@sveltejs/kit 1.30.3 → 2.0.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 +24 -24
- package/src/core/adapt/builder.js +8 -1
- package/src/core/config/index.js +9 -1
- package/src/core/config/options.js +1 -12
- package/src/core/postbuild/analyse.js +98 -80
- package/src/core/postbuild/prerender.js +11 -9
- package/src/core/sync/sync.js +2 -0
- package/src/core/sync/write_non_ambient.js +42 -0
- package/src/core/sync/write_server.js +3 -3
- package/src/core/sync/write_tsconfig.js +27 -78
- package/src/core/sync/write_types/index.js +1 -1
- package/src/exports/hooks/sequence.js +1 -1
- package/src/exports/index.js +88 -71
- package/src/exports/node/index.js +21 -24
- package/src/exports/node/polyfills.js +5 -34
- package/src/exports/public.d.ts +82 -61
- package/src/exports/vite/dev/index.js +11 -19
- package/src/exports/vite/graph_analysis/index.js +2 -4
- package/src/exports/vite/index.js +73 -14
- package/src/exports/vite/module_ids.js +7 -0
- package/src/exports/vite/preview/index.js +56 -130
- package/src/runtime/app/forms.js +2 -35
- package/src/runtime/app/navigation.js +28 -15
- package/src/runtime/app/paths.js +2 -29
- package/src/runtime/client/client.js +449 -199
- package/src/runtime/client/constants.js +5 -1
- package/src/runtime/client/session-storage.js +7 -5
- package/src/runtime/client/singletons.js +7 -1
- package/src/runtime/client/types.d.ts +6 -2
- package/src/runtime/client/utils.js +12 -10
- package/src/runtime/control.js +16 -8
- package/src/runtime/server/cookie.js +38 -61
- package/src/runtime/server/data/index.js +6 -4
- package/src/runtime/server/env_module.js +29 -0
- package/src/runtime/server/fetch.js +7 -6
- package/src/runtime/server/index.js +23 -20
- package/src/runtime/server/page/actions.js +24 -15
- package/src/runtime/server/page/index.js +6 -8
- package/src/runtime/server/page/load_data.js +58 -40
- package/src/runtime/server/page/render.js +12 -7
- package/src/runtime/server/page/respond_with_error.js +4 -4
- package/src/runtime/server/page/types.d.ts +1 -1
- package/src/runtime/server/respond.js +14 -12
- package/src/runtime/server/utils.js +11 -8
- package/src/runtime/shared-server.js +19 -2
- package/src/types/ambient.d.ts +7 -1
- package/src/types/internal.d.ts +4 -1
- package/src/types/synthetic/$env+dynamic+private.md +2 -0
- package/src/types/synthetic/$env+dynamic+public.md +2 -0
- package/src/utils/error.js +17 -1
- package/src/utils/routing.js +47 -1
- package/src/utils/url.js +45 -27
- package/src/version.js +1 -1
- package/types/index.d.ts +166 -115
- package/types/index.d.ts.map +9 -5
- package/src/utils/platform.js +0 -1
- package/src/utils/promises.js +0 -61
package/types/index.d.ts.map
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
"file": "index.d.ts",
|
|
4
4
|
"names": [
|
|
5
5
|
"Adapter",
|
|
6
|
-
"
|
|
6
|
+
"LoadProperties",
|
|
7
7
|
"AwaitedActions",
|
|
8
|
+
"ActionFailure",
|
|
8
9
|
"Builder",
|
|
9
10
|
"Config",
|
|
10
11
|
"Cookies",
|
|
@@ -57,7 +58,6 @@
|
|
|
57
58
|
"RequestOptions",
|
|
58
59
|
"RouteSegment",
|
|
59
60
|
"TrailingSlash",
|
|
60
|
-
"ActionFailure",
|
|
61
61
|
"Asset",
|
|
62
62
|
"BuildData",
|
|
63
63
|
"ManifestData",
|
|
@@ -74,11 +74,13 @@
|
|
|
74
74
|
"SSREndpoint",
|
|
75
75
|
"SSRRoute",
|
|
76
76
|
"ValidatedConfig",
|
|
77
|
+
"isHttpError",
|
|
77
78
|
"redirect",
|
|
79
|
+
"isRedirect",
|
|
78
80
|
"json",
|
|
79
81
|
"text",
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
+
"LessThan",
|
|
83
|
+
"NumericRange",
|
|
82
84
|
"VERSION",
|
|
83
85
|
"sequence",
|
|
84
86
|
"getRequest",
|
|
@@ -99,6 +101,8 @@
|
|
|
99
101
|
"beforeNavigate",
|
|
100
102
|
"onNavigate",
|
|
101
103
|
"afterNavigate",
|
|
104
|
+
"pushState",
|
|
105
|
+
"replaceState",
|
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;;;;;;;;cCxHlBC,OAAOA;;;;cAKPC,GAAGA;;;;;;;;iBCEAC,WAAWA;;;;;;;;;;;;;;;;;;;iBA8BXC,WAAWA;;;;;;;;;;;;;;;;;;;;;iBAyCXC,OAAOA;;;;;;;;;;cC7EVC,qBAAqBA;;;;;;;;cAerBC,IAAIA;;;;;;;;;;;;;;;;;;;;;;;cAqBJC,UAAUA;;;;cAOVC,aAAaA;;;;;;;;;;;;cAebC,WAAWA;;;;;;;;;;;cAeXC,WAAWA;;;;;;;;;;;;cAgBXC,cAAcA;;;;;;;;;;cAcdC,UAAUA;;;;;;cAUVC,aAAaA;;;;;cAUbC,SAASA;;;;;cAUTC,YAAYA;MVgBbxD,YAAYA;;;;;;;;;;;;;;;;;;iBWxIRyD,YAAYA;;;;iBCZfC,SAASA;;;;;;;;;;;;;;cAwBTC,IAAIA;;;;;;;;cAeJC,UAAUA;;;;;;cAaVC,OAAOA"
|
|
143
147
|
}
|
package/src/utils/platform.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const should_polyfill = typeof Deno === 'undefined' && typeof Bun === 'undefined';
|
package/src/utils/promises.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { DEV } from 'esm-env';
|
|
2
|
-
|
|
3
|
-
/** @type {Set<string> | null} */
|
|
4
|
-
let warned = null;
|
|
5
|
-
|
|
6
|
-
// TODO v2: remove all references to unwrap_promises
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Given an object, return a new object where all top level values are awaited
|
|
10
|
-
*
|
|
11
|
-
* @param {Record<string, any>} object
|
|
12
|
-
* @param {string | null} [id]
|
|
13
|
-
* @returns {Promise<Record<string, any>>}
|
|
14
|
-
*/
|
|
15
|
-
export async function unwrap_promises(object, id) {
|
|
16
|
-
if (DEV) {
|
|
17
|
-
/** @type {string[]} */
|
|
18
|
-
const promises = [];
|
|
19
|
-
|
|
20
|
-
for (const key in object) {
|
|
21
|
-
if (typeof object[key]?.then === 'function') {
|
|
22
|
-
promises.push(key);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (promises.length > 0) {
|
|
27
|
-
if (!warned) warned = new Set();
|
|
28
|
-
|
|
29
|
-
const last = promises.pop();
|
|
30
|
-
|
|
31
|
-
const properties =
|
|
32
|
-
promises.length > 0
|
|
33
|
-
? `${promises.map((p) => `"${p}"`).join(', ')} and "${last}" properties`
|
|
34
|
-
: `"${last}" property`;
|
|
35
|
-
|
|
36
|
-
const location = id ? `the \`load\` function in ${id}` : 'a `load` function';
|
|
37
|
-
|
|
38
|
-
const description = promises.length > 0 ? 'are promises' : 'is a promise';
|
|
39
|
-
|
|
40
|
-
const message = `The top-level ${properties} returned from ${location} ${description}.`;
|
|
41
|
-
|
|
42
|
-
if (!warned.has(message)) {
|
|
43
|
-
console.warn(
|
|
44
|
-
`\n${message}\n\nIn SvelteKit 2.0, these will no longer be awaited automatically. To get rid of this warning, await all promises included as top-level properties in \`load\` return values.\n`
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
warned.add(message);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
for (const key in object) {
|
|
53
|
-
if (typeof object[key]?.then === 'function') {
|
|
54
|
-
return Object.fromEntries(
|
|
55
|
-
await Promise.all(Object.entries(object).map(async ([key, value]) => [key, await value]))
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return object;
|
|
61
|
-
}
|