Skip to content

Comments

feat(plugin-stylus): compatible with Rsbuild v1#7056

Merged
chenjiahan merged 2 commits intomainfrom
plugin_stylus_0126
Jan 26, 2026
Merged

feat(plugin-stylus): compatible with Rsbuild v1#7056
chenjiahan merged 2 commits intomainfrom
plugin_stylus_0126

Conversation

@chenjiahan
Copy link
Member

Summary

Added support for Rsbuild v1 in @rsbuild/plugin-stylus by detecting the version and mapping rule IDs accordingly, ensuring that Stylus processing works seamlessly across Rsbuild v1 and v2.

Related Links

Checklist

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

Copilot AI review requested due to automatic review settings January 26, 2026 14:35
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@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 backward compatibility for Rsbuild v1 within the @rsbuild/plugin-stylus. It intelligently adapts the internal bundler configuration based on the detected Rsbuild version, allowing the plugin to function correctly in both older and newer environments. This ensures broader usability of the Stylus plugin without requiring separate versions for different Rsbuild major releases.

Highlights

  • Rsbuild v1 Compatibility: The @rsbuild/plugin-stylus now supports Rsbuild v1 by detecting the framework version and dynamically adjusting bundler chain rule IDs, ensuring seamless Stylus processing across v1 and v2.
  • Bundler Chain Rule Refinement: Stylus-specific CHAIN_ID constants (STYLUS_MAIN, STYLUS_RAW, STYLUS_INLINE) have been removed from the core configuration, and the plugin now manages these rules internally with conditional logic for Rsbuild v1.
  • Dependency Updates: The package.json for plugin-stylus now includes @rsbuild/core-v1 as a dev dependency for testing purposes and updates the @rsbuild/core peer dependency to ^1.3.0 || ^2.0.0-0.
  • Testing and Documentation: New test cases have been added to verify the Stylus loader configuration specifically for Rsbuild v1, and the documentation for bundler-chain has been updated to reflect the removal of Stylus-specific ONE_OF rule IDs.
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.

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

The pull request successfully adds compatibility for Rsbuild v1 in the @rsbuild/plugin-stylus by introducing version-aware logic for rule IDs and updating dependencies. The changes are well-implemented and include appropriate test cases and documentation updates. The approach of using a getRule helper function to abstract version-specific rule retrieval is robust and maintains code clarity.

@cloudflare-workers-and-pages
Copy link

Deploying rsbuild with  Cloudflare Pages  Cloudflare Pages

Latest commit: b935357
Status: ✅  Deploy successful!
Preview URL: https://fba4fa9b.rsbuild-v2.pages.dev
Branch Preview URL: https://plugin-stylus-0126.rsbuild-v2.pages.dev

View logs

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

Adds Rsbuild v1 compatibility to @rsbuild/plugin-stylus by detecting the running Rsbuild major version and mapping bundler-chain rule IDs so Stylus handling works across v1 and v2.

Changes:

  • Update plugin-stylus bundler-chain rule wiring to support Rsbuild v1/v2 ID differences.
  • Add Rsbuild v1 test coverage via an aliased @rsbuild/core-v1 devDependency and new snapshots.
  • Update CHAIN_ID docs (EN/ZH) and adjust core CHAIN_ID definitions accordingly.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
website/docs/zh/config/tools/bundler-chain.mdx Updates documented CHAIN_ID.ONE_OF entries (notably removing Stylus oneOf IDs).
website/docs/en/config/tools/bundler-chain.mdx Same as ZH doc update for CHAIN_ID.ONE_OF.
pnpm-lock.yaml Adds lock entries for the aliased @rsbuild/core-v1 dependency.
packages/plugin-stylus/tests/index.test.ts Adds a new test that runs the plugin against Rsbuild v1.
packages/plugin-stylus/tests/snapshots/index.test.ts.snap Updates snapshots and adds a new snapshot for Rsbuild v1 behavior.
packages/plugin-stylus/src/index.ts Implements v1/v2 detection and rule-ID mapping for Stylus rules/branches.
packages/plugin-stylus/package.json Adds @rsbuild/core-v1 devDependency and bumps @rsbuild/core peer range.
packages/core/src/configChain.ts Removes Stylus-specific CHAIN_ID.ONE_OF identifiers from core constants.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

@chenjiahan chenjiahan merged commit 994e61a into main Jan 26, 2026
5 checks passed
@chenjiahan chenjiahan deleted the plugin_stylus_0126 branch January 26, 2026 14:46
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