Beispiel
@jridgewell/trace-mapping 0.3.31: sourceContentFor
Verifiziertes Beispiel für npm @jridgewell/trace-mapping 0.3.31: sourceContentFor. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand.
sha256:216fec617f1f2888b99b8085d43febeee3a7a8dc43be50394199ae5632fb0f20
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 1
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| 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 |
Fall
HOW- Ziel
- verify @jridgewell/trace-mapping.sourceContentFor in pkg:npm/%40jridgewell/trace-mapping@0.3.31
- Symbole
-
- @jridgewell/trace-mapping.sourceContentFor
- Umgebung
- node 22.23.2
- Erstellt
- 2026-08-27T11:50:49Z
Contract
- sourceContentFor returns the embedded source content for a source file present in sourcesContent
- sourceContentFor returns null for a source file without content or when sourcesContent is not provided
- sourceContentFor returns null for an unknown or unmapped source file path
- sourceContentFor resolves sources correctly when sourceRoot is configured in the source map
Dateien
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- test/contract.mjs
Quelltext
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 @jridgewell/trace-mapping.sourceContentFor in pkg:npm/%40jridgewell/trace-mapping@0.3.31
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40jridgewell/trace-mapping@0.3.31
Demonstrate these symbols/APIs:
- @jridgewell/trace-mapping.sourceContentFor
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:5237a04d316955944c34148c3fef8e3da3f402c81153920709e659199306ffd6","contract":["sourceContentFor returns the embedded source content for a source file present in sourcesContent","sourceContentFor returns null for a source file without content or when sourcesContent is not provided","sourceContentFor returns null for an unknown or unmapped source file path","sourceContentFor resolves sources correctly when sourceRoot is configured in the source map"],"goal":"verify @jridgewell/trace-mapping.sourceContentFor in pkg:npm/%40jridgewell/trace-mapping@0.3.31","kind":"HOW","packages":["pkg:npm/%40jridgewell/trace-mapping@0.3.31"],"schemaVersion":1,"symbols":["@jridgewell/trace-mapping.sourceContentFor"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","language":"javascript","libc":"glibc","libcVersion":"2.39","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/trace-mapping@0.3.31"],"schemaVersion":1,"subject":"pkg:npm/%40jridgewell/trace-mapping@0.3.31","symbols":["@jridgewell/trace-mapping.sourceContentFor"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-trace-mapping-source-content-for",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-trace-mapping-source-content-for",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@jridgewell/trace-mapping": "0.3.31"
}
},
"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-trace-mapping-source-content-for",
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT-0",
"dependencies": {
"@jridgewell/trace-mapping": "0.3.31"
}
}
{
"schemaVersion": 1,
"goal": "verify @jridgewell/trace-mapping.sourceContentFor in pkg:npm/%40jridgewell/trace-mapping@0.3.31",
"kind": "HOW",
"packages": [
"pkg:npm/%40jridgewell/trace-mapping@0.3.31"
],
"symbols": [
"@jridgewell/trace-mapping.sourceContentFor"
]
}
import { TraceMap, sourceContentFor } from "@jridgewell/trace-mapping";
export function createTraceMap(map) {
return new TraceMap(map);
}
export function getSourceContent(tracer, source) {
return sourceContentFor(tracer, source);
}
import assert from "node:assert/strict";
import { TraceMap, sourceContentFor } from "@jridgewell/trace-mapping";
import { createTraceMap, getSourceContent } from "../src/index.mjs";
// Test 1: sourceContentFor returns the embedded source content for a source file present in sourcesContent
{
const map = {
version: 3,
sources: ["input.js", "utils.js"],
sourcesContent: ["export const x = 42;", "export function add(a, b) { return a + b; }"],
mappings: "AAAA;"
};
const tracer = createTraceMap(map);
assert.equal(getSourceContent(tracer, "input.js"), "export const x = 42;");
assert.equal(getSourceContent(tracer, "utils.js"), "export function add(a, b) { return a + b; }");
assert.equal(sourceContentFor(tracer, "input.js"), "export const x = 42;");
}
// Test 2: sourceContentFor returns null for a source file without content or when sourcesContent is not provided
{
const mapWithNull = {
version: 3,
sources: ["has-content.js", "no-content.js"],
sourcesContent: ["const a = 1;", null],
mappings: "AAAA;"
};
const tracer1 = createTraceMap(mapWithNull);
assert.equal(getSourceContent(tracer1, "has-content.js"), "const a = 1;");
assert.equal(getSourceContent(tracer1, "no-content.js"), null);
const mapWithoutSourcesContent = {
version: 3,
sources: ["input.js"],
mappings: "AAAA;"
};
const tracer2 = createTraceMap(mapWithoutSourcesContent);
assert.equal(getSourceContent(tracer2, "input.js"), null);
}
// Test 3: sourceContentFor returns null for an unknown or unmapped source file path
{
const map = {
version: 3,
sources: ["file1.js"],
sourcesContent: ["const ok = true;"],
mappings: "AAAA;"
};
const tracer = createTraceMap(map);
assert.equal(getSourceContent(tracer, "unknown.js"), null);
assert.equal(getSourceContent(tracer, ""), null);
assert.equal(getSourceContent(tracer, null), null);
assert.equal(getSourceContent(tracer, undefined), null);
}
// Test 4: sourceContentFor resolves sources correctly when sourceRoot is configured in the source map
{
const mapWithRoot = {
version: 3,
sourceRoot: "https://example.com/src/",
sources: ["app.js"],
sourcesContent: ["console.log('root app');"],
mappings: "AAAA;"
};
const tracer = createTraceMap(mapWithRoot);
assert.equal(getSourceContent(tracer, "https://example.com/src/app.js"), "console.log('root app');");
assert.equal(getSourceContent(tracer, "app.js"), "console.log('root app');");
}
console.log("All @jridgewell/trace-mapping.sourceContentFor contract tests passed successfully.");
Ursprungs-Seeder
anonym