Skip to content

feat(core): support decorators version 2023-11#7394

Merged
chenjiahan merged 1 commit intomainfrom
codex/feat-decorators-2023-11
Mar 27, 2026
Merged

feat(core): support decorators version 2023-11#7394
chenjiahan merged 1 commit intomainfrom
codex/feat-decorators-2023-11

Conversation

@chenjiahan
Copy link
Copy Markdown
Member

@chenjiahan chenjiahan commented Mar 27, 2026

Summary

This PR adds support for the 2023-11 decorators version in Rsbuild core, keeps Babel and SWC snapshots aligned with the new config, and updates the English and Chinese docs to document the option.

Related Links

Copilot AI review requested due to automatic review settings March 27, 2026 03:12
Copy link
Copy Markdown
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 introduces support for the 2023-11 decorator version, aligning with the November 2023 Stage 3 proposal. The implementation includes updates to the SWC and Babel plugins, type definitions, and documentation in both English and Chinese. Additionally, the @swc/helpers dependency has been upgraded to version 0.5.20, and comprehensive E2E and unit tests have been added. Review feedback identified minor typos in the reference URLs within the documentation that should be corrected to avoid unnecessary redirects.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying rsbuild with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8d1ffbd
Status: ✅  Deploy successful!
Preview URL: https://6d25c047.rsbuild-v2.pages.dev
Branch Preview URL: https://codex-feat-decorators-2023-1.rsbuild-v2.pages.dev

View logs

@chenjiahan chenjiahan merged commit e4e3810 into main Mar 27, 2026
11 checks passed
@chenjiahan chenjiahan deleted the codex/feat-decorators-2023-11 branch March 27, 2026 03:18
Copy link
Copy Markdown
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 a new source.decorators.version: '2023-11' option to Rsbuild, updates SWC/Babel snapshots and E2E coverage, and documents the new option in both English and Chinese docs.

Changes:

  • Extend Decorators.version type and document '2023-11' in EN/ZH docs.
  • Update SWC decorator config wiring and add unit/E2E tests + snapshots for '2023-11'.
  • Bump @swc/helpers and refresh pnpm-lock.yaml snapshots.

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
website/docs/zh/guide/basic/typescript.mdx Mentions '2023-11' as an available decorators version.
website/docs/zh/config/source/decorators.mdx Documents '2023-11' in the decorators config reference (ZH).
website/docs/en/guide/basic/typescript.mdx Mentions '2023-11' as an available decorators version.
website/docs/en/config/source/decorators.mdx Documents '2023-11' in the decorators config reference (EN).
pnpm-lock.yaml Lockfile updates reflecting dependency graph changes (incl. @swc/helpers).
packages/plugin-babel/tests/index.test.ts Adds a snapshot test ensuring Babel is configured for decorators version: '2023-11'.
packages/plugin-babel/tests/snapshots/index.test.ts.snap Snapshot update for Babel decorators '2023-11'.
packages/core/tests/swc.test.ts Adds a snapshot test for SWC config when using decorators '2023-11'.
packages/core/tests/snapshots/swc.test.ts.snap Snapshot update for SWC decorators '2023-11'.
packages/core/src/types/config.ts Extends Decorators.version union to include '2023-11'.
packages/core/src/plugins/swc.ts Updates SWC decorator config application logic for '2023-11'.
packages/core/package.json Bumps @swc/helpers to ^0.5.20.
e2e/cases/syntax-es/decorator-config/index.test.ts Adds E2E cases for '2023-11' (with and without Babel plugin).
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

Comment on lines 314 to +318
case '2022-03':
case '2023-11':
swcConfig.jsc.transform.legacyDecorator = false;
swcConfig.jsc.transform.decoratorVersion = '2022-03';
// TODO `@swc/types` does not include `2023-11` yet.
(swcConfig.jsc.transform.decoratorVersion as string) = version;
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

builtin:swc-loader/SWC does not currently implement a working transform for decoratorVersion: '2023-11' (it can crash when that code path is hit). Setting swcConfig.jsc.transform.decoratorVersion to the user-provided '2023-11' risks breaking builds at runtime.

Suggestion: avoid passing '2023-11' into SWC until it’s supported. Either (a) throw a clear error when source.decorators.version === '2023-11' and SWC is the active transformer, recommending using the Babel plugin for 2023-11, or (b) map '2023-11' to '2022-03' for SWC and warn that semantics may differ.

Copilot uses AI. Check for mistakes.
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.

2 participants