source-map-js
1.2.4 · 19 Nov 2026BSD-3-Clause312.6M / weekRepositorynpmAtom feed
11 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
- 1.x · latest line
1.2.4
19 Nov 2026Fix
originalPositionForreturning nulls at the first column of a sectionReported
Fix a section's column offset being applied to its second line instead of its first
This affected sections with both a line and a column offset, in
eachMapping,generatedPositionFor,SourceMapGenerator.fromSourceMapandSourceNode.fromStringWithSourceMap.Support
allGeneratedPositionsForIt threw
TypeError: this._findSourceIndex is not a function. It now returns the same results as for the equivalent map without sections, with positions from every section that has the source.generatedPositionForon nested index maps threw the same error and works now too.
Index source maps
Fix
originalPositionForreturning nulls at the first column of a sectionReported
Fix a section's column offset being applied to its second line instead of its first
This affected sections with both a line and a column offset, in
eachMapping,generatedPositionFor,SourceMapGenerator.fromSourceMapandSourceNode.fromStringWithSourceMap.Support
allGeneratedPositionsForIt threw
TypeError: this._findSourceIndex is not a function. It now returns the same results as for the equivalent map without sections, with positions from every section that has the source.generatedPositionForon nested index maps threw the same error and works now too.Fix
generatedPositionForreturning made-up positionsIt only searched the first section that listed the source, and when that section had no match, it returned the section offset added to
null. It now searches all sections, sobiaspicks the closest mapping across them, and returns nulls when nothing matches.Add
computeColumnSpans
Other fixes
Fix
generatedPositionFor,allGeneratedPositionsForandeachMappingwithORIGINAL_ORDERthrowingTypeErrorwhen a source has no mappingsReported
Fix
allGeneratedPositionsForreturning positions that belong to a different sourceFix lookups throwing
RangeError: Maximum call stack size exceededon source maps with about 200,000 or more sourcesFix
SourceNode#replaceRightthrowing on a node without children
TypeScript
Fix type definitions that didn't match the runtime, without breaking changes
SourceMapConsumeracceptsversionas a number,nullentries insourcesContent, a missingnames, index maps, JSON strings and thesourceMapUrlargument. Reported by @linsk1998 in #43; a fix forsourcesContentwas proposedSourceMapConsumer.fromSourceMapis declared, andallGeneratedPositionsFortakes an optionalcolumnand returnslastColumn.The
skipValidationandignoreInvalidMappingoptions ofSourceMapGeneratorare typed.SourceNodeacceptsnulls and chunk arrays in the constructor, nested arrays inaddandprepend, and a RegExp or a replacer function inreplaceRight.
Return types that would need a breaking change, such as the
nulls fromoriginalPositionFor(#30), are documented in comments and left for the next major (#118).
Package
Set
engines.nodeto>=6.0.0The library already failed to load on older Node versions, so this only adds an install warning there.
1.2.3
18 Nov 2026Fix CSP violation reported in browsers that don't permit unsafe-eval
Reported by @Viktor-Ivliev in #81. The library no longer uses
new Functionat all. As a side effect, sorting mappings is ~40% faster on Node 22, 24 and 26: consuming source maps is up to 40% faster, andSourceMapConsumer.fromSourceMap20–40% faster.
1.2.2
30 Sep 2026- Security
Fix denial of service from malicious indexed source maps (CVE-2026-93749)
Reported
Fix crash when executing in browser with CSP script-src that don't permit unsafe-eval
1.2.1
8 Sep 2024Fix TS2306 “not a module” errors in type definitions
Ensure null source is respected
Improve ts declarations to be null-safe
1.2.0
19 Mar 2024Add generator options to fromSourceMap
Allow to pass options to
SourceMapGeneratorusingSourceMapGenerator.fromSourceMapas second argumentvar generator = sourceMap.SourceMapGenerator.fromSourceMap(new SourceMapConsumer(), { ignoreInvalidMapping: true, });Add generator options to fromSourceMap
1.1.0
17 Mar 2024Do not throw an error since broken prev map is popular issue #20
Add ignoreInvalidMapping option
Add
ignoreInvalidMappingoption toSourceMapGenerator. 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
Add ignoreInvalidMapping option
1.0.3
17 Mar 2024Use sourceContents when non-null, even if it's an empty string
1.0.2
18 Jan 2022Add types for path imports
1.0.1
8 Nov 2021Remove cleanComments optimization
1.0.0
4 Nov 2021Fix package.json#typings field
Reduce memory usage of eachMapping w/ loop
Reduce npm package size
Breaking Changes
Bundled files like
source-map-js/dist/*doesn't exist anymore. Usesource-map-js/lib/*.PRs
Fix package.json#typings field
Reduce memory usage of eachMapping w/ loop
Reduce npm package size
- 0.6.x
0.6.2
7 Feb 2021
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.