Exemplo
@jridgewell/gen-mapping 0.3.13: toEncodedMap
Amostra verificada para npm @jridgewell/gen-mapping 0.3.13: toEncodedMap. O contrato rodou em node 22 · linux debian/x64 · docker e passou.
sha256:5fd65a553a8d2f8bf579fc93f336209380a64ad0ef0443ccd66d8ebf1b69991e
Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu.
Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas.
MIT-0
Evidência de execução
O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.
- Base da evidência
- Contrato assinado aprovado
- Recibos de verificação
- 1
- Chaves de assinatura que o compilaram
- 1
Ambiente declarado
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| 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 |
Caso
HOW- Objetivo
- verify @jridgewell/gen-mapping.toEncodedMap in pkg:npm/%40jridgewell/gen-mapping@0.3.13
- Pacotes
- Símbolos
-
- @jridgewell/gen-mapping.toEncodedMap
- Ambiente
- node 22.23.2
- Criado
- 2026-09-05T15:36:52Z
Contrato
- toEncodedMap returns an EncodedSourceMap object with version 3 and VLQ encoded mappings
- toEncodedMap serializes source mappings and symbol names correctly into VLQ encoded format
- toEncodedMap includes optional file, sourceRoot, sourcesContent, and ignoreList metadata
- toEncodedMap produces an empty mappings string when no mappings are added to GenMapping
Arquivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- test/contract.mjs
Código-fonte
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.toEncodedMap 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.toEncodedMap
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:d63b9baf94d7c8c7335b908747d1949c8c5e0b82cf5e746d1c4c56bdeb027646","constraints":{"executionContext":"node"},"contract":["toEncodedMap returns an EncodedSourceMap object with version 3 and VLQ encoded mappings","toEncodedMap serializes source mappings and symbol names correctly into VLQ encoded format","toEncodedMap includes optional file, sourceRoot, sourcesContent, and ignoreList metadata","toEncodedMap produces an empty mappings string when no mappings are added to GenMapping"],"goal":"verify @jridgewell/gen-mapping.toEncodedMap 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.toEncodedMap"]},"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.toEncodedMap"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-gen-mapping-to-encoded-map",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-gen-mapping-to-encoded-map",
"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.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"
}
}
}
}
{
"name": "sample-gen-mapping-to-encoded-map",
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT-0",
"dependencies": {
"@jridgewell/gen-mapping": "0.3.13"
}
}
{
"schemaVersion": 1,
"goal": "verify @jridgewell/gen-mapping.toEncodedMap in pkg:npm/%40jridgewell/gen-mapping@0.3.13",
"kind": "HOW",
"packages": [
"pkg:npm/%40jridgewell/gen-mapping@0.3.13"
],
"symbols": [
"@jridgewell/gen-mapping.toEncodedMap"
]
}
import {
GenMapping,
addMapping,
addSegment,
setSourceContent,
setIgnore,
toEncodedMap
} from "@jridgewell/gen-mapping";
export function createGenMapping(options = {}) {
return new GenMapping(options);
}
export function encodeMapping(map) {
return toEncodedMap(map);
}
export {
GenMapping,
addMapping,
addSegment,
setSourceContent,
setIgnore,
toEncodedMap
};
import assert from "node:assert/strict";
import {
GenMapping,
addMapping,
setSourceContent,
setIgnore,
toEncodedMap,
createGenMapping,
encodeMapping
} from "../src/index.mjs";
// Test 1: toEncodedMap returns an EncodedSourceMap object with version 3 and VLQ encoded mappings
{
const map = createGenMapping({
file: "output.js",
sourceRoot: "https://example.com/src"
});
addMapping(map, {
generated: { line: 1, column: 0 },
source: "input.js",
original: { line: 1, column: 0 }
});
const encoded = encodeMapping(map);
assert.equal(encoded.version, 3);
assert.equal(encoded.file, "output.js");
assert.equal(encoded.sourceRoot, "https://example.com/src");
assert.equal(typeof encoded.mappings, "string");
assert.equal(encoded.mappings, "AAAA");
assert.deepEqual(encoded.sources, ["input.js"]);
}
// Test 2: toEncodedMap serializes source mappings and symbol names correctly into VLQ encoded format
{
const map = new GenMapping();
addMapping(map, {
generated: { line: 1, column: 0 },
source: "index.js",
original: { line: 1, column: 0 },
name: "init"
});
addMapping(map, {
generated: { line: 2, column: 4 },
source: "index.js",
original: { line: 2, column: 2 },
name: "start"
});
const encoded = toEncodedMap(map);
assert.deepEqual(encoded.names, ["init", "start"]);
assert.equal(encoded.mappings, "AAAAA;IACEC");
assert.deepEqual(encoded.sources, ["index.js"]);
}
// Test 3: toEncodedMap includes optional file, sourceRoot, sourcesContent, and ignoreList metadata
{
const map = new GenMapping({
file: "minified.js",
sourceRoot: "https://example.com/dist"
});
setSourceContent(map, "lib.js", "export function run() {}");
setIgnore(map, "lib.js", true);
addMapping(map, {
generated: { line: 1, column: 0 },
source: "lib.js",
original: { line: 1, column: 0 }
});
const encoded = toEncodedMap(map);
assert.equal(encoded.file, "minified.js");
assert.equal(encoded.sourceRoot, "https://example.com/dist");
assert.deepEqual(encoded.sourcesContent, ["export function run() {}"]);
assert.deepEqual(encoded.ignoreList, [0]);
}
// Test 4: toEncodedMap produces an empty mappings string when no mappings are added to GenMapping
{
const map = new GenMapping();
const encoded = toEncodedMap(map);
assert.equal(encoded.version, 3);
assert.equal(encoded.mappings, "");
assert.deepEqual(encoded.names, []);
assert.deepEqual(encoded.sources, []);
assert.deepEqual(encoded.sourcesContent, []);
}
console.log("All @jridgewell/gen-mapping.toEncodedMap contract tests passed successfully.");
Seeder de origem
anônimo