Packages

source-map-js

1.2.4 · 19 Nov 2026BSD-3-Clause312.6M / weekRepositorynpmAtom feed

Your version

1.2.4

Latest19 Nov 2026Where it was published

In short

2 new8 fixed1 changed

Release note

Index source maps

  • Fix originalPositionFor returning nulls at the first column of a section

    Reported

  • 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.fromSourceMap and SourceNode.fromStringWithSourceMap.

  • Support allGeneratedPositionsFor

    It 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. generatedPositionFor on nested index maps threw the same error and works now too.

  • Fix generatedPositionFor returning made-up positions

    It 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, so bias picks the closest mapping across them, and returns nulls when nothing matches.

  • Add computeColumnSpans

Other fixes

  • Fix generatedPositionFor, allGeneratedPositionsFor and eachMapping with ORIGINAL_ORDER throwing TypeError when a source has no mappings

    Reported

  • Fix allGeneratedPositionsFor returning positions that belong to a different source

  • Fix lookups throwing RangeError: Maximum call stack size exceeded on source maps with about 200,000 or more sources

  • Fix SourceNode#replaceRight throwing on a node without children

TypeScript

  • Fix type definitions that didn't match the runtime, without breaking changes

    • SourceMapConsumer accepts version as a number, null entries in sourcesContent, a missing names, index maps, JSON strings and the sourceMapUrl argument. Reported by @linsk1998 in #43; a fix for sourcesContent was proposed

    • SourceMapConsumer.fromSourceMap is declared, and allGeneratedPositionsFor takes an optional column and returns lastColumn.

    • The skipValidation and ignoreInvalidMapping options of SourceMapGenerator are typed.

    • SourceNode accepts nulls and chunk arrays in the constructor, nested arrays in add and prepend, and a RegExp or a replacer function in replaceRight.

    Return types that would need a breaking change, such as the nulls from originalPositionFor (#30), are documented in comments and left for the next major (#118).

Package

  • Set engines.node to >=6.0.0

    The library already failed to load on older Node versions, so this only adds an install warning there.

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.