Skip to content

feat: support Rsbuild v2 - #5

Merged
fi3ework merged 4 commits into
rstackjs:mainfrom
Timeless0911:codex/rsbuild-v2-compat
Mar 17, 2026
Merged

fi3ework merged 4 commits into
rstackjs:mainfrom
Timeless0911:codex/rsbuild-v2-compat

Conversation

@Timeless0911

Copy link
Copy Markdown
Member

Summary

  • add Rsbuild v2 compatibility for style rule handling while keeping v1 behavior working
  • update peer/dev dependencies for Rsbuild v2 and add a separate Rsbuild v1 test entry
  • upgrade Rslib to the latest stable version and adapt the Rslib test to the new API/output

Testing

  • pnpm lint
  • pnpm exec playwright test test/rsbuild/rsbuild.test.ts --reporter=line
  • pnpm exec playwright test test/rsbuild/rsbuild.v1.test.ts --reporter=line
  • pnpm exec playwright test test/rslib/index.test.ts --reporter=line

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello, 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 significant updates to ensure the project's compatibility with the latest versions of Rsbuild and Rslib. The core changes revolve around adapting the style rule processing logic to accommodate Rsbuild v2's new internal structure, while also performing a comprehensive update of project dependencies. A key aspect of this work is the enhancement of the testing framework to provide separate validation paths for different Rsbuild versions, thereby guaranteeing backward compatibility and forward-looking support.

Highlights

  • Rsbuild v2 Compatibility: Implemented support for Rsbuild v2, specifically adapting style rule handling to its new architecture while maintaining compatibility with Rsbuild v1 behavior.
  • Dependency Updates: Upgraded various development and peer dependencies, including @rsbuild/core to its v2 beta, @rslib/core to its latest stable version, and other related packages like Playwright and TypeScript.
  • Enhanced Testing Infrastructure: Refactored the testing suite to include dedicated test entries and helper functions for both Rsbuild v1 and v2, ensuring robust validation of compatibility and new features. The Rslib test has also been updated to align with its new API and expected output.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • .gitignore
    • Added dist-*/ to the ignore list to exclude new distribution directories.
  • package.json
    • Updated various development dependencies, including @playwright/test, @rsbuild/core, @rslib/core, @types/node, playwright, simple-git-hooks, typescript, and vue.
    • Introduced @rsbuild/core-v1 as an alias for @rsbuild/core@^1.7.3 to facilitate testing of the previous version.
    • Modified peerDependencies for @rsbuild/core to support both v1 and v2 versions.
  • pnpm-lock.yaml
    • Updated numerous dependency versions and added new entries to reflect changes in package.json and transitive dependencies across the project.
  • src/index.ts
    • Added a new helper function getStyleRuleBranchIds to derive rule branch IDs.
    • Introduced logic to detect Rsbuild v1 based on api.context.version.
    • Modified the style rule enforcement mechanism to apply enforce('post') directly to the base rule for Rsbuild v1, and to iterate through specific oneOf branches for Rsbuild v2.
  • test/rsbuild/helper.ts
    • Removed the helper.ts file, as its functionality was integrated into a new test helper.
  • test/rsbuild/index.test.ts
    • Removed the index.test.ts file, replaced by new, version-specific test files.
  • test/rsbuild/rsbuild-test-helper.ts
    • Added a new helper file rsbuild-test-helper.ts containing shared utilities for Rsbuild tests, including getRandomPort, createRsbuildInstance, runRsbuildDevServerTest, and runRsbuildBuildTest to support both Rsbuild v1 and v2 testing scenarios.
  • test/rsbuild/rsbuild.test.ts
    • Added a new test file rsbuild.test.ts to specifically run tests against Rsbuild v2 using the new test helper functions.
  • test/rsbuild/rsbuild.v1.test.ts
    • Added a new test file rsbuild.v1.test.ts to specifically run tests against Rsbuild v1, ensuring backward compatibility with the new test helper functions.
  • test/rslib/index.test.ts
    • Updated the Rslib build process to use the new createRslib API.
    • Adjusted the expected output files to include rslib-runtime.js.
Activity
  • The author, Timeless0911, created this pull request to add support for Rsbuild v2 and update related dependencies. No further activity has been recorded yet.
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. ↩

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6ac7ae3c92

ℹ️ 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".

Comment thread src/index.ts Resolved

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request successfully adds compatibility for Rsbuild v2 while maintaining support for v1. The approach of using version detection to apply conditional logic for style rules is clean. I particularly appreciate the refactoring of the test suite to validate both v1 and v2 behavior, which significantly improves the project's maintainability. The code is well-structured, and I have one suggestion to improve the reliability of the test setup.

Comment thread test/rsbuild/rsbuild-test-helper.ts Resolved
@fi3ework
fi3ework merged commit 5324660 into rstackjs:main Mar 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants