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/source-map

v0.3.8

Published

Drop-in replacement for Mozilla's source-map v0.6 API, powered by Rust via WebAssembly

Readme

@srcmap/source-map

npm CI

Drop-in replacement for Mozilla's source-map v0.6 API powered by Rust via WebAssembly.

Same SourceMapConsumer and SourceMapGenerator classes, same behavior. Swap the import and get source map operations backed by Rust under the hood.

Install

npm install @srcmap/source-map

Usage

Consumer

// Before:
// import { SourceMapConsumer } from 'source-map'

// After:
import { SourceMapConsumer } from '@srcmap/source-map'

const consumer = new SourceMapConsumer(sourceMapJsonOrObject)

const pos = consumer.originalPositionFor({ line: 43, column: 10 })
// { source: 'src/app.ts', line: 11, column: 4, name: 'handleClick' }

const content = consumer.sourceContentFor('src/app.ts')

consumer.eachMapping((mapping) => {
  console.log(mapping.generatedLine, mapping.generatedColumn)
})

// Cleanup WASM memory
consumer.destroy()

Generator

import { SourceMapGenerator } from '@srcmap/source-map'

const generator = new SourceMapGenerator({ file: 'bundle.js' })

generator.addMapping({
  generated: { line: 1, column: 0 },
  source: 'src/app.ts',
  original: { line: 10, column: 4 },
  name: 'handleClick',
})

generator.setSourceContent('src/app.ts', sourceCode)

const json = generator.toJSON()
const str = generator.toString()

generator.destroy()

API compatibility

SourceMapConsumer

| Method / Property | Description | |--------|-------------| | originalPositionFor(needle) | Forward lookup (1-based lines, 0-based columns) | | generatedPositionFor(needle) | Reverse lookup | | eachMapping(callback) | Iterate all mappings in generated order | | sourceContentFor(source) | Get source content for a file | | sources | Resolved source file URLs | | sourcesContent | Inline source contents | | file | Output filename | | sourceRoot | Source root prefix | | destroy() | Free WASM resources | | GREATEST_LOWER_BOUND / LEAST_UPPER_BOUND | Search bias constants |

SourceMapGenerator

| Method | Description | |--------|-------------| | addMapping(mapping) | Add a mapping (object-based API) | | setSourceContent(source, content) | Set source content for a file | | applySourceMap(consumer, source?, path?) | Apply a consumer's mappings to this generator | | toJSON() | Return as parsed source map object | | toString() | Return as JSON string | | destroy() | Free WASM resources |

Differences from Mozilla source-map

  • Synchronous API: No SourceMapConsumer.with() or promise-based initialization — construction is synchronous
  • WASM memory: Call consumer.destroy() / generator.destroy() when done to free WASM memory
  • Indexed source maps: Handled natively by the WASM engine

Part of srcmap

High-performance source map tooling written in Rust. See also:

License

MIT