@axium/server 0.22.11 → 0.22.13
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/CiUsfGrc.js +43 -0
- package/build/client/_app/immutable/chunks/CiUsfGrc.js.br +0 -0
- package/build/client/_app/immutable/chunks/CiUsfGrc.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/Dext3JFj.js +3 -0
- package/build/client/_app/immutable/chunks/Dext3JFj.js.br +0 -0
- package/build/client/_app/immutable/chunks/Dext3JFj.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/{DN_VTkOW.js → XdRahthI.js} +1 -1
- package/build/client/_app/immutable/chunks/XdRahthI.js.br +0 -0
- package/build/client/_app/immutable/chunks/XdRahthI.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/entry/app.C5LuJT06.js +2 -0
- package/build/client/_app/immutable/entry/app.C5LuJT06.js.br +0 -0
- package/build/client/_app/immutable/entry/app.C5LuJT06.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.BQJupvGE.js +1 -0
- package/build/client/_app/immutable/entry/start.BQJupvGE.js.br +2 -0
- package/build/client/_app/immutable/entry/start.BQJupvGE.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.BAsobPu4.js} +1 -1
- package/build/client/_app/immutable/nodes/1.BAsobPu4.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.BAsobPu4.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.C18mc0nK.js +7 -0
- package/build/client/_app/immutable/nodes/3.C18mc0nK.js.br +0 -0
- package/build/client/_app/immutable/nodes/3.C18mc0nK.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{4.C0wscA_4.js → 4.eINJOagY.js} +1 -1
- package/build/client/_app/immutable/nodes/4.eINJOagY.js.br +0 -0
- package/build/client/_app/immutable/nodes/4.eINJOagY.js.gz +0 -0
- package/build/client/_app/immutable/nodes/5.DITFCLgK.js +1 -0
- package/build/client/_app/immutable/nodes/5.DITFCLgK.js.br +0 -0
- package/build/client/_app/immutable/nodes/5.DITFCLgK.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{6.TEubHotu.js → 6.BbgUOuKV.js} +1 -1
- package/build/client/_app/immutable/nodes/6.BbgUOuKV.js.br +0 -0
- package/build/client/_app/immutable/nodes/6.BbgUOuKV.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-5bszWZCQ.js +9 -0
- package/build/server/chunks/{1-D4403Evz.js.map → 1-5bszWZCQ.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-CGyRgNsB.js +13 -0
- package/build/server/chunks/{3-CCrTqwF9.js.map → 3-CGyRgNsB.js.map} +1 -1
- package/build/server/chunks/4-BuMxaapL.js +9 -0
- package/build/server/chunks/{4-vjHkix88.js.map → 4-BuMxaapL.js.map} +1 -1
- package/build/server/chunks/5-BhHQT7ic.js +9 -0
- package/build/server/chunks/{5-Dc6xvhmU.js.map → 5-BhHQT7ic.js.map} +1 -1
- package/build/server/chunks/6-Do2XsDIk.js +9 -0
- package/build/server/chunks/{6-CvdeNFQU.js.map → 6-Do2XsDIk.js.map} +1 -1
- package/build/server/chunks/{FormDialog-CUzCwBFr.js → FormDialog-BemX_bll.js} +5 -5
- package/build/server/chunks/{FormDialog-CUzCwBFr.js.map → FormDialog-BemX_bll.js.map} +1 -1
- package/build/server/chunks/{Logout-48MBrG2s.js → Logout-BhQS74v2.js} +3 -3
- package/build/server/chunks/{Logout-48MBrG2s.js.map → Logout-BhQS74v2.js.map} +1 -1
- package/build/server/chunks/_page.svelte-BdL0IPY2.js +11 -0
- package/build/server/chunks/{_page.svelte-BHwIILw0.js.map → _page.svelte-BdL0IPY2.js.map} +1 -1
- package/build/server/chunks/{_page.svelte-Yesd_T6C.js → _page.svelte-Cw9An0SZ.js} +4 -4
- package/build/server/chunks/{_page.svelte-Yesd_T6C.js.map → _page.svelte-Cw9An0SZ.js.map} +1 -1
- package/build/server/chunks/{_page.svelte-CNug2JTC.js → _page.svelte-D6BUZio7.js} +5 -5
- package/build/server/chunks/{_page.svelte-CNug2JTC.js.map → _page.svelte-D6BUZio7.js.map} +1 -1
- package/build/server/chunks/{_page.svelte-DSnarRUI.js → _page.svelte-Q_wBpED1.js} +4 -4
- package/build/server/chunks/{_page.svelte-DSnarRUI.js.map → _page.svelte-Q_wBpED1.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-B7iBt6uC.js} +6 -6
- package/build/server/chunks/hooks.server-B7iBt6uC.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/{index-iqDDeMM6.js → index-wXTeP1jh.js} +275 -257
- package/build/server/chunks/index-wXTeP1jh.js.map +1 -0
- 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 +600 -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 +6 -4
- package/dist/config.d.ts +8 -8
- package/dist/plugins.js +1 -1
- package/dist/requests.js +2 -2
- 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/hooks.server-BJTU7JI4.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
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1511
|
+
flush_effects();
|
|
1512
|
+
}
|
|
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();
|
|
1542
1532
|
}
|
|
1543
|
-
|
|
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: "14jmemo"
|
|
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-B7iBt6uC.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) {
|
|
@@ -3938,6 +4055,7 @@ function create_universal_fetch(event, state, fetched, csr, resolve_opts) {
|
|
|
3938
4055
|
}
|
|
3939
4056
|
}
|
|
3940
4057
|
}
|
|
4058
|
+
let teed_body;
|
|
3941
4059
|
const proxy = new Proxy(response, {
|
|
3942
4060
|
get(response2, key2, _receiver) {
|
|
3943
4061
|
async function push_fetched(body2, is_b64) {
|
|
@@ -3960,14 +4078,38 @@ function create_universal_fetch(event, state, fetched, csr, resolve_opts) {
|
|
|
3960
4078
|
is_b64
|
|
3961
4079
|
});
|
|
3962
4080
|
}
|
|
4081
|
+
if (key2 === "body") {
|
|
4082
|
+
if (response2.body === null) {
|
|
4083
|
+
return null;
|
|
4084
|
+
}
|
|
4085
|
+
if (teed_body) {
|
|
4086
|
+
return teed_body;
|
|
4087
|
+
}
|
|
4088
|
+
const [a, b] = response2.body.tee();
|
|
4089
|
+
void (async () => {
|
|
4090
|
+
let result = new Uint8Array();
|
|
4091
|
+
for await (const chunk of a) {
|
|
4092
|
+
const combined = new Uint8Array(result.length + chunk.length);
|
|
4093
|
+
combined.set(result, 0);
|
|
4094
|
+
combined.set(chunk, result.length);
|
|
4095
|
+
result = combined;
|
|
4096
|
+
}
|
|
4097
|
+
if (dependency) {
|
|
4098
|
+
dependency.body = new Uint8Array(result);
|
|
4099
|
+
}
|
|
4100
|
+
void push_fetched(base64_encode(result), true);
|
|
4101
|
+
})();
|
|
4102
|
+
return teed_body = b;
|
|
4103
|
+
}
|
|
3963
4104
|
if (key2 === "arrayBuffer") {
|
|
3964
4105
|
return async () => {
|
|
3965
4106
|
const buffer = await response2.arrayBuffer();
|
|
4107
|
+
const bytes = new Uint8Array(buffer);
|
|
3966
4108
|
if (dependency) {
|
|
3967
|
-
dependency.body =
|
|
4109
|
+
dependency.body = bytes;
|
|
3968
4110
|
}
|
|
3969
4111
|
if (buffer instanceof ArrayBuffer) {
|
|
3970
|
-
await push_fetched(
|
|
4112
|
+
await push_fetched(base64_encode(bytes), true);
|
|
3971
4113
|
}
|
|
3972
4114
|
return buffer;
|
|
3973
4115
|
};
|
|
@@ -4021,13 +4163,12 @@ function create_universal_fetch(event, state, fetched, csr, resolve_opts) {
|
|
|
4021
4163
|
async function stream_to_string(stream) {
|
|
4022
4164
|
let result = "";
|
|
4023
4165
|
const reader = stream.getReader();
|
|
4024
|
-
const decoder = new TextDecoder();
|
|
4025
4166
|
while (true) {
|
|
4026
4167
|
const { done, value } = await reader.read();
|
|
4027
4168
|
if (done) {
|
|
4028
4169
|
break;
|
|
4029
4170
|
}
|
|
4030
|
-
result +=
|
|
4171
|
+
result += text_decoder.decode(value);
|
|
4031
4172
|
}
|
|
4032
4173
|
return result;
|
|
4033
4174
|
}
|
|
@@ -4101,7 +4242,6 @@ function serialize_data(fetched, filter, prerendering2 = false) {
|
|
|
4101
4242
|
return `<script ${attrs.join(" ")}>${safe_payload}<\/script>`;
|
|
4102
4243
|
}
|
|
4103
4244
|
const s = JSON.stringify;
|
|
4104
|
-
const encoder$2 = new TextEncoder();
|
|
4105
4245
|
function sha256(data) {
|
|
4106
4246
|
if (!key[0]) precompute();
|
|
4107
4247
|
const out = init.slice(0);
|
|
@@ -4148,7 +4288,7 @@ function sha256(data) {
|
|
|
4148
4288
|
}
|
|
4149
4289
|
const bytes = new Uint8Array(out.buffer);
|
|
4150
4290
|
reverse_endianness(bytes);
|
|
4151
|
-
return
|
|
4291
|
+
return btoa(String.fromCharCode(...bytes));
|
|
4152
4292
|
}
|
|
4153
4293
|
const init = new Uint32Array(8);
|
|
4154
4294
|
const key = new Uint32Array(64);
|
|
@@ -4187,7 +4327,7 @@ function reverse_endianness(bytes) {
|
|
|
4187
4327
|
}
|
|
4188
4328
|
}
|
|
4189
4329
|
function encode(str) {
|
|
4190
|
-
const encoded =
|
|
4330
|
+
const encoded = text_encoder.encode(str);
|
|
4191
4331
|
const length = encoded.length * 8;
|
|
4192
4332
|
const size = 512 * Math.ceil((length + 65) / 512);
|
|
4193
4333
|
const bytes = new Uint8Array(size / 8);
|
|
@@ -4199,34 +4339,10 @@ function encode(str) {
|
|
|
4199
4339
|
words[words.length - 1] = length;
|
|
4200
4340
|
return words;
|
|
4201
4341
|
}
|
|
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
4342
|
const array = new Uint8Array(16);
|
|
4227
4343
|
function generate_nonce() {
|
|
4228
4344
|
crypto.getRandomValues(array);
|
|
4229
|
-
return
|
|
4345
|
+
return btoa(String.fromCharCode(...array));
|
|
4230
4346
|
}
|
|
4231
4347
|
const quoted = /* @__PURE__ */ new Set([
|
|
4232
4348
|
"self",
|
|
@@ -4607,7 +4723,6 @@ const updated = {
|
|
|
4607
4723
|
...readable(false),
|
|
4608
4724
|
check: () => false
|
|
4609
4725
|
};
|
|
4610
|
-
const encoder$1 = new TextEncoder();
|
|
4611
4726
|
async function render_response({
|
|
4612
4727
|
branch,
|
|
4613
4728
|
fetched,
|
|
@@ -4618,6 +4733,7 @@ async function render_response({
|
|
|
4618
4733
|
status,
|
|
4619
4734
|
error: error2 = null,
|
|
4620
4735
|
event,
|
|
4736
|
+
event_state,
|
|
4621
4737
|
resolve_opts,
|
|
4622
4738
|
action_result
|
|
4623
4739
|
}) {
|
|
@@ -4700,7 +4816,10 @@ async function render_response({
|
|
|
4700
4816
|
};
|
|
4701
4817
|
{
|
|
4702
4818
|
try {
|
|
4703
|
-
rendered =
|
|
4819
|
+
rendered = with_request_store(
|
|
4820
|
+
{ event, state: event_state },
|
|
4821
|
+
() => options2.root.render(props, render_opts)
|
|
4822
|
+
);
|
|
4704
4823
|
} finally {
|
|
4705
4824
|
reset();
|
|
4706
4825
|
}
|
|
@@ -4767,6 +4886,7 @@ async function render_response({
|
|
|
4767
4886
|
const global = `__sveltekit_${options2.version_hash}`;
|
|
4768
4887
|
const { data, chunks } = get_data(
|
|
4769
4888
|
event,
|
|
4889
|
+
event_state,
|
|
4770
4890
|
options2,
|
|
4771
4891
|
branch.map((b) => b.server_data),
|
|
4772
4892
|
csp,
|
|
@@ -4833,7 +4953,7 @@ async function render_response({
|
|
|
4833
4953
|
try_to_resolve();
|
|
4834
4954
|
}`);
|
|
4835
4955
|
}
|
|
4836
|
-
const { remote_data } =
|
|
4956
|
+
const { remote_data } = event_state;
|
|
4837
4957
|
if (remote_data) {
|
|
4838
4958
|
const remote = {};
|
|
4839
4959
|
for (const key2 in remote_data) {
|
|
@@ -4913,7 +5033,11 @@ ${indent}}`);
|
|
|
4913
5033
|
blocks.push(boot);
|
|
4914
5034
|
}
|
|
4915
5035
|
if (options2.service_worker) {
|
|
4916
|
-
|
|
5036
|
+
let opts = "";
|
|
5037
|
+
if (options2.service_worker_options != null) {
|
|
5038
|
+
const service_worker_options = { ...options2.service_worker_options };
|
|
5039
|
+
opts = `, ${s(service_worker_options)}`;
|
|
5040
|
+
}
|
|
4917
5041
|
blocks.push(`if ('serviceWorker' in navigator) {
|
|
4918
5042
|
addEventListener('load', function () {
|
|
4919
5043
|
navigator.serviceWorker.register('${prefixed("service-worker.js")}'${opts});
|
|
@@ -4983,9 +5107,9 @@ ${indent}}`);
|
|
|
4983
5107
|
}) : new Response(
|
|
4984
5108
|
new ReadableStream({
|
|
4985
5109
|
async start(controller) {
|
|
4986
|
-
controller.enqueue(
|
|
5110
|
+
controller.enqueue(text_encoder.encode(transformed + "\n"));
|
|
4987
5111
|
for await (const chunk of chunks) {
|
|
4988
|
-
controller.enqueue(
|
|
5112
|
+
controller.enqueue(text_encoder.encode(chunk));
|
|
4989
5113
|
}
|
|
4990
5114
|
controller.close();
|
|
4991
5115
|
},
|
|
@@ -4996,7 +5120,7 @@ ${indent}}`);
|
|
|
4996
5120
|
}
|
|
4997
5121
|
);
|
|
4998
5122
|
}
|
|
4999
|
-
function get_data(event, options2, nodes, csp, global) {
|
|
5123
|
+
function get_data(event, event_state, options2, nodes, csp, global) {
|
|
5000
5124
|
let promise_id = 1;
|
|
5001
5125
|
let count = 0;
|
|
5002
5126
|
const { iterator, push, done } = create_async_iterator();
|
|
@@ -5010,7 +5134,7 @@ function get_data(event, options2, nodes, csp, global) {
|
|
|
5010
5134
|
).catch(
|
|
5011
5135
|
/** @param {any} error */
|
|
5012
5136
|
async (error2) => ({
|
|
5013
|
-
error: await handle_error_and_jsonify(event, options2, error2)
|
|
5137
|
+
error: await handle_error_and_jsonify(event, event_state, options2, error2)
|
|
5014
5138
|
})
|
|
5015
5139
|
).then(
|
|
5016
5140
|
/**
|
|
@@ -5024,6 +5148,7 @@ function get_data(event, options2, nodes, csp, global) {
|
|
|
5024
5148
|
} catch {
|
|
5025
5149
|
error2 = await handle_error_and_jsonify(
|
|
5026
5150
|
event,
|
|
5151
|
+
event_state,
|
|
5027
5152
|
options2,
|
|
5028
5153
|
new Error(`Failed to serialize promise while rendering ${event.route.id}`)
|
|
5029
5154
|
);
|
|
@@ -5157,6 +5282,7 @@ class PageNodes {
|
|
|
5157
5282
|
}
|
|
5158
5283
|
async function respond_with_error({
|
|
5159
5284
|
event,
|
|
5285
|
+
event_state,
|
|
5160
5286
|
options: options2,
|
|
5161
5287
|
manifest,
|
|
5162
5288
|
state,
|
|
@@ -5183,6 +5309,7 @@ async function respond_with_error({
|
|
|
5183
5309
|
state.error = true;
|
|
5184
5310
|
const server_data_promise = load_server_data({
|
|
5185
5311
|
event,
|
|
5312
|
+
event_state,
|
|
5186
5313
|
state,
|
|
5187
5314
|
node: default_layout,
|
|
5188
5315
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
@@ -5191,6 +5318,7 @@ async function respond_with_error({
|
|
|
5191
5318
|
const server_data = await server_data_promise;
|
|
5192
5319
|
const data = await load_data({
|
|
5193
5320
|
event,
|
|
5321
|
+
event_state,
|
|
5194
5322
|
fetched,
|
|
5195
5323
|
node: default_layout,
|
|
5196
5324
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
@@ -5223,10 +5351,11 @@ async function respond_with_error({
|
|
|
5223
5351
|
csr
|
|
5224
5352
|
},
|
|
5225
5353
|
status,
|
|
5226
|
-
error: await handle_error_and_jsonify(event, options2, error2),
|
|
5354
|
+
error: await handle_error_and_jsonify(event, event_state, options2, error2),
|
|
5227
5355
|
branch,
|
|
5228
5356
|
fetched,
|
|
5229
5357
|
event,
|
|
5358
|
+
event_state,
|
|
5230
5359
|
resolve_opts
|
|
5231
5360
|
});
|
|
5232
5361
|
} catch (e) {
|
|
@@ -5236,7 +5365,7 @@ async function respond_with_error({
|
|
|
5236
5365
|
return static_error_page(
|
|
5237
5366
|
options2,
|
|
5238
5367
|
get_status(e),
|
|
5239
|
-
(await handle_error_and_jsonify(event, options2, e)).message
|
|
5368
|
+
(await handle_error_and_jsonify(event, event_state, options2, e)).message
|
|
5240
5369
|
);
|
|
5241
5370
|
}
|
|
5242
5371
|
}
|
|
@@ -5249,8 +5378,7 @@ function once(fn) {
|
|
|
5249
5378
|
return result = fn();
|
|
5250
5379
|
};
|
|
5251
5380
|
}
|
|
5252
|
-
|
|
5253
|
-
async function render_data(event, route, options2, manifest, state, invalidated_data_nodes, trailing_slash) {
|
|
5381
|
+
async function render_data(event, event_state, route, options2, manifest, state, invalidated_data_nodes, trailing_slash) {
|
|
5254
5382
|
if (!route.page) {
|
|
5255
5383
|
return new Response(void 0, {
|
|
5256
5384
|
status: 404
|
|
@@ -5277,6 +5405,7 @@ async function render_data(event, route, options2, manifest, state, invalidated_
|
|
|
5277
5405
|
const node = n == void 0 ? n : await manifest._.nodes[n]();
|
|
5278
5406
|
return load_server_data({
|
|
5279
5407
|
event: new_event,
|
|
5408
|
+
event_state,
|
|
5280
5409
|
state,
|
|
5281
5410
|
node,
|
|
5282
5411
|
parent: async () => {
|
|
@@ -5322,23 +5451,23 @@ async function render_data(event, route, options2, manifest, state, invalidated_
|
|
|
5322
5451
|
/** @type {import('types').ServerErrorNode} */
|
|
5323
5452
|
{
|
|
5324
5453
|
type: "error",
|
|
5325
|
-
error: await handle_error_and_jsonify(event, options2, error2),
|
|
5454
|
+
error: await handle_error_and_jsonify(event, event_state, options2, error2),
|
|
5326
5455
|
status: error2 instanceof HttpError || error2 instanceof SvelteKitError ? error2.status : void 0
|
|
5327
5456
|
}
|
|
5328
5457
|
);
|
|
5329
5458
|
})
|
|
5330
5459
|
)
|
|
5331
5460
|
);
|
|
5332
|
-
const { data, chunks } = get_data_json(event, options2, nodes);
|
|
5461
|
+
const { data, chunks } = get_data_json(event, event_state, options2, nodes);
|
|
5333
5462
|
if (!chunks) {
|
|
5334
5463
|
return json_response(data);
|
|
5335
5464
|
}
|
|
5336
5465
|
return new Response(
|
|
5337
5466
|
new ReadableStream({
|
|
5338
5467
|
async start(controller) {
|
|
5339
|
-
controller.enqueue(
|
|
5468
|
+
controller.enqueue(text_encoder.encode(data));
|
|
5340
5469
|
for await (const chunk of chunks) {
|
|
5341
|
-
controller.enqueue(
|
|
5470
|
+
controller.enqueue(text_encoder.encode(chunk));
|
|
5342
5471
|
}
|
|
5343
5472
|
controller.close();
|
|
5344
5473
|
},
|
|
@@ -5358,7 +5487,7 @@ async function render_data(event, route, options2, manifest, state, invalidated_
|
|
|
5358
5487
|
if (error2 instanceof Redirect) {
|
|
5359
5488
|
return redirect_json_response(error2);
|
|
5360
5489
|
} else {
|
|
5361
|
-
return json_response(await handle_error_and_jsonify(event, options2, error2), 500);
|
|
5490
|
+
return json_response(await handle_error_and_jsonify(event, event_state, options2, error2), 500);
|
|
5362
5491
|
}
|
|
5363
5492
|
}
|
|
5364
5493
|
}
|
|
@@ -5380,7 +5509,7 @@ function redirect_json_response(redirect) {
|
|
|
5380
5509
|
}
|
|
5381
5510
|
);
|
|
5382
5511
|
}
|
|
5383
|
-
function get_data_json(event, options2, nodes) {
|
|
5512
|
+
function get_data_json(event, event_state, options2, nodes) {
|
|
5384
5513
|
let promise_id = 1;
|
|
5385
5514
|
let count = 0;
|
|
5386
5515
|
const { iterator, push, done } = create_async_iterator();
|
|
@@ -5400,6 +5529,7 @@ function get_data_json(event, options2, nodes) {
|
|
|
5400
5529
|
key2 = "error";
|
|
5401
5530
|
return handle_error_and_jsonify(
|
|
5402
5531
|
event,
|
|
5532
|
+
event_state,
|
|
5403
5533
|
options2,
|
|
5404
5534
|
/** @type {any} */
|
|
5405
5535
|
e
|
|
@@ -5414,6 +5544,7 @@ function get_data_json(event, options2, nodes) {
|
|
|
5414
5544
|
} catch {
|
|
5415
5545
|
const error2 = await handle_error_and_jsonify(
|
|
5416
5546
|
event,
|
|
5547
|
+
event_state,
|
|
5417
5548
|
options2,
|
|
5418
5549
|
new Error(`Failed to serialize promise while rendering ${event.route.id}`)
|
|
5419
5550
|
);
|
|
@@ -5454,7 +5585,20 @@ function get_data_json(event, options2, nodes) {
|
|
|
5454
5585
|
));
|
|
5455
5586
|
}
|
|
5456
5587
|
}
|
|
5457
|
-
async function handle_remote_call(event, options2, manifest, id) {
|
|
5588
|
+
async function handle_remote_call(event, state, options2, manifest, id) {
|
|
5589
|
+
return record_span({
|
|
5590
|
+
name: "sveltekit.remote.call",
|
|
5591
|
+
attributes: {},
|
|
5592
|
+
fn: (current) => {
|
|
5593
|
+
const traced_event = merge_tracing(event, current);
|
|
5594
|
+
return with_request_store(
|
|
5595
|
+
{ event: traced_event, state },
|
|
5596
|
+
() => handle_remote_call_internal(traced_event, state, options2, manifest, id)
|
|
5597
|
+
);
|
|
5598
|
+
}
|
|
5599
|
+
});
|
|
5600
|
+
}
|
|
5601
|
+
async function handle_remote_call_internal(event, state, options2, manifest, id) {
|
|
5458
5602
|
const [hash2, name, prerender_args] = id.split("/");
|
|
5459
5603
|
const remotes = manifest._.remotes;
|
|
5460
5604
|
if (!remotes[hash2]) error(404);
|
|
@@ -5463,6 +5607,10 @@ async function handle_remote_call(event, options2, manifest, id) {
|
|
|
5463
5607
|
if (!fn) error(404);
|
|
5464
5608
|
const info = fn.__;
|
|
5465
5609
|
const transport = options2.hooks.transport;
|
|
5610
|
+
event.tracing.current.setAttributes({
|
|
5611
|
+
"sveltekit.remote.call.type": info.type,
|
|
5612
|
+
"sveltekit.remote.call.name": info.name
|
|
5613
|
+
});
|
|
5466
5614
|
let form_client_refreshes;
|
|
5467
5615
|
try {
|
|
5468
5616
|
if (info.type === "form") {
|
|
@@ -5482,21 +5630,15 @@ async function handle_remote_call(event, options2, manifest, id) {
|
|
|
5482
5630
|
);
|
|
5483
5631
|
form_data.delete("sveltekit:remote_refreshes");
|
|
5484
5632
|
const fn2 = info.fn;
|
|
5485
|
-
const data2 = await
|
|
5633
|
+
const data2 = await with_request_store({ event, state }, () => fn2(form_data));
|
|
5486
5634
|
return json(
|
|
5487
5635
|
/** @type {RemoteFunctionResponse} */
|
|
5488
5636
|
{
|
|
5489
5637
|
type: "result",
|
|
5490
5638
|
result: stringify(data2, transport),
|
|
5491
|
-
refreshes:
|
|
5492
|
-
{
|
|
5493
|
-
|
|
5494
|
-
...await apply_client_refreshes(
|
|
5495
|
-
/** @type {string[]} */
|
|
5496
|
-
form_client_refreshes
|
|
5497
|
-
)
|
|
5498
|
-
},
|
|
5499
|
-
transport
|
|
5639
|
+
refreshes: await serialize_refreshes(
|
|
5640
|
+
/** @type {string[]} */
|
|
5641
|
+
form_client_refreshes
|
|
5500
5642
|
)
|
|
5501
5643
|
}
|
|
5502
5644
|
);
|
|
@@ -5504,14 +5646,13 @@ async function handle_remote_call(event, options2, manifest, id) {
|
|
|
5504
5646
|
if (info.type === "command") {
|
|
5505
5647
|
const { payload: payload2, refreshes } = await event.request.json();
|
|
5506
5648
|
const arg = parse_remote_arg(payload2, transport);
|
|
5507
|
-
const data2 = await
|
|
5508
|
-
const refreshed = await apply_client_refreshes(refreshes);
|
|
5649
|
+
const data2 = await with_request_store({ event, state }, () => fn(arg));
|
|
5509
5650
|
return json(
|
|
5510
5651
|
/** @type {RemoteFunctionResponse} */
|
|
5511
5652
|
{
|
|
5512
5653
|
type: "result",
|
|
5513
5654
|
result: stringify(data2, transport),
|
|
5514
|
-
refreshes:
|
|
5655
|
+
refreshes: await serialize_refreshes(refreshes)
|
|
5515
5656
|
}
|
|
5516
5657
|
);
|
|
5517
5658
|
}
|
|
@@ -5520,7 +5661,10 @@ async function handle_remote_call(event, options2, manifest, id) {
|
|
|
5520
5661
|
// new URL(...) necessary because we're hiding the URL from the user in the event object
|
|
5521
5662
|
new URL(event.request.url).searchParams.get("payload")
|
|
5522
5663
|
);
|
|
5523
|
-
const data = await
|
|
5664
|
+
const data = await with_request_store(
|
|
5665
|
+
{ event, state },
|
|
5666
|
+
() => fn(parse_remote_arg(payload, transport))
|
|
5667
|
+
);
|
|
5524
5668
|
return json(
|
|
5525
5669
|
/** @type {RemoteFunctionResponse} */
|
|
5526
5670
|
{
|
|
@@ -5530,22 +5674,17 @@ async function handle_remote_call(event, options2, manifest, id) {
|
|
|
5530
5674
|
);
|
|
5531
5675
|
} catch (error2) {
|
|
5532
5676
|
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
5677
|
return json({
|
|
5539
5678
|
type: "redirect",
|
|
5540
5679
|
location: error2.location,
|
|
5541
|
-
refreshes:
|
|
5680
|
+
refreshes: await serialize_refreshes(form_client_refreshes ?? [])
|
|
5542
5681
|
});
|
|
5543
5682
|
}
|
|
5544
5683
|
return json(
|
|
5545
5684
|
/** @type {RemoteFunctionResponse} */
|
|
5546
5685
|
{
|
|
5547
5686
|
type: "error",
|
|
5548
|
-
error: await handle_error_and_jsonify(event, options2, error2),
|
|
5687
|
+
error: await handle_error_and_jsonify(event, state, options2, error2),
|
|
5549
5688
|
status: error2 instanceof HttpError || error2 instanceof SvelteKitError ? error2.status : 500
|
|
5550
5689
|
},
|
|
5551
5690
|
{
|
|
@@ -5555,23 +5694,46 @@ async function handle_remote_call(event, options2, manifest, id) {
|
|
|
5555
5694
|
}
|
|
5556
5695
|
);
|
|
5557
5696
|
}
|
|
5558
|
-
async function
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5697
|
+
async function serialize_refreshes(client_refreshes) {
|
|
5698
|
+
const refreshes = {
|
|
5699
|
+
...state.refreshes,
|
|
5700
|
+
...Object.fromEntries(
|
|
5701
|
+
await Promise.all(
|
|
5702
|
+
client_refreshes.map(async (key2) => {
|
|
5703
|
+
const [hash3, name2, payload] = key2.split("/");
|
|
5704
|
+
const loader = manifest._.remotes[hash3];
|
|
5705
|
+
if (!loader) error(400, "Bad Request");
|
|
5706
|
+
const module2 = await loader();
|
|
5707
|
+
const fn2 = module2[name2];
|
|
5708
|
+
if (!fn2) error(400, "Bad Request");
|
|
5709
|
+
return [
|
|
5710
|
+
key2,
|
|
5711
|
+
await with_request_store(
|
|
5712
|
+
{ event, state },
|
|
5713
|
+
() => fn2(parse_remote_arg(payload, transport))
|
|
5714
|
+
)
|
|
5715
|
+
];
|
|
5716
|
+
})
|
|
5717
|
+
)
|
|
5570
5718
|
)
|
|
5571
|
-
|
|
5572
|
-
|
|
5719
|
+
};
|
|
5720
|
+
return Object.keys(refreshes).length > 0 ? stringify(refreshes, transport) : void 0;
|
|
5721
|
+
}
|
|
5722
|
+
}
|
|
5723
|
+
async function handle_remote_form_post(event, state, manifest, id) {
|
|
5724
|
+
return record_span({
|
|
5725
|
+
name: "sveltekit.remote.form.post",
|
|
5726
|
+
attributes: {},
|
|
5727
|
+
fn: (current) => {
|
|
5728
|
+
const traced_event = merge_tracing(event, current);
|
|
5729
|
+
return with_request_store(
|
|
5730
|
+
{ event: traced_event, state },
|
|
5731
|
+
() => handle_remote_form_post_internal(traced_event, state, manifest, id)
|
|
5732
|
+
);
|
|
5733
|
+
}
|
|
5734
|
+
});
|
|
5573
5735
|
}
|
|
5574
|
-
async function
|
|
5736
|
+
async function handle_remote_form_post_internal(event, state, manifest, id) {
|
|
5575
5737
|
const [hash2, name, action_id] = id.split("/");
|
|
5576
5738
|
const remotes = manifest._.remotes;
|
|
5577
5739
|
const module = await remotes[hash2]?.();
|
|
@@ -5595,7 +5757,7 @@ async function handle_remote_form_post(event, manifest, id) {
|
|
|
5595
5757
|
};
|
|
5596
5758
|
}
|
|
5597
5759
|
if (action_id) {
|
|
5598
|
-
form =
|
|
5760
|
+
form = with_request_store({ event, state }, () => form.for(JSON.parse(action_id)));
|
|
5599
5761
|
}
|
|
5600
5762
|
try {
|
|
5601
5763
|
const form_data = await event.request.formData();
|
|
@@ -5604,7 +5766,7 @@ async function handle_remote_form_post(event, manifest, id) {
|
|
|
5604
5766
|
/** @type {any} */
|
|
5605
5767
|
form.__.fn
|
|
5606
5768
|
);
|
|
5607
|
-
await
|
|
5769
|
+
await with_request_store({ event, state }, () => fn(form_data));
|
|
5608
5770
|
return {
|
|
5609
5771
|
type: "success",
|
|
5610
5772
|
status: 200
|
|
@@ -5631,7 +5793,7 @@ function get_remote_action(url) {
|
|
|
5631
5793
|
return url.searchParams.get("/remote");
|
|
5632
5794
|
}
|
|
5633
5795
|
const MAX_DEPTH = 10;
|
|
5634
|
-
async function render_page(event, page, options2, manifest, state, nodes, resolve_opts) {
|
|
5796
|
+
async function render_page(event, event_state, page, options2, manifest, state, nodes, resolve_opts) {
|
|
5635
5797
|
if (state.depth > MAX_DEPTH) {
|
|
5636
5798
|
return text(`Not found: ${event.url.pathname}`, {
|
|
5637
5799
|
status: 404
|
|
@@ -5640,7 +5802,7 @@ async function render_page(event, page, options2, manifest, state, nodes, resolv
|
|
|
5640
5802
|
}
|
|
5641
5803
|
if (is_action_json_request(event)) {
|
|
5642
5804
|
const node = await manifest._.nodes[page.leaf]();
|
|
5643
|
-
return handle_action_json_request(event, options2, node?.server);
|
|
5805
|
+
return handle_action_json_request(event, event_state, options2, node?.server);
|
|
5644
5806
|
}
|
|
5645
5807
|
try {
|
|
5646
5808
|
const leaf_node = (
|
|
@@ -5652,9 +5814,9 @@ async function render_page(event, page, options2, manifest, state, nodes, resolv
|
|
|
5652
5814
|
if (is_action_request(event)) {
|
|
5653
5815
|
const remote_id = get_remote_action(event.url);
|
|
5654
5816
|
if (remote_id) {
|
|
5655
|
-
action_result = await handle_remote_form_post(event, manifest, remote_id);
|
|
5817
|
+
action_result = await handle_remote_form_post(event, event_state, manifest, remote_id);
|
|
5656
5818
|
} else {
|
|
5657
|
-
action_result = await handle_action_request(event, leaf_node.server);
|
|
5819
|
+
action_result = await handle_action_request(event, event_state, leaf_node.server);
|
|
5658
5820
|
}
|
|
5659
5821
|
if (action_result?.type === "redirect") {
|
|
5660
5822
|
return redirect_response(action_result.status, action_result.location);
|
|
@@ -5695,6 +5857,7 @@ async function render_page(event, page, options2, manifest, state, nodes, resolv
|
|
|
5695
5857
|
status,
|
|
5696
5858
|
error: null,
|
|
5697
5859
|
event,
|
|
5860
|
+
event_state,
|
|
5698
5861
|
options: options2,
|
|
5699
5862
|
manifest,
|
|
5700
5863
|
state,
|
|
@@ -5714,6 +5877,7 @@ async function render_page(event, page, options2, manifest, state, nodes, resolv
|
|
|
5714
5877
|
}
|
|
5715
5878
|
return await load_server_data({
|
|
5716
5879
|
event,
|
|
5880
|
+
event_state,
|
|
5717
5881
|
state,
|
|
5718
5882
|
node,
|
|
5719
5883
|
parent: async () => {
|
|
@@ -5738,6 +5902,7 @@ async function render_page(event, page, options2, manifest, state, nodes, resolv
|
|
|
5738
5902
|
try {
|
|
5739
5903
|
return await load_data({
|
|
5740
5904
|
event,
|
|
5905
|
+
event_state,
|
|
5741
5906
|
fetched,
|
|
5742
5907
|
node,
|
|
5743
5908
|
parent: async () => {
|
|
@@ -5786,7 +5951,7 @@ async function render_page(event, page, options2, manifest, state, nodes, resolv
|
|
|
5786
5951
|
return redirect_response(err.status, err.location);
|
|
5787
5952
|
}
|
|
5788
5953
|
const status2 = get_status(err);
|
|
5789
|
-
const error2 = await handle_error_and_jsonify(event, options2, err);
|
|
5954
|
+
const error2 = await handle_error_and_jsonify(event, event_state, options2, err);
|
|
5790
5955
|
while (i--) {
|
|
5791
5956
|
if (page.errors[i]) {
|
|
5792
5957
|
const index = (
|
|
@@ -5800,6 +5965,7 @@ async function render_page(event, page, options2, manifest, state, nodes, resolv
|
|
|
5800
5965
|
const nodes2 = new PageNodes(layouts.map((layout) => layout.node));
|
|
5801
5966
|
return await render_response({
|
|
5802
5967
|
event,
|
|
5968
|
+
event_state,
|
|
5803
5969
|
options: options2,
|
|
5804
5970
|
manifest,
|
|
5805
5971
|
state,
|
|
@@ -5828,6 +5994,7 @@ async function render_page(event, page, options2, manifest, state, nodes, resolv
|
|
|
5828
5994
|
if (state.prerendering && should_prerender_data) {
|
|
5829
5995
|
let { data, chunks } = get_data_json(
|
|
5830
5996
|
event,
|
|
5997
|
+
event_state,
|
|
5831
5998
|
options2,
|
|
5832
5999
|
branch.map((node) => node?.server_data)
|
|
5833
6000
|
);
|
|
@@ -5843,6 +6010,7 @@ async function render_page(event, page, options2, manifest, state, nodes, resolv
|
|
|
5843
6010
|
}
|
|
5844
6011
|
return await render_response({
|
|
5845
6012
|
event,
|
|
6013
|
+
event_state,
|
|
5846
6014
|
options: options2,
|
|
5847
6015
|
manifest,
|
|
5848
6016
|
state,
|
|
@@ -5860,6 +6028,7 @@ async function render_page(event, page, options2, manifest, state, nodes, resolv
|
|
|
5860
6028
|
} catch (e) {
|
|
5861
6029
|
return await respond_with_error({
|
|
5862
6030
|
event,
|
|
6031
|
+
event_state,
|
|
5863
6032
|
options: options2,
|
|
5864
6033
|
manifest,
|
|
5865
6034
|
state,
|
|
@@ -5966,8 +6135,8 @@ function get_cookies(request, url) {
|
|
|
5966
6135
|
const cookie = new_cookies[key2];
|
|
5967
6136
|
if (!domain_matches(destination.hostname, cookie.options.domain)) continue;
|
|
5968
6137
|
if (!path_matches(destination.pathname, cookie.options.path)) continue;
|
|
5969
|
-
const
|
|
5970
|
-
combined_cookies[cookie.name] =
|
|
6138
|
+
const encoder = cookie.options.encode || encodeURIComponent;
|
|
6139
|
+
combined_cookies[cookie.name] = encoder(cookie.value);
|
|
5971
6140
|
}
|
|
5972
6141
|
if (header2) {
|
|
5973
6142
|
const parsed = parse$1(header2, { decode: (value) => value });
|
|
@@ -6176,7 +6345,8 @@ const default_filter = () => false;
|
|
|
6176
6345
|
const default_preload = ({ type }) => type === "js" || type === "css";
|
|
6177
6346
|
const page_methods = /* @__PURE__ */ new Set(["GET", "HEAD", "POST"]);
|
|
6178
6347
|
const allowed_page_methods = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS"]);
|
|
6179
|
-
|
|
6348
|
+
const respond = propagate_context(internal_respond);
|
|
6349
|
+
async function internal_respond(request, options2, manifest, state) {
|
|
6180
6350
|
const url = new URL(request.url);
|
|
6181
6351
|
const is_route_resolution_request = has_resolution_suffix(url.pathname);
|
|
6182
6352
|
const is_data_request = has_data_suffix(url.pathname);
|
|
@@ -6220,8 +6390,15 @@ async function respond(request, options2, manifest, state) {
|
|
|
6220
6390
|
request,
|
|
6221
6391
|
url
|
|
6222
6392
|
);
|
|
6393
|
+
const event_state = {
|
|
6394
|
+
prerendering: state.prerendering,
|
|
6395
|
+
transport: options2.hooks.transport,
|
|
6396
|
+
handleValidationError: options2.hooks.handleValidationError,
|
|
6397
|
+
tracing: {
|
|
6398
|
+
record_span
|
|
6399
|
+
}
|
|
6400
|
+
};
|
|
6223
6401
|
const event = {
|
|
6224
|
-
[EVENT_STATE]: create_event_state(state, options2),
|
|
6225
6402
|
cookies,
|
|
6226
6403
|
// @ts-expect-error `fetch` needs to be created after the `event` itself
|
|
6227
6404
|
fetch: null,
|
|
@@ -6396,34 +6573,66 @@ async function respond(request, options2, manifest, state) {
|
|
|
6396
6573
|
if (state.prerendering && !state.prerendering.fallback && !state.prerendering.inside_reroute) {
|
|
6397
6574
|
disable_search(url);
|
|
6398
6575
|
}
|
|
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
|
-
|
|
6576
|
+
const response = await record_span({
|
|
6577
|
+
name: "sveltekit.handle.root",
|
|
6578
|
+
attributes: {
|
|
6579
|
+
"http.route": event.route.id || "unknown",
|
|
6580
|
+
"http.method": event.request.method,
|
|
6581
|
+
"http.url": event.url.href,
|
|
6582
|
+
"sveltekit.is_data_request": is_data_request,
|
|
6583
|
+
"sveltekit.is_sub_request": event.isSubRequest
|
|
6584
|
+
},
|
|
6585
|
+
fn: async (root_span) => {
|
|
6586
|
+
const traced_event = {
|
|
6587
|
+
...event,
|
|
6588
|
+
tracing: {
|
|
6589
|
+
enabled: false,
|
|
6590
|
+
root: root_span,
|
|
6591
|
+
current: root_span
|
|
6592
|
+
}
|
|
6593
|
+
};
|
|
6594
|
+
return await with_request_store(
|
|
6595
|
+
{ event: traced_event, state: event_state },
|
|
6596
|
+
() => options2.hooks.handle({
|
|
6597
|
+
event: traced_event,
|
|
6598
|
+
resolve: (event2, opts) => {
|
|
6599
|
+
return record_span({
|
|
6600
|
+
name: "sveltekit.resolve",
|
|
6601
|
+
attributes: {
|
|
6602
|
+
"http.route": event2.route.id || "unknown"
|
|
6603
|
+
},
|
|
6604
|
+
fn: (resolve_span) => {
|
|
6605
|
+
return with_request_store(
|
|
6606
|
+
null,
|
|
6607
|
+
() => resolve2(merge_tracing(event2, resolve_span), page_nodes, opts).then(
|
|
6608
|
+
(response2) => {
|
|
6609
|
+
for (const key2 in headers2) {
|
|
6610
|
+
const value = headers2[key2];
|
|
6611
|
+
response2.headers.set(
|
|
6612
|
+
key2,
|
|
6613
|
+
/** @type {string} */
|
|
6614
|
+
value
|
|
6615
|
+
);
|
|
6616
|
+
}
|
|
6617
|
+
add_cookies_to_headers(response2.headers, Object.values(new_cookies));
|
|
6618
|
+
if (state.prerendering && event2.route.id !== null) {
|
|
6619
|
+
response2.headers.set("x-sveltekit-routeid", encodeURI(event2.route.id));
|
|
6620
|
+
}
|
|
6621
|
+
resolve_span.setAttributes({
|
|
6622
|
+
"http.response.status_code": response2.status,
|
|
6623
|
+
"http.response.body.size": response2.headers.get("content-length") || "unknown"
|
|
6624
|
+
});
|
|
6625
|
+
return response2;
|
|
6626
|
+
}
|
|
6627
|
+
)
|
|
6628
|
+
);
|
|
6629
|
+
}
|
|
6630
|
+
});
|
|
6631
|
+
}
|
|
6632
|
+
})
|
|
6633
|
+
);
|
|
6634
|
+
}
|
|
6635
|
+
});
|
|
6427
6636
|
if (response.status === 200 && response.headers.has("etag")) {
|
|
6428
6637
|
let if_none_match_value = request.headers.get("if-none-match");
|
|
6429
6638
|
if (if_none_match_value?.startsWith('W/"')) {
|
|
@@ -6469,7 +6678,7 @@ async function respond(request, options2, manifest, state) {
|
|
|
6469
6678
|
add_cookies_to_headers(response.headers, Object.values(new_cookies));
|
|
6470
6679
|
return response;
|
|
6471
6680
|
}
|
|
6472
|
-
return await handle_fatal_error(event, options2, e);
|
|
6681
|
+
return await handle_fatal_error(event, event_state, options2, e);
|
|
6473
6682
|
}
|
|
6474
6683
|
async function resolve2(event2, page_nodes, opts) {
|
|
6475
6684
|
try {
|
|
@@ -6483,6 +6692,7 @@ async function respond(request, options2, manifest, state) {
|
|
|
6483
6692
|
if (options2.hash_routing || state.prerendering?.fallback) {
|
|
6484
6693
|
return await render_response({
|
|
6485
6694
|
event: event2,
|
|
6695
|
+
event_state,
|
|
6486
6696
|
options: options2,
|
|
6487
6697
|
manifest,
|
|
6488
6698
|
state,
|
|
@@ -6495,7 +6705,7 @@ async function respond(request, options2, manifest, state) {
|
|
|
6495
6705
|
});
|
|
6496
6706
|
}
|
|
6497
6707
|
if (remote_id) {
|
|
6498
|
-
return await handle_remote_call(event2, options2, manifest, remote_id);
|
|
6708
|
+
return await handle_remote_call(event2, event_state, options2, manifest, remote_id);
|
|
6499
6709
|
}
|
|
6500
6710
|
if (route) {
|
|
6501
6711
|
const method = (
|
|
@@ -6506,6 +6716,7 @@ async function respond(request, options2, manifest, state) {
|
|
|
6506
6716
|
if (is_data_request) {
|
|
6507
6717
|
response = await render_data(
|
|
6508
6718
|
event2,
|
|
6719
|
+
event_state,
|
|
6509
6720
|
route,
|
|
6510
6721
|
options2,
|
|
6511
6722
|
manifest,
|
|
@@ -6514,13 +6725,14 @@ async function respond(request, options2, manifest, state) {
|
|
|
6514
6725
|
trailing_slash
|
|
6515
6726
|
);
|
|
6516
6727
|
} else if (route.endpoint && (!route.page || is_endpoint_request(event2))) {
|
|
6517
|
-
response = await render_endpoint(event2, await route.endpoint(), state);
|
|
6728
|
+
response = await render_endpoint(event2, event_state, await route.endpoint(), state);
|
|
6518
6729
|
} else if (route.page) {
|
|
6519
6730
|
if (!page_nodes) {
|
|
6520
6731
|
throw new Error("page_nodes not found. This should never happen");
|
|
6521
6732
|
} else if (page_methods.has(method)) {
|
|
6522
6733
|
response = await render_page(
|
|
6523
6734
|
event2,
|
|
6735
|
+
event_state,
|
|
6524
6736
|
route.page,
|
|
6525
6737
|
options2,
|
|
6526
6738
|
manifest,
|
|
@@ -6583,6 +6795,7 @@ async function respond(request, options2, manifest, state) {
|
|
|
6583
6795
|
if (DEV && event2.url.pathname === "/.well-known/appspecific/com.chrome.devtools.json") ;
|
|
6584
6796
|
return await respond_with_error({
|
|
6585
6797
|
event: event2,
|
|
6798
|
+
event_state,
|
|
6586
6799
|
options: options2,
|
|
6587
6800
|
manifest,
|
|
6588
6801
|
state,
|
|
@@ -6596,7 +6809,7 @@ async function respond(request, options2, manifest, state) {
|
|
|
6596
6809
|
}
|
|
6597
6810
|
return await fetch(request);
|
|
6598
6811
|
} catch (e) {
|
|
6599
|
-
return await handle_fatal_error(event2, options2, e);
|
|
6812
|
+
return await handle_fatal_error(event2, event_state, options2, e);
|
|
6600
6813
|
} finally {
|
|
6601
6814
|
event2.cookies.set = () => {
|
|
6602
6815
|
throw new Error("Cannot use `cookies.set(...)` after the response has been generated");
|
|
@@ -6614,6 +6827,13 @@ function load_page_nodes(page, manifest) {
|
|
|
6614
6827
|
manifest._.nodes[page.leaf]()
|
|
6615
6828
|
]);
|
|
6616
6829
|
}
|
|
6830
|
+
function propagate_context(fn) {
|
|
6831
|
+
return async (req, ...rest) => {
|
|
6832
|
+
{
|
|
6833
|
+
return fn(req, ...rest);
|
|
6834
|
+
}
|
|
6835
|
+
};
|
|
6836
|
+
}
|
|
6617
6837
|
function filter_private_env(env, { public_prefix, private_prefix }) {
|
|
6618
6838
|
return Object.fromEntries(
|
|
6619
6839
|
Object.entries(env).filter(
|