This PR updates our Svelte and SvelteKit SDKs to support Svelte 5 (tested with latest Svelte 5 preview version).
Concrete changes and adjustments:
Removed current_component import from Svelte SDK trackComponent function, due to the export no longer being available in Svelte 5
This means, the trackComponent utility can no longer auto-obtain the component name. Instead, a component name needs to be provided when calling the function or it falls back to a default const name.
While not ideal for Svelte <5 users; users are instructed to use our component tracking preprocessor which automatically already injects the correct component name.
I checked and the preprocessor doesn't work in SvelteKit apps (regardless of Svelte version). This is somewhat expected as we never added 1st class support for tracking components in SvelteKit (only pure Svelte apps), lest did we document it properly.
Added a dummy/no-op trackComponent utility to the Server-side of the SvelteKit SDK. Component tracking doesn't make much sense in SSR but only in client-side hydration and subsequent navigations. With this change, users can now manually call trackComponent within their pages/components.
For automatic component tracking I wanna add injecting the function call with our sentrySvelteKit vite plugin. This is much better DX than making the withSentryConfig wrapper work with SvelteKit apps. We can do this at any point in time, I opened https://github.com/getsentry/sentry-javascript/issues/11808 to track it.
Adjusted peer dependencies in the Svelte SDK to permit svelte@5.x whenever it's released. I don't think we should add the preview versions here but happy to change/remove for now if reviewers prefer.
Added SvelteKit 2 + Svelte 5 E2E test app with latest preview release with all the tests from the older SvelteKit E2E test apps. Also added a test for manual component tracking and backported it to the other Sveltekit E2E tests
This PR updates our Svelte and SvelteKit SDKs to support Svelte 5 (tested with latest Svelte 5 preview version). Concrete changes and adjustments:
current_component
import from Svelte SDKtrackComponent
function, due to the export no longer being available in Svelte 5trackComponent
utility can no longer auto-obtain the component name. Instead, a component name needs to be provided when calling the function or it falls back to a default const name.trackComponent
utility to the Server-side of the SvelteKit SDK. Component tracking doesn't make much sense in SSR but only in client-side hydration and subsequent navigations. With this change, users can now manually calltrackComponent
within their pages/components.sentrySvelteKit
vite plugin. This is much better DX than making thewithSentryConfig
wrapper work with SvelteKit apps. We can do this at any point in time, I opened https://github.com/getsentry/sentry-javascript/issues/11808 to track it.svelte@5.x
whenever it's released. I don't think we should add the preview versions here but happy to change/remove for now if reviewers prefer.closes https://github.com/getsentry/sentry-javascript/issues/10275 closes #10318