In Cursive, I call the analyser directly in order to generate function stubs for some namespaces that are hard to index via static analysis. I’m having problems doing this with helix, because it contains a require like: ["./impl/class.js" :as helix.class]
. I’m getting an exception when analysing that: /_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
. My analysis code looks like this (quasiquoted so a bit ugly, sorry):
(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)
Do I need to pass any options to the analyser to use node-style dependencies like that?Actually, digging around a bit it looks like that relative path syntax might only be supported by Shadow, is that true @thheller?
Yes, I added that as a simple way to include local JS that "just works". See https://shadow-cljs.github.io/docs/UsersGuide.html#classpath-js
Yep!
Problem solved, that was indeed it.
Does ClojureScript encourage the unsatisfied arguments ? Like a function that takes argument and in the function body, it was just ignored when none given. It takes null/nil, and programming on this idea. Are we really OK with that ?
That's how JavaScript works. The compiler warns about this though.