Exemple
postcss 8.5.25: Split CSS values using postcss.list space, comma, and split utilities while preserving nested parentheses, brackets, and quoted strings
Échantillon vérifié pour npm postcss 8.5.25: Split CSS values using postcss.list space, comma, and split utilities while preserving nested parentheses…
sha256:0c40cfa0b1d485bc94a2b18bf25ee7aac2a12c568a0b2d094eaf9afc41c86459
Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré.
Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes.
MIT-0
Preuves d'exécution
L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.
- Base de preuve
- Contrat signé réussi
- Reçus de vérification
- 1
- Clés de signature qui l’ont compilé
- 1
Environnement déclaré
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| 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 |
Cas
HOW- Objectif
- Split CSS values using postcss.list space, comma, and split utilities while preserving nested parentheses, brackets, and quoted strings
- Paquets
- Symboles
-
- postcss.list.comma
- postcss.list.space
- postcss.list.split
- Environnement
- node 22.23.2
- Créé
- 2026-08-27T14:49:14Z
Contrat
- assert postcss.list.space splits whitespace-separated tokens into trimmed values while preserving nested functions, parenthesized expressions, and quoted strings
- assert postcss.list.comma splits comma-separated CSS values while preserving nested commas within functional notation like rgb(), var(), and linear-gradient()
- assert postcss.list.comma preserves empty trailing tokens when ending with a trailing delimiter while postcss.list.space omits trailing whitespace tokens
- assert postcss.list.split splits a string by custom delimiter characters while ignoring delimiters inside quotes and parentheses
- assert postcss.list helper methods return an empty array when given an empty string or whitespace-only input
Fichiers
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Code source
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: Split CSS values using postcss.list space, comma, and split utilities while preserving nested parentheses, brackets, and quoted strings
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/postcss@8.5.25
Demonstrate these symbols/APIs:
- postcss.list.comma
- postcss.list.space
- postcss.list.split
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:e853b25a39097eb663c712ddcf5e67996c284843576c7f32b6035ba9fd6d7574","contract":["assert postcss.list.space splits whitespace-separated tokens into trimmed values while preserving nested functions, parenthesized expressions, and quoted strings","assert postcss.list.comma splits comma-separated CSS values while preserving nested commas within functional notation like rgb(), var(), and linear-gradient()","assert postcss.list.comma preserves empty trailing tokens when ending with a trailing delimiter while postcss.list.space omits trailing whitespace tokens","assert postcss.list.split splits a string by custom delimiter characters while ignoring delimiters inside quotes and parentheses","assert postcss.list helper methods return an empty array when given an empty string or whitespace-only input"],"goal":"Split CSS values using postcss.list space, comma, and split utilities while preserving nested parentheses, brackets, and quoted strings","kind":"HOW","packages":["pkg:npm/postcss@8.5.25"],"schemaVersion":1,"symbols":["postcss.list.comma","postcss.list.space","postcss.list.split"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/postcss@8.5.25"],"schemaVersion":1,"subject":"pkg:npm/postcss@8.5.25","symbols":["postcss.list.comma","postcss.list.space","postcss.list.split"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-postcss-list",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-postcss-list",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"postcss": "8.5.25"
}
},
"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.25",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.25.tgz",
"integrity": "sha512-DTPx3RWSSnWyzLxQnlH0rJP+EW5ekl16ZU4/psbIhA0e53kJfdgaN5vKM+xP7yJtXVu+nfdVFmlgFDEKAe4Pyw==",
"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.16",
"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-list",
"version": "1.0.0",
"type": "module",
"license": "MIT-0",
"dependencies": {
"postcss": "8.5.25"
}
}
{
"schemaVersion": 1,
"goal": "Split CSS values using postcss.list space, comma, and split utilities while preserving nested parentheses, brackets, and quoted strings",
"kind": "HOW",
"packages": [
"pkg:npm/postcss@8.5.25"
],
"symbols": [
"postcss.list.comma",
"postcss.list.space",
"postcss.list.split"
]
}
import assert from 'node:assert/strict';
import postcss from 'postcss';
const { list } = postcss;
// 1. assert postcss.list.space splits whitespace-separated tokens into trimmed values while preserving nested functions, parenthesized expressions, and quoted strings
{
const cssValue = 'calc(100% - 20px) url("my asset file.png") rgba(0, 0, 0, 0.75) "custom font name"';
const tokens = list.space(cssValue);
assert.deepEqual(tokens, [
'calc(100% - 20px)',
'url("my asset file.png")',
'rgba(0, 0, 0, 0.75)',
'"custom font name"'
]);
const border = '1px solid black';
assert.deepEqual(list.space(border), ['1px', 'solid', 'black']);
}
// 2. assert postcss.list.comma splits comma-separated CSS values while preserving nested commas within functional notation like rgb(), var(), and linear-gradient()
{
const complexValue = 'linear-gradient(90deg, #ff0000 0%, #0000ff 100%), var(--fallback, #ffffff), rgba(255, 255, 255, 0.8)';
const items = list.comma(complexValue);
assert.deepEqual(items, [
'linear-gradient(90deg, #ff0000 0%, #0000ff 100%)',
'var(--fallback, #ffffff)',
'rgba(255, 255, 255, 0.8)'
]);
const fontFamilies = 'Helvetica, "Times New Roman, serif", Arial, sans-serif';
assert.deepEqual(list.comma(fontFamilies), [
'Helvetica',
'"Times New Roman, serif"',
'Arial',
'sans-serif'
]);
}
// 3. assert postcss.list.comma preserves empty trailing tokens when ending with a trailing delimiter while postcss.list.space omits trailing whitespace tokens
{
const trailingComma = list.comma('font-size, color, ');
assert.deepEqual(trailingComma, ['font-size', 'color', '']);
const trailingSpace = list.space('font-size color \t\n ');
assert.deepEqual(trailingSpace, ['font-size', 'color']);
}
// 4. assert postcss.list.split splits a string by custom delimiter characters while ignoring delimiters inside quotes and parentheses
{
const customDelimited = 'minmax(100px, 1fr) / calc(200px / 2) / auto';
const parts = list.split(customDelimited, ['/'], true);
assert.deepEqual(parts, [
'minmax(100px, 1fr)',
'calc(200px / 2)',
'auto'
]);
const multiSeparators = list.split('a + b - c * d', ['+', '-', '*'], false);
assert.deepEqual(multiSeparators, ['a', 'b', 'c', 'd']);
}
// 5. assert postcss.list helper methods return an empty array when given an empty string or whitespace-only input
{
assert.deepEqual(list.space(''), []);
assert.deepEqual(list.space(' \t\n '), []);
assert.deepEqual(list.comma(''), []);
assert.deepEqual(list.split('', [','], true), []);
}
Seeder d'origine
anonyme