Back to Top

spire-of-babel master

A one stop solution for working with ES2015 and React.

transform()

Transforms input based on options passed to the command and outputs to either stdout or file.

Returns

Void

lint()

Lints input based on options passed to the command.

Returns

Void

lintAndTransform()

Lints and transforms input based on options passed to the command.

Returns

Void

createPresetArray(settings)

Creates array of presets based on user settings.

Parameters

Name Type Description
settings Object

Settings object.

settings.presets String

Custom presets to load. Comma delimited value.

settings.minify Boolean

Minify output.

Examples

spire.createPresetArray({'presets': 'es2015', 'minify': true});

Returns

Array

transformFileWithBabel(file[, options])

Transforms a file with babel.

Parameters

Name Type Description
file String

File path.

options Object

Options object.

Optional
options.sourcemap Boolean

Generate sourcemap.

Optional
options.minify Boolean

Minify output.

Optional

Examples

spire.transformFileWithBabel(file).then(function (result) { console.log(result); });

Returns

Object

Promise

transformFileWithBrowserify(file[, options])

Transforms a file with browserify.

Parameters

Name Type Description
file String

File path.

options Object

Options object.

Optional
options.output Boolean

Path to save transformed file to.

Optional
options.sourcemap Boolean

Generate sourcemap.

Optional
options.minify Boolean

Minify output.

Optional

Examples

spire.transformFileWithBrowserify(file).then(function (result) { console.log(result); });

Returns

Object

Promise

transformFile(file[, options])

Transforms a file.

Parameters

Name Type Description
file String

File path.

options Object

Options object.

Optional
options.bundle Boolean

Use browserify bundler.

Optional

Examples

spire.transformFile(file, options).then(function (result) { console.log(result); });

Returns

Object

Promise

lintFile(file, configFile)

Lint a file.

Parameters

Name Type Description
file String

File path.

configFile String

Config file.

Examples

spire.lintFile(file, configFile).then(function (results) { console.log(results); });

Returns

Object

Promise

parseWatchPath(input)

Parses a path into directory and filename or file regular expression pattern.

Parameters

Name Type Description
input String

Path to parse.

Examples

console.log(utils.parseWatchPath(input));

Returns

Object

Object with directory, filename (pattern) and boolean flag.

findConfigFile(input[, filename])

Find local config file.

Parameters

Name Type Description
input String

Directory or file.

filename String

Config file name.

Optional

Examples

utils.findConfigFile(input).then((path) => console.log(path));

Returns

Object

Promise