# Data flow — postcss/postcss

> Canonical page: https://codevetter.com/unpack/postcss/data-flow

# Data flow — postcss/postcss

Scanned commit 7ac902664902289ea0cb9d6b1096b81e8d33bbf5 (2026-09-29). Generated by codevetter codevetter 1.15.0 on 2026-10-02.

Source inspection; upstream code and tests were not executed.

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.
- Input rejects null, undefined, and objects without toString, converts accepted input to text, strips an initial BOM, and keeps opts.document separately from the parsed CSS. — [lib/input.js#L37-56](https://github.com/postcss/postcss/blob/7ac902664902289ea0cb9d6b1096b81e8d33bbf5/lib/input.js#L37-L56)
- Input resolves relative from paths, preserves absolute paths and URL-like identifiers, loads PreviousMap when supported, and assigns a non-secure nanoid-based diagnostic ID when no file identity exists. — [lib/input.js#L3-6](https://github.com/postcss/postcss/blob/7ac902664902289ea0cb9d6b1096b81e8d33bbf5/lib/input.js#L3-L6) [lib/input.js#L58-82](https://github.com/postcss/postcss/blob/7ac902664902289ea0cb9d6b1096b81e8d33bbf5/lib/input.js#L58-L82)
- Tokenizer emits token arrays containing text and offsets; Parser.init attaches a shared Input and start position, while declaration parsing records an exclusive end offset. — [lib/tokenize.js#L84-93](https://github.com/postcss/postcss/blob/7ac902664902289ea0cb9d6b1096b81e8d33bbf5/lib/tokenize.js#L84-L93) [lib/tokenize.js#L247-257](https://github.com/postcss/postcss/blob/7ac902664902289ea0cb9d6b1096b81e8d33bbf5/lib/tokenize.js#L247-L257) [lib/parser.js#L202-215](https://github.com/postcss/postcss/blob/7ac902664902289ea0cb9d6b1096b81e8d33bbf5/lib/parser.js#L202-L215) [lib/parser.js#L377-385](https://github.com/postcss/postcss/blob/7ac902664902289ea0cb9d6b1096b81e8d33bbf5/lib/parser.js#L377-L385)
- Parser.raw separates cleaned selector/value/parameter text from its original token spelling; Stringifier.rawValue reuses that spelling only while the semantic value still matches. — [lib/parser.js#L493-530](https://github.com/postcss/postcss/blob/7ac902664902289ea0cb9d6b1096b81e8d33bbf5/lib/parser.js#L493-L530) [lib/stringifier.js#L413-420](https://github.com/postcss/postcss/blob/7ac902664902289ea0cb9d6b1096b81e8d33bbf5/lib/stringifier.js#L413-L420)
- LazyResult accepts existing Root/Document trees or previous Result/LazyResult objects without reparsing; it clears cleanliness markers and carries a previous result's map into opts.map.prev. — [lib/lazy-result.js#L99-108](https://github.com/postcss/postcss/blob/7ac902664902289ea0cb9d6b1096b81e8d33bbf5/lib/lazy-result.js#L99-L108) [lib/lazy-result.js#L146-163](https://github.com/postcss/postcss/blob/7ac902664902289ea0cb9d6b1096b81e8d33bbf5/lib/lazy-result.js#L146-L163)
- Visitor callbacks receive helpers containing the public API and current Result; proxies mark selected property changes dirty, and markDirty propagates invalidation through ancestors. — [lib/lazy-result.js#L183-191](https://github.com/postcss/postcss/blob/7ac902664902289ea0cb9d6b1096b81e8d33bbf5/lib/lazy-result.js#L183-L191) [lib/lazy-result.js#L489-500](https://github.com/postcss/postcss/blob/7ac902664902289ea0cb9d6b1096b81e8d33bbf5/lib/lazy-result.js#L489-L500) [lib/node.js#L188-219](https://github.com/postcss/postcss/blob/7ac902664902289ea0cb9d6b1096b81e8d33bbf5/lib/node.js#L188-L219) [lib/container.js#L143-149](https://github.com/postcss/postcss/blob/7ac902664902289ea0cb9d6b1096b81e8d33bbf5/lib/container.js#L143-L149)
- Serialization either concatenates builder chunks directly or lets MapGenerator track generated positions, attach source mappings, compose previous maps, and return CSS with an optional external map; the documented caller writes files. — [lib/lazy-result.js#L374-405](https://github.com/postcss/postcss/blob/7ac902664902289ea0cb9d6b1096b81e8d33bbf5/lib/lazy-result.js#L374-L405) [lib/map-generator.js#L144-178](https://github.com/postcss/postcss/blob/7ac902664902289ea0cb9d6b1096b81e8d33bbf5/lib/map-generator.js#L144-L178) [lib/map-generator.js#L133-140](https://github.com/postcss/postcss/blob/7ac902664902289ea0cb9d6b1096b81e8d33bbf5/lib/map-generator.js#L133-L140) [README.md#L379-386](https://github.com/postcss/postcss/blob/7ac902664902289ea0cb9d6b1096b81e8d33bbf5/README.md#L379-L386)
- Node.toJSON omits parent/proxy links and deduplicates Inputs using inputId; fromJSON restores Input/PreviousMap prototypes, resolves input references, constructs nodes bottom-up, and reconnects child.parent without spacing normalization. — [lib/node.js#L415-465](https://github.com/postcss/postcss/blob/7ac902664902289ea0cb9d6b1096b81e8d33bbf5/lib/node.js#L415-L465) [lib/fromJSON.js#L11-34](https://github.com/postcss/postcss/blob/7ac902664902289ea0cb9d6b1096b81e8d33bbf5/lib/fromJSON.js#L11-L34) [lib/fromJSON.js#L52-58](https://github.com/postcss/postcss/blob/7ac902664902289ea0cb9d6b1096b81e8d33bbf5/lib/fromJSON.js#L52-L58) [lib/fromJSON.js#L63-103](https://github.com/postcss/postcss/blob/7ac902664902289ea0cb9d6b1096b81e8d33bbf5/lib/fromJSON.js#L63-L103)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
