From 9ed5e05cb3767f8421516d116abe9e3189f1d207 Mon Sep 17 00:00:00 2001 From: Joachim Viide Date: Wed, 13 Mar 2024 22:52:12 +0000 Subject: [PATCH] build: remove @babel/plugin-transform-typescript patch introduced in #174 The patch is already a part of Babel itself. --- package.json | 3 +- ...__plugin-transform-typescript@7.19.1.patch | 54 ------------------- pnpm-lock.yaml | 8 +-- 3 files changed, 3 insertions(+), 62 deletions(-) delete mode 100644 patches/@babel__plugin-transform-typescript@7.19.1.patch diff --git a/package.json b/package.json index 1ea8b17d0..2f8002272 100644 --- a/package.json +++ b/package.json @@ -104,8 +104,7 @@ }, "pnpm": { "patchedDependencies": { - "microbundle@0.15.1": "patches/microbundle@0.15.1.patch", - "@babel/plugin-transform-typescript@7.19.1": "patches/@babel__plugin-transform-typescript@7.19.1.patch" + "microbundle@0.15.1": "patches/microbundle@0.15.1.patch" }, "overrides": { "socket.io": "~4.7.2" diff --git a/patches/@babel__plugin-transform-typescript@7.19.1.patch b/patches/@babel__plugin-transform-typescript@7.19.1.patch deleted file mode 100644 index 430d58043..000000000 --- a/patches/@babel__plugin-transform-typescript@7.19.1.patch +++ /dev/null @@ -1,54 +0,0 @@ -diff --git a/lib/index.js b/lib/index.js -index 9753d47727d94827bc40a674a721527e50331acd..9c7acc8d88ffd1b588f5c4c9c3a73256892c30dd 100644 ---- a/lib/index.js -+++ b/lib/index.js -@@ -54,6 +54,20 @@ function registerGlobalType(programScope, name) { - GLOBAL_TYPES.get(programScope).add(name); - } - -+// A hack to avoid removing the impl Binding when we remove the declare NodePath -+function safeRemove(path) { -+ const ids = path.getBindingIdentifiers(); -+ for (const name of Object.keys(ids)) { -+ const binding = path.scope.getBinding(name); -+ if (binding && binding.identifier === ids[name]) { -+ binding.scope.removeBinding(name); -+ } -+ } -+ path.opts.noScope = true; -+ path.remove(); -+ path.opts.noScope = false; -+} -+ - var _default = (0, _helperPluginUtils.declare)((api, opts) => { - api.assertVersion(7); - const JSX_PRAGMA_REGEX = /\*?\s*@jsx((?:Frag)?)\s+([^\s]+)/; -@@ -347,16 +361,16 @@ var _default = (0, _helperPluginUtils.declare)((api, opts) => { - }, - - TSDeclareFunction(path) { -- path.remove(); -+ safeRemove(path) - }, - - TSDeclareMethod(path) { -- path.remove(); -+ safeRemove(path) - }, - - VariableDeclaration(path) { - if (path.node.declare) { -- path.remove(); -+ safeRemove(path) - } - }, - -@@ -376,7 +390,7 @@ var _default = (0, _helperPluginUtils.declare)((api, opts) => { - } = path; - - if (node.declare) { -- path.remove(); -+ safeRemove(path) - return; - } - }, \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c755bd6c5..3b28cb964 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,9 +8,6 @@ overrides: socket.io: ~4.7.2 patchedDependencies: - '@babel/plugin-transform-typescript@7.19.1': - hash: tiqrfntt5y3ned567j2lekmz2i - path: patches/@babel__plugin-transform-typescript@7.19.1.patch microbundle@0.15.1: hash: yvstdq4ikeml4yz3a6bi3bgrvu path: patches/microbundle@0.15.1.patch @@ -36,7 +33,7 @@ importers: version: 7.23.4(@babel/core@7.23.3) '@babel/plugin-transform-typescript': specifier: ^7.19.1 - version: 7.19.1(patch_hash=tiqrfntt5y3ned567j2lekmz2i)(@babel/core@7.23.3) + version: 7.19.1(@babel/core@7.23.3) '@babel/preset-env': specifier: ^7.23.3 version: 7.23.3(@babel/core@7.23.3) @@ -1610,7 +1607,7 @@ packages: '@babel/helper-plugin-utils': 7.22.5 dev: true - /@babel/plugin-transform-typescript@7.19.1(patch_hash=tiqrfntt5y3ned567j2lekmz2i)(@babel/core@7.23.3): + /@babel/plugin-transform-typescript@7.19.1(@babel/core@7.23.3): resolution: {integrity: sha512-+ILcOU+6mWLlvCwnL920m2Ow3wWx3Wo8n2t5aROQmV55GZt+hOiLvBaa3DNzRjSEHa1aauRs4/YLmkCfFkhhRQ==} engines: {node: '>=6.9.0'} peerDependencies: @@ -1623,7 +1620,6 @@ packages: transitivePeerDependencies: - supports-color dev: true - patched: true /@babel/plugin-transform-typescript@7.23.4(@babel/core@7.23.3): resolution: {integrity: sha512-39hCCOl+YUAyMOu6B9SmUTiHUU0t/CxJNUmY3qRdJujbqi+lrQcL11ysYUsAvFWPBdhihrv1z0oRG84Yr3dODQ==}