Skip to content

Commit 9ad23a8

Browse files
authored
feat(v8/svelte): Remove deprecated componentTrackingPreprocessor export (#11277)
ref #10100
1 parent d06af96 commit 9ad23a8

File tree

7 files changed

+40
-12
lines changed

7 files changed

+40
-12
lines changed

MIGRATION.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ To make sure these integrations work properly you'll have to change how you
350350
- [Astro SDK](./MIGRATION.md#astro-sdk)
351351
- [AWS Serverless SDK](./MIGRATION.md#aws-serverless-sdk)
352352
- [Ember SDK](./MIGRATION.md#ember-sdk)
353+
- [Svelte SDK](./MIGRATION.md#svelte-sdk)
353354

354355
### General
355356

@@ -927,6 +928,42 @@ Removed top-level exports: `InitSentryForEmber`, `StartTransactionFunction`
927928
The `InitSentryForEmber` export has been removed. Instead, you should use the `Sentry.init` method to initialize the
928929
SDK.
929930

931+
### Svelte SDK
932+
933+
Removed top-level exports: `componentTrackingPreprocessor`
934+
935+
#### Removal of `componentTrackingPreprocessor` export
936+
937+
The `componentTrackingPreprocessor` export has been removed. You should instead use `withSentryConfig` to configure
938+
component tracking.
939+
940+
```js
941+
// v7 - svelte.config.js
942+
import { componentTrackingPreprocessor } from '@sentry/svelte';
943+
944+
const config = {
945+
preprocess: [
946+
componentTrackingPreprocessor(),
947+
// ...
948+
],
949+
// ...
950+
};
951+
952+
export default config;
953+
```
954+
955+
```js
956+
// v8 - svelte.config.js
957+
import { withSentryConfig } from "@sentry/svelte";
958+
959+
const config = {
960+
// Your svelte config
961+
compilerOptions: {...},
962+
};
963+
964+
export default withSentryConfig(config);
965+
```
966+
930967
## 5. Behaviour Changes
931968

932969
- [Updated behaviour of `tracePropagationTargets` in the browser](./MIGRATION.md#updated-behaviour-of-tracepropagationtargets-in-the-browser-http-tracing-headers--cors)

packages/svelte/src/config.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ export function withSentryConfig(
3333

3434
const shouldTrackComponents = mergedOptions.componentTracking && mergedOptions.componentTracking.trackComponents;
3535
if (shouldTrackComponents) {
36-
// TODO(v8): Remove eslint rule
37-
// eslint-disable-next-line deprecation/deprecation
3836
const firstPassPreproc: SentryPreprocessorGroup = componentTrackingPreprocessor(mergedOptions.componentTracking);
3937
sentryPreprocessors.set(firstPassPreproc.sentryId || '', firstPassPreproc);
4038
}

packages/svelte/src/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ export * from '@sentry/browser';
77

88
export { init } from './sdk';
99

10-
// TODO(v8): Remove this export
11-
// eslint-disable-next-line deprecation/deprecation
12-
export { componentTrackingPreprocessor } from './preprocessors';
13-
1410
export { trackComponent } from './performance';
1511

1612
export { withSentryConfig } from './config';

packages/svelte/src/performance.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ const defaultTrackComponentOptions: {
1919
/**
2020
* Tracks the Svelte component's intialization and mounting operation as well as
2121
* updates and records them as spans.
22+
*
2223
* This function is injected automatically into your Svelte components' code
23-
* if you are using the Sentry componentTrackingPreprocessor.
24+
* if you are using the withSentryConfig wrapper.
25+
*
2426
* Alternatively, you can call it yourself if you don't want to use the preprocessor.
2527
*/
2628
export function trackComponent(options?: TrackComponentOptions): void {

packages/svelte/src/preprocessors.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ export const FIRST_PASS_COMPONENT_TRACKING_PREPROC_ID = 'FIRST_PASS_COMPONENT_TR
1414
/**
1515
* Svelte Preprocessor to inject Sentry performance monitoring related code
1616
* into Svelte components.
17-
*
18-
* @deprecated Use `withSentryConfig` which is the new way of making compile-time modifications
19-
* to Svelte apps going forward.
2017
*/
2118
export function componentTrackingPreprocessor(options?: ComponentTrackingInitOptions): PreprocessorGroup {
2219
const mergedOptions = { ...defaultComponentTrackingOptions, ...options };

packages/svelte/test/config.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ describe('withSentryConfig', () => {
4848
});
4949

5050
it("doesn't add Sentry preprocessors that were already added by the users", () => {
51-
// eslint-disable-next-line deprecation/deprecation
5251
const sentryPreproc = componentTrackingPreprocessor();
5352
const originalConfig = {
5453
compilerOptions: {

packages/svelte/test/preprocessors.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as svelteCompiler from 'svelte/compiler';
22

3-
/* eslint-disable deprecation/deprecation */
43
import {
54
FIRST_PASS_COMPONENT_TRACKING_PREPROC_ID,
65
componentTrackingPreprocessor,

0 commit comments

Comments
 (0)