Skip to content

Commit cd2371d

Browse files
committed
[migrate] replace Babel with patched Next.js SWC to compile ES decorator stage-3
[optimize] upgrade Upstream packages
1 parent 1713bdf commit cd2371d

7 files changed

Lines changed: 538 additions & 691 deletions

File tree

babel.config.js

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

package.json

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
},
1515
"dependencies": {
1616
"@giscus/react": "^3.1.0",
17-
"@koa/router": "^15.6.0",
17+
"@koa/router": "^15.7.0",
1818
"@mdx-js/loader": "^3.1.1",
1919
"@mdx-js/react": "^3.1.1",
20-
"@next/mdx": "^16.2.9",
20+
"@next/mdx": "16.2.10",
2121
"core-js": "^3.49.0",
2222
"echarts-jsx": "^0.6.0",
2323
"file-type": "^22.0.1",
@@ -27,70 +27,72 @@
2727
"koa-jwt": "^4.0.4",
2828
"koajax": "^3.3.0",
2929
"license-filter": "^0.2.5",
30-
"marked": "^18.0.5",
30+
"marked": "^18.0.6",
3131
"mime": "^4.1.0",
3232
"mobx": "^6.16.1",
3333
"mobx-github": "^0.6.2",
34-
"mobx-i18n": "^0.7.2",
35-
"mobx-lark": "^2.8.1",
34+
"mobx-i18n": "^0.7.5",
35+
"mobx-lark": "^2.10.0",
3636
"mobx-react": "^9.2.2",
3737
"mobx-react-helper": "^0.5.1",
3838
"mobx-restful": "^2.1.4",
3939
"mobx-restful-table": "^2.6.3",
4040
"mobx-strapi": "^0.8.1",
41-
"next": "^16.2.9",
41+
"next": "16.2.10",
4242
"next-pwa": "^5.6.0",
4343
"next-ssr-middleware": "^1.1.0",
44-
"nodemailer": "^9.0.0",
44+
"nodemailer": "^9.0.3",
4545
"open-react-map": "^0.9.1",
4646
"react": "^19.2.7",
4747
"react-bootstrap": "^2.10.10",
4848
"react-dom": "^19.2.7",
4949
"react-typed-component": "^1.0.6",
5050
"remark-frontmatter": "^5.0.0",
5151
"remark-mdx-frontmatter": "^5.2.0",
52-
"web-utility": "^4.6.6",
52+
"web-utility": "^4.7.2",
5353
"yaml": "^2.9.0"
5454
},
5555
"devDependencies": {
56-
"@babel/plugin-proposal-decorators": "^7.29.7",
57-
"@babel/plugin-transform-typescript": "^7.29.7",
58-
"@babel/preset-react": "^7.29.7",
5956
"@cspell/eslint-plugin": "^10.0.1",
6057
"@eslint/js": "^10.0.1",
61-
"@next/eslint-plugin-next": "^16.2.9",
58+
"@next/eslint-plugin-next": "16.2.10",
6259
"@softonus/prettier-plugin-duplicate-remover": "^1.1.2",
6360
"@stylistic/eslint-plugin": "^5.10.0",
6461
"@types/eslint-config-prettier": "^6.11.3",
6562
"@types/jsonwebtoken": "^9.0.10",
6663
"@types/koa": "^3.0.3",
6764
"@types/next-pwa": "^5.6.9",
68-
"@types/node": "^24.13.2",
65+
"@types/node": "^24.13.3",
6966
"@types/nodemailer": "^8.0.1",
7067
"@types/react": "^19.2.17",
7168
"@types/react-dom": "^19.2.3",
72-
"eslint": "^10.5.0",
73-
"eslint-config-next": "^16.2.9",
69+
"eslint": "^10.7.0",
70+
"eslint-config-next": "16.2.10",
7471
"eslint-config-prettier": "^10.1.8",
7572
"eslint-plugin-react": "^7.37.5",
7673
"eslint-plugin-simple-import-sort": "^13.0.0",
77-
"globals": "^17.6.0",
74+
"globals": "^17.7.0",
7875
"husky": "^9.1.7",
7976
"jiti": "^2.7.0",
80-
"less": "^4.6.5",
77+
"less": "^4.6.7",
8178
"less-loader": "^13.0.0",
82-
"lint-staged": "^17.0.7",
79+
"lint-staged": "^17.0.8",
8380
"next-with-less": "^3.0.1",
84-
"prettier": "^3.8.4",
81+
"prettier": "^3.9.5",
8582
"prettier-plugin-css-order": "^2.2.0",
8683
"sass": "^1.101.0",
8784
"typescript": "~5.9.3",
88-
"typescript-eslint": "^8.61.0"
85+
"typescript-eslint": "^8.63.0"
8986
},
9087
"resolutions": {
9188
"mobx-react-helper": "$mobx-react-helper",
9289
"next": "$next"
9390
},
91+
"pnpm": {
92+
"patchedDependencies": {
93+
"next@16.2.10": "patches/next@16.2.10.patch"
94+
}
95+
},
9496
"prettier": {
9597
"singleQuote": true,
9698
"trailingComma": "all",

pages/policy/[...slug].tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import 'core-js/stable/typed-array/from-base64';
2+
13
import { marked } from 'marked';
24
import { observer } from 'mobx-react';
35
import { BadgeBar } from 'mobx-restful-table';

pages/recipe/[...slug].tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import 'core-js/stable/typed-array/from-base64';
2+
13
import { marked } from 'marked';
24
import { observer } from 'mobx-react';
35
import { BadgeBar } from 'mobx-restful-table';

patches/next@16.2.10.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 8da2935285177960b5ae8b89070979d720ad15af..305dbb07c625b1afd7cb37bbcc2b51f7d14715dd 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 6d5922e81ec99e3f89028bcad957492994b02d77..ccc298359e6d252dde631e0179b2fd511d89385f 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'),

0 commit comments

Comments
 (0)