Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,9 @@ const tsConfig = require(baseTscConfigPath);
// TS 3.8 fails build when it encounters a config option it does not understand, so we remove it :(
delete tsConfig.compilerOptions.noUncheckedIndexedAccess;

// TS 3.8 doesn't support "bundler" moduleResolution (introduced in TS 5.0)
if (tsConfig.compilerOptions.moduleResolution === 'bundler') {
tsConfig.compilerOptions.moduleResolution = 'node';
}

writeFileSync(baseTscConfigPath, JSON.stringify(tsConfig, null, 2));
5 changes: 5 additions & 0 deletions dev-packages/node-integration-tests/scripts/use-ts-3_8.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,9 @@ const tsConfig = require(baseTscConfigPath);
// TS 3.8 fails build when it encounters a config option it does not understand, so we remove it :(
delete tsConfig.compilerOptions.noUncheckedIndexedAccess;

// TS 3.8 doesn't support "bundler" moduleResolution (introduced in TS 5.0)
if (tsConfig.compilerOptions.moduleResolution === 'bundler') {
tsConfig.compilerOptions.moduleResolution = 'node';
}

writeFileSync(baseTscConfigPath, JSON.stringify(tsConfig, null, 2));
3 changes: 2 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"{workspaceRoot}/*.js",
"{workspaceRoot}/*.json",
"{workspaceRoot}/yarn.lock",
"{workspaceRoot}/dev-packages/rollup-utils/**"
"{workspaceRoot}/dev-packages/rollup-utils/**",
"{workspaceRoot}/packages/typescript/**"
],
"production": ["default", "!{projectRoot}/test/**/*", "!{projectRoot}/**/*.md", "!{projectRoot}/*.tgz"]
},
Expand Down
26 changes: 24 additions & 2 deletions packages/angular/tsconfig.ngc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,34 @@
// This tsconfig is used when building @sentry/angular with the Angular
// compiler and `ng-packagr`. It configures a production build conforming
// to the Angular Package Format (APF).
//
// Does NOT extend the shared base tsconfig because ng-packagr ships its own
// older TypeScript that doesn't support "moduleResolution": "bundler".
{
"extends": "./tsconfig.json",
"include": ["**/*.ts", "src/**/*"],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is sad that we have to do this :(
But it seems to be the only way

@logaretm logaretm Jun 16, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I don't want to go on an upgrade trip and find the lowest possible version of angular build tooling that both works for us and makes the angular SDK build properly without breaking our support range.

We probably need to upgrade this setup at somepoint.

"exclude": ["patch-vitest.ts", "setup-test.ts"],
"compilerOptions": {
"target": "es2020",
"declaration": false,
"declarationMap": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"importHelpers": true,
"inlineSources": true,
"isolatedModules": true,
"lib": ["DOM", "es2020"],
"moduleResolution": "node",
"noErrorTruncation": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noUncheckedIndexedAccess": true,
"preserveWatchOutput": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"strictBindCallApply": false,
"target": "es2020",
"baseUrl": "./"
},
"angularCompilerOptions": {
Expand Down
1 change: 0 additions & 1 deletion packages/astro/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"include": ["src/**/*"],

"compilerOptions": {
"moduleResolution": "bundler"
// package-specific options
}
}
1 change: 0 additions & 1 deletion packages/browser/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"include": ["src/**/*", "test/loader.js"],

"compilerOptions": {
"moduleResolution": "bundler",
"lib": ["DOM", "es2020", "WebWorker"]
}
}
1 change: 0 additions & 1 deletion packages/cloudflare/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"include": ["src/**/*"],

"compilerOptions": {
"module": "esnext",
"types": ["node", "@cloudflare/workers-types"]
}
}
2 changes: 0 additions & 2 deletions packages/core/tsconfig.types.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
"extends": "./tsconfig.json",

"compilerOptions": {
"module": "esnext",
"moduleResolution": "bundler",
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": true,
Expand Down
1 change: 0 additions & 1 deletion packages/deno/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"include": ["./lib.deno.d.ts", "src/**/*", "example.ts"],
"compilerOptions": {
"lib": ["esnext"],
"module": "esnext",
"target": "esnext"
}
}
1 change: 0 additions & 1 deletion packages/deno/tsconfig.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"include": ["./lib.deno.d.ts", "test/**/*"],
"compilerOptions": {
"lib": ["esnext"],
"module": "esnext",
"target": "esnext"
}
}
2 changes: 0 additions & 2 deletions packages/effect/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"module": "esnext",
"moduleResolution": "bundler",
"outDir": "build"
},
"include": ["src/**/*"]
Expand Down
2 changes: 0 additions & 2 deletions packages/ember/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@
"target": "es2022",
"lib": ["DOM", "ES2022"],
"allowJs": true,
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"alwaysStrict": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"noEmitOnError": false,
"noEmit": true,
"baseUrl": ".",
"module": "esnext",
"experimentalDecorators": true,
"paths": {
"dummy/tests/*": ["tests/*"],
Expand Down
2 changes: 0 additions & 2 deletions packages/feedback/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"module": "esnext",

/* Preact Config */
"jsx": "react-jsx",
"jsxImportSource": "preact",
Expand Down
1 change: 0 additions & 1 deletion packages/hono/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"include": ["src/**/*"],

"compilerOptions": {
"module": "esnext",
"types": ["node", "@cloudflare/workers-types"]
}
}
1 change: 0 additions & 1 deletion packages/integration-shims/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"include": ["src/**/*"],

"compilerOptions": {
"moduleResolution": "bundler"
// package-specific options
}
}
2 changes: 0 additions & 2 deletions packages/nextjs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@

"compilerOptions": {
// package-specific options
"module": "esnext",
"moduleResolution": "bundler"
}
}
3 changes: 0 additions & 3 deletions packages/nextjs/tsconfig.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
// should include all types from `./tsconfig.json` plus types for all test frameworks used
"types": ["node"],

// require for top-level await
"module": "Node16",
"moduleResolution": "Node16",
"target": "es2020",

// other package-specific, test-specific options
Expand Down
2 changes: 0 additions & 2 deletions packages/nitro/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@

"compilerOptions": {
// package-specific options
"module": "esnext",
"moduleResolution": "bundler"
}
}
4 changes: 1 addition & 3 deletions packages/node-core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
"include": ["src/**/*"],

"compilerOptions": {
"lib": ["ES2020", "ES2021.WeakRef"],
"module": "Node16",
"moduleResolution": "Node16"
"lib": ["ES2020", "ES2021.WeakRef"]
}
}
2 changes: 0 additions & 2 deletions packages/node-native/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"module": "esnext",
"lib": ["es2020"],
"outDir": "build",
"types": ["node"]
},
Expand Down
6 changes: 1 addition & 5 deletions packages/node/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,5 @@

"include": ["src/**/*"],

"compilerOptions": {
"lib": ["es2020"],
"module": "Node16",
"moduleResolution": "Node16"
}
"compilerOptions": {}
}
2 changes: 0 additions & 2 deletions packages/nuxt/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@

"compilerOptions": {
// package-specific options
"module": "esnext",
"moduleResolution": "bundler"
}
}
2 changes: 0 additions & 2 deletions packages/profiling-node/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"module": "esnext",
"lib": ["es2020"],
"outDir": "build",
"types": ["node"]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ describe('wrapServerAction', () => {
it('should skip span creation and warn when instrumentation API is used', async () => {
// Reset modules to get a fresh copy with unset warning flag
vi.resetModules();
// @ts-expect-error - Dynamic import for module reset works at runtime but vitest's typecheck doesn't fully support it
const { wrapServerAction: freshWrapServerAction } = await import('../../src/server/wrapServerAction');

// Set the global flag indicating instrumentation API is in use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ describe('wrapServerLoader', () => {
it('should skip span creation and warn when instrumentation API is used', async () => {
// Reset modules to get a fresh copy with unset warning flag
vi.resetModules();
// @ts-expect-error - Dynamic import for module reset works at runtime but vitest's typecheck doesn't fully support it
const { wrapServerLoader: freshWrapServerLoader } = await import('../../src/server/wrapServerLoader');

// Set the global flag indicating instrumentation API is in use
Expand Down
1 change: 0 additions & 1 deletion packages/react-router/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"include": ["src/**/*"],

"compilerOptions": {
"moduleResolution": "bundler",
"jsx": "react"
}
}
2 changes: 0 additions & 2 deletions packages/react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

"compilerOptions": {
"lib": ["DOM", "es2020"],
"module": "esnext",
"moduleResolution": "bundler",
// package-specific options
"esModuleInterop": true,
"jsx": "react"
Expand Down
4 changes: 1 addition & 3 deletions packages/remix/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
"include": ["src/**/*"],

"compilerOptions": {
"jsx": "react",
"module": "esnext",
"moduleResolution": "bundler"
"jsx": "react"
}
}
3 changes: 0 additions & 3 deletions packages/remix/tsconfig.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
"compilerOptions": {
"lib": ["DOM", "es2020"],
"types": ["node"],
// Required for top-level await in tests
"module": "Node16",
"moduleResolution": "Node16",
"target": "es2020",

"esModuleInterop": true
Expand Down
3 changes: 1 addition & 2 deletions packages/replay-canvas/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"lib": ["DOM", "es2020"],
"module": "esnext"
"lib": ["DOM", "es2020"]
},
"include": ["src/**/*.ts"]
}
3 changes: 1 addition & 2 deletions packages/replay-internal/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"lib": ["DOM", "es2020"],
"module": "esnext"
"lib": ["DOM", "es2020"]
},
"include": ["src/**/*.ts"]
}
1 change: 0 additions & 1 deletion packages/replay-worker/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"module": "esnext",
"lib": ["webworker", "scripthost"],
"esModuleInterop": true,
"target": "es2020",
Expand Down
4 changes: 1 addition & 3 deletions packages/server-utils/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@

"include": ["src/**/*"],

"compilerOptions": {
"lib": ["ES2020"]
}
"compilerOptions": {}
}
5 changes: 1 addition & 4 deletions packages/solidstart/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,5 @@

"include": ["src/**/*"],

"compilerOptions": {
"module": "esnext",
"moduleResolution": "bundler"
}
"compilerOptions": {}
}
3 changes: 1 addition & 2 deletions packages/svelte/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { PreprocessorGroup } from 'svelte/types/compiler/preprocess';
import { componentTrackingPreprocessor, defaultComponentTrackingOptions } from './preprocessors';
import type { SentryPreprocessorGroup, SentrySvelteConfigOptions, SvelteConfig } from './types';
import type { PreprocessorGroup, SentryPreprocessorGroup, SentrySvelteConfigOptions, SvelteConfig } from './types';

const defaultSentryOptions: SentrySvelteConfigOptions = {
componentTracking: defaultComponentTrackingOptions,
Expand Down
8 changes: 6 additions & 2 deletions packages/svelte/src/preprocessors.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import MagicString from 'magic-string';
import type { PreprocessorGroup } from 'svelte/types/compiler/preprocess';
import type { ComponentTrackingInitOptions, SentryPreprocessorGroup, TrackComponentOptions } from './types';
import type {
ComponentTrackingInitOptions,
PreprocessorGroup,
SentryPreprocessorGroup,
TrackComponentOptions,
} from './types';

export const defaultComponentTrackingOptions: Required<ComponentTrackingInitOptions> = {
trackComponents: true,
Expand Down
32 changes: 30 additions & 2 deletions packages/svelte/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { CompileOptions } from 'svelte/types/compiler';
import type { PreprocessorGroup } from 'svelte/types/compiler/preprocess';
import type { CompileOptions } from 'svelte/compiler';

// Adds an id property to the preprocessor object we can use to check for duplication
// in the preprocessors array
Expand Down Expand Up @@ -70,3 +69,32 @@ export type TrackComponentOptions = {
*/
componentName?: string;
} & SpanOptions;

// vendor those types from svelte/types/compiler/preprocess
export interface Processed {
code: string;
map?: string | object;
dependencies?: string[];
toString?: () => string;
}
export declare type MarkupPreprocessor = (options: {
content: string;
filename?: string;
}) => Processed | void | Promise<Processed | void>;
export declare type Preprocessor = (options: {
/**
* The script/style tag content
*/
content: string;
attributes: Record<string, string | boolean>;
/**
* The whole Svelte file content
*/
markup: string;
filename?: string;
}) => Processed | void | Promise<Processed | void>;
export interface PreprocessorGroup {
markup?: MarkupPreprocessor;
style?: Preprocessor;
script?: Preprocessor;
}
Comment on lines +96 to +100

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The vendored PreprocessorGroup type is missing the name property, which is required in Svelte 4 and 5, potentially causing runtime errors in user projects.
Severity: MEDIUM

Suggested Fix

Add the name: string; property to the PreprocessorGroup interface in packages/svelte/src/types.ts. Then, assign a unique name to the preprocessor objects created in packages/svelte/src/preprocessors.ts to conform to the Svelte 4+ API.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: packages/svelte/src/types.ts#L96-L100

Potential issue: The vendored `PreprocessorGroup` type, which is used to configure
Svelte preprocessors, is missing the `name` property. While the project's tests pass
with Svelte 3, the package claims support for Svelte 4 and 5, where this property is
required according to official types and documentation. If a user integrates this SDK
with a Svelte 5 project, the Svelte compiler may throw a runtime error when it receives
a preprocessor object without the expected `name` property, causing the build process to
fail.

Also affects:

  • packages/svelte/src/preprocessors.ts:1~10

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are internal types, not exposed to users AFAIK.

Loading
Loading