1.0.11 • Published 3 years ago

sourcemap-view v1.0.11

Weekly downloads
4
License
MIT
Repository
github
Last release
3 years ago

sourcemap-view

View the original code from the sourcemap based on the error lineno and colno.

Installation

npm install sourcemap-view

Why would you want to do that?

When js throws an exception, we can view the original code without Chrome Console or Other.

Uncaught TypeError: Cannot read property 'a' of undefined
    at a.getSameError (app.07cd8612.js:1:3842)
    at app.07cd8612.js:1:3357

Usage

const fs = require('fs');
const sourcemapView = require('sourcemap-view');

const sourcemapRaw = fs.readFileSync('./app.07cd8612.js.map', { encoding: 'utf-8'});

const view = sourcemapView(JSON.parse(sourcemapRaw));

view(1, 3842); // { file: './HelloWorld.js', lineNo: 43, colNo: 29, name: 'a', content: <Original Code> }
view(1, 3357); // { file: './HelloWorld.js', lineNo: 35, colNo: 0, name: 'setTimeout', content: <Original Code> }

License

MIT.

1.0.11

3 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago