1
0
mirror of https://github.com/home-assistant/frontend.git synced 2025-12-24 04:39:01 +00:00

Use SWC for typescript, update to Lit 3, migrate decorators (#25150)

Co-authored-by: Wendelin <w@pe8.at>
This commit is contained in:
Bram Kragten
2025-04-24 14:10:35 +02:00
committed by GitHub
parent c40bf8f3cd
commit e156dd36f4
241 changed files with 1676 additions and 1388 deletions

View File

@@ -73,6 +73,19 @@ module.exports.terserOptions = ({ latestBuild, isTestBuild }) => ({
sourceMap: !isTestBuild,
});
/** @type {import('@rspack/core').SwcLoaderOptions} */
module.exports.swcOptions = ({ latestBuild }) => ({
jsc: {
loose: true,
externalHelpers: true,
target: latestBuild ? "ES2021" : "ES5",
parser: {
syntax: "typescript",
decorators: true,
},
},
});
module.exports.babelOptions = ({
latestBuild,
isProdBuild,
@@ -97,7 +110,6 @@ module.exports.babelOptions = ({
shippedProposals: true,
},
],
"@babel/preset-typescript",
],
plugins: [
[
@@ -134,12 +146,6 @@ module.exports.babelOptions = ({
"@babel/plugin-transform-runtime",
{ version: dependencies["@babel/runtime"] },
],
// Transpile decorators (still in TC39 process)
// Modern browsers support class fields and private methods, but transform is required with the older decorator version dictated by Lit
[
"@babel/plugin-proposal-decorators",
{ version: "2018-09", decoratorsBeforeExport: true },
],
"@babel/plugin-transform-class-properties",
"@babel/plugin-transform-private-methods",
].filter(Boolean),