API for cljs.compiler
-
Full namespace name:
cljs.compiler
Overview
Public Variables and Functions
cljs-files-in
function
Usage: (cljs-files-in dir)
Return a sequence of all .cljs and .cljc files in the given directory.
compile-file
function
Usage: (compile-file src)
(compile-file src dest)
(compile-file src dest opts)
Compiles src to a file of the same name, but with a .js extension,
in the src file's directory.
With dest argument, write file to provided location. If the dest
argument is a file outside the source tree, missing parent
directories will be created. The src file will only be compiled if
the dest file has an older modification time.
Both src and dest may be either a String or a File.
Returns a map containing {:ns .. :provides .. :requires .. :file ..}.
If the file was not compiled returns only {:file ...}
compile-root
function
Usage: (compile-root src-dir)
(compile-root src-dir target-dir)
(compile-root src-dir target-dir opts)
Looks recursively in src-dir for .cljs files and compiles them to
.js files. If target-dir is provided, output will go into this
directory mirroring the source directory structure. Returns a list
of maps containing information about each file which was compiled
in dependency order.
emit-arguments-to-array
function
Usage: (emit-arguments-to-array startslice)
Emit code that copies function arguments into an array starting at an index.
Returns name of var holding the array.
function
Usage: (emit-comment doc jsdoc)
(emit-comment env doc jsdoc)
Emit a nicely formatted comment string.
rename-to-js
function
Usage: (rename-to-js file-str)
Change the file extension from .cljs to .js. Takes a File or a
String. Always returns a String.
requires-compilation?
function
Usage: (requires-compilation? src dest)
(requires-compilation? src dest opts)
Return true if the src file requires compilation.
with-core-cljs
function
Usage: (with-core-cljs)
(with-core-cljs opts)
(with-core-cljs opts body)
Ensure that core.cljs has been loaded.
cljs.compiler.api
This is intended to be a stable api for those who need programmatic access
to the compiler.
Public Variables and Functions
cljs-files-in
function
Usage: (cljs-files-in dir)
Return a sequence of all .cljs and .cljc files in the given directory.
compile-file
function
Usage: (compile-file src)
(compile-file src dest)
(compile-file src dest opts)
(compile-file state src dest opts)
Compiles src to a file of the same name, but with a .js extension,
in the src file's directory.
With dest argument, write file to provided location. If the dest
argument is a file outside the source tree, missing parent
directories will be created. The src file will only be compiled if
the dest file has an older modification time.
Both src and dest may be either a String or a File.
Returns a map containing {:ns .. :provides .. :requires .. :file ..}.
If the file was not compiled returns only {:file ...}
compile-root
function
Usage: (compile-root src-dir)
(compile-root src-dir target-dir)
(compile-root src-dir target-dir opts)
(compile-root state src-dir target-dir opts)
Looks recursively in src-dir for .cljs files and compiles them to
.js files. If target-dir is provided, output will go into this
directory mirroring the source directory structure. Returns a list
of maps containing information about each file which was compiled
in dependency order.
emit
function
Usage: (emit ast)
(emit state ast)
Given an AST node generated by the analyzer emit JavaScript as a string.
requires-compilation?
function
Usage: (requires-compilation? src dest)
(requires-compilation? src dest opts)
(requires-compilation? state src dest opts)
Return true if the src file requires compilation.
with-core-cljs
function
Usage: (with-core-cljs)
(with-core-cljs opts)
(with-core-cljs opts body)
(with-core-cljs state opts body)
Ensure that core.cljs has been loaded.