サンプル
@jridgewell/source-map 0.3.11: generate and consume source maps with SourceMapGenerator and SourceMapConsumer
検証済みサンプル — npm @jridgewell/source-map 0.3.11: generate and consume source maps with SourceMapGenerator and SourceMapConsumer. node 22 · linux alpine/x64 …
sha256:cd955a15d9d14491fcf327dc93d2cf371536158c5ee4c3392cab4b18e4c4d544
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 1
- ビルドした署名鍵
- 1
宣言された環境
linux 24 · ubuntu · glibc 2.39 x64 npm
検証実行環境
| 環境 | コントラクト | ステージ | 実行日 |
|---|---|---|---|
| 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-27 |
ケース
HOW- ゴール
- generate and consume source maps with SourceMapGenerator and SourceMapConsumer
- シンボル
-
- SourceMapConsumer
- SourceMapGenerator
- 作成日
- 2026-08-27T23:46:02Z
コントラクト
- SourceMapGenerator generates v3 source map with mappings and embedded sourcesContent
- SourceMapConsumer resolves originalPositionFor with mapped line column and symbol name
- SourceMapConsumer resolves generatedPositionFor matching original line and column
- SourceMapConsumer retrieves original source code via sourceContentFor
ファイル
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
ソース
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: generate and consume source maps with SourceMapGenerator and SourceMapConsumer
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40jridgewell/source-map@0.3.11
Demonstrate these symbols/APIs:
- SourceMapConsumer
- SourceMapGenerator
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:cbd03d708bf1f1fcfb6144c4ef3b5578df3f1dec78c10b972a9ba977d05dd5aa","contract":["SourceMapGenerator generates v3 source map with mappings and embedded sourcesContent","SourceMapConsumer resolves originalPositionFor with mapped line column and symbol name","SourceMapConsumer resolves generatedPositionFor matching original line and column","SourceMapConsumer retrieves original source code via sourceContentFor"],"goal":"generate and consume source maps with SourceMapGenerator and SourceMapConsumer","kind":"HOW","packages":["pkg:npm/%40jridgewell/source-map@0.3.11"],"schemaVersion":1,"symbols":["SourceMapConsumer","SourceMapGenerator"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/%40jridgewell/source-map@0.3.11"],"schemaVersion":1,"subject":"pkg:npm/%40jridgewell/source-map@0.3.11","symbols":["SourceMapConsumer","SourceMapGenerator"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-source-map",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-source-map",
"version": "1.0.0",
"dependencies": {
"@jridgewell/source-map": "0.3.11"
}
},
"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/source-map": {
"version": "0.3.11",
"resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.11.tgz",
"integrity": "sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA==",
"license": "MIT",
"dependencies": {
"@jridgewell/gen-mapping": "^0.3.5",
"@jridgewell/trace-mapping": "^0.3.25"
}
},
"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-source-map",
"version": "1.0.0",
"type": "module",
"private": true,
"dependencies": {
"@jridgewell/source-map": "0.3.11"
}
}
{
"schemaVersion": 1,
"goal": "generate and consume source maps with SourceMapGenerator and SourceMapConsumer",
"kind": "HOW",
"packages": [
"pkg:npm/%40jridgewell/source-map@0.3.11"
],
"symbols": [
"SourceMapConsumer",
"SourceMapGenerator"
]
}
import assert from 'node:assert/strict';
import { SourceMapGenerator, SourceMapConsumer } from '@jridgewell/source-map';
// 1. Generate source map with SourceMapGenerator
const generator = new SourceMapGenerator({
file: 'bundle.js',
sourceRoot: 'https://example.com/src/'
});
const originalCode = 'function hello() {\n console.log("world");\n}\n';
generator.setSourceContent('hello.js', originalCode);
generator.addMapping({
source: 'hello.js',
original: { line: 2, column: 2 },
generated: { line: 1, column: 18 },
name: 'console'
});
const rawMap = generator.toJSON();
assert.equal(rawMap.version, 3);
assert.equal(rawMap.file, 'bundle.js');
assert.equal(rawMap.sourceRoot, 'https://example.com/src/');
assert.deepEqual(rawMap.sources, ['hello.js']);
assert.deepEqual(rawMap.sourcesContent, [originalCode]);
assert.ok(typeof rawMap.mappings === 'string');
// 2. Query original position with SourceMapConsumer
const consumer = new SourceMapConsumer(rawMap);
const origPos = consumer.originalPositionFor({ line: 1, column: 18 });
assert.equal(origPos.source, 'https://example.com/src/hello.js');
assert.equal(origPos.line, 2);
assert.equal(origPos.column, 2);
assert.equal(origPos.name, 'console');
// 3. Query generated position with SourceMapConsumer
const genPos = consumer.generatedPositionFor({
source: 'hello.js',
line: 2,
column: 2
});
assert.equal(genPos.line, 1);
assert.equal(genPos.column, 18);
// 4. Retrieve source content with SourceMapConsumer
const retrievedSource = consumer.sourceContentFor('hello.js');
assert.equal(retrievedSource, originalCode);
consumer.destroy();
console.log('Contract passed');
オリジンシーダー
匿名