-
-
Notifications
You must be signed in to change notification settings - Fork 249
feat!: convert the built‑in CSS rule to oneOf structure #7037
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Summary of ChangesHello @chenjiahan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a significant refactoring of how CSS and CSS preprocessor (Less, Sass, Stylus) rules are managed within the build system. It transitions from using separate, distinct rules for different CSS variants (like raw, inline, and standard CSS) to a more organized 'oneOf' structure. This change consolidates related rules under a single parent rule, improving clarity and maintainability of the webpack/Rspack configuration. The associated plugins for Less, Sass, and Stylus have been updated to align with this new structure, ensuring consistent handling of their respective file types. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Deploying rsbuild with
|
| Latest commit: |
70f6380
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://e967f78d.rsbuild-v2.pages.dev |
| Branch Preview URL: | https://css-one-of-0125.rsbuild-v2.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 70f638014a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request converts the built-in CSS rule configuration from separate rules to a unified oneOf structure, mirroring the approach taken in PR #7032 for JavaScript rules. The change improves code organization and makes the rule layout more consistent with standard Rspack patterns.
Changes:
- Converted CSS rules from three separate rules (CSS, CSS_INLINE, CSS_RAW) to a single CSS rule with three oneOf branches (CSS_MAIN, CSS_INLINE, CSS_RAW)
- Added new oneOf identifiers in CHAIN_ID for CSS, Less, Sass, and Stylus preprocessors
- Updated all CSS preprocessor plugins (Less, Sass, Stylus) to follow the same oneOf pattern and attach to the corresponding CSS oneOf branches
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/plugins/css.ts | Converted CSS rule to oneOf structure with inline, raw, and main branches; updated updateRules callback parameter names from 'normal'/'inline' to 'main'/'inline' |
| packages/core/src/configChain.ts | Added CSS/Less/Sass/Stylus oneOf identifiers; removed individual rule IDs that are now oneOf branches |
| packages/plugin-less/src/index.ts | Updated to use CSS oneOf structure; creates corresponding Less oneOf branches |
| packages/plugin-sass/src/index.ts | Updated to use CSS oneOf structure; creates corresponding Sass oneOf branches |
| packages/plugin-stylus/src/index.ts | Updated to use CSS oneOf structure; creates corresponding Stylus oneOf branches |
| packages/plugin-less/tests/index.test.ts | Updated test expectations to reflect reduced rule count (from 2 to 1, from 5 to 2) |
| packages/plugin-sass/tests/index.test.ts | Updated test expectations to reflect reduced rule count (from 2 to 1, from 5 to 2) |
| packages/plugin-stylus/tests/index.test.ts | Updated test expectations to reflect reduced rule count (from 2 to 1) |
| packages//tests/snapshots/.snap | Updated snapshots to show new oneOf structure with branches ordered as: inline, raw, main |
| packages/core/tests/snapshots/*.snap | Updated core test snapshots to reflect CSS oneOf structure changes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request refactors the CSS, Less, Sass, and Stylus rule management by migrating from separate top-level rules (e.g., CSS_RAW, CSS_INLINE) to a oneOf structure within a single main rule for each language. This change involves updating the CHAIN_ID definitions to include ONE_OF categories for main, raw, and inline variants. The core CSS plugin (pluginCss.ts) and the Less, Sass, and Stylus plugins are modified to implement this oneOf pattern, where specific loaders and configurations are applied to the respective oneOf branches. Consequently, test snapshots and assertions are updated to reflect the new rule hierarchy, expecting a single main rule with nested oneOf branches rather than multiple distinct rules.
Summary
Related Links
The same as #7032
Checklist