Skip to content

Commit

Permalink
remove old module processing stuff, install node deps & index
Browse files Browse the repository at this point in the history
all top-level modules
  • Loading branch information
swannodette committed Jul 14, 2017
1 parent 41fa44e commit 2ba8ec7
Showing 1 changed file with 19 additions and 26 deletions.
45 changes: 19 additions & 26 deletions src/main/clojure/cljs/repl.cljc
Expand Up @@ -193,8 +193,8 @@
(merge (env->opts repl-env) opts)
{:requires [(name ns)]
:type :seed
:url (:uri (cljsc/source-for-namespace
ns env/*compiler*))}))
:url (:uri (cljsc/source-for-namespace ns env/*compiler*))}))
opts' (cljsc/handle-js-modules opts sources env/*compiler* false)
deps (->> sources
(remove (comp #{["goog"]} :provides))
(remove (comp #{:seed} :type))
Expand Down Expand Up @@ -828,13 +828,6 @@
(catch Throwable e
(caught e repl-env opts)
opts))))
;; TODO: consider alternative ways to deal with JS module processing at REPL
opts' opts ;; need to save opts prior to JS module processing for watch
opts (if (or (:libs opts) (:foreign-libs opts))
(let [opts (cljsc/process-js-modules opts)]
(swap! env/*compiler* assoc :js-dependency-index (deps/js-dependency-index opts))
opts)
opts)
init (do
(evaluate-form repl-env env "<cljs repl>"
`(~'set! ~'cljs.core/*print-namespace-maps* true)
Expand Down Expand Up @@ -865,6 +858,8 @@
(print nil))
(let [value (eval repl-env env input opts)]
(print value))))))]
(cljsc/maybe-install-node-deps! opts)
(cljsc/handle-js-modules opts '() env/*compiler* false)
(comp/with-core-cljs opts
(fn []
(binding [*repl-opts* opts]
Expand All @@ -876,23 +871,21 @@
(init)
(catch Throwable e
(caught e repl-env opts)))
;; TODO: consider alternative ways to deal with JS module processing at REPL
(let [opts opts'] ;; use opts prior to JS module processing
(when-let [src (:watch opts)]
(.start
(Thread.
((ns-resolve 'clojure.core 'binding-conveyor-fn)
(fn []
(let [log-file (io/file (util/output-directory opts) "watch.log")]
(err-out (println "Watch compilation log available at:" (str log-file)))
(try
(let [log-out (FileWriter. log-file)]
(binding [*err* log-out
*out* log-out]
(cljsc/watch src (dissoc opts :watch)
env/*compiler* done?)))
(catch Throwable e
(caught e repl-env opts))))))))))
(when-let [src (:watch opts)]
(.start
(Thread.
((ns-resolve 'clojure.core 'binding-conveyor-fn)
(fn []
(let [log-file (io/file (util/output-directory opts) "watch.log")]
(err-out (println "Watch compilation log available at:" (str log-file)))
(try
(let [log-out (FileWriter. log-file)]
(binding [*err* log-out
*out* log-out]
(cljsc/watch src (dissoc opts :watch)
env/*compiler* done?)))
(catch Throwable e
(caught e repl-env opts)))))))))
;; let any setup async messages flush
(Thread/sleep 50)
(binding [*in* (if (true? (:source-map-inline opts))
Expand Down

0 comments on commit 2ba8ec7

Please sign in to comment.