source-list-map
API
Example
var SourceListMap = SourceListMap;// Create a new mapvar map = ;// Add generated code that is map line to line to some souremap;// Add generated code that isn't mappedmap;// Get SourceMap and generated sourcemap;// {// source: 'Generated\ncode1\nGenerated\ncode2\n',// map: {// version: 3,// file: 'generated-code.js',// sources: [ 'source-code.js' ],// sourcesContent: [ 'Orginal\nsource' ],// mappings: 'AAAA;AACA;;;'// }// }// Convert existing SourceMap into SourceListMap// (Only the first mapping per line is preserved)var fromStringWithSourceMap = fromStringWithSourceMap;var map = ;
new SourceListMap()
SourceListMap.prototype.add
SourceListMapprototypeSourceListMapprototypeSourceListMapprototype
Append some stuff.
SourceListMap.prototype.prepend
SourceListMapprototypeSourceListMapprototypeSourceListMapprototype
Prepend some stuff.
SourceListMap.prototype.toString()
Get generated code.
SourceListMap.prototype.toStringWithSourceMap
SourceListMapprototype
Get generated code and SourceMap. options
can contains file
property which defines the file
property of the SourceMap.
SourceListMap.prototype.mapGeneratedCode
SourceListMapprototype
Applies fn
to each generated code block (per line). The returned value is set as new generated code. Returns a new SourceListMap.
Removing and adding lines is supported. The SourceMap complexity will increase when doing this.
Test
License
Copyright (c) 2017 JS Foundation
MIT (http://www.opensource.org/licenses/mit-license.php)