@sveltejs/kit
Advanced tools
Comparing version 2.7.2 to 2.7.3
{ | ||
"name": "@sveltejs/kit", | ||
"version": "2.7.2", | ||
"version": "2.7.3", | ||
"description": "SvelteKit is the fastest way to build Svelte apps", | ||
@@ -18,3 +18,3 @@ "keywords": [ | ||
"license": "MIT", | ||
"homepage": "https://kit.svelte.dev", | ||
"homepage": "https://svelte.dev", | ||
"type": "module", | ||
@@ -21,0 +21,0 @@ "dependencies": { |
# The fastest way to build Svelte apps | ||
This is the [SvelteKit](https://kit.svelte.dev) framework and CLI. | ||
This is the [SvelteKit](https://svelte.dev/docs/kit) framework and CLI. | ||
The quickest way to get started is via the [create-svelte](https://github.com/sveltejs/kit/tree/main/packages/create-svelte) package: | ||
The quickest way to get started is via the [sv](https://npmjs.com/package/sv) package: | ||
```bash | ||
npm create svelte@latest my-app | ||
npx sv create my-app | ||
cd my-app | ||
@@ -14,3 +14,3 @@ npm install | ||
See the [documentation](https://kit.svelte.dev/docs) to learn more. | ||
See the [documentation](https://svelte.dev/docs/kit) to learn more. | ||
@@ -17,0 +17,0 @@ ## Changelog |
@@ -114,3 +114,3 @@ import fs from 'node:fs'; | ||
throw new Error( | ||
'svelte.config.js must have a configuration object as its default export. See https://kit.svelte.dev/docs/configuration' | ||
'svelte.config.js must have a configuration object as its default export. See https://svelte.dev/docs/kit/configuration' | ||
); | ||
@@ -117,0 +117,0 @@ } |
@@ -71,3 +71,3 @@ import { join } from 'node:path'; | ||
throw new Error(`${message}. See https://kit.svelte.dev/docs/adapters`); | ||
throw new Error(`${message}. See https://svelte.dev/docs/kit/adapters`); | ||
} | ||
@@ -96,3 +96,3 @@ | ||
throw new Error( | ||
"config.kit.appDir cannot start or end with '/'. See https://kit.svelte.dev/docs/configuration" | ||
"config.kit.appDir cannot start or end with '/'. See https://svelte.dev/docs/kit/configuration" | ||
); | ||
@@ -156,3 +156,3 @@ } | ||
throw new Error( | ||
`${keypath} option must either be the empty string or a root-relative path that starts but doesn't end with '/'. See https://kit.svelte.dev/docs/configuration#paths` | ||
`${keypath} option must either be the empty string or a root-relative path that starts but doesn't end with '/'. See https://svelte.dev/docs/kit/configuration#paths` | ||
); | ||
@@ -169,3 +169,3 @@ } | ||
throw new Error( | ||
`${keypath} option must be an absolute path, if specified. See https://kit.svelte.dev/docs/configuration#paths` | ||
`${keypath} option must be an absolute path, if specified. See https://svelte.dev/docs/kit/configuration#paths` | ||
); | ||
@@ -176,3 +176,3 @@ } | ||
throw new Error( | ||
`${keypath} option must not end with '/'. See https://kit.svelte.dev/docs/configuration#paths` | ||
`${keypath} option must not end with '/'. See https://svelte.dev/docs/kit/configuration#paths` | ||
); | ||
@@ -210,3 +210,3 @@ } | ||
message + | ||
'\nTo suppress or handle this error, implement `handleHttpError` in https://kit.svelte.dev/docs/configuration#prerender' | ||
'\nTo suppress or handle this error, implement `handleHttpError` in https://svelte.dev/docs/kit/configuration#prerender' | ||
); | ||
@@ -225,3 +225,3 @@ }, | ||
message + | ||
'\nTo suppress or handle this error, implement `handleMissingId` in https://kit.svelte.dev/docs/configuration#prerender' | ||
'\nTo suppress or handle this error, implement `handleMissingId` in https://svelte.dev/docs/kit/configuration#prerender' | ||
); | ||
@@ -240,3 +240,3 @@ }, | ||
message + | ||
'\nTo suppress or handle this error, implement `handleEntryGeneratorMismatch` in https://kit.svelte.dev/docs/configuration#prerender' | ||
'\nTo suppress or handle this error, implement `handleEntryGeneratorMismatch` in https://svelte.dev/docs/kit/configuration#prerender' | ||
); | ||
@@ -243,0 +243,0 @@ }, |
@@ -117,3 +117,3 @@ import { existsSync, readFileSync, statSync, writeFileSync } from 'node:fs'; | ||
status === 404 && !path.startsWith(config.paths.base) | ||
? `${path} does not begin with \`base\`, which is configured in \`paths.base\` and can be imported from \`$app/paths\` - see https://kit.svelte.dev/docs/configuration#paths for more info` | ||
? `${path} does not begin with \`base\`, which is configured in \`paths.base\` and can be imported from \`$app/paths\` - see https://svelte.dev/docs/kit/configuration#paths for more info` | ||
: path; | ||
@@ -130,3 +130,3 @@ | ||
return ( | ||
`The following pages contain links to ${path}#${id}, but no element with id="${id}" exists on ${path} - see the \`handleMissingId\` option in https://kit.svelte.dev/docs/configuration#prerender for more info:` + | ||
`The following pages contain links to ${path}#${id}, but no element with id="${id}" exists on ${path} - see the \`handleMissingId\` option in https://svelte.dev/docs/kit/configuration#prerender for more info:` + | ||
referrers.map((l) => `\n - ${l}`).join('') | ||
@@ -141,3 +141,3 @@ ); | ||
({ generatedFromId, entry, matchedId }) => { | ||
return `The entries export from ${generatedFromId} generated entry ${entry}, which was matched by ${matchedId} - see the \`handleEntryGeneratorMismatch\` option in https://kit.svelte.dev/docs/configuration#prerender for more info.`; | ||
return `The entries export from ${generatedFromId} generated entry ${entry}, which was matched by ${matchedId} - see the \`handleEntryGeneratorMismatch\` option in https://svelte.dev/docs/kit/configuration#prerender for more info.`; | ||
} | ||
@@ -391,3 +391,3 @@ ); | ||
throw new Error( | ||
`Cannot save ${decoded} as it is already a directory. See https://kit.svelte.dev/docs/page-options#prerender-route-conflicts for more information` | ||
`Cannot save ${decoded} as it is already a directory. See https://svelte.dev/docs/kit/page-options#prerender-route-conflicts for more information` | ||
); | ||
@@ -401,3 +401,3 @@ } | ||
throw new Error( | ||
`Cannot save ${decoded} as ${parent} is already a file. See https://kit.svelte.dev/docs/page-options#prerender-route-conflicts for more information` | ||
`Cannot save ${decoded} as ${parent} is already a file. See https://svelte.dev/docs/kit/page-options#prerender-route-conflicts for more information` | ||
); | ||
@@ -517,3 +517,3 @@ } | ||
throw new Error( | ||
`The following routes were marked as prerenderable, but were not prerendered because they were not found while crawling your app:\n${list}\n\nSee https://kit.svelte.dev/docs/page-options#prerender-troubleshooting for info on how to solve this` | ||
`The following routes were marked as prerenderable, but were not prerendered because they were not found while crawling your app:\n${list}\n\nSee https://svelte.dev/docs/kit/page-options#prerender-troubleshooting for info on how to solve this` | ||
); | ||
@@ -520,0 +520,0 @@ } |
@@ -10,3 +10,3 @@ import fs from 'node:fs'; | ||
// TODO these types should be described in a neutral place, rather than | ||
// inside either `packages/kit` or `kit.svelte.dev` | ||
// inside either `packages/kit` or `svelte.dev/docs/kit` | ||
const descriptions_dir = fileURLToPath(new URL('../../../src/types/synthetic', import.meta.url)); | ||
@@ -13,0 +13,0 @@ |
@@ -169,3 +169,3 @@ import fs from 'node:fs'; | ||
`You have specified a baseUrl and/or paths in your ${config.kind} which interferes with SvelteKit's auto-generated tsconfig.json. ` + | ||
'Remove it to avoid problems with intellisense. For path aliases, use `kit.alias` instead: https://kit.svelte.dev/docs/configuration#alias' | ||
'Remove it to avoid problems with intellisense. For path aliases, use `kit.alias` instead: https://svelte.dev/docs/kit/configuration#alias' | ||
) | ||
@@ -172,0 +172,0 @@ ); |
@@ -26,3 +26,3 @@ import 'svelte'; // pick up `declare module "*.svelte"` | ||
/** | ||
* [Adapters](https://kit.svelte.dev/docs/adapters) are responsible for taking the production build and turning it into something that can be deployed to a platform of your choosing. | ||
* [Adapters](https://svelte.dev/docs/kit/adapters) are responsible for taking the production build and turning it into something that can be deployed to a platform of your choosing. | ||
*/ | ||
@@ -83,8 +83,7 @@ export interface Adapter { | ||
type UnpackValidationError<T> = | ||
T extends ActionFailure<infer X> | ||
? X | ||
: T extends void | ||
? undefined // needs to be undefined, because void will corrupt union type | ||
: T; | ||
type UnpackValidationError<T> = T extends ActionFailure<infer X> | ||
? X | ||
: T extends void | ||
? undefined // needs to be undefined, because void will corrupt union type | ||
: T; | ||
@@ -134,3 +133,3 @@ /** | ||
/** | ||
* Generate a server-side manifest to initialise the SvelteKit [server](https://kit.svelte.dev/docs/types#public-types-server) with. | ||
* Generate a server-side manifest to initialise the SvelteKit [server](https://svelte.dev/docs/kit/@sveltejs-kit#Server) with. | ||
* @param opts a relative path to the base directory of the app and optionally in which format (esm or cjs) the manifest should be generated | ||
@@ -196,3 +195,3 @@ */ | ||
/** | ||
* Options passed to [`svelte.compile`](https://svelte.dev/docs#compile-time-svelte-compile). | ||
* Options passed to [`svelte.compile`](https://svelte.dev/docs/svelte/svelte-compiler#CompileOptions). | ||
* @default {} | ||
@@ -286,3 +285,3 @@ */ | ||
/** | ||
* Your [adapter](https://kit.svelte.dev/docs/adapters) is run when executing `vite build`. It determines how the output is converted for different platforms. | ||
* Your [adapter](https://svelte.dev/docs/kit/adapters) is run when executing `vite build`. It determines how the output is converted for different platforms. | ||
* @default undefined | ||
@@ -360,5 +359,5 @@ */ | ||
* | ||
* > [!NOTE] Note that most [Svelte transitions](https://svelte.dev/tutorial/transition) work by creating an inline `<style>` element. If you use these in your app, you must either leave the `style-src` directive unspecified or add `unsafe-inline`. | ||
* > [!NOTE] Note that most [Svelte transitions](https://svelte.dev/tutorial/svelte/transition) work by creating an inline `<style>` element. If you use these in your app, you must either leave the `style-src` directive unspecified or add `unsafe-inline`. | ||
* | ||
* If this level of configuration is insufficient and you have more dynamic requirements, you can use the [`handle` hook](https://kit.svelte.dev/docs/hooks#Server-hooks-handle) to roll your own CSP. | ||
* If this level of configuration is insufficient and you have more dynamic requirements, you can use the [`handle` hook](https://svelte.dev/docs/kit/hooks#Server-hooks-handle) to roll your own CSP. | ||
*/ | ||
@@ -407,3 +406,3 @@ csp?: { | ||
/** | ||
* A prefix that signals that an environment variable is safe to expose to client-side code. See [`$env/static/public`](https://kit.svelte.dev/docs/modules#$env-static-public) and [`$env/dynamic/public`](https://kit.svelte.dev/docs/modules#$env-dynamic-public). Note that Vite's [`envPrefix`](https://vitejs.dev/config/shared-options.html#envprefix) must be set separately if you are using Vite's environment variable handling - though use of that feature should generally be unnecessary. | ||
* A prefix that signals that an environment variable is safe to expose to client-side code. See [`$env/static/public`](https://svelte.dev/docs/kit/$env-static-public) and [`$env/dynamic/public`](https://svelte.dev/docs/kit/$env-dynamic-public). Note that Vite's [`envPrefix`](https://vitejs.dev/config/shared-options.html#envprefix) must be set separately if you are using Vite's environment variable handling - though use of that feature should generally be unnecessary. | ||
* @default "PUBLIC_" | ||
@@ -413,3 +412,3 @@ */ | ||
/** | ||
* A prefix that signals that an environment variable is unsafe to expose to client-side code. Environment variables matching neither the public nor the private prefix will be discarded completely. See [`$env/static/private`](https://kit.svelte.dev/docs/modules#$env-static-private) and [`$env/dynamic/private`](https://kit.svelte.dev/docs/modules#$env-dynamic-private). | ||
* A prefix that signals that an environment variable is unsafe to expose to client-side code. Environment variables matching neither the public nor the private prefix will be discarded completely. See [`$env/static/private`](https://svelte.dev/docs/kit/$env-static-private) and [`$env/dynamic/private`](https://svelte.dev/docs/kit/$env-dynamic-private). | ||
* @default "" | ||
@@ -431,3 +430,3 @@ * @since 1.21.0 | ||
/** | ||
* The location of your client [hooks](https://kit.svelte.dev/docs/hooks). | ||
* The location of your client [hooks](https://svelte.dev/docs/kit/hooks). | ||
* @default "src/hooks.client" | ||
@@ -437,3 +436,3 @@ */ | ||
/** | ||
* The location of your server [hooks](https://kit.svelte.dev/docs/hooks). | ||
* The location of your server [hooks](https://svelte.dev/docs/kit/hooks). | ||
* @default "src/hooks.server" | ||
@@ -443,3 +442,3 @@ */ | ||
/** | ||
* The location of your universal [hooks](https://kit.svelte.dev/docs/hooks). | ||
* The location of your universal [hooks](https://svelte.dev/docs/kit/hooks). | ||
* @default "src/hooks" | ||
@@ -456,3 +455,3 @@ * @since 2.3.0 | ||
/** | ||
* a directory containing [parameter matchers](https://kit.svelte.dev/docs/advanced-routing#matching) | ||
* a directory containing [parameter matchers](https://svelte.dev/docs/kit/advanced-routing#matching) | ||
* @default "src/params" | ||
@@ -462,3 +461,3 @@ */ | ||
/** | ||
* the files that define the structure of your app (see [Routing](https://kit.svelte.dev/docs/routing)) | ||
* the files that define the structure of your app (see [Routing](https://svelte.dev/docs/kit/routing)) | ||
* @default "src/routes" | ||
@@ -468,3 +467,3 @@ */ | ||
/** | ||
* the location of your service worker's entry point (see [Service workers](https://kit.svelte.dev/docs/service-workers)) | ||
* the location of your service worker's entry point (see [Service workers](https://svelte.dev/docs/kit/service-workers)) | ||
* @default "src/service-worker" | ||
@@ -523,3 +522,3 @@ */ | ||
/** | ||
* A root-relative path that must start, but not end with `/` (e.g. `/base-path`), unless it is the empty string. This specifies where your app is served from and allows the app to live on a non-root path. Note that you need to prepend all your root-relative links with the base value or they will point to the root of your domain, not your `base` (this is how the browser works). You can use [`base` from `$app/paths`](https://kit.svelte.dev/docs/modules#$app-paths-base) for that: `<a href="{base}/your-page">Link</a>`. If you find yourself writing this often, it may make sense to extract this into a reusable component. | ||
* A root-relative path that must start, but not end with `/` (e.g. `/base-path`), unless it is the empty string. This specifies where your app is served from and allows the app to live on a non-root path. Note that you need to prepend all your root-relative links with the base value or they will point to the root of your domain, not your `base` (this is how the browser works). You can use [`base` from `$app/paths`](https://svelte.dev/docs/kit/$app-paths#base) for that: `<a href="{base}/your-page">Link</a>`. If you find yourself writing this often, it may make sense to extract this into a reusable component. | ||
* @default "" | ||
@@ -534,3 +533,3 @@ */ | ||
* | ||
* [Single-page app](https://kit.svelte.dev/docs/single-page-apps) fallback pages will always use absolute paths, regardless of this setting. | ||
* [Single-page app](https://svelte.dev/docs/kit/single-page-apps) fallback pages will always use absolute paths, regardless of this setting. | ||
* | ||
@@ -547,3 +546,3 @@ * If your app uses a `<base>` element, you should set this to `false`, otherwise asset URLs will incorrectly be resolved against the `<base>` URL rather than the current page. | ||
/** | ||
* See [Prerendering](https://kit.svelte.dev/docs/page-options#prerender). | ||
* See [Prerendering](https://svelte.dev/docs/kit/page-options#prerender). | ||
*/ | ||
@@ -668,3 +667,3 @@ prerender?: { | ||
* | ||
* If you set `pollInterval` to a non-zero value, SvelteKit will poll for new versions in the background and set the value of the [`updated`](https://kit.svelte.dev/docs/modules#$app-stores-updated) store to `true` when it detects one. | ||
* If you set `pollInterval` to a non-zero value, SvelteKit will poll for new versions in the background and set the value of the [`updated`](https://svelte.dev/docs/kit/$app-stores#updated) store to `true` when it detects one. | ||
*/ | ||
@@ -700,4 +699,4 @@ version?: { | ||
/** | ||
* The [`handle`](https://kit.svelte.dev/docs/hooks#Server-hooks-handle) hook runs every time the SvelteKit server receives a [request](https://kit.svelte.dev/docs/web-standards#Fetch-APIs-Request) and | ||
* determines the [response](https://kit.svelte.dev/docs/web-standards#Fetch-APIs-Response). | ||
* The [`handle`](https://svelte.dev/docs/kit/hooks#Server-hooks-handle) hook runs every time the SvelteKit server receives a [request](https://svelte.dev/docs/kit/web-standards#Fetch-APIs-Request) and | ||
* determines the [response](https://svelte.dev/docs/kit/web-standards#Fetch-APIs-Response). | ||
* It receives an `event` object representing the request and a function called `resolve`, which renders the route and generates a `Response`. | ||
@@ -712,3 +711,3 @@ * This allows you to modify response headers or bodies, or bypass SvelteKit entirely (for implementing routes programmatically, for example). | ||
/** | ||
* The server-side [`handleError`](https://kit.svelte.dev/docs/hooks#shared-hooks-handleError) hook runs when an unexpected error is thrown while responding to a request. | ||
* The server-side [`handleError`](https://svelte.dev/docs/kit/hooks#shared-hooks-handleError) hook runs when an unexpected error is thrown while responding to a request. | ||
* | ||
@@ -726,3 +725,3 @@ * If an unexpected error is thrown during loading or rendering, this function will be called with the error and the event. | ||
/** | ||
* The client-side [`handleError`](https://kit.svelte.dev/docs/hooks#shared-hooks-handleError) hook runs when an unexpected error is thrown while navigating. | ||
* The client-side [`handleError`](https://svelte.dev/docs/kit/hooks#shared-hooks-handleError) hook runs when an unexpected error is thrown while navigating. | ||
* | ||
@@ -740,3 +739,3 @@ * If an unexpected error is thrown during loading or the following render, this function will be called with the error and the event. | ||
/** | ||
* The [`handleFetch`](https://kit.svelte.dev/docs/hooks#server-hooks-handleFetch) hook allows you to modify (or replace) a `fetch` request that happens inside a `load` function that runs on the server (or during pre-rendering) | ||
* The [`handleFetch`](https://svelte.dev/docs/kit/hooks#server-hooks-handleFetch) hook allows you to modify (or replace) a `fetch` request that happens inside a `load` function that runs on the server (or during pre-rendering) | ||
*/ | ||
@@ -750,3 +749,3 @@ export type HandleFetch = (input: { | ||
/** | ||
* The [`reroute`](https://kit.svelte.dev/docs/hooks#universal-hooks-reroute) hook allows you to modify the URL before it is used to determine which route to render. | ||
* The [`reroute`](https://svelte.dev/docs/kit/hooks#Universal-hooks-reroute) hook allows you to modify the URL before it is used to determine which route to render. | ||
* @since 2.3.0 | ||
@@ -757,3 +756,3 @@ */ | ||
/** | ||
* The generic form of `PageLoad` and `LayoutLoad`. You should import those from `./$types` (see [generated types](https://kit.svelte.dev/docs/types#generated-types)) | ||
* The generic form of `PageLoad` and `LayoutLoad`. You should import those from `./$types` (see [generated types](https://svelte.dev/docs/kit/types#Generated-types)) | ||
* rather than using `Load` directly. | ||
@@ -770,3 +769,3 @@ */ | ||
/** | ||
* The generic form of `PageLoadEvent` and `LayoutLoadEvent`. You should import those from `./$types` (see [generated types](https://kit.svelte.dev/docs/types#generated-types)) | ||
* The generic form of `PageLoadEvent` and `LayoutLoadEvent`. You should import those from `./$types` (see [generated types](https://svelte.dev/docs/kit/types#Generated-types)) | ||
* rather than using `LoadEvent` directly. | ||
@@ -786,6 +785,6 @@ */ | ||
* - Internal requests (e.g. for `+server.js` routes) go directly to the handler function when running on the server, without the overhead of an HTTP call. | ||
* - During server-side rendering, the response will be captured and inlined into the rendered HTML by hooking into the `text` and `json` methods of the `Response` object. Note that headers will _not_ be serialized, unless explicitly included via [`filterSerializedResponseHeaders`](https://kit.svelte.dev/docs/hooks#Server-hooks-handle) | ||
* - During server-side rendering, the response will be captured and inlined into the rendered HTML by hooking into the `text` and `json` methods of the `Response` object. Note that headers will _not_ be serialized, unless explicitly included via [`filterSerializedResponseHeaders`](https://svelte.dev/docs/kit/hooks#Server-hooks-handle) | ||
* - During hydration, the response will be read from the HTML, guaranteeing consistency and preventing an additional network request. | ||
* | ||
* You can learn more about making credentialed requests with cookies [here](https://kit.svelte.dev/docs/load#cookies) | ||
* You can learn more about making credentialed requests with cookies [here](https://svelte.dev/docs/kit/load#Cookies) | ||
*/ | ||
@@ -817,3 +816,3 @@ fetch: typeof fetch; | ||
* | ||
* You cannot add a `set-cookie` header with `setHeaders` — use the [`cookies`](https://kit.svelte.dev/docs/types#public-types-cookies) API in a server-only `load` function instead. | ||
* You cannot add a `set-cookie` header with `setHeaders` — use the [`cookies`](https://svelte.dev/docs/kit/@sveltejs-kit#Cookies) API in a server-only `load` function instead. | ||
* | ||
@@ -831,3 +830,3 @@ * `setHeaders` has no effect when a `load` function runs in the browser. | ||
/** | ||
* This function declares that the `load` function has a _dependency_ on one or more URLs or custom identifiers, which can subsequently be used with [`invalidate()`](https://kit.svelte.dev/docs/modules#$app-navigation-invalidate) to cause `load` to rerun. | ||
* This function declares that the `load` function has a _dependency_ on one or more URLs or custom identifiers, which can subsequently be used with [`invalidate()`](https://svelte.dev/docs/kit/$app-navigation#invalidate) to cause `load` to rerun. | ||
* | ||
@@ -857,3 +856,3 @@ * Most of the time you won't need this, as `fetch` calls `depends` on your behalf — it's only necessary if you're using a custom API client that bypasses `fetch`. | ||
* | ||
* export let data; | ||
* let { data } = $props(); | ||
* | ||
@@ -972,3 +971,3 @@ * const increase = async () => { | ||
/** | ||
* The argument passed to [`beforeNavigate`](https://kit.svelte.dev/docs/modules#$app-navigation-beforenavigate) callbacks. | ||
* The argument passed to [`beforeNavigate`](https://svelte.dev/docs/kit/$app-navigation#beforeNavigate) callbacks. | ||
*/ | ||
@@ -983,3 +982,3 @@ export interface BeforeNavigate extends Navigation { | ||
/** | ||
* The argument passed to [`onNavigate`](https://kit.svelte.dev/docs/modules#$app-navigation-onnavigate) callbacks. | ||
* The argument passed to [`onNavigate`](https://svelte.dev/docs/kit/$app-navigation#onNavigate) callbacks. | ||
*/ | ||
@@ -1002,3 +1001,3 @@ export interface OnNavigate extends Navigation { | ||
/** | ||
* The argument passed to [`afterNavigate`](https://kit.svelte.dev/docs/modules#$app-navigation-afternavigate) callbacks. | ||
* The argument passed to [`afterNavigate`](https://svelte.dev/docs/kit/$app-navigation#afterNavigate) callbacks. | ||
*/ | ||
@@ -1058,7 +1057,7 @@ export interface AfterNavigate extends Omit<Navigation, 'type'> { | ||
/** | ||
* The page state, which can be manipulated using the [`pushState`](https://kit.svelte.dev/docs/modules#$app-navigation-pushstate) and [`replaceState`](https://kit.svelte.dev/docs/modules#$app-navigation-replacestate) functions from `$app/navigation`. | ||
* The page state, which can be manipulated using the [`pushState`](https://svelte.dev/docs/kit/$app-navigation#pushState) and [`replaceState`](https://svelte.dev/docs/kit/$app-navigation#replaceState) functions from `$app/navigation`. | ||
*/ | ||
state: App.PageState; | ||
/** | ||
* Filled only after a form submission. See [form actions](https://kit.svelte.dev/docs/form-actions) for more info. | ||
* Filled only after a form submission. See [form actions](https://svelte.dev/docs/kit/form-actions) for more info. | ||
*/ | ||
@@ -1069,3 +1068,3 @@ form: any; | ||
/** | ||
* The shape of a param matcher. See [matching](https://kit.svelte.dev/docs/advanced-routing#matching) for more info. | ||
* The shape of a param matcher. See [matching](https://svelte.dev/docs/kit/advanced-routing#Matching) for more info. | ||
*/ | ||
@@ -1088,6 +1087,6 @@ export type ParamMatcher = (param: string) => boolean; | ||
* - Internal requests (e.g. for `+server.js` routes) go directly to the handler function when running on the server, without the overhead of an HTTP call. | ||
* - During server-side rendering, the response will be captured and inlined into the rendered HTML by hooking into the `text` and `json` methods of the `Response` object. Note that headers will _not_ be serialized, unless explicitly included via [`filterSerializedResponseHeaders`](https://kit.svelte.dev/docs/hooks#Server-hooks-handle) | ||
* - During server-side rendering, the response will be captured and inlined into the rendered HTML by hooking into the `text` and `json` methods of the `Response` object. Note that headers will _not_ be serialized, unless explicitly included via [`filterSerializedResponseHeaders`](https://svelte.dev/docs/kit/hooks#Server-hooks-handle) | ||
* - During hydration, the response will be read from the HTML, guaranteeing consistency and preventing an additional network request. | ||
* | ||
* You can learn more about making credentialed requests with cookies [here](https://kit.svelte.dev/docs/load#cookies) | ||
* You can learn more about making credentialed requests with cookies [here](https://svelte.dev/docs/kit/load#Cookies) | ||
*/ | ||
@@ -1100,3 +1099,3 @@ fetch: typeof fetch; | ||
/** | ||
* Contains custom data that was added to the request within the [`handle hook`](https://kit.svelte.dev/docs/hooks#Server-hooks-handle). | ||
* Contains custom data that was added to the request within the [`handle hook`](https://svelte.dev/docs/kit/hooks#Server-hooks-handle). | ||
*/ | ||
@@ -1145,3 +1144,3 @@ locals: App.Locals; | ||
* | ||
* You cannot add a `set-cookie` header with `setHeaders` — use the [`cookies`](https://kit.svelte.dev/docs/types#public-types-cookies) API instead. | ||
* You cannot add a `set-cookie` header with `setHeaders` — use the [`cookies`](https://svelte.dev/docs/kit/@sveltejs-kit#Cookies) API instead. | ||
*/ | ||
@@ -1167,3 +1166,3 @@ setHeaders(headers: Record<string, string>): void; | ||
* | ||
* It receives `Params` as the first generic argument, which you can skip by using [generated types](https://kit.svelte.dev/docs/types#generated-types) instead. | ||
* It receives `Params` as the first generic argument, which you can skip by using [generated types](https://svelte.dev/docs/kit/types#Generated-types) instead. | ||
*/ | ||
@@ -1244,3 +1243,3 @@ export type RequestHandler< | ||
/** | ||
* The generic form of `PageServerLoad` and `LayoutServerLoad`. You should import those from `./$types` (see [generated types](https://kit.svelte.dev/docs/types#generated-types)) | ||
* The generic form of `PageServerLoad` and `LayoutServerLoad`. You should import those from `./$types` (see [generated types](https://svelte.dev/docs/kit/types#Generated-types)) | ||
* rather than using `ServerLoad` directly. | ||
@@ -1267,3 +1266,3 @@ */ | ||
/** | ||
* This function declares that the `load` function has a _dependency_ on one or more URLs or custom identifiers, which can subsequently be used with [`invalidate()`](https://kit.svelte.dev/docs/modules#$app-navigation-invalidate) to cause `load` to rerun. | ||
* This function declares that the `load` function has a _dependency_ on one or more URLs or custom identifiers, which can subsequently be used with [`invalidate()`](https://svelte.dev/docs/kit/$app-navigation#invalidate) to cause `load` to rerun. | ||
* | ||
@@ -1293,3 +1292,3 @@ * Most of the time you won't need this, as `fetch` calls `depends` on your behalf — it's only necessary if you're using a custom API client that bypasses `fetch`. | ||
* | ||
* export let data; | ||
* let { data } = $props(); | ||
* | ||
@@ -1324,3 +1323,3 @@ * const increase = async () => { | ||
* Shape of a form action method that is part of `export const actions = {..}` in `+page.server.js`. | ||
* See [form actions](https://kit.svelte.dev/docs/form-actions) for more information. | ||
* See [form actions](https://svelte.dev/docs/kit/form-actions) for more information. | ||
*/ | ||
@@ -1335,3 +1334,3 @@ export type Action< | ||
* Shape of the `export const actions = {..}` object in `+page.server.js`. | ||
* See [form actions](https://kit.svelte.dev/docs/form-actions) for more information. | ||
* See [form actions](https://svelte.dev/docs/kit/form-actions) for more information. | ||
*/ | ||
@@ -1364,3 +1363,3 @@ export type Actions< | ||
/** | ||
* The object returned by the [`error`](https://kit.svelte.dev/docs/modules#sveltejs-kit-error) function. | ||
* The object returned by the [`error`](https://svelte.dev/docs/kit/@sveltejs-kit#error) function. | ||
*/ | ||
@@ -1375,3 +1374,3 @@ export interface HttpError { | ||
/** | ||
* The object returned by the [`redirect`](https://kit.svelte.dev/docs/modules#sveltejs-kit-redirect) function | ||
* The object returned by the [`redirect`](https://svelte.dev/docs/kit/@sveltejs-kit#redirect) function | ||
*/ | ||
@@ -1378,0 +1377,0 @@ export interface Redirect { |
@@ -46,3 +46,3 @@ import fs from 'node:fs'; | ||
throw new Error( | ||
`Cannot use relative URL (${info}) with global fetch — use \`event.fetch\` instead: https://kit.svelte.dev/docs/web-standards#fetch-apis` | ||
`Cannot use relative URL (${info}) with global fetch — use \`event.fetch\` instead: https://svelte.dev/docs/kit/web-standards#fetch-apis` | ||
); | ||
@@ -49,0 +49,0 @@ } |
@@ -96,3 +96,3 @@ import fs from 'node:fs'; | ||
`\n${colors.bold().red(path.relative('.', filename))}\n` + | ||
`\`${match[1]}\` will be ignored — move it to ${fixed} instead. See https://kit.svelte.dev/docs/page-options for more information.`; | ||
`\`${match[1]}\` will be ignored — move it to ${fixed} instead. See https://svelte.dev/docs/kit/page-options for more information.`; | ||
@@ -356,2 +356,5 @@ if (!warned.has(message)) { | ||
/** @type {Map<string, string>} */ | ||
const import_map = new Map(); | ||
/** @type {import('vite').Plugin} */ | ||
@@ -377,2 +380,4 @@ const plugin_virtual_modules = { | ||
} | ||
import_map.set(id, importer); | ||
} | ||
@@ -404,3 +409,14 @@ | ||
const relative = normalize_id(id, normalized_lib, normalized_cwd); | ||
throw new Error(`Cannot import ${strip_virtual_prefix(relative)} into client-side code`); | ||
const illegal_module = strip_virtual_prefix(relative); | ||
if (import_map.has(illegal_module)) { | ||
const importer = path.relative( | ||
cwd, | ||
/** @type {string} */ (import_map.get(illegal_module)) | ||
); | ||
throw new Error(`Cannot import ${illegal_module} into client-side code: ${importer}`); | ||
} | ||
throw new Error(`Cannot import ${illegal_module} into client-side code`); | ||
} | ||
@@ -907,3 +923,3 @@ } | ||
const link = colors.bold().cyan('https://kit.svelte.dev/docs/adapters'); | ||
const link = colors.bold().cyan('https://svelte.dev/docs/kit/adapters'); | ||
console.log( | ||
@@ -910,0 +926,0 @@ `See ${link} to learn how to configure your app to run on the platform of your choosing` |
@@ -134,2 +134,9 @@ import fs from 'node:fs'; | ||
); | ||
try { | ||
filename = decodeURI(filename); | ||
} catch { | ||
// malformed URI | ||
} | ||
let prerendered = is_file(filename); | ||
@@ -136,0 +143,0 @@ |
/** | ||
* A string that matches [`config.kit.paths.base`](https://kit.svelte.dev/docs/configuration#paths). | ||
* A string that matches [`config.kit.paths.base`](https://svelte.dev/docs/kit/configuration#paths). | ||
* | ||
@@ -9,3 +9,3 @@ * Example usage: `<a href="{base}/your-page">Link</a>` | ||
/** | ||
* An absolute path that matches [`config.kit.paths.assets`](https://kit.svelte.dev/docs/configuration#paths). | ||
* An absolute path that matches [`config.kit.paths.assets`](https://svelte.dev/docs/kit/configuration#paths). | ||
* | ||
@@ -12,0 +12,0 @@ * > [!NOTE] If a value for `config.kit.paths.assets` is specified, it will be replaced with `'/_svelte_kit_assets'` during `vite dev` or `vite preview`, since the assets don't yet live at their eventual URL. |
@@ -56,3 +56,3 @@ import { getContext } from 'svelte'; | ||
/** | ||
* A readable store whose initial value is `false`. If [`version.pollInterval`](https://kit.svelte.dev/docs/configuration#version) is a non-zero value, SvelteKit will poll for new versions of the app and update the store value to `true` when it detects one. `updated.check()` will force an immediate check, regardless of polling. | ||
* A readable store whose initial value is `false`. If [`version.pollInterval`](https://svelte.dev/docs/kit/configuration#version) is a non-zero value, SvelteKit will poll for new versions of the app and update the store value to `true` when it detects one. `updated.check()` will force an immediate check, regardless of polling. | ||
* | ||
@@ -92,5 +92,5 @@ * On the server, this store can only be subscribed to during component initialization. In the browser, it can be subscribed to at any time. | ||
`Cannot subscribe to '${name}' store on the server outside of a Svelte component, as it is bound to the current request via component context. This prevents state from leaking between users.` + | ||
'For more information, see https://kit.svelte.dev/docs/state-management#avoid-shared-state-on-the-server' | ||
'For more information, see https://svelte.dev/docs/kit/state-management#avoid-shared-state-on-the-server' | ||
); | ||
} | ||
} |
@@ -56,3 +56,3 @@ import { BROWSER, DEV } from 'esm-env'; | ||
console.warn( | ||
`Loading ${url} using \`window.fetch\`. For best results, use the \`fetch\` that is passed to your \`load\` function: https://kit.svelte.dev/docs/load#making-fetch-requests` | ||
`Loading ${url} using \`window.fetch\`. For best results, use the \`fetch\` that is passed to your \`load\` function: https://svelte.dev/docs/kit/load#making-fetch-requests` | ||
); | ||
@@ -59,0 +59,0 @@ } |
@@ -100,3 +100,3 @@ import * as set_cookie_parser from 'set-cookie-parser'; | ||
}); | ||
} else if (read_implementation) { | ||
} else if (read_implementation && file in manifest._.server_assets) { | ||
const length = manifest._.server_assets[file]; | ||
@@ -103,0 +103,0 @@ const type = manifest.mimeTypes[file.slice(file.lastIndexOf('.'))]; |
@@ -200,3 +200,3 @@ import * as devalue from 'devalue'; | ||
throw new Error( | ||
'When using named actions, the default action cannot be used. See the docs for more info: https://kit.svelte.dev/docs/form-actions#named-actions' | ||
'When using named actions, the default action cannot be used. See the docs for more info: https://svelte.dev/docs/kit/form-actions#named-actions' | ||
); | ||
@@ -284,2 +284,10 @@ } | ||
// if someone tries to use `json()` in their action | ||
if (data instanceof Response) { | ||
throw new Error( | ||
`Data returned from action inside ${route_id} is not serializable. Form actions need to return plain objects or fail(). E.g. return { success: true } or return fail(400, { message: "invalid" });` | ||
); | ||
} | ||
// if devalue could not serialize a property on the object, etc. | ||
if ('path' in error) { | ||
@@ -286,0 +294,0 @@ let message = `Data returned from action inside ${route_id} is not serializable: ${error.message}`; |
@@ -108,3 +108,3 @@ import { text } from '../../../exports/index.js'; | ||
console.warn( | ||
"The form action returned an error, but +error.svelte wasn't rendered because SSR is off. To get the error page with CSR, enhance your form with `use:enhance`. See https://kit.svelte.dev/docs/form-actions#progressive-enhancement-use-enhance" | ||
"The form action returned an error, but +error.svelte wasn't rendered because SSR is off. To get the error page with CSR, enhance your form with `use:enhance`. See https://svelte.dev/docs/kit/form-actions#progressive-enhancement-use-enhance" | ||
); | ||
@@ -114,3 +114,3 @@ } else if (action_result.data) { | ||
console.warn( | ||
"The form action returned a value, but it isn't available in `$page.form`, because SSR is off. To handle the returned value in CSR, enhance your form with `use:enhance`. See https://kit.svelte.dev/docs/form-actions#progressive-enhancement-use-enhance" | ||
"The form action returned a value, but it isn't available in `$page.form`, because SSR is off. To handle the returned value in CSR, enhance your form with `use:enhance`. See https://svelte.dev/docs/kit/form-actions#progressive-enhancement-use-enhance" | ||
); | ||
@@ -117,0 +117,0 @@ } |
@@ -351,3 +351,3 @@ import { DEV } from 'esm-env'; | ||
throw new Error( | ||
`Failed to get response header "${lower}" — it must be included by the \`filterSerializedResponseHeaders\` option: https://kit.svelte.dev/docs/hooks#Server-hooks-handle (at ${event.route.id})` | ||
`Failed to get response header "${lower}" — it must be included by the \`filterSerializedResponseHeaders\` option: https://svelte.dev/docs/kit/hooks#Server-hooks-handle (at ${event.route.id})` | ||
); | ||
@@ -354,0 +354,0 @@ } |
@@ -483,3 +483,3 @@ import * as devalue from 'devalue'; | ||
// the \u001B stuff is ANSI codes, so that we don't need to add a library to the runtime | ||
// https://svelte.dev/repl/1b3f49696f0c44c881c34587f2537aa2 | ||
// https://svelte.dev/playground/1b3f49696f0c44c881c34587f2537aa2?version=4.2.19 | ||
console.warn( | ||
@@ -570,5 +570,4 @@ "\u001B[1m\u001B[31mRemoving comments in transformPageChunk can break Svelte's hydration\u001B[39m\u001B[22m" | ||
push( | ||
`<script${csp.script_needs_nonce ? ` nonce="${csp.nonce}"` : ''}>${global}.resolve(${str})</script>\n` | ||
); | ||
const nonce = csp.script_needs_nonce ? ` nonce="${csp.nonce}"` : ''; | ||
push(`<script${nonce}>${global}.resolve(${str})</script>\n`); | ||
if (count === 0) done(); | ||
@@ -575,0 +574,0 @@ } |
@@ -32,3 +32,3 @@ /** | ||
/** | ||
* The interface that defines `event.locals`, which can be accessed in [hooks](https://kit.svelte.dev/docs/hooks) (`handle`, and `handleError`), server-only `load` functions, and `+server.js` files. | ||
* The interface that defines `event.locals`, which can be accessed in [hooks](https://svelte.dev/docs/kit/hooks) (`handle`, and `handleError`), server-only `load` functions, and `+server.js` files. | ||
*/ | ||
@@ -38,3 +38,3 @@ export interface Locals {} | ||
/** | ||
* Defines the common shape of the [$page.data store](https://kit.svelte.dev/docs/modules#$app-stores-page) - that is, the data that is shared between all pages. | ||
* Defines the common shape of the [$page.data store](https://svelte.dev/docs/kit/$app-stores#page) - that is, the data that is shared between all pages. | ||
* The `Load` and `ServerLoad` functions in `./$types` will be narrowed accordingly. | ||
@@ -46,3 +46,3 @@ * Use optional properties for data that is only present on specific pages. Do not add an index signature (`[key: string]: any`). | ||
/** | ||
* The shape of the `$page.state` object, which can be manipulated using the [`pushState`](https://kit.svelte.dev/docs/modules#$app-navigation-pushstate) and [`replaceState`](https://kit.svelte.dev/docs/modules#$app-navigation-replacestate) functions from `$app/navigation`. | ||
* The shape of the `$page.state` object, which can be manipulated using the [`pushState`](https://svelte.dev/docs/kit/$app-navigation#pushState) and [`replaceState`](https://svelte.dev/docs/kit/$app-navigation#replaceState) functions from `$app/navigation`. | ||
*/ | ||
@@ -52,3 +52,3 @@ export interface PageState {} | ||
/** | ||
* If your adapter provides [platform-specific context](https://kit.svelte.dev/docs/adapters#platform-specific-context) via `event.platform`, you can specify it here. | ||
* If your adapter provides [platform-specific context](https://svelte.dev/docs/kit/adapters#platform-specific-context) via `event.platform`, you can specify it here. | ||
*/ | ||
@@ -59,3 +59,3 @@ export interface Platform {} | ||
/** | ||
* This module is only available to [service workers](https://kit.svelte.dev/docs/service-workers). | ||
* This module is only available to [service workers](https://svelte.dev/docs/kit/service-workers). | ||
*/ | ||
@@ -74,3 +74,3 @@ declare module '$service-worker' { | ||
/** | ||
* An array of URL strings representing the files in your static directory, or whatever directory is specified by `config.kit.files.assets`. You can customize which files are included from `static` directory using [`config.kit.serviceWorker.files`](https://kit.svelte.dev/docs/configuration) | ||
* An array of URL strings representing the files in your static directory, or whatever directory is specified by `config.kit.files.assets`. You can customize which files are included from `static` directory using [`config.kit.serviceWorker.files`](https://svelte.dev/docs/kit/configuration) | ||
*/ | ||
@@ -84,5 +84,5 @@ export const files: string[]; | ||
/** | ||
* 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. | ||
* See [`config.kit.version`](https://svelte.dev/docs/kit/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; | ||
} |
@@ -1,2 +0,2 @@ | ||
This module provides access to runtime environment variables, as defined by the platform you're running on. For example if you're using [`adapter-node`](https://github.com/sveltejs/kit/tree/main/packages/adapter-node) (or running [`vite preview`](https://kit.svelte.dev/docs/cli)), this is equivalent to `process.env`. This module only includes variables that _do not_ begin with [`config.kit.env.publicPrefix`](https://kit.svelte.dev/docs/configuration#env) _and do_ start with [`config.kit.env.privatePrefix`](https://kit.svelte.dev/docs/configuration#env) (if configured). | ||
This module provides access to runtime environment variables, as defined by the platform you're running on. For example if you're using [`adapter-node`](https://github.com/sveltejs/kit/tree/main/packages/adapter-node) (or running [`vite preview`](https://svelte.dev/docs/kit/cli)), this is equivalent to `process.env`. This module only includes variables that _do not_ begin with [`config.kit.env.publicPrefix`](https://svelte.dev/docs/kit/configuration#env) _and do_ start with [`config.kit.env.privatePrefix`](https://svelte.dev/docs/kit/configuration#env) (if configured). | ||
@@ -3,0 +3,0 @@ This module cannot be imported into client-side code. |
@@ -1,2 +0,2 @@ | ||
Similar to [`$env/dynamic/private`](https://kit.svelte.dev/docs/modules#$env-dynamic-private), but only includes variables that begin with [`config.kit.env.publicPrefix`](https://kit.svelte.dev/docs/configuration#env) (which defaults to `PUBLIC_`), and can therefore safely be exposed to client-side code. | ||
Similar to [`$env/dynamic/private`](https://svelte.dev/docs/kit/$env-dynamic-private), but only includes variables that begin with [`config.kit.env.publicPrefix`](https://svelte.dev/docs/kit/configuration#env) (which defaults to `PUBLIC_`), and can therefore safely be exposed to client-side code. | ||
@@ -3,0 +3,0 @@ Note that public dynamic environment variables must all be sent from the server to the client, causing larger network requests — when possible, use `$env/static/public` instead. |
@@ -1,4 +0,4 @@ | ||
Environment variables [loaded by Vite](https://vitejs.dev/guide/env-and-mode.html#env-files) from `.env` files and `process.env`. Like [`$env/dynamic/private`](https://kit.svelte.dev/docs/modules#$env-dynamic-private), this module cannot be imported into client-side code. This module only includes variables that _do not_ begin with [`config.kit.env.publicPrefix`](https://kit.svelte.dev/docs/configuration#env) _and do_ start with [`config.kit.env.privatePrefix`](https://kit.svelte.dev/docs/configuration#env) (if configured). | ||
Environment variables [loaded by Vite](https://vitejs.dev/guide/env-and-mode.html#env-files) from `.env` files and `process.env`. Like [`$env/dynamic/private`](https://svelte.dev/docs/kit/$env-dynamic-private), this module cannot be imported into client-side code. This module only includes variables that _do not_ begin with [`config.kit.env.publicPrefix`](https://svelte.dev/docs/kit/configuration#env) _and do_ start with [`config.kit.env.privatePrefix`](https://svelte.dev/docs/kit/configuration#env) (if configured). | ||
_Unlike_ [`$env/dynamic/private`](https://kit.svelte.dev/docs/modules#$env-dynamic-private), the values exported from this module are statically injected into your bundle at build time, enabling optimisations like dead code elimination. | ||
_Unlike_ [`$env/dynamic/private`](https://svelte.dev/docs/kit/$env-dynamic-private), the values exported from this module are statically injected into your bundle at build time, enabling optimisations like dead code elimination. | ||
@@ -5,0 +5,0 @@ ```ts |
@@ -1,2 +0,2 @@ | ||
Similar to [`$env/static/private`](https://kit.svelte.dev/docs/modules#$env-static-private), except that it only includes environment variables that begin with [`config.kit.env.publicPrefix`](https://kit.svelte.dev/docs/configuration#env) (which defaults to `PUBLIC_`), and can therefore safely be exposed to client-side code. | ||
Similar to [`$env/static/private`](https://svelte.dev/docs/kit/$env-static-private), except that it only includes environment variables that begin with [`config.kit.env.publicPrefix`](https://svelte.dev/docs/kit/configuration#env) (which defaults to `PUBLIC_`), and can therefore safely be exposed to client-side code. | ||
@@ -3,0 +3,0 @@ Values are replaced statically at build time. |
@@ -1,5 +0,5 @@ | ||
This is a simple alias to `src/lib`, or whatever directory is specified as [`config.kit.files.lib`](https://kit.svelte.dev/docs/configuration#files). It allows you to access common components and utility modules without `../../../../` nonsense. | ||
This is a simple alias to `src/lib`, or whatever directory is specified as [`config.kit.files.lib`](https://svelte.dev/docs/kit/configuration#files). It allows you to access common components and utility modules without `../../../../` nonsense. | ||
### `$lib/server` | ||
A subdirectory of `$lib`. SvelteKit will prevent you from importing any modules in `$lib/server` into client-side code. See [server-only modules](https://kit.svelte.dev/docs/server-only-modules). | ||
A subdirectory of `$lib`. SvelteKit will prevent you from importing any modules in `$lib/server` into client-side code. See [server-only modules](https://svelte.dev/docs/kit/server-only-modules). |
// generated during release, do not modify | ||
/** @type {string} */ | ||
export const VERSION = '2.7.2'; | ||
export const VERSION = '2.7.3'; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
740309
21502
11
15
4
79