CodeSampleX

Sample

@jridgewell/gen-mapping 0.3.13: toDecodedMap

Verified sample for npm @jridgewell/gen-mapping 0.3.13: toDecodedMap. The contract ran on node 22 · linux debian/x64 · docker and passed.

sha256:92bcb085c91d2441ea3ee615d8b87d469aae38fe1ed7ae22592d5e37d3719540

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.toDecodedMap in pkg:npm/%40jridgewell/gen-mapping@0.3.13
Packages
Symbols
  • @jridgewell/gen-mapping.toDecodedMap
Environment
node 22.23.2
Created
2026-09-05T15:20:32Z

Contract

  1. toDecodedMap returns a valid v3 decoded source map structure with default fields
  2. toDecodedMap preserves file and sourceRoot metadata
  3. toDecodedMap extracts source file names into sources array
  4. toDecodedMap preserves inline source contents via sourcesContent array
  5. toDecodedMap records identifier names into names array with 5-field segment coordinates
  6. toDecodedMap generates 4-field decoded segments for mappings without symbol names
  7. toDecodedMap produces 1-field decoded segments for sourceless mappings
  8. toDecodedMap preserves ignoreList indices for debugger filtering
  9. toDecodedMap trims empty trailing lines from mappings array
  10. toDecodedMap supports multi-line mappings sorted by generated column order

Files

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.mjs

Download the source artifact (tar.gz)

Source

PROMPT.md
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.toDecodedMap 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.toDecodedMap
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.
csx.json
{"case":{"caseId":"case:sha256:d292a7170ebe4c7e67db2247a850a11a37fc02d8f7237abc34b174063fcc23b2","constraints":{"executionContext":"node"},"contract":["toDecodedMap returns a valid v3 decoded source map structure with default fields","toDecodedMap preserves file and sourceRoot metadata","toDecodedMap extracts source file names into sources array","toDecodedMap preserves inline source contents via sourcesContent array","toDecodedMap records identifier names into names array with 5-field segment coordinates","toDecodedMap generates 4-field decoded segments for mappings without symbol names","toDecodedMap produces 1-field decoded segments for sourceless mappings","toDecodedMap preserves ignoreList indices for debugger filtering","toDecodedMap trims empty trailing lines from mappings array","toDecodedMap supports multi-line mappings sorted by generated column order"],"goal":"verify @jridgewell/gen-mapping.toDecodedMap 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.toDecodedMap"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","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.toDecodedMap"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "gen-mapping-sample",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "gen-mapping-sample",
      "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.6.0",
      "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz",
      "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==",
      "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"
      }
    }
  }
}
package.json
{
  "name": "gen-mapping-sample",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room verification for @jridgewell/gen-mapping.toDecodedMap",
  "dependencies": {
    "@jridgewell/gen-mapping": "0.3.13"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify @jridgewell/gen-mapping.toDecodedMap in pkg:npm/%40jridgewell/gen-mapping@0.3.13",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40jridgewell/gen-mapping@0.3.13"
  ],
  "symbols": [
    "@jridgewell/gen-mapping.toDecodedMap"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
test/contract.mjs
import assert from 'node:assert/strict';
import {
  GenMapping,
  addMapping,
  addSegment,
  setSourceContent,
  setIgnore,
  toDecodedMap,
} from '@jridgewell/gen-mapping';

// 1. toDecodedMap returns a valid v3 decoded source map structure with default fields
{
  const map = new GenMapping();
  const decoded = toDecodedMap(map);
  assert.equal(decoded.version, 3);
  assert.equal(decoded.file, undefined);
  assert.equal(decoded.sourceRoot, undefined);
  assert.deepEqual(decoded.sources, []);
  assert.deepEqual(decoded.names, []);
  assert.deepEqual(decoded.mappings, []);
  assert.deepEqual(decoded.ignoreList, []);
}

// 2. toDecodedMap preserves file and sourceRoot metadata
{
  const map = new GenMapping({
    file: 'bundle.js',
    sourceRoot: 'https://example.com/src/',
  });
  const decoded = toDecodedMap(map);
  assert.equal(decoded.file, 'bundle.js');
  assert.equal(decoded.sourceRoot, 'https://example.com/src/');
}

// 3. toDecodedMap extracts source file names into sources array
{
  const map = new GenMapping();
  addSegment(map, 0, 0, 'file-a.js', 0, 0);
  addSegment(map, 0, 10, 'file-b.js', 0, 0);
  const decoded = toDecodedMap(map);
  assert.deepEqual(decoded.sources, ['file-a.js', 'file-b.js']);
}

// 4. toDecodedMap preserves inline source contents via sourcesContent array
{
  const map = new GenMapping();
  addSegment(map, 0, 0, 'src.js', 0, 0);
  setSourceContent(map, 'src.js', 'const x = 42;');
  const decoded = toDecodedMap(map);
  assert.deepEqual(decoded.sourcesContent, ['const x = 42;']);
}

// 5. toDecodedMap records identifier names into names array with 5-field segment coordinates
{
  const map = new GenMapping();
  addMapping(map, {
    generated: { line: 1, column: 0 },
    source: 'foo.js',
    original: { line: 1, column: 0 },
    name: 'myFunction',
  });
  const decoded = toDecodedMap(map);
  assert.deepEqual(decoded.names, ['myFunction']);
  assert.deepEqual(decoded.mappings, [[[0, 0, 0, 0, 0]]]);
}

// 6. toDecodedMap generates 4-field decoded segments for mappings without symbol names
{
  const map = new GenMapping();
  addMapping(map, {
    generated: { line: 1, column: 5 },
    source: 'bar.js',
    original: { line: 10, column: 2 },
  });
  const decoded = toDecodedMap(map);
  assert.deepEqual(decoded.mappings, [[[5, 0, 9, 2]]]);
}

// 7. toDecodedMap produces 1-field decoded segments for sourceless mappings
{
  const map = new GenMapping();
  addSegment(map, 0, 12);
  const decoded = toDecodedMap(map);
  assert.deepEqual(decoded.mappings, [[[12]]]);
}

// 8. toDecodedMap preserves ignoreList indices for debugger filtering
{
  const map = new GenMapping();
  addSegment(map, 0, 0, 'vendor/lib.js', 0, 0);
  addSegment(map, 0, 5, 'app.js', 0, 0);
  setIgnore(map, 'vendor/lib.js', true);
  const decoded = toDecodedMap(map);
  assert.deepEqual(decoded.ignoreList, [0]);
}

// 9. toDecodedMap trims empty trailing lines from mappings array
{
  const map = new GenMapping();
  addSegment(map, 0, 0, 'a.js', 0, 0);
  const decoded = toDecodedMap(map);
  assert.equal(decoded.mappings.length, 1);
  assert.deepEqual(decoded.mappings[0], [[0, 0, 0, 0]]);
}

// 10. toDecodedMap supports multi-line mappings sorted by generated column order
{
  const map = new GenMapping();
  addSegment(map, 1, 10, 'a.js', 1, 5);
  addSegment(map, 1, 0, 'a.js', 1, 0);
  addSegment(map, 0, 0, 'a.js', 0, 0);
  const decoded = toDecodedMap(map);
  assert.equal(decoded.mappings.length, 2);
  assert.deepEqual(decoded.mappings[0], [[0, 0, 0, 0]]);
  assert.deepEqual(decoded.mappings[1], [
    [0, 0, 1, 0],
    [10, 0, 1, 5],
  ]);
}

console.log('Contract passed');

Origin Seeder

anonymous