From df0636d7fb524bdb7a3df2f92c063d017d0c13dc Mon Sep 17 00:00:00 2001 From: Onur Temizkan Date: Thu, 6 Mar 2025 20:28:50 +0000 Subject: [PATCH 01/24] fix(remix): Null-check `options` (#15610) --- packages/remix/src/server/errors.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/remix/src/server/errors.ts b/packages/remix/src/server/errors.ts index 0a5e9f4918bc..e14654415a2c 100644 --- a/packages/remix/src/server/errors.ts +++ b/packages/remix/src/server/errors.ts @@ -127,9 +127,9 @@ export async function errorHandleDataFunction( return handleCallbackErrors( async () => { if (name === 'action' && span) { - const options = getClient()?.getOptions() as RemixOptions; + const options = getClient()?.getOptions() as RemixOptions | undefined; - if (options.sendDefaultPii && options.captureActionFormDataKeys) { + if (options?.sendDefaultPii && options.captureActionFormDataKeys) { await storeFormDataKeys(args, span); } } From e386281da828007618a5a84a53ecb6e37874f761 Mon Sep 17 00:00:00 2001 From: Sigrid Huemer <32902192+s1gr1d@users.noreply.github.com> Date: Fri, 7 Mar 2025 09:59:38 +0100 Subject: [PATCH 02/24] fix(sveltekit): Guard process variable (#15605) `process` was guarded in https://github.com/getsentry/sentry-javascript/pull/15516 already, but it still did not fix the problem as the variable `process` is not even available so the code still broke. This is another attempt to fix "process is undefined" reported in https://github.com/getsentry/sentry-javascript/issues/15506 --- packages/sveltekit/src/server-common/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sveltekit/src/server-common/utils.ts b/packages/sveltekit/src/server-common/utils.ts index 90f47f022e5c..d79a88030ca9 100644 --- a/packages/sveltekit/src/server-common/utils.ts +++ b/packages/sveltekit/src/server-common/utils.ts @@ -19,7 +19,7 @@ export function getTracePropagationData(event: RequestEvent): { sentryTrace: str /** Flush the event queue to ensure that events get sent to Sentry before the response is finished and the lambda ends */ export async function flushIfServerless(): Promise { - if (!process) { + if (typeof process === 'undefined') { return; } From aa92e85ccc1cdd82c3098189485bf8e24aaf0f1b Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Mon, 10 Mar 2025 17:14:47 +0100 Subject: [PATCH 03/24] test(nuxt): Fix failing e2e tests (#15625) Not sure why this only started happening now but it seems like `import { test, describe } from '@nuxt/test-utils/playwright` instead of from `@playwright/test` builds a nuxt application on every test. This seems in line with what @s1gr1d found out about the purpose of Nuxt E2E which is to create small test apps on every `test` function invocation. We don't want this functionallity anyway, so let's get rid of this depenency and only import form `@playwright/test`. --- .../nuxt-3-dynamic-import/package.json | 1 - .../nuxt-3-dynamic-import/playwright.config.ts | 9 --------- .../tests/errors.client.test.ts | 2 +- .../tests/tracing.client.test.ts | 2 +- .../test-applications/nuxt-3-min/package.json | 1 - .../nuxt-3-min/playwright.config.ts | 12 ------------ .../nuxt-3-min/tests/errors.client.test.ts | 2 +- .../nuxt-3-min/tests/tracing.client.test.ts | 2 +- .../nuxt-3-top-level-import/package.json | 1 - .../nuxt-3-top-level-import/playwright.config.ts | 12 ------------ .../tests/errors.client.test.ts | 2 +- .../tests/tracing.client.test.ts | 2 +- .../e2e-tests/test-applications/nuxt-3/package.json | 1 - .../test-applications/nuxt-3/playwright.config.ts | 12 ------------ .../nuxt-3/tests/errors.client.test.ts | 2 +- .../nuxt-3/tests/tracing.client.test.ts | 2 +- .../e2e-tests/test-applications/nuxt-4/package.json | 1 - .../test-applications/nuxt-4/playwright.config.ts | 12 ------------ 18 files changed, 8 insertions(+), 70 deletions(-) diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3-dynamic-import/package.json b/dev-packages/e2e-tests/test-applications/nuxt-3-dynamic-import/package.json index 8555f0da7a58..3c383fe962e1 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3-dynamic-import/package.json +++ b/dev-packages/e2e-tests/test-applications/nuxt-3-dynamic-import/package.json @@ -18,7 +18,6 @@ "nuxt": "^3.14.0" }, "devDependencies": { - "@nuxt/test-utils": "^3.14.1", "@playwright/test": "~1.50.0", "@sentry-internal/test-utils": "link:../../../test-utils" }, diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3-dynamic-import/playwright.config.ts b/dev-packages/e2e-tests/test-applications/nuxt-3-dynamic-import/playwright.config.ts index aa1ff8e9743c..586ca5cf8226 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3-dynamic-import/playwright.config.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-3-dynamic-import/playwright.config.ts @@ -1,19 +1,10 @@ -import { fileURLToPath } from 'node:url'; -import type { ConfigOptions } from '@nuxt/test-utils/playwright'; import { getPlaywrightConfig } from '@sentry-internal/test-utils'; -const nuxtConfigOptions: ConfigOptions = { - nuxt: { - rootDir: fileURLToPath(new URL('.', import.meta.url)), - }, -}; - /* Make sure to import from '@nuxt/test-utils/playwright' in the tests * Like this: import { expect, test } from '@nuxt/test-utils/playwright' */ const config = getPlaywrightConfig({ startCommand: `pnpm start`, - use: { ...nuxtConfigOptions }, }); export default config; diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3-dynamic-import/tests/errors.client.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-3-dynamic-import/tests/errors.client.test.ts index 2fdd4f79cc46..f4ca86413598 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3-dynamic-import/tests/errors.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-3-dynamic-import/tests/errors.client.test.ts @@ -1,4 +1,4 @@ -import { expect, test } from '@nuxt/test-utils/playwright'; +import { expect, test } from '@playwright/test'; import { waitForError } from '@sentry-internal/test-utils'; test.describe('client-side errors', async () => { diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3-dynamic-import/tests/tracing.client.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-3-dynamic-import/tests/tracing.client.test.ts index e4cc6d7b35b2..f87949e32527 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3-dynamic-import/tests/tracing.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-3-dynamic-import/tests/tracing.client.test.ts @@ -1,4 +1,4 @@ -import { expect, test } from '@nuxt/test-utils/playwright'; +import { expect, test } from '@playwright/test'; import { waitForTransaction } from '@sentry-internal/test-utils'; import type { Span } from '@sentry/nuxt'; diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3-min/package.json b/dev-packages/e2e-tests/test-applications/nuxt-3-min/package.json index 7fb034434fdf..62133c9a85c3 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3-min/package.json +++ b/dev-packages/e2e-tests/test-applications/nuxt-3-min/package.json @@ -20,7 +20,6 @@ "nuxt": "3.7.0" }, "devDependencies": { - "@nuxt/test-utils": "^3.14.1", "@playwright/test": "~1.50.0", "@sentry-internal/test-utils": "link:../../../test-utils" }, diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3-min/playwright.config.ts b/dev-packages/e2e-tests/test-applications/nuxt-3-min/playwright.config.ts index 6cea405151bd..e07fb02e5218 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3-min/playwright.config.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-3-min/playwright.config.ts @@ -1,19 +1,7 @@ -import { fileURLToPath } from 'node:url'; -import type { ConfigOptions } from '@nuxt/test-utils/playwright'; import { getPlaywrightConfig } from '@sentry-internal/test-utils'; -const nuxtConfigOptions: ConfigOptions = { - nuxt: { - rootDir: fileURLToPath(new URL('.', import.meta.url)), - }, -}; - -/* Make sure to import from '@nuxt/test-utils/playwright' in the tests - * Like this: import { expect, test } from '@nuxt/test-utils/playwright' */ - const config = getPlaywrightConfig({ startCommand: `pnpm start:import`, - use: { ...nuxtConfigOptions }, }); export default config; diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3-min/tests/errors.client.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-3-min/tests/errors.client.test.ts index 66f86755218e..0de0c3dd498a 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3-min/tests/errors.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-3-min/tests/errors.client.test.ts @@ -1,4 +1,4 @@ -import { expect, test } from '@nuxt/test-utils/playwright'; +import { expect, test } from '@playwright/test'; import { waitForError } from '@sentry-internal/test-utils'; test.describe('client-side errors', async () => { diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3-min/tests/tracing.client.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-3-min/tests/tracing.client.test.ts index b726636974c9..1f5a6aee4891 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3-min/tests/tracing.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-3-min/tests/tracing.client.test.ts @@ -1,4 +1,4 @@ -import { expect, test } from '@nuxt/test-utils/playwright'; +import { expect, test } from '@playwright/test'; import { waitForTransaction } from '@sentry-internal/test-utils'; import type { Span } from '@sentry/nuxt'; diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3-top-level-import/package.json b/dev-packages/e2e-tests/test-applications/nuxt-3-top-level-import/package.json index 1e6590da7a10..0f7411d6a3d6 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3-top-level-import/package.json +++ b/dev-packages/e2e-tests/test-applications/nuxt-3-top-level-import/package.json @@ -18,7 +18,6 @@ "nuxt": "^3.14.0" }, "devDependencies": { - "@nuxt/test-utils": "^3.14.1", "@playwright/test": "~1.50.0", "@sentry-internal/test-utils": "link:../../../test-utils" } diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3-top-level-import/playwright.config.ts b/dev-packages/e2e-tests/test-applications/nuxt-3-top-level-import/playwright.config.ts index aa1ff8e9743c..31f2b913b58b 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3-top-level-import/playwright.config.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-3-top-level-import/playwright.config.ts @@ -1,19 +1,7 @@ -import { fileURLToPath } from 'node:url'; -import type { ConfigOptions } from '@nuxt/test-utils/playwright'; import { getPlaywrightConfig } from '@sentry-internal/test-utils'; -const nuxtConfigOptions: ConfigOptions = { - nuxt: { - rootDir: fileURLToPath(new URL('.', import.meta.url)), - }, -}; - -/* Make sure to import from '@nuxt/test-utils/playwright' in the tests - * Like this: import { expect, test } from '@nuxt/test-utils/playwright' */ - const config = getPlaywrightConfig({ startCommand: `pnpm start`, - use: { ...nuxtConfigOptions }, }); export default config; diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3-top-level-import/tests/errors.client.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-3-top-level-import/tests/errors.client.test.ts index 667075693223..445a62e54b2a 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3-top-level-import/tests/errors.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-3-top-level-import/tests/errors.client.test.ts @@ -1,4 +1,4 @@ -import { expect, test } from '@nuxt/test-utils/playwright'; +import { expect, test } from '@playwright/test'; import { waitForError } from '@sentry-internal/test-utils'; test.describe('client-side errors', async () => { diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3-top-level-import/tests/tracing.client.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-3-top-level-import/tests/tracing.client.test.ts index 44b37a90f7a0..9945cc11da5f 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3-top-level-import/tests/tracing.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-3-top-level-import/tests/tracing.client.test.ts @@ -1,4 +1,4 @@ -import { expect, test } from '@nuxt/test-utils/playwright'; +import { expect, test } from '@playwright/test'; import { waitForTransaction } from '@sentry-internal/test-utils'; import type { Span } from '@sentry/nuxt'; diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3/package.json b/dev-packages/e2e-tests/test-applications/nuxt-3/package.json index df88dd717a8d..0656c5978990 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3/package.json +++ b/dev-packages/e2e-tests/test-applications/nuxt-3/package.json @@ -19,7 +19,6 @@ "nuxt": "^3.14.0" }, "devDependencies": { - "@nuxt/test-utils": "^3.14.1", "@playwright/test": "~1.50.0", "@sentry-internal/test-utils": "link:../../../test-utils" } diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3/playwright.config.ts b/dev-packages/e2e-tests/test-applications/nuxt-3/playwright.config.ts index 6cea405151bd..e07fb02e5218 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3/playwright.config.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-3/playwright.config.ts @@ -1,19 +1,7 @@ -import { fileURLToPath } from 'node:url'; -import type { ConfigOptions } from '@nuxt/test-utils/playwright'; import { getPlaywrightConfig } from '@sentry-internal/test-utils'; -const nuxtConfigOptions: ConfigOptions = { - nuxt: { - rootDir: fileURLToPath(new URL('.', import.meta.url)), - }, -}; - -/* Make sure to import from '@nuxt/test-utils/playwright' in the tests - * Like this: import { expect, test } from '@nuxt/test-utils/playwright' */ - const config = getPlaywrightConfig({ startCommand: `pnpm start:import`, - use: { ...nuxtConfigOptions }, }); export default config; diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3/tests/errors.client.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-3/tests/errors.client.test.ts index a04ebf73f08d..d94f649f78d1 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3/tests/errors.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-3/tests/errors.client.test.ts @@ -1,4 +1,4 @@ -import { expect, test } from '@nuxt/test-utils/playwright'; +import { expect, test } from '@playwright/test'; import { waitForError } from '@sentry-internal/test-utils'; test.describe('client-side errors', async () => { diff --git a/dev-packages/e2e-tests/test-applications/nuxt-3/tests/tracing.client.test.ts b/dev-packages/e2e-tests/test-applications/nuxt-3/tests/tracing.client.test.ts index f779bbcee69f..abeed374a426 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-3/tests/tracing.client.test.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-3/tests/tracing.client.test.ts @@ -1,4 +1,4 @@ -import { expect, test } from '@nuxt/test-utils/playwright'; +import { expect, test } from '@playwright/test'; import { waitForTransaction } from '@sentry-internal/test-utils'; import type { Span } from '@sentry/nuxt'; diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4/package.json b/dev-packages/e2e-tests/test-applications/nuxt-4/package.json index a1cbc9164e9e..104032962c50 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-4/package.json +++ b/dev-packages/e2e-tests/test-applications/nuxt-4/package.json @@ -20,7 +20,6 @@ "nuxt": "^3.13.2" }, "devDependencies": { - "@nuxt/test-utils": "^3.14.2", "@playwright/test": "~1.50.0", "@sentry-internal/test-utils": "link:../../../test-utils" }, diff --git a/dev-packages/e2e-tests/test-applications/nuxt-4/playwright.config.ts b/dev-packages/e2e-tests/test-applications/nuxt-4/playwright.config.ts index 6cea405151bd..e07fb02e5218 100644 --- a/dev-packages/e2e-tests/test-applications/nuxt-4/playwright.config.ts +++ b/dev-packages/e2e-tests/test-applications/nuxt-4/playwright.config.ts @@ -1,19 +1,7 @@ -import { fileURLToPath } from 'node:url'; -import type { ConfigOptions } from '@nuxt/test-utils/playwright'; import { getPlaywrightConfig } from '@sentry-internal/test-utils'; -const nuxtConfigOptions: ConfigOptions = { - nuxt: { - rootDir: fileURLToPath(new URL('.', import.meta.url)), - }, -}; - -/* Make sure to import from '@nuxt/test-utils/playwright' in the tests - * Like this: import { expect, test } from '@nuxt/test-utils/playwright' */ - const config = getPlaywrightConfig({ startCommand: `pnpm start:import`, - use: { ...nuxtConfigOptions }, }); export default config; From 0b754c9c465d7f5a77257e30191635a2df8c5733 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Mar 2025 16:16:02 +0000 Subject: [PATCH 04/24] chore(deps): bump axios in /dev-packages/browser-integration-tests Bumps [axios](https://github.com/axios/axios) from 1.7.7 to 1.8.2. - [Release notes](https://github.com/axios/axios/releases) - [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md) - [Commits](https://github.com/axios/axios/compare/v1.7.7...v1.8.2) --- updated-dependencies: - dependency-name: axios dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- dev-packages/browser-integration-tests/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-packages/browser-integration-tests/package.json b/dev-packages/browser-integration-tests/package.json index 3a1f3a9ae3c6..1d24fe0ae486 100644 --- a/dev-packages/browser-integration-tests/package.json +++ b/dev-packages/browser-integration-tests/package.json @@ -43,7 +43,7 @@ "@playwright/test": "~1.50.0", "@sentry-internal/rrweb": "2.34.0", "@sentry/browser": "9.5.0", - "axios": "1.7.7", + "axios": "1.8.2", "babel-loader": "^8.2.2", "fflate": "0.8.2", "html-webpack-plugin": "^5.5.0", From d71e6adbd85c0426fee1392966b48cd607dc87dd Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Tue, 4 Mar 2025 17:55:33 +0100 Subject: [PATCH 05/24] fix(sveltekit): Correctly parse angle bracket type assertions for auto instrumentation --- .../src/routes/type-assertion/+page.svelte | 16 ++++ .../src/routes/type-assertion/+page.ts | 8 ++ packages/sveltekit/package.json | 3 +- packages/sveltekit/src/vite/autoInstrument.ts | 73 +++++++++++++++-- .../test/vite/autoInstrument.test.ts | 10 ++- yarn.lock | 79 ++++++------------- 6 files changed, 127 insertions(+), 62 deletions(-) create mode 100644 dev-packages/e2e-tests/test-applications/sveltekit-2/src/routes/type-assertion/+page.svelte create mode 100644 dev-packages/e2e-tests/test-applications/sveltekit-2/src/routes/type-assertion/+page.ts diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2/src/routes/type-assertion/+page.svelte b/dev-packages/e2e-tests/test-applications/sveltekit-2/src/routes/type-assertion/+page.svelte new file mode 100644 index 000000000000..8b60ec50cce3 --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2/src/routes/type-assertion/+page.svelte @@ -0,0 +1,16 @@ + + +

Type Assertion

+ +

+ TIL: +const myCanvas = document.getElementById("main_canvas"); + is equal to +const myCanvas = document.getElementById("main_canvas") as HTMLCanvasElement; +

+ +

+ Message: {data.msg} +

diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2/src/routes/type-assertion/+page.ts b/dev-packages/e2e-tests/test-applications/sveltekit-2/src/routes/type-assertion/+page.ts new file mode 100644 index 000000000000..5e517f53bb90 --- /dev/null +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2/src/routes/type-assertion/+page.ts @@ -0,0 +1,8 @@ +export async function load() { + let x: unknown = 'foo'; + return { + // this angle bracket type assertion threw an auto instrumentation error + // see: https://github.com/getsentry/sentry-javascript/issues/9318 + msg: x, + }; +} diff --git a/packages/sveltekit/package.json b/packages/sveltekit/package.json index e447ec887e48..3430358d7ae4 100644 --- a/packages/sveltekit/package.json +++ b/packages/sveltekit/package.json @@ -44,6 +44,7 @@ } }, "dependencies": { + "@babel/parser": "7.26.9", "@sentry/cloudflare": "9.5.0", "@sentry/core": "9.5.0", "@sentry/node": "9.5.0", @@ -51,7 +52,7 @@ "@sentry/svelte": "9.5.0", "@sentry/vite-plugin": "3.2.0", "magic-string": "0.30.7", - "magicast": "0.2.8", + "recast": "0.23.11", "sorcery": "1.0.0" }, "devDependencies": { diff --git a/packages/sveltekit/src/vite/autoInstrument.ts b/packages/sveltekit/src/vite/autoInstrument.ts index 8303af502f90..dc5c02ff0bea 100644 --- a/packages/sveltekit/src/vite/autoInstrument.ts +++ b/packages/sveltekit/src/vite/autoInstrument.ts @@ -1,7 +1,9 @@ import * as fs from 'fs'; import * as path from 'path'; import type { ExportNamedDeclaration } from '@babel/types'; -import { parseModule } from 'magicast'; +import * as recast from 'recast'; +import t = recast.types.namedTypes; +import { parse as babelParse } from '@babel/parser'; import type { Plugin } from 'vite'; import { WRAPPED_MODULE_SUFFIX } from '../common/utils'; @@ -101,9 +103,59 @@ export async function canWrapLoad(id: string, debug: boolean): Promise const code = (await fs.promises.readFile(id, 'utf8')).toString(); - const mod = parseModule(code); + // Taken from recast's typescript parser config + const parser = { + parse: (source: string) => + babelParse(source, { + plugins: [ + 'typescript', + 'asyncGenerators', + 'bigInt', + 'classPrivateMethods', + 'classPrivateProperties', + 'classProperties', + 'classStaticBlock', + 'decimal', + 'decorators-legacy', + 'doExpressions', + 'dynamicImport', + 'exportDefaultFrom', + 'exportNamespaceFrom', + 'functionBind', + 'functionSent', + 'importAssertions', + 'importMeta', + 'nullishCoalescingOperator', + 'numericSeparator', + 'objectRestSpread', + 'optionalCatchBinding', + 'optionalChaining', + [ + 'pipelineOperator', + { + proposal: 'minimal', + }, + ], + [ + 'recordAndTuple', + { + syntaxType: 'hash', + }, + ], + 'throwExpressions', + 'topLevelAwait', + 'v8intrinsic', + ], + sourceType: 'module', + }), + }; + + const ast = recast.parse(code, { + parser, + }); + + const program = (ast as { program?: t.Program }).program; - const program = mod.$ast.type === 'Program' && mod.$ast; if (!program) { // eslint-disable-next-line no-console debug && console.log(`Skipping wrapping ${id} because it doesn't contain valid JavaScript or TypeScript`); @@ -111,12 +163,17 @@ export async function canWrapLoad(id: string, debug: boolean): Promise } const hasLoadDeclaration = program.body - .filter((statement): statement is ExportNamedDeclaration => statement.type === 'ExportNamedDeclaration') + .filter( + (statement): statement is recast.types.namedTypes.ExportNamedDeclaration => + statement.type === 'ExportNamedDeclaration', + ) .find(exportDecl => { // find `export const load = ...` if (exportDecl.declaration?.type === 'VariableDeclaration') { const variableDeclarations = exportDecl.declaration.declarations; - return variableDeclarations.find(decl => decl.id.type === 'Identifier' && decl.id.name === 'load'); + return variableDeclarations.find( + decl => decl.type === 'VariableDeclarator' && decl.id.type === 'Identifier' && decl.id.name === 'load', + ); } // find `export function load = ...` @@ -130,7 +187,11 @@ export async function canWrapLoad(id: string, debug: boolean): Promise return exportDecl.specifiers.find(specifier => { return ( (specifier.exported.type === 'Identifier' && specifier.exported.name === 'load') || - (specifier.exported.type === 'StringLiteral' && specifier.exported.value === 'load') + // Type casting here because babel by default doesn't include the 'exportExtensions' plugin + // This plugin adds support for exporting something as a string literal (see comment above) + // Doing this to avoid adding another babel plugin dependency + ((specifier.exported.type as 'StringLiteral' | '') === 'StringLiteral' && + (specifier.exported as unknown as t.StringLiteral).value === 'load') ); }); } diff --git a/packages/sveltekit/test/vite/autoInstrument.test.ts b/packages/sveltekit/test/vite/autoInstrument.test.ts index 37f6be4f9700..6451c603d47e 100644 --- a/packages/sveltekit/test/vite/autoInstrument.test.ts +++ b/packages/sveltekit/test/vite/autoInstrument.test.ts @@ -140,7 +140,15 @@ describe('canWrapLoad', () => { return { props: { msg: res.toString() } } }`, ], - + [ + 'export function declaration - with angle bracket type assertion', + `export async function load() { + let x: unknown = 'foo'; + return { + msg: x, + }; + }`, + ], [ 'variable declaration (let)', `import {something} from 'somewhere'; diff --git a/yarn.lock b/yarn.lock index 8dfc3eae3547..27c534b65ea3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1695,20 +1695,20 @@ js-tokens "^4.0.0" picocolors "^1.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.16.4", "@babel/parser@^7.18.10", "@babel/parser@^7.20.7", "@babel/parser@^7.21.8", "@babel/parser@^7.21.9", "@babel/parser@^7.22.10", "@babel/parser@^7.22.16", "@babel/parser@^7.23.5", "@babel/parser@^7.23.9", "@babel/parser@^7.25.3", "@babel/parser@^7.25.4", "@babel/parser@^7.25.6", "@babel/parser@^7.25.9", "@babel/parser@^7.26.0", "@babel/parser@^7.26.3", "@babel/parser@^7.4.5", "@babel/parser@^7.7.0": - version "7.26.3" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.26.3.tgz#8c51c5db6ddf08134af1ddbacf16aaab48bac234" - integrity sha512-WJ/CvmY8Mea8iDXo6a7RK2wbmJITT5fN3BEkRuFlxVyNx8jOKIIhmC4fSkTcPcf8JyavbBwIe6OpiCOBXt/IcA== - dependencies: - "@babel/types" "^7.26.3" - -"@babel/parser@^7.23.6", "@babel/parser@^7.26.9": +"@babel/parser@7.26.9", "@babel/parser@^7.23.6", "@babel/parser@^7.26.9": version "7.26.9" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.26.9.tgz#d9e78bee6dc80f9efd8f2349dcfbbcdace280fd5" integrity sha512-81NWa1njQblgZbQHxWHpxxCzNsa3ZwvFqpUg7P+NNUU6f3UU2jBEg4OlF/J6rl8+PQGh1q6/zWScd001YwcA5A== dependencies: "@babel/types" "^7.26.9" +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.16.4", "@babel/parser@^7.18.10", "@babel/parser@^7.20.7", "@babel/parser@^7.21.8", "@babel/parser@^7.22.10", "@babel/parser@^7.22.16", "@babel/parser@^7.23.5", "@babel/parser@^7.23.9", "@babel/parser@^7.25.3", "@babel/parser@^7.25.4", "@babel/parser@^7.25.6", "@babel/parser@^7.25.9", "@babel/parser@^7.26.0", "@babel/parser@^7.26.3", "@babel/parser@^7.4.5", "@babel/parser@^7.7.0": + version "7.26.3" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.26.3.tgz#8c51c5db6ddf08134af1ddbacf16aaab48bac234" + integrity sha512-WJ/CvmY8Mea8iDXo6a7RK2wbmJITT5fN3BEkRuFlxVyNx8jOKIIhmC4fSkTcPcf8JyavbBwIe6OpiCOBXt/IcA== + dependencies: + "@babel/types" "^7.26.3" + "@babel/plugin-bugfix-firefox-class-in-computed-class-key@^7.24.4": version "7.24.4" resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-firefox-class-in-computed-class-key/-/plugin-bugfix-firefox-class-in-computed-class-key-7.24.4.tgz#6125f0158543fb4edf1c22f322f3db67f21cb3e1" @@ -2829,7 +2829,7 @@ debug "^4.3.1" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.18.10", "@babel/types@^7.18.6", "@babel/types@^7.20.7", "@babel/types@^7.21.5", "@babel/types@^7.22.10", "@babel/types@^7.22.15", "@babel/types@^7.22.17", "@babel/types@^7.22.19", "@babel/types@^7.23.6", "@babel/types@^7.23.9", "@babel/types@^7.24.7", "@babel/types@^7.24.8", "@babel/types@^7.25.4", "@babel/types@^7.25.6", "@babel/types@^7.25.9", "@babel/types@^7.26.0", "@babel/types@^7.26.3", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.7.0", "@babel/types@^7.7.2": +"@babel/types@^7.0.0", "@babel/types@^7.18.10", "@babel/types@^7.18.6", "@babel/types@^7.20.7", "@babel/types@^7.22.10", "@babel/types@^7.22.15", "@babel/types@^7.22.17", "@babel/types@^7.22.19", "@babel/types@^7.23.6", "@babel/types@^7.23.9", "@babel/types@^7.24.7", "@babel/types@^7.24.8", "@babel/types@^7.25.4", "@babel/types@^7.25.6", "@babel/types@^7.25.9", "@babel/types@^7.26.0", "@babel/types@^7.26.3", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.7.0", "@babel/types@^7.7.2": version "7.26.3" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.26.3.tgz#37e79830f04c2b5687acc77db97fbc75fb81f3c0" integrity sha512-vN5p+1kl59GVKMvTHt55NzzmYVxprfJD+ql7U9NFIfKCBkYE55LYtS+WtPlaYOyzydrKI8Nezd+aZextrd+FMA== @@ -8509,12 +8509,7 @@ dependencies: "@types/unist" "*" -"@types/history-4@npm:@types/history@4.7.8": - version "4.7.8" - resolved "https://registry.yarnpkg.com/@types/history/-/history-4.7.8.tgz#49348387983075705fe8f4e02fb67f7daaec4934" - integrity sha512-S78QIYirQcUoo6UJZx9CSP0O2ix9IaeAXwQi26Rhr/+mg7qqPy8TzaxHSUut7eGjL8WmLccT7/MXf304WjqHcA== - -"@types/history-5@npm:@types/history@4.7.8": +"@types/history-4@npm:@types/history@4.7.8", "@types/history-5@npm:@types/history@4.7.8": version "4.7.8" resolved "https://registry.yarnpkg.com/@types/history/-/history-4.7.8.tgz#49348387983075705fe8f4e02fb67f7daaec4934" integrity sha512-S78QIYirQcUoo6UJZx9CSP0O2ix9IaeAXwQi26Rhr/+mg7qqPy8TzaxHSUut7eGjL8WmLccT7/MXf304WjqHcA== @@ -21326,15 +21321,6 @@ magic-string@^0.30.0, magic-string@^0.30.10, magic-string@^0.30.11, magic-string dependencies: "@jridgewell/sourcemap-codec" "^1.5.0" -magicast@0.2.8: - version "0.2.8" - resolved "https://registry.yarnpkg.com/magicast/-/magicast-0.2.8.tgz#02b298c65fbc5b7d1fce52ef779c59caf68cc9cf" - integrity sha512-zEnqeb3E6TfMKYXGyHv3utbuHNixr04o3/gVGviSzVQkbFiU46VZUd+Ea/1npKfvEsEWxBYuIksKzoztTDPg0A== - dependencies: - "@babel/parser" "^7.21.9" - "@babel/types" "^7.21.5" - recast "^0.23.2" - magicast@^0.2.10: version "0.2.11" resolved "https://registry.yarnpkg.com/magicast/-/magicast-0.2.11.tgz#d5d9339ec59e5322cf331460d8e3db2f6585f5d5" @@ -26237,6 +26223,17 @@ realistic-structured-clone@^3.0.0: typeson "^6.1.0" typeson-registry "^1.0.0-alpha.20" +recast@0.23.11: + version "0.23.11" + resolved "https://registry.yarnpkg.com/recast/-/recast-0.23.11.tgz#8885570bb28cf773ba1dc600da7f502f7883f73f" + integrity sha512-YTUo+Flmw4ZXiWfQKGcwwc11KnoRAYgzAE2E7mXKCjSviTKShtxBsN6YUUBB2gtaBzKzeKunxhUwNHQuRryhWA== + dependencies: + ast-types "^0.16.1" + esprima "~4.0.0" + source-map "~0.6.1" + tiny-invariant "^1.3.3" + tslib "^2.0.1" + recast@^0.18.1: version "0.18.10" resolved "https://registry.yarnpkg.com/recast/-/recast-0.18.10.tgz#605ebbe621511eb89b6356a7e224bff66ed91478" @@ -26257,7 +26254,7 @@ recast@^0.20.5: source-map "~0.6.1" tslib "^2.0.1" -recast@^0.23.2, recast@^0.23.4: +recast@^0.23.4: version "0.23.9" resolved "https://registry.yarnpkg.com/recast/-/recast-0.23.9.tgz#587c5d3a77c2cfcb0c18ccce6da4361528c2587b" integrity sha512-Hx/BGIbwj+Des3+xy5uAtAbdCyqK9y9wbBcDFDYanLS9JnMqf7OeF87HQwUimE87OEc72mr6tkKUKMBBL+hF9Q== @@ -28346,16 +28343,7 @@ string-template@~0.2.1: resolved "https://registry.yarnpkg.com/string-template/-/string-template-0.2.1.tgz#42932e598a352d01fc22ec3367d9d84eec6c9add" integrity sha1-QpMuWYo1LQH8IuwzZ9nYTuxsmt0= -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string-width@4.2.3, "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0", string-width@4.2.3, "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -28458,14 +28446,7 @@ stringify-object@^3.2.1: is-obj "^1.0.1" is-regexp "^1.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -28630,7 +28611,6 @@ stylus@0.59.0, stylus@^0.59.0: sucrase@^3.27.0, sucrase@^3.35.0, sucrase@getsentry/sucrase#es2020-polyfills: version "3.36.0" - uid fd682f6129e507c00bb4e6319cc5d6b767e36061 resolved "https://codeload.github.com/getsentry/sucrase/tar.gz/fd682f6129e507c00bb4e6319cc5d6b767e36061" dependencies: "@jridgewell/gen-mapping" "^0.3.2" @@ -31303,16 +31283,7 @@ wrangler@^3.67.1: optionalDependencies: fsevents "~2.3.2" -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - -wrap-ansi@7.0.0, wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@7.0.0, wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== From 90685e2ca07fe385e8bb2f68cd3fff8aa0a9a365 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Tue, 4 Mar 2025 18:01:00 +0100 Subject: [PATCH 06/24] cleanup --- packages/sveltekit/src/vite/autoInstrument.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/sveltekit/src/vite/autoInstrument.ts b/packages/sveltekit/src/vite/autoInstrument.ts index dc5c02ff0bea..4537f1052416 100644 --- a/packages/sveltekit/src/vite/autoInstrument.ts +++ b/packages/sveltekit/src/vite/autoInstrument.ts @@ -1,8 +1,8 @@ import * as fs from 'fs'; import * as path from 'path'; -import type { ExportNamedDeclaration } from '@babel/types'; import * as recast from 'recast'; import t = recast.types.namedTypes; +import type { ParserPlugin } from '@babel/parser'; import { parse as babelParse } from '@babel/parser'; import type { Plugin } from 'vite'; import { WRAPPED_MODULE_SUFFIX } from '../common/utils'; @@ -103,7 +103,9 @@ export async function canWrapLoad(id: string, debug: boolean): Promise const code = (await fs.promises.readFile(id, 'utf8')).toString(); - // Taken from recast's typescript parser config + // Taken from recast's typescript parser config, minus the JSX plugin + // see: https://github.com/benjamn/recast/blob/master/parsers/_babel_options.ts + // see: https://github.com/benjamn/recast/blob/master/parsers/babel-ts.ts const parser = { parse: (source: string) => babelParse(source, { @@ -124,6 +126,7 @@ export async function canWrapLoad(id: string, debug: boolean): Promise 'functionBind', 'functionSent', 'importAssertions', + 'exportExtensions' as ParserPlugin, 'importMeta', 'nullishCoalescingOperator', 'numericSeparator', @@ -187,7 +190,7 @@ export async function canWrapLoad(id: string, debug: boolean): Promise return exportDecl.specifiers.find(specifier => { return ( (specifier.exported.type === 'Identifier' && specifier.exported.name === 'load') || - // Type casting here because babel by default doesn't include the 'exportExtensions' plugin + // Type casting here because somehow the 'exportExtensions' plugin isn't reflected in the possible types // This plugin adds support for exporting something as a string literal (see comment above) // Doing this to avoid adding another babel plugin dependency ((specifier.exported.type as 'StringLiteral' | '') === 'StringLiteral' && From 9f33bae148df4b354fa541c6ce770e0ff38fd01d Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Tue, 4 Mar 2025 18:15:55 +0100 Subject: [PATCH 07/24] extract recast parser config into extra file, add vendor information and license --- packages/sveltekit/src/vite/autoInstrument.ts | 53 +----------- .../src/vite/recastTypescriptParser.ts | 85 +++++++++++++++++++ 2 files changed, 86 insertions(+), 52 deletions(-) create mode 100644 packages/sveltekit/src/vite/recastTypescriptParser.ts diff --git a/packages/sveltekit/src/vite/autoInstrument.ts b/packages/sveltekit/src/vite/autoInstrument.ts index 4537f1052416..48e72db9ba0a 100644 --- a/packages/sveltekit/src/vite/autoInstrument.ts +++ b/packages/sveltekit/src/vite/autoInstrument.ts @@ -2,10 +2,9 @@ import * as fs from 'fs'; import * as path from 'path'; import * as recast from 'recast'; import t = recast.types.namedTypes; -import type { ParserPlugin } from '@babel/parser'; -import { parse as babelParse } from '@babel/parser'; import type { Plugin } from 'vite'; import { WRAPPED_MODULE_SUFFIX } from '../common/utils'; +import { parser } from './recastTypescriptParser'; export type AutoInstrumentSelection = { /** @@ -103,56 +102,6 @@ export async function canWrapLoad(id: string, debug: boolean): Promise const code = (await fs.promises.readFile(id, 'utf8')).toString(); - // Taken from recast's typescript parser config, minus the JSX plugin - // see: https://github.com/benjamn/recast/blob/master/parsers/_babel_options.ts - // see: https://github.com/benjamn/recast/blob/master/parsers/babel-ts.ts - const parser = { - parse: (source: string) => - babelParse(source, { - plugins: [ - 'typescript', - 'asyncGenerators', - 'bigInt', - 'classPrivateMethods', - 'classPrivateProperties', - 'classProperties', - 'classStaticBlock', - 'decimal', - 'decorators-legacy', - 'doExpressions', - 'dynamicImport', - 'exportDefaultFrom', - 'exportNamespaceFrom', - 'functionBind', - 'functionSent', - 'importAssertions', - 'exportExtensions' as ParserPlugin, - 'importMeta', - 'nullishCoalescingOperator', - 'numericSeparator', - 'objectRestSpread', - 'optionalCatchBinding', - 'optionalChaining', - [ - 'pipelineOperator', - { - proposal: 'minimal', - }, - ], - [ - 'recordAndTuple', - { - syntaxType: 'hash', - }, - ], - 'throwExpressions', - 'topLevelAwait', - 'v8intrinsic', - ], - sourceType: 'module', - }), - }; - const ast = recast.parse(code, { parser, }); diff --git a/packages/sveltekit/src/vite/recastTypescriptParser.ts b/packages/sveltekit/src/vite/recastTypescriptParser.ts new file mode 100644 index 000000000000..fb5f813292fc --- /dev/null +++ b/packages/sveltekit/src/vite/recastTypescriptParser.ts @@ -0,0 +1,85 @@ +// This babel parser config is taken from recast's typescript parser config, specifically from these two files: +// see: https://github.com/benjamn/recast/blob/master/parsers/_babel_options.ts +// see: https://github.com/benjamn/recast/blob/master/parsers/babel-ts.ts +// +// Changes: +// - we don't add the 'jsx' plugin, to correctly parse TypeScript angle bracket type assertions +// (see https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#type-assertions) +// - minor import and export changes +// - merged the two files linked above into one for simplicity + +// Date of access: 2025-03-04 +// Commit: https://github.com/benjamn/recast/commit/ba5132174894b496285da9d001f1f2524ceaed3a + +// Recast license: + +// Copyright (c) 2012 Ben Newman + +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: + +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +import type { ParserPlugin } from '@babel/parser'; +import { parse as babelParse } from '@babel/parser'; + +export const parser = { + parse: (source: string) => + babelParse(source, { + plugins: [ + 'typescript', + 'asyncGenerators', + 'bigInt', + 'classPrivateMethods', + 'classPrivateProperties', + 'classProperties', + 'classStaticBlock', + 'decimal', + 'decorators-legacy', + 'doExpressions', + 'dynamicImport', + 'exportDefaultFrom', + 'exportNamespaceFrom', + 'functionBind', + 'functionSent', + 'importAssertions', + 'exportExtensions' as ParserPlugin, + 'importMeta', + 'nullishCoalescingOperator', + 'numericSeparator', + 'objectRestSpread', + 'optionalCatchBinding', + 'optionalChaining', + [ + 'pipelineOperator', + { + proposal: 'minimal', + }, + ], + [ + 'recordAndTuple', + { + syntaxType: 'hash', + }, + ], + 'throwExpressions', + 'topLevelAwait', + 'v8intrinsic', + ], + sourceType: 'module', + }), +}; From 25a39d2867e92b96fdbe06f03ef21bf6900b0942 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Tue, 4 Mar 2025 18:19:32 +0100 Subject: [PATCH 08/24] fix type error --- packages/sveltekit/src/vite/recastTypescriptParser.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/sveltekit/src/vite/recastTypescriptParser.ts b/packages/sveltekit/src/vite/recastTypescriptParser.ts index fb5f813292fc..898fd0fb4931 100644 --- a/packages/sveltekit/src/vite/recastTypescriptParser.ts +++ b/packages/sveltekit/src/vite/recastTypescriptParser.ts @@ -36,8 +36,9 @@ import type { ParserPlugin } from '@babel/parser'; import { parse as babelParse } from '@babel/parser'; +import type { Options } from 'recast'; -export const parser = { +export const parser: Options['parser'] = { parse: (source: string) => babelParse(source, { plugins: [ From 0ec758b97a84bb795acf0a05da037630ebc91329 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Tue, 4 Mar 2025 18:21:13 +0100 Subject: [PATCH 09/24] add remaining options --- packages/sveltekit/src/vite/recastTypescriptParser.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/sveltekit/src/vite/recastTypescriptParser.ts b/packages/sveltekit/src/vite/recastTypescriptParser.ts index 898fd0fb4931..ca37439ddae9 100644 --- a/packages/sveltekit/src/vite/recastTypescriptParser.ts +++ b/packages/sveltekit/src/vite/recastTypescriptParser.ts @@ -41,6 +41,11 @@ import type { Options } from 'recast'; export const parser: Options['parser'] = { parse: (source: string) => babelParse(source, { + strictMode: false, + allowImportExportEverywhere: true, + allowReturnOutsideFunction: true, + startLine: 1, + tokens: true, plugins: [ 'typescript', 'asyncGenerators', From 62f3b09068b218652a5a7dd12aac2a2182754d64 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Mon, 10 Mar 2025 12:29:40 +0100 Subject: [PATCH 10/24] fix e2e test --- .../sveltekit-2/src/routes/type-assertion/+page.svelte | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/dev-packages/e2e-tests/test-applications/sveltekit-2/src/routes/type-assertion/+page.svelte b/dev-packages/e2e-tests/test-applications/sveltekit-2/src/routes/type-assertion/+page.svelte index 8b60ec50cce3..fcf83b8b2986 100644 --- a/dev-packages/e2e-tests/test-applications/sveltekit-2/src/routes/type-assertion/+page.svelte +++ b/dev-packages/e2e-tests/test-applications/sveltekit-2/src/routes/type-assertion/+page.svelte @@ -5,10 +5,8 @@

Type Assertion

- TIL: -const myCanvas = document.getElementById("main_canvas"); - is equal to -const myCanvas = document.getElementById("main_canvas") as HTMLCanvasElement; + This route only exists to ensure we don't emit a build error because of the angle bracket type assertion in +page.ts + see https://github.com/getsentry/sentry-javascript/issues/9318

From dfc2b525f626d1bbe2d8f0b9f0b78c65c5f10fc3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 09:36:34 +0000 Subject: [PATCH 11/24] feat(deps): bump @sentry/webpack-plugin from 3.2.1 to 3.2.2 (#15627) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [@sentry/webpack-plugin](https://github.com/getsentry/sentry-javascript-bundler-plugins) from 3.2.1 to 3.2.2.

Release notes

Sourced from @​sentry/webpack-plugin's releases.

3.2.2

  • feat(annotation): Handle JSX member expressions (#690)
  • fix(core): Don't crash on recoverable CLI command error (#682)
  • chore: Suggest putting SENTRY_AUTH_TOKEN, SENTRY_ORG and SENTRY_PROJECT in passThroughEnv when using Turborepo (#675)
Changelog

Sourced from @​sentry/webpack-plugin's changelog.

3.2.2

  • feat(annotation): Handle JSX member expressions (#690)
  • fix(core): Don't crash on recoverable CLI command error (#682)
  • chore: Suggest putting SENTRY_AUTH_TOKEN, SENTRY_ORG and SENTRY_PROJECT in passThroughEnv when using Turborepo (#675)
Commits
  • c5b9fde release: 3.2.2
  • db87d68 meta: Update Changelog for 3.2.2 (#691)
  • 10a8b0e feat(annotation): Handle JSX member expressions (#690)
  • 2fba173 fix(core): Don't crash on recoverable CLI command error (#682)
  • ee73414 chore: Suggest putting SENTRY_AUTH_TOKEN, SENTRY_ORG and SENTRY_PROJECT...
  • dc0da7f Merge branch 'release/3.2.1'
  • See full diff in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@sentry/webpack-plugin&package-manager=npm_and_yarn&previous-version=3.2.1&new-version=3.2.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- packages/gatsby/package.json | 2 +- packages/nextjs/package.json | 2 +- yarn.lock | 28 ++++++++++++++-------------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/gatsby/package.json b/packages/gatsby/package.json index c9566d7cd035..5440de6a26bb 100644 --- a/packages/gatsby/package.json +++ b/packages/gatsby/package.json @@ -47,7 +47,7 @@ "dependencies": { "@sentry/core": "9.5.0", "@sentry/react": "9.5.0", - "@sentry/webpack-plugin": "3.2.1" + "@sentry/webpack-plugin": "3.2.2" }, "peerDependencies": { "gatsby": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0", diff --git a/packages/nextjs/package.json b/packages/nextjs/package.json index 625d2a921fb0..831a52370b69 100644 --- a/packages/nextjs/package.json +++ b/packages/nextjs/package.json @@ -85,7 +85,7 @@ "@sentry/opentelemetry": "9.5.0", "@sentry/react": "9.5.0", "@sentry/vercel-edge": "9.5.0", - "@sentry/webpack-plugin": "3.2.1", + "@sentry/webpack-plugin": "3.2.2", "chalk": "3.0.0", "resolve": "1.22.8", "rollup": "4.34.9", diff --git a/yarn.lock b/yarn.lock index 8dfc3eae3547..758c24916a6d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7103,10 +7103,10 @@ resolved "https://registry.yarnpkg.com/@sentry/babel-plugin-component-annotate/-/babel-plugin-component-annotate-3.2.0.tgz#17c000cf6cc315bb620eddbd95c88dfb2471cfb9" integrity sha512-Sg7nLRP1yiJYl/KdGGxYGbjvLq5rswyeB5yESgfWX34XUNZaFgmNvw4pU/QEKVeYgcPyOulgJ+y80ewujyffTA== -"@sentry/babel-plugin-component-annotate@3.2.1": - version "3.2.1" - resolved "https://registry.yarnpkg.com/@sentry/babel-plugin-component-annotate/-/babel-plugin-component-annotate-3.2.1.tgz#90e40750a63ef5ce3d67498ed0cfccc587ab4cd8" - integrity sha512-tUp2e+CERpRFzTftjPxt7lg4BF0R3K+wGfeJyIqrc0tbJ2y6duT8OD0ArWoOi1g8xQ73NDn1/mEeS8pC+sbjTQ== +"@sentry/babel-plugin-component-annotate@3.2.2": + version "3.2.2" + resolved "https://registry.yarnpkg.com/@sentry/babel-plugin-component-annotate/-/babel-plugin-component-annotate-3.2.2.tgz#0c5f26e417b8f524924fa4531b82ad5603216e90" + integrity sha512-D+SKQ266ra/wo87s9+UI/rKQi3qhGPCR8eSCDe0VJudhjHsqyNU+JJ5lnIGCgmZaWFTXgdBP/gdr1Iz1zqGs4Q== "@sentry/bundler-plugin-core@2.22.6": version "2.22.6" @@ -7150,13 +7150,13 @@ magic-string "0.30.8" unplugin "1.0.1" -"@sentry/bundler-plugin-core@3.2.1": - version "3.2.1" - resolved "https://registry.yarnpkg.com/@sentry/bundler-plugin-core/-/bundler-plugin-core-3.2.1.tgz#9c1c8b9acaca3ae5eeae2a04529f70212dd2937e" - integrity sha512-1wId05LXf6LyTeNwqyhSDSWYbYtFT/NQRqq3sW7hcL4nZuAgzT82PSvxeeCgR/D2qXOj7RCYXXZtyWzzo3wtXA== +"@sentry/bundler-plugin-core@3.2.2": + version "3.2.2" + resolved "https://registry.yarnpkg.com/@sentry/bundler-plugin-core/-/bundler-plugin-core-3.2.2.tgz#c9193b0c97acf0097fdb820d86eaaad9c9b6b2c4" + integrity sha512-YGrtmqQ2jMixccX2slVG/Lw7pCGJL3DGB3clmY9mO8QBEBIN3/gEANiHJVWwRidpUOS/0b7yVVGAdwZ87oPwTg== dependencies: "@babel/core" "^7.18.5" - "@sentry/babel-plugin-component-annotate" "3.2.1" + "@sentry/babel-plugin-component-annotate" "3.2.2" "@sentry/cli" "2.42.2" dotenv "^16.3.1" find-up "^5.0.0" @@ -7296,12 +7296,12 @@ "@sentry/bundler-plugin-core" "3.2.0" unplugin "1.0.1" -"@sentry/webpack-plugin@3.2.1": - version "3.2.1" - resolved "https://registry.yarnpkg.com/@sentry/webpack-plugin/-/webpack-plugin-3.2.1.tgz#83756c64c59a2be39e05beda30b08753f7b80780" - integrity sha512-wP/JDljhB9pCFc62rSwWbIglF2Os8FLV68pQuyJnmImM9cjGjlK6UO+qKa2pOLYsmAcnn+t3Bhu77bbzPIStCg== +"@sentry/webpack-plugin@3.2.2": + version "3.2.2" + resolved "https://registry.yarnpkg.com/@sentry/webpack-plugin/-/webpack-plugin-3.2.2.tgz#716ab462279c25cea17490d02cb1d22b00f3f661" + integrity sha512-6OkVKNOjKk8P9j7oh6svZ+kEP1i9YIHBC2aGWL2XsgeZTIrMBxJAXtOf+qSrfMAxEtibSroGVOMQc/y3WJTQtg== dependencies: - "@sentry/bundler-plugin-core" "3.2.1" + "@sentry/bundler-plugin-core" "3.2.2" unplugin "1.0.1" uuid "^9.0.0" From c27a09aea775e0ea0d22a760404cfcd07a4518c7 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Tue, 11 Mar 2025 10:39:44 +0100 Subject: [PATCH 12/24] feat(tanstackstart): Refine initial API (#15574) - Adds a config param to the build time wrapping so that TS doesn't complain when people copy paste a docs snippet. - Adds `wrapCreateRootRouteWithSentry` which will be used for server->client tracing because we inject meta tags into the initial SSR html. --- packages/tanstackstart/src/common/index.ts | 7 +++++++ packages/tanstackstart/src/config/index.ts | 12 +++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/packages/tanstackstart/src/common/index.ts b/packages/tanstackstart/src/common/index.ts index a853f3bee0ef..d83c684d1523 100644 --- a/packages/tanstackstart/src/common/index.ts +++ b/packages/tanstackstart/src/common/index.ts @@ -14,3 +14,10 @@ export function sentryGlobalServerMiddlewareHandler() { export function wrapStreamHandlerWithSentry(handler: H): H { return handler; } + +/** + * Wraps the create root route function with Sentry for server-client tracing with SSR. + */ +export function wrapCreateRootRouteWithSentry(createRootRoute: F): F { + return createRootRoute; +} diff --git a/packages/tanstackstart/src/config/index.ts b/packages/tanstackstart/src/config/index.ts index 89897b1b6677..579fe3c7db00 100644 --- a/packages/tanstackstart/src/config/index.ts +++ b/packages/tanstackstart/src/config/index.ts @@ -1,6 +1,16 @@ /** * Wraps a TanStack Start config. */ -export function wrapVinxiConfigWithSentry(config: C): C { +export function wrapVinxiConfigWithSentry( + config: C, + // TODO: Expand this type in the future. Right now it is just so that TS doesn't complain for our users when they copy paste from the docs. + // eslint-disable-next-line @typescript-eslint/no-unused-vars + sentryBuildOptions: { + org?: string; + project?: string; + silent?: boolean; + authToken?: boolean; + } = {}, +): C { return config; } From 9cae1a07d7873b725db7a5295919a7df11c14063 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Tue, 11 Mar 2025 13:22:18 +0100 Subject: [PATCH 13/24] feat(tanstackstart): Add `@sentry/tanstackstart-react` package and make `@sentry/tanstackstart` package a utility package (#15629) --- .craft.yml | 3 + .github/ISSUE_TEMPLATE/bug.yml | 1 + README.md | 1 + .../e2e-tests/verdaccio-config/config.yaml | 6 ++ docs/new-sdk-release-checklist.md | 6 ++ package.json | 1 + packages/tanstackstart-react/.eslintrc.js | 10 +++ packages/tanstackstart-react/LICENSE | 21 +++++ packages/tanstackstart-react/README.md | 52 +++++++++++ packages/tanstackstart-react/package.json | 86 +++++++++++++++++++ .../tanstackstart-react/rollup.npm.config.mjs | 10 +++ .../tanstackstart-react/src/client/index.ts | 1 + .../tanstackstart-react/src/common/index.ts | 23 +++++ .../tanstackstart-react/src/config/index.ts | 16 ++++ .../tanstackstart-react/src/index.client.ts | 2 + .../tanstackstart-react/src/index.server.ts | 3 + .../tanstackstart-react/src/index.types.ts | 27 ++++++ .../tanstackstart-react/src/server/index.ts | 42 +++++++++ .../tanstackstart-react/test/temp.test.ts | 7 ++ .../tanstackstart-react/test/tsconfig.json | 3 + packages/tanstackstart-react/tsconfig.json | 8 ++ .../tanstackstart-react/tsconfig.test.json | 8 ++ .../tanstackstart-react/tsconfig.types.json | 9 ++ packages/tanstackstart-react/vite.config.ts | 8 ++ packages/tanstackstart/README.md | 38 +------- packages/tanstackstart/package.json | 22 +---- packages/tanstackstart/rollup.npm.config.mjs | 3 +- packages/tanstackstart/src/client/index.ts | 2 +- packages/tanstackstart/src/common/index.ts | 24 +----- packages/tanstackstart/src/config/index.ts | 17 +--- packages/tanstackstart/src/index.types.ts | 21 ----- packages/tanstackstart/src/server/index.ts | 43 +--------- yarn.lock | 11 ++- 33 files changed, 375 insertions(+), 160 deletions(-) create mode 100644 packages/tanstackstart-react/.eslintrc.js create mode 100644 packages/tanstackstart-react/LICENSE create mode 100644 packages/tanstackstart-react/README.md create mode 100644 packages/tanstackstart-react/package.json create mode 100644 packages/tanstackstart-react/rollup.npm.config.mjs create mode 100644 packages/tanstackstart-react/src/client/index.ts create mode 100644 packages/tanstackstart-react/src/common/index.ts create mode 100644 packages/tanstackstart-react/src/config/index.ts create mode 100644 packages/tanstackstart-react/src/index.client.ts create mode 100644 packages/tanstackstart-react/src/index.server.ts create mode 100644 packages/tanstackstart-react/src/index.types.ts create mode 100644 packages/tanstackstart-react/src/server/index.ts create mode 100644 packages/tanstackstart-react/test/temp.test.ts create mode 100644 packages/tanstackstart-react/test/tsconfig.json create mode 100644 packages/tanstackstart-react/tsconfig.json create mode 100644 packages/tanstackstart-react/tsconfig.test.json create mode 100644 packages/tanstackstart-react/tsconfig.types.json create mode 100644 packages/tanstackstart-react/vite.config.ts diff --git a/.craft.yml b/.craft.yml index 4f52ed1ea6ba..a5df75a24519 100644 --- a/.craft.yml +++ b/.craft.yml @@ -111,6 +111,9 @@ targets: - name: npm id: '@sentry/tanstackstart' includeNames: /^sentry-tanstackstart-\d.*\.tgz$/ + - name: npm + id: '@sentry/tanstackstart-react' + includeNames: /^sentry-tanstackstart-react-\d.*\.tgz$/ - name: npm id: '@sentry/gatsby' includeNames: /^sentry-gatsby-\d.*\.tgz$/ diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index a68dea235925..7446ed57aabc 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -50,6 +50,7 @@ body: - '@sentry/solidstart' - '@sentry/svelte' - '@sentry/sveltekit' + - '@sentry/tanstackstart-react' - '@sentry/vue' - '@sentry/wasm' - Sentry Browser Loader diff --git a/README.md b/README.md index 50f1b7125a94..8b22dafb0c63 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ package. Please refer to the README and instructions of those SDKs for more deta - [`@sentry/nestjs`](https://github.com/getsentry/sentry-javascript/tree/master/packages/nestjs): SDK for NestJS - [`@sentry/nextjs`](https://github.com/getsentry/sentry-javascript/tree/master/packages/nextjs): SDK for Next.js - [`@sentry/remix`](https://github.com/getsentry/sentry-javascript/tree/master/packages/remix): SDK for Remix +- [`@sentry/tanstackstart-react`](https://github.com/getsentry/sentry-javascript/tree/master/packages/tanstackstart-react): SDK for TanStack Start React - [`@sentry/aws-serverless`](https://github.com/getsentry/sentry-javascript/tree/master/packages/aws-serverless): SDK for AWS Lambda Functions - [`@sentry/google-cloud-serverless`](https://github.com/getsentry/sentry-javascript/tree/master/packages/google-cloud-serverless): diff --git a/dev-packages/e2e-tests/verdaccio-config/config.yaml b/dev-packages/e2e-tests/verdaccio-config/config.yaml index af7d62521c59..8535c5898175 100644 --- a/dev-packages/e2e-tests/verdaccio-config/config.yaml +++ b/dev-packages/e2e-tests/verdaccio-config/config.yaml @@ -176,6 +176,12 @@ packages: unpublish: $all # proxy: npmjs # Don't proxy for E2E tests! + '@sentry/tanstackstart-react': + access: $all + publish: $all + unpublish: $all + # proxy: npmjs # Don't proxy for E2E tests! + '@sentry/types': access: $all publish: $all diff --git a/docs/new-sdk-release-checklist.md b/docs/new-sdk-release-checklist.md index 7f1811e53d8f..3bf931a1dab4 100644 --- a/docs/new-sdk-release-checklist.md +++ b/docs/new-sdk-release-checklist.md @@ -62,6 +62,12 @@ differ slightly for other SDKs depending on how they are structured and how they - [ ] If the package you're adding is a dependency of fullstack framework (e.g. Remix or NextJS) SDKs, make sure that your package is added to the integration test apps' `"resolutions"` field in their `package.json`s. +- [ ] Add the new package to the "root" README inside the repository. + +- [ ] Add the new package to the GitHub Issue bug template. + +- [ ] Create label inside the GitHub repo named "Package: foobar". + ## Cutting the Release When you’re ready to make the first release, there are a couple of steps that need to be performed in the **correct diff --git a/package.json b/package.json index 460d2c42abb1..443b45361873 100644 --- a/package.json +++ b/package.json @@ -80,6 +80,7 @@ "packages/svelte", "packages/sveltekit", "packages/tanstackstart", + "packages/tanstackstart-react", "packages/types", "packages/typescript", "packages/vercel-edge", diff --git a/packages/tanstackstart-react/.eslintrc.js b/packages/tanstackstart-react/.eslintrc.js new file mode 100644 index 000000000000..54e8382b22a8 --- /dev/null +++ b/packages/tanstackstart-react/.eslintrc.js @@ -0,0 +1,10 @@ +module.exports = { + env: { + browser: true, + node: true, + }, + parserOptions: { + jsx: true, + }, + extends: ['../../.eslintrc.js'], +}; diff --git a/packages/tanstackstart-react/LICENSE b/packages/tanstackstart-react/LICENSE new file mode 100644 index 000000000000..0da96cd2f885 --- /dev/null +++ b/packages/tanstackstart-react/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Functional Software, Inc. dba Sentry + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/tanstackstart-react/README.md b/packages/tanstackstart-react/README.md new file mode 100644 index 000000000000..6d28df3ba6df --- /dev/null +++ b/packages/tanstackstart-react/README.md @@ -0,0 +1,52 @@ +

+ + Sentry + +

+ +# Official Sentry SDK for TanStack Start React (Alpha) + +[![npm version](https://img.shields.io/npm/v/@sentry/tanstackstart-react.svg)](https://www.npmjs.com/package/@sentry/tanstackstart-react) +[![npm dm](https://img.shields.io/npm/dm/@sentry/tanstackstart-react.svg)](https://www.npmjs.com/package/@sentry/tanstackstart-react) +[![npm dt](https://img.shields.io/npm/dt/@sentry/tanstackstart-react.svg)](https://www.npmjs.com/package/@sentry/tanstackstart-react) + +> NOTICE: This package is in alpha state and may be subject to breaking changes. + +## Getting Started + +This SDK does not have docs yet. Stay tuned. + +## Compatibility + +The minimum supported version of TanStack Start is `1.111.12`. + +## Custom Usage + +To set context information or to send manual events, you can use `@sentry/tanstackstart-react` as follows: + +```ts +import * as Sentry from '@sentry/tanstackstart-react'; + +// Set user information, as well as tags and further extras +Sentry.setTag('user_mode', 'admin'); +Sentry.setUser({ id: '4711' }); +Sentry.setContext('application_area', { location: 'checkout' }); + +// Add a breadcrumb for future events +Sentry.addBreadcrumb({ + message: '"Add to cart" clicked', + // ... +}); + +// Capture exceptions or messages +Sentry.captureException(new Error('Oh no.')); +Sentry.captureMessage('Hello, world!'); +``` + +## Links + + + +- [Sentry.io](https://sentry.io/?utm_source=github&utm_medium=npm_tanstackstartreact) +- [Sentry Discord Server](https://discord.gg/Ww9hbqr) +- [Stack Overflow](https://stackoverflow.com/questions/tagged/sentry) diff --git a/packages/tanstackstart-react/package.json b/packages/tanstackstart-react/package.json new file mode 100644 index 000000000000..7e36a332922e --- /dev/null +++ b/packages/tanstackstart-react/package.json @@ -0,0 +1,86 @@ +{ + "name": "@sentry/tanstackstart-react", + "version": "9.5.0", + "description": "Official Sentry SDK for TanStack Start React", + "repository": "git://github.com/getsentry/sentry-javascript.git", + "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/tanstackstart-react", + "author": "Sentry", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "main": "build/cjs/index.server.js", + "module": "build/esm/index.server.js", + "types": "build/types/index.types.d.ts", + "files": [ + "/build" + ], + "exports": { + "./package.json": "./package.json", + ".": { + "types": "./build/types/index.types.d.ts", + "browser": { + "import": "./build/esm/index.client.js", + "require": "./build/cjs/index.client.js" + }, + "node": { + "import": "./build/esm/index.server.js", + "require": "./build/cjs/index.server.js" + } + }, + "./import": { + "import": { + "default": "./build/import-hook.mjs" + } + }, + "./loader": { + "import": { + "default": "./build/loader-hook.mjs" + } + } + }, + "typesVersions": { + "<5.0": { + "build/npm/types/index.d.ts": [ + "build/npm/types-ts3.8/index.d.ts" + ] + } + }, + "publishConfig": { + "access": "public" + }, + "dependencies": { + "@opentelemetry/api": "^1.9.0", + "@opentelemetry/semantic-conventions": "^1.30.0", + "@sentry-internal/browser-utils": "9.5.0", + "@sentry/core": "9.5.0", + "@sentry/node": "9.5.0", + "@sentry/opentelemetry": "9.5.0", + "@sentry/react": "9.5.0" + }, + "scripts": { + "build": "run-p build:transpile build:types", + "build:dev": "yarn build", + "build:transpile": "rollup -c rollup.npm.config.mjs", + "build:types": "run-s build:types:core build:types:downlevel", + "build:types:core": "tsc -p tsconfig.types.json", + "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", + "build:watch": "run-p build:transpile:watch build:types:watch", + "build:dev:watch": "yarn build:watch", + "build:transpile:watch": "nodemon --ext ts --watch src scripts/buildRollup.ts", + "build:types:watch": "tsc -p tsconfig.types.json --watch", + "build:tarball": "npm pack", + "circularDepCheck": "madge --circular src/index.client.ts && madge --circular src/index.server.ts && madge --circular src/index.types.ts", + "clean": "rimraf build coverage sentry-tanstackstart-react-*.tgz", + "fix": "eslint . --format stylish --fix", + "lint": "eslint . --format stylish", + "test": "yarn test:unit", + "test:unit": "vitest run", + "test:watch": "vitest --watch", + "yalc:publish": "yalc publish --push --sig" + }, + "volta": { + "extends": "../../package.json" + }, + "sideEffects": false +} diff --git a/packages/tanstackstart-react/rollup.npm.config.mjs b/packages/tanstackstart-react/rollup.npm.config.mjs new file mode 100644 index 000000000000..3c1bae9abd07 --- /dev/null +++ b/packages/tanstackstart-react/rollup.npm.config.mjs @@ -0,0 +1,10 @@ +import { makeBaseNPMConfig, makeNPMConfigVariants, makeOtelLoaders } from '@sentry-internal/rollup-utils'; + +export default [ + ...makeNPMConfigVariants( + makeBaseNPMConfig({ + entrypoints: ['src/index.server.ts', 'src/index.client.ts', 'src/client/index.ts', 'src/server/index.ts'], + }), + ), + ...makeOtelLoaders('./build', 'sentry-node'), +]; diff --git a/packages/tanstackstart-react/src/client/index.ts b/packages/tanstackstart-react/src/client/index.ts new file mode 100644 index 000000000000..c45aad673ad0 --- /dev/null +++ b/packages/tanstackstart-react/src/client/index.ts @@ -0,0 +1 @@ +export * from '@sentry/react'; diff --git a/packages/tanstackstart-react/src/common/index.ts b/packages/tanstackstart-react/src/common/index.ts new file mode 100644 index 000000000000..d83c684d1523 --- /dev/null +++ b/packages/tanstackstart-react/src/common/index.ts @@ -0,0 +1,23 @@ +/** + * A middleware handler that can be passed to TanStack Start's `createMiddleware().server(...)` method as [global middleware](https://tanstack.com/start/latest/docs/framework/react/middleware#global-middleware) for instrumenting server functions. + */ +export function sentryGlobalServerMiddlewareHandler() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return function (server: { next: (...args: any[]) => T }): T { + return server.next(); + }; +} + +/** + * Wraps a TanStack Start stream handler with Sentry instrumentation that can be passed to `createStartHandler(...)`. + */ +export function wrapStreamHandlerWithSentry(handler: H): H { + return handler; +} + +/** + * Wraps the create root route function with Sentry for server-client tracing with SSR. + */ +export function wrapCreateRootRouteWithSentry(createRootRoute: F): F { + return createRootRoute; +} diff --git a/packages/tanstackstart-react/src/config/index.ts b/packages/tanstackstart-react/src/config/index.ts new file mode 100644 index 000000000000..579fe3c7db00 --- /dev/null +++ b/packages/tanstackstart-react/src/config/index.ts @@ -0,0 +1,16 @@ +/** + * Wraps a TanStack Start config. + */ +export function wrapVinxiConfigWithSentry( + config: C, + // TODO: Expand this type in the future. Right now it is just so that TS doesn't complain for our users when they copy paste from the docs. + // eslint-disable-next-line @typescript-eslint/no-unused-vars + sentryBuildOptions: { + org?: string; + project?: string; + silent?: boolean; + authToken?: boolean; + } = {}, +): C { + return config; +} diff --git a/packages/tanstackstart-react/src/index.client.ts b/packages/tanstackstart-react/src/index.client.ts new file mode 100644 index 000000000000..478066d2ce1e --- /dev/null +++ b/packages/tanstackstart-react/src/index.client.ts @@ -0,0 +1,2 @@ +export * from './client'; +export * from './common'; diff --git a/packages/tanstackstart-react/src/index.server.ts b/packages/tanstackstart-react/src/index.server.ts new file mode 100644 index 000000000000..3295df71604b --- /dev/null +++ b/packages/tanstackstart-react/src/index.server.ts @@ -0,0 +1,3 @@ +export * from './config'; +export * from './server'; +export * from './common'; diff --git a/packages/tanstackstart-react/src/index.types.ts b/packages/tanstackstart-react/src/index.types.ts new file mode 100644 index 000000000000..84a987788d17 --- /dev/null +++ b/packages/tanstackstart-react/src/index.types.ts @@ -0,0 +1,27 @@ +// We export everything from both the client part of the SDK and from the server part. Some of the exports collide, +// which is not allowed, unless we redefine the colliding exports in this file - which we do below. +export * from './config'; +export * from './client'; +export * from './server'; +export * from './common'; + +import type { Client, Integration, Options, StackParser } from '@sentry/core'; + +import type * as clientSdk from './client'; +import type * as serverSdk from './server'; + +/** Initializes Sentry TanStack Start SDK */ +export declare function init(options: Options | clientSdk.BrowserOptions | serverSdk.NodeOptions): Client | undefined; + +export declare const linkedErrorsIntegration: typeof clientSdk.linkedErrorsIntegration; +export declare const contextLinesIntegration: typeof clientSdk.contextLinesIntegration; + +export declare const getDefaultIntegrations: (options: Options) => Integration[]; +export declare const defaultStackParser: StackParser; + +export declare function getSentryRelease(fallback?: string): string | undefined; + +export declare const ErrorBoundary: typeof clientSdk.ErrorBoundary; +export declare const createReduxEnhancer: typeof clientSdk.createReduxEnhancer; +export declare const showReportDialog: typeof clientSdk.showReportDialog; +export declare const withErrorBoundary: typeof clientSdk.withErrorBoundary; diff --git a/packages/tanstackstart-react/src/server/index.ts b/packages/tanstackstart-react/src/server/index.ts new file mode 100644 index 000000000000..91f80547f143 --- /dev/null +++ b/packages/tanstackstart-react/src/server/index.ts @@ -0,0 +1,42 @@ +export * from '@sentry/node'; + +/** + * A passthrough error boundary for the server that doesn't depend on any react. Error boundaries don't catch SSR errors + * so they should simply be a passthrough. + */ +export const ErrorBoundary = (props: React.PropsWithChildren): React.ReactNode => { + if (!props.children) { + return null; + } + + if (typeof props.children === 'function') { + return (props.children as () => React.ReactNode)(); + } + + return props.children; +}; + +/** + * A passthrough redux enhancer for the server that doesn't depend on anything from the `@sentry/react` package. + */ +export function createReduxEnhancer() { + return (createStore: unknown) => createStore; +} + +/** + * A passthrough error boundary wrapper for the server that doesn't depend on any react. Error boundaries don't catch + * SSR errors so they should simply be a passthrough. + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export function withErrorBoundary

>( + WrappedComponent: React.ComponentType

, +): React.FC

{ + return WrappedComponent as React.FC

; +} + +/** + * Just a passthrough since we're on the server and showing the report dialog on the server doesn't make any sense. + */ +export function showReportDialog(): void { + return; +} diff --git a/packages/tanstackstart-react/test/temp.test.ts b/packages/tanstackstart-react/test/temp.test.ts new file mode 100644 index 000000000000..28874b0d1c84 --- /dev/null +++ b/packages/tanstackstart-react/test/temp.test.ts @@ -0,0 +1,7 @@ +import { describe, it, expect } from 'vitest'; + +describe('Basic test suite', () => { + it('should pass', () => { + expect(true).toBe(true); + }); +}); diff --git a/packages/tanstackstart-react/test/tsconfig.json b/packages/tanstackstart-react/test/tsconfig.json new file mode 100644 index 000000000000..38ca0b13bcdd --- /dev/null +++ b/packages/tanstackstart-react/test/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.test.json" +} diff --git a/packages/tanstackstart-react/tsconfig.json b/packages/tanstackstart-react/tsconfig.json new file mode 100644 index 000000000000..20cf507e5203 --- /dev/null +++ b/packages/tanstackstart-react/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.json", + "include": ["src/**/*"], + "compilerOptions": { + "lib": ["es2018", "es2020.string"], + "module": "Node16" + } +} diff --git a/packages/tanstackstart-react/tsconfig.test.json b/packages/tanstackstart-react/tsconfig.test.json new file mode 100644 index 000000000000..bbbebba51d18 --- /dev/null +++ b/packages/tanstackstart-react/tsconfig.test.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "include": ["test/**/*", "vite.config.ts"], + "compilerOptions": { + "types": ["node"], + "lib": ["DOM", "ESNext"] + } +} diff --git a/packages/tanstackstart-react/tsconfig.types.json b/packages/tanstackstart-react/tsconfig.types.json new file mode 100644 index 000000000000..b1a51db073c2 --- /dev/null +++ b/packages/tanstackstart-react/tsconfig.types.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "build/types" + } +} diff --git a/packages/tanstackstart-react/vite.config.ts b/packages/tanstackstart-react/vite.config.ts new file mode 100644 index 000000000000..f18ec92095bc --- /dev/null +++ b/packages/tanstackstart-react/vite.config.ts @@ -0,0 +1,8 @@ +import baseConfig from '../../vite/vite.config'; + +export default { + ...baseConfig, + test: { + ...baseConfig.test, + }, +}; diff --git a/packages/tanstackstart/README.md b/packages/tanstackstart/README.md index 35e369cf25e9..e5ef2c111dd6 100644 --- a/packages/tanstackstart/README.md +++ b/packages/tanstackstart/README.md @@ -4,49 +4,19 @@

-# Official Sentry SDK for TanStack Start (Alpha) +# Utilities for the Sentry TanStack Start SDKs [![npm version](https://img.shields.io/npm/v/@sentry/tanstackstart.svg)](https://www.npmjs.com/package/@sentry/tanstackstart) [![npm dm](https://img.shields.io/npm/dm/@sentry/tanstackstart.svg)](https://www.npmjs.com/package/@sentry/tanstackstart) [![npm dt](https://img.shields.io/npm/dt/@sentry/tanstackstart.svg)](https://www.npmjs.com/package/@sentry/tanstackstart) -> NOTICE: This package is in alpha state and may be subject to breaking changes. +> NOTICE: This package is a package that contains SDK internals and does not follow semantic versioning. Use with caution. -## Getting Started - -This SDK does not have docs yet. Stay tuned. - -## Compatibility - -The minimum supported version of TanStack Start is `1.111.12`. - -## Custom Usage - -To set context information or to send manual events, you can use `@sentry/tanstackstart` as follows: - -```ts -import * as Sentry from '@sentry/tanstackstart'; - -// Set user information, as well as tags and further extras -Sentry.setTag('user_mode', 'admin'); -Sentry.setUser({ id: '4711' }); -Sentry.setContext('application_area', { location: 'checkout' }); - -// Add a breadcrumb for future events -Sentry.addBreadcrumb({ - message: '"Add to cart" clicked', - // ... -}); - -// Capture exceptions or messages -Sentry.captureException(new Error('Oh no.')); -Sentry.captureMessage('Hello, world!'); -``` +This package contains shared utilities for Sentry TanStack Start SDKs. +If you are looking for the actual TanStack Start React SDK package, see: https://www.npmjs.com/package/@sentry/tanstackstart-react ## Links - - - [Sentry.io](https://sentry.io/?utm_source=github&utm_medium=npm_tanstackstart) - [Sentry Discord Server](https://discord.gg/Ww9hbqr) - [Stack Overflow](https://stackoverflow.com/questions/tagged/sentry) diff --git a/packages/tanstackstart/package.json b/packages/tanstackstart/package.json index 992a07d9c6eb..766a85278741 100644 --- a/packages/tanstackstart/package.json +++ b/packages/tanstackstart/package.json @@ -1,7 +1,7 @@ { "name": "@sentry/tanstackstart", "version": "9.5.0", - "description": "Official Sentry SDK for TanStack Start", + "description": "Utilities for the Sentry TanStack Start SDKs", "repository": "git://github.com/getsentry/sentry-javascript.git", "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/tanstackstart", "author": "Sentry", @@ -27,16 +27,6 @@ "import": "./build/esm/index.server.js", "require": "./build/cjs/index.server.js" } - }, - "./import": { - "import": { - "default": "./build/import-hook.mjs" - } - }, - "./loader": { - "import": { - "default": "./build/loader-hook.mjs" - } } }, "typesVersions": { @@ -49,15 +39,7 @@ "publishConfig": { "access": "public" }, - "dependencies": { - "@opentelemetry/api": "^1.9.0", - "@opentelemetry/semantic-conventions": "^1.30.0", - "@sentry-internal/browser-utils": "9.5.0", - "@sentry/core": "9.5.0", - "@sentry/node": "9.5.0", - "@sentry/opentelemetry": "9.5.0", - "@sentry/react": "9.5.0" - }, + "dependencies": {}, "scripts": { "build": "run-p build:transpile build:types", "build:dev": "yarn build", diff --git a/packages/tanstackstart/rollup.npm.config.mjs b/packages/tanstackstart/rollup.npm.config.mjs index 9b334bdbae41..25850a8309c6 100644 --- a/packages/tanstackstart/rollup.npm.config.mjs +++ b/packages/tanstackstart/rollup.npm.config.mjs @@ -1,4 +1,4 @@ -import { makeBaseNPMConfig, makeNPMConfigVariants, makeOtelLoaders } from '@sentry-internal/rollup-utils'; +import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils'; export default [ ...makeNPMConfigVariants( @@ -12,5 +12,4 @@ export default [ ], }), ), - ...makeOtelLoaders('./build', 'sentry-node'), ]; diff --git a/packages/tanstackstart/src/client/index.ts b/packages/tanstackstart/src/client/index.ts index c45aad673ad0..cb0ff5c3b541 100644 --- a/packages/tanstackstart/src/client/index.ts +++ b/packages/tanstackstart/src/client/index.ts @@ -1 +1 @@ -export * from '@sentry/react'; +export {}; diff --git a/packages/tanstackstart/src/common/index.ts b/packages/tanstackstart/src/common/index.ts index d83c684d1523..cb0ff5c3b541 100644 --- a/packages/tanstackstart/src/common/index.ts +++ b/packages/tanstackstart/src/common/index.ts @@ -1,23 +1 @@ -/** - * A middleware handler that can be passed to TanStack Start's `createMiddleware().server(...)` method as [global middleware](https://tanstack.com/start/latest/docs/framework/react/middleware#global-middleware) for instrumenting server functions. - */ -export function sentryGlobalServerMiddlewareHandler() { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return function (server: { next: (...args: any[]) => T }): T { - return server.next(); - }; -} - -/** - * Wraps a TanStack Start stream handler with Sentry instrumentation that can be passed to `createStartHandler(...)`. - */ -export function wrapStreamHandlerWithSentry(handler: H): H { - return handler; -} - -/** - * Wraps the create root route function with Sentry for server-client tracing with SSR. - */ -export function wrapCreateRootRouteWithSentry(createRootRoute: F): F { - return createRootRoute; -} +export {}; diff --git a/packages/tanstackstart/src/config/index.ts b/packages/tanstackstart/src/config/index.ts index 579fe3c7db00..cb0ff5c3b541 100644 --- a/packages/tanstackstart/src/config/index.ts +++ b/packages/tanstackstart/src/config/index.ts @@ -1,16 +1 @@ -/** - * Wraps a TanStack Start config. - */ -export function wrapVinxiConfigWithSentry( - config: C, - // TODO: Expand this type in the future. Right now it is just so that TS doesn't complain for our users when they copy paste from the docs. - // eslint-disable-next-line @typescript-eslint/no-unused-vars - sentryBuildOptions: { - org?: string; - project?: string; - silent?: boolean; - authToken?: boolean; - } = {}, -): C { - return config; -} +export {}; diff --git a/packages/tanstackstart/src/index.types.ts b/packages/tanstackstart/src/index.types.ts index 84a987788d17..13fa9080e92a 100644 --- a/packages/tanstackstart/src/index.types.ts +++ b/packages/tanstackstart/src/index.types.ts @@ -4,24 +4,3 @@ export * from './config'; export * from './client'; export * from './server'; export * from './common'; - -import type { Client, Integration, Options, StackParser } from '@sentry/core'; - -import type * as clientSdk from './client'; -import type * as serverSdk from './server'; - -/** Initializes Sentry TanStack Start SDK */ -export declare function init(options: Options | clientSdk.BrowserOptions | serverSdk.NodeOptions): Client | undefined; - -export declare const linkedErrorsIntegration: typeof clientSdk.linkedErrorsIntegration; -export declare const contextLinesIntegration: typeof clientSdk.contextLinesIntegration; - -export declare const getDefaultIntegrations: (options: Options) => Integration[]; -export declare const defaultStackParser: StackParser; - -export declare function getSentryRelease(fallback?: string): string | undefined; - -export declare const ErrorBoundary: typeof clientSdk.ErrorBoundary; -export declare const createReduxEnhancer: typeof clientSdk.createReduxEnhancer; -export declare const showReportDialog: typeof clientSdk.showReportDialog; -export declare const withErrorBoundary: typeof clientSdk.withErrorBoundary; diff --git a/packages/tanstackstart/src/server/index.ts b/packages/tanstackstart/src/server/index.ts index 91f80547f143..cb0ff5c3b541 100644 --- a/packages/tanstackstart/src/server/index.ts +++ b/packages/tanstackstart/src/server/index.ts @@ -1,42 +1 @@ -export * from '@sentry/node'; - -/** - * A passthrough error boundary for the server that doesn't depend on any react. Error boundaries don't catch SSR errors - * so they should simply be a passthrough. - */ -export const ErrorBoundary = (props: React.PropsWithChildren): React.ReactNode => { - if (!props.children) { - return null; - } - - if (typeof props.children === 'function') { - return (props.children as () => React.ReactNode)(); - } - - return props.children; -}; - -/** - * A passthrough redux enhancer for the server that doesn't depend on anything from the `@sentry/react` package. - */ -export function createReduxEnhancer() { - return (createStore: unknown) => createStore; -} - -/** - * A passthrough error boundary wrapper for the server that doesn't depend on any react. Error boundaries don't catch - * SSR errors so they should simply be a passthrough. - */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any -export function withErrorBoundary

>( - WrappedComponent: React.ComponentType

, -): React.FC

{ - return WrappedComponent as React.FC

; -} - -/** - * Just a passthrough since we're on the server and showing the report dialog on the server doesn't make any sense. - */ -export function showReportDialog(): void { - return; -} +export {}; diff --git a/yarn.lock b/yarn.lock index 549b2e4eba54..20df35f2b9d5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10879,7 +10879,16 @@ aws-ssl-profiles@^1.1.1: resolved "https://registry.yarnpkg.com/aws-ssl-profiles/-/aws-ssl-profiles-1.1.2.tgz#157dd77e9f19b1d123678e93f120e6f193022641" integrity sha512-NZKeq9AfyQvEeNlN0zSYAaWrmBffJh3IELMZfRpJVWgrpEbtEpnjvzqBPf+mxoI287JohRDoa+/nsfqqiZmF6g== -axios@1.7.7, axios@^1.0.0, axios@^1.7.7: +axios@1.8.2: + version "1.8.2" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.8.2.tgz#fabe06e241dfe83071d4edfbcaa7b1c3a40f7979" + integrity sha512-ls4GYBm5aig9vWx8AWDSGLpnpDQRtWAfrjU+EuytuODrFBkqesN2RkOQCBzrA1RQNHw1SmRMSDDDSwzNAYQ6Rg== + dependencies: + follow-redirects "^1.15.6" + form-data "^4.0.0" + proxy-from-env "^1.1.0" + +axios@^1.0.0, axios@^1.7.7: version "1.7.7" resolved "https://registry.yarnpkg.com/axios/-/axios-1.7.7.tgz#2f554296f9892a72ac8d8e4c5b79c14a91d0a47f" integrity sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q== From 47f95e5dc575e26d2959f57c1a050ceb4fff2cc3 Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Tue, 11 Mar 2025 17:27:34 +0100 Subject: [PATCH 14/24] fix(core): Ensure `fill` only patches functions (#15632) --- .../browser-utils/src/instrument/history.ts | 5 +- .../test/instrument/history.test.ts | 58 +++++++++++++++++++ packages/core/src/utils-hoist/object.ts | 10 +++- packages/core/src/utils-hoist/supports.ts | 2 +- packages/core/test/utils-hoist/object.test.ts | 13 +++++ .../core/test/utils-hoist/supports.test.ts | 32 ++++++++++ 6 files changed, 117 insertions(+), 3 deletions(-) create mode 100644 packages/browser-utils/test/instrument/history.test.ts create mode 100644 packages/core/test/utils-hoist/supports.test.ts diff --git a/packages/browser-utils/src/instrument/history.ts b/packages/browser-utils/src/instrument/history.ts index 8494fca3076e..60ee888aae24 100644 --- a/packages/browser-utils/src/instrument/history.ts +++ b/packages/browser-utils/src/instrument/history.ts @@ -18,7 +18,10 @@ export function addHistoryInstrumentationHandler(handler: (data: HandlerDataHist maybeInstrument(type, instrumentHistory); } -function instrumentHistory(): void { +/** + * Exported just for testing + */ +export function instrumentHistory(): void { // The `popstate` event may also be triggered on `pushState`, but it may not always reliably be emitted by the browser // Which is why we also monkey-patch methods below, in addition to this WINDOW.addEventListener('popstate', () => { diff --git a/packages/browser-utils/test/instrument/history.test.ts b/packages/browser-utils/test/instrument/history.test.ts new file mode 100644 index 000000000000..9d9ffd5b0686 --- /dev/null +++ b/packages/browser-utils/test/instrument/history.test.ts @@ -0,0 +1,58 @@ +import { describe, expect, it, vi } from 'vitest'; +import { WINDOW } from '../../src/types'; +import { afterEach } from 'node:test'; + +import { instrumentHistory } from './../../src/instrument/history'; + +describe('instrumentHistory', () => { + const originalHistory = WINDOW.history; + WINDOW.addEventListener = vi.fn(); + + afterEach(() => { + // @ts-expect-error - this is fine for testing + WINDOW.history = originalHistory; + }); + + it("doesn't throw if history is not available", () => { + // @ts-expect-error - this is fine for testing + WINDOW.history = undefined; + expect(instrumentHistory).not.toThrow(); + expect(WINDOW.history).toBe(undefined); + }); + + it('adds an event listener for popstate', () => { + // adds an event listener for popstate + expect(WINDOW.addEventListener).toHaveBeenCalledTimes(1); + expect(WINDOW.addEventListener).toHaveBeenCalledWith('popstate', expect.any(Function)); + }); + + it("doesn't throw if history.pushState is not a function", () => { + // @ts-expect-error - only partially adding history properties + WINDOW.history = { + replaceState: () => {}, + pushState: undefined, + }; + + expect(instrumentHistory).not.toThrow(); + + expect(WINDOW.history).toEqual({ + replaceState: expect.any(Function), // patched function + pushState: undefined, // unpatched + }); + }); + + it("doesn't throw if history.replaceState is not a function", () => { + // @ts-expect-error - only partially adding history properties + WINDOW.history = { + replaceState: undefined, + pushState: () => {}, + }; + + expect(instrumentHistory).not.toThrow(); + + expect(WINDOW.history).toEqual({ + replaceState: undefined, // unpatched + pushState: expect.any(Function), // patched function + }); + }); +}); diff --git a/packages/core/src/utils-hoist/object.ts b/packages/core/src/utils-hoist/object.ts index 31d1d862d01f..2c9080682a9d 100644 --- a/packages/core/src/utils-hoist/object.ts +++ b/packages/core/src/utils-hoist/object.ts @@ -10,6 +10,8 @@ import { truncate } from './string'; /** * Replace a method in an object with a wrapped version of itself. * + * If the method on the passed object is not a function, the wrapper will not be applied. + * * @param source An object that contains a method to be wrapped. * @param name The name of the method to be wrapped. * @param replacementFactory A higher-order function that takes the original version of the given method and returns a @@ -23,7 +25,13 @@ export function fill(source: { [key: string]: any }, name: string, replacementFa return; } - const original = source[name] as () => any; + // explicitly casting to unknown because we don't know the type of the method initially at all + const original = source[name] as unknown; + + if (typeof original !== 'function') { + return; + } + const wrapped = replacementFactory(original) as WrappedFunction; // Make sure it's a function first, as we need to attach an empty prototype for `defineProperties` to work diff --git a/packages/core/src/utils-hoist/supports.ts b/packages/core/src/utils-hoist/supports.ts index d52c06e702ea..e486d672a625 100644 --- a/packages/core/src/utils-hoist/supports.ts +++ b/packages/core/src/utils-hoist/supports.ts @@ -61,7 +61,7 @@ export function supportsDOMException(): boolean { * @returns Answer to the given question. */ export function supportsHistory(): boolean { - return 'history' in WINDOW; + return 'history' in WINDOW && !!WINDOW.history; } /** diff --git a/packages/core/test/utils-hoist/object.test.ts b/packages/core/test/utils-hoist/object.test.ts index 668d071108f9..e1c32f163193 100644 --- a/packages/core/test/utils-hoist/object.test.ts +++ b/packages/core/test/utils-hoist/object.test.ts @@ -54,6 +54,19 @@ describe('fill()', () => { expect(source.prop()).toEqual(41); }); + test.each([42, null, undefined, {}])("does't throw if the property is not a function but %s", (propValue: any) => { + const source = { + foo: propValue, + }; + const name = 'foo'; + const replacement = vi.fn().mockImplementationOnce(cb => cb); + + fill(source, name, replacement); + + expect(source.foo).toBe(propValue); + expect(replacement).not.toBeCalled(); + }); + test('can do anything inside replacement function', () => { const source = { foo: (): number => 42, diff --git a/packages/core/test/utils-hoist/supports.test.ts b/packages/core/test/utils-hoist/supports.test.ts new file mode 100644 index 000000000000..b2b444ab9b99 --- /dev/null +++ b/packages/core/test/utils-hoist/supports.test.ts @@ -0,0 +1,32 @@ +import { afterEach } from 'node:test'; +import { supportsHistory } from '../../src/utils-hoist/supports'; +import { describe, it, expect } from 'vitest'; + +describe('supportsHistory', () => { + const originalHistory = globalThis.history; + + afterEach(() => { + globalThis.history = originalHistory; + }); + + it('returns true if history is available', () => { + // @ts-expect-error - not setting all history properties + globalThis.history = { + pushState: () => {}, + replaceState: () => {}, + }; + expect(supportsHistory()).toBe(true); + }); + + it('returns false if history is not available', () => { + // @ts-expect-error - deletion is okay in this case + delete globalThis.history; + expect(supportsHistory()).toBe(false); + }); + + it('returns false if history is undefined', () => { + // @ts-expect-error - undefined is okay in this case + globalThis.history = undefined; + expect(supportsHistory()).toBe(false); + }); +}); From 9e0b4c01b993b835c0af4a346a2595d8d7f78246 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Tue, 11 Mar 2025 17:55:14 -0400 Subject: [PATCH 15/24] chore: Fix link in migration doc --- MIGRATION.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MIGRATION.md b/MIGRATION.md index cbd2a282db99..7f3160a59466 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -5,7 +5,7 @@ These docs walk through how to migrate our JavaScript SDKs through different maj - Upgrading from [SDK 4.x to 5.x/6.x](./docs/migration/v4-to-v5_v6.md) - Upgrading from [SDK 6.x to 7.x](./docs/migration/v6-to-v7.md) - Upgrading from [SDK 7.x to 8.x](./docs/migration/v7-to-v8.md) -- Upgrading from [SDK 8.x to 9.x](./docs/migration/v8-to-v9.md#upgrading-from-7x-to-8x) +- Upgrading from [SDK 8.x to 9.x](#upgrading-from-8x-to-9x) # Upgrading from 8.x to 9.x From 9cb8684c90bcaf4b182d1c0defdeb55f3efe5d65 Mon Sep 17 00:00:00 2001 From: Angelika Cathor Date: Thu, 13 Mar 2025 10:23:02 +0100 Subject: [PATCH 16/24] feat(astro): Accept all vite-plugin options (#15638) Adds support for `unstable_sentryVitePluginOptions` which can be used to pass any valid vite-plugin option to the Astro integration. --- packages/astro/src/integration/index.ts | 17 +++--- packages/astro/src/integration/types.ts | 15 ++++++ packages/astro/test/integration/index.test.ts | 53 +++++++++++++++++++ 3 files changed, 78 insertions(+), 7 deletions(-) diff --git a/packages/astro/src/integration/index.ts b/packages/astro/src/integration/index.ts index 79b74b8804c1..fb26e956daeb 100644 --- a/packages/astro/src/integration/index.ts +++ b/packages/astro/src/integration/index.ts @@ -30,7 +30,7 @@ export const sentryAstro = (options: SentryOptions = {}): AstroIntegration => { }; const sourceMapsNeeded = sdkEnabled.client || sdkEnabled.server; - const uploadOptions = options.sourceMapsUploadOptions || {}; + const { unstable_sentryVitePluginOptions, ...uploadOptions } = options.sourceMapsUploadOptions || {}; const shouldUploadSourcemaps = (sourceMapsNeeded && uploadOptions?.enabled) ?? true; // We don't need to check for AUTH_TOKEN here, because the plugin will pick it up from the env @@ -68,23 +68,26 @@ export const sentryAstro = (options: SentryOptions = {}): AstroIntegration => { project: uploadOptions.project ?? env.SENTRY_PROJECT, authToken: uploadOptions.authToken ?? env.SENTRY_AUTH_TOKEN, telemetry: uploadOptions.telemetry ?? true, + _metaOptions: { + telemetry: { + metaFramework: 'astro', + }, + }, + ...unstable_sentryVitePluginOptions, + debug: options.debug ?? false, sourcemaps: { assets: uploadOptions.assets ?? [getSourcemapsAssetsGlob(config)], filesToDeleteAfterUpload: uploadOptions?.filesToDeleteAfterUpload ?? updatedFilesToDeleteAfterUpload, + ...unstable_sentryVitePluginOptions?.sourcemaps, }, bundleSizeOptimizations: { ...options.bundleSizeOptimizations, // TODO: with a future version of the vite plugin (probably 2.22.0) this re-mapping is not needed anymore // ref: https://github.com/getsentry/sentry-javascript-bundler-plugins/pull/582 excludePerformanceMonitoring: options.bundleSizeOptimizations?.excludeTracing, + ...unstable_sentryVitePluginOptions?.bundleSizeOptimizations, }, - _metaOptions: { - telemetry: { - metaFramework: 'astro', - }, - }, - debug: options.debug ?? false, }), ), ], diff --git a/packages/astro/src/integration/types.ts b/packages/astro/src/integration/types.ts index 6c2e41808eca..5b5308e3a474 100644 --- a/packages/astro/src/integration/types.ts +++ b/packages/astro/src/integration/types.ts @@ -1,5 +1,6 @@ import type { BrowserOptions } from '@sentry/browser'; import type { Options } from '@sentry/core'; +import type { SentryVitePluginOptions } from '@sentry/vite-plugin'; type SdkInitPaths = { /** @@ -83,6 +84,20 @@ type SourceMapsOptions = { * The globbing patterns follow the implementation of the glob package. (https://www.npmjs.com/package/glob) */ filesToDeleteAfterUpload?: string | Array; + + /** + * Options to further customize the Sentry Vite Plugin (@sentry/vite-plugin) behavior directly. + * Options specified in this object take precedence over all other options. + * + * @see https://www.npmjs.com/package/@sentry/vite-plugin/v/2.14.2#options which lists all available options. + * + * Warning: Options within this object are subject to change at any time. + * We DO NOT guarantee semantic versioning for these options, meaning breaking + * changes can occur at any time within a major SDK version. + * + * Furthermore, some options are untested with Astro specifically. Use with caution. + */ + unstable_sentryVitePluginOptions?: Partial; }; type BundleSizeOptimizationOptions = { diff --git a/packages/astro/test/integration/index.test.ts b/packages/astro/test/integration/index.test.ts index 6684a841ba4e..01d86e85baee 100644 --- a/packages/astro/test/integration/index.test.ts +++ b/packages/astro/test/integration/index.test.ts @@ -202,6 +202,59 @@ describe('sentryAstro integration', () => { ); }); + it('prefers user-specified unstable vite plugin options and merges them with default values', async () => { + const integration = sentryAstro({ + bundleSizeOptimizations: { + excludeReplayShadowDom: true, + }, + sourceMapsUploadOptions: { + enabled: true, + org: 'my-org', + project: 'my-project', + assets: ['dist/server/**/*, dist/client/**/*'], + unstable_sentryVitePluginOptions: { + org: 'my-other-org', + project: 'my-other-project', + applicationKey: 'my-application-key', + sourcemaps: { + assets: ['foo/*.js'], + ignore: ['bar/*.js'], + }, + bundleSizeOptimizations: { + excludeReplayIframe: true, + }, + }, + }, + }); + // @ts-expect-error - the hook exists, and we only need to pass what we actually use + await integration.hooks['astro:config:setup']({ + updateConfig, + injectScript, + // @ts-expect-error - only passing in partial config + config: { + outDir: new URL('file://path/to/project/build'), + }, + }); + + expect(sentryVitePluginSpy).toHaveBeenCalledTimes(1); + expect(sentryVitePluginSpy).toHaveBeenCalledWith( + expect.objectContaining({ + org: 'my-other-org', + project: 'my-other-project', + applicationKey: 'my-application-key', + sourcemaps: { + assets: ['foo/*.js'], + ignore: ['bar/*.js'], + filesToDeleteAfterUpload: ['./dist/**/client/**/*.map', './dist/**/server/**/*.map'], + }, + bundleSizeOptimizations: { + excludeReplayShadowDom: true, + excludeReplayIframe: true, + }, + }), + ); + }); + it("doesn't enable source maps if `sourceMapsUploadOptions.enabled` is `false`", async () => { const integration = sentryAstro({ sourceMapsUploadOptions: { enabled: false }, From ce1ced81724539fe8ca047ecc54a2f64cdec4769 Mon Sep 17 00:00:00 2001 From: Daniel Griesser Date: Thu, 13 Mar 2025 10:38:01 +0100 Subject: [PATCH 17/24] chore: Add external contributor to CHANGELOG.md (#15640) This PR adds the external contributor to the CHANGELOG.md file, so that they are credited for their contribution. See #15638 Co-authored-by: Lms24 <8420481+Lms24@users.noreply.github.com> --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cef0ee776afe..8859e968d9e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ - "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott +Work in this release was contributed by @angelikatyborska. Thank you for your contribution! + ## 9.5.0 ### Important Changes From 5c4cab7b34c736ecd5c029048ba14181dabaaa9f Mon Sep 17 00:00:00 2001 From: Nathan Sarang-Walters Date: Thu, 13 Mar 2025 02:43:02 -0700 Subject: [PATCH 18/24] chore(deps): Deduplicate `@babel` dependencies (#15639) Splitting this out of #15119 in the hope that gradually deduping things will help identify which dependency is causing the Next E2E tests to fail in that PR. --- yarn.lock | 281 +++++++++++------------------------------------------- 1 file changed, 55 insertions(+), 226 deletions(-) diff --git a/yarn.lock b/yarn.lock index 20df35f2b9d5..6cabcaaf3e41 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1273,7 +1273,7 @@ dependencies: "@babel/highlight" "^7.10.4" -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.18.6", "@babel/code-frame@^7.23.5", "@babel/code-frame@^7.24.2", "@babel/code-frame@^7.25.9", "@babel/code-frame@^7.26.0", "@babel/code-frame@^7.26.2": +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.18.6", "@babel/code-frame@^7.23.5", "@babel/code-frame@^7.24.2", "@babel/code-frame@^7.26.2": version "7.26.2" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.26.2.tgz#4b5fab97d33338eff916235055f0ebc21e573a85" integrity sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ== @@ -1282,12 +1282,7 @@ js-tokens "^4.0.0" picocolors "^1.0.0" -"@babel/compat-data@^7.17.7", "@babel/compat-data@^7.18.8", "@babel/compat-data@^7.20.5", "@babel/compat-data@^7.22.6", "@babel/compat-data@^7.24.4", "@babel/compat-data@^7.25.9": - version "7.26.0" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.26.0.tgz#f02ba6d34e88fadd5e8861e8b38902f43cc1c819" - integrity sha512-qETICbZSLe7uXv9VE8T/RWOdIE5qqyTucOt4zLYMafj2MRO271VGgLd4RACJMeBO37UPWhXiKMBk7YlJ0fOzQA== - -"@babel/compat-data@^7.26.5": +"@babel/compat-data@^7.17.7", "@babel/compat-data@^7.18.8", "@babel/compat-data@^7.20.5", "@babel/compat-data@^7.22.6", "@babel/compat-data@^7.24.4", "@babel/compat-data@^7.26.5": version "7.26.8" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.26.8.tgz#821c1d35641c355284d4a870b8a4a7b0c141e367" integrity sha512-oH5UPLMWR3L2wEFLnFJ1TZXqHufiTKAiLfqw5zkhS4dKXLJ10yVztfil/twG8EDTA4F/tvVNw9nOl4ZMslB8rQ== @@ -1313,28 +1308,7 @@ json5 "^2.2.1" semver "^6.3.0" -"@babel/core@^7.1.0", "@babel/core@^7.12.0", "@babel/core@^7.12.3", "@babel/core@^7.16.10", "@babel/core@^7.16.7", "@babel/core@^7.17.2", "@babel/core@^7.17.5", "@babel/core@^7.18.5", "@babel/core@^7.21.0", "@babel/core@^7.22.10", "@babel/core@^7.23.0", "@babel/core@^7.23.3", "@babel/core@^7.23.7", "@babel/core@^7.24.4", "@babel/core@^7.24.7", "@babel/core@^7.3.4", "@babel/core@^7.7.2", "@babel/core@^7.8.0": - version "7.26.0" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.26.0.tgz#d78b6023cc8f3114ccf049eb219613f74a747b40" - integrity sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg== - dependencies: - "@ampproject/remapping" "^2.2.0" - "@babel/code-frame" "^7.26.0" - "@babel/generator" "^7.26.0" - "@babel/helper-compilation-targets" "^7.25.9" - "@babel/helper-module-transforms" "^7.26.0" - "@babel/helpers" "^7.26.0" - "@babel/parser" "^7.26.0" - "@babel/template" "^7.25.9" - "@babel/traverse" "^7.25.9" - "@babel/types" "^7.26.0" - convert-source-map "^2.0.0" - debug "^4.1.0" - gensync "^1.0.0-beta.2" - json5 "^2.2.3" - semver "^6.3.1" - -"@babel/core@^7.21.8": +"@babel/core@^7.1.0", "@babel/core@^7.12.0", "@babel/core@^7.12.3", "@babel/core@^7.16.10", "@babel/core@^7.16.7", "@babel/core@^7.17.2", "@babel/core@^7.17.5", "@babel/core@^7.18.5", "@babel/core@^7.21.0", "@babel/core@^7.21.8", "@babel/core@^7.22.10", "@babel/core@^7.23.0", "@babel/core@^7.23.3", "@babel/core@^7.23.7", "@babel/core@^7.24.4", "@babel/core@^7.24.7", "@babel/core@^7.3.4", "@babel/core@^7.7.2", "@babel/core@^7.8.0": version "7.26.9" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.26.9.tgz#71838542a4b1e49dfed353d7acbc6eb89f4a76f2" integrity sha512-lWBYIrF7qK5+GjY5Uy+/hEgp8OJWOD/rpy74GplYRhEauvbHDeFB8t5hPOZxCZ0Oxf4Cc36tK51/l3ymJysrKw== @@ -1364,18 +1338,7 @@ "@jridgewell/gen-mapping" "^0.3.2" jsesc "^2.5.1" -"@babel/generator@^7.18.10", "@babel/generator@^7.22.10", "@babel/generator@^7.23.6", "@babel/generator@^7.26.0", "@babel/generator@^7.26.3", "@babel/generator@^7.7.2": - version "7.26.3" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.26.3.tgz#ab8d4360544a425c90c248df7059881f4b2ce019" - integrity sha512-6FF/urZvD0sTeO7k6/B15pMLC4CHUv1426lzr3N01aHJTl046uCAh9LXW/fzeXXjPNCJ6iABW5XaWOsIZB93aQ== - dependencies: - "@babel/parser" "^7.26.3" - "@babel/types" "^7.26.3" - "@jridgewell/gen-mapping" "^0.3.5" - "@jridgewell/trace-mapping" "^0.3.25" - jsesc "^3.0.2" - -"@babel/generator@^7.21.5", "@babel/generator@^7.26.9": +"@babel/generator@^7.18.10", "@babel/generator@^7.21.5", "@babel/generator@^7.22.10", "@babel/generator@^7.23.6", "@babel/generator@^7.26.9", "@babel/generator@^7.7.2": version "7.26.9" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.26.9.tgz#75a9482ad3d0cc7188a537aa4910bc59db67cbca" integrity sha512-kEWdzjOAUMW4hAyrzJ0ZaTOu9OmpyDIQicIh0zg0EEcEkYXZb2TjtBhnHi2ViX7PKwZqF4xwqfAm299/QMP3lg== @@ -1393,14 +1356,7 @@ dependencies: "@babel/types" "^7.18.6" -"@babel/helper-annotate-as-pure@^7.18.6", "@babel/helper-annotate-as-pure@^7.22.5", "@babel/helper-annotate-as-pure@^7.24.7": - version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.24.7.tgz#5373c7bc8366b12a033b4be1ac13a206c6656aab" - integrity sha512-BaDeOonYvhdKw+JoMVkAixAAJzG2jVPIwWoKBPdYuY9b452e2rPuI9QPYh3KpofZ3pW2akOmwZLOiOsHMiqRAg== - dependencies: - "@babel/types" "^7.24.7" - -"@babel/helper-annotate-as-pure@^7.25.9": +"@babel/helper-annotate-as-pure@^7.18.6", "@babel/helper-annotate-as-pure@^7.22.5", "@babel/helper-annotate-as-pure@^7.25.9": version "7.25.9" resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.25.9.tgz#d8eac4d2dc0d7b6e11fa6e535332e0d3184f06b4" integrity sha512-gv7320KBUFJz1RnylIg5WWYPRXKZ884AGkYpgpWW02TH66Dl+HaC1t1CKd0z3R4b6hdYEcmrNZHUmfCP+1u3/g== @@ -1414,18 +1370,7 @@ dependencies: "@babel/types" "^7.22.15" -"@babel/helper-compilation-targets@^7.12.0", "@babel/helper-compilation-targets@^7.17.7", "@babel/helper-compilation-targets@^7.18.9", "@babel/helper-compilation-targets@^7.20.7", "@babel/helper-compilation-targets@^7.22.6", "@babel/helper-compilation-targets@^7.23.6", "@babel/helper-compilation-targets@^7.25.9": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.9.tgz#55af025ce365be3cdc0c1c1e56c6af617ce88875" - integrity sha512-j9Db8Suy6yV/VHa4qzrj9yZfZxhLWQdVnRlXxmKLYlhWUVB1sB2G5sxuWYXk/whHD9iW76PmNzxZ4UCnTQTVEQ== - dependencies: - "@babel/compat-data" "^7.25.9" - "@babel/helper-validator-option" "^7.25.9" - browserslist "^4.24.0" - lru-cache "^5.1.1" - semver "^6.3.1" - -"@babel/helper-compilation-targets@^7.26.5": +"@babel/helper-compilation-targets@^7.12.0", "@babel/helper-compilation-targets@^7.17.7", "@babel/helper-compilation-targets@^7.18.9", "@babel/helper-compilation-targets@^7.20.7", "@babel/helper-compilation-targets@^7.22.6", "@babel/helper-compilation-targets@^7.23.6", "@babel/helper-compilation-targets@^7.26.5": version "7.26.5" resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.26.5.tgz#75d92bb8d8d51301c0d49e52a65c9a7fe94514d8" integrity sha512-IXuyn5EkouFJscIDuFF5EsiSolseme1s0CZB+QxVugqJLYmKdxI1VfIBOst0SUu4rnk2Z7kqTwmoO1lp3HIfnA== @@ -1436,20 +1381,7 @@ lru-cache "^5.1.1" semver "^6.3.1" -"@babel/helper-create-class-features-plugin@^7.18.6", "@babel/helper-create-class-features-plugin@^7.21.0", "@babel/helper-create-class-features-plugin@^7.24.1", "@babel/helper-create-class-features-plugin@^7.24.4", "@babel/helper-create-class-features-plugin@^7.24.7", "@babel/helper-create-class-features-plugin@^7.25.0", "@babel/helper-create-class-features-plugin@^7.5.5": - version "7.25.4" - resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.25.4.tgz#57eaf1af38be4224a9d9dd01ddde05b741f50e14" - integrity sha512-ro/bFs3/84MDgDmMwbcHgDa8/E6J3QKNTk4xJJnVeFtGE+tL0K26E3pNxhYz2b67fJpt7Aphw5XcploKXuCvCQ== - dependencies: - "@babel/helper-annotate-as-pure" "^7.24.7" - "@babel/helper-member-expression-to-functions" "^7.24.8" - "@babel/helper-optimise-call-expression" "^7.24.7" - "@babel/helper-replace-supers" "^7.25.0" - "@babel/helper-skip-transparent-expression-wrappers" "^7.24.7" - "@babel/traverse" "^7.25.4" - semver "^6.3.1" - -"@babel/helper-create-class-features-plugin@^7.25.9": +"@babel/helper-create-class-features-plugin@^7.18.6", "@babel/helper-create-class-features-plugin@^7.21.0", "@babel/helper-create-class-features-plugin@^7.24.1", "@babel/helper-create-class-features-plugin@^7.24.4", "@babel/helper-create-class-features-plugin@^7.24.7", "@babel/helper-create-class-features-plugin@^7.25.9", "@babel/helper-create-class-features-plugin@^7.5.5": version "7.26.9" resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.26.9.tgz#d6f83e3039547fbb39967e78043cd3c8b7820c71" integrity sha512-ubbUqCofvxPRurw5L8WTsCLSkQiVpov4Qx0WMA+jUN+nXBK8ADPlJO1grkFw5CWKC5+sZSOfuGMdX1aI1iT9Sg== @@ -1516,14 +1448,6 @@ dependencies: "@babel/types" "^7.24.7" -"@babel/helper-member-expression-to-functions@^7.24.8": - version "7.24.8" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.24.8.tgz#6155e079c913357d24a4c20480db7c712a5c3fb6" - integrity sha512-LABppdt+Lp/RlBxqrh4qgf1oEH/WxdzQNDJIu5gC/W1GyvPVrOBiItmmM8wan2fm4oYqFuFfkXmlGpLQhPY8CA== - dependencies: - "@babel/traverse" "^7.24.8" - "@babel/types" "^7.24.8" - "@babel/helper-member-expression-to-functions@^7.25.9": version "7.25.9" resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.25.9.tgz#9dfffe46f727005a5ea29051ac835fb735e4c1a3" @@ -1563,13 +1487,6 @@ "@babel/helper-validator-identifier" "^7.25.9" "@babel/traverse" "^7.25.9" -"@babel/helper-optimise-call-expression@^7.24.7": - version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.24.7.tgz#8b0a0456c92f6b323d27cfd00d1d664e76692a0f" - integrity sha512-jKiTsW2xmWwxT1ixIdfXUZp+P5yURx2suzLZr5Hi64rURpDYdMW0pv+Uf17EYk2Rd428Lx4tLsnjGJzYKDM/6A== - dependencies: - "@babel/types" "^7.24.7" - "@babel/helper-optimise-call-expression@^7.25.9": version "7.25.9" resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.25.9.tgz#3324ae50bae7e2ab3c33f60c9a877b6a0146b54e" @@ -1577,12 +1494,7 @@ dependencies: "@babel/types" "^7.25.9" -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.16.7", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.18.9", "@babel/helper-plugin-utils@^7.20.2", "@babel/helper-plugin-utils@^7.22.5", "@babel/helper-plugin-utils@^7.24.0", "@babel/helper-plugin-utils@^7.24.7", "@babel/helper-plugin-utils@^7.24.8", "@babel/helper-plugin-utils@^7.25.9", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.25.9.tgz#9cbdd63a9443a2c92a725cca7ebca12cc8dd9f46" - integrity sha512-kSMlyUVdWe25rEsRGviIgOWnoT/nfABVWlqt9N19/dIPWViAOW2s9wznP5tURbs/IDuNk4gPy3YdYRgH3uxhBw== - -"@babel/helper-plugin-utils@^7.26.5": +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.16.7", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.18.9", "@babel/helper-plugin-utils@^7.20.2", "@babel/helper-plugin-utils@^7.22.5", "@babel/helper-plugin-utils@^7.24.0", "@babel/helper-plugin-utils@^7.24.7", "@babel/helper-plugin-utils@^7.25.9", "@babel/helper-plugin-utils@^7.26.5", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3": version "7.26.5" resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.26.5.tgz#18580d00c9934117ad719392c4f6585c9333cc35" integrity sha512-RS+jZcRdZdRFzMyr+wcsaqOmld1/EqTghfaBGQQd/WnRdzdlvSZ//kF7U8VQTxf1ynZ4cjUcYgjVGx13ewNPMg== @@ -1596,16 +1508,7 @@ "@babel/helper-environment-visitor" "^7.22.20" "@babel/helper-wrap-function" "^7.22.20" -"@babel/helper-replace-supers@^7.24.1", "@babel/helper-replace-supers@^7.25.0": - version "7.25.0" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.25.0.tgz#ff44deac1c9f619523fe2ca1fd650773792000a9" - integrity sha512-q688zIvQVYtZu+i2PsdIu/uWGRpfxzr5WESsfpShfZECkO+d2o+WROWezCi/Q6kJ0tfPa5+pUGUlfx2HhrA3Bg== - dependencies: - "@babel/helper-member-expression-to-functions" "^7.24.8" - "@babel/helper-optimise-call-expression" "^7.24.7" - "@babel/traverse" "^7.25.0" - -"@babel/helper-replace-supers@^7.26.5": +"@babel/helper-replace-supers@^7.24.1", "@babel/helper-replace-supers@^7.26.5": version "7.26.5" resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.26.5.tgz#6cb04e82ae291dae8e72335dfe438b0725f14c8d" integrity sha512-bJ6iIVdYX1YooY2X7w1q6VITt+LnUILtNk7zT78ykuwStx8BauCzxvFqFaHjOpW1bVnSUM1PN1f0p5P21wHxvg== @@ -1614,23 +1517,7 @@ "@babel/helper-optimise-call-expression" "^7.25.9" "@babel/traverse" "^7.26.5" -"@babel/helper-simple-access@^7.22.5": - version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.24.7.tgz#bcade8da3aec8ed16b9c4953b74e506b51b5edb3" - integrity sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg== - dependencies: - "@babel/traverse" "^7.24.7" - "@babel/types" "^7.24.7" - -"@babel/helper-skip-transparent-expression-wrappers@^7.18.9", "@babel/helper-skip-transparent-expression-wrappers@^7.22.5", "@babel/helper-skip-transparent-expression-wrappers@^7.24.7": - version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.24.7.tgz#5f8fa83b69ed5c27adc56044f8be2b3ea96669d9" - integrity sha512-IO+DLT3LQUElMbpzlatRASEyQtfhSE0+m465v++3jyyXeBTBUjtVZg28/gHeV5mrTJqvEKhKroBGAvhW+qPHiQ== - dependencies: - "@babel/traverse" "^7.24.7" - "@babel/types" "^7.24.7" - -"@babel/helper-skip-transparent-expression-wrappers@^7.25.9": +"@babel/helper-skip-transparent-expression-wrappers@^7.18.9", "@babel/helper-skip-transparent-expression-wrappers@^7.22.5", "@babel/helper-skip-transparent-expression-wrappers@^7.25.9": version "7.25.9" resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.25.9.tgz#0b2e1b62d560d6b1954893fd2b705dc17c91f0c9" integrity sha512-K4Du3BFa3gvyhzgPcntrkDgZzQaq6uozzcpGbOO1OEJaI+EJdqWIMTLgFgQf6lrfiDFo5FU+BxKepI9RmZqahA== @@ -1655,7 +1542,7 @@ resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz#24b64e2c3ec7cd3b3c547729b8d16871f22cbdc7" integrity sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ== -"@babel/helper-validator-option@^7.16.7", "@babel/helper-validator-option@^7.18.6", "@babel/helper-validator-option@^7.23.5", "@babel/helper-validator-option@^7.25.9": +"@babel/helper-validator-option@^7.18.6", "@babel/helper-validator-option@^7.23.5", "@babel/helper-validator-option@^7.25.9": version "7.25.9" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz#86e45bd8a49ab7e03f276577f96179653d41da72" integrity sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw== @@ -1669,15 +1556,7 @@ "@babel/template" "^7.22.15" "@babel/types" "^7.22.19" -"@babel/helpers@^7.18.9", "@babel/helpers@^7.26.0": - version "7.26.0" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.26.0.tgz#30e621f1eba5aa45fe6f4868d2e9154d884119a4" - integrity sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw== - dependencies: - "@babel/template" "^7.25.9" - "@babel/types" "^7.26.0" - -"@babel/helpers@^7.26.9": +"@babel/helpers@^7.18.9", "@babel/helpers@^7.26.9": version "7.26.9" resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.26.9.tgz#28f3fb45252fc88ef2dc547c8a911c255fc9fef6" integrity sha512-Mz/4+y8udxBKdmzt/UjPACs4G3j5SshJJEFFKxlCGPydG4JAHXxjWjAwjd09tf6oINvl1VfMJo+nB7H2YKQ0dA== @@ -1695,20 +1574,13 @@ js-tokens "^4.0.0" picocolors "^1.0.0" -"@babel/parser@7.26.9", "@babel/parser@^7.23.6", "@babel/parser@^7.26.9": +"@babel/parser@7.26.9", "@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.16.4", "@babel/parser@^7.18.10", "@babel/parser@^7.20.7", "@babel/parser@^7.21.8", "@babel/parser@^7.22.10", "@babel/parser@^7.22.16", "@babel/parser@^7.23.5", "@babel/parser@^7.23.6", "@babel/parser@^7.23.9", "@babel/parser@^7.25.3", "@babel/parser@^7.25.4", "@babel/parser@^7.25.6", "@babel/parser@^7.26.9", "@babel/parser@^7.4.5", "@babel/parser@^7.7.0": version "7.26.9" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.26.9.tgz#d9e78bee6dc80f9efd8f2349dcfbbcdace280fd5" integrity sha512-81NWa1njQblgZbQHxWHpxxCzNsa3ZwvFqpUg7P+NNUU6f3UU2jBEg4OlF/J6rl8+PQGh1q6/zWScd001YwcA5A== dependencies: "@babel/types" "^7.26.9" -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.16.4", "@babel/parser@^7.18.10", "@babel/parser@^7.20.7", "@babel/parser@^7.21.8", "@babel/parser@^7.22.10", "@babel/parser@^7.22.16", "@babel/parser@^7.23.5", "@babel/parser@^7.23.9", "@babel/parser@^7.25.3", "@babel/parser@^7.25.4", "@babel/parser@^7.25.6", "@babel/parser@^7.25.9", "@babel/parser@^7.26.0", "@babel/parser@^7.26.3", "@babel/parser@^7.4.5", "@babel/parser@^7.7.0": - version "7.26.3" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.26.3.tgz#8c51c5db6ddf08134af1ddbacf16aaab48bac234" - integrity sha512-WJ/CvmY8Mea8iDXo6a7RK2wbmJITT5fN3BEkRuFlxVyNx8jOKIIhmC4fSkTcPcf8JyavbBwIe6OpiCOBXt/IcA== - dependencies: - "@babel/types" "^7.26.3" - "@babel/plugin-bugfix-firefox-class-in-computed-class-key@^7.24.4": version "7.24.4" resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-firefox-class-in-computed-class-key/-/plugin-bugfix-firefox-class-in-computed-class-key-7.24.4.tgz#6125f0158543fb4edf1c22f322f3db67f21cb3e1" @@ -1971,14 +1843,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-jsx@^7.18.6", "@babel/plugin-syntax-jsx@^7.22.5", "@babel/plugin-syntax-jsx@^7.23.3": - version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.24.7.tgz#39a1fa4a7e3d3d7f34e2acc6be585b718d30e02d" - integrity sha512-6ddciUPe/mpMnOKv/U+RSd2vvVy+Yw/JfBB0ZHYjEZt9NLHmCUylNYlsbqCCS1Bffjlb0fCwC9Vqz+sBz6PsiQ== - dependencies: - "@babel/helper-plugin-utils" "^7.24.7" - -"@babel/plugin-syntax-jsx@^7.21.4", "@babel/plugin-syntax-jsx@^7.25.9": +"@babel/plugin-syntax-jsx@^7.18.6", "@babel/plugin-syntax-jsx@^7.21.4", "@babel/plugin-syntax-jsx@^7.22.5", "@babel/plugin-syntax-jsx@^7.23.3", "@babel/plugin-syntax-jsx@^7.25.9": version "7.25.9" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.25.9.tgz#a34313a178ea56f1951599b929c1ceacee719290" integrity sha512-ld6oezHQMZsZfp6pWtbjaNDF2tiiCYYDqQszHt5VV437lewP9aSi2Of99CK0D0XB21k7FLgnLcmQKyKzynfeAA== @@ -2041,14 +1906,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" -"@babel/plugin-syntax-typescript@^7.2.0", "@babel/plugin-syntax-typescript@^7.24.7", "@babel/plugin-syntax-typescript@^7.7.2": - version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.24.7.tgz#58d458271b4d3b6bb27ee6ac9525acbb259bad1c" - integrity sha512-c/+fVeJBB0FeKsFvwytYiUD+LBvhHjGSI0g446PRGdSVGZLRNArBUno2PETbAly3tpiNAQR5XaZ+JslxkotsbA== - dependencies: - "@babel/helper-plugin-utils" "^7.24.7" - -"@babel/plugin-syntax-typescript@^7.25.9": +"@babel/plugin-syntax-typescript@^7.2.0", "@babel/plugin-syntax-typescript@^7.25.9", "@babel/plugin-syntax-typescript@^7.7.2": version "7.25.9" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.25.9.tgz#67dda2b74da43727cf21d46cf9afef23f4365399" integrity sha512-hjMgRy5hb8uJJjUcdWunWVcoi9bGpJp8p5Ol1229PoN6aytsLwNMgmdftO23wnCLMfVmTwZDWMPNq/D1SY60JQ== @@ -2252,16 +2110,7 @@ "@babel/helper-module-transforms" "^7.23.3" "@babel/helper-plugin-utils" "^7.24.0" -"@babel/plugin-transform-modules-commonjs@^7.18.6", "@babel/plugin-transform-modules-commonjs@^7.24.1": - version "7.24.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.24.1.tgz#e71ba1d0d69e049a22bf90b3867e263823d3f1b9" - integrity sha512-szog8fFTUxBfw0b98gEWPaEqF42ZUD/T3bkynW/wtgx2p/XCP55WEsb+VosKceRSd6njipdZvNogqdtI4Q0chw== - dependencies: - "@babel/helper-module-transforms" "^7.23.3" - "@babel/helper-plugin-utils" "^7.24.0" - "@babel/helper-simple-access" "^7.22.5" - -"@babel/plugin-transform-modules-commonjs@^7.25.9": +"@babel/plugin-transform-modules-commonjs@^7.18.6", "@babel/plugin-transform-modules-commonjs@^7.24.1", "@babel/plugin-transform-modules-commonjs@^7.25.9": version "7.26.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.26.3.tgz#8f011d44b20d02c3de44d8850d971d8497f981fb" integrity sha512-MgR55l4q9KddUDITEzEFYn5ZsGDXMSsU9E+kh7fjRXTIC3RHqfCo8RPRbyReYJh44HQ/yomFkqbOFohXvDCiIQ== @@ -2459,18 +2308,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.24.0" -"@babel/plugin-transform-typescript@^7.13.0", "@babel/plugin-transform-typescript@^7.16.7", "@babel/plugin-transform-typescript@^7.16.8", "@babel/plugin-transform-typescript@^7.20.13", "@babel/plugin-transform-typescript@^7.22.15", "@babel/plugin-transform-typescript@^7.24.7": - version "7.25.2" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.25.2.tgz#237c5d10de6d493be31637c6b9fa30b6c5461add" - integrity sha512-lBwRvjSmqiMYe/pS0+1gggjJleUJi7NzjvQ1Fkqtt69hBa/0t1YuW/MLQMAPixfwaQOHUXsd6jeU3Z+vdGv3+A== - dependencies: - "@babel/helper-annotate-as-pure" "^7.24.7" - "@babel/helper-create-class-features-plugin" "^7.25.0" - "@babel/helper-plugin-utils" "^7.24.8" - "@babel/helper-skip-transparent-expression-wrappers" "^7.24.7" - "@babel/plugin-syntax-typescript" "^7.24.7" - -"@babel/plugin-transform-typescript@^7.25.9": +"@babel/plugin-transform-typescript@^7.13.0", "@babel/plugin-transform-typescript@^7.16.8", "@babel/plugin-transform-typescript@^7.20.13", "@babel/plugin-transform-typescript@^7.22.15", "@babel/plugin-transform-typescript@^7.24.7", "@babel/plugin-transform-typescript@^7.25.9": version "7.26.8" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.26.8.tgz#2e9caa870aa102f50d7125240d9dbf91334b0950" integrity sha512-bME5J9AC8ChwA7aEPJ6zym3w7aObZULHhbNLU0bKUhKsAkylkzUdq+0kdymh9rzi8nlNFl2bmldFBCKNJBUpuw== @@ -2725,16 +2563,7 @@ "@babel/types" "^7.4.4" esutils "^2.0.2" -"@babel/preset-typescript@^7.16.7": - version "7.16.7" - resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.16.7.tgz#ab114d68bb2020afc069cd51b37ff98a046a70b9" - integrity sha512-WbVEmgXdIyvzB77AQjGBEyYPZx+8tTsO50XtfozQrkW8QB2rLJpH2lgx0TRw5EJrBxOZQ+wCcyPVQvS8tjEHpQ== - dependencies: - "@babel/helper-plugin-utils" "^7.16.7" - "@babel/helper-validator-option" "^7.16.7" - "@babel/plugin-transform-typescript" "^7.16.7" - -"@babel/preset-typescript@^7.21.5": +"@babel/preset-typescript@^7.16.7", "@babel/preset-typescript@^7.21.5": version "7.26.0" resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.26.0.tgz#4a570f1b8d104a242d923957ffa1eaff142a106d" integrity sha512-NMk1IGZ5I/oHhoXEElcm+xUnL/szL6xflkFZmoEU9xj1qSJXpiS7rsspYo92B4DRCDvZn2erT5LdsCeXAKNCkg== @@ -2785,16 +2614,7 @@ "@babel/parser" "^7.18.10" "@babel/types" "^7.18.10" -"@babel/template@^7.18.10", "@babel/template@^7.22.15", "@babel/template@^7.23.9", "@babel/template@^7.24.0", "@babel/template@^7.24.7", "@babel/template@^7.25.9", "@babel/template@^7.3.3": - version "7.25.9" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.25.9.tgz#ecb62d81a8a6f5dc5fe8abfc3901fc52ddf15016" - integrity sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg== - dependencies: - "@babel/code-frame" "^7.25.9" - "@babel/parser" "^7.25.9" - "@babel/types" "^7.25.9" - -"@babel/template@^7.26.9": +"@babel/template@^7.18.10", "@babel/template@^7.22.15", "@babel/template@^7.23.9", "@babel/template@^7.24.0", "@babel/template@^7.24.7", "@babel/template@^7.26.9", "@babel/template@^7.3.3": version "7.26.9" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.26.9.tgz#4577ad3ddf43d194528cff4e1fa6b232fa609bb2" integrity sha512-qyRplbeIpNZhmzOysF/wFMuP9sctmh2cFzRAZOn1YapxBsE1i9bJIY586R/WBLfLcmcBlM8ROBiQURnnNy+zfA== @@ -2803,20 +2623,7 @@ "@babel/parser" "^7.26.9" "@babel/types" "^7.26.9" -"@babel/traverse@^7.18.10", "@babel/traverse@^7.22.10", "@babel/traverse@^7.23.9", "@babel/traverse@^7.24.7", "@babel/traverse@^7.24.8", "@babel/traverse@^7.25.0", "@babel/traverse@^7.25.4", "@babel/traverse@^7.25.9", "@babel/traverse@^7.4.5", "@babel/traverse@^7.7.0", "@babel/traverse@^7.7.2": - version "7.26.4" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.26.4.tgz#ac3a2a84b908dde6d463c3bfa2c5fdc1653574bd" - integrity sha512-fH+b7Y4p3yqvApJALCPJcwb0/XaOSgtK4pzV6WVjPR5GLFQBRI7pfoX2V2iM48NXvX07NUxxm1Vw98YjqTcU5w== - dependencies: - "@babel/code-frame" "^7.26.2" - "@babel/generator" "^7.26.3" - "@babel/parser" "^7.26.3" - "@babel/template" "^7.25.9" - "@babel/types" "^7.26.3" - debug "^4.3.1" - globals "^11.1.0" - -"@babel/traverse@^7.23.2", "@babel/traverse@^7.23.7", "@babel/traverse@^7.26.5", "@babel/traverse@^7.26.9": +"@babel/traverse@^7.18.10", "@babel/traverse@^7.22.10", "@babel/traverse@^7.23.2", "@babel/traverse@^7.23.7", "@babel/traverse@^7.23.9", "@babel/traverse@^7.25.9", "@babel/traverse@^7.26.5", "@babel/traverse@^7.26.9", "@babel/traverse@^7.4.5", "@babel/traverse@^7.7.0", "@babel/traverse@^7.7.2": version "7.26.9" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.26.9.tgz#4398f2394ba66d05d988b2ad13c219a2c857461a" integrity sha512-ZYW7L+pL8ahU5fXmNbPF+iZFHCv5scFak7MZ9bwaRPLUhHh7QQEMjZUg0HevihoqCM5iSYHN61EyCoZvqC+bxg== @@ -2829,15 +2636,7 @@ debug "^4.3.1" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.18.10", "@babel/types@^7.18.6", "@babel/types@^7.20.7", "@babel/types@^7.22.10", "@babel/types@^7.22.15", "@babel/types@^7.22.17", "@babel/types@^7.22.19", "@babel/types@^7.23.6", "@babel/types@^7.23.9", "@babel/types@^7.24.7", "@babel/types@^7.24.8", "@babel/types@^7.25.4", "@babel/types@^7.25.6", "@babel/types@^7.25.9", "@babel/types@^7.26.0", "@babel/types@^7.26.3", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.7.0", "@babel/types@^7.7.2": - version "7.26.3" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.26.3.tgz#37e79830f04c2b5687acc77db97fbc75fb81f3c0" - integrity sha512-vN5p+1kl59GVKMvTHt55NzzmYVxprfJD+ql7U9NFIfKCBkYE55LYtS+WtPlaYOyzydrKI8Nezd+aZextrd+FMA== - dependencies: - "@babel/helper-string-parser" "^7.25.9" - "@babel/helper-validator-identifier" "^7.25.9" - -"@babel/types@^7.22.5", "@babel/types@^7.26.9": +"@babel/types@^7.0.0", "@babel/types@^7.18.10", "@babel/types@^7.18.6", "@babel/types@^7.20.7", "@babel/types@^7.22.10", "@babel/types@^7.22.15", "@babel/types@^7.22.17", "@babel/types@^7.22.19", "@babel/types@^7.22.5", "@babel/types@^7.23.6", "@babel/types@^7.23.9", "@babel/types@^7.24.7", "@babel/types@^7.25.4", "@babel/types@^7.25.6", "@babel/types@^7.25.9", "@babel/types@^7.26.3", "@babel/types@^7.26.9", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.7.0", "@babel/types@^7.7.2": version "7.26.9" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.26.9.tgz#08b43dec79ee8e682c2ac631c010bdcac54a21ce" integrity sha512-Y3IR1cRnOxOCDvMmNiym7XpXQ93iGDDPHx+Zj+NM+rg0fBaShfQLkg+hKPaZCEvg5N/LeCo4+Rj/i3FuJsIQaw== @@ -8509,7 +8308,12 @@ dependencies: "@types/unist" "*" -"@types/history-4@npm:@types/history@4.7.8", "@types/history-5@npm:@types/history@4.7.8": +"@types/history-4@npm:@types/history@4.7.8": + version "4.7.8" + resolved "https://registry.yarnpkg.com/@types/history/-/history-4.7.8.tgz#49348387983075705fe8f4e02fb67f7daaec4934" + integrity sha512-S78QIYirQcUoo6UJZx9CSP0O2ix9IaeAXwQi26Rhr/+mg7qqPy8TzaxHSUut7eGjL8WmLccT7/MXf304WjqHcA== + +"@types/history-5@npm:@types/history@4.7.8": version "4.7.8" resolved "https://registry.yarnpkg.com/@types/history/-/history-4.7.8.tgz#49348387983075705fe8f4e02fb67f7daaec4934" integrity sha512-S78QIYirQcUoo6UJZx9CSP0O2ix9IaeAXwQi26Rhr/+mg7qqPy8TzaxHSUut7eGjL8WmLccT7/MXf304WjqHcA== @@ -28352,7 +28156,16 @@ string-template@~0.2.1: resolved "https://registry.yarnpkg.com/string-template/-/string-template-0.2.1.tgz#42932e598a352d01fc22ec3367d9d84eec6c9add" integrity sha1-QpMuWYo1LQH8IuwzZ9nYTuxsmt0= -"string-width-cjs@npm:string-width@^4.2.0", string-width@4.2.3, "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@4.2.3, "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -28455,7 +28268,14 @@ stringify-object@^3.2.1: is-obj "^1.0.1" is-regexp "^1.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-ansi@6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -31292,7 +31112,16 @@ wrangler@^3.67.1: optionalDependencies: fsevents "~2.3.2" -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@7.0.0, wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + +wrap-ansi@7.0.0, wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== From e15988c2adc27613018497e87401478b427f4fc5 Mon Sep 17 00:00:00 2001 From: Daniel Griesser Date: Fri, 14 Mar 2025 14:41:30 +0100 Subject: [PATCH 19/24] chore: Add external contributor to CHANGELOG.md (#15642) This PR adds the external contributor to the CHANGELOG.md file, so that they are credited for their contribution. See #15639 Co-authored-by: Lms24 <8420481+Lms24@users.noreply.github.com> --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8859e968d9e0..3eb2bd89a0d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ - "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott -Work in this release was contributed by @angelikatyborska. Thank you for your contribution! +Work in this release was contributed by @angelikatyborska and @nwalters512. Thank you for your contributions! ## 9.5.0 From 48ed271b6dfd247f57e06c97eb5f99b5742a66d6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 14 Mar 2025 14:41:46 +0100 Subject: [PATCH 20/24] chore(deps): bump esbuild from 0.20.0 to 0.25.0 in /dev-packages/e2e-tests/test-applications/node-profiling-cjs (#15641) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [esbuild](https://github.com/evanw/esbuild) from 0.20.0 to 0.25.0.

Release notes

Sourced from esbuild's releases.

v0.25.0

This release deliberately contains backwards-incompatible changes. To avoid automatically picking up releases like this, you should either be pinning the exact version of esbuild in your package.json file (recommended) or be using a version range syntax that only accepts patch upgrades such as ^0.24.0 or ~0.24.0. See npm's documentation about semver for more information.

  • Restrict access to esbuild's development server (GHSA-67mh-4wv8-2f99)

    This change addresses esbuild's first security vulnerability report. Previously esbuild set the Access-Control-Allow-Origin header to * to allow esbuild's development server to be flexible in how it's used for development. However, this allows the websites you visit to make HTTP requests to esbuild's local development server, which gives read-only access to your source code if the website were to fetch your source code's specific URL. You can read more information in the report.

    Starting with this release, CORS will now be disabled, and requests will now be denied if the host does not match the one provided to --serve=. The default host is 0.0.0.0, which refers to all of the IP addresses that represent the local machine (e.g. both 127.0.0.1 and 192.168.0.1). If you want to customize anything about esbuild's development server, you can put a proxy in front of esbuild and modify the incoming and/or outgoing requests.

    In addition, the serve() API call has been changed to return an array of hosts instead of a single host string. This makes it possible to determine all of the hosts that esbuild's development server will accept.

    Thanks to @​sapphi-red for reporting this issue.

  • Delete output files when a build fails in watch mode (#3643)

    It has been requested for esbuild to delete files when a build fails in watch mode. Previously esbuild left the old files in place, which could cause people to not immediately realize that the most recent build failed. With this release, esbuild will now delete all output files if a rebuild fails. Fixing the build error and triggering another rebuild will restore all output files again.

  • Fix correctness issues with the CSS nesting transform (#3620, #3877, #3933, #3997, #4005, #4037, #4038)

    This release fixes the following problems:

    • Naive expansion of CSS nesting can result in an exponential blow-up of generated CSS if each nesting level has multiple selectors. Previously esbuild sometimes collapsed individual nesting levels using :is() to limit expansion. However, this collapsing wasn't correct in some cases, so it has been removed to fix correctness issues.

      /* Original code */
      .parent {
        > .a,
        > .b1 > .b2 {
          color: red;
        }
      }
      

      /* Old output (with --supported:nesting=false) */
      .parent > :is(.a, .b1 > .b2) {
      color: red;
      }

      /* New output (with --supported:nesting=false) */
      .parent > .a,
      .parent > .b1 > .b2 {
      color: red;
      }

      Thanks to @​tim-we for working on a fix.

    • The & CSS nesting selector can be repeated multiple times to increase CSS specificity. Previously esbuild ignored this possibility and incorrectly considered && to have the same specificity as &. With this release, this should now work correctly:

      /* Original code (color should be red) */
      

... (truncated)

Changelog

Sourced from esbuild's changelog.

Changelog: 2024

This changelog documents all esbuild versions published in the year 2024 (versions 0.19.12 through 0.24.2).

0.24.2

  • Fix regression with --define and import.meta (#4010, #4012, #4013)

    The previous change in version 0.24.1 to use a more expression-like parser for define values to allow quoted property names introduced a regression that removed the ability to use --define:import.meta=.... Even though import is normally a keyword that can't be used as an identifier, ES modules special-case the import.meta expression to behave like an identifier anyway. This change fixes the regression.

    This fix was contributed by @​sapphi-red.

0.24.1

  • Allow es2024 as a target in tsconfig.json (#4004)

    TypeScript recently added es2024 as a compilation target, so esbuild now supports this in the target field of tsconfig.json files, such as in the following configuration file:

    {
      "compilerOptions": {
        "target": "ES2024"
      }
    }
    

    As a reminder, the only thing that esbuild uses this field for is determining whether or not to use legacy TypeScript behavior for class fields. You can read more in the documentation.

    This fix was contributed by @​billyjanitsch.

  • Allow automatic semicolon insertion after get/set

    This change fixes a grammar bug in the parser that incorrectly treated the following code as a syntax error:

    class Foo {
      get
      *x() {}
      set
      *y() {}
    }
    

    The above code will be considered valid starting with this release. This change to esbuild follows a similar change to TypeScript which will allow this syntax starting with TypeScript 5.7.

  • Allow quoted property names in --define and --pure (#4008)

    The define and pure API options now accept identifier expressions containing quoted property names. Previously all identifiers in the identifier expression had to be bare identifiers. This change now makes --define and --pure consistent with --global-name, which already supported quoted property names. For example, the following is now possible:

... (truncated)

Commits
  • e9174d6 publish 0.25.0 to npm
  • c27dbeb fix hosts in plugin-tests.js
  • 6794f60 fix hosts in node-unref-tests.js
  • de85afd Merge commit from fork
  • da1de1b fix #4065: bitwise operators can return bigints
  • f4e9d19 switch case liveness: default is always last
  • 7aa47c3 fix #4028: minify live/dead switch cases better
  • 22ecd30 minify: more constant folding for strict equality
  • 4cdf03c fix #4053: reordering of .tsx in node_modules
  • dc71977 fix #3692: 0 now picks a random ephemeral port
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=esbuild&package-manager=npm_and_yarn&previous-version=0.20.0&new-version=0.25.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/getsentry/sentry-javascript/network/alerts).
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../e2e-tests/test-applications/node-profiling-cjs/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-packages/e2e-tests/test-applications/node-profiling-cjs/package.json b/dev-packages/e2e-tests/test-applications/node-profiling-cjs/package.json index aa729a030a5d..051127a4961f 100644 --- a/dev-packages/e2e-tests/test-applications/node-profiling-cjs/package.json +++ b/dev-packages/e2e-tests/test-applications/node-profiling-cjs/package.json @@ -13,7 +13,7 @@ "@playwright/test": "~1.50.0", "@sentry/node": "latest || *", "@sentry/profiling-node": "latest || *", - "esbuild": "0.20.0", + "esbuild": "0.25.0", "typescript": "^5.7.3" }, "volta": { From 7d88266a6ef1907acc0ffed6bdf56fcaead9b160 Mon Sep 17 00:00:00 2001 From: Charly Gomez Date: Sun, 16 Mar 2025 15:17:00 +0100 Subject: [PATCH 21/24] chore(ci): Remove `type` from canary failure template (#15698) Apparently `type` is not yet supported by https://github.com/JasonEtco/create-an-issue ref https://github.com/getsentry/sentry-javascript/pull/15562 --- .github/CANARY_FAILURE_TEMPLATE.md | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/CANARY_FAILURE_TEMPLATE.md b/.github/CANARY_FAILURE_TEMPLATE.md index ba3f2a7f1469..9e05fcfc44ae 100644 --- a/.github/CANARY_FAILURE_TEMPLATE.md +++ b/.github/CANARY_FAILURE_TEMPLATE.md @@ -1,7 +1,6 @@ --- title: '{{ env.TITLE }}' labels: 'Type: Tests, Waiting for: Product Owner' -type: 'task' --- Canary tests failed: {{ env.RUN_LINK }} From 2b5526565c9008c9f350f02e2b9458d266099199 Mon Sep 17 00:00:00 2001 From: Andrei <168741329+andreiborza@users.noreply.github.com> Date: Mon, 17 Mar 2025 18:12:43 +0900 Subject: [PATCH 22/24] fix(nextjs): Consider `pageExtensions` when looking for instrumentation file (#15701) Closes: #15652 --------- Co-authored-by: Luca Forstner --- packages/nextjs/src/config/webpack.ts | 94 +++++++++++---------------- 1 file changed, 39 insertions(+), 55 deletions(-) diff --git a/packages/nextjs/src/config/webpack.ts b/packages/nextjs/src/config/webpack.ts index 3119a70a38bd..de047c0b8cf4 100644 --- a/packages/nextjs/src/config/webpack.ts +++ b/packages/nextjs/src/config/webpack.ts @@ -54,16 +54,25 @@ export function constructWebpackConfigFunction( ): WebpackConfigObject { const { isServer, dev: isDev, dir: projectDir } = buildContext; const runtime = isServer ? (buildContext.nextRuntime === 'edge' ? 'edge' : 'server') : 'client'; + // Default page extensions per https://github.com/vercel/next.js/blob/f1dbc9260d48c7995f6c52f8fbcc65f08e627992/packages/next/server/config-shared.ts#L161 + const pageExtensions = userNextConfig.pageExtensions || ['tsx', 'ts', 'jsx', 'js']; + const dotPrefixedPageExtensions = pageExtensions.map(ext => `.${ext}`); + const pageExtensionRegex = pageExtensions.map(escapeStringForRegex).join('|'); + + // We add `.ts` and `.js` back in because `pageExtensions` might not be relevant to the instrumentation file + // e.g. user's setting `.mdx`. In that case we still want to default look up + // `instrumentation.ts` and `instrumentation.js` + const instrumentationFile = getInstrumentationFile(projectDir, dotPrefixedPageExtensions.concat(['.ts', '.js'])); if (runtime !== 'client') { - warnAboutDeprecatedConfigFiles(projectDir, runtime); + warnAboutDeprecatedConfigFiles(projectDir, instrumentationFile, runtime); } if (runtime === 'server') { const nextJsVersion = getNextjsVersion(); const { major } = parseSemver(nextJsVersion || ''); // was added in v15 (https://github.com/vercel/next.js/pull/67539) if (major && major >= 15) { - warnAboutMissingOnRequestErrorHandler(projectDir); + warnAboutMissingOnRequestErrorHandler(instrumentationFile); } } @@ -110,11 +119,6 @@ export function constructWebpackConfigFunction( ? path.join(appDirPath, '..') : projectDir; - // Default page extensions per https://github.com/vercel/next.js/blob/f1dbc9260d48c7995f6c52f8fbcc65f08e627992/packages/next/server/config-shared.ts#L161 - const pageExtensions = userNextConfig.pageExtensions || ['tsx', 'ts', 'jsx', 'js']; - const dotPrefixedPageExtensions = pageExtensions.map(ext => `.${ext}`); - const pageExtensionRegex = pageExtensions.map(escapeStringForRegex).join('|'); - const staticWrappingLoaderOptions = { appDir: appDirPath, pagesDir: pagesDirPath, @@ -445,37 +449,29 @@ async function addSentryToClientEntryProperty( } /** - * Make sure the instrumentation file has a `onRequestError` Handler - * - * @param projectDir The root directory of the project, where config files would be located + * Gets the content of the user's instrumentation file */ -function warnAboutMissingOnRequestErrorHandler(projectDir: string): void { - const instrumentationPaths = [ - ['src', 'instrumentation.ts'], - ['src', 'instrumentation.js'], - ['instrumentation.ts'], - ['instrumentation.js'], - ]; - const instrumentationFile = instrumentationPaths - .map(pathSegments => path.resolve(projectDir, ...pathSegments)) - .find(function exists(filePath: string): string | null { - try { - fs.accessSync(filePath, fs.constants.F_OK); - return filePath; - } catch (error) { - return null; - } - }); +function getInstrumentationFile(projectDir: string, dotPrefixedExtensions: string[]): string | null { + const paths = dotPrefixedExtensions.flatMap(extension => [ + ['src', `instrumentation${extension}`], + [`instrumentation${extension}`], + ]); - function hasOnRequestErrorHandler(absolutePath: string): boolean { + for (const pathSegments of paths) { try { - const content = fs.readFileSync(absolutePath, 'utf8'); - return content.includes('onRequestError'); - } catch (error) { - return false; + return fs.readFileSync(path.resolve(projectDir, ...pathSegments), { encoding: 'utf-8' }); + } catch (e) { + // no-op } } + return null; +} + +/** + * Make sure the instrumentation file has a `onRequestError` Handler + */ +function warnAboutMissingOnRequestErrorHandler(instrumentationFile: string | null): void { if (!instrumentationFile) { if (!process.env.SENTRY_SUPPRESS_INSTRUMENTATION_FILE_WARNING) { // eslint-disable-next-line no-console @@ -488,7 +484,7 @@ function warnAboutMissingOnRequestErrorHandler(projectDir: string): void { return; } - if (!hasOnRequestErrorHandler(instrumentationFile)) { + if (!instrumentationFile.includes('onRequestError')) { // eslint-disable-next-line no-console console.warn( chalk.yellow( @@ -505,27 +501,15 @@ function warnAboutMissingOnRequestErrorHandler(projectDir: string): void { * @param projectDir The root directory of the project, where config files would be located * @param platform Either "server" or "edge", so that we know which file to look for */ -function warnAboutDeprecatedConfigFiles(projectDir: string, platform: 'server' | 'edge'): void { - const hasInstrumentationHookWithIndicationsOfSentry = [ - ['src', 'instrumentation.ts'], - ['src', 'instrumentation.js'], - ['instrumentation.ts'], - ['instrumentation.js'], - ].some(potentialInstrumentationHookPathSegments => { - try { - const instrumentationHookContent = fs.readFileSync( - path.resolve(projectDir, ...potentialInstrumentationHookPathSegments), - { encoding: 'utf-8' }, - ); - - return ( - instrumentationHookContent.includes('@sentry/') || - instrumentationHookContent.match(/sentry\.(server|edge)\.config(\.(ts|js))?/) - ); - } catch (e) { - return false; - } - }); +function warnAboutDeprecatedConfigFiles( + projectDir: string, + instrumentationFile: string | null, + platform: 'server' | 'edge', +): void { + const hasInstrumentationHookWithIndicationsOfSentry = + instrumentationFile && + (instrumentationFile.includes('@sentry/') || + instrumentationFile.match(/sentry\.(server|edge)\.config(\.(ts|js))?/)); if (hasInstrumentationHookWithIndicationsOfSentry) { return; @@ -535,7 +519,7 @@ function warnAboutDeprecatedConfigFiles(projectDir: string, platform: 'server' | if (fs.existsSync(path.resolve(projectDir, filename))) { // eslint-disable-next-line no-console console.warn( - `[@sentry/nextjs] It appears you've configured a \`${filename}\` file. Please ensure to put this file's content into the \`register()\` function of a Next.js instrumentation hook instead. To ensure correct functionality of the SDK, \`Sentry.init\` must be called inside \`instrumentation.ts\`. Learn more about setting up an instrumentation hook in Next.js: https://nextjs.org/docs/app/building-your-application/optimizing/instrumentation. You can safely delete the \`${filename}\` file afterward.`, + `[@sentry/nextjs] It appears you've configured a \`${filename}\` file. Please ensure to put this file's content into the \`register()\` function of a Next.js instrumentation file instead. To ensure correct functionality of the SDK, \`Sentry.init\` must be called inside of an instrumentation file. Learn more about setting up an instrumentation file in Next.js: https://nextjs.org/docs/app/building-your-application/optimizing/instrumentation. You can safely delete the \`${filename}\` file afterward.`, ); } } From 788976803528c379dc40513fb47d47392c5fec54 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Mon, 17 Mar 2025 11:12:38 +0100 Subject: [PATCH 23/24] meta(changelog): Update changelog for 9.6.0 --- CHANGELOG.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3eb2bd89a0d9..7ea76d84e6ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,27 @@ - "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott +## 9.6.0 + +### Important Changes + +- **feat(tanstackstart): Add `@sentry/tanstackstart-react` package and make `@sentry/tanstackstart` package a utility package ([#15629](https://github.com/getsentry/sentry-javascript/pull/15629))** + + Since TanStack Start is supposed to be a generic framework that supports libraries like React and Solid, the `@sentry/tanstackstart` SDK package was renamed to `@sentry/tanstackstart-react` to reflect that the SDK is specifically intended to be used for React TanStack Start applications. + Note that the TanStack Start SDK is still in alpha status and may be subject to breaking changes in non-major package updates. + +### Other Changes + +- chore(ci): Remove `type` from canary failure template ([#15698](https://github.com/getsentry/sentry-javascript/pull/15698)) +- feat(astro): Accept all vite-plugin options ([#15638](https://github.com/getsentry/sentry-javascript/pull/15638)) +- feat(deps): bump @sentry/webpack-plugin from 3.2.1 to 3.2.2 ([#15627](https://github.com/getsentry/sentry-javascript/pull/15627)) +- feat(tanstackstart): Refine initial API ([#15574](https://github.com/getsentry/sentry-javascript/pull/15574)) +- fix(core): Ensure `fill` only patches functions ([#15632](https://github.com/getsentry/sentry-javascript/pull/15632)) +- fix(nextjs): Consider `pageExtensions` when looking for instrumentation file ([#15701](https://github.com/getsentry/sentry-javascript/pull/15701)) +- fix(remix): Null-check `options` ([#15610](https://github.com/getsentry/sentry-javascript/pull/15610)) +- fix(sveltekit): Correctly parse angle bracket type assertions for auto instrumentation ([#15578](https://github.com/getsentry/sentry-javascript/pull/15578)) +- fix(sveltekit): Guard process variable ([#15605](https://github.com/getsentry/sentry-javascript/pull/15605)) + Work in this release was contributed by @angelikatyborska and @nwalters512. Thank you for your contributions! ## 9.5.0 From 8dc6e50597f440d78d7e13bc7175f309fafe6f9f Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Mon, 17 Mar 2025 16:06:17 +0100 Subject: [PATCH 24/24] Remove unnecessary changelog item --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ea76d84e6ed..71b26ab8fcef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,6 @@ ### Other Changes -- chore(ci): Remove `type` from canary failure template ([#15698](https://github.com/getsentry/sentry-javascript/pull/15698)) - feat(astro): Accept all vite-plugin options ([#15638](https://github.com/getsentry/sentry-javascript/pull/15638)) - feat(deps): bump @sentry/webpack-plugin from 3.2.1 to 3.2.2 ([#15627](https://github.com/getsentry/sentry-javascript/pull/15627)) - feat(tanstackstart): Refine initial API ([#15574](https://github.com/getsentry/sentry-javascript/pull/15574))