@demiurgejs/core 0.2.0-beta.2 → 0.2.0-beta.3
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/dist/adapter/testing.js.map +1 -1
- package/dist/browser/file-router.d.ts.map +1 -1
- package/dist/chunks/{document-shell-D1xo6cEA.js → document-shell-WoM8yZlR.js} +2 -2
- package/dist/chunks/{document-shell-D1xo6cEA.js.map → document-shell-WoM8yZlR.js.map} +1 -1
- package/dist/chunks/{image-codec-BGTx_t5K.js → image-codec-Di53WpcH.js} +2 -2
- package/dist/chunks/{image-codec-BGTx_t5K.js.map → image-codec-Di53WpcH.js.map} +1 -1
- package/dist/chunks/{images-B9MqcjSA.js → images-Edar3eU1.js} +2 -2
- package/dist/chunks/{images-B9MqcjSA.js.map → images-Edar3eU1.js.map} +1 -1
- package/dist/chunks/{request-metadata-D5NrT8ks.js → request-metadata-DaIYq4Ea.js} +214 -179
- package/dist/chunks/request-metadata-DaIYq4Ea.js.map +1 -0
- package/dist/chunks/{streaming-BQ1bykDo.js → streaming-D0fGAuiO.js} +5 -5
- package/dist/chunks/streaming-D0fGAuiO.js.map +1 -0
- package/dist/chunks/{testing-B_iMFYz_.js → testing-CRflAw4X.js} +1228 -1074
- package/dist/chunks/testing-CRflAw4X.js.map +1 -0
- package/dist/data/cache.d.ts +8 -0
- package/dist/data/cache.d.ts.map +1 -1
- package/dist/data/idempotency.d.ts.map +1 -1
- package/dist/data/index.d.ts +3 -1
- package/dist/data/index.d.ts.map +1 -1
- package/dist/data/testing.d.ts.map +1 -1
- package/dist/data/testing.js +94 -72
- package/dist/data/testing.js.map +1 -1
- package/dist/data/tiered.d.ts +7 -0
- package/dist/data/tiered.d.ts.map +1 -0
- package/dist/document/deferred-scripts.d.ts.map +1 -1
- package/dist/document/hydration.d.ts.map +1 -1
- package/dist/document/index.d.ts +1 -0
- package/dist/document/index.d.ts.map +1 -1
- package/dist/document/trusted-types.d.ts +10 -0
- package/dist/document/trusted-types.d.ts.map +1 -0
- package/dist/edge/index.js +3 -3
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +768 -432
- package/dist/index.js.map +1 -1
- package/dist/internal/testing.js +9 -9
- package/dist/kv/index.d.ts +2 -0
- package/dist/kv/index.d.ts.map +1 -1
- package/dist/kv/index.js +71 -48
- package/dist/kv/index.js.map +1 -1
- package/dist/kv/rate-limit-store.d.ts +8 -0
- package/dist/kv/rate-limit-store.d.ts.map +1 -0
- package/dist/kv/store.d.ts.map +1 -1
- package/dist/node/http.d.ts.map +1 -1
- package/dist/node/image.d.ts.map +1 -1
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +3 -3
- package/dist/node/index.js.map +1 -1
- package/dist/node/static.d.ts.map +1 -1
- package/dist/node/streaming.d.ts.map +1 -1
- package/dist/platform/images.d.ts.map +1 -1
- package/dist/platform/index.d.ts +5 -1
- package/dist/platform/index.d.ts.map +1 -1
- package/dist/platform/observability.d.ts +2 -1
- package/dist/platform/observability.d.ts.map +1 -1
- package/dist/platform/web-vitals-client.d.ts +32 -0
- package/dist/platform/web-vitals-client.d.ts.map +1 -0
- package/dist/platform/web-vitals.d.ts +78 -0
- package/dist/platform/web-vitals.d.ts.map +1 -0
- package/dist/redis/index.d.ts +2 -0
- package/dist/redis/index.d.ts.map +1 -1
- package/dist/redis/index.js +84 -46
- package/dist/redis/index.js.map +1 -1
- package/dist/redis/rate-limit-store.d.ts +8 -0
- package/dist/redis/rate-limit-store.d.ts.map +1 -0
- package/dist/redis/store.d.ts.map +1 -1
- package/dist/route/action.d.ts.map +1 -1
- package/dist/route/middleware.d.ts.map +1 -1
- package/dist/route/response.d.ts.map +1 -1
- package/dist/router/index.d.ts +1 -1
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/manifest.d.ts +1 -0
- package/dist/router/manifest.d.ts.map +1 -1
- package/dist/security/cookies.d.ts +26 -0
- package/dist/security/cookies.d.ts.map +1 -0
- package/dist/security/env.d.ts.map +1 -1
- package/dist/security/fetch-metadata.d.ts +29 -0
- package/dist/security/fetch-metadata.d.ts.map +1 -0
- package/dist/security/index.d.ts +5 -1
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/policy.d.ts.map +1 -1
- package/dist/security/rate-limit.d.ts +6 -3
- package/dist/security/rate-limit.d.ts.map +1 -1
- package/dist/security/request.d.ts.map +1 -1
- package/dist/security/types.d.ts +72 -3
- package/dist/security/types.d.ts.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/request-handler.d.ts +6 -2
- package/dist/server/request-handler.d.ts.map +1 -1
- package/dist/static/index.d.ts.map +1 -1
- package/dist/static/index.js +4 -4
- package/dist/static/index.js.map +1 -1
- package/dist/vite/index.d.ts +3 -0
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +1030 -666
- package/dist/vite/index.js.map +1 -1
- package/dist/vite/plugin.d.ts +2 -0
- package/dist/vite/plugin.d.ts.map +1 -1
- package/dist/vite/policy-verification.d.ts.map +1 -1
- package/dist/vite/route-audit.d.ts +50 -0
- package/dist/vite/route-audit.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/chunks/request-metadata-D5NrT8ks.js.map +0 -1
- package/dist/chunks/streaming-BQ1bykDo.js.map +0 -1
- package/dist/chunks/testing-B_iMFYz_.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { renderToString as
|
|
2
|
-
import { createContext as
|
|
3
|
-
const
|
|
1
|
+
import { renderToString as q } from "react-dom/server";
|
|
2
|
+
import { createContext as J, useContext as j, useEffect as G, createElement as f } from "react";
|
|
3
|
+
const W = {
|
|
4
4
|
backgroundLifetime: !1,
|
|
5
5
|
crossOriginIsolationHeaders: !1,
|
|
6
6
|
nonceInjection: !1,
|
|
@@ -10,16 +10,16 @@ const F = {
|
|
|
10
10
|
webSocket: !1,
|
|
11
11
|
webTransport: !1
|
|
12
12
|
};
|
|
13
|
-
function
|
|
13
|
+
function Ue(e) {
|
|
14
14
|
return {
|
|
15
15
|
capabilities: {
|
|
16
|
-
...
|
|
16
|
+
...W,
|
|
17
17
|
...e.capabilities
|
|
18
18
|
},
|
|
19
19
|
name: e.name
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function H(e, t) {
|
|
23
23
|
const r = [...new Set(t)], n = r.filter(
|
|
24
24
|
(o) => !e.capabilities[o]
|
|
25
25
|
);
|
|
@@ -30,21 +30,21 @@ function J(e, t) {
|
|
|
30
30
|
required: r
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
const r =
|
|
33
|
+
function Me(e, t) {
|
|
34
|
+
const r = H(e, t);
|
|
35
35
|
if (!r.ok)
|
|
36
36
|
throw new Error(
|
|
37
37
|
`Adapter "${e.name}" does not support required capabilities: ${r.missing.join(", ")}.`
|
|
38
38
|
);
|
|
39
39
|
return r;
|
|
40
40
|
}
|
|
41
|
-
const x = "__demiurge_data",
|
|
42
|
-
function
|
|
43
|
-
return
|
|
41
|
+
const x = "__demiurge_data", Y = "data-demiurge-hydrate", K = "data-demiurge-fallback";
|
|
42
|
+
function z(e, t = {}) {
|
|
43
|
+
return V(
|
|
44
44
|
JSON.stringify({ data: e, hasData: !0, ...t })
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function Be(e) {
|
|
48
48
|
const t = e.getElementById(x), r = t?.tagName === "TEMPLATE" ? t.content.textContent : t?.textContent;
|
|
49
49
|
if (r)
|
|
50
50
|
try {
|
|
@@ -56,61 +56,92 @@ function Oe(e) {
|
|
|
56
56
|
);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function V(e) {
|
|
60
60
|
return e.replace(/&/g, "\\u0026").replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
61
61
|
}
|
|
62
|
-
const
|
|
62
|
+
const E = "demiurge", k = /* @__PURE__ */ new WeakMap();
|
|
63
|
+
function T(e, t) {
|
|
64
|
+
return Q(e)?.createScriptURL(t) ?? t;
|
|
65
|
+
}
|
|
66
|
+
function Q(e) {
|
|
67
|
+
if (!e)
|
|
68
|
+
return null;
|
|
69
|
+
const t = k.get(e);
|
|
70
|
+
if (t !== void 0)
|
|
71
|
+
return t;
|
|
72
|
+
const r = X(e);
|
|
73
|
+
return k.set(e, r), r;
|
|
74
|
+
}
|
|
75
|
+
function X(e) {
|
|
76
|
+
const t = e.trustedTypes;
|
|
77
|
+
if (!t || typeof t.createPolicy != "function")
|
|
78
|
+
return null;
|
|
79
|
+
try {
|
|
80
|
+
return t.createPolicy(E, {
|
|
81
|
+
// The framework passes only a URL that the server rendered into its own
|
|
82
|
+
// placeholder attribute. `script-src` and `worker-src` still govern that
|
|
83
|
+
// URL, so this policy adds a type without widening the source rules.
|
|
84
|
+
createScriptURL: (r) => r
|
|
85
|
+
});
|
|
86
|
+
} catch (r) {
|
|
87
|
+
return console.error(
|
|
88
|
+
`Demiurge could not create the ${JSON.stringify(E)} Trusted Types policy. Add ${JSON.stringify(E)} to the document trusted-types directive.`,
|
|
89
|
+
r
|
|
90
|
+
), null;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const U = "text/demiurge-script", p = "data-demiurge-script", y = "data-demiurge-script-src", h = "data-demiurge-script-type", D = "data-demiurge-script-started", Z = 2e3, ee = [
|
|
63
94
|
"data-api",
|
|
64
95
|
"data-demiurge-script-placement",
|
|
65
96
|
"data-domain",
|
|
66
97
|
"id",
|
|
67
98
|
"integrity",
|
|
68
99
|
"referrerpolicy"
|
|
69
|
-
],
|
|
70
|
-
function
|
|
100
|
+
], M = /* @__PURE__ */ new Map();
|
|
101
|
+
function R(e) {
|
|
71
102
|
return e === "idle" || e === "worker";
|
|
72
103
|
}
|
|
73
|
-
function
|
|
104
|
+
function te(e) {
|
|
74
105
|
const t = e ?? (typeof document > "u" ? void 0 : document);
|
|
75
106
|
if (!t)
|
|
76
107
|
return;
|
|
77
108
|
const r = t.querySelectorAll(
|
|
78
|
-
`script[${p}]:not([${
|
|
109
|
+
`script[${p}]:not([${D}])`
|
|
79
110
|
);
|
|
80
111
|
for (const n of [...r]) {
|
|
81
112
|
const o = n.getAttribute(p);
|
|
82
113
|
if (!(o !== "idle" && o !== "worker")) {
|
|
83
|
-
if (n.setAttribute(
|
|
84
|
-
|
|
114
|
+
if (n.setAttribute(D, ""), o === "worker") {
|
|
115
|
+
oe(n);
|
|
85
116
|
continue;
|
|
86
117
|
}
|
|
87
|
-
|
|
118
|
+
re(n, () => ne(n));
|
|
88
119
|
}
|
|
89
120
|
}
|
|
90
121
|
}
|
|
91
|
-
function
|
|
92
|
-
return
|
|
122
|
+
function Fe(e) {
|
|
123
|
+
return M.get(e);
|
|
93
124
|
}
|
|
94
|
-
function
|
|
125
|
+
function re(e, t) {
|
|
95
126
|
const r = e.ownerDocument.defaultView;
|
|
96
127
|
if (r && typeof r.requestIdleCallback == "function") {
|
|
97
|
-
r.requestIdleCallback(() => t(), { timeout:
|
|
128
|
+
r.requestIdleCallback(() => t(), { timeout: Z });
|
|
98
129
|
return;
|
|
99
130
|
}
|
|
100
131
|
(r ?? globalThis).setTimeout(t, 1);
|
|
101
132
|
}
|
|
102
|
-
function
|
|
133
|
+
function ne(e) {
|
|
103
134
|
const t = e.ownerDocument, r = e.getAttribute(y);
|
|
104
135
|
if (!r)
|
|
105
136
|
return;
|
|
106
137
|
const n = t.createElement("script"), o = e.getAttribute(h);
|
|
107
|
-
for (const s of
|
|
138
|
+
for (const s of ee) {
|
|
108
139
|
const c = e.getAttribute(s);
|
|
109
140
|
c !== null && n.setAttribute(s, c);
|
|
110
141
|
}
|
|
111
|
-
e.removeAttribute("id"), o && (n.type = o), n.async = !0, n.nonce = e.nonce, n.src = r, t.head.appendChild(n);
|
|
142
|
+
e.removeAttribute("id"), o && (n.type = o), n.async = !0, n.nonce = e.nonce, n.src = T(t.defaultView, r), t.head.appendChild(n);
|
|
112
143
|
}
|
|
113
|
-
function
|
|
144
|
+
function oe(e) {
|
|
114
145
|
const t = e.getAttribute(y), r = e.ownerDocument.defaultView;
|
|
115
146
|
if (!t)
|
|
116
147
|
return;
|
|
@@ -122,9 +153,11 @@ function Z(e) {
|
|
|
122
153
|
}
|
|
123
154
|
const n = e.getAttribute(h);
|
|
124
155
|
try {
|
|
125
|
-
|
|
156
|
+
M.set(
|
|
126
157
|
t,
|
|
127
|
-
new r.Worker(t, {
|
|
158
|
+
new r.Worker(T(r, t), {
|
|
159
|
+
type: n === "module" ? "module" : "classic"
|
|
160
|
+
})
|
|
128
161
|
);
|
|
129
162
|
} catch (o) {
|
|
130
163
|
console.error(
|
|
@@ -133,16 +166,16 @@ function Z(e) {
|
|
|
133
166
|
);
|
|
134
167
|
}
|
|
135
168
|
}
|
|
136
|
-
const
|
|
169
|
+
const ie = /* @__PURE__ */ new Set([
|
|
137
170
|
"afterInteractive",
|
|
138
171
|
"beforeInteractive",
|
|
139
172
|
"idle",
|
|
140
173
|
"module",
|
|
141
174
|
"worker"
|
|
142
|
-
]),
|
|
175
|
+
]), a = Symbol("demiurge.scriptPlacement"), B = J(
|
|
143
176
|
void 0
|
|
144
177
|
);
|
|
145
|
-
function
|
|
178
|
+
function ce(e = {}) {
|
|
146
179
|
let t = !1;
|
|
147
180
|
const r = [...e.scripts ?? []], n = new Set(r.map((c) => c.src)), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Map();
|
|
148
181
|
return {
|
|
@@ -162,7 +195,7 @@ function te(e = {}) {
|
|
|
162
195
|
if (o.add(c.src), !t)
|
|
163
196
|
return s.set(c.src, {
|
|
164
197
|
...c,
|
|
165
|
-
[
|
|
198
|
+
[a]: "hoisted"
|
|
166
199
|
}), "hoist";
|
|
167
200
|
if (c.strategy === "beforeInteractive" && (e.dev ?? !1))
|
|
168
201
|
throw new Error(
|
|
@@ -171,34 +204,34 @@ function te(e = {}) {
|
|
|
171
204
|
return "render";
|
|
172
205
|
},
|
|
173
206
|
scripts() {
|
|
174
|
-
return
|
|
207
|
+
return F([...r, ...s.values()]);
|
|
175
208
|
}
|
|
176
209
|
};
|
|
177
210
|
}
|
|
178
|
-
function
|
|
179
|
-
const t =
|
|
180
|
-
if (
|
|
181
|
-
|
|
211
|
+
function Le(e) {
|
|
212
|
+
const t = j(B), r = ae(e);
|
|
213
|
+
if (G(() => {
|
|
214
|
+
R(r.strategy) && te();
|
|
182
215
|
}), !t) {
|
|
183
216
|
if (typeof document > "u")
|
|
184
217
|
throw new Error(
|
|
185
218
|
`The script ${JSON.stringify(r.src)} rendered outside a Demiurge document render context. A server render must wrap its component tree with the script render context.`
|
|
186
219
|
);
|
|
187
|
-
return
|
|
220
|
+
return se(r.src) ? null : v({
|
|
188
221
|
...r,
|
|
189
|
-
[
|
|
190
|
-
},
|
|
222
|
+
[a]: "in-place"
|
|
223
|
+
}, ue());
|
|
191
224
|
}
|
|
192
225
|
return t.register(r) !== "render" ? null : v({
|
|
193
226
|
...r,
|
|
194
|
-
[
|
|
227
|
+
[a]: "in-place"
|
|
195
228
|
}, t.nonce);
|
|
196
229
|
}
|
|
197
230
|
function v(e, t) {
|
|
198
|
-
return
|
|
231
|
+
return R(e.strategy) ? f("script", {
|
|
199
232
|
"data-api": e.dataApi,
|
|
200
233
|
[p]: e.strategy,
|
|
201
|
-
"data-demiurge-script-placement": e[
|
|
234
|
+
"data-demiurge-script-placement": e[a],
|
|
202
235
|
[y]: e.src,
|
|
203
236
|
[h]: e.type,
|
|
204
237
|
"data-domain": e.dataDomain,
|
|
@@ -206,23 +239,23 @@ function v(e, t) {
|
|
|
206
239
|
integrity: e.integrity,
|
|
207
240
|
nonce: e.nonce ?? t,
|
|
208
241
|
referrerPolicy: e.referrerPolicy,
|
|
209
|
-
type:
|
|
242
|
+
type: U
|
|
210
243
|
}) : f("script", {
|
|
211
244
|
async: e.async,
|
|
212
245
|
crossOrigin: e.crossOrigin,
|
|
213
246
|
"data-api": e.dataApi,
|
|
214
247
|
"data-domain": e.dataDomain,
|
|
215
|
-
"data-demiurge-script-placement": e[
|
|
248
|
+
"data-demiurge-script-placement": e[a],
|
|
216
249
|
defer: e.defer,
|
|
217
250
|
id: e.id,
|
|
218
251
|
integrity: e.integrity,
|
|
219
252
|
nonce: e.nonce ?? t,
|
|
220
253
|
referrerPolicy: e.referrerPolicy,
|
|
221
254
|
src: e.src,
|
|
222
|
-
type: e.type ??
|
|
255
|
+
type: e.type ?? pe(e.strategy)
|
|
223
256
|
});
|
|
224
257
|
}
|
|
225
|
-
function
|
|
258
|
+
function se(e) {
|
|
226
259
|
if (typeof document > "u")
|
|
227
260
|
return !1;
|
|
228
261
|
const t = new URL(e, document.baseURI).href;
|
|
@@ -230,16 +263,16 @@ function re(e) {
|
|
|
230
263
|
(r) => r.src === t && r.dataset.demiurgeScriptPlacement !== "in-place"
|
|
231
264
|
);
|
|
232
265
|
}
|
|
233
|
-
function
|
|
266
|
+
function ue() {
|
|
234
267
|
if (!(typeof document > "u"))
|
|
235
268
|
return [...document.scripts].reverse().find((e) => e.nonce)?.nonce;
|
|
236
269
|
}
|
|
237
|
-
function
|
|
270
|
+
function Ne(e) {
|
|
238
271
|
return e;
|
|
239
272
|
}
|
|
240
|
-
function
|
|
273
|
+
function ae(e) {
|
|
241
274
|
const t = e.strategy ?? "afterInteractive";
|
|
242
|
-
if (!
|
|
275
|
+
if (!ie.has(t))
|
|
243
276
|
throw new Error(
|
|
244
277
|
`Unsupported script strategy ${JSON.stringify(t)}. Demiurge supports "beforeInteractive", "module", "afterInteractive", "idle", and "worker".`
|
|
245
278
|
);
|
|
@@ -257,10 +290,10 @@ function oe(e) {
|
|
|
257
290
|
strategy: t
|
|
258
291
|
};
|
|
259
292
|
}
|
|
260
|
-
function
|
|
293
|
+
function de(e, t) {
|
|
261
294
|
return f(B.Provider, { value: e, children: t });
|
|
262
295
|
}
|
|
263
|
-
async function
|
|
296
|
+
async function qe(e, t) {
|
|
264
297
|
const r = [];
|
|
265
298
|
for (const n of e) {
|
|
266
299
|
if (!n)
|
|
@@ -268,18 +301,18 @@ async function Te(e, t) {
|
|
|
268
301
|
const o = typeof n == "function" ? await n(t) : n;
|
|
269
302
|
r.push(...o);
|
|
270
303
|
}
|
|
271
|
-
return
|
|
304
|
+
return F(le(r));
|
|
272
305
|
}
|
|
273
|
-
function
|
|
306
|
+
function le(e) {
|
|
274
307
|
const t = /* @__PURE__ */ new Map();
|
|
275
308
|
for (const r of e)
|
|
276
|
-
t.set(
|
|
277
|
-
...t.get(
|
|
309
|
+
t.set(I(r), {
|
|
310
|
+
...t.get(I(r)),
|
|
278
311
|
...r
|
|
279
312
|
});
|
|
280
313
|
return [...t.values()];
|
|
281
314
|
}
|
|
282
|
-
function
|
|
315
|
+
function I(e) {
|
|
283
316
|
return [
|
|
284
317
|
e.src,
|
|
285
318
|
e.type ?? "",
|
|
@@ -287,27 +320,27 @@ function D(e) {
|
|
|
287
320
|
e.strategy
|
|
288
321
|
].join("\0");
|
|
289
322
|
}
|
|
290
|
-
function
|
|
291
|
-
return
|
|
323
|
+
function fe(e, t) {
|
|
324
|
+
return C(e.strategy) - C(t.strategy) || e.src.localeCompare(t.src);
|
|
292
325
|
}
|
|
293
|
-
function
|
|
294
|
-
return e.sort(
|
|
326
|
+
function F(e) {
|
|
327
|
+
return e.sort(fe);
|
|
295
328
|
}
|
|
296
|
-
function
|
|
329
|
+
function pe(e) {
|
|
297
330
|
return e === "module" ? "module" : void 0;
|
|
298
331
|
}
|
|
299
|
-
function
|
|
332
|
+
function C(e) {
|
|
300
333
|
return e === "beforeInteractive" ? 0 : e === "module" ? 1 : e === "afterInteractive" ? 2 : e === "idle" ? 3 : 4;
|
|
301
334
|
}
|
|
302
|
-
const
|
|
303
|
-
function
|
|
335
|
+
const me = "data-demiurge-structured-data";
|
|
336
|
+
function ye(e) {
|
|
304
337
|
if (e.body) {
|
|
305
|
-
const { html: t, ...r } = e.body, { prefix: n, suffix: o } =
|
|
338
|
+
const { html: t, ...r } = e.body, { prefix: n, suffix: o } = he({ ...e, body: r });
|
|
306
339
|
return `${n}${t}${o}`;
|
|
307
340
|
}
|
|
308
|
-
return
|
|
341
|
+
return $e(e);
|
|
309
342
|
}
|
|
310
|
-
function
|
|
343
|
+
function he({
|
|
311
344
|
body: e,
|
|
312
345
|
entrySrc: t,
|
|
313
346
|
lang: r = "en",
|
|
@@ -316,22 +349,22 @@ function le({
|
|
|
316
349
|
nonce: s,
|
|
317
350
|
scripts: c = [],
|
|
318
351
|
styles: $ = [],
|
|
319
|
-
title:
|
|
352
|
+
title: S = "Demiurge App"
|
|
320
353
|
}) {
|
|
321
|
-
const
|
|
322
|
-
...c.filter((
|
|
323
|
-
|
|
324
|
-
...t ? [
|
|
354
|
+
const w = o?.title ?? S, l = [
|
|
355
|
+
...c.filter((g) => g[a] !== "hoisted").map((g) => ` ${b(g, s)}`),
|
|
356
|
+
ge(e.data, e.navigation),
|
|
357
|
+
...t ? [L(t, s)] : []
|
|
325
358
|
].join(`
|
|
326
359
|
`);
|
|
327
360
|
return {
|
|
328
361
|
prefix: `<!doctype html>
|
|
329
|
-
<html lang="${
|
|
362
|
+
<html lang="${u(r)}">
|
|
330
363
|
<head>
|
|
331
|
-
${
|
|
364
|
+
${N({ links: n, metadata: o, nonce: s, scripts: c, styles: $, title: w })}
|
|
332
365
|
</head>
|
|
333
366
|
<body>
|
|
334
|
-
${
|
|
367
|
+
${we(e)}`,
|
|
335
368
|
suffix: `</div>
|
|
336
369
|
${l}
|
|
337
370
|
</body>
|
|
@@ -339,7 +372,7 @@ ${l}
|
|
|
339
372
|
`
|
|
340
373
|
};
|
|
341
374
|
}
|
|
342
|
-
function
|
|
375
|
+
function $e({
|
|
343
376
|
entrySrc: e,
|
|
344
377
|
lang: t = "en",
|
|
345
378
|
links: r = [],
|
|
@@ -349,37 +382,37 @@ function fe({
|
|
|
349
382
|
styles: c = [],
|
|
350
383
|
title: $ = "Demiurge App"
|
|
351
384
|
}) {
|
|
352
|
-
const
|
|
353
|
-
|
|
354
|
-
...s.filter((l) => l[
|
|
355
|
-
...e ? [
|
|
385
|
+
const S = n?.title ?? $, w = [
|
|
386
|
+
Se(),
|
|
387
|
+
...s.filter((l) => l[a] !== "hoisted").map((l) => ` ${b(l, o)}`),
|
|
388
|
+
...e ? [L(e, o)] : []
|
|
356
389
|
].join(`
|
|
357
390
|
`);
|
|
358
391
|
return `<!doctype html>
|
|
359
|
-
<html lang="${
|
|
392
|
+
<html lang="${u(t)}">
|
|
360
393
|
<head>
|
|
361
|
-
${
|
|
394
|
+
${N({ links: r, metadata: n, nonce: o, scripts: s, styles: c, title: S })}
|
|
362
395
|
</head>
|
|
363
396
|
<body>
|
|
364
|
-
${
|
|
397
|
+
${w}
|
|
365
398
|
</body>
|
|
366
399
|
</html>
|
|
367
400
|
`;
|
|
368
401
|
}
|
|
369
|
-
function
|
|
402
|
+
function Se(e) {
|
|
370
403
|
return ' <div id="root"></div>';
|
|
371
404
|
}
|
|
372
|
-
function
|
|
373
|
-
const t = e.fallback ? ` ${
|
|
374
|
-
return ` <div id="root" ${
|
|
405
|
+
function we(e) {
|
|
406
|
+
const t = e.fallback ? ` ${K}="${u(e.fallback)}"` : "";
|
|
407
|
+
return ` <div id="root" ${Y}=""${t}>`;
|
|
375
408
|
}
|
|
376
|
-
function
|
|
377
|
-
return ` <template id="${x}">${
|
|
409
|
+
function ge(e, t) {
|
|
410
|
+
return ` <template id="${x}">${z(e, { navigation: t })}</template>`;
|
|
378
411
|
}
|
|
379
|
-
function
|
|
380
|
-
return ` <script type="module" src="${
|
|
412
|
+
function L(e, t) {
|
|
413
|
+
return ` <script type="module" src="${u(e)}"${i("nonce", t)}><\/script>`;
|
|
381
414
|
}
|
|
382
|
-
function
|
|
415
|
+
function N({
|
|
383
416
|
links: e,
|
|
384
417
|
metadata: t,
|
|
385
418
|
nonce: r,
|
|
@@ -396,7 +429,7 @@ function U({
|
|
|
396
429
|
content: t?.viewport ?? "width=device-width, initial-scale=1.0",
|
|
397
430
|
name: "viewport"
|
|
398
431
|
}),
|
|
399
|
-
` <title>${
|
|
432
|
+
` <title>${u(s)}</title>`,
|
|
400
433
|
...t?.description ? [
|
|
401
434
|
d({
|
|
402
435
|
content: t.description,
|
|
@@ -404,26 +437,26 @@ function U({
|
|
|
404
437
|
})
|
|
405
438
|
] : [],
|
|
406
439
|
...t?.canonical ? [
|
|
407
|
-
|
|
440
|
+
A({
|
|
408
441
|
href: t.canonical,
|
|
409
442
|
rel: "canonical"
|
|
410
443
|
})
|
|
411
444
|
] : [],
|
|
412
|
-
...
|
|
413
|
-
|
|
414
|
-
...(t?.custom ?? []).map(
|
|
445
|
+
...Ee(t),
|
|
446
|
+
...Ae(t),
|
|
447
|
+
...(t?.custom ?? []).map(Re),
|
|
415
448
|
...(t?.structuredData ?? []).map(
|
|
416
|
-
(c) =>
|
|
449
|
+
(c) => be(c, r)
|
|
417
450
|
),
|
|
418
451
|
...o.map(
|
|
419
|
-
(c) => ` <link rel="stylesheet" href="${
|
|
452
|
+
(c) => ` <link rel="stylesheet" href="${u(c)}" />`
|
|
420
453
|
),
|
|
421
|
-
...e.map(
|
|
422
|
-
...n.filter((c) => c[
|
|
454
|
+
...e.map(A),
|
|
455
|
+
...n.filter((c) => c[a] === "hoisted").map((c) => ` ${b(c, r)}`)
|
|
423
456
|
].join(`
|
|
424
457
|
`);
|
|
425
458
|
}
|
|
426
|
-
function
|
|
459
|
+
function Ee(e) {
|
|
427
460
|
if (!e?.robots)
|
|
428
461
|
return [];
|
|
429
462
|
const t = [
|
|
@@ -437,7 +470,7 @@ function he(e) {
|
|
|
437
470
|
})
|
|
438
471
|
];
|
|
439
472
|
}
|
|
440
|
-
function
|
|
473
|
+
function Ae(e) {
|
|
441
474
|
return e?.openGraph ? [
|
|
442
475
|
e.openGraph.title ? d({
|
|
443
476
|
content: e.openGraph.title,
|
|
@@ -453,46 +486,46 @@ function $e(e) {
|
|
|
453
486
|
}) : null
|
|
454
487
|
].filter((t) => !!t) : [];
|
|
455
488
|
}
|
|
456
|
-
function
|
|
457
|
-
return e.kind === "link" ?
|
|
489
|
+
function Re(e) {
|
|
490
|
+
return e.kind === "link" ? A(e) : d(e);
|
|
458
491
|
}
|
|
459
|
-
function
|
|
460
|
-
return ` <script type="application/ld+json"${t ? "" : ` ${
|
|
492
|
+
function be(e, t) {
|
|
493
|
+
return ` <script type="application/ld+json"${t ? "" : ` ${me}`}${i("nonce", t)}>${ve(JSON.stringify(e.value))}<\/script>`;
|
|
461
494
|
}
|
|
462
495
|
function d(e) {
|
|
463
496
|
if (e.name === "charset")
|
|
464
|
-
return ` <meta charset="${
|
|
465
|
-
const t = e.name ? ` name="${
|
|
466
|
-
return ` <meta${t}${r} content="${
|
|
497
|
+
return ` <meta charset="${u(e.content)}" />`;
|
|
498
|
+
const t = e.name ? ` name="${u(e.name)}"` : "", r = e.property ? ` property="${u(e.property)}"` : "";
|
|
499
|
+
return ` <meta${t}${r} content="${u(e.content)}" />`;
|
|
467
500
|
}
|
|
468
|
-
function
|
|
501
|
+
function A(e) {
|
|
469
502
|
return ` <link${i("rel", e.rel)}${i("href", e.href)}${i("as", e.as)}${i("type", e.type)}${i("crossorigin", e.crossOrigin)}${i("hreflang", e.hrefLang)} />`;
|
|
470
503
|
}
|
|
471
|
-
function
|
|
472
|
-
return
|
|
504
|
+
function b(e, t) {
|
|
505
|
+
return R(e.strategy) ? ke(e, t) : `<script${i("id", e.id)}${i("src", e.src)}${i("type", e.type ?? De(e.strategy))}${i("nonce", e.nonce ?? t)}${i("integrity", e.integrity)}${i("crossorigin", e.crossOrigin)}${i("referrerpolicy", e.referrerPolicy)}${i("data-api", e.dataApi)}${i("data-domain", e.dataDomain)}${i("data-demiurge-script-placement", e[a])}${P("async", e.async)}${P("defer", e.defer)}><\/script>`;
|
|
473
506
|
}
|
|
474
|
-
function
|
|
475
|
-
return `<script${i("id", e.id)}${i("type",
|
|
507
|
+
function ke(e, t) {
|
|
508
|
+
return `<script${i("id", e.id)}${i("type", U)}${i("nonce", e.nonce ?? t)}${i("integrity", e.integrity)}${i("crossorigin", e.crossOrigin)}${i("referrerpolicy", e.referrerPolicy)}${i("data-api", e.dataApi)}${i("data-domain", e.dataDomain)}${i(p, e.strategy)}${i(y, e.src)}${i(h, e.type)}${i("data-demiurge-script-placement", e[a])}><\/script>`;
|
|
476
509
|
}
|
|
477
|
-
function
|
|
510
|
+
function De(e) {
|
|
478
511
|
return e === "module" ? "module" : void 0;
|
|
479
512
|
}
|
|
480
513
|
function i(e, t) {
|
|
481
|
-
return t ? ` ${e}="${
|
|
514
|
+
return t ? ` ${e}="${u(t)}"` : "";
|
|
482
515
|
}
|
|
483
|
-
function
|
|
516
|
+
function P(e, t) {
|
|
484
517
|
return t ? ` ${e}` : "";
|
|
485
518
|
}
|
|
486
|
-
function
|
|
519
|
+
function u(e) {
|
|
487
520
|
return e.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """);
|
|
488
521
|
}
|
|
489
|
-
function
|
|
522
|
+
function ve(e) {
|
|
490
523
|
return e.replaceAll("<", "\\u003c").replaceAll(">", "\\u003e").replaceAll("\u2028", "\\u2028").replaceAll("\u2029", "\\u2029");
|
|
491
524
|
}
|
|
492
|
-
function
|
|
525
|
+
function Je(e) {
|
|
493
526
|
return e;
|
|
494
527
|
}
|
|
495
|
-
function
|
|
528
|
+
function je(e, t = {}) {
|
|
496
529
|
return {
|
|
497
530
|
...t,
|
|
498
531
|
href: e,
|
|
@@ -500,7 +533,7 @@ function Ne(e, t = {}) {
|
|
|
500
533
|
rel: "preconnect"
|
|
501
534
|
};
|
|
502
535
|
}
|
|
503
|
-
function
|
|
536
|
+
function Ge(e, t) {
|
|
504
537
|
return {
|
|
505
538
|
...t,
|
|
506
539
|
href: e,
|
|
@@ -508,14 +541,14 @@ function Le(e, t) {
|
|
|
508
541
|
rel: "preload"
|
|
509
542
|
};
|
|
510
543
|
}
|
|
511
|
-
function
|
|
544
|
+
function We(e) {
|
|
512
545
|
return {
|
|
513
546
|
href: e,
|
|
514
547
|
kind: "link",
|
|
515
548
|
rel: "modulepreload"
|
|
516
549
|
};
|
|
517
550
|
}
|
|
518
|
-
async function
|
|
551
|
+
async function He(e, t) {
|
|
519
552
|
const r = [];
|
|
520
553
|
for (const n of e) {
|
|
521
554
|
if (!n)
|
|
@@ -523,18 +556,18 @@ async function je(e, t) {
|
|
|
523
556
|
const o = typeof n == "function" ? await n(t) : n;
|
|
524
557
|
r.push(...o);
|
|
525
558
|
}
|
|
526
|
-
return
|
|
559
|
+
return Ie(r).sort(Ce);
|
|
527
560
|
}
|
|
528
|
-
function
|
|
561
|
+
function Ie(e) {
|
|
529
562
|
const t = /* @__PURE__ */ new Map();
|
|
530
563
|
for (const r of e)
|
|
531
|
-
t.set(
|
|
532
|
-
...t.get(
|
|
564
|
+
t.set(_(r), {
|
|
565
|
+
...t.get(_(r)),
|
|
533
566
|
...r
|
|
534
567
|
});
|
|
535
568
|
return [...t.values()];
|
|
536
569
|
}
|
|
537
|
-
function
|
|
570
|
+
function _(e) {
|
|
538
571
|
return [
|
|
539
572
|
e.rel,
|
|
540
573
|
e.href,
|
|
@@ -543,13 +576,13 @@ function C(e) {
|
|
|
543
576
|
e.crossOrigin ?? ""
|
|
544
577
|
].join("\0");
|
|
545
578
|
}
|
|
546
|
-
function
|
|
547
|
-
return
|
|
579
|
+
function Ce(e, t) {
|
|
580
|
+
return O(e.rel) - O(t.rel) || e.href.localeCompare(t.href);
|
|
548
581
|
}
|
|
549
|
-
function
|
|
582
|
+
function O(e) {
|
|
550
583
|
return e === "preconnect" ? 0 : e === "preload" ? 1 : e === "modulepreload" ? 2 : 3;
|
|
551
584
|
}
|
|
552
|
-
function
|
|
585
|
+
function Pe(e, t) {
|
|
553
586
|
const r = f(e.page, {
|
|
554
587
|
data: e.data,
|
|
555
588
|
path: e.path,
|
|
@@ -562,18 +595,18 @@ function ve(e, t) {
|
|
|
562
595
|
}),
|
|
563
596
|
r
|
|
564
597
|
);
|
|
565
|
-
return t ?
|
|
598
|
+
return t ? de(t, n) : n;
|
|
566
599
|
}
|
|
567
|
-
function
|
|
568
|
-
return
|
|
600
|
+
function _e(e, t = {}) {
|
|
601
|
+
return ce({
|
|
569
602
|
dev: t.dev,
|
|
570
603
|
nonce: t.nonce,
|
|
571
604
|
scripts: e.scripts
|
|
572
605
|
});
|
|
573
606
|
}
|
|
574
|
-
function
|
|
575
|
-
const r =
|
|
576
|
-
return
|
|
607
|
+
function Oe(e, t = {}) {
|
|
608
|
+
const r = _e(e, t), n = q(Pe(e, r));
|
|
609
|
+
return ye({
|
|
577
610
|
body: {
|
|
578
611
|
data: e.data,
|
|
579
612
|
html: n,
|
|
@@ -589,8 +622,8 @@ function ke(e, t = {}) {
|
|
|
589
622
|
title: t.title
|
|
590
623
|
});
|
|
591
624
|
}
|
|
592
|
-
function
|
|
593
|
-
const r =
|
|
625
|
+
function Ye(e, t = {}) {
|
|
626
|
+
const r = Oe(e, t);
|
|
594
627
|
return new Response(r, {
|
|
595
628
|
headers: {
|
|
596
629
|
"content-type": "text/html; charset=utf-8"
|
|
@@ -598,45 +631,47 @@ function Fe(e, t = {}) {
|
|
|
598
631
|
});
|
|
599
632
|
}
|
|
600
633
|
const m = /* @__PURE__ */ new WeakMap();
|
|
601
|
-
function
|
|
634
|
+
function Ke(e) {
|
|
602
635
|
return m.get(e);
|
|
603
636
|
}
|
|
604
|
-
function
|
|
637
|
+
function ze(e, t) {
|
|
605
638
|
m.set(e, t);
|
|
606
639
|
}
|
|
607
|
-
function
|
|
640
|
+
function Ve(e, t) {
|
|
608
641
|
const r = m.get(e);
|
|
609
642
|
r && m.set(t, r);
|
|
610
643
|
}
|
|
611
644
|
export {
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
645
|
+
Ke as A,
|
|
646
|
+
Ve as B,
|
|
647
|
+
E as F,
|
|
648
|
+
Y as H,
|
|
649
|
+
me as S,
|
|
650
|
+
Ye as a,
|
|
651
|
+
Pe as b,
|
|
652
|
+
_e as c,
|
|
653
|
+
Ue as d,
|
|
654
|
+
ye as e,
|
|
655
|
+
Oe as f,
|
|
656
|
+
Be as g,
|
|
657
|
+
te as h,
|
|
658
|
+
K as i,
|
|
659
|
+
ae as j,
|
|
660
|
+
Le as k,
|
|
661
|
+
Me as l,
|
|
662
|
+
H as m,
|
|
663
|
+
T as n,
|
|
664
|
+
Je as o,
|
|
665
|
+
Ge as p,
|
|
666
|
+
Ne as q,
|
|
667
|
+
he as r,
|
|
668
|
+
ze as s,
|
|
669
|
+
Fe as t,
|
|
670
|
+
We as u,
|
|
636
671
|
je as v,
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
672
|
+
He as w,
|
|
673
|
+
qe as x,
|
|
674
|
+
ce as y,
|
|
675
|
+
de as z
|
|
641
676
|
};
|
|
642
|
-
//# sourceMappingURL=request-metadata-
|
|
677
|
+
//# sourceMappingURL=request-metadata-DaIYq4Ea.js.map
|