Fork me on GitHub
#shadow-cljs
<
2019-02-04
>
Karol Wójcik12:02:18

Is there some example project which uses shadow-cljs with leiningen instead of shadow-cljs with npm?

thheller12:02:31

@kwcharllie379 do you mean completely without npm or just managing dependencies with lein?

Karol Wójcik12:02:27

I would like to manage dependencies with lein and also be able to attach dirac agent

thheller12:02:53

dirac is not supported I think

Karol Wójcik12:02:32

Is there way to attach it somehow? via repl-options?

Karol Wójcik12:02:43

Or should I stick to devtools for now?

thheller12:02:40

I don't know. never used dirac, dont' know how it works

thheller12:02:50

yeah not quite. it requires server-side support and that part I have no idea about

thheller12:02:21

but last time I checked it interfaced directly with cljs.analyzer and stuff

thheller12:02:53

so shadow-cljs is out of the picture at that point

thheller12:02:43

maybe it would work. I don't know, someone else would need to dig into it a bit

darwin17:02:55

hi, maybe I could shed some light on it, dirac agent is non-issue, it is just a proxy between nrepl server and dirac’s client in web browser, the problem is nrepl middleware responsible for translating clojurescript to javascript on server side, shadow-cljs uses their own middleware (originally forked from piggieback), dirac uses their own middleware - dirac would have switch using shadow-cljs middleware for this job

thheller17:02:46

nothing ever forked from piggieback in shadow-cljs 😉

thheller17:02:00

I'm just trying to emulate it so other tools are happy 😉

darwin17:02:31

I guess I had a similar issue with figweel, I wanted to use it’s cljs compiler state to drive evals of cljs code coming from dirac REPL

thheller17:02:36

@darwin what do you actually need for dirac though? I'd expect that access to the compiler env is enough?

darwin17:02:46

I had to do some glue code to bridge it

thheller17:02:34

yeah I couldn't follow those graphs. didn't compute in my head.

darwin17:02:09

yep, it gets too complex, even I cannot keep it in my brain RAM

thheller17:02:55

not quite sure why you doing all this nrepl mess when you are running something in the same VM already

thheller17:02:16

(diract.agent/boot! {:eval-fn ... :env compiler-env-atom}) seems to me like it would be

thheller17:02:27

seems like those are the only two things you need

darwin17:02:33

just correction, I wanted to write that dirac middleware was forked from piggieback, did a wrong edit there ^ 🙂

thheller17:02:38

eval-fn as a function taking a string or form and returning the result

thheller17:02:46

not sure why the whole nrepl stuff is necessary but I honestly don't know at all what you do so you probably have your reasons 🙂

darwin17:02:56

I don’t remember the reasons, but the thing was created without prior design incrementally, the figwheel support was added later

darwin17:02:37

I started with piggieback + nrepl proxy (dirac agent) until I realized it won’t work in some cases and then I needed to rewrite it

darwin17:02:27

dirac agent does not necessary need to run inside the same JVM, only nrepl middleware has to

thheller17:02:13

well how often is that important 😉

darwin17:02:42

btw. here it the high-level code responsible for eval: https://github.com/binaryage/dirac/blob/master/src/nrepl/dirac/nrepl/utils.clj#L121 I need cljs compiler which is either normal cljs or figwheel, compiler env is part of nREPL session state I believe (same what piggieback does)