typerighter 0.57.3 → 0.57.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{app-C-C48izb.js → app-BQYETY9F.js} +176 -176
- package/dist/{cli-C2MIZ1lV.js → cli-MA8-6Usn.js} +5 -5
- package/dist/cli.js +1 -1
- package/dist/client/app/index.d.ts.map +1 -1
- package/dist/client/theme-default.js +1 -1
- package/dist/client.js +1 -1
- package/dist/index.js +2 -2
- package/dist/{init-BduI0qK5.js → init-BND13fc5.js} +1 -1
- package/dist/node/build/index.d.ts.map +1 -1
- package/dist/node/build/seo/index.d.ts +1 -0
- package/dist/node/build/seo/index.d.ts.map +1 -1
- package/dist/{page-ChF2owpa.js → page-BjRVeDZC.js} +5 -5
- package/dist/prerenderWorker.js +2 -2
- package/dist/{renderMath-e3scuxfY.js → renderMath-DzumBAaX.js} +1 -1
- package/dist/{shared-dB08amQA.js → shared-BhUHq27C.js} +1 -1
- package/dist/shared.js +1 -1
- package/dist/typerighter.css +1 -1
- package/dist/{vite-Bd6MPoKO.js → vite-l2QQKyhl.js} +452 -432
- package/dist/vite.js +1 -1
- package/package.json +3 -3
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { B as e, D as t, F as n,
|
|
2
|
-
import { n as
|
|
3
|
-
import { t as
|
|
4
|
-
import { a as
|
|
5
|
-
import { t as
|
|
1
|
+
import { B as e, D as t, F as n, I as r, J as i, O as a, Q as o, R as s, T as c, U as l, V as u, W as d, X as f, _ as p, b as m, c as h, d as g, g as _, h as v, i as y, it as b, p as x, rt as S, tt as C, v as w, x as ee, y as T, z as E } from "./shared-BhUHq27C.js";
|
|
2
|
+
import { n as D, t as O } from "./page-BjRVeDZC.js";
|
|
3
|
+
import { t as k } from "./temml-CjI4drVW.js";
|
|
4
|
+
import { a as A, i as te, n as ne, r as re } from "./context-CLKZYp4U.js";
|
|
5
|
+
import { t as ie } from "./es-B_QJMowB.js";
|
|
6
6
|
import j, { resolve as M } from "node:path";
|
|
7
7
|
import N from "picocolors";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { build as
|
|
11
|
-
import F, { readdir as
|
|
12
|
-
import { fileURLToPath as
|
|
13
|
-
import
|
|
14
|
-
import { Worker as
|
|
15
|
-
import I, { createReadStream as
|
|
16
|
-
import { createRequire as
|
|
17
|
-
import { createChecker as
|
|
18
|
-
import { createHighlighter as
|
|
8
|
+
import ae from "@tailwindcss/vite";
|
|
9
|
+
import oe from "@vitejs/plugin-vue";
|
|
10
|
+
import { build as se, normalizePath as P } from "vite";
|
|
11
|
+
import F, { readdir as ce } from "node:fs/promises";
|
|
12
|
+
import { fileURLToPath as le } from "node:url";
|
|
13
|
+
import ue from "node:os";
|
|
14
|
+
import { Worker as de } from "node:worker_threads";
|
|
15
|
+
import I, { createReadStream as fe, existsSync as pe, globSync as me, readFileSync as he, statSync as ge } from "node:fs";
|
|
16
|
+
import { createRequire as _e } from "node:module";
|
|
17
|
+
import { createChecker as ve, createCheckerByJson as ye } from "vue-component-meta";
|
|
18
|
+
import { createHighlighter as be, guessEmbeddedLanguages as xe, isSpecialLang as Se } from "shiki";
|
|
19
19
|
// src/node/lib/worker-pool/index.ts
|
|
20
|
-
var
|
|
20
|
+
var Ce = class {
|
|
21
21
|
workers = [];
|
|
22
22
|
queue = [];
|
|
23
23
|
destroyed = !1;
|
|
24
24
|
startupError;
|
|
25
25
|
constructor(e) {
|
|
26
|
-
let t = e.concurrency ?? Math.max(1, Math.floor(
|
|
26
|
+
let t = e.concurrency ?? Math.max(1, Math.floor(ue.cpus().length / 2));
|
|
27
27
|
for (let n = 0; n < t; n++) {
|
|
28
|
-
let t = new
|
|
28
|
+
let t = new de(e.filename, { workerData: e.workerData }), n = { worker: t };
|
|
29
29
|
this.workers.push(n), t.on("message", (e) => {
|
|
30
30
|
let t = n.pending;
|
|
31
31
|
n.pending = void 0, e.error === void 0 ? t?.resolve(e.result) : t?.reject(Error(e.error)), this.dispatch(n);
|
|
@@ -62,18 +62,18 @@ var xe = class {
|
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
64
|
// src/node/build/seo/sitemap.ts
|
|
65
|
-
function
|
|
65
|
+
function we(e, t, r, i) {
|
|
66
66
|
let a = r ?? "";
|
|
67
67
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
68
68
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
69
69
|
${e.map((e) => {
|
|
70
|
-
let r =
|
|
71
|
-
return ` <url><loc>${r}</loc>${o === void 0 ? "" : `<lastmod>${
|
|
70
|
+
let r = h(a + t + n(e)), o = i?.get(e);
|
|
71
|
+
return ` <url><loc>${r}</loc>${o === void 0 ? "" : `<lastmod>${y(o * 1e3)}</lastmod>`}</url>`;
|
|
72
72
|
}).join("\n")}
|
|
73
73
|
</urlset>
|
|
74
74
|
`;
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function Te(e, t) {
|
|
77
77
|
return `User-agent: *
|
|
78
78
|
Allow: /
|
|
79
79
|
|
|
@@ -81,44 +81,64 @@ Sitemap: ${e}${t}sitemap.xml
|
|
|
81
81
|
`;
|
|
82
82
|
}
|
|
83
83
|
// src/node/build/seo/feed.ts
|
|
84
|
-
function
|
|
85
|
-
let
|
|
86
|
-
let
|
|
84
|
+
function Ee(e, t, n, r, i, a) {
|
|
85
|
+
let o = [...e].filter((e) => e.fileMetadata.mtimeSecs > 0).sort((e, t) => t.fileMetadata.mtimeSecs - e.fileMetadata.mtimeSecs).slice(0, 50).map((e) => {
|
|
86
|
+
let r = l(e.filepath), i = `${n}${t}${r}`, a = (/* @__PURE__ */ new Date(e.fileMetadata.mtimeSecs * 1e3)).toUTCString(), o = h(e.label ?? r), s = e.excerpt === void 0 ? "" : `<![CDATA[${e.excerpt}]]>`;
|
|
87
87
|
return ` <item>
|
|
88
|
-
<title>${
|
|
89
|
-
<link>${
|
|
90
|
-
<guid>${
|
|
91
|
-
<pubDate>${
|
|
92
|
-
<description>${
|
|
88
|
+
<title>${o}</title>
|
|
89
|
+
<link>${h(i)}</link>
|
|
90
|
+
<guid>${h(i)}</guid>
|
|
91
|
+
<pubDate>${a}</pubDate>
|
|
92
|
+
<description>${s}</description>
|
|
93
93
|
</item>`;
|
|
94
94
|
}).join("\n");
|
|
95
95
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
96
96
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
|
97
97
|
<channel>
|
|
98
|
-
<title>${
|
|
99
|
-
<link>${
|
|
100
|
-
<description>${
|
|
101
|
-
<language>${
|
|
102
|
-
<atom:link href="${
|
|
103
|
-
${
|
|
98
|
+
<title>${h(r)}</title>
|
|
99
|
+
<link>${h(n + t)}</link>
|
|
100
|
+
<description>${h(i)}</description>
|
|
101
|
+
<language>${a}</language>
|
|
102
|
+
<atom:link href="${h(n + t)}feed.xml" rel="self" type="application/rss+xml"/>
|
|
103
|
+
${o}
|
|
104
104
|
</channel>
|
|
105
105
|
</rss>
|
|
106
106
|
`;
|
|
107
107
|
}
|
|
108
|
+
// src/node/build/seo/llms.ts
|
|
109
|
+
function De(e, t, n, r, i) {
|
|
110
|
+
let a = [];
|
|
111
|
+
a.push(`# ${r}`), a.push(""), i && (a.push(`> ${i}`), a.push(""));
|
|
112
|
+
let o = /* @__PURE__ */ new Map();
|
|
113
|
+
for (let t of e) {
|
|
114
|
+
let e = t.filepath.split("/"), n = e.length > 1 ? e[0] : "";
|
|
115
|
+
o.has(n) || o.set(n, []), o.get(n).push(t);
|
|
116
|
+
}
|
|
117
|
+
for (let [e, r] of o) {
|
|
118
|
+
let i = e ? f(e) : "General";
|
|
119
|
+
a.push(`## ${i}`), a.push("");
|
|
120
|
+
for (let e of r) {
|
|
121
|
+
let r = l(e.filepath), i = `${n}${t}${m(e.filepath) ? r.replace(/\/index$/, "/").replace(/^index$/, "") : r}`, o = e.label ?? f(E(e.filepath)), s = e.excerpt ? `: ${e.excerpt}` : "";
|
|
122
|
+
a.push(`- [${o}](${i})${s}`);
|
|
123
|
+
}
|
|
124
|
+
a.push("");
|
|
125
|
+
}
|
|
126
|
+
return a.join("\n");
|
|
127
|
+
}
|
|
108
128
|
// src/node/build/fonts.ts
|
|
109
|
-
function
|
|
129
|
+
function Oe(e) {
|
|
110
130
|
let t = j.basename(e);
|
|
111
131
|
return t.endsWith(".woff2") && t.includes("-latin-") && !t.includes("-latin-ext-");
|
|
112
132
|
}
|
|
113
133
|
// src/node/build/prerender.ts
|
|
114
|
-
var
|
|
115
|
-
async function
|
|
116
|
-
let { clientEntry: t, cssFiles: n, fontFiles: r } = await
|
|
117
|
-
e.pageRoutes.length >=
|
|
118
|
-
}
|
|
119
|
-
async function
|
|
120
|
-
let r = new
|
|
121
|
-
filename: j.resolve(
|
|
134
|
+
var ke = 64;
|
|
135
|
+
async function Ae(e) {
|
|
136
|
+
let { clientEntry: t, cssFiles: n, fontFiles: r } = await Ne(e.clientOutDir), i = [n.map((t) => ` <link rel="stylesheet" href="${e.base}${t}">`).join("\n"), r.map((t) => ` <link rel="preload" as="font" type="font/woff2" crossorigin href="${e.base}${t}">`).join("\n")].filter(Boolean).join("\n") || void 0;
|
|
137
|
+
e.pageRoutes.length >= ke ? await je(e, t, i) : await Me(e, t, i);
|
|
138
|
+
}
|
|
139
|
+
async function je(e, t, n) {
|
|
140
|
+
let r = new Ce({
|
|
141
|
+
filename: j.resolve(le(import.meta.url), "../prerenderWorker.js"),
|
|
122
142
|
workerData: {
|
|
123
143
|
ssrEntryPath: e.ssrEntryPath,
|
|
124
144
|
base: e.base,
|
|
@@ -139,14 +159,14 @@ async function Oe(e, t, n) {
|
|
|
139
159
|
await r.destroy();
|
|
140
160
|
}
|
|
141
161
|
}
|
|
142
|
-
async function
|
|
162
|
+
async function Me(e, t, r) {
|
|
143
163
|
let i = await (await import(e.ssrEntryPath)).createRenderer(), a = e.pageRoutes.length, o = 0;
|
|
144
164
|
for (let s of e.pageRoutes) {
|
|
145
|
-
let c = await i(s), l =
|
|
165
|
+
let c = await i(s), l = O(c.pageData, s, {
|
|
146
166
|
base: e.base,
|
|
147
167
|
origin: e.origin,
|
|
148
168
|
author: e.author
|
|
149
|
-
}), u =
|
|
169
|
+
}), u = D({
|
|
150
170
|
title: l.title,
|
|
151
171
|
description: l.description,
|
|
152
172
|
siteTitle: e.siteTitle,
|
|
@@ -165,9 +185,9 @@ async function ke(e, t, r) {
|
|
|
165
185
|
await F.mkdir(j.dirname(f), { recursive: !0 }), await F.writeFile(f, u), o++, e.progress?.update(o, a);
|
|
166
186
|
}
|
|
167
187
|
}
|
|
168
|
-
async function
|
|
188
|
+
async function Ne(e) {
|
|
169
189
|
let t = j.join(e, ".vite", "manifest.json"), n = await F.readFile(t, "utf-8"), r = JSON.parse(n), i = "", a = [], o = [];
|
|
170
|
-
for (let e of Object.values(r)) e.isEntry ? (i = e.file, e.css && a.push(...e.css)) :
|
|
190
|
+
for (let e of Object.values(r)) e.isEntry ? (i = e.file, e.css && a.push(...e.css)) : Oe(e.file) && o.push(e.file);
|
|
171
191
|
return {
|
|
172
192
|
clientEntry: i,
|
|
173
193
|
cssFiles: a,
|
|
@@ -175,7 +195,7 @@ async function Ae(e) {
|
|
|
175
195
|
};
|
|
176
196
|
}
|
|
177
197
|
// src/node/lib/codegen/app-entry.ts
|
|
178
|
-
function
|
|
198
|
+
function Pe(e, t) {
|
|
179
199
|
let { rootDir: n = ".", mountPath: r = "", userComponents: i = [] } = e, a = [r, n === "." ? "" : n].filter(Boolean).join("/"), o = i.map((e) => `import ${e.name} from ${JSON.stringify(e.absolutePath)};`).join("\n"), s = i.map((e) => `app.component(${JSON.stringify(e.name)}, ${e.name});`).join("\n"), c = JSON.stringify({
|
|
180
200
|
title: e.siteTitle,
|
|
181
201
|
description: e.siteDescription,
|
|
@@ -233,8 +253,8 @@ if (import.meta.hot) {
|
|
|
233
253
|
`;
|
|
234
254
|
}
|
|
235
255
|
// src/node/lib/codegen/theme.ts
|
|
236
|
-
var
|
|
237
|
-
function
|
|
256
|
+
var L = "typerighter/client/theme-default";
|
|
257
|
+
function Fe(e, t) {
|
|
238
258
|
let n = e?.notFound ? `import CustomNotFound from ${JSON.stringify(t ? j.resolve(t, e.notFound) : e.notFound)};` : "", r = e?.notFound ? ", NotFound: CustomNotFound" : "";
|
|
239
259
|
if (e?.component) {
|
|
240
260
|
let i = t ? j.resolve(t, e.component) : e.component;
|
|
@@ -244,40 +264,40 @@ function Ne(e, t) {
|
|
|
244
264
|
`export default { Layout: CustomLayout${r} };`
|
|
245
265
|
].filter(Boolean).join("\n");
|
|
246
266
|
}
|
|
247
|
-
let
|
|
248
|
-
if (0 <
|
|
249
|
-
let e =
|
|
267
|
+
let a = Object.entries(e?.slots ?? {});
|
|
268
|
+
if (0 < a.length) {
|
|
269
|
+
let e = a.map(([e, t]) => `${JSON.stringify(i(e))}: () => h(resolveComponent(${JSON.stringify(t)}))`).join(", ");
|
|
250
270
|
return [
|
|
251
|
-
`import DefaultTheme from ${JSON.stringify(
|
|
271
|
+
`import DefaultTheme from ${JSON.stringify(L)};`,
|
|
252
272
|
"import { h, resolveComponent } from 'vue';",
|
|
253
273
|
n,
|
|
254
274
|
`export default { Layout: { render() { return h(DefaultTheme.Layout, null, { ${e} }); } }${r} };`
|
|
255
275
|
].filter(Boolean).join("\n");
|
|
256
276
|
}
|
|
257
277
|
return n ? [
|
|
258
|
-
`import DefaultTheme from ${JSON.stringify(
|
|
278
|
+
`import DefaultTheme from ${JSON.stringify(L)};`,
|
|
259
279
|
n,
|
|
260
280
|
`export default { ...DefaultTheme${r} };`
|
|
261
|
-
].join("\n") : `export { default } from ${JSON.stringify(
|
|
281
|
+
].join("\n") : `export { default } from ${JSON.stringify(L)};`;
|
|
262
282
|
}
|
|
263
283
|
// src/node/lib/components.ts
|
|
264
|
-
function
|
|
284
|
+
function Ie(e) {
|
|
265
285
|
let t = j.join(e, "tsconfig.json");
|
|
266
|
-
if (I.existsSync(t)) return
|
|
267
|
-
let n =
|
|
268
|
-
return
|
|
286
|
+
if (I.existsSync(t)) return ve(t);
|
|
287
|
+
let n = Le(e);
|
|
288
|
+
return ye(e, { compilerOptions: {
|
|
269
289
|
strict: !1,
|
|
270
290
|
jsx: "preserve",
|
|
271
291
|
jsxImportSource: "vue",
|
|
272
292
|
...n && { paths: n }
|
|
273
293
|
} });
|
|
274
294
|
}
|
|
275
|
-
async function
|
|
295
|
+
async function R(e, t) {
|
|
276
296
|
let n = [];
|
|
277
297
|
for (let r of e) if (r.kind === "dir") {
|
|
278
298
|
let e = j.resolve(t, r.path), i;
|
|
279
299
|
try {
|
|
280
|
-
i = await
|
|
300
|
+
i = await ce(e, { withFileTypes: !0 });
|
|
281
301
|
} catch {
|
|
282
302
|
continue;
|
|
283
303
|
}
|
|
@@ -298,9 +318,9 @@ async function L(e, t) {
|
|
|
298
318
|
});
|
|
299
319
|
return n;
|
|
300
320
|
}
|
|
301
|
-
function
|
|
321
|
+
function Le(e) {
|
|
302
322
|
try {
|
|
303
|
-
let t =
|
|
323
|
+
let t = _e(j.join(e, "package.json")), n = j.dirname(t.resolve("vue/package.json"));
|
|
304
324
|
return {
|
|
305
325
|
vue: [n],
|
|
306
326
|
"vue/*": [j.join(n, "*")]
|
|
@@ -310,12 +330,12 @@ function Fe(e) {
|
|
|
310
330
|
}
|
|
311
331
|
}
|
|
312
332
|
// src/node/lib/progress.ts
|
|
313
|
-
var
|
|
333
|
+
var z = [
|
|
314
334
|
"◐",
|
|
315
335
|
"◓",
|
|
316
336
|
"◑",
|
|
317
337
|
"◒"
|
|
318
|
-
],
|
|
338
|
+
], Re = class {
|
|
319
339
|
logger;
|
|
320
340
|
label;
|
|
321
341
|
start;
|
|
@@ -323,8 +343,8 @@ var R = [
|
|
|
323
343
|
constructor(e, t) {
|
|
324
344
|
if (this.logger = e, this.label = t, this.start = performance.now(), process.stdout.isTTY) {
|
|
325
345
|
let e = 0;
|
|
326
|
-
process.stdout.write(N.cyan(`${
|
|
327
|
-
e = (e + 1) %
|
|
346
|
+
process.stdout.write(N.cyan(`${z[0]} ${t}`)), this.spinnerInterval = setInterval(() => {
|
|
347
|
+
e = (e + 1) % z.length, process.stdout.write(`\r${N.cyan(`${z[e]} ${this.label}`)}`);
|
|
328
348
|
}, 120).unref();
|
|
329
349
|
} else this.logger.start(t);
|
|
330
350
|
}
|
|
@@ -336,70 +356,70 @@ var R = [
|
|
|
336
356
|
done(e) {
|
|
337
357
|
this.stopSpinner(), process.stdout.isTTY && process.stdout.write("\r\x1B[K");
|
|
338
358
|
let t = Math.round(performance.now() - this.start);
|
|
339
|
-
this.logger.success(`${e} (${
|
|
359
|
+
this.logger.success(`${e} (${ze(t)})`);
|
|
340
360
|
}
|
|
341
361
|
stopSpinner() {
|
|
342
362
|
this.spinnerInterval &&= (clearInterval(this.spinnerInterval), void 0);
|
|
343
363
|
}
|
|
344
364
|
};
|
|
345
|
-
function
|
|
365
|
+
function ze(e) {
|
|
346
366
|
return e < 1e3 ? `${Math.round(e)}ms` : `${(e / 1e3).toFixed(1)}s`;
|
|
347
367
|
}
|
|
348
368
|
// src/node/build/index.ts
|
|
349
|
-
async function
|
|
350
|
-
let { root: n, logger:
|
|
351
|
-
await F.rm(
|
|
369
|
+
async function Be(e, t = {}) {
|
|
370
|
+
let { root: n, logger: r } = e, i = j.resolve(n, t.outDir ?? "dist"), a = j.join(i, ".client"), o = j.join(i, ".server");
|
|
371
|
+
await F.rm(i, {
|
|
352
372
|
recursive: !0,
|
|
353
373
|
force: !0
|
|
354
374
|
});
|
|
355
|
-
let
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
]), p = await Promise.all(f.map(async (e) => [e, (await
|
|
375
|
+
let s = await e.getTdContext(), [c, u, d, f] = await Promise.all([
|
|
376
|
+
s.getConfig(),
|
|
377
|
+
s.listFiles(),
|
|
378
|
+
s.listSidebar(),
|
|
379
|
+
s.listSchemas()
|
|
380
|
+
]), p = await Promise.all(f.map(async (e) => [e, (await s.getSchema(e)).properties])), m = Object.fromEntries(p), h = c.origin ?? void 0, g = c.author ?? void 0, _ = c.license ?? void 0, y = c.repo ?? void 0, b = t.base ?? c.basePath ?? "/", x = ee(b), S = d.map((e) => ({
|
|
361
381
|
...e,
|
|
362
382
|
header: {}
|
|
363
|
-
})), C =
|
|
364
|
-
title:
|
|
365
|
-
description:
|
|
383
|
+
})), C = v(S), w = JSON.stringify({
|
|
384
|
+
title: c.siteTitle,
|
|
385
|
+
description: c.siteDescription,
|
|
366
386
|
basePath: x,
|
|
367
387
|
origin: h,
|
|
368
|
-
lang:
|
|
369
|
-
rootDir:
|
|
388
|
+
lang: c.lang,
|
|
389
|
+
rootDir: c.rootDir,
|
|
370
390
|
repo: y,
|
|
371
|
-
author:
|
|
372
|
-
license:
|
|
373
|
-
nav:
|
|
391
|
+
author: g,
|
|
392
|
+
license: _,
|
|
393
|
+
nav: c.nav
|
|
374
394
|
}), T = JSON.stringify({
|
|
375
395
|
ready: !0,
|
|
376
396
|
contentTree: C,
|
|
377
397
|
schemas: m
|
|
378
398
|
}), E = j.join(n, "node_modules", ".typerighter");
|
|
379
399
|
await F.mkdir(E, { recursive: !0 });
|
|
380
|
-
let D = j.join(E, "client-entry.js"), O = j.join(E, "ssr-entry.js"), k = j.join(E, "theme.js"), A = await
|
|
400
|
+
let D = j.join(E, "client-entry.js"), O = j.join(E, "ssr-entry.js"), k = j.join(E, "theme.js"), A = await R(c.components, n), te = Fe(c.layout ?? void 0, n);
|
|
381
401
|
await Promise.all([
|
|
382
|
-
F.writeFile(D,
|
|
383
|
-
rootDir:
|
|
402
|
+
F.writeFile(D, Pe({
|
|
403
|
+
rootDir: c.rootDir,
|
|
384
404
|
basePath: x,
|
|
385
405
|
origin: h,
|
|
386
|
-
lang:
|
|
387
|
-
siteTitle:
|
|
388
|
-
siteDescription:
|
|
406
|
+
lang: c.lang,
|
|
407
|
+
siteTitle: c.siteTitle,
|
|
408
|
+
siteDescription: c.siteDescription,
|
|
389
409
|
repo: y,
|
|
390
|
-
author:
|
|
391
|
-
license:
|
|
392
|
-
nav:
|
|
410
|
+
author: g,
|
|
411
|
+
license: _,
|
|
412
|
+
nav: c.nav,
|
|
393
413
|
userComponents: A
|
|
394
414
|
}, {
|
|
395
|
-
theme:
|
|
396
|
-
pages:
|
|
397
|
-
siteData:
|
|
398
|
-
searchIndex:
|
|
399
|
-
pageDataEvent:
|
|
415
|
+
theme: Y,
|
|
416
|
+
pages: G,
|
|
417
|
+
siteData: q,
|
|
418
|
+
searchIndex: J,
|
|
419
|
+
pageDataEvent: X
|
|
400
420
|
})),
|
|
401
|
-
F.writeFile(O,
|
|
402
|
-
rootDir:
|
|
421
|
+
F.writeFile(O, Ve({
|
|
422
|
+
rootDir: c.rootDir,
|
|
403
423
|
siteConfig: w,
|
|
404
424
|
siteData: T,
|
|
405
425
|
themeModulePath: k,
|
|
@@ -408,17 +428,17 @@ async function Re(e, t = {}) {
|
|
|
408
428
|
F.writeFile(k, te)
|
|
409
429
|
]);
|
|
410
430
|
try {
|
|
411
|
-
let
|
|
412
|
-
await Promise.all([
|
|
431
|
+
let s = e.createViteLogger(), f = new Re(r, "Building bundles..."), p = performance.now();
|
|
432
|
+
await Promise.all([se({
|
|
413
433
|
...t.viteConfig,
|
|
414
434
|
root: n,
|
|
415
435
|
base: x,
|
|
416
436
|
plugins: $({ context: e }),
|
|
417
|
-
customLogger:
|
|
437
|
+
customLogger: s,
|
|
418
438
|
logLevel: "silent",
|
|
419
439
|
build: {
|
|
420
440
|
...t.viteConfig?.build,
|
|
421
|
-
outDir:
|
|
441
|
+
outDir: a,
|
|
422
442
|
manifest: !0,
|
|
423
443
|
emptyOutDir: !0,
|
|
424
444
|
rollupOptions: {
|
|
@@ -426,71 +446,71 @@ async function Re(e, t = {}) {
|
|
|
426
446
|
input: D
|
|
427
447
|
}
|
|
428
448
|
}
|
|
429
|
-
}),
|
|
449
|
+
}), se({
|
|
430
450
|
...t.viteConfig,
|
|
431
451
|
root: n,
|
|
432
452
|
base: x,
|
|
433
453
|
plugins: $({ context: e }),
|
|
434
|
-
customLogger:
|
|
454
|
+
customLogger: s,
|
|
435
455
|
logLevel: "silent",
|
|
436
456
|
build: {
|
|
437
457
|
...t.viteConfig?.build,
|
|
438
|
-
outDir:
|
|
458
|
+
outDir: o,
|
|
439
459
|
ssr: O,
|
|
440
460
|
emptyOutDir: !0
|
|
441
461
|
}
|
|
442
462
|
})]);
|
|
443
|
-
let m = await F.readdir(j.join(
|
|
444
|
-
f.done(`Client (${m.length} chunks) + SSR`), process.env.TYPEDOWN_VERBOSE === "1" && process.stderr.write(`[timing:phase] bundles ${
|
|
463
|
+
let m = await F.readdir(j.join(a, "assets")).catch(() => []), _ = performance.now() - p;
|
|
464
|
+
f.done(`Client (${m.length} chunks) + SSR`), process.env.TYPEDOWN_VERBOSE === "1" && process.stderr.write(`[timing:phase] bundles ${_.toFixed(0)}ms\n`);
|
|
445
465
|
let v = u.map((e) => {
|
|
446
|
-
let t =
|
|
466
|
+
let t = l(e);
|
|
447
467
|
return t === "index" ? "/" : `/${t}`;
|
|
448
468
|
});
|
|
449
|
-
v.push("/"),
|
|
450
|
-
let y = new
|
|
451
|
-
await
|
|
452
|
-
ssrEntryPath: j.join(
|
|
453
|
-
clientOutDir:
|
|
454
|
-
outDir:
|
|
469
|
+
v.push("/"), Ue(C.entries, v);
|
|
470
|
+
let y = new Re(r, "Pre-rendering pages...");
|
|
471
|
+
await Ae({
|
|
472
|
+
ssrEntryPath: j.join(o, "ssr-entry.js"),
|
|
473
|
+
clientOutDir: a,
|
|
474
|
+
outDir: i,
|
|
455
475
|
base: x,
|
|
456
476
|
origin: h,
|
|
457
|
-
lang:
|
|
477
|
+
lang: c.lang,
|
|
458
478
|
pageRoutes: v,
|
|
459
|
-
siteTitle:
|
|
460
|
-
author:
|
|
479
|
+
siteTitle: c.siteTitle,
|
|
480
|
+
author: g,
|
|
461
481
|
progress: y
|
|
462
482
|
}), y.done(`Pre-rendered ${v.length} pages`);
|
|
463
483
|
let b = /* @__PURE__ */ new Map();
|
|
464
484
|
for (let e of d) {
|
|
465
|
-
let t =
|
|
485
|
+
let t = l(e.filepath), n = t === "index" ? "/" : `/${t}`;
|
|
466
486
|
b.set(n, e.fileMetadata.mtimeSecs);
|
|
467
487
|
}
|
|
468
|
-
let
|
|
469
|
-
h !== void 0 && (
|
|
470
|
-
let
|
|
471
|
-
await F.cp(
|
|
472
|
-
let E = j.join(n,
|
|
473
|
-
await F.cp(E,
|
|
488
|
+
let S = we(v, x, h, b), w = [F.writeFile(j.join(i, "sitemap.xml"), S)];
|
|
489
|
+
h !== void 0 && (w.push(F.writeFile(j.join(i, "robots.txt"), Te(h, x))), w.push(F.writeFile(j.join(i, "feed.xml"), Ee(d, x, h, c.siteTitle, c.siteDescription, c.lang))), w.push(F.writeFile(j.join(i, "llms.txt"), De(d, x, h, c.siteTitle, c.siteDescription)))), await Promise.all(w);
|
|
490
|
+
let ee = j.join(a, "assets"), T = j.join(i, "assets");
|
|
491
|
+
await F.cp(ee, T, { recursive: !0 }).catch(() => {}), await He(j.join(n, c.rootDir), i);
|
|
492
|
+
let E = j.join(n, c.publicDir);
|
|
493
|
+
await F.cp(E, i, { recursive: !0 }).catch(() => {});
|
|
474
494
|
} finally {
|
|
475
495
|
await Promise.all([
|
|
476
496
|
F.rm(E, {
|
|
477
497
|
recursive: !0,
|
|
478
498
|
force: !0
|
|
479
499
|
}),
|
|
480
|
-
F.rm(
|
|
500
|
+
F.rm(a, {
|
|
481
501
|
recursive: !0,
|
|
482
502
|
force: !0
|
|
483
503
|
}),
|
|
484
|
-
F.rm(
|
|
504
|
+
F.rm(o, {
|
|
485
505
|
recursive: !0,
|
|
486
506
|
force: !0
|
|
487
507
|
})
|
|
488
508
|
]);
|
|
489
509
|
}
|
|
490
|
-
|
|
510
|
+
r.log(`\nBuild complete. Output: ${i}`);
|
|
491
511
|
}
|
|
492
|
-
function
|
|
493
|
-
let t = `/${e.rootDir}/${
|
|
512
|
+
function Ve(e) {
|
|
513
|
+
let t = `/${e.rootDir}/${C}`, n = JSON.parse(e.siteConfig), r = JSON.parse(e.siteData), i = r.contentTree ?? { entries: [] }, a = _(i.entries ?? [], n.title ?? ""), o = JSON.stringify({
|
|
494
514
|
...r,
|
|
495
515
|
directoryListings: a
|
|
496
516
|
}), s = e.userComponents ?? [], c = s.map((e) => `import ${e.name} from ${JSON.stringify(e.absolutePath)};`).join("\n"), l = s.map((e) => `app.component(${JSON.stringify(e.name)}, ${e.name});`).join("\n");
|
|
@@ -515,31 +535,31 @@ export async function createRenderer() {
|
|
|
515
535
|
}
|
|
516
536
|
`;
|
|
517
537
|
}
|
|
518
|
-
async function
|
|
519
|
-
let
|
|
538
|
+
async function He(t, n) {
|
|
539
|
+
let r = (await F.readdir(t, {
|
|
520
540
|
recursive: !0,
|
|
521
541
|
withFileTypes: !0
|
|
522
|
-
})).filter((
|
|
523
|
-
let r = j.join(
|
|
542
|
+
})).filter((t) => t.isFile() && !e(t.name)).map(async (e) => {
|
|
543
|
+
let r = j.join(e.parentPath, e.name), i = j.relative(t, r), a = j.join(n, i);
|
|
524
544
|
return F.mkdir(j.dirname(a), { recursive: !0 }).then(() => F.copyFile(r, a));
|
|
525
545
|
});
|
|
526
|
-
await Promise.all(
|
|
546
|
+
await Promise.all(r);
|
|
527
547
|
}
|
|
528
|
-
function
|
|
548
|
+
function Ue(e, t, n = "") {
|
|
529
549
|
for (let r of e) {
|
|
530
550
|
if (r.kind !== "dir") continue;
|
|
531
551
|
let e = `${n}/${r.node.name}`;
|
|
532
|
-
|
|
552
|
+
p(r.node) || t.push(c(e)), Ue(r.node.entries, t, e);
|
|
533
553
|
}
|
|
534
554
|
}
|
|
535
555
|
// ../../node_modules/.pnpm/@shikijs+transformers@4.4.3/node_modules/@shikijs/transformers/dist/index.mjs
|
|
536
|
-
var
|
|
556
|
+
var We = /(\s+\/\/)/, Ge = /(?:\/\/|["'#]|;{1,2}|%{1,2}|--)(\s*)$/, Ke = /(?:\/\/|#|;{1,2}|%{1,2}|--)(\s*)$/, qe = [
|
|
537
557
|
[/^(<!--)(.+)(-->)$/, !1],
|
|
538
558
|
[/^(\/\*)(.+)(\*\/)$/, !1],
|
|
539
559
|
[/^(\/\/|["'#]|;{1,2}|%{1,2}|--)(.*)$/, !0],
|
|
540
560
|
[/^(\*)(.+)$/, !0]
|
|
541
561
|
];
|
|
542
|
-
function
|
|
562
|
+
function Je(e, t, n) {
|
|
543
563
|
let r = [];
|
|
544
564
|
for (let i of e) {
|
|
545
565
|
if (n === "v3") {
|
|
@@ -548,8 +568,8 @@ function Ke(e, t, n) {
|
|
|
548
568
|
let n = e.children[0];
|
|
549
569
|
if (n.type !== "text") return e;
|
|
550
570
|
let r = t === i.children.length - 1;
|
|
551
|
-
if (!
|
|
552
|
-
let a = n.value.split(
|
|
571
|
+
if (!B(n.value, r)) return e;
|
|
572
|
+
let a = n.value.split(We);
|
|
553
573
|
if (a.length <= 1) return e;
|
|
554
574
|
let o = [a[0]];
|
|
555
575
|
for (let e = 1; e < a.length; e += 2) o.push(a[e] + (a[e + 1] || ""));
|
|
@@ -570,13 +590,13 @@ function Ke(e, t, n) {
|
|
|
570
590
|
if (a.type !== "element") continue;
|
|
571
591
|
let o = a.children.at(0);
|
|
572
592
|
if (o?.type !== "text") continue;
|
|
573
|
-
let s = n === e.length - 1, c =
|
|
593
|
+
let s = n === e.length - 1, c = B(o.value, s), l;
|
|
574
594
|
if (!c && n > 0 && o.value.trim().startsWith("[!code")) {
|
|
575
595
|
let t = e[n - 1];
|
|
576
596
|
if (t?.type === "element") {
|
|
577
597
|
let n = t.children.at(0);
|
|
578
598
|
if (n?.type === "text" && n.value.includes("//")) {
|
|
579
|
-
let l =
|
|
599
|
+
let l = B(n.value + o.value, s);
|
|
580
600
|
if (l) {
|
|
581
601
|
c = l, r.push({
|
|
582
602
|
info: l,
|
|
@@ -593,7 +613,7 @@ function Ke(e, t, n) {
|
|
|
593
613
|
}
|
|
594
614
|
if (c) {
|
|
595
615
|
if (t && !s && n !== 0) {
|
|
596
|
-
let t =
|
|
616
|
+
let t = Ye(e[n - 1], "{") && Ye(e[n + 1], "}");
|
|
597
617
|
r.push({
|
|
598
618
|
info: c,
|
|
599
619
|
line: i,
|
|
@@ -615,16 +635,16 @@ function Ke(e, t, n) {
|
|
|
615
635
|
}
|
|
616
636
|
return r;
|
|
617
637
|
}
|
|
618
|
-
function
|
|
638
|
+
function Ye(e, t) {
|
|
619
639
|
if (e.type !== "element") return !1;
|
|
620
640
|
let n = e.children[0];
|
|
621
641
|
return n.type === "text" && n.value.trim() === t;
|
|
622
642
|
}
|
|
623
|
-
function
|
|
643
|
+
function B(e, t) {
|
|
624
644
|
let n = e.trimStart(), r = e.length - n.length;
|
|
625
645
|
n = n.trimEnd();
|
|
626
646
|
let i = e.length - n.length - r;
|
|
627
|
-
for (let [e, a] of
|
|
647
|
+
for (let [e, a] of qe) {
|
|
628
648
|
if (a && !t) continue;
|
|
629
649
|
let o = e.exec(n);
|
|
630
650
|
if (o) return [
|
|
@@ -634,22 +654,22 @@ function z(e, t) {
|
|
|
634
654
|
];
|
|
635
655
|
}
|
|
636
656
|
}
|
|
637
|
-
function
|
|
638
|
-
let t = e.match(
|
|
657
|
+
function Xe(e) {
|
|
658
|
+
let t = e.match(Ge);
|
|
639
659
|
return t && t[1].trim().length === 0 ? e.slice(0, t.index) : e;
|
|
640
660
|
}
|
|
641
|
-
function
|
|
642
|
-
let t = e.match(
|
|
661
|
+
function Ze(e) {
|
|
662
|
+
let t = e.match(Ke);
|
|
643
663
|
return t && t[1].trim().length === 0 ? e.slice(0, t.index).trimEnd() : e;
|
|
644
664
|
}
|
|
645
|
-
function
|
|
665
|
+
function Qe(e, t, n, r) {
|
|
646
666
|
return r ??= "v3", {
|
|
647
667
|
name: e,
|
|
648
668
|
code(e) {
|
|
649
669
|
let i = e.children.filter((e) => e.type === "element"), a = [];
|
|
650
670
|
e.data ??= {};
|
|
651
671
|
let o = e.data;
|
|
652
|
-
o._shiki_notation ??=
|
|
672
|
+
o._shiki_notation ??= Je(i, ["jsx", "tsx"].includes(this.options.lang), r);
|
|
653
673
|
let s = o._shiki_notation;
|
|
654
674
|
for (let e of s) {
|
|
655
675
|
if (e.info[1].length === 0) continue;
|
|
@@ -657,7 +677,7 @@ function Xe(e, t, n, r) {
|
|
|
657
677
|
e.isLineCommentOnly && r !== "v1" && o++;
|
|
658
678
|
let s = !1;
|
|
659
679
|
if (e.info[1] = e.info[1].replace(t, (...t) => n.call(this, t, e.line, e.token, i, o) ? (s = !0, "") : t[0]), !s) continue;
|
|
660
|
-
r === "v1" ? e.info[1] =
|
|
680
|
+
r === "v1" ? e.info[1] = Xe(e.info[1]) : r === "v3" && (e.info[1] = Ze(e.info[1]));
|
|
661
681
|
let c = e.info[1].trim().length === 0;
|
|
662
682
|
if (c && (e.info[1] = ""), c && e.isLineCommentOnly) a.push(e.line);
|
|
663
683
|
else if (c && e.isJsxStyle) e.line.children.splice(e.line.children.indexOf(e.token) - 1, 3);
|
|
@@ -682,44 +702,44 @@ function Xe(e, t, n, r) {
|
|
|
682
702
|
}
|
|
683
703
|
};
|
|
684
704
|
}
|
|
685
|
-
var
|
|
686
|
-
function
|
|
705
|
+
var $e = /\{([\d,-]+)\}/;
|
|
706
|
+
function et(e) {
|
|
687
707
|
if (!e) return null;
|
|
688
|
-
let t = e.match(
|
|
708
|
+
let t = e.match($e);
|
|
689
709
|
return t ? t[1].split(",").flatMap((e) => {
|
|
690
710
|
let t = e.split("-").map((e) => Number.parseInt(e, 10));
|
|
691
711
|
return t.length === 1 ? [t[0]] : Array.from({ length: t[1] - t[0] + 1 }, (e, n) => t[0] + n);
|
|
692
712
|
}) : null;
|
|
693
713
|
}
|
|
694
|
-
var
|
|
695
|
-
function
|
|
714
|
+
var tt = Symbol("highlighted-lines");
|
|
715
|
+
function nt(e = {}) {
|
|
696
716
|
let { className: t = "highlighted", zeroIndexed: n = !1 } = e;
|
|
697
717
|
return {
|
|
698
718
|
name: "@shikijs/transformers:meta-highlight",
|
|
699
719
|
line(e, r) {
|
|
700
720
|
if (!this.options.meta?.__raw) return;
|
|
701
721
|
let i = this.meta;
|
|
702
|
-
i[
|
|
703
|
-
let a = i[
|
|
722
|
+
i[tt] ??= et(this.options.meta.__raw);
|
|
723
|
+
let a = i[tt] ?? [], o = n ? r - 1 : r;
|
|
704
724
|
return a.includes(o) && this.addClassToHast(e, t), e;
|
|
705
725
|
}
|
|
706
726
|
};
|
|
707
727
|
}
|
|
708
|
-
var
|
|
709
|
-
function
|
|
710
|
-
return e.replace(
|
|
728
|
+
var rt = /[.*+?^${}()|[\]\\]/g;
|
|
729
|
+
function it(e) {
|
|
730
|
+
return e.replace(rt, "\\$&");
|
|
711
731
|
}
|
|
712
|
-
function
|
|
732
|
+
function V(e = {}, t = "@shikijs/transformers:notation-map") {
|
|
713
733
|
let { classMap: n = {}, classActivePre: r = void 0, classActiveCode: i = void 0 } = e;
|
|
714
|
-
return
|
|
734
|
+
return Qe(t, RegExp(`#?\\s*\\[!code (${Object.keys(n).map(it).join("|")})(:\\d+)?\\]`, "gi"), function([e, t, a = ":1"], o, s, c, l) {
|
|
715
735
|
let u = Number.parseInt(a.slice(1), 10);
|
|
716
736
|
for (let e = l; e < Math.min(l + u, c.length); e++) this.addClassToHast(c[e], n[t]);
|
|
717
737
|
return r && this.addClassToHast(this.pre, r), i && this.addClassToHast(this.code, i), !0;
|
|
718
738
|
}, e.matchAlgorithm);
|
|
719
739
|
}
|
|
720
|
-
function
|
|
740
|
+
function at(e = {}) {
|
|
721
741
|
let { classLineAdd: t = "diff add", classLineRemove: n = "diff remove", classActivePre: r = "has-diff", classActiveCode: i } = e;
|
|
722
|
-
return
|
|
742
|
+
return V({
|
|
723
743
|
classMap: {
|
|
724
744
|
"++": t,
|
|
725
745
|
"--": n
|
|
@@ -729,31 +749,31 @@ function rt(e = {}) {
|
|
|
729
749
|
matchAlgorithm: e.matchAlgorithm
|
|
730
750
|
}, "@shikijs/transformers:notation-diff");
|
|
731
751
|
}
|
|
732
|
-
function
|
|
752
|
+
function ot(e = {}) {
|
|
733
753
|
let { classMap: t = {
|
|
734
754
|
error: ["highlighted", "error"],
|
|
735
755
|
warning: ["highlighted", "warning"],
|
|
736
756
|
info: ["highlighted", "info"]
|
|
737
757
|
}, classActivePre: n = "has-highlighted", classActiveCode: r } = e;
|
|
738
|
-
return
|
|
758
|
+
return V({
|
|
739
759
|
classMap: t,
|
|
740
760
|
classActivePre: n,
|
|
741
761
|
classActiveCode: r,
|
|
742
762
|
matchAlgorithm: e.matchAlgorithm
|
|
743
763
|
}, "@shikijs/transformers:notation-error-level");
|
|
744
764
|
}
|
|
745
|
-
function
|
|
765
|
+
function st(e = {}) {
|
|
746
766
|
let { classActiveLine: t = "focused", classActivePre: n = "has-focused", classActiveCode: r } = e;
|
|
747
|
-
return
|
|
767
|
+
return V({
|
|
748
768
|
classMap: { focus: t },
|
|
749
769
|
classActivePre: n,
|
|
750
770
|
classActiveCode: r,
|
|
751
771
|
matchAlgorithm: e.matchAlgorithm
|
|
752
772
|
}, "@shikijs/transformers:notation-focus");
|
|
753
773
|
}
|
|
754
|
-
function
|
|
774
|
+
function ct(e = {}) {
|
|
755
775
|
let { classActiveLine: t = "highlighted", classActivePre: n = "has-highlighted", classActiveCode: r } = e;
|
|
756
|
-
return
|
|
776
|
+
return V({
|
|
757
777
|
classMap: {
|
|
758
778
|
highlight: t,
|
|
759
779
|
hl: t
|
|
@@ -764,41 +784,41 @@ function ot(e = {}) {
|
|
|
764
784
|
}, "@shikijs/transformers:notation-highlight");
|
|
765
785
|
}
|
|
766
786
|
// src/node/lib/render/highlight/language.ts
|
|
767
|
-
var
|
|
787
|
+
var lt = [
|
|
768
788
|
"shellscript",
|
|
769
789
|
"shell",
|
|
770
790
|
"bash",
|
|
771
791
|
"sh",
|
|
772
792
|
"zsh"
|
|
773
793
|
];
|
|
774
|
-
function ct(e) {
|
|
775
|
-
return st.includes(e);
|
|
776
|
-
}
|
|
777
|
-
var lt = /^[a-zA-Z0-9-_]+/;
|
|
778
794
|
function ut(e) {
|
|
779
|
-
return lt.
|
|
795
|
+
return lt.includes(e);
|
|
796
|
+
}
|
|
797
|
+
var dt = /^[a-zA-Z0-9-_]+/;
|
|
798
|
+
function ft(e) {
|
|
799
|
+
return dt.exec(e)?.[0] || "";
|
|
780
800
|
}
|
|
781
801
|
// src/node/lib/render/highlight/index.ts
|
|
782
|
-
var
|
|
802
|
+
var pt = new FinalizationRegistry((e) => {
|
|
783
803
|
e();
|
|
784
|
-
}),
|
|
804
|
+
}), H = {
|
|
785
805
|
light: "github-light",
|
|
786
806
|
dark: "github-dark"
|
|
787
807
|
};
|
|
788
|
-
async function
|
|
789
|
-
let e = await
|
|
790
|
-
themes: [
|
|
808
|
+
async function mt() {
|
|
809
|
+
let e = await be({
|
|
810
|
+
themes: [H.light, H.dark],
|
|
791
811
|
langs: []
|
|
792
812
|
}), t = [
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
813
|
+
nt(),
|
|
814
|
+
at(),
|
|
815
|
+
st({
|
|
796
816
|
classActiveLine: "has-focus",
|
|
797
817
|
classActivePre: "has-focused-lines"
|
|
798
818
|
}),
|
|
819
|
+
ct(),
|
|
799
820
|
ot(),
|
|
800
|
-
|
|
801
|
-
pt(),
|
|
821
|
+
ht(),
|
|
802
822
|
{
|
|
803
823
|
name: "typedown:add-dir",
|
|
804
824
|
pre(e) {
|
|
@@ -807,19 +827,19 @@ async function ft() {
|
|
|
807
827
|
}
|
|
808
828
|
], n = new Set(e.getLoadedLanguages());
|
|
809
829
|
async function r(r, i, a, o) {
|
|
810
|
-
let s =
|
|
830
|
+
let s = ft(i);
|
|
811
831
|
if (s) {
|
|
812
832
|
let e = i;
|
|
813
833
|
i = s.toLowerCase(), a = e.slice(i.length).replace(/(?<!=)\{/g, " {") + " " + a, a = a.trim().replace(/\s+/g, " ");
|
|
814
834
|
}
|
|
815
835
|
i ||= "txt";
|
|
816
836
|
try {
|
|
817
|
-
!
|
|
837
|
+
!Se(i) && !n.has(i) && (await e.loadLanguage(i), n.add(i));
|
|
818
838
|
} catch {
|
|
819
|
-
|
|
839
|
+
A.warn(`\nThe language '${i}' is not loaded, falling back to 'txt' for syntax highlighting.`), i = "txt";
|
|
820
840
|
}
|
|
821
841
|
r = r.trimEnd();
|
|
822
|
-
let c =
|
|
842
|
+
let c = xe(r, i, e);
|
|
823
843
|
return await e.loadLanguage(...c), e.codeToHtml(r, {
|
|
824
844
|
lang: i,
|
|
825
845
|
transformers: [
|
|
@@ -840,10 +860,10 @@ async function ft() {
|
|
|
840
860
|
});
|
|
841
861
|
}
|
|
842
862
|
},
|
|
843
|
-
...o === void 0 ? [] : [
|
|
863
|
+
...o === void 0 ? [] : [gt(o)]
|
|
844
864
|
],
|
|
845
865
|
meta: { __raw: a },
|
|
846
|
-
themes:
|
|
866
|
+
themes: H,
|
|
847
867
|
defaultColor: !1,
|
|
848
868
|
colorReplacements: {
|
|
849
869
|
"github-light": {
|
|
@@ -868,13 +888,13 @@ async function ft() {
|
|
|
868
888
|
}
|
|
869
889
|
});
|
|
870
890
|
}
|
|
871
|
-
return
|
|
891
|
+
return pt.register(r, () => e.dispose()), r;
|
|
872
892
|
}
|
|
873
|
-
function
|
|
893
|
+
function ht() {
|
|
874
894
|
return {
|
|
875
895
|
name: "typedown:disable-shell-symbol-select",
|
|
876
896
|
tokens(e) {
|
|
877
|
-
if (
|
|
897
|
+
if (ut(this.options.lang)) for (let t of e) {
|
|
878
898
|
if (t.length < 2) continue;
|
|
879
899
|
let e = t[0].content.trim();
|
|
880
900
|
(e === "$" || e === ">") && t[1].content[0] === " " && (t[0].content = e + " ", t[0].htmlStyle ??= {}, t[0].htmlStyle["user-select"] = "none", t[0].htmlStyle["-webkit-user-select"] = "none", t[1].content = t[1].content.slice(1));
|
|
@@ -882,7 +902,7 @@ function pt() {
|
|
|
882
902
|
}
|
|
883
903
|
};
|
|
884
904
|
}
|
|
885
|
-
function
|
|
905
|
+
function gt(e) {
|
|
886
906
|
return {
|
|
887
907
|
name: "typedown:line-numbers",
|
|
888
908
|
code(t) {
|
|
@@ -914,23 +934,23 @@ function mt(e) {
|
|
|
914
934
|
};
|
|
915
935
|
}
|
|
916
936
|
// src/node/lib/render/postprocess.ts
|
|
917
|
-
var
|
|
918
|
-
async function
|
|
919
|
-
return e = await
|
|
937
|
+
var _t;
|
|
938
|
+
async function vt(e) {
|
|
939
|
+
return e = await xt(e), e = Dt(e), e;
|
|
920
940
|
}
|
|
921
|
-
function
|
|
922
|
-
return
|
|
941
|
+
function yt() {
|
|
942
|
+
return _t ||= mt(), _t;
|
|
923
943
|
}
|
|
924
|
-
var
|
|
925
|
-
function
|
|
944
|
+
var bt = /<pre class="td-code-placeholder"([^>]*)><code>([\s\S]*?)<\/code><\/pre>/g;
|
|
945
|
+
function U(e, t) {
|
|
926
946
|
return e.match(RegExp(`${t}="([^"]*)"`))?.[1];
|
|
927
947
|
}
|
|
928
|
-
async function
|
|
929
|
-
let t = await
|
|
948
|
+
async function xt(e) {
|
|
949
|
+
let t = await yt(), n = [...e.matchAll(bt)];
|
|
930
950
|
if (n.length === 0) return e;
|
|
931
951
|
let r = await Promise.all(n.map(async (e) => {
|
|
932
|
-
let n = e[1], r =
|
|
933
|
-
return
|
|
952
|
+
let n = e[1], r = U(n, "data-lang") ?? "", i = U(n, "data-meta") ?? "", a = U(n, "data-title"), o = U(n, "data-line-numbers"), s = g(e[2]);
|
|
953
|
+
return wt(await t(s, r, i, o === void 0 ? void 0 : parseInt(o) || 1), r, {
|
|
934
954
|
title: a,
|
|
935
955
|
lineNumbers: o
|
|
936
956
|
});
|
|
@@ -941,7 +961,7 @@ async function yt(e) {
|
|
|
941
961
|
}
|
|
942
962
|
return i;
|
|
943
963
|
}
|
|
944
|
-
var
|
|
964
|
+
var St = {
|
|
945
965
|
typescript: "TypeScript",
|
|
946
966
|
javascript: "JavaScript",
|
|
947
967
|
tsx: "TSX",
|
|
@@ -989,38 +1009,38 @@ var bt = {
|
|
|
989
1009
|
scala: "Scala",
|
|
990
1010
|
txt: "Text"
|
|
991
1011
|
};
|
|
992
|
-
function
|
|
993
|
-
return
|
|
1012
|
+
function Ct(e) {
|
|
1013
|
+
return St[e.toLowerCase()] ?? e;
|
|
994
1014
|
}
|
|
995
|
-
function
|
|
1015
|
+
function wt(e, t, n) {
|
|
996
1016
|
t ||= "txt";
|
|
997
|
-
let r =
|
|
1017
|
+
let r = Ct(t), i = ["td-code-block", "language-" + t];
|
|
998
1018
|
n.title && i.push("has-title"), n.lineNumbers !== void 0 && i.push("line-numbers-mode");
|
|
999
1019
|
let a = `<figure class="${i.join(" ")}">`;
|
|
1000
|
-
return a += "<figcaption class=\"td-code-header\">", a += "<span class=\"td-code-left\">", a += `<span class="td-code-lang">${
|
|
1001
|
-
}
|
|
1002
|
-
var Ct = /<span class="td-math-inline">([\s\S]*?)<\/span>/g, wt = /<div class="td-math-block">([\s\S]*?)<\/div>/g;
|
|
1003
|
-
function Tt(e) {
|
|
1004
|
-
return e = e.replace(Ct, (e, t) => Ot(t, !1)), e = e.replace(wt, (e, t) => Ot(t, !0)), e;
|
|
1020
|
+
return a += "<figcaption class=\"td-code-header\">", a += "<span class=\"td-code-left\">", a += `<span class="td-code-lang">${h(r)}</span>`, n.title && (a += `<span class="td-code-label">${h(n.title)}</span>`), a += "</span>", a += "<span class=\"td-code-actions\">", a += "<button type=\"button\" aria-label=\"Copy code\" data-copied=\"Copied\" class=\"td-code-copy\">", a += "<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\"></rect><path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\"></path></svg>", a += "<span class=\"td-code-copy-text\">Copy</span>", a += "</button>", a += "</span>", a += "</figcaption>", a += e, a += "</figure>", a;
|
|
1005
1021
|
}
|
|
1006
|
-
var
|
|
1022
|
+
var Tt = /<span class="td-math-inline">([\s\S]*?)<\/span>/g, Et = /<div class="td-math-block">([\s\S]*?)<\/div>/g;
|
|
1007
1023
|
function Dt(e) {
|
|
1024
|
+
return e = e.replace(Tt, (e, t) => At(t, !1)), e = e.replace(Et, (e, t) => At(t, !0)), e;
|
|
1025
|
+
}
|
|
1026
|
+
var Ot = /`([^`]+)`|\$([^$]+)\$/g;
|
|
1027
|
+
function kt(e) {
|
|
1008
1028
|
let t = 0, n = "";
|
|
1009
|
-
for (let r of e.matchAll(
|
|
1010
|
-
if (n +=
|
|
1029
|
+
for (let r of e.matchAll(Ot)) {
|
|
1030
|
+
if (n += h(e.slice(t, r.index)), r[1] !== void 0) n += `<code>${h(r[1])}</code>`;
|
|
1011
1031
|
else if (r[2] !== void 0) try {
|
|
1012
|
-
n +=
|
|
1032
|
+
n += k.renderToString(r[2], { throwOnError: !1 });
|
|
1013
1033
|
} catch {
|
|
1014
|
-
n +=
|
|
1034
|
+
n += h(r[0]);
|
|
1015
1035
|
}
|
|
1016
1036
|
t = r.index + r[0].length;
|
|
1017
1037
|
}
|
|
1018
|
-
return n +=
|
|
1038
|
+
return n += h(e.slice(t)), n;
|
|
1019
1039
|
}
|
|
1020
|
-
function
|
|
1040
|
+
function At(e, t) {
|
|
1021
1041
|
let n = t ? "div" : "span";
|
|
1022
1042
|
try {
|
|
1023
|
-
return
|
|
1043
|
+
return k.renderToString(g(e), {
|
|
1024
1044
|
throwOnError: !1,
|
|
1025
1045
|
displayMode: t
|
|
1026
1046
|
});
|
|
@@ -1029,25 +1049,25 @@ function Ot(e, t) {
|
|
|
1029
1049
|
}
|
|
1030
1050
|
}
|
|
1031
1051
|
// src/node/lib/render/vue.ts
|
|
1032
|
-
async function
|
|
1033
|
-
let r = t.title || t.label || (
|
|
1052
|
+
async function W(e, t, n) {
|
|
1053
|
+
let r = t.title || t.label || (m(n) ? w(n, (await e.getConfig()).siteTitle) : T(n));
|
|
1034
1054
|
return {
|
|
1035
1055
|
schema: t.schema,
|
|
1036
1056
|
schemaLabel: t.schemaLabel,
|
|
1037
1057
|
label: t.label,
|
|
1038
1058
|
icon: t.icon,
|
|
1039
1059
|
frontmatter: t.header ?? {},
|
|
1040
|
-
headings:
|
|
1060
|
+
headings: Mt(t.headings),
|
|
1041
1061
|
title: r,
|
|
1042
|
-
titleHtml:
|
|
1062
|
+
titleHtml: kt(r),
|
|
1043
1063
|
filepath: n,
|
|
1044
1064
|
fileMetadata: t.fileMetadata,
|
|
1045
1065
|
seoMetadata: t.seoMetadata,
|
|
1046
1066
|
excerpt: t.excerpt
|
|
1047
1067
|
};
|
|
1048
1068
|
}
|
|
1049
|
-
async function
|
|
1050
|
-
let r = await
|
|
1069
|
+
async function jt(e, t, n) {
|
|
1070
|
+
let r = await vt(t.content), i = await W(e, t, n), a = JSON.stringify(`@typedown/pages?resource=${encodeURIComponent(n)}`);
|
|
1051
1071
|
return {
|
|
1052
1072
|
vueSrc: [
|
|
1053
1073
|
"<script>",
|
|
@@ -1059,12 +1079,12 @@ async function kt(e, t, n) {
|
|
|
1059
1079
|
`import { pageData } from ${a}`,
|
|
1060
1080
|
"useRouter().route.data = pageData",
|
|
1061
1081
|
"<\/script>",
|
|
1062
|
-
`<template><div class="typedown-content">\n${
|
|
1082
|
+
`<template><div class="typedown-content">\n${Nt(r)}\n</div></template>`
|
|
1063
1083
|
].join("\n"),
|
|
1064
1084
|
pageData: i
|
|
1065
1085
|
};
|
|
1066
1086
|
}
|
|
1067
|
-
function
|
|
1087
|
+
function Mt(e) {
|
|
1068
1088
|
let t = [], n = [];
|
|
1069
1089
|
for (let r of e) {
|
|
1070
1090
|
let e = {
|
|
@@ -1080,15 +1100,15 @@ function At(e) {
|
|
|
1080
1100
|
}
|
|
1081
1101
|
return t;
|
|
1082
1102
|
}
|
|
1083
|
-
function
|
|
1103
|
+
function Nt(e) {
|
|
1084
1104
|
return e.replaceAll("{{", "{{").replaceAll("}}", "}}");
|
|
1085
1105
|
}
|
|
1086
1106
|
// src/node/plugin/vite/constants.ts
|
|
1087
|
-
var
|
|
1088
|
-
|
|
1089
|
-
var
|
|
1107
|
+
var Pt = "@typedown/app", Ft = "\0@typedown/app", G = "@typedown/pages", It = "\0" + G;
|
|
1108
|
+
G + "";
|
|
1109
|
+
var K = "\0@typedown/pages?resource=", q = "@typedown/site-data", Lt = "\0@typedown/site-data", J = "@typedown/search-index", Rt = "\0@typedown/search-index", Y = "@typedown/theme", zt = "\0@typedown/theme", X = "typedown:page-data";
|
|
1090
1110
|
// src/node/plugin/vite/virtual/utils.ts
|
|
1091
|
-
function
|
|
1111
|
+
function Z(e, t) {
|
|
1092
1112
|
let n = e.moduleGraph.getModuleById(t);
|
|
1093
1113
|
if (n) {
|
|
1094
1114
|
e.moduleGraph.invalidateModule(n);
|
|
@@ -1104,14 +1124,14 @@ function X(e, t) {
|
|
|
1104
1124
|
}
|
|
1105
1125
|
}
|
|
1106
1126
|
// src/node/plugin/vite/virtual/app.ts
|
|
1107
|
-
var
|
|
1127
|
+
var Bt = class {
|
|
1108
1128
|
mountPath;
|
|
1109
1129
|
constructor(e = "") {
|
|
1110
1130
|
this.mountPath = e;
|
|
1111
1131
|
}
|
|
1112
1132
|
async load(e) {
|
|
1113
|
-
let t = await (await e.getTdContext()).getConfig(), n = await
|
|
1114
|
-
return
|
|
1133
|
+
let t = await (await e.getTdContext()).getConfig(), n = await R(t.components, e.root);
|
|
1134
|
+
return Pe({
|
|
1115
1135
|
rootDir: t.rootDir,
|
|
1116
1136
|
mountPath: this.mountPath,
|
|
1117
1137
|
basePath: t.basePath,
|
|
@@ -1125,17 +1145,17 @@ var Rt = class {
|
|
|
1125
1145
|
nav: t.nav,
|
|
1126
1146
|
userComponents: n
|
|
1127
1147
|
}, {
|
|
1128
|
-
theme:
|
|
1129
|
-
pages:
|
|
1130
|
-
siteData:
|
|
1131
|
-
searchIndex:
|
|
1132
|
-
pageDataEvent:
|
|
1148
|
+
theme: Y,
|
|
1149
|
+
pages: G,
|
|
1150
|
+
siteData: q,
|
|
1151
|
+
searchIndex: J,
|
|
1152
|
+
pageDataEvent: X
|
|
1133
1153
|
});
|
|
1134
1154
|
}
|
|
1135
1155
|
invalidate(e) {
|
|
1136
|
-
|
|
1156
|
+
Z(e, Ft);
|
|
1137
1157
|
}
|
|
1138
|
-
},
|
|
1158
|
+
}, Vt = class {
|
|
1139
1159
|
mountPath;
|
|
1140
1160
|
constructor(e = "") {
|
|
1141
1161
|
this.mountPath = e;
|
|
@@ -1148,21 +1168,21 @@ var Rt = class {
|
|
|
1148
1168
|
if (e.startsWith("@typedown/pages?resource=")) return "\0" + e;
|
|
1149
1169
|
}
|
|
1150
1170
|
isPageDataModule(e) {
|
|
1151
|
-
return e.startsWith(
|
|
1171
|
+
return e.startsWith(K);
|
|
1152
1172
|
}
|
|
1153
1173
|
async loadPageData(e, t) {
|
|
1154
|
-
let n = decodeURIComponent(e.slice(
|
|
1174
|
+
let n = decodeURIComponent(e.slice(K.length)), r = await W(t, await t.getFile(n), n);
|
|
1155
1175
|
return `export const pageData = ${JSON.stringify(r)}`;
|
|
1156
1176
|
}
|
|
1157
1177
|
invalidatePageData(e, t) {
|
|
1158
|
-
|
|
1178
|
+
Z(e, K + encodeURIComponent(t));
|
|
1159
1179
|
}
|
|
1160
1180
|
sendPageData(e, t, n) {
|
|
1161
1181
|
t.getFile(n).then(async (r) => {
|
|
1162
|
-
let i = await
|
|
1182
|
+
let i = await W(t, r, n);
|
|
1163
1183
|
e.hot.send({
|
|
1164
1184
|
type: "custom",
|
|
1165
|
-
event:
|
|
1185
|
+
event: X,
|
|
1166
1186
|
data: {
|
|
1167
1187
|
filepath: n,
|
|
1168
1188
|
pageData: i
|
|
@@ -1173,62 +1193,62 @@ var Rt = class {
|
|
|
1173
1193
|
});
|
|
1174
1194
|
}
|
|
1175
1195
|
invalidate(e) {
|
|
1176
|
-
|
|
1196
|
+
Z(e, It);
|
|
1177
1197
|
}
|
|
1178
|
-
},
|
|
1198
|
+
}, Ht = class {
|
|
1179
1199
|
async load(e) {
|
|
1180
|
-
return
|
|
1200
|
+
return Fe((await (await e.getTdContext()).getConfig()).layout ?? void 0, e.root);
|
|
1181
1201
|
}
|
|
1182
1202
|
invalidate(e) {
|
|
1183
|
-
|
|
1203
|
+
Z(e, zt);
|
|
1184
1204
|
}
|
|
1185
|
-
},
|
|
1205
|
+
}, Ut = "\0@typedown/site-data", Wt = {
|
|
1186
1206
|
ready: !1,
|
|
1187
1207
|
contentTree: { entries: [] },
|
|
1188
1208
|
schemas: {},
|
|
1189
1209
|
directoryListings: {}
|
|
1190
|
-
},
|
|
1210
|
+
}, Gt = class {
|
|
1191
1211
|
data;
|
|
1192
1212
|
scan(e) {
|
|
1193
|
-
let t =
|
|
1213
|
+
let t = me("**/*.td", {
|
|
1194
1214
|
cwd: e,
|
|
1195
1215
|
exclude: (e) => e.startsWith("_")
|
|
1196
1216
|
}).map((e) => ({
|
|
1197
1217
|
filepath: e,
|
|
1198
|
-
label:
|
|
1218
|
+
label: T(e),
|
|
1199
1219
|
header: {}
|
|
1200
|
-
})), n =
|
|
1220
|
+
})), n = v(t);
|
|
1201
1221
|
this.data = {
|
|
1202
1222
|
contentTree: n,
|
|
1203
1223
|
schemas: {},
|
|
1204
|
-
directoryListings:
|
|
1224
|
+
directoryListings: _(n.entries, "")
|
|
1205
1225
|
};
|
|
1206
1226
|
}
|
|
1207
1227
|
load(e) {
|
|
1208
1228
|
let t = this.data ? {
|
|
1209
1229
|
ready: !0,
|
|
1210
1230
|
...this.data
|
|
1211
|
-
} :
|
|
1231
|
+
} : Wt;
|
|
1212
1232
|
return `export default ${JSON.stringify(t)}`;
|
|
1213
1233
|
}
|
|
1214
1234
|
clear() {
|
|
1215
1235
|
this.data = void 0;
|
|
1216
1236
|
}
|
|
1217
|
-
fetch =
|
|
1218
|
-
|
|
1237
|
+
fetch = x((e, t) => {
|
|
1238
|
+
Kt(e).then((e) => {
|
|
1219
1239
|
this.data = e, t && this.invalidate(t);
|
|
1220
1240
|
}).catch((e) => {
|
|
1221
1241
|
console.error("[typedown] Failed to fetch site data:", e instanceof Error ? e.message : e);
|
|
1222
1242
|
});
|
|
1223
1243
|
}, 200);
|
|
1224
1244
|
async fetchSync(e) {
|
|
1225
|
-
this.data = await
|
|
1245
|
+
this.data = await Kt(e);
|
|
1226
1246
|
}
|
|
1227
1247
|
invalidate(e) {
|
|
1228
|
-
|
|
1248
|
+
Z(e, Ut);
|
|
1229
1249
|
}
|
|
1230
1250
|
};
|
|
1231
|
-
async function
|
|
1251
|
+
async function Kt(e) {
|
|
1232
1252
|
let [t, n, r] = await Promise.all([
|
|
1233
1253
|
e.getConfig(),
|
|
1234
1254
|
e.listSidebar(),
|
|
@@ -1236,20 +1256,20 @@ async function Wt(e) {
|
|
|
1236
1256
|
]), i = await Promise.all(r.map(async (t) => [t, (await e.getSchema(t)).properties])), a = Object.fromEntries(i), o = n.map((e) => ({
|
|
1237
1257
|
...e,
|
|
1238
1258
|
header: {}
|
|
1239
|
-
})), s =
|
|
1259
|
+
})), s = v(o);
|
|
1240
1260
|
return {
|
|
1241
1261
|
contentTree: s,
|
|
1242
1262
|
schemas: a,
|
|
1243
|
-
directoryListings:
|
|
1263
|
+
directoryListings: _(s.entries, t.siteTitle)
|
|
1244
1264
|
};
|
|
1245
1265
|
}
|
|
1246
1266
|
// src/node/lib/search-indexer/index.ts
|
|
1247
|
-
var
|
|
1267
|
+
var qt = class {
|
|
1248
1268
|
index;
|
|
1249
1269
|
constructor() {
|
|
1250
|
-
this.index = new
|
|
1251
|
-
fields:
|
|
1252
|
-
storeFields:
|
|
1270
|
+
this.index = new ie({
|
|
1271
|
+
fields: S,
|
|
1272
|
+
storeFields: b
|
|
1253
1273
|
});
|
|
1254
1274
|
}
|
|
1255
1275
|
addAll(e) {
|
|
@@ -1267,20 +1287,20 @@ var Gt = class {
|
|
|
1267
1287
|
}
|
|
1268
1288
|
};
|
|
1269
1289
|
// src/node/lib/search-indexer/scan.ts
|
|
1270
|
-
function
|
|
1271
|
-
let n =
|
|
1290
|
+
function Jt(e, t) {
|
|
1291
|
+
let n = Qt(e), r = [];
|
|
1272
1292
|
for (let t of n) {
|
|
1273
|
-
let n =
|
|
1293
|
+
let n = Zt(e, t);
|
|
1274
1294
|
n && r.push(n);
|
|
1275
1295
|
}
|
|
1276
1296
|
t.addAll(r);
|
|
1277
1297
|
}
|
|
1278
|
-
function
|
|
1279
|
-
let i =
|
|
1298
|
+
function Yt(e, n, r) {
|
|
1299
|
+
let i = Zt(e, M(e, n));
|
|
1280
1300
|
i ? r.addPage(i) : r.discardPage(t(n));
|
|
1281
1301
|
}
|
|
1282
|
-
function
|
|
1283
|
-
let n =
|
|
1302
|
+
function Xt(e, t) {
|
|
1303
|
+
let n = T(e);
|
|
1284
1304
|
if (!t.startsWith("---")) return {
|
|
1285
1305
|
title: n,
|
|
1286
1306
|
body: t
|
|
@@ -1296,54 +1316,54 @@ function Jt(e, t) {
|
|
|
1296
1316
|
body: a
|
|
1297
1317
|
};
|
|
1298
1318
|
}
|
|
1299
|
-
function
|
|
1319
|
+
function Zt(e, n) {
|
|
1300
1320
|
let r;
|
|
1301
1321
|
try {
|
|
1302
|
-
r =
|
|
1322
|
+
r = he(n, "utf-8");
|
|
1303
1323
|
} catch {
|
|
1304
1324
|
return;
|
|
1305
1325
|
}
|
|
1306
1326
|
if (!r.trim()) return;
|
|
1307
|
-
let i = n.slice(e.length + 1), { title: a, body: o } =
|
|
1327
|
+
let i = n.slice(e.length + 1), { title: a, body: o } = Xt(i, r);
|
|
1308
1328
|
return {
|
|
1309
1329
|
id: t(i),
|
|
1310
1330
|
title: a,
|
|
1311
1331
|
text: `${a}\n${o}`
|
|
1312
1332
|
};
|
|
1313
1333
|
}
|
|
1314
|
-
function
|
|
1315
|
-
return
|
|
1334
|
+
function Qt(e) {
|
|
1335
|
+
return me("**/*.td", {
|
|
1316
1336
|
cwd: e,
|
|
1317
1337
|
exclude: (e) => e.startsWith("_")
|
|
1318
1338
|
}).map((t) => M(e, t));
|
|
1319
1339
|
}
|
|
1320
1340
|
// src/node/plugin/vite/virtual/search-index.ts
|
|
1321
|
-
var
|
|
1322
|
-
indexer = new
|
|
1341
|
+
var $t = "\0@typedown/search-index", en = class {
|
|
1342
|
+
indexer = new qt();
|
|
1323
1343
|
load(e) {
|
|
1324
1344
|
return `export default ${JSON.stringify(this.indexer.serialize())}`;
|
|
1325
1345
|
}
|
|
1326
1346
|
index(e) {
|
|
1327
|
-
|
|
1347
|
+
Jt(e, this.indexer);
|
|
1328
1348
|
}
|
|
1329
1349
|
reindex(e, t) {
|
|
1330
|
-
|
|
1350
|
+
Yt(e, t, this.indexer);
|
|
1331
1351
|
}
|
|
1332
1352
|
invalidate(e) {
|
|
1333
|
-
|
|
1353
|
+
Z(e, $t);
|
|
1334
1354
|
}
|
|
1335
|
-
},
|
|
1336
|
-
function
|
|
1355
|
+
}, tn = _e(import.meta.url);
|
|
1356
|
+
function nn() {
|
|
1337
1357
|
return [{
|
|
1338
1358
|
find: "vue/server-renderer",
|
|
1339
|
-
replacement:
|
|
1359
|
+
replacement: tn.resolve("vue/server-renderer")
|
|
1340
1360
|
}, {
|
|
1341
1361
|
find: "vue",
|
|
1342
|
-
replacement:
|
|
1362
|
+
replacement: tn.resolve("vue/dist/vue.runtime.esm-bundler.js")
|
|
1343
1363
|
}];
|
|
1344
1364
|
}
|
|
1345
1365
|
// src/node/plugin/vite/middleware/vault-assets.ts
|
|
1346
|
-
var
|
|
1366
|
+
var rn = {
|
|
1347
1367
|
jpg: "image/jpeg",
|
|
1348
1368
|
jpeg: "image/jpeg",
|
|
1349
1369
|
png: "image/png",
|
|
@@ -1361,66 +1381,66 @@ var tn = {
|
|
|
1361
1381
|
woff: "font/woff",
|
|
1362
1382
|
ttf: "font/ttf"
|
|
1363
1383
|
};
|
|
1364
|
-
function
|
|
1365
|
-
return (n,
|
|
1366
|
-
if (!n.url || n.method !== "GET" ||
|
|
1384
|
+
function an(e, t) {
|
|
1385
|
+
return (n, i, o) => {
|
|
1386
|
+
if (!n.url || n.method !== "GET" || i.writableEnded) return o();
|
|
1367
1387
|
let c = a(n.url);
|
|
1368
|
-
if (c.startsWith("/@") || c.startsWith("/node_modules")) return
|
|
1369
|
-
let l =
|
|
1370
|
-
if (
|
|
1371
|
-
let e =
|
|
1388
|
+
if (c.startsWith("/@") || c.startsWith("/node_modules")) return o();
|
|
1389
|
+
let l = r(t.basePath), u = (l && c.startsWith(l) ? c.slice(l.length) : c).replace(/^\//, ""), d = M(e.config.root, t.rootDirectory, u);
|
|
1390
|
+
if (pe(d)) try {
|
|
1391
|
+
let e = ge(d);
|
|
1372
1392
|
if (e.isFile()) {
|
|
1373
|
-
let t =
|
|
1374
|
-
|
|
1393
|
+
let t = rn[s(d).slice(1).toLowerCase()] ?? "application/octet-stream";
|
|
1394
|
+
i.setHeader("Content-Type", t), i.setHeader("Content-Length", e.size), fe(d).pipe(i);
|
|
1375
1395
|
return;
|
|
1376
1396
|
}
|
|
1377
1397
|
} catch {}
|
|
1378
|
-
|
|
1398
|
+
o();
|
|
1379
1399
|
};
|
|
1380
1400
|
}
|
|
1381
1401
|
// src/node/plugin/vite/middleware/virtual-html.ts
|
|
1382
|
-
function
|
|
1383
|
-
return (
|
|
1384
|
-
if (!
|
|
1385
|
-
let c =
|
|
1402
|
+
function on(e, t, n) {
|
|
1403
|
+
return (i, o, s) => {
|
|
1404
|
+
if (!i.url) return s();
|
|
1405
|
+
let c = r(a(i.url)), l = r(n.basePath);
|
|
1386
1406
|
if (c.startsWith("/@") || c.startsWith("/node_modules") || !c.startsWith(l)) return s();
|
|
1387
1407
|
let u = c.slice(l.length);
|
|
1388
1408
|
if (u.startsWith("/@") || u.startsWith("/node_modules") || c.includes(".") && !c.endsWith("/index.html")) return s();
|
|
1389
1409
|
t.getConfig().then(async (t) => {
|
|
1390
|
-
let
|
|
1391
|
-
o.setHeader("Content-Type", "text/html"), o.end(
|
|
1410
|
+
let r = await e.transformIndexHtml(i.url ?? "", sn(n, t));
|
|
1411
|
+
o.setHeader("Content-Type", "text/html"), o.end(r);
|
|
1392
1412
|
}).catch(() => s());
|
|
1393
1413
|
};
|
|
1394
1414
|
}
|
|
1395
|
-
function
|
|
1396
|
-
return e.devHtml === void 0 && (e.devHtml =
|
|
1415
|
+
function sn(e, t) {
|
|
1416
|
+
return e.devHtml === void 0 && (e.devHtml = D({
|
|
1397
1417
|
title: t.siteTitle,
|
|
1398
1418
|
description: t.siteDescription,
|
|
1399
1419
|
base: "/",
|
|
1400
1420
|
ogType: "website",
|
|
1401
|
-
entryScript:
|
|
1421
|
+
entryScript: Pt
|
|
1402
1422
|
})), e.devHtml;
|
|
1403
1423
|
}
|
|
1404
1424
|
// src/node/lib/prop-schema.ts
|
|
1405
|
-
function
|
|
1425
|
+
function cn(e, t, n) {
|
|
1406
1426
|
let r = {};
|
|
1407
1427
|
for (let i of e) {
|
|
1408
1428
|
let e = `./${j.relative(t, i.absolutePath)}`;
|
|
1409
1429
|
try {
|
|
1410
|
-
let t = n.getComponentMeta(i.absolutePath), a = {},
|
|
1430
|
+
let t = n.getComponentMeta(i.absolutePath), a = {}, s = !1;
|
|
1411
1431
|
for (let e of t.props) {
|
|
1412
1432
|
if (e.global) continue;
|
|
1413
|
-
let t =
|
|
1433
|
+
let t = Q(e.schema);
|
|
1414
1434
|
if (t !== void 0) {
|
|
1415
|
-
let n = { schema: e.required ? t :
|
|
1416
|
-
e.description && (n.description = e.description), a[e.name] = n,
|
|
1435
|
+
let n = { schema: e.required ? t : o(t) };
|
|
1436
|
+
e.description && (n.description = e.description), a[e.name] = n, s = !0;
|
|
1417
1437
|
}
|
|
1418
1438
|
}
|
|
1419
|
-
let
|
|
1439
|
+
let c = t.slots.map((e) => e.name).filter((e) => e !== "default");
|
|
1420
1440
|
r[i.name] = {
|
|
1421
1441
|
source: e,
|
|
1422
|
-
props:
|
|
1423
|
-
slots: 0 <
|
|
1442
|
+
props: s ? a : void 0,
|
|
1443
|
+
slots: 0 < c.length ? c : void 0
|
|
1424
1444
|
};
|
|
1425
1445
|
} catch {
|
|
1426
1446
|
r[i.name] = { source: e };
|
|
@@ -1428,25 +1448,25 @@ function on(e, t, n) {
|
|
|
1428
1448
|
}
|
|
1429
1449
|
return r;
|
|
1430
1450
|
}
|
|
1431
|
-
function
|
|
1451
|
+
function ln(e) {
|
|
1432
1452
|
if (!e || e.length !== 1) return;
|
|
1433
|
-
let t =
|
|
1453
|
+
let t = Q(e[0]);
|
|
1434
1454
|
return t === void 0 ? void 0 : {
|
|
1435
1455
|
type: "array",
|
|
1436
1456
|
items: t
|
|
1437
1457
|
};
|
|
1438
1458
|
}
|
|
1439
|
-
function
|
|
1440
|
-
if (t && 0 < Object.keys(t).length) return
|
|
1459
|
+
function un(e, t) {
|
|
1460
|
+
if (t && 0 < Object.keys(t).length) return fn(t);
|
|
1441
1461
|
let n = /^(?:Record<string,\s*(\w+)>|\{\s*\[key:\s*string\]:\s*(\w+);\s*\})$/.exec(e);
|
|
1442
1462
|
if (!n) return;
|
|
1443
|
-
let r =
|
|
1463
|
+
let r = dn(n[1] ?? n[2]);
|
|
1444
1464
|
return r === void 0 ? void 0 : {
|
|
1445
1465
|
type: "object",
|
|
1446
1466
|
additionalProperties: r
|
|
1447
1467
|
};
|
|
1448
1468
|
}
|
|
1449
|
-
function
|
|
1469
|
+
function dn(e) {
|
|
1450
1470
|
switch (e) {
|
|
1451
1471
|
case "string": return { type: "string" };
|
|
1452
1472
|
case "number": return { type: "number" };
|
|
@@ -1460,20 +1480,20 @@ function ln(e) {
|
|
|
1460
1480
|
let t = e.replace(/^["']|["']$/g, "");
|
|
1461
1481
|
i.push({ const: t });
|
|
1462
1482
|
} else {
|
|
1463
|
-
let t =
|
|
1483
|
+
let t = dn(e);
|
|
1464
1484
|
if (t === void 0) return;
|
|
1465
1485
|
i.push(t);
|
|
1466
1486
|
}
|
|
1467
1487
|
let a = i.length === 1 ? i[0] : { oneOf: i };
|
|
1468
|
-
return n ?
|
|
1488
|
+
return n ? o(a) : a;
|
|
1469
1489
|
}
|
|
1470
1490
|
return;
|
|
1471
1491
|
}
|
|
1472
1492
|
}
|
|
1473
|
-
function
|
|
1493
|
+
function fn(e) {
|
|
1474
1494
|
let t = {}, n = [];
|
|
1475
1495
|
for (let [r, i] of Object.entries(e)) {
|
|
1476
|
-
let e =
|
|
1496
|
+
let e = Q(i.schema);
|
|
1477
1497
|
if (e === void 0) return;
|
|
1478
1498
|
t[r] = e, i.required && n.push(r);
|
|
1479
1499
|
}
|
|
@@ -1484,22 +1504,22 @@ function un(e) {
|
|
|
1484
1504
|
};
|
|
1485
1505
|
return 0 < n.length && (r.required = n), r;
|
|
1486
1506
|
}
|
|
1487
|
-
function
|
|
1488
|
-
if (typeof e == "string") return
|
|
1507
|
+
function Q(e) {
|
|
1508
|
+
if (typeof e == "string") return dn(e);
|
|
1489
1509
|
switch (e.kind) {
|
|
1490
|
-
case "enum": return
|
|
1491
|
-
case "array": return
|
|
1492
|
-
case "object": return
|
|
1510
|
+
case "enum": return pn(e.schema);
|
|
1511
|
+
case "array": return ln(e.schema);
|
|
1512
|
+
case "object": return un(e.type, e.schema);
|
|
1493
1513
|
case "literal": return "value" in e ? { const: e.value } : void 0;
|
|
1494
1514
|
default: return;
|
|
1495
1515
|
}
|
|
1496
1516
|
}
|
|
1497
|
-
function
|
|
1517
|
+
function pn(e) {
|
|
1498
1518
|
let t = e ?? [], n = t.some((e) => e === "undefined" || e === "null"), r = t.filter((e) => e !== "undefined" && e !== "null");
|
|
1499
1519
|
if (r.length === 0) return;
|
|
1500
1520
|
if (r.length === 1) {
|
|
1501
|
-
let e =
|
|
1502
|
-
return e === void 0 ? void 0 : n ?
|
|
1521
|
+
let e = Q(r[0]);
|
|
1522
|
+
return e === void 0 ? void 0 : n ? o(e) : e;
|
|
1503
1523
|
}
|
|
1504
1524
|
if (r.every((e) => typeof e == "object" && e.kind === "literal")) {
|
|
1505
1525
|
let e = [];
|
|
@@ -1508,56 +1528,56 @@ function dn(e) {
|
|
|
1508
1528
|
e.push(t.value);
|
|
1509
1529
|
}
|
|
1510
1530
|
let t = { enum: e };
|
|
1511
|
-
return n ?
|
|
1531
|
+
return n ? o(t) : t;
|
|
1512
1532
|
}
|
|
1513
1533
|
let i = [];
|
|
1514
1534
|
for (let e of r) {
|
|
1515
|
-
let t =
|
|
1535
|
+
let t = Q(e);
|
|
1516
1536
|
if (t === void 0) return;
|
|
1517
1537
|
i.push(t);
|
|
1518
1538
|
}
|
|
1519
1539
|
if (i.length === 0) return;
|
|
1520
1540
|
let a = { oneOf: i };
|
|
1521
|
-
return n ?
|
|
1541
|
+
return n ? o(a) : a;
|
|
1522
1542
|
}
|
|
1523
1543
|
// src/node/plugin/vite/subplugins/component-contract.ts
|
|
1524
|
-
var
|
|
1525
|
-
function
|
|
1544
|
+
var mn = ".typedown/components.json";
|
|
1545
|
+
function hn(e) {
|
|
1526
1546
|
return {
|
|
1527
1547
|
name: "vite-plugin-typedown-component-contract",
|
|
1528
1548
|
async buildStart() {
|
|
1529
1549
|
let t = e();
|
|
1530
1550
|
if (!t) return;
|
|
1531
|
-
let n = await
|
|
1532
|
-
|
|
1551
|
+
let n = await R((await (await t.getTdContext()).getConfig()).components, t.root);
|
|
1552
|
+
bn(t.root, n);
|
|
1533
1553
|
},
|
|
1534
1554
|
configureServer(t) {
|
|
1535
1555
|
let n = e();
|
|
1536
1556
|
n && n.getTdContext().then(async (e) => {
|
|
1537
|
-
let r = await e.getConfig(), i = await
|
|
1538
|
-
|
|
1557
|
+
let r = await e.getConfig(), i = await R(r.components, n.root);
|
|
1558
|
+
bn(n.root, i), gn(t, r.components, n.root);
|
|
1539
1559
|
}).catch(() => {});
|
|
1540
1560
|
}
|
|
1541
1561
|
};
|
|
1542
1562
|
}
|
|
1543
|
-
function
|
|
1563
|
+
function gn(e, t, n) {
|
|
1544
1564
|
let r = new Set(t.filter((e) => e.kind === "explicit").map((e) => P(j.resolve(n, e.source)))), i = new Set(t.filter((e) => e.kind === "dir").map((e) => P(j.resolve(n, e.path))));
|
|
1545
1565
|
for (let t of i) e.watcher.add(t);
|
|
1546
1566
|
let a = (a) => {
|
|
1547
|
-
|
|
1567
|
+
_n(a, r, i) && (e.config.logger.info("[typedown] component changed, rebuilding contract..."), R(t, n).then((e) => bn(n, e)).catch(() => {}));
|
|
1548
1568
|
};
|
|
1549
1569
|
e.watcher.on("change", a), e.watcher.on("add", a), e.watcher.on("unlink", a);
|
|
1550
1570
|
}
|
|
1551
|
-
function
|
|
1571
|
+
function _n(e, t, n) {
|
|
1552
1572
|
if (!e.endsWith(".vue")) return !1;
|
|
1553
1573
|
let r = P(e);
|
|
1554
1574
|
if (t.has(r)) return !0;
|
|
1555
1575
|
for (let e of n) if (r.startsWith(e + "/")) return !0;
|
|
1556
1576
|
return !1;
|
|
1557
1577
|
}
|
|
1558
|
-
function
|
|
1578
|
+
function vn() {
|
|
1559
1579
|
try {
|
|
1560
|
-
let e = j.dirname(
|
|
1580
|
+
let e = j.dirname(le(import.meta.url)), t = j.resolve(e, "builtin-components.json"), n = JSON.parse(I.readFileSync(t, "utf-8"));
|
|
1561
1581
|
for (let e of Object.values(n)) if (typeof e == "object" && e && "source" in e) {
|
|
1562
1582
|
let t = e;
|
|
1563
1583
|
typeof t.source == "string" && t.source.startsWith("./") && (t.source = `typerighter/${t.source.slice(2)}`);
|
|
@@ -1567,36 +1587,36 @@ function gn() {
|
|
|
1567
1587
|
return {};
|
|
1568
1588
|
}
|
|
1569
1589
|
}
|
|
1570
|
-
var
|
|
1571
|
-
function
|
|
1572
|
-
if (!(0 < Object.keys(
|
|
1573
|
-
let n = 0 < t.length ?
|
|
1574
|
-
...
|
|
1590
|
+
var yn = vn();
|
|
1591
|
+
function bn(e, t) {
|
|
1592
|
+
if (!(0 < Object.keys(yn).length) && t.length === 0) return;
|
|
1593
|
+
let n = 0 < t.length ? cn(t, e, Ie(e)) : {}, r = {
|
|
1594
|
+
...yn,
|
|
1575
1595
|
...n
|
|
1576
|
-
}, i = j.join(e,
|
|
1596
|
+
}, i = j.join(e, mn);
|
|
1577
1597
|
I.mkdirSync(j.dirname(i), { recursive: !0 }), I.writeFileSync(i, JSON.stringify(r, null, 2));
|
|
1578
1598
|
}
|
|
1579
1599
|
// src/node/plugin/vite/index.ts
|
|
1580
1600
|
function $(t = {}) {
|
|
1581
|
-
let n = t.context, r, i, a, o = new
|
|
1601
|
+
let n = t.context, r, i, a, o = new Bt(t.root ?? ""), s = new Ht(), c = new Vt(t.root ?? ""), l = new Gt(), f = new en(), p = {
|
|
1582
1602
|
devHtml: void 0,
|
|
1583
1603
|
basePath: "/",
|
|
1584
1604
|
rootDirectory: "vault"
|
|
1585
1605
|
};
|
|
1586
|
-
function
|
|
1606
|
+
function m() {
|
|
1587
1607
|
if (n === void 0) throw Error("typedown plugin not initialized");
|
|
1588
1608
|
return n.getTdContext();
|
|
1589
1609
|
}
|
|
1590
|
-
let
|
|
1610
|
+
let h = {
|
|
1591
1611
|
name: "vite-plugin-typedown",
|
|
1592
1612
|
enforce: "pre",
|
|
1593
1613
|
async config(e) {
|
|
1594
1614
|
if (!n) {
|
|
1595
|
-
let r = t.root ? M(e.root ?? process.cwd(), t.root) :
|
|
1596
|
-
n =
|
|
1615
|
+
let r = t.root ? M(e.root ?? process.cwd(), t.root) : re(e.root ?? process.cwd());
|
|
1616
|
+
n = ne(r);
|
|
1597
1617
|
}
|
|
1598
1618
|
a = e.base ?? "/";
|
|
1599
|
-
let r = await (await
|
|
1619
|
+
let r = await (await m()).getConfig();
|
|
1600
1620
|
return {
|
|
1601
1621
|
base: e.base ?? r.basePath,
|
|
1602
1622
|
publicDir: r.publicDir,
|
|
@@ -1604,7 +1624,7 @@ function $(t = {}) {
|
|
|
1604
1624
|
port: e.server?.port ?? 8686,
|
|
1605
1625
|
strictPort: e.server?.strictPort ?? !1
|
|
1606
1626
|
},
|
|
1607
|
-
resolve: { alias:
|
|
1627
|
+
resolve: { alias: nn() },
|
|
1608
1628
|
ssr: { noExternal: ["typerighter"] }
|
|
1609
1629
|
};
|
|
1610
1630
|
},
|
|
@@ -1613,42 +1633,42 @@ function $(t = {}) {
|
|
|
1613
1633
|
},
|
|
1614
1634
|
async buildStart() {
|
|
1615
1635
|
if (r) return;
|
|
1616
|
-
let e = await
|
|
1617
|
-
|
|
1636
|
+
let e = await m(), t = await e.getConfig(), n = M(t.rootDir);
|
|
1637
|
+
f.index(n), await l.fetchSync(e);
|
|
1618
1638
|
let i = await e.checkVault();
|
|
1619
|
-
if (
|
|
1639
|
+
if (Tn(i.diagnostics), 0 < i.errorCount) {
|
|
1620
1640
|
let e = i.diagnostics.filter((e) => e.severity === "error").map((e) => ` ${e.filepath}:${e.line}:${e.column} - ${e.message} (${e.code})`);
|
|
1621
1641
|
this.error(`Vault check failed with ${i.errorCount} error(s):\n${e.join("\n")}`);
|
|
1622
1642
|
}
|
|
1623
1643
|
},
|
|
1624
1644
|
resolveId(e) {
|
|
1625
|
-
if (e === "/@typedown/app" || e === "@typedown/app") return
|
|
1626
|
-
if (e === "@typedown/pages") return
|
|
1627
|
-
if (e.startsWith("@typedown/pages?resource=")) return
|
|
1628
|
-
if (e === "@typedown/site-data") return
|
|
1629
|
-
if (e === "@typedown/search-index") return
|
|
1630
|
-
if (e === "@typedown/theme") return
|
|
1645
|
+
if (e === "/@typedown/app" || e === "@typedown/app") return Ft;
|
|
1646
|
+
if (e === "@typedown/pages") return It;
|
|
1647
|
+
if (e.startsWith("@typedown/pages?resource=")) return c.resolvePageData(e);
|
|
1648
|
+
if (e === "@typedown/site-data") return Lt;
|
|
1649
|
+
if (e === "@typedown/search-index") return Rt;
|
|
1650
|
+
if (e === "@typedown/theme") return zt;
|
|
1631
1651
|
},
|
|
1632
1652
|
async load(e) {
|
|
1633
|
-
if (
|
|
1653
|
+
if (c.isPageDataModule(e)) return c.loadPageData(e, await m());
|
|
1634
1654
|
if (e !== "\0@typedown/search-index" && e !== "\0@typedown/site-data" && e !== "\0@typedown/pages" && e !== "\0@typedown/app" && e !== "\0@typedown/theme") return;
|
|
1635
|
-
let t = await
|
|
1636
|
-
if (e === "\0@typedown/search-index") return
|
|
1637
|
-
if (e === "\0@typedown/site-data") return
|
|
1638
|
-
if (e === "\0@typedown/pages") return
|
|
1655
|
+
let t = await m();
|
|
1656
|
+
if (e === "\0@typedown/search-index") return f.load(t);
|
|
1657
|
+
if (e === "\0@typedown/site-data") return l.load(t);
|
|
1658
|
+
if (e === "\0@typedown/pages") return c.load(t);
|
|
1639
1659
|
if (e === "\0@typedown/app") return o.load(n);
|
|
1640
1660
|
if (e === "\0@typedown/theme") return s.load(n);
|
|
1641
1661
|
},
|
|
1642
1662
|
async configureServer(e) {
|
|
1643
1663
|
r = e;
|
|
1644
|
-
let t = await
|
|
1645
|
-
|
|
1664
|
+
let t = await m(), n = await t.getConfig(), i = M(n.rootDir);
|
|
1665
|
+
f.index(i), l.scan(i), l.fetch(t, r), e.httpServer?.once("listening", async () => {
|
|
1646
1666
|
let e = await t.checkVault();
|
|
1647
|
-
0 < e.diagnostics.length && (console.error(""),
|
|
1667
|
+
0 < e.diagnostics.length && (console.error(""), Tn(e.diagnostics));
|
|
1648
1668
|
}), t.rpc.onConfigChanged(() => {
|
|
1649
|
-
r && (
|
|
1669
|
+
r && (p.devHtml = void 0, l.clear(), o.invalidate(r), s.invalidate(r), c.invalidate(r), Sn(r), l.fetch(t, r));
|
|
1650
1670
|
}), t.rpc.onComponentContractChanged(() => {
|
|
1651
|
-
r && (o.invalidate(r),
|
|
1671
|
+
r && (o.invalidate(r), Sn(r));
|
|
1652
1672
|
});
|
|
1653
1673
|
function a(...e) {
|
|
1654
1674
|
r && t.getConfig().then((t) => {
|
|
@@ -1657,8 +1677,8 @@ function $(t = {}) {
|
|
|
1657
1677
|
for (let i of e) {
|
|
1658
1678
|
let e = P(M(r.config.root, t.rootDir, i)), a = r.moduleGraph.getModulesByFile(e);
|
|
1659
1679
|
if (a?.size) {
|
|
1660
|
-
for (let e of a) r.moduleGraph.invalidateModule(e), n.push(
|
|
1661
|
-
|
|
1680
|
+
for (let e of a) r.moduleGraph.invalidateModule(e), n.push(wn(e));
|
|
1681
|
+
c.invalidatePageData(r, i);
|
|
1662
1682
|
}
|
|
1663
1683
|
}
|
|
1664
1684
|
0 < n.length && r.hot.send({
|
|
@@ -1668,46 +1688,46 @@ function $(t = {}) {
|
|
|
1668
1688
|
}).catch(() => {});
|
|
1669
1689
|
}
|
|
1670
1690
|
t.rpc.onContentUpdated(({ filepath: e, affectedFiles: n = [] }) => {
|
|
1671
|
-
r && (
|
|
1691
|
+
r && (f.reindex(i, e), f.invalidate(r), c.invalidate(r), l.fetch(t, r), a(e, ...n), c.sendPageData(r, t, e));
|
|
1672
1692
|
}), t.rpc.onContentDeleted(({ filepath: e }) => {
|
|
1673
|
-
r && (
|
|
1693
|
+
r && (f.reindex(i, e), f.invalidate(r), c.invalidate(r), l.fetch(t, r), a(e));
|
|
1674
1694
|
});
|
|
1675
|
-
function
|
|
1676
|
-
r && (
|
|
1695
|
+
function u() {
|
|
1696
|
+
r && (l.clear(), Cn(r), l.fetch(t, r));
|
|
1677
1697
|
}
|
|
1678
|
-
t.rpc.onSchemaUpdated(
|
|
1679
|
-
let
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
}), e.middlewares.use(
|
|
1698
|
+
t.rpc.onSchemaUpdated(u), t.rpc.onSchemaDeleted(u);
|
|
1699
|
+
let d = await t.getConfig();
|
|
1700
|
+
p.basePath = d.basePath, p.rootDirectory = d.rootDir, t.rpc.onConfigChanged((e) => {
|
|
1701
|
+
p.basePath = e.basePath, p.rootDirectory = e.rootDir, p.devHtml = void 0;
|
|
1702
|
+
}), e.middlewares.use(an(e, p)), e.middlewares.use(on(e, t, p));
|
|
1683
1703
|
},
|
|
1684
1704
|
async transform(t, n) {
|
|
1685
1705
|
let r = n.split("?")[0];
|
|
1686
|
-
if (!
|
|
1687
|
-
if (
|
|
1688
|
-
code: `<script>import theme from '${
|
|
1706
|
+
if (!e(r)) return;
|
|
1707
|
+
if (u(r)) return {
|
|
1708
|
+
code: `<script>import theme from '${Y}'; import { TdNotFound } from 'typerighter/client/theme-default'; export default theme.NotFound || TdNotFound; export const pageData = { frontmatter: {}, headings: [], title: '' };<\/script>`,
|
|
1689
1709
|
map: null
|
|
1690
1710
|
};
|
|
1691
|
-
let i = await
|
|
1711
|
+
let i = await m(), a = await i.getConfig(), o = d(r, a.rootDir);
|
|
1692
1712
|
try {
|
|
1693
|
-
let { vueSrc: e } = await
|
|
1713
|
+
let { vueSrc: e } = await jt(i, await i.getFile(o), o);
|
|
1694
1714
|
return {
|
|
1695
1715
|
code: e,
|
|
1696
1716
|
map: null
|
|
1697
1717
|
};
|
|
1698
1718
|
} catch (e) {
|
|
1699
|
-
if (
|
|
1719
|
+
if (te(e)) return;
|
|
1700
1720
|
let t = e instanceof Error ? e.message : String(e);
|
|
1701
1721
|
this.error(`[typedown] Failed to transform ${o}: ${t}`);
|
|
1702
1722
|
}
|
|
1703
1723
|
},
|
|
1704
|
-
handleHotUpdate({ file:
|
|
1705
|
-
if (
|
|
1724
|
+
handleHotUpdate({ file: t }) {
|
|
1725
|
+
if (e(t)) return [];
|
|
1706
1726
|
},
|
|
1707
1727
|
async closeBundle() {
|
|
1708
1728
|
if (!t.context && n) try {
|
|
1709
1729
|
let e = (await (await n.getTdContext()).getConfig()).basePath, t = e.startsWith(a) ? e.slice(a.length) : e.replace(/^\//, "");
|
|
1710
|
-
await
|
|
1730
|
+
await Be(n, {
|
|
1711
1731
|
outDir: M(i, t),
|
|
1712
1732
|
base: e
|
|
1713
1733
|
});
|
|
@@ -1715,32 +1735,32 @@ function $(t = {}) {
|
|
|
1715
1735
|
n.dispose();
|
|
1716
1736
|
}
|
|
1717
1737
|
}
|
|
1718
|
-
},
|
|
1738
|
+
}, g = oe({
|
|
1719
1739
|
include: t.root ? RegExp(`${t.root.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}/.*\\.(?:vue|td)$`) : /\.(?:vue|td)$/,
|
|
1720
1740
|
template: { transformAssetUrls: !1 }
|
|
1721
1741
|
});
|
|
1722
1742
|
return [
|
|
1723
|
-
m,
|
|
1724
|
-
pn(() => n),
|
|
1725
1743
|
h,
|
|
1726
|
-
|
|
1744
|
+
hn(() => n),
|
|
1745
|
+
g,
|
|
1746
|
+
...ae()
|
|
1727
1747
|
];
|
|
1728
1748
|
}
|
|
1729
|
-
function
|
|
1749
|
+
function xn(e) {
|
|
1730
1750
|
return [...e.moduleGraph.idToModuleMap.entries()].filter(([e]) => e.endsWith(".td")).map(([, e]) => e);
|
|
1731
1751
|
}
|
|
1732
|
-
function
|
|
1733
|
-
for (let t of
|
|
1752
|
+
function Sn(e) {
|
|
1753
|
+
for (let t of xn(e)) e.moduleGraph.invalidateModule(t);
|
|
1734
1754
|
e.hot.send({ type: "full-reload" });
|
|
1735
1755
|
}
|
|
1736
|
-
function
|
|
1737
|
-
let t =
|
|
1756
|
+
function Cn(e) {
|
|
1757
|
+
let t = xn(e).map((t) => (e.moduleGraph.invalidateModule(t), wn(t)));
|
|
1738
1758
|
0 < t.length && e.hot.send({
|
|
1739
1759
|
type: "update",
|
|
1740
1760
|
updates: t
|
|
1741
1761
|
});
|
|
1742
1762
|
}
|
|
1743
|
-
function
|
|
1763
|
+
function wn(e) {
|
|
1744
1764
|
return {
|
|
1745
1765
|
type: "js-update",
|
|
1746
1766
|
path: e.url,
|
|
@@ -1748,10 +1768,10 @@ function xn(e) {
|
|
|
1748
1768
|
timestamp: Date.now()
|
|
1749
1769
|
};
|
|
1750
1770
|
}
|
|
1751
|
-
function
|
|
1771
|
+
function Tn(e) {
|
|
1752
1772
|
for (let t of e) {
|
|
1753
1773
|
let e = `${t.filepath}:${t.line}:${t.column}`, n = t.severity === "error" ? N.red("error") : N.yellow("warn");
|
|
1754
1774
|
console.error(` ${n} ${e} ${t.message} ${N.dim(`(${t.code})`)}`);
|
|
1755
1775
|
}
|
|
1756
1776
|
}
|
|
1757
|
-
export {
|
|
1777
|
+
export { q as a, J as i, G as n, Y as o, X as r, Be as s, $ as t };
|