@sveltejs/kit 2.20.6 → 2.20.8
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.20.
|
|
3
|
+
"version": "2.20.8",
|
|
4
4
|
"description": "SvelteKit is the fastest way to build Svelte apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"framework",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"sirv": "^3.0.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@playwright/test": "^1.
|
|
34
|
+
"@playwright/test": "^1.51.1",
|
|
35
35
|
"@sveltejs/vite-plugin-svelte": "^5.0.1",
|
|
36
36
|
"@types/connect": "^3.4.38",
|
|
37
37
|
"@types/node": "^18.19.48",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"svelte": "^5.23.1",
|
|
42
42
|
"svelte-preprocess": "^6.0.0",
|
|
43
43
|
"typescript": "^5.3.3",
|
|
44
|
-
"vite": "^6.
|
|
45
|
-
"vitest": "^3.
|
|
44
|
+
"vite": "^6.2.6",
|
|
45
|
+
"vitest": "^3.1.1"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@sveltejs/vite-plugin-svelte": "^3.0.0 || ^4.0.0-next.1 || ^5.0.0",
|
|
@@ -253,7 +253,7 @@ export function get_data_json(event, options, nodes) {
|
|
|
253
253
|
return JSON.stringify(node);
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
return `{"type":"data","data":${devalue.stringify(node.data, reducers)}
|
|
256
|
+
return `{"type":"data","data":${devalue.stringify(node.data, reducers)},"uses":${JSON.stringify(
|
|
257
257
|
serialize_uses(node)
|
|
258
258
|
)}${node.slash ? `,"slash":${JSON.stringify(node.slash)}` : ''}}`;
|
|
259
259
|
});
|
|
@@ -263,6 +263,8 @@ export function get_data_json(event, options, nodes) {
|
|
|
263
263
|
chunks: count > 0 ? iterator : null
|
|
264
264
|
};
|
|
265
265
|
} catch (e) {
|
|
266
|
+
// @ts-expect-error
|
|
267
|
+
e.path = 'data' + e.path;
|
|
266
268
|
throw new Error(clarify_devalue_error(event, /** @type {any} */ (e)));
|
|
267
269
|
}
|
|
268
270
|
}
|
|
@@ -15,6 +15,7 @@ import { render_response } from './render.js';
|
|
|
15
15
|
import { respond_with_error } from './respond_with_error.js';
|
|
16
16
|
import { get_data_json } from '../data/index.js';
|
|
17
17
|
import { DEV } from 'esm-env';
|
|
18
|
+
import { PageNodes } from '../../../utils/page_nodes.js';
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* The maximum request depth permitted before assuming we're stuck in an infinite loop
|
|
@@ -93,10 +94,13 @@ export async function render_page(event, page, options, manifest, state, nodes,
|
|
|
93
94
|
/** @type {import('./types.js').Fetched[]} */
|
|
94
95
|
const fetched = [];
|
|
95
96
|
|
|
97
|
+
const ssr = nodes.ssr();
|
|
98
|
+
const csr = nodes.csr();
|
|
99
|
+
|
|
96
100
|
// renders an empty 'shell' page if SSR is turned off and if there is
|
|
97
101
|
// no server data to prerender. As a result, the load functions and rendering
|
|
98
102
|
// only occur client-side.
|
|
99
|
-
if (
|
|
103
|
+
if (ssr === false && !(state.prerendering && should_prerender_data)) {
|
|
100
104
|
// if the user makes a request through a non-enhanced form, the returned value is lost
|
|
101
105
|
// because there is no SSR or client-side handling of the response
|
|
102
106
|
if (DEV && action_result && !event.request.headers.has('x-sveltekit-action')) {
|
|
@@ -117,7 +121,7 @@ export async function render_page(event, page, options, manifest, state, nodes,
|
|
|
117
121
|
fetched,
|
|
118
122
|
page_config: {
|
|
119
123
|
ssr: false,
|
|
120
|
-
csr
|
|
124
|
+
csr
|
|
121
125
|
},
|
|
122
126
|
status,
|
|
123
127
|
error: null,
|
|
@@ -171,8 +175,6 @@ export async function render_page(event, page, options, manifest, state, nodes,
|
|
|
171
175
|
});
|
|
172
176
|
});
|
|
173
177
|
|
|
174
|
-
const csr = nodes.csr();
|
|
175
|
-
|
|
176
178
|
/** @type {Array<Promise<Record<string, any> | null>>} */
|
|
177
179
|
const load_promises = nodes.data.map((node, i) => {
|
|
178
180
|
if (load_error) throw load_error;
|
|
@@ -244,16 +246,22 @@ export async function render_page(event, page, options, manifest, state, nodes,
|
|
|
244
246
|
let j = i;
|
|
245
247
|
while (!branch[j]) j -= 1;
|
|
246
248
|
|
|
249
|
+
const layouts = compact(branch.slice(0, j + 1));
|
|
250
|
+
const nodes = new PageNodes(layouts.map((layout) => layout.node));
|
|
251
|
+
|
|
247
252
|
return await render_response({
|
|
248
253
|
event,
|
|
249
254
|
options,
|
|
250
255
|
manifest,
|
|
251
256
|
state,
|
|
252
257
|
resolve_opts,
|
|
253
|
-
page_config: {
|
|
258
|
+
page_config: {
|
|
259
|
+
ssr: nodes.ssr(),
|
|
260
|
+
csr: nodes.csr()
|
|
261
|
+
},
|
|
254
262
|
status,
|
|
255
263
|
error,
|
|
256
|
-
branch:
|
|
264
|
+
branch: layouts.concat({
|
|
257
265
|
node,
|
|
258
266
|
data: null,
|
|
259
267
|
server_data: null
|
|
@@ -294,8 +302,6 @@ export async function render_page(event, page, options, manifest, state, nodes,
|
|
|
294
302
|
});
|
|
295
303
|
}
|
|
296
304
|
|
|
297
|
-
const ssr = nodes.ssr();
|
|
298
|
-
|
|
299
305
|
return await render_response({
|
|
300
306
|
event,
|
|
301
307
|
options,
|
|
@@ -303,7 +309,7 @@ export async function render_page(event, page, options, manifest, state, nodes,
|
|
|
303
309
|
state,
|
|
304
310
|
resolve_opts,
|
|
305
311
|
page_config: {
|
|
306
|
-
csr
|
|
312
|
+
csr,
|
|
307
313
|
ssr
|
|
308
314
|
},
|
|
309
315
|
status,
|
|
@@ -658,6 +658,8 @@ function get_data(event, options, nodes, csp, global) {
|
|
|
658
658
|
chunks: count > 0 ? iterator : null
|
|
659
659
|
};
|
|
660
660
|
} catch (e) {
|
|
661
|
+
// @ts-expect-error
|
|
662
|
+
e.path = e.path.slice(1);
|
|
661
663
|
throw new Error(clarify_devalue_error(event, /** @type {any} */ (e)));
|
|
662
664
|
}
|
|
663
665
|
}
|
|
@@ -133,7 +133,7 @@ export function redirect_response(status, location) {
|
|
|
133
133
|
*/
|
|
134
134
|
export function clarify_devalue_error(event, error) {
|
|
135
135
|
if (error.path) {
|
|
136
|
-
return `Data returned from \`load\` while rendering ${event.route.id} is not serializable: ${error.message} (
|
|
136
|
+
return `Data returned from \`load\` while rendering ${event.route.id} is not serializable: ${error.message} (${error.path})`;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
if (error.path === '') {
|
package/src/version.js
CHANGED