@sveltejs/kit 3.0.0-next.11 → 3.0.0-next.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +10 -10
- package/src/cli.js +8 -8
- package/src/constants.js +1 -1
- package/src/core/config/options.js +43 -35
- package/src/core/env.js +25 -11
- package/src/core/postbuild/prerender.js +3 -3
- package/src/core/sync/sync.js +11 -14
- package/src/core/sync/utils.js +21 -1
- package/src/core/sync/{write_non_ambient.js → write_app_types.js} +24 -23
- package/src/core/sync/write_client_manifest.js +4 -12
- package/src/core/sync/write_env.js +6 -4
- package/src/core/sync/write_server.js +10 -15
- package/src/core/sync/write_tsconfig/index.js +257 -0
- package/src/core/sync/write_tsconfig/utils.js +162 -0
- package/src/core/sync/write_types/index.js +80 -88
- package/src/exports/index.js +23 -12
- package/src/exports/internal/server/index.js +3 -1
- package/src/exports/internal/shared.js +4 -12
- package/src/exports/public.d.ts +87 -62
- package/src/exports/vite/build/remote.js +10 -12
- package/src/exports/vite/dev/index.js +113 -88
- package/src/exports/vite/index.js +452 -237
- package/src/exports/vite/module_ids.js +3 -1
- package/src/exports/vite/utils.js +1 -10
- package/src/runner.js +13 -0
- package/src/runtime/app/forms.js +4 -0
- package/src/runtime/app/manifest/index.js +1 -0
- package/src/runtime/app/paths/client.js +30 -30
- package/src/runtime/app/paths/internal/client.js +26 -0
- package/src/runtime/app/paths/server.js +22 -9
- package/src/runtime/app/paths/types.d.ts +11 -19
- package/src/runtime/app/server/remote/command.js +12 -7
- package/src/runtime/app/server/remote/form.js +37 -26
- package/src/runtime/app/server/remote/prerender.js +22 -11
- package/src/runtime/app/server/remote/query.js +5 -4
- package/src/runtime/app/server/remote/requested.js +4 -4
- package/src/runtime/app/server/remote/shared.js +48 -30
- package/src/runtime/app/service-worker/index.js +24 -0
- package/src/runtime/app/state/client.js +3 -0
- package/src/runtime/app/state/index.js +3 -3
- package/src/runtime/app/state/server.js +3 -0
- package/src/runtime/client/client.js +627 -311
- package/src/runtime/client/constants.js +2 -6
- package/src/runtime/client/fetcher.js +27 -17
- package/src/runtime/client/remote-functions/form.svelte.js +82 -58
- package/src/runtime/client/remote-functions/prerender.svelte.js +1 -1
- package/src/runtime/client/remote-functions/query/index.js +2 -2
- package/src/runtime/client/remote-functions/query/instance.svelte.js +2 -2
- package/src/runtime/client/remote-functions/query-batch.svelte.js +3 -4
- package/src/runtime/client/remote-functions/query-live/instance.svelte.js +2 -2
- package/src/runtime/client/remote-functions/query-live/iterator.js +15 -10
- package/src/runtime/client/remote-functions/shared.svelte.js +15 -11
- package/src/runtime/client/state.svelte.js +54 -33
- package/src/runtime/client/types.d.ts +1 -2
- package/src/runtime/client/utils.js +21 -14
- package/src/runtime/components/root.svelte +4 -14
- package/src/runtime/form-utils.js +89 -54
- package/src/runtime/props.svelte.js +71 -0
- package/src/runtime/server/cookie.js +1 -1
- package/src/runtime/server/data/index.js +31 -28
- package/src/runtime/server/errors.js +1 -1
- package/src/runtime/server/fetch.js +4 -6
- package/src/runtime/server/page/actions.js +3 -3
- package/src/runtime/server/page/csp.js +86 -103
- package/src/runtime/server/page/index.js +1 -2
- package/src/runtime/server/page/load_data.js +15 -5
- package/src/runtime/server/page/render.js +46 -52
- package/src/runtime/server/page/respond_with_error.js +1 -3
- package/src/runtime/server/remote-functions.js +66 -35
- package/src/runtime/server/respond.js +56 -16
- package/src/runtime/server/utils.js +10 -0
- package/src/types/ambient-private.d.ts +9 -1
- package/src/types/ambient.d.ts +23 -28
- package/src/types/global-private.d.ts +12 -0
- package/src/types/internal.d.ts +15 -10
- package/src/types/private.d.ts +3 -12
- package/src/utils/url.js +12 -0
- package/src/version.js +1 -1
- package/types/index.d.ts +172 -155
- package/types/index.d.ts.map +5 -1
- package/src/core/sync/write_ambient.js +0 -18
- package/src/core/sync/write_tsconfig.js +0 -258
- package/src/runtime/types.d.ts +0 -8
- /package/src/core/sync/{write_tsconfig_test → write_tsconfig/test-app}/package.json +0 -0
package/types/index.d.ts
CHANGED
|
@@ -260,7 +260,7 @@ declare module '@sveltejs/kit' {
|
|
|
260
260
|
/**
|
|
261
261
|
* Sets a cookie. This will add a `set-cookie` header to the response, but also make the cookie available via `cookies.get` or `cookies.getAll` during the current request.
|
|
262
262
|
*
|
|
263
|
-
* The `httpOnly`
|
|
263
|
+
* The `httpOnly` is `true` by default, as is `secure`, except during development, when it defaults to `false`. These must be explicitly disabled if you want cookies to be readable by client-side JavaScript and/or transmitted over HTTP.
|
|
264
264
|
*
|
|
265
265
|
* The `path` option is `'/'` by default. You can use relative paths, or set `path: ''` to make the cookie only available on the current path and its children.
|
|
266
266
|
* @param name the name of the cookie
|
|
@@ -272,7 +272,7 @@ declare module '@sveltejs/kit' {
|
|
|
272
272
|
/**
|
|
273
273
|
* Deletes a cookie by setting its value to an empty string and setting the expiry date in the past.
|
|
274
274
|
*
|
|
275
|
-
* The `httpOnly`
|
|
275
|
+
* The `httpOnly` is `true` by default, as is `secure`, except during development, when it defaults to `false`. These must be explicitly disabled if you want cookies to be readable by client-side JavaScript and/or transmitted over HTTP.
|
|
276
276
|
*
|
|
277
277
|
* The `path` option is `'/'` by default. You can use relative paths, or set `path: ''` to make the cookie only available on the current path and its children.
|
|
278
278
|
* @param name the name of the cookie
|
|
@@ -307,7 +307,7 @@ declare module '@sveltejs/kit' {
|
|
|
307
307
|
/**
|
|
308
308
|
* Serialize a cookie name-value pair into a `Set-Cookie` header string, but don't apply it to the response.
|
|
309
309
|
*
|
|
310
|
-
* The `httpOnly`
|
|
310
|
+
* The `httpOnly` is `true` by default, as is `secure`, except during development, when it defaults to `false`. These must be explicitly disabled if you want cookies to be readable by client-side JavaScript and/or transmitted over HTTP.
|
|
311
311
|
*
|
|
312
312
|
* The `path` option is `'/'` by default. You can use relative paths, or set `path: ''` to make the cookie only available on the current path and its children.
|
|
313
313
|
* @param name the name of the cookie
|
|
@@ -337,32 +337,10 @@ declare module '@sveltejs/kit' {
|
|
|
337
337
|
/**
|
|
338
338
|
* An object containing zero or more aliases used to replace values in `import` statements. These aliases are automatically passed to Vite and TypeScript.
|
|
339
339
|
*
|
|
340
|
-
*
|
|
341
|
-
* /// file: vite.config.js
|
|
342
|
-
* import { defineConfig } from 'vite';
|
|
343
|
-
* import { sveltekit } from '@sveltejs/kit/vite';
|
|
344
|
-
*
|
|
345
|
-
* export default defineConfig({
|
|
346
|
-
* plugins: [
|
|
347
|
-
* sveltekit({
|
|
348
|
-
* alias: {
|
|
349
|
-
* // this will match a file
|
|
350
|
-
* 'my-file': 'path/to/my-file.js',
|
|
351
|
-
*
|
|
352
|
-
* // this will match a directory and its contents
|
|
353
|
-
* // (`my-directory/x` resolves to `path/to/my-directory/x`)
|
|
354
|
-
* 'my-directory': 'path/to/my-directory',
|
|
355
|
-
*
|
|
356
|
-
* // an alias ending /* will only match
|
|
357
|
-
* // the contents of a directory, not the directory itself
|
|
358
|
-
* 'my-directory/*': 'path/to/my-directory/*'
|
|
359
|
-
* }
|
|
360
|
-
* })
|
|
361
|
-
* ]
|
|
362
|
-
* });
|
|
363
|
-
* ```
|
|
340
|
+
* This option is deprecated. Use [subpath imports](https://svelte.dev/docs/kit/$lib) instead.
|
|
364
341
|
*
|
|
365
342
|
* > [!NOTE] You will need to run `npm run dev` to have SvelteKit automatically generate the required alias configuration in `jsconfig.json` or `tsconfig.json`.
|
|
343
|
+
* @deprecated
|
|
366
344
|
* @default {}
|
|
367
345
|
*/
|
|
368
346
|
alias?: Record<string, string>;
|
|
@@ -818,13 +796,7 @@ declare module '@sveltejs/kit' {
|
|
|
818
796
|
*/
|
|
819
797
|
resolution?: 'client' | 'server';
|
|
820
798
|
};
|
|
821
|
-
serviceWorker?:
|
|
822
|
-
/**
|
|
823
|
-
* Determine which files in your `static` directory will be available in `$service-worker.files`.
|
|
824
|
-
* @default (filename) => !/\.DS_Store/.test(filename)
|
|
825
|
-
*/
|
|
826
|
-
files?: (file: string) => boolean;
|
|
827
|
-
} & (
|
|
799
|
+
serviceWorker?:
|
|
828
800
|
| {
|
|
829
801
|
/**
|
|
830
802
|
* Whether to automatically register the service worker, if it exists.
|
|
@@ -842,8 +814,7 @@ declare module '@sveltejs/kit' {
|
|
|
842
814
|
* @default true
|
|
843
815
|
*/
|
|
844
816
|
register?: false;
|
|
845
|
-
}
|
|
846
|
-
);
|
|
817
|
+
};
|
|
847
818
|
/**
|
|
848
819
|
* Options for enabling [OpenTelemetry](https://opentelemetry.io/) tracing for SvelteKit operations.
|
|
849
820
|
* @default { server: false }
|
|
@@ -855,12 +826,15 @@ declare module '@sveltejs/kit' {
|
|
|
855
826
|
*/
|
|
856
827
|
server?: boolean;
|
|
857
828
|
};
|
|
829
|
+
/**
|
|
830
|
+
* @deprecated Add configuration to `tsconfig.json` directly
|
|
831
|
+
*/
|
|
858
832
|
typescript?: {
|
|
859
833
|
/**
|
|
860
834
|
* A function that allows you to edit the generated `tsconfig.json`. You can mutate the config (recommended) or return a new one.
|
|
861
835
|
* This is useful for extending a shared `tsconfig.json` in a monorepo root, for example.
|
|
862
836
|
*
|
|
863
|
-
* Note that any paths configured here should be relative to the generated config file, which is written to
|
|
837
|
+
* Note that any paths configured here should be relative to the generated config file, which is written to `node_modules/$app/tsconfig/tsconfig.json`.
|
|
864
838
|
*
|
|
865
839
|
* @default (config) => config
|
|
866
840
|
* @since 1.3.0
|
|
@@ -869,9 +843,9 @@ declare module '@sveltejs/kit' {
|
|
|
869
843
|
};
|
|
870
844
|
/**
|
|
871
845
|
* Client-side navigation can be buggy if you deploy a new version of your app while people are using it. If the code for the new page is already loaded, it may have stale content; if it isn't, the app's route manifest may point to a JavaScript file that no longer exists.
|
|
872
|
-
* SvelteKit helps you solve this problem through version management.
|
|
846
|
+
* SvelteKit helps you solve this problem through version management. The current version is included in data, remote, and form action responses via the `x-sveltekit-version` header, so SvelteKit can detect new deployments without polling — for example when a navigation triggers a server `load` function, or when a remote function is called. SvelteKit also checks for new versions when the tab regains focus or becomes visible.
|
|
873
847
|
* If SvelteKit encounters an error while loading the page and detects that a new version has been deployed (using the `name` specified here, which defaults to a timestamp of the build) it will fall back to traditional full-page navigation.
|
|
874
|
-
* Not all navigations will result in an error though, for example if the JavaScript for the next page is already loaded. If you still want to force a full-page navigation in these cases, use
|
|
848
|
+
* Not all navigations will result in an error though, for example if the JavaScript for the next page is already loaded. If you still want to force a full-page navigation in these cases, use `beforeNavigate`:
|
|
875
849
|
* ```html
|
|
876
850
|
* /// file: +layout.svelte
|
|
877
851
|
* <script>
|
|
@@ -886,7 +860,7 @@ declare module '@sveltejs/kit' {
|
|
|
886
860
|
* </script>
|
|
887
861
|
* ```
|
|
888
862
|
*
|
|
889
|
-
*
|
|
863
|
+
* In addition to these checks, SvelteKit polls for new versions on an interval and sets [`updated.current`](https://svelte.dev/docs/kit/$app-state#updated) to `true` when it detects one. Set `pollInterval` to `0` to disable polling (the header- and event-based checks will still run).
|
|
890
864
|
*/
|
|
891
865
|
version?: {
|
|
892
866
|
/**
|
|
@@ -913,8 +887,8 @@ declare module '@sveltejs/kit' {
|
|
|
913
887
|
*/
|
|
914
888
|
name?: string;
|
|
915
889
|
/**
|
|
916
|
-
* The interval in milliseconds to poll for version changes. If this is `0`, no polling occurs.
|
|
917
|
-
* @default
|
|
890
|
+
* The interval in milliseconds to poll for version changes. If this is `0`, no polling occurs. SvelteKit also checks for new versions on server responses (via the `x-sveltekit-version` header) and when the tab regains focus or becomes visible, so polling is only needed for long-lived sessions on a single page.
|
|
891
|
+
* @default 3600000
|
|
918
892
|
*/
|
|
919
893
|
pollInterval?: number;
|
|
920
894
|
};
|
|
@@ -1235,6 +1209,46 @@ declare module '@sveltejs/kit' {
|
|
|
1235
1209
|
scroll: { x: number; y: number } | null;
|
|
1236
1210
|
}
|
|
1237
1211
|
|
|
1212
|
+
export interface GotoOptions {
|
|
1213
|
+
/**
|
|
1214
|
+
* If `true`, replaces the current history entry rather than creating a new one.
|
|
1215
|
+
* @default false
|
|
1216
|
+
*/
|
|
1217
|
+
replace?: boolean;
|
|
1218
|
+
/** @deprecated Use `replace` instead. */
|
|
1219
|
+
replaceState?: boolean;
|
|
1220
|
+
/**
|
|
1221
|
+
* If `true`, updates the URL and `page.state` without navigating.
|
|
1222
|
+
* @default false
|
|
1223
|
+
*/
|
|
1224
|
+
shallow?: boolean;
|
|
1225
|
+
/**
|
|
1226
|
+
* If `true`, resets the scroll position (to the top of the page, or to the element
|
|
1227
|
+
* matching the URL's `#hash` if there is one) and resets focus (to the `<body>`, or the
|
|
1228
|
+
* `autofocus` element if there is one) once the navigation completes.
|
|
1229
|
+
*
|
|
1230
|
+
* If `false`, the current scroll position and focused element are left alone.
|
|
1231
|
+
* @default true, or false when `shallow` is true
|
|
1232
|
+
*/
|
|
1233
|
+
reset?: boolean;
|
|
1234
|
+
/**
|
|
1235
|
+
* If `true`, reruns all `load` functions and queries of the page.
|
|
1236
|
+
* @default false
|
|
1237
|
+
*/
|
|
1238
|
+
refreshAll?: boolean;
|
|
1239
|
+
/** Causes any `load` functions to rerun if they depend on one of the URLs. */
|
|
1240
|
+
invalidate?: Array<string | URL | ((url: URL) => boolean)>;
|
|
1241
|
+
/** @deprecated Use `refreshAll` instead. */
|
|
1242
|
+
invalidateAll?: boolean;
|
|
1243
|
+
/** An optional object that will be available as `page.state`. */
|
|
1244
|
+
state?: App.PageState;
|
|
1245
|
+
/**
|
|
1246
|
+
* If `true`, `page.state` will be restored after a full page reload.
|
|
1247
|
+
* @default false
|
|
1248
|
+
*/
|
|
1249
|
+
persistState?: boolean;
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1238
1252
|
/**
|
|
1239
1253
|
* - `enter`: The app has hydrated/started
|
|
1240
1254
|
* - `form`: The user submitted a `<form method="GET">`
|
|
@@ -1256,6 +1270,8 @@ declare module '@sveltejs/kit' {
|
|
|
1256
1270
|
* - `popstate`: Navigation was triggered by back/forward navigation
|
|
1257
1271
|
*/
|
|
1258
1272
|
type: NavigationType;
|
|
1273
|
+
/** Whether this is a shallow navigation. */
|
|
1274
|
+
shallow: boolean;
|
|
1259
1275
|
/**
|
|
1260
1276
|
* Where navigation was triggered from
|
|
1261
1277
|
*/
|
|
@@ -1350,10 +1366,7 @@ declare module '@sveltejs/kit' {
|
|
|
1350
1366
|
}
|
|
1351
1367
|
|
|
1352
1368
|
export type Navigation =
|
|
1353
|
-
|
|
|
1354
|
-
| NavigationFormSubmit
|
|
1355
|
-
| NavigationPopState
|
|
1356
|
-
| NavigationLink;
|
|
1369
|
+
NavigationExternal | NavigationFormSubmit | NavigationPopState | NavigationLink;
|
|
1357
1370
|
|
|
1358
1371
|
/**
|
|
1359
1372
|
* The argument passed to [`beforeNavigate`](https://svelte.dev/docs/kit/$app-navigation#beforeNavigate) callbacks.
|
|
@@ -1424,9 +1437,20 @@ declare module '@sveltejs/kit' {
|
|
|
1424
1437
|
*/
|
|
1425
1438
|
data: App.PageData & Record<string, any>;
|
|
1426
1439
|
/**
|
|
1427
|
-
* The page state, which can be manipulated using
|
|
1440
|
+
* The page state, which can be manipulated using [`goto`](https://svelte.dev/docs/kit/$app-navigation#goto) from `$app/navigation`.
|
|
1428
1441
|
*/
|
|
1429
1442
|
state: App.PageState;
|
|
1443
|
+
/**
|
|
1444
|
+
* Information about the target of the current shallow navigation, or `null` if no shallow navigation has occurred.
|
|
1445
|
+
*/
|
|
1446
|
+
shallow: {
|
|
1447
|
+
/** Parameters of the target route, or `null` if the URL does not resolve to a route. */
|
|
1448
|
+
params: AppLayoutParams<'/'> | null;
|
|
1449
|
+
/** Info about the target route, or `null` if the URL does not resolve to a route. */
|
|
1450
|
+
route: { id: AppRouteId } | null;
|
|
1451
|
+
/** The normalized URL passed to `goto(..., { shallow: true })`. */
|
|
1452
|
+
url: ReadonlyURL;
|
|
1453
|
+
} | null;
|
|
1430
1454
|
/**
|
|
1431
1455
|
* Filled only after a form submission. See [form actions](https://svelte.dev/docs/kit/form-actions) for more info.
|
|
1432
1456
|
*/
|
|
@@ -1447,8 +1471,7 @@ declare module '@sveltejs/kit' {
|
|
|
1447
1471
|
* A param matcher definition passed to [`defineParams`](https://svelte.dev/docs/kit/@sveltejs-kit#defineParams).
|
|
1448
1472
|
*/
|
|
1449
1473
|
export type ParamDefinition =
|
|
1450
|
-
|
|
1451
|
-
| StandardSchemaV1<string, ParamValue>;
|
|
1474
|
+
((param: string) => ParamValue | undefined) | StandardSchemaV1<string, ParamValue>;
|
|
1452
1475
|
|
|
1453
1476
|
/**
|
|
1454
1477
|
* The return type of [`defineParams`](https://svelte.dev/docs/kit/@sveltejs-kit#defineParams).
|
|
@@ -1551,8 +1574,7 @@ declare module '@sveltejs/kit' {
|
|
|
1551
1574
|
};
|
|
1552
1575
|
|
|
1553
1576
|
export type RequestedResult<Validated, Output> =
|
|
1554
|
-
|
|
|
1555
|
-
| LiveQueryRequestedResult<Validated, Output>;
|
|
1577
|
+
QueryRequestedResult<Validated, Output> | LiveQueryRequestedResult<Validated, Output>;
|
|
1556
1578
|
|
|
1557
1579
|
export interface RequestEvent<
|
|
1558
1580
|
Params extends AppLayoutParams<'/'> = AppLayoutParams<'/'>,
|
|
@@ -1585,9 +1607,10 @@ declare module '@sveltejs/kit' {
|
|
|
1585
1607
|
/**
|
|
1586
1608
|
* The parameters of the current route - e.g. for a route like `/blog/[slug]`, a `{ slug: string }` object.
|
|
1587
1609
|
*
|
|
1588
|
-
*
|
|
1589
|
-
*
|
|
1590
|
-
*
|
|
1610
|
+
* Inside `query` functions (including `query.batch` and `query.live`), accessing this property throws an error.
|
|
1611
|
+
* Pass values from the page as arguments to the query instead. Inside `form` and `command` functions it relates to the page
|
|
1612
|
+
* the remote function was called from, _not_ the URL of the endpoint SvelteKit creates for the remote function. Never use it
|
|
1613
|
+
* to determine whether or not a user is authorized to access certain data, as these values are part of the request which could be manipulated.
|
|
1591
1614
|
*/
|
|
1592
1615
|
params: Params;
|
|
1593
1616
|
/**
|
|
@@ -1605,9 +1628,10 @@ declare module '@sveltejs/kit' {
|
|
|
1605
1628
|
/**
|
|
1606
1629
|
* The ID of the current route - e.g. for `src/routes/blog/[slug]`, it would be `/blog/[slug]`. It is `null` when no route is matched.
|
|
1607
1630
|
*
|
|
1608
|
-
*
|
|
1609
|
-
*
|
|
1610
|
-
*
|
|
1631
|
+
* Inside `query` functions (including `query.batch` and `query.live`), accessing this property throws an error.
|
|
1632
|
+
* Pass values from the page as arguments to the query instead. Inside `form` and `command` functions it relates to the page
|
|
1633
|
+
* the remote function was called from, _not_ the URL of the endpoint SvelteKit creates for the remote function. Never use it
|
|
1634
|
+
* to determine whether or not a user is authorized to access certain data, as these values are part of the request which could be manipulated.
|
|
1611
1635
|
*/
|
|
1612
1636
|
id: RouteId;
|
|
1613
1637
|
};
|
|
@@ -1637,9 +1661,10 @@ declare module '@sveltejs/kit' {
|
|
|
1637
1661
|
/**
|
|
1638
1662
|
* The requested URL.
|
|
1639
1663
|
*
|
|
1640
|
-
*
|
|
1641
|
-
*
|
|
1642
|
-
*
|
|
1664
|
+
* Inside `query` functions (including `query.batch` and `query.live`), accessing this property throws an error.
|
|
1665
|
+
* Pass values from the page as arguments to the query instead. Inside `form` and `command` functions it relates to the page
|
|
1666
|
+
* the remote function was called from, _not_ the URL of the endpoint SvelteKit creates for the remote function. Never use it
|
|
1667
|
+
* to determine whether or not a user is authorized to access certain data, as these values are part of the request which could be manipulated.
|
|
1643
1668
|
*/
|
|
1644
1669
|
url: URL;
|
|
1645
1670
|
/**
|
|
@@ -1730,7 +1755,7 @@ declare module '@sveltejs/kit' {
|
|
|
1730
1755
|
|
|
1731
1756
|
export interface ServerInitOptions {
|
|
1732
1757
|
/** A map of environment variables. */
|
|
1733
|
-
env: Record<string, string>;
|
|
1758
|
+
env: Record<string, string | undefined>;
|
|
1734
1759
|
/** A function that turns an asset filename into a `ReadableStream`. Required for the `read` export from `$app/server` to work. */
|
|
1735
1760
|
read?: (file: string) => MaybePromise<ReadableStream | null>;
|
|
1736
1761
|
}
|
|
@@ -2064,7 +2089,7 @@ declare module '@sveltejs/kit' {
|
|
|
2064
2089
|
? [type: Type, value: Value | (string & {})]
|
|
2065
2090
|
: Type extends 'file' | 'file multiple'
|
|
2066
2091
|
? [type: Type]
|
|
2067
|
-
: [type: Type] | [type: Type, value: Value |
|
|
2092
|
+
: [type: Type] | [type: Type, value: Value | undefined];
|
|
2068
2093
|
|
|
2069
2094
|
/**
|
|
2070
2095
|
* Form field accessor type that provides name(), value(), and issues() methods
|
|
@@ -2678,20 +2703,11 @@ declare module '@sveltejs/kit' {
|
|
|
2678
2703
|
type PrerenderHttpErrorHandlerValue = 'fail' | 'warn' | 'ignore' | PrerenderHttpErrorHandler;
|
|
2679
2704
|
type PrerenderMissingIdHandlerValue = 'fail' | 'warn' | 'ignore' | PrerenderMissingIdHandler;
|
|
2680
2705
|
type PrerenderUnseenRoutesHandlerValue =
|
|
2681
|
-
| '
|
|
2682
|
-
| 'warn'
|
|
2683
|
-
| 'ignore'
|
|
2684
|
-
| PrerenderUnseenRoutesHandler;
|
|
2706
|
+
'fail' | 'warn' | 'ignore' | PrerenderUnseenRoutesHandler;
|
|
2685
2707
|
type PrerenderEntryGeneratorMismatchHandlerValue =
|
|
2686
|
-
| '
|
|
2687
|
-
| 'warn'
|
|
2688
|
-
| 'ignore'
|
|
2689
|
-
| PrerenderEntryGeneratorMismatchHandler;
|
|
2708
|
+
'fail' | 'warn' | 'ignore' | PrerenderEntryGeneratorMismatchHandler;
|
|
2690
2709
|
type PrerenderInvalidUrlHandlerValue =
|
|
2691
|
-
| '
|
|
2692
|
-
| 'warn'
|
|
2693
|
-
| 'ignore'
|
|
2694
|
-
| PrerenderInvalidUrlHandler;
|
|
2710
|
+
'fail' | 'warn' | 'ignore' | PrerenderInvalidUrlHandler;
|
|
2695
2711
|
|
|
2696
2712
|
export type PrerenderOption = boolean | 'auto';
|
|
2697
2713
|
|
|
@@ -2736,42 +2752,43 @@ declare module '@sveltejs/kit' {
|
|
|
2736
2752
|
* return an error response without invoking `handleError`.
|
|
2737
2753
|
* Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it.
|
|
2738
2754
|
* @param status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.
|
|
2739
|
-
* @param
|
|
2755
|
+
* @param message The error message.
|
|
2740
2756
|
* @throws {import('./public.js').HttpError} This error instructs SvelteKit to initiate HTTP error handling.
|
|
2741
2757
|
* @throws {Error} If the provided status is invalid (not between 400 and 599).
|
|
2742
2758
|
*/
|
|
2743
|
-
export function error(status:
|
|
2744
|
-
status
|
|
2745
|
-
|
|
2759
|
+
export function error(status: {
|
|
2760
|
+
status: number;
|
|
2761
|
+
message: string;
|
|
2762
|
+
} extends App.Error ? number : never, message?: string | undefined): never;
|
|
2746
2763
|
/**
|
|
2747
2764
|
* Throws an error with a HTTP status code and an optional message.
|
|
2748
2765
|
* When called during request handling, this will cause SvelteKit to
|
|
2749
2766
|
* return an error response without invoking `handleError`.
|
|
2750
2767
|
* Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it.
|
|
2751
2768
|
* @param status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.
|
|
2752
|
-
* @param
|
|
2769
|
+
* @param message The error message.
|
|
2770
|
+
* @param properties Additional properties of the App.Error type.
|
|
2753
2771
|
* @throws {import('./public.js').HttpError} This error instructs SvelteKit to initiate HTTP error handling.
|
|
2754
2772
|
* @throws {Error} If the provided status is invalid (not between 400 and 599).
|
|
2755
2773
|
*/
|
|
2756
|
-
export function error(status: number,
|
|
2774
|
+
export function error(status: number, message: string, properties: {
|
|
2757
2775
|
status: number;
|
|
2758
2776
|
message: string;
|
|
2759
|
-
} extends App.Error ?
|
|
2777
|
+
} extends App.Error ? never : Omit<App.Error, "status" | "message">): never;
|
|
2760
2778
|
/**
|
|
2761
2779
|
* Throws an error with a HTTP status code and an optional message.
|
|
2762
2780
|
* When called during request handling, this will cause SvelteKit to
|
|
2763
2781
|
* return an error response without invoking `handleError`.
|
|
2764
2782
|
* Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it.
|
|
2783
|
+
* @deprecated Passing an `App.Error` body as the second argument is deprecated — pass the `message` as the second argument, and any additional properties as the third
|
|
2765
2784
|
* @param status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.
|
|
2766
|
-
* @param body
|
|
2767
|
-
* @param properties Additional properties of the App.Error type.
|
|
2785
|
+
* @param body An object that conforms to the App.Error type. If a string is passed, it will be used as the message property.
|
|
2768
2786
|
* @throws {import('./public.js').HttpError} This error instructs SvelteKit to initiate HTTP error handling.
|
|
2769
2787
|
* @throws {Error} If the provided status is invalid (not between 400 and 599).
|
|
2770
2788
|
*/
|
|
2771
|
-
export function error(status: number,
|
|
2772
|
-
status
|
|
2773
|
-
|
|
2774
|
-
} extends App.Error ? never : Omit<App.Error, "status" | "message">): never;
|
|
2789
|
+
export function error(status: number, properties: Omit<App.Error, "status"> & {
|
|
2790
|
+
status?: App.Error["status"];
|
|
2791
|
+
}): never;
|
|
2775
2792
|
/**
|
|
2776
2793
|
* Checks whether this is an error thrown by {@link error}.
|
|
2777
2794
|
* @param status The status to filter for.
|
|
@@ -3149,25 +3166,18 @@ declare module '$app/navigation' {
|
|
|
3149
3166
|
* */
|
|
3150
3167
|
export function disableScrollHandling(): void;
|
|
3151
3168
|
/**
|
|
3152
|
-
* Allows you to navigate programmatically to a given route, with
|
|
3153
|
-
*
|
|
3169
|
+
* Allows you to navigate programmatically to a given route, with control over details such as whether scroll and focus are reset
|
|
3170
|
+
* (as they would be with a regular navigation) or preserved.
|
|
3171
|
+
*
|
|
3172
|
+
* Returns a Promise that resolves when SvelteKit navigates (or fails to navigate, in which case the promise rejects) or the state change has been applied.
|
|
3154
3173
|
*
|
|
3155
|
-
* `goto` is intended for navigations to routes that belong to the app.
|
|
3156
|
-
* If the URL does not resolve to a route within the app, the returned promise will reject.
|
|
3174
|
+
* `goto` is intended for navigations to routes that belong to the app, and will reject if a route cannot be resolved.
|
|
3157
3175
|
* For external URLs, use `window.location = url` to perform a full-page navigation instead of calling `goto(url)`.
|
|
3158
3176
|
*
|
|
3159
3177
|
* @param url Where to navigate to. Note that if you've set [`config.paths.base`](https://svelte.dev/docs/kit/configuration#paths) and the URL is root-relative, you need to prepend the base path if you want to navigate within the app.
|
|
3160
|
-
* @param
|
|
3178
|
+
* @param opts Options related to the navigation
|
|
3161
3179
|
* */
|
|
3162
|
-
export function goto(url: string | URL, opts?:
|
|
3163
|
-
replaceState?: boolean | undefined;
|
|
3164
|
-
noScroll?: boolean | undefined;
|
|
3165
|
-
keepFocus?: boolean | undefined;
|
|
3166
|
-
refreshAll?: boolean | undefined;
|
|
3167
|
-
invalidate?: (string | URL | ((url: URL) => boolean))[] | undefined;
|
|
3168
|
-
invalidateAll?: boolean | undefined;
|
|
3169
|
-
state?: App.PageState | undefined;
|
|
3170
|
-
}): Promise<void>;
|
|
3180
|
+
export function goto(url: string | URL, opts?: import("@sveltejs/kit").GotoOptions): Promise<void>;
|
|
3171
3181
|
/**
|
|
3172
3182
|
* Causes any `load` functions belonging to the currently active page to re-run if they depend on the `url` in question, via `fetch` or `depends`. Returns a `Promise` that resolves when the page is subsequently updated.
|
|
3173
3183
|
*
|
|
@@ -3235,22 +3245,24 @@ declare module '$app/navigation' {
|
|
|
3235
3245
|
* */
|
|
3236
3246
|
export function preloadCode(pathname: string): Promise<void>;
|
|
3237
3247
|
/**
|
|
3238
|
-
* Programmatically create a new history entry with the given `page.state`.
|
|
3248
|
+
* Programmatically create a new history entry with the given `page.state`. Used for [shallow routing](https://svelte.dev/docs/kit/shallow-routing).
|
|
3239
3249
|
*
|
|
3250
|
+
* @deprecated Use `goto(url, { state, shallow: true })` instead.
|
|
3240
3251
|
* */
|
|
3241
|
-
export function pushState(url: string | URL, state: App.PageState): void
|
|
3252
|
+
export function pushState(url: string | URL, state: App.PageState): Promise<void>;
|
|
3242
3253
|
/**
|
|
3243
|
-
* Programmatically replace the current history entry with the given `page.state`.
|
|
3254
|
+
* Programmatically replace the current history entry with the given `page.state`. Used for [shallow routing](https://svelte.dev/docs/kit/shallow-routing).
|
|
3244
3255
|
*
|
|
3256
|
+
* @deprecated Use `goto(url, { state, shallow: true, replace: true })` instead.
|
|
3245
3257
|
* */
|
|
3246
|
-
export function replaceState(url: string | URL, state: App.PageState): void
|
|
3258
|
+
export function replaceState(url: string | URL, state: App.PageState): Promise<void>;
|
|
3247
3259
|
type MaybePromise<T> = T | Promise<T>;
|
|
3248
3260
|
|
|
3249
3261
|
export {};
|
|
3250
3262
|
}
|
|
3251
3263
|
|
|
3252
3264
|
declare module '$app/paths' {
|
|
3253
|
-
import type {
|
|
3265
|
+
import type { AssetPath, RouteIdWithSearchOrHash, PathnameWithSearchOrHash, ResolvedPathname, Path, RouteId, RouteParams } from '$app/types';
|
|
3254
3266
|
/**
|
|
3255
3267
|
* Resolve the URL of an asset in your `static` directory, by prefixing it with [`config.paths.assets`](https://svelte.dev/docs/kit/configuration#paths) if configured, or otherwise by prefixing it with the base path.
|
|
3256
3268
|
*
|
|
@@ -3262,12 +3274,12 @@ declare module '$app/paths' {
|
|
|
3262
3274
|
* import { asset } from '$app/paths';
|
|
3263
3275
|
* </script>
|
|
3264
3276
|
*
|
|
3265
|
-
* <img alt="a potato" src={asset('
|
|
3277
|
+
* <img alt="a potato" src={asset('potato.jpg')} />
|
|
3266
3278
|
* ```
|
|
3267
3279
|
* @since 2.26
|
|
3268
3280
|
*
|
|
3269
3281
|
* */
|
|
3270
|
-
export function asset(file:
|
|
3282
|
+
export function asset(file: AssetPath): string;
|
|
3271
3283
|
/**
|
|
3272
3284
|
* Resolve a pathname by prefixing it with the base path, if any, or resolve a route ID by populating dynamic segments with parameters.
|
|
3273
3285
|
*
|
|
@@ -3278,7 +3290,7 @@ declare module '$app/paths' {
|
|
|
3278
3290
|
* import { resolve } from '$app/paths';
|
|
3279
3291
|
*
|
|
3280
3292
|
* // using a pathname
|
|
3281
|
-
* const resolved = resolve(
|
|
3293
|
+
* const resolved = resolve(`blog/hello-world`);
|
|
3282
3294
|
*
|
|
3283
3295
|
* // using a route ID plus parameters
|
|
3284
3296
|
* const resolved = resolve('/blog/[slug]', {
|
|
@@ -3296,7 +3308,7 @@ declare module '$app/paths' {
|
|
|
3296
3308
|
* ```js
|
|
3297
3309
|
* import { match } from '$app/paths';
|
|
3298
3310
|
*
|
|
3299
|
-
* const route = await match('
|
|
3311
|
+
* const route = await match('blog/hello-world');
|
|
3300
3312
|
*
|
|
3301
3313
|
* if (route?.id === '/blog/[slug]') {
|
|
3302
3314
|
* const slug = route.params.slug;
|
|
@@ -3307,26 +3319,23 @@ declare module '$app/paths' {
|
|
|
3307
3319
|
* @since 2.52.0
|
|
3308
3320
|
*
|
|
3309
3321
|
* */
|
|
3310
|
-
export function match(url:
|
|
3322
|
+
export function match(url: Path | URL | (string & {})): Promise<{ [K in RouteId]: {
|
|
3311
3323
|
id: K;
|
|
3312
3324
|
params: RouteParams<K>;
|
|
3313
3325
|
}; }[RouteId] | null>;
|
|
3314
|
-
type StripSearchOrHash<T extends string> = T extends `${infer
|
|
3315
|
-
?
|
|
3316
|
-
: T extends `${infer
|
|
3317
|
-
?
|
|
3326
|
+
type StripSearchOrHash<T extends string> = T extends `${infer U}?${string}`
|
|
3327
|
+
? U
|
|
3328
|
+
: T extends `${infer U}#${string}`
|
|
3329
|
+
? U
|
|
3318
3330
|
: T;
|
|
3319
3331
|
|
|
3320
|
-
type ResolveArgs<T
|
|
3321
|
-
T extends RouteId
|
|
3322
|
-
? RouteParams<
|
|
3332
|
+
type ResolveArgs<T> = T extends `/${string}`
|
|
3333
|
+
? StripSearchOrHash<T> extends infer U extends RouteId
|
|
3334
|
+
? RouteParams<U> extends Record<string, never>
|
|
3323
3335
|
? [route: T]
|
|
3324
|
-
: [route: T, params: RouteParams<
|
|
3325
|
-
:
|
|
3326
|
-
|
|
3327
|
-
? [route: T]
|
|
3328
|
-
: [route: T, params: RouteParams<U>]
|
|
3329
|
-
: [route: T];
|
|
3336
|
+
: [route: T, params: RouteParams<U>]
|
|
3337
|
+
: [never]
|
|
3338
|
+
: [pathname: T];
|
|
3330
3339
|
|
|
3331
3340
|
export {};
|
|
3332
3341
|
}
|
|
@@ -3590,13 +3599,26 @@ declare module '$app/server' {
|
|
|
3590
3599
|
export {};
|
|
3591
3600
|
}
|
|
3592
3601
|
|
|
3602
|
+
declare module '$app/service-worker' {
|
|
3603
|
+
/**
|
|
3604
|
+
* The execution context of a service worker. This export exists to make it easier to
|
|
3605
|
+
* use service workers with the correct types, provided the importing module is governed
|
|
3606
|
+
* by a `tsconfig.json` that extends [`$app/tsconfig/service-worker`](https://svelte.dev/docs/kit/$app-tsconfig-service-worker).
|
|
3607
|
+
*
|
|
3608
|
+
*/
|
|
3609
|
+
// @ts-ignore
|
|
3610
|
+
export const self: ServiceWorkerGlobalScope;
|
|
3611
|
+
|
|
3612
|
+
export {};
|
|
3613
|
+
}
|
|
3614
|
+
|
|
3593
3615
|
declare module '$app/state' {
|
|
3594
3616
|
/**
|
|
3595
3617
|
* A read-only reactive object with information about the current page, serving several use cases:
|
|
3596
3618
|
* - retrieving the combined `data` of all pages/layouts anywhere in your component tree (also see [loading data](https://svelte.dev/docs/kit/load))
|
|
3597
3619
|
* - retrieving the current value of the `form` prop anywhere in your component tree (also see [form actions](https://svelte.dev/docs/kit/form-actions))
|
|
3598
|
-
* - retrieving the page state that was set through `goto
|
|
3599
|
-
* - retrieving metadata such as the URL you're on, the current route and its parameters, and whether or not there was an error
|
|
3620
|
+
* - retrieving the page state that was set through `goto` (also see [goto](https://svelte.dev/docs/kit/$app-navigation#goto) and [shallow routing](https://svelte.dev/docs/kit/shallow-routing))
|
|
3621
|
+
* - retrieving metadata such as the URL you're on, the current route and its parameters, the target of a shallow navigation, and whether or not there was an error
|
|
3600
3622
|
*
|
|
3601
3623
|
* ```svelte
|
|
3602
3624
|
* <!--- file: +layout.svelte --->
|
|
@@ -3641,7 +3663,7 @@ declare module '$app/state' {
|
|
|
3641
3663
|
complete: null;
|
|
3642
3664
|
};
|
|
3643
3665
|
/**
|
|
3644
|
-
* A read-only reactive value that's initially `false`.
|
|
3666
|
+
* A read-only reactive value that's initially `false`. SvelteKit checks for new versions on data, remote, and form action responses (via the `x-sveltekit-version` header), when the tab regains focus or becomes visible, and on a poll interval (see [`version.pollInterval`](https://svelte.dev/docs/kit/configuration#version)). `updated.current` is set to `true` when a new version is detected. `updated.check()` will force an immediate check, regardless of polling.
|
|
3645
3667
|
* */
|
|
3646
3668
|
export const updated: {
|
|
3647
3669
|
get current(): boolean;
|
|
@@ -3697,7 +3719,7 @@ declare namespace App {
|
|
|
3697
3719
|
export interface PageData {}
|
|
3698
3720
|
|
|
3699
3721
|
/**
|
|
3700
|
-
* The shape of the `page.state` object, which can be manipulated using
|
|
3722
|
+
* The shape of the `page.state` object, which can be manipulated using [`goto`](https://svelte.dev/docs/kit/$app-navigation#goto).
|
|
3701
3723
|
*/
|
|
3702
3724
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
3703
3725
|
export interface PageState {}
|
|
@@ -3710,32 +3732,30 @@ declare namespace App {
|
|
|
3710
3732
|
}
|
|
3711
3733
|
|
|
3712
3734
|
/**
|
|
3713
|
-
* This module is
|
|
3735
|
+
* This module is available to [service workers](https://svelte.dev/docs/kit/service-workers) and other contexts.
|
|
3736
|
+
* It exports information about the build output, static files, prerendered pages, and routes.
|
|
3714
3737
|
*/
|
|
3715
|
-
declare module '$
|
|
3738
|
+
declare module '$app/manifest' {
|
|
3716
3739
|
/**
|
|
3717
|
-
*
|
|
3718
|
-
*
|
|
3719
|
-
*/
|
|
3720
|
-
export const base: string;
|
|
3721
|
-
/**
|
|
3722
|
-
* An array of URL strings representing the files generated by Vite, suitable for caching with `cache.addAll(build)`.
|
|
3740
|
+
* An array of `{ path: string }` objects representing the files generated by Vite.
|
|
3741
|
+
* The path is relative to the [base path](https://svelte.dev/docs/kit/configuration#paths), and is intended for use with `cache.add(...)` inside a [service worker](https://svelte.dev/docs/kit/service-workers).
|
|
3723
3742
|
* During development, this is an empty array.
|
|
3724
3743
|
*/
|
|
3725
|
-
export const
|
|
3744
|
+
export const immutable: Array<{ path: string }>;
|
|
3726
3745
|
/**
|
|
3727
|
-
* An array of
|
|
3746
|
+
* An array of `{ path: AssetPath }` objects representing the files in your `static` directory, or whatever directory is specified by `config.files.assets`.
|
|
3747
|
+
* The path is relative to the [base path](https://svelte.dev/docs/kit/configuration#paths), and can be used with [`asset(...)`](https://svelte.dev/docs/kit/$app-paths#asset).
|
|
3728
3748
|
*/
|
|
3729
|
-
export const
|
|
3749
|
+
export const assets: Array<{ path: import('$app/types').AssetPath }>;
|
|
3730
3750
|
/**
|
|
3731
|
-
* An array of
|
|
3751
|
+
* An array of `{ path: Path }` objects representing prerendered pages and endpoints, relative to the [base path](https://svelte.dev/docs/kit/configuration#paths).
|
|
3732
3752
|
* During development, this is an empty array.
|
|
3733
3753
|
*/
|
|
3734
|
-
export const prerendered:
|
|
3754
|
+
export const prerendered: Array<{ path: import('$app/types').Path }>;
|
|
3735
3755
|
/**
|
|
3736
|
-
*
|
|
3756
|
+
* An array of objects with an `id` property representing the routes in your app.
|
|
3737
3757
|
*/
|
|
3738
|
-
export const
|
|
3758
|
+
export const routes: Array<{ id: import('$app/types').RouteId }>;
|
|
3739
3759
|
}
|
|
3740
3760
|
|
|
3741
3761
|
/**
|
|
@@ -3752,9 +3772,9 @@ declare module '$app/types' {
|
|
|
3752
3772
|
RouteId(): string;
|
|
3753
3773
|
RouteParams(): Record<string, Record<string, string>>;
|
|
3754
3774
|
LayoutParams(): Record<string, Record<string, string>>;
|
|
3755
|
-
|
|
3775
|
+
Path(): string;
|
|
3756
3776
|
ResolvedPathname(): string;
|
|
3757
|
-
|
|
3777
|
+
AssetPath(): string;
|
|
3758
3778
|
}
|
|
3759
3779
|
|
|
3760
3780
|
/**
|
|
@@ -3782,27 +3802,24 @@ declare module '$app/types' {
|
|
|
3782
3802
|
: Record<string, never>;
|
|
3783
3803
|
|
|
3784
3804
|
/**
|
|
3785
|
-
* A union of all valid
|
|
3805
|
+
* A union of all valid paths in your app, relative to the `base` path.
|
|
3786
3806
|
*/
|
|
3787
|
-
export type
|
|
3807
|
+
export type Path = ReturnType<AppTypes['Path']>;
|
|
3788
3808
|
|
|
3789
3809
|
/**
|
|
3790
|
-
* `
|
|
3810
|
+
* `Path`, but possibly suffixed with a search string and/or hash.
|
|
3791
3811
|
*/
|
|
3792
|
-
export type PathnameWithSearchOrHash =
|
|
3793
|
-
| Pathname
|
|
3794
|
-
| `${Pathname}?${string}`
|
|
3795
|
-
| `${Pathname}#${string}`;
|
|
3812
|
+
export type PathnameWithSearchOrHash = Path | `${Path}?${string}` | `${Path}#${string}`;
|
|
3796
3813
|
|
|
3797
3814
|
/**
|
|
3798
|
-
* `
|
|
3815
|
+
* `Path`, but prefixed with a base path. Used for `page.url.pathname`.
|
|
3799
3816
|
*/
|
|
3800
3817
|
export type ResolvedPathname = ReturnType<AppTypes['ResolvedPathname']>;
|
|
3801
3818
|
|
|
3802
3819
|
/**
|
|
3803
|
-
* A union of all the filenames of assets contained in your `static` directory.
|
|
3820
|
+
* A union of all the filenames of assets contained in your `static` directory, relative to the `base` path.
|
|
3804
3821
|
*/
|
|
3805
|
-
export type
|
|
3822
|
+
export type AssetPath = ReturnType<AppTypes['AssetPath']>;
|
|
3806
3823
|
}
|
|
3807
3824
|
|
|
3808
3825
|
//# sourceMappingURL=index.d.ts.map
|