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

@smapped-traces/vite

v0.1.1

Published

Vite source map collection for smapped-traces

Readme

@smapped-traces/vite

Vite plugin for build-time source map collection.

Installation

npm install smapped-traces @smapped-traces/vite @smapped-traces/sqlite

Usage

Add the sourceMaps() plugin. Production builds emit hidden, debug-ID-stamped source maps, and with the collect option the plugin stores them and deletes every .map file once the final build output exists:

// vite.config.ts
import { join } from "node:path";
import { createSqliteStore } from "@smapped-traces/sqlite";
import { sourceMaps } from "@smapped-traces/vite";
import { defineConfig } from "vite";

export default defineConfig({
  plugins: [
    sourceMaps({
      collect: {
        store: (dir) => createSqliteStore(join(dir, "sourcemaps.db")),
      },
    }),
  ],
});

SvelteKit

Collection runs via a post-ordered sequential closeBundle hook, after SvelteKit's adapter assembles its deploy directory in the same phase (the client compile pass, which ends before the adapter runs, is skipped). The adapter's deploy directory is not Vite's outDir, so set dir — and since adapter-node re-bundles the server without preserving debug IDs, restrict storage to the client output. Server maps are still deleted:

sourceMaps({
  collect: {
    dir: "build",
    include: "client/**/*.{,c,m}js.map",
    store: (dir) => createSqliteStore(join(dir, "sourcemaps.db")),
  },
});

Remote stores

Any SourceMapStore works — see the root README:

import { createHttpStore } from "smapped-traces/store";

sourceMaps({
  collect: {
    store: () => createHttpStore("https://sourcemaps.internal"),
  },
});

Collecting outside the build

When the final output is produced outside the Vite build entirely — a pipeline the plugin cannot order against — leave collect unset and run the sweep yourself after that pipeline completes:

import { collectSourceMaps } from "@smapped-traces/vite";

await collectSourceMaps({
  dir: "dist",
  store: (dir) => createSqliteStore(join(dir, "sourcemaps.db")),
});

It resolves to { stored, deleted } counts.

Options

sourceMaps(options?) accepts a SourceMapsOptions object whose collect field enables the automatic sweep. collect and collectSourceMaps(options) share CollectSourceMapsOptions:

| Option | Type | Required | Description | | --- | --- | --- | --- | | dir | string | In collectSourceMaps | Build output directory to sweep for .map files. In collect it defaults to the resolved build.outDir; a framework whose adapter assembles a separate deploy directory must set it, and relative paths resolve against the project root. | | store | (dir: string) => SourceMapStore \| Promise<SourceMapStore> | Yes | Factory that creates a source map store. Called with dir. | | include | string \| string[] | No | Glob pattern(s), relative to dir, selecting the maps to store. Defaults to every JavaScript source map (**/*.{,c,m}js.map). A selected map without a debugId is an error; maps outside the selection are deleted without being stored. |

What it does

  1. Sets build.sourcemap = "hidden" and build.rolldownOptions.output.sourcemapDebugIds = true
  2. After the final build output exists (or when collectSourceMaps() is called):
    • Globs for all .map files in the build output, including dot directories
    • Parses each selected source map and extracts its debugId
    • Uploads it to the provided store via store.put(debugId, content)
    • Deletes every .map file from the build output so none are deployed
    • Fails if a selected map carries no debugId

Requirements

  • Vite 8+ (uses Rolldown's sourcemapDebugIds output option)

License

Apache-2.0