Skip to content
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
2 changes: 1 addition & 1 deletion packages/sveltekit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
},
"devDependencies": {
"@babel/types": "^7.26.3",
"@sveltejs/kit": "^2.0.2",
"@sveltejs/kit": "^2.49.5",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"svelte": "^4.2.8",
"vite": "^5.4.11"
Expand Down
4 changes: 4 additions & 0 deletions packages/sveltekit/src/client/browserTracingIntegration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ function _instrumentPageload(client: Client): void {
return;
}

// TODO(v11): require svelte 5 or newer to switch to `page` from `$app/state`
// eslint-disable-next-line deprecation/deprecation
page.subscribe(page => {
if (!page) {
return;
Expand All @@ -76,6 +78,8 @@ function _instrumentPageload(client: Client): void {
function _instrumentNavigations(client: Client): void {
let routingSpan: Span | undefined;

// TODO(v11): require svelte 5 or newer to switch to `navigating` from `$app/state`
// eslint-disable-next-line deprecation/deprecation
navigating.subscribe(navigation => {
if (!navigation) {
// `navigating` emits a 'null' value when the navigation is completed.
Expand Down
4 changes: 4 additions & 0 deletions packages/sveltekit/src/vite/svelteConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ export async function loadSvelteConfig(): Promise<BackwardsForwardsCompatibleSve
* directory is specified, the default directory is returned.
*/
export function getHooksFileName(svelteConfig: Config, hookType: 'client' | 'server'): string {
// `files` is deprecated in favour of unchangeable file names. Once it is removed, only the
// fallback will be necessary. We can remove the curstom files path once we drop support
// for that version range (presumably sveltekit 2).
// eslint-disable-next-line deprecation/deprecation
return svelteConfig.kit?.files?.hooks?.[hookType] || `src/hooks.${hookType}`;
}

Expand Down
24 changes: 20 additions & 4 deletions packages/sveltekit/test/client/browserTracingIntegration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ describe('browserTracingIntegration', () => {
});

// We emit an update to the `page` store to simulate the SvelteKit router lifecycle
// TODO(v11): switch to `page` from `$app/state`
// @ts-expect-error - page is a writable but the types say it's just readable
// eslint-disable-next-line deprecation/deprecation
page.set({ route: { id: 'testRoute' } });

// This should update the transaction name with the parameterized route:
Expand Down Expand Up @@ -151,7 +153,9 @@ describe('browserTracingIntegration', () => {
integration.afterAllSetup(fakeClient);

// We emit an update to the `page` store to simulate the SvelteKit router lifecycle
// TODO(v11): switch to `page` from `$app/state`
// @ts-expect-error - page is a writable but the types say it's just readable
// eslint-disable-next-line deprecation/deprecation
page.set({ route: { id: 'testRoute/:id' } });

// This should update the transaction name with the parameterized route:
Expand All @@ -167,7 +171,9 @@ describe('browserTracingIntegration', () => {
integration.afterAllSetup(fakeClient);

// We emit an update to the `navigating` store to simulate the SvelteKit navigation lifecycle
// TODO(v11): switch to `navigating` from `$app/state`
// @ts-expect-error - page is a writable but the types say it's just readable
// eslint-disable-next-line deprecation/deprecation
navigating.set({
from: { route: { id: '/users' }, url: { pathname: '/users' } },
to: { route: { id: '/users/[id]' }, url: { pathname: '/users/7762' } },
Expand All @@ -185,7 +191,9 @@ describe('browserTracingIntegration', () => {
integration.afterAllSetup(fakeClient);

// We emit an update to the `navigating` store to simulate the SvelteKit navigation lifecycle
// TODO(v11): switch to `navigating` from `$app/state`
// @ts-expect-error - page is a writable but the types say it's just readable
// eslint-disable-next-line deprecation/deprecation
navigating.set({
from: { route: { id: '/users' }, url: { pathname: '/users' } },
to: { route: { id: '/users/[id]' }, url: { pathname: '/users/7762' } },
Expand Down Expand Up @@ -219,7 +227,9 @@ describe('browserTracingIntegration', () => {
});

// We emit `null` here to simulate the end of the navigation lifecycle
// @ts-expect-error - page is a writable but the types say it's just readable
// TODO(v11): switch to `navigating` from `$app/state`
// @ts-expect-error - navigating is a writable but the types say it's just readable
// eslint-disable-next-line deprecation/deprecation
navigating.set(null);

expect(routingSpanEndSpy).toHaveBeenCalledTimes(1);
Expand All @@ -234,7 +244,9 @@ describe('browserTracingIntegration', () => {
integration.afterAllSetup(fakeClient);

// We emit an update to the `navigating` store to simulate the SvelteKit navigation lifecycle
// @ts-expect-error - page is a writable but the types say it's just readable
// TODO(v11): switch to `navigating` from `$app/state`
// @ts-expect-error - navigating is a writable but the types say it's just readable
// eslint-disable-next-line deprecation/deprecation
navigating.set({
from: { route: { id: '/users/[id]' }, url: { pathname: '/users/7762' } },
to: { route: { id: '/users/[id]' }, url: { pathname: '/users/7762' } },
Expand All @@ -250,7 +262,9 @@ describe('browserTracingIntegration', () => {
// @ts-expect-error - the fakeClient doesn't satisfy Client but that's fine
integration.afterAllSetup(fakeClient);

// @ts-expect-error - page is a writable but the types say it's just readable
// TODO(v11): switch to `navigating` from `$app/state`
// @ts-expect-error - navigating is a writable but the types say it's just readable
// eslint-disable-next-line deprecation/deprecation
navigating.set({
from: { route: { id: '/users/[id]' }, url: { pathname: '/users/7762' } },
to: { route: { id: '/users/[id]' }, url: { pathname: '/users/223412' } },
Expand Down Expand Up @@ -289,7 +303,9 @@ describe('browserTracingIntegration', () => {

// window.location.pathname is "/" in tests

// @ts-expect-error - page is a writable but the types say it's just readable
// TODO(v11): switch to `navigating` from `$app/state`
// @ts-expect-error - navigating is a writable but the types say it's just readable
// eslint-disable-next-line deprecation/deprecation
navigating.set({
to: { route: {}, url: { pathname: '/' } },
});
Expand Down
52 changes: 34 additions & 18 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7947,22 +7947,29 @@
"@supabase/realtime-js" "2.11.2"
"@supabase/storage-js" "2.7.1"

"@sveltejs/kit@^2.0.2":
version "2.0.2"
resolved "https://registry.yarnpkg.com/@sveltejs/kit/-/kit-2.0.2.tgz#bd02523fe570ddaf89148bffb1eb2233c458054b"
integrity sha512-xFpnLxVQ4KgCbj4Cj2zCFUcyfAoO87nn4nf3XcGJ7ZtOwy20tZ91vXWrtyuum8hakJWVwdNYyGXG9aBoIEYpFQ==
"@sveltejs/acorn-typescript@^1.0.5":
version "1.0.8"
resolved "https://registry.yarnpkg.com/@sveltejs/acorn-typescript/-/acorn-typescript-1.0.8.tgz#69c746a7c232094c117c50dedbd1279fc64887b7"
integrity sha512-esgN+54+q0NjB0Y/4BomT9samII7jGwNy/2a3wNZbT2A2RpmXsXwUt24LvLhx6jUq2gVk4cWEvcRO6MFQbOfNA==

"@sveltejs/kit@^2.49.5":
version "2.49.5"
resolved "https://registry.yarnpkg.com/@sveltejs/kit/-/kit-2.49.5.tgz#da173805592e3ebd483bb77d45ef424078f0aaff"
integrity sha512-dCYqelr2RVnWUuxc+Dk/dB/SjV/8JBndp1UovCyCZdIQezd8TRwFLNZctYkzgHxRJtaNvseCSRsuuHPeUgIN/A==
dependencies:
"@standard-schema/spec" "^1.0.0"
"@sveltejs/acorn-typescript" "^1.0.5"
"@types/cookie" "^0.6.0"
acorn "^8.14.1"
cookie "^0.6.0"
devalue "^4.3.2"
esm-env "^1.0.0"
devalue "^5.6.2"
esm-env "^1.2.2"
kleur "^4.1.5"
magic-string "^0.30.5"
mrmime "^1.0.1"
mrmime "^2.0.0"
sade "^1.8.1"
set-cookie-parser "^2.6.0"
sirv "^2.0.3"
tiny-glob "^0.2.9"
sirv "^3.0.0"

"@sveltejs/vite-plugin-svelte-inspector@^2.1.0":
version "2.1.0"
Expand Down Expand Up @@ -14538,10 +14545,10 @@ devalue@^4.3.2:
resolved "https://registry.yarnpkg.com/devalue/-/devalue-4.3.3.tgz#e35df3bdc49136837e77986f629b9fa6fef50726"
integrity sha512-UH8EL6H2ifcY8TbD2QsxwCC/pr5xSwPvv85LrLXVihmHVC3T3YqTCIwnR5ak0yO1KYqlxrPVOA/JVZJYPy2ATg==

devalue@^5.0.0:
version "5.3.2"
resolved "https://registry.yarnpkg.com/devalue/-/devalue-5.3.2.tgz#1d9a00f0d126a2f768589f236da8b67d6988d285"
integrity sha512-UDsjUbpQn9kvm68slnrs+mfxwFkIflOhkanmyabZ8zOYk8SMEIbJ3TK+88g70hSIeytu4y18f0z/hYHMTrXIWw==
devalue@^5.0.0, devalue@^5.6.2:
version "5.6.2"
resolved "https://registry.yarnpkg.com/devalue/-/devalue-5.6.2.tgz#931e2bb1cc2b299e0f0fb9e4e5be8ebf521a25b8"
integrity sha512-nPRkjWzzDQlsejL1WVifk5rvcFi/y1onBRxjaFMjZeR9mFpqu2gmAZ9xUB9/IEanEP/vBtGeGganC/GO1fmufg==

devlop@^1.0.0:
version "1.1.0"
Copy link
Member Author

Choose a reason for hiding this comment

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

devalue was also affected by 2 other CVEs but the latest kit version already bumps to the fixed version

Expand Down Expand Up @@ -16521,10 +16528,10 @@ eslint@8.57.0:
strip-ansi "^6.0.1"
text-table "^0.2.0"

esm-env@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/esm-env/-/esm-env-1.0.0.tgz#b124b40b180711690a4cb9b00d16573391950413"
integrity sha512-Cf6VksWPsTuW01vU9Mk/3vRue91Zevka5SjyNf3nEpokFRuqt/KjUQoGAwq9qMmhpLTHmXzSIrFRw8zxWzmFBA==
esm-env@^1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/esm-env/-/esm-env-1.2.2.tgz#263c9455c55861f41618df31b20cb571fc20b75e"
integrity sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA==

esm@^3.2.25, esm@^3.2.4:
version "3.2.25"
Expand Down Expand Up @@ -22857,7 +22864,7 @@ mri@^1.1.0, mri@^1.2.0:
resolved "https://registry.yarnpkg.com/mri/-/mri-1.2.0.tgz#6721480fec2a11a4889861115a48b6cbe7cc8f0b"
integrity sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==

mrmime@^1.0.0, mrmime@^1.0.1:
mrmime@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/mrmime/-/mrmime-1.0.1.tgz#5f90c825fad4bdd41dc914eff5d1a8cfdaf24f27"
integrity sha512-hzzEagAgDyoU1Q6yg5uI+AorQgdvMCur3FcKf7NhMKWsaYg+RnbTyHRa/9IlLF9rf455MOCtcqqrQQ83pPP7Uw==
Expand Down Expand Up @@ -28120,6 +28127,15 @@ sirv@^2.0.3, sirv@^2.0.4:
mrmime "^2.0.0"
totalist "^3.0.0"

sirv@^3.0.0:
version "3.0.2"
resolved "https://registry.yarnpkg.com/sirv/-/sirv-3.0.2.tgz#f775fccf10e22a40832684848d636346f41cd970"
integrity sha512-2wcC/oGxHis/BoHkkPwldgiPSYcpZK3JU28WoMVv55yHJgcZ8rlXvuG9iZggz+sU1d4bRgIGASwyWqjxu3FM0g==
dependencies:
"@polka/url" "^1.0.0-next.24"
mrmime "^2.0.0"
totalist "^3.0.0"

sisteransi@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed"
Expand Down
Loading