Source map stack traces.
$ npm install source-map-stack
var sourceMap = require('source-map-stack')
var content = fs.readFileSync('build.js')
var map = sourceMap.get(content)
try {
vm.runInNewContext(content, ctx)
} catch(e) {
console.error()
console.error(sourceMap.stack(map, e))
}
-
content
- file contents with source map embedded
Returns: a SourceMapConsumer from mozilla's source-map
-
map
- a source map consumer -
error
- the error whose stack will be mapped -
base
- basepath of paths used in stack trace
Returns: a mapped stack trace
MIT