From 3fe3327270f9e8235ad9bb651b503aa8af7ea0a9 Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Tue, 19 May 2026 11:12:52 +0100 Subject: [PATCH 1/2] chore: Modernize TypeScript configuration --- package.json | 5 ++--- rollup.config.mjs | 13 +++++++++---- src/main/utility-processes.ts | 10 ++++++---- src/renderer/ipc.ts | 13 ++++++++++++- src/utility/transport.ts | 10 ++++++---- tsconfig.build.json | 17 ----------------- tsconfig.json | 19 ++++++++++++++----- tsconfig.preload.json | 9 --------- tsconfig.test.json | 8 -------- yarn.lock | 13 ++++--------- 10 files changed, 53 insertions(+), 64 deletions(-) delete mode 100644 tsconfig.build.json delete mode 100644 tsconfig.preload.json delete mode 100644 tsconfig.test.json diff --git a/package.json b/package.json index 6a6ad3dd1..6871e2000 100644 --- a/package.json +++ b/package.json @@ -119,7 +119,6 @@ }, "devDependencies": { "@rollup/plugin-typescript": "^12.1.3", - "@sentry-internal/typescript": "10.53.1", "@sentry-internal/eslint-plugin-sdk": "10.53.1", "@sentry/node-native": "10.53.1", "@types/busboy": "^1.5.4", @@ -139,7 +138,7 @@ "rollup": "^4.44.1", "tmp": "^0.2.1", "tslib": "^2.8.1", - "typescript": "~5.0.0", + "typescript": "^6.0.0", "vitest": "^4.0.18", "xvfb-maybe": "^0.2.1", "yaml": "^2.2.1" @@ -148,4 +147,4 @@ "node": "22.19.0", "yarn": "1.22.22" } -} \ No newline at end of file +} diff --git a/rollup.config.mjs b/rollup.config.mjs index ff2f0e600..c2701b74d 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -44,9 +44,11 @@ function transpileFiles(format, input, outDir) { treeshake: { moduleSideEffects: false }, plugins: [ typescript({ + compilerOptions: { + outDir, + rootDir: 'src', + }, outDir, - tsconfig: './tsconfig.build.json', - noEmitOnError: true, }), format === 'esm' ? modulePackageJson : {}, ], @@ -64,8 +66,11 @@ function bundlePreload(format, input, output) { }, plugins: [ typescript({ - tsconfig: './tsconfig.preload.json', - noEmitOnError: true, + compilerOptions: { + declaration: false, + declarationMap: false, + rootDir: 'src', + }, }), ], external, diff --git a/src/main/utility-processes.ts b/src/main/utility-processes.ts index 5b047a502..f70cb306a 100644 --- a/src/main/utility-processes.ts +++ b/src/main/utility-processes.ts @@ -52,10 +52,12 @@ export function configureUtilityProcessIPC(): void { // We proxy child.on so we can filter messages from the child SDK and ensure that users do not see them // eslint-disable-next-line typescript/unbound-method child.on = new Proxy(child.on, { - apply: (target, thisArg, [event, listener]) => { + apply: (target, thisArg, args: [string, (message: unknown) => unknown]) => { + const [event, listener] = args; + if (event === 'message') { - return target.apply(thisArg, [ - 'message', + return Reflect.apply(target, thisArg, [ + event, (msg: unknown) => { if (isMagicMessage(msg)) { return; @@ -66,7 +68,7 @@ export function configureUtilityProcessIPC(): void { ]); } - return target.apply(thisArg, [event, listener]); + return Reflect.apply(target, thisArg, args); }, }); diff --git a/src/renderer/ipc.ts b/src/renderer/ipc.ts index f586d32b9..6fc60e650 100644 --- a/src/renderer/ipc.ts +++ b/src/renderer/ipc.ts @@ -36,7 +36,18 @@ function getImplementation(ipcKey: string): IPCInterface { }); }, sendEnvelope: (body: string | Uint8Array) => { - fetch(ipcUtil.createUrl('envelope'), { method: 'POST', body, headers }).catch(() => { + const requestBody = + typeof body === 'string' + ? body + : body.buffer instanceof ArrayBuffer + ? body.buffer.slice(body.byteOffset, body.byteOffset + body.byteLength) + : Uint8Array.from(body).buffer; + + fetch(ipcUtil.createUrl('envelope'), { + method: 'POST', + body: requestBody, + headers, + }).catch(() => { // ignore }); }, diff --git a/src/utility/transport.ts b/src/utility/transport.ts index 072ac4e24..53f4ff3d2 100644 --- a/src/utility/transport.ts +++ b/src/utility/transport.ts @@ -37,11 +37,13 @@ export function makeUtilityProcessTransport(): (options: BaseTransportOptions) = // We proxy `process.parentPort.on` so we can filter messages from the main SDK and ensure that users do not see them // eslint-disable-next-line typescript/unbound-method process.parentPort.on = new Proxy(process.parentPort.on, { - apply: (target, thisArg, [event, listener]) => { + apply: (target, thisArg, args: Parameters) => { + const [event, listener] = args; + if (event === 'message') { return target.apply(thisArg, [ - 'message', - (msg: MessageEvent) => { + event, + (msg) => { if (isMagicMessage(msg.data)) { return; } @@ -51,7 +53,7 @@ export function makeUtilityProcessTransport(): (options: BaseTransportOptions) = ]); } - return target.apply(thisArg, [event, listener]); + return target.apply(thisArg, args); }, }); diff --git a/tsconfig.build.json b/tsconfig.build.json deleted file mode 100644 index 2da4a62dc..000000000 --- a/tsconfig.build.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "./node_modules/@sentry-internal/typescript/tsconfig.json", - "include": ["src/**/*.ts"], - "exclude": ["node_modules"], - "compilerOptions": { - "skipLibCheck": true, - "baseUrl": ".", - "lib": ["ES2020", "DOM"], - "module": "ESNext", - "outDir": ".", - "rootDir": "src", - "target": "ES2020", - "esModuleInterop": true, - "ignoreDeprecations": "5.0", - "moduleResolution": "node16" - } -} diff --git a/tsconfig.json b/tsconfig.json index 55a98f1ec..9df7e0a10 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,8 +1,17 @@ { - "extends": "./tsconfig.build.json", - "include": ["src/**/*.ts", "test/**/*.ts"], - "exclude": ["node_modules"], "compilerOptions": { - "rootDir": "." - } + "target": "ES2020", + "lib": ["ES2020", "DOM"], + "module": "ESNext", + "moduleResolution": "Bundler", + "strict": true, + "noUncheckedIndexedAccess": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "declaration": true, + "declarationMap": true, + "sourceMap": true + }, + "include": ["src/**/*.ts", "test/**/*.ts"], + "exclude": ["node_modules"] } diff --git a/tsconfig.preload.json b/tsconfig.preload.json deleted file mode 100644 index 067a5bbd1..000000000 --- a/tsconfig.preload.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig.build.json", - "include": ["src/preload/**/*.ts"], - "exclude": ["node_modules"], - "compilerOptions": { - "declaration": false, - "declarationMap": false - } -} diff --git a/tsconfig.test.json b/tsconfig.test.json deleted file mode 100644 index 55a98f1ec..000000000 --- a/tsconfig.test.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "./tsconfig.build.json", - "include": ["src/**/*.ts", "test/**/*.ts"], - "exclude": ["node_modules"], - "compilerOptions": { - "rootDir": "." - } -} diff --git a/yarn.lock b/yarn.lock index 42e852b81..7bee39a8b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -805,11 +805,6 @@ "@sentry-internal/browser-utils" "10.53.1" "@sentry/core" "10.53.1" -"@sentry-internal/typescript@10.53.1": - version "10.53.1" - resolved "https://registry.yarnpkg.com/@sentry-internal/typescript/-/typescript-10.53.1.tgz#216b3e3ec0d5aa7ef3e7055ea50d6371d9786cce" - integrity sha512-7ncY4Ww9MsTf5lsX9qAUaiNeQdKNBeZm7rtFze0UeU8fTLxOKx9ink4jCFa1xB/sztIR1pq/rGmnBs7evvn+aw== - "@sentry/browser@10.53.1": version "10.53.1" resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-10.53.1.tgz#db8dbbf4fc752acec9fec5073a7105a2b0f58f97" @@ -2694,10 +2689,10 @@ type-is@^2.0.1: media-typer "^1.1.0" mime-types "^3.0.0" -typescript@~5.0.0: - version "5.0.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b" - integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw== +typescript@^6.0.0: + version "6.0.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-6.0.3.tgz#90251dc007916e972786cb94d74d15b185577d21" + integrity sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw== undici-types@~5.26.4: version "5.26.5" From 90d2ed74ba57cdf167f0c259ec79a9343bb29026 Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Tue, 19 May 2026 15:00:19 +0100 Subject: [PATCH 2/2] Remove redundant `outDir` --- rollup.config.mjs | 1 - 1 file changed, 1 deletion(-) diff --git a/rollup.config.mjs b/rollup.config.mjs index c2701b74d..3fa99acb7 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -48,7 +48,6 @@ function transpileFiles(format, input, outDir) { outDir, rootDir: 'src', }, - outDir, }), format === 'esm' ? modulePackageJson : {}, ],