funcool / cuerdas

String manipulation library for Clojure(Script)
https://cljdoc.org/d/funcool/cuerdas/2020.03.26-3/
BSD 2-Clause "Simplified" License
304 stars 30 forks source link

Version 2.1.0 cannot be compiled in CLJS #71

Closed serioga closed 5 years ago

serioga commented 5 years ago

Upgraded from 2.0.6 and get error


----  Could not Analyze  resources/public/app/ok/cuerdas/regexp.cljc  ----                                         

  No such namespace: xregexp, could not locate xregexp.cljs, xregexp.cljc, or JavaScript source providing "xregexp"

----  Analysis Error : Please see resources/public/app/ok/cuerdas/regexp.cljc  ----                                
Figwheel: initial compile failed - outputting temporary helper application to resources/public/app/ok.js```
niwinz commented 5 years ago

which cljs compiler version you are using?

serioga commented 5 years ago
[org.clojure/clojurescript "1.10.439"]
[figwheel-sidecar "0.5.18"]
alexandergunnarson commented 5 years ago

This is related to https://github.com/funcool/cuerdas/issues/54 in which I posted a minimal example to reproduce this.

darwin commented 5 years ago

@niwinz Looking at https://github.com/funcool/cuerdas/commit/a8443724e22435e052af4149b27dd2169f3216ac. It looks to me that you assume :install-deps to be enabled by default in projects consuming cuerdas. But I'm afraid that is not the case. People with existing projects who simply bump their dependency without explicitly adding :npm-deps {:xregexp "4.2.0"} or :install-deps true will hit this issue.

And even adding :install-deps true to my cljsbuild config breaks with 1.10.439:

Compiling ["test/browser/fixtures/resources/.compiled/scenarios03/main.js"] failed.
java.lang.IllegalArgumentException: contains? not supported on type: java.lang.Boolean
    at clojure.lang.RT.contains(RT.java:849)
    at clojure.core$contains_QMARK_.invokeStatic(core.clj:1492)
    at clojure.core$contains_QMARK_.invoke(core.clj:1484)
    at cljs.closure$compute_upstream_npm_deps$fn__5852.invoke(closure.clj:2343)
    at clojure.core.protocols$iter_reduce.invokeStatic(protocols.clj:49)
    at clojure.core.protocols$fn__8125.invokeStatic(protocols.clj:75)
    at clojure.core.protocols$fn__8125.invoke(protocols.clj:75)
    at clojure.core.protocols$fn__8073$G__8068__8086.invoke(protocols.clj:13)
    at clojure.core$reduce.invokeStatic(core.clj:6828)
    at clojure.core$reduce.invoke(core.clj:6810)
    at cljs.closure$compute_upstream_npm_deps.invokeStatic(closure.clj:2340)
    at cljs.closure$compute_upstream_npm_deps.invoke(closure.clj:2333)
    at cljs.closure$maybe_install_node_deps_BANG_.invokeStatic(closure.clj:2475)
    at cljs.closure$maybe_install_node_deps_BANG_.invoke(closure.clj:2473)
    at cljs.closure$build$fn__6107.invoke(closure.clj:2927)
    at clojure.lang.AFn.applyToHelper(AFn.java:154)
    at clojure.lang.AFn.applyTo(AFn.java:144)
    at clojure.core$apply.invokeStatic(core.clj:667)
    at clojure.core$update_in$up__6838.invoke(core.clj:6185)
    at clojure.core$update_in.invokeStatic(core.clj:6186)
    at clojure.core$update_in.doInvoke(core.clj:6172)
    at clojure.lang.RestFn.invoke(RestFn.java:445)
    at clojure.lang.Atom.swap(Atom.java:65)
    at clojure.core$swap_BANG_.invokeStatic(core.clj:2354)
    at clojure.core$swap_BANG_.invoke(core.clj:2345)
    at cljs.closure$build.invokeStatic(closure.clj:2924)
    at cljs.closure$build.invoke(closure.clj:2903)
    at cljs.build.api$build.invokeStatic(api.clj:208)
    at cljs.build.api$build.invoke(api.clj:189)
    at cljs.build.api$build.invokeStatic(api.clj:195)
    at cljs.build.api$build.invoke(api.clj:189)
    at cljsbuild.compiler$compile_cljs$fn__850.invoke(compiler.clj:61)
    at cljsbuild.compiler$compile_cljs.invokeStatic(compiler.clj:60)
    at cljsbuild.compiler$compile_cljs.invoke(compiler.clj:48)
    at cljsbuild.compiler$run_compiler.invokeStatic(compiler.clj:168)
    at cljsbuild.compiler$run_compiler.invoke(compiler.clj:129)
    at user$eval979$iter__1027__1031$fn__1032$fn__1058.invoke(4bbe473181edb320e0ea08c3f4d192891cd96cca-init.clj:1)
    at user$eval979$iter__1027__1031$fn__1032.invoke(4bbe473181edb320e0ea08c3f4d192891cd96cca-init.clj:1)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:51)
    at clojure.lang.RT.seq(RT.java:531)
    at clojure.core$seq__5387.invokeStatic(core.clj:137)
    at clojure.core$dorun.invokeStatic(core.clj:3133)
    at clojure.core$doall.invokeStatic(core.clj:3148)
    at clojure.core$doall.invoke(core.clj:3148)
    at user$eval979.invokeStatic(4bbe473181edb320e0ea08c3f4d192891cd96cca-init.clj:1)
    at user$eval979.invoke(4bbe473181edb320e0ea08c3f4d192891cd96cca-init.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:7176)
    at clojure.lang.Compiler.eval(Compiler.java:7166)
    at clojure.lang.Compiler.load(Compiler.java:7635)
    at clojure.lang.Compiler.loadFile(Compiler.java:7573)
    at clojure.main$load_script.invokeStatic(main.clj:452)
    at clojure.main$init_opt.invokeStatic(main.clj:454)
    at clojure.main$init_opt.invoke(main.clj:454)
    at clojure.main$initialize.invokeStatic(main.clj:485)
    at clojure.main$null_opt.invokeStatic(main.clj:519)
    at clojure.main$null_opt.invoke(main.clj:516)
    at clojure.main$main.invokeStatic(main.clj:598)
    at clojure.main$main.doInvoke(main.clj:561)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.lang.Var.applyTo(Var.java:705)
    at clojure.main.main(main.java:37)

This looks like some internal issue with cljs npm machinery.

niwinz commented 5 years ago

Hmm, I think i will revert the change of using npm-deps. I'm also found similar problems in my other projects using npm-deps, that seems not working well enough.

niwinz commented 5 years ago

released 2.2.0 with that change reverted and deps updated.

alexandergunnarson commented 5 years ago

Yeah npm-deps doesn't really work with some of my projects either. Thanks @niwinz!