thheller / shadow-cljs

ClojureScript compilation made easy
https://github.com/thheller/shadow-cljs
Eclipse Public License 1.0
2.23k stars 173 forks source link

2.26.5 incorrectly tagging @dagrejs/dagre npm module js file as es3 #1168

Closed zk closed 5 months ago

zk commented 5 months ago

Hey Thomas,

Ran into this this morning, I think what's going on is JsInspector.java is classifying this file as es3 instead of es6 (see :js-language).

Caused by:
ExceptionInfo errors in file: /Users/zk/code/figment/node_modules/@dagrejs/graphlib/lib/graph.js {:tag :shadow.build.npm/file-info-errors, :info {:js-str-offsets [], :js-esm false, :js-imports [], :js-invalid-requires [], :goog-provides [], :js-language "es3", :goog-module nil, :goog-module-legacy-namespace false, :js-warnings [], :js-requires [], :js-errors [{:line 18, :column 2, :message "'}' expected"}], :goog-requires [], :goog-require-types [], :uses-global-buffer false, :uses-global-process false}, :file #object[java.io.File 0x7f509d05 "/Users/zk/code/figment/node_modules/@dagrejs/graphlib/lib/graph.js"]}

Full trace here

I'm happy to take a stab at a fix PR if that's helpful.

Repro repo here: https://github.com/zk/zk-shadow-cljs-bug-fix

Shadow info:

=== npm package
cli:                  2.26.5
config-version:       2.26.5

=== shadow-cljs version (via npm)
shadow-cljs version:  2.26.5

=== Java
openjdk version "21.0.1" 2023-10-17
OpenJDK Runtime Environment Homebrew (build 21.0.1)
OpenJDK 64-Bit Server VM Homebrew (build 21.0.1, mixed mode, sharing)

=== Source Paths
/Users/zk/code/zk-shadow-cljs-bug-fix/src/dev
/Users/zk/code/zk-shadow-cljs-bug-fix/src/main
/Users/zk/code/zk-shadow-cljs-bug-fix/src/test

=== Dependencies
[thheller/shadow-cljs "2.26.5" :classifier "aot"]
[com.bhauman/cljs-test-display "0.1.1"]
[cider/piggieback "0.5.3" :exclusions [[org.clojure/clojure] [org.clojure/clojurescript] [nrepl]]]
[io.methvin/directory-watcher "0.17.1"]
  [net.java.dev.jna/jna "5.12.1"]
  [org.slf4j/slf4j-api "1.7.36"]
[org.clojure/clojure "1.11.1"]
  [org.clojure/core.specs.alpha "0.2.62"]
  [org.clojure/spec.alpha "0.3.218"]
[com.cognitect/transit-cljs "0.8.280"]
  [com.cognitect/transit-js "0.8.874"]
[org.clojure/google-closure-library "0.0-20230227-c7c0a541"]
[thheller/shadow-cljsjs "0.0.22"]
[org.clojure/core.async "1.5.648"]
  [org.clojure/tools.analyzer.jvm "1.2.2"]
    [org.clojure/core.memoize "1.0.253"]
      [org.clojure/core.cache "1.0.225"]
        [org.clojure/data.priority-map "1.1.0"]
    [org.clojure/tools.analyzer "1.1.0"]
    [org.ow2.asm/asm "9.2"]
[thheller/shadow-undertow "0.3.4"]
  [io.undertow/undertow-core "2.3.10.Final"]
    [org.jboss.logging/jboss-logging "3.4.3.Final"]
    [org.jboss.threads/jboss-threads "3.5.0.Final" :exclusions [[org.wildfly.common/wildfly-common]]]
    [org.jboss.xnio/xnio-api "3.8.8.Final" :exclusions [[org.jboss.threads/jboss-threads]]]
      [org.wildfly.client/wildfly-client-config "1.0.1.Final" :exclusions [[org.wildfly.common/wildfly-common]]]
      [org.wildfly.common/wildfly-common "1.5.4.Final"]
    [org.jboss.xnio/xnio-nio "3.8.8.Final" :scope "runtime" :exclusions [[org.wildfly.common/wildfly-common]]]
[com.google.javascript/closure-compiler-unshaded "v20230802"]
  [com.google.code.gson/gson "2.9.1"]
  [com.google.guava/guava "31.0.1-jre"]
    [com.google.code.findbugs/jsr305 "3.0.2"]
    [com.google.guava/listenablefuture "9999.0-empty-to-avoid-conflict-with-guava"]
    [com.google.j2objc/j2objc-annotations "1.3"]
    [org.checkerframework/checker-qual "3.12.0"]
  [com.google.guava/failureaccess "1.0.1"]
  [org.jspecify/jspecify "0.2.0"]
  [com.google.auto.value/auto-value-annotations "1.6"]
  [javax.annotation/jsr250-api "1.0"]
  [args4j "2.33"]
  [com.google.errorprone/error_prone_annotations "2.15.0"]
  [com.google.protobuf/protobuf-java "3.21.12"]
  [org.apache.ant/ant "1.10.11"]
    [org.apache.ant/ant-launcher "1.10.11"]
  [com.google.re2j/re2j "1.3"]
[ring/ring-core "1.9.6" :exclusions [[clj-time]]]
  [commons-fileupload "1.4"]
  [commons-io "2.11.0"]
  [crypto-equality "1.0.1"]
  [crypto-random "1.2.1"]
    [commons-codec "1.15"]
  [ring/ring-codec "1.2.0"]
[hiccup "1.0.5"]
[org.clojure/tools.reader "1.3.7"]
[thheller/shadow-client "1.3.3"]
[fipp "0.6.26"]
  [org.clojure/core.rrb-vector "0.1.2"]
[org.clojure/google-closure-library-third-party "0.0-20230227-c7c0a541"]
[org.clojure/clojurescript "1.11.60" :exclusions [[com.google.javascript/closure-compiler-unshaded] [org.clojure/google-closure-library] [org.clojure/google-closure-library-third-party]]]
[org.clojure/tools.cli "1.0.206"]
[org.clojure/data.json "2.4.0"]
[nrepl "1.0.0"]
[com.cognitect/transit-clj "1.0.329"]
  [com.cognitect/transit-java "1.0.362"]
    [com.fasterxml.jackson.core/jackson-core "2.8.7"]
    [javax.xml.bind/jaxb-api "2.3.0"]
    [org.msgpack/msgpack "0.6.12"]
      [com.googlecode.json-simple/json-simple "1.1.1" :exclusions [[junit]]]
      [org.javassist/javassist "3.18.1-GA"]
[expound "0.9.0"]
[thheller/shadow-util "0.7.0"]
thheller commented 5 months ago

The Closure Compiler doesn't support the syntax for private properties and thus chokes on #isDirected. Fix has been pending for a very long time now and nothing I can do it from the shadow-cljs side unfortunately. :js-language is irrelevant here.

See https://github.com/google/closure-compiler/issues/2731

zk commented 5 months ago

Ah my mistake, thought it was choking on the ‘class’ reserved word. Thanks for checking.