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

multi-stage-sourcemap

v0.3.1

Published

multi-level sourcemap

Downloads

518,525

Readme

multi-stage-sourcemap Build Status

This library provide re-mapping function for multi-level sourcemap.

Installation

npm install multi-stage-sourcemap

Concept

Basic SourceMap

well-know basic sourcemap is no problem.

basic-sourcemap.png

Multi-level SourceMap

Multi-level SourceMap has a problem.

Source Map Revision 3 Proposal doens't provide the way of mapping Minified Code to Original Code in the following figure.

multiple-sourcemap.png

Example:

A.js -> B.js     -> C.js
        B.js.map -> C.js.map

We can't see from C.js to A.js.

multi-stage-sourcemap <= THIS LIBRARY

multi-stage-sourcemap can mapping C.js to A.js

multiple-stage-sourcemap.png

The easy but lossy way is to ignore the intermediate steps in the process for the purposes of debugging, the source location information from the translation is either ignored (the intermediate translation is considered the “Original Source”) or the source location information is carried through (the intermediate translation hidden). -- Source Map Revision 3 Proposal

multi-stage-sourcemap does that!

C.js -> ... -> A.js

Code:

var transfer = require("multi-stage-sourcemap").transfer;
var cToAMap = transfer({fromSourceMap: cMap, toSourceMap: bMap});

Usage

transfer

Return the re-mapped rawSourceMap string.

The only argument is an object with the following properties:

  • fromSourceMap : Object - rawSourceMap or String - JSON.stringify(rawSourceMap)
  • toSourceMap : Object - rawSourceMap or String - JSON.stringify(rawSourceMap)

rawSourceMap is like below object.

var rawSourceMap = {
  version: 3,
  file: 'min.js',
  names: ['bar', 'baz', 'n'],
  sources: ['one.js', 'two.js'],
  sourceRoot: 'http://exammuple.com/www/js/',
  mappings: 'CAAC,IAAI,IAAM,SAAUA,GAClB,OAAOC,IAAID;CCDb,IAAI,IAAM,SAAUE,GAClB,OAAOA'
};

For details, please see mozilla/source-map.

Use Case

etc...

AltJS is languages that compile to JS. (It's contain ES6 with Traceur. )

Related library

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT