ClojureScript

Mishandling of :npm-deps Boolean value computing upstream deps

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

cljs.closure/compute-upstream-npm-deps mishandles the case when the :npm-deps value is not a map but a Boolean.

Repro

deps.edn
{:deps {org.clojure/clojurescript {:mvn/version "1.10.439"}
        upstream-lib {:local/root "./upstream-lib"}}}
upstream-lib/deps.edn
{:paths ["."]}
upstream-lib/deps.cljs
{:npm-deps {:left-pad "1.3.0"}}

Then executing

clj -Srepro -m cljs.main -co '{:install-deps true}'

results in

Exception in thread "main" java.lang.IllegalArgumentException: contains? not supported on type: java.lang.Boolean
	at clojure.lang.RT.contains(RT.java:846)
	at clojure.core$contains_QMARK_.invokeStatic(core.clj:1484)
	at clojure.core$contains_QMARK_.invoke(core.clj:1476)
	at cljs.closure$compute_upstream_npm_deps$fn__5780.invoke(closure.clj:2343)
	at clojure.core.protocols$iter_reduce.invokeStatic(protocols.clj:49)
	at clojure.core.protocols$fn__7839.invokeStatic(protocols.clj:75)
	at clojure.core.protocols$fn__7839.invoke(protocols.clj:75)
	at clojure.core.protocols$fn__7781$G__7776__7794.invoke(protocols.clj:13)
	at clojure.core$reduce.invokeStatic(core.clj:6748)
	at clojure.core$reduce.invoke(core.clj:6730)
	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__6035.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:659)
	at clojure.core$update_in$up__6562.invoke(core.clj:6105)
	at clojure.core$update_in.invokeStatic(core.clj:6106)
	at clojure.core$update_in.doInvoke(core.clj:6092)
	at clojure.lang.RestFn.invoke(RestFn.java:445)
	at clojure.lang.Atom.swap(Atom.java:65)
	at clojure.core$swap_BANG_.invokeStatic(core.clj:2346)
	at clojure.core$swap_BANG_.invoke(core.clj:2337)
	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 cljs.repl.browser$setup$fn__7555.invoke(browser.clj:352)
	at cljs.repl.browser$setup.invokeStatic(browser.clj:332)
	at cljs.repl.browser$setup.invoke(browser.clj:331)
	at cljs.repl.browser.BrowserEnv._setup(browser.clj:367)
	at cljs.repl$setup.invokeStatic(repl.cljc:129)
	at cljs.repl$setup.invoke(repl.cljc:128)
	at cljs.cli$default_main$fn__6916.invoke(cli.clj:354)
	at cljs.compiler$with_core_cljs.invokeStatic(compiler.cljc:1416)
	at cljs.compiler$with_core_cljs.invoke(compiler.cljc:1405)
	at cljs.compiler.api$with_core_cljs.invokeStatic(api.clj:50)
	at cljs.compiler.api$with_core_cljs.invoke(api.clj:34)
	at cljs.compiler.api$with_core_cljs.invokeStatic(api.clj:42)
	at cljs.compiler.api$with_core_cljs.invoke(api.clj:34)
	at cljs.cli$default_main.invokeStatic(cli.clj:351)
	at cljs.cli$default_main.invoke(cli.clj:324)
	at cljs.cli$null_opt.invokeStatic(cli.clj:422)
	at cljs.cli$null_opt.invoke(cli.clj:419)
	at cljs.cli$main.invokeStatic(cli.clj:646)
	at cljs.cli$main.doInvoke(cli.clj:635)
	at clojure.lang.RestFn.applyTo(RestFn.java:139)
	at clojure.core$apply.invokeStatic(core.clj:659)
	at clojure.core$apply.invoke(core.clj:652)
	at cljs.main$_main.invokeStatic(main.clj:61)
	at cljs.main$_main.doInvoke(main.clj:52)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.lang.Var.applyTo(Var.java:702)
	at clojure.core$apply.invokeStatic(core.clj:657)
	at clojure.main$main_opt.invokeStatic(main.clj:317)
	at clojure.main$main_opt.invoke(main.clj:313)
	at clojure.main$main.invokeStatic(main.clj:424)
	at clojure.main$main.doInvoke(main.clj:387)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.lang.Var.applyTo(Var.java:702)
	at clojure.main.main(main.java:37)

Note that this is not a really a regression introduced with CLJS-2904 because you can repro it with 1.10.339 via by executing:

clj -Srepro -m cljs.main -co '{:install-deps true :npm-deps false}'

Workaround

Specify :npm-deps as an empty map instead of letting it default to true

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: