Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 67088e8

Browse files
committed
test(solidstart): Don't rely on flushing for lowQualityTransactionFilter
1 parent 2ec09c9 commit 67088e8

File tree

4 files changed

+389
-101
lines changed

4 files changed

+389
-101
lines changed

‎packages/core/src/build-time-plugins/buildTimeOptionsBase.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,13 @@ interface ReleaseOptions {
257257
*/
258258
name?: string;
259259

260+
/**
261+
* Whether the plugin should inject release information into the build for the SDK to pick it up when sending events (recommended).
262+
*
263+
* @default true
264+
*/
265+
inject?: boolean;
266+
260267
/**
261268
* Whether to create a new release.
262269
*

‎packages/sveltekit/src/vite/sentryVitePlugins.ts

Lines changed: 56 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,31 +73,80 @@ export function generateVitePluginOptions(
7373
};
7474
}
7575

76+
// todo(v11): remove deprecated options (Also from options type)
77+
7678
// Source Maps
7779
if (svelteKitPluginOptions.autoUploadSourceMaps && process.env.NODE_ENV !== 'development') {
78-
const { unstable_sentryVitePluginOptions, ...sourceMapsUploadOptions } =
79-
svelteKitPluginOptions.sourceMapsUploadOptions || {};
80+
const {
81+
// eslint-disable-next-line deprecation/deprecation
82+
unstable_sentryVitePluginOptions: deprecated_unstableSourceMapUploadOptions,
83+
...deprecatedSourceMapUploadOptions
84+
// eslint-disable-next-line deprecation/deprecation
85+
} = svelteKitPluginOptions.sourceMapsUploadOptions || {};
86+
87+
const {
88+
// eslint-disable-next-line @typescript-eslint/no-unused-vars,deprecation/deprecation
89+
sourceMapsUploadOptions: _filtered1,
90+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
91+
unstable_sentryVitePluginOptions: _filtered2,
92+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
93+
autoUploadSourceMaps: _filtered3,
94+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
95+
autoInstrument: _filtered4,
96+
sentryUrl,
97+
...newSvelteKitPluginOptions
98+
} = svelteKitPluginOptions;
99+
100+
const { unstable_sentryVitePluginOptions } = svelteKitPluginOptions;
80101

81102
sentryVitePluginsOptions = {
82103
...(sentryVitePluginsOptions ? sentryVitePluginsOptions : {}),
83104

84-
...sourceMapsUploadOptions,
105+
...deprecatedSourceMapUploadOptions,
106+
...newSvelteKitPluginOptions,
107+
108+
url: sentryUrl,
109+
110+
...deprecated_unstableSourceMapUploadOptions,
85111
...unstable_sentryVitePluginOptions,
112+
86113
adapter: svelteKitPluginOptions.adapter,
87114
// override the plugin's debug flag with the one from the top-level options
88115
debug: svelteKitPluginOptions.debug,
89116
};
90117

91-
if (sentryVitePluginsOptions.sourcemaps) {
118+
// Handle sourcemaps options - merge deprecated and new, with new taking precedence
119+
if (
120+
// eslint-disable-next-line deprecation/deprecation
121+
deprecatedSourceMapUploadOptions.sourcemaps ||
122+
svelteKitPluginOptions.sourcemaps ||
123+
deprecated_unstableSourceMapUploadOptions?.sourcemaps ||
124+
unstable_sentryVitePluginOptions?.sourcemaps
125+
) {
92126
sentryVitePluginsOptions.sourcemaps = {
93-
...sourceMapsUploadOptions?.sourcemaps,
127+
// eslint-disable-next-line deprecation/deprecation
128+
...deprecatedSourceMapUploadOptions.sourcemaps,
129+
...svelteKitPluginOptions.sourcemaps,
130+
// Also handle nested deprecated options from unstable plugin options
131+
...deprecated_unstableSourceMapUploadOptions?.sourcemaps,
94132
...unstable_sentryVitePluginOptions?.sourcemaps,
95133
};
96134
}
97135

98-
if (sentryVitePluginsOptions.release) {
136+
// Handle release options - merge deprecated and new, with new taking precedence
137+
if (
138+
// eslint-disable-next-line deprecation/deprecation
139+
deprecatedSourceMapUploadOptions.release ||
140+
svelteKitPluginOptions.release ||
141+
deprecated_unstableSourceMapUploadOptions?.release ||
142+
unstable_sentryVitePluginOptions?.release
143+
) {
99144
sentryVitePluginsOptions.release = {
100-
...sourceMapsUploadOptions?.release,
145+
// eslint-disable-next-line deprecation/deprecation
146+
...deprecatedSourceMapUploadOptions.release,
147+
...svelteKitPluginOptions.release,
148+
// Also handle nested deprecated options from unstable plugin options
149+
...deprecated_unstableSourceMapUploadOptions?.release,
101150
...unstable_sentryVitePluginOptions?.release,
102151
};
103152
}

‎packages/sveltekit/src/vite/types.ts

Lines changed: 66 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { BuildTimeOptionsBase, UnstableVitePluginOptions } from '@sentry/core';
12
import type { SentryVitePluginOptions } from '@sentry/vite-plugin';
23
import type { AutoInstrumentSelection } from './autoInstrument';
34
import type { SupportedSvelteKitAdapters } from './detectAdapter';
@@ -19,18 +20,24 @@ type SourceMapsUploadOptions = {
1920
*
2021
* To create an auth token, follow this guide:
2122
* @see https://docs.sentry.io/product/accounts/auth-tokens/#organization-auth-tokens
23+
*
24+
* @deprecated Use option `authToken` instead of `sourceMapsUploadOptions.authToken`
2225
*/
2326
authToken?: string;
2427

2528
/**
2629
* The organization slug of your Sentry organization.
2730
* Instead of specifying this option, you can also set the `SENTRY_ORG` environment variable.
31+
*
32+
* @deprecated Use option `org` instead of `sourceMapsUploadOptions.org`
2833
*/
2934
org?: string;
3035

3136
/**
3237
* The project slug of your Sentry project.
3338
* Instead of specifying this option, you can also set the `SENTRY_PROJECT` environment variable.
39+
*
40+
* @deprecated Use option `project` instead of `sourceMapsUploadOptions.project`
3441
*/
3542
project?: string;
3643

@@ -39,11 +46,13 @@ type SourceMapsUploadOptions = {
3946
* It will not collect any sensitive or user-specific data.
4047
*
4148
* @default true
49+
* @deprecated Use option `telemetry` instead of `sourceMapsUploadOptions.telemetry`
4250
*/
4351
telemetry?: boolean;
4452

4553
/**
4654
* Options related to sourcemaps
55+
* @deprecated Use `sourcemaps` instead of `sourceMapsUploadOptions.sourcemaps`
4756
*/
4857
sourcemaps?: {
4958
/**
@@ -55,6 +64,7 @@ type SourceMapsUploadOptions = {
5564
*
5665
* The globbing patterns must follow the implementation of the `glob` package.
5766
* @see https://www.npmjs.com/package/glob#glob-primer
67+
* @deprecated Use `sourcemaps.assets` instead of `sourceMapsUploadOptions.sourcemaps.assets`
5868
*/
5969
assets?: string | Array<string>;
6070

@@ -65,6 +75,8 @@ type SourceMapsUploadOptions = {
6575
* or the default value for `assets` are uploaded.
6676
*
6777
* The globbing patterns follow the implementation of the glob package. (https://www.npmjs.com/package/glob)
78+
*
79+
* @deprecated Use `sourcemaps.ignore` instead of `sourceMapsUploadOptions.sourcemaps.ignore`
6880
*/
6981
ignore?: string | Array<string>;
7082

@@ -75,6 +87,8 @@ type SourceMapsUploadOptions = {
7587
* @default [] - By default no files are deleted.
7688
*
7789
* The globbing patterns follow the implementation of the glob package. (https://www.npmjs.com/package/glob)
90+
*
91+
* @deprecated Use `sourcemaps.filesToDeleteAfterUpload` instead of `sourceMapsUploadOptions.sourcemaps.filesToDeleteAfterUpload`
7892
*/
7993
filesToDeleteAfterUpload?: string | Array<string>;
8094
};
@@ -83,6 +97,8 @@ type SourceMapsUploadOptions = {
8397
* Options related to managing the Sentry releases for a build.
8498
*
8599
* Note: Managing releases is optional and not required for uploading source maps.
100+
*
101+
* @deprecated Use `release` instead of `sourceMapsUploadOptions.release`
86102
*/
87103
release?: {
88104
/**
@@ -94,6 +110,8 @@ type SourceMapsUploadOptions = {
94110
* access to git CLI and for the root directory to be a valid repository).
95111
*
96112
* If you didn't provide a value and the plugin can't automatically detect one, no release will be created.
113+
*
114+
* @deprecated Use `release.name` instead of `sourceMapsUploadOptions.release.name`
97115
*/
98116
name?: string;
99117

@@ -102,12 +120,16 @@ type SourceMapsUploadOptions = {
102120
* sending events.
103121
*
104122
* Defaults to `true`.
123+
*
124+
* @deprecated Use `release.inject` instead of `sourceMapsUploadOptions.release.inject`
105125
*/
106126
inject?: boolean;
107127
};
108128

109129
/**
110130
* The URL of the Sentry instance to upload the source maps to.
131+
*
132+
* @deprecated Use `sentryUrl` instead of `sourceMapsUploadOptions.url`
111133
*/
112134
url?: string;
113135

@@ -123,104 +145,54 @@ type SourceMapsUploadOptions = {
123145
* changes can occur at any time within a major SDK version.
124146
*
125147
* Furthermore, some options are untested with SvelteKit specifically. Use with caution.
126-
*/
127-
unstable_sentryVitePluginOptions?: Partial<SentryVitePluginOptions>;
128-
};
129-
130-
type BundleSizeOptimizationOptions = {
131-
/**
132-
* If set to `true`, the plugin will attempt to tree-shake (remove) any debugging code within the Sentry SDK.
133-
* Note that the success of this depends on tree shaking being enabled in your build tooling.
134-
*
135-
* Setting this option to `true` will disable features like the SDK's `debug` option.
136-
*/
137-
excludeDebugStatements?: boolean;
138-
139-
/**
140-
* If set to true, the plugin will try to tree-shake tracing statements out.
141-
* Note that the success of this depends on tree shaking generally being enabled in your build.
142-
* Attention: DO NOT enable this when you're using any performance monitoring-related SDK features (e.g. Sentry.startSpan()).
143-
*/
144-
excludeTracing?: boolean;
145-
146-
/**
147-
* If set to `true`, the plugin will attempt to tree-shake (remove) code related to the Sentry SDK's Session Replay Shadow DOM recording functionality.
148-
* Note that the success of this depends on tree shaking being enabled in your build tooling.
149148
*
150-
* This option is safe to be used when you do not want to capture any Shadow DOM activity via Sentry Session Replay.
149+
* @deprecated Use `unstable_sentryVitePluginOptions` instead of `sourceMapsUploadOptions.unstable_sentryVitePluginOptions`
151150
*/
152-
excludeReplayShadowDom?: boolean;
153-
154-
/**
155-
* If set to `true`, the plugin will attempt to tree-shake (remove) code related to the Sentry SDK's Session Replay `iframe` recording functionality.
156-
* Note that the success of this depends on tree shaking being enabled in your build tooling.
157-
*
158-
* You can safely do this when you do not want to capture any `iframe` activity via Sentry Session Replay.
159-
*/
160-
excludeReplayIframe?: boolean;
161-
162-
/**
163-
* If set to `true`, the plugin will attempt to tree-shake (remove) code related to the Sentry SDK's Session Replay's Compression Web Worker.
164-
* Note that the success of this depends on tree shaking being enabled in your build tooling.
165-
*
166-
* **Notice:** You should only do use this option if you manually host a compression worker and configure it in your Sentry Session Replay integration config via the `workerUrl` option.
167-
*/
168-
excludeReplayWorker?: boolean;
151+
unstable_sentryVitePluginOptions?: Partial<SentryVitePluginOptions>;
169152
};
170153

171154
/** Options for the Sentry SvelteKit plugin */
172-
export type SentrySvelteKitPluginOptions = {
173-
/**
174-
* If this flag is `true`, the Sentry plugins will log some useful debug information.
175-
* @default false.
176-
*/
177-
debug?: boolean;
178-
179-
/**
180-
* The Sentry plugin will automatically instrument certain parts of your SvelteKit application at build time.
181-
* Set this option to `false` to disable this behavior or what is intrumented by passing an object.
182-
*
183-
* Auto instrumentation includes:
184-
* - Universal `load` functions in `+page.(js|ts)` files
185-
* - Server-only `load` functions in `+page.server.(js|ts)` files
186-
*
187-
* @default true (meaning, the plugin will instrument all of the above)
188-
*/
189-
autoInstrument?: boolean | AutoInstrumentSelection;
190-
191-
/**
192-
* Specify which SvelteKit adapter you're using.
193-
* By default, the SDK will attempt auto-detect the used adapter at build time and apply the
194-
* correct config for source maps upload or auto-instrumentation.
195-
*
196-
* Currently, the SDK supports the following adapters:
197-
* - node (@sveltejs/adapter-node)
198-
* - auto (@sveltejs/adapter-auto) only Vercel
199-
* - vercel (@sveltejs/adapter-auto) only Serverless functions, no edge runtime
200-
*
201-
* Set this option, if the SDK detects the wrong adapter or you want to use an adapter
202-
* that is not in this list. If you specify 'other', you'll most likely need to configure
203-
* source maps upload yourself.
204-
*
205-
* @default {} the SDK attempts to auto-detect the used adapter at build time
206-
*/
207-
adapter?: SupportedSvelteKitAdapters;
155+
export type SentrySvelteKitPluginOptions = BuildTimeOptionsBase &
156+
UnstableVitePluginOptions<Partial<SentryVitePluginOptions>> & {
157+
/**
158+
* The Sentry plugin will automatically instrument certain parts of your SvelteKit application at build time.
159+
* Set this option to `false` to disable this behavior or what is intrumented by passing an object.
160+
*
161+
* Auto instrumentation includes:
162+
* - Universal `load` functions in `+page.(js|ts)` files
163+
* - Server-only `load` functions in `+page.server.(js|ts)` files
164+
*
165+
* @default true (meaning, the plugin will instrument all of the above)
166+
*/
167+
autoInstrument?: boolean | AutoInstrumentSelection;
208168

209-
/**
210-
* Options for the Sentry Vite plugin to customize bundle size optimizations.
211-
*
212-
* These options are always read from the `sentryAstro` integration.
213-
* Do not define them in the `sentry.client.config.(js|ts)` or `sentry.server.config.(js|ts)` files.
214-
*/
215-
bundleSizeOptimizations?: BundleSizeOptimizationOptions;
169+
/**
170+
* Specify which SvelteKit adapter you're using.
171+
* By default, the SDK will attempt auto-detect the used adapter at build time and apply the
172+
* correct config for source maps upload or auto-instrumentation.
173+
*
174+
* Currently, the SDK supports the following adapters:
175+
* - node (@sveltejs/adapter-node)
176+
* - auto (@sveltejs/adapter-auto) only Vercel
177+
* - vercel (@sveltejs/adapter-auto) only Serverless functions, no edge runtime
178+
*
179+
* Set this option, if the SDK detects the wrong adapter or you want to use an adapter
180+
* that is not in this list. If you specify 'other', you'll most likely need to configure
181+
* source maps upload yourself.
182+
*
183+
* @default {} the SDK attempts to auto-detect the used adapter at build time
184+
*/
185+
adapter?: SupportedSvelteKitAdapters;
216186

217-
/**
218-
* If this flag is `true`, the Sentry plugins will automatically upload source maps to Sentry.
219-
* @default true`.
220-
*/
221-
autoUploadSourceMaps?: boolean;
222-
/**
223-
* Options related to source maps upload to Sentry
224-
*/
225-
sourceMapsUploadOptions?: SourceMapsUploadOptions;
226-
};
187+
/**
188+
* If this flag is `true`, the Sentry plugins will automatically upload source maps to Sentry.
189+
* @default true`.
190+
*/
191+
autoUploadSourceMaps?: boolean;
192+
/**
193+
* Options related to source maps upload to Sentry
194+
*
195+
* @deprecated This option was deprecated as it adds unnecessary nesting. Put the options one level higher to the root-level of the Sentry Svelte plugin options.
196+
*/
197+
sourceMapsUploadOptions?: SourceMapsUploadOptions;
198+
};

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /