(absolute-parent path)
(absolute-path? path)
(add-converted-source closure-compiler
inputs-by-name
opts
{:keys [file-min file provides requires] :as ijs})
(add-core-macros-if-cljs-js compiled)
If a compiled entity is the cljs.js namespace, explicitly add the cljs.core macros namespace dependency to it.
If a compiled entity is the cljs.js namespace, explicitly add the cljs.core macros namespace dependency to it.
(add-dep-string opts input)
Return a goog.addDependency string for an input.
Return a goog.addDependency string for an input.
(add-dependencies opts & inputs)
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.
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 inputs)
(add-dependency-sources inputs compile-opts)
Given list of IJavaScript objects, produce a new sequence of IJavaScript objects of all dependencies of inputs.
Given list of IJavaScript objects, produce a new sequence of IJavaScript objects of all dependencies of inputs.
(add-externs-sources opts)
(add-goog-base inputs)
(add-header opts js)
(add-implicit-options {:keys [optimizations output-dir]
:or {optimizations :none output-dir "out"}
:as opts})
(add-js-sources inputs opts)
Given list of IJavaScript objects, add foreign-deps, constants-table IJavaScript objects to the list.
Given list of IJavaScript objects, add foreign-deps, constants-table IJavaScript objects to the list.
(add-preloads inputs opts)
Add :preloads to a given set of inputs (IJavaScript). Returns a new list of inputs where the preloaded namespaces and their deps come immediately after cljs.core or the constants table depending on the optimization setting. Any files needing copying or compilation will be compiled and/or copied to the appropiate location.
Add :preloads to a given set of inputs (IJavaScript). Returns a new list of inputs where the preloaded namespaces and their deps come immediately after cljs.core or the constants table depending on the optimization setting. Any files needing copying or compilation will be compiled and/or copied to the appropiate location.
(add-source-map-link {:keys [source-map output-to] :as opts} js)
(add-wrapper {:keys [output-wrapper] :as opts} js)
(aot-cache-core)
(build opts)
(build source opts)
(build source opts compiler-env)
Given compiler options, produce runnable JavaScript. An optional source parameter may be provided.
Given compiler options, produce runnable JavaScript. An optional source parameter may be provided.
(build-modules sources opts)
Given a list of IJavaScript sources in dependency order and compiler options return a dependency sorted list of module name / description tuples. The module descriptions will be augmented with a :closure-module entry holding the Closure JSModule. Each module description will also be augmented with a :foreign-deps vector containing foreign IJavaScript sources in dependency order.
Given a list of IJavaScript sources in dependency order and compiler options return a dependency sorted list of module name / description tuples. The module descriptions will be augmented with a :closure-module entry holding the Closure JSModule. Each module description will also be augmented with a :foreign-deps vector containing foreign IJavaScript sources in dependency order.
(build-provides provides)
Given a vector of provides, builds required goog.provide statements
Given a vector of provides, builds required goog.provide statements
(check-cache-analysis-format {:keys [cache-analysis cache-analysis-format]
:as opts})
(check-main {:keys [main] :as opts})
(check-node-target {:keys [target optimizations] :as opts})
(check-npm-deps {:keys [npm-deps]})
(check-output-dir {:keys [output-dir] :as opts})
(check-output-to {:keys [output-to] :as opts})
(check-output-wrapper {:keys [output-wrapper optimizations]})
(check-preloads {:keys [preloads optimizations] :as opts})
(check-source-map {:keys [output-to source-map output-dir optimizations]
:as opts})
When :source-map is specified in opts,
When :source-map is specified in opts,
(check-source-map-path {:keys [source-map-path] :as opts})
(check-unprovided inputs)
(cljs-dependencies opts requires)
Given a list of all required namespaces, return a list of IJavaScripts which are the cljs dependencies. The returned list will not only include the explicitly required files but any transitive dependencies as well. JavaScript files will be compiled to the working directory if they do not already exist.
Only load dependencies from the classpath.
Given a list of all required namespaces, return a list of IJavaScripts which are the cljs dependencies. The returned list will not only include the explicitly required files but any transitive dependencies as well. JavaScript files will be compiled to the working directory if they do not already exist. Only load dependencies from the classpath.
(cljs-dependents-for-macro-namespaces state namespaces)
(cljs-source-for-namespace ns)
Given a namespace return the corresponding source with either a .cljs or .cljc extension.
Given a namespace return the corresponding source with either a .cljs or .cljc extension.
(-compile this opts)
Returns one or more IJavaScripts.
Returns one or more IJavaScripts.
(-find-sources this opts)
Returns one or more IJavascripts, without compiling them.
Returns one or more IJavascripts, without compiling them.
(compilable-input-paths paths)
Takes a coll of inputs as strings or files and returns a single Inputs and Compilable object.
Takes a coll of inputs as strings or files and returns a single Inputs and Compilable object.
(compile compilable opts)
Given a Compilable, compile it and return an IJavaScript.
Given a Compilable, compile it and return an IJavaScript.
(compile-client-js opts)
(compile-dir src-dir opts)
Recursively compile all cljs files under the given source directory. Return a list of JavaScriptFiles.
Recursively compile all cljs files under the given source directory. Return a list of JavaScriptFiles.
(compile-file file {:keys [output-file] :as opts})
Compile a single cljs file. If no output-file is specified, returns a string of compiled JavaScript. With an output-file option, the compiled JavaScript will written to this location and the function returns a JavaScriptFile. In either case the return value satisfies IJavaScript.
Compile a single cljs file. If no output-file is specified, returns a string of compiled JavaScript. With an output-file option, the compiled JavaScript will written to this location and the function returns a JavaScriptFile. In either case the return value satisfies IJavaScript.
(compile-form-seq forms)
(compile-form-seq forms opts)
Compile a sequence of forms to a JavaScript source string.
Compile a sequence of forms to a JavaScript source string.
(compile-from-jar jar-file {:keys [output-file] :as opts})
Compile a file from a jar if necessary. Returns IJavaScript.
Compile a file from a jar if necessary. Returns IJavaScript.
(compile-inputs inputs opts)
Compile inputs and all of their transitive dependencies including JS modules, libs, and foreign libs. Duplicates the pipeline of build.
Compile inputs and all of their transitive dependencies including JS modules, libs, and foreign libs. Duplicates the pipeline of build.
(compile-loader inputs {:keys [modules] :as opts})
Special compilation pass for cljs.loader namespace. cljs.loader must be compiled last after all inputs. This is because all inputs must be known and they must already be sorted in dependency order.
Special compilation pass for cljs.loader namespace. cljs.loader must be compiled last after all inputs. This is because all inputs must be known and they must already be sorted in dependency order.
(compile-ns ns opts)
Compiles a namespace and all of its transitive dependencies. See compile-inputs.
Compiles a namespace and all of its transitive dependencies. See compile-inputs.
(compile-sources inputs opts)
(compile-sources inputs compiler-stats opts)
Takes dependency ordered list of IJavaScript compatible maps from parse-ns and compiles them.
Takes dependency ordered list of IJavaScript compatible maps from parse-ns and compiles them.
(compile-task deque input-set compiled opts failed)
(compiled-file m)
Given a map with at least a :file key, return a map with {:file .. :provides .. :requires ..}.
Compiled files are cached so they will only be read once.
Given a map with at least a :file key, return a map with {:file .. :provides .. :requires ..}. Compiled files are cached so they will only be read once.
(compute-upstream-npm-deps)
(compute-upstream-npm-deps {:keys [npm-deps]})
(convert-js-modules js-modules opts)
Takes a list JavaScript modules as an IJavaScript and rewrites them into a Google Closure-compatible form. Returns list IJavaScript with the converted module code set as source.
Takes a list JavaScript modules as an IJavaScript and rewrites them into a Google Closure-compatible form. Returns list IJavaScript with the converted module code set as source.
(create-client-js-file opts file-path)
(deps-file opts sources)
Return a deps file string for a sequence of inputs.
Return a deps file string for a sequence of inputs.
(elide-strict js {:keys [elide-strict] :as opts})
(emit-optimized-source-map sm-json sources name opts)
Given a JSON parsed Google Closure JavaScript to JavaScript source map, the entire list of original IJavaScript sources output a merged JavaScript to ClojureScript source map file with the given file name. opts should supply :preamble-line-count and :foreign-deps-line-count if they are relevant.
Given a JSON parsed Google Closure JavaScript to JavaScript source map, the entire list of original IJavaScript sources output a merged JavaScript to ClojureScript source map file with the given file name. opts should supply :preamble-line-count and :foreign-deps-line-count if they are relevant.
(ensure-cljs-base-module modules)
(ensure-cljs-base-module modules opts)
Ensure that compiler :modules map has :cljs-base module with defined :output-to. If :output-to not provided will default to :output-dir location and the name of the file will be "cljs_base.js."
Ensure that compiler :modules map has :cljs-base module with defined :output-to. If :output-to not provided will default to :output-dir location and the name of the file will be "cljs_base.js."
(ensure-module-opts opts)
(expand-libs libs)
EXPERIMENTAL. Given a set of libs expand any entries which only name directories into a sequence of lib entries for all JS files recursively found in that directory. All other options will be shared with the original entry. The computed :provides assumes the specified directory is on the classpath.
EXPERIMENTAL. Given a set of libs expand any entries which only name directories into a sequence of lib entries for all JS files recursively found in that directory. All other options will be shared with the original entry. The computed :provides assumes the specified directory is on the classpath.
(find-cljs-dependencies requires)
Given set of cljs namespace symbols, find IJavaScript objects for the namespaces.
Given set of cljs namespace symbols, find IJavaScript objects for the namespaces.
(find-jar-sources this opts)
(find-sources compilable opts)
Given a Compilable, find sources and return a sequence of IJavaScript.
Given a Compilable, find sources and return a sequence of IJavaScript.
(fingerprint-out-file content out-file)
(fingerprinted-modules modules fingerprint-info)
(foreign-deps-str opts sources)
(foreign-source? js)
(get-compiled-cljs opts {:keys [relative-path uri]})
Return an IJavaScript for this file. Compiled output will be written to the working directory.
Return an IJavaScript for this file. Compiled output will be written to the working directory.
(get-data-readers*)
(get-data-readers* classloader)
returns a merged map containing all data readers defined by libraries on the classpath.
returns a merged map containing all data readers defined by libraries on the classpath.
(get-source-files js-modules opts)
(get-upstream-deps*)
(get-upstream-deps* classloader)
returns a merged map containing all upstream dependencies defined by libraries on the classpath.
returns a merged map containing all upstream dependencies defined by libraries on the classpath.
(handle-js-modules {:keys [npm-deps target] :as opts} js-sources compiler-env)
Given all Cljs sources (build inputs and dependencies in classpath)
Given all Cljs sources (build inputs and dependencies in classpath) - index all the node node modules - process the JS modules (preprocess + convert to Closure JS) - save js-dependency-index for compilation
(in-same-dir? path-1 path-2)
Checks that path-1 and path-2 are siblings in the same logical directory.
Checks that path-1 and path-2 are siblings in the same logical directory.
(index-node-modules modules)
(index-node-modules modules opts)
(index-node-modules-dir)
(index-node-modules-dir opts)
(-paths this)
Returns the file paths to the source inputs
Returns the file paths to the source inputs
(-source-map this)
Return the CLJS compiler generated JS source mapping
Return the CLJS compiler generated JS source mapping
(-source-url this)
Return the CLJS source url
Return the CLJS source url
(jar-file-to-disk url out-dir)
(jar-file-to-disk url out-dir opts)
Copy a file contained within a jar to disk. Return the created file.
Copy a file contained within a jar to disk. Return the created file.
(javascript-file foreign url provides requires)
(javascript-file foreign url source-url provides requires lines source-map)
(js-dependencies opts requires)
Given a sequence of Closure namespace strings, return the list of all dependencies. The returned list includes all Google and third-party library dependencies.
Third-party libraries are configured using the :libs option where the value is a list of directories containing third-party libraries.
Given a sequence of Closure namespace strings, return the list of all dependencies. The returned list includes all Google and third-party library dependencies. Third-party libraries are configured using the :libs option where the value is a list of directories containing third-party libraries.
Takes an IJavaScript with the source code set as source, transforms the source code and returns an IJavascript with the new code set as source.
Takes an IJavaScript with the source code set as source, transforms the source code and returns an IJavascript with the new code set as source.
(lang-key->lang-mode key)
(lib-rel-path {:keys [lib-path url provides] :as ijs})
(load-data-readers! compiler)
(load-externs {:keys [externs use-only-custom-externs target ups-externs
infer-externs]
:as opts})
Externs are JavaScript files which contain empty definitions of functions which will be provided by the environment. Any function in an extern file will not be renamed during optimization.
Options may contain an :externs key with a list of file paths to load. The :use-only-custom-externs flag may be used to indicate that the default externs should be excluded.
Externs are JavaScript files which contain empty definitions of functions which will be provided by the environment. Any function in an extern file will not be renamed during optimization. Options may contain an :externs key with a list of file paths to load. The :use-only-custom-externs flag may be used to indicate that the default externs should be excluded.
(make-closure-compiler)
(make-convert-js-module-options opts)
(make-options opts)
Create a CompilerOptions object and set options from opts map.
Create a CompilerOptions object and set options from opts map.
(make-preamble {:keys [target preamble hashbang]})
(map->javascript-file m)
(mark-cljs-ns-for-recompile! ns-sym output-dir)
(maybe-install-node-deps! {:keys [npm-deps verbose] :as opts})
(module-type->keyword module-type)
(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.
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-module-deps entry)
(node-module-deps {:keys [file]} {:keys [target] :as opts})
EXPERIMENTAL: return the foreign libs entries as computed by running
the module-deps package on the supplied JavaScript entry point. Assumes
that the @cljs-oss/module-deps
NPM package is either locally or globally
installed.
EXPERIMENTAL: return the foreign libs entries as computed by running the module-deps package on the supplied JavaScript entry point. Assumes that the `@cljs-oss/module-deps` NPM package is either locally or globally installed.
(normalize-closure-defines defines)
(optimize opts & sources)
Use the Closure Compiler to optimize one or more JavaScript files.
Use the Closure Compiler to optimize one or more JavaScript files.
(optimize-modules opts & sources)
Use the Closure Compiler to optimize one or more Closure JSModules. Returns a dependency sorted list of module name and description tuples.
Use the Closure Compiler to optimize one or more Closure JSModules. Returns a dependency sorted list of module name and description tuples.
(output-bootstrap {:keys [target] :as opts})
(output-deps-file opts sources)
(output-directory opts)
(output-main-file opts)
Output an entry point. In the non-modules case, opts is simply compiler options. When emitting a module entry point, opts must contain :module-name.
Output an entry point. In the non-modules case, opts is simply compiler options. When emitting a module entry point, opts must contain :module-name.
(output-modules opts js-sources modules)
Given compiler options, original IJavaScript sources and a sequence of module name and module description tuples output module sources to disk. Modules description must define :output-to and supply :source entry with the JavaScript source to write to disk.
Given compiler options, original IJavaScript sources and a sequence of module name and module description tuples output module sources to disk. Modules description must define :output-to and supply :source entry with the JavaScript source to write to disk.
(output-one-file {:keys [output-to fingerprint] :as opts} js)
(output-unoptimized {:keys [modules] :as 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.
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.
(parallel-compile-sources inputs compiler-stats opts)
(parse-js-ns f)
(path-from-jarfile url)
Given the URL of a file within a jar, return the path of the file from the root of the jar.
Given the URL of a file within a jar, return the path of the file from the root of the jar.
(path-relative-to base input)
Generate a string which is the path to the input IJavaScript relative to the specified base file.
Generate a string which is the path to the input IJavaScript relative to the specified base file.
(preamble-from-paths paths)
(preloads syms)
(preloads syms mode)
(preprocess-js {:keys [preprocess] :as js-module} opts)
Given js-module map, apply preprocessing defined by :preprocess value in the map.
Given js-module map, apply preprocessing defined by :preprocess value in the map.
(process-js-modules opts)
Given the current compiler options, converts JavaScript modules to Google Closure modules and writes them to disk. Adds mapping from original module namespace to new module namespace to compiler env. Returns modified compiler options where new modules are passed with :libs option.
Given the current compiler options, converts JavaScript modules to Google Closure modules and writes them to disk. Adds mapping from original module namespace to new module namespace to compiler env. Returns modified compiler options where new modules are passed with :libs option.
(random-char)
(random-string length)
(read-js f)
Read a JavaScript file returning a map of file information.
Read a JavaScript file returning a map of file information.
(rel-output-path js)
(rel-output-path js opts)
Given a IJavaScript which points to a .js file either in memory, in a jar file, or is a foreign lib, return the path relative to the output directory.
Given a IJavaScript which points to a .js file either in memory, in a jar file, or is a foreign lib, return the path relative to the output directory.
(remove-goog-base inputs)
(report-failure result)
(same-or-subdirectory-of? dir path)
Checks that path names a file or directory that is the dir or a subdirectory there of.
Checks that path names a file or directory that is the dir or a subdirectory there of.
(set-options opts compiler-options)
TODO: Add any other options that we would like to support.
TODO: Add any other options that we would like to support.
(shim-process? {:keys [target process-shim] :as opts})
(source-for-namespace 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
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
(source-on-disk opts js)
Ensure that the given IJavaScript exists on disk in the output directory. Return updated IJavaScript with the new location if necessary.
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 src)
(src-file->goog-require src {:keys [wrap all-provides macros-ns] :as options})
(src-file->target-file src)
(src-file->target-file src opts)
(target-file-for-cljs-ns ns-sym output-dir)
(to-charset charset)
(validate-opts opts)
(watch source opts)
(watch source opts compiler-env)
(watch source opts compiler-env quit)
Given a source directory, produce runnable JavaScript. Watch the source directory for changes rebuilding when necessary. Takes the same arguments as cljs.closure/build in addition to some watch-specific options:
Given a source directory, produce runnable JavaScript. Watch the source directory for changes rebuilding when necessary. Takes the same arguments as cljs.closure/build in addition to some watch-specific options: - :watch-fn, a function of no arguments to run after a successful build. May be a function value or a namespaced symbol identifying a function, in which case the associated namespace willl be loaded and the symbol resolved. - :watch-error-fn, a function receiving the exception of a failed build. May be a function value or a namespaced symbol, loaded as with :watch-fn.
(write-javascript opts js)
Write or copy a JavaScript file to output directory. Only write if the file does not already exist. Return IJavaScript for the file on disk at the new location.
Write or copy a JavaScript file to output directory. Only write if the file does not already exist. Return IJavaScript for the file on disk at the new location.
(write-js? js)
Returns true if IJavaScript instance needs to be written/copied to output directory. True when in memory, in a JAR, or if foreign library.
Returns true if IJavaScript instance needs to be written/copied to output directory. True when in memory, in a JAR, or if foreign library.
(write-variable-maps result opts)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close