File tree 3 files changed +22
-4
lines changed
test/clojure/cljs/compiler
3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change 815
815
(defn goog-module-dep?
816
816
[module]
817
817
(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 ])))))
820
826
821
827
(defn confirm-var-exists
822
828
([env prefix suffix]
Original file line number Diff line number Diff line change 213
213
:watch :watch-error-fn :watch-fn :install-deps :process-shim :rename-prefix :rename-prefix-namespace
214
214
:closure-variable-map-in :closure-property-map-in :closure-variable-map-out :closure-property-map-out
215
215
: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 })
217
217
218
218
(def string->charset
219
219
{" iso-8859-1" StandardCharsets/ISO_8859_1
Original file line number Diff line number Diff line change 5
5
6
6
(deftest test-glib-module-compile
7
7
(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 )
9
9
(comp-tests/compile-form-seq
10
10
'[(ns test.foo
11
11
(:import [goog.module ModuleLoader]))
14
14
(is (re-find #"test\. foo\. goog\$ module\$ goog\$ module\$ ModuleLoader = goog\. module\. get\( 'goog.module.ModuleLoader'\) " src))
15
15
(is (re-find #"test\. foo\. module_loader = \( new test\. foo\. goog\$ module\$ goog\$ module\$ ModuleLoader\(\)\) " src)))))
16
16
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
+
17
29
(comment
18
30
19
31
(test/run-tests )
You can’t perform that action at this time.
0 commit comments