Sample
@jridgewell/source-map 0.3.11: generate and consume source maps with SourceMapGenerator and SourceMapConsumer
Verified sample for npm @jridgewell/source-map 0.3.11: generate and consume source maps with SourceMapGenerator and SourceMapConsumer. The contract ran on…
sha256:cd955a15d9d14491fcf327dc93d2cf371536158c5ee4c3392cab4b18e4c4d544
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
linux 24 · ubuntu · glibc 2.39 x64 npm
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-27 |
Case
HOW- Goal
- generate and consume source maps with SourceMapGenerator and SourceMapConsumer
- Packages
- Symbols
-
- SourceMapConsumer
- SourceMapGenerator
- Created
- 2026-08-27T23:46:02Z
Contract
- SourceMapGenerator generates v3 source map with mappings and embedded sourcesContent
- SourceMapConsumer resolves originalPositionFor with mapped line column and symbol name
- SourceMapConsumer resolves generatedPositionFor matching original line and column
- SourceMapConsumer retrieves original source code via sourceContentFor
Files
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Source
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: generate and consume source maps with SourceMapGenerator and SourceMapConsumer
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40jridgewell/source-map@0.3.11
Demonstrate these symbols/APIs:
- SourceMapConsumer
- SourceMapGenerator
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:cbd03d708bf1f1fcfb6144c4ef3b5578df3f1dec78c10b972a9ba977d05dd5aa","contract":["SourceMapGenerator generates v3 source map with mappings and embedded sourcesContent","SourceMapConsumer resolves originalPositionFor with mapped line column and symbol name","SourceMapConsumer resolves generatedPositionFor matching original line and column","SourceMapConsumer retrieves original source code via sourceContentFor"],"goal":"generate and consume source maps with SourceMapGenerator and SourceMapConsumer","kind":"HOW","packages":["pkg:npm/%40jridgewell/source-map@0.3.11"],"schemaVersion":1,"symbols":["SourceMapConsumer","SourceMapGenerator"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/%40jridgewell/source-map@0.3.11"],"schemaVersion":1,"subject":"pkg:npm/%40jridgewell/source-map@0.3.11","symbols":["SourceMapConsumer","SourceMapGenerator"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-source-map",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-source-map",
"version": "1.0.0",
"dependencies": {
"@jridgewell/source-map": "0.3.11"
}
},
"node_modules/@jridgewell/gen-mapping": {
"version": "0.3.13",
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
"integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==",
"license": "MIT",
"dependencies": {
"@jridgewell/sourcemap-codec": "^1.5.0",
"@jridgewell/trace-mapping": "^0.3.24"
}
},
"node_modules/@jridgewell/resolve-uri": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
"integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
"license": "MIT",
"engines": {
"node": ">=6.0.0"
}
},
"node_modules/@jridgewell/source-map": {
"version": "0.3.11",
"resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.11.tgz",
"integrity": "sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA==",
"license": "MIT",
"dependencies": {
"@jridgewell/gen-mapping": "^0.3.5",
"@jridgewell/trace-mapping": "^0.3.25"
}
},
"node_modules/@jridgewell/sourcemap-codec": {
"version": "1.5.5",
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",
"integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==",
"license": "MIT"
},
"node_modules/@jridgewell/trace-mapping": {
"version": "0.3.31",
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz",
"integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==",
"license": "MIT",
"dependencies": {
"@jridgewell/resolve-uri": "^3.1.0",
"@jridgewell/sourcemap-codec": "^1.4.14"
}
}
}
}
{
"name": "sample-source-map",
"version": "1.0.0",
"type": "module",
"private": true,
"dependencies": {
"@jridgewell/source-map": "0.3.11"
}
}
{
"schemaVersion": 1,
"goal": "generate and consume source maps with SourceMapGenerator and SourceMapConsumer",
"kind": "HOW",
"packages": [
"pkg:npm/%40jridgewell/source-map@0.3.11"
],
"symbols": [
"SourceMapConsumer",
"SourceMapGenerator"
]
}
import assert from 'node:assert/strict';
import { SourceMapGenerator, SourceMapConsumer } from '@jridgewell/source-map';
// 1. Generate source map with SourceMapGenerator
const generator = new SourceMapGenerator({
file: 'bundle.js',
sourceRoot: 'https://example.com/src/'
});
const originalCode = 'function hello() {\n console.log("world");\n}\n';
generator.setSourceContent('hello.js', originalCode);
generator.addMapping({
source: 'hello.js',
original: { line: 2, column: 2 },
generated: { line: 1, column: 18 },
name: 'console'
});
const rawMap = generator.toJSON();
assert.equal(rawMap.version, 3);
assert.equal(rawMap.file, 'bundle.js');
assert.equal(rawMap.sourceRoot, 'https://example.com/src/');
assert.deepEqual(rawMap.sources, ['hello.js']);
assert.deepEqual(rawMap.sourcesContent, [originalCode]);
assert.ok(typeof rawMap.mappings === 'string');
// 2. Query original position with SourceMapConsumer
const consumer = new SourceMapConsumer(rawMap);
const origPos = consumer.originalPositionFor({ line: 1, column: 18 });
assert.equal(origPos.source, 'https://example.com/src/hello.js');
assert.equal(origPos.line, 2);
assert.equal(origPos.column, 2);
assert.equal(origPos.name, 'console');
// 3. Query generated position with SourceMapConsumer
const genPos = consumer.generatedPositionFor({
source: 'hello.js',
line: 2,
column: 2
});
assert.equal(genPos.line, 1);
assert.equal(genPos.column, 18);
// 4. Retrieve source content with SourceMapConsumer
const retrievedSource = consumer.sourceContentFor('hello.js');
assert.equal(retrievedSource, originalCode);
consumer.destroy();
console.log('Contract passed');
Origin Seeder
anonymous