Use to concat JS files after babel transformation.
The apis (see API) take a list of files (or blocks of code) instead of a single one and process all the list to return a babel-like object ({code:..., map:...}):
- code attribute contains the concatenation of all compiled code blocks.
- map attribute contains a source map object which is the concatenation of each source-map of each given file (or block of code). This is only available if you activated the source-map option.
npm install babel-concat
var concat = require("babel-concat")
Usage example :
var rst = concat.transformFileSync([path1, path2, ..., pathN], options)
rst.code // returns the concatenation of file1, file2, ..., fileN after they have been processed by Babel
rst.map // returns a source map, concatenation of the generated source-map of each file (only if the source-maps option has been set to true, inline or both => see babel documentation)
Same as transform from babel except that you give a list of code blocks.
codeBlocks
: list of code blocksoptions
: see babel options
Same as transformFile from babel with mutilple files.
files
: all files to transformoptions
: see babel optionscallback
: see babel callback
Same as transformFileSync from babel with mutilple files.
files
: all files to transformoptions
: see babel options
Concat all result with code and map from babel transform.
results
: all results from babel. Use option "both" or "true" to have the source map.options
: see babel options