샘플
convert-source-map 1.9.0
검증된 샘플 — npm convert-source-map 1.9.0. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: fromObject converts a source map object to a Converter…
sha256:3da0b0fb6d3493e7b5d2ecd2dcc0487399af4afe00f358d3189502ab22103033
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
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-25 |
케이스
HOW- 목표
- verify pkg:npm/convert-source-map@1.9.0
- 환경
- node 22.23.2
- 생성일
- 2026-08-25T02:37:43Z
컨트랙트
- fromObject converts a source map object to a Converter with toComment and toJSON methods
- fromComment parses inline line and block sourceMappingURL comments into source map objects
- fromJSON and fromBase64 reconstruct source map converters from serialized formats
- fromSource extracts embedded inline source map from source code string
- removeComments strips inline source map comment annotations from source code
- setProperty and getProperty modify and inspect source map metadata properties
파일
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- 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 pkg:npm/convert-source-map@1.9.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/convert-source-map@1.9.0
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:d928a57238232f7f02686681914c9f0c7007076e6c2718c8c8718183192e4741","contract":["fromObject converts a source map object to a Converter with toComment and toJSON methods","fromComment parses inline line and block sourceMappingURL comments into source map objects","fromJSON and fromBase64 reconstruct source map converters from serialized formats","fromSource extracts embedded inline source map from source code string","removeComments strips inline source map comment annotations from source code","setProperty and getProperty modify and inspect source map metadata properties"],"goal":"verify pkg:npm/convert-source-map@1.9.0","kind":"HOW","packages":["pkg:npm/convert-source-map@1.9.0"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","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/convert-source-map@1.9.0"],"schemaVersion":1,"subject":"pkg:npm/convert-source-map@1.9.0","verifierAdapter":"node-typescript@1"}
{
"name": "sample-convert-source-map",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-convert-source-map",
"version": "1.0.0",
"dependencies": {
"convert-source-map": "1.9.0"
}
},
"node_modules/convert-source-map": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz",
"integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==",
"license": "MIT"
}
}
}
{
"name": "sample-convert-source-map",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of convert-source-map",
"main": "src/index.js",
"dependencies": {
"convert-source-map": "1.9.0"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/convert-source-map@1.9.0",
"kind": "HOW",
"packages": [
"pkg:npm/convert-source-map@1.9.0"
]
}
const convertSourceMap = require('convert-source-map');
/**
* Generate an inline sourceMappingURL comment from a source map object.
* @param {object} mapObject - Source map object.
* @param {object} [options] - Generation options.
* @param {boolean} [options.multiline=false] - Whether to generate a block comment.
* @returns {string} Inline comment string.
*/
function createSourceMapComment(mapObject, options = {}) {
const converter = convertSourceMap.fromObject(mapObject);
return converter.toComment(options);
}
/**
* Parse a source map object from an inline comment string.
* @param {string} comment - Inline comment containing source map.
* @returns {object|null} Parsed source map object, or null if invalid.
*/
function parseSourceMapFromComment(comment) {
const converter = convertSourceMap.fromComment(comment);
return converter ? converter.toObject() : null;
}
/**
* Extract and parse an inline source map from a source code string.
* @param {string} sourceCode - Source code containing inline source map.
* @returns {object|null} Parsed source map object, or null if not found.
*/
function parseSourceMapFromSource(sourceCode) {
const converter = convertSourceMap.fromSource(sourceCode);
return converter ? converter.toObject() : null;
}
/**
* Strip inline source map comments from source code.
* @param {string} sourceCode - Source code containing inline source maps.
* @returns {string} Source code without inline source map comments.
*/
function stripSourceMapComments(sourceCode) {
return convertSourceMap.removeComments(sourceCode);
}
/**
* Set a metadata property on a source map object.
* @param {object} mapObject - Source map object.
* @param {string} key - Property name.
* @param {any} value - Property value.
* @returns {object} Updated source map object.
*/
function modifySourceMapProperty(mapObject, key, value) {
const converter = convertSourceMap.fromObject(mapObject);
converter.setProperty(key, value);
return converter.toObject();
}
module.exports = {
convertSourceMap,
createSourceMapComment,
parseSourceMapFromComment,
parseSourceMapFromSource,
stripSourceMapComments,
modifySourceMapProperty
};
import assert from 'node:assert';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const {
convertSourceMap,
createSourceMapComment,
parseSourceMapFromComment,
parseSourceMapFromSource,
stripSourceMapComments,
modifySourceMapProperty
} = require('../src/index.js');
// 1. Export verification
assert.strictEqual(typeof convertSourceMap, 'object', 'convertSourceMap should be exported');
assert.strictEqual(typeof convertSourceMap.fromObject, 'function', 'fromObject should be a function');
assert.strictEqual(typeof convertSourceMap.fromJSON, 'function', 'fromJSON should be a function');
assert.strictEqual(typeof convertSourceMap.fromBase64, 'function', 'fromBase64 should be a function');
assert.strictEqual(typeof convertSourceMap.fromComment, 'function', 'fromComment should be a function');
assert.strictEqual(typeof convertSourceMap.fromSource, 'function', 'fromSource should be a function');
assert.strictEqual(typeof convertSourceMap.removeComments, 'function', 'removeComments should be a function');
assert.strictEqual(typeof createSourceMapComment, 'function', 'createSourceMapComment should be a function');
assert.strictEqual(typeof parseSourceMapFromComment, 'function', 'parseSourceMapFromComment should be a function');
assert.strictEqual(typeof parseSourceMapFromSource, 'function', 'parseSourceMapFromSource should be a function');
assert.strictEqual(typeof stripSourceMapComments, 'function', 'stripSourceMapComments should be a function');
assert.strictEqual(typeof modifySourceMapProperty, 'function', 'modifySourceMapProperty should be a function');
// 2. fromObject converts a source map object to a Converter with toComment and toJSON methods
const sampleMap = {
version: 3,
file: 'output.js',
sources: ['input.js'],
mappings: 'AAAA;'
};
const conv = convertSourceMap.fromObject(sampleMap);
assert.deepStrictEqual(conv.toObject(), sampleMap);
assert.strictEqual(typeof conv.toJSON(), 'string');
assert.strictEqual(typeof conv.toBase64(), 'string');
const lineComment = conv.toComment();
assert.ok(lineComment.startsWith('//# sourceMappingURL=data:application/json;charset=utf-8;base64,'));
const blockComment = conv.toComment({ multiline: true });
assert.ok(blockComment.startsWith('/*# sourceMappingURL=data:application/json;charset=utf-8;base64,'));
assert.ok(blockComment.endsWith('*/'));
// 3. fromComment parses inline line and block sourceMappingURL comments into source map objects
const parsedLine = parseSourceMapFromComment(lineComment);
assert.deepStrictEqual(parsedLine, sampleMap);
const parsedBlock = parseSourceMapFromComment(blockComment);
assert.deepStrictEqual(parsedBlock, sampleMap);
// 4. fromJSON and fromBase64 reconstruct source map converters from serialized formats
const jsonString = JSON.stringify(sampleMap);
const fromJsonConv = convertSourceMap.fromJSON(jsonString);
assert.deepStrictEqual(fromJsonConv.toObject(), sampleMap);
const base64String = Buffer.from(jsonString).toString('base64');
const fromBase64Conv = convertSourceMap.fromBase64(base64String);
assert.deepStrictEqual(fromBase64Conv.toObject(), sampleMap);
// 5. fromSource extracts embedded inline source map from source code string
const sampleCode = 'function hello() { return 1; }\n' + lineComment;
const parsedFromCode = parseSourceMapFromSource(sampleCode);
assert.deepStrictEqual(parsedFromCode, sampleMap);
// 6. removeComments strips inline source map comment annotations from source code
const stripped = stripSourceMapComments(sampleCode);
assert.strictEqual(stripped, 'function hello() { return 1; }\n');
assert.strictEqual(convertSourceMap.fromSource(stripped), null);
// 7. setProperty and getProperty modify and inspect source map metadata properties
const updatedMap = modifySourceMapProperty(sampleMap, 'sourcesContent', ['function hello() {}']);
assert.deepStrictEqual(updatedMap.sourcesContent, ['function hello() {}']);
assert.strictEqual(updatedMap.version, 3);
assert.strictEqual(updatedMap.file, 'output.js');
console.log('Contract tests passed successfully.');
오리진 시더
익명