@axium/server 0.22.11 → 0.22.12
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/build/client/_app/immutable/chunks/{DN_VTkOW.js → CUKk2pac.js} +1 -1
- package/build/client/_app/immutable/chunks/CUKk2pac.js.br +0 -0
- package/build/client/_app/immutable/chunks/CUKk2pac.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{BMQhMafy.js → D3hk2v8y.js} +1 -1
- package/build/client/_app/immutable/chunks/D3hk2v8y.js.br +2 -0
- package/build/client/_app/immutable/chunks/D3hk2v8y.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{ButWEHh0.js → D4Bce_hb.js} +1 -1
- package/build/client/_app/immutable/chunks/D4Bce_hb.js.br +0 -0
- package/build/client/_app/immutable/chunks/D4Bce_hb.js.gz +0 -0
- package/build/client/_app/immutable/chunks/D9TfJrfD.js +1 -0
- package/build/client/_app/immutable/chunks/D9TfJrfD.js.br +0 -0
- package/build/client/_app/immutable/chunks/D9TfJrfD.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Dy1O3iBu.js +2 -0
- package/build/client/_app/immutable/chunks/Dy1O3iBu.js.br +0 -0
- package/build/client/_app/immutable/chunks/Dy1O3iBu.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{Cj9PL7OG.js → pba7IodQ.js} +1 -1
- package/build/client/_app/immutable/chunks/pba7IodQ.js.br +0 -0
- package/build/client/_app/immutable/chunks/pba7IodQ.js.gz +0 -0
- package/build/client/_app/immutable/chunks/ryIMAJBY.js +43 -0
- package/build/client/_app/immutable/chunks/ryIMAJBY.js.br +0 -0
- package/build/client/_app/immutable/chunks/ryIMAJBY.js.gz +0 -0
- package/build/client/_app/immutable/chunks/xrbt_D8M.js +3 -0
- package/build/client/_app/immutable/chunks/xrbt_D8M.js.br +0 -0
- package/build/client/_app/immutable/chunks/xrbt_D8M.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.BVHPDUMp.js +2 -0
- package/build/client/_app/immutable/entry/app.BVHPDUMp.js.br +0 -0
- package/build/client/_app/immutable/entry/app.BVHPDUMp.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.iSaoKHym.js +1 -0
- package/build/client/_app/immutable/entry/start.iSaoKHym.js.br +2 -0
- package/build/client/_app/immutable/entry/start.iSaoKHym.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{0.CE0uBbp0.js → 0.DlE8ZTIF.js} +1 -1
- package/build/client/_app/immutable/nodes/0.DlE8ZTIF.js.br +0 -0
- package/build/client/_app/immutable/nodes/0.DlE8ZTIF.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{1.9GlBYpox.js → 1.C6i9ejlV.js} +1 -1
- package/build/client/_app/immutable/nodes/1.C6i9ejlV.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.C6i9ejlV.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{2.B3qXd01D.js → 2.CvEpuMc7.js} +1 -1
- package/build/client/_app/immutable/nodes/2.CvEpuMc7.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.CvEpuMc7.js.gz +0 -0
- package/build/client/_app/immutable/nodes/3.C_lSL2XQ.js +7 -0
- package/build/client/_app/immutable/nodes/3.C_lSL2XQ.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.C_lSL2XQ.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{4.C0wscA_4.js → 4.CSeqUIkS.js} +1 -1
- package/build/client/_app/immutable/nodes/4.CSeqUIkS.js.br +0 -0
- package/build/client/_app/immutable/nodes/4.CSeqUIkS.js.gz +0 -0
- package/build/client/_app/immutable/nodes/5.D9aWeMNp.js +1 -0
- package/build/client/_app/immutable/nodes/5.D9aWeMNp.js.br +0 -0
- package/build/client/_app/immutable/nodes/5.D9aWeMNp.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{6.TEubHotu.js → 6.BD8IYyN_.js} +1 -1
- package/build/client/_app/immutable/nodes/6.BD8IYyN_.js.br +0 -0
- package/build/client/_app/immutable/nodes/6.BD8IYyN_.js.gz +0 -0
- package/build/client/_app/version.json +1 -1
- package/build/client/_app/version.json.br +0 -0
- package/build/client/_app/version.json.gz +0 -0
- package/build/handler.js +26 -26
- package/build/server/chunks/{0-DJKsK7F_.js → 0-DgHTujtC.js} +2 -2
- package/build/server/chunks/{0-DJKsK7F_.js.map → 0-DgHTujtC.js.map} +1 -1
- package/build/server/chunks/1-CgOeUaUi.js +9 -0
- package/build/server/chunks/{1-D4403Evz.js.map → 1-CgOeUaUi.js.map} +1 -1
- package/build/server/chunks/{2-fj0aW1I0.js → 2-CXlrhpR6.js} +2 -2
- package/build/server/chunks/{2-fj0aW1I0.js.map → 2-CXlrhpR6.js.map} +1 -1
- package/build/server/chunks/3-DbcmCKOG.js +13 -0
- package/build/server/chunks/{3-CCrTqwF9.js.map → 3-DbcmCKOG.js.map} +1 -1
- package/build/server/chunks/4-B7Be1Aab.js +9 -0
- package/build/server/chunks/{4-vjHkix88.js.map → 4-B7Be1Aab.js.map} +1 -1
- package/build/server/chunks/5-E3t1nJQO.js +9 -0
- package/build/server/chunks/{5-Dc6xvhmU.js.map → 5-E3t1nJQO.js.map} +1 -1
- package/build/server/chunks/6-CWIerHsF.js +9 -0
- package/build/server/chunks/{6-CvdeNFQU.js.map → 6-CWIerHsF.js.map} +1 -1
- package/build/server/chunks/{FormDialog-CUzCwBFr.js → FormDialog-_22YUZPH.js} +3 -3
- package/build/server/chunks/{FormDialog-CUzCwBFr.js.map → FormDialog-_22YUZPH.js.map} +1 -1
- package/build/server/chunks/{Logout-48MBrG2s.js → Logout-DRQAFA2-.js} +3 -3
- package/build/server/chunks/{Logout-48MBrG2s.js.map → Logout-DRQAFA2-.js.map} +1 -1
- package/build/server/chunks/{_page.svelte-CNug2JTC.js → _page.svelte-CA8NgS50.js} +5 -5
- package/build/server/chunks/{_page.svelte-CNug2JTC.js.map → _page.svelte-CA8NgS50.js.map} +1 -1
- package/build/server/chunks/{_page.svelte-Yesd_T6C.js → _page.svelte-D3LtJDcL.js} +4 -4
- package/build/server/chunks/{_page.svelte-Yesd_T6C.js.map → _page.svelte-D3LtJDcL.js.map} +1 -1
- package/build/server/chunks/_page.svelte-DL39TUpH.js +11 -0
- package/build/server/chunks/{_page.svelte-BHwIILw0.js.map → _page.svelte-DL39TUpH.js.map} +1 -1
- package/build/server/chunks/{_page.svelte-DSnarRUI.js → _page.svelte-_0PdjNVj.js} +4 -4
- package/build/server/chunks/{_page.svelte-DSnarRUI.js.map → _page.svelte-_0PdjNVj.js.map} +1 -1
- package/build/server/chunks/{error.svelte-DtpUafMU.js → error.svelte-DNQXZmIO.js} +3 -3
- package/build/server/chunks/error.svelte-DNQXZmIO.js.map +1 -0
- package/build/server/chunks/{hooks.server-BJTU7JI4.js → hooks.server-CGmuK43l.js} +3 -3
- package/build/server/chunks/{hooks.server-BJTU7JI4.js.map → hooks.server-CGmuK43l.js.map} +1 -1
- package/build/server/chunks/{index-iqDDeMM6.js → index-CYIWeBgw.js} +274 -256
- package/build/server/chunks/index-CYIWeBgw.js.map +1 -0
- package/build/server/chunks/{index-apo9QTc6.js → index-RTKpMYZ1.js} +2 -2
- package/build/server/chunks/{index-apo9QTc6.js.map → index-RTKpMYZ1.js.map} +1 -1
- package/build/server/chunks/{exports-Cy4FWdYs.js → utils-h74ns7K6.js} +39 -2
- package/build/server/chunks/utils-h74ns7K6.js.map +1 -0
- package/build/server/index.js +576 -380
- package/build/server/index.js.map +1 -1
- package/build/server/manifest.js +8 -8
- package/build/server/manifest.js.map +1 -1
- package/dist/cli.js +2 -2
- package/dist/config.d.ts +8 -8
- package/package.json +1 -1
- package/build/client/_app/immutable/chunks/BMQhMafy.js.br +0 -0
- package/build/client/_app/immutable/chunks/BMQhMafy.js.gz +0 -0
- package/build/client/_app/immutable/chunks/ButWEHh0.js.br +0 -0
- package/build/client/_app/immutable/chunks/ButWEHh0.js.gz +0 -0
- package/build/client/_app/immutable/chunks/C8C04JmV.js +0 -1
- package/build/client/_app/immutable/chunks/C8C04JmV.js.br +0 -0
- package/build/client/_app/immutable/chunks/C8C04JmV.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Cj9PL7OG.js.br +0 -0
- package/build/client/_app/immutable/chunks/Cj9PL7OG.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DN_VTkOW.js.br +0 -0
- package/build/client/_app/immutable/chunks/DN_VTkOW.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DwJfO5YS.js +0 -3
- package/build/client/_app/immutable/chunks/DwJfO5YS.js.br +0 -0
- package/build/client/_app/immutable/chunks/DwJfO5YS.js.gz +0 -0
- package/build/client/_app/immutable/chunks/lSbGwHqC.js +0 -51
- package/build/client/_app/immutable/chunks/lSbGwHqC.js.br +0 -0
- package/build/client/_app/immutable/chunks/lSbGwHqC.js.gz +0 -0
- package/build/client/_app/immutable/chunks/x4Pz-wH_.js +0 -1
- package/build/client/_app/immutable/chunks/x4Pz-wH_.js.br +0 -0
- package/build/client/_app/immutable/chunks/x4Pz-wH_.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.DLzwCGBk.js +0 -2
- package/build/client/_app/immutable/entry/app.DLzwCGBk.js.br +0 -0
- package/build/client/_app/immutable/entry/app.DLzwCGBk.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.BoB-G5Ls.js +0 -1
- package/build/client/_app/immutable/entry/start.BoB-G5Ls.js.br +0 -2
- package/build/client/_app/immutable/entry/start.BoB-G5Ls.js.gz +0 -0
- package/build/client/_app/immutable/nodes/0.CE0uBbp0.js.br +0 -0
- package/build/client/_app/immutable/nodes/0.CE0uBbp0.js.gz +0 -0
- package/build/client/_app/immutable/nodes/1.9GlBYpox.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.9GlBYpox.js.gz +0 -0
- package/build/client/_app/immutable/nodes/2.B3qXd01D.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.B3qXd01D.js.gz +0 -0
- package/build/client/_app/immutable/nodes/3.DuwUIVtX.js +0 -7
- package/build/client/_app/immutable/nodes/3.DuwUIVtX.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.DuwUIVtX.js.gz +0 -0
- package/build/client/_app/immutable/nodes/4.C0wscA_4.js.br +0 -0
- package/build/client/_app/immutable/nodes/4.C0wscA_4.js.gz +0 -0
- package/build/client/_app/immutable/nodes/5.CWS-YJ56.js +0 -1
- package/build/client/_app/immutable/nodes/5.CWS-YJ56.js.br +0 -0
- package/build/client/_app/immutable/nodes/5.CWS-YJ56.js.gz +0 -0
- package/build/client/_app/immutable/nodes/6.TEubHotu.js.br +0 -0
- package/build/client/_app/immutable/nodes/6.TEubHotu.js.gz +0 -0
- package/build/server/chunks/1-D4403Evz.js +0 -9
- package/build/server/chunks/3-CCrTqwF9.js +0 -13
- package/build/server/chunks/4-vjHkix88.js +0 -9
- package/build/server/chunks/5-Dc6xvhmU.js +0 -9
- package/build/server/chunks/6-CvdeNFQU.js +0 -9
- package/build/server/chunks/_page.svelte-BHwIILw0.js +0 -11
- package/build/server/chunks/error.svelte-DtpUafMU.js.map +0 -1
- package/build/server/chunks/exports-Cy4FWdYs.js.map +0 -1
- package/build/server/chunks/index-iqDDeMM6.js.map +0 -1
package/build/server/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { r as render, L as LEGACY_PROPS, U as UNOWNED, E as ERROR_VALUE, C as COMMENT_NODE, H as HYDRATION_START, a as HYDRATION_ERROR, b as HYDRATION_END, S as STATE_SYMBOL, c as UNINITIALIZED, D as DERIVED, d as DIRTY, e as CLEAN, M as MAYBE_DIRTY, f as DISCONNECTED, I as INERT,
|
|
1
|
+
import { r as render, L as LEGACY_PROPS, U as UNOWNED, E as ERROR_VALUE, C as COMMENT_NODE, H as HYDRATION_START, a as HYDRATION_ERROR, b as HYDRATION_END, S as STATE_SYMBOL, c as UNINITIALIZED, D as DERIVED, d as DIRTY, e as CLEAN, M as MAYBE_DIRTY, f as DISCONNECTED, g as DEV, I as INERT, h as EFFECT, A as ASYNC, B as BLOCK_EFFECT, i as is_passive_event, j as BRANCH_EFFECT, R as ROOT_EFFECT, k as DESTROYED, l as REACTION_IS_UPDATING, m as EFFECT_RAN, n as EFFECT_PRESERVED, o as HEAD_EFFECT, p as BOUNDARY_EFFECT, q as EFFECT_TRANSPARENT, s as INSPECT_EFFECT, t as STALE_REACTION, u as push$1, v as setContext, w as pop$1, x as USER_EFFECT } from './chunks/index-RTKpMYZ1.js';
|
|
2
2
|
import { json, text, error } from '@sveltejs/kit';
|
|
3
3
|
import { Redirect, SvelteKitError, HttpError, ActionFailure } from '@sveltejs/kit/internal';
|
|
4
|
-
import {
|
|
4
|
+
import { with_request_store, merge_tracing } from '@sveltejs/kit/internal/server';
|
|
5
|
+
import { d as define_property, s as safe_equals, o as object_prototype, a as array_prototype, g as get_descriptor, i as is_extensible, b as array_from, e as equals, c as get_prototype_of, f as is_array, h as deferred, r as run_all, j as index_of, t as text_decoder, k as base64_decode, l as decode_pathname, m as decode_params, n as normalize_path, p as disable_search, v as validate_layout_server_exports, q as validate_layout_exports, u as validate_page_server_exports, w as validate_page_exports, x as text_encoder, y as resolve, z as make_trackable, A as get_relative_path, B as base64_encode, C as readable, D as writable } from './chunks/utils-h74ns7K6.js';
|
|
5
6
|
import { parse as parse$1, serialize } from 'cookie';
|
|
6
7
|
|
|
7
8
|
let base = "";
|
|
@@ -131,7 +132,7 @@ function stringify_key(key) {
|
|
|
131
132
|
return is_identifier.test(key) ? '.' + key : '[' + JSON.stringify(key) + ']';
|
|
132
133
|
}
|
|
133
134
|
|
|
134
|
-
const chars
|
|
135
|
+
const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$';
|
|
135
136
|
const unsafe_chars = /[<\b\f\n\r\t\0\u2028\u2029]/g;
|
|
136
137
|
const reserved =
|
|
137
138
|
/^(?:do|if|in|for|int|let|new|try|var|byte|case|char|else|enum|goto|long|this|void|with|await|break|catch|class|const|final|float|short|super|throw|while|yield|delete|double|export|import|native|return|switch|throws|typeof|boolean|default|extends|finally|package|private|abstract|continue|debugger|function|volatile|interface|protected|transient|implements|instanceof|synchronized)$/;
|
|
@@ -430,8 +431,8 @@ function get_name(num) {
|
|
|
430
431
|
let name = '';
|
|
431
432
|
|
|
432
433
|
do {
|
|
433
|
-
name = chars
|
|
434
|
-
num = ~~(num / chars
|
|
434
|
+
name = chars[num % chars.length] + name;
|
|
435
|
+
num = ~~(num / chars.length) - 1;
|
|
435
436
|
} while (num >= 0);
|
|
436
437
|
|
|
437
438
|
return reserved.test(name) ? `${name}0` : name;
|
|
@@ -955,45 +956,6 @@ function stringify_primitive(thing) {
|
|
|
955
956
|
return String(thing);
|
|
956
957
|
}
|
|
957
958
|
|
|
958
|
-
let request_event = null;
|
|
959
|
-
let als;
|
|
960
|
-
import('node:async_hooks').then((hooks) => als = new hooks.AsyncLocalStorage()).catch(() => {
|
|
961
|
-
});
|
|
962
|
-
function with_event(event, fn) {
|
|
963
|
-
try {
|
|
964
|
-
request_event = event;
|
|
965
|
-
return als ? als.run(event, fn) : fn();
|
|
966
|
-
} finally {
|
|
967
|
-
request_event = null;
|
|
968
|
-
}
|
|
969
|
-
}
|
|
970
|
-
const INVALIDATED_PARAM = "x-sveltekit-invalidated";
|
|
971
|
-
const TRAILING_SLASH_PARAM = "x-sveltekit-trailing-slash";
|
|
972
|
-
function stringify(data, transport) {
|
|
973
|
-
const encoders = Object.fromEntries(Object.entries(transport).map(([k, v]) => [k, v.encode]));
|
|
974
|
-
return stringify$1(data, encoders);
|
|
975
|
-
}
|
|
976
|
-
function parse_remote_arg(string, transport) {
|
|
977
|
-
if (!string) return void 0;
|
|
978
|
-
const decoders = Object.fromEntries(Object.entries(transport).map(([k, v]) => [k, v.decode]));
|
|
979
|
-
const base64_restored = string.replace(/-/g, "+").replace(/_/g, "/");
|
|
980
|
-
const binary_string = atob(base64_restored);
|
|
981
|
-
const utf8_bytes = new Uint8Array([...binary_string].map((char) => char.charCodeAt(0)));
|
|
982
|
-
const json_string = new TextDecoder().decode(utf8_bytes);
|
|
983
|
-
return parse(json_string, decoders);
|
|
984
|
-
}
|
|
985
|
-
const EVENT_STATE = Symbol("remote");
|
|
986
|
-
function create_event_state(state, options) {
|
|
987
|
-
return {
|
|
988
|
-
prerendering: state.prerendering,
|
|
989
|
-
transport: options.hooks.transport,
|
|
990
|
-
handleValidationError: options.hooks.handleValidationError
|
|
991
|
-
};
|
|
992
|
-
}
|
|
993
|
-
function get_event_state(event) {
|
|
994
|
-
return event[EVENT_STATE];
|
|
995
|
-
}
|
|
996
|
-
|
|
997
959
|
let public_env = {};
|
|
998
960
|
let safe_public_env = {};
|
|
999
961
|
function set_public_env(environment) {
|
|
@@ -1226,13 +1188,14 @@ function dequeue() {
|
|
|
1226
1188
|
let queued_root_effects = [];
|
|
1227
1189
|
let last_scheduled_effect = null;
|
|
1228
1190
|
let is_flushing = false;
|
|
1191
|
+
let is_flushing_sync = false;
|
|
1229
1192
|
class Batch {
|
|
1230
1193
|
/**
|
|
1231
1194
|
* The current values of any sources that are updated in this batch
|
|
1232
1195
|
* They keys of this map are identical to `this.#previous`
|
|
1233
1196
|
* @type {Map<Source, any>}
|
|
1234
1197
|
*/
|
|
1235
|
-
|
|
1198
|
+
current = /* @__PURE__ */ new Map();
|
|
1236
1199
|
/**
|
|
1237
1200
|
* The values of any sources that are updated in this batch _before_ those updates took place.
|
|
1238
1201
|
* They keys of this map are identical to `this.#current`
|
|
@@ -1290,6 +1253,16 @@ class Batch {
|
|
|
1290
1253
|
* @type {Effect[]}
|
|
1291
1254
|
*/
|
|
1292
1255
|
#block_effects = [];
|
|
1256
|
+
/**
|
|
1257
|
+
* Deferred effects (which run after async work has completed) that are DIRTY
|
|
1258
|
+
* @type {Effect[]}
|
|
1259
|
+
*/
|
|
1260
|
+
#dirty_effects = [];
|
|
1261
|
+
/**
|
|
1262
|
+
* Deferred effects that are MAYBE_DIRTY
|
|
1263
|
+
* @type {Effect[]}
|
|
1264
|
+
*/
|
|
1265
|
+
#maybe_dirty_effects = [];
|
|
1293
1266
|
/**
|
|
1294
1267
|
* A set of branches that still exist, but will be destroyed when this batch
|
|
1295
1268
|
* is committed — we skip over these during `process`
|
|
@@ -1300,13 +1273,13 @@ class Batch {
|
|
|
1300
1273
|
*
|
|
1301
1274
|
* @param {Effect[]} root_effects
|
|
1302
1275
|
*/
|
|
1303
|
-
|
|
1276
|
+
process(root_effects) {
|
|
1304
1277
|
queued_root_effects = [];
|
|
1305
1278
|
var current_values = null;
|
|
1306
1279
|
if (batches.size > 1) {
|
|
1307
1280
|
current_values = /* @__PURE__ */ new Map();
|
|
1308
1281
|
batch_deriveds = /* @__PURE__ */ new Map();
|
|
1309
|
-
for (const [source2, current] of this
|
|
1282
|
+
for (const [source2, current] of this.current) {
|
|
1310
1283
|
current_values.set(source2, { v: source2.v, wv: source2.wv });
|
|
1311
1284
|
source2.v = current;
|
|
1312
1285
|
}
|
|
@@ -1324,19 +1297,25 @@ class Batch {
|
|
|
1324
1297
|
this.#traverse_effect_tree(root2);
|
|
1325
1298
|
}
|
|
1326
1299
|
if (this.#async_effects.length === 0 && this.#pending === 0) {
|
|
1300
|
+
this.#commit();
|
|
1327
1301
|
var render_effects = this.#render_effects;
|
|
1328
1302
|
var effects = this.#effects;
|
|
1329
1303
|
this.#render_effects = [];
|
|
1330
1304
|
this.#effects = [];
|
|
1331
1305
|
this.#block_effects = [];
|
|
1332
|
-
|
|
1306
|
+
current_batch = null;
|
|
1333
1307
|
flush_queued_effects(render_effects);
|
|
1334
1308
|
flush_queued_effects(effects);
|
|
1309
|
+
if (current_batch === null) {
|
|
1310
|
+
current_batch = this;
|
|
1311
|
+
} else {
|
|
1312
|
+
batches.delete(this);
|
|
1313
|
+
}
|
|
1335
1314
|
this.#deferred?.resolve();
|
|
1336
1315
|
} else {
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1316
|
+
this.#defer_effects(this.#render_effects);
|
|
1317
|
+
this.#defer_effects(this.#effects);
|
|
1318
|
+
this.#defer_effects(this.#block_effects);
|
|
1340
1319
|
}
|
|
1341
1320
|
if (current_values) {
|
|
1342
1321
|
for (const [source2, { v, wv }] of current_values) {
|
|
@@ -1373,11 +1352,11 @@ class Batch {
|
|
|
1373
1352
|
effect.f ^= CLEAN;
|
|
1374
1353
|
} else if ((flags & EFFECT) !== 0) {
|
|
1375
1354
|
this.#effects.push(effect);
|
|
1376
|
-
} else if (
|
|
1355
|
+
} else if ((flags & CLEAN) === 0) {
|
|
1377
1356
|
if ((flags & ASYNC) !== 0) {
|
|
1378
1357
|
var effects = effect.b?.pending ? this.#boundary_async_effects : this.#async_effects;
|
|
1379
1358
|
effects.push(effect);
|
|
1380
|
-
} else {
|
|
1359
|
+
} else if (is_dirty(effect)) {
|
|
1381
1360
|
if ((effect.f & BLOCK_EFFECT) !== 0) this.#block_effects.push(effect);
|
|
1382
1361
|
update_effect(effect);
|
|
1383
1362
|
}
|
|
@@ -1396,6 +1375,17 @@ class Batch {
|
|
|
1396
1375
|
}
|
|
1397
1376
|
}
|
|
1398
1377
|
}
|
|
1378
|
+
/**
|
|
1379
|
+
* @param {Effect[]} effects
|
|
1380
|
+
*/
|
|
1381
|
+
#defer_effects(effects) {
|
|
1382
|
+
for (const e of effects) {
|
|
1383
|
+
const target = (e.f & DIRTY) !== 0 ? this.#dirty_effects : this.#maybe_dirty_effects;
|
|
1384
|
+
target.push(e);
|
|
1385
|
+
set_signal_status(e, CLEAN);
|
|
1386
|
+
}
|
|
1387
|
+
effects.length = 0;
|
|
1388
|
+
}
|
|
1399
1389
|
/**
|
|
1400
1390
|
* Associate a change to a given source with the current
|
|
1401
1391
|
* batch, noting its previous and current values
|
|
@@ -1406,7 +1396,7 @@ class Batch {
|
|
|
1406
1396
|
if (!this.#previous.has(source2)) {
|
|
1407
1397
|
this.#previous.set(source2, value);
|
|
1408
1398
|
}
|
|
1409
|
-
this
|
|
1399
|
+
this.current.set(source2, source2.v);
|
|
1410
1400
|
}
|
|
1411
1401
|
activate() {
|
|
1412
1402
|
current_batch = this;
|
|
@@ -1426,7 +1416,7 @@ class Batch {
|
|
|
1426
1416
|
}
|
|
1427
1417
|
flush() {
|
|
1428
1418
|
if (queued_root_effects.length > 0) {
|
|
1429
|
-
|
|
1419
|
+
flush_effects();
|
|
1430
1420
|
} else {
|
|
1431
1421
|
this.#commit();
|
|
1432
1422
|
}
|
|
@@ -1438,27 +1428,6 @@ class Batch {
|
|
|
1438
1428
|
}
|
|
1439
1429
|
this.deactivate();
|
|
1440
1430
|
}
|
|
1441
|
-
flush_effects() {
|
|
1442
|
-
var was_updating_effect = is_updating_effect;
|
|
1443
|
-
is_flushing = true;
|
|
1444
|
-
try {
|
|
1445
|
-
var flush_count = 0;
|
|
1446
|
-
set_is_updating_effect(true);
|
|
1447
|
-
while (queued_root_effects.length > 0) {
|
|
1448
|
-
if (flush_count++ > 1e3) {
|
|
1449
|
-
var updates, entry;
|
|
1450
|
-
if (DEV) ;
|
|
1451
|
-
infinite_loop_guard();
|
|
1452
|
-
}
|
|
1453
|
-
this.#process(queued_root_effects);
|
|
1454
|
-
old_values.clear();
|
|
1455
|
-
}
|
|
1456
|
-
} finally {
|
|
1457
|
-
is_flushing = false;
|
|
1458
|
-
set_is_updating_effect(was_updating_effect);
|
|
1459
|
-
last_scheduled_effect = null;
|
|
1460
|
-
}
|
|
1461
|
-
}
|
|
1462
1431
|
/**
|
|
1463
1432
|
* Append and remove branches to/from the DOM
|
|
1464
1433
|
*/
|
|
@@ -1476,16 +1445,12 @@ class Batch {
|
|
|
1476
1445
|
decrement() {
|
|
1477
1446
|
this.#pending -= 1;
|
|
1478
1447
|
if (this.#pending === 0) {
|
|
1479
|
-
for (const e of this.#
|
|
1448
|
+
for (const e of this.#dirty_effects) {
|
|
1480
1449
|
set_signal_status(e, DIRTY);
|
|
1481
1450
|
schedule_effect(e);
|
|
1482
1451
|
}
|
|
1483
|
-
for (const e of this.#
|
|
1484
|
-
set_signal_status(e,
|
|
1485
|
-
schedule_effect(e);
|
|
1486
|
-
}
|
|
1487
|
-
for (const e of this.#block_effects) {
|
|
1488
|
-
set_signal_status(e, DIRTY);
|
|
1452
|
+
for (const e of this.#maybe_dirty_effects) {
|
|
1453
|
+
set_signal_status(e, MAYBE_DIRTY);
|
|
1489
1454
|
schedule_effect(e);
|
|
1490
1455
|
}
|
|
1491
1456
|
this.#render_effects = [];
|
|
@@ -1502,11 +1467,11 @@ class Batch {
|
|
|
1502
1467
|
settled() {
|
|
1503
1468
|
return (this.#deferred ??= deferred()).promise;
|
|
1504
1469
|
}
|
|
1505
|
-
static ensure(
|
|
1470
|
+
static ensure() {
|
|
1506
1471
|
if (current_batch === null) {
|
|
1507
1472
|
const batch = current_batch = new Batch();
|
|
1508
1473
|
batches.add(current_batch);
|
|
1509
|
-
if (
|
|
1474
|
+
if (!is_flushing_sync) {
|
|
1510
1475
|
Batch.enqueue(() => {
|
|
1511
1476
|
if (current_batch !== batch) {
|
|
1512
1477
|
return;
|
|
@@ -1526,21 +1491,49 @@ class Batch {
|
|
|
1526
1491
|
}
|
|
1527
1492
|
}
|
|
1528
1493
|
function flushSync(fn) {
|
|
1529
|
-
var
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
if (
|
|
1534
|
-
|
|
1535
|
-
|
|
1494
|
+
var was_flushing_sync = is_flushing_sync;
|
|
1495
|
+
is_flushing_sync = true;
|
|
1496
|
+
try {
|
|
1497
|
+
var result;
|
|
1498
|
+
if (fn) ;
|
|
1499
|
+
while (true) {
|
|
1500
|
+
flush_tasks();
|
|
1501
|
+
if (queued_root_effects.length === 0) {
|
|
1502
|
+
current_batch?.flush();
|
|
1503
|
+
if (queued_root_effects.length === 0) {
|
|
1504
|
+
last_scheduled_effect = null;
|
|
1505
|
+
return (
|
|
1506
|
+
/** @type {T} */
|
|
1507
|
+
result
|
|
1508
|
+
);
|
|
1509
|
+
}
|
|
1536
1510
|
}
|
|
1537
|
-
|
|
1538
|
-
return (
|
|
1539
|
-
/** @type {T} */
|
|
1540
|
-
result
|
|
1541
|
-
);
|
|
1511
|
+
flush_effects();
|
|
1542
1512
|
}
|
|
1543
|
-
|
|
1513
|
+
} finally {
|
|
1514
|
+
is_flushing_sync = was_flushing_sync;
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
function flush_effects() {
|
|
1518
|
+
var was_updating_effect = is_updating_effect;
|
|
1519
|
+
is_flushing = true;
|
|
1520
|
+
try {
|
|
1521
|
+
var flush_count = 0;
|
|
1522
|
+
set_is_updating_effect(true);
|
|
1523
|
+
while (queued_root_effects.length > 0) {
|
|
1524
|
+
var batch = Batch.ensure();
|
|
1525
|
+
if (flush_count++ > 1e3) {
|
|
1526
|
+
var updates, entry;
|
|
1527
|
+
if (DEV) ;
|
|
1528
|
+
infinite_loop_guard();
|
|
1529
|
+
}
|
|
1530
|
+
batch.process(queued_root_effects);
|
|
1531
|
+
old_values.clear();
|
|
1532
|
+
}
|
|
1533
|
+
} finally {
|
|
1534
|
+
is_flushing = false;
|
|
1535
|
+
set_is_updating_effect(was_updating_effect);
|
|
1536
|
+
last_scheduled_effect = null;
|
|
1544
1537
|
}
|
|
1545
1538
|
}
|
|
1546
1539
|
function infinite_loop_guard() {
|
|
@@ -1550,31 +1543,33 @@ function infinite_loop_guard() {
|
|
|
1550
1543
|
invoke_error_boundary(error, last_scheduled_effect);
|
|
1551
1544
|
}
|
|
1552
1545
|
}
|
|
1546
|
+
let eager_block_effects = null;
|
|
1553
1547
|
function flush_queued_effects(effects) {
|
|
1554
1548
|
var length = effects.length;
|
|
1555
1549
|
if (length === 0) return;
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
}
|
|
1550
|
+
var i = 0;
|
|
1551
|
+
while (i < length) {
|
|
1552
|
+
var effect = effects[i++];
|
|
1553
|
+
if ((effect.f & (DESTROYED | INERT)) === 0 && is_dirty(effect)) {
|
|
1554
|
+
eager_block_effects = [];
|
|
1555
|
+
update_effect(effect);
|
|
1556
|
+
if (effect.deps === null && effect.first === null && effect.nodes_start === null) {
|
|
1557
|
+
if (effect.teardown === null && effect.ac === null) {
|
|
1558
|
+
unlink_effect(effect);
|
|
1559
|
+
} else {
|
|
1560
|
+
effect.fn = null;
|
|
1568
1561
|
}
|
|
1569
|
-
|
|
1570
|
-
|
|
1562
|
+
}
|
|
1563
|
+
if (eager_block_effects.length > 0) {
|
|
1564
|
+
old_values.clear();
|
|
1565
|
+
for (const e of eager_block_effects) {
|
|
1566
|
+
update_effect(e);
|
|
1571
1567
|
}
|
|
1568
|
+
eager_block_effects = [];
|
|
1572
1569
|
}
|
|
1573
1570
|
}
|
|
1574
1571
|
}
|
|
1575
|
-
|
|
1576
|
-
schedule_effect(effects[i]);
|
|
1577
|
-
}
|
|
1572
|
+
eager_block_effects = null;
|
|
1578
1573
|
}
|
|
1579
1574
|
function schedule_effect(signal) {
|
|
1580
1575
|
var effect = last_scheduled_effect = signal;
|
|
@@ -1636,7 +1631,7 @@ function internal_set(source2, value) {
|
|
|
1636
1631
|
old_values.set(source2, old_value);
|
|
1637
1632
|
}
|
|
1638
1633
|
source2.v = value;
|
|
1639
|
-
|
|
1634
|
+
var batch = Batch.ensure();
|
|
1640
1635
|
batch.capture(source2, old_value);
|
|
1641
1636
|
if ((source2.f & DERIVED) !== 0) {
|
|
1642
1637
|
if ((source2.f & DIRTY) !== 0) {
|
|
@@ -1669,7 +1664,8 @@ function mark_reactions(signal, status) {
|
|
|
1669
1664
|
for (var i = 0; i < length; i++) {
|
|
1670
1665
|
var reaction = reactions[i];
|
|
1671
1666
|
var flags = reaction.f;
|
|
1672
|
-
|
|
1667
|
+
var not_dirty = (flags & DIRTY) === 0;
|
|
1668
|
+
if (not_dirty) {
|
|
1673
1669
|
set_signal_status(reaction, status);
|
|
1674
1670
|
}
|
|
1675
1671
|
if ((flags & DERIVED) !== 0) {
|
|
@@ -1678,7 +1674,15 @@ function mark_reactions(signal, status) {
|
|
|
1678
1674
|
reaction,
|
|
1679
1675
|
MAYBE_DIRTY
|
|
1680
1676
|
);
|
|
1681
|
-
} else if (
|
|
1677
|
+
} else if (not_dirty) {
|
|
1678
|
+
if ((flags & BLOCK_EFFECT) !== 0) {
|
|
1679
|
+
if (eager_block_effects !== null) {
|
|
1680
|
+
eager_block_effects.push(
|
|
1681
|
+
/** @type {Effect} */
|
|
1682
|
+
reaction
|
|
1683
|
+
);
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1682
1686
|
schedule_effect(
|
|
1683
1687
|
/** @type {Effect} */
|
|
1684
1688
|
reaction
|
|
@@ -1914,6 +1918,18 @@ function get_next_sibling(node) {
|
|
|
1914
1918
|
function clear_text_content(node) {
|
|
1915
1919
|
node.textContent = "";
|
|
1916
1920
|
}
|
|
1921
|
+
function without_reactive_context(fn) {
|
|
1922
|
+
var previous_reaction = active_reaction;
|
|
1923
|
+
var previous_effect = active_effect;
|
|
1924
|
+
set_active_reaction(null);
|
|
1925
|
+
set_active_effect(null);
|
|
1926
|
+
try {
|
|
1927
|
+
return fn();
|
|
1928
|
+
} finally {
|
|
1929
|
+
set_active_reaction(previous_reaction);
|
|
1930
|
+
set_active_effect(previous_effect);
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1917
1933
|
function push_effect(effect, parent_effect) {
|
|
1918
1934
|
var parent_last = parent_effect.last;
|
|
1919
1935
|
if (parent_last === null) {
|
|
@@ -1963,7 +1979,7 @@ function create_effect(type, fn, sync, push2 = true) {
|
|
|
1963
1979
|
if (parent !== null) {
|
|
1964
1980
|
push_effect(effect, parent);
|
|
1965
1981
|
}
|
|
1966
|
-
if (active_reaction !== null && (active_reaction.f & DERIVED) !== 0) {
|
|
1982
|
+
if (active_reaction !== null && (active_reaction.f & DERIVED) !== 0 && (type & ROOT_EFFECT) === 0) {
|
|
1967
1983
|
var derived = (
|
|
1968
1984
|
/** @type {Derived} */
|
|
1969
1985
|
active_reaction
|
|
@@ -2015,7 +2031,12 @@ function destroy_effect_children(signal, remove_dom = false) {
|
|
|
2015
2031
|
var effect = signal.first;
|
|
2016
2032
|
signal.first = signal.last = null;
|
|
2017
2033
|
while (effect !== null) {
|
|
2018
|
-
effect.ac
|
|
2034
|
+
const controller = effect.ac;
|
|
2035
|
+
if (controller !== null) {
|
|
2036
|
+
without_reactive_context(() => {
|
|
2037
|
+
controller.abort(STALE_REACTION);
|
|
2038
|
+
});
|
|
2039
|
+
}
|
|
2019
2040
|
var next = effect.next;
|
|
2020
2041
|
if ((effect.f & ROOT_EFFECT) !== 0) {
|
|
2021
2042
|
effect.parent = null;
|
|
@@ -2267,15 +2288,18 @@ function update_reaction(reaction) {
|
|
|
2267
2288
|
untracking = false;
|
|
2268
2289
|
update_version = ++read_version;
|
|
2269
2290
|
if (reaction.ac !== null) {
|
|
2270
|
-
|
|
2291
|
+
without_reactive_context(() => {
|
|
2292
|
+
reaction.ac.abort(STALE_REACTION);
|
|
2293
|
+
});
|
|
2271
2294
|
reaction.ac = null;
|
|
2272
2295
|
}
|
|
2273
2296
|
try {
|
|
2274
2297
|
reaction.f |= REACTION_IS_UPDATING;
|
|
2275
|
-
var
|
|
2298
|
+
var fn = (
|
|
2276
2299
|
/** @type {Function} */
|
|
2277
|
-
|
|
2300
|
+
reaction.fn
|
|
2278
2301
|
);
|
|
2302
|
+
var result = fn();
|
|
2279
2303
|
var deps = reaction.deps;
|
|
2280
2304
|
if (new_deps !== null) {
|
|
2281
2305
|
var i;
|
|
@@ -2497,6 +2521,7 @@ function set_signal_status(signal, status) {
|
|
|
2497
2521
|
}
|
|
2498
2522
|
const all_registered_events = /* @__PURE__ */ new Set();
|
|
2499
2523
|
const root_event_handles = /* @__PURE__ */ new Set();
|
|
2524
|
+
let last_propagated_event = null;
|
|
2500
2525
|
function handle_event_propagation(event) {
|
|
2501
2526
|
var handler_element = this;
|
|
2502
2527
|
var owner_document = (
|
|
@@ -2509,8 +2534,9 @@ function handle_event_propagation(event) {
|
|
|
2509
2534
|
/** @type {null | Element} */
|
|
2510
2535
|
path[0] || event.target
|
|
2511
2536
|
);
|
|
2537
|
+
last_propagated_event = event;
|
|
2512
2538
|
var path_idx = 0;
|
|
2513
|
-
var handled_at = event.__root;
|
|
2539
|
+
var handled_at = last_propagated_event === event && event.__root;
|
|
2514
2540
|
if (handled_at) {
|
|
2515
2541
|
var at_idx = path.indexOf(handled_at);
|
|
2516
2542
|
if (at_idx !== -1 && (handler_element === document || handler_element === /** @type {any} */
|
|
@@ -2635,16 +2661,19 @@ function hydrate(component, options2) {
|
|
|
2635
2661
|
instance
|
|
2636
2662
|
);
|
|
2637
2663
|
} catch (error) {
|
|
2638
|
-
if (error
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
clear_text_content(target);
|
|
2644
|
-
set_hydrating(false);
|
|
2645
|
-
return mount(component, options2);
|
|
2664
|
+
if (error instanceof Error && error.message.split("\n").some((line) => line.startsWith("https://svelte.dev/e/"))) {
|
|
2665
|
+
throw error;
|
|
2666
|
+
}
|
|
2667
|
+
if (error !== HYDRATION_ERROR) {
|
|
2668
|
+
console.warn("Failed to hydrate: ", error);
|
|
2646
2669
|
}
|
|
2647
|
-
|
|
2670
|
+
if (options2.recover === false) {
|
|
2671
|
+
hydration_failed();
|
|
2672
|
+
}
|
|
2673
|
+
init_operations();
|
|
2674
|
+
clear_text_content(target);
|
|
2675
|
+
set_hydrating(false);
|
|
2676
|
+
return mount(component, options2);
|
|
2648
2677
|
} finally {
|
|
2649
2678
|
set_hydrating(was_hydrating);
|
|
2650
2679
|
set_hydrate_node(previous_hydrate_node);
|
|
@@ -2915,6 +2944,7 @@ const options = {
|
|
|
2915
2944
|
preload_strategy: "modulepreload",
|
|
2916
2945
|
root,
|
|
2917
2946
|
service_worker: false,
|
|
2947
|
+
service_worker_options: void 0,
|
|
2918
2948
|
templates: {
|
|
2919
2949
|
app: ({ head, body, assets, nonce, env }) => '<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <link rel="icon" href="' + assets + '/favicon.svg" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <meta name="color-scheme" content="dark light" />\n <link rel="stylesheet" href="' + assets + '/theme.css" />\n <link rel="stylesheet" href="' + assets + '/styles.css" />\n <link rel="preload" href="' + assets + '/icons/light.svg" as="image" type="image/svg+xml" />\n <link rel="preload" href="' + assets + '/icons/regular.svg" as="image" type="image/svg+xml" />\n <link rel="preload" href="' + assets + '/icons/solid.svg" as="image" type="image/svg+xml" />\n ' + head + '\n </head>\n\n <body>\n <div style="display: contents">' + body + "</div>\n </body>\n</html>\n",
|
|
2920
2950
|
error: ({ status, message }) => '<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <title>' + message + `</title>
|
|
@@ -2988,7 +3018,7 @@ const options = {
|
|
|
2988
3018
|
<div class="error">
|
|
2989
3019
|
<span class="status">` + status + '</span>\n <div class="message">\n <h1>' + message + "</h1>\n </div>\n </div>\n </body>\n</html>\n"
|
|
2990
3020
|
},
|
|
2991
|
-
version_hash: "
|
|
3021
|
+
version_hash: "o0idy5"
|
|
2992
3022
|
};
|
|
2993
3023
|
async function get_hooks() {
|
|
2994
3024
|
let handle;
|
|
@@ -2996,7 +3026,7 @@ async function get_hooks() {
|
|
|
2996
3026
|
let handleError;
|
|
2997
3027
|
let handleValidationError;
|
|
2998
3028
|
let init;
|
|
2999
|
-
({ handle, handleFetch, handleError, handleValidationError, init } = await import('./chunks/hooks.server-
|
|
3029
|
+
({ handle, handleFetch, handleError, handleValidationError, init } = await import('./chunks/hooks.server-CGmuK43l.js'));
|
|
3000
3030
|
let reroute;
|
|
3001
3031
|
let transport;
|
|
3002
3032
|
return {
|
|
@@ -3010,6 +3040,22 @@ async function get_hooks() {
|
|
|
3010
3040
|
};
|
|
3011
3041
|
}
|
|
3012
3042
|
|
|
3043
|
+
const INVALIDATED_PARAM = "x-sveltekit-invalidated";
|
|
3044
|
+
const TRAILING_SLASH_PARAM = "x-sveltekit-trailing-slash";
|
|
3045
|
+
function stringify(data, transport) {
|
|
3046
|
+
const encoders = Object.fromEntries(Object.entries(transport).map(([k, v]) => [k, v.encode]));
|
|
3047
|
+
return stringify$1(data, encoders);
|
|
3048
|
+
}
|
|
3049
|
+
function parse_remote_arg(string, transport) {
|
|
3050
|
+
if (!string) return void 0;
|
|
3051
|
+
const json_string = text_decoder.decode(
|
|
3052
|
+
// no need to add back `=` characters, atob can handle it
|
|
3053
|
+
base64_decode(string.replaceAll("-", "+").replaceAll("_", "/"))
|
|
3054
|
+
);
|
|
3055
|
+
const decoders = Object.fromEntries(Object.entries(transport).map(([k, v]) => [k, v.decode]));
|
|
3056
|
+
return parse(json_string, decoders);
|
|
3057
|
+
}
|
|
3058
|
+
|
|
3013
3059
|
var setCookie = {exports: {}};
|
|
3014
3060
|
|
|
3015
3061
|
var hasRequiredSetCookie;
|
|
@@ -3370,10 +3416,10 @@ function static_error_page(options2, status, message) {
|
|
|
3370
3416
|
status
|
|
3371
3417
|
});
|
|
3372
3418
|
}
|
|
3373
|
-
async function handle_fatal_error(event, options2, error2) {
|
|
3419
|
+
async function handle_fatal_error(event, state, options2, error2) {
|
|
3374
3420
|
error2 = error2 instanceof HttpError ? error2 : coalesce_to_error(error2);
|
|
3375
3421
|
const status = get_status(error2);
|
|
3376
|
-
const body2 = await handle_error_and_jsonify(event, options2, error2);
|
|
3422
|
+
const body2 = await handle_error_and_jsonify(event, state, options2, error2);
|
|
3377
3423
|
const type = negotiate(event.request.headers.get("accept") || "text/html", [
|
|
3378
3424
|
"application/json",
|
|
3379
3425
|
"text/html"
|
|
@@ -3385,14 +3431,14 @@ async function handle_fatal_error(event, options2, error2) {
|
|
|
3385
3431
|
}
|
|
3386
3432
|
return static_error_page(options2, status, body2.message);
|
|
3387
3433
|
}
|
|
3388
|
-
async function handle_error_and_jsonify(event, options2, error2) {
|
|
3434
|
+
async function handle_error_and_jsonify(event, state, options2, error2) {
|
|
3389
3435
|
if (error2 instanceof HttpError) {
|
|
3390
3436
|
return error2.body;
|
|
3391
3437
|
}
|
|
3392
3438
|
const status = get_status(error2);
|
|
3393
3439
|
const message = get_message(error2);
|
|
3394
|
-
return await
|
|
3395
|
-
event,
|
|
3440
|
+
return await with_request_store(
|
|
3441
|
+
{ event, state },
|
|
3396
3442
|
() => options2.hooks.handleError({ error: error2, event, status, message })
|
|
3397
3443
|
) ?? { message };
|
|
3398
3444
|
}
|
|
@@ -3431,7 +3477,14 @@ function serialize_uses(node) {
|
|
|
3431
3477
|
function has_prerendered_path(manifest, pathname) {
|
|
3432
3478
|
return manifest._.prerendered_routes.has(pathname) || pathname.at(-1) === "/" && manifest._.prerendered_routes.has(pathname.slice(0, -1));
|
|
3433
3479
|
}
|
|
3434
|
-
|
|
3480
|
+
function get_node_type(node_id) {
|
|
3481
|
+
const parts = node_id?.split("/");
|
|
3482
|
+
const filename = parts?.at(-1);
|
|
3483
|
+
if (!filename) return "unknown";
|
|
3484
|
+
const dot_parts = filename.split(".");
|
|
3485
|
+
return dot_parts.slice(0, -1).join(".");
|
|
3486
|
+
}
|
|
3487
|
+
async function render_endpoint(event, event_state, mod, state) {
|
|
3435
3488
|
const method = (
|
|
3436
3489
|
/** @type {import('types').HttpMethod} */
|
|
3437
3490
|
event.request.method
|
|
@@ -3455,8 +3508,8 @@ async function render_endpoint(event, mod, state) {
|
|
|
3455
3508
|
}
|
|
3456
3509
|
}
|
|
3457
3510
|
try {
|
|
3458
|
-
const response = await
|
|
3459
|
-
event,
|
|
3511
|
+
const response = await with_request_store(
|
|
3512
|
+
{ event, state: event_state },
|
|
3460
3513
|
() => handler(
|
|
3461
3514
|
/** @type {import('@sveltejs/kit').RequestEvent<Record<string, any>>} */
|
|
3462
3515
|
event
|
|
@@ -3538,6 +3591,51 @@ function add_resolution_suffix(pathname) {
|
|
|
3538
3591
|
function strip_resolution_suffix(pathname) {
|
|
3539
3592
|
return pathname.slice(0, -ROUTE_SUFFIX.length);
|
|
3540
3593
|
}
|
|
3594
|
+
const noop_span = {
|
|
3595
|
+
spanContext() {
|
|
3596
|
+
return noop_span_context;
|
|
3597
|
+
},
|
|
3598
|
+
setAttribute() {
|
|
3599
|
+
return this;
|
|
3600
|
+
},
|
|
3601
|
+
setAttributes() {
|
|
3602
|
+
return this;
|
|
3603
|
+
},
|
|
3604
|
+
addEvent() {
|
|
3605
|
+
return this;
|
|
3606
|
+
},
|
|
3607
|
+
setStatus() {
|
|
3608
|
+
return this;
|
|
3609
|
+
},
|
|
3610
|
+
updateName() {
|
|
3611
|
+
return this;
|
|
3612
|
+
},
|
|
3613
|
+
end() {
|
|
3614
|
+
return this;
|
|
3615
|
+
},
|
|
3616
|
+
isRecording() {
|
|
3617
|
+
return false;
|
|
3618
|
+
},
|
|
3619
|
+
recordException() {
|
|
3620
|
+
return this;
|
|
3621
|
+
},
|
|
3622
|
+
addLink() {
|
|
3623
|
+
return this;
|
|
3624
|
+
},
|
|
3625
|
+
addLinks() {
|
|
3626
|
+
return this;
|
|
3627
|
+
}
|
|
3628
|
+
};
|
|
3629
|
+
const noop_span_context = {
|
|
3630
|
+
traceId: "",
|
|
3631
|
+
spanId: "",
|
|
3632
|
+
traceFlags: 0
|
|
3633
|
+
};
|
|
3634
|
+
async function record_span({ name, attributes, fn }) {
|
|
3635
|
+
{
|
|
3636
|
+
return fn(noop_span);
|
|
3637
|
+
}
|
|
3638
|
+
}
|
|
3541
3639
|
function is_action_json_request(event) {
|
|
3542
3640
|
const accept = negotiate(event.request.headers.get("accept") ?? "*/*", [
|
|
3543
3641
|
"application/json",
|
|
@@ -3545,7 +3643,7 @@ function is_action_json_request(event) {
|
|
|
3545
3643
|
]);
|
|
3546
3644
|
return accept === "application/json" && event.request.method === "POST";
|
|
3547
3645
|
}
|
|
3548
|
-
async function handle_action_json_request(event, options2, server) {
|
|
3646
|
+
async function handle_action_json_request(event, event_state, options2, server) {
|
|
3549
3647
|
const actions = server?.actions;
|
|
3550
3648
|
if (!actions) {
|
|
3551
3649
|
const no_actions_error = new SvelteKitError(
|
|
@@ -3556,7 +3654,7 @@ async function handle_action_json_request(event, options2, server) {
|
|
|
3556
3654
|
return action_json(
|
|
3557
3655
|
{
|
|
3558
3656
|
type: "error",
|
|
3559
|
-
error: await handle_error_and_jsonify(event, options2, no_actions_error)
|
|
3657
|
+
error: await handle_error_and_jsonify(event, event_state, options2, no_actions_error)
|
|
3560
3658
|
},
|
|
3561
3659
|
{
|
|
3562
3660
|
status: no_actions_error.status,
|
|
@@ -3570,7 +3668,7 @@ async function handle_action_json_request(event, options2, server) {
|
|
|
3570
3668
|
}
|
|
3571
3669
|
check_named_default_separate(actions);
|
|
3572
3670
|
try {
|
|
3573
|
-
const data = await call_action(event, actions);
|
|
3671
|
+
const data = await call_action(event, event_state, actions);
|
|
3574
3672
|
if (false) ;
|
|
3575
3673
|
if (data instanceof ActionFailure) {
|
|
3576
3674
|
return action_json({
|
|
@@ -3607,7 +3705,12 @@ async function handle_action_json_request(event, options2, server) {
|
|
|
3607
3705
|
return action_json(
|
|
3608
3706
|
{
|
|
3609
3707
|
type: "error",
|
|
3610
|
-
error: await handle_error_and_jsonify(
|
|
3708
|
+
error: await handle_error_and_jsonify(
|
|
3709
|
+
event,
|
|
3710
|
+
event_state,
|
|
3711
|
+
options2,
|
|
3712
|
+
check_incorrect_fail_use(err)
|
|
3713
|
+
)
|
|
3611
3714
|
},
|
|
3612
3715
|
{
|
|
3613
3716
|
status: get_status(err)
|
|
@@ -3631,7 +3734,7 @@ function action_json(data, init2) {
|
|
|
3631
3734
|
function is_action_request(event) {
|
|
3632
3735
|
return event.request.method === "POST";
|
|
3633
3736
|
}
|
|
3634
|
-
async function handle_action_request(event, server) {
|
|
3737
|
+
async function handle_action_request(event, event_state, server) {
|
|
3635
3738
|
const actions = server?.actions;
|
|
3636
3739
|
if (!actions) {
|
|
3637
3740
|
event.setHeaders({
|
|
@@ -3650,7 +3753,7 @@ async function handle_action_request(event, server) {
|
|
|
3650
3753
|
}
|
|
3651
3754
|
check_named_default_separate(actions);
|
|
3652
3755
|
try {
|
|
3653
|
-
const data = await call_action(event, actions);
|
|
3756
|
+
const data = await call_action(event, event_state, actions);
|
|
3654
3757
|
if (false) ;
|
|
3655
3758
|
if (data instanceof ActionFailure) {
|
|
3656
3759
|
return {
|
|
@@ -3688,7 +3791,7 @@ function check_named_default_separate(actions) {
|
|
|
3688
3791
|
);
|
|
3689
3792
|
}
|
|
3690
3793
|
}
|
|
3691
|
-
async function call_action(event, actions) {
|
|
3794
|
+
async function call_action(event, event_state, actions) {
|
|
3692
3795
|
const url = new URL(event.request.url);
|
|
3693
3796
|
let name = "default";
|
|
3694
3797
|
for (const param of url.searchParams) {
|
|
@@ -3713,7 +3816,26 @@ async function call_action(event, actions) {
|
|
|
3713
3816
|
)}`
|
|
3714
3817
|
);
|
|
3715
3818
|
}
|
|
3716
|
-
return
|
|
3819
|
+
return record_span({
|
|
3820
|
+
name: "sveltekit.form_action",
|
|
3821
|
+
attributes: {
|
|
3822
|
+
"http.route": event.route.id || "unknown"
|
|
3823
|
+
},
|
|
3824
|
+
fn: async (current) => {
|
|
3825
|
+
const traced_event = merge_tracing(event, current);
|
|
3826
|
+
const result = await with_request_store(
|
|
3827
|
+
{ event: traced_event, state: event_state },
|
|
3828
|
+
() => action(traced_event)
|
|
3829
|
+
);
|
|
3830
|
+
if (result instanceof ActionFailure) {
|
|
3831
|
+
current.setAttributes({
|
|
3832
|
+
"sveltekit.form_action.result.type": "failure",
|
|
3833
|
+
"sveltekit.form_action.result.status": result.status
|
|
3834
|
+
});
|
|
3835
|
+
}
|
|
3836
|
+
return result;
|
|
3837
|
+
}
|
|
3838
|
+
});
|
|
3717
3839
|
}
|
|
3718
3840
|
function uneval_action_response(data, route_id, transport) {
|
|
3719
3841
|
const replacer = (thing) => {
|
|
@@ -3753,30 +3875,7 @@ function try_serialize(data, fn, route_id) {
|
|
|
3753
3875
|
throw error2;
|
|
3754
3876
|
}
|
|
3755
3877
|
}
|
|
3756
|
-
function
|
|
3757
|
-
if (globalThis.Buffer) {
|
|
3758
|
-
return Buffer.from(buffer).toString("base64");
|
|
3759
|
-
}
|
|
3760
|
-
const little_endian = new Uint8Array(new Uint16Array([1]).buffer)[0] > 0;
|
|
3761
|
-
return btoa(
|
|
3762
|
-
new TextDecoder(little_endian ? "utf-16le" : "utf-16be").decode(
|
|
3763
|
-
new Uint16Array(new Uint8Array(buffer))
|
|
3764
|
-
)
|
|
3765
|
-
);
|
|
3766
|
-
}
|
|
3767
|
-
function get_relative_path(from, to) {
|
|
3768
|
-
const from_parts = from.split(/[/\\]/);
|
|
3769
|
-
const to_parts = to.split(/[/\\]/);
|
|
3770
|
-
from_parts.pop();
|
|
3771
|
-
while (from_parts[0] === to_parts[0]) {
|
|
3772
|
-
from_parts.shift();
|
|
3773
|
-
to_parts.shift();
|
|
3774
|
-
}
|
|
3775
|
-
let i = from_parts.length;
|
|
3776
|
-
while (i--) from_parts[i] = "..";
|
|
3777
|
-
return from_parts.concat(to_parts).join("/");
|
|
3778
|
-
}
|
|
3779
|
-
async function load_server_data({ event, state, node, parent }) {
|
|
3878
|
+
async function load_server_data({ event, event_state, state, node, parent }) {
|
|
3780
3879
|
if (!node?.server) return null;
|
|
3781
3880
|
let is_tracking = true;
|
|
3782
3881
|
const uses = {
|
|
@@ -3808,67 +3907,72 @@ async function load_server_data({ event, state, node, parent }) {
|
|
|
3808
3907
|
if (state.prerendering) {
|
|
3809
3908
|
disable_search(url);
|
|
3810
3909
|
}
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
}
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3910
|
+
const result = await record_span({
|
|
3911
|
+
name: "sveltekit.load",
|
|
3912
|
+
attributes: {
|
|
3913
|
+
"sveltekit.load.node_id": node.server_id || "unknown",
|
|
3914
|
+
"sveltekit.load.node_type": get_node_type(node.server_id),
|
|
3915
|
+
"http.route": event.route.id || "unknown"
|
|
3916
|
+
},
|
|
3917
|
+
fn: async (current) => {
|
|
3918
|
+
const traced_event = merge_tracing(event, current);
|
|
3919
|
+
const result2 = await with_request_store(
|
|
3920
|
+
{ event: traced_event, state: event_state },
|
|
3921
|
+
() => load.call(null, {
|
|
3922
|
+
...traced_event,
|
|
3923
|
+
fetch: (info, init2) => {
|
|
3924
|
+
new URL(info instanceof Request ? info.url : info, event.url);
|
|
3925
|
+
return event.fetch(info, init2);
|
|
3926
|
+
},
|
|
3927
|
+
/** @param {string[]} deps */
|
|
3928
|
+
depends: (...deps) => {
|
|
3929
|
+
for (const dep of deps) {
|
|
3930
|
+
const { href } = new URL(dep, event.url);
|
|
3931
|
+
uses.dependencies.add(href);
|
|
3932
|
+
}
|
|
3933
|
+
},
|
|
3934
|
+
params: new Proxy(event.params, {
|
|
3935
|
+
get: (target, key2) => {
|
|
3936
|
+
if (is_tracking) {
|
|
3937
|
+
uses.params.add(key2);
|
|
3938
|
+
}
|
|
3939
|
+
return target[
|
|
3940
|
+
/** @type {string} */
|
|
3941
|
+
key2
|
|
3942
|
+
];
|
|
3943
|
+
}
|
|
3944
|
+
}),
|
|
3945
|
+
parent: async () => {
|
|
3946
|
+
if (is_tracking) {
|
|
3947
|
+
uses.parent = true;
|
|
3948
|
+
}
|
|
3949
|
+
return parent();
|
|
3950
|
+
},
|
|
3951
|
+
route: new Proxy(event.route, {
|
|
3952
|
+
get: (target, key2) => {
|
|
3953
|
+
if (is_tracking) {
|
|
3954
|
+
uses.route = true;
|
|
3955
|
+
}
|
|
3956
|
+
return target[
|
|
3957
|
+
/** @type {'id'} */
|
|
3958
|
+
key2
|
|
3959
|
+
];
|
|
3960
|
+
}
|
|
3961
|
+
}),
|
|
3962
|
+
url,
|
|
3963
|
+
untrack(fn) {
|
|
3964
|
+
is_tracking = false;
|
|
3965
|
+
try {
|
|
3966
|
+
return fn();
|
|
3967
|
+
} finally {
|
|
3968
|
+
is_tracking = true;
|
|
3969
|
+
}
|
|
3853
3970
|
}
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
}),
|
|
3860
|
-
url,
|
|
3861
|
-
untrack(fn) {
|
|
3862
|
-
is_tracking = false;
|
|
3863
|
-
try {
|
|
3864
|
-
return fn();
|
|
3865
|
-
} finally {
|
|
3866
|
-
is_tracking = true;
|
|
3867
|
-
}
|
|
3868
|
-
}
|
|
3869
|
-
})
|
|
3870
|
-
);
|
|
3871
|
-
done = true;
|
|
3971
|
+
})
|
|
3972
|
+
);
|
|
3973
|
+
return result2;
|
|
3974
|
+
}
|
|
3975
|
+
});
|
|
3872
3976
|
return {
|
|
3873
3977
|
type: "data",
|
|
3874
3978
|
data: result ?? null,
|
|
@@ -3878,6 +3982,7 @@ async function load_server_data({ event, state, node, parent }) {
|
|
|
3878
3982
|
}
|
|
3879
3983
|
async function load_data({
|
|
3880
3984
|
event,
|
|
3985
|
+
event_state,
|
|
3881
3986
|
fetched,
|
|
3882
3987
|
node,
|
|
3883
3988
|
parent,
|
|
@@ -3891,21 +3996,33 @@ async function load_data({
|
|
|
3891
3996
|
if (!load) {
|
|
3892
3997
|
return server_data_node?.data ?? null;
|
|
3893
3998
|
}
|
|
3894
|
-
const result = await
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3999
|
+
const result = await record_span({
|
|
4000
|
+
name: "sveltekit.load",
|
|
4001
|
+
attributes: {
|
|
4002
|
+
"sveltekit.load.node_id": node.universal_id || "unknown",
|
|
4003
|
+
"sveltekit.load.node_type": get_node_type(node.universal_id),
|
|
4004
|
+
"http.route": event.route.id || "unknown"
|
|
4005
|
+
},
|
|
4006
|
+
fn: async (current) => {
|
|
4007
|
+
const traced_event = merge_tracing(event, current);
|
|
4008
|
+
return await with_request_store(
|
|
4009
|
+
{ event: traced_event, state: event_state },
|
|
4010
|
+
() => load.call(null, {
|
|
4011
|
+
url: event.url,
|
|
4012
|
+
params: event.params,
|
|
4013
|
+
data: server_data_node?.data ?? null,
|
|
4014
|
+
route: event.route,
|
|
4015
|
+
fetch: create_universal_fetch(event, state, fetched, csr, resolve_opts),
|
|
4016
|
+
setHeaders: event.setHeaders,
|
|
4017
|
+
depends: () => {
|
|
4018
|
+
},
|
|
4019
|
+
parent,
|
|
4020
|
+
untrack: (fn) => fn(),
|
|
4021
|
+
tracing: traced_event.tracing
|
|
4022
|
+
})
|
|
4023
|
+
);
|
|
4024
|
+
}
|
|
4025
|
+
});
|
|
3909
4026
|
return result ?? null;
|
|
3910
4027
|
}
|
|
3911
4028
|
function create_universal_fetch(event, state, fetched, csr, resolve_opts) {
|
|
@@ -3963,11 +4080,12 @@ function create_universal_fetch(event, state, fetched, csr, resolve_opts) {
|
|
|
3963
4080
|
if (key2 === "arrayBuffer") {
|
|
3964
4081
|
return async () => {
|
|
3965
4082
|
const buffer = await response2.arrayBuffer();
|
|
4083
|
+
const bytes = new Uint8Array(buffer);
|
|
3966
4084
|
if (dependency) {
|
|
3967
|
-
dependency.body =
|
|
4085
|
+
dependency.body = bytes;
|
|
3968
4086
|
}
|
|
3969
4087
|
if (buffer instanceof ArrayBuffer) {
|
|
3970
|
-
await push_fetched(
|
|
4088
|
+
await push_fetched(base64_encode(bytes), true);
|
|
3971
4089
|
}
|
|
3972
4090
|
return buffer;
|
|
3973
4091
|
};
|
|
@@ -4021,13 +4139,12 @@ function create_universal_fetch(event, state, fetched, csr, resolve_opts) {
|
|
|
4021
4139
|
async function stream_to_string(stream) {
|
|
4022
4140
|
let result = "";
|
|
4023
4141
|
const reader = stream.getReader();
|
|
4024
|
-
const decoder = new TextDecoder();
|
|
4025
4142
|
while (true) {
|
|
4026
4143
|
const { done, value } = await reader.read();
|
|
4027
4144
|
if (done) {
|
|
4028
4145
|
break;
|
|
4029
4146
|
}
|
|
4030
|
-
result +=
|
|
4147
|
+
result += text_decoder.decode(value);
|
|
4031
4148
|
}
|
|
4032
4149
|
return result;
|
|
4033
4150
|
}
|
|
@@ -4101,7 +4218,6 @@ function serialize_data(fetched, filter, prerendering2 = false) {
|
|
|
4101
4218
|
return `<script ${attrs.join(" ")}>${safe_payload}<\/script>`;
|
|
4102
4219
|
}
|
|
4103
4220
|
const s = JSON.stringify;
|
|
4104
|
-
const encoder$2 = new TextEncoder();
|
|
4105
4221
|
function sha256(data) {
|
|
4106
4222
|
if (!key[0]) precompute();
|
|
4107
4223
|
const out = init.slice(0);
|
|
@@ -4148,7 +4264,7 @@ function sha256(data) {
|
|
|
4148
4264
|
}
|
|
4149
4265
|
const bytes = new Uint8Array(out.buffer);
|
|
4150
4266
|
reverse_endianness(bytes);
|
|
4151
|
-
return
|
|
4267
|
+
return btoa(String.fromCharCode(...bytes));
|
|
4152
4268
|
}
|
|
4153
4269
|
const init = new Uint32Array(8);
|
|
4154
4270
|
const key = new Uint32Array(64);
|
|
@@ -4187,7 +4303,7 @@ function reverse_endianness(bytes) {
|
|
|
4187
4303
|
}
|
|
4188
4304
|
}
|
|
4189
4305
|
function encode(str) {
|
|
4190
|
-
const encoded =
|
|
4306
|
+
const encoded = text_encoder.encode(str);
|
|
4191
4307
|
const length = encoded.length * 8;
|
|
4192
4308
|
const size = 512 * Math.ceil((length + 65) / 512);
|
|
4193
4309
|
const bytes = new Uint8Array(size / 8);
|
|
@@ -4199,34 +4315,10 @@ function encode(str) {
|
|
|
4199
4315
|
words[words.length - 1] = length;
|
|
4200
4316
|
return words;
|
|
4201
4317
|
}
|
|
4202
|
-
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
|
|
4203
|
-
function base64(bytes) {
|
|
4204
|
-
const l = bytes.length;
|
|
4205
|
-
let result = "";
|
|
4206
|
-
let i;
|
|
4207
|
-
for (i = 2; i < l; i += 3) {
|
|
4208
|
-
result += chars[bytes[i - 2] >> 2];
|
|
4209
|
-
result += chars[(bytes[i - 2] & 3) << 4 | bytes[i - 1] >> 4];
|
|
4210
|
-
result += chars[(bytes[i - 1] & 15) << 2 | bytes[i] >> 6];
|
|
4211
|
-
result += chars[bytes[i] & 63];
|
|
4212
|
-
}
|
|
4213
|
-
if (i === l + 1) {
|
|
4214
|
-
result += chars[bytes[i - 2] >> 2];
|
|
4215
|
-
result += chars[(bytes[i - 2] & 3) << 4];
|
|
4216
|
-
result += "==";
|
|
4217
|
-
}
|
|
4218
|
-
if (i === l) {
|
|
4219
|
-
result += chars[bytes[i - 2] >> 2];
|
|
4220
|
-
result += chars[(bytes[i - 2] & 3) << 4 | bytes[i - 1] >> 4];
|
|
4221
|
-
result += chars[(bytes[i - 1] & 15) << 2];
|
|
4222
|
-
result += "=";
|
|
4223
|
-
}
|
|
4224
|
-
return result;
|
|
4225
|
-
}
|
|
4226
4318
|
const array = new Uint8Array(16);
|
|
4227
4319
|
function generate_nonce() {
|
|
4228
4320
|
crypto.getRandomValues(array);
|
|
4229
|
-
return
|
|
4321
|
+
return btoa(String.fromCharCode(...array));
|
|
4230
4322
|
}
|
|
4231
4323
|
const quoted = /* @__PURE__ */ new Set([
|
|
4232
4324
|
"self",
|
|
@@ -4607,7 +4699,6 @@ const updated = {
|
|
|
4607
4699
|
...readable(false),
|
|
4608
4700
|
check: () => false
|
|
4609
4701
|
};
|
|
4610
|
-
const encoder$1 = new TextEncoder();
|
|
4611
4702
|
async function render_response({
|
|
4612
4703
|
branch,
|
|
4613
4704
|
fetched,
|
|
@@ -4618,6 +4709,7 @@ async function render_response({
|
|
|
4618
4709
|
status,
|
|
4619
4710
|
error: error2 = null,
|
|
4620
4711
|
event,
|
|
4712
|
+
event_state,
|
|
4621
4713
|
resolve_opts,
|
|
4622
4714
|
action_result
|
|
4623
4715
|
}) {
|
|
@@ -4700,7 +4792,10 @@ async function render_response({
|
|
|
4700
4792
|
};
|
|
4701
4793
|
{
|
|
4702
4794
|
try {
|
|
4703
|
-
rendered =
|
|
4795
|
+
rendered = with_request_store(
|
|
4796
|
+
{ event, state: event_state },
|
|
4797
|
+
() => options2.root.render(props, render_opts)
|
|
4798
|
+
);
|
|
4704
4799
|
} finally {
|
|
4705
4800
|
reset();
|
|
4706
4801
|
}
|
|
@@ -4767,6 +4862,7 @@ async function render_response({
|
|
|
4767
4862
|
const global = `__sveltekit_${options2.version_hash}`;
|
|
4768
4863
|
const { data, chunks } = get_data(
|
|
4769
4864
|
event,
|
|
4865
|
+
event_state,
|
|
4770
4866
|
options2,
|
|
4771
4867
|
branch.map((b) => b.server_data),
|
|
4772
4868
|
csp,
|
|
@@ -4833,7 +4929,7 @@ async function render_response({
|
|
|
4833
4929
|
try_to_resolve();
|
|
4834
4930
|
}`);
|
|
4835
4931
|
}
|
|
4836
|
-
const { remote_data } =
|
|
4932
|
+
const { remote_data } = event_state;
|
|
4837
4933
|
if (remote_data) {
|
|
4838
4934
|
const remote = {};
|
|
4839
4935
|
for (const key2 in remote_data) {
|
|
@@ -4913,7 +5009,11 @@ ${indent}}`);
|
|
|
4913
5009
|
blocks.push(boot);
|
|
4914
5010
|
}
|
|
4915
5011
|
if (options2.service_worker) {
|
|
4916
|
-
|
|
5012
|
+
let opts = "";
|
|
5013
|
+
if (options2.service_worker_options != null) {
|
|
5014
|
+
const service_worker_options = { ...options2.service_worker_options };
|
|
5015
|
+
opts = `, ${s(service_worker_options)}`;
|
|
5016
|
+
}
|
|
4917
5017
|
blocks.push(`if ('serviceWorker' in navigator) {
|
|
4918
5018
|
addEventListener('load', function () {
|
|
4919
5019
|
navigator.serviceWorker.register('${prefixed("service-worker.js")}'${opts});
|
|
@@ -4983,9 +5083,9 @@ ${indent}}`);
|
|
|
4983
5083
|
}) : new Response(
|
|
4984
5084
|
new ReadableStream({
|
|
4985
5085
|
async start(controller) {
|
|
4986
|
-
controller.enqueue(
|
|
5086
|
+
controller.enqueue(text_encoder.encode(transformed + "\n"));
|
|
4987
5087
|
for await (const chunk of chunks) {
|
|
4988
|
-
controller.enqueue(
|
|
5088
|
+
controller.enqueue(text_encoder.encode(chunk));
|
|
4989
5089
|
}
|
|
4990
5090
|
controller.close();
|
|
4991
5091
|
},
|
|
@@ -4996,7 +5096,7 @@ ${indent}}`);
|
|
|
4996
5096
|
}
|
|
4997
5097
|
);
|
|
4998
5098
|
}
|
|
4999
|
-
function get_data(event, options2, nodes, csp, global) {
|
|
5099
|
+
function get_data(event, event_state, options2, nodes, csp, global) {
|
|
5000
5100
|
let promise_id = 1;
|
|
5001
5101
|
let count = 0;
|
|
5002
5102
|
const { iterator, push, done } = create_async_iterator();
|
|
@@ -5010,7 +5110,7 @@ function get_data(event, options2, nodes, csp, global) {
|
|
|
5010
5110
|
).catch(
|
|
5011
5111
|
/** @param {any} error */
|
|
5012
5112
|
async (error2) => ({
|
|
5013
|
-
error: await handle_error_and_jsonify(event, options2, error2)
|
|
5113
|
+
error: await handle_error_and_jsonify(event, event_state, options2, error2)
|
|
5014
5114
|
})
|
|
5015
5115
|
).then(
|
|
5016
5116
|
/**
|
|
@@ -5024,6 +5124,7 @@ function get_data(event, options2, nodes, csp, global) {
|
|
|
5024
5124
|
} catch {
|
|
5025
5125
|
error2 = await handle_error_and_jsonify(
|
|
5026
5126
|
event,
|
|
5127
|
+
event_state,
|
|
5027
5128
|
options2,
|
|
5028
5129
|
new Error(`Failed to serialize promise while rendering ${event.route.id}`)
|
|
5029
5130
|
);
|
|
@@ -5157,6 +5258,7 @@ class PageNodes {
|
|
|
5157
5258
|
}
|
|
5158
5259
|
async function respond_with_error({
|
|
5159
5260
|
event,
|
|
5261
|
+
event_state,
|
|
5160
5262
|
options: options2,
|
|
5161
5263
|
manifest,
|
|
5162
5264
|
state,
|
|
@@ -5183,6 +5285,7 @@ async function respond_with_error({
|
|
|
5183
5285
|
state.error = true;
|
|
5184
5286
|
const server_data_promise = load_server_data({
|
|
5185
5287
|
event,
|
|
5288
|
+
event_state,
|
|
5186
5289
|
state,
|
|
5187
5290
|
node: default_layout,
|
|
5188
5291
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
@@ -5191,6 +5294,7 @@ async function respond_with_error({
|
|
|
5191
5294
|
const server_data = await server_data_promise;
|
|
5192
5295
|
const data = await load_data({
|
|
5193
5296
|
event,
|
|
5297
|
+
event_state,
|
|
5194
5298
|
fetched,
|
|
5195
5299
|
node: default_layout,
|
|
5196
5300
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
@@ -5223,10 +5327,11 @@ async function respond_with_error({
|
|
|
5223
5327
|
csr
|
|
5224
5328
|
},
|
|
5225
5329
|
status,
|
|
5226
|
-
error: await handle_error_and_jsonify(event, options2, error2),
|
|
5330
|
+
error: await handle_error_and_jsonify(event, event_state, options2, error2),
|
|
5227
5331
|
branch,
|
|
5228
5332
|
fetched,
|
|
5229
5333
|
event,
|
|
5334
|
+
event_state,
|
|
5230
5335
|
resolve_opts
|
|
5231
5336
|
});
|
|
5232
5337
|
} catch (e) {
|
|
@@ -5236,7 +5341,7 @@ async function respond_with_error({
|
|
|
5236
5341
|
return static_error_page(
|
|
5237
5342
|
options2,
|
|
5238
5343
|
get_status(e),
|
|
5239
|
-
(await handle_error_and_jsonify(event, options2, e)).message
|
|
5344
|
+
(await handle_error_and_jsonify(event, event_state, options2, e)).message
|
|
5240
5345
|
);
|
|
5241
5346
|
}
|
|
5242
5347
|
}
|
|
@@ -5249,8 +5354,7 @@ function once(fn) {
|
|
|
5249
5354
|
return result = fn();
|
|
5250
5355
|
};
|
|
5251
5356
|
}
|
|
5252
|
-
|
|
5253
|
-
async function render_data(event, route, options2, manifest, state, invalidated_data_nodes, trailing_slash) {
|
|
5357
|
+
async function render_data(event, event_state, route, options2, manifest, state, invalidated_data_nodes, trailing_slash) {
|
|
5254
5358
|
if (!route.page) {
|
|
5255
5359
|
return new Response(void 0, {
|
|
5256
5360
|
status: 404
|
|
@@ -5277,6 +5381,7 @@ async function render_data(event, route, options2, manifest, state, invalidated_
|
|
|
5277
5381
|
const node = n == void 0 ? n : await manifest._.nodes[n]();
|
|
5278
5382
|
return load_server_data({
|
|
5279
5383
|
event: new_event,
|
|
5384
|
+
event_state,
|
|
5280
5385
|
state,
|
|
5281
5386
|
node,
|
|
5282
5387
|
parent: async () => {
|
|
@@ -5322,23 +5427,23 @@ async function render_data(event, route, options2, manifest, state, invalidated_
|
|
|
5322
5427
|
/** @type {import('types').ServerErrorNode} */
|
|
5323
5428
|
{
|
|
5324
5429
|
type: "error",
|
|
5325
|
-
error: await handle_error_and_jsonify(event, options2, error2),
|
|
5430
|
+
error: await handle_error_and_jsonify(event, event_state, options2, error2),
|
|
5326
5431
|
status: error2 instanceof HttpError || error2 instanceof SvelteKitError ? error2.status : void 0
|
|
5327
5432
|
}
|
|
5328
5433
|
);
|
|
5329
5434
|
})
|
|
5330
5435
|
)
|
|
5331
5436
|
);
|
|
5332
|
-
const { data, chunks } = get_data_json(event, options2, nodes);
|
|
5437
|
+
const { data, chunks } = get_data_json(event, event_state, options2, nodes);
|
|
5333
5438
|
if (!chunks) {
|
|
5334
5439
|
return json_response(data);
|
|
5335
5440
|
}
|
|
5336
5441
|
return new Response(
|
|
5337
5442
|
new ReadableStream({
|
|
5338
5443
|
async start(controller) {
|
|
5339
|
-
controller.enqueue(
|
|
5444
|
+
controller.enqueue(text_encoder.encode(data));
|
|
5340
5445
|
for await (const chunk of chunks) {
|
|
5341
|
-
controller.enqueue(
|
|
5446
|
+
controller.enqueue(text_encoder.encode(chunk));
|
|
5342
5447
|
}
|
|
5343
5448
|
controller.close();
|
|
5344
5449
|
},
|
|
@@ -5358,7 +5463,7 @@ async function render_data(event, route, options2, manifest, state, invalidated_
|
|
|
5358
5463
|
if (error2 instanceof Redirect) {
|
|
5359
5464
|
return redirect_json_response(error2);
|
|
5360
5465
|
} else {
|
|
5361
|
-
return json_response(await handle_error_and_jsonify(event, options2, error2), 500);
|
|
5466
|
+
return json_response(await handle_error_and_jsonify(event, event_state, options2, error2), 500);
|
|
5362
5467
|
}
|
|
5363
5468
|
}
|
|
5364
5469
|
}
|
|
@@ -5380,7 +5485,7 @@ function redirect_json_response(redirect) {
|
|
|
5380
5485
|
}
|
|
5381
5486
|
);
|
|
5382
5487
|
}
|
|
5383
|
-
function get_data_json(event, options2, nodes) {
|
|
5488
|
+
function get_data_json(event, event_state, options2, nodes) {
|
|
5384
5489
|
let promise_id = 1;
|
|
5385
5490
|
let count = 0;
|
|
5386
5491
|
const { iterator, push, done } = create_async_iterator();
|
|
@@ -5400,6 +5505,7 @@ function get_data_json(event, options2, nodes) {
|
|
|
5400
5505
|
key2 = "error";
|
|
5401
5506
|
return handle_error_and_jsonify(
|
|
5402
5507
|
event,
|
|
5508
|
+
event_state,
|
|
5403
5509
|
options2,
|
|
5404
5510
|
/** @type {any} */
|
|
5405
5511
|
e
|
|
@@ -5414,6 +5520,7 @@ function get_data_json(event, options2, nodes) {
|
|
|
5414
5520
|
} catch {
|
|
5415
5521
|
const error2 = await handle_error_and_jsonify(
|
|
5416
5522
|
event,
|
|
5523
|
+
event_state,
|
|
5417
5524
|
options2,
|
|
5418
5525
|
new Error(`Failed to serialize promise while rendering ${event.route.id}`)
|
|
5419
5526
|
);
|
|
@@ -5454,7 +5561,20 @@ function get_data_json(event, options2, nodes) {
|
|
|
5454
5561
|
));
|
|
5455
5562
|
}
|
|
5456
5563
|
}
|
|
5457
|
-
async function handle_remote_call(event, options2, manifest, id) {
|
|
5564
|
+
async function handle_remote_call(event, state, options2, manifest, id) {
|
|
5565
|
+
return record_span({
|
|
5566
|
+
name: "sveltekit.remote.call",
|
|
5567
|
+
attributes: {},
|
|
5568
|
+
fn: (current) => {
|
|
5569
|
+
const traced_event = merge_tracing(event, current);
|
|
5570
|
+
return with_request_store(
|
|
5571
|
+
{ event: traced_event, state },
|
|
5572
|
+
() => handle_remote_call_internal(traced_event, state, options2, manifest, id)
|
|
5573
|
+
);
|
|
5574
|
+
}
|
|
5575
|
+
});
|
|
5576
|
+
}
|
|
5577
|
+
async function handle_remote_call_internal(event, state, options2, manifest, id) {
|
|
5458
5578
|
const [hash2, name, prerender_args] = id.split("/");
|
|
5459
5579
|
const remotes = manifest._.remotes;
|
|
5460
5580
|
if (!remotes[hash2]) error(404);
|
|
@@ -5463,6 +5583,10 @@ async function handle_remote_call(event, options2, manifest, id) {
|
|
|
5463
5583
|
if (!fn) error(404);
|
|
5464
5584
|
const info = fn.__;
|
|
5465
5585
|
const transport = options2.hooks.transport;
|
|
5586
|
+
event.tracing.current.setAttributes({
|
|
5587
|
+
"sveltekit.remote.call.type": info.type,
|
|
5588
|
+
"sveltekit.remote.call.name": info.name
|
|
5589
|
+
});
|
|
5466
5590
|
let form_client_refreshes;
|
|
5467
5591
|
try {
|
|
5468
5592
|
if (info.type === "form") {
|
|
@@ -5482,21 +5606,15 @@ async function handle_remote_call(event, options2, manifest, id) {
|
|
|
5482
5606
|
);
|
|
5483
5607
|
form_data.delete("sveltekit:remote_refreshes");
|
|
5484
5608
|
const fn2 = info.fn;
|
|
5485
|
-
const data2 = await
|
|
5609
|
+
const data2 = await with_request_store({ event, state }, () => fn2(form_data));
|
|
5486
5610
|
return json(
|
|
5487
5611
|
/** @type {RemoteFunctionResponse} */
|
|
5488
5612
|
{
|
|
5489
5613
|
type: "result",
|
|
5490
5614
|
result: stringify(data2, transport),
|
|
5491
|
-
refreshes:
|
|
5492
|
-
{
|
|
5493
|
-
|
|
5494
|
-
...await apply_client_refreshes(
|
|
5495
|
-
/** @type {string[]} */
|
|
5496
|
-
form_client_refreshes
|
|
5497
|
-
)
|
|
5498
|
-
},
|
|
5499
|
-
transport
|
|
5615
|
+
refreshes: await serialize_refreshes(
|
|
5616
|
+
/** @type {string[]} */
|
|
5617
|
+
form_client_refreshes
|
|
5500
5618
|
)
|
|
5501
5619
|
}
|
|
5502
5620
|
);
|
|
@@ -5504,14 +5622,13 @@ async function handle_remote_call(event, options2, manifest, id) {
|
|
|
5504
5622
|
if (info.type === "command") {
|
|
5505
5623
|
const { payload: payload2, refreshes } = await event.request.json();
|
|
5506
5624
|
const arg = parse_remote_arg(payload2, transport);
|
|
5507
|
-
const data2 = await
|
|
5508
|
-
const refreshed = await apply_client_refreshes(refreshes);
|
|
5625
|
+
const data2 = await with_request_store({ event, state }, () => fn(arg));
|
|
5509
5626
|
return json(
|
|
5510
5627
|
/** @type {RemoteFunctionResponse} */
|
|
5511
5628
|
{
|
|
5512
5629
|
type: "result",
|
|
5513
5630
|
result: stringify(data2, transport),
|
|
5514
|
-
refreshes:
|
|
5631
|
+
refreshes: await serialize_refreshes(refreshes)
|
|
5515
5632
|
}
|
|
5516
5633
|
);
|
|
5517
5634
|
}
|
|
@@ -5520,7 +5637,10 @@ async function handle_remote_call(event, options2, manifest, id) {
|
|
|
5520
5637
|
// new URL(...) necessary because we're hiding the URL from the user in the event object
|
|
5521
5638
|
new URL(event.request.url).searchParams.get("payload")
|
|
5522
5639
|
);
|
|
5523
|
-
const data = await
|
|
5640
|
+
const data = await with_request_store(
|
|
5641
|
+
{ event, state },
|
|
5642
|
+
() => fn(parse_remote_arg(payload, transport))
|
|
5643
|
+
);
|
|
5524
5644
|
return json(
|
|
5525
5645
|
/** @type {RemoteFunctionResponse} */
|
|
5526
5646
|
{
|
|
@@ -5530,22 +5650,17 @@ async function handle_remote_call(event, options2, manifest, id) {
|
|
|
5530
5650
|
);
|
|
5531
5651
|
} catch (error2) {
|
|
5532
5652
|
if (error2 instanceof Redirect) {
|
|
5533
|
-
const refreshes = {
|
|
5534
|
-
...get_event_state(event).refreshes ?? {},
|
|
5535
|
-
// could be set by form actions
|
|
5536
|
-
...await apply_client_refreshes(form_client_refreshes ?? [])
|
|
5537
|
-
};
|
|
5538
5653
|
return json({
|
|
5539
5654
|
type: "redirect",
|
|
5540
5655
|
location: error2.location,
|
|
5541
|
-
refreshes:
|
|
5656
|
+
refreshes: await serialize_refreshes(form_client_refreshes ?? [])
|
|
5542
5657
|
});
|
|
5543
5658
|
}
|
|
5544
5659
|
return json(
|
|
5545
5660
|
/** @type {RemoteFunctionResponse} */
|
|
5546
5661
|
{
|
|
5547
5662
|
type: "error",
|
|
5548
|
-
error: await handle_error_and_jsonify(event, options2, error2),
|
|
5663
|
+
error: await handle_error_and_jsonify(event, state, options2, error2),
|
|
5549
5664
|
status: error2 instanceof HttpError || error2 instanceof SvelteKitError ? error2.status : 500
|
|
5550
5665
|
},
|
|
5551
5666
|
{
|
|
@@ -5555,23 +5670,46 @@ async function handle_remote_call(event, options2, manifest, id) {
|
|
|
5555
5670
|
}
|
|
5556
5671
|
);
|
|
5557
5672
|
}
|
|
5558
|
-
async function
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5673
|
+
async function serialize_refreshes(client_refreshes) {
|
|
5674
|
+
const refreshes = {
|
|
5675
|
+
...state.refreshes,
|
|
5676
|
+
...Object.fromEntries(
|
|
5677
|
+
await Promise.all(
|
|
5678
|
+
client_refreshes.map(async (key2) => {
|
|
5679
|
+
const [hash3, name2, payload] = key2.split("/");
|
|
5680
|
+
const loader = manifest._.remotes[hash3];
|
|
5681
|
+
if (!loader) error(400, "Bad Request");
|
|
5682
|
+
const module2 = await loader();
|
|
5683
|
+
const fn2 = module2[name2];
|
|
5684
|
+
if (!fn2) error(400, "Bad Request");
|
|
5685
|
+
return [
|
|
5686
|
+
key2,
|
|
5687
|
+
await with_request_store(
|
|
5688
|
+
{ event, state },
|
|
5689
|
+
() => fn2(parse_remote_arg(payload, transport))
|
|
5690
|
+
)
|
|
5691
|
+
];
|
|
5692
|
+
})
|
|
5693
|
+
)
|
|
5570
5694
|
)
|
|
5571
|
-
|
|
5572
|
-
|
|
5695
|
+
};
|
|
5696
|
+
return Object.keys(refreshes).length > 0 ? stringify(refreshes, transport) : void 0;
|
|
5697
|
+
}
|
|
5698
|
+
}
|
|
5699
|
+
async function handle_remote_form_post(event, state, manifest, id) {
|
|
5700
|
+
return record_span({
|
|
5701
|
+
name: "sveltekit.remote.form.post",
|
|
5702
|
+
attributes: {},
|
|
5703
|
+
fn: (current) => {
|
|
5704
|
+
const traced_event = merge_tracing(event, current);
|
|
5705
|
+
return with_request_store(
|
|
5706
|
+
{ event: traced_event, state },
|
|
5707
|
+
() => handle_remote_form_post_internal(traced_event, state, manifest, id)
|
|
5708
|
+
);
|
|
5709
|
+
}
|
|
5710
|
+
});
|
|
5573
5711
|
}
|
|
5574
|
-
async function
|
|
5712
|
+
async function handle_remote_form_post_internal(event, state, manifest, id) {
|
|
5575
5713
|
const [hash2, name, action_id] = id.split("/");
|
|
5576
5714
|
const remotes = manifest._.remotes;
|
|
5577
5715
|
const module = await remotes[hash2]?.();
|
|
@@ -5595,7 +5733,7 @@ async function handle_remote_form_post(event, manifest, id) {
|
|
|
5595
5733
|
};
|
|
5596
5734
|
}
|
|
5597
5735
|
if (action_id) {
|
|
5598
|
-
form =
|
|
5736
|
+
form = with_request_store({ event, state }, () => form.for(JSON.parse(action_id)));
|
|
5599
5737
|
}
|
|
5600
5738
|
try {
|
|
5601
5739
|
const form_data = await event.request.formData();
|
|
@@ -5604,7 +5742,7 @@ async function handle_remote_form_post(event, manifest, id) {
|
|
|
5604
5742
|
/** @type {any} */
|
|
5605
5743
|
form.__.fn
|
|
5606
5744
|
);
|
|
5607
|
-
await
|
|
5745
|
+
await with_request_store({ event, state }, () => fn(form_data));
|
|
5608
5746
|
return {
|
|
5609
5747
|
type: "success",
|
|
5610
5748
|
status: 200
|
|
@@ -5631,7 +5769,7 @@ function get_remote_action(url) {
|
|
|
5631
5769
|
return url.searchParams.get("/remote");
|
|
5632
5770
|
}
|
|
5633
5771
|
const MAX_DEPTH = 10;
|
|
5634
|
-
async function render_page(event, page, options2, manifest, state, nodes, resolve_opts) {
|
|
5772
|
+
async function render_page(event, event_state, page, options2, manifest, state, nodes, resolve_opts) {
|
|
5635
5773
|
if (state.depth > MAX_DEPTH) {
|
|
5636
5774
|
return text(`Not found: ${event.url.pathname}`, {
|
|
5637
5775
|
status: 404
|
|
@@ -5640,7 +5778,7 @@ async function render_page(event, page, options2, manifest, state, nodes, resolv
|
|
|
5640
5778
|
}
|
|
5641
5779
|
if (is_action_json_request(event)) {
|
|
5642
5780
|
const node = await manifest._.nodes[page.leaf]();
|
|
5643
|
-
return handle_action_json_request(event, options2, node?.server);
|
|
5781
|
+
return handle_action_json_request(event, event_state, options2, node?.server);
|
|
5644
5782
|
}
|
|
5645
5783
|
try {
|
|
5646
5784
|
const leaf_node = (
|
|
@@ -5652,9 +5790,9 @@ async function render_page(event, page, options2, manifest, state, nodes, resolv
|
|
|
5652
5790
|
if (is_action_request(event)) {
|
|
5653
5791
|
const remote_id = get_remote_action(event.url);
|
|
5654
5792
|
if (remote_id) {
|
|
5655
|
-
action_result = await handle_remote_form_post(event, manifest, remote_id);
|
|
5793
|
+
action_result = await handle_remote_form_post(event, event_state, manifest, remote_id);
|
|
5656
5794
|
} else {
|
|
5657
|
-
action_result = await handle_action_request(event, leaf_node.server);
|
|
5795
|
+
action_result = await handle_action_request(event, event_state, leaf_node.server);
|
|
5658
5796
|
}
|
|
5659
5797
|
if (action_result?.type === "redirect") {
|
|
5660
5798
|
return redirect_response(action_result.status, action_result.location);
|
|
@@ -5695,6 +5833,7 @@ async function render_page(event, page, options2, manifest, state, nodes, resolv
|
|
|
5695
5833
|
status,
|
|
5696
5834
|
error: null,
|
|
5697
5835
|
event,
|
|
5836
|
+
event_state,
|
|
5698
5837
|
options: options2,
|
|
5699
5838
|
manifest,
|
|
5700
5839
|
state,
|
|
@@ -5714,6 +5853,7 @@ async function render_page(event, page, options2, manifest, state, nodes, resolv
|
|
|
5714
5853
|
}
|
|
5715
5854
|
return await load_server_data({
|
|
5716
5855
|
event,
|
|
5856
|
+
event_state,
|
|
5717
5857
|
state,
|
|
5718
5858
|
node,
|
|
5719
5859
|
parent: async () => {
|
|
@@ -5738,6 +5878,7 @@ async function render_page(event, page, options2, manifest, state, nodes, resolv
|
|
|
5738
5878
|
try {
|
|
5739
5879
|
return await load_data({
|
|
5740
5880
|
event,
|
|
5881
|
+
event_state,
|
|
5741
5882
|
fetched,
|
|
5742
5883
|
node,
|
|
5743
5884
|
parent: async () => {
|
|
@@ -5786,7 +5927,7 @@ async function render_page(event, page, options2, manifest, state, nodes, resolv
|
|
|
5786
5927
|
return redirect_response(err.status, err.location);
|
|
5787
5928
|
}
|
|
5788
5929
|
const status2 = get_status(err);
|
|
5789
|
-
const error2 = await handle_error_and_jsonify(event, options2, err);
|
|
5930
|
+
const error2 = await handle_error_and_jsonify(event, event_state, options2, err);
|
|
5790
5931
|
while (i--) {
|
|
5791
5932
|
if (page.errors[i]) {
|
|
5792
5933
|
const index = (
|
|
@@ -5800,6 +5941,7 @@ async function render_page(event, page, options2, manifest, state, nodes, resolv
|
|
|
5800
5941
|
const nodes2 = new PageNodes(layouts.map((layout) => layout.node));
|
|
5801
5942
|
return await render_response({
|
|
5802
5943
|
event,
|
|
5944
|
+
event_state,
|
|
5803
5945
|
options: options2,
|
|
5804
5946
|
manifest,
|
|
5805
5947
|
state,
|
|
@@ -5828,6 +5970,7 @@ async function render_page(event, page, options2, manifest, state, nodes, resolv
|
|
|
5828
5970
|
if (state.prerendering && should_prerender_data) {
|
|
5829
5971
|
let { data, chunks } = get_data_json(
|
|
5830
5972
|
event,
|
|
5973
|
+
event_state,
|
|
5831
5974
|
options2,
|
|
5832
5975
|
branch.map((node) => node?.server_data)
|
|
5833
5976
|
);
|
|
@@ -5843,6 +5986,7 @@ async function render_page(event, page, options2, manifest, state, nodes, resolv
|
|
|
5843
5986
|
}
|
|
5844
5987
|
return await render_response({
|
|
5845
5988
|
event,
|
|
5989
|
+
event_state,
|
|
5846
5990
|
options: options2,
|
|
5847
5991
|
manifest,
|
|
5848
5992
|
state,
|
|
@@ -5860,6 +6004,7 @@ async function render_page(event, page, options2, manifest, state, nodes, resolv
|
|
|
5860
6004
|
} catch (e) {
|
|
5861
6005
|
return await respond_with_error({
|
|
5862
6006
|
event,
|
|
6007
|
+
event_state,
|
|
5863
6008
|
options: options2,
|
|
5864
6009
|
manifest,
|
|
5865
6010
|
state,
|
|
@@ -5966,8 +6111,8 @@ function get_cookies(request, url) {
|
|
|
5966
6111
|
const cookie = new_cookies[key2];
|
|
5967
6112
|
if (!domain_matches(destination.hostname, cookie.options.domain)) continue;
|
|
5968
6113
|
if (!path_matches(destination.pathname, cookie.options.path)) continue;
|
|
5969
|
-
const
|
|
5970
|
-
combined_cookies[cookie.name] =
|
|
6114
|
+
const encoder = cookie.options.encode || encodeURIComponent;
|
|
6115
|
+
combined_cookies[cookie.name] = encoder(cookie.value);
|
|
5971
6116
|
}
|
|
5972
6117
|
if (header2) {
|
|
5973
6118
|
const parsed = parse$1(header2, { decode: (value) => value });
|
|
@@ -6176,7 +6321,8 @@ const default_filter = () => false;
|
|
|
6176
6321
|
const default_preload = ({ type }) => type === "js" || type === "css";
|
|
6177
6322
|
const page_methods = /* @__PURE__ */ new Set(["GET", "HEAD", "POST"]);
|
|
6178
6323
|
const allowed_page_methods = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
|
|
6179
|
-
|
|
6324
|
+
const respond = propagate_context(internal_respond);
|
|
6325
|
+
async function internal_respond(request, options2, manifest, state) {
|
|
6180
6326
|
const url = new URL(request.url);
|
|
6181
6327
|
const is_route_resolution_request = has_resolution_suffix(url.pathname);
|
|
6182
6328
|
const is_data_request = has_data_suffix(url.pathname);
|
|
@@ -6220,8 +6366,15 @@ async function respond(request, options2, manifest, state) {
|
|
|
6220
6366
|
request,
|
|
6221
6367
|
url
|
|
6222
6368
|
);
|
|
6369
|
+
const event_state = {
|
|
6370
|
+
prerendering: state.prerendering,
|
|
6371
|
+
transport: options2.hooks.transport,
|
|
6372
|
+
handleValidationError: options2.hooks.handleValidationError,
|
|
6373
|
+
tracing: {
|
|
6374
|
+
record_span
|
|
6375
|
+
}
|
|
6376
|
+
};
|
|
6223
6377
|
const event = {
|
|
6224
|
-
[EVENT_STATE]: create_event_state(state, options2),
|
|
6225
6378
|
cookies,
|
|
6226
6379
|
// @ts-expect-error `fetch` needs to be created after the `event` itself
|
|
6227
6380
|
fetch: null,
|
|
@@ -6396,34 +6549,66 @@ async function respond(request, options2, manifest, state) {
|
|
|
6396
6549
|
if (state.prerendering && !state.prerendering.fallback && !state.prerendering.inside_reroute) {
|
|
6397
6550
|
disable_search(url);
|
|
6398
6551
|
}
|
|
6399
|
-
const response = await
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
event,
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6552
|
+
const response = await record_span({
|
|
6553
|
+
name: "sveltekit.handle.root",
|
|
6554
|
+
attributes: {
|
|
6555
|
+
"http.route": event.route.id || "unknown",
|
|
6556
|
+
"http.method": event.request.method,
|
|
6557
|
+
"http.url": event.url.href,
|
|
6558
|
+
"sveltekit.is_data_request": is_data_request,
|
|
6559
|
+
"sveltekit.is_sub_request": event.isSubRequest
|
|
6560
|
+
},
|
|
6561
|
+
fn: async (root_span) => {
|
|
6562
|
+
const traced_event = {
|
|
6563
|
+
...event,
|
|
6564
|
+
tracing: {
|
|
6565
|
+
enabled: false,
|
|
6566
|
+
root: root_span,
|
|
6567
|
+
current: root_span
|
|
6568
|
+
}
|
|
6569
|
+
};
|
|
6570
|
+
return await with_request_store(
|
|
6571
|
+
{ event: traced_event, state: event_state },
|
|
6572
|
+
() => options2.hooks.handle({
|
|
6573
|
+
event: traced_event,
|
|
6574
|
+
resolve: (event2, opts) => {
|
|
6575
|
+
return record_span({
|
|
6576
|
+
name: "sveltekit.resolve",
|
|
6577
|
+
attributes: {
|
|
6578
|
+
"http.route": event2.route.id || "unknown"
|
|
6579
|
+
},
|
|
6580
|
+
fn: (resolve_span) => {
|
|
6581
|
+
return with_request_store(
|
|
6582
|
+
null,
|
|
6583
|
+
() => resolve2(merge_tracing(event2, resolve_span), page_nodes, opts).then(
|
|
6584
|
+
(response2) => {
|
|
6585
|
+
for (const key2 in headers2) {
|
|
6586
|
+
const value = headers2[key2];
|
|
6587
|
+
response2.headers.set(
|
|
6588
|
+
key2,
|
|
6589
|
+
/** @type {string} */
|
|
6590
|
+
value
|
|
6591
|
+
);
|
|
6592
|
+
}
|
|
6593
|
+
add_cookies_to_headers(response2.headers, Object.values(new_cookies));
|
|
6594
|
+
if (state.prerendering && event2.route.id !== null) {
|
|
6595
|
+
response2.headers.set("x-sveltekit-routeid", encodeURI(event2.route.id));
|
|
6596
|
+
}
|
|
6597
|
+
resolve_span.setAttributes({
|
|
6598
|
+
"http.response.status_code": response2.status,
|
|
6599
|
+
"http.response.body.size": response2.headers.get("content-length") || "unknown"
|
|
6600
|
+
});
|
|
6601
|
+
return response2;
|
|
6602
|
+
}
|
|
6603
|
+
)
|
|
6604
|
+
);
|
|
6605
|
+
}
|
|
6606
|
+
});
|
|
6607
|
+
}
|
|
6608
|
+
})
|
|
6609
|
+
);
|
|
6610
|
+
}
|
|
6611
|
+
});
|
|
6427
6612
|
if (response.status === 200 && response.headers.has("etag")) {
|
|
6428
6613
|
let if_none_match_value = request.headers.get("if-none-match");
|
|
6429
6614
|
if (if_none_match_value?.startsWith('W/"')) {
|
|
@@ -6469,7 +6654,7 @@ async function respond(request, options2, manifest, state) {
|
|
|
6469
6654
|
add_cookies_to_headers(response.headers, Object.values(new_cookies));
|
|
6470
6655
|
return response;
|
|
6471
6656
|
}
|
|
6472
|
-
return await handle_fatal_error(event, options2, e);
|
|
6657
|
+
return await handle_fatal_error(event, event_state, options2, e);
|
|
6473
6658
|
}
|
|
6474
6659
|
async function resolve2(event2, page_nodes, opts) {
|
|
6475
6660
|
try {
|
|
@@ -6483,6 +6668,7 @@ async function respond(request, options2, manifest, state) {
|
|
|
6483
6668
|
if (options2.hash_routing || state.prerendering?.fallback) {
|
|
6484
6669
|
return await render_response({
|
|
6485
6670
|
event: event2,
|
|
6671
|
+
event_state,
|
|
6486
6672
|
options: options2,
|
|
6487
6673
|
manifest,
|
|
6488
6674
|
state,
|
|
@@ -6495,7 +6681,7 @@ async function respond(request, options2, manifest, state) {
|
|
|
6495
6681
|
});
|
|
6496
6682
|
}
|
|
6497
6683
|
if (remote_id) {
|
|
6498
|
-
return await handle_remote_call(event2, options2, manifest, remote_id);
|
|
6684
|
+
return await handle_remote_call(event2, event_state, options2, manifest, remote_id);
|
|
6499
6685
|
}
|
|
6500
6686
|
if (route) {
|
|
6501
6687
|
const method = (
|
|
@@ -6506,6 +6692,7 @@ async function respond(request, options2, manifest, state) {
|
|
|
6506
6692
|
if (is_data_request) {
|
|
6507
6693
|
response = await render_data(
|
|
6508
6694
|
event2,
|
|
6695
|
+
event_state,
|
|
6509
6696
|
route,
|
|
6510
6697
|
options2,
|
|
6511
6698
|
manifest,
|
|
@@ -6514,13 +6701,14 @@ async function respond(request, options2, manifest, state) {
|
|
|
6514
6701
|
trailing_slash
|
|
6515
6702
|
);
|
|
6516
6703
|
} else if (route.endpoint && (!route.page || is_endpoint_request(event2))) {
|
|
6517
|
-
response = await render_endpoint(event2, await route.endpoint(), state);
|
|
6704
|
+
response = await render_endpoint(event2, event_state, await route.endpoint(), state);
|
|
6518
6705
|
} else if (route.page) {
|
|
6519
6706
|
if (!page_nodes) {
|
|
6520
6707
|
throw new Error("page_nodes not found. This should never happen");
|
|
6521
6708
|
} else if (page_methods.has(method)) {
|
|
6522
6709
|
response = await render_page(
|
|
6523
6710
|
event2,
|
|
6711
|
+
event_state,
|
|
6524
6712
|
route.page,
|
|
6525
6713
|
options2,
|
|
6526
6714
|
manifest,
|
|
@@ -6583,6 +6771,7 @@ async function respond(request, options2, manifest, state) {
|
|
|
6583
6771
|
if (DEV && event2.url.pathname === "/.well-known/appspecific/com.chrome.devtools.json") ;
|
|
6584
6772
|
return await respond_with_error({
|
|
6585
6773
|
event: event2,
|
|
6774
|
+
event_state,
|
|
6586
6775
|
options: options2,
|
|
6587
6776
|
manifest,
|
|
6588
6777
|
state,
|
|
@@ -6596,7 +6785,7 @@ async function respond(request, options2, manifest, state) {
|
|
|
6596
6785
|
}
|
|
6597
6786
|
return await fetch(request);
|
|
6598
6787
|
} catch (e) {
|
|
6599
|
-
return await handle_fatal_error(event2, options2, e);
|
|
6788
|
+
return await handle_fatal_error(event2, event_state, options2, e);
|
|
6600
6789
|
} finally {
|
|
6601
6790
|
event2.cookies.set = () => {
|
|
6602
6791
|
throw new Error("Cannot use `cookies.set(...)` after the response has been generated");
|
|
@@ -6614,6 +6803,13 @@ function load_page_nodes(page, manifest) {
|
|
|
6614
6803
|
manifest._.nodes[page.leaf]()
|
|
6615
6804
|
]);
|
|
6616
6805
|
}
|
|
6806
|
+
function propagate_context(fn) {
|
|
6807
|
+
return async (req, ...rest) => {
|
|
6808
|
+
{
|
|
6809
|
+
return fn(req, ...rest);
|
|
6810
|
+
}
|
|
6811
|
+
};
|
|
6812
|
+
}
|
|
6617
6813
|
function filter_private_env(env, { public_prefix, private_prefix }) {
|
|
6618
6814
|
return Object.fromEntries(
|
|
6619
6815
|
Object.entries(env).filter(
|