Generic file processing library.

Core library for the processing lifecycle.

new LifeCycle(options)

Creates a new LifeCycle.

readonly Config config

The lifecycle configuration.

readonly Context context

The processing context for this lifecycle.

readonly Array main

List of standard lifecycle phases.

readonly Array deploy

List of deploy lifecycle phases.


Builds the list of phases to execute.

Returns array list of phase plugins.

LifeCycle.prototype.getLifecycleConfig(opts, argv)

Abstract method to get a default lifecycle configuration.

Returns object map of lifecycle phase configurations.

LifeCycle.prototype.process(argv, phases)

Process the entire lifecycle.

This method will set the computed options on the config based on the passed argv options merged with the options specified when the instance was created.

It will then merge the result of calling getLifecycleConfig() into the lifecycle property of the computed options before retrieving the list of plugin phases to execute returned by getPlugins().

Finally it creates a processing context for this lifecycle before deferring execution to the run() method.

Returns a promise that resolves when all phases have completed.

readonly String phase

Name of the currently executing phase.

readonly Array phases

List of phases that have already executed.

Run lifecycle processing phases.

Returns a promise that resolves when all phases have completed.

Encapsulates the processing context information.

new Context(lifecycle, config)

Configure the information encapsulated by this context.

readonly String phase

Name of the currently executing phase.

readonly Array phases

List of phases that have already executed.


Alias for FileList.getFile.

Returns a File instance.

readonly Object lifecycle

Get the main lifecycle runner.

readonly Object log

Get the log helper.

readonly Object config

Get the configuration.

readonly Object options

Get the computed options encapsulated by the config.

readonly Object list

Get the file list manager.

readonly Array files

Get the output file list.

Object assets

Map of output assets.

Compatible with the webpack asset map.

Object agent

HTTP client agent.

Many plugins need to fetch resources from the network so it makes sense for them to use a common API for loading network resources and allowing resources to be cached which makes consecutive builds much faster.

Propagated when the http-cache plugin is used. The core-standard package will load the http-cache plugin automatically.

Object graph

Application resource graph.

Propagated when the graph-resources plugin is used.

Object manifest

Application manifest.

Propagated when the manifest plugin is used.

Object sitemap

Application sitemap.

Propagated when the sitemap plugin is used.

readonly Object data

Property that allows plugins to assign arbitrary data to the processing context that may be used by other plugins.

readonly Function TreeAdapter

Reference to the TreeAdapter class.

Parsers should use this class to provide a consistent API for parsing documents to abstract syntax trees with the benefits provided by the tree adapter implementation.

Encapsulates the output file lists.

The files list is an array of file objects whilst the assets list is a map of relative file paths to file objects.

new FileList(context, sources)

Create a FileList.

readonly Object context

The processing context.

readonly String root

The root directory for input files.

readonly Array sources

Raw list of input file names.

readonly Array files

List of current output files.

Object assets

Map of current output files.


Add a file to the list by name or pointer.

The file is not added if it already exists in the files list.

Returns the file on success otherwise undefined.


Remove a file from the list by name or pointer.

Returns the file on success otherwise undefined.

FileList.prototype.rewrite(options, dest)

Rewrite the output path for an existing file.

Returns the file on success otherwise undefined.

FileList.prototype.rename(options, name)

Rename the output file name for an existing file.

Returns the file on success otherwise undefined.


Get a file from the list by name or pointer.

Returns a file object or undefined.


Get a File pointer.

Accepts an input file path which becomes the file name or a map of properties for the new file.

If a File is passed it is returned.

Returns a file object.


Propagates the file lists converting file path strings to complex filewrap objects.

Abstraction for abstract syntax tree parsers and serializers that provides a common API for interacting with abstract syntax trees.

This implementation provides a mechanism for lazily converting buffers to strings when the tree is parsed and lazily parsing when the result property is accessed.

It also allows for trees to be marked as dirty, if a tree has not been marked as dirty and serialize is called the original content is returned.

new TreeAdapter(parse, serialize, iterator, content[, clone])

Create a TreeAdapter.

All constructor parameters are required.


Calls the underlying AST parse closure and sets the result on this adapter.

Returns this tree adapter.


Calls the underlying AST serialize closure.

Returns the serialize closure return value.


Gets a copy of this tree adapter sharing the same parse, serialize iterator and clone closures.

If the consumer passed a clone function to the constructor it is called with the cloned tree adapter so that the consumer can decorate the new tree if necessary.

Returns a new tree adapter.


Gets a file seal closure for this adapter.

If this AST is not dirty the original content is returned.

Returns a seal closure.


Calls a function passing the result AST and flags this tree as dirty.

If the passed function does not return a value it is assumed the tree is dirty otherwise the return value is coerced to a boolean and set as the dirty flag.

Returns this tree adapter.

TreeAdapter.prototype.walk(predicate, fn)

Walk the abstract syntax tree nodes.

Returns this tree adapter.

readonly Buffer|String content

Source file content.

readonly Object result

A parse result object.

Boolean dirty

Determines if the tree is dirty.