@skgo/sveltekit-adapter 0.10.0 → 0.10.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 +1 -1
- package/skgo-adapter/entry.js +19 -17
package/package.json
CHANGED
package/skgo-adapter/entry.js
CHANGED
|
@@ -218,7 +218,7 @@ function node_data(node) {
|
|
|
218
218
|
});
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
-
async function build_props(req, url) {
|
|
221
|
+
async function build_props(req, url, event, state) {
|
|
222
222
|
const form = req.form ? devalue.parse(req.form, decoders) : null;
|
|
223
223
|
const page = {
|
|
224
224
|
error: req.error ?? null,
|
|
@@ -252,21 +252,23 @@ async function build_props(req, url) {
|
|
|
252
252
|
const load = universalLoads[branch[i].node];
|
|
253
253
|
const parent_data = data;
|
|
254
254
|
const result = load
|
|
255
|
-
? await
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
255
|
+
? await with_request_store({ event, state }, () =>
|
|
256
|
+
load.call(null, {
|
|
257
|
+
url,
|
|
258
|
+
params: req.params ?? {},
|
|
259
|
+
data: server_data,
|
|
260
|
+
route: { id: req.route_id ?? null },
|
|
261
|
+
parent: async () => parent_data,
|
|
262
|
+
depends: () => {},
|
|
263
|
+
untrack: (fn) => fn(),
|
|
264
|
+
fetch: () => {
|
|
265
|
+
throw new Error('skgo: universal load fetch is not supported during rendering');
|
|
266
|
+
},
|
|
267
|
+
setHeaders: () => {
|
|
268
|
+
throw new Error('skgo: universal load setHeaders is not supported during rendering');
|
|
269
|
+
}
|
|
270
|
+
})
|
|
271
|
+
)
|
|
270
272
|
: server_data;
|
|
271
273
|
if (result != null && Object.getPrototypeOf(result) !== Object.prototype) {
|
|
272
274
|
throw new Error('skgo: universal load must return a plain object');
|
|
@@ -367,9 +369,9 @@ globalThis.__skgo_render = function (req_json) {
|
|
|
367
369
|
try {
|
|
368
370
|
const req = JSON.parse(req_json);
|
|
369
371
|
const url = new URL(req.url);
|
|
370
|
-
const props_promise = build_props(req, url);
|
|
371
372
|
const state = make_state();
|
|
372
373
|
const event = make_event(req, url);
|
|
374
|
+
const props_promise = build_props(req, url, event, state);
|
|
373
375
|
const promise = props_promise.then((props) => {
|
|
374
376
|
result.status = props.page.status;
|
|
375
377
|
result.error = req.error ?? null;
|