샘플
source-map 0.6.1: SourceMapConsumer
검증된 샘플 — npm source-map 0.6.1: SourceMapConsumer. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: SourceMapConsumer parses raw source map and…
sha256:6e34f2d9dd46d525a4d8a8c458a7c0addf85cf2e4d302dfbc5ccb524f5263256
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 2
- 빌드한 서명 키
- 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-23 |
| 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-07 |
케이스
HOW- 목표
- verify source-map.SourceMapConsumer in pkg:npm/source-map@0.6.1
- 패키지
- 심벌
-
- source-map.SourceMapConsumer
- 생성일
- 2026-08-23T13:37:59Z
컨트랙트
- SourceMapConsumer parses raw source map and resolves original position for a generated coordinate
- SourceMapConsumer resolves original position with GREATEST_LOWER_BOUND and LEAST_UPPER_BOUND bias options
- SourceMapConsumer resolves generated position for an original source line and column
- SourceMapConsumer returns all generated positions matching an original source line
- SourceMapConsumer retrieves embedded source content by file name
- SourceMapConsumer iterates over mappings in GENERATED_ORDER and ORIGINAL_ORDER
- SourceMapConsumer checks whether contents are embedded for all source files
파일
- 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: verify source-map.SourceMapConsumer in pkg:npm/source-map@0.6.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/source-map@0.6.1
Demonstrate these symbols/APIs:
- source-map.SourceMapConsumer
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:f6f7a4f31aee60da6579456ccac44df06465bcb249b1fa5e17fe3f23a971c08d","contract":["SourceMapConsumer parses raw source map and resolves original position for a generated coordinate","SourceMapConsumer resolves original position with GREATEST_LOWER_BOUND and LEAST_UPPER_BOUND bias options","SourceMapConsumer resolves generated position for an original source line and column","SourceMapConsumer returns all generated positions matching an original source line","SourceMapConsumer retrieves embedded source content by file name","SourceMapConsumer iterates over mappings in GENERATED_ORDER and ORIGINAL_ORDER","SourceMapConsumer checks whether contents are embedded for all source files"],"goal":"verify source-map.SourceMapConsumer in pkg:npm/source-map@0.6.1","kind":"HOW","packages":["pkg:npm/source-map@0.6.1"],"schemaVersion":1,"symbols":["source-map.SourceMapConsumer"]},"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/source-map@0.6.1"],"schemaVersion":1,"subject":"pkg:npm/source-map@0.6.1","symbols":["source-map.SourceMapConsumer"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-source-map-consumer",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-source-map-consumer",
"version": "1.0.0",
"dependencies": {
"source-map": "0.6.1"
}
},
"node_modules/source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.10.0"
}
}
}
}
{
"name": "sample-source-map-consumer",
"version": "1.0.0",
"type": "module",
"private": true,
"dependencies": {
"source-map": "0.6.1"
}
}
{
"schemaVersion": 1,
"goal": "verify source-map.SourceMapConsumer in pkg:npm/source-map@0.6.1",
"kind": "HOW",
"packages": [
"pkg:npm/source-map@0.6.1"
],
"symbols": [
"source-map.SourceMapConsumer"
]
}
import assert from 'node:assert/strict';
import { SourceMapConsumer, SourceMapGenerator } from 'source-map';
function createFixtureSourceMap() {
const generator = new SourceMapGenerator({
file: 'bundle.min.js'
});
generator.setSourceContent('util.js', 'export function add(a, b) {\n return a + b;\n}\n');
generator.setSourceContent('main.js', 'import { add } from "./util";\nconst sum = add(1, 2);\n');
// Mapping 1: util.js add function definition
generator.addMapping({
generated: { line: 1, column: 0 },
original: { line: 1, column: 0 },
source: 'util.js',
name: 'add'
});
// Mapping 2: util.js return statement
generator.addMapping({
generated: { line: 1, column: 20 },
original: { line: 2, column: 2 },
source: 'util.js'
});
// Mapping 3: main.js import
generator.addMapping({
generated: { line: 2, column: 0 },
original: { line: 1, column: 0 },
source: 'main.js'
});
// Mapping 4: main.js sum assignment
generator.addMapping({
generated: { line: 2, column: 15 },
original: { line: 2, column: 6 },
source: 'main.js',
name: 'sum'
});
// Mapping 5: main.js call to add on same line
generator.addMapping({
generated: { line: 2, column: 25 },
original: { line: 2, column: 12 },
source: 'main.js',
name: 'add'
});
return generator.toJSON();
}
const rawMap = createFixtureSourceMap();
// 1. SourceMapConsumer parses raw source map and resolves original position for a generated coordinate
{
const consumer = new SourceMapConsumer(rawMap);
const pos = consumer.originalPositionFor({ line: 2, column: 15 });
assert.equal(pos.source, 'main.js');
assert.equal(pos.line, 2);
assert.equal(pos.column, 6);
assert.equal(pos.name, 'sum');
}
// 2. SourceMapConsumer resolves original position with GREATEST_LOWER_BOUND and LEAST_UPPER_BOUND bias options
{
const consumer = new SourceMapConsumer(rawMap);
// Column 18 is between mapping at col 15 and col 25 on line 2
const lowerPos = consumer.originalPositionFor({
line: 2,
column: 18,
bias: SourceMapConsumer.GREATEST_LOWER_BOUND
});
assert.equal(lowerPos.line, 2);
assert.equal(lowerPos.column, 6);
assert.equal(lowerPos.name, 'sum');
const upperPos = consumer.originalPositionFor({
line: 2,
column: 18,
bias: SourceMapConsumer.LEAST_UPPER_BOUND
});
assert.equal(upperPos.line, 2);
assert.equal(upperPos.column, 12);
assert.equal(upperPos.name, 'add');
}
// 3. SourceMapConsumer resolves generated position for an original source line and column
{
const consumer = new SourceMapConsumer(rawMap);
const genPos = consumer.generatedPositionFor({
source: 'util.js',
line: 2,
column: 2
});
assert.equal(genPos.line, 1);
assert.equal(genPos.column, 20);
}
// 4. SourceMapConsumer returns all generated positions matching an original source line
{
const consumer = new SourceMapConsumer(rawMap);
const allPositions = consumer.allGeneratedPositionsFor({
source: 'main.js',
line: 2
});
assert.ok(Array.isArray(allPositions));
assert.equal(allPositions.length, 2);
assert.equal(allPositions[0].line, 2);
assert.equal(allPositions[0].column, 15);
assert.equal(allPositions[1].line, 2);
assert.equal(allPositions[1].column, 25);
}
// 5. SourceMapConsumer retrieves embedded source content by file name
{
const consumer = new SourceMapConsumer(rawMap);
const utilContent = consumer.sourceContentFor('util.js');
assert.equal(utilContent, 'export function add(a, b) {\n return a + b;\n}\n');
const mainContent = consumer.sourceContentFor('main.js');
assert.equal(mainContent, 'import { add } from "./util";\nconst sum = add(1, 2);\n');
const missingContent = consumer.sourceContentFor('nonexistent.js', true);
assert.equal(missingContent, null);
}
// 6. SourceMapConsumer iterates over mappings in GENERATED_ORDER and ORIGINAL_ORDER
{
const consumer = new SourceMapConsumer(rawMap);
const genOrderMappings = [];
consumer.eachMapping((m) => {
genOrderMappings.push({ genLine: m.generatedLine, genCol: m.generatedColumn });
}, null, SourceMapConsumer.GENERATED_ORDER);
assert.equal(genOrderMappings.length, 5);
assert.deepEqual(genOrderMappings[0], { genLine: 1, genCol: 0 });
assert.deepEqual(genOrderMappings[1], { genLine: 1, genCol: 20 });
assert.deepEqual(genOrderMappings[2], { genLine: 2, genCol: 0 });
const origOrderMappings = [];
consumer.eachMapping((m) => {
origOrderMappings.push({ source: m.source, origLine: m.originalLine, origCol: m.originalColumn });
}, null, SourceMapConsumer.ORIGINAL_ORDER);
assert.equal(origOrderMappings.length, 5);
assert.equal(origOrderMappings[0].source, 'util.js');
assert.equal(origOrderMappings[0].origLine, 1);
assert.equal(origOrderMappings[0].origCol, 0);
}
// 7. SourceMapConsumer checks whether contents are embedded for all source files
{
const consumer = new SourceMapConsumer(rawMap);
assert.equal(consumer.hasContentsOfAllSources(), true);
const partialMap = {
version: 3,
file: 'out.js',
sources: ['a.js', 'b.js'],
sourcesContent: ['content a', null],
names: [],
mappings: 'AAAA;'
};
const partialConsumer = new SourceMapConsumer(partialMap);
assert.equal(partialConsumer.hasContentsOfAllSources(), false);
}
오리진 시더
익명