From e83b3c7e68df3c0a82af7568020bbdeba8921a48 Mon Sep 17 00:00:00 2001 From: Billy Tat Date: Mon, 5 Jun 2023 16:28:15 -0700 Subject: [PATCH] Switch to swc-loader --- docusaurus.config.js | 17 +++++++++++ package.json | 4 ++- yarn.lock | 71 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 1 deletion(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index 5a5295790d1..f3b2ca9f31e 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -23,6 +23,23 @@ module.exports = { }, }, }, + webpack: { + jsLoader: (isServer) => ({ + loader: require.resolve('swc-loader'), + options: { + jsc: { + parser: { + syntax: 'typescript', + tsx: true, + }, + target: 'es2017', + }, + module: { + type: isServer ? 'commonjs' : 'es6', + }, + }, + }), + }, themeConfig: { docs: { sidebar: { diff --git a/package.json b/package.json index 1ca0fe6a5fa..736dfa216f7 100644 --- a/package.json +++ b/package.json @@ -18,13 +18,15 @@ "@docusaurus/plugin-client-redirects": "^2.3.1", "@docusaurus/preset-classic": "^2.3.1", "@mdx-js/react": "^1.6.22", + "@swc/core": "^1.3.62", "clsx": "^1.1.1", "prism-react-renderer": "^1.3.3", "react": "^17.0.2", "react-dom": "^17.0.2", "remark-cli": "^11.0.0", "remark-lint-no-dead-urls": "^1.1.0", - "remark-validate-links": "^12.1.0" + "remark-validate-links": "^12.1.0", + "swc-loader": "^0.2.3" }, "devDependencies": { "@docusaurus/module-type-aliases": "^2.3.1" diff --git a/yarn.lock b/yarn.lock index 1f19069a62d..5ae718654f5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1952,6 +1952,72 @@ "@svgr/plugin-jsx" "^6.5.1" "@svgr/plugin-svgo" "^6.5.1" +"@swc/core-darwin-arm64@1.3.62": + version "1.3.62" + resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.62.tgz#dafb50bf784c6b7b40dce6d8cf0605f6729812cb" + integrity sha512-MmGilibITz68LEje6vJlKzc2gUUSgzvB3wGLSjEORikTNeM7P8jXVxE4A8fgZqDeudJUm9HVWrxCV+pHDSwXhA== + +"@swc/core-darwin-x64@1.3.62": + version "1.3.62" + resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.3.62.tgz#324bd144268860338040db64c42c2345fcaaebcf" + integrity sha512-Xl93MMB3sCWVlYWuQIB+v6EQgzoiuQYK5tNt9lsHoIEVu2zLdkQjae+5FUHZb1VYqCXIiWcULFfVz0R4Sjb7JQ== + +"@swc/core-linux-arm-gnueabihf@1.3.62": + version "1.3.62" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.62.tgz#9b5ca188ea3c91827e43e4287bd20ce2a7cb7d81" + integrity sha512-nJsp6O7kCtAjTTMcIjVB0g5y1JNiYAa5q630eiwrnaHUusEFoANDdORI3Z9vXeikMkng+6yIv9/V8Rb093xLjQ== + +"@swc/core-linux-arm64-gnu@1.3.62": + version "1.3.62" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.62.tgz#b208b005223fd9c4c4a12fc0e24070c5e902965f" + integrity sha512-XGsV93vpUAopDt5y6vPwbK1Nc/MlL55L77bAZUPIiosWD1cWWPHNtNSpriE6+I+JiMHe0pqtfS/SSTk6ZkFQVw== + +"@swc/core-linux-arm64-musl@1.3.62": + version "1.3.62" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.62.tgz#bf66add093fa732d3b7f629e00b6ef9bf3c483f2" + integrity sha512-ESUmJjSlTTkoBy9dMG49opcNn8BmviqStMhwyeD1G8XRnmRVCZZgoBOKdvCXmJhw8bQXDhZumeaTUB+OFUKVXg== + +"@swc/core-linux-x64-gnu@1.3.62": + version "1.3.62" + resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.62.tgz#b97eee374986388b71d87c67d7edb8208356dde2" + integrity sha512-wnHJkt3ZBrax3SFnUHDcncG6mrSg9ZZjMhQV9Mc3JL1x1s1Gy9rGZCoBNnV/BUZWTemxIBcQbANRSDut/WO+9A== + +"@swc/core-linux-x64-musl@1.3.62": + version "1.3.62" + resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.62.tgz#548ccdef6d7535ee7fea6ec9488322411f10da1a" + integrity sha512-9oRbuTC/VshB66Rgwi3pTq3sPxSTIb8k9L1vJjES+dDMKa29DAjPtWCXG/pyZ00ufpFZgkGEuAHH5uqUcr1JQg== + +"@swc/core-win32-arm64-msvc@1.3.62": + version "1.3.62" + resolved "https://registry.yarnpkg.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.62.tgz#fc0ca735b23c017fe8ff6f85aa4788ddd1ac583d" + integrity sha512-zv14vlF2VRrxS061XkfzGjCYnOrEo5glKJjLK5PwUKysIoVrx/L8nAbFxjkX5cObdlyoqo+ekelyBPAO+4bS0w== + +"@swc/core-win32-ia32-msvc@1.3.62": + version "1.3.62" + resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.62.tgz#f8dfbb4f0763d2db5ef420b04da3b5cb73897756" + integrity sha512-8MC/PZQSsOP2iA/81tAfNRqMWyEqTS/8zKUI67vPuLvpx6NAjRn3E9qBv7iFqH79iqZNzqSMo3awnLrKZyFbcw== + +"@swc/core-win32-x64-msvc@1.3.62": + version "1.3.62" + resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.62.tgz#e661ec99c5ac91f1cd63c02b5f114f73f55e7b15" + integrity sha512-GJSmUJ95HKHZXAxiuPUmrcm/S3ivQvEzXhOZaIqYBIwUsm02vFZkClsV7eIKzWjso1t0+I/8MjrnUNaSWqh1rQ== + +"@swc/core@^1.3.62": + version "1.3.62" + resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.3.62.tgz#bc93ede0981ee69fe17d753e1d693ce3afa6c16b" + integrity sha512-J58hWY+/G8vOr4J6ZH9hLg0lMSijZtqIIf4HofZezGog/pVX6sJyBJ40dZ1ploFkDIlWTWvJyqtpesBKS73gkQ== + optionalDependencies: + "@swc/core-darwin-arm64" "1.3.62" + "@swc/core-darwin-x64" "1.3.62" + "@swc/core-linux-arm-gnueabihf" "1.3.62" + "@swc/core-linux-arm64-gnu" "1.3.62" + "@swc/core-linux-arm64-musl" "1.3.62" + "@swc/core-linux-x64-gnu" "1.3.62" + "@swc/core-linux-x64-musl" "1.3.62" + "@swc/core-win32-arm64-msvc" "1.3.62" + "@swc/core-win32-ia32-msvc" "1.3.62" + "@swc/core-win32-x64-msvc" "1.3.62" + "@szmarczak/http-timer@^1.1.2": version "1.1.2" resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-1.1.2.tgz#b1665e2c461a2cd92f4c1bbf50d5454de0d4b421" @@ -7747,6 +7813,11 @@ svgo@^2.7.0, svgo@^2.8.0: picocolors "^1.0.0" stable "^0.1.8" +swc-loader@^0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/swc-loader/-/swc-loader-0.2.3.tgz#6792f1c2e4c9ae9bf9b933b3e010210e270c186d" + integrity sha512-D1p6XXURfSPleZZA/Lipb3A8pZ17fP4NObZvFCDjK/OKljroqDpPmsBdTraWhVBqUNpcWBQY1imWdoPScRlQ7A== + tapable@^1.0.0: version "1.1.3" resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2"