|
193 | 193 | (merge (env->opts repl-env) opts) |
194 | 194 | {:requires [(name ns)] |
195 | 195 | :type :seed |
196 | | - :url (:uri (cljsc/source-for-namespace |
197 | | - ns env/*compiler*))})) |
| 196 | + :url (:uri (cljsc/source-for-namespace ns env/*compiler*))})) |
| 197 | + opts' (cljsc/handle-js-modules opts sources env/*compiler* false) |
198 | 198 | deps (->> sources |
199 | 199 | (remove (comp #{["goog"]} :provides)) |
200 | 200 | (remove (comp #{:seed} :type)) |
|
828 | 828 | (catch Throwable e |
829 | 829 | (caught e repl-env opts) |
830 | 830 | opts)))) |
831 | | - ;; TODO: consider alternative ways to deal with JS module processing at REPL |
832 | | - opts' opts ;; need to save opts prior to JS module processing for watch |
833 | | - opts (if (or (:libs opts) (:foreign-libs opts)) |
834 | | - (let [opts (cljsc/process-js-modules opts)] |
835 | | - (swap! env/*compiler* assoc :js-dependency-index (deps/js-dependency-index opts)) |
836 | | - opts) |
837 | | - opts) |
838 | 831 | init (do |
839 | 832 | (evaluate-form repl-env env "<cljs repl>" |
840 | 833 | `(~'set! ~'cljs.core/*print-namespace-maps* true) |
|
865 | 858 | (print nil)) |
866 | 859 | (let [value (eval repl-env env input opts)] |
867 | 860 | (print value))))))] |
| 861 | + (cljsc/maybe-install-node-deps! opts) |
| 862 | + (cljsc/handle-js-modules opts '() env/*compiler* false) |
868 | 863 | (comp/with-core-cljs opts |
869 | 864 | (fn [] |
870 | 865 | (binding [*repl-opts* opts] |
|
876 | 871 | (init) |
877 | 872 | (catch Throwable e |
878 | 873 | (caught e repl-env opts))) |
879 | | - ;; TODO: consider alternative ways to deal with JS module processing at REPL |
880 | | - (let [opts opts'] ;; use opts prior to JS module processing |
881 | | - (when-let [src (:watch opts)] |
882 | | - (.start |
883 | | - (Thread. |
884 | | - ((ns-resolve 'clojure.core 'binding-conveyor-fn) |
885 | | - (fn [] |
886 | | - (let [log-file (io/file (util/output-directory opts) "watch.log")] |
887 | | - (err-out (println "Watch compilation log available at:" (str log-file))) |
888 | | - (try |
889 | | - (let [log-out (FileWriter. log-file)] |
890 | | - (binding [*err* log-out |
891 | | - *out* log-out] |
892 | | - (cljsc/watch src (dissoc opts :watch) |
893 | | - env/*compiler* done?))) |
894 | | - (catch Throwable e |
895 | | - (caught e repl-env opts)))))))))) |
| 874 | + (when-let [src (:watch opts)] |
| 875 | + (.start |
| 876 | + (Thread. |
| 877 | + ((ns-resolve 'clojure.core 'binding-conveyor-fn) |
| 878 | + (fn [] |
| 879 | + (let [log-file (io/file (util/output-directory opts) "watch.log")] |
| 880 | + (err-out (println "Watch compilation log available at:" (str log-file))) |
| 881 | + (try |
| 882 | + (let [log-out (FileWriter. log-file)] |
| 883 | + (binding [*err* log-out |
| 884 | + *out* log-out] |
| 885 | + (cljsc/watch src (dissoc opts :watch) |
| 886 | + env/*compiler* done?))) |
| 887 | + (catch Throwable e |
| 888 | + (caught e repl-env opts))))))))) |
896 | 889 | ;; let any setup async messages flush |
897 | 890 | (Thread/sleep 50) |
898 | 891 | (binding [*in* (if (true? (:source-map-inline opts)) |
|
0 commit comments