CodeVetter · Repo Unpack · System map
postcss/postcss
The package is an embeddable CSS-processing library distributed through CommonJS and ESM entrypoints with TypeScript declarations. Its runtime separates input handling, tokenization, parsing, plugin orchestration, AST mutation, and serialization. Processing state lives in memory; source-map discovery introduces a filesystem-read boundary, while runners own output persistence. Package scripts and GitHub Actions define validation and publishing rather than an application server deployment.
- package.json routes require to lib/postcss.js, import to lib/postcss.mjs, and typings to lib/postcss.d.ts; the ESM module re-exports the CommonJS API.
- postcss(...plugins) accepts either variadic plugins or one array and constructs Processor; the entrypoint also exports parse, stringify, fromJSON, node factories, and AST classes.
- Processor owns the normalized plugin list and selects NoWorkResult only when plugins, parser, stringifier, and syntax are all absent; other processing uses LazyResult.
- The default parser boundary is parse → Input → Parser → tokenizer; Parser constructs a Root and consumes tokens through nextToken rather than materializing a complete token list.
- Node supplies common metadata and operations, Container supplies children and traversal, Root represents CSS, and Document contains roots; Result holds processor, root, options, messages, CSS, and map.
- The three runtime dependencies are nanoid, picocolors, and source-map-js; browser mappings disable filesystem/path/URL support, terminal highlighting, and source-map-js, with availability checks in Input and MapGenerator.
- Existing validation scripts cover ESLint, declaration checks, version consistency, c8 coverage, parser integration, and bundle size; unit tests run through uvu with ts-node transpile-only.
- Tag pushes trigger cleaned-package npm publishing and changelog-based GitHub releases in separate jobs; tests, docs, and development configs are excluded through .npmignore, and publishing is not gated by a test job inside release.yml.