Ejemplo
postcss 8.5.26
Muestra verificada para npm postcss 8.5.26. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó: assert node.next, node.prev…
sha256:488675049b80a5aff4050b8635e23374fcd690967418a29c58e29c25012a1fa6
Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido.
Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas.
MIT-0
Evidencia de ejecución
El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.
- Base de evidencia
- Contrato firmado aprobado
- Recibos de verificación
- 1
- Claves de firma que lo compilaron
- 1
Entorno declarado
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm
Entornos de las ejecuciones de verificación
| Entorno | Contrato | Etapas | Ejecución |
|---|---|---|---|
| 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-26 |
Caso
HOW- Objetivo
- verify pkg:npm/postcss@8.5.26
- Paquetes
- Entorno
- node 22.23.2
- Creado
- 2026-08-26T14:30:54Z
Contrato
- assert node.next, node.prev, container.index, container.first, container.last, container.some, and container.every navigate and query child nodes within AST containers
- assert container.insertBefore, container.insertAfter, and container.removeAll modify container child lists and reset node references
- assert result.warn and result.warnings record diagnostic warnings with AST node positions and preserve custom plugin messages
- assert postcss.stringify and custom stringifiers serialize AST nodes and allow customizing emitted CSS output
- assert decl.raws controls whitespace and colon spacing, decl.important appends !important flag, and cleanRaws normalizes formatting
Archivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Código fuente
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/postcss@8.5.26
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/postcss@8.5.26
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:2174332ee26764b4fa1514271f9ef3e3a01672f14328f206cd9b7226a8feb436","contract":["assert node.next, node.prev, container.index, container.first, container.last, container.some, and container.every navigate and query child nodes within AST containers","assert container.insertBefore, container.insertAfter, and container.removeAll modify container child lists and reset node references","assert result.warn and result.warnings record diagnostic warnings with AST node positions and preserve custom plugin messages","assert postcss.stringify and custom stringifiers serialize AST nodes and allow customizing emitted CSS output","assert decl.raws controls whitespace and colon spacing, decl.important appends !important flag, and cleanRaws normalizes formatting"],"goal":"verify pkg:npm/postcss@8.5.26","kind":"HOW","packages":["pkg:npm/postcss@8.5.26"],"schemaVersion":1},"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","verifierAdapter":"node-typescript@1"}
{
"name": "sample-postcss",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-postcss",
"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",
"version": "1.0.0",
"type": "module",
"license": "MIT-0",
"dependencies": {
"postcss": "8.5.26"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/postcss@8.5.26",
"kind": "HOW",
"packages": [
"pkg:npm/postcss@8.5.26"
]
}
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const postcss = require('postcss');
// 1. assert node.next, node.prev, container.index, container.first, container.last, container.some, and container.every navigate and query child nodes within AST containers
{
const css = `
.card {
color: #333333;
margin: 10px;
padding: 20px;
}
`;
const root = postcss.parse(css);
const rule = root.first;
assert.equal(rule.type, 'rule');
assert.equal(rule.selector, '.card');
assert.equal(rule.nodes.length, 3);
const firstDecl = rule.first;
const lastDecl = rule.last;
assert.equal(firstDecl.prop, 'color');
assert.equal(lastDecl.prop, 'padding');
const midDecl = firstDecl.next();
assert.equal(midDecl.prop, 'margin');
assert.equal(midDecl.prev(), firstDecl);
assert.equal(midDecl.next(), lastDecl);
assert.equal(lastDecl.next(), undefined);
assert.equal(firstDecl.prev(), undefined);
assert.equal(rule.index(firstDecl), 0);
assert.equal(rule.index(midDecl), 1);
assert.equal(rule.index(lastDecl), 2);
assert.equal(rule.every((node) => node.type === 'decl'), true);
assert.equal(rule.some((node) => node.prop === 'margin'), true);
assert.equal(rule.some((node) => node.prop === 'nonexistent'), false);
}
// 2. assert container.insertBefore, container.insertAfter, and container.removeAll modify container child lists and reset node references
{
const css = '.box { color: red; }';
const root = postcss.parse(css);
const rule = root.first;
const bgDecl = postcss.decl({ prop: 'background', value: 'blue' });
const fontDecl = postcss.decl({ prop: 'font-size', value: '14px' });
rule.insertBefore(rule.first, bgDecl);
assert.equal(rule.first.prop, 'background');
assert.equal(rule.index(bgDecl), 0);
rule.insertAfter(bgDecl, fontDecl);
assert.equal(rule.index(fontDecl), 1);
assert.equal(rule.nodes.length, 3);
assert.deepEqual(
rule.nodes.map((n) => n.prop),
['background', 'font-size', 'color']
);
rule.removeAll();
assert.equal(rule.nodes.length, 0);
assert.equal(rule.first, undefined);
assert.equal(rule.last, undefined);
}
// 3. assert result.warn and result.warnings record diagnostic warnings with AST node positions and preserve custom plugin messages
{
const testPlugin = () => {
return {
postcssPlugin: 'test-warning-plugin',
Declaration(decl, { result }) {
if (decl.prop === 'opacity') {
result.warn('Opacity property found', {
node: decl,
word: 'opacity',
});
}
},
Once(root, { result }) {
result.messages.push({
type: 'dependency',
plugin: 'test-warning-plugin',
file: 'tokens.css',
});
},
};
};
testPlugin.postcss = true;
const css = '.alert { opacity: 0.5; color: black; }';
const result = postcss([testPlugin]).process(css);
const warnings = result.warnings();
assert.equal(warnings.length, 1);
assert.equal(warnings[0].plugin, 'test-warning-plugin');
assert.equal(warnings[0].text, 'Opacity property found');
assert.equal(warnings[0].line, 1);
assert.equal(warnings[0].column, 10);
assert.equal(warnings[0].word, 'opacity');
assert.equal(warnings[0].toString(), 'test-warning-plugin: <css input>:1:10: Opacity property found');
assert.equal(result.messages.length, 2);
const depMsg = result.messages.find((m) => m.type === 'dependency');
assert.ok(depMsg);
assert.equal(depMsg.file, 'tokens.css');
}
// 4. assert postcss.stringify and custom stringifiers serialize AST nodes and allow customizing emitted CSS output
{
const root = postcss.root();
const rule = postcss.rule({ selector: 'a' });
rule.append(postcss.decl({ prop: 'color', value: 'blue' }));
root.append(rule);
const chunks = [];
postcss.stringify(root, (chunk, node, type) => {
chunks.push({ chunk, nodeType: node ? node.type : null, type });
});
assert.ok(chunks.length > 0);
assert.equal(chunks.map((c) => c.chunk).join(''), 'a {\n color: blue\n}');
const customStringifier = (node, builder) => {
if (node.type === 'decl') {
builder(`${node.prop}=>${node.value};`, node);
} else if (node.type === 'rule') {
builder(`${node.selector}[`, node, 'start');
node.nodes.forEach((child) => customStringifier(child, builder));
builder(']', node, 'end');
} else if (node.type === 'root') {
node.nodes.forEach((child) => customStringifier(child, builder));
}
};
const customOutput = root.toString(customStringifier);
assert.equal(customOutput, 'a[color=>blue;]');
}
// 5. assert decl.raws controls whitespace and colon spacing, decl.important appends !important flag, and cleanRaws normalizes formatting
{
const root = postcss.parse('.box { color: red; }');
const decl = root.first.first;
assert.equal(decl.prop, 'color');
assert.equal(decl.value, 'red');
assert.equal(Boolean(decl.important), false);
decl.important = true;
assert.equal(decl.toString(), 'color: red !important');
decl.raws.between = ' : ';
decl.raws.before = '\n ';
assert.equal(decl.toString(), 'color : red !important');
assert.equal(root.toString(), '.box {\n color : red !important; }');
decl.cleanRaws();
assert.equal(decl.raws.between, undefined);
assert.equal(decl.raws.before, undefined);
assert.equal(decl.toString(), 'color: red !important');
}
Seeder de origen
anónimo