@nimtech/nimpress 2.3.5 → 2.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/rules/changelog-entries.md +1 -1
- package/.claude/rules/frontmatter.md +2 -0
- package/dist/cli.es.js +1 -1
- package/dist/nimpress.es.js +3997 -3983
- package/dist/{plugin-BLpql0xC.js → plugin-BeM5N1us.js} +1148 -1143
- package/dist/plugin.es.js +1 -1
- package/dist/src/types.d.ts +2 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { readdir as
|
|
2
|
-
import { existsSync as
|
|
1
|
+
import { readdir as Me, readFile as it, writeFile as nt, copyFile as rs, cp as Ze, mkdir as Tt } from "node:fs/promises";
|
|
2
|
+
import { existsSync as dt, readFileSync as zt, statSync as ie, readdirSync as pe, createReadStream as is } from "node:fs";
|
|
3
3
|
import { request as as } from "node:http";
|
|
4
4
|
import { execFileSync as cs } from "node:child_process";
|
|
5
|
-
import { resolve as q, dirname as
|
|
6
|
-
import { createHash as
|
|
7
|
-
import
|
|
5
|
+
import { resolve as q, dirname as G, join as W, basename as Mt, relative as jt, extname as _e, isAbsolute as vt, sep as kt } from "node:path";
|
|
6
|
+
import { createHash as bn } from "node:crypto";
|
|
7
|
+
import Te from "gray-matter";
|
|
8
8
|
import ls from "markdown-it";
|
|
9
9
|
import Qe from "markdown-it-anchor";
|
|
10
10
|
import ps from "markdown-it-attrs";
|
|
@@ -13,11 +13,11 @@ import fs from "markdown-it-deflist";
|
|
|
13
13
|
import ms from "markdown-it-footnote";
|
|
14
14
|
import ds from "markdown-it-task-lists";
|
|
15
15
|
import { z as f } from "zod";
|
|
16
|
-
import { parse as
|
|
16
|
+
import { parse as vn, stringify as hs } from "yaml";
|
|
17
17
|
import { createHighlighter as gs } from "shiki";
|
|
18
18
|
import { fileURLToPath as ys, pathToFileURL as tn } from "node:url";
|
|
19
|
-
import { exporter as
|
|
20
|
-
import { n as
|
|
19
|
+
import { exporter as bs } from "@dbml/core";
|
|
20
|
+
import { n as vs, r as Ut, e as ae, b as je, p as wn, c as Ne, d as Fe, g as ce, h as ws, k as Ie, o as $s, s as Ss, l as xs, q as ks, t as Ps, j as gt, m as js, a as Es } from "./typeMembers-CNvE92EX.js";
|
|
21
21
|
import { createRequire as Ds } from "node:module";
|
|
22
22
|
import { svelte as As } from "@sveltejs/vite-plugin-svelte";
|
|
23
23
|
import Cs from "@tailwindcss/vite";
|
|
@@ -28,7 +28,7 @@ const en = {
|
|
|
28
28
|
export: ".nimpress",
|
|
29
29
|
modules: "_components",
|
|
30
30
|
guarded: "_guarded"
|
|
31
|
-
},
|
|
31
|
+
}, Wt = {
|
|
32
32
|
title: "Nimpress",
|
|
33
33
|
base: "/",
|
|
34
34
|
contentDir: "docs",
|
|
@@ -160,22 +160,22 @@ const Bs = ["nimpress.config.ts", "nimpress.config.js", "nimpress.config.mjs", "
|
|
|
160
160
|
function sn(e) {
|
|
161
161
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function Ee(e, t) {
|
|
164
164
|
if (!t) return e;
|
|
165
165
|
const n = { ...e };
|
|
166
166
|
for (const [s, r] of Object.entries(t)) {
|
|
167
167
|
if (r === void 0) continue;
|
|
168
168
|
const i = n[s];
|
|
169
|
-
sn(i) && sn(r) ? n[s] =
|
|
169
|
+
sn(i) && sn(r) ? n[s] = Ee(i, r) : n[s] = r;
|
|
170
170
|
}
|
|
171
171
|
return n;
|
|
172
172
|
}
|
|
173
173
|
async function Rs(e) {
|
|
174
174
|
for (const t of Bs) {
|
|
175
175
|
const n = q(e, t);
|
|
176
|
-
if (!
|
|
176
|
+
if (!dt(n)) continue;
|
|
177
177
|
if (t.endsWith(".json")) {
|
|
178
|
-
const i = JSON.parse(
|
|
178
|
+
const i = JSON.parse(zt(n, "utf-8"));
|
|
179
179
|
return { config: nn(i, n), file: n };
|
|
180
180
|
}
|
|
181
181
|
const r = (await Os({ command: "serve", mode: "development" }, n, e))?.config ?? {};
|
|
@@ -185,13 +185,13 @@ async function Rs(e) {
|
|
|
185
185
|
}
|
|
186
186
|
async function Ws(e, t) {
|
|
187
187
|
const n = await Rs(e), s = n?.config ? { ...n.config, modules: void 0 } : void 0, r = t ? { ...t, modules: void 0 } : void 0;
|
|
188
|
-
let i =
|
|
189
|
-
i =
|
|
188
|
+
let i = Ee(Wt, s);
|
|
189
|
+
i = Ee(i, r), 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
|
-
dir:
|
|
192
|
+
dir: Wt.modules.dir,
|
|
193
193
|
route: `/${i.paths.modules}`,
|
|
194
|
-
systems: c ? Object.fromEntries(c.map((
|
|
194
|
+
systems: c ? Object.fromEntries(c.map((u) => [u.name, u])) : {}
|
|
195
195
|
}, { resolved: i, configFile: n?.file ?? null };
|
|
196
196
|
}
|
|
197
197
|
function Ls(e) {
|
|
@@ -210,34 +210,34 @@ function Ls(e) {
|
|
|
210
210
|
guardedBase: `/${e.paths.guarded}`
|
|
211
211
|
};
|
|
212
212
|
}
|
|
213
|
-
const et = "\x1B[0m",
|
|
213
|
+
const et = "\x1B[0m", le = "\x1B[1m", oe = "\x1B[2m", $n = "\x1B[38;2;204;120;92m", Pt = "\x1B[38;2;229;174;156m", Ot = "\x1B[38;2;160;160;170m", Kt = [
|
|
214
214
|
" ███╗ ██╗ ██╗ ███╗ ███╗ ██████╗ ██████╗ ███████╗ ███████╗ ███████╗",
|
|
215
215
|
" ████╗ ██║ ██║ ████╗ ████║ ██╔══██╗ ██╔══██╗ ██╔════╝ ██╔════╝ ██╔════╝",
|
|
216
216
|
" ██╔██╗ ██║ ██║ ██╔████╔██║ ██████╔╝ ██████╔╝ █████╗ ███████╗ ███████╗",
|
|
217
217
|
" ██║╚██╗██║ ██║ ██║╚██╔╝██║ ██╔═══╝ ██╔══██╗ ██╔══╝ ╚════██║ ╚════██║",
|
|
218
218
|
" ██║ ╚████║ ██║ ██║ ╚═╝ ██║ ██║ ██║ ██║ ███████╗ ███████║ ███████║",
|
|
219
219
|
" ╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝ ╚══════╝ ╚══════╝"
|
|
220
|
-
],
|
|
220
|
+
], It = 60;
|
|
221
221
|
function Hs(e, t) {
|
|
222
222
|
const n = e.replace(/\x1b\[[0-9;]*m/g, ""), s = Math.max(0, t - n.length);
|
|
223
223
|
return e + " ".repeat(s);
|
|
224
224
|
}
|
|
225
225
|
function Us(e) {
|
|
226
|
-
const t = "╔" + "═".repeat(
|
|
226
|
+
const t = "╔" + "═".repeat(It + 2) + "╗", n = "╠" + "═".repeat(It + 2) + "╣", s = "╚" + "═".repeat(It + 2) + "╝", r = [t];
|
|
227
227
|
for (let i = 0; i < e.length; i++)
|
|
228
|
-
r.push("║ " + Hs(e[i],
|
|
228
|
+
r.push("║ " + Hs(e[i], It) + " ║"), i < e.length - 1 && r.push(n);
|
|
229
229
|
return r.push(s), r;
|
|
230
230
|
}
|
|
231
231
|
function Js() {
|
|
232
232
|
try {
|
|
233
|
-
const e =
|
|
233
|
+
const e = G(ys(import.meta.url)), t = [
|
|
234
234
|
q(e, "package.json"),
|
|
235
235
|
q(e, "..", "package.json"),
|
|
236
236
|
q(e, "..", "..", "package.json")
|
|
237
237
|
];
|
|
238
238
|
for (const n of t)
|
|
239
239
|
try {
|
|
240
|
-
const s =
|
|
240
|
+
const s = zt(n, "utf-8"), r = JSON.parse(s);
|
|
241
241
|
if (r?.name === "@nimtech/nimpress" && typeof r.version == "string") return r.version;
|
|
242
242
|
} catch {
|
|
243
243
|
}
|
|
@@ -246,31 +246,31 @@ 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()}`, r = e.version ?? "dev", i = e.localUrl ?? "http://localhost:5173/", c = e.networkUrl ?? "use --host to expose",
|
|
249
|
+
const t = e.title ?? "Nimpress", n = e.tagline ?? "Docs framework on Svelte", s = e.company ?? `Samna® ${(/* @__PURE__ */ new Date()).getFullYear()}`, r = 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
|
-
for (const H of
|
|
251
|
+
for (const H of Kt) d.push($n + H + et);
|
|
252
252
|
d.push("");
|
|
253
253
|
const m = [
|
|
254
|
-
`${
|
|
255
|
-
`${
|
|
256
|
-
`${Pt}Version${et} ${r} ${Pt}${
|
|
254
|
+
`${le}${t}${et}${Ot} · ${s}${et}`,
|
|
255
|
+
`${Ot}${n}${et}`,
|
|
256
|
+
`${Pt}Version${et} ${r} ${Pt}${u}${et}`
|
|
257
257
|
];
|
|
258
|
-
|
|
259
|
-
const S = Us(m), k =
|
|
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 S = Us(m), k = Kt[0].length, j = Kt[0].length - Kt[0].trimStart().length, T = It + 4, D = " ".repeat(Math.max(0, Math.floor((k + j - T) / 2)));
|
|
260
260
|
for (const H of S) d.push(D + H);
|
|
261
261
|
return d.push(""), d.join(`
|
|
262
262
|
`);
|
|
263
263
|
}
|
|
264
264
|
function zs() {
|
|
265
265
|
try {
|
|
266
|
-
const e =
|
|
266
|
+
const e = zt(q(process.cwd(), "package.json"), "utf-8"), t = JSON.parse(e);
|
|
267
267
|
return { name: t.name, version: t.version };
|
|
268
268
|
} catch {
|
|
269
269
|
return {};
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
|
-
const Gs = 27, Vs = 14, Xs = 16, Ys = 20, Ks = 17, Zs = 14, Sn = 110, Qs = 60, to = 120,
|
|
273
|
-
class
|
|
272
|
+
const Gs = 27, Vs = 14, Xs = 16, Ys = 20, Ks = 17, Zs = 14, Sn = 110, Qs = 60, to = 120, Lt = 40, eo = 200, no = 420, so = 24, oo = 7.6, ro = 6.6, xn = 7.4, io = 5.4, ao = 5.8, co = 6.2, lo = 34, po = 48, on = 8, uo = 260, fo = 18, mo = 6.2, ho = 30, rn = 24, an = 24;
|
|
273
|
+
class Be extends Error {
|
|
274
274
|
}
|
|
275
275
|
function go(e) {
|
|
276
276
|
const t = e?.diags;
|
|
@@ -282,15 +282,15 @@ function go(e) {
|
|
|
282
282
|
}
|
|
283
283
|
function yo(e) {
|
|
284
284
|
try {
|
|
285
|
-
return JSON.parse(
|
|
285
|
+
return JSON.parse(bs.export(e, "json"));
|
|
286
286
|
} catch (t) {
|
|
287
|
-
throw new
|
|
287
|
+
throw new Be(go(t));
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
|
-
function
|
|
290
|
+
function bo(e) {
|
|
291
291
|
return (e.type?.type_name ?? "").trim();
|
|
292
292
|
}
|
|
293
|
-
function
|
|
293
|
+
function vo(e) {
|
|
294
294
|
const t = e.dbdefault;
|
|
295
295
|
return !t || t.value === void 0 || t.value === null ? "" : String(t.value);
|
|
296
296
|
}
|
|
@@ -303,28 +303,28 @@ function $o(e) {
|
|
|
303
303
|
href: n[2].trim()
|
|
304
304
|
} : { note: t, label: "", href: "" };
|
|
305
305
|
}
|
|
306
|
-
function
|
|
306
|
+
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
310
|
`).reduce((r, i) => r + Math.max(1, Math.ceil(i.trim().length / s)), 0);
|
|
311
311
|
}
|
|
312
|
-
function
|
|
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 =
|
|
317
|
-
return Math.min(no, Math.max(eo, c,
|
|
316
|
+
const n = be(t.map((b) => b.name)) * oo, s = be(t.map((b) => b.type)) * ro, r = be(t.map((b) => b.linkLabel)) * co, i = t.some((b) => b.pk || b.fk) ? lo : 0, c = Math.round(n + s + r + i + po), u = Math.round(e.length * xn + 32);
|
|
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,
|
|
321
|
-
(
|
|
320
|
+
const t = e.width - so, n = Math.max(1, re(e.name, xn, t)), s = re(e.note, io, t), r = Ys + n * Ks + s * Zs, i = Math.max(e.columns.length, 1) * Gs, c = e.indexes.reduce(
|
|
321
|
+
(b, d) => b + re(`${d.unique ? "unique" : "index"} ${d.columns.join(", ")}`, ao, t),
|
|
322
322
|
0
|
|
323
|
-
),
|
|
324
|
-
return Math.round(r + i +
|
|
323
|
+
), u = e.indexes.length ? Xs + c * Vs : 0;
|
|
324
|
+
return Math.round(r + i + u + 2);
|
|
325
325
|
}
|
|
326
326
|
function ko(e) {
|
|
327
|
-
const t = e.width - rn, n =
|
|
327
|
+
const t = e.width - rn, n = re(e.body, mo, t), s = e.title ? ho : 0;
|
|
328
328
|
return Math.round(rn + s + Math.max(1, n) * fo);
|
|
329
329
|
}
|
|
330
330
|
function Po(e, t, n) {
|
|
@@ -343,25 +343,25 @@ function jo(e, t) {
|
|
|
343
343
|
}
|
|
344
344
|
function Eo(e, t) {
|
|
345
345
|
const n = /* @__PURE__ */ new Map();
|
|
346
|
-
for (const
|
|
347
|
-
for (const [
|
|
348
|
-
|
|
349
|
-
const s = new Map(e.map((
|
|
350
|
-
(
|
|
346
|
+
for (const u of e) n.set(u.id, /* @__PURE__ */ new Set());
|
|
347
|
+
for (const [u, b] of t)
|
|
348
|
+
u !== b && (n.get(u)?.add(b), n.get(b)?.add(u));
|
|
349
|
+
const s = new Map(e.map((u) => [u.id, u])), r = /* @__PURE__ */ new Set(), i = [], c = [...e].sort(
|
|
350
|
+
(u, b) => (n.get(b.id)?.size ?? 0) - (n.get(u.id)?.size ?? 0)
|
|
351
351
|
);
|
|
352
|
-
for (const
|
|
353
|
-
if (r.has(
|
|
354
|
-
const
|
|
355
|
-
for (r.add(
|
|
352
|
+
for (const u of c) {
|
|
353
|
+
if (r.has(u.id)) continue;
|
|
354
|
+
const b = [], d = [u.id];
|
|
355
|
+
for (r.add(u.id); d.length; ) {
|
|
356
356
|
const m = d.shift(), S = s.get(m);
|
|
357
|
-
S &&
|
|
357
|
+
S && b.push(S);
|
|
358
358
|
const k = [...n.get(m) ?? []].sort(
|
|
359
359
|
(j, T) => (n.get(T)?.size ?? 0) - (n.get(j)?.size ?? 0)
|
|
360
360
|
);
|
|
361
361
|
for (const j of k)
|
|
362
362
|
r.has(j) || (r.add(j), d.push(j));
|
|
363
363
|
}
|
|
364
|
-
i.push(
|
|
364
|
+
i.push(b);
|
|
365
365
|
}
|
|
366
366
|
return i;
|
|
367
367
|
}
|
|
@@ -378,30 +378,30 @@ function Do(e, t) {
|
|
|
378
378
|
for (const m of s.get(d) ?? [])
|
|
379
379
|
r.has(m) || (r.set(m, (r.get(d) ?? 0) + 1), c.push(m));
|
|
380
380
|
}
|
|
381
|
-
const
|
|
381
|
+
const u = /* @__PURE__ */ new Map();
|
|
382
382
|
for (const d of e) {
|
|
383
|
-
const m = r.get(d.id) ?? 0, S =
|
|
384
|
-
S.push(d),
|
|
383
|
+
const m = r.get(d.id) ?? 0, S = u.get(m) ?? [];
|
|
384
|
+
S.push(d), u.set(m, S);
|
|
385
385
|
}
|
|
386
|
-
const
|
|
387
|
-
for (const d of [...
|
|
388
|
-
const m =
|
|
386
|
+
const b = [];
|
|
387
|
+
for (const d of [...u.keys()].sort((m, S) => m - S)) {
|
|
388
|
+
const m = u.get(d) ?? [];
|
|
389
389
|
for (let S = 0; S < m.length; S += on)
|
|
390
|
-
|
|
390
|
+
b.push(m.slice(S, S + on));
|
|
391
391
|
}
|
|
392
|
-
return
|
|
392
|
+
return b;
|
|
393
393
|
}
|
|
394
394
|
function Ao(e, t) {
|
|
395
395
|
const n = [];
|
|
396
|
-
let s =
|
|
396
|
+
let s = Lt;
|
|
397
397
|
for (const r of Eo(e, t)) {
|
|
398
|
-
let i =
|
|
399
|
-
for (const
|
|
400
|
-
const
|
|
398
|
+
let i = Lt, c = s;
|
|
399
|
+
for (const u of Do(r, t)) {
|
|
400
|
+
const b = Math.max(...u.map((m) => m.width));
|
|
401
401
|
let d = s;
|
|
402
|
-
for (const m of
|
|
403
|
-
m.x = i + Math.round((
|
|
404
|
-
i +=
|
|
402
|
+
for (const m of u)
|
|
403
|
+
m.x = i + Math.round((b - m.width) / 2), m.y = d, d += m.height + Qs, c = Math.max(c, m.y + m.height), n.push(m);
|
|
404
|
+
i += b + Sn;
|
|
405
405
|
}
|
|
406
406
|
s = c + to;
|
|
407
407
|
}
|
|
@@ -409,42 +409,42 @@ function Ao(e, t) {
|
|
|
409
409
|
}
|
|
410
410
|
function Co(e) {
|
|
411
411
|
const t = yo(e), n = Object.values(t.database)[0], s = /* @__PURE__ */ new Map(), r = [];
|
|
412
|
-
for (const
|
|
413
|
-
for (const A of
|
|
414
|
-
r.push(A), s.set(A,
|
|
412
|
+
for (const M of Object.values(t.schemas).sort((A, L) => A.id - L.id))
|
|
413
|
+
for (const A of M.tableIds)
|
|
414
|
+
r.push(A), s.set(A, M.name);
|
|
415
415
|
const i = /* @__PURE__ */ new Set();
|
|
416
|
-
for (const
|
|
417
|
-
if (!
|
|
418
|
-
const A = t.tables[String(
|
|
416
|
+
for (const M of Object.values(t.indexes)) {
|
|
417
|
+
if (!M.pk) continue;
|
|
418
|
+
const A = t.tables[String(M.tableId)];
|
|
419
419
|
if (A)
|
|
420
|
-
for (const L of
|
|
420
|
+
for (const L of M.columnIds) {
|
|
421
421
|
const ot = t.indexColumns[String(L)];
|
|
422
422
|
if (!ot || ot.type !== "column") continue;
|
|
423
|
-
const lt = A.fieldIds.map((
|
|
423
|
+
const lt = A.fieldIds.map((mt) => t.fields[String(mt)]).find((mt) => mt && mt.name === ot.value);
|
|
424
424
|
lt && i.add(lt.id);
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
|
-
const c = [],
|
|
428
|
-
for (const
|
|
429
|
-
const A = t.tables[String(
|
|
427
|
+
const c = [], u = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
|
|
428
|
+
for (const M of r) {
|
|
429
|
+
const A = t.tables[String(M)];
|
|
430
430
|
if (!A) continue;
|
|
431
|
-
const L = s.get(
|
|
431
|
+
const L = s.get(M) ?? "public", ot = L === "public" ? A.name : `${L}.${A.name}`, lt = `table-${M}`, mt = [];
|
|
432
432
|
A.fieldIds.forEach((pt) => {
|
|
433
433
|
const Q = t.fields[String(pt)];
|
|
434
434
|
if (!Q) return;
|
|
435
|
-
const
|
|
436
|
-
d.set(Q.id,
|
|
435
|
+
const $t = !!Q.pk || i.has(Q.id), at = $o(Q.note ?? "");
|
|
436
|
+
d.set(Q.id, mt.length), m.set(Q.id, lt), mt.push({
|
|
437
437
|
name: Q.name,
|
|
438
|
-
type:
|
|
439
|
-
note:
|
|
440
|
-
default:
|
|
441
|
-
pk:
|
|
438
|
+
type: bo(Q),
|
|
439
|
+
note: at.note,
|
|
440
|
+
default: vo(Q),
|
|
441
|
+
pk: $t,
|
|
442
442
|
fk: !1,
|
|
443
443
|
unique: !!Q.unique,
|
|
444
|
-
notNull:
|
|
444
|
+
notNull: $t || !!Q.not_null,
|
|
445
445
|
increment: !!Q.increment,
|
|
446
|
-
link:
|
|
447
|
-
linkLabel:
|
|
446
|
+
link: at.href,
|
|
447
|
+
linkLabel: at.label,
|
|
448
448
|
target: ""
|
|
449
449
|
});
|
|
450
450
|
});
|
|
@@ -452,51 +452,51 @@ function Co(e) {
|
|
|
452
452
|
for (const pt of A.indexIds) {
|
|
453
453
|
const Q = t.indexes[String(pt)];
|
|
454
454
|
if (!Q || Q.pk) continue;
|
|
455
|
-
const
|
|
456
|
-
|
|
455
|
+
const $t = Q.columnIds.map((at) => t.indexColumns[String(at)]).filter((at) => at && at.type === "column").map((at) => at.value);
|
|
456
|
+
$t.length && Et.push({
|
|
457
457
|
name: Q.name ?? `${A.name}_index_${Q.id}`,
|
|
458
|
-
columns:
|
|
458
|
+
columns: $t,
|
|
459
459
|
unique: !!Q.unique
|
|
460
460
|
});
|
|
461
461
|
}
|
|
462
|
-
const
|
|
462
|
+
const wt = {
|
|
463
463
|
id: lt,
|
|
464
464
|
name: ot,
|
|
465
465
|
note: A.note ?? "",
|
|
466
466
|
color: A.headerColor ?? "",
|
|
467
|
-
columns:
|
|
467
|
+
columns: mt,
|
|
468
468
|
indexes: Et,
|
|
469
469
|
x: 0,
|
|
470
470
|
y: 0,
|
|
471
|
-
width: So(ot,
|
|
471
|
+
width: So(ot, mt),
|
|
472
472
|
height: 0
|
|
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 M of c)
|
|
477
|
+
for (const A of M.columns) {
|
|
478
478
|
if (!A.link) continue;
|
|
479
|
-
const L = A.link.replace(/^#/, ""), ot =
|
|
480
|
-
!ot || ot ===
|
|
479
|
+
const L = A.link.replace(/^#/, ""), ot = b.get(L) ?? b.get(A.link);
|
|
480
|
+
!ot || ot === M.id || (A.target = ot, A.link = "");
|
|
481
481
|
}
|
|
482
482
|
const S = [];
|
|
483
|
-
for (const
|
|
484
|
-
const A =
|
|
483
|
+
for (const M of Object.values(t.refs).sort((A, L) => A.id - L.id)) {
|
|
484
|
+
const A = M.endpointIds.map((Q) => t.endpoints[String(Q)]).filter(Boolean);
|
|
485
485
|
if (A.length !== 2) continue;
|
|
486
|
-
const L = A[1].relation === "1" ? 1 : A[0].relation === "1" ? 0 : 1, ot = A[L], lt = A[L === 0 ? 1 : 0],
|
|
487
|
-
if (
|
|
488
|
-
const
|
|
489
|
-
if (!(!
|
|
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
|
+
if (mt === void 0 || Et === void 0) continue;
|
|
488
|
+
const wt = m.get(mt) ?? b.get(ot.tableName), pt = m.get(Et) ?? b.get(lt.tableName);
|
|
489
|
+
if (!(!wt || !pt)) {
|
|
490
490
|
for (const Q of lt.fieldIds) {
|
|
491
|
-
const
|
|
492
|
-
if (
|
|
493
|
-
const
|
|
494
|
-
|
|
491
|
+
const $t = u.get(m.get(Q) ?? ""), at = d.get(Q);
|
|
492
|
+
if (!$t || at === void 0) continue;
|
|
493
|
+
const St = $t.columns[at];
|
|
494
|
+
St.fk = !0, !St.target && !St.link && (St.target = wt);
|
|
495
495
|
}
|
|
496
496
|
S.push({
|
|
497
|
-
id: `edge-${
|
|
498
|
-
parent:
|
|
499
|
-
parentColumn: d.get(
|
|
497
|
+
id: `edge-${M.id}`,
|
|
498
|
+
parent: wt,
|
|
499
|
+
parentColumn: d.get(mt) ?? 0,
|
|
500
500
|
child: pt,
|
|
501
501
|
childColumn: d.get(Et) ?? 0,
|
|
502
502
|
many: lt.relation !== "1"
|
|
@@ -505,16 +505,16 @@ function Co(e) {
|
|
|
505
505
|
}
|
|
506
506
|
const k = Ao(
|
|
507
507
|
c,
|
|
508
|
-
S.map((
|
|
509
|
-
), j = k.length ? k : c, T = [], D = j.reduce((
|
|
510
|
-
let H =
|
|
511
|
-
const K = D +
|
|
512
|
-
for (const
|
|
513
|
-
const A = String(
|
|
508
|
+
S.map((M) => [M.parent, M.child])
|
|
509
|
+
), j = k.length ? k : c, T = [], D = j.reduce((M, A) => Math.max(M, A.x + A.width), Lt);
|
|
510
|
+
let H = Lt;
|
|
511
|
+
const K = D + Lt + Sn;
|
|
512
|
+
for (const M of Object.values(t.notes).sort((A, L) => A.id - L.id)) {
|
|
513
|
+
const A = String(M.content ?? "").trim();
|
|
514
514
|
if (!A) continue;
|
|
515
515
|
const L = {
|
|
516
|
-
id: `note-${
|
|
517
|
-
title:
|
|
516
|
+
id: `note-${M.id}`,
|
|
517
|
+
title: M.name ?? "",
|
|
518
518
|
body: A,
|
|
519
519
|
x: K,
|
|
520
520
|
y: H,
|
|
@@ -525,17 +525,17 @@ function Co(e) {
|
|
|
525
525
|
}
|
|
526
526
|
jo([...j, ...T], an);
|
|
527
527
|
const st = [];
|
|
528
|
-
for (const
|
|
529
|
-
const A =
|
|
528
|
+
for (const M of S) {
|
|
529
|
+
const A = u.get(M.parent), L = u.get(M.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: M.id,
|
|
534
534
|
source: A.id,
|
|
535
|
-
sourceHandle: `${ot}-${
|
|
535
|
+
sourceHandle: `${ot}-${M.parentColumn}`,
|
|
536
536
|
target: L.id,
|
|
537
|
-
targetHandle: `${lt}-${
|
|
538
|
-
many:
|
|
537
|
+
targetHandle: `${lt}-${M.childColumn}`,
|
|
538
|
+
many: M.many
|
|
539
539
|
});
|
|
540
540
|
}
|
|
541
541
|
return {
|
|
@@ -552,37 +552,37 @@ function Oo(e, t, n = "") {
|
|
|
552
552
|
const s = e.match(/<script[^>]*\bsetup\b[^>]*>([\s\S]*?)<\/script>/)?.[1] ?? "", r = e.match(/<template>([\s\S]*)<\/template>/)?.[1] ?? "", i = `${s}
|
|
553
553
|
${n}`;
|
|
554
554
|
let c = null;
|
|
555
|
-
const
|
|
556
|
-
if (
|
|
557
|
-
c =
|
|
555
|
+
const u = /defineProps<\s*\{/.exec(s);
|
|
556
|
+
if (u)
|
|
557
|
+
c = Ut(s, u.index + u[0].length);
|
|
558
558
|
else {
|
|
559
559
|
const D = s.match(/defineProps<\s*([A-Za-z_$][\w$]*)\s*>/);
|
|
560
|
-
D && (c =
|
|
560
|
+
D && (c = ae(i, D[1]));
|
|
561
561
|
}
|
|
562
|
-
const
|
|
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 D of
|
|
564
|
+
for (const D of je(d[1])) {
|
|
565
565
|
const H = D.match(/^([A-Za-z_$][\w$]*)\s*=\s*([\s\S]+)$/);
|
|
566
|
-
H &&
|
|
566
|
+
H && b.set(H[1], wn(H[2]));
|
|
567
567
|
}
|
|
568
568
|
const m = [];
|
|
569
569
|
if (c)
|
|
570
|
-
for (const D of
|
|
571
|
-
const H =
|
|
572
|
-
|
|
570
|
+
for (const D of Ne(c)) {
|
|
571
|
+
const H = Fe(
|
|
572
|
+
ce(D.name, D.type, D.optional, i, D.description),
|
|
573
573
|
D
|
|
574
574
|
);
|
|
575
|
-
|
|
575
|
+
b.has(D.name) && (H.default = b.get(D.name)), m.push(H);
|
|
576
576
|
}
|
|
577
577
|
for (const D of s.matchAll(/\bdefineModel(?:<([^>]*)>)?\(\s*(?:['"]([\w-]+)['"])?/g)) {
|
|
578
578
|
const H = D[2] ?? "modelValue";
|
|
579
|
-
if (m.some((
|
|
580
|
-
const K =
|
|
579
|
+
if (m.some((M) => M.name === H)) continue;
|
|
580
|
+
const K = ce(H, D[1]?.trim() || "string", !0, i);
|
|
581
581
|
K.bindable = !0;
|
|
582
582
|
const st = s.slice(0, D.index).match(/\/\*\*((?:[^*]|\*(?!\/))*)\*\/\s*(?:const|let)\s+[\w$]+\s*=\s*$/);
|
|
583
583
|
if (st) {
|
|
584
|
-
const
|
|
585
|
-
|
|
584
|
+
const M = ws(st[1].replace(/^\s*\*\s?/gm, "").trim());
|
|
585
|
+
M.description && (K.description = M.description), M.mock && !K.mock && (K.mock = M.mock);
|
|
586
586
|
}
|
|
587
587
|
m.push(K);
|
|
588
588
|
}
|
|
@@ -597,11 +597,11 @@ ${n}`;
|
|
|
597
597
|
if (T >= 0) {
|
|
598
598
|
const D = s.slice(T), H = D.search(/[<(]/);
|
|
599
599
|
if (H >= 0) {
|
|
600
|
-
const K = D[H], st = K === "<" ? ">" : ")",
|
|
601
|
-
for (const L of
|
|
602
|
-
for (const L of
|
|
603
|
-
for (const L of
|
|
604
|
-
for (const L of
|
|
600
|
+
const K = D[H], st = K === "<" ? ">" : ")", M = Ut(D, H + 1, K, st), A = /* @__PURE__ */ new Set();
|
|
601
|
+
for (const L of M.matchAll(/['"]([\w:.-]+)['"]\s*:\s*\[/g)) A.add(L[1]);
|
|
602
|
+
for (const L of M.matchAll(/\(\s*\w+\s*:\s*['"]([\w:.-]+)['"]/g)) A.add(L[1]);
|
|
603
|
+
for (const L of M.matchAll(/[,\[]\s*['"]([\w:.-]+)['"]\s*[,\]]/g)) A.add(L[1]);
|
|
604
|
+
for (const L of M.matchAll(/(?:^|[\n;{,])\s*([A-Za-z_$][\w$]*)\s*:\s*\[/g)) A.add(L[1]);
|
|
605
605
|
j.push(...A);
|
|
606
606
|
}
|
|
607
607
|
}
|
|
@@ -611,26 +611,26 @@ ${n}`;
|
|
|
611
611
|
}
|
|
612
612
|
function Mo(e, t, n = "") {
|
|
613
613
|
const s = e.match(/<script[^>]*>([\s\S]*?)<\/script>/)?.[1] ?? "", r = `${s}
|
|
614
|
-
${n}`, i = s.match(/(?:let|const)\s*\{([\s\S]*?)\}\s*(?::\s*([\s\S]*?))?=\s*\$props\(\)/), c = /* @__PURE__ */ new Map(),
|
|
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 j of
|
|
616
|
+
for (const j of je(i[1])) {
|
|
617
617
|
const T = j.match(/^([A-Za-z_$][\w$]*)\s*=\s*([\s\S]+)$/);
|
|
618
618
|
if (!T) continue;
|
|
619
619
|
const D = T[2].trim().match(/^\$bindable\(([\s\S]*)\)$/);
|
|
620
|
-
D &&
|
|
620
|
+
D && u.add(T[1]), c.set(T[1], wn(D ? D[1] : T[2]));
|
|
621
621
|
}
|
|
622
|
-
let
|
|
622
|
+
let b = null;
|
|
623
623
|
const d = i?.[2]?.trim();
|
|
624
624
|
if (d)
|
|
625
625
|
if (d.startsWith("{"))
|
|
626
|
-
|
|
626
|
+
b = Ut(d, 1);
|
|
627
627
|
else {
|
|
628
628
|
const j = d.match(/^([A-Za-z_$][\w$]*)/);
|
|
629
|
-
j && (
|
|
629
|
+
j && (b = ae(r, j[1]));
|
|
630
630
|
}
|
|
631
631
|
const m = [], S = [], k = [];
|
|
632
|
-
if (
|
|
633
|
-
for (const j of
|
|
632
|
+
if (b)
|
|
633
|
+
for (const j of Ne(b)) {
|
|
634
634
|
if (/\bSnippet\b/.test(j.type)) {
|
|
635
635
|
S.push({ name: j.name, kind: "slot", type: j.type, required: !j.optional });
|
|
636
636
|
continue;
|
|
@@ -639,18 +639,18 @@ ${n}`, i = s.match(/(?:let|const)\s*\{([\s\S]*?)\}\s*(?::\s*([\s\S]*?))?=\s*\$pr
|
|
|
639
639
|
k.push(j.name);
|
|
640
640
|
continue;
|
|
641
641
|
}
|
|
642
|
-
const T =
|
|
643
|
-
|
|
642
|
+
const T = Fe(
|
|
643
|
+
ce(j.name, j.type, j.optional, r, j.description),
|
|
644
644
|
j
|
|
645
645
|
);
|
|
646
|
-
c.has(j.name) && (T.default = c.get(j.name)),
|
|
646
|
+
c.has(j.name) && (T.default = c.get(j.name)), u.has(j.name) && (T.bindable = !0), m.push(T);
|
|
647
647
|
}
|
|
648
648
|
else if (i) {
|
|
649
|
-
for (const j of
|
|
649
|
+
for (const j of je(i[1])) {
|
|
650
650
|
const T = j.match(/^([A-Za-z_$][\w$]*)/)?.[1];
|
|
651
651
|
if (!T || T === "children") continue;
|
|
652
652
|
const D = { name: T, kind: "json", type: "unknown" };
|
|
653
|
-
c.has(T) && (D.default = c.get(T)),
|
|
653
|
+
c.has(T) && (D.default = c.get(T)), u.has(T) && (D.bindable = !0), m.push(D);
|
|
654
654
|
}
|
|
655
655
|
/\bchildren\b/.test(i[1]) && S.push({ name: "children", kind: "slot", type: "Snippet" });
|
|
656
656
|
}
|
|
@@ -659,7 +659,7 @@ ${n}`, i = s.match(/(?:let|const)\s*\{([\s\S]*?)\}\s*(?::\s*([\s\S]*?))?=\s*\$pr
|
|
|
659
659
|
function Pn(e, t = []) {
|
|
660
660
|
let n;
|
|
661
661
|
try {
|
|
662
|
-
n =
|
|
662
|
+
n = pe(e, { withFileTypes: !0 });
|
|
663
663
|
} catch {
|
|
664
664
|
return t;
|
|
665
665
|
}
|
|
@@ -674,7 +674,7 @@ function Pn(e, t = []) {
|
|
|
674
674
|
}
|
|
675
675
|
function _o(e, t, n) {
|
|
676
676
|
const s = W(e, "node_modules", t);
|
|
677
|
-
if (!
|
|
677
|
+
if (!dt(s) || !ie(s).isDirectory()) return null;
|
|
678
678
|
const r = [
|
|
679
679
|
`${n}.vue.d.ts`,
|
|
680
680
|
`${n}.svelte.d.ts`,
|
|
@@ -682,16 +682,16 @@ function _o(e, t, n) {
|
|
|
682
682
|
`${n.toLowerCase()}/index.d.ts`
|
|
683
683
|
], i = Pn(s);
|
|
684
684
|
for (const c of r) {
|
|
685
|
-
const
|
|
686
|
-
if (
|
|
685
|
+
const u = i.find((b) => b.endsWith(`/${c}`));
|
|
686
|
+
if (u) return u;
|
|
687
687
|
}
|
|
688
688
|
return null;
|
|
689
689
|
}
|
|
690
690
|
function ti(e, t) {
|
|
691
|
-
const n =
|
|
691
|
+
const n = ae(e, `${t}Props`) ?? ae(e, "Props");
|
|
692
692
|
if (!n) return;
|
|
693
693
|
const s = [], r = [], i = [];
|
|
694
|
-
for (const c of
|
|
694
|
+
for (const c of Ne(n)) {
|
|
695
695
|
if (/\bSnippet\b/.test(c.type)) {
|
|
696
696
|
r.push({ name: c.name, kind: "slot", type: c.type, required: !c.optional });
|
|
697
697
|
continue;
|
|
@@ -700,7 +700,7 @@ function ti(e, t) {
|
|
|
700
700
|
i.push(c.name);
|
|
701
701
|
continue;
|
|
702
702
|
}
|
|
703
|
-
s.push(
|
|
703
|
+
s.push(Fe(ce(c.name, c.type, c.optional, e, c.description), c));
|
|
704
704
|
}
|
|
705
705
|
return { component: t, props: s, slots: r, emits: i };
|
|
706
706
|
}
|
|
@@ -709,28 +709,28 @@ function ve(e, t) {
|
|
|
709
709
|
if (n < 0) return;
|
|
710
710
|
const s = e.indexOf("{", n);
|
|
711
711
|
if (s < 0) return;
|
|
712
|
-
const r =
|
|
712
|
+
const r = Ut(e, s + 1);
|
|
713
713
|
try {
|
|
714
714
|
return new Function(`return {${r}}`)();
|
|
715
715
|
} catch {
|
|
716
716
|
return;
|
|
717
717
|
}
|
|
718
718
|
}
|
|
719
|
-
function
|
|
719
|
+
function we(e, t) {
|
|
720
720
|
const n = e.search(new RegExp(`\\b${t}\\s*:`));
|
|
721
721
|
if (n < 0) return e;
|
|
722
722
|
const s = e.indexOf("{", n);
|
|
723
723
|
if (s < 0) return e;
|
|
724
|
-
const r =
|
|
724
|
+
const r = Ut(e, s + 1);
|
|
725
725
|
return e.slice(0, n) + e.slice(s + 1 + r.length + 1);
|
|
726
726
|
}
|
|
727
727
|
function To(e, t) {
|
|
728
|
-
const n = e.match(/^\s*\/\/\s*story:\s*(.+)$/m)?.[1]?.trim(), s =
|
|
728
|
+
const n = e.match(/^\s*\/\/\s*story:\s*(.+)$/m)?.[1]?.trim(), s = we(we(e, "props"), "slots"), r = 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
|
-
name: n ?? c ??
|
|
730
|
+
name: n ?? c ?? Mt(t).replace(/\.story\.tsx?$/, "").replace(/_/g, " "),
|
|
731
731
|
file: t,
|
|
732
|
-
description:
|
|
733
|
-
props:
|
|
732
|
+
description: u,
|
|
733
|
+
props: b,
|
|
734
734
|
slots: d,
|
|
735
735
|
sidebar: r
|
|
736
736
|
};
|
|
@@ -738,7 +738,7 @@ function To(e, t) {
|
|
|
738
738
|
async function No(e) {
|
|
739
739
|
let t;
|
|
740
740
|
try {
|
|
741
|
-
t = await
|
|
741
|
+
t = await Me(e, { withFileTypes: !0 });
|
|
742
742
|
} catch {
|
|
743
743
|
return [];
|
|
744
744
|
}
|
|
@@ -747,7 +747,7 @@ async function No(e) {
|
|
|
747
747
|
if (!s.isFile() || !s.name.match(/\.story\.tsx?$/)) continue;
|
|
748
748
|
let r;
|
|
749
749
|
try {
|
|
750
|
-
r = await
|
|
750
|
+
r = await it(W(e, s.name), "utf-8");
|
|
751
751
|
} catch {
|
|
752
752
|
continue;
|
|
753
753
|
}
|
|
@@ -755,13 +755,13 @@ async function No(e) {
|
|
|
755
755
|
}
|
|
756
756
|
return n.sort((s, r) => s.name.localeCompare(r.name)), n;
|
|
757
757
|
}
|
|
758
|
-
function
|
|
758
|
+
function ue(e, t, n, s, r) {
|
|
759
759
|
const i = t.systems[n];
|
|
760
760
|
if (!i?.source) return null;
|
|
761
|
-
const c = q(e, i.source),
|
|
762
|
-
for (const d of
|
|
763
|
-
if (!r && !d.startsWith(c) || !
|
|
764
|
-
const m =
|
|
761
|
+
const c = q(e, i.source), u = i.framework === "vue" ? ".vue" : ".svelte", b = r ? [q(c, r)] : [W(c, s, s + u), W(c, s + u)];
|
|
762
|
+
for (const d of b) {
|
|
763
|
+
if (!r && !d.startsWith(c) || !dt(d)) continue;
|
|
764
|
+
const m = G(d);
|
|
765
765
|
return {
|
|
766
766
|
systemConfig: i,
|
|
767
767
|
componentFile: d,
|
|
@@ -774,7 +774,7 @@ function pe(e, t, n, s, r) {
|
|
|
774
774
|
async function jn(e, t = []) {
|
|
775
775
|
let n;
|
|
776
776
|
try {
|
|
777
|
-
n = await
|
|
777
|
+
n = await Me(e, { withFileTypes: !0 });
|
|
778
778
|
} catch {
|
|
779
779
|
return t;
|
|
780
780
|
}
|
|
@@ -787,52 +787,52 @@ async function jn(e, t = []) {
|
|
|
787
787
|
}
|
|
788
788
|
return t;
|
|
789
789
|
}
|
|
790
|
-
async function
|
|
790
|
+
async function Re(e, t) {
|
|
791
791
|
const n = q(e, t), s = await jn(n), r = [];
|
|
792
792
|
for (const i of s) {
|
|
793
793
|
let c;
|
|
794
794
|
try {
|
|
795
|
-
c = await
|
|
795
|
+
c = await it(i, "utf-8");
|
|
796
796
|
} catch {
|
|
797
797
|
continue;
|
|
798
798
|
}
|
|
799
|
-
const { data:
|
|
800
|
-
if (
|
|
801
|
-
const
|
|
799
|
+
const { data: u } = Te(c);
|
|
800
|
+
if (u?.type !== "component") continue;
|
|
801
|
+
const b = u.data ?? {}, d = String(b.system ?? ""), m = String(b.component ?? "");
|
|
802
802
|
!d || !m || r.push({
|
|
803
803
|
pageFile: i,
|
|
804
804
|
system: d,
|
|
805
805
|
component: m,
|
|
806
|
-
file: typeof
|
|
807
|
-
package: typeof
|
|
808
|
-
version: typeof
|
|
806
|
+
file: typeof b.file == "string" ? b.file : void 0,
|
|
807
|
+
package: typeof b.package == "string" ? b.package : void 0,
|
|
808
|
+
version: typeof b.version == "string" ? b.version : void 0
|
|
809
809
|
});
|
|
810
810
|
}
|
|
811
811
|
return r;
|
|
812
812
|
}
|
|
813
|
-
function
|
|
813
|
+
function Gt(e) {
|
|
814
814
|
const t = W(e, "schema.yml");
|
|
815
|
-
if (
|
|
815
|
+
if (dt(t)) return { path: t, form: "yml" };
|
|
816
816
|
const n = W(e, "schema.json");
|
|
817
|
-
return
|
|
817
|
+
return dt(n) ? { path: n, form: "json" } : null;
|
|
818
818
|
}
|
|
819
|
-
function
|
|
820
|
-
return t === "yml" ?
|
|
819
|
+
function Vt(e, t) {
|
|
820
|
+
return t === "yml" ? vn(e) : JSON.parse(e);
|
|
821
821
|
}
|
|
822
|
-
function
|
|
822
|
+
function Jt(e, t) {
|
|
823
823
|
return t === "yml" ? hs(e) : JSON.stringify(e, null, 2) + `
|
|
824
824
|
`;
|
|
825
825
|
}
|
|
826
|
-
async function
|
|
826
|
+
async function We(e, t, n) {
|
|
827
827
|
try {
|
|
828
|
-
return await Xo(
|
|
828
|
+
return await Xo(G(e), e, t, n);
|
|
829
829
|
} catch (s) {
|
|
830
830
|
console.warn(`nimpress modules: schema parse failed for ${n}: ${String(s)}`);
|
|
831
831
|
return;
|
|
832
832
|
}
|
|
833
833
|
}
|
|
834
834
|
const Fo = ["description", "default", "enum", "mock", "format", "minimum", "maximum", "title"], Io = ["type", "tsType", "bindable"];
|
|
835
|
-
function
|
|
835
|
+
function Ht(e, t) {
|
|
836
836
|
const n = { ...e }, s = n, r = t;
|
|
837
837
|
for (const i of Io)
|
|
838
838
|
r[i] !== void 0 && (s[i] = r[i]);
|
|
@@ -841,44 +841,44 @@ function Lt(e, t) {
|
|
|
841
841
|
s[i] === void 0 && r[i] !== void 0 && (s[i] = r[i]);
|
|
842
842
|
if (t.properties) {
|
|
843
843
|
const i = {};
|
|
844
|
-
for (const [c,
|
|
845
|
-
const
|
|
846
|
-
i[c] =
|
|
844
|
+
for (const [c, u] of Object.entries(t.properties)) {
|
|
845
|
+
const b = e.properties?.[c];
|
|
846
|
+
i[c] = b ? Ht(b, u) : u;
|
|
847
847
|
}
|
|
848
|
-
for (const [c,
|
|
849
|
-
c in i || (i[c] =
|
|
848
|
+
for (const [c, u] of Object.entries(e.properties ?? {}))
|
|
849
|
+
c in i || (i[c] = u);
|
|
850
850
|
n.properties = i;
|
|
851
851
|
}
|
|
852
|
-
return t.items && (n.items = e.items ?
|
|
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
|
-
function
|
|
854
|
+
function Le(e, t) {
|
|
855
855
|
const n = t, s = { added: [], missing: [] }, r = {};
|
|
856
|
-
for (const [
|
|
857
|
-
const m = e.properties?.[
|
|
858
|
-
m ? r[
|
|
856
|
+
for (const [b, d] of Object.entries(n.properties ?? {})) {
|
|
857
|
+
const m = e.properties?.[b];
|
|
858
|
+
m ? r[b] = Ht(m, d) : (r[b] = d, s.added.push(b));
|
|
859
859
|
}
|
|
860
|
-
for (const [
|
|
861
|
-
|
|
860
|
+
for (const [b, d] of Object.entries(e.properties ?? {}))
|
|
861
|
+
b in r || (r[b] = d, s.missing.push(`prop ${b}`));
|
|
862
862
|
const i = {};
|
|
863
|
-
for (const [
|
|
864
|
-
const m = e.slots?.[
|
|
865
|
-
i[
|
|
863
|
+
for (const [b, d] of Object.entries(n.slots ?? {})) {
|
|
864
|
+
const m = e.slots?.[b];
|
|
865
|
+
i[b] = m ? Ht(m, d) : d;
|
|
866
866
|
}
|
|
867
|
-
for (const [
|
|
868
|
-
|
|
867
|
+
for (const [b, d] of Object.entries(e.slots ?? {}))
|
|
868
|
+
b in i || (i[b] = d, s.missing.push(`slot ${b}`));
|
|
869
869
|
const c = [...n.emits ?? []];
|
|
870
|
-
for (const
|
|
871
|
-
c.includes(
|
|
870
|
+
for (const b of e.emits ?? [])
|
|
871
|
+
c.includes(b) || (c.push(b), s.missing.push(`emit ${b}`));
|
|
872
872
|
return { merged: { ...e, ...t, properties: r, slots: i, emits: c }, report: s };
|
|
873
873
|
}
|
|
874
|
-
const
|
|
874
|
+
const Bt = [], cn = /* @__PURE__ */ new Set();
|
|
875
875
|
function Bo(e) {
|
|
876
876
|
return `${e.component}|${e.kind}|${e.path}`;
|
|
877
877
|
}
|
|
878
878
|
function ln(e) {
|
|
879
879
|
for (const t of e) {
|
|
880
880
|
const n = Bo(t);
|
|
881
|
-
cn.has(n) || (cn.add(n),
|
|
881
|
+
cn.has(n) || (cn.add(n), Bt.push(t));
|
|
882
882
|
}
|
|
883
883
|
}
|
|
884
884
|
const Ro = {
|
|
@@ -888,30 +888,30 @@ const Ro = {
|
|
|
888
888
|
};
|
|
889
889
|
function Wo(e) {
|
|
890
890
|
const t = e.match(/^type (.+) is opaque$/);
|
|
891
|
-
return t ? `${
|
|
891
|
+
return t ? `${Ot}type${et} ${t[1]} ${Ot}is opaque${et}` : `${Ot}${e}${et}`;
|
|
892
892
|
}
|
|
893
|
-
function
|
|
894
|
-
if (!
|
|
893
|
+
function Nt(e = process.cwd()) {
|
|
894
|
+
if (!Bt.length) return;
|
|
895
895
|
const t = /* @__PURE__ */ new Map();
|
|
896
|
-
for (const c of
|
|
897
|
-
const
|
|
898
|
-
|
|
896
|
+
for (const c of Bt) {
|
|
897
|
+
const u = t.get(c.component) ?? [];
|
|
898
|
+
u.push(c), t.set(c.component, u);
|
|
899
899
|
}
|
|
900
|
-
const n =
|
|
901
|
-
|
|
900
|
+
const n = Bt.length;
|
|
901
|
+
Bt.length = 0;
|
|
902
902
|
const s = n === 1 ? "schema warning" : "schema warnings", r = t.size === 1 ? "component" : "components", i = [""];
|
|
903
|
-
i.push(` ${Pt}${
|
|
904
|
-
for (const [c,
|
|
905
|
-
const
|
|
906
|
-
i.push(` ${$n}${
|
|
907
|
-
const d = Math.max(...
|
|
908
|
-
for (const S of
|
|
903
|
+
i.push(` ${Pt}${le}nimpress modules${et} ${Ot}${n} ${s} in ${t.size} ${r}${et}`), i.push("");
|
|
904
|
+
for (const [c, u] of t) {
|
|
905
|
+
const b = u.find((S) => S.sourceFile)?.sourceFile;
|
|
906
|
+
i.push(` ${$n}${le}${c}${et}${b ? ` ${oe}${jt(e, b)}${et}` : ""}`);
|
|
907
|
+
const d = Math.max(...u.map((S) => (S.line ? `L${S.line}` : "·").length)), m = Math.max(...u.map((S) => (S.path || "(component)").length));
|
|
908
|
+
for (const S of u) {
|
|
909
909
|
const k = (S.line ? `L${S.line}` : "·").padStart(d), j = (S.path || "(component)").padEnd(m);
|
|
910
|
-
i.push(` ${
|
|
910
|
+
i.push(` ${Ot}${k}${et} ${Pt}${j}${et} ${Wo(S.detail)}`);
|
|
911
911
|
}
|
|
912
|
-
for (const S of new Set(
|
|
913
|
-
i.push(` ${Pt}→${et} ${
|
|
914
|
-
i.push(` ${Pt}→${et} ${
|
|
912
|
+
for (const S of new Set(u.map((k) => k.kind)))
|
|
913
|
+
i.push(` ${Pt}→${et} ${oe}${Ro[S]}${et}`);
|
|
914
|
+
i.push(` ${Pt}→${et} ${oe}then run${et} nimpress modules update ${c}`), i.push("");
|
|
915
915
|
}
|
|
916
916
|
console.warn(i.join(`
|
|
917
917
|
`));
|
|
@@ -929,7 +929,7 @@ function pn(e, t) {
|
|
|
929
929
|
if (i.test(s[c])) return c + 1;
|
|
930
930
|
}
|
|
931
931
|
function un(e, t, n = {}) {
|
|
932
|
-
const s = [], r =
|
|
932
|
+
const s = [], r = Ie(e, t);
|
|
933
933
|
for (const i of r.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
935
|
for (const i of $s(r.props))
|
|
@@ -938,25 +938,25 @@ function un(e, t, n = {}) {
|
|
|
938
938
|
s.push({ component: e, sourceFile: n.sourceFile, path: i, detail: "has no counterpart in the component source", kind: "orphan" });
|
|
939
939
|
return s;
|
|
940
940
|
}
|
|
941
|
-
async function
|
|
941
|
+
async function He(e, t, n, s) {
|
|
942
942
|
if (!n) return;
|
|
943
|
-
const r = Ss(t, n.props, n.slots, n.emits), i = s ? await
|
|
944
|
-
}) : void 0, c =
|
|
943
|
+
const r = Ss(t, n.props, n.slots, n.emits), i = s ? await it(s, "utf-8").catch(() => {
|
|
944
|
+
}) : void 0, c = Gt(e);
|
|
945
945
|
if (!c) {
|
|
946
946
|
const k = W(e, "schema.json");
|
|
947
|
-
await nt(k,
|
|
947
|
+
await nt(k, Jt(r, "json")), console.log(`nimpress modules: ${t} schema seeded at ${k} — the file is yours to author from here`), ln(un(t, r, { sourceFile: s, sourceText: i }));
|
|
948
948
|
return;
|
|
949
949
|
}
|
|
950
|
-
const
|
|
951
|
-
let
|
|
950
|
+
const u = await it(c.path, "utf-8");
|
|
951
|
+
let b;
|
|
952
952
|
try {
|
|
953
|
-
|
|
953
|
+
b = Vt(u, c.form);
|
|
954
954
|
} catch (k) {
|
|
955
|
-
console.warn(`nimpress modules: ${t} ${
|
|
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 } =
|
|
959
|
-
if (S !==
|
|
958
|
+
const { merged: d, report: m } = Le(b, r), S = Jt(d, c.form);
|
|
959
|
+
if (S !== u) {
|
|
960
960
|
await nt(c.path, S);
|
|
961
961
|
const k = m.added.length ? `, added ${m.added.join(", ")}` : "";
|
|
962
962
|
console.log(`nimpress modules: ${t} schema upserted at ${c.path}${k}`);
|
|
@@ -967,27 +967,27 @@ const fn = /* @__PURE__ */ new Map();
|
|
|
967
967
|
async function Lo(e, t, n, s) {
|
|
968
968
|
let r;
|
|
969
969
|
try {
|
|
970
|
-
r = await
|
|
970
|
+
r = await it(n, "utf-8");
|
|
971
971
|
} catch {
|
|
972
972
|
return;
|
|
973
973
|
}
|
|
974
|
-
const i =
|
|
974
|
+
const i = bn("sha1").update(r).digest("hex");
|
|
975
975
|
if (fn.get(n) === i) return;
|
|
976
976
|
fn.set(n, i);
|
|
977
|
-
const c = await
|
|
978
|
-
c && await
|
|
977
|
+
const c = await We(n, s, t);
|
|
978
|
+
c && await He(e, t, c, n);
|
|
979
979
|
}
|
|
980
980
|
async function ei(e, t) {
|
|
981
|
-
const n =
|
|
981
|
+
const n = Gt(e);
|
|
982
982
|
if (!n) {
|
|
983
|
-
await nt(W(e, "schema.json"),
|
|
983
|
+
await nt(W(e, "schema.json"), Jt(t, "json"));
|
|
984
984
|
return;
|
|
985
985
|
}
|
|
986
|
-
const s = await
|
|
987
|
-
await nt(n.path,
|
|
986
|
+
const s = await it(n.path, "utf-8"), r = Vt(s, n.form), { merged: i } = Le(t, r);
|
|
987
|
+
await nt(n.path, Jt(i, n.form));
|
|
988
988
|
}
|
|
989
|
-
function
|
|
990
|
-
const t =
|
|
989
|
+
function De(e) {
|
|
990
|
+
const t = _e(e);
|
|
991
991
|
return t === ".vue" ? "vue" : t === ".svelte" ? "svelte" : null;
|
|
992
992
|
}
|
|
993
993
|
function Ho(e, t, n) {
|
|
@@ -1002,12 +1002,12 @@ 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
|
|
1006
|
-
if ((n.includes("/") || n.includes("\\")) &&
|
|
1007
|
-
const d =
|
|
1005
|
+
const s = await Re(e, t.contentDir), r = q(e, n);
|
|
1006
|
+
if ((n.includes("/") || n.includes("\\")) && dt(r)) {
|
|
1007
|
+
const d = De(r);
|
|
1008
1008
|
if (!d)
|
|
1009
1009
|
throw new Error(`[nimpress] modules: ${n} is not a .vue or .svelte component file`);
|
|
1010
|
-
const m =
|
|
1010
|
+
const m = Mt(r, _e(r)), S = Ho(e, t, r);
|
|
1011
1011
|
if (!S)
|
|
1012
1012
|
throw new Error(`[nimpress] modules: ${n} sits under no configured system source`);
|
|
1013
1013
|
const k = Uo(s, S, m);
|
|
@@ -1015,7 +1015,7 @@ async function Jo(e, t, n) {
|
|
|
1015
1015
|
throw new Error(
|
|
1016
1016
|
`[nimpress] modules: no component page found for ${S}/${m}, run nimpress modules create ${S} ${m} first`
|
|
1017
1017
|
);
|
|
1018
|
-
return { system: S, component: m, framework: d, componentFile: r, pageDir:
|
|
1018
|
+
return { system: S, component: m, framework: d, componentFile: r, pageDir: G(k.pageFile) };
|
|
1019
1019
|
}
|
|
1020
1020
|
const i = s.filter((d) => d.component === n);
|
|
1021
1021
|
if (!i.length)
|
|
@@ -1024,42 +1024,42 @@ async function Jo(e, t, n) {
|
|
|
1024
1024
|
const d = i.map((m) => `${m.system}/${m.component}`).join(", ");
|
|
1025
1025
|
throw new Error(`[nimpress] modules: ${n} is ambiguous across ${d}, pass the component file path`);
|
|
1026
1026
|
}
|
|
1027
|
-
const c = i[0],
|
|
1028
|
-
if (!
|
|
1027
|
+
const c = i[0], u = ue(e, t.modules, c.system, c.component, c.file);
|
|
1028
|
+
if (!u)
|
|
1029
1029
|
throw new Error(
|
|
1030
1030
|
`[nimpress] modules: no source file found for ${c.system}/${c.component}, the schema upsert needs the component source`
|
|
1031
1031
|
);
|
|
1032
|
-
const
|
|
1032
|
+
const b = De(u.componentFile) ?? u.systemConfig.framework;
|
|
1033
1033
|
return {
|
|
1034
1034
|
system: c.system,
|
|
1035
1035
|
component: c.component,
|
|
1036
|
-
framework:
|
|
1037
|
-
componentFile:
|
|
1038
|
-
pageDir:
|
|
1036
|
+
framework: b,
|
|
1037
|
+
componentFile: u.componentFile,
|
|
1038
|
+
pageDir: G(c.pageFile)
|
|
1039
1039
|
};
|
|
1040
1040
|
}
|
|
1041
1041
|
async function qo(e, t, n) {
|
|
1042
|
-
const s = await Jo(e, t, n), r = await
|
|
1042
|
+
const s = await Jo(e, t, n), r = await We(s.componentFile, s.framework, s.component);
|
|
1043
1043
|
if (!r)
|
|
1044
1044
|
throw new Error(`[nimpress] modules: schema parse produced nothing for ${s.component}`);
|
|
1045
|
-
await
|
|
1046
|
-
const i =
|
|
1045
|
+
await He(s.pageDir, s.component, r);
|
|
1046
|
+
const i = Gt(s.pageDir);
|
|
1047
1047
|
return jt(e, i?.path ?? W(s.pageDir, "schema.json"));
|
|
1048
1048
|
}
|
|
1049
1049
|
async function ni(e, t, n = {}) {
|
|
1050
1050
|
if (n.ref)
|
|
1051
1051
|
return await qo(e, t, n.ref), 1;
|
|
1052
|
-
const s = await
|
|
1052
|
+
const s = await Re(e, t.contentDir);
|
|
1053
1053
|
let r = 0;
|
|
1054
1054
|
for (const i of s) {
|
|
1055
1055
|
if (n.system && i.system !== n.system) continue;
|
|
1056
|
-
const c =
|
|
1056
|
+
const c = ue(e, t.modules, i.system, i.component, i.file);
|
|
1057
1057
|
if (!c) {
|
|
1058
1058
|
console.warn(`nimpress modules: no source for ${i.system}/${i.component}, skipped`);
|
|
1059
1059
|
continue;
|
|
1060
1060
|
}
|
|
1061
|
-
const
|
|
1062
|
-
|
|
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), r++);
|
|
1063
1063
|
}
|
|
1064
1064
|
return r;
|
|
1065
1065
|
}
|
|
@@ -1067,7 +1067,7 @@ function zo(e) {
|
|
|
1067
1067
|
let t = e;
|
|
1068
1068
|
for (let n = 0; n < 8; n++) {
|
|
1069
1069
|
if (t.endsWith("/src")) return t;
|
|
1070
|
-
const s =
|
|
1070
|
+
const s = G(t);
|
|
1071
1071
|
if (s === t) return null;
|
|
1072
1072
|
t = s;
|
|
1073
1073
|
}
|
|
@@ -1081,98 +1081,98 @@ async function Go(e, t, n) {
|
|
|
1081
1081
|
const s = zo(e), r = /* @__PURE__ */ new Set([q(t)]), i = [{ file: t, text: n, depth: 0 }];
|
|
1082
1082
|
let c = "";
|
|
1083
1083
|
for (; i.length; ) {
|
|
1084
|
-
const
|
|
1085
|
-
if (!
|
|
1086
|
-
const
|
|
1087
|
-
for (const d of
|
|
1084
|
+
const u = i.shift();
|
|
1085
|
+
if (!u || u.depth >= 3) continue;
|
|
1086
|
+
const b = mn(u.file, u.text);
|
|
1087
|
+
for (const d of b.matchAll(/from\s+['"]([^'"]+)['"]/g)) {
|
|
1088
1088
|
const m = d[1];
|
|
1089
1089
|
let S = null;
|
|
1090
|
-
if (m.startsWith(".") ? S = q(
|
|
1090
|
+
if (m.startsWith(".") ? S = q(G(u.file), m) : m.startsWith("@/") && s && (S = q(s, m.slice(2))), !S || !vt(S)) continue;
|
|
1091
1091
|
const j = [S, `${S}.ts`, `${S}.vue`, W(S, "index.ts")].find((H) => Vo(H));
|
|
1092
1092
|
if (!j) continue;
|
|
1093
1093
|
const T = q(j);
|
|
1094
1094
|
if (r.has(T) || r.size > 50) continue;
|
|
1095
1095
|
r.add(T);
|
|
1096
|
-
const D = await
|
|
1096
|
+
const D = await it(j, "utf-8");
|
|
1097
1097
|
c += mn(j, D) + `
|
|
1098
|
-
`, i.push({ file: j, text: D, depth:
|
|
1098
|
+
`, i.push({ file: j, text: D, depth: u.depth + 1 });
|
|
1099
1099
|
}
|
|
1100
1100
|
}
|
|
1101
1101
|
return c;
|
|
1102
1102
|
}
|
|
1103
1103
|
function Vo(e) {
|
|
1104
1104
|
try {
|
|
1105
|
-
return
|
|
1105
|
+
return ie(e).isFile();
|
|
1106
1106
|
} catch {
|
|
1107
1107
|
return !1;
|
|
1108
1108
|
}
|
|
1109
1109
|
}
|
|
1110
1110
|
async function Xo(e, t, n, s) {
|
|
1111
|
-
const r = await
|
|
1111
|
+
const r = await it(t, "utf-8");
|
|
1112
1112
|
let i = "";
|
|
1113
|
-
for (const
|
|
1114
|
-
|
|
1113
|
+
for (const u of pe(e))
|
|
1114
|
+
u.endsWith(".ts") && (u.endsWith(".stories.ts") || u.endsWith(".story.ts") || (i += await it(W(e, u), "utf-8"), i += `
|
|
1115
1115
|
`));
|
|
1116
1116
|
i += await Go(e, t, r);
|
|
1117
1117
|
const c = n === "vue" ? Oo(r, s, i) : Mo(r, s, i);
|
|
1118
|
-
for (const
|
|
1119
|
-
if (!
|
|
1120
|
-
const
|
|
1121
|
-
|
|
1118
|
+
for (const u of c.props) {
|
|
1119
|
+
if (!u.format) {
|
|
1120
|
+
const b = xs(u);
|
|
1121
|
+
b && (u.format = b);
|
|
1122
1122
|
}
|
|
1123
|
-
|
|
1123
|
+
u.mock || (u.mock = ks(u.name, Ps(u)));
|
|
1124
1124
|
}
|
|
1125
1125
|
return c;
|
|
1126
1126
|
}
|
|
1127
1127
|
async function Yo(e) {
|
|
1128
|
-
const { cwd: t, modules: n, pageFile: s, data: r, editable: i } = e, c = String(r.system ?? ""),
|
|
1128
|
+
const { cwd: t, modules: n, pageFile: s, data: r, editable: i } = e, c = String(r.system ?? ""), u = String(r.component ?? ""), b = typeof r.file == "string" ? r.file : void 0, d = await No(G(s)), m = ue(t, n, c, u, b), S = [];
|
|
1129
1129
|
if (i && m) {
|
|
1130
|
-
const
|
|
1130
|
+
const M = m.componentFile.endsWith(".svelte") ? "svelte" : "vue";
|
|
1131
1131
|
try {
|
|
1132
|
-
await Lo(
|
|
1132
|
+
await Lo(G(s), u, m.componentFile, M);
|
|
1133
1133
|
} catch (A) {
|
|
1134
|
-
console.warn(`nimpress modules: ${c}/${
|
|
1134
|
+
console.warn(`nimpress modules: ${c}/${u} schema upsert failed: ${String(A)}`);
|
|
1135
1135
|
}
|
|
1136
1136
|
}
|
|
1137
1137
|
let k;
|
|
1138
|
-
const j =
|
|
1138
|
+
const j = Gt(G(s));
|
|
1139
1139
|
if (j) {
|
|
1140
1140
|
S.push(j.path);
|
|
1141
1141
|
try {
|
|
1142
|
-
k =
|
|
1143
|
-
} catch (
|
|
1144
|
-
console.warn(`nimpress modules: ${c}/${
|
|
1142
|
+
k = Vt(await it(j.path, "utf-8"), j.form);
|
|
1143
|
+
} catch (M) {
|
|
1144
|
+
console.warn(`nimpress modules: ${c}/${u} ${j.form} schema failed to parse: ${String(M)}`);
|
|
1145
1145
|
}
|
|
1146
1146
|
} else
|
|
1147
1147
|
console.warn(
|
|
1148
|
-
`nimpress modules: ${c}/${
|
|
1148
|
+
`nimpress modules: ${c}/${u} has no schema file, controls stay empty, run nimpress modules update ${u}`
|
|
1149
1149
|
);
|
|
1150
1150
|
let T, D;
|
|
1151
1151
|
if (m)
|
|
1152
|
-
S.push(m.componentFile), D = jt(t, m.claudeMdPath),
|
|
1152
|
+
S.push(m.componentFile), D = jt(t, m.claudeMdPath), dt(m.claudeMdPath) && (T = await it(m.claudeMdPath, "utf-8"), S.push(m.claudeMdPath));
|
|
1153
1153
|
else {
|
|
1154
|
-
const
|
|
1155
|
-
if (
|
|
1156
|
-
const A = _o(t,
|
|
1154
|
+
const M = typeof r.package == "string" ? r.package : n.systems[c]?.package;
|
|
1155
|
+
if (M) {
|
|
1156
|
+
const A = _o(t, M, u);
|
|
1157
1157
|
if (A) {
|
|
1158
1158
|
const L = A.replace(/[^/]+$/, "CLAUDE.md");
|
|
1159
|
-
|
|
1159
|
+
dt(L) && (T = await it(L, "utf-8"));
|
|
1160
1160
|
}
|
|
1161
1161
|
}
|
|
1162
1162
|
}
|
|
1163
1163
|
const H = r.schema && typeof r.schema == "object" && !Array.isArray(r.schema) ? r.schema : void 0;
|
|
1164
|
-
H && (k = k ?
|
|
1165
|
-
const K = k ?
|
|
1164
|
+
H && (k = k ? Le(H, k).merged : H);
|
|
1165
|
+
const K = k ? Ie(u, k) : void 0, st = n.route.replace(/\/$/, "");
|
|
1166
1166
|
return {
|
|
1167
1167
|
data: {
|
|
1168
1168
|
system: c,
|
|
1169
|
-
component:
|
|
1169
|
+
component: u,
|
|
1170
1170
|
package: typeof r.package == "string" ? r.package : void 0,
|
|
1171
1171
|
version: typeof r.version == "string" ? r.version : void 0,
|
|
1172
1172
|
claudeMd: T,
|
|
1173
1173
|
claudeMdPath: D,
|
|
1174
1174
|
editable: i && !!m,
|
|
1175
|
-
harnessPath: `${st}/${encodeURIComponent(c)}/${encodeURIComponent(
|
|
1175
|
+
harnessPath: `${st}/${encodeURIComponent(c)}/${encodeURIComponent(u)}/`,
|
|
1176
1176
|
schema: K,
|
|
1177
1177
|
schemaPath: j ? jt(t, j.path) : void 0,
|
|
1178
1178
|
stories: d
|
|
@@ -1191,25 +1191,25 @@ function si(e, t) {
|
|
|
1191
1191
|
}
|
|
1192
1192
|
function Ko(e) {
|
|
1193
1193
|
const t = /* @__PURE__ */ new Map();
|
|
1194
|
-
for (const
|
|
1195
|
-
|
|
1196
|
-
const n = /* @__PURE__ */ new Map(), s = [], r = [], i = (
|
|
1197
|
-
const
|
|
1198
|
-
return
|
|
1199
|
-
}, c = (
|
|
1200
|
-
n.set(
|
|
1201
|
-
for (const
|
|
1202
|
-
if (!t.has(
|
|
1203
|
-
const d = n.get(
|
|
1194
|
+
for (const u of Object.values(e))
|
|
1195
|
+
u.type === "chunk" && t.set(u.fileName, u);
|
|
1196
|
+
const n = /* @__PURE__ */ new Map(), s = [], r = [], i = (u) => {
|
|
1197
|
+
const b = t.get(u);
|
|
1198
|
+
return b ? b.facadeModuleId ?? Object.keys(b.modules)[0] ?? u : u;
|
|
1199
|
+
}, c = (u) => {
|
|
1200
|
+
n.set(u, 1), s.push(u);
|
|
1201
|
+
for (const b of t.get(u)?.imports ?? []) {
|
|
1202
|
+
if (!t.has(b)) continue;
|
|
1203
|
+
const d = n.get(b);
|
|
1204
1204
|
if (d === 1) {
|
|
1205
|
-
const m = s.slice(s.indexOf(
|
|
1205
|
+
const m = s.slice(s.indexOf(b)).concat(b);
|
|
1206
1206
|
r.push({ chunks: m, modules: m.map(i) });
|
|
1207
|
-
} else d || c(
|
|
1207
|
+
} else d || c(b);
|
|
1208
1208
|
}
|
|
1209
|
-
s.pop(), n.set(
|
|
1209
|
+
s.pop(), n.set(u, 2);
|
|
1210
1210
|
};
|
|
1211
|
-
for (const
|
|
1212
|
-
n.get(
|
|
1211
|
+
for (const u of t.keys())
|
|
1212
|
+
n.get(u) || c(u);
|
|
1213
1213
|
return r;
|
|
1214
1214
|
}
|
|
1215
1215
|
function An() {
|
|
@@ -1220,7 +1220,7 @@ function An() {
|
|
|
1220
1220
|
const n = Ko(t);
|
|
1221
1221
|
if (!n.length) return;
|
|
1222
1222
|
const s = n.map((r) => {
|
|
1223
|
-
const i = r.chunks.join(" -> "), c = r.modules.map((
|
|
1223
|
+
const i = r.chunks.join(" -> "), c = r.modules.map((u) => ` ${u}`).join(`
|
|
1224
1224
|
`);
|
|
1225
1225
|
return ` ${i}
|
|
1226
1226
|
${c}`;
|
|
@@ -1234,13 +1234,13 @@ A module shared across chunks statically imports a component that got its own ch
|
|
|
1234
1234
|
}
|
|
1235
1235
|
};
|
|
1236
1236
|
}
|
|
1237
|
-
function
|
|
1237
|
+
function Ue(e, t) {
|
|
1238
1238
|
if (!t) return e;
|
|
1239
1239
|
const n = { ...e };
|
|
1240
1240
|
for (const [s, r] of Object.entries(t)) {
|
|
1241
1241
|
if (r === void 0) continue;
|
|
1242
|
-
const i = n[s], c = (
|
|
1243
|
-
c(i) && c(r) ? n[s] =
|
|
1242
|
+
const i = n[s], c = (u) => typeof u == "object" && u !== null && !Array.isArray(u);
|
|
1243
|
+
c(i) && c(r) ? n[s] = Ue(i, r) : n[s] = r;
|
|
1244
1244
|
}
|
|
1245
1245
|
return n;
|
|
1246
1246
|
}
|
|
@@ -1265,17 +1265,17 @@ function oi(e) {
|
|
|
1265
1265
|
...r ? { rollupOptions: { input: r } } : {}
|
|
1266
1266
|
}
|
|
1267
1267
|
};
|
|
1268
|
-
return
|
|
1268
|
+
return Ue(i, s.vite);
|
|
1269
1269
|
}
|
|
1270
|
-
const Zo = 6161,
|
|
1271
|
-
function
|
|
1270
|
+
const Zo = 6161, Ae = "virtual:nimpress-harness/";
|
|
1271
|
+
function Ce(e, t) {
|
|
1272
1272
|
const n = e.systems[t]?.port;
|
|
1273
1273
|
if (n) return n;
|
|
1274
1274
|
const s = Object.keys(e.systems).sort();
|
|
1275
1275
|
return Zo + Math.max(0, s.indexOf(t));
|
|
1276
1276
|
}
|
|
1277
1277
|
function Cn(e, t) {
|
|
1278
|
-
return `${
|
|
1278
|
+
return `${Ae}${e}/${t}/entry`;
|
|
1279
1279
|
}
|
|
1280
1280
|
function On() {
|
|
1281
1281
|
return `const params = new URLSearchParams(location.search)
|
|
@@ -1472,7 +1472,7 @@ function Tn(e) {
|
|
|
1472
1472
|
return e ? `import harnessSetup from ${JSON.stringify(e)}` : "const harnessSetup = null";
|
|
1473
1473
|
}
|
|
1474
1474
|
function Qo(e, t, n, s, r) {
|
|
1475
|
-
const i = t.map((
|
|
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'
|
|
1478
1478
|
import { DefaultHarness, ComponentStory, createHarnessContext, HARNESS_KEY } from '@nimtech/nimpress/harness/vue'
|
|
@@ -1566,7 +1566,7 @@ parent.postMessage({ type: 'nimpress:ready' }, '*')
|
|
|
1566
1566
|
`;
|
|
1567
1567
|
}
|
|
1568
1568
|
function tr(e, t, n, s, r) {
|
|
1569
|
-
const i = t.map((
|
|
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'
|
|
1572
1572
|
import { DefaultHarness, HarnessRoot, createHarnessContext } from '@nimtech/nimpress/harness/svelte'
|
|
@@ -1633,14 +1633,14 @@ parent.postMessage({ type: 'nimpress:ready' }, '*')
|
|
|
1633
1633
|
`;
|
|
1634
1634
|
}
|
|
1635
1635
|
function er(e) {
|
|
1636
|
-
if (!e.schemaFile || !
|
|
1636
|
+
if (!e.schemaFile || !dt(e.schemaFile)) return {};
|
|
1637
1637
|
let t;
|
|
1638
1638
|
try {
|
|
1639
|
-
t =
|
|
1639
|
+
t = Vt(zt(e.schemaFile, "utf-8"), e.schemaFile.endsWith(".yml") ? "yml" : "json");
|
|
1640
1640
|
} catch {
|
|
1641
1641
|
return {};
|
|
1642
1642
|
}
|
|
1643
|
-
const n =
|
|
1643
|
+
const n = Ie(e.component, t), s = {};
|
|
1644
1644
|
for (const r of n.props) {
|
|
1645
1645
|
if (!r.required) continue;
|
|
1646
1646
|
const i = r.default !== void 0 ? r.default : js(r, 0);
|
|
@@ -1682,8 +1682,8 @@ ${s ? s + `
|
|
|
1682
1682
|
}
|
|
1683
1683
|
async function sr(e, t) {
|
|
1684
1684
|
if (t === "svelte") {
|
|
1685
|
-
const { svelte:
|
|
1686
|
-
return
|
|
1685
|
+
const { svelte: u } = await import("@sveltejs/vite-plugin-svelte");
|
|
1686
|
+
return u();
|
|
1687
1687
|
}
|
|
1688
1688
|
const n = Ds(W(e, "package.json"));
|
|
1689
1689
|
let s;
|
|
@@ -1694,7 +1694,7 @@ async function sr(e, t) {
|
|
|
1694
1694
|
}
|
|
1695
1695
|
const r = await import(tn(s).href), c = [(r.default ?? r)()];
|
|
1696
1696
|
try {
|
|
1697
|
-
const
|
|
1697
|
+
const u = n.resolve("@vitejs/plugin-vue-jsx"), b = await import(tn(u).href), d = b.default ?? b;
|
|
1698
1698
|
c.push(d());
|
|
1699
1699
|
} catch {
|
|
1700
1700
|
}
|
|
@@ -1706,14 +1706,14 @@ function or(e, t, n, s) {
|
|
|
1706
1706
|
const i = [];
|
|
1707
1707
|
for (const c of s) {
|
|
1708
1708
|
if (c.system !== n) continue;
|
|
1709
|
-
const
|
|
1709
|
+
const u = rr(c.pageFile), b = Gt(G(c.pageFile))?.path ?? W(G(c.pageFile), "schema.json"), d = r.source ? ue(e, t, n, c.component, c.file) : null;
|
|
1710
1710
|
if (d) {
|
|
1711
|
-
i.push({ component: c.component, importSpec: d.componentFile, storyFiles:
|
|
1711
|
+
i.push({ component: c.component, importSpec: d.componentFile, storyFiles: u, schemaFile: b });
|
|
1712
1712
|
continue;
|
|
1713
1713
|
}
|
|
1714
1714
|
const m = c.package ?? r.package;
|
|
1715
1715
|
if (m) {
|
|
1716
|
-
i.push({ component: c.component, importSpec: m, named: !0, storyFiles:
|
|
1716
|
+
i.push({ component: c.component, importSpec: m, named: !0, storyFiles: u, schemaFile: b });
|
|
1717
1717
|
continue;
|
|
1718
1718
|
}
|
|
1719
1719
|
console.warn(`[nimpress] modules: no source found for ${n}/${c.component}`);
|
|
@@ -1721,15 +1721,15 @@ function or(e, t, n, s) {
|
|
|
1721
1721
|
return i;
|
|
1722
1722
|
}
|
|
1723
1723
|
function rr(e) {
|
|
1724
|
-
const t =
|
|
1724
|
+
const t = G(e);
|
|
1725
1725
|
let n;
|
|
1726
1726
|
try {
|
|
1727
|
-
n =
|
|
1727
|
+
n = pe(t);
|
|
1728
1728
|
} catch {
|
|
1729
1729
|
return [];
|
|
1730
1730
|
}
|
|
1731
1731
|
return n.filter((s) => s.endsWith(".story.ts") || s.endsWith(".story.tsx")).sort().map((s) => ({
|
|
1732
|
-
base: s.endsWith(".story.tsx") ?
|
|
1732
|
+
base: s.endsWith(".story.tsx") ? Mt(s, ".story.tsx") : Mt(s, ".story.ts"),
|
|
1733
1733
|
path: W(t, s)
|
|
1734
1734
|
}));
|
|
1735
1735
|
}
|
|
@@ -1744,20 +1744,20 @@ function ar(e, t) {
|
|
|
1744
1744
|
function cr(e, t, n, s, r) {
|
|
1745
1745
|
const i = (t.css ?? []).map(
|
|
1746
1746
|
(k) => k.startsWith(".") || vt(k) ? q(e, k) : k
|
|
1747
|
-
), c = ir(e, t),
|
|
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
1749
|
const j = k.slice(d.length).split("/");
|
|
1750
1750
|
return j[0] === n && j[1] ? j[1] : null;
|
|
1751
|
-
}, S = (k) => nr(t.framework, k, i, c,
|
|
1751
|
+
}, S = (k) => nr(t.framework, k, i, c, u);
|
|
1752
1752
|
return {
|
|
1753
1753
|
name: "nimpress:harness",
|
|
1754
1754
|
resolveId(k) {
|
|
1755
|
-
return k.startsWith(d) ? k : k.startsWith(
|
|
1755
|
+
return k.startsWith(d) ? k : k.startsWith(Ae) ? "\0" + k : null;
|
|
1756
1756
|
},
|
|
1757
1757
|
load(k) {
|
|
1758
1758
|
const j = m(k);
|
|
1759
1759
|
if (!j) return null;
|
|
1760
|
-
const T =
|
|
1760
|
+
const T = b.get(j);
|
|
1761
1761
|
return T ? S(T) : null;
|
|
1762
1762
|
},
|
|
1763
1763
|
configureServer(k) {
|
|
@@ -1766,17 +1766,17 @@ function cr(e, t, n, s, r) {
|
|
|
1766
1766
|
if (!H) return D();
|
|
1767
1767
|
const K = H.split("?")[0];
|
|
1768
1768
|
if (!K.startsWith(r)) return D();
|
|
1769
|
-
const st = K.slice(r.length).split("/").filter(Boolean),
|
|
1770
|
-
if (!
|
|
1769
|
+
const st = K.slice(r.length).split("/").filter(Boolean), M = st[0];
|
|
1770
|
+
if (!M || !b.has(M)) return D();
|
|
1771
1771
|
const A = st.slice(1).join("/");
|
|
1772
1772
|
if (A === "" || A === "index.html") {
|
|
1773
1773
|
const L = ` <script type="module" src="${r}@vite/client"><\/script>
|
|
1774
|
-
</head>`, ot = dn(
|
|
1774
|
+
</head>`, ot = dn(M, "./entry.js", []).replace(" </head>", L);
|
|
1775
1775
|
T.statusCode = 200, T.setHeader("Content-Type", "text/html"), T.end(ot);
|
|
1776
1776
|
return;
|
|
1777
1777
|
}
|
|
1778
1778
|
if (A === "entry.js") {
|
|
1779
|
-
const L = await k.transformRequest(Cn(n,
|
|
1779
|
+
const L = await k.transformRequest(Cn(n, M));
|
|
1780
1780
|
if (!L) return D();
|
|
1781
1781
|
T.statusCode = 200, T.setHeader("Content-Type", "application/javascript"), T.end(L.code);
|
|
1782
1782
|
return;
|
|
@@ -1790,17 +1790,17 @@ function cr(e, t, n, s, r) {
|
|
|
1790
1790
|
H.add(D);
|
|
1791
1791
|
const st = j[D];
|
|
1792
1792
|
if (!st || st.type !== "chunk") return;
|
|
1793
|
-
const
|
|
1794
|
-
for (const A of
|
|
1793
|
+
const M = st.viteMetadata;
|
|
1794
|
+
for (const A of M?.importedCss ?? []) K.add(A);
|
|
1795
1795
|
for (const A of st.imports) T(A, H, K);
|
|
1796
1796
|
};
|
|
1797
1797
|
for (const D of Object.values(j)) {
|
|
1798
1798
|
if (D.type !== "chunk" || !D.isEntry) continue;
|
|
1799
|
-
const H =
|
|
1799
|
+
const H = b.get(D.name);
|
|
1800
1800
|
if (!H) continue;
|
|
1801
1801
|
const K = /* @__PURE__ */ new Set();
|
|
1802
1802
|
T(D.fileName, /* @__PURE__ */ new Set(), K);
|
|
1803
|
-
const st = [...K].map((
|
|
1803
|
+
const st = [...K].map((M) => r + M);
|
|
1804
1804
|
this.emitFile({
|
|
1805
1805
|
type: "asset",
|
|
1806
1806
|
fileName: `${H.component}/index.html`,
|
|
@@ -1813,15 +1813,15 @@ function cr(e, t, n, s, r) {
|
|
|
1813
1813
|
async function ri(e, t, n, s) {
|
|
1814
1814
|
const r = t.modules, i = r.systems[n];
|
|
1815
1815
|
if (!i) throw new Error(`[nimpress] unknown module system: ${n}`);
|
|
1816
|
-
const c = await
|
|
1817
|
-
|
|
1818
|
-
const
|
|
1816
|
+
const c = await Re(e, t.contentDir), u = or(e, r, n, c);
|
|
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 = r.route.replace(/\/$/, ""), S = `${m}/${n}/`, k = s === "build" ? gt(t.base, S) : S, j = u.filter((D) => vt(D.importSpec)).map((D) => D.importSpec).concat(u.flatMap((D) => (D.storyFiles ?? []).map((H) => H.path))), T = {
|
|
1819
1819
|
root: e,
|
|
1820
1820
|
configFile: !1,
|
|
1821
1821
|
publicDir: !1,
|
|
1822
1822
|
appType: "mpa",
|
|
1823
1823
|
cacheDir: Dn(e, t, "modules", n),
|
|
1824
|
-
plugins: [cr(e, i, n,
|
|
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
1827
|
entries: j,
|
|
@@ -1830,12 +1830,12 @@ async function ri(e, t, n, s) {
|
|
|
1830
1830
|
},
|
|
1831
1831
|
server: {
|
|
1832
1832
|
host: "127.0.0.1",
|
|
1833
|
-
port:
|
|
1833
|
+
port: Ce(r, n),
|
|
1834
1834
|
strictPort: !0,
|
|
1835
1835
|
fs: { allow: [e, d] },
|
|
1836
1836
|
hmr: {
|
|
1837
1837
|
host: "127.0.0.1",
|
|
1838
|
-
clientPort:
|
|
1838
|
+
clientPort: Ce(r, 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(
|
|
1846
|
+
input: Object.fromEntries(u.map((D) => [D.component, Cn(n, D.component)]))
|
|
1847
1847
|
}
|
|
1848
1848
|
},
|
|
1849
1849
|
base: k
|
|
1850
1850
|
};
|
|
1851
|
-
return
|
|
1851
|
+
return Ue(T, t.vite);
|
|
1852
1852
|
}
|
|
1853
1853
|
function lr(e, t = "virtual:nimpress/main") {
|
|
1854
1854
|
return `<!doctype html>
|
|
@@ -1876,8 +1876,8 @@ function lr(e, t = "virtual:nimpress/main") {
|
|
|
1876
1876
|
</html>
|
|
1877
1877
|
`;
|
|
1878
1878
|
}
|
|
1879
|
-
const
|
|
1880
|
-
function
|
|
1879
|
+
const Zt = "virtual:nimpress/manifest", Qt = "virtual:nimpress/search", te = "virtual:nimpress/pages", ee = "virtual:nimpress/bodies", $e = "virtual:nimpress/config", Se = "virtual:nimpress/main", Ft = "virtual:nimpress/page-component/", _t = "virtual:nimpress/page-body/", xe = 20, pr = "https://github.com/nimling/nimpress";
|
|
1880
|
+
function ft(e) {
|
|
1881
1881
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1882
1882
|
}
|
|
1883
1883
|
function ur(e) {
|
|
@@ -1927,7 +1927,7 @@ const gn = [
|
|
|
1927
1927
|
function fr(e) {
|
|
1928
1928
|
return `<script type="application/ld+json">${(typeof e == "string" ? e : JSON.stringify(e)).replace(/</g, "\\u003c")}<\/script>`;
|
|
1929
1929
|
}
|
|
1930
|
-
const
|
|
1930
|
+
const ke = (e) => e.visibility === "hidden", Dt = (e) => e.visibility === "hidden" || e.visibility === "dev-only", ne = (e) => e.visibility === "dev-only", mr = {
|
|
1931
1931
|
milestone: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"/><line x1="4" x2="4" y1="22" y2="15"/></svg>',
|
|
1932
1932
|
epic: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></svg>',
|
|
1933
1933
|
feature: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"/><path d="M20 3v4"/><path d="M22 5h-4"/><path d="M4 17v2"/><path d="M5 18H3"/></svg>',
|
|
@@ -1978,6 +1978,7 @@ const xe = (e) => e.visibility === "hidden", Dt = (e) => e.visibility === "hidde
|
|
|
1978
1978
|
path: f.string().optional(),
|
|
1979
1979
|
spec: f.string().optional(),
|
|
1980
1980
|
gate: f.string().optional(),
|
|
1981
|
+
link: f.string().optional(),
|
|
1981
1982
|
description: f.string().optional(),
|
|
1982
1983
|
order: f.number().optional(),
|
|
1983
1984
|
icon: f.string().optional(),
|
|
@@ -2003,34 +2004,36 @@ const xe = (e) => e.visibility === "hidden", Dt = (e) => e.visibility === "hidde
|
|
|
2003
2004
|
function Fn(e, t = "x") {
|
|
2004
2005
|
const n = [], s = Nn.safeParse(e);
|
|
2005
2006
|
if (!s.success) {
|
|
2006
|
-
for (const
|
|
2007
|
-
n.push(`${
|
|
2007
|
+
for (const u of s.error.errors)
|
|
2008
|
+
n.push(`${u.path.join(".") || "frontmatter"}: ${u.message}`);
|
|
2008
2009
|
return n;
|
|
2009
2010
|
}
|
|
2010
2011
|
const r = s.data, i = r.data ?? {};
|
|
2012
|
+
if (r.link)
|
|
2013
|
+
return !r.title && !r.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(r.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;
|
|
2011
2014
|
if (e.type === void 0 && t.trim() === "")
|
|
2012
2015
|
return r.sidebar?.name || n.push("a page without a type and without a body needs a sidebar.name to decorate its group"), n;
|
|
2013
2016
|
if (r.title || n.push("title: Required"), r.type === "openapi" && !r.spec && n.push("type openapi requires a spec field"), r.type === "dbml" && !r.spec && n.push("type dbml requires a spec field"), r.type === "changelog") {
|
|
2014
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");
|
|
2015
|
-
const
|
|
2016
|
-
|
|
2018
|
+
const u = i.title === void 0 ? "" : String(i.title);
|
|
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");
|
|
2017
2020
|
}
|
|
2018
2021
|
return (r.type === "milestone" || r.type === "epic" || r.type === "feature" || r.type === "bug") && (r.description || n.push(`type ${r.type} requires a description`), (i.date === void 0 || Number.isNaN(new Date(String(i.date)).getTime())) && n.push(`type ${r.type} requires a valid data.date`)), r.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;
|
|
2019
2022
|
}
|
|
2020
2023
|
function yr(e, t) {
|
|
2021
2024
|
const n = String(e ?? "").replace(/^v/i, "").split(/[.\-+]/), s = String(t ?? "").replace(/^v/i, "").split(/[.\-+]/), r = Math.max(n.length, s.length);
|
|
2022
2025
|
for (let i = 0; i < r; i++) {
|
|
2023
|
-
const c = parseInt(n[i] ?? "0", 10) || 0,
|
|
2024
|
-
if (c !==
|
|
2026
|
+
const c = parseInt(n[i] ?? "0", 10) || 0, u = parseInt(s[i] ?? "0", 10) || 0;
|
|
2027
|
+
if (c !== u) return c - u;
|
|
2025
2028
|
}
|
|
2026
2029
|
return 0;
|
|
2027
2030
|
}
|
|
2028
|
-
function
|
|
2031
|
+
function br(e, t) {
|
|
2029
2032
|
const n = jt(e, t).split(kt).join("/");
|
|
2030
2033
|
if (!(!n || n.startsWith("..") || vt(n)))
|
|
2031
2034
|
return `/${n}`;
|
|
2032
2035
|
}
|
|
2033
|
-
function
|
|
2036
|
+
function vr(e, t) {
|
|
2034
2037
|
const n = jt(e, t).split(kt).join("/");
|
|
2035
2038
|
if (n.startsWith("..") || vt(n))
|
|
2036
2039
|
throw new Error(
|
|
@@ -2053,10 +2056,10 @@ function yn(e) {
|
|
|
2053
2056
|
let t = e.startsWith("/") ? e : "/" + e;
|
|
2054
2057
|
return t.length > 1 && t.endsWith("/") && (t = t.slice(0, -1)), t;
|
|
2055
2058
|
}
|
|
2056
|
-
async function
|
|
2059
|
+
async function Je(e, t = []) {
|
|
2057
2060
|
let n;
|
|
2058
2061
|
try {
|
|
2059
|
-
n = await
|
|
2062
|
+
n = await Me(e, { withFileTypes: !0 });
|
|
2060
2063
|
} catch {
|
|
2061
2064
|
return t;
|
|
2062
2065
|
}
|
|
@@ -2064,7 +2067,7 @@ async function Ue(e, t = []) {
|
|
|
2064
2067
|
const r = W(e, s.name);
|
|
2065
2068
|
if (s.isDirectory()) {
|
|
2066
2069
|
if (s.name.startsWith(".") || s.name === "node_modules") continue;
|
|
2067
|
-
await
|
|
2070
|
+
await Je(r, t);
|
|
2068
2071
|
} else s.isFile() && s.name.endsWith(".md") && t.push(r);
|
|
2069
2072
|
}
|
|
2070
2073
|
return t;
|
|
@@ -2072,7 +2075,7 @@ async function Ue(e, t = []) {
|
|
|
2072
2075
|
function In(e) {
|
|
2073
2076
|
return e.toLowerCase().replace(/[^a-z0-9\s-]/g, "").trim().replace(/\s+/g, "-");
|
|
2074
2077
|
}
|
|
2075
|
-
function
|
|
2078
|
+
function Pe(e) {
|
|
2076
2079
|
return e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
2077
2080
|
}
|
|
2078
2081
|
function Sr(e, t = { route: "/_components" }, n = "/") {
|
|
@@ -2097,21 +2100,21 @@ function Sr(e, t = { route: "/_components" }, n = "/") {
|
|
|
2097
2100
|
}), r = (d, m, S, k, j) => j.renderToken(d, m, S), i = s.renderer.rules.link_open ?? r;
|
|
2098
2101
|
s.renderer.rules.link_open = (d, m, S, k, j) => {
|
|
2099
2102
|
const T = d[m].attrGet("href");
|
|
2100
|
-
return T && d[m].attrSet("href",
|
|
2103
|
+
return T && d[m].attrSet("href", gt(n, T)), i(d, m, S, k, j);
|
|
2101
2104
|
};
|
|
2102
2105
|
const c = s.renderer.rules.image ?? r;
|
|
2103
2106
|
s.renderer.rules.image = (d, m, S, k, j) => {
|
|
2104
2107
|
const T = d[m].attrGet("src");
|
|
2105
|
-
return T && d[m].attrSet("src",
|
|
2108
|
+
return T && d[m].attrSet("src", gt(n, T)), c(d, m, S, k, j);
|
|
2106
2109
|
}, s.use(Qe, {
|
|
2107
2110
|
slugify: In,
|
|
2108
2111
|
permalink: Qe.permalink.headerLink({ safariReaderFix: !0 })
|
|
2109
2112
|
}), s.use(ps), s.use(fs), s.use(ms), s.use(ds, { enabled: !0 });
|
|
2110
|
-
const
|
|
2113
|
+
const u = (d, m) => {
|
|
2111
2114
|
s.use(us, d, m);
|
|
2112
|
-
},
|
|
2113
|
-
for (const d of
|
|
2114
|
-
|
|
2115
|
+
}, b = ["tip", "note", "warning", "info", "check"];
|
|
2116
|
+
for (const d of b)
|
|
2117
|
+
u(d, {
|
|
2115
2118
|
render(m, S) {
|
|
2116
2119
|
if (m[S].nesting === 1) {
|
|
2117
2120
|
const k = m[S].info.trim().slice(d.length).trim() || d;
|
|
@@ -2120,11 +2123,11 @@ function Sr(e, t = { route: "/_components" }, n = "/") {
|
|
|
2120
2123
|
return "</div></div>";
|
|
2121
2124
|
}
|
|
2122
2125
|
});
|
|
2123
|
-
return
|
|
2126
|
+
return u("cards", {
|
|
2124
2127
|
render(d, m) {
|
|
2125
2128
|
return d[m].nesting === 1 ? '<div class="np-cards-grid">' : "</div>";
|
|
2126
2129
|
}
|
|
2127
|
-
}),
|
|
2130
|
+
}), u("details", {
|
|
2128
2131
|
validate(d) {
|
|
2129
2132
|
return /^details\b/.test(d.trim());
|
|
2130
2133
|
},
|
|
@@ -2137,45 +2140,45 @@ function Sr(e, t = { route: "/_components" }, n = "/") {
|
|
|
2137
2140
|
return `</div></details>
|
|
2138
2141
|
`;
|
|
2139
2142
|
}
|
|
2140
|
-
}),
|
|
2143
|
+
}), u("code-group", {
|
|
2141
2144
|
render(d, m) {
|
|
2142
2145
|
return d[m].nesting === 1 ? '<div class="np-code-group">' : "</div>";
|
|
2143
2146
|
}
|
|
2144
|
-
}),
|
|
2147
|
+
}), u("actions", {
|
|
2145
2148
|
render(d, m) {
|
|
2146
2149
|
if (d[m].nesting === 1) {
|
|
2147
|
-
const S = d[m].info.trim().slice(7).trim(), k = S ?
|
|
2150
|
+
const S = d[m].info.trim().slice(7).trim(), k = S ? Rt(S, d[m].info) : {}, j = typeof k?.align == "string" ? k.align : "start";
|
|
2148
2151
|
return `<div class="np-actions" data-align="${s.utils.escapeHtml(j)}">`;
|
|
2149
2152
|
}
|
|
2150
2153
|
return "</div>";
|
|
2151
2154
|
}
|
|
2152
|
-
}),
|
|
2155
|
+
}), u("features", {
|
|
2153
2156
|
render(d, m) {
|
|
2154
2157
|
if (d[m].nesting === 1) {
|
|
2155
|
-
const S = d[m].info.trim().slice(8).trim(), k = S ?
|
|
2158
|
+
const S = d[m].info.trim().slice(8).trim(), k = S ? Rt(S, d[m].info) : {}, j = typeof k?.columns == "number" ? k.columns : 0;
|
|
2156
2159
|
return `<div class="np-features"${j > 0 ? ` data-columns="${j}"` : ""}>`;
|
|
2157
2160
|
}
|
|
2158
2161
|
return "</div>";
|
|
2159
2162
|
}
|
|
2160
|
-
}),
|
|
2163
|
+
}), u("feature", {
|
|
2161
2164
|
render(d, m) {
|
|
2162
2165
|
if (d[m].nesting === 1) {
|
|
2163
|
-
const S = d[m].info.trim().slice(7).trim(), k = S ?
|
|
2164
|
-
return `<div class="np-feature" data-config="${
|
|
2166
|
+
const S = d[m].info.trim().slice(7).trim(), k = S ? Rt(S, d[m].info) : {};
|
|
2167
|
+
return `<div class="np-feature" data-config="${qt(JSON.stringify(k))}"><div class="np-feature-body">`;
|
|
2165
2168
|
}
|
|
2166
2169
|
return "</div></div>";
|
|
2167
2170
|
}
|
|
2168
|
-
}),
|
|
2171
|
+
}), u("component", {
|
|
2169
2172
|
render(d, m) {
|
|
2170
2173
|
if (d[m].nesting === 1) {
|
|
2171
|
-
const S = d[m].info.trim().slice(9).trim(), k = S.startsWith("{") ?
|
|
2172
|
-
return `<div class="np-component-embed" data-embed="${
|
|
2174
|
+
const S = d[m].info.trim().slice(9).trim(), k = S.startsWith("{") ? Rt(S, d[m].info) : S ? { component: S } : {};
|
|
2175
|
+
return `<div class="np-component-embed" data-embed="${qt(JSON.stringify({ ...t, ...k }))}"><div class="np-component-embed-body">`;
|
|
2173
2176
|
}
|
|
2174
2177
|
return "</div></div>";
|
|
2175
2178
|
}
|
|
2176
2179
|
}), s;
|
|
2177
2180
|
}
|
|
2178
|
-
function
|
|
2181
|
+
function Rt(e, t) {
|
|
2179
2182
|
try {
|
|
2180
2183
|
const n = JSON.parse(e);
|
|
2181
2184
|
return n && typeof n == "object" && !Array.isArray(n) ? n : {};
|
|
@@ -2183,26 +2186,26 @@ function Bt(e, t) {
|
|
|
2183
2186
|
return console.warn(`[nimpress] invalid JSON in directive: ${t}`), {};
|
|
2184
2187
|
}
|
|
2185
2188
|
}
|
|
2186
|
-
function
|
|
2189
|
+
function qt(e) {
|
|
2187
2190
|
return e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
2188
2191
|
}
|
|
2189
2192
|
function xr(e) {
|
|
2190
2193
|
return `<div class="np-mermaid" data-graph="${Buffer.from(e, "utf-8").toString("base64")}"></div>`;
|
|
2191
2194
|
}
|
|
2192
2195
|
function kr(e, t, n) {
|
|
2193
|
-
const s = t.startsWith("{") ?
|
|
2196
|
+
const s = t.startsWith("{") ? Rt(t, t) : {};
|
|
2194
2197
|
let r = "", i = "";
|
|
2195
2198
|
try {
|
|
2196
2199
|
r = kn(e);
|
|
2197
2200
|
} catch (d) {
|
|
2198
|
-
i = d instanceof
|
|
2201
|
+
i = d instanceof Be ? d.message : String(d), console.warn(`[nimpress] invalid dbml in ${n}:
|
|
2199
2202
|
${i}`);
|
|
2200
2203
|
}
|
|
2201
|
-
const c = Buffer.from(r, "utf-8").toString("base64"),
|
|
2204
|
+
const c = Buffer.from(r, "utf-8").toString("base64"), u = typeof s.height == "string" ? s.height : "";
|
|
2202
2205
|
return `<div class="np-dbml" ${[
|
|
2203
2206
|
`data-schema="${c}"`,
|
|
2204
|
-
i ? `data-error="${
|
|
2205
|
-
|
|
2207
|
+
i ? `data-error="${qt(i)}"` : "",
|
|
2208
|
+
u ? `data-height="${qt(u)}"` : ""
|
|
2206
2209
|
].filter(Boolean).join(" ")}></div>`;
|
|
2207
2210
|
}
|
|
2208
2211
|
function Pr(e, t) {
|
|
@@ -2215,10 +2218,10 @@ function Pr(e, t) {
|
|
|
2215
2218
|
s.push(n[r]), r += 1;
|
|
2216
2219
|
continue;
|
|
2217
2220
|
}
|
|
2218
|
-
const [, c,
|
|
2221
|
+
const [, c, u, b] = i, d = new RegExp(`^\\s*\\${u[0]}{${u.length},}\\s*$`);
|
|
2219
2222
|
let m = r + 1;
|
|
2220
2223
|
for (; m < n.length && !d.test(n[m]); ) m += 1;
|
|
2221
|
-
const S =
|
|
2224
|
+
const S = b.trim(), k = S.split(/\s+/)[0].toLowerCase(), j = n.slice(r + 1, m).join(`
|
|
2222
2225
|
`);
|
|
2223
2226
|
k === "mermaid" ? s.push(`${c}${xr(j && `${j}
|
|
2224
2227
|
`)}`) : k === "dbml" ? s.push(`${c}${kr(j, S.slice(k.length).trim(), t)}`) : s.push(...n.slice(r, Math.min(m + 1, n.length))), r = m + 1;
|
|
@@ -2242,9 +2245,9 @@ function Er(e, t) {
|
|
|
2242
2245
|
let r = 0;
|
|
2243
2246
|
const i = /* @__PURE__ */ new Map();
|
|
2244
2247
|
for (let c = 0; c < n.length; c++) {
|
|
2245
|
-
const
|
|
2246
|
-
if (
|
|
2247
|
-
const
|
|
2248
|
+
const u = n[c];
|
|
2249
|
+
if (u.type === "heading_open") {
|
|
2250
|
+
const b = parseInt(u.tag.slice(1)), d = n[c + 1], m = jr(d) || `heading-${r++}`;
|
|
2248
2251
|
let S = In(m);
|
|
2249
2252
|
S || (S = `heading-${r++}`);
|
|
2250
2253
|
const k = i.get(S);
|
|
@@ -2253,7 +2256,7 @@ function Er(e, t) {
|
|
|
2253
2256
|
i.set(S, j), S = `${S}-${j}`;
|
|
2254
2257
|
} else
|
|
2255
2258
|
i.set(S, 0);
|
|
2256
|
-
s.push({ level:
|
|
2259
|
+
s.push({ level: b, text: m, slug: S });
|
|
2257
2260
|
}
|
|
2258
2261
|
}
|
|
2259
2262
|
return s;
|
|
@@ -2261,22 +2264,22 @@ function Er(e, t) {
|
|
|
2261
2264
|
function Dr(e) {
|
|
2262
2265
|
return e.frontmatter.slug ?? e.frontmatter.title;
|
|
2263
2266
|
}
|
|
2264
|
-
function
|
|
2267
|
+
function se(e) {
|
|
2265
2268
|
return e ? e.replace(/[-_]/g, " ").replace(/\b\w/g, (t) => t.toUpperCase()) : "";
|
|
2266
2269
|
}
|
|
2267
|
-
function
|
|
2270
|
+
function Oe(e) {
|
|
2268
2271
|
e.sort((t, n) => {
|
|
2269
2272
|
const s = t.order ?? Number.MAX_SAFE_INTEGER, r = n.order ?? Number.MAX_SAFE_INTEGER;
|
|
2270
2273
|
return s !== r ? s - r : t.text.localeCompare(n.text);
|
|
2271
2274
|
});
|
|
2272
2275
|
for (const t of e)
|
|
2273
|
-
t.items &&
|
|
2276
|
+
t.items && Oe(t.items);
|
|
2274
2277
|
}
|
|
2275
2278
|
function Ar(e) {
|
|
2276
|
-
let t =
|
|
2279
|
+
let t = Wt, n = q(process.cwd(), Wt.contentDir), s = q(process.cwd(), Wt.assetsDir), r = /* @__PURE__ */ new Map(), i = null, c = q(process.cwd(), "dist"), u = !1, b = null;
|
|
2277
2280
|
const d = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Set(), k = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Set();
|
|
2278
2281
|
function T(o) {
|
|
2279
|
-
return
|
|
2282
|
+
return bn("sha1").update(o).digest("hex");
|
|
2280
2283
|
}
|
|
2281
2284
|
async function D() {
|
|
2282
2285
|
return i || (i = await gs({
|
|
@@ -2306,12 +2309,12 @@ function Ar(e) {
|
|
|
2306
2309
|
}), i);
|
|
2307
2310
|
}
|
|
2308
2311
|
function H(o, l) {
|
|
2309
|
-
return /\.ya?ml$/i.test(l) ?
|
|
2312
|
+
return /\.ya?ml$/i.test(l) ? vn(o) : JSON.parse(o);
|
|
2310
2313
|
}
|
|
2311
2314
|
async function K(o, l) {
|
|
2312
2315
|
try {
|
|
2313
|
-
const a = vt(l) ? l : q(
|
|
2314
|
-
return await st(w,
|
|
2316
|
+
const a = vt(l) ? l : q(G(o), l), g = await it(a, "utf-8"), w = H(g, a);
|
|
2317
|
+
return await st(w, G(a)), w;
|
|
2315
2318
|
} catch (a) {
|
|
2316
2319
|
return console.warn(`[nimpress] failed to load spec ${l} for ${o}:`, a), null;
|
|
2317
2320
|
}
|
|
@@ -2319,66 +2322,66 @@ function Ar(e) {
|
|
|
2319
2322
|
async function st(o, l) {
|
|
2320
2323
|
if (!o || typeof o != "object") return;
|
|
2321
2324
|
o.components || (o.components = {}), o.components.schemas || (o.components.schemas = {});
|
|
2322
|
-
const a = o.components.schemas,
|
|
2323
|
-
const x = await
|
|
2324
|
-
return H(x,
|
|
2325
|
-
},
|
|
2326
|
-
if (
|
|
2327
|
-
const
|
|
2328
|
-
|
|
2329
|
-
const P = await w(
|
|
2330
|
-
return await
|
|
2331
|
-
},
|
|
2332
|
-
if (!
|
|
2333
|
-
if (Array.isArray(
|
|
2334
|
-
for (const P of
|
|
2325
|
+
const a = o.components.schemas, g = /* @__PURE__ */ new Map(), w = async (y) => {
|
|
2326
|
+
const x = await it(y, "utf-8");
|
|
2327
|
+
return H(x, y);
|
|
2328
|
+
}, h = async (y) => {
|
|
2329
|
+
if (g.has(y)) return g.get(y);
|
|
2330
|
+
const v = (y.split("/").pop() ?? "").replace(/\.json$/, "");
|
|
2331
|
+
g.set(y, v);
|
|
2332
|
+
const P = await w(y);
|
|
2333
|
+
return await p(P, G(y)), a[v] = P, v;
|
|
2334
|
+
}, p = async (y, x) => {
|
|
2335
|
+
if (!y || typeof y != "object") return;
|
|
2336
|
+
if (Array.isArray(y)) {
|
|
2337
|
+
for (const P of y) await p(P, x);
|
|
2335
2338
|
return;
|
|
2336
2339
|
}
|
|
2337
|
-
const
|
|
2338
|
-
if (typeof
|
|
2339
|
-
const P = vt(
|
|
2340
|
-
if (
|
|
2341
|
-
const $ = await
|
|
2342
|
-
|
|
2340
|
+
const v = y.$ref;
|
|
2341
|
+
if (typeof v == "string" && !v.startsWith("#")) {
|
|
2342
|
+
const P = vt(v) ? v : q(x, v), O = G(P).split("/").pop() ?? "";
|
|
2343
|
+
if (O === "schemas") {
|
|
2344
|
+
const $ = await h(P);
|
|
2345
|
+
y.$ref = `#/components/schemas/${$}`;
|
|
2343
2346
|
return;
|
|
2344
2347
|
}
|
|
2345
|
-
if (
|
|
2348
|
+
if (O === "operations") {
|
|
2346
2349
|
const $ = await w(P);
|
|
2347
|
-
await
|
|
2348
|
-
for (const N of Object.keys($))
|
|
2350
|
+
await p($, G(P)), delete y.$ref;
|
|
2351
|
+
for (const N of Object.keys($)) y[N] = $[N];
|
|
2349
2352
|
return;
|
|
2350
2353
|
}
|
|
2351
2354
|
return;
|
|
2352
2355
|
}
|
|
2353
|
-
for (const P of Object.keys(
|
|
2354
|
-
await
|
|
2356
|
+
for (const P of Object.keys(y))
|
|
2357
|
+
await p(y[P], x);
|
|
2355
2358
|
};
|
|
2356
|
-
for (const
|
|
2357
|
-
const x = a[
|
|
2359
|
+
for (const y of Object.keys(a)) {
|
|
2360
|
+
const x = a[y];
|
|
2358
2361
|
if (x && typeof x == "object" && typeof x.$ref == "string" && !x.$ref.startsWith("#")) {
|
|
2359
|
-
const
|
|
2360
|
-
|
|
2361
|
-
const P = await w(
|
|
2362
|
-
await
|
|
2362
|
+
const v = vt(x.$ref) ? x.$ref : q(l, x.$ref);
|
|
2363
|
+
g.set(v, y);
|
|
2364
|
+
const P = await w(v);
|
|
2365
|
+
await p(P, G(v)), a[y] = P;
|
|
2363
2366
|
}
|
|
2364
2367
|
}
|
|
2365
|
-
for (const
|
|
2366
|
-
|
|
2368
|
+
for (const y of Object.keys(o))
|
|
2369
|
+
y !== "components" && await p(o[y], l);
|
|
2367
2370
|
}
|
|
2368
|
-
function
|
|
2371
|
+
function M(o, l) {
|
|
2369
2372
|
if (typeof l != "string" || !l.startsWith("#/")) return null;
|
|
2370
2373
|
const a = l.slice(2).split("/").map((w) => w.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
2371
|
-
let
|
|
2374
|
+
let g = o;
|
|
2372
2375
|
for (const w of a) {
|
|
2373
|
-
if (
|
|
2374
|
-
|
|
2376
|
+
if (g == null) return null;
|
|
2377
|
+
g = g[w];
|
|
2375
2378
|
}
|
|
2376
|
-
return
|
|
2379
|
+
return g;
|
|
2377
2380
|
}
|
|
2378
2381
|
function A(o, l, a = 0) {
|
|
2379
2382
|
if (a > 4 || !o || typeof o != "object" || typeof o.$ref != "string") return o;
|
|
2380
|
-
const
|
|
2381
|
-
return
|
|
2383
|
+
const g = M(l, o.$ref);
|
|
2384
|
+
return g == null ? o : A(g, l, a + 1);
|
|
2382
2385
|
}
|
|
2383
2386
|
function L(o, l) {
|
|
2384
2387
|
if (!(typeof l != "string" || l === ""))
|
|
@@ -2390,173 +2393,174 @@ function Ar(e) {
|
|
|
2390
2393
|
}
|
|
2391
2394
|
function ot(o, l) {
|
|
2392
2395
|
if (!o) return null;
|
|
2393
|
-
const a = o,
|
|
2396
|
+
const a = o, g = a.info ?? {}, w = a.components?.securitySchemes ?? {}, h = ["get", "post", "put", "patch", "delete", "head", "options"], p = ($) => A($, a)?.example, y = /* @__PURE__ */ new Map(), x = a.paths ?? {};
|
|
2394
2397
|
for (const [$, N] of Object.entries(x)) {
|
|
2395
|
-
const
|
|
2396
|
-
if (!
|
|
2397
|
-
const U = (
|
|
2398
|
-
for (const C of
|
|
2399
|
-
const
|
|
2400
|
-
if (!
|
|
2401
|
-
const E =
|
|
2402
|
-
for (const ht of
|
|
2403
|
-
const
|
|
2404
|
-
if (!
|
|
2405
|
-
const
|
|
2406
|
-
|
|
2407
|
-
name:
|
|
2408
|
-
in:
|
|
2409
|
-
required:
|
|
2410
|
-
schema:
|
|
2411
|
-
description:
|
|
2412
|
-
description_html: L(l,
|
|
2413
|
-
example:
|
|
2398
|
+
const I = A(N, a);
|
|
2399
|
+
if (!I || typeof I != "object") continue;
|
|
2400
|
+
const U = (I.parameters ?? []).map((C) => A(C, a));
|
|
2401
|
+
for (const C of h) {
|
|
2402
|
+
const F = I[C];
|
|
2403
|
+
if (!F) continue;
|
|
2404
|
+
const E = F.operationId ?? `${C}-${$.replace(/[^a-z0-9]+/gi, "-")}`, R = F.tags?.[0] ?? "default", z = (F.parameters ?? []).map((ht) => A(ht, a)), V = [...U, ...z], _ = /* @__PURE__ */ new Set(), B = [];
|
|
2405
|
+
for (const ht of V) {
|
|
2406
|
+
const rt = ht;
|
|
2407
|
+
if (!rt || typeof rt != "object" || !rt.name || !rt.in) continue;
|
|
2408
|
+
const tt = `${rt.name}@${rt.in}`;
|
|
2409
|
+
_.has(tt) || (_.add(tt), B.push({
|
|
2410
|
+
name: rt.name,
|
|
2411
|
+
in: rt.in,
|
|
2412
|
+
required: rt.required,
|
|
2413
|
+
schema: rt.schema,
|
|
2414
|
+
description: rt.description,
|
|
2415
|
+
description_html: L(l, rt.description),
|
|
2416
|
+
example: rt.example ?? p(rt.schema)
|
|
2414
2417
|
}));
|
|
2415
2418
|
}
|
|
2416
|
-
const J =
|
|
2417
|
-
for (const [ht,
|
|
2418
|
-
const
|
|
2419
|
-
|
|
2420
|
-
const
|
|
2421
|
-
|
|
2419
|
+
const J = F.requestBody ? A(F.requestBody, a) : void 0, Z = J?.content?.["application/json"], X = Z?.example ?? (Z?.examples ? Object.values(Z.examples)[0]?.value : void 0) ?? p(Z?.schema), Y = {}, ct = {};
|
|
2420
|
+
for (const [ht, rt] of Object.entries(F.responses ?? {})) {
|
|
2421
|
+
const tt = A(rt, a);
|
|
2422
|
+
ct[ht] = tt;
|
|
2423
|
+
const bt = tt?.content?.["application/json"], Ct = bt?.example ?? (bt?.examples ? Object.values(bt.examples)[0]?.value : void 0) ?? p(bt?.schema);
|
|
2424
|
+
Ct !== void 0 && (Y[ht] = Ct);
|
|
2422
2425
|
}
|
|
2423
|
-
const
|
|
2426
|
+
const ut = {
|
|
2424
2427
|
id: E,
|
|
2425
2428
|
method: C.toUpperCase(),
|
|
2426
2429
|
path: $,
|
|
2427
|
-
tag:
|
|
2428
|
-
summary:
|
|
2429
|
-
summary_html: L(l,
|
|
2430
|
-
description:
|
|
2431
|
-
description_html: L(l,
|
|
2432
|
-
parameters:
|
|
2430
|
+
tag: R,
|
|
2431
|
+
summary: F.summary ?? E,
|
|
2432
|
+
summary_html: L(l, F.summary),
|
|
2433
|
+
description: F.description,
|
|
2434
|
+
description_html: L(l, F.description),
|
|
2435
|
+
parameters: B,
|
|
2433
2436
|
requestBody: J,
|
|
2434
2437
|
requestBodyHtml: L(l, J?.description),
|
|
2435
|
-
requestExample:
|
|
2436
|
-
responses:
|
|
2437
|
-
responseExamples:
|
|
2438
|
-
security:
|
|
2439
|
-
operationName:
|
|
2438
|
+
requestExample: X,
|
|
2439
|
+
responses: ct,
|
|
2440
|
+
responseExamples: Y,
|
|
2441
|
+
security: F.security ?? a.security,
|
|
2442
|
+
operationName: F.operationId
|
|
2440
2443
|
};
|
|
2441
|
-
|
|
2444
|
+
y.has(R) || y.set(R, []), y.get(R).push(ut);
|
|
2442
2445
|
}
|
|
2443
2446
|
}
|
|
2444
|
-
const
|
|
2447
|
+
const v = [...y.entries()].map(([$, N]) => ({ name: $, operations: N })).sort(($, N) => $.name.localeCompare(N.name)), P = a.components?.schemas ?? {}, O = {};
|
|
2445
2448
|
for (const [$, N] of Object.entries(P)) {
|
|
2446
|
-
const
|
|
2447
|
-
|
|
2449
|
+
const I = L(l, N?.description);
|
|
2450
|
+
O[$] = I ? { ...N, description_html: I } : N;
|
|
2448
2451
|
}
|
|
2449
2452
|
return {
|
|
2450
|
-
title:
|
|
2451
|
-
version:
|
|
2452
|
-
description:
|
|
2453
|
-
description_html: L(l,
|
|
2453
|
+
title: g.title ?? "API",
|
|
2454
|
+
version: g.version ?? "",
|
|
2455
|
+
description: g.description,
|
|
2456
|
+
description_html: L(l, g.description),
|
|
2454
2457
|
servers: a.servers,
|
|
2455
2458
|
securitySchemes: w,
|
|
2456
|
-
tags:
|
|
2457
|
-
schemas:
|
|
2459
|
+
tags: v,
|
|
2460
|
+
schemas: O
|
|
2458
2461
|
};
|
|
2459
2462
|
}
|
|
2460
2463
|
async function lt(o) {
|
|
2461
|
-
const l = await
|
|
2464
|
+
const l = await it(o, "utf-8"), { data: a, content: g } = Te(l), w = Fn(a, g);
|
|
2462
2465
|
if (w.length) {
|
|
2463
|
-
const
|
|
2466
|
+
const tt = `${o}
|
|
2464
2467
|
${w.join(`
|
|
2465
2468
|
`)}`;
|
|
2466
|
-
if (
|
|
2467
|
-
console.warn(`[nimpress] invalid frontmatter in ${
|
|
2469
|
+
if (u) throw new Error(`[nimpress] invalid frontmatter in ${tt}`);
|
|
2470
|
+
console.warn(`[nimpress] invalid frontmatter in ${tt}`);
|
|
2468
2471
|
}
|
|
2469
|
-
const
|
|
2470
|
-
if (!(t.defaultFrontmatterExclude ?? []).some((
|
|
2471
|
-
const
|
|
2472
|
-
return
|
|
2472
|
+
const h = Nn.safeParse(a), p = h.success ? h.data : { title: o }, y = vr(n, o), x = p.type ?? "doc", v = yn(p.path ?? $r(y)), P = typeof p.link == "string" && p.link.trim() !== "" ? p.link.trim() : void 0, O = !!P || a.type === void 0 && g.trim() === "", $ = t.defaultFrontmatter ?? {};
|
|
2473
|
+
if (!(t.defaultFrontmatterExclude ?? []).some((tt) => {
|
|
2474
|
+
const bt = tt.startsWith("/") ? tt : "/" + tt;
|
|
2475
|
+
return v === bt || v.startsWith(bt + "/");
|
|
2473
2476
|
}))
|
|
2474
|
-
for (const [
|
|
2475
|
-
const
|
|
2476
|
-
(
|
|
2477
|
+
for (const [tt, bt] of Object.entries($)) {
|
|
2478
|
+
const Ct = tt;
|
|
2479
|
+
(p[Ct] === void 0 || p[Ct] === null || p[Ct] === "") && (p[Ct] = bt);
|
|
2477
2480
|
}
|
|
2478
|
-
const
|
|
2479
|
-
let
|
|
2481
|
+
const U = await D(), C = Sr(U, Q(), t.base), F = Pr(g, o), E = Er(C, F), R = C.render(F);
|
|
2482
|
+
let z, V, _, B;
|
|
2480
2483
|
if (x === "openapi")
|
|
2481
|
-
if (!
|
|
2484
|
+
if (!p.spec)
|
|
2482
2485
|
console.warn(`[nimpress] page ${o} has type openapi but no spec field`);
|
|
2483
2486
|
else {
|
|
2484
|
-
|
|
2485
|
-
const
|
|
2486
|
-
|
|
2487
|
+
B = vt(p.spec) ? p.spec : q(G(o), p.spec), V = Mt(B), _ = br(n, B);
|
|
2488
|
+
const tt = await K(o, p.spec);
|
|
2489
|
+
z = tt ? ot(tt, C) ?? void 0 : void 0;
|
|
2487
2490
|
}
|
|
2488
|
-
let
|
|
2491
|
+
let J, Z, X, Y;
|
|
2489
2492
|
if (x === "dbml")
|
|
2490
|
-
if (!
|
|
2493
|
+
if (!p.spec)
|
|
2491
2494
|
console.warn(`[nimpress] page ${o} has type dbml but no spec field`);
|
|
2492
2495
|
else {
|
|
2493
|
-
|
|
2496
|
+
B = vt(p.spec) ? p.spec : q(G(o), p.spec), X = Mt(B);
|
|
2494
2497
|
try {
|
|
2495
|
-
|
|
2496
|
-
} catch (
|
|
2497
|
-
Y =
|
|
2498
|
-
const
|
|
2498
|
+
Z = await it(B, "utf-8"), J = kn(Z);
|
|
2499
|
+
} catch (tt) {
|
|
2500
|
+
Y = tt instanceof Be ? tt.message : String(tt);
|
|
2501
|
+
const bt = `${o} -> ${p.spec}
|
|
2499
2502
|
${Y}`;
|
|
2500
|
-
if (
|
|
2501
|
-
console.warn(`[nimpress] invalid dbml in ${
|
|
2503
|
+
if (u) throw new Error(`[nimpress] invalid dbml in ${bt}`);
|
|
2504
|
+
console.warn(`[nimpress] invalid dbml in ${bt}`);
|
|
2502
2505
|
}
|
|
2503
2506
|
}
|
|
2504
|
-
|
|
2505
|
-
let
|
|
2507
|
+
mt(o, B);
|
|
2508
|
+
let ct, ut = [];
|
|
2506
2509
|
if (x === "component") {
|
|
2507
|
-
const
|
|
2510
|
+
const tt = await Yo({
|
|
2508
2511
|
cwd: process.cwd(),
|
|
2509
2512
|
modules: t.modules,
|
|
2510
2513
|
pageFile: o,
|
|
2511
|
-
data:
|
|
2512
|
-
editable: !
|
|
2514
|
+
data: p.data ?? {},
|
|
2515
|
+
editable: !u
|
|
2513
2516
|
});
|
|
2514
|
-
|
|
2517
|
+
ct = tt.data, ut = tt.watchFiles;
|
|
2515
2518
|
}
|
|
2516
|
-
Et(o,
|
|
2517
|
-
const
|
|
2518
|
-
let
|
|
2519
|
-
return
|
|
2520
|
-
slug:
|
|
2519
|
+
Et(o, ut);
|
|
2520
|
+
const ht = o.replace(/\.md$/, ".css");
|
|
2521
|
+
let rt;
|
|
2522
|
+
return ht !== o && dt(ht) && (rt = await it(ht, "utf-8")), {
|
|
2523
|
+
slug: y,
|
|
2521
2524
|
filePath: o,
|
|
2522
|
-
effectivePath:
|
|
2525
|
+
effectivePath: v,
|
|
2523
2526
|
type: x,
|
|
2524
|
-
sidebarOnly:
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2527
|
+
sidebarOnly: O,
|
|
2528
|
+
linkTo: P,
|
|
2529
|
+
frontmatter: p,
|
|
2530
|
+
html: R,
|
|
2531
|
+
headings: E,
|
|
2532
|
+
rawText: g,
|
|
2533
|
+
pageCss: rt,
|
|
2534
|
+
openApiSpec: z,
|
|
2535
|
+
openApiFile: V,
|
|
2536
|
+
openApiUrl: _,
|
|
2537
|
+
componentData: ct,
|
|
2538
|
+
dbmlSchema: J,
|
|
2539
|
+
dbmlSource: Z,
|
|
2540
|
+
dbmlFile: X,
|
|
2537
2541
|
dbmlError: Y
|
|
2538
2542
|
};
|
|
2539
2543
|
}
|
|
2540
|
-
function
|
|
2541
|
-
for (const [a,
|
|
2542
|
-
|
|
2543
|
-
l && (m.set(l, o),
|
|
2544
|
+
function mt(o, l) {
|
|
2545
|
+
for (const [a, g] of m)
|
|
2546
|
+
g === o && m.delete(a);
|
|
2547
|
+
l && (m.set(l, o), b && !S.has(l) && (b.watcher.add(l), S.add(l)));
|
|
2544
2548
|
}
|
|
2545
2549
|
function Et(o, l) {
|
|
2546
|
-
for (const [a,
|
|
2547
|
-
|
|
2550
|
+
for (const [a, g] of k)
|
|
2551
|
+
g === o && k.delete(a);
|
|
2548
2552
|
for (const a of l)
|
|
2549
|
-
k.set(a, o),
|
|
2553
|
+
k.set(a, o), b && !j.has(a) && (b.watcher.add(a), j.add(a));
|
|
2550
2554
|
}
|
|
2551
|
-
async function
|
|
2555
|
+
async function wt(o) {
|
|
2552
2556
|
let l;
|
|
2553
2557
|
try {
|
|
2554
|
-
l = await
|
|
2558
|
+
l = await it(o, "utf-8");
|
|
2555
2559
|
} catch {
|
|
2556
2560
|
return null;
|
|
2557
2561
|
}
|
|
2558
|
-
const a = T(l),
|
|
2559
|
-
if (
|
|
2562
|
+
const a = T(l), g = d.get(o);
|
|
2563
|
+
if (g && g.hash === a) return g.processed;
|
|
2560
2564
|
const w = await lt(o);
|
|
2561
2565
|
return w ? (d.set(o, { hash: a, processed: w }), w) : (d.delete(o), null);
|
|
2562
2566
|
}
|
|
@@ -2570,83 +2574,83 @@ function Ar(e) {
|
|
|
2570
2574
|
system: o.length === 1 ? o[0] : void 0
|
|
2571
2575
|
};
|
|
2572
2576
|
}
|
|
2573
|
-
function
|
|
2577
|
+
function $t(o) {
|
|
2574
2578
|
const l = t.exclude ?? [];
|
|
2575
2579
|
for (const a of l) {
|
|
2576
|
-
const
|
|
2577
|
-
if (o ===
|
|
2580
|
+
const g = a.replace(/\/$/, "");
|
|
2581
|
+
if (o === g || o.startsWith(g + "/")) return !0;
|
|
2578
2582
|
}
|
|
2579
2583
|
return !1;
|
|
2580
2584
|
}
|
|
2581
|
-
async function
|
|
2582
|
-
const o = await
|
|
2585
|
+
async function at() {
|
|
2586
|
+
const o = await Je(n), l = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), p = [], y = new Set(o);
|
|
2583
2587
|
for (const x of [...d.keys()])
|
|
2584
|
-
|
|
2588
|
+
y.has(x) || d.delete(x);
|
|
2585
2589
|
for (const x of o) {
|
|
2586
|
-
let
|
|
2590
|
+
let v = null;
|
|
2587
2591
|
try {
|
|
2588
|
-
|
|
2589
|
-
} catch (
|
|
2590
|
-
console.warn(`[nimpress] failed to process ${x}:`,
|
|
2592
|
+
v = await wt(x);
|
|
2593
|
+
} catch (O) {
|
|
2594
|
+
console.warn(`[nimpress] failed to process ${x}:`, O);
|
|
2591
2595
|
continue;
|
|
2592
2596
|
}
|
|
2593
|
-
if (!
|
|
2594
|
-
if (
|
|
2595
|
-
const $ = `${wr(
|
|
2596
|
-
N.push(
|
|
2597
|
+
if (!v || $t(v.slug)) continue;
|
|
2598
|
+
if (p.push(v), v.type === "changelog") {
|
|
2599
|
+
const $ = `${wr(v.slug)}\0${v.frontmatter.title}`, N = g.get($) ?? [];
|
|
2600
|
+
N.push(v), g.set($, N);
|
|
2597
2601
|
continue;
|
|
2598
2602
|
}
|
|
2599
|
-
if (
|
|
2600
|
-
const
|
|
2601
|
-
w.set(
|
|
2603
|
+
if (v.type === "roadmap") {
|
|
2604
|
+
const O = String(v.filePath);
|
|
2605
|
+
w.set(O, [v]);
|
|
2602
2606
|
}
|
|
2603
|
-
if (
|
|
2604
|
-
const
|
|
2607
|
+
if (v.type === "component") {
|
|
2608
|
+
const O = G(v.filePath), $ = h.get(O);
|
|
2605
2609
|
if ($)
|
|
2606
2610
|
throw new Error(
|
|
2607
|
-
`[nimpress] one type component page per folder: ${
|
|
2611
|
+
`[nimpress] one type component page per folder: ${O} holds ${$} and ${v.filePath}`
|
|
2608
2612
|
);
|
|
2609
|
-
|
|
2613
|
+
h.set(O, v.filePath);
|
|
2610
2614
|
}
|
|
2611
|
-
const P = a.get(
|
|
2615
|
+
const P = a.get(v.effectivePath);
|
|
2612
2616
|
if (P)
|
|
2613
2617
|
throw new Error(
|
|
2614
|
-
`[nimpress] duplicate path ${
|
|
2618
|
+
`[nimpress] duplicate path ${v.effectivePath}: ${P} and ${v.filePath}`
|
|
2615
2619
|
);
|
|
2616
|
-
a.set(
|
|
2620
|
+
a.set(v.effectivePath, v.filePath), l.set(v.slug, v);
|
|
2617
2621
|
}
|
|
2618
|
-
|
|
2619
|
-
for (const [x,
|
|
2620
|
-
const P = x.split("\0", 1)[0],
|
|
2621
|
-
if (a.has(
|
|
2622
|
+
fe.clear();
|
|
2623
|
+
for (const [x, v] of g) {
|
|
2624
|
+
const P = x.split("\0", 1)[0], O = yn(P ? "/" + P : "/");
|
|
2625
|
+
if (a.has(O))
|
|
2622
2626
|
throw new Error(
|
|
2623
|
-
`[nimpress] path ${
|
|
2627
|
+
`[nimpress] path ${O} is occupied by both a changelog collection and a regular page`
|
|
2624
2628
|
);
|
|
2625
|
-
const $ =
|
|
2629
|
+
const $ = v.filter((E) => !(u && Dt(E.frontmatter)));
|
|
2626
2630
|
if ($.length === 0) continue;
|
|
2627
|
-
$.sort((E,
|
|
2628
|
-
const z = String(E.frontmatter.data?.version ?? ""),
|
|
2629
|
-
return yr(
|
|
2631
|
+
$.sort((E, R) => {
|
|
2632
|
+
const z = String(E.frontmatter.data?.version ?? ""), V = String(R.frontmatter.data?.version ?? "");
|
|
2633
|
+
return yr(V, z);
|
|
2630
2634
|
});
|
|
2631
|
-
const N = $[0],
|
|
2632
|
-
const
|
|
2635
|
+
const N = $[0], I = `__changelog__${(P || "root").replace(/\//g, "__")}`, U = $.map((E) => {
|
|
2636
|
+
const R = E.frontmatter.data, z = String(R?.version ?? ""), V = String(R?.title ?? ""), _ = R?.description !== void 0 ? String(R.description) : void 0, B = R?.release_date;
|
|
2633
2637
|
let J;
|
|
2634
|
-
if (
|
|
2635
|
-
const
|
|
2636
|
-
if (Number.isNaN(
|
|
2638
|
+
if (B != null && String(B).trim() !== "") {
|
|
2639
|
+
const X = B instanceof Date ? B.toISOString() : String(B), Y = new Date(X);
|
|
2640
|
+
if (Number.isNaN(Y.getTime()))
|
|
2637
2641
|
throw new Error(
|
|
2638
|
-
`[nimpress] changelog entry ${E.filePath} has an invalid data.release_date (${
|
|
2642
|
+
`[nimpress] changelog entry ${E.filePath} has an invalid data.release_date (${X}). Use an RFC 3339 timestamp like 2026-06-10 or 2026-06-10T09:00:00Z.`
|
|
2639
2643
|
);
|
|
2640
|
-
J =
|
|
2644
|
+
J = Y.toISOString();
|
|
2641
2645
|
}
|
|
2642
|
-
const
|
|
2643
|
-
return
|
|
2646
|
+
const Z = z ? `v${z}` : "unreleased";
|
|
2647
|
+
return fe.set(`${I}#${Z}`, E.rawText), {
|
|
2644
2648
|
version: z,
|
|
2645
|
-
slug:
|
|
2646
|
-
title:
|
|
2647
|
-
description:
|
|
2649
|
+
slug: Z,
|
|
2650
|
+
title: V,
|
|
2651
|
+
description: _,
|
|
2648
2652
|
releaseDate: J,
|
|
2649
|
-
hidden:
|
|
2653
|
+
hidden: ne(E.frontmatter),
|
|
2650
2654
|
html: E.html,
|
|
2651
2655
|
headings: E.headings,
|
|
2652
2656
|
data: E.frontmatter.data
|
|
@@ -2655,14 +2659,14 @@ function Ar(e) {
|
|
|
2655
2659
|
level: 2,
|
|
2656
2660
|
text: E.version ? `v${E.version}` : E.title || "unreleased",
|
|
2657
2661
|
slug: E.slug
|
|
2658
|
-
})),
|
|
2659
|
-
slug:
|
|
2662
|
+
})), F = {
|
|
2663
|
+
slug: I,
|
|
2660
2664
|
filePath: N.filePath,
|
|
2661
|
-
effectivePath:
|
|
2665
|
+
effectivePath: O,
|
|
2662
2666
|
type: "changelog",
|
|
2663
2667
|
frontmatter: {
|
|
2664
2668
|
...N.frontmatter,
|
|
2665
|
-
path:
|
|
2669
|
+
path: O,
|
|
2666
2670
|
type: "changelog",
|
|
2667
2671
|
rss: $.some((E) => E.frontmatter.rss === !0) ? !0 : void 0,
|
|
2668
2672
|
subscribe: $.some((E) => E.frontmatter.subscribe === !0) ? !0 : void 0
|
|
@@ -2674,39 +2678,39 @@ function Ar(e) {
|
|
|
2674
2678
|
`),
|
|
2675
2679
|
changelogEntries: U
|
|
2676
2680
|
};
|
|
2677
|
-
a.set(
|
|
2681
|
+
a.set(O, F.filePath), l.set(F.slug, F);
|
|
2678
2682
|
}
|
|
2679
|
-
Yn(w,
|
|
2683
|
+
Yn(w, p), Rn(l), Bn(l), r = l;
|
|
2680
2684
|
}
|
|
2681
|
-
const
|
|
2682
|
-
let
|
|
2685
|
+
const St = /* @__PURE__ */ new Map(), fe = /* @__PURE__ */ new Map();
|
|
2686
|
+
let me = JSON.stringify({ pages: [] }, null, 2) + `
|
|
2683
2687
|
`;
|
|
2684
2688
|
function Bn(o) {
|
|
2685
2689
|
const l = [];
|
|
2686
2690
|
for (const a of o.values()) {
|
|
2687
|
-
if (a.frontmatter.subscribe !== !0 ||
|
|
2688
|
-
const
|
|
2689
|
-
if (
|
|
2690
|
-
const
|
|
2691
|
+
if (a.frontmatter.subscribe !== !0 || ke(a.frontmatter)) continue;
|
|
2692
|
+
const g = a.effectivePath === "/" ? "" : a.effectivePath, h = `${yt(a) ? `/${t.paths.guarded}/${Xt(a)}` : ""}${g}/${hn(0)}`;
|
|
2693
|
+
if (!St.has(h)) continue;
|
|
2694
|
+
const p = {
|
|
2691
2695
|
path: a.effectivePath,
|
|
2692
2696
|
title: a.frontmatter.title,
|
|
2693
2697
|
name: a.effectivePath === "/" ? "index" : a.effectivePath.replace(/\//g, "-").replace(/^-/, ""),
|
|
2694
|
-
feed:
|
|
2698
|
+
feed: h
|
|
2695
2699
|
};
|
|
2696
|
-
a.type === "changelog" && (
|
|
2697
|
-
slug:
|
|
2698
|
-
version:
|
|
2699
|
-
date:
|
|
2700
|
-
title:
|
|
2701
|
-
description:
|
|
2702
|
-
body:
|
|
2703
|
-
}))), l.push(
|
|
2704
|
-
}
|
|
2705
|
-
l.sort((a,
|
|
2700
|
+
a.type === "changelog" && (p.entries = (a.changelogEntries ?? []).filter((y) => !y.hidden).map((y) => ({
|
|
2701
|
+
slug: y.slug,
|
|
2702
|
+
version: y.version,
|
|
2703
|
+
date: y.releaseDate,
|
|
2704
|
+
title: y.title,
|
|
2705
|
+
description: y.description,
|
|
2706
|
+
body: fe.get(`${a.slug}#${y.slug}`) ?? ""
|
|
2707
|
+
}))), l.push(p);
|
|
2708
|
+
}
|
|
2709
|
+
l.sort((a, g) => a.path.localeCompare(g.path)), me = JSON.stringify({ pages: l }, null, 2) + `
|
|
2706
2710
|
`;
|
|
2707
2711
|
}
|
|
2708
2712
|
function Rn(o) {
|
|
2709
|
-
|
|
2713
|
+
St.clear();
|
|
2710
2714
|
const l = t.site?.url?.replace(/\/$/, "");
|
|
2711
2715
|
for (const a of o.values()) {
|
|
2712
2716
|
if (a.type !== "changelog" || !(a.frontmatter.rss === !0 || a.frontmatter.subscribe === !0)) continue;
|
|
@@ -2714,88 +2718,88 @@ function Ar(e) {
|
|
|
2714
2718
|
console.warn(`[nimpress] changelog feed for ${a.effectivePath} needs site.url in the config, skipping`);
|
|
2715
2719
|
continue;
|
|
2716
2720
|
}
|
|
2717
|
-
const
|
|
2718
|
-
if (
|
|
2719
|
-
const w = a.effectivePath === "/" ? "" : a.effectivePath,
|
|
2720
|
-
for (let E = 0; E + 1 < x.length; E++)
|
|
2721
|
-
const P =
|
|
2721
|
+
const g = (a.changelogEntries ?? []).filter((E) => !E.hidden);
|
|
2722
|
+
if (g.length === 0) continue;
|
|
2723
|
+
const w = a.effectivePath === "/" ? "" : a.effectivePath, h = `${l}${gt(t.base, w || "/")}`, p = yt(a) ? `/${t.paths.guarded}/${Xt(a)}` : "", y = (E) => `${p}${w}/${hn(E)}`, x = g.map((E) => E.releaseDate ? new Date(E.releaseDate).getTime() : Number.NaN).filter((E) => !Number.isNaN(E)).sort((E, R) => R - E), v = [];
|
|
2724
|
+
for (let E = 0; E + 1 < x.length; E++) v.push(x[E] - x[E + 1]);
|
|
2725
|
+
const P = v.length ? Math.round(v.reduce((E, R) => E + R, 0) / v.length / 1e3) : void 0, O = P ? Math.min(43200, Math.max(60, Math.round(P / 60))) : 1440, $ = P ? P <= 172800 ? "daily" : P <= 1209600 ? "weekly" : P <= 5184e3 ? "monthly" : "yearly" : "weekly", N = x.length ? new Date(x[0]).toUTCString() : void 0, I = ft(a.frontmatter.title), U = ft(
|
|
2722
2726
|
a.frontmatter.description ?? t.site?.description ?? a.frontmatter.title
|
|
2723
|
-
), C = t.site?.locale?.replace("_", "-").toLowerCase(),
|
|
2724
|
-
for (let E = 0; E <
|
|
2725
|
-
const
|
|
2726
|
-
`<atom:link href="${
|
|
2727
|
+
), C = t.site?.locale?.replace("_", "-").toLowerCase(), F = Math.max(1, Math.ceil(g.length / xe));
|
|
2728
|
+
for (let E = 0; E < F; E++) {
|
|
2729
|
+
const R = g.slice(E * xe, (E + 1) * xe), z = [
|
|
2730
|
+
`<atom:link href="${ft(`${l}${gt(t.base, y(E))}`)}" rel="self" type="application/rss+xml"/>`
|
|
2727
2731
|
];
|
|
2728
2732
|
E > 0 && z.push(
|
|
2729
|
-
`<atom:link href="${
|
|
2730
|
-
), E + 1 <
|
|
2731
|
-
`<atom:link href="${
|
|
2733
|
+
`<atom:link href="${ft(`${l}${gt(t.base, y(0))}`)}" rel="current" type="application/rss+xml"/>`
|
|
2734
|
+
), E + 1 < F && z.push(
|
|
2735
|
+
`<atom:link href="${ft(`${l}${gt(t.base, y(E + 1))}`)}" rel="prev-archive" type="application/rss+xml"/>`
|
|
2732
2736
|
), E > 1 && z.push(
|
|
2733
|
-
`<atom:link href="${
|
|
2737
|
+
`<atom:link href="${ft(`${l}${gt(t.base, y(E - 1))}`)}" rel="next-archive" type="application/rss+xml"/>`
|
|
2734
2738
|
);
|
|
2735
|
-
const
|
|
2736
|
-
const
|
|
2737
|
-
`<title>${
|
|
2738
|
-
`<link>${
|
|
2739
|
-
`<guid isPermaLink="true">${
|
|
2739
|
+
const V = R.map((J) => {
|
|
2740
|
+
const Z = `${h}#${J.slug}`, X = [
|
|
2741
|
+
`<title>${ft(J.version ? `v${J.version} ${J.title}` : J.title)}</title>`,
|
|
2742
|
+
`<link>${ft(Z)}</link>`,
|
|
2743
|
+
`<guid isPermaLink="true">${ft(Z)}</guid>`
|
|
2740
2744
|
];
|
|
2741
|
-
return J.releaseDate &&
|
|
2742
|
-
${
|
|
2745
|
+
return J.releaseDate && X.push(`<pubDate>${new Date(J.releaseDate).toUTCString()}</pubDate>`), J.description && X.push(`<description>${ft(J.description)}</description>`), J.html && X.push(`<content:encoded>${ur(J.html)}</content:encoded>`), ` <item>
|
|
2746
|
+
${X.join(`
|
|
2743
2747
|
`)}
|
|
2744
2748
|
</item>`;
|
|
2745
|
-
}),
|
|
2746
|
-
`<title>${
|
|
2747
|
-
`<link>${
|
|
2749
|
+
}), _ = [
|
|
2750
|
+
`<title>${I}</title>`,
|
|
2751
|
+
`<link>${ft(h)}</link>`,
|
|
2748
2752
|
`<description>${U}</description>`,
|
|
2749
2753
|
...z
|
|
2750
2754
|
];
|
|
2751
|
-
C &&
|
|
2752
|
-
const
|
|
2755
|
+
C && _.push(`<language>${ft(C)}</language>`), N && _.push(`<lastBuildDate>${N}</lastBuildDate>`), _.push(`<ttl>${O}</ttl>`), _.push(`<sy:updatePeriod>${$}</sy:updatePeriod>`), _.push("<sy:updateFrequency>1</sy:updateFrequency>"), P !== void 0 && _.push(`<nimpress:releaseCadence>${P}</nimpress:releaseCadence>`), _.push(`<nimpress:latestVersion>${ft(g[0].version)}</nimpress:latestVersion>`), _.push(`<nimpress:releaseCount>${g.length}</nimpress:releaseCount>`), E > 0 && _.push("<fh:archive/>");
|
|
2756
|
+
const B = [
|
|
2753
2757
|
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
2754
2758
|
`<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}">`,
|
|
2755
2759
|
" <channel>",
|
|
2756
|
-
` ${
|
|
2760
|
+
` ${_.join(`
|
|
2757
2761
|
`)}`,
|
|
2758
|
-
|
|
2762
|
+
V.join(`
|
|
2759
2763
|
`),
|
|
2760
2764
|
" </channel>",
|
|
2761
2765
|
"</rss>"
|
|
2762
2766
|
].join(`
|
|
2763
2767
|
`);
|
|
2764
|
-
|
|
2768
|
+
St.set(y(E), B);
|
|
2765
2769
|
}
|
|
2766
2770
|
}
|
|
2767
2771
|
}
|
|
2768
|
-
const
|
|
2772
|
+
const de = /* @__PURE__ */ new Map();
|
|
2769
2773
|
function yt(o) {
|
|
2770
2774
|
return o.frontmatter.gate !== void 0;
|
|
2771
2775
|
}
|
|
2772
2776
|
function Wn(o) {
|
|
2773
|
-
const l =
|
|
2777
|
+
const l = G(o.filePath);
|
|
2774
2778
|
let a = [];
|
|
2775
2779
|
try {
|
|
2776
|
-
a =
|
|
2780
|
+
a = pe(l);
|
|
2777
2781
|
} catch {
|
|
2778
2782
|
return [];
|
|
2779
2783
|
}
|
|
2780
|
-
return a.filter((
|
|
2784
|
+
return a.filter((g) => W(l, g) !== o.filePath).map((g) => jt(process.cwd(), W(l, g)));
|
|
2781
2785
|
}
|
|
2782
|
-
function
|
|
2786
|
+
function Xt(o) {
|
|
2783
2787
|
const l = t.auth?.guard;
|
|
2784
2788
|
return typeof l == "function" ? l(o.frontmatter, jt(process.cwd(), o.filePath), Wn(o)) : o.frontmatter.gate ?? "default";
|
|
2785
2789
|
}
|
|
2786
2790
|
function Ln() {
|
|
2787
2791
|
const o = [];
|
|
2788
2792
|
for (const l of r.values())
|
|
2789
|
-
l.sidebarOnly ||
|
|
2793
|
+
l.sidebarOnly || ke(l.frontmatter) || yt(l) || o.push(l);
|
|
2790
2794
|
return o;
|
|
2791
2795
|
}
|
|
2792
|
-
function
|
|
2796
|
+
function xt(o) {
|
|
2793
2797
|
const l = t.site?.url?.replace(/\/$/, "");
|
|
2794
2798
|
if (l)
|
|
2795
|
-
return l +
|
|
2799
|
+
return l + gt(t.base, o.startsWith("/") ? o : "/" + o);
|
|
2796
2800
|
}
|
|
2797
|
-
function
|
|
2798
|
-
if (
|
|
2801
|
+
function qe(o) {
|
|
2802
|
+
if (de.has(o)) return de.get(o);
|
|
2799
2803
|
let l;
|
|
2800
2804
|
try {
|
|
2801
2805
|
l = cs("git", ["log", "-1", "--format=%cI", "--", o], {
|
|
@@ -2806,70 +2810,70 @@ function Ar(e) {
|
|
|
2806
2810
|
} catch {
|
|
2807
2811
|
l = void 0;
|
|
2808
2812
|
}
|
|
2809
|
-
return
|
|
2813
|
+
return de.set(o, l), l;
|
|
2810
2814
|
}
|
|
2811
2815
|
function Hn(o) {
|
|
2812
2816
|
return o === "changelog" || o === "roadmap" ? "CollectionPage" : o === "openapi" ? "APIReference" : o === "hero" ? "WebPage" : "TechArticle";
|
|
2813
2817
|
}
|
|
2814
2818
|
function Un(o) {
|
|
2815
|
-
const l = t.meta ?? {}, a = t.site,
|
|
2819
|
+
const l = t.meta ?? {}, a = t.site, g = o.frontmatter, w = g.meta ?? {}, h = w.og ?? {}, p = w.twitter ?? {}, y = g.title, x = a?.title && a.title !== y ? `${y} · ${a.title}` : y, v = w.description ?? g.description ?? a?.description, P = w.canonical ?? xt(o.effectivePath), O = (() => {
|
|
2816
2820
|
if (w.keywords) return Array.isArray(w.keywords) ? w.keywords : [w.keywords];
|
|
2817
|
-
const
|
|
2818
|
-
return
|
|
2819
|
-
})(), $ = w.robots ?? "index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1", N =
|
|
2820
|
-
if (
|
|
2821
|
-
|
|
2822
|
-
const
|
|
2823
|
-
for (const
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
}
|
|
2827
|
-
if (
|
|
2828
|
-
const
|
|
2829
|
-
|
|
2830
|
-
}
|
|
2831
|
-
const J = t.site?.url?.replace(/\/$/, ""),
|
|
2832
|
-
if (l.organization &&
|
|
2821
|
+
const X = ge(g.tags);
|
|
2822
|
+
return X.length ? X : l.keywords ?? [];
|
|
2823
|
+
})(), $ = w.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" || o.effectivePath === "/" ? "website" : "article"), E = l.og?.width ?? 1200, R = l.og?.height ?? 600, z = p.card ?? (C ? "summary_large_image" : "summary"), V = p.site ?? a?.twitterSite, _ = qt, B = [];
|
|
2824
|
+
if (B.push(`<title>${_(x)}</title>`), v && B.push(`<meta name="description" content="${_(v)}">`), O.length && B.push(`<meta name="keywords" content="${_(O.join(", "))}">`), B.push(`<meta name="robots" content="${_($)}">`), B.push(`<meta name="googlebot" content="${_($)}">`), P) {
|
|
2825
|
+
B.push(`<link rel="canonical" href="${_(P)}">`);
|
|
2826
|
+
const X = l.localeAlternates ?? [];
|
|
2827
|
+
for (const Y of X)
|
|
2828
|
+
B.push(`<link rel="alternate" hreflang="${_(Y)}" href="${_(P)}">`);
|
|
2829
|
+
X.length && B.push(`<link rel="alternate" hreflang="x-default" href="${_(P)}">`);
|
|
2830
|
+
}
|
|
2831
|
+
if (B.push(`<meta property="og:title" content="${_(N)}">`), I && B.push(`<meta property="og:description" content="${_(I)}">`), B.push(`<meta property="og:type" content="${_(F)}">`), P && B.push(`<meta property="og:url" content="${_(P)}">`), C && (B.push(`<meta property="og:image" content="${_(C)}">`), B.push(`<meta property="og:image:width" content="${E}">`), B.push(`<meta property="og:image:height" content="${R}">`), h.imageAlt && B.push(`<meta property="og:image:alt" content="${_(h.imageAlt)}">`)), a?.title && B.push(`<meta property="og:site_name" content="${_(a.title)}">`), a?.locale && B.push(`<meta property="og:locale" content="${_(a.locale)}">`), B.push(`<meta name="twitter:card" content="${_(z)}">`), V && B.push(`<meta name="twitter:site" content="${_(V)}">`), B.push(`<meta name="twitter:title" content="${_(p.title ?? N)}">`), (p.description ?? I) && B.push(`<meta name="twitter:description" content="${_(p.description ?? I ?? "")}">`), (p.image ?? C) && B.push(`<meta name="twitter:image" content="${_(p.image ?? C ?? "")}">`), v && B.push(`<meta name="dc.description" content="${_(v)}">`), B.push(`<meta name="dc.title" content="${_(x)}">`), a?.locale && B.push(`<meta name="dc.language" content="${_(a.locale)}">`), g.type === "changelog" && (g.rss === !0 || g.subscribe === !0)) {
|
|
2832
|
+
const X = o.effectivePath === "/" ? "/rss.xml" : `${o.effectivePath}/rss.xml`, Y = xt(X) ?? X;
|
|
2833
|
+
B.push(`<link rel="alternate" type="application/rss+xml" title="${_(y)}" href="${_(Y)}">`);
|
|
2834
|
+
}
|
|
2835
|
+
const J = t.site?.url?.replace(/\/$/, ""), Z = [];
|
|
2836
|
+
if (l.organization && Z.push({ "@context": "https://schema.org", ...l.organization }), J && a?.title && Z.push({
|
|
2833
2837
|
"@context": "https://schema.org",
|
|
2834
2838
|
"@type": "WebSite",
|
|
2835
|
-
"@id": `${J}${
|
|
2839
|
+
"@id": `${J}${gt(t.base, "/")}#website`,
|
|
2836
2840
|
name: a.title,
|
|
2837
|
-
url: `${J}${
|
|
2841
|
+
url: `${J}${gt(t.base, "/")}`,
|
|
2838
2842
|
description: a.description
|
|
2839
2843
|
}), P && o.effectivePath !== "/") {
|
|
2840
|
-
const
|
|
2841
|
-
{ name: a?.title ?? "Home", item: J ? `${J}${
|
|
2842
|
-
],
|
|
2843
|
-
let
|
|
2844
|
-
for (const
|
|
2845
|
-
|
|
2846
|
-
const ht = [...r.values()].find((
|
|
2847
|
-
|
|
2844
|
+
const X = [
|
|
2845
|
+
{ name: a?.title ?? "Home", item: J ? `${J}${gt(t.base, "/")}` : void 0 }
|
|
2846
|
+
], Y = o.effectivePath.split("/").filter(Boolean);
|
|
2847
|
+
let ct = "";
|
|
2848
|
+
for (const ut of Y) {
|
|
2849
|
+
ct += "/" + ut;
|
|
2850
|
+
const ht = [...r.values()].find((rt) => rt.effectivePath === ct);
|
|
2851
|
+
X.push({ name: ht?.frontmatter.title ?? se(ut), item: xt(ct) });
|
|
2848
2852
|
}
|
|
2849
|
-
|
|
2853
|
+
Z.push({
|
|
2850
2854
|
"@context": "https://schema.org",
|
|
2851
2855
|
"@type": "BreadcrumbList",
|
|
2852
|
-
itemListElement:
|
|
2856
|
+
itemListElement: X.map((ut, ht) => ({
|
|
2853
2857
|
"@type": "ListItem",
|
|
2854
2858
|
position: ht + 1,
|
|
2855
|
-
name:
|
|
2856
|
-
item:
|
|
2859
|
+
name: ut.name,
|
|
2860
|
+
item: ut.item
|
|
2857
2861
|
}))
|
|
2858
2862
|
});
|
|
2859
2863
|
}
|
|
2860
|
-
|
|
2864
|
+
Z.push({
|
|
2861
2865
|
"@context": "https://schema.org",
|
|
2862
2866
|
"@type": Hn(o.type),
|
|
2863
2867
|
name: x,
|
|
2864
|
-
headline:
|
|
2865
|
-
description:
|
|
2868
|
+
headline: y,
|
|
2869
|
+
description: v,
|
|
2866
2870
|
url: P,
|
|
2867
|
-
isPartOf: J ? `${J}${
|
|
2868
|
-
dateModified:
|
|
2869
|
-
}), w.jsonLd &&
|
|
2870
|
-
for (const
|
|
2871
|
+
isPartOf: J ? `${J}${gt(t.base, "/")}#website` : void 0,
|
|
2872
|
+
dateModified: qe(o.filePath)
|
|
2873
|
+
}), w.jsonLd && Z.push(w.jsonLd);
|
|
2874
|
+
for (const X of Z) B.push(fr(X));
|
|
2871
2875
|
return `
|
|
2872
|
-
${
|
|
2876
|
+
${B.join(`
|
|
2873
2877
|
`)}
|
|
2874
2878
|
`;
|
|
2875
2879
|
}
|
|
@@ -2882,8 +2886,8 @@ function Ar(e) {
|
|
|
2882
2886
|
for (const w of l)
|
|
2883
2887
|
gn.includes(w) || (a.push(`User-agent: ${w}`), a.push("Disallow: /"), a.push(""));
|
|
2884
2888
|
o.robots?.append && a.push(o.robots.append, "");
|
|
2885
|
-
const
|
|
2886
|
-
return
|
|
2889
|
+
const g = xt("/sitemap.xml");
|
|
2890
|
+
return g && a.push(`Sitemap: ${g}`), a.join(`
|
|
2887
2891
|
`).replace(/\n{3,}/g, `
|
|
2888
2892
|
|
|
2889
2893
|
`).trim() + `
|
|
@@ -2897,10 +2901,10 @@ function Ar(e) {
|
|
|
2897
2901
|
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
2898
2902
|
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">',
|
|
2899
2903
|
o.map((w) => {
|
|
2900
|
-
const
|
|
2901
|
-
|
|
2902
|
-
for (const
|
|
2903
|
-
P.push(` <xhtml:link rel="alternate" hreflang="${
|
|
2904
|
+
const h = `${l}${gt(t.base, w.effectivePath === "/" ? "/" : w.effectivePath)}`, p = w.effectivePath.split("/").filter(Boolean).length, y = p === 0 ? "1.0" : p === 1 ? "0.8" : "0.6", x = p === 0 ? "weekly" : "monthly", v = qe(w.filePath), P = [` <loc>${ft(h)}</loc>`];
|
|
2905
|
+
v && P.push(` <lastmod>${ft(v)}</lastmod>`), P.push(` <changefreq>${x}</changefreq>`), P.push(` <priority>${y}</priority>`);
|
|
2906
|
+
for (const O of a)
|
|
2907
|
+
P.push(` <xhtml:link rel="alternate" hreflang="${ft(O)}" href="${ft(h)}"/>`);
|
|
2904
2908
|
return ` <url>
|
|
2905
2909
|
${P.join(`
|
|
2906
2910
|
`)}
|
|
@@ -2913,45 +2917,45 @@ ${P.join(`
|
|
|
2913
2917
|
`);
|
|
2914
2918
|
}
|
|
2915
2919
|
function zn(o) {
|
|
2916
|
-
const l = t.meta ?? {}, a = t.site,
|
|
2917
|
-
w &&
|
|
2918
|
-
const
|
|
2919
|
-
for (const
|
|
2920
|
-
const $ =
|
|
2920
|
+
const l = t.meta ?? {}, a = t.site, g = [`# ${a?.title ?? t.title}`, ""], w = l.llms?.summary ?? a?.description;
|
|
2921
|
+
w && g.push(`> ${w}`, "");
|
|
2922
|
+
const h = /* @__PURE__ */ new Map(), p = [];
|
|
2923
|
+
for (const O of o) {
|
|
2924
|
+
const $ = O.effectivePath.split("/").filter(Boolean);
|
|
2921
2925
|
if ($.length === 0) {
|
|
2922
|
-
|
|
2926
|
+
p.push(O);
|
|
2923
2927
|
continue;
|
|
2924
2928
|
}
|
|
2925
|
-
const N = $[0],
|
|
2926
|
-
|
|
2929
|
+
const N = $[0], I = h.get(N) ?? [];
|
|
2930
|
+
I.push(O), h.set(N, I);
|
|
2927
2931
|
}
|
|
2928
|
-
const
|
|
2929
|
-
const $ =
|
|
2930
|
-
return
|
|
2932
|
+
const y = (O) => {
|
|
2933
|
+
const $ = xt(O.effectivePath) ?? O.effectivePath;
|
|
2934
|
+
return O.frontmatter.description ? `- [${O.frontmatter.title}](${$}): ${O.frontmatter.description}` : `- [${O.frontmatter.title}](${$})`;
|
|
2931
2935
|
};
|
|
2932
|
-
for (const
|
|
2933
|
-
|
|
2934
|
-
for (const [
|
|
2935
|
-
const N = $.find((
|
|
2936
|
-
|
|
2937
|
-
for (const
|
|
2938
|
-
|
|
2936
|
+
for (const O of p) g.push(y(O));
|
|
2937
|
+
p.length && g.push("");
|
|
2938
|
+
for (const [O, $] of [...h.entries()].sort((N, I) => N[0].localeCompare(I[0]))) {
|
|
2939
|
+
const N = $.find((I) => I.effectivePath === `/${O}`);
|
|
2940
|
+
g.push(`## ${N?.frontmatter.title ?? se(O)}`, ""), $.sort((I, U) => I.effectivePath.localeCompare(U.effectivePath));
|
|
2941
|
+
for (const I of $) g.push(y(I));
|
|
2942
|
+
g.push("");
|
|
2939
2943
|
}
|
|
2940
2944
|
const x = new Set(t.meta?.keywords ?? []);
|
|
2941
|
-
for (const
|
|
2942
|
-
x.size &&
|
|
2943
|
-
const
|
|
2944
|
-
return (
|
|
2945
|
+
for (const O of o) for (const $ of ge(O.frontmatter.tags)) x.add($);
|
|
2946
|
+
x.size && g.push("## Keywords", "", [...x].join(", "), "");
|
|
2947
|
+
const v = xt("/sitemap.xml"), P = xt("/robots.txt");
|
|
2948
|
+
return (v || P) && (g.push("## Optional", ""), v && g.push(`- [Sitemap](${v})`), P && g.push(`- [Robots](${P})`), g.push("")), l.llms?.append && g.push(l.llms.append, ""), g.join(`
|
|
2945
2949
|
`).replace(/\n{3,}/g, `
|
|
2946
2950
|
|
|
2947
2951
|
`);
|
|
2948
2952
|
}
|
|
2949
2953
|
function Gn(o) {
|
|
2950
2954
|
const a = [`# ${t.site?.title ?? t.title}`, ""];
|
|
2951
|
-
for (const
|
|
2952
|
-
a.push(`## ${
|
|
2953
|
-
const w =
|
|
2954
|
-
w && a.push(`URL: ${w}`, ""), a.push(
|
|
2955
|
+
for (const g of o) {
|
|
2956
|
+
a.push(`## ${g.frontmatter.title}`, "");
|
|
2957
|
+
const w = xt(g.effectivePath);
|
|
2958
|
+
w && a.push(`URL: ${w}`, ""), a.push(g.rawText.trim(), "");
|
|
2955
2959
|
}
|
|
2956
2960
|
return a.join(`
|
|
2957
2961
|
`).replace(/\n{3,}/g, `
|
|
@@ -2959,49 +2963,49 @@ ${P.join(`
|
|
|
2959
2963
|
`);
|
|
2960
2964
|
}
|
|
2961
2965
|
async function Vn() {
|
|
2962
|
-
const o = t.meta ?? {}, l = Ln().sort((
|
|
2963
|
-
for (const
|
|
2964
|
-
const
|
|
2965
|
-
await
|
|
2966
|
+
const o = t.meta ?? {}, l = Ln().sort((h, p) => h.effectivePath.localeCompare(p.effectivePath)), a = W(c, "index.html"), g = await it(a, "utf-8");
|
|
2967
|
+
for (const h of l) {
|
|
2968
|
+
const p = Un(h), y = g.replace("</head>", `${p}</head>`), x = h.effectivePath === "/" ? a : W(c, h.effectivePath.replace(/^\//, ""), "index.html");
|
|
2969
|
+
await Tt(G(x), { recursive: !0 }), await nt(x, y);
|
|
2966
2970
|
}
|
|
2967
2971
|
await nt(W(c, "robots.txt"), Jn());
|
|
2968
2972
|
const w = qn(l);
|
|
2969
2973
|
if (w && await nt(W(c, "sitemap.xml"), w), await nt(W(c, "llms.txt"), zn(l)), o.llms?.full && await nt(W(c, "llms-full.txt"), Gn(l)), o.webmanifest && await nt(W(c, "site.webmanifest"), JSON.stringify(o.webmanifest, null, 2) + `
|
|
2970
2974
|
`), o.humans && await nt(W(c, "humans.txt"), o.humans.trim() + `
|
|
2971
2975
|
`), o.security) {
|
|
2972
|
-
const
|
|
2973
|
-
|
|
2976
|
+
const h = o.security, p = [];
|
|
2977
|
+
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(`
|
|
2974
2978
|
`) + `
|
|
2975
2979
|
`));
|
|
2976
2980
|
}
|
|
2977
2981
|
}
|
|
2978
2982
|
async function Xn() {
|
|
2979
|
-
const o = [...r.values()].filter((
|
|
2980
|
-
for (const
|
|
2981
|
-
const
|
|
2982
|
-
l[
|
|
2983
|
-
const x = a.get(
|
|
2984
|
-
x.push(
|
|
2985
|
-
}
|
|
2986
|
-
const
|
|
2983
|
+
const o = [...r.values()].filter((p) => !ke(p.frontmatter) && yt(p)), l = {}, a = /* @__PURE__ */ new Map();
|
|
2984
|
+
for (const p of o) {
|
|
2985
|
+
const y = Xt(p);
|
|
2986
|
+
l[p.effectivePath] = { gate: p.frontmatter.gate, bundle: y };
|
|
2987
|
+
const x = a.get(y) ?? [];
|
|
2988
|
+
x.push(p), a.set(y, x);
|
|
2989
|
+
}
|
|
2990
|
+
const g = `/${t.paths.guarded}/`;
|
|
2987
2991
|
if (await nt(
|
|
2988
2992
|
W(c, "access.json"),
|
|
2989
|
-
JSON.stringify({ prefix:
|
|
2993
|
+
JSON.stringify({ prefix: g, routes: l }, null, 2) + `
|
|
2990
2994
|
`
|
|
2991
2995
|
), o.length === 0) return;
|
|
2992
|
-
const w = W(c, t.paths.guarded),
|
|
2993
|
-
for (const [
|
|
2994
|
-
const x = W(w,
|
|
2995
|
-
await
|
|
2996
|
-
const
|
|
2996
|
+
const w = W(c, t.paths.guarded), h = {};
|
|
2997
|
+
for (const [p, y] of a) {
|
|
2998
|
+
const x = W(w, p);
|
|
2999
|
+
await Tt(W(x, "body"), { recursive: !0 });
|
|
3000
|
+
const v = {}, P = y.map(($) => ({
|
|
2997
3001
|
slug: $.slug,
|
|
2998
3002
|
path: $.effectivePath,
|
|
2999
3003
|
type: $.type,
|
|
3000
3004
|
frontmatter: $.frontmatter,
|
|
3001
|
-
bundle:
|
|
3002
|
-
})),
|
|
3003
|
-
for (const $ of
|
|
3004
|
-
$.pageCss && (
|
|
3005
|
+
bundle: p
|
|
3006
|
+
})), O = [`${p}/manifest.json`, `${p}/search.json`];
|
|
3007
|
+
for (const $ of y) {
|
|
3008
|
+
$.pageCss && (v[$.effectivePath] = $.pageCss);
|
|
3005
3009
|
const N = {
|
|
3006
3010
|
html: $.html,
|
|
3007
3011
|
headings: $.headings,
|
|
@@ -3015,91 +3019,91 @@ ${P.join(`
|
|
|
3015
3019
|
dbmlSource: $.dbmlSource,
|
|
3016
3020
|
dbmlFile: $.dbmlFile,
|
|
3017
3021
|
dbmlError: $.dbmlError
|
|
3018
|
-
},
|
|
3019
|
-
await
|
|
3022
|
+
}, I = W(x, "body", `${At($.slug)}.json`);
|
|
3023
|
+
await Tt(G(I), { recursive: !0 }), await nt(I, JSON.stringify(N)), O.push(`${p}/body/${At($.slug)}.json`);
|
|
3020
3024
|
}
|
|
3021
3025
|
await nt(
|
|
3022
3026
|
W(x, "manifest.json"),
|
|
3023
|
-
JSON.stringify({ shells: P, styles:
|
|
3024
|
-
), await nt(W(x, "search.json"), JSON.stringify(
|
|
3025
|
-
pages: Object.fromEntries(
|
|
3026
|
-
files:
|
|
3027
|
+
JSON.stringify({ shells: P, styles: v, sidebar: Ve(!0) })
|
|
3028
|
+
), await nt(W(x, "search.json"), JSON.stringify(Xe(!0, y))), h[p] = {
|
|
3029
|
+
pages: Object.fromEntries(y.map(($) => [$.effectivePath, $.frontmatter.gate ?? ""])),
|
|
3030
|
+
files: O
|
|
3027
3031
|
};
|
|
3028
3032
|
}
|
|
3029
3033
|
await nt(
|
|
3030
3034
|
W(c, "guard.map.json"),
|
|
3031
|
-
JSON.stringify({ prefix:
|
|
3035
|
+
JSON.stringify({ prefix: g, routes: l, bundles: h }, null, 2) + `
|
|
3032
3036
|
`
|
|
3033
3037
|
);
|
|
3034
3038
|
}
|
|
3035
3039
|
function Yn(o, l) {
|
|
3036
3040
|
if (o.size === 0) return;
|
|
3037
|
-
const a = l.filter((w) => Kn(w.type)),
|
|
3038
|
-
for (const w of a)
|
|
3041
|
+
const a = l.filter((w) => Kn(w.type)), g = /* @__PURE__ */ new Map();
|
|
3042
|
+
for (const w of a) g.set(w.filePath, w);
|
|
3039
3043
|
for (const [, w] of o) {
|
|
3040
|
-
const
|
|
3041
|
-
if (typeof x == "string")
|
|
3044
|
+
const h = w[0], p = G(h.filePath), y = h.frontmatter.data, x = y?.issues ?? y?.entries, v = [];
|
|
3045
|
+
if (typeof x == "string") v.push(x);
|
|
3042
3046
|
else if (Array.isArray(x))
|
|
3043
|
-
for (const C of x) typeof C == "string" &&
|
|
3044
|
-
const P =
|
|
3045
|
-
for (const
|
|
3046
|
-
if (C.filePath !==
|
|
3047
|
+
for (const C of x) typeof C == "string" && v.push(C);
|
|
3048
|
+
const P = v.length ? v.map((C) => q(p, C)) : [p], O = a.filter((C) => {
|
|
3049
|
+
for (const F of P)
|
|
3050
|
+
if (C.filePath !== F && (C.filePath.startsWith(F + "/") || C.filePath.startsWith(F + "\\")))
|
|
3047
3051
|
return !0;
|
|
3048
3052
|
return !1;
|
|
3049
|
-
}), $ =
|
|
3053
|
+
}), $ = y?.changelog, N = [];
|
|
3050
3054
|
if (typeof $ == "string")
|
|
3051
|
-
N.push(q(
|
|
3055
|
+
N.push(q(p, $));
|
|
3052
3056
|
else if (Array.isArray($))
|
|
3053
|
-
for (const C of $) typeof C == "string" && N.push(q(
|
|
3054
|
-
const
|
|
3057
|
+
for (const C of $) typeof C == "string" && N.push(q(p, C));
|
|
3058
|
+
const I = /* @__PURE__ */ new Map();
|
|
3055
3059
|
for (const C of l) {
|
|
3056
3060
|
if (C.type !== "changelog" || N.length && !N.some(
|
|
3057
|
-
(
|
|
3061
|
+
(ut) => C.filePath === ut || C.filePath.startsWith(ut + "/") || C.filePath.startsWith(ut + "\\")
|
|
3058
3062
|
))
|
|
3059
3063
|
continue;
|
|
3060
|
-
const
|
|
3064
|
+
const F = C.frontmatter.data, E = F?.issue;
|
|
3061
3065
|
if (!E) continue;
|
|
3062
|
-
const
|
|
3063
|
-
if (!
|
|
3064
|
-
const z =
|
|
3066
|
+
const R = String(E).trim();
|
|
3067
|
+
if (!R) continue;
|
|
3068
|
+
const z = ze(C.filePath, R);
|
|
3065
3069
|
if (!z) continue;
|
|
3066
|
-
const
|
|
3067
|
-
if (!
|
|
3068
|
-
const
|
|
3069
|
-
let
|
|
3070
|
+
const V = g.get(z);
|
|
3071
|
+
if (!V) continue;
|
|
3072
|
+
const _ = String(F?.version ?? ""), B = Ge(F?.release_date), J = F?.status;
|
|
3073
|
+
let Z, X = !1;
|
|
3070
3074
|
if (typeof J == "string") {
|
|
3071
|
-
const
|
|
3072
|
-
if (["completes", "completed", "complete", "fixes", "closes", "resolves"].includes(
|
|
3073
|
-
|
|
3075
|
+
const ct = J.trim().toLowerCase();
|
|
3076
|
+
if (["completes", "completed", "complete", "fixes", "closes", "resolves"].includes(ct))
|
|
3077
|
+
X = !0;
|
|
3074
3078
|
else {
|
|
3075
|
-
const
|
|
3076
|
-
Number.isFinite(
|
|
3079
|
+
const ut = Number(ct.replace(/%$/, ""));
|
|
3080
|
+
Number.isFinite(ut) && (Z = ut);
|
|
3077
3081
|
}
|
|
3078
|
-
} else typeof J == "number" && (
|
|
3079
|
-
const
|
|
3080
|
-
|
|
3081
|
-
version:
|
|
3082
|
-
title: String(
|
|
3083
|
-
description:
|
|
3084
|
-
releaseDate:
|
|
3085
|
-
progress:
|
|
3086
|
-
completes:
|
|
3082
|
+
} else typeof J == "number" && (Z = J);
|
|
3083
|
+
const Y = I.get(V.filePath) ?? [];
|
|
3084
|
+
Y.push({
|
|
3085
|
+
version: _,
|
|
3086
|
+
title: String(F?.title ?? C.frontmatter.title),
|
|
3087
|
+
description: F?.description !== void 0 ? String(F.description) : void 0,
|
|
3088
|
+
releaseDate: B,
|
|
3089
|
+
progress: Z,
|
|
3090
|
+
completes: X,
|
|
3087
3091
|
path: C.effectivePath,
|
|
3088
|
-
slug:
|
|
3089
|
-
entrySlug: `${C.effectivePath}#${
|
|
3090
|
-
}),
|
|
3092
|
+
slug: _ ? `v${_}` : "unreleased",
|
|
3093
|
+
entrySlug: `${C.effectivePath}#${_ ? `v${_}` : "unreleased"}`
|
|
3094
|
+
}), I.set(V.filePath, Y);
|
|
3091
3095
|
}
|
|
3092
|
-
const U =
|
|
3093
|
-
const
|
|
3096
|
+
const U = O.map((C) => {
|
|
3097
|
+
const F = C.frontmatter.data, E = C.type, R = Ge(F?.date ?? F?.target_date);
|
|
3094
3098
|
let z;
|
|
3095
|
-
const
|
|
3096
|
-
if (typeof
|
|
3097
|
-
const
|
|
3098
|
-
|
|
3099
|
+
const V = F?.parent;
|
|
3100
|
+
if (typeof V == "string" && V.trim()) {
|
|
3101
|
+
const Y = ze(C.filePath, V.trim());
|
|
3102
|
+
Y && g.has(Y) && (z = g.get(Y).effectivePath);
|
|
3099
3103
|
}
|
|
3100
|
-
const
|
|
3101
|
-
(
|
|
3102
|
-
),
|
|
3104
|
+
const _ = (I.get(C.filePath) ?? []).slice().sort(
|
|
3105
|
+
(Y, ct) => (Y.releaseDate ?? "").localeCompare(ct.releaseDate ?? "")
|
|
3106
|
+
), B = _.some((Y) => Y.completes), J = String(F?.status ?? "").toLowerCase(), Z = J === "shipped" || J === "in_progress" || J === "planned" ? J : B ? "shipped" : _.length ? "in_progress" : "planned", X = _.reduce((Y, ct) => typeof ct.progress == "number" ? Math.max(Y ?? 0, ct.progress) : Y, void 0);
|
|
3103
3107
|
return {
|
|
3104
3108
|
kind: E,
|
|
3105
3109
|
slug: C.slug,
|
|
@@ -3107,18 +3111,18 @@ ${P.join(`
|
|
|
3107
3111
|
href: C.effectivePath,
|
|
3108
3112
|
title: C.frontmatter.title,
|
|
3109
3113
|
description: C.frontmatter.description,
|
|
3110
|
-
targetDate:
|
|
3114
|
+
targetDate: R,
|
|
3111
3115
|
parent: z,
|
|
3112
|
-
progress:
|
|
3113
|
-
status:
|
|
3114
|
-
hidden:
|
|
3116
|
+
progress: X,
|
|
3117
|
+
status: Z,
|
|
3118
|
+
hidden: ne(C.frontmatter),
|
|
3115
3119
|
html: C.html,
|
|
3116
3120
|
headings: C.headings,
|
|
3117
3121
|
data: C.frontmatter.data,
|
|
3118
|
-
changelog:
|
|
3122
|
+
changelog: _
|
|
3119
3123
|
};
|
|
3120
3124
|
});
|
|
3121
|
-
U.sort((C,
|
|
3125
|
+
U.sort((C, F) => (C.targetDate ?? "").localeCompare(F.targetDate ?? "")), h.roadmapEntries = U, h.headings = U.map((C) => ({
|
|
3122
3126
|
level: 2,
|
|
3123
3127
|
text: C.title,
|
|
3124
3128
|
slug: C.slug
|
|
@@ -3128,11 +3132,11 @@ ${P.join(`
|
|
|
3128
3132
|
function Kn(o) {
|
|
3129
3133
|
return o === "milestone" || o === "epic" || o === "feature" || o === "bug";
|
|
3130
3134
|
}
|
|
3131
|
-
function
|
|
3132
|
-
const a =
|
|
3135
|
+
function ze(o, l) {
|
|
3136
|
+
const a = G(o), g = l.replace(/\\/g, "/").trim(), w = g.endsWith(".md") ? g : `${g}.md`;
|
|
3133
3137
|
return q(a, w);
|
|
3134
3138
|
}
|
|
3135
|
-
function
|
|
3139
|
+
function Ge(o) {
|
|
3136
3140
|
if (o == null) return;
|
|
3137
3141
|
if (o instanceof Date) return o.toISOString();
|
|
3138
3142
|
const l = String(o).trim();
|
|
@@ -3141,255 +3145,256 @@ ${P.join(`
|
|
|
3141
3145
|
if (!Number.isNaN(a.getTime()))
|
|
3142
3146
|
return a.toISOString();
|
|
3143
3147
|
}
|
|
3144
|
-
function
|
|
3148
|
+
function he(o, l) {
|
|
3145
3149
|
if (!o || !/\.svg$/i.test(o.trim())) return o;
|
|
3146
|
-
const a = o.trim(),
|
|
3150
|
+
const a = o.trim(), g = a.startsWith("/") ? W(n, a) : q(G(l), a);
|
|
3147
3151
|
try {
|
|
3148
|
-
return
|
|
3152
|
+
return zt(g, "utf8").trim();
|
|
3149
3153
|
} catch {
|
|
3150
3154
|
console.warn(`[nimpress] sidebar icon ${a} referenced from ${l} is not readable`);
|
|
3151
3155
|
return;
|
|
3152
3156
|
}
|
|
3153
3157
|
}
|
|
3154
|
-
function
|
|
3158
|
+
function Ve(o = !1) {
|
|
3155
3159
|
const l = { children: /* @__PURE__ */ new Map() }, a = /* @__PURE__ */ new Map();
|
|
3156
|
-
for (const
|
|
3157
|
-
if (
|
|
3158
|
-
const
|
|
3159
|
-
if (
|
|
3160
|
-
const
|
|
3161
|
-
if (
|
|
3162
|
-
const $ = "/" +
|
|
3160
|
+
for (const h of r.values()) {
|
|
3161
|
+
if (u && (Dt(h.frontmatter) || !o && yt(h))) continue;
|
|
3162
|
+
const p = h.frontmatter.sidebar;
|
|
3163
|
+
if (h.effectivePath === "/" && !p?.name) continue;
|
|
3164
|
+
const y = h.effectivePath === "/" ? [p.path ?? p.name] : h.effectivePath.split("/").filter(Boolean), x = h.filePath.endsWith(`${kt}index.md`);
|
|
3165
|
+
if (p?.name && x) {
|
|
3166
|
+
const $ = "/" + y.join("/");
|
|
3163
3167
|
a.set($, {
|
|
3164
|
-
label:
|
|
3165
|
-
icon:
|
|
3166
|
-
style:
|
|
3168
|
+
label: p.name,
|
|
3169
|
+
icon: he(p.icon, h.filePath) ?? a.get($)?.icon,
|
|
3170
|
+
style: p.style ?? a.get($)?.style
|
|
3167
3171
|
});
|
|
3168
3172
|
}
|
|
3169
|
-
if (
|
|
3170
|
-
const
|
|
3171
|
-
|
|
3172
|
-
let P = l,
|
|
3173
|
-
for (const $ of
|
|
3174
|
-
|
|
3173
|
+
if (h.sidebarOnly && !h.linkTo) continue;
|
|
3174
|
+
const v = x ? void 0 : p?.path ?? p?.name;
|
|
3175
|
+
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 P = l, O = "";
|
|
3177
|
+
for (const $ of y) {
|
|
3178
|
+
O = O + "/" + $;
|
|
3175
3179
|
let N = P.children.get($);
|
|
3176
|
-
N || (N = { segment: $, fullPath:
|
|
3180
|
+
N || (N = { segment: $, fullPath: O, children: /* @__PURE__ */ new Map() }, P.children.set($, N)), P = N;
|
|
3177
3181
|
}
|
|
3178
|
-
if (P.page =
|
|
3179
|
-
const $ = "/" +
|
|
3182
|
+
if (P.page = h, !x && p?.name) {
|
|
3183
|
+
const $ = "/" + y.slice(0, -1).join("/");
|
|
3180
3184
|
a.set($, {
|
|
3181
|
-
label:
|
|
3182
|
-
icon:
|
|
3183
|
-
style:
|
|
3185
|
+
label: p.name,
|
|
3186
|
+
icon: he(p.icon, h.filePath) ?? a.get($)?.icon,
|
|
3187
|
+
style: p.style ?? a.get($)?.style
|
|
3184
3188
|
});
|
|
3185
3189
|
}
|
|
3186
3190
|
}
|
|
3187
|
-
function h
|
|
3188
|
-
const
|
|
3189
|
-
for (const
|
|
3190
|
-
if (
|
|
3191
|
-
const
|
|
3192
|
-
text: Dr(
|
|
3193
|
-
link:
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3191
|
+
function g(h) {
|
|
3192
|
+
const p = [];
|
|
3193
|
+
for (const v of h.children.values()) p.push(g(v));
|
|
3194
|
+
if (Oe(p), h.page) {
|
|
3195
|
+
const v = {
|
|
3196
|
+
text: Dr(h.page),
|
|
3197
|
+
link: h.page.linkTo ?? h.page.effectivePath,
|
|
3198
|
+
external: h.page.linkTo ? !0 : void 0,
|
|
3199
|
+
slug: h.page.slug,
|
|
3200
|
+
gate: h.page.frontmatter.gate,
|
|
3201
|
+
order: h.page.frontmatter.order,
|
|
3202
|
+
collapsed: h.page.frontmatter.collapsed,
|
|
3203
|
+
hidden: ne(h.page.frontmatter)
|
|
3204
|
+
}, P = a.get(h.fullPath);
|
|
3205
|
+
P?.label && (v.text = P.label), P?.icon && !v.icon && (v.icon = P.icon), P?.style && (v.style = P.style);
|
|
3206
|
+
const O = h.page.openApiSpec;
|
|
3207
|
+
if (h.page.type === "openapi" && O?.tags?.length) {
|
|
3208
|
+
const $ = O.tags.map((N) => ({
|
|
3204
3209
|
text: N.name,
|
|
3205
|
-
link: `${
|
|
3206
|
-
slug: `${
|
|
3210
|
+
link: `${h.page.effectivePath}#tag/${N.name}`,
|
|
3211
|
+
slug: `${h.page.slug}__tag__${N.name}`
|
|
3207
3212
|
}));
|
|
3208
|
-
|
|
3209
|
-
} else if (
|
|
3210
|
-
const $ =
|
|
3213
|
+
v.items = [...$, ...p];
|
|
3214
|
+
} else if (h.page.type === "changelog" && h.page.changelogEntries?.length) {
|
|
3215
|
+
const $ = h.page.changelogEntries.map((N, I) => ({
|
|
3211
3216
|
text: N.version ? `v${N.version}` : N.title || "unreleased",
|
|
3212
|
-
link: `${
|
|
3213
|
-
slug: `${
|
|
3217
|
+
link: `${h.page.effectivePath}#${N.slug}`,
|
|
3218
|
+
slug: `${h.page.slug}__${N.slug}`,
|
|
3214
3219
|
hidden: N.hidden,
|
|
3215
|
-
order:
|
|
3220
|
+
order: I
|
|
3216
3221
|
}));
|
|
3217
|
-
|
|
3218
|
-
} else if (
|
|
3219
|
-
const $ =
|
|
3220
|
-
(
|
|
3221
|
-
), N = new Map($.map((
|
|
3222
|
-
for (const
|
|
3223
|
-
if (
|
|
3224
|
-
const z =
|
|
3225
|
-
z.push(
|
|
3222
|
+
v.items = p.length ? [...$, ...p] : $;
|
|
3223
|
+
} else if (h.page.type === "roadmap" && h.page.roadmapEntries?.length) {
|
|
3224
|
+
const $ = h.page.roadmapEntries.slice().sort(
|
|
3225
|
+
(R, z) => (R.targetDate ?? "").localeCompare(z.targetDate ?? "")
|
|
3226
|
+
), N = new Map($.map((R) => [R.href, R])), I = /* @__PURE__ */ new Map(), U = [];
|
|
3227
|
+
for (const R of $)
|
|
3228
|
+
if (R.parent && N.has(R.parent)) {
|
|
3229
|
+
const z = I.get(R.parent) ?? [];
|
|
3230
|
+
z.push(R), I.set(R.parent, z);
|
|
3226
3231
|
} else
|
|
3227
|
-
U.push(
|
|
3228
|
-
const C = (
|
|
3229
|
-
const
|
|
3230
|
-
text:
|
|
3231
|
-
link:
|
|
3232
|
-
slug:
|
|
3233
|
-
icon: mr[
|
|
3234
|
-
hidden:
|
|
3232
|
+
U.push(R);
|
|
3233
|
+
const C = (R, z) => {
|
|
3234
|
+
const V = I.get(R.href) ?? [], _ = {
|
|
3235
|
+
text: R.title,
|
|
3236
|
+
link: R.href,
|
|
3237
|
+
slug: R.slug,
|
|
3238
|
+
icon: mr[R.kind],
|
|
3239
|
+
hidden: R.hidden,
|
|
3235
3240
|
order: z
|
|
3236
3241
|
};
|
|
3237
|
-
return
|
|
3238
|
-
},
|
|
3239
|
-
|
|
3240
|
-
} else if (
|
|
3242
|
+
return V.length && (_.items = V.map((B, J) => C(B, J))), _;
|
|
3243
|
+
}, F = U.map((R, z) => C(R, z)), E = p.filter((R) => !R.slug || !$.some((z) => z.slug === R.slug));
|
|
3244
|
+
v.items = E.length ? [...F, ...E] : F;
|
|
3245
|
+
} else if (h.page.type === "component") {
|
|
3241
3246
|
const $ = {
|
|
3242
3247
|
text: "Overview",
|
|
3243
|
-
link:
|
|
3244
|
-
slug: `${
|
|
3248
|
+
link: h.page.effectivePath,
|
|
3249
|
+
slug: `${h.page.slug}__doc`,
|
|
3245
3250
|
order: -1
|
|
3246
|
-
}, N = (
|
|
3247
|
-
text:
|
|
3248
|
-
link: `${
|
|
3249
|
-
slug: `${
|
|
3250
|
-
icon:
|
|
3251
|
-
style:
|
|
3251
|
+
}, N = (h.page.componentData?.stories ?? []).map((I, U) => ({
|
|
3252
|
+
text: I.sidebar?.name ?? I.name,
|
|
3253
|
+
link: `${h.page.effectivePath}/${Pe(I.name)}`,
|
|
3254
|
+
slug: `${h.page.slug}__story__${Pe(I.name)}`,
|
|
3255
|
+
icon: he(I.sidebar?.icon, h.page.filePath),
|
|
3256
|
+
style: I.sidebar?.style,
|
|
3252
3257
|
order: U
|
|
3253
3258
|
}));
|
|
3254
|
-
|
|
3255
|
-
} else
|
|
3256
|
-
return
|
|
3259
|
+
v.text = se(h.segment), v.items = [$, ...N, ...p], v.collapsed = !0;
|
|
3260
|
+
} else p.length && (v.items = p);
|
|
3261
|
+
return v.collapsed !== !1 && v.items?.some(($) => $.collapsed === !1) && (v.collapsed = !1), v;
|
|
3257
3262
|
}
|
|
3258
|
-
const
|
|
3259
|
-
text:
|
|
3260
|
-
slug:
|
|
3263
|
+
const y = a.get(h.fullPath), x = {
|
|
3264
|
+
text: y?.label ?? se(h.segment),
|
|
3265
|
+
slug: h.fullPath.replace(/^\//, "")
|
|
3261
3266
|
};
|
|
3262
|
-
if (
|
|
3263
|
-
x.items =
|
|
3264
|
-
let
|
|
3265
|
-
for (const P of
|
|
3266
|
-
P.order !== void 0 && P.order <
|
|
3267
|
-
|
|
3267
|
+
if (y?.icon && (x.icon = y.icon), y?.style && (x.style = y.style), p.length) {
|
|
3268
|
+
x.items = p;
|
|
3269
|
+
let v = Number.MAX_SAFE_INTEGER;
|
|
3270
|
+
for (const P of p)
|
|
3271
|
+
P.order !== void 0 && P.order < v && (v = P.order);
|
|
3272
|
+
v !== Number.MAX_SAFE_INTEGER && (x.order = v);
|
|
3268
3273
|
}
|
|
3269
|
-
return x.items?.some((
|
|
3274
|
+
return x.items?.some((v) => v.collapsed === !1) && (x.collapsed = !1), x;
|
|
3270
3275
|
}
|
|
3271
3276
|
const w = [];
|
|
3272
|
-
for (const
|
|
3273
|
-
return
|
|
3277
|
+
for (const h of l.children.values()) w.push(g(h));
|
|
3278
|
+
return Oe(w), w;
|
|
3274
3279
|
}
|
|
3275
3280
|
function Zn() {
|
|
3276
3281
|
const o = {}, l = {};
|
|
3277
|
-
for (const [
|
|
3278
|
-
if (
|
|
3279
|
-
const
|
|
3280
|
-
slug:
|
|
3282
|
+
for (const [g, w] of r) {
|
|
3283
|
+
if (u && (Dt(w.frontmatter) || yt(w)) || w.sidebarOnly) continue;
|
|
3284
|
+
const h = {
|
|
3285
|
+
slug: g,
|
|
3281
3286
|
path: w.effectivePath,
|
|
3282
3287
|
type: w.type,
|
|
3283
3288
|
title: w.frontmatter.title,
|
|
3284
3289
|
gate: w.frontmatter.gate,
|
|
3285
|
-
bundle: yt(w) ?
|
|
3290
|
+
bundle: yt(w) ? Xt(w) : void 0,
|
|
3286
3291
|
description: w.frontmatter.description,
|
|
3287
3292
|
order: w.frontmatter.order,
|
|
3288
|
-
hidden:
|
|
3293
|
+
hidden: ne(w.frontmatter),
|
|
3289
3294
|
redirect: w.frontmatter.redirect,
|
|
3290
3295
|
meta: w.frontmatter.meta
|
|
3291
3296
|
};
|
|
3292
|
-
if (o[
|
|
3293
|
-
for (const
|
|
3294
|
-
l[`${w.effectivePath}/${
|
|
3297
|
+
if (o[g] = h, l[w.effectivePath] = g, w.type === "component")
|
|
3298
|
+
for (const p of w.componentData?.stories ?? [])
|
|
3299
|
+
l[`${w.effectivePath}/${Pe(p.name)}`] = g;
|
|
3295
3300
|
}
|
|
3296
3301
|
const a = {};
|
|
3297
|
-
for (const
|
|
3298
|
-
|
|
3299
|
-
return { pages: o, byPath: l, sidebar:
|
|
3300
|
-
}
|
|
3301
|
-
function
|
|
3302
|
-
const a = [],
|
|
3303
|
-
for (const [w,
|
|
3304
|
-
if (
|
|
3302
|
+
for (const g of r.values())
|
|
3303
|
+
g.sidebarOnly || u && (Dt(g.frontmatter) || yt(g)) || g.pageCss && (a[g.effectivePath] = g.pageCss);
|
|
3304
|
+
return { pages: o, byPath: l, sidebar: Ve(), styles: a };
|
|
3305
|
+
}
|
|
3306
|
+
function Xe(o = !1, l) {
|
|
3307
|
+
const a = [], g = l ? l.map((w) => [w.slug, w]) : r;
|
|
3308
|
+
for (const [w, h] of g) {
|
|
3309
|
+
if (h.sidebarOnly) continue;
|
|
3305
3310
|
if (o) {
|
|
3306
|
-
if (Dt(
|
|
3307
|
-
} else if (
|
|
3308
|
-
const
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
...(
|
|
3312
|
-
].filter(Boolean).join(" ") : "", P =
|
|
3311
|
+
if (Dt(h.frontmatter) || !yt(h)) continue;
|
|
3312
|
+
} else if (u && (Dt(h.frontmatter) || yt(h))) continue;
|
|
3313
|
+
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
|
+
h.componentData.component,
|
|
3315
|
+
h.componentData.system,
|
|
3316
|
+
...(h.componentData.stories ?? []).flatMap(($) => [$.name, $.file])
|
|
3317
|
+
].filter(Boolean).join(" ") : "", P = h.dbmlSource ? h.dbmlSource.replace(/[{}\[\]'"`,]/g, " ") : "", O = [p, y, x, v, P].filter(Boolean).join(`
|
|
3313
3318
|
`);
|
|
3314
3319
|
a.push({
|
|
3315
3320
|
slug: w,
|
|
3316
|
-
path:
|
|
3317
|
-
title:
|
|
3318
|
-
description:
|
|
3319
|
-
body:
|
|
3320
|
-
gate:
|
|
3321
|
-
headings:
|
|
3321
|
+
path: h.effectivePath,
|
|
3322
|
+
title: h.frontmatter.title,
|
|
3323
|
+
description: h.frontmatter.description,
|
|
3324
|
+
body: O,
|
|
3325
|
+
gate: h.frontmatter.gate,
|
|
3326
|
+
headings: h.headings.map(($) => $.text),
|
|
3322
3327
|
tags: [
|
|
3323
|
-
...
|
|
3324
|
-
...
|
|
3328
|
+
...ge(h.frontmatter.tags),
|
|
3329
|
+
...h.componentData ? [h.componentData.component] : []
|
|
3325
3330
|
]
|
|
3326
3331
|
});
|
|
3327
3332
|
}
|
|
3328
3333
|
return a;
|
|
3329
3334
|
}
|
|
3330
|
-
function
|
|
3335
|
+
function Ye(o) {
|
|
3331
3336
|
return o ? o.replace(/<[^>]+>/g, " ").replace(/&[a-z]+;/gi, " ") : "";
|
|
3332
3337
|
}
|
|
3333
3338
|
function Qn(o) {
|
|
3334
3339
|
if (!o || typeof o != "object") return "";
|
|
3335
|
-
const l = o, a = [],
|
|
3336
|
-
if (
|
|
3337
|
-
const x = typeof
|
|
3340
|
+
const l = o, a = [], g = /* @__PURE__ */ new WeakSet(), w = 12, h = (p, y) => {
|
|
3341
|
+
if (p == null || y > w) return;
|
|
3342
|
+
const x = typeof p;
|
|
3338
3343
|
if (x === "string") {
|
|
3339
|
-
const
|
|
3340
|
-
|
|
3344
|
+
const v = p.trim();
|
|
3345
|
+
v && a.push(v);
|
|
3341
3346
|
return;
|
|
3342
3347
|
}
|
|
3343
3348
|
if (x === "number" || x === "boolean") {
|
|
3344
|
-
a.push(String(
|
|
3349
|
+
a.push(String(p));
|
|
3345
3350
|
return;
|
|
3346
3351
|
}
|
|
3347
|
-
if (x === "object" && !
|
|
3348
|
-
if (
|
|
3349
|
-
for (const
|
|
3352
|
+
if (x === "object" && !g.has(p)) {
|
|
3353
|
+
if (g.add(p), Array.isArray(p)) {
|
|
3354
|
+
for (const v of p) h(v, y + 1);
|
|
3350
3355
|
return;
|
|
3351
3356
|
}
|
|
3352
|
-
for (const [
|
|
3353
|
-
if (
|
|
3354
|
-
typeof P == "string" && a.push(
|
|
3357
|
+
for (const [v, P] of Object.entries(p)) {
|
|
3358
|
+
if (v === "description_html" || v === "summary_html" || v === "requestBodyHtml") {
|
|
3359
|
+
typeof P == "string" && a.push(Ye(P));
|
|
3355
3360
|
continue;
|
|
3356
3361
|
}
|
|
3357
|
-
a.push(
|
|
3362
|
+
a.push(v), h(P, y + 1);
|
|
3358
3363
|
}
|
|
3359
3364
|
}
|
|
3360
3365
|
};
|
|
3361
3366
|
l.title && a.push(l.title), l.description && a.push(l.description);
|
|
3362
|
-
for (const
|
|
3363
|
-
|
|
3364
|
-
for (const [
|
|
3365
|
-
a.push(
|
|
3366
|
-
for (const
|
|
3367
|
-
|
|
3368
|
-
for (const
|
|
3369
|
-
const x =
|
|
3370
|
-
x.method && a.push(x.method.toLowerCase(), x.method.toUpperCase()), y
|
|
3367
|
+
for (const p of l.servers ?? [])
|
|
3368
|
+
p.url && a.push(p.url), p.description && a.push(p.description);
|
|
3369
|
+
for (const [p, y] of Object.entries(l.securitySchemes ?? {}))
|
|
3370
|
+
a.push(p), h(y, 0);
|
|
3371
|
+
for (const p of l.tags ?? []) {
|
|
3372
|
+
p.name && a.push(p.name), p.description && a.push(p.description);
|
|
3373
|
+
for (const y of p.operations ?? []) {
|
|
3374
|
+
const x = y;
|
|
3375
|
+
x.method && a.push(x.method.toLowerCase(), x.method.toUpperCase()), h(y, 0);
|
|
3371
3376
|
}
|
|
3372
3377
|
}
|
|
3373
|
-
for (const [
|
|
3374
|
-
a.push(
|
|
3378
|
+
for (const [p, y] of Object.entries(l.schemas ?? {}))
|
|
3379
|
+
a.push(p), h(y, 0);
|
|
3375
3380
|
return a.join(`
|
|
3376
3381
|
`);
|
|
3377
3382
|
}
|
|
3378
3383
|
function ts(o) {
|
|
3379
3384
|
const l = [];
|
|
3380
3385
|
for (const a of o) {
|
|
3381
|
-
l.push(a.slug, a.kind, a.title), a.description && l.push(a.description), a.targetDate && l.push(a.targetDate), a.html && l.push(
|
|
3382
|
-
for (const
|
|
3383
|
-
l.push(
|
|
3386
|
+
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
|
+
for (const g of a.changelog)
|
|
3388
|
+
l.push(g.version, g.title), g.description && l.push(g.description), g.releaseDate && l.push(g.releaseDate);
|
|
3384
3389
|
}
|
|
3385
3390
|
return l.join(`
|
|
3386
3391
|
`);
|
|
3387
3392
|
}
|
|
3388
|
-
function
|
|
3393
|
+
function ge(o) {
|
|
3389
3394
|
if (!o) return [];
|
|
3390
3395
|
const l = Array.isArray(o) ? o : String(o).split(","), a = [];
|
|
3391
|
-
for (const
|
|
3392
|
-
const w = String(
|
|
3396
|
+
for (const g of l) {
|
|
3397
|
+
const w = String(g).trim();
|
|
3393
3398
|
w && a.push(w);
|
|
3394
3399
|
}
|
|
3395
3400
|
return a;
|
|
@@ -3397,27 +3402,27 @@ ${P.join(`
|
|
|
3397
3402
|
function At(o) {
|
|
3398
3403
|
return o === "" ? "__root__" : o;
|
|
3399
3404
|
}
|
|
3400
|
-
function
|
|
3405
|
+
function Ke(o) {
|
|
3401
3406
|
return o === "__root__" ? "" : o;
|
|
3402
3407
|
}
|
|
3403
|
-
function
|
|
3404
|
-
for (const l of [
|
|
3408
|
+
function Yt(o) {
|
|
3409
|
+
for (const l of [Zt, Qt, te, ee]) {
|
|
3405
3410
|
const a = o.moduleGraph.getModuleById("\0" + l);
|
|
3406
3411
|
a && o.moduleGraph.invalidateModule(a);
|
|
3407
3412
|
}
|
|
3408
3413
|
}
|
|
3409
|
-
function
|
|
3414
|
+
function ye(o) {
|
|
3410
3415
|
for (const l of r.keys()) {
|
|
3411
|
-
const a =
|
|
3412
|
-
w && o.moduleGraph.invalidateModule(w),
|
|
3416
|
+
const a = _t + At(l) + ".js", g = Ft + At(l) + ".svelte", w = o.moduleGraph.getModuleById(a), h = o.moduleGraph.getModuleById(g);
|
|
3417
|
+
w && o.moduleGraph.invalidateModule(w), h && o.moduleGraph.invalidateModule(h);
|
|
3413
3418
|
}
|
|
3414
3419
|
}
|
|
3415
3420
|
function es() {
|
|
3416
3421
|
const o = [];
|
|
3417
3422
|
for (const [l, a] of r) {
|
|
3418
|
-
if (a.sidebarOnly ||
|
|
3419
|
-
const
|
|
3420
|
-
o.push(` ${JSON.stringify(l)}: () => import(${JSON.stringify(
|
|
3423
|
+
if (a.sidebarOnly || u && (Dt(a.frontmatter) || yt(a))) continue;
|
|
3424
|
+
const g = `${Ft}${At(l)}.svelte`;
|
|
3425
|
+
o.push(` ${JSON.stringify(l)}: () => import(${JSON.stringify(g)})`);
|
|
3421
3426
|
}
|
|
3422
3427
|
return `export const pages = {
|
|
3423
3428
|
${o.join(`,
|
|
@@ -3429,9 +3434,9 @@ export default pages
|
|
|
3429
3434
|
function ns() {
|
|
3430
3435
|
const o = [];
|
|
3431
3436
|
for (const [l, a] of r) {
|
|
3432
|
-
if (a.sidebarOnly ||
|
|
3433
|
-
const
|
|
3434
|
-
o.push(` ${JSON.stringify(l)}: () => import(${JSON.stringify(
|
|
3437
|
+
if (a.sidebarOnly || u && (Dt(a.frontmatter) || yt(a))) continue;
|
|
3438
|
+
const g = `${_t}${At(l)}.js`;
|
|
3439
|
+
o.push(` ${JSON.stringify(l)}: () => import(${JSON.stringify(g)})`);
|
|
3435
3440
|
}
|
|
3436
3441
|
return `export const bodies = {
|
|
3437
3442
|
${o.join(`,
|
|
@@ -3468,14 +3473,14 @@ export default bodies
|
|
|
3468
3473
|
path: l.effectivePath,
|
|
3469
3474
|
type: l.type,
|
|
3470
3475
|
frontmatter: l.frontmatter
|
|
3471
|
-
},
|
|
3476
|
+
}, g = `${_t}${At(o)}.js`;
|
|
3472
3477
|
return `<script lang="ts">
|
|
3473
3478
|
import { Page, OpenApiRoot, ChangelogPage, HeroPage, RoadmapPage, ComponentPage, DbmlPage, setPageMeta, applyPageStyles } from '@nimtech/nimpress'
|
|
3474
3479
|
import type { PageBody } from '@nimtech/nimpress'
|
|
3475
3480
|
const shell = ${JSON.stringify(a).replace(/<\/script>/g, "<\\/script>")}
|
|
3476
3481
|
setPageMeta(shell)
|
|
3477
3482
|
applyPageStyles(shell.path)
|
|
3478
|
-
const bodyPromise: Promise<{ default: PageBody }> = import(${JSON.stringify(
|
|
3483
|
+
const bodyPromise: Promise<{ default: PageBody }> = import(${JSON.stringify(g)})
|
|
3479
3484
|
<\/script>
|
|
3480
3485
|
|
|
3481
3486
|
{#if shell.type === 'hero'}
|
|
@@ -3509,83 +3514,83 @@ export default bodies
|
|
|
3509
3514
|
return t = (await Ws(process.cwd(), e)).resolved, n = q(process.cwd(), t.contentDir), s = q(process.cwd(), t.assetsDir), {};
|
|
3510
3515
|
},
|
|
3511
3516
|
configResolved(o) {
|
|
3512
|
-
|
|
3517
|
+
u = o.command === "build", c = q(o.root, o.build.outDir);
|
|
3513
3518
|
},
|
|
3514
3519
|
async buildStart() {
|
|
3515
|
-
await
|
|
3520
|
+
await at(), u && Nt();
|
|
3516
3521
|
},
|
|
3517
3522
|
async closeBundle(o) {
|
|
3518
|
-
if (!
|
|
3523
|
+
if (!u || o) return;
|
|
3519
3524
|
const l = W(c, "index.html"), a = W(c, "404.html");
|
|
3520
|
-
if (await rs(l, a), await nt(W(c, ".nojekyll"), ""),
|
|
3525
|
+
if (await rs(l, a), await nt(W(c, ".nojekyll"), ""), dt(n) && await Ze(n, c, {
|
|
3521
3526
|
recursive: !0,
|
|
3522
|
-
filter: (
|
|
3527
|
+
filter: (g) => {
|
|
3523
3528
|
try {
|
|
3524
|
-
return
|
|
3529
|
+
return ie(g).isDirectory() || !(g.endsWith(".md") || g.endsWith(".css"));
|
|
3525
3530
|
} catch {
|
|
3526
3531
|
return !1;
|
|
3527
3532
|
}
|
|
3528
3533
|
}
|
|
3529
|
-
}),
|
|
3530
|
-
const
|
|
3531
|
-
await Ze(s,
|
|
3534
|
+
}), dt(s)) {
|
|
3535
|
+
const g = W(c, t.assetUrlBase.replace(/^\//, ""));
|
|
3536
|
+
await Ze(s, g, { recursive: !0 });
|
|
3532
3537
|
}
|
|
3533
|
-
for (const [
|
|
3534
|
-
const
|
|
3535
|
-
await
|
|
3538
|
+
for (const [g, w] of St) {
|
|
3539
|
+
const h = W(c, g.replace(/^\//, ""));
|
|
3540
|
+
await Tt(G(h), { recursive: !0 }), await nt(h, w);
|
|
3536
3541
|
}
|
|
3537
|
-
await nt(W(c, "subscribe.map.json"),
|
|
3542
|
+
await nt(W(c, "subscribe.map.json"), me), await Vn(), await Xn();
|
|
3538
3543
|
},
|
|
3539
3544
|
configureServer(o) {
|
|
3540
|
-
|
|
3541
|
-
for (const
|
|
3542
|
-
for (const
|
|
3543
|
-
const l = async (
|
|
3544
|
-
if (!(!
|
|
3545
|
-
|
|
3545
|
+
b = o, o.watcher.add(n), o.watcher.add(s);
|
|
3546
|
+
for (const p of S) o.watcher.add(p);
|
|
3547
|
+
for (const p of j) o.watcher.add(p);
|
|
3548
|
+
const l = async (p) => {
|
|
3549
|
+
if (!(!p.startsWith(n) || !(p.endsWith(".md") || p.endsWith(".css") || p.match(/\.story\.tsx?$/)))) {
|
|
3550
|
+
p.endsWith(".css") && pt(p.replace(/\.css$/, ".md")), p.match(/\.story\.tsx?$/) && pt(W(G(p), "index.md"));
|
|
3546
3551
|
try {
|
|
3547
|
-
await
|
|
3552
|
+
await at();
|
|
3548
3553
|
} catch (x) {
|
|
3549
3554
|
o.config.logger.error(String(x));
|
|
3550
3555
|
return;
|
|
3551
3556
|
}
|
|
3552
|
-
|
|
3557
|
+
Yt(o), ye(o), Nt(), o.ws.send({ type: "full-reload" });
|
|
3553
3558
|
}
|
|
3554
|
-
}, a = async (
|
|
3555
|
-
if (
|
|
3556
|
-
|
|
3559
|
+
}, a = async (p) => {
|
|
3560
|
+
if (p.startsWith(n) && (p.endsWith(".md") || p.endsWith(".css") || p.match(/\.story\.tsx?$/))) {
|
|
3561
|
+
p.match(/\.story\.tsx?$/) ? pt(W(G(p), "index.md")) : pt(p.endsWith(".css") ? p.replace(/\.css$/, ".md") : p);
|
|
3557
3562
|
try {
|
|
3558
|
-
await
|
|
3563
|
+
await at();
|
|
3559
3564
|
} catch (x) {
|
|
3560
3565
|
o.config.logger.error(String(x));
|
|
3561
3566
|
return;
|
|
3562
3567
|
}
|
|
3563
|
-
|
|
3568
|
+
Yt(o), ye(o), Nt(), o.ws.send({ type: "full-reload" });
|
|
3564
3569
|
return;
|
|
3565
3570
|
}
|
|
3566
|
-
if (m.has(
|
|
3567
|
-
const x = m.get(
|
|
3571
|
+
if (m.has(p)) {
|
|
3572
|
+
const x = m.get(p);
|
|
3568
3573
|
pt(x);
|
|
3569
3574
|
}
|
|
3570
|
-
k.has(
|
|
3575
|
+
k.has(p) && pt(k.get(p));
|
|
3571
3576
|
};
|
|
3572
3577
|
if (o.watcher.on("add", l), o.watcher.on("unlink", a), t.banner !== !1) {
|
|
3573
|
-
const
|
|
3578
|
+
const p = zs(), y = t.banner, x = Date.now();
|
|
3574
3579
|
o.printUrls = function() {
|
|
3575
|
-
const
|
|
3576
|
-
title:
|
|
3577
|
-
tagline:
|
|
3578
|
-
company:
|
|
3579
|
-
version:
|
|
3580
|
+
const v = o.resolvedUrls, P = v?.local?.[0] ?? `http://localhost:${o.config.server.port ?? 5173}/`, O = v?.network?.[0] ?? "use --host to expose", $ = qs({
|
|
3581
|
+
title: y.title ?? t.title ?? p.name ?? "Nimpress",
|
|
3582
|
+
tagline: y.tagline,
|
|
3583
|
+
company: y.company,
|
|
3584
|
+
version: y.version ?? p.version,
|
|
3580
3585
|
localUrl: P,
|
|
3581
|
-
networkUrl:
|
|
3586
|
+
networkUrl: O,
|
|
3582
3587
|
duration: Date.now() - x
|
|
3583
3588
|
});
|
|
3584
3589
|
process.stdout.write("\x1Bc"), process.stdout.write($ + `
|
|
3585
|
-
`),
|
|
3590
|
+
`), Nt();
|
|
3586
3591
|
};
|
|
3587
3592
|
}
|
|
3588
|
-
const
|
|
3593
|
+
const g = {
|
|
3589
3594
|
".png": "image/png",
|
|
3590
3595
|
".jpg": "image/jpeg",
|
|
3591
3596
|
".jpeg": "image/jpeg",
|
|
@@ -3601,140 +3606,140 @@ export default bodies
|
|
|
3601
3606
|
".woff": "font/woff",
|
|
3602
3607
|
".woff2": "font/woff2",
|
|
3603
3608
|
".mp4": "video/mp4"
|
|
3604
|
-
}, w = t.assetUrlBase,
|
|
3605
|
-
if (!
|
|
3606
|
-
const
|
|
3607
|
-
return !
|
|
3609
|
+
}, w = t.assetUrlBase, h = (p, y, x) => {
|
|
3610
|
+
if (!y || y.endsWith(".md")) return !1;
|
|
3611
|
+
const v = W(p, decodeURIComponent(y));
|
|
3612
|
+
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);
|
|
3608
3613
|
};
|
|
3609
|
-
return o.middlewares.use((
|
|
3610
|
-
const
|
|
3614
|
+
return o.middlewares.use((p, y, x) => {
|
|
3615
|
+
const v = (p.url ?? "").split("?")[0], P = Es(t.base, v);
|
|
3611
3616
|
if (P.startsWith("/@") || P.startsWith("/node_modules/")) return x();
|
|
3612
|
-
if (P === "/__nimpress/claude-md" &&
|
|
3613
|
-
const
|
|
3614
|
-
|
|
3617
|
+
if (P === "/__nimpress/claude-md" && p.method === "PUT") {
|
|
3618
|
+
const I = [];
|
|
3619
|
+
p.on("data", (U) => I.push(U)), p.on("end", async () => {
|
|
3615
3620
|
try {
|
|
3616
|
-
const U = JSON.parse(Buffer.concat(
|
|
3617
|
-
if (!Object.values(t.modules.systems).filter((
|
|
3618
|
-
|
|
3621
|
+
const U = JSON.parse(Buffer.concat(I).toString("utf-8")), C = String(U.path ?? ""), F = String(U.content ?? ""), E = q(process.cwd(), C);
|
|
3622
|
+
if (!Object.values(t.modules.systems).filter((V) => V.source).map((V) => q(process.cwd(), V.source)).some((V) => E.startsWith(V + kt)) || !E.endsWith(`${kt}CLAUDE.md`) || !dt(G(E))) {
|
|
3623
|
+
y.statusCode = 403, y.end("invalid claude-md target");
|
|
3619
3624
|
return;
|
|
3620
3625
|
}
|
|
3621
|
-
await nt(E,
|
|
3626
|
+
await nt(E, F), pt(k.get(E) ?? ""), y.statusCode = 204, y.end();
|
|
3622
3627
|
} catch (U) {
|
|
3623
|
-
|
|
3628
|
+
y.statusCode = 400, y.end(String(U));
|
|
3624
3629
|
}
|
|
3625
3630
|
});
|
|
3626
3631
|
return;
|
|
3627
3632
|
}
|
|
3628
|
-
if (P === "/__nimpress/schema-defaults" &&
|
|
3629
|
-
const
|
|
3630
|
-
|
|
3633
|
+
if (P === "/__nimpress/schema-defaults" && p.method === "PUT") {
|
|
3634
|
+
const I = [];
|
|
3635
|
+
p.on("data", (U) => I.push(U)), p.on("end", async () => {
|
|
3631
3636
|
try {
|
|
3632
|
-
const U = JSON.parse(Buffer.concat(
|
|
3633
|
-
if (!
|
|
3634
|
-
|
|
3637
|
+
const U = JSON.parse(Buffer.concat(I).toString("utf-8")), C = String(U.path ?? ""), F = q(process.cwd(), C), E = F.endsWith(`${kt}schema.json`) || F.endsWith(`${kt}schema.yml`);
|
|
3638
|
+
if (!F.startsWith(n + kt) || !E || !dt(F)) {
|
|
3639
|
+
y.statusCode = 403, y.end("invalid schema target");
|
|
3635
3640
|
return;
|
|
3636
3641
|
}
|
|
3637
|
-
const
|
|
3638
|
-
for (const [
|
|
3639
|
-
const
|
|
3640
|
-
|
|
3642
|
+
const R = F.endsWith(".yml") ? "yml" : "json", z = Vt(await it(F, "utf-8"), R);
|
|
3643
|
+
for (const [V, _] of Object.entries(U.defaults ?? {})) {
|
|
3644
|
+
const B = z.properties?.[V];
|
|
3645
|
+
B && (B.default = _);
|
|
3641
3646
|
}
|
|
3642
|
-
await nt(
|
|
3647
|
+
await nt(F, Jt(z, R)), pt(k.get(F) ?? ""), y.statusCode = 204, y.end();
|
|
3643
3648
|
} catch (U) {
|
|
3644
|
-
|
|
3649
|
+
y.statusCode = 400, y.end(String(U));
|
|
3645
3650
|
}
|
|
3646
3651
|
});
|
|
3647
3652
|
return;
|
|
3648
3653
|
}
|
|
3649
|
-
const
|
|
3650
|
-
if (
|
|
3651
|
-
|
|
3654
|
+
const O = St.get(P);
|
|
3655
|
+
if (O !== void 0) {
|
|
3656
|
+
y.setHeader("Content-Type", "application/rss+xml; charset=utf-8"), y.end(O);
|
|
3652
3657
|
return;
|
|
3653
3658
|
}
|
|
3654
3659
|
if (P === "/subscribe.map.json") {
|
|
3655
|
-
|
|
3660
|
+
y.setHeader("Content-Type", "application/json; charset=utf-8"), y.end(me);
|
|
3656
3661
|
return;
|
|
3657
3662
|
}
|
|
3658
3663
|
const $ = t.modules.route.replace(/\/$/, "");
|
|
3659
3664
|
if (P === $ || P.startsWith($ + "/")) {
|
|
3660
|
-
const
|
|
3665
|
+
const I = P.slice($.length).replace(/^\/+/, ""), U = decodeURIComponent(I.split("/")[0] ?? "");
|
|
3661
3666
|
if (!t.modules.systems[U]) {
|
|
3662
|
-
|
|
3667
|
+
y.statusCode = 404, y.end(`unknown module system: ${U}`);
|
|
3663
3668
|
return;
|
|
3664
3669
|
}
|
|
3665
|
-
const
|
|
3670
|
+
const F = as(
|
|
3666
3671
|
{
|
|
3667
3672
|
host: "127.0.0.1",
|
|
3668
|
-
port:
|
|
3669
|
-
path: `${P}${(
|
|
3670
|
-
method:
|
|
3671
|
-
headers:
|
|
3673
|
+
port: Ce(t.modules, U),
|
|
3674
|
+
path: `${P}${(p.url ?? "").includes("?") ? `?${(p.url ?? "").split("?").slice(1).join("?")}` : ""}`,
|
|
3675
|
+
method: p.method,
|
|
3676
|
+
headers: p.headers
|
|
3672
3677
|
},
|
|
3673
3678
|
(E) => {
|
|
3674
|
-
|
|
3679
|
+
y.writeHead(E.statusCode ?? 502, E.headers), E.pipe(y);
|
|
3675
3680
|
}
|
|
3676
3681
|
);
|
|
3677
|
-
|
|
3678
|
-
|
|
3682
|
+
F.on("error", () => {
|
|
3683
|
+
y.statusCode = 503, y.setHeader("Content-Type", "text/html"), y.end(
|
|
3679
3684
|
`<!doctype html><html><body style="font-family:monospace;padding:2rem"><p>module harness for <b>${U}</b> is not running.</p><p>start it with: <code>nimpress modules dev ${U}</code></p></body></html>`
|
|
3680
3685
|
);
|
|
3681
|
-
}),
|
|
3686
|
+
}), p.pipe(F);
|
|
3682
3687
|
return;
|
|
3683
3688
|
}
|
|
3684
3689
|
if (w === "/" || P === w || P.startsWith(w + "/")) {
|
|
3685
|
-
const
|
|
3686
|
-
if (
|
|
3690
|
+
const I = w === "/" ? P : P.slice(w.length);
|
|
3691
|
+
if (h(s, I.replace(/^\/+/, ""), y)) return;
|
|
3687
3692
|
}
|
|
3688
|
-
|
|
3693
|
+
h(n, P.replace(/^\/+/, ""), y) || x();
|
|
3689
3694
|
}), () => {
|
|
3690
|
-
o.middlewares.use(async (
|
|
3691
|
-
if (
|
|
3695
|
+
o.middlewares.use(async (p, y, x) => {
|
|
3696
|
+
if (p.method !== "GET" && p.method !== "HEAD" || !(p.headers.accept ?? "").includes("text/html")) return x();
|
|
3692
3697
|
try {
|
|
3693
|
-
const
|
|
3694
|
-
|
|
3698
|
+
const v = await o.transformIndexHtml(
|
|
3699
|
+
p.url ?? "/",
|
|
3695
3700
|
lr(t, "/@id/__x00__virtual:nimpress/main")
|
|
3696
3701
|
);
|
|
3697
|
-
|
|
3698
|
-
} catch (
|
|
3699
|
-
x(
|
|
3702
|
+
y.statusCode = 200, y.setHeader("Content-Type", "text/html"), y.end(v);
|
|
3703
|
+
} catch (v) {
|
|
3704
|
+
x(v);
|
|
3700
3705
|
}
|
|
3701
3706
|
});
|
|
3702
3707
|
};
|
|
3703
3708
|
},
|
|
3704
3709
|
async handleHotUpdate(o) {
|
|
3705
|
-
const l = o.file, a = l.endsWith(".md") && l.startsWith(n),
|
|
3706
|
-
if (
|
|
3710
|
+
const l = o.file, a = l.endsWith(".md") && l.startsWith(n), g = l.endsWith(".css") && l.startsWith(n), w = l.match(/\.story\.tsx?$/) && l.startsWith(n), h = m.get(l), p = k.get(l);
|
|
3711
|
+
if (g) {
|
|
3707
3712
|
pt(l.replace(/\.css$/, ".md"));
|
|
3708
3713
|
try {
|
|
3709
|
-
await
|
|
3714
|
+
await at();
|
|
3710
3715
|
} catch (x) {
|
|
3711
3716
|
o.server.config.logger.error(String(x));
|
|
3712
3717
|
return;
|
|
3713
3718
|
}
|
|
3714
|
-
return
|
|
3719
|
+
return Yt(o.server), o.server.ws.send({ type: "full-reload" }), [];
|
|
3715
3720
|
}
|
|
3716
|
-
if (!a && !w && !
|
|
3717
|
-
const
|
|
3718
|
-
pt(
|
|
3721
|
+
if (!a && !w && !h && !p) return;
|
|
3722
|
+
const y = a ? l : w ? W(G(l), "index.md") : h ?? p;
|
|
3723
|
+
pt(y);
|
|
3719
3724
|
try {
|
|
3720
|
-
await
|
|
3725
|
+
await at();
|
|
3721
3726
|
} catch (x) {
|
|
3722
3727
|
o.server.config.logger.error(String(x));
|
|
3723
3728
|
return;
|
|
3724
3729
|
}
|
|
3725
|
-
return
|
|
3730
|
+
return Yt(o.server), ye(o.server), Nt(), o.server.ws.send({ type: "full-reload" }), [];
|
|
3726
3731
|
},
|
|
3727
3732
|
resolveId(o) {
|
|
3728
|
-
return o ===
|
|
3733
|
+
return o === Zt ? "\0" + Zt : o === Qt ? "\0" + Qt : o === te ? "\0" + te : o === ee ? "\0" + ee : o === $e ? "\0" + $e : o === Se ? "\0" + Se : o.startsWith(Ft) && o.endsWith(".svelte") || o.startsWith(_t) && o.endsWith(".js") ? o : null;
|
|
3729
3734
|
},
|
|
3730
3735
|
async load(o) {
|
|
3731
|
-
if (o === "\0" +
|
|
3736
|
+
if (o === "\0" + Zt)
|
|
3732
3737
|
return `export default ${JSON.stringify(Zn())}`;
|
|
3733
|
-
if (o === "\0" +
|
|
3738
|
+
if (o === "\0" + $e)
|
|
3734
3739
|
return `export default ${JSON.stringify(Ls(t))}`;
|
|
3735
|
-
if (o === "\0" +
|
|
3736
|
-
const l = t.css.map((
|
|
3737
|
-
`), a = t.client ? t.client.startsWith("/") ? t.client : "/" + t.client.replace(/^\.\//, "") : null,
|
|
3740
|
+
if (o === "\0" + Se) {
|
|
3741
|
+
const l = t.css.map((h) => `import ${JSON.stringify(h.startsWith("/") ? h : "/" + h)}`).join(`
|
|
3742
|
+
`), a = t.client ? t.client.startsWith("/") ? t.client : "/" + t.client.replace(/^\.\//, "") : null, g = a ? `import { authFunctions, subscribeFunctions } from ${JSON.stringify(a)}` : "";
|
|
3738
3743
|
return `import '@nimtech/nimpress/app.css'
|
|
3739
3744
|
${l}
|
|
3740
3745
|
import { createNimpressApp } from '@nimtech/nimpress'
|
|
@@ -3742,26 +3747,26 @@ import config from 'virtual:nimpress/config'
|
|
|
3742
3747
|
import manifest from 'virtual:nimpress/manifest'
|
|
3743
3748
|
import searchIndex from 'virtual:nimpress/search'
|
|
3744
3749
|
import pages from 'virtual:nimpress/pages'
|
|
3745
|
-
${
|
|
3750
|
+
${g}
|
|
3746
3751
|
const app = createNimpressApp({ ...config, manifest, searchIndex, pageLoader: pages${a ? ", authFunctions, subscribeFunctions" : ""} })
|
|
3747
3752
|
const target = document.getElementById('app')
|
|
3748
3753
|
if (!target) throw new Error('Mount target #app missing')
|
|
3749
3754
|
app.mount(target)
|
|
3750
3755
|
`;
|
|
3751
3756
|
}
|
|
3752
|
-
if (o === "\0" + Zt)
|
|
3753
|
-
return `export default ${JSON.stringify(Ve())}`;
|
|
3754
3757
|
if (o === "\0" + Qt)
|
|
3755
|
-
return
|
|
3758
|
+
return `export default ${JSON.stringify(Xe())}`;
|
|
3756
3759
|
if (o === "\0" + te)
|
|
3760
|
+
return es();
|
|
3761
|
+
if (o === "\0" + ee)
|
|
3757
3762
|
return ns();
|
|
3758
|
-
if (o.startsWith(
|
|
3759
|
-
const l = o.slice(
|
|
3760
|
-
return os(
|
|
3763
|
+
if (o.startsWith(Ft) && o.endsWith(".svelte")) {
|
|
3764
|
+
const l = o.slice(Ft.length, -7);
|
|
3765
|
+
return os(Ke(l));
|
|
3761
3766
|
}
|
|
3762
|
-
if (o.startsWith(
|
|
3763
|
-
const l = o.slice(
|
|
3764
|
-
return ss(
|
|
3767
|
+
if (o.startsWith(_t) && o.endsWith(".js")) {
|
|
3768
|
+
const l = o.slice(_t.length, -3);
|
|
3769
|
+
return ss(Ke(l));
|
|
3765
3770
|
}
|
|
3766
3771
|
return null;
|
|
3767
3772
|
}
|
|
@@ -3771,44 +3776,44 @@ function ii(e) {
|
|
|
3771
3776
|
return e;
|
|
3772
3777
|
}
|
|
3773
3778
|
async function ai(e, t) {
|
|
3774
|
-
const n = q(e, t), s = await
|
|
3779
|
+
const n = q(e, t), s = await Je(n), r = [];
|
|
3775
3780
|
for (const i of s) {
|
|
3776
3781
|
let c;
|
|
3777
3782
|
try {
|
|
3778
|
-
c = await
|
|
3783
|
+
c = await it(i, "utf-8");
|
|
3779
3784
|
} catch {
|
|
3780
3785
|
continue;
|
|
3781
3786
|
}
|
|
3782
|
-
const { data:
|
|
3783
|
-
for (const d of Fn(
|
|
3787
|
+
const { data: u, content: b } = Te(c);
|
|
3788
|
+
for (const d of Fn(u, b))
|
|
3784
3789
|
r.push(`${jt(n, i).split(kt).join("/")}: ${d}`);
|
|
3785
3790
|
}
|
|
3786
3791
|
return r;
|
|
3787
3792
|
}
|
|
3788
3793
|
export {
|
|
3789
3794
|
No as a,
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3795
|
+
We as b,
|
|
3796
|
+
Re as c,
|
|
3797
|
+
Wt as d,
|
|
3793
3798
|
ln as e,
|
|
3794
3799
|
un as f,
|
|
3795
|
-
|
|
3800
|
+
Nt as g,
|
|
3796
3801
|
oi as h,
|
|
3797
3802
|
lr as i,
|
|
3798
3803
|
ri as j,
|
|
3799
|
-
|
|
3804
|
+
Ce as k,
|
|
3800
3805
|
ai as l,
|
|
3801
3806
|
Dn as m,
|
|
3802
3807
|
si as n,
|
|
3803
3808
|
ei as o,
|
|
3804
|
-
|
|
3809
|
+
Vt as p,
|
|
3805
3810
|
_o as q,
|
|
3806
|
-
|
|
3807
|
-
|
|
3811
|
+
ue as r,
|
|
3812
|
+
Gt as s,
|
|
3808
3813
|
ti as t,
|
|
3809
3814
|
ni as u,
|
|
3810
3815
|
qo as v,
|
|
3811
|
-
|
|
3816
|
+
He as w,
|
|
3812
3817
|
Ws as x,
|
|
3813
3818
|
Ar as y,
|
|
3814
3819
|
ii as z
|