File tree Expand file tree Collapse file tree 3 files changed +22
-4
lines changed
test/clojure/cljs/compiler Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change 815815(defn goog-module-dep?
816816 [module]
817817 (let [[module _] (lib&sublib module)
818- module-type (get-in @env/*compiler* [:js-dependency-index (str module) :module ])]
819- (= :goog module-type)))
818+ module-str (str module)
819+ options (compiler-options )]
820+ ; ; CLJS-3330: flag for loading some old things in the old way to give time
821+ ; ; for library authors to migrate
822+ (if (and (:global-goog-object&array options)
823+ (#{" goog.object" " goog.array" } module-str))
824+ false
825+ (= :goog (get-in @env/*compiler* [:js-dependency-index module-str :module ])))))
820826
821827(defn confirm-var-exists
822828 ([env prefix suffix]
Original file line number Diff line number Diff line change 213213 :watch :watch-error-fn :watch-fn :install-deps :process-shim :rename-prefix :rename-prefix-namespace
214214 :closure-variable-map-in :closure-property-map-in :closure-variable-map-out :closure-property-map-out
215215 :stable-names :ignore-js-module-exts :opts-cache :aot-cache :elide-strict :fingerprint :spec-skip-macros
216- :nodejs-rt :target-fn :deps-cmd :bundle-cmd })
216+ :nodejs-rt :target-fn :deps-cmd :bundle-cmd :global-goog-object&array })
217217
218218(def string->charset
219219 {" iso-8859-1" StandardCharsets/ISO_8859_1
Original file line number Diff line number Diff line change 55
66(deftest test-glib-module-compile
77 (testing " glib modules compiled to Closure Compile expectations"
8- (let [src (env/with-compiler-env (env/default-compiler-env )
8+ (let [src (env/with-compiler-env (env/default-compiler-env )
99 (comp-tests/compile-form-seq
1010 '[(ns test.foo
1111 (:import [goog.module ModuleLoader]))
1414 (is (re-find #"test\. foo\. goog\$ module\$ goog\$ module\$ ModuleLoader = goog\. module\. get\( 'goog.module.ModuleLoader'\) " src))
1515 (is (re-find #"test\. foo\. module_loader = \( new test\. foo\. goog\$ module\$ goog\$ module\$ ModuleLoader\(\)\) " src)))))
1616
17+ (deftest cljs-3330-global-goog-object &array
18+ (testing " migration path for goog.module impact on goog.object & goog.array"
19+ (let [src (env/with-compiler-env
20+ (env/default-compiler-env {:global-goog-object&array true })
21+ (comp-tests/compile-form-seq
22+ '[(ns test.foo
23+ (:require [goog.object :as gobj]
24+ [goog.array :as garray]))
25+ (def module-loader (ModuleLoader. ))]))]
26+ (is (re-find #"goog\. require\( 'goog\. object\'\) " src))
27+ (is (re-find #"goog\. require\( 'goog\. array\'\) " src)))))
28+
1729(comment
1830
1931 (test/run-tests )
You can’t perform that action at this time.
0 commit comments