API for cljs.build.api - clojurescript


Full namespace name: cljs.build.api

Overview

This is intended to be a stable api for those who need programmatic access
to ClojureScript's project building facilities.

For example: a build script may need to how to invalidate compiled
files so that they will be recompiled.

Public Variables and Functions



add-dependencies

function
Usage: (add-dependencies opts & ijss)
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-implicit-options

function
Usage: (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
Usage: (build source opts)
       (build source opts compiler-env)
Given a source which can be compiled, produce runnable JavaScript.

    
    
    
  


cljs-dependents-for-macro-namespaces

function
Usage: (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)

    
    
    
  


compile

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

    
    
    
  


goog-dep-string

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

    
    
    
  


inputs

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

    
    
    
  


mark-cljs-ns-for-recompile!

function
Usage: (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.

    
    
    
  


ns->location

function
Usage: (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
Usage: (ns->source ns)
Given a namespace as a symbol return the corresponding resource if it exists.

    
    
    
  


output-unoptimized

function
Usage: (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
Usage: (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
Usage: (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
Usage: (src-file->goog-require src)
       (src-file->goog-require src options)
       (src-file->goog-require state src options)
Given a ClojureScript or Google Closure style JavaScript source file return
the goog.require statement for it.

    
    
    
  


src-file->target-file

function
Usage: (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
Usage: (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) ->
<File: "resources/out/example/core.js">

    
    
    
  


watch

function
Usage: (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.

    
    
    
  
Logo & site design by Tom Hickey.
Clojure auto-documentation system by Tom Faulhaber.