Skip to content

joshrtay/source-map-stack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

source-map-stack

Build status Git tag NPM version Code style

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 consumer
  • error - the error whose stack will be mapped
  • base - basepath of paths used in stack trace

Returns: a mapped stack trace

License

MIT

About

Source map stack traces.

Resources

Stars

Watchers

Forks

Packages

No packages published