From 215af2c26800aead3ed04fe7562e8b931856d07b Mon Sep 17 00:00:00 2001 From: fire332 <96039230+fire332@users.noreply.github.com> Date: Wed, 18 Dec 2024 03:33:10 -0800 Subject: [PATCH] add typescript support for app code (cherry picked from commit 7952cebde829fbee38c6128b60fa493f5953f7ef) --- babel.config.js | 6 ++++++ package-lock.json | 37 +++++++++++++++++++++++++++++++++++++ package.json | 1 + webpack.config.js | 4 ++-- 4 files changed, 46 insertions(+), 2 deletions(-) diff --git a/babel.config.js b/babel.config.js index 92d98037..7c54fae5 100644 --- a/babel.config.js +++ b/babel.config.js @@ -23,6 +23,12 @@ function makeConfig(api) { noNewArrows: true }, plugins: [ + [ + '@babel/plugin-transform-typescript', + { + strictMode: true + } + ], [ '@babel/plugin-transform-runtime', { diff --git a/package-lock.json b/package-lock.json index 054c0f3c..f427ef3c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,7 @@ "devDependencies": { "@babel/core": "^7.26.0", "@babel/plugin-transform-runtime": "^7.25.9", + "@babel/plugin-transform-typescript": "^7.26.3", "@babel/preset-env": "^7.26.0", "@eslint/js": "^9.17.0", "@stylistic/eslint-plugin": "^2.12.1", @@ -553,6 +554,22 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/plugin-syntax-typescript": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.25.9.tgz", + "integrity": "sha512-hjMgRy5hb8uJJjUcdWunWVcoi9bGpJp8p5Ol1229PoN6aytsLwNMgmdftO23wnCLMfVmTwZDWMPNq/D1SY60JQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/plugin-syntax-unicode-sets-regex": { "version": "7.18.6", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-unicode-sets-regex/-/plugin-syntax-unicode-sets-regex-7.18.6.tgz", @@ -1384,6 +1401,26 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/plugin-transform-typescript": { + "version": "7.26.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.26.3.tgz", + "integrity": "sha512-6+5hpdr6mETwSKjmJUdYw0EIkATiQhnELWlE3kJFBwSg/BGIVwVaVbX+gOXBCdc7Ln1RXZxyWGecIXhUfnl7oA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.25.9", + "@babel/helper-create-class-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9", + "@babel/plugin-syntax-typescript": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/plugin-transform-unicode-escapes": { "version": "7.25.9", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.25.9.tgz", diff --git a/package.json b/package.json index 2e5935b4..4a0cf77b 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "devDependencies": { "@babel/core": "^7.26.0", "@babel/plugin-transform-runtime": "^7.25.9", + "@babel/plugin-transform-typescript": "^7.26.3", "@babel/preset-env": "^7.26.0", "@eslint/js": "^9.17.0", "@stylistic/eslint-plugin": "^2.12.1", diff --git a/webpack.config.js b/webpack.config.js index 4bbbf4f3..bc674c83 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -18,13 +18,13 @@ const makeConfig = () => [ }, resolve: { - extensions: ['.mjs', '.cjs', '.js', '.json'] + extensions: ['.mjs', '.cjs', '.js', '.json', '.ts'] }, module: { rules: [ { - test: /\.[mc]?js$/i, + test: /\.[mc]?[jt]s$/i, loader: 'babel-loader', exclude: [