Skip to content

Feat/postcss values parser 8 - #353

Open
joscha wants to merge 2 commits into
mainfrom
feat/postcss-values-parser-8
Open

joscha wants to merge 2 commits into
mainfrom
feat/postcss-values-parser-8

Conversation

@joscha

@joscha joscha commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

postcss-values-parser 8 is a rewrite on top of css-tree, which tokenizes unquoted url() as a single url token, so unquoted data: URLs no longer throw.

- @import and @value params aren't plain values (media queries, layer(), 'name: value'), so only the relevant component is parsed, split with postcss's list.space()
- url() is now a Word node; detect it via its source text
- wrap values parser errors in MalformedCssError
- add @types/css-tree, which the parser's type definitions need

BREAKING CHANGE: requires Node.js >= 22.12.0 (postcss-values-parser 8 requires Node.js >= 22)

Fixes #351
- Remove unused AtRule type import from postcss
- Combine separate @import and @value rule walkers into single walkAtRules call using regex pattern
- Unify logic for parsing rule params and extracting file references
- Simplify node selection by using array indexing (first for @import, last for @value)
- Remove isImportRule and isValueRule helper functions in favor of inline checks
- Improve code clarity by consolidating duplicate reference detection logic
- Reduce cyclomatic complexity while maintaining feature parity
@@ -0,0 +1,50 @@
import { describe, it, expect } from 'vitest';

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is copied from #352 to prevent regressions

@joscha
joscha requested a review from XhmikosR November 16, 2026 08:01

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant