Last active
August 29, 2015 14:06
-
-
Save iwillig/9b34575829a2a2449132 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*jshint node: true */ | |
var sourceMap = require('source-map'), | |
fs = require('fs'); | |
function main() { | |
var newMapping = new sourceMap.SourceMapGenerator(); | |
var source = new sourceMap.SourceMapConsumer(require('./tangram.debug.js.map.json')); | |
/* | |
map.addMapping({ | |
generated: { | |
line: 10, | |
column: 35 | |
}, | |
source: "foo.js", | |
original: { | |
line: 33, | |
column: 2 | |
}, | |
name: "christopher" | |
}); | |
{ source: '/home/ivan/dev/mapzen/tangram/node_modules/gl-matrix/dist/gl-matrix.js', | |
generatedLine: 1896, | |
generatedColumn: 0, | |
originalLine: 1895, | |
originalColumn: 0, | |
name: undefined } | |
*/ | |
source.eachMapping(function (oldMapping) { | |
var mapping = { | |
source: oldMapping.source, | |
generated: { | |
line: oldMapping.generatedLine, | |
column: oldMapping.generatedColumn | |
}, | |
original: { | |
line: oldMapping.originalLine, | |
column: oldMapping.originalColumn | |
} | |
}; | |
newMapping.addMapping(mapping); | |
}, this, sourceMap.SourceMapConsumer.ORIGINAL_ORDER); | |
fs.writeFileSync('test.json', newMapping.toString()); | |
} | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment