- new Builder()
- config()
- loadConfig()
- loadConfigSync()
- reset()
- invalidate()
- bundle()
- buildStatic()
- trace()
- addTrees()
- subtractTrees()
- intersectTrees()
baseURL
: Sets the root for the loader
configFilePath
: A systemjs config file conforming to the [systemjs config api] (https://github.com/systemjs/systemjs/blob/master/docs/config-api.md)
new Builder('/scripts', 'config.js');
config
: An object conforming to the [config api] (https://github.com/systemjs/systemjs/blob/master/docs/config-api.md)
builder.config({
map: {
'a': 'b.js'
}
});
configFilePath
: A systemjs config file conforming to the [systemjs config api] (https://github.com/systemjs/systemjs/blob/master/docs/config-api.md)
Returns a promise which resolves when config has been loaded
builder.loadConfig('config.js').then(() => {
});
Synchronous version of builder.loadConfig()
configFilePath
: A systemjs config file conforming to the [systemjs config api] (https://github.com/systemjs/systemjs/blob/master/docs/config-api.md)
builder.loadConfigSync('config.js');
Reset the builder config to its initial state and clear loader registry. This will remove any registered modules, but will maintain the builder's compiled module cache. For efficiency, use builder.invalidate() to clear individual modules from the cache.
builder.reset();
Removes a module from the loader cache
moduleName
: The name of the module to invalidate, this can include wildcards
Returns the list of invalidated modules
builder.invalidate("/jquery.js");
builder.invalidate("someLib/*");
Concatenate all modules in the tree or module tree expression and optionally write them out to a file
tree
: A tree object as returned from builder.trace(), or one of the arithmetic functions
expression
: A module tree expression
moduleNames
: An array of exact, unnormalized module names
Important: The module names in expression
or moduleNames
should only be /
separated (On Windows, do NOT use \
as your path separator for this argument). The module names are specified in URL space; in particular, they are not file-paths.
outfile
: The file to write out the bundle to
options
: Additional bundle options as outlined below
Returns a promise which resolves with the bundle content
minify
: Minify source in bundle output (Default:true)
uglify
: Options to pass to uglifyjs
mangle
: Allow the minifier to shorten non-public variable names (Default:false)
sourceMaps
: Generate source maps for minified code (Default:false)
sourceMapContents
: Include original source in the generated sourceMaps, this will generate a self-contained sourceMap which will not require the browser to load the original source file during debugging (Default:false)
lowResSourceMaps
: When true, use line-number level source maps, when false, use character level source maps (Default:false)
globalName
: When building a self-executing bundle, assign the bundle output to a global variable (Default:null)
globalDeps
: When building a self-executing bundle, indicates external dependendencies available in the global context (Default:{})
fetch
: Override the fetch function to retrieve module source manually (Default:undefined)
normalize
: Rewrite required module names to their normalized names (Default:false)
anonymous
: Compile modules as anonymous modules (Default:false)
systemGlobal
: The global used to register compiled modules with systemjs (Default:'System')
format
: Module format to compile modules to (Default:'umd')
builder.bundle('moduleA.js', { minify:true }).then((bundle) => {
//bundle contains source to moduleA.js + dependencies
});
Similar to builder.bundle() but builds a self-executing bundle
tree
: A tree object as returned from builder.trace(), or one of the arithmetic functions
expression
: A module tree expression
Important: The module names in expression
or moduleNames
should only be /
separated (On Windows, do NOT use \
as your path separator for this argument). The module names are specified in URL space; in particular, they are not file-paths.
outfile
: The file to write out the bundle to
options
: Additional bundle options as outlined in builder.bundle()
Returns a promise which resolves with the bundle content
builder.buildStatic('moduleA.js').then((sfxBundle) => {
//sfxBundle contains source to moduleA.js + dependencies + self-executing intialization code
});
Creates the module tree object represented by expression
expression
: A module tree expression
Important: The module names in expression
should only be /
separated (On Windows, do NOT use \
as your path separator for this argument). The module names are specified in URL space; in particular, they are not file-paths.
Returns a promise which resolves with the module tree
builder.trace('moduleA.js').then((moduleTree) => {
});
let moduleTree = builder.addTrees('moduleA.js', 'moduleB.js')
let moduleTree = builder.subtractTrees('moduleA.js', 'moduleB.js');
let moduleTree = builder.intersectTrees('moduleA.js', 'moduleB.js');
builder.buildStatic
, builder.bundle
and builder.trace
accept module tree expressions
Represents moduleA and all of its dependencies
'moduleA.js'
Represents moduleA only
'[moduleA.js]'
Represents a tree that combines moduleA, moduleB and their dependencies
'moduleA.js + moduleB.js'
Represents a tree that includes moduleA and its dependencies, excluding moduleB and its dependencies
'moduleA.js - moduleB.js'
Represents the dependencies shared between moduleA and moduleB
'moduleA.js & moduleB.js'
Represents the combination of all modules in dirA and their dependencies
'dirA/*'
Use parenthesis to group module tree operations
'(moduleA.js & moduleB.js) + moduleC.js'