Version 1.0.0
@stackline/source-map-js
Generates and consumes source maps
Independent maintenance of source-map-js 1.2.1. Original authors and licenses are retained.
Installation
# Preserve existing imports with an npm alias
npm install source-map-js@npm:@stackline/source-map-js@1.0.0
# Or use the scoped package name in your imports
npm install @stackline/source-map-js@1.0.0Node.js: >=0.10.0. Read the compatibility and maintenance notes before migrating.
Usage and API
The reference below may retain upstream package names. Use the alias installation above to run those imports with this Stackline release.
Source Map JS
Difference between original source-map:
TL,DR: it's fork of original source-map@0.6, but with perfomance optimizations.
This journey starts from source-map@0.7.0. Some part of it was rewritten to Rust and WASM and API became async.
It's still a major block for many libraries like PostCSS or Sass for example because they need to migrate the whole API to the async way. This is the reason why 0.6.1 has 2x more downloads than 0.7.3 while it's faster several times.

More important that WASM version has some optimizations in JS code too. This is why community asked to create branch for 0.6 version and port these optimizations but, sadly, the answer was «no». A bit later I discovered the issue created by Ben Rothman (@benthemonkey) with no response at all.
Roman Dvornov (@lahmatiy) wrote a serveral posts (russian, only, sorry) about source-map library in his own Telegram channel. He mentioned the article «Maybe you don't need Rust and WASM to speed up your JS» written by Vyacheslav Egorov (@mraleph). This article contains optimizations and hacks that lead to almost the same performance compare to WASM implementation.
I decided to fork the original source-map and port these optimizations from the article and several others PR from the original source-map.
This is a library to generate and consume the source map format described here.
Use with Node
$ npm install source-map-js
Table of Contents
- Examples
- API
- SourceMapConsumer
- new SourceMapConsumer(rawSourceMap)
- SourceMapConsumer.prototype.computeColumnSpans()
- SourceMapConsumer.prototype.originalPositionFor(generatedPosition)
- SourceMapConsumer.prototype.generatedPositionFor(originalPosition)
- SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition)
- SourceMapConsumer.prototype.hasContentsOfAllSources()
- SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])
- SourceMapConsumer.prototype.eachMapping(callback, context, order)
- SourceMapGenerator
- new SourceMapGenerator([startOfSourceMap])
- SourceMapGenerator.fromSourceMap(sourceMapConsumer)
- SourceMapGenerator.prototype.addMapping(mapping)
- SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)
- [SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]])](#sourcemapgeneratorprototypeapplysourcemapsourcemapconsumer-sourcefile-sourcemappath)
- SourceMapGenerator.prototype.toString()
- SourceNode
- [new SourceNode([line, column, source[, chunk[, name]]])](#new-sourcenodeline-column-source-chunk-name)
- SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath])
- SourceNode.prototype.add(chunk)
- SourceNode.prototype.prepend(chunk)
- SourceNode.prototype.setSourceContent(sourceFile, sourceContent)
- SourceNode.prototype.walk(fn)
- SourceNode.prototype.walkSourceContents(fn)
- SourceNode.prototype.join(sep)
- SourceNode.prototype.replaceRight(pattern, replacement)
- SourceNode.prototype.toString()
- SourceNode.prototype.toStringWithSourceMap([startOfSourceMap])
- SourceMapConsumer
Examples
Consuming a source map
var rawSourceMap = {
version: 3,
file: 'min.js',
names: ['bar', 'baz', 'n'],
sources: ['one.js', 'two.js'],
sourceRoot: 'http://example.com/www/js/',
mappings: 'CAAC,IAAI,IAAM,SAAUA,GAClB,OAAOC,IAAID;CCDb,IAAI,IAAM,SAAUE,GAClB,OAAOA'
};
var smc = new SourceMapConsumer(rawSourceMap);
console.log(smc.sources);
// [ 'http://example.com/www/js/one.js',
// 'http://example.com/www/js/two.js' ]
console.log(smc.originalPositionFor({
line: 2,
column: 28
}));
// { source: 'http://example.com/www/js/two.js',
// line: 2,
// column: 10,
// name: 'n' }
console.log(smc.generatedPositionFor({
source: 'http://example.com/www/js/two.js',
line: 2,
column: 10
}));
// { line: 2, column: 28 }
smc.eachMapping(function (m) {
// ...
});
Generating a source map
In depth guide: Compiling to JavaScript, and Debugging with Source Maps
With SourceNode (high level API)
function compile(ast) {
switch (ast.type) {
case 'BinaryExpression':
return new SourceNode(
ast.location.line,
ast.location.column,
ast.location.source,
[compile(ast.left), " + ", compile(ast.right)]
);
case 'Literal':
return new SourceNode(
ast.location.line,
ast.location.column,
ast.location.source,
String(ast.value)
);
// ...
default:
throw new Error("Bad AST");
}
}
var ast = parse("40 + 2", "add.js");
console.log(compile(ast).toStringWithSourceMap({
file: 'add.js'
}));
// { code: '40 + 2',
// map: [object SourceMapGenerator] }
With SourceMapGenerator (low level API)
var map = new SourceMapGenerator({
file: "source-mapped.js"
});
map.addMapping({
generated: {
line: 10,
column: 35
},
source: "foo.js",
original: {
line: 33,
column: 2
},
name: "christopher"
});
console.log(map.toString());
// '{"version":3,"file":"source-mapped.js","sources":["foo.js"],"names":["christopher"],"mappings":";;;;;;;;;mCAgCEA"}'
API
Get a reference to the module:
// Node.js
var sourceMap = require('source-map');
// Browser builds
var sourceMap = window.sourceMap;
// Inside Firefox
const sourceMap = require("devtools/toolkit/sourcemap/source-map.js");
SourceMapConsumer
A SourceMapConsumer instance represents a parsed source map which we can query for information about the original file positions by giving it a file position in the generated source.
new SourceMapConsumer(rawSourceMap)
The only parameter is the raw source map (either as a string which can be
JSON.parse'd, or an object). According to the spec, source maps have the
following attributes:
version: Which version of the source map spec this map is following.sources: An array of URLs to the original source files.names: An array of identifiers which can be referenced by individual mappings.sourceRoot: Optional. The URL root from which all sources are relative.sourcesContent: Optional. An array of contents of the original source files.mappings: A string of base64 VLQs which contain the actual mappings.file: Optional. The generated filename this source map is associated with.
var consumer = new sourceMap.SourceMapConsumer(rawSourceMapJsonData);
SourceMapConsumer.prototype.computeColumnSpans()
Compute the last column for each generated mapping. The last column is inclusive.
// Before:
consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" })
// [ { line: 2,
// column: 1 },
// { line: 2,
// column: 10 },
// { line: 2,
// column: 20 } ]
consumer.computeColumnSpans();
// After:
consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" })
// [ { line: 2,
// column: 1,
// lastColumn: 9 },
// { line: 2,
// column: 10,
// lastColumn: 19 },
// { line: 2,
// column: 20,
// lastColumn: Infinity } ]
SourceMapConsumer.prototype.originalPositionFor(generatedPosition)
Returns the original source, line, and column information for the generated source's line and column positions provided. The only argument is an object with the following properties:
line: The line number in the generated source. Line numbers in this library are 1-based (note that the underlying source map specification uses 0-based line numbers -- this library handles the translation).column: The column number in the generated source. Column numbers in this library are 0-based.bias: EitherSourceMapConsumer.GREATEST_LOWER_BOUNDorSourceMapConsumer.LEAST_UPPER_BOUND. Specifies whether to return the closest element that is smaller than or greater than the one we are searching for, respectively, if the exact element cannot be found. Defaults toSourceMapConsumer.GREATEST_LOWER_BOUND.
and an object is returned with the following properties:
source: The original source file, or null if this information is not available.line: The line number in the original source, or null if this information is not available. The line number is 1-based.column: The column number in the original source, or null if this information is not available. The column number is 0-based.name: The original identifier, or null if this information is not available.
consumer.originalPositionFor({ line: 2, column: 10 })
// { source: 'foo.coffee',
// line: 2,
// column: 2,
// name: null }
consumer.originalPositionFor({ line: 99999999999999999, column: 999999999999999 })
// { source: null,
// line: null,
// column: null,
// name: null }
SourceMapConsumer.prototype.generatedPositionFor(originalPosition)
Returns the generated line and column information for the original source, line, and column positions provided. The only argument is an object with the following properties:
source: The filename of the original source.line: The line number in the original source. The line number is 1-based.column: The column number in the original source. The column number is 0-based.
and an object is returned with the following properties:
line: The line number in the generated source, or null. The line number is 1-based.column: The column number in the generated source, or null. The column number is 0-based.
consumer.generatedPositionFor({ source: "example.js", line: 2, column: 10 })
// { line: 1,
// column: 56 }
SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition)
Returns all generated line and column information for the original source, line, and column provided. If no column is provided, returns all mappings corresponding to a either the line we are searching for or the next closest line that has any mappings. Otherwise, returns all mappings corresponding to the given line and either the column we are searching for or the next closest column that has any offsets.
The only argument is an object with the following properties:
source: The filename of the original source.line: The line number in the original source. The line number is 1-based.column: Optional. The column number in the original source. The column number is 0-based.
and an array of objects is returned, each with the following properties:
line: The line number in the generated source, or null. The line number is 1-based.column: The column number in the generated source, or null. The column number is 0-based.
consumer.allGeneratedpositionsfor({ line: 2, source: "foo.coffee" })
// [ { line: 2,
// column: 1 },
// { line: 2,
// column: 10 },
// { line: 2,
// column: 20 } ]
SourceMapConsumer.prototype.hasContentsOfAllSources()
Return true if we have the embedded source content for every source listed in the source map, false otherwise.
In other words, if this method returns true, then
consumer.sourceContentFor(s) will succeed for every source s in
consumer.sources.
// ...
if (consumer.hasContentsOfAllSources()) {
consumerReadyCallback(consumer);
} else {
fetchSources(consumer, consumerReadyCallback);
}
// ...
SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])
Returns the original source content for the source provided. The only argument is the URL of the original source file.
If the source content for the given source is not found, then an error is
thrown. Optionally, pass true as the second param to have null returned
instead.
consumer.sources
// [ "my-cool-lib.clj" ]
consumer.sourceContentFor("my-cool-lib.clj")
// "..."
consumer.sourceContentFor("this is not in the source map");
// Error: "this is not in the source map" is not in the source map
consumer.sourceContentFor("this is not in the source map", true);
// null
SourceMapConsumer.prototype.eachMapping(callback, context, order)
Iterate over each mapping between an original source/line/column and a generated line/column in this source map.
callback: The function that is called with each mapping. Mappings have the form{ source, generatedLine, generatedColumn, originalLine, originalColumn, name }context: Optional. If specified, this object will be the value ofthisevery time thatcallbackis called.order: EitherSourceMapConsumer.GENERATED_ORDERorSourceMapConsumer.ORIGINAL_ORDER. Specifies whether you want to iterate over the mappings sorted by the generated file's line/column order or the original's source/line/column order, respectively. Defaults toSourceMapConsumer.GENERATED_ORDER.
consumer.eachMapping(function (m) { console.log(m); })
// ...
// { source: 'illmatic.js',
// generatedLine: 1,
// generatedColumn: 0,
// originalLine: 1,
// originalColumn: 0,
// name: null }
// { source: 'illmatic.js',
// generatedLine: 2,
// generatedColumn: 0,
// originalLine: 2,
// originalColumn: 0,
// name: null }
// ...
SourceMapGenerator
An instance of the SourceMapGenerator represents a source map which is being built incrementally.
new SourceMapGenerator([startOfSourceMap])
You may pass an object with the following properties:
file: The filename of the generated source that this source map is associated with.sourceRoot: A root for all relative URLs in this source map.skipValidation: Optional. Whentrue, disables validation of mappings as they are added. This can improve performance but should be used with discretion, as a last resort. Even then, one should avoid using this flag when running tests, if possible.ignoreInvalidMapping: Optional. Whentrue, instead of throwing error on invalid mapping, it will be ignored.
var generator = new sourceMap.SourceMapGenerator({
file: "my-generated-javascript-file.js",
sourceRoot: "http://example.com/app/js/"
});
SourceMapGenerator.fromSourceMap(sourceMapConsumer, sourceMapGeneratorOptions)
Creates a new SourceMapGenerator from an existing SourceMapConsumer instance.
sourceMapConsumerThe SourceMap.sourceMapGeneratorOptionsoptions that will be passed to the SourceMapGenerator constructor which used under the hood.
var generator = sourceMap.SourceMapGenerator.fromSourceMap(consumer, {
ignoreInvalidMapping: true,
});
SourceMapGenerator.prototype.addMapping(mapping)
Add a single mapping from original source line and column to the generated source's line and column for this source map being created. The mapping object should have the following properties:
generated: An object with the generated line and column positions.original: An object with the original line and column positions.source: The original source file (relative to the sourceRoot).name: An optional original token name for this mapping.
generator.addMapping({
source: "module-one.scm",
original: { line: 128, column: 0 },
generated: { line: 3, column: 456 }
})
SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)
Set the source content for an original source file.
sourceFilethe URL of the original source file.sourceContentthe content of the source file.
generator.setSourceContent("module-one.scm",
fs.readFileSync("path/to/module-one.scm"))
SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]])
Applies a SourceMap for a source file to the SourceMap. Each mapping to the supplied source file is rewritten using the supplied SourceMap. Note: The resolution for the resulting mappings is the minimum of this map and the supplied map.
sourceMapConsumer: The SourceMap to be applied.sourceFile: Optional. The filename of the source file. If omitted, sourceMapConsumer.file will be used, if it exists. Otherwise an error will be thrown.sourceMapPath: Optional. The dirname of the path to the SourceMap to be applied. If relative, it is relative to the SourceMap.This parameter is needed when the two SourceMaps aren't in the same directory, and the SourceMap to be applied contains relative source paths. If so, those relative source paths need to be rewritten relative to the SourceMap.
If omitted, it is assumed that both SourceMaps are in the same directory, thus not needing any rewriting. (Supplying
'.'has the same effect.)
SourceMapGenerator.prototype.toString()
Renders the source map being generated to a string.
generator.toString()
// '{"version":3,"sources":["module-one.scm"],"names":[],"mappings":"...snip...","file":"my-generated-javascript-file.js","sourceRoot":"http://example.com/app/js/"}'
SourceNode
SourceNodes provide a way to abstract over interpolating and/or concatenating snippets of generated JavaScript source code, while maintaining the line and column information associated between those snippets and the original source code. This is useful as the final intermediate representation a compiler might use before outputting the generated JS and source map.
new SourceNode([line, column, source[, chunk[, name]]])
line: The original line number associated with this source node, or null if it isn't associated with an original line. The line number is 1-based.column: The original column number associated with this source node, or null if it isn't associated with an original column. The column number is 0-based.source: The original source's filename; null if no filename is provided.chunk: Optional. Is immediately passed toSourceNode.prototype.add, see below.name: Optional. The original identifier.
var node = new SourceNode(1, 2, "a.cpp", [
new SourceNode(3, 4, "b.cpp", "extern int status;\n"),
new SourceNode(5, 6, "c.cpp", "std::string* make_string(size_t n);\n"),
new SourceNode(7, 8, "d.cpp", "int main(int argc, char** argv) {}\n"),
]);
SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath])
Creates a SourceNode from generated code and a SourceMapConsumer.
code: The generated codesourceMapConsumerThe SourceMap for the generated coderelativePathThe optional path that relative sources insourceMapConsumershould be relative to.
var consumer = new SourceMapConsumer(fs.readFileSync("path/to/my-file.js.map", "utf8"));
var node = SourceNode.fromStringWithSourceMap(fs.readFileSync("path/to/my-file.js"),
consumer);
SourceNode.prototype.add(chunk)
Add a chunk of generated JS to this source node.
chunk: A string snippet of generated JS code, another instance ofSourceNode, or an array where each member is one of those things.
node.add(" + ");
node.add(otherNode);
node.add([leftHandOperandNode, " + ", rightHandOperandNode]);
SourceNode.prototype.prepend(chunk)
Prepend a chunk of generated JS to this source node.
chunk: A string snippet of generated JS code, another instance ofSourceNode, or an array where each member is one of those things.
node.prepend("/** Build Id: f783haef86324gf **/\n\n");
SourceNode.prototype.setSourceContent(sourceFile, sourceContent)
Set the source content for a source file. This will be added to the
SourceMap in the sourcesContent field.
sourceFile: The filename of the source filesourceContent: The content of the source file
node.setSourceContent("module-one.scm",
fs.readFileSync("path/to/module-one.scm"))
SourceNode.prototype.walk(fn)
Walk over the tree of JS snippets in this node and its children. The walking function is called once for each snippet of JS and is passed that snippet and the its original associated source's line/column location.
fn: The traversal function.
var node = new SourceNode(1, 2, "a.js", [
new SourceNode(3, 4, "b.js", "uno"),
"dos",
[
"tres",
new SourceNode(5, 6, "c.js", "quatro")
]
]);
node.walk(function (code, loc) { console.log("WALK:", code, loc); })
// WALK: uno { source: 'b.js', line: 3, column: 4, name: null }
// WALK: dos { source: 'a.js', line: 1, column: 2, name: null }
// WALK: tres { source: 'a.js', line: 1, column: 2, name: null }
// WALK: quatro { source: 'c.js', line: 5, column: 6, name: null }
SourceNode.prototype.walkSourceContents(fn)
Walk over the tree of SourceNodes. The walking function is called for each source file content and is passed the filename and source content.
fn: The traversal function.
var a = new SourceNode(1, 2, "a.js", "generated from a");
a.setSourceContent("a.js", "original a");
var b = new SourceNode(1, 2, "b.js", "generated from b");
b.setSourceContent("b.js", "original b");
var c = new SourceNode(1, 2, "c.js", "generated from c");
c.setSourceContent("c.js", "original c");
var node = new SourceNode(null, null, null, [a, b, c]);
node.walkSourceContents(function (source, contents) { console.log("WALK:", source, ":", contents); })
// WALK: a.js : original a
// WALK: b.js : original b
// WALK: c.js : original c
SourceNode.prototype.join(sep)
Like Array.prototype.join except for SourceNodes. Inserts the separator
between each of this source node's children.
sep: The separator.
var lhs = new SourceNode(1, 2, "a.rs", "my_copy");
var operand = new SourceNode(3, 4, "a.rs", "=");
var rhs = new SourceNode(5, 6, "a.rs", "orig.clone()");
var node = new SourceNode(null, null, null, [ lhs, operand, rhs ]);
var joinedNode = node.join(" ");
SourceNode.prototype.replaceRight(pattern, replacement)
Call String.prototype.replace on the very right-most source snippet. Useful
for trimming white space from the end of a source node, etc.
pattern: The pattern to replace.replacement: The thing to replace the pattern with.
// Trim trailing white space.
node.replaceRight(/\s*$/, "");
SourceNode.prototype.toString()
Return the string representation of this source node. Walks over the tree and concatenates all the various snippets together to one string.
var node = new SourceNode(1, 2, "a.js", [
new SourceNode(3, 4, "b.js", "uno"),
"dos",
[
"tres",
new SourceNode(5, 6, "c.js", "quatro")
]
]);
node.toString()
// 'unodostresquatro'
SourceNode.prototype.toStringWithSourceMap([startOfSourceMap])
Returns the string representation of this tree of source nodes, plus a SourceMapGenerator which contains all the mappings between the generated and original sources.
The arguments are the same as those to new SourceMapGenerator.
var node = new SourceNode(1, 2, "a.js", [
new SourceNode(3, 4, "b.js", "uno"),
"dos",
[
"tres",
new SourceNode(5, 6, "c.js", "quatro")
]
]);
node.toStringWithSourceMap({ file: "my-output-file.js" })
// { code: 'unodostresquatro',
// map: [object SourceMapGenerator] }
Upstream issues and maintenance review
Upstream origin and triage
- Original package:
source-map-js@1.2.1 - Repository: https://github.com/7rulnik/source-map-js
- Source commit: https://github.com/7rulnik/source-map-js/commit/428d49f6b1e1614f082b7706fa879a3d9c64f728
- Source directory:
. - npm tarball: https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz
- SHA512 integrity:
sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA== - npm last-release age selects maintenance scope; it does not imply no ongoing source development.
Reviewed issues
Primary-source snapshot: 2026-09-29T00:21:42.767424+00:00. Most recently updated 100 open and 30 closed issue/PR entries; PRs removed. This is triage evidence, not a claim of exhaustive review.
Reject invalid indexed-map offsets and mappings outside the generated content before SourceNode line padding (upstream reports 76/77). The regression preserves valid indexed-map text.
- 76: Security Advisory: Event-loop denial of service in SourceNode via unvalidated section offset line
- 77: CVE-2026-93749 affects 1.2.1 with no fixed release available
- 43: Bug: RawSourceMap.version type should be number, not string
- 30: originalPositionFor has incorrect typing
- 14: Setup CI and automate release
- 9: Add info how to use it via yarn resolutions
The structured snapshot in .stackline/issue-triage.json also records recently closed reports. Issues for unrelated packages in shared monorepositories were qualified as outside this fork’s runtime scope. No maintainer was contacted.
URL parsing, data URL detection, and trailing-slash handling now avoid overlapping regex backtracking, with differential URL fixtures and large-input regressions.
Release changes
Change Log
1.2.1
Fix TS2306 “not a module” errors in type definitions (#16) @andersk
Ensure null source is respected (#26) @dragomirtitian
Improve ts declarations to be null-safe (#27) @dragomirtitian
1.2.0
Allow to pass options to SourceMapGenerator using SourceMapGenerator.fromSourceMap as second argument
var generator = sourceMap.SourceMapGenerator.fromSourceMap(new SourceMapConsumer(), {
ignoreInvalidMapping: true,
});
1.1.0
Add ignoreInvalidMapping option to SourceMapGenerator. If enabled, source-map-js will not throw an error on the incorrect previous source map. Instead, it will print warnings and ignore broken mappings.
var generator = new sourceMap.SourceMapGenerator({
file: "my-generated-javascript-file.js",
sourceRoot: "http://example.com/app/js/",
ignoreInvalidMapping: true,
});
- Do not throw an error since broken prev map is popular issue (#20) @ai
- Add ignoreInvalidMapping option (#21) @7rulnik
1.0.3
- Use sourceContents when non-null, even if it's an empty string (#17) @bshepherdson
1.0.2
1.0.1
1.0.0
Fix package.json#typings field (#6) @chalkygames123
It doesn't related to this fork:
0.5.6
- Fix for regression when people were using numbers as names in source maps. See #236.
0.5.5
Fix "regression" of unsupported, implementation behavior that half the world happens to have come to depend on. See #235.
Fix regression involving function hoisting in SpiderMonkey. See #233.
0.5.4
- Large performance improvements to source-map serialization. See #228 and #229.
0.5.3
- Do not include unnecessary distribution files. See commit ef7006f8d1647e0a83fdc60f04f5a7ca54886f86.
0.5.2
- Include browser distributions of the library in package.json's
files. See issue #212.
0.5.1
- Fix latent bugs in IndexedSourceMapConsumer.prototype._parseMappings. See ff05274becc9e6e1295ed60f3ea090d31d843379.
0.5.0
Node 0.8 is no longer supported.
Use webpack instead of dryice for bundling.
Big speedups serializing source maps. See pull request #203.
Fix a bug with
SourceMapConsumer.prototype.sourceContentForand sources that explicitly start with the source root. See issue #199.
0.4.4
Fix an issue where using a
SourceMapGeneratorafter having created aSourceMapConsumerfrom it viaSourceMapConsumer.fromSourceMapfailed. See issue #191.Fix an issue with where
SourceMapGeneratorwould mistakenly consider different mappings as duplicates of each other and avoid generating them. See issue #192.
0.4.3
A very large number of performance improvements, particularly when parsing source maps. Collectively about 75% of time shaved off of the source map parsing benchmark!
Fix a bug in
SourceMapConsumer.prototype.allGeneratedPositionsForand fuzzy searching in the presence of a column option. See issue #177.Fix a bug with joining a source and its source root when the source is above the root. See issue #182.
Add the
SourceMapConsumer.prototype.hasContentsOfAllSourcesmethod to determine when all sources' contents are inlined into the source map. See issue #190.
0.4.2
Add an
.npmignorefile so that the benchmarks aren't pulled down by dependent projects. Issue #169.Add an optional
columnargument toSourceMapConsumer.prototype.allGeneratedPositionsForand better handle lines with no mappings. Issues #172 and #173.
0.4.1
- Fix accidentally defining a global variable. #170.
0.4.0
The default direction for fuzzy searching was changed back to its original direction. See #164.
There is now a
biasoption you can supply toSourceMapConsumerto control the fuzzy searching direction. See #167.About an 8% speed up in parsing source maps. See #159.
Added a benchmark for parsing and generating source maps.
0.3.0
Change the default direction that searching for positions fuzzes when there is not an exact match. See #154.
Support for environments using json2.js for JSON serialization. See #156.
0.2.0
- Support for consuming "indexed" source maps which do not have any remote
sections. See pull request #127. This introduces a minor backwards
incompatibility if you are monkey patching
SourceMapConsumer.prototypemethods.
0.1.43
- Performance improvements for
SourceMapGeneratorandSourceNode. See issue #148 for some discussion and issues #150, #151, and #152 for implementations.
0.1.42
- Fix an issue where
SourceNodes from different versions of the source-map library couldn't be used in conjunction with each other. See issue #142.
0.1.41
Fix a bug with getting the source content of relative sources with a "./" prefix. See issue #145 and Bug 1090768.
Add the
SourceMapConsumer.prototype.computeColumnSpansmethod to compute the column span of each mapping.Add the
SourceMapConsumer.prototype.allGeneratedPositionsFormethod to find all generated positions associated with a given original source and line.
0.1.40
- Performance improvements for parsing source maps in SourceMapConsumer.
0.1.39
- Fix a bug where setting a source's contents to null before any source content had been set before threw a TypeError. See issue #131.
0.1.38
- Fix a bug where finding relative paths from an empty path were creating absolute paths. See issue #129.
0.1.37
- Fix a bug where if the source root was an empty string, relative source paths would turn into absolute source paths. Issue #124.
0.1.36
- Allow the
namesmapping property to be an empty string. Issue #121.
0.1.35
A third optional parameter was added to
SourceNode.fromStringWithSourceMapto specify a path that relative sources in the second parameter should be relative to. Issue #105.If no file property is given to a
SourceMapGenerator, then the resulting source map will no longer have anullfile property. The property will simply not exist. Issue #104.Fixed a bug where consecutive newlines were ignored in
SourceNodes. Issue #116.
0.1.34
Make
SourceNodework with windows style ("\r\n") newlines. Issue #103.Fix bug involving source contents and the
SourceMapGenerator.prototype.applySourceMap. Issue #100.
0.1.33
Fix some edge cases surrounding path joining and URL resolution.
Add a third parameter for relative path to
SourceMapGenerator.prototype.applySourceMap.Fix issues with mappings and EOLs.
0.1.32
Fixed a bug where SourceMapConsumer couldn't handle negative relative columns (issue 92).
Fixed test runner to actually report number of failed tests as its process exit code.
Fixed a typo when reporting bad mappings (issue 87).
0.1.31
Delay parsing the mappings in SourceMapConsumer until queried for a source location.
Support Sass source maps (which at the time of writing deviate from the spec in small ways) in SourceMapConsumer.
0.1.30
Do not join source root with a source, when the source is a data URI.
Extend the test runner to allow running single specific test files at a time.
Performance improvements in
SourceNode.prototype.walkandSourceMapConsumer.prototype.eachMapping.Source map browser builds will now work inside Workers.
Better error messages when attempting to add an invalid mapping to a
SourceMapGenerator.
0.1.29
- Allow duplicate entries in the
namesandsourcesarrays of source maps (usually from TypeScript) we are parsing. Fixes github issue 72.
0.1.28
- Skip duplicate mappings when creating source maps from SourceNode; github issue 75.
0.1.27
- Don't throw an error when the
fileproperty is missing in SourceMapConsumer, we don't use it anyway.
0.1.26
- Fix SourceNode.fromStringWithSourceMap for empty maps. Fixes github issue 70.
0.1.25
- Make compatible with browserify
0.1.24
- Fix issue with absolute paths and
file://URIs. See https://bugzilla.mozilla.org/show_bug.cgi?id=885597
0.1.23
- Fix issue with absolute paths and sourcesContent, github issue 64.
0.1.22
- Ignore duplicate mappings in SourceMapGenerator. Fixes github issue 21.
0.1.21
- Fixed handling of sources that start with a slash so that they are relative to the source root's host.
0.1.20
- Fixed github issue #43: absolute URLs aren't joined with the source root anymore.
0.1.19
- Using Travis CI to run tests.
0.1.18
- Fixed a bug in the handling of sourceRoot.
0.1.17
- Added SourceNode.fromStringWithSourceMap.
0.1.16
Added missing documentation.
Fixed the generating of empty mappings in SourceNode.
0.1.15
- Added SourceMapGenerator.applySourceMap.
0.1.14
- The sourceRoot is now handled consistently.
0.1.13
- Added SourceMapGenerator.fromSourceMap.
0.1.12
- SourceNode now generates empty mappings too.
0.1.11
- Added name support to SourceNode.
0.1.10
- Added sourcesContent support to the customer and generator.
Release files and references
Package bytes, npm provenance and the immutable GitHub release were verified for this version. Security checks describe the reviewed release; documented compatibility risks and upstream reports are not blanket claims of resolution.
