Hello. Is there a way to have an nrepl for squint in browser?
@alexander.scherbanov_ Sadly not yet. I have a branch where I have this working, but it's limited to one namespace. I need to put more work into this first to make it consumable for a broader audience
@borkdude, how about a quick hack? A script on the page could open a websocket connection to a locally running app in terminal, which acts as a repl, compiling and sending code to the page. The isend-mode would be enough for me, I believe. Would this work?
yes, that quick hack is basically what I did :)
let me look up the branch
here's an example app that uses it: https://github.com/squint-cljs/squint/commit/f468c1bbe5a479243708dc9d1f86f6f4a894841c
you need to include this bit in your app: https://github.com/squint-cljs/squint/blob/f468c1bbe5a479243708dc9d1f86f6f4a894841c/examples/browser-repl/js/nrepl.js
I could have another go at this but at that point I just had a POC working
That's cool, thanks. How hard would it be to circumvent this limitation of one namespace?
I mean, I've never seen the codebase, how hard it would be for me if I wanted to contribute?
@alexander.scherbanov_ I hope it shouldn't be too difficult but there are two main challenges. 1. All requires files (transitively) that have changed should also be sent along to the browser. 2. Requiring node libraries should somehow be converted as well to something that can be sent to the browser. Both changes should (I think happen) in the nrepl server
Hm. I'm not sure I follow. I'd like to send pieces of code for a very basic repl-workflow, when I start with data and then write code around it, and then define a function. Is sending all transitive requires files and node libraries necessary for this?
Consider this:
(ns foo
(:require ["d3" :as d3]
[another-namespace :as a]))
(d3/whatever (a/foo))
If you would like to evaluate (d3/whatever (a/foo)) in the browser, what do you think should happen to accomplish this?Oh, do you mean the namespaces are not implemented yet? I thought it's a limitation of the repl. If so, that's fine. Basically, I'd like a lightweight tool for repl in js.
that's basically what I had in the POC yes