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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@srcmap/remapping

v0.6.0

Published

The @jridgewell/remapping and @ampproject/remapping API on the srcmap Rust remapping code, compiled to WebAssembly

Readme

@srcmap/remapping

npm CI

The API of @jridgewell/remapping and @ampproject/remapping on the srcmap Rust remapping code, compiled to WebAssembly.

remapping(maps, loader) takes the arguments of @jridgewell/remapping and returns a SourceMap with the same fields.

On the maps of four recorded Vite 8 runs, it gives the same output as @jridgewell/remapping. On the three larger runs it is 1.3 to 1.7 times faster on the first pass, and 1.5 to 1.9 times faster on later passes. benchmarks/vite-workload.mjs in the repository reproduces this result.

The wrapper gives each map to WASM as parts, not as JSON. A map that it cannot take that way with certainty (for example a map with an unknown key, or a string with a lone surrogate) takes a slower JSON path, with the same result.

It also fits a Node.js tool that must compose maps the same way as a Rust tool with srcmap-remapping.

Install

npm install @srcmap/remapping

Usage

// Before:
// import remapping from '@jridgewell/remapping'
// import remapping from '@ampproject/remapping'

// After:
import remapping from '@srcmap/remapping'

// Remap a single source map through a loader
const composed = remapping(minifiedMap, (sourcefile) => {
  // Return the upstream source map for this file, or null
  return upstreamMaps[sourcefile] ?? null
})

console.log(composed.sources)    // Original sources
console.log(composed.mappings)   // Composed VLQ mappings
console.log(composed.toString()) // JSON string

Compose an array of source maps

// When you have the full chain: [minified map, intermediate map, original map]
const composed = remapping([minifiedMap, intermediateMap], (sourcefile) => {
  return upstreamMaps[sourcefile] ?? null
})

API compatibility

| Export | Description | |--------|-------------| | remapping(input, loader, options?) | Remap a single source map through a loader | | remapping(inputs[], loader, options?) | Compose an array of source maps | | SourceMap | Result class with version, file, mappings, sources, sourcesContent, names, ignoreList |

The loader function receives a source filename and a LoaderContext, and should return the upstream source map (as a JSON string, parsed object, or decoded source map), or null if no upstream map exists. As in @jridgewell/remapping, the loader is called again for the sources of each map that it returns, and it can set ctx.source, ctx.content and ctx.ignore for a source without an upstream map.

options takes excludeContent and decodedMappings. true means { excludeContent: true }.

SourceMap result

| Property / Method | Type | Description | |--------|------|-------------| | version | number | Source map version (always 3) | | file | string \| undefined | Output filename | | mappings | string \| number[][][] | VLQ-encoded mappings, or decoded segments with decodedMappings | | sources | (string \| null)[] | Source filenames | | sourcesContent | (string \| null)[] \| undefined | Inline source contents, left out with excludeContent | | names | string[] | Name strings | | ignoreList | number[] | Indices of ignored sources | | toString() | string | Serialize as JSON string | | toJSON() | RawSourceMap | Return as parsed object |

Differences from @jridgewell/remapping

  • WASM-powered: Composition runs in Rust via WebAssembly
  • Indexed source maps: Handled natively (no JS-side flattening)
  • ctx.source that is not a string: As in @jridgewell/remapping, a falsy value gives segments without a source, and an other value stays in sources as it is. Values with the same string form (for example 42 and "42") share one entry, and the value of the first segment that uses that entry goes in sources. One difference stays: when the loader ignores falsy sources of more than one kind in one call (for example "" and null), the result has one entry for them, and jridgewell can have one entry for each kind.

Part of srcmap

Source map tooling written in Rust. See also:

License

MIT