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.
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.
hmm what are you using to analyze the project?
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 <http://clojure.java.io|clojure.java.io>)
(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 (<http://clojure.java.io/resource|clojure.java.io/resource> "helix/dom.cljs")
(<http://clojure.java.io/resource|clojure.java.io/resource> "helix/dom.cljc"))
opts4)
(this is quasiquoted so a bit ugly, sorry)
Do I need to pass any options to the analyser to use node-style interop forms?
I’ll ask this over in #cljs-dev too.
@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.
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.
The analyser code above is executed in a process with the CWD set to the project root.
@cfleming clojurescript should search the node_modules directly for react, so I'm not sure why it wouldn't pick it up.
Does the analyzer need an option passed to it to do that?
Maybe :npm-deps true
, but I thought it was default.
Yeah, I just tried that and adding it doesn’t help.
I don't suppose your cljs version is really old? 😄
Hehe, well, it uses whatever helix-todo-mvc is using.
https://clojurescript.org/reference/compiler-options#npm-deps looks like :npm-deps true
is necessary.
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.
I’m using (cljs.closure/add-implicit-options {:cache-analysis false, :npm-deps true})
but I’m still getting that error.
But it’s finding and invoking the analyzer fine.
Yeah, shadow pulls in cljs, with the analyzer
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.
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.