This library lets you concatenate files (with or without their own pre-generated sourcemaps), and get a single output file along with a sourcemap.
It was written for use in ember-cli via broccoli-concat.
Type: path
The root directory for resolving source and map files.
If no value is given, will default to the current working directory.
Type: Object
(Optional) Used to cache encoder results. Passing this in from the outside allows for many instances of the plugin to share one cache.
Type: string
The value assigned to the sourcemap's "file"
key, as described in the sourcemaps spec.
If no value is given, will default to the basename of outputFile
.
Type: Object
A custom Node File System module.
If no value is given, will default to require('fs-extra')
.
Type: string
If 'line'
is specified, sourceMappingURL
will be written in a single-line comment (//
).
If 'none'
is specified, no reference to the source map is included in the source file.
If anything else truthy is specified, sourceMappingURL
will be written in a block comment (/* */
).
If no value is given, or a falsey value is given, will default to 'line'
.
Type: string
Filename where the concatenated sourcemap will be written.
If no value is given, will default to the value of outputFile
, but with '.js'
replaced by '.map'
.
Type: string
If 'data'
is specified, sourceMappingURL
will contain a data URL instead of mapURL
.
If 'file'
is specified, sourceMappingURL
will contain mapURL
.
If anything else truthy is specified, the behavior is undefined.
If no value is given, or a falsey value is given, will default to 'file'
.
Type: string
The value written to the sourceMappingURL
comment.
If no value is given, will default to the basename of mapFile
.
Type: string
Filename where the concatenated source code will be written.
If you don't specify this you must specify mapURL
and file
.
Type: number
A unique id for one instance of this lib. Ensures unique filenames when reporting stats via CONCAT_STATS
env var.
Type: string
The value assigned to the sourcemap's "sourceRoot"
key, as described in the sourcemaps spec.
We depend on (a fork of)
mozilla's source-map
library,
but only to use their base64-vlq implementation,
which is in turn based on the version in the Closure Compiler.
(The fork restores the vlq decode
functionality, which source-map
considers as private API and removed in v0.5.0, and is compatible
with node 18.x, which source-map
< 0.8.0-beta.0 was not.)
We can concatenate much faster than source-map because we are specifically optimized for line-by-line concatenation.