Skip to content

Commit

Permalink
cljs bump 1.10.891 + various closure updates
Browse files Browse the repository at this point in the history
  • Loading branch information
thheller committed Nov 4, 2021
1 parent 4530ed1 commit 7fefe5b
Show file tree
Hide file tree
Showing 14 changed files with 277 additions and 205 deletions.
8 changes: 4 additions & 4 deletions project.clj
Expand Up @@ -37,16 +37,16 @@
[org.clojure/core.async "1.3.618"]

;; hack to get the latest closure-compiler if CLJS doesn't have it
[org.clojure/clojurescript "1.10.879"
[org.clojure/clojurescript "1.10.891"
:exclusions
[com.google.javascript/closure-compiler-unshaded
org.clojure/google-closure-library
org.clojure/google-closure-library-third-party]]

[com.google.javascript/closure-compiler-unshaded "v20210505"]
[com.google.javascript/closure-compiler-unshaded "v20211006"]

[org.clojure/google-closure-library "0.0-20201211-3e6c510d"]
[org.clojure/google-closure-library-third-party "0.0-20201211-3e6c510d"]
[org.clojure/google-closure-library "0.0-20211011-0726fdeb"]
[org.clojure/google-closure-library-third-party "0.0-20211011-0726fdeb"]

[thheller/shadow-util "0.7.0"]
[thheller/shadow-client "1.3.3"]
Expand Down
3 changes: 2 additions & 1 deletion shadow-cljs.edn
Expand Up @@ -135,14 +135,15 @@
:compiler-options
{;; :strip-type-prefixes #{"cljs.pprint"}
:shadow-keywords true
:global-goog-object&array true
;; :output-feature-set :es6
;; :output-wrapper false
;; :closure-output-charset "US-ASCII"
:closure-defines
{demo.browser/FOO "bar"}}

:build-hooks
[;; (shadow.build/tap-hook)
[(shadow.build/tap-hook)
(shadow.cljs.build-report/hook)
(shadow.html/copy-file
"out/demo-browser/index.src.html"
Expand Down
12 changes: 8 additions & 4 deletions src/dev/demo/browser.cljs
Expand Up @@ -21,9 +21,13 @@
["./cjs.js" :as cjs]
[demo.js-class :refer (Foo)]
[demo.dummy-cljc]
[demo.didnt-follow-the-rules :as rule-breaker]
))
[demo.didnt-follow-the-rules :as rule-breaker])
(:import [goog.module ModuleLoader]))

(js/console.log (goog.object/get #js {:foo "foo"} "foo"))


(js/console.log "ml" ModuleLoader)
(js/console.log "es6" es6 es6/default)

;; (throw (js/Error. "foo"))
Expand Down Expand Up @@ -137,9 +141,9 @@
(done))
10))

(defrecord Foo [a b])
(defrecord Rec [a b])

(js/console.log (pr-str Foo) (pr-str (Foo. 1 2)) (Foo. 1 2))
(js/console.log (pr-str Rec) (pr-str (Rec. 1 2)) (Rec. 1 2))

(js/console.log "test-macro" (test-macro 1 2 3))

Expand Down
2 changes: 1 addition & 1 deletion src/main/com/google/javascript/jscomp/ShadowAccess.java
Expand Up @@ -19,7 +19,7 @@ public static void reportChangeToEnclosingScope(AbstractCompiler comp, Node node
comp.reportChangeToEnclosingScope(node);
}

public static JSModuleGraph getModuleGraph(AbstractCompiler compiler) {
public static JSChunkGraph getModuleGraph(AbstractCompiler compiler) {
return compiler.getModuleGraph();
}

Expand Down
4 changes: 0 additions & 4 deletions src/main/com/google/javascript/jscomp/ShadowCompiler.java
Expand Up @@ -24,10 +24,6 @@ public ShadowCompiler(ErrorManager errorManager) {
super(errorManager);
}

public void justSetOptions(CompilerOptions opts) {
this.options = opts;
}

/**
* fixing https://github.com/google/closure-compiler/issues/3825 by removing relative path logic
* the inputs provided by shadow-cljs always use the full name and as such don't need that logic
Expand Down
17 changes: 11 additions & 6 deletions src/main/shadow/build/classpath.clj
Expand Up @@ -94,6 +94,7 @@
js-language
js-str-offsets
goog-module
goog-module-legacy-namespace
goog-requires
goog-provides]
:as info}
Expand All @@ -102,10 +103,7 @@
;; SourceFile/fromFile seems to leak file descriptors
(SourceFile/fromCode resource-name source))

rc (assoc rc :inspect-info info)

ns (-> (ModuleNames/fileToModuleName resource-name)
(symbol))]
rc (assoc rc :inspect-info info)]

(cond
;; goog.provide('thing')
Expand Down Expand Up @@ -139,7 +137,9 @@
:deps deps)
(cond->
(seq goog-module)
(-> (assoc :goog-module true
(-> (assoc :ns (util/munge-goog-ns goog-module)
:goog-module goog-module
:goog-module-legacy-namespace goog-module-legacy-namespace
:goog-src (str/starts-with? goog-module "goog."))
(update :provides conj (util/munge-goog-ns goog-module) (symbol goog-module)))

Expand All @@ -163,7 +163,12 @@
(:uses-global-buffer info)
(conj "buffer")
(:uses-global-process info)
(conj "process"))]
(conj "process"))

ns
(-> (ModuleNames/fileToModuleName resource-name)
(symbol))]


(-> info
(merge rc)
Expand Down
13 changes: 11 additions & 2 deletions src/main/shadow/build/cljs_bridge.clj
Expand Up @@ -105,9 +105,18 @@
(map #(get-in state [:sources %]))
(filter #(= :goog (:type %)))
(map :provides)
(reduce set/union #{}))]
(reduce set/union #{}))

(assoc-in state [:compiler-env :goog-names] goog-names)))
goog-modules
(->> (:build-sources state)
(map #(get-in state [:sources %]))
(filter :goog-module)
(map :ns)
(set))]

(-> state
(assoc-in [:compiler-env :goog-names] goog-names)
(assoc-in [:compiler-env :goog-modules] goog-modules))))

(def ^:dynamic *in-compiler-env* false)

Expand Down

0 comments on commit 7fefe5b

Please sign in to comment.