@nimtech/nimpress 2.6.12 → 2.6.13
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/roadmap-entries.md +5 -3
- package/dist/cli.es.js +1 -1
- package/dist/nimpress.es.js +3225 -3223
- package/dist/{plugin-DnnKU6ST.js → plugin-CnifGnSA.js} +1207 -1180
- package/dist/plugin.es.js +1 -1
- package/package.json +1 -1
- package/src/styles/themes/glass.css +45 -6
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { readFile as
|
|
2
|
-
import { existsSync as fe, readFileSync as
|
|
3
|
-
import { createRequire as
|
|
4
|
-
import { request as
|
|
5
|
-
import { execFileSync as
|
|
6
|
-
import { resolve as G, dirname as Y, join as
|
|
7
|
-
import { createHash as
|
|
1
|
+
import { readFile as ce, readdir as Jt, writeFile as me, copyFile as mn, cp as fn, mkdir as Ue } from "node:fs/promises";
|
|
2
|
+
import { existsSync as fe, readFileSync as Ce, statSync as gt, readdirSync as Le, createReadStream as Ro } from "node:fs";
|
|
3
|
+
import { createRequire as In } from "node:module";
|
|
4
|
+
import { request as Bo } from "node:http";
|
|
5
|
+
import { execFileSync as Wo } from "node:child_process";
|
|
6
|
+
import { resolve as G, dirname as Y, join as U, relative as Se, basename as Pe, extname as Gt, isAbsolute as $e, sep as ke } from "node:path";
|
|
7
|
+
import { createHash as Fn } from "node:crypto";
|
|
8
8
|
import _t from "gray-matter";
|
|
9
|
-
import
|
|
9
|
+
import Rn from "markdown-it";
|
|
10
10
|
import dn from "markdown-it-anchor";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
11
|
+
import Lo from "markdown-it-attrs";
|
|
12
|
+
import Ho from "markdown-it-container";
|
|
13
|
+
import Bn from "markdown-it-deflist";
|
|
14
|
+
import zo from "markdown-it-footnote";
|
|
15
|
+
import qo from "markdown-it-task-lists";
|
|
16
16
|
import { z as m } from "zod";
|
|
17
|
-
import { parse as
|
|
18
|
-
import { createHighlighter as
|
|
19
|
-
import { fileURLToPath as
|
|
20
|
-
import { exporter as
|
|
21
|
-
import { n as
|
|
22
|
-
import { loadConfigFromFile as
|
|
17
|
+
import { parse as Wn, stringify as Uo } from "yaml";
|
|
18
|
+
import { createHighlighter as Jo } from "shiki";
|
|
19
|
+
import { fileURLToPath as Go, pathToFileURL as hn } from "node:url";
|
|
20
|
+
import { exporter as Vo } from "@dbml/core";
|
|
21
|
+
import { n as Xo, r as et, e as yt, b as Wt, p as Ln, c as Vt, d as Xt, g as bt, h as Yo, k as Yt, o as Ko, s as Zo, j as we, m as Qo, l as es, q as ts, t as ns, a as os } from "./typeMembers-CNvE92EX.js";
|
|
22
|
+
import { loadConfigFromFile as ss } from "vite";
|
|
23
23
|
const gn = {
|
|
24
24
|
out: "dist",
|
|
25
25
|
cache: "node_modules/.nimpress",
|
|
26
26
|
export: ".nimpress",
|
|
27
27
|
modules: "_components",
|
|
28
28
|
guarded: "_guarded"
|
|
29
|
-
},
|
|
29
|
+
}, Ke = {
|
|
30
30
|
title: "Nimpress",
|
|
31
31
|
status: { new: "Recently added", deprecated: "Deprecated" },
|
|
32
32
|
tabs: { linked: !1 },
|
|
@@ -52,7 +52,7 @@ const gn = {
|
|
|
52
52
|
route: `/${gn.modules}`,
|
|
53
53
|
systems: {}
|
|
54
54
|
}
|
|
55
|
-
}, ft = ["stock", "glass"],
|
|
55
|
+
}, ft = ["stock", "glass"], rs = [
|
|
56
56
|
"Header",
|
|
57
57
|
"Announce",
|
|
58
58
|
"Footer",
|
|
@@ -89,26 +89,26 @@ const gn = {
|
|
|
89
89
|
function wt(e) {
|
|
90
90
|
return ft.includes(e) ? e : e.replace(/^.*\//, "").replace(/\.css$/, "");
|
|
91
91
|
}
|
|
92
|
-
const
|
|
92
|
+
const as = m.object({
|
|
93
93
|
primary: m.string().optional(),
|
|
94
94
|
primaryHover: m.string().optional()
|
|
95
|
-
}).passthrough(),
|
|
95
|
+
}).passthrough(), is = m.object({
|
|
96
96
|
title: m.string(),
|
|
97
97
|
url: m.string().optional(),
|
|
98
98
|
description: m.string().optional(),
|
|
99
99
|
ogImage: m.string().optional(),
|
|
100
100
|
twitterSite: m.string().optional(),
|
|
101
101
|
locale: m.string().optional()
|
|
102
|
-
}).passthrough(),
|
|
102
|
+
}).passthrough(), cs = m.object({
|
|
103
103
|
text: m.string(),
|
|
104
104
|
link: m.string(),
|
|
105
105
|
gate: m.string().optional()
|
|
106
|
-
}),
|
|
106
|
+
}), ls = m.object({
|
|
107
107
|
title: m.string().optional(),
|
|
108
108
|
tagline: m.string().optional(),
|
|
109
109
|
company: m.string().optional(),
|
|
110
110
|
version: m.string().optional()
|
|
111
|
-
}).passthrough(),
|
|
111
|
+
}).passthrough(), ps = m.object({
|
|
112
112
|
name: m.string(),
|
|
113
113
|
framework: m.enum(["vue", "svelte"]),
|
|
114
114
|
source: m.string().optional(),
|
|
@@ -119,11 +119,11 @@ const rs = m.object({
|
|
|
119
119
|
harness: m.string().optional(),
|
|
120
120
|
port: m.number().optional(),
|
|
121
121
|
visibility: m.enum(["visible", "dev-only"]).optional()
|
|
122
|
-
}),
|
|
122
|
+
}), us = m.object({
|
|
123
123
|
title: m.string().optional(),
|
|
124
124
|
logo: m.string().optional(),
|
|
125
125
|
github: m.string().optional(),
|
|
126
|
-
brand:
|
|
126
|
+
brand: as.optional(),
|
|
127
127
|
footer: m.object({
|
|
128
128
|
text: m.string().optional(),
|
|
129
129
|
copyright: m.string().optional(),
|
|
@@ -152,7 +152,7 @@ const rs = m.object({
|
|
|
152
152
|
icons: m.string().optional(),
|
|
153
153
|
math: m.boolean().optional(),
|
|
154
154
|
tags: m.object({ icons: m.record(m.string()).optional(), map: m.record(m.string()).optional() }).optional(),
|
|
155
|
-
navRoutes: m.array(
|
|
155
|
+
navRoutes: m.array(cs).optional(),
|
|
156
156
|
auth: m.object({
|
|
157
157
|
issuer: m.string(),
|
|
158
158
|
clientId: m.string(),
|
|
@@ -207,7 +207,7 @@ const rs = m.object({
|
|
|
207
207
|
expires: m.string().optional()
|
|
208
208
|
}).passthrough().optional()
|
|
209
209
|
}).passthrough().optional(),
|
|
210
|
-
site:
|
|
210
|
+
site: is.optional(),
|
|
211
211
|
base: m.string().optional(),
|
|
212
212
|
contentDir: m.string().optional(),
|
|
213
213
|
assetsDir: m.string().optional(),
|
|
@@ -222,20 +222,20 @@ const rs = m.object({
|
|
|
222
222
|
exclude: m.array(m.string()).optional(),
|
|
223
223
|
defaultFrontmatter: m.record(m.unknown()).optional(),
|
|
224
224
|
defaultFrontmatterExclude: m.array(m.string()).optional(),
|
|
225
|
-
banner: m.union([
|
|
225
|
+
banner: m.union([ls, m.literal(!1)]).optional(),
|
|
226
226
|
theme: m.string().optional(),
|
|
227
227
|
themes: m.array(m.string()).optional(),
|
|
228
|
-
components: m.record(m.enum(
|
|
228
|
+
components: m.record(m.enum(rs), m.string()).optional(),
|
|
229
229
|
css: m.union([m.string(), m.array(m.string())]).optional(),
|
|
230
230
|
vite: m.record(m.unknown()).optional(),
|
|
231
231
|
pageTypes: m.record(m.string()).optional(),
|
|
232
|
-
modules: m.array(
|
|
232
|
+
modules: m.array(ps).optional()
|
|
233
233
|
}).passthrough();
|
|
234
234
|
function _n(e, t) {
|
|
235
|
-
const n =
|
|
235
|
+
const n = us.safeParse(e);
|
|
236
236
|
return n.success ? n.data : (console.warn(`[nimpress] invalid config in ${t}: ${n.error.message}`), {});
|
|
237
237
|
}
|
|
238
|
-
const
|
|
238
|
+
const ms = ["nimpress.config.ts", "nimpress.config.js", "nimpress.config.mjs", "nimpress.config.json"];
|
|
239
239
|
function yn(e) {
|
|
240
240
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
241
241
|
}
|
|
@@ -249,31 +249,31 @@ function Lt(e, t) {
|
|
|
249
249
|
}
|
|
250
250
|
return n;
|
|
251
251
|
}
|
|
252
|
-
async function
|
|
253
|
-
for (const t of
|
|
252
|
+
async function fs(e) {
|
|
253
|
+
for (const t of ms) {
|
|
254
254
|
const n = G(e, t);
|
|
255
255
|
if (!fe(n)) continue;
|
|
256
256
|
if (t.endsWith(".json")) {
|
|
257
|
-
const r = JSON.parse(
|
|
257
|
+
const r = JSON.parse(Ce(n, "utf-8"));
|
|
258
258
|
return { config: _n(r, n), file: n };
|
|
259
259
|
}
|
|
260
|
-
const s = (await
|
|
260
|
+
const s = (await ss({ command: "serve", mode: "development" }, n, e))?.config ?? {};
|
|
261
261
|
return { config: _n(s, n), file: n };
|
|
262
262
|
}
|
|
263
263
|
return null;
|
|
264
264
|
}
|
|
265
|
-
async function
|
|
266
|
-
const n = await
|
|
267
|
-
let r = Lt(
|
|
268
|
-
r = Lt(r, s), r.css = typeof r.css == "string" ? [r.css] : r.css ?? [], r.base =
|
|
265
|
+
async function ds(e, t) {
|
|
266
|
+
const n = await fs(e), o = n?.config ? { ...n.config, modules: void 0 } : void 0, s = t ? { ...t, modules: void 0 } : void 0;
|
|
267
|
+
let r = Lt(Ke, o);
|
|
268
|
+
r = Lt(r, s), r.css = typeof r.css == "string" ? [r.css] : r.css ?? [], r.base = Xo(r.base);
|
|
269
269
|
const a = t?.modules ?? n?.config?.modules;
|
|
270
270
|
return r.modules = {
|
|
271
|
-
dir:
|
|
271
|
+
dir: Ke.modules.dir,
|
|
272
272
|
route: `/${r.paths.modules}`,
|
|
273
273
|
systems: a ? Object.fromEntries(a.map((c) => [c.name, c])) : {}
|
|
274
274
|
}, { resolved: r, configFile: n?.file ?? null };
|
|
275
275
|
}
|
|
276
|
-
function
|
|
276
|
+
function hs(e) {
|
|
277
277
|
return {
|
|
278
278
|
title: e.title,
|
|
279
279
|
logo: e.logo,
|
|
@@ -301,7 +301,7 @@ function ds(e) {
|
|
|
301
301
|
function vt(e) {
|
|
302
302
|
return Array.from(/* @__PURE__ */ new Set([...e.themes, e.theme]));
|
|
303
303
|
}
|
|
304
|
-
function
|
|
304
|
+
function gs(e) {
|
|
305
305
|
function t(o, s) {
|
|
306
306
|
const r = o.pos, a = o.src.charCodeAt(r);
|
|
307
307
|
if (s || a !== 61)
|
|
@@ -360,8 +360,8 @@ function hs(e) {
|
|
|
360
360
|
r[s] && r[s].delimiters && n(o, r[s].delimiters);
|
|
361
361
|
});
|
|
362
362
|
}
|
|
363
|
-
const
|
|
364
|
-
function
|
|
363
|
+
const _s = /\\([ \\!"#$%&'()*+,./:;<=>?@[\]^_`{|}~-])/g;
|
|
364
|
+
function ys(e, t) {
|
|
365
365
|
const n = e.posMax, o = e.pos;
|
|
366
366
|
if (e.src.charCodeAt(o) !== 126 || t || o + 2 >= n)
|
|
367
367
|
return !1;
|
|
@@ -383,15 +383,15 @@ function _s(e, t) {
|
|
|
383
383
|
const a = e.push("sub_open", "sub", 1);
|
|
384
384
|
a.markup = "~";
|
|
385
385
|
const c = e.push("text", "", 0);
|
|
386
|
-
c.content = r.replace(
|
|
386
|
+
c.content = r.replace(_s, "$1");
|
|
387
387
|
const p = e.push("sub_close", "sub", -1);
|
|
388
388
|
return p.markup = "~", e.pos = e.posMax + 1, e.posMax = n, !0;
|
|
389
389
|
}
|
|
390
|
-
function
|
|
391
|
-
e.inline.ruler.after("emphasis", "sub",
|
|
390
|
+
function bs(e) {
|
|
391
|
+
e.inline.ruler.after("emphasis", "sub", ys);
|
|
392
392
|
}
|
|
393
|
-
const
|
|
394
|
-
function
|
|
393
|
+
const ws = /\\([ \\!"#$%&'()*+,./:;<=>?@[\]^_`{|}~-])/g;
|
|
394
|
+
function vs(e, t) {
|
|
395
395
|
const n = e.posMax, o = e.pos;
|
|
396
396
|
if (e.src.charCodeAt(o) !== 94 || t || o + 2 >= n)
|
|
397
397
|
return !1;
|
|
@@ -413,37 +413,37 @@ function ws(e, t) {
|
|
|
413
413
|
const a = e.push("sup_open", "sup", 1);
|
|
414
414
|
a.markup = "^";
|
|
415
415
|
const c = e.push("text", "", 0);
|
|
416
|
-
c.content = r.replace(
|
|
416
|
+
c.content = r.replace(ws, "$1");
|
|
417
417
|
const p = e.push("sup_close", "sup", -1);
|
|
418
418
|
return p.markup = "^", e.pos = e.posMax + 1, e.posMax = n, !0;
|
|
419
419
|
}
|
|
420
|
-
function
|
|
421
|
-
e.inline.ruler.after("emphasis", "sup",
|
|
420
|
+
function ks(e) {
|
|
421
|
+
e.inline.ruler.after("emphasis", "sup", vs);
|
|
422
422
|
}
|
|
423
|
-
function
|
|
423
|
+
function $s(e, t) {
|
|
424
424
|
return e[t].content;
|
|
425
425
|
}
|
|
426
|
-
function
|
|
426
|
+
function xs(e, t, n, o, s) {
|
|
427
427
|
const r = e.utils.arrayReplaceAt, a = e.utils.lib.ucmicro, c = new RegExp([a.Z.source, a.P.source, a.Cc.source].join("|"));
|
|
428
428
|
function p(d, g, w) {
|
|
429
429
|
let P = 0;
|
|
430
430
|
const A = [];
|
|
431
|
-
if (d.replace(s, function(
|
|
431
|
+
if (d.replace(s, function(M, h, v) {
|
|
432
432
|
let D;
|
|
433
|
-
if (Object.prototype.hasOwnProperty.call(n,
|
|
434
|
-
if (D = n[
|
|
433
|
+
if (Object.prototype.hasOwnProperty.call(n, M)) {
|
|
434
|
+
if (D = n[M], h > 0 && !c.test(v[h - 1]) || h + M.length < v.length && !c.test(v[h + M.length]))
|
|
435
435
|
return;
|
|
436
436
|
} else
|
|
437
|
-
D =
|
|
437
|
+
D = M.slice(1, -1);
|
|
438
438
|
if (h > P) {
|
|
439
439
|
const x = new w("text", "", 0);
|
|
440
440
|
x.content = d.slice(P, h), A.push(x);
|
|
441
441
|
}
|
|
442
442
|
const R = new w("emoji", "", 0);
|
|
443
|
-
R.markup = D, R.content = t[D], A.push(R), P = h +
|
|
443
|
+
R.markup = D, R.content = t[D], A.push(R), P = h + M.length;
|
|
444
444
|
}), P < d.length) {
|
|
445
|
-
const
|
|
446
|
-
|
|
445
|
+
const M = new w("text", "", 0);
|
|
446
|
+
M.content = d.slice(P), A.push(M);
|
|
447
447
|
}
|
|
448
448
|
return A;
|
|
449
449
|
}
|
|
@@ -451,12 +451,12 @@ function $s(e, t, n, o, s) {
|
|
|
451
451
|
let w;
|
|
452
452
|
const P = g.tokens;
|
|
453
453
|
let A = 0;
|
|
454
|
-
for (let
|
|
455
|
-
if (P[
|
|
454
|
+
for (let M = 0, h = P.length; M < h; M++) {
|
|
455
|
+
if (P[M].type !== "inline")
|
|
456
456
|
continue;
|
|
457
|
-
let v = P[
|
|
457
|
+
let v = P[M].children;
|
|
458
458
|
for (let D = v.length - 1; D >= 0; D--)
|
|
459
|
-
w = v[D], (w.type === "link_open" || w.type === "link_close") && w.info === "auto" && (A -= w.nesting), w.type === "text" && A === 0 && o.test(w.content) && (P[
|
|
459
|
+
w = v[D], (w.type === "link_open" || w.type === "link_close") && w.info === "auto" && (A -= w.nesting), w.type === "text" && A === 0 && o.test(w.content) && (P[M].children = v = r(
|
|
460
460
|
v,
|
|
461
461
|
D,
|
|
462
462
|
p(w.content, w.level, g.Token)
|
|
@@ -464,17 +464,17 @@ function $s(e, t, n, o, s) {
|
|
|
464
464
|
}
|
|
465
465
|
};
|
|
466
466
|
}
|
|
467
|
-
function
|
|
467
|
+
function Ss(e) {
|
|
468
468
|
return e.replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&");
|
|
469
469
|
}
|
|
470
|
-
function
|
|
470
|
+
function js(e) {
|
|
471
471
|
let t = e.defs;
|
|
472
472
|
e.enabled.length && (t = Object.keys(t).reduce((c, p) => (e.enabled.indexOf(p) >= 0 && (c[p] = t[p]), c), {}));
|
|
473
473
|
const n = Object.keys(e.shortcuts).reduce((c, p) => t[p] ? Array.isArray(e.shortcuts[p]) ? (e.shortcuts[p].forEach((d) => {
|
|
474
474
|
c[d] = p;
|
|
475
475
|
}), c) : (c[e.shortcuts[p]] = p, c) : c, {}), o = Object.keys(t);
|
|
476
476
|
let s;
|
|
477
|
-
o.length === 0 ? s = "^$" : s = o.map((c) => `:${c}:`).concat(Object.keys(n)).sort().reverse().map((c) =>
|
|
477
|
+
o.length === 0 ? s = "^$" : s = o.map((c) => `:${c}:`).concat(Object.keys(n)).sort().reverse().map((c) => Ss(c)).join("|");
|
|
478
478
|
const r = RegExp(s), a = RegExp(s, "g");
|
|
479
479
|
return {
|
|
480
480
|
defs: t,
|
|
@@ -483,19 +483,19 @@ function Ss(e) {
|
|
|
483
483
|
replaceRE: a
|
|
484
484
|
};
|
|
485
485
|
}
|
|
486
|
-
function
|
|
487
|
-
const o =
|
|
486
|
+
function Ps(e, t) {
|
|
487
|
+
const o = js(Object.assign({}, {
|
|
488
488
|
defs: {},
|
|
489
489
|
shortcuts: {},
|
|
490
490
|
enabled: []
|
|
491
491
|
}, t || {}));
|
|
492
|
-
e.renderer.rules.emoji =
|
|
492
|
+
e.renderer.rules.emoji = $s, e.core.ruler.after(
|
|
493
493
|
"linkify",
|
|
494
494
|
"emoji",
|
|
495
|
-
|
|
495
|
+
xs(e, o.defs, o.shortcuts, o.scanRE, o.replaceRE)
|
|
496
496
|
);
|
|
497
497
|
}
|
|
498
|
-
const
|
|
498
|
+
const As = {
|
|
499
499
|
angry: [">:(", ">:-("],
|
|
500
500
|
blush: [':")', ':-")'],
|
|
501
501
|
broken_heart: ["</3", "<\\3"],
|
|
@@ -523,7 +523,7 @@ const Ps = {
|
|
|
523
523
|
sweat_smile: [",:)", ",:-)"],
|
|
524
524
|
unamused: [":s", ":-S", ":z", ":-Z", ":$", ":-$"],
|
|
525
525
|
wink: [";)", ";-)"]
|
|
526
|
-
},
|
|
526
|
+
}, Es = {
|
|
527
527
|
100: "💯",
|
|
528
528
|
1234: "🔢",
|
|
529
529
|
grinning: "😀",
|
|
@@ -2430,40 +2430,40 @@ const Ps = {
|
|
|
2430
2430
|
};
|
|
2431
2431
|
function Cs(e, t) {
|
|
2432
2432
|
const o = Object.assign({}, {
|
|
2433
|
-
defs:
|
|
2434
|
-
shortcuts:
|
|
2433
|
+
defs: Es,
|
|
2434
|
+
shortcuts: As,
|
|
2435
2435
|
enabled: []
|
|
2436
2436
|
}, t || {});
|
|
2437
|
-
|
|
2437
|
+
Ps(e, o);
|
|
2438
2438
|
}
|
|
2439
|
-
const
|
|
2439
|
+
const le = "\x1B[0m", kt = "\x1B[1m", dt = "\x1B[2m", Hn = "\x1B[38;2;204;120;92m", Ee = "\x1B[38;2;229;174;156m", Te = "\x1B[38;2;160;160;170m", it = [
|
|
2440
2440
|
" ███╗ ██╗ ██╗ ███╗ ███╗ ██████╗ ██████╗ ███████╗ ███████╗ ███████╗",
|
|
2441
2441
|
" ████╗ ██║ ██║ ████╗ ████║ ██╔══██╗ ██╔══██╗ ██╔════╝ ██╔════╝ ██╔════╝",
|
|
2442
2442
|
" ██╔██╗ ██║ ██║ ██╔████╔██║ ██████╔╝ ██████╔╝ █████╗ ███████╗ ███████╗",
|
|
2443
2443
|
" ██║╚██╗██║ ██║ ██║╚██╔╝██║ ██╔═══╝ ██╔══██╗ ██╔══╝ ╚════██║ ╚════██║",
|
|
2444
2444
|
" ██║ ╚████║ ██║ ██║ ╚═╝ ██║ ██║ ██║ ██║ ███████╗ ███████║ ███████║",
|
|
2445
2445
|
" ╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝ ╚══════╝ ╚══════╝"
|
|
2446
|
-
],
|
|
2447
|
-
function
|
|
2446
|
+
], Xe = 60;
|
|
2447
|
+
function Os(e, t) {
|
|
2448
2448
|
const n = e.replace(/\x1b\[[0-9;]*m/g, ""), o = Math.max(0, t - n.length);
|
|
2449
2449
|
return e + " ".repeat(o);
|
|
2450
2450
|
}
|
|
2451
|
-
function
|
|
2452
|
-
const t = "╔" + "═".repeat(
|
|
2451
|
+
function Ds(e) {
|
|
2452
|
+
const t = "╔" + "═".repeat(Xe + 2) + "╗", n = "╠" + "═".repeat(Xe + 2) + "╣", o = "╚" + "═".repeat(Xe + 2) + "╝", s = [t];
|
|
2453
2453
|
for (let r = 0; r < e.length; r++)
|
|
2454
|
-
s.push("║ " +
|
|
2454
|
+
s.push("║ " + Os(e[r], Xe) + " ║"), r < e.length - 1 && s.push(n);
|
|
2455
2455
|
return s.push(o), s;
|
|
2456
2456
|
}
|
|
2457
|
-
function
|
|
2457
|
+
function Ms() {
|
|
2458
2458
|
try {
|
|
2459
|
-
const e = Y(
|
|
2459
|
+
const e = Y(Go(import.meta.url)), t = [
|
|
2460
2460
|
G(e, "package.json"),
|
|
2461
2461
|
G(e, "..", "package.json"),
|
|
2462
2462
|
G(e, "..", "..", "package.json")
|
|
2463
2463
|
];
|
|
2464
2464
|
for (const n of t)
|
|
2465
2465
|
try {
|
|
2466
|
-
const o =
|
|
2466
|
+
const o = Ce(n, "utf-8"), s = JSON.parse(o);
|
|
2467
2467
|
if (s?.name === "@nimtech/nimpress" && typeof s.version == "string") return s.version;
|
|
2468
2468
|
} catch {
|
|
2469
2469
|
}
|
|
@@ -2472,33 +2472,33 @@ function Ds() {
|
|
|
2472
2472
|
return "";
|
|
2473
2473
|
}
|
|
2474
2474
|
function Ts(e = {}) {
|
|
2475
|
-
const t = e.title ?? "Nimpress", n = e.tagline ?? "Docs framework on Svelte", o = e.company ?? `Samna® ${(/* @__PURE__ */ new Date()).getFullYear()}`, s = e.version ?? "dev", r = e.localUrl ?? "http://localhost:5173/", a = e.networkUrl ?? "use --host to expose", c = typeof e.duration == "number" ? `ready in ${e.duration} ms` : "ready", p = e.nimpressVersion ??
|
|
2475
|
+
const t = e.title ?? "Nimpress", n = e.tagline ?? "Docs framework on Svelte", o = e.company ?? `Samna® ${(/* @__PURE__ */ new Date()).getFullYear()}`, s = e.version ?? "dev", r = e.localUrl ?? "http://localhost:5173/", a = e.networkUrl ?? "use --host to expose", c = typeof e.duration == "number" ? `ready in ${e.duration} ms` : "ready", p = e.nimpressVersion ?? Ms(), d = [];
|
|
2476
2476
|
d.push("");
|
|
2477
|
-
for (const v of
|
|
2477
|
+
for (const v of it) d.push(Hn + v + le);
|
|
2478
2478
|
d.push("");
|
|
2479
2479
|
const g = [
|
|
2480
|
-
`${kt}${t}${
|
|
2481
|
-
`${
|
|
2482
|
-
`${
|
|
2480
|
+
`${kt}${t}${le}${Te} · ${o}${le}`,
|
|
2481
|
+
`${Te}${n}${le}`,
|
|
2482
|
+
`${Ee}Version${le} ${s} ${Ee}${c}${le}`
|
|
2483
2483
|
];
|
|
2484
|
-
p && g.push(`${
|
|
2485
|
-
const w =
|
|
2484
|
+
p && g.push(`${Ee}Nimpress${le} ${p}`), g.push(`${Ee}➜${le} Local ${kt}${r}${le}`), g.push(`${Ee}➜${le} Network ${dt}${a}${le}`);
|
|
2485
|
+
const w = Ds(g), P = it[0].length, A = it[0].length - it[0].trimStart().length, M = Xe + 4, h = " ".repeat(Math.max(0, Math.floor((P + A - M) / 2)));
|
|
2486
2486
|
for (const v of w) d.push(h + v);
|
|
2487
2487
|
return d.push(""), d.join(`
|
|
2488
2488
|
`);
|
|
2489
2489
|
}
|
|
2490
|
-
function
|
|
2490
|
+
function Ns() {
|
|
2491
2491
|
try {
|
|
2492
|
-
const e =
|
|
2492
|
+
const e = Ce(G(process.cwd(), "package.json"), "utf-8"), t = JSON.parse(e);
|
|
2493
2493
|
return { name: t.name, version: t.version };
|
|
2494
2494
|
} catch {
|
|
2495
2495
|
return {};
|
|
2496
2496
|
}
|
|
2497
2497
|
}
|
|
2498
|
-
const
|
|
2498
|
+
const Is = 27, Fs = 14, Rs = 16, Bs = 20, Ws = 17, Ls = 14, zn = 110, Hs = 60, zs = 120, Ze = 40, qs = 200, Us = 420, Js = 24, Gs = 7.6, Vs = 6.6, qn = 7.4, Xs = 5.4, Ys = 5.8, Ks = 6.2, Zs = 34, Qs = 48, bn = 8, er = 260, tr = 18, nr = 6.2, or = 30, wn = 24, vn = 24;
|
|
2499
2499
|
class Kt extends Error {
|
|
2500
2500
|
}
|
|
2501
|
-
function
|
|
2501
|
+
function sr(e) {
|
|
2502
2502
|
const t = e?.diags;
|
|
2503
2503
|
return Array.isArray(t) && t.length ? t.map((n) => {
|
|
2504
2504
|
const o = n.location, s = o?.start?.line, r = o?.start?.column;
|
|
@@ -2506,23 +2506,23 @@ function or(e) {
|
|
|
2506
2506
|
}).join(`
|
|
2507
2507
|
`) : e instanceof Error ? e.message : String(e);
|
|
2508
2508
|
}
|
|
2509
|
-
function
|
|
2509
|
+
function rr(e) {
|
|
2510
2510
|
try {
|
|
2511
|
-
return JSON.parse(
|
|
2511
|
+
return JSON.parse(Vo.export(e, "json"));
|
|
2512
2512
|
} catch (t) {
|
|
2513
|
-
throw new Kt(
|
|
2513
|
+
throw new Kt(sr(t));
|
|
2514
2514
|
}
|
|
2515
2515
|
}
|
|
2516
|
-
function
|
|
2516
|
+
function ar(e) {
|
|
2517
2517
|
return (e.type?.type_name ?? "").trim();
|
|
2518
2518
|
}
|
|
2519
|
-
function
|
|
2519
|
+
function ir(e) {
|
|
2520
2520
|
const t = e.dbdefault;
|
|
2521
2521
|
return !t || t.value === void 0 || t.value === null ? "" : String(t.value);
|
|
2522
2522
|
}
|
|
2523
|
-
const
|
|
2524
|
-
function
|
|
2525
|
-
const t = String(e ?? "").trim(), n =
|
|
2523
|
+
const cr = /\[([^\]]+)\]\(([^)\s]+)\)/;
|
|
2524
|
+
function lr(e) {
|
|
2525
|
+
const t = String(e ?? "").trim(), n = cr.exec(t);
|
|
2526
2526
|
return n ? {
|
|
2527
2527
|
note: t.replace(n[0], "").replace(/\s{2,}/g, " ").trim(),
|
|
2528
2528
|
label: n[1].trim(),
|
|
@@ -2535,39 +2535,39 @@ function ht(e, t, n) {
|
|
|
2535
2535
|
return e.split(`
|
|
2536
2536
|
`).reduce((s, r) => s + Math.max(1, Math.ceil(r.trim().length / o)), 0);
|
|
2537
2537
|
}
|
|
2538
|
-
function
|
|
2538
|
+
function Ct(e) {
|
|
2539
2539
|
return e.reduce((t, n) => Math.max(t, n.length), 0);
|
|
2540
2540
|
}
|
|
2541
|
-
function
|
|
2542
|
-
const n =
|
|
2543
|
-
return Math.min(
|
|
2541
|
+
function pr(e, t) {
|
|
2542
|
+
const n = Ct(t.map((p) => p.name)) * Gs, o = Ct(t.map((p) => p.type)) * Vs, s = Ct(t.map((p) => p.linkLabel)) * Ks, r = t.some((p) => p.pk || p.fk) ? Zs : 0, a = Math.round(n + o + s + r + Qs), c = Math.round(e.length * qn + 32);
|
|
2543
|
+
return Math.min(Us, Math.max(qs, a, c));
|
|
2544
2544
|
}
|
|
2545
|
-
function
|
|
2546
|
-
const t = e.width -
|
|
2547
|
-
(p, d) => p + ht(`${d.unique ? "unique" : "index"} ${d.columns.join(", ")}`,
|
|
2545
|
+
function ur(e) {
|
|
2546
|
+
const t = e.width - Js, n = Math.max(1, ht(e.name, qn, t)), o = ht(e.note, Xs, t), s = Bs + n * Ws + o * Ls, r = Math.max(e.columns.length, 1) * Is, a = e.indexes.reduce(
|
|
2547
|
+
(p, d) => p + ht(`${d.unique ? "unique" : "index"} ${d.columns.join(", ")}`, Ys, t),
|
|
2548
2548
|
0
|
|
2549
|
-
), c = e.indexes.length ?
|
|
2549
|
+
), c = e.indexes.length ? Rs + a * Fs : 0;
|
|
2550
2550
|
return Math.round(s + r + c + 2);
|
|
2551
2551
|
}
|
|
2552
|
-
function
|
|
2553
|
-
const t = e.width - wn, n = ht(e.body,
|
|
2554
|
-
return Math.round(wn + o + Math.max(1, n) *
|
|
2552
|
+
function mr(e) {
|
|
2553
|
+
const t = e.width - wn, n = ht(e.body, nr, t), o = e.title ? or : 0;
|
|
2554
|
+
return Math.round(wn + o + Math.max(1, n) * tr);
|
|
2555
2555
|
}
|
|
2556
|
-
function
|
|
2556
|
+
function fr(e, t, n) {
|
|
2557
2557
|
return e.x < t.x + t.width + n && t.x < e.x + e.width + n && e.y < t.y + t.height + n && t.y < e.y + e.height + n;
|
|
2558
2558
|
}
|
|
2559
|
-
function
|
|
2559
|
+
function dr(e, t) {
|
|
2560
2560
|
const n = [...e].sort((o, s) => o.y - s.y || o.x - s.x);
|
|
2561
2561
|
for (let o = 1; o < n.length; o++) {
|
|
2562
2562
|
let s = !0, r = 0;
|
|
2563
2563
|
for (; s && r < n.length; ) {
|
|
2564
2564
|
s = !1, r += 1;
|
|
2565
2565
|
for (let a = 0; a < o; a++)
|
|
2566
|
-
|
|
2566
|
+
fr(n[o], n[a], t) && (n[o].y = n[a].y + n[a].height + t, s = !0);
|
|
2567
2567
|
}
|
|
2568
2568
|
}
|
|
2569
2569
|
}
|
|
2570
|
-
function
|
|
2570
|
+
function hr(e, t) {
|
|
2571
2571
|
const n = /* @__PURE__ */ new Map();
|
|
2572
2572
|
for (const c of e) n.set(c.id, /* @__PURE__ */ new Set());
|
|
2573
2573
|
for (const [c, p] of t)
|
|
@@ -2582,7 +2582,7 @@ function dr(e, t) {
|
|
|
2582
2582
|
const g = d.shift(), w = o.get(g);
|
|
2583
2583
|
w && p.push(w);
|
|
2584
2584
|
const P = [...n.get(g) ?? []].sort(
|
|
2585
|
-
(A,
|
|
2585
|
+
(A, M) => (n.get(M)?.size ?? 0) - (n.get(A)?.size ?? 0)
|
|
2586
2586
|
);
|
|
2587
2587
|
for (const A of P)
|
|
2588
2588
|
s.has(A) || (s.add(A), d.push(A));
|
|
@@ -2591,7 +2591,7 @@ function dr(e, t) {
|
|
|
2591
2591
|
}
|
|
2592
2592
|
return r;
|
|
2593
2593
|
}
|
|
2594
|
-
function
|
|
2594
|
+
function gr(e, t) {
|
|
2595
2595
|
const n = new Set(e.map((d) => d.id)), o = /* @__PURE__ */ new Map();
|
|
2596
2596
|
for (const d of e) o.set(d.id, /* @__PURE__ */ new Set());
|
|
2597
2597
|
for (const [d, g] of t)
|
|
@@ -2617,53 +2617,53 @@ function hr(e, t) {
|
|
|
2617
2617
|
}
|
|
2618
2618
|
return p;
|
|
2619
2619
|
}
|
|
2620
|
-
function
|
|
2620
|
+
function _r(e, t) {
|
|
2621
2621
|
const n = [];
|
|
2622
|
-
let o =
|
|
2623
|
-
for (const s of
|
|
2624
|
-
let r =
|
|
2625
|
-
for (const c of
|
|
2622
|
+
let o = Ze;
|
|
2623
|
+
for (const s of hr(e, t)) {
|
|
2624
|
+
let r = Ze, a = o;
|
|
2625
|
+
for (const c of gr(s, t)) {
|
|
2626
2626
|
const p = Math.max(...c.map((g) => g.width));
|
|
2627
2627
|
let d = o;
|
|
2628
2628
|
for (const g of c)
|
|
2629
|
-
g.x = r + Math.round((p - g.width) / 2), g.y = d, d += g.height +
|
|
2630
|
-
r += p +
|
|
2629
|
+
g.x = r + Math.round((p - g.width) / 2), g.y = d, d += g.height + Hs, a = Math.max(a, g.y + g.height), n.push(g);
|
|
2630
|
+
r += p + zn;
|
|
2631
2631
|
}
|
|
2632
|
-
o = a +
|
|
2632
|
+
o = a + zs;
|
|
2633
2633
|
}
|
|
2634
2634
|
return n;
|
|
2635
2635
|
}
|
|
2636
|
-
function
|
|
2637
|
-
const t =
|
|
2638
|
-
for (const x of Object.values(t.schemas).sort((
|
|
2639
|
-
for (const
|
|
2640
|
-
s.push(
|
|
2636
|
+
function yr(e) {
|
|
2637
|
+
const t = rr(e), n = Object.values(t.database)[0], o = /* @__PURE__ */ new Map(), s = [];
|
|
2638
|
+
for (const x of Object.values(t.schemas).sort((E, F) => E.id - F.id))
|
|
2639
|
+
for (const E of x.tableIds)
|
|
2640
|
+
s.push(E), o.set(E, x.name);
|
|
2641
2641
|
const r = /* @__PURE__ */ new Set();
|
|
2642
2642
|
for (const x of Object.values(t.indexes)) {
|
|
2643
2643
|
if (!x.pk) continue;
|
|
2644
|
-
const
|
|
2645
|
-
if (
|
|
2646
|
-
for (const
|
|
2647
|
-
const
|
|
2648
|
-
if (!
|
|
2649
|
-
const
|
|
2650
|
-
|
|
2644
|
+
const E = t.tables[String(x.tableId)];
|
|
2645
|
+
if (E)
|
|
2646
|
+
for (const F of x.columnIds) {
|
|
2647
|
+
const z = t.indexColumns[String(F)];
|
|
2648
|
+
if (!z || z.type !== "column") continue;
|
|
2649
|
+
const Q = E.fieldIds.map((re) => t.fields[String(re)]).find((re) => re && re.name === z.value);
|
|
2650
|
+
Q && r.add(Q.id);
|
|
2651
2651
|
}
|
|
2652
2652
|
}
|
|
2653
2653
|
const a = [], c = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
|
|
2654
2654
|
for (const x of s) {
|
|
2655
|
-
const
|
|
2656
|
-
if (!
|
|
2657
|
-
const
|
|
2658
|
-
|
|
2655
|
+
const E = t.tables[String(x)];
|
|
2656
|
+
if (!E) continue;
|
|
2657
|
+
const F = o.get(x) ?? "public", z = F === "public" ? E.name : `${F}.${E.name}`, Q = `table-${x}`, re = [];
|
|
2658
|
+
E.fieldIds.forEach((ge) => {
|
|
2659
2659
|
const oe = t.fields[String(ge)];
|
|
2660
2660
|
if (!oe) return;
|
|
2661
|
-
const de = !!oe.pk || r.has(oe.id), be =
|
|
2662
|
-
d.set(oe.id, re.length), g.set(oe.id,
|
|
2661
|
+
const de = !!oe.pk || r.has(oe.id), be = lr(oe.note ?? "");
|
|
2662
|
+
d.set(oe.id, re.length), g.set(oe.id, Q), re.push({
|
|
2663
2663
|
name: oe.name,
|
|
2664
|
-
type:
|
|
2664
|
+
type: ar(oe),
|
|
2665
2665
|
note: be.note,
|
|
2666
|
-
default:
|
|
2666
|
+
default: ir(oe),
|
|
2667
2667
|
pk: de,
|
|
2668
2668
|
fk: !1,
|
|
2669
2669
|
unique: !!oe.unique,
|
|
@@ -2675,45 +2675,45 @@ function _r(e) {
|
|
|
2675
2675
|
});
|
|
2676
2676
|
});
|
|
2677
2677
|
const he = [];
|
|
2678
|
-
for (const ge of
|
|
2678
|
+
for (const ge of E.indexIds) {
|
|
2679
2679
|
const oe = t.indexes[String(ge)];
|
|
2680
2680
|
if (!oe || oe.pk) continue;
|
|
2681
2681
|
const de = oe.columnIds.map((be) => t.indexColumns[String(be)]).filter((be) => be && be.type === "column").map((be) => be.value);
|
|
2682
2682
|
de.length && he.push({
|
|
2683
|
-
name: oe.name ?? `${
|
|
2683
|
+
name: oe.name ?? `${E.name}_index_${oe.id}`,
|
|
2684
2684
|
columns: de,
|
|
2685
2685
|
unique: !!oe.unique
|
|
2686
2686
|
});
|
|
2687
2687
|
}
|
|
2688
2688
|
const te = {
|
|
2689
|
-
id:
|
|
2690
|
-
name:
|
|
2691
|
-
note:
|
|
2692
|
-
color:
|
|
2689
|
+
id: Q,
|
|
2690
|
+
name: z,
|
|
2691
|
+
note: E.note ?? "",
|
|
2692
|
+
color: E.headerColor ?? "",
|
|
2693
2693
|
columns: re,
|
|
2694
2694
|
indexes: he,
|
|
2695
2695
|
x: 0,
|
|
2696
2696
|
y: 0,
|
|
2697
|
-
width:
|
|
2697
|
+
width: pr(z, re),
|
|
2698
2698
|
height: 0
|
|
2699
2699
|
};
|
|
2700
|
-
te.height =
|
|
2700
|
+
te.height = ur(te), a.push(te), c.set(Q, te), p.set(E.name, Q), p.set(z, Q);
|
|
2701
2701
|
}
|
|
2702
2702
|
for (const x of a)
|
|
2703
|
-
for (const
|
|
2704
|
-
if (!
|
|
2705
|
-
const
|
|
2706
|
-
!
|
|
2703
|
+
for (const E of x.columns) {
|
|
2704
|
+
if (!E.link) continue;
|
|
2705
|
+
const F = E.link.replace(/^#/, ""), z = p.get(F) ?? p.get(E.link);
|
|
2706
|
+
!z || z === x.id || (E.target = z, E.link = "");
|
|
2707
2707
|
}
|
|
2708
2708
|
const w = [];
|
|
2709
|
-
for (const x of Object.values(t.refs).sort((
|
|
2710
|
-
const
|
|
2711
|
-
if (
|
|
2712
|
-
const
|
|
2709
|
+
for (const x of Object.values(t.refs).sort((E, F) => E.id - F.id)) {
|
|
2710
|
+
const E = x.endpointIds.map((oe) => t.endpoints[String(oe)]).filter(Boolean);
|
|
2711
|
+
if (E.length !== 2) continue;
|
|
2712
|
+
const F = E[1].relation === "1" ? 1 : E[0].relation === "1" ? 0 : 1, z = E[F], Q = E[F === 0 ? 1 : 0], re = z.fieldIds[0], he = Q.fieldIds[0];
|
|
2713
2713
|
if (re === void 0 || he === void 0) continue;
|
|
2714
|
-
const te = g.get(re) ?? p.get(
|
|
2714
|
+
const te = g.get(re) ?? p.get(z.tableName), ge = g.get(he) ?? p.get(Q.tableName);
|
|
2715
2715
|
if (!(!te || !ge)) {
|
|
2716
|
-
for (const oe of
|
|
2716
|
+
for (const oe of Q.fieldIds) {
|
|
2717
2717
|
const de = c.get(g.get(oe) ?? ""), be = d.get(oe);
|
|
2718
2718
|
if (!de || be === void 0) continue;
|
|
2719
2719
|
const Fe = de.columns[be];
|
|
@@ -2725,42 +2725,42 @@ function _r(e) {
|
|
|
2725
2725
|
parentColumn: d.get(re) ?? 0,
|
|
2726
2726
|
child: ge,
|
|
2727
2727
|
childColumn: d.get(he) ?? 0,
|
|
2728
|
-
many:
|
|
2728
|
+
many: Q.relation !== "1"
|
|
2729
2729
|
});
|
|
2730
2730
|
}
|
|
2731
2731
|
}
|
|
2732
|
-
const P =
|
|
2732
|
+
const P = _r(
|
|
2733
2733
|
a,
|
|
2734
2734
|
w.map((x) => [x.parent, x.child])
|
|
2735
|
-
), A = P.length ? P : a,
|
|
2736
|
-
let v =
|
|
2737
|
-
const D = h +
|
|
2738
|
-
for (const x of Object.values(t.notes).sort((
|
|
2739
|
-
const
|
|
2740
|
-
if (!
|
|
2741
|
-
const
|
|
2735
|
+
), A = P.length ? P : a, M = [], h = A.reduce((x, E) => Math.max(x, E.x + E.width), Ze);
|
|
2736
|
+
let v = Ze;
|
|
2737
|
+
const D = h + Ze + zn;
|
|
2738
|
+
for (const x of Object.values(t.notes).sort((E, F) => E.id - F.id)) {
|
|
2739
|
+
const E = String(x.content ?? "").trim();
|
|
2740
|
+
if (!E) continue;
|
|
2741
|
+
const F = {
|
|
2742
2742
|
id: `note-${x.id}`,
|
|
2743
2743
|
title: x.name ?? "",
|
|
2744
|
-
body:
|
|
2744
|
+
body: E,
|
|
2745
2745
|
x: D,
|
|
2746
2746
|
y: v,
|
|
2747
|
-
width:
|
|
2747
|
+
width: er,
|
|
2748
2748
|
height: 0
|
|
2749
2749
|
};
|
|
2750
|
-
|
|
2750
|
+
F.height = mr(F), M.push(F), v += F.height + vn;
|
|
2751
2751
|
}
|
|
2752
|
-
|
|
2752
|
+
dr([...A, ...M], vn);
|
|
2753
2753
|
const R = [];
|
|
2754
2754
|
for (const x of w) {
|
|
2755
|
-
const
|
|
2756
|
-
if (!
|
|
2757
|
-
const
|
|
2755
|
+
const E = c.get(x.parent), F = c.get(x.child);
|
|
2756
|
+
if (!E || !F) continue;
|
|
2757
|
+
const z = E.x + E.width / 2 <= F.x + F.width / 2 ? "r" : "l", Q = z === "r" ? "l" : "r";
|
|
2758
2758
|
R.push({
|
|
2759
2759
|
id: x.id,
|
|
2760
|
-
source:
|
|
2761
|
-
sourceHandle: `${
|
|
2762
|
-
target:
|
|
2763
|
-
targetHandle: `${
|
|
2760
|
+
source: E.id,
|
|
2761
|
+
sourceHandle: `${z}-${x.parentColumn}`,
|
|
2762
|
+
target: F.id,
|
|
2763
|
+
targetHandle: `${Q}-${x.childColumn}`,
|
|
2764
2764
|
many: x.many
|
|
2765
2765
|
});
|
|
2766
2766
|
}
|
|
@@ -2768,19 +2768,19 @@ function _r(e) {
|
|
|
2768
2768
|
database: n?.name ?? "",
|
|
2769
2769
|
tables: A,
|
|
2770
2770
|
edges: R,
|
|
2771
|
-
notes:
|
|
2771
|
+
notes: M
|
|
2772
2772
|
};
|
|
2773
2773
|
}
|
|
2774
|
-
function
|
|
2775
|
-
return JSON.stringify(
|
|
2774
|
+
function Un(e) {
|
|
2775
|
+
return JSON.stringify(yr(e));
|
|
2776
2776
|
}
|
|
2777
|
-
function
|
|
2777
|
+
function br(e, t, n = "") {
|
|
2778
2778
|
const o = e.match(/<script[^>]*\bsetup\b[^>]*>([\s\S]*?)<\/script>/)?.[1] ?? "", s = e.match(/<template>([\s\S]*)<\/template>/)?.[1] ?? "", r = `${o}
|
|
2779
2779
|
${n}`;
|
|
2780
2780
|
let a = null;
|
|
2781
2781
|
const c = /defineProps<\s*\{/.exec(o);
|
|
2782
2782
|
if (c)
|
|
2783
|
-
a =
|
|
2783
|
+
a = et(o, c.index + c[0].length);
|
|
2784
2784
|
else {
|
|
2785
2785
|
const h = o.match(/defineProps<\s*([A-Za-z_$][\w$]*)\s*>/);
|
|
2786
2786
|
h && (a = yt(r, h[1]));
|
|
@@ -2789,7 +2789,7 @@ ${n}`;
|
|
|
2789
2789
|
if (d)
|
|
2790
2790
|
for (const h of Wt(d[1])) {
|
|
2791
2791
|
const v = h.match(/^([A-Za-z_$][\w$]*)\s*=\s*([\s\S]+)$/);
|
|
2792
|
-
v && p.set(v[1],
|
|
2792
|
+
v && p.set(v[1], Ln(v[2]));
|
|
2793
2793
|
}
|
|
2794
2794
|
const g = [];
|
|
2795
2795
|
if (a)
|
|
@@ -2807,7 +2807,7 @@ ${n}`;
|
|
|
2807
2807
|
D.bindable = !0;
|
|
2808
2808
|
const R = o.slice(0, h.index).match(/\/\*\*((?:[^*]|\*(?!\/))*)\*\/\s*(?:const|let)\s+[\w$]+\s*=\s*$/);
|
|
2809
2809
|
if (R) {
|
|
2810
|
-
const x =
|
|
2810
|
+
const x = Yo(R[1].replace(/^\s*\*\s?/gm, "").trim());
|
|
2811
2811
|
x.description && (D.description = x.description), x.mock && !D.mock && (D.mock = x.mock);
|
|
2812
2812
|
}
|
|
2813
2813
|
g.push(D);
|
|
@@ -2819,37 +2819,37 @@ ${n}`;
|
|
|
2819
2819
|
const D = v ?? "default";
|
|
2820
2820
|
P.has(D) || (P.add(D), w.push({ name: D, kind: "slot", type: "slot" }));
|
|
2821
2821
|
}
|
|
2822
|
-
const A = [],
|
|
2823
|
-
if (
|
|
2824
|
-
const h = o.slice(
|
|
2822
|
+
const A = [], M = o.indexOf("defineEmits");
|
|
2823
|
+
if (M >= 0) {
|
|
2824
|
+
const h = o.slice(M), v = h.search(/[<(]/);
|
|
2825
2825
|
if (v >= 0) {
|
|
2826
|
-
const D = h[v], R = D === "<" ? ">" : ")", x =
|
|
2827
|
-
for (const
|
|
2828
|
-
for (const
|
|
2829
|
-
for (const
|
|
2830
|
-
for (const
|
|
2831
|
-
A.push(...
|
|
2826
|
+
const D = h[v], R = D === "<" ? ">" : ")", x = et(h, v + 1, D, R), E = /* @__PURE__ */ new Set();
|
|
2827
|
+
for (const F of x.matchAll(/['"]([\w:.-]+)['"]\s*:\s*\[/g)) E.add(F[1]);
|
|
2828
|
+
for (const F of x.matchAll(/\(\s*\w+\s*:\s*['"]([\w:.-]+)['"]/g)) E.add(F[1]);
|
|
2829
|
+
for (const F of x.matchAll(/[,\[]\s*['"]([\w:.-]+)['"]\s*[,\]]/g)) E.add(F[1]);
|
|
2830
|
+
for (const F of x.matchAll(/(?:^|[\n;{,])\s*([A-Za-z_$][\w$]*)\s*:\s*\[/g)) E.add(F[1]);
|
|
2831
|
+
A.push(...E);
|
|
2832
2832
|
}
|
|
2833
2833
|
}
|
|
2834
2834
|
for (const h of g)
|
|
2835
2835
|
(h.bindable || A.includes(`update:${h.name}`)) && (h.bindable = !0, A.includes(`update:${h.name}`) || A.push(`update:${h.name}`));
|
|
2836
2836
|
return { component: t, props: g, slots: w, emits: A };
|
|
2837
2837
|
}
|
|
2838
|
-
function
|
|
2838
|
+
function wr(e, t, n = "") {
|
|
2839
2839
|
const o = e.match(/<script[^>]*>([\s\S]*?)<\/script>/)?.[1] ?? "", s = `${o}
|
|
2840
2840
|
${n}`, r = o.match(/(?:let|const)\s*\{([\s\S]*?)\}\s*(?::\s*([\s\S]*?))?=\s*\$props\(\)/), a = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set();
|
|
2841
2841
|
if (r)
|
|
2842
2842
|
for (const A of Wt(r[1])) {
|
|
2843
|
-
const
|
|
2844
|
-
if (!
|
|
2845
|
-
const h =
|
|
2846
|
-
h && c.add(
|
|
2843
|
+
const M = A.match(/^([A-Za-z_$][\w$]*)\s*=\s*([\s\S]+)$/);
|
|
2844
|
+
if (!M) continue;
|
|
2845
|
+
const h = M[2].trim().match(/^\$bindable\(([\s\S]*)\)$/);
|
|
2846
|
+
h && c.add(M[1]), a.set(M[1], Ln(h ? h[1] : M[2]));
|
|
2847
2847
|
}
|
|
2848
2848
|
let p = null;
|
|
2849
2849
|
const d = r?.[2]?.trim();
|
|
2850
2850
|
if (d)
|
|
2851
2851
|
if (d.startsWith("{"))
|
|
2852
|
-
p =
|
|
2852
|
+
p = et(d, 1);
|
|
2853
2853
|
else {
|
|
2854
2854
|
const A = d.match(/^([A-Za-z_$][\w$]*)/);
|
|
2855
2855
|
A && (p = yt(s, A[1]));
|
|
@@ -2865,24 +2865,24 @@ ${n}`, r = o.match(/(?:let|const)\s*\{([\s\S]*?)\}\s*(?::\s*([\s\S]*?))?=\s*\$pr
|
|
|
2865
2865
|
P.push(A.name);
|
|
2866
2866
|
continue;
|
|
2867
2867
|
}
|
|
2868
|
-
const
|
|
2868
|
+
const M = Xt(
|
|
2869
2869
|
bt(A.name, A.type, A.optional, s, A.description),
|
|
2870
2870
|
A
|
|
2871
2871
|
);
|
|
2872
|
-
a.has(A.name) && (
|
|
2872
|
+
a.has(A.name) && (M.default = a.get(A.name)), c.has(A.name) && (M.bindable = !0), g.push(M);
|
|
2873
2873
|
}
|
|
2874
2874
|
else if (r) {
|
|
2875
2875
|
for (const A of Wt(r[1])) {
|
|
2876
|
-
const
|
|
2877
|
-
if (!
|
|
2878
|
-
const h = { name:
|
|
2879
|
-
a.has(
|
|
2876
|
+
const M = A.match(/^([A-Za-z_$][\w$]*)/)?.[1];
|
|
2877
|
+
if (!M || M === "children") continue;
|
|
2878
|
+
const h = { name: M, kind: "json", type: "unknown" };
|
|
2879
|
+
a.has(M) && (h.default = a.get(M)), c.has(M) && (h.bindable = !0), g.push(h);
|
|
2880
2880
|
}
|
|
2881
2881
|
/\bchildren\b/.test(r[1]) && w.push({ name: "children", kind: "slot", type: "Snippet" });
|
|
2882
2882
|
}
|
|
2883
2883
|
return { component: t, props: g, slots: w, emits: P };
|
|
2884
2884
|
}
|
|
2885
|
-
function
|
|
2885
|
+
function Jn(e, t = []) {
|
|
2886
2886
|
let n;
|
|
2887
2887
|
try {
|
|
2888
2888
|
n = Le(e, { withFileTypes: !0 });
|
|
@@ -2890,23 +2890,23 @@ function Un(e, t = []) {
|
|
|
2890
2890
|
return t;
|
|
2891
2891
|
}
|
|
2892
2892
|
for (const o of n) {
|
|
2893
|
-
const s =
|
|
2893
|
+
const s = U(e, o.name);
|
|
2894
2894
|
if (o.isDirectory()) {
|
|
2895
2895
|
if (o.name === "node_modules") continue;
|
|
2896
|
-
|
|
2896
|
+
Jn(s, t);
|
|
2897
2897
|
} else o.isFile() && o.name.endsWith(".d.ts") && t.push(s);
|
|
2898
2898
|
}
|
|
2899
2899
|
return t;
|
|
2900
2900
|
}
|
|
2901
|
-
function
|
|
2902
|
-
const o =
|
|
2901
|
+
function vr(e, t, n) {
|
|
2902
|
+
const o = U(e, "node_modules", t);
|
|
2903
2903
|
if (!fe(o) || !gt(o).isDirectory()) return null;
|
|
2904
2904
|
const s = [
|
|
2905
2905
|
`${n}.vue.d.ts`,
|
|
2906
2906
|
`${n}.svelte.d.ts`,
|
|
2907
2907
|
`${n}.d.ts`,
|
|
2908
2908
|
`${n.toLowerCase()}/index.d.ts`
|
|
2909
|
-
], r =
|
|
2909
|
+
], r = Jn(o);
|
|
2910
2910
|
for (const a of s) {
|
|
2911
2911
|
const c = r.find((p) => p.endsWith(`/${a}`));
|
|
2912
2912
|
if (c) return c;
|
|
@@ -2930,16 +2930,16 @@ function di(e, t) {
|
|
|
2930
2930
|
}
|
|
2931
2931
|
return { component: t, props: o, slots: s, emits: r };
|
|
2932
2932
|
}
|
|
2933
|
-
function
|
|
2933
|
+
function Gn(e, t) {
|
|
2934
2934
|
return G(e, t.paths.out);
|
|
2935
2935
|
}
|
|
2936
|
-
function
|
|
2936
|
+
function Vn(e, t, ...n) {
|
|
2937
2937
|
return G(e, t.paths.cache, ...n);
|
|
2938
2938
|
}
|
|
2939
2939
|
function hi(e, t) {
|
|
2940
|
-
return
|
|
2940
|
+
return U(e, t.paths.guarded);
|
|
2941
2941
|
}
|
|
2942
|
-
function
|
|
2942
|
+
function kr(e) {
|
|
2943
2943
|
const t = /* @__PURE__ */ new Map();
|
|
2944
2944
|
for (const c of Object.values(e))
|
|
2945
2945
|
c.type === "chunk" && t.set(c.fileName, c);
|
|
@@ -2962,12 +2962,12 @@ function vr(e) {
|
|
|
2962
2962
|
n.get(c) || a(c);
|
|
2963
2963
|
return s;
|
|
2964
2964
|
}
|
|
2965
|
-
function
|
|
2965
|
+
function Xn() {
|
|
2966
2966
|
return {
|
|
2967
2967
|
name: "nimpress:chunk-cycle-guard",
|
|
2968
2968
|
apply: "build",
|
|
2969
2969
|
generateBundle(e, t) {
|
|
2970
|
-
const n =
|
|
2970
|
+
const n = kr(t);
|
|
2971
2971
|
if (!n.length) return;
|
|
2972
2972
|
const o = n.map((s) => {
|
|
2973
2973
|
const r = s.chunks.join(" -> "), a = s.modules.map((c) => ` ${c}`).join(`
|
|
@@ -3005,11 +3005,11 @@ async function gi(e) {
|
|
|
3005
3005
|
r({ compilerOptions: { runes: !0, dev: n === "serve" } }),
|
|
3006
3006
|
a(),
|
|
3007
3007
|
Ua({ ...o, modules: Object.values(o.modules.systems) }),
|
|
3008
|
-
|
|
3008
|
+
Xn()
|
|
3009
3009
|
],
|
|
3010
|
-
cacheDir:
|
|
3010
|
+
cacheDir: Vn(t, o, "site"),
|
|
3011
3011
|
build: {
|
|
3012
|
-
outDir:
|
|
3012
|
+
outDir: Gn(t, o),
|
|
3013
3013
|
emptyOutDir: !0,
|
|
3014
3014
|
target: "es2022",
|
|
3015
3015
|
...s ? { rollupOptions: { input: s } } : {}
|
|
@@ -3020,7 +3020,7 @@ async function gi(e) {
|
|
|
3020
3020
|
function $t(e, t, n, o, s) {
|
|
3021
3021
|
const r = t.systems[n];
|
|
3022
3022
|
if (!r?.source) return null;
|
|
3023
|
-
const a = G(e, r.source), c = r.framework === "vue" ? ".vue" : ".svelte", p = s ? [G(a, s)] : [
|
|
3023
|
+
const a = G(e, r.source), c = r.framework === "vue" ? ".vue" : ".svelte", p = s ? [G(a, s)] : [U(a, o, o + c), U(a, o + c)];
|
|
3024
3024
|
for (const d of p) {
|
|
3025
3025
|
if (!s && !d.startsWith(a) || !fe(d)) continue;
|
|
3026
3026
|
const g = Y(d);
|
|
@@ -3028,12 +3028,12 @@ function $t(e, t, n, o, s) {
|
|
|
3028
3028
|
systemConfig: r,
|
|
3029
3029
|
componentFile: d,
|
|
3030
3030
|
componentDir: g,
|
|
3031
|
-
claudeMdPath:
|
|
3031
|
+
claudeMdPath: U(g, "CLAUDE.md")
|
|
3032
3032
|
};
|
|
3033
3033
|
}
|
|
3034
3034
|
return null;
|
|
3035
3035
|
}
|
|
3036
|
-
async function
|
|
3036
|
+
async function Yn(e, t = []) {
|
|
3037
3037
|
let n;
|
|
3038
3038
|
try {
|
|
3039
3039
|
n = await Jt(e, { withFileTypes: !0 });
|
|
@@ -3041,20 +3041,20 @@ async function Xn(e, t = []) {
|
|
|
3041
3041
|
return t;
|
|
3042
3042
|
}
|
|
3043
3043
|
for (const o of n) {
|
|
3044
|
-
const s =
|
|
3044
|
+
const s = U(e, o.name);
|
|
3045
3045
|
if (o.isDirectory()) {
|
|
3046
3046
|
if (o.name.startsWith(".") || o.name === "node_modules") continue;
|
|
3047
|
-
await
|
|
3047
|
+
await Yn(s, t);
|
|
3048
3048
|
} else o.isFile() && o.name.endsWith(".md") && t.push(s);
|
|
3049
3049
|
}
|
|
3050
3050
|
return t;
|
|
3051
3051
|
}
|
|
3052
3052
|
async function xt(e, t) {
|
|
3053
|
-
const n = G(e, t), o = await
|
|
3053
|
+
const n = G(e, t), o = await Yn(n), s = [];
|
|
3054
3054
|
for (const r of o) {
|
|
3055
3055
|
let a;
|
|
3056
3056
|
try {
|
|
3057
|
-
a = await
|
|
3057
|
+
a = await ce(r, "utf-8");
|
|
3058
3058
|
} catch {
|
|
3059
3059
|
continue;
|
|
3060
3060
|
}
|
|
@@ -3072,59 +3072,59 @@ async function xt(e, t) {
|
|
|
3072
3072
|
}
|
|
3073
3073
|
return s;
|
|
3074
3074
|
}
|
|
3075
|
-
function
|
|
3076
|
-
const t =
|
|
3075
|
+
function ot(e) {
|
|
3076
|
+
const t = U(e, "schema.yml");
|
|
3077
3077
|
if (fe(t)) return { path: t, form: "yml" };
|
|
3078
|
-
const n =
|
|
3078
|
+
const n = U(e, "schema.json");
|
|
3079
3079
|
return fe(n) ? { path: n, form: "json" } : null;
|
|
3080
3080
|
}
|
|
3081
|
-
function
|
|
3082
|
-
return t === "yml" ?
|
|
3081
|
+
function st(e, t) {
|
|
3082
|
+
return t === "yml" ? Wn(e) : JSON.parse(e);
|
|
3083
3083
|
}
|
|
3084
|
-
function
|
|
3085
|
-
return t === "yml" ?
|
|
3084
|
+
function tt(e, t) {
|
|
3085
|
+
return t === "yml" ? Uo(e) : JSON.stringify(e, null, 2) + `
|
|
3086
3086
|
`;
|
|
3087
3087
|
}
|
|
3088
3088
|
async function Qt(e, t, n) {
|
|
3089
3089
|
try {
|
|
3090
|
-
return await
|
|
3090
|
+
return await Gr(Y(e), e, t, n);
|
|
3091
3091
|
} catch (o) {
|
|
3092
3092
|
console.warn(`nimpress modules: schema parse failed for ${n}: ${String(o)}`);
|
|
3093
3093
|
return;
|
|
3094
3094
|
}
|
|
3095
3095
|
}
|
|
3096
|
-
const
|
|
3097
|
-
function
|
|
3096
|
+
const $r = ["description", "default", "enum", "mock", "format", "minimum", "maximum", "title"], xr = ["type", "tsType", "bindable"];
|
|
3097
|
+
function Qe(e, t) {
|
|
3098
3098
|
const n = { ...e }, o = n, s = t;
|
|
3099
|
-
for (const r of
|
|
3099
|
+
for (const r of xr)
|
|
3100
3100
|
s[r] !== void 0 && (o[r] = s[r]);
|
|
3101
3101
|
t.type !== void 0 && t.tsType === void 0 && delete n.tsType, t.required !== void 0 && (n.required = t.required);
|
|
3102
|
-
for (const r of
|
|
3102
|
+
for (const r of $r)
|
|
3103
3103
|
o[r] === void 0 && s[r] !== void 0 && (o[r] = s[r]);
|
|
3104
3104
|
if (t.properties) {
|
|
3105
3105
|
const r = {};
|
|
3106
3106
|
for (const [a, c] of Object.entries(t.properties)) {
|
|
3107
3107
|
const p = e.properties?.[a];
|
|
3108
|
-
r[a] = p ?
|
|
3108
|
+
r[a] = p ? Qe(p, c) : c;
|
|
3109
3109
|
}
|
|
3110
3110
|
for (const [a, c] of Object.entries(e.properties ?? {}))
|
|
3111
3111
|
a in r || (r[a] = c);
|
|
3112
3112
|
n.properties = r;
|
|
3113
3113
|
}
|
|
3114
|
-
return t.items && (n.items = e.items ?
|
|
3114
|
+
return t.items && (n.items = e.items ? Qe(e.items, t.items) : t.items), t.additionalProperties && (n.additionalProperties = e.additionalProperties ? Qe(e.additionalProperties, t.additionalProperties) : t.additionalProperties), n;
|
|
3115
3115
|
}
|
|
3116
3116
|
function en(e, t) {
|
|
3117
3117
|
const n = t, o = { added: [], missing: [] }, s = {};
|
|
3118
3118
|
for (const [p, d] of Object.entries(n.properties ?? {})) {
|
|
3119
3119
|
const g = e.properties?.[p];
|
|
3120
|
-
g ? s[p] =
|
|
3120
|
+
g ? s[p] = Qe(g, d) : (s[p] = d, o.added.push(p));
|
|
3121
3121
|
}
|
|
3122
3122
|
for (const [p, d] of Object.entries(e.properties ?? {}))
|
|
3123
3123
|
p in s || (s[p] = d, o.missing.push(`prop ${p}`));
|
|
3124
3124
|
const r = {};
|
|
3125
3125
|
for (const [p, d] of Object.entries(n.slots ?? {})) {
|
|
3126
3126
|
const g = e.slots?.[p];
|
|
3127
|
-
r[p] = g ?
|
|
3127
|
+
r[p] = g ? Qe(g, d) : d;
|
|
3128
3128
|
}
|
|
3129
3129
|
for (const [p, d] of Object.entries(e.slots ?? {}))
|
|
3130
3130
|
p in r || (r[p] = d, o.missing.push(`slot ${p}`));
|
|
@@ -3133,47 +3133,47 @@ function en(e, t) {
|
|
|
3133
3133
|
a.includes(p) || (a.push(p), o.missing.push(`emit ${p}`));
|
|
3134
3134
|
return { merged: { ...e, ...t, properties: s, slots: r, emits: a }, report: o };
|
|
3135
3135
|
}
|
|
3136
|
-
const
|
|
3137
|
-
function
|
|
3136
|
+
const Ye = [], kn = /* @__PURE__ */ new Set();
|
|
3137
|
+
function Sr(e) {
|
|
3138
3138
|
return `${e.component}|${e.kind}|${e.path}`;
|
|
3139
3139
|
}
|
|
3140
3140
|
function $n(e) {
|
|
3141
3141
|
for (const t of e) {
|
|
3142
|
-
const n =
|
|
3143
|
-
kn.has(n) || (kn.add(n),
|
|
3142
|
+
const n = Sr(t);
|
|
3143
|
+
kn.has(n) || (kn.add(n), Ye.push(t));
|
|
3144
3144
|
}
|
|
3145
3145
|
}
|
|
3146
|
-
const
|
|
3146
|
+
const jr = {
|
|
3147
3147
|
opaque: "author opaque members in the schema with enum or properties, or type them in the source",
|
|
3148
3148
|
undocumented: "describe them in the schema or above the type member in the source",
|
|
3149
3149
|
orphan: "remove the schema member or restore it in the source"
|
|
3150
3150
|
};
|
|
3151
|
-
function
|
|
3151
|
+
function Pr(e) {
|
|
3152
3152
|
const t = e.match(/^type (.+) is opaque$/);
|
|
3153
|
-
return t ? `${
|
|
3153
|
+
return t ? `${Te}type${le} ${t[1]} ${Te}is opaque${le}` : `${Te}${e}${le}`;
|
|
3154
3154
|
}
|
|
3155
3155
|
function Je(e = process.cwd()) {
|
|
3156
|
-
if (!
|
|
3156
|
+
if (!Ye.length) return;
|
|
3157
3157
|
const t = /* @__PURE__ */ new Map();
|
|
3158
|
-
for (const a of
|
|
3158
|
+
for (const a of Ye) {
|
|
3159
3159
|
const c = t.get(a.component) ?? [];
|
|
3160
3160
|
c.push(a), t.set(a.component, c);
|
|
3161
3161
|
}
|
|
3162
|
-
const n =
|
|
3163
|
-
|
|
3162
|
+
const n = Ye.length;
|
|
3163
|
+
Ye.length = 0;
|
|
3164
3164
|
const o = n === 1 ? "schema warning" : "schema warnings", s = t.size === 1 ? "component" : "components", r = [""];
|
|
3165
|
-
r.push(` ${
|
|
3165
|
+
r.push(` ${Ee}${kt}nimpress modules${le} ${Te}${n} ${o} in ${t.size} ${s}${le}`), r.push("");
|
|
3166
3166
|
for (const [a, c] of t) {
|
|
3167
3167
|
const p = c.find((w) => w.sourceFile)?.sourceFile;
|
|
3168
|
-
r.push(` ${
|
|
3168
|
+
r.push(` ${Hn}${kt}${a}${le}${p ? ` ${dt}${Se(e, p)}${le}` : ""}`);
|
|
3169
3169
|
const d = Math.max(...c.map((w) => (w.line ? `L${w.line}` : "·").length)), g = Math.max(...c.map((w) => (w.path || "(component)").length));
|
|
3170
3170
|
for (const w of c) {
|
|
3171
3171
|
const P = (w.line ? `L${w.line}` : "·").padStart(d), A = (w.path || "(component)").padEnd(g);
|
|
3172
|
-
r.push(` ${
|
|
3172
|
+
r.push(` ${Te}${P}${le} ${Ee}${A}${le} ${Pr(w.detail)}`);
|
|
3173
3173
|
}
|
|
3174
3174
|
for (const w of new Set(c.map((P) => P.kind)))
|
|
3175
|
-
r.push(` ${
|
|
3176
|
-
r.push(` ${
|
|
3175
|
+
r.push(` ${Ee}→${le} ${dt}${jr[w]}${le}`);
|
|
3176
|
+
r.push(` ${Ee}→${le} ${dt}then run${le} nimpress modules update ${a}`), r.push("");
|
|
3177
3177
|
}
|
|
3178
3178
|
console.warn(r.join(`
|
|
3179
3179
|
`));
|
|
@@ -3194,7 +3194,7 @@ function Sn(e, t, n = {}) {
|
|
|
3194
3194
|
const o = [], s = Yt(e, t);
|
|
3195
3195
|
for (const r of s.props.filter((a) => !a.description))
|
|
3196
3196
|
o.push({ component: e, sourceFile: n.sourceFile, line: xn(n.sourceText, r.name), path: r.name, detail: "has no description", kind: "undocumented" });
|
|
3197
|
-
for (const r of
|
|
3197
|
+
for (const r of Ko(s.props))
|
|
3198
3198
|
o.push({ component: e, sourceFile: n.sourceFile, line: xn(n.sourceText, r.path), path: r.path, detail: `type ${r.type} is opaque`, kind: "opaque" });
|
|
3199
3199
|
for (const r of n.report?.missing ?? [])
|
|
3200
3200
|
o.push({ component: e, sourceFile: n.sourceFile, path: r, detail: "has no counterpart in the component source", kind: "orphan" });
|
|
@@ -3202,57 +3202,57 @@ function Sn(e, t, n = {}) {
|
|
|
3202
3202
|
}
|
|
3203
3203
|
async function tn(e, t, n, o) {
|
|
3204
3204
|
if (!n) return;
|
|
3205
|
-
const s =
|
|
3206
|
-
}) : void 0, a =
|
|
3205
|
+
const s = Zo(t, n.props, n.slots, n.emits), r = o ? await ce(o, "utf-8").catch(() => {
|
|
3206
|
+
}) : void 0, a = ot(e);
|
|
3207
3207
|
if (!a) {
|
|
3208
|
-
const P =
|
|
3209
|
-
await
|
|
3208
|
+
const P = U(e, "schema.json");
|
|
3209
|
+
await me(P, tt(s, "json")), console.log(`nimpress modules: ${t} schema seeded at ${P} — the file is yours to author from here`), $n(Sn(t, s, { sourceFile: o, sourceText: r }));
|
|
3210
3210
|
return;
|
|
3211
3211
|
}
|
|
3212
|
-
const c = await
|
|
3212
|
+
const c = await ce(a.path, "utf-8");
|
|
3213
3213
|
let p;
|
|
3214
3214
|
try {
|
|
3215
|
-
p =
|
|
3215
|
+
p = st(c, a.form);
|
|
3216
3216
|
} catch (P) {
|
|
3217
|
-
console.warn(`nimpress modules: ${t} ${
|
|
3217
|
+
console.warn(`nimpress modules: ${t} ${Pe(a.path)} failed to parse, left untouched: ${String(P)}`);
|
|
3218
3218
|
return;
|
|
3219
3219
|
}
|
|
3220
|
-
const { merged: d, report: g } = en(p, s), w =
|
|
3220
|
+
const { merged: d, report: g } = en(p, s), w = tt(d, a.form);
|
|
3221
3221
|
if (w !== c) {
|
|
3222
|
-
await
|
|
3222
|
+
await me(a.path, w);
|
|
3223
3223
|
const P = g.added.length ? `, added ${g.added.join(", ")}` : "";
|
|
3224
3224
|
console.log(`nimpress modules: ${t} schema upserted at ${a.path}${P}`);
|
|
3225
3225
|
}
|
|
3226
3226
|
$n(Sn(t, d, { sourceFile: o, sourceText: r, report: g }));
|
|
3227
3227
|
}
|
|
3228
3228
|
const jn = /* @__PURE__ */ new Map();
|
|
3229
|
-
async function
|
|
3229
|
+
async function Ar(e, t, n, o) {
|
|
3230
3230
|
let s;
|
|
3231
3231
|
try {
|
|
3232
|
-
s = await
|
|
3232
|
+
s = await ce(n, "utf-8");
|
|
3233
3233
|
} catch {
|
|
3234
3234
|
return;
|
|
3235
3235
|
}
|
|
3236
|
-
const r =
|
|
3236
|
+
const r = Fn("sha1").update(s).digest("hex");
|
|
3237
3237
|
if (jn.get(n) === r) return;
|
|
3238
3238
|
jn.set(n, r);
|
|
3239
3239
|
const a = await Qt(n, o, t);
|
|
3240
3240
|
a && await tn(e, t, a, n);
|
|
3241
3241
|
}
|
|
3242
3242
|
async function _i(e, t) {
|
|
3243
|
-
const n =
|
|
3243
|
+
const n = ot(e);
|
|
3244
3244
|
if (!n) {
|
|
3245
|
-
await
|
|
3245
|
+
await me(U(e, "schema.json"), tt(t, "json"));
|
|
3246
3246
|
return;
|
|
3247
3247
|
}
|
|
3248
|
-
const o = await
|
|
3249
|
-
await
|
|
3248
|
+
const o = await ce(n.path, "utf-8"), s = st(o, n.form), { merged: r } = en(t, s);
|
|
3249
|
+
await me(n.path, tt(r, n.form));
|
|
3250
3250
|
}
|
|
3251
3251
|
function Ht(e) {
|
|
3252
3252
|
const t = Gt(e);
|
|
3253
3253
|
return t === ".vue" ? "vue" : t === ".svelte" ? "svelte" : null;
|
|
3254
3254
|
}
|
|
3255
|
-
function
|
|
3255
|
+
function Er(e, t, n) {
|
|
3256
3256
|
for (const [o, s] of Object.entries(t.modules.systems)) {
|
|
3257
3257
|
if (!s.source) continue;
|
|
3258
3258
|
const r = G(e, s.source);
|
|
@@ -3263,13 +3263,13 @@ function Ar(e, t, n) {
|
|
|
3263
3263
|
function Cr(e, t, n) {
|
|
3264
3264
|
return e.find((o) => o.system === t && o.component === n);
|
|
3265
3265
|
}
|
|
3266
|
-
async function
|
|
3266
|
+
async function Or(e, t, n) {
|
|
3267
3267
|
const o = await xt(e, t.contentDir), s = G(e, n);
|
|
3268
3268
|
if ((n.includes("/") || n.includes("\\")) && fe(s)) {
|
|
3269
3269
|
const d = Ht(s);
|
|
3270
3270
|
if (!d)
|
|
3271
3271
|
throw new Error(`[nimpress] modules: ${n} is not a .vue or .svelte component file`);
|
|
3272
|
-
const g =
|
|
3272
|
+
const g = Pe(s, Gt(s)), w = Er(e, t, s);
|
|
3273
3273
|
if (!w)
|
|
3274
3274
|
throw new Error(`[nimpress] modules: ${n} sits under no configured system source`);
|
|
3275
3275
|
const P = Cr(o, w, g);
|
|
@@ -3300,17 +3300,17 @@ async function Er(e, t, n) {
|
|
|
3300
3300
|
pageDir: Y(a.pageFile)
|
|
3301
3301
|
};
|
|
3302
3302
|
}
|
|
3303
|
-
async function
|
|
3304
|
-
const o = await
|
|
3303
|
+
async function Dr(e, t, n) {
|
|
3304
|
+
const o = await Or(e, t, n), s = await Qt(o.componentFile, o.framework, o.component);
|
|
3305
3305
|
if (!s)
|
|
3306
3306
|
throw new Error(`[nimpress] modules: schema parse produced nothing for ${o.component}`);
|
|
3307
3307
|
await tn(o.pageDir, o.component, s);
|
|
3308
|
-
const r =
|
|
3309
|
-
return
|
|
3308
|
+
const r = ot(o.pageDir);
|
|
3309
|
+
return Se(e, r?.path ?? U(o.pageDir, "schema.json"));
|
|
3310
3310
|
}
|
|
3311
3311
|
async function yi(e, t, n = {}) {
|
|
3312
3312
|
if (n.ref)
|
|
3313
|
-
return await
|
|
3313
|
+
return await Dr(e, t, n.ref), 1;
|
|
3314
3314
|
const o = await xt(e, t.contentDir);
|
|
3315
3315
|
let s = 0;
|
|
3316
3316
|
for (const r of o) {
|
|
@@ -3325,17 +3325,17 @@ async function yi(e, t, n = {}) {
|
|
|
3325
3325
|
}
|
|
3326
3326
|
return s;
|
|
3327
3327
|
}
|
|
3328
|
-
const
|
|
3328
|
+
const Mr = 6161, zt = "virtual:nimpress-harness/";
|
|
3329
3329
|
function qt(e, t) {
|
|
3330
3330
|
const n = e.systems[t]?.port;
|
|
3331
3331
|
if (n) return n;
|
|
3332
3332
|
const o = Object.keys(e.systems).sort();
|
|
3333
|
-
return
|
|
3333
|
+
return Mr + Math.max(0, o.indexOf(t));
|
|
3334
3334
|
}
|
|
3335
|
-
function
|
|
3335
|
+
function Kn(e, t) {
|
|
3336
3336
|
return `${zt}${e}/${t}/entry`;
|
|
3337
3337
|
}
|
|
3338
|
-
function
|
|
3338
|
+
function Zn() {
|
|
3339
3339
|
return `const params = new URLSearchParams(location.search)
|
|
3340
3340
|
function parseParam(name) {
|
|
3341
3341
|
const raw = params.get(name)
|
|
@@ -3507,7 +3507,7 @@ window.addEventListener('dblclick', (event) => {
|
|
|
3507
3507
|
applyPan()
|
|
3508
3508
|
})`;
|
|
3509
3509
|
}
|
|
3510
|
-
function
|
|
3510
|
+
function Qn(e) {
|
|
3511
3511
|
const t = e.named ? `mod[${JSON.stringify(e.component)}]` : "mod.default ?? mod";
|
|
3512
3512
|
return `let ComponentRef = null
|
|
3513
3513
|
async function ensureComponent() {
|
|
@@ -3518,7 +3518,7 @@ async function ensureComponent() {
|
|
|
3518
3518
|
return ComponentRef
|
|
3519
3519
|
}`;
|
|
3520
3520
|
}
|
|
3521
|
-
function
|
|
3521
|
+
function eo(e) {
|
|
3522
3522
|
return `const storyLoaders = {
|
|
3523
3523
|
${(e.storyFiles ?? []).map((n) => ` ${JSON.stringify(n.base)}: () => import(${JSON.stringify(n.path)})`).join(`,
|
|
3524
3524
|
`)}
|
|
@@ -3526,7 +3526,7 @@ ${(e.storyFiles ?? []).map((n) => ` ${JSON.stringify(n.base)}: () => import(${J
|
|
|
3526
3526
|
const activeLoader = storyLoaders[params.get('story') ?? '']
|
|
3527
3527
|
const activeStoryDef = activeLoader ? (await activeLoader()).default : null`;
|
|
3528
3528
|
}
|
|
3529
|
-
function
|
|
3529
|
+
function to(e) {
|
|
3530
3530
|
return e ? `import harnessSetup from ${JSON.stringify(e)}` : "const harnessSetup = null";
|
|
3531
3531
|
}
|
|
3532
3532
|
function Tr(e, t, n, o, s) {
|
|
@@ -3535,12 +3535,12 @@ function Tr(e, t, n, o, s) {
|
|
|
3535
3535
|
return `import { createApp, h } from 'vue'
|
|
3536
3536
|
import { DefaultHarness, ComponentStory, createHarnessContext, HARNESS_KEY } from '@nimtech/nimpress/harness/vue'
|
|
3537
3537
|
${r}
|
|
3538
|
-
${
|
|
3538
|
+
${to(n)}
|
|
3539
3539
|
${a}
|
|
3540
3540
|
|
|
3541
|
-
${
|
|
3541
|
+
${Zn()}
|
|
3542
|
+
${eo(e)}
|
|
3542
3543
|
${Qn(e)}
|
|
3543
|
-
${Zn(e)}
|
|
3544
3544
|
|
|
3545
3545
|
const setupDef = typeof harnessSetup === 'function' ? await harnessSetup() : harnessSetup
|
|
3546
3546
|
const Overlay = setupDef ? (setupDef.companion ?? null) : null
|
|
@@ -3623,18 +3623,18 @@ try {
|
|
|
3623
3623
|
parent.postMessage({ type: 'nimpress:ready' }, '*')
|
|
3624
3624
|
`;
|
|
3625
3625
|
}
|
|
3626
|
-
function
|
|
3626
|
+
function Nr(e, t, n, o, s) {
|
|
3627
3627
|
const r = t.map((c) => `import ${JSON.stringify(c)}`).join(`
|
|
3628
3628
|
`), a = o ? `import HarnessOverride from ${JSON.stringify(o)}` : "const HarnessOverride = null";
|
|
3629
3629
|
return `import { mount, createRawSnippet } from 'svelte'
|
|
3630
3630
|
import { DefaultHarness, HarnessRoot, createHarnessContext } from '@nimtech/nimpress/harness/svelte'
|
|
3631
3631
|
${r}
|
|
3632
|
-
${
|
|
3632
|
+
${to(n)}
|
|
3633
3633
|
${a}
|
|
3634
3634
|
|
|
3635
|
-
${
|
|
3635
|
+
${Zn()}
|
|
3636
|
+
${eo(e)}
|
|
3636
3637
|
${Qn(e)}
|
|
3637
|
-
${Zn(e)}
|
|
3638
3638
|
|
|
3639
3639
|
if (typeof harnessSetup === 'function') await harnessSetup()
|
|
3640
3640
|
|
|
@@ -3690,25 +3690,25 @@ try {
|
|
|
3690
3690
|
parent.postMessage({ type: 'nimpress:ready' }, '*')
|
|
3691
3691
|
`;
|
|
3692
3692
|
}
|
|
3693
|
-
function
|
|
3693
|
+
function Ir(e) {
|
|
3694
3694
|
if (!e.schemaFile || !fe(e.schemaFile)) return {};
|
|
3695
3695
|
let t;
|
|
3696
3696
|
try {
|
|
3697
|
-
t =
|
|
3697
|
+
t = st(Ce(e.schemaFile, "utf-8"), e.schemaFile.endsWith(".yml") ? "yml" : "json");
|
|
3698
3698
|
} catch {
|
|
3699
3699
|
return {};
|
|
3700
3700
|
}
|
|
3701
3701
|
const n = Yt(e.component, t), o = {};
|
|
3702
3702
|
for (const s of n.props) {
|
|
3703
3703
|
if (!s.required) continue;
|
|
3704
|
-
const r = s.default !== void 0 ? s.default :
|
|
3704
|
+
const r = s.default !== void 0 ? s.default : Qo(s, 0);
|
|
3705
3705
|
r !== void 0 && (o[s.name] = r);
|
|
3706
3706
|
}
|
|
3707
3707
|
return o;
|
|
3708
3708
|
}
|
|
3709
|
-
function
|
|
3710
|
-
const r =
|
|
3711
|
-
return e === "vue" ? Tr(t, n, o, s, r) :
|
|
3709
|
+
function Fr(e, t, n, o, s) {
|
|
3710
|
+
const r = Ir(t);
|
|
3711
|
+
return e === "vue" ? Tr(t, n, o, s, r) : Nr(t, n, o, s, r);
|
|
3712
3712
|
}
|
|
3713
3713
|
function Pn(e, t, n) {
|
|
3714
3714
|
const o = n.map((s) => ` <link rel="stylesheet" href="${s}" />`).join(`
|
|
@@ -3738,12 +3738,12 @@ ${o ? o + `
|
|
|
3738
3738
|
</html>
|
|
3739
3739
|
`;
|
|
3740
3740
|
}
|
|
3741
|
-
async function
|
|
3741
|
+
async function Rr(e, t) {
|
|
3742
3742
|
if (t === "svelte") {
|
|
3743
3743
|
const { svelte: c } = await import("@sveltejs/vite-plugin-svelte");
|
|
3744
3744
|
return c();
|
|
3745
3745
|
}
|
|
3746
|
-
const n =
|
|
3746
|
+
const n = In(U(e, "package.json"));
|
|
3747
3747
|
let o;
|
|
3748
3748
|
try {
|
|
3749
3749
|
o = n.resolve("@vitejs/plugin-vue");
|
|
@@ -3758,13 +3758,13 @@ async function Fr(e, t) {
|
|
|
3758
3758
|
}
|
|
3759
3759
|
return a;
|
|
3760
3760
|
}
|
|
3761
|
-
function
|
|
3761
|
+
function Br(e, t, n, o) {
|
|
3762
3762
|
const s = t.systems[n];
|
|
3763
3763
|
if (!s) return [];
|
|
3764
3764
|
const r = [];
|
|
3765
3765
|
for (const a of o) {
|
|
3766
3766
|
if (a.system !== n) continue;
|
|
3767
|
-
const c =
|
|
3767
|
+
const c = no(a.pageFile), p = ot(Y(a.pageFile))?.path ?? U(Y(a.pageFile), "schema.json"), d = s.source ? $t(e, t, n, a.component, a.file) : null;
|
|
3768
3768
|
if (d) {
|
|
3769
3769
|
r.push({ component: a.component, importSpec: d.componentFile, storyFiles: c, schemaFile: p });
|
|
3770
3770
|
continue;
|
|
@@ -3778,7 +3778,7 @@ function Rr(e, t, n, o) {
|
|
|
3778
3778
|
}
|
|
3779
3779
|
return r;
|
|
3780
3780
|
}
|
|
3781
|
-
function
|
|
3781
|
+
function no(e) {
|
|
3782
3782
|
const t = Y(e);
|
|
3783
3783
|
let n;
|
|
3784
3784
|
try {
|
|
@@ -3787,26 +3787,26 @@ function to(e) {
|
|
|
3787
3787
|
return [];
|
|
3788
3788
|
}
|
|
3789
3789
|
return n.filter((o) => o.endsWith(".story.ts") || o.endsWith(".story.tsx")).sort().map((o) => ({
|
|
3790
|
-
base: o.endsWith(".story.tsx") ?
|
|
3791
|
-
path:
|
|
3790
|
+
base: o.endsWith(".story.tsx") ? Pe(o, ".story.tsx") : Pe(o, ".story.ts"),
|
|
3791
|
+
path: U(t, o)
|
|
3792
3792
|
}));
|
|
3793
3793
|
}
|
|
3794
|
-
function
|
|
3794
|
+
function Wr(e, t) {
|
|
3795
3795
|
if (t.setup)
|
|
3796
|
-
return t.setup.startsWith(".") ||
|
|
3796
|
+
return t.setup.startsWith(".") || $e(t.setup) ? G(e, t.setup) : t.setup;
|
|
3797
3797
|
}
|
|
3798
|
-
function
|
|
3798
|
+
function Lr(e, t) {
|
|
3799
3799
|
if (t.harness)
|
|
3800
|
-
return t.harness.startsWith(".") ||
|
|
3800
|
+
return t.harness.startsWith(".") || $e(t.harness) ? G(e, t.harness) : t.harness;
|
|
3801
3801
|
}
|
|
3802
|
-
function
|
|
3802
|
+
function Hr(e, t, n, o, s) {
|
|
3803
3803
|
const r = (t.css ?? []).map(
|
|
3804
|
-
(P) => P.startsWith(".") ||
|
|
3805
|
-
), a =
|
|
3804
|
+
(P) => P.startsWith(".") || $e(P) ? G(e, P) : P
|
|
3805
|
+
), a = Wr(e, t), c = Lr(e, t), p = new Map(o.map((P) => [P.component, P])), d = "\0" + zt, g = (P) => {
|
|
3806
3806
|
if (!P.startsWith(d)) return null;
|
|
3807
3807
|
const A = P.slice(d.length).split("/");
|
|
3808
3808
|
return A[0] === n && A[1] ? A[1] : null;
|
|
3809
|
-
}, w = (P) =>
|
|
3809
|
+
}, w = (P) => Fr(t.framework, P, r, a, c);
|
|
3810
3810
|
return {
|
|
3811
3811
|
name: "nimpress:harness",
|
|
3812
3812
|
resolveId(P) {
|
|
@@ -3815,49 +3815,49 @@ function Lr(e, t, n, o, s) {
|
|
|
3815
3815
|
load(P) {
|
|
3816
3816
|
const A = g(P);
|
|
3817
3817
|
if (!A) return null;
|
|
3818
|
-
const
|
|
3819
|
-
return
|
|
3818
|
+
const M = p.get(A);
|
|
3819
|
+
return M ? w(M) : null;
|
|
3820
3820
|
},
|
|
3821
3821
|
configureServer(P) {
|
|
3822
|
-
P.middlewares.use(async (A,
|
|
3822
|
+
P.middlewares.use(async (A, M, h) => {
|
|
3823
3823
|
const v = A.url;
|
|
3824
3824
|
if (!v) return h();
|
|
3825
3825
|
const D = v.split("?")[0];
|
|
3826
3826
|
if (!D.startsWith(s)) return h();
|
|
3827
3827
|
const R = D.slice(s.length).split("/").filter(Boolean), x = R[0];
|
|
3828
3828
|
if (!x || !p.has(x)) return h();
|
|
3829
|
-
const
|
|
3830
|
-
if (
|
|
3831
|
-
const
|
|
3832
|
-
</head>`,
|
|
3833
|
-
|
|
3829
|
+
const E = R.slice(1).join("/");
|
|
3830
|
+
if (E === "" || E === "index.html") {
|
|
3831
|
+
const F = ` <script type="module" src="${s}@vite/client"><\/script>
|
|
3832
|
+
</head>`, z = Pn(x, "./entry.js", []).replace(" </head>", F);
|
|
3833
|
+
M.statusCode = 200, M.setHeader("Content-Type", "text/html"), M.end(z);
|
|
3834
3834
|
return;
|
|
3835
3835
|
}
|
|
3836
|
-
if (
|
|
3837
|
-
const
|
|
3838
|
-
if (!
|
|
3839
|
-
|
|
3836
|
+
if (E === "entry.js") {
|
|
3837
|
+
const F = await P.transformRequest(Kn(n, x));
|
|
3838
|
+
if (!F) return h();
|
|
3839
|
+
M.statusCode = 200, M.setHeader("Content-Type", "application/javascript"), M.end(F.code);
|
|
3840
3840
|
return;
|
|
3841
3841
|
}
|
|
3842
3842
|
return h();
|
|
3843
3843
|
});
|
|
3844
3844
|
},
|
|
3845
3845
|
generateBundle(P, A) {
|
|
3846
|
-
const
|
|
3846
|
+
const M = (h, v, D) => {
|
|
3847
3847
|
if (v.has(h)) return;
|
|
3848
3848
|
v.add(h);
|
|
3849
3849
|
const R = A[h];
|
|
3850
3850
|
if (!R || R.type !== "chunk") return;
|
|
3851
3851
|
const x = R.viteMetadata;
|
|
3852
|
-
for (const
|
|
3853
|
-
for (const
|
|
3852
|
+
for (const E of x?.importedCss ?? []) D.add(E);
|
|
3853
|
+
for (const E of R.imports) M(E, v, D);
|
|
3854
3854
|
};
|
|
3855
3855
|
for (const h of Object.values(A)) {
|
|
3856
3856
|
if (h.type !== "chunk" || !h.isEntry) continue;
|
|
3857
3857
|
const v = p.get(h.name);
|
|
3858
3858
|
if (!v) continue;
|
|
3859
3859
|
const D = /* @__PURE__ */ new Set();
|
|
3860
|
-
|
|
3860
|
+
M(h.fileName, /* @__PURE__ */ new Set(), D);
|
|
3861
3861
|
const R = [...D].map((x) => s + x);
|
|
3862
3862
|
this.emitFile({
|
|
3863
3863
|
type: "asset",
|
|
@@ -3871,15 +3871,15 @@ function Lr(e, t, n, o, s) {
|
|
|
3871
3871
|
async function bi(e, t, n, o) {
|
|
3872
3872
|
const s = t.modules, r = s.systems[n];
|
|
3873
3873
|
if (!r) throw new Error(`[nimpress] unknown module system: ${n}`);
|
|
3874
|
-
const a = await xt(e, t.contentDir), c =
|
|
3874
|
+
const a = await xt(e, t.contentDir), c = Br(e, s, n, a);
|
|
3875
3875
|
c.length || console.warn(`[nimpress] modules: no component pages found for system ${n}`);
|
|
3876
|
-
const p = await
|
|
3876
|
+
const p = await Rr(e, r.framework), d = r.source ? G(e, r.source) : e, g = s.route.replace(/\/$/, ""), w = `${g}/${n}/`, P = o === "build" ? we(t.base, w) : w, A = c.filter((h) => $e(h.importSpec)).map((h) => h.importSpec).concat(c.flatMap((h) => (h.storyFiles ?? []).map((v) => v.path))), M = {
|
|
3877
3877
|
root: e,
|
|
3878
3878
|
configFile: !1,
|
|
3879
3879
|
publicDir: !1,
|
|
3880
3880
|
appType: "mpa",
|
|
3881
|
-
cacheDir:
|
|
3882
|
-
plugins: [
|
|
3881
|
+
cacheDir: Vn(e, t, "modules", n),
|
|
3882
|
+
plugins: [Hr(e, r, n, c, P), p, Xn()],
|
|
3883
3883
|
resolve: r.framework === "vue" ? { alias: { vue: "vue/dist/vue.esm-bundler.js" } } : void 0,
|
|
3884
3884
|
optimizeDeps: {
|
|
3885
3885
|
entries: A,
|
|
@@ -3897,23 +3897,23 @@ async function bi(e, t, n, o) {
|
|
|
3897
3897
|
}
|
|
3898
3898
|
},
|
|
3899
3899
|
build: {
|
|
3900
|
-
outDir:
|
|
3900
|
+
outDir: U(Gn(e, t), g.replace(/^\//, ""), n),
|
|
3901
3901
|
emptyOutDir: !0,
|
|
3902
3902
|
target: "es2022",
|
|
3903
3903
|
rollupOptions: {
|
|
3904
|
-
input: Object.fromEntries(c.map((h) => [h.component,
|
|
3904
|
+
input: Object.fromEntries(c.map((h) => [h.component, Kn(n, h.component)]))
|
|
3905
3905
|
}
|
|
3906
3906
|
},
|
|
3907
3907
|
base: P
|
|
3908
3908
|
};
|
|
3909
|
-
return Zt(
|
|
3909
|
+
return Zt(M, t.vite);
|
|
3910
3910
|
}
|
|
3911
3911
|
function Ot(e, t) {
|
|
3912
3912
|
const n = e.search(new RegExp(`\\b${t}\\s*:`));
|
|
3913
3913
|
if (n < 0) return;
|
|
3914
3914
|
const o = e.indexOf("{", n);
|
|
3915
3915
|
if (o < 0) return;
|
|
3916
|
-
const s =
|
|
3916
|
+
const s = et(e, o + 1);
|
|
3917
3917
|
try {
|
|
3918
3918
|
return new Function(`return {${s}}`)();
|
|
3919
3919
|
} catch {
|
|
@@ -3925,13 +3925,13 @@ function Dt(e, t) {
|
|
|
3925
3925
|
if (n < 0) return e;
|
|
3926
3926
|
const o = e.indexOf("{", n);
|
|
3927
3927
|
if (o < 0) return e;
|
|
3928
|
-
const s =
|
|
3928
|
+
const s = et(e, o + 1);
|
|
3929
3929
|
return e.slice(0, n) + e.slice(o + 1 + s.length + 1);
|
|
3930
3930
|
}
|
|
3931
|
-
function
|
|
3931
|
+
function oo(e, t) {
|
|
3932
3932
|
const n = e.match(/^\s*\/\/\s*story:\s*(.+)$/m)?.[1]?.trim(), o = Dt(Dt(e, "props"), "slots"), s = Ot(o, "sidebar"), r = Dt(o, "sidebar"), a = r.match(/\bname\s*:\s*['"]([^'"]+)['"]/)?.[1], c = r.match(/\bdescription\s*:\s*['"]([^'"]+)['"]/)?.[1], p = Ot(e, "props"), d = Ot(e, "slots");
|
|
3933
3933
|
return {
|
|
3934
|
-
name: n ?? a ??
|
|
3934
|
+
name: n ?? a ?? Pe(t).replace(/\.story\.tsx?$/, "").replace(/_/g, " "),
|
|
3935
3935
|
file: t,
|
|
3936
3936
|
description: c,
|
|
3937
3937
|
props: p,
|
|
@@ -3939,7 +3939,7 @@ function no(e, t) {
|
|
|
3939
3939
|
sidebar: s
|
|
3940
3940
|
};
|
|
3941
3941
|
}
|
|
3942
|
-
async function
|
|
3942
|
+
async function zr(e) {
|
|
3943
3943
|
let t;
|
|
3944
3944
|
try {
|
|
3945
3945
|
t = await Jt(e, { withFileTypes: !0 });
|
|
@@ -3951,11 +3951,11 @@ async function Hr(e) {
|
|
|
3951
3951
|
if (!o.isFile() || !o.name.match(/\.story\.tsx?$/)) continue;
|
|
3952
3952
|
let s;
|
|
3953
3953
|
try {
|
|
3954
|
-
s = await
|
|
3954
|
+
s = await ce(U(e, o.name), "utf-8");
|
|
3955
3955
|
} catch {
|
|
3956
3956
|
continue;
|
|
3957
3957
|
}
|
|
3958
|
-
n.push(
|
|
3958
|
+
n.push(oo(s, o.name));
|
|
3959
3959
|
}
|
|
3960
3960
|
return n.sort((o, s) => o.name.localeCompare(s.name)), n;
|
|
3961
3961
|
}
|
|
@@ -3963,8 +3963,8 @@ async function wi(e, t, n = {}) {
|
|
|
3963
3963
|
const o = t.modules.route.replace(/\/$/, ""), s = n.component?.toLowerCase(), r = (await xt(e, t.contentDir)).filter((c) => c.system in t.modules.systems).filter((c) => !n.system || c.system === n.system).filter((c) => !s || c.component.toLowerCase() === s), a = [];
|
|
3964
3964
|
for (const c of r) {
|
|
3965
3965
|
const p = we(t.base, `${o}/${c.system}/${c.component}/`);
|
|
3966
|
-
for (const d of
|
|
3967
|
-
const g =
|
|
3966
|
+
for (const d of no(c.pageFile)) {
|
|
3967
|
+
const g = oo(Ce(d.path, "utf-8"), Pe(d.path));
|
|
3968
3968
|
a.push({
|
|
3969
3969
|
system: c.system,
|
|
3970
3970
|
component: c.component,
|
|
@@ -3977,7 +3977,7 @@ async function wi(e, t, n = {}) {
|
|
|
3977
3977
|
}
|
|
3978
3978
|
return a.sort((c, p) => c.system.localeCompare(p.system) || c.component.localeCompare(p.component) || c.story.localeCompare(p.story)), a;
|
|
3979
3979
|
}
|
|
3980
|
-
function
|
|
3980
|
+
function qr(e) {
|
|
3981
3981
|
let t = e;
|
|
3982
3982
|
for (let n = 0; n < 8; n++) {
|
|
3983
3983
|
if (t.endsWith("/src")) return t;
|
|
@@ -3991,8 +3991,8 @@ function An(e, t) {
|
|
|
3991
3991
|
return !e.endsWith(".vue") && !e.endsWith(".svelte") ? t : [...t.matchAll(/<script[^>]*>([\s\S]*?)<\/script>/g)].map((n) => n[1]).join(`
|
|
3992
3992
|
`);
|
|
3993
3993
|
}
|
|
3994
|
-
async function
|
|
3995
|
-
const o =
|
|
3994
|
+
async function Ur(e, t, n) {
|
|
3995
|
+
const o = qr(e), s = /* @__PURE__ */ new Set([G(t)]), r = [{ file: t, text: n, depth: 0 }];
|
|
3996
3996
|
let a = "";
|
|
3997
3997
|
for (; r.length; ) {
|
|
3998
3998
|
const c = r.shift();
|
|
@@ -4001,59 +4001,59 @@ async function qr(e, t, n) {
|
|
|
4001
4001
|
for (const d of p.matchAll(/from\s+['"]([^'"]+)['"]/g)) {
|
|
4002
4002
|
const g = d[1];
|
|
4003
4003
|
let w = null;
|
|
4004
|
-
if (g.startsWith(".") ? w = G(Y(c.file), g) : g.startsWith("@/") && o && (w = G(o, g.slice(2))), !w ||
|
|
4005
|
-
const A = [w, `${w}.ts`, `${w}.vue`,
|
|
4004
|
+
if (g.startsWith(".") ? w = G(Y(c.file), g) : g.startsWith("@/") && o && (w = G(o, g.slice(2))), !w || !$e(w)) continue;
|
|
4005
|
+
const A = [w, `${w}.ts`, `${w}.vue`, U(w, "index.ts")].find((v) => Jr(v));
|
|
4006
4006
|
if (!A) continue;
|
|
4007
|
-
const
|
|
4008
|
-
if (s.has(
|
|
4009
|
-
s.add(
|
|
4010
|
-
const h = await
|
|
4007
|
+
const M = G(A);
|
|
4008
|
+
if (s.has(M) || s.size > 50) continue;
|
|
4009
|
+
s.add(M);
|
|
4010
|
+
const h = await ce(A, "utf-8");
|
|
4011
4011
|
a += An(A, h) + `
|
|
4012
4012
|
`, r.push({ file: A, text: h, depth: c.depth + 1 });
|
|
4013
4013
|
}
|
|
4014
4014
|
}
|
|
4015
4015
|
return a;
|
|
4016
4016
|
}
|
|
4017
|
-
function
|
|
4017
|
+
function Jr(e) {
|
|
4018
4018
|
try {
|
|
4019
4019
|
return gt(e).isFile();
|
|
4020
4020
|
} catch {
|
|
4021
4021
|
return !1;
|
|
4022
4022
|
}
|
|
4023
4023
|
}
|
|
4024
|
-
async function
|
|
4025
|
-
const s = await
|
|
4024
|
+
async function Gr(e, t, n, o) {
|
|
4025
|
+
const s = await ce(t, "utf-8");
|
|
4026
4026
|
let r = "";
|
|
4027
4027
|
for (const c of Le(e))
|
|
4028
|
-
c.endsWith(".ts") && (c.endsWith(".stories.ts") || c.endsWith(".story.ts") || (r += await
|
|
4028
|
+
c.endsWith(".ts") && (c.endsWith(".stories.ts") || c.endsWith(".story.ts") || (r += await ce(U(e, c), "utf-8"), r += `
|
|
4029
4029
|
`));
|
|
4030
|
-
r += await
|
|
4031
|
-
const a = n === "vue" ?
|
|
4030
|
+
r += await Ur(e, t, s);
|
|
4031
|
+
const a = n === "vue" ? br(s, o, r) : wr(s, o, r);
|
|
4032
4032
|
for (const c of a.props) {
|
|
4033
4033
|
if (!c.format) {
|
|
4034
|
-
const p =
|
|
4034
|
+
const p = es(c);
|
|
4035
4035
|
p && (c.format = p);
|
|
4036
4036
|
}
|
|
4037
|
-
c.mock || (c.mock =
|
|
4037
|
+
c.mock || (c.mock = ts(c.name, ns(c)));
|
|
4038
4038
|
}
|
|
4039
4039
|
return a;
|
|
4040
4040
|
}
|
|
4041
|
-
async function
|
|
4042
|
-
const { cwd: t, modules: n, pageFile: o, data: s, editable: r } = e, a = String(s.system ?? ""), c = String(s.component ?? ""), p = typeof s.file == "string" ? s.file : void 0, d = await
|
|
4041
|
+
async function Vr(e) {
|
|
4042
|
+
const { cwd: t, modules: n, pageFile: o, data: s, editable: r } = e, a = String(s.system ?? ""), c = String(s.component ?? ""), p = typeof s.file == "string" ? s.file : void 0, d = await zr(Y(o)), g = $t(t, n, a, c, p), w = [];
|
|
4043
4043
|
if (r && g) {
|
|
4044
4044
|
const x = g.componentFile.endsWith(".svelte") ? "svelte" : "vue";
|
|
4045
4045
|
try {
|
|
4046
|
-
await
|
|
4047
|
-
} catch (
|
|
4048
|
-
console.warn(`nimpress modules: ${a}/${c} schema upsert failed: ${String(
|
|
4046
|
+
await Ar(Y(o), c, g.componentFile, x);
|
|
4047
|
+
} catch (E) {
|
|
4048
|
+
console.warn(`nimpress modules: ${a}/${c} schema upsert failed: ${String(E)}`);
|
|
4049
4049
|
}
|
|
4050
4050
|
}
|
|
4051
4051
|
let P;
|
|
4052
|
-
const A =
|
|
4052
|
+
const A = ot(Y(o));
|
|
4053
4053
|
if (A) {
|
|
4054
4054
|
w.push(A.path);
|
|
4055
4055
|
try {
|
|
4056
|
-
P =
|
|
4056
|
+
P = st(await ce(A.path, "utf-8"), A.form);
|
|
4057
4057
|
} catch (x) {
|
|
4058
4058
|
console.warn(`nimpress modules: ${a}/${c} ${A.form} schema failed to parse: ${String(x)}`);
|
|
4059
4059
|
}
|
|
@@ -4061,16 +4061,16 @@ async function Gr(e) {
|
|
|
4061
4061
|
console.warn(
|
|
4062
4062
|
`nimpress modules: ${a}/${c} has no schema file, controls stay empty, run nimpress modules update ${c}`
|
|
4063
4063
|
);
|
|
4064
|
-
let
|
|
4064
|
+
let M, h;
|
|
4065
4065
|
if (g)
|
|
4066
|
-
w.push(g.componentFile), h =
|
|
4066
|
+
w.push(g.componentFile), h = Se(t, g.claudeMdPath), fe(g.claudeMdPath) && (M = await ce(g.claudeMdPath, "utf-8"), w.push(g.claudeMdPath));
|
|
4067
4067
|
else {
|
|
4068
4068
|
const x = typeof s.package == "string" ? s.package : n.systems[a]?.package;
|
|
4069
4069
|
if (x) {
|
|
4070
|
-
const
|
|
4071
|
-
if (
|
|
4072
|
-
const
|
|
4073
|
-
fe(
|
|
4070
|
+
const E = vr(t, x, c);
|
|
4071
|
+
if (E) {
|
|
4072
|
+
const F = E.replace(/[^/]+$/, "CLAUDE.md");
|
|
4073
|
+
fe(F) && (M = await ce(F, "utf-8"));
|
|
4074
4074
|
}
|
|
4075
4075
|
}
|
|
4076
4076
|
}
|
|
@@ -4083,18 +4083,18 @@ async function Gr(e) {
|
|
|
4083
4083
|
component: c,
|
|
4084
4084
|
package: typeof s.package == "string" ? s.package : void 0,
|
|
4085
4085
|
version: typeof s.version == "string" ? s.version : void 0,
|
|
4086
|
-
claudeMd:
|
|
4086
|
+
claudeMd: M,
|
|
4087
4087
|
claudeMdPath: h,
|
|
4088
4088
|
editable: r && !!g,
|
|
4089
4089
|
harnessPath: `${R}/${encodeURIComponent(a)}/${encodeURIComponent(c)}/`,
|
|
4090
4090
|
schema: D,
|
|
4091
|
-
schemaPath: A ?
|
|
4091
|
+
schemaPath: A ? Se(t, A.path) : void 0,
|
|
4092
4092
|
stories: d
|
|
4093
4093
|
},
|
|
4094
4094
|
watchFiles: w
|
|
4095
4095
|
};
|
|
4096
4096
|
}
|
|
4097
|
-
function
|
|
4097
|
+
function Xr(e, t = "virtual:nimpress/main") {
|
|
4098
4098
|
const n = e.logo ? `
|
|
4099
4099
|
<link rel="icon" href="${e.logo}" />` : "", o = JSON.stringify(vt(e).map(wt)), s = JSON.stringify(wt(e.theme));
|
|
4100
4100
|
return `<!doctype html>
|
|
@@ -4124,14 +4124,14 @@ function Vr(e, t = "virtual:nimpress/main") {
|
|
|
4124
4124
|
</html>
|
|
4125
4125
|
`;
|
|
4126
4126
|
}
|
|
4127
|
-
const
|
|
4127
|
+
const ct = "virtual:nimpress/manifest", lt = "virtual:nimpress/search", pt = "virtual:nimpress/pages", ut = "virtual:nimpress/bodies", Mt = "virtual:nimpress/config", Tt = "virtual:nimpress/main", Ge = "virtual:nimpress/page-component/", We = "virtual:nimpress/page-body/", Nt = 20, Yr = "https://github.com/nimling/nimpress";
|
|
4128
4128
|
function ye(e) {
|
|
4129
4129
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
4130
4130
|
}
|
|
4131
|
-
function
|
|
4131
|
+
function Kr(e) {
|
|
4132
4132
|
return `<![CDATA[${e.replace(/\]\]>/g, "]]]]><![CDATA[>")}]]>`;
|
|
4133
4133
|
}
|
|
4134
|
-
function
|
|
4134
|
+
function En(e) {
|
|
4135
4135
|
return e === 0 ? "rss.xml" : `rss-${e + 1}.xml`;
|
|
4136
4136
|
}
|
|
4137
4137
|
const It = [
|
|
@@ -4172,15 +4172,15 @@ const It = [
|
|
|
4172
4172
|
"DotBot",
|
|
4173
4173
|
"MJ12bot"
|
|
4174
4174
|
];
|
|
4175
|
-
function
|
|
4175
|
+
function Zr(e) {
|
|
4176
4176
|
return `<script type="application/ld+json">${(typeof e == "string" ? e : JSON.stringify(e)).replace(/</g, "\\u003c")}<\/script>`;
|
|
4177
4177
|
}
|
|
4178
|
-
const Ft = (e) => e.visibility === "hidden",
|
|
4178
|
+
const Ft = (e) => e.visibility === "hidden", je = (e) => e.visibility === "hidden" || e.visibility === "dev-only", mt = (e) => e.visibility === "dev-only", Qr = {
|
|
4179
4179
|
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>',
|
|
4180
4180
|
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>',
|
|
4181
4181
|
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>',
|
|
4182
4182
|
bug: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/></svg>'
|
|
4183
|
-
},
|
|
4183
|
+
}, ea = m.object({
|
|
4184
4184
|
title: m.string().optional(),
|
|
4185
4185
|
description: m.string().optional(),
|
|
4186
4186
|
type: m.string().optional(),
|
|
@@ -4189,7 +4189,7 @@ const Ft = (e) => e.visibility === "hidden", Se = (e) => e.visibility === "hidde
|
|
|
4189
4189
|
url: m.string().optional(),
|
|
4190
4190
|
siteName: m.string().optional(),
|
|
4191
4191
|
locale: m.string().optional()
|
|
4192
|
-
}).passthrough(),
|
|
4192
|
+
}).passthrough(), ta = m.object({
|
|
4193
4193
|
card: m.string().optional(),
|
|
4194
4194
|
site: m.string().optional(),
|
|
4195
4195
|
creator: m.string().optional(),
|
|
@@ -4197,7 +4197,7 @@ const Ft = (e) => e.visibility === "hidden", Se = (e) => e.visibility === "hidde
|
|
|
4197
4197
|
description: m.string().optional(),
|
|
4198
4198
|
image: m.string().optional(),
|
|
4199
4199
|
imageAlt: m.string().optional()
|
|
4200
|
-
}).passthrough(),
|
|
4200
|
+
}).passthrough(), na = m.object({
|
|
4201
4201
|
override: m.boolean().optional(),
|
|
4202
4202
|
ai: m.boolean().optional(),
|
|
4203
4203
|
description: m.string().optional(),
|
|
@@ -4206,10 +4206,10 @@ const Ft = (e) => e.visibility === "hidden", Se = (e) => e.visibility === "hidde
|
|
|
4206
4206
|
keywords: m.union([m.string(), m.array(m.string())]).optional(),
|
|
4207
4207
|
author: m.string().optional(),
|
|
4208
4208
|
themeColor: m.string().optional(),
|
|
4209
|
-
og:
|
|
4210
|
-
twitter:
|
|
4209
|
+
og: ea.optional(),
|
|
4210
|
+
twitter: ta.optional(),
|
|
4211
4211
|
jsonLd: m.unknown().optional()
|
|
4212
|
-
}).passthrough(),
|
|
4212
|
+
}).passthrough(), so = m.object({
|
|
4213
4213
|
title: m.string().optional(),
|
|
4214
4214
|
slug: m.string().optional(),
|
|
4215
4215
|
type: m.string().optional(),
|
|
@@ -4240,47 +4240,47 @@ const Ft = (e) => e.visibility === "hidden", Se = (e) => e.visibility === "hidde
|
|
|
4240
4240
|
subscribe: m.boolean().optional(),
|
|
4241
4241
|
feedback: m.boolean().optional(),
|
|
4242
4242
|
styles: m.array(m.string()).optional(),
|
|
4243
|
-
meta:
|
|
4243
|
+
meta: na.optional(),
|
|
4244
4244
|
data: m.record(m.unknown()).optional()
|
|
4245
|
-
}).passthrough(),
|
|
4246
|
-
function
|
|
4245
|
+
}).passthrough(), ro = /* @__PURE__ */ new Set(["doc", "openapi", "changelog", "hero", "fullpage", "404", "section", "tags", "glossary", "team", "pricing", "roadmap", "dbml", "milestone", "epic", "feature", "bug", "component"]), Ne = /* @__PURE__ */ new Map();
|
|
4246
|
+
function oa(e, t) {
|
|
4247
4247
|
Ne.clear();
|
|
4248
4248
|
for (const [n, o] of Object.entries(t)) {
|
|
4249
4249
|
const s = G(e, o), r = s.replace(/\.svelte$/, ".schema.json");
|
|
4250
4250
|
let a;
|
|
4251
4251
|
if (r !== s && fe(r))
|
|
4252
4252
|
try {
|
|
4253
|
-
a = JSON.parse(
|
|
4253
|
+
a = JSON.parse(Ce(r, "utf-8"));
|
|
4254
4254
|
} catch {
|
|
4255
4255
|
console.warn(`[nimpress] page type ${n}: ${r} is not valid json`);
|
|
4256
4256
|
}
|
|
4257
4257
|
Ne.set(n, { file: o, schema: a });
|
|
4258
4258
|
}
|
|
4259
4259
|
}
|
|
4260
|
-
function
|
|
4260
|
+
function sa(e) {
|
|
4261
4261
|
return Array.isArray(e) ? "array" : e === null ? "null" : typeof e;
|
|
4262
4262
|
}
|
|
4263
|
-
function
|
|
4263
|
+
function ra(e, t) {
|
|
4264
4264
|
const n = Ne.get(e)?.schema;
|
|
4265
4265
|
if (!n) return [];
|
|
4266
4266
|
const o = [];
|
|
4267
4267
|
for (const s of n.required ?? [])
|
|
4268
4268
|
t[s] === void 0 && o.push(`type ${e} requires data.${s}`);
|
|
4269
4269
|
for (const [s, r] of Object.entries(n.properties ?? {}))
|
|
4270
|
-
t[s] !== void 0 && r.type &&
|
|
4270
|
+
t[s] !== void 0 && r.type && sa(t[s]) !== r.type && o.push(`type ${e} expects data.${s} to be ${r.type}`);
|
|
4271
4271
|
return o;
|
|
4272
4272
|
}
|
|
4273
|
-
function
|
|
4273
|
+
function ao(e, t = "x") {
|
|
4274
4274
|
const n = [], s = (typeof e == "object" && e !== null ? Object.keys(e) : []).find((d) => d.toLowerCase() === "notoc");
|
|
4275
4275
|
s && n.push(`${s}: write hide: [toc], the hide list carries every element a page drops`);
|
|
4276
|
-
const r =
|
|
4276
|
+
const r = so.safeParse(e);
|
|
4277
4277
|
if (!r.success) {
|
|
4278
4278
|
for (const d of r.error.errors)
|
|
4279
4279
|
n.push(`${d.path.join(".") || "frontmatter"}: ${d.message}`);
|
|
4280
4280
|
return n;
|
|
4281
4281
|
}
|
|
4282
4282
|
const a = r.data;
|
|
4283
|
-
a.type && !
|
|
4283
|
+
a.type && !ro.has(a.type) && !Ne.has(a.type) && n.push(`type: ${a.type} is not a page type; add it under pageTypes in the config`);
|
|
4284
4284
|
const c = a.data ?? {};
|
|
4285
4285
|
if (a.link)
|
|
4286
4286
|
return !a.title && !a.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(a.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;
|
|
@@ -4291,7 +4291,7 @@ function ro(e, t = "x") {
|
|
|
4291
4291
|
const d = c.title === void 0 ? "" : String(c.title);
|
|
4292
4292
|
d.trim() || n.push("changelog requires data.title"), d.length > 48 && n.push("changelog data.title exceeds 48 characters"), d.includes(",") && n.push("changelog data.title must not contain a comma"), c.description !== void 0 && String(c.description).length > 160 && n.push("changelog data.description exceeds 160 characters");
|
|
4293
4293
|
}
|
|
4294
|
-
if ((a.type === "milestone" || a.type === "epic" || a.type === "feature" || a.type === "bug") && (a.description || n.push(`type ${a.type} requires a description`), (c.date === void 0 || Number.isNaN(new Date(String(c.date)).getTime())) && n.push(`type ${a.type} requires a valid data.date`)), a.type && Ne.has(a.type) && n.push(...
|
|
4294
|
+
if ((a.type === "milestone" || a.type === "epic" || a.type === "feature" || a.type === "bug") && (a.description || n.push(`type ${a.type} requires a description`), (c.date === void 0 || Number.isNaN(new Date(String(c.date)).getTime())) && n.push(`type ${a.type} requires a valid data.date`)), a.type && Ne.has(a.type) && n.push(...ra(a.type, c)), a.type === "team") {
|
|
4295
4295
|
const d = Array.isArray(c.members) ? c.members : [];
|
|
4296
4296
|
d.length === 0 && n.push("type team requires data.members with at least one member"), d.forEach((g, w) => {
|
|
4297
4297
|
(typeof g?.name != "string" || !g.name.trim()) && n.push(`type team member ${w + 1} needs a name`);
|
|
@@ -4305,7 +4305,7 @@ function ro(e, t = "x") {
|
|
|
4305
4305
|
}
|
|
4306
4306
|
return a.type === "component" && ((c.system === void 0 || String(c.system).trim() === "") && n.push("type component requires data.system"), (c.component === void 0 || String(c.component).trim() === "") && n.push("type component requires data.component")), n;
|
|
4307
4307
|
}
|
|
4308
|
-
function
|
|
4308
|
+
function aa(e, t) {
|
|
4309
4309
|
const n = (p) => {
|
|
4310
4310
|
const d = String(p ?? "").replace(/^v/i, "").replace(/\+.*$/, ""), g = d.indexOf("-");
|
|
4311
4311
|
return {
|
|
@@ -4315,14 +4315,14 @@ function ra(e, t) {
|
|
|
4315
4315
|
}, o = (p, d) => {
|
|
4316
4316
|
const g = p.match(/\d+|\D+/g) ?? [], w = d.match(/\d+|\D+/g) ?? [];
|
|
4317
4317
|
for (let P = 0; P < Math.max(g.length, w.length); P++) {
|
|
4318
|
-
const A = g[P],
|
|
4318
|
+
const A = g[P], M = w[P];
|
|
4319
4319
|
if (A === void 0) return -1;
|
|
4320
|
-
if (
|
|
4321
|
-
if (/^\d+$/.test(A) && /^\d+$/.test(
|
|
4322
|
-
const h = parseInt(A, 10) - parseInt(
|
|
4320
|
+
if (M === void 0) return 1;
|
|
4321
|
+
if (/^\d+$/.test(A) && /^\d+$/.test(M)) {
|
|
4322
|
+
const h = parseInt(A, 10) - parseInt(M, 10);
|
|
4323
4323
|
if (h !== 0) return h;
|
|
4324
|
-
} else if (A !==
|
|
4325
|
-
return A <
|
|
4324
|
+
} else if (A !== M)
|
|
4325
|
+
return A < M ? -1 : 1;
|
|
4326
4326
|
}
|
|
4327
4327
|
return 0;
|
|
4328
4328
|
}, s = n(e), r = n(t);
|
|
@@ -4343,14 +4343,14 @@ function ra(e, t) {
|
|
|
4343
4343
|
}
|
|
4344
4344
|
return 0;
|
|
4345
4345
|
}
|
|
4346
|
-
function
|
|
4347
|
-
const n =
|
|
4348
|
-
if (!(!n || n.startsWith("..") ||
|
|
4346
|
+
function ia(e, t) {
|
|
4347
|
+
const n = Se(e, t).split(ke).join("/");
|
|
4348
|
+
if (!(!n || n.startsWith("..") || $e(n)))
|
|
4349
4349
|
return `/${n}`;
|
|
4350
4350
|
}
|
|
4351
|
-
function
|
|
4352
|
-
const n =
|
|
4353
|
-
if (n.startsWith("..") ||
|
|
4351
|
+
function io(e, t) {
|
|
4352
|
+
const n = Se(e, t).split(ke).join("/");
|
|
4353
|
+
if (n.startsWith("..") || $e(n))
|
|
4354
4354
|
throw new Error(
|
|
4355
4355
|
`[nimpress] content file is outside contentDir.
|
|
4356
4356
|
contentDir: ${e}
|
|
@@ -4359,20 +4359,20 @@ Check the working directory you run vite from and the contentDir option.`
|
|
|
4359
4359
|
);
|
|
4360
4360
|
return n.replace(/\.md$/, "").replace(/\/index$/, "").replace(/^index$/, "");
|
|
4361
4361
|
}
|
|
4362
|
-
function
|
|
4362
|
+
function ca(e) {
|
|
4363
4363
|
const t = e.lastIndexOf("/");
|
|
4364
4364
|
return t >= 0 ? e.slice(0, t) : "";
|
|
4365
4365
|
}
|
|
4366
|
-
function
|
|
4366
|
+
function la(e) {
|
|
4367
4367
|
return e ? "/" + e : "/";
|
|
4368
4368
|
}
|
|
4369
|
-
function
|
|
4369
|
+
function co(e) {
|
|
4370
4370
|
if (!e) return "/";
|
|
4371
4371
|
let t = e.startsWith("/") ? e : "/" + e;
|
|
4372
4372
|
return t.length > 1 && t.endsWith("/") && (t = t.slice(0, -1)), t;
|
|
4373
4373
|
}
|
|
4374
|
-
function
|
|
4375
|
-
return
|
|
4374
|
+
function pa(e, t, n) {
|
|
4375
|
+
return co(n ?? la(io(e, t)));
|
|
4376
4376
|
}
|
|
4377
4377
|
async function nn(e, t = []) {
|
|
4378
4378
|
let n;
|
|
@@ -4382,7 +4382,7 @@ async function nn(e, t = []) {
|
|
|
4382
4382
|
return t;
|
|
4383
4383
|
}
|
|
4384
4384
|
for (const o of n) {
|
|
4385
|
-
const s =
|
|
4385
|
+
const s = U(e, o.name);
|
|
4386
4386
|
if (o.isDirectory()) {
|
|
4387
4387
|
if (o.name.startsWith(".") || o.name === "node_modules") continue;
|
|
4388
4388
|
await nn(s, t);
|
|
@@ -4396,7 +4396,7 @@ function Ie(e) {
|
|
|
4396
4396
|
function Rt(e) {
|
|
4397
4397
|
return e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
4398
4398
|
}
|
|
4399
|
-
const
|
|
4399
|
+
const Cn = {
|
|
4400
4400
|
ctrl: "Ctrl",
|
|
4401
4401
|
control: "Ctrl",
|
|
4402
4402
|
alt: "Alt",
|
|
@@ -4429,11 +4429,11 @@ const En = {
|
|
|
4429
4429
|
plus: "+",
|
|
4430
4430
|
minus: "−"
|
|
4431
4431
|
};
|
|
4432
|
-
function
|
|
4432
|
+
function ua(e) {
|
|
4433
4433
|
const t = e.trim().toLowerCase();
|
|
4434
|
-
return
|
|
4434
|
+
return Cn[t] ? Cn[t] : t.length === 1 ? t.toUpperCase() : t.charAt(0).toUpperCase() + t.slice(1);
|
|
4435
4435
|
}
|
|
4436
|
-
const
|
|
4436
|
+
const ma = (e, t) => {
|
|
4437
4437
|
const n = e.src, o = e.pos;
|
|
4438
4438
|
if (n.charCodeAt(o) !== 94 || n.charCodeAt(o + 1) !== 94) return !1;
|
|
4439
4439
|
const s = n.indexOf("^^", o + 2);
|
|
@@ -4446,7 +4446,7 @@ const ua = (e, t) => {
|
|
|
4446
4446
|
a.content = r, e.push("ins_close", "ins", -1);
|
|
4447
4447
|
}
|
|
4448
4448
|
return e.pos = s + 2, !0;
|
|
4449
|
-
},
|
|
4449
|
+
}, fa = (e, t) => {
|
|
4450
4450
|
const n = e.src, o = e.pos;
|
|
4451
4451
|
if (n.charCodeAt(o) !== 43 || n.charCodeAt(o + 1) !== 43) return !1;
|
|
4452
4452
|
const s = n.indexOf("++", o + 2);
|
|
@@ -4457,34 +4457,34 @@ const ua = (e, t) => {
|
|
|
4457
4457
|
if (a.length === 0) return !1;
|
|
4458
4458
|
if (!t) {
|
|
4459
4459
|
const c = e.push("html_inline", "", 0);
|
|
4460
|
-
c.content = `<span class="np-keys">${a.map((p) => `<kbd class="np-key">${e.md.utils.escapeHtml(
|
|
4460
|
+
c.content = `<span class="np-keys">${a.map((p) => `<kbd class="np-key">${e.md.utils.escapeHtml(ua(p))}</kbd>`).join('<span class="np-key-join">+</span>')}</span>`;
|
|
4461
4461
|
}
|
|
4462
4462
|
return e.pos = s + 2, !0;
|
|
4463
|
-
},
|
|
4463
|
+
}, da = (e) => {
|
|
4464
4464
|
const t = e.tokens;
|
|
4465
4465
|
for (let n = 0; n + 2 < t.length; n++) {
|
|
4466
4466
|
if (t[n].type !== "paragraph_open" || t[n + 1].type !== "inline" || t[n + 2].type !== "paragraph_close") continue;
|
|
4467
4467
|
const s = (t[n + 1].children ?? []).filter((r) => !(r.type === "text" && r.content.trim() === ""));
|
|
4468
4468
|
s.length !== 1 || s[0].type !== "image" || !s[0].attrGet("title") || (s[0].meta = { ...s[0].meta ?? {}, figure: !0 }, t[n].tag = "figure", t[n + 2].tag = "figure", t[n].attrJoin("class", "np-figure"));
|
|
4469
4469
|
}
|
|
4470
|
-
},
|
|
4471
|
-
function
|
|
4470
|
+
}, ha = /^:([a-z0-9]+(?:-[a-z0-9]+)*):/, ga = In(import.meta.url);
|
|
4471
|
+
function _a() {
|
|
4472
4472
|
try {
|
|
4473
|
-
return Y(
|
|
4473
|
+
return Y(ga.resolve("lucide-static/icons/a-arrow-down.svg"));
|
|
4474
4474
|
} catch {
|
|
4475
4475
|
return G(process.cwd(), "node_modules", "lucide-static", "icons");
|
|
4476
4476
|
}
|
|
4477
4477
|
}
|
|
4478
4478
|
const On = /* @__PURE__ */ new Map();
|
|
4479
|
-
function
|
|
4479
|
+
function lo(e, t) {
|
|
4480
4480
|
const n = `${t ?? ""}:${e}`, o = On.get(n);
|
|
4481
4481
|
if (o !== void 0) return o;
|
|
4482
4482
|
let s = null;
|
|
4483
|
-
e.startsWith("lucide-") ? s =
|
|
4483
|
+
e.startsWith("lucide-") ? s = U(_a(), `${e.slice(7)}.svg`) : t && (s = G(process.cwd(), t, `${e}.svg`));
|
|
4484
4484
|
let r = null;
|
|
4485
|
-
return s && fe(s) && (r =
|
|
4485
|
+
return s && fe(s) && (r = Ce(s, "utf8").replace(/<\?xml[^>]*>/g, "").replace(/<!--[\s\S]*?-->/g, "").replace(/\s+(width|height)="[^"]*"/g, "").replace(/<svg/, '<svg aria-hidden="true" focusable="false"').trim()), On.set(n, r), r;
|
|
4486
4486
|
}
|
|
4487
|
-
function
|
|
4487
|
+
function ya(e) {
|
|
4488
4488
|
const t = [], n = [];
|
|
4489
4489
|
for (const o of e.trim().split(/\s+/).filter(Boolean))
|
|
4490
4490
|
if (o.startsWith(".")) n.push(o.slice(1));
|
|
@@ -4495,17 +4495,17 @@ function _a(e) {
|
|
|
4495
4495
|
}
|
|
4496
4496
|
return n.length && t.push(["class", n.join(" ")]), t;
|
|
4497
4497
|
}
|
|
4498
|
-
function
|
|
4498
|
+
function ba(e) {
|
|
4499
4499
|
return (t, n) => {
|
|
4500
4500
|
if (t.src.charCodeAt(t.pos) !== 58) return !1;
|
|
4501
|
-
const o =
|
|
4501
|
+
const o = ha.exec(t.src.slice(t.pos));
|
|
4502
4502
|
if (!o) return !1;
|
|
4503
|
-
const s = o[1], r =
|
|
4503
|
+
const s = o[1], r = lo(s, e);
|
|
4504
4504
|
if (!r)
|
|
4505
4505
|
return s.startsWith("lucide-") && console.warn(`[nimpress] icon :${s}: is not a lucide icon; the shortcode stays as text`), !1;
|
|
4506
4506
|
let a = t.pos + o[0].length, c = [];
|
|
4507
4507
|
const p = t.src.slice(a), d = /^\{([^}\n]*)\}/.exec(p);
|
|
4508
|
-
if (d && (c =
|
|
4508
|
+
if (d && (c = ya(d[1]), a += d[0].length), !n) {
|
|
4509
4509
|
const g = t.push("np_icon", "span", 0);
|
|
4510
4510
|
g.content = r, g.attrSet("data-icon", s), g.attrJoin("class", "np-icon");
|
|
4511
4511
|
for (const [w, P] of c)
|
|
@@ -4517,7 +4517,7 @@ function ya(e) {
|
|
|
4517
4517
|
function Dn(e) {
|
|
4518
4518
|
return Buffer.from(e, "utf-8").toString("base64");
|
|
4519
4519
|
}
|
|
4520
|
-
const
|
|
4520
|
+
const wa = (e, t, n, o) => {
|
|
4521
4521
|
const s = e.bMarks[t] + e.tShift[t], r = e.eMarks[t];
|
|
4522
4522
|
if (e.src.slice(s, s + 2) !== "$$") return !1;
|
|
4523
4523
|
const a = e.src.slice(s + 2, r);
|
|
@@ -4547,7 +4547,7 @@ const ba = (e, t, n, o) => {
|
|
|
4547
4547
|
const g = e.push("np_math_block", "div", 0);
|
|
4548
4548
|
return g.content = p.join(`
|
|
4549
4549
|
`).trim(), g.map = [t, c + 1], e.line = c + 1, !0;
|
|
4550
|
-
},
|
|
4550
|
+
}, va = (e, t) => {
|
|
4551
4551
|
const n = e.src, o = e.pos;
|
|
4552
4552
|
if (n.charCodeAt(o) !== 36 || n.charCodeAt(o + 1) === 36 || o > 0 && n.charCodeAt(o - 1) === 92) return !1;
|
|
4553
4553
|
const s = n.charCodeAt(o + 1);
|
|
@@ -4572,25 +4572,25 @@ const ba = (e, t, n, o) => {
|
|
|
4572
4572
|
p.content = a;
|
|
4573
4573
|
}
|
|
4574
4574
|
return e.pos = r + 1, !0;
|
|
4575
|
-
},
|
|
4575
|
+
}, ka = /^\*\[([^\]\n]+)\]:[ \t]*(.+?)[ \t]*$/, $a = (e, t, n, o) => {
|
|
4576
4576
|
const s = e.bMarks[t] + e.tShift[t], r = e.eMarks[t];
|
|
4577
4577
|
if (e.src.charCodeAt(s) !== 42 || e.src.charCodeAt(s + 1) !== 91) return !1;
|
|
4578
|
-
const a =
|
|
4578
|
+
const a = ka.exec(e.src.slice(s, r));
|
|
4579
4579
|
if (!a) return !1;
|
|
4580
4580
|
if (o) return !0;
|
|
4581
4581
|
const c = e.env;
|
|
4582
4582
|
return c.abbr = { ...c.abbr ?? {}, [a[1].trim()]: a[2].trim() }, e.line = t + 1, !0;
|
|
4583
4583
|
};
|
|
4584
|
-
function
|
|
4584
|
+
function xa(e) {
|
|
4585
4585
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4586
4586
|
}
|
|
4587
|
-
function
|
|
4587
|
+
function Sa(e) {
|
|
4588
4588
|
return (t) => {
|
|
4589
4589
|
const n = t.env, o = /* @__PURE__ */ new Map();
|
|
4590
4590
|
if (!n.glossaryPage) for (const p of e) o.set(p.term, p.description);
|
|
4591
4591
|
for (const [p, d] of Object.entries(n.abbr ?? {})) o.set(p, d);
|
|
4592
4592
|
if (o.size === 0) return;
|
|
4593
|
-
const s = Array.from(o.entries()).sort((p, d) => d[0].length - p[0].length), r = new Map(s.map(([p]) => [p.toLowerCase(), p])), a = new RegExp(`(^|[^\\p{L}\\p{N}_])(${s.map(([p]) =>
|
|
4593
|
+
const s = Array.from(o.entries()).sort((p, d) => d[0].length - p[0].length), r = new Map(s.map(([p]) => [p.toLowerCase(), p])), a = new RegExp(`(^|[^\\p{L}\\p{N}_])(${s.map(([p]) => xa(p)).join("|")})(?![\\p{L}\\p{N}_])`, "iu"), c = t.tokens;
|
|
4594
4594
|
for (let p = 0; p < c.length; p++) {
|
|
4595
4595
|
const d = c[p];
|
|
4596
4596
|
if (d.type !== "inline" || !d.children || c[p - 1]?.type === "heading_open") continue;
|
|
@@ -4602,46 +4602,46 @@ function xa(e) {
|
|
|
4602
4602
|
P.push(A);
|
|
4603
4603
|
continue;
|
|
4604
4604
|
}
|
|
4605
|
-
let
|
|
4606
|
-
for (;
|
|
4607
|
-
const h = a.exec(
|
|
4605
|
+
let M = A.content;
|
|
4606
|
+
for (; M.length; ) {
|
|
4607
|
+
const h = a.exec(M);
|
|
4608
4608
|
if (!h) break;
|
|
4609
4609
|
const v = h[2], D = r.get(v.toLowerCase()) ?? v;
|
|
4610
4610
|
if (D === D.toUpperCase() && D.length > 1 && v !== D) {
|
|
4611
|
-
const
|
|
4612
|
-
|
|
4611
|
+
const z = new t.Token("text", "", 0);
|
|
4612
|
+
z.content = M.slice(0, h.index + h[1].length + v.length), P.push(z), M = M.slice(h.index + h[1].length + v.length);
|
|
4613
4613
|
continue;
|
|
4614
4614
|
}
|
|
4615
4615
|
const x = h.index + h[1].length;
|
|
4616
4616
|
if (g.has(D)) {
|
|
4617
|
-
const
|
|
4618
|
-
|
|
4617
|
+
const z = new t.Token("text", "", 0);
|
|
4618
|
+
z.content = M.slice(0, x + v.length), P.push(z), M = M.slice(x + v.length);
|
|
4619
4619
|
continue;
|
|
4620
4620
|
}
|
|
4621
4621
|
if (g.add(D), x > 0) {
|
|
4622
|
-
const
|
|
4623
|
-
|
|
4622
|
+
const z = new t.Token("text", "", 0);
|
|
4623
|
+
z.content = M.slice(0, x), P.push(z);
|
|
4624
4624
|
}
|
|
4625
|
-
const
|
|
4626
|
-
|
|
4627
|
-
const
|
|
4628
|
-
|
|
4625
|
+
const E = new t.Token("abbr_open", "abbr", 1);
|
|
4626
|
+
E.attrSet("class", "np-abbr np-tip"), E.attrSet("aria-label", o.get(D) ?? ""), P.push(E);
|
|
4627
|
+
const F = new t.Token("text", "", 0);
|
|
4628
|
+
F.content = v, P.push(F), P.push(new t.Token("abbr_close", "abbr", -1)), M = M.slice(x + v.length);
|
|
4629
4629
|
}
|
|
4630
|
-
if (
|
|
4630
|
+
if (M.length) {
|
|
4631
4631
|
const h = new t.Token("text", "", 0);
|
|
4632
|
-
h.content =
|
|
4632
|
+
h.content = M, P.push(h);
|
|
4633
4633
|
}
|
|
4634
4634
|
}
|
|
4635
4635
|
d.children = P;
|
|
4636
4636
|
}
|
|
4637
4637
|
};
|
|
4638
4638
|
}
|
|
4639
|
-
const
|
|
4639
|
+
const ja = (e) => {
|
|
4640
4640
|
if (!e.env.glossaryPage) return;
|
|
4641
4641
|
const n = e.tokens;
|
|
4642
4642
|
for (let o = 0; o + 1 < n.length; o++)
|
|
4643
4643
|
n[o].type !== "dt_open" || n[o + 1].type !== "inline" || (n[o].attrSet("id", `term-${Ie(n[o + 1].content)}`), n[o].attrJoin("class", "np-glossary-term"));
|
|
4644
|
-
},
|
|
4644
|
+
}, Pa = (e) => {
|
|
4645
4645
|
const t = e.tokens, n = /* @__PURE__ */ new Map();
|
|
4646
4646
|
for (let o = 0; o < t.length; o++) {
|
|
4647
4647
|
if (t[o].type !== "footnote_open") continue;
|
|
@@ -4658,7 +4658,7 @@ const Sa = (e) => {
|
|
|
4658
4658
|
r && (s.meta = { ...s.meta, tip: r });
|
|
4659
4659
|
}
|
|
4660
4660
|
};
|
|
4661
|
-
function
|
|
4661
|
+
function Aa(e, t) {
|
|
4662
4662
|
const n = e.parse(t, {}), o = [];
|
|
4663
4663
|
let s = "";
|
|
4664
4664
|
for (let r = 0; r + 1 < n.length; r++) {
|
|
@@ -4676,12 +4676,12 @@ function Pa(e, t) {
|
|
|
4676
4676
|
return o;
|
|
4677
4677
|
}
|
|
4678
4678
|
const vi = ["prose", "page", "callout", "code", "code-group", "tabs", "cards", "card", "features", "feature", "actions", "action", "hero", "fullpage", "section", "tags", "tag", "footer", "announce", "feedback", "header", "sidebar", "toc", "crumbs", "search", "mermaid", "dbml", "op", "changelog", "roadmap", "team", "pricing", "glossary", "notfound", "math", "icon", "figure", "keys", "lightbox", "abbr", "img", "page-actions"];
|
|
4679
|
-
function
|
|
4679
|
+
function Mn(e, t) {
|
|
4680
4680
|
return `@scope (.np-${e}) {
|
|
4681
4681
|
${t}
|
|
4682
4682
|
}`;
|
|
4683
4683
|
}
|
|
4684
|
-
function
|
|
4684
|
+
function Ea(e, t) {
|
|
4685
4685
|
const n = new RegExp(`^${t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\.([a-z0-9-]+)\\.css$`).exec(e);
|
|
4686
4686
|
return n ? n[1] : null;
|
|
4687
4687
|
}
|
|
@@ -4689,7 +4689,7 @@ const Ca = new Set("a an the and or but if then else of to in on at by for with
|
|
|
4689
4689
|
function Bt(e) {
|
|
4690
4690
|
return e.toLowerCase().replace(/```[\s\S]*?```/g, " ").replace(/`[^`]*`/g, " ").replace(/[^\p{L}\p{N}\s-]/gu, " ").split(/\s+/).map((t) => t.replace(/^-+|-+$/g, "")).filter((t) => t.length > 2 && !Ca.has(t) && !/^\d+$/.test(t));
|
|
4691
4691
|
}
|
|
4692
|
-
function
|
|
4692
|
+
function Oa(e) {
|
|
4693
4693
|
const t = e.replace(/```[\s\S]*?```/g, "").replace(/^:{3,}.*$/gm, "").replace(/^\s*[#>|-].*$/gm, "").split(/\n\s*\n/).map((s) => s.replace(/\s+/g, " ").trim()).find((s) => s.length > 40 && !s.startsWith("!") && !s.startsWith("<"));
|
|
4694
4694
|
if (!t) return "";
|
|
4695
4695
|
const n = t.replace(/\[([^\]]+)\]\([^)]*\)/g, "$1").replace(/[*_`~^=]+/g, "");
|
|
@@ -4697,7 +4697,7 @@ function Ea(e) {
|
|
|
4697
4697
|
const o = n.slice(0, 157);
|
|
4698
4698
|
return `${o.slice(0, Math.max(o.lastIndexOf(" "), 100))}…`;
|
|
4699
4699
|
}
|
|
4700
|
-
function
|
|
4700
|
+
function Da(e) {
|
|
4701
4701
|
const t = /* @__PURE__ */ new Map(), n = e.map((r) => {
|
|
4702
4702
|
const a = /* @__PURE__ */ new Map(), c = (p, d) => {
|
|
4703
4703
|
for (const g of p) a.set(g, (a.get(g) ?? 0) + d);
|
|
@@ -4713,15 +4713,15 @@ function Oa(e) {
|
|
|
4713
4713
|
if (p.length >= 8) break;
|
|
4714
4714
|
p.some((g) => g.toLowerCase() === d.word) || p.push(d.word);
|
|
4715
4715
|
}
|
|
4716
|
-
s.set(r.slug, { keywords: p, description:
|
|
4716
|
+
s.set(r.slug, { keywords: p, description: Oa(r.body) });
|
|
4717
4717
|
}
|
|
4718
4718
|
return s;
|
|
4719
4719
|
}
|
|
4720
|
-
function
|
|
4720
|
+
function Ma(e, t, n) {
|
|
4721
4721
|
return n === !1 || t === !1 && n !== !0 ? `${e}, noai, noimageai` : e;
|
|
4722
4722
|
}
|
|
4723
|
-
function
|
|
4724
|
-
const s = new
|
|
4723
|
+
function Tn(e, t = { route: "/_components" }, n = "/", o = { math: !0 }) {
|
|
4724
|
+
const s = new Rn({
|
|
4725
4725
|
html: !0,
|
|
4726
4726
|
linkify: !0,
|
|
4727
4727
|
typographer: !1,
|
|
@@ -4732,13 +4732,13 @@ function Mn(e, t = { route: "/_components" }, n = "/", o = { math: !0 }) {
|
|
|
4732
4732
|
zsh: "bash",
|
|
4733
4733
|
console: "bash",
|
|
4734
4734
|
hurl: "http"
|
|
4735
|
-
},
|
|
4735
|
+
}, E = ((D ? D.match(/\[([^\]]+)\]/) : null)?.[1].trim() || v || "text").trim(), F = R[v] ?? v, z = F && e.getLoadedLanguages().includes(F) ? F : "text", Q = Na(D ?? ""), re = Ia(E, Q), he = po.test(h) ? { includeExplanation: "scopeName" } : {};
|
|
4736
4736
|
try {
|
|
4737
4737
|
return e.codeToHtml(h, {
|
|
4738
4738
|
...he,
|
|
4739
|
-
lang:
|
|
4739
|
+
lang: z,
|
|
4740
4740
|
theme: "github-dark",
|
|
4741
|
-
transformers: [
|
|
4741
|
+
transformers: [Ba(re, Q)]
|
|
4742
4742
|
});
|
|
4743
4743
|
} catch {
|
|
4744
4744
|
return `<pre ${Object.entries(re).map(([ge, oe]) => `${ge}="${s.utils.escapeHtml(oe)}"`).join(" ")}><code>${s.utils.escapeHtml(h)}</code></pre>`;
|
|
@@ -4746,57 +4746,57 @@ function Mn(e, t = { route: "/_components" }, n = "/", o = { math: !0 }) {
|
|
|
4746
4746
|
}
|
|
4747
4747
|
}), r = (h, v, D, R, x) => x.renderToken(h, v, D), a = s.renderer.rules.fence ?? r;
|
|
4748
4748
|
s.renderer.rules.fence = (h, v, D, R, x) => {
|
|
4749
|
-
const
|
|
4750
|
-
if (!
|
|
4751
|
-
const
|
|
4752
|
-
if (!
|
|
4753
|
-
let
|
|
4754
|
-
for (;
|
|
4755
|
-
if (
|
|
4756
|
-
const
|
|
4757
|
-
let re = Number(
|
|
4758
|
-
for (let te = v + 2; te <
|
|
4759
|
-
if (h[te].type !== "list_item_open" || h[te].level !==
|
|
4749
|
+
const E = a(h, v, D, R, x);
|
|
4750
|
+
if (!E.includes("np-code-annotation")) return E;
|
|
4751
|
+
const F = h[v + 1];
|
|
4752
|
+
if (!F || F.type !== "ordered_list_open") return E;
|
|
4753
|
+
let z = v + 2;
|
|
4754
|
+
for (; z < h.length && !(h[z].type === "ordered_list_close" && h[z].level === F.level); ) z += 1;
|
|
4755
|
+
if (z >= h.length) return E;
|
|
4756
|
+
const Q = {};
|
|
4757
|
+
let re = Number(F.attrGet("start") ?? 1);
|
|
4758
|
+
for (let te = v + 2; te < z; te++) {
|
|
4759
|
+
if (h[te].type !== "list_item_open" || h[te].level !== F.level + 1) continue;
|
|
4760
4760
|
let ge = te + 1;
|
|
4761
|
-
for (; ge <
|
|
4762
|
-
|
|
4761
|
+
for (; ge < z && !(h[ge].type === "list_item_close" && h[ge].level === h[te].level); ) ge += 1;
|
|
4762
|
+
Q[String(re)] = x.render(h.slice(te + 1, ge), D, R).trim(), re += 1, te = ge;
|
|
4763
4763
|
}
|
|
4764
|
-
for (let te = v + 1; te <=
|
|
4765
|
-
const he = Buffer.from(JSON.stringify(
|
|
4766
|
-
return
|
|
4764
|
+
for (let te = v + 1; te <= z; te++) h[te].type = "np_annotation_list";
|
|
4765
|
+
const he = Buffer.from(JSON.stringify(Q), "utf-8").toString("base64");
|
|
4766
|
+
return E.replace("<pre ", `<pre data-annotations="${he}" `);
|
|
4767
4767
|
}, s.renderer.rules.np_annotation_list = () => "";
|
|
4768
4768
|
const c = s.renderer.rules.link_open ?? r;
|
|
4769
4769
|
s.renderer.rules.link_open = (h, v, D, R, x) => {
|
|
4770
|
-
const
|
|
4771
|
-
|
|
4772
|
-
const
|
|
4773
|
-
return
|
|
4770
|
+
const E = h[v].attrGet("href");
|
|
4771
|
+
E && h[v].attrSet("href", we(n, E));
|
|
4772
|
+
const F = h[v].attrGet("title");
|
|
4773
|
+
return F && (h[v].attrs = (h[v].attrs ?? []).filter(([z]) => z !== "title"), h[v].attrJoin("class", "np-tip"), h[v].attrSet("aria-label", F)), c(h, v, D, R, x);
|
|
4774
4774
|
};
|
|
4775
4775
|
const p = s.renderer.rules.image ?? r;
|
|
4776
4776
|
s.renderer.rules.image = (h, v, D, R, x) => {
|
|
4777
|
-
const
|
|
4778
|
-
if (
|
|
4779
|
-
const te = /#only-(light|dark)$/.exec(
|
|
4780
|
-
te ? (
|
|
4777
|
+
const E = h[v], F = E.attrGet("src");
|
|
4778
|
+
if (F) {
|
|
4779
|
+
const te = /#only-(light|dark)$/.exec(F);
|
|
4780
|
+
te ? (E.attrSet("src", we(n, F.slice(0, -te[0].length))), E.attrJoin("class", `np-img-${te[1]}`)) : E.attrSet("src", we(n, F));
|
|
4781
4781
|
}
|
|
4782
|
-
const
|
|
4783
|
-
(
|
|
4784
|
-
const
|
|
4785
|
-
|
|
4786
|
-
const re = p(h, v, D, R, x), he =
|
|
4782
|
+
const z = E.attrGet("align");
|
|
4783
|
+
(z === "left" || z === "right") && (E.attrs = (E.attrs ?? []).filter(([te]) => te !== "align"), E.attrJoin("class", `np-img-${z}`));
|
|
4784
|
+
const Q = R;
|
|
4785
|
+
Q.imageCount = (Q.imageCount ?? 0) + 1, Q.imageCount > 1 && !E.attrGet("loading") && E.attrSet("loading", "lazy");
|
|
4786
|
+
const re = p(h, v, D, R, x), he = E.meta?.figure ? E.attrGet("title") : null;
|
|
4787
4787
|
return he ? `${re}<figcaption class="np-figcaption">${s.utils.escapeHtml(he)}</figcaption>` : re;
|
|
4788
4788
|
}, s.use(dn, {
|
|
4789
4789
|
slugify: Ie,
|
|
4790
4790
|
permalink: dn.permalink.headerLink({ safariReaderFix: !0 })
|
|
4791
|
-
}), s.use(
|
|
4791
|
+
}), s.use(Lo), s.use(Bn), s.use(zo), s.use(qo, { enabled: !0 }), s.use(gs), s.inline.ruler.before("emphasis", "np_ins", ma), s.renderer.rules.s_open = () => "<del>", s.renderer.rules.s_close = () => "</del>", s.use(bs), s.use(ks), s.inline.ruler.before("emphasis", "np_keys", fa), s.core.ruler.push("np_figures", da), s.block.ruler.before("reference", "np_abbr_definition", $a, { alt: ["paragraph", "reference", "blockquote", "list"] }), s.core.ruler.after("inline", "np_abbr", Sa(o.glossary ?? [])), s.core.ruler.push("np_glossary_anchors", ja), s.core.ruler.after("footnote_tail", "np_footnote_tips", Pa);
|
|
4792
4792
|
const d = s.renderer.rules.footnote_ref ?? r;
|
|
4793
4793
|
s.renderer.rules.footnote_ref = (h, v, D, R, x) => {
|
|
4794
|
-
const
|
|
4795
|
-
return
|
|
4796
|
-
}, s.inline.ruler.before("emphasis", "np_icon",
|
|
4794
|
+
const E = String(h[v].meta?.tip ?? ""), F = d(h, v, D, R, x);
|
|
4795
|
+
return E ? F.replace('<sup class="footnote-ref">', `<sup class="footnote-ref np-tip" aria-label="${s.utils.escapeHtml(E)}">`) : F;
|
|
4796
|
+
}, s.inline.ruler.before("emphasis", "np_icon", ba(o.icons)), s.use(Cs), s.renderer.rules.np_icon = (h, v, D, R, x) => `<span${x.renderAttrs(h[v])}>${h[v].content}</span>`, o.math !== !1 && (s.block.ruler.before("fence", "np_math_block", wa, { alt: ["paragraph", "reference", "blockquote", "list"] }), s.inline.ruler.before("emphasis", "np_math_inline", va), s.renderer.rules.np_math_block = (h, v) => `<div class="np-math np-math-display" data-math="${Dn(h[v].content)}"></div>
|
|
4797
4797
|
`, s.renderer.rules.np_math_inline = (h, v) => `<span class="np-math" data-math="${Dn(h[v].content)}"></span>`);
|
|
4798
4798
|
const g = (h, v) => {
|
|
4799
|
-
s.use(
|
|
4799
|
+
s.use(Ho, h, v);
|
|
4800
4800
|
}, w = [
|
|
4801
4801
|
"tip",
|
|
4802
4802
|
"note",
|
|
@@ -4812,14 +4812,14 @@ function Mn(e, t = { route: "/_components" }, n = "/", o = { math: !0 }) {
|
|
|
4812
4812
|
"example",
|
|
4813
4813
|
"quote"
|
|
4814
4814
|
], P = (h) => h[0].toUpperCase() + h.slice(1), A = (h, v) => {
|
|
4815
|
-
const D = h.trim().slice(v.length).trim(), R = D.indexOf("{"), x = R >= 0 ? Oe(D.slice(R), h) : {},
|
|
4815
|
+
const D = h.trim().slice(v.length).trim(), R = D.indexOf("{"), x = R >= 0 ? Oe(D.slice(R), h) : {}, E = (R >= 0 ? D.slice(0, R) : D).trim();
|
|
4816
4816
|
return {
|
|
4817
|
-
title:
|
|
4817
|
+
title: E === '""' ? "" : E || P(v),
|
|
4818
4818
|
collapsible: x.collapsible === !0,
|
|
4819
4819
|
open: x.open === !0,
|
|
4820
4820
|
inline: x.inline === "start" || x.inline === "end" ? x.inline : ""
|
|
4821
4821
|
};
|
|
4822
|
-
},
|
|
4822
|
+
}, M = (h, v, D) => {
|
|
4823
4823
|
let R = 0;
|
|
4824
4824
|
for (let x = v - 1; x >= 0; x--)
|
|
4825
4825
|
if (h[x].type === `container_${D}_close`) R++;
|
|
@@ -4833,12 +4833,12 @@ function Mn(e, t = { route: "/_components" }, n = "/", o = { math: !0 }) {
|
|
|
4833
4833
|
g(h, {
|
|
4834
4834
|
render(v, D) {
|
|
4835
4835
|
if (v[D].nesting !== 1)
|
|
4836
|
-
return A(
|
|
4837
|
-
const { title: R, collapsible: x, open:
|
|
4836
|
+
return A(M(v, D, h).info, h).collapsible ? "</div></details>" : "</div></div>";
|
|
4837
|
+
const { title: R, collapsible: x, open: E, inline: F } = A(v[D].info, h), z = `np-callout np-callout-${h}${x ? " np-callout-collapsible" : ""}${F ? ` np-callout-inline np-callout-inline-${F}` : ""}`;
|
|
4838
4838
|
if (x)
|
|
4839
|
-
return `<details class="${
|
|
4840
|
-
const
|
|
4841
|
-
return `<div class="${
|
|
4839
|
+
return `<details class="${z}"${E ? " open" : ""}><summary class="np-callout-title">${s.utils.escapeHtml(R || P(h))}</summary><div class="np-callout-body">`;
|
|
4840
|
+
const Q = R ? `<div class="np-callout-title">${s.utils.escapeHtml(R)}</div>` : "";
|
|
4841
|
+
return `<div class="${z}"><div class="np-callout-body">${Q}`;
|
|
4842
4842
|
}
|
|
4843
4843
|
});
|
|
4844
4844
|
return g("cards", {
|
|
@@ -4872,26 +4872,26 @@ function Mn(e, t = { route: "/_components" }, n = "/", o = { math: !0 }) {
|
|
|
4872
4872
|
}
|
|
4873
4873
|
}), s.core.ruler.before("inline", "nimpress_tabs", (h) => {
|
|
4874
4874
|
const v = h.tokens, D = [], R = (x) => {
|
|
4875
|
-
const
|
|
4876
|
-
return
|
|
4875
|
+
const E = new h.Token("html_block", "", 0);
|
|
4876
|
+
return E.content = x, E.block = !0, E;
|
|
4877
4877
|
};
|
|
4878
4878
|
for (let x = 0; x < v.length; x++) {
|
|
4879
|
-
const
|
|
4880
|
-
if (
|
|
4879
|
+
const E = v[x];
|
|
4880
|
+
if (E.type === "container_tabs_open") {
|
|
4881
4881
|
D.push(!1);
|
|
4882
4882
|
continue;
|
|
4883
4883
|
}
|
|
4884
|
-
if (
|
|
4884
|
+
if (E.type === "container_tabs_close") {
|
|
4885
4885
|
D.pop() && v.splice(x++, 0, R("</div>"));
|
|
4886
4886
|
continue;
|
|
4887
4887
|
}
|
|
4888
|
-
if (D.length === 0 ||
|
|
4889
|
-
const
|
|
4890
|
-
if (!
|
|
4891
|
-
const
|
|
4892
|
-
`${re}<div class="np-tabs-panel" data-label="${s.utils.escapeHtml(
|
|
4888
|
+
if (D.length === 0 || E.type !== "paragraph_open") continue;
|
|
4889
|
+
const F = v[x + 1], z = F?.type === "inline" ? F.content.match(/^::tab[ \t]+(.+?)[ \t]*(?:\n([\s\S]*))?$/) : null;
|
|
4890
|
+
if (!z) continue;
|
|
4891
|
+
const Q = z[1], re = D[D.length - 1] ? "</div>" : "", he = R(
|
|
4892
|
+
`${re}<div class="np-tabs-panel" data-label="${s.utils.escapeHtml(Q)}" data-id="tab-${Ie(Q)}">`
|
|
4893
4893
|
);
|
|
4894
|
-
D[D.length - 1] = !0,
|
|
4894
|
+
D[D.length - 1] = !0, z[2] === void 0 ? v.splice(x, 3, he) : (F.content = z[2], v.splice(x, 0, he), x++);
|
|
4895
4895
|
}
|
|
4896
4896
|
}), g("actions", {
|
|
4897
4897
|
render(h, v) {
|
|
@@ -4913,7 +4913,7 @@ function Mn(e, t = { route: "/_components" }, n = "/", o = { math: !0 }) {
|
|
|
4913
4913
|
render(h, v) {
|
|
4914
4914
|
if (h[v].nesting === 1) {
|
|
4915
4915
|
const D = h[v].info.trim().slice(7).trim(), R = D ? Oe(D, h[v].info) : {};
|
|
4916
|
-
return `<div class="np-feature" data-config="${
|
|
4916
|
+
return `<div class="np-feature" data-config="${nt(JSON.stringify(R))}"><div class="np-feature-body">`;
|
|
4917
4917
|
}
|
|
4918
4918
|
return "</div></div>";
|
|
4919
4919
|
}
|
|
@@ -4921,13 +4921,13 @@ function Mn(e, t = { route: "/_components" }, n = "/", o = { math: !0 }) {
|
|
|
4921
4921
|
render(h, v) {
|
|
4922
4922
|
if (h[v].nesting === 1) {
|
|
4923
4923
|
const D = h[v].info.trim().slice(9).trim(), R = D.startsWith("{") ? Oe(D, h[v].info) : D ? { component: D } : {};
|
|
4924
|
-
return `<div class="np-component-embed" data-embed="${
|
|
4924
|
+
return `<div class="np-component-embed" data-embed="${nt(JSON.stringify({ ...t, ...R }))}"><div class="np-component-embed-body">`;
|
|
4925
4925
|
}
|
|
4926
4926
|
return "</div></div>";
|
|
4927
4927
|
}
|
|
4928
4928
|
}), s;
|
|
4929
4929
|
}
|
|
4930
|
-
const
|
|
4930
|
+
const po = /\((\d+)\)(!?)[ \t]*$/m;
|
|
4931
4931
|
function Ta(e) {
|
|
4932
4932
|
const t = /* @__PURE__ */ new Set(), n = Array.isArray(e) ? e : typeof e == "string" ? e.split(",") : typeof e == "number" ? [e] : [];
|
|
4933
4933
|
for (const o of n) {
|
|
@@ -4938,7 +4938,7 @@ function Ta(e) {
|
|
|
4938
4938
|
}
|
|
4939
4939
|
return t;
|
|
4940
4940
|
}
|
|
4941
|
-
function
|
|
4941
|
+
function Na(e) {
|
|
4942
4942
|
const t = e.indexOf("{"), n = t >= 0 ? Oe(e.slice(t), e) : {}, o = typeof n.start == "number" && Number.isInteger(n.start) ? n.start : 1;
|
|
4943
4943
|
return {
|
|
4944
4944
|
title: typeof n.title == "string" ? n.title.trim() : "",
|
|
@@ -4947,19 +4947,19 @@ function Ma(e) {
|
|
|
4947
4947
|
highlight: Ta(n.highlight)
|
|
4948
4948
|
};
|
|
4949
4949
|
}
|
|
4950
|
-
function
|
|
4950
|
+
function Ia(e, t) {
|
|
4951
4951
|
const n = { "data-lang": e };
|
|
4952
4952
|
return t.title && (n["data-title"] = t.title), t.lines && (n["data-lines"] = "true", n["data-start"] = String(t.start)), n;
|
|
4953
4953
|
}
|
|
4954
|
-
function
|
|
4954
|
+
function Fa(e) {
|
|
4955
4955
|
const t = e.explanation ?? [];
|
|
4956
4956
|
return t.length > 0 && t.every(
|
|
4957
4957
|
(n) => n.scopes.some((o) => /(^|\.)comment(\.|$)/.test(o.scopeName)) && !n.scopes.some((o) => o.scopeName.startsWith("markup.fenced_code") || o.scopeName.startsWith("markup.raw"))
|
|
4958
4958
|
);
|
|
4959
4959
|
}
|
|
4960
|
-
function
|
|
4960
|
+
function Ra(e) {
|
|
4961
4961
|
let t = e.length;
|
|
4962
|
-
for (; t > 0 &&
|
|
4962
|
+
for (; t > 0 && Fa(e[t - 1]); ) t -= 1;
|
|
4963
4963
|
if (t === e.length) return e;
|
|
4964
4964
|
const n = e.slice(t).flatMap(
|
|
4965
4965
|
(w) => (w.explanation ?? []).map((P) => ({
|
|
@@ -4972,7 +4972,7 @@ function Fa(e) {
|
|
|
4972
4972
|
let o = n.length - 1;
|
|
4973
4973
|
for (; o >= 0 && (n[o].punctuation || !n[o].text.trim()); ) o -= 1;
|
|
4974
4974
|
if (o < 0) return e;
|
|
4975
|
-
const s =
|
|
4975
|
+
const s = po.exec(n[o].text);
|
|
4976
4976
|
if (!s) return e;
|
|
4977
4977
|
const r = s[2] === "!";
|
|
4978
4978
|
n[o].text = n[o].text.slice(0, s.index);
|
|
@@ -4988,11 +4988,11 @@ function Fa(e) {
|
|
|
4988
4988
|
});
|
|
4989
4989
|
return [...e.slice(0, t), ...p.map(g), a, ...d.map(g)];
|
|
4990
4990
|
}
|
|
4991
|
-
function
|
|
4991
|
+
function Ba(e, t) {
|
|
4992
4992
|
return {
|
|
4993
4993
|
name: "nimpress:code-fence",
|
|
4994
4994
|
tokens(n) {
|
|
4995
|
-
return n.map(
|
|
4995
|
+
return n.map(Ra);
|
|
4996
4996
|
},
|
|
4997
4997
|
pre(n) {
|
|
4998
4998
|
n.properties.style = String(n.properties.style ?? "").replace(/background-color:[^;]*;?/, "");
|
|
@@ -5014,17 +5014,17 @@ function Oe(e, t) {
|
|
|
5014
5014
|
return console.warn(`[nimpress] invalid JSON in directive: ${t}`), {};
|
|
5015
5015
|
}
|
|
5016
5016
|
}
|
|
5017
|
-
function
|
|
5017
|
+
function nt(e) {
|
|
5018
5018
|
return e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
5019
5019
|
}
|
|
5020
|
-
function
|
|
5020
|
+
function Wa(e) {
|
|
5021
5021
|
return `<div class="np-mermaid" data-graph="${Buffer.from(e, "utf-8").toString("base64")}"></div>`;
|
|
5022
5022
|
}
|
|
5023
|
-
function
|
|
5023
|
+
function La(e, t, n) {
|
|
5024
5024
|
const o = t.startsWith("{") ? Oe(t, t) : {};
|
|
5025
5025
|
let s = "", r = "";
|
|
5026
5026
|
try {
|
|
5027
|
-
s =
|
|
5027
|
+
s = Un(e);
|
|
5028
5028
|
} catch (d) {
|
|
5029
5029
|
r = d instanceof Kt ? d.message : String(d), console.warn(`[nimpress] invalid dbml in ${n}:
|
|
5030
5030
|
${r}`);
|
|
@@ -5032,11 +5032,11 @@ ${r}`);
|
|
|
5032
5032
|
const a = Buffer.from(s, "utf-8").toString("base64"), c = typeof o.height == "string" ? o.height : "";
|
|
5033
5033
|
return `<div class="np-dbml" ${[
|
|
5034
5034
|
`data-schema="${a}"`,
|
|
5035
|
-
r ? `data-error="${
|
|
5036
|
-
c ? `data-height="${
|
|
5035
|
+
r ? `data-error="${nt(r)}"` : "",
|
|
5036
|
+
c ? `data-height="${nt(c)}"` : ""
|
|
5037
5037
|
].filter(Boolean).join(" ")}></div>`;
|
|
5038
5038
|
}
|
|
5039
|
-
function
|
|
5039
|
+
function Ha(e, t) {
|
|
5040
5040
|
const n = e.split(`
|
|
5041
5041
|
`), o = [];
|
|
5042
5042
|
let s = 0;
|
|
@@ -5051,13 +5051,13 @@ function La(e, t) {
|
|
|
5051
5051
|
for (; g < n.length && !d.test(n[g]); ) g += 1;
|
|
5052
5052
|
const w = p.trim(), P = w.split(/\s+/)[0].toLowerCase(), A = n.slice(s + 1, g).join(`
|
|
5053
5053
|
`);
|
|
5054
|
-
P === "mermaid" ? o.push(`${a}${
|
|
5055
|
-
`)}`) : P === "dbml" ? o.push(`${a}${
|
|
5054
|
+
P === "mermaid" ? o.push(`${a}${Wa(A && `${A}
|
|
5055
|
+
`)}`) : P === "dbml" ? o.push(`${a}${La(A, w.slice(P.length).trim(), t)}`) : o.push(...n.slice(s, Math.min(g + 1, n.length))), s = g + 1;
|
|
5056
5056
|
}
|
|
5057
5057
|
return o.join(`
|
|
5058
5058
|
`);
|
|
5059
5059
|
}
|
|
5060
|
-
function
|
|
5060
|
+
function za(e) {
|
|
5061
5061
|
if (!e) return "";
|
|
5062
5062
|
const t = [], n = (s) => {
|
|
5063
5063
|
if (s)
|
|
@@ -5068,14 +5068,14 @@ function Ha(e) {
|
|
|
5068
5068
|
const o = t.join("").trim();
|
|
5069
5069
|
return o || (e.content ?? "").trim();
|
|
5070
5070
|
}
|
|
5071
|
-
function
|
|
5071
|
+
function qa(e, t) {
|
|
5072
5072
|
const n = e.parse(t, {}), o = [];
|
|
5073
5073
|
let s = 0;
|
|
5074
5074
|
const r = /* @__PURE__ */ new Map();
|
|
5075
5075
|
for (let a = 0; a < n.length; a++) {
|
|
5076
5076
|
const c = n[a];
|
|
5077
5077
|
if (c.type === "heading_open") {
|
|
5078
|
-
const p = parseInt(c.tag.slice(1)), d = n[a + 1], g =
|
|
5078
|
+
const p = parseInt(c.tag.slice(1)), d = n[a + 1], g = za(d) || `heading-${s++}`;
|
|
5079
5079
|
let w = Ie(g);
|
|
5080
5080
|
w || (w = `heading-${s++}`);
|
|
5081
5081
|
const P = r.get(w);
|
|
@@ -5089,10 +5089,10 @@ function za(e, t) {
|
|
|
5089
5089
|
}
|
|
5090
5090
|
return o;
|
|
5091
5091
|
}
|
|
5092
|
-
function
|
|
5092
|
+
function Nn(e) {
|
|
5093
5093
|
return e.frontmatter.slug ?? e.frontmatter.title;
|
|
5094
5094
|
}
|
|
5095
|
-
function
|
|
5095
|
+
function Ve(e) {
|
|
5096
5096
|
return e ? e.replace(/[-_]/g, " ").replace(/\b\w/g, (t) => t.toUpperCase()) : "";
|
|
5097
5097
|
}
|
|
5098
5098
|
function Ut(e) {
|
|
@@ -5104,15 +5104,15 @@ function Ut(e) {
|
|
|
5104
5104
|
t.items && Ut(t.items);
|
|
5105
5105
|
}
|
|
5106
5106
|
function Ua(e) {
|
|
5107
|
-
let t =
|
|
5107
|
+
let t = Ke, n = G(process.cwd(), Ke.contentDir), o = G(process.cwd(), Ke.assetsDir), s = /* @__PURE__ */ new Map(), r = null, a = G(process.cwd(), "dist"), c = !1, p = null;
|
|
5108
5108
|
const d = /* @__PURE__ */ new Map();
|
|
5109
5109
|
let g = [], w = "";
|
|
5110
|
-
const P = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Set(),
|
|
5110
|
+
const P = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Set(), M = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Set();
|
|
5111
5111
|
function v(i) {
|
|
5112
|
-
return
|
|
5112
|
+
return Fn("sha1").update(i).digest("hex");
|
|
5113
5113
|
}
|
|
5114
5114
|
async function D() {
|
|
5115
|
-
return r || (r = await
|
|
5115
|
+
return r || (r = await Jo({
|
|
5116
5116
|
themes: ["github-dark"],
|
|
5117
5117
|
langs: [
|
|
5118
5118
|
"ts",
|
|
@@ -5139,43 +5139,43 @@ function Ua(e) {
|
|
|
5139
5139
|
}), r);
|
|
5140
5140
|
}
|
|
5141
5141
|
function R(i, l) {
|
|
5142
|
-
return /\.ya?ml$/i.test(l) ?
|
|
5142
|
+
return /\.ya?ml$/i.test(l) ? Wn(i) : JSON.parse(i);
|
|
5143
5143
|
}
|
|
5144
5144
|
async function x(i, l) {
|
|
5145
5145
|
try {
|
|
5146
|
-
const u =
|
|
5147
|
-
return await
|
|
5146
|
+
const u = $e(l) ? l : G(Y(i), l), b = await ce(u, "utf-8"), k = R(b, u);
|
|
5147
|
+
return await E(k, Y(u)), k;
|
|
5148
5148
|
} catch (u) {
|
|
5149
5149
|
return console.warn(`[nimpress] failed to load spec ${l} for ${i}:`, u), null;
|
|
5150
5150
|
}
|
|
5151
5151
|
}
|
|
5152
|
-
async function
|
|
5152
|
+
async function E(i, l) {
|
|
5153
5153
|
if (!i || typeof i != "object") return;
|
|
5154
5154
|
i.components || (i.components = {}), i.components.schemas || (i.components.schemas = {});
|
|
5155
5155
|
const u = i.components.schemas, b = /* @__PURE__ */ new Map(), k = async (_) => {
|
|
5156
|
-
const
|
|
5157
|
-
return R(
|
|
5156
|
+
const C = await ce(_, "utf-8");
|
|
5157
|
+
return R(C, _);
|
|
5158
5158
|
}, y = async (_) => {
|
|
5159
5159
|
if (b.has(_)) return b.get(_);
|
|
5160
5160
|
const $ = (_.split("/").pop() ?? "").replace(/\.json$/, "");
|
|
5161
5161
|
b.set(_, $);
|
|
5162
5162
|
const S = await k(_);
|
|
5163
5163
|
return await f(S, Y(_)), u[$] = S, $;
|
|
5164
|
-
}, f = async (_,
|
|
5164
|
+
}, f = async (_, C) => {
|
|
5165
5165
|
if (!_ || typeof _ != "object") return;
|
|
5166
5166
|
if (Array.isArray(_)) {
|
|
5167
|
-
for (const S of _) await f(S,
|
|
5167
|
+
for (const S of _) await f(S, C);
|
|
5168
5168
|
return;
|
|
5169
5169
|
}
|
|
5170
5170
|
const $ = _.$ref;
|
|
5171
5171
|
if (typeof $ == "string" && !$.startsWith("#")) {
|
|
5172
|
-
const S =
|
|
5173
|
-
if (
|
|
5172
|
+
const S = $e($) ? $ : G(C, $), J = Y(S).split("/").pop() ?? "";
|
|
5173
|
+
if (J === "schemas") {
|
|
5174
5174
|
const j = await y(S);
|
|
5175
5175
|
_.$ref = `#/components/schemas/${j}`;
|
|
5176
5176
|
return;
|
|
5177
5177
|
}
|
|
5178
|
-
if (
|
|
5178
|
+
if (J === "operations") {
|
|
5179
5179
|
const j = await k(S);
|
|
5180
5180
|
await f(j, Y(S)), delete _.$ref;
|
|
5181
5181
|
for (const O of Object.keys(j)) _[O] = j[O];
|
|
@@ -5184,12 +5184,12 @@ function Ua(e) {
|
|
|
5184
5184
|
return;
|
|
5185
5185
|
}
|
|
5186
5186
|
for (const S of Object.keys(_))
|
|
5187
|
-
await f(_[S],
|
|
5187
|
+
await f(_[S], C);
|
|
5188
5188
|
};
|
|
5189
5189
|
for (const _ of Object.keys(u)) {
|
|
5190
|
-
const
|
|
5191
|
-
if (
|
|
5192
|
-
const $ =
|
|
5190
|
+
const C = u[_];
|
|
5191
|
+
if (C && typeof C == "object" && typeof C.$ref == "string" && !C.$ref.startsWith("#")) {
|
|
5192
|
+
const $ = $e(C.$ref) ? C.$ref : G(l, C.$ref);
|
|
5193
5193
|
b.set($, _);
|
|
5194
5194
|
const S = await k($);
|
|
5195
5195
|
await f(S, Y($)), u[_] = S;
|
|
@@ -5198,7 +5198,7 @@ function Ua(e) {
|
|
|
5198
5198
|
for (const _ of Object.keys(i))
|
|
5199
5199
|
_ !== "components" && await f(i[_], l);
|
|
5200
5200
|
}
|
|
5201
|
-
function
|
|
5201
|
+
function F(i, l) {
|
|
5202
5202
|
if (typeof l != "string" || !l.startsWith("#/")) return null;
|
|
5203
5203
|
const u = l.slice(2).split("/").map((k) => k.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
5204
5204
|
let b = i;
|
|
@@ -5208,12 +5208,12 @@ function Ua(e) {
|
|
|
5208
5208
|
}
|
|
5209
5209
|
return b;
|
|
5210
5210
|
}
|
|
5211
|
-
function
|
|
5211
|
+
function z(i, l, u = 0) {
|
|
5212
5212
|
if (u > 4 || !i || typeof i != "object" || typeof i.$ref != "string") return i;
|
|
5213
|
-
const b =
|
|
5214
|
-
return b == null ? i :
|
|
5213
|
+
const b = F(l, i.$ref);
|
|
5214
|
+
return b == null ? i : z(b, l, u + 1);
|
|
5215
5215
|
}
|
|
5216
|
-
function
|
|
5216
|
+
function Q(i, l) {
|
|
5217
5217
|
if (!(typeof l != "string" || l === ""))
|
|
5218
5218
|
try {
|
|
5219
5219
|
return i.render(l);
|
|
@@ -5223,170 +5223,170 @@ function Ua(e) {
|
|
|
5223
5223
|
}
|
|
5224
5224
|
function re(i, l) {
|
|
5225
5225
|
if (!i) return null;
|
|
5226
|
-
const u = i, b = u.info ?? {}, k = u.components?.securitySchemes ?? {}, y = ["get", "post", "put", "patch", "delete", "head", "options"], f = (j) =>
|
|
5227
|
-
for (const [j, O] of Object.entries(
|
|
5228
|
-
const
|
|
5229
|
-
if (!
|
|
5230
|
-
const
|
|
5231
|
-
for (const
|
|
5232
|
-
const
|
|
5233
|
-
if (!
|
|
5234
|
-
const
|
|
5226
|
+
const u = i, b = u.info ?? {}, k = u.components?.securitySchemes ?? {}, y = ["get", "post", "put", "patch", "delete", "head", "options"], f = (j) => z(j, u)?.example, _ = /* @__PURE__ */ new Map(), C = u.paths ?? {};
|
|
5227
|
+
for (const [j, O] of Object.entries(C)) {
|
|
5228
|
+
const B = z(O, u);
|
|
5229
|
+
if (!B || typeof B != "object") continue;
|
|
5230
|
+
const W = (B.parameters ?? []).map((T) => z(T, u));
|
|
5231
|
+
for (const T of y) {
|
|
5232
|
+
const L = B[T];
|
|
5233
|
+
if (!L) continue;
|
|
5234
|
+
const H = L.operationId ?? `${T}-${j.replace(/[^a-z0-9]+/gi, "-")}`, ne = L.tags?.[0] ?? "default", ae = (L.parameters ?? []).map((_e) => z(_e, u)), ee = [...W, ...ae], I = /* @__PURE__ */ new Set(), N = [];
|
|
5235
5235
|
for (const _e of ee) {
|
|
5236
|
-
const
|
|
5237
|
-
if (!
|
|
5238
|
-
const
|
|
5239
|
-
|
|
5240
|
-
name:
|
|
5241
|
-
in:
|
|
5242
|
-
required:
|
|
5243
|
-
schema:
|
|
5244
|
-
description:
|
|
5245
|
-
description_html:
|
|
5246
|
-
example:
|
|
5236
|
+
const ie = _e;
|
|
5237
|
+
if (!ie || typeof ie != "object" || !ie.name || !ie.in) continue;
|
|
5238
|
+
const xe = `${ie.name}@${ie.in}`;
|
|
5239
|
+
I.has(xe) || (I.add(xe), N.push({
|
|
5240
|
+
name: ie.name,
|
|
5241
|
+
in: ie.in,
|
|
5242
|
+
required: ie.required,
|
|
5243
|
+
schema: ie.schema,
|
|
5244
|
+
description: ie.description,
|
|
5245
|
+
description_html: Q(l, ie.description),
|
|
5246
|
+
example: ie.example ?? f(ie.schema)
|
|
5247
5247
|
}));
|
|
5248
5248
|
}
|
|
5249
|
-
const
|
|
5250
|
-
for (const [_e,
|
|
5251
|
-
const
|
|
5252
|
-
|
|
5253
|
-
const Be =
|
|
5254
|
-
|
|
5249
|
+
const q = L.requestBody ? z(L.requestBody, u) : void 0, V = q?.content?.["application/json"], K = V?.example ?? (V?.examples ? Object.values(V.examples)[0]?.value : void 0) ?? f(V?.schema), X = {}, se = {};
|
|
5250
|
+
for (const [_e, ie] of Object.entries(L.responses ?? {})) {
|
|
5251
|
+
const xe = z(ie, u);
|
|
5252
|
+
se[_e] = xe;
|
|
5253
|
+
const Be = xe?.content?.["application/json"], Z = Be?.example ?? (Be?.examples ? Object.values(Be.examples)[0]?.value : void 0) ?? f(Be?.schema);
|
|
5254
|
+
Z !== void 0 && (X[_e] = Z);
|
|
5255
5255
|
}
|
|
5256
|
-
const
|
|
5257
|
-
id:
|
|
5258
|
-
method:
|
|
5256
|
+
const pe = {
|
|
5257
|
+
id: H,
|
|
5258
|
+
method: T.toUpperCase(),
|
|
5259
5259
|
path: j,
|
|
5260
|
-
tag:
|
|
5261
|
-
summary:
|
|
5262
|
-
summary_html:
|
|
5263
|
-
description:
|
|
5264
|
-
description_html:
|
|
5265
|
-
parameters:
|
|
5266
|
-
requestBody:
|
|
5267
|
-
requestBodyHtml:
|
|
5268
|
-
requestExample:
|
|
5269
|
-
responses:
|
|
5270
|
-
responseExamples:
|
|
5271
|
-
security:
|
|
5272
|
-
operationName:
|
|
5260
|
+
tag: ne,
|
|
5261
|
+
summary: L.summary ?? H,
|
|
5262
|
+
summary_html: Q(l, L.summary),
|
|
5263
|
+
description: L.description,
|
|
5264
|
+
description_html: Q(l, L.description),
|
|
5265
|
+
parameters: N,
|
|
5266
|
+
requestBody: q,
|
|
5267
|
+
requestBodyHtml: Q(l, q?.description),
|
|
5268
|
+
requestExample: K,
|
|
5269
|
+
responses: se,
|
|
5270
|
+
responseExamples: X,
|
|
5271
|
+
security: L.security ?? u.security,
|
|
5272
|
+
operationName: L.operationId
|
|
5273
5273
|
};
|
|
5274
|
-
_.has(
|
|
5274
|
+
_.has(ne) || _.set(ne, []), _.get(ne).push(pe);
|
|
5275
5275
|
}
|
|
5276
5276
|
}
|
|
5277
|
-
const $ = [..._.entries()].map(([j, O]) => ({ name: j, operations: O })).sort((j, O) => j.name.localeCompare(O.name)), S = u.components?.schemas ?? {},
|
|
5277
|
+
const $ = [..._.entries()].map(([j, O]) => ({ name: j, operations: O })).sort((j, O) => j.name.localeCompare(O.name)), S = u.components?.schemas ?? {}, J = {};
|
|
5278
5278
|
for (const [j, O] of Object.entries(S)) {
|
|
5279
|
-
const
|
|
5280
|
-
|
|
5279
|
+
const B = Q(l, O?.description);
|
|
5280
|
+
J[j] = B ? { ...O, description_html: B } : O;
|
|
5281
5281
|
}
|
|
5282
5282
|
return {
|
|
5283
5283
|
title: b.title ?? "API",
|
|
5284
5284
|
version: b.version ?? "",
|
|
5285
5285
|
description: b.description,
|
|
5286
|
-
description_html:
|
|
5286
|
+
description_html: Q(l, b.description),
|
|
5287
5287
|
servers: u.servers,
|
|
5288
5288
|
securitySchemes: k,
|
|
5289
5289
|
tags: $,
|
|
5290
|
-
schemas:
|
|
5290
|
+
schemas: J
|
|
5291
5291
|
};
|
|
5292
5292
|
}
|
|
5293
5293
|
async function he(i) {
|
|
5294
|
-
const l = await
|
|
5294
|
+
const l = await ce(i, "utf-8"), { data: u, content: b } = _t(l);
|
|
5295
5295
|
typeof u.type == "number" && (u.type = String(u.type));
|
|
5296
|
-
const k =
|
|
5296
|
+
const k = ao(u, b);
|
|
5297
5297
|
if (k.length) {
|
|
5298
|
-
const
|
|
5298
|
+
const Z = `${i}
|
|
5299
5299
|
${k.join(`
|
|
5300
5300
|
`)}`;
|
|
5301
|
-
if (c) throw new Error(`[nimpress] invalid frontmatter in ${
|
|
5302
|
-
console.warn(`[nimpress] invalid frontmatter in ${
|
|
5301
|
+
if (c) throw new Error(`[nimpress] invalid frontmatter in ${Z}`);
|
|
5302
|
+
console.warn(`[nimpress] invalid frontmatter in ${Z}`);
|
|
5303
5303
|
}
|
|
5304
|
-
const y =
|
|
5305
|
-
if (!(t.defaultFrontmatterExclude ?? []).some((
|
|
5306
|
-
const
|
|
5307
|
-
return $ ===
|
|
5304
|
+
const y = so.safeParse(u), f = y.success ? y.data : { title: i }, _ = io(n, i), C = f.type ?? "doc", $ = pa(n, i, f.path), S = typeof f.link == "string" && f.link.trim() !== "" ? f.link.trim() : void 0, J = !!S || u.type === void 0 && b.trim() === "", j = t.defaultFrontmatter ?? {};
|
|
5305
|
+
if (!(t.defaultFrontmatterExclude ?? []).some((Z) => {
|
|
5306
|
+
const ue = Z.startsWith("/") ? Z : "/" + Z;
|
|
5307
|
+
return $ === ue || $.startsWith(ue + "/");
|
|
5308
5308
|
}))
|
|
5309
|
-
for (const [
|
|
5310
|
-
const
|
|
5311
|
-
|
|
5309
|
+
for (const [Z, ue] of Object.entries(j)) {
|
|
5310
|
+
const Me = Z;
|
|
5311
|
+
Me === "hide" ? f.hide = Array.from(/* @__PURE__ */ new Set([...ue ?? [], ...f.hide ?? []])) : (f[Me] === void 0 || f[Me] === null || f[Me] === "") && (f[Me] = ue);
|
|
5312
5312
|
}
|
|
5313
|
-
const
|
|
5314
|
-
if (
|
|
5315
|
-
const
|
|
5316
|
-
Array.isArray(
|
|
5313
|
+
const W = await D(), T = Tn(W, be(), t.base, { math: t.math, icons: t.icons, glossary: g }), L = Ha(b, i), H = qa(T, L), ne = T.render(L, { glossaryPage: C === "glossary" });
|
|
5314
|
+
if (C === "team" || C === "pricing") {
|
|
5315
|
+
const Z = { ...f.data ?? {} };
|
|
5316
|
+
Array.isArray(Z.members) && (Z.members = Z.members.map((ue) => ({ ...ue, bioHtml: typeof ue.bio == "string" ? T.renderInline(ue.bio) : "" }))), Array.isArray(Z.tiers) && (Z.tiers = Z.tiers.map((ue) => ({ ...ue, benefitsHtml: Array.isArray(ue.benefits) ? ue.benefits.map((Me) => T.renderInline(String(Me))) : [] }))), typeof Z.footnote == "string" && (Z.footnoteHtml = T.renderInline(Z.footnote)), f.data = Z;
|
|
5317
5317
|
}
|
|
5318
|
-
let
|
|
5319
|
-
if (
|
|
5318
|
+
let ae, ee, I, N;
|
|
5319
|
+
if (C === "openapi")
|
|
5320
5320
|
if (!f.spec)
|
|
5321
5321
|
console.warn(`[nimpress] page ${i} has type openapi but no spec field`);
|
|
5322
5322
|
else {
|
|
5323
|
-
|
|
5324
|
-
const
|
|
5325
|
-
|
|
5323
|
+
N = $e(f.spec) ? f.spec : G(Y(i), f.spec), ee = Pe(N), I = ia(n, N);
|
|
5324
|
+
const Z = await x(i, f.spec);
|
|
5325
|
+
ae = Z ? re(Z, T) ?? void 0 : void 0;
|
|
5326
5326
|
}
|
|
5327
|
-
let
|
|
5328
|
-
if (
|
|
5327
|
+
let q, V, K, X;
|
|
5328
|
+
if (C === "dbml")
|
|
5329
5329
|
if (!f.spec)
|
|
5330
5330
|
console.warn(`[nimpress] page ${i} has type dbml but no spec field`);
|
|
5331
5331
|
else {
|
|
5332
|
-
|
|
5332
|
+
N = $e(f.spec) ? f.spec : G(Y(i), f.spec), K = Pe(N);
|
|
5333
5333
|
try {
|
|
5334
|
-
|
|
5335
|
-
} catch (
|
|
5336
|
-
|
|
5337
|
-
const
|
|
5338
|
-
${
|
|
5339
|
-
if (c) throw new Error(`[nimpress] invalid dbml in ${
|
|
5340
|
-
console.warn(`[nimpress] invalid dbml in ${
|
|
5334
|
+
V = await ce(N, "utf-8"), q = Un(V);
|
|
5335
|
+
} catch (Z) {
|
|
5336
|
+
X = Z instanceof Kt ? Z.message : String(Z);
|
|
5337
|
+
const ue = `${i} -> ${f.spec}
|
|
5338
|
+
${X}`;
|
|
5339
|
+
if (c) throw new Error(`[nimpress] invalid dbml in ${ue}`);
|
|
5340
|
+
console.warn(`[nimpress] invalid dbml in ${ue}`);
|
|
5341
5341
|
}
|
|
5342
5342
|
}
|
|
5343
|
-
te(i,
|
|
5344
|
-
let
|
|
5345
|
-
if (
|
|
5346
|
-
const
|
|
5343
|
+
te(i, N);
|
|
5344
|
+
let se, pe = [];
|
|
5345
|
+
if (C === "component") {
|
|
5346
|
+
const Z = await Vr({
|
|
5347
5347
|
cwd: process.cwd(),
|
|
5348
5348
|
modules: t.modules,
|
|
5349
5349
|
pageFile: i,
|
|
5350
5350
|
data: f.data ?? {},
|
|
5351
5351
|
editable: !c
|
|
5352
5352
|
});
|
|
5353
|
-
|
|
5353
|
+
se = Z.data, pe = Z.watchFiles;
|
|
5354
5354
|
}
|
|
5355
|
-
ge(i,
|
|
5355
|
+
ge(i, pe);
|
|
5356
5356
|
const _e = i.replace(/\.md$/, ".css");
|
|
5357
|
-
let
|
|
5358
|
-
const
|
|
5359
|
-
_e !== i && fe(_e) &&
|
|
5360
|
-
const Be =
|
|
5361
|
-
for (const
|
|
5362
|
-
const
|
|
5363
|
-
|
|
5357
|
+
let ie;
|
|
5358
|
+
const xe = [];
|
|
5359
|
+
_e !== i && fe(_e) && xe.push(await ce(_e, "utf-8"));
|
|
5360
|
+
const Be = Pe(i, ".md");
|
|
5361
|
+
for (const Z of Le(Y(i)).sort()) {
|
|
5362
|
+
const ue = Ea(Z, Be);
|
|
5363
|
+
ue && xe.push(Mn(ue, await ce(U(Y(i), Z), "utf-8")));
|
|
5364
5364
|
}
|
|
5365
|
-
for (const
|
|
5366
|
-
const
|
|
5367
|
-
fe(
|
|
5365
|
+
for (const Z of f.styles ?? []) {
|
|
5366
|
+
const ue = G(Y(i), Z);
|
|
5367
|
+
fe(ue) ? xe.push(await ce(ue, "utf-8")) : console.warn(`[nimpress] ${i}: styles entry ${Z} does not resolve`);
|
|
5368
5368
|
}
|
|
5369
|
-
return
|
|
5369
|
+
return xe.length && (ie = xe.join(`
|
|
5370
5370
|
`)), {
|
|
5371
5371
|
slug: _,
|
|
5372
5372
|
filePath: i,
|
|
5373
5373
|
effectivePath: $,
|
|
5374
|
-
type:
|
|
5375
|
-
sidebarOnly:
|
|
5374
|
+
type: C,
|
|
5375
|
+
sidebarOnly: J,
|
|
5376
5376
|
linkTo: S,
|
|
5377
5377
|
frontmatter: f,
|
|
5378
|
-
html:
|
|
5379
|
-
headings:
|
|
5378
|
+
html: ne,
|
|
5379
|
+
headings: H,
|
|
5380
5380
|
rawText: b,
|
|
5381
|
-
pageCss:
|
|
5382
|
-
openApiSpec:
|
|
5381
|
+
pageCss: ie,
|
|
5382
|
+
openApiSpec: ae,
|
|
5383
5383
|
openApiFile: ee,
|
|
5384
|
-
openApiUrl:
|
|
5385
|
-
componentData:
|
|
5386
|
-
dbmlSchema:
|
|
5387
|
-
dbmlSource:
|
|
5388
|
-
dbmlFile:
|
|
5389
|
-
dbmlError:
|
|
5384
|
+
openApiUrl: I,
|
|
5385
|
+
componentData: se,
|
|
5386
|
+
dbmlSchema: q,
|
|
5387
|
+
dbmlSource: V,
|
|
5388
|
+
dbmlFile: K,
|
|
5389
|
+
dbmlError: X
|
|
5390
5390
|
};
|
|
5391
5391
|
}
|
|
5392
5392
|
function te(i, l) {
|
|
@@ -5395,15 +5395,15 @@ function Ua(e) {
|
|
|
5395
5395
|
l && (P.set(l, i), p && !A.has(l) && (p.watcher.add(l), A.add(l)));
|
|
5396
5396
|
}
|
|
5397
5397
|
function ge(i, l) {
|
|
5398
|
-
for (const [u, b] of
|
|
5399
|
-
b === i &&
|
|
5398
|
+
for (const [u, b] of M)
|
|
5399
|
+
b === i && M.delete(u);
|
|
5400
5400
|
for (const u of l)
|
|
5401
|
-
|
|
5401
|
+
M.set(u, i), p && !h.has(u) && (p.watcher.add(u), h.add(u));
|
|
5402
5402
|
}
|
|
5403
5403
|
async function oe(i) {
|
|
5404
5404
|
let l;
|
|
5405
5405
|
try {
|
|
5406
|
-
l = await
|
|
5406
|
+
l = await ce(i, "utf-8");
|
|
5407
5407
|
} catch {
|
|
5408
5408
|
return null;
|
|
5409
5409
|
}
|
|
@@ -5433,43 +5433,43 @@ function Ua(e) {
|
|
|
5433
5433
|
async function He() {
|
|
5434
5434
|
const i = await nn(n), l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map();
|
|
5435
5435
|
let f, _;
|
|
5436
|
-
const
|
|
5436
|
+
const C = [], $ = [];
|
|
5437
5437
|
let S = [];
|
|
5438
5438
|
for (const j of i) {
|
|
5439
5439
|
if (!j.endsWith(".md")) continue;
|
|
5440
5440
|
let O = "";
|
|
5441
5441
|
try {
|
|
5442
|
-
O = await
|
|
5442
|
+
O = await ce(j, "utf-8");
|
|
5443
5443
|
} catch {
|
|
5444
5444
|
continue;
|
|
5445
5445
|
}
|
|
5446
|
-
const { data:
|
|
5447
|
-
String(
|
|
5446
|
+
const { data: B, content: W } = _t(O);
|
|
5447
|
+
String(B.type) === "glossary" && ($.push(j), S = Aa(new Rn().use(Bn), W));
|
|
5448
5448
|
}
|
|
5449
5449
|
if ($.length > 1) throw new Error(`[nimpress] one type glossary page per site: ${$.join(" and ")}`);
|
|
5450
5450
|
g = S, w = JSON.stringify(S);
|
|
5451
|
-
const
|
|
5451
|
+
const J = new Set(i);
|
|
5452
5452
|
for (const j of [...d.keys()])
|
|
5453
|
-
|
|
5453
|
+
J.has(j) || d.delete(j);
|
|
5454
5454
|
for (const j of i) {
|
|
5455
5455
|
let O = null;
|
|
5456
5456
|
try {
|
|
5457
5457
|
O = await oe(j);
|
|
5458
|
-
} catch (
|
|
5459
|
-
console.warn(`[nimpress] failed to process ${j}:`,
|
|
5458
|
+
} catch (W) {
|
|
5459
|
+
console.warn(`[nimpress] failed to process ${j}:`, W);
|
|
5460
5460
|
continue;
|
|
5461
5461
|
}
|
|
5462
5462
|
if (!O || Fe(O.slug)) continue;
|
|
5463
|
-
if (
|
|
5464
|
-
const
|
|
5465
|
-
|
|
5463
|
+
if (C.push(O), O.type === "changelog") {
|
|
5464
|
+
const T = `${ca(O.slug)}\0${O.frontmatter.title}`, L = b.get(T) ?? [];
|
|
5465
|
+
L.push(O), b.set(T, L);
|
|
5466
5466
|
continue;
|
|
5467
5467
|
}
|
|
5468
5468
|
if (O.type === "roadmap") {
|
|
5469
|
-
const
|
|
5470
|
-
k.set(
|
|
5469
|
+
const W = String(O.filePath);
|
|
5470
|
+
k.set(W, [O]);
|
|
5471
5471
|
}
|
|
5472
|
-
if (O.type === "section" && !O.filePath.endsWith(`${
|
|
5472
|
+
if (O.type === "section" && !O.filePath.endsWith(`${ke}index.md`))
|
|
5473
5473
|
throw new Error(`[nimpress] type section belongs on a folder index.md: ${O.filePath}`);
|
|
5474
5474
|
if (O.type === "glossary" && !O.html.includes("<dl"))
|
|
5475
5475
|
throw new Error(`[nimpress] type glossary needs a definition list body: ${O.filePath}`);
|
|
@@ -5484,94 +5484,94 @@ function Ua(e) {
|
|
|
5484
5484
|
f = O.filePath;
|
|
5485
5485
|
}
|
|
5486
5486
|
if (O.type === "component") {
|
|
5487
|
-
const
|
|
5488
|
-
if (
|
|
5487
|
+
const W = Y(O.filePath), T = y.get(W);
|
|
5488
|
+
if (T)
|
|
5489
5489
|
throw new Error(
|
|
5490
|
-
`[nimpress] one type component page per folder: ${
|
|
5490
|
+
`[nimpress] one type component page per folder: ${W} holds ${T} and ${O.filePath}`
|
|
5491
5491
|
);
|
|
5492
|
-
y.set(
|
|
5492
|
+
y.set(W, O.filePath);
|
|
5493
5493
|
}
|
|
5494
|
-
const
|
|
5495
|
-
if (
|
|
5494
|
+
const B = u.get(O.effectivePath);
|
|
5495
|
+
if (B)
|
|
5496
5496
|
throw new Error(
|
|
5497
|
-
`[nimpress] duplicate path ${O.effectivePath}: ${
|
|
5497
|
+
`[nimpress] duplicate path ${O.effectivePath}: ${B} and ${O.filePath}`
|
|
5498
5498
|
);
|
|
5499
5499
|
u.set(O.effectivePath, O.filePath), l.set(O.slug, O);
|
|
5500
5500
|
}
|
|
5501
5501
|
St.clear();
|
|
5502
5502
|
for (const [j, O] of b) {
|
|
5503
|
-
const
|
|
5504
|
-
if (u.has(
|
|
5503
|
+
const B = j.split("\0", 1)[0], W = co(B ? "/" + B : "/");
|
|
5504
|
+
if (u.has(W))
|
|
5505
5505
|
throw new Error(
|
|
5506
|
-
`[nimpress] path ${
|
|
5506
|
+
`[nimpress] path ${W} is occupied by both a changelog collection and a regular page`
|
|
5507
5507
|
);
|
|
5508
|
-
const
|
|
5509
|
-
if (
|
|
5510
|
-
|
|
5511
|
-
const
|
|
5512
|
-
return
|
|
5508
|
+
const T = O.filter((I) => !(c && je(I.frontmatter)));
|
|
5509
|
+
if (T.length === 0) continue;
|
|
5510
|
+
T.sort((I, N) => {
|
|
5511
|
+
const q = String(I.frontmatter.data?.version ?? ""), V = String(N.frontmatter.data?.version ?? "");
|
|
5512
|
+
return aa(V, q);
|
|
5513
5513
|
});
|
|
5514
|
-
const
|
|
5515
|
-
const
|
|
5516
|
-
let
|
|
5517
|
-
if (
|
|
5518
|
-
const _e =
|
|
5519
|
-
if (Number.isNaN(
|
|
5514
|
+
const L = T[0], H = `__changelog__${(B || "root").replace(/\//g, "__")}`, ne = T.map((I) => {
|
|
5515
|
+
const N = I.frontmatter.data, q = String(N?.version ?? ""), V = String(N?.title ?? ""), K = N?.description !== void 0 ? String(N.description) : void 0, X = N?.release_date;
|
|
5516
|
+
let se;
|
|
5517
|
+
if (X != null && String(X).trim() !== "") {
|
|
5518
|
+
const _e = X instanceof Date ? X.toISOString() : String(X), ie = new Date(_e);
|
|
5519
|
+
if (Number.isNaN(ie.getTime()))
|
|
5520
5520
|
throw new Error(
|
|
5521
|
-
`[nimpress] changelog entry ${
|
|
5521
|
+
`[nimpress] changelog entry ${I.filePath} has an invalid data.release_date (${_e}). Use an RFC 3339 timestamp like 2026-06-10 or 2026-06-10T09:00:00Z.`
|
|
5522
5522
|
);
|
|
5523
|
-
|
|
5523
|
+
se = ie.toISOString();
|
|
5524
5524
|
}
|
|
5525
|
-
const
|
|
5526
|
-
return St.set(`${
|
|
5527
|
-
version:
|
|
5528
|
-
slug:
|
|
5529
|
-
title:
|
|
5530
|
-
description:
|
|
5531
|
-
releaseDate:
|
|
5532
|
-
hidden:
|
|
5533
|
-
html:
|
|
5534
|
-
headings:
|
|
5535
|
-
data:
|
|
5525
|
+
const pe = q ? `v${q}` : "unreleased";
|
|
5526
|
+
return St.set(`${H}#${pe}`, I.rawText), {
|
|
5527
|
+
version: q,
|
|
5528
|
+
slug: pe,
|
|
5529
|
+
title: V,
|
|
5530
|
+
description: K,
|
|
5531
|
+
releaseDate: se,
|
|
5532
|
+
hidden: mt(I.frontmatter),
|
|
5533
|
+
html: I.html,
|
|
5534
|
+
headings: I.headings,
|
|
5535
|
+
data: I.frontmatter.data
|
|
5536
5536
|
};
|
|
5537
|
-
}),
|
|
5537
|
+
}), ae = ne.map((I) => ({
|
|
5538
5538
|
level: 2,
|
|
5539
|
-
text:
|
|
5540
|
-
slug:
|
|
5539
|
+
text: I.version ? `v${I.version}` : I.title || "unreleased",
|
|
5540
|
+
slug: I.slug
|
|
5541
5541
|
})), ee = {
|
|
5542
|
-
slug:
|
|
5543
|
-
filePath:
|
|
5544
|
-
effectivePath:
|
|
5542
|
+
slug: H,
|
|
5543
|
+
filePath: L.filePath,
|
|
5544
|
+
effectivePath: W,
|
|
5545
5545
|
type: "changelog",
|
|
5546
5546
|
frontmatter: {
|
|
5547
|
-
...
|
|
5548
|
-
path:
|
|
5547
|
+
...L.frontmatter,
|
|
5548
|
+
path: W,
|
|
5549
5549
|
type: "changelog",
|
|
5550
|
-
rss:
|
|
5551
|
-
subscribe:
|
|
5550
|
+
rss: T.some((I) => I.frontmatter.rss === !0) ? !0 : void 0,
|
|
5551
|
+
subscribe: T.some((I) => I.frontmatter.subscribe === !0) ? !0 : void 0
|
|
5552
5552
|
},
|
|
5553
5553
|
html: "",
|
|
5554
|
-
headings:
|
|
5555
|
-
rawText:
|
|
5554
|
+
headings: ae,
|
|
5555
|
+
rawText: T.map((I) => I.rawText).join(`
|
|
5556
5556
|
|
|
5557
5557
|
`),
|
|
5558
|
-
changelogEntries:
|
|
5558
|
+
changelogEntries: ne
|
|
5559
5559
|
};
|
|
5560
|
-
u.set(
|
|
5560
|
+
u.set(W, ee.filePath), l.set(ee.slug, ee);
|
|
5561
5561
|
}
|
|
5562
|
-
if (
|
|
5563
|
-
const j =
|
|
5562
|
+
if (xo(k, C), mo(l), uo(l), t.seo?.auto) {
|
|
5563
|
+
const j = Da(C.map((O) => ({
|
|
5564
5564
|
slug: O.slug,
|
|
5565
5565
|
title: O.frontmatter.title,
|
|
5566
|
-
headings: O.headings.map((
|
|
5566
|
+
headings: O.headings.map((B) => B.text),
|
|
5567
5567
|
tags: Re(O.frontmatter.tags),
|
|
5568
5568
|
body: O.rawText
|
|
5569
5569
|
})));
|
|
5570
|
-
for (const O of
|
|
5571
|
-
const
|
|
5572
|
-
if (!
|
|
5573
|
-
const
|
|
5574
|
-
O.frontmatter.meta = { ...
|
|
5570
|
+
for (const O of C) {
|
|
5571
|
+
const B = j.get(O.slug);
|
|
5572
|
+
if (!B) continue;
|
|
5573
|
+
const W = O.frontmatter.meta ?? {}, T = W.override === !0, L = T && W.keywords ? W.keywords : B.keywords.length ? B.keywords : W.keywords, H = T && W.description ? W.description : B.description || W.description;
|
|
5574
|
+
O.frontmatter.meta = { ...W, ...L ? { keywords: L } : {}, ...H ? { description: H } : {} };
|
|
5575
5575
|
}
|
|
5576
5576
|
}
|
|
5577
5577
|
s = l;
|
|
@@ -5579,11 +5579,11 @@ function Ua(e) {
|
|
|
5579
5579
|
const ze = /* @__PURE__ */ new Map(), St = /* @__PURE__ */ new Map();
|
|
5580
5580
|
let jt = JSON.stringify({ pages: [] }, null, 2) + `
|
|
5581
5581
|
`;
|
|
5582
|
-
function
|
|
5582
|
+
function uo(i) {
|
|
5583
5583
|
const l = [];
|
|
5584
5584
|
for (const u of i.values()) {
|
|
5585
5585
|
if (u.frontmatter.subscribe !== !0 || Ft(u.frontmatter)) continue;
|
|
5586
|
-
const b = u.effectivePath === "/" ? "" : u.effectivePath, y = `${ve(u) ? `/${t.paths.guarded}/${
|
|
5586
|
+
const b = u.effectivePath === "/" ? "" : u.effectivePath, y = `${ve(u) ? `/${t.paths.guarded}/${rt(u)}` : ""}${b}/${En(0)}`;
|
|
5587
5587
|
if (!ze.has(y)) continue;
|
|
5588
5588
|
const f = {
|
|
5589
5589
|
path: u.effectivePath,
|
|
@@ -5603,7 +5603,7 @@ function Ua(e) {
|
|
|
5603
5603
|
l.sort((u, b) => u.path.localeCompare(b.path)), jt = JSON.stringify({ pages: l }, null, 2) + `
|
|
5604
5604
|
`;
|
|
5605
5605
|
}
|
|
5606
|
-
function
|
|
5606
|
+
function mo(i) {
|
|
5607
5607
|
ze.clear();
|
|
5608
5608
|
const l = t.site?.url?.replace(/\/$/, "");
|
|
5609
5609
|
for (const u of i.values()) {
|
|
@@ -5612,46 +5612,46 @@ function Ua(e) {
|
|
|
5612
5612
|
console.warn(`[nimpress] changelog feed for ${u.effectivePath} needs site.url in the config, skipping`);
|
|
5613
5613
|
continue;
|
|
5614
5614
|
}
|
|
5615
|
-
const b = (u.changelogEntries ?? []).filter((
|
|
5615
|
+
const b = (u.changelogEntries ?? []).filter((H) => !H.hidden);
|
|
5616
5616
|
if (b.length === 0) continue;
|
|
5617
|
-
const k = u.effectivePath === "/" ? "" : u.effectivePath, y = `${l}${we(t.base, k || "/")}`, f = ve(u) ? `/${t.paths.guarded}/${
|
|
5618
|
-
for (let
|
|
5619
|
-
const S = $.length ? Math.round($.reduce((
|
|
5617
|
+
const k = u.effectivePath === "/" ? "" : u.effectivePath, y = `${l}${we(t.base, k || "/")}`, f = ve(u) ? `/${t.paths.guarded}/${rt(u)}` : "", _ = (H) => `${f}${k}/${En(H)}`, C = b.map((H) => H.releaseDate ? new Date(H.releaseDate).getTime() : Number.NaN).filter((H) => !Number.isNaN(H)).sort((H, ne) => ne - H), $ = [];
|
|
5618
|
+
for (let H = 0; H + 1 < C.length; H++) $.push(C[H] - C[H + 1]);
|
|
5619
|
+
const S = $.length ? Math.round($.reduce((H, ne) => H + ne, 0) / $.length / 1e3) : void 0, J = S ? Math.min(43200, Math.max(60, Math.round(S / 60))) : 1440, j = S ? S <= 172800 ? "daily" : S <= 1209600 ? "weekly" : S <= 5184e3 ? "monthly" : "yearly" : "weekly", O = C.length ? new Date(C[0]).toUTCString() : void 0, B = ye(u.frontmatter.title), W = ye(
|
|
5620
5620
|
u.frontmatter.description ?? t.site?.description ?? u.frontmatter.title
|
|
5621
|
-
),
|
|
5622
|
-
for (let
|
|
5623
|
-
const
|
|
5624
|
-
`<atom:link href="${ye(`${l}${we(t.base, _(
|
|
5621
|
+
), T = t.site?.locale?.replace("_", "-").toLowerCase(), L = Math.max(1, Math.ceil(b.length / Nt));
|
|
5622
|
+
for (let H = 0; H < L; H++) {
|
|
5623
|
+
const ne = b.slice(H * Nt, (H + 1) * Nt), ae = [
|
|
5624
|
+
`<atom:link href="${ye(`${l}${we(t.base, _(H))}`)}" rel="self" type="application/rss+xml"/>`
|
|
5625
5625
|
];
|
|
5626
|
-
|
|
5626
|
+
H > 0 && ae.push(
|
|
5627
5627
|
`<atom:link href="${ye(`${l}${we(t.base, _(0))}`)}" rel="current" type="application/rss+xml"/>`
|
|
5628
|
-
),
|
|
5629
|
-
`<atom:link href="${ye(`${l}${we(t.base, _(
|
|
5630
|
-
),
|
|
5631
|
-
`<atom:link href="${ye(`${l}${we(t.base, _(
|
|
5628
|
+
), H + 1 < L && ae.push(
|
|
5629
|
+
`<atom:link href="${ye(`${l}${we(t.base, _(H + 1))}`)}" rel="prev-archive" type="application/rss+xml"/>`
|
|
5630
|
+
), H > 1 && ae.push(
|
|
5631
|
+
`<atom:link href="${ye(`${l}${we(t.base, _(H - 1))}`)}" rel="next-archive" type="application/rss+xml"/>`
|
|
5632
5632
|
);
|
|
5633
|
-
const ee =
|
|
5634
|
-
const
|
|
5635
|
-
`<title>${ye(
|
|
5636
|
-
`<link>${ye(
|
|
5637
|
-
`<guid isPermaLink="true">${ye(
|
|
5633
|
+
const ee = ne.map((q) => {
|
|
5634
|
+
const V = `${y}#${q.slug}`, K = [
|
|
5635
|
+
`<title>${ye(q.version ? `v${q.version} ${q.title}` : q.title)}</title>`,
|
|
5636
|
+
`<link>${ye(V)}</link>`,
|
|
5637
|
+
`<guid isPermaLink="true">${ye(V)}</guid>`
|
|
5638
5638
|
];
|
|
5639
|
-
return
|
|
5640
|
-
${
|
|
5639
|
+
return q.releaseDate && K.push(`<pubDate>${new Date(q.releaseDate).toUTCString()}</pubDate>`), q.description && K.push(`<description>${ye(q.description)}</description>`), q.html && K.push(`<content:encoded>${Kr(q.html)}</content:encoded>`), ` <item>
|
|
5640
|
+
${K.join(`
|
|
5641
5641
|
`)}
|
|
5642
5642
|
</item>`;
|
|
5643
|
-
}),
|
|
5644
|
-
`<title>${
|
|
5643
|
+
}), I = [
|
|
5644
|
+
`<title>${B}</title>`,
|
|
5645
5645
|
`<link>${ye(y)}</link>`,
|
|
5646
|
-
`<description>${
|
|
5647
|
-
...
|
|
5646
|
+
`<description>${W}</description>`,
|
|
5647
|
+
...ae
|
|
5648
5648
|
];
|
|
5649
|
-
|
|
5650
|
-
const
|
|
5649
|
+
T && I.push(`<language>${ye(T)}</language>`), O && I.push(`<lastBuildDate>${O}</lastBuildDate>`), I.push(`<ttl>${J}</ttl>`), I.push(`<sy:updatePeriod>${j}</sy:updatePeriod>`), I.push("<sy:updateFrequency>1</sy:updateFrequency>"), S !== void 0 && I.push(`<nimpress:releaseCadence>${S}</nimpress:releaseCadence>`), I.push(`<nimpress:latestVersion>${ye(b[0].version)}</nimpress:latestVersion>`), I.push(`<nimpress:releaseCount>${b.length}</nimpress:releaseCount>`), H > 0 && I.push("<fh:archive/>");
|
|
5650
|
+
const N = [
|
|
5651
5651
|
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
5652
|
-
`<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="${
|
|
5652
|
+
`<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="${Yr}">`,
|
|
5653
5653
|
" <channel>",
|
|
5654
|
-
` ${
|
|
5654
|
+
` ${I.join(`
|
|
5655
5655
|
`)}`,
|
|
5656
5656
|
ee.join(`
|
|
5657
5657
|
`),
|
|
@@ -5659,7 +5659,7 @@ function Ua(e) {
|
|
|
5659
5659
|
"</rss>"
|
|
5660
5660
|
].join(`
|
|
5661
5661
|
`);
|
|
5662
|
-
ze.set(_(
|
|
5662
|
+
ze.set(_(H), N);
|
|
5663
5663
|
}
|
|
5664
5664
|
}
|
|
5665
5665
|
}
|
|
@@ -5667,7 +5667,7 @@ function Ua(e) {
|
|
|
5667
5667
|
function ve(i) {
|
|
5668
5668
|
return i.frontmatter.gate !== void 0;
|
|
5669
5669
|
}
|
|
5670
|
-
function
|
|
5670
|
+
function fo(i) {
|
|
5671
5671
|
const l = Y(i.filePath);
|
|
5672
5672
|
let u = [];
|
|
5673
5673
|
try {
|
|
@@ -5675,19 +5675,19 @@ function Ua(e) {
|
|
|
5675
5675
|
} catch {
|
|
5676
5676
|
return [];
|
|
5677
5677
|
}
|
|
5678
|
-
return u.filter((b) =>
|
|
5678
|
+
return u.filter((b) => U(l, b) !== i.filePath).map((b) => Se(process.cwd(), U(l, b)));
|
|
5679
5679
|
}
|
|
5680
|
-
function
|
|
5680
|
+
function rt(i) {
|
|
5681
5681
|
const l = t.auth?.guard;
|
|
5682
|
-
return typeof l == "function" ? l(i.frontmatter,
|
|
5682
|
+
return typeof l == "function" ? l(i.frontmatter, Se(process.cwd(), i.filePath), fo(i)) : i.frontmatter.gate ?? "default";
|
|
5683
5683
|
}
|
|
5684
|
-
function
|
|
5684
|
+
function ho() {
|
|
5685
5685
|
const i = [];
|
|
5686
5686
|
for (const l of s.values())
|
|
5687
5687
|
l.sidebarOnly || Ft(l.frontmatter) || ve(l) || i.push(l);
|
|
5688
5688
|
return i;
|
|
5689
5689
|
}
|
|
5690
|
-
function
|
|
5690
|
+
function Ae(i) {
|
|
5691
5691
|
const l = t.site?.url?.replace(/\/$/, "");
|
|
5692
5692
|
if (l)
|
|
5693
5693
|
return l + we(t.base, i.startsWith("/") ? i : "/" + i);
|
|
@@ -5696,7 +5696,7 @@ function Ua(e) {
|
|
|
5696
5696
|
if (Pt.has(i)) return Pt.get(i);
|
|
5697
5697
|
let l;
|
|
5698
5698
|
try {
|
|
5699
|
-
l =
|
|
5699
|
+
l = Wo("git", ["log", "-1", "--format=%cI", "--", i], {
|
|
5700
5700
|
cwd: process.cwd(),
|
|
5701
5701
|
encoding: "utf-8",
|
|
5702
5702
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -5706,72 +5706,72 @@ function Ua(e) {
|
|
|
5706
5706
|
}
|
|
5707
5707
|
return Pt.set(i, l), l;
|
|
5708
5708
|
}
|
|
5709
|
-
function
|
|
5709
|
+
function go(i) {
|
|
5710
5710
|
return i === "changelog" || i === "roadmap" ? "CollectionPage" : i === "openapi" ? "APIReference" : i === "hero" || i === "fullpage" || i === "404" ? "WebPage" : i === "section" || i === "tags" ? "CollectionPage" : i === "glossary" ? "DefinedTermSet" : i === "team" ? "AboutPage" : "TechArticle";
|
|
5711
5711
|
}
|
|
5712
|
-
function
|
|
5713
|
-
const l = t.meta ?? {}, u = t.site, b = i.frontmatter, k = b.meta ?? {}, y = k.og ?? {}, f = k.twitter ?? {}, _ = b.title,
|
|
5712
|
+
function _o(i) {
|
|
5713
|
+
const l = t.meta ?? {}, u = t.site, b = i.frontmatter, k = b.meta ?? {}, y = k.og ?? {}, f = k.twitter ?? {}, _ = b.title, C = u?.title && u.title !== _ ? `${_} · ${u.title}` : _, $ = k.description ?? b.description ?? u?.description, S = k.canonical ?? Ae(i.effectivePath), J = (() => {
|
|
5714
5714
|
if (k.keywords) return Array.isArray(k.keywords) ? k.keywords : [k.keywords];
|
|
5715
|
-
const
|
|
5716
|
-
return
|
|
5717
|
-
})(), j =
|
|
5718
|
-
if (
|
|
5719
|
-
|
|
5720
|
-
const
|
|
5721
|
-
for (const
|
|
5722
|
-
|
|
5723
|
-
|
|
5715
|
+
const K = Re(b.tags);
|
|
5716
|
+
return K.length ? K : l.keywords ?? [];
|
|
5717
|
+
})(), j = Ma(k.robots ?? "index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1", t.seo?.ai?.index, k.ai), O = y.title ?? _, B = y.description ?? $, W = y.image ?? u?.ogImage, T = W ? Ae(W) ?? W : void 0, L = y.type ?? (b.type === "hero" || b.type === "fullpage" || i.effectivePath === "/" ? "website" : "article"), H = l.og?.width ?? 1200, ne = l.og?.height ?? 600, ae = f.card ?? (T ? "summary_large_image" : "summary"), ee = f.site ?? u?.twitterSite, I = nt, N = [];
|
|
5718
|
+
if (N.push(`<title>${I(C)}</title>`), $ && N.push(`<meta name="description" content="${I($)}">`), J.length && N.push(`<meta name="keywords" content="${I(J.join(", "))}">`), N.push(`<meta name="robots" content="${I(j)}">`), N.push(`<meta name="googlebot" content="${I(j)}">`), S) {
|
|
5719
|
+
N.push(`<link rel="canonical" href="${I(S)}">`);
|
|
5720
|
+
const K = l.localeAlternates ?? [];
|
|
5721
|
+
for (const X of K)
|
|
5722
|
+
N.push(`<link rel="alternate" hreflang="${I(X)}" href="${I(S)}">`);
|
|
5723
|
+
K.length && N.push(`<link rel="alternate" hreflang="x-default" href="${I(S)}">`);
|
|
5724
5724
|
}
|
|
5725
|
-
if (
|
|
5726
|
-
const
|
|
5727
|
-
|
|
5725
|
+
if (N.push(`<meta property="og:title" content="${I(O)}">`), B && N.push(`<meta property="og:description" content="${I(B)}">`), N.push(`<meta property="og:type" content="${I(L)}">`), S && N.push(`<meta property="og:url" content="${I(S)}">`), T && (N.push(`<meta property="og:image" content="${I(T)}">`), N.push(`<meta property="og:image:width" content="${H}">`), N.push(`<meta property="og:image:height" content="${ne}">`), y.imageAlt && N.push(`<meta property="og:image:alt" content="${I(y.imageAlt)}">`)), u?.title && N.push(`<meta property="og:site_name" content="${I(u.title)}">`), u?.locale && N.push(`<meta property="og:locale" content="${I(u.locale)}">`), N.push(`<meta name="twitter:card" content="${I(ae)}">`), ee && N.push(`<meta name="twitter:site" content="${I(ee)}">`), N.push(`<meta name="twitter:title" content="${I(f.title ?? O)}">`), (f.description ?? B) && N.push(`<meta name="twitter:description" content="${I(f.description ?? B ?? "")}">`), (f.image ?? T) && N.push(`<meta name="twitter:image" content="${I(f.image ?? T ?? "")}">`), $ && N.push(`<meta name="dc.description" content="${I($)}">`), N.push(`<meta name="dc.title" content="${I(C)}">`), u?.locale && N.push(`<meta name="dc.language" content="${I(u.locale)}">`), b.type === "changelog" && (b.rss === !0 || b.subscribe === !0)) {
|
|
5726
|
+
const K = i.effectivePath === "/" ? "/rss.xml" : `${i.effectivePath}/rss.xml`, X = Ae(K) ?? K;
|
|
5727
|
+
N.push(`<link rel="alternate" type="application/rss+xml" title="${I(_)}" href="${I(X)}">`);
|
|
5728
5728
|
}
|
|
5729
|
-
const
|
|
5730
|
-
if (l.organization &&
|
|
5729
|
+
const q = t.site?.url?.replace(/\/$/, ""), V = [];
|
|
5730
|
+
if (l.organization && V.push({ "@context": "https://schema.org", ...l.organization }), q && u?.title && V.push({
|
|
5731
5731
|
"@context": "https://schema.org",
|
|
5732
5732
|
"@type": "WebSite",
|
|
5733
|
-
"@id": `${
|
|
5733
|
+
"@id": `${q}${we(t.base, "/")}#website`,
|
|
5734
5734
|
name: u.title,
|
|
5735
|
-
url: `${
|
|
5735
|
+
url: `${q}${we(t.base, "/")}`,
|
|
5736
5736
|
description: u.description
|
|
5737
5737
|
}), S && i.effectivePath !== "/") {
|
|
5738
|
-
const
|
|
5739
|
-
{ name: u?.title ?? "Home", item:
|
|
5740
|
-
],
|
|
5741
|
-
let
|
|
5742
|
-
for (const
|
|
5743
|
-
|
|
5744
|
-
const _e = [...s.values()].find((
|
|
5745
|
-
|
|
5738
|
+
const K = [
|
|
5739
|
+
{ name: u?.title ?? "Home", item: q ? `${q}${we(t.base, "/")}` : void 0 }
|
|
5740
|
+
], X = i.effectivePath.split("/").filter(Boolean);
|
|
5741
|
+
let se = "";
|
|
5742
|
+
for (const pe of X) {
|
|
5743
|
+
se += "/" + pe;
|
|
5744
|
+
const _e = [...s.values()].find((ie) => ie.effectivePath === se);
|
|
5745
|
+
K.push({ name: _e?.frontmatter.title ?? Ve(pe), item: Ae(se) });
|
|
5746
5746
|
}
|
|
5747
|
-
|
|
5747
|
+
V.push({
|
|
5748
5748
|
"@context": "https://schema.org",
|
|
5749
5749
|
"@type": "BreadcrumbList",
|
|
5750
|
-
itemListElement:
|
|
5750
|
+
itemListElement: K.map((pe, _e) => ({
|
|
5751
5751
|
"@type": "ListItem",
|
|
5752
5752
|
position: _e + 1,
|
|
5753
|
-
name:
|
|
5754
|
-
item:
|
|
5753
|
+
name: pe.name,
|
|
5754
|
+
item: pe.item
|
|
5755
5755
|
}))
|
|
5756
5756
|
});
|
|
5757
5757
|
}
|
|
5758
|
-
|
|
5758
|
+
V.push({
|
|
5759
5759
|
"@context": "https://schema.org",
|
|
5760
|
-
"@type":
|
|
5761
|
-
name:
|
|
5760
|
+
"@type": go(i.type),
|
|
5761
|
+
name: C,
|
|
5762
5762
|
headline: _,
|
|
5763
5763
|
description: $,
|
|
5764
5764
|
url: S,
|
|
5765
|
-
isPartOf:
|
|
5765
|
+
isPartOf: q ? `${q}${we(t.base, "/")}#website` : void 0,
|
|
5766
5766
|
dateModified: on(i.filePath)
|
|
5767
|
-
}), k.jsonLd &&
|
|
5768
|
-
for (const
|
|
5767
|
+
}), k.jsonLd && V.push(k.jsonLd);
|
|
5768
|
+
for (const K of V) N.push(Zr(K));
|
|
5769
5769
|
return `
|
|
5770
|
-
${
|
|
5770
|
+
${N.join(`
|
|
5771
5771
|
`)}
|
|
5772
5772
|
`;
|
|
5773
5773
|
}
|
|
5774
|
-
function
|
|
5774
|
+
function yo() {
|
|
5775
5775
|
const i = t.meta ?? {};
|
|
5776
5776
|
if (i.robots?.custom) return i.robots.custom;
|
|
5777
5777
|
const l = /* @__PURE__ */ new Set([...i.robots?.block ?? [], ...t.seo?.ai?.index === !1 ? It : []]), u = ["User-agent: *", "Allow: /", ""];
|
|
@@ -5780,14 +5780,14 @@ function Ua(e) {
|
|
|
5780
5780
|
for (const k of l)
|
|
5781
5781
|
It.includes(k) || (u.push(`User-agent: ${k}`), u.push("Disallow: /"), u.push(""));
|
|
5782
5782
|
i.robots?.append && u.push(i.robots.append, "");
|
|
5783
|
-
const b =
|
|
5783
|
+
const b = Ae("/sitemap.xml");
|
|
5784
5784
|
return b && u.push(`Sitemap: ${b}`), u.join(`
|
|
5785
5785
|
`).replace(/\n{3,}/g, `
|
|
5786
5786
|
|
|
5787
5787
|
`).trim() + `
|
|
5788
5788
|
`;
|
|
5789
5789
|
}
|
|
5790
|
-
function
|
|
5790
|
+
function bo(i) {
|
|
5791
5791
|
const l = t.site?.url?.replace(/\/$/, "");
|
|
5792
5792
|
if (!l) return;
|
|
5793
5793
|
const u = t.meta?.localeAlternates ?? [];
|
|
@@ -5795,10 +5795,10 @@ function Ua(e) {
|
|
|
5795
5795
|
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
5796
5796
|
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">',
|
|
5797
5797
|
i.map((k) => {
|
|
5798
|
-
const y = `${l}${we(t.base, k.effectivePath === "/" ? "/" : k.effectivePath)}`, f = k.effectivePath.split("/").filter(Boolean).length, _ = f === 0 ? "1.0" : f === 1 ? "0.8" : "0.6",
|
|
5799
|
-
$ && S.push(` <lastmod>${ye($)}</lastmod>`), S.push(` <changefreq>${
|
|
5800
|
-
for (const
|
|
5801
|
-
S.push(` <xhtml:link rel="alternate" hreflang="${ye(
|
|
5798
|
+
const y = `${l}${we(t.base, k.effectivePath === "/" ? "/" : k.effectivePath)}`, f = k.effectivePath.split("/").filter(Boolean).length, _ = f === 0 ? "1.0" : f === 1 ? "0.8" : "0.6", C = f === 0 ? "weekly" : "monthly", $ = on(k.filePath), S = [` <loc>${ye(y)}</loc>`];
|
|
5799
|
+
$ && S.push(` <lastmod>${ye($)}</lastmod>`), S.push(` <changefreq>${C}</changefreq>`), S.push(` <priority>${_}</priority>`);
|
|
5800
|
+
for (const J of u)
|
|
5801
|
+
S.push(` <xhtml:link rel="alternate" hreflang="${ye(J)}" href="${ye(y)}"/>`);
|
|
5802
5802
|
return ` <url>
|
|
5803
5803
|
${S.join(`
|
|
5804
5804
|
`)}
|
|
@@ -5810,45 +5810,45 @@ ${S.join(`
|
|
|
5810
5810
|
].join(`
|
|
5811
5811
|
`);
|
|
5812
5812
|
}
|
|
5813
|
-
function
|
|
5813
|
+
function wo(i) {
|
|
5814
5814
|
const l = t.meta ?? {}, u = t.site, b = [`# ${u?.title ?? t.title}`, ""], k = l.llms?.summary ?? u?.description;
|
|
5815
5815
|
k && b.push(`> ${k}`, "");
|
|
5816
5816
|
const y = /* @__PURE__ */ new Map(), f = [];
|
|
5817
|
-
for (const
|
|
5818
|
-
const j =
|
|
5817
|
+
for (const J of i) {
|
|
5818
|
+
const j = J.effectivePath.split("/").filter(Boolean);
|
|
5819
5819
|
if (j.length === 0) {
|
|
5820
|
-
f.push(
|
|
5820
|
+
f.push(J);
|
|
5821
5821
|
continue;
|
|
5822
5822
|
}
|
|
5823
|
-
const O = j[0],
|
|
5824
|
-
|
|
5823
|
+
const O = j[0], B = y.get(O) ?? [];
|
|
5824
|
+
B.push(J), y.set(O, B);
|
|
5825
5825
|
}
|
|
5826
|
-
const _ = (
|
|
5827
|
-
const j =
|
|
5828
|
-
return
|
|
5826
|
+
const _ = (J) => {
|
|
5827
|
+
const j = Ae(J.effectivePath) ?? J.effectivePath;
|
|
5828
|
+
return J.frontmatter.description ? `- [${J.frontmatter.title}](${j}): ${J.frontmatter.description}` : `- [${J.frontmatter.title}](${j})`;
|
|
5829
5829
|
};
|
|
5830
|
-
for (const
|
|
5830
|
+
for (const J of f) b.push(_(J));
|
|
5831
5831
|
f.length && b.push("");
|
|
5832
|
-
for (const [
|
|
5833
|
-
const O = j.find((
|
|
5834
|
-
b.push(`## ${O?.frontmatter.title ??
|
|
5835
|
-
for (const
|
|
5832
|
+
for (const [J, j] of [...y.entries()].sort((O, B) => O[0].localeCompare(B[0]))) {
|
|
5833
|
+
const O = j.find((B) => B.effectivePath === `/${J}`);
|
|
5834
|
+
b.push(`## ${O?.frontmatter.title ?? Ve(J)}`, ""), j.sort((B, W) => B.effectivePath.localeCompare(W.effectivePath));
|
|
5835
|
+
for (const B of j) b.push(_(B));
|
|
5836
5836
|
b.push("");
|
|
5837
5837
|
}
|
|
5838
|
-
const
|
|
5839
|
-
for (const
|
|
5840
|
-
|
|
5841
|
-
const $ =
|
|
5838
|
+
const C = new Set(t.meta?.keywords ?? []);
|
|
5839
|
+
for (const J of i) for (const j of Re(J.frontmatter.tags)) C.add(j);
|
|
5840
|
+
C.size && b.push("## Keywords", "", [...C].join(", "), "");
|
|
5841
|
+
const $ = Ae("/sitemap.xml"), S = Ae("/robots.txt");
|
|
5842
5842
|
return ($ || S) && (b.push("## Optional", ""), $ && b.push(`- [Sitemap](${$})`), S && b.push(`- [Robots](${S})`), b.push("")), l.llms?.append && b.push(l.llms.append, ""), b.join(`
|
|
5843
5843
|
`).replace(/\n{3,}/g, `
|
|
5844
5844
|
|
|
5845
5845
|
`);
|
|
5846
5846
|
}
|
|
5847
|
-
function
|
|
5847
|
+
function vo(i) {
|
|
5848
5848
|
const u = [`# ${t.site?.title ?? t.title}`, ""];
|
|
5849
5849
|
for (const b of i) {
|
|
5850
5850
|
u.push(`## ${b.frontmatter.title}`, "");
|
|
5851
|
-
const k =
|
|
5851
|
+
const k = Ae(b.effectivePath);
|
|
5852
5852
|
k && u.push(`URL: ${k}`, ""), u.push(b.rawText.trim(), "");
|
|
5853
5853
|
}
|
|
5854
5854
|
return u.join(`
|
|
@@ -5856,48 +5856,48 @@ ${S.join(`
|
|
|
5856
5856
|
|
|
5857
5857
|
`);
|
|
5858
5858
|
}
|
|
5859
|
-
async function
|
|
5860
|
-
const i = t.meta ?? {}, l =
|
|
5859
|
+
async function ko() {
|
|
5860
|
+
const i = t.meta ?? {}, l = ho().sort((f, _) => f.effectivePath.localeCompare(_.effectivePath)), u = U(a, "index.html"), b = await ce(u, "utf-8");
|
|
5861
5861
|
for (const f of l) {
|
|
5862
|
-
const _ =
|
|
5863
|
-
await Ue(Y($), { recursive: !0 }), await
|
|
5862
|
+
const _ = _o(f), C = b.replace("</head>", `${_}</head>`), $ = f.effectivePath === "/" ? u : U(a, f.effectivePath.replace(/^\//, ""), "index.html");
|
|
5863
|
+
await Ue(Y($), { recursive: !0 }), await me($, C);
|
|
5864
5864
|
}
|
|
5865
|
-
await
|
|
5866
|
-
const k = l.filter((f) => f.type !== "404"), y =
|
|
5867
|
-
if (y && await
|
|
5868
|
-
`), i.humans && await
|
|
5865
|
+
await me(U(a, "robots.txt"), yo());
|
|
5866
|
+
const k = l.filter((f) => f.type !== "404"), y = bo(k);
|
|
5867
|
+
if (y && await me(U(a, "sitemap.xml"), y), await me(U(a, "llms.txt"), wo(k)), i.llms?.full && await me(U(a, "llms-full.txt"), vo(k)), i.webmanifest && await me(U(a, "site.webmanifest"), JSON.stringify(i.webmanifest, null, 2) + `
|
|
5868
|
+
`), i.humans && await me(U(a, "humans.txt"), i.humans.trim() + `
|
|
5869
5869
|
`), i.security) {
|
|
5870
5870
|
const f = i.security, _ = [];
|
|
5871
|
-
f.contact && _.push(`Contact: ${f.contact}`), f.policy && _.push(`Policy: ${f.policy}`), f.languages && _.push(`Preferred-Languages: ${f.languages}`), f.canonical && _.push(`Canonical: ${f.canonical}`), f.expires && _.push(`Expires: ${f.expires}`), _.length && (await Ue(
|
|
5871
|
+
f.contact && _.push(`Contact: ${f.contact}`), f.policy && _.push(`Policy: ${f.policy}`), f.languages && _.push(`Preferred-Languages: ${f.languages}`), f.canonical && _.push(`Canonical: ${f.canonical}`), f.expires && _.push(`Expires: ${f.expires}`), _.length && (await Ue(U(a, ".well-known"), { recursive: !0 }), await me(U(a, ".well-known", "security.txt"), _.join(`
|
|
5872
5872
|
`) + `
|
|
5873
5873
|
`));
|
|
5874
5874
|
}
|
|
5875
5875
|
}
|
|
5876
|
-
async function
|
|
5876
|
+
async function $o() {
|
|
5877
5877
|
const i = [...s.values()].filter((f) => !Ft(f.frontmatter) && ve(f)), l = {}, u = /* @__PURE__ */ new Map();
|
|
5878
5878
|
for (const f of i) {
|
|
5879
|
-
const _ =
|
|
5879
|
+
const _ = rt(f);
|
|
5880
5880
|
l[f.effectivePath] = { gate: f.frontmatter.gate, bundle: _, denied: f.frontmatter.gateDenied === void 0 ? void 0 : String(f.frontmatter.gateDenied) };
|
|
5881
|
-
const
|
|
5882
|
-
|
|
5881
|
+
const C = u.get(_) ?? [];
|
|
5882
|
+
C.push(f), u.set(_, C);
|
|
5883
5883
|
}
|
|
5884
5884
|
const b = `/${t.paths.guarded}/`;
|
|
5885
|
-
if (await
|
|
5886
|
-
|
|
5885
|
+
if (await me(
|
|
5886
|
+
U(a, "access.json"),
|
|
5887
5887
|
JSON.stringify({ prefix: b, routes: l }, null, 2) + `
|
|
5888
5888
|
`
|
|
5889
5889
|
), i.length === 0) return;
|
|
5890
|
-
const k =
|
|
5890
|
+
const k = U(a, t.paths.guarded), y = {};
|
|
5891
5891
|
for (const [f, _] of u) {
|
|
5892
|
-
const
|
|
5893
|
-
await Ue(
|
|
5892
|
+
const C = U(k, f);
|
|
5893
|
+
await Ue(U(C, "body"), { recursive: !0 });
|
|
5894
5894
|
const $ = {}, S = _.map((j) => ({
|
|
5895
5895
|
slug: j.slug,
|
|
5896
5896
|
path: j.effectivePath,
|
|
5897
5897
|
type: j.type,
|
|
5898
5898
|
frontmatter: j.frontmatter,
|
|
5899
5899
|
bundle: f
|
|
5900
|
-
})),
|
|
5900
|
+
})), J = [`${f}/manifest.json`, `${f}/search.json`];
|
|
5901
5901
|
for (const j of _) {
|
|
5902
5902
|
j.pageCss && ($[j.effectivePath] = [$[j.effectivePath], j.pageCss].filter(Boolean).join(`
|
|
5903
5903
|
`));
|
|
@@ -5914,117 +5914,117 @@ ${S.join(`
|
|
|
5914
5914
|
dbmlSource: j.dbmlSource,
|
|
5915
5915
|
dbmlFile: j.dbmlFile,
|
|
5916
5916
|
dbmlError: j.dbmlError
|
|
5917
|
-
},
|
|
5918
|
-
await Ue(Y(
|
|
5917
|
+
}, B = U(C, "body", `${De(j.slug)}.json`);
|
|
5918
|
+
await Ue(Y(B), { recursive: !0 }), await me(B, JSON.stringify(O)), J.push(`${f}/body/${De(j.slug)}.json`);
|
|
5919
5919
|
}
|
|
5920
|
-
await
|
|
5921
|
-
|
|
5920
|
+
await me(
|
|
5921
|
+
U(C, "manifest.json"),
|
|
5922
5922
|
JSON.stringify({ shells: S, styles: $, sidebar: an(!0) })
|
|
5923
|
-
), await
|
|
5923
|
+
), await me(U(C, "search.json"), JSON.stringify(ln(!0, _))), y[f] = {
|
|
5924
5924
|
pages: Object.fromEntries(_.map((j) => [j.effectivePath, j.frontmatter.gate ?? ""])),
|
|
5925
|
-
files:
|
|
5925
|
+
files: J
|
|
5926
5926
|
};
|
|
5927
5927
|
}
|
|
5928
|
-
await
|
|
5929
|
-
|
|
5928
|
+
await me(
|
|
5929
|
+
U(a, "guard.map.json"),
|
|
5930
5930
|
JSON.stringify({ prefix: b, routes: l, bundles: y }, null, 2) + `
|
|
5931
5931
|
`
|
|
5932
5932
|
);
|
|
5933
5933
|
}
|
|
5934
|
-
function
|
|
5934
|
+
function xo(i, l) {
|
|
5935
5935
|
if (i.size === 0) return;
|
|
5936
|
-
const u = l.filter((k) =>
|
|
5936
|
+
const u = l.filter((k) => So(k.type)), b = /* @__PURE__ */ new Map();
|
|
5937
5937
|
for (const k of u) b.set(k.filePath, k);
|
|
5938
5938
|
for (const [, k] of i) {
|
|
5939
|
-
const y = k[0], f = Y(y.filePath), _ = y.frontmatter.data,
|
|
5940
|
-
if (typeof
|
|
5941
|
-
else if (Array.isArray(
|
|
5942
|
-
for (const
|
|
5943
|
-
const S = $.length ? $.map((
|
|
5944
|
-
for (const
|
|
5945
|
-
if (
|
|
5939
|
+
const y = k[0], f = Y(y.filePath), _ = y.frontmatter.data, C = _?.issues ?? _?.entries, $ = [];
|
|
5940
|
+
if (typeof C == "string") $.push(C);
|
|
5941
|
+
else if (Array.isArray(C))
|
|
5942
|
+
for (const T of C) typeof T == "string" && $.push(T);
|
|
5943
|
+
const S = $.length ? $.map((T) => G(f, T)) : [f], J = u.filter((T) => {
|
|
5944
|
+
for (const L of S)
|
|
5945
|
+
if (T.filePath !== L && (T.filePath.startsWith(L + "/") || T.filePath.startsWith(L + "\\")))
|
|
5946
5946
|
return !0;
|
|
5947
5947
|
return !1;
|
|
5948
5948
|
}), j = _?.changelog, O = [];
|
|
5949
5949
|
if (typeof j == "string")
|
|
5950
5950
|
O.push(G(f, j));
|
|
5951
5951
|
else if (Array.isArray(j))
|
|
5952
|
-
for (const
|
|
5953
|
-
const
|
|
5954
|
-
for (const
|
|
5955
|
-
if (
|
|
5956
|
-
(
|
|
5952
|
+
for (const T of j) typeof T == "string" && O.push(G(f, T));
|
|
5953
|
+
const B = /* @__PURE__ */ new Map();
|
|
5954
|
+
for (const T of l) {
|
|
5955
|
+
if (T.type !== "changelog" || O.length && !O.some(
|
|
5956
|
+
(pe) => T.filePath === pe || T.filePath.startsWith(pe + "/") || T.filePath.startsWith(pe + "\\")
|
|
5957
5957
|
))
|
|
5958
5958
|
continue;
|
|
5959
|
-
const
|
|
5960
|
-
if (!
|
|
5961
|
-
const
|
|
5962
|
-
if (!
|
|
5963
|
-
const
|
|
5964
|
-
if (!
|
|
5965
|
-
const ee = b.get(
|
|
5959
|
+
const L = T.frontmatter.data, H = L?.issue;
|
|
5960
|
+
if (!H) continue;
|
|
5961
|
+
const ne = String(H).trim();
|
|
5962
|
+
if (!ne) continue;
|
|
5963
|
+
const ae = sn(T.filePath, ne);
|
|
5964
|
+
if (!ae) continue;
|
|
5965
|
+
const ee = b.get(ae);
|
|
5966
5966
|
if (!ee) continue;
|
|
5967
|
-
const
|
|
5968
|
-
let
|
|
5969
|
-
if (typeof
|
|
5970
|
-
const
|
|
5971
|
-
if (["completes", "completed", "complete", "fixes", "closes", "resolves"].includes(
|
|
5972
|
-
|
|
5967
|
+
const I = String(L?.version ?? ""), N = rn(L?.release_date), q = L?.status;
|
|
5968
|
+
let V, K = !1;
|
|
5969
|
+
if (typeof q == "string") {
|
|
5970
|
+
const se = q.trim().toLowerCase();
|
|
5971
|
+
if (["completes", "completed", "complete", "fixes", "closes", "resolves"].includes(se))
|
|
5972
|
+
K = !0;
|
|
5973
5973
|
else {
|
|
5974
|
-
const
|
|
5975
|
-
Number.isFinite(
|
|
5974
|
+
const pe = Number(se.replace(/%$/, ""));
|
|
5975
|
+
Number.isFinite(pe) && (V = pe);
|
|
5976
5976
|
}
|
|
5977
|
-
} else typeof
|
|
5978
|
-
const
|
|
5979
|
-
|
|
5980
|
-
version:
|
|
5981
|
-
title: String(
|
|
5982
|
-
description:
|
|
5983
|
-
releaseDate:
|
|
5984
|
-
progress:
|
|
5985
|
-
completes:
|
|
5986
|
-
path:
|
|
5987
|
-
slug:
|
|
5988
|
-
entrySlug: `${
|
|
5989
|
-
}),
|
|
5977
|
+
} else typeof q == "number" && (V = q);
|
|
5978
|
+
const X = B.get(ee.filePath) ?? [];
|
|
5979
|
+
X.push({
|
|
5980
|
+
version: I,
|
|
5981
|
+
title: String(L?.title ?? T.frontmatter.title),
|
|
5982
|
+
description: L?.description !== void 0 ? String(L.description) : void 0,
|
|
5983
|
+
releaseDate: N,
|
|
5984
|
+
progress: V,
|
|
5985
|
+
completes: K,
|
|
5986
|
+
path: T.effectivePath,
|
|
5987
|
+
slug: I ? `v${I}` : "unreleased",
|
|
5988
|
+
entrySlug: `${T.effectivePath}#${I ? `v${I}` : "unreleased"}`
|
|
5989
|
+
}), B.set(ee.filePath, X);
|
|
5990
5990
|
}
|
|
5991
|
-
const
|
|
5992
|
-
const
|
|
5993
|
-
let
|
|
5994
|
-
const ee =
|
|
5991
|
+
const W = J.map((T) => {
|
|
5992
|
+
const L = T.frontmatter.data, H = T.type, ne = rn(L?.date ?? L?.target_date);
|
|
5993
|
+
let ae;
|
|
5994
|
+
const ee = L?.parent;
|
|
5995
5995
|
if (typeof ee == "string" && ee.trim()) {
|
|
5996
|
-
const
|
|
5997
|
-
|
|
5996
|
+
const X = sn(T.filePath, ee.trim());
|
|
5997
|
+
X && b.has(X) && (ae = b.get(X).effectivePath);
|
|
5998
5998
|
}
|
|
5999
|
-
const
|
|
6000
|
-
(
|
|
6001
|
-
),
|
|
5999
|
+
const I = (B.get(T.filePath) ?? []).slice().sort(
|
|
6000
|
+
(X, se) => (X.releaseDate ?? "").localeCompare(se.releaseDate ?? "")
|
|
6001
|
+
), N = I.some((X) => X.completes), q = String(L?.status ?? "").toLowerCase(), V = q === "shipped" || q === "in_progress" || q === "planned" ? q : N ? "shipped" : I.length ? "in_progress" : "planned", K = I.reduce((X, se) => typeof se.progress == "number" ? Math.max(X ?? 0, se.progress) : X, void 0);
|
|
6002
6002
|
return {
|
|
6003
|
-
kind:
|
|
6004
|
-
slug:
|
|
6005
|
-
filePath:
|
|
6006
|
-
href:
|
|
6007
|
-
title:
|
|
6008
|
-
description:
|
|
6009
|
-
targetDate:
|
|
6010
|
-
parent:
|
|
6011
|
-
progress:
|
|
6012
|
-
status:
|
|
6013
|
-
hidden:
|
|
6014
|
-
html:
|
|
6015
|
-
headings:
|
|
6016
|
-
data:
|
|
6017
|
-
changelog:
|
|
6003
|
+
kind: H,
|
|
6004
|
+
slug: T.slug,
|
|
6005
|
+
filePath: T.filePath,
|
|
6006
|
+
href: T.effectivePath,
|
|
6007
|
+
title: T.frontmatter.title,
|
|
6008
|
+
description: T.frontmatter.description,
|
|
6009
|
+
targetDate: ne,
|
|
6010
|
+
parent: ae,
|
|
6011
|
+
progress: K,
|
|
6012
|
+
status: V,
|
|
6013
|
+
hidden: mt(T.frontmatter),
|
|
6014
|
+
html: T.html,
|
|
6015
|
+
headings: T.headings,
|
|
6016
|
+
data: T.frontmatter.data,
|
|
6017
|
+
changelog: I
|
|
6018
6018
|
};
|
|
6019
6019
|
});
|
|
6020
|
-
|
|
6020
|
+
W.sort((T, L) => (T.targetDate ?? "").localeCompare(L.targetDate ?? "")), y.roadmapEntries = W, y.headings = W.map((T) => ({
|
|
6021
6021
|
level: 2,
|
|
6022
|
-
text:
|
|
6023
|
-
slug:
|
|
6022
|
+
text: T.title,
|
|
6023
|
+
slug: T.slug
|
|
6024
6024
|
}));
|
|
6025
6025
|
}
|
|
6026
6026
|
}
|
|
6027
|
-
function
|
|
6027
|
+
function So(i) {
|
|
6028
6028
|
return i === "milestone" || i === "epic" || i === "feature" || i === "bug";
|
|
6029
6029
|
}
|
|
6030
6030
|
function sn(i, l) {
|
|
@@ -6043,13 +6043,13 @@ ${S.join(`
|
|
|
6043
6043
|
function qe(i, l) {
|
|
6044
6044
|
const u = i ? /^:([a-z0-9]+(?:-[a-z0-9]+)*):$/.exec(i.trim()) : null;
|
|
6045
6045
|
if (u) {
|
|
6046
|
-
const y =
|
|
6046
|
+
const y = lo(u[1], t.icons);
|
|
6047
6047
|
return y || console.warn(`[nimpress] icon ${i} referenced from ${l} is not a known shortcode`), y ?? void 0;
|
|
6048
6048
|
}
|
|
6049
6049
|
if (!i || !/\.svg$/i.test(i.trim())) return i;
|
|
6050
|
-
const b = i.trim(), k = b.startsWith("/") ?
|
|
6050
|
+
const b = i.trim(), k = b.startsWith("/") ? U(n, b) : G(Y(l), b);
|
|
6051
6051
|
try {
|
|
6052
|
-
return
|
|
6052
|
+
return Ce(k, "utf8").trim();
|
|
6053
6053
|
} catch {
|
|
6054
6054
|
console.warn(`[nimpress] sidebar icon ${b} referenced from ${l} is not readable`);
|
|
6055
6055
|
return;
|
|
@@ -6058,11 +6058,11 @@ ${S.join(`
|
|
|
6058
6058
|
function an(i = !1) {
|
|
6059
6059
|
const l = { children: /* @__PURE__ */ new Map() }, u = /* @__PURE__ */ new Map();
|
|
6060
6060
|
for (const y of s.values()) {
|
|
6061
|
-
if (c && (
|
|
6061
|
+
if (c && (je(y.frontmatter) || !i && ve(y)) || y.type === "404" && !y.frontmatter.sidebar?.name) continue;
|
|
6062
6062
|
const f = y.frontmatter.sidebar;
|
|
6063
6063
|
if (y.effectivePath === "/" && !f?.name) continue;
|
|
6064
|
-
const _ = y.effectivePath === "/" ? [f.path ?? f.name] : y.effectivePath.split("/").filter(Boolean),
|
|
6065
|
-
if (f?.name &&
|
|
6064
|
+
const _ = y.effectivePath === "/" ? [f.path ?? f.name] : y.effectivePath.split("/").filter(Boolean), C = y.filePath.endsWith(`${ke}index.md`);
|
|
6065
|
+
if (f?.name && C) {
|
|
6066
6066
|
const j = "/" + _.join("/");
|
|
6067
6067
|
u.set(j, {
|
|
6068
6068
|
label: f.name,
|
|
@@ -6071,15 +6071,15 @@ ${S.join(`
|
|
|
6071
6071
|
});
|
|
6072
6072
|
}
|
|
6073
6073
|
if (y.sidebarOnly && !y.linkTo) continue;
|
|
6074
|
-
const $ =
|
|
6074
|
+
const $ = C ? void 0 : f?.path ?? f?.name;
|
|
6075
6075
|
$ && _[_.length - 2] !== $ && (_.length >= 3 ? _.splice(_.length - 2, 1, $) : _.splice(_.length - 1, 0, $));
|
|
6076
|
-
let S = l,
|
|
6076
|
+
let S = l, J = "";
|
|
6077
6077
|
for (const j of _) {
|
|
6078
|
-
|
|
6078
|
+
J = J + "/" + j;
|
|
6079
6079
|
let O = S.children.get(j);
|
|
6080
|
-
O || (O = { segment: j, fullPath:
|
|
6080
|
+
O || (O = { segment: j, fullPath: J, children: /* @__PURE__ */ new Map() }, S.children.set(j, O)), S = O;
|
|
6081
6081
|
}
|
|
6082
|
-
if (S.page = y, !
|
|
6082
|
+
if (S.page = y, !C && f?.name) {
|
|
6083
6083
|
const j = "/" + _.slice(0, -1).join("/");
|
|
6084
6084
|
u.set(j, {
|
|
6085
6085
|
label: f.name,
|
|
@@ -6093,95 +6093,122 @@ ${S.join(`
|
|
|
6093
6093
|
for (const $ of y.children.values()) f.push(b($));
|
|
6094
6094
|
if (Ut(f), y.page) {
|
|
6095
6095
|
const $ = {
|
|
6096
|
-
text:
|
|
6096
|
+
text: Nn(y.page),
|
|
6097
6097
|
link: y.page.linkTo ?? y.page.effectivePath,
|
|
6098
6098
|
external: y.page.linkTo ? !0 : void 0,
|
|
6099
6099
|
slug: y.page.slug,
|
|
6100
6100
|
gate: y.page.frontmatter.gate,
|
|
6101
6101
|
order: y.page.frontmatter.order,
|
|
6102
6102
|
collapsed: y.page.frontmatter.collapsed,
|
|
6103
|
-
hidden:
|
|
6103
|
+
hidden: mt(y.page.frontmatter),
|
|
6104
6104
|
status: y.page.frontmatter.status
|
|
6105
6105
|
}, S = u.get(y.fullPath);
|
|
6106
6106
|
S?.label && ($.text = S.label), S?.icon && !$.icon && ($.icon = S.icon), S?.style && ($.style = S.style);
|
|
6107
|
-
const
|
|
6108
|
-
if (y.page.type === "openapi" &&
|
|
6109
|
-
const j =
|
|
6107
|
+
const J = y.page.openApiSpec;
|
|
6108
|
+
if (y.page.type === "openapi" && J?.tags?.length) {
|
|
6109
|
+
const j = J.tags.map((O) => ({
|
|
6110
6110
|
text: O.name,
|
|
6111
6111
|
link: `${y.page.effectivePath}#tag/${O.name}`,
|
|
6112
6112
|
slug: `${y.page.slug}__tag__${O.name}`
|
|
6113
6113
|
}));
|
|
6114
6114
|
$.items = [...j, ...f];
|
|
6115
6115
|
} else if (y.page.type === "changelog" && y.page.changelogEntries?.length) {
|
|
6116
|
-
const j = y.page.changelogEntries.map((O,
|
|
6116
|
+
const j = y.page.changelogEntries.map((O, B) => ({
|
|
6117
6117
|
text: O.version ? `v${O.version}` : O.title || "unreleased",
|
|
6118
6118
|
link: `${y.page.effectivePath}#${O.slug}`,
|
|
6119
6119
|
slug: `${y.page.slug}__${O.slug}`,
|
|
6120
6120
|
hidden: O.hidden,
|
|
6121
|
-
order:
|
|
6121
|
+
order: B
|
|
6122
6122
|
}));
|
|
6123
6123
|
$.items = f.length ? [...j, ...f] : j;
|
|
6124
6124
|
} else if (y.page.type === "roadmap" && y.page.roadmapEntries?.length) {
|
|
6125
6125
|
const j = y.page.roadmapEntries.slice().sort(
|
|
6126
|
-
(
|
|
6127
|
-
), O = new Map(j.map((
|
|
6128
|
-
for (const
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6126
|
+
(N, q) => (N.targetDate ?? "").localeCompare(q.targetDate ?? "")
|
|
6127
|
+
), O = Y(y.page.filePath), B = new Map(j.map((N) => [N.href, N])), W = /* @__PURE__ */ new Map(), T = [];
|
|
6128
|
+
for (const N of j) {
|
|
6129
|
+
const q = N.parent ? B.get(N.parent) : void 0;
|
|
6130
|
+
if (N.parent && q && Y(q.filePath) === Y(N.filePath)) {
|
|
6131
|
+
const V = W.get(N.parent) ?? [];
|
|
6132
|
+
V.push(N), W.set(N.parent, V);
|
|
6132
6133
|
} else
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6134
|
+
T.push(N);
|
|
6135
|
+
}
|
|
6136
|
+
const L = (N, q) => {
|
|
6137
|
+
const V = W.get(N.href) ?? [], K = {
|
|
6138
|
+
text: N.title,
|
|
6139
|
+
link: N.href,
|
|
6140
|
+
slug: N.slug,
|
|
6141
|
+
icon: Qr[N.kind],
|
|
6142
|
+
hidden: N.hidden,
|
|
6143
|
+
order: q
|
|
6142
6144
|
};
|
|
6143
|
-
return
|
|
6144
|
-
},
|
|
6145
|
-
|
|
6145
|
+
return V.length && (K.items = V.map((X, se) => L(X, se))), K;
|
|
6146
|
+
}, H = [], ne = /* @__PURE__ */ new Map();
|
|
6147
|
+
T.forEach((N, q) => {
|
|
6148
|
+
const V = L(N, q), K = Y(N.filePath);
|
|
6149
|
+
if (K === O) {
|
|
6150
|
+
H.push(V);
|
|
6151
|
+
return;
|
|
6152
|
+
}
|
|
6153
|
+
let X = ne.get(K);
|
|
6154
|
+
if (!X) {
|
|
6155
|
+
const se = [...s.values()].find((pe) => pe.filePath === U(K, "index.md"));
|
|
6156
|
+
X = {
|
|
6157
|
+
text: se ? Nn(se) : Ve(Pe(K)),
|
|
6158
|
+
link: se?.effectivePath,
|
|
6159
|
+
slug: `${y.page.slug}__${Se(O, K).split(ke).join("/")}`,
|
|
6160
|
+
order: q,
|
|
6161
|
+
items: []
|
|
6162
|
+
}, ne.set(K, X), H.push(X);
|
|
6163
|
+
}
|
|
6164
|
+
V.order = X.items.length, X.items.push(V);
|
|
6165
|
+
});
|
|
6166
|
+
const ae = new Set(j.map((N) => N.slug)), ee = (N) => N.flatMap((q) => {
|
|
6167
|
+
if (q.slug && ae.has(q.slug)) return [];
|
|
6168
|
+
if (!q.items) return [q];
|
|
6169
|
+
const V = ee(q.items);
|
|
6170
|
+
return !V.length && !q.link ? [] : [{ ...q, items: V.length ? V : void 0 }];
|
|
6171
|
+
}), I = ee(f);
|
|
6172
|
+
$.items = I.length ? [...H, ...I] : H;
|
|
6146
6173
|
} else if (y.page.type === "component") {
|
|
6147
6174
|
const j = {
|
|
6148
6175
|
text: "Overview",
|
|
6149
6176
|
link: y.page.effectivePath,
|
|
6150
6177
|
slug: `${y.page.slug}__doc`,
|
|
6151
6178
|
order: -1
|
|
6152
|
-
}, O = (y.page.componentData?.stories ?? []).map((
|
|
6153
|
-
text:
|
|
6154
|
-
link: `${y.page.effectivePath}/${Rt(
|
|
6155
|
-
slug: `${y.page.slug}__story__${Rt(
|
|
6156
|
-
icon: qe(
|
|
6157
|
-
style:
|
|
6158
|
-
order:
|
|
6179
|
+
}, O = (y.page.componentData?.stories ?? []).map((B, W) => ({
|
|
6180
|
+
text: B.sidebar?.name ?? B.name,
|
|
6181
|
+
link: `${y.page.effectivePath}/${Rt(B.name)}`,
|
|
6182
|
+
slug: `${y.page.slug}__story__${Rt(B.name)}`,
|
|
6183
|
+
icon: qe(B.sidebar?.icon, y.page.filePath),
|
|
6184
|
+
style: B.sidebar?.style,
|
|
6185
|
+
order: W
|
|
6159
6186
|
}));
|
|
6160
|
-
$.text =
|
|
6187
|
+
$.text = Ve(y.segment), $.items = [j, ...O, ...f], $.collapsed = !0;
|
|
6161
6188
|
} else f.length && ($.items = f);
|
|
6162
6189
|
return $.collapsed !== !1 && $.items?.some((j) => j.collapsed === !1) && ($.collapsed = !1), $;
|
|
6163
6190
|
}
|
|
6164
|
-
const _ = u.get(y.fullPath),
|
|
6165
|
-
text: _?.label ??
|
|
6191
|
+
const _ = u.get(y.fullPath), C = {
|
|
6192
|
+
text: _?.label ?? Ve(y.segment),
|
|
6166
6193
|
slug: y.fullPath.replace(/^\//, "")
|
|
6167
6194
|
};
|
|
6168
|
-
if (_?.icon && (
|
|
6169
|
-
|
|
6195
|
+
if (_?.icon && (C.icon = _.icon), _?.style && (C.style = _.style), f.length) {
|
|
6196
|
+
C.items = f;
|
|
6170
6197
|
let $ = Number.MAX_SAFE_INTEGER;
|
|
6171
6198
|
for (const S of f)
|
|
6172
6199
|
S.order !== void 0 && S.order < $ && ($ = S.order);
|
|
6173
|
-
$ !== Number.MAX_SAFE_INTEGER && (
|
|
6200
|
+
$ !== Number.MAX_SAFE_INTEGER && (C.order = $);
|
|
6174
6201
|
}
|
|
6175
|
-
return
|
|
6202
|
+
return C.items?.some(($) => $.collapsed === !1) && (C.collapsed = !1), C;
|
|
6176
6203
|
}
|
|
6177
6204
|
const k = [];
|
|
6178
6205
|
for (const y of l.children.values()) k.push(b(y));
|
|
6179
6206
|
return Ut(k), k;
|
|
6180
6207
|
}
|
|
6181
|
-
function
|
|
6208
|
+
function jo(i) {
|
|
6182
6209
|
return `tag-${Ie(i)}`;
|
|
6183
6210
|
}
|
|
6184
|
-
function
|
|
6211
|
+
function Po(i) {
|
|
6185
6212
|
const l = t.tags?.icons;
|
|
6186
6213
|
if (!l) return;
|
|
6187
6214
|
const u = l[t.tags?.map?.[i] ?? i] ?? l.default;
|
|
@@ -6190,34 +6217,34 @@ ${S.join(`
|
|
|
6190
6217
|
function cn() {
|
|
6191
6218
|
const i = /* @__PURE__ */ new Map();
|
|
6192
6219
|
for (const l of s.values())
|
|
6193
|
-
if (!(l.sidebarOnly || l.type === "404" || l.type === "tags") && !(c && (
|
|
6220
|
+
if (!(l.sidebarOnly || l.type === "404" || l.type === "tags") && !(c && (je(l.frontmatter) || ve(l))))
|
|
6194
6221
|
for (const u of Re(l.frontmatter.tags)) {
|
|
6195
|
-
const b = i.get(u) ?? { name: u, slug:
|
|
6222
|
+
const b = i.get(u) ?? { name: u, slug: jo(u), icon: Po(u), pages: [] };
|
|
6196
6223
|
b.pages.push({ slug: l.slug, title: l.frontmatter.title, path: l.effectivePath, description: l.frontmatter.description }), i.set(u, b);
|
|
6197
6224
|
}
|
|
6198
6225
|
return Array.from(i.values()).sort((l, u) => l.name.localeCompare(u.name)).map((l) => ({ ...l, pages: l.pages.sort((u, b) => u.title.localeCompare(b.title)) }));
|
|
6199
6226
|
}
|
|
6200
|
-
function
|
|
6201
|
-
const i =
|
|
6202
|
-
return fe(i) ? Le(i).filter((l) => l.endsWith(".css")).sort().map((l) =>
|
|
6227
|
+
function Ao() {
|
|
6228
|
+
const i = U(n, "styles");
|
|
6229
|
+
return fe(i) ? Le(i).filter((l) => l.endsWith(".css")).sort().map((l) => Mn(l.replace(/\.css$/, ""), Ce(U(i, l), "utf-8"))).join(`
|
|
6203
6230
|
`) : "";
|
|
6204
6231
|
}
|
|
6205
|
-
function
|
|
6232
|
+
function Eo() {
|
|
6206
6233
|
const i = {}, l = {};
|
|
6207
6234
|
for (const [k, y] of s) {
|
|
6208
|
-
if (c && (
|
|
6235
|
+
if (c && (je(y.frontmatter) || ve(y)) || y.sidebarOnly) continue;
|
|
6209
6236
|
const f = {
|
|
6210
6237
|
slug: k,
|
|
6211
6238
|
path: y.effectivePath,
|
|
6212
6239
|
type: y.type,
|
|
6213
6240
|
title: y.frontmatter.title,
|
|
6214
6241
|
gate: y.frontmatter.gate,
|
|
6215
|
-
bundle: ve(y) ?
|
|
6242
|
+
bundle: ve(y) ? rt(y) : void 0,
|
|
6216
6243
|
description: y.frontmatter.description,
|
|
6217
6244
|
order: y.frontmatter.order,
|
|
6218
|
-
hidden:
|
|
6245
|
+
hidden: mt(y.frontmatter),
|
|
6219
6246
|
hide: y.type === "fullpage" ? Array.from(/* @__PURE__ */ new Set(["navigation", "path", "toc", "footer", ...y.frontmatter.hide ?? []])) : y.frontmatter.hide,
|
|
6220
|
-
source:
|
|
6247
|
+
source: Se(n, y.filePath).split(ke).join("/"),
|
|
6221
6248
|
tags: Re(y.frontmatter.tags),
|
|
6222
6249
|
redirect: y.frontmatter.redirect,
|
|
6223
6250
|
meta: y.frontmatter.meta
|
|
@@ -6226,10 +6253,10 @@ ${S.join(`
|
|
|
6226
6253
|
for (const _ of y.componentData?.stories ?? [])
|
|
6227
6254
|
l[`${y.effectivePath}/${Rt(_.name)}`] = k;
|
|
6228
6255
|
}
|
|
6229
|
-
const u = {}, b =
|
|
6256
|
+
const u = {}, b = Ao();
|
|
6230
6257
|
b && (u["/"] = b);
|
|
6231
6258
|
for (const k of s.values())
|
|
6232
|
-
k.sidebarOnly || c && (
|
|
6259
|
+
k.sidebarOnly || c && (je(k.frontmatter) || ve(k)) || k.pageCss && (u[k.effectivePath] = [u[k.effectivePath], k.pageCss].filter(Boolean).join(`
|
|
6233
6260
|
`));
|
|
6234
6261
|
return { pages: i, byPath: l, sidebar: an(), styles: u, tags: cn(), glossary: g };
|
|
6235
6262
|
}
|
|
@@ -6238,20 +6265,20 @@ ${S.join(`
|
|
|
6238
6265
|
for (const [k, y] of b) {
|
|
6239
6266
|
if (y.sidebarOnly || y.type === "404") continue;
|
|
6240
6267
|
if (i) {
|
|
6241
|
-
if (
|
|
6242
|
-
} else if (c && (
|
|
6243
|
-
const f = y.rawText.replace(/```[\s\S]*?```/g, "").replace(/[#*`>_\[\]\(\)]/g, " "), _ = y.type === "openapi" ? Co(y.openApiSpec) : "",
|
|
6268
|
+
if (je(y.frontmatter) || !ve(y)) continue;
|
|
6269
|
+
} else if (c && (je(y.frontmatter) || ve(y))) continue;
|
|
6270
|
+
const f = y.rawText.replace(/```[\s\S]*?```/g, "").replace(/[#*`>_\[\]\(\)]/g, " "), _ = y.type === "openapi" ? Co(y.openApiSpec) : "", C = y.type === "roadmap" ? Oo(y.roadmapEntries ?? []) : "", $ = y.componentData ? [
|
|
6244
6271
|
y.componentData.component,
|
|
6245
6272
|
y.componentData.system,
|
|
6246
6273
|
...(y.componentData.stories ?? []).flatMap((j) => [j.name, j.file])
|
|
6247
|
-
].filter(Boolean).join(" ") : "", S = y.dbmlSource ? y.dbmlSource.replace(/[{}\[\]'"`,]/g, " ") : "",
|
|
6274
|
+
].filter(Boolean).join(" ") : "", S = y.dbmlSource ? y.dbmlSource.replace(/[{}\[\]'"`,]/g, " ") : "", J = [f, _, C, $, S].filter(Boolean).join(`
|
|
6248
6275
|
`);
|
|
6249
6276
|
u.push({
|
|
6250
6277
|
slug: k,
|
|
6251
6278
|
path: y.effectivePath,
|
|
6252
6279
|
title: y.frontmatter.title,
|
|
6253
6280
|
description: y.frontmatter.description,
|
|
6254
|
-
body:
|
|
6281
|
+
body: J,
|
|
6255
6282
|
gate: y.frontmatter.gate,
|
|
6256
6283
|
headings: y.headings.map((j) => j.text),
|
|
6257
6284
|
tags: [
|
|
@@ -6269,17 +6296,17 @@ ${S.join(`
|
|
|
6269
6296
|
if (!i || typeof i != "object") return "";
|
|
6270
6297
|
const l = i, u = [], b = /* @__PURE__ */ new WeakSet(), k = 12, y = (f, _) => {
|
|
6271
6298
|
if (f == null || _ > k) return;
|
|
6272
|
-
const
|
|
6273
|
-
if (
|
|
6299
|
+
const C = typeof f;
|
|
6300
|
+
if (C === "string") {
|
|
6274
6301
|
const $ = f.trim();
|
|
6275
6302
|
$ && u.push($);
|
|
6276
6303
|
return;
|
|
6277
6304
|
}
|
|
6278
|
-
if (
|
|
6305
|
+
if (C === "number" || C === "boolean") {
|
|
6279
6306
|
u.push(String(f));
|
|
6280
6307
|
return;
|
|
6281
6308
|
}
|
|
6282
|
-
if (
|
|
6309
|
+
if (C === "object" && !b.has(f)) {
|
|
6283
6310
|
if (b.add(f), Array.isArray(f)) {
|
|
6284
6311
|
for (const $ of f) y($, _ + 1);
|
|
6285
6312
|
return;
|
|
@@ -6301,8 +6328,8 @@ ${S.join(`
|
|
|
6301
6328
|
for (const f of l.tags ?? []) {
|
|
6302
6329
|
f.name && u.push(f.name), f.description && u.push(f.description);
|
|
6303
6330
|
for (const _ of f.operations ?? []) {
|
|
6304
|
-
const
|
|
6305
|
-
|
|
6331
|
+
const C = _;
|
|
6332
|
+
C.method && u.push(C.method.toLowerCase(), C.method.toUpperCase()), y(_, 0);
|
|
6306
6333
|
}
|
|
6307
6334
|
}
|
|
6308
6335
|
for (const [f, _] of Object.entries(l.schemas ?? {}))
|
|
@@ -6310,7 +6337,7 @@ ${S.join(`
|
|
|
6310
6337
|
return u.join(`
|
|
6311
6338
|
`);
|
|
6312
6339
|
}
|
|
6313
|
-
function
|
|
6340
|
+
function Oo(i) {
|
|
6314
6341
|
const l = [];
|
|
6315
6342
|
for (const u of i) {
|
|
6316
6343
|
l.push(u.slug, u.kind, u.title), u.description && l.push(u.description), u.targetDate && l.push(u.targetDate), u.html && l.push(pn(u.html));
|
|
@@ -6335,8 +6362,8 @@ ${S.join(`
|
|
|
6335
6362
|
function un(i) {
|
|
6336
6363
|
return i === "__root__" ? "" : i;
|
|
6337
6364
|
}
|
|
6338
|
-
function
|
|
6339
|
-
for (const l of [
|
|
6365
|
+
function at(i) {
|
|
6366
|
+
for (const l of [ct, lt, pt, ut]) {
|
|
6340
6367
|
const u = i.moduleGraph.getModuleById("\0" + l);
|
|
6341
6368
|
u && i.moduleGraph.invalidateModule(u);
|
|
6342
6369
|
}
|
|
@@ -6347,10 +6374,10 @@ ${S.join(`
|
|
|
6347
6374
|
k && i.moduleGraph.invalidateModule(k), y && i.moduleGraph.invalidateModule(y);
|
|
6348
6375
|
}
|
|
6349
6376
|
}
|
|
6350
|
-
function
|
|
6377
|
+
function Do() {
|
|
6351
6378
|
const i = [];
|
|
6352
6379
|
for (const [l, u] of s) {
|
|
6353
|
-
if (u.sidebarOnly || c && (
|
|
6380
|
+
if (u.sidebarOnly || c && (je(u.frontmatter) || ve(u))) continue;
|
|
6354
6381
|
const b = `${Ge}${De(l)}.svelte`;
|
|
6355
6382
|
i.push(` ${JSON.stringify(l)}: () => import(${JSON.stringify(b)})`);
|
|
6356
6383
|
}
|
|
@@ -6361,10 +6388,10 @@ ${i.join(`,
|
|
|
6361
6388
|
export default pages
|
|
6362
6389
|
`;
|
|
6363
6390
|
}
|
|
6364
|
-
function
|
|
6391
|
+
function Mo() {
|
|
6365
6392
|
const i = [];
|
|
6366
6393
|
for (const [l, u] of s) {
|
|
6367
|
-
if (u.sidebarOnly || c && (
|
|
6394
|
+
if (u.sidebarOnly || c && (je(u.frontmatter) || ve(u))) continue;
|
|
6368
6395
|
const b = `${We}${De(l)}.js`;
|
|
6369
6396
|
i.push(` ${JSON.stringify(l)}: () => import(${JSON.stringify(b)})`);
|
|
6370
6397
|
}
|
|
@@ -6384,7 +6411,7 @@ export default bodies
|
|
|
6384
6411
|
}
|
|
6385
6412
|
return i.headings;
|
|
6386
6413
|
}
|
|
6387
|
-
function
|
|
6414
|
+
function No(i) {
|
|
6388
6415
|
const l = s.get(i);
|
|
6389
6416
|
if (!l) return null;
|
|
6390
6417
|
const u = {
|
|
@@ -6404,13 +6431,13 @@ export default bodies
|
|
|
6404
6431
|
return `export default ${JSON.stringify(u)}
|
|
6405
6432
|
`;
|
|
6406
6433
|
}
|
|
6407
|
-
function
|
|
6434
|
+
function Et(i) {
|
|
6408
6435
|
return `Custom_${i.replace(/[^a-zA-Z0-9]/g, "_")}`;
|
|
6409
6436
|
}
|
|
6410
|
-
function
|
|
6437
|
+
function Io(i) {
|
|
6411
6438
|
return i.startsWith("/") ? i : "/" + i.replace(/^\.\//, "");
|
|
6412
6439
|
}
|
|
6413
|
-
function
|
|
6440
|
+
function Fo(i) {
|
|
6414
6441
|
const l = s.get(i);
|
|
6415
6442
|
if (!l) return null;
|
|
6416
6443
|
const u = {
|
|
@@ -6418,8 +6445,8 @@ export default bodies
|
|
|
6418
6445
|
path: l.effectivePath,
|
|
6419
6446
|
type: l.type,
|
|
6420
6447
|
frontmatter: l.frontmatter
|
|
6421
|
-
}, b = `${We}${De(i)}.js`, k = JSON.stringify(u).replace(/<\/script>/g, "<\\/script>"), y = Array.from(Ne.entries()), f = y.map(([$, S]) => ` import ${
|
|
6422
|
-
`), _ = ($, S) => Ne.has($) ?
|
|
6448
|
+
}, b = `${We}${De(i)}.js`, k = JSON.stringify(u).replace(/<\/script>/g, "<\\/script>"), y = Array.from(Ne.entries()), f = y.map(([$, S]) => ` import ${Et($)} from ${JSON.stringify(Io(S.file))}`).join(`
|
|
6449
|
+
`), _ = ($, S) => Ne.has($) ? Et($) : S, C = [
|
|
6423
6450
|
["team", "TeamPage"],
|
|
6424
6451
|
["pricing", "PricingPage"],
|
|
6425
6452
|
["glossary", "GlossaryPage"],
|
|
@@ -6432,8 +6459,8 @@ export default bodies
|
|
|
6432
6459
|
["dbml", "DbmlPage"]
|
|
6433
6460
|
].map(([$, S]) => ` {:else if shell.type === ${JSON.stringify($)}}
|
|
6434
6461
|
<${_($, S)} page={{ ...shell, ...mod.default }} />`).concat(
|
|
6435
|
-
y.filter(([$]) => !
|
|
6436
|
-
<${
|
|
6462
|
+
y.filter(([$]) => !ro.has($)).map(([$]) => ` {:else if shell.type === ${JSON.stringify($)}}
|
|
6463
|
+
<${Et($)} page={{ ...shell, ...mod.default }} />`)
|
|
6437
6464
|
).join(`
|
|
6438
6465
|
`);
|
|
6439
6466
|
return `<script lang="ts">
|
|
@@ -6471,7 +6498,7 @@ ${f}
|
|
|
6471
6498
|
{:then mod}
|
|
6472
6499
|
{#if shell.type === 'openapi' && mod.default.openApiSpec}
|
|
6473
6500
|
<OpenApiRoot spec={mod.default.openApiSpec} specFile={mod.default.openApiFile} specUrl={mod.default.openApiUrl} title={shell.frontmatter.title} frontmatter={shell.frontmatter} />
|
|
6474
|
-
${
|
|
6501
|
+
${C}
|
|
6475
6502
|
{:else}
|
|
6476
6503
|
<${_("doc", "Page")} page={{ ...shell, ...mod.default }} />
|
|
6477
6504
|
{/if}
|
|
@@ -6484,7 +6511,7 @@ ${E}
|
|
|
6484
6511
|
return {
|
|
6485
6512
|
name: "@nimtech/nimpress:markdown",
|
|
6486
6513
|
async config() {
|
|
6487
|
-
t = (await
|
|
6514
|
+
t = (await ds(process.cwd(), e)).resolved, n = G(process.cwd(), t.contentDir), oa(process.cwd(), t.pageTypes ?? {});
|
|
6488
6515
|
for (const l of vt(t))
|
|
6489
6516
|
ft.includes(l) || fe(G(process.cwd(), l)) || console.warn(`[nimpress] theme ${l} is neither a built in theme, ${ft.join(" or ")}, nor a stylesheet`);
|
|
6490
6517
|
return o = G(process.cwd(), t.assetsDir), {};
|
|
@@ -6497,8 +6524,8 @@ ${E}
|
|
|
6497
6524
|
},
|
|
6498
6525
|
async closeBundle(i) {
|
|
6499
6526
|
if (!c || i) return;
|
|
6500
|
-
const l =
|
|
6501
|
-
if (await mn(l, u), await
|
|
6527
|
+
const l = U(a, "index.html"), u = U(a, "404.html");
|
|
6528
|
+
if (await mn(l, u), await me(U(a, ".nojekyll"), ""), fe(n) && await fn(n, a, {
|
|
6502
6529
|
recursive: !0,
|
|
6503
6530
|
filter: (k) => {
|
|
6504
6531
|
try {
|
|
@@ -6508,16 +6535,16 @@ ${E}
|
|
|
6508
6535
|
}
|
|
6509
6536
|
}
|
|
6510
6537
|
}), fe(o)) {
|
|
6511
|
-
const k =
|
|
6538
|
+
const k = U(a, t.assetUrlBase.replace(/^\//, ""));
|
|
6512
6539
|
await fn(o, k, { recursive: !0 });
|
|
6513
6540
|
}
|
|
6514
6541
|
for (const [k, y] of ze) {
|
|
6515
|
-
const f =
|
|
6516
|
-
await Ue(Y(f), { recursive: !0 }), await
|
|
6542
|
+
const f = U(a, k.replace(/^\//, ""));
|
|
6543
|
+
await Ue(Y(f), { recursive: !0 }), await me(f, y);
|
|
6517
6544
|
}
|
|
6518
|
-
await
|
|
6519
|
-
const b = Array.from(s.values()).find((k) => k.type === "404" && !
|
|
6520
|
-
b && await mn(
|
|
6545
|
+
await me(U(a, "subscribe.map.json"), jt), await ko();
|
|
6546
|
+
const b = Array.from(s.values()).find((k) => k.type === "404" && !je(k.frontmatter) && !ve(k));
|
|
6547
|
+
b && await mn(U(a, b.effectivePath.replace(/^\//, ""), "index.html"), U(a, "404.html")), await $o();
|
|
6521
6548
|
},
|
|
6522
6549
|
configureServer(i) {
|
|
6523
6550
|
p = i, i.watcher.add(n), i.watcher.add(o);
|
|
@@ -6525,44 +6552,44 @@ ${E}
|
|
|
6525
6552
|
for (const f of h) i.watcher.add(f);
|
|
6526
6553
|
const l = async (f) => {
|
|
6527
6554
|
if (!(!f.startsWith(n) || !(f.endsWith(".md") || f.endsWith(".css") || f.match(/\.story\.tsx?$/)))) {
|
|
6528
|
-
f.endsWith(".css") && de(f.replace(/(\.[a-z0-9-]+)?\.css$/, ".md")), f.match(/\.story\.tsx?$/) && de(
|
|
6555
|
+
f.endsWith(".css") && de(f.replace(/(\.[a-z0-9-]+)?\.css$/, ".md")), f.match(/\.story\.tsx?$/) && de(U(Y(f), "index.md"));
|
|
6529
6556
|
try {
|
|
6530
6557
|
await He();
|
|
6531
|
-
} catch (
|
|
6532
|
-
i.config.logger.error(String(
|
|
6558
|
+
} catch (C) {
|
|
6559
|
+
i.config.logger.error(String(C));
|
|
6533
6560
|
return;
|
|
6534
6561
|
}
|
|
6535
|
-
|
|
6562
|
+
at(i), At(i), Je(), i.ws.send({ type: "full-reload" });
|
|
6536
6563
|
}
|
|
6537
6564
|
}, u = async (f) => {
|
|
6538
6565
|
if (f.startsWith(n) && (f.endsWith(".md") || f.endsWith(".css") || f.match(/\.story\.tsx?$/))) {
|
|
6539
|
-
f.match(/\.story\.tsx?$/) ? de(
|
|
6566
|
+
f.match(/\.story\.tsx?$/) ? de(U(Y(f), "index.md")) : de(f.endsWith(".css") ? f.replace(/(\.[a-z0-9-]+)?\.css$/, ".md") : f);
|
|
6540
6567
|
try {
|
|
6541
6568
|
await He();
|
|
6542
|
-
} catch (
|
|
6543
|
-
i.config.logger.error(String(
|
|
6569
|
+
} catch (C) {
|
|
6570
|
+
i.config.logger.error(String(C));
|
|
6544
6571
|
return;
|
|
6545
6572
|
}
|
|
6546
|
-
|
|
6573
|
+
at(i), At(i), Je(), i.ws.send({ type: "full-reload" });
|
|
6547
6574
|
return;
|
|
6548
6575
|
}
|
|
6549
6576
|
if (P.has(f)) {
|
|
6550
|
-
const
|
|
6551
|
-
de(
|
|
6577
|
+
const C = P.get(f);
|
|
6578
|
+
de(C);
|
|
6552
6579
|
}
|
|
6553
|
-
|
|
6580
|
+
M.has(f) && de(M.get(f));
|
|
6554
6581
|
};
|
|
6555
6582
|
if (i.watcher.on("add", l), i.watcher.on("unlink", u), t.banner !== !1) {
|
|
6556
|
-
const f =
|
|
6583
|
+
const f = Ns(), _ = t.banner, C = Date.now();
|
|
6557
6584
|
i.printUrls = function() {
|
|
6558
|
-
const $ = i.resolvedUrls, S = $?.local?.[0] ?? `http://localhost:${i.config.server.port ?? 5173}/`,
|
|
6585
|
+
const $ = i.resolvedUrls, S = $?.local?.[0] ?? `http://localhost:${i.config.server.port ?? 5173}/`, J = $?.network?.[0] ?? "use --host to expose", j = Ts({
|
|
6559
6586
|
title: _.title ?? t.title ?? f.name ?? "Nimpress",
|
|
6560
6587
|
tagline: _.tagline,
|
|
6561
6588
|
company: _.company,
|
|
6562
6589
|
version: _.version ?? f.version,
|
|
6563
6590
|
localUrl: S,
|
|
6564
|
-
networkUrl:
|
|
6565
|
-
duration: Date.now() -
|
|
6591
|
+
networkUrl: J,
|
|
6592
|
+
duration: Date.now() - C
|
|
6566
6593
|
});
|
|
6567
6594
|
process.stdout.write("\x1Bc"), process.stdout.write(j + `
|
|
6568
6595
|
`), Je();
|
|
@@ -6584,54 +6611,54 @@ ${E}
|
|
|
6584
6611
|
".woff": "font/woff",
|
|
6585
6612
|
".woff2": "font/woff2",
|
|
6586
6613
|
".mp4": "video/mp4"
|
|
6587
|
-
}, k = t.assetUrlBase, y = (f, _,
|
|
6614
|
+
}, k = t.assetUrlBase, y = (f, _, C) => {
|
|
6588
6615
|
if (!_ || _.endsWith(".md")) return !1;
|
|
6589
|
-
const $ =
|
|
6590
|
-
return !$.startsWith(f) || !fe($) || !gt($).isFile() ? !1 : (
|
|
6616
|
+
const $ = U(f, decodeURIComponent(_));
|
|
6617
|
+
return !$.startsWith(f) || !fe($) || !gt($).isFile() ? !1 : (C.setHeader("Content-Type", b[Gt($).toLowerCase()] ?? "application/octet-stream"), Ro($).pipe(C), !0);
|
|
6591
6618
|
};
|
|
6592
|
-
return i.middlewares.use((f, _,
|
|
6593
|
-
const $ = (f.url ?? "").split("?")[0], S =
|
|
6594
|
-
if (S.startsWith("/@") || S.startsWith("/node_modules/")) return
|
|
6619
|
+
return i.middlewares.use((f, _, C) => {
|
|
6620
|
+
const $ = (f.url ?? "").split("?")[0], S = os(t.base, $);
|
|
6621
|
+
if (S.startsWith("/@") || S.startsWith("/node_modules/")) return C();
|
|
6595
6622
|
if (S === "/__nimpress/claude-md" && f.method === "PUT") {
|
|
6596
|
-
const
|
|
6597
|
-
f.on("data", (
|
|
6623
|
+
const B = [];
|
|
6624
|
+
f.on("data", (W) => B.push(W)), f.on("end", async () => {
|
|
6598
6625
|
try {
|
|
6599
|
-
const
|
|
6600
|
-
if (!Object.values(t.modules.systems).filter((ee) => ee.source).map((ee) => G(process.cwd(), ee.source)).some((ee) =>
|
|
6626
|
+
const W = JSON.parse(Buffer.concat(B).toString("utf-8")), T = String(W.path ?? ""), L = String(W.content ?? ""), H = G(process.cwd(), T);
|
|
6627
|
+
if (!Object.values(t.modules.systems).filter((ee) => ee.source).map((ee) => G(process.cwd(), ee.source)).some((ee) => H.startsWith(ee + ke)) || !H.endsWith(`${ke}CLAUDE.md`) || !fe(Y(H))) {
|
|
6601
6628
|
_.statusCode = 403, _.end("invalid claude-md target");
|
|
6602
6629
|
return;
|
|
6603
6630
|
}
|
|
6604
|
-
await
|
|
6605
|
-
} catch (
|
|
6606
|
-
_.statusCode = 400, _.end(String(
|
|
6631
|
+
await me(H, L), de(M.get(H) ?? ""), _.statusCode = 204, _.end();
|
|
6632
|
+
} catch (W) {
|
|
6633
|
+
_.statusCode = 400, _.end(String(W));
|
|
6607
6634
|
}
|
|
6608
6635
|
});
|
|
6609
6636
|
return;
|
|
6610
6637
|
}
|
|
6611
6638
|
if (S === "/__nimpress/schema-defaults" && f.method === "PUT") {
|
|
6612
|
-
const
|
|
6613
|
-
f.on("data", (
|
|
6639
|
+
const B = [];
|
|
6640
|
+
f.on("data", (W) => B.push(W)), f.on("end", async () => {
|
|
6614
6641
|
try {
|
|
6615
|
-
const
|
|
6616
|
-
if (!
|
|
6642
|
+
const W = JSON.parse(Buffer.concat(B).toString("utf-8")), T = String(W.path ?? ""), L = G(process.cwd(), T), H = L.endsWith(`${ke}schema.json`) || L.endsWith(`${ke}schema.yml`);
|
|
6643
|
+
if (!L.startsWith(n + ke) || !H || !fe(L)) {
|
|
6617
6644
|
_.statusCode = 403, _.end("invalid schema target");
|
|
6618
6645
|
return;
|
|
6619
6646
|
}
|
|
6620
|
-
const
|
|
6621
|
-
for (const [ee,
|
|
6622
|
-
const
|
|
6623
|
-
|
|
6647
|
+
const ne = L.endsWith(".yml") ? "yml" : "json", ae = st(await ce(L, "utf-8"), ne);
|
|
6648
|
+
for (const [ee, I] of Object.entries(W.defaults ?? {})) {
|
|
6649
|
+
const N = ae.properties?.[ee];
|
|
6650
|
+
N && (N.default = I);
|
|
6624
6651
|
}
|
|
6625
|
-
await
|
|
6626
|
-
} catch (
|
|
6627
|
-
_.statusCode = 400, _.end(String(
|
|
6652
|
+
await me(L, tt(ae, ne)), de(M.get(L) ?? ""), _.statusCode = 204, _.end();
|
|
6653
|
+
} catch (W) {
|
|
6654
|
+
_.statusCode = 400, _.end(String(W));
|
|
6628
6655
|
}
|
|
6629
6656
|
});
|
|
6630
6657
|
return;
|
|
6631
6658
|
}
|
|
6632
|
-
const
|
|
6633
|
-
if (
|
|
6634
|
-
_.setHeader("Content-Type", "application/rss+xml; charset=utf-8"), _.end(
|
|
6659
|
+
const J = ze.get(S);
|
|
6660
|
+
if (J !== void 0) {
|
|
6661
|
+
_.setHeader("Content-Type", "application/rss+xml; charset=utf-8"), _.end(J);
|
|
6635
6662
|
return;
|
|
6636
6663
|
}
|
|
6637
6664
|
if (S === "/subscribe.map.json") {
|
|
@@ -6640,81 +6667,81 @@ ${E}
|
|
|
6640
6667
|
}
|
|
6641
6668
|
const j = t.modules.route.replace(/\/$/, "");
|
|
6642
6669
|
if (S === j || S.startsWith(j + "/")) {
|
|
6643
|
-
const
|
|
6644
|
-
if (!t.modules.systems[
|
|
6645
|
-
_.statusCode = 404, _.end(`unknown module system: ${
|
|
6670
|
+
const B = S.slice(j.length).replace(/^\/+/, ""), W = decodeURIComponent(B.split("/")[0] ?? "");
|
|
6671
|
+
if (!t.modules.systems[W]) {
|
|
6672
|
+
_.statusCode = 404, _.end(`unknown module system: ${W}`);
|
|
6646
6673
|
return;
|
|
6647
6674
|
}
|
|
6648
|
-
const
|
|
6675
|
+
const L = Bo(
|
|
6649
6676
|
{
|
|
6650
6677
|
host: "127.0.0.1",
|
|
6651
|
-
port: qt(t.modules,
|
|
6678
|
+
port: qt(t.modules, W),
|
|
6652
6679
|
path: `${S}${(f.url ?? "").includes("?") ? `?${(f.url ?? "").split("?").slice(1).join("?")}` : ""}`,
|
|
6653
6680
|
method: f.method,
|
|
6654
6681
|
headers: f.headers
|
|
6655
6682
|
},
|
|
6656
|
-
(
|
|
6657
|
-
_.writeHead(
|
|
6683
|
+
(H) => {
|
|
6684
|
+
_.writeHead(H.statusCode ?? 502, H.headers), H.pipe(_);
|
|
6658
6685
|
}
|
|
6659
6686
|
);
|
|
6660
|
-
|
|
6687
|
+
L.on("error", () => {
|
|
6661
6688
|
_.statusCode = 503, _.setHeader("Content-Type", "text/html"), _.end(
|
|
6662
|
-
`<!doctype html><html><body style="font-family:monospace;padding:2rem"><p>module harness for <b>${
|
|
6689
|
+
`<!doctype html><html><body style="font-family:monospace;padding:2rem"><p>module harness for <b>${W}</b> is not running.</p><p>start it with: <code>nimpress modules dev ${W}</code></p></body></html>`
|
|
6663
6690
|
);
|
|
6664
|
-
}), f.pipe(
|
|
6691
|
+
}), f.pipe(L);
|
|
6665
6692
|
return;
|
|
6666
6693
|
}
|
|
6667
6694
|
if (k === "/" || S === k || S.startsWith(k + "/")) {
|
|
6668
|
-
const
|
|
6669
|
-
if (y(o,
|
|
6695
|
+
const B = k === "/" ? S : S.slice(k.length);
|
|
6696
|
+
if (y(o, B.replace(/^\/+/, ""), _)) return;
|
|
6670
6697
|
}
|
|
6671
|
-
y(n, S.replace(/^\/+/, ""), _) ||
|
|
6698
|
+
y(n, S.replace(/^\/+/, ""), _) || C();
|
|
6672
6699
|
}), () => {
|
|
6673
|
-
i.middlewares.use(async (f, _,
|
|
6674
|
-
if (f.method !== "GET" && f.method !== "HEAD" || !(f.headers.accept ?? "").includes("text/html")) return
|
|
6700
|
+
i.middlewares.use(async (f, _, C) => {
|
|
6701
|
+
if (f.method !== "GET" && f.method !== "HEAD" || !(f.headers.accept ?? "").includes("text/html")) return C();
|
|
6675
6702
|
try {
|
|
6676
6703
|
const $ = await i.transformIndexHtml(
|
|
6677
6704
|
f.url ?? "/",
|
|
6678
|
-
|
|
6705
|
+
Xr(t, "/@id/__x00__virtual:nimpress/main")
|
|
6679
6706
|
);
|
|
6680
6707
|
_.statusCode = 200, _.setHeader("Content-Type", "text/html"), _.end($);
|
|
6681
6708
|
} catch ($) {
|
|
6682
|
-
|
|
6709
|
+
C($);
|
|
6683
6710
|
}
|
|
6684
6711
|
});
|
|
6685
6712
|
};
|
|
6686
6713
|
},
|
|
6687
6714
|
async handleHotUpdate(i) {
|
|
6688
|
-
const l = i.file, u = l.endsWith(".md") && l.startsWith(n), b = l.endsWith(".css") && l.startsWith(n), k = l.match(/\.story\.tsx?$/) && l.startsWith(n), y = P.get(l), f =
|
|
6715
|
+
const l = i.file, u = l.endsWith(".md") && l.startsWith(n), b = l.endsWith(".css") && l.startsWith(n), k = l.match(/\.story\.tsx?$/) && l.startsWith(n), y = P.get(l), f = M.get(l);
|
|
6689
6716
|
if (b) {
|
|
6690
6717
|
de(l.replace(/(\.[a-z0-9-]+)?\.css$/, ".md"));
|
|
6691
6718
|
try {
|
|
6692
6719
|
await He();
|
|
6693
|
-
} catch (
|
|
6694
|
-
i.server.config.logger.error(String(
|
|
6720
|
+
} catch (C) {
|
|
6721
|
+
i.server.config.logger.error(String(C));
|
|
6695
6722
|
return;
|
|
6696
6723
|
}
|
|
6697
|
-
return
|
|
6724
|
+
return at(i.server), i.server.ws.send({ type: "full-reload" }), [];
|
|
6698
6725
|
}
|
|
6699
6726
|
if (!u && !k && !y && !f) return;
|
|
6700
|
-
const _ = u ? l : k ?
|
|
6727
|
+
const _ = u ? l : k ? U(Y(l), "index.md") : y ?? f;
|
|
6701
6728
|
de(_);
|
|
6702
6729
|
try {
|
|
6703
6730
|
await He();
|
|
6704
|
-
} catch (
|
|
6705
|
-
i.server.config.logger.error(String(
|
|
6731
|
+
} catch (C) {
|
|
6732
|
+
i.server.config.logger.error(String(C));
|
|
6706
6733
|
return;
|
|
6707
6734
|
}
|
|
6708
|
-
return
|
|
6735
|
+
return at(i.server), At(i.server), Je(), i.server.ws.send({ type: "full-reload" }), [];
|
|
6709
6736
|
},
|
|
6710
6737
|
resolveId(i) {
|
|
6711
|
-
return i ===
|
|
6738
|
+
return i === ct ? "\0" + ct : i === lt ? "\0" + lt : i === pt ? "\0" + pt : i === ut ? "\0" + ut : i === Mt ? "\0" + Mt : i === Tt ? "\0" + Tt : i.startsWith(Ge) && i.endsWith(".svelte") || i.startsWith(We) && i.endsWith(".js") ? i : null;
|
|
6712
6739
|
},
|
|
6713
6740
|
async load(i) {
|
|
6714
|
-
if (i === "\0" +
|
|
6715
|
-
return `export default ${JSON.stringify(
|
|
6716
|
-
if (i === "\0" +
|
|
6717
|
-
const l =
|
|
6741
|
+
if (i === "\0" + ct)
|
|
6742
|
+
return `export default ${JSON.stringify(Eo())}`;
|
|
6743
|
+
if (i === "\0" + Mt) {
|
|
6744
|
+
const l = hs(t), u = l.announce || l.feedback ? Tn(await D(), be(), t.base, { math: t.math, icons: t.icons }) : null;
|
|
6718
6745
|
if (l.feedback && u && (l.feedback = {
|
|
6719
6746
|
...l.feedback,
|
|
6720
6747
|
ratings: l.feedback.ratings.map((b) => ({ ...b, html: u.renderInline(b.note) }))
|
|
@@ -6727,10 +6754,10 @@ ${E}
|
|
|
6727
6754
|
}
|
|
6728
6755
|
return `export default ${JSON.stringify(l)}`;
|
|
6729
6756
|
}
|
|
6730
|
-
if (i === "\0" +
|
|
6757
|
+
if (i === "\0" + Tt) {
|
|
6731
6758
|
const l = (S) => S.startsWith("/") ? S : "/" + S.replace(/^\.\//, ""), b = [...vt(t).filter((S) => S !== "stock").map((S) => ft.includes(S) ? `@nimtech/nimpress/themes/${S}.css` : l(S)), ...t.css.map(l)].map((S) => `import ${JSON.stringify(S)}`).join(`
|
|
6732
|
-
`), k = Object.entries(t.components), y = k.map(([S,
|
|
6733
|
-
`), f = k.length ? `, components: { ${k.map(([S]) => `${S}: Nimpress${S}`).join(", ")} }` : "", _ = t.client ? l(t.client) : null,
|
|
6759
|
+
`), k = Object.entries(t.components), y = k.map(([S, J]) => `import Nimpress${S} from ${JSON.stringify(l(J))}`).join(`
|
|
6760
|
+
`), f = k.length ? `, components: { ${k.map(([S]) => `${S}: Nimpress${S}`).join(", ")} }` : "", _ = t.client ? l(t.client) : null, C = _ ? `import { authFunctions, subscribeFunctions, feedbackFunctions } from ${JSON.stringify(_)}` : "";
|
|
6734
6761
|
return `import '@nimtech/nimpress/app.css'
|
|
6735
6762
|
${b}
|
|
6736
6763
|
import { createNimpressApp } from '@nimtech/nimpress'
|
|
@@ -6738,7 +6765,7 @@ import config from 'virtual:nimpress/config'
|
|
|
6738
6765
|
import manifest from 'virtual:nimpress/manifest'
|
|
6739
6766
|
import searchIndex from 'virtual:nimpress/search'
|
|
6740
6767
|
import pages from 'virtual:nimpress/pages'
|
|
6741
|
-
${
|
|
6768
|
+
${C}
|
|
6742
6769
|
${y}
|
|
6743
6770
|
const app = createNimpressApp({ ...config, manifest, searchIndex, pageLoader: pages${f}${_ ? ", authFunctions, subscribeFunctions, feedbackFunctions" : ""} })
|
|
6744
6771
|
const target = document.getElementById('app')
|
|
@@ -6746,19 +6773,19 @@ if (!target) throw new Error('Mount target #app missing')
|
|
|
6746
6773
|
app.mount(target)
|
|
6747
6774
|
`;
|
|
6748
6775
|
}
|
|
6749
|
-
if (i === "\0" + ct)
|
|
6750
|
-
return `export default ${JSON.stringify(ln())}`;
|
|
6751
6776
|
if (i === "\0" + lt)
|
|
6752
|
-
return
|
|
6777
|
+
return `export default ${JSON.stringify(ln())}`;
|
|
6753
6778
|
if (i === "\0" + pt)
|
|
6754
6779
|
return Do();
|
|
6780
|
+
if (i === "\0" + ut)
|
|
6781
|
+
return Mo();
|
|
6755
6782
|
if (i.startsWith(Ge) && i.endsWith(".svelte")) {
|
|
6756
6783
|
const l = i.slice(Ge.length, -7);
|
|
6757
|
-
return
|
|
6784
|
+
return Fo(un(l));
|
|
6758
6785
|
}
|
|
6759
6786
|
if (i.startsWith(We) && i.endsWith(".js")) {
|
|
6760
6787
|
const l = i.slice(We.length, -3);
|
|
6761
|
-
return
|
|
6788
|
+
return No(un(l));
|
|
6762
6789
|
}
|
|
6763
6790
|
return null;
|
|
6764
6791
|
}
|
|
@@ -6772,52 +6799,52 @@ async function $i(e, t) {
|
|
|
6772
6799
|
for (const r of o) {
|
|
6773
6800
|
let a;
|
|
6774
6801
|
try {
|
|
6775
|
-
a = await
|
|
6802
|
+
a = await ce(r, "utf-8");
|
|
6776
6803
|
} catch {
|
|
6777
6804
|
continue;
|
|
6778
6805
|
}
|
|
6779
6806
|
const { data: c, content: p } = _t(a);
|
|
6780
6807
|
typeof c.type == "number" && (c.type = String(c.type));
|
|
6781
|
-
for (const d of
|
|
6782
|
-
s.push(`${
|
|
6808
|
+
for (const d of ao(c, p))
|
|
6809
|
+
s.push(`${Se(n, r).split(ke).join("/")}: ${d}`);
|
|
6783
6810
|
}
|
|
6784
6811
|
return s;
|
|
6785
6812
|
}
|
|
6786
6813
|
export {
|
|
6787
|
-
|
|
6788
|
-
|
|
6814
|
+
Da as A,
|
|
6815
|
+
Ma as B,
|
|
6789
6816
|
vi as C,
|
|
6790
|
-
|
|
6791
|
-
|
|
6792
|
-
|
|
6817
|
+
ds as D,
|
|
6818
|
+
pa as E,
|
|
6819
|
+
aa as F,
|
|
6793
6820
|
Ua as G,
|
|
6794
6821
|
ki as H,
|
|
6795
|
-
|
|
6796
|
-
|
|
6797
|
-
|
|
6822
|
+
Mn as I,
|
|
6823
|
+
Oa as J,
|
|
6824
|
+
zr as a,
|
|
6798
6825
|
Qt as b,
|
|
6799
6826
|
xt as c,
|
|
6800
|
-
|
|
6827
|
+
Ke as d,
|
|
6801
6828
|
$n as e,
|
|
6802
6829
|
Sn as f,
|
|
6803
6830
|
Je as g,
|
|
6804
6831
|
gi as h,
|
|
6805
|
-
|
|
6832
|
+
Xr as i,
|
|
6806
6833
|
bi as j,
|
|
6807
6834
|
qt as k,
|
|
6808
|
-
|
|
6835
|
+
oa as l,
|
|
6809
6836
|
$i as m,
|
|
6810
|
-
|
|
6811
|
-
|
|
6812
|
-
|
|
6837
|
+
Ea as n,
|
|
6838
|
+
Vn as o,
|
|
6839
|
+
st as p,
|
|
6813
6840
|
hi as q,
|
|
6814
6841
|
$t as r,
|
|
6815
|
-
|
|
6842
|
+
ot as s,
|
|
6816
6843
|
_i as t,
|
|
6817
|
-
|
|
6844
|
+
vr as u,
|
|
6818
6845
|
di as v,
|
|
6819
6846
|
tn as w,
|
|
6820
6847
|
wi as x,
|
|
6821
6848
|
yi as y,
|
|
6822
|
-
|
|
6849
|
+
Dr as z
|
|
6823
6850
|
};
|