Skip to content

Commit 82a3c14

Browse files
bensudnolen
authored and
dnolen
committed
CLJS-1472 Patch for CLJS-1467 causes regression for nodejscli
The :output-to fallback of cljs.closure/compile-file is removed since it was not reachable before CLJS-1467 and it only caused problems after. Instead, all compile-file callers need to explicitly use :output-file, including the (:main & (:simple | :optimizations)) case tackled by CLJS-1467.
1 parent 6d4ada4 commit 82a3c14

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/main/clojure/cljs/closure.clj

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,9 @@
427427
compiled JavaScript will written to this location and the function
428428
returns a JavaScriptFile. In either case the return value satisfies
429429
IJavaScript."
430-
[^File file {:keys [output-file output-to] :as opts}]
431-
(if (or output-file (string? output-to))
432-
(let [out-file (io/file (util/output-directory opts)
433-
(or output-file output-to))]
430+
[^File file {:keys [output-file] :as opts}]
431+
(if output-file
432+
(let [out-file (io/file (util/output-directory opts) output-file)]
434433
(compiled-file (comp/compile-file file out-file opts)))
435434
(let [path (.getPath ^File file)]
436435
(binding [ana/*cljs-file* path]
@@ -1676,12 +1675,17 @@
16761675
(repeat warnings))
16771676
warnings)))
16781677
ana/*verbose* (:verbose opts)]
1679-
(let [source (if (and (:main all-opts) (#{:advanced :simple} (:optimizations all-opts)))
1678+
(let [one-file? (and (:main all-opts)
1679+
(#{:advanced :simple} (:optimizations all-opts)))
1680+
source (if one-file?
16801681
(:uri (cljs-source-for-namespace (:main all-opts)))
16811682
source)
1683+
compile-opts (if one-file?
1684+
(assoc all-opts :output-file (:output-to all-opts))
1685+
all-opts)
16821686
compiled (util/measure compiler-stats
16831687
"Compile basic sources"
1684-
(doall (-compile source all-opts)))
1688+
(doall (-compile source compile-opts)))
16851689
js-sources (util/measure compiler-stats
16861690
"Add dependencies"
16871691
(doall

0 commit comments

Comments
 (0)