npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

src-mp

v1.1.1

Published

Consume source maps from the command line

Downloads

206

Readme

src-mp

Consume source maps from the command line.

$ npx src-mp functions/index.js.map 6 550
webpack:///node_modules/agentkeepalive/lib/https_agent.js:18:13

  16 |     this.maxCachedSessions = this.options.maxCachedSessions;
  17 |     /* istanbul ignore next */
> 18 |     if (this.maxCachedSessions === undefined) {
     |             ^
  19 |       this.maxCachedSessions = 100;
  20 |     }
  21 |

Objective

The objective of this cli is to easily allow to see what code is behind a line and column of a transpiled code.

With the rise of transpilers (and compilers) for server code, I often found myself debuging stack traces with incomprenhensible combination of lines and column. I would always resort to installing source-map and manually consumming the source map. This tool does just that, but without the need running manually the code.

This package also has a src-mp-extract that will extract all files from the source map.

Help

src-mp <map> <line> <column>

Consume source maps from the command line

Positionals:
  map     Source map file
  line    Line in the transformed file                                  [número]
  column  Column in the transformed file                                [número]

Options:
  --help     Muestra ayuda                                            [booleano]
  --version  Muestra número de versión                                [booleano]

Example

If you are using razzle, typescript and frebase, reading the logs from the command line tools is something like the following:

$ firebase functions:log
2020-03-26T03:08:30.256Z ? myFunction: Unhandled error TypeError: u is not a function
2020-03-26T03:08:30.256Z ? myFunction:     at c.addPersonalization (/srv/functions/index.js:199:115683)
2020-03-26T03:08:30.256Z ? myFunction:     at c.addTo (/srv/functions/index.js:199:115881)
2020-03-26T03:08:30.256Z ? myFunction:     at e.exports.deepMergeDynamicTemplateData (/srv/functions/index.js:121:57684)
2020-03-26T03:08:30.256Z ? myFunction:     at c.applyDynamicTemplateData (/srv/functions/index.js:199:116432)
2020-03-26T03:08:30.256Z ? myFunction:     at c.fromData (/srv/functions/index.js:199:114449)
2020-03-26T03:08:30.256Z ? myFunction:     at new c (/srv/functions/index.js:199:113313)
2020-03-26T03:08:30.256Z ? myFunction:     at Function.create (/srv/functions/index.js:199:119725)
2020-03-26T03:08:30.256Z ? myFunction:     at e.exports.send (/srv/functions/index.js:1:176323)
2020-03-26T03:08:30.256Z ? myFunction:     at /srv/functions/index.js:204:548418
2020-03-26T03:08:30.256Z ? myFunction:     at Generator.next (<anonymous>)
2020-03-26T03:08:30.256Z ? myFunction:     at o (/srv/functions/index.js:204:547402)

This tool helps you to understand where the error really was:

$ npx src-mp functions/index.js.map 199 115683
webpack:///node_modules/@sendgrid/helpers/classes/mail.js:262:11

  260 |     //If this is dynamic, set dynamicTemplateData, or set substitutions
  261 |     if (this.isDynamic) {
> 262 |       this.applyDynamicTemplateData(personalization);
      |           ^
  263 |     }
  264 |     else {
  265 |       this.applySubstitutions(personalization);

Extract

src-mp-extract <map> <output>

Extract all files from source map

Positionals:
  map     Source map file
  output  Output folder

Options:
  --help        Muestra ayuda                                         [booleano]
  --version     Muestra número de versión                             [booleano]
  --filter, -f  Regexp in order to filter out files    [defecto: "node_modules"]