Exemple
@tailwindcss/oxide 4.3.3: Extract Tailwind CSS candidate tokens and byte offsets from in-memory content and file sources using Scanner with glob and negation filters
Échantillon vérifié pour npm @tailwindcss/oxide 4.3.3: Extract Tailwind CSS candidate tokens and byte offsets from in-memory content and file sources using…
sha256:0bf5927bbb5ce9369eab866dadc417f20b2132743fd9ae7aea94322ca26f55aa
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
- 2
- 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 10
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@1 |
2026-08-20 |
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-09-14 |
Cas
HOW- Objectif
- Extract Tailwind CSS candidate tokens and byte offsets from in-memory content and file sources using Scanner with glob and negation filters
- Paquets
- Environnement
- node 22.23.2
- Créé
- 2026-08-20T15:24:47Z
Contrat
- Scanner.scanFiles extracts candidate utility class tokens from in-memory content strings across multiple file extensions
- Scanner.getCandidatesWithPositions returns utility candidate strings alongside their exact byte offset positions
- Scanner.scanFiles deduplicates identical utility candidates extracted across multiple files or code snippets
- Scanner configured with source glob patterns resolves matching file paths on disk while filtering out negated patterns
- Scanner.scanFiles scans on-disk files when passed resolved file paths and extracts candidates according to extension
Fichiers
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.js
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: Extract Tailwind CSS candidate tokens and byte offsets from in-memory content and file sources using Scanner with glob and negation filters
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40tailwindcss/oxide@4.3.3
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@10.9.8
- runtime: node@22.23.2
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:a9fce74f4246eba516cd82c97fad64554cf80996c96186aef0c88c441b01d650","constraints":{"executionContext":"node"},"contract":["Scanner.scanFiles extracts candidate utility class tokens from in-memory content strings across multiple file extensions","Scanner.getCandidatesWithPositions returns utility candidate strings alongside their exact byte offset positions","Scanner.scanFiles deduplicates identical utility candidates extracted across multiple files or code snippets","Scanner configured with source glob patterns resolves matching file paths on disk while filtering out negated patterns","Scanner.scanFiles scans on-disk files when passed resolved file paths and extracts candidates according to extension"],"goal":"Extract Tailwind CSS candidate tokens and byte offsets from in-memory content and file sources using Scanner with glob and negation filters","kind":"HOW","packages":["pkg:npm/%40tailwindcss/oxide@4.3.3"],"schemaVersion":1,"symbols":["Scanner","Scanner.scanFiles","Scanner.getCandidatesWithPositions","Scanner.files"]},"contractCommand":["node","test/contract.js"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","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/%40tailwindcss/oxide@4.3.3"],"schemaVersion":1,"subject":"pkg:npm/%40tailwindcss/oxide@4.3.3","verifierAdapter":"node-typescript@1"}
{
"name": "sample-tailwindcss-oxide",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-tailwindcss-oxide",
"version": "1.0.0",
"dependencies": {
"@tailwindcss/oxide": "4.3.3"
}
},
"node_modules/@tailwindcss/oxide": {
"version": "4.3.3",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide/-/oxide-4.3.3.tgz",
"integrity": "sha512-krXjAikiaFSPaK/FkAQT5UTx3VormQaiZ5hBFlJZ9UFQGB/rwg1MZIhHAG9smMQRTdyJxP6Qt5MwMtdyU5FWrA==",
"license": "MIT",
"engines": {
"node": ">= 20"
},
"optionalDependencies": {
"@tailwindcss/oxide-android-arm64": "4.3.3",
"@tailwindcss/oxide-darwin-arm64": "4.3.3",
"@tailwindcss/oxide-darwin-x64": "4.3.3",
"@tailwindcss/oxide-freebsd-x64": "4.3.3",
"@tailwindcss/oxide-linux-arm-gnueabihf": "4.3.3",
"@tailwindcss/oxide-linux-arm64-gnu": "4.3.3",
"@tailwindcss/oxide-linux-arm64-musl": "4.3.3",
"@tailwindcss/oxide-linux-x64-gnu": "4.3.3",
"@tailwindcss/oxide-linux-x64-musl": "4.3.3",
"@tailwindcss/oxide-wasm32-wasi": "4.3.3",
"@tailwindcss/oxide-win32-arm64-msvc": "4.3.3",
"@tailwindcss/oxide-win32-x64-msvc": "4.3.3"
}
},
"node_modules/@tailwindcss/oxide-android-arm64": {
"version": "4.3.3",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-android-arm64/-/oxide-android-arm64-4.3.3.tgz",
"integrity": "sha512-Y85A2gmPSkl5Ve5qR86GL4HT509cFqQh1aes9p3sSkyTPwt0Pppf3GkwGe4JPACcRYjgJIEhQgM6dBClnr0NYw==",
"cpu": [
"arm64"
],
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">= 20"
}
},
"node_modules/@tailwindcss/oxide-darwin-arm64": {
"version": "4.3.3",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-arm64/-/oxide-darwin-arm64-4.3.3.tgz",
"integrity": "sha512-BiaWatpBcERQFDlOjRDpIVXuFK5PJez5SA4JMg6VYZdBYU+qKfV/vqjcIs+IYmtitf1xYQZTwXvU/8y4lfZUGw==",
"cpu": [
"arm64"
],
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">= 20"
}
},
"node_modules/@tailwindcss/oxide-darwin-x64": {
"version": "4.3.3",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-x64/-/oxide-darwin-x64-4.3.3.tgz",
"integrity": "sha512-fAeUqfV5ndhxRwai8cXGzdLvul9utWOmeTkv69unv4ZXixjn61Z+p9lCWdwOwA3TYboG3BwdVuN/RDjhBRl0mw==",
"cpu": [
"x64"
],
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">= 20"
}
},
"node_modules/@tailwindcss/oxide-freebsd-x64": {
"version": "4.3.3",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-freebsd-x64/-/oxide-freebsd-x64-4.3.3.tgz",
"integrity": "sha512-iyf5bV6+wnAlflVeEy7R25dupxTNECZN5QMI0qNT6eT+EgaGdZcKhGkr5SdoaWiLJ3spLqIY9VCeSGrwmtg4kw==",
"cpu": [
"x64"
],
"license": "MIT",
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">= 20"
}
},
"node_modules/@tailwindcss/oxide-linux-arm-gnueabihf": {
"version": "4.3.3",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm-gnueabihf/-/oxide-linux-arm-gnueabihf-4.3.3.tgz",
"integrity": "sha512-aAYUprJAJQWWbRrPvtjdroZ56Md+JM8pMiopS6xGEwDfLhqj+2ver2p4nU4Mb3CRqcMmNBjo8KkUgcxhkzVQGQ==",
"cpu": [
"arm"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 20"
}
},
"node_modules/@tailwindcss/oxide-linux-arm64-gnu": {
"version": "4.3.3",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-gnu/-/oxide-linux-arm64-gnu-4.3.3.tgz",
"integrity": "sha512-nDxldcEENOxZRzC2uu9jrutZdAAQtb+8WWDCSnWL1zvBk1+FN+x6MtDViPB5AJMfttVCUhehGWus3XBPgatM/w==",
"cpu": [
"arm64"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 20"
}
},
"node_modules/@tailwindcss/oxide-linux-arm64-musl": {
"version": "4.3.3",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-musl/-/oxide-linux-arm64-musl-4.3.3.tgz",
"integrity": "sha512-Md44bD6veX/PC5iyF8cDVnw4HBIANZepRZZ7a8DQOvkfo5WUBwcp6iAuCUz23u+4SUkhJlD3eL7hNdW8ezd/kA==",
"cpu": [
"arm64"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 20"
}
},
"node_modules/@tailwindcss/oxide-linux-x64-gnu": {
"version": "4.3.3",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-gnu/-/oxide-linux-x64-gnu-4.3.3.tgz",
"integrity": "sha512-tx7us1muwOKAKWao2v/GaafFeQboE6aj88vC6ziN2NCGcRm8gWUhwjzg+YdVB1e4boAtdtma4L43onunI6NS4w==",
"cpu": [
"x64"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 20"
}
},
"node_modules/@tailwindcss/oxide-linux-x64-musl": {
"version": "4.3.3",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-musl/-/oxide-linux-x64-musl-4.3.3.tgz",
"integrity": "sha512-SJxX60smvHgasZoBy11dX6YRjXJFovwWBoedhbQPOBzgFWBHGB+TVPWB9BxzR7TTxU8FQZAI2AyiNCMzFm8Img==",
"cpu": [
"x64"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 20"
}
},
"node_modules/@tailwindcss/oxide-wasm32-wasi": {
"version": "4.3.3",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-wasm32-wasi/-/oxide-wasm32-wasi-4.3.3.tgz",
"integrity": "sha512-jx1+rPhY/5Ympkktd656HBWEBLxP7dH06losBLjjf5vgCODXvi9KhtftWcMIwTFIDqBr7cRnQkdLnAG+IOlGvQ==",
"bundleDependencies": [
"@napi-rs/wasm-runtime",
"@emnapi/core",
"@emnapi/runtime",
"@tybys/wasm-util",
"@emnapi/wasi-threads",
"tslib"
],
"cpu": [
"wasm32"
],
"license": "MIT",
"optional": true,
"dependencies": {
"@emnapi/core": "^1.11.1",
"@emnapi/runtime": "^1.11.1",
"@emnapi/wasi-threads": "^1.2.2",
"@napi-rs/wasm-runtime": "^1.1.4",
"@tybys/wasm-util": "^0.10.2",
"tslib": "^2.8.1"
},
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/core": {
"version": "1.11.1",
"inBundle": true,
"license": "MIT",
"optional": true,
"dependencies": {
"@emnapi/wasi-threads": "1.2.2",
"tslib": "^2.4.0"
}
},
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/runtime": {
"version": "1.11.1",
"inBundle": true,
"license": "MIT",
"optional": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/wasi-threads": {
"version": "1.2.2",
"inBundle": true,
"license": "MIT",
"optional": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@napi-rs/wasm-runtime": {
"version": "1.1.4",
"inBundle": true,
"license": "MIT",
"optional": true,
"dependencies": {
"@tybys/wasm-util": "^0.10.1"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/Brooooooklyn"
},
"peerDependencies": {
"@emnapi/core": "^1.7.1",
"@emnapi/runtime": "^1.7.1"
}
},
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@tybys/wasm-util": {
"version": "0.10.2",
"inBundle": true,
"license": "MIT",
"optional": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/tslib": {
"version": "2.8.1",
"inBundle": true,
"license": "0BSD",
"optional": true
},
"node_modules/@tailwindcss/oxide-win32-arm64-msvc": {
"version": "4.3.3",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.3.3.tgz",
"integrity": "sha512-3rc292Ca2ceK6Ulcc/bAVnTs/3nDtoPhyEKlgPv+yQJQi/JS/AMJlqzxvlDacL1nekbrcf6bTqp/jV4qgnPxNQ==",
"cpu": [
"arm64"
],
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">= 20"
}
},
"node_modules/@tailwindcss/oxide-win32-x64-msvc": {
"version": "4.3.3",
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-x64-msvc/-/oxide-win32-x64-msvc-4.3.3.tgz",
"integrity": "sha512-yJ0pwIVc/nYeGoV02WtsN8KYyLQv7kyI2wDnkezyJlGGjkd4QLwDGAwl47YpPJeuI0M0ObaXGSPjvWDPeTPggw==",
"cpu": [
"x64"
],
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">= 20"
}
}
}
}
{
"name": "sample-tailwindcss-oxide",
"version": "1.0.0",
"private": true,
"description": "Clean-room sample demonstrating Tailwind CSS candidate extraction and file scanning using @tailwindcss/oxide Scanner",
"main": "src/index.js",
"scripts": {
"test": "node test/contract.js"
},
"dependencies": {
"@tailwindcss/oxide": "4.3.3"
}
}
{
"schemaVersion": 1,
"goal": "Extract Tailwind CSS candidate tokens and byte offsets from in-memory content and file sources using Scanner with glob and negation filters",
"kind": "HOW",
"packages": [
"pkg:npm/%40tailwindcss/oxide@4.3.3"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
const { Scanner } = require('@tailwindcss/oxide');
/**
* Scan in-memory content entries for Tailwind utility class candidates.
* @param {Array<{ content?: string, extension: string, file?: string }>} entries
* @returns {string[]}
*/
function scanContent(entries) {
const scanner = new Scanner({ sources: [] });
return scanner.scanFiles(entries);
}
/**
* Extract candidates along with their byte positions from content.
* @param {string} content
* @param {string} extension
* @returns {Array<{ candidate: string, position: number }>}
*/
function getCandidatesWithPositions(content, extension) {
const scanner = new Scanner({ sources: [] });
return scanner.getCandidatesWithPositions({ content, extension });
}
/**
* Create a scanner configured with source glob directories and exclusion patterns.
* @param {string} baseDir
* @param {string} includePattern
* @param {string} excludePattern
* @returns {Scanner}
*/
function createProjectScanner(baseDir, includePattern, excludePattern) {
return new Scanner({
sources: [
{ base: baseDir, pattern: includePattern, negated: false },
{ base: baseDir, pattern: excludePattern, negated: true }
]
});
}
module.exports = {
Scanner,
scanContent,
getCandidatesWithPositions,
createProjectScanner
};
const assert = require('node:assert');
const path = require('node:path');
const fs = require('node:fs');
const os = require('node:os');
const { Scanner, scanContent, getCandidatesWithPositions, createProjectScanner } = require('../src/index.js');
// Contract 1: Scanner.scanFiles extracts candidate utility class tokens from in-memory content strings across multiple file extensions
{
const scanner = new Scanner({ sources: [] });
const candidates = scanner.scanFiles([
{
content: '<button class="px-4 py-2 bg-blue-600 hover:bg-blue-700 active:scale-95 text-white font-bold rounded-lg shadow-md md:flex"></button>',
extension: 'html'
}
]);
assert(Array.isArray(candidates), 'scanFiles must return an array');
assert(candidates.includes('px-4'), 'candidates should include px-4');
assert(candidates.includes('py-2'), 'candidates should include py-2');
assert(candidates.includes('bg-blue-600'), 'candidates should include bg-blue-600');
assert(candidates.includes('hover:bg-blue-700'), 'candidates should include hover:bg-blue-700');
assert(candidates.includes('active:scale-95'), 'candidates should include active:scale-95');
assert(candidates.includes('text-white'), 'candidates should include text-white');
assert(candidates.includes('font-bold'), 'candidates should include font-bold');
assert(candidates.includes('rounded-lg'), 'candidates should include rounded-lg');
assert(candidates.includes('shadow-md'), 'candidates should include shadow-md');
assert(candidates.includes('md:flex'), 'candidates should include md:flex');
}
// Contract 2: Scanner.getCandidatesWithPositions returns utility candidate strings alongside their exact byte offset positions
{
const positions = getCandidatesWithPositions('flex p-4 items-center', 'html');
assert.deepStrictEqual(positions, [
{ candidate: 'flex', position: 0 },
{ candidate: 'p-4', position: 5 },
{ candidate: 'items-center', position: 9 }
], 'getCandidatesWithPositions must return exact candidate tokens and byte offsets');
}
// Contract 3: Scanner.scanFiles deduplicates identical utility candidates extracted across multiple files or code snippets
{
const candidates = scanContent([
{ content: 'const header = "bg-card text-card-foreground p-4";', extension: 'js' },
{ content: '<div class="bg-card p-4 border-b"></div>', extension: 'html' }
]);
assert(candidates.includes('bg-card'), 'should include bg-card');
assert(candidates.includes('text-card-foreground'), 'should include text-card-foreground');
assert(candidates.includes('p-4'), 'should include p-4');
assert(candidates.includes('border-b'), 'should include border-b');
assert.strictEqual(candidates.filter(c => c === 'bg-card').length, 1, 'bg-card should only appear once');
assert.strictEqual(candidates.filter(c => c === 'p-4').length, 1, 'p-4 should only appear once');
}
// Contract 4: Scanner configured with source glob patterns resolves matching file paths on disk while filtering out negated patterns
{
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'csx-oxide-test-'));
try {
fs.mkdirSync(path.join(tmpDir, 'src/components'), { recursive: true });
fs.mkdirSync(path.join(tmpDir, 'dist'), { recursive: true });
const compFile = path.join(tmpDir, 'src/components/Card.tsx');
const distFile = path.join(tmpDir, 'dist/bundle.js');
fs.writeFileSync(compFile, '<div className="rounded-xl shadow-lg border"></div>');
fs.writeFileSync(distFile, 'const x = "ignored-class";');
const projectScanner = createProjectScanner(tmpDir, '**/*.{tsx,js}', 'dist/**');
const resolvedFiles = projectScanner.files.map(f => path.resolve(f));
assert.strictEqual(resolvedFiles.length, 1, 'only non-negated source files should be matched');
assert.strictEqual(resolvedFiles[0], path.resolve(compFile), 'matched file should be Card.tsx');
// Contract 5: Scanner.scanFiles scans on-disk files when passed resolved file paths and extracts candidates according to extension
const fileScanResults = projectScanner.scanFiles([
{ file: compFile, extension: 'tsx' }
]);
assert(fileScanResults.includes('rounded-xl'), 'should extract rounded-xl from disk file');
assert(fileScanResults.includes('shadow-lg'), 'should extract shadow-lg from disk file');
assert(fileScanResults.includes('border'), 'should extract border from disk file');
} finally {
fs.rmSync(tmpDir, { recursive: true, force: true });
}
}
console.log('All @tailwindcss/oxide Scanner contract tests passed successfully.');
Seeder d'origine
anonyme