@serveside/check-source-map
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

@serveside/check-source-map

npx @serveside/check-source-map <sourcemap-filename> -l <line-number> -c <column-number>

Local sourcemap file

Read a sourcemap file given a line number and column number and return the line/column of the same in the source code:

For example:

$ npx @serveside/check-source-map ~/dist/prod.b6e7359deed79be25536.js.map -l 2 -c 106543

{
  source: 'webpack://my-project/node_modules/some-module/some-file.js',
  line: 158,
  column: 52,
  name: 'someMethodName'
}

Remote sourcemap file

Add the -r flag to the command

For example:

$ npx @serveside/check-source-map https://some-website.example.com/js/prod.b6e7359deed79be25536.js.map -l 2 -c 106543 -r

{
  source: 'webpack://my-project/node_modules/some-module/some-file.js',
  line: 158,
  column: 52,
  name: 'someMethodName'
}

Using global npm module

Run:

npm i -g @serveside/check-source-map

Then can run s-csm instead of npx @serveside/check-source-map


This module can also be used programatically:

const csm = require('@serveside/check-source-map');

async function someMethod() {
  const result = await csm.readLocalSourcemap({
    source: './some_local_map.js.map',
    line: 1,
    column 134
  });

  console.log(result);
}

The result would be the same values that are echoed out by the cli.

Can also run with the same parameters for csm.readRemoteSourcemap.

Dependencies (3)

Dev Dependencies (8)

Package Sidebar

Install

npm i @serveside/check-source-map

Weekly Downloads

7

Version

1.0.1

License

none

Unpacked Size

11.3 kB

Total Files

19

Last publish

Collaborators

  • serveside_admin
  • maniator