Repository navigation
Index source maps
-
Fix
originalPositionForreturning nulls at the first column of a section (#99) -
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.fromSourceMapandSourceNode.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.generatedPositionForon nested index maps threw the same error and works now too. -
Fix
generatedPositionForreturning 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, sobiaspicks the closest mapping across them, and returns nulls when nothing matches. -
Add
computeColumnSpans(#116)
Other fixes
-
Fix
generatedPositionFor,allGeneratedPositionsForandeachMappingwithORIGINAL_ORDERthrowingTypeErrorwhen 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
allGeneratedPositionsForreturning positions that belong to a different source (#102) -
Fix lookups throwing
RangeError: Maximum call stack size exceededon source maps with about 200,000 or more sources (#113) -
Fix
SourceNode#replaceRightthrowing on a node without children (#114)
TypeScript
-
Fix type definitions that didn't match the runtime, without breaking changes (#117)
SourceMapConsumeracceptsversionas a number,nullentries insourcesContent, a missingnames, index maps, JSON strings and thesourceMapUrlargument. Reported by @linsk1998 in #43; a fix forsourcesContentwas proposed by @lahmatiy in #75.SourceMapConsumer.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.0(#97)The library already failed to load on older Node versions, so this only adds an install warning there.