Beispiel
postcss 8.5.26: Warning
Verifiziertes Beispiel für npm postcss 8.5.26: Warning. Der Vertrag lief auf node 22 · linux alpine/x64 · docker und bestand: assert new postcss.Warning…
sha256:6f49a412a178410607e8c39babc53374a1736b818f2dae5af39e1f8115d3dad7
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
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:d91480838ac982c9 | 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 Warning in pkg:npm/postcss@8.5.26
- Pakete
- Symbole
-
- Warning
- Umgebung
- node 22.23.2
- Erstellt
- 2026-08-27T02:10:39Z
Contract
- assert new postcss.Warning constructs warning object with type 'warning', custom text, and copies optional metadata
- assert Warning automatically derives line, column, endLine, and endColumn coordinates from AST node source ranges
- assert Warning calculates line and column offsets when word or index options are specified for an AST node
- assert warning.toString formats messages based on presence of AST node, plugin name, and source location
- assert result.warn instantiates Warning with active plugin context and appends it to result messages and warnings
Dateien
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- 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 Warning in pkg:npm/postcss@8.5.26
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/postcss@8.5.26
Demonstrate these symbols/APIs:
- Warning
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:e419d0c185e1463246045bb6479be6239e2656c39d8994e415453e210e9404d7","contract":["assert new postcss.Warning constructs warning object with type 'warning', custom text, and copies optional metadata","assert Warning automatically derives line, column, endLine, and endColumn coordinates from AST node source ranges","assert Warning calculates line and column offsets when word or index options are specified for an AST node","assert warning.toString formats messages based on presence of AST node, plugin name, and source location","assert result.warn instantiates Warning with active plugin context and appends it to result messages and warnings"],"goal":"verify Warning in pkg:npm/postcss@8.5.26","kind":"HOW","packages":["pkg:npm/postcss@8.5.26"],"schemaVersion":1,"symbols":["Warning"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/postcss@8.5.26"],"schemaVersion":1,"subject":"pkg:npm/postcss@8.5.26","symbols":["Warning"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-postcss-warning",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-postcss-warning",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"postcss": "8.5.26"
}
},
"node_modules/nanoid": {
"version": "3.3.18",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.18.tgz",
"integrity": "sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"license": "MIT",
"bin": {
"nanoid": "bin/nanoid.cjs"
},
"engines": {
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
}
},
"node_modules/picocolors": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
"license": "ISC"
},
"node_modules/postcss": {
"version": "8.5.26",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.26.tgz",
"integrity": "sha512-u82N74LFzG8ca+dD8puPnplTXoGH4fTPpVGuIbt36G3qvNlkvfD0lEAZSxaly3KX8TS/L1A1gsCEmvKmBcVbkQ==",
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/postcss/"
},
{
"type": "tidelift",
"url": "https://tidelift.com/funding/github/npm/postcss"
},
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"license": "MIT",
"dependencies": {
"nanoid": "^3.3.17",
"picocolors": "^1.1.1",
"source-map-js": "^1.2.1"
},
"engines": {
"node": "^10 || ^12 || >=14"
}
},
"node_modules/source-map-js": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.10.0"
}
}
}
}
{
"name": "sample-postcss-warning",
"version": "1.0.0",
"type": "module",
"license": "MIT-0",
"dependencies": {
"postcss": "8.5.26"
}
}
{
"schemaVersion": 1,
"goal": "verify Warning in pkg:npm/postcss@8.5.26",
"kind": "HOW",
"packages": [
"pkg:npm/postcss@8.5.26"
],
"symbols": [
"Warning"
]
}
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const postcss = require('postcss');
// 1. assert new postcss.Warning constructs warning object with type 'warning', custom text, and copies optional metadata
{
const warning = new postcss.Warning('Deprecated property used', {
plugin: 'postcss-custom-linter',
});
assert.equal(warning.type, 'warning');
assert.equal(warning.text, 'Deprecated property used');
assert.equal(warning.plugin, 'postcss-custom-linter');
assert.equal(warning.node, undefined);
assert.equal(warning.line, undefined);
assert.equal(warning.column, undefined);
}
// 2. assert Warning automatically derives line, column, endLine, and endColumn coordinates from AST node source ranges
{
const css = 'a {\n color: red;\n opacity: 0.5;\n}';
const root = postcss.parse(css);
const decl = root.nodes[0].nodes[1]; // opacity: 0.5
const warning = new postcss.Warning('Low opacity value', {
node: decl,
plugin: 'postcss-validator',
});
assert.equal(warning.node, decl);
assert.equal(warning.line, 3);
assert.equal(warning.column, 3);
assert.equal(warning.endLine, 3);
assert.equal(warning.endColumn, 16);
}
// 3. assert Warning calculates line and column offsets when word or index options are specified for an AST node
{
const css = '.btn {\n background: red blue;\n}';
const root = postcss.parse(css);
const decl = root.first.first; // background: red blue;
const wordWarning = new postcss.Warning('Unknown color token', {
node: decl,
word: 'blue',
plugin: 'color-checker',
});
assert.equal(wordWarning.word, 'blue');
assert.equal(wordWarning.line, 2);
assert.equal(wordWarning.column, 19);
assert.equal(wordWarning.endLine, 2);
assert.equal(wordWarning.endColumn, 23);
const indexWarning = new postcss.Warning('Indexed issue', {
node: decl,
index: 5,
plugin: 'index-checker',
});
assert.equal(indexWarning.index, 5);
assert.equal(indexWarning.line, 2);
assert.equal(indexWarning.column, 8);
}
// 4. assert warning.toString formats messages based on presence of AST node, plugin name, and source location
{
// Plain warning without node or plugin
const plainWarning = new postcss.Warning('Generic warning message');
assert.equal(plainWarning.toString(), 'Generic warning message');
// Warning with plugin but no node
const pluginWarning = new postcss.Warning('Config deprecated', {
plugin: 'postcss-config-checker',
});
assert.equal(pluginWarning.toString(), 'postcss-config-checker: Config deprecated');
// Warning with node and source
const css = '.alert {\n display: inline;\n}';
const root = postcss.parse(css);
const decl = root.first.first;
const nodeWarning = new postcss.Warning('Use flex instead', {
node: decl,
plugin: 'layout-linter',
});
assert.equal(
nodeWarning.toString(),
'layout-linter: <css input>:2:3: Use flex instead'
);
}
// 5. assert result.warn instantiates Warning with active plugin context and appends it to result messages and warnings
{
const testPlugin = {
postcssPlugin: 'test-warning-emitter',
Declaration(decl, { result }) {
if (decl.prop === 'margin') {
const warn = result.warn('Margin found', { node: decl, word: 'margin' });
assert.ok(warn instanceof postcss.Warning);
}
},
};
const css = 'div { margin: 10px; }';
const result = postcss([testPlugin]).process(css);
const warnings = result.warnings();
assert.equal(warnings.length, 1);
const w = warnings[0];
assert.ok(w instanceof postcss.Warning);
assert.equal(w.plugin, 'test-warning-emitter');
assert.equal(w.text, 'Margin found');
assert.equal(w.line, 1);
assert.equal(w.column, 7);
assert.equal(w.word, 'margin');
assert.equal(w.toString(), 'test-warning-emitter: <css input>:1:7: Margin found');
}
Ursprungs-Seeder
anonym