cljs.analyzer.api

since v0.0-2496

all-ns - function
(all-ns)
(all-ns state)
Return all namespaces. Analagous to clojure.core/all-ns but
returns symbols identifying namespaces not Namespace instances.

analyze - function
(analyze env form)
(analyze env form name)
(analyze env form name opts)
(analyze state env form name opts)
Given an environment, a map containing {:locals (mapping of names to bindings), :context
  (one of :statement, :expr, :return), :ns (a symbol naming the
  compilation ns)}, and form, returns an expression object (a map
  containing at least :form, :op and :env keys). If expr has any (immediately)
  nested exprs, must have :children entry. This must be a vector of keywords naming
  the immediately nested fields mapped to an expr or vector of exprs. This will
  facilitate code walking without knowing the details of the op set.

analyze-file - function
(analyze-file f)
(analyze-file f opts)
(analyze-file state f opts)
Given a java.io.File, java.net.URL or a string identifying a resource on the
   classpath attempt to analyze it.

   This function side-effects the ambient compilation environment
   `cljs.env/*compiler*` to aggregate analysis information. opts argument is
   compiler options, if :cache-analysis true will cache analysis to
   ":output-dir/some/ns/foo.cljs.cache.edn". This function does not return a
   meaningful value.

current-file - function
(current-file)
Return the current file under analysis or compilation.

current-ns - function
(current-ns)
Return the current ns under analysis or compilation.

current-state - function
(current-state)
Return the current compiler state atom.

default-passes - var
ClojureScript's default analysis passes.

default-warning-handler - function
(default-warning-handler warning-type env extra)
The default warning handler.

Outputs the warning messages to *err*.

empty-env - function
(empty-env)
Creates an empty analysis environment.

empty-state - function
(empty-state)
(empty-state opts)
Creates an empty compilation state Atom. The optional opts arg is a map
representing the compiler configuration. See the documentation
for details: https://clojurescript.org/reference/compiler-options

enabled-warnings - function
(enabled-warnings)
Get the enabled warning types.

find-ns - function
(find-ns sym)
(find-ns state sym)
Given a namespace return the corresponding namespace analysis map. Analagous
to clojure.core/find-ns.

forms-seq - function
(forms-seq rdr)
(forms-seq rdr filename)
Seq of Clojure/ClojureScript forms from rdr, a java.io.Reader. Optionally
  accepts a filename argument which will be used in any emitted errors.

get-js-index - function
(get-js-index)
(get-js-index state)
Return the currently computed Google Closure js dependency index from the
compiler state.

get-options - function
(get-options)
(get-options state)
Return the compiler options from compiler state.

in-cljs-user - macro
(in-cljs-user env & body)
Binds cljs.analyzer/*cljs-ns* to 'cljs.user and uses the given compilation
environment atom and runs body.

no-warn - macro
(no-warn & body)
Disable analyzer warnings for any analysis executed in body.

ns-interns - function
(ns-interns ns)
(ns-interns state ns)
Given a namespace return all the var analysis maps. Analagous to
clojure.core/ns-interns but returns var analysis maps not vars.

ns-publics - function
(ns-publics ns)
(ns-publics state ns)
Given a namespace return all the public var analysis maps. Analagous to
clojure.core/ns-publics but returns var analysis maps not vars.

ns-resolve - function
(ns-resolve ns sym)
(ns-resolve state ns sym)
Given a namespace and a symbol return the corresponding var analysis map.
Analagous to clojure.core/ns-resolve but returns var analysis map not Var.

parse-ns - function
(parse-ns src)
(parse-ns src opts)
(parse-ns src dest opts)
(parse-ns state src dest opts)
Helper for parsing only the essential namespace information from a
   ClojureScript source file and returning a cljs.closure/IJavaScript compatible
   map _not_ a namespace AST node.

   By default does not load macros or perform any analysis of dependencies. If
   opts parameter provided :analyze-deps and :load-macros keys their values will
   be used for *analyze-deps* and *load-macros* bindings respectively. This
   function does _not_ side-effect the ambient compilation environment unless
   requested via opts where :restore is false.

read-analysis-cache - function
(read-analysis-cache cache-file)
Read an analysis cache.

remove-ns - function
(remove-ns ns)
(remove-ns state ns)
Removes the namespace named by the symbol.

resolve - function
(resolve env sym)
Given an analysis environment resolve a var. Analogous to
clojure.core/resolve

warning-enabled? - function
(warning-enabled? warning-type)
Test if the given warning-type is enabled.

warning-message - function
(warning-message warn-type warn-info)
Helper for generating the standard analyzer messages for warnings. Should be
passed warn-type and warn-info. See with-warning-handlers.

with-passes - macro
(with-passes passes & body)
Evaluate the body with the provided sequence of compiler passes.

with-state - macro
(with-state state & body)
Run the body with the given compilation state Atom.

with-warning-handlers - macro
(with-warning-handlers handlers & body)
Helper macro for custom handling of emitted warnings. Handlers should be
a vector of functions. The signature of these functions is
[warn-type env warn-info]. warn-type is a keyword describing the warning,
env is the analysis environment, and warn-info is a map of extra useful
information for a particular warning type.