Exemple
@jridgewell/gen-mapping 0.3.13
Échantillon vérifié pour npm @jridgewell/gen-mapping 0.3.13. Le contrat s'est exécuté sur node 22 · linux alpine/x64 · docker et a réussi.
sha256:68d72d35fab28d6e8939bc2e71688369f35ca601ce45691af4ec70e4939bbe16
Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré.
Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes.
MIT-0
Preuves d'exécution
L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.
- Base de preuve
- Contrat signé réussi
- Reçus de vérification
- 1
- Clés de signature qui l’ont compilé
- 1
Environnement déclaré
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| 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-24 |
Cas
HOW- Objectif
- verify pkg:npm/%40jridgewell/gen-mapping@0.3.13
- Paquets
- Environnement
- node 22.23.2
- Créé
- 2026-08-24T20:26:01Z
Contrat
- GenMapping constructor initializes a source map instance with optional file and sourceRoot
- addMapping associates 1-based generated positions with original source positions and optional symbol names
- addSegment associates 0-based generated coordinates directly with original source coordinates
- maybeAddMapping skips redundant consecutive mappings with identical original positions
- setSourceContent embeds original file content into sourcesContent
- setIgnore marks source file indices in ignoreList for debugger filtering
- toDecodedMap exports source map with decoded segment coordinate arrays
- toEncodedMap exports source map with VLQ encoded mappings string
- allMappings returns array of high-level mapping objects for all recorded segments
- fromMap initializes a new GenMapping instance pre-populated from an existing source map
Fichiers
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Code 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 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
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@10.9.8
- runtime: node@22.23.2
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:7bf65b0081c919194e5c784e8c30d9ae87e5b0524dde78689584f57b79f8f219","constraints":{"executionContext":"node"},"contract":["GenMapping constructor initializes a source map instance with optional file and sourceRoot","addMapping associates 1-based generated positions with original source positions and optional symbol names","addSegment associates 0-based generated coordinates directly with original source coordinates","maybeAddMapping skips redundant consecutive mappings with identical original positions","setSourceContent embeds original file content into sourcesContent","setIgnore marks source file indices in ignoreList for debugger filtering","toDecodedMap exports source map with decoded segment coordinate arrays","toEncodedMap exports source map with VLQ encoded mappings string","allMappings returns array of high-level mapping objects for all recorded segments","fromMap initializes a new GenMapping instance pre-populated from an existing source map"],"goal":"verify pkg:npm/%40jridgewell/gen-mapping@0.3.13","kind":"HOW","packages":["pkg:npm/%40jridgewell/gen-mapping@0.3.13"],"schemaVersion":1},"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","verifierAdapter":"node-typescript@1"}
{
"name": "sample-gen-mapping",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-gen-mapping",
"version": "1.0.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",
"version": "1.0.0",
"type": "module",
"private": true,
"dependencies": {
"@jridgewell/gen-mapping": "0.3.13"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/%40jridgewell/gen-mapping@0.3.13",
"kind": "HOW",
"packages": [
"pkg:npm/%40jridgewell/gen-mapping@0.3.13"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
import assert from 'node:assert/strict';
import {
GenMapping,
addMapping,
addSegment,
maybeAddMapping,
maybeAddSegment,
setSourceContent,
setIgnore,
toDecodedMap,
toEncodedMap,
fromMap,
allMappings,
} from '@jridgewell/gen-mapping';
// 1. GenMapping constructor initializes a source map instance with optional file and sourceRoot
{
const map = new GenMapping({ file: 'output.js', sourceRoot: 'https://example.com/src' });
assert.equal(map.file, 'output.js');
assert.equal(map.sourceRoot, 'https://example.com/src');
const decoded = toDecodedMap(map);
assert.equal(decoded.version, 3);
assert.equal(decoded.file, 'output.js');
assert.equal(decoded.sourceRoot, 'https://example.com/src');
assert.deepEqual(decoded.sources, []);
assert.deepEqual(decoded.names, []);
assert.deepEqual(decoded.mappings, []);
}
// 2. addMapping associates 1-based generated positions with original source positions and optional symbol names
{
const map = new GenMapping({ file: 'bundle.js' });
addMapping(map, {
generated: { line: 1, column: 0 },
source: 'foo.js',
original: { line: 1, column: 0 },
});
addMapping(map, {
generated: { line: 1, column: 10 },
source: 'foo.js',
original: { line: 1, column: 5 },
name: 'bar',
});
const decoded = toDecodedMap(map);
assert.deepEqual(decoded.sources, ['foo.js']);
assert.deepEqual(decoded.names, ['bar']);
assert.deepEqual(decoded.mappings, [
[
[0, 0, 0, 0],
[10, 0, 0, 5, 0],
],
]);
}
// 3. addSegment associates 0-based generated coordinates directly with original source coordinates
{
const map = new GenMapping();
addSegment(map, 0, 0, 'input.js', 0, 0);
addSegment(map, 0, 5, 'input.js', 0, 5, 'greet');
addSegment(map, 1, 0, 'input.js', 1, 0);
const decoded = toDecodedMap(map);
assert.equal(decoded.mappings.length, 2);
assert.deepEqual(decoded.mappings[0], [
[0, 0, 0, 0],
[5, 0, 0, 5, 0],
]);
assert.deepEqual(decoded.mappings[1], [
[0, 0, 1, 0],
]);
}
// 4. maybeAddMapping skips redundant consecutive mappings with identical original positions
{
const map = new GenMapping();
maybeAddMapping(map, {
generated: { line: 1, column: 0 },
source: 'a.js',
original: { line: 1, column: 0 },
});
maybeAddMapping(map, {
generated: { line: 1, column: 4 },
source: 'a.js',
original: { line: 1, column: 0 },
});
const decoded = toDecodedMap(map);
assert.equal(decoded.mappings[0].length, 1);
}
// 5. setSourceContent embeds original file content into sourcesContent
{
const map = new GenMapping();
addSegment(map, 0, 0, 'a.js', 0, 0);
setSourceContent(map, 'a.js', 'const x = 1;');
const decoded = toDecodedMap(map);
assert.deepEqual(decoded.sourcesContent, ['const x = 1;']);
const encoded = toEncodedMap(map);
assert.deepEqual(encoded.sourcesContent, ['const x = 1;']);
}
// 6. setIgnore marks source file indices in ignoreList for debugger filtering
{
const map = new GenMapping();
addSegment(map, 0, 0, 'node_modules/dep/index.js', 0, 0);
addSegment(map, 0, 10, 'src/index.js', 0, 0);
setIgnore(map, 'node_modules/dep/index.js', true);
const decoded = toDecodedMap(map);
assert.deepEqual(decoded.ignoreList, [0]);
const encoded = toEncodedMap(map);
assert.deepEqual(encoded.ignoreList, [0]);
}
// 7. toDecodedMap exports source map with decoded segment coordinate arrays
{
const map = new GenMapping({ file: 'min.js' });
addSegment(map, 0, 0, 'src.js', 0, 0);
const decoded = toDecodedMap(map);
assert.equal(decoded.file, 'min.js');
assert.ok(Array.isArray(decoded.mappings));
assert.ok(Array.isArray(decoded.mappings[0]));
assert.deepEqual(decoded.mappings[0][0], [0, 0, 0, 0]);
}
// 8. toEncodedMap exports source map with VLQ encoded mappings string
{
const map = new GenMapping({ file: 'min.js' });
addSegment(map, 0, 0, 'src.js', 0, 0);
const encoded = toEncodedMap(map);
assert.equal(encoded.file, 'min.js');
assert.equal(typeof encoded.mappings, 'string');
assert.ok(encoded.mappings.length > 0);
}
// 9. allMappings returns array of high-level mapping objects for all recorded segments
{
const map = new GenMapping();
addMapping(map, {
generated: { line: 1, column: 0 },
source: 'foo.js',
original: { line: 2, column: 4 },
name: 'testVar',
});
const mappings = allMappings(map);
assert.equal(mappings.length, 1);
assert.deepEqual(mappings[0], {
generated: { line: 1, column: 0 },
source: 'foo.js',
original: { line: 2, column: 4 },
name: 'testVar',
});
}
// 10. fromMap initializes a new GenMapping instance pre-populated from an existing source map
{
const original = new GenMapping({ file: 'out.js' });
addMapping(original, {
generated: { line: 1, column: 0 },
source: 'src.js',
original: { line: 1, column: 0 },
});
const encoded = toEncodedMap(original);
const cloned = fromMap(encoded);
addMapping(cloned, {
generated: { line: 2, column: 0 },
source: 'src.js',
original: { line: 2, column: 0 },
});
const decoded = toDecodedMap(cloned);
assert.equal(decoded.file, 'out.js');
assert.equal(decoded.mappings.length, 2);
}
Seeder d'origine
anonyme