@nimtech/nimpress 2.7.0 → 2.8.0
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/docs-sync.md +5 -1
- package/.claude/rules/frontmatter.md +2 -0
- package/dist/cli.es.js +1017 -972
- package/dist/nimpress.es.js +1 -1
- package/dist/{plugin-C8OdcVeq.js → plugin-DOHMact8.js} +252 -250
- package/dist/plugin.es.js +1 -1
- package/dist/src/cli/export.d.ts +1 -1
- package/dist/src/cli/export.d.ts.map +1 -1
- package/dist/src/cli/site.d.ts.map +1 -1
- package/dist/src/types.d.ts +4 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { readFile as le, readdir as Jt, writeFile as fe, copyFile as dn, cp as hn, mkdir as Je } from "node:fs/promises";
|
|
2
|
-
import { existsSync as he, readFileSync as Ce, statSync as
|
|
2
|
+
import { existsSync as he, readFileSync as Ce, statSync as yt, readdirSync as He, createReadStream as Ho } from "node:fs";
|
|
3
3
|
import { createRequire as Bn } from "node:module";
|
|
4
4
|
import { request as zo } from "node:http";
|
|
5
5
|
import { execFileSync as qo } from "node:child_process";
|
|
6
6
|
import { resolve as V, dirname as K, join as U, relative as Se, basename as Pe, extname as Gt, isAbsolute as xe, sep as $e } from "node:path";
|
|
7
7
|
import { createHash as Wn } from "node:crypto";
|
|
8
|
-
import
|
|
8
|
+
import bt from "gray-matter";
|
|
9
9
|
import Ln from "markdown-it";
|
|
10
10
|
import gn from "markdown-it-anchor";
|
|
11
11
|
import Uo from "markdown-it-attrs";
|
|
@@ -18,7 +18,7 @@ import { parse as zn, stringify as Xo } from "yaml";
|
|
|
18
18
|
import { createHighlighter as Yo } from "shiki";
|
|
19
19
|
import { fileURLToPath as Ko, pathToFileURL as _n } from "node:url";
|
|
20
20
|
import { exporter as Zo } from "@dbml/core";
|
|
21
|
-
import { n as Qo, r as et, e as
|
|
21
|
+
import { n as Qo, r as et, e as wt, b as Lt, p as qn, c as Vt, d as Xt, g as vt, h as es, k as Yt, o as ts, s as ns, j as we, m as os, a as Un, l as ss, q as rs, t as as } from "./typeMembers-CNvE92EX.js";
|
|
22
22
|
import { loadConfigFromFile as is } from "vite";
|
|
23
23
|
const yn = {
|
|
24
24
|
out: "dist",
|
|
@@ -88,7 +88,7 @@ const yn = {
|
|
|
88
88
|
"TryPanel",
|
|
89
89
|
"TryDialog"
|
|
90
90
|
];
|
|
91
|
-
function
|
|
91
|
+
function kt(e) {
|
|
92
92
|
return dt.includes(e) ? e : e.replace(/^.*\//, "").replace(/\.css$/, "");
|
|
93
93
|
}
|
|
94
94
|
const ls = u.object({
|
|
@@ -246,13 +246,13 @@ const hs = ["nimpress.config.ts", "nimpress.config.js", "nimpress.config.mjs", "
|
|
|
246
246
|
function wn(e) {
|
|
247
247
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
248
248
|
}
|
|
249
|
-
function
|
|
249
|
+
function Ht(e, t) {
|
|
250
250
|
if (!t) return e;
|
|
251
251
|
const n = { ...e };
|
|
252
252
|
for (const [o, s] of Object.entries(t)) {
|
|
253
253
|
if (s === void 0) continue;
|
|
254
254
|
const r = n[o];
|
|
255
|
-
wn(r) && wn(s) ? n[o] =
|
|
255
|
+
wn(r) && wn(s) ? n[o] = Ht(r, s) : n[o] = s;
|
|
256
256
|
}
|
|
257
257
|
return n;
|
|
258
258
|
}
|
|
@@ -271,8 +271,8 @@ async function gs(e) {
|
|
|
271
271
|
}
|
|
272
272
|
async function _s(e, t) {
|
|
273
273
|
const n = await gs(e), o = n?.config ? { ...n.config, modules: void 0 } : void 0, s = t ? { ...t, modules: void 0 } : void 0;
|
|
274
|
-
let r =
|
|
275
|
-
r =
|
|
274
|
+
let r = Ht(Ke, o);
|
|
275
|
+
r = Ht(r, s), r.css = typeof r.css == "string" ? [r.css] : r.css ?? [], r.base = Qo(r.base);
|
|
276
276
|
const i = t?.modules ?? n?.config?.modules;
|
|
277
277
|
return r.modules = {
|
|
278
278
|
dir: Ke.modules.dir,
|
|
@@ -286,8 +286,8 @@ function ys(e) {
|
|
|
286
286
|
logo: e.logo,
|
|
287
287
|
github: e.github,
|
|
288
288
|
brand: e.brand,
|
|
289
|
-
theme:
|
|
290
|
-
themes:
|
|
289
|
+
theme: kt(e.theme),
|
|
290
|
+
themes: $t(e).map(kt),
|
|
291
291
|
base: e.base,
|
|
292
292
|
contentRoot: e.contentDir,
|
|
293
293
|
navRoutes: e.navRoutes,
|
|
@@ -305,7 +305,7 @@ function ys(e) {
|
|
|
305
305
|
guardedBase: `/${e.paths.guarded}`
|
|
306
306
|
};
|
|
307
307
|
}
|
|
308
|
-
function
|
|
308
|
+
function $t(e) {
|
|
309
309
|
return Array.from(/* @__PURE__ */ new Set([...e.themes, e.theme]));
|
|
310
310
|
}
|
|
311
311
|
function bs(e) {
|
|
@@ -2443,7 +2443,7 @@ function Ms(e, t) {
|
|
|
2443
2443
|
}, t || {});
|
|
2444
2444
|
Cs(e, o);
|
|
2445
2445
|
}
|
|
2446
|
-
const pe = "\x1B[0m",
|
|
2446
|
+
const pe = "\x1B[0m", xt = "\x1B[1m", ht = "\x1B[2m", Jn = "\x1B[38;2;204;120;92m", Ee = "\x1B[38;2;229;174;156m", Ne = "\x1B[38;2;160;160;170m", ct = [
|
|
2447
2447
|
" ███╗ ██╗ ██╗ ███╗ ███╗ ██████╗ ██████╗ ███████╗ ███████╗ ███████╗",
|
|
2448
2448
|
" ████╗ ██║ ██║ ████╗ ████║ ██╔══██╗ ██╔══██╗ ██╔════╝ ██╔════╝ ██╔════╝",
|
|
2449
2449
|
" ██╔██╗ ██║ ██║ ██╔████╔██║ ██████╔╝ ██████╔╝ █████╗ ███████╗ ███████╗",
|
|
@@ -2484,11 +2484,11 @@ function Fs(e = {}) {
|
|
|
2484
2484
|
for (const b of ct) d.push(Jn + b + pe);
|
|
2485
2485
|
d.push("");
|
|
2486
2486
|
const h = [
|
|
2487
|
-
`${
|
|
2487
|
+
`${xt}${t}${pe}${Ne} · ${o}${pe}`,
|
|
2488
2488
|
`${Ne}${n}${pe}`,
|
|
2489
2489
|
`${Ee}Version${pe} ${s} ${Ee}${c}${pe}`
|
|
2490
2490
|
];
|
|
2491
|
-
f && h.push(`${Ee}Nimpress${pe} ${f}`), h.push(`${Ee}➜${pe} Local ${
|
|
2491
|
+
f && h.push(`${Ee}Nimpress${pe} ${f}`), h.push(`${Ee}➜${pe} Local ${xt}${r}${pe}`), h.push(`${Ee}➜${pe} Network ${ht}${i}${pe}`);
|
|
2492
2492
|
const w = Ns(h), T = ct[0].length, k = ct[0].length - ct[0].trimStart().length, D = Xe + 4, _ = " ".repeat(Math.max(0, Math.floor((T + k - D) / 2)));
|
|
2493
2493
|
for (const b of w) d.push(_ + b);
|
|
2494
2494
|
return d.push(""), d.join(`
|
|
@@ -2542,11 +2542,11 @@ function gt(e, t, n) {
|
|
|
2542
2542
|
return e.split(`
|
|
2543
2543
|
`).reduce((s, r) => s + Math.max(1, Math.ceil(r.trim().length / o)), 0);
|
|
2544
2544
|
}
|
|
2545
|
-
function
|
|
2545
|
+
function Dt(e) {
|
|
2546
2546
|
return e.reduce((t, n) => Math.max(t, n.length), 0);
|
|
2547
2547
|
}
|
|
2548
2548
|
function fr(e, t) {
|
|
2549
|
-
const n =
|
|
2549
|
+
const n = Dt(t.map((f) => f.name)) * Ys, o = Dt(t.map((f) => f.type)) * Ks, s = Dt(t.map((f) => f.linkLabel)) * er, r = t.some((f) => f.pk || f.fk) ? tr : 0, i = Math.round(n + o + s + r + nr), c = Math.round(e.length * Vn + 32);
|
|
2550
2550
|
return Math.min(Vs, Math.max(Gs, i, c));
|
|
2551
2551
|
}
|
|
2552
2552
|
function dr(e) {
|
|
@@ -2790,11 +2790,11 @@ ${n}`;
|
|
|
2790
2790
|
i = et(o, c.index + c[0].length);
|
|
2791
2791
|
else {
|
|
2792
2792
|
const _ = o.match(/defineProps<\s*([A-Za-z_$][\w$]*)\s*>/);
|
|
2793
|
-
_ && (i =
|
|
2793
|
+
_ && (i = wt(r, _[1]));
|
|
2794
2794
|
}
|
|
2795
2795
|
const f = /* @__PURE__ */ new Map(), d = o.match(/(?:const|let)\s*\{([\s\S]*?)\}\s*=\s*(?:withDefaults\s*\(\s*)?defineProps/);
|
|
2796
2796
|
if (d)
|
|
2797
|
-
for (const _ of
|
|
2797
|
+
for (const _ of Lt(d[1])) {
|
|
2798
2798
|
const b = _.match(/^([A-Za-z_$][\w$]*)\s*=\s*([\s\S]+)$/);
|
|
2799
2799
|
b && f.set(b[1], qn(b[2]));
|
|
2800
2800
|
}
|
|
@@ -2802,7 +2802,7 @@ ${n}`;
|
|
|
2802
2802
|
if (i)
|
|
2803
2803
|
for (const _ of Vt(i)) {
|
|
2804
2804
|
const b = Xt(
|
|
2805
|
-
|
|
2805
|
+
vt(_.name, _.type, _.optional, r, _.description),
|
|
2806
2806
|
_
|
|
2807
2807
|
);
|
|
2808
2808
|
f.has(_.name) && (b.default = f.get(_.name)), h.push(b);
|
|
@@ -2810,7 +2810,7 @@ ${n}`;
|
|
|
2810
2810
|
for (const _ of o.matchAll(/\bdefineModel(?:<([^>]*)>)?\(\s*(?:['"]([\w-]+)['"])?/g)) {
|
|
2811
2811
|
const b = _[2] ?? "modelValue";
|
|
2812
2812
|
if (h.some(($) => $.name === b)) continue;
|
|
2813
|
-
const P =
|
|
2813
|
+
const P = vt(b, _[1]?.trim() || "string", !0, r);
|
|
2814
2814
|
P.bindable = !0;
|
|
2815
2815
|
const N = o.slice(0, _.index).match(/\/\*\*((?:[^*]|\*(?!\/))*)\*\/\s*(?:const|let)\s+[\w$]+\s*=\s*$/);
|
|
2816
2816
|
if (N) {
|
|
@@ -2846,7 +2846,7 @@ function $r(e, t, n = "") {
|
|
|
2846
2846
|
const o = e.match(/<script[^>]*>([\s\S]*?)<\/script>/)?.[1] ?? "", s = `${o}
|
|
2847
2847
|
${n}`, r = o.match(/(?:let|const)\s*\{([\s\S]*?)\}\s*(?::\s*([\s\S]*?))?=\s*\$props\(\)/), i = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set();
|
|
2848
2848
|
if (r)
|
|
2849
|
-
for (const k of
|
|
2849
|
+
for (const k of Lt(r[1])) {
|
|
2850
2850
|
const D = k.match(/^([A-Za-z_$][\w$]*)\s*=\s*([\s\S]+)$/);
|
|
2851
2851
|
if (!D) continue;
|
|
2852
2852
|
const _ = D[2].trim().match(/^\$bindable\(([\s\S]*)\)$/);
|
|
@@ -2859,7 +2859,7 @@ ${n}`, r = o.match(/(?:let|const)\s*\{([\s\S]*?)\}\s*(?::\s*([\s\S]*?))?=\s*\$pr
|
|
|
2859
2859
|
f = et(d, 1);
|
|
2860
2860
|
else {
|
|
2861
2861
|
const k = d.match(/^([A-Za-z_$][\w$]*)/);
|
|
2862
|
-
k && (f =
|
|
2862
|
+
k && (f = wt(s, k[1]));
|
|
2863
2863
|
}
|
|
2864
2864
|
const h = [], w = [], T = [];
|
|
2865
2865
|
if (f)
|
|
@@ -2873,13 +2873,13 @@ ${n}`, r = o.match(/(?:let|const)\s*\{([\s\S]*?)\}\s*(?::\s*([\s\S]*?))?=\s*\$pr
|
|
|
2873
2873
|
continue;
|
|
2874
2874
|
}
|
|
2875
2875
|
const D = Xt(
|
|
2876
|
-
|
|
2876
|
+
vt(k.name, k.type, k.optional, s, k.description),
|
|
2877
2877
|
k
|
|
2878
2878
|
);
|
|
2879
2879
|
i.has(k.name) && (D.default = i.get(k.name)), c.has(k.name) && (D.bindable = !0), h.push(D);
|
|
2880
2880
|
}
|
|
2881
2881
|
else if (r) {
|
|
2882
|
-
for (const k of
|
|
2882
|
+
for (const k of Lt(r[1])) {
|
|
2883
2883
|
const D = k.match(/^([A-Za-z_$][\w$]*)/)?.[1];
|
|
2884
2884
|
if (!D || D === "children") continue;
|
|
2885
2885
|
const _ = { name: D, kind: "json", type: "unknown" };
|
|
@@ -2907,7 +2907,7 @@ function Yn(e, t = []) {
|
|
|
2907
2907
|
}
|
|
2908
2908
|
function xr(e, t, n) {
|
|
2909
2909
|
const o = U(e, "node_modules", t);
|
|
2910
|
-
if (!he(o) || !
|
|
2910
|
+
if (!he(o) || !yt(o).isDirectory()) return null;
|
|
2911
2911
|
const s = [
|
|
2912
2912
|
`${n}.vue.d.ts`,
|
|
2913
2913
|
`${n}.svelte.d.ts`,
|
|
@@ -2921,7 +2921,7 @@ function xr(e, t, n) {
|
|
|
2921
2921
|
return null;
|
|
2922
2922
|
}
|
|
2923
2923
|
function gi(e, t) {
|
|
2924
|
-
const n =
|
|
2924
|
+
const n = wt(e, `${t}Props`) ?? wt(e, "Props");
|
|
2925
2925
|
if (!n) return;
|
|
2926
2926
|
const o = [], s = [], r = [];
|
|
2927
2927
|
for (const i of Vt(n)) {
|
|
@@ -2933,7 +2933,7 @@ function gi(e, t) {
|
|
|
2933
2933
|
r.push(i.name);
|
|
2934
2934
|
continue;
|
|
2935
2935
|
}
|
|
2936
|
-
o.push(Xt(
|
|
2936
|
+
o.push(Xt(vt(i.name, i.type, i.optional, e, i.description), i));
|
|
2937
2937
|
}
|
|
2938
2938
|
return { component: t, props: o, slots: s, emits: r };
|
|
2939
2939
|
}
|
|
@@ -3024,7 +3024,7 @@ async function yi(e) {
|
|
|
3024
3024
|
};
|
|
3025
3025
|
return Zt(c, o.vite);
|
|
3026
3026
|
}
|
|
3027
|
-
function
|
|
3027
|
+
function jt(e, t, n, o, s) {
|
|
3028
3028
|
const r = t.systems[n];
|
|
3029
3029
|
if (!r?.source) return null;
|
|
3030
3030
|
const i = V(e, r.source), c = r.framework === "vue" ? ".vue" : ".svelte", f = s ? [V(i, s)] : [U(i, o, o + c), U(i, o + c)];
|
|
@@ -3065,7 +3065,7 @@ async function ot(e, t) {
|
|
|
3065
3065
|
} catch {
|
|
3066
3066
|
continue;
|
|
3067
3067
|
}
|
|
3068
|
-
const { data: c } =
|
|
3068
|
+
const { data: c } = bt(i);
|
|
3069
3069
|
if (c?.type !== "component") continue;
|
|
3070
3070
|
const f = c.data ?? {}, d = String(f.system ?? ""), h = String(f.component ?? "");
|
|
3071
3071
|
!d || !h || s.push({
|
|
@@ -3169,10 +3169,10 @@ function Ge(e = process.cwd()) {
|
|
|
3169
3169
|
const n = Ye.length;
|
|
3170
3170
|
Ye.length = 0;
|
|
3171
3171
|
const o = n === 1 ? "schema warning" : "schema warnings", s = t.size === 1 ? "component" : "components", r = [""];
|
|
3172
|
-
r.push(` ${Ee}${
|
|
3172
|
+
r.push(` ${Ee}${xt}nimpress modules${pe} ${Ne}${n} ${o} in ${t.size} ${s}${pe}`), r.push("");
|
|
3173
3173
|
for (const [i, c] of t) {
|
|
3174
3174
|
const f = c.find((w) => w.sourceFile)?.sourceFile;
|
|
3175
|
-
r.push(` ${Jn}${
|
|
3175
|
+
r.push(` ${Jn}${xt}${i}${pe}${f ? ` ${ht}${Se(e, f)}${pe}` : ""}`);
|
|
3176
3176
|
const d = Math.max(...c.map((w) => (w.line ? `L${w.line}` : "·").length)), h = Math.max(...c.map((w) => (w.path || "(component)").length));
|
|
3177
3177
|
for (const w of c) {
|
|
3178
3178
|
const T = (w.line ? `L${w.line}` : "·").padStart(d), k = (w.path || "(component)").padEnd(h);
|
|
@@ -3255,7 +3255,7 @@ async function bi(e, t) {
|
|
|
3255
3255
|
const o = await le(n.path, "utf-8"), s = rt(o, n.form), { merged: r } = en(t, s);
|
|
3256
3256
|
await fe(n.path, tt(r, n.form));
|
|
3257
3257
|
}
|
|
3258
|
-
function
|
|
3258
|
+
function zt(e) {
|
|
3259
3259
|
const t = Gt(e);
|
|
3260
3260
|
return t === ".vue" ? "vue" : t === ".svelte" ? "svelte" : null;
|
|
3261
3261
|
}
|
|
@@ -3273,7 +3273,7 @@ function Mr(e, t, n) {
|
|
|
3273
3273
|
async function Tr(e, t, n) {
|
|
3274
3274
|
const o = await ot(e, t.contentDir), s = V(e, n);
|
|
3275
3275
|
if ((n.includes("/") || n.includes("\\")) && he(s)) {
|
|
3276
|
-
const d =
|
|
3276
|
+
const d = zt(s);
|
|
3277
3277
|
if (!d)
|
|
3278
3278
|
throw new Error(`[nimpress] modules: ${n} is not a .vue or .svelte component file`);
|
|
3279
3279
|
const h = Pe(s, Gt(s)), w = Dr(e, t, s);
|
|
@@ -3293,12 +3293,12 @@ async function Tr(e, t, n) {
|
|
|
3293
3293
|
const d = r.map((h) => `${h.system}/${h.component}`).join(", ");
|
|
3294
3294
|
throw new Error(`[nimpress] modules: ${n} is ambiguous across ${d}, pass the component file path`);
|
|
3295
3295
|
}
|
|
3296
|
-
const i = r[0], c =
|
|
3296
|
+
const i = r[0], c = jt(e, t.modules, i.system, i.component, i.file);
|
|
3297
3297
|
if (!c)
|
|
3298
3298
|
throw new Error(
|
|
3299
3299
|
`[nimpress] modules: no source file found for ${i.system}/${i.component}, the schema upsert needs the component source`
|
|
3300
3300
|
);
|
|
3301
|
-
const f =
|
|
3301
|
+
const f = zt(c.componentFile) ?? c.systemConfig.framework;
|
|
3302
3302
|
return {
|
|
3303
3303
|
system: i.system,
|
|
3304
3304
|
component: i.component,
|
|
@@ -3322,25 +3322,25 @@ async function wi(e, t, n = {}) {
|
|
|
3322
3322
|
let s = 0;
|
|
3323
3323
|
for (const r of o) {
|
|
3324
3324
|
if (n.system && r.system !== n.system) continue;
|
|
3325
|
-
const i =
|
|
3325
|
+
const i = jt(e, t.modules, r.system, r.component, r.file);
|
|
3326
3326
|
if (!i) {
|
|
3327
3327
|
console.warn(`nimpress modules: no source for ${r.system}/${r.component}, skipped`);
|
|
3328
3328
|
continue;
|
|
3329
3329
|
}
|
|
3330
|
-
const c =
|
|
3330
|
+
const c = zt(i.componentFile) ?? i.systemConfig.framework, f = await Qt(i.componentFile, c, r.component);
|
|
3331
3331
|
f && (await tn(K(r.pageFile), r.component, f), s++);
|
|
3332
3332
|
}
|
|
3333
3333
|
return s;
|
|
3334
3334
|
}
|
|
3335
|
-
const Ir = 6161,
|
|
3336
|
-
function
|
|
3335
|
+
const Ir = 6161, qt = "virtual:nimpress-harness/";
|
|
3336
|
+
function St(e, t) {
|
|
3337
3337
|
const n = e.systems[t]?.port;
|
|
3338
3338
|
if (n) return n;
|
|
3339
3339
|
const o = Object.keys(e.systems).sort();
|
|
3340
3340
|
return Ir + Math.max(0, o.indexOf(t));
|
|
3341
3341
|
}
|
|
3342
|
-
function
|
|
3343
|
-
return `${
|
|
3342
|
+
function Ut(e, t) {
|
|
3343
|
+
return `${qt}${e}/${t}/entry`;
|
|
3344
3344
|
}
|
|
3345
3345
|
function to() {
|
|
3346
3346
|
return `const params = new URLSearchParams(location.search)
|
|
@@ -3771,7 +3771,7 @@ function ro(e, t, n, o) {
|
|
|
3771
3771
|
const r = [];
|
|
3772
3772
|
for (const i of o) {
|
|
3773
3773
|
if (i.system !== n) continue;
|
|
3774
|
-
const c = ao(i.pageFile), f = st(K(i.pageFile))?.path ?? U(K(i.pageFile), "schema.json"), d = s.source ?
|
|
3774
|
+
const c = ao(i.pageFile), f = st(K(i.pageFile))?.path ?? U(K(i.pageFile), "schema.json"), d = s.source ? jt(e, t, n, i.component, i.file) : null;
|
|
3775
3775
|
if (d) {
|
|
3776
3776
|
r.push({ component: i.component, importSpec: d.componentFile, storyFiles: c, schemaFile: f });
|
|
3777
3777
|
continue;
|
|
@@ -3811,7 +3811,7 @@ function qr(e, t, n, o, s) {
|
|
|
3811
3811
|
(k) => k.startsWith(".") || xe(k) ? V(e, k) : k
|
|
3812
3812
|
), c = Hr(e, r), f = zr(e, r);
|
|
3813
3813
|
let d = new Map(o.map((k) => [k.component, k]));
|
|
3814
|
-
const h = "\0" +
|
|
3814
|
+
const h = "\0" + qt, w = (k) => {
|
|
3815
3815
|
if (!k.startsWith(h)) return null;
|
|
3816
3816
|
const D = k.slice(h.length).split("/");
|
|
3817
3817
|
return D[0] === n && D[1] ? D[1] : null;
|
|
@@ -3819,7 +3819,7 @@ function qr(e, t, n, o, s) {
|
|
|
3819
3819
|
return {
|
|
3820
3820
|
name: "nimpress:harness",
|
|
3821
3821
|
resolveId(k) {
|
|
3822
|
-
return k.startsWith(h) ? k : k.startsWith(
|
|
3822
|
+
return k.startsWith(h) ? k : k.startsWith(qt) ? "\0" + k : null;
|
|
3823
3823
|
},
|
|
3824
3824
|
load(k) {
|
|
3825
3825
|
const D = w(k);
|
|
@@ -3833,7 +3833,7 @@ function qr(e, t, n, o, s) {
|
|
|
3833
3833
|
const P = await ot(e, t.contentDir), N = [...d.keys()];
|
|
3834
3834
|
d = new Map(ro(e, t.modules, n, P).map(($) => [$.component, $]));
|
|
3835
3835
|
for (const $ of /* @__PURE__ */ new Set([...N, ...d.keys()])) {
|
|
3836
|
-
const A = k.moduleGraph.getModuleById("\0" +
|
|
3836
|
+
const A = k.moduleGraph.getModuleById("\0" + Ut(n, $));
|
|
3837
3837
|
A && k.moduleGraph.invalidateModule(A);
|
|
3838
3838
|
}
|
|
3839
3839
|
k.ws.send({ type: "full-reload" });
|
|
@@ -3853,7 +3853,7 @@ function qr(e, t, n, o, s) {
|
|
|
3853
3853
|
return;
|
|
3854
3854
|
}
|
|
3855
3855
|
if (Z === "entry.js") {
|
|
3856
|
-
const te = await k.transformRequest(
|
|
3856
|
+
const te = await k.transformRequest(Ut(n, H));
|
|
3857
3857
|
if (!te) return N();
|
|
3858
3858
|
P.statusCode = 200, P.setHeader("Content-Type", "application/javascript"), P.end(te.code);
|
|
3859
3859
|
return;
|
|
@@ -3906,12 +3906,12 @@ async function vi(e, t, n, o) {
|
|
|
3906
3906
|
},
|
|
3907
3907
|
server: {
|
|
3908
3908
|
host: "127.0.0.1",
|
|
3909
|
-
port:
|
|
3909
|
+
port: St(s, n),
|
|
3910
3910
|
strictPort: !0,
|
|
3911
3911
|
fs: { allow: [e, d] },
|
|
3912
3912
|
hmr: {
|
|
3913
3913
|
host: "127.0.0.1",
|
|
3914
|
-
clientPort:
|
|
3914
|
+
clientPort: St(s, n)
|
|
3915
3915
|
}
|
|
3916
3916
|
},
|
|
3917
3917
|
build: {
|
|
@@ -3919,7 +3919,7 @@ async function vi(e, t, n, o) {
|
|
|
3919
3919
|
emptyOutDir: !0,
|
|
3920
3920
|
target: "es2022",
|
|
3921
3921
|
rollupOptions: {
|
|
3922
|
-
input: Object.fromEntries(c.map((N) => [N.component,
|
|
3922
|
+
input: Object.fromEntries(c.map((N) => [N.component, Ut(n, N.component)]))
|
|
3923
3923
|
}
|
|
3924
3924
|
},
|
|
3925
3925
|
base: T
|
|
@@ -3931,7 +3931,7 @@ async function vi(e, t, n, o) {
|
|
|
3931
3931
|
resolve: { ..._.resolve, alias: [{ find: /^vue$/, replacement: "vue/dist/vue.esm-bundler.js" }, ...P] }
|
|
3932
3932
|
};
|
|
3933
3933
|
}
|
|
3934
|
-
function
|
|
3934
|
+
function Mt(e, t) {
|
|
3935
3935
|
const n = e.search(new RegExp(`\\b${t}\\s*:`));
|
|
3936
3936
|
if (n < 0) return;
|
|
3937
3937
|
const o = e.indexOf("{", n);
|
|
@@ -3943,7 +3943,7 @@ function Dt(e, t) {
|
|
|
3943
3943
|
return;
|
|
3944
3944
|
}
|
|
3945
3945
|
}
|
|
3946
|
-
function
|
|
3946
|
+
function Tt(e, t) {
|
|
3947
3947
|
const n = e.search(new RegExp(`\\b${t}\\s*:`));
|
|
3948
3948
|
if (n < 0) return e;
|
|
3949
3949
|
const o = e.indexOf("{", n);
|
|
@@ -3952,7 +3952,7 @@ function Mt(e, t) {
|
|
|
3952
3952
|
return e.slice(0, n) + e.slice(o + 1 + s.length + 1);
|
|
3953
3953
|
}
|
|
3954
3954
|
function io(e, t) {
|
|
3955
|
-
const n = e.match(/^\s*\/\/\s*story:\s*(.+)$/m)?.[1]?.trim(), o =
|
|
3955
|
+
const n = e.match(/^\s*\/\/\s*story:\s*(.+)$/m)?.[1]?.trim(), o = Tt(Tt(e, "props"), "slots"), s = Mt(o, "sidebar"), r = Tt(o, "sidebar"), i = r.match(/\bname\s*:\s*['"]([^'"]+)['"]/)?.[1], c = r.match(/\bdescription\s*:\s*['"]([^'"]+)['"]/)?.[1], f = Mt(e, "props"), d = Mt(e, "slots");
|
|
3956
3956
|
return {
|
|
3957
3957
|
name: n ?? i ?? Pe(t).replace(/\.story\.tsx?$/, "").replace(/_/g, " "),
|
|
3958
3958
|
file: t,
|
|
@@ -4006,7 +4006,7 @@ function $i(e, t) {
|
|
|
4006
4006
|
return e.find((o) => o.story.toLowerCase() === n) ?? e.find((o) => o.name.toLowerCase() === n);
|
|
4007
4007
|
}
|
|
4008
4008
|
function xi(e, t) {
|
|
4009
|
-
return `http://127.0.0.1:${
|
|
4009
|
+
return `http://127.0.0.1:${St(e.modules, t.system)}${Un(e.base, t.route)}`;
|
|
4010
4010
|
}
|
|
4011
4011
|
function Jr(e) {
|
|
4012
4012
|
let t = e;
|
|
@@ -4047,7 +4047,7 @@ async function Gr(e, t, n) {
|
|
|
4047
4047
|
}
|
|
4048
4048
|
function Vr(e) {
|
|
4049
4049
|
try {
|
|
4050
|
-
return
|
|
4050
|
+
return yt(e).isFile();
|
|
4051
4051
|
} catch {
|
|
4052
4052
|
return !1;
|
|
4053
4053
|
}
|
|
@@ -4070,7 +4070,7 @@ async function Xr(e, t, n, o) {
|
|
|
4070
4070
|
return i;
|
|
4071
4071
|
}
|
|
4072
4072
|
async function Yr(e) {
|
|
4073
|
-
const { cwd: t, modules: n, pageFile: o, data: s, editable: r } = e, i = String(s.system ?? ""), c = String(s.component ?? ""), f = typeof s.file == "string" ? s.file : void 0, d = await Ur(K(o)), h =
|
|
4073
|
+
const { cwd: t, modules: n, pageFile: o, data: s, editable: r } = e, i = String(s.system ?? ""), c = String(s.component ?? ""), f = typeof s.file == "string" ? s.file : void 0, d = await Ur(K(o)), h = jt(t, n, i, c, f), w = [];
|
|
4074
4074
|
if (r && h) {
|
|
4075
4075
|
const $ = h.componentFile.endsWith(".svelte") ? "svelte" : "vue";
|
|
4076
4076
|
try {
|
|
@@ -4127,7 +4127,7 @@ async function Yr(e) {
|
|
|
4127
4127
|
}
|
|
4128
4128
|
function Kr(e, t = "virtual:nimpress/main") {
|
|
4129
4129
|
const n = e.logo ? `
|
|
4130
|
-
<link rel="icon" href="${e.logo}" />` : "", o = JSON.stringify(
|
|
4130
|
+
<link rel="icon" href="${e.logo}" />` : "", o = JSON.stringify($t(e).map(kt)), s = JSON.stringify(kt(e.theme));
|
|
4131
4131
|
return `<!doctype html>
|
|
4132
4132
|
<html lang="en">
|
|
4133
4133
|
<head>
|
|
@@ -4155,7 +4155,7 @@ function Kr(e, t = "virtual:nimpress/main") {
|
|
|
4155
4155
|
</html>
|
|
4156
4156
|
`;
|
|
4157
4157
|
}
|
|
4158
|
-
const lt = "virtual:nimpress/manifest", pt = "virtual:nimpress/search", ut = "virtual:nimpress/pages", mt = "virtual:nimpress/bodies",
|
|
4158
|
+
const lt = "virtual:nimpress/manifest", pt = "virtual:nimpress/search", ut = "virtual:nimpress/pages", mt = "virtual:nimpress/bodies", Nt = "virtual:nimpress/config", It = "virtual:nimpress/main", Ve = "virtual:nimpress/page-component/", Le = "virtual:nimpress/page-body/", Ft = 20, Zr = "https://github.com/nimling/nimpress";
|
|
4159
4159
|
function ye(e) {
|
|
4160
4160
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
4161
4161
|
}
|
|
@@ -4165,7 +4165,7 @@ function Qr(e) {
|
|
|
4165
4165
|
function On(e) {
|
|
4166
4166
|
return e === 0 ? "rss.xml" : `rss-${e + 1}.xml`;
|
|
4167
4167
|
}
|
|
4168
|
-
const
|
|
4168
|
+
const Rt = [
|
|
4169
4169
|
"Google-Extended",
|
|
4170
4170
|
"Applebot-Extended",
|
|
4171
4171
|
"OAI-SearchBot",
|
|
@@ -4262,6 +4262,7 @@ const Dn = (e) => e.visibility === "hidden", ke = (e) => e.visibility === "hidde
|
|
|
4262
4262
|
description: u.string().optional(),
|
|
4263
4263
|
value: u.array(u.string()).optional()
|
|
4264
4264
|
})).optional(),
|
|
4265
|
+
export: u.union([u.string(), u.boolean(), u.object({ target: u.string().optional(), gate: u.string().optional() })]).optional(),
|
|
4265
4266
|
visibility: u.enum(["visible", "hidden", "dev-only"]).optional(),
|
|
4266
4267
|
collapsed: u.boolean().optional(),
|
|
4267
4268
|
lastUpdated: u.boolean().optional(),
|
|
@@ -4429,7 +4430,7 @@ async function nn(e, t = []) {
|
|
|
4429
4430
|
function Fe(e) {
|
|
4430
4431
|
return e.toLowerCase().replace(/[^a-z0-9\s-]/g, "").trim().replace(/\s+/g, "-");
|
|
4431
4432
|
}
|
|
4432
|
-
function
|
|
4433
|
+
function Bt(e) {
|
|
4433
4434
|
return e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
4434
4435
|
}
|
|
4435
4436
|
const Mn = {
|
|
@@ -4722,7 +4723,7 @@ function Oa(e, t) {
|
|
|
4722
4723
|
return n ? n[1] : null;
|
|
4723
4724
|
}
|
|
4724
4725
|
const Da = new Set("a an the and or but if then else of to in on at by for with from as is are was were be been being it its this that these those there here which who whom what when where why how not no yes you your we our they their he she his her them us me my i so do does did done can could should would will shall may might must into over under again more most some any each every all both few own same than too very just also only such other another one two three first last new use used using page pages file files field fields set sets value values see".split(" "));
|
|
4725
|
-
function
|
|
4726
|
+
function Wt(e) {
|
|
4726
4727
|
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 && !Da.has(t) && !/^\d+$/.test(t));
|
|
4727
4728
|
}
|
|
4728
4729
|
function Ma(e) {
|
|
@@ -4738,7 +4739,7 @@ function Ta(e) {
|
|
|
4738
4739
|
const i = /* @__PURE__ */ new Map(), c = (f, d) => {
|
|
4739
4740
|
for (const h of f) i.set(h, (i.get(h) ?? 0) + d);
|
|
4740
4741
|
};
|
|
4741
|
-
c(
|
|
4742
|
+
c(Wt(r.title), 6), c(Wt(r.headings.join(" ")), 3), c(r.tags.map((f) => f.toLowerCase()), 8), c(Wt(r.body), 1);
|
|
4742
4743
|
for (const f of i.keys()) t.set(f, (t.get(f) ?? 0) + 1);
|
|
4743
4744
|
return { source: r, counts: i };
|
|
4744
4745
|
}), o = Math.max(e.length, 1), s = /* @__PURE__ */ new Map();
|
|
@@ -5131,13 +5132,13 @@ function Rn(e) {
|
|
|
5131
5132
|
function Te(e) {
|
|
5132
5133
|
return e ? e.replace(/[-_]/g, " ").replace(/\b\w/g, (t) => t.toUpperCase()) : "";
|
|
5133
5134
|
}
|
|
5134
|
-
function
|
|
5135
|
+
function _t(e) {
|
|
5135
5136
|
e.sort((t, n) => {
|
|
5136
5137
|
const o = t.order ?? Number.MAX_SAFE_INTEGER, s = n.order ?? Number.MAX_SAFE_INTEGER;
|
|
5137
5138
|
return o !== s ? o - s : t.text.localeCompare(n.text);
|
|
5138
5139
|
});
|
|
5139
5140
|
for (const t of e)
|
|
5140
|
-
t.items &&
|
|
5141
|
+
t.items && _t(t.items);
|
|
5141
5142
|
}
|
|
5142
5143
|
function Ga(e) {
|
|
5143
5144
|
let t = Ke, n = V(process.cwd(), Ke.contentDir), o = V(process.cwd(), Ke.assetsDir), s = /* @__PURE__ */ new Map(), r = null, i = V(process.cwd(), "dist"), c = !1, f = null;
|
|
@@ -5193,19 +5194,19 @@ function Ga(e) {
|
|
|
5193
5194
|
return N(S, g);
|
|
5194
5195
|
}, x = async (g) => {
|
|
5195
5196
|
if (y.has(g)) return y.get(g);
|
|
5196
|
-
const
|
|
5197
|
-
y.set(g,
|
|
5197
|
+
const C = (g.split("/").pop() ?? "").replace(/\.json$/, "");
|
|
5198
|
+
y.set(g, C);
|
|
5198
5199
|
const E = await v(g);
|
|
5199
|
-
return await p(E, K(g)), m[
|
|
5200
|
+
return await p(E, K(g)), m[C] = E, C;
|
|
5200
5201
|
}, p = async (g, S) => {
|
|
5201
5202
|
if (!g || typeof g != "object") return;
|
|
5202
5203
|
if (Array.isArray(g)) {
|
|
5203
5204
|
for (const E of g) await p(E, S);
|
|
5204
5205
|
return;
|
|
5205
5206
|
}
|
|
5206
|
-
const
|
|
5207
|
-
if (typeof
|
|
5208
|
-
const E = xe(
|
|
5207
|
+
const C = g.$ref;
|
|
5208
|
+
if (typeof C == "string" && !C.startsWith("#")) {
|
|
5209
|
+
const E = xe(C) ? C : V(S, C), I = K(E).split("/").pop() ?? "";
|
|
5209
5210
|
if (I === "schemas") {
|
|
5210
5211
|
const j = await x(E);
|
|
5211
5212
|
g.$ref = `#/components/schemas/${j}`;
|
|
@@ -5214,7 +5215,7 @@ function Ga(e) {
|
|
|
5214
5215
|
if (I === "operations") {
|
|
5215
5216
|
const j = await v(E);
|
|
5216
5217
|
await p(j, K(E)), delete g.$ref;
|
|
5217
|
-
for (const
|
|
5218
|
+
for (const O of Object.keys(j)) g[O] = j[O];
|
|
5218
5219
|
return;
|
|
5219
5220
|
}
|
|
5220
5221
|
return;
|
|
@@ -5225,10 +5226,10 @@ function Ga(e) {
|
|
|
5225
5226
|
for (const g of Object.keys(m)) {
|
|
5226
5227
|
const S = m[g];
|
|
5227
5228
|
if (S && typeof S == "object" && typeof S.$ref == "string" && !S.$ref.startsWith("#")) {
|
|
5228
|
-
const
|
|
5229
|
-
y.set(
|
|
5230
|
-
const E = await v(
|
|
5231
|
-
await p(E, K(
|
|
5229
|
+
const C = xe(S.$ref) ? S.$ref : V(l, S.$ref);
|
|
5230
|
+
y.set(C, g);
|
|
5231
|
+
const E = await v(C);
|
|
5232
|
+
await p(E, K(C)), m[g] = E;
|
|
5232
5233
|
}
|
|
5233
5234
|
}
|
|
5234
5235
|
for (const g of Object.keys(a))
|
|
@@ -5260,8 +5261,8 @@ function Ga(e) {
|
|
|
5260
5261
|
function te(a, l) {
|
|
5261
5262
|
if (!a) return null;
|
|
5262
5263
|
const m = a, y = m.info ?? {}, v = m.components?.securitySchemes ?? {}, x = ["get", "post", "put", "patch", "delete", "head", "options"], p = (j) => H(j, m)?.example, g = /* @__PURE__ */ new Map(), S = m.paths ?? {};
|
|
5263
|
-
for (const [j,
|
|
5264
|
-
const R = H(
|
|
5264
|
+
for (const [j, O] of Object.entries(S)) {
|
|
5265
|
+
const R = H(O, m);
|
|
5265
5266
|
if (!R || typeof R != "object") continue;
|
|
5266
5267
|
const B = (R.parameters ?? []).map((M) => H(M, m));
|
|
5267
5268
|
for (const M of x) {
|
|
@@ -5310,10 +5311,10 @@ function Ga(e) {
|
|
|
5310
5311
|
g.has(se) || g.set(se, []), g.get(se).push(re);
|
|
5311
5312
|
}
|
|
5312
5313
|
}
|
|
5313
|
-
const
|
|
5314
|
-
for (const [j,
|
|
5315
|
-
const R = Z(l,
|
|
5316
|
-
I[j] = R ? { ...
|
|
5314
|
+
const C = [...g.entries()].map(([j, O]) => ({ name: j, operations: O })).sort((j, O) => j.name.localeCompare(O.name)), E = m.components?.schemas ?? {}, I = {};
|
|
5315
|
+
for (const [j, O] of Object.entries(E)) {
|
|
5316
|
+
const R = Z(l, O?.description);
|
|
5317
|
+
I[j] = R ? { ...O, description_html: R } : O;
|
|
5317
5318
|
}
|
|
5318
5319
|
return {
|
|
5319
5320
|
title: y.title ?? "API",
|
|
@@ -5322,12 +5323,12 @@ function Ga(e) {
|
|
|
5322
5323
|
description_html: Z(l, y.description),
|
|
5323
5324
|
servers: m.servers,
|
|
5324
5325
|
securitySchemes: v,
|
|
5325
|
-
tags:
|
|
5326
|
+
tags: C,
|
|
5326
5327
|
schemas: I
|
|
5327
5328
|
};
|
|
5328
5329
|
}
|
|
5329
5330
|
async function de(a) {
|
|
5330
|
-
const l = await le(a, "utf-8"), { data: m, content: y } =
|
|
5331
|
+
const l = await le(a, "utf-8"), { data: m, content: y } = bt(l);
|
|
5331
5332
|
typeof m.type == "number" && (m.type = String(m.type));
|
|
5332
5333
|
const v = po(m, y);
|
|
5333
5334
|
if (v.length) {
|
|
@@ -5337,10 +5338,10 @@ function Ga(e) {
|
|
|
5337
5338
|
if (c) throw new Error(`[nimpress] invalid frontmatter in ${Q}`);
|
|
5338
5339
|
console.warn(`[nimpress] invalid frontmatter in ${Q}`);
|
|
5339
5340
|
}
|
|
5340
|
-
const x = co.safeParse(m), p = x.success ? x.data : { title: a }, g = uo(n, a), S = p.type ?? "doc",
|
|
5341
|
+
const x = co.safeParse(m), p = x.success ? x.data : { title: a }, g = uo(n, a), S = p.type ?? "doc", C = ma(n, a, p.path), E = typeof p.link == "string" && p.link.trim() !== "" ? p.link.trim() : void 0, I = !!E || m.type === void 0 && y.trim() === "", j = t.defaultFrontmatter ?? {};
|
|
5341
5342
|
if (!(t.defaultFrontmatterExclude ?? []).some((Q) => {
|
|
5342
5343
|
const me = Q.startsWith("/") ? Q : "/" + Q;
|
|
5343
|
-
return
|
|
5344
|
+
return C === me || C.startsWith(me + "/");
|
|
5344
5345
|
}))
|
|
5345
5346
|
for (const [Q, me] of Object.entries(j)) {
|
|
5346
5347
|
const Me = Q;
|
|
@@ -5406,7 +5407,7 @@ function Ga(e) {
|
|
|
5406
5407
|
`)), {
|
|
5407
5408
|
slug: g,
|
|
5408
5409
|
filePath: a,
|
|
5409
|
-
effectivePath:
|
|
5410
|
+
effectivePath: C,
|
|
5410
5411
|
type: S,
|
|
5411
5412
|
sidebarOnly: I,
|
|
5412
5413
|
linkTo: E,
|
|
@@ -5469,79 +5470,79 @@ function Ga(e) {
|
|
|
5469
5470
|
async function ze() {
|
|
5470
5471
|
const a = await nn(n), l = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map();
|
|
5471
5472
|
let p, g;
|
|
5472
|
-
const S = [],
|
|
5473
|
+
const S = [], C = [];
|
|
5473
5474
|
let E = [];
|
|
5474
5475
|
for (const j of a) {
|
|
5475
5476
|
if (!j.endsWith(".md")) continue;
|
|
5476
|
-
let
|
|
5477
|
+
let O = "";
|
|
5477
5478
|
try {
|
|
5478
|
-
|
|
5479
|
+
O = await le(j, "utf-8");
|
|
5479
5480
|
} catch {
|
|
5480
5481
|
continue;
|
|
5481
5482
|
}
|
|
5482
|
-
const { data: R, content: B } =
|
|
5483
|
-
String(R.type) === "glossary" && (
|
|
5483
|
+
const { data: R, content: B } = bt(O);
|
|
5484
|
+
String(R.type) === "glossary" && (C.push(j), E = Ca(new Ln().use(Hn), B));
|
|
5484
5485
|
}
|
|
5485
|
-
if (
|
|
5486
|
+
if (C.length > 1) throw new Error(`[nimpress] one type glossary page per site: ${C.join(" and ")}`);
|
|
5486
5487
|
h = E, w = JSON.stringify(E);
|
|
5487
5488
|
const I = new Set(a);
|
|
5488
5489
|
for (const j of [...d.keys()])
|
|
5489
5490
|
I.has(j) || d.delete(j);
|
|
5490
5491
|
for (const j of a) {
|
|
5491
|
-
let
|
|
5492
|
+
let O = null;
|
|
5492
5493
|
try {
|
|
5493
|
-
|
|
5494
|
+
O = await ae(j);
|
|
5494
5495
|
} catch (B) {
|
|
5495
5496
|
console.warn(`[nimpress] failed to process ${j}:`, B);
|
|
5496
5497
|
continue;
|
|
5497
5498
|
}
|
|
5498
|
-
if (!
|
|
5499
|
-
if (S.push(
|
|
5500
|
-
const M = `${pa(
|
|
5501
|
-
L.push(
|
|
5499
|
+
if (!O || Re(O.slug)) continue;
|
|
5500
|
+
if (S.push(O), O.type === "changelog") {
|
|
5501
|
+
const M = `${pa(O.slug)}\0${O.frontmatter.title}`, L = y.get(M) ?? [];
|
|
5502
|
+
L.push(O), y.set(M, L);
|
|
5502
5503
|
continue;
|
|
5503
5504
|
}
|
|
5504
|
-
if (
|
|
5505
|
-
const B = String(
|
|
5506
|
-
v.set(B, [
|
|
5505
|
+
if (O.type === "roadmap") {
|
|
5506
|
+
const B = String(O.filePath);
|
|
5507
|
+
v.set(B, [O]);
|
|
5507
5508
|
}
|
|
5508
|
-
if (
|
|
5509
|
-
throw new Error(`[nimpress] type section belongs on a folder index.md: ${
|
|
5510
|
-
if (
|
|
5511
|
-
throw new Error(`[nimpress] type glossary needs a definition list body: ${
|
|
5512
|
-
if (
|
|
5513
|
-
if (g && g !==
|
|
5514
|
-
throw new Error(`[nimpress] one type tags page per site: ${g} and ${
|
|
5515
|
-
g =
|
|
5509
|
+
if (O.type === "section" && !O.filePath.endsWith(`${$e}index.md`))
|
|
5510
|
+
throw new Error(`[nimpress] type section belongs on a folder index.md: ${O.filePath}`);
|
|
5511
|
+
if (O.type === "glossary" && !O.html.includes("<dl"))
|
|
5512
|
+
throw new Error(`[nimpress] type glossary needs a definition list body: ${O.filePath}`);
|
|
5513
|
+
if (O.type === "tags") {
|
|
5514
|
+
if (g && g !== O.filePath)
|
|
5515
|
+
throw new Error(`[nimpress] one type tags page per site: ${g} and ${O.filePath}`);
|
|
5516
|
+
g = O.filePath;
|
|
5516
5517
|
}
|
|
5517
|
-
if (
|
|
5518
|
-
if (p && p !==
|
|
5519
|
-
throw new Error(`[nimpress] one type 404 page per site: ${p} and ${
|
|
5520
|
-
p =
|
|
5518
|
+
if (O.type === "404") {
|
|
5519
|
+
if (p && p !== O.filePath)
|
|
5520
|
+
throw new Error(`[nimpress] one type 404 page per site: ${p} and ${O.filePath}`);
|
|
5521
|
+
p = O.filePath;
|
|
5521
5522
|
}
|
|
5522
|
-
if (
|
|
5523
|
-
const B = K(
|
|
5523
|
+
if (O.type === "component") {
|
|
5524
|
+
const B = K(O.filePath), M = x.get(B);
|
|
5524
5525
|
if (M)
|
|
5525
5526
|
throw new Error(
|
|
5526
|
-
`[nimpress] one type component page per folder: ${B} holds ${M} and ${
|
|
5527
|
+
`[nimpress] one type component page per folder: ${B} holds ${M} and ${O.filePath}`
|
|
5527
5528
|
);
|
|
5528
|
-
x.set(B,
|
|
5529
|
+
x.set(B, O.filePath);
|
|
5529
5530
|
}
|
|
5530
|
-
const R = m.get(
|
|
5531
|
+
const R = m.get(O.effectivePath);
|
|
5531
5532
|
if (R)
|
|
5532
5533
|
throw new Error(
|
|
5533
|
-
`[nimpress] duplicate path ${
|
|
5534
|
+
`[nimpress] duplicate path ${O.effectivePath}: ${R} and ${O.filePath}`
|
|
5534
5535
|
);
|
|
5535
|
-
m.set(
|
|
5536
|
+
m.set(O.effectivePath, O.filePath), l.set(O.slug, O);
|
|
5536
5537
|
}
|
|
5537
|
-
|
|
5538
|
-
for (const [j,
|
|
5538
|
+
Pt.clear();
|
|
5539
|
+
for (const [j, O] of y) {
|
|
5539
5540
|
const R = j.split("\0", 1)[0], B = mo(R ? "/" + R : "/");
|
|
5540
5541
|
if (m.has(B))
|
|
5541
5542
|
throw new Error(
|
|
5542
5543
|
`[nimpress] path ${B} is occupied by both a changelog collection and a regular page`
|
|
5543
5544
|
);
|
|
5544
|
-
const M =
|
|
5545
|
+
const M = O.filter((F) => !(c && ke(F.frontmatter)));
|
|
5545
5546
|
if (M.length === 0) continue;
|
|
5546
5547
|
M.sort((F, q) => {
|
|
5547
5548
|
const Y = String(F.frontmatter.data?.version ?? ""), J = String(q.frontmatter.data?.version ?? "");
|
|
@@ -5559,7 +5560,7 @@ function Ga(e) {
|
|
|
5559
5560
|
ne = ce.toISOString();
|
|
5560
5561
|
}
|
|
5561
5562
|
const re = Y ? `v${Y}` : "unreleased";
|
|
5562
|
-
return
|
|
5563
|
+
return Pt.set(`${z}#${re}`, F.rawText), {
|
|
5563
5564
|
version: Y,
|
|
5564
5565
|
slug: re,
|
|
5565
5566
|
title: J,
|
|
@@ -5596,24 +5597,24 @@ function Ga(e) {
|
|
|
5596
5597
|
m.set(B, ee.filePath), l.set(ee.slug, ee);
|
|
5597
5598
|
}
|
|
5598
5599
|
if (Ao(v, S), _o(l), go(l), t.seo?.auto) {
|
|
5599
|
-
const j = Ta(S.map((
|
|
5600
|
-
slug:
|
|
5601
|
-
title:
|
|
5602
|
-
headings:
|
|
5603
|
-
tags: Be(
|
|
5604
|
-
body:
|
|
5600
|
+
const j = Ta(S.map((O) => ({
|
|
5601
|
+
slug: O.slug,
|
|
5602
|
+
title: O.frontmatter.title,
|
|
5603
|
+
headings: O.headings.map((R) => R.text),
|
|
5604
|
+
tags: Be(O.frontmatter.tags),
|
|
5605
|
+
body: O.rawText
|
|
5605
5606
|
})));
|
|
5606
|
-
for (const
|
|
5607
|
-
const R = j.get(
|
|
5607
|
+
for (const O of S) {
|
|
5608
|
+
const R = j.get(O.slug);
|
|
5608
5609
|
if (!R) continue;
|
|
5609
|
-
const B =
|
|
5610
|
-
|
|
5610
|
+
const B = O.frontmatter.meta ?? {}, M = B.override === !0, L = M && B.keywords ? B.keywords : R.keywords.length ? R.keywords : B.keywords, z = M && B.description ? B.description : R.description || B.description;
|
|
5611
|
+
O.frontmatter.meta = { ...B, ...L ? { keywords: L } : {}, ...z ? { description: z } : {} };
|
|
5611
5612
|
}
|
|
5612
5613
|
}
|
|
5613
5614
|
s = l;
|
|
5614
5615
|
}
|
|
5615
|
-
const qe = /* @__PURE__ */ new Map(),
|
|
5616
|
-
let
|
|
5616
|
+
const qe = /* @__PURE__ */ new Map(), Pt = /* @__PURE__ */ new Map();
|
|
5617
|
+
let At = JSON.stringify({ pages: [] }, null, 2) + `
|
|
5617
5618
|
`;
|
|
5618
5619
|
function go(a) {
|
|
5619
5620
|
const l = [];
|
|
@@ -5633,10 +5634,10 @@ function Ga(e) {
|
|
|
5633
5634
|
date: g.releaseDate,
|
|
5634
5635
|
title: g.title,
|
|
5635
5636
|
description: g.description,
|
|
5636
|
-
body:
|
|
5637
|
+
body: Pt.get(`${m.slug}#${g.slug}`) ?? ""
|
|
5637
5638
|
}))), l.push(p);
|
|
5638
5639
|
}
|
|
5639
|
-
l.sort((m, y) => m.path.localeCompare(y.path)),
|
|
5640
|
+
l.sort((m, y) => m.path.localeCompare(y.path)), At = JSON.stringify({ pages: l }, null, 2) + `
|
|
5640
5641
|
`;
|
|
5641
5642
|
}
|
|
5642
5643
|
function _o(a) {
|
|
@@ -5650,13 +5651,13 @@ function Ga(e) {
|
|
|
5650
5651
|
}
|
|
5651
5652
|
const y = (m.changelogEntries ?? []).filter((z) => !z.hidden);
|
|
5652
5653
|
if (y.length === 0) continue;
|
|
5653
|
-
const v = m.effectivePath === "/" ? "" : m.effectivePath, x = `${l}${we(t.base, v || "/")}`, p = ve(m) ? `/${t.paths.guarded}/${at(m)}` : "", g = (z) => `${p}${v}/${On(z)}`, S = y.map((z) => z.releaseDate ? new Date(z.releaseDate).getTime() : Number.NaN).filter((z) => !Number.isNaN(z)).sort((z, se) => se - z),
|
|
5654
|
-
for (let z = 0; z + 1 < S.length; z++)
|
|
5655
|
-
const E =
|
|
5654
|
+
const v = m.effectivePath === "/" ? "" : m.effectivePath, x = `${l}${we(t.base, v || "/")}`, p = ve(m) ? `/${t.paths.guarded}/${at(m)}` : "", g = (z) => `${p}${v}/${On(z)}`, S = y.map((z) => z.releaseDate ? new Date(z.releaseDate).getTime() : Number.NaN).filter((z) => !Number.isNaN(z)).sort((z, se) => se - z), C = [];
|
|
5655
|
+
for (let z = 0; z + 1 < S.length; z++) C.push(S[z] - S[z + 1]);
|
|
5656
|
+
const E = C.length ? Math.round(C.reduce((z, se) => z + se, 0) / C.length / 1e3) : void 0, I = E ? Math.min(43200, Math.max(60, Math.round(E / 60))) : 1440, j = E ? E <= 172800 ? "daily" : E <= 1209600 ? "weekly" : E <= 5184e3 ? "monthly" : "yearly" : "weekly", O = S.length ? new Date(S[0]).toUTCString() : void 0, R = ye(m.frontmatter.title), B = ye(
|
|
5656
5657
|
m.frontmatter.description ?? t.site?.description ?? m.frontmatter.title
|
|
5657
|
-
), M = t.site?.locale?.replace("_", "-").toLowerCase(), L = Math.max(1, Math.ceil(y.length /
|
|
5658
|
+
), M = t.site?.locale?.replace("_", "-").toLowerCase(), L = Math.max(1, Math.ceil(y.length / Ft));
|
|
5658
5659
|
for (let z = 0; z < L; z++) {
|
|
5659
|
-
const se = y.slice(z *
|
|
5660
|
+
const se = y.slice(z * Ft, (z + 1) * Ft), ie = [
|
|
5660
5661
|
`<atom:link href="${ye(`${l}${we(t.base, g(z))}`)}" rel="self" type="application/rss+xml"/>`
|
|
5661
5662
|
];
|
|
5662
5663
|
z > 0 && ie.push(
|
|
@@ -5682,7 +5683,7 @@ function Ga(e) {
|
|
|
5682
5683
|
`<description>${B}</description>`,
|
|
5683
5684
|
...ie
|
|
5684
5685
|
];
|
|
5685
|
-
M && F.push(`<language>${ye(M)}</language>`),
|
|
5686
|
+
M && F.push(`<language>${ye(M)}</language>`), O && F.push(`<lastBuildDate>${O}</lastBuildDate>`), F.push(`<ttl>${I}</ttl>`), F.push(`<sy:updatePeriod>${j}</sy:updatePeriod>`), F.push("<sy:updateFrequency>1</sy:updateFrequency>"), E !== void 0 && F.push(`<nimpress:releaseCadence>${E}</nimpress:releaseCadence>`), F.push(`<nimpress:latestVersion>${ye(y[0].version)}</nimpress:latestVersion>`), F.push(`<nimpress:releaseCount>${y.length}</nimpress:releaseCount>`), z > 0 && F.push("<fh:archive/>");
|
|
5686
5687
|
const q = [
|
|
5687
5688
|
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
5688
5689
|
`<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="${Zr}">`,
|
|
@@ -5699,7 +5700,7 @@ function Ga(e) {
|
|
|
5699
5700
|
}
|
|
5700
5701
|
}
|
|
5701
5702
|
}
|
|
5702
|
-
const
|
|
5703
|
+
const Et = /* @__PURE__ */ new Map();
|
|
5703
5704
|
function ve(a) {
|
|
5704
5705
|
return a.frontmatter.gate !== void 0;
|
|
5705
5706
|
}
|
|
@@ -5729,7 +5730,7 @@ function Ga(e) {
|
|
|
5729
5730
|
return l + we(t.base, a.startsWith("/") ? a : "/" + a);
|
|
5730
5731
|
}
|
|
5731
5732
|
function on(a) {
|
|
5732
|
-
if (
|
|
5733
|
+
if (Et.has(a)) return Et.get(a);
|
|
5733
5734
|
let l;
|
|
5734
5735
|
try {
|
|
5735
5736
|
l = qo("git", ["log", "-1", "--format=%cI", "--", a], {
|
|
@@ -5740,25 +5741,25 @@ function Ga(e) {
|
|
|
5740
5741
|
} catch {
|
|
5741
5742
|
l = void 0;
|
|
5742
5743
|
}
|
|
5743
|
-
return
|
|
5744
|
+
return Et.set(a, l), l;
|
|
5744
5745
|
}
|
|
5745
5746
|
function wo(a) {
|
|
5746
5747
|
return a === "changelog" || a === "roadmap" ? "CollectionPage" : a === "openapi" ? "APIReference" : a === "hero" || a === "fullpage" || a === "404" ? "WebPage" : a === "section" || a === "tags" ? "CollectionPage" : a === "glossary" ? "DefinedTermSet" : a === "team" ? "AboutPage" : "TechArticle";
|
|
5747
5748
|
}
|
|
5748
5749
|
function vo(a) {
|
|
5749
|
-
const l = t.meta ?? {}, m = t.site, y = a.frontmatter, v = y.meta ?? {}, x = v.og ?? {}, p = v.twitter ?? {}, g = y.title, S = m?.title && m.title !== g ? `${g} · ${m.title}` : g,
|
|
5750
|
+
const l = t.meta ?? {}, m = t.site, y = a.frontmatter, v = y.meta ?? {}, x = v.og ?? {}, p = v.twitter ?? {}, g = y.title, S = m?.title && m.title !== g ? `${g} · ${m.title}` : g, C = v.description ?? y.description ?? m?.description, E = v.canonical ?? Ae(a.effectivePath), I = (() => {
|
|
5750
5751
|
if (v.keywords) return Array.isArray(v.keywords) ? v.keywords : [v.keywords];
|
|
5751
5752
|
const G = Be(y.tags);
|
|
5752
5753
|
return G.length ? G : l.keywords ?? [];
|
|
5753
|
-
})(), j = Na(v.robots ?? "index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1", t.seo?.ai?.index, v.ai),
|
|
5754
|
-
if (q.push(`<title>${F(S)}</title>`),
|
|
5754
|
+
})(), j = Na(v.robots ?? "index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1", t.seo?.ai?.index, v.ai), O = x.title ?? g, R = x.description ?? C, B = x.image ?? m?.ogImage, M = B ? Ae(B) ?? B : void 0, L = x.type ?? (y.type === "hero" || y.type === "fullpage" || a.effectivePath === "/" ? "website" : "article"), z = l.og?.width ?? 1200, se = l.og?.height ?? 600, ie = p.card ?? (M ? "summary_large_image" : "summary"), ee = p.site ?? m?.twitterSite, F = nt, q = [];
|
|
5755
|
+
if (q.push(`<title>${F(S)}</title>`), C && q.push(`<meta name="description" content="${F(C)}">`), I.length && q.push(`<meta name="keywords" content="${F(I.join(", "))}">`), q.push(`<meta name="robots" content="${F(j)}">`), q.push(`<meta name="googlebot" content="${F(j)}">`), E) {
|
|
5755
5756
|
q.push(`<link rel="canonical" href="${F(E)}">`);
|
|
5756
5757
|
const G = l.localeAlternates ?? [];
|
|
5757
5758
|
for (const X of G)
|
|
5758
5759
|
q.push(`<link rel="alternate" hreflang="${F(X)}" href="${F(E)}">`);
|
|
5759
5760
|
G.length && q.push(`<link rel="alternate" hreflang="x-default" href="${F(E)}">`);
|
|
5760
5761
|
}
|
|
5761
|
-
if (q.push(`<meta property="og:title" content="${F(
|
|
5762
|
+
if (q.push(`<meta property="og:title" content="${F(O)}">`), R && q.push(`<meta property="og:description" content="${F(R)}">`), q.push(`<meta property="og:type" content="${F(L)}">`), E && q.push(`<meta property="og:url" content="${F(E)}">`), M && (q.push(`<meta property="og:image" content="${F(M)}">`), q.push(`<meta property="og:image:width" content="${z}">`), q.push(`<meta property="og:image:height" content="${se}">`), x.imageAlt && q.push(`<meta property="og:image:alt" content="${F(x.imageAlt)}">`)), m?.title && q.push(`<meta property="og:site_name" content="${F(m.title)}">`), m?.locale && q.push(`<meta property="og:locale" content="${F(m.locale)}">`), q.push(`<meta name="twitter:card" content="${F(ie)}">`), ee && q.push(`<meta name="twitter:site" content="${F(ee)}">`), q.push(`<meta name="twitter:title" content="${F(p.title ?? O)}">`), (p.description ?? R) && q.push(`<meta name="twitter:description" content="${F(p.description ?? R ?? "")}">`), (p.image ?? M) && q.push(`<meta name="twitter:image" content="${F(p.image ?? M ?? "")}">`), C && q.push(`<meta name="dc.description" content="${F(C)}">`), q.push(`<meta name="dc.title" content="${F(S)}">`), m?.locale && q.push(`<meta name="dc.language" content="${F(m.locale)}">`), y.type === "changelog" && (y.rss === !0 || y.subscribe === !0)) {
|
|
5762
5763
|
const G = a.effectivePath === "/" ? "/rss.xml" : `${a.effectivePath}/rss.xml`, X = Ae(G) ?? G;
|
|
5763
5764
|
q.push(`<link rel="alternate" type="application/rss+xml" title="${F(g)}" href="${F(X)}">`);
|
|
5764
5765
|
}
|
|
@@ -5796,7 +5797,7 @@ function Ga(e) {
|
|
|
5796
5797
|
"@type": wo(a.type),
|
|
5797
5798
|
name: S,
|
|
5798
5799
|
headline: g,
|
|
5799
|
-
description:
|
|
5800
|
+
description: C,
|
|
5800
5801
|
url: E,
|
|
5801
5802
|
isPartOf: Y ? `${Y}${we(t.base, "/")}#website` : void 0,
|
|
5802
5803
|
dateModified: on(a.filePath)
|
|
@@ -5810,11 +5811,11 @@ function Ga(e) {
|
|
|
5810
5811
|
function ko() {
|
|
5811
5812
|
const a = t.meta ?? {};
|
|
5812
5813
|
if (a.robots?.custom) return a.robots.custom;
|
|
5813
|
-
const l = /* @__PURE__ */ new Set([...a.robots?.block ?? [], ...t.seo?.ai?.index === !1 ?
|
|
5814
|
-
for (const v of
|
|
5814
|
+
const l = /* @__PURE__ */ new Set([...a.robots?.block ?? [], ...t.seo?.ai?.index === !1 ? Rt : []]), m = ["User-agent: *", "Allow: /", ""];
|
|
5815
|
+
for (const v of Rt)
|
|
5815
5816
|
m.push(`User-agent: ${v}`), m.push(l.has(v) ? "Disallow: /" : "Allow: /"), m.push("");
|
|
5816
5817
|
for (const v of l)
|
|
5817
|
-
|
|
5818
|
+
Rt.includes(v) || (m.push(`User-agent: ${v}`), m.push("Disallow: /"), m.push(""));
|
|
5818
5819
|
a.robots?.append && m.push(a.robots.append, "");
|
|
5819
5820
|
const y = Ae("/sitemap.xml");
|
|
5820
5821
|
return y && m.push(`Sitemap: ${y}`), m.join(`
|
|
@@ -5831,8 +5832,8 @@ function Ga(e) {
|
|
|
5831
5832
|
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
5832
5833
|
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">',
|
|
5833
5834
|
a.map((v) => {
|
|
5834
|
-
const x = `${l}${we(t.base, v.effectivePath === "/" ? "/" : v.effectivePath)}`, p = v.effectivePath.split("/").filter(Boolean).length, g = p === 0 ? "1.0" : p === 1 ? "0.8" : "0.6", S = p === 0 ? "weekly" : "monthly",
|
|
5835
|
-
|
|
5835
|
+
const x = `${l}${we(t.base, v.effectivePath === "/" ? "/" : v.effectivePath)}`, p = v.effectivePath.split("/").filter(Boolean).length, g = p === 0 ? "1.0" : p === 1 ? "0.8" : "0.6", S = p === 0 ? "weekly" : "monthly", C = on(v.filePath), E = [` <loc>${ye(x)}</loc>`];
|
|
5836
|
+
C && E.push(` <lastmod>${ye(C)}</lastmod>`), E.push(` <changefreq>${S}</changefreq>`), E.push(` <priority>${g}</priority>`);
|
|
5836
5837
|
for (const I of m)
|
|
5837
5838
|
E.push(` <xhtml:link rel="alternate" hreflang="${ye(I)}" href="${ye(x)}"/>`);
|
|
5838
5839
|
return ` <url>
|
|
@@ -5856,8 +5857,8 @@ ${E.join(`
|
|
|
5856
5857
|
p.push(I);
|
|
5857
5858
|
continue;
|
|
5858
5859
|
}
|
|
5859
|
-
const
|
|
5860
|
-
R.push(I), x.set(
|
|
5860
|
+
const O = j[0], R = x.get(O) ?? [];
|
|
5861
|
+
R.push(I), x.set(O, R);
|
|
5861
5862
|
}
|
|
5862
5863
|
const g = (I) => {
|
|
5863
5864
|
const j = Ae(I.effectivePath) ?? I.effectivePath;
|
|
@@ -5865,17 +5866,17 @@ ${E.join(`
|
|
|
5865
5866
|
};
|
|
5866
5867
|
for (const I of p) y.push(g(I));
|
|
5867
5868
|
p.length && y.push("");
|
|
5868
|
-
for (const [I, j] of [...x.entries()].sort((
|
|
5869
|
-
const
|
|
5870
|
-
y.push(`## ${
|
|
5869
|
+
for (const [I, j] of [...x.entries()].sort((O, R) => O[0].localeCompare(R[0]))) {
|
|
5870
|
+
const O = j.find((R) => R.effectivePath === `/${I}`);
|
|
5871
|
+
y.push(`## ${O?.frontmatter.title ?? Te(I)}`, ""), j.sort((R, B) => R.effectivePath.localeCompare(B.effectivePath));
|
|
5871
5872
|
for (const R of j) y.push(g(R));
|
|
5872
5873
|
y.push("");
|
|
5873
5874
|
}
|
|
5874
5875
|
const S = new Set(t.meta?.keywords ?? []);
|
|
5875
5876
|
for (const I of a) for (const j of Be(I.frontmatter.tags)) S.add(j);
|
|
5876
5877
|
S.size && y.push("## Keywords", "", [...S].join(", "), "");
|
|
5877
|
-
const
|
|
5878
|
-
return (
|
|
5878
|
+
const C = Ae("/sitemap.xml"), E = Ae("/robots.txt");
|
|
5879
|
+
return (C || E) && (y.push("## Optional", ""), C && y.push(`- [Sitemap](${C})`), E && y.push(`- [Robots](${E})`), y.push("")), l.llms?.append && y.push(l.llms.append, ""), y.join(`
|
|
5879
5880
|
`).replace(/\n{3,}/g, `
|
|
5880
5881
|
|
|
5881
5882
|
`);
|
|
@@ -5895,8 +5896,8 @@ ${E.join(`
|
|
|
5895
5896
|
async function jo() {
|
|
5896
5897
|
const a = t.meta ?? {}, l = bo().sort((p, g) => p.effectivePath.localeCompare(g.effectivePath)), m = U(i, "index.html"), y = await le(m, "utf-8");
|
|
5897
5898
|
for (const p of l) {
|
|
5898
|
-
const g = vo(p), S = y.replace("</head>", `${g}</head>`),
|
|
5899
|
-
await Je(K(
|
|
5899
|
+
const g = vo(p), S = y.replace("</head>", `${g}</head>`), C = p.effectivePath === "/" ? m : U(i, p.effectivePath.replace(/^\//, ""), "index.html");
|
|
5900
|
+
await Je(K(C), { recursive: !0 }), await fe(C, S);
|
|
5900
5901
|
}
|
|
5901
5902
|
await fe(U(i, "robots.txt"), ko());
|
|
5902
5903
|
const v = l.filter((p) => p.type !== "404"), x = $o(v);
|
|
@@ -5927,7 +5928,7 @@ ${E.join(`
|
|
|
5927
5928
|
for (const [p, g] of m) {
|
|
5928
5929
|
const S = U(v, p);
|
|
5929
5930
|
await Je(U(S, "body"), { recursive: !0 });
|
|
5930
|
-
const
|
|
5931
|
+
const C = {}, E = g.map((j) => ({
|
|
5931
5932
|
slug: j.slug,
|
|
5932
5933
|
path: j.effectivePath,
|
|
5933
5934
|
type: j.type,
|
|
@@ -5935,9 +5936,9 @@ ${E.join(`
|
|
|
5935
5936
|
bundle: p
|
|
5936
5937
|
})), I = [`${p}/manifest.json`, `${p}/search.json`];
|
|
5937
5938
|
for (const j of g) {
|
|
5938
|
-
j.pageCss && (
|
|
5939
|
+
j.pageCss && (C[j.effectivePath] = [C[j.effectivePath], j.pageCss].filter(Boolean).join(`
|
|
5939
5940
|
`));
|
|
5940
|
-
const
|
|
5941
|
+
const O = {
|
|
5941
5942
|
html: j.html,
|
|
5942
5943
|
headings: j.headings,
|
|
5943
5944
|
openApiSpec: j.openApiSpec,
|
|
@@ -5951,11 +5952,11 @@ ${E.join(`
|
|
|
5951
5952
|
dbmlFile: j.dbmlFile,
|
|
5952
5953
|
dbmlError: j.dbmlError
|
|
5953
5954
|
}, R = U(S, "body", `${De(j.slug)}.json`);
|
|
5954
|
-
await Je(K(R), { recursive: !0 }), await fe(R, JSON.stringify(
|
|
5955
|
+
await Je(K(R), { recursive: !0 }), await fe(R, JSON.stringify(O)), I.push(`${p}/body/${De(j.slug)}.json`);
|
|
5955
5956
|
}
|
|
5956
5957
|
await fe(
|
|
5957
5958
|
U(S, "manifest.json"),
|
|
5958
|
-
JSON.stringify({ shells: E, styles:
|
|
5959
|
+
JSON.stringify({ shells: E, styles: C, sidebar: an(!0) })
|
|
5959
5960
|
), await fe(U(S, "search.json"), JSON.stringify(un(!0, g))), x[p] = {
|
|
5960
5961
|
pages: Object.fromEntries(g.map((j) => [j.effectivePath, j.frontmatter.gate ?? ""])),
|
|
5961
5962
|
files: I
|
|
@@ -5972,23 +5973,23 @@ ${E.join(`
|
|
|
5972
5973
|
const m = l.filter((v) => Eo(v.type)), y = /* @__PURE__ */ new Map();
|
|
5973
5974
|
for (const v of m) y.set(v.filePath, v);
|
|
5974
5975
|
for (const [, v] of a) {
|
|
5975
|
-
const x = v[0], p = K(x.filePath), g = x.frontmatter.data, S = g?.issues ?? g?.entries,
|
|
5976
|
-
if (typeof S == "string")
|
|
5976
|
+
const x = v[0], p = K(x.filePath), g = x.frontmatter.data, S = g?.issues ?? g?.entries, C = [];
|
|
5977
|
+
if (typeof S == "string") C.push(S);
|
|
5977
5978
|
else if (Array.isArray(S))
|
|
5978
|
-
for (const M of S) typeof M == "string" &&
|
|
5979
|
-
const E =
|
|
5979
|
+
for (const M of S) typeof M == "string" && C.push(M);
|
|
5980
|
+
const E = C.length ? C.map((M) => V(p, M)) : [p], I = m.filter((M) => {
|
|
5980
5981
|
for (const L of E)
|
|
5981
5982
|
if (M.filePath !== L && (M.filePath.startsWith(L + "/") || M.filePath.startsWith(L + "\\")))
|
|
5982
5983
|
return !0;
|
|
5983
5984
|
return !1;
|
|
5984
|
-
}), j = g?.changelog,
|
|
5985
|
+
}), j = g?.changelog, O = [];
|
|
5985
5986
|
if (typeof j == "string")
|
|
5986
|
-
|
|
5987
|
+
O.push(V(p, j));
|
|
5987
5988
|
else if (Array.isArray(j))
|
|
5988
|
-
for (const M of j) typeof M == "string" &&
|
|
5989
|
+
for (const M of j) typeof M == "string" && O.push(V(p, M));
|
|
5989
5990
|
const R = /* @__PURE__ */ new Map();
|
|
5990
5991
|
for (const M of l) {
|
|
5991
|
-
if (M.type !== "changelog" ||
|
|
5992
|
+
if (M.type !== "changelog" || O.length && !O.some(
|
|
5992
5993
|
(re) => M.filePath === re || M.filePath.startsWith(re + "/") || M.filePath.startsWith(re + "\\")
|
|
5993
5994
|
))
|
|
5994
5995
|
continue;
|
|
@@ -6097,37 +6098,37 @@ ${E.join(`
|
|
|
6097
6098
|
if (c && (ke(p.frontmatter) || !a && ve(p)) || p.type === "404" && !p.frontmatter.sidebar?.name) continue;
|
|
6098
6099
|
const g = p.frontmatter.sidebar;
|
|
6099
6100
|
if (p.effectivePath === "/" && !g?.name) continue;
|
|
6100
|
-
const S = p.effectivePath === "/" ? [g.path ?? g.name] : p.effectivePath.split("/").filter(Boolean),
|
|
6101
|
-
if (g?.name &&
|
|
6102
|
-
const
|
|
6103
|
-
y.set(
|
|
6101
|
+
const S = p.effectivePath === "/" ? [g.path ?? g.name] : p.effectivePath.split("/").filter(Boolean), C = p.filePath.endsWith(`${$e}index.md`);
|
|
6102
|
+
if (g?.name && C) {
|
|
6103
|
+
const O = "/" + S.join("/");
|
|
6104
|
+
y.set(O, {
|
|
6104
6105
|
label: g.name,
|
|
6105
|
-
icon: Ue(g.icon, p.filePath) ?? y.get(
|
|
6106
|
-
style: g.style ?? y.get(
|
|
6106
|
+
icon: Ue(g.icon, p.filePath) ?? y.get(O)?.icon,
|
|
6107
|
+
style: g.style ?? y.get(O)?.style
|
|
6107
6108
|
});
|
|
6108
6109
|
}
|
|
6109
6110
|
if (p.sidebarOnly && !p.linkTo) continue;
|
|
6110
|
-
const E =
|
|
6111
|
+
const E = C ? void 0 : g?.path ?? g?.name;
|
|
6111
6112
|
E && S[S.length - 2] !== E && (S.length >= 3 ? S.splice(S.length - 2, 1, E) : S.splice(S.length - 1, 0, E));
|
|
6112
6113
|
let I = l, j = "";
|
|
6113
|
-
for (const
|
|
6114
|
-
j = j + "/" +
|
|
6115
|
-
let R = I.children.get(
|
|
6116
|
-
R || (R = { segment:
|
|
6114
|
+
for (const O of S) {
|
|
6115
|
+
j = j + "/" + O;
|
|
6116
|
+
let R = I.children.get(O);
|
|
6117
|
+
R || (R = { segment: O, fullPath: j, children: /* @__PURE__ */ new Map() }, I.children.set(O, R)), I = R;
|
|
6117
6118
|
}
|
|
6118
|
-
if (I.page = p, !
|
|
6119
|
-
const
|
|
6120
|
-
y.set(
|
|
6119
|
+
if (I.page = p, !C && g?.name) {
|
|
6120
|
+
const O = "/" + S.slice(0, -1).join("/");
|
|
6121
|
+
y.set(O, {
|
|
6121
6122
|
label: g.name,
|
|
6122
|
-
icon: Ue(g.icon, p.filePath) ?? y.get(
|
|
6123
|
-
style: g.style ?? y.get(
|
|
6123
|
+
icon: Ue(g.icon, p.filePath) ?? y.get(O)?.icon,
|
|
6124
|
+
style: g.style ?? y.get(O)?.style
|
|
6124
6125
|
});
|
|
6125
6126
|
}
|
|
6126
6127
|
}
|
|
6127
6128
|
function v(p) {
|
|
6128
6129
|
const g = [];
|
|
6129
6130
|
for (const I of p.children.values()) g.push(v(I));
|
|
6130
|
-
if (
|
|
6131
|
+
if (_t(g), p.page) {
|
|
6131
6132
|
const I = {
|
|
6132
6133
|
text: Rn(p.page),
|
|
6133
6134
|
link: p.page.linkTo ?? p.page.effectivePath,
|
|
@@ -6141,9 +6142,9 @@ ${E.join(`
|
|
|
6141
6142
|
dropdown: cn(p.page)
|
|
6142
6143
|
}, j = y.get(p.fullPath);
|
|
6143
6144
|
j?.label && (I.text = j.label), j?.icon && !I.icon && (I.icon = j.icon), j?.style && (I.style = j.style);
|
|
6144
|
-
const
|
|
6145
|
-
if (p.page.type === "openapi" &&
|
|
6146
|
-
const R =
|
|
6145
|
+
const O = p.page.openApiSpec;
|
|
6146
|
+
if (p.page.type === "openapi" && O?.tags?.length) {
|
|
6147
|
+
const R = O.tags.map((B) => ({
|
|
6147
6148
|
text: B.name,
|
|
6148
6149
|
link: `${p.page.effectivePath}#tag/${B.name}`,
|
|
6149
6150
|
slug: `${p.page.slug}__tag__${B.name}`
|
|
@@ -6215,8 +6216,8 @@ ${E.join(`
|
|
|
6215
6216
|
order: -1
|
|
6216
6217
|
}, B = (p.page.componentData?.stories ?? []).map((M, L) => ({
|
|
6217
6218
|
text: M.sidebar?.name ?? M.name,
|
|
6218
|
-
link: `${p.page.effectivePath}/${
|
|
6219
|
-
slug: `${p.page.slug}__story__${
|
|
6219
|
+
link: `${p.page.effectivePath}/${Bt(M.name)}`,
|
|
6220
|
+
slug: `${p.page.slug}__story__${Bt(M.name)}`,
|
|
6220
6221
|
icon: Ue(M.sidebar?.icon, p.page.filePath),
|
|
6221
6222
|
style: M.sidebar?.style,
|
|
6222
6223
|
order: L
|
|
@@ -6225,29 +6226,30 @@ ${E.join(`
|
|
|
6225
6226
|
} else g.length && (I.items = g);
|
|
6226
6227
|
return I.collapsed !== !1 && I.items?.some((R) => R.collapsed === !1) && (I.collapsed = !1), I;
|
|
6227
6228
|
}
|
|
6228
|
-
const S = y.get(p.fullPath),
|
|
6229
|
+
const S = y.get(p.fullPath), C = {
|
|
6229
6230
|
text: S?.label ?? Te(p.segment),
|
|
6230
6231
|
slug: p.fullPath.replace(/^\//, "")
|
|
6231
6232
|
};
|
|
6232
|
-
S?.icon && (
|
|
6233
|
+
S?.icon && (C.icon = S.icon), S?.style && (C.style = S.style);
|
|
6233
6234
|
const E = [...p.children.values()];
|
|
6234
|
-
if (E.length && E.every((I) => I.page && Object.values(cn(I.page) ?? {}).some((j) => j.some((
|
|
6235
|
-
|
|
6236
|
-
const I = (j) => Math.min(...Object.entries(j.dropdown ?? {}).map(([
|
|
6237
|
-
|
|
6235
|
+
if (E.length && E.every((I) => I.page && Object.values(cn(I.page) ?? {}).some((j) => j.some((O) => O.toLowerCase() === I.segment.toLowerCase())))) {
|
|
6236
|
+
C.variants = !0;
|
|
6237
|
+
const I = (j) => Math.min(...Object.entries(j.dropdown ?? {}).map(([O, R]) => m.get(`${O}:${R[0]}`) ?? Number.MAX_SAFE_INTEGER));
|
|
6238
|
+
for (const j of g) j.order ??= I(j);
|
|
6239
|
+
_t(g);
|
|
6238
6240
|
}
|
|
6239
6241
|
if (g.length) {
|
|
6240
|
-
|
|
6242
|
+
C.items = g;
|
|
6241
6243
|
let I = Number.MAX_SAFE_INTEGER;
|
|
6242
6244
|
for (const j of g)
|
|
6243
6245
|
j.order !== void 0 && j.order < I && (I = j.order);
|
|
6244
|
-
I !== Number.MAX_SAFE_INTEGER && (
|
|
6246
|
+
I !== Number.MAX_SAFE_INTEGER && !C.variants && (C.order = I);
|
|
6245
6247
|
}
|
|
6246
|
-
return
|
|
6248
|
+
return C.items?.some((I) => I.collapsed === !1) && (C.collapsed = !1), C;
|
|
6247
6249
|
}
|
|
6248
6250
|
const x = [];
|
|
6249
6251
|
for (const p of l.children.values()) x.push(v(p));
|
|
6250
|
-
return
|
|
6252
|
+
return _t(x), x;
|
|
6251
6253
|
}
|
|
6252
6254
|
function cn(a) {
|
|
6253
6255
|
const l = Object.entries(a.frontmatter.dropdown ?? {}).filter(([, m]) => m.value?.length);
|
|
@@ -6313,7 +6315,7 @@ ${E.join(`
|
|
|
6313
6315
|
};
|
|
6314
6316
|
if (a[v] = p, l[x.effectivePath] = v, x.type === "component")
|
|
6315
6317
|
for (const g of x.componentData?.stories ?? [])
|
|
6316
|
-
l[`${x.effectivePath}/${
|
|
6318
|
+
l[`${x.effectivePath}/${Bt(g.name)}`] = v;
|
|
6317
6319
|
}
|
|
6318
6320
|
const m = {}, y = Do();
|
|
6319
6321
|
y && (m["/"] = y);
|
|
@@ -6329,11 +6331,11 @@ ${E.join(`
|
|
|
6329
6331
|
if (a) {
|
|
6330
6332
|
if (ke(x.frontmatter) || !ve(x)) continue;
|
|
6331
6333
|
} else if (c && (ke(x.frontmatter) || ve(x))) continue;
|
|
6332
|
-
const p = x.rawText.replace(/```[\s\S]*?```/g, "").replace(/[#*`>_\[\]\(\)]/g, " "), g = x.type === "openapi" ? To(x.openApiSpec) : "", S = x.type === "roadmap" ? No(x.roadmapEntries ?? []) : "",
|
|
6334
|
+
const p = x.rawText.replace(/```[\s\S]*?```/g, "").replace(/[#*`>_\[\]\(\)]/g, " "), g = x.type === "openapi" ? To(x.openApiSpec) : "", S = x.type === "roadmap" ? No(x.roadmapEntries ?? []) : "", C = x.componentData ? [
|
|
6333
6335
|
x.componentData.component,
|
|
6334
6336
|
x.componentData.system,
|
|
6335
6337
|
...(x.componentData.stories ?? []).flatMap((j) => [j.name, j.file])
|
|
6336
|
-
].filter(Boolean).join(" ") : "", E = x.dbmlSource ? x.dbmlSource.replace(/[{}\[\]'"`,]/g, " ") : "", I = [p, g, S,
|
|
6338
|
+
].filter(Boolean).join(" ") : "", E = x.dbmlSource ? x.dbmlSource.replace(/[{}\[\]'"`,]/g, " ") : "", I = [p, g, S, C, E].filter(Boolean).join(`
|
|
6337
6339
|
`);
|
|
6338
6340
|
m.push({
|
|
6339
6341
|
slug: v,
|
|
@@ -6360,8 +6362,8 @@ ${E.join(`
|
|
|
6360
6362
|
if (p == null || g > v) return;
|
|
6361
6363
|
const S = typeof p;
|
|
6362
6364
|
if (S === "string") {
|
|
6363
|
-
const
|
|
6364
|
-
|
|
6365
|
+
const C = p.trim();
|
|
6366
|
+
C && m.push(C);
|
|
6365
6367
|
return;
|
|
6366
6368
|
}
|
|
6367
6369
|
if (S === "number" || S === "boolean") {
|
|
@@ -6370,15 +6372,15 @@ ${E.join(`
|
|
|
6370
6372
|
}
|
|
6371
6373
|
if (S === "object" && !y.has(p)) {
|
|
6372
6374
|
if (y.add(p), Array.isArray(p)) {
|
|
6373
|
-
for (const
|
|
6375
|
+
for (const C of p) x(C, g + 1);
|
|
6374
6376
|
return;
|
|
6375
6377
|
}
|
|
6376
|
-
for (const [
|
|
6377
|
-
if (
|
|
6378
|
+
for (const [C, E] of Object.entries(p)) {
|
|
6379
|
+
if (C === "description_html" || C === "summary_html" || C === "requestBodyHtml") {
|
|
6378
6380
|
typeof E == "string" && m.push(mn(E));
|
|
6379
6381
|
continue;
|
|
6380
6382
|
}
|
|
6381
|
-
m.push(
|
|
6383
|
+
m.push(C), x(E, g + 1);
|
|
6382
6384
|
}
|
|
6383
6385
|
}
|
|
6384
6386
|
};
|
|
@@ -6430,7 +6432,7 @@ ${E.join(`
|
|
|
6430
6432
|
m && a.moduleGraph.invalidateModule(m);
|
|
6431
6433
|
}
|
|
6432
6434
|
}
|
|
6433
|
-
function
|
|
6435
|
+
function Ct(a) {
|
|
6434
6436
|
for (const l of s.keys()) {
|
|
6435
6437
|
const m = Le + De(l) + ".js", y = Ve + De(l) + ".svelte", v = a.moduleGraph.getModuleById(m), x = a.moduleGraph.getModuleById(y);
|
|
6436
6438
|
v && a.moduleGraph.invalidateModule(v), x && a.moduleGraph.invalidateModule(x);
|
|
@@ -6493,7 +6495,7 @@ export default bodies
|
|
|
6493
6495
|
return `export default ${JSON.stringify(m)}
|
|
6494
6496
|
`;
|
|
6495
6497
|
}
|
|
6496
|
-
function
|
|
6498
|
+
function Ot(a) {
|
|
6497
6499
|
return `Custom_${a.replace(/[^a-zA-Z0-9]/g, "_")}`;
|
|
6498
6500
|
}
|
|
6499
6501
|
function Wo(a) {
|
|
@@ -6507,8 +6509,8 @@ export default bodies
|
|
|
6507
6509
|
path: l.effectivePath,
|
|
6508
6510
|
type: l.type,
|
|
6509
6511
|
frontmatter: l.frontmatter
|
|
6510
|
-
}, y = `${Le}${De(a)}.js`, v = JSON.stringify(m).replace(/<\/script>/g, "<\\/script>"), x = Array.from(Ie.entries()), p = x.map(([
|
|
6511
|
-
`), g = (
|
|
6512
|
+
}, y = `${Le}${De(a)}.js`, v = JSON.stringify(m).replace(/<\/script>/g, "<\\/script>"), x = Array.from(Ie.entries()), p = x.map(([C, E]) => ` import ${Ot(C)} from ${JSON.stringify(Wo(E.file))}`).join(`
|
|
6513
|
+
`), g = (C, E) => Ie.has(C) ? Ot(C) : E, S = [
|
|
6512
6514
|
["team", "TeamPage"],
|
|
6513
6515
|
["pricing", "PricingPage"],
|
|
6514
6516
|
["glossary", "GlossaryPage"],
|
|
@@ -6519,10 +6521,10 @@ export default bodies
|
|
|
6519
6521
|
["roadmap", "RoadmapPage"],
|
|
6520
6522
|
["component", "ComponentPage"],
|
|
6521
6523
|
["dbml", "DbmlPage"]
|
|
6522
|
-
].map(([
|
|
6523
|
-
<${g(
|
|
6524
|
-
x.filter(([
|
|
6525
|
-
<${
|
|
6524
|
+
].map(([C, E]) => ` {:else if shell.type === ${JSON.stringify(C)}}
|
|
6525
|
+
<${g(C, E)} page={{ ...shell, ...mod.default }} />`).concat(
|
|
6526
|
+
x.filter(([C]) => !lo.has(C)).map(([C]) => ` {:else if shell.type === ${JSON.stringify(C)}}
|
|
6527
|
+
<${Ot(C)} page={{ ...shell, ...mod.default }} />`)
|
|
6526
6528
|
).join(`
|
|
6527
6529
|
`);
|
|
6528
6530
|
return `<script lang="ts">
|
|
@@ -6574,7 +6576,7 @@ ${S}
|
|
|
6574
6576
|
name: "@nimtech/nimpress:markdown",
|
|
6575
6577
|
async config() {
|
|
6576
6578
|
t = (await _s(process.cwd(), e)).resolved, n = V(process.cwd(), t.contentDir), ra(process.cwd(), t.pageTypes ?? {});
|
|
6577
|
-
for (const l of
|
|
6579
|
+
for (const l of $t(t))
|
|
6578
6580
|
dt.includes(l) || he(V(process.cwd(), l)) || console.warn(`[nimpress] theme ${l} is neither a built in theme, ${dt.join(" or ")}, nor a stylesheet`);
|
|
6579
6581
|
return o = V(process.cwd(), t.assetsDir), {};
|
|
6580
6582
|
},
|
|
@@ -6591,7 +6593,7 @@ ${S}
|
|
|
6591
6593
|
recursive: !0,
|
|
6592
6594
|
filter: (v) => {
|
|
6593
6595
|
try {
|
|
6594
|
-
return
|
|
6596
|
+
return yt(v).isDirectory() || !(v.endsWith(".md") || v.endsWith(".css"));
|
|
6595
6597
|
} catch {
|
|
6596
6598
|
return !1;
|
|
6597
6599
|
}
|
|
@@ -6604,7 +6606,7 @@ ${S}
|
|
|
6604
6606
|
const p = U(i, v.replace(/^\//, ""));
|
|
6605
6607
|
await Je(K(p), { recursive: !0 }), await fe(p, x);
|
|
6606
6608
|
}
|
|
6607
|
-
await fe(U(i, "subscribe.map.json"),
|
|
6609
|
+
await fe(U(i, "subscribe.map.json"), At), await jo();
|
|
6608
6610
|
const y = Array.from(s.values()).find((v) => v.type === "404" && !ke(v.frontmatter) && !ve(v));
|
|
6609
6611
|
y && await dn(U(i, y.effectivePath.replace(/^\//, ""), "index.html"), U(i, "404.html")), await Po();
|
|
6610
6612
|
},
|
|
@@ -6621,7 +6623,7 @@ ${S}
|
|
|
6621
6623
|
a.config.logger.error(String(S));
|
|
6622
6624
|
return;
|
|
6623
6625
|
}
|
|
6624
|
-
it(a),
|
|
6626
|
+
it(a), Ct(a), Ge(), a.ws.send({ type: "full-reload" });
|
|
6625
6627
|
}
|
|
6626
6628
|
}, m = async (p) => {
|
|
6627
6629
|
if (p.startsWith(n) && (p.endsWith(".md") || p.endsWith(".css") || p.match(/\.story\.tsx?$/))) {
|
|
@@ -6632,7 +6634,7 @@ ${S}
|
|
|
6632
6634
|
a.config.logger.error(String(S));
|
|
6633
6635
|
return;
|
|
6634
6636
|
}
|
|
6635
|
-
it(a),
|
|
6637
|
+
it(a), Ct(a), Ge(), a.ws.send({ type: "full-reload" });
|
|
6636
6638
|
return;
|
|
6637
6639
|
}
|
|
6638
6640
|
if (T.has(p)) {
|
|
@@ -6644,7 +6646,7 @@ ${S}
|
|
|
6644
6646
|
if (a.watcher.on("add", l), a.watcher.on("unlink", m), t.banner !== !1) {
|
|
6645
6647
|
const p = Rs(), g = t.banner, S = Date.now();
|
|
6646
6648
|
a.printUrls = function() {
|
|
6647
|
-
const
|
|
6649
|
+
const C = a.resolvedUrls, E = C?.local?.[0] ?? `http://localhost:${a.config.server.port ?? 5173}/`, I = C?.network?.[0] ?? "use --host to expose", j = Fs({
|
|
6648
6650
|
title: g.title ?? t.title ?? p.name ?? "Nimpress",
|
|
6649
6651
|
tagline: g.tagline,
|
|
6650
6652
|
company: g.company,
|
|
@@ -6675,11 +6677,11 @@ ${S}
|
|
|
6675
6677
|
".mp4": "video/mp4"
|
|
6676
6678
|
}, v = t.assetUrlBase, x = (p, g, S) => {
|
|
6677
6679
|
if (!g || g.endsWith(".md")) return !1;
|
|
6678
|
-
const
|
|
6679
|
-
return !
|
|
6680
|
+
const C = U(p, decodeURIComponent(g));
|
|
6681
|
+
return !C.startsWith(p) || !he(C) || !yt(C).isFile() ? !1 : (S.setHeader("Content-Type", y[Gt(C).toLowerCase()] ?? "application/octet-stream"), Ho(C).pipe(S), !0);
|
|
6680
6682
|
};
|
|
6681
6683
|
return a.middlewares.use((p, g, S) => {
|
|
6682
|
-
const
|
|
6684
|
+
const C = (p.url ?? "").split("?")[0], E = Un(t.base, C);
|
|
6683
6685
|
if (E.startsWith("/@") || E.startsWith("/node_modules/")) return S();
|
|
6684
6686
|
if (E === "/__nimpress/claude-md" && p.method === "PUT") {
|
|
6685
6687
|
const R = [];
|
|
@@ -6724,7 +6726,7 @@ ${S}
|
|
|
6724
6726
|
return;
|
|
6725
6727
|
}
|
|
6726
6728
|
if (E === "/subscribe.map.json") {
|
|
6727
|
-
g.setHeader("Content-Type", "application/json; charset=utf-8"), g.end(
|
|
6729
|
+
g.setHeader("Content-Type", "application/json; charset=utf-8"), g.end(At);
|
|
6728
6730
|
return;
|
|
6729
6731
|
}
|
|
6730
6732
|
const j = t.modules.route.replace(/\/$/, "");
|
|
@@ -6737,7 +6739,7 @@ ${S}
|
|
|
6737
6739
|
const L = zo(
|
|
6738
6740
|
{
|
|
6739
6741
|
host: "127.0.0.1",
|
|
6740
|
-
port:
|
|
6742
|
+
port: St(t.modules, B),
|
|
6741
6743
|
path: `${E}${(p.url ?? "").includes("?") ? `?${(p.url ?? "").split("?").slice(1).join("?")}` : ""}`,
|
|
6742
6744
|
method: p.method,
|
|
6743
6745
|
headers: p.headers
|
|
@@ -6762,13 +6764,13 @@ ${S}
|
|
|
6762
6764
|
a.middlewares.use(async (p, g, S) => {
|
|
6763
6765
|
if (p.method !== "GET" && p.method !== "HEAD" || !(p.headers.accept ?? "").includes("text/html")) return S();
|
|
6764
6766
|
try {
|
|
6765
|
-
const
|
|
6767
|
+
const C = await a.transformIndexHtml(
|
|
6766
6768
|
p.url ?? "/",
|
|
6767
6769
|
Kr(t, "/@id/__x00__virtual:nimpress/main")
|
|
6768
6770
|
);
|
|
6769
|
-
g.statusCode = 200, g.setHeader("Content-Type", "text/html"), g.end(
|
|
6770
|
-
} catch (
|
|
6771
|
-
S(
|
|
6771
|
+
g.statusCode = 200, g.setHeader("Content-Type", "text/html"), g.end(C);
|
|
6772
|
+
} catch (C) {
|
|
6773
|
+
S(C);
|
|
6772
6774
|
}
|
|
6773
6775
|
});
|
|
6774
6776
|
};
|
|
@@ -6794,15 +6796,15 @@ ${S}
|
|
|
6794
6796
|
a.server.config.logger.error(String(S));
|
|
6795
6797
|
return;
|
|
6796
6798
|
}
|
|
6797
|
-
return it(a.server),
|
|
6799
|
+
return it(a.server), Ct(a.server), Ge(), a.server.ws.send({ type: "full-reload" }), [];
|
|
6798
6800
|
},
|
|
6799
6801
|
resolveId(a) {
|
|
6800
|
-
return a === lt ? "\0" + lt : a === pt ? "\0" + pt : a === ut ? "\0" + ut : a === mt ? "\0" + mt : a ===
|
|
6802
|
+
return a === lt ? "\0" + lt : a === pt ? "\0" + pt : a === ut ? "\0" + ut : a === mt ? "\0" + mt : a === Nt ? "\0" + Nt : a === It ? "\0" + It : a.startsWith(Ve) && a.endsWith(".svelte") || a.startsWith(Le) && a.endsWith(".js") ? a : null;
|
|
6801
6803
|
},
|
|
6802
6804
|
async load(a) {
|
|
6803
6805
|
if (a === "\0" + lt)
|
|
6804
6806
|
return `export default ${JSON.stringify(Mo())}`;
|
|
6805
|
-
if (a === "\0" +
|
|
6807
|
+
if (a === "\0" + Nt) {
|
|
6806
6808
|
const l = ys(t), m = l.announce || l.feedback ? Fn(await P(), be(), t.base, { math: t.math, icons: t.icons }) : null;
|
|
6807
6809
|
if (l.feedback && m && (l.feedback = {
|
|
6808
6810
|
...l.feedback,
|
|
@@ -6816,8 +6818,8 @@ ${S}
|
|
|
6816
6818
|
}
|
|
6817
6819
|
return `export default ${JSON.stringify(l)}`;
|
|
6818
6820
|
}
|
|
6819
|
-
if (a === "\0" +
|
|
6820
|
-
const l = (E) => E.startsWith("/") ? E : "/" + E.replace(/^\.\//, ""), y = [
|
|
6821
|
+
if (a === "\0" + It) {
|
|
6822
|
+
const l = (E) => E.startsWith("/") ? E : "/" + E.replace(/^\.\//, ""), y = [...$t(t).filter((E) => E !== "stock").map((E) => dt.includes(E) ? `@nimtech/nimpress/themes/${E}.css` : l(E)), ...t.css.map(l)].map((E) => `import ${JSON.stringify(E)}`).join(`
|
|
6821
6823
|
`), v = Object.entries(t.components), x = v.map(([E, I]) => `import Nimpress${E} from ${JSON.stringify(l(I))}`).join(`
|
|
6822
6824
|
`), p = v.length ? `, components: { ${v.map(([E]) => `${E}: Nimpress${E}`).join(", ")} }` : "", g = t.client ? l(t.client) : null, S = g ? `import { authFunctions, subscribeFunctions, feedbackFunctions } from ${JSON.stringify(g)}` : "";
|
|
6823
6825
|
return `import '@nimtech/nimpress/app.css'
|
|
@@ -6865,7 +6867,7 @@ async function Pi(e, t) {
|
|
|
6865
6867
|
} catch {
|
|
6866
6868
|
continue;
|
|
6867
6869
|
}
|
|
6868
|
-
const { data: c, content: f } =
|
|
6870
|
+
const { data: c, content: f } = bt(i);
|
|
6869
6871
|
typeof c.type == "number" && (c.type = String(c.type));
|
|
6870
6872
|
for (const d of po(c, f))
|
|
6871
6873
|
s.push(`${Se(n, r).split($e).join("/")}: ${d}`);
|
|
@@ -6895,14 +6897,14 @@ export {
|
|
|
6895
6897
|
yi as h,
|
|
6896
6898
|
Kr as i,
|
|
6897
6899
|
vi as j,
|
|
6898
|
-
|
|
6900
|
+
St as k,
|
|
6899
6901
|
ra as l,
|
|
6900
6902
|
Pi as m,
|
|
6901
6903
|
Oa as n,
|
|
6902
6904
|
Zn as o,
|
|
6903
6905
|
rt as p,
|
|
6904
6906
|
_i as q,
|
|
6905
|
-
|
|
6907
|
+
jt as r,
|
|
6906
6908
|
st as s,
|
|
6907
6909
|
bi as t,
|
|
6908
6910
|
xr as u,
|