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: expose paths to service worker #8472

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 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
5 changes: 5 additions & 0 deletions .changeset/good-seahorses-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': minor
---

feat: expose paths to service workers
Rich-Harris marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions packages/kit/src/exports/vite/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ export const files = [
.map((asset) => `${JSON.stringify(`${config.kit.paths.base}/${asset.file}`)}`)
.join(',\n\t\t\t\t')}
];
export const paths = ${JSON.stringify(config.kit.paths)};
export const prerendered = [];
export const version = ${JSON.stringify(config.kit.version.name)};
`;
7 changes: 7 additions & 0 deletions packages/kit/types/ambient.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,13 @@ declare module '$service-worker' {
* See [`config.kit.version`](https://kit.svelte.dev/docs/configuration#version). It's useful for generating unique cache names inside your service worker, so that a later deployment of your app can invalidate old caches.
*/
export const version: string;
/**
* See [`config.kit.paths`](https://kit.svelte.dev/docs/configuration#paths).
*/
export const paths: {
assets: string;
base: string;
};
}

declare module '@sveltejs/kit/hooks' {
Expand Down