@sveltejs/kit 3.0.0-next.23 → 3.0.0-next.24
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 +40 -5
- package/src/cli.js +3 -3
- package/src/constants.js +13 -1
- package/src/core/adapt/builder.js +2 -3
- package/src/core/env.js +139 -181
- package/src/core/postbuild/analyse.js +9 -4
- package/src/core/postbuild/prerender.js +3 -4
- package/src/core/sync/create_manifest_data/index.js +29 -33
- package/src/core/sync/sync.js +23 -40
- package/src/core/sync/write_app_manifest.js +83 -0
- package/src/core/sync/write_client_manifest.js +6 -4
- package/src/core/sync/write_server.js +10 -6
- package/src/core/sync/write_types/index.js +2 -2
- package/src/core/utils.js +0 -28
- package/src/exports/hooks/public.d.ts +9 -1
- package/src/exports/node/index.js +77 -5
- package/src/exports/vite/build/build_server.js +3 -3
- package/src/exports/vite/build/utils.js +48 -4
- package/src/exports/vite/dev/index.js +11 -22
- package/src/exports/vite/index.js +62 -345
- package/src/exports/vite/module_ids.js +1 -11
- package/src/exports/vite/plugins/env-vars.js +117 -0
- package/src/exports/vite/preview/index.js +6 -4
- package/src/exports/vite/utils.js +2 -4
- package/src/runtime/app/env/{types.d.ts → client.js} +9 -4
- package/src/runtime/app/env/index.js +1 -2
- package/src/runtime/app/env/private/index.js +1 -0
- package/src/runtime/app/env/public/client.js +1 -1
- package/src/runtime/app/env/public/server.js +1 -1
- package/src/runtime/app/env/{internal.js → server.js} +4 -4
- package/src/runtime/app/forms/client.js +263 -0
- package/src/runtime/app/forms/index.js +1 -263
- package/src/runtime/app/forms/public.d.ts +1 -1
- package/src/runtime/app/forms/server.js +6 -0
- package/src/runtime/app/forms/shared.js +34 -0
- package/src/runtime/app/manifest/index.js +1 -1
- package/src/runtime/app/navigation/client.js +15 -0
- package/src/runtime/app/navigation/index.js +1 -15
- package/src/runtime/app/navigation/public.d.ts +1 -1
- package/src/runtime/app/navigation/server.js +15 -0
- package/src/runtime/app/paths/server.js +1 -1
- package/src/runtime/app/server/remote/form.js +11 -1
- package/src/runtime/app/server/remote/prerender.js +1 -2
- package/src/runtime/app/server/remote/query.js +1 -1
- package/src/runtime/app/state/client.svelte.js +207 -0
- package/src/runtime/app/state/index.js +1 -66
- package/src/runtime/app/state/public.d.ts +1 -1
- package/src/runtime/client/bundle.js +1 -1
- package/src/runtime/client/client.js +206 -274
- package/src/runtime/client/fetcher.js +18 -8
- package/src/runtime/client/remote-functions/form.svelte.js +9 -6
- package/src/runtime/client/remote-functions/prerender.svelte.js +1 -1
- package/src/runtime/client/remote-functions/query-live/iterator.js +1 -1
- package/src/runtime/client/remote-functions/shared.svelte.js +2 -2
- package/src/runtime/client/snapshots.js +1 -3
- package/src/runtime/client/stream.js +27 -20
- package/src/runtime/client/utils.js +7 -3
- package/src/runtime/components/root.svelte +5 -5
- package/src/runtime/env/dynamic/private.js +1 -1
- package/src/runtime/env/static/private.js +1 -1
- package/src/runtime/error-chain.js +54 -0
- package/src/runtime/form-utils.js +53 -77
- package/src/runtime/invalid-import.js +1 -0
- package/src/runtime/props.svelte.js +1 -1
- package/src/runtime/server/data/index.js +1 -1
- package/src/runtime/server/endpoint.js +8 -3
- package/src/runtime/server/env_module.js +1 -1
- package/src/runtime/server/errors.js +2 -2
- package/src/runtime/server/index.js +2 -2
- package/src/runtime/server/page/actions.js +77 -122
- package/src/runtime/server/page/index.js +37 -69
- package/src/runtime/server/page/render.js +18 -23
- package/src/runtime/server/remote-functions.js +14 -42
- package/src/runtime/server/respond.js +23 -3
- package/src/telemetry.js +1 -33
- package/src/types/ambient-private.d.ts +9 -17
- package/src/types/internal.d.ts +20 -4
- package/src/types/private.d.ts +1 -1
- package/src/utils/exports.js +1 -0
- package/src/utils/filesystem.js +9 -21
- package/src/utils/functions.js +10 -0
- package/src/utils/routing.js +0 -11
- package/src/utils/url.js +0 -11
- package/src/version.js +1 -1
- package/types/index.d.ts +34 -28
- package/types/index.d.ts.map +7 -5
- package/src/runtime/app/env/private.js +0 -1
- package/src/runtime/app/env/standard-schema.d.ts +0 -0
- package/src/runtime/app/state/client.js +0 -63
- package/src/runtime/client/state.svelte.js +0 -98
- package/src/runtime/server/ambient.d.ts +0 -4
- package/src/utils/path.js +0 -23
package/src/telemetry.js
CHANGED
|
@@ -1,36 +1,4 @@
|
|
|
1
|
-
/** @import {
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Tracer implementation that does nothing (null object).
|
|
5
|
-
* @type {Tracer}
|
|
6
|
-
*/
|
|
7
|
-
export const noop_tracer = {
|
|
8
|
-
/**
|
|
9
|
-
* @returns {Span}
|
|
10
|
-
*/
|
|
11
|
-
startSpan() {
|
|
12
|
-
return noop_span;
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @param {unknown} _name
|
|
17
|
-
* @param {unknown} arg_1
|
|
18
|
-
* @param {unknown} [arg_2]
|
|
19
|
-
* @param {Function} [arg_3]
|
|
20
|
-
* @returns {unknown}
|
|
21
|
-
*/
|
|
22
|
-
startActiveSpan(_name, arg_1, arg_2, arg_3) {
|
|
23
|
-
if (typeof arg_1 === 'function') {
|
|
24
|
-
return arg_1(noop_span);
|
|
25
|
-
}
|
|
26
|
-
if (typeof arg_2 === 'function') {
|
|
27
|
-
return arg_2(noop_span);
|
|
28
|
-
}
|
|
29
|
-
if (typeof arg_3 === 'function') {
|
|
30
|
-
return arg_3(noop_span);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
};
|
|
1
|
+
/** @import { Span, SpanContext } from '@opentelemetry/api' */
|
|
34
2
|
|
|
35
3
|
/**
|
|
36
4
|
* @type {Span}
|
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
/** Internal version of $app/paths */
|
|
2
|
-
declare module '__sveltekit/paths' {
|
|
3
|
-
export let base: '' | `/${string}`;
|
|
4
|
-
export let assets: '' | `https://${string}` | `http://${string}` | '/_svelte_kit_assets';
|
|
5
|
-
export let app_dir: string;
|
|
6
|
-
export let relative: boolean;
|
|
7
|
-
export function reset(): void;
|
|
8
|
-
export function override(paths: { base: string; assets: string }): void;
|
|
9
|
-
export function set_assets(path: string): void;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
1
|
/** Internal version of $app/server */
|
|
13
|
-
declare module '
|
|
2
|
+
declare module '<sveltekit:generated>/server.js' {
|
|
14
3
|
import { SSRManifest } from '@sveltejs/kit';
|
|
4
|
+
import { SSROptions, ServerHooks } from 'types';
|
|
15
5
|
|
|
6
|
+
export const options: SSROptions;
|
|
7
|
+
export const get_hooks: () => Promise<Partial<ServerHooks>>;
|
|
16
8
|
export let fix_stack_trace: (error: Error) => string;
|
|
17
9
|
export let manifest: SSRManifest;
|
|
18
10
|
export function read_implementation(path: string): ReadableStream;
|
|
@@ -21,7 +13,7 @@ declare module '__sveltekit/server' {
|
|
|
21
13
|
export function set_read_implementation(fn: (path: string) => ReadableStream): void;
|
|
22
14
|
}
|
|
23
15
|
|
|
24
|
-
declare module '
|
|
16
|
+
declare module '<sveltekit:generated>/env/config.js' {
|
|
25
17
|
// exported environment variables are defined in env.d.ts
|
|
26
18
|
|
|
27
19
|
/** Populate exported environment variables */
|
|
@@ -34,20 +26,20 @@ declare module '__sveltekit/env' {
|
|
|
34
26
|
export const rendered_env: Record<string, any>;
|
|
35
27
|
}
|
|
36
28
|
|
|
37
|
-
declare module '
|
|
29
|
+
declare module '<sveltekit:generated>/env/private/server.js' {
|
|
38
30
|
// exported environment variables are defined in env.d.ts
|
|
39
31
|
}
|
|
40
32
|
|
|
41
|
-
declare module '
|
|
33
|
+
declare module '<sveltekit:generated>/env/public/client.js' {
|
|
42
34
|
// exported environment variables are defined in env.d.ts
|
|
43
35
|
}
|
|
44
36
|
|
|
45
|
-
declare module '
|
|
37
|
+
declare module '<sveltekit:generated>/env/public/server.js' {
|
|
46
38
|
// exported environment variables are defined in env.d.ts
|
|
47
39
|
}
|
|
48
40
|
|
|
49
41
|
/** Internal version of $app/manifest */
|
|
50
|
-
declare module '
|
|
42
|
+
declare module '<sveltekit:generated>/app-manifest.js' {
|
|
51
43
|
export const immutable: Array<{ path: string }>;
|
|
52
44
|
export const assets: Array<{ path: string }>;
|
|
53
45
|
export const prerendered: Array<{ path: string }>;
|
package/src/types/internal.d.ts
CHANGED
|
@@ -8,7 +8,8 @@ import {
|
|
|
8
8
|
Actions,
|
|
9
9
|
RequestEvent,
|
|
10
10
|
SSRManifest,
|
|
11
|
-
Emulator
|
|
11
|
+
Emulator,
|
|
12
|
+
HttpError
|
|
12
13
|
} from '@sveltejs/kit';
|
|
13
14
|
import { RemoteFormIssue, RemoteQuery, RemoteLiveQuery } from '$app/server';
|
|
14
15
|
import { Config } from '@sveltejs/kit/vite';
|
|
@@ -61,10 +62,17 @@ export interface AssetDependencies {
|
|
|
61
62
|
file: string;
|
|
62
63
|
imports: string[];
|
|
63
64
|
stylesheets: string[];
|
|
64
|
-
fonts:
|
|
65
|
+
fonts: FontDependency[];
|
|
65
66
|
stylesheet_map: Map<string, { css: Set<string>; assets: Set<string> }>;
|
|
66
67
|
}
|
|
67
68
|
|
|
69
|
+
export interface FontDependency {
|
|
70
|
+
/** emitted file path, relative to the client output directory */
|
|
71
|
+
file: string;
|
|
72
|
+
/** the source file path relative to the project root, before hashing and character sanitization */
|
|
73
|
+
filename: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
68
76
|
export interface BuildData {
|
|
69
77
|
app_dir: string;
|
|
70
78
|
app_path: string;
|
|
@@ -97,7 +105,7 @@ export interface BuildData {
|
|
|
97
105
|
*/
|
|
98
106
|
routes?: SSRClientRoute[];
|
|
99
107
|
stylesheets: string[];
|
|
100
|
-
fonts:
|
|
108
|
+
fonts: FontDependency[];
|
|
101
109
|
/**
|
|
102
110
|
* Whether the client uses public dynamic env vars — `$env/dynamic/public` or `$app/env/public`.
|
|
103
111
|
*/
|
|
@@ -292,6 +300,14 @@ export interface RouteData {
|
|
|
292
300
|
} | null;
|
|
293
301
|
}
|
|
294
302
|
|
|
303
|
+
/**
|
|
304
|
+
* The server-side form of `ActionResult`, before the error is passed
|
|
305
|
+
* through `handleError` and the data is serialized
|
|
306
|
+
*/
|
|
307
|
+
export type ServerActionResult =
|
|
308
|
+
| Exclude<import('$app/forms').ActionResult, { type: 'error' }>
|
|
309
|
+
| { type: 'error'; location: string; error: Error | HttpError };
|
|
310
|
+
|
|
295
311
|
export type ServerRedirectNode = {
|
|
296
312
|
type: 'redirect';
|
|
297
313
|
status: number;
|
|
@@ -449,7 +465,7 @@ export interface SSRNode {
|
|
|
449
465
|
/** external CSS files that are loaded on the client */
|
|
450
466
|
stylesheets: string[];
|
|
451
467
|
/** external font files that are loaded on the client */
|
|
452
|
-
fonts:
|
|
468
|
+
fonts: FontDependency[];
|
|
453
469
|
|
|
454
470
|
universal_id?: string;
|
|
455
471
|
server_id?: string;
|
package/src/types/private.d.ts
CHANGED
|
@@ -154,7 +154,7 @@ export interface CspDirectives {
|
|
|
154
154
|
>;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
export type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS';
|
|
157
|
+
export type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | 'QUERY';
|
|
158
158
|
|
|
159
159
|
export interface Logger {
|
|
160
160
|
(msg: string): void;
|
package/src/utils/exports.js
CHANGED
package/src/utils/filesystem.js
CHANGED
|
@@ -63,30 +63,18 @@ export function copy(source, target, opts = {}) {
|
|
|
63
63
|
/**
|
|
64
64
|
* Get a list of all files in a directory
|
|
65
65
|
* @param {string} cwd - the directory to walk
|
|
66
|
-
* @param {
|
|
67
|
-
* @returns {string
|
|
66
|
+
* @param {string} [dir] - the subdirectory to walk, relative to `cwd`
|
|
67
|
+
* @returns {Generator<string>} the posix paths of all found files, relative to `cwd`
|
|
68
68
|
*/
|
|
69
|
-
export function walk(cwd,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
for (const file of files) {
|
|
78
|
-
const joined = path.join(dir, file);
|
|
79
|
-
const stats = fs.statSync(path.join(cwd, joined));
|
|
80
|
-
if (stats.isDirectory()) {
|
|
81
|
-
if (dirs) all_files.push(joined);
|
|
82
|
-
walk_dir(joined);
|
|
83
|
-
} else {
|
|
84
|
-
all_files.push(joined);
|
|
85
|
-
}
|
|
69
|
+
export function* walk(cwd, dir = '') {
|
|
70
|
+
for (const file of fs.readdirSync(path.join(cwd, dir))) {
|
|
71
|
+
const joined = dir ? `${dir}/${file}` : file;
|
|
72
|
+
if (fs.statSync(path.join(cwd, joined)).isDirectory()) {
|
|
73
|
+
yield* walk(cwd, joined);
|
|
74
|
+
} else {
|
|
75
|
+
yield joined;
|
|
86
76
|
}
|
|
87
77
|
}
|
|
88
|
-
|
|
89
|
-
return (walk_dir(''), all_files);
|
|
90
78
|
}
|
|
91
79
|
|
|
92
80
|
/**
|
package/src/utils/functions.js
CHANGED
|
@@ -16,3 +16,13 @@ export function once(fn) {
|
|
|
16
16
|
return (result = fn());
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @param {string} name
|
|
22
|
+
* @param {string} [parens]
|
|
23
|
+
*/
|
|
24
|
+
export function disallow_on_server(name, parens = '(...)') {
|
|
25
|
+
return () => {
|
|
26
|
+
throw new Error(`Cannot call \`${name}${parens}\` on the server`);
|
|
27
|
+
};
|
|
28
|
+
}
|
package/src/utils/routing.js
CHANGED
|
@@ -116,17 +116,6 @@ export function parse_route_id(id) {
|
|
|
116
116
|
return { pattern, params };
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
const optional_param_regex = /\/\[\[[\w-]+?(?:=[\w-]+)?\]\]/;
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Removes optional params from a route ID.
|
|
123
|
-
* @param {string} id
|
|
124
|
-
* @returns The route id with optional params removed
|
|
125
|
-
*/
|
|
126
|
-
export function remove_optional_params(id) {
|
|
127
|
-
return id.replace(optional_param_regex, '');
|
|
128
|
-
}
|
|
129
|
-
|
|
130
119
|
/**
|
|
131
120
|
* Returns `false` for `(group)` segments
|
|
132
121
|
* @param {string} segment
|
package/src/utils/url.js
CHANGED
|
@@ -82,17 +82,6 @@ export function decode_pathname(pathname) {
|
|
|
82
82
|
return pathname.split('%25').map(decodeURI).join('%25');
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
/** @param {Record<string, string>} params */
|
|
86
|
-
export function decode_params(params) {
|
|
87
|
-
for (const key in params) {
|
|
88
|
-
// input has already been decoded by decodeURI
|
|
89
|
-
// now handle the rest
|
|
90
|
-
params[key] = decodeURIComponent(params[key]);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return params;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
85
|
/**
|
|
97
86
|
* The error when a URL is malformed is not very helpful, so we augment it with the URI
|
|
98
87
|
* @param {string} uri
|
package/src/version.js
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -828,7 +828,7 @@ declare module '@sveltejs/kit' {
|
|
|
828
828
|
complete(entry: { generateManifest(opts: { relativePath: string }): string }): MaybePromise<void>;
|
|
829
829
|
}
|
|
830
830
|
|
|
831
|
-
type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS';
|
|
831
|
+
type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | 'QUERY';
|
|
832
832
|
|
|
833
833
|
interface Logger {
|
|
834
834
|
(msg: string): void;
|
|
@@ -1317,9 +1317,17 @@ declare module '@sveltejs/kit/hooks' {
|
|
|
1317
1317
|
* `<head>` tag; if `output.linkHeaderPreload` is enabled, dynamically rendered pages use the
|
|
1318
1318
|
* [`Link` response header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link) instead.
|
|
1319
1319
|
* By default, `js` and `css` files will be preloaded.
|
|
1320
|
+
*
|
|
1321
|
+
* For `font` files, `input` also has a `filename` property, the source file's pathname relative
|
|
1322
|
+
* to the project root, so that a filter can match on it instead of the hashed path. `js` and
|
|
1323
|
+
* `css` files are bundled and have no single source file name.
|
|
1320
1324
|
* @param input the type of the file and its path
|
|
1321
1325
|
*/
|
|
1322
|
-
preload?: (
|
|
1326
|
+
preload?: (
|
|
1327
|
+
input:
|
|
1328
|
+
| { type: 'css' | 'js' | 'asset'; path: string }
|
|
1329
|
+
| { type: 'font'; path: string; filename: string }
|
|
1330
|
+
) => boolean;
|
|
1323
1331
|
}
|
|
1324
1332
|
|
|
1325
1333
|
type AppErrorWithOptionalDefaults = Omit<App.Error, 'status' | 'message'> & {
|
|
@@ -1418,8 +1426,9 @@ declare module '@sveltejs/kit/hooks' {
|
|
|
1418
1426
|
}
|
|
1419
1427
|
|
|
1420
1428
|
declare module '@sveltejs/kit/node' {
|
|
1421
|
-
export function getRequest({ request, base, bodySizeLimit }: {
|
|
1429
|
+
export function getRequest({ request, response, base, bodySizeLimit }: {
|
|
1422
1430
|
request: import("http").IncomingMessage;
|
|
1431
|
+
response?: import("http").ServerResponse;
|
|
1423
1432
|
base: string;
|
|
1424
1433
|
bodySizeLimit?: number;
|
|
1425
1434
|
}): Request;
|
|
@@ -2288,19 +2297,16 @@ declare module '@sveltejs/kit/vite' {
|
|
|
2288
2297
|
declare module '$app/env' {
|
|
2289
2298
|
/**
|
|
2290
2299
|
* `true` if the app is running in the browser.
|
|
2291
|
-
*/
|
|
2300
|
+
* */
|
|
2292
2301
|
export const browser: boolean;
|
|
2293
|
-
|
|
2294
2302
|
/**
|
|
2295
2303
|
* Whether the dev server is running. This is not guaranteed to correspond to `NODE_ENV` or `MODE`.
|
|
2296
|
-
*/
|
|
2304
|
+
* */
|
|
2297
2305
|
export const dev: boolean;
|
|
2298
|
-
|
|
2299
2306
|
/**
|
|
2300
2307
|
* SvelteKit analyses your app during the `build` step by running it. During this process, `building` is `true`. This also applies during prerendering.
|
|
2301
|
-
*/
|
|
2308
|
+
* */
|
|
2302
2309
|
export const building: boolean;
|
|
2303
|
-
|
|
2304
2310
|
/**
|
|
2305
2311
|
* The value of `config.version.name`.
|
|
2306
2312
|
*/
|
|
@@ -2310,25 +2316,6 @@ declare module '$app/env' {
|
|
|
2310
2316
|
}
|
|
2311
2317
|
|
|
2312
2318
|
declare module '$app/forms' {
|
|
2313
|
-
/**
|
|
2314
|
-
* Use this function to deserialize the response from a form submission.
|
|
2315
|
-
* Usage:
|
|
2316
|
-
*
|
|
2317
|
-
* ```js
|
|
2318
|
-
* import { deserialize } from '$app/forms';
|
|
2319
|
-
*
|
|
2320
|
-
* async function handleSubmit(event) {
|
|
2321
|
-
* const response = await fetch('/form?/action', {
|
|
2322
|
-
* method: 'POST',
|
|
2323
|
-
* body: new FormData(event.target)
|
|
2324
|
-
* });
|
|
2325
|
-
*
|
|
2326
|
-
* const result = deserialize(await response.text());
|
|
2327
|
-
* // ...
|
|
2328
|
-
* }
|
|
2329
|
-
* ```
|
|
2330
|
-
* */
|
|
2331
|
-
export function deserialize<Success extends Record<string, unknown> | undefined, Failure extends Record<string, unknown> | undefined>(result: string): ActionResult<Success, Failure>;
|
|
2332
2319
|
/**
|
|
2333
2320
|
* This action enhances a `<form>` element that otherwise would work without JavaScript.
|
|
2334
2321
|
*
|
|
@@ -2416,6 +2403,25 @@ declare module '$app/forms' {
|
|
|
2416
2403
|
* the redirect location.
|
|
2417
2404
|
* */
|
|
2418
2405
|
export function applyAction<Success extends Record<string, unknown> | undefined, Failure extends Record<string, unknown> | undefined>(result: ActionResult<Success, Failure>): Promise<void>;
|
|
2406
|
+
/**
|
|
2407
|
+
* Use this function to deserialize the response from a form submission.
|
|
2408
|
+
* Usage:
|
|
2409
|
+
*
|
|
2410
|
+
* ```js
|
|
2411
|
+
* import { deserialize } from '$app/forms';
|
|
2412
|
+
*
|
|
2413
|
+
* async function handleSubmit(event) {
|
|
2414
|
+
* const response = await fetch('/form?/action', {
|
|
2415
|
+
* method: 'POST',
|
|
2416
|
+
* body: new FormData(event.target)
|
|
2417
|
+
* });
|
|
2418
|
+
*
|
|
2419
|
+
* const result = deserialize(await response.text());
|
|
2420
|
+
* // ...
|
|
2421
|
+
* }
|
|
2422
|
+
* ```
|
|
2423
|
+
* */
|
|
2424
|
+
export function deserialize<Success extends Record<string, unknown> | undefined, Failure extends Record<string, unknown> | undefined>(result: string): ActionResult<Success, Failure>;
|
|
2419
2425
|
type MaybePromise<T> = T | Promise<T>;
|
|
2420
2426
|
|
|
2421
2427
|
export {};
|
package/types/index.d.ts.map
CHANGED
|
@@ -101,11 +101,11 @@
|
|
|
101
101
|
"dev",
|
|
102
102
|
"building",
|
|
103
103
|
"version",
|
|
104
|
-
"deserialize",
|
|
105
104
|
"enhance",
|
|
106
105
|
"ActionResult",
|
|
107
106
|
"SubmitFunction",
|
|
108
107
|
"applyAction",
|
|
108
|
+
"deserialize",
|
|
109
109
|
"NavigationTarget",
|
|
110
110
|
"GotoOptions",
|
|
111
111
|
"NavigationType",
|
|
@@ -205,10 +205,11 @@
|
|
|
205
205
|
"../src/exports/params/public.d.ts",
|
|
206
206
|
"../src/exports/vite/public.d.ts",
|
|
207
207
|
"../src/exports/vite/index.js",
|
|
208
|
-
"../src/runtime/app/env/
|
|
209
|
-
"../src/runtime/app/forms/
|
|
208
|
+
"../src/runtime/app/env/client.js",
|
|
209
|
+
"../src/runtime/app/forms/client.js",
|
|
210
210
|
"../src/runtime/app/forms/types.d.ts",
|
|
211
211
|
"../src/runtime/client/client.js",
|
|
212
|
+
"../src/runtime/app/forms/shared.js",
|
|
212
213
|
"../src/runtime/app/navigation/public.d.ts",
|
|
213
214
|
"../src/runtime/client/snapshots.js",
|
|
214
215
|
"../src/runtime/app/paths/client.js",
|
|
@@ -218,7 +219,7 @@
|
|
|
218
219
|
"../src/exports/internal/server/event.js",
|
|
219
220
|
"../src/runtime/app/service-worker/index.js",
|
|
220
221
|
"../src/runtime/app/state/public.d.ts",
|
|
221
|
-
"../src/runtime/app/state/
|
|
222
|
+
"../src/runtime/app/state/client.svelte.js"
|
|
222
223
|
],
|
|
223
224
|
"sourcesContent": [
|
|
224
225
|
null,
|
|
@@ -247,8 +248,9 @@
|
|
|
247
248
|
null,
|
|
248
249
|
null,
|
|
249
250
|
null,
|
|
251
|
+
null,
|
|
250
252
|
null
|
|
251
253
|
],
|
|
252
|
-
"mappings": ";;;;;;;;;MAuBKA,IAAIA;;;;;kBAKQC,OAAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aA+CZC,cAAcA;;;;;;aAMdC,cAAcA;;;;;;;;MAQrBC,aAAaA;;;;;OAKJC,YAAYA;;kBAETC,aAAaA;;;;;;;;;kBASbC,eAAeA;;;;;MAK3BC,qBAAqBA;;;;;;;;;;;kBAWTC,OAAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAkJPC,OAAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA6EPC,QAAQA;;;;;;;;;;;;aAYbC,IAAIA;;;;;;;;;;;;kBAYCC,SAASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAyHTC,eAAeA;;;;;;;;;;;;;;;;;;;;;;;kBAuBfC,YAAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;aAkB1BC,8BAA8BA;;;;;;;;;;;;;;;;;;aAkB9BC,eAAeA;;;MpBtJfC,qCAAqCA;;;;;;;;MAqKrCC,8BAA8BA;;;;;;;;;;;;;iBqB3f1BC,IAAIA;MtB6JRjJ,YAAYA;;MAmGZkJ,WAAWA;;;;;;;;MAQXC,KAAKA;;MAELC,qBAAqBA;;;;;;;;;;;;;;;;;iBuBjQjBC,eAAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCflBC,IAAIA;;;;;;;;aCJLC,uBAAuBA;;aAEvBC,WAAWA;;;;;;;;;kBASNC,IAAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cC4CRC,IAAIA;;;;;cA6CJC,UAAUA;;;;;;;;;;;cAoCVC,OAAOA",
|
|
253
255
|
"ignoreList": []
|
|
254
256
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '__sveltekit/env/private';
|
|
File without changes
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
page as _page,
|
|
3
|
-
navigating as _navigating,
|
|
4
|
-
updated as _updated
|
|
5
|
-
} from '../../client/state.svelte.js';
|
|
6
|
-
|
|
7
|
-
export const page = {
|
|
8
|
-
get data() {
|
|
9
|
-
return _page.data;
|
|
10
|
-
},
|
|
11
|
-
get error() {
|
|
12
|
-
return _page.error;
|
|
13
|
-
},
|
|
14
|
-
get form() {
|
|
15
|
-
return _page.form;
|
|
16
|
-
},
|
|
17
|
-
get params() {
|
|
18
|
-
return _page.params;
|
|
19
|
-
},
|
|
20
|
-
get route() {
|
|
21
|
-
return _page.route;
|
|
22
|
-
},
|
|
23
|
-
get shallow() {
|
|
24
|
-
return _page.shallow;
|
|
25
|
-
},
|
|
26
|
-
get state() {
|
|
27
|
-
return _page.state;
|
|
28
|
-
},
|
|
29
|
-
get status() {
|
|
30
|
-
return _page.status;
|
|
31
|
-
},
|
|
32
|
-
get url() {
|
|
33
|
-
return _page.url;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const navigating = {
|
|
38
|
-
get from() {
|
|
39
|
-
return _navigating.current ? _navigating.current.from : null;
|
|
40
|
-
},
|
|
41
|
-
get to() {
|
|
42
|
-
return _navigating.current ? _navigating.current.to : null;
|
|
43
|
-
},
|
|
44
|
-
get type() {
|
|
45
|
-
return _navigating.current ? _navigating.current.type : null;
|
|
46
|
-
},
|
|
47
|
-
get willUnload() {
|
|
48
|
-
return _navigating.current ? _navigating.current.willUnload : null;
|
|
49
|
-
},
|
|
50
|
-
get delta() {
|
|
51
|
-
return _navigating.current?.type === 'popstate' ? _navigating.current.delta : null;
|
|
52
|
-
},
|
|
53
|
-
get complete() {
|
|
54
|
-
return _navigating.current ? _navigating.current.complete : null;
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const updated = {
|
|
59
|
-
get current() {
|
|
60
|
-
return _updated.current;
|
|
61
|
-
},
|
|
62
|
-
check: _updated.check
|
|
63
|
-
};
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/** @import { Navigation } from '$app/navigation' */
|
|
2
|
-
/** @import { Page } from '$app/state' */
|
|
3
|
-
import { version } from '$app/env';
|
|
4
|
-
import { assets } from '#app/paths';
|
|
5
|
-
import { BROWSER, DEV } from 'esm-env';
|
|
6
|
-
|
|
7
|
-
/** @type {Page} */
|
|
8
|
-
export const page = new (class Page {
|
|
9
|
-
data = $state.raw({});
|
|
10
|
-
form = $state.raw(null);
|
|
11
|
-
error = $state.raw(null);
|
|
12
|
-
params = $state.raw({});
|
|
13
|
-
route = $state.raw({ id: null });
|
|
14
|
-
shallow = $state.raw(null);
|
|
15
|
-
state = $state.raw({});
|
|
16
|
-
status = $state.raw(-1);
|
|
17
|
-
url = $state.raw(new URL('a:'));
|
|
18
|
-
})();
|
|
19
|
-
|
|
20
|
-
export const navigating = new (class Navigating {
|
|
21
|
-
/** @type {Navigation | null} */
|
|
22
|
-
current = $state.raw(null);
|
|
23
|
-
})();
|
|
24
|
-
|
|
25
|
-
export const updated = new (class Updated {
|
|
26
|
-
current = $state.raw(false);
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/require-await
|
|
28
|
-
check = async () => false;
|
|
29
|
-
})();
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Internal: mark `updated.current` as `true` if the given version differs.
|
|
33
|
-
* Called from the server response header path. No-op unless version checks
|
|
34
|
-
* are enabled (assigned below). Not exported on the public `updated` object.
|
|
35
|
-
* @type {(new_version: string | null) => void}
|
|
36
|
-
*/
|
|
37
|
-
export let notify_version = () => {};
|
|
38
|
-
|
|
39
|
-
if (!DEV && BROWSER) {
|
|
40
|
-
const interval = __SVELTEKIT_APP_VERSION_POLL_INTERVAL__;
|
|
41
|
-
|
|
42
|
-
/** @type {number | undefined} */
|
|
43
|
-
let timeout;
|
|
44
|
-
|
|
45
|
-
/** @type {Promise<boolean> | undefined} */
|
|
46
|
-
let checking;
|
|
47
|
-
|
|
48
|
-
if (__SVELTEKIT_APP_VERSION_CHECKS_ENABLED__) {
|
|
49
|
-
/**
|
|
50
|
-
* Mark `updated.current` as `true` if the given version differs from the one
|
|
51
|
-
* the app was hydrated with. Called from the server response header path.
|
|
52
|
-
* Does NOT reset the poll timer — unlike `check()`, this is a passive observation
|
|
53
|
-
* from a single server instance's response, not an explicit version check. The
|
|
54
|
-
* poll timer continues on its original schedule as a backstop. This is important
|
|
55
|
-
* for platforms that implement skew protection, where `x-sveltekit-version`
|
|
56
|
-
* may be out of date — in this case we still need to poll for `version.json`.
|
|
57
|
-
* @param {string | null} new_version
|
|
58
|
-
*/
|
|
59
|
-
notify_version = (new_version) => {
|
|
60
|
-
if (new_version && new_version !== version) {
|
|
61
|
-
updated.current = true;
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/** @type {() => Promise<boolean>} */
|
|
67
|
-
updated.check = function check() {
|
|
68
|
-
window.clearTimeout(timeout);
|
|
69
|
-
|
|
70
|
-
if (updated.current) {
|
|
71
|
-
return Promise.resolve(true);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return (checking ??= (async () => {
|
|
75
|
-
try {
|
|
76
|
-
const res = await fetch(`${assets}/${__SVELTEKIT_APP_VERSION_FILE__}`, {
|
|
77
|
-
headers: {
|
|
78
|
-
'cache-control': 'no-cache'
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
if (!res.ok) {
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const data = await res.json();
|
|
87
|
-
return (updated.current ||= data.version !== version);
|
|
88
|
-
} catch {
|
|
89
|
-
return false;
|
|
90
|
-
} finally {
|
|
91
|
-
checking = undefined;
|
|
92
|
-
if (interval && !updated.current) timeout = window.setTimeout(check, interval);
|
|
93
|
-
}
|
|
94
|
-
})());
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
if (interval) timeout = window.setTimeout(updated.check, interval);
|
|
98
|
-
}
|
package/src/utils/path.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// This file contains Node-agnostic path utilities so that it can be used in
|
|
2
|
-
// environments that do not have access to `node:path` (e.g. Cloudflare Workers).
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @param {string} from
|
|
6
|
-
* @param {string} to
|
|
7
|
-
* @returns {string}
|
|
8
|
-
*/
|
|
9
|
-
export function relative(from, to) {
|
|
10
|
-
const from_parts = from.split('/').filter(Boolean);
|
|
11
|
-
const to_parts = to.split('/').filter(Boolean);
|
|
12
|
-
let i = 0;
|
|
13
|
-
while (i < from_parts.length && i < to_parts.length && from_parts[i] === to_parts[i]) i++;
|
|
14
|
-
return [...Array(from_parts.length - i).fill('..'), ...to_parts.slice(i)].join('/') || '.';
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @param {...string} parts
|
|
19
|
-
* @returns {string}
|
|
20
|
-
*/
|
|
21
|
-
export function join(...parts) {
|
|
22
|
-
return parts.join('/');
|
|
23
|
-
}
|