CodeVetter
← All unpacks
CodeVetter · Repo Unpack evidence

postcss/postcss

Scanned commit 7ac9026649 dated 2026-09-29 — last upstream commit. Generated by codevetter 1.15.0 on 2026-10-02.

github.com/postcss/postcss ↗ · 114 files · 630 KB

PostCSS PostCSS is a tool for transforming styles with JS plugins.

Deep analysis by cli:codex via the codex CLI on 2026-10-02 (369s) — every claim below links to its cited source files. Source inspection; upstream code and tests were not executed.

Overview

PostCSS 8.5.28 is a JavaScript library for developers building CSS transformations, linters, and build-tool integrations. It parses CSS into a mutable, source-aware AST, runs caller-supplied plugins, and emits CSS with optional chained source maps. Its distinctive mechanisms include mutation-aware visitor rescanning, preservation of original formatting, replaceable parsers and stringifiers, and a separate no-plugin processing shortcut. This brief reflects read-only inspection at commit 7ac902664902289ea0cb9d6b1096b81e8d33bbf5.

System map

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.

Feature catalog

The user-facing surface is a JavaScript API for transforming and inspecting CSS. Callers can use plugin processing, direct parsing, programmatic AST construction, custom syntaxes, diagnostics, source maps, and JSON hydration. Ecosystem tools supply features such as prefixing and linting, while external runners supply CLI and build-tool integration. Core features preserve source and formatting information to support those integrations.

Data flow

CSS enters as text or a string-convertible value and gains an Input object that owns original text, source identity, and previous-map information. The parser turns token offsets into AST source positions and retains formatting separately in raws. Plugins mutate the shared tree and append messages to Result, after which a builder emits CSS and optionally source mappings. JSON serialization provides a separate transport boundary; neither that API nor normal output generation writes the resulting artifact to disk.

Behavior traces

The investigation followed initialization, plugin transformation, no-plugin processing, source-map loading/output, and JSON round-tripping through their implementation files. Plugin setup and parsing occur before deferred transformation, so LazyResult is only partly lazy. Sync and async traversal share event semantics but use separate execution loops. Branch conditions matter: no-plugin output, Document hooks, custom stringifiers, and inline maps have different behavior from the ordinary Root transformation path.

Testing signals

Tests and CI were inspected, not executed; no passing result or achieved coverage is asserted. The bounded inspection found uvu unit tests, declaration checks, external parser fixtures, integration testing, and a separate fuzz target. Tests specify important contracts for async ordering, insertion during traversal, deep trees, source-map trust boundaries, and serialization. Coverage configuration excludes a critical map module, and the inspected fuzz harness has limits that prevent treating it as comprehensive validation.

Risk map

These are source observations and explicitly labeled hypotheses, not confirmed vulnerabilities. Sensitive boundaries include annotation-driven filesystem reads, caller-provided executable plugins, HTML embedding, and serialized AST hydration. The implementation contains concrete protections, but their scope and bypass options matter. Testing and documentation also have limits that future work should preserve or examine without assuming whole-repository coverage.

Extension points

The primary extension boundary is the plugin interface, with creators, packs, per-result preparation, filtered visitors, and lifecycle hooks. Parser and stringifier options provide a separate syntax boundary. AST factories and mutation methods allow extensions to construct or move nodes while retaining source information. Messages connect plugins to runners, while internal registration functions wire modules together and should be distinguished from public plugin APIs.

Contributor handoff

Begin with the package contract and trace the affected runtime branch before proposing edits. Preserve source positions, formatting raws, parent ownership, dirty propagation, and mutation-aware iterator behavior together. Tests and CI were inspected, not executed; their existence is not a passing result, and this inventory is bounded rather than exhaustive coverage. Continued work under the current authority must remain read-only, with executable validation deferred to a separately authorized task.

Languages

LanguageFilesShare of source
TypeScript4958%
JavaScript3642%
Markdown16docs/config
YAML4docs/config
JSON3docs/config

Start reading here

Probable source entrypoint: lib/ — inferred from the directory tree and manifest, not the upstream docs.

Source roots

lib/ (52 files)

Source layout — lib/

PathFiles
lib/at-rule.d.ts1
lib/at-rule.js1
lib/comment.d.ts1
lib/comment.js1
lib/container.d.ts1
lib/container.js1
lib/css-syntax-error.d.ts1
lib/css-syntax-error.js1
lib/declaration.d.ts1
lib/declaration.js1
lib/document.d.ts1
lib/document.js1
lib/fromJSON.d.ts1
lib/fromJSON.js1

Repository structure

Top-level pathFiles
lib/52
test/33
docs/13
.github/4

Docs found: README.mddocs/CODE_OF_CONDUCT.mddocs/INCIDENT_RESPONSE.mddocs/README-cn.mddocs/README.mddocs/SECURITY.mddocs/THREAT_MODEL.mddocs/architecture.mddocs/guidelines/plugin.mddocs/guidelines/runner.md

Package

package.json — postcss v8.5.28, 21 declared dependencies.

@logux/eslint-config@logux/oxc-configs@size-limit/preset-small-lib@types/nodec8check-dtsconcat-with-sourcemapseslintmultiocularnanodelaynanoidnanospy

CI & config entrypoints

Structural health signals

Average score 8.6/10 across 59 analyzed source files; 6 hotspots surfaced.

These are deterministic review leads — size, churn, and structural signals — not proof of a bug in this project.

Recent history