CodeSampleX

Beispiel

@jridgewell/sourcemap-codec 1.5.5

Verifiziertes Beispiel für npm @jridgewell/sourcemap-codec 1.5.5. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand.

sha256:00fc7198e2b88dc23daf820a169cd43f6bb9ffbbfaa370e37582eba52d17a9d5

Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen. Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen. MIT-0

Ausführungsbelege

Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.

Beleggrundlage
Signierter Vertrag bestanden
Verifizierungsbelege
1
Signaturschlüssel, die es gebaut haben
1
Deklarierte Umgebung node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10

Umgebungen der Verifizierungsläufe

Umgebung Contract Stufen Lauf
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

Fall

HOW
Ziel
verify pkg:npm/%40jridgewell/sourcemap-codec@1.5.5
Pakete
Umgebung
node 22.23.2
Erstellt
2026-08-24T20:17:31Z

Contract

  1. decode parses VLQ encoded string mappings into multi-line arrays of 4-element coordinate segments
  2. decode parses 1-element column segments and 5-element segments with source name indices
  3. decode maps an empty string to a single line containing an empty segment array
  4. decode and encode preserve empty lines represented by consecutive semicolons
  5. decode tracks relative state deltas for source index, original line, and original column across lines
  6. encode serializes nested coordinate segment arrays into VLQ encoded sourcemap mapping strings
  7. encode and decode perform lossless roundtrips on complex multi-line sourcemap mappings

Dateien

  • PROMPT.md
  • csx.json
  • index.js
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.cjs

Quellartefakt herunterladen (tar.gz)

Quelltext

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 pkg:npm/%40jridgewell/sourcemap-codec@1.5.5
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40jridgewell/sourcemap-codec@1.5.5
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:c1eedf026b33995402c8d056c7b08cc18a5304922a99c0105de361b7e2eaadaf","constraints":{"executionContext":"node"},"contract":["decode parses VLQ encoded string mappings into multi-line arrays of 4-element coordinate segments","decode parses 1-element column segments and 5-element segments with source name indices","decode maps an empty string to a single line containing an empty segment array","decode and encode preserve empty lines represented by consecutive semicolons","decode tracks relative state deltas for source index, original line, and original column across lines","encode serializes nested coordinate segment arrays into VLQ encoded sourcemap mapping strings","encode and decode perform lossless roundtrips on complex multi-line sourcemap mappings"],"goal":"verify pkg:npm/%40jridgewell/sourcemap-codec@1.5.5","kind":"HOW","packages":["pkg:npm/%40jridgewell/sourcemap-codec@1.5.5"],"schemaVersion":1},"contractCommand":["node","test/contract.cjs"],"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/sourcemap-codec@1.5.5"],"schemaVersion":1,"subject":"pkg:npm/%40jridgewell/sourcemap-codec@1.5.5","verifierAdapter":"node-typescript@1"}
index.js
'use strict';

const { encode, decode } = require('@jridgewell/sourcemap-codec');

function decodeMappings(mappings) {
  return decode(mappings);
}

function encodeMappings(decoded) {
  return encode(decoded);
}

module.exports = {
  decode,
  encode,
  decodeMappings,
  encodeMappings,
};
package-lock.json
{
  "name": "sample-sourcemap-codec",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-sourcemap-codec",
      "version": "1.0.0",
      "license": "MIT-0",
      "dependencies": {
        "@jridgewell/sourcemap-codec": "1.5.5"
      }
    },
    "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"
    }
  }
}
package.json
{
  "name": "sample-sourcemap-codec",
  "version": "1.0.0",
  "private": true,
  "license": "MIT-0",
  "dependencies": {
    "@jridgewell/sourcemap-codec": "1.5.5"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/%40jridgewell/sourcemap-codec@1.5.5",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40jridgewell/sourcemap-codec@1.5.5"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
test/contract.cjs
'use strict';

const assert = require('assert');
const { encode, decode, decodeMappings, encodeMappings } = require('../index.js');

function runContract() {
  // 1. decode parses VLQ encoded string mappings into multi-line arrays of 4-element coordinate segments
  const basicMappings = 'AAAA';
  const decodedBasic = decode(basicMappings);
  assert.deepStrictEqual(decodedBasic, [[[0, 0, 0, 0]]]);
  assert.strictEqual(encode(decodedBasic), basicMappings);
  assert.deepStrictEqual(decodeMappings(basicMappings), [[[0, 0, 0, 0]]]);

  // 2. decode parses 1-element column segments and 5-element segments with source name indices
  const singleSegment = 'A,C,C';
  const decodedSingle = decode(singleSegment);
  assert.deepStrictEqual(decodedSingle, [[[0], [1], [2]]]);
  assert.strictEqual(encode(decodedSingle), singleSegment);

  const fiveSegment = 'AAAAA';
  const decodedFive = decode(fiveSegment);
  assert.deepStrictEqual(decodedFive, [[[0, 0, 0, 0, 0]]]);
  assert.strictEqual(encode(decodedFive), fiveSegment);

  // 3. decode maps an empty string to a single line containing an empty segment array
  const emptyDecoded = decode('');
  assert.deepStrictEqual(emptyDecoded, [[]]);
  assert.strictEqual(encode([[]]), '');
  assert.strictEqual(encode([]), '');
  assert.strictEqual(encodeMappings([[]]), '');

  // 4. decode and encode preserve empty lines represented by consecutive semicolons
  const withEmptyLines = 'AAAA;;QAAT';
  const decodedEmptyLines = decode(withEmptyLines);
  assert.strictEqual(decodedEmptyLines.length, 3);
  assert.deepStrictEqual(decodedEmptyLines[0], [[0, 0, 0, 0]]);
  assert.deepStrictEqual(decodedEmptyLines[1], []);
  assert.deepStrictEqual(decodedEmptyLines[2], [[8, 0, 0, -9]]);
  assert.strictEqual(encode(decodedEmptyLines), withEmptyLines);

  // 5. decode tracks relative state deltas for source index, original line, and original column across lines
  const multiSegment = 'AAAA,SAAS;QAAT';
  const decodedMulti = decode(multiSegment);
  assert.strictEqual(decodedMulti.length, 2);
  assert.deepStrictEqual(decodedMulti[0], [[0, 0, 0, 0], [9, 0, 0, 9]]);
  assert.deepStrictEqual(decodedMulti[1], [[8, 0, 0, 0]]);
  assert.strictEqual(encode(decodedMulti), multiSegment);

  // 6. encode serializes nested coordinate segment arrays into VLQ encoded sourcemap mapping strings
  const customSegments = [
    [[0, 0, 0, 0], [4, 0, 0, 4]],
    [[0, 0, 1, 0]]
  ];
  const encodedCustom = encode(customSegments);
  assert.strictEqual(typeof encodedCustom, 'string');
  assert.deepStrictEqual(decode(encodedCustom), customSegments);

  // 7. encode and decode perform lossless roundtrips on complex multi-line sourcemap mappings
  const complexMappings = 'AAAA,SAAS,aAAa;QAAT,SAAS;aAAa';
  const roundtripped = encode(decode(complexMappings));
  assert.strictEqual(roundtripped, complexMappings);

  console.log('Contract tests passed successfully.');
}

runContract();

Ursprungs-Seeder

anonym