fix(core): match from / global / as keywords case-insensitively in composes and @value#426
Merged
Merged
Conversation
… 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>
🦋 Changeset detectedLatest commit: c9ebe58 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
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 |
There was a problem hiding this comment.
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/globalmatching incomposescase-insensitive. - Make
from/asmatching in@valuecase-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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #422
Summary
CSS keywords are ASCII case-insensitive, but the
from/globalkeywords incomposesand thefrom/askeywords in@valuewere compared case-sensitively. As a result, uppercase spellings likecomposes: 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 howvar()references already treat keywords.Test Plan
🤖 Generated with Claude Code