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