@demiurgejs/core 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/file-router.d.ts +5 -0
- package/dist/browser/file-router.d.ts.map +1 -1
- package/dist/chunks/{ssr-O3d7Q73U.js → ssr-BJejKlkZ.js} +57 -55
- package/dist/chunks/ssr-BJejKlkZ.js.map +1 -0
- package/dist/chunks/static-files-DUjHw-4H.js +11 -0
- package/dist/chunks/static-files-DUjHw-4H.js.map +1 -0
- package/dist/chunks/{streaming-27pwhjGC.js → streaming-DN1DnbRE.js} +2 -2
- package/dist/chunks/{streaming-27pwhjGC.js.map → streaming-DN1DnbRE.js.map} +1 -1
- package/dist/chunks/{testing-BBnJ5WUR.js → testing-DR3eQAvY.js} +127 -126
- package/dist/chunks/testing-DR3eQAvY.js.map +1 -0
- package/dist/document/render.d.ts +1 -0
- package/dist/document/render.d.ts.map +1 -1
- package/dist/index.js +284 -274
- package/dist/index.js.map +1 -1
- package/dist/internal/testing.js +1 -1
- package/dist/node/index.js +86 -85
- package/dist/node/index.js.map +1 -1
- package/dist/node/static.d.ts.map +1 -1
- package/dist/router/manifest.d.ts +3 -1
- package/dist/router/manifest.d.ts.map +1 -1
- package/dist/static/index.d.ts +5 -0
- package/dist/static/index.d.ts.map +1 -1
- package/dist/static/index.js +245 -124
- package/dist/static/index.js.map +1 -1
- package/dist/static-files.d.ts +5 -0
- package/dist/static-files.d.ts.map +1 -0
- package/dist/vite/index.js +445 -279
- package/dist/vite/index.js.map +1 -1
- package/dist/vite/plugin.d.ts.map +1 -1
- package/package.json +4 -1
- package/dist/chunks/ssr-O3d7Q73U.js.map +0 -1
- package/dist/chunks/testing-BBnJ5WUR.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as mt, h as ht, b as Le, r as pt } from "./ssr-
|
|
1
|
+
import { g as mt, h as ht, b as Le, r as pt } from "./ssr-BJejKlkZ.js";
|
|
2
2
|
import { createElement as ee } from "react";
|
|
3
3
|
import { renderToString as He } from "react-dom/server";
|
|
4
4
|
import { jsxs as N, jsx as $ } from "react/jsx-runtime";
|
|
@@ -557,14 +557,14 @@ function qt(e, t) {
|
|
|
557
557
|
});
|
|
558
558
|
}
|
|
559
559
|
function Wt(e) {
|
|
560
|
-
return e.map(
|
|
560
|
+
return e.map(Gt).join(", ");
|
|
561
561
|
}
|
|
562
562
|
function S(e) {
|
|
563
563
|
if (e)
|
|
564
564
|
return Array.isArray(e) ? e : [e];
|
|
565
565
|
}
|
|
566
|
-
function
|
|
567
|
-
if (!
|
|
566
|
+
function Gt(e) {
|
|
567
|
+
if (!Bt(e.name))
|
|
568
568
|
throw new Error(
|
|
569
569
|
`Server-Timing metric name "${e.name}" is not a valid token.`
|
|
570
570
|
);
|
|
@@ -576,7 +576,7 @@ function Bt(e) {
|
|
|
576
576
|
}
|
|
577
577
|
return e.description !== void 0 && t.push(`desc="${Vt(e.description)}"`), t.join(";");
|
|
578
578
|
}
|
|
579
|
-
function
|
|
579
|
+
function Bt(e) {
|
|
580
580
|
return /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/.test(e);
|
|
581
581
|
}
|
|
582
582
|
function _t(e) {
|
|
@@ -1242,7 +1242,7 @@ async function qe(e, t, r = new Request(`http://demiurge.local${t}`), n, s = ae(
|
|
|
1242
1242
|
status: "not-found"
|
|
1243
1243
|
};
|
|
1244
1244
|
const c = e.layouts.filter(
|
|
1245
|
-
(f) =>
|
|
1245
|
+
(f) => G(f.fileSegments, a.route.fileSegments)
|
|
1246
1246
|
), u = await a.route.load();
|
|
1247
1247
|
if (!u.GET || u.GET.kind !== "page")
|
|
1248
1248
|
return {
|
|
@@ -1297,42 +1297,42 @@ async function qe(e, t, r = new Request(`http://demiurge.local${t}`), n, s = ae(
|
|
|
1297
1297
|
}
|
|
1298
1298
|
};
|
|
1299
1299
|
}
|
|
1300
|
-
async function $s(e) {
|
|
1301
|
-
const
|
|
1302
|
-
for (const
|
|
1303
|
-
const
|
|
1304
|
-
if (!
|
|
1300
|
+
async function $s(e, t = {}) {
|
|
1301
|
+
const r = ae(), n = [];
|
|
1302
|
+
for (const s of e.routes) {
|
|
1303
|
+
const o = await s.load();
|
|
1304
|
+
if (!o.GET || o.GET.kind !== "page" && !t.includeResources)
|
|
1305
1305
|
continue;
|
|
1306
|
-
if (
|
|
1306
|
+
if (o.GET.kind === "page" && o.GET.render.mode !== "static")
|
|
1307
1307
|
throw new Error(
|
|
1308
|
-
`Page route "${
|
|
1308
|
+
`Page route "${s.file}" uses render mode "${o.GET.render.mode}" and cannot be emitted as static output. Set render: { mode: "static" } or deploy a runtime adapter.`
|
|
1309
1309
|
);
|
|
1310
|
-
const
|
|
1311
|
-
if (br(
|
|
1312
|
-
|
|
1313
|
-
file:
|
|
1310
|
+
const i = Er(s.segments);
|
|
1311
|
+
if (br(s.segments).length === 0) {
|
|
1312
|
+
n.push({
|
|
1313
|
+
file: s.file,
|
|
1314
1314
|
path: {},
|
|
1315
|
-
pattern:
|
|
1316
|
-
pathname:
|
|
1315
|
+
pattern: i,
|
|
1316
|
+
pathname: i
|
|
1317
1317
|
});
|
|
1318
1318
|
continue;
|
|
1319
1319
|
}
|
|
1320
|
-
if (!
|
|
1320
|
+
if (!o.paths)
|
|
1321
1321
|
throw new Error(
|
|
1322
|
-
`Dynamic static route "${
|
|
1322
|
+
`Dynamic static route "${s.file}" must export paths for "${i}".`
|
|
1323
1323
|
);
|
|
1324
|
-
const
|
|
1325
|
-
for (const
|
|
1326
|
-
const
|
|
1327
|
-
|
|
1328
|
-
file:
|
|
1329
|
-
path:
|
|
1330
|
-
pattern:
|
|
1331
|
-
pathname: xr(
|
|
1324
|
+
const c = await o.paths({ cache: r });
|
|
1325
|
+
for (const u of c) {
|
|
1326
|
+
const l = Tr(s, i, u);
|
|
1327
|
+
n.push({
|
|
1328
|
+
file: s.file,
|
|
1329
|
+
path: l,
|
|
1330
|
+
pattern: i,
|
|
1331
|
+
pathname: xr(s.segments, l)
|
|
1332
1332
|
});
|
|
1333
1333
|
}
|
|
1334
1334
|
}
|
|
1335
|
-
return
|
|
1335
|
+
return n;
|
|
1336
1336
|
}
|
|
1337
1337
|
async function Is(e, t) {
|
|
1338
1338
|
const r = L(e.routes, t);
|
|
@@ -1362,11 +1362,11 @@ async function We(e, t) {
|
|
|
1362
1362
|
}
|
|
1363
1363
|
async function pr(e, t) {
|
|
1364
1364
|
return await le(
|
|
1365
|
-
|
|
1365
|
+
Ge(e.fallbacks.error, t)
|
|
1366
1366
|
);
|
|
1367
1367
|
}
|
|
1368
1368
|
async function ne(e, t, r = {}) {
|
|
1369
|
-
const s = await (r.fallback ??
|
|
1369
|
+
const s = await (r.fallback ?? Ge(e.fallbacks.notFound, t))?.load(), o = s?.default, i = r.documentContributions ?? !0;
|
|
1370
1370
|
if (s?.layout === !1)
|
|
1371
1371
|
return {
|
|
1372
1372
|
layouts: [],
|
|
@@ -1402,27 +1402,27 @@ async function ne(e, t, r = {}) {
|
|
|
1402
1402
|
function gr(e, t) {
|
|
1403
1403
|
const r = _(t);
|
|
1404
1404
|
return e.layouts.filter(
|
|
1405
|
-
(n) => !n.fileSegments.some(
|
|
1405
|
+
(n) => !n.fileSegments.some(B) && ue(n.segments, r)
|
|
1406
1406
|
);
|
|
1407
1407
|
}
|
|
1408
1408
|
function wr(e, t) {
|
|
1409
1409
|
const r = _(t);
|
|
1410
1410
|
return e.policies.filter(
|
|
1411
|
-
(n) => !n.fileSegments.some(
|
|
1411
|
+
(n) => !n.fileSegments.some(B) && ue(n.segments, r)
|
|
1412
1412
|
);
|
|
1413
1413
|
}
|
|
1414
1414
|
function ce(e, t) {
|
|
1415
1415
|
for (let r = e.length - 1; r >= 0; r -= 1) {
|
|
1416
1416
|
const n = e[r];
|
|
1417
|
-
if (
|
|
1417
|
+
if (G(n.fileSegments, t.fileSegments))
|
|
1418
1418
|
return n;
|
|
1419
1419
|
}
|
|
1420
1420
|
}
|
|
1421
|
-
function
|
|
1421
|
+
function Ge(e, t) {
|
|
1422
1422
|
const r = _(t);
|
|
1423
1423
|
for (let n = e.length - 1; n >= 0; n -= 1) {
|
|
1424
1424
|
const s = e[n];
|
|
1425
|
-
if (!s.fileSegments.some(
|
|
1425
|
+
if (!s.fileSegments.some(B) && ue(s.segments, r))
|
|
1426
1426
|
return s;
|
|
1427
1427
|
}
|
|
1428
1428
|
}
|
|
@@ -1467,15 +1467,15 @@ function Hs(e, t) {
|
|
|
1467
1467
|
(r, n) => t[n] === r
|
|
1468
1468
|
);
|
|
1469
1469
|
}
|
|
1470
|
-
function
|
|
1470
|
+
function G(e, t) {
|
|
1471
1471
|
return e.every(
|
|
1472
1472
|
(r, n) => t[n] === r
|
|
1473
1473
|
);
|
|
1474
1474
|
}
|
|
1475
1475
|
function R(e) {
|
|
1476
|
-
return e.flatMap((t) =>
|
|
1476
|
+
return e.flatMap((t) => B(t) ? [] : t === "index" ? [] : t.startsWith("[...") && t.endsWith("]") ? [`*${t.slice(4, -1)}`] : t.startsWith("[") && t.endsWith("]") ? [`:${t.slice(1, -1)}`] : [t]);
|
|
1477
1477
|
}
|
|
1478
|
-
function
|
|
1478
|
+
function B(e) {
|
|
1479
1479
|
return e.startsWith("(") && e.endsWith(")");
|
|
1480
1480
|
}
|
|
1481
1481
|
function Er(e) {
|
|
@@ -1533,7 +1533,7 @@ class fe extends URIError {
|
|
|
1533
1533
|
}
|
|
1534
1534
|
}
|
|
1535
1535
|
const x = "x-demiurge-navigation", Pr = "data", Cr = "data", Z = "error", xe = "not-found";
|
|
1536
|
-
function
|
|
1536
|
+
function Be(e) {
|
|
1537
1537
|
return e.headers.get(x) === Pr;
|
|
1538
1538
|
}
|
|
1539
1539
|
function Ar(e) {
|
|
@@ -1695,7 +1695,7 @@ async function js(e, t = "sha256") {
|
|
|
1695
1695
|
return `'${t}-${Yr(new Uint8Array(r))}'`;
|
|
1696
1696
|
}
|
|
1697
1697
|
function Je(e, t = {}) {
|
|
1698
|
-
|
|
1698
|
+
Br(e);
|
|
1699
1699
|
const r = new Headers(), n = e.csp !== !1 && e.csp ? qr(e.csp, t) : void 0, s = Fr(e.trustedTypes), o = e.trustedTypes ? e.trustedTypes.mode === "report-only" : !1;
|
|
1700
1700
|
return y(
|
|
1701
1701
|
r,
|
|
@@ -1809,12 +1809,12 @@ function Xe(e) {
|
|
|
1809
1809
|
}
|
|
1810
1810
|
function Wr(e) {
|
|
1811
1811
|
if (e)
|
|
1812
|
-
return Object.entries(e).sort(([t], [r]) => t.localeCompare(r)).map(([t, r]) => `${t}="${
|
|
1812
|
+
return Object.entries(e).sort(([t], [r]) => t.localeCompare(r)).map(([t, r]) => `${t}="${Gr(r)}"`).join(", ");
|
|
1813
1813
|
}
|
|
1814
|
-
function
|
|
1814
|
+
function Gr(e) {
|
|
1815
1815
|
return e.replaceAll("\\", "\\\\").replaceAll('"', '\\"');
|
|
1816
1816
|
}
|
|
1817
|
-
function
|
|
1817
|
+
function Br(e) {
|
|
1818
1818
|
const t = e.headers?.reportingEndpoints;
|
|
1819
1819
|
if (t) {
|
|
1820
1820
|
const n = Object.entries(t);
|
|
@@ -2385,7 +2385,7 @@ async function Wn(e, t, r) {
|
|
|
2385
2385
|
return Pe;
|
|
2386
2386
|
}
|
|
2387
2387
|
}
|
|
2388
|
-
function
|
|
2388
|
+
function Gn(e) {
|
|
2389
2389
|
return W({
|
|
2390
2390
|
instance: `${e.pathname}${e.search}`,
|
|
2391
2391
|
status: 404,
|
|
@@ -2395,10 +2395,10 @@ function Bn(e) {
|
|
|
2395
2395
|
async function se(e, t, r = {}) {
|
|
2396
2396
|
const n = new URL(t.url);
|
|
2397
2397
|
if (!it(t))
|
|
2398
|
-
return
|
|
2398
|
+
return Gn(n);
|
|
2399
2399
|
const s = await ne(e, n.pathname, {
|
|
2400
2400
|
onLayoutError: (u) => r.onError?.(u, "page")
|
|
2401
|
-
}), o = await
|
|
2401
|
+
}), o = await Bn(e, n.pathname), i = r.nonce ?? (Ye(o) ? Ze() : void 0), a = _n(s, { ...r, nonce: i }), c = Je(o ?? {}, {
|
|
2402
2402
|
nonce: i,
|
|
2403
2403
|
request: t
|
|
2404
2404
|
});
|
|
@@ -2410,7 +2410,7 @@ async function se(e, t, r = {}) {
|
|
|
2410
2410
|
}
|
|
2411
2411
|
);
|
|
2412
2412
|
}
|
|
2413
|
-
async function
|
|
2413
|
+
async function Bn(e, t) {
|
|
2414
2414
|
const r = await Promise.all(
|
|
2415
2415
|
wr(e, t).map((n) => n.load())
|
|
2416
2416
|
);
|
|
@@ -2478,7 +2478,7 @@ function zs(e) {
|
|
|
2478
2478
|
async function Vn(e, t, r = {
|
|
2479
2479
|
rateLimitStore: lt
|
|
2480
2480
|
}) {
|
|
2481
|
-
const n = new URL(t.url), s = Yn(n, r), o =
|
|
2481
|
+
const n = new URL(t.url), s = Yn(n, r), o = Be(t);
|
|
2482
2482
|
let i;
|
|
2483
2483
|
try {
|
|
2484
2484
|
i = L(e.routes, n.pathname);
|
|
@@ -2600,7 +2600,7 @@ async function Kn(e, t, r, n, s, o) {
|
|
|
2600
2600
|
...o,
|
|
2601
2601
|
nonce: v
|
|
2602
2602
|
});
|
|
2603
|
-
if (
|
|
2603
|
+
if (Be(t))
|
|
2604
2604
|
return Ar(p.match.data);
|
|
2605
2605
|
if (p.match.render.mode === "streaming" && !s.renderPage)
|
|
2606
2606
|
throw new Error(
|
|
@@ -2715,7 +2715,7 @@ function Zn(e, t) {
|
|
|
2715
2715
|
async function Qn(e, t, r, n) {
|
|
2716
2716
|
const s = await Promise.all(
|
|
2717
2717
|
e.policies.filter(
|
|
2718
|
-
(o) =>
|
|
2718
|
+
(o) => G(o.fileSegments, t.fileSegments)
|
|
2719
2719
|
).map((o) => o.load())
|
|
2720
2720
|
);
|
|
2721
2721
|
return Ke(
|
|
@@ -2729,7 +2729,7 @@ async function Qn(e, t, r, n) {
|
|
|
2729
2729
|
async function $e(e, t) {
|
|
2730
2730
|
return (await Promise.all(
|
|
2731
2731
|
e.middlewares.filter(
|
|
2732
|
-
(n) =>
|
|
2732
|
+
(n) => G(n.fileSegments, t.fileSegments)
|
|
2733
2733
|
).map((n) => n.load())
|
|
2734
2734
|
)).flatMap(
|
|
2735
2735
|
(n) => n.middleware ? [n.middleware] : []
|
|
@@ -2780,92 +2780,93 @@ function rs(e) {
|
|
|
2780
2780
|
return e.GET && !t.includes("HEAD") && t.push("HEAD"), t;
|
|
2781
2781
|
}
|
|
2782
2782
|
export {
|
|
2783
|
-
|
|
2784
|
-
|
|
2783
|
+
ys as $,
|
|
2784
|
+
ot as A,
|
|
2785
2785
|
ke as B,
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2786
|
+
Ue as C,
|
|
2787
|
+
Me as D,
|
|
2788
|
+
et as E,
|
|
2789
|
+
cn as F,
|
|
2790
|
+
an as G,
|
|
2791
2791
|
Kt as H,
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2792
|
+
Ns as I,
|
|
2793
|
+
ae as J,
|
|
2794
|
+
tr as K,
|
|
2795
|
+
zs as L,
|
|
2796
|
+
as as M,
|
|
2797
2797
|
x as N,
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2798
|
+
fs as O,
|
|
2799
|
+
Ms as P,
|
|
2800
|
+
ps as Q,
|
|
2801
2801
|
D as R,
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2802
|
+
Us as S,
|
|
2803
|
+
Ds as T,
|
|
2804
|
+
Cn as U,
|
|
2805
|
+
un as V,
|
|
2806
|
+
Sn as W,
|
|
2807
|
+
kn as X,
|
|
2808
|
+
Es as Y,
|
|
2809
|
+
Fs as Z,
|
|
2810
|
+
ws as _,
|
|
2811
2811
|
$s as a,
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2812
|
+
ms as a0,
|
|
2813
|
+
Ke as a1,
|
|
2814
|
+
Or as a2,
|
|
2815
|
+
Ir as a3,
|
|
2816
|
+
ds as a4,
|
|
2817
|
+
ls as a5,
|
|
2818
|
+
bs as a6,
|
|
2819
|
+
ln as a7,
|
|
2820
|
+
st as a8,
|
|
2821
|
+
cs as a9,
|
|
2822
|
+
us as aa,
|
|
2823
|
+
Cs as ab,
|
|
2824
|
+
Rs as ac,
|
|
2825
|
+
gt as ad,
|
|
2826
|
+
b as ae,
|
|
2827
|
+
vt as af,
|
|
2828
|
+
P as ag,
|
|
2829
|
+
je as ah,
|
|
2830
|
+
te as ai,
|
|
2831
|
+
ks as aj,
|
|
2832
|
+
xs as ak,
|
|
2833
|
+
vs as al,
|
|
2834
|
+
hs as am,
|
|
2835
|
+
As as an,
|
|
2836
|
+
Ss as ao,
|
|
2837
|
+
En as ap,
|
|
2838
|
+
Ls as aq,
|
|
2839
|
+
G as ar,
|
|
2840
|
+
Hs as as,
|
|
2841
|
+
Os as at,
|
|
2842
|
+
Sr as au,
|
|
2843
|
+
kr as av,
|
|
2844
|
+
_ as aw,
|
|
2845
|
+
R as ax,
|
|
2845
2846
|
nt as b,
|
|
2846
2847
|
ur as c,
|
|
2847
2848
|
js as d,
|
|
2848
|
-
|
|
2849
|
+
Ze as e,
|
|
2849
2850
|
L as f,
|
|
2850
|
-
|
|
2851
|
+
Ts as g,
|
|
2851
2852
|
Vn as h,
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2853
|
+
Pt as i,
|
|
2854
|
+
qe as j,
|
|
2855
|
+
hr as k,
|
|
2855
2856
|
Is as l,
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2857
|
+
Pr as m,
|
|
2858
|
+
Cr as n,
|
|
2859
|
+
xe as o,
|
|
2859
2860
|
I as p,
|
|
2860
|
-
|
|
2861
|
+
Z as q,
|
|
2861
2862
|
se as r,
|
|
2862
2863
|
Re as s,
|
|
2863
2864
|
$t as t,
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2865
|
+
Ps as u,
|
|
2866
|
+
ie as v,
|
|
2867
|
+
gs as w,
|
|
2868
|
+
Je as x,
|
|
2869
|
+
Qr as y,
|
|
2870
|
+
Pn as z
|
|
2870
2871
|
};
|
|
2871
|
-
//# sourceMappingURL=testing-
|
|
2872
|
+
//# sourceMappingURL=testing-DR3eQAvY.js.map
|