Skip to content

Releases

v1.2.4

Choose a tag to compare

@7rulnik 7rulnik released this 19 Nov 12:12

Index source maps

  • Fix originalPositionFor returning nulls at the first column of a section (#99)

    Reported by @trackoor in #82.

  • Fix a section's column offset being applied to its second line instead of its first (#104)

    This affected sections with both a line and a column offset, in eachMapping, generatedPositionFor, SourceMapGenerator.fromSourceMap and SourceNode.fromStringWithSourceMap.

  • Support allGeneratedPositionsFor (#105)

    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 (#115)

    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 (#116)

Other fixes

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

    Reported by @trackoor in #83. This is common in bundles, where a source can be listed after its code was tree-shaken away.

  • Fix allGeneratedPositionsFor returning positions that belong to a different source (#102)

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

  • Fix SourceNode#replaceRight throwing on a node without children (#114)

TypeScript

  • Fix type definitions that didn't match the runtime, without breaking changes (#117)

    • 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 by @lahmatiy in #75.
    • 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 (#97)

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

v1.2.3

Choose a tag to compare

@7rulnik 7rulnik released this 18 Nov 19:36
  • Fix CSP violation reported in browsers that don't permit unsafe-eval (#85)

    Reported by @Viktor-Ivliev in #81. The library no longer uses new Function at all. As a side effect, sorting mappings is ~40% faster on Node 22, 24 and 26: consuming source maps is up to 40% faster, and SourceMapConsumer.fromSourceMap 20–40% faster.

v1.2.2

Choose a tag to compare

@7rulnik 7rulnik released this 30 Sep 13:34

v1.2.1

Choose a tag to compare

@7rulnik 7rulnik released this 08 Sep 16:24
428d49f

v1.2.0

Choose a tag to compare

@7rulnik 7rulnik released this 19 Mar 16:22
9b69fab

Allow to pass options to SourceMapGenerator using SourceMapGenerator.fromSourceMap as second argument

var generator = sourceMap.SourceMapGenerator.fromSourceMap(new SourceMapConsumer(), {
  ignoreInvalidMapping: true,
});
  • Add generator options to fromSourceMap (#22) @ai

v1.1.0

Choose a tag to compare

@7rulnik 7rulnik released this 17 Mar 19:34
f0a16e5

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 (#20) @ai
  • Add ignoreInvalidMapping option (#21) @7rulnik

v1.0.3

Choose a tag to compare

@7rulnik 7rulnik released this 17 Mar 18:33
2ab15d9
  • Use sourceContents when non-null, even if it's an empty string (#17) @bshepherdson

v1.0.2

Choose a tag to compare

@7rulnik 7rulnik released this 17 Mar 18:33
04907d5

1.0.1

Choose a tag to compare

@7rulnik 7rulnik released this 08 Nov 19:46
47654d2
  • Remove cleanComments optimization (#10) @ai

1.0.0

Choose a tag to compare

@7rulnik 7rulnik released this 04 Nov 20:54
895d9cc

Breaking Changes

Bundled files like source-map-js/dist/* doesn't exist anymore. Use source-map-js/lib/*.

PRs