Fork me on GitHub
#helix
<
2020-08-28
>
cfleming02:08:11

Hi everyone, I’m trying to implement support for helix in Cursive, per: https://github.com/cursive-ide/cursive/issues/2330. When Cursive analyses helix.core, I’m getting an error: /_SLASH_impl_SLASH_class/js.cljs is not a relative path in file file:/Users/colin/.m2/repository/lilactown/helix/0.0.10/helix-0.0.10.jar!/helix/core.cljs. Has anyone seen this error, or have any idea what it might mean? It’s coming from deep inside some generated code, but as far as I can tell the generated code should be good and I haven’t had problems like this analysing other CLJS projects.

cfleming02:08:07

Oh wait, it looks like the problem might be with ["./impl/class.js" :as helix.class], although I have no idea what that problem might be.

lilactown04:08:35

hmm what are you using to analyze the project?

cfleming06:08:17

I’m using the analyser directly, it looks like this:

(do
  (clojure.core/require (quote cljs.closure)
                        (quote cljs.env)
                        (quote cljs.analyzer.api)
                        (quote clojure.string)
                        (quote )
                        (quote clojure.walk))
  (clojure.core/let [opts4 (cljs.closure/add-implicit-options {:cache-analysis false})
                     state5 (cljs.env/default-compiler-env opts4)]
    (cljs.analyzer.api/analyze-file state5 "cljs/core.cljs" opts4)
    (cljs.analyzer.api/analyze-file state5 (clojure.core/or ( "helix/dom.cljs")
                                                            ( "helix/dom.cljc"))
                                    opts4)

cfleming06:08:33

(this is quasiquoted so a bit ugly, sorry)

cfleming06:08:06

Do I need to pass any options to the analyser to use node-style interop forms?

cfleming06:08:34

I’ll ask this over in #cljs-dev too.

dominicm07:08:20

@cfleming 0.0.10 had shadow specific code in it. That line doesn't work with the clojurescript analyzer. That's now fixed in a newer version and it works with clojurescript analyzer.

cfleming08:08:48

Thanks @dominicm, upgrading to 0.0.13 fixes that. I now get another error: No such namespace: react, could not locate react.cljs, react.cljc, or JavaScript source providing "react" in file file:/Users/colin/.m2/repository/lilactown/helix/0.0.13/helix-0.0.13.jar!/helix/core.cljs. Any idea what that might be about? This is with helix-todo-mvc, but with the helix dep upgraded as above. React is installed in node_modules but I can’t see anything react-related in the CLJS deps.

cfleming08:08:08

The analyser code above is executed in a process with the CWD set to the project root.

dominicm08:08:27

@cfleming clojurescript should search the node_modules directly for react, so I'm not sure why it wouldn't pick it up.

cfleming08:08:48

Does the analyzer need an option passed to it to do that?

dominicm08:08:50

Maybe :npm-deps true, but I thought it was default.

cfleming08:08:09

Yeah, I just tried that and adding it doesn’t help.

dominicm08:08:34

I don't suppose your cljs version is really old? 😄

cfleming08:08:03

Hehe, well, it uses whatever helix-todo-mvc is using.

dominicm08:08:19

https://github.com/lilactown/helix-todo-mvc/blob/master/deps.edn there's no dependency on clojurescript, so it might be that you're trying to use the cljs analyzer, and this project uses shadow. But I don't know anything about that tbh.

cfleming08:08:07

I’m using (cljs.closure/add-implicit-options {:cache-analysis false, :npm-deps true}) but I’m still getting that error.

cfleming08:08:36

But it’s finding and invoking the analyzer fine.

cfleming08:08:07

Yeah, shadow pulls in cljs, with the analyzer

cfleming21:08:09

I neglected to provide a final update last night, after digging around with thheller a lot last night, with his help I managed to figure out the problem and find code I can use to fix it in cljdoc.

3
dominicm22:08:01

That would be the code used to fake foreign libs when they're not present. I still don't understand why they're not present for you. Maybe the api you're using skips that part.