@sveltejs/kit 2.63.0 → 3.0.0-next.1
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 +17 -22
- package/src/cli.js +19 -16
- package/src/core/adapt/builder.js +25 -77
- package/src/core/adapt/index.js +6 -4
- package/src/core/config/index.js +12 -84
- package/src/core/config/options.js +36 -46
- package/src/core/env.js +5 -130
- package/src/core/generate_manifest/find_server_assets.js +3 -2
- package/src/core/generate_manifest/index.js +11 -3
- package/src/core/postbuild/analyse.js +19 -16
- package/src/core/postbuild/fallback.js +0 -3
- package/src/core/postbuild/prerender.js +18 -17
- package/src/core/postbuild/queue.js +3 -4
- package/src/core/sync/create_manifest_data/index.js +16 -18
- package/src/core/sync/sync.js +30 -25
- package/src/core/sync/utils.js +0 -15
- package/src/core/sync/write_ambient.js +3 -54
- package/src/core/sync/write_client_manifest.js +8 -9
- package/src/core/sync/write_env.js +5 -1
- package/src/core/sync/write_non_ambient.js +7 -7
- package/src/core/sync/write_root.js +40 -88
- package/src/core/sync/write_server.js +16 -23
- package/src/core/sync/write_tsconfig.js +28 -24
- package/src/core/sync/write_types/index.js +31 -25
- package/src/core/utils.js +14 -11
- package/src/exports/index.js +8 -21
- package/src/exports/node/index.js +8 -13
- package/src/exports/public.d.ts +35 -76
- package/src/exports/vite/build/build_server.js +14 -11
- package/src/exports/vite/build/remote.js +6 -7
- package/src/exports/vite/build/utils.js +7 -5
- package/src/exports/vite/dev/index.js +30 -31
- package/src/exports/vite/index.js +938 -732
- package/src/exports/vite/module_ids.js +1 -6
- package/src/exports/vite/options.js +17 -0
- package/src/exports/vite/preview/index.js +3 -5
- package/src/exports/vite/static_analysis/index.js +11 -5
- package/src/exports/vite/utils.js +9 -45
- package/src/runtime/app/env/internal.js +3 -0
- package/src/runtime/app/env/public/client.js +0 -6
- package/src/runtime/app/env/public/server.js +0 -6
- package/src/runtime/app/environment/index.js +3 -7
- package/src/runtime/app/server/index.js +4 -2
- package/src/runtime/app/server/remote/form.js +0 -51
- package/src/runtime/app/server/remote/query.js +0 -7
- package/src/runtime/app/server/remote/shared.js +4 -3
- package/src/runtime/app/state/client.js +1 -12
- package/src/runtime/client/client.js +1 -1
- package/src/runtime/client/constants.js +0 -1
- package/src/runtime/client/remote-functions/form.svelte.js +0 -31
- package/src/runtime/client/remote-functions/query/index.js +2 -2
- package/src/runtime/client/remote-functions/query/instance.svelte.js +1 -2
- package/src/runtime/client/remote-functions/query-batch.svelte.js +2 -2
- package/src/runtime/client/remote-functions/query-live/instance.svelte.js +5 -8
- package/src/runtime/client/utils.js +8 -10
- package/src/runtime/components/{svelte-5/layout.svelte → layout.svelte} +1 -1
- package/src/runtime/form-utils.js +4 -41
- package/src/runtime/server/cookie.js +21 -37
- package/src/runtime/server/env_module.js +1 -3
- package/src/runtime/server/fetch.js +6 -10
- package/src/runtime/server/index.js +3 -9
- package/src/runtime/server/page/render.js +32 -44
- package/src/runtime/server/page/types.d.ts +4 -2
- package/src/runtime/server/respond.js +2 -2
- package/src/runtime/server/utils.js +2 -4
- package/src/runtime/shared-server.js +0 -22
- package/src/runtime/shared.js +0 -15
- package/src/types/global-private.d.ts +5 -1
- package/src/types/internal.d.ts +3 -8
- package/src/utils/css.js +3 -19
- package/src/utils/filesystem.js +1 -30
- package/src/utils/http.js +0 -21
- package/src/utils/import.js +7 -6
- package/src/utils/os.js +7 -0
- package/src/utils/path.js +23 -0
- package/src/utils/shared-iterator.js +3 -0
- package/src/utils/streaming.js +2 -4
- package/src/utils/url.js +1 -1
- package/src/utils/vite.js +28 -0
- package/src/version.js +1 -1
- package/types/index.d.ts +45 -138
- package/types/index.d.ts.map +1 -8
- package/src/exports/vite/build/build_service_worker.js +0 -165
- package/src/runtime/app/environment/types.d.ts +0 -19
- package/src/runtime/components/svelte-4/error.svelte +0 -6
- package/src/runtime/components/svelte-4/layout.svelte +0 -1
- package/src/runtime/env/dynamic/private.js +0 -1
- package/src/runtime/env/dynamic/public.js +0 -1
- package/src/types/synthetic/$env+dynamic+private.md +0 -43
- package/src/types/synthetic/$env+dynamic+public.md +0 -46
- package/src/types/synthetic/$env+static+private.md +0 -31
- package/src/types/synthetic/$env+static+public.md +0 -31
- package/src/utils/env.js +0 -13
- package/src/utils/promise.js +0 -29
- /package/src/runtime/components/{svelte-5/error.svelte → error.svelte} +0 -0
package/types/index.d.ts
CHANGED
|
@@ -97,13 +97,12 @@ declare module '@sveltejs/kit' {
|
|
|
97
97
|
/** An array of all routes (including prerendered) */
|
|
98
98
|
routes: RouteDefinition[];
|
|
99
99
|
|
|
100
|
-
// TODO 3.0 remove this method
|
|
101
100
|
/**
|
|
102
101
|
* Create separate functions that map to one or more routes of your app.
|
|
103
102
|
* @param fn A function that groups a set of routes into an entry point
|
|
104
|
-
* @deprecated Use `builder.routes` instead
|
|
103
|
+
* @deprecated removed in 3.0. Use `builder.routes` instead
|
|
105
104
|
*/
|
|
106
|
-
createEntries
|
|
105
|
+
createEntries?: (fn: (route: RouteDefinition) => AdapterEntry) => Promise<void>;
|
|
107
106
|
|
|
108
107
|
/**
|
|
109
108
|
* Find all the assets imported by server files belonging to `routes`
|
|
@@ -116,7 +115,7 @@ declare module '@sveltejs/kit' {
|
|
|
116
115
|
generateFallback: (dest: string) => Promise<void>;
|
|
117
116
|
|
|
118
117
|
/**
|
|
119
|
-
* Generate a module exposing
|
|
118
|
+
* Generate a module exposing public environment variables as `$app/env/public` if the app uses it.
|
|
120
119
|
*/
|
|
121
120
|
generateEnvModule: () => void;
|
|
122
121
|
|
|
@@ -238,57 +237,50 @@ declare module '@sveltejs/kit' {
|
|
|
238
237
|
/**
|
|
239
238
|
* Gets a cookie that was previously set with `cookies.set`, or from the request headers.
|
|
240
239
|
* @param name the name of the cookie
|
|
241
|
-
* @param opts the options, passed directly to `cookie.parse`. See documentation [here](https://github.com/jshttp/cookie#
|
|
240
|
+
* @param opts the options, passed directly to `cookie.parse`. See documentation [here](https://github.com/jshttp/cookie?tab=readme-ov-file#cookieparsecookiestr-options)
|
|
242
241
|
*/
|
|
243
|
-
get: (name: string, opts?: import('cookie').
|
|
242
|
+
get: (name: string, opts?: import('cookie').ParseOptions) => string | undefined;
|
|
244
243
|
|
|
245
244
|
/**
|
|
246
245
|
* Gets all cookies that were previously set with `cookies.set`, or from the request headers.
|
|
247
|
-
* @param opts the options, passed directly to `cookie.parse`. See documentation [here](https://github.com/jshttp/cookie#
|
|
246
|
+
* @param opts the options, passed directly to `cookie.parse`. See documentation [here](https://github.com/jshttp/cookie?tab=readme-ov-file#cookieparsecookiestr-options)
|
|
248
247
|
*/
|
|
249
|
-
getAll: (opts?: import('cookie').
|
|
248
|
+
getAll: (opts?: import('cookie').ParseOptions) => Array<{ name: string; value: string }>;
|
|
250
249
|
|
|
251
250
|
/**
|
|
252
251
|
* 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.
|
|
253
252
|
*
|
|
254
|
-
* The `httpOnly` and `secure` options are `true` by default (except on http://localhost, where `secure` is `false`), and must be explicitly disabled if you want cookies to be readable by client-side JavaScript and/or transmitted over HTTP.
|
|
253
|
+
* The `httpOnly` and `secure` options are `true` by default (except on http://localhost, where `secure` is `false`), and must be explicitly disabled if you want cookies to be readable by client-side JavaScript and/or transmitted over HTTP.
|
|
255
254
|
*
|
|
256
|
-
*
|
|
255
|
+
* 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.
|
|
257
256
|
* @param name the name of the cookie
|
|
258
257
|
* @param value the cookie value
|
|
259
|
-
* @param opts the options
|
|
258
|
+
* @param opts the options passed to `cookie.serialize` with the SvelteKit defaults described above. See documentation [here](https://github.com/jshttp/cookie?tab=readme-ov-file#cookiestringifysetcookiesetcookieobj-options)
|
|
260
259
|
*/
|
|
261
|
-
set: (
|
|
262
|
-
name: string,
|
|
263
|
-
value: string,
|
|
264
|
-
opts: import('cookie').CookieSerializeOptions & { path: string }
|
|
265
|
-
) => void;
|
|
260
|
+
set: (name: string, value: string, opts: import('cookie').SerializeOptions) => void;
|
|
266
261
|
|
|
267
262
|
/**
|
|
268
263
|
* Deletes a cookie by setting its value to an empty string and setting the expiry date in the past.
|
|
269
264
|
*
|
|
270
|
-
*
|
|
265
|
+
* The `httpOnly` and `secure` options are `true` by default (except on http://localhost, where `secure` is `false`), and must be explicitly disabled if you want cookies to be readable by client-side JavaScript and/or transmitted over HTTP.
|
|
266
|
+
*
|
|
267
|
+
* 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.
|
|
271
268
|
* @param name the name of the cookie
|
|
272
|
-
* @param opts the options
|
|
269
|
+
* @param opts the options passed to `cookie.serialize` with the SvelteKit defaults described above. See documentation [here](https://github.com/jshttp/cookie?tab=readme-ov-file#cookiestringifysetcookiesetcookieobj-options)
|
|
273
270
|
*/
|
|
274
|
-
delete: (name: string, opts: import('cookie').
|
|
271
|
+
delete: (name: string, opts: import('cookie').SerializeOptions) => void;
|
|
275
272
|
|
|
276
273
|
/**
|
|
277
274
|
* Serialize a cookie name-value pair into a `Set-Cookie` header string, but don't apply it to the response.
|
|
278
275
|
*
|
|
279
|
-
* The `httpOnly` and `secure` options are `true` by default (except on http://localhost, where `secure` is `false`), and must be explicitly disabled if you want cookies to be readable by client-side JavaScript and/or transmitted over HTTP.
|
|
280
|
-
*
|
|
281
|
-
* You must specify a `path` for the cookie. In most cases you should explicitly set `path: '/'` to make the cookie available throughout your app. You can use relative paths, or set `path: ''` to make the cookie only available on the current path and its children
|
|
276
|
+
* The `httpOnly` and `secure` options are `true` by default (except on http://localhost, where `secure` is `false`), and must be explicitly disabled if you want cookies to be readable by client-side JavaScript and/or transmitted over HTTP.
|
|
282
277
|
*
|
|
278
|
+
* 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.
|
|
283
279
|
* @param name the name of the cookie
|
|
284
280
|
* @param value the cookie value
|
|
285
|
-
* @param opts the options
|
|
281
|
+
* @param opts the options passed to `cookie.serialize` with the SvelteKit defaults described above. See documentation [here](https://github.com/jshttp/cookie?tab=readme-ov-file#cookiestringifysetcookiesetcookieobj-options)
|
|
286
282
|
*/
|
|
287
|
-
serialize: (
|
|
288
|
-
name: string,
|
|
289
|
-
value: string,
|
|
290
|
-
opts: import('cookie').CookieSerializeOptions & { path: string }
|
|
291
|
-
) => string;
|
|
283
|
+
serialize: (name: string, value: string, opts: import('cookie').SerializeOptions) => string;
|
|
292
284
|
}
|
|
293
285
|
|
|
294
286
|
/**
|
|
@@ -303,9 +295,11 @@ declare module '@sveltejs/kit' {
|
|
|
303
295
|
}
|
|
304
296
|
|
|
305
297
|
export interface KitConfig {
|
|
298
|
+
// TODO: remove this in 4.0
|
|
306
299
|
/**
|
|
307
300
|
* Your [adapter](https://svelte.dev/docs/kit/adapters) is run when executing `vite build`. It determines how the output is converted for different platforms.
|
|
308
301
|
* @default undefined
|
|
302
|
+
* @deprecated removed in 3.0.0. Adapters should now be passed to the `sveltekit` Vite plugin in `vite.config.js`
|
|
309
303
|
*/
|
|
310
304
|
adapter?: Adapter;
|
|
311
305
|
/**
|
|
@@ -402,7 +396,7 @@ declare module '@sveltejs/kit' {
|
|
|
402
396
|
*
|
|
403
397
|
* To allow people to make `POST`, `PUT`, `PATCH`, or `DELETE` requests with a `Content-Type` of `application/x-www-form-urlencoded`, `multipart/form-data`, or `text/plain` to your app from other origins, you will need to disable this option. Be careful!
|
|
404
398
|
* @default true
|
|
405
|
-
* @deprecated Use `trustedOrigins: ['*']` instead
|
|
399
|
+
* @deprecated removed in 3.0. Use `trustedOrigins: ['*']` instead
|
|
406
400
|
*/
|
|
407
401
|
checkOrigin?: boolean;
|
|
408
402
|
/**
|
|
@@ -436,27 +430,9 @@ declare module '@sveltejs/kit' {
|
|
|
436
430
|
* @default "."
|
|
437
431
|
*/
|
|
438
432
|
dir?: string;
|
|
439
|
-
/**
|
|
440
|
-
* 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.
|
|
441
|
-
* @default "PUBLIC_"
|
|
442
|
-
*/
|
|
443
|
-
publicPrefix?: string;
|
|
444
|
-
/**
|
|
445
|
-
* 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).
|
|
446
|
-
* @default ""
|
|
447
|
-
* @since 1.21.0
|
|
448
|
-
*/
|
|
449
|
-
privatePrefix?: string;
|
|
450
433
|
};
|
|
451
434
|
/** Experimental features. Here be dragons. These are not subject to semantic versioning, so breaking changes or removal can happen in any release. */
|
|
452
435
|
experimental?: {
|
|
453
|
-
/**
|
|
454
|
-
* Whether to enable explicit environment variables using `src/env.js` or `src/env.ts`.
|
|
455
|
-
* @since 2.62.0
|
|
456
|
-
* @default false
|
|
457
|
-
*/
|
|
458
|
-
explicitEnvironmentVariables?: boolean;
|
|
459
|
-
|
|
460
436
|
/**
|
|
461
437
|
* Options for enabling server-side [OpenTelemetry](https://opentelemetry.io/) tracing for SvelteKit operations including the [`handle` hook](https://svelte.dev/docs/kit/hooks#Server-hooks-handle), [`load` functions](https://svelte.dev/docs/kit/load), [form actions](https://svelte.dev/docs/kit/form-actions), and [remote functions](https://svelte.dev/docs/kit/remote-functions).
|
|
462
438
|
* @default { server: false, serverFile: false }
|
|
@@ -601,6 +577,16 @@ declare module '@sveltejs/kit' {
|
|
|
601
577
|
* Options related to the build output format
|
|
602
578
|
*/
|
|
603
579
|
output?: {
|
|
580
|
+
/**
|
|
581
|
+
* Whether to use the [HTTP `Link` header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Link) to preload assets instead of the [`<link>` HTML element](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/link) for non-prerendered pages.
|
|
582
|
+
*
|
|
583
|
+
* Note that some web servers such as Nginx and Apache have a default header size limit which may be easily exceeded.
|
|
584
|
+
* If you are using one of these web servers, you may want to leave this as `false` or configure a higher limit.
|
|
585
|
+
*
|
|
586
|
+
* @default false
|
|
587
|
+
* @since 3.0.0
|
|
588
|
+
*/
|
|
589
|
+
linkHeaderPreload?: boolean;
|
|
604
590
|
/**
|
|
605
591
|
* SvelteKit will preload the JavaScript modules needed for the initial page to avoid import 'waterfalls', resulting in faster application startup. There
|
|
606
592
|
* are three strategies with different trade-offs:
|
|
@@ -609,6 +595,7 @@ declare module '@sveltejs/kit' {
|
|
|
609
595
|
* - `preload-mjs` - uses `<link rel="preload">` but with the `.mjs` extension which prevents double-parsing in Chromium. Some static webservers will fail to serve .mjs files with a `Content-Type: application/javascript` header, which will cause your application to break. If that doesn't apply to you, this is the option that will deliver the best performance for the largest number of users, until `modulepreload` is more widely supported.
|
|
610
596
|
* @default "modulepreload"
|
|
611
597
|
* @since 1.8.4
|
|
598
|
+
* @deprecated removed in 3.0
|
|
612
599
|
*/
|
|
613
600
|
preloadStrategy?: 'modulepreload' | 'preload-js' | 'preload-mjs';
|
|
614
601
|
/**
|
|
@@ -617,7 +604,7 @@ declare module '@sveltejs/kit' {
|
|
|
617
604
|
* - If `'single'`, creates just one .js bundle and one .css file containing code for the entire app.
|
|
618
605
|
* - If `'inline'`, inlines all JavaScript and CSS of the entire app into the HTML. The result is usable without a server (i.e. you can just open the file in your browser).
|
|
619
606
|
*
|
|
620
|
-
* When using `'split'`, you can also adjust the bundling behaviour by setting [`output.
|
|
607
|
+
* When using `'split'`, you can also adjust the bundling behaviour by setting [`output.codeSplitting`](https://rolldown.rs/reference/OutputOptions.codeSplitting) inside your Vite config's [`build.rolldownOptions`](https://vite.dev/config/build-options#build-rolldownoptions).
|
|
621
608
|
*
|
|
622
609
|
* If you want to inline your assets, you'll need to set Vite's [`build.assetsInlineLimit`](https://vite.dev/config/build-options.html#build-assetsinlinelimit) option to an appropriate size then import your assets through Vite.
|
|
623
610
|
*
|
|
@@ -1262,13 +1249,6 @@ declare module '@sveltejs/kit' {
|
|
|
1262
1249
|
* - `goto`: Navigation was triggered by a `goto(...)` call or a redirect
|
|
1263
1250
|
*/
|
|
1264
1251
|
type: 'goto';
|
|
1265
|
-
|
|
1266
|
-
// TODO 3.0 remove this property, so that it only exists when type is 'popstate'
|
|
1267
|
-
// (would possibly be a breaking change to do it prior to that)
|
|
1268
|
-
/**
|
|
1269
|
-
* In case of a history back/forward navigation, the number of steps to go back/forward
|
|
1270
|
-
*/
|
|
1271
|
-
delta?: undefined;
|
|
1272
1252
|
}
|
|
1273
1253
|
|
|
1274
1254
|
export interface NavigationLeave extends NavigationBase {
|
|
@@ -1277,13 +1257,6 @@ declare module '@sveltejs/kit' {
|
|
|
1277
1257
|
* - `leave`: The app is being left either because the tab is being closed or a navigation to a different document is occurring
|
|
1278
1258
|
*/
|
|
1279
1259
|
type: 'leave';
|
|
1280
|
-
|
|
1281
|
-
// TODO 3.0 remove this property, so that it only exists when type is 'popstate'
|
|
1282
|
-
// (would possibly be a breaking change to do it prior to that)
|
|
1283
|
-
/**
|
|
1284
|
-
* In case of a history back/forward navigation, the number of steps to go back/forward
|
|
1285
|
-
*/
|
|
1286
|
-
delta?: undefined;
|
|
1287
1260
|
}
|
|
1288
1261
|
|
|
1289
1262
|
export interface NavigationFormSubmit extends NavigationBase {
|
|
@@ -1297,13 +1270,6 @@ declare module '@sveltejs/kit' {
|
|
|
1297
1270
|
* The `SubmitEvent` that caused the navigation
|
|
1298
1271
|
*/
|
|
1299
1272
|
event: SubmitEvent;
|
|
1300
|
-
|
|
1301
|
-
// TODO 3.0 remove this property, so that it only exists when type is 'popstate'
|
|
1302
|
-
// (would possibly be a breaking change to do it prior to that)
|
|
1303
|
-
/**
|
|
1304
|
-
* In case of a history back/forward navigation, the number of steps to go back/forward
|
|
1305
|
-
*/
|
|
1306
|
-
delta?: undefined;
|
|
1307
1273
|
}
|
|
1308
1274
|
|
|
1309
1275
|
export interface NavigationPopState extends NavigationBase {
|
|
@@ -1335,13 +1301,6 @@ declare module '@sveltejs/kit' {
|
|
|
1335
1301
|
* The `PointerEvent` that caused the navigation
|
|
1336
1302
|
*/
|
|
1337
1303
|
event: PointerEvent;
|
|
1338
|
-
|
|
1339
|
-
// TODO 3.0 remove this property, so that it only exists when type is 'popstate'
|
|
1340
|
-
// (would possibly be a breaking change to do it prior to that)
|
|
1341
|
-
/**
|
|
1342
|
-
* In case of a history back/forward navigation, the number of steps to go back/forward
|
|
1343
|
-
*/
|
|
1344
|
-
delta?: undefined;
|
|
1345
1304
|
}
|
|
1346
1305
|
|
|
1347
1306
|
export type Navigation =
|
|
@@ -2811,9 +2770,8 @@ declare module '@sveltejs/kit' {
|
|
|
2811
2770
|
extensions: string[];
|
|
2812
2771
|
};
|
|
2813
2772
|
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
};
|
|
2773
|
+
// TODO: remove the omit in 4.0
|
|
2774
|
+
type ValidatedKitConfig = Omit<RecursiveRequired<KitConfig>, 'adapter'>;
|
|
2817
2775
|
/**
|
|
2818
2776
|
* Throws an error with a HTTP status code and an optional message.
|
|
2819
2777
|
* When called during request handling, this will cause SvelteKit to
|
|
@@ -2821,7 +2779,7 @@ declare module '@sveltejs/kit' {
|
|
|
2821
2779
|
* Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it.
|
|
2822
2780
|
* @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.
|
|
2823
2781
|
* @param body An object that conforms to the App.Error type. If a string is passed, it will be used as the message property.
|
|
2824
|
-
* @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling.
|
|
2782
|
+
* @throws {import('./public.js').HttpError} This error instructs SvelteKit to initiate HTTP error handling.
|
|
2825
2783
|
* @throws {Error} If the provided status is invalid (not between 400 and 599).
|
|
2826
2784
|
*/
|
|
2827
2785
|
export function error(status: number, body: App.Error): never;
|
|
@@ -2832,7 +2790,7 @@ declare module '@sveltejs/kit' {
|
|
|
2832
2790
|
* Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it.
|
|
2833
2791
|
* @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.
|
|
2834
2792
|
* @param body An object that conforms to the App.Error type. If a string is passed, it will be used as the message property.
|
|
2835
|
-
* @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling.
|
|
2793
|
+
* @throws {import('./public.js').HttpError} This error instructs SvelteKit to initiate HTTP error handling.
|
|
2836
2794
|
* @throws {Error} If the provided status is invalid (not between 400 and 599).
|
|
2837
2795
|
*/
|
|
2838
2796
|
export function error(status: number, body?: {
|
|
@@ -2842,7 +2800,7 @@ declare module '@sveltejs/kit' {
|
|
|
2842
2800
|
* Checks whether this is an error thrown by {@link error}.
|
|
2843
2801
|
* @param status The status to filter for.
|
|
2844
2802
|
* */
|
|
2845
|
-
export function isHttpError<T extends number>(e: unknown, status?: T): e is (
|
|
2803
|
+
export function isHttpError<T extends number>(e: unknown, status?: T): e is (HttpError & {
|
|
2846
2804
|
status: T extends undefined ? never : T;
|
|
2847
2805
|
});
|
|
2848
2806
|
/**
|
|
@@ -2858,7 +2816,7 @@ declare module '@sveltejs/kit' {
|
|
|
2858
2816
|
*
|
|
2859
2817
|
* @param status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#redirection_messages). Must be in the range 300-308.
|
|
2860
2818
|
* @param location The location to redirect to.
|
|
2861
|
-
* @throws {Redirect} This error instructs SvelteKit to redirect to the specified location.
|
|
2819
|
+
* @throws {import('./public.js').Redirect} This error instructs SvelteKit to redirect to the specified location.
|
|
2862
2820
|
* @throws {Error} If the provided status is invalid or the location cannot be used as a header value.
|
|
2863
2821
|
* */
|
|
2864
2822
|
export function redirect(status: 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | ({} & number), location: string | URL): never;
|
|
@@ -2866,17 +2824,19 @@ declare module '@sveltejs/kit' {
|
|
|
2866
2824
|
* Checks whether this is a redirect thrown by {@link redirect}.
|
|
2867
2825
|
* @param e The object to check.
|
|
2868
2826
|
* */
|
|
2869
|
-
export function isRedirect(e: unknown): e is
|
|
2827
|
+
export function isRedirect(e: unknown): e is Redirect;
|
|
2870
2828
|
/**
|
|
2871
2829
|
* Create a JSON `Response` object from the supplied data.
|
|
2872
2830
|
* @param data The value that will be serialized as JSON.
|
|
2873
2831
|
* @param init Options such as `status` and `headers` that will be added to the response. `Content-Type: application/json` and `Content-Length` headers will be added automatically.
|
|
2832
|
+
* @deprecated use `Response.json`
|
|
2874
2833
|
*/
|
|
2875
2834
|
export function json(data: any, init?: ResponseInit): Response;
|
|
2876
2835
|
/**
|
|
2877
2836
|
* Create a `Response` object from the supplied body.
|
|
2878
2837
|
* @param body The value that will be used as-is.
|
|
2879
2838
|
* @param init Options such as `status` and `headers` that will be added to the response. A `Content-Length` header will be added automatically.
|
|
2839
|
+
* @deprecated use `new Response`
|
|
2880
2840
|
*/
|
|
2881
2841
|
export function text(body: string, init?: ResponseInit): Response;
|
|
2882
2842
|
/**
|
|
@@ -2945,27 +2905,10 @@ declare module '@sveltejs/kit' {
|
|
|
2945
2905
|
wasNormalized: boolean;
|
|
2946
2906
|
denormalize: (url?: string | URL) => URL;
|
|
2947
2907
|
};
|
|
2948
|
-
export type LessThan<TNumber extends number, TArray extends any[] = []> = TNumber extends TArray["length"] ? TArray[number] : LessThan<TNumber, [...TArray, TArray["length"]]>;
|
|
2949
|
-
export type NumericRange<TStart extends number, TEnd extends number> = Exclude<TEnd | LessThan<TEnd>, LessThan<TStart>>;
|
|
2950
2908
|
type ValidPageOption = (typeof valid_page_options_array)[number];
|
|
2951
2909
|
type PageOptions = Partial<Record<ValidPageOption, any>>;
|
|
2952
2910
|
const valid_page_options_array: readonly ["ssr", "prerender", "csr", "trailingSlash", "config", "entries", "load"];
|
|
2953
2911
|
export const VERSION: string;
|
|
2954
|
-
class HttpError_1 {
|
|
2955
|
-
|
|
2956
|
-
constructor(status: number, body: {
|
|
2957
|
-
message: string;
|
|
2958
|
-
} extends App.Error ? (App.Error | string | undefined) : App.Error);
|
|
2959
|
-
status: number;
|
|
2960
|
-
body: App.Error;
|
|
2961
|
-
toString(): string;
|
|
2962
|
-
}
|
|
2963
|
-
class Redirect_1 {
|
|
2964
|
-
|
|
2965
|
-
constructor(status: 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308, location: string);
|
|
2966
|
-
status: 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308;
|
|
2967
|
-
location: string;
|
|
2968
|
-
}
|
|
2969
2912
|
|
|
2970
2913
|
export {};
|
|
2971
2914
|
}
|
|
@@ -3069,26 +3012,14 @@ declare module '@sveltejs/kit/node' {
|
|
|
3069
3012
|
export {};
|
|
3070
3013
|
}
|
|
3071
3014
|
|
|
3072
|
-
declare module '@sveltejs/kit/node/polyfills' {
|
|
3073
|
-
/**
|
|
3074
|
-
* Make various web APIs available as globals:
|
|
3075
|
-
* - `crypto`
|
|
3076
|
-
* - `File`
|
|
3077
|
-
*/
|
|
3078
|
-
export function installPolyfills(): void;
|
|
3079
|
-
|
|
3080
|
-
export {};
|
|
3081
|
-
}
|
|
3082
|
-
|
|
3083
3015
|
declare module '@sveltejs/kit/vite' {
|
|
3084
|
-
import type { KitConfig } from '@sveltejs/kit';
|
|
3085
3016
|
import type { SvelteConfig } from '@sveltejs/vite-plugin-svelte';
|
|
3086
3017
|
import type { Plugin } from 'vite';
|
|
3087
3018
|
/**
|
|
3088
3019
|
* Returns the SvelteKit Vite plugins.
|
|
3089
3020
|
* Since version 2.62.0 you can pass [configuration](configuration) directly, in which case `svelte.config.js` is ignored.
|
|
3090
3021
|
* */
|
|
3091
|
-
export function sveltekit(config?: KitConfig & Omit<SvelteConfig, "onwarn">): Promise<Plugin[]>;
|
|
3022
|
+
export function sveltekit(config?: import("@sveltejs/kit").KitConfig & Omit<SvelteConfig, "onwarn">): Promise<Plugin[]>;
|
|
3092
3023
|
|
|
3093
3024
|
export {};
|
|
3094
3025
|
}
|
|
@@ -3117,30 +3048,6 @@ declare module '$app/env' {
|
|
|
3117
3048
|
export {};
|
|
3118
3049
|
}
|
|
3119
3050
|
|
|
3120
|
-
declare module '$app/environment' {
|
|
3121
|
-
/**
|
|
3122
|
-
* `true` if the app is running in the browser.
|
|
3123
|
-
*/
|
|
3124
|
-
export const browser: boolean;
|
|
3125
|
-
|
|
3126
|
-
/**
|
|
3127
|
-
* Whether the dev server is running. This is not guaranteed to correspond to `NODE_ENV` or `MODE`.
|
|
3128
|
-
*/
|
|
3129
|
-
export const dev: boolean;
|
|
3130
|
-
|
|
3131
|
-
/**
|
|
3132
|
-
* SvelteKit analyses your app during the `build` step by running it. During this process, `building` is `true`. This also applies during prerendering.
|
|
3133
|
-
*/
|
|
3134
|
-
export const building: boolean;
|
|
3135
|
-
|
|
3136
|
-
/**
|
|
3137
|
-
* The value of `config.kit.version.name`.
|
|
3138
|
-
*/
|
|
3139
|
-
export const version: string;
|
|
3140
|
-
|
|
3141
|
-
export {};
|
|
3142
|
-
}
|
|
3143
|
-
|
|
3144
3051
|
declare module '$app/forms' {
|
|
3145
3052
|
/**
|
|
3146
3053
|
* Use this function to deserialize the response from a form submission.
|
package/types/index.d.ts.map
CHANGED
|
@@ -156,7 +156,6 @@
|
|
|
156
156
|
"getRequest",
|
|
157
157
|
"setResponse",
|
|
158
158
|
"createReadableStream",
|
|
159
|
-
"installPolyfills",
|
|
160
159
|
"sveltekit",
|
|
161
160
|
"browser",
|
|
162
161
|
"dev",
|
|
@@ -196,7 +195,6 @@
|
|
|
196
195
|
],
|
|
197
196
|
"sources": [
|
|
198
197
|
"../src/exports/public.d.ts",
|
|
199
|
-
"../src/exports/internal/index.js",
|
|
200
198
|
"../src/types/private.d.ts",
|
|
201
199
|
"../src/types/internal.d.ts",
|
|
202
200
|
"../src/exports/index.js",
|
|
@@ -205,10 +203,8 @@
|
|
|
205
203
|
"../src/exports/hooks/index.js",
|
|
206
204
|
"../src/exports/hooks/sequence.js",
|
|
207
205
|
"../src/exports/node/index.js",
|
|
208
|
-
"../src/exports/node/polyfills.js",
|
|
209
206
|
"../src/exports/vite/index.js",
|
|
210
207
|
"../src/runtime/app/env/types.d.ts",
|
|
211
|
-
"../src/runtime/app/environment/types.d.ts",
|
|
212
208
|
"../src/runtime/app/forms.js",
|
|
213
209
|
"../src/runtime/client/client.js",
|
|
214
210
|
"../src/runtime/app/paths/public.d.ts",
|
|
@@ -239,11 +235,8 @@
|
|
|
239
235
|
null,
|
|
240
236
|
null,
|
|
241
237
|
null,
|
|
242
|
-
null,
|
|
243
|
-
null,
|
|
244
|
-
null,
|
|
245
238
|
null
|
|
246
239
|
],
|
|
247
|
-
"mappings": ";;;;;;;;MAiCKA,IAAIA;;;;;kBAKQC,OAAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAiCZC,cAAcA;;;;;;aAMdC,cAAcA;;;;;;;;MAQrBC,aAAaA;;;;;OAKJC,YAAYA;;kBAETC,aAAaA;;;;;;MAMzBC,qBAAqBA;;;;;;;;;;;kBAWTC,OAAOA
|
|
240
|
+
"mappings": ";;;;;;;;MAiCKA,IAAIA;;;;;kBAKQC,OAAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAiCZC,cAAcA;;;;;;aAMdC,cAAcA;;;;;;;;MAQrBC,aAAaA;;;;;OAKJC,YAAYA;;kBAETC,aAAaA;;;;;;MAMzBC,qBAAqBA;;;;;;;;;;;kBAWTC,OAAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA6IPC,MAAMA;;;;;;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BvBC,iBAAiBA;;;;;;MAMVC,WAAWA;;;;;;;;;;;;;;;;;;;;;;;;;;iBCWPC,KAAKA;;;;;;;;;;;;;;;;;;;;;iBA6BLC,OAAOA;;;;;;;;;;;;;;;;;;;iBAmCDC,KAAKA;;;;;;;;;;;;;;;;;;;;;;;iBCtEXC,IAAIA;;;;;;;;iBCUJC,eAAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MfyTnBC,qCAAqCA;;;;;;;;MA2LrCC,8BAA8BA;MDrX9BrF,YAAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ciB1GXsF,IAAIA;;;;;cAQJC,UAAUA;;;;;;;;;;;cAMVC,OAAOA;;;;;;;;;iBCrDPC,SAASA;;;;;;;;;;;;;;;cAyBTH,IAAIA;;;;;;;;;;cAiBJC,UAAUA;;;;;;;;cAeVC,OAAOA",
|
|
248
241
|
"ignoreList": []
|
|
249
242
|
}
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
/** @import { EnvVarConfig } from '@sveltejs/kit' */
|
|
2
|
-
import fs from 'node:fs';
|
|
3
|
-
import process from 'node:process';
|
|
4
|
-
import * as vite from 'vite';
|
|
5
|
-
import { dedent } from '../../../core/sync/utils.js';
|
|
6
|
-
import { s } from '../../../utils/misc.js';
|
|
7
|
-
import { get_config_aliases, strip_virtual_prefix, get_env, normalize_id } from '../utils.js';
|
|
8
|
-
import { create_static_module, create_sveltekit_env_public } from '../../../core/env.js';
|
|
9
|
-
import { env_static_public, service_worker } from '../module_ids.js';
|
|
10
|
-
|
|
11
|
-
// @ts-ignore `vite.rolldownVersion` only exists in `rolldown-vite`
|
|
12
|
-
const is_rolldown = !!vite.rolldownVersion;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @param {string} out
|
|
16
|
-
* @param {import('types').ValidatedKitConfig} kit
|
|
17
|
-
* @param {import('vite').ResolvedConfig} vite_config
|
|
18
|
-
* @param {import('types').ManifestData} manifest_data
|
|
19
|
-
* @param {string} service_worker_entry_file
|
|
20
|
-
* @param {import('types').Prerendered} prerendered
|
|
21
|
-
* @param {import('vite').Manifest} client_manifest
|
|
22
|
-
* @param {Record<string, EnvVarConfig<any>> | null} env_config
|
|
23
|
-
*/
|
|
24
|
-
export async function build_service_worker(
|
|
25
|
-
out,
|
|
26
|
-
kit,
|
|
27
|
-
vite_config,
|
|
28
|
-
manifest_data,
|
|
29
|
-
service_worker_entry_file,
|
|
30
|
-
prerendered,
|
|
31
|
-
client_manifest,
|
|
32
|
-
env_config
|
|
33
|
-
) {
|
|
34
|
-
const build = new Set();
|
|
35
|
-
for (const key in client_manifest) {
|
|
36
|
-
const { file, css = [], assets = [] } = client_manifest[key];
|
|
37
|
-
build.add(file);
|
|
38
|
-
css.forEach((file) => build.add(file));
|
|
39
|
-
assets.forEach((file) => build.add(file));
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// in a service worker, `location` is the location of the service worker itself,
|
|
43
|
-
// which is guaranteed to be `<base>/service-worker.js`
|
|
44
|
-
const base = "location.pathname.split('/').slice(0, -1).join('/')";
|
|
45
|
-
|
|
46
|
-
const service_worker_code = dedent`
|
|
47
|
-
export const base = /*@__PURE__*/ ${base};
|
|
48
|
-
|
|
49
|
-
export const build = [
|
|
50
|
-
${Array.from(build)
|
|
51
|
-
.map((file) => `base + ${s(`/${file}`)}`)
|
|
52
|
-
.join(',\n')}
|
|
53
|
-
];
|
|
54
|
-
|
|
55
|
-
export const files = [
|
|
56
|
-
${manifest_data.assets
|
|
57
|
-
.filter((asset) => kit.serviceWorker.files(asset.file))
|
|
58
|
-
.map((asset) => `base + ${s(`/${asset.file}`)}`)
|
|
59
|
-
.join(',\n')}
|
|
60
|
-
];
|
|
61
|
-
|
|
62
|
-
export const prerendered = [
|
|
63
|
-
${prerendered.paths.map((path) => `base + ${s(path.replace(kit.paths.base, ''))}`).join(',\n')}
|
|
64
|
-
];
|
|
65
|
-
|
|
66
|
-
export const version = ${s(kit.version.name)};
|
|
67
|
-
`;
|
|
68
|
-
|
|
69
|
-
const env = get_env(kit.env, vite_config.mode);
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* @type {import('vite').Plugin}
|
|
73
|
-
*/
|
|
74
|
-
const sw_virtual_modules = {
|
|
75
|
-
name: 'service-worker-build-virtual-modules',
|
|
76
|
-
resolveId(id) {
|
|
77
|
-
if (id.startsWith('$env/') || id.startsWith('$app/') || id === '$service-worker') {
|
|
78
|
-
// ids with :$ don't work with reverse proxies like nginx
|
|
79
|
-
return `\0virtual:${id.substring(1)}`;
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
load(id) {
|
|
84
|
-
if (!id.startsWith('\0virtual:')) return;
|
|
85
|
-
|
|
86
|
-
if (id === service_worker) {
|
|
87
|
-
return service_worker_code;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (id === env_static_public) {
|
|
91
|
-
return create_static_module(
|
|
92
|
-
'$env/static/public',
|
|
93
|
-
env.public,
|
|
94
|
-
kit.experimental.explicitEnvironmentVariables
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (id === '\0virtual:app/env/public') {
|
|
99
|
-
// TODO ideally we would only add the `importScripts` if there are dynamic vars that are known to be used
|
|
100
|
-
return create_sveltekit_env_public(
|
|
101
|
-
env_config,
|
|
102
|
-
env.all,
|
|
103
|
-
`importScripts('${kit.paths.base}/${kit.appDir}/env.script.js'); const env = globalThis.__sveltekit_sw.env;`
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const normalized_cwd = vite.normalizePath(process.cwd());
|
|
108
|
-
const normalized_lib = vite.normalizePath(kit.files.lib);
|
|
109
|
-
const relative = normalize_id(id, normalized_lib, normalized_cwd);
|
|
110
|
-
const stripped = strip_virtual_prefix(relative);
|
|
111
|
-
throw new Error(
|
|
112
|
-
`Cannot import ${stripped} into service-worker code. Only the modules $service-worker, $env/static/public and $app/env/public are available in service workers.`
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
/** @type {import('vite').InlineConfig} */
|
|
118
|
-
const config = {
|
|
119
|
-
build: {
|
|
120
|
-
modulePreload: false,
|
|
121
|
-
rollupOptions: {
|
|
122
|
-
input: {
|
|
123
|
-
'service-worker': service_worker_entry_file
|
|
124
|
-
},
|
|
125
|
-
output: {
|
|
126
|
-
// .mjs so that esbuild doesn't incorrectly inject `export` https://github.com/vitejs/vite/issues/15379
|
|
127
|
-
entryFileNames: `service-worker.${is_rolldown ? 'js' : 'mjs'}`,
|
|
128
|
-
assetFileNames: `${kit.appDir}/immutable/assets/[name].[hash][extname]`,
|
|
129
|
-
inlineDynamicImports: !is_rolldown ? true : undefined
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
outDir: `${out}/client`,
|
|
133
|
-
emptyOutDir: false,
|
|
134
|
-
minify: vite_config.build.minify
|
|
135
|
-
},
|
|
136
|
-
configFile: false,
|
|
137
|
-
define: vite_config.define,
|
|
138
|
-
publicDir: false,
|
|
139
|
-
plugins: [sw_virtual_modules],
|
|
140
|
-
resolve: {
|
|
141
|
-
alias: [...get_config_aliases(kit)]
|
|
142
|
-
},
|
|
143
|
-
experimental: {
|
|
144
|
-
renderBuiltUrl(filename) {
|
|
145
|
-
return {
|
|
146
|
-
runtime: `new URL(${JSON.stringify(filename)}, location.href).pathname`
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
// we must reference Vite 8 options conditionally. Otherwise, older Vite
|
|
153
|
-
// versions throw an error about unknown config options
|
|
154
|
-
if (is_rolldown && config?.build?.rollupOptions?.output) {
|
|
155
|
-
// @ts-ignore only available in Vite 8
|
|
156
|
-
config.build.rollupOptions.output.codeSplitting = true;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
await vite.build(config);
|
|
160
|
-
|
|
161
|
-
// rename .mjs to .js to avoid incorrect MIME types with ancient webservers
|
|
162
|
-
if (!is_rolldown) {
|
|
163
|
-
fs.renameSync(`${out}/client/service-worker.mjs`, `${out}/client/service-worker.js`);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `true` if the app is running in the browser.
|
|
3
|
-
*/
|
|
4
|
-
export const browser: boolean;
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Whether the dev server is running. This is not guaranteed to correspond to `NODE_ENV` or `MODE`.
|
|
8
|
-
*/
|
|
9
|
-
export const dev: boolean;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* SvelteKit analyses your app during the `build` step by running it. During this process, `building` is `true`. This also applies during prerendering.
|
|
13
|
-
*/
|
|
14
|
-
export const building: boolean;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* The value of `config.kit.version.name`.
|
|
18
|
-
*/
|
|
19
|
-
export const version: string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<slot />
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { private_env as env } from '../../shared-server.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { public_env as env } from '../../shared-server.js';
|