Skip to content

fix(core): match from / global / as keywords case-insensitively in composes and @value#426

Merged
mizdra merged 1 commit into
mainfrom
fix/case-insensitive-composes-value-keywords
Jul 2, 2026
Merged

fix(core): match from / global / as keywords case-insensitively in composes and @value#426
mizdra merged 1 commit into
mainfrom
fix/case-insensitive-composes-value-keywords

Conversation

@mizdra

@mizdra mizdra commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Fixes #422

Summary

CSS keywords are ASCII case-insensitive, but the from / global keywords in composes and the from / as keywords in @value were compared case-sensitively. As a result, uppercase spellings like composes: foo FROM './x.css' or @value a AS b FROM './x.css' were not recognized as keywords. This PR makes these comparisons case-insensitive, matching how var() references already treat keywords.

Test Plan

$ vp check
$ vp test --project unit

🤖 Generated with Claude Code

… in `composes` and `@value`

CSS keywords are ASCII case-insensitive, but these keywords were
compared case-sensitively, so uppercase spellings like
`composes: foo FROM './x.css'` were not recognized as keywords.

Fixes #422

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mizdra mizdra added the Type: Bug Bug or Bug fixes label Jul 2, 2026
@changeset-bot

changeset-bot Bot commented Jul 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c9ebe58

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the core CSS Modules parsers to treat certain CSS keywords as ASCII case-insensitive, aligning composes and @value parsing behavior with CSS keyword matching expectations and the existing var() handling.

Changes:

  • Make from / global matching in composes case-insensitive.
  • Make from / as matching in @value case-insensitive.
  • Add unit tests and a patch changeset documenting the behavior change.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/core/src/parser/composes-parser.ts Lowercases from/global keyword comparisons while parsing composes.
packages/core/src/parser/composes-parser.test.ts Adds coverage for uppercase FROM and GLOBAL in composes.
packages/core/src/parser/at-value-parser.ts Lowercases from/as keyword comparisons while parsing @value importers.
packages/core/src/parser/at-value-parser.test.ts Adds coverage for uppercase AS/FROM in @value.
.changeset/case-insensitive-keywords.md Records a patch-level release note for the parsing change.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/core/src/parser/at-value-parser.ts
@mizdra mizdra marked this pull request as ready for review July 2, 2026 14:15
@mizdra mizdra merged commit 85196f9 into main Jul 2, 2026
17 checks passed
@mizdra mizdra deleted the fix/case-insensitive-composes-value-keywords branch July 2, 2026 14:15
@github-actions github-actions Bot mentioned this pull request Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Bug Bug or Bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Match from / global / as keywords case-insensitively in composes and @value

2 participants