Skip to content

Commit 39db3cd

Browse files
chargomeclaude
andcommitted
feat(sveltekit)!: Remove unstable_sentryVitePluginOptions
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 3f57a05 commit 39db3cd

3 files changed

Lines changed: 92 additions & 242 deletions

File tree

packages/sveltekit/src/vite/sentryVitePlugins.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { consoleSandbox } from '@sentry/core';
1+
import { consoleSandbox, warnOnRemovedBuildOptions } from '@sentry/core';
22
import { sentryOrchestrionPlugin } from '@sentry/server-utils/orchestrion/vite';
33
import * as fs from 'fs';
44
import * as path from 'path';
@@ -25,6 +25,8 @@ const DEFAULT_PLUGIN_OPTIONS: SentrySvelteKitPluginOptions = {
2525
* Make sure, it is registered before the SvelteKit plugin.
2626
*/
2727
export async function sentrySvelteKit(options: SentrySvelteKitPluginOptions = {}): Promise<Plugin[]> {
28+
warnOnRemovedBuildOptions(options, ['unstable_sentryVitePluginOptions']);
29+
2830
const svelteConfig = await loadSvelteConfig();
2931

3032
const mergedOptions = {
@@ -170,7 +172,7 @@ async function readPackageMajor(
170172

171173
/**
172174
* This function creates the options for the custom Sentry Vite plugin.
173-
* The options are derived from the Sentry SvelteKit plugin options, where the `_unstable` options take precedence.
175+
* The options are derived from the Sentry SvelteKit plugin options.
174176
*
175177
* only exported for testing
176178
*/
@@ -195,7 +197,6 @@ export function generateVitePluginOptions(
195197
autoUploadSourceMaps: _filtered1,
196198
// eslint-disable-next-line @typescript-eslint/no-unused-vars
197199
autoInstrument: _filtered2,
198-
unstable_sentryVitePluginOptions,
199200
sentryUrl,
200201
...newSvelteKitPluginOptions
201202
} = svelteKitPluginOptions;
@@ -207,24 +208,20 @@ export function generateVitePluginOptions(
207208

208209
url: sentryUrl,
209210

210-
...unstable_sentryVitePluginOptions,
211-
212211
adapter: svelteKitPluginOptions.adapter,
213212
// override the plugin's debug flag with the one from the top-level options
214213
debug: svelteKitPluginOptions.debug,
215214
};
216215

217-
if (svelteKitPluginOptions.sourcemaps || unstable_sentryVitePluginOptions?.sourcemaps) {
216+
if (svelteKitPluginOptions.sourcemaps) {
218217
sentryVitePluginsOptions.sourcemaps = {
219218
...svelteKitPluginOptions.sourcemaps,
220-
...unstable_sentryVitePluginOptions?.sourcemaps,
221219
};
222220
}
223221

224-
if (svelteKitPluginOptions.release || unstable_sentryVitePluginOptions?.release) {
222+
if (svelteKitPluginOptions.release) {
225223
sentryVitePluginsOptions.release = {
226224
...svelteKitPluginOptions.release,
227-
...unstable_sentryVitePluginOptions?.release,
228225
};
229226
}
230227
}
Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { BuildTimeOptionsBase, UnstableVitePluginOptions } from '@sentry/core';
1+
import type { BuildTimeOptionsBase } from '@sentry/core';
22
import type { SentryVitePluginOptions } from '@sentry/bundler-plugins/vite';
33
import type { AutoInstrumentSelection } from './autoInstrument';
44
import type { SupportedSvelteKitAdapters } from './detectAdapter';
@@ -9,41 +9,40 @@ export type CustomSentryVitePluginOptions = SentryVitePluginOptions & {
99
};
1010

1111
/** Options for the Sentry SvelteKit plugin */
12-
export type SentrySvelteKitPluginOptions = BuildTimeOptionsBase &
13-
UnstableVitePluginOptions<Partial<SentryVitePluginOptions>> & {
14-
/**
15-
* The Sentry plugin will automatically instrument certain parts of your SvelteKit application at build time.
16-
* Set this option to `false` to disable this behavior or what is intrumented by passing an object.
17-
*
18-
* Auto instrumentation includes:
19-
* - Universal `load` functions in `+page.(js|ts)` files
20-
* - Server-only `load` functions in `+page.server.(js|ts)` files
21-
*
22-
* @default true (meaning, the plugin will instrument all of the above)
23-
*/
24-
autoInstrument?: boolean | AutoInstrumentSelection;
12+
export type SentrySvelteKitPluginOptions = BuildTimeOptionsBase & {
13+
/**
14+
* The Sentry plugin will automatically instrument certain parts of your SvelteKit application at build time.
15+
* Set this option to `false` to disable this behavior or what is intrumented by passing an object.
16+
*
17+
* Auto instrumentation includes:
18+
* - Universal `load` functions in `+page.(js|ts)` files
19+
* - Server-only `load` functions in `+page.server.(js|ts)` files
20+
*
21+
* @default true (meaning, the plugin will instrument all of the above)
22+
*/
23+
autoInstrument?: boolean | AutoInstrumentSelection;
2524

26-
/**
27-
* Specify which SvelteKit adapter you're using.
28-
* By default, the SDK will attempt auto-detect the used adapter at build time and apply the
29-
* correct config for source maps upload or auto-instrumentation.
30-
*
31-
* Currently, the SDK supports the following adapters:
32-
* - node (@sveltejs/adapter-node)
33-
* - auto (@sveltejs/adapter-auto) only Vercel
34-
* - vercel (@sveltejs/adapter-auto) only Serverless functions, no edge runtime
35-
*
36-
* Set this option, if the SDK detects the wrong adapter or you want to use an adapter
37-
* that is not in this list. If you specify 'other', you'll most likely need to configure
38-
* source maps upload yourself.
39-
*
40-
* @default {} the SDK attempts to auto-detect the used adapter at build time
41-
*/
42-
adapter?: SupportedSvelteKitAdapters;
25+
/**
26+
* Specify which SvelteKit adapter you're using.
27+
* By default, the SDK will attempt auto-detect the used adapter at build time and apply the
28+
* correct config for source maps upload or auto-instrumentation.
29+
*
30+
* Currently, the SDK supports the following adapters:
31+
* - node (@sveltejs/adapter-node)
32+
* - auto (@sveltejs/adapter-auto) only Vercel
33+
* - vercel (@sveltejs/adapter-auto) only Serverless functions, no edge runtime
34+
*
35+
* Set this option, if the SDK detects the wrong adapter or you want to use an adapter
36+
* that is not in this list. If you specify 'other', you'll most likely need to configure
37+
* source maps upload yourself.
38+
*
39+
* @default {} the SDK attempts to auto-detect the used adapter at build time
40+
*/
41+
adapter?: SupportedSvelteKitAdapters;
4342

44-
/**
45-
* If this flag is `true`, the Sentry plugins will automatically upload source maps to Sentry.
46-
* @default true`.
47-
*/
48-
autoUploadSourceMaps?: boolean;
49-
};
43+
/**
44+
* If this flag is `true`, the Sentry plugins will automatically upload source maps to Sentry.
45+
* @default true`.
46+
*/
47+
autoUploadSourceMaps?: boolean;
48+
};

0 commit comments

Comments
 (0)