Sample
@jridgewell/gen-mapping 0.3.13: allMappings
Verified sample for npm @jridgewell/gen-mapping 0.3.13: allMappings. The contract ran on node 22 · linux debian/x64 · docker and passed.
sha256:47beff5b5983633501e43f6e8cdf66ef501faae99656c46b6e4b5b4863ab7ad5
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
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-09-05 |
Case
HOW- Goal
- verify @jridgewell/gen-mapping.allMappings in pkg:npm/%40jridgewell/gen-mapping@0.3.13
- Packages
- Symbols
-
- @jridgewell/gen-mapping.allMappings
- Environment
- node 22.23.2
- Created
- 2026-09-05T14:43:43Z
Contract
- allMappings returns an empty array when given a freshly initialized GenMapping with no mappings
- allMappings returns mapping objects with 1-based generated positions and original source positions added via addMapping
- allMappings includes the symbol name when a segment is associated with an identifier name
- allMappings converts 0-based generated line indices from addSegment to 1-based generated line numbers
- allMappings yields undefined source, original, and name fields for sourceless segments
- allMappings preserves order across multiple generated lines and multiple segments within the same line
- allMappings correctly reconstructs all mapping objects from an imported source map loaded via fromMap
- allMappings skips consecutive duplicate mappings when added via maybeAddMapping
Files
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- 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: verify @jridgewell/gen-mapping.allMappings in pkg:npm/%40jridgewell/gen-mapping@0.3.13
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40jridgewell/gen-mapping@0.3.13
Demonstrate these symbols/APIs:
- @jridgewell/gen-mapping.allMappings
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:1b29284ed6186433b32ff70233414e73da1758d0bfd88432f64d6e4a04dedc8c","constraints":{"executionContext":"node"},"contract":["allMappings returns an empty array when given a freshly initialized GenMapping with no mappings","allMappings returns mapping objects with 1-based generated positions and original source positions added via addMapping","allMappings includes the symbol name when a segment is associated with an identifier name","allMappings converts 0-based generated line indices from addSegment to 1-based generated line numbers","allMappings yields undefined source, original, and name fields for sourceless segments","allMappings preserves order across multiple generated lines and multiple segments within the same line","allMappings correctly reconstructs all mapping objects from an imported source map loaded via fromMap","allMappings skips consecutive duplicate mappings when added via maybeAddMapping"],"goal":"verify @jridgewell/gen-mapping.allMappings in pkg:npm/%40jridgewell/gen-mapping@0.3.13","kind":"HOW","packages":["pkg:npm/%40jridgewell/gen-mapping@0.3.13"],"schemaVersion":1,"symbols":["@jridgewell/gen-mapping.allMappings"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"esm","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/%40jridgewell/gen-mapping@0.3.13"],"schemaVersion":1,"subject":"pkg:npm/%40jridgewell/gen-mapping@0.3.13","symbols":["@jridgewell/gen-mapping.allMappings"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-gen-mapping-all-mappings",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-gen-mapping-all-mappings",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@jridgewell/gen-mapping": "0.3.13"
}
},
"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/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-gen-mapping-all-mappings",
"version": "1.0.0",
"type": "module",
"private": true,
"license": "MIT-0",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"@jridgewell/gen-mapping": "0.3.13"
}
}
{
"schemaVersion": 1,
"goal": "verify @jridgewell/gen-mapping.allMappings in pkg:npm/%40jridgewell/gen-mapping@0.3.13",
"kind": "HOW",
"packages": [
"pkg:npm/%40jridgewell/gen-mapping@0.3.13"
],
"symbols": [
"@jridgewell/gen-mapping.allMappings"
]
}
import { allMappings } from '@jridgewell/gen-mapping';
/**
* Extracts all mapping records from a GenMapping instance.
* @param {import('@jridgewell/gen-mapping').GenMapping} map
* @returns {import('@jridgewell/gen-mapping').Mapping[]}
*/
export function extractMappings(map) {
return allMappings(map);
}
export { allMappings };
import assert from 'node:assert/strict';
import {
GenMapping,
addMapping,
addSegment,
maybeAddMapping,
allMappings,
fromMap,
toEncodedMap,
} from '@jridgewell/gen-mapping';
import { extractMappings } from '../src/index.mjs';
// 1. allMappings returns an empty array when given a freshly initialized GenMapping with no mappings
{
const map = new GenMapping();
const mappings = allMappings(map);
assert.ok(Array.isArray(mappings));
assert.equal(mappings.length, 0);
const helperMappings = extractMappings(map);
assert.deepEqual(helperMappings, []);
}
// 2. allMappings returns mapping objects with 1-based generated positions and original source positions added via addMapping
{
const map = new GenMapping();
addMapping(map, {
generated: { line: 1, column: 0 },
source: 'main.js',
original: { line: 10, column: 2 },
});
const mappings = allMappings(map);
assert.equal(mappings.length, 1);
assert.deepEqual(mappings[0], {
generated: { line: 1, column: 0 },
source: 'main.js',
original: { line: 10, column: 2 },
name: undefined,
});
}
// 3. allMappings includes the symbol name when a segment is associated with an identifier name
{
const map = new GenMapping();
addMapping(map, {
generated: { line: 1, column: 5 },
source: 'util.js',
original: { line: 3, column: 8 },
name: 'calculateTotal',
});
const mappings = allMappings(map);
assert.equal(mappings.length, 1);
assert.deepEqual(mappings[0], {
generated: { line: 1, column: 5 },
source: 'util.js',
original: { line: 3, column: 8 },
name: 'calculateTotal',
});
}
// 4. allMappings converts 0-based generated line indices from addSegment to 1-based generated line numbers
{
const map = new GenMapping();
addSegment(map, 0, 4, 'mod.js', 5, 12);
addSegment(map, 2, 8, 'mod.js', 7, 0);
const mappings = allMappings(map);
assert.equal(mappings.length, 2);
assert.deepEqual(mappings[0], {
generated: { line: 1, column: 4 },
source: 'mod.js',
original: { line: 6, column: 12 },
name: undefined,
});
assert.deepEqual(mappings[1], {
generated: { line: 3, column: 8 },
source: 'mod.js',
original: { line: 8, column: 0 },
name: undefined,
});
}
// 5. allMappings yields undefined source, original, and name fields for sourceless segments
{
const map = new GenMapping();
addSegment(map, 0, 0);
addSegment(map, 0, 10, 'app.js', 0, 0);
const mappings = allMappings(map);
assert.equal(mappings.length, 2);
assert.deepEqual(mappings[0], {
generated: { line: 1, column: 0 },
source: undefined,
original: undefined,
name: undefined,
});
assert.deepEqual(mappings[1], {
generated: { line: 1, column: 10 },
source: 'app.js',
original: { line: 1, column: 0 },
name: undefined,
});
}
// 6. allMappings preserves order across multiple generated lines and multiple segments within the same line
{
const map = new GenMapping();
addMapping(map, { generated: { line: 1, column: 0 }, source: 'a.js', original: { line: 1, column: 0 } });
addMapping(map, { generated: { line: 1, column: 15 }, source: 'a.js', original: { line: 1, column: 8 }, name: 'foo' });
addMapping(map, { generated: { line: 2, column: 4 }, source: 'b.js', original: { line: 5, column: 0 } });
const mappings = allMappings(map);
assert.equal(mappings.length, 3);
assert.equal(mappings[0].generated.line, 1);
assert.equal(mappings[0].generated.column, 0);
assert.equal(mappings[1].generated.line, 1);
assert.equal(mappings[1].generated.column, 15);
assert.equal(mappings[1].name, 'foo');
assert.equal(mappings[2].generated.line, 2);
assert.equal(mappings[2].generated.column, 4);
}
// 7. allMappings correctly reconstructs all mapping objects from an imported source map loaded via fromMap
{
const original = new GenMapping({ file: 'bundle.js' });
addMapping(original, { generated: { line: 1, column: 0 }, source: 'src.js', original: { line: 1, column: 0 } });
addMapping(original, { generated: { line: 2, column: 5 }, source: 'src.js', original: { line: 2, column: 10 }, name: 'bar' });
const encoded = toEncodedMap(original);
const imported = fromMap(encoded);
const mappings = allMappings(imported);
assert.deepEqual(mappings, allMappings(original));
}
// 8. allMappings skips consecutive duplicate mappings when added via maybeAddMapping
{
const map = new GenMapping();
maybeAddMapping(map, { generated: { line: 1, column: 0 }, source: 'src.js', original: { line: 1, column: 0 } });
maybeAddMapping(map, { generated: { line: 1, column: 4 }, source: 'src.js', original: { line: 1, column: 0 } });
const mappings = allMappings(map);
assert.equal(mappings.length, 1);
assert.deepEqual(mappings[0], {
generated: { line: 1, column: 0 },
source: 'src.js',
original: { line: 1, column: 0 },
name: undefined,
});
}
console.log('Contract tests passed successfully.');
Origin Seeder
anonymous