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