@qwik.dev/router 2.0.0-beta.1 → 2.0.0-beta.10
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/adapters/static/vite.d.ts +1 -1
- package/lib/adapters/azure-swa/vite/index-BqUeglYs.cjs +1 -0
- package/lib/adapters/azure-swa/vite/index-CBIchDYq.js +651 -0
- package/lib/adapters/azure-swa/vite/index-ClHGw5z1.js +6 -0
- package/lib/adapters/azure-swa/vite/index-CrwlB95_.js +22 -0
- package/lib/adapters/azure-swa/vite/index-DTIOTwZo.cjs +11 -0
- package/lib/adapters/azure-swa/vite/index-vQuPcef3.cjs +1 -0
- package/lib/adapters/azure-swa/vite/index.cjs +5 -96
- package/lib/adapters/azure-swa/vite/index.d.ts +2 -2
- package/lib/adapters/azure-swa/vite/index.mjs +201 -26
- package/lib/adapters/bun-server/vite/index-BqUeglYs.cjs +1 -0
- package/lib/adapters/bun-server/vite/index-CBIchDYq.js +651 -0
- package/lib/adapters/bun-server/vite/index-ClHGw5z1.js +6 -0
- package/lib/adapters/bun-server/vite/index-CrwlB95_.js +22 -0
- package/lib/adapters/bun-server/vite/index-DTIOTwZo.cjs +11 -0
- package/lib/adapters/bun-server/vite/index-vQuPcef3.cjs +1 -0
- package/lib/adapters/bun-server/vite/index.cjs +5 -50
- package/lib/adapters/bun-server/vite/index.d.ts +2 -2
- package/lib/adapters/bun-server/vite/index.mjs +196 -12
- package/lib/adapters/cloud-run/vite/index-BqUeglYs.cjs +1 -0
- package/lib/adapters/cloud-run/vite/index-CBIchDYq.js +651 -0
- package/lib/adapters/cloud-run/vite/index-ClHGw5z1.js +6 -0
- package/lib/adapters/cloud-run/vite/index-CrwlB95_.js +22 -0
- package/lib/adapters/cloud-run/vite/index-DTIOTwZo.cjs +11 -0
- package/lib/adapters/cloud-run/vite/index-vQuPcef3.cjs +1 -0
- package/lib/adapters/cloud-run/vite/index.cjs +5 -47
- package/lib/adapters/cloud-run/vite/index.d.ts +2 -2
- package/lib/adapters/cloud-run/vite/index.mjs +195 -11
- package/lib/adapters/cloudflare-pages/vite/index-BIeHg2Cj.cjs +5 -0
- package/lib/adapters/cloudflare-pages/vite/index-C455V8_A.cjs +1 -0
- package/lib/adapters/cloudflare-pages/vite/index-ClHGw5z1.js +6 -0
- package/lib/adapters/cloudflare-pages/vite/index-D3HITboM.js +645 -0
- package/lib/adapters/cloudflare-pages/vite/index-DKcVHRBy.cjs +11 -0
- package/lib/adapters/cloudflare-pages/vite/index-DwovcBp3.js +22 -0
- package/lib/adapters/cloudflare-pages/vite/index-bogwy7wh.js +250 -0
- package/lib/adapters/cloudflare-pages/vite/index-vQuPcef3.cjs +1 -0
- package/lib/adapters/cloudflare-pages/vite/index.cjs +1 -115
- package/lib/adapters/cloudflare-pages/vite/index.d.ts +2 -2
- package/lib/adapters/cloudflare-pages/vite/index.mjs +4 -78
- package/lib/adapters/deno-server/vite/index-BqUeglYs.cjs +1 -0
- package/lib/adapters/deno-server/vite/index-CBIchDYq.js +651 -0
- package/lib/adapters/deno-server/vite/index-ClHGw5z1.js +6 -0
- package/lib/adapters/deno-server/vite/index-CrwlB95_.js +22 -0
- package/lib/adapters/deno-server/vite/index-DTIOTwZo.cjs +11 -0
- package/lib/adapters/deno-server/vite/index-vQuPcef3.cjs +1 -0
- package/lib/adapters/deno-server/vite/index.cjs +5 -62
- package/lib/adapters/deno-server/vite/index.d.ts +2 -2
- package/lib/adapters/deno-server/vite/index.mjs +198 -14
- package/lib/adapters/netlify-edge/vite/index-BqUeglYs.cjs +1 -0
- package/lib/adapters/netlify-edge/vite/index-CBIchDYq.js +651 -0
- package/lib/adapters/netlify-edge/vite/index-ClHGw5z1.js +6 -0
- package/lib/adapters/netlify-edge/vite/index-CrwlB95_.js +22 -0
- package/lib/adapters/netlify-edge/vite/index-DTIOTwZo.cjs +11 -0
- package/lib/adapters/netlify-edge/vite/index-vQuPcef3.cjs +1 -0
- package/lib/adapters/netlify-edge/vite/index.cjs +6 -129
- package/lib/adapters/netlify-edge/vite/index.d.ts +2 -2
- package/lib/adapters/netlify-edge/vite/index.mjs +240 -60
- package/lib/adapters/node-server/vite/index-BqUeglYs.cjs +1 -0
- package/lib/adapters/node-server/vite/index-CBIchDYq.js +651 -0
- package/lib/adapters/node-server/vite/index-ClHGw5z1.js +6 -0
- package/lib/adapters/node-server/vite/index-CrwlB95_.js +22 -0
- package/lib/adapters/node-server/vite/index-DTIOTwZo.cjs +11 -0
- package/lib/adapters/node-server/vite/index-vQuPcef3.cjs +1 -0
- package/lib/adapters/node-server/vite/index.cjs +5 -50
- package/lib/adapters/node-server/vite/index.d.ts +2 -2
- package/lib/adapters/node-server/vite/index.mjs +196 -12
- package/lib/adapters/shared/vite/index-BqUeglYs.cjs +1 -0
- package/lib/adapters/shared/vite/index-CBIchDYq.js +651 -0
- package/lib/adapters/shared/vite/index-ClHGw5z1.js +6 -0
- package/lib/adapters/shared/vite/index-CrwlB95_.js +22 -0
- package/lib/adapters/shared/vite/index-DTIOTwZo.cjs +11 -0
- package/lib/adapters/shared/vite/index-vQuPcef3.cjs +1 -0
- package/lib/adapters/shared/vite/index.cjs +2 -375
- package/lib/adapters/shared/vite/index.d.ts +9 -15
- package/lib/adapters/shared/vite/index.mjs +155 -292
- package/lib/adapters/ssg/vite/index-BqUeglYs.cjs +1 -0
- package/lib/adapters/ssg/vite/index-CBIchDYq.js +651 -0
- package/lib/adapters/ssg/vite/index-ClHGw5z1.js +6 -0
- package/lib/adapters/ssg/vite/index-CrwlB95_.js +22 -0
- package/lib/adapters/ssg/vite/index-DTIOTwZo.cjs +11 -0
- package/lib/adapters/ssg/vite/index-vQuPcef3.cjs +1 -0
- package/lib/adapters/ssg/vite/index.cjs +5 -0
- package/lib/adapters/ssg/vite/index.d.ts +13 -0
- package/lib/adapters/ssg/vite/index.mjs +201 -0
- package/lib/adapters/vercel-edge/vite/index-BqUeglYs.cjs +1 -0
- package/lib/adapters/vercel-edge/vite/index-CBIchDYq.js +651 -0
- package/lib/adapters/vercel-edge/vite/index-ClHGw5z1.js +6 -0
- package/lib/adapters/vercel-edge/vite/index-CrwlB95_.js +22 -0
- package/lib/adapters/vercel-edge/vite/index-DTIOTwZo.cjs +11 -0
- package/lib/adapters/vercel-edge/vite/index-vQuPcef3.cjs +1 -0
- package/lib/adapters/vercel-edge/vite/index.cjs +5 -118
- package/lib/adapters/vercel-edge/vite/index.d.ts +2 -2
- package/lib/adapters/vercel-edge/vite/index.mjs +230 -51
- package/lib/index.d.ts +172 -50
- package/lib/index.qwik.cjs +333 -160
- package/lib/index.qwik.mjs +335 -162
- package/lib/middleware/aws-lambda/index.cjs +1 -0
- package/lib/middleware/aws-lambda/index.d.ts +3 -2
- package/lib/middleware/aws-lambda/index.mjs +27 -41
- package/lib/middleware/azure-swa/index.cjs +1 -0
- package/lib/middleware/azure-swa/index.mjs +46 -269
- package/lib/middleware/bun/index.cjs +1 -0
- package/lib/middleware/bun/index.mjs +68 -120
- package/lib/middleware/cloudflare-pages/index.cjs +1 -0
- package/lib/middleware/cloudflare-pages/index.mjs +48 -80
- package/lib/middleware/deno/index.cjs +1 -0
- package/lib/middleware/deno/index.mjs +63 -110
- package/lib/middleware/firebase/index.cjs +1 -0
- package/lib/middleware/firebase/index.mjs +16 -28
- package/lib/middleware/netlify-edge/index.cjs +1 -0
- package/lib/middleware/netlify-edge/index.mjs +36 -64
- package/lib/middleware/node/index.cjs +1 -314
- package/lib/middleware/node/index.mjs +116 -198
- package/lib/middleware/request-handler/index.cjs +11 -1607
- package/lib/middleware/request-handler/index.d.ts +63 -62
- package/lib/middleware/request-handler/index.mjs +879 -1333
- package/lib/middleware/vercel-edge/index.cjs +1 -0
- package/lib/middleware/vercel-edge/index.mjs +47 -82
- package/lib/modules.d.ts +4 -12
- package/lib/service-worker.cjs +1 -17
- package/lib/service-worker.mjs +5 -15
- package/lib/ssg/deno.cjs +1 -0
- package/lib/ssg/deno.mjs +6 -0
- package/lib/ssg/index-CBIchDYq.js +651 -0
- package/lib/ssg/index-ClHGw5z1.js +6 -0
- package/lib/ssg/index-DTIOTwZo.cjs +11 -0
- package/lib/ssg/index-vQuPcef3.cjs +1 -0
- package/lib/ssg/index.cjs +1 -0
- package/lib/{static → ssg}/index.d.ts +17 -17
- package/lib/ssg/index.mjs +22 -0
- package/lib/ssg/node.cjs +11 -0
- package/lib/ssg/node.mjs +651 -0
- package/lib/vite/index.cjs +28 -27431
- package/lib/vite/index.d.ts +16 -0
- package/lib/vite/index.mjs +1413 -27227
- package/modules.d.ts +4 -12
- package/package.json +50 -39
- package/ssg.d.ts +2 -0
- package/static.d.ts +1 -1
- package/lib/adapters/static/vite/index.cjs +0 -368
- package/lib/adapters/static/vite/index.d.ts +0 -10
- package/lib/adapters/static/vite/index.mjs +0 -331
- package/lib/static/deno.mjs +0 -8
- package/lib/static/index.cjs +0 -67
- package/lib/static/index.mjs +0 -48
- package/lib/static/node.cjs +0 -1124
- package/lib/static/node.mjs +0 -1086
- package/middleware/request-handler/generated/not-found-paths.ts +0 -7
- package/middleware/request-handler/generated/static-paths.ts +0 -35
|
@@ -1,1570 +1,1116 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { _serialize as D, _UNINITIALIZED as ye, _deserialize as ee, _verifySerializable as Se } from "@qwik.dev/core/internal";
|
|
2
|
+
import "@qwik.dev/core";
|
|
3
|
+
import { ServerError as F, RedirectMessage as H, RewriteMessage as we, AbortMessage as pe } from "@qwik.dev/router/middleware/request-handler";
|
|
4
|
+
const ne = /* @__PURE__ */ new WeakMap(), te = "qaction", v = "qloaders", Qe = "qfunc", re = "qdata", je = "q:route";
|
|
5
|
+
function Ee(e, t) {
|
|
6
|
+
const n = ae(e), r = ie(e), o = ae(t), i = ie(t);
|
|
7
|
+
return Re(e, n, r, t, o, i);
|
|
8
|
+
}
|
|
9
|
+
function Re(e, t, n, r, o, i) {
|
|
10
|
+
if (r.startsWith("/build/"))
|
|
11
|
+
return null;
|
|
12
|
+
let a = null;
|
|
13
|
+
for (; t < n; ) {
|
|
14
|
+
const s = e.charCodeAt(t++), c = r.charCodeAt(o++);
|
|
15
|
+
if (s === 91) {
|
|
16
|
+
const f = be(e, t), l = t + (f ? 3 : 0), u = B(
|
|
17
|
+
e,
|
|
18
|
+
l,
|
|
19
|
+
n,
|
|
20
|
+
93
|
|
21
|
+
/* CLOSE_BRACKET */
|
|
22
|
+
), h = e.substring(l, u), y = B(
|
|
23
|
+
e,
|
|
24
|
+
u + 1,
|
|
25
|
+
n,
|
|
26
|
+
47
|
|
27
|
+
/* SLASH */
|
|
28
|
+
), w = e.substring(u + 1, y);
|
|
29
|
+
t = u + 1;
|
|
30
|
+
const R = o - 1;
|
|
31
|
+
if (f) {
|
|
32
|
+
const M = ze(
|
|
33
|
+
h,
|
|
34
|
+
w,
|
|
35
|
+
r,
|
|
36
|
+
R,
|
|
37
|
+
i,
|
|
38
|
+
e,
|
|
39
|
+
t + w.length + 1,
|
|
40
|
+
n
|
|
41
|
+
);
|
|
42
|
+
if (M)
|
|
43
|
+
return Object.assign(a || (a = {}), M);
|
|
44
|
+
}
|
|
45
|
+
const p = B(r, R, i, 47, w);
|
|
46
|
+
if (p == -1)
|
|
47
|
+
return null;
|
|
48
|
+
const T = r.substring(R, p);
|
|
49
|
+
if (!f && !w && !T)
|
|
50
|
+
return null;
|
|
51
|
+
o = p, (a || (a = {}))[h] = decodeURIComponent(T);
|
|
52
|
+
} else if (s !== c && !(isNaN(c) && Ge(e, t)))
|
|
53
|
+
return null;
|
|
7
54
|
}
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
55
|
+
return oe(e, t) && oe(r, o) ? a || {} : null;
|
|
56
|
+
}
|
|
57
|
+
function Ge(e, t) {
|
|
58
|
+
return e.charCodeAt(t) === 91 && be(e, t + 1);
|
|
59
|
+
}
|
|
60
|
+
function ie(e) {
|
|
61
|
+
const t = e.length;
|
|
62
|
+
return t > 1 && e.charCodeAt(t - 1) === 47 ? t - 1 : t;
|
|
63
|
+
}
|
|
64
|
+
function oe(e, t) {
|
|
65
|
+
const n = e.length;
|
|
66
|
+
return t >= n || t == n - 1 && e.charCodeAt(t) === 47;
|
|
67
|
+
}
|
|
68
|
+
function ae(e) {
|
|
69
|
+
return e.charCodeAt(0) === 47 ? 1 : 0;
|
|
70
|
+
}
|
|
71
|
+
function be(e, t) {
|
|
72
|
+
return e.charCodeAt(t) === 46 && e.charCodeAt(t + 1) === 46 && e.charCodeAt(t + 2) === 46;
|
|
73
|
+
}
|
|
74
|
+
function B(e, t, n, r, o = "") {
|
|
75
|
+
for (; t < n && e.charCodeAt(t) !== r; )
|
|
76
|
+
t++;
|
|
77
|
+
const i = o.length;
|
|
78
|
+
for (let a = 0; a < i; a++)
|
|
79
|
+
if (e.charCodeAt(t - i + a) !== o.charCodeAt(a))
|
|
80
|
+
return -1;
|
|
81
|
+
return t - i;
|
|
82
|
+
}
|
|
83
|
+
function ze(e, t, n, r, o, i, a, s) {
|
|
84
|
+
n.charCodeAt(r) === 47 && r++;
|
|
85
|
+
let c = o;
|
|
86
|
+
const f = t + "/";
|
|
87
|
+
for (; c >= r; ) {
|
|
88
|
+
const l = Re(i, a, s, n, c, o);
|
|
89
|
+
if (l) {
|
|
90
|
+
let h = n.substring(r, Math.min(c, o));
|
|
91
|
+
return h.endsWith(f) && (h = h.substring(0, h.length - f.length)), l[e] = decodeURIComponent(h), l;
|
|
16
92
|
}
|
|
93
|
+
const u = Be(n, r, f, c, r - 1) + f.length;
|
|
94
|
+
if (c === u)
|
|
95
|
+
break;
|
|
96
|
+
c = u;
|
|
17
97
|
}
|
|
18
|
-
return
|
|
98
|
+
return null;
|
|
19
99
|
}
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
if (typeof message === "string") {
|
|
25
|
-
message = escapeHtml(message);
|
|
26
|
-
} else {
|
|
27
|
-
message = "";
|
|
28
|
-
}
|
|
29
|
-
const width = typeof message === "string" ? "600px" : "300px";
|
|
30
|
-
const color = status >= 500 ? COLOR_500 : COLOR_400;
|
|
31
|
-
return `
|
|
32
|
-
<head>
|
|
33
|
-
<meta charset="utf-8">
|
|
34
|
-
<meta http-equiv="Status" content="${status}">
|
|
35
|
-
<title>${status} ${message}</title>
|
|
36
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
37
|
-
<style>
|
|
38
|
-
body { color: ${color}; background-color: #fafafa; padding: 30px; font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif; }
|
|
39
|
-
p { max-width: ${width}; margin: 60px auto 30px auto; background: white; border-radius: 4px; box-shadow: 0px 0px 50px -20px ${color}; overflow: hidden; }
|
|
40
|
-
strong { display: inline-block; padding: 15px; background: ${color}; color: white; }
|
|
41
|
-
span { display: inline-block; padding: 15px; }
|
|
42
|
-
</style>
|
|
43
|
-
</head>
|
|
44
|
-
<body><p><strong>${status}</strong> <span>${message}</span></p></body>
|
|
45
|
-
`;
|
|
100
|
+
function Be(e, t, n, r, o) {
|
|
101
|
+
let i = e.lastIndexOf(n, r);
|
|
102
|
+
return i == r - n.length && (i = e.lastIndexOf(n, r - n.length - 1)), i > t ? i : o;
|
|
46
103
|
}
|
|
47
|
-
var
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
104
|
+
var k = /* @__PURE__ */ ((e) => (e[e.RouteName = 0] = "RouteName", e[e.Loaders = 1] = "Loaders", e[e.OriginalPathname = 2] = "OriginalPathname", e[e.RouteBundleNames = 3] = "RouteBundleNames", e))(k || {}), $ = /* @__PURE__ */ ((e) => (e[e.Pathname = 0] = "Pathname", e[e.MenuLoader = 1] = "MenuLoader", e))($ || {}), L = /* @__PURE__ */ ((e) => (e[e.RouteName = 0] = "RouteName", e[e.Params = 1] = "Params", e[e.Mods = 2] = "Mods", e[e.Menu = 3] = "Menu", e[e.RouteBundleNames = 4] = "RouteBundleNames", e))(L || {});
|
|
105
|
+
const Ae = (e) => e == null ? e : (Object.getOwnPropertyNames(e).forEach((t) => {
|
|
106
|
+
const n = e[t];
|
|
107
|
+
n && typeof n == "object" && !Object.isFrozen(n) && Ae(n);
|
|
108
|
+
}), Object.freeze(e)), Ke = async (e, t, n, r) => {
|
|
109
|
+
if (!Array.isArray(e))
|
|
110
|
+
return null;
|
|
111
|
+
for (const o of e) {
|
|
112
|
+
const i = o[k.RouteName], a = Ee(i, r);
|
|
113
|
+
if (!a)
|
|
114
|
+
continue;
|
|
115
|
+
const s = o[k.Loaders], c = o[k.RouteBundleNames], f = new Array(s.length), l = [];
|
|
116
|
+
s.forEach((y, w) => {
|
|
117
|
+
se(
|
|
118
|
+
y,
|
|
119
|
+
l,
|
|
120
|
+
(R) => f[w] = R,
|
|
121
|
+
n
|
|
122
|
+
);
|
|
123
|
+
});
|
|
124
|
+
const u = Je(t, r);
|
|
125
|
+
let h;
|
|
126
|
+
return se(
|
|
127
|
+
u,
|
|
128
|
+
l,
|
|
129
|
+
(y) => h = y?.default,
|
|
130
|
+
n
|
|
131
|
+
), l.length > 0 && await Promise.all(l), [i, a, f, Ae(h), c];
|
|
132
|
+
}
|
|
133
|
+
return null;
|
|
134
|
+
}, se = (e, t, n, r) => {
|
|
135
|
+
if (typeof e == "function") {
|
|
136
|
+
const o = ne.get(e);
|
|
137
|
+
if (o)
|
|
138
|
+
n(o);
|
|
139
|
+
else {
|
|
140
|
+
const i = e();
|
|
141
|
+
typeof i.then == "function" ? t.push(
|
|
142
|
+
i.then((a) => {
|
|
143
|
+
r !== !1 && ne.set(e, a), n(a);
|
|
144
|
+
})
|
|
145
|
+
) : i && n(i);
|
|
59
146
|
}
|
|
60
|
-
}
|
|
147
|
+
}
|
|
148
|
+
}, Je = (e, t) => {
|
|
149
|
+
if (e) {
|
|
150
|
+
t = t.endsWith("/") ? t : t + "/";
|
|
151
|
+
const n = e.find(
|
|
152
|
+
(r) => r[$.Pathname] === t || t.startsWith(r[$.Pathname] + (t.endsWith("/") ? "" : "/"))
|
|
153
|
+
);
|
|
154
|
+
if (n)
|
|
155
|
+
return n[$.MenuLoader];
|
|
156
|
+
}
|
|
61
157
|
};
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
158
|
+
var V = /* @__PURE__ */ ((e) => (e[e.Continue = 100] = "Continue", e[e.SwitchingProtocols = 101] = "SwitchingProtocols", e[e.Processing = 102] = "Processing", e[e.Ok = 200] = "Ok", e[e.Created = 201] = "Created", e[e.Accepted = 202] = "Accepted", e[e.NonAuthoritativeInformation = 203] = "NonAuthoritativeInformation", e[e.NoContent = 204] = "NoContent", e[e.ResetContent = 205] = "ResetContent", e[e.PartialContent = 206] = "PartialContent", e[e.MultiStatus = 207] = "MultiStatus", e[e.AlreadyReported = 208] = "AlreadyReported", e[e.ImUsed = 226] = "ImUsed", e[e.MultipleChoices = 300] = "MultipleChoices", e[e.MovedPermanently = 301] = "MovedPermanently", e[e.Found = 302] = "Found", e[e.SeeOther = 303] = "SeeOther", e[e.NotModified = 304] = "NotModified", e[e.UseProxy = 305] = "UseProxy", e[e.SwitchProxy = 306] = "SwitchProxy", e[e.TemporaryRedirect = 307] = "TemporaryRedirect", e[e.PermanentRedirect = 308] = "PermanentRedirect", e[e.BadRequest = 400] = "BadRequest", e[e.Unauthorized = 401] = "Unauthorized", e[e.PaymentRequired = 402] = "PaymentRequired", e[e.Forbidden = 403] = "Forbidden", e[e.NotFound = 404] = "NotFound", e[e.MethodNotAllowed = 405] = "MethodNotAllowed", e[e.NotAcceptable = 406] = "NotAcceptable", e[e.ProxyAuthenticationRequired = 407] = "ProxyAuthenticationRequired", e[e.RequestTimeout = 408] = "RequestTimeout", e[e.Conflict = 409] = "Conflict", e[e.Gone = 410] = "Gone", e[e.LengthRequired = 411] = "LengthRequired", e[e.PreconditionFailed = 412] = "PreconditionFailed", e[e.PayloadTooLarge = 413] = "PayloadTooLarge", e[e.UriTooLong = 414] = "UriTooLong", e[e.UnsupportedMediaType = 415] = "UnsupportedMediaType", e[e.RangeNotSatisfiable = 416] = "RangeNotSatisfiable", e[e.ExpectationFailed = 417] = "ExpectationFailed", e[e.IAmATeapot = 418] = "IAmATeapot", e[e.MisdirectedRequest = 421] = "MisdirectedRequest", e[e.UnprocessableEntity = 422] = "UnprocessableEntity", e[e.Locked = 423] = "Locked", e[e.FailedDependency = 424] = "FailedDependency", e[e.UpgradeRequired = 426] = "UpgradeRequired", e[e.PreconditionRequired = 428] = "PreconditionRequired", e[e.TooManyRequests = 429] = "TooManyRequests", e[e.RequestHeaderFieldsTooLarge = 431] = "RequestHeaderFieldsTooLarge", e[e.UnavailableForLegalReasons = 451] = "UnavailableForLegalReasons", e[e.InternalServerError = 500] = "InternalServerError", e[e.NotImplemented = 501] = "NotImplemented", e[e.BadGateway = 502] = "BadGateway", e[e.ServiceUnavailable = 503] = "ServiceUnavailable", e[e.GatewayTimeout = 504] = "GatewayTimeout", e[e.HttpVersionNotSupported = 505] = "HttpVersionNotSupported", e[e.VariantAlsoNegotiates = 506] = "VariantAlsoNegotiates", e[e.InsufficientStorage = 507] = "InsufficientStorage", e[e.LoopDetected = 508] = "LoopDetected", e[e.NotExtended = 510] = "NotExtended", e[e.NetworkAuthenticationRequired = 511] = "NetworkAuthenticationRequired", e))(V || {});
|
|
159
|
+
const Ye = (e) => e && typeof e.then == "function";
|
|
160
|
+
function ve(e) {
|
|
161
|
+
const t = [];
|
|
162
|
+
return e === "day" ? e = 3600 * 24 : e === "week" ? e = 3600 * 24 * 7 : e === "month" ? e = 3600 * 24 * 30 : e === "year" ? e = 3600 * 24 * 365 : e === "private" ? e = {
|
|
163
|
+
private: !0,
|
|
164
|
+
noCache: !0
|
|
165
|
+
} : e === "immutable" ? e = {
|
|
166
|
+
public: !0,
|
|
167
|
+
immutable: !0,
|
|
168
|
+
maxAge: 3600 * 24 * 365
|
|
169
|
+
} : e === "no-cache" && (e = {
|
|
170
|
+
noCache: !0
|
|
171
|
+
}), typeof e == "number" && (e = {
|
|
172
|
+
maxAge: e,
|
|
173
|
+
sMaxAge: e
|
|
174
|
+
}), e.immutable && t.push("immutable"), e.maxAge && t.push(`max-age=${e.maxAge}`), e.sMaxAge && t.push(`s-maxage=${e.sMaxAge}`), e.noStore && t.push("no-store"), e.noCache && t.push("no-cache"), e.private && t.push("private"), e.public && t.push("public"), e.staleWhileRevalidate && t.push(`stale-while-revalidate=${e.staleWhileRevalidate}`), e.staleIfError && t.push(`stale-if-error=${e.staleIfError}`), t.join(", ");
|
|
175
|
+
}
|
|
176
|
+
const Ve = {
|
|
67
177
|
lax: "Lax",
|
|
68
178
|
Lax: "Lax",
|
|
69
179
|
None: "None",
|
|
70
180
|
none: "None",
|
|
71
181
|
strict: "Strict",
|
|
72
182
|
Strict: "Strict"
|
|
73
|
-
}
|
|
74
|
-
var UNIT = {
|
|
183
|
+
}, Xe = {
|
|
75
184
|
seconds: 1,
|
|
76
|
-
minutes:
|
|
77
|
-
hours:
|
|
78
|
-
days:
|
|
79
|
-
weeks:
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
if (typeof options.maxAge === "number") {
|
|
87
|
-
c.push(`Max-Age=${options.maxAge}`);
|
|
88
|
-
} else if (Array.isArray(options.maxAge)) {
|
|
89
|
-
c.push(`Max-Age=${options.maxAge[0] * UNIT[options.maxAge[1]]}`);
|
|
90
|
-
} else if (typeof options.expires === "number" || typeof options.expires == "string") {
|
|
91
|
-
c.push(`Expires=${options.expires}`);
|
|
92
|
-
} else if (options.expires instanceof Date) {
|
|
93
|
-
c.push(`Expires=${options.expires.toUTCString()}`);
|
|
94
|
-
}
|
|
95
|
-
if (options.httpOnly) {
|
|
96
|
-
c.push("HttpOnly");
|
|
97
|
-
}
|
|
98
|
-
if (typeof options.path === "string") {
|
|
99
|
-
c.push(`Path=${options.path}`);
|
|
100
|
-
}
|
|
101
|
-
const sameSite = resolveSameSite(options.sameSite);
|
|
102
|
-
if (sameSite) {
|
|
103
|
-
c.push(`SameSite=${sameSite}`);
|
|
104
|
-
}
|
|
105
|
-
if (options.secure) {
|
|
106
|
-
c.push("Secure");
|
|
107
|
-
}
|
|
108
|
-
return c.join("; ");
|
|
185
|
+
minutes: 60,
|
|
186
|
+
hours: 3600,
|
|
187
|
+
days: 3600 * 24,
|
|
188
|
+
weeks: 3600 * 24 * 7
|
|
189
|
+
}, ce = (e, t, n) => {
|
|
190
|
+
const r = [`${e}=${t}`];
|
|
191
|
+
typeof n.domain == "string" && r.push(`Domain=${n.domain}`), typeof n.maxAge == "number" ? r.push(`Max-Age=${n.maxAge}`) : Array.isArray(n.maxAge) ? r.push(`Max-Age=${n.maxAge[0] * Xe[n.maxAge[1]]}`) : typeof n.expires == "number" || typeof n.expires == "string" ? r.push(`Expires=${n.expires}`) : n.expires instanceof Date && r.push(`Expires=${n.expires.toUTCString()}`), n.httpOnly && r.push("HttpOnly"), typeof n.path == "string" && r.push(`Path=${n.path}`);
|
|
192
|
+
const o = He(n.sameSite);
|
|
193
|
+
return o && r.push(`SameSite=${o}`), n.secure && r.push("Secure"), r.join("; ");
|
|
109
194
|
};
|
|
110
|
-
function
|
|
195
|
+
function le(e) {
|
|
111
196
|
try {
|
|
112
|
-
return decodeURIComponent(
|
|
197
|
+
return decodeURIComponent(e);
|
|
113
198
|
} catch {
|
|
114
|
-
return
|
|
199
|
+
return e;
|
|
115
200
|
}
|
|
116
201
|
}
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
if (typeof
|
|
120
|
-
const
|
|
121
|
-
for (const
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
cookie[tryDecodeUriComponent(cookieSegment.slice(0, separatorIndex).trim())] = tryDecodeUriComponent(cookieSegment.slice(separatorIndex + 1).trim());
|
|
125
|
-
}
|
|
202
|
+
const Ze = (e) => {
|
|
203
|
+
const t = {};
|
|
204
|
+
if (typeof e == "string" && e !== "") {
|
|
205
|
+
const n = e.split(";");
|
|
206
|
+
for (const r of n) {
|
|
207
|
+
const o = r.indexOf("=");
|
|
208
|
+
o !== -1 && (t[le(r.slice(0, o).trim())] = le(r.slice(o + 1).trim()));
|
|
126
209
|
}
|
|
127
210
|
}
|
|
128
|
-
return
|
|
211
|
+
return t;
|
|
129
212
|
};
|
|
130
|
-
function
|
|
131
|
-
if (
|
|
213
|
+
function He(e) {
|
|
214
|
+
if (e === !0)
|
|
132
215
|
return "Strict";
|
|
133
|
-
|
|
134
|
-
if (sameSite === false) {
|
|
216
|
+
if (e === !1)
|
|
135
217
|
return "None";
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
return SAMESITE[sameSite];
|
|
139
|
-
}
|
|
140
|
-
return void 0;
|
|
218
|
+
if (e)
|
|
219
|
+
return Ve[e];
|
|
141
220
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
[
|
|
147
|
-
[RES_COOKIE] = {};
|
|
148
|
-
[LIVE_COOKIE] = {};
|
|
221
|
+
const x = Symbol("request-cookies"), q = Symbol("response-cookies"), _ = Symbol("live-cookies");
|
|
222
|
+
class en {
|
|
223
|
+
[x];
|
|
224
|
+
[q] = {};
|
|
225
|
+
[_] = {};
|
|
149
226
|
appendCounter = 0;
|
|
150
|
-
constructor(
|
|
151
|
-
this[
|
|
152
|
-
this[LIVE_COOKIE] = { ...this[REQ_COOKIE] };
|
|
227
|
+
constructor(t) {
|
|
228
|
+
this[x] = Ze(t), this[_] = { ...this[x] };
|
|
153
229
|
}
|
|
154
|
-
get(
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
return {
|
|
160
|
-
value,
|
|
230
|
+
get(t, n = !0) {
|
|
231
|
+
const r = this[n ? _ : x][t];
|
|
232
|
+
return r ? {
|
|
233
|
+
value: r,
|
|
161
234
|
json() {
|
|
162
|
-
return JSON.parse(
|
|
235
|
+
return JSON.parse(r);
|
|
163
236
|
},
|
|
164
237
|
number() {
|
|
165
|
-
return Number(
|
|
238
|
+
return Number(r);
|
|
166
239
|
}
|
|
167
|
-
};
|
|
240
|
+
} : null;
|
|
168
241
|
}
|
|
169
|
-
getAll(
|
|
170
|
-
return Object.keys(this[
|
|
171
|
-
(
|
|
172
|
-
cookies[cookieName] = this.get(cookieName);
|
|
173
|
-
return cookies;
|
|
174
|
-
},
|
|
242
|
+
getAll(t = !0) {
|
|
243
|
+
return Object.keys(this[t ? _ : x]).reduce(
|
|
244
|
+
(n, r) => (n[r] = this.get(r), n),
|
|
175
245
|
{}
|
|
176
246
|
);
|
|
177
247
|
}
|
|
178
|
-
has(
|
|
179
|
-
return !!this[
|
|
180
|
-
}
|
|
181
|
-
set(
|
|
182
|
-
this[
|
|
183
|
-
const
|
|
184
|
-
this[
|
|
185
|
-
}
|
|
186
|
-
append(
|
|
187
|
-
this[
|
|
188
|
-
const
|
|
189
|
-
this[
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
248
|
+
has(t, n = !0) {
|
|
249
|
+
return !!this[n ? _ : x][t];
|
|
250
|
+
}
|
|
251
|
+
set(t, n, r = {}) {
|
|
252
|
+
this[_][t] = typeof n == "string" ? n : JSON.stringify(n);
|
|
253
|
+
const o = typeof n == "string" ? n : encodeURIComponent(JSON.stringify(n));
|
|
254
|
+
this[q][t] = ce(t, o, r);
|
|
255
|
+
}
|
|
256
|
+
append(t, n, r = {}) {
|
|
257
|
+
this[_][t] = typeof n == "string" ? n : JSON.stringify(n);
|
|
258
|
+
const o = typeof n == "string" ? n : encodeURIComponent(JSON.stringify(n));
|
|
259
|
+
this[q][++this.appendCounter] = ce(
|
|
260
|
+
t,
|
|
261
|
+
o,
|
|
262
|
+
r
|
|
193
263
|
);
|
|
194
264
|
}
|
|
195
|
-
delete(
|
|
196
|
-
this.set(
|
|
197
|
-
this[LIVE_COOKIE][name] = null;
|
|
265
|
+
delete(t, n) {
|
|
266
|
+
this.set(t, "deleted", { ...n, maxAge: 0 }), this[_][t] = null;
|
|
198
267
|
}
|
|
199
268
|
headers() {
|
|
200
|
-
return Object.values(this[
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
var mergeHeadersCookies = (headers, cookies) => {
|
|
204
|
-
const cookieHeaders = cookies.headers();
|
|
205
|
-
if (cookieHeaders.length > 0) {
|
|
206
|
-
const newHeaders = new Headers(headers);
|
|
207
|
-
for (const cookie of cookieHeaders) {
|
|
208
|
-
newHeaders.append("Set-Cookie", cookie);
|
|
209
|
-
}
|
|
210
|
-
return newHeaders;
|
|
211
|
-
}
|
|
212
|
-
return headers;
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
// packages/qwik-router/src/middleware/request-handler/redirect-handler.ts
|
|
216
|
-
var AbortMessage = class {
|
|
217
|
-
};
|
|
218
|
-
var RedirectMessage = class extends AbortMessage {
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
// packages/qwik-router/src/middleware/request-handler/rewrite-handler.ts
|
|
222
|
-
var RewriteMessage = class extends AbortMessage {
|
|
223
|
-
constructor(pathname) {
|
|
224
|
-
super();
|
|
225
|
-
this.pathname = pathname;
|
|
269
|
+
return Object.values(this[q]);
|
|
226
270
|
}
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
// packages/qwik-router/src/runtime/src/constants.ts
|
|
230
|
-
var MODULE_CACHE = /* @__PURE__ */ new WeakMap();
|
|
231
|
-
var QACTION_KEY = "qaction";
|
|
232
|
-
var QFN_KEY = "qfunc";
|
|
233
|
-
var QDATA_KEY = "qdata";
|
|
234
|
-
|
|
235
|
-
// packages/qwik-router/src/runtime/src/route-matcher.ts
|
|
236
|
-
function matchRoute(route, path) {
|
|
237
|
-
const routeIdx = startIdxSkipSlash(route);
|
|
238
|
-
const routeLength = lengthNoTrailingSlash(route);
|
|
239
|
-
const pathIdx = startIdxSkipSlash(path);
|
|
240
|
-
const pathLength = lengthNoTrailingSlash(path);
|
|
241
|
-
return matchRoutePart(route, routeIdx, routeLength, path, pathIdx, pathLength);
|
|
242
271
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
const
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
const paramName = route.substring(paramNameStart, paramNameEnd);
|
|
253
|
-
const paramSuffixEnd = scan(route, paramNameEnd + 1, routeLength, 47 /* SLASH */);
|
|
254
|
-
const suffix = route.substring(paramNameEnd + 1, paramSuffixEnd);
|
|
255
|
-
routeIdx = paramNameEnd + 1;
|
|
256
|
-
const paramValueStart = pathIdx - 1;
|
|
257
|
-
if (isMany) {
|
|
258
|
-
const match = recursiveScan(
|
|
259
|
-
paramName,
|
|
260
|
-
suffix,
|
|
261
|
-
path,
|
|
262
|
-
paramValueStart,
|
|
263
|
-
pathLength,
|
|
264
|
-
route,
|
|
265
|
-
routeIdx + suffix.length + 1,
|
|
266
|
-
routeLength
|
|
267
|
-
);
|
|
268
|
-
if (match) {
|
|
269
|
-
return Object.assign(params || (params = {}), match);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
const paramValueEnd = scan(path, paramValueStart, pathLength, 47 /* SLASH */, suffix);
|
|
273
|
-
if (paramValueEnd == -1) {
|
|
274
|
-
return null;
|
|
275
|
-
}
|
|
276
|
-
const paramValue = path.substring(paramValueStart, paramValueEnd);
|
|
277
|
-
if (!isMany && !suffix && !paramValue) {
|
|
278
|
-
return null;
|
|
279
|
-
}
|
|
280
|
-
pathIdx = paramValueEnd;
|
|
281
|
-
(params || (params = {}))[paramName] = decodeURIComponent(paramValue);
|
|
282
|
-
} else if (routeCh !== pathCh) {
|
|
283
|
-
if (!(isNaN(pathCh) && isRestParameter(route, routeIdx))) {
|
|
284
|
-
return null;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
if (allConsumed(route, routeIdx) && allConsumed(path, pathIdx)) {
|
|
289
|
-
return params || {};
|
|
290
|
-
} else {
|
|
291
|
-
return null;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
function isRestParameter(text, idx) {
|
|
295
|
-
return text.charCodeAt(idx) === 91 /* OPEN_BRACKET */ && isThreeDots(text, idx + 1);
|
|
296
|
-
}
|
|
297
|
-
function lengthNoTrailingSlash(text) {
|
|
298
|
-
const length = text.length;
|
|
299
|
-
return length > 1 && text.charCodeAt(length - 1) === 47 /* SLASH */ ? length - 1 : length;
|
|
300
|
-
}
|
|
301
|
-
function allConsumed(text, idx) {
|
|
302
|
-
const length = text.length;
|
|
303
|
-
return idx >= length || idx == length - 1 && text.charCodeAt(idx) === 47 /* SLASH */;
|
|
304
|
-
}
|
|
305
|
-
function startIdxSkipSlash(text) {
|
|
306
|
-
return text.charCodeAt(0) === 47 /* SLASH */ ? 1 : 0;
|
|
307
|
-
}
|
|
308
|
-
function isThreeDots(text, idx) {
|
|
309
|
-
return text.charCodeAt(idx) === 46 /* DOT */ && text.charCodeAt(idx + 1) === 46 /* DOT */ && text.charCodeAt(idx + 2) === 46 /* DOT */;
|
|
310
|
-
}
|
|
311
|
-
function scan(text, idx, end, ch, suffix = "") {
|
|
312
|
-
while (idx < end && text.charCodeAt(idx) !== ch) {
|
|
313
|
-
idx++;
|
|
314
|
-
}
|
|
315
|
-
const suffixLength = suffix.length;
|
|
316
|
-
for (let i = 0; i < suffixLength; i++) {
|
|
317
|
-
if (text.charCodeAt(idx - suffixLength + i) !== suffix.charCodeAt(i)) {
|
|
318
|
-
return -1;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
return idx - suffixLength;
|
|
322
|
-
}
|
|
323
|
-
function recursiveScan(paramName, suffix, path, pathStart, pathLength, route, routeStart, routeLength) {
|
|
324
|
-
if (path.charCodeAt(pathStart) === 47 /* SLASH */) {
|
|
325
|
-
pathStart++;
|
|
326
|
-
}
|
|
327
|
-
let pathIdx = pathLength;
|
|
328
|
-
const sep = suffix + "/";
|
|
329
|
-
while (pathIdx >= pathStart) {
|
|
330
|
-
const match = matchRoutePart(route, routeStart, routeLength, path, pathIdx, pathLength);
|
|
331
|
-
if (match) {
|
|
332
|
-
let value = path.substring(pathStart, Math.min(pathIdx, pathLength));
|
|
333
|
-
if (value.endsWith(sep)) {
|
|
334
|
-
value = value.substring(0, value.length - sep.length);
|
|
335
|
-
}
|
|
336
|
-
match[paramName] = decodeURIComponent(value);
|
|
337
|
-
return match;
|
|
338
|
-
}
|
|
339
|
-
const newPathIdx = lastIndexOf(path, pathStart, sep, pathIdx, pathStart - 1) + sep.length;
|
|
340
|
-
if (pathIdx === newPathIdx) {
|
|
341
|
-
break;
|
|
342
|
-
}
|
|
343
|
-
pathIdx = newPathIdx;
|
|
344
|
-
}
|
|
345
|
-
return null;
|
|
346
|
-
}
|
|
347
|
-
function lastIndexOf(text, start, match, searchIdx, notFoundIdx) {
|
|
348
|
-
let idx = text.lastIndexOf(match, searchIdx);
|
|
349
|
-
if (idx == searchIdx - match.length) {
|
|
350
|
-
idx = text.lastIndexOf(match, searchIdx - match.length - 1);
|
|
351
|
-
}
|
|
352
|
-
return idx > start ? idx : notFoundIdx;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
// packages/qwik-router/src/runtime/src/utils.ts
|
|
356
|
-
var isPromise = (value) => {
|
|
357
|
-
return value && typeof value.then === "function";
|
|
358
|
-
};
|
|
359
|
-
var deepFreeze = (obj) => {
|
|
360
|
-
if (obj == null) {
|
|
361
|
-
return obj;
|
|
362
|
-
}
|
|
363
|
-
Object.getOwnPropertyNames(obj).forEach((prop) => {
|
|
364
|
-
const value = obj[prop];
|
|
365
|
-
if (value && typeof value === "object" && !Object.isFrozen(value)) {
|
|
366
|
-
deepFreeze(value);
|
|
367
|
-
}
|
|
368
|
-
});
|
|
369
|
-
return Object.freeze(obj);
|
|
370
|
-
};
|
|
371
|
-
|
|
372
|
-
// packages/qwik-router/src/runtime/src/routing.ts
|
|
373
|
-
var loadRoute = async (routes, menus, cacheModules, pathname) => {
|
|
374
|
-
if (!Array.isArray(routes)) {
|
|
375
|
-
return null;
|
|
376
|
-
}
|
|
377
|
-
for (const routeData of routes) {
|
|
378
|
-
const routeName = routeData[0];
|
|
379
|
-
const params = matchRoute(routeName, pathname);
|
|
380
|
-
if (!params) {
|
|
381
|
-
continue;
|
|
382
|
-
}
|
|
383
|
-
const loaders = routeData[1];
|
|
384
|
-
const routeBundleNames = routeData[3];
|
|
385
|
-
const modules = new Array(loaders.length);
|
|
386
|
-
const pendingLoads = [];
|
|
387
|
-
loaders.forEach((moduleLoader, i) => {
|
|
388
|
-
loadModule(
|
|
389
|
-
moduleLoader,
|
|
390
|
-
pendingLoads,
|
|
391
|
-
(routeModule) => modules[i] = routeModule,
|
|
392
|
-
cacheModules
|
|
393
|
-
);
|
|
394
|
-
});
|
|
395
|
-
const menuLoader = getMenuLoader(menus, pathname);
|
|
396
|
-
let menu = void 0;
|
|
397
|
-
loadModule(
|
|
398
|
-
menuLoader,
|
|
399
|
-
pendingLoads,
|
|
400
|
-
(menuModule) => menu = menuModule == null ? void 0 : menuModule.default,
|
|
401
|
-
cacheModules
|
|
402
|
-
);
|
|
403
|
-
if (pendingLoads.length > 0) {
|
|
404
|
-
await Promise.all(pendingLoads);
|
|
405
|
-
}
|
|
406
|
-
return [routeName, params, modules, deepFreeze(menu), routeBundleNames];
|
|
407
|
-
}
|
|
408
|
-
return null;
|
|
409
|
-
};
|
|
410
|
-
var loadModule = (moduleLoader, pendingLoads, moduleSetter, cacheModules) => {
|
|
411
|
-
if (typeof moduleLoader === "function") {
|
|
412
|
-
const loadedModule = MODULE_CACHE.get(moduleLoader);
|
|
413
|
-
if (loadedModule) {
|
|
414
|
-
moduleSetter(loadedModule);
|
|
415
|
-
} else {
|
|
416
|
-
const moduleOrPromise = moduleLoader();
|
|
417
|
-
if (typeof moduleOrPromise.then === "function") {
|
|
418
|
-
pendingLoads.push(
|
|
419
|
-
moduleOrPromise.then((loadedModule2) => {
|
|
420
|
-
if (cacheModules !== false) {
|
|
421
|
-
MODULE_CACHE.set(moduleLoader, loadedModule2);
|
|
422
|
-
}
|
|
423
|
-
moduleSetter(loadedModule2);
|
|
424
|
-
})
|
|
425
|
-
);
|
|
426
|
-
} else if (moduleOrPromise) {
|
|
427
|
-
moduleSetter(moduleOrPromise);
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
}
|
|
272
|
+
const Un = (e, t) => {
|
|
273
|
+
const n = t.headers();
|
|
274
|
+
if (n.length > 0) {
|
|
275
|
+
const r = new Headers(e);
|
|
276
|
+
for (const o of n)
|
|
277
|
+
r.append("Set-Cookie", o);
|
|
278
|
+
return r;
|
|
279
|
+
}
|
|
280
|
+
return e;
|
|
431
281
|
};
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
cacheControl = 60 * 60 * 24 * 365;
|
|
455
|
-
} else if (cacheControl === "private") {
|
|
456
|
-
cacheControl = {
|
|
457
|
-
private: true,
|
|
458
|
-
noCache: true
|
|
459
|
-
};
|
|
460
|
-
} else if (cacheControl === "immutable") {
|
|
461
|
-
cacheControl = {
|
|
462
|
-
public: true,
|
|
463
|
-
immutable: true,
|
|
464
|
-
maxAge: 60 * 60 * 24 * 365
|
|
465
|
-
};
|
|
466
|
-
} else if (cacheControl === "no-cache") {
|
|
467
|
-
cacheControl = {
|
|
468
|
-
noCache: true
|
|
469
|
-
};
|
|
470
|
-
}
|
|
471
|
-
if (typeof cacheControl === "number") {
|
|
472
|
-
cacheControl = {
|
|
473
|
-
maxAge: cacheControl,
|
|
474
|
-
sMaxAge: cacheControl
|
|
475
|
-
};
|
|
476
|
-
}
|
|
477
|
-
if (cacheControl.immutable) {
|
|
478
|
-
controls.push("immutable");
|
|
479
|
-
}
|
|
480
|
-
if (cacheControl.maxAge) {
|
|
481
|
-
controls.push(`max-age=${cacheControl.maxAge}`);
|
|
482
|
-
}
|
|
483
|
-
if (cacheControl.sMaxAge) {
|
|
484
|
-
controls.push(`s-maxage=${cacheControl.sMaxAge}`);
|
|
485
|
-
}
|
|
486
|
-
if (cacheControl.noStore) {
|
|
487
|
-
controls.push("no-store");
|
|
488
|
-
}
|
|
489
|
-
if (cacheControl.noCache) {
|
|
490
|
-
controls.push("no-cache");
|
|
491
|
-
}
|
|
492
|
-
if (cacheControl.private) {
|
|
493
|
-
controls.push("private");
|
|
494
|
-
}
|
|
495
|
-
if (cacheControl.public) {
|
|
496
|
-
controls.push("public");
|
|
497
|
-
}
|
|
498
|
-
if (cacheControl.staleWhileRevalidate) {
|
|
499
|
-
controls.push(`stale-while-revalidate=${cacheControl.staleWhileRevalidate}`);
|
|
500
|
-
}
|
|
501
|
-
if (cacheControl.staleIfError) {
|
|
502
|
-
controls.push(`stale-if-error=${cacheControl.staleIfError}`);
|
|
503
|
-
}
|
|
504
|
-
return controls.join(", ");
|
|
282
|
+
function K(e, t) {
|
|
283
|
+
let n = "Server Error";
|
|
284
|
+
return t != null && (typeof t.message == "string" ? n = t.message : n = String(t)), "<html>" + _e(e, n) + "</html>";
|
|
285
|
+
}
|
|
286
|
+
function _e(e, t) {
|
|
287
|
+
typeof e != "number" && (e = 500), typeof t == "string" ? t = tn(t) : t = "";
|
|
288
|
+
const n = typeof t == "string" ? "600px" : "300px", r = e >= 500 ? on : rn;
|
|
289
|
+
return `
|
|
290
|
+
<head>
|
|
291
|
+
<meta charset="utf-8">
|
|
292
|
+
<meta http-equiv="Status" content="${e}">
|
|
293
|
+
<title>${e} ${t}</title>
|
|
294
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
295
|
+
<style>
|
|
296
|
+
body { color: ${r}; background-color: #fafafa; padding: 30px; font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif; }
|
|
297
|
+
p { max-width: ${n}; margin: 60px auto 30px auto; background: white; border-radius: 4px; box-shadow: 0px 0px 50px -20px ${r}; overflow: hidden; }
|
|
298
|
+
strong { display: inline-block; padding: 15px; background: ${r}; color: white; }
|
|
299
|
+
span { display: inline-block; padding: 15px; }
|
|
300
|
+
</style>
|
|
301
|
+
</head>
|
|
302
|
+
<body><p><strong>${e}</strong> <span>${t}</span></p></body>
|
|
303
|
+
`;
|
|
505
304
|
}
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
305
|
+
const nn = /[&<>]/g, tn = (e) => e.replace(nn, (t) => {
|
|
306
|
+
switch (t) {
|
|
307
|
+
case "&":
|
|
308
|
+
return "&";
|
|
309
|
+
case "<":
|
|
310
|
+
return "<";
|
|
311
|
+
case ">":
|
|
312
|
+
return ">";
|
|
313
|
+
default:
|
|
314
|
+
return "";
|
|
315
|
+
}
|
|
316
|
+
}), rn = "#006ce9", on = "#713fc2";
|
|
317
|
+
let S;
|
|
318
|
+
import("node:async_hooks").then((e) => {
|
|
319
|
+
const t = e.AsyncLocalStorage;
|
|
320
|
+
S = new t(), globalThis.qcAsyncRequestStore = S;
|
|
321
|
+
}).catch((e) => {
|
|
514
322
|
console.warn(
|
|
515
323
|
"AsyncLocalStorage not available, continuing without it. This might impact concurrent server calls.",
|
|
516
|
-
|
|
324
|
+
e
|
|
517
325
|
);
|
|
518
326
|
});
|
|
519
|
-
function
|
|
520
|
-
let
|
|
521
|
-
const
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
basePathname,
|
|
528
|
-
qwikSerializer,
|
|
529
|
-
resolve
|
|
327
|
+
function an(e, t, n, r, o = "/") {
|
|
328
|
+
let i;
|
|
329
|
+
const a = new Promise((c) => i = c), s = cn(
|
|
330
|
+
e,
|
|
331
|
+
t,
|
|
332
|
+
n,
|
|
333
|
+
o,
|
|
334
|
+
i
|
|
530
335
|
);
|
|
531
336
|
return {
|
|
532
|
-
response:
|
|
533
|
-
requestEv,
|
|
534
|
-
completion:
|
|
337
|
+
response: a,
|
|
338
|
+
requestEv: s,
|
|
339
|
+
completion: S ? S.run(s, de, s, r, i) : de(s, r, i)
|
|
535
340
|
};
|
|
536
341
|
}
|
|
537
|
-
async function
|
|
538
|
-
|
|
539
|
-
|
|
342
|
+
async function de(e, t, n) {
|
|
343
|
+
try {
|
|
344
|
+
((a) => new URL(a.pathname + a.search, a))(e.originalUrl);
|
|
345
|
+
} catch {
|
|
346
|
+
const a = "Resource Not Found";
|
|
347
|
+
e.status(404);
|
|
348
|
+
const s = K(404, a);
|
|
349
|
+
return e.html(404, s), new F(404, a);
|
|
350
|
+
}
|
|
351
|
+
let r = 1;
|
|
352
|
+
async function o() {
|
|
540
353
|
try {
|
|
541
|
-
await
|
|
542
|
-
} catch (
|
|
543
|
-
if (
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
const
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
const qwikSerializer = requestEv[RequestEvQwikSerializer];
|
|
562
|
-
requestEv.headers.set("Content-Type", "application/qwik-json");
|
|
563
|
-
requestEv.send(status, await qwikSerializer._serialize([e.data]));
|
|
564
|
-
} else {
|
|
565
|
-
const html = getErrorHtml(e.status, e.data);
|
|
566
|
-
requestEv.html(status, html);
|
|
354
|
+
await e.next();
|
|
355
|
+
} catch (i) {
|
|
356
|
+
if (i instanceof H)
|
|
357
|
+
await e.getWritableStream().close();
|
|
358
|
+
else if (i instanceof we) {
|
|
359
|
+
if (r > 50)
|
|
360
|
+
throw new Error("Infinite rewrite loop");
|
|
361
|
+
r += 1;
|
|
362
|
+
const a = new URL(e.url);
|
|
363
|
+
a.pathname = i.pathname;
|
|
364
|
+
const { loadedRoute: s, requestHandlers: c } = await t(a);
|
|
365
|
+
return e.resetRoute(s, c, a), await o();
|
|
366
|
+
} else if (i instanceof F) {
|
|
367
|
+
if (!e.headersSent) {
|
|
368
|
+
const a = i.status, s = e.request.headers.get("Accept");
|
|
369
|
+
if (s && !s.includes("text/html"))
|
|
370
|
+
e.headers.set("Content-Type", "application/qwik-json"), e.send(a, await D([i.data]));
|
|
371
|
+
else {
|
|
372
|
+
const c = K(i.status, i.data);
|
|
373
|
+
e.html(a, c);
|
|
567
374
|
}
|
|
568
375
|
}
|
|
569
|
-
} else if (!(
|
|
570
|
-
if (
|
|
376
|
+
} else if (!(i instanceof pe)) {
|
|
377
|
+
if (P(e) !== "dev")
|
|
571
378
|
try {
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
const stream = requestEv.getWritableStream();
|
|
578
|
-
if (!stream.locked) {
|
|
579
|
-
const writer = stream.getWriter();
|
|
580
|
-
await writer.write(encoder.encode(minimalHtmlResponse(500, "Internal Server Error")));
|
|
581
|
-
await writer.close();
|
|
379
|
+
e.headersSent || (e.headers.set("content-type", "text/html; charset=utf-8"), e.cacheControl({ noCache: !0 }), e.status(500));
|
|
380
|
+
const a = e.getWritableStream();
|
|
381
|
+
if (!a.locked) {
|
|
382
|
+
const s = a.getWriter();
|
|
383
|
+
await s.write(E.encode(K(500, "Internal Server Error"))), await s.close();
|
|
582
384
|
}
|
|
583
385
|
} catch {
|
|
584
386
|
console.error("Unable to render error page");
|
|
585
387
|
}
|
|
586
|
-
|
|
587
|
-
return e;
|
|
388
|
+
return i;
|
|
588
389
|
}
|
|
589
390
|
}
|
|
590
|
-
return void 0;
|
|
591
391
|
}
|
|
592
392
|
try {
|
|
593
|
-
return await
|
|
393
|
+
return await o();
|
|
594
394
|
} finally {
|
|
595
|
-
|
|
596
|
-
resolve(null);
|
|
597
|
-
}
|
|
395
|
+
e.isDirty() || n(null);
|
|
598
396
|
}
|
|
599
397
|
}
|
|
600
|
-
function
|
|
601
|
-
if (
|
|
602
|
-
const
|
|
603
|
-
|
|
604
|
-
if (pathname === "") {
|
|
605
|
-
pathname = "/";
|
|
606
|
-
}
|
|
398
|
+
function fe(e) {
|
|
399
|
+
if (e.endsWith(C)) {
|
|
400
|
+
const t = e.length - Te + (globalThis.__NO_TRAILING_SLASH__ ? 0 : 1);
|
|
401
|
+
e = e.slice(0, t), e === "" && (e = "/");
|
|
607
402
|
}
|
|
608
|
-
return
|
|
403
|
+
return e;
|
|
609
404
|
}
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
var RequestEvSharedActionId = "@actionId";
|
|
622
|
-
var RequestEvSharedActionFormData = "@actionFormData";
|
|
623
|
-
var RequestEvSharedNonce = "@nonce";
|
|
624
|
-
var RequestEvIsRewrite = "@rewrite";
|
|
625
|
-
function createRequestEvent(serverRequestEv, loadedRoute, requestHandlers, trailingSlash, basePathname, qwikSerializer, resolved) {
|
|
626
|
-
const { request, platform, env } = serverRequestEv;
|
|
627
|
-
const sharedMap = /* @__PURE__ */ new Map();
|
|
628
|
-
const cookie = new Cookie(request.headers.get("cookie"));
|
|
629
|
-
const headers = new Headers();
|
|
630
|
-
const url = new URL(request.url);
|
|
631
|
-
if (url.pathname.endsWith(QDATA_JSON)) {
|
|
632
|
-
url.pathname = url.pathname.slice(0, -QDATA_JSON_LEN);
|
|
633
|
-
if (trailingSlash && !url.pathname.endsWith("/")) {
|
|
634
|
-
url.pathname += "/";
|
|
405
|
+
const O = "@isQData", C = "/q-data.json", Te = C.length, Me = Symbol("RequestEvLoaders"), Ne = Symbol("RequestEvMode"), xe = Symbol("RequestEvRoute"), Ce = Symbol(
|
|
406
|
+
"RequestEvLoaderSerializationStrategyMap"
|
|
407
|
+
), Pe = "@routeName", j = "@actionId", Ie = "@actionFormData", sn = "@nonce", Le = "@rewrite", X = "@serverTiming", Oe = "qData";
|
|
408
|
+
function cn(e, t, n, r, o) {
|
|
409
|
+
const { request: i, platform: a, env: s } = e, c = /* @__PURE__ */ new Map(), f = new en(i.headers.get("cookie")), l = new Headers(), u = new URL(i.url);
|
|
410
|
+
u.pathname.endsWith(C) && (u.pathname = u.pathname.slice(0, -Te), !globalThis.__NO_TRAILING_SLASH__ && !u.pathname.endsWith("/") && (u.pathname += "/"), c.set(O, !0));
|
|
411
|
+
let h = -1, y = null, w, R = e.locale, p = 200;
|
|
412
|
+
const T = async () => {
|
|
413
|
+
for (h++; h < n.length; ) {
|
|
414
|
+
const d = n[h], m = globalThis.qcAsyncRequestStore, g = m?.run ? m.run(b, d, b) : d(b);
|
|
415
|
+
Ye(g) && await g, h++;
|
|
635
416
|
}
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
let requestData = void 0;
|
|
641
|
-
let locale = serverRequestEv.locale;
|
|
642
|
-
let status = 200;
|
|
643
|
-
const next = async () => {
|
|
644
|
-
routeModuleIndex++;
|
|
645
|
-
while (routeModuleIndex < requestHandlers.length) {
|
|
646
|
-
const moduleRequestHandler = requestHandlers[routeModuleIndex];
|
|
647
|
-
const asyncStore2 = globalThis.qcAsyncRequestStore;
|
|
648
|
-
const result = (asyncStore2 == null ? void 0 : asyncStore2.run) ? asyncStore2.run(requestEv, moduleRequestHandler, requestEv) : moduleRequestHandler(requestEv);
|
|
649
|
-
if (isPromise(result)) {
|
|
650
|
-
await result;
|
|
651
|
-
}
|
|
652
|
-
routeModuleIndex++;
|
|
653
|
-
}
|
|
654
|
-
};
|
|
655
|
-
const resetRoute = (_loadedRoute, _requestHandlers, _url = url) => {
|
|
656
|
-
loadedRoute = _loadedRoute;
|
|
657
|
-
requestHandlers = _requestHandlers;
|
|
658
|
-
url.pathname = _url.pathname;
|
|
659
|
-
url.search = _url.search;
|
|
660
|
-
routeModuleIndex = -1;
|
|
661
|
-
};
|
|
662
|
-
const check = () => {
|
|
663
|
-
if (writableStream !== null) {
|
|
417
|
+
}, M = (d, m, g = u) => {
|
|
418
|
+
t = d, n = m, u.pathname = g.pathname, u.search = g.search, h = -1;
|
|
419
|
+
}, N = () => {
|
|
420
|
+
if (y !== null)
|
|
664
421
|
throw new Error("Response already sent");
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
cookie.set(key, value);
|
|
691
|
-
});
|
|
692
|
-
if (statusOrResponse.body) {
|
|
693
|
-
const writableStream2 = requestEv.getWritableStream();
|
|
694
|
-
statusOrResponse.body.pipeTo(writableStream2);
|
|
695
|
-
} else {
|
|
696
|
-
requestEv.getWritableStream().getWriter().close();
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
return exit();
|
|
700
|
-
};
|
|
701
|
-
const exit = () => {
|
|
702
|
-
routeModuleIndex = ABORT_INDEX;
|
|
703
|
-
return new AbortMessage();
|
|
704
|
-
};
|
|
705
|
-
const loaders = {};
|
|
706
|
-
const requestEv = {
|
|
707
|
-
[RequestEvLoaders]: loaders,
|
|
708
|
-
[RequestEvMode]: serverRequestEv.mode,
|
|
709
|
-
[RequestEvTrailingSlash]: trailingSlash,
|
|
710
|
-
get [RequestEvRoute]() {
|
|
711
|
-
return loadedRoute;
|
|
422
|
+
}, W = (d, m) => {
|
|
423
|
+
if (N(), typeof d == "number") {
|
|
424
|
+
p = d;
|
|
425
|
+
const A = b.getWritableStream().getWriter();
|
|
426
|
+
A.write(typeof m == "string" ? E.encode(m) : m), A.close();
|
|
427
|
+
} else if (p = d.status, d.headers.forEach((g, A) => {
|
|
428
|
+
A.toLowerCase() !== "set-cookie" && l.append(A, g);
|
|
429
|
+
}), d.headers.getSetCookie().forEach((g) => {
|
|
430
|
+
const A = g.indexOf("=");
|
|
431
|
+
if (A === -1)
|
|
432
|
+
return;
|
|
433
|
+
const De = g.slice(0, A).trim(), Fe = g.slice(A + 1).trim();
|
|
434
|
+
f.set(De, Fe);
|
|
435
|
+
}), d.body) {
|
|
436
|
+
const g = b.getWritableStream();
|
|
437
|
+
d.body.pipeTo(g);
|
|
438
|
+
} else
|
|
439
|
+
b.getWritableStream().getWriter().close();
|
|
440
|
+
return z();
|
|
441
|
+
}, z = () => (h = ue, new pe()), I = {}, b = {
|
|
442
|
+
[Me]: I,
|
|
443
|
+
[Ce]: /* @__PURE__ */ new Map(),
|
|
444
|
+
[Ne]: e.mode,
|
|
445
|
+
get [xe]() {
|
|
446
|
+
return t;
|
|
712
447
|
},
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
originalUrl: new URL(url),
|
|
448
|
+
cookie: f,
|
|
449
|
+
headers: l,
|
|
450
|
+
env: s,
|
|
451
|
+
method: i.method,
|
|
452
|
+
signal: i.signal,
|
|
453
|
+
originalUrl: new URL(u),
|
|
720
454
|
get params() {
|
|
721
|
-
return
|
|
455
|
+
return t?.[L.Params] ?? {};
|
|
722
456
|
},
|
|
723
457
|
get pathname() {
|
|
724
|
-
return
|
|
458
|
+
return u.pathname;
|
|
725
459
|
},
|
|
726
|
-
platform,
|
|
460
|
+
platform: a,
|
|
727
461
|
get query() {
|
|
728
|
-
return
|
|
462
|
+
return u.searchParams;
|
|
729
463
|
},
|
|
730
|
-
request,
|
|
731
|
-
url,
|
|
732
|
-
basePathname,
|
|
733
|
-
sharedMap,
|
|
464
|
+
request: i,
|
|
465
|
+
url: u,
|
|
466
|
+
basePathname: r,
|
|
467
|
+
sharedMap: c,
|
|
734
468
|
get headersSent() {
|
|
735
|
-
return
|
|
469
|
+
return y !== null;
|
|
736
470
|
},
|
|
737
471
|
get exited() {
|
|
738
|
-
return
|
|
472
|
+
return h >= ue;
|
|
739
473
|
},
|
|
740
474
|
get clientConn() {
|
|
741
|
-
return
|
|
475
|
+
return e.getClientConn();
|
|
742
476
|
},
|
|
743
|
-
next,
|
|
744
|
-
resetRoute,
|
|
745
|
-
exit,
|
|
746
|
-
cacheControl: (
|
|
747
|
-
|
|
748
|
-
headers.set(target, createCacheControl(cacheControl));
|
|
477
|
+
next: T,
|
|
478
|
+
resetRoute: M,
|
|
479
|
+
exit: z,
|
|
480
|
+
cacheControl: (d, m = "Cache-Control") => {
|
|
481
|
+
N(), l.set(m, ve(d));
|
|
749
482
|
},
|
|
750
|
-
resolveValue: async (
|
|
751
|
-
const
|
|
752
|
-
if (
|
|
753
|
-
if (!(
|
|
483
|
+
resolveValue: (async (d) => {
|
|
484
|
+
const m = d.__id;
|
|
485
|
+
if (d.__brand === "server_loader") {
|
|
486
|
+
if (!(m in I))
|
|
754
487
|
throw new Error(
|
|
755
488
|
"You can not get the returned data of a loader that has not been executed for this request."
|
|
756
489
|
);
|
|
490
|
+
if (I[m] === ye) {
|
|
491
|
+
const g = P(b) === "dev";
|
|
492
|
+
await We(d, I, b, g);
|
|
757
493
|
}
|
|
758
494
|
}
|
|
759
|
-
return
|
|
760
|
-
},
|
|
761
|
-
status: (
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
},
|
|
769
|
-
locale: (_locale) => {
|
|
770
|
-
if (typeof _locale === "string") {
|
|
771
|
-
locale = _locale;
|
|
772
|
-
}
|
|
773
|
-
return locale || "";
|
|
774
|
-
},
|
|
775
|
-
error: (statusCode, message) => {
|
|
776
|
-
status = statusCode;
|
|
777
|
-
return new ServerError(statusCode, message);
|
|
778
|
-
},
|
|
779
|
-
redirect: (statusCode, url2) => {
|
|
780
|
-
check();
|
|
781
|
-
status = statusCode;
|
|
782
|
-
if (url2) {
|
|
783
|
-
const fixedURL = url2.replace(/([^:])\/{2,}/g, "$1/");
|
|
784
|
-
if (url2 !== fixedURL) {
|
|
785
|
-
console.warn(`Redirect URL ${url2} is invalid, fixing to ${fixedURL}`);
|
|
786
|
-
}
|
|
787
|
-
headers.set("Location", fixedURL);
|
|
788
|
-
}
|
|
789
|
-
if (statusCode > 301 && !headers.get("Cache-Control")) {
|
|
790
|
-
headers.set("Cache-Control", "no-store");
|
|
495
|
+
return I[m];
|
|
496
|
+
}),
|
|
497
|
+
status: (d) => typeof d == "number" ? (N(), p = d, d) : p,
|
|
498
|
+
locale: (d) => (typeof d == "string" && (R = d), R || ""),
|
|
499
|
+
error: (d, m) => (p = d, l.delete("Cache-Control"), new F(d, m)),
|
|
500
|
+
redirect: (d, m) => {
|
|
501
|
+
if (N(), p = d, m) {
|
|
502
|
+
const g = m.replace(/([^:])\/{2,}/g, "$1/");
|
|
503
|
+
m !== g && console.warn(`Redirect URL ${m} is invalid, fixing to ${g}`), l.set("Location", g);
|
|
791
504
|
}
|
|
792
|
-
|
|
793
|
-
return new RedirectMessage();
|
|
505
|
+
return l.delete("Cache-Control"), d > 301 && l.set("Cache-Control", "no-store"), z(), new H();
|
|
794
506
|
},
|
|
795
|
-
rewrite: (
|
|
796
|
-
|
|
797
|
-
if (pathname.startsWith("http")) {
|
|
507
|
+
rewrite: (d) => {
|
|
508
|
+
if (N(), d.startsWith("http"))
|
|
798
509
|
throw new Error("Rewrite does not support absolute urls");
|
|
799
|
-
|
|
800
|
-
sharedMap.set(RequestEvIsRewrite, true);
|
|
801
|
-
return new RewriteMessage(pathname.replace(/\/+/g, "/"));
|
|
802
|
-
},
|
|
803
|
-
defer: (returnData) => {
|
|
804
|
-
return typeof returnData === "function" ? returnData : () => returnData;
|
|
805
|
-
},
|
|
806
|
-
fail: (statusCode, data) => {
|
|
807
|
-
check();
|
|
808
|
-
status = statusCode;
|
|
809
|
-
return {
|
|
810
|
-
failed: true,
|
|
811
|
-
...data
|
|
812
|
-
};
|
|
813
|
-
},
|
|
814
|
-
text: (statusCode, text) => {
|
|
815
|
-
headers.set("Content-Type", "text/plain; charset=utf-8");
|
|
816
|
-
return send(statusCode, text);
|
|
817
|
-
},
|
|
818
|
-
html: (statusCode, html) => {
|
|
819
|
-
headers.set("Content-Type", "text/html; charset=utf-8");
|
|
820
|
-
return send(statusCode, html);
|
|
821
|
-
},
|
|
822
|
-
parseBody: async () => {
|
|
823
|
-
if (requestData !== void 0) {
|
|
824
|
-
return requestData;
|
|
825
|
-
}
|
|
826
|
-
return requestData = parseRequest(requestEv, sharedMap, qwikSerializer);
|
|
827
|
-
},
|
|
828
|
-
json: (statusCode, data) => {
|
|
829
|
-
headers.set("Content-Type", "application/json; charset=utf-8");
|
|
830
|
-
return send(statusCode, JSON.stringify(data));
|
|
831
|
-
},
|
|
832
|
-
send,
|
|
833
|
-
isDirty: () => {
|
|
834
|
-
return writableStream !== null;
|
|
510
|
+
return c.set(Le, !0), new we(d.replace(/\/+/g, "/"));
|
|
835
511
|
},
|
|
512
|
+
defer: (d) => typeof d == "function" ? d : () => d,
|
|
513
|
+
fail: (d, m) => (N(), p = d, l.delete("Cache-Control"), {
|
|
514
|
+
failed: !0,
|
|
515
|
+
...m
|
|
516
|
+
}),
|
|
517
|
+
text: (d, m) => (l.set("Content-Type", "text/plain; charset=utf-8"), W(d, m)),
|
|
518
|
+
html: (d, m) => (l.set("Content-Type", "text/html; charset=utf-8"), W(d, m)),
|
|
519
|
+
parseBody: async () => w !== void 0 ? w : w = dn(b, c),
|
|
520
|
+
json: (d, m) => (l.set("Content-Type", "application/json; charset=utf-8"), W(d, JSON.stringify(m))),
|
|
521
|
+
send: W,
|
|
522
|
+
isDirty: () => y !== null,
|
|
836
523
|
getWritableStream: () => {
|
|
837
|
-
if (
|
|
838
|
-
if (
|
|
839
|
-
const
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
524
|
+
if (y === null) {
|
|
525
|
+
if (e.mode === "dev") {
|
|
526
|
+
const d = c.get(X);
|
|
527
|
+
d && l.set(
|
|
528
|
+
"Server-Timing",
|
|
529
|
+
d.map(([m, g]) => `${m};dur=${g}`).join(",")
|
|
530
|
+
);
|
|
843
531
|
}
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
532
|
+
y = e.getWritableStream(
|
|
533
|
+
p,
|
|
534
|
+
l,
|
|
535
|
+
f,
|
|
536
|
+
o,
|
|
537
|
+
b
|
|
850
538
|
);
|
|
851
539
|
}
|
|
852
|
-
return
|
|
540
|
+
return y;
|
|
853
541
|
}
|
|
854
542
|
};
|
|
855
|
-
return Object.freeze(
|
|
543
|
+
return Object.freeze(b);
|
|
856
544
|
}
|
|
857
|
-
function
|
|
858
|
-
return
|
|
545
|
+
function U(e) {
|
|
546
|
+
return e[Me];
|
|
859
547
|
}
|
|
860
|
-
function
|
|
861
|
-
return
|
|
548
|
+
function Ue(e) {
|
|
549
|
+
return e[Ce];
|
|
862
550
|
}
|
|
863
|
-
function
|
|
864
|
-
return
|
|
551
|
+
function ln(e) {
|
|
552
|
+
return e[xe];
|
|
865
553
|
}
|
|
866
|
-
function
|
|
867
|
-
return
|
|
554
|
+
function P(e) {
|
|
555
|
+
return e[Ne];
|
|
868
556
|
}
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
return qwikSerializer._deserialize(decodeURIComponent(data));
|
|
886
|
-
} catch {
|
|
887
|
-
}
|
|
557
|
+
const ue = Number.MAX_SAFE_INTEGER, dn = async ({ request: e, method: t, query: n }, r) => {
|
|
558
|
+
const o = e.headers.get("content-type")?.split(/[;,]/, 1)[0].trim() ?? "";
|
|
559
|
+
if (o === "application/x-www-form-urlencoded" || o === "multipart/form-data") {
|
|
560
|
+
const i = await e.formData();
|
|
561
|
+
return r.set(Ie, i), fn(i);
|
|
562
|
+
} else {
|
|
563
|
+
if (o === "application/json")
|
|
564
|
+
return await e.json();
|
|
565
|
+
if (o === "application/qwik-json") {
|
|
566
|
+
if (t === "GET" && n.has(re)) {
|
|
567
|
+
const i = n.get(re);
|
|
568
|
+
if (i)
|
|
569
|
+
try {
|
|
570
|
+
return ee(decodeURIComponent(i));
|
|
571
|
+
} catch {
|
|
572
|
+
}
|
|
888
573
|
}
|
|
574
|
+
return ee(await e.text());
|
|
889
575
|
}
|
|
890
|
-
return qwikSerializer._deserialize(await request.text());
|
|
891
|
-
}
|
|
892
|
-
return void 0;
|
|
893
|
-
};
|
|
894
|
-
var formToObj = (formData) => {
|
|
895
|
-
const values = [...formData.entries()].reduce((values2, [name, value]) => {
|
|
896
|
-
name.split(".").reduce((object, key, index, keys) => {
|
|
897
|
-
if (key.endsWith("[]")) {
|
|
898
|
-
const arrayKey = key.slice(0, -2);
|
|
899
|
-
object[arrayKey] = object[arrayKey] || [];
|
|
900
|
-
return object[arrayKey] = [...object[arrayKey], value];
|
|
901
|
-
}
|
|
902
|
-
if (index < keys.length - 1) {
|
|
903
|
-
return object[key] = object[key] || (Number.isNaN(+keys[index + 1]) ? {} : []);
|
|
904
|
-
}
|
|
905
|
-
return object[key] = value;
|
|
906
|
-
}, values2);
|
|
907
|
-
return values2;
|
|
908
|
-
}, {});
|
|
909
|
-
return values;
|
|
910
|
-
};
|
|
911
|
-
|
|
912
|
-
// packages/qwik-router/src/middleware/request-handler/response-page.ts
|
|
913
|
-
function getQwikRouterServerData(requestEv) {
|
|
914
|
-
const { params, request, status, locale, originalUrl } = requestEv;
|
|
915
|
-
const requestHeaders = {};
|
|
916
|
-
request.headers.forEach((value, key) => requestHeaders[key] = value);
|
|
917
|
-
const action = requestEv.sharedMap.get(RequestEvSharedActionId);
|
|
918
|
-
const formData = requestEv.sharedMap.get(RequestEvSharedActionFormData);
|
|
919
|
-
const routeName = requestEv.sharedMap.get(RequestRouteName);
|
|
920
|
-
const nonce = requestEv.sharedMap.get(RequestEvSharedNonce);
|
|
921
|
-
const headers = requestEv.request.headers;
|
|
922
|
-
const reconstructedUrl = new URL(originalUrl.pathname + originalUrl.search, originalUrl);
|
|
923
|
-
const host = headers.get("X-Forwarded-Host");
|
|
924
|
-
const protocol = headers.get("X-Forwarded-Proto");
|
|
925
|
-
if (host) {
|
|
926
|
-
reconstructedUrl.port = "";
|
|
927
|
-
reconstructedUrl.host = host;
|
|
928
|
-
}
|
|
929
|
-
if (protocol) {
|
|
930
|
-
reconstructedUrl.protocol = protocol;
|
|
931
576
|
}
|
|
577
|
+
}, fn = (e) => [...e.entries()].reduce((n, [r, o]) => (r.split(".").reduce((i, a, s, c) => {
|
|
578
|
+
if (a.endsWith("[]")) {
|
|
579
|
+
const f = a.slice(0, -2);
|
|
580
|
+
return i[f] = i[f] || [], i[f] = [...i[f], o];
|
|
581
|
+
}
|
|
582
|
+
return s < c.length - 1 ? i[a] = i[a] || (Number.isNaN(+c[s + 1]) ? {} : []) : i[a] = o;
|
|
583
|
+
}, n), n), {});
|
|
584
|
+
function un(e) {
|
|
585
|
+
const { params: t, request: n, status: r, locale: o, originalUrl: i } = e, a = {};
|
|
586
|
+
n.headers.forEach((T, M) => a[M] = T);
|
|
587
|
+
const s = e.sharedMap.get(j), c = e.sharedMap.get(Ie), f = e.sharedMap.get(Pe), l = e.sharedMap.get(sn), u = e.request.headers, h = new URL(i.pathname + i.search, i), y = u.get("X-Forwarded-Host"), w = u.get("X-Forwarded-Proto");
|
|
588
|
+
y && (h.port = "", h.host = y), w && (h.protocol = w);
|
|
589
|
+
const R = U(e), p = Ue(e);
|
|
932
590
|
return {
|
|
933
|
-
url:
|
|
934
|
-
requestHeaders,
|
|
935
|
-
locale:
|
|
936
|
-
nonce,
|
|
591
|
+
url: h.href,
|
|
592
|
+
requestHeaders: a,
|
|
593
|
+
locale: o(),
|
|
594
|
+
nonce: l,
|
|
937
595
|
containerAttributes: {
|
|
938
|
-
|
|
596
|
+
[je]: f
|
|
939
597
|
},
|
|
940
598
|
qwikrouter: {
|
|
941
|
-
routeName,
|
|
942
|
-
ev:
|
|
943
|
-
params: { ...
|
|
944
|
-
loadedRoute:
|
|
599
|
+
routeName: f,
|
|
600
|
+
ev: e,
|
|
601
|
+
params: { ...t },
|
|
602
|
+
loadedRoute: ln(e),
|
|
945
603
|
response: {
|
|
946
|
-
status:
|
|
947
|
-
loaders:
|
|
948
|
-
|
|
949
|
-
|
|
604
|
+
status: r(),
|
|
605
|
+
loaders: R,
|
|
606
|
+
loadersSerializationStrategy: p,
|
|
607
|
+
action: s,
|
|
608
|
+
formData: c
|
|
950
609
|
}
|
|
951
610
|
}
|
|
952
611
|
};
|
|
953
612
|
}
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
requestHandlers.push(handleRedirect);
|
|
985
|
-
_resolveRequestHandlers(
|
|
986
|
-
routeLoaders,
|
|
987
|
-
routeActions,
|
|
988
|
-
requestHandlers,
|
|
989
|
-
routeModules,
|
|
990
|
-
isPageRoute,
|
|
991
|
-
method
|
|
992
|
-
);
|
|
993
|
-
if (isPageRoute) {
|
|
994
|
-
requestHandlers.push((ev) => {
|
|
995
|
-
ev.sharedMap.set(RequestRouteName, routeName);
|
|
996
|
-
});
|
|
997
|
-
requestHandlers.push(actionsMiddleware(routeActions, routeLoaders));
|
|
998
|
-
requestHandlers.push(renderHandler);
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
return requestHandlers;
|
|
1002
|
-
};
|
|
1003
|
-
var _resolveRequestHandlers = (routeLoaders, routeActions, requestHandlers, routeModules, collectActions, method) => {
|
|
1004
|
-
for (const routeModule of routeModules) {
|
|
1005
|
-
if (typeof routeModule.onRequest === "function") {
|
|
1006
|
-
requestHandlers.push(routeModule.onRequest);
|
|
1007
|
-
} else if (Array.isArray(routeModule.onRequest)) {
|
|
1008
|
-
requestHandlers.push(...routeModule.onRequest);
|
|
1009
|
-
}
|
|
1010
|
-
let methodReqHandler;
|
|
1011
|
-
switch (method) {
|
|
613
|
+
const hn = (e, t, n, r, o) => {
|
|
614
|
+
const i = [], a = [], s = [], c = !!(t && bn(t[L.Mods]));
|
|
615
|
+
if (e && he(
|
|
616
|
+
i,
|
|
617
|
+
a,
|
|
618
|
+
s,
|
|
619
|
+
e,
|
|
620
|
+
c,
|
|
621
|
+
n
|
|
622
|
+
), t) {
|
|
623
|
+
const f = t[L.RouteName];
|
|
624
|
+
r && (n === "POST" || n === "PUT" || n === "PATCH" || n === "DELETE") && (r === "lax-proto" ? s.unshift(An) : s.unshift(_n)), c && ((n === "POST" || n === "GET") && s.push(wn), s.push(pn), s.push(Nn));
|
|
625
|
+
const l = t[L.Mods];
|
|
626
|
+
s.push(Mn), he(
|
|
627
|
+
i,
|
|
628
|
+
a,
|
|
629
|
+
s,
|
|
630
|
+
l,
|
|
631
|
+
c,
|
|
632
|
+
n
|
|
633
|
+
), c && (s.push((u) => {
|
|
634
|
+
u.sharedMap.set(Pe, f);
|
|
635
|
+
}), s.push(mn(a)), s.push(gn(i)), s.push(o));
|
|
636
|
+
}
|
|
637
|
+
return s;
|
|
638
|
+
}, he = (e, t, n, r, o, i) => {
|
|
639
|
+
for (const a of r) {
|
|
640
|
+
typeof a.onRequest == "function" ? n.push(a.onRequest) : Array.isArray(a.onRequest) && n.push(...a.onRequest);
|
|
641
|
+
let s;
|
|
642
|
+
switch (i) {
|
|
1012
643
|
case "GET": {
|
|
1013
|
-
|
|
644
|
+
s = a.onGet;
|
|
1014
645
|
break;
|
|
1015
646
|
}
|
|
1016
647
|
case "POST": {
|
|
1017
|
-
|
|
648
|
+
s = a.onPost;
|
|
1018
649
|
break;
|
|
1019
650
|
}
|
|
1020
651
|
case "PUT": {
|
|
1021
|
-
|
|
652
|
+
s = a.onPut;
|
|
1022
653
|
break;
|
|
1023
654
|
}
|
|
1024
655
|
case "PATCH": {
|
|
1025
|
-
|
|
656
|
+
s = a.onPatch;
|
|
1026
657
|
break;
|
|
1027
658
|
}
|
|
1028
659
|
case "DELETE": {
|
|
1029
|
-
|
|
660
|
+
s = a.onDelete;
|
|
1030
661
|
break;
|
|
1031
662
|
}
|
|
1032
663
|
case "OPTIONS": {
|
|
1033
|
-
|
|
664
|
+
s = a.onOptions;
|
|
1034
665
|
break;
|
|
1035
666
|
}
|
|
1036
667
|
case "HEAD": {
|
|
1037
|
-
|
|
668
|
+
s = a.onHead;
|
|
1038
669
|
break;
|
|
1039
670
|
}
|
|
1040
671
|
}
|
|
1041
|
-
if (typeof
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
requestHandlers.push(...methodReqHandler);
|
|
1045
|
-
}
|
|
1046
|
-
if (collectActions) {
|
|
1047
|
-
for (const module of Object.values(routeModule)) {
|
|
1048
|
-
if (typeof module === "function") {
|
|
1049
|
-
if (module.__brand === "server_loader") {
|
|
1050
|
-
routeLoaders.push(module);
|
|
1051
|
-
} else if (module.__brand === "server_action") {
|
|
1052
|
-
routeActions.push(module);
|
|
1053
|
-
}
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
672
|
+
if (typeof s == "function" ? n.push(s) : Array.isArray(s) && n.push(...s), o)
|
|
673
|
+
for (const c of Object.values(a))
|
|
674
|
+
typeof c == "function" && (c.__brand === "server_loader" ? e.push(c) : c.__brand === "server_action" && t.push(c));
|
|
1057
675
|
}
|
|
1058
676
|
};
|
|
1059
|
-
function
|
|
1060
|
-
return async (
|
|
1061
|
-
|
|
1062
|
-
|
|
677
|
+
function mn(e) {
|
|
678
|
+
return async (t) => {
|
|
679
|
+
const n = t;
|
|
680
|
+
if (n.headersSent) {
|
|
681
|
+
n.exit();
|
|
1063
682
|
return;
|
|
1064
683
|
}
|
|
1065
|
-
const { method } =
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
)
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
const selectedActionId = requestEv.query.get(QACTION_KEY);
|
|
1078
|
-
if (selectedActionId) {
|
|
1079
|
-
const serverActionsMap = globalThis._qwikActionsMap;
|
|
1080
|
-
const action = routeActions.find((action2) => action2.__id === selectedActionId) ?? (serverActionsMap == null ? void 0 : serverActionsMap.get(selectedActionId));
|
|
1081
|
-
if (action) {
|
|
1082
|
-
requestEv.sharedMap.set(RequestEvSharedActionId, selectedActionId);
|
|
1083
|
-
const data = await requestEv.parseBody();
|
|
1084
|
-
if (!data || typeof data !== "object") {
|
|
684
|
+
const { method: r } = n, o = U(n), i = P(n) === "dev";
|
|
685
|
+
if (i && r === "GET" && n.query.has(te) && console.warn(
|
|
686
|
+
`Seems like you are submitting a Qwik Action via GET request. Qwik Actions should be submitted via POST request.
|
|
687
|
+
Make sure your <form> has method="POST" attribute, like this: <form method="POST">`
|
|
688
|
+
), r === "POST") {
|
|
689
|
+
const a = n.query.get(te);
|
|
690
|
+
if (a) {
|
|
691
|
+
const s = globalThis._qwikActionsMap, c = e.find((f) => f.__id === a) ?? s?.get(a);
|
|
692
|
+
if (c) {
|
|
693
|
+
n.sharedMap.set(j, a);
|
|
694
|
+
const f = await n.parseBody();
|
|
695
|
+
if (!f || typeof f != "object")
|
|
1085
696
|
throw new Error(
|
|
1086
|
-
`Expected request data for the action id ${
|
|
697
|
+
`Expected request data for the action id ${a} to be an object`
|
|
1087
698
|
);
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
if (isDev) {
|
|
1099
|
-
verifySerializable(qwikSerializer, actionResolved, action.__qrl);
|
|
1100
|
-
}
|
|
1101
|
-
loaders[selectedActionId] = actionResolved;
|
|
699
|
+
const l = await qe(n, c.__validators, f, i);
|
|
700
|
+
if (!l.success)
|
|
701
|
+
o[a] = n.fail(l.status ?? 500, l.error);
|
|
702
|
+
else {
|
|
703
|
+
const u = i ? await G(
|
|
704
|
+
n,
|
|
705
|
+
c.__qrl.getHash(),
|
|
706
|
+
() => c.__qrl.call(n, l.data, n)
|
|
707
|
+
) : await c.__qrl.call(n, l.data, n);
|
|
708
|
+
i && Q(u, c.__qrl), o[a] = u;
|
|
1102
709
|
}
|
|
1103
710
|
}
|
|
1104
711
|
}
|
|
1105
712
|
}
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
}
|
|
1129
|
-
}).then((resolvedLoader) => {
|
|
1130
|
-
if (typeof resolvedLoader === "function") {
|
|
1131
|
-
loaders[loaderId] = resolvedLoader();
|
|
1132
|
-
} else {
|
|
1133
|
-
if (isDev) {
|
|
1134
|
-
verifySerializable(qwikSerializer, resolvedLoader, loader.__qrl);
|
|
1135
|
-
}
|
|
1136
|
-
loaders[loaderId] = resolvedLoader;
|
|
1137
|
-
}
|
|
1138
|
-
return resolvedLoader;
|
|
1139
|
-
});
|
|
1140
|
-
return loaders[loaderId];
|
|
1141
|
-
});
|
|
1142
|
-
await Promise.all(resolvedLoadersPromises);
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
function gn(e) {
|
|
716
|
+
return async (t) => {
|
|
717
|
+
const n = t;
|
|
718
|
+
if (n.headersSent) {
|
|
719
|
+
n.exit();
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
const r = U(n), o = P(n) === "dev";
|
|
723
|
+
if (e.length > 0) {
|
|
724
|
+
let i = [];
|
|
725
|
+
if (n.query.has(v)) {
|
|
726
|
+
const s = n.query.getAll(v);
|
|
727
|
+
for (const c of e)
|
|
728
|
+
s.includes(c.__id) ? i.push(c) : r[c.__id] = ye;
|
|
729
|
+
} else
|
|
730
|
+
i = e;
|
|
731
|
+
const a = i.map(
|
|
732
|
+
(s) => We(s, r, n, o)
|
|
733
|
+
);
|
|
734
|
+
await Promise.all(a);
|
|
1143
735
|
}
|
|
1144
736
|
};
|
|
1145
737
|
}
|
|
1146
|
-
async function
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
738
|
+
async function We(e, t, n, r) {
|
|
739
|
+
const o = e.__id;
|
|
740
|
+
return t[o] = qe(
|
|
741
|
+
n,
|
|
742
|
+
e.__validators,
|
|
743
|
+
void 0,
|
|
744
|
+
// data
|
|
745
|
+
r
|
|
746
|
+
).then((a) => a.success ? r ? G(
|
|
747
|
+
n,
|
|
748
|
+
e.__qrl.getHash(),
|
|
749
|
+
() => e.__qrl.call(n, n)
|
|
750
|
+
) : e.__qrl.call(n, n) : n.fail(a.status ?? 500, a.error)).then((a) => (typeof a == "function" ? t[o] = a() : (r && Q(a, e.__qrl), t[o] = a), a)), Ue(n).set(o, e.__serializationStrategy), t[o];
|
|
751
|
+
}
|
|
752
|
+
async function qe(e, t, n, r) {
|
|
753
|
+
let o = {
|
|
754
|
+
success: !0,
|
|
755
|
+
data: n
|
|
1150
756
|
};
|
|
1151
|
-
if (
|
|
1152
|
-
for (const
|
|
1153
|
-
if (
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
if (!lastResult.success) {
|
|
1163
|
-
return lastResult;
|
|
1164
|
-
} else {
|
|
1165
|
-
data = lastResult.data;
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
|
-
return lastResult;
|
|
757
|
+
if (t)
|
|
758
|
+
for (const i of t)
|
|
759
|
+
if (r ? o = await G(
|
|
760
|
+
e,
|
|
761
|
+
"validator$",
|
|
762
|
+
() => i.validate(e, n)
|
|
763
|
+
) : o = await i.validate(e, n), o.success)
|
|
764
|
+
n = o.data;
|
|
765
|
+
else
|
|
766
|
+
return o;
|
|
767
|
+
return o;
|
|
1170
768
|
}
|
|
1171
|
-
function
|
|
1172
|
-
return
|
|
769
|
+
function yn(e) {
|
|
770
|
+
return e ? typeof e == "object" && Symbol.asyncIterator in e : !1;
|
|
1173
771
|
}
|
|
1174
|
-
async function
|
|
1175
|
-
const
|
|
1176
|
-
if (
|
|
1177
|
-
|
|
1178
|
-
const
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
if (isQrl(qrl) && qrl.getHash() === fn) {
|
|
1184
|
-
let result;
|
|
772
|
+
async function wn(e) {
|
|
773
|
+
const t = e.query.get(Qe);
|
|
774
|
+
if (t && e.request.headers.get("X-QRL") === t && e.request.headers.get("Content-Type") === "application/qwik-json") {
|
|
775
|
+
e.exit();
|
|
776
|
+
const n = P(e) === "dev", r = await e.parseBody();
|
|
777
|
+
if (Array.isArray(r)) {
|
|
778
|
+
const [o, ...i] = r;
|
|
779
|
+
if (Rn(o) && o.getHash() === t) {
|
|
780
|
+
let a;
|
|
1185
781
|
try {
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
result = await qrl.apply(ev, args);
|
|
1194
|
-
}
|
|
1195
|
-
} catch (err) {
|
|
1196
|
-
if (err instanceof ServerError) {
|
|
1197
|
-
throw ev.error(err.status, err.data);
|
|
1198
|
-
}
|
|
1199
|
-
throw ev.error(500, "Invalid request");
|
|
782
|
+
n ? a = await G(
|
|
783
|
+
e,
|
|
784
|
+
`server_${o.getSymbol()}`,
|
|
785
|
+
() => o.apply(e, i)
|
|
786
|
+
) : a = await o.apply(e, i);
|
|
787
|
+
} catch (s) {
|
|
788
|
+
throw s instanceof F ? e.error(s.status, s.data) : e.error(500, "Invalid request");
|
|
1200
789
|
}
|
|
1201
|
-
if (
|
|
1202
|
-
|
|
1203
|
-
const
|
|
1204
|
-
const
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
}
|
|
1209
|
-
const message = await qwikSerializer._serialize([item]);
|
|
1210
|
-
if (ev.signal.aborted) {
|
|
790
|
+
if (yn(a)) {
|
|
791
|
+
e.headers.set("Content-Type", "text/qwik-json-stream");
|
|
792
|
+
const c = e.getWritableStream().getWriter();
|
|
793
|
+
for await (const f of a) {
|
|
794
|
+
n && Q(f, o);
|
|
795
|
+
const l = await D([f]);
|
|
796
|
+
if (e.signal.aborted)
|
|
1211
797
|
break;
|
|
1212
|
-
}
|
|
1213
|
-
await stream.write(encoder.encode(`${message}
|
|
798
|
+
await c.write(E.encode(`${l}
|
|
1214
799
|
`));
|
|
1215
800
|
}
|
|
1216
|
-
|
|
801
|
+
c.close();
|
|
1217
802
|
} else {
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
ev.send(200, message);
|
|
803
|
+
Q(a, o), e.headers.set("Content-Type", "application/qwik-json");
|
|
804
|
+
const s = await D([a]);
|
|
805
|
+
e.send(200, s);
|
|
1222
806
|
}
|
|
1223
807
|
return;
|
|
1224
808
|
}
|
|
1225
809
|
}
|
|
1226
|
-
throw
|
|
810
|
+
throw e.error(500, "Invalid request");
|
|
1227
811
|
}
|
|
1228
812
|
}
|
|
1229
|
-
function
|
|
1230
|
-
const
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
throw ev.redirect(301 /* MovedPermanently */, pathname + "/" + search);
|
|
1238
|
-
}
|
|
1239
|
-
} else {
|
|
1240
|
-
if (pathname.endsWith("/")) {
|
|
1241
|
-
throw ev.redirect(
|
|
1242
|
-
301 /* MovedPermanently */,
|
|
1243
|
-
pathname.slice(0, pathname.length - 1) + search
|
|
813
|
+
function pn(e) {
|
|
814
|
+
const { basePathname: t, originalUrl: n, sharedMap: r } = e, { pathname: o, search: i } = n;
|
|
815
|
+
if (!r.has(O) && o !== t && !o.endsWith(".html")) {
|
|
816
|
+
if (globalThis.__NO_TRAILING_SLASH__) {
|
|
817
|
+
if (o.endsWith("/"))
|
|
818
|
+
throw e.redirect(
|
|
819
|
+
V.MovedPermanently,
|
|
820
|
+
o.slice(0, o.length - 1) + i
|
|
1244
821
|
);
|
|
1245
|
-
|
|
1246
|
-
|
|
822
|
+
} else if (!o.endsWith("/"))
|
|
823
|
+
throw e.redirect(V.MovedPermanently, o + "/" + i);
|
|
1247
824
|
}
|
|
1248
825
|
}
|
|
1249
|
-
function
|
|
826
|
+
function Q(e, t) {
|
|
1250
827
|
try {
|
|
1251
|
-
|
|
1252
|
-
} catch (
|
|
1253
|
-
|
|
1254
|
-
e.loc = qrl.dev;
|
|
1255
|
-
}
|
|
1256
|
-
throw e;
|
|
828
|
+
Se(e, void 0);
|
|
829
|
+
} catch (n) {
|
|
830
|
+
throw n instanceof Error && t.dev && (n.loc = t.dev), n;
|
|
1257
831
|
}
|
|
1258
832
|
}
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
const lastRouteModule = routeModules[routeModules.length - 1];
|
|
1264
|
-
return lastRouteModule && typeof lastRouteModule.default === "function";
|
|
833
|
+
const Rn = (e) => typeof e == "function" && typeof e.getSymbol == "function";
|
|
834
|
+
function bn(e) {
|
|
835
|
+
const t = e[e.length - 1];
|
|
836
|
+
return t && typeof t.default == "function";
|
|
1265
837
|
}
|
|
1266
|
-
function
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
}
|
|
1275
|
-
} else {
|
|
1276
|
-
if (url.pathname.endsWith("/")) {
|
|
1277
|
-
url.pathname = url.pathname.slice(0, -1);
|
|
1278
|
-
}
|
|
1279
|
-
}
|
|
1280
|
-
const search = url.search.slice(1).replaceAll(/&?q(action|data|func)=[^&]+/g, "");
|
|
1281
|
-
return `${url.pathname}${search ? `?${search}` : ""}${url.hash}`;
|
|
838
|
+
function Z(e) {
|
|
839
|
+
e = new URL(e), e.pathname.endsWith(C) && (e.pathname = e.pathname.slice(0, -C.length)), globalThis.__NO_TRAILING_SLASH__ ? e.pathname.endsWith("/") && (e.pathname = e.pathname.slice(0, -1)) : e.pathname.endsWith("/") || (e.pathname += "/");
|
|
840
|
+
const t = e.search.slice(1).replaceAll(/&?q(action|data|func|loaders)=[^&]+/g, "");
|
|
841
|
+
return `${e.pathname}${t ? `?${t}` : ""}${e.hash}`;
|
|
842
|
+
}
|
|
843
|
+
const E = /* @__PURE__ */ new TextEncoder();
|
|
844
|
+
function An(e) {
|
|
845
|
+
ke(e, "lax-proto");
|
|
1282
846
|
}
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
847
|
+
function _n(e) {
|
|
848
|
+
ke(e);
|
|
849
|
+
}
|
|
850
|
+
function ke(e, t) {
|
|
851
|
+
if (Cn(
|
|
852
|
+
e.request.headers,
|
|
1287
853
|
"application/x-www-form-urlencoded",
|
|
1288
854
|
"multipart/form-data",
|
|
1289
855
|
"text/plain"
|
|
1290
|
-
)
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
if (forbidden) {
|
|
1296
|
-
throw requestEv.error(
|
|
856
|
+
)) {
|
|
857
|
+
const r = e.request.headers.get("origin"), o = e.url.origin;
|
|
858
|
+
let i = r !== o;
|
|
859
|
+
if (i && t && r?.replace(/^http(s)?/g, "") === o.replace(/^http(s)?/g, "") && (i = !1), i)
|
|
860
|
+
throw e.error(
|
|
1297
861
|
403,
|
|
1298
|
-
`CSRF check failed. Cross-site ${
|
|
1299
|
-
The request origin "${
|
|
862
|
+
`CSRF check failed. Cross-site ${e.method} form submissions are forbidden.
|
|
863
|
+
The request origin "${r}" does not match the server origin "${o}".`
|
|
1300
864
|
);
|
|
1301
|
-
}
|
|
1302
865
|
}
|
|
1303
866
|
}
|
|
1304
|
-
function
|
|
1305
|
-
return async (
|
|
1306
|
-
if (
|
|
1307
|
-
return;
|
|
1308
|
-
}
|
|
1309
|
-
const isPageDataReq = requestEv.sharedMap.has(IsQData);
|
|
1310
|
-
if (isPageDataReq) {
|
|
867
|
+
function Tn(e) {
|
|
868
|
+
return async (t) => {
|
|
869
|
+
if (t.headersSent || t.sharedMap.has(O))
|
|
1311
870
|
return;
|
|
1312
|
-
|
|
1313
|
-
const
|
|
1314
|
-
|
|
1315
|
-
const
|
|
1316
|
-
if (!responseHeaders.has("Content-Type")) {
|
|
1317
|
-
responseHeaders.set("Content-Type", "text/html; charset=utf-8");
|
|
1318
|
-
}
|
|
1319
|
-
const trailingSlash = getRequestTrailingSlash(requestEv);
|
|
1320
|
-
const { readable, writable } = new TextEncoderStream();
|
|
1321
|
-
const writableStream = requestEv.getWritableStream();
|
|
1322
|
-
const pipe = readable.pipeTo(writableStream, { preventClose: true });
|
|
1323
|
-
const stream = writable.getWriter();
|
|
1324
|
-
const status = requestEv.status();
|
|
871
|
+
t.request.headers.forEach((l, u) => l);
|
|
872
|
+
const r = t.headers;
|
|
873
|
+
r.has("Content-Type") || r.set("Content-Type", "text/html; charset=utf-8");
|
|
874
|
+
const { readable: o, writable: i } = new TextEncoderStream(), a = t.getWritableStream(), s = o.pipeTo(a, { preventClose: !0 }), c = i.getWriter(), f = t.status();
|
|
1325
875
|
try {
|
|
1326
|
-
const
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
stream,
|
|
1331
|
-
serverData,
|
|
876
|
+
const l = P(t) === "static", u = un(t), h = await e({
|
|
877
|
+
base: t.basePathname + "build/",
|
|
878
|
+
stream: c,
|
|
879
|
+
serverData: u,
|
|
1332
880
|
containerAttributes: {
|
|
1333
|
-
|
|
1334
|
-
...
|
|
881
|
+
"q:render": l ? "static" : "",
|
|
882
|
+
...u.containerAttributes
|
|
1335
883
|
}
|
|
1336
|
-
})
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
href: getPathname(requestEv.url, trailingSlash)
|
|
884
|
+
}), y = {
|
|
885
|
+
loaders: U(t),
|
|
886
|
+
action: t.sharedMap.get(j),
|
|
887
|
+
status: f !== 200 ? f : 200,
|
|
888
|
+
href: Z(t.url)
|
|
1342
889
|
};
|
|
1343
|
-
|
|
1344
|
-
await stream.write(result.html);
|
|
1345
|
-
}
|
|
1346
|
-
requestEv.sharedMap.set("qData", qData);
|
|
890
|
+
typeof h.html == "string" && await c.write(h.html), t.sharedMap.set(Oe, y);
|
|
1347
891
|
} finally {
|
|
1348
|
-
await
|
|
1349
|
-
await stream.close();
|
|
1350
|
-
await pipe;
|
|
892
|
+
await c.ready, await c.close(), await s;
|
|
1351
893
|
}
|
|
1352
|
-
await
|
|
894
|
+
await a.close();
|
|
1353
895
|
};
|
|
1354
896
|
}
|
|
1355
|
-
async function
|
|
1356
|
-
|
|
1357
|
-
if (!isPageDataReq) {
|
|
897
|
+
async function Mn(e) {
|
|
898
|
+
if (!e.sharedMap.has(O))
|
|
1358
899
|
return;
|
|
1359
|
-
}
|
|
1360
900
|
try {
|
|
1361
|
-
await
|
|
1362
|
-
} catch (
|
|
1363
|
-
if (!(
|
|
1364
|
-
throw
|
|
1365
|
-
}
|
|
901
|
+
await e.next();
|
|
902
|
+
} catch (i) {
|
|
903
|
+
if (!(i instanceof H))
|
|
904
|
+
throw i;
|
|
1366
905
|
}
|
|
1367
|
-
if (
|
|
906
|
+
if (e.headersSent)
|
|
1368
907
|
return;
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
const adaptedLocation = makeQDataPath(location);
|
|
1375
|
-
if (adaptedLocation) {
|
|
1376
|
-
requestEv.headers.set("Location", adaptedLocation);
|
|
1377
|
-
requestEv.getWritableStream().close();
|
|
908
|
+
const n = e.status(), r = e.headers.get("Location");
|
|
909
|
+
if (n >= 301 && n <= 308 && r) {
|
|
910
|
+
const i = xn(r);
|
|
911
|
+
if (i) {
|
|
912
|
+
e.headers.set("Location", i), e.getWritableStream().close();
|
|
1378
913
|
return;
|
|
1379
|
-
} else
|
|
1380
|
-
|
|
1381
|
-
requestEv.headers.delete("Location");
|
|
1382
|
-
}
|
|
914
|
+
} else
|
|
915
|
+
e.status(200), e.headers.delete("Location");
|
|
1383
916
|
}
|
|
1384
917
|
}
|
|
1385
|
-
async function
|
|
1386
|
-
|
|
1387
|
-
if (!isPageDataReq) {
|
|
1388
|
-
return;
|
|
1389
|
-
}
|
|
1390
|
-
await requestEv.next();
|
|
1391
|
-
if (requestEv.headersSent || requestEv.exited) {
|
|
918
|
+
async function Nn(e) {
|
|
919
|
+
if (!e.sharedMap.has(O) || (await e.next(), e.headersSent || e.exited))
|
|
1392
920
|
return;
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
const
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
921
|
+
const n = e.status(), r = e.headers.get("Location");
|
|
922
|
+
e.request.headers.forEach((l, u) => l), e.headers.set("Content-Type", "application/json; charset=utf-8");
|
|
923
|
+
let o = U(e);
|
|
924
|
+
const i = e.query.getAll(v), a = i.length > 0;
|
|
925
|
+
if (a) {
|
|
926
|
+
const l = {};
|
|
927
|
+
for (const u of i) {
|
|
928
|
+
const h = o[u];
|
|
929
|
+
l[u] = h;
|
|
930
|
+
}
|
|
931
|
+
o = l;
|
|
932
|
+
}
|
|
933
|
+
const s = a ? {
|
|
934
|
+
// send minimal data to the client
|
|
935
|
+
loaders: o,
|
|
936
|
+
status: n !== 200 ? n : 200,
|
|
937
|
+
href: Z(e.url)
|
|
938
|
+
} : {
|
|
939
|
+
loaders: o,
|
|
940
|
+
action: e.sharedMap.get(j),
|
|
941
|
+
status: n !== 200 ? n : 200,
|
|
942
|
+
href: Z(e.url),
|
|
943
|
+
redirect: r ?? void 0,
|
|
944
|
+
isRewrite: e.sharedMap.get(Le)
|
|
945
|
+
}, c = e.getWritableStream().getWriter(), f = await D([s]);
|
|
946
|
+
c.write(E.encode(f)), e.sharedMap.set(Oe, s), c.close();
|
|
1414
947
|
}
|
|
1415
|
-
function
|
|
1416
|
-
if (
|
|
1417
|
-
const
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
return
|
|
1421
|
-
} else {
|
|
1422
|
-
return void 0;
|
|
1423
|
-
}
|
|
948
|
+
function xn(e) {
|
|
949
|
+
if (e.startsWith("/")) {
|
|
950
|
+
const t = C, n = new URL(e, "http://localhost");
|
|
951
|
+
return (n.pathname.endsWith("/") ? n.pathname.slice(0, -1) : n.pathname) + (t.startsWith("/") ? "" : "/") + t + n.search;
|
|
952
|
+
} else
|
|
953
|
+
return;
|
|
1424
954
|
}
|
|
1425
|
-
function
|
|
1426
|
-
return typeof performance
|
|
955
|
+
function me() {
|
|
956
|
+
return typeof performance < "u" ? performance.now() : 0;
|
|
1427
957
|
}
|
|
1428
|
-
async function
|
|
1429
|
-
const
|
|
958
|
+
async function G(e, t, n) {
|
|
959
|
+
const r = me();
|
|
1430
960
|
try {
|
|
1431
|
-
return await
|
|
961
|
+
return await n();
|
|
1432
962
|
} finally {
|
|
1433
|
-
const
|
|
1434
|
-
let
|
|
1435
|
-
|
|
1436
|
-
requestEv.sharedMap.set("@serverTiming", measurements = []);
|
|
1437
|
-
}
|
|
1438
|
-
measurements.push([name, duration]);
|
|
963
|
+
const o = me() - r;
|
|
964
|
+
let i = e.sharedMap.get(X);
|
|
965
|
+
i || e.sharedMap.set(X, i = []), i.push([t, o]);
|
|
1439
966
|
}
|
|
1440
967
|
}
|
|
1441
|
-
function
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
return types.includes(type);
|
|
968
|
+
function Cn(e, ...t) {
|
|
969
|
+
const n = e.get("content-type")?.split(/;/, 1)[0].trim() ?? "";
|
|
970
|
+
return t.includes(n);
|
|
1445
971
|
}
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
if (!
|
|
972
|
+
let J;
|
|
973
|
+
async function Wn(e, t) {
|
|
974
|
+
const { render: n, checkOrigin: r } = t;
|
|
975
|
+
let { qwikRouterConfig: o } = t;
|
|
976
|
+
if (o || (J || (J = await import("@qwik-router-config")), o = J), !o)
|
|
1451
977
|
throw new Error("qwikRouterConfig is required.");
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
serverRequestEv.request.method,
|
|
1459
|
-
checkOrigin ?? true,
|
|
1460
|
-
render
|
|
978
|
+
const i = e.url.pathname, a = fe(i), s = await ge(
|
|
979
|
+
o,
|
|
980
|
+
a,
|
|
981
|
+
e.request.method,
|
|
982
|
+
r ?? !0,
|
|
983
|
+
n
|
|
1461
984
|
);
|
|
1462
|
-
if (
|
|
1463
|
-
const [
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
requestHandlers,
|
|
1484
|
-
rebuildRouteInfo,
|
|
1485
|
-
qwikRouterConfig.trailingSlash,
|
|
1486
|
-
qwikRouterConfig.basePathname,
|
|
1487
|
-
qwikSerializer
|
|
985
|
+
if (s) {
|
|
986
|
+
const [c, f] = s;
|
|
987
|
+
return an(
|
|
988
|
+
e,
|
|
989
|
+
c,
|
|
990
|
+
f,
|
|
991
|
+
async (u) => {
|
|
992
|
+
const h = fe(u.pathname), y = await ge(
|
|
993
|
+
o,
|
|
994
|
+
h,
|
|
995
|
+
e.request.method,
|
|
996
|
+
r ?? !0,
|
|
997
|
+
n
|
|
998
|
+
);
|
|
999
|
+
if (y) {
|
|
1000
|
+
const [w, R] = y;
|
|
1001
|
+
return { loadedRoute: w, requestHandlers: R };
|
|
1002
|
+
} else
|
|
1003
|
+
return { loadedRoute: null, requestHandlers: [] };
|
|
1004
|
+
},
|
|
1005
|
+
o.basePathname
|
|
1488
1006
|
);
|
|
1489
1007
|
}
|
|
1490
1008
|
return null;
|
|
1491
1009
|
}
|
|
1492
|
-
async function
|
|
1493
|
-
const { routes, serverPlugins, menus, cacheModules } =
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
checkOrigin,
|
|
1500
|
-
renderQwikMiddleware(renderFn)
|
|
1010
|
+
async function ge(e, t, n, r, o) {
|
|
1011
|
+
const { routes: i, serverPlugins: a, menus: s, cacheModules: c } = e, f = await Ke(i, s, c, t), l = hn(
|
|
1012
|
+
a,
|
|
1013
|
+
f,
|
|
1014
|
+
n,
|
|
1015
|
+
r,
|
|
1016
|
+
Tn(o)
|
|
1501
1017
|
);
|
|
1502
|
-
|
|
1503
|
-
|
|
1018
|
+
return l.length > 0 ? [f, l] : null;
|
|
1019
|
+
}
|
|
1020
|
+
const Pn = [
|
|
1021
|
+
// Will be replaced in post-build with the 404s generated by SSG
|
|
1022
|
+
"__QWIK_ROUTER_NOT_FOUND_ARRAY__"
|
|
1023
|
+
];
|
|
1024
|
+
function qn(e) {
|
|
1025
|
+
for (const [t, n] of Pn)
|
|
1026
|
+
if (e.startsWith(t))
|
|
1027
|
+
return n;
|
|
1028
|
+
return _e(404, "Resource Not Found");
|
|
1029
|
+
}
|
|
1030
|
+
const Y = /* @__PURE__ */ new Set(["__QWIK_ROUTER_STATIC_PATHS_ARRAY__"]);
|
|
1031
|
+
function kn(e, t) {
|
|
1032
|
+
if (e.toUpperCase() !== "GET")
|
|
1033
|
+
return !1;
|
|
1034
|
+
const n = t.pathname;
|
|
1035
|
+
if (n.startsWith("/" + (globalThis.__QWIK_BUILD_DIR__ || "build") + "/") || n.startsWith("/" + (globalThis.__QWIK_ASSETS_DIR__ || "assets") + "/") || Y.has(n))
|
|
1036
|
+
return !0;
|
|
1037
|
+
if (n.endsWith("/q-data.json")) {
|
|
1038
|
+
const r = n.replace(/\/q-data.json$/, "");
|
|
1039
|
+
if (Y.has(r + "/") || Y.has(r))
|
|
1040
|
+
return !0;
|
|
1041
|
+
}
|
|
1042
|
+
return !1;
|
|
1043
|
+
}
|
|
1044
|
+
class $n extends Error {
|
|
1045
|
+
constructor(t, n) {
|
|
1046
|
+
super(typeof n == "string" ? n : void 0), this.status = t, this.data = n;
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
class $e {
|
|
1050
|
+
}
|
|
1051
|
+
class Dn extends $e {
|
|
1052
|
+
}
|
|
1053
|
+
class Fn extends $e {
|
|
1054
|
+
constructor(t) {
|
|
1055
|
+
super(), this.pathname = t;
|
|
1504
1056
|
}
|
|
1505
|
-
return null;
|
|
1506
1057
|
}
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
#
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
const highSurrogate = this.#pendingHighSurrogate;
|
|
1521
|
-
this.#pendingHighSurrogate = null;
|
|
1522
|
-
if (56320 <= codeUnit && codeUnit <= 57343) {
|
|
1523
|
-
finalChunk += highSurrogate + item;
|
|
1058
|
+
class Sn {
|
|
1059
|
+
#e = null;
|
|
1060
|
+
#n = new TextEncoder();
|
|
1061
|
+
#t = new TransformStream({
|
|
1062
|
+
transform: (t, n) => {
|
|
1063
|
+
t = String(t);
|
|
1064
|
+
let r = "";
|
|
1065
|
+
for (let o = 0; o < t.length; o++) {
|
|
1066
|
+
const i = t[o], a = i.charCodeAt(0);
|
|
1067
|
+
if (this.#e !== null) {
|
|
1068
|
+
const s = this.#e;
|
|
1069
|
+
if (this.#e = null, 56320 <= a && a <= 57343) {
|
|
1070
|
+
r += s + i;
|
|
1524
1071
|
continue;
|
|
1525
1072
|
}
|
|
1526
|
-
|
|
1073
|
+
r += "�";
|
|
1527
1074
|
}
|
|
1528
|
-
if (55296 <=
|
|
1529
|
-
this.#
|
|
1075
|
+
if (55296 <= a && a <= 56319) {
|
|
1076
|
+
this.#e = i;
|
|
1530
1077
|
continue;
|
|
1531
1078
|
}
|
|
1532
|
-
if (56320 <=
|
|
1533
|
-
|
|
1079
|
+
if (56320 <= a && a <= 57343) {
|
|
1080
|
+
r += "�";
|
|
1534
1081
|
continue;
|
|
1535
1082
|
}
|
|
1536
|
-
|
|
1537
|
-
}
|
|
1538
|
-
if (finalChunk) {
|
|
1539
|
-
controller.enqueue(this.#handle.encode(finalChunk));
|
|
1083
|
+
r += i;
|
|
1540
1084
|
}
|
|
1085
|
+
r && n.enqueue(this.#n.encode(r));
|
|
1541
1086
|
},
|
|
1542
|
-
flush: (
|
|
1543
|
-
|
|
1544
|
-
controller.enqueue(new Uint8Array([239, 191, 189]));
|
|
1545
|
-
}
|
|
1087
|
+
flush: (t) => {
|
|
1088
|
+
this.#e !== null && t.enqueue(new Uint8Array([239, 191, 189]));
|
|
1546
1089
|
}
|
|
1547
1090
|
});
|
|
1548
1091
|
get encoding() {
|
|
1549
|
-
return this.#
|
|
1092
|
+
return this.#n.encoding;
|
|
1550
1093
|
}
|
|
1551
1094
|
get readable() {
|
|
1552
|
-
return this.#
|
|
1095
|
+
return this.#t.readable;
|
|
1553
1096
|
}
|
|
1554
1097
|
get writable() {
|
|
1555
|
-
return this.#
|
|
1098
|
+
return this.#t.writable;
|
|
1556
1099
|
}
|
|
1557
1100
|
get [Symbol.toStringTag]() {
|
|
1558
1101
|
return "TextEncoderStream";
|
|
1559
1102
|
}
|
|
1560
|
-
}
|
|
1103
|
+
}
|
|
1561
1104
|
export {
|
|
1562
|
-
AbortMessage,
|
|
1563
|
-
RedirectMessage,
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1105
|
+
$e as AbortMessage,
|
|
1106
|
+
Dn as RedirectMessage,
|
|
1107
|
+
Oe as RequestEvShareQData,
|
|
1108
|
+
Fn as RewriteMessage,
|
|
1109
|
+
$n as ServerError,
|
|
1110
|
+
Sn as _TextEncoderStream_polyfill,
|
|
1111
|
+
K as getErrorHtml,
|
|
1112
|
+
qn as getNotFound,
|
|
1113
|
+
kn as isStaticPath,
|
|
1114
|
+
Un as mergeHeadersCookies,
|
|
1115
|
+
Wn as requestHandler
|
|
1570
1116
|
};
|