typerighter 0.30.3 → 0.30.4
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-gH0dpuch.js → app-wLTpP3BP.js} +17 -17
- package/dist/{cli-BFgBPypP.js → cli-DFeDkMZb.js} +5 -5
- package/dist/cli.js +1 -1
- package/dist/client/theme-default.js +876 -875
- package/dist/client.js +1 -1
- package/dist/index.js +2 -2
- package/dist/{init-EKDV1L4U.js → init-4ZHUVwp-.js} +3 -3
- package/dist/shared/types/ssg.d.ts +3 -0
- package/dist/shared/types/ssg.d.ts.map +1 -1
- package/dist/shared/utils/html.d.ts +1 -0
- package/dist/shared/utils/html.d.ts.map +1 -1
- package/dist/{shared-BuA2cqMO.js → shared-B-n46X4N.js} +86 -82
- package/dist/shared.js +2 -2
- package/dist/typerighter.css +1 -1
- package/dist/{vite-CYozrIIG.js → vite-vMuZ0f3f.js} +111 -110
- package/dist/vite.js +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { F as e, G as t, H as n, I as r, K as i, M as a, P as o, R as s, T as c, U as l, _ as u, g as d, m as f, p, s as m, u as h, v as g, w as _ } from "./shared-B-n46X4N.js";
|
|
2
2
|
import { t as v } from "./temml-DZbhOfRE.js";
|
|
3
3
|
import { t as y } from "./es-ClqUVRJn.js";
|
|
4
4
|
import b, { resolve as x } from "node:path";
|
|
@@ -14,7 +14,7 @@ import { RPC_CANCELLED_CODE as ue, RpcClient as de } from "@typerighter/rpc-clie
|
|
|
14
14
|
import { createRequire as fe } from "node:module";
|
|
15
15
|
//#region src/node/lib/html-template.ts
|
|
16
16
|
function k(e) {
|
|
17
|
-
let t =
|
|
17
|
+
let t = m(e.title), n = m(e.description), r = e.siteTitle !== void 0 && e.title !== e.siteTitle ? `${t} - ${m(e.siteTitle)}` : t, i = e.canonicalUrl === void 0 ? "" : `\n <link rel="canonical" href="${m(e.canonicalUrl)}">`, a = e.headExtra === void 0 ? "" : e.headExtra + "\n", o = JSON.stringify({
|
|
18
18
|
"@context": "https://schema.org",
|
|
19
19
|
"@type": "Article",
|
|
20
20
|
headline: e.title,
|
|
@@ -119,20 +119,20 @@ function he(e) {
|
|
|
119
119
|
//#region src/node/build/index.ts
|
|
120
120
|
var ge = "typerighter/client/theme-default";
|
|
121
121
|
async function M(e, t = {}) {
|
|
122
|
-
let { root: n, logger: r } = e,
|
|
123
|
-
await D.rm(
|
|
122
|
+
let { root: n, logger: r } = e, i = b.resolve(n, t.outDir ?? "dist"), a = b.join(i, ".client"), o = b.join(i, ".server");
|
|
123
|
+
await D.rm(i, {
|
|
124
124
|
recursive: !0,
|
|
125
125
|
force: !0
|
|
126
126
|
});
|
|
127
|
-
let c = await e.getTdContext(), [l, d, f
|
|
127
|
+
let c = await e.getTdContext(), [l, u, d, f] = await Promise.all([
|
|
128
128
|
c.getConfig(),
|
|
129
129
|
c.listFiles(),
|
|
130
130
|
c.listSidebar(),
|
|
131
131
|
c.listSchemas()
|
|
132
|
-
]), m = t.base ?? l.basePath ?? "/", h = m.endsWith("/") ? m : m + "/", g =
|
|
132
|
+
]), m = t.base ?? l.basePath ?? "/", h = m.endsWith("/") ? m : m + "/", g = d.map((e) => ({
|
|
133
133
|
...e,
|
|
134
134
|
header: {}
|
|
135
|
-
})), _ =
|
|
135
|
+
})), _ = p(g), v = JSON.stringify({
|
|
136
136
|
title: l.siteTitle,
|
|
137
137
|
description: l.siteDescription,
|
|
138
138
|
basePath: h,
|
|
@@ -159,17 +159,17 @@ async function M(e, t = {}) {
|
|
|
159
159
|
siteData: y
|
|
160
160
|
}))]);
|
|
161
161
|
try {
|
|
162
|
-
let c = Nt({ context: e }),
|
|
162
|
+
let c = Nt({ context: e }), d = e.createViteLogger(), f = new j(r, "Building client bundle...");
|
|
163
163
|
await T({
|
|
164
164
|
...t.viteConfig,
|
|
165
165
|
root: n,
|
|
166
166
|
base: h,
|
|
167
167
|
plugins: c,
|
|
168
|
-
customLogger:
|
|
168
|
+
customLogger: d,
|
|
169
169
|
logLevel: "silent",
|
|
170
170
|
build: {
|
|
171
171
|
...t.viteConfig?.build,
|
|
172
|
-
outDir:
|
|
172
|
+
outDir: a,
|
|
173
173
|
manifest: !0,
|
|
174
174
|
emptyOutDir: !0,
|
|
175
175
|
rollupOptions: {
|
|
@@ -178,7 +178,7 @@ async function M(e, t = {}) {
|
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
});
|
|
181
|
-
let p = await D.readdir(b.join(
|
|
181
|
+
let p = await D.readdir(b.join(a, "assets")).catch(() => []);
|
|
182
182
|
f.done(`Client bundle (${p.length} chunks)`);
|
|
183
183
|
let m = new j(r, "Building SSR bundle...");
|
|
184
184
|
await T({
|
|
@@ -186,56 +186,56 @@ async function M(e, t = {}) {
|
|
|
186
186
|
root: n,
|
|
187
187
|
base: h,
|
|
188
188
|
plugins: c,
|
|
189
|
-
customLogger:
|
|
189
|
+
customLogger: d,
|
|
190
190
|
logLevel: "silent",
|
|
191
191
|
build: {
|
|
192
192
|
...t.viteConfig?.build,
|
|
193
|
-
outDir:
|
|
193
|
+
outDir: o,
|
|
194
194
|
ssr: C,
|
|
195
195
|
emptyOutDir: !0
|
|
196
196
|
}
|
|
197
197
|
}), m.done("SSR bundle");
|
|
198
|
-
let g =
|
|
199
|
-
let t =
|
|
198
|
+
let g = u.map((e) => {
|
|
199
|
+
let t = s(e);
|
|
200
200
|
return t === "index" ? "/" : `/${t}`;
|
|
201
201
|
});
|
|
202
202
|
g.push("/"), N(_.entries, "", g);
|
|
203
203
|
let v = new j(r, "Pre-rendering pages...");
|
|
204
204
|
await pe({
|
|
205
|
-
ssrEntryPath: b.join(
|
|
206
|
-
clientOutDir:
|
|
207
|
-
outDir:
|
|
205
|
+
ssrEntryPath: b.join(o, "ssr-entry.js"),
|
|
206
|
+
clientOutDir: a,
|
|
207
|
+
outDir: i,
|
|
208
208
|
base: h,
|
|
209
209
|
pagePaths: g,
|
|
210
210
|
siteTitle: l.siteTitle,
|
|
211
211
|
progress: v
|
|
212
212
|
}), v.done(`Pre-rendered ${g.length} pages`);
|
|
213
213
|
let y = ye(g, h);
|
|
214
|
-
await D.writeFile(b.join(
|
|
215
|
-
let x = b.join(
|
|
216
|
-
await D.cp(x, w, { recursive: !0 }).catch(() => {}), await ve(b.join(n, l.rootDir),
|
|
214
|
+
await D.writeFile(b.join(i, "sitemap.xml"), y);
|
|
215
|
+
let x = b.join(a, "assets"), w = b.join(i, "assets");
|
|
216
|
+
await D.cp(x, w, { recursive: !0 }).catch(() => {}), await ve(b.join(n, l.rootDir), i);
|
|
217
217
|
let E = b.join(n, l.publicDir);
|
|
218
|
-
await D.cp(E,
|
|
218
|
+
await D.cp(E, i, { recursive: !0 }).catch(() => {});
|
|
219
219
|
} finally {
|
|
220
220
|
await Promise.all([
|
|
221
221
|
D.rm(x, {
|
|
222
222
|
recursive: !0,
|
|
223
223
|
force: !0
|
|
224
224
|
}),
|
|
225
|
-
D.rm(
|
|
225
|
+
D.rm(a, {
|
|
226
226
|
recursive: !0,
|
|
227
227
|
force: !0
|
|
228
228
|
}),
|
|
229
|
-
D.rm(
|
|
229
|
+
D.rm(o, {
|
|
230
230
|
recursive: !0,
|
|
231
231
|
force: !0
|
|
232
232
|
})
|
|
233
233
|
]);
|
|
234
234
|
}
|
|
235
|
-
r.log(`\nBuild complete. Output: ${
|
|
235
|
+
r.log(`\nBuild complete. Output: ${i}`);
|
|
236
236
|
}
|
|
237
237
|
function _e(e) {
|
|
238
|
-
let t = `/${e.rootDir}/${
|
|
238
|
+
let t = `/${e.rootDir}/${l}`, r = JSON.parse(e.siteConfig), i = JSON.parse(e.siteData), a = i.contentTree ?? { entries: [] }, o = f(a.entries ?? [], r.title ?? ""), s = JSON.stringify({
|
|
239
239
|
...i,
|
|
240
240
|
directoryListings: o
|
|
241
241
|
});
|
|
@@ -248,8 +248,8 @@ import { h } from 'vue';
|
|
|
248
248
|
import theme from '${e.layoutImport}';
|
|
249
249
|
|
|
250
250
|
const pages = import.meta.glob('${t}', { eager: true });
|
|
251
|
-
const contentExts = ${JSON.stringify(
|
|
252
|
-
const siteData = ${
|
|
251
|
+
const contentExts = ${JSON.stringify(n)};
|
|
252
|
+
const siteData = ${s};
|
|
253
253
|
|
|
254
254
|
function findPage(base) {
|
|
255
255
|
for (const ext of contentExts) {
|
|
@@ -283,20 +283,20 @@ export async function render(url) {
|
|
|
283
283
|
}
|
|
284
284
|
`;
|
|
285
285
|
}
|
|
286
|
-
async function ve(
|
|
287
|
-
let
|
|
286
|
+
async function ve(t, n) {
|
|
287
|
+
let r = (await D.readdir(t, {
|
|
288
288
|
recursive: !0,
|
|
289
289
|
withFileTypes: !0
|
|
290
|
-
})).filter((
|
|
291
|
-
let r = b.join(
|
|
290
|
+
})).filter((t) => t.isFile() && !e(t.name)).map(async (e) => {
|
|
291
|
+
let r = b.join(e.parentPath, e.name), i = b.relative(t, r), a = b.join(n, i);
|
|
292
292
|
return D.mkdir(b.dirname(a), { recursive: !0 }).then(() => D.copyFile(r, a));
|
|
293
293
|
});
|
|
294
|
-
await Promise.all(
|
|
294
|
+
await Promise.all(r);
|
|
295
295
|
}
|
|
296
296
|
function ye(e, t) {
|
|
297
297
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
298
298
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
299
|
-
${e.map((e) => ` <url><loc>${
|
|
299
|
+
${e.map((e) => ` <url><loc>${m(t + e.replace(/^\//, ""))}</loc></url>`).join("\n")}
|
|
300
300
|
</urlset>
|
|
301
301
|
`;
|
|
302
302
|
}
|
|
@@ -698,7 +698,7 @@ async function Ye(e) {
|
|
|
698
698
|
let t = await qe(), n = [...e.matchAll(Je)];
|
|
699
699
|
if (n.length === 0) return e;
|
|
700
700
|
let r = await Promise.all(n.map(async (e) => {
|
|
701
|
-
let n = e[1] || "", r = e[2] || "", i =
|
|
701
|
+
let n = e[1] || "", r = e[2] || "", i = h(e[3]);
|
|
702
702
|
return Xe(await t(i, n, r), n, r);
|
|
703
703
|
})), i = e;
|
|
704
704
|
for (let e = n.length - 1; 0 <= e; e--) {
|
|
@@ -725,7 +725,7 @@ function $e(e) {
|
|
|
725
725
|
function V(e, t) {
|
|
726
726
|
let n = t ? "div" : "span";
|
|
727
727
|
try {
|
|
728
|
-
return v.renderToString(
|
|
728
|
+
return v.renderToString(h(e), {
|
|
729
729
|
throwOnError: !1,
|
|
730
730
|
displayMode: t
|
|
731
731
|
});
|
|
@@ -736,7 +736,7 @@ function V(e, t) {
|
|
|
736
736
|
//#endregion
|
|
737
737
|
//#region src/node/lib/render/vue.ts
|
|
738
738
|
async function H(e, t, n) {
|
|
739
|
-
let r = t.title || (
|
|
739
|
+
let r = t.title || (g(n) ? d(n, (await e.getConfig()).siteTitle) : u(n, t.label));
|
|
740
740
|
return {
|
|
741
741
|
schema: t.schema,
|
|
742
742
|
schemaLabel: t.schemaLabel,
|
|
@@ -772,6 +772,7 @@ function tt(e) {
|
|
|
772
772
|
let e = {
|
|
773
773
|
level: r.level,
|
|
774
774
|
title: r.title,
|
|
775
|
+
titleHtml: r.titleHtml ?? r.title,
|
|
775
776
|
slug: r.slug,
|
|
776
777
|
link: `#${r.slug}`,
|
|
777
778
|
children: []
|
|
@@ -982,7 +983,7 @@ var mt = class {
|
|
|
982
983
|
}
|
|
983
984
|
};
|
|
984
985
|
function Z(e) {
|
|
985
|
-
let { rootDir: t = "." } = e,
|
|
986
|
+
let { rootDir: t = "." } = e, r = JSON.stringify({
|
|
986
987
|
title: e.siteTitle,
|
|
987
988
|
description: e.siteDescription,
|
|
988
989
|
basePath: e.basePath ?? "/",
|
|
@@ -1003,7 +1004,7 @@ import theme from 'typerighter/client/theme-default';
|
|
|
1003
1004
|
import { pages as initialPages } from '${J}';
|
|
1004
1005
|
import initialSiteData from '${lt}';
|
|
1005
1006
|
let pages = initialPages;
|
|
1006
|
-
const contentExts = ${JSON.stringify(
|
|
1007
|
+
const contentExts = ${JSON.stringify(n)};
|
|
1007
1008
|
|
|
1008
1009
|
function findPage(base) {
|
|
1009
1010
|
for (const ext of contentExts) {
|
|
@@ -1029,7 +1030,7 @@ async function loadPageModule(pagePath) {
|
|
|
1029
1030
|
return undefined;
|
|
1030
1031
|
}
|
|
1031
1032
|
|
|
1032
|
-
const { app, searchIndex: searchIndexRef, siteData } = await createTypedownApp(loadPageModule, theme.Layout, ${
|
|
1033
|
+
const { app, searchIndex: searchIndexRef, siteData } = await createTypedownApp(loadPageModule, theme.Layout, ${r}, initialSiteData);
|
|
1033
1034
|
app.mount('#app');
|
|
1034
1035
|
|
|
1035
1036
|
// Load search index in the background after the app is mounted
|
|
@@ -1087,9 +1088,9 @@ var ht = class {
|
|
|
1087
1088
|
exclude: (e) => e.startsWith("_")
|
|
1088
1089
|
}).map((e) => ({
|
|
1089
1090
|
filepath: e,
|
|
1090
|
-
label:
|
|
1091
|
+
label: u(e),
|
|
1091
1092
|
header: {}
|
|
1092
|
-
})), n =
|
|
1093
|
+
})), n = p(t);
|
|
1093
1094
|
this.data = {
|
|
1094
1095
|
contentTree: n,
|
|
1095
1096
|
schemas: {},
|
|
@@ -1128,11 +1129,11 @@ async function yt(e) {
|
|
|
1128
1129
|
]), i = await Promise.all(r.map(async (t) => [t, (await e.getSchema(t)).properties])), a = Object.fromEntries(i), o = n.map((e) => ({
|
|
1129
1130
|
...e,
|
|
1130
1131
|
header: {}
|
|
1131
|
-
})), s =
|
|
1132
|
+
})), s = p(o);
|
|
1132
1133
|
return {
|
|
1133
1134
|
contentTree: s,
|
|
1134
1135
|
schemas: a,
|
|
1135
|
-
directoryListings:
|
|
1136
|
+
directoryListings: f(s.entries, t.siteTitle)
|
|
1136
1137
|
};
|
|
1137
1138
|
}
|
|
1138
1139
|
//#endregion
|
|
@@ -1141,8 +1142,8 @@ var bt = class {
|
|
|
1141
1142
|
index;
|
|
1142
1143
|
constructor() {
|
|
1143
1144
|
this.index = new y({
|
|
1144
|
-
fields:
|
|
1145
|
-
storeFields:
|
|
1145
|
+
fields: t,
|
|
1146
|
+
storeFields: i
|
|
1146
1147
|
});
|
|
1147
1148
|
}
|
|
1148
1149
|
addAll(e) {
|
|
@@ -1169,12 +1170,12 @@ function xt(e, t) {
|
|
|
1169
1170
|
}
|
|
1170
1171
|
t.addAll(r);
|
|
1171
1172
|
}
|
|
1172
|
-
function St(t, n
|
|
1173
|
-
let
|
|
1174
|
-
|
|
1173
|
+
function St(e, t, n) {
|
|
1174
|
+
let r = wt(e, x(e, t));
|
|
1175
|
+
r ? n.addPage(r) : n.discardPage(_(t));
|
|
1175
1176
|
}
|
|
1176
1177
|
function Ct(e, t) {
|
|
1177
|
-
let n =
|
|
1178
|
+
let n = u(e);
|
|
1178
1179
|
if (!t.startsWith("---")) return {
|
|
1179
1180
|
title: n,
|
|
1180
1181
|
body: t
|
|
@@ -1190,19 +1191,19 @@ function Ct(e, t) {
|
|
|
1190
1191
|
body: a
|
|
1191
1192
|
};
|
|
1192
1193
|
}
|
|
1193
|
-
function wt(
|
|
1194
|
-
let
|
|
1194
|
+
function wt(e, t) {
|
|
1195
|
+
let n;
|
|
1195
1196
|
try {
|
|
1196
|
-
|
|
1197
|
+
n = se(t, "utf-8");
|
|
1197
1198
|
} catch {
|
|
1198
1199
|
return;
|
|
1199
1200
|
}
|
|
1200
|
-
if (!
|
|
1201
|
-
let
|
|
1201
|
+
if (!n.trim()) return;
|
|
1202
|
+
let r = t.slice(e.length + 1), { title: i, body: a } = Ct(r, n);
|
|
1202
1203
|
return {
|
|
1203
|
-
id:
|
|
1204
|
-
title:
|
|
1205
|
-
text: `${
|
|
1204
|
+
id: _(r),
|
|
1205
|
+
title: i,
|
|
1206
|
+
text: `${i}\n${a}`
|
|
1206
1207
|
};
|
|
1207
1208
|
}
|
|
1208
1209
|
function Tt(e) {
|
|
@@ -1260,14 +1261,14 @@ var kt = {
|
|
|
1260
1261
|
function At(e, t) {
|
|
1261
1262
|
return (n, r, i) => {
|
|
1262
1263
|
if (!n.url || n.method !== "GET" || r.writableEnded) return i();
|
|
1263
|
-
let
|
|
1264
|
-
if (
|
|
1265
|
-
let s =
|
|
1266
|
-
if (ae(
|
|
1267
|
-
let e = ce(
|
|
1264
|
+
let a = c(n.url);
|
|
1265
|
+
if (a.startsWith("/@") || a.startsWith("/node_modules")) return i();
|
|
1266
|
+
let s = a.replace(/^\//, ""), l = x(e.config.root, t.rootDirectory, s);
|
|
1267
|
+
if (ae(l)) try {
|
|
1268
|
+
let e = ce(l);
|
|
1268
1269
|
if (e.isFile()) {
|
|
1269
|
-
let t = kt[
|
|
1270
|
-
r.setHeader("Content-Type", t), r.setHeader("Content-Length", e.size), ie(
|
|
1270
|
+
let t = kt[o(l).slice(1).toLowerCase()] ?? "application/octet-stream";
|
|
1271
|
+
r.setHeader("Content-Type", t), r.setHeader("Content-Length", e.size), ie(l).pipe(r);
|
|
1271
1272
|
return;
|
|
1272
1273
|
}
|
|
1273
1274
|
} catch {}
|
|
@@ -1277,16 +1278,16 @@ function At(e, t) {
|
|
|
1277
1278
|
//#endregion
|
|
1278
1279
|
//#region src/node/plugin/vite/middleware/virtual-html.ts
|
|
1279
1280
|
function jt(e, t, n) {
|
|
1280
|
-
return (r, i,
|
|
1281
|
-
if (!r.url) return
|
|
1282
|
-
let
|
|
1283
|
-
if (
|
|
1284
|
-
let
|
|
1285
|
-
if (
|
|
1281
|
+
return (r, i, o) => {
|
|
1282
|
+
if (!r.url) return o();
|
|
1283
|
+
let s = a(c(r.url)), l = a(n.basePath);
|
|
1284
|
+
if (s.startsWith("/@") || s.startsWith("/node_modules") || !s.startsWith(l)) return o();
|
|
1285
|
+
let u = s.slice(l.length);
|
|
1286
|
+
if (u.startsWith("/@") || u.startsWith("/node_modules") || s.includes(".") && !s.endsWith("/index.html")) return o();
|
|
1286
1287
|
t.getConfig().then(async (t) => {
|
|
1287
1288
|
let a = await e.transformIndexHtml(r.url ?? "", Mt(n, t));
|
|
1288
1289
|
i.setHeader("Content-Type", "text/html"), i.end(a);
|
|
1289
|
-
}).catch(() =>
|
|
1290
|
+
}).catch(() => o());
|
|
1290
1291
|
};
|
|
1291
1292
|
}
|
|
1292
1293
|
function Mt(e, t) {
|
|
@@ -1299,8 +1300,8 @@ function Mt(e, t) {
|
|
|
1299
1300
|
}
|
|
1300
1301
|
//#endregion
|
|
1301
1302
|
//#region src/node/plugin/vite/index.ts
|
|
1302
|
-
function Nt(
|
|
1303
|
-
let n =
|
|
1303
|
+
function Nt(t = {}) {
|
|
1304
|
+
let n = t.context, i, a, o, s = new mt(), c = new ht(), l = new vt(), u = new Dt(), d = {
|
|
1304
1305
|
devHtml: void 0,
|
|
1305
1306
|
basePath: "/",
|
|
1306
1307
|
rootDirectory: "vault"
|
|
@@ -1313,11 +1314,11 @@ function Nt(e = {}) {
|
|
|
1313
1314
|
{
|
|
1314
1315
|
name: "vite-plugin-typedown",
|
|
1315
1316
|
enforce: "pre",
|
|
1316
|
-
async config(
|
|
1317
|
-
n ||= K(
|
|
1317
|
+
async config(e) {
|
|
1318
|
+
n ||= K(t.root ? x(e.root ?? process.cwd(), t.root) : it(e.root ?? process.cwd())), o = e.base ?? "/";
|
|
1318
1319
|
let r = await (await f()).getConfig();
|
|
1319
1320
|
return {
|
|
1320
|
-
base:
|
|
1321
|
+
base: e.base ?? r.basePath,
|
|
1321
1322
|
publicDir: r.publicDir,
|
|
1322
1323
|
server: {
|
|
1323
1324
|
port: 8686,
|
|
@@ -1328,16 +1329,16 @@ function Nt(e = {}) {
|
|
|
1328
1329
|
};
|
|
1329
1330
|
},
|
|
1330
1331
|
configResolved(e) {
|
|
1331
|
-
|
|
1332
|
+
a = x(e.root, e.build.outDir);
|
|
1332
1333
|
},
|
|
1333
1334
|
async buildStart() {
|
|
1334
|
-
if (
|
|
1335
|
+
if (i) return;
|
|
1335
1336
|
let e = await f(), t = await e.getConfig(), n = x(t.rootDir);
|
|
1336
1337
|
u.index(n), await l.fetchSync(e);
|
|
1337
|
-
let
|
|
1338
|
-
if ($(
|
|
1339
|
-
let e =
|
|
1340
|
-
this.error(`Vault check failed with ${
|
|
1338
|
+
let r = await e.checkVault();
|
|
1339
|
+
if ($(r.diagnostics), 0 < r.errorCount) {
|
|
1340
|
+
let e = r.diagnostics.filter((e) => e.severity === "error").map((e) => ` ${e.filepath}:${e.line}:${e.column} - ${e.message} (${e.code})`);
|
|
1341
|
+
this.error(`Vault check failed with ${r.errorCount} error(s):\n${e.join("\n")}`);
|
|
1341
1342
|
}
|
|
1342
1343
|
},
|
|
1343
1344
|
resolveId(e) {
|
|
@@ -1357,36 +1358,36 @@ function Nt(e = {}) {
|
|
|
1357
1358
|
if (e === "\0@typedown/app") return s.load(t);
|
|
1358
1359
|
},
|
|
1359
1360
|
async configureServer(e) {
|
|
1360
|
-
|
|
1361
|
-
let t = await f(), n = await t.getConfig(),
|
|
1362
|
-
u.index(
|
|
1361
|
+
i = e;
|
|
1362
|
+
let t = await f(), n = await t.getConfig(), r = x(n.rootDir);
|
|
1363
|
+
u.index(r), l.scan(r), l.fetch(t, i), e.httpServer?.once("listening", async () => {
|
|
1363
1364
|
let e = await t.checkVault();
|
|
1364
1365
|
0 < e.diagnostics.length && (console.error(""), $(e.diagnostics));
|
|
1365
1366
|
}), t.rpc.onConfigChanged(() => {
|
|
1366
|
-
|
|
1367
|
+
i && (d.devHtml = void 0, l.clear(), s.invalidate(i), c.invalidate(i), Ft(i), l.fetch(t, i));
|
|
1367
1368
|
}), t.rpc.onContentChanged(({ content: e, affectedFiles: n = [] }) => {
|
|
1368
|
-
|
|
1369
|
-
if (!
|
|
1370
|
-
let
|
|
1371
|
-
for (let e of
|
|
1372
|
-
let n = ee(x(
|
|
1373
|
-
if (
|
|
1374
|
-
for (let e of
|
|
1375
|
-
c.invalidatePageData(
|
|
1369
|
+
i && (u.reindex(r, e), u.invalidate(i), t.getConfig().then((t) => {
|
|
1370
|
+
if (!i) return;
|
|
1371
|
+
let r = [e, ...n], a = [];
|
|
1372
|
+
for (let e of r) {
|
|
1373
|
+
let n = ee(x(i.config.root, t.rootDir, e)), r = i.moduleGraph.getModulesByFile(n);
|
|
1374
|
+
if (r?.size) {
|
|
1375
|
+
for (let e of r) i?.moduleGraph.invalidateModule(e), a.push(Lt(e));
|
|
1376
|
+
c.invalidatePageData(i, e);
|
|
1376
1377
|
}
|
|
1377
1378
|
}
|
|
1378
|
-
0 < a.length &&
|
|
1379
|
+
0 < a.length && i.hot.send({
|
|
1379
1380
|
type: "update",
|
|
1380
1381
|
updates: a
|
|
1381
1382
|
});
|
|
1382
1383
|
}).catch(() => {}));
|
|
1383
1384
|
});
|
|
1384
1385
|
function a() {
|
|
1385
|
-
|
|
1386
|
+
i && (u.index(r), u.invalidate(i), c.invalidate(i), l.clear(), l.fetch(t, i));
|
|
1386
1387
|
}
|
|
1387
1388
|
t.rpc.onContentCreated(a), t.rpc.onContentDeleted(a);
|
|
1388
1389
|
function o() {
|
|
1389
|
-
|
|
1390
|
+
i && (l.clear(), It(i), l.fetch(t, i));
|
|
1390
1391
|
}
|
|
1391
1392
|
t.rpc.onSchemaChanged(o), t.rpc.onSchemaCreated(o), t.rpc.onSchemaDeleted(o);
|
|
1392
1393
|
let p = await t.getConfig();
|
|
@@ -1394,16 +1395,16 @@ function Nt(e = {}) {
|
|
|
1394
1395
|
d.basePath = e.basePath, d.rootDirectory = e.rootDir, d.devHtml = void 0;
|
|
1395
1396
|
}), e.middlewares.use(At(e, d)), e.middlewares.use(jt(e, t, d));
|
|
1396
1397
|
},
|
|
1397
|
-
async transform(
|
|
1398
|
-
let
|
|
1399
|
-
if (!
|
|
1400
|
-
if (
|
|
1398
|
+
async transform(t, n) {
|
|
1399
|
+
let i = n.split("?")[0];
|
|
1400
|
+
if (!e(i)) return;
|
|
1401
|
+
if (r(i)) return {
|
|
1401
1402
|
code: "<script>import { TdNotFound } from 'typerighter/client/theme-default'; export default TdNotFound; export const pageData = { frontmatter: {}, headings: [], title: '' };<\/script>",
|
|
1402
1403
|
map: null
|
|
1403
1404
|
};
|
|
1404
|
-
let
|
|
1405
|
+
let a = await f(), o = (await a.getConfig()).rootDir, s = i.includes(o) ? i.slice(i.indexOf(o) + o.length + 1) : i;
|
|
1405
1406
|
try {
|
|
1406
|
-
let { vueSrc: e } = await et(
|
|
1407
|
+
let { vueSrc: e } = await et(a, await a.getFile(s), s);
|
|
1407
1408
|
return {
|
|
1408
1409
|
code: e,
|
|
1409
1410
|
map: null
|
|
@@ -1414,14 +1415,14 @@ function Nt(e = {}) {
|
|
|
1414
1415
|
this.error(`[typedown] Failed to transform ${s}: ${t}`);
|
|
1415
1416
|
}
|
|
1416
1417
|
},
|
|
1417
|
-
handleHotUpdate({ file:
|
|
1418
|
-
if (
|
|
1418
|
+
handleHotUpdate({ file: t }) {
|
|
1419
|
+
if (e(t)) return [];
|
|
1419
1420
|
},
|
|
1420
1421
|
async closeBundle() {
|
|
1421
|
-
if (!
|
|
1422
|
-
let e = (await (await n.getTdContext()).getConfig()).basePath, t = e.startsWith(
|
|
1422
|
+
if (!t.context && n) try {
|
|
1423
|
+
let e = (await (await n.getTdContext()).getConfig()).basePath, t = e.startsWith(o) ? e.slice(o.length) : e.replace(/^\//, "");
|
|
1423
1424
|
await M(n, {
|
|
1424
|
-
outDir: x(
|
|
1425
|
+
outDir: x(a, t),
|
|
1425
1426
|
base: e
|
|
1426
1427
|
});
|
|
1427
1428
|
} finally {
|
|
@@ -1430,7 +1431,7 @@ function Nt(e = {}) {
|
|
|
1430
1431
|
}
|
|
1431
1432
|
},
|
|
1432
1433
|
w({
|
|
1433
|
-
include:
|
|
1434
|
+
include: t.root ? RegExp(`${t.root.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}/.*\\.(?:vue|td)$`) : /\.(?:vue|td)$/,
|
|
1434
1435
|
template: { transformAssetUrls: !1 }
|
|
1435
1436
|
}),
|
|
1436
1437
|
...C()
|
package/dist/vite.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "./vite-
|
|
1
|
+
import { n as e, t } from "./vite-vMuZ0f3f.js";
|
|
2
2
|
export { e as generateClientAppEntry, t as typedown };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "typerighter",
|
|
4
|
-
"version": "0.30.
|
|
4
|
+
"version": "0.30.4",
|
|
5
5
|
"description": "Typedown: A typed content framework.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
"temml": "^0.13.5",
|
|
71
71
|
"vite": "^8.2.2",
|
|
72
72
|
"vue": "^3.5.42",
|
|
73
|
-
"@typerighter/rpc-client": "0.30.
|
|
74
|
-
"@typerighter/rpc-server": "0.30.
|
|
73
|
+
"@typerighter/rpc-client": "0.30.4",
|
|
74
|
+
"@typerighter/rpc-server": "0.30.4"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@hdnax/nuclint": "^0.17.5",
|