File tree Expand file tree Collapse file tree 4 files changed +14
-26
lines changed Expand file tree Collapse file tree 4 files changed +14
-26
lines changed Original file line number Diff line number Diff line change 848848 (emitln " if(!COMPILED) " loaded-libs " = cljs.core.set();" ))
849849 (doseq [lib (remove (set (vals seen)) (distinct (vals libs)))]
850850 (cond
851- (ana/foreign-dep? lib)
851+ (and (= :nodejs (get-in @env/*compiler* [:options :target ]))
852+ (ana/foreign-dep? lib))
852853 ; ; under node.js we load foreign libs globally
853- (if (= :nodejs (get-in @env/*compiler* [:options :target ]))
854- (let [js-index (:js-dependency-index @env/*compiler*)
855- ijs-url (get-in js-index [(name lib) :url ])]
856- (emitln " cljs.core.load_file(\" " (util/get-name ijs-url) " \" );" ))
857- ; ; otherwise only include if set in the options to do so,
858- ; ; in the browser unnecessary due to the fact that goog.require
859- ; ; there works by writing all deps as script tags, this doesn't
860- ; ; work in Rhino-like environment where we do a proper goog.require
861- ; ; on demand
862- (when (get-in @env/*compiler* [:options :require-foreign ])
863- (emitln " goog.require('" (munge lib) " ');" )))
854+ (let [{:keys [js-dependency-index options]} @env/*compiler*
855+ ijs-url (get-in js-dependency-index [(name lib) :url ])]
856+ (emitln " cljs.core.load_file(\" "
857+ (str (io/file (util/output-directory options) (util/get-name ijs-url)))
858+ " \" );" ))
864859
865860 (-> libs meta :reload )
866861 (emitln " goog.require('" (munge lib) " ', 'reload');" )
Original file line number Diff line number Diff line change 317317(defmacro false? [x]
318318 (bool-expr (core/list 'js* " ~{} === false" x)))
319319
320- (defmacro array? [x]
321- (if (= :nodejs (-> @env/*compiler* :options :target ))
322- (bool-expr `(.isArray js/Array ~x))
323- (bool-expr (core/list 'js* " ~{} instanceof Array" x))))
324-
325320(defmacro string? [x]
326321 (bool-expr (core/list 'js* " typeof ~{} === 'string'" x)))
327322
19741969 [vol f & args]
19751970 `(-vreset! ~vol (~f (-deref ~vol) ~@args)))
19761971
1972+ ; ; INTERNAL - do not use, only for Node.js
19771973(defmacro load-file* [f]
1978- (core/let [{:keys [target output-dir]} (:options @env/*compiler*)]
1979- (core/condp = target
1980- ; ; under Node.js, always relative to JVM working directory
1981- :nodejs `(. js/goog (~'nodeGlobalRequire (str ~output-dir ~File/separator ~f)))
1982- `(. js/goog (~'importScript_ ~f)))))
1974+ `(. js/goog (~'nodeGlobalRequire ~f)))
Original file line number Diff line number Diff line change 169169(defrecord RhinoEnv []
170170 repl /IReplEnvOptions
171171 (-repl-options [this]
172- {:require-foreign true
173- :output-dir " .cljs_rhino_repl"
172+ {:output-dir " .cljs_rhino_repl"
174173 :wrap wrap-fn})
175174 repl /IParseStacktrace
176175 (-parse-stacktrace [this frames-str ret {output-dir :output-dir }]
Original file line number Diff line number Diff line change 153153(defn ^boolean array?
154154 " Returns true if x is a JavaScript array."
155155 [x]
156- (cljs.core/array? x))
156+ (if (identical? *target* " nodejs" )
157+ (.isArray js/Array x)
158+ (instance? js/Array x)))
157159
158160(defn ^boolean number?
159161 " Returns true if x is a JavaScript number."
221223 s
222224 (str ty)))
223225
224- ; ; INTERNAL - do not use
226+ ; ; INTERNAL - do not use, only for Node.js
225227(defn load-file [file]
226228 (when-not js/COMPILED
227229 (cljs.core/load-file* file)))
You can’t perform that action at this time.
0 commit comments