@nimtech/nimpress 2.3.7 → 2.3.8
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.
|
@@ -163,10 +163,10 @@ function sn(e) {
|
|
|
163
163
|
function Ee(e, t) {
|
|
164
164
|
if (!t) return e;
|
|
165
165
|
const n = { ...e };
|
|
166
|
-
for (const [s,
|
|
167
|
-
if (
|
|
166
|
+
for (const [s, o] of Object.entries(t)) {
|
|
167
|
+
if (o === void 0) continue;
|
|
168
168
|
const i = n[s];
|
|
169
|
-
sn(i) && sn(
|
|
169
|
+
sn(i) && sn(o) ? n[s] = Ee(i, o) : n[s] = o;
|
|
170
170
|
}
|
|
171
171
|
return n;
|
|
172
172
|
}
|
|
@@ -178,15 +178,15 @@ async function Rs(e) {
|
|
|
178
178
|
const i = JSON.parse(zt(n, "utf-8"));
|
|
179
179
|
return { config: nn(i, n), file: n };
|
|
180
180
|
}
|
|
181
|
-
const
|
|
182
|
-
return { config: nn(
|
|
181
|
+
const o = (await Os({ command: "serve", mode: "development" }, n, e))?.config ?? {};
|
|
182
|
+
return { config: nn(o, n), file: n };
|
|
183
183
|
}
|
|
184
184
|
return null;
|
|
185
185
|
}
|
|
186
186
|
async function Ws(e, t) {
|
|
187
|
-
const n = await Rs(e), s = n?.config ? { ...n.config, modules: void 0 } : void 0,
|
|
187
|
+
const n = await Rs(e), s = n?.config ? { ...n.config, modules: void 0 } : void 0, o = t ? { ...t, modules: void 0 } : void 0;
|
|
188
188
|
let i = Ee(Wt, s);
|
|
189
|
-
i = Ee(i,
|
|
189
|
+
i = Ee(i, o), i.css = typeof i.css == "string" ? [i.css] : i.css ?? [], i.base = vs(i.base);
|
|
190
190
|
const c = t?.modules ?? n?.config?.modules;
|
|
191
191
|
return i.modules = {
|
|
192
192
|
dir: Wt.modules.dir,
|
|
@@ -223,10 +223,10 @@ function Hs(e, t) {
|
|
|
223
223
|
return e + " ".repeat(s);
|
|
224
224
|
}
|
|
225
225
|
function Us(e) {
|
|
226
|
-
const t = "╔" + "═".repeat(It + 2) + "╗", n = "╠" + "═".repeat(It + 2) + "╣", s = "╚" + "═".repeat(It + 2) + "╝",
|
|
226
|
+
const t = "╔" + "═".repeat(It + 2) + "╗", n = "╠" + "═".repeat(It + 2) + "╣", s = "╚" + "═".repeat(It + 2) + "╝", o = [t];
|
|
227
227
|
for (let i = 0; i < e.length; i++)
|
|
228
|
-
|
|
229
|
-
return
|
|
228
|
+
o.push("║ " + Hs(e[i], It) + " ║"), i < e.length - 1 && o.push(n);
|
|
229
|
+
return o.push(s), o;
|
|
230
230
|
}
|
|
231
231
|
function Js() {
|
|
232
232
|
try {
|
|
@@ -237,8 +237,8 @@ function Js() {
|
|
|
237
237
|
];
|
|
238
238
|
for (const n of t)
|
|
239
239
|
try {
|
|
240
|
-
const s = zt(n, "utf-8"),
|
|
241
|
-
if (
|
|
240
|
+
const s = zt(n, "utf-8"), o = JSON.parse(s);
|
|
241
|
+
if (o?.name === "@nimtech/nimpress" && typeof o.version == "string") return o.version;
|
|
242
242
|
} catch {
|
|
243
243
|
}
|
|
244
244
|
} catch {
|
|
@@ -246,18 +246,18 @@ function Js() {
|
|
|
246
246
|
return "";
|
|
247
247
|
}
|
|
248
248
|
function qs(e = {}) {
|
|
249
|
-
const t = e.title ?? "Nimpress", n = e.tagline ?? "Docs framework on Svelte", s = e.company ?? `Samna® ${(/* @__PURE__ */ new Date()).getFullYear()}`,
|
|
249
|
+
const t = e.title ?? "Nimpress", n = e.tagline ?? "Docs framework on Svelte", s = e.company ?? `Samna® ${(/* @__PURE__ */ new Date()).getFullYear()}`, o = e.version ?? "dev", i = e.localUrl ?? "http://localhost:5173/", c = e.networkUrl ?? "use --host to expose", u = typeof e.duration == "number" ? `ready in ${e.duration} ms` : "ready", b = e.nimpressVersion ?? Js(), d = [];
|
|
250
250
|
d.push("");
|
|
251
251
|
for (const H of Kt) d.push($n + H + et);
|
|
252
252
|
d.push("");
|
|
253
253
|
const m = [
|
|
254
254
|
`${le}${t}${et}${Ot} · ${s}${et}`,
|
|
255
255
|
`${Ot}${n}${et}`,
|
|
256
|
-
`${Pt}Version${et} ${
|
|
256
|
+
`${Pt}Version${et} ${o} ${Pt}${u}${et}`
|
|
257
257
|
];
|
|
258
258
|
b && m.push(`${Pt}Nimpress${et} ${b}`), m.push(`${Pt}➜${et} Local ${le}${i}${et}`), m.push(`${Pt}➜${et} Network ${oe}${c}${et}`);
|
|
259
|
-
const
|
|
260
|
-
for (const H of
|
|
259
|
+
const w = Us(m), k = Kt[0].length, P = Kt[0].length - Kt[0].trimStart().length, O = It + 4, E = " ".repeat(Math.max(0, Math.floor((k + P - O) / 2)));
|
|
260
|
+
for (const H of w) d.push(E + H);
|
|
261
261
|
return d.push(""), d.join(`
|
|
262
262
|
`);
|
|
263
263
|
}
|
|
@@ -275,8 +275,8 @@ class Be extends Error {
|
|
|
275
275
|
function go(e) {
|
|
276
276
|
const t = e?.diags;
|
|
277
277
|
return Array.isArray(t) && t.length ? t.map((n) => {
|
|
278
|
-
const s = n.location,
|
|
279
|
-
return `${
|
|
278
|
+
const s = n.location, o = s?.start?.line, i = s?.start?.column;
|
|
279
|
+
return `${o ? `line ${o}${i ? `, column ${i}` : ""}: ` : ""}${String(n.message ?? "invalid dbml")}`;
|
|
280
280
|
}).join(`
|
|
281
281
|
`) : e instanceof Error ? e.message : String(e);
|
|
282
282
|
}
|
|
@@ -307,21 +307,21 @@ function re(e, t, n) {
|
|
|
307
307
|
if (!e) return 0;
|
|
308
308
|
const s = Math.max(1, Math.floor(n / t));
|
|
309
309
|
return e.split(`
|
|
310
|
-
`).reduce((
|
|
310
|
+
`).reduce((o, i) => o + Math.max(1, Math.ceil(i.trim().length / s)), 0);
|
|
311
311
|
}
|
|
312
312
|
function be(e) {
|
|
313
313
|
return e.reduce((t, n) => Math.max(t, n.length), 0);
|
|
314
314
|
}
|
|
315
315
|
function So(e, t) {
|
|
316
|
-
const n = be(t.map((b) => b.name)) * oo, s = be(t.map((b) => b.type)) * ro,
|
|
316
|
+
const n = be(t.map((b) => b.name)) * oo, s = be(t.map((b) => b.type)) * ro, o = be(t.map((b) => b.linkLabel)) * co, i = t.some((b) => b.pk || b.fk) ? lo : 0, c = Math.round(n + s + o + i + po), u = Math.round(e.length * xn + 32);
|
|
317
317
|
return Math.min(no, Math.max(eo, c, u));
|
|
318
318
|
}
|
|
319
319
|
function xo(e) {
|
|
320
|
-
const t = e.width - so, n = Math.max(1, re(e.name, xn, t)), s = re(e.note, io, t),
|
|
320
|
+
const t = e.width - so, n = Math.max(1, re(e.name, xn, t)), s = re(e.note, io, t), o = Ys + n * Ks + s * Zs, i = Math.max(e.columns.length, 1) * Gs, c = e.indexes.reduce(
|
|
321
321
|
(b, d) => b + re(`${d.unique ? "unique" : "index"} ${d.columns.join(", ")}`, ao, t),
|
|
322
322
|
0
|
|
323
323
|
), u = e.indexes.length ? Xs + c * Vs : 0;
|
|
324
|
-
return Math.round(
|
|
324
|
+
return Math.round(o + i + u + 2);
|
|
325
325
|
}
|
|
326
326
|
function ko(e) {
|
|
327
327
|
const t = e.width - rn, n = re(e.body, mo, t), s = e.title ? ho : 0;
|
|
@@ -331,13 +331,13 @@ function Po(e, t, n) {
|
|
|
331
331
|
return e.x < t.x + t.width + n && t.x < e.x + e.width + n && e.y < t.y + t.height + n && t.y < e.y + e.height + n;
|
|
332
332
|
}
|
|
333
333
|
function jo(e, t) {
|
|
334
|
-
const n = [...e].sort((s,
|
|
334
|
+
const n = [...e].sort((s, o) => s.y - o.y || s.x - o.x);
|
|
335
335
|
for (let s = 1; s < n.length; s++) {
|
|
336
|
-
let
|
|
337
|
-
for (;
|
|
338
|
-
|
|
336
|
+
let o = !0, i = 0;
|
|
337
|
+
for (; o && i < n.length; ) {
|
|
338
|
+
o = !1, i += 1;
|
|
339
339
|
for (let c = 0; c < s; c++)
|
|
340
|
-
Po(n[s], n[c], t) && (n[s].y = n[c].y + n[c].height + t,
|
|
340
|
+
Po(n[s], n[c], t) && (n[s].y = n[c].y + n[c].height + t, o = !0);
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
343
|
}
|
|
@@ -346,20 +346,20 @@ function Eo(e, t) {
|
|
|
346
346
|
for (const u of e) n.set(u.id, /* @__PURE__ */ new Set());
|
|
347
347
|
for (const [u, b] of t)
|
|
348
348
|
u !== b && (n.get(u)?.add(b), n.get(b)?.add(u));
|
|
349
|
-
const s = new Map(e.map((u) => [u.id, u])),
|
|
349
|
+
const s = new Map(e.map((u) => [u.id, u])), o = /* @__PURE__ */ new Set(), i = [], c = [...e].sort(
|
|
350
350
|
(u, b) => (n.get(b.id)?.size ?? 0) - (n.get(u.id)?.size ?? 0)
|
|
351
351
|
);
|
|
352
352
|
for (const u of c) {
|
|
353
|
-
if (
|
|
353
|
+
if (o.has(u.id)) continue;
|
|
354
354
|
const b = [], d = [u.id];
|
|
355
|
-
for (
|
|
356
|
-
const m = d.shift(),
|
|
357
|
-
|
|
355
|
+
for (o.add(u.id); d.length; ) {
|
|
356
|
+
const m = d.shift(), w = s.get(m);
|
|
357
|
+
w && b.push(w);
|
|
358
358
|
const k = [...n.get(m) ?? []].sort(
|
|
359
|
-
(
|
|
359
|
+
(P, O) => (n.get(O)?.size ?? 0) - (n.get(P)?.size ?? 0)
|
|
360
360
|
);
|
|
361
|
-
for (const
|
|
362
|
-
|
|
361
|
+
for (const P of k)
|
|
362
|
+
o.has(P) || (o.add(P), d.push(P));
|
|
363
363
|
}
|
|
364
364
|
i.push(b);
|
|
365
365
|
}
|
|
@@ -370,33 +370,33 @@ function Do(e, t) {
|
|
|
370
370
|
for (const d of e) s.set(d.id, /* @__PURE__ */ new Set());
|
|
371
371
|
for (const [d, m] of t)
|
|
372
372
|
d === m || !n.has(d) || !n.has(m) || (s.get(d)?.add(m), s.get(m)?.add(d));
|
|
373
|
-
const
|
|
374
|
-
|
|
373
|
+
const o = /* @__PURE__ */ new Map(), i = e[0];
|
|
374
|
+
o.set(i.id, 0);
|
|
375
375
|
const c = [i.id];
|
|
376
376
|
for (; c.length; ) {
|
|
377
377
|
const d = c.shift();
|
|
378
378
|
for (const m of s.get(d) ?? [])
|
|
379
|
-
|
|
379
|
+
o.has(m) || (o.set(m, (o.get(d) ?? 0) + 1), c.push(m));
|
|
380
380
|
}
|
|
381
381
|
const u = /* @__PURE__ */ new Map();
|
|
382
382
|
for (const d of e) {
|
|
383
|
-
const m =
|
|
384
|
-
|
|
383
|
+
const m = o.get(d.id) ?? 0, w = u.get(m) ?? [];
|
|
384
|
+
w.push(d), u.set(m, w);
|
|
385
385
|
}
|
|
386
386
|
const b = [];
|
|
387
|
-
for (const d of [...u.keys()].sort((m,
|
|
387
|
+
for (const d of [...u.keys()].sort((m, w) => m - w)) {
|
|
388
388
|
const m = u.get(d) ?? [];
|
|
389
|
-
for (let
|
|
390
|
-
b.push(m.slice(
|
|
389
|
+
for (let w = 0; w < m.length; w += on)
|
|
390
|
+
b.push(m.slice(w, w + on));
|
|
391
391
|
}
|
|
392
392
|
return b;
|
|
393
393
|
}
|
|
394
394
|
function Ao(e, t) {
|
|
395
395
|
const n = [];
|
|
396
396
|
let s = Lt;
|
|
397
|
-
for (const
|
|
397
|
+
for (const o of Eo(e, t)) {
|
|
398
398
|
let i = Lt, c = s;
|
|
399
|
-
for (const u of Do(
|
|
399
|
+
for (const u of Do(o, t)) {
|
|
400
400
|
const b = Math.max(...u.map((m) => m.width));
|
|
401
401
|
let d = s;
|
|
402
402
|
for (const m of u)
|
|
@@ -408,16 +408,16 @@ function Ao(e, t) {
|
|
|
408
408
|
return n;
|
|
409
409
|
}
|
|
410
410
|
function Co(e) {
|
|
411
|
-
const t = yo(e), n = Object.values(t.database)[0], s = /* @__PURE__ */ new Map(),
|
|
412
|
-
for (const
|
|
413
|
-
for (const A of
|
|
414
|
-
|
|
411
|
+
const t = yo(e), n = Object.values(t.database)[0], s = /* @__PURE__ */ new Map(), o = [];
|
|
412
|
+
for (const _ of Object.values(t.schemas).sort((A, L) => A.id - L.id))
|
|
413
|
+
for (const A of _.tableIds)
|
|
414
|
+
o.push(A), s.set(A, _.name);
|
|
415
415
|
const i = /* @__PURE__ */ new Set();
|
|
416
|
-
for (const
|
|
417
|
-
if (!
|
|
418
|
-
const A = t.tables[String(
|
|
416
|
+
for (const _ of Object.values(t.indexes)) {
|
|
417
|
+
if (!_.pk) continue;
|
|
418
|
+
const A = t.tables[String(_.tableId)];
|
|
419
419
|
if (A)
|
|
420
|
-
for (const L of
|
|
420
|
+
for (const L of _.columnIds) {
|
|
421
421
|
const ot = t.indexColumns[String(L)];
|
|
422
422
|
if (!ot || ot.type !== "column") continue;
|
|
423
423
|
const lt = A.fieldIds.map((mt) => t.fields[String(mt)]).find((mt) => mt && mt.name === ot.value);
|
|
@@ -425,10 +425,10 @@ function Co(e) {
|
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
427
|
const c = [], u = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
|
|
428
|
-
for (const
|
|
429
|
-
const A = t.tables[String(
|
|
428
|
+
for (const _ of o) {
|
|
429
|
+
const A = t.tables[String(_)];
|
|
430
430
|
if (!A) continue;
|
|
431
|
-
const L = s.get(
|
|
431
|
+
const L = s.get(_) ?? "public", ot = L === "public" ? A.name : `${L}.${A.name}`, lt = `table-${_}`, mt = [];
|
|
432
432
|
A.fieldIds.forEach((pt) => {
|
|
433
433
|
const Q = t.fields[String(pt)];
|
|
434
434
|
if (!Q) return;
|
|
@@ -473,15 +473,15 @@ function Co(e) {
|
|
|
473
473
|
};
|
|
474
474
|
wt.height = xo(wt), c.push(wt), u.set(lt, wt), b.set(A.name, lt), b.set(ot, lt);
|
|
475
475
|
}
|
|
476
|
-
for (const
|
|
477
|
-
for (const A of
|
|
476
|
+
for (const _ of c)
|
|
477
|
+
for (const A of _.columns) {
|
|
478
478
|
if (!A.link) continue;
|
|
479
479
|
const L = A.link.replace(/^#/, ""), ot = b.get(L) ?? b.get(A.link);
|
|
480
|
-
!ot || ot ===
|
|
480
|
+
!ot || ot === _.id || (A.target = ot, A.link = "");
|
|
481
481
|
}
|
|
482
|
-
const
|
|
483
|
-
for (const
|
|
484
|
-
const A =
|
|
482
|
+
const w = [];
|
|
483
|
+
for (const _ of Object.values(t.refs).sort((A, L) => A.id - L.id)) {
|
|
484
|
+
const A = _.endpointIds.map((Q) => t.endpoints[String(Q)]).filter(Boolean);
|
|
485
485
|
if (A.length !== 2) continue;
|
|
486
486
|
const L = A[1].relation === "1" ? 1 : A[0].relation === "1" ? 0 : 1, ot = A[L], lt = A[L === 0 ? 1 : 0], mt = ot.fieldIds[0], Et = lt.fieldIds[0];
|
|
487
487
|
if (mt === void 0 || Et === void 0) continue;
|
|
@@ -493,8 +493,8 @@ function Co(e) {
|
|
|
493
493
|
const St = $t.columns[at];
|
|
494
494
|
St.fk = !0, !St.target && !St.link && (St.target = wt);
|
|
495
495
|
}
|
|
496
|
-
|
|
497
|
-
id: `edge-${
|
|
496
|
+
w.push({
|
|
497
|
+
id: `edge-${_.id}`,
|
|
498
498
|
parent: wt,
|
|
499
499
|
parentColumn: d.get(mt) ?? 0,
|
|
500
500
|
child: pt,
|
|
@@ -505,119 +505,119 @@ function Co(e) {
|
|
|
505
505
|
}
|
|
506
506
|
const k = Ao(
|
|
507
507
|
c,
|
|
508
|
-
|
|
509
|
-
),
|
|
508
|
+
w.map((_) => [_.parent, _.child])
|
|
509
|
+
), P = k.length ? k : c, O = [], E = P.reduce((_, A) => Math.max(_, A.x + A.width), Lt);
|
|
510
510
|
let H = Lt;
|
|
511
|
-
const K =
|
|
512
|
-
for (const
|
|
513
|
-
const A = String(
|
|
511
|
+
const K = E + Lt + Sn;
|
|
512
|
+
for (const _ of Object.values(t.notes).sort((A, L) => A.id - L.id)) {
|
|
513
|
+
const A = String(_.content ?? "").trim();
|
|
514
514
|
if (!A) continue;
|
|
515
515
|
const L = {
|
|
516
|
-
id: `note-${
|
|
517
|
-
title:
|
|
516
|
+
id: `note-${_.id}`,
|
|
517
|
+
title: _.name ?? "",
|
|
518
518
|
body: A,
|
|
519
519
|
x: K,
|
|
520
520
|
y: H,
|
|
521
521
|
width: uo,
|
|
522
522
|
height: 0
|
|
523
523
|
};
|
|
524
|
-
L.height = ko(L),
|
|
524
|
+
L.height = ko(L), O.push(L), H += L.height + an;
|
|
525
525
|
}
|
|
526
|
-
jo([...
|
|
526
|
+
jo([...P, ...O], an);
|
|
527
527
|
const st = [];
|
|
528
|
-
for (const
|
|
529
|
-
const A = u.get(
|
|
528
|
+
for (const _ of w) {
|
|
529
|
+
const A = u.get(_.parent), L = u.get(_.child);
|
|
530
530
|
if (!A || !L) continue;
|
|
531
531
|
const ot = A.x + A.width / 2 <= L.x + L.width / 2 ? "r" : "l", lt = ot === "r" ? "l" : "r";
|
|
532
532
|
st.push({
|
|
533
|
-
id:
|
|
533
|
+
id: _.id,
|
|
534
534
|
source: A.id,
|
|
535
|
-
sourceHandle: `${ot}-${
|
|
535
|
+
sourceHandle: `${ot}-${_.parentColumn}`,
|
|
536
536
|
target: L.id,
|
|
537
|
-
targetHandle: `${lt}-${
|
|
538
|
-
many:
|
|
537
|
+
targetHandle: `${lt}-${_.childColumn}`,
|
|
538
|
+
many: _.many
|
|
539
539
|
});
|
|
540
540
|
}
|
|
541
541
|
return {
|
|
542
542
|
database: n?.name ?? "",
|
|
543
|
-
tables:
|
|
543
|
+
tables: P,
|
|
544
544
|
edges: st,
|
|
545
|
-
notes:
|
|
545
|
+
notes: O
|
|
546
546
|
};
|
|
547
547
|
}
|
|
548
548
|
function kn(e) {
|
|
549
549
|
return JSON.stringify(Co(e));
|
|
550
550
|
}
|
|
551
551
|
function Oo(e, t, n = "") {
|
|
552
|
-
const s = e.match(/<script[^>]*\bsetup\b[^>]*>([\s\S]*?)<\/script>/)?.[1] ?? "",
|
|
552
|
+
const s = e.match(/<script[^>]*\bsetup\b[^>]*>([\s\S]*?)<\/script>/)?.[1] ?? "", o = e.match(/<template>([\s\S]*)<\/template>/)?.[1] ?? "", i = `${s}
|
|
553
553
|
${n}`;
|
|
554
554
|
let c = null;
|
|
555
555
|
const u = /defineProps<\s*\{/.exec(s);
|
|
556
556
|
if (u)
|
|
557
557
|
c = Ut(s, u.index + u[0].length);
|
|
558
558
|
else {
|
|
559
|
-
const
|
|
560
|
-
|
|
559
|
+
const E = s.match(/defineProps<\s*([A-Za-z_$][\w$]*)\s*>/);
|
|
560
|
+
E && (c = ae(i, E[1]));
|
|
561
561
|
}
|
|
562
562
|
const b = /* @__PURE__ */ new Map(), d = s.match(/(?:const|let)\s*\{([\s\S]*?)\}\s*=\s*(?:withDefaults\s*\(\s*)?defineProps/);
|
|
563
563
|
if (d)
|
|
564
|
-
for (const
|
|
565
|
-
const H =
|
|
564
|
+
for (const E of je(d[1])) {
|
|
565
|
+
const H = E.match(/^([A-Za-z_$][\w$]*)\s*=\s*([\s\S]+)$/);
|
|
566
566
|
H && b.set(H[1], wn(H[2]));
|
|
567
567
|
}
|
|
568
568
|
const m = [];
|
|
569
569
|
if (c)
|
|
570
|
-
for (const
|
|
570
|
+
for (const E of Ne(c)) {
|
|
571
571
|
const H = Fe(
|
|
572
|
-
ce(
|
|
573
|
-
|
|
572
|
+
ce(E.name, E.type, E.optional, i, E.description),
|
|
573
|
+
E
|
|
574
574
|
);
|
|
575
|
-
b.has(
|
|
575
|
+
b.has(E.name) && (H.default = b.get(E.name)), m.push(H);
|
|
576
576
|
}
|
|
577
|
-
for (const
|
|
578
|
-
const H =
|
|
579
|
-
if (m.some((
|
|
580
|
-
const K = ce(H,
|
|
577
|
+
for (const E of s.matchAll(/\bdefineModel(?:<([^>]*)>)?\(\s*(?:['"]([\w-]+)['"])?/g)) {
|
|
578
|
+
const H = E[2] ?? "modelValue";
|
|
579
|
+
if (m.some((_) => _.name === H)) continue;
|
|
580
|
+
const K = ce(H, E[1]?.trim() || "string", !0, i);
|
|
581
581
|
K.bindable = !0;
|
|
582
|
-
const st = s.slice(0,
|
|
582
|
+
const st = s.slice(0, E.index).match(/\/\*\*((?:[^*]|\*(?!\/))*)\*\/\s*(?:const|let)\s+[\w$]+\s*=\s*$/);
|
|
583
583
|
if (st) {
|
|
584
|
-
const
|
|
585
|
-
|
|
584
|
+
const _ = ws(st[1].replace(/^\s*\*\s?/gm, "").trim());
|
|
585
|
+
_.description && (K.description = _.description), _.mock && !K.mock && (K.mock = _.mock);
|
|
586
586
|
}
|
|
587
587
|
m.push(K);
|
|
588
588
|
}
|
|
589
|
-
const
|
|
590
|
-
for (const
|
|
591
|
-
const H =
|
|
592
|
-
if (!H && /(?:^|\s)(?::|v-bind:)name=/.test(
|
|
589
|
+
const w = [], k = /* @__PURE__ */ new Set();
|
|
590
|
+
for (const E of o.matchAll(/<slot\b([^>]*)>/g)) {
|
|
591
|
+
const H = E[1].match(/(?:^|[^:\w-])name=["']([^"']+)["']/)?.[1];
|
|
592
|
+
if (!H && /(?:^|\s)(?::|v-bind:)name=/.test(E[1])) continue;
|
|
593
593
|
const K = H ?? "default";
|
|
594
|
-
k.has(K) || (k.add(K),
|
|
594
|
+
k.has(K) || (k.add(K), w.push({ name: K, kind: "slot", type: "slot" }));
|
|
595
595
|
}
|
|
596
|
-
const
|
|
597
|
-
if (
|
|
598
|
-
const
|
|
596
|
+
const P = [], O = s.indexOf("defineEmits");
|
|
597
|
+
if (O >= 0) {
|
|
598
|
+
const E = s.slice(O), H = E.search(/[<(]/);
|
|
599
599
|
if (H >= 0) {
|
|
600
|
-
const K =
|
|
601
|
-
for (const L of
|
|
602
|
-
for (const L of
|
|
603
|
-
for (const L of
|
|
604
|
-
for (const L of
|
|
605
|
-
|
|
600
|
+
const K = E[H], st = K === "<" ? ">" : ")", _ = Ut(E, H + 1, K, st), A = /* @__PURE__ */ new Set();
|
|
601
|
+
for (const L of _.matchAll(/['"]([\w:.-]+)['"]\s*:\s*\[/g)) A.add(L[1]);
|
|
602
|
+
for (const L of _.matchAll(/\(\s*\w+\s*:\s*['"]([\w:.-]+)['"]/g)) A.add(L[1]);
|
|
603
|
+
for (const L of _.matchAll(/[,\[]\s*['"]([\w:.-]+)['"]\s*[,\]]/g)) A.add(L[1]);
|
|
604
|
+
for (const L of _.matchAll(/(?:^|[\n;{,])\s*([A-Za-z_$][\w$]*)\s*:\s*\[/g)) A.add(L[1]);
|
|
605
|
+
P.push(...A);
|
|
606
606
|
}
|
|
607
607
|
}
|
|
608
|
-
for (const
|
|
609
|
-
(
|
|
610
|
-
return { component: t, props: m, slots:
|
|
608
|
+
for (const E of m)
|
|
609
|
+
(E.bindable || P.includes(`update:${E.name}`)) && (E.bindable = !0, P.includes(`update:${E.name}`) || P.push(`update:${E.name}`));
|
|
610
|
+
return { component: t, props: m, slots: w, emits: P };
|
|
611
611
|
}
|
|
612
612
|
function Mo(e, t, n = "") {
|
|
613
|
-
const s = e.match(/<script[^>]*>([\s\S]*?)<\/script>/)?.[1] ?? "",
|
|
613
|
+
const s = e.match(/<script[^>]*>([\s\S]*?)<\/script>/)?.[1] ?? "", o = `${s}
|
|
614
614
|
${n}`, i = s.match(/(?:let|const)\s*\{([\s\S]*?)\}\s*(?::\s*([\s\S]*?))?=\s*\$props\(\)/), c = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Set();
|
|
615
615
|
if (i)
|
|
616
|
-
for (const
|
|
617
|
-
const
|
|
618
|
-
if (!
|
|
619
|
-
const
|
|
620
|
-
|
|
616
|
+
for (const P of je(i[1])) {
|
|
617
|
+
const O = P.match(/^([A-Za-z_$][\w$]*)\s*=\s*([\s\S]+)$/);
|
|
618
|
+
if (!O) continue;
|
|
619
|
+
const E = O[2].trim().match(/^\$bindable\(([\s\S]*)\)$/);
|
|
620
|
+
E && u.add(O[1]), c.set(O[1], wn(E ? E[1] : O[2]));
|
|
621
621
|
}
|
|
622
622
|
let b = null;
|
|
623
623
|
const d = i?.[2]?.trim();
|
|
@@ -625,36 +625,36 @@ ${n}`, i = s.match(/(?:let|const)\s*\{([\s\S]*?)\}\s*(?::\s*([\s\S]*?))?=\s*\$pr
|
|
|
625
625
|
if (d.startsWith("{"))
|
|
626
626
|
b = Ut(d, 1);
|
|
627
627
|
else {
|
|
628
|
-
const
|
|
629
|
-
|
|
628
|
+
const P = d.match(/^([A-Za-z_$][\w$]*)/);
|
|
629
|
+
P && (b = ae(o, P[1]));
|
|
630
630
|
}
|
|
631
|
-
const m = [],
|
|
631
|
+
const m = [], w = [], k = [];
|
|
632
632
|
if (b)
|
|
633
|
-
for (const
|
|
634
|
-
if (/\bSnippet\b/.test(
|
|
635
|
-
|
|
633
|
+
for (const P of Ne(b)) {
|
|
634
|
+
if (/\bSnippet\b/.test(P.type)) {
|
|
635
|
+
w.push({ name: P.name, kind: "slot", type: P.type, required: !P.optional });
|
|
636
636
|
continue;
|
|
637
637
|
}
|
|
638
|
-
if (/^on[A-Z]/.test(
|
|
639
|
-
k.push(
|
|
638
|
+
if (/^on[A-Z]/.test(P.name) && /=>/.test(P.type)) {
|
|
639
|
+
k.push(P.name);
|
|
640
640
|
continue;
|
|
641
641
|
}
|
|
642
|
-
const
|
|
643
|
-
ce(
|
|
644
|
-
|
|
642
|
+
const O = Fe(
|
|
643
|
+
ce(P.name, P.type, P.optional, o, P.description),
|
|
644
|
+
P
|
|
645
645
|
);
|
|
646
|
-
c.has(
|
|
646
|
+
c.has(P.name) && (O.default = c.get(P.name)), u.has(P.name) && (O.bindable = !0), m.push(O);
|
|
647
647
|
}
|
|
648
648
|
else if (i) {
|
|
649
|
-
for (const
|
|
650
|
-
const
|
|
651
|
-
if (!
|
|
652
|
-
const
|
|
653
|
-
c.has(
|
|
649
|
+
for (const P of je(i[1])) {
|
|
650
|
+
const O = P.match(/^([A-Za-z_$][\w$]*)/)?.[1];
|
|
651
|
+
if (!O || O === "children") continue;
|
|
652
|
+
const E = { name: O, kind: "json", type: "unknown" };
|
|
653
|
+
c.has(O) && (E.default = c.get(O)), u.has(O) && (E.bindable = !0), m.push(E);
|
|
654
654
|
}
|
|
655
|
-
/\bchildren\b/.test(i[1]) &&
|
|
655
|
+
/\bchildren\b/.test(i[1]) && w.push({ name: "children", kind: "slot", type: "Snippet" });
|
|
656
656
|
}
|
|
657
|
-
return { component: t, props: m, slots:
|
|
657
|
+
return { component: t, props: m, slots: w, emits: k };
|
|
658
658
|
}
|
|
659
659
|
function Pn(e, t = []) {
|
|
660
660
|
let n;
|
|
@@ -664,24 +664,24 @@ function Pn(e, t = []) {
|
|
|
664
664
|
return t;
|
|
665
665
|
}
|
|
666
666
|
for (const s of n) {
|
|
667
|
-
const
|
|
667
|
+
const o = W(e, s.name);
|
|
668
668
|
if (s.isDirectory()) {
|
|
669
669
|
if (s.name === "node_modules") continue;
|
|
670
|
-
Pn(
|
|
671
|
-
} else s.isFile() && s.name.endsWith(".d.ts") && t.push(
|
|
670
|
+
Pn(o, t);
|
|
671
|
+
} else s.isFile() && s.name.endsWith(".d.ts") && t.push(o);
|
|
672
672
|
}
|
|
673
673
|
return t;
|
|
674
674
|
}
|
|
675
675
|
function _o(e, t, n) {
|
|
676
676
|
const s = W(e, "node_modules", t);
|
|
677
677
|
if (!dt(s) || !ie(s).isDirectory()) return null;
|
|
678
|
-
const
|
|
678
|
+
const o = [
|
|
679
679
|
`${n}.vue.d.ts`,
|
|
680
680
|
`${n}.svelte.d.ts`,
|
|
681
681
|
`${n}.d.ts`,
|
|
682
682
|
`${n.toLowerCase()}/index.d.ts`
|
|
683
683
|
], i = Pn(s);
|
|
684
|
-
for (const c of
|
|
684
|
+
for (const c of o) {
|
|
685
685
|
const u = i.find((b) => b.endsWith(`/${c}`));
|
|
686
686
|
if (u) return u;
|
|
687
687
|
}
|
|
@@ -690,10 +690,10 @@ function _o(e, t, n) {
|
|
|
690
690
|
function ti(e, t) {
|
|
691
691
|
const n = ae(e, `${t}Props`) ?? ae(e, "Props");
|
|
692
692
|
if (!n) return;
|
|
693
|
-
const s = [],
|
|
693
|
+
const s = [], o = [], i = [];
|
|
694
694
|
for (const c of Ne(n)) {
|
|
695
695
|
if (/\bSnippet\b/.test(c.type)) {
|
|
696
|
-
|
|
696
|
+
o.push({ name: c.name, kind: "slot", type: c.type, required: !c.optional });
|
|
697
697
|
continue;
|
|
698
698
|
}
|
|
699
699
|
if (/^on[A-Z]/.test(c.name) && /=>/.test(c.type)) {
|
|
@@ -702,16 +702,16 @@ function ti(e, t) {
|
|
|
702
702
|
}
|
|
703
703
|
s.push(Fe(ce(c.name, c.type, c.optional, e, c.description), c));
|
|
704
704
|
}
|
|
705
|
-
return { component: t, props: s, slots:
|
|
705
|
+
return { component: t, props: s, slots: o, emits: i };
|
|
706
706
|
}
|
|
707
707
|
function ve(e, t) {
|
|
708
708
|
const n = e.search(new RegExp(`\\b${t}\\s*:`));
|
|
709
709
|
if (n < 0) return;
|
|
710
710
|
const s = e.indexOf("{", n);
|
|
711
711
|
if (s < 0) return;
|
|
712
|
-
const
|
|
712
|
+
const o = Ut(e, s + 1);
|
|
713
713
|
try {
|
|
714
|
-
return new Function(`return {${
|
|
714
|
+
return new Function(`return {${o}}`)();
|
|
715
715
|
} catch {
|
|
716
716
|
return;
|
|
717
717
|
}
|
|
@@ -721,18 +721,18 @@ function we(e, t) {
|
|
|
721
721
|
if (n < 0) return e;
|
|
722
722
|
const s = e.indexOf("{", n);
|
|
723
723
|
if (s < 0) return e;
|
|
724
|
-
const
|
|
725
|
-
return e.slice(0, n) + e.slice(s + 1 +
|
|
724
|
+
const o = Ut(e, s + 1);
|
|
725
|
+
return e.slice(0, n) + e.slice(s + 1 + o.length + 1);
|
|
726
726
|
}
|
|
727
727
|
function To(e, t) {
|
|
728
|
-
const n = e.match(/^\s*\/\/\s*story:\s*(.+)$/m)?.[1]?.trim(), s = we(we(e, "props"), "slots"),
|
|
728
|
+
const n = e.match(/^\s*\/\/\s*story:\s*(.+)$/m)?.[1]?.trim(), s = we(we(e, "props"), "slots"), o = ve(s, "sidebar"), i = we(s, "sidebar"), c = i.match(/\bname\s*:\s*['"]([^'"]+)['"]/)?.[1], u = i.match(/\bdescription\s*:\s*['"]([^'"]+)['"]/)?.[1], b = ve(e, "props"), d = ve(e, "slots");
|
|
729
729
|
return {
|
|
730
730
|
name: n ?? c ?? Mt(t).replace(/\.story\.tsx?$/, "").replace(/_/g, " "),
|
|
731
731
|
file: t,
|
|
732
732
|
description: u,
|
|
733
733
|
props: b,
|
|
734
734
|
slots: d,
|
|
735
|
-
sidebar:
|
|
735
|
+
sidebar: o
|
|
736
736
|
};
|
|
737
737
|
}
|
|
738
738
|
async function No(e) {
|
|
@@ -745,22 +745,22 @@ async function No(e) {
|
|
|
745
745
|
const n = [];
|
|
746
746
|
for (const s of t) {
|
|
747
747
|
if (!s.isFile() || !s.name.match(/\.story\.tsx?$/)) continue;
|
|
748
|
-
let
|
|
748
|
+
let o;
|
|
749
749
|
try {
|
|
750
|
-
|
|
750
|
+
o = await it(W(e, s.name), "utf-8");
|
|
751
751
|
} catch {
|
|
752
752
|
continue;
|
|
753
753
|
}
|
|
754
|
-
n.push(To(
|
|
754
|
+
n.push(To(o, s.name));
|
|
755
755
|
}
|
|
756
|
-
return n.sort((s,
|
|
756
|
+
return n.sort((s, o) => s.name.localeCompare(o.name)), n;
|
|
757
757
|
}
|
|
758
|
-
function ue(e, t, n, s,
|
|
758
|
+
function ue(e, t, n, s, o) {
|
|
759
759
|
const i = t.systems[n];
|
|
760
760
|
if (!i?.source) return null;
|
|
761
|
-
const c = q(e, i.source), u = i.framework === "vue" ? ".vue" : ".svelte", b =
|
|
761
|
+
const c = q(e, i.source), u = i.framework === "vue" ? ".vue" : ".svelte", b = o ? [q(c, o)] : [W(c, s, s + u), W(c, s + u)];
|
|
762
762
|
for (const d of b) {
|
|
763
|
-
if (!
|
|
763
|
+
if (!o && !d.startsWith(c) || !dt(d)) continue;
|
|
764
764
|
const m = G(d);
|
|
765
765
|
return {
|
|
766
766
|
systemConfig: i,
|
|
@@ -779,16 +779,16 @@ async function jn(e, t = []) {
|
|
|
779
779
|
return t;
|
|
780
780
|
}
|
|
781
781
|
for (const s of n) {
|
|
782
|
-
const
|
|
782
|
+
const o = W(e, s.name);
|
|
783
783
|
if (s.isDirectory()) {
|
|
784
784
|
if (s.name.startsWith(".") || s.name === "node_modules") continue;
|
|
785
|
-
await jn(
|
|
786
|
-
} else s.isFile() && s.name.endsWith(".md") && t.push(
|
|
785
|
+
await jn(o, t);
|
|
786
|
+
} else s.isFile() && s.name.endsWith(".md") && t.push(o);
|
|
787
787
|
}
|
|
788
788
|
return t;
|
|
789
789
|
}
|
|
790
790
|
async function Re(e, t) {
|
|
791
|
-
const n = q(e, t), s = await jn(n),
|
|
791
|
+
const n = q(e, t), s = await jn(n), o = [];
|
|
792
792
|
for (const i of s) {
|
|
793
793
|
let c;
|
|
794
794
|
try {
|
|
@@ -799,7 +799,7 @@ async function Re(e, t) {
|
|
|
799
799
|
const { data: u } = Te(c);
|
|
800
800
|
if (u?.type !== "component") continue;
|
|
801
801
|
const b = u.data ?? {}, d = String(b.system ?? ""), m = String(b.component ?? "");
|
|
802
|
-
!d || !m ||
|
|
802
|
+
!d || !m || o.push({
|
|
803
803
|
pageFile: i,
|
|
804
804
|
system: d,
|
|
805
805
|
component: m,
|
|
@@ -808,7 +808,7 @@ async function Re(e, t) {
|
|
|
808
808
|
version: typeof b.version == "string" ? b.version : void 0
|
|
809
809
|
});
|
|
810
810
|
}
|
|
811
|
-
return
|
|
811
|
+
return o;
|
|
812
812
|
}
|
|
813
813
|
function Gt(e) {
|
|
814
814
|
const t = W(e, "schema.yml");
|
|
@@ -833,12 +833,12 @@ async function We(e, t, n) {
|
|
|
833
833
|
}
|
|
834
834
|
const Fo = ["description", "default", "enum", "mock", "format", "minimum", "maximum", "title"], Io = ["type", "tsType", "bindable"];
|
|
835
835
|
function Ht(e, t) {
|
|
836
|
-
const n = { ...e }, s = n,
|
|
836
|
+
const n = { ...e }, s = n, o = t;
|
|
837
837
|
for (const i of Io)
|
|
838
|
-
|
|
838
|
+
o[i] !== void 0 && (s[i] = o[i]);
|
|
839
839
|
t.type !== void 0 && t.tsType === void 0 && delete n.tsType, t.required !== void 0 && (n.required = t.required);
|
|
840
840
|
for (const i of Fo)
|
|
841
|
-
s[i] === void 0 &&
|
|
841
|
+
s[i] === void 0 && o[i] !== void 0 && (s[i] = o[i]);
|
|
842
842
|
if (t.properties) {
|
|
843
843
|
const i = {};
|
|
844
844
|
for (const [c, u] of Object.entries(t.properties)) {
|
|
@@ -852,13 +852,13 @@ function Ht(e, t) {
|
|
|
852
852
|
return t.items && (n.items = e.items ? Ht(e.items, t.items) : t.items), t.additionalProperties && (n.additionalProperties = e.additionalProperties ? Ht(e.additionalProperties, t.additionalProperties) : t.additionalProperties), n;
|
|
853
853
|
}
|
|
854
854
|
function Le(e, t) {
|
|
855
|
-
const n = t, s = { added: [], missing: [] },
|
|
855
|
+
const n = t, s = { added: [], missing: [] }, o = {};
|
|
856
856
|
for (const [b, d] of Object.entries(n.properties ?? {})) {
|
|
857
857
|
const m = e.properties?.[b];
|
|
858
|
-
m ?
|
|
858
|
+
m ? o[b] = Ht(m, d) : (o[b] = d, s.added.push(b));
|
|
859
859
|
}
|
|
860
860
|
for (const [b, d] of Object.entries(e.properties ?? {}))
|
|
861
|
-
b in
|
|
861
|
+
b in o || (o[b] = d, s.missing.push(`prop ${b}`));
|
|
862
862
|
const i = {};
|
|
863
863
|
for (const [b, d] of Object.entries(n.slots ?? {})) {
|
|
864
864
|
const m = e.slots?.[b];
|
|
@@ -869,7 +869,7 @@ function Le(e, t) {
|
|
|
869
869
|
const c = [...n.emits ?? []];
|
|
870
870
|
for (const b of e.emits ?? [])
|
|
871
871
|
c.includes(b) || (c.push(b), s.missing.push(`emit ${b}`));
|
|
872
|
-
return { merged: { ...e, ...t, properties:
|
|
872
|
+
return { merged: { ...e, ...t, properties: o, slots: i, emits: c }, report: s };
|
|
873
873
|
}
|
|
874
874
|
const Bt = [], cn = /* @__PURE__ */ new Set();
|
|
875
875
|
function Bo(e) {
|
|
@@ -899,18 +899,18 @@ function Nt(e = process.cwd()) {
|
|
|
899
899
|
}
|
|
900
900
|
const n = Bt.length;
|
|
901
901
|
Bt.length = 0;
|
|
902
|
-
const s = n === 1 ? "schema warning" : "schema warnings",
|
|
903
|
-
i.push(` ${Pt}${le}nimpress modules${et} ${Ot}${n} ${s} in ${t.size} ${
|
|
902
|
+
const s = n === 1 ? "schema warning" : "schema warnings", o = t.size === 1 ? "component" : "components", i = [""];
|
|
903
|
+
i.push(` ${Pt}${le}nimpress modules${et} ${Ot}${n} ${s} in ${t.size} ${o}${et}`), i.push("");
|
|
904
904
|
for (const [c, u] of t) {
|
|
905
|
-
const b = u.find((
|
|
905
|
+
const b = u.find((w) => w.sourceFile)?.sourceFile;
|
|
906
906
|
i.push(` ${$n}${le}${c}${et}${b ? ` ${oe}${jt(e, b)}${et}` : ""}`);
|
|
907
|
-
const d = Math.max(...u.map((
|
|
908
|
-
for (const
|
|
909
|
-
const k = (
|
|
910
|
-
i.push(` ${Ot}${k}${et} ${Pt}${
|
|
907
|
+
const d = Math.max(...u.map((w) => (w.line ? `L${w.line}` : "·").length)), m = Math.max(...u.map((w) => (w.path || "(component)").length));
|
|
908
|
+
for (const w of u) {
|
|
909
|
+
const k = (w.line ? `L${w.line}` : "·").padStart(d), P = (w.path || "(component)").padEnd(m);
|
|
910
|
+
i.push(` ${Ot}${k}${et} ${Pt}${P}${et} ${Wo(w.detail)}`);
|
|
911
911
|
}
|
|
912
|
-
for (const
|
|
913
|
-
i.push(` ${Pt}→${et} ${oe}${Ro[
|
|
912
|
+
for (const w of new Set(u.map((k) => k.kind)))
|
|
913
|
+
i.push(` ${Pt}→${et} ${oe}${Ro[w]}${et}`);
|
|
914
914
|
i.push(` ${Pt}→${et} ${oe}then run${et} nimpress modules update ${c}`), i.push("");
|
|
915
915
|
}
|
|
916
916
|
console.warn(i.join(`
|
|
@@ -921,18 +921,18 @@ function pn(e, t) {
|
|
|
921
921
|
const n = t.split(".").filter((c) => c && c !== "[]").pop();
|
|
922
922
|
if (!n) return;
|
|
923
923
|
const s = e.split(`
|
|
924
|
-
`),
|
|
924
|
+
`), o = new RegExp(`(^|[^\\w$])${n}\\s*[?:]`);
|
|
925
925
|
for (let c = 0; c < s.length; c++)
|
|
926
|
-
if (
|
|
926
|
+
if (o.test(s[c])) return c + 1;
|
|
927
927
|
const i = new RegExp(`\\b${n}\\b`);
|
|
928
928
|
for (let c = 0; c < s.length; c++)
|
|
929
929
|
if (i.test(s[c])) return c + 1;
|
|
930
930
|
}
|
|
931
931
|
function un(e, t, n = {}) {
|
|
932
|
-
const s = [],
|
|
933
|
-
for (const i of
|
|
932
|
+
const s = [], o = Ie(e, t);
|
|
933
|
+
for (const i of o.props.filter((c) => !c.description))
|
|
934
934
|
s.push({ component: e, sourceFile: n.sourceFile, line: pn(n.sourceText, i.name), path: i.name, detail: "has no description", kind: "undocumented" });
|
|
935
|
-
for (const i of $s(
|
|
935
|
+
for (const i of $s(o.props))
|
|
936
936
|
s.push({ component: e, sourceFile: n.sourceFile, line: pn(n.sourceText, i.path), path: i.path, detail: `type ${i.type} is opaque`, kind: "opaque" });
|
|
937
937
|
for (const i of n.report?.missing ?? [])
|
|
938
938
|
s.push({ component: e, sourceFile: n.sourceFile, path: i, detail: "has no counterpart in the component source", kind: "orphan" });
|
|
@@ -940,11 +940,11 @@ function un(e, t, n = {}) {
|
|
|
940
940
|
}
|
|
941
941
|
async function He(e, t, n, s) {
|
|
942
942
|
if (!n) return;
|
|
943
|
-
const
|
|
943
|
+
const o = Ss(t, n.props, n.slots, n.emits), i = s ? await it(s, "utf-8").catch(() => {
|
|
944
944
|
}) : void 0, c = Gt(e);
|
|
945
945
|
if (!c) {
|
|
946
946
|
const k = W(e, "schema.json");
|
|
947
|
-
await nt(k, Jt(
|
|
947
|
+
await nt(k, Jt(o, "json")), console.log(`nimpress modules: ${t} schema seeded at ${k} — the file is yours to author from here`), ln(un(t, o, { sourceFile: s, sourceText: i }));
|
|
948
948
|
return;
|
|
949
949
|
}
|
|
950
950
|
const u = await it(c.path, "utf-8");
|
|
@@ -955,9 +955,9 @@ async function He(e, t, n, s) {
|
|
|
955
955
|
console.warn(`nimpress modules: ${t} ${Mt(c.path)} failed to parse, left untouched: ${String(k)}`);
|
|
956
956
|
return;
|
|
957
957
|
}
|
|
958
|
-
const { merged: d, report: m } = Le(b,
|
|
959
|
-
if (
|
|
960
|
-
await nt(c.path,
|
|
958
|
+
const { merged: d, report: m } = Le(b, o), w = Jt(d, c.form);
|
|
959
|
+
if (w !== u) {
|
|
960
|
+
await nt(c.path, w);
|
|
961
961
|
const k = m.added.length ? `, added ${m.added.join(", ")}` : "";
|
|
962
962
|
console.log(`nimpress modules: ${t} schema upserted at ${c.path}${k}`);
|
|
963
963
|
}
|
|
@@ -965,13 +965,13 @@ async function He(e, t, n, s) {
|
|
|
965
965
|
}
|
|
966
966
|
const fn = /* @__PURE__ */ new Map();
|
|
967
967
|
async function Lo(e, t, n, s) {
|
|
968
|
-
let
|
|
968
|
+
let o;
|
|
969
969
|
try {
|
|
970
|
-
|
|
970
|
+
o = await it(n, "utf-8");
|
|
971
971
|
} catch {
|
|
972
972
|
return;
|
|
973
973
|
}
|
|
974
|
-
const i = bn("sha1").update(
|
|
974
|
+
const i = bn("sha1").update(o).digest("hex");
|
|
975
975
|
if (fn.get(n) === i) return;
|
|
976
976
|
fn.set(n, i);
|
|
977
977
|
const c = await We(n, s, t);
|
|
@@ -983,7 +983,7 @@ async function ei(e, t) {
|
|
|
983
983
|
await nt(W(e, "schema.json"), Jt(t, "json"));
|
|
984
984
|
return;
|
|
985
985
|
}
|
|
986
|
-
const s = await it(n.path, "utf-8"),
|
|
986
|
+
const s = await it(n.path, "utf-8"), o = Vt(s, n.form), { merged: i } = Le(t, o);
|
|
987
987
|
await nt(n.path, Jt(i, n.form));
|
|
988
988
|
}
|
|
989
989
|
function De(e) {
|
|
@@ -991,9 +991,9 @@ function De(e) {
|
|
|
991
991
|
return t === ".vue" ? "vue" : t === ".svelte" ? "svelte" : null;
|
|
992
992
|
}
|
|
993
993
|
function Ho(e, t, n) {
|
|
994
|
-
for (const [s,
|
|
995
|
-
if (!
|
|
996
|
-
const i = q(e,
|
|
994
|
+
for (const [s, o] of Object.entries(t.modules.systems)) {
|
|
995
|
+
if (!o.source) continue;
|
|
996
|
+
const i = q(e, o.source);
|
|
997
997
|
if (n.startsWith(i + "/") || n.startsWith(i + "\\")) return s;
|
|
998
998
|
}
|
|
999
999
|
return null;
|
|
@@ -1002,20 +1002,20 @@ function Uo(e, t, n) {
|
|
|
1002
1002
|
return e.find((s) => s.system === t && s.component === n);
|
|
1003
1003
|
}
|
|
1004
1004
|
async function Jo(e, t, n) {
|
|
1005
|
-
const s = await Re(e, t.contentDir),
|
|
1006
|
-
if ((n.includes("/") || n.includes("\\")) && dt(
|
|
1007
|
-
const d = De(
|
|
1005
|
+
const s = await Re(e, t.contentDir), o = q(e, n);
|
|
1006
|
+
if ((n.includes("/") || n.includes("\\")) && dt(o)) {
|
|
1007
|
+
const d = De(o);
|
|
1008
1008
|
if (!d)
|
|
1009
1009
|
throw new Error(`[nimpress] modules: ${n} is not a .vue or .svelte component file`);
|
|
1010
|
-
const m = Mt(
|
|
1011
|
-
if (!
|
|
1010
|
+
const m = Mt(o, _e(o)), w = Ho(e, t, o);
|
|
1011
|
+
if (!w)
|
|
1012
1012
|
throw new Error(`[nimpress] modules: ${n} sits under no configured system source`);
|
|
1013
|
-
const k = Uo(s,
|
|
1013
|
+
const k = Uo(s, w, m);
|
|
1014
1014
|
if (!k)
|
|
1015
1015
|
throw new Error(
|
|
1016
|
-
`[nimpress] modules: no component page found for ${
|
|
1016
|
+
`[nimpress] modules: no component page found for ${w}/${m}, run nimpress modules create ${w} ${m} first`
|
|
1017
1017
|
);
|
|
1018
|
-
return { system:
|
|
1018
|
+
return { system: w, component: m, framework: d, componentFile: o, pageDir: G(k.pageFile) };
|
|
1019
1019
|
}
|
|
1020
1020
|
const i = s.filter((d) => d.component === n);
|
|
1021
1021
|
if (!i.length)
|
|
@@ -1039,10 +1039,10 @@ async function Jo(e, t, n) {
|
|
|
1039
1039
|
};
|
|
1040
1040
|
}
|
|
1041
1041
|
async function qo(e, t, n) {
|
|
1042
|
-
const s = await Jo(e, t, n),
|
|
1043
|
-
if (!
|
|
1042
|
+
const s = await Jo(e, t, n), o = await We(s.componentFile, s.framework, s.component);
|
|
1043
|
+
if (!o)
|
|
1044
1044
|
throw new Error(`[nimpress] modules: schema parse produced nothing for ${s.component}`);
|
|
1045
|
-
await He(s.pageDir, s.component,
|
|
1045
|
+
await He(s.pageDir, s.component, o);
|
|
1046
1046
|
const i = Gt(s.pageDir);
|
|
1047
1047
|
return jt(e, i?.path ?? W(s.pageDir, "schema.json"));
|
|
1048
1048
|
}
|
|
@@ -1050,7 +1050,7 @@ async function ni(e, t, n = {}) {
|
|
|
1050
1050
|
if (n.ref)
|
|
1051
1051
|
return await qo(e, t, n.ref), 1;
|
|
1052
1052
|
const s = await Re(e, t.contentDir);
|
|
1053
|
-
let
|
|
1053
|
+
let o = 0;
|
|
1054
1054
|
for (const i of s) {
|
|
1055
1055
|
if (n.system && i.system !== n.system) continue;
|
|
1056
1056
|
const c = ue(e, t.modules, i.system, i.component, i.file);
|
|
@@ -1059,9 +1059,9 @@ async function ni(e, t, n = {}) {
|
|
|
1059
1059
|
continue;
|
|
1060
1060
|
}
|
|
1061
1061
|
const u = De(c.componentFile) ?? c.systemConfig.framework, b = await We(c.componentFile, u, i.component);
|
|
1062
|
-
b && (await He(G(i.pageFile), i.component, b),
|
|
1062
|
+
b && (await He(G(i.pageFile), i.component, b), o++);
|
|
1063
1063
|
}
|
|
1064
|
-
return
|
|
1064
|
+
return o;
|
|
1065
1065
|
}
|
|
1066
1066
|
function zo(e) {
|
|
1067
1067
|
let t = e;
|
|
@@ -1078,7 +1078,7 @@ function mn(e, t) {
|
|
|
1078
1078
|
`);
|
|
1079
1079
|
}
|
|
1080
1080
|
async function Go(e, t, n) {
|
|
1081
|
-
const s = zo(e),
|
|
1081
|
+
const s = zo(e), o = /* @__PURE__ */ new Set([q(t)]), i = [{ file: t, text: n, depth: 0 }];
|
|
1082
1082
|
let c = "";
|
|
1083
1083
|
for (; i.length; ) {
|
|
1084
1084
|
const u = i.shift();
|
|
@@ -1086,16 +1086,16 @@ async function Go(e, t, n) {
|
|
|
1086
1086
|
const b = mn(u.file, u.text);
|
|
1087
1087
|
for (const d of b.matchAll(/from\s+['"]([^'"]+)['"]/g)) {
|
|
1088
1088
|
const m = d[1];
|
|
1089
|
-
let
|
|
1090
|
-
if (m.startsWith(".") ?
|
|
1091
|
-
const
|
|
1092
|
-
if (!
|
|
1093
|
-
const
|
|
1094
|
-
if (
|
|
1095
|
-
|
|
1096
|
-
const
|
|
1097
|
-
c += mn(
|
|
1098
|
-
`, i.push({ file:
|
|
1089
|
+
let w = null;
|
|
1090
|
+
if (m.startsWith(".") ? w = q(G(u.file), m) : m.startsWith("@/") && s && (w = q(s, m.slice(2))), !w || !vt(w)) continue;
|
|
1091
|
+
const P = [w, `${w}.ts`, `${w}.vue`, W(w, "index.ts")].find((H) => Vo(H));
|
|
1092
|
+
if (!P) continue;
|
|
1093
|
+
const O = q(P);
|
|
1094
|
+
if (o.has(O) || o.size > 50) continue;
|
|
1095
|
+
o.add(O);
|
|
1096
|
+
const E = await it(P, "utf-8");
|
|
1097
|
+
c += mn(P, E) + `
|
|
1098
|
+
`, i.push({ file: P, text: E, depth: u.depth + 1 });
|
|
1099
1099
|
}
|
|
1100
1100
|
}
|
|
1101
1101
|
return c;
|
|
@@ -1108,13 +1108,13 @@ function Vo(e) {
|
|
|
1108
1108
|
}
|
|
1109
1109
|
}
|
|
1110
1110
|
async function Xo(e, t, n, s) {
|
|
1111
|
-
const
|
|
1111
|
+
const o = await it(t, "utf-8");
|
|
1112
1112
|
let i = "";
|
|
1113
1113
|
for (const u of pe(e))
|
|
1114
1114
|
u.endsWith(".ts") && (u.endsWith(".stories.ts") || u.endsWith(".story.ts") || (i += await it(W(e, u), "utf-8"), i += `
|
|
1115
1115
|
`));
|
|
1116
|
-
i += await Go(e, t,
|
|
1117
|
-
const c = n === "vue" ? Oo(
|
|
1116
|
+
i += await Go(e, t, o);
|
|
1117
|
+
const c = n === "vue" ? Oo(o, s, i) : Mo(o, s, i);
|
|
1118
1118
|
for (const u of c.props) {
|
|
1119
1119
|
if (!u.format) {
|
|
1120
1120
|
const b = xs(u);
|
|
@@ -1125,59 +1125,59 @@ async function Xo(e, t, n, s) {
|
|
|
1125
1125
|
return c;
|
|
1126
1126
|
}
|
|
1127
1127
|
async function Yo(e) {
|
|
1128
|
-
const { cwd: t, modules: n, pageFile: s, data:
|
|
1128
|
+
const { cwd: t, modules: n, pageFile: s, data: o, editable: i } = e, c = String(o.system ?? ""), u = String(o.component ?? ""), b = typeof o.file == "string" ? o.file : void 0, d = await No(G(s)), m = ue(t, n, c, u, b), w = [];
|
|
1129
1129
|
if (i && m) {
|
|
1130
|
-
const
|
|
1130
|
+
const _ = m.componentFile.endsWith(".svelte") ? "svelte" : "vue";
|
|
1131
1131
|
try {
|
|
1132
|
-
await Lo(G(s), u, m.componentFile,
|
|
1132
|
+
await Lo(G(s), u, m.componentFile, _);
|
|
1133
1133
|
} catch (A) {
|
|
1134
1134
|
console.warn(`nimpress modules: ${c}/${u} schema upsert failed: ${String(A)}`);
|
|
1135
1135
|
}
|
|
1136
1136
|
}
|
|
1137
1137
|
let k;
|
|
1138
|
-
const
|
|
1139
|
-
if (
|
|
1140
|
-
|
|
1138
|
+
const P = Gt(G(s));
|
|
1139
|
+
if (P) {
|
|
1140
|
+
w.push(P.path);
|
|
1141
1141
|
try {
|
|
1142
|
-
k = Vt(await it(
|
|
1143
|
-
} catch (
|
|
1144
|
-
console.warn(`nimpress modules: ${c}/${u} ${
|
|
1142
|
+
k = Vt(await it(P.path, "utf-8"), P.form);
|
|
1143
|
+
} catch (_) {
|
|
1144
|
+
console.warn(`nimpress modules: ${c}/${u} ${P.form} schema failed to parse: ${String(_)}`);
|
|
1145
1145
|
}
|
|
1146
1146
|
} else
|
|
1147
1147
|
console.warn(
|
|
1148
1148
|
`nimpress modules: ${c}/${u} has no schema file, controls stay empty, run nimpress modules update ${u}`
|
|
1149
1149
|
);
|
|
1150
|
-
let
|
|
1150
|
+
let O, E;
|
|
1151
1151
|
if (m)
|
|
1152
|
-
|
|
1152
|
+
w.push(m.componentFile), E = jt(t, m.claudeMdPath), dt(m.claudeMdPath) && (O = await it(m.claudeMdPath, "utf-8"), w.push(m.claudeMdPath));
|
|
1153
1153
|
else {
|
|
1154
|
-
const
|
|
1155
|
-
if (
|
|
1156
|
-
const A = _o(t,
|
|
1154
|
+
const _ = typeof o.package == "string" ? o.package : n.systems[c]?.package;
|
|
1155
|
+
if (_) {
|
|
1156
|
+
const A = _o(t, _, u);
|
|
1157
1157
|
if (A) {
|
|
1158
1158
|
const L = A.replace(/[^/]+$/, "CLAUDE.md");
|
|
1159
|
-
dt(L) && (
|
|
1159
|
+
dt(L) && (O = await it(L, "utf-8"));
|
|
1160
1160
|
}
|
|
1161
1161
|
}
|
|
1162
1162
|
}
|
|
1163
|
-
const H =
|
|
1163
|
+
const H = o.schema && typeof o.schema == "object" && !Array.isArray(o.schema) ? o.schema : void 0;
|
|
1164
1164
|
H && (k = k ? Le(H, k).merged : H);
|
|
1165
1165
|
const K = k ? Ie(u, k) : void 0, st = n.route.replace(/\/$/, "");
|
|
1166
1166
|
return {
|
|
1167
1167
|
data: {
|
|
1168
1168
|
system: c,
|
|
1169
1169
|
component: u,
|
|
1170
|
-
package: typeof
|
|
1171
|
-
version: typeof
|
|
1172
|
-
claudeMd:
|
|
1173
|
-
claudeMdPath:
|
|
1170
|
+
package: typeof o.package == "string" ? o.package : void 0,
|
|
1171
|
+
version: typeof o.version == "string" ? o.version : void 0,
|
|
1172
|
+
claudeMd: O,
|
|
1173
|
+
claudeMdPath: E,
|
|
1174
1174
|
editable: i && !!m,
|
|
1175
1175
|
harnessPath: `${st}/${encodeURIComponent(c)}/${encodeURIComponent(u)}/`,
|
|
1176
1176
|
schema: K,
|
|
1177
|
-
schemaPath:
|
|
1177
|
+
schemaPath: P ? jt(t, P.path) : void 0,
|
|
1178
1178
|
stories: d
|
|
1179
1179
|
},
|
|
1180
|
-
watchFiles:
|
|
1180
|
+
watchFiles: w
|
|
1181
1181
|
};
|
|
1182
1182
|
}
|
|
1183
1183
|
function En(e, t) {
|
|
@@ -1193,7 +1193,7 @@ function Ko(e) {
|
|
|
1193
1193
|
const t = /* @__PURE__ */ new Map();
|
|
1194
1194
|
for (const u of Object.values(e))
|
|
1195
1195
|
u.type === "chunk" && t.set(u.fileName, u);
|
|
1196
|
-
const n = /* @__PURE__ */ new Map(), s = [],
|
|
1196
|
+
const n = /* @__PURE__ */ new Map(), s = [], o = [], i = (u) => {
|
|
1197
1197
|
const b = t.get(u);
|
|
1198
1198
|
return b ? b.facadeModuleId ?? Object.keys(b.modules)[0] ?? u : u;
|
|
1199
1199
|
}, c = (u) => {
|
|
@@ -1203,14 +1203,14 @@ function Ko(e) {
|
|
|
1203
1203
|
const d = n.get(b);
|
|
1204
1204
|
if (d === 1) {
|
|
1205
1205
|
const m = s.slice(s.indexOf(b)).concat(b);
|
|
1206
|
-
|
|
1206
|
+
o.push({ chunks: m, modules: m.map(i) });
|
|
1207
1207
|
} else d || c(b);
|
|
1208
1208
|
}
|
|
1209
1209
|
s.pop(), n.set(u, 2);
|
|
1210
1210
|
};
|
|
1211
1211
|
for (const u of t.keys())
|
|
1212
1212
|
n.get(u) || c(u);
|
|
1213
|
-
return
|
|
1213
|
+
return o;
|
|
1214
1214
|
}
|
|
1215
1215
|
function An() {
|
|
1216
1216
|
return {
|
|
@@ -1219,8 +1219,8 @@ function An() {
|
|
|
1219
1219
|
generateBundle(e, t) {
|
|
1220
1220
|
const n = Ko(t);
|
|
1221
1221
|
if (!n.length) return;
|
|
1222
|
-
const s = n.map((
|
|
1223
|
-
const i =
|
|
1222
|
+
const s = n.map((o) => {
|
|
1223
|
+
const i = o.chunks.join(" -> "), c = o.modules.map((u) => ` ${u}`).join(`
|
|
1224
1224
|
`);
|
|
1225
1225
|
return ` ${i}
|
|
1226
1226
|
${c}`;
|
|
@@ -1237,15 +1237,15 @@ A module shared across chunks statically imports a component that got its own ch
|
|
|
1237
1237
|
function Ue(e, t) {
|
|
1238
1238
|
if (!t) return e;
|
|
1239
1239
|
const n = { ...e };
|
|
1240
|
-
for (const [s,
|
|
1241
|
-
if (
|
|
1240
|
+
for (const [s, o] of Object.entries(t)) {
|
|
1241
|
+
if (o === void 0) continue;
|
|
1242
1242
|
const i = n[s], c = (u) => typeof u == "object" && u !== null && !Array.isArray(u);
|
|
1243
|
-
c(i) && c(
|
|
1243
|
+
c(i) && c(o) ? n[s] = Ue(i, o) : n[s] = o;
|
|
1244
1244
|
}
|
|
1245
1245
|
return n;
|
|
1246
1246
|
}
|
|
1247
1247
|
function oi(e) {
|
|
1248
|
-
const { cwd: t, command: n, resolved: s, htmlInput:
|
|
1248
|
+
const { cwd: t, command: n, resolved: s, htmlInput: o } = e, i = {
|
|
1249
1249
|
root: t,
|
|
1250
1250
|
base: s.base,
|
|
1251
1251
|
configFile: !1,
|
|
@@ -1262,7 +1262,7 @@ function oi(e) {
|
|
|
1262
1262
|
outDir: En(t, s),
|
|
1263
1263
|
emptyOutDir: !0,
|
|
1264
1264
|
target: "es2022",
|
|
1265
|
-
...
|
|
1265
|
+
...o ? { rollupOptions: { input: o } } : {}
|
|
1266
1266
|
}
|
|
1267
1267
|
};
|
|
1268
1268
|
return Ue(i, s.vite);
|
|
@@ -1471,7 +1471,7 @@ const activeStoryDef = activeLoader ? (await activeLoader()).default : null`;
|
|
|
1471
1471
|
function Tn(e) {
|
|
1472
1472
|
return e ? `import harnessSetup from ${JSON.stringify(e)}` : "const harnessSetup = null";
|
|
1473
1473
|
}
|
|
1474
|
-
function Qo(e, t, n, s,
|
|
1474
|
+
function Qo(e, t, n, s, o) {
|
|
1475
1475
|
const i = t.map((u) => `import ${JSON.stringify(u)}`).join(`
|
|
1476
1476
|
`), c = s ? `import HarnessOverride from ${JSON.stringify(s)}` : "const HarnessOverride = null";
|
|
1477
1477
|
return `import { createApp, h } from 'vue'
|
|
@@ -1498,7 +1498,7 @@ const ctx = createHarnessContext()
|
|
|
1498
1498
|
ctx.overlay.value = Overlay
|
|
1499
1499
|
const isRenderStory = activeStoryDef && typeof activeStoryDef.render === 'function'
|
|
1500
1500
|
|
|
1501
|
-
const requiredDefaults = ${JSON.stringify(
|
|
1501
|
+
const requiredDefaults = ${JSON.stringify(o)}
|
|
1502
1502
|
const storyProps = activeStoryDef && activeStoryDef.props ? activeStoryDef.props : {}
|
|
1503
1503
|
const storySlots = activeStoryDef && activeStoryDef.slots ? activeStoryDef.slots : {}
|
|
1504
1504
|
|
|
@@ -1565,7 +1565,7 @@ try {
|
|
|
1565
1565
|
parent.postMessage({ type: 'nimpress:ready' }, '*')
|
|
1566
1566
|
`;
|
|
1567
1567
|
}
|
|
1568
|
-
function tr(e, t, n, s,
|
|
1568
|
+
function tr(e, t, n, s, o) {
|
|
1569
1569
|
const i = t.map((u) => `import ${JSON.stringify(u)}`).join(`
|
|
1570
1570
|
`), c = s ? `import HarnessOverride from ${JSON.stringify(s)}` : "const HarnessOverride = null";
|
|
1571
1571
|
return `import { mount, createRawSnippet } from 'svelte'
|
|
@@ -1584,7 +1584,7 @@ const Harness = HarnessOverride ?? DefaultHarness
|
|
|
1584
1584
|
const ctx = createHarnessContext()
|
|
1585
1585
|
const isRenderStory = activeStoryDef && activeStoryDef.component
|
|
1586
1586
|
|
|
1587
|
-
const requiredDefaults = ${JSON.stringify(
|
|
1587
|
+
const requiredDefaults = ${JSON.stringify(o)}
|
|
1588
1588
|
const storyProps = activeStoryDef && activeStoryDef.props ? activeStoryDef.props : {}
|
|
1589
1589
|
const storySlots = activeStoryDef && activeStoryDef.slots ? activeStoryDef.slots : {}
|
|
1590
1590
|
|
|
@@ -1641,19 +1641,19 @@ function er(e) {
|
|
|
1641
1641
|
return {};
|
|
1642
1642
|
}
|
|
1643
1643
|
const n = Ie(e.component, t), s = {};
|
|
1644
|
-
for (const
|
|
1645
|
-
if (!
|
|
1646
|
-
const i =
|
|
1647
|
-
i !== void 0 && (s[
|
|
1644
|
+
for (const o of n.props) {
|
|
1645
|
+
if (!o.required) continue;
|
|
1646
|
+
const i = o.default !== void 0 ? o.default : js(o, 0);
|
|
1647
|
+
i !== void 0 && (s[o.name] = i);
|
|
1648
1648
|
}
|
|
1649
1649
|
return s;
|
|
1650
1650
|
}
|
|
1651
|
-
function nr(e, t, n, s,
|
|
1651
|
+
function nr(e, t, n, s, o) {
|
|
1652
1652
|
const i = er(t);
|
|
1653
|
-
return e === "vue" ? Qo(t, n, s,
|
|
1653
|
+
return e === "vue" ? Qo(t, n, s, o, i) : tr(t, n, s, o, i);
|
|
1654
1654
|
}
|
|
1655
1655
|
function dn(e, t, n) {
|
|
1656
|
-
const s = n.map((
|
|
1656
|
+
const s = n.map((o) => ` <link rel="stylesheet" href="${o}" />`).join(`
|
|
1657
1657
|
`);
|
|
1658
1658
|
return `<!doctype html>
|
|
1659
1659
|
<html lang="en">
|
|
@@ -1692,7 +1692,7 @@ async function sr(e, t) {
|
|
|
1692
1692
|
} catch {
|
|
1693
1693
|
throw new Error("[nimpress] modules system with framework vue requires @vitejs/plugin-vue installed in the consumer");
|
|
1694
1694
|
}
|
|
1695
|
-
const
|
|
1695
|
+
const o = await import(tn(s).href), c = [(o.default ?? o)()];
|
|
1696
1696
|
try {
|
|
1697
1697
|
const u = n.resolve("@vitejs/plugin-vue-jsx"), b = await import(tn(u).href), d = b.default ?? b;
|
|
1698
1698
|
c.push(d());
|
|
@@ -1701,17 +1701,17 @@ async function sr(e, t) {
|
|
|
1701
1701
|
return c;
|
|
1702
1702
|
}
|
|
1703
1703
|
function or(e, t, n, s) {
|
|
1704
|
-
const
|
|
1705
|
-
if (!
|
|
1704
|
+
const o = t.systems[n];
|
|
1705
|
+
if (!o) return [];
|
|
1706
1706
|
const i = [];
|
|
1707
1707
|
for (const c of s) {
|
|
1708
1708
|
if (c.system !== n) continue;
|
|
1709
|
-
const u = rr(c.pageFile), b = Gt(G(c.pageFile))?.path ?? W(G(c.pageFile), "schema.json"), d =
|
|
1709
|
+
const u = rr(c.pageFile), b = Gt(G(c.pageFile))?.path ?? W(G(c.pageFile), "schema.json"), d = o.source ? ue(e, t, n, c.component, c.file) : null;
|
|
1710
1710
|
if (d) {
|
|
1711
1711
|
i.push({ component: c.component, importSpec: d.componentFile, storyFiles: u, schemaFile: b });
|
|
1712
1712
|
continue;
|
|
1713
1713
|
}
|
|
1714
|
-
const m = c.package ??
|
|
1714
|
+
const m = c.package ?? o.package;
|
|
1715
1715
|
if (m) {
|
|
1716
1716
|
i.push({ component: c.component, importSpec: m, named: !0, storyFiles: u, schemaFile: b });
|
|
1717
1717
|
continue;
|
|
@@ -1741,81 +1741,81 @@ function ar(e, t) {
|
|
|
1741
1741
|
if (t.harness)
|
|
1742
1742
|
return t.harness.startsWith(".") || vt(t.harness) ? q(e, t.harness) : t.harness;
|
|
1743
1743
|
}
|
|
1744
|
-
function cr(e, t, n, s,
|
|
1744
|
+
function cr(e, t, n, s, o) {
|
|
1745
1745
|
const i = (t.css ?? []).map(
|
|
1746
1746
|
(k) => k.startsWith(".") || vt(k) ? q(e, k) : k
|
|
1747
1747
|
), c = ir(e, t), u = ar(e, t), b = new Map(s.map((k) => [k.component, k])), d = "\0" + Ae, m = (k) => {
|
|
1748
1748
|
if (!k.startsWith(d)) return null;
|
|
1749
|
-
const
|
|
1750
|
-
return
|
|
1751
|
-
},
|
|
1749
|
+
const P = k.slice(d.length).split("/");
|
|
1750
|
+
return P[0] === n && P[1] ? P[1] : null;
|
|
1751
|
+
}, w = (k) => nr(t.framework, k, i, c, u);
|
|
1752
1752
|
return {
|
|
1753
1753
|
name: "nimpress:harness",
|
|
1754
1754
|
resolveId(k) {
|
|
1755
1755
|
return k.startsWith(d) ? k : k.startsWith(Ae) ? "\0" + k : null;
|
|
1756
1756
|
},
|
|
1757
1757
|
load(k) {
|
|
1758
|
-
const
|
|
1759
|
-
if (!
|
|
1760
|
-
const
|
|
1761
|
-
return
|
|
1758
|
+
const P = m(k);
|
|
1759
|
+
if (!P) return null;
|
|
1760
|
+
const O = b.get(P);
|
|
1761
|
+
return O ? w(O) : null;
|
|
1762
1762
|
},
|
|
1763
1763
|
configureServer(k) {
|
|
1764
|
-
k.middlewares.use(async (
|
|
1765
|
-
const H =
|
|
1766
|
-
if (!H) return
|
|
1764
|
+
k.middlewares.use(async (P, O, E) => {
|
|
1765
|
+
const H = P.url;
|
|
1766
|
+
if (!H) return E();
|
|
1767
1767
|
const K = H.split("?")[0];
|
|
1768
|
-
if (!K.startsWith(
|
|
1769
|
-
const st = K.slice(
|
|
1770
|
-
if (!
|
|
1768
|
+
if (!K.startsWith(o)) return E();
|
|
1769
|
+
const st = K.slice(o.length).split("/").filter(Boolean), _ = st[0];
|
|
1770
|
+
if (!_ || !b.has(_)) return E();
|
|
1771
1771
|
const A = st.slice(1).join("/");
|
|
1772
1772
|
if (A === "" || A === "index.html") {
|
|
1773
|
-
const L = ` <script type="module" src="${
|
|
1774
|
-
</head>`, ot = dn(
|
|
1775
|
-
|
|
1773
|
+
const L = ` <script type="module" src="${o}@vite/client"><\/script>
|
|
1774
|
+
</head>`, ot = dn(_, "./entry.js", []).replace(" </head>", L);
|
|
1775
|
+
O.statusCode = 200, O.setHeader("Content-Type", "text/html"), O.end(ot);
|
|
1776
1776
|
return;
|
|
1777
1777
|
}
|
|
1778
1778
|
if (A === "entry.js") {
|
|
1779
|
-
const L = await k.transformRequest(Cn(n,
|
|
1780
|
-
if (!L) return
|
|
1781
|
-
|
|
1779
|
+
const L = await k.transformRequest(Cn(n, _));
|
|
1780
|
+
if (!L) return E();
|
|
1781
|
+
O.statusCode = 200, O.setHeader("Content-Type", "application/javascript"), O.end(L.code);
|
|
1782
1782
|
return;
|
|
1783
1783
|
}
|
|
1784
|
-
return
|
|
1784
|
+
return E();
|
|
1785
1785
|
});
|
|
1786
1786
|
},
|
|
1787
|
-
generateBundle(k,
|
|
1788
|
-
const
|
|
1789
|
-
if (H.has(
|
|
1790
|
-
H.add(
|
|
1791
|
-
const st =
|
|
1787
|
+
generateBundle(k, P) {
|
|
1788
|
+
const O = (E, H, K) => {
|
|
1789
|
+
if (H.has(E)) return;
|
|
1790
|
+
H.add(E);
|
|
1791
|
+
const st = P[E];
|
|
1792
1792
|
if (!st || st.type !== "chunk") return;
|
|
1793
|
-
const
|
|
1794
|
-
for (const A of
|
|
1795
|
-
for (const A of st.imports)
|
|
1793
|
+
const _ = st.viteMetadata;
|
|
1794
|
+
for (const A of _?.importedCss ?? []) K.add(A);
|
|
1795
|
+
for (const A of st.imports) O(A, H, K);
|
|
1796
1796
|
};
|
|
1797
|
-
for (const
|
|
1798
|
-
if (
|
|
1799
|
-
const H = b.get(
|
|
1797
|
+
for (const E of Object.values(P)) {
|
|
1798
|
+
if (E.type !== "chunk" || !E.isEntry) continue;
|
|
1799
|
+
const H = b.get(E.name);
|
|
1800
1800
|
if (!H) continue;
|
|
1801
1801
|
const K = /* @__PURE__ */ new Set();
|
|
1802
|
-
|
|
1803
|
-
const st = [...K].map((
|
|
1802
|
+
O(E.fileName, /* @__PURE__ */ new Set(), K);
|
|
1803
|
+
const st = [...K].map((_) => o + _);
|
|
1804
1804
|
this.emitFile({
|
|
1805
1805
|
type: "asset",
|
|
1806
1806
|
fileName: `${H.component}/index.html`,
|
|
1807
|
-
source: dn(H.component,
|
|
1807
|
+
source: dn(H.component, o + E.fileName, st)
|
|
1808
1808
|
});
|
|
1809
1809
|
}
|
|
1810
1810
|
}
|
|
1811
1811
|
};
|
|
1812
1812
|
}
|
|
1813
1813
|
async function ri(e, t, n, s) {
|
|
1814
|
-
const
|
|
1814
|
+
const o = t.modules, i = o.systems[n];
|
|
1815
1815
|
if (!i) throw new Error(`[nimpress] unknown module system: ${n}`);
|
|
1816
|
-
const c = await Re(e, t.contentDir), u = or(e,
|
|
1816
|
+
const c = await Re(e, t.contentDir), u = or(e, o, n, c);
|
|
1817
1817
|
u.length || console.warn(`[nimpress] modules: no component pages found for system ${n}`);
|
|
1818
|
-
const b = await sr(e, i.framework), d = i.source ? q(e, i.source) : e, m =
|
|
1818
|
+
const b = await sr(e, i.framework), d = i.source ? q(e, i.source) : e, m = o.route.replace(/\/$/, ""), w = `${m}/${n}/`, k = s === "build" ? gt(t.base, w) : w, P = u.filter((E) => vt(E.importSpec)).map((E) => E.importSpec).concat(u.flatMap((E) => (E.storyFiles ?? []).map((H) => H.path))), O = {
|
|
1819
1819
|
root: e,
|
|
1820
1820
|
configFile: !1,
|
|
1821
1821
|
publicDir: !1,
|
|
@@ -1824,18 +1824,18 @@ async function ri(e, t, n, s) {
|
|
|
1824
1824
|
plugins: [cr(e, i, n, u, k), b, An()],
|
|
1825
1825
|
resolve: i.framework === "vue" ? { alias: { vue: "vue/dist/vue.esm-bundler.js" } } : void 0,
|
|
1826
1826
|
optimizeDeps: {
|
|
1827
|
-
entries:
|
|
1827
|
+
entries: P,
|
|
1828
1828
|
include: i.framework === "vue" ? ["vue"] : [],
|
|
1829
1829
|
exclude: ["@nimtech/nimpress/harness/vue", "@nimtech/nimpress/harness/svelte"]
|
|
1830
1830
|
},
|
|
1831
1831
|
server: {
|
|
1832
1832
|
host: "127.0.0.1",
|
|
1833
|
-
port: Ce(
|
|
1833
|
+
port: Ce(o, n),
|
|
1834
1834
|
strictPort: !0,
|
|
1835
1835
|
fs: { allow: [e, d] },
|
|
1836
1836
|
hmr: {
|
|
1837
1837
|
host: "127.0.0.1",
|
|
1838
|
-
clientPort: Ce(
|
|
1838
|
+
clientPort: Ce(o, n)
|
|
1839
1839
|
}
|
|
1840
1840
|
},
|
|
1841
1841
|
build: {
|
|
@@ -1843,12 +1843,12 @@ async function ri(e, t, n, s) {
|
|
|
1843
1843
|
emptyOutDir: !0,
|
|
1844
1844
|
target: "es2022",
|
|
1845
1845
|
rollupOptions: {
|
|
1846
|
-
input: Object.fromEntries(u.map((
|
|
1846
|
+
input: Object.fromEntries(u.map((E) => [E.component, Cn(n, E.component)]))
|
|
1847
1847
|
}
|
|
1848
1848
|
},
|
|
1849
1849
|
base: k
|
|
1850
1850
|
};
|
|
1851
|
-
return Ue(
|
|
1851
|
+
return Ue(O, t.vite);
|
|
1852
1852
|
}
|
|
1853
1853
|
function lr(e, t = "virtual:nimpress/main") {
|
|
1854
1854
|
return `<!doctype html>
|
|
@@ -2008,23 +2008,53 @@ function Fn(e, t = "x") {
|
|
|
2008
2008
|
n.push(`${u.path.join(".") || "frontmatter"}: ${u.message}`);
|
|
2009
2009
|
return n;
|
|
2010
2010
|
}
|
|
2011
|
-
const
|
|
2012
|
-
if (
|
|
2013
|
-
return !
|
|
2011
|
+
const o = s.data, i = o.data ?? {};
|
|
2012
|
+
if (o.link)
|
|
2013
|
+
return !o.title && !o.sidebar?.name && n.push("a link page needs a title or a sidebar.name for its label"), /^[a-z][a-z0-9+.-]*:\/\/|^mailto:|^tel:/i.test(o.link) || n.push("link: must be an absolute url"), t.trim() !== "" && n.push("a link page carries no body, the entry opens link instead of a page"), n;
|
|
2014
2014
|
if (e.type === void 0 && t.trim() === "")
|
|
2015
|
-
return
|
|
2016
|
-
if (
|
|
2015
|
+
return o.sidebar?.name || n.push("a page without a type and without a body needs a sidebar.name to decorate its group"), n;
|
|
2016
|
+
if (o.title || n.push("title: Required"), o.type === "openapi" && !o.spec && n.push("type openapi requires a spec field"), o.type === "dbml" && !o.spec && n.push("type dbml requires a spec field"), o.type === "changelog") {
|
|
2017
2017
|
(i.version === void 0 || String(i.version).trim() === "") && n.push("changelog requires data.version"), (i.release_date === void 0 || Number.isNaN(new Date(String(i.release_date)).getTime())) && n.push("changelog requires a valid data.release_date");
|
|
2018
2018
|
const u = i.title === void 0 ? "" : String(i.title);
|
|
2019
2019
|
u.trim() || n.push("changelog requires data.title"), u.length > 48 && n.push("changelog data.title exceeds 48 characters"), u.includes(",") && n.push("changelog data.title must not contain a comma"), i.description !== void 0 && String(i.description).length > 160 && n.push("changelog data.description exceeds 160 characters");
|
|
2020
2020
|
}
|
|
2021
|
-
return (
|
|
2021
|
+
return (o.type === "milestone" || o.type === "epic" || o.type === "feature" || o.type === "bug") && (o.description || n.push(`type ${o.type} requires a description`), (i.date === void 0 || Number.isNaN(new Date(String(i.date)).getTime())) && n.push(`type ${o.type} requires a valid data.date`)), o.type === "component" && ((i.system === void 0 || String(i.system).trim() === "") && n.push("type component requires data.system"), (i.component === void 0 || String(i.component).trim() === "") && n.push("type component requires data.component")), n;
|
|
2022
2022
|
}
|
|
2023
2023
|
function yr(e, t) {
|
|
2024
|
-
const n =
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2024
|
+
const n = (b) => {
|
|
2025
|
+
const d = String(b ?? "").replace(/^v/i, "").replace(/\+.*$/, ""), m = d.indexOf("-");
|
|
2026
|
+
return {
|
|
2027
|
+
base: (m === -1 ? d : d.slice(0, m)).split("."),
|
|
2028
|
+
pre: m === -1 ? "" : d.slice(m + 1)
|
|
2029
|
+
};
|
|
2030
|
+
}, s = (b, d) => {
|
|
2031
|
+
const m = b.match(/\d+|\D+/g) ?? [], w = d.match(/\d+|\D+/g) ?? [];
|
|
2032
|
+
for (let k = 0; k < Math.max(m.length, w.length); k++) {
|
|
2033
|
+
const P = m[k], O = w[k];
|
|
2034
|
+
if (P === void 0) return -1;
|
|
2035
|
+
if (O === void 0) return 1;
|
|
2036
|
+
if (/^\d+$/.test(P) && /^\d+$/.test(O)) {
|
|
2037
|
+
const E = parseInt(P, 10) - parseInt(O, 10);
|
|
2038
|
+
if (E !== 0) return E;
|
|
2039
|
+
} else if (P !== O)
|
|
2040
|
+
return P < O ? -1 : 1;
|
|
2041
|
+
}
|
|
2042
|
+
return 0;
|
|
2043
|
+
}, o = n(e), i = n(t);
|
|
2044
|
+
for (let b = 0; b < Math.max(o.base.length, i.base.length); b++) {
|
|
2045
|
+
const d = parseInt(o.base[b] ?? "0", 10) || 0, m = parseInt(i.base[b] ?? "0", 10) || 0;
|
|
2046
|
+
if (d !== m) return d - m;
|
|
2047
|
+
}
|
|
2048
|
+
if (!o.pre && !i.pre) return 0;
|
|
2049
|
+
if (!o.pre) return 1;
|
|
2050
|
+
if (!i.pre) return -1;
|
|
2051
|
+
const c = o.pre.split("."), u = i.pre.split(".");
|
|
2052
|
+
for (let b = 0; b < Math.max(c.length, u.length); b++) {
|
|
2053
|
+
const d = c[b], m = u[b];
|
|
2054
|
+
if (d === void 0) return -1;
|
|
2055
|
+
if (m === void 0) return 1;
|
|
2056
|
+
const w = s(d, m);
|
|
2057
|
+
if (w !== 0) return w;
|
|
2028
2058
|
}
|
|
2029
2059
|
return 0;
|
|
2030
2060
|
}
|
|
@@ -2064,11 +2094,11 @@ async function Je(e, t = []) {
|
|
|
2064
2094
|
return t;
|
|
2065
2095
|
}
|
|
2066
2096
|
for (const s of n) {
|
|
2067
|
-
const
|
|
2097
|
+
const o = W(e, s.name);
|
|
2068
2098
|
if (s.isDirectory()) {
|
|
2069
2099
|
if (s.name.startsWith(".") || s.name === "node_modules") continue;
|
|
2070
|
-
await Je(
|
|
2071
|
-
} else s.isFile() && s.name.endsWith(".md") && t.push(
|
|
2100
|
+
await Je(o, t);
|
|
2101
|
+
} else s.isFile() && s.name.endsWith(".md") && t.push(o);
|
|
2072
2102
|
}
|
|
2073
2103
|
return t;
|
|
2074
2104
|
}
|
|
@@ -2083,29 +2113,29 @@ function Sr(e, t = { route: "/_components" }, n = "/") {
|
|
|
2083
2113
|
html: !0,
|
|
2084
2114
|
linkify: !0,
|
|
2085
2115
|
typographer: !1,
|
|
2086
|
-
highlight(d, m,
|
|
2116
|
+
highlight(d, m, w) {
|
|
2087
2117
|
const k = {
|
|
2088
2118
|
curl: "bash",
|
|
2089
2119
|
sh: "bash",
|
|
2090
2120
|
zsh: "bash",
|
|
2091
2121
|
console: "bash",
|
|
2092
2122
|
hurl: "http"
|
|
2093
|
-
},
|
|
2123
|
+
}, O = ((w ? w.match(/\[([^\]]+)\]/) : null)?.[1].trim() || m || "text").trim(), E = k[m] ?? m, H = E && e.getLoadedLanguages().includes(E) ? E : "text";
|
|
2094
2124
|
try {
|
|
2095
|
-
return e.codeToHtml(d, { lang: H, theme: "github-dark" }).replace("<pre ", `<pre data-lang="${s.utils.escapeHtml(
|
|
2125
|
+
return e.codeToHtml(d, { lang: H, theme: "github-dark" }).replace("<pre ", `<pre data-lang="${s.utils.escapeHtml(O)}" `);
|
|
2096
2126
|
} catch {
|
|
2097
|
-
return `<pre data-lang="${s.utils.escapeHtml(
|
|
2127
|
+
return `<pre data-lang="${s.utils.escapeHtml(O)}"><code>${s.utils.escapeHtml(d)}</code></pre>`;
|
|
2098
2128
|
}
|
|
2099
2129
|
}
|
|
2100
|
-
}),
|
|
2101
|
-
s.renderer.rules.link_open = (d, m,
|
|
2102
|
-
const
|
|
2103
|
-
return
|
|
2130
|
+
}), o = (d, m, w, k, P) => P.renderToken(d, m, w), i = s.renderer.rules.link_open ?? o;
|
|
2131
|
+
s.renderer.rules.link_open = (d, m, w, k, P) => {
|
|
2132
|
+
const O = d[m].attrGet("href");
|
|
2133
|
+
return O && d[m].attrSet("href", gt(n, O)), i(d, m, w, k, P);
|
|
2104
2134
|
};
|
|
2105
|
-
const c = s.renderer.rules.image ??
|
|
2106
|
-
s.renderer.rules.image = (d, m,
|
|
2107
|
-
const
|
|
2108
|
-
return
|
|
2135
|
+
const c = s.renderer.rules.image ?? o;
|
|
2136
|
+
s.renderer.rules.image = (d, m, w, k, P) => {
|
|
2137
|
+
const O = d[m].attrGet("src");
|
|
2138
|
+
return O && d[m].attrSet("src", gt(n, O)), c(d, m, w, k, P);
|
|
2109
2139
|
}, s.use(Qe, {
|
|
2110
2140
|
slugify: In,
|
|
2111
2141
|
permalink: Qe.permalink.headerLink({ safariReaderFix: !0 })
|
|
@@ -2115,9 +2145,9 @@ function Sr(e, t = { route: "/_components" }, n = "/") {
|
|
|
2115
2145
|
}, b = ["tip", "note", "warning", "info", "check"];
|
|
2116
2146
|
for (const d of b)
|
|
2117
2147
|
u(d, {
|
|
2118
|
-
render(m,
|
|
2119
|
-
if (m[
|
|
2120
|
-
const k = m[
|
|
2148
|
+
render(m, w) {
|
|
2149
|
+
if (m[w].nesting === 1) {
|
|
2150
|
+
const k = m[w].info.trim().slice(d.length).trim() || d;
|
|
2121
2151
|
return `<div class="np-callout np-callout-${d}"><div class="np-callout-body"><div class="np-callout-title">${s.utils.escapeHtml(k)}</div>`;
|
|
2122
2152
|
}
|
|
2123
2153
|
return "</div></div>";
|
|
@@ -2133,7 +2163,7 @@ function Sr(e, t = { route: "/_components" }, n = "/") {
|
|
|
2133
2163
|
},
|
|
2134
2164
|
render(d, m) {
|
|
2135
2165
|
if (d[m].nesting === 1) {
|
|
2136
|
-
const
|
|
2166
|
+
const w = d[m].info.trim().match(/^details\s*(.*)$/), k = w && w[1] || "Details";
|
|
2137
2167
|
return `<details class="np-details"><summary class="np-details-summary">${s.utils.escapeHtml(k)}</summary><div class="np-details-body">
|
|
2138
2168
|
`;
|
|
2139
2169
|
}
|
|
@@ -2147,23 +2177,23 @@ function Sr(e, t = { route: "/_components" }, n = "/") {
|
|
|
2147
2177
|
}), u("actions", {
|
|
2148
2178
|
render(d, m) {
|
|
2149
2179
|
if (d[m].nesting === 1) {
|
|
2150
|
-
const
|
|
2151
|
-
return `<div class="np-actions" data-align="${s.utils.escapeHtml(
|
|
2180
|
+
const w = d[m].info.trim().slice(7).trim(), k = w ? Rt(w, d[m].info) : {}, P = typeof k?.align == "string" ? k.align : "start";
|
|
2181
|
+
return `<div class="np-actions" data-align="${s.utils.escapeHtml(P)}">`;
|
|
2152
2182
|
}
|
|
2153
2183
|
return "</div>";
|
|
2154
2184
|
}
|
|
2155
2185
|
}), u("features", {
|
|
2156
2186
|
render(d, m) {
|
|
2157
2187
|
if (d[m].nesting === 1) {
|
|
2158
|
-
const
|
|
2159
|
-
return `<div class="np-features"${
|
|
2188
|
+
const w = d[m].info.trim().slice(8).trim(), k = w ? Rt(w, d[m].info) : {}, P = typeof k?.columns == "number" ? k.columns : 0;
|
|
2189
|
+
return `<div class="np-features"${P > 0 ? ` data-columns="${P}"` : ""}>`;
|
|
2160
2190
|
}
|
|
2161
2191
|
return "</div>";
|
|
2162
2192
|
}
|
|
2163
2193
|
}), u("feature", {
|
|
2164
2194
|
render(d, m) {
|
|
2165
2195
|
if (d[m].nesting === 1) {
|
|
2166
|
-
const
|
|
2196
|
+
const w = d[m].info.trim().slice(7).trim(), k = w ? Rt(w, d[m].info) : {};
|
|
2167
2197
|
return `<div class="np-feature" data-config="${qt(JSON.stringify(k))}"><div class="np-feature-body">`;
|
|
2168
2198
|
}
|
|
2169
2199
|
return "</div></div>";
|
|
@@ -2171,7 +2201,7 @@ function Sr(e, t = { route: "/_components" }, n = "/") {
|
|
|
2171
2201
|
}), u("component", {
|
|
2172
2202
|
render(d, m) {
|
|
2173
2203
|
if (d[m].nesting === 1) {
|
|
2174
|
-
const
|
|
2204
|
+
const w = d[m].info.trim().slice(9).trim(), k = w.startsWith("{") ? Rt(w, d[m].info) : w ? { component: w } : {};
|
|
2175
2205
|
return `<div class="np-component-embed" data-embed="${qt(JSON.stringify({ ...t, ...k }))}"><div class="np-component-embed-body">`;
|
|
2176
2206
|
}
|
|
2177
2207
|
return "</div></div>";
|
|
@@ -2194,14 +2224,14 @@ function xr(e) {
|
|
|
2194
2224
|
}
|
|
2195
2225
|
function kr(e, t, n) {
|
|
2196
2226
|
const s = t.startsWith("{") ? Rt(t, t) : {};
|
|
2197
|
-
let
|
|
2227
|
+
let o = "", i = "";
|
|
2198
2228
|
try {
|
|
2199
|
-
|
|
2229
|
+
o = kn(e);
|
|
2200
2230
|
} catch (d) {
|
|
2201
2231
|
i = d instanceof Be ? d.message : String(d), console.warn(`[nimpress] invalid dbml in ${n}:
|
|
2202
2232
|
${i}`);
|
|
2203
2233
|
}
|
|
2204
|
-
const c = Buffer.from(
|
|
2234
|
+
const c = Buffer.from(o, "utf-8").toString("base64"), u = typeof s.height == "string" ? s.height : "";
|
|
2205
2235
|
return `<div class="np-dbml" ${[
|
|
2206
2236
|
`data-schema="${c}"`,
|
|
2207
2237
|
i ? `data-error="${qt(i)}"` : "",
|
|
@@ -2211,29 +2241,29 @@ ${i}`);
|
|
|
2211
2241
|
function Pr(e, t) {
|
|
2212
2242
|
const n = e.split(`
|
|
2213
2243
|
`), s = [];
|
|
2214
|
-
let
|
|
2215
|
-
for (;
|
|
2216
|
-
const i = /^(\s*)(`{3,}|~{3,})(.*)$/.exec(n[
|
|
2244
|
+
let o = 0;
|
|
2245
|
+
for (; o < n.length; ) {
|
|
2246
|
+
const i = /^(\s*)(`{3,}|~{3,})(.*)$/.exec(n[o]);
|
|
2217
2247
|
if (!i) {
|
|
2218
|
-
s.push(n[
|
|
2248
|
+
s.push(n[o]), o += 1;
|
|
2219
2249
|
continue;
|
|
2220
2250
|
}
|
|
2221
2251
|
const [, c, u, b] = i, d = new RegExp(`^\\s*\\${u[0]}{${u.length},}\\s*$`);
|
|
2222
|
-
let m =
|
|
2252
|
+
let m = o + 1;
|
|
2223
2253
|
for (; m < n.length && !d.test(n[m]); ) m += 1;
|
|
2224
|
-
const
|
|
2254
|
+
const w = b.trim(), k = w.split(/\s+/)[0].toLowerCase(), P = n.slice(o + 1, m).join(`
|
|
2225
2255
|
`);
|
|
2226
|
-
k === "mermaid" ? s.push(`${c}${xr(
|
|
2227
|
-
`)}`) : k === "dbml" ? s.push(`${c}${kr(
|
|
2256
|
+
k === "mermaid" ? s.push(`${c}${xr(P && `${P}
|
|
2257
|
+
`)}`) : k === "dbml" ? s.push(`${c}${kr(P, w.slice(k.length).trim(), t)}`) : s.push(...n.slice(o, Math.min(m + 1, n.length))), o = m + 1;
|
|
2228
2258
|
}
|
|
2229
2259
|
return s.join(`
|
|
2230
2260
|
`);
|
|
2231
2261
|
}
|
|
2232
2262
|
function jr(e) {
|
|
2233
2263
|
if (!e) return "";
|
|
2234
|
-
const t = [], n = (
|
|
2235
|
-
if (
|
|
2236
|
-
for (const i of
|
|
2264
|
+
const t = [], n = (o) => {
|
|
2265
|
+
if (o)
|
|
2266
|
+
for (const i of o)
|
|
2237
2267
|
i.type === "text" || i.type === "code_inline" ? t.push(i.content ?? "") : i.children && n(i.children);
|
|
2238
2268
|
};
|
|
2239
2269
|
n(e.children);
|
|
@@ -2242,21 +2272,21 @@ function jr(e) {
|
|
|
2242
2272
|
}
|
|
2243
2273
|
function Er(e, t) {
|
|
2244
2274
|
const n = e.parse(t, {}), s = [];
|
|
2245
|
-
let
|
|
2275
|
+
let o = 0;
|
|
2246
2276
|
const i = /* @__PURE__ */ new Map();
|
|
2247
2277
|
for (let c = 0; c < n.length; c++) {
|
|
2248
2278
|
const u = n[c];
|
|
2249
2279
|
if (u.type === "heading_open") {
|
|
2250
|
-
const b = parseInt(u.tag.slice(1)), d = n[c + 1], m = jr(d) || `heading-${
|
|
2251
|
-
let
|
|
2252
|
-
|
|
2253
|
-
const k = i.get(
|
|
2280
|
+
const b = parseInt(u.tag.slice(1)), d = n[c + 1], m = jr(d) || `heading-${o++}`;
|
|
2281
|
+
let w = In(m);
|
|
2282
|
+
w || (w = `heading-${o++}`);
|
|
2283
|
+
const k = i.get(w);
|
|
2254
2284
|
if (k !== void 0) {
|
|
2255
|
-
const
|
|
2256
|
-
i.set(
|
|
2285
|
+
const P = k + 1;
|
|
2286
|
+
i.set(w, P), w = `${w}-${P}`;
|
|
2257
2287
|
} else
|
|
2258
|
-
i.set(
|
|
2259
|
-
s.push({ level: b, text: m, slug:
|
|
2288
|
+
i.set(w, 0);
|
|
2289
|
+
s.push({ level: b, text: m, slug: w });
|
|
2260
2290
|
}
|
|
2261
2291
|
}
|
|
2262
2292
|
return s;
|
|
@@ -2269,19 +2299,19 @@ function se(e) {
|
|
|
2269
2299
|
}
|
|
2270
2300
|
function Oe(e) {
|
|
2271
2301
|
e.sort((t, n) => {
|
|
2272
|
-
const s = t.order ?? Number.MAX_SAFE_INTEGER,
|
|
2273
|
-
return s !==
|
|
2302
|
+
const s = t.order ?? Number.MAX_SAFE_INTEGER, o = n.order ?? Number.MAX_SAFE_INTEGER;
|
|
2303
|
+
return s !== o ? s - o : t.text.localeCompare(n.text);
|
|
2274
2304
|
});
|
|
2275
2305
|
for (const t of e)
|
|
2276
2306
|
t.items && Oe(t.items);
|
|
2277
2307
|
}
|
|
2278
2308
|
function Ar(e) {
|
|
2279
|
-
let t = Wt, n = q(process.cwd(), Wt.contentDir), s = q(process.cwd(), Wt.assetsDir),
|
|
2280
|
-
const d = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(),
|
|
2281
|
-
function
|
|
2282
|
-
return bn("sha1").update(
|
|
2309
|
+
let t = Wt, n = q(process.cwd(), Wt.contentDir), s = q(process.cwd(), Wt.assetsDir), o = /* @__PURE__ */ new Map(), i = null, c = q(process.cwd(), "dist"), u = !1, b = null;
|
|
2310
|
+
const d = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Set(), k = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new Set();
|
|
2311
|
+
function O(r) {
|
|
2312
|
+
return bn("sha1").update(r).digest("hex");
|
|
2283
2313
|
}
|
|
2284
|
-
async function
|
|
2314
|
+
async function E() {
|
|
2285
2315
|
return i || (i = await gs({
|
|
2286
2316
|
themes: ["github-dark"],
|
|
2287
2317
|
langs: [
|
|
@@ -2308,105 +2338,105 @@ function Ar(e) {
|
|
|
2308
2338
|
]
|
|
2309
2339
|
}), i);
|
|
2310
2340
|
}
|
|
2311
|
-
function H(
|
|
2312
|
-
return /\.ya?ml$/i.test(l) ? vn(
|
|
2341
|
+
function H(r, l) {
|
|
2342
|
+
return /\.ya?ml$/i.test(l) ? vn(r) : JSON.parse(r);
|
|
2313
2343
|
}
|
|
2314
|
-
async function K(
|
|
2344
|
+
async function K(r, l) {
|
|
2315
2345
|
try {
|
|
2316
|
-
const a = vt(l) ? l : q(G(
|
|
2317
|
-
return await st(
|
|
2346
|
+
const a = vt(l) ? l : q(G(r), l), g = await it(a, "utf-8"), $ = H(g, a);
|
|
2347
|
+
return await st($, G(a)), $;
|
|
2318
2348
|
} catch (a) {
|
|
2319
|
-
return console.warn(`[nimpress] failed to load spec ${l} for ${
|
|
2349
|
+
return console.warn(`[nimpress] failed to load spec ${l} for ${r}:`, a), null;
|
|
2320
2350
|
}
|
|
2321
2351
|
}
|
|
2322
|
-
async function st(
|
|
2323
|
-
if (!
|
|
2324
|
-
|
|
2325
|
-
const a =
|
|
2352
|
+
async function st(r, l) {
|
|
2353
|
+
if (!r || typeof r != "object") return;
|
|
2354
|
+
r.components || (r.components = {}), r.components.schemas || (r.components.schemas = {});
|
|
2355
|
+
const a = r.components.schemas, g = /* @__PURE__ */ new Map(), $ = async (y) => {
|
|
2326
2356
|
const x = await it(y, "utf-8");
|
|
2327
2357
|
return H(x, y);
|
|
2328
2358
|
}, h = async (y) => {
|
|
2329
2359
|
if (g.has(y)) return g.get(y);
|
|
2330
2360
|
const v = (y.split("/").pop() ?? "").replace(/\.json$/, "");
|
|
2331
2361
|
g.set(y, v);
|
|
2332
|
-
const
|
|
2333
|
-
return await p(
|
|
2362
|
+
const j = await $(y);
|
|
2363
|
+
return await p(j, G(y)), a[v] = j, v;
|
|
2334
2364
|
}, p = async (y, x) => {
|
|
2335
2365
|
if (!y || typeof y != "object") return;
|
|
2336
2366
|
if (Array.isArray(y)) {
|
|
2337
|
-
for (const
|
|
2367
|
+
for (const j of y) await p(j, x);
|
|
2338
2368
|
return;
|
|
2339
2369
|
}
|
|
2340
2370
|
const v = y.$ref;
|
|
2341
2371
|
if (typeof v == "string" && !v.startsWith("#")) {
|
|
2342
|
-
const
|
|
2343
|
-
if (
|
|
2344
|
-
const
|
|
2345
|
-
y.$ref = `#/components/schemas/${
|
|
2372
|
+
const j = vt(v) ? v : q(x, v), M = G(j).split("/").pop() ?? "";
|
|
2373
|
+
if (M === "schemas") {
|
|
2374
|
+
const S = await h(j);
|
|
2375
|
+
y.$ref = `#/components/schemas/${S}`;
|
|
2346
2376
|
return;
|
|
2347
2377
|
}
|
|
2348
|
-
if (
|
|
2349
|
-
const
|
|
2350
|
-
await p(
|
|
2351
|
-
for (const N of Object.keys(
|
|
2378
|
+
if (M === "operations") {
|
|
2379
|
+
const S = await $(j);
|
|
2380
|
+
await p(S, G(j)), delete y.$ref;
|
|
2381
|
+
for (const N of Object.keys(S)) y[N] = S[N];
|
|
2352
2382
|
return;
|
|
2353
2383
|
}
|
|
2354
2384
|
return;
|
|
2355
2385
|
}
|
|
2356
|
-
for (const
|
|
2357
|
-
await p(y[
|
|
2386
|
+
for (const j of Object.keys(y))
|
|
2387
|
+
await p(y[j], x);
|
|
2358
2388
|
};
|
|
2359
2389
|
for (const y of Object.keys(a)) {
|
|
2360
2390
|
const x = a[y];
|
|
2361
2391
|
if (x && typeof x == "object" && typeof x.$ref == "string" && !x.$ref.startsWith("#")) {
|
|
2362
2392
|
const v = vt(x.$ref) ? x.$ref : q(l, x.$ref);
|
|
2363
2393
|
g.set(v, y);
|
|
2364
|
-
const
|
|
2365
|
-
await p(
|
|
2394
|
+
const j = await $(v);
|
|
2395
|
+
await p(j, G(v)), a[y] = j;
|
|
2366
2396
|
}
|
|
2367
2397
|
}
|
|
2368
|
-
for (const y of Object.keys(
|
|
2369
|
-
y !== "components" && await p(
|
|
2398
|
+
for (const y of Object.keys(r))
|
|
2399
|
+
y !== "components" && await p(r[y], l);
|
|
2370
2400
|
}
|
|
2371
|
-
function
|
|
2401
|
+
function _(r, l) {
|
|
2372
2402
|
if (typeof l != "string" || !l.startsWith("#/")) return null;
|
|
2373
|
-
const a = l.slice(2).split("/").map((
|
|
2374
|
-
let g =
|
|
2375
|
-
for (const
|
|
2403
|
+
const a = l.slice(2).split("/").map(($) => $.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
2404
|
+
let g = r;
|
|
2405
|
+
for (const $ of a) {
|
|
2376
2406
|
if (g == null) return null;
|
|
2377
|
-
g = g[
|
|
2407
|
+
g = g[$];
|
|
2378
2408
|
}
|
|
2379
2409
|
return g;
|
|
2380
2410
|
}
|
|
2381
|
-
function A(
|
|
2382
|
-
if (a > 4 || !
|
|
2383
|
-
const g =
|
|
2384
|
-
return g == null ?
|
|
2411
|
+
function A(r, l, a = 0) {
|
|
2412
|
+
if (a > 4 || !r || typeof r != "object" || typeof r.$ref != "string") return r;
|
|
2413
|
+
const g = _(l, r.$ref);
|
|
2414
|
+
return g == null ? r : A(g, l, a + 1);
|
|
2385
2415
|
}
|
|
2386
|
-
function L(
|
|
2416
|
+
function L(r, l) {
|
|
2387
2417
|
if (!(typeof l != "string" || l === ""))
|
|
2388
2418
|
try {
|
|
2389
|
-
return
|
|
2419
|
+
return r.render(l);
|
|
2390
2420
|
} catch {
|
|
2391
2421
|
return;
|
|
2392
2422
|
}
|
|
2393
2423
|
}
|
|
2394
|
-
function ot(
|
|
2395
|
-
if (!
|
|
2396
|
-
const a =
|
|
2397
|
-
for (const [
|
|
2424
|
+
function ot(r, l) {
|
|
2425
|
+
if (!r) return null;
|
|
2426
|
+
const a = r, g = a.info ?? {}, $ = a.components?.securitySchemes ?? {}, h = ["get", "post", "put", "patch", "delete", "head", "options"], p = (S) => A(S, a)?.example, y = /* @__PURE__ */ new Map(), x = a.paths ?? {};
|
|
2427
|
+
for (const [S, N] of Object.entries(x)) {
|
|
2398
2428
|
const I = A(N, a);
|
|
2399
2429
|
if (!I || typeof I != "object") continue;
|
|
2400
2430
|
const U = (I.parameters ?? []).map((C) => A(C, a));
|
|
2401
2431
|
for (const C of h) {
|
|
2402
2432
|
const F = I[C];
|
|
2403
2433
|
if (!F) continue;
|
|
2404
|
-
const
|
|
2434
|
+
const D = F.operationId ?? `${C}-${S.replace(/[^a-z0-9]+/gi, "-")}`, R = F.tags?.[0] ?? "default", z = (F.parameters ?? []).map((ht) => A(ht, a)), V = [...U, ...z], T = /* @__PURE__ */ new Set(), B = [];
|
|
2405
2435
|
for (const ht of V) {
|
|
2406
2436
|
const rt = ht;
|
|
2407
2437
|
if (!rt || typeof rt != "object" || !rt.name || !rt.in) continue;
|
|
2408
2438
|
const tt = `${rt.name}@${rt.in}`;
|
|
2409
|
-
|
|
2439
|
+
T.has(tt) || (T.add(tt), B.push({
|
|
2410
2440
|
name: rt.name,
|
|
2411
2441
|
in: rt.in,
|
|
2412
2442
|
required: rt.required,
|
|
@@ -2424,11 +2454,11 @@ function Ar(e) {
|
|
|
2424
2454
|
Ct !== void 0 && (Y[ht] = Ct);
|
|
2425
2455
|
}
|
|
2426
2456
|
const ut = {
|
|
2427
|
-
id:
|
|
2457
|
+
id: D,
|
|
2428
2458
|
method: C.toUpperCase(),
|
|
2429
|
-
path:
|
|
2459
|
+
path: S,
|
|
2430
2460
|
tag: R,
|
|
2431
|
-
summary: F.summary ??
|
|
2461
|
+
summary: F.summary ?? D,
|
|
2432
2462
|
summary_html: L(l, F.summary),
|
|
2433
2463
|
description: F.description,
|
|
2434
2464
|
description_html: L(l, F.description),
|
|
@@ -2444,10 +2474,10 @@ function Ar(e) {
|
|
|
2444
2474
|
y.has(R) || y.set(R, []), y.get(R).push(ut);
|
|
2445
2475
|
}
|
|
2446
2476
|
}
|
|
2447
|
-
const v = [...y.entries()].map(([
|
|
2448
|
-
for (const [
|
|
2477
|
+
const v = [...y.entries()].map(([S, N]) => ({ name: S, operations: N })).sort((S, N) => S.name.localeCompare(N.name)), j = a.components?.schemas ?? {}, M = {};
|
|
2478
|
+
for (const [S, N] of Object.entries(j)) {
|
|
2449
2479
|
const I = L(l, N?.description);
|
|
2450
|
-
|
|
2480
|
+
M[S] = I ? { ...N, description_html: I } : N;
|
|
2451
2481
|
}
|
|
2452
2482
|
return {
|
|
2453
2483
|
title: g.title ?? "API",
|
|
@@ -2455,85 +2485,85 @@ function Ar(e) {
|
|
|
2455
2485
|
description: g.description,
|
|
2456
2486
|
description_html: L(l, g.description),
|
|
2457
2487
|
servers: a.servers,
|
|
2458
|
-
securitySchemes:
|
|
2488
|
+
securitySchemes: $,
|
|
2459
2489
|
tags: v,
|
|
2460
|
-
schemas:
|
|
2490
|
+
schemas: M
|
|
2461
2491
|
};
|
|
2462
2492
|
}
|
|
2463
|
-
async function lt(
|
|
2464
|
-
const l = await it(
|
|
2465
|
-
if (
|
|
2466
|
-
const tt = `${
|
|
2467
|
-
${
|
|
2493
|
+
async function lt(r) {
|
|
2494
|
+
const l = await it(r, "utf-8"), { data: a, content: g } = Te(l), $ = Fn(a, g);
|
|
2495
|
+
if ($.length) {
|
|
2496
|
+
const tt = `${r}
|
|
2497
|
+
${$.join(`
|
|
2468
2498
|
`)}`;
|
|
2469
2499
|
if (u) throw new Error(`[nimpress] invalid frontmatter in ${tt}`);
|
|
2470
2500
|
console.warn(`[nimpress] invalid frontmatter in ${tt}`);
|
|
2471
2501
|
}
|
|
2472
|
-
const h = Nn.safeParse(a), p = h.success ? h.data : { title:
|
|
2502
|
+
const h = Nn.safeParse(a), p = h.success ? h.data : { title: r }, y = vr(n, r), x = p.type ?? "doc", v = yn(p.path ?? $r(y)), j = typeof p.link == "string" && p.link.trim() !== "" ? p.link.trim() : void 0, M = !!j || a.type === void 0 && g.trim() === "", S = t.defaultFrontmatter ?? {};
|
|
2473
2503
|
if (!(t.defaultFrontmatterExclude ?? []).some((tt) => {
|
|
2474
2504
|
const bt = tt.startsWith("/") ? tt : "/" + tt;
|
|
2475
2505
|
return v === bt || v.startsWith(bt + "/");
|
|
2476
2506
|
}))
|
|
2477
|
-
for (const [tt, bt] of Object.entries(
|
|
2507
|
+
for (const [tt, bt] of Object.entries(S)) {
|
|
2478
2508
|
const Ct = tt;
|
|
2479
2509
|
(p[Ct] === void 0 || p[Ct] === null || p[Ct] === "") && (p[Ct] = bt);
|
|
2480
2510
|
}
|
|
2481
|
-
const U = await
|
|
2482
|
-
let z, V,
|
|
2511
|
+
const U = await E(), C = Sr(U, Q(), t.base), F = Pr(g, r), D = Er(C, F), R = C.render(F);
|
|
2512
|
+
let z, V, T, B;
|
|
2483
2513
|
if (x === "openapi")
|
|
2484
2514
|
if (!p.spec)
|
|
2485
|
-
console.warn(`[nimpress] page ${
|
|
2515
|
+
console.warn(`[nimpress] page ${r} has type openapi but no spec field`);
|
|
2486
2516
|
else {
|
|
2487
|
-
B = vt(p.spec) ? p.spec : q(G(
|
|
2488
|
-
const tt = await K(
|
|
2517
|
+
B = vt(p.spec) ? p.spec : q(G(r), p.spec), V = Mt(B), T = br(n, B);
|
|
2518
|
+
const tt = await K(r, p.spec);
|
|
2489
2519
|
z = tt ? ot(tt, C) ?? void 0 : void 0;
|
|
2490
2520
|
}
|
|
2491
2521
|
let J, Z, X, Y;
|
|
2492
2522
|
if (x === "dbml")
|
|
2493
2523
|
if (!p.spec)
|
|
2494
|
-
console.warn(`[nimpress] page ${
|
|
2524
|
+
console.warn(`[nimpress] page ${r} has type dbml but no spec field`);
|
|
2495
2525
|
else {
|
|
2496
|
-
B = vt(p.spec) ? p.spec : q(G(
|
|
2526
|
+
B = vt(p.spec) ? p.spec : q(G(r), p.spec), X = Mt(B);
|
|
2497
2527
|
try {
|
|
2498
2528
|
Z = await it(B, "utf-8"), J = kn(Z);
|
|
2499
2529
|
} catch (tt) {
|
|
2500
2530
|
Y = tt instanceof Be ? tt.message : String(tt);
|
|
2501
|
-
const bt = `${
|
|
2531
|
+
const bt = `${r} -> ${p.spec}
|
|
2502
2532
|
${Y}`;
|
|
2503
2533
|
if (u) throw new Error(`[nimpress] invalid dbml in ${bt}`);
|
|
2504
2534
|
console.warn(`[nimpress] invalid dbml in ${bt}`);
|
|
2505
2535
|
}
|
|
2506
2536
|
}
|
|
2507
|
-
mt(
|
|
2537
|
+
mt(r, B);
|
|
2508
2538
|
let ct, ut = [];
|
|
2509
2539
|
if (x === "component") {
|
|
2510
2540
|
const tt = await Yo({
|
|
2511
2541
|
cwd: process.cwd(),
|
|
2512
2542
|
modules: t.modules,
|
|
2513
|
-
pageFile:
|
|
2543
|
+
pageFile: r,
|
|
2514
2544
|
data: p.data ?? {},
|
|
2515
2545
|
editable: !u
|
|
2516
2546
|
});
|
|
2517
2547
|
ct = tt.data, ut = tt.watchFiles;
|
|
2518
2548
|
}
|
|
2519
|
-
Et(
|
|
2520
|
-
const ht =
|
|
2549
|
+
Et(r, ut);
|
|
2550
|
+
const ht = r.replace(/\.md$/, ".css");
|
|
2521
2551
|
let rt;
|
|
2522
|
-
return ht !==
|
|
2552
|
+
return ht !== r && dt(ht) && (rt = await it(ht, "utf-8")), {
|
|
2523
2553
|
slug: y,
|
|
2524
|
-
filePath:
|
|
2554
|
+
filePath: r,
|
|
2525
2555
|
effectivePath: v,
|
|
2526
2556
|
type: x,
|
|
2527
|
-
sidebarOnly:
|
|
2528
|
-
linkTo:
|
|
2557
|
+
sidebarOnly: M,
|
|
2558
|
+
linkTo: j,
|
|
2529
2559
|
frontmatter: p,
|
|
2530
2560
|
html: R,
|
|
2531
|
-
headings:
|
|
2561
|
+
headings: D,
|
|
2532
2562
|
rawText: g,
|
|
2533
2563
|
pageCss: rt,
|
|
2534
2564
|
openApiSpec: z,
|
|
2535
2565
|
openApiFile: V,
|
|
2536
|
-
openApiUrl:
|
|
2566
|
+
openApiUrl: T,
|
|
2537
2567
|
componentData: ct,
|
|
2538
2568
|
dbmlSchema: J,
|
|
2539
2569
|
dbmlSource: Z,
|
|
@@ -2541,153 +2571,153 @@ function Ar(e) {
|
|
|
2541
2571
|
dbmlError: Y
|
|
2542
2572
|
};
|
|
2543
2573
|
}
|
|
2544
|
-
function mt(
|
|
2574
|
+
function mt(r, l) {
|
|
2545
2575
|
for (const [a, g] of m)
|
|
2546
|
-
g ===
|
|
2547
|
-
l && (m.set(l,
|
|
2576
|
+
g === r && m.delete(a);
|
|
2577
|
+
l && (m.set(l, r), b && !w.has(l) && (b.watcher.add(l), w.add(l)));
|
|
2548
2578
|
}
|
|
2549
|
-
function Et(
|
|
2579
|
+
function Et(r, l) {
|
|
2550
2580
|
for (const [a, g] of k)
|
|
2551
|
-
g ===
|
|
2581
|
+
g === r && k.delete(a);
|
|
2552
2582
|
for (const a of l)
|
|
2553
|
-
k.set(a,
|
|
2583
|
+
k.set(a, r), b && !P.has(a) && (b.watcher.add(a), P.add(a));
|
|
2554
2584
|
}
|
|
2555
|
-
async function wt(
|
|
2585
|
+
async function wt(r) {
|
|
2556
2586
|
let l;
|
|
2557
2587
|
try {
|
|
2558
|
-
l = await it(
|
|
2588
|
+
l = await it(r, "utf-8");
|
|
2559
2589
|
} catch {
|
|
2560
2590
|
return null;
|
|
2561
2591
|
}
|
|
2562
|
-
const a =
|
|
2592
|
+
const a = O(l), g = d.get(r);
|
|
2563
2593
|
if (g && g.hash === a) return g.processed;
|
|
2564
|
-
const
|
|
2565
|
-
return
|
|
2594
|
+
const $ = await lt(r);
|
|
2595
|
+
return $ ? (d.set(r, { hash: a, processed: $ }), $) : (d.delete(r), null);
|
|
2566
2596
|
}
|
|
2567
|
-
function pt(
|
|
2568
|
-
d.delete(
|
|
2597
|
+
function pt(r) {
|
|
2598
|
+
d.delete(r);
|
|
2569
2599
|
}
|
|
2570
2600
|
function Q() {
|
|
2571
|
-
const
|
|
2601
|
+
const r = Object.keys(t.modules.systems);
|
|
2572
2602
|
return {
|
|
2573
2603
|
route: t.modules.route.replace(/\/$/, ""),
|
|
2574
|
-
system:
|
|
2604
|
+
system: r.length === 1 ? r[0] : void 0
|
|
2575
2605
|
};
|
|
2576
2606
|
}
|
|
2577
|
-
function $t(
|
|
2607
|
+
function $t(r) {
|
|
2578
2608
|
const l = t.exclude ?? [];
|
|
2579
2609
|
for (const a of l) {
|
|
2580
2610
|
const g = a.replace(/\/$/, "");
|
|
2581
|
-
if (
|
|
2611
|
+
if (r === g || r.startsWith(g + "/")) return !0;
|
|
2582
2612
|
}
|
|
2583
2613
|
return !1;
|
|
2584
2614
|
}
|
|
2585
2615
|
async function at() {
|
|
2586
|
-
const
|
|
2616
|
+
const r = await Je(n), l = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), $ = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), p = [], y = new Set(r);
|
|
2587
2617
|
for (const x of [...d.keys()])
|
|
2588
2618
|
y.has(x) || d.delete(x);
|
|
2589
|
-
for (const x of
|
|
2619
|
+
for (const x of r) {
|
|
2590
2620
|
let v = null;
|
|
2591
2621
|
try {
|
|
2592
2622
|
v = await wt(x);
|
|
2593
|
-
} catch (
|
|
2594
|
-
console.warn(`[nimpress] failed to process ${x}:`,
|
|
2623
|
+
} catch (M) {
|
|
2624
|
+
console.warn(`[nimpress] failed to process ${x}:`, M);
|
|
2595
2625
|
continue;
|
|
2596
2626
|
}
|
|
2597
2627
|
if (!v || $t(v.slug)) continue;
|
|
2598
2628
|
if (p.push(v), v.type === "changelog") {
|
|
2599
|
-
const
|
|
2600
|
-
N.push(v), g.set(
|
|
2629
|
+
const S = `${wr(v.slug)}\0${v.frontmatter.title}`, N = g.get(S) ?? [];
|
|
2630
|
+
N.push(v), g.set(S, N);
|
|
2601
2631
|
continue;
|
|
2602
2632
|
}
|
|
2603
2633
|
if (v.type === "roadmap") {
|
|
2604
|
-
const
|
|
2605
|
-
|
|
2634
|
+
const M = String(v.filePath);
|
|
2635
|
+
$.set(M, [v]);
|
|
2606
2636
|
}
|
|
2607
2637
|
if (v.type === "component") {
|
|
2608
|
-
const
|
|
2609
|
-
if (
|
|
2638
|
+
const M = G(v.filePath), S = h.get(M);
|
|
2639
|
+
if (S)
|
|
2610
2640
|
throw new Error(
|
|
2611
|
-
`[nimpress] one type component page per folder: ${
|
|
2641
|
+
`[nimpress] one type component page per folder: ${M} holds ${S} and ${v.filePath}`
|
|
2612
2642
|
);
|
|
2613
|
-
h.set(
|
|
2643
|
+
h.set(M, v.filePath);
|
|
2614
2644
|
}
|
|
2615
|
-
const
|
|
2616
|
-
if (
|
|
2645
|
+
const j = a.get(v.effectivePath);
|
|
2646
|
+
if (j)
|
|
2617
2647
|
throw new Error(
|
|
2618
|
-
`[nimpress] duplicate path ${v.effectivePath}: ${
|
|
2648
|
+
`[nimpress] duplicate path ${v.effectivePath}: ${j} and ${v.filePath}`
|
|
2619
2649
|
);
|
|
2620
2650
|
a.set(v.effectivePath, v.filePath), l.set(v.slug, v);
|
|
2621
2651
|
}
|
|
2622
2652
|
fe.clear();
|
|
2623
2653
|
for (const [x, v] of g) {
|
|
2624
|
-
const
|
|
2625
|
-
if (a.has(
|
|
2654
|
+
const j = x.split("\0", 1)[0], M = yn(j ? "/" + j : "/");
|
|
2655
|
+
if (a.has(M))
|
|
2626
2656
|
throw new Error(
|
|
2627
|
-
`[nimpress] path ${
|
|
2657
|
+
`[nimpress] path ${M} is occupied by both a changelog collection and a regular page`
|
|
2628
2658
|
);
|
|
2629
|
-
const
|
|
2630
|
-
if (
|
|
2631
|
-
|
|
2632
|
-
const z = String(
|
|
2659
|
+
const S = v.filter((D) => !(u && Dt(D.frontmatter)));
|
|
2660
|
+
if (S.length === 0) continue;
|
|
2661
|
+
S.sort((D, R) => {
|
|
2662
|
+
const z = String(D.frontmatter.data?.version ?? ""), V = String(R.frontmatter.data?.version ?? "");
|
|
2633
2663
|
return yr(V, z);
|
|
2634
2664
|
});
|
|
2635
|
-
const N =
|
|
2636
|
-
const R =
|
|
2665
|
+
const N = S[0], I = `__changelog__${(j || "root").replace(/\//g, "__")}`, U = S.map((D) => {
|
|
2666
|
+
const R = D.frontmatter.data, z = String(R?.version ?? ""), V = String(R?.title ?? ""), T = R?.description !== void 0 ? String(R.description) : void 0, B = R?.release_date;
|
|
2637
2667
|
let J;
|
|
2638
2668
|
if (B != null && String(B).trim() !== "") {
|
|
2639
2669
|
const X = B instanceof Date ? B.toISOString() : String(B), Y = new Date(X);
|
|
2640
2670
|
if (Number.isNaN(Y.getTime()))
|
|
2641
2671
|
throw new Error(
|
|
2642
|
-
`[nimpress] changelog entry ${
|
|
2672
|
+
`[nimpress] changelog entry ${D.filePath} has an invalid data.release_date (${X}). Use an RFC 3339 timestamp like 2026-06-10 or 2026-06-10T09:00:00Z.`
|
|
2643
2673
|
);
|
|
2644
2674
|
J = Y.toISOString();
|
|
2645
2675
|
}
|
|
2646
2676
|
const Z = z ? `v${z}` : "unreleased";
|
|
2647
|
-
return fe.set(`${I}#${Z}`,
|
|
2677
|
+
return fe.set(`${I}#${Z}`, D.rawText), {
|
|
2648
2678
|
version: z,
|
|
2649
2679
|
slug: Z,
|
|
2650
2680
|
title: V,
|
|
2651
|
-
description:
|
|
2681
|
+
description: T,
|
|
2652
2682
|
releaseDate: J,
|
|
2653
|
-
hidden: ne(
|
|
2654
|
-
html:
|
|
2655
|
-
headings:
|
|
2656
|
-
data:
|
|
2683
|
+
hidden: ne(D.frontmatter),
|
|
2684
|
+
html: D.html,
|
|
2685
|
+
headings: D.headings,
|
|
2686
|
+
data: D.frontmatter.data
|
|
2657
2687
|
};
|
|
2658
|
-
}), C = U.map((
|
|
2688
|
+
}), C = U.map((D) => ({
|
|
2659
2689
|
level: 2,
|
|
2660
|
-
text:
|
|
2661
|
-
slug:
|
|
2690
|
+
text: D.version ? `v${D.version}` : D.title || "unreleased",
|
|
2691
|
+
slug: D.slug
|
|
2662
2692
|
})), F = {
|
|
2663
2693
|
slug: I,
|
|
2664
2694
|
filePath: N.filePath,
|
|
2665
|
-
effectivePath:
|
|
2695
|
+
effectivePath: M,
|
|
2666
2696
|
type: "changelog",
|
|
2667
2697
|
frontmatter: {
|
|
2668
2698
|
...N.frontmatter,
|
|
2669
|
-
path:
|
|
2699
|
+
path: M,
|
|
2670
2700
|
type: "changelog",
|
|
2671
|
-
rss:
|
|
2672
|
-
subscribe:
|
|
2701
|
+
rss: S.some((D) => D.frontmatter.rss === !0) ? !0 : void 0,
|
|
2702
|
+
subscribe: S.some((D) => D.frontmatter.subscribe === !0) ? !0 : void 0
|
|
2673
2703
|
},
|
|
2674
2704
|
html: "",
|
|
2675
2705
|
headings: C,
|
|
2676
|
-
rawText:
|
|
2706
|
+
rawText: S.map((D) => D.rawText).join(`
|
|
2677
2707
|
|
|
2678
2708
|
`),
|
|
2679
2709
|
changelogEntries: U
|
|
2680
2710
|
};
|
|
2681
|
-
a.set(
|
|
2711
|
+
a.set(M, F.filePath), l.set(F.slug, F);
|
|
2682
2712
|
}
|
|
2683
|
-
Yn(
|
|
2713
|
+
Yn($, p), Rn(l), Bn(l), o = l;
|
|
2684
2714
|
}
|
|
2685
2715
|
const St = /* @__PURE__ */ new Map(), fe = /* @__PURE__ */ new Map();
|
|
2686
2716
|
let me = JSON.stringify({ pages: [] }, null, 2) + `
|
|
2687
2717
|
`;
|
|
2688
|
-
function Bn(
|
|
2718
|
+
function Bn(r) {
|
|
2689
2719
|
const l = [];
|
|
2690
|
-
for (const a of
|
|
2720
|
+
for (const a of r.values()) {
|
|
2691
2721
|
if (a.frontmatter.subscribe !== !0 || ke(a.frontmatter)) continue;
|
|
2692
2722
|
const g = a.effectivePath === "/" ? "" : a.effectivePath, h = `${yt(a) ? `/${t.paths.guarded}/${Xt(a)}` : ""}${g}/${hn(0)}`;
|
|
2693
2723
|
if (!St.has(h)) continue;
|
|
@@ -2709,32 +2739,32 @@ function Ar(e) {
|
|
|
2709
2739
|
l.sort((a, g) => a.path.localeCompare(g.path)), me = JSON.stringify({ pages: l }, null, 2) + `
|
|
2710
2740
|
`;
|
|
2711
2741
|
}
|
|
2712
|
-
function Rn(
|
|
2742
|
+
function Rn(r) {
|
|
2713
2743
|
St.clear();
|
|
2714
2744
|
const l = t.site?.url?.replace(/\/$/, "");
|
|
2715
|
-
for (const a of
|
|
2745
|
+
for (const a of r.values()) {
|
|
2716
2746
|
if (a.type !== "changelog" || !(a.frontmatter.rss === !0 || a.frontmatter.subscribe === !0)) continue;
|
|
2717
2747
|
if (!l) {
|
|
2718
2748
|
console.warn(`[nimpress] changelog feed for ${a.effectivePath} needs site.url in the config, skipping`);
|
|
2719
2749
|
continue;
|
|
2720
2750
|
}
|
|
2721
|
-
const g = (a.changelogEntries ?? []).filter((
|
|
2751
|
+
const g = (a.changelogEntries ?? []).filter((D) => !D.hidden);
|
|
2722
2752
|
if (g.length === 0) continue;
|
|
2723
|
-
const
|
|
2724
|
-
for (let
|
|
2725
|
-
const
|
|
2753
|
+
const $ = a.effectivePath === "/" ? "" : a.effectivePath, h = `${l}${gt(t.base, $ || "/")}`, p = yt(a) ? `/${t.paths.guarded}/${Xt(a)}` : "", y = (D) => `${p}${$}/${hn(D)}`, x = g.map((D) => D.releaseDate ? new Date(D.releaseDate).getTime() : Number.NaN).filter((D) => !Number.isNaN(D)).sort((D, R) => R - D), v = [];
|
|
2754
|
+
for (let D = 0; D + 1 < x.length; D++) v.push(x[D] - x[D + 1]);
|
|
2755
|
+
const j = v.length ? Math.round(v.reduce((D, R) => D + R, 0) / v.length / 1e3) : void 0, M = j ? Math.min(43200, Math.max(60, Math.round(j / 60))) : 1440, S = j ? j <= 172800 ? "daily" : j <= 1209600 ? "weekly" : j <= 5184e3 ? "monthly" : "yearly" : "weekly", N = x.length ? new Date(x[0]).toUTCString() : void 0, I = ft(a.frontmatter.title), U = ft(
|
|
2726
2756
|
a.frontmatter.description ?? t.site?.description ?? a.frontmatter.title
|
|
2727
2757
|
), C = t.site?.locale?.replace("_", "-").toLowerCase(), F = Math.max(1, Math.ceil(g.length / xe));
|
|
2728
|
-
for (let
|
|
2729
|
-
const R = g.slice(
|
|
2730
|
-
`<atom:link href="${ft(`${l}${gt(t.base, y(
|
|
2758
|
+
for (let D = 0; D < F; D++) {
|
|
2759
|
+
const R = g.slice(D * xe, (D + 1) * xe), z = [
|
|
2760
|
+
`<atom:link href="${ft(`${l}${gt(t.base, y(D))}`)}" rel="self" type="application/rss+xml"/>`
|
|
2731
2761
|
];
|
|
2732
|
-
|
|
2762
|
+
D > 0 && z.push(
|
|
2733
2763
|
`<atom:link href="${ft(`${l}${gt(t.base, y(0))}`)}" rel="current" type="application/rss+xml"/>`
|
|
2734
|
-
),
|
|
2735
|
-
`<atom:link href="${ft(`${l}${gt(t.base, y(
|
|
2736
|
-
),
|
|
2737
|
-
`<atom:link href="${ft(`${l}${gt(t.base, y(
|
|
2764
|
+
), D + 1 < F && z.push(
|
|
2765
|
+
`<atom:link href="${ft(`${l}${gt(t.base, y(D + 1))}`)}" rel="prev-archive" type="application/rss+xml"/>`
|
|
2766
|
+
), D > 1 && z.push(
|
|
2767
|
+
`<atom:link href="${ft(`${l}${gt(t.base, y(D - 1))}`)}" rel="next-archive" type="application/rss+xml"/>`
|
|
2738
2768
|
);
|
|
2739
2769
|
const V = R.map((J) => {
|
|
2740
2770
|
const Z = `${h}#${J.slug}`, X = [
|
|
@@ -2746,18 +2776,18 @@ function Ar(e) {
|
|
|
2746
2776
|
${X.join(`
|
|
2747
2777
|
`)}
|
|
2748
2778
|
</item>`;
|
|
2749
|
-
}),
|
|
2779
|
+
}), T = [
|
|
2750
2780
|
`<title>${I}</title>`,
|
|
2751
2781
|
`<link>${ft(h)}</link>`,
|
|
2752
2782
|
`<description>${U}</description>`,
|
|
2753
2783
|
...z
|
|
2754
2784
|
];
|
|
2755
|
-
C &&
|
|
2785
|
+
C && T.push(`<language>${ft(C)}</language>`), N && T.push(`<lastBuildDate>${N}</lastBuildDate>`), T.push(`<ttl>${M}</ttl>`), T.push(`<sy:updatePeriod>${S}</sy:updatePeriod>`), T.push("<sy:updateFrequency>1</sy:updateFrequency>"), j !== void 0 && T.push(`<nimpress:releaseCadence>${j}</nimpress:releaseCadence>`), T.push(`<nimpress:latestVersion>${ft(g[0].version)}</nimpress:latestVersion>`), T.push(`<nimpress:releaseCount>${g.length}</nimpress:releaseCount>`), D > 0 && T.push("<fh:archive/>");
|
|
2756
2786
|
const B = [
|
|
2757
2787
|
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
2758
2788
|
`<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:fh="http://purl.org/syndication/history/1.0" xmlns:nimpress="${pr}">`,
|
|
2759
2789
|
" <channel>",
|
|
2760
|
-
` ${
|
|
2790
|
+
` ${T.join(`
|
|
2761
2791
|
`)}`,
|
|
2762
2792
|
V.join(`
|
|
2763
2793
|
`),
|
|
@@ -2765,44 +2795,44 @@ function Ar(e) {
|
|
|
2765
2795
|
"</rss>"
|
|
2766
2796
|
].join(`
|
|
2767
2797
|
`);
|
|
2768
|
-
St.set(y(
|
|
2798
|
+
St.set(y(D), B);
|
|
2769
2799
|
}
|
|
2770
2800
|
}
|
|
2771
2801
|
}
|
|
2772
2802
|
const de = /* @__PURE__ */ new Map();
|
|
2773
|
-
function yt(
|
|
2774
|
-
return
|
|
2803
|
+
function yt(r) {
|
|
2804
|
+
return r.frontmatter.gate !== void 0;
|
|
2775
2805
|
}
|
|
2776
|
-
function Wn(
|
|
2777
|
-
const l = G(
|
|
2806
|
+
function Wn(r) {
|
|
2807
|
+
const l = G(r.filePath);
|
|
2778
2808
|
let a = [];
|
|
2779
2809
|
try {
|
|
2780
2810
|
a = pe(l);
|
|
2781
2811
|
} catch {
|
|
2782
2812
|
return [];
|
|
2783
2813
|
}
|
|
2784
|
-
return a.filter((g) => W(l, g) !==
|
|
2814
|
+
return a.filter((g) => W(l, g) !== r.filePath).map((g) => jt(process.cwd(), W(l, g)));
|
|
2785
2815
|
}
|
|
2786
|
-
function Xt(
|
|
2816
|
+
function Xt(r) {
|
|
2787
2817
|
const l = t.auth?.guard;
|
|
2788
|
-
return typeof l == "function" ? l(
|
|
2818
|
+
return typeof l == "function" ? l(r.frontmatter, jt(process.cwd(), r.filePath), Wn(r)) : r.frontmatter.gate ?? "default";
|
|
2789
2819
|
}
|
|
2790
2820
|
function Ln() {
|
|
2791
|
-
const
|
|
2792
|
-
for (const l of
|
|
2793
|
-
l.sidebarOnly || ke(l.frontmatter) || yt(l) ||
|
|
2794
|
-
return
|
|
2821
|
+
const r = [];
|
|
2822
|
+
for (const l of o.values())
|
|
2823
|
+
l.sidebarOnly || ke(l.frontmatter) || yt(l) || r.push(l);
|
|
2824
|
+
return r;
|
|
2795
2825
|
}
|
|
2796
|
-
function xt(
|
|
2826
|
+
function xt(r) {
|
|
2797
2827
|
const l = t.site?.url?.replace(/\/$/, "");
|
|
2798
2828
|
if (l)
|
|
2799
|
-
return l + gt(t.base,
|
|
2829
|
+
return l + gt(t.base, r.startsWith("/") ? r : "/" + r);
|
|
2800
2830
|
}
|
|
2801
|
-
function qe(
|
|
2802
|
-
if (de.has(
|
|
2831
|
+
function qe(r) {
|
|
2832
|
+
if (de.has(r)) return de.get(r);
|
|
2803
2833
|
let l;
|
|
2804
2834
|
try {
|
|
2805
|
-
l = cs("git", ["log", "-1", "--format=%cI", "--",
|
|
2835
|
+
l = cs("git", ["log", "-1", "--format=%cI", "--", r], {
|
|
2806
2836
|
cwd: process.cwd(),
|
|
2807
2837
|
encoding: "utf-8",
|
|
2808
2838
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -2810,27 +2840,27 @@ function Ar(e) {
|
|
|
2810
2840
|
} catch {
|
|
2811
2841
|
l = void 0;
|
|
2812
2842
|
}
|
|
2813
|
-
return de.set(
|
|
2843
|
+
return de.set(r, l), l;
|
|
2814
2844
|
}
|
|
2815
|
-
function Hn(
|
|
2816
|
-
return
|
|
2845
|
+
function Hn(r) {
|
|
2846
|
+
return r === "changelog" || r === "roadmap" ? "CollectionPage" : r === "openapi" ? "APIReference" : r === "hero" ? "WebPage" : "TechArticle";
|
|
2817
2847
|
}
|
|
2818
|
-
function Un(
|
|
2819
|
-
const l = t.meta ?? {}, a = t.site, g =
|
|
2820
|
-
if (
|
|
2848
|
+
function Un(r) {
|
|
2849
|
+
const l = t.meta ?? {}, a = t.site, g = r.frontmatter, $ = g.meta ?? {}, h = $.og ?? {}, p = $.twitter ?? {}, y = g.title, x = a?.title && a.title !== y ? `${y} · ${a.title}` : y, v = $.description ?? g.description ?? a?.description, j = $.canonical ?? xt(r.effectivePath), M = (() => {
|
|
2850
|
+
if ($.keywords) return Array.isArray($.keywords) ? $.keywords : [$.keywords];
|
|
2821
2851
|
const X = ge(g.tags);
|
|
2822
2852
|
return X.length ? X : l.keywords ?? [];
|
|
2823
|
-
})(),
|
|
2824
|
-
if (B.push(`<title>${
|
|
2825
|
-
B.push(`<link rel="canonical" href="${
|
|
2853
|
+
})(), S = $.robots ?? "index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1", N = h.title ?? y, I = h.description ?? v, U = h.image ?? a?.ogImage, C = U ? xt(U) ?? U : void 0, F = h.type ?? (g.type === "hero" || r.effectivePath === "/" ? "website" : "article"), D = l.og?.width ?? 1200, R = l.og?.height ?? 600, z = p.card ?? (C ? "summary_large_image" : "summary"), V = p.site ?? a?.twitterSite, T = qt, B = [];
|
|
2854
|
+
if (B.push(`<title>${T(x)}</title>`), v && B.push(`<meta name="description" content="${T(v)}">`), M.length && B.push(`<meta name="keywords" content="${T(M.join(", "))}">`), B.push(`<meta name="robots" content="${T(S)}">`), B.push(`<meta name="googlebot" content="${T(S)}">`), j) {
|
|
2855
|
+
B.push(`<link rel="canonical" href="${T(j)}">`);
|
|
2826
2856
|
const X = l.localeAlternates ?? [];
|
|
2827
2857
|
for (const Y of X)
|
|
2828
|
-
B.push(`<link rel="alternate" hreflang="${
|
|
2829
|
-
X.length && B.push(`<link rel="alternate" hreflang="x-default" href="${
|
|
2858
|
+
B.push(`<link rel="alternate" hreflang="${T(Y)}" href="${T(j)}">`);
|
|
2859
|
+
X.length && B.push(`<link rel="alternate" hreflang="x-default" href="${T(j)}">`);
|
|
2830
2860
|
}
|
|
2831
|
-
if (B.push(`<meta property="og:title" content="${
|
|
2832
|
-
const X =
|
|
2833
|
-
B.push(`<link rel="alternate" type="application/rss+xml" title="${
|
|
2861
|
+
if (B.push(`<meta property="og:title" content="${T(N)}">`), I && B.push(`<meta property="og:description" content="${T(I)}">`), B.push(`<meta property="og:type" content="${T(F)}">`), j && B.push(`<meta property="og:url" content="${T(j)}">`), C && (B.push(`<meta property="og:image" content="${T(C)}">`), B.push(`<meta property="og:image:width" content="${D}">`), B.push(`<meta property="og:image:height" content="${R}">`), h.imageAlt && B.push(`<meta property="og:image:alt" content="${T(h.imageAlt)}">`)), a?.title && B.push(`<meta property="og:site_name" content="${T(a.title)}">`), a?.locale && B.push(`<meta property="og:locale" content="${T(a.locale)}">`), B.push(`<meta name="twitter:card" content="${T(z)}">`), V && B.push(`<meta name="twitter:site" content="${T(V)}">`), B.push(`<meta name="twitter:title" content="${T(p.title ?? N)}">`), (p.description ?? I) && B.push(`<meta name="twitter:description" content="${T(p.description ?? I ?? "")}">`), (p.image ?? C) && B.push(`<meta name="twitter:image" content="${T(p.image ?? C ?? "")}">`), v && B.push(`<meta name="dc.description" content="${T(v)}">`), B.push(`<meta name="dc.title" content="${T(x)}">`), a?.locale && B.push(`<meta name="dc.language" content="${T(a.locale)}">`), g.type === "changelog" && (g.rss === !0 || g.subscribe === !0)) {
|
|
2862
|
+
const X = r.effectivePath === "/" ? "/rss.xml" : `${r.effectivePath}/rss.xml`, Y = xt(X) ?? X;
|
|
2863
|
+
B.push(`<link rel="alternate" type="application/rss+xml" title="${T(y)}" href="${T(Y)}">`);
|
|
2834
2864
|
}
|
|
2835
2865
|
const J = t.site?.url?.replace(/\/$/, ""), Z = [];
|
|
2836
2866
|
if (l.organization && Z.push({ "@context": "https://schema.org", ...l.organization }), J && a?.title && Z.push({
|
|
@@ -2840,14 +2870,14 @@ function Ar(e) {
|
|
|
2840
2870
|
name: a.title,
|
|
2841
2871
|
url: `${J}${gt(t.base, "/")}`,
|
|
2842
2872
|
description: a.description
|
|
2843
|
-
}),
|
|
2873
|
+
}), j && r.effectivePath !== "/") {
|
|
2844
2874
|
const X = [
|
|
2845
2875
|
{ name: a?.title ?? "Home", item: J ? `${J}${gt(t.base, "/")}` : void 0 }
|
|
2846
|
-
], Y =
|
|
2876
|
+
], Y = r.effectivePath.split("/").filter(Boolean);
|
|
2847
2877
|
let ct = "";
|
|
2848
2878
|
for (const ut of Y) {
|
|
2849
2879
|
ct += "/" + ut;
|
|
2850
|
-
const ht = [...
|
|
2880
|
+
const ht = [...o.values()].find((rt) => rt.effectivePath === ct);
|
|
2851
2881
|
X.push({ name: ht?.frontmatter.title ?? se(ut), item: xt(ct) });
|
|
2852
2882
|
}
|
|
2853
2883
|
Z.push({
|
|
@@ -2863,14 +2893,14 @@ function Ar(e) {
|
|
|
2863
2893
|
}
|
|
2864
2894
|
Z.push({
|
|
2865
2895
|
"@context": "https://schema.org",
|
|
2866
|
-
"@type": Hn(
|
|
2896
|
+
"@type": Hn(r.type),
|
|
2867
2897
|
name: x,
|
|
2868
2898
|
headline: y,
|
|
2869
2899
|
description: v,
|
|
2870
|
-
url:
|
|
2900
|
+
url: j,
|
|
2871
2901
|
isPartOf: J ? `${J}${gt(t.base, "/")}#website` : void 0,
|
|
2872
|
-
dateModified: qe(
|
|
2873
|
-
}),
|
|
2902
|
+
dateModified: qe(r.filePath)
|
|
2903
|
+
}), $.jsonLd && Z.push($.jsonLd);
|
|
2874
2904
|
for (const X of Z) B.push(fr(X));
|
|
2875
2905
|
return `
|
|
2876
2906
|
${B.join(`
|
|
@@ -2878,14 +2908,14 @@ function Ar(e) {
|
|
|
2878
2908
|
`;
|
|
2879
2909
|
}
|
|
2880
2910
|
function Jn() {
|
|
2881
|
-
const
|
|
2882
|
-
if (
|
|
2883
|
-
const l = new Set(
|
|
2884
|
-
for (const
|
|
2885
|
-
a.push(`User-agent: ${
|
|
2886
|
-
for (const
|
|
2887
|
-
gn.includes(
|
|
2888
|
-
|
|
2911
|
+
const r = t.meta ?? {};
|
|
2912
|
+
if (r.robots?.custom) return r.robots.custom;
|
|
2913
|
+
const l = new Set(r.robots?.block ?? []), a = ["User-agent: *", "Allow: /", ""];
|
|
2914
|
+
for (const $ of gn)
|
|
2915
|
+
a.push(`User-agent: ${$}`), a.push(l.has($) ? "Disallow: /" : "Allow: /"), a.push("");
|
|
2916
|
+
for (const $ of l)
|
|
2917
|
+
gn.includes($) || (a.push(`User-agent: ${$}`), a.push("Disallow: /"), a.push(""));
|
|
2918
|
+
r.robots?.append && a.push(r.robots.append, "");
|
|
2889
2919
|
const g = xt("/sitemap.xml");
|
|
2890
2920
|
return g && a.push(`Sitemap: ${g}`), a.join(`
|
|
2891
2921
|
`).replace(/\n{3,}/g, `
|
|
@@ -2893,20 +2923,20 @@ function Ar(e) {
|
|
|
2893
2923
|
`).trim() + `
|
|
2894
2924
|
`;
|
|
2895
2925
|
}
|
|
2896
|
-
function qn(
|
|
2926
|
+
function qn(r) {
|
|
2897
2927
|
const l = t.site?.url?.replace(/\/$/, "");
|
|
2898
2928
|
if (!l) return;
|
|
2899
2929
|
const a = t.meta?.localeAlternates ?? [];
|
|
2900
2930
|
return [
|
|
2901
2931
|
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
2902
2932
|
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">',
|
|
2903
|
-
|
|
2904
|
-
const h = `${l}${gt(t.base,
|
|
2905
|
-
v &&
|
|
2906
|
-
for (const
|
|
2907
|
-
|
|
2933
|
+
r.map(($) => {
|
|
2934
|
+
const h = `${l}${gt(t.base, $.effectivePath === "/" ? "/" : $.effectivePath)}`, p = $.effectivePath.split("/").filter(Boolean).length, y = p === 0 ? "1.0" : p === 1 ? "0.8" : "0.6", x = p === 0 ? "weekly" : "monthly", v = qe($.filePath), j = [` <loc>${ft(h)}</loc>`];
|
|
2935
|
+
v && j.push(` <lastmod>${ft(v)}</lastmod>`), j.push(` <changefreq>${x}</changefreq>`), j.push(` <priority>${y}</priority>`);
|
|
2936
|
+
for (const M of a)
|
|
2937
|
+
j.push(` <xhtml:link rel="alternate" hreflang="${ft(M)}" href="${ft(h)}"/>`);
|
|
2908
2938
|
return ` <url>
|
|
2909
|
-
${
|
|
2939
|
+
${j.join(`
|
|
2910
2940
|
`)}
|
|
2911
2941
|
</url>`;
|
|
2912
2942
|
}).join(`
|
|
@@ -2916,46 +2946,46 @@ ${P.join(`
|
|
|
2916
2946
|
].join(`
|
|
2917
2947
|
`);
|
|
2918
2948
|
}
|
|
2919
|
-
function zn(
|
|
2920
|
-
const l = t.meta ?? {}, a = t.site, g = [`# ${a?.title ?? t.title}`, ""],
|
|
2921
|
-
|
|
2949
|
+
function zn(r) {
|
|
2950
|
+
const l = t.meta ?? {}, a = t.site, g = [`# ${a?.title ?? t.title}`, ""], $ = l.llms?.summary ?? a?.description;
|
|
2951
|
+
$ && g.push(`> ${$}`, "");
|
|
2922
2952
|
const h = /* @__PURE__ */ new Map(), p = [];
|
|
2923
|
-
for (const
|
|
2924
|
-
const
|
|
2925
|
-
if (
|
|
2926
|
-
p.push(
|
|
2953
|
+
for (const M of r) {
|
|
2954
|
+
const S = M.effectivePath.split("/").filter(Boolean);
|
|
2955
|
+
if (S.length === 0) {
|
|
2956
|
+
p.push(M);
|
|
2927
2957
|
continue;
|
|
2928
2958
|
}
|
|
2929
|
-
const N =
|
|
2930
|
-
I.push(
|
|
2959
|
+
const N = S[0], I = h.get(N) ?? [];
|
|
2960
|
+
I.push(M), h.set(N, I);
|
|
2931
2961
|
}
|
|
2932
|
-
const y = (
|
|
2933
|
-
const
|
|
2934
|
-
return
|
|
2962
|
+
const y = (M) => {
|
|
2963
|
+
const S = xt(M.effectivePath) ?? M.effectivePath;
|
|
2964
|
+
return M.frontmatter.description ? `- [${M.frontmatter.title}](${S}): ${M.frontmatter.description}` : `- [${M.frontmatter.title}](${S})`;
|
|
2935
2965
|
};
|
|
2936
|
-
for (const
|
|
2966
|
+
for (const M of p) g.push(y(M));
|
|
2937
2967
|
p.length && g.push("");
|
|
2938
|
-
for (const [
|
|
2939
|
-
const N =
|
|
2940
|
-
g.push(`## ${N?.frontmatter.title ?? se(
|
|
2941
|
-
for (const I of
|
|
2968
|
+
for (const [M, S] of [...h.entries()].sort((N, I) => N[0].localeCompare(I[0]))) {
|
|
2969
|
+
const N = S.find((I) => I.effectivePath === `/${M}`);
|
|
2970
|
+
g.push(`## ${N?.frontmatter.title ?? se(M)}`, ""), S.sort((I, U) => I.effectivePath.localeCompare(U.effectivePath));
|
|
2971
|
+
for (const I of S) g.push(y(I));
|
|
2942
2972
|
g.push("");
|
|
2943
2973
|
}
|
|
2944
2974
|
const x = new Set(t.meta?.keywords ?? []);
|
|
2945
|
-
for (const
|
|
2975
|
+
for (const M of r) for (const S of ge(M.frontmatter.tags)) x.add(S);
|
|
2946
2976
|
x.size && g.push("## Keywords", "", [...x].join(", "), "");
|
|
2947
|
-
const v = xt("/sitemap.xml"),
|
|
2948
|
-
return (v ||
|
|
2977
|
+
const v = xt("/sitemap.xml"), j = xt("/robots.txt");
|
|
2978
|
+
return (v || j) && (g.push("## Optional", ""), v && g.push(`- [Sitemap](${v})`), j && g.push(`- [Robots](${j})`), g.push("")), l.llms?.append && g.push(l.llms.append, ""), g.join(`
|
|
2949
2979
|
`).replace(/\n{3,}/g, `
|
|
2950
2980
|
|
|
2951
2981
|
`);
|
|
2952
2982
|
}
|
|
2953
|
-
function Gn(
|
|
2983
|
+
function Gn(r) {
|
|
2954
2984
|
const a = [`# ${t.site?.title ?? t.title}`, ""];
|
|
2955
|
-
for (const g of
|
|
2985
|
+
for (const g of r) {
|
|
2956
2986
|
a.push(`## ${g.frontmatter.title}`, "");
|
|
2957
|
-
const
|
|
2958
|
-
|
|
2987
|
+
const $ = xt(g.effectivePath);
|
|
2988
|
+
$ && a.push(`URL: ${$}`, ""), a.push(g.rawText.trim(), "");
|
|
2959
2989
|
}
|
|
2960
2990
|
return a.join(`
|
|
2961
2991
|
`).replace(/\n{3,}/g, `
|
|
@@ -2963,25 +2993,25 @@ ${P.join(`
|
|
|
2963
2993
|
`);
|
|
2964
2994
|
}
|
|
2965
2995
|
async function Vn() {
|
|
2966
|
-
const
|
|
2996
|
+
const r = t.meta ?? {}, l = Ln().sort((h, p) => h.effectivePath.localeCompare(p.effectivePath)), a = W(c, "index.html"), g = await it(a, "utf-8");
|
|
2967
2997
|
for (const h of l) {
|
|
2968
2998
|
const p = Un(h), y = g.replace("</head>", `${p}</head>`), x = h.effectivePath === "/" ? a : W(c, h.effectivePath.replace(/^\//, ""), "index.html");
|
|
2969
2999
|
await Tt(G(x), { recursive: !0 }), await nt(x, y);
|
|
2970
3000
|
}
|
|
2971
3001
|
await nt(W(c, "robots.txt"), Jn());
|
|
2972
|
-
const
|
|
2973
|
-
if (
|
|
2974
|
-
`),
|
|
2975
|
-
`),
|
|
2976
|
-
const h =
|
|
3002
|
+
const $ = qn(l);
|
|
3003
|
+
if ($ && await nt(W(c, "sitemap.xml"), $), await nt(W(c, "llms.txt"), zn(l)), r.llms?.full && await nt(W(c, "llms-full.txt"), Gn(l)), r.webmanifest && await nt(W(c, "site.webmanifest"), JSON.stringify(r.webmanifest, null, 2) + `
|
|
3004
|
+
`), r.humans && await nt(W(c, "humans.txt"), r.humans.trim() + `
|
|
3005
|
+
`), r.security) {
|
|
3006
|
+
const h = r.security, p = [];
|
|
2977
3007
|
h.contact && p.push(`Contact: ${h.contact}`), h.policy && p.push(`Policy: ${h.policy}`), h.languages && p.push(`Preferred-Languages: ${h.languages}`), h.canonical && p.push(`Canonical: ${h.canonical}`), h.expires && p.push(`Expires: ${h.expires}`), p.length && (await Tt(W(c, ".well-known"), { recursive: !0 }), await nt(W(c, ".well-known", "security.txt"), p.join(`
|
|
2978
3008
|
`) + `
|
|
2979
3009
|
`));
|
|
2980
3010
|
}
|
|
2981
3011
|
}
|
|
2982
3012
|
async function Xn() {
|
|
2983
|
-
const
|
|
2984
|
-
for (const p of
|
|
3013
|
+
const r = [...o.values()].filter((p) => !ke(p.frontmatter) && yt(p)), l = {}, a = /* @__PURE__ */ new Map();
|
|
3014
|
+
for (const p of r) {
|
|
2985
3015
|
const y = Xt(p);
|
|
2986
3016
|
l[p.effectivePath] = { gate: p.frontmatter.gate, bundle: y };
|
|
2987
3017
|
const x = a.get(y) ?? [];
|
|
@@ -2992,42 +3022,42 @@ ${P.join(`
|
|
|
2992
3022
|
W(c, "access.json"),
|
|
2993
3023
|
JSON.stringify({ prefix: g, routes: l }, null, 2) + `
|
|
2994
3024
|
`
|
|
2995
|
-
),
|
|
2996
|
-
const
|
|
3025
|
+
), r.length === 0) return;
|
|
3026
|
+
const $ = W(c, t.paths.guarded), h = {};
|
|
2997
3027
|
for (const [p, y] of a) {
|
|
2998
|
-
const x = W(
|
|
3028
|
+
const x = W($, p);
|
|
2999
3029
|
await Tt(W(x, "body"), { recursive: !0 });
|
|
3000
|
-
const v = {},
|
|
3001
|
-
slug:
|
|
3002
|
-
path:
|
|
3003
|
-
type:
|
|
3004
|
-
frontmatter:
|
|
3030
|
+
const v = {}, j = y.map((S) => ({
|
|
3031
|
+
slug: S.slug,
|
|
3032
|
+
path: S.effectivePath,
|
|
3033
|
+
type: S.type,
|
|
3034
|
+
frontmatter: S.frontmatter,
|
|
3005
3035
|
bundle: p
|
|
3006
|
-
})),
|
|
3007
|
-
for (const
|
|
3008
|
-
|
|
3036
|
+
})), M = [`${p}/manifest.json`, `${p}/search.json`];
|
|
3037
|
+
for (const S of y) {
|
|
3038
|
+
S.pageCss && (v[S.effectivePath] = S.pageCss);
|
|
3009
3039
|
const N = {
|
|
3010
|
-
html:
|
|
3011
|
-
headings:
|
|
3012
|
-
openApiSpec:
|
|
3013
|
-
openApiFile:
|
|
3014
|
-
openApiUrl:
|
|
3015
|
-
changelogEntries:
|
|
3016
|
-
roadmapEntries:
|
|
3017
|
-
componentData:
|
|
3018
|
-
dbmlSchema:
|
|
3019
|
-
dbmlSource:
|
|
3020
|
-
dbmlFile:
|
|
3021
|
-
dbmlError:
|
|
3022
|
-
}, I = W(x, "body", `${At(
|
|
3023
|
-
await Tt(G(I), { recursive: !0 }), await nt(I, JSON.stringify(N)),
|
|
3040
|
+
html: S.html,
|
|
3041
|
+
headings: S.headings,
|
|
3042
|
+
openApiSpec: S.openApiSpec,
|
|
3043
|
+
openApiFile: S.openApiFile,
|
|
3044
|
+
openApiUrl: S.openApiUrl,
|
|
3045
|
+
changelogEntries: S.changelogEntries,
|
|
3046
|
+
roadmapEntries: S.roadmapEntries,
|
|
3047
|
+
componentData: S.componentData,
|
|
3048
|
+
dbmlSchema: S.dbmlSchema,
|
|
3049
|
+
dbmlSource: S.dbmlSource,
|
|
3050
|
+
dbmlFile: S.dbmlFile,
|
|
3051
|
+
dbmlError: S.dbmlError
|
|
3052
|
+
}, I = W(x, "body", `${At(S.slug)}.json`);
|
|
3053
|
+
await Tt(G(I), { recursive: !0 }), await nt(I, JSON.stringify(N)), M.push(`${p}/body/${At(S.slug)}.json`);
|
|
3024
3054
|
}
|
|
3025
3055
|
await nt(
|
|
3026
3056
|
W(x, "manifest.json"),
|
|
3027
|
-
JSON.stringify({ shells:
|
|
3057
|
+
JSON.stringify({ shells: j, styles: v, sidebar: Ve(!0) })
|
|
3028
3058
|
), await nt(W(x, "search.json"), JSON.stringify(Xe(!0, y))), h[p] = {
|
|
3029
|
-
pages: Object.fromEntries(y.map((
|
|
3030
|
-
files:
|
|
3059
|
+
pages: Object.fromEntries(y.map((S) => [S.effectivePath, S.frontmatter.gate ?? ""])),
|
|
3060
|
+
files: M
|
|
3031
3061
|
};
|
|
3032
3062
|
}
|
|
3033
3063
|
await nt(
|
|
@@ -3036,40 +3066,40 @@ ${P.join(`
|
|
|
3036
3066
|
`
|
|
3037
3067
|
);
|
|
3038
3068
|
}
|
|
3039
|
-
function Yn(
|
|
3040
|
-
if (
|
|
3041
|
-
const a = l.filter((
|
|
3042
|
-
for (const
|
|
3043
|
-
for (const [,
|
|
3044
|
-
const h =
|
|
3069
|
+
function Yn(r, l) {
|
|
3070
|
+
if (r.size === 0) return;
|
|
3071
|
+
const a = l.filter(($) => Kn($.type)), g = /* @__PURE__ */ new Map();
|
|
3072
|
+
for (const $ of a) g.set($.filePath, $);
|
|
3073
|
+
for (const [, $] of r) {
|
|
3074
|
+
const h = $[0], p = G(h.filePath), y = h.frontmatter.data, x = y?.issues ?? y?.entries, v = [];
|
|
3045
3075
|
if (typeof x == "string") v.push(x);
|
|
3046
3076
|
else if (Array.isArray(x))
|
|
3047
3077
|
for (const C of x) typeof C == "string" && v.push(C);
|
|
3048
|
-
const
|
|
3049
|
-
for (const F of
|
|
3078
|
+
const j = v.length ? v.map((C) => q(p, C)) : [p], M = a.filter((C) => {
|
|
3079
|
+
for (const F of j)
|
|
3050
3080
|
if (C.filePath !== F && (C.filePath.startsWith(F + "/") || C.filePath.startsWith(F + "\\")))
|
|
3051
3081
|
return !0;
|
|
3052
3082
|
return !1;
|
|
3053
|
-
}),
|
|
3054
|
-
if (typeof
|
|
3055
|
-
N.push(q(p,
|
|
3056
|
-
else if (Array.isArray(
|
|
3057
|
-
for (const C of
|
|
3083
|
+
}), S = y?.changelog, N = [];
|
|
3084
|
+
if (typeof S == "string")
|
|
3085
|
+
N.push(q(p, S));
|
|
3086
|
+
else if (Array.isArray(S))
|
|
3087
|
+
for (const C of S) typeof C == "string" && N.push(q(p, C));
|
|
3058
3088
|
const I = /* @__PURE__ */ new Map();
|
|
3059
3089
|
for (const C of l) {
|
|
3060
3090
|
if (C.type !== "changelog" || N.length && !N.some(
|
|
3061
3091
|
(ut) => C.filePath === ut || C.filePath.startsWith(ut + "/") || C.filePath.startsWith(ut + "\\")
|
|
3062
3092
|
))
|
|
3063
3093
|
continue;
|
|
3064
|
-
const F = C.frontmatter.data,
|
|
3065
|
-
if (!
|
|
3066
|
-
const R = String(
|
|
3094
|
+
const F = C.frontmatter.data, D = F?.issue;
|
|
3095
|
+
if (!D) continue;
|
|
3096
|
+
const R = String(D).trim();
|
|
3067
3097
|
if (!R) continue;
|
|
3068
3098
|
const z = ze(C.filePath, R);
|
|
3069
3099
|
if (!z) continue;
|
|
3070
3100
|
const V = g.get(z);
|
|
3071
3101
|
if (!V) continue;
|
|
3072
|
-
const
|
|
3102
|
+
const T = String(F?.version ?? ""), B = Ge(F?.release_date), J = F?.status;
|
|
3073
3103
|
let Z, X = !1;
|
|
3074
3104
|
if (typeof J == "string") {
|
|
3075
3105
|
const ct = J.trim().toLowerCase();
|
|
@@ -3082,30 +3112,30 @@ ${P.join(`
|
|
|
3082
3112
|
} else typeof J == "number" && (Z = J);
|
|
3083
3113
|
const Y = I.get(V.filePath) ?? [];
|
|
3084
3114
|
Y.push({
|
|
3085
|
-
version:
|
|
3115
|
+
version: T,
|
|
3086
3116
|
title: String(F?.title ?? C.frontmatter.title),
|
|
3087
3117
|
description: F?.description !== void 0 ? String(F.description) : void 0,
|
|
3088
3118
|
releaseDate: B,
|
|
3089
3119
|
progress: Z,
|
|
3090
3120
|
completes: X,
|
|
3091
3121
|
path: C.effectivePath,
|
|
3092
|
-
slug:
|
|
3093
|
-
entrySlug: `${C.effectivePath}#${
|
|
3122
|
+
slug: T ? `v${T}` : "unreleased",
|
|
3123
|
+
entrySlug: `${C.effectivePath}#${T ? `v${T}` : "unreleased"}`
|
|
3094
3124
|
}), I.set(V.filePath, Y);
|
|
3095
3125
|
}
|
|
3096
|
-
const U =
|
|
3097
|
-
const F = C.frontmatter.data,
|
|
3126
|
+
const U = M.map((C) => {
|
|
3127
|
+
const F = C.frontmatter.data, D = C.type, R = Ge(F?.date ?? F?.target_date);
|
|
3098
3128
|
let z;
|
|
3099
3129
|
const V = F?.parent;
|
|
3100
3130
|
if (typeof V == "string" && V.trim()) {
|
|
3101
3131
|
const Y = ze(C.filePath, V.trim());
|
|
3102
3132
|
Y && g.has(Y) && (z = g.get(Y).effectivePath);
|
|
3103
3133
|
}
|
|
3104
|
-
const
|
|
3134
|
+
const T = (I.get(C.filePath) ?? []).slice().sort(
|
|
3105
3135
|
(Y, ct) => (Y.releaseDate ?? "").localeCompare(ct.releaseDate ?? "")
|
|
3106
|
-
), B =
|
|
3136
|
+
), B = T.some((Y) => Y.completes), J = String(F?.status ?? "").toLowerCase(), Z = J === "shipped" || J === "in_progress" || J === "planned" ? J : B ? "shipped" : T.length ? "in_progress" : "planned", X = T.reduce((Y, ct) => typeof ct.progress == "number" ? Math.max(Y ?? 0, ct.progress) : Y, void 0);
|
|
3107
3137
|
return {
|
|
3108
|
-
kind:
|
|
3138
|
+
kind: D,
|
|
3109
3139
|
slug: C.slug,
|
|
3110
3140
|
filePath: C.filePath,
|
|
3111
3141
|
href: C.effectivePath,
|
|
@@ -3119,7 +3149,7 @@ ${P.join(`
|
|
|
3119
3149
|
html: C.html,
|
|
3120
3150
|
headings: C.headings,
|
|
3121
3151
|
data: C.frontmatter.data,
|
|
3122
|
-
changelog:
|
|
3152
|
+
changelog: T
|
|
3123
3153
|
};
|
|
3124
3154
|
});
|
|
3125
3155
|
U.sort((C, F) => (C.targetDate ?? "").localeCompare(F.targetDate ?? "")), h.roadmapEntries = U, h.headings = U.map((C) => ({
|
|
@@ -3129,25 +3159,25 @@ ${P.join(`
|
|
|
3129
3159
|
}));
|
|
3130
3160
|
}
|
|
3131
3161
|
}
|
|
3132
|
-
function Kn(
|
|
3133
|
-
return
|
|
3162
|
+
function Kn(r) {
|
|
3163
|
+
return r === "milestone" || r === "epic" || r === "feature" || r === "bug";
|
|
3134
3164
|
}
|
|
3135
|
-
function ze(
|
|
3136
|
-
const a = G(
|
|
3137
|
-
return q(a,
|
|
3165
|
+
function ze(r, l) {
|
|
3166
|
+
const a = G(r), g = l.replace(/\\/g, "/").trim(), $ = g.endsWith(".md") ? g : `${g}.md`;
|
|
3167
|
+
return q(a, $);
|
|
3138
3168
|
}
|
|
3139
|
-
function Ge(
|
|
3140
|
-
if (
|
|
3141
|
-
if (
|
|
3142
|
-
const l = String(
|
|
3169
|
+
function Ge(r) {
|
|
3170
|
+
if (r == null) return;
|
|
3171
|
+
if (r instanceof Date) return r.toISOString();
|
|
3172
|
+
const l = String(r).trim();
|
|
3143
3173
|
if (!l) return;
|
|
3144
3174
|
const a = new Date(l);
|
|
3145
3175
|
if (!Number.isNaN(a.getTime()))
|
|
3146
3176
|
return a.toISOString();
|
|
3147
3177
|
}
|
|
3148
|
-
function he(
|
|
3149
|
-
if (!
|
|
3150
|
-
const a =
|
|
3178
|
+
function he(r, l) {
|
|
3179
|
+
if (!r || !/\.svg$/i.test(r.trim())) return r;
|
|
3180
|
+
const a = r.trim(), g = a.startsWith("/") ? W(n, a) : q(G(l), a);
|
|
3151
3181
|
try {
|
|
3152
3182
|
return zt(g, "utf8").trim();
|
|
3153
3183
|
} catch {
|
|
@@ -3155,36 +3185,36 @@ ${P.join(`
|
|
|
3155
3185
|
return;
|
|
3156
3186
|
}
|
|
3157
3187
|
}
|
|
3158
|
-
function Ve(
|
|
3188
|
+
function Ve(r = !1) {
|
|
3159
3189
|
const l = { children: /* @__PURE__ */ new Map() }, a = /* @__PURE__ */ new Map();
|
|
3160
|
-
for (const h of
|
|
3161
|
-
if (u && (Dt(h.frontmatter) || !
|
|
3190
|
+
for (const h of o.values()) {
|
|
3191
|
+
if (u && (Dt(h.frontmatter) || !r && yt(h))) continue;
|
|
3162
3192
|
const p = h.frontmatter.sidebar;
|
|
3163
3193
|
if (h.effectivePath === "/" && !p?.name) continue;
|
|
3164
3194
|
const y = h.effectivePath === "/" ? [p.path ?? p.name] : h.effectivePath.split("/").filter(Boolean), x = h.filePath.endsWith(`${kt}index.md`);
|
|
3165
3195
|
if (p?.name && x) {
|
|
3166
|
-
const
|
|
3167
|
-
a.set(
|
|
3196
|
+
const S = "/" + y.join("/");
|
|
3197
|
+
a.set(S, {
|
|
3168
3198
|
label: p.name,
|
|
3169
|
-
icon: he(p.icon, h.filePath) ?? a.get(
|
|
3170
|
-
style: p.style ?? a.get(
|
|
3199
|
+
icon: he(p.icon, h.filePath) ?? a.get(S)?.icon,
|
|
3200
|
+
style: p.style ?? a.get(S)?.style
|
|
3171
3201
|
});
|
|
3172
3202
|
}
|
|
3173
3203
|
if (h.sidebarOnly && !h.linkTo) continue;
|
|
3174
3204
|
const v = x ? void 0 : p?.path ?? p?.name;
|
|
3175
3205
|
v && y[y.length - 2] !== v && (y.length >= 3 ? y.splice(y.length - 2, 1, v) : y.splice(y.length - 1, 0, v));
|
|
3176
|
-
let
|
|
3177
|
-
for (const
|
|
3178
|
-
|
|
3179
|
-
let N =
|
|
3180
|
-
N || (N = { segment:
|
|
3206
|
+
let j = l, M = "";
|
|
3207
|
+
for (const S of y) {
|
|
3208
|
+
M = M + "/" + S;
|
|
3209
|
+
let N = j.children.get(S);
|
|
3210
|
+
N || (N = { segment: S, fullPath: M, children: /* @__PURE__ */ new Map() }, j.children.set(S, N)), j = N;
|
|
3181
3211
|
}
|
|
3182
|
-
if (
|
|
3183
|
-
const
|
|
3184
|
-
a.set(
|
|
3212
|
+
if (j.page = h, !x && p?.name) {
|
|
3213
|
+
const S = "/" + y.slice(0, -1).join("/");
|
|
3214
|
+
a.set(S, {
|
|
3185
3215
|
label: p.name,
|
|
3186
|
-
icon: he(p.icon, h.filePath) ?? a.get(
|
|
3187
|
-
style: p.style ?? a.get(
|
|
3216
|
+
icon: he(p.icon, h.filePath) ?? a.get(S)?.icon,
|
|
3217
|
+
style: p.style ?? a.get(S)?.style
|
|
3188
3218
|
});
|
|
3189
3219
|
}
|
|
3190
3220
|
}
|
|
@@ -3201,37 +3231,37 @@ ${P.join(`
|
|
|
3201
3231
|
order: h.page.frontmatter.order,
|
|
3202
3232
|
collapsed: h.page.frontmatter.collapsed,
|
|
3203
3233
|
hidden: ne(h.page.frontmatter)
|
|
3204
|
-
},
|
|
3205
|
-
|
|
3206
|
-
const
|
|
3207
|
-
if (h.page.type === "openapi" &&
|
|
3208
|
-
const
|
|
3234
|
+
}, j = a.get(h.fullPath);
|
|
3235
|
+
j?.label && (v.text = j.label), j?.icon && !v.icon && (v.icon = j.icon), j?.style && (v.style = j.style);
|
|
3236
|
+
const M = h.page.openApiSpec;
|
|
3237
|
+
if (h.page.type === "openapi" && M?.tags?.length) {
|
|
3238
|
+
const S = M.tags.map((N) => ({
|
|
3209
3239
|
text: N.name,
|
|
3210
3240
|
link: `${h.page.effectivePath}#tag/${N.name}`,
|
|
3211
3241
|
slug: `${h.page.slug}__tag__${N.name}`
|
|
3212
3242
|
}));
|
|
3213
|
-
v.items = [
|
|
3243
|
+
v.items = [...S, ...p];
|
|
3214
3244
|
} else if (h.page.type === "changelog" && h.page.changelogEntries?.length) {
|
|
3215
|
-
const
|
|
3245
|
+
const S = h.page.changelogEntries.map((N, I) => ({
|
|
3216
3246
|
text: N.version ? `v${N.version}` : N.title || "unreleased",
|
|
3217
3247
|
link: `${h.page.effectivePath}#${N.slug}`,
|
|
3218
3248
|
slug: `${h.page.slug}__${N.slug}`,
|
|
3219
3249
|
hidden: N.hidden,
|
|
3220
3250
|
order: I
|
|
3221
3251
|
}));
|
|
3222
|
-
v.items = p.length ? [
|
|
3252
|
+
v.items = p.length ? [...S, ...p] : S;
|
|
3223
3253
|
} else if (h.page.type === "roadmap" && h.page.roadmapEntries?.length) {
|
|
3224
|
-
const
|
|
3254
|
+
const S = h.page.roadmapEntries.slice().sort(
|
|
3225
3255
|
(R, z) => (R.targetDate ?? "").localeCompare(z.targetDate ?? "")
|
|
3226
|
-
), N = new Map(
|
|
3227
|
-
for (const R of
|
|
3256
|
+
), N = new Map(S.map((R) => [R.href, R])), I = /* @__PURE__ */ new Map(), U = [];
|
|
3257
|
+
for (const R of S)
|
|
3228
3258
|
if (R.parent && N.has(R.parent)) {
|
|
3229
3259
|
const z = I.get(R.parent) ?? [];
|
|
3230
3260
|
z.push(R), I.set(R.parent, z);
|
|
3231
3261
|
} else
|
|
3232
3262
|
U.push(R);
|
|
3233
3263
|
const C = (R, z) => {
|
|
3234
|
-
const V = I.get(R.href) ?? [],
|
|
3264
|
+
const V = I.get(R.href) ?? [], T = {
|
|
3235
3265
|
text: R.title,
|
|
3236
3266
|
link: R.href,
|
|
3237
3267
|
slug: R.slug,
|
|
@@ -3239,11 +3269,11 @@ ${P.join(`
|
|
|
3239
3269
|
hidden: R.hidden,
|
|
3240
3270
|
order: z
|
|
3241
3271
|
};
|
|
3242
|
-
return V.length && (
|
|
3243
|
-
}, F = U.map((R, z) => C(R, z)),
|
|
3244
|
-
v.items =
|
|
3272
|
+
return V.length && (T.items = V.map((B, J) => C(B, J))), T;
|
|
3273
|
+
}, F = U.map((R, z) => C(R, z)), D = p.filter((R) => !R.slug || !S.some((z) => z.slug === R.slug));
|
|
3274
|
+
v.items = D.length ? [...F, ...D] : F;
|
|
3245
3275
|
} else if (h.page.type === "component") {
|
|
3246
|
-
const
|
|
3276
|
+
const S = {
|
|
3247
3277
|
text: "Overview",
|
|
3248
3278
|
link: h.page.effectivePath,
|
|
3249
3279
|
slug: `${h.page.slug}__doc`,
|
|
@@ -3256,9 +3286,9 @@ ${P.join(`
|
|
|
3256
3286
|
style: I.sidebar?.style,
|
|
3257
3287
|
order: U
|
|
3258
3288
|
}));
|
|
3259
|
-
v.text = se(h.segment), v.items = [
|
|
3289
|
+
v.text = se(h.segment), v.items = [S, ...N, ...p], v.collapsed = !0;
|
|
3260
3290
|
} else p.length && (v.items = p);
|
|
3261
|
-
return v.collapsed !== !1 && v.items?.some((
|
|
3291
|
+
return v.collapsed !== !1 && v.items?.some((S) => S.collapsed === !1) && (v.collapsed = !1), v;
|
|
3262
3292
|
}
|
|
3263
3293
|
const y = a.get(h.fullPath), x = {
|
|
3264
3294
|
text: y?.label ?? se(h.segment),
|
|
@@ -3267,63 +3297,63 @@ ${P.join(`
|
|
|
3267
3297
|
if (y?.icon && (x.icon = y.icon), y?.style && (x.style = y.style), p.length) {
|
|
3268
3298
|
x.items = p;
|
|
3269
3299
|
let v = Number.MAX_SAFE_INTEGER;
|
|
3270
|
-
for (const
|
|
3271
|
-
|
|
3300
|
+
for (const j of p)
|
|
3301
|
+
j.order !== void 0 && j.order < v && (v = j.order);
|
|
3272
3302
|
v !== Number.MAX_SAFE_INTEGER && (x.order = v);
|
|
3273
3303
|
}
|
|
3274
3304
|
return x.items?.some((v) => v.collapsed === !1) && (x.collapsed = !1), x;
|
|
3275
3305
|
}
|
|
3276
|
-
const
|
|
3277
|
-
for (const h of l.children.values())
|
|
3278
|
-
return Oe(
|
|
3306
|
+
const $ = [];
|
|
3307
|
+
for (const h of l.children.values()) $.push(g(h));
|
|
3308
|
+
return Oe($), $;
|
|
3279
3309
|
}
|
|
3280
3310
|
function Zn() {
|
|
3281
|
-
const
|
|
3282
|
-
for (const [g,
|
|
3283
|
-
if (u && (Dt(
|
|
3311
|
+
const r = {}, l = {};
|
|
3312
|
+
for (const [g, $] of o) {
|
|
3313
|
+
if (u && (Dt($.frontmatter) || yt($)) || $.sidebarOnly) continue;
|
|
3284
3314
|
const h = {
|
|
3285
3315
|
slug: g,
|
|
3286
|
-
path:
|
|
3287
|
-
type:
|
|
3288
|
-
title:
|
|
3289
|
-
gate:
|
|
3290
|
-
bundle: yt(
|
|
3291
|
-
description:
|
|
3292
|
-
order:
|
|
3293
|
-
hidden: ne(
|
|
3294
|
-
redirect:
|
|
3295
|
-
meta:
|
|
3316
|
+
path: $.effectivePath,
|
|
3317
|
+
type: $.type,
|
|
3318
|
+
title: $.frontmatter.title,
|
|
3319
|
+
gate: $.frontmatter.gate,
|
|
3320
|
+
bundle: yt($) ? Xt($) : void 0,
|
|
3321
|
+
description: $.frontmatter.description,
|
|
3322
|
+
order: $.frontmatter.order,
|
|
3323
|
+
hidden: ne($.frontmatter),
|
|
3324
|
+
redirect: $.frontmatter.redirect,
|
|
3325
|
+
meta: $.frontmatter.meta
|
|
3296
3326
|
};
|
|
3297
|
-
if (
|
|
3298
|
-
for (const p of
|
|
3299
|
-
l[`${
|
|
3327
|
+
if (r[g] = h, l[$.effectivePath] = g, $.type === "component")
|
|
3328
|
+
for (const p of $.componentData?.stories ?? [])
|
|
3329
|
+
l[`${$.effectivePath}/${Pe(p.name)}`] = g;
|
|
3300
3330
|
}
|
|
3301
3331
|
const a = {};
|
|
3302
|
-
for (const g of
|
|
3332
|
+
for (const g of o.values())
|
|
3303
3333
|
g.sidebarOnly || u && (Dt(g.frontmatter) || yt(g)) || g.pageCss && (a[g.effectivePath] = g.pageCss);
|
|
3304
|
-
return { pages:
|
|
3334
|
+
return { pages: r, byPath: l, sidebar: Ve(), styles: a };
|
|
3305
3335
|
}
|
|
3306
|
-
function Xe(
|
|
3307
|
-
const a = [], g = l ? l.map((
|
|
3308
|
-
for (const [
|
|
3336
|
+
function Xe(r = !1, l) {
|
|
3337
|
+
const a = [], g = l ? l.map(($) => [$.slug, $]) : o;
|
|
3338
|
+
for (const [$, h] of g) {
|
|
3309
3339
|
if (h.sidebarOnly) continue;
|
|
3310
|
-
if (
|
|
3340
|
+
if (r) {
|
|
3311
3341
|
if (Dt(h.frontmatter) || !yt(h)) continue;
|
|
3312
3342
|
} else if (u && (Dt(h.frontmatter) || yt(h))) continue;
|
|
3313
3343
|
const p = h.rawText.replace(/```[\s\S]*?```/g, "").replace(/[#*`>_\[\]\(\)]/g, " "), y = h.type === "openapi" ? Qn(h.openApiSpec) : "", x = h.type === "roadmap" ? ts(h.roadmapEntries ?? []) : "", v = h.componentData ? [
|
|
3314
3344
|
h.componentData.component,
|
|
3315
3345
|
h.componentData.system,
|
|
3316
|
-
...(h.componentData.stories ?? []).flatMap((
|
|
3317
|
-
].filter(Boolean).join(" ") : "",
|
|
3346
|
+
...(h.componentData.stories ?? []).flatMap((S) => [S.name, S.file])
|
|
3347
|
+
].filter(Boolean).join(" ") : "", j = h.dbmlSource ? h.dbmlSource.replace(/[{}\[\]'"`,]/g, " ") : "", M = [p, y, x, v, j].filter(Boolean).join(`
|
|
3318
3348
|
`);
|
|
3319
3349
|
a.push({
|
|
3320
|
-
slug:
|
|
3350
|
+
slug: $,
|
|
3321
3351
|
path: h.effectivePath,
|
|
3322
3352
|
title: h.frontmatter.title,
|
|
3323
3353
|
description: h.frontmatter.description,
|
|
3324
|
-
body:
|
|
3354
|
+
body: M,
|
|
3325
3355
|
gate: h.frontmatter.gate,
|
|
3326
|
-
headings: h.headings.map((
|
|
3356
|
+
headings: h.headings.map((S) => S.text),
|
|
3327
3357
|
tags: [
|
|
3328
3358
|
...ge(h.frontmatter.tags),
|
|
3329
3359
|
...h.componentData ? [h.componentData.component] : []
|
|
@@ -3332,13 +3362,13 @@ ${P.join(`
|
|
|
3332
3362
|
}
|
|
3333
3363
|
return a;
|
|
3334
3364
|
}
|
|
3335
|
-
function Ye(
|
|
3336
|
-
return
|
|
3365
|
+
function Ye(r) {
|
|
3366
|
+
return r ? r.replace(/<[^>]+>/g, " ").replace(/&[a-z]+;/gi, " ") : "";
|
|
3337
3367
|
}
|
|
3338
|
-
function Qn(
|
|
3339
|
-
if (!
|
|
3340
|
-
const l =
|
|
3341
|
-
if (p == null || y >
|
|
3368
|
+
function Qn(r) {
|
|
3369
|
+
if (!r || typeof r != "object") return "";
|
|
3370
|
+
const l = r, a = [], g = /* @__PURE__ */ new WeakSet(), $ = 12, h = (p, y) => {
|
|
3371
|
+
if (p == null || y > $) return;
|
|
3342
3372
|
const x = typeof p;
|
|
3343
3373
|
if (x === "string") {
|
|
3344
3374
|
const v = p.trim();
|
|
@@ -3354,12 +3384,12 @@ ${P.join(`
|
|
|
3354
3384
|
for (const v of p) h(v, y + 1);
|
|
3355
3385
|
return;
|
|
3356
3386
|
}
|
|
3357
|
-
for (const [v,
|
|
3387
|
+
for (const [v, j] of Object.entries(p)) {
|
|
3358
3388
|
if (v === "description_html" || v === "summary_html" || v === "requestBodyHtml") {
|
|
3359
|
-
typeof
|
|
3389
|
+
typeof j == "string" && a.push(Ye(j));
|
|
3360
3390
|
continue;
|
|
3361
3391
|
}
|
|
3362
|
-
a.push(v), h(
|
|
3392
|
+
a.push(v), h(j, y + 1);
|
|
3363
3393
|
}
|
|
3364
3394
|
}
|
|
3365
3395
|
};
|
|
@@ -3380,9 +3410,9 @@ ${P.join(`
|
|
|
3380
3410
|
return a.join(`
|
|
3381
3411
|
`);
|
|
3382
3412
|
}
|
|
3383
|
-
function ts(
|
|
3413
|
+
function ts(r) {
|
|
3384
3414
|
const l = [];
|
|
3385
|
-
for (const a of
|
|
3415
|
+
for (const a of r) {
|
|
3386
3416
|
l.push(a.slug, a.kind, a.title), a.description && l.push(a.description), a.targetDate && l.push(a.targetDate), a.html && l.push(Ye(a.html));
|
|
3387
3417
|
for (const g of a.changelog)
|
|
3388
3418
|
l.push(g.version, g.title), g.description && l.push(g.description), g.releaseDate && l.push(g.releaseDate);
|
|
@@ -3390,63 +3420,63 @@ ${P.join(`
|
|
|
3390
3420
|
return l.join(`
|
|
3391
3421
|
`);
|
|
3392
3422
|
}
|
|
3393
|
-
function ge(
|
|
3394
|
-
if (!
|
|
3395
|
-
const l = Array.isArray(
|
|
3423
|
+
function ge(r) {
|
|
3424
|
+
if (!r) return [];
|
|
3425
|
+
const l = Array.isArray(r) ? r : String(r).split(","), a = [];
|
|
3396
3426
|
for (const g of l) {
|
|
3397
|
-
const
|
|
3398
|
-
|
|
3427
|
+
const $ = String(g).trim();
|
|
3428
|
+
$ && a.push($);
|
|
3399
3429
|
}
|
|
3400
3430
|
return a;
|
|
3401
3431
|
}
|
|
3402
|
-
function At(
|
|
3403
|
-
return
|
|
3432
|
+
function At(r) {
|
|
3433
|
+
return r === "" ? "__root__" : r;
|
|
3404
3434
|
}
|
|
3405
|
-
function Ke(
|
|
3406
|
-
return
|
|
3435
|
+
function Ke(r) {
|
|
3436
|
+
return r === "__root__" ? "" : r;
|
|
3407
3437
|
}
|
|
3408
|
-
function Yt(
|
|
3438
|
+
function Yt(r) {
|
|
3409
3439
|
for (const l of [Zt, Qt, te, ee]) {
|
|
3410
|
-
const a =
|
|
3411
|
-
a &&
|
|
3440
|
+
const a = r.moduleGraph.getModuleById("\0" + l);
|
|
3441
|
+
a && r.moduleGraph.invalidateModule(a);
|
|
3412
3442
|
}
|
|
3413
3443
|
}
|
|
3414
|
-
function ye(
|
|
3415
|
-
for (const l of
|
|
3416
|
-
const a = _t + At(l) + ".js", g = Ft + At(l) + ".svelte",
|
|
3417
|
-
|
|
3444
|
+
function ye(r) {
|
|
3445
|
+
for (const l of o.keys()) {
|
|
3446
|
+
const a = _t + At(l) + ".js", g = Ft + At(l) + ".svelte", $ = r.moduleGraph.getModuleById(a), h = r.moduleGraph.getModuleById(g);
|
|
3447
|
+
$ && r.moduleGraph.invalidateModule($), h && r.moduleGraph.invalidateModule(h);
|
|
3418
3448
|
}
|
|
3419
3449
|
}
|
|
3420
3450
|
function es() {
|
|
3421
|
-
const
|
|
3422
|
-
for (const [l, a] of
|
|
3451
|
+
const r = [];
|
|
3452
|
+
for (const [l, a] of o) {
|
|
3423
3453
|
if (a.sidebarOnly || u && (Dt(a.frontmatter) || yt(a))) continue;
|
|
3424
3454
|
const g = `${Ft}${At(l)}.svelte`;
|
|
3425
|
-
|
|
3455
|
+
r.push(` ${JSON.stringify(l)}: () => import(${JSON.stringify(g)})`);
|
|
3426
3456
|
}
|
|
3427
3457
|
return `export const pages = {
|
|
3428
|
-
${
|
|
3458
|
+
${r.join(`,
|
|
3429
3459
|
`)}
|
|
3430
3460
|
}
|
|
3431
3461
|
export default pages
|
|
3432
3462
|
`;
|
|
3433
3463
|
}
|
|
3434
3464
|
function ns() {
|
|
3435
|
-
const
|
|
3436
|
-
for (const [l, a] of
|
|
3465
|
+
const r = [];
|
|
3466
|
+
for (const [l, a] of o) {
|
|
3437
3467
|
if (a.sidebarOnly || u && (Dt(a.frontmatter) || yt(a))) continue;
|
|
3438
3468
|
const g = `${_t}${At(l)}.js`;
|
|
3439
|
-
|
|
3469
|
+
r.push(` ${JSON.stringify(l)}: () => import(${JSON.stringify(g)})`);
|
|
3440
3470
|
}
|
|
3441
3471
|
return `export const bodies = {
|
|
3442
|
-
${
|
|
3472
|
+
${r.join(`,
|
|
3443
3473
|
`)}
|
|
3444
3474
|
}
|
|
3445
3475
|
export default bodies
|
|
3446
3476
|
`;
|
|
3447
3477
|
}
|
|
3448
|
-
function ss(
|
|
3449
|
-
const l =
|
|
3478
|
+
function ss(r) {
|
|
3479
|
+
const l = o.get(r);
|
|
3450
3480
|
if (!l) return null;
|
|
3451
3481
|
const a = {
|
|
3452
3482
|
html: l.html,
|
|
@@ -3465,15 +3495,15 @@ export default bodies
|
|
|
3465
3495
|
return `export default ${JSON.stringify(a)}
|
|
3466
3496
|
`;
|
|
3467
3497
|
}
|
|
3468
|
-
function os(
|
|
3469
|
-
const l =
|
|
3498
|
+
function os(r) {
|
|
3499
|
+
const l = o.get(r);
|
|
3470
3500
|
if (!l) return null;
|
|
3471
3501
|
const a = {
|
|
3472
3502
|
slug: l.slug,
|
|
3473
3503
|
path: l.effectivePath,
|
|
3474
3504
|
type: l.type,
|
|
3475
3505
|
frontmatter: l.frontmatter
|
|
3476
|
-
}, g = `${_t}${At(
|
|
3506
|
+
}, g = `${_t}${At(r)}.js`;
|
|
3477
3507
|
return `<script lang="ts">
|
|
3478
3508
|
import { Page, OpenApiRoot, ChangelogPage, HeroPage, RoadmapPage, ComponentPage, DbmlPage, setPageMeta, applyPageStyles } from '@nimtech/nimpress'
|
|
3479
3509
|
import type { PageBody } from '@nimtech/nimpress'
|
|
@@ -3513,14 +3543,14 @@ export default bodies
|
|
|
3513
3543
|
async config() {
|
|
3514
3544
|
return t = (await Ws(process.cwd(), e)).resolved, n = q(process.cwd(), t.contentDir), s = q(process.cwd(), t.assetsDir), {};
|
|
3515
3545
|
},
|
|
3516
|
-
configResolved(
|
|
3517
|
-
u =
|
|
3546
|
+
configResolved(r) {
|
|
3547
|
+
u = r.command === "build", c = q(r.root, r.build.outDir);
|
|
3518
3548
|
},
|
|
3519
3549
|
async buildStart() {
|
|
3520
3550
|
await at(), u && Nt();
|
|
3521
3551
|
},
|
|
3522
|
-
async closeBundle(
|
|
3523
|
-
if (!u ||
|
|
3552
|
+
async closeBundle(r) {
|
|
3553
|
+
if (!u || r) return;
|
|
3524
3554
|
const l = W(c, "index.html"), a = W(c, "404.html");
|
|
3525
3555
|
if (await rs(l, a), await nt(W(c, ".nojekyll"), ""), dt(n) && await Ze(n, c, {
|
|
3526
3556
|
recursive: !0,
|
|
@@ -3535,26 +3565,26 @@ export default bodies
|
|
|
3535
3565
|
const g = W(c, t.assetUrlBase.replace(/^\//, ""));
|
|
3536
3566
|
await Ze(s, g, { recursive: !0 });
|
|
3537
3567
|
}
|
|
3538
|
-
for (const [g,
|
|
3568
|
+
for (const [g, $] of St) {
|
|
3539
3569
|
const h = W(c, g.replace(/^\//, ""));
|
|
3540
|
-
await Tt(G(h), { recursive: !0 }), await nt(h,
|
|
3570
|
+
await Tt(G(h), { recursive: !0 }), await nt(h, $);
|
|
3541
3571
|
}
|
|
3542
3572
|
await nt(W(c, "subscribe.map.json"), me), await Vn(), await Xn();
|
|
3543
3573
|
},
|
|
3544
|
-
configureServer(
|
|
3545
|
-
b =
|
|
3546
|
-
for (const p of
|
|
3547
|
-
for (const p of
|
|
3574
|
+
configureServer(r) {
|
|
3575
|
+
b = r, r.watcher.add(n), r.watcher.add(s);
|
|
3576
|
+
for (const p of w) r.watcher.add(p);
|
|
3577
|
+
for (const p of P) r.watcher.add(p);
|
|
3548
3578
|
const l = async (p) => {
|
|
3549
3579
|
if (!(!p.startsWith(n) || !(p.endsWith(".md") || p.endsWith(".css") || p.match(/\.story\.tsx?$/)))) {
|
|
3550
3580
|
p.endsWith(".css") && pt(p.replace(/\.css$/, ".md")), p.match(/\.story\.tsx?$/) && pt(W(G(p), "index.md"));
|
|
3551
3581
|
try {
|
|
3552
3582
|
await at();
|
|
3553
3583
|
} catch (x) {
|
|
3554
|
-
|
|
3584
|
+
r.config.logger.error(String(x));
|
|
3555
3585
|
return;
|
|
3556
3586
|
}
|
|
3557
|
-
Yt(
|
|
3587
|
+
Yt(r), ye(r), Nt(), r.ws.send({ type: "full-reload" });
|
|
3558
3588
|
}
|
|
3559
3589
|
}, a = async (p) => {
|
|
3560
3590
|
if (p.startsWith(n) && (p.endsWith(".md") || p.endsWith(".css") || p.match(/\.story\.tsx?$/))) {
|
|
@@ -3562,10 +3592,10 @@ export default bodies
|
|
|
3562
3592
|
try {
|
|
3563
3593
|
await at();
|
|
3564
3594
|
} catch (x) {
|
|
3565
|
-
|
|
3595
|
+
r.config.logger.error(String(x));
|
|
3566
3596
|
return;
|
|
3567
3597
|
}
|
|
3568
|
-
Yt(
|
|
3598
|
+
Yt(r), ye(r), Nt(), r.ws.send({ type: "full-reload" });
|
|
3569
3599
|
return;
|
|
3570
3600
|
}
|
|
3571
3601
|
if (m.has(p)) {
|
|
@@ -3574,19 +3604,19 @@ export default bodies
|
|
|
3574
3604
|
}
|
|
3575
3605
|
k.has(p) && pt(k.get(p));
|
|
3576
3606
|
};
|
|
3577
|
-
if (
|
|
3607
|
+
if (r.watcher.on("add", l), r.watcher.on("unlink", a), t.banner !== !1) {
|
|
3578
3608
|
const p = zs(), y = t.banner, x = Date.now();
|
|
3579
|
-
|
|
3580
|
-
const v =
|
|
3609
|
+
r.printUrls = function() {
|
|
3610
|
+
const v = r.resolvedUrls, j = v?.local?.[0] ?? `http://localhost:${r.config.server.port ?? 5173}/`, M = v?.network?.[0] ?? "use --host to expose", S = qs({
|
|
3581
3611
|
title: y.title ?? t.title ?? p.name ?? "Nimpress",
|
|
3582
3612
|
tagline: y.tagline,
|
|
3583
3613
|
company: y.company,
|
|
3584
3614
|
version: y.version ?? p.version,
|
|
3585
|
-
localUrl:
|
|
3586
|
-
networkUrl:
|
|
3615
|
+
localUrl: j,
|
|
3616
|
+
networkUrl: M,
|
|
3587
3617
|
duration: Date.now() - x
|
|
3588
3618
|
});
|
|
3589
|
-
process.stdout.write("\x1Bc"), process.stdout.write(
|
|
3619
|
+
process.stdout.write("\x1Bc"), process.stdout.write(S + `
|
|
3590
3620
|
`), Nt();
|
|
3591
3621
|
};
|
|
3592
3622
|
}
|
|
@@ -3606,43 +3636,43 @@ export default bodies
|
|
|
3606
3636
|
".woff": "font/woff",
|
|
3607
3637
|
".woff2": "font/woff2",
|
|
3608
3638
|
".mp4": "video/mp4"
|
|
3609
|
-
},
|
|
3639
|
+
}, $ = t.assetUrlBase, h = (p, y, x) => {
|
|
3610
3640
|
if (!y || y.endsWith(".md")) return !1;
|
|
3611
3641
|
const v = W(p, decodeURIComponent(y));
|
|
3612
3642
|
return !v.startsWith(p) || !dt(v) || !ie(v).isFile() ? !1 : (x.setHeader("Content-Type", g[_e(v).toLowerCase()] ?? "application/octet-stream"), is(v).pipe(x), !0);
|
|
3613
3643
|
};
|
|
3614
|
-
return
|
|
3615
|
-
const v = (p.url ?? "").split("?")[0],
|
|
3616
|
-
if (
|
|
3617
|
-
if (
|
|
3644
|
+
return r.middlewares.use((p, y, x) => {
|
|
3645
|
+
const v = (p.url ?? "").split("?")[0], j = Es(t.base, v);
|
|
3646
|
+
if (j.startsWith("/@") || j.startsWith("/node_modules/")) return x();
|
|
3647
|
+
if (j === "/__nimpress/claude-md" && p.method === "PUT") {
|
|
3618
3648
|
const I = [];
|
|
3619
3649
|
p.on("data", (U) => I.push(U)), p.on("end", async () => {
|
|
3620
3650
|
try {
|
|
3621
|
-
const U = JSON.parse(Buffer.concat(I).toString("utf-8")), C = String(U.path ?? ""), F = String(U.content ?? ""),
|
|
3622
|
-
if (!Object.values(t.modules.systems).filter((V) => V.source).map((V) => q(process.cwd(), V.source)).some((V) =>
|
|
3651
|
+
const U = JSON.parse(Buffer.concat(I).toString("utf-8")), C = String(U.path ?? ""), F = String(U.content ?? ""), D = q(process.cwd(), C);
|
|
3652
|
+
if (!Object.values(t.modules.systems).filter((V) => V.source).map((V) => q(process.cwd(), V.source)).some((V) => D.startsWith(V + kt)) || !D.endsWith(`${kt}CLAUDE.md`) || !dt(G(D))) {
|
|
3623
3653
|
y.statusCode = 403, y.end("invalid claude-md target");
|
|
3624
3654
|
return;
|
|
3625
3655
|
}
|
|
3626
|
-
await nt(
|
|
3656
|
+
await nt(D, F), pt(k.get(D) ?? ""), y.statusCode = 204, y.end();
|
|
3627
3657
|
} catch (U) {
|
|
3628
3658
|
y.statusCode = 400, y.end(String(U));
|
|
3629
3659
|
}
|
|
3630
3660
|
});
|
|
3631
3661
|
return;
|
|
3632
3662
|
}
|
|
3633
|
-
if (
|
|
3663
|
+
if (j === "/__nimpress/schema-defaults" && p.method === "PUT") {
|
|
3634
3664
|
const I = [];
|
|
3635
3665
|
p.on("data", (U) => I.push(U)), p.on("end", async () => {
|
|
3636
3666
|
try {
|
|
3637
|
-
const U = JSON.parse(Buffer.concat(I).toString("utf-8")), C = String(U.path ?? ""), F = q(process.cwd(), C),
|
|
3638
|
-
if (!F.startsWith(n + kt) || !
|
|
3667
|
+
const U = JSON.parse(Buffer.concat(I).toString("utf-8")), C = String(U.path ?? ""), F = q(process.cwd(), C), D = F.endsWith(`${kt}schema.json`) || F.endsWith(`${kt}schema.yml`);
|
|
3668
|
+
if (!F.startsWith(n + kt) || !D || !dt(F)) {
|
|
3639
3669
|
y.statusCode = 403, y.end("invalid schema target");
|
|
3640
3670
|
return;
|
|
3641
3671
|
}
|
|
3642
3672
|
const R = F.endsWith(".yml") ? "yml" : "json", z = Vt(await it(F, "utf-8"), R);
|
|
3643
|
-
for (const [V,
|
|
3673
|
+
for (const [V, T] of Object.entries(U.defaults ?? {})) {
|
|
3644
3674
|
const B = z.properties?.[V];
|
|
3645
|
-
B && (B.default =
|
|
3675
|
+
B && (B.default = T);
|
|
3646
3676
|
}
|
|
3647
3677
|
await nt(F, Jt(z, R)), pt(k.get(F) ?? ""), y.statusCode = 204, y.end();
|
|
3648
3678
|
} catch (U) {
|
|
@@ -3651,18 +3681,18 @@ export default bodies
|
|
|
3651
3681
|
});
|
|
3652
3682
|
return;
|
|
3653
3683
|
}
|
|
3654
|
-
const
|
|
3655
|
-
if (
|
|
3656
|
-
y.setHeader("Content-Type", "application/rss+xml; charset=utf-8"), y.end(
|
|
3684
|
+
const M = St.get(j);
|
|
3685
|
+
if (M !== void 0) {
|
|
3686
|
+
y.setHeader("Content-Type", "application/rss+xml; charset=utf-8"), y.end(M);
|
|
3657
3687
|
return;
|
|
3658
3688
|
}
|
|
3659
|
-
if (
|
|
3689
|
+
if (j === "/subscribe.map.json") {
|
|
3660
3690
|
y.setHeader("Content-Type", "application/json; charset=utf-8"), y.end(me);
|
|
3661
3691
|
return;
|
|
3662
3692
|
}
|
|
3663
|
-
const
|
|
3664
|
-
if (
|
|
3665
|
-
const I =
|
|
3693
|
+
const S = t.modules.route.replace(/\/$/, "");
|
|
3694
|
+
if (j === S || j.startsWith(S + "/")) {
|
|
3695
|
+
const I = j.slice(S.length).replace(/^\/+/, ""), U = decodeURIComponent(I.split("/")[0] ?? "");
|
|
3666
3696
|
if (!t.modules.systems[U]) {
|
|
3667
3697
|
y.statusCode = 404, y.end(`unknown module system: ${U}`);
|
|
3668
3698
|
return;
|
|
@@ -3671,12 +3701,12 @@ export default bodies
|
|
|
3671
3701
|
{
|
|
3672
3702
|
host: "127.0.0.1",
|
|
3673
3703
|
port: Ce(t.modules, U),
|
|
3674
|
-
path: `${
|
|
3704
|
+
path: `${j}${(p.url ?? "").includes("?") ? `?${(p.url ?? "").split("?").slice(1).join("?")}` : ""}`,
|
|
3675
3705
|
method: p.method,
|
|
3676
3706
|
headers: p.headers
|
|
3677
3707
|
},
|
|
3678
|
-
(
|
|
3679
|
-
y.writeHead(
|
|
3708
|
+
(D) => {
|
|
3709
|
+
y.writeHead(D.statusCode ?? 502, D.headers), D.pipe(y);
|
|
3680
3710
|
}
|
|
3681
3711
|
);
|
|
3682
3712
|
F.on("error", () => {
|
|
@@ -3686,16 +3716,16 @@ export default bodies
|
|
|
3686
3716
|
}), p.pipe(F);
|
|
3687
3717
|
return;
|
|
3688
3718
|
}
|
|
3689
|
-
if (
|
|
3690
|
-
const I =
|
|
3719
|
+
if ($ === "/" || j === $ || j.startsWith($ + "/")) {
|
|
3720
|
+
const I = $ === "/" ? j : j.slice($.length);
|
|
3691
3721
|
if (h(s, I.replace(/^\/+/, ""), y)) return;
|
|
3692
3722
|
}
|
|
3693
|
-
h(n,
|
|
3723
|
+
h(n, j.replace(/^\/+/, ""), y) || x();
|
|
3694
3724
|
}), () => {
|
|
3695
|
-
|
|
3725
|
+
r.middlewares.use(async (p, y, x) => {
|
|
3696
3726
|
if (p.method !== "GET" && p.method !== "HEAD" || !(p.headers.accept ?? "").includes("text/html")) return x();
|
|
3697
3727
|
try {
|
|
3698
|
-
const v = await
|
|
3728
|
+
const v = await r.transformIndexHtml(
|
|
3699
3729
|
p.url ?? "/",
|
|
3700
3730
|
lr(t, "/@id/__x00__virtual:nimpress/main")
|
|
3701
3731
|
);
|
|
@@ -3706,38 +3736,38 @@ export default bodies
|
|
|
3706
3736
|
});
|
|
3707
3737
|
};
|
|
3708
3738
|
},
|
|
3709
|
-
async handleHotUpdate(
|
|
3710
|
-
const l =
|
|
3739
|
+
async handleHotUpdate(r) {
|
|
3740
|
+
const l = r.file, a = l.endsWith(".md") && l.startsWith(n), g = l.endsWith(".css") && l.startsWith(n), $ = l.match(/\.story\.tsx?$/) && l.startsWith(n), h = m.get(l), p = k.get(l);
|
|
3711
3741
|
if (g) {
|
|
3712
3742
|
pt(l.replace(/\.css$/, ".md"));
|
|
3713
3743
|
try {
|
|
3714
3744
|
await at();
|
|
3715
3745
|
} catch (x) {
|
|
3716
|
-
|
|
3746
|
+
r.server.config.logger.error(String(x));
|
|
3717
3747
|
return;
|
|
3718
3748
|
}
|
|
3719
|
-
return Yt(
|
|
3749
|
+
return Yt(r.server), r.server.ws.send({ type: "full-reload" }), [];
|
|
3720
3750
|
}
|
|
3721
|
-
if (!a &&
|
|
3722
|
-
const y = a ? l :
|
|
3751
|
+
if (!a && !$ && !h && !p) return;
|
|
3752
|
+
const y = a ? l : $ ? W(G(l), "index.md") : h ?? p;
|
|
3723
3753
|
pt(y);
|
|
3724
3754
|
try {
|
|
3725
3755
|
await at();
|
|
3726
3756
|
} catch (x) {
|
|
3727
|
-
|
|
3757
|
+
r.server.config.logger.error(String(x));
|
|
3728
3758
|
return;
|
|
3729
3759
|
}
|
|
3730
|
-
return Yt(
|
|
3760
|
+
return Yt(r.server), ye(r.server), Nt(), r.server.ws.send({ type: "full-reload" }), [];
|
|
3731
3761
|
},
|
|
3732
|
-
resolveId(
|
|
3733
|
-
return
|
|
3762
|
+
resolveId(r) {
|
|
3763
|
+
return r === Zt ? "\0" + Zt : r === Qt ? "\0" + Qt : r === te ? "\0" + te : r === ee ? "\0" + ee : r === $e ? "\0" + $e : r === Se ? "\0" + Se : r.startsWith(Ft) && r.endsWith(".svelte") || r.startsWith(_t) && r.endsWith(".js") ? r : null;
|
|
3734
3764
|
},
|
|
3735
|
-
async load(
|
|
3736
|
-
if (
|
|
3765
|
+
async load(r) {
|
|
3766
|
+
if (r === "\0" + Zt)
|
|
3737
3767
|
return `export default ${JSON.stringify(Zn())}`;
|
|
3738
|
-
if (
|
|
3768
|
+
if (r === "\0" + $e)
|
|
3739
3769
|
return `export default ${JSON.stringify(Ls(t))}`;
|
|
3740
|
-
if (
|
|
3770
|
+
if (r === "\0" + Se) {
|
|
3741
3771
|
const l = t.css.map((h) => `import ${JSON.stringify(h.startsWith("/") ? h : "/" + h)}`).join(`
|
|
3742
3772
|
`), a = t.client ? t.client.startsWith("/") ? t.client : "/" + t.client.replace(/^\.\//, "") : null, g = a ? `import { authFunctions, subscribeFunctions } from ${JSON.stringify(a)}` : "";
|
|
3743
3773
|
return `import '@nimtech/nimpress/app.css'
|
|
@@ -3754,18 +3784,18 @@ if (!target) throw new Error('Mount target #app missing')
|
|
|
3754
3784
|
app.mount(target)
|
|
3755
3785
|
`;
|
|
3756
3786
|
}
|
|
3757
|
-
if (
|
|
3787
|
+
if (r === "\0" + Qt)
|
|
3758
3788
|
return `export default ${JSON.stringify(Xe())}`;
|
|
3759
|
-
if (
|
|
3789
|
+
if (r === "\0" + te)
|
|
3760
3790
|
return es();
|
|
3761
|
-
if (
|
|
3791
|
+
if (r === "\0" + ee)
|
|
3762
3792
|
return ns();
|
|
3763
|
-
if (
|
|
3764
|
-
const l =
|
|
3793
|
+
if (r.startsWith(Ft) && r.endsWith(".svelte")) {
|
|
3794
|
+
const l = r.slice(Ft.length, -7);
|
|
3765
3795
|
return os(Ke(l));
|
|
3766
3796
|
}
|
|
3767
|
-
if (
|
|
3768
|
-
const l =
|
|
3797
|
+
if (r.startsWith(_t) && r.endsWith(".js")) {
|
|
3798
|
+
const l = r.slice(_t.length, -3);
|
|
3769
3799
|
return ss(Ke(l));
|
|
3770
3800
|
}
|
|
3771
3801
|
return null;
|
|
@@ -3776,7 +3806,7 @@ function ii(e) {
|
|
|
3776
3806
|
return e;
|
|
3777
3807
|
}
|
|
3778
3808
|
async function ai(e, t) {
|
|
3779
|
-
const n = q(e, t), s = await Je(n),
|
|
3809
|
+
const n = q(e, t), s = await Je(n), o = [];
|
|
3780
3810
|
for (const i of s) {
|
|
3781
3811
|
let c;
|
|
3782
3812
|
try {
|
|
@@ -3786,11 +3816,12 @@ async function ai(e, t) {
|
|
|
3786
3816
|
}
|
|
3787
3817
|
const { data: u, content: b } = Te(c);
|
|
3788
3818
|
for (const d of Fn(u, b))
|
|
3789
|
-
|
|
3819
|
+
o.push(`${jt(n, i).split(kt).join("/")}: ${d}`);
|
|
3790
3820
|
}
|
|
3791
|
-
return
|
|
3821
|
+
return o;
|
|
3792
3822
|
}
|
|
3793
3823
|
export {
|
|
3824
|
+
ii as A,
|
|
3794
3825
|
No as a,
|
|
3795
3826
|
We as b,
|
|
3796
3827
|
Re as c,
|
|
@@ -3815,6 +3846,6 @@ export {
|
|
|
3815
3846
|
qo as v,
|
|
3816
3847
|
He as w,
|
|
3817
3848
|
Ws as x,
|
|
3818
|
-
|
|
3819
|
-
|
|
3849
|
+
yr as y,
|
|
3850
|
+
Ar as z
|
|
3820
3851
|
};
|