@sveltejs/kit 2.24.0 → 2.25.1
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltejs/kit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.25.1",
|
|
4
4
|
"description": "SvelteKit is the fastest way to build Svelte apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"framework",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@playwright/test": "^1.51.1",
|
|
36
36
|
"@sveltejs/vite-plugin-svelte": "^6.0.0-next.3",
|
|
37
37
|
"@types/connect": "^3.4.38",
|
|
38
|
-
"@types/node": "^18.19.
|
|
38
|
+
"@types/node": "^18.19.119",
|
|
39
39
|
"@types/set-cookie-parser": "^2.4.7",
|
|
40
40
|
"dts-buddy": "^0.6.1",
|
|
41
41
|
"rollup": "^4.14.2",
|
package/src/core/config/index.js
CHANGED
|
@@ -67,6 +67,9 @@ export async function load_config({ cwd = process.cwd() } = {}) {
|
|
|
67
67
|
.filter((f) => fs.existsSync(f));
|
|
68
68
|
|
|
69
69
|
if (config_files.length === 0) {
|
|
70
|
+
console.log(
|
|
71
|
+
`No Svelte config file found in ${cwd} - using SvelteKit's default configuration without an adapter.`
|
|
72
|
+
);
|
|
70
73
|
return process_config({}, { cwd });
|
|
71
74
|
}
|
|
72
75
|
const config_file = config_files[0];
|
|
@@ -25,8 +25,8 @@ export function write_root(manifest_data, output) {
|
|
|
25
25
|
${
|
|
26
26
|
isSvelte5Plus()
|
|
27
27
|
? `<!-- svelte-ignore binding_property_non_reactive -->
|
|
28
|
-
<Pyramid_${l} bind:this={components[${l}]} data={data_${l}} {form} />`
|
|
29
|
-
: `<svelte:component this={constructors[${l}]} bind:this={components[${l}]} data={data_${l}} {form} />`
|
|
28
|
+
<Pyramid_${l} bind:this={components[${l}]} data={data_${l}} {form} params={page.params} />`
|
|
29
|
+
: `<svelte:component this={constructors[${l}]} bind:this={components[${l}]} data={data_${l}} {form} params={page.params} />`
|
|
30
30
|
}`;
|
|
31
31
|
|
|
32
32
|
while (l--) {
|
package/src/exports/public.d.ts
CHANGED
|
@@ -1302,7 +1302,7 @@ export interface ServerInitOptions {
|
|
|
1302
1302
|
/** A map of environment variables. */
|
|
1303
1303
|
env: Record<string, string>;
|
|
1304
1304
|
/** A function that turns an asset filename into a `ReadableStream`. Required for the `read` export from `$app/server` to work. */
|
|
1305
|
-
read?: (file: string) => ReadableStream
|
|
1305
|
+
read?: (file: string) => MaybePromise<ReadableStream | null>;
|
|
1306
1306
|
}
|
|
1307
1307
|
|
|
1308
1308
|
export interface SSRManifest {
|
|
@@ -36,10 +36,7 @@ export class Server {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
* @param {
|
|
40
|
-
* env: Record<string, string>;
|
|
41
|
-
* read?: (file: string) => ReadableStream;
|
|
42
|
-
* }} opts
|
|
39
|
+
* @param {import('@sveltejs/kit').ServerInitOptions} opts
|
|
43
40
|
*/
|
|
44
41
|
async init({ env, read }) {
|
|
45
42
|
// Take care: Some adapters may have to call `Server.init` per-request to set env vars,
|
|
@@ -64,7 +61,41 @@ export class Server {
|
|
|
64
61
|
set_safe_public_env(public_env);
|
|
65
62
|
|
|
66
63
|
if (read) {
|
|
67
|
-
|
|
64
|
+
// Wrap the read function to handle MaybePromise<ReadableStream>
|
|
65
|
+
// and ensure the public API stays synchronous
|
|
66
|
+
/** @param {string} file */
|
|
67
|
+
const wrapped_read = (file) => {
|
|
68
|
+
const result = read(file);
|
|
69
|
+
if (result instanceof ReadableStream) {
|
|
70
|
+
return result;
|
|
71
|
+
} else {
|
|
72
|
+
return new ReadableStream({
|
|
73
|
+
async start(controller) {
|
|
74
|
+
try {
|
|
75
|
+
const stream = await Promise.resolve(result);
|
|
76
|
+
if (!stream) {
|
|
77
|
+
controller.close();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const reader = stream.getReader();
|
|
82
|
+
|
|
83
|
+
while (true) {
|
|
84
|
+
const { done, value } = await reader.read();
|
|
85
|
+
if (done) break;
|
|
86
|
+
controller.enqueue(value);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
controller.close();
|
|
90
|
+
} catch (error) {
|
|
91
|
+
controller.error(error);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
set_read_implementation(wrapped_read);
|
|
68
99
|
}
|
|
69
100
|
|
|
70
101
|
// During DEV and for some adapters this function might be called in quick succession,
|
|
@@ -133,7 +133,10 @@ export function redirect_response(status, location) {
|
|
|
133
133
|
*/
|
|
134
134
|
export function clarify_devalue_error(event, error) {
|
|
135
135
|
if (error.path) {
|
|
136
|
-
return
|
|
136
|
+
return (
|
|
137
|
+
`Data returned from \`load\` while rendering ${event.route.id} is not serializable: ${error.message} (${error.path}). ` +
|
|
138
|
+
`If you need to serialize/deserialize custom types, use transport hooks: https://svelte.dev/docs/kit/hooks#Universal-hooks-transport.`
|
|
139
|
+
);
|
|
137
140
|
}
|
|
138
141
|
|
|
139
142
|
if (error.path === '') {
|
package/src/version.js
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -1284,7 +1284,7 @@ declare module '@sveltejs/kit' {
|
|
|
1284
1284
|
/** A map of environment variables. */
|
|
1285
1285
|
env: Record<string, string>;
|
|
1286
1286
|
/** A function that turns an asset filename into a `ReadableStream`. Required for the `read` export from `$app/server` to work. */
|
|
1287
|
-
read?: (file: string) => ReadableStream
|
|
1287
|
+
read?: (file: string) => MaybePromise<ReadableStream | null>;
|
|
1288
1288
|
}
|
|
1289
1289
|
|
|
1290
1290
|
export interface SSRManifest {
|