typerighter 0.44.0 → 0.44.1

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