Skip to content

Commit

Permalink
feat!: decorators version defaults to 2022-03
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan committed Jun 24, 2024
1 parent a2b07b2 commit cc8a80b
Show file tree
Hide file tree
Showing 18 changed files with 204 additions and 252 deletions.
9 changes: 9 additions & 0 deletions e2e/cases/babel/decorator/rsbuild.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from '@rsbuild/core';

export default defineConfig({
source: {
decorators: {
version: 'legacy',
},
},
});
72 changes: 30 additions & 42 deletions packages/compat/plugin-swc/tests/__snapshots__/plugin.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,12 @@ exports[`plugin-swc > should apply source.include and source.exclude correctly 1
},
"preserveAllComments": true,
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
"decoratorVersion": "2022-03",
"legacyDecorator": false,
"react": {
"refresh": true,
"runtime": "classic",
},
"useDefineForClassFields": false,
},
},
},
Expand Down Expand Up @@ -373,13 +372,12 @@ exports[`plugin-swc > should apply source.include and source.exclude correctly 1
},
"preserveAllComments": true,
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
"decoratorVersion": "2022-03",
"legacyDecorator": false,
"react": {
"refresh": true,
"runtime": "classic",
},
"useDefineForClassFields": false,
},
},
},
Expand Down Expand Up @@ -444,13 +442,12 @@ exports[`plugin-swc > should disable react refresh when dev.hmr is false 1`] = `
},
"preserveAllComments": true,
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
"decoratorVersion": "2022-03",
"legacyDecorator": false,
"react": {
"refresh": false,
"runtime": "classic",
},
"useDefineForClassFields": false,
},
},
},
Expand Down Expand Up @@ -504,13 +501,12 @@ exports[`plugin-swc > should disable react refresh when dev.hmr is false 1`] = `
},
"preserveAllComments": true,
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
"decoratorVersion": "2022-03",
"legacyDecorator": false,
"react": {
"refresh": false,
"runtime": "classic",
},
"useDefineForClassFields": false,
},
},
},
Expand Down Expand Up @@ -571,13 +567,12 @@ exports[`plugin-swc > should disable react refresh when target is not web 1`] =
},
"preserveAllComments": true,
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
"decoratorVersion": "2022-03",
"legacyDecorator": false,
"react": {
"refresh": false,
"runtime": "classic",
},
"useDefineForClassFields": false,
},
},
},
Expand Down Expand Up @@ -628,13 +623,12 @@ exports[`plugin-swc > should disable react refresh when target is not web 1`] =
},
"preserveAllComments": true,
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
"decoratorVersion": "2022-03",
"legacyDecorator": false,
"react": {
"refresh": false,
"runtime": "classic",
},
"useDefineForClassFields": false,
},
},
},
Expand Down Expand Up @@ -698,13 +692,12 @@ exports[`plugin-swc > should disable react refresh when target is not web 2`] =
},
"preserveAllComments": true,
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
"decoratorVersion": "2022-03",
"legacyDecorator": false,
"react": {
"refresh": true,
"runtime": "classic",
},
"useDefineForClassFields": false,
},
},
},
Expand Down Expand Up @@ -758,13 +751,12 @@ exports[`plugin-swc > should disable react refresh when target is not web 2`] =
},
"preserveAllComments": true,
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
"decoratorVersion": "2022-03",
"legacyDecorator": false,
"react": {
"refresh": true,
"runtime": "classic",
},
"useDefineForClassFields": false,
},
},
},
Expand Down Expand Up @@ -828,13 +820,12 @@ exports[`plugin-swc > should disable react refresh when target is not web 3`] =
},
"preserveAllComments": true,
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
"decoratorVersion": "2022-03",
"legacyDecorator": false,
"react": {
"refresh": false,
"runtime": "classic",
},
"useDefineForClassFields": false,
},
},
},
Expand Down Expand Up @@ -888,13 +879,12 @@ exports[`plugin-swc > should disable react refresh when target is not web 3`] =
},
"preserveAllComments": true,
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
"decoratorVersion": "2022-03",
"legacyDecorator": false,
"react": {
"refresh": false,
"runtime": "classic",
},
"useDefineForClassFields": false,
},
},
},
Expand Down Expand Up @@ -1011,8 +1001,8 @@ exports[`plugin-swc > should set multiple swc-loader 1`] = `
},
"preserveAllComments": true,
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
"decoratorVersion": "2022-03",
"legacyDecorator": false,
"react": {
"refresh": true,
"runtime": "classic",
Expand Down Expand Up @@ -1063,8 +1053,8 @@ exports[`plugin-swc > should set multiple swc-loader 1`] = `
},
"preserveAllComments": true,
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
"decoratorVersion": "2022-03",
"legacyDecorator": false,
"react": {
"refresh": true,
"runtime": "classic",
Expand Down Expand Up @@ -1123,8 +1113,8 @@ exports[`plugin-swc > should set multiple swc-loader 1`] = `
},
"preserveAllComments": true,
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
"decoratorVersion": "2022-03",
"legacyDecorator": false,
"react": {
"refresh": true,
"runtime": "classic",
Expand Down Expand Up @@ -1219,13 +1209,12 @@ exports[`plugin-swc > should set swc-loader 1`] = `
},
"preserveAllComments": true,
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
"decoratorVersion": "2022-03",
"legacyDecorator": false,
"react": {
"refresh": true,
"runtime": "classic",
},
"useDefineForClassFields": false,
},
},
},
Expand Down Expand Up @@ -1279,13 +1268,12 @@ exports[`plugin-swc > should set swc-loader 1`] = `
},
"preserveAllComments": true,
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
"decoratorVersion": "2022-03",
"legacyDecorator": false,
"react": {
"refresh": true,
"runtime": "classic",
},
"useDefineForClassFields": false,
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const getDefaultSourceConfig = (): NormalizedSourceConfig => ({
aliasStrategy: 'prefer-tsconfig',
preEntry: [],
decorators: {
version: 'legacy',
version: '2022-03',
},
});

Expand Down
10 changes: 4 additions & 6 deletions packages/core/tests/__snapshots__/builder.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,8 @@ exports[`should use rspack as default bundler > apply rspack correctly 1`] = `
},
"preserveAllComments": true,
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
"useDefineForClassFields": false,
"decoratorVersion": "2022-03",
"legacyDecorator": false,
},
},
},
Expand Down Expand Up @@ -178,9 +177,8 @@ exports[`should use rspack as default bundler > apply rspack correctly 1`] = `
},
"preserveAllComments": true,
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
"useDefineForClassFields": false,
"decoratorVersion": "2022-03",
"legacyDecorator": false,
},
},
},
Expand Down
40 changes: 16 additions & 24 deletions packages/core/tests/__snapshots__/default.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,8 @@ exports[`applyDefaultPlugins > should apply default plugins correctly 1`] = `
},
"preserveAllComments": true,
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
"useDefineForClassFields": false,
"decoratorVersion": "2022-03",
"legacyDecorator": false,
},
},
},
Expand Down Expand Up @@ -178,9 +177,8 @@ exports[`applyDefaultPlugins > should apply default plugins correctly 1`] = `
},
"preserveAllComments": true,
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
"useDefineForClassFields": false,
"decoratorVersion": "2022-03",
"legacyDecorator": false,
},
},
},
Expand Down Expand Up @@ -578,9 +576,8 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when prod
},
"preserveAllComments": true,
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
"useDefineForClassFields": false,
"decoratorVersion": "2022-03",
"legacyDecorator": false,
},
},
},
Expand Down Expand Up @@ -625,9 +622,8 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when prod
},
"preserveAllComments": true,
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
"useDefineForClassFields": false,
"decoratorVersion": "2022-03",
"legacyDecorator": false,
},
},
},
Expand Down Expand Up @@ -1052,9 +1048,8 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when targe
},
"preserveAllComments": true,
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
"useDefineForClassFields": false,
"decoratorVersion": "2022-03",
"legacyDecorator": false,
},
},
},
Expand Down Expand Up @@ -1090,9 +1085,8 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when targe
},
"preserveAllComments": true,
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
"useDefineForClassFields": false,
"decoratorVersion": "2022-03",
"legacyDecorator": false,
},
},
},
Expand Down Expand Up @@ -1416,9 +1410,8 @@ exports[`tools.rspack > should match snapshot 1`] = `
},
"preserveAllComments": true,
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
"useDefineForClassFields": false,
"decoratorVersion": "2022-03",
"legacyDecorator": false,
},
},
},
Expand Down Expand Up @@ -1463,9 +1456,8 @@ exports[`tools.rspack > should match snapshot 1`] = `
},
"preserveAllComments": true,
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
"useDefineForClassFields": false,
"decoratorVersion": "2022-03",
"legacyDecorator": false,
},
},
},
Expand Down
Loading

0 comments on commit cc8a80b

Please sign in to comment.