@sveltejs/kit 1.18.0 → 1.19.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 +6 -1
- package/src/core/adapt/builder.js +3 -3
- package/src/core/config/index.js +2 -2
- package/src/core/config/options.js +3 -3
- package/src/core/env.js +1 -1
- package/src/core/generate_manifest/index.js +2 -2
- package/src/core/postbuild/analyse.js +3 -3
- package/src/core/postbuild/fallback.js +1 -1
- package/src/core/postbuild/prerender.js +1 -1
- package/src/core/sync/create_manifest_data/index.js +2 -2
- package/src/core/sync/write_ambient.js +1 -1
- package/src/core/sync/write_client_manifest.js +1 -1
- package/src/core/sync/write_server.js +1 -1
- package/src/core/sync/write_types/index.js +24 -24
- package/src/exports/hooks/sequence.js +71 -7
- package/src/exports/index.js +88 -12
- package/src/exports/node/index.js +14 -3
- package/src/exports/node/polyfills.js +8 -0
- package/src/exports/public.d.ts +1264 -0
- package/src/exports/vite/build/build_server.js +2 -2
- package/src/exports/vite/build/build_service_worker.js +1 -1
- package/src/exports/vite/dev/index.js +3 -3
- package/src/exports/vite/index.js +11 -6
- package/src/runtime/app/environment.js +3 -4
- package/src/runtime/app/forms.js +63 -7
- package/src/runtime/app/navigation.js +95 -0
- package/src/runtime/app/stores.js +28 -7
- package/src/runtime/client/client.js +26 -14
- package/src/runtime/client/singletons.js +6 -4
- package/src/runtime/client/start.js +1 -1
- package/src/runtime/client/types.d.ts +4 -12
- package/src/runtime/client/utils.js +29 -10
- package/src/runtime/control.js +12 -9
- package/src/runtime/server/ambient.d.ts +3 -3
- package/src/runtime/server/cookie.js +3 -3
- package/src/runtime/server/data/index.js +3 -3
- package/src/runtime/server/endpoint.js +11 -4
- package/src/runtime/server/fetch.js +4 -6
- package/src/runtime/server/index.js +2 -2
- package/src/runtime/server/page/actions.js +13 -13
- package/src/runtime/server/page/csp.js +7 -2
- package/src/runtime/server/page/index.js +4 -4
- package/src/runtime/server/page/load_data.js +7 -7
- package/src/runtime/server/page/render.js +11 -11
- package/src/runtime/server/page/respond_with_error.js +2 -2
- package/src/runtime/server/respond.js +6 -6
- package/src/runtime/server/utils.js +7 -7
- package/src/types/ambient-private.d.ts +11 -0
- package/src/types/ambient.d.ts +108 -0
- package/{types → src/types}/internal.d.ts +3 -13
- package/{types → src/types}/private.d.ts +1 -10
- package/src/utils/error.js +3 -3
- package/src/utils/exports.js +2 -2
- package/src/utils/routing.js +1 -39
- package/src/utils/streaming.js +2 -2
- package/types/index.d.ts +2079 -1108
- package/types/index.d.ts.map +165 -0
- package/src/internal.d.ts +0 -16
- package/types/ambient.d.ts +0 -486
- /package/{types → src/types}/synthetic/$env+dynamic+private.md +0 -0
- /package/{types → src/types}/synthetic/$env+dynamic+public.md +0 -0
- /package/{types → src/types}/synthetic/$env+static+private.md +0 -0
- /package/{types → src/types}/synthetic/$env+static+public.md +0 -0
- /package/{types → src/types}/synthetic/$lib.md +0 -0
|
@@ -92,7 +92,14 @@ function get_raw_body(req, body_size_limit) {
|
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
/**
|
|
95
|
+
/**
|
|
96
|
+
* @param {{
|
|
97
|
+
* request: import('http').IncomingMessage;
|
|
98
|
+
* base: string;
|
|
99
|
+
* bodySizeLimit?: number;
|
|
100
|
+
* }} options
|
|
101
|
+
* @returns {Promise<Request>}
|
|
102
|
+
*/
|
|
96
103
|
export async function getRequest({ request, base, bodySizeLimit }) {
|
|
97
104
|
return new Request(base + request.url, {
|
|
98
105
|
// @ts-expect-error
|
|
@@ -103,7 +110,11 @@ export async function getRequest({ request, base, bodySizeLimit }) {
|
|
|
103
110
|
});
|
|
104
111
|
}
|
|
105
112
|
|
|
106
|
-
/**
|
|
113
|
+
/**
|
|
114
|
+
* @param {import('http').ServerResponse} res
|
|
115
|
+
* @param {Response} response
|
|
116
|
+
* @returns {Promise<void>}
|
|
117
|
+
*/
|
|
107
118
|
export async function setResponse(res, response) {
|
|
108
119
|
for (const [key, value] of response.headers) {
|
|
109
120
|
try {
|
|
@@ -133,7 +144,7 @@ export async function setResponse(res, response) {
|
|
|
133
144
|
if (response.body.locked) {
|
|
134
145
|
res.end(
|
|
135
146
|
'Fatal error: Response body is locked. ' +
|
|
136
|
-
|
|
147
|
+
"This can happen when the response was already read (for example through 'response.json()' or 'response.text()')."
|
|
137
148
|
);
|
|
138
149
|
return;
|
|
139
150
|
}
|
|
@@ -22,6 +22,14 @@ const globals = {
|
|
|
22
22
|
|
|
23
23
|
// exported for dev/preview and node environments
|
|
24
24
|
// TODO: remove this once we only support Node 18.11+ (the version multipart/form-data was added)
|
|
25
|
+
/**
|
|
26
|
+
* Make various web APIs available as globals:
|
|
27
|
+
* - `crypto`
|
|
28
|
+
* - `fetch`
|
|
29
|
+
* - `Headers`
|
|
30
|
+
* - `Request`
|
|
31
|
+
* - `Response`
|
|
32
|
+
*/
|
|
25
33
|
export function installPolyfills() {
|
|
26
34
|
for (const name in globals) {
|
|
27
35
|
Object.defineProperty(globalThis, name, {
|