Skip to content

[DO NOT MERGE]replace postcss with css-tree#417

Draft
mizdra wants to merge 1 commit into
mainfrom
refactor/core-css-tree-parser
Draft

[DO NOT MERGE]replace postcss with css-tree#417
mizdra wants to merge 1 commit into
mainfrom
refactor/core-css-tree-parser

Conversation

@mizdra

@mizdra mizdra commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Why

The CSS parser depended on postcss plus three companion libraries (postcss-safe-parser, postcss-selector-parser, postcss-value-parser). Replacing them with css-tree — which provides tolerant parsing, selector/value parsing, and source positions on its own — reduces the dependency count and the supply-chain surface.

What changed

  • @css-modules-kit/core now parses CSS Modules with css-tree instead of postcss.
  • @css-modules-kit/eslint-plugin no longer depends on postcss-safe-parser.
  • Syntax error messages reported during type generation now come from css-tree, so their wording and position can differ from before (for example, for a stray word or a missing colon). Unclosed blocks are still reported.

How to verify

  • vp test — all tests pass.
  • vp check — format, lint, and type checks pass.
  • vp run build — builds successfully.
  • vp run update-generated-in-examples — produces no changes, so the generated .d.ts output is unchanged.

🤖 Generated with Claude Code

… css-tree

The postcss-based parser required three companion libraries (safe-parser,
selector-parser, value-parser). css-tree provides tolerant parsing, selector
and value ASTs, and node positions in a single dependency, reducing the
supply-chain surface.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mizdra mizdra added Type: Dependencies Dependency issues or Changes to dependency files Type: Refactoring A code change that neither fixes a bug nor adds a feature labels Jun 14, 2026
@changeset-bot

changeset-bot Bot commented Jun 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 937b32b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@css-modules-kit/core Patch
@css-modules-kit/ts-plugin Patch
@css-modules-kit/codegen Patch
@css-modules-kit/eslint-plugin Patch
@css-modules-kit/stylelint-plugin Patch
css-modules-kit-vscode Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mizdra mizdra changed the title refactor(core, eslint-plugin, stylelint-plugin): replace postcss with css-tree [DO NOT MERGE]replace postcss with css-tree Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Dependencies Dependency issues or Changes to dependency files Type: Refactoring A code change that neither fixes a bug nor adds a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant