File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -289,6 +289,13 @@ is trying load some arbitrary ns."
289
289
(util/mkdirs f)
290
290
(util/path f)))
291
291
292
+ (defn- repl-name [repl-env]
293
+ (subs (-> repl-env meta :ns str) (count " cljs.repl." )))
294
+
295
+ (defn- fast-initial-prompt? [repl-env inits]
296
+ (and (empty? inits)
297
+ (contains? #{" node" " nashorn" " graaljs" " rhino" } (repl-name repl-env))))
298
+
292
299
(defn- repl-opt
293
300
" Start a repl with args and inits. Print greeting if no eval options were
294
301
present"
@@ -304,6 +311,7 @@ present"
304
311
renv (apply repl-env (mapcat identity reopts))]
305
312
(repl/repl* renv
306
313
(assoc (dissoc-entry-point-opts opts)
314
+ ::repl/fast-initial-prompt? (fast-initial-prompt? repl-env inits)
307
315
:inits
308
316
(into
309
317
[{:type :init-forms
Original file line number Diff line number Diff line change 853
853
(cljsc/maybe-install-node-deps! opts)
854
854
installed?)))))
855
855
856
+ (defn initial-prompt [quit-prompt prompt]
857
+ (quit-prompt )
858
+ (prompt )
859
+ (flush ))
860
+
856
861
(defn repl*
857
862
[repl-env {:keys [init inits need-prompt quit-prompt prompt flush read eval print caught reader
858
- print-no-newline source-map-inline wrap repl-requires
863
+ print-no-newline source-map-inline wrap repl-requires ::fast-initial-prompt?
859
864
compiler-env bind-err]
860
865
:or {need-prompt #(if (readers/indexing-reader? *in*)
861
866
(== (readers/get-column-number *in*) 1 )
862
867
(identity true ))
868
+ fast-initial-prompt? false
863
869
quit-prompt repl-title
864
870
prompt repl-prompt
865
871
flush flush
879
885
(doseq [[unknown-opt suggested-opt] (util/unknown-opts (set (keys opts)) (set/union known-repl-opts cljsc/known-opts))]
880
886
(when suggested-opt
881
887
(println (str " WARNING: Unknown option '" unknown-opt " '. Did you mean '" suggested-opt " '?" ))))
888
+ (when fast-initial-prompt?
889
+ (initial-prompt quit-prompt prompt))
882
890
(let [repl-opts (-repl-options repl-env)
883
891
repl-requires (into repl-requires (:repl-requires repl-opts))
884
892
{:keys [analyze-path repl-verbose warn-on-undeclared special-fns
1010
1018
(binding [*in* (if (true ? (:source-map-inline opts))
1011
1019
*in*
1012
1020
(reader ))]
1013
- (quit-prompt )
1014
- (prompt )
1015
- (flush )
1021
+ (when-not fast-initial-prompt?
1022
+ (initial-prompt quit-prompt prompt))
1016
1023
(loop []
1017
1024
(when-not
1018
1025
(try
You can’t perform that action at this time.
0 commit comments