source-map-stack
v0.1.7
Published
Apply source maps of current file to stack traces.
Downloads
8
Readme
source-map-stack
Source map stack traces.
Installation
$ npm install source-map-stack
Usage
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))
}
API
.get(content)
content
- file contents with source map embedded
Returns: a SourceMapConsumer from mozilla's source-map
.stack(map, error, base)
map
- a source map consumererror
- the error whose stack will be mappedbase
- basepath of paths used in stack trace
Returns: a mapped stack trace
License
MIT