@smapped-traces/sqlite
v0.1.1
Published
SQLite source map store for smapped-traces
Maintainers
Readme
@smapped-traces/sqlite
SQLite-backed source map store for smapped-traces.
Suitable for local development, single-server deployments, and CI pipelines where source maps are collected and resolved on the same machine.
Installation
npm install @smapped-traces/sqlite smapped-traces better-sqlite3Usage
Build-time collection with Next.js
// next.config.ts
import { withSourceMaps } from "@smapped-traces/nextjs";
import { createSqliteStore } from "@smapped-traces/sqlite";
export default withSourceMaps(nextConfig, {
store: (distDir) => createSqliteStore(`${distDir}/sourcemaps.db`),
});Runtime resolution in the traces handler
import { createTracesHandler } from "smapped-traces/route";
import { createSqliteStore } from "@smapped-traces/sqlite";
const store = createSqliteStore("./sourcemaps.db");
export const POST = createTracesHandler({ exporter, store });Serving as a remote store
import { createStoreHandler } from "smapped-traces/store";
import { createSqliteStore } from "@smapped-traces/sqlite";
const store = createSqliteStore("./sourcemaps.db");
const handler = createStoreHandler(store);
// Express, Hono, or any framework that accepts (Request) => Response
app.use("/sourcemaps", handler);API
createSqliteStore(dbPath)
| Parameter | Type | Description |
|-----------|------|-------------|
| dbPath | string | Path to the SQLite database file. Created on first write. |
Returns a SourceMapStore. The table is created lazily on the first put. Calling close() releases the database connection.
License
Apache-2.0
