cljs.build.api

since v0.0-2496

add-dependencies - function
(add-dependencies opts & ijss)
DEPRECATED: Given one or more IJavaScript objects in dependency order, produce
a new sequence of IJavaScript objects which includes the input list
plus all dependencies in dependency order.

add-dependency-sources - function
(add-dependency-sources xs)
(add-dependency-sources xs opts)
(add-dependency-sources state xs opts)
Given a sequence of cljs.closure/IJavaScript values, return a set that includes
all dependencies.

add-implicit-options - function
(add-implicit-options opts)
Given a valid map of build options add any standard implicit options. For
example :optimizations :none implies :cache-analysis true and :source-map
true.

build - function
(build opts)
(build source opts)
(build source opts compiler-env)
Given compiler options, produce runnable JavaScript. An optional source
parameter may be provided.

cljs-dependents-for-macro-namespaces - function
(cljs-dependents-for-macro-namespaces namespaces)
(cljs-dependents-for-macro-namespaces state namespaces)
Takes a list of Clojure (.clj) namespaces that define macros and
returns a list ClojureScript (.cljs) namespaces that depend on those macro
namespaces.

For example where example.macros is defined in the clojure file
"example/macros.clj" and both 'example.core and 'example.util are
ClojureScript namespaces that require and use the macros from
'example.macros :
(cljs-dependents-for-macro-namespaces 'example.macros) ->
('example.core 'example.util)

compilable->ijs - function
(compilable->ijs x)
(compilable->ijs x opts)
Given a cljs.closure/Compilable value, return the corresponding
cljs.closure/IJavaScript value.

compile - function
(compile opts compilable)
(compile state opts compilable)
Given a Compilable, compile it and return an IJavaScript.

compiler-opts? - function
(compiler-opts? m)

dependency-order - function
(dependency-order xs)
Topologically sort a collection of IJavaScript values.

get-node-deps - function
(get-node-deps dependencies)
(get-node-deps dependencies opts)
EXPERIMENTAL: Get the Node.js dependency graph of the supplied dependencies.
Dependencies must be a sequence of strings or symbols naming packages or paths
within packages (e.g. [react "react-dom/server"] or a valid compiler options
map. Assumes dependencies have been been previously installed, either by
`cljs.build.api/install-node-deps!` or by an NPM client, and reside in the
`node_modules` directory.

goog-dep-string - function
(goog-dep-string opts ijs)
Given compiler options and a IJavaScript instance return the corresponding
goog.addDependency string

handle-js-modules - function
(handle-js-modules state xs opts)
Given a collection of IJavaScript values representing a build, index all
node modules, convert all JS modules (ES6 etc), and store the updated
js-dependency-index (likely changed due to modules) in compiler state.

index-ijs - function
(index-ijs xs)
Given a sequence of cljs.closure/IJavaScript values, create an index using
:provides. The original values will appear under each :provide.

inputs - function
(inputs & xs)
Given a list of directories and files, return a compilable object that may
be passed to build or watch.

install-node-deps! - function
(install-node-deps! dependencies)
(install-node-deps! dependencies opts)
EXPERIMENTAL: Install the supplied dependencies via NPM. dependencies must be
a map of name to version or a valid compiler options map.

mark-cljs-ns-for-recompile! - function
(mark-cljs-ns-for-recompile! ns-sym)
(mark-cljs-ns-for-recompile! ns-sym output-dir)
Backdates a cljs target file so that it the cljs compiler will recompile it.

node-inputs - function
(node-inputs entries)
(node-inputs entries opts)
EXPERIMENTAL: return the foreign libs entries as computed by running
the module-deps package on the supplied JavaScript entry points. Assumes
that the `@cljs-oss/module-deps` NPM package is either locally or globally
installed.

node-modules - function
(node-modules)
(node-modules opts)
Return a sequence of requirable libraries found under node_modules.

ns->location - function
(ns->location ns)
(ns->location ns compiler-env)
Given a namespace and compilation environment return the relative path and
uri of the corresponding source regardless of the source language extension:
.cljs, .cljc, .js. Returns a map containing :relative-path a string, and
:uri a URL.

ns->source - function
(ns->source ns)
Given a namespace as a symbol return the corresponding resource if it exists.

output-unoptimized - function
(output-unoptimized opts & sources)
Ensure that all JavaScript source files are on disk (not in jars),
write the goog deps file including only the libraries that are being
used and write the deps file for the current project.

The deps file for the current project will include third-party
libraries.

parse-js-ns - function
(parse-js-ns f)
Given a Google Closure style JavaScript file or resource return the namespace
information for the given file. Only returns the value extracted from the
first provide statement.

source-on-disk - function
(source-on-disk opts ijs)
Ensure that the given IJavaScript exists on disk in the output directory.
Return updated IJavaScript with the new location if necessary.

src-file->goog-require - function
(src-file->goog-require src)
(src-file->goog-require src opts)
(src-file->goog-require state src opts)
Given a ClojureScript or Google Closure style JavaScript source file return
the goog.require statement for it.

src-file->target-file - function
(src-file->target-file src)
(src-file->target-file src opts)
(src-file->target-file state src opts)
Given a ClojureScript source file return the target file. May optionally
provide build options with :output-dir specified.

target-file-for-cljs-ns - function
(target-file-for-cljs-ns ns-sym)
(target-file-for-cljs-ns ns-sym output-dir)
Given an output directory and a clojurescript namespace return the
compilation target file for that namespace.

For example:
(target-file-from-cljs-ns "resources/out" 'example.core) ->

watch - function
(watch source opts)
(watch source opts compiler-env)
(watch source opts compiler-env stop)
Given a source which can be compiled, watch it for changes to produce.