@sveltejs/kit 3.0.0-next.7 → 3.0.0-next.8
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 +2 -2
- package/src/core/config/options.js +1 -1
- package/src/core/env.js +1 -0
- package/src/core/sync/create_manifest_data/index.js +1 -1
- package/src/core/sync/sync.js +0 -2
- package/src/core/sync/write_client_manifest.js +0 -7
- package/src/core/sync/write_non_ambient.js +2 -2
- package/src/core/sync/write_server.js +0 -3
- package/src/core/sync/write_types/index.js +17 -14
- package/src/core/utils.js +2 -2
- package/src/exports/node/index.js +4 -8
- package/src/exports/public.d.ts +21 -14
- package/src/exports/vite/dev/index.js +3 -3
- package/src/exports/vite/index.js +64 -44
- package/src/exports/vite/preview/index.js +13 -14
- package/src/exports/vite/utils.js +5 -5
- package/src/runtime/app/env/internal.js +4 -4
- package/src/runtime/app/forms.js +2 -2
- package/src/runtime/app/paths/internal/client.js +4 -2
- package/src/runtime/app/paths/internal/server.js +2 -23
- package/src/runtime/app/paths/server.js +2 -2
- package/src/runtime/client/bundle.js +1 -1
- package/src/runtime/client/client-entry.js +3 -0
- package/src/runtime/client/client.js +216 -171
- package/src/runtime/client/entry.js +24 -3
- package/src/runtime/client/payload.js +17 -0
- package/src/runtime/client/remote-functions/form.svelte.js +6 -6
- package/src/runtime/client/types.d.ts +2 -6
- package/src/runtime/components/root.svelte +66 -0
- package/src/runtime/form-utils.js +1 -4
- package/src/runtime/server/cookie.js +17 -7
- package/src/runtime/server/page/index.js +7 -14
- package/src/runtime/server/page/render.js +71 -78
- package/src/runtime/server/remote.js +2 -1
- package/src/runtime/server/utils.js +28 -5
- package/src/runtime/types.d.ts +8 -0
- package/src/types/global-private.d.ts +10 -17
- package/src/types/internal.d.ts +21 -25
- package/src/utils/import.js +6 -1
- package/src/utils/routing.js +6 -6
- package/src/version.js +1 -1
- package/types/index.d.ts +34 -43
- package/types/index.d.ts.map +3 -2
- package/src/core/sync/write_root.js +0 -127
package/src/types/internal.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Component } from 'svelte';
|
|
2
2
|
import {
|
|
3
3
|
Config,
|
|
4
4
|
ServerLoad,
|
|
@@ -113,7 +113,7 @@ export interface BuildData {
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
export interface CSRPageNode {
|
|
116
|
-
component:
|
|
116
|
+
component: Component;
|
|
117
117
|
universal: {
|
|
118
118
|
load?: Load;
|
|
119
119
|
trailingSlash?: TrailingSlash;
|
|
@@ -417,27 +417,7 @@ export interface ServerMetadata {
|
|
|
417
417
|
remotes: Map<string, Map<string, { type: RemoteInternals['type']; dynamic: boolean }>>;
|
|
418
418
|
}
|
|
419
419
|
|
|
420
|
-
|
|
421
|
-
export interface SSRComponent {
|
|
422
|
-
default: {
|
|
423
|
-
render(
|
|
424
|
-
props: Record<string, any>,
|
|
425
|
-
opts: { context: Map<any, any>; csp?: { nonce?: string; hash?: boolean } }
|
|
426
|
-
): Promise<{
|
|
427
|
-
body: string;
|
|
428
|
-
head: string;
|
|
429
|
-
css: {
|
|
430
|
-
code: string;
|
|
431
|
-
map: any; // TODO
|
|
432
|
-
};
|
|
433
|
-
hashes: {
|
|
434
|
-
script: Array<`sha256-${string}`>;
|
|
435
|
-
};
|
|
436
|
-
}>;
|
|
437
|
-
};
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
export type SSRComponentLoader = () => Promise<SSRComponent>;
|
|
420
|
+
export type SSRComponentLoader = () => Promise<Component>;
|
|
441
421
|
|
|
442
422
|
export interface UniversalNode {
|
|
443
423
|
/** Is `null` in case static analysis succeeds but the node is ssr=false */
|
|
@@ -501,10 +481,8 @@ export interface SSROptions {
|
|
|
501
481
|
hooks: ServerHooks;
|
|
502
482
|
link_header_preload: ValidatedConfig['kit']['output']['linkHeaderPreload'];
|
|
503
483
|
paths_origin: string | undefined;
|
|
504
|
-
root: SSRComponent['default'];
|
|
505
484
|
service_worker: boolean;
|
|
506
485
|
service_worker_options: RegistrationOptions;
|
|
507
|
-
server_error_boundaries: boolean;
|
|
508
486
|
templates: {
|
|
509
487
|
app(values: {
|
|
510
488
|
head: string;
|
|
@@ -764,5 +742,23 @@ export interface RequestStore {
|
|
|
764
742
|
state: RequestState;
|
|
765
743
|
}
|
|
766
744
|
|
|
745
|
+
/** Type of the `__sveltekit_abc123` object in the init `<script>` */
|
|
746
|
+
export interface SvelteKitPayload {
|
|
747
|
+
/** The application version */
|
|
748
|
+
version: string;
|
|
749
|
+
/** The basepath, usually relative to the current page */
|
|
750
|
+
base: string;
|
|
751
|
+
/** Path to externally-hosted assets */
|
|
752
|
+
assets?: string;
|
|
753
|
+
/** Public environment variables */
|
|
754
|
+
env?: Record<string, string>;
|
|
755
|
+
/** Serialized data from query/form/command functions */
|
|
756
|
+
data?: RemoteFunctionData;
|
|
757
|
+
/** Create a placeholder promise */
|
|
758
|
+
defer?: (id: number) => Promise<any>;
|
|
759
|
+
/** Resolve a placeholder promise */
|
|
760
|
+
resolve?: (data: { id: number; data: any; error: any }) => void;
|
|
761
|
+
}
|
|
762
|
+
|
|
767
763
|
export * from '../exports/index.js';
|
|
768
764
|
export * from './private.js';
|
package/src/utils/import.js
CHANGED
|
@@ -2,7 +2,12 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Resolves a peer dependency relative to the current working directory.
|
|
5
|
+
* Resolves a peer dependency relative to the current working directory.
|
|
6
|
+
*
|
|
7
|
+
* Mainly used to resolve the correct Vite package when an app's SvelteKit is a
|
|
8
|
+
* linked local repository.
|
|
9
|
+
*
|
|
10
|
+
* Duplicated with `packages/adapter-auto`
|
|
6
11
|
* @param {string} dependency
|
|
7
12
|
* @param {string} root
|
|
8
13
|
*/
|
package/src/utils/routing.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BROWSER } from 'esm-env';
|
|
2
2
|
|
|
3
|
-
const param_pattern = /^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;
|
|
3
|
+
const param_pattern = /^(\[)?(\.\.\.)?([\w-]+)(?:=([\w-]+))?(\])?$/;
|
|
4
4
|
|
|
5
5
|
const root_group_pattern = /^\/\((?:[^)]+)\)$/;
|
|
6
6
|
|
|
@@ -19,7 +19,7 @@ export function parse_route_id(id) {
|
|
|
19
19
|
`^${get_route_segments(id)
|
|
20
20
|
.map((segment) => {
|
|
21
21
|
// special case — /[...rest]/ could contain zero segments
|
|
22
|
-
const rest_match = /^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(segment);
|
|
22
|
+
const rest_match = /^\[\.\.\.([\w-]+)(?:=([\w-]+))?\]$/.exec(segment);
|
|
23
23
|
if (rest_match) {
|
|
24
24
|
params.push({
|
|
25
25
|
name: rest_match[1],
|
|
@@ -31,7 +31,7 @@ export function parse_route_id(id) {
|
|
|
31
31
|
return '(?:/([^]*))?';
|
|
32
32
|
}
|
|
33
33
|
// special case — /[[optional]]/ could contain zero segments
|
|
34
|
-
const optional_match = /^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(segment);
|
|
34
|
+
const optional_match = /^\[\[([\w-]+)(?:=([\w-]+))?\]\]$/.exec(segment);
|
|
35
35
|
if (optional_match) {
|
|
36
36
|
params.push({
|
|
37
37
|
name: optional_match[1],
|
|
@@ -72,7 +72,7 @@ export function parse_route_id(id) {
|
|
|
72
72
|
const match = /** @type {RegExpExecArray} */ (param_pattern.exec(content));
|
|
73
73
|
if (!BROWSER && !match) {
|
|
74
74
|
throw new Error(
|
|
75
|
-
`Invalid param: ${content}. Params and matcher names can only have underscores and alphanumeric characters.`
|
|
75
|
+
`Invalid param: ${content}. Params and matcher names can only have underscores, hyphens, and alphanumeric characters.`
|
|
76
76
|
);
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -103,7 +103,7 @@ export function parse_route_id(id) {
|
|
|
103
103
|
return { pattern, params };
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
const optional_param_regex = /\/\[\[\w+?(
|
|
106
|
+
const optional_param_regex = /\/\[\[[\w-]+?(?:=[\w-]+)?\]\]/;
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
109
|
* Removes optional params from a route ID.
|
|
@@ -260,7 +260,7 @@ function escape(str) {
|
|
|
260
260
|
);
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
const basic_param_pattern = /\[(\[)?(\.\.\.)?(\w+?)(?:=(\w+))?\]\]?/g;
|
|
263
|
+
const basic_param_pattern = /\[(\[)?(\.\.\.)?([\w-]+?)(?:=([\w-]+))?\]\]?/g;
|
|
264
264
|
|
|
265
265
|
/**
|
|
266
266
|
* Populate a route ID with params to resolve a pathname.
|
package/src/version.js
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ declare module '@sveltejs/kit' {
|
|
|
6
6
|
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
7
7
|
import type { Plugin } from 'vite';
|
|
8
8
|
import type { RouteId as AppRouteId, LayoutParams as AppLayoutParams, ResolvedPathname } from '$app/types';
|
|
9
|
+
import type { Component } from 'svelte';
|
|
9
10
|
// @ts-ignore this is an optional peer dependency so could be missing. Written like this so dts-buddy preserves the ts-ignore
|
|
10
11
|
type Span = import('@opentelemetry/api').Span;
|
|
11
12
|
|
|
@@ -131,7 +132,7 @@ declare module '@sveltejs/kit' {
|
|
|
131
132
|
|
|
132
133
|
/**
|
|
133
134
|
* Generate a server-side manifest to initialise the SvelteKit [server](https://svelte.dev/docs/kit/@sveltejs-kit#Server) with.
|
|
134
|
-
* @param opts
|
|
135
|
+
* @param opts.relativePath A relative path to the base directory of the server build output
|
|
135
136
|
*/
|
|
136
137
|
generateManifest: (opts: { relativePath: string; routes?: RouteDefinition[] }) => string;
|
|
137
138
|
|
|
@@ -482,15 +483,6 @@ declare module '@sveltejs/kit' {
|
|
|
482
483
|
* @default false
|
|
483
484
|
*/
|
|
484
485
|
forkPreloads?: boolean;
|
|
485
|
-
|
|
486
|
-
/**
|
|
487
|
-
* Whether to enable the experimental handling of rendering errors.
|
|
488
|
-
* When enabled, `<svelte:boundary>` is used to wrap components at each level
|
|
489
|
-
* where there's an `+error.svelte`, rendering the error page if the component fails.
|
|
490
|
-
* In addition, error boundaries also work on the server and the error object goes through `handleError`.
|
|
491
|
-
* @default false
|
|
492
|
-
*/
|
|
493
|
-
handleRenderingErrors?: boolean;
|
|
494
486
|
};
|
|
495
487
|
/**
|
|
496
488
|
* Where to find various files within your project.
|
|
@@ -1412,7 +1404,7 @@ declare module '@sveltejs/kit' {
|
|
|
1412
1404
|
/**
|
|
1413
1405
|
* The URL of the current page.
|
|
1414
1406
|
*/
|
|
1415
|
-
url:
|
|
1407
|
+
url: ReadonlyURL & { readonly pathname: ResolvedPathname | (string & {}) };
|
|
1416
1408
|
/**
|
|
1417
1409
|
* The parameters of the current page - e.g. for a route like `/blog/[slug]`, a `{ slug: string }` object.
|
|
1418
1410
|
*/
|
|
@@ -1713,7 +1705,9 @@ declare module '@sveltejs/kit' {
|
|
|
1713
1705
|
*/
|
|
1714
1706
|
filterSerializedResponseHeaders?: (name: string, value: string) => boolean;
|
|
1715
1707
|
/**
|
|
1716
|
-
* Determines
|
|
1708
|
+
* Determines which files should be preloaded. Files are preloaded via `<link>` tags added to the
|
|
1709
|
+
* `<head>` tag; if `output.linkHeaderPreload` is enabled, dynamically rendered pages use the
|
|
1710
|
+
* [`Link` response header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link) instead.
|
|
1717
1711
|
* By default, `js` and `css` files will be preloaded.
|
|
1718
1712
|
* @param input the type of the file and its path
|
|
1719
1713
|
*/
|
|
@@ -1748,19 +1742,24 @@ declare module '@sveltejs/kit' {
|
|
|
1748
1742
|
read?: (file: string) => MaybePromise<ReadableStream | null>;
|
|
1749
1743
|
}
|
|
1750
1744
|
|
|
1745
|
+
/**
|
|
1746
|
+
* Information required to instantiate a new `Server` instance.
|
|
1747
|
+
*/
|
|
1751
1748
|
export interface SSRManifest {
|
|
1749
|
+
/** The directory where SvelteKit keeps its stuff, including static assets (such as JS and CSS) and internally-used routes. */
|
|
1752
1750
|
appDir: string;
|
|
1751
|
+
/** The `base` and `appDir` settings combined without a leading slash. */
|
|
1753
1752
|
appPath: string;
|
|
1754
1753
|
/** Static files from `config.files.assets` and the service worker (if any). */
|
|
1755
1754
|
assets: Set<string>;
|
|
1756
1755
|
mimeTypes: Record<string, string>;
|
|
1757
1756
|
|
|
1758
|
-
/** private fields */
|
|
1757
|
+
/** @internal private fields */
|
|
1759
1758
|
_: {
|
|
1760
1759
|
client: BuildData['client'];
|
|
1761
1760
|
nodes: SSRNodeLoader[];
|
|
1762
1761
|
/** hashed filename -> import to that file */
|
|
1763
|
-
remotes: Record<string, () => Promise<any>>;
|
|
1762
|
+
remotes: Record<string, () => Promise<{ default: Record<string, any> }>>;
|
|
1764
1763
|
routes: SSRRoute[];
|
|
1765
1764
|
prerendered_routes: Set<string>;
|
|
1766
1765
|
matchers: () => Promise<Record<string, ParamMatcher>>;
|
|
@@ -1951,6 +1950,14 @@ declare module '@sveltejs/kit' {
|
|
|
1951
1950
|
restore: (snapshot: T) => void;
|
|
1952
1951
|
}
|
|
1953
1952
|
|
|
1953
|
+
export type ReadonlyURLSearchParams = Omit<URLSearchParams, 'set' | 'append' | 'delete' | 'sort'>;
|
|
1954
|
+
|
|
1955
|
+
export type ReadonlyURL = Readonly<
|
|
1956
|
+
Omit<URL, 'searchParams'> & {
|
|
1957
|
+
searchParams: ReadonlyURLSearchParams;
|
|
1958
|
+
}
|
|
1959
|
+
>;
|
|
1960
|
+
|
|
1954
1961
|
// If T is unknown or has an index signature, the types below will recurse indefinitely and create giant unions that TS can't handle
|
|
1955
1962
|
type WillRecurseIndefinitely<T> = unknown extends T ? true : string extends keyof T ? true : false;
|
|
1956
1963
|
|
|
@@ -2832,27 +2839,7 @@ declare module '@sveltejs/kit' {
|
|
|
2832
2839
|
} | null;
|
|
2833
2840
|
}
|
|
2834
2841
|
|
|
2835
|
-
|
|
2836
|
-
interface SSRComponent {
|
|
2837
|
-
default: {
|
|
2838
|
-
render(
|
|
2839
|
-
props: Record<string, any>,
|
|
2840
|
-
opts: { context: Map<any, any>; csp?: { nonce?: string; hash?: boolean } }
|
|
2841
|
-
): Promise<{
|
|
2842
|
-
body: string;
|
|
2843
|
-
head: string;
|
|
2844
|
-
css: {
|
|
2845
|
-
code: string;
|
|
2846
|
-
map: any; // TODO
|
|
2847
|
-
};
|
|
2848
|
-
hashes: {
|
|
2849
|
-
script: Array<`sha256-${string}`>;
|
|
2850
|
-
};
|
|
2851
|
-
}>;
|
|
2852
|
-
};
|
|
2853
|
-
}
|
|
2854
|
-
|
|
2855
|
-
type SSRComponentLoader = () => Promise<SSRComponent>;
|
|
2842
|
+
type SSRComponentLoader = () => Promise<Component>;
|
|
2856
2843
|
|
|
2857
2844
|
interface UniversalNode {
|
|
2858
2845
|
/** Is `null` in case static analysis succeeds but the node is ssr=false */
|
|
@@ -3204,9 +3191,9 @@ declare module '@sveltejs/kit/node' {
|
|
|
3204
3191
|
request: import("http").IncomingMessage;
|
|
3205
3192
|
base: string;
|
|
3206
3193
|
bodySizeLimit?: number;
|
|
3207
|
-
}):
|
|
3194
|
+
}): Request;
|
|
3208
3195
|
|
|
3209
|
-
export function setResponse(res: import("http").ServerResponse, response: Response):
|
|
3196
|
+
export function setResponse(res: import("http").ServerResponse, response: Response): void;
|
|
3210
3197
|
/**
|
|
3211
3198
|
* Converts a file on disk to a readable stream
|
|
3212
3199
|
* @since 2.4.0
|
|
@@ -3362,8 +3349,9 @@ declare module '$app/navigation' {
|
|
|
3362
3349
|
replaceState?: boolean | undefined;
|
|
3363
3350
|
noScroll?: boolean | undefined;
|
|
3364
3351
|
keepFocus?: boolean | undefined;
|
|
3365
|
-
|
|
3352
|
+
refreshAll?: boolean | undefined;
|
|
3366
3353
|
invalidate?: (string | URL | ((url: URL) => boolean))[] | undefined;
|
|
3354
|
+
invalidateAll?: boolean | undefined;
|
|
3367
3355
|
state?: App.PageState | undefined;
|
|
3368
3356
|
}): Promise<void>;
|
|
3369
3357
|
/**
|
|
@@ -3382,19 +3370,22 @@ declare module '$app/navigation' {
|
|
|
3382
3370
|
* invalidate((url) => url.pathname === '/path');
|
|
3383
3371
|
* ```
|
|
3384
3372
|
* @param resource The invalidated URL
|
|
3373
|
+
* @param keepState If `true`, the current `page.state` will be preserved. Otherwise, it will be reset to an empty object. `false` by default.
|
|
3385
3374
|
* */
|
|
3386
|
-
export function invalidate(resource: string | URL | ((url: URL) => boolean)): Promise<void>;
|
|
3375
|
+
export function invalidate(resource: string | URL | ((url: URL) => boolean), keepState?: boolean): Promise<void>;
|
|
3387
3376
|
/**
|
|
3388
3377
|
* Causes all `load` and `query` functions belonging to the currently active page to re-run. Returns a `Promise` that resolves when the page is subsequently updated.
|
|
3378
|
+
*
|
|
3379
|
+
* Note that this resets `page.state` to an empty object. If you want to preserve `page.state` (for example when using [shallow routing](https://svelte.dev/docs/kit/shallow-routing)), use `refreshAll` instead.
|
|
3380
|
+
*
|
|
3381
|
+
* @deprecated Use [`refreshAll`](https://svelte.dev/docs/kit/$app-navigation#refreshAll) instead. Unlike `invalidateAll`, `refreshAll` does not reset `page.state`.
|
|
3389
3382
|
* */
|
|
3390
3383
|
export function invalidateAll(): Promise<void>;
|
|
3391
3384
|
/**
|
|
3392
|
-
* Causes all currently active remote functions to refresh, and all `load` functions belonging to the currently active page to re-run
|
|
3385
|
+
* Causes all currently active remote functions to refresh, and all `load` functions belonging to the currently active page to re-run.
|
|
3393
3386
|
* Returns a `Promise` that resolves when the page is subsequently updated.
|
|
3394
3387
|
* */
|
|
3395
|
-
export function refreshAll(
|
|
3396
|
-
includeLoadFunctions?: boolean;
|
|
3397
|
-
}): Promise<void>;
|
|
3388
|
+
export function refreshAll(): Promise<void>;
|
|
3398
3389
|
/**
|
|
3399
3390
|
* Programmatically preloads the given page, which means
|
|
3400
3391
|
* 1. ensuring that the code for the page is loaded, and
|
package/types/index.d.ts.map
CHANGED
|
@@ -72,6 +72,8 @@
|
|
|
72
72
|
"Redirect",
|
|
73
73
|
"SubmitFunction",
|
|
74
74
|
"Snapshot",
|
|
75
|
+
"ReadonlyURLSearchParams",
|
|
76
|
+
"ReadonlyURL",
|
|
75
77
|
"WillRecurseIndefinitely",
|
|
76
78
|
"InputTypeMap",
|
|
77
79
|
"RemoteFormFieldType",
|
|
@@ -136,7 +138,6 @@
|
|
|
136
138
|
"RecursiveRequired",
|
|
137
139
|
"RouteParam",
|
|
138
140
|
"RouteData",
|
|
139
|
-
"SSRComponent",
|
|
140
141
|
"SSRComponentLoader",
|
|
141
142
|
"UniversalNode",
|
|
142
143
|
"ServerNode",
|
|
@@ -243,6 +244,6 @@
|
|
|
243
244
|
null,
|
|
244
245
|
null
|
|
245
246
|
],
|
|
246
|
-
"mappings": "
|
|
247
|
+
"mappings": ";;;;;;;;;;MAmCKA,IAAIA;;MAEJC,0BAA0BA;;;;;kBAKdC,OAAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAwCZC,cAAcA;;;;;;aAMdC,cAAcA;;;;;;;;MAQrBC,aAAaA;;;;;OAKJC,YAAYA;;kBAETC,aAAaA;;;;;;MAMzBC,qBAAqBA;;;;;;;;;;;kBAWTC,OAAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA8IPC,MAAMA;;;;;;;;;;;kBAWNC,OAAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA6EPC,QAAQA;;;;;;;;kBAQRC,SAASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;iBAqDXC,WAAWA;;;;;iBAwCjBC,SAASA;;;;;iBA2CTC,YAAYA;MZ54EhB1E,YAAYA;;;;;;;;;;;;;;;;;;;;;;;iBa/IR2E,KAAKA;;;;;;;;;;;;;;;;;;;;;iBA6BLC,OAAOA;;;;;;;;;;;;;;;;;;;iBA+BDC,KAAKA;;;;MC7EtBC,iBAAiBA;;;;;;MAMVC,WAAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCKPC,IAAIA;;;;;;;;iBCSJC,eAAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Mf6TnBC,qCAAqCA;;;;;;;;MAiKrCC,8BAA8BA;MDlV9BnF,YAAYA;;MA2GZiB,KAAKA;;MAELmE,qBAAqBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ciBnOpBC,IAAIA;;;;;cAQJC,UAAUA;;;;;;;;;;;cAMVC,OAAOA",
|
|
247
248
|
"ignoreList": []
|
|
248
249
|
}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { dedent, write_if_changed } from './utils.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @param {import('types').ManifestData} manifest_data
|
|
5
|
-
* @param {import('types').ValidatedConfig} config
|
|
6
|
-
* @param {string} output
|
|
7
|
-
*/
|
|
8
|
-
export function write_root(manifest_data, config, output) {
|
|
9
|
-
// TODO remove default layout altogether
|
|
10
|
-
|
|
11
|
-
const use_boundaries = config.kit.experimental.handleRenderingErrors;
|
|
12
|
-
|
|
13
|
-
const max_depth = Math.max(
|
|
14
|
-
...manifest_data.routes.map((route) =>
|
|
15
|
-
route.page ? route.page.layouts.filter(Boolean).length + 1 : 0
|
|
16
|
-
),
|
|
17
|
-
1
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
const levels = [];
|
|
21
|
-
for (let i = 0; i <= max_depth; i += 1) {
|
|
22
|
-
levels.push(i);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
let l = max_depth;
|
|
26
|
-
/** @type {string} */
|
|
27
|
-
let pyramid;
|
|
28
|
-
|
|
29
|
-
if (use_boundaries) {
|
|
30
|
-
// with the @const we force the data[depth] access to be derived, which is important to not fire updates needlessly
|
|
31
|
-
// TODO in Svelte 5 we should rethink the client.js side, we can likely make data a $state and only update indexes that changed there, simplifying this a lot
|
|
32
|
-
pyramid = dedent`
|
|
33
|
-
{#snippet pyramid(depth)}
|
|
34
|
-
{@const Pyramid = constructors[depth]}
|
|
35
|
-
{#snippet failed(error)}
|
|
36
|
-
{@const ErrorPage = errors[depth]}
|
|
37
|
-
<ErrorPage {error} />
|
|
38
|
-
{/snippet}
|
|
39
|
-
<svelte:boundary failed={errors[depth] ? failed : undefined}>
|
|
40
|
-
{#if constructors[depth + 1]}
|
|
41
|
-
{@const d = data[depth]}
|
|
42
|
-
<!-- svelte-ignore binding_property_non_reactive -->
|
|
43
|
-
<Pyramid bind:this={components[depth]} data={d} {form} params={page.params}>
|
|
44
|
-
{@render pyramid(depth + 1)}
|
|
45
|
-
</Pyramid>
|
|
46
|
-
{:else}
|
|
47
|
-
{@const d = data[depth]}
|
|
48
|
-
<!-- svelte-ignore binding_property_non_reactive -->
|
|
49
|
-
<Pyramid bind:this={components[depth]} data={d} {form} params={page.params} {error} />
|
|
50
|
-
{/if}
|
|
51
|
-
</svelte:boundary>
|
|
52
|
-
{/snippet}
|
|
53
|
-
|
|
54
|
-
{@render pyramid(0)}
|
|
55
|
-
`;
|
|
56
|
-
} else {
|
|
57
|
-
pyramid = dedent`
|
|
58
|
-
<!-- svelte-ignore binding_property_non_reactive -->
|
|
59
|
-
<Pyramid_${l} bind:this={components[${l}]} data={data_${l}} {form} params={page.params} />`;
|
|
60
|
-
|
|
61
|
-
while (l--) {
|
|
62
|
-
pyramid = dedent`
|
|
63
|
-
{#if constructors[${l + 1}]}
|
|
64
|
-
{@const Pyramid_${l} = constructors[${l}]}
|
|
65
|
-
<!-- svelte-ignore binding_property_non_reactive -->
|
|
66
|
-
<Pyramid_${l} bind:this={components[${l}]} data={data_${l}} {form} params={page.params}>
|
|
67
|
-
${pyramid}
|
|
68
|
-
</Pyramid_${l}>
|
|
69
|
-
{:else}
|
|
70
|
-
{@const Pyramid_${l} = constructors[${l}]}
|
|
71
|
-
<!-- svelte-ignore binding_property_non_reactive -->
|
|
72
|
-
<Pyramid_${l} bind:this={components[${l}]} data={data_${l}} {form} params={page.params} />
|
|
73
|
-
{/if}
|
|
74
|
-
`;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
write_if_changed(
|
|
79
|
-
`${output}/root.svelte`,
|
|
80
|
-
dedent`
|
|
81
|
-
<!-- This file is generated by @sveltejs/kit — do not edit it! -->
|
|
82
|
-
<svelte:options runes={true} />
|
|
83
|
-
<script>
|
|
84
|
-
import { afterNavigate } from '$app/navigation';
|
|
85
|
-
|
|
86
|
-
let { page, constructors, components = [], form, ${use_boundaries ? 'errors = [], error, ' : ''}${levels
|
|
87
|
-
.map((l) => `data_${l} = null`)
|
|
88
|
-
.join(', ')} } = $props();
|
|
89
|
-
${use_boundaries ? `let data = $derived({${levels.map((l) => `'${l}': data_${l}`).join(', ')}})` : ''}
|
|
90
|
-
|
|
91
|
-
let mounted = $state(false);
|
|
92
|
-
let navigated = $state(false);
|
|
93
|
-
let title = $state(null);
|
|
94
|
-
|
|
95
|
-
afterNavigate(() => {
|
|
96
|
-
if (mounted) {
|
|
97
|
-
navigated = true;
|
|
98
|
-
title = document.title || 'untitled page';
|
|
99
|
-
} else {
|
|
100
|
-
mounted = true;
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
const Pyramid_${max_depth} = $derived(constructors[${max_depth}]);
|
|
105
|
-
</script>
|
|
106
|
-
|
|
107
|
-
${pyramid}
|
|
108
|
-
|
|
109
|
-
{#if mounted}
|
|
110
|
-
<div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px">
|
|
111
|
-
{#if navigated}
|
|
112
|
-
{title}
|
|
113
|
-
{/if}
|
|
114
|
-
</div>
|
|
115
|
-
{/if}
|
|
116
|
-
`
|
|
117
|
-
);
|
|
118
|
-
|
|
119
|
-
write_if_changed(
|
|
120
|
-
`${output}/root.js`,
|
|
121
|
-
dedent`
|
|
122
|
-
import { asClassComponent } from 'svelte/legacy';
|
|
123
|
-
import Root from './root.svelte';
|
|
124
|
-
export default asClassComponent(Root);
|
|
125
|
-
`
|
|
126
|
-
);
|
|
127
|
-
}
|