Exemplo
@ampproject/remapping 2.3.0
Amostra verificada para npm @ampproject/remapping 2.3.0. O contrato rodou em node 22 · linux alpine/x64 · docker e passou: remapping composes multi-step…
sha256:a5b8161b04e6d701c9d95717de416cc01ebc4df652a7daef4c633451993bffb5
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 alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1 |
2026-08-20 |
Caso
HOW- Objetivo
- verify pkg:npm/%40ampproject/remapping@2.3.0
- Pacotes
- Ambiente
- node 22.23.2
- Criado
- 2026-08-20T14:44:43Z
Contrato
- remapping composes multi-step sourcemaps back to original source files
- remapping supports loader callback returning null for original source files
- remapping accepts JSON string as sourcemap input
- remapping supports decodedMappings option returning segment arrays
- remapping supports excludeContent option omitting sourcesContent
- remapping SourceMap toString returns valid JSON string
Arquivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.js
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 pkg:npm/%40ampproject/remapping@2.3.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40ampproject/remapping@2.3.0
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:0184a4bfadedd85b2619f5944a31d7cb7c7ca63b9aed67198b62447e954c8c1e","constraints":{"executionContext":"node"},"contract":["remapping composes multi-step sourcemaps back to original source files","remapping supports loader callback returning null for original source files","remapping accepts JSON string as sourcemap input","remapping supports decodedMappings option returning segment arrays","remapping supports excludeContent option omitting sourcesContent","remapping SourceMap toString returns valid JSON string"],"goal":"verify pkg:npm/%40ampproject/remapping@2.3.0","kind":"HOW","packages":["pkg:npm/%40ampproject/remapping@2.3.0"],"schemaVersion":1},"contractCommand":["node","test/contract.js"],"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/%40ampproject/remapping@2.3.0"],"schemaVersion":1,"verifierAdapter":"node-typescript@1"}
{
"name": "sample-ampproject-remapping",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-ampproject-remapping",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@ampproject/remapping": "2.3.0"
}
},
"node_modules/@ampproject/remapping": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz",
"integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==",
"license": "Apache-2.0",
"dependencies": {
"@jridgewell/gen-mapping": "^0.3.5",
"@jridgewell/trace-mapping": "^0.3.24"
},
"engines": {
"node": ">=6.0.0"
}
},
"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-ampproject-remapping",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification sample for @ampproject/remapping",
"main": "src/index.js",
"scripts": {
"test": "node test/contract.js"
},
"dependencies": {
"@ampproject/remapping": "2.3.0"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/%40ampproject/remapping@2.3.0",
"kind": "HOW",
"packages": [
"pkg:npm/%40ampproject/remapping@2.3.0"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
'use strict';
const remapping = require('@ampproject/remapping');
function remapSourcemap(inputMap, loader, options) {
return remapping(inputMap, loader, options);
}
module.exports = {
remapping,
remapSourcemap
};
'use strict';
const assert = require('node:assert');
const remapping = require('@ampproject/remapping');
const { remapSourcemap } = require('../src/index.js');
function runTests() {
// 1. Compose multi-step sourcemaps back to original source file
const minifiedMap = {
version: 3,
file: 'output.min.js',
sources: ['transpiled.js'],
mappings: 'AAAA;',
sourcesContent: ['const answer = 42;']
};
const transpiledMap = {
version: 3,
file: 'transpiled.js',
sources: ['source.ts'],
mappings: 'AAAA;',
sourcesContent: ['export const answer: number = 42;']
};
const remapped = remapping(minifiedMap, (sourcefile) => {
if (sourcefile === 'transpiled.js') {
return transpiledMap;
}
return null;
});
assert.strictEqual(remapped.version, 3, 'remapped version should be 3');
assert.strictEqual(remapped.file, 'output.min.js', 'remapped file should match target');
assert.deepStrictEqual(remapped.sources, ['source.ts'], 'remapped sources should point to original source file');
assert.deepStrictEqual(
remapped.sourcesContent,
['export const answer: number = 42;'],
'remapped sourcesContent should match original source content'
);
// 2. remapSourcemap wrapper functionality
const wrappedResult = remapSourcemap(minifiedMap, (sourcefile) => {
if (sourcefile === 'transpiled.js') {
return transpiledMap;
}
return null;
});
assert.deepStrictEqual(wrappedResult.sources, ['source.ts']);
// 3. Loader callback returning null treated as original source file
const singleStepMap = {
version: 3,
file: 'bundle.js',
sources: ['root.js'],
mappings: 'AAAA;',
sourcesContent: ['console.log("hello");']
};
const singleRemapped = remapping(singleStepMap, () => null);
assert.deepStrictEqual(singleRemapped.sources, ['root.js']);
assert.deepStrictEqual(singleRemapped.sourcesContent, ['console.log("hello");']);
// 4. Accept JSON string as sourcemap input
const jsonInput = JSON.stringify(minifiedMap);
const stringInputRemapped = remapping(jsonInput, (sourcefile) => {
if (sourcefile === 'transpiled.js') {
return transpiledMap;
}
return null;
});
assert.deepStrictEqual(stringInputRemapped.sources, ['source.ts']);
// 5. decodedMappings option returning segment arrays
const decodedResult = remapping(
minifiedMap,
(sourcefile) => (sourcefile === 'transpiled.js' ? transpiledMap : null),
{ decodedMappings: true }
);
assert(Array.isArray(decodedResult.mappings), 'mappings should be an array when decodedMappings is true');
assert(Array.isArray(decodedResult.mappings[0]), 'first line mappings should be an array');
// 6. excludeContent option omitting sourcesContent
const excludedContentResult = remapping(
minifiedMap,
(sourcefile) => (sourcefile === 'transpiled.js' ? transpiledMap : null),
{ excludeContent: true }
);
assert.strictEqual(
excludedContentResult.sourcesContent,
undefined,
'sourcesContent should be undefined when excludeContent is true'
);
// 7. toString() method returns valid JSON string
const jsonString = remapped.toString();
const parsed = JSON.parse(jsonString);
assert.strictEqual(parsed.version, 3);
assert.deepStrictEqual(parsed.sources, ['source.ts']);
console.log('All @ampproject/remapping contract assertions passed.');
}
runTests();
Seeder de origem
anônimo