@sveltejs/kit 2.62.0 → 3.0.0-next.0
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 +28 -22
- package/src/cli.js +49 -20
- package/src/core/adapt/builder.js +38 -69
- package/src/core/adapt/index.js +11 -6
- package/src/core/config/index.js +12 -82
- package/src/core/config/options.js +36 -45
- package/src/core/env.js +240 -60
- 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 +20 -16
- package/src/core/postbuild/fallback.js +0 -3
- package/src/core/postbuild/prerender.js +19 -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 +44 -23
- package/src/core/sync/utils.js +0 -15
- package/src/core/sync/write_ambient.js +5 -50
- package/src/core/sync/write_client_manifest.js +8 -9
- package/src/core/sync/write_env.js +36 -0
- package/src/core/sync/write_non_ambient.js +7 -7
- package/src/core/sync/write_root.js +41 -89
- package/src/core/sync/write_server.js +18 -24
- package/src/core/sync/write_tsconfig.js +29 -24
- package/src/core/sync/write_types/index.js +31 -25
- package/src/core/utils.js +14 -11
- package/src/exports/hooks/index.js +13 -0
- package/src/exports/index.js +8 -21
- package/src/exports/internal/env.js +71 -0
- package/src/exports/internal/types.d.ts +3 -0
- package/src/exports/node/index.js +8 -13
- package/src/exports/public.d.ts +68 -69
- 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 +32 -33
- package/src/exports/vite/index.js +1015 -711
- package/src/exports/vite/module_ids.js +10 -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 +11 -41
- package/src/runtime/app/env/index.js +2 -0
- package/src/runtime/app/env/internal.js +14 -0
- package/src/runtime/app/env/private.js +1 -0
- package/src/runtime/app/env/public/client.js +1 -0
- package/src/runtime/app/env/public/index.js +1 -0
- package/src/runtime/app/env/public/server.js +1 -0
- package/src/runtime/app/env/standard-schema.d.ts +0 -0
- 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 +1 -8
- 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/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 +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 +9 -11
- 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 +12 -4
- package/src/runtime/server/fetch.js +6 -10
- package/src/runtime/server/index.js +5 -9
- package/src/runtime/server/page/render.js +33 -37
- package/src/runtime/server/page/types.d.ts +4 -2
- package/src/runtime/server/respond.js +3 -3
- 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/ambient-private.d.ts +25 -9
- package/src/types/global-private.d.ts +6 -0
- package/src/types/internal.d.ts +4 -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 +8 -7
- 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 +85 -109
- package/types/index.d.ts.map +5 -6
- package/src/exports/vite/build/build_service_worker.js +0 -149
- package/src/runtime/app/environment/index.js +0 -2
- 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/app/{environment → env}/types.d.ts +0 -0
- /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,17 +430,6 @@ 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?: {
|
|
@@ -594,6 +577,16 @@ declare module '@sveltejs/kit' {
|
|
|
594
577
|
* Options related to the build output format
|
|
595
578
|
*/
|
|
596
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;
|
|
597
590
|
/**
|
|
598
591
|
* SvelteKit will preload the JavaScript modules needed for the initial page to avoid import 'waterfalls', resulting in faster application startup. There
|
|
599
592
|
* are three strategies with different trade-offs:
|
|
@@ -602,6 +595,7 @@ declare module '@sveltejs/kit' {
|
|
|
602
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.
|
|
603
596
|
* @default "modulepreload"
|
|
604
597
|
* @since 1.8.4
|
|
598
|
+
* @deprecated removed in 3.0
|
|
605
599
|
*/
|
|
606
600
|
preloadStrategy?: 'modulepreload' | 'preload-js' | 'preload-mjs';
|
|
607
601
|
/**
|
|
@@ -610,7 +604,7 @@ declare module '@sveltejs/kit' {
|
|
|
610
604
|
* - If `'single'`, creates just one .js bundle and one .css file containing code for the entire app.
|
|
611
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).
|
|
612
606
|
*
|
|
613
|
-
* 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).
|
|
614
608
|
*
|
|
615
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.
|
|
616
610
|
*
|
|
@@ -1255,13 +1249,6 @@ declare module '@sveltejs/kit' {
|
|
|
1255
1249
|
* - `goto`: Navigation was triggered by a `goto(...)` call or a redirect
|
|
1256
1250
|
*/
|
|
1257
1251
|
type: 'goto';
|
|
1258
|
-
|
|
1259
|
-
// TODO 3.0 remove this property, so that it only exists when type is 'popstate'
|
|
1260
|
-
// (would possibly be a breaking change to do it prior to that)
|
|
1261
|
-
/**
|
|
1262
|
-
* In case of a history back/forward navigation, the number of steps to go back/forward
|
|
1263
|
-
*/
|
|
1264
|
-
delta?: undefined;
|
|
1265
1252
|
}
|
|
1266
1253
|
|
|
1267
1254
|
export interface NavigationLeave extends NavigationBase {
|
|
@@ -1270,13 +1257,6 @@ declare module '@sveltejs/kit' {
|
|
|
1270
1257
|
* - `leave`: The app is being left either because the tab is being closed or a navigation to a different document is occurring
|
|
1271
1258
|
*/
|
|
1272
1259
|
type: 'leave';
|
|
1273
|
-
|
|
1274
|
-
// TODO 3.0 remove this property, so that it only exists when type is 'popstate'
|
|
1275
|
-
// (would possibly be a breaking change to do it prior to that)
|
|
1276
|
-
/**
|
|
1277
|
-
* In case of a history back/forward navigation, the number of steps to go back/forward
|
|
1278
|
-
*/
|
|
1279
|
-
delta?: undefined;
|
|
1280
1260
|
}
|
|
1281
1261
|
|
|
1282
1262
|
export interface NavigationFormSubmit extends NavigationBase {
|
|
@@ -1290,13 +1270,6 @@ declare module '@sveltejs/kit' {
|
|
|
1290
1270
|
* The `SubmitEvent` that caused the navigation
|
|
1291
1271
|
*/
|
|
1292
1272
|
event: SubmitEvent;
|
|
1293
|
-
|
|
1294
|
-
// TODO 3.0 remove this property, so that it only exists when type is 'popstate'
|
|
1295
|
-
// (would possibly be a breaking change to do it prior to that)
|
|
1296
|
-
/**
|
|
1297
|
-
* In case of a history back/forward navigation, the number of steps to go back/forward
|
|
1298
|
-
*/
|
|
1299
|
-
delta?: undefined;
|
|
1300
1273
|
}
|
|
1301
1274
|
|
|
1302
1275
|
export interface NavigationPopState extends NavigationBase {
|
|
@@ -1328,13 +1301,6 @@ declare module '@sveltejs/kit' {
|
|
|
1328
1301
|
* The `PointerEvent` that caused the navigation
|
|
1329
1302
|
*/
|
|
1330
1303
|
event: PointerEvent;
|
|
1331
|
-
|
|
1332
|
-
// TODO 3.0 remove this property, so that it only exists when type is 'popstate'
|
|
1333
|
-
// (would possibly be a breaking change to do it prior to that)
|
|
1334
|
-
/**
|
|
1335
|
-
* In case of a history back/forward navigation, the number of steps to go back/forward
|
|
1336
|
-
*/
|
|
1337
|
-
delta?: undefined;
|
|
1338
1304
|
}
|
|
1339
1305
|
|
|
1340
1306
|
export type Navigation =
|
|
@@ -2287,6 +2253,39 @@ declare module '@sveltejs/kit' {
|
|
|
2287
2253
|
export type RemoteLiveQueryFunction<Input, Output, _Validated = Input> = (
|
|
2288
2254
|
arg: undefined extends Input ? Input | void : Input
|
|
2289
2255
|
) => RemoteLiveQuery<Output>;
|
|
2256
|
+
|
|
2257
|
+
/**
|
|
2258
|
+
* [Environment variables](https://svelte.dev/docs/kit/environment-variables) can be configured by exporting
|
|
2259
|
+
* a `variables` object from `src/env.ts`, using [`defineEnvVars`](https://svelte.dev/docs/kit/@sveltejs-kit-hooks#defineEnvVars).
|
|
2260
|
+
*/
|
|
2261
|
+
export interface EnvVarConfig<T> {
|
|
2262
|
+
/**
|
|
2263
|
+
* Whether the environment variable can be accessed by client-side code.
|
|
2264
|
+
* - if `true`, it can be imported from `$app/env/public`
|
|
2265
|
+
* - if `false`, it can be imported from `$app/env/private`, which is a [server-only module](https://svelte.dev/docs/kit/server-only-modules)
|
|
2266
|
+
* @default false
|
|
2267
|
+
*/
|
|
2268
|
+
public?: boolean;
|
|
2269
|
+
/**
|
|
2270
|
+
* Whether the value is determined at build time or when the app runs.
|
|
2271
|
+
* - if `true`, the build time value is inlined into the bundle. This enables optimisations like dead-code elimination
|
|
2272
|
+
* - if `false`, the value is read from the environment when the app starts
|
|
2273
|
+
* @default false
|
|
2274
|
+
*/
|
|
2275
|
+
static?: boolean;
|
|
2276
|
+
/**
|
|
2277
|
+
* A [Standard Schema](https://standardschema.dev/) validator that is applied to the value when the app starts.
|
|
2278
|
+
* The validator can output any value — not necessarily a string — but public, non-static values must be
|
|
2279
|
+
* serializable by [devalue](https://github.com/sveltejs/devalue) so that they can be sent to the browser.
|
|
2280
|
+
*
|
|
2281
|
+
* If omitted, the value must be a non-empty string.
|
|
2282
|
+
*/
|
|
2283
|
+
schema?: StandardSchemaV1<string | undefined, T>;
|
|
2284
|
+
/**
|
|
2285
|
+
* A description of the variable that will be used for inline documentation on hover.
|
|
2286
|
+
*/
|
|
2287
|
+
description?: string;
|
|
2288
|
+
}
|
|
2290
2289
|
interface AdapterEntry {
|
|
2291
2290
|
/**
|
|
2292
2291
|
* A string that uniquely identifies an HTTP service (e.g. serverless function) and is used for deduplication.
|
|
@@ -2771,9 +2770,8 @@ declare module '@sveltejs/kit' {
|
|
|
2771
2770
|
extensions: string[];
|
|
2772
2771
|
};
|
|
2773
2772
|
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
};
|
|
2773
|
+
// TODO: remove the omit in 4.0
|
|
2774
|
+
type ValidatedKitConfig = Omit<RecursiveRequired<KitConfig>, 'adapter'>;
|
|
2777
2775
|
/**
|
|
2778
2776
|
* Throws an error with a HTTP status code and an optional message.
|
|
2779
2777
|
* When called during request handling, this will cause SvelteKit to
|
|
@@ -2781,7 +2779,7 @@ declare module '@sveltejs/kit' {
|
|
|
2781
2779
|
* Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it.
|
|
2782
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.
|
|
2783
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.
|
|
2784
|
-
* @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.
|
|
2785
2783
|
* @throws {Error} If the provided status is invalid (not between 400 and 599).
|
|
2786
2784
|
*/
|
|
2787
2785
|
export function error(status: number, body: App.Error): never;
|
|
@@ -2792,7 +2790,7 @@ declare module '@sveltejs/kit' {
|
|
|
2792
2790
|
* Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it.
|
|
2793
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.
|
|
2794
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.
|
|
2795
|
-
* @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.
|
|
2796
2794
|
* @throws {Error} If the provided status is invalid (not between 400 and 599).
|
|
2797
2795
|
*/
|
|
2798
2796
|
export function error(status: number, body?: {
|
|
@@ -2802,7 +2800,7 @@ declare module '@sveltejs/kit' {
|
|
|
2802
2800
|
* Checks whether this is an error thrown by {@link error}.
|
|
2803
2801
|
* @param status The status to filter for.
|
|
2804
2802
|
* */
|
|
2805
|
-
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 & {
|
|
2806
2804
|
status: T extends undefined ? never : T;
|
|
2807
2805
|
});
|
|
2808
2806
|
/**
|
|
@@ -2818,7 +2816,7 @@ declare module '@sveltejs/kit' {
|
|
|
2818
2816
|
*
|
|
2819
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.
|
|
2820
2818
|
* @param location The location to redirect to.
|
|
2821
|
-
* @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.
|
|
2822
2820
|
* @throws {Error} If the provided status is invalid or the location cannot be used as a header value.
|
|
2823
2821
|
* */
|
|
2824
2822
|
export function redirect(status: 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | ({} & number), location: string | URL): never;
|
|
@@ -2826,17 +2824,19 @@ declare module '@sveltejs/kit' {
|
|
|
2826
2824
|
* Checks whether this is a redirect thrown by {@link redirect}.
|
|
2827
2825
|
* @param e The object to check.
|
|
2828
2826
|
* */
|
|
2829
|
-
export function isRedirect(e: unknown): e is
|
|
2827
|
+
export function isRedirect(e: unknown): e is Redirect;
|
|
2830
2828
|
/**
|
|
2831
2829
|
* Create a JSON `Response` object from the supplied data.
|
|
2832
2830
|
* @param data The value that will be serialized as JSON.
|
|
2833
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`
|
|
2834
2833
|
*/
|
|
2835
2834
|
export function json(data: any, init?: ResponseInit): Response;
|
|
2836
2835
|
/**
|
|
2837
2836
|
* Create a `Response` object from the supplied body.
|
|
2838
2837
|
* @param body The value that will be used as-is.
|
|
2839
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`
|
|
2840
2840
|
*/
|
|
2841
2841
|
export function text(body: string, init?: ResponseInit): Response;
|
|
2842
2842
|
/**
|
|
@@ -2905,33 +2905,21 @@ declare module '@sveltejs/kit' {
|
|
|
2905
2905
|
wasNormalized: boolean;
|
|
2906
2906
|
denormalize: (url?: string | URL) => URL;
|
|
2907
2907
|
};
|
|
2908
|
-
export type LessThan<TNumber extends number, TArray extends any[] = []> = TNumber extends TArray["length"] ? TArray[number] : LessThan<TNumber, [...TArray, TArray["length"]]>;
|
|
2909
|
-
export type NumericRange<TStart extends number, TEnd extends number> = Exclude<TEnd | LessThan<TEnd>, LessThan<TStart>>;
|
|
2910
2908
|
type ValidPageOption = (typeof valid_page_options_array)[number];
|
|
2911
2909
|
type PageOptions = Partial<Record<ValidPageOption, any>>;
|
|
2912
2910
|
const valid_page_options_array: readonly ["ssr", "prerender", "csr", "trailingSlash", "config", "entries", "load"];
|
|
2913
2911
|
export const VERSION: string;
|
|
2914
|
-
class HttpError_1 {
|
|
2915
|
-
|
|
2916
|
-
constructor(status: number, body: {
|
|
2917
|
-
message: string;
|
|
2918
|
-
} extends App.Error ? (App.Error | string | undefined) : App.Error);
|
|
2919
|
-
status: number;
|
|
2920
|
-
body: App.Error;
|
|
2921
|
-
toString(): string;
|
|
2922
|
-
}
|
|
2923
|
-
class Redirect_1 {
|
|
2924
|
-
|
|
2925
|
-
constructor(status: 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308, location: string);
|
|
2926
|
-
status: 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308;
|
|
2927
|
-
location: string;
|
|
2928
|
-
}
|
|
2929
2912
|
|
|
2930
2913
|
export {};
|
|
2931
2914
|
}
|
|
2932
2915
|
|
|
2933
2916
|
declare module '@sveltejs/kit/hooks' {
|
|
2934
|
-
import type { Handle } from '@sveltejs/kit';
|
|
2917
|
+
import type { EnvVarConfig, Handle } from '@sveltejs/kit';
|
|
2918
|
+
/**
|
|
2919
|
+
* Utility for defining [environment variables](https://svelte.dev/docs/kit/environment-variables),
|
|
2920
|
+
* which are made available via `$app/env/public` and `$app/env/private`.
|
|
2921
|
+
* */
|
|
2922
|
+
export function defineEnvVars<T extends Record<string, EnvVarConfig<any>>>(variables: T): T;
|
|
2935
2923
|
/**
|
|
2936
2924
|
* A helper function for sequencing multiple `handle` calls in a middleware-like manner.
|
|
2937
2925
|
* The behavior for the `handle` options is as follows:
|
|
@@ -3024,31 +3012,19 @@ declare module '@sveltejs/kit/node' {
|
|
|
3024
3012
|
export {};
|
|
3025
3013
|
}
|
|
3026
3014
|
|
|
3027
|
-
declare module '@sveltejs/kit/node/polyfills' {
|
|
3028
|
-
/**
|
|
3029
|
-
* Make various web APIs available as globals:
|
|
3030
|
-
* - `crypto`
|
|
3031
|
-
* - `File`
|
|
3032
|
-
*/
|
|
3033
|
-
export function installPolyfills(): void;
|
|
3034
|
-
|
|
3035
|
-
export {};
|
|
3036
|
-
}
|
|
3037
|
-
|
|
3038
3015
|
declare module '@sveltejs/kit/vite' {
|
|
3039
|
-
import type { KitConfig } from '@sveltejs/kit';
|
|
3040
3016
|
import type { SvelteConfig } from '@sveltejs/vite-plugin-svelte';
|
|
3041
3017
|
import type { Plugin } from 'vite';
|
|
3042
3018
|
/**
|
|
3043
3019
|
* Returns the SvelteKit Vite plugins.
|
|
3044
3020
|
* Since version 2.62.0 you can pass [configuration](configuration) directly, in which case `svelte.config.js` is ignored.
|
|
3045
3021
|
* */
|
|
3046
|
-
export function sveltekit(config?: KitConfig & Omit<SvelteConfig, "onwarn">): Promise<Plugin[]>;
|
|
3022
|
+
export function sveltekit(config?: import("@sveltejs/kit").KitConfig & Omit<SvelteConfig, "onwarn">): Promise<Plugin[]>;
|
|
3047
3023
|
|
|
3048
3024
|
export {};
|
|
3049
3025
|
}
|
|
3050
3026
|
|
|
3051
|
-
declare module '$app/
|
|
3027
|
+
declare module '$app/env' {
|
|
3052
3028
|
/**
|
|
3053
3029
|
* `true` if the app is running in the browser.
|
|
3054
3030
|
*/
|
package/types/index.d.ts.map
CHANGED
|
@@ -96,6 +96,7 @@
|
|
|
96
96
|
"RemotePrerenderFunction",
|
|
97
97
|
"RemoteQueryFunction",
|
|
98
98
|
"RemoteLiveQueryFunction",
|
|
99
|
+
"EnvVarConfig",
|
|
99
100
|
"AdapterEntry",
|
|
100
101
|
"Csp",
|
|
101
102
|
"CspDirectives",
|
|
@@ -150,11 +151,11 @@
|
|
|
150
151
|
"PageOptions",
|
|
151
152
|
"valid_page_options_array",
|
|
152
153
|
"VERSION",
|
|
154
|
+
"defineEnvVars",
|
|
153
155
|
"sequence",
|
|
154
156
|
"getRequest",
|
|
155
157
|
"setResponse",
|
|
156
158
|
"createReadableStream",
|
|
157
|
-
"installPolyfills",
|
|
158
159
|
"sveltekit",
|
|
159
160
|
"browser",
|
|
160
161
|
"dev",
|
|
@@ -194,17 +195,16 @@
|
|
|
194
195
|
],
|
|
195
196
|
"sources": [
|
|
196
197
|
"../src/exports/public.d.ts",
|
|
197
|
-
"../src/exports/internal/index.js",
|
|
198
198
|
"../src/types/private.d.ts",
|
|
199
199
|
"../src/types/internal.d.ts",
|
|
200
200
|
"../src/exports/index.js",
|
|
201
201
|
"../src/exports/vite/static_analysis/index.js",
|
|
202
202
|
"../src/version.js",
|
|
203
|
+
"../src/exports/hooks/index.js",
|
|
203
204
|
"../src/exports/hooks/sequence.js",
|
|
204
205
|
"../src/exports/node/index.js",
|
|
205
|
-
"../src/exports/node/polyfills.js",
|
|
206
206
|
"../src/exports/vite/index.js",
|
|
207
|
-
"../src/runtime/app/
|
|
207
|
+
"../src/runtime/app/env/types.d.ts",
|
|
208
208
|
"../src/runtime/app/forms.js",
|
|
209
209
|
"../src/runtime/client/client.js",
|
|
210
210
|
"../src/runtime/app/paths/public.d.ts",
|
|
@@ -235,9 +235,8 @@
|
|
|
235
235
|
null,
|
|
236
236
|
null,
|
|
237
237
|
null,
|
|
238
|
-
null,
|
|
239
238
|
null
|
|
240
239
|
],
|
|
241
|
-
"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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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C,YAAYA;MX9xEhBzE,YAAYA;;;;;;;;;;;;;;YY/Ib0E,IAAIA;;;;;;;;;YASJC,MAAMA;;;;;iBAKDC,YAAYA;;;MCnBvBC,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",
|
|
242
241
|
"ignoreList": []
|
|
243
242
|
}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import process from 'node:process';
|
|
3
|
-
import * as vite from 'vite';
|
|
4
|
-
import { dedent } from '../../../core/sync/utils.js';
|
|
5
|
-
import { s } from '../../../utils/misc.js';
|
|
6
|
-
import { get_config_aliases, strip_virtual_prefix, get_env, normalize_id } from '../utils.js';
|
|
7
|
-
import { create_static_module } from '../../../core/env.js';
|
|
8
|
-
import { env_static_public, service_worker } from '../module_ids.js';
|
|
9
|
-
|
|
10
|
-
// @ts-ignore `vite.rolldownVersion` only exists in `rolldown-vite`
|
|
11
|
-
const is_rolldown = !!vite.rolldownVersion;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @param {string} out
|
|
15
|
-
* @param {import('types').ValidatedKitConfig} kit
|
|
16
|
-
* @param {import('vite').ResolvedConfig} vite_config
|
|
17
|
-
* @param {import('types').ManifestData} manifest_data
|
|
18
|
-
* @param {string} service_worker_entry_file
|
|
19
|
-
* @param {import('types').Prerendered} prerendered
|
|
20
|
-
* @param {import('vite').Manifest} client_manifest
|
|
21
|
-
*/
|
|
22
|
-
export async function build_service_worker(
|
|
23
|
-
out,
|
|
24
|
-
kit,
|
|
25
|
-
vite_config,
|
|
26
|
-
manifest_data,
|
|
27
|
-
service_worker_entry_file,
|
|
28
|
-
prerendered,
|
|
29
|
-
client_manifest
|
|
30
|
-
) {
|
|
31
|
-
const build = new Set();
|
|
32
|
-
for (const key in client_manifest) {
|
|
33
|
-
const { file, css = [], assets = [] } = client_manifest[key];
|
|
34
|
-
build.add(file);
|
|
35
|
-
css.forEach((file) => build.add(file));
|
|
36
|
-
assets.forEach((file) => build.add(file));
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// in a service worker, `location` is the location of the service worker itself,
|
|
40
|
-
// which is guaranteed to be `<base>/service-worker.js`
|
|
41
|
-
const base = "location.pathname.split('/').slice(0, -1).join('/')";
|
|
42
|
-
|
|
43
|
-
const service_worker_code = dedent`
|
|
44
|
-
export const base = /*@__PURE__*/ ${base};
|
|
45
|
-
|
|
46
|
-
export const build = [
|
|
47
|
-
${Array.from(build)
|
|
48
|
-
.map((file) => `base + ${s(`/${file}`)}`)
|
|
49
|
-
.join(',\n')}
|
|
50
|
-
];
|
|
51
|
-
|
|
52
|
-
export const files = [
|
|
53
|
-
${manifest_data.assets
|
|
54
|
-
.filter((asset) => kit.serviceWorker.files(asset.file))
|
|
55
|
-
.map((asset) => `base + ${s(`/${asset.file}`)}`)
|
|
56
|
-
.join(',\n')}
|
|
57
|
-
];
|
|
58
|
-
|
|
59
|
-
export const prerendered = [
|
|
60
|
-
${prerendered.paths.map((path) => `base + ${s(path.replace(kit.paths.base, ''))}`).join(',\n')}
|
|
61
|
-
];
|
|
62
|
-
|
|
63
|
-
export const version = ${s(kit.version.name)};
|
|
64
|
-
`;
|
|
65
|
-
|
|
66
|
-
const env = get_env(kit.env, vite_config.mode);
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* @type {import('vite').Plugin}
|
|
70
|
-
*/
|
|
71
|
-
const sw_virtual_modules = {
|
|
72
|
-
name: 'service-worker-build-virtual-modules',
|
|
73
|
-
resolveId(id) {
|
|
74
|
-
if (id.startsWith('$env/') || id.startsWith('$app/') || id === '$service-worker') {
|
|
75
|
-
// ids with :$ don't work with reverse proxies like nginx
|
|
76
|
-
return `\0virtual:${id.substring(1)}`;
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
load(id) {
|
|
81
|
-
if (!id.startsWith('\0virtual:')) return;
|
|
82
|
-
|
|
83
|
-
if (id === service_worker) {
|
|
84
|
-
return service_worker_code;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (id === env_static_public) {
|
|
88
|
-
return create_static_module('$env/static/public', env.public);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const normalized_cwd = vite.normalizePath(process.cwd());
|
|
92
|
-
const normalized_lib = vite.normalizePath(kit.files.lib);
|
|
93
|
-
const relative = normalize_id(id, normalized_lib, normalized_cwd);
|
|
94
|
-
const stripped = strip_virtual_prefix(relative);
|
|
95
|
-
throw new Error(
|
|
96
|
-
`Cannot import ${stripped} into service-worker code. Only the modules $service-worker and $env/static/public are available in service workers.`
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
/** @type {import('vite').InlineConfig} */
|
|
102
|
-
const config = {
|
|
103
|
-
build: {
|
|
104
|
-
modulePreload: false,
|
|
105
|
-
rollupOptions: {
|
|
106
|
-
input: {
|
|
107
|
-
'service-worker': service_worker_entry_file
|
|
108
|
-
},
|
|
109
|
-
output: {
|
|
110
|
-
// .mjs so that esbuild doesn't incorrectly inject `export` https://github.com/vitejs/vite/issues/15379
|
|
111
|
-
entryFileNames: `service-worker.${is_rolldown ? 'js' : 'mjs'}`,
|
|
112
|
-
assetFileNames: `${kit.appDir}/immutable/assets/[name].[hash][extname]`,
|
|
113
|
-
inlineDynamicImports: !is_rolldown ? true : undefined
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
outDir: `${out}/client`,
|
|
117
|
-
emptyOutDir: false,
|
|
118
|
-
minify: vite_config.build.minify
|
|
119
|
-
},
|
|
120
|
-
configFile: false,
|
|
121
|
-
define: vite_config.define,
|
|
122
|
-
publicDir: false,
|
|
123
|
-
plugins: [sw_virtual_modules],
|
|
124
|
-
resolve: {
|
|
125
|
-
alias: [...get_config_aliases(kit)]
|
|
126
|
-
},
|
|
127
|
-
experimental: {
|
|
128
|
-
renderBuiltUrl(filename) {
|
|
129
|
-
return {
|
|
130
|
-
runtime: `new URL(${JSON.stringify(filename)}, location.href).pathname`
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
// we must reference Vite 8 options conditionally. Otherwise, older Vite
|
|
137
|
-
// versions throw an error about unknown config options
|
|
138
|
-
if (is_rolldown && config?.build?.rollupOptions?.output) {
|
|
139
|
-
// @ts-ignore only available in Vite 8
|
|
140
|
-
config.build.rollupOptions.output.codeSplitting = true;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
await vite.build(config);
|
|
144
|
-
|
|
145
|
-
// rename .mjs to .js to avoid incorrect MIME types with ancient webservers
|
|
146
|
-
if (!is_rolldown) {
|
|
147
|
-
fs.renameSync(`${out}/client/service-worker.mjs`, `${out}/client/service-worker.js`);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
@@ -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';
|