typerighter 0.40.7 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{app-OdN7kiy-.js → app-xAspP0Kq.js} +6 -6
- package/dist/{cli-s8kXR6K0.js → cli-xL59SSOm.js} +5 -5
- package/dist/cli.js +1 -2
- package/dist/client/theme-default.js +11 -26
- package/dist/client.js +1 -2
- package/dist/index.js +2 -2
- package/dist/{init-D14LSLGH.js → init-vb1LEYkf.js} +9 -13
- package/dist/{jsonld-BoEW-5KW.js → jsonld-Du1iJ_fG.js} +1 -1
- package/dist/node/build/index.d.ts.map +1 -1
- package/dist/node/plugin/vite/constants.d.ts +1 -0
- package/dist/node/plugin/vite/constants.d.ts.map +1 -1
- package/dist/node/plugin/vite/index.d.ts.map +1 -1
- package/dist/node/plugin/vite/virtual/app.d.ts.map +1 -1
- package/dist/node/plugin/vite/virtual/pages.d.ts +1 -0
- package/dist/node/plugin/vite/virtual/pages.d.ts.map +1 -1
- package/dist/node/plugin/vite/virtual/utils.d.ts.map +1 -1
- package/dist/prerenderWorker.js +4 -4
- package/dist/shared/types/ssg.d.ts +4 -4
- package/dist/shared/types/ssg.d.ts.map +1 -1
- package/dist/{shared-DMNZD2i1.js → shared-BMujDY3P.js} +1 -1
- package/dist/shared.js +1 -2
- package/dist/{temml-DZbhOfRE.js → temml-D47Z4xZ2.js} +31 -38
- package/dist/{vite-BlO1hmkO.js → vite-Dup9wBL7.js} +245 -226
- package/dist/vite.js +1 -2
- package/package.json +7 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as e, E as t, F as n, H as r, K as i, L as a, P as o, R as s, V as c, X as l, Y as u, _ as d, b as f, c as p, d as m, g as h, h as g, i as _, p as v, q as y, v as b, w as x, y as S, z as C } from "./shared-
|
|
2
|
-
import { a as w, i as T, n as E, o as ee, r as D, s as O, t as te } from "./jsonld-
|
|
3
|
-
import { t as ne } from "./temml-
|
|
1
|
+
import { D as e, E as t, F as n, H as r, K as i, L as a, P as o, R as s, V as c, X as l, Y as u, _ as d, b as f, c as p, d as m, g as h, h as g, i as _, p as v, q as y, v as b, w as x, y as S, z as C } from "./shared-BMujDY3P.js";
|
|
2
|
+
import { a as w, i as T, n as E, o as ee, r as D, s as O, t as te } from "./jsonld-Du1iJ_fG.js";
|
|
3
|
+
import { t as ne } from "./temml-D47Z4xZ2.js";
|
|
4
4
|
import { a as re, i as ie, n as ae, r as oe } from "./context-CSvoDxVt.js";
|
|
5
5
|
import { t as se } from "./es-ClqUVRJn.js";
|
|
6
6
|
import k, { resolve as A } from "node:path";
|
|
@@ -13,10 +13,10 @@ import { fileURLToPath as de } from "node:url";
|
|
|
13
13
|
import fe from "node:os";
|
|
14
14
|
import { Worker as pe } from "node:worker_threads";
|
|
15
15
|
import { createHighlighter as me, guessEmbeddedLanguages as he, isSpecialLang as ge } from "shiki";
|
|
16
|
-
import { createReadStream as _e, existsSync as ve, globSync as
|
|
17
|
-
import { createRequire as
|
|
16
|
+
import { createReadStream as _e, existsSync as ve, globSync as ye, readFileSync as be, statSync as xe } from "node:fs";
|
|
17
|
+
import { createRequire as Se } from "node:module";
|
|
18
18
|
//#region src/node/lib/worker-pool/index.ts
|
|
19
|
-
var
|
|
19
|
+
var Ce = class {
|
|
20
20
|
workers = [];
|
|
21
21
|
queue = [];
|
|
22
22
|
destroyed = !1;
|
|
@@ -62,7 +62,7 @@ var Se = class {
|
|
|
62
62
|
};
|
|
63
63
|
//#endregion
|
|
64
64
|
//#region src/node/build/seo/sitemap.ts
|
|
65
|
-
function
|
|
65
|
+
function we(e, t, n, r) {
|
|
66
66
|
let i = n ?? "";
|
|
67
67
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
68
68
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
@@ -73,7 +73,7 @@ ${e.map((e) => {
|
|
|
73
73
|
</urlset>
|
|
74
74
|
`;
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function Te(e, t) {
|
|
77
77
|
return `User-agent: *
|
|
78
78
|
Allow: /
|
|
79
79
|
|
|
@@ -82,7 +82,7 @@ Sitemap: ${e}${t}sitemap.xml
|
|
|
82
82
|
}
|
|
83
83
|
//#endregion
|
|
84
84
|
//#region src/node/build/seo/feed.ts
|
|
85
|
-
function
|
|
85
|
+
function Ee(e, t, n, r, i, a) {
|
|
86
86
|
let o = [...e].filter((e) => e.fileMetadata.mtime > 0).sort((e, t) => t.fileMetadata.mtime - e.fileMetadata.mtime).slice(0, 50).map((e) => {
|
|
87
87
|
let r = c(e.filepath), i = `${n}${t}${r}`, a = new Date(e.fileMetadata.mtime).toUTCString(), o = p(e.label ?? r), s = e.excerpt === void 0 ? "" : `<![CDATA[${e.excerpt}]]>`;
|
|
88
88
|
return ` <item>
|
|
@@ -108,13 +108,13 @@ ${o}
|
|
|
108
108
|
}
|
|
109
109
|
//#endregion
|
|
110
110
|
//#region src/node/build/prerender.ts
|
|
111
|
-
var
|
|
112
|
-
async function
|
|
113
|
-
let { clientEntry: t, cssFiles: n, jsFiles: r } = await
|
|
114
|
-
e.pagePaths.length >=
|
|
111
|
+
var De = 64;
|
|
112
|
+
async function Oe(e) {
|
|
113
|
+
let { clientEntry: t, cssFiles: n, jsFiles: r } = await je(e.clientOutDir), i = [n.map((t) => ` <link rel="stylesheet" href="${e.base}${t}">`).join("\n"), r.map((t) => ` <link rel="modulepreload" href="${e.base}${t}">`).join("\n")].filter(Boolean).join("\n") || void 0;
|
|
114
|
+
e.pagePaths.length >= De ? await ke(e, t, i) : await Ae(e, t, i);
|
|
115
115
|
}
|
|
116
|
-
async function
|
|
117
|
-
let r = new
|
|
116
|
+
async function ke(e, t, n) {
|
|
117
|
+
let r = new Ce({
|
|
118
118
|
filename: k.resolve(de(import.meta.url), "../prerenderWorker.js"),
|
|
119
119
|
workerData: {
|
|
120
120
|
ssrEntryPath: e.ssrEntryPath,
|
|
@@ -136,37 +136,34 @@ async function Oe(e, t, n) {
|
|
|
136
136
|
await r.destroy();
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
async function
|
|
140
|
-
let r = await import(e.ssrEntryPath), i = e.pagePaths.length, a = 0;
|
|
141
|
-
for (let s
|
|
142
|
-
let c =
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}), h = s === "/" ? "index.html" : `${o(s)}.html`, g = k.join(e.outDir, h);
|
|
165
|
-
await N.mkdir(k.dirname(g), { recursive: !0 }), await N.writeFile(g, m), a++, e.progress?.update(a, i);
|
|
166
|
-
}));
|
|
139
|
+
async function Ae(e, t, n) {
|
|
140
|
+
let r = await (await import(e.ssrEntryPath)).createRenderer(), i = e.pagePaths.length, a = 0;
|
|
141
|
+
for (let s of e.pagePaths) {
|
|
142
|
+
let c = await r(s), l = ee(c.pageData), u = w(c.pageData), d = D(c.pageData), f = e.base + o(s), p = [te({
|
|
143
|
+
title: l,
|
|
144
|
+
description: u,
|
|
145
|
+
canonicalUrl: f,
|
|
146
|
+
author: e.author,
|
|
147
|
+
dateModified: d
|
|
148
|
+
}), E(s, l)].filter((e) => e !== void 0), m = O({
|
|
149
|
+
title: l,
|
|
150
|
+
description: u,
|
|
151
|
+
siteTitle: e.siteTitle,
|
|
152
|
+
author: e.author,
|
|
153
|
+
base: e.base,
|
|
154
|
+
origin: e.origin,
|
|
155
|
+
lang: e.lang,
|
|
156
|
+
entryScript: t,
|
|
157
|
+
canonicalUrl: f,
|
|
158
|
+
ogImagePath: T(c.pageData),
|
|
159
|
+
jsonLdBlocks: p,
|
|
160
|
+
headExtra: n,
|
|
161
|
+
appContent: c.html
|
|
162
|
+
}), h = s === "/" ? "index.html" : `${o(s)}.html`, g = k.join(e.outDir, h);
|
|
163
|
+
await N.mkdir(k.dirname(g), { recursive: !0 }), await N.writeFile(g, m), a++, e.progress?.update(a, i);
|
|
167
164
|
}
|
|
168
165
|
}
|
|
169
|
-
async function
|
|
166
|
+
async function je(e) {
|
|
170
167
|
let t = k.join(e, ".vite", "manifest.json"), n = await N.readFile(t, "utf-8"), r = JSON.parse(n), i = "", a = [], o = [];
|
|
171
168
|
for (let e of Object.values(r)) e.isEntry ? (i = e.file, e.css && a.push(...e.css)) : e.file.endsWith(".js") && o.push(e.file);
|
|
172
169
|
return {
|
|
@@ -177,12 +174,12 @@ async function Ae(e) {
|
|
|
177
174
|
}
|
|
178
175
|
//#endregion
|
|
179
176
|
//#region src/node/lib/progress.ts
|
|
180
|
-
var
|
|
177
|
+
var P = [
|
|
181
178
|
"◐",
|
|
182
179
|
"◓",
|
|
183
180
|
"◑",
|
|
184
181
|
"◒"
|
|
185
|
-
],
|
|
182
|
+
], F = class {
|
|
186
183
|
logger;
|
|
187
184
|
label;
|
|
188
185
|
start;
|
|
@@ -190,8 +187,8 @@ var F = [
|
|
|
190
187
|
constructor(e, t) {
|
|
191
188
|
if (this.logger = e, this.label = t, this.start = performance.now(), process.stdout.isTTY) {
|
|
192
189
|
let e = 0;
|
|
193
|
-
process.stdout.write(j.cyan(`${
|
|
194
|
-
e = (e + 1) %
|
|
190
|
+
process.stdout.write(j.cyan(`${P[0]} ${t}`)), this.spinnerInterval = setInterval(() => {
|
|
191
|
+
e = (e + 1) % P.length, process.stdout.write(`\r${j.cyan(`${P[e]} ${this.label}`)}`);
|
|
195
192
|
}, 120).unref();
|
|
196
193
|
} else this.logger.start(t);
|
|
197
194
|
}
|
|
@@ -203,70 +200,69 @@ var F = [
|
|
|
203
200
|
done(e) {
|
|
204
201
|
this.stopSpinner(), process.stdout.isTTY && process.stdout.write("\r\x1B[K");
|
|
205
202
|
let t = Math.round(performance.now() - this.start);
|
|
206
|
-
this.logger.success(`${e} (${
|
|
203
|
+
this.logger.success(`${e} (${Me(t)})`);
|
|
207
204
|
}
|
|
208
205
|
stopSpinner() {
|
|
209
206
|
this.spinnerInterval &&= (clearInterval(this.spinnerInterval), void 0);
|
|
210
207
|
}
|
|
211
208
|
};
|
|
212
|
-
function
|
|
209
|
+
function Me(e) {
|
|
213
210
|
return e < 1e3 ? `${Math.round(e)}ms` : `${(e / 1e3).toFixed(1)}s`;
|
|
214
211
|
}
|
|
215
212
|
//#endregion
|
|
216
213
|
//#region src/node/build/index.ts
|
|
217
|
-
var
|
|
218
|
-
async function
|
|
214
|
+
var Ne = "typerighter/client/theme-default";
|
|
215
|
+
async function I(e, t = {}) {
|
|
219
216
|
let { root: n, logger: r } = e, i = k.resolve(n, t.outDir ?? "dist"), a = k.join(i, ".client"), o = k.join(i, ".server");
|
|
220
217
|
await N.rm(i, {
|
|
221
218
|
recursive: !0,
|
|
222
219
|
force: !0
|
|
223
220
|
});
|
|
224
|
-
let s = await e.getTdContext(), [l, u, d
|
|
221
|
+
let s = await e.getTdContext(), [l, u, d] = await Promise.all([
|
|
225
222
|
s.getConfig(),
|
|
226
223
|
s.listFiles(),
|
|
227
|
-
s.listSidebar()
|
|
228
|
-
|
|
229
|
-
]), p = l.origin ?? void 0, m = l.author ?? void 0, h = l.license ?? void 0, _ = l.repo ?? void 0, v = t.base ?? l.basePath ?? "/", y = v.endsWith("/") ? v : v + "/", b = d.map((e) => ({
|
|
224
|
+
s.listSidebar()
|
|
225
|
+
]), 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 = _.endsWith("/") ? _ : _ + "/", y = d.map((e) => ({
|
|
230
226
|
...e,
|
|
231
227
|
header: {}
|
|
232
|
-
})),
|
|
228
|
+
})), b = g(y), x = JSON.stringify({
|
|
233
229
|
title: l.siteTitle,
|
|
234
230
|
description: l.siteDescription,
|
|
235
|
-
basePath:
|
|
236
|
-
origin:
|
|
231
|
+
basePath: v,
|
|
232
|
+
origin: f,
|
|
237
233
|
lang: l.lang,
|
|
238
234
|
nav: l.nav
|
|
239
|
-
}),
|
|
235
|
+
}), S = JSON.stringify({
|
|
240
236
|
ready: !0,
|
|
241
|
-
contentTree:
|
|
242
|
-
}),
|
|
243
|
-
await N.mkdir(
|
|
244
|
-
let
|
|
245
|
-
await Promise.all([N.writeFile(
|
|
237
|
+
contentTree: b
|
|
238
|
+
}), C = k.join(n, "node_modules", ".typerighter");
|
|
239
|
+
await N.mkdir(C, { recursive: !0 });
|
|
240
|
+
let w = k.join(C, "client-entry.js"), T = k.join(C, "ssr-entry.js");
|
|
241
|
+
await Promise.all([N.writeFile(w, Q({
|
|
246
242
|
rootDir: l.rootDir,
|
|
247
|
-
basePath:
|
|
248
|
-
origin:
|
|
243
|
+
basePath: v,
|
|
244
|
+
origin: f,
|
|
249
245
|
lang: l.lang,
|
|
250
246
|
siteTitle: l.siteTitle,
|
|
251
247
|
siteDescription: l.siteDescription,
|
|
252
|
-
repo:
|
|
253
|
-
author:
|
|
254
|
-
license:
|
|
248
|
+
repo: h,
|
|
249
|
+
author: p,
|
|
250
|
+
license: m,
|
|
255
251
|
nav: l.nav
|
|
256
|
-
})), N.writeFile(
|
|
252
|
+
})), N.writeFile(T, Pe({
|
|
257
253
|
rootDir: l.rootDir,
|
|
258
|
-
layoutImport:
|
|
259
|
-
siteConfig:
|
|
260
|
-
siteData:
|
|
254
|
+
layoutImport: Ne,
|
|
255
|
+
siteConfig: x,
|
|
256
|
+
siteData: S
|
|
261
257
|
}))]);
|
|
262
258
|
try {
|
|
263
|
-
let s = $({ context: e }),
|
|
259
|
+
let s = $({ context: e }), m = e.createViteLogger(), h = new F(r, "Building client bundle...");
|
|
264
260
|
await M({
|
|
265
261
|
...t.viteConfig,
|
|
266
262
|
root: n,
|
|
267
|
-
base:
|
|
263
|
+
base: v,
|
|
268
264
|
plugins: s,
|
|
269
|
-
customLogger:
|
|
265
|
+
customLogger: m,
|
|
270
266
|
logLevel: "silent",
|
|
271
267
|
build: {
|
|
272
268
|
...t.viteConfig?.build,
|
|
@@ -275,59 +271,59 @@ async function L(e, t = {}) {
|
|
|
275
271
|
emptyOutDir: !0,
|
|
276
272
|
rollupOptions: {
|
|
277
273
|
...t.viteConfig?.build?.rollupOptions,
|
|
278
|
-
input:
|
|
274
|
+
input: w
|
|
279
275
|
}
|
|
280
276
|
}
|
|
281
277
|
});
|
|
282
278
|
let g = await N.readdir(k.join(a, "assets")).catch(() => []);
|
|
283
279
|
h.done(`Client bundle (${g.length} chunks)`);
|
|
284
|
-
let _ = new
|
|
280
|
+
let _ = new F(r, "Building SSR bundle...");
|
|
285
281
|
await M({
|
|
286
282
|
...t.viteConfig,
|
|
287
283
|
root: n,
|
|
288
|
-
base:
|
|
284
|
+
base: v,
|
|
289
285
|
plugins: s,
|
|
290
|
-
customLogger:
|
|
286
|
+
customLogger: m,
|
|
291
287
|
logLevel: "silent",
|
|
292
288
|
build: {
|
|
293
289
|
...t.viteConfig?.build,
|
|
294
290
|
outDir: o,
|
|
295
|
-
ssr:
|
|
291
|
+
ssr: T,
|
|
296
292
|
emptyOutDir: !0
|
|
297
293
|
}
|
|
298
294
|
}), _.done("SSR bundle");
|
|
299
|
-
let
|
|
295
|
+
let y = u.map((e) => {
|
|
300
296
|
let t = c(e);
|
|
301
297
|
return t === "index" ? "/" : `/${t}`;
|
|
302
298
|
});
|
|
303
|
-
|
|
304
|
-
let
|
|
305
|
-
await
|
|
299
|
+
y.push("/"), L(b.entries, "", y);
|
|
300
|
+
let x = new F(r, "Pre-rendering pages...");
|
|
301
|
+
await Oe({
|
|
306
302
|
ssrEntryPath: k.join(o, "ssr-entry.js"),
|
|
307
303
|
clientOutDir: a,
|
|
308
304
|
outDir: i,
|
|
309
|
-
base:
|
|
310
|
-
origin:
|
|
305
|
+
base: v,
|
|
306
|
+
origin: f,
|
|
311
307
|
lang: l.lang,
|
|
312
|
-
pagePaths:
|
|
308
|
+
pagePaths: y,
|
|
313
309
|
siteTitle: l.siteTitle,
|
|
314
|
-
author:
|
|
315
|
-
progress:
|
|
316
|
-
}),
|
|
310
|
+
author: p,
|
|
311
|
+
progress: x
|
|
312
|
+
}), x.done(`Pre-rendered ${y.length} pages`);
|
|
317
313
|
let S = /* @__PURE__ */ new Map();
|
|
318
314
|
for (let e of d) {
|
|
319
315
|
let t = c(e.filepath), n = t === "index" ? "/" : `/${t}`;
|
|
320
316
|
S.set(n, e.fileMetadata.mtime);
|
|
321
317
|
}
|
|
322
|
-
let C =
|
|
323
|
-
|
|
318
|
+
let C = we(y, v, f, S), E = [N.writeFile(k.join(i, "sitemap.xml"), C)];
|
|
319
|
+
f !== void 0 && (E.push(N.writeFile(k.join(i, "robots.txt"), Te(f, v))), E.push(N.writeFile(k.join(i, "feed.xml"), Ee(d, v, f, l.siteTitle, l.siteDescription, l.lang)))), await Promise.all(E);
|
|
324
320
|
let ee = k.join(a, "assets"), D = k.join(i, "assets");
|
|
325
|
-
await N.cp(ee, D, { recursive: !0 }).catch(() => {}), await
|
|
321
|
+
await N.cp(ee, D, { recursive: !0 }).catch(() => {}), await Fe(k.join(n, l.rootDir), i);
|
|
326
322
|
let O = k.join(n, l.publicDir);
|
|
327
323
|
await N.cp(O, i, { recursive: !0 }).catch(() => {});
|
|
328
324
|
} finally {
|
|
329
325
|
await Promise.all([
|
|
330
|
-
N.rm(
|
|
326
|
+
N.rm(C, {
|
|
331
327
|
recursive: !0,
|
|
332
328
|
force: !0
|
|
333
329
|
}),
|
|
@@ -343,7 +339,7 @@ async function L(e, t = {}) {
|
|
|
343
339
|
}
|
|
344
340
|
r.log(`\nBuild complete. Output: ${i}`);
|
|
345
341
|
}
|
|
346
|
-
function
|
|
342
|
+
function Pe(e) {
|
|
347
343
|
let t = `/${e.rootDir}/${y}`, n = JSON.parse(e.siteConfig), r = JSON.parse(e.siteData), a = r.contentTree ?? { entries: [] }, o = h(a.entries ?? [], n.title ?? ""), s = JSON.stringify({
|
|
348
344
|
...r,
|
|
349
345
|
directoryListings: o
|
|
@@ -384,15 +380,17 @@ function loadPageModule(pagePath) {
|
|
|
384
380
|
return Promise.resolve(undefined);
|
|
385
381
|
}
|
|
386
382
|
|
|
387
|
-
export async function
|
|
383
|
+
export async function createRenderer() {
|
|
388
384
|
const { app, router } = await createTypedownApp(loadPageModule, theme.Layout, ${e.siteConfig}, siteData);
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
385
|
+
return async function render(url) {
|
|
386
|
+
await router.go(url, { replace: true });
|
|
387
|
+
const html = await renderToString(app);
|
|
388
|
+
return { html, pageData: router.route.data };
|
|
389
|
+
};
|
|
392
390
|
}
|
|
393
391
|
`;
|
|
394
392
|
}
|
|
395
|
-
async function
|
|
393
|
+
async function Fe(e, t) {
|
|
396
394
|
let n = (await N.readdir(e, {
|
|
397
395
|
recursive: !0,
|
|
398
396
|
withFileTypes: !0
|
|
@@ -402,22 +400,22 @@ async function Pe(e, t) {
|
|
|
402
400
|
});
|
|
403
401
|
await Promise.all(n);
|
|
404
402
|
}
|
|
405
|
-
function
|
|
403
|
+
function L(e, t, n) {
|
|
406
404
|
for (let r of e) {
|
|
407
405
|
if (r.kind !== "dir") continue;
|
|
408
406
|
let e = `${t}/${r.node.name}`;
|
|
409
|
-
d(r.node) || n.push(x(e)),
|
|
407
|
+
d(r.node) || n.push(x(e)), L(r.node.entries, e, n);
|
|
410
408
|
}
|
|
411
409
|
}
|
|
412
410
|
//#endregion
|
|
413
411
|
//#region ../../node_modules/.pnpm/@shikijs+transformers@4.4.3/node_modules/@shikijs/transformers/dist/index.mjs
|
|
414
|
-
var
|
|
412
|
+
var Ie = /(\s+\/\/)/, Le = /(?:\/\/|["'#]|;{1,2}|%{1,2}|--)(\s*)$/, Re = /(?:\/\/|#|;{1,2}|%{1,2}|--)(\s*)$/, ze = [
|
|
415
413
|
[/^(<!--)(.+)(-->)$/, !1],
|
|
416
414
|
[/^(\/\*)(.+)(\*\/)$/, !1],
|
|
417
415
|
[/^(\/\/|["'#]|;{1,2}|%{1,2}|--)(.*)$/, !0],
|
|
418
416
|
[/^(\*)(.+)$/, !0]
|
|
419
417
|
];
|
|
420
|
-
function
|
|
418
|
+
function Be(e, t, n) {
|
|
421
419
|
let r = [];
|
|
422
420
|
for (let i of e) {
|
|
423
421
|
if (n === "v3") {
|
|
@@ -426,8 +424,8 @@ function ze(e, t, n) {
|
|
|
426
424
|
let n = e.children[0];
|
|
427
425
|
if (n.type !== "text") return e;
|
|
428
426
|
let r = t === i.children.length - 1;
|
|
429
|
-
if (!
|
|
430
|
-
let a = n.value.split(
|
|
427
|
+
if (!R(n.value, r)) return e;
|
|
428
|
+
let a = n.value.split(Ie);
|
|
431
429
|
if (a.length <= 1) return e;
|
|
432
430
|
let o = [a[0]];
|
|
433
431
|
for (let e = 1; e < a.length; e += 2) o.push(a[e] + (a[e + 1] || ""));
|
|
@@ -448,13 +446,13 @@ function ze(e, t, n) {
|
|
|
448
446
|
if (a.type !== "element") continue;
|
|
449
447
|
let o = a.children.at(0);
|
|
450
448
|
if (o?.type !== "text") continue;
|
|
451
|
-
let s = n === e.length - 1, c =
|
|
449
|
+
let s = n === e.length - 1, c = R(o.value, s), l;
|
|
452
450
|
if (!c && n > 0 && o.value.trim().startsWith("[!code")) {
|
|
453
451
|
let t = e[n - 1];
|
|
454
452
|
if (t?.type === "element") {
|
|
455
453
|
let n = t.children.at(0);
|
|
456
454
|
if (n?.type === "text" && n.value.includes("//")) {
|
|
457
|
-
let l =
|
|
455
|
+
let l = R(n.value + o.value, s);
|
|
458
456
|
if (l) {
|
|
459
457
|
c = l, r.push({
|
|
460
458
|
info: l,
|
|
@@ -471,7 +469,7 @@ function ze(e, t, n) {
|
|
|
471
469
|
}
|
|
472
470
|
if (c) {
|
|
473
471
|
if (t && !s && n !== 0) {
|
|
474
|
-
let t =
|
|
472
|
+
let t = Ve(e[n - 1], "{") && Ve(e[n + 1], "}");
|
|
475
473
|
r.push({
|
|
476
474
|
info: c,
|
|
477
475
|
line: i,
|
|
@@ -493,16 +491,16 @@ function ze(e, t, n) {
|
|
|
493
491
|
}
|
|
494
492
|
return r;
|
|
495
493
|
}
|
|
496
|
-
function
|
|
494
|
+
function Ve(e, t) {
|
|
497
495
|
if (e.type !== "element") return !1;
|
|
498
496
|
let n = e.children[0];
|
|
499
497
|
return n.type === "text" && n.value.trim() === t;
|
|
500
498
|
}
|
|
501
|
-
function
|
|
499
|
+
function R(e, t) {
|
|
502
500
|
let n = e.trimStart(), r = e.length - n.length;
|
|
503
501
|
n = n.trimEnd();
|
|
504
502
|
let i = e.length - n.length - r;
|
|
505
|
-
for (let [e, a] of
|
|
503
|
+
for (let [e, a] of ze) {
|
|
506
504
|
if (a && !t) continue;
|
|
507
505
|
let o = e.exec(n);
|
|
508
506
|
if (o) return [
|
|
@@ -512,22 +510,22 @@ function z(e, t) {
|
|
|
512
510
|
];
|
|
513
511
|
}
|
|
514
512
|
}
|
|
515
|
-
function Ve(e) {
|
|
516
|
-
let t = e.match(Ie);
|
|
517
|
-
return t && t[1].trim().length === 0 ? e.slice(0, t.index) : e;
|
|
518
|
-
}
|
|
519
513
|
function He(e) {
|
|
520
514
|
let t = e.match(Le);
|
|
515
|
+
return t && t[1].trim().length === 0 ? e.slice(0, t.index) : e;
|
|
516
|
+
}
|
|
517
|
+
function Ue(e) {
|
|
518
|
+
let t = e.match(Re);
|
|
521
519
|
return t && t[1].trim().length === 0 ? e.slice(0, t.index).trimEnd() : e;
|
|
522
520
|
}
|
|
523
|
-
function
|
|
521
|
+
function We(e, t, n, r) {
|
|
524
522
|
return r ??= "v3", {
|
|
525
523
|
name: e,
|
|
526
524
|
code(e) {
|
|
527
525
|
let i = e.children.filter((e) => e.type === "element"), a = [];
|
|
528
526
|
e.data ??= {};
|
|
529
527
|
let o = e.data;
|
|
530
|
-
o._shiki_notation ??=
|
|
528
|
+
o._shiki_notation ??= Be(i, ["jsx", "tsx"].includes(this.options.lang), r);
|
|
531
529
|
let s = o._shiki_notation;
|
|
532
530
|
for (let e of s) {
|
|
533
531
|
if (e.info[1].length === 0) continue;
|
|
@@ -535,7 +533,7 @@ function Ue(e, t, n, r) {
|
|
|
535
533
|
e.isLineCommentOnly && r !== "v1" && o++;
|
|
536
534
|
let s = !1;
|
|
537
535
|
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;
|
|
538
|
-
r === "v1" ? e.info[1] =
|
|
536
|
+
r === "v1" ? e.info[1] = He(e.info[1]) : r === "v3" && (e.info[1] = Ue(e.info[1]));
|
|
539
537
|
let c = e.info[1].trim().length === 0;
|
|
540
538
|
if (c && (e.info[1] = ""), c && e.isLineCommentOnly) a.push(e.line);
|
|
541
539
|
else if (c && e.isJsxStyle) e.line.children.splice(e.line.children.indexOf(e.token) - 1, 3);
|
|
@@ -560,44 +558,44 @@ function Ue(e, t, n, r) {
|
|
|
560
558
|
}
|
|
561
559
|
};
|
|
562
560
|
}
|
|
563
|
-
var
|
|
564
|
-
function
|
|
561
|
+
var Ge = /\{([\d,-]+)\}/;
|
|
562
|
+
function Ke(e) {
|
|
565
563
|
if (!e) return null;
|
|
566
|
-
let t = e.match(
|
|
564
|
+
let t = e.match(Ge);
|
|
567
565
|
return t ? t[1].split(",").flatMap((e) => {
|
|
568
566
|
let t = e.split("-").map((e) => Number.parseInt(e, 10));
|
|
569
567
|
return t.length === 1 ? [t[0]] : Array.from({ length: t[1] - t[0] + 1 }, (e, n) => t[0] + n);
|
|
570
568
|
}) : null;
|
|
571
569
|
}
|
|
572
|
-
var
|
|
573
|
-
function
|
|
570
|
+
var qe = Symbol("highlighted-lines");
|
|
571
|
+
function Je(e = {}) {
|
|
574
572
|
let { className: t = "highlighted", zeroIndexed: n = !1 } = e;
|
|
575
573
|
return {
|
|
576
574
|
name: "@shikijs/transformers:meta-highlight",
|
|
577
575
|
line(e, r) {
|
|
578
576
|
if (!this.options.meta?.__raw) return;
|
|
579
577
|
let i = this.meta;
|
|
580
|
-
i[
|
|
581
|
-
let a = i[
|
|
578
|
+
i[qe] ??= Ke(this.options.meta.__raw);
|
|
579
|
+
let a = i[qe] ?? [], o = n ? r - 1 : r;
|
|
582
580
|
return a.includes(o) && this.addClassToHast(e, t), e;
|
|
583
581
|
}
|
|
584
582
|
};
|
|
585
583
|
}
|
|
586
|
-
var
|
|
587
|
-
function
|
|
588
|
-
return e.replace(
|
|
584
|
+
var Ye = /[.*+?^${}()|[\]\\]/g;
|
|
585
|
+
function Xe(e) {
|
|
586
|
+
return e.replace(Ye, "\\$&");
|
|
589
587
|
}
|
|
590
|
-
function
|
|
588
|
+
function z(e = {}, t = "@shikijs/transformers:notation-map") {
|
|
591
589
|
let { classMap: n = {}, classActivePre: r = void 0, classActiveCode: i = void 0 } = e;
|
|
592
|
-
return
|
|
590
|
+
return We(t, RegExp(`#?\\s*\\[!code (${Object.keys(n).map(Xe).join("|")})(:\\d+)?\\]`, "gi"), function([e, t, a = ":1"], o, s, c, l) {
|
|
593
591
|
let u = Number.parseInt(a.slice(1), 10);
|
|
594
592
|
for (let e = l; e < Math.min(l + u, c.length); e++) this.addClassToHast(c[e], n[t]);
|
|
595
593
|
return r && this.addClassToHast(this.pre, r), i && this.addClassToHast(this.code, i), !0;
|
|
596
594
|
}, e.matchAlgorithm);
|
|
597
595
|
}
|
|
598
|
-
function
|
|
596
|
+
function Ze(e = {}) {
|
|
599
597
|
let { classLineAdd: t = "diff add", classLineRemove: n = "diff remove", classActivePre: r = "has-diff", classActiveCode: i } = e;
|
|
600
|
-
return
|
|
598
|
+
return z({
|
|
601
599
|
classMap: {
|
|
602
600
|
"++": t,
|
|
603
601
|
"--": n
|
|
@@ -607,31 +605,31 @@ function Xe(e = {}) {
|
|
|
607
605
|
matchAlgorithm: e.matchAlgorithm
|
|
608
606
|
}, "@shikijs/transformers:notation-diff");
|
|
609
607
|
}
|
|
610
|
-
function
|
|
608
|
+
function Qe(e = {}) {
|
|
611
609
|
let { classMap: t = {
|
|
612
610
|
error: ["highlighted", "error"],
|
|
613
611
|
warning: ["highlighted", "warning"],
|
|
614
612
|
info: ["highlighted", "info"]
|
|
615
613
|
}, classActivePre: n = "has-highlighted", classActiveCode: r } = e;
|
|
616
|
-
return
|
|
614
|
+
return z({
|
|
617
615
|
classMap: t,
|
|
618
616
|
classActivePre: n,
|
|
619
617
|
classActiveCode: r,
|
|
620
618
|
matchAlgorithm: e.matchAlgorithm
|
|
621
619
|
}, "@shikijs/transformers:notation-error-level");
|
|
622
620
|
}
|
|
623
|
-
function
|
|
621
|
+
function $e(e = {}) {
|
|
624
622
|
let { classActiveLine: t = "focused", classActivePre: n = "has-focused", classActiveCode: r } = e;
|
|
625
|
-
return
|
|
623
|
+
return z({
|
|
626
624
|
classMap: { focus: t },
|
|
627
625
|
classActivePre: n,
|
|
628
626
|
classActiveCode: r,
|
|
629
627
|
matchAlgorithm: e.matchAlgorithm
|
|
630
628
|
}, "@shikijs/transformers:notation-focus");
|
|
631
629
|
}
|
|
632
|
-
function
|
|
630
|
+
function et(e = {}) {
|
|
633
631
|
let { classActiveLine: t = "highlighted", classActivePre: n = "has-highlighted", classActiveCode: r } = e;
|
|
634
|
-
return
|
|
632
|
+
return z({
|
|
635
633
|
classMap: {
|
|
636
634
|
highlight: t,
|
|
637
635
|
hl: t
|
|
@@ -643,42 +641,42 @@ function $e(e = {}) {
|
|
|
643
641
|
}
|
|
644
642
|
//#endregion
|
|
645
643
|
//#region src/node/lib/render/highlight/language.ts
|
|
646
|
-
var
|
|
644
|
+
var tt = [
|
|
647
645
|
"shellscript",
|
|
648
646
|
"shell",
|
|
649
647
|
"bash",
|
|
650
648
|
"sh",
|
|
651
649
|
"zsh"
|
|
652
650
|
];
|
|
653
|
-
function
|
|
654
|
-
return
|
|
651
|
+
function nt(e) {
|
|
652
|
+
return tt.includes(e);
|
|
655
653
|
}
|
|
656
|
-
var
|
|
657
|
-
function
|
|
658
|
-
return
|
|
654
|
+
var rt = /^[a-zA-Z0-9-_]+/;
|
|
655
|
+
function it(e) {
|
|
656
|
+
return rt.exec(e)?.[0] || "";
|
|
659
657
|
}
|
|
660
658
|
//#endregion
|
|
661
659
|
//#region src/node/lib/render/highlight/index.ts
|
|
662
|
-
var
|
|
660
|
+
var at = new FinalizationRegistry((e) => {
|
|
663
661
|
e();
|
|
664
|
-
}),
|
|
662
|
+
}), B = {
|
|
665
663
|
light: "github-light",
|
|
666
664
|
dark: "github-dark"
|
|
667
665
|
};
|
|
668
|
-
async function
|
|
666
|
+
async function ot() {
|
|
669
667
|
let e = await me({
|
|
670
|
-
themes: [
|
|
668
|
+
themes: [B.light, B.dark],
|
|
671
669
|
langs: []
|
|
672
670
|
}), t = [
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
671
|
+
Je(),
|
|
672
|
+
Ze(),
|
|
673
|
+
$e({
|
|
676
674
|
classActiveLine: "has-focus",
|
|
677
675
|
classActivePre: "has-focused-lines"
|
|
678
676
|
}),
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
677
|
+
et(),
|
|
678
|
+
Qe(),
|
|
679
|
+
st(),
|
|
682
680
|
{
|
|
683
681
|
name: "typedown:add-dir",
|
|
684
682
|
pre(e) {
|
|
@@ -687,7 +685,7 @@ async function at() {
|
|
|
687
685
|
}
|
|
688
686
|
], n = new Set(e.getLoadedLanguages());
|
|
689
687
|
async function r(r, i, a) {
|
|
690
|
-
let o =
|
|
688
|
+
let o = it(i);
|
|
691
689
|
if (o) {
|
|
692
690
|
let e = i;
|
|
693
691
|
i = o.toLowerCase(), a = e.slice(i.length).replace(/(?<!=)\{/g, " {") + " " + a, a = a.trim().replace(/\s+/g, " ");
|
|
@@ -716,7 +714,7 @@ async function at() {
|
|
|
716
714
|
}
|
|
717
715
|
}],
|
|
718
716
|
meta: { __raw: a },
|
|
719
|
-
themes:
|
|
717
|
+
themes: B,
|
|
720
718
|
defaultColor: !1,
|
|
721
719
|
colorReplacements: {
|
|
722
720
|
"github-light": {
|
|
@@ -741,13 +739,13 @@ async function at() {
|
|
|
741
739
|
}
|
|
742
740
|
});
|
|
743
741
|
}
|
|
744
|
-
return
|
|
742
|
+
return at.register(r, () => e.dispose()), r;
|
|
745
743
|
}
|
|
746
|
-
function
|
|
744
|
+
function st() {
|
|
747
745
|
return {
|
|
748
746
|
name: "typedown:disable-shell-symbol-select",
|
|
749
747
|
tokens(e) {
|
|
750
|
-
if (
|
|
748
|
+
if (nt(this.options.lang)) for (let t of e) {
|
|
751
749
|
if (t.length < 2) continue;
|
|
752
750
|
let e = t[0].content.trim();
|
|
753
751
|
(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));
|
|
@@ -757,20 +755,20 @@ function ot() {
|
|
|
757
755
|
}
|
|
758
756
|
//#endregion
|
|
759
757
|
//#region src/node/lib/render/postprocess.ts
|
|
760
|
-
var
|
|
761
|
-
async function
|
|
762
|
-
return e = await
|
|
758
|
+
var V;
|
|
759
|
+
async function ct(e) {
|
|
760
|
+
return e = await dt(e), e = ht(e), e;
|
|
763
761
|
}
|
|
764
|
-
function
|
|
765
|
-
return
|
|
762
|
+
function lt() {
|
|
763
|
+
return V ||= ot(), V;
|
|
766
764
|
}
|
|
767
|
-
var
|
|
768
|
-
async function
|
|
769
|
-
let t = await
|
|
765
|
+
var ut = /<pre class="td-code-placeholder"(?: data-lang="([^"]*)")?(?: data-meta="([^"]*)")?><code>([\s\S]*?)<\/code><\/pre>/g;
|
|
766
|
+
async function dt(e) {
|
|
767
|
+
let t = await lt(), n = [...e.matchAll(ut)];
|
|
770
768
|
if (n.length === 0) return e;
|
|
771
769
|
let r = await Promise.all(n.map(async (e) => {
|
|
772
770
|
let n = e[1] || "", r = e[2] || "", i = m(e[3]);
|
|
773
|
-
return
|
|
771
|
+
return ft(await t(i, n, r), n, r);
|
|
774
772
|
})), i = e;
|
|
775
773
|
for (let e = n.length - 1; 0 <= e; e--) {
|
|
776
774
|
let t = n[e];
|
|
@@ -778,7 +776,7 @@ async function ut(e) {
|
|
|
778
776
|
}
|
|
779
777
|
return i;
|
|
780
778
|
}
|
|
781
|
-
function
|
|
779
|
+
function ft(e, t, n) {
|
|
782
780
|
t ||= "txt";
|
|
783
781
|
let r = t.replace(/_/g, " "), i = `<div class="language-${t}"><button title="Copy code" data-copied="Copied" class="copy"></button><span class="lang">${r}</span>` + e + "</div>";
|
|
784
782
|
if (/:line-numbers\b/.test(n)) {
|
|
@@ -789,11 +787,11 @@ function dt(e, t, n) {
|
|
|
789
787
|
}
|
|
790
788
|
return i;
|
|
791
789
|
}
|
|
792
|
-
var
|
|
793
|
-
function
|
|
794
|
-
return e = e.replace(
|
|
790
|
+
var pt = /<span class="td-math-inline">([\s\S]*?)<\/span>/g, mt = /<div class="td-math-block">([\s\S]*?)<\/div>/g;
|
|
791
|
+
function ht(e) {
|
|
792
|
+
return e = e.replace(pt, (e, t) => H(t, !1)), e = e.replace(mt, (e, t) => H(t, !0)), e;
|
|
795
793
|
}
|
|
796
|
-
function
|
|
794
|
+
function H(e, t) {
|
|
797
795
|
let n = t ? "div" : "span";
|
|
798
796
|
try {
|
|
799
797
|
return ne.renderToString(m(e), {
|
|
@@ -806,7 +804,7 @@ function U(e, t) {
|
|
|
806
804
|
}
|
|
807
805
|
//#endregion
|
|
808
806
|
//#region src/node/lib/render/vue.ts
|
|
809
|
-
async function
|
|
807
|
+
async function U(e, t, n) {
|
|
810
808
|
let r = t.title || t.label || (f(n) ? b(n, (await e.getConfig()).siteTitle) : S(n));
|
|
811
809
|
return {
|
|
812
810
|
schema: t.schema,
|
|
@@ -814,14 +812,14 @@ async function W(e, t, n) {
|
|
|
814
812
|
label: t.label,
|
|
815
813
|
icon: t.icon,
|
|
816
814
|
frontmatter: t.header ?? {},
|
|
817
|
-
headings:
|
|
815
|
+
headings: _t(t.headings),
|
|
818
816
|
title: r,
|
|
819
817
|
fileMetadata: t.fileMetadata,
|
|
820
818
|
seoMetadata: t.seoMetadata
|
|
821
819
|
};
|
|
822
820
|
}
|
|
823
|
-
async function
|
|
824
|
-
let r = await
|
|
821
|
+
async function gt(e, t, n) {
|
|
822
|
+
let r = await ct(t.content), i = await U(e, t, n), a = JSON.stringify(`@typedown/pages?resource=${encodeURIComponent(n)}`);
|
|
825
823
|
return {
|
|
826
824
|
vueSrc: [
|
|
827
825
|
"<script>",
|
|
@@ -833,12 +831,12 @@ async function ht(e, t, n) {
|
|
|
833
831
|
`import { pageData } from ${a}`,
|
|
834
832
|
"useRouter().route.data = pageData",
|
|
835
833
|
"<\/script>",
|
|
836
|
-
`<template><div class="typedown-content">\n${
|
|
834
|
+
`<template><div class="typedown-content">\n${vt(r)}\n</div></template>`
|
|
837
835
|
].join("\n"),
|
|
838
836
|
pageData: i
|
|
839
837
|
};
|
|
840
838
|
}
|
|
841
|
-
function
|
|
839
|
+
function _t(e) {
|
|
842
840
|
let t = [], n = [];
|
|
843
841
|
for (let r of e) {
|
|
844
842
|
let e = {
|
|
@@ -854,33 +852,30 @@ function gt(e) {
|
|
|
854
852
|
}
|
|
855
853
|
return t;
|
|
856
854
|
}
|
|
857
|
-
function
|
|
855
|
+
function vt(e) {
|
|
858
856
|
return e.replaceAll("{{", "{{").replaceAll("}}", "}}");
|
|
859
857
|
}
|
|
860
858
|
//#endregion
|
|
861
859
|
//#region src/node/plugin/vite/constants.ts
|
|
862
|
-
var
|
|
863
|
-
|
|
864
|
-
var
|
|
860
|
+
var yt = "@typedown/app", W = "\0@typedown/app", G = "@typedown/pages", K = "\0" + G;
|
|
861
|
+
G + "";
|
|
862
|
+
var q = "\0@typedown/pages?resource=", J = "@typedown/site-data", bt = "\0@typedown/site-data", Y = "@typedown/search-index", xt = "\0@typedown/search-index", X = "typedown:page-data";
|
|
865
863
|
//#endregion
|
|
866
864
|
//#region src/node/plugin/vite/virtual/utils.ts
|
|
867
865
|
function Z(e, t) {
|
|
868
866
|
let n = e.moduleGraph.getModuleById(t);
|
|
869
|
-
if (
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
|
-
function xt(e) {
|
|
883
|
-
return e.startsWith("\0") ? "/@id/__x00__" + e.slice(1) : e;
|
|
867
|
+
if (n) {
|
|
868
|
+
e.moduleGraph.invalidateModule(n);
|
|
869
|
+
for (let t of n.importers) e.hot.send({
|
|
870
|
+
type: "update",
|
|
871
|
+
updates: [{
|
|
872
|
+
type: "js-update",
|
|
873
|
+
path: t.url,
|
|
874
|
+
acceptedPath: n.url,
|
|
875
|
+
timestamp: Date.now()
|
|
876
|
+
}]
|
|
877
|
+
});
|
|
878
|
+
}
|
|
884
879
|
}
|
|
885
880
|
//#endregion
|
|
886
881
|
//#region src/node/plugin/vite/virtual/app.ts
|
|
@@ -893,7 +888,7 @@ var St = class {
|
|
|
893
888
|
});
|
|
894
889
|
}
|
|
895
890
|
invalidate(e) {
|
|
896
|
-
Z(e,
|
|
891
|
+
Z(e, W);
|
|
897
892
|
}
|
|
898
893
|
};
|
|
899
894
|
function Q(e) {
|
|
@@ -916,8 +911,8 @@ import { TdDirectoryIndex, TdGlossaryIndex } from 'typerighter/client/theme-defa
|
|
|
916
911
|
import { isIndexUrl, getDirectoryFromPageUrl, getParentUrl, path } from 'typerighter/shared';
|
|
917
912
|
import { h } from 'vue';
|
|
918
913
|
import theme from 'typerighter/client/theme-default';
|
|
919
|
-
import { pages as initialPages } from '${
|
|
920
|
-
import initialSiteData from '${
|
|
914
|
+
import { pages as initialPages } from '${G}';
|
|
915
|
+
import initialSiteData from '${J}';
|
|
921
916
|
let pages = initialPages;
|
|
922
917
|
const contentExts = ${JSON.stringify(i)};
|
|
923
918
|
|
|
@@ -948,11 +943,11 @@ const { app, router, searchIndex: searchIndexRef, siteData } = await createTyped
|
|
|
948
943
|
app.mount('#app');
|
|
949
944
|
|
|
950
945
|
// Load search index in the background after the app is mounted
|
|
951
|
-
import('${
|
|
946
|
+
import('${Y}').then((m) => { searchIndexRef.value = m.default; });
|
|
952
947
|
|
|
953
948
|
// Accept HMR so modules update without a full page reload
|
|
954
949
|
if (import.meta.hot) {
|
|
955
|
-
import.meta.hot.accept('${
|
|
950
|
+
import.meta.hot.accept('${G}', (m) => {
|
|
956
951
|
if (!m) return;
|
|
957
952
|
const base = path.join('/', '${t}', router.route.path);
|
|
958
953
|
const hadPage = !!findPage(base);
|
|
@@ -964,13 +959,22 @@ if (import.meta.hot) {
|
|
|
964
959
|
if (!hadPage && hasPage) router.go(router.route.path);
|
|
965
960
|
});
|
|
966
961
|
|
|
967
|
-
import.meta.hot.accept('${
|
|
962
|
+
import.meta.hot.accept('${Y}', (m) => {
|
|
968
963
|
if (m) searchIndexRef.value = m.default;
|
|
969
964
|
});
|
|
970
965
|
|
|
971
|
-
import.meta.hot.accept('${
|
|
966
|
+
import.meta.hot.accept('${J}', (m) => {
|
|
972
967
|
if (m) siteData.value = m.default;
|
|
973
968
|
});
|
|
969
|
+
|
|
970
|
+
// Update route.data directly when content changes - Vue SFC setup only re-runs on script block changes
|
|
971
|
+
import.meta.hot.on('${X}', ({ filepath, pageData }) => {
|
|
972
|
+
const eventBase = path.join('/', '${t}', path.stripExtension(filepath));
|
|
973
|
+
const routeBase = path.join('/', '${t}', router.route.path);
|
|
974
|
+
if (eventBase === routeBase) {
|
|
975
|
+
router.route.data = pageData;
|
|
976
|
+
}
|
|
977
|
+
});
|
|
974
978
|
}
|
|
975
979
|
`;
|
|
976
980
|
}
|
|
@@ -985,17 +989,32 @@ var Ct = class {
|
|
|
985
989
|
if (e.startsWith("@typedown/pages?resource=")) return "\0" + e;
|
|
986
990
|
}
|
|
987
991
|
isPageDataModule(e) {
|
|
988
|
-
return e.startsWith(
|
|
992
|
+
return e.startsWith(q);
|
|
989
993
|
}
|
|
990
994
|
async loadPageData(e, t) {
|
|
991
|
-
let n = decodeURIComponent(e.slice(
|
|
995
|
+
let n = decodeURIComponent(e.slice(q.length)), r = await U(t, await t.getFile(n), n);
|
|
992
996
|
return `export const pageData = ${JSON.stringify(r)}`;
|
|
993
997
|
}
|
|
994
998
|
invalidatePageData(e, t) {
|
|
995
|
-
Z(e,
|
|
999
|
+
Z(e, q + encodeURIComponent(t));
|
|
1000
|
+
}
|
|
1001
|
+
sendPageData(e, t, n) {
|
|
1002
|
+
t.getFile(n).then(async (r) => {
|
|
1003
|
+
let i = await U(t, r, n);
|
|
1004
|
+
e.hot.send({
|
|
1005
|
+
type: "custom",
|
|
1006
|
+
event: X,
|
|
1007
|
+
data: {
|
|
1008
|
+
filepath: n,
|
|
1009
|
+
pageData: i
|
|
1010
|
+
}
|
|
1011
|
+
});
|
|
1012
|
+
}).catch((e) => {
|
|
1013
|
+
console.error("[typedown] Failed to send page data:", e instanceof Error ? e.message : e);
|
|
1014
|
+
});
|
|
996
1015
|
}
|
|
997
1016
|
invalidate(e) {
|
|
998
|
-
Z(e,
|
|
1017
|
+
Z(e, K);
|
|
999
1018
|
}
|
|
1000
1019
|
}, wt = "\0@typedown/site-data", Tt = {
|
|
1001
1020
|
ready: !1,
|
|
@@ -1005,7 +1024,7 @@ var Ct = class {
|
|
|
1005
1024
|
}, Et = class {
|
|
1006
1025
|
data;
|
|
1007
1026
|
scan(e) {
|
|
1008
|
-
let t =
|
|
1027
|
+
let t = ye("**/*.td", {
|
|
1009
1028
|
cwd: e,
|
|
1010
1029
|
exclude: (e) => e.startsWith("_")
|
|
1011
1030
|
}).map((e) => ({
|
|
@@ -1116,7 +1135,7 @@ function jt(e, t) {
|
|
|
1116
1135
|
function Mt(e, n) {
|
|
1117
1136
|
let r;
|
|
1118
1137
|
try {
|
|
1119
|
-
r =
|
|
1138
|
+
r = be(n, "utf-8");
|
|
1120
1139
|
} catch {
|
|
1121
1140
|
return;
|
|
1122
1141
|
}
|
|
@@ -1129,7 +1148,7 @@ function Mt(e, n) {
|
|
|
1129
1148
|
};
|
|
1130
1149
|
}
|
|
1131
1150
|
function Nt(e) {
|
|
1132
|
-
return
|
|
1151
|
+
return ye("**/*.td", {
|
|
1133
1152
|
cwd: e,
|
|
1134
1153
|
exclude: (e) => e.startsWith("_")
|
|
1135
1154
|
}).map((t) => A(e, t));
|
|
@@ -1150,7 +1169,7 @@ var Pt = "\0@typedown/search-index", Ft = class {
|
|
|
1150
1169
|
invalidate(e) {
|
|
1151
1170
|
Z(e, Pt);
|
|
1152
1171
|
}
|
|
1153
|
-
}, It =
|
|
1172
|
+
}, It = Se(import.meta.url);
|
|
1154
1173
|
function Lt() {
|
|
1155
1174
|
return [{
|
|
1156
1175
|
find: "vue/server-renderer",
|
|
@@ -1187,7 +1206,7 @@ function zt(t, r) {
|
|
|
1187
1206
|
if (c.startsWith("/@") || c.startsWith("/node_modules")) return s();
|
|
1188
1207
|
let l = n(r.basePath), u = (l && c.startsWith(l) ? c.slice(l.length) : c).replace(/^\//, ""), d = A(t.config.root, r.rootDirectory, u);
|
|
1189
1208
|
if (ve(d)) try {
|
|
1190
|
-
let e =
|
|
1209
|
+
let e = xe(d);
|
|
1191
1210
|
if (e.isFile()) {
|
|
1192
1211
|
let t = Rt[a(d).slice(1).toLowerCase()] ?? "application/octet-stream";
|
|
1193
1212
|
o.setHeader("Content-Type", t), o.setHeader("Content-Length", e.size), _e(d).pipe(o);
|
|
@@ -1217,7 +1236,7 @@ function Vt(e, t) {
|
|
|
1217
1236
|
title: t.siteTitle,
|
|
1218
1237
|
description: t.siteDescription,
|
|
1219
1238
|
base: "/",
|
|
1220
|
-
entryScript:
|
|
1239
|
+
entryScript: yt
|
|
1221
1240
|
})), e.devHtml;
|
|
1222
1241
|
}
|
|
1223
1242
|
//#endregion
|
|
@@ -1268,11 +1287,11 @@ function $(e = {}) {
|
|
|
1268
1287
|
}
|
|
1269
1288
|
},
|
|
1270
1289
|
resolveId(e) {
|
|
1271
|
-
if (e === "/@typedown/app" || e === "@typedown/app") return
|
|
1272
|
-
if (e === "@typedown/pages") return
|
|
1290
|
+
if (e === "/@typedown/app" || e === "@typedown/app") return W;
|
|
1291
|
+
if (e === "@typedown/pages") return K;
|
|
1273
1292
|
if (e.startsWith("@typedown/pages?resource=")) return c.resolvePageData(e);
|
|
1274
|
-
if (e === "@typedown/site-data") return
|
|
1275
|
-
if (e === "@typedown/search-index") return
|
|
1293
|
+
if (e === "@typedown/site-data") return bt;
|
|
1294
|
+
if (e === "@typedown/search-index") return xt;
|
|
1276
1295
|
},
|
|
1277
1296
|
async load(e) {
|
|
1278
1297
|
if (c.isPageDataModule(e)) return c.loadPageData(e, await f());
|
|
@@ -1310,7 +1329,7 @@ function $(e = {}) {
|
|
|
1310
1329
|
}).catch(() => {});
|
|
1311
1330
|
}
|
|
1312
1331
|
t.rpc.onContentUpdated(({ filepath: e, affectedFiles: r = [] }) => {
|
|
1313
|
-
n && (u.reindex(i, e), u.invalidate(n), c.invalidate(n), l.fetch(t, n), a(e, ...r));
|
|
1332
|
+
n && (u.reindex(i, e), u.invalidate(n), c.invalidate(n), l.fetch(t, n), a(e, ...r), c.sendPageData(n, t, e));
|
|
1314
1333
|
}), t.rpc.onContentDeleted(({ filepath: e }) => {
|
|
1315
1334
|
n && (u.reindex(i, e), u.invalidate(n), c.invalidate(n), l.fetch(t, n), a(e));
|
|
1316
1335
|
});
|
|
@@ -1332,7 +1351,7 @@ function $(e = {}) {
|
|
|
1332
1351
|
};
|
|
1333
1352
|
let i = await f(), a = await i.getConfig(), o = r(n, a.rootDir);
|
|
1334
1353
|
try {
|
|
1335
|
-
let { vueSrc: e } = await
|
|
1354
|
+
let { vueSrc: e } = await gt(i, await i.getFile(o), o);
|
|
1336
1355
|
return {
|
|
1337
1356
|
code: e,
|
|
1338
1357
|
map: null
|
|
@@ -1349,7 +1368,7 @@ function $(e = {}) {
|
|
|
1349
1368
|
async closeBundle() {
|
|
1350
1369
|
if (!e.context && t) try {
|
|
1351
1370
|
let e = (await (await t.getTdContext()).getConfig()).basePath, n = e.startsWith(a) ? e.slice(a.length) : e.replace(/^\//, "");
|
|
1352
|
-
await
|
|
1371
|
+
await I(t, {
|
|
1353
1372
|
outDir: A(i, n),
|
|
1354
1373
|
base: e
|
|
1355
1374
|
});
|
|
@@ -1394,4 +1413,4 @@ function Kt(e) {
|
|
|
1394
1413
|
}
|
|
1395
1414
|
}
|
|
1396
1415
|
//#endregion
|
|
1397
|
-
export { Q as n,
|
|
1416
|
+
export { Q as n, I as r, $ as t };
|