@sveltejs/kit 2.49.3 → 2.49.5
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 +3 -3
- package/src/core/config/options.js +2 -1
- package/src/exports/public.d.ts +6 -0
- package/src/exports/vite/build/build_server.js +26 -11
- package/src/exports/vite/build/utils.js +8 -15
- package/src/exports/vite/index.js +5 -2
- package/src/exports/vite/preview/index.js +5 -0
- package/src/runtime/client/client.js +2 -2
- package/src/runtime/form-utils.js +42 -17
- package/src/runtime/server/remote.js +1 -0
- package/src/runtime/server/respond.js +20 -14
- package/src/types/global-private.d.ts +2 -0
- package/src/utils/url.js +2 -2
- package/src/version.js +1 -1
- package/types/index.d.ts +7 -1
- package/types/index.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltejs/kit",
|
|
3
|
-
"version": "2.49.
|
|
3
|
+
"version": "2.49.5",
|
|
4
4
|
"description": "SvelteKit is the fastest way to build Svelte apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"framework",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@types/cookie": "^0.6.0",
|
|
24
24
|
"acorn": "^8.14.1",
|
|
25
25
|
"cookie": "^0.6.0",
|
|
26
|
-
"devalue": "^5.
|
|
26
|
+
"devalue": "^5.6.2",
|
|
27
27
|
"esm-env": "^1.2.2",
|
|
28
28
|
"kleur": "^4.1.5",
|
|
29
29
|
"magic-string": "^0.30.5",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@types/set-cookie-parser": "^2.4.7",
|
|
42
42
|
"dts-buddy": "^0.6.2",
|
|
43
43
|
"rollup": "^4.14.2",
|
|
44
|
-
"svelte": "^5.
|
|
44
|
+
"svelte": "^5.46.4",
|
|
45
45
|
"svelte-preprocess": "^6.0.0",
|
|
46
46
|
"typescript": "^5.3.3",
|
|
47
47
|
"vite": "^6.3.5",
|
package/src/exports/public.d.ts
CHANGED
|
@@ -505,6 +505,12 @@ export interface KitConfig {
|
|
|
505
505
|
* @default false
|
|
506
506
|
*/
|
|
507
507
|
remoteFunctions?: boolean;
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Whether to enable the experimental forked preloading feature using Svelte's fork API.
|
|
511
|
+
* @default false
|
|
512
|
+
*/
|
|
513
|
+
forkPreloads?: boolean;
|
|
508
514
|
};
|
|
509
515
|
/**
|
|
510
516
|
* Where to find various files within your project.
|
|
@@ -6,7 +6,6 @@ import { normalizePath } from 'vite';
|
|
|
6
6
|
import { basename, join } from 'node:path';
|
|
7
7
|
import { create_node_analyser } from '../static_analysis/index.js';
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
/**
|
|
11
10
|
* @param {string} out
|
|
12
11
|
* @param {import('types').ValidatedKitConfig} kit
|
|
@@ -18,7 +17,17 @@ import { create_node_analyser } from '../static_analysis/index.js';
|
|
|
18
17
|
* @param {import('types').RecursiveRequired<import('types').ValidatedConfig['kit']['output']>} output_config
|
|
19
18
|
* @param {Map<string, { page_options: Record<string, any> | null, children: string[] }>} static_exports
|
|
20
19
|
*/
|
|
21
|
-
export async function build_server_nodes(
|
|
20
|
+
export async function build_server_nodes(
|
|
21
|
+
out,
|
|
22
|
+
kit,
|
|
23
|
+
manifest_data,
|
|
24
|
+
server_manifest,
|
|
25
|
+
client_manifest,
|
|
26
|
+
server_bundle,
|
|
27
|
+
client_chunks,
|
|
28
|
+
output_config,
|
|
29
|
+
static_exports
|
|
30
|
+
) {
|
|
22
31
|
mkdirp(`${out}/server/nodes`);
|
|
23
32
|
mkdirp(`${out}/server/stylesheets`);
|
|
24
33
|
|
|
@@ -37,7 +46,7 @@ export async function build_server_nodes(out, kit, manifest_data, server_manifes
|
|
|
37
46
|
}
|
|
38
47
|
client_stylesheet.forEach((file, i) => {
|
|
39
48
|
stylesheets_to_inline.set(file, server_stylesheet[i]);
|
|
40
|
-
})
|
|
49
|
+
});
|
|
41
50
|
}
|
|
42
51
|
|
|
43
52
|
// filter out stylesheets that should not be inlined
|
|
@@ -60,7 +69,9 @@ export async function build_server_nodes(out, kit, manifest_data, server_manifes
|
|
|
60
69
|
const { get_page_options } = create_node_analyser({
|
|
61
70
|
resolve: (server_node) => {
|
|
62
71
|
// Windows needs the file:// protocol for absolute path dynamic imports
|
|
63
|
-
return import(
|
|
72
|
+
return import(
|
|
73
|
+
`file://${join(out, 'server', resolve_symlinks(server_manifest, server_node).chunk.file)}`
|
|
74
|
+
);
|
|
64
75
|
},
|
|
65
76
|
static_exports
|
|
66
77
|
});
|
|
@@ -97,7 +108,7 @@ export async function build_server_nodes(out, kit, manifest_data, server_manifes
|
|
|
97
108
|
if (node.universal) {
|
|
98
109
|
const page_options = await get_page_options(node);
|
|
99
110
|
if (!!page_options && page_options.ssr === false) {
|
|
100
|
-
exports.push(`export const universal = ${s(page_options, null, 2)};`)
|
|
111
|
+
exports.push(`export const universal = ${s(page_options, null, 2)};`);
|
|
101
112
|
} else {
|
|
102
113
|
imports.push(
|
|
103
114
|
`import * as universal from '../${resolve_symlinks(server_manifest, node.universal).chunk.file}';`
|
|
@@ -116,14 +127,18 @@ export async function build_server_nodes(out, kit, manifest_data, server_manifes
|
|
|
116
127
|
exports.push(`export const server_id = ${s(node.server)};`);
|
|
117
128
|
}
|
|
118
129
|
|
|
119
|
-
if (
|
|
130
|
+
if (
|
|
131
|
+
client_manifest &&
|
|
132
|
+
(node.universal || node.component) &&
|
|
133
|
+
output_config.bundleStrategy === 'split'
|
|
134
|
+
) {
|
|
120
135
|
const entry_path = `${normalizePath(kit.outDir)}/generated/client-optimized/nodes/${i}.js`;
|
|
121
136
|
const entry = find_deps(client_manifest, entry_path, true);
|
|
122
137
|
|
|
123
138
|
// eagerly load client stylesheets and fonts imported by the SSR-ed page to avoid FOUC.
|
|
124
139
|
// However, if it is not used during SSR (not present in the server manifest),
|
|
125
140
|
// then it can be lazily loaded in the browser.
|
|
126
|
-
|
|
141
|
+
|
|
127
142
|
/** @type {import('types').AssetDependencies | undefined} */
|
|
128
143
|
let component;
|
|
129
144
|
if (node.component) {
|
|
@@ -149,8 +164,8 @@ export async function build_server_nodes(out, kit, manifest_data, server_manifes
|
|
|
149
164
|
}
|
|
150
165
|
|
|
151
166
|
if (component?.stylesheet_map.has(filepath) || universal?.stylesheet_map.has(filepath)) {
|
|
152
|
-
value.css.forEach(file => eager_css.add(file));
|
|
153
|
-
value.assets.forEach(file => eager_assets.add(file));
|
|
167
|
+
value.css.forEach((file) => eager_css.add(file));
|
|
168
|
+
value.assets.forEach((file) => eager_assets.add(file));
|
|
154
169
|
}
|
|
155
170
|
});
|
|
156
171
|
|
|
@@ -196,7 +211,7 @@ export async function build_server_nodes(out, kit, manifest_data, server_manifes
|
|
|
196
211
|
}
|
|
197
212
|
|
|
198
213
|
/**
|
|
199
|
-
* @param {(import('vite').Rollup.OutputAsset | import('vite').Rollup.OutputChunk)[]} chunks
|
|
214
|
+
* @param {(import('vite').Rollup.OutputAsset | import('vite').Rollup.OutputChunk)[]} chunks
|
|
200
215
|
*/
|
|
201
216
|
function get_stylesheets(chunks) {
|
|
202
217
|
/**
|
|
@@ -222,7 +237,7 @@ function get_stylesheets(chunks) {
|
|
|
222
237
|
if (chunk.viteMetadata?.importedCss.size) {
|
|
223
238
|
const css = Array.from(chunk.viteMetadata.importedCss);
|
|
224
239
|
for (const id of chunk.moduleIds) {
|
|
225
|
-
stylesheets_used.set(id, css
|
|
240
|
+
stylesheets_used.set(id, css);
|
|
226
241
|
}
|
|
227
242
|
}
|
|
228
243
|
}
|
|
@@ -40,7 +40,7 @@ export function find_deps(manifest, entry, add_dynamic_css) {
|
|
|
40
40
|
if (add_js) imports.add(chunk.file);
|
|
41
41
|
|
|
42
42
|
if (chunk.assets) {
|
|
43
|
-
chunk.assets.forEach(asset => imported_assets.add(asset));
|
|
43
|
+
chunk.assets.forEach((asset) => imported_assets.add(asset));
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
if (chunk.css) {
|
|
@@ -48,7 +48,9 @@ export function find_deps(manifest, entry, add_dynamic_css) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
if (chunk.imports) {
|
|
51
|
-
chunk.imports.forEach((file) =>
|
|
51
|
+
chunk.imports.forEach((file) =>
|
|
52
|
+
traverse(file, add_js, initial_importer, dynamic_import_depth)
|
|
53
|
+
);
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
if (!add_dynamic_css) return;
|
|
@@ -58,7 +60,9 @@ export function find_deps(manifest, entry, add_dynamic_css) {
|
|
|
58
60
|
// a transitive dependency, it doesn't have a suitable name we can map back to
|
|
59
61
|
// the server manifest
|
|
60
62
|
if (stylesheet_map.has(initial_importer)) {
|
|
61
|
-
const { css, assets } = /** @type {{ css: Set<string>; assets: Set<string> }} */ (
|
|
63
|
+
const { css, assets } = /** @type {{ css: Set<string>; assets: Set<string> }} */ (
|
|
64
|
+
stylesheet_map.get(initial_importer)
|
|
65
|
+
);
|
|
62
66
|
if (chunk.css) chunk.css.forEach((file) => css.add(file));
|
|
63
67
|
if (chunk.assets) chunk.assets.forEach((file) => assets.add(file));
|
|
64
68
|
} else {
|
|
@@ -111,24 +115,13 @@ export function resolve_symlinks(manifest, file) {
|
|
|
111
115
|
}
|
|
112
116
|
|
|
113
117
|
/**
|
|
114
|
-
* @param {string[]} assets
|
|
118
|
+
* @param {string[]} assets
|
|
115
119
|
* @returns {string[]}
|
|
116
120
|
*/
|
|
117
121
|
export function filter_fonts(assets) {
|
|
118
122
|
return assets.filter((asset) => /\.(woff2?|ttf|otf)$/.test(asset));
|
|
119
123
|
}
|
|
120
124
|
|
|
121
|
-
const method_names = new Set((['GET', 'HEAD', 'PUT', 'POST', 'DELETE', 'PATCH', 'OPTIONS']));
|
|
122
|
-
|
|
123
|
-
// If we'd written this in TypeScript, it could be easy...
|
|
124
|
-
/**
|
|
125
|
-
* @param {string} str
|
|
126
|
-
* @returns {str is import('types').HttpMethod}
|
|
127
|
-
*/
|
|
128
|
-
export function is_http_method(str) {
|
|
129
|
-
return method_names.has(str);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
125
|
/**
|
|
133
126
|
* @param {import('types').ValidatedKitConfig} config
|
|
134
127
|
* @returns {string}
|
|
@@ -346,6 +346,7 @@ async function kit({ svelte_config }) {
|
|
|
346
346
|
__SVELTEKIT_APP_DIR__: s(kit.appDir),
|
|
347
347
|
__SVELTEKIT_EMBEDDED__: s(kit.embedded),
|
|
348
348
|
__SVELTEKIT_EXPERIMENTAL__REMOTE_FUNCTIONS__: s(kit.experimental.remoteFunctions),
|
|
349
|
+
__SVELTEKIT_FORK_PRELOADS__: s(kit.experimental.forkPreloads),
|
|
349
350
|
__SVELTEKIT_PATHS_ASSETS__: s(kit.paths.assets),
|
|
350
351
|
__SVELTEKIT_PATHS_BASE__: s(kit.paths.base),
|
|
351
352
|
__SVELTEKIT_PATHS_RELATIVE__: s(kit.paths.relative),
|
|
@@ -802,6 +803,8 @@ async function kit({ svelte_config }) {
|
|
|
802
803
|
/** @type {import('vite').UserConfig} */
|
|
803
804
|
let new_config;
|
|
804
805
|
|
|
806
|
+
const kit_paths_base = kit.paths.base || '/';
|
|
807
|
+
|
|
805
808
|
if (is_build) {
|
|
806
809
|
const ssr = /** @type {boolean} */ (config.build?.ssr);
|
|
807
810
|
const prefix = `${kit.appDir}/immutable`;
|
|
@@ -883,7 +886,7 @@ async function kit({ svelte_config }) {
|
|
|
883
886
|
// That's larger and takes longer to run and also causes an HTML diff between SSR and client
|
|
884
887
|
// causing us to do a more expensive hydration check.
|
|
885
888
|
const client_base =
|
|
886
|
-
kit.paths.relative !== false || kit.paths.assets ? './' :
|
|
889
|
+
kit.paths.relative !== false || kit.paths.assets ? './' : kit_paths_base;
|
|
887
890
|
|
|
888
891
|
const inline = !ssr && svelte_config.kit.output.bundleStrategy === 'inline';
|
|
889
892
|
const split = ssr || svelte_config.kit.output.bundleStrategy === 'split';
|
|
@@ -942,7 +945,7 @@ async function kit({ svelte_config }) {
|
|
|
942
945
|
} else {
|
|
943
946
|
new_config = {
|
|
944
947
|
appType: 'custom',
|
|
945
|
-
base:
|
|
948
|
+
base: kit_paths_base,
|
|
946
949
|
build: {
|
|
947
950
|
rollupOptions: {
|
|
948
951
|
// Vite dependency crawler needs an explicit JS entry point
|
|
@@ -35,6 +35,11 @@ export async function preview(vite, vite_config, svelte_config) {
|
|
|
35
35
|
throw new Error(`Server files not found at ${dir}, did you run \`build\` first?`);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
const instrumentation = join(dir, 'instrumentation.server.js');
|
|
39
|
+
if (fs.existsSync(instrumentation)) {
|
|
40
|
+
await import(pathToFileURL(instrumentation).href);
|
|
41
|
+
}
|
|
42
|
+
|
|
38
43
|
/** @type {import('types').ServerInternalModule} */
|
|
39
44
|
const { set_assets } = await import(pathToFileURL(join(dir, 'internal.js')).href);
|
|
40
45
|
|
|
@@ -532,7 +532,7 @@ async function _preload_data(intent) {
|
|
|
532
532
|
fork: null
|
|
533
533
|
};
|
|
534
534
|
|
|
535
|
-
if (svelte.fork) {
|
|
535
|
+
if (__SVELTEKIT_FORK_PRELOADS__ && svelte.fork) {
|
|
536
536
|
const lc = load_cache;
|
|
537
537
|
|
|
538
538
|
lc.fork = lc.promise.then((result) => {
|
|
@@ -545,7 +545,7 @@ async function _preload_data(intent) {
|
|
|
545
545
|
update(result.props.page);
|
|
546
546
|
});
|
|
547
547
|
} catch {
|
|
548
|
-
// if it errors, it's because the experimental flag isn't enabled
|
|
548
|
+
// if it errors, it's because the experimental flag isn't enabled in Svelte
|
|
549
549
|
}
|
|
550
550
|
}
|
|
551
551
|
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { DEV } from 'esm-env';
|
|
6
6
|
import * as devalue from 'devalue';
|
|
7
7
|
import { text_decoder, text_encoder } from './utils.js';
|
|
8
|
+
import { SvelteKitError } from '@sveltejs/kit/internal';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Sets a value in a nested object using a path string, mutating the original object
|
|
@@ -64,7 +65,7 @@ export function convert_formdata(data) {
|
|
|
64
65
|
|
|
65
66
|
export const BINARY_FORM_CONTENT_TYPE = 'application/x-sveltekit-formdata';
|
|
66
67
|
const BINARY_FORM_VERSION = 0;
|
|
67
|
-
|
|
68
|
+
const HEADER_BYTES = 1 + 4 + 2;
|
|
68
69
|
/**
|
|
69
70
|
* The binary format is as follows:
|
|
70
71
|
* - 1 byte: Format version
|
|
@@ -144,7 +145,11 @@ export async function deserialize_binary_form(request) {
|
|
|
144
145
|
return { data: convert_formdata(form_data), meta: {}, form_data };
|
|
145
146
|
}
|
|
146
147
|
if (!request.body) {
|
|
147
|
-
throw
|
|
148
|
+
throw deserialize_error('no body');
|
|
149
|
+
}
|
|
150
|
+
const content_length = parseInt(request.headers.get('content-length') ?? '');
|
|
151
|
+
if (Number.isNaN(content_length)) {
|
|
152
|
+
throw deserialize_error('invalid Content-Length header');
|
|
148
153
|
}
|
|
149
154
|
|
|
150
155
|
const reader = request.body.getReader();
|
|
@@ -156,7 +161,7 @@ export async function deserialize_binary_form(request) {
|
|
|
156
161
|
* @param {number} index
|
|
157
162
|
* @returns {Promise<Uint8Array<ArrayBuffer> | undefined>}
|
|
158
163
|
*/
|
|
159
|
-
|
|
164
|
+
function get_chunk(index) {
|
|
160
165
|
if (index in chunks) return chunks[index];
|
|
161
166
|
|
|
162
167
|
let i = chunks.length;
|
|
@@ -195,8 +200,7 @@ export async function deserialize_binary_form(request) {
|
|
|
195
200
|
return start_chunk.subarray(offset - chunk_start, offset + length - chunk_start);
|
|
196
201
|
}
|
|
197
202
|
// Otherwise, copy the data into a new buffer
|
|
198
|
-
const
|
|
199
|
-
buffer.set(start_chunk.subarray(offset - chunk_start));
|
|
203
|
+
const chunks = [start_chunk.subarray(offset - chunk_start)];
|
|
200
204
|
let cursor = start_chunk.byteLength - offset + chunk_start;
|
|
201
205
|
while (cursor < length) {
|
|
202
206
|
chunk_index++;
|
|
@@ -205,6 +209,12 @@ export async function deserialize_binary_form(request) {
|
|
|
205
209
|
if (chunk.byteLength > length - cursor) {
|
|
206
210
|
chunk = chunk.subarray(0, length - cursor);
|
|
207
211
|
}
|
|
212
|
+
chunks.push(chunk);
|
|
213
|
+
cursor += chunk.byteLength;
|
|
214
|
+
}
|
|
215
|
+
const buffer = new Uint8Array(length);
|
|
216
|
+
cursor = 0;
|
|
217
|
+
for (const chunk of chunks) {
|
|
208
218
|
buffer.set(chunk, cursor);
|
|
209
219
|
cursor += chunk.byteLength;
|
|
210
220
|
}
|
|
@@ -212,21 +222,28 @@ export async function deserialize_binary_form(request) {
|
|
|
212
222
|
return buffer;
|
|
213
223
|
}
|
|
214
224
|
|
|
215
|
-
const header = await get_buffer(0,
|
|
216
|
-
if (!header) throw
|
|
225
|
+
const header = await get_buffer(0, HEADER_BYTES);
|
|
226
|
+
if (!header) throw deserialize_error('too short');
|
|
217
227
|
|
|
218
228
|
if (header[0] !== BINARY_FORM_VERSION) {
|
|
219
|
-
throw
|
|
220
|
-
`Could not deserialize binary form: got version ${header[0]}, expected version ${BINARY_FORM_VERSION}`
|
|
221
|
-
);
|
|
229
|
+
throw deserialize_error(`got version ${header[0]}, expected version ${BINARY_FORM_VERSION}`);
|
|
222
230
|
}
|
|
223
231
|
const header_view = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
224
232
|
const data_length = header_view.getUint32(1, true);
|
|
233
|
+
|
|
234
|
+
if (HEADER_BYTES + data_length > content_length) {
|
|
235
|
+
throw deserialize_error('data overflow');
|
|
236
|
+
}
|
|
237
|
+
|
|
225
238
|
const file_offsets_length = header_view.getUint16(5, true);
|
|
226
239
|
|
|
240
|
+
if (HEADER_BYTES + data_length + file_offsets_length > content_length) {
|
|
241
|
+
throw deserialize_error('file offset table overflow');
|
|
242
|
+
}
|
|
243
|
+
|
|
227
244
|
// Read the form data
|
|
228
|
-
const data_buffer = await get_buffer(
|
|
229
|
-
if (!data_buffer) throw
|
|
245
|
+
const data_buffer = await get_buffer(HEADER_BYTES, data_length);
|
|
246
|
+
if (!data_buffer) throw deserialize_error('data too short');
|
|
230
247
|
|
|
231
248
|
/** @type {Array<number>} */
|
|
232
249
|
let file_offsets;
|
|
@@ -234,18 +251,20 @@ export async function deserialize_binary_form(request) {
|
|
|
234
251
|
let files_start_offset;
|
|
235
252
|
if (file_offsets_length > 0) {
|
|
236
253
|
// Read the file offset table
|
|
237
|
-
const file_offsets_buffer = await get_buffer(
|
|
238
|
-
if (!file_offsets_buffer)
|
|
239
|
-
throw new Error('Could not deserialize binary form: file offset table too short');
|
|
254
|
+
const file_offsets_buffer = await get_buffer(HEADER_BYTES + data_length, file_offsets_length);
|
|
255
|
+
if (!file_offsets_buffer) throw deserialize_error('file offset table too short');
|
|
240
256
|
|
|
241
257
|
file_offsets = /** @type {Array<number>} */ (
|
|
242
258
|
JSON.parse(text_decoder.decode(file_offsets_buffer))
|
|
243
259
|
);
|
|
244
|
-
files_start_offset =
|
|
260
|
+
files_start_offset = HEADER_BYTES + data_length + file_offsets_length;
|
|
245
261
|
}
|
|
246
262
|
|
|
247
263
|
const [data, meta] = devalue.parse(text_decoder.decode(data_buffer), {
|
|
248
264
|
File: ([name, type, size, last_modified, index]) => {
|
|
265
|
+
if (files_start_offset + file_offsets[index] + size > content_length) {
|
|
266
|
+
throw deserialize_error('file data overflow');
|
|
267
|
+
}
|
|
249
268
|
return new Proxy(
|
|
250
269
|
new LazyFile(
|
|
251
270
|
name,
|
|
@@ -276,6 +295,12 @@ export async function deserialize_binary_form(request) {
|
|
|
276
295
|
|
|
277
296
|
return { data, meta, form_data: null };
|
|
278
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* @param {string} message
|
|
300
|
+
*/
|
|
301
|
+
function deserialize_error(message) {
|
|
302
|
+
return new SvelteKitError(400, 'Bad Request', `Could not deserialize binary form: ${message}`);
|
|
303
|
+
}
|
|
279
304
|
|
|
280
305
|
/** @implements {File} */
|
|
281
306
|
class LazyFile {
|
|
@@ -380,7 +405,7 @@ class LazyFile {
|
|
|
380
405
|
chunk_index++;
|
|
381
406
|
let chunk = await this.#get_chunk(chunk_index);
|
|
382
407
|
if (!chunk) {
|
|
383
|
-
controller.error('
|
|
408
|
+
controller.error('incomplete file data');
|
|
384
409
|
controller.close();
|
|
385
410
|
return;
|
|
386
411
|
}
|
|
@@ -294,6 +294,7 @@ async function handle_remote_form_post_internal(event, state, manifest, id) {
|
|
|
294
294
|
const fn = /** @type {RemoteInfo & { type: 'form' }} */ (/** @type {any} */ (form).__).fn;
|
|
295
295
|
|
|
296
296
|
const { data, meta, form_data } = await deserialize_binary_form(event.request);
|
|
297
|
+
|
|
297
298
|
if (action_id && !('id' in data)) {
|
|
298
299
|
data.id = JSON.parse(decodeURIComponent(action_id));
|
|
299
300
|
}
|
|
@@ -247,8 +247,10 @@ export async function internal_respond(request, options, manifest, state) {
|
|
|
247
247
|
return text('Malformed URI', { status: 400 });
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
+
// try to serve the rerouted prerendered resource if it exists
|
|
250
251
|
if (
|
|
251
|
-
|
|
252
|
+
// the resolved path has been decoded so it should be compared to the decoded url pathname
|
|
253
|
+
resolved_path !== decode_pathname(url.pathname) &&
|
|
252
254
|
!state.prerendering?.fallback &&
|
|
253
255
|
has_prerendered_path(manifest, resolved_path)
|
|
254
256
|
) {
|
|
@@ -259,20 +261,24 @@ export async function internal_respond(request, options, manifest, state) {
|
|
|
259
261
|
? add_resolution_suffix(resolved_path)
|
|
260
262
|
: resolved_path;
|
|
261
263
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
headers.
|
|
268
|
-
|
|
269
|
-
|
|
264
|
+
try {
|
|
265
|
+
// `fetch` automatically decodes the body, so we need to delete the related headers to not break the response
|
|
266
|
+
// Also see https://github.com/sveltejs/kit/issues/12197 for more info (we should fix this more generally at some point)
|
|
267
|
+
const response = await fetch(url, request);
|
|
268
|
+
const headers = new Headers(response.headers);
|
|
269
|
+
if (headers.has('content-encoding')) {
|
|
270
|
+
headers.delete('content-encoding');
|
|
271
|
+
headers.delete('content-length');
|
|
272
|
+
}
|
|
270
273
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
274
|
+
return new Response(response.body, {
|
|
275
|
+
headers,
|
|
276
|
+
status: response.status,
|
|
277
|
+
statusText: response.statusText
|
|
278
|
+
});
|
|
279
|
+
} catch (error) {
|
|
280
|
+
return await handle_fatal_error(event, event_state, options, error);
|
|
281
|
+
}
|
|
276
282
|
}
|
|
277
283
|
|
|
278
284
|
/** @type {import('types').SSRRoute | null} */
|
|
@@ -11,6 +11,8 @@ declare global {
|
|
|
11
11
|
const __SVELTEKIT_SERVER_TRACING_ENABLED__: boolean;
|
|
12
12
|
/** true if corresponding config option is set to true */
|
|
13
13
|
const __SVELTEKIT_EXPERIMENTAL__REMOTE_FUNCTIONS__: boolean;
|
|
14
|
+
/** True if `config.kit.experimental.forkPreloads` is `true` */
|
|
15
|
+
const __SVELTEKIT_FORK_PRELOADS__: boolean;
|
|
14
16
|
/** True if `config.kit.router.resolution === 'client'` */
|
|
15
17
|
const __SVELTEKIT_CLIENT_ROUTING__: boolean;
|
|
16
18
|
/** True if `config.kit.router.type === 'hash'` */
|
package/src/utils/url.js
CHANGED
|
@@ -98,9 +98,9 @@ export function make_trackable(url, callback, search_params_callback, allow_hash
|
|
|
98
98
|
value: new Proxy(tracked.searchParams, {
|
|
99
99
|
get(obj, key) {
|
|
100
100
|
if (key === 'get' || key === 'getAll' || key === 'has') {
|
|
101
|
-
return (
|
|
101
|
+
return (/** @type {string} */ param, /** @type {string[]} */ ...rest) => {
|
|
102
102
|
search_params_callback(param);
|
|
103
|
-
return obj[key](param);
|
|
103
|
+
return obj[key](param, ...rest);
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
|
package/src/version.js
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -481,6 +481,12 @@ declare module '@sveltejs/kit' {
|
|
|
481
481
|
* @default false
|
|
482
482
|
*/
|
|
483
483
|
remoteFunctions?: boolean;
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* Whether to enable the experimental forked preloading feature using Svelte's fork API.
|
|
487
|
+
* @default false
|
|
488
|
+
*/
|
|
489
|
+
forkPreloads?: boolean;
|
|
484
490
|
};
|
|
485
491
|
/**
|
|
486
492
|
* Where to find various files within your project.
|
|
@@ -2763,7 +2769,7 @@ declare module '@sveltejs/kit' {
|
|
|
2763
2769
|
class Redirect_1 {
|
|
2764
2770
|
|
|
2765
2771
|
constructor(status: 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308, location: string);
|
|
2766
|
-
status: 301 | 302 | 303 |
|
|
2772
|
+
status: 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308;
|
|
2767
2773
|
location: string;
|
|
2768
2774
|
}
|
|
2769
2775
|
|
package/types/index.d.ts.map
CHANGED
|
@@ -215,6 +215,6 @@
|
|
|
215
215
|
null,
|
|
216
216
|
null
|
|
217
217
|
],
|
|
218
|
-
"mappings": ";;;;;;;;MA+BKA,IAAIA;;;;;kBAKQC,OAAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAiCZC,cAAcA;;;;;;aAMdC,cAAcA;;;;;;;;MAQrBC,aAAaA;;;;;OAKJC,YAAYA;;kBAETC,aAAaA;;;;;;MAMzBC,qBAAqBA;;;;;;;;;;;kBAWTC,OAAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA8IPC,MAAMA;;;;;;;;;;;kBAWNC,OAAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA4DPC,QAAQA;;;;;;;;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