Skip to content

Conversation

@chenjiahan
Copy link
Member

@chenjiahan chenjiahan commented Jan 25, 2026

Summary

  • Convert the built‑in CSS rule to the oneOf structure
  • Update plugins (Sass/Less/Stylus) to attach to the oneOf branches
  • Add new oneOf IDs and remove outdated IDs

Related Links

The same as #7032

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings January 25, 2026 10:02
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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

  • Refactored CSS Rule Structure: The core CSS rule has been converted to use a 'oneOf' structure, allowing for more organized handling of different CSS variants (main, raw, inline) under a single rule.
  • Consolidated Rule IDs: Several specific CHAIN_ID entries for raw and inline CSS, Less, Sass, and Stylus have been removed, replaced by new ONE_OF IDs that categorize these variants within their respective 'oneOf' branches.
  • Plugin Adaptations: The Less, Sass, and Stylus plugins have been updated to integrate seamlessly with the new 'oneOf' rule structure, ensuring their specific file types are processed correctly within the consolidated CSS handling.
  • Improved Configuration Clarity: This change simplifies the overall bundler configuration by grouping related CSS processing logic, making it easier to understand and extend.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@cloudflare-workers-and-pages
Copy link

Deploying rsbuild with  Cloudflare Pages  Cloudflare Pages

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

View logs

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a 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".

Copy link
Contributor

Copilot AI left a 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.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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.

@chenjiahan chenjiahan merged commit d62944f into main Jan 25, 2026
15 checks passed
@chenjiahan chenjiahan deleted the css_one_of_0125 branch January 25, 2026 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant