Liking cljdoc? Tell your friends :D

cljs.repl


*cljs-verbose*clj


*repl-env*clj


*repl-opts*clj


add-urlclj

(add-url ijs)

analyze-sourceclj

(analyze-source src-dir)
(analyze-source src-dir opts)

Given a source directory, analyzes all .cljs files. Used to populate (:cljs.analyzer/namespaces compiler-env) so as to support code reflection.

Given a source directory, analyzes all .cljs files. Used to populate
(:cljs.analyzer/namespaces compiler-env) so as to support code reflection.
raw docstring

aproposcljmacro

(apropos str-or-pattern)

Given a regular expression or stringable thing, return a seq of all public definitions in all currently-loaded namespaces that match the str-or-pattern.

Given a regular expression or stringable thing, return a seq of all
public definitions in all currently-loaded namespaces that match the
str-or-pattern.
raw docstring

compilable?clj

(compilable? input)

decorate-specsclj

(decorate-specs specs)

default-special-fnsclj


demungeclj

(demunge fn-name)

Given a string representation of a fn class, as in a stack trace element, returns a readable version.

Given a string representation of a fn class,
as in a stack trace element, returns a readable version.
raw docstring

dircljmacro

(dir ns)

Prints a sorted directory of public vars in a namespace

Prints a sorted directory of public vars in a namespace
raw docstring

doccljmacro

(doc name)

Prints documentation for a var or special form given its name, or for a spec if given a keyword

Prints documentation for a var or special form given its name,
or for a spec if given a keyword
raw docstring

eval-cljsclj

(eval-cljs repl-env env form)
(eval-cljs repl-env env form opts)

Given a REPL evaluation environment, an analysis environment, and a form, evaluate the form and return the result. The result is always the value represented as a string.

Given a REPL evaluation environment, an analysis environment, and a
form, evaluate the form and return the result. The result is always the value
represented as a string.
raw docstring

evaluateclj

(evaluate repl-env filename line js)

evaluate-formclj

(evaluate-form repl-env env filename form)
(evaluate-form repl-env env filename form wrap)
(evaluate-form repl-env env filename form wrap opts)

Evaluate a ClojureScript form in the JavaScript environment. Returns a string which is the ClojureScript return value. This string may or may not be readable by the Clojure reader.

Evaluate a ClojureScript form in the JavaScript environment. Returns a
string which is the ClojureScript return value. This string may or may
not be readable by the Clojure reader.
raw docstring

ex-strclj

(ex-str {:keys [:clojure.error/phase :clojure.error/source :clojure.error/line
                :clojure.error/column :clojure.error/symbol :clojure.error/class
                :clojure.error/cause :clojure.error/spec]
         :as triage-data})

Returns a string from exception data, as produced by ex-triage. The first line summarizes the exception phase and location. The subsequent lines describe the cause.

Returns a string from exception data, as produced by ex-triage.
The first line summarizes the exception phase and location.
The subsequent lines describe the cause.
raw docstring

ex-triageclj

(ex-triage datafied-throwable)

Returns an analysis of the phase, error, cause, and location of an error that occurred based on Throwable data, as returned by Throwable->map. All attributes other than phase are optional: :clojure.error/phase - keyword phase indicator, one of: :read-source :compile-syntax-check :compilation :macro-syntax-check :macroexpansion :execution :read-eval-result :print-eval-result :clojure.error/source - file name (no path) :clojure.error/line - integer line number :clojure.error/column - integer column number :clojure.error/symbol - symbol being expanded/compiled/invoked :clojure.error/class - cause exception class symbol :clojure.error/cause - cause exception message :clojure.error/spec - explain-data for spec error

Returns an analysis of the phase, error, cause, and location of an error that occurred
based on Throwable data, as returned by Throwable->map. All attributes other than phase
are optional:
  :clojure.error/phase - keyword phase indicator, one of:
    :read-source :compile-syntax-check :compilation :macro-syntax-check :macroexpansion
    :execution :read-eval-result :print-eval-result
  :clojure.error/source - file name (no path)
  :clojure.error/line - integer line number
  :clojure.error/column - integer column number
  :clojure.error/symbol - symbol being expanded/compiled/invoked
  :clojure.error/class - cause exception class symbol
  :clojure.error/cause - cause exception message
  :clojure.error/spec - explain-data for spec error
raw docstring

file-displayclj

(file-display file {:keys [output-dir temp-output-dir?]})

find-doccljmacro

(find-doc re-string-or-pattern)

Prints documentation for any var whose documentation or name contains a match for re-string-or-pattern

Prints documentation for any var whose documentation or name
contains a match for re-string-or-pattern
raw docstring

IGetErrorcljprotocol

-get-errorclj

(-get-error repl-env name env build-options)

Given a symbol representing a var holding an error, an analysis environment, and the REPL/compiler options return the canonical error representation:

{:value <string> :stacktrace <string>}

:value should be the host environment JavaScript error message string. :stacktrace should be the host JavaScript environment stacktrace string.

Given a symbol representing a var holding an error, an analysis
 environment, and the REPL/compiler options return the canonical error
 representation:

 {:value <string>
  :stacktrace <string>}

:value should be the host environment JavaScript error message string.
:stacktrace should be the host JavaScript environment stacktrace string.

IJavaScriptEnvcljprotocol

-evaluateclj

(-evaluate repl-env filename line js)

evaluate a javascript string

evaluate a javascript string

-loadclj

(-load repl-env provides url)

load code at url into the environment

load code at url into the environment

-setupclj

(-setup repl-env opts)

initialize the environment

initialize the environment

-tear-downclj

(-tear-down repl-env)

dispose of the environment

dispose of the environment

initial-promptclj

(initial-prompt quit-prompt prompt)

IParseErrorcljprotocol

-parse-errorclj

(-parse-error repl-env error build-options)

Given the original JavaScript error return the error to actually use.

Given the original JavaScript error return the error to actually
use.

IParseStacktracecljprotocol

-parse-stacktraceclj

(-parse-stacktrace repl-env stacktrace error build-options)

Given the original JavaScript stacktrace string, the entire original error value and current compiler build options, parse the stacktrace into the canonical form:

[{:file <string> :function <string> :line <integer> :column <integer>}*]

:file must be a URL path (without protocol) relative to :output-dir. If no source file can be supplied (such as REPL defs), :file may be a custom identifier string surrounded by angle brackets, i.e. "<cljs repl>".

Given the original JavaScript stacktrace string, the entire original error
value and current compiler build options, parse the stacktrace into the
canonical form:

[{:file <string>
  :function <string>
  :line <integer>
  :column <integer>}*]

:file must be a URL path (without protocol) relative to :output-dir. If
no source file can be supplied (such as REPL defs), :file may be a custom
identifier string surrounded by angle brackets, i.e. "<cljs repl>".

IPrintStacktracecljprotocol

-print-stacktraceclj

(-print-stacktrace repl-env stacktrace error build-options)

Implementing REPL evaluation environments are given the opportunity to print the mapped stacktrace themselves. This permits further processing.

Implementing REPL evaluation environments are given the opportunity to
print the mapped stacktrace themselves. This permits further processing.

IReplEnvOptionscljprotocol

-repl-optionsclj

(-repl-options repl-env)

Return default REPL options for a REPL Env

Return default REPL options for a REPL Env

js-src->cljs-srcclj

(js-src->cljs-src f)

Map a JavaScript output file back to the original ClojureScript source file (.cljs or .cljc).

Map a JavaScript output file back to the original ClojureScript source
file (.cljs or .cljc).
raw docstring

known-repl-optsclj

Set of all known REPL options.

Set of all known REPL options.
raw docstring

loadclj

(load repl-env provides url)

load-fileclj

(load-file repl-env f)
(load-file repl-env f opts)

load-namespaceclj

(load-namespace repl-env ns)
(load-namespace repl-env ns opts)

Load a namespace and all of its dependencies into the evaluation environment. The environment is responsible for ensuring that each namespace is loaded once and only once. Returns the compiled sources.

Load a namespace and all of its dependencies into the evaluation environment.
The environment is responsible for ensuring that each namespace is
loaded once and only once. Returns the compiled sources.
raw docstring

load-streamclj

(load-stream repl-env filename res)

mapped-stacktraceclj

(mapped-stacktrace stacktrace)
(mapped-stacktrace stacktrace opts)

Given a vector representing the canonicalized JavaScript stacktrace return the ClojureScript stacktrace. The canonical stacktrace must be in the form:

[{:file <string> :function <string> :line <integer> :column <integer>}*]

:file must be a URL path (without protocol) relative to :output-dir or a identifier delimited by angle brackets. The returned mapped stacktrace will also contain :url entries to the original sources if it can be determined from the classpath.

Given a vector representing the canonicalized JavaScript stacktrace
return the ClojureScript stacktrace. The canonical stacktrace must be
in the form:

 [{:file <string>
   :function <string>
   :line <integer>
   :column <integer>}*]

:file must be a URL path (without protocol) relative to :output-dir or a
identifier delimited by angle brackets. The returned mapped stacktrace will
also contain :url entries to the original sources if it can be determined
from the classpath.
raw docstring

maybe-install-npm-depsclj

(maybe-install-npm-deps opts)

ns->inputclj

(ns->input ns opts)

ns-infoclj

(ns-info f)

Given a path to a js source file return the ns info for the corresponding ClojureScript file if it exists.

Given a path to a js source file return the ns info for the corresponding
ClojureScript file if it exists.
raw docstring

(print-mapped-stacktrace stacktrace)
(print-mapped-stacktrace stacktrace opts)

Given a vector representing the canonicalized JavaScript stacktrace print the ClojureScript stacktrace. See mapped-stacktrace.

Given a vector representing the canonicalized JavaScript stacktrace
print the ClojureScript stacktrace. See mapped-stacktrace.
raw docstring

pstcljmacro

(pst)
(pst e)

read-source-mapclj

(read-source-map f)

Return the source map for the JavaScript source file.

Return the source map for the JavaScript source file.
raw docstring

replclj

(repl repl-env & opts)

Generic, reusable, read-eval-print loop. By default, reads from in using a c.t.r.reader-types/source-logging-push-back-reader, writes to out, and prints exception summaries to err. If you use the default :read hook, in must either be an instance of c.t.r.reader-types/PushbackReader or duplicate its behavior of both supporting unread and collapsing CR, LF, and CRLF into a single \newline. Options are sequential keyword-value pairs. The first argument is the JavaScript evaluation environment, the second argument is an extended version of the standard ClojureScript compiler options. In addition to ClojureScript compiler build options it also take a set of options similar to clojure.main/repl with adjustments for ClojureScript evalution and compilation model:

Available clojure.main/repl style options and their defaults:

  • :init, function of no arguments, initialization hook called with bindings for set!-able vars in place. default: #()

  • :need-prompt, function of no arguments, called before each read-eval-print except the first, the user will be prompted if it returns true. default: #(if (c.t.r.readers-types/indexing-reader? in) (== (c.t.r.reader-types/get-column-number in) 1) (identity true))

  • :prompt, function of no arguments, prompts for more input. default: repl-prompt

  • :flush, function of no arguments, flushes output default: flush

  • :read, function of two arguments, reads from in:

    • returns its first argument to request a fresh prompt
      • depending on need-prompt, this may cause the repl to prompt before reading again
    • returns its second argument to request an exit from the repl
    • else returns the next object read from the input stream default: repl-read
  • :eval, function of one argument, returns the evaluation of its argument. The eval function must take repl-env, the JavaScript evaluation environment, env, the ClojureScript analysis environment, the form and opts, the standard ClojureScript REPL/compiler options. default: eval

  • :print, function of one argument, prints its argument to the output default: println

  • :caught, function of three arguments, a throwable, called when read, eval, or print throws an exception or error default. The second argument is the JavaScript evaluation environment this permits context sensitive handling if necessary. The third argument is opts, the standard ClojureScript REPL/compiler options. In the case of errors or exception in the JavaScript target, these will be thrown as clojure.lang.IExceptionInfo instances. default: repl-caught

  • :reader, the c.t.r reader to use. default: c.t.r.reader-types/source-logging-push-back-reader

  • :print-no-newline, print without a newline. default: print

  • :source-map-inline, whether inline source maps should be enabled. Most useful in browser context. Implies using a fresh reader for each form. default: true

Generic, reusable, read-eval-print loop. By default, reads from *in* using
a c.t.r.reader-types/source-logging-push-back-reader,
writes to *out*, and prints exception summaries to *err*. If you use the
default :read hook, *in* must either be an instance of
c.t.r.reader-types/PushbackReader or duplicate its behavior of both supporting
unread and collapsing CR, LF, and CRLF into a single \newline. Options
are sequential keyword-value pairs. The first argument is the JavaScript
evaluation environment, the second argument is an extended version of the
standard ClojureScript compiler options. In addition to ClojureScript compiler
build options it also take a set of options similar to clojure.main/repl with
adjustments for ClojureScript evalution and compilation model:

Available clojure.main/repl style options and their defaults:

   - :init, function of no arguments, initialization hook called with
     bindings for set!-able vars in place.
     default: #()

   - :need-prompt, function of no arguments, called before each
     read-eval-print except the first, the user will be prompted if it
     returns true.
     default: #(if (c.t.r.readers-types/indexing-reader? *in*)
                 (== (c.t.r.reader-types/get-column-number *in*) 1)
                 (identity true))

   - :prompt, function of no arguments, prompts for more input.
     default: repl-prompt

   - :flush, function of no arguments, flushes output
     default: flush

   - :read, function of two arguments, reads from *in*:
       - returns its first argument to request a fresh prompt
         - depending on need-prompt, this may cause the repl to prompt
           before reading again
       - returns its second argument to request an exit from the repl
       - else returns the next object read from the input stream
     default: repl-read

   - :eval, function of one argument, returns the evaluation of its
     argument. The eval function must take repl-env, the JavaScript evaluation
     environment, env, the ClojureScript analysis environment, the form
     and opts, the standard ClojureScript REPL/compiler options.
     default: eval

   - :print, function of one argument, prints its argument to the output
     default: println

   - :caught, function of three arguments, a throwable, called when
     read, eval, or print throws an exception or error default. The second
     argument is the JavaScript evaluation environment this permits context
     sensitive handling if necessary. The third argument is opts, the standard
     ClojureScript REPL/compiler options. In the case of errors or exception
     in the JavaScript target, these will be thrown as
     clojure.lang.IExceptionInfo instances.
     default: repl-caught

   - :reader, the c.t.r reader to use.
     default: c.t.r.reader-types/source-logging-push-back-reader

   - :print-no-newline, print without a newline.
     default: print

   - :source-map-inline, whether inline source maps should be enabled. Most
     useful in browser context. Implies using a fresh reader for each form.
     default: true
raw docstring

repl*clj

(repl*
  repl-env
  {:keys [init inits need-prompt quit-prompt prompt flush read eval print caught
          reader print-no-newline source-map-inline wrap repl-requires
          :cljs.repl/fast-initial-prompt? compiler-env bind-err]
   :or {caught repl-caught
        quit-prompt repl-title
        eval eval-cljs
        print-no-newline print
        flush flush
        fast-initial-prompt? false
        read repl-read
        bind-err true
        print println
        source-map-inline true
        prompt repl-prompt
        repl-requires (quote [[cljs.repl :refer-macros
                               [source doc find-doc apropos dir pst]]
                              [cljs.pprint :refer [pprint] :refer-macros [pp]]])
        reader
          (fn*
            []
            (readers/source-logging-push-back-reader *in* 1 "<NO_SOURCE_FILE>"))
        need-prompt (fn* []
                         (if (readers/indexing-reader? *in*)
                             (== (readers/get-column-number *in*) 1)
                             (identity true)))}
   :as opts})

repl-caughtclj

(repl-caught e repl-env opts)

repl-nil?clj

(repl-nil? x)

repl-optionsclj

(repl-options repl-env)

repl-promptclj

(repl-prompt)

repl-quit-promptclj

(repl-quit-prompt)

repl-readclj

(repl-read request-prompt request-exit)
(repl-read request-prompt request-exit opts)

Default :read hook for repl. Reads from in which must either be an instance of LineNumberingPushbackReader or duplicate its behavior of both supporting .unread and collapsing all of CR, LF, and CRLF into a single \newline. repl-read:

  • skips whitespace, then
    • returns request-prompt on start of line, or
    • returns request-exit on end of stream, or
    • reads an object from the input stream, then
      • skips the next input character if it's end of line, then
      • returns the object.
Default :read hook for repl. Reads from *in* which must either be an
instance of LineNumberingPushbackReader or duplicate its behavior of both
supporting .unread and collapsing all of CR, LF, and CRLF into a single
\newline. repl-read:
  - skips whitespace, then
    - returns request-prompt on start of line, or
    - returns request-exit on end of stream, or
    - reads an object from the input stream, then
      - skips the next input character if it's end of line, then
      - returns the object.
raw docstring

repl-special-doc-mapclj


repl-titleclj

(repl-title)

run-initsclj

(run-inits renv inits)

setupclj

(setup repl-env opts)

skip-if-eolclj

(skip-if-eol s)

If the next character on stream s is a newline, skips it, otherwise leaves the stream untouched. Returns :line-start, :stream-end, or :body to indicate the relative location of the next character on s. The stream must either be an instance of LineNumberingPushbackReader or duplicate its behavior of both supporting .unread and collapsing all of CR, LF, and CRLF to a single \newline.

If the next character on stream s is a newline, skips it, otherwise
leaves the stream untouched. Returns :line-start, :stream-end, or :body
to indicate the relative location of the next character on s. The stream
must either be an instance of LineNumberingPushbackReader or duplicate
its behavior of both supporting .unread and collapsing all of CR, LF, and
CRLF to a single \newline.
raw docstring

skip-whitespaceclj

(skip-whitespace s)

Skips whitespace characters on stream s. Returns :line-start, :stream-end, or :body to indicate the relative location of the next character on s. Interprets comma as whitespace and semicolon as comment to end of line. Does not interpret #! as comment to end of line because only one character of lookahead is available. The stream must either be an instance of LineNumberingPushbackReader or duplicate its behavior of both supporting .unread and collapsing all of CR, LF, and CRLF to a single \newline.

Skips whitespace characters on stream s. Returns :line-start, :stream-end,
or :body to indicate the relative location of the next character on s.
Interprets comma as whitespace and semicolon as comment to end of line.
Does not interpret #! as comment to end of line because only one
character of lookahead is available. The stream must either be an
instance of LineNumberingPushbackReader or duplicate its behavior of both
supporting .unread and collapsing all of CR, LF, and CRLF to a single
\newline.
raw docstring

sourcecljmacro

(source n)

Prints the source code for the given symbol, if it can find it. This requires that the symbol resolve to a Var defined in a namespace for which the .cljs is in the classpath.

Example: (source filter)

Prints the source code for the given symbol, if it can find it.
This requires that the symbol resolve to a Var defined in a
namespace for which the .cljs is in the classpath.

Example: (source filter)
raw docstring

source-fnclj

(source-fn env x)

Returns a string of the source code for the given symbol, if it can find it. This requires that the symbol resolve to a Var defined in a namespace for which the .clj is in the classpath. Returns nil if it can't find the source. For most REPL usage, 'source' is more convenient.

Example: (source-fn 'filter)

Returns a string of the source code for the given symbol, if it can
find it.  This requires that the symbol resolve to a Var defined in
a namespace for which the .clj is in the classpath.  Returns nil if
it can't find the source.  For most REPL usage, 'source' is more
convenient.

Example: (source-fn 'filter)
raw docstring

special-doc-mapclj


tear-downclj

(tear-down repl-env)

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close