Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bengourley/source-map-decoder

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

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

  • 1.0.1-0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
136
increased by36%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 12 Jul 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc