Пример
@jridgewell/sourcemap-codec 1.5.5
Проверенный пример — npm @jridgewell/sourcemap-codec 1.5.5. Контракт выполнен на node 22 · linux alpine/x64 · docker и пройден.
sha256:00fc7198e2b88dc23daf820a169cd43f6bb9ffbbfaa370e37582eba52d17a9d5
Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла.
Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди.
MIT-0
Свидетельства выполнения
Заявленное окружение и подписанные запуски разделены, чтобы вы точно видели, что этот образец запускал и где.
- Основа свидетельства
- Подписанный контракт пройден
- Квитанции проверки
- 1
- Ключи подписи, собравшие его
- 1
Заявленная среда
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Среды запусков проверки
| Окружение | Контракт | Этапы | Запуск |
|---|---|---|---|
| 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 |
Кейс
HOW- Цель
- verify pkg:npm/%40jridgewell/sourcemap-codec@1.5.5
- Окружение
- node 22.23.2
- Создан
- 2026-08-24T20:17:31Z
Контракт
- 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
Файлы
- PROMPT.md
- csx.json
- index.js
- package-lock.json
- package.json
- spec.json
- test/contract.cjs
Исходный код
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.
{"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"}
'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,
};
{
"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"
}
}
}
{
"name": "sample-sourcemap-codec",
"version": "1.0.0",
"private": true,
"license": "MIT-0",
"dependencies": {
"@jridgewell/sourcemap-codec": "1.5.5"
}
}
{
"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"
}
}
'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();
Исходный сидер
аноним