@sveltejs/kit 3.0.0-next.7 → 3.0.0-next.9
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 +6 -3
- package/src/core/config/index.js +1 -2
- package/src/core/config/options.js +5 -2
- 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_tsconfig.js +14 -4
- package/src/core/sync/write_tsconfig_test/package.json +7 -0
- package/src/core/sync/write_types/index.js +17 -14
- package/src/core/utils.js +2 -2
- package/src/exports/hooks/sequence.js +3 -2
- package/src/exports/index.js +1 -1
- package/src/exports/node/index.js +4 -8
- package/src/exports/public.d.ts +22 -23
- package/src/exports/vite/dev/index.js +4 -7
- package/src/exports/vite/index.js +110 -59
- package/src/exports/vite/preview/index.js +13 -14
- package/src/exports/vite/utils.js +14 -14
- package/src/runtime/app/env/internal.js +4 -4
- package/src/runtime/app/environment/index.js +3 -3
- 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/app/server/remote/prerender.js +1 -2
- package/src/runtime/client/bundle.js +1 -1
- package/src/runtime/client/client-entry.js +3 -0
- package/src/runtime/client/client.js +217 -172
- 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/state.svelte.js +0 -1
- package/src/runtime/client/types.d.ts +2 -6
- package/src/runtime/components/root.svelte +66 -0
- package/src/runtime/env/dynamic/private.js +7 -0
- package/src/runtime/env/dynamic/public.js +7 -0
- package/src/runtime/env/static/private.js +6 -0
- package/src/runtime/env/static/public.js +6 -0
- package/src/runtime/form-utils.js +1 -4
- package/src/runtime/server/cookie.js +51 -23
- package/src/runtime/server/csrf.js +1 -1
- package/src/runtime/server/data/index.js +8 -12
- 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/respond.js +1 -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 +25 -26
- package/src/utils/import.js +6 -1
- package/src/utils/imports.js +83 -0
- package/src/utils/routing.js +6 -6
- package/src/version.js +1 -1
- package/types/index.d.ts +34 -285
- package/types/index.d.ts.map +3 -26
- package/src/core/sync/write_root.js +0 -127
- package/src/types/synthetic/$lib.md +0 -5
package/types/index.d.ts
CHANGED
|
@@ -131,7 +131,7 @@ declare module '@sveltejs/kit' {
|
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
133
|
* Generate a server-side manifest to initialise the SvelteKit [server](https://svelte.dev/docs/kit/@sveltejs-kit#Server) with.
|
|
134
|
-
* @param opts
|
|
134
|
+
* @param opts.relativePath A relative path to the base directory of the server build output
|
|
135
135
|
*/
|
|
136
136
|
generateManifest: (opts: { relativePath: string; routes?: RouteDefinition[] }) => string;
|
|
137
137
|
|
|
@@ -407,8 +407,6 @@ declare module '@sveltejs/kit' {
|
|
|
407
407
|
*
|
|
408
408
|
* > [!NOTE] When `mode` is `'auto'`, SvelteKit will use nonces for dynamically rendered pages and hashes for prerendered pages. Using nonces with prerendered pages is insecure and therefore forbidden.
|
|
409
409
|
*
|
|
410
|
-
* > [!NOTE] Note that most [Svelte transitions](https://svelte.dev/tutorial/svelte/transition) work by creating an inline `<style>` element. If you use these in your app, you must either leave the `style-src` directive unspecified or add `unsafe-inline`.
|
|
411
|
-
*
|
|
412
410
|
* If this level of configuration is insufficient and you have more dynamic requirements, you can use the [`handle` hook](https://svelte.dev/docs/kit/hooks#Server-hooks-handle) to roll your own CSP.
|
|
413
411
|
*/
|
|
414
412
|
csp?: {
|
|
@@ -482,15 +480,6 @@ declare module '@sveltejs/kit' {
|
|
|
482
480
|
* @default false
|
|
483
481
|
*/
|
|
484
482
|
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
483
|
};
|
|
495
484
|
/**
|
|
496
485
|
* Where to find various files within your project.
|
|
@@ -531,12 +520,6 @@ declare module '@sveltejs/kit' {
|
|
|
531
520
|
*/
|
|
532
521
|
universal?: string;
|
|
533
522
|
};
|
|
534
|
-
/**
|
|
535
|
-
* Your app's internal library, accessible throughout the codebase as `$lib`.
|
|
536
|
-
* @deprecated this feature is still supported, but it's generally recommended to use [monorepos](https://levelup.video/tutorials/monorepos-with-pnpm) instead
|
|
537
|
-
* @default "src/lib"
|
|
538
|
-
*/
|
|
539
|
-
lib?: string;
|
|
540
523
|
/**
|
|
541
524
|
* A directory containing [parameter matchers](https://svelte.dev/docs/kit/advanced-routing#Matching).
|
|
542
525
|
* @deprecated this feature is still supported, but it's generally recommended to use [monorepos](https://levelup.video/tutorials/monorepos-with-pnpm) instead
|
|
@@ -943,7 +926,7 @@ declare module '@sveltejs/kit' {
|
|
|
943
926
|
*/
|
|
944
927
|
export type Handle = (input: {
|
|
945
928
|
event: RequestEvent;
|
|
946
|
-
resolve: (event: RequestEvent, opts?: ResolveOptions) =>
|
|
929
|
+
resolve: (event: RequestEvent, opts?: ResolveOptions) => Promise<Response>;
|
|
947
930
|
}) => MaybePromise<Response>;
|
|
948
931
|
|
|
949
932
|
/**
|
|
@@ -1412,7 +1395,7 @@ declare module '@sveltejs/kit' {
|
|
|
1412
1395
|
/**
|
|
1413
1396
|
* The URL of the current page.
|
|
1414
1397
|
*/
|
|
1415
|
-
url:
|
|
1398
|
+
url: ReadonlyURL & { readonly pathname: ResolvedPathname | (string & {}) };
|
|
1416
1399
|
/**
|
|
1417
1400
|
* The parameters of the current page - e.g. for a route like `/blog/[slug]`, a `{ slug: string }` object.
|
|
1418
1401
|
*/
|
|
@@ -1713,7 +1696,9 @@ declare module '@sveltejs/kit' {
|
|
|
1713
1696
|
*/
|
|
1714
1697
|
filterSerializedResponseHeaders?: (name: string, value: string) => boolean;
|
|
1715
1698
|
/**
|
|
1716
|
-
* Determines
|
|
1699
|
+
* Determines which files should be preloaded. Files are preloaded via `<link>` tags added to the
|
|
1700
|
+
* `<head>` tag; if `output.linkHeaderPreload` is enabled, dynamically rendered pages use the
|
|
1701
|
+
* [`Link` response header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link) instead.
|
|
1717
1702
|
* By default, `js` and `css` files will be preloaded.
|
|
1718
1703
|
* @param input the type of the file and its path
|
|
1719
1704
|
*/
|
|
@@ -1748,25 +1733,17 @@ declare module '@sveltejs/kit' {
|
|
|
1748
1733
|
read?: (file: string) => MaybePromise<ReadableStream | null>;
|
|
1749
1734
|
}
|
|
1750
1735
|
|
|
1736
|
+
/**
|
|
1737
|
+
* Information required to instantiate a new `Server` instance.
|
|
1738
|
+
*/
|
|
1751
1739
|
export interface SSRManifest {
|
|
1740
|
+
/** The directory where SvelteKit keeps its stuff, including static assets (such as JS and CSS) and internally-used routes. */
|
|
1752
1741
|
appDir: string;
|
|
1742
|
+
/** The `base` and `appDir` settings combined without a leading slash. */
|
|
1753
1743
|
appPath: string;
|
|
1754
1744
|
/** Static files from `config.files.assets` and the service worker (if any). */
|
|
1755
1745
|
assets: Set<string>;
|
|
1756
1746
|
mimeTypes: Record<string, string>;
|
|
1757
|
-
|
|
1758
|
-
/** private fields */
|
|
1759
|
-
_: {
|
|
1760
|
-
client: BuildData['client'];
|
|
1761
|
-
nodes: SSRNodeLoader[];
|
|
1762
|
-
/** hashed filename -> import to that file */
|
|
1763
|
-
remotes: Record<string, () => Promise<any>>;
|
|
1764
|
-
routes: SSRRoute[];
|
|
1765
|
-
prerendered_routes: Set<string>;
|
|
1766
|
-
matchers: () => Promise<Record<string, ParamMatcher>>;
|
|
1767
|
-
/** A `[file]: size` map of all assets imported by server code. */
|
|
1768
|
-
server_assets: Record<string, number>;
|
|
1769
|
-
};
|
|
1770
1747
|
}
|
|
1771
1748
|
|
|
1772
1749
|
/**
|
|
@@ -1951,6 +1928,14 @@ declare module '@sveltejs/kit' {
|
|
|
1951
1928
|
restore: (snapshot: T) => void;
|
|
1952
1929
|
}
|
|
1953
1930
|
|
|
1931
|
+
export type ReadonlyURLSearchParams = Omit<URLSearchParams, 'set' | 'append' | 'delete' | 'sort'>;
|
|
1932
|
+
|
|
1933
|
+
export type ReadonlyURL = Readonly<
|
|
1934
|
+
Omit<URL, 'searchParams'> & {
|
|
1935
|
+
searchParams: ReadonlyURLSearchParams;
|
|
1936
|
+
}
|
|
1937
|
+
>;
|
|
1938
|
+
|
|
1954
1939
|
// 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
1940
|
type WillRecurseIndefinitely<T> = unknown extends T ? true : string extends keyof T ? true : false;
|
|
1956
1941
|
|
|
@@ -2692,9 +2677,6 @@ declare module '@sveltejs/kit' {
|
|
|
2692
2677
|
rest: boolean;
|
|
2693
2678
|
}
|
|
2694
2679
|
|
|
2695
|
-
/** @default 'never' */
|
|
2696
|
-
type TrailingSlash = 'never' | 'always' | 'ignore';
|
|
2697
|
-
|
|
2698
2680
|
type DeepPartial<T> = T extends Record<PropertyKey, unknown> | unknown[]
|
|
2699
2681
|
? {
|
|
2700
2682
|
[K in keyof T]?: T[K] extends Record<PropertyKey, unknown> | unknown[]
|
|
@@ -2704,87 +2686,6 @@ declare module '@sveltejs/kit' {
|
|
|
2704
2686
|
: T | undefined;
|
|
2705
2687
|
|
|
2706
2688
|
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
2707
|
-
interface Asset {
|
|
2708
|
-
file: string;
|
|
2709
|
-
size: number;
|
|
2710
|
-
type: string | null;
|
|
2711
|
-
}
|
|
2712
|
-
|
|
2713
|
-
interface BuildData {
|
|
2714
|
-
app_dir: string;
|
|
2715
|
-
app_path: string;
|
|
2716
|
-
manifest_data: ManifestData;
|
|
2717
|
-
out_dir: string;
|
|
2718
|
-
service_worker: string | null;
|
|
2719
|
-
client: {
|
|
2720
|
-
/** Path to the client entry point. */
|
|
2721
|
-
start: string;
|
|
2722
|
-
/** Path to the generated `app.js` file that contains the client manifest. Only set in case of `bundleStrategy === 'split'`. */
|
|
2723
|
-
app?: string;
|
|
2724
|
-
/** JS files that the client entry point relies on. */
|
|
2725
|
-
imports: string[];
|
|
2726
|
-
/**
|
|
2727
|
-
* JS files that represent the entry points of the layouts/pages.
|
|
2728
|
-
* An entry is undefined if the layout/page has no component or universal file (i.e. only has a `.server.js` file).
|
|
2729
|
-
* Only set in case of `router.resolution === 'server'`.
|
|
2730
|
-
*/
|
|
2731
|
-
nodes?: Array<string | undefined>;
|
|
2732
|
-
/**
|
|
2733
|
-
* CSS files referenced in the entry points of the layouts/pages.
|
|
2734
|
-
* An entry is undefined if the layout/page has no component or universal file (i.e. only has a `.server.js` file) or if has no CSS.
|
|
2735
|
-
* Only set in case of `router.resolution === 'server'`.
|
|
2736
|
-
*/
|
|
2737
|
-
css?: Array<string[] | undefined>;
|
|
2738
|
-
/**
|
|
2739
|
-
* Contains the client route manifest in a form suitable for the server which is used for server-side route resolution.
|
|
2740
|
-
* Notably, it contains all routes, regardless of whether they are prerendered or not (those are missing in the optimized server route manifest).
|
|
2741
|
-
* Only set in case of `router.resolution === 'server'`.
|
|
2742
|
-
*/
|
|
2743
|
-
routes?: SSRClientRoute[];
|
|
2744
|
-
stylesheets: string[];
|
|
2745
|
-
fonts: string[];
|
|
2746
|
-
/**
|
|
2747
|
-
* Whether the client uses public dynamic env vars — `$env/dynamic/public` or `$app/env/public`.
|
|
2748
|
-
*/
|
|
2749
|
-
uses_env_dynamic_public: boolean;
|
|
2750
|
-
/** Only set in case of `bundleStrategy === 'inline'`. */
|
|
2751
|
-
inline?: {
|
|
2752
|
-
script: string;
|
|
2753
|
-
style: string | undefined;
|
|
2754
|
-
};
|
|
2755
|
-
} | null;
|
|
2756
|
-
server_manifest: import('vite').Manifest;
|
|
2757
|
-
}
|
|
2758
|
-
|
|
2759
|
-
interface ManifestData {
|
|
2760
|
-
/** Static files from `config.files.assets`. */
|
|
2761
|
-
assets: Asset[];
|
|
2762
|
-
hooks: {
|
|
2763
|
-
client: string | null;
|
|
2764
|
-
server: string | null;
|
|
2765
|
-
universal: string | null;
|
|
2766
|
-
};
|
|
2767
|
-
nodes: PageNode[];
|
|
2768
|
-
routes: RouteData[];
|
|
2769
|
-
params: string | null;
|
|
2770
|
-
}
|
|
2771
|
-
|
|
2772
|
-
interface PageNode {
|
|
2773
|
-
depth: number;
|
|
2774
|
-
/** The `+page/layout.svelte`. */
|
|
2775
|
-
component?: string; // TODO supply default component if it's missing (bit of an edge case)
|
|
2776
|
-
/** The `+page/layout.js/.ts`. */
|
|
2777
|
-
universal?: string;
|
|
2778
|
-
/** The `+page/layout.server.js/ts`. */
|
|
2779
|
-
server?: string;
|
|
2780
|
-
parent_id?: string;
|
|
2781
|
-
parent?: PageNode;
|
|
2782
|
-
/** Filled with the pages that reference this layout (if this is a layout). */
|
|
2783
|
-
child_pages?: PageNode[];
|
|
2784
|
-
/** The final page options for a node if it was statically analysable */
|
|
2785
|
-
page_options?: PageOptions | null;
|
|
2786
|
-
}
|
|
2787
|
-
|
|
2788
2689
|
type RecursiveRequired<T> = {
|
|
2789
2690
|
// Recursive implementation of TypeScript's Required utility type.
|
|
2790
2691
|
// Will recursively continue until it reaches a primitive or Function
|
|
@@ -2794,152 +2695,6 @@ declare module '@sveltejs/kit' {
|
|
|
2794
2695
|
: T[K]; // Use the exact type for everything else
|
|
2795
2696
|
};
|
|
2796
2697
|
|
|
2797
|
-
interface RouteParam {
|
|
2798
|
-
name: string;
|
|
2799
|
-
matcher: string;
|
|
2800
|
-
optional: boolean;
|
|
2801
|
-
rest: boolean;
|
|
2802
|
-
chained: boolean;
|
|
2803
|
-
}
|
|
2804
|
-
|
|
2805
|
-
/**
|
|
2806
|
-
* Represents a route segment in the app. It can either be an intermediate node
|
|
2807
|
-
* with only layout/error pages, or a leaf, at which point either `page` and `leaf`
|
|
2808
|
-
* or `endpoint` is set.
|
|
2809
|
-
*/
|
|
2810
|
-
interface RouteData {
|
|
2811
|
-
id: string;
|
|
2812
|
-
parent: RouteData | null;
|
|
2813
|
-
|
|
2814
|
-
segment: string;
|
|
2815
|
-
pattern: RegExp;
|
|
2816
|
-
params: RouteParam[];
|
|
2817
|
-
|
|
2818
|
-
layout: PageNode | null;
|
|
2819
|
-
error: PageNode | null;
|
|
2820
|
-
leaf: PageNode | null;
|
|
2821
|
-
|
|
2822
|
-
page: {
|
|
2823
|
-
layouts: Array<number | undefined>;
|
|
2824
|
-
errors: Array<number | undefined>;
|
|
2825
|
-
leaf: number;
|
|
2826
|
-
} | null;
|
|
2827
|
-
|
|
2828
|
-
endpoint: {
|
|
2829
|
-
file: string;
|
|
2830
|
-
/** The final page options for the endpoint if it was statically analysable */
|
|
2831
|
-
page_options: PageOptions | null;
|
|
2832
|
-
} | null;
|
|
2833
|
-
}
|
|
2834
|
-
|
|
2835
|
-
// TODO get rid of this in favor us using just import('svelte').Component<any, any, any>
|
|
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>;
|
|
2856
|
-
|
|
2857
|
-
interface UniversalNode {
|
|
2858
|
-
/** Is `null` in case static analysis succeeds but the node is ssr=false */
|
|
2859
|
-
load?: Load;
|
|
2860
|
-
prerender?: PrerenderOption;
|
|
2861
|
-
ssr?: boolean;
|
|
2862
|
-
csr?: boolean;
|
|
2863
|
-
trailingSlash?: TrailingSlash;
|
|
2864
|
-
config?: any;
|
|
2865
|
-
entries?: PrerenderEntryGenerator;
|
|
2866
|
-
}
|
|
2867
|
-
|
|
2868
|
-
interface ServerNode {
|
|
2869
|
-
load?: ServerLoad;
|
|
2870
|
-
prerender?: PrerenderOption;
|
|
2871
|
-
ssr?: boolean;
|
|
2872
|
-
csr?: boolean;
|
|
2873
|
-
trailingSlash?: TrailingSlash;
|
|
2874
|
-
actions?: Actions;
|
|
2875
|
-
config?: any;
|
|
2876
|
-
entries?: PrerenderEntryGenerator;
|
|
2877
|
-
}
|
|
2878
|
-
|
|
2879
|
-
interface SSRNode {
|
|
2880
|
-
/** index into the `nodes` array in the generated `client/app.js`. */
|
|
2881
|
-
index: number;
|
|
2882
|
-
/** external JS files that are loaded on the client. `imports[0]` is the entry point (e.g. `client/nodes/0.js`) */
|
|
2883
|
-
imports: string[];
|
|
2884
|
-
/** external CSS files that are loaded on the client */
|
|
2885
|
-
stylesheets: string[];
|
|
2886
|
-
/** external font files that are loaded on the client */
|
|
2887
|
-
fonts: string[];
|
|
2888
|
-
|
|
2889
|
-
universal_id?: string;
|
|
2890
|
-
server_id?: string;
|
|
2891
|
-
|
|
2892
|
-
/**
|
|
2893
|
-
* During development, all styles are inlined for the page to avoid FOUC.
|
|
2894
|
-
* But in production, this stores styles that are below the inline threshold
|
|
2895
|
-
*/
|
|
2896
|
-
inline_styles?(): MaybePromise<
|
|
2897
|
-
Record<string, string | ((assets: string, base: string) => string)>
|
|
2898
|
-
>;
|
|
2899
|
-
/** Svelte component */
|
|
2900
|
-
component?: SSRComponentLoader;
|
|
2901
|
-
/** +page.js or +layout.js */
|
|
2902
|
-
universal?: UniversalNode;
|
|
2903
|
-
/** +page.server.js, +layout.server.js, or +server.js */
|
|
2904
|
-
server?: ServerNode;
|
|
2905
|
-
}
|
|
2906
|
-
|
|
2907
|
-
type SSRNodeLoader = () => Promise<SSRNode>;
|
|
2908
|
-
|
|
2909
|
-
interface PageNodeIndexes {
|
|
2910
|
-
errors: Array<number | undefined>;
|
|
2911
|
-
layouts: Array<number | undefined>;
|
|
2912
|
-
leaf: number;
|
|
2913
|
-
}
|
|
2914
|
-
|
|
2915
|
-
type PrerenderEntryGenerator = () => MaybePromise<Array<Record<string, string>>>;
|
|
2916
|
-
|
|
2917
|
-
type SSREndpoint = Partial<Record<HttpMethod, RequestHandler>> & {
|
|
2918
|
-
prerender?: PrerenderOption;
|
|
2919
|
-
trailingSlash?: TrailingSlash;
|
|
2920
|
-
config?: any;
|
|
2921
|
-
entries?: PrerenderEntryGenerator;
|
|
2922
|
-
fallback?: RequestHandler;
|
|
2923
|
-
};
|
|
2924
|
-
|
|
2925
|
-
interface SSRRoute {
|
|
2926
|
-
id: string;
|
|
2927
|
-
pattern: RegExp;
|
|
2928
|
-
params: RouteParam[];
|
|
2929
|
-
page: PageNodeIndexes | null;
|
|
2930
|
-
endpoint: (() => Promise<SSREndpoint>) | null;
|
|
2931
|
-
endpoint_id?: string;
|
|
2932
|
-
}
|
|
2933
|
-
|
|
2934
|
-
interface SSRClientRoute {
|
|
2935
|
-
id: string;
|
|
2936
|
-
pattern: RegExp;
|
|
2937
|
-
params: RouteParam[];
|
|
2938
|
-
errors: Array<number | undefined>;
|
|
2939
|
-
layouts: Array<[has_server_load: boolean, node_id: number] | undefined>;
|
|
2940
|
-
leaf: [has_server_load: boolean, node_id: number];
|
|
2941
|
-
}
|
|
2942
|
-
|
|
2943
2698
|
type ValidatedConfig = Omit<Config, 'kit'> & {
|
|
2944
2699
|
kit: ValidatedKitConfig;
|
|
2945
2700
|
extensions: string[];
|
|
@@ -3058,7 +2813,7 @@ declare module '@sveltejs/kit' {
|
|
|
3058
2813
|
* ```ts
|
|
3059
2814
|
* import { invalid } from '@sveltejs/kit';
|
|
3060
2815
|
* import { form } from '$app/server';
|
|
3061
|
-
* import { tryLogin } from '
|
|
2816
|
+
* import { tryLogin } from '#lib/server/auth';
|
|
3062
2817
|
* import * as v from 'valibot';
|
|
3063
2818
|
*
|
|
3064
2819
|
* export const login = form(
|
|
@@ -3100,19 +2855,7 @@ declare module '@sveltejs/kit' {
|
|
|
3100
2855
|
wasNormalized: boolean;
|
|
3101
2856
|
denormalize: (url?: string | URL) => URL;
|
|
3102
2857
|
};
|
|
3103
|
-
type ValidPageOption = (typeof valid_page_options_array)[number];
|
|
3104
|
-
|
|
3105
|
-
type PageOptions = Partial<{
|
|
3106
|
-
[K in ValidPageOption]: K extends 'ssr' | 'csr'
|
|
3107
|
-
? boolean
|
|
3108
|
-
: K extends 'prerender'
|
|
3109
|
-
? PrerenderOption
|
|
3110
|
-
: K extends 'trailingSlash'
|
|
3111
|
-
? TrailingSlash
|
|
3112
|
-
: any;
|
|
3113
|
-
}>;
|
|
3114
2858
|
export const VERSION: string;
|
|
3115
|
-
const valid_page_options_array: readonly ["ssr", "prerender", "csr", "trailingSlash", "config", "entries", "load"];
|
|
3116
2859
|
|
|
3117
2860
|
export {};
|
|
3118
2861
|
}
|
|
@@ -3192,6 +2935,8 @@ declare module '@sveltejs/kit/hooks' {
|
|
|
3192
2935
|
* first post-processing
|
|
3193
2936
|
* ```
|
|
3194
2937
|
*
|
|
2938
|
+
* Calling `resolve` invokes the next handler in the sequence (or SvelteKit itself, if it is the last one). To pass data between handlers, use `event.locals`.
|
|
2939
|
+
*
|
|
3195
2940
|
* @param handlers The chain of `handle` functions
|
|
3196
2941
|
* */
|
|
3197
2942
|
export function sequence(...handlers: Handle[]): Handle;
|
|
@@ -3204,9 +2949,9 @@ declare module '@sveltejs/kit/node' {
|
|
|
3204
2949
|
request: import("http").IncomingMessage;
|
|
3205
2950
|
base: string;
|
|
3206
2951
|
bodySizeLimit?: number;
|
|
3207
|
-
}):
|
|
2952
|
+
}): Request;
|
|
3208
2953
|
|
|
3209
|
-
export function setResponse(res: import("http").ServerResponse, response: Response):
|
|
2954
|
+
export function setResponse(res: import("http").ServerResponse, response: Response): void;
|
|
3210
2955
|
/**
|
|
3211
2956
|
* Converts a file on disk to a readable stream
|
|
3212
2957
|
* @since 2.4.0
|
|
@@ -3362,8 +3107,9 @@ declare module '$app/navigation' {
|
|
|
3362
3107
|
replaceState?: boolean | undefined;
|
|
3363
3108
|
noScroll?: boolean | undefined;
|
|
3364
3109
|
keepFocus?: boolean | undefined;
|
|
3365
|
-
|
|
3110
|
+
refreshAll?: boolean | undefined;
|
|
3366
3111
|
invalidate?: (string | URL | ((url: URL) => boolean))[] | undefined;
|
|
3112
|
+
invalidateAll?: boolean | undefined;
|
|
3367
3113
|
state?: App.PageState | undefined;
|
|
3368
3114
|
}): Promise<void>;
|
|
3369
3115
|
/**
|
|
@@ -3382,19 +3128,22 @@ declare module '$app/navigation' {
|
|
|
3382
3128
|
* invalidate((url) => url.pathname === '/path');
|
|
3383
3129
|
* ```
|
|
3384
3130
|
* @param resource The invalidated URL
|
|
3131
|
+
* @param keepState If `true`, the current `page.state` will be preserved. Otherwise, it will be reset to an empty object. `false` by default.
|
|
3385
3132
|
* */
|
|
3386
|
-
export function invalidate(resource: string | URL | ((url: URL) => boolean)): Promise<void>;
|
|
3133
|
+
export function invalidate(resource: string | URL | ((url: URL) => boolean), keepState?: boolean): Promise<void>;
|
|
3387
3134
|
/**
|
|
3388
3135
|
* 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.
|
|
3136
|
+
*
|
|
3137
|
+
* 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.
|
|
3138
|
+
*
|
|
3139
|
+
* @deprecated Use [`refreshAll`](https://svelte.dev/docs/kit/$app-navigation#refreshAll) instead. Unlike `invalidateAll`, `refreshAll` does not reset `page.state`.
|
|
3389
3140
|
* */
|
|
3390
3141
|
export function invalidateAll(): Promise<void>;
|
|
3391
3142
|
/**
|
|
3392
|
-
* Causes all currently active remote functions to refresh, and all `load` functions belonging to the currently active page to re-run
|
|
3143
|
+
* Causes all currently active remote functions to refresh, and all `load` functions belonging to the currently active page to re-run.
|
|
3393
3144
|
* Returns a `Promise` that resolves when the page is subsequently updated.
|
|
3394
3145
|
* */
|
|
3395
|
-
export function refreshAll(
|
|
3396
|
-
includeLoadFunctions?: boolean;
|
|
3397
|
-
}): Promise<void>;
|
|
3146
|
+
export function refreshAll(): Promise<void>;
|
|
3398
3147
|
/**
|
|
3399
3148
|
* Programmatically preloads the given page, which means
|
|
3400
3149
|
* 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",
|
|
@@ -126,27 +128,9 @@
|
|
|
126
128
|
"PrerenderOption",
|
|
127
129
|
"RequestOptions",
|
|
128
130
|
"RouteSegment",
|
|
129
|
-
"TrailingSlash",
|
|
130
131
|
"DeepPartial",
|
|
131
132
|
"IsAny",
|
|
132
|
-
"Asset",
|
|
133
|
-
"BuildData",
|
|
134
|
-
"ManifestData",
|
|
135
|
-
"PageNode",
|
|
136
133
|
"RecursiveRequired",
|
|
137
|
-
"RouteParam",
|
|
138
|
-
"RouteData",
|
|
139
|
-
"SSRComponent",
|
|
140
|
-
"SSRComponentLoader",
|
|
141
|
-
"UniversalNode",
|
|
142
|
-
"ServerNode",
|
|
143
|
-
"SSRNode",
|
|
144
|
-
"SSRNodeLoader",
|
|
145
|
-
"PageNodeIndexes",
|
|
146
|
-
"PrerenderEntryGenerator",
|
|
147
|
-
"SSREndpoint",
|
|
148
|
-
"SSRRoute",
|
|
149
|
-
"SSRClientRoute",
|
|
150
134
|
"ValidatedConfig",
|
|
151
135
|
"ValidatedKitConfig",
|
|
152
136
|
"isHttpError",
|
|
@@ -158,10 +142,7 @@
|
|
|
158
142
|
"invalid",
|
|
159
143
|
"isValidationError",
|
|
160
144
|
"normalizeUrl",
|
|
161
|
-
"ValidPageOption",
|
|
162
|
-
"PageOptions",
|
|
163
145
|
"VERSION",
|
|
164
|
-
"valid_page_options_array",
|
|
165
146
|
"defineEnvVars",
|
|
166
147
|
"sequence",
|
|
167
148
|
"getRequest",
|
|
@@ -206,9 +187,7 @@
|
|
|
206
187
|
"../src/types/private.d.ts",
|
|
207
188
|
"../src/types/internal.d.ts",
|
|
208
189
|
"../src/exports/index.js",
|
|
209
|
-
"../src/exports/vite/static_analysis/types.d.ts",
|
|
210
190
|
"../src/version.js",
|
|
211
|
-
"../src/exports/vite/static_analysis/index.js",
|
|
212
191
|
"../src/exports/hooks/index.js",
|
|
213
192
|
"../src/exports/hooks/sequence.js",
|
|
214
193
|
"../src/exports/node/index.js",
|
|
@@ -239,10 +218,8 @@
|
|
|
239
218
|
null,
|
|
240
219
|
null,
|
|
241
220
|
null,
|
|
242
|
-
null,
|
|
243
|
-
null,
|
|
244
221
|
null
|
|
245
222
|
],
|
|
246
|
-
"mappings": ";;;;;;;;;MAmCKA,IAAIA;;MAEJC,0BAA0BA;;;;;kBAKdC,OAAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAwCZC,cAAcA;;;;;;aAMdC,cAAcA;;;;;;;;MAQrBC,aAAaA;;;;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,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
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
This is a simple alias to `src/lib`, or whatever directory is specified as [`config.files.lib`](https://svelte.dev/docs/kit/configuration#files). It allows you to access common components and utility modules without `../../../../` nonsense.
|
|
2
|
-
|
|
3
|
-
### `$lib/server`
|
|
4
|
-
|
|
5
|
-
A subdirectory of `$lib`. SvelteKit will prevent you from importing any modules in `$lib/server` into client-side code. See [server-only modules](https://svelte.dev/docs/kit/server-only-modules).
|