Skip to content
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

feat(svelte): Add withSentryConfig function to wrap User Svelte Configuration #5936

Merged
merged 8 commits into from Oct 12, 2022

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Oct 12, 2022

This PR adds the withSentryConfig wrapper function to our Svelte SDK which can be used to automatically add Sentry-specific svelte configuration options to our users' configuration in svelte.config.js. Going forward, this function will allow us to add more sentry-specific config items, such as additional preprocessors to the config without having to ask our users to adjust their config stuff every time we introduce changes.

We already have a concrete use case for adding another preprocessor to fix #5923 which will be addressed in a follow-up PR.

The change is fully backward-compatible with how we previously instructed users to add the componentTrackingPreprocessor explicitly to their set of preprocessors in their config. However, to make it clear that withSentryConfig is the way forward, this PR deprecates componentTrackingPreprocessor and in v8, we'll remove it from our public exports.

Additionally, this PR

  • adds tests for withSentryConfig.
  • removes the svelte-internal types we previously copied from Svelte source code into our types file. I think it doesn't do us any harm to switch to the actual types because if they ever change we'd have problems either way. Happy to revert this though if reviewers think this might cause issues.

Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

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

Good tests!

packages/svelte/src/types.ts Show resolved Hide resolved
packages/svelte/src/config.ts Outdated Show resolved Hide resolved
packages/svelte/src/preprocessors.ts Outdated Show resolved Hide resolved
Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

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

LGTM - feel free to take any decision you want on my code suggestion

@Lms24 Lms24 enabled auto-merge (squash) October 12, 2022 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Svelte Component Tracking doesn't pick up components without a <script> tag
2 participants