Skip to content

Commit

Permalink
Migrate from Babel to SWC (#751)
Browse files Browse the repository at this point in the history
  • Loading branch information
julianweng authored Nov 25, 2024
1 parent 1f7cdfe commit e0fc84f
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 38 deletions.
12 changes: 0 additions & 12 deletions frontend/.babelrc

This file was deleted.

9 changes: 9 additions & 0 deletions frontend/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"jsc": {
"experimental": {
"plugins": [
["swc-plugin-coverage-instrument", {}]
]
}
}
}
4 changes: 2 additions & 2 deletions frontend/components/EventPage/HappeningNow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ const blink = keyframes`
`

const HappeningNowContainer = styled.p<{
urgent?: boolean
$urgent?: boolean
floatRight?: boolean
}>`
font-size: 14px;
font-weight: 500;
${({ floatRight }) => (floatRight ? 'float: right;' : '')}
${({ urgent }) => (urgent ? UrgentText : '')}
${({ $urgent }) => ($urgent ? UrgentText : '')}
`

const HappeningNow = (props: {
Expand Down
3 changes: 3 additions & 0 deletions frontend/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ module.exports = {
})
return config
},
compiler: {
styledComponents: true,
},
async rewrites() {
return [
{
Expand Down
4 changes: 2 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@
"@sentry/browser": "^7.101.1",
"@sentry/node": "^7.101.1",
"@svgr/webpack": "^8.1.0",
"@swc/core": "^1.9.3",
"@types/moment-timezone": "^0.5.30",
"@zeit/next-source-maps": "0.0.4-canary.1",
"babel-loader": "^9.1.3",
"babel-plugin-istanbul": "^6.1.1",
"babel-plugin-styled-components": "^2.1.4",
"babel-preset-next": "^1.2.0",
"body-parser": "^1.20.2",
"body-scroll-lock": "^4.0.0-beta.0",
Expand Down Expand Up @@ -113,6 +112,7 @@
"local-ssl-proxy": "^2.0.5",
"nyc": "^15.0.0",
"prettier": "^3.2.5",
"swc-plugin-coverage-instrument": "^0.0.25",
"typescript": "^5.3.3",
"wait-on": "^7.2.0"
},
Expand Down
114 changes: 92 additions & 22 deletions frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@
dependencies:
"@babel/types" "^7.12.13"

"@babel/helper-module-imports@^7.16.7", "@babel/helper-module-imports@^7.22.15", "@babel/helper-module-imports@^7.22.5":
"@babel/helper-module-imports@^7.16.7", "@babel/helper-module-imports@^7.22.15":
version "7.22.15"
resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz#16146307acdc40cc00c3b2c647713076464bdbf0"
integrity sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==
Expand Down Expand Up @@ -742,7 +742,7 @@
dependencies:
"@babel/helper-plugin-utils" "^7.12.13"

"@babel/plugin-syntax-jsx@^7.22.5", "@babel/plugin-syntax-jsx@^7.23.3":
"@babel/plugin-syntax-jsx@^7.23.3":
version "7.23.3"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.23.3.tgz#8f2e4f8a9b5f9aa16067e142c1ac9cd9f810f473"
integrity sha512-EB2MELswq55OHUoRZLGg/zC7QWUKfNLpE57m/S2yr1uEneIgsTgrSzXP3NXEsMkVn76OlaVVnzN+ugObuYGwhg==
Expand Down Expand Up @@ -3374,13 +3374,94 @@
"@svgr/plugin-jsx" "8.1.0"
"@svgr/plugin-svgo" "8.1.0"

"@swc/[email protected]":
version "1.9.3"
resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.9.3.tgz#cca13f7ce6e1099612a7ba017f4923857d3a4d5f"
integrity sha512-hGfl/KTic/QY4tB9DkTbNuxy5cV4IeejpPD4zo+Lzt4iLlDWIeANL4Fkg67FiVceNJboqg48CUX+APhDHO5G1w==

"@swc/[email protected]":
version "1.9.3"
resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.9.3.tgz#01376c6c2caea5dd0c235f21ebc7e41238153c86"
integrity sha512-IaRq05ZLdtgF5h9CzlcgaNHyg4VXuiStnOFpfNEMuI5fm5afP2S0FHq8WdakUz5WppsbddTdplL+vpeApt/WCQ==

"@swc/[email protected]":
version "1.9.3"
resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.9.3.tgz#4a9705903cebfc8e3e2bee71a42f7c88896e61df"
integrity sha512-Pbwe7xYprj/nEnZrNBvZfjnTxlBIcfApAGdz2EROhjpPj+FBqBa3wOogqbsuGGBdCphf8S+KPprL1z+oDWkmSQ==

"@swc/[email protected]":
version "1.9.3"
resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.9.3.tgz#722aefc00a7abfb031fae7539226c7d7683f5c8d"
integrity sha512-AQ5JZiwNGVV/2K2TVulg0mw/3LYfqpjZO6jDPtR2evNbk9Yt57YsVzS+3vHSlUBQDRV9/jqMuZYVU3P13xrk+g==

"@swc/[email protected]":
version "1.9.3"
resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.9.3.tgz#6643f683311cc1dcee00970e3d6b4872225bdbd8"
integrity sha512-tzVH480RY6RbMl/QRgh5HK3zn1ZTFsThuxDGo6Iuk1MdwIbdFYUY034heWUTI4u3Db97ArKh0hNL0xhO3+PZdg==

"@swc/[email protected]":
version "1.9.3"
resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.9.3.tgz#e6f5cefa244409abe1451fbb4575696a870cbd7a"
integrity sha512-ivXXBRDXDc9k4cdv10R21ccBmGebVOwKXT/UdH1PhxUn9m/h8erAWjz5pcELwjiMf27WokqPgaWVfaclDbgE+w==

"@swc/[email protected]":
version "1.9.3"
resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.9.3.tgz#4d45399f7a01389add61febd02da9b12f16abc81"
integrity sha512-ILsGMgfnOz1HwdDz+ZgEuomIwkP1PHT6maigZxaCIuC6OPEhKE8uYna22uU63XvYcLQvZYDzpR3ms47WQPuNEg==

"@swc/[email protected]":
version "1.9.3"
resolved "https://registry.yarnpkg.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.9.3.tgz#8c352bcea558b9a950877cd724f132d7d51a4d80"
integrity sha512-e+XmltDVIHieUnNJHtspn6B+PCcFOMYXNJB1GqoCcyinkEIQNwC8KtWgMqUucUbEWJkPc35NHy9k8aCXRmw9Kg==

"@swc/[email protected]":
version "1.9.3"
resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.9.3.tgz#656f78b9c56413dbd590ac259dbe0d563cd8e166"
integrity sha512-rqpzNfpAooSL4UfQnHhkW8aL+oyjqJniDP0qwZfGnjDoJSbtPysHg2LpcOBEdSnEH+uIZq6J96qf0ZFD8AGfXA==

"@swc/[email protected]":
version "1.9.3"
resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.9.3.tgz#9595c177d2c11909558da93b18f37e7c5ae1909c"
integrity sha512-3YJJLQ5suIEHEKc1GHtqVq475guiyqisKSoUnoaRtxkDaW5g1yvPt9IoSLOe2mRs7+FFhGGU693RsBUSwOXSdQ==

"@swc/core@^1.9.3":
version "1.9.3"
resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.9.3.tgz#e5bc9b35df2f4a60026c6759c1a6575070339d4f"
integrity sha512-oRj0AFePUhtatX+BscVhnzaAmWjpfAeySpM1TCbxA1rtBDeH/JDhi5yYzAKneDYtVtBvA7ApfeuzhMC9ye4xSg==
dependencies:
"@swc/counter" "^0.1.3"
"@swc/types" "^0.1.17"
optionalDependencies:
"@swc/core-darwin-arm64" "1.9.3"
"@swc/core-darwin-x64" "1.9.3"
"@swc/core-linux-arm-gnueabihf" "1.9.3"
"@swc/core-linux-arm64-gnu" "1.9.3"
"@swc/core-linux-arm64-musl" "1.9.3"
"@swc/core-linux-x64-gnu" "1.9.3"
"@swc/core-linux-x64-musl" "1.9.3"
"@swc/core-win32-arm64-msvc" "1.9.3"
"@swc/core-win32-ia32-msvc" "1.9.3"
"@swc/core-win32-x64-msvc" "1.9.3"

"@swc/counter@^0.1.3":
version "0.1.3"
resolved "https://registry.yarnpkg.com/@swc/counter/-/counter-0.1.3.tgz#cc7463bd02949611c6329596fccd2b0ec782b0e9"
integrity sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==

"@swc/[email protected]":
version "0.5.2"
resolved "https://registry.yarnpkg.com/@swc/helpers/-/helpers-0.5.2.tgz#85ea0c76450b61ad7d10a37050289eded783c27d"
integrity sha512-E4KcWTpoLHqwPHLxidpOqQbcrZVgi0rsmmZXUle1jXmJfuIf/UWpczUJ7MZZ5tlxytgJXyp0w4PGkkeLiuIdZw==
dependencies:
tslib "^2.4.0"

"@swc/types@^0.1.17":
version "0.1.17"
resolved "https://registry.yarnpkg.com/@swc/types/-/types-0.1.17.tgz#bd1d94e73497f27341bf141abdf4c85230d41e7c"
integrity sha512-V5gRru+aD8YVyCOMAjMpWR1Ui577DD5KSJsHP8RAxopAH22jFz6GZd/qxqjO6MJHQhcsjvjOFXyDhyLQUnMveQ==
dependencies:
"@swc/counter" "^0.1.3"

"@tootallnate/once@1":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82"
Expand Down Expand Up @@ -4400,17 +4481,6 @@ babel-plugin-react-require@^3.1.3:
resolved "https://registry.yarnpkg.com/babel-plugin-react-require/-/babel-plugin-react-require-3.1.3.tgz#ba3d7305b044a90c35c32c5a9ab943fd68e1638d"
integrity sha512-kDXhW2iPTL81x4Ye2aUMdEXQ56JP0sBJmRQRXJPH5FsNB7fOc/YCsHTqHv8IovPyw9Rk07gdd7MVUz8tUmRBCA==

babel-plugin-styled-components@^2.1.4:
version "2.1.4"
resolved "https://registry.yarnpkg.com/babel-plugin-styled-components/-/babel-plugin-styled-components-2.1.4.tgz#9a1f37c7f32ef927b4b008b529feb4a2c82b1092"
integrity sha512-Xgp9g+A/cG47sUyRwwYxGM4bR/jDRg5N6it/8+HxCnbT5XNKSKDT9xm4oag/osgqjC2It/vH0yXsomOG6k558g==
dependencies:
"@babel/helper-annotate-as-pure" "^7.22.5"
"@babel/helper-module-imports" "^7.22.5"
"@babel/plugin-syntax-jsx" "^7.22.5"
lodash "^4.17.21"
picomatch "^2.3.1"

babel-preset-next@^1.2.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/babel-preset-next/-/babel-preset-next-1.4.0.tgz#6f20007befb6d888be315a64d772e0d7101b71ca"
Expand Down Expand Up @@ -4662,15 +4732,10 @@ camelize@^1.0.0:
resolved "https://registry.yarnpkg.com/camelize/-/camelize-1.0.0.tgz#164a5483e630fa4321e5af07020e531831b2609b"
integrity sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs=

caniuse-lite@^1.0.30001181:
version "1.0.30001192"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001192.tgz#b848ebc0ab230cf313d194a4775a30155d50ae40"
integrity sha512-63OrUnwJj5T1rUmoyqYTdRWBqFFxZFlyZnRRjDR8NSUQFB6A+j/uBORU/SyJ5WzDLg4SPiZH40hQCBNdZ/jmAw==

caniuse-lite@^1.0.30001579, caniuse-lite@^1.0.30001587:
version "1.0.30001588"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001588.tgz#07f16b65a7f95dba82377096923947fb25bce6e3"
integrity sha512-+hVY9jE44uKLkH0SrUTqxjxqNTOWHsbnQDIKjwkZ3lNTzUUVdBLBGXtj/q5Mp5u98r3droaZAewQuEDzjQdZlQ==
caniuse-lite@^1.0.30001181, caniuse-lite@^1.0.30001579, caniuse-lite@^1.0.30001587:
version "1.0.30001683"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001683.tgz"
integrity sha512-iqmNnThZ0n70mNwvxpEC2nBJ037ZHZUoBI5Gorh1Mw6IlEAZujEoU1tXA628iZfzm7R9FvFzxbfdgml82a3k8Q==

caseless@~0.12.0:
version "0.12.0"
Expand Down Expand Up @@ -10101,6 +10166,11 @@ svgo@^3.0.2:
csso "^5.0.5"
picocolors "^1.0.0"

swc-plugin-coverage-instrument@^0.0.25:
version "0.0.25"
resolved "https://registry.yarnpkg.com/swc-plugin-coverage-instrument/-/swc-plugin-coverage-instrument-0.0.25.tgz#111fdca889029eaa9104a62714c4fdd88d35da60"
integrity sha512-7watbzeySulr+7o3NbSaD2icOmEYBKf1uUQs2sBYv1cdWHEsUQETxI/CpXn+Q53vaBU0e3puWPO99OW3DVq34g==

swiper@^11.1.12:
version "11.1.12"
resolved "https://registry.yarnpkg.com/swiper/-/swiper-11.1.12.tgz#563b90dd0162925025878c2ec4e136cc46bcb4f4"
Expand Down

0 comments on commit e0fc84f

Please sign in to comment.