Fork me on GitHub
#dirac
<
2019-10-25
>
tekacs00:10:35

So I’m trying to use dirac, shadow-cljs and deps.edn together — I’ll completely understand if it’s too far from the supported path. I’m getting pretty far, but I’m getting tripped up during bootstrap on the following issue: Assert failed: (set? ns-roots)

tekacs00:10:43

I’ll try debugging myself some more, but I’ve included full logs from everywhere I could find in the snippet above. (except the Chrome DevTools, where I can confirm that Dirac is making its presence known — I’ll paste that too)

tekacs00:10:51

Any help would be appreciated :)

tekacs01:10:44

I guess folks didn’t have any luck so far @julien.rouse @darwin?

tekacs01:10:58

I’m curious if my (huge) snippet above is of any use in debugging, or if there’s steps that I can take to trace this back — I’m happy to dig into the error in more depth, only any pointers as to what might be causing it would help. 🙂

superstructor09:10:35

@tekacs my impression is dirac/shadow-cljs integration needs significant expert (e.g. @darwin / @thheller) development work. See their discussion on #shadow-cljs earlier. Looks very promising steps forward but its early days and certainly not usable just by configuration at this point.

darwin12:10:01

@tekacs in nutshell, dirac needs a clojurescript compiler to turn your REPL commands into js code to be evaluated in javascript context (in the browser), under normal circumstances it uses cljs compiler with blank state or if it detects figwheel, it uses cljs compiler with figwheel’s cljs compiler state (see [1] for mote details). Dirac uses cljs compiler through cljs.repl API[2]. And this is the problem. Shadow cljs wraps cljs compiler with its own modifications and does not support cljs.repl, it has its own custom REPL apis. This is why your setup throws. Dirac middleware tries to compile cljs code via cljs.repl API and fails, because shadow cljs monkey patching is not expecting entering via cljs.repl codepath (my assumption). It is unlikely for shadow-cljs to add support for cljs.repl. The only way forward is for Dirac to start using shadow-cljs repl apis. And this will be quite some work and maintenance for me going forward. [1] https://github.com/binaryage/dirac/blob/master/docs/about-repls.md#dirac--figwheel [2] https://github.com/binaryage/dirac/blob/master/src/nrepl/dirac/nrepl/eval.clj

tekacs16:10:20

Understood, thanks very much for explaining, both of you!

tekacs16:10:01

The Dirac (and associated libraries’) code is pretty manageable, so I could look into a patch now that I have a sense of where to start, but let me double check how/whether shadow-cljs stays in this workflow. :)

darwin16:10:23

Thanks for your help offer I wanted to look into this over the weekend. I think I will be able to implement initial support. I guess two things will be needed: 1) implementing shadow-cljs detection and interface which will use shadow-cljs dynamically (not as a hard dependency), see how figwheel detection is done[1] 2) implementing support for shadow-cljs code-path in dirac.nrepl.eval - I think I could be still able to implement it as a cljs.repl shim, so that code won’t change much, I will just call corresponding shadow cljs repl api to compile cljs code to javascript [1] https://github.com/binaryage/dirac/blob/master/src/nrepl/dirac/nrepl/figwheel.clj

darwin16:10:23

I think the meat is here: https://github.com/binaryage/dirac/blob/master/src/nrepl/dirac/nrepl/eval.clj#L176-L177 this needs to be done via shadow repl api

darwin17:10:11

yes, from recent discussion with @thheller in #shadow-cljs it looks like we can almost use it as-is, and he is willing to add support for missing stuff, we will definitely need some way how to pass :locals into cljs compiler which is not currently exposed AFAICT