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