diff --git a/examples/sveltekit-ts-assets-generator/package.json b/examples/sveltekit-ts-assets-generator/package.json
index be87edd..07a8e67 100644
--- a/examples/sveltekit-ts-assets-generator/package.json
+++ b/examples/sveltekit-ts-assets-generator/package.json
@@ -27,18 +27,18 @@
"@playwright/test": "^1.37.1",
"@sveltejs/adapter-static": "^3.0.0",
"@sveltejs/adapter-node": "^2.0.0",
- "@sveltejs/kit": "^2.0.1",
+ "@sveltejs/kit": "^2.7.4",
"@types/cookie": "^0.6.0",
"@typescript-eslint/eslint-plugin": "^6.14.0",
"@typescript-eslint/parser": "^6.14.0",
"@vite-pwa/sveltekit": "workspace:*",
"eslint": "^8.55.0",
- "eslint-plugin-svelte": "^2.35.1",
- "svelte": "^4.2.8",
- "svelte-check": "^3.6.2",
- "tslib": "^2.6.2",
- "typescript": "^5.4.5",
- "vitest": "^2.0.5"
+ "eslint-plugin-svelte": "^2.45.1",
+ "svelte": "^5.1.9",
+ "svelte-check": "^4.0.5",
+ "tslib": "^2.8.1",
+ "typescript": "^5.6.3",
+ "vitest": "^2.1.4"
},
"type": "module",
"dependencies": {
diff --git a/examples/sveltekit-ts-assets-generator/src/lib/Counter.svelte b/examples/sveltekit-ts-assets-generator/src/lib/Counter.svelte
index bb71271..5935336 100644
--- a/examples/sveltekit-ts-assets-generator/src/lib/Counter.svelte
+++ b/examples/sveltekit-ts-assets-generator/src/lib/Counter.svelte
@@ -1,20 +1,24 @@
-
- (count += 1)} aria-label="Increase the counter by one">
+ (count += 1)} aria-label="Increase the counter by one">
diff --git a/examples/sveltekit-ts-assets-generator/src/lib/ReloadPrompt.svelte b/examples/sveltekit-ts-assets-generator/src/lib/ReloadPrompt.svelte
index 6a812cb..ab2d4c4 100644
--- a/examples/sveltekit-ts-assets-generator/src/lib/ReloadPrompt.svelte
+++ b/examples/sveltekit-ts-assets-generator/src/lib/ReloadPrompt.svelte
@@ -9,15 +9,25 @@
needRefresh,
updateServiceWorker
} = useRegisterSW({
- onRegistered(r) {
- if (__RELOAD_SW__) {
- r && setInterval(() => {
- console.log('Checking for sw update')
- r.update()
- }, 20000 /* 20s for testing purposes */)
- } else {
- console.log(`SW Registered: ${r}`)
- }
+ onRegisteredSW(swUrl, r) {
+ r && setInterval(async () => {
+ if (r.installing || !navigator)
+ return
+
+ if (('connection' in navigator) && !navigator.onLine)
+ return
+
+ const resp = await fetch(swUrl, {
+ cache: 'no-store',
+ headers: {
+ 'cache': 'no-store',
+ 'cache-control': 'no-cache',
+ },
+ })
+
+ if (resp?.status === 200)
+ await r.update()
+ }, 20000 /* 20s for testing purposes */)
},
onRegisterError(error) {
console.log('SW registration error', error)
@@ -28,7 +38,7 @@
needRefresh.set(false)
}
- $: toast = $offlineReady || $needRefresh
+ let toast = $derived($offlineReady || $needRefresh)
{#if toast}
@@ -45,11 +55,11 @@
{/if}
{#if $needRefresh}
- updateServiceWorker(true)}>
+ updateServiceWorker(true)}>
Reload
{/if}
-
+
Close
diff --git a/examples/sveltekit-ts-assets-generator/src/routes/+layout.svelte b/examples/sveltekit-ts-assets-generator/src/routes/+layout.svelte
index f33d8b1..ccb5e40 100644
--- a/examples/sveltekit-ts-assets-generator/src/routes/+layout.svelte
+++ b/examples/sveltekit-ts-assets-generator/src/routes/+layout.svelte
@@ -3,8 +3,13 @@
import '../app.css';
import { pwaInfo } from 'virtual:pwa-info';
import { pwaAssetsHead } from 'virtual:pwa-assets/head';
+ interface Props {
+ children?: import('svelte').Snippet;
+ }
+
+ let { children }: Props = $props();
- $: webManifest = pwaInfo ? pwaInfo.webManifest.linkTag : ''
+ let webManifest = $derived(pwaInfo ? pwaInfo.webManifest.linkTag : '')
@@ -22,7 +27,7 @@
-
+ {@render children?.()}