CrossClj

1.10.339 docs

SourceDocs



RECENT
    VARS
    *cljs-verbose*
    *repl-env*
    *repl-opts*
    add-url
    analyze-source
    apropos
    bytes-to-base64-str
    compilable?
    decorate-specs
    default-special-fns
    dir
    display-error
    doc
    env->opts
    err-out
    eval-cljs
    evaluate
    evaluate-form
    file-display
    find-doc
    IGetError
    IJavaScriptEnv
    init-wrap-fn
    IParseError
    IParseStacktrace
    IPrintStacktrace
    IReplEnvOptions
    js-src->cljs-src
    known-repl-opts
    load-cljs-loader
    load-dependencies
    load-file
    load-namespace
    load-path->cp-path
    load-sources
    load-stream
    mapped-frame
    mapped-line-column-call
    mapped-stacktrace
    maybe-install-npm-deps
    named-publics-vars
    ns->input
    ns-info
    print-mapped-stacktrace
    pst
    read-source-map
    repl
    repl*
    repl-caught
    repl-nil?
    repl-options
    repl-prompt
    repl-quit-prompt
    repl-read
    repl-special-doc
    repl-special-doc-map
    repl-title
    resolve-ns
    root-directory
    root-resource
    run-inits
    setup
    skip-if-eol
    skip-whitespace
    source
    source-fn
    special-doc
    special-doc-map
    tear-down
    wrap-fn
    wrap-self
    wrap-special-fns

    « Index of all namespaces of this project

    (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.
    macro
    (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.
    (decorate-specs specs)
    macro
    (dir ns)
    Prints a sorted directory of public vars in a namespace
    
    Private
    (display-error repl-env ret form opts)(display-error repl-env ret form f opts)
    macro
    (doc name)
    Prints documentation for a var or special form given its name
    
    Private
    (env->opts repl-env)(env->opts repl-env opts)
    Returns a hash-map containing all of the entries in [repl-env], translating
    :working-dir to :output-dir.
    macro
    (err-out & body)
    Private
    (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.
    (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.
    macro
    (find-doc re-string-or-pattern)
    Prints documentation for any var whose documentation or name
    contains a match for re-string-or-pattern
    protocol
    (-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.
    protocol
    (-evaluate repl-env filename line js)
    evaluate a javascript string
    
    (-load repl-env provides url)
    load code at url into the environment
    
    (-setup repl-env opts)
    initialize the environment
    
    (-tear-down repl-env)
    dispose of the environment
    
    protocol
    (-parse-error repl-env error build-options)
    Given the original JavaScript error return the error to actually
    use.
    protocol
    (-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>".
    protocol
    (-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.
    protocol
    (-repl-options repl-env)
    Return default REPL options for a REPL Env
    
    (js-src->cljs-src f)
    Map a JavaScript output file back to the original ClojureScript source
    file (.cljs or .cljc).
    Set of all known REPL options.
    
    Private
    (load-dependencies repl-env requires)(load-dependencies repl-env requires opts)
    (load-file repl-env f)(load-file repl-env f opts)
    (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.
    Private
    (load-path->cp-path path)
    (load-stream repl-env filename res)
    Private
    (mapped-frame {:keys [function file line column]} opts)
    Given opts and a canonicalized JavaScript stacktrace frame, return the
    ClojureScript frame.
    Private
    (mapped-line-column-call source-map line column)
    Given a cljs.source-map source map data structure map a generated line
    and column back to the original line, column, and function called.
    (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.
    Private
    (named-publics-vars ns)
    Gets the public vars in a namespace that are not anonymous.
    
    (ns-info f)
    Given a path to a js source file return the ns info for the corresponding
    ClojureScript file if it exists.
    (print-mapped-stacktrace stacktrace)(print-mapped-stacktrace stacktrace opts)
    Given a vector representing the canonicalized JavaScript stacktrace
    print the ClojureScript stacktrace. See mapped-stacktrace.
    macro
    (pst)(pst e)
    (read-source-map f)
    Return the source map for the JavaScript source file.
    
    (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
    (repl* repl-env {:keys [init need-prompt quit-prompt prompt flush read eval print caught reader print-no-newline source-map-inline wrap repl-requires compiler-env bind-err], :or {caught repl-caught, quit-prompt repl-quit-prompt, eval eval-cljs, print-no-newline print, flush flush, 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-caught e repl-env opts)
    (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.
    Private
    (repl-special-doc name-symbol)
    Private
    (root-directory lib)
    Returns the root resource path for a lib
    
    Private
    (root-resource lib)
    Returns the root directory path for a lib
    
    (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.
    (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.
    macro
    (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)
    (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)
    Private
    (special-doc name-symbol)
    Private
    (wrap-fn form)
    Private
    (wrap-self f)
    Takes a self-ish fn and returns it wrapped with exception handling.
    Compiler state is restored if self-ish fn fails.
    Private
    (wrap-special-fns wfn fns)