:analyze-path "src"
ClojureScript REPLs can take nearly all the same options that can be
supplied to cljs.closure/build
, for details see Compiler Options.
This page documents additional supported options.
Note that options presented below under General Options should be passed
as compiler options (via -co
/ --compile-opts
if using cljs.main
), while
REPL-environment-specific options should be passed as REPL options
(via -ro
/ repl-opts
if using cljs.main
).
Sets a source path to analyze upon REPL initialization so that, if it connects to an already-running JavaScript environment, symbols for any previously loaded namespaces are available. May also be set to a vector of paths to analyze.
:analyze-path "src"
Sets whether def
(and derived) forms evaluated at the REPL return
either a Var (if set to true
) or the def
init value (if false
).
Only affects forms evaluated at the REPL; compiled source behaves as if
set to false
. Default is true
.
:def-emits-var false
Specifies a set of lib specs (per the require
REPL special) to be
automatically loaded when launching a REPL. Defaults to specs that refer
doc
etc. along with pp
.
:repl-requires [[cljs.repl :refer-macros [source doc find-doc apropos dir pst]]
[cljs.pprint :refer [pprint] :refer-macros [pp]]]
Enable verbose reporting for the REPL. Useful for debugging. Defaults to
false
.
:repl-verbose true
This prints the compiled JavaScript before printing its evaluation:
cljs.user=> (+ 1 2) ((1) + (2)) 3
Overrides warnings related to the use of undeclared vars and non-existent
namespaces at the REPL (specifically :unprovided
, :undeclared-var
,
:undeclared-ns
, and :undeclared-ns-form
). Defaults to true
.
:warn-on-undeclared false
These options are only applicable to the browser REPL that ships with ClojureScript.
By default, starting the browser REPL launches the default browser configured with your operating system to connect back to it. You can disable this behavior by setting this option to false
, and when doing so you will be prompted to connect with a message like
Waiting for browser to connect to http://localhost:9000 ...
:launch-browser false
Executing js --help:languages
will display a list of Graal.JS-specific options.
Any REPL option with a string key starting with "js."
will be passed through
to the Graal.JS engine. Such entries should have string values.
Here is an example enabling and using the ECMAScript Internationalization API:
$ clj -M -m cljs.main -re graaljs -ro '{"js.intl-402" "true"}' -r cljs.user=> (def gas-price (js/Intl.NumberFormat. "en-US" #js {:style "currency" :currency "USD" :minimumFractionDigits 3})) #'cljs.user/gas-price cljs.user=> (.format gas-price 5.259) "$5.259"