Skip to content

Commit d1cf0a3

Browse files
author
dnolen
committed
CLJS-2577: cljs.main: Side effect of lone -i not occurring in brepl
Make bREPL "easy mode" smarter. Only compile if browser REPL preload is not present. Fixup verbose mode, pr-str compiler options
1 parent e8d4a75 commit d1cf0a3

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/main/clojure/cljs/cli.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ present"
265265
repl/*repl-opts* opts
266266
ana/*verbose* (:verbose opts)]
267267
(when ana/*verbose*
268-
(util/debug-prn "Compiler options:" repl/*repl-opts*))
268+
(util/debug-prn "Compiler options:" (pr-str repl/*repl-opts*)))
269269
(comp/with-core-cljs repl/*repl-opts*
270270
(fn []
271271
(repl/setup renv repl/*repl-opts*)

src/main/clojure/cljs/repl/browser.clj

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,9 @@
177177
"var CLOSURE_NO_DEPS = true;\n"
178178
"document.write('<script src=\"out/goog/base.js\"></script>');\n"
179179
"document.write('<script src=\"out/goog/deps.js\"></script>');\n"
180-
"document.write('<script src=\"out/cljs_deps.js\"></script>');\n"
180+
(when (.exists (io/file "out" "cljs_deps.js"))
181+
"document.write('<script src=\"out/cljs_deps.js\"></script>');\n")
182+
"document.write('<script src=\"out/brepl_deps.js\"></script>');\n"
181183
"document.write('<script>goog.require(\"clojure.browser.repl.preload\");</script>');\n")
182184
"text/javascript" "UTF-8"))
183185
:else (server/send-404 conn path)))
@@ -289,8 +291,8 @@
289291
(io/file working-dir "brepl_client.js")))))
290292
;; TODO: this could be cleaner if compiling forms resulted in a
291293
;; :output-to file with the result of compiling those forms - David
292-
(when (and output-dir (not (.exists (io/file output-dir))))
293-
(spit (io/file "out/cljs_deps.js")
294+
(when (and output-dir (not (.exists (io/file output-dir "clojure" "browser" "repl" "preload.js"))))
295+
(spit (io/file "out/brepl_deps.js")
294296
(build/build
295297
'[(require '[clojure.browser.repl.preload])] {:optimizations :none})))
296298
(repl/err-out

0 commit comments

Comments
 (0)