source-mapper

2.1.0 • Public • Published

Source Mapper

Build Status SemVer License

Replace stack traces with original sources using source-map. For node and the browser.

Install

npm install source-mapper

Usage

var sourceMapper = require('source-mapper');
 
var extracted = sourceMapper.extract(js);
var throughStream = sourceMapper.stream(extracted.map);

API

  • extract(string) extracts an inline source map from the given string. The returned object has the js without source maps and a map with source maps.
  • consumer(map) returns a source map consumer for the given map.
  • line(consumer, line[, offset]) maps the given line to the original source using a consumer. If offset is given, it is substracted from the line number.
  • stream(consumer[, offset]) returns a through2 stream that replaces URLs in stack traces with the original source location using a consumer. If offset is given, it is substracted from the line number.
  • stream(map[, offset]) returns a through2 stream that replaces URLs in stack traces with the original source location using a source map. If offset is given, it is substracted from the line number.

Development

Clone the repository and then run:

npm install
npm test

Compatibility

  • Node 0.10 or later
  • Browserify 5.9 or later

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.1.0
    850
    • latest

Version History

Package Sidebar

Install

npm i source-mapper

Weekly Downloads

993

Version

2.1.0

License

MIT

Unpacked Size

7.75 kB

Total Files

5

Last publish

Collaborators

  • mantoni