typerighter 0.40.6 → 0.41.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/dist/{app-OdN7kiy-.js → app-CrcoXWCG.js} +1 -1
- package/dist/{cli-FDtyIPNk.js → cli-Chux95ZY.js} +5 -5
- package/dist/cli.js +1 -1
- package/dist/client/theme-default.js +2 -2
- package/dist/client.js +1 -1
- package/dist/index.js +2 -2
- package/dist/{init-BdR4QzXX.js → init-CjABoI2t.js} +1 -1
- package/dist/{jsonld-BoEW-5KW.js → jsonld-Du1iJ_fG.js} +1 -1
- package/dist/node/plugin/vite/constants.d.ts +1 -0
- package/dist/node/plugin/vite/constants.d.ts.map +1 -1
- package/dist/node/plugin/vite/index.d.ts.map +1 -1
- package/dist/node/plugin/vite/virtual/app.d.ts.map +1 -1
- package/dist/node/plugin/vite/virtual/pages.d.ts +1 -0
- package/dist/node/plugin/vite/virtual/pages.d.ts.map +1 -1
- package/dist/prerenderWorker.js +2 -2
- package/dist/shared/types/ssg.d.ts +4 -4
- package/dist/shared/types/ssg.d.ts.map +1 -1
- package/dist/{shared-DMNZD2i1.js → shared-BMujDY3P.js} +1 -1
- package/dist/shared.js +1 -1
- package/dist/{vite-BlO1hmkO.js → vite-Bsf15M7-.js} +221 -197
- package/dist/vite.js +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as e, E as t, F as n, H as r, K as i, L as a, P as o, R as s, V as c, X as l, Y as u, _ as d, b as f, c as p, d as m, g as h, h as g, i as _, p as v, q as y, v as b, w as x, y as S, z as C } from "./shared-
|
|
2
|
-
import { a as w, i as T, n as E, o as ee, r as D, s as O, t as te } from "./jsonld-
|
|
1
|
+
import { D as e, E as t, F as n, H as r, K as i, L as a, P as o, R as s, V as c, X as l, Y as u, _ as d, b as f, c as p, d as m, g as h, h as g, i as _, p as v, q as y, v as b, w as x, y as S, z as C } from "./shared-BMujDY3P.js";
|
|
2
|
+
import { a as w, i as T, n as E, o as ee, r as D, s as O, t as te } from "./jsonld-Du1iJ_fG.js";
|
|
3
3
|
import { t as ne } from "./temml-DZbhOfRE.js";
|
|
4
4
|
import { a as re, i as ie, n as ae, r as oe } from "./context-CSvoDxVt.js";
|
|
5
5
|
import { t as se } from "./es-ClqUVRJn.js";
|
|
@@ -13,10 +13,10 @@ import { fileURLToPath as de } from "node:url";
|
|
|
13
13
|
import fe from "node:os";
|
|
14
14
|
import { Worker as pe } from "node:worker_threads";
|
|
15
15
|
import { createHighlighter as me, guessEmbeddedLanguages as he, isSpecialLang as ge } from "shiki";
|
|
16
|
-
import { createReadStream as _e, existsSync as ve, globSync as
|
|
17
|
-
import { createRequire as
|
|
16
|
+
import { createReadStream as _e, existsSync as ve, globSync as ye, readFileSync as be, statSync as xe } from "node:fs";
|
|
17
|
+
import { createRequire as Se } from "node:module";
|
|
18
18
|
//#region src/node/lib/worker-pool/index.ts
|
|
19
|
-
var
|
|
19
|
+
var Ce = class {
|
|
20
20
|
workers = [];
|
|
21
21
|
queue = [];
|
|
22
22
|
destroyed = !1;
|
|
@@ -62,7 +62,7 @@ var Se = class {
|
|
|
62
62
|
};
|
|
63
63
|
//#endregion
|
|
64
64
|
//#region src/node/build/seo/sitemap.ts
|
|
65
|
-
function
|
|
65
|
+
function we(e, t, n, r) {
|
|
66
66
|
let i = n ?? "";
|
|
67
67
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
68
68
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
@@ -73,7 +73,7 @@ ${e.map((e) => {
|
|
|
73
73
|
</urlset>
|
|
74
74
|
`;
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function Te(e, t) {
|
|
77
77
|
return `User-agent: *
|
|
78
78
|
Allow: /
|
|
79
79
|
|
|
@@ -82,7 +82,7 @@ Sitemap: ${e}${t}sitemap.xml
|
|
|
82
82
|
}
|
|
83
83
|
//#endregion
|
|
84
84
|
//#region src/node/build/seo/feed.ts
|
|
85
|
-
function
|
|
85
|
+
function Ee(e, t, n, r, i, a) {
|
|
86
86
|
let o = [...e].filter((e) => e.fileMetadata.mtime > 0).sort((e, t) => t.fileMetadata.mtime - e.fileMetadata.mtime).slice(0, 50).map((e) => {
|
|
87
87
|
let r = c(e.filepath), i = `${n}${t}${r}`, a = new Date(e.fileMetadata.mtime).toUTCString(), o = p(e.label ?? r), s = e.excerpt === void 0 ? "" : `<![CDATA[${e.excerpt}]]>`;
|
|
88
88
|
return ` <item>
|
|
@@ -108,13 +108,13 @@ ${o}
|
|
|
108
108
|
}
|
|
109
109
|
//#endregion
|
|
110
110
|
//#region src/node/build/prerender.ts
|
|
111
|
-
var
|
|
112
|
-
async function
|
|
113
|
-
let { clientEntry: t, cssFiles: n, jsFiles: r } = await
|
|
114
|
-
e.pagePaths.length >=
|
|
111
|
+
var De = 64;
|
|
112
|
+
async function Oe(e) {
|
|
113
|
+
let { clientEntry: t, cssFiles: n, jsFiles: r } = await je(e.clientOutDir), i = [n.map((t) => ` <link rel="stylesheet" href="${e.base}${t}">`).join("\n"), r.map((t) => ` <link rel="modulepreload" href="${e.base}${t}">`).join("\n")].filter(Boolean).join("\n") || void 0;
|
|
114
|
+
e.pagePaths.length >= De ? await ke(e, t, i) : await Ae(e, t, i);
|
|
115
115
|
}
|
|
116
|
-
async function
|
|
117
|
-
let r = new
|
|
116
|
+
async function ke(e, t, n) {
|
|
117
|
+
let r = new Ce({
|
|
118
118
|
filename: k.resolve(de(import.meta.url), "../prerenderWorker.js"),
|
|
119
119
|
workerData: {
|
|
120
120
|
ssrEntryPath: e.ssrEntryPath,
|
|
@@ -136,7 +136,7 @@ async function Oe(e, t, n) {
|
|
|
136
136
|
await r.destroy();
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
async function
|
|
139
|
+
async function Ae(e, t, n) {
|
|
140
140
|
let r = await import(e.ssrEntryPath), i = e.pagePaths.length, a = 0;
|
|
141
141
|
for (let s = 0; s < i; s += 32) {
|
|
142
142
|
let c = e.pagePaths.slice(s, s + 32);
|
|
@@ -166,7 +166,7 @@ async function ke(e, t, n) {
|
|
|
166
166
|
}));
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
async function
|
|
169
|
+
async function je(e) {
|
|
170
170
|
let t = k.join(e, ".vite", "manifest.json"), n = await N.readFile(t, "utf-8"), r = JSON.parse(n), i = "", a = [], o = [];
|
|
171
171
|
for (let e of Object.values(r)) e.isEntry ? (i = e.file, e.css && a.push(...e.css)) : e.file.endsWith(".js") && o.push(e.file);
|
|
172
172
|
return {
|
|
@@ -177,12 +177,12 @@ async function Ae(e) {
|
|
|
177
177
|
}
|
|
178
178
|
//#endregion
|
|
179
179
|
//#region src/node/lib/progress.ts
|
|
180
|
-
var
|
|
180
|
+
var P = [
|
|
181
181
|
"◐",
|
|
182
182
|
"◓",
|
|
183
183
|
"◑",
|
|
184
184
|
"◒"
|
|
185
|
-
],
|
|
185
|
+
], F = class {
|
|
186
186
|
logger;
|
|
187
187
|
label;
|
|
188
188
|
start;
|
|
@@ -190,8 +190,8 @@ var F = [
|
|
|
190
190
|
constructor(e, t) {
|
|
191
191
|
if (this.logger = e, this.label = t, this.start = performance.now(), process.stdout.isTTY) {
|
|
192
192
|
let e = 0;
|
|
193
|
-
process.stdout.write(j.cyan(`${
|
|
194
|
-
e = (e + 1) %
|
|
193
|
+
process.stdout.write(j.cyan(`${P[0]} ${t}`)), this.spinnerInterval = setInterval(() => {
|
|
194
|
+
e = (e + 1) % P.length, process.stdout.write(`\r${j.cyan(`${P[e]} ${this.label}`)}`);
|
|
195
195
|
}, 120).unref();
|
|
196
196
|
} else this.logger.start(t);
|
|
197
197
|
}
|
|
@@ -203,19 +203,19 @@ var F = [
|
|
|
203
203
|
done(e) {
|
|
204
204
|
this.stopSpinner(), process.stdout.isTTY && process.stdout.write("\r\x1B[K");
|
|
205
205
|
let t = Math.round(performance.now() - this.start);
|
|
206
|
-
this.logger.success(`${e} (${
|
|
206
|
+
this.logger.success(`${e} (${Me(t)})`);
|
|
207
207
|
}
|
|
208
208
|
stopSpinner() {
|
|
209
209
|
this.spinnerInterval &&= (clearInterval(this.spinnerInterval), void 0);
|
|
210
210
|
}
|
|
211
211
|
};
|
|
212
|
-
function
|
|
212
|
+
function Me(e) {
|
|
213
213
|
return e < 1e3 ? `${Math.round(e)}ms` : `${(e / 1e3).toFixed(1)}s`;
|
|
214
214
|
}
|
|
215
215
|
//#endregion
|
|
216
216
|
//#region src/node/build/index.ts
|
|
217
|
-
var
|
|
218
|
-
async function
|
|
217
|
+
var Ne = "typerighter/client/theme-default";
|
|
218
|
+
async function I(e, t = {}) {
|
|
219
219
|
let { root: n, logger: r } = e, i = k.resolve(n, t.outDir ?? "dist"), a = k.join(i, ".client"), o = k.join(i, ".server");
|
|
220
220
|
await N.rm(i, {
|
|
221
221
|
recursive: !0,
|
|
@@ -253,14 +253,14 @@ async function L(e, t = {}) {
|
|
|
253
253
|
author: m,
|
|
254
254
|
license: h,
|
|
255
255
|
nav: l.nav
|
|
256
|
-
})), N.writeFile(E,
|
|
256
|
+
})), N.writeFile(E, Pe({
|
|
257
257
|
rootDir: l.rootDir,
|
|
258
|
-
layoutImport:
|
|
258
|
+
layoutImport: Ne,
|
|
259
259
|
siteConfig: S,
|
|
260
260
|
siteData: C
|
|
261
261
|
}))]);
|
|
262
262
|
try {
|
|
263
|
-
let s =
|
|
263
|
+
let s = Ut({ context: e }), f = e.createViteLogger(), h = new F(r, "Building client bundle...");
|
|
264
264
|
await M({
|
|
265
265
|
...t.viteConfig,
|
|
266
266
|
root: n,
|
|
@@ -281,7 +281,7 @@ async function L(e, t = {}) {
|
|
|
281
281
|
});
|
|
282
282
|
let g = await N.readdir(k.join(a, "assets")).catch(() => []);
|
|
283
283
|
h.done(`Client bundle (${g.length} chunks)`);
|
|
284
|
-
let _ = new
|
|
284
|
+
let _ = new F(r, "Building SSR bundle...");
|
|
285
285
|
await M({
|
|
286
286
|
...t.viteConfig,
|
|
287
287
|
root: n,
|
|
@@ -300,9 +300,9 @@ async function L(e, t = {}) {
|
|
|
300
300
|
let t = c(e);
|
|
301
301
|
return t === "index" ? "/" : `/${t}`;
|
|
302
302
|
});
|
|
303
|
-
v.push("/"),
|
|
304
|
-
let b = new
|
|
305
|
-
await
|
|
303
|
+
v.push("/"), L(x.entries, "", v);
|
|
304
|
+
let b = new F(r, "Pre-rendering pages...");
|
|
305
|
+
await Oe({
|
|
306
306
|
ssrEntryPath: k.join(o, "ssr-entry.js"),
|
|
307
307
|
clientOutDir: a,
|
|
308
308
|
outDir: i,
|
|
@@ -319,10 +319,10 @@ async function L(e, t = {}) {
|
|
|
319
319
|
let t = c(e.filepath), n = t === "index" ? "/" : `/${t}`;
|
|
320
320
|
S.set(n, e.fileMetadata.mtime);
|
|
321
321
|
}
|
|
322
|
-
let C =
|
|
323
|
-
p !== void 0 && (w.push(N.writeFile(k.join(i, "robots.txt"),
|
|
322
|
+
let C = we(v, y, p, S), w = [N.writeFile(k.join(i, "sitemap.xml"), C)];
|
|
323
|
+
p !== void 0 && (w.push(N.writeFile(k.join(i, "robots.txt"), Te(p, y))), w.push(N.writeFile(k.join(i, "feed.xml"), Ee(d, y, p, l.siteTitle, l.siteDescription, l.lang)))), await Promise.all(w);
|
|
324
324
|
let ee = k.join(a, "assets"), D = k.join(i, "assets");
|
|
325
|
-
await N.cp(ee, D, { recursive: !0 }).catch(() => {}), await
|
|
325
|
+
await N.cp(ee, D, { recursive: !0 }).catch(() => {}), await Fe(k.join(n, l.rootDir), i);
|
|
326
326
|
let O = k.join(n, l.publicDir);
|
|
327
327
|
await N.cp(O, i, { recursive: !0 }).catch(() => {});
|
|
328
328
|
} finally {
|
|
@@ -343,7 +343,7 @@ async function L(e, t = {}) {
|
|
|
343
343
|
}
|
|
344
344
|
r.log(`\nBuild complete. Output: ${i}`);
|
|
345
345
|
}
|
|
346
|
-
function
|
|
346
|
+
function Pe(e) {
|
|
347
347
|
let t = `/${e.rootDir}/${y}`, n = JSON.parse(e.siteConfig), r = JSON.parse(e.siteData), a = r.contentTree ?? { entries: [] }, o = h(a.entries ?? [], n.title ?? ""), s = JSON.stringify({
|
|
348
348
|
...r,
|
|
349
349
|
directoryListings: o
|
|
@@ -392,7 +392,7 @@ export async function render(url) {
|
|
|
392
392
|
}
|
|
393
393
|
`;
|
|
394
394
|
}
|
|
395
|
-
async function
|
|
395
|
+
async function Fe(e, t) {
|
|
396
396
|
let n = (await N.readdir(e, {
|
|
397
397
|
recursive: !0,
|
|
398
398
|
withFileTypes: !0
|
|
@@ -402,22 +402,22 @@ async function Pe(e, t) {
|
|
|
402
402
|
});
|
|
403
403
|
await Promise.all(n);
|
|
404
404
|
}
|
|
405
|
-
function
|
|
405
|
+
function L(e, t, n) {
|
|
406
406
|
for (let r of e) {
|
|
407
407
|
if (r.kind !== "dir") continue;
|
|
408
408
|
let e = `${t}/${r.node.name}`;
|
|
409
|
-
d(r.node) || n.push(x(e)),
|
|
409
|
+
d(r.node) || n.push(x(e)), L(r.node.entries, e, n);
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
412
|
//#endregion
|
|
413
413
|
//#region ../../node_modules/.pnpm/@shikijs+transformers@4.4.3/node_modules/@shikijs/transformers/dist/index.mjs
|
|
414
|
-
var
|
|
414
|
+
var Ie = /(\s+\/\/)/, Le = /(?:\/\/|["'#]|;{1,2}|%{1,2}|--)(\s*)$/, Re = /(?:\/\/|#|;{1,2}|%{1,2}|--)(\s*)$/, ze = [
|
|
415
415
|
[/^(<!--)(.+)(-->)$/, !1],
|
|
416
416
|
[/^(\/\*)(.+)(\*\/)$/, !1],
|
|
417
417
|
[/^(\/\/|["'#]|;{1,2}|%{1,2}|--)(.*)$/, !0],
|
|
418
418
|
[/^(\*)(.+)$/, !0]
|
|
419
419
|
];
|
|
420
|
-
function
|
|
420
|
+
function Be(e, t, n) {
|
|
421
421
|
let r = [];
|
|
422
422
|
for (let i of e) {
|
|
423
423
|
if (n === "v3") {
|
|
@@ -426,8 +426,8 @@ function ze(e, t, n) {
|
|
|
426
426
|
let n = e.children[0];
|
|
427
427
|
if (n.type !== "text") return e;
|
|
428
428
|
let r = t === i.children.length - 1;
|
|
429
|
-
if (!
|
|
430
|
-
let a = n.value.split(
|
|
429
|
+
if (!R(n.value, r)) return e;
|
|
430
|
+
let a = n.value.split(Ie);
|
|
431
431
|
if (a.length <= 1) return e;
|
|
432
432
|
let o = [a[0]];
|
|
433
433
|
for (let e = 1; e < a.length; e += 2) o.push(a[e] + (a[e + 1] || ""));
|
|
@@ -448,13 +448,13 @@ function ze(e, t, n) {
|
|
|
448
448
|
if (a.type !== "element") continue;
|
|
449
449
|
let o = a.children.at(0);
|
|
450
450
|
if (o?.type !== "text") continue;
|
|
451
|
-
let s = n === e.length - 1, c =
|
|
451
|
+
let s = n === e.length - 1, c = R(o.value, s), l;
|
|
452
452
|
if (!c && n > 0 && o.value.trim().startsWith("[!code")) {
|
|
453
453
|
let t = e[n - 1];
|
|
454
454
|
if (t?.type === "element") {
|
|
455
455
|
let n = t.children.at(0);
|
|
456
456
|
if (n?.type === "text" && n.value.includes("//")) {
|
|
457
|
-
let l =
|
|
457
|
+
let l = R(n.value + o.value, s);
|
|
458
458
|
if (l) {
|
|
459
459
|
c = l, r.push({
|
|
460
460
|
info: l,
|
|
@@ -471,7 +471,7 @@ function ze(e, t, n) {
|
|
|
471
471
|
}
|
|
472
472
|
if (c) {
|
|
473
473
|
if (t && !s && n !== 0) {
|
|
474
|
-
let t =
|
|
474
|
+
let t = Ve(e[n - 1], "{") && Ve(e[n + 1], "}");
|
|
475
475
|
r.push({
|
|
476
476
|
info: c,
|
|
477
477
|
line: i,
|
|
@@ -493,16 +493,16 @@ function ze(e, t, n) {
|
|
|
493
493
|
}
|
|
494
494
|
return r;
|
|
495
495
|
}
|
|
496
|
-
function
|
|
496
|
+
function Ve(e, t) {
|
|
497
497
|
if (e.type !== "element") return !1;
|
|
498
498
|
let n = e.children[0];
|
|
499
499
|
return n.type === "text" && n.value.trim() === t;
|
|
500
500
|
}
|
|
501
|
-
function
|
|
501
|
+
function R(e, t) {
|
|
502
502
|
let n = e.trimStart(), r = e.length - n.length;
|
|
503
503
|
n = n.trimEnd();
|
|
504
504
|
let i = e.length - n.length - r;
|
|
505
|
-
for (let [e, a] of
|
|
505
|
+
for (let [e, a] of ze) {
|
|
506
506
|
if (a && !t) continue;
|
|
507
507
|
let o = e.exec(n);
|
|
508
508
|
if (o) return [
|
|
@@ -512,22 +512,22 @@ function z(e, t) {
|
|
|
512
512
|
];
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
|
-
function Ve(e) {
|
|
516
|
-
let t = e.match(Ie);
|
|
517
|
-
return t && t[1].trim().length === 0 ? e.slice(0, t.index) : e;
|
|
518
|
-
}
|
|
519
515
|
function He(e) {
|
|
520
516
|
let t = e.match(Le);
|
|
517
|
+
return t && t[1].trim().length === 0 ? e.slice(0, t.index) : e;
|
|
518
|
+
}
|
|
519
|
+
function Ue(e) {
|
|
520
|
+
let t = e.match(Re);
|
|
521
521
|
return t && t[1].trim().length === 0 ? e.slice(0, t.index).trimEnd() : e;
|
|
522
522
|
}
|
|
523
|
-
function
|
|
523
|
+
function We(e, t, n, r) {
|
|
524
524
|
return r ??= "v3", {
|
|
525
525
|
name: e,
|
|
526
526
|
code(e) {
|
|
527
527
|
let i = e.children.filter((e) => e.type === "element"), a = [];
|
|
528
528
|
e.data ??= {};
|
|
529
529
|
let o = e.data;
|
|
530
|
-
o._shiki_notation ??=
|
|
530
|
+
o._shiki_notation ??= Be(i, ["jsx", "tsx"].includes(this.options.lang), r);
|
|
531
531
|
let s = o._shiki_notation;
|
|
532
532
|
for (let e of s) {
|
|
533
533
|
if (e.info[1].length === 0) continue;
|
|
@@ -535,7 +535,7 @@ function Ue(e, t, n, r) {
|
|
|
535
535
|
e.isLineCommentOnly && r !== "v1" && o++;
|
|
536
536
|
let s = !1;
|
|
537
537
|
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;
|
|
538
|
-
r === "v1" ? e.info[1] =
|
|
538
|
+
r === "v1" ? e.info[1] = He(e.info[1]) : r === "v3" && (e.info[1] = Ue(e.info[1]));
|
|
539
539
|
let c = e.info[1].trim().length === 0;
|
|
540
540
|
if (c && (e.info[1] = ""), c && e.isLineCommentOnly) a.push(e.line);
|
|
541
541
|
else if (c && e.isJsxStyle) e.line.children.splice(e.line.children.indexOf(e.token) - 1, 3);
|
|
@@ -560,44 +560,44 @@ function Ue(e, t, n, r) {
|
|
|
560
560
|
}
|
|
561
561
|
};
|
|
562
562
|
}
|
|
563
|
-
var
|
|
564
|
-
function
|
|
563
|
+
var Ge = /\{([\d,-]+)\}/;
|
|
564
|
+
function Ke(e) {
|
|
565
565
|
if (!e) return null;
|
|
566
|
-
let t = e.match(
|
|
566
|
+
let t = e.match(Ge);
|
|
567
567
|
return t ? t[1].split(",").flatMap((e) => {
|
|
568
568
|
let t = e.split("-").map((e) => Number.parseInt(e, 10));
|
|
569
569
|
return t.length === 1 ? [t[0]] : Array.from({ length: t[1] - t[0] + 1 }, (e, n) => t[0] + n);
|
|
570
570
|
}) : null;
|
|
571
571
|
}
|
|
572
|
-
var
|
|
573
|
-
function
|
|
572
|
+
var qe = Symbol("highlighted-lines");
|
|
573
|
+
function Je(e = {}) {
|
|
574
574
|
let { className: t = "highlighted", zeroIndexed: n = !1 } = e;
|
|
575
575
|
return {
|
|
576
576
|
name: "@shikijs/transformers:meta-highlight",
|
|
577
577
|
line(e, r) {
|
|
578
578
|
if (!this.options.meta?.__raw) return;
|
|
579
579
|
let i = this.meta;
|
|
580
|
-
i[
|
|
581
|
-
let a = i[
|
|
580
|
+
i[qe] ??= Ke(this.options.meta.__raw);
|
|
581
|
+
let a = i[qe] ?? [], o = n ? r - 1 : r;
|
|
582
582
|
return a.includes(o) && this.addClassToHast(e, t), e;
|
|
583
583
|
}
|
|
584
584
|
};
|
|
585
585
|
}
|
|
586
|
-
var
|
|
587
|
-
function
|
|
588
|
-
return e.replace(
|
|
586
|
+
var Ye = /[.*+?^${}()|[\]\\]/g;
|
|
587
|
+
function Xe(e) {
|
|
588
|
+
return e.replace(Ye, "\\$&");
|
|
589
589
|
}
|
|
590
|
-
function
|
|
590
|
+
function z(e = {}, t = "@shikijs/transformers:notation-map") {
|
|
591
591
|
let { classMap: n = {}, classActivePre: r = void 0, classActiveCode: i = void 0 } = e;
|
|
592
|
-
return
|
|
592
|
+
return We(t, RegExp(`#?\\s*\\[!code (${Object.keys(n).map(Xe).join("|")})(:\\d+)?\\]`, "gi"), function([e, t, a = ":1"], o, s, c, l) {
|
|
593
593
|
let u = Number.parseInt(a.slice(1), 10);
|
|
594
594
|
for (let e = l; e < Math.min(l + u, c.length); e++) this.addClassToHast(c[e], n[t]);
|
|
595
595
|
return r && this.addClassToHast(this.pre, r), i && this.addClassToHast(this.code, i), !0;
|
|
596
596
|
}, e.matchAlgorithm);
|
|
597
597
|
}
|
|
598
|
-
function
|
|
598
|
+
function Ze(e = {}) {
|
|
599
599
|
let { classLineAdd: t = "diff add", classLineRemove: n = "diff remove", classActivePre: r = "has-diff", classActiveCode: i } = e;
|
|
600
|
-
return
|
|
600
|
+
return z({
|
|
601
601
|
classMap: {
|
|
602
602
|
"++": t,
|
|
603
603
|
"--": n
|
|
@@ -607,31 +607,31 @@ function Xe(e = {}) {
|
|
|
607
607
|
matchAlgorithm: e.matchAlgorithm
|
|
608
608
|
}, "@shikijs/transformers:notation-diff");
|
|
609
609
|
}
|
|
610
|
-
function
|
|
610
|
+
function Qe(e = {}) {
|
|
611
611
|
let { classMap: t = {
|
|
612
612
|
error: ["highlighted", "error"],
|
|
613
613
|
warning: ["highlighted", "warning"],
|
|
614
614
|
info: ["highlighted", "info"]
|
|
615
615
|
}, classActivePre: n = "has-highlighted", classActiveCode: r } = e;
|
|
616
|
-
return
|
|
616
|
+
return z({
|
|
617
617
|
classMap: t,
|
|
618
618
|
classActivePre: n,
|
|
619
619
|
classActiveCode: r,
|
|
620
620
|
matchAlgorithm: e.matchAlgorithm
|
|
621
621
|
}, "@shikijs/transformers:notation-error-level");
|
|
622
622
|
}
|
|
623
|
-
function
|
|
623
|
+
function $e(e = {}) {
|
|
624
624
|
let { classActiveLine: t = "focused", classActivePre: n = "has-focused", classActiveCode: r } = e;
|
|
625
|
-
return
|
|
625
|
+
return z({
|
|
626
626
|
classMap: { focus: t },
|
|
627
627
|
classActivePre: n,
|
|
628
628
|
classActiveCode: r,
|
|
629
629
|
matchAlgorithm: e.matchAlgorithm
|
|
630
630
|
}, "@shikijs/transformers:notation-focus");
|
|
631
631
|
}
|
|
632
|
-
function
|
|
632
|
+
function et(e = {}) {
|
|
633
633
|
let { classActiveLine: t = "highlighted", classActivePre: n = "has-highlighted", classActiveCode: r } = e;
|
|
634
|
-
return
|
|
634
|
+
return z({
|
|
635
635
|
classMap: {
|
|
636
636
|
highlight: t,
|
|
637
637
|
hl: t
|
|
@@ -643,42 +643,42 @@ function $e(e = {}) {
|
|
|
643
643
|
}
|
|
644
644
|
//#endregion
|
|
645
645
|
//#region src/node/lib/render/highlight/language.ts
|
|
646
|
-
var
|
|
646
|
+
var tt = [
|
|
647
647
|
"shellscript",
|
|
648
648
|
"shell",
|
|
649
649
|
"bash",
|
|
650
650
|
"sh",
|
|
651
651
|
"zsh"
|
|
652
652
|
];
|
|
653
|
-
function
|
|
654
|
-
return
|
|
653
|
+
function nt(e) {
|
|
654
|
+
return tt.includes(e);
|
|
655
655
|
}
|
|
656
|
-
var
|
|
657
|
-
function
|
|
658
|
-
return
|
|
656
|
+
var rt = /^[a-zA-Z0-9-_]+/;
|
|
657
|
+
function it(e) {
|
|
658
|
+
return rt.exec(e)?.[0] || "";
|
|
659
659
|
}
|
|
660
660
|
//#endregion
|
|
661
661
|
//#region src/node/lib/render/highlight/index.ts
|
|
662
|
-
var
|
|
662
|
+
var at = new FinalizationRegistry((e) => {
|
|
663
663
|
e();
|
|
664
|
-
}),
|
|
664
|
+
}), B = {
|
|
665
665
|
light: "github-light",
|
|
666
666
|
dark: "github-dark"
|
|
667
667
|
};
|
|
668
|
-
async function
|
|
668
|
+
async function ot() {
|
|
669
669
|
let e = await me({
|
|
670
|
-
themes: [
|
|
670
|
+
themes: [B.light, B.dark],
|
|
671
671
|
langs: []
|
|
672
672
|
}), t = [
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
673
|
+
Je(),
|
|
674
|
+
Ze(),
|
|
675
|
+
$e({
|
|
676
676
|
classActiveLine: "has-focus",
|
|
677
677
|
classActivePre: "has-focused-lines"
|
|
678
678
|
}),
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
679
|
+
et(),
|
|
680
|
+
Qe(),
|
|
681
|
+
st(),
|
|
682
682
|
{
|
|
683
683
|
name: "typedown:add-dir",
|
|
684
684
|
pre(e) {
|
|
@@ -687,7 +687,7 @@ async function at() {
|
|
|
687
687
|
}
|
|
688
688
|
], n = new Set(e.getLoadedLanguages());
|
|
689
689
|
async function r(r, i, a) {
|
|
690
|
-
let o =
|
|
690
|
+
let o = it(i);
|
|
691
691
|
if (o) {
|
|
692
692
|
let e = i;
|
|
693
693
|
i = o.toLowerCase(), a = e.slice(i.length).replace(/(?<!=)\{/g, " {") + " " + a, a = a.trim().replace(/\s+/g, " ");
|
|
@@ -716,7 +716,7 @@ async function at() {
|
|
|
716
716
|
}
|
|
717
717
|
}],
|
|
718
718
|
meta: { __raw: a },
|
|
719
|
-
themes:
|
|
719
|
+
themes: B,
|
|
720
720
|
defaultColor: !1,
|
|
721
721
|
colorReplacements: {
|
|
722
722
|
"github-light": {
|
|
@@ -741,13 +741,13 @@ async function at() {
|
|
|
741
741
|
}
|
|
742
742
|
});
|
|
743
743
|
}
|
|
744
|
-
return
|
|
744
|
+
return at.register(r, () => e.dispose()), r;
|
|
745
745
|
}
|
|
746
|
-
function
|
|
746
|
+
function st() {
|
|
747
747
|
return {
|
|
748
748
|
name: "typedown:disable-shell-symbol-select",
|
|
749
749
|
tokens(e) {
|
|
750
|
-
if (
|
|
750
|
+
if (nt(this.options.lang)) for (let t of e) {
|
|
751
751
|
if (t.length < 2) continue;
|
|
752
752
|
let e = t[0].content.trim();
|
|
753
753
|
(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));
|
|
@@ -757,20 +757,20 @@ function ot() {
|
|
|
757
757
|
}
|
|
758
758
|
//#endregion
|
|
759
759
|
//#region src/node/lib/render/postprocess.ts
|
|
760
|
-
var
|
|
761
|
-
async function
|
|
762
|
-
return e = await
|
|
760
|
+
var V;
|
|
761
|
+
async function ct(e) {
|
|
762
|
+
return e = await dt(e), e = ht(e), e;
|
|
763
763
|
}
|
|
764
|
-
function
|
|
765
|
-
return
|
|
764
|
+
function lt() {
|
|
765
|
+
return V ||= ot(), V;
|
|
766
766
|
}
|
|
767
|
-
var
|
|
768
|
-
async function
|
|
769
|
-
let t = await
|
|
767
|
+
var ut = /<pre class="td-code-placeholder"(?: data-lang="([^"]*)")?(?: data-meta="([^"]*)")?><code>([\s\S]*?)<\/code><\/pre>/g;
|
|
768
|
+
async function dt(e) {
|
|
769
|
+
let t = await lt(), n = [...e.matchAll(ut)];
|
|
770
770
|
if (n.length === 0) return e;
|
|
771
771
|
let r = await Promise.all(n.map(async (e) => {
|
|
772
772
|
let n = e[1] || "", r = e[2] || "", i = m(e[3]);
|
|
773
|
-
return
|
|
773
|
+
return ft(await t(i, n, r), n, r);
|
|
774
774
|
})), i = e;
|
|
775
775
|
for (let e = n.length - 1; 0 <= e; e--) {
|
|
776
776
|
let t = n[e];
|
|
@@ -778,7 +778,7 @@ async function ut(e) {
|
|
|
778
778
|
}
|
|
779
779
|
return i;
|
|
780
780
|
}
|
|
781
|
-
function
|
|
781
|
+
function ft(e, t, n) {
|
|
782
782
|
t ||= "txt";
|
|
783
783
|
let r = t.replace(/_/g, " "), i = `<div class="language-${t}"><button title="Copy code" data-copied="Copied" class="copy"></button><span class="lang">${r}</span>` + e + "</div>";
|
|
784
784
|
if (/:line-numbers\b/.test(n)) {
|
|
@@ -789,11 +789,11 @@ function dt(e, t, n) {
|
|
|
789
789
|
}
|
|
790
790
|
return i;
|
|
791
791
|
}
|
|
792
|
-
var
|
|
793
|
-
function
|
|
794
|
-
return e = e.replace(
|
|
792
|
+
var pt = /<span class="td-math-inline">([\s\S]*?)<\/span>/g, mt = /<div class="td-math-block">([\s\S]*?)<\/div>/g;
|
|
793
|
+
function ht(e) {
|
|
794
|
+
return e = e.replace(pt, (e, t) => H(t, !1)), e = e.replace(mt, (e, t) => H(t, !0)), e;
|
|
795
795
|
}
|
|
796
|
-
function
|
|
796
|
+
function H(e, t) {
|
|
797
797
|
let n = t ? "div" : "span";
|
|
798
798
|
try {
|
|
799
799
|
return ne.renderToString(m(e), {
|
|
@@ -806,7 +806,7 @@ function U(e, t) {
|
|
|
806
806
|
}
|
|
807
807
|
//#endregion
|
|
808
808
|
//#region src/node/lib/render/vue.ts
|
|
809
|
-
async function
|
|
809
|
+
async function U(e, t, n) {
|
|
810
810
|
let r = t.title || t.label || (f(n) ? b(n, (await e.getConfig()).siteTitle) : S(n));
|
|
811
811
|
return {
|
|
812
812
|
schema: t.schema,
|
|
@@ -814,14 +814,14 @@ async function W(e, t, n) {
|
|
|
814
814
|
label: t.label,
|
|
815
815
|
icon: t.icon,
|
|
816
816
|
frontmatter: t.header ?? {},
|
|
817
|
-
headings:
|
|
817
|
+
headings: _t(t.headings),
|
|
818
818
|
title: r,
|
|
819
819
|
fileMetadata: t.fileMetadata,
|
|
820
820
|
seoMetadata: t.seoMetadata
|
|
821
821
|
};
|
|
822
822
|
}
|
|
823
|
-
async function
|
|
824
|
-
let r = await
|
|
823
|
+
async function gt(e, t, n) {
|
|
824
|
+
let r = await ct(t.content), i = await U(e, t, n), a = JSON.stringify(`@typedown/pages?resource=${encodeURIComponent(n)}`);
|
|
825
825
|
return {
|
|
826
826
|
vueSrc: [
|
|
827
827
|
"<script>",
|
|
@@ -833,12 +833,12 @@ async function ht(e, t, n) {
|
|
|
833
833
|
`import { pageData } from ${a}`,
|
|
834
834
|
"useRouter().route.data = pageData",
|
|
835
835
|
"<\/script>",
|
|
836
|
-
`<template><div class="typedown-content">\n${
|
|
836
|
+
`<template><div class="typedown-content">\n${vt(r)}\n</div></template>`
|
|
837
837
|
].join("\n"),
|
|
838
838
|
pageData: i
|
|
839
839
|
};
|
|
840
840
|
}
|
|
841
|
-
function
|
|
841
|
+
function _t(e) {
|
|
842
842
|
let t = [], n = [];
|
|
843
843
|
for (let r of e) {
|
|
844
844
|
let e = {
|
|
@@ -854,37 +854,37 @@ function gt(e) {
|
|
|
854
854
|
}
|
|
855
855
|
return t;
|
|
856
856
|
}
|
|
857
|
-
function
|
|
857
|
+
function vt(e) {
|
|
858
858
|
return e.replaceAll("{{", "{{").replaceAll("}}", "}}");
|
|
859
859
|
}
|
|
860
860
|
//#endregion
|
|
861
861
|
//#region src/node/plugin/vite/constants.ts
|
|
862
|
-
var
|
|
863
|
-
|
|
864
|
-
var
|
|
862
|
+
var yt = "@typedown/app", W = "\0@typedown/app", G = "@typedown/pages", K = "\0" + G;
|
|
863
|
+
G + "";
|
|
864
|
+
var q = "\0@typedown/pages?resource=", J = "@typedown/site-data", bt = "\0@typedown/site-data", Y = "@typedown/search-index", xt = "\0@typedown/search-index", X = "typedown:page-data";
|
|
865
865
|
//#endregion
|
|
866
866
|
//#region src/node/plugin/vite/virtual/utils.ts
|
|
867
867
|
function Z(e, t) {
|
|
868
868
|
let n = e.moduleGraph.getModuleById(t);
|
|
869
869
|
if (!n) return;
|
|
870
870
|
e.moduleGraph.invalidateModule(n);
|
|
871
|
-
let r =
|
|
871
|
+
let r = St(n.url);
|
|
872
872
|
for (let t of n.importers) e.hot.send({
|
|
873
873
|
type: "update",
|
|
874
874
|
updates: [{
|
|
875
875
|
type: "js-update",
|
|
876
|
-
path:
|
|
876
|
+
path: St(t.url),
|
|
877
877
|
acceptedPath: r,
|
|
878
878
|
timestamp: Date.now()
|
|
879
879
|
}]
|
|
880
880
|
});
|
|
881
881
|
}
|
|
882
|
-
function
|
|
882
|
+
function St(e) {
|
|
883
883
|
return e.startsWith("\0") ? "/@id/__x00__" + e.slice(1) : e;
|
|
884
884
|
}
|
|
885
885
|
//#endregion
|
|
886
886
|
//#region src/node/plugin/vite/virtual/app.ts
|
|
887
|
-
var
|
|
887
|
+
var Ct = class {
|
|
888
888
|
async load(e) {
|
|
889
889
|
let t = await e.getConfig();
|
|
890
890
|
return Q({
|
|
@@ -893,7 +893,7 @@ var St = class {
|
|
|
893
893
|
});
|
|
894
894
|
}
|
|
895
895
|
invalidate(e) {
|
|
896
|
-
Z(e,
|
|
896
|
+
Z(e, W);
|
|
897
897
|
}
|
|
898
898
|
};
|
|
899
899
|
function Q(e) {
|
|
@@ -916,8 +916,8 @@ import { TdDirectoryIndex, TdGlossaryIndex } from 'typerighter/client/theme-defa
|
|
|
916
916
|
import { isIndexUrl, getDirectoryFromPageUrl, getParentUrl, path } from 'typerighter/shared';
|
|
917
917
|
import { h } from 'vue';
|
|
918
918
|
import theme from 'typerighter/client/theme-default';
|
|
919
|
-
import { pages as initialPages } from '${
|
|
920
|
-
import initialSiteData from '${
|
|
919
|
+
import { pages as initialPages } from '${G}';
|
|
920
|
+
import initialSiteData from '${J}';
|
|
921
921
|
let pages = initialPages;
|
|
922
922
|
const contentExts = ${JSON.stringify(i)};
|
|
923
923
|
|
|
@@ -948,11 +948,11 @@ const { app, router, searchIndex: searchIndexRef, siteData } = await createTyped
|
|
|
948
948
|
app.mount('#app');
|
|
949
949
|
|
|
950
950
|
// Load search index in the background after the app is mounted
|
|
951
|
-
import('${
|
|
951
|
+
import('${Y}').then((m) => { searchIndexRef.value = m.default; });
|
|
952
952
|
|
|
953
953
|
// Accept HMR so modules update without a full page reload
|
|
954
954
|
if (import.meta.hot) {
|
|
955
|
-
import.meta.hot.accept('${
|
|
955
|
+
import.meta.hot.accept('${G}', (m) => {
|
|
956
956
|
if (!m) return;
|
|
957
957
|
const base = path.join('/', '${t}', router.route.path);
|
|
958
958
|
const hadPage = !!findPage(base);
|
|
@@ -964,19 +964,28 @@ if (import.meta.hot) {
|
|
|
964
964
|
if (!hadPage && hasPage) router.go(router.route.path);
|
|
965
965
|
});
|
|
966
966
|
|
|
967
|
-
import.meta.hot.accept('${
|
|
967
|
+
import.meta.hot.accept('${Y}', (m) => {
|
|
968
968
|
if (m) searchIndexRef.value = m.default;
|
|
969
969
|
});
|
|
970
970
|
|
|
971
|
-
import.meta.hot.accept('${
|
|
971
|
+
import.meta.hot.accept('${J}', (m) => {
|
|
972
972
|
if (m) siteData.value = m.default;
|
|
973
973
|
});
|
|
974
|
+
|
|
975
|
+
// Update route.data directly when content changes - Vue SFC setup only re-runs on script block changes
|
|
976
|
+
import.meta.hot.on('${X}', ({ filepath, pageData }) => {
|
|
977
|
+
const eventBase = path.join('/', '${t}', path.stripExtension(filepath));
|
|
978
|
+
const routeBase = path.join('/', '${t}', router.route.path);
|
|
979
|
+
if (eventBase === routeBase) {
|
|
980
|
+
router.route.data = pageData;
|
|
981
|
+
}
|
|
982
|
+
});
|
|
974
983
|
}
|
|
975
984
|
`;
|
|
976
985
|
}
|
|
977
986
|
//#endregion
|
|
978
987
|
//#region src/node/plugin/vite/virtual/pages.ts
|
|
979
|
-
var
|
|
988
|
+
var wt = class {
|
|
980
989
|
async load(e) {
|
|
981
990
|
let t = (await e.getConfig()).rootDir ?? ".";
|
|
982
991
|
return `export const pages = import.meta.glob('${t === "." ? "/**/*.{td,md}" : `/${t}/**/*.{td,md}`}');`;
|
|
@@ -985,27 +994,42 @@ var Ct = class {
|
|
|
985
994
|
if (e.startsWith("@typedown/pages?resource=")) return "\0" + e;
|
|
986
995
|
}
|
|
987
996
|
isPageDataModule(e) {
|
|
988
|
-
return e.startsWith(
|
|
997
|
+
return e.startsWith(q);
|
|
989
998
|
}
|
|
990
999
|
async loadPageData(e, t) {
|
|
991
|
-
let n = decodeURIComponent(e.slice(
|
|
1000
|
+
let n = decodeURIComponent(e.slice(q.length)), r = await U(t, await t.getFile(n), n);
|
|
992
1001
|
return `export const pageData = ${JSON.stringify(r)}`;
|
|
993
1002
|
}
|
|
994
1003
|
invalidatePageData(e, t) {
|
|
995
|
-
Z(e,
|
|
1004
|
+
Z(e, q + encodeURIComponent(t));
|
|
1005
|
+
}
|
|
1006
|
+
sendPageData(e, t, n) {
|
|
1007
|
+
t.getFile(n).then(async (r) => {
|
|
1008
|
+
let i = await U(t, r, n);
|
|
1009
|
+
e.hot.send({
|
|
1010
|
+
type: "custom",
|
|
1011
|
+
event: X,
|
|
1012
|
+
data: {
|
|
1013
|
+
filepath: n,
|
|
1014
|
+
pageData: i
|
|
1015
|
+
}
|
|
1016
|
+
});
|
|
1017
|
+
}).catch((e) => {
|
|
1018
|
+
console.error("[typedown] Failed to send page data:", e instanceof Error ? e.message : e);
|
|
1019
|
+
});
|
|
996
1020
|
}
|
|
997
1021
|
invalidate(e) {
|
|
998
|
-
Z(e,
|
|
1022
|
+
Z(e, K);
|
|
999
1023
|
}
|
|
1000
|
-
},
|
|
1024
|
+
}, Tt = "\0@typedown/site-data", Et = {
|
|
1001
1025
|
ready: !1,
|
|
1002
1026
|
contentTree: { entries: [] },
|
|
1003
1027
|
schemas: {},
|
|
1004
1028
|
directoryListings: {}
|
|
1005
|
-
},
|
|
1029
|
+
}, Dt = class {
|
|
1006
1030
|
data;
|
|
1007
1031
|
scan(e) {
|
|
1008
|
-
let t =
|
|
1032
|
+
let t = ye("**/*.td", {
|
|
1009
1033
|
cwd: e,
|
|
1010
1034
|
exclude: (e) => e.startsWith("_")
|
|
1011
1035
|
}).map((e) => ({
|
|
@@ -1023,27 +1047,27 @@ var Ct = class {
|
|
|
1023
1047
|
let t = this.data ? {
|
|
1024
1048
|
ready: !0,
|
|
1025
1049
|
...this.data
|
|
1026
|
-
} :
|
|
1050
|
+
} : Et;
|
|
1027
1051
|
return `export default ${JSON.stringify(t)}`;
|
|
1028
1052
|
}
|
|
1029
1053
|
clear() {
|
|
1030
1054
|
this.data = void 0;
|
|
1031
1055
|
}
|
|
1032
1056
|
fetch = v((e, t) => {
|
|
1033
|
-
|
|
1057
|
+
Ot(e).then((e) => {
|
|
1034
1058
|
this.data = e, t && this.invalidate(t);
|
|
1035
1059
|
}).catch((e) => {
|
|
1036
1060
|
console.error("[typedown] Failed to fetch site data:", e instanceof Error ? e.message : e);
|
|
1037
1061
|
});
|
|
1038
1062
|
}, 200);
|
|
1039
1063
|
async fetchSync(e) {
|
|
1040
|
-
this.data = await
|
|
1064
|
+
this.data = await Ot(e);
|
|
1041
1065
|
}
|
|
1042
1066
|
invalidate(e) {
|
|
1043
|
-
Z(e,
|
|
1067
|
+
Z(e, Tt);
|
|
1044
1068
|
}
|
|
1045
1069
|
};
|
|
1046
|
-
async function
|
|
1070
|
+
async function Ot(e) {
|
|
1047
1071
|
let [t, n, r] = await Promise.all([
|
|
1048
1072
|
e.getConfig(),
|
|
1049
1073
|
e.listSidebar(),
|
|
@@ -1060,7 +1084,7 @@ async function Dt(e) {
|
|
|
1060
1084
|
}
|
|
1061
1085
|
//#endregion
|
|
1062
1086
|
//#region src/node/lib/search-indexer/index.ts
|
|
1063
|
-
var
|
|
1087
|
+
var kt = class {
|
|
1064
1088
|
index;
|
|
1065
1089
|
constructor() {
|
|
1066
1090
|
this.index = new se({
|
|
@@ -1084,19 +1108,19 @@ var Ot = class {
|
|
|
1084
1108
|
};
|
|
1085
1109
|
//#endregion
|
|
1086
1110
|
//#region src/node/lib/search-indexer/scan.ts
|
|
1087
|
-
function
|
|
1088
|
-
let n =
|
|
1111
|
+
function At(e, t) {
|
|
1112
|
+
let n = Pt(e), r = [];
|
|
1089
1113
|
for (let t of n) {
|
|
1090
|
-
let n =
|
|
1114
|
+
let n = Nt(e, t);
|
|
1091
1115
|
n && r.push(n);
|
|
1092
1116
|
}
|
|
1093
1117
|
t.addAll(r);
|
|
1094
1118
|
}
|
|
1095
|
-
function
|
|
1096
|
-
let i =
|
|
1119
|
+
function jt(e, n, r) {
|
|
1120
|
+
let i = Nt(e, A(e, n));
|
|
1097
1121
|
i ? r.addPage(i) : r.discardPage(t(n));
|
|
1098
1122
|
}
|
|
1099
|
-
function
|
|
1123
|
+
function Mt(e, t) {
|
|
1100
1124
|
let n = S(e);
|
|
1101
1125
|
if (!t.startsWith("---")) return {
|
|
1102
1126
|
title: n,
|
|
@@ -1113,56 +1137,56 @@ function jt(e, t) {
|
|
|
1113
1137
|
body: a
|
|
1114
1138
|
};
|
|
1115
1139
|
}
|
|
1116
|
-
function
|
|
1140
|
+
function Nt(e, n) {
|
|
1117
1141
|
let r;
|
|
1118
1142
|
try {
|
|
1119
|
-
r =
|
|
1143
|
+
r = be(n, "utf-8");
|
|
1120
1144
|
} catch {
|
|
1121
1145
|
return;
|
|
1122
1146
|
}
|
|
1123
1147
|
if (!r.trim()) return;
|
|
1124
|
-
let i = n.slice(e.length + 1), { title: a, body: o } =
|
|
1148
|
+
let i = n.slice(e.length + 1), { title: a, body: o } = Mt(i, r);
|
|
1125
1149
|
return {
|
|
1126
1150
|
id: t(i),
|
|
1127
1151
|
title: a,
|
|
1128
1152
|
text: `${a}\n${o}`
|
|
1129
1153
|
};
|
|
1130
1154
|
}
|
|
1131
|
-
function
|
|
1132
|
-
return
|
|
1155
|
+
function Pt(e) {
|
|
1156
|
+
return ye("**/*.td", {
|
|
1133
1157
|
cwd: e,
|
|
1134
1158
|
exclude: (e) => e.startsWith("_")
|
|
1135
1159
|
}).map((t) => A(e, t));
|
|
1136
1160
|
}
|
|
1137
1161
|
//#endregion
|
|
1138
1162
|
//#region src/node/plugin/vite/virtual/search-index.ts
|
|
1139
|
-
var
|
|
1140
|
-
indexer = new
|
|
1163
|
+
var Ft = "\0@typedown/search-index", It = class {
|
|
1164
|
+
indexer = new kt();
|
|
1141
1165
|
load(e) {
|
|
1142
1166
|
return `export default ${JSON.stringify(this.indexer.serialize())}`;
|
|
1143
1167
|
}
|
|
1144
1168
|
index(e) {
|
|
1145
|
-
|
|
1169
|
+
At(e, this.indexer);
|
|
1146
1170
|
}
|
|
1147
1171
|
reindex(e, t) {
|
|
1148
|
-
|
|
1172
|
+
jt(e, t, this.indexer);
|
|
1149
1173
|
}
|
|
1150
1174
|
invalidate(e) {
|
|
1151
|
-
Z(e,
|
|
1175
|
+
Z(e, Ft);
|
|
1152
1176
|
}
|
|
1153
|
-
},
|
|
1154
|
-
function
|
|
1177
|
+
}, Lt = Se(import.meta.url);
|
|
1178
|
+
function Rt() {
|
|
1155
1179
|
return [{
|
|
1156
1180
|
find: "vue/server-renderer",
|
|
1157
|
-
replacement:
|
|
1181
|
+
replacement: Lt.resolve("vue/server-renderer")
|
|
1158
1182
|
}, {
|
|
1159
1183
|
find: "vue",
|
|
1160
|
-
replacement:
|
|
1184
|
+
replacement: Lt.resolve("vue/dist/vue.runtime.esm-bundler.js")
|
|
1161
1185
|
}];
|
|
1162
1186
|
}
|
|
1163
1187
|
//#endregion
|
|
1164
1188
|
//#region src/node/plugin/vite/middleware/vault-assets.ts
|
|
1165
|
-
var
|
|
1189
|
+
var zt = {
|
|
1166
1190
|
jpg: "image/jpeg",
|
|
1167
1191
|
jpeg: "image/jpeg",
|
|
1168
1192
|
png: "image/png",
|
|
@@ -1180,16 +1204,16 @@ var Rt = {
|
|
|
1180
1204
|
woff: "font/woff",
|
|
1181
1205
|
ttf: "font/ttf"
|
|
1182
1206
|
};
|
|
1183
|
-
function
|
|
1207
|
+
function Bt(t, r) {
|
|
1184
1208
|
return (i, o, s) => {
|
|
1185
1209
|
if (!i.url || i.method !== "GET" || o.writableEnded) return s();
|
|
1186
1210
|
let c = e(i.url);
|
|
1187
1211
|
if (c.startsWith("/@") || c.startsWith("/node_modules")) return s();
|
|
1188
1212
|
let l = n(r.basePath), u = (l && c.startsWith(l) ? c.slice(l.length) : c).replace(/^\//, ""), d = A(t.config.root, r.rootDirectory, u);
|
|
1189
1213
|
if (ve(d)) try {
|
|
1190
|
-
let e =
|
|
1214
|
+
let e = xe(d);
|
|
1191
1215
|
if (e.isFile()) {
|
|
1192
|
-
let t =
|
|
1216
|
+
let t = zt[a(d).slice(1).toLowerCase()] ?? "application/octet-stream";
|
|
1193
1217
|
o.setHeader("Content-Type", t), o.setHeader("Content-Length", e.size), _e(d).pipe(o);
|
|
1194
1218
|
return;
|
|
1195
1219
|
}
|
|
@@ -1199,7 +1223,7 @@ function zt(t, r) {
|
|
|
1199
1223
|
}
|
|
1200
1224
|
//#endregion
|
|
1201
1225
|
//#region src/node/plugin/vite/middleware/virtual-html.ts
|
|
1202
|
-
function
|
|
1226
|
+
function Vt(t, r, i) {
|
|
1203
1227
|
return (a, o, s) => {
|
|
1204
1228
|
if (!a.url) return s();
|
|
1205
1229
|
let c = n(e(a.url)), l = n(i.basePath);
|
|
@@ -1207,23 +1231,23 @@ function Bt(t, r, i) {
|
|
|
1207
1231
|
let u = c.slice(l.length);
|
|
1208
1232
|
if (u.startsWith("/@") || u.startsWith("/node_modules") || c.includes(".") && !c.endsWith("/index.html")) return s();
|
|
1209
1233
|
r.getConfig().then(async (e) => {
|
|
1210
|
-
let n = await t.transformIndexHtml(a.url ?? "",
|
|
1234
|
+
let n = await t.transformIndexHtml(a.url ?? "", Ht(i, e));
|
|
1211
1235
|
o.setHeader("Content-Type", "text/html"), o.end(n);
|
|
1212
1236
|
}).catch(() => s());
|
|
1213
1237
|
};
|
|
1214
1238
|
}
|
|
1215
|
-
function
|
|
1239
|
+
function Ht(e, t) {
|
|
1216
1240
|
return e.devHtml === void 0 && (e.devHtml = O({
|
|
1217
1241
|
title: t.siteTitle,
|
|
1218
1242
|
description: t.siteDescription,
|
|
1219
1243
|
base: "/",
|
|
1220
|
-
entryScript:
|
|
1244
|
+
entryScript: yt
|
|
1221
1245
|
})), e.devHtml;
|
|
1222
1246
|
}
|
|
1223
1247
|
//#endregion
|
|
1224
1248
|
//#region src/node/plugin/vite/index.ts
|
|
1225
|
-
function
|
|
1226
|
-
let t = e.context, n, i, a, o = new
|
|
1249
|
+
function Ut(e = {}) {
|
|
1250
|
+
let t = e.context, n, i, a, o = new Ct(), c = new wt(), l = new Dt(), u = new It(), d = {
|
|
1227
1251
|
devHtml: void 0,
|
|
1228
1252
|
basePath: "/",
|
|
1229
1253
|
rootDirectory: "vault"
|
|
@@ -1250,7 +1274,7 @@ function $(e = {}) {
|
|
|
1250
1274
|
port: n.server?.port ?? 8686,
|
|
1251
1275
|
strictPort: n.server?.strictPort ?? !1
|
|
1252
1276
|
},
|
|
1253
|
-
resolve: { alias:
|
|
1277
|
+
resolve: { alias: Rt() },
|
|
1254
1278
|
ssr: { noExternal: ["typerighter"] }
|
|
1255
1279
|
};
|
|
1256
1280
|
},
|
|
@@ -1262,17 +1286,17 @@ function $(e = {}) {
|
|
|
1262
1286
|
let e = await f(), t = await e.getConfig(), r = A(t.rootDir);
|
|
1263
1287
|
u.index(r), await l.fetchSync(e);
|
|
1264
1288
|
let i = await e.checkVault();
|
|
1265
|
-
if (
|
|
1289
|
+
if (qt(i.diagnostics), 0 < i.errorCount) {
|
|
1266
1290
|
let e = i.diagnostics.filter((e) => e.severity === "error").map((e) => ` ${e.filepath}:${e.line}:${e.column} - ${e.message} (${e.code})`);
|
|
1267
1291
|
this.error(`Vault check failed with ${i.errorCount} error(s):\n${e.join("\n")}`);
|
|
1268
1292
|
}
|
|
1269
1293
|
},
|
|
1270
1294
|
resolveId(e) {
|
|
1271
|
-
if (e === "/@typedown/app" || e === "@typedown/app") return
|
|
1272
|
-
if (e === "@typedown/pages") return
|
|
1295
|
+
if (e === "/@typedown/app" || e === "@typedown/app") return W;
|
|
1296
|
+
if (e === "@typedown/pages") return K;
|
|
1273
1297
|
if (e.startsWith("@typedown/pages?resource=")) return c.resolvePageData(e);
|
|
1274
|
-
if (e === "@typedown/site-data") return
|
|
1275
|
-
if (e === "@typedown/search-index") return
|
|
1298
|
+
if (e === "@typedown/site-data") return bt;
|
|
1299
|
+
if (e === "@typedown/search-index") return xt;
|
|
1276
1300
|
},
|
|
1277
1301
|
async load(e) {
|
|
1278
1302
|
if (c.isPageDataModule(e)) return c.loadPageData(e, await f());
|
|
@@ -1288,9 +1312,9 @@ function $(e = {}) {
|
|
|
1288
1312
|
let t = await f(), r = await t.getConfig(), i = A(r.rootDir);
|
|
1289
1313
|
u.index(i), l.scan(i), l.fetch(t, n), e.httpServer?.once("listening", async () => {
|
|
1290
1314
|
let e = await t.checkVault();
|
|
1291
|
-
0 < e.diagnostics.length && (console.error(""),
|
|
1315
|
+
0 < e.diagnostics.length && (console.error(""), qt(e.diagnostics));
|
|
1292
1316
|
}), t.rpc.onConfigChanged(() => {
|
|
1293
|
-
n && (d.devHtml = void 0, l.clear(), o.invalidate(n), c.invalidate(n),
|
|
1317
|
+
n && (d.devHtml = void 0, l.clear(), o.invalidate(n), c.invalidate(n), Gt(n), l.fetch(t, n));
|
|
1294
1318
|
});
|
|
1295
1319
|
function a(...e) {
|
|
1296
1320
|
n && t.getConfig().then((t) => {
|
|
@@ -1299,7 +1323,7 @@ function $(e = {}) {
|
|
|
1299
1323
|
for (let i of e) {
|
|
1300
1324
|
let e = ue(A(n.config.root, t.rootDir, i)), a = n.moduleGraph.getModulesByFile(e);
|
|
1301
1325
|
if (a?.size) {
|
|
1302
|
-
for (let e of a) n.moduleGraph.invalidateModule(e), r.push(
|
|
1326
|
+
for (let e of a) n.moduleGraph.invalidateModule(e), r.push($(e));
|
|
1303
1327
|
c.invalidatePageData(n, i);
|
|
1304
1328
|
}
|
|
1305
1329
|
}
|
|
@@ -1310,18 +1334,18 @@ function $(e = {}) {
|
|
|
1310
1334
|
}).catch(() => {});
|
|
1311
1335
|
}
|
|
1312
1336
|
t.rpc.onContentUpdated(({ filepath: e, affectedFiles: r = [] }) => {
|
|
1313
|
-
n && (u.reindex(i, e), u.invalidate(n), c.invalidate(n), l.fetch(t, n), a(e, ...r));
|
|
1337
|
+
n && (u.reindex(i, e), u.invalidate(n), c.invalidate(n), l.fetch(t, n), a(e, ...r), c.sendPageData(n, t, e));
|
|
1314
1338
|
}), t.rpc.onContentDeleted(({ filepath: e }) => {
|
|
1315
1339
|
n && (u.reindex(i, e), u.invalidate(n), c.invalidate(n), l.fetch(t, n), a(e));
|
|
1316
1340
|
});
|
|
1317
1341
|
function s() {
|
|
1318
|
-
n && (l.clear(),
|
|
1342
|
+
n && (l.clear(), Kt(n), l.fetch(t, n));
|
|
1319
1343
|
}
|
|
1320
1344
|
t.rpc.onSchemaUpdated(s), t.rpc.onSchemaDeleted(s);
|
|
1321
1345
|
let p = await t.getConfig();
|
|
1322
1346
|
d.basePath = p.basePath, d.rootDirectory = p.rootDir, t.rpc.onConfigChanged((e) => {
|
|
1323
1347
|
d.basePath = e.basePath, d.rootDirectory = e.rootDir, d.devHtml = void 0;
|
|
1324
|
-
}), e.middlewares.use(
|
|
1348
|
+
}), e.middlewares.use(Bt(e, d)), e.middlewares.use(Vt(e, t, d));
|
|
1325
1349
|
},
|
|
1326
1350
|
async transform(e, t) {
|
|
1327
1351
|
let n = t.split("?")[0];
|
|
@@ -1332,7 +1356,7 @@ function $(e = {}) {
|
|
|
1332
1356
|
};
|
|
1333
1357
|
let i = await f(), a = await i.getConfig(), o = r(n, a.rootDir);
|
|
1334
1358
|
try {
|
|
1335
|
-
let { vueSrc: e } = await
|
|
1359
|
+
let { vueSrc: e } = await gt(i, await i.getFile(o), o);
|
|
1336
1360
|
return {
|
|
1337
1361
|
code: e,
|
|
1338
1362
|
map: null
|
|
@@ -1349,7 +1373,7 @@ function $(e = {}) {
|
|
|
1349
1373
|
async closeBundle() {
|
|
1350
1374
|
if (!e.context && t) try {
|
|
1351
1375
|
let e = (await (await t.getTdContext()).getConfig()).basePath, n = e.startsWith(a) ? e.slice(a.length) : e.replace(/^\//, "");
|
|
1352
|
-
await
|
|
1376
|
+
await I(t, {
|
|
1353
1377
|
outDir: A(i, n),
|
|
1354
1378
|
base: e
|
|
1355
1379
|
});
|
|
@@ -1365,21 +1389,21 @@ function $(e = {}) {
|
|
|
1365
1389
|
...ce()
|
|
1366
1390
|
];
|
|
1367
1391
|
}
|
|
1368
|
-
function
|
|
1392
|
+
function Wt(e) {
|
|
1369
1393
|
return [...e.moduleGraph.idToModuleMap.entries()].filter(([e]) => e.endsWith(".td")).map(([, e]) => e);
|
|
1370
1394
|
}
|
|
1371
|
-
function
|
|
1372
|
-
for (let t of
|
|
1395
|
+
function Gt(e) {
|
|
1396
|
+
for (let t of Wt(e)) e.moduleGraph.invalidateModule(t);
|
|
1373
1397
|
e.hot.send({ type: "full-reload" });
|
|
1374
1398
|
}
|
|
1375
|
-
function
|
|
1376
|
-
let t =
|
|
1399
|
+
function Kt(e) {
|
|
1400
|
+
let t = Wt(e).map((t) => (e.moduleGraph.invalidateModule(t), $(t)));
|
|
1377
1401
|
0 < t.length && e.hot.send({
|
|
1378
1402
|
type: "update",
|
|
1379
1403
|
updates: t
|
|
1380
1404
|
});
|
|
1381
1405
|
}
|
|
1382
|
-
function
|
|
1406
|
+
function $(e) {
|
|
1383
1407
|
return {
|
|
1384
1408
|
type: "js-update",
|
|
1385
1409
|
path: e.url,
|
|
@@ -1387,11 +1411,11 @@ function Gt(e) {
|
|
|
1387
1411
|
timestamp: Date.now()
|
|
1388
1412
|
};
|
|
1389
1413
|
}
|
|
1390
|
-
function
|
|
1414
|
+
function qt(e) {
|
|
1391
1415
|
for (let t of e) {
|
|
1392
1416
|
let e = `${t.filepath}:${t.line}:${t.column}`, n = t.severity === "error" ? j.red("error") : j.yellow("warn");
|
|
1393
1417
|
console.error(` ${n} ${e} ${t.message} ${j.dim(`(${t.code})`)}`);
|
|
1394
1418
|
}
|
|
1395
1419
|
}
|
|
1396
1420
|
//#endregion
|
|
1397
|
-
export { Q as n,
|
|
1421
|
+
export { Q as n, I as r, Ut as t };
|