Socket
Socket
Sign inDemoInstall

@bengourley/source-map-decoder

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @bengourley/source-map-decoder

Parse a source map and output the data in a way that makes sense to humans


Version published
Weekly downloads
26
decreased by-85.87%
Maintainers
1
Install size
12.7 kB
Created
Weekly downloads
 

Readme

Source

@bengourley/source-map-decoder

Parse a source map and output the data in a way that makes sense to humans

This started life as a gist for the purpose of this blog post.

It reads a source map, and outputs an object with a similar structure, replacing the VLQ mappings property with a human-readable format:

"mappings": {
  "0": [
   ^
   └── the line number of the output file

    "231 => source.js 5:64 foo"
      ^        ^       ^    ^
      │        │       │    └── the symbol name from the source file
      │        │       │
      │        │       └── the line:column position in the source file
      │        │
      │        └── the name of the source file
      │
      └── the column number of the output file

  ]
}

Installation

npm i -g @bengourley/source-map-decoder

Usage

cat my-source-map.js.map | decode-source-map

This will output some not very pretty JSON so I recommend combining it with the jq tool (available on a mac with brew install jq) to pretty-print and colourise the output:

cat my-source-map.js.map | decode-source-map | jq .

The above command will pretty print the entire source map structure, potentially including all sources. So to just view the mappings property, use jq's selector interface:

cat my-source-map.js.map | decode-source-map | jq .mappings

License

ISC

FAQs

Last updated on 12 Jul 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc