typerighter 0.57.1 → 0.57.2
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/{cli-aIilXlJS.js → cli-Dpa3j5Sm.js} +5 -5
- package/dist/cli.js +1 -1
- package/dist/index.js +2 -2
- package/dist/{init-Bvm3vDph.js → init-DPhEzp34.js} +1 -1
- package/dist/node/build/index.d.ts +2 -2
- package/dist/node/build/index.d.ts.map +1 -1
- package/dist/{vite-ltcrEmat.js → vite-D3_cd2_2.js} +373 -371
- 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, H as r, I as i, O as a, R as o, T as s, U as c, Z as l, _ as u, b as d, c as f, d as p, et as m, g as h, h as g, i as _, nt as v, p as y, q as b, rt as x, v as
|
|
1
|
+
import { B as e, D as t, F as n, H as r, I as i, O as a, R as o, T as s, U as c, Z as l, _ as u, b as d, c as f, d as p, et as m, g as h, h as g, i as _, nt as v, p as y, q as b, rt as x, v as ee, x as S, y as C, z as w } from "./shared-dB08amQA.js";
|
|
2
2
|
import { n as T, t as E } from "./page-BbSO0VG8.js";
|
|
3
3
|
import { t as D } from "./temml-CjI4drVW.js";
|
|
4
|
-
import { a as O, i as
|
|
5
|
-
import { t as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { build as
|
|
11
|
-
import
|
|
12
|
-
import { fileURLToPath as
|
|
13
|
-
import
|
|
14
|
-
import { Worker as
|
|
15
|
-
import
|
|
16
|
-
import { createRequire as
|
|
17
|
-
import { createChecker as
|
|
18
|
-
import { createHighlighter as
|
|
4
|
+
import { a as O, i as k, n as te, r as ne } from "./context-CPrHBM3S.js";
|
|
5
|
+
import { t as re } from "./es-B_QJMowB.js";
|
|
6
|
+
import A, { resolve as j } from "node:path";
|
|
7
|
+
import M from "picocolors";
|
|
8
|
+
import ie from "@tailwindcss/vite";
|
|
9
|
+
import ae from "@vitejs/plugin-vue";
|
|
10
|
+
import { build as oe, normalizePath as N } from "vite";
|
|
11
|
+
import P, { readdir as se } from "node:fs/promises";
|
|
12
|
+
import { fileURLToPath as ce } from "node:url";
|
|
13
|
+
import le from "node:os";
|
|
14
|
+
import { Worker as ue } from "node:worker_threads";
|
|
15
|
+
import F, { createReadStream as de, existsSync as fe, globSync as pe, readFileSync as me, statSync as he } from "node:fs";
|
|
16
|
+
import { createRequire as ge } from "node:module";
|
|
17
|
+
import { createChecker as _e, createCheckerByJson as ve } from "vue-component-meta";
|
|
18
|
+
import { createHighlighter as ye, guessEmbeddedLanguages as be, isSpecialLang as xe } from "shiki";
|
|
19
19
|
// src/node/lib/worker-pool/index.ts
|
|
20
|
-
var
|
|
20
|
+
var Se = 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(le.cpus().length / 2));
|
|
27
27
|
for (let n = 0; n < t; n++) {
|
|
28
|
-
let t = new
|
|
28
|
+
let t = new ue(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,7 +62,7 @@ var Ce = class {
|
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
64
|
// src/node/build/seo/sitemap.ts
|
|
65
|
-
function
|
|
65
|
+
function Ce(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">
|
|
@@ -73,7 +73,7 @@ ${e.map((e) => {
|
|
|
73
73
|
</urlset>
|
|
74
74
|
`;
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function we(e, t) {
|
|
77
77
|
return `User-agent: *
|
|
78
78
|
Allow: /
|
|
79
79
|
|
|
@@ -81,7 +81,7 @@ Sitemap: ${e}${t}sitemap.xml
|
|
|
81
81
|
`;
|
|
82
82
|
}
|
|
83
83
|
// src/node/build/seo/feed.ts
|
|
84
|
-
function
|
|
84
|
+
function Te(e, t, n, i, a, o) {
|
|
85
85
|
let s = [...e].filter((e) => e.fileMetadata.mtimeSecs > 0).sort((e, t) => t.fileMetadata.mtimeSecs - e.fileMetadata.mtimeSecs).slice(0, 50).map((e) => {
|
|
86
86
|
let i = r(e.filepath), a = `${n}${t}${i}`, o = (/* @__PURE__ */ new Date(e.fileMetadata.mtimeSecs * 1e3)).toUTCString(), s = f(e.label ?? i), c = e.excerpt === void 0 ? "" : `<![CDATA[${e.excerpt}]]>`;
|
|
87
87
|
return ` <item>
|
|
@@ -106,19 +106,19 @@ ${s}
|
|
|
106
106
|
`;
|
|
107
107
|
}
|
|
108
108
|
// src/node/build/fonts.ts
|
|
109
|
-
function
|
|
110
|
-
let t =
|
|
109
|
+
function Ee(e) {
|
|
110
|
+
let t = A.basename(e);
|
|
111
111
|
return t.endsWith(".woff2") && t.includes("-latin-") && !t.includes("-latin-ext-");
|
|
112
112
|
}
|
|
113
113
|
// 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:
|
|
114
|
+
var De = 64;
|
|
115
|
+
async function Oe(e) {
|
|
116
|
+
let { clientEntry: t, cssFiles: n, fontFiles: r } = await je(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;
|
|
117
|
+
e.pageRoutes.length >= De ? await ke(e, t, i) : await Ae(e, t, i);
|
|
118
|
+
}
|
|
119
|
+
async function ke(e, t, n) {
|
|
120
|
+
let r = new Se({
|
|
121
|
+
filename: A.resolve(ce(import.meta.url), "../prerenderWorker.js"),
|
|
122
122
|
workerData: {
|
|
123
123
|
ssrEntryPath: e.ssrEntryPath,
|
|
124
124
|
base: e.base,
|
|
@@ -132,14 +132,14 @@ async function Ae(e, t, n) {
|
|
|
132
132
|
}), i = 0, a = e.pageRoutes.length;
|
|
133
133
|
try {
|
|
134
134
|
await Promise.all(e.pageRoutes.map(async (t) => {
|
|
135
|
-
let n = await r.run(t), o =
|
|
136
|
-
await
|
|
135
|
+
let n = await r.run(t), o = A.join(e.outDir, n.fileName);
|
|
136
|
+
await P.mkdir(A.dirname(o), { recursive: !0 }), await P.writeFile(o, n.html), i++, e.progress?.update(i, a);
|
|
137
137
|
}));
|
|
138
138
|
} finally {
|
|
139
139
|
await r.destroy();
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
async function
|
|
142
|
+
async function Ae(e, t, r) {
|
|
143
143
|
let i = await (await import(e.ssrEntryPath)).createRenderer(), a = e.pageRoutes.length, o = 0;
|
|
144
144
|
for (let s of e.pageRoutes) {
|
|
145
145
|
let c = await i(s), l = E(c.pageData, s, {
|
|
@@ -161,13 +161,13 @@ async function je(e, t, r) {
|
|
|
161
161
|
jsonLdBlocks: l.jsonLdBlocks,
|
|
162
162
|
headExtra: r,
|
|
163
163
|
appContent: c.html
|
|
164
|
-
}), d = l.isHomepage ? "index.html" : `${n(s)}.html`, f =
|
|
165
|
-
await
|
|
164
|
+
}), d = l.isHomepage ? "index.html" : `${n(s)}.html`, f = A.join(e.outDir, d);
|
|
165
|
+
await P.mkdir(A.dirname(f), { recursive: !0 }), await P.writeFile(f, u), o++, e.progress?.update(o, a);
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
|
-
async function
|
|
169
|
-
let t =
|
|
170
|
-
for (let e of Object.values(r)) e.isEntry ? (i = e.file, e.css && a.push(...e.css)) :
|
|
168
|
+
async function je(e) {
|
|
169
|
+
let t = A.join(e, ".vite", "manifest.json"), n = await P.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)) : Ee(e.file) && o.push(e.file);
|
|
171
171
|
return {
|
|
172
172
|
clientEntry: i,
|
|
173
173
|
cssFiles: a,
|
|
@@ -175,7 +175,7 @@ async function Me(e) {
|
|
|
175
175
|
};
|
|
176
176
|
}
|
|
177
177
|
// src/node/lib/codegen/app-entry.ts
|
|
178
|
-
function
|
|
178
|
+
function Me(e, t) {
|
|
179
179
|
let { rootDir: n = ".", mountPath: r = "", userComponents: i = [] } = e, a = [r, n === "." ? "" : n].filter(Boolean).join("/"), o = i.map((e) => `import ${e.name} from ${JSON.stringify(e.absolutePath)};`).join("\n"), s = i.map((e) => `app.component(${JSON.stringify(e.name)}, ${e.name});`).join("\n"), c = JSON.stringify({
|
|
180
180
|
title: e.siteTitle,
|
|
181
181
|
description: e.siteDescription,
|
|
@@ -233,11 +233,11 @@ if (import.meta.hot) {
|
|
|
233
233
|
`;
|
|
234
234
|
}
|
|
235
235
|
// src/node/lib/codegen/theme.ts
|
|
236
|
-
var
|
|
237
|
-
function
|
|
238
|
-
let n = e?.notFound ? `import CustomNotFound from ${JSON.stringify(t ?
|
|
236
|
+
var I = "typerighter/client/theme-default";
|
|
237
|
+
function Ne(e, t) {
|
|
238
|
+
let n = e?.notFound ? `import CustomNotFound from ${JSON.stringify(t ? A.resolve(t, e.notFound) : e.notFound)};` : "", r = e?.notFound ? ", NotFound: CustomNotFound" : "";
|
|
239
239
|
if (e?.component) {
|
|
240
|
-
let i = t ?
|
|
240
|
+
let i = t ? A.resolve(t, e.component) : e.component;
|
|
241
241
|
return [
|
|
242
242
|
`import CustomLayout from ${JSON.stringify(i)};`,
|
|
243
243
|
n,
|
|
@@ -248,74 +248,74 @@ function Pe(e, t) {
|
|
|
248
248
|
if (0 < i.length) {
|
|
249
249
|
let e = i.map(([e, t]) => `${JSON.stringify(b(e))}: () => h(resolveComponent(${JSON.stringify(t)}))`).join(", ");
|
|
250
250
|
return [
|
|
251
|
-
`import DefaultTheme from ${JSON.stringify(
|
|
251
|
+
`import DefaultTheme from ${JSON.stringify(I)};`,
|
|
252
252
|
"import { h, resolveComponent } from 'vue';",
|
|
253
253
|
n,
|
|
254
254
|
`export default { Layout: { render() { return h(DefaultTheme.Layout, null, { ${e} }); } }${r} };`
|
|
255
255
|
].filter(Boolean).join("\n");
|
|
256
256
|
}
|
|
257
257
|
return n ? [
|
|
258
|
-
`import DefaultTheme from ${JSON.stringify(
|
|
258
|
+
`import DefaultTheme from ${JSON.stringify(I)};`,
|
|
259
259
|
n,
|
|
260
260
|
`export default { ...DefaultTheme${r} };`
|
|
261
|
-
].join("\n") : `export { default } from ${JSON.stringify(
|
|
261
|
+
].join("\n") : `export { default } from ${JSON.stringify(I)};`;
|
|
262
262
|
}
|
|
263
263
|
// src/node/lib/components.ts
|
|
264
|
-
function
|
|
265
|
-
let t =
|
|
266
|
-
if (
|
|
267
|
-
let n =
|
|
268
|
-
return
|
|
264
|
+
function Pe(e) {
|
|
265
|
+
let t = A.join(e, "tsconfig.json");
|
|
266
|
+
if (F.existsSync(t)) return _e(t);
|
|
267
|
+
let n = Fe(e);
|
|
268
|
+
return ve(e, { compilerOptions: {
|
|
269
269
|
strict: !1,
|
|
270
270
|
jsx: "preserve",
|
|
271
271
|
jsxImportSource: "vue",
|
|
272
272
|
...n && { paths: n }
|
|
273
273
|
} });
|
|
274
274
|
}
|
|
275
|
-
async function
|
|
275
|
+
async function L(e, t) {
|
|
276
276
|
let n = [];
|
|
277
277
|
for (let r of e) if (r.kind === "dir") {
|
|
278
|
-
let e =
|
|
278
|
+
let e = A.resolve(t, r.path), i;
|
|
279
279
|
try {
|
|
280
|
-
i = await
|
|
280
|
+
i = await se(e, { withFileTypes: !0 });
|
|
281
281
|
} catch {
|
|
282
282
|
continue;
|
|
283
283
|
}
|
|
284
284
|
for (let t of i) if (t.isFile() && t.name.endsWith(".vue")) n.push({
|
|
285
285
|
name: t.name.slice(0, -4),
|
|
286
|
-
absolutePath:
|
|
286
|
+
absolutePath: A.join(e, t.name)
|
|
287
287
|
});
|
|
288
288
|
else if (t.isDirectory()) {
|
|
289
|
-
let r =
|
|
290
|
-
|
|
289
|
+
let r = A.join(e, t.name, "index.vue");
|
|
290
|
+
F.existsSync(r) && n.push({
|
|
291
291
|
name: t.name,
|
|
292
292
|
absolutePath: r
|
|
293
293
|
});
|
|
294
294
|
}
|
|
295
295
|
} else n.push({
|
|
296
296
|
name: r.name,
|
|
297
|
-
absolutePath:
|
|
297
|
+
absolutePath: A.resolve(t, r.source)
|
|
298
298
|
});
|
|
299
299
|
return n;
|
|
300
300
|
}
|
|
301
|
-
function
|
|
301
|
+
function Fe(e) {
|
|
302
302
|
try {
|
|
303
|
-
let t =
|
|
303
|
+
let t = ge(A.join(e, "package.json")), n = A.dirname(t.resolve("vue/package.json"));
|
|
304
304
|
return {
|
|
305
305
|
vue: [n],
|
|
306
|
-
"vue/*": [
|
|
306
|
+
"vue/*": [A.join(n, "*")]
|
|
307
307
|
};
|
|
308
308
|
} catch {
|
|
309
309
|
return;
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
312
|
// src/node/lib/progress.ts
|
|
313
|
-
var
|
|
313
|
+
var R = [
|
|
314
314
|
"◐",
|
|
315
315
|
"◓",
|
|
316
316
|
"◑",
|
|
317
317
|
"◒"
|
|
318
|
-
],
|
|
318
|
+
], z = class {
|
|
319
319
|
logger;
|
|
320
320
|
label;
|
|
321
321
|
start;
|
|
@@ -323,8 +323,8 @@ var L = [
|
|
|
323
323
|
constructor(e, t) {
|
|
324
324
|
if (this.logger = e, this.label = t, this.start = performance.now(), process.stdout.isTTY) {
|
|
325
325
|
let e = 0;
|
|
326
|
-
process.stdout.write(
|
|
327
|
-
e = (e + 1) %
|
|
326
|
+
process.stdout.write(M.cyan(`${R[0]} ${t}`)), this.spinnerInterval = setInterval(() => {
|
|
327
|
+
e = (e + 1) % R.length, process.stdout.write(`\r${M.cyan(`${R[e]} ${this.label}`)}`);
|
|
328
328
|
}, 120).unref();
|
|
329
329
|
} else this.logger.start(t);
|
|
330
330
|
}
|
|
@@ -336,83 +336,85 @@ var L = [
|
|
|
336
336
|
done(e) {
|
|
337
337
|
this.stopSpinner(), process.stdout.isTTY && process.stdout.write("\r\x1B[K");
|
|
338
338
|
let t = Math.round(performance.now() - this.start);
|
|
339
|
-
this.logger.success(`${e} (${
|
|
339
|
+
this.logger.success(`${e} (${Ie(t)})`);
|
|
340
340
|
}
|
|
341
341
|
stopSpinner() {
|
|
342
342
|
this.spinnerInterval &&= (clearInterval(this.spinnerInterval), void 0);
|
|
343
343
|
}
|
|
344
344
|
};
|
|
345
|
-
function
|
|
345
|
+
function Ie(e) {
|
|
346
346
|
return e < 1e3 ? `${Math.round(e)}ms` : `${(e / 1e3).toFixed(1)}s`;
|
|
347
347
|
}
|
|
348
348
|
// src/node/build/index.ts
|
|
349
|
-
async function
|
|
350
|
-
let { root: n, logger: i } = e, a =
|
|
351
|
-
await
|
|
349
|
+
async function Le(e, t = {}) {
|
|
350
|
+
let { root: n, logger: i } = e, a = A.resolve(n, t.outDir ?? "dist"), o = A.join(a, ".client"), s = A.join(a, ".server");
|
|
351
|
+
await P.rm(a, {
|
|
352
352
|
recursive: !0,
|
|
353
353
|
force: !0
|
|
354
354
|
});
|
|
355
|
-
let c = await e.getTdContext(), [l, u, d] = await Promise.all([
|
|
355
|
+
let c = await e.getTdContext(), [l, u, d, f] = await Promise.all([
|
|
356
356
|
c.getConfig(),
|
|
357
357
|
c.listFiles(),
|
|
358
|
-
c.listSidebar()
|
|
359
|
-
|
|
358
|
+
c.listSidebar(),
|
|
359
|
+
c.listSchemas()
|
|
360
|
+
]), p = await Promise.all(f.map(async (e) => [e, (await c.getSchema(e)).properties])), m = Object.fromEntries(p), h = l.origin ?? void 0, _ = l.author ?? void 0, v = l.license ?? void 0, y = l.repo ?? void 0, b = t.base ?? l.basePath ?? "/", x = S(b), ee = d.map((e) => ({
|
|
360
361
|
...e,
|
|
361
362
|
header: {}
|
|
362
|
-
})),
|
|
363
|
+
})), C = g(ee), w = JSON.stringify({
|
|
363
364
|
title: l.siteTitle,
|
|
364
365
|
description: l.siteDescription,
|
|
365
|
-
basePath:
|
|
366
|
-
origin:
|
|
366
|
+
basePath: x,
|
|
367
|
+
origin: h,
|
|
367
368
|
lang: l.lang,
|
|
368
369
|
rootDir: l.rootDir,
|
|
369
|
-
repo:
|
|
370
|
-
author:
|
|
371
|
-
license:
|
|
370
|
+
repo: y,
|
|
371
|
+
author: _,
|
|
372
|
+
license: v,
|
|
372
373
|
nav: l.nav
|
|
373
|
-
}),
|
|
374
|
+
}), T = JSON.stringify({
|
|
374
375
|
ready: !0,
|
|
375
|
-
contentTree:
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
376
|
+
contentTree: C,
|
|
377
|
+
schemas: m
|
|
378
|
+
}), E = A.join(n, "node_modules", ".typerighter");
|
|
379
|
+
await P.mkdir(E, { recursive: !0 });
|
|
380
|
+
let D = A.join(E, "client-entry.js"), O = A.join(E, "ssr-entry.js"), k = A.join(E, "theme.js"), te = await L(l.components, n), ne = Ne(l.layout ?? void 0, n);
|
|
379
381
|
await Promise.all([
|
|
380
|
-
|
|
382
|
+
P.writeFile(D, Me({
|
|
381
383
|
rootDir: l.rootDir,
|
|
382
|
-
basePath:
|
|
383
|
-
origin:
|
|
384
|
+
basePath: x,
|
|
385
|
+
origin: h,
|
|
384
386
|
lang: l.lang,
|
|
385
387
|
siteTitle: l.siteTitle,
|
|
386
388
|
siteDescription: l.siteDescription,
|
|
387
|
-
repo:
|
|
388
|
-
author:
|
|
389
|
-
license:
|
|
389
|
+
repo: y,
|
|
390
|
+
author: _,
|
|
391
|
+
license: v,
|
|
390
392
|
nav: l.nav,
|
|
391
|
-
userComponents:
|
|
393
|
+
userComponents: te
|
|
392
394
|
}, {
|
|
393
|
-
theme:
|
|
394
|
-
pages:
|
|
395
|
-
siteData:
|
|
396
|
-
searchIndex:
|
|
397
|
-
pageDataEvent:
|
|
395
|
+
theme: Y,
|
|
396
|
+
pages: G,
|
|
397
|
+
siteData: q,
|
|
398
|
+
searchIndex: J,
|
|
399
|
+
pageDataEvent: X
|
|
398
400
|
})),
|
|
399
|
-
|
|
401
|
+
P.writeFile(O, Re({
|
|
400
402
|
rootDir: l.rootDir,
|
|
401
|
-
siteConfig:
|
|
402
|
-
siteData:
|
|
403
|
-
themeModulePath:
|
|
404
|
-
userComponents:
|
|
403
|
+
siteConfig: w,
|
|
404
|
+
siteData: T,
|
|
405
|
+
themeModulePath: k,
|
|
406
|
+
userComponents: te
|
|
405
407
|
})),
|
|
406
|
-
|
|
408
|
+
P.writeFile(k, ne)
|
|
407
409
|
]);
|
|
408
410
|
try {
|
|
409
|
-
let c = _n({ context: e }),
|
|
410
|
-
await
|
|
411
|
+
let c = _n({ context: e }), f = e.createViteLogger(), p = new z(i, "Building client bundle...");
|
|
412
|
+
await oe({
|
|
411
413
|
...t.viteConfig,
|
|
412
414
|
root: n,
|
|
413
|
-
base:
|
|
415
|
+
base: x,
|
|
414
416
|
plugins: c,
|
|
415
|
-
customLogger:
|
|
417
|
+
customLogger: f,
|
|
416
418
|
logLevel: "silent",
|
|
417
419
|
build: {
|
|
418
420
|
...t.viteConfig?.build,
|
|
@@ -421,67 +423,67 @@ async function Re(e, t = {}) {
|
|
|
421
423
|
emptyOutDir: !0,
|
|
422
424
|
rollupOptions: {
|
|
423
425
|
...t.viteConfig?.build?.rollupOptions,
|
|
424
|
-
input:
|
|
426
|
+
input: D
|
|
425
427
|
}
|
|
426
428
|
}
|
|
427
429
|
});
|
|
428
|
-
let
|
|
429
|
-
|
|
430
|
-
let
|
|
431
|
-
await
|
|
430
|
+
let m = await P.readdir(A.join(o, "assets")).catch(() => []);
|
|
431
|
+
p.done(`Client bundle (${m.length} chunks)`);
|
|
432
|
+
let g = new z(i, "Building SSR bundle...");
|
|
433
|
+
await oe({
|
|
432
434
|
...t.viteConfig,
|
|
433
435
|
root: n,
|
|
434
|
-
base:
|
|
436
|
+
base: x,
|
|
435
437
|
plugins: c,
|
|
436
|
-
customLogger:
|
|
438
|
+
customLogger: f,
|
|
437
439
|
logLevel: "silent",
|
|
438
440
|
build: {
|
|
439
441
|
...t.viteConfig?.build,
|
|
440
442
|
outDir: s,
|
|
441
|
-
ssr:
|
|
443
|
+
ssr: O,
|
|
442
444
|
emptyOutDir: !0
|
|
443
445
|
}
|
|
444
|
-
}),
|
|
445
|
-
let
|
|
446
|
+
}), g.done("SSR bundle");
|
|
447
|
+
let v = u.map((e) => {
|
|
446
448
|
let t = r(e);
|
|
447
449
|
return t === "index" ? "/" : `/${t}`;
|
|
448
450
|
});
|
|
449
|
-
|
|
450
|
-
let
|
|
451
|
-
await
|
|
452
|
-
ssrEntryPath:
|
|
451
|
+
v.push("/"), Be(C.entries, v);
|
|
452
|
+
let y = new z(i, "Pre-rendering pages...");
|
|
453
|
+
await Oe({
|
|
454
|
+
ssrEntryPath: A.join(s, "ssr-entry.js"),
|
|
453
455
|
clientOutDir: o,
|
|
454
456
|
outDir: a,
|
|
455
|
-
base:
|
|
456
|
-
origin:
|
|
457
|
+
base: x,
|
|
458
|
+
origin: h,
|
|
457
459
|
lang: l.lang,
|
|
458
|
-
pageRoutes:
|
|
460
|
+
pageRoutes: v,
|
|
459
461
|
siteTitle: l.siteTitle,
|
|
460
|
-
author:
|
|
461
|
-
progress:
|
|
462
|
-
}),
|
|
463
|
-
let
|
|
462
|
+
author: _,
|
|
463
|
+
progress: y
|
|
464
|
+
}), y.done(`Pre-rendered ${v.length} pages`);
|
|
465
|
+
let b = /* @__PURE__ */ new Map();
|
|
464
466
|
for (let e of d) {
|
|
465
467
|
let t = r(e.filepath), n = t === "index" ? "/" : `/${t}`;
|
|
466
|
-
|
|
468
|
+
b.set(n, e.fileMetadata.mtimeSecs);
|
|
467
469
|
}
|
|
468
|
-
let ee =
|
|
469
|
-
|
|
470
|
-
let
|
|
471
|
-
await
|
|
472
|
-
let
|
|
473
|
-
await
|
|
470
|
+
let ee = Ce(v, x, h, b), S = [P.writeFile(A.join(a, "sitemap.xml"), ee)];
|
|
471
|
+
h !== void 0 && (S.push(P.writeFile(A.join(a, "robots.txt"), we(h, x))), S.push(P.writeFile(A.join(a, "feed.xml"), Te(d, x, h, l.siteTitle, l.siteDescription, l.lang)))), await Promise.all(S);
|
|
472
|
+
let w = A.join(o, "assets"), T = A.join(a, "assets");
|
|
473
|
+
await P.cp(w, T, { recursive: !0 }).catch(() => {}), await ze(A.join(n, l.rootDir), a);
|
|
474
|
+
let E = A.join(n, l.publicDir);
|
|
475
|
+
await P.cp(E, a, { recursive: !0 }).catch(() => {});
|
|
474
476
|
} finally {
|
|
475
477
|
await Promise.all([
|
|
476
|
-
|
|
478
|
+
P.rm(E, {
|
|
477
479
|
recursive: !0,
|
|
478
480
|
force: !0
|
|
479
481
|
}),
|
|
480
|
-
|
|
482
|
+
P.rm(o, {
|
|
481
483
|
recursive: !0,
|
|
482
484
|
force: !0
|
|
483
485
|
}),
|
|
484
|
-
|
|
486
|
+
P.rm(s, {
|
|
485
487
|
recursive: !0,
|
|
486
488
|
force: !0
|
|
487
489
|
})
|
|
@@ -489,7 +491,7 @@ async function Re(e, t = {}) {
|
|
|
489
491
|
}
|
|
490
492
|
i.log(`\nBuild complete. Output: ${a}`);
|
|
491
493
|
}
|
|
492
|
-
function
|
|
494
|
+
function Re(e) {
|
|
493
495
|
let t = `/${e.rootDir}/${m}`, n = JSON.parse(e.siteConfig), r = JSON.parse(e.siteData), i = r.contentTree ?? { entries: [] }, a = h(i.entries ?? [], n.title ?? ""), o = JSON.stringify({
|
|
494
496
|
...r,
|
|
495
497
|
directoryListings: a
|
|
@@ -515,31 +517,31 @@ export async function createRenderer() {
|
|
|
515
517
|
}
|
|
516
518
|
`;
|
|
517
519
|
}
|
|
518
|
-
async function
|
|
519
|
-
let n = (await
|
|
520
|
+
async function ze(e, t) {
|
|
521
|
+
let n = (await P.readdir(e, {
|
|
520
522
|
recursive: !0,
|
|
521
523
|
withFileTypes: !0
|
|
522
524
|
})).filter((e) => e.isFile() && !w(e.name)).map(async (n) => {
|
|
523
|
-
let r =
|
|
524
|
-
return
|
|
525
|
+
let r = A.join(n.parentPath, n.name), i = A.relative(e, r), a = A.join(t, i);
|
|
526
|
+
return P.mkdir(A.dirname(a), { recursive: !0 }).then(() => P.copyFile(r, a));
|
|
525
527
|
});
|
|
526
528
|
await Promise.all(n);
|
|
527
529
|
}
|
|
528
|
-
function
|
|
530
|
+
function Be(e, t, n = "") {
|
|
529
531
|
for (let r of e) {
|
|
530
532
|
if (r.kind !== "dir") continue;
|
|
531
533
|
let e = `${n}/${r.node.name}`;
|
|
532
|
-
u(r.node) || t.push(s(e)),
|
|
534
|
+
u(r.node) || t.push(s(e)), Be(r.node.entries, t, e);
|
|
533
535
|
}
|
|
534
536
|
}
|
|
535
537
|
// ../../node_modules/.pnpm/@shikijs+transformers@4.4.3/node_modules/@shikijs/transformers/dist/index.mjs
|
|
536
|
-
var
|
|
538
|
+
var Ve = /(\s+\/\/)/, He = /(?:\/\/|["'#]|;{1,2}|%{1,2}|--)(\s*)$/, Ue = /(?:\/\/|#|;{1,2}|%{1,2}|--)(\s*)$/, We = [
|
|
537
539
|
[/^(<!--)(.+)(-->)$/, !1],
|
|
538
540
|
[/^(\/\*)(.+)(\*\/)$/, !1],
|
|
539
541
|
[/^(\/\/|["'#]|;{1,2}|%{1,2}|--)(.*)$/, !0],
|
|
540
542
|
[/^(\*)(.+)$/, !0]
|
|
541
543
|
];
|
|
542
|
-
function
|
|
544
|
+
function Ge(e, t, n) {
|
|
543
545
|
let r = [];
|
|
544
546
|
for (let i of e) {
|
|
545
547
|
if (n === "v3") {
|
|
@@ -548,8 +550,8 @@ function Ke(e, t, n) {
|
|
|
548
550
|
let n = e.children[0];
|
|
549
551
|
if (n.type !== "text") return e;
|
|
550
552
|
let r = t === i.children.length - 1;
|
|
551
|
-
if (!
|
|
552
|
-
let a = n.value.split(
|
|
553
|
+
if (!B(n.value, r)) return e;
|
|
554
|
+
let a = n.value.split(Ve);
|
|
553
555
|
if (a.length <= 1) return e;
|
|
554
556
|
let o = [a[0]];
|
|
555
557
|
for (let e = 1; e < a.length; e += 2) o.push(a[e] + (a[e + 1] || ""));
|
|
@@ -570,13 +572,13 @@ function Ke(e, t, n) {
|
|
|
570
572
|
if (a.type !== "element") continue;
|
|
571
573
|
let o = a.children.at(0);
|
|
572
574
|
if (o?.type !== "text") continue;
|
|
573
|
-
let s = n === e.length - 1, c =
|
|
575
|
+
let s = n === e.length - 1, c = B(o.value, s), l;
|
|
574
576
|
if (!c && n > 0 && o.value.trim().startsWith("[!code")) {
|
|
575
577
|
let t = e[n - 1];
|
|
576
578
|
if (t?.type === "element") {
|
|
577
579
|
let n = t.children.at(0);
|
|
578
580
|
if (n?.type === "text" && n.value.includes("//")) {
|
|
579
|
-
let l =
|
|
581
|
+
let l = B(n.value + o.value, s);
|
|
580
582
|
if (l) {
|
|
581
583
|
c = l, r.push({
|
|
582
584
|
info: l,
|
|
@@ -593,7 +595,7 @@ function Ke(e, t, n) {
|
|
|
593
595
|
}
|
|
594
596
|
if (c) {
|
|
595
597
|
if (t && !s && n !== 0) {
|
|
596
|
-
let t =
|
|
598
|
+
let t = Ke(e[n - 1], "{") && Ke(e[n + 1], "}");
|
|
597
599
|
r.push({
|
|
598
600
|
info: c,
|
|
599
601
|
line: i,
|
|
@@ -615,16 +617,16 @@ function Ke(e, t, n) {
|
|
|
615
617
|
}
|
|
616
618
|
return r;
|
|
617
619
|
}
|
|
618
|
-
function
|
|
620
|
+
function Ke(e, t) {
|
|
619
621
|
if (e.type !== "element") return !1;
|
|
620
622
|
let n = e.children[0];
|
|
621
623
|
return n.type === "text" && n.value.trim() === t;
|
|
622
624
|
}
|
|
623
|
-
function
|
|
625
|
+
function B(e, t) {
|
|
624
626
|
let n = e.trimStart(), r = e.length - n.length;
|
|
625
627
|
n = n.trimEnd();
|
|
626
628
|
let i = e.length - n.length - r;
|
|
627
|
-
for (let [e, a] of
|
|
629
|
+
for (let [e, a] of We) {
|
|
628
630
|
if (a && !t) continue;
|
|
629
631
|
let o = e.exec(n);
|
|
630
632
|
if (o) return [
|
|
@@ -634,22 +636,22 @@ function z(e, t) {
|
|
|
634
636
|
];
|
|
635
637
|
}
|
|
636
638
|
}
|
|
637
|
-
function
|
|
638
|
-
let t = e.match(
|
|
639
|
+
function qe(e) {
|
|
640
|
+
let t = e.match(He);
|
|
639
641
|
return t && t[1].trim().length === 0 ? e.slice(0, t.index) : e;
|
|
640
642
|
}
|
|
641
|
-
function
|
|
642
|
-
let t = e.match(
|
|
643
|
+
function Je(e) {
|
|
644
|
+
let t = e.match(Ue);
|
|
643
645
|
return t && t[1].trim().length === 0 ? e.slice(0, t.index).trimEnd() : e;
|
|
644
646
|
}
|
|
645
|
-
function
|
|
647
|
+
function Ye(e, t, n, r) {
|
|
646
648
|
return r ??= "v3", {
|
|
647
649
|
name: e,
|
|
648
650
|
code(e) {
|
|
649
651
|
let i = e.children.filter((e) => e.type === "element"), a = [];
|
|
650
652
|
e.data ??= {};
|
|
651
653
|
let o = e.data;
|
|
652
|
-
o._shiki_notation ??=
|
|
654
|
+
o._shiki_notation ??= Ge(i, ["jsx", "tsx"].includes(this.options.lang), r);
|
|
653
655
|
let s = o._shiki_notation;
|
|
654
656
|
for (let e of s) {
|
|
655
657
|
if (e.info[1].length === 0) continue;
|
|
@@ -657,7 +659,7 @@ function Xe(e, t, n, r) {
|
|
|
657
659
|
e.isLineCommentOnly && r !== "v1" && o++;
|
|
658
660
|
let s = !1;
|
|
659
661
|
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] =
|
|
662
|
+
r === "v1" ? e.info[1] = qe(e.info[1]) : r === "v3" && (e.info[1] = Je(e.info[1]));
|
|
661
663
|
let c = e.info[1].trim().length === 0;
|
|
662
664
|
if (c && (e.info[1] = ""), c && e.isLineCommentOnly) a.push(e.line);
|
|
663
665
|
else if (c && e.isJsxStyle) e.line.children.splice(e.line.children.indexOf(e.token) - 1, 3);
|
|
@@ -682,44 +684,44 @@ function Xe(e, t, n, r) {
|
|
|
682
684
|
}
|
|
683
685
|
};
|
|
684
686
|
}
|
|
685
|
-
var
|
|
686
|
-
function
|
|
687
|
+
var Xe = /\{([\d,-]+)\}/;
|
|
688
|
+
function Ze(e) {
|
|
687
689
|
if (!e) return null;
|
|
688
|
-
let t = e.match(
|
|
690
|
+
let t = e.match(Xe);
|
|
689
691
|
return t ? t[1].split(",").flatMap((e) => {
|
|
690
692
|
let t = e.split("-").map((e) => Number.parseInt(e, 10));
|
|
691
693
|
return t.length === 1 ? [t[0]] : Array.from({ length: t[1] - t[0] + 1 }, (e, n) => t[0] + n);
|
|
692
694
|
}) : null;
|
|
693
695
|
}
|
|
694
|
-
var
|
|
695
|
-
function
|
|
696
|
+
var Qe = Symbol("highlighted-lines");
|
|
697
|
+
function $e(e = {}) {
|
|
696
698
|
let { className: t = "highlighted", zeroIndexed: n = !1 } = e;
|
|
697
699
|
return {
|
|
698
700
|
name: "@shikijs/transformers:meta-highlight",
|
|
699
701
|
line(e, r) {
|
|
700
702
|
if (!this.options.meta?.__raw) return;
|
|
701
703
|
let i = this.meta;
|
|
702
|
-
i[
|
|
703
|
-
let a = i[
|
|
704
|
+
i[Qe] ??= Ze(this.options.meta.__raw);
|
|
705
|
+
let a = i[Qe] ?? [], o = n ? r - 1 : r;
|
|
704
706
|
return a.includes(o) && this.addClassToHast(e, t), e;
|
|
705
707
|
}
|
|
706
708
|
};
|
|
707
709
|
}
|
|
708
|
-
var
|
|
709
|
-
function
|
|
710
|
-
return e.replace(
|
|
710
|
+
var et = /[.*+?^${}()|[\]\\]/g;
|
|
711
|
+
function tt(e) {
|
|
712
|
+
return e.replace(et, "\\$&");
|
|
711
713
|
}
|
|
712
|
-
function
|
|
714
|
+
function V(e = {}, t = "@shikijs/transformers:notation-map") {
|
|
713
715
|
let { classMap: n = {}, classActivePre: r = void 0, classActiveCode: i = void 0 } = e;
|
|
714
|
-
return
|
|
716
|
+
return Ye(t, RegExp(`#?\\s*\\[!code (${Object.keys(n).map(tt).join("|")})(:\\d+)?\\]`, "gi"), function([e, t, a = ":1"], o, s, c, l) {
|
|
715
717
|
let u = Number.parseInt(a.slice(1), 10);
|
|
716
718
|
for (let e = l; e < Math.min(l + u, c.length); e++) this.addClassToHast(c[e], n[t]);
|
|
717
719
|
return r && this.addClassToHast(this.pre, r), i && this.addClassToHast(this.code, i), !0;
|
|
718
720
|
}, e.matchAlgorithm);
|
|
719
721
|
}
|
|
720
|
-
function
|
|
722
|
+
function nt(e = {}) {
|
|
721
723
|
let { classLineAdd: t = "diff add", classLineRemove: n = "diff remove", classActivePre: r = "has-diff", classActiveCode: i } = e;
|
|
722
|
-
return
|
|
724
|
+
return V({
|
|
723
725
|
classMap: {
|
|
724
726
|
"++": t,
|
|
725
727
|
"--": n
|
|
@@ -729,31 +731,31 @@ function rt(e = {}) {
|
|
|
729
731
|
matchAlgorithm: e.matchAlgorithm
|
|
730
732
|
}, "@shikijs/transformers:notation-diff");
|
|
731
733
|
}
|
|
732
|
-
function
|
|
734
|
+
function rt(e = {}) {
|
|
733
735
|
let { classMap: t = {
|
|
734
736
|
error: ["highlighted", "error"],
|
|
735
737
|
warning: ["highlighted", "warning"],
|
|
736
738
|
info: ["highlighted", "info"]
|
|
737
739
|
}, classActivePre: n = "has-highlighted", classActiveCode: r } = e;
|
|
738
|
-
return
|
|
740
|
+
return V({
|
|
739
741
|
classMap: t,
|
|
740
742
|
classActivePre: n,
|
|
741
743
|
classActiveCode: r,
|
|
742
744
|
matchAlgorithm: e.matchAlgorithm
|
|
743
745
|
}, "@shikijs/transformers:notation-error-level");
|
|
744
746
|
}
|
|
745
|
-
function
|
|
747
|
+
function it(e = {}) {
|
|
746
748
|
let { classActiveLine: t = "focused", classActivePre: n = "has-focused", classActiveCode: r } = e;
|
|
747
|
-
return
|
|
749
|
+
return V({
|
|
748
750
|
classMap: { focus: t },
|
|
749
751
|
classActivePre: n,
|
|
750
752
|
classActiveCode: r,
|
|
751
753
|
matchAlgorithm: e.matchAlgorithm
|
|
752
754
|
}, "@shikijs/transformers:notation-focus");
|
|
753
755
|
}
|
|
754
|
-
function
|
|
756
|
+
function at(e = {}) {
|
|
755
757
|
let { classActiveLine: t = "highlighted", classActivePre: n = "has-highlighted", classActiveCode: r } = e;
|
|
756
|
-
return
|
|
758
|
+
return V({
|
|
757
759
|
classMap: {
|
|
758
760
|
highlight: t,
|
|
759
761
|
hl: t
|
|
@@ -764,41 +766,41 @@ function ot(e = {}) {
|
|
|
764
766
|
}, "@shikijs/transformers:notation-highlight");
|
|
765
767
|
}
|
|
766
768
|
// src/node/lib/render/highlight/language.ts
|
|
767
|
-
var
|
|
769
|
+
var ot = [
|
|
768
770
|
"shellscript",
|
|
769
771
|
"shell",
|
|
770
772
|
"bash",
|
|
771
773
|
"sh",
|
|
772
774
|
"zsh"
|
|
773
775
|
];
|
|
774
|
-
function
|
|
775
|
-
return
|
|
776
|
+
function st(e) {
|
|
777
|
+
return ot.includes(e);
|
|
776
778
|
}
|
|
777
|
-
var
|
|
778
|
-
function
|
|
779
|
-
return
|
|
779
|
+
var ct = /^[a-zA-Z0-9-_]+/;
|
|
780
|
+
function lt(e) {
|
|
781
|
+
return ct.exec(e)?.[0] || "";
|
|
780
782
|
}
|
|
781
783
|
// src/node/lib/render/highlight/index.ts
|
|
782
|
-
var
|
|
784
|
+
var ut = new FinalizationRegistry((e) => {
|
|
783
785
|
e();
|
|
784
|
-
}),
|
|
786
|
+
}), H = {
|
|
785
787
|
light: "github-light",
|
|
786
788
|
dark: "github-dark"
|
|
787
789
|
};
|
|
788
|
-
async function
|
|
789
|
-
let e = await
|
|
790
|
-
themes: [
|
|
790
|
+
async function dt() {
|
|
791
|
+
let e = await ye({
|
|
792
|
+
themes: [H.light, H.dark],
|
|
791
793
|
langs: []
|
|
792
794
|
}), t = [
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
795
|
+
$e(),
|
|
796
|
+
nt(),
|
|
797
|
+
it({
|
|
796
798
|
classActiveLine: "has-focus",
|
|
797
799
|
classActivePre: "has-focused-lines"
|
|
798
800
|
}),
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
801
|
+
at(),
|
|
802
|
+
rt(),
|
|
803
|
+
ft(),
|
|
802
804
|
{
|
|
803
805
|
name: "typedown:add-dir",
|
|
804
806
|
pre(e) {
|
|
@@ -807,19 +809,19 @@ async function ft() {
|
|
|
807
809
|
}
|
|
808
810
|
], n = new Set(e.getLoadedLanguages());
|
|
809
811
|
async function r(r, i, a, o) {
|
|
810
|
-
let s =
|
|
812
|
+
let s = lt(i);
|
|
811
813
|
if (s) {
|
|
812
814
|
let e = i;
|
|
813
815
|
i = s.toLowerCase(), a = e.slice(i.length).replace(/(?<!=)\{/g, " {") + " " + a, a = a.trim().replace(/\s+/g, " ");
|
|
814
816
|
}
|
|
815
817
|
i ||= "txt";
|
|
816
818
|
try {
|
|
817
|
-
!
|
|
819
|
+
!xe(i) && !n.has(i) && (await e.loadLanguage(i), n.add(i));
|
|
818
820
|
} catch {
|
|
819
821
|
O.warn(`\nThe language '${i}' is not loaded, falling back to 'txt' for syntax highlighting.`), i = "txt";
|
|
820
822
|
}
|
|
821
823
|
r = r.trimEnd();
|
|
822
|
-
let c =
|
|
824
|
+
let c = be(r, i, e);
|
|
823
825
|
return await e.loadLanguage(...c), e.codeToHtml(r, {
|
|
824
826
|
lang: i,
|
|
825
827
|
transformers: [
|
|
@@ -840,10 +842,10 @@ async function ft() {
|
|
|
840
842
|
});
|
|
841
843
|
}
|
|
842
844
|
},
|
|
843
|
-
...o === void 0 ? [] : [
|
|
845
|
+
...o === void 0 ? [] : [pt(o)]
|
|
844
846
|
],
|
|
845
847
|
meta: { __raw: a },
|
|
846
|
-
themes:
|
|
848
|
+
themes: H,
|
|
847
849
|
defaultColor: !1,
|
|
848
850
|
colorReplacements: {
|
|
849
851
|
"github-light": {
|
|
@@ -868,13 +870,13 @@ async function ft() {
|
|
|
868
870
|
}
|
|
869
871
|
});
|
|
870
872
|
}
|
|
871
|
-
return
|
|
873
|
+
return ut.register(r, () => e.dispose()), r;
|
|
872
874
|
}
|
|
873
|
-
function
|
|
875
|
+
function ft() {
|
|
874
876
|
return {
|
|
875
877
|
name: "typedown:disable-shell-symbol-select",
|
|
876
878
|
tokens(e) {
|
|
877
|
-
if (
|
|
879
|
+
if (st(this.options.lang)) for (let t of e) {
|
|
878
880
|
if (t.length < 2) continue;
|
|
879
881
|
let e = t[0].content.trim();
|
|
880
882
|
(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 +884,7 @@ function pt() {
|
|
|
882
884
|
}
|
|
883
885
|
};
|
|
884
886
|
}
|
|
885
|
-
function
|
|
887
|
+
function pt(e) {
|
|
886
888
|
return {
|
|
887
889
|
name: "typedown:line-numbers",
|
|
888
890
|
code(t) {
|
|
@@ -914,23 +916,23 @@ function mt(e) {
|
|
|
914
916
|
};
|
|
915
917
|
}
|
|
916
918
|
// src/node/lib/render/postprocess.ts
|
|
917
|
-
var
|
|
918
|
-
async function
|
|
919
|
-
return e = await
|
|
919
|
+
var mt;
|
|
920
|
+
async function ht(e) {
|
|
921
|
+
return e = await vt(e), e = wt(e), e;
|
|
920
922
|
}
|
|
921
|
-
function
|
|
922
|
-
return
|
|
923
|
+
function gt() {
|
|
924
|
+
return mt ||= dt(), mt;
|
|
923
925
|
}
|
|
924
|
-
var
|
|
925
|
-
function
|
|
926
|
+
var _t = /<pre class="td-code-placeholder"([^>]*)><code>([\s\S]*?)<\/code><\/pre>/g;
|
|
927
|
+
function U(e, t) {
|
|
926
928
|
return e.match(RegExp(`${t}="([^"]*)"`))?.[1];
|
|
927
929
|
}
|
|
928
|
-
async function
|
|
929
|
-
let t = await
|
|
930
|
+
async function vt(e) {
|
|
931
|
+
let t = await gt(), n = [...e.matchAll(_t)];
|
|
930
932
|
if (n.length === 0) return e;
|
|
931
933
|
let r = await Promise.all(n.map(async (e) => {
|
|
932
|
-
let n = e[1], r =
|
|
933
|
-
return
|
|
934
|
+
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 = p(e[2]);
|
|
935
|
+
return xt(await t(s, r, i, o === void 0 ? void 0 : parseInt(o) || 1), r, {
|
|
934
936
|
title: a,
|
|
935
937
|
lineNumbers: o
|
|
936
938
|
});
|
|
@@ -941,7 +943,7 @@ async function yt(e) {
|
|
|
941
943
|
}
|
|
942
944
|
return i;
|
|
943
945
|
}
|
|
944
|
-
var
|
|
946
|
+
var yt = {
|
|
945
947
|
typescript: "TypeScript",
|
|
946
948
|
javascript: "JavaScript",
|
|
947
949
|
tsx: "TSX",
|
|
@@ -989,24 +991,24 @@ var bt = {
|
|
|
989
991
|
scala: "Scala",
|
|
990
992
|
txt: "Text"
|
|
991
993
|
};
|
|
992
|
-
function
|
|
993
|
-
return
|
|
994
|
+
function bt(e) {
|
|
995
|
+
return yt[e.toLowerCase()] ?? e;
|
|
994
996
|
}
|
|
995
|
-
function
|
|
997
|
+
function xt(e, t, n) {
|
|
996
998
|
t ||= "txt";
|
|
997
|
-
let r =
|
|
999
|
+
let r = bt(t), i = ["td-code-block", "language-" + t];
|
|
998
1000
|
n.title && i.push("has-title"), n.lineNumbers !== void 0 && i.push("line-numbers-mode");
|
|
999
1001
|
let a = `<figure class="${i.join(" ")}">`;
|
|
1000
1002
|
return a += "<figcaption class=\"td-code-header\">", a += "<span class=\"td-code-left\">", a += `<span class="td-code-lang">${f(r)}</span>`, n.title && (a += `<span class="td-code-label">${f(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;
|
|
1001
1003
|
}
|
|
1002
|
-
var
|
|
1003
|
-
function
|
|
1004
|
-
return e = e.replace(
|
|
1004
|
+
var St = /<span class="td-math-inline">([\s\S]*?)<\/span>/g, Ct = /<div class="td-math-block">([\s\S]*?)<\/div>/g;
|
|
1005
|
+
function wt(e) {
|
|
1006
|
+
return e = e.replace(St, (e, t) => Dt(t, !1)), e = e.replace(Ct, (e, t) => Dt(t, !0)), e;
|
|
1005
1007
|
}
|
|
1006
|
-
var
|
|
1007
|
-
function
|
|
1008
|
+
var Tt = /`([^`]+)`|\$([^$]+)\$/g;
|
|
1009
|
+
function Et(e) {
|
|
1008
1010
|
let t = 0, n = "";
|
|
1009
|
-
for (let r of e.matchAll(
|
|
1011
|
+
for (let r of e.matchAll(Tt)) {
|
|
1010
1012
|
if (n += f(e.slice(t, r.index)), r[1] !== void 0) n += `<code>${f(r[1])}</code>`;
|
|
1011
1013
|
else if (r[2] !== void 0) try {
|
|
1012
1014
|
n += D.renderToString(r[2], { throwOnError: !1 });
|
|
@@ -1017,7 +1019,7 @@ function Dt(e) {
|
|
|
1017
1019
|
}
|
|
1018
1020
|
return n += f(e.slice(t)), n;
|
|
1019
1021
|
}
|
|
1020
|
-
function
|
|
1022
|
+
function Dt(e, t) {
|
|
1021
1023
|
let n = t ? "div" : "span";
|
|
1022
1024
|
try {
|
|
1023
1025
|
return D.renderToString(p(e), {
|
|
@@ -1029,25 +1031,25 @@ function Ot(e, t) {
|
|
|
1029
1031
|
}
|
|
1030
1032
|
}
|
|
1031
1033
|
// src/node/lib/render/vue.ts
|
|
1032
|
-
async function
|
|
1033
|
-
let r = t.title || t.label || (d(n) ?
|
|
1034
|
+
async function W(e, t, n) {
|
|
1035
|
+
let r = t.title || t.label || (d(n) ? ee(n, (await e.getConfig()).siteTitle) : C(n));
|
|
1034
1036
|
return {
|
|
1035
1037
|
schema: t.schema,
|
|
1036
1038
|
schemaLabel: t.schemaLabel,
|
|
1037
1039
|
label: t.label,
|
|
1038
1040
|
icon: t.icon,
|
|
1039
1041
|
frontmatter: t.header ?? {},
|
|
1040
|
-
headings:
|
|
1042
|
+
headings: kt(t.headings),
|
|
1041
1043
|
title: r,
|
|
1042
|
-
titleHtml:
|
|
1044
|
+
titleHtml: Et(r),
|
|
1043
1045
|
filepath: n,
|
|
1044
1046
|
fileMetadata: t.fileMetadata,
|
|
1045
1047
|
seoMetadata: t.seoMetadata,
|
|
1046
1048
|
excerpt: t.excerpt
|
|
1047
1049
|
};
|
|
1048
1050
|
}
|
|
1049
|
-
async function
|
|
1050
|
-
let r = await
|
|
1051
|
+
async function Ot(e, t, n) {
|
|
1052
|
+
let r = await ht(t.content), i = await W(e, t, n), a = JSON.stringify(`@typedown/pages?resource=${encodeURIComponent(n)}`);
|
|
1051
1053
|
return {
|
|
1052
1054
|
vueSrc: [
|
|
1053
1055
|
"<script>",
|
|
@@ -1059,12 +1061,12 @@ async function kt(e, t, n) {
|
|
|
1059
1061
|
`import { pageData } from ${a}`,
|
|
1060
1062
|
"useRouter().route.data = pageData",
|
|
1061
1063
|
"<\/script>",
|
|
1062
|
-
`<template><div class="typedown-content">\n${
|
|
1064
|
+
`<template><div class="typedown-content">\n${At(r)}\n</div></template>`
|
|
1063
1065
|
].join("\n"),
|
|
1064
1066
|
pageData: i
|
|
1065
1067
|
};
|
|
1066
1068
|
}
|
|
1067
|
-
function
|
|
1069
|
+
function kt(e) {
|
|
1068
1070
|
let t = [], n = [];
|
|
1069
1071
|
for (let r of e) {
|
|
1070
1072
|
let e = {
|
|
@@ -1080,15 +1082,15 @@ function At(e) {
|
|
|
1080
1082
|
}
|
|
1081
1083
|
return t;
|
|
1082
1084
|
}
|
|
1083
|
-
function
|
|
1085
|
+
function At(e) {
|
|
1084
1086
|
return e.replaceAll("{{", "{{").replaceAll("}}", "}}");
|
|
1085
1087
|
}
|
|
1086
1088
|
// src/node/plugin/vite/constants.ts
|
|
1087
|
-
var
|
|
1088
|
-
|
|
1089
|
-
var
|
|
1089
|
+
var jt = "@typedown/app", Mt = "\0@typedown/app", G = "@typedown/pages", Nt = "\0" + G;
|
|
1090
|
+
G + "";
|
|
1091
|
+
var K = "\0@typedown/pages?resource=", q = "@typedown/site-data", Pt = "\0@typedown/site-data", J = "@typedown/search-index", Ft = "\0@typedown/search-index", Y = "@typedown/theme", It = "\0@typedown/theme", X = "typedown:page-data";
|
|
1090
1092
|
// src/node/plugin/vite/virtual/utils.ts
|
|
1091
|
-
function
|
|
1093
|
+
function Z(e, t) {
|
|
1092
1094
|
let n = e.moduleGraph.getModuleById(t);
|
|
1093
1095
|
if (n) {
|
|
1094
1096
|
e.moduleGraph.invalidateModule(n);
|
|
@@ -1104,14 +1106,14 @@ function X(e, t) {
|
|
|
1104
1106
|
}
|
|
1105
1107
|
}
|
|
1106
1108
|
// src/node/plugin/vite/virtual/app.ts
|
|
1107
|
-
var
|
|
1109
|
+
var Lt = class {
|
|
1108
1110
|
mountPath;
|
|
1109
1111
|
constructor(e = "") {
|
|
1110
1112
|
this.mountPath = e;
|
|
1111
1113
|
}
|
|
1112
1114
|
async load(e) {
|
|
1113
|
-
let t = await (await e.getTdContext()).getConfig(), n = await
|
|
1114
|
-
return
|
|
1115
|
+
let t = await (await e.getTdContext()).getConfig(), n = await L(t.components, e.root);
|
|
1116
|
+
return Me({
|
|
1115
1117
|
rootDir: t.rootDir,
|
|
1116
1118
|
mountPath: this.mountPath,
|
|
1117
1119
|
basePath: t.basePath,
|
|
@@ -1125,17 +1127,17 @@ var Rt = class {
|
|
|
1125
1127
|
nav: t.nav,
|
|
1126
1128
|
userComponents: n
|
|
1127
1129
|
}, {
|
|
1128
|
-
theme:
|
|
1129
|
-
pages:
|
|
1130
|
-
siteData:
|
|
1131
|
-
searchIndex:
|
|
1132
|
-
pageDataEvent:
|
|
1130
|
+
theme: Y,
|
|
1131
|
+
pages: G,
|
|
1132
|
+
siteData: q,
|
|
1133
|
+
searchIndex: J,
|
|
1134
|
+
pageDataEvent: X
|
|
1133
1135
|
});
|
|
1134
1136
|
}
|
|
1135
1137
|
invalidate(e) {
|
|
1136
|
-
|
|
1138
|
+
Z(e, Mt);
|
|
1137
1139
|
}
|
|
1138
|
-
},
|
|
1140
|
+
}, Rt = class {
|
|
1139
1141
|
mountPath;
|
|
1140
1142
|
constructor(e = "") {
|
|
1141
1143
|
this.mountPath = e;
|
|
@@ -1148,21 +1150,21 @@ var Rt = class {
|
|
|
1148
1150
|
if (e.startsWith("@typedown/pages?resource=")) return "\0" + e;
|
|
1149
1151
|
}
|
|
1150
1152
|
isPageDataModule(e) {
|
|
1151
|
-
return e.startsWith(
|
|
1153
|
+
return e.startsWith(K);
|
|
1152
1154
|
}
|
|
1153
1155
|
async loadPageData(e, t) {
|
|
1154
|
-
let n = decodeURIComponent(e.slice(
|
|
1156
|
+
let n = decodeURIComponent(e.slice(K.length)), r = await W(t, await t.getFile(n), n);
|
|
1155
1157
|
return `export const pageData = ${JSON.stringify(r)}`;
|
|
1156
1158
|
}
|
|
1157
1159
|
invalidatePageData(e, t) {
|
|
1158
|
-
|
|
1160
|
+
Z(e, K + encodeURIComponent(t));
|
|
1159
1161
|
}
|
|
1160
1162
|
sendPageData(e, t, n) {
|
|
1161
1163
|
t.getFile(n).then(async (r) => {
|
|
1162
|
-
let i = await
|
|
1164
|
+
let i = await W(t, r, n);
|
|
1163
1165
|
e.hot.send({
|
|
1164
1166
|
type: "custom",
|
|
1165
|
-
event:
|
|
1167
|
+
event: X,
|
|
1166
1168
|
data: {
|
|
1167
1169
|
filepath: n,
|
|
1168
1170
|
pageData: i
|
|
@@ -1173,24 +1175,24 @@ var Rt = class {
|
|
|
1173
1175
|
});
|
|
1174
1176
|
}
|
|
1175
1177
|
invalidate(e) {
|
|
1176
|
-
|
|
1178
|
+
Z(e, Nt);
|
|
1177
1179
|
}
|
|
1178
|
-
},
|
|
1180
|
+
}, zt = class {
|
|
1179
1181
|
async load(e) {
|
|
1180
|
-
return
|
|
1182
|
+
return Ne((await (await e.getTdContext()).getConfig()).layout ?? void 0, e.root);
|
|
1181
1183
|
}
|
|
1182
1184
|
invalidate(e) {
|
|
1183
|
-
|
|
1185
|
+
Z(e, It);
|
|
1184
1186
|
}
|
|
1185
|
-
},
|
|
1187
|
+
}, Bt = "\0@typedown/site-data", Vt = {
|
|
1186
1188
|
ready: !1,
|
|
1187
1189
|
contentTree: { entries: [] },
|
|
1188
1190
|
schemas: {},
|
|
1189
1191
|
directoryListings: {}
|
|
1190
|
-
},
|
|
1192
|
+
}, Ht = class {
|
|
1191
1193
|
data;
|
|
1192
1194
|
scan(e) {
|
|
1193
|
-
let t =
|
|
1195
|
+
let t = pe("**/*.td", {
|
|
1194
1196
|
cwd: e,
|
|
1195
1197
|
exclude: (e) => e.startsWith("_")
|
|
1196
1198
|
}).map((e) => ({
|
|
@@ -1208,27 +1210,27 @@ var Rt = class {
|
|
|
1208
1210
|
let t = this.data ? {
|
|
1209
1211
|
ready: !0,
|
|
1210
1212
|
...this.data
|
|
1211
|
-
} :
|
|
1213
|
+
} : Vt;
|
|
1212
1214
|
return `export default ${JSON.stringify(t)}`;
|
|
1213
1215
|
}
|
|
1214
1216
|
clear() {
|
|
1215
1217
|
this.data = void 0;
|
|
1216
1218
|
}
|
|
1217
1219
|
fetch = y((e, t) => {
|
|
1218
|
-
|
|
1220
|
+
Ut(e).then((e) => {
|
|
1219
1221
|
this.data = e, t && this.invalidate(t);
|
|
1220
1222
|
}).catch((e) => {
|
|
1221
1223
|
console.error("[typedown] Failed to fetch site data:", e instanceof Error ? e.message : e);
|
|
1222
1224
|
});
|
|
1223
1225
|
}, 200);
|
|
1224
1226
|
async fetchSync(e) {
|
|
1225
|
-
this.data = await
|
|
1227
|
+
this.data = await Ut(e);
|
|
1226
1228
|
}
|
|
1227
1229
|
invalidate(e) {
|
|
1228
|
-
|
|
1230
|
+
Z(e, Bt);
|
|
1229
1231
|
}
|
|
1230
1232
|
};
|
|
1231
|
-
async function
|
|
1233
|
+
async function Ut(e) {
|
|
1232
1234
|
let [t, n, r] = await Promise.all([
|
|
1233
1235
|
e.getConfig(),
|
|
1234
1236
|
e.listSidebar(),
|
|
@@ -1244,10 +1246,10 @@ async function Wt(e) {
|
|
|
1244
1246
|
};
|
|
1245
1247
|
}
|
|
1246
1248
|
// src/node/lib/search-indexer/index.ts
|
|
1247
|
-
var
|
|
1249
|
+
var Wt = class {
|
|
1248
1250
|
index;
|
|
1249
1251
|
constructor() {
|
|
1250
|
-
this.index = new
|
|
1252
|
+
this.index = new re({
|
|
1251
1253
|
fields: v,
|
|
1252
1254
|
storeFields: x
|
|
1253
1255
|
});
|
|
@@ -1267,19 +1269,19 @@ var Gt = class {
|
|
|
1267
1269
|
}
|
|
1268
1270
|
};
|
|
1269
1271
|
// src/node/lib/search-indexer/scan.ts
|
|
1270
|
-
function
|
|
1271
|
-
let n =
|
|
1272
|
+
function Gt(e, t) {
|
|
1273
|
+
let n = Yt(e), r = [];
|
|
1272
1274
|
for (let t of n) {
|
|
1273
|
-
let n =
|
|
1275
|
+
let n = Jt(e, t);
|
|
1274
1276
|
n && r.push(n);
|
|
1275
1277
|
}
|
|
1276
1278
|
t.addAll(r);
|
|
1277
1279
|
}
|
|
1278
|
-
function
|
|
1279
|
-
let i =
|
|
1280
|
+
function Kt(e, n, r) {
|
|
1281
|
+
let i = Jt(e, j(e, n));
|
|
1280
1282
|
i ? r.addPage(i) : r.discardPage(t(n));
|
|
1281
1283
|
}
|
|
1282
|
-
function
|
|
1284
|
+
function qt(e, t) {
|
|
1283
1285
|
let n = C(e);
|
|
1284
1286
|
if (!t.startsWith("---")) return {
|
|
1285
1287
|
title: n,
|
|
@@ -1296,54 +1298,54 @@ function Jt(e, t) {
|
|
|
1296
1298
|
body: a
|
|
1297
1299
|
};
|
|
1298
1300
|
}
|
|
1299
|
-
function
|
|
1301
|
+
function Jt(e, n) {
|
|
1300
1302
|
let r;
|
|
1301
1303
|
try {
|
|
1302
|
-
r =
|
|
1304
|
+
r = me(n, "utf-8");
|
|
1303
1305
|
} catch {
|
|
1304
1306
|
return;
|
|
1305
1307
|
}
|
|
1306
1308
|
if (!r.trim()) return;
|
|
1307
|
-
let i = n.slice(e.length + 1), { title: a, body: o } =
|
|
1309
|
+
let i = n.slice(e.length + 1), { title: a, body: o } = qt(i, r);
|
|
1308
1310
|
return {
|
|
1309
1311
|
id: t(i),
|
|
1310
1312
|
title: a,
|
|
1311
1313
|
text: `${a}\n${o}`
|
|
1312
1314
|
};
|
|
1313
1315
|
}
|
|
1314
|
-
function
|
|
1315
|
-
return
|
|
1316
|
+
function Yt(e) {
|
|
1317
|
+
return pe("**/*.td", {
|
|
1316
1318
|
cwd: e,
|
|
1317
1319
|
exclude: (e) => e.startsWith("_")
|
|
1318
|
-
}).map((t) =>
|
|
1320
|
+
}).map((t) => j(e, t));
|
|
1319
1321
|
}
|
|
1320
1322
|
// src/node/plugin/vite/virtual/search-index.ts
|
|
1321
|
-
var
|
|
1322
|
-
indexer = new
|
|
1323
|
+
var Xt = "\0@typedown/search-index", Zt = class {
|
|
1324
|
+
indexer = new Wt();
|
|
1323
1325
|
load(e) {
|
|
1324
1326
|
return `export default ${JSON.stringify(this.indexer.serialize())}`;
|
|
1325
1327
|
}
|
|
1326
1328
|
index(e) {
|
|
1327
|
-
|
|
1329
|
+
Gt(e, this.indexer);
|
|
1328
1330
|
}
|
|
1329
1331
|
reindex(e, t) {
|
|
1330
|
-
|
|
1332
|
+
Kt(e, t, this.indexer);
|
|
1331
1333
|
}
|
|
1332
1334
|
invalidate(e) {
|
|
1333
|
-
|
|
1335
|
+
Z(e, Xt);
|
|
1334
1336
|
}
|
|
1335
|
-
},
|
|
1336
|
-
function
|
|
1337
|
+
}, Qt = ge(import.meta.url);
|
|
1338
|
+
function $t() {
|
|
1337
1339
|
return [{
|
|
1338
1340
|
find: "vue/server-renderer",
|
|
1339
|
-
replacement:
|
|
1341
|
+
replacement: Qt.resolve("vue/server-renderer")
|
|
1340
1342
|
}, {
|
|
1341
1343
|
find: "vue",
|
|
1342
|
-
replacement:
|
|
1344
|
+
replacement: Qt.resolve("vue/dist/vue.runtime.esm-bundler.js")
|
|
1343
1345
|
}];
|
|
1344
1346
|
}
|
|
1345
1347
|
// src/node/plugin/vite/middleware/vault-assets.ts
|
|
1346
|
-
var
|
|
1348
|
+
var en = {
|
|
1347
1349
|
jpg: "image/jpeg",
|
|
1348
1350
|
jpeg: "image/jpeg",
|
|
1349
1351
|
png: "image/png",
|
|
@@ -1361,17 +1363,17 @@ var tn = {
|
|
|
1361
1363
|
woff: "font/woff",
|
|
1362
1364
|
ttf: "font/ttf"
|
|
1363
1365
|
};
|
|
1364
|
-
function
|
|
1366
|
+
function tn(e, t) {
|
|
1365
1367
|
return (n, r, s) => {
|
|
1366
1368
|
if (!n.url || n.method !== "GET" || r.writableEnded) return s();
|
|
1367
1369
|
let c = a(n.url);
|
|
1368
1370
|
if (c.startsWith("/@") || c.startsWith("/node_modules")) return s();
|
|
1369
|
-
let l = i(t.basePath), u = (l && c.startsWith(l) ? c.slice(l.length) : c).replace(/^\//, ""), d =
|
|
1370
|
-
if (
|
|
1371
|
-
let e =
|
|
1371
|
+
let l = i(t.basePath), u = (l && c.startsWith(l) ? c.slice(l.length) : c).replace(/^\//, ""), d = j(e.config.root, t.rootDirectory, u);
|
|
1372
|
+
if (fe(d)) try {
|
|
1373
|
+
let e = he(d);
|
|
1372
1374
|
if (e.isFile()) {
|
|
1373
|
-
let t =
|
|
1374
|
-
r.setHeader("Content-Type", t), r.setHeader("Content-Length", e.size),
|
|
1375
|
+
let t = en[o(d).slice(1).toLowerCase()] ?? "application/octet-stream";
|
|
1376
|
+
r.setHeader("Content-Type", t), r.setHeader("Content-Length", e.size), de(d).pipe(r);
|
|
1375
1377
|
return;
|
|
1376
1378
|
}
|
|
1377
1379
|
} catch {}
|
|
@@ -1379,7 +1381,7 @@ function nn(e, t) {
|
|
|
1379
1381
|
};
|
|
1380
1382
|
}
|
|
1381
1383
|
// src/node/plugin/vite/middleware/virtual-html.ts
|
|
1382
|
-
function
|
|
1384
|
+
function nn(e, t, n) {
|
|
1383
1385
|
return (r, o, s) => {
|
|
1384
1386
|
if (!r.url) return s();
|
|
1385
1387
|
let c = i(a(r.url)), l = i(n.basePath);
|
|
@@ -1387,30 +1389,30 @@ function rn(e, t, n) {
|
|
|
1387
1389
|
let u = c.slice(l.length);
|
|
1388
1390
|
if (u.startsWith("/@") || u.startsWith("/node_modules") || c.includes(".") && !c.endsWith("/index.html")) return s();
|
|
1389
1391
|
t.getConfig().then(async (t) => {
|
|
1390
|
-
let i = await e.transformIndexHtml(r.url ?? "",
|
|
1392
|
+
let i = await e.transformIndexHtml(r.url ?? "", rn(n, t));
|
|
1391
1393
|
o.setHeader("Content-Type", "text/html"), o.end(i);
|
|
1392
1394
|
}).catch(() => s());
|
|
1393
1395
|
};
|
|
1394
1396
|
}
|
|
1395
|
-
function
|
|
1397
|
+
function rn(e, t) {
|
|
1396
1398
|
return e.devHtml === void 0 && (e.devHtml = T({
|
|
1397
1399
|
title: t.siteTitle,
|
|
1398
1400
|
description: t.siteDescription,
|
|
1399
1401
|
base: "/",
|
|
1400
1402
|
ogType: "website",
|
|
1401
|
-
entryScript:
|
|
1403
|
+
entryScript: jt
|
|
1402
1404
|
})), e.devHtml;
|
|
1403
1405
|
}
|
|
1404
1406
|
// src/node/lib/prop-schema.ts
|
|
1405
|
-
function
|
|
1407
|
+
function an(e, t, n) {
|
|
1406
1408
|
let r = {};
|
|
1407
1409
|
for (let i of e) {
|
|
1408
|
-
let e = `./${
|
|
1410
|
+
let e = `./${A.relative(t, i.absolutePath)}`;
|
|
1409
1411
|
try {
|
|
1410
1412
|
let t = n.getComponentMeta(i.absolutePath), a = {}, o = !1;
|
|
1411
1413
|
for (let e of t.props) {
|
|
1412
1414
|
if (e.global) continue;
|
|
1413
|
-
let t =
|
|
1415
|
+
let t = $(e.schema);
|
|
1414
1416
|
if (t !== void 0) {
|
|
1415
1417
|
let n = { schema: e.required ? t : l(t) };
|
|
1416
1418
|
e.description && (n.description = e.description), a[e.name] = n, o = !0;
|
|
@@ -1428,25 +1430,25 @@ function on(e, t, n) {
|
|
|
1428
1430
|
}
|
|
1429
1431
|
return r;
|
|
1430
1432
|
}
|
|
1431
|
-
function
|
|
1433
|
+
function on(e) {
|
|
1432
1434
|
if (!e || e.length !== 1) return;
|
|
1433
|
-
let t =
|
|
1435
|
+
let t = $(e[0]);
|
|
1434
1436
|
return t === void 0 ? void 0 : {
|
|
1435
1437
|
type: "array",
|
|
1436
1438
|
items: t
|
|
1437
1439
|
};
|
|
1438
1440
|
}
|
|
1439
|
-
function
|
|
1440
|
-
if (t && 0 < Object.keys(t).length) return
|
|
1441
|
+
function sn(e, t) {
|
|
1442
|
+
if (t && 0 < Object.keys(t).length) return cn(t);
|
|
1441
1443
|
let n = /^(?:Record<string,\s*(\w+)>|\{\s*\[key:\s*string\]:\s*(\w+);\s*\})$/.exec(e);
|
|
1442
1444
|
if (!n) return;
|
|
1443
|
-
let r =
|
|
1445
|
+
let r = Q(n[1] ?? n[2]);
|
|
1444
1446
|
return r === void 0 ? void 0 : {
|
|
1445
1447
|
type: "object",
|
|
1446
1448
|
additionalProperties: r
|
|
1447
1449
|
};
|
|
1448
1450
|
}
|
|
1449
|
-
function
|
|
1451
|
+
function Q(e) {
|
|
1450
1452
|
switch (e) {
|
|
1451
1453
|
case "string": return { type: "string" };
|
|
1452
1454
|
case "number": return { type: "number" };
|
|
@@ -1460,7 +1462,7 @@ function Z(e) {
|
|
|
1460
1462
|
let t = e.replace(/^["']|["']$/g, "");
|
|
1461
1463
|
i.push({ const: t });
|
|
1462
1464
|
} else {
|
|
1463
|
-
let t =
|
|
1465
|
+
let t = Q(e);
|
|
1464
1466
|
if (t === void 0) return;
|
|
1465
1467
|
i.push(t);
|
|
1466
1468
|
}
|
|
@@ -1470,10 +1472,10 @@ function Z(e) {
|
|
|
1470
1472
|
return;
|
|
1471
1473
|
}
|
|
1472
1474
|
}
|
|
1473
|
-
function
|
|
1475
|
+
function cn(e) {
|
|
1474
1476
|
let t = {}, n = [];
|
|
1475
1477
|
for (let [r, i] of Object.entries(e)) {
|
|
1476
|
-
let e =
|
|
1478
|
+
let e = $(i.schema);
|
|
1477
1479
|
if (e === void 0) return;
|
|
1478
1480
|
t[r] = e, i.required && n.push(r);
|
|
1479
1481
|
}
|
|
@@ -1484,21 +1486,21 @@ function ln(e) {
|
|
|
1484
1486
|
};
|
|
1485
1487
|
return 0 < n.length && (r.required = n), r;
|
|
1486
1488
|
}
|
|
1487
|
-
function
|
|
1488
|
-
if (typeof e == "string") return
|
|
1489
|
+
function $(e) {
|
|
1490
|
+
if (typeof e == "string") return Q(e);
|
|
1489
1491
|
switch (e.kind) {
|
|
1490
|
-
case "enum": return
|
|
1491
|
-
case "array": return
|
|
1492
|
-
case "object": return
|
|
1492
|
+
case "enum": return ln(e.schema);
|
|
1493
|
+
case "array": return on(e.schema);
|
|
1494
|
+
case "object": return sn(e.type, e.schema);
|
|
1493
1495
|
case "literal": return "value" in e ? { const: e.value } : void 0;
|
|
1494
1496
|
default: return;
|
|
1495
1497
|
}
|
|
1496
1498
|
}
|
|
1497
|
-
function
|
|
1499
|
+
function ln(e) {
|
|
1498
1500
|
let t = e ?? [], n = t.some((e) => e === "undefined" || e === "null"), r = t.filter((e) => e !== "undefined" && e !== "null");
|
|
1499
1501
|
if (r.length === 0) return;
|
|
1500
1502
|
if (r.length === 1) {
|
|
1501
|
-
let e =
|
|
1503
|
+
let e = $(r[0]);
|
|
1502
1504
|
return e === void 0 ? void 0 : n ? l(e) : e;
|
|
1503
1505
|
}
|
|
1504
1506
|
if (r.every((e) => typeof e == "object" && e.kind === "literal")) {
|
|
@@ -1512,7 +1514,7 @@ function un(e) {
|
|
|
1512
1514
|
}
|
|
1513
1515
|
let i = [];
|
|
1514
1516
|
for (let e of r) {
|
|
1515
|
-
let t =
|
|
1517
|
+
let t = $(e);
|
|
1516
1518
|
if (t === void 0) return;
|
|
1517
1519
|
i.push(t);
|
|
1518
1520
|
}
|
|
@@ -1521,43 +1523,43 @@ function un(e) {
|
|
|
1521
1523
|
return n ? l(a) : a;
|
|
1522
1524
|
}
|
|
1523
1525
|
// src/node/plugin/vite/subplugins/component-contract.ts
|
|
1524
|
-
var
|
|
1525
|
-
function
|
|
1526
|
+
var un = ".typedown/components.json";
|
|
1527
|
+
function dn(e) {
|
|
1526
1528
|
return {
|
|
1527
1529
|
name: "vite-plugin-typedown-component-contract",
|
|
1528
1530
|
async buildStart() {
|
|
1529
1531
|
let t = e();
|
|
1530
1532
|
if (!t) return;
|
|
1531
|
-
let n = await
|
|
1532
|
-
|
|
1533
|
+
let n = await L((await (await t.getTdContext()).getConfig()).components, t.root);
|
|
1534
|
+
gn(t.root, n);
|
|
1533
1535
|
},
|
|
1534
1536
|
configureServer(t) {
|
|
1535
1537
|
let n = e();
|
|
1536
1538
|
n && n.getTdContext().then(async (e) => {
|
|
1537
|
-
let r = await e.getConfig(), i = await
|
|
1538
|
-
|
|
1539
|
+
let r = await e.getConfig(), i = await L(r.components, n.root);
|
|
1540
|
+
gn(n.root, i), fn(t, r.components, n.root);
|
|
1539
1541
|
}).catch(() => {});
|
|
1540
1542
|
}
|
|
1541
1543
|
};
|
|
1542
1544
|
}
|
|
1543
|
-
function
|
|
1544
|
-
let r = new Set(t.filter((e) => e.kind === "explicit").map((e) =>
|
|
1545
|
+
function fn(e, t, n) {
|
|
1546
|
+
let r = new Set(t.filter((e) => e.kind === "explicit").map((e) => N(A.resolve(n, e.source)))), i = new Set(t.filter((e) => e.kind === "dir").map((e) => N(A.resolve(n, e.path))));
|
|
1545
1547
|
for (let t of i) e.watcher.add(t);
|
|
1546
1548
|
let a = (a) => {
|
|
1547
|
-
|
|
1549
|
+
pn(a, r, i) && (e.config.logger.info("[typedown] component changed, rebuilding contract..."), L(t, n).then((e) => gn(n, e)).catch(() => {}));
|
|
1548
1550
|
};
|
|
1549
1551
|
e.watcher.on("change", a), e.watcher.on("add", a), e.watcher.on("unlink", a);
|
|
1550
1552
|
}
|
|
1551
|
-
function
|
|
1553
|
+
function pn(e, t, n) {
|
|
1552
1554
|
if (!e.endsWith(".vue")) return !1;
|
|
1553
|
-
let r =
|
|
1555
|
+
let r = N(e);
|
|
1554
1556
|
if (t.has(r)) return !0;
|
|
1555
1557
|
for (let e of n) if (r.startsWith(e + "/")) return !0;
|
|
1556
1558
|
return !1;
|
|
1557
1559
|
}
|
|
1558
|
-
function
|
|
1560
|
+
function mn() {
|
|
1559
1561
|
try {
|
|
1560
|
-
let e =
|
|
1562
|
+
let e = A.dirname(ce(import.meta.url)), t = A.resolve(e, "builtin-components.json"), n = JSON.parse(F.readFileSync(t, "utf-8"));
|
|
1561
1563
|
for (let e of Object.values(n)) if (typeof e == "object" && e && "source" in e) {
|
|
1562
1564
|
let t = e;
|
|
1563
1565
|
typeof t.source == "string" && t.source.startsWith("./") && (t.source = `typerighter/${t.source.slice(2)}`);
|
|
@@ -1567,18 +1569,18 @@ function hn() {
|
|
|
1567
1569
|
return {};
|
|
1568
1570
|
}
|
|
1569
1571
|
}
|
|
1570
|
-
var
|
|
1571
|
-
function
|
|
1572
|
-
if (!(0 < Object.keys(
|
|
1573
|
-
let n = 0 < t.length ?
|
|
1574
|
-
...
|
|
1572
|
+
var hn = mn();
|
|
1573
|
+
function gn(e, t) {
|
|
1574
|
+
if (!(0 < Object.keys(hn).length) && t.length === 0) return;
|
|
1575
|
+
let n = 0 < t.length ? an(t, e, Pe(e)) : {}, r = {
|
|
1576
|
+
...hn,
|
|
1575
1577
|
...n
|
|
1576
|
-
}, i =
|
|
1577
|
-
|
|
1578
|
+
}, i = A.join(e, un);
|
|
1579
|
+
F.mkdirSync(A.dirname(i), { recursive: !0 }), F.writeFileSync(i, JSON.stringify(r, null, 2));
|
|
1578
1580
|
}
|
|
1579
1581
|
// src/node/plugin/vite/index.ts
|
|
1580
1582
|
function _n(t = {}) {
|
|
1581
|
-
let n = t.context, r, i, a, o = new
|
|
1583
|
+
let n = t.context, r, i, a, o = new Lt(t.root ?? ""), s = new zt(), l = new Rt(t.root ?? ""), u = new Ht(), d = new Zt(), f = {
|
|
1582
1584
|
devHtml: void 0,
|
|
1583
1585
|
basePath: "/",
|
|
1584
1586
|
rootDirectory: "vault"
|
|
@@ -1592,8 +1594,8 @@ function _n(t = {}) {
|
|
|
1592
1594
|
enforce: "pre",
|
|
1593
1595
|
async config(e) {
|
|
1594
1596
|
if (!n) {
|
|
1595
|
-
let r = t.root ?
|
|
1596
|
-
n =
|
|
1597
|
+
let r = t.root ? j(e.root ?? process.cwd(), t.root) : ne(e.root ?? process.cwd());
|
|
1598
|
+
n = te(r);
|
|
1597
1599
|
}
|
|
1598
1600
|
a = e.base ?? "/";
|
|
1599
1601
|
let r = await (await p()).getConfig();
|
|
@@ -1604,16 +1606,16 @@ function _n(t = {}) {
|
|
|
1604
1606
|
port: e.server?.port ?? 8686,
|
|
1605
1607
|
strictPort: e.server?.strictPort ?? !1
|
|
1606
1608
|
},
|
|
1607
|
-
resolve: { alias:
|
|
1609
|
+
resolve: { alias: $t() },
|
|
1608
1610
|
ssr: { noExternal: ["typerighter"] }
|
|
1609
1611
|
};
|
|
1610
1612
|
},
|
|
1611
1613
|
configResolved(e) {
|
|
1612
|
-
i =
|
|
1614
|
+
i = j(e.root, e.build.outDir);
|
|
1613
1615
|
},
|
|
1614
1616
|
async buildStart() {
|
|
1615
1617
|
if (r) return;
|
|
1616
|
-
let e = await p(), t = await e.getConfig(), n =
|
|
1618
|
+
let e = await p(), t = await e.getConfig(), n = j(t.rootDir);
|
|
1617
1619
|
d.index(n), await u.fetchSync(e);
|
|
1618
1620
|
let i = await e.checkVault();
|
|
1619
1621
|
if (Sn(i.diagnostics), 0 < i.errorCount) {
|
|
@@ -1622,12 +1624,12 @@ function _n(t = {}) {
|
|
|
1622
1624
|
}
|
|
1623
1625
|
},
|
|
1624
1626
|
resolveId(e) {
|
|
1625
|
-
if (e === "/@typedown/app" || e === "@typedown/app") return
|
|
1626
|
-
if (e === "@typedown/pages") return
|
|
1627
|
+
if (e === "/@typedown/app" || e === "@typedown/app") return Mt;
|
|
1628
|
+
if (e === "@typedown/pages") return Nt;
|
|
1627
1629
|
if (e.startsWith("@typedown/pages?resource=")) return l.resolvePageData(e);
|
|
1628
|
-
if (e === "@typedown/site-data") return
|
|
1629
|
-
if (e === "@typedown/search-index") return
|
|
1630
|
-
if (e === "@typedown/theme") return
|
|
1630
|
+
if (e === "@typedown/site-data") return Pt;
|
|
1631
|
+
if (e === "@typedown/search-index") return Ft;
|
|
1632
|
+
if (e === "@typedown/theme") return It;
|
|
1631
1633
|
},
|
|
1632
1634
|
async load(e) {
|
|
1633
1635
|
if (l.isPageDataModule(e)) return l.loadPageData(e, await p());
|
|
@@ -1641,7 +1643,7 @@ function _n(t = {}) {
|
|
|
1641
1643
|
},
|
|
1642
1644
|
async configureServer(e) {
|
|
1643
1645
|
r = e;
|
|
1644
|
-
let t = await p(), n = await t.getConfig(), i =
|
|
1646
|
+
let t = await p(), n = await t.getConfig(), i = j(n.rootDir);
|
|
1645
1647
|
d.index(i), u.scan(i), u.fetch(t, r), e.httpServer?.once("listening", async () => {
|
|
1646
1648
|
let e = await t.checkVault();
|
|
1647
1649
|
0 < e.diagnostics.length && (console.error(""), Sn(e.diagnostics));
|
|
@@ -1655,7 +1657,7 @@ function _n(t = {}) {
|
|
|
1655
1657
|
if (!r) return;
|
|
1656
1658
|
let n = [];
|
|
1657
1659
|
for (let i of e) {
|
|
1658
|
-
let e =
|
|
1660
|
+
let e = N(j(r.config.root, t.rootDir, i)), a = r.moduleGraph.getModulesByFile(e);
|
|
1659
1661
|
if (a?.size) {
|
|
1660
1662
|
for (let e of a) r.moduleGraph.invalidateModule(e), n.push(xn(e));
|
|
1661
1663
|
l.invalidatePageData(r, i);
|
|
@@ -1679,24 +1681,24 @@ function _n(t = {}) {
|
|
|
1679
1681
|
let m = await t.getConfig();
|
|
1680
1682
|
f.basePath = m.basePath, f.rootDirectory = m.rootDir, t.rpc.onConfigChanged((e) => {
|
|
1681
1683
|
f.basePath = e.basePath, f.rootDirectory = e.rootDir, f.devHtml = void 0;
|
|
1682
|
-
}), e.middlewares.use(
|
|
1684
|
+
}), e.middlewares.use(tn(e, f)), e.middlewares.use(nn(e, t, f));
|
|
1683
1685
|
},
|
|
1684
1686
|
async transform(t, n) {
|
|
1685
1687
|
let r = n.split("?")[0];
|
|
1686
1688
|
if (!w(r)) return;
|
|
1687
1689
|
if (e(r)) return {
|
|
1688
|
-
code: `<script>import theme from '${
|
|
1690
|
+
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
1691
|
map: null
|
|
1690
1692
|
};
|
|
1691
1693
|
let i = await p(), a = await i.getConfig(), o = c(r, a.rootDir);
|
|
1692
1694
|
try {
|
|
1693
|
-
let { vueSrc: e } = await
|
|
1695
|
+
let { vueSrc: e } = await Ot(i, await i.getFile(o), o);
|
|
1694
1696
|
return {
|
|
1695
1697
|
code: e,
|
|
1696
1698
|
map: null
|
|
1697
1699
|
};
|
|
1698
1700
|
} catch (e) {
|
|
1699
|
-
if (
|
|
1701
|
+
if (k(e)) return;
|
|
1700
1702
|
let t = e instanceof Error ? e.message : String(e);
|
|
1701
1703
|
this.error(`[typedown] Failed to transform ${o}: ${t}`);
|
|
1702
1704
|
}
|
|
@@ -1707,23 +1709,23 @@ function _n(t = {}) {
|
|
|
1707
1709
|
async closeBundle() {
|
|
1708
1710
|
if (!t.context && n) try {
|
|
1709
1711
|
let e = (await (await n.getTdContext()).getConfig()).basePath, t = e.startsWith(a) ? e.slice(a.length) : e.replace(/^\//, "");
|
|
1710
|
-
await
|
|
1711
|
-
outDir:
|
|
1712
|
+
await Le(n, {
|
|
1713
|
+
outDir: j(i, t),
|
|
1712
1714
|
base: e
|
|
1713
1715
|
});
|
|
1714
1716
|
} finally {
|
|
1715
1717
|
n.dispose();
|
|
1716
1718
|
}
|
|
1717
1719
|
}
|
|
1718
|
-
}, h =
|
|
1720
|
+
}, h = ae({
|
|
1719
1721
|
include: t.root ? RegExp(`${t.root.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}/.*\\.(?:vue|td)$`) : /\.(?:vue|td)$/,
|
|
1720
1722
|
template: { transformAssetUrls: !1 }
|
|
1721
1723
|
});
|
|
1722
1724
|
return [
|
|
1723
1725
|
m,
|
|
1724
|
-
|
|
1726
|
+
dn(() => n),
|
|
1725
1727
|
h,
|
|
1726
|
-
...
|
|
1728
|
+
...ie()
|
|
1727
1729
|
];
|
|
1728
1730
|
}
|
|
1729
1731
|
function vn(e) {
|
|
@@ -1750,8 +1752,8 @@ function xn(e) {
|
|
|
1750
1752
|
}
|
|
1751
1753
|
function Sn(e) {
|
|
1752
1754
|
for (let t of e) {
|
|
1753
|
-
let e = `${t.filepath}:${t.line}:${t.column}`, n = t.severity === "error" ?
|
|
1754
|
-
console.error(` ${n} ${e} ${t.message} ${
|
|
1755
|
+
let e = `${t.filepath}:${t.line}:${t.column}`, n = t.severity === "error" ? M.red("error") : M.yellow("warn");
|
|
1756
|
+
console.error(` ${n} ${e} ${t.message} ${M.dim(`(${t.code})`)}`);
|
|
1755
1757
|
}
|
|
1756
1758
|
}
|
|
1757
|
-
export {
|
|
1759
|
+
export { q as a, J as i, G as n, Y as o, X as r, Le as s, _n as t };
|