Skip to content

feat(v8/svelte): Remove deprecated componentTrackingPreprocessor export #11277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 26, 2024
Merged
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
37 changes: 37 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ To make sure these integrations work properly you'll have to change how you
- [Astro SDK](./MIGRATION.md#astro-sdk)
- [AWS Serverless SDK](./MIGRATION.md#aws-serverless-sdk)
- [Ember SDK](./MIGRATION.md#ember-sdk)
- [Svelte SDK](./MIGRATION.md#svelte-sdk)

### General

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

### Svelte SDK

Removed top-level exports: `componentTrackingPreprocessor`

#### Removal of `componentTrackingPreprocessor` export

The `componentTrackingPreprocessor` export has been removed. You should instead use `withSentryConfig` to configure
component tracking.

```js
// v7 - svelte.config.js
import { componentTrackingPreprocessor } from '@sentry/svelte';

const config = {
preprocess: [
componentTrackingPreprocessor(),
// ...
],
// ...
};

export default config;
```

```js
// v8 - svelte.config.js
import { withSentryConfig } from "@sentry/svelte";

const config = {
// Your svelte config
compilerOptions: {...},
};

export default withSentryConfig(config);
```

## 5. Behaviour Changes

- [Updated behaviour of `tracePropagationTargets` in the browser](./MIGRATION.md#updated-behaviour-of-tracepropagationtargets-in-the-browser-http-tracing-headers--cors)
Expand Down
2 changes: 0 additions & 2 deletions packages/svelte/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ export function withSentryConfig(

const shouldTrackComponents = mergedOptions.componentTracking && mergedOptions.componentTracking.trackComponents;
if (shouldTrackComponents) {
// TODO(v8): Remove eslint rule
// eslint-disable-next-line deprecation/deprecation
const firstPassPreproc: SentryPreprocessorGroup = componentTrackingPreprocessor(mergedOptions.componentTracking);
sentryPreprocessors.set(firstPassPreproc.sentryId || '', firstPassPreproc);
}
Expand Down
4 changes: 0 additions & 4 deletions packages/svelte/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ export * from '@sentry/browser';

export { init } from './sdk';

// TODO(v8): Remove this export
// eslint-disable-next-line deprecation/deprecation
export { componentTrackingPreprocessor } from './preprocessors';

export { trackComponent } from './performance';

export { withSentryConfig } from './config';
4 changes: 3 additions & 1 deletion packages/svelte/src/performance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ const defaultTrackComponentOptions: {
/**
* Tracks the Svelte component's intialization and mounting operation as well as
* updates and records them as spans.
*
* This function is injected automatically into your Svelte components' code
* if you are using the Sentry componentTrackingPreprocessor.
* if you are using the withSentryConfig wrapper.
*
* Alternatively, you can call it yourself if you don't want to use the preprocessor.
*/
export function trackComponent(options?: TrackComponentOptions): void {
Expand Down
3 changes: 0 additions & 3 deletions packages/svelte/src/preprocessors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ export const FIRST_PASS_COMPONENT_TRACKING_PREPROC_ID = 'FIRST_PASS_COMPONENT_TR
/**
* Svelte Preprocessor to inject Sentry performance monitoring related code
* into Svelte components.
*
* @deprecated Use `withSentryConfig` which is the new way of making compile-time modifications
* to Svelte apps going forward.
*/
export function componentTrackingPreprocessor(options?: ComponentTrackingInitOptions): PreprocessorGroup {
const mergedOptions = { ...defaultComponentTrackingOptions, ...options };
Expand Down
1 change: 0 additions & 1 deletion packages/svelte/test/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ describe('withSentryConfig', () => {
});

it("doesn't add Sentry preprocessors that were already added by the users", () => {
// eslint-disable-next-line deprecation/deprecation
const sentryPreproc = componentTrackingPreprocessor();
const originalConfig = {
compilerOptions: {
Expand Down
1 change: 0 additions & 1 deletion packages/svelte/test/preprocessors.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as svelteCompiler from 'svelte/compiler';

/* eslint-disable deprecation/deprecation */
import {
FIRST_PASS_COMPONENT_TRACKING_PREPROC_ID,
componentTrackingPreprocessor,
Expand Down