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."
289289 (util/mkdirs f)
290290 (util/path f)))
291291
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+
292299(defn- repl-opt
293300 " Start a repl with args and inits. Print greeting if no eval options were
294301present"
@@ -304,6 +311,7 @@ present"
304311 renv (apply repl-env (mapcat identity reopts))]
305312 (repl/repl* renv
306313 (assoc (dissoc-entry-point-opts opts)
314+ ::repl/fast-initial-prompt? (fast-initial-prompt? repl-env inits)
307315 :inits
308316 (into
309317 [{:type :init-forms
Original file line number Diff line number Diff line change 853853 (cljsc/maybe-install-node-deps! opts)
854854 installed?)))))
855855
856+ (defn initial-prompt [quit-prompt prompt]
857+ (quit-prompt )
858+ (prompt )
859+ (flush ))
860+
856861(defn repl*
857862 [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?
859864 compiler-env bind-err]
860865 :or {need-prompt #(if (readers/indexing-reader? *in*)
861866 (== (readers/get-column-number *in*) 1 )
862867 (identity true ))
868+ fast-initial-prompt? false
863869 quit-prompt repl-title
864870 prompt repl-prompt
865871 flush flush
879885 (doseq [[unknown-opt suggested-opt] (util/unknown-opts (set (keys opts)) (set/union known-repl-opts cljsc/known-opts))]
880886 (when suggested-opt
881887 (println (str " WARNING: Unknown option '" unknown-opt " '. Did you mean '" suggested-opt " '?" ))))
888+ (when fast-initial-prompt?
889+ (initial-prompt quit-prompt prompt))
882890 (let [repl-opts (-repl-options repl-env)
883891 repl-requires (into repl-requires (:repl-requires repl-opts))
884892 {:keys [analyze-path repl-verbose warn-on-undeclared special-fns
10101018 (binding [*in* (if (true ? (:source-map-inline opts))
10111019 *in*
10121020 (reader ))]
1013- (quit-prompt )
1014- (prompt )
1015- (flush )
1021+ (when-not fast-initial-prompt?
1022+ (initial-prompt quit-prompt prompt))
10161023 (loop []
10171024 (when-not
10181025 (try
You can’t perform that action at this time.
0 commit comments