示例
@jridgewell/remapping 2.3.5: remapping
已验证示例 — npm @jridgewell/remapping 2.3.5: remapping. contract 在 node 22 · linux alpine/x64 · docker 上运行并通过: remapping traces transformations across sequential…
sha256:dd221012ff9119187a21cd2100a54c5a7414512f9071343a2bb2bbc71e2d3021
本网络只提供一件事:能构建的样本。它在沙箱中运行并保留签名回执。它不评级、不担保——同样的代码能否在你的环境构建,它没有测量过。
提交了通过的契约回执的不同签名密钥数量。为 1 表示只有作者;大于 1 表示还有其他人构建过。密钥是自行生成的,背后没有注册身份,因此计的是密钥而非人。
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/remapping@2.3.5
- 符号
-
- remapping
- 环境
- node 22.23.2
- 创建时间
- 2026-08-24T20:24:36Z
契约
- remapping traces transformations across sequential sourcemaps back to original source files
- remapping passes source file paths to the loader function and recurses when a map is returned
- remapping accepts options to return decoded mappings or exclude sourcesContent
文件
- 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/remapping@2.3.5
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40jridgewell/remapping@2.3.5
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:ba43ad55877dc659f6bba10b0e92195359983dec124a574eb78aa4ba2cdf8e13","contract":["remapping traces transformations across sequential sourcemaps back to original source files","remapping passes source file paths to the loader function and recurses when a map is returned","remapping accepts options to return decoded mappings or exclude sourcesContent"],"goal":"verify pkg:npm/%40jridgewell/remapping@2.3.5","kind":"HOW","packages":["pkg:npm/%40jridgewell/remapping@2.3.5"],"schemaVersion":1,"symbols":["remapping"]},"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/remapping@2.3.5"],"schemaVersion":1,"subject":"pkg:npm/%40jridgewell/remapping@2.3.5","symbols":["remapping"],"verifierAdapter":"node-typescript@1"}
'use strict';
const remapping = require('@jridgewell/remapping');
/**
* Traces through all the mappings in the input sourcemap using the provided loader.
*
* @param {object|string|Array} input - Root sourcemap or array of sourcemaps.
* @param {Function} loader - Loader function called for each source file.
* @param {object|boolean} [options] - Remapping options.
* @returns {object} The remapped SourceMap instance.
*/
function remap(input, loader, options) {
return remapping(input, loader, options);
}
module.exports = {
remapping,
remap
};
{
"name": "sample-remapping",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-remapping",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@jridgewell/remapping": "2.3.5"
}
},
"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/remapping": {
"version": "2.3.5",
"resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz",
"integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==",
"license": "MIT",
"dependencies": {
"@jridgewell/gen-mapping": "^0.3.5",
"@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-remapping",
"version": "1.0.0",
"private": true,
"description": "verify @jridgewell/remapping in pkg:npm/%40jridgewell/remapping@2.3.5",
"main": "index.js",
"scripts": {
"test": "node test/contract.cjs"
},
"dependencies": {
"@jridgewell/remapping": "2.3.5"
},
"license": "MIT-0"
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/%40jridgewell/remapping@2.3.5",
"kind": "HOW",
"packages": [
"pkg:npm/%40jridgewell/remapping@2.3.5"
]
}
'use strict';
const assert = require('assert');
const remapping = require('@jridgewell/remapping');
const { remap } = require('../index.js');
function run() {
// Transformation step 1: original.js -> intermediate.js
const map1 = {
version: 3,
file: 'intermediate.js',
sources: ['original.js'],
sourcesContent: ['const answer = 42;\nconsole.log(answer);'],
names: ['answer', 'console', 'log'],
mappings: 'AAAA,MAAM,SAAS,EAAE,CAAC;AAClB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;'
};
// Transformation step 2: intermediate.js -> bundle.js
const map2 = {
version: 3,
file: 'bundle.js',
sources: ['intermediate.js'],
sourcesContent: ['var answer=42;console.log(answer);'],
names: ['answer', 'console', 'log'],
mappings: 'AAAA,IAAM,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;'
};
// 1. Verify remapping traces transformations back to original.js
const remapped = remapping(map2, (file) => {
if (file === 'intermediate.js') {
return map1;
}
return null;
});
assert.strictEqual(remapped.version, 3, 'Remapped source map version must be 3');
assert.strictEqual(remapped.file, 'bundle.js', 'Remapped output file should match root map');
assert.deepStrictEqual(remapped.sources, ['original.js'], 'Remapped sources should resolve to original.js');
assert.strictEqual(typeof remapped.mappings, 'string', 'Default mappings should be encoded string');
assert.deepStrictEqual(
remapped.sourcesContent,
['const answer = 42;\nconsole.log(answer);'],
'sourcesContent should be preserved from root map1'
);
// 2. Verify JSON serialization via toString()
const jsonString = remapped.toString();
const parsed = JSON.parse(jsonString);
assert.strictEqual(parsed.version, 3, 'Parsed JSON must have version 3');
assert.deepStrictEqual(parsed.sources, ['original.js'], 'Parsed JSON sources must match');
// 3. Verify decodedMappings option
const decodedResult = remap(map2, (file) => (file === 'intermediate.js' ? map1 : null), {
decodedMappings: true
});
assert.ok(Array.isArray(decodedResult.mappings), 'decodedMappings: true should produce array mappings');
// 4. Verify excludeContent option
const excludedContentResult = remap(map2, (file) => (file === 'intermediate.js' ? map1 : null), {
excludeContent: true
});
assert.strictEqual(
excludedContentResult.sourcesContent,
undefined,
'excludeContent: true should omit sourcesContent'
);
// 5. Verify loader returning null treats source as root source
const directMap = remapping(map1, () => null);
assert.deepStrictEqual(directMap.sources, ['original.js'], 'When loader returns null, source remains unchanged');
console.log('Contract tests passed successfully.');
}
try {
run();
} catch (err) {
console.error('Contract test failed:', err);
process.exit(1);
}
原始种子者
匿名