Skip to content

Commit 33a7989

Browse files
authored
chore: switch from Babel to SWC with pnpm patch for stage-3 decorators
1 parent d50adb6 commit 33a7989

5 files changed

Lines changed: 52 additions & 137 deletions

File tree

‎babel.config.js‎

Lines changed: 0 additions & 26 deletions
This file was deleted.

‎package.json‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131
"web-utility": "^4.6.6"
3232
},
3333
"devDependencies": {
34-
"@babel/plugin-proposal-decorators": "^7.29.7",
35-
"@babel/plugin-transform-typescript": "^7.29.7",
36-
"@babel/preset-react": "^7.29.7",
3734
"@biomejs/biome": "^2.5.1",
3835
"@octokit/openapi-types": "^27.0.0",
3936
"@tailwindcss/postcss": "^4.3.1",

‎patches/next@16.2.9.patch‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
diff --git a/dist/build/swc/options.js b/dist/build/swc/options.js
2+
index 8da2935..8e04947 100644
3+
--- a/dist/build/swc/options.js
4+
+++ b/dist/build/swc/options.js
5+
@@ -57,7 +57,7 @@ function getParserOptions({ filename, jsConfig, ...rest }) {
6+
...rest,
7+
syntax: hasTsSyntax ? 'typescript' : 'ecmascript',
8+
dynamicImport: true,
9+
- decorators: enableDecorators,
10+
+ decorators: true,
11+
// Exclude regular TypeScript files from React transformation to prevent e.g. generic parameters and angle-bracket type assertion from being interpreted as JSX tags.
12+
[hasTsSyntax ? 'tsx' : 'jsx']: !isTSFile,
13+
importAssertions: true
14+
@@ -102,6 +102,7 @@ function getBaseSWCOptions({ filename, jest, development, hasReactRefresh, globa
15+
} : {},
16+
legacyDecorator: enableDecorators,
17+
decoratorMetadata: emitDecoratorMetadata,
18+
+ decoratorVersion: "2022-03",
19+
useDefineForClassFields: useDefineForClassFields,
20+
react: {
21+
importSource: (jsConfig == null ? void 0 : (_jsConfig_compilerOptions4 = jsConfig.compilerOptions) == null ? void 0 : _jsConfig_compilerOptions4.jsxImportSource) ?? ((compilerOptions == null ? void 0 : compilerOptions.emotion) && !isReactServerLayer ? '@emotion/react' : 'react'),
22+
diff --git a/dist/esm/build/swc/options.js b/dist/esm/build/swc/options.js
23+
index 6d5922e..fb9b44a 100644
24+
--- a/dist/esm/build/swc/options.js
25+
+++ b/dist/esm/build/swc/options.js
26+
@@ -26,7 +26,7 @@ export function getParserOptions({ filename, jsConfig, ...rest }) {
27+
...rest,
28+
syntax: hasTsSyntax ? 'typescript' : 'ecmascript',
29+
dynamicImport: true,
30+
- decorators: enableDecorators,
31+
+ decorators: true,
32+
// Exclude regular TypeScript files from React transformation to prevent e.g. generic parameters and angle-bracket type assertion from being interpreted as JSX tags.
33+
[hasTsSyntax ? 'tsx' : 'jsx']: !isTSFile,
34+
importAssertions: true
35+
@@ -71,6 +71,7 @@ function getBaseSWCOptions({ filename, jest, development, hasReactRefresh, globa
36+
} : {},
37+
legacyDecorator: enableDecorators,
38+
decoratorMetadata: emitDecoratorMetadata,
39+
+ decoratorVersion: "2022-03",
40+
useDefineForClassFields: useDefineForClassFields,
41+
react: {
42+
importSource: (jsConfig == null ? void 0 : (_jsConfig_compilerOptions4 = jsConfig.compilerOptions) == null ? void 0 : _jsConfig_compilerOptions4.jsxImportSource) ?? ((compilerOptions == null ? void 0 : compilerOptions.emotion) && !isReactServerLayer ? '@emotion/react' : 'react'),

‎pnpm-lock.yaml‎

Lines changed: 8 additions & 108 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pnpm-workspace.yaml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ autoInstallPeers: false
44
overrides:
55
"@types/react": "^19.2.17"
66
"@types/react-dom": "^19.2.3"
7+
patchedDependencies:
8+
next@16.2.9: patches/next@16.2.9.patch
79
allowBuilds:
810
"@biomejs/biome": true
911
"core-js": true

0 commit comments

Comments
 (0)