typerighter 0.4.4 → 0.5.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.
Potentially problematic release.
This version of typerighter might be problematic. Click here for more details.
- package/dist/{app-Bw90hv7G.js → app-DZLkaV9-.js} +1 -1
- package/dist/{brand-CmL-6h9U.js → brand-C6VJ3Tpf.js} +0 -4
- package/dist/{cli-Dz9GEomM.js → cli-CAvgSpyx.js} +142 -119
- package/dist/cli.js +1 -1
- package/dist/client/theme-default.js +254 -267
- package/dist/client.js +1 -1
- package/dist/{constants-7heqadyd.js → constants-BVW9e5iH.js} +9 -3
- package/dist/index.js +2 -2
- package/dist/{init-z0GJPXx4.js → init-Dfj-Yf9i.js} +3 -3
- package/dist/node/cli/index.d.ts.map +1 -1
- package/dist/node/context.d.ts.map +1 -1
- package/dist/node/lib/typedown-context.d.ts +3 -1
- package/dist/node/lib/typedown-context.d.ts.map +1 -1
- package/dist/node/plugin/vite/index.d.ts.map +1 -1
- package/dist/shared/utils/url.d.ts.map +1 -1
- package/dist/typerighter.css +1 -1
- package/dist/{vite-B-ktlRz9.js → vite-DPRlAukM.js} +60 -48
- package/dist/vite.js +1 -1
- package/package.json +3 -3
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { i as e, n as t, o as n, r, s as i, t as a } from "./constants-
|
|
2
|
-
import { A as o, E as s, O as c, S as l, _ as u, d, f, k as p, l as m, m as h, p as g, r as _, u as v, x as y } from "./brand-
|
|
1
|
+
import { i as e, n as t, o as n, r, s as i, t as a } from "./constants-BVW9e5iH.js";
|
|
2
|
+
import { A as o, E as s, O as c, S as l, _ as u, d, f, k as p, l as m, m as h, p as g, r as _, u as v, x as y } from "./brand-C6VJ3Tpf.js";
|
|
3
3
|
import { t as b } from "./es-ClqUVRJn.js";
|
|
4
4
|
import { resolve as x } from "node:path";
|
|
5
|
-
import S from "
|
|
6
|
-
import C from "@
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
5
|
+
import S from "picocolors";
|
|
6
|
+
import C from "@tailwindcss/vite";
|
|
7
|
+
import w from "@vitejs/plugin-vue";
|
|
8
|
+
import { normalizePath as T } from "vite";
|
|
9
|
+
import { createRequire as E } from "node:module";
|
|
9
10
|
//#region src/node/lib/render/vue.ts
|
|
10
|
-
async function
|
|
11
|
+
async function D(e, t, n) {
|
|
11
12
|
let r = {
|
|
12
13
|
path: n,
|
|
13
14
|
relativePath: n,
|
|
@@ -25,17 +26,17 @@ async function E(e, t, n) {
|
|
|
25
26
|
`export const __pageData = JSON.parse(${JSON.stringify(JSON.stringify(s))})`,
|
|
26
27
|
`export default { name: ${JSON.stringify(n)} }`,
|
|
27
28
|
"<\/script>",
|
|
28
|
-
`<template><div class="typedown-content">\n${
|
|
29
|
+
`<template><div class="typedown-content">\n${O(i)}\n</div></template>`
|
|
29
30
|
].join("\n"),
|
|
30
31
|
pageData: s
|
|
31
32
|
};
|
|
32
33
|
}
|
|
33
|
-
function
|
|
34
|
+
function O(e) {
|
|
34
35
|
return e.replaceAll("{{", "{{");
|
|
35
36
|
}
|
|
36
37
|
//#endregion
|
|
37
38
|
//#region src/node/plugin/vite/search.ts
|
|
38
|
-
var
|
|
39
|
+
var k = /<h(\d*).*?>(.*?<a.*? href="#.*?".*?>.*?<\/a>)<\/h\1>/gi, A = /(.*)<a.*? href="#(.*?)".*?>.*?<\/a>/i, j = class {
|
|
39
40
|
index;
|
|
40
41
|
pageDocIds = /* @__PURE__ */ new Map();
|
|
41
42
|
constructor() {
|
|
@@ -52,7 +53,7 @@ var O = /<h(\d*).*?>(.*?<a.*? href="#.*?".*?>.*?<\/a>)<\/h\1>/gi, k = /(.*)<a.*?
|
|
|
52
53
|
addPage(e) {
|
|
53
54
|
this.discardPage(e.id);
|
|
54
55
|
let t = [];
|
|
55
|
-
for (let n of
|
|
56
|
+
for (let n of M(e.html)) {
|
|
56
57
|
let r = n.anchor ? `${e.id}#${n.anchor}` : e.id;
|
|
57
58
|
this.index.has(r) && this.index.discard(r), this.index.add({
|
|
58
59
|
id: r,
|
|
@@ -74,12 +75,12 @@ var O = /<h(\d*).*?>(.*?<a.*? href="#.*?".*?>.*?<\/a>)<\/h\1>/gi, k = /(.*)<a.*?
|
|
|
74
75
|
return JSON.stringify(this.index);
|
|
75
76
|
}
|
|
76
77
|
};
|
|
77
|
-
function*
|
|
78
|
-
let t = e.split(
|
|
78
|
+
function* M(e) {
|
|
79
|
+
let t = e.split(k);
|
|
79
80
|
t.shift();
|
|
80
81
|
let n = [];
|
|
81
82
|
for (let e = 0; e < t.length; e += 3) {
|
|
82
|
-
let r = Number.parseInt(t[e]) - 1, i = t[e + 1], a =
|
|
83
|
+
let r = Number.parseInt(t[e]) - 1, i = t[e + 1], a = A.exec(i), o = v(a?.[1] ?? "").trim(), s = a?.[2] ?? "", c = t[e + 2];
|
|
83
84
|
if (!o || !c) continue;
|
|
84
85
|
let l = n.slice(0, r);
|
|
85
86
|
l[r] = o, yield {
|
|
@@ -91,19 +92,19 @@ function* j(e) {
|
|
|
91
92
|
}
|
|
92
93
|
//#endregion
|
|
93
94
|
//#region src/node/plugin/vite/alias.ts
|
|
94
|
-
var
|
|
95
|
-
function
|
|
95
|
+
var N = E(import.meta.url);
|
|
96
|
+
function P() {
|
|
96
97
|
return [{
|
|
97
98
|
find: "vue/server-renderer",
|
|
98
|
-
replacement:
|
|
99
|
+
replacement: N.resolve("vue/server-renderer")
|
|
99
100
|
}, {
|
|
100
101
|
find: "vue",
|
|
101
|
-
replacement:
|
|
102
|
+
replacement: N.resolve("vue/dist/vue.runtime.esm-bundler.js")
|
|
102
103
|
}];
|
|
103
104
|
}
|
|
104
105
|
//#endregion
|
|
105
106
|
//#region src/node/plugin/vite/index.ts
|
|
106
|
-
function
|
|
107
|
+
function F(e) {
|
|
107
108
|
let { contentDir: t } = e, n = `/${t}/**/*.{td,md}`, i = JSON.stringify({
|
|
108
109
|
title: e.siteTitle,
|
|
109
110
|
description: e.siteDescription
|
|
@@ -158,8 +159,8 @@ if (import.meta.hot) {
|
|
|
158
159
|
}
|
|
159
160
|
`;
|
|
160
161
|
}
|
|
161
|
-
function
|
|
162
|
-
let o = r.context, s, c = new
|
|
162
|
+
function I(r = {}) {
|
|
163
|
+
let o = r.context, s, c = new j(), u;
|
|
163
164
|
function f() {
|
|
164
165
|
if (o === void 0) throw Error("typedown plugin not initialized");
|
|
165
166
|
return o.getTdContext();
|
|
@@ -173,23 +174,34 @@ function F(r = {}) {
|
|
|
173
174
|
},
|
|
174
175
|
config() {
|
|
175
176
|
return {
|
|
176
|
-
resolve: { alias:
|
|
177
|
+
resolve: { alias: P() },
|
|
177
178
|
ssr: { noExternal: ["typerighter"] }
|
|
178
179
|
};
|
|
179
180
|
},
|
|
181
|
+
async buildStart() {
|
|
182
|
+
let e = await (await f()).checkVault();
|
|
183
|
+
if (e.errorCount > 0 || e.warningCount > 0) for (let t of e.diagnostics) {
|
|
184
|
+
let e = `${t.filepath}:${t.line}:${t.column}`, n = t.severity === "error" ? S.red("error") : S.yellow("warn");
|
|
185
|
+
console.error(` ${n} ${e} ${t.message} ${S.dim(`(${t.code})`)}`);
|
|
186
|
+
}
|
|
187
|
+
if (!s && e.errorCount > 0) {
|
|
188
|
+
let t = e.diagnostics.filter((e) => e.severity === "error").map((e) => ` ${e.filepath}:${e.line}:${e.column} - ${e.message} (${e.code})`);
|
|
189
|
+
this.error(`Vault check failed with ${e.errorCount} error(s):\n${t.join("\n")}`);
|
|
190
|
+
}
|
|
191
|
+
},
|
|
180
192
|
resolveId(e) {
|
|
181
193
|
if (e === "/@typedown/app" || e === "@typedown/app") return t;
|
|
182
194
|
if (e === "@typedown/search-index") return a;
|
|
183
195
|
},
|
|
184
196
|
async load(e) {
|
|
185
|
-
if (e === "\0@typedown/search-index") return u ||=
|
|
197
|
+
if (e === "\0@typedown/search-index") return u ||= V(await f(), c), await u, `export default ${JSON.stringify(c.serialize())}`;
|
|
186
198
|
if (e !== "\0@typedown/app") return;
|
|
187
199
|
let t = await f(), [n, r, i] = await Promise.all([
|
|
188
200
|
t.getConfig(),
|
|
189
201
|
t.listFilesGroupedBySchema(),
|
|
190
202
|
t.listSchemas()
|
|
191
203
|
]), a = await Promise.all(i.map(async (e) => [e, (await t.getSchema(e)).properties])), o = Object.fromEntries(a), s = d(Object.values(r).flat());
|
|
192
|
-
return
|
|
204
|
+
return F({
|
|
193
205
|
...n,
|
|
194
206
|
contentTree: s,
|
|
195
207
|
schemas: o
|
|
@@ -198,14 +210,14 @@ function F(r = {}) {
|
|
|
198
210
|
async configureServer(t) {
|
|
199
211
|
s = t;
|
|
200
212
|
let n = await f();
|
|
201
|
-
n.rpc.onConfigChanged(() => s &&
|
|
202
|
-
s && (
|
|
203
|
-
e && s && (c.addPage(e),
|
|
213
|
+
n.rpc.onConfigChanged(() => s && z(s)), n.rpc.onContentChanged(({ content: e }) => {
|
|
214
|
+
s && (L(n, e).then((e) => {
|
|
215
|
+
e && s && (c.addPage(e), H(s));
|
|
204
216
|
}).catch(() => {}), n.getConfig().then((t) => {
|
|
205
217
|
if (!s) return;
|
|
206
|
-
let n =
|
|
218
|
+
let n = T(x(s.config.root, t.contentDir, e)), r = s.moduleGraph.getModulesByFile(n);
|
|
207
219
|
if (!r?.size) return;
|
|
208
|
-
let i = [...r].map((e) => (s?.moduleGraph.invalidateModule(e),
|
|
220
|
+
let i = [...r].map((e) => (s?.moduleGraph.invalidateModule(e), U(e)));
|
|
209
221
|
s.hot.send({
|
|
210
222
|
type: "update",
|
|
211
223
|
updates: i
|
|
@@ -213,11 +225,11 @@ function F(r = {}) {
|
|
|
213
225
|
}).catch(() => {}));
|
|
214
226
|
});
|
|
215
227
|
function r() {
|
|
216
|
-
s && (u =
|
|
217
|
-
s &&
|
|
218
|
-
}),
|
|
228
|
+
s && (u = V(n, c), u.then(() => {
|
|
229
|
+
s && H(s);
|
|
230
|
+
}), B(s));
|
|
219
231
|
}
|
|
220
|
-
return n.rpc.onContentCreated(r), n.rpc.onContentDeleted(r), n.rpc.onSchemaChanged(() => s &&
|
|
232
|
+
return n.rpc.onContentCreated(r), n.rpc.onContentDeleted(r), n.rpc.onSchemaChanged(() => s && B(s)), n.rpc.onSchemaCreated(() => s && B(s)), n.rpc.onSchemaDeleted(() => s && B(s)), () => {
|
|
221
233
|
t.middlewares.use((t, r, i) => {
|
|
222
234
|
if (!t.url || r.writableEnded || t.url.startsWith("/@") || t.url.startsWith("/node_modules") || t.url.includes(".")) return i();
|
|
223
235
|
n.getConfig().then((t) => {
|
|
@@ -242,7 +254,7 @@ function F(r = {}) {
|
|
|
242
254
|
async transform(e, t) {
|
|
243
255
|
let n = t.split("?")[0];
|
|
244
256
|
if (!l(n)) return;
|
|
245
|
-
let r = await f(), i = (await r.getConfig()).contentDir, a = n.includes(i) ? n.slice(n.indexOf(i) + i.length + 1) : n, { vueSrc: o } = await
|
|
257
|
+
let r = await f(), i = (await r.getConfig()).contentDir, a = n.includes(i) ? n.slice(n.indexOf(i) + i.length + 1) : n, { vueSrc: o } = await D(r, await r.getFile(a), a);
|
|
246
258
|
return {
|
|
247
259
|
code: o,
|
|
248
260
|
map: null
|
|
@@ -252,11 +264,11 @@ function F(r = {}) {
|
|
|
252
264
|
if (l(e)) return [];
|
|
253
265
|
}
|
|
254
266
|
},
|
|
255
|
-
|
|
256
|
-
...
|
|
267
|
+
w({ include: /\.(?:vue|td)$/ }),
|
|
268
|
+
...C()
|
|
257
269
|
];
|
|
258
270
|
}
|
|
259
|
-
async function
|
|
271
|
+
async function L(e, t) {
|
|
260
272
|
try {
|
|
261
273
|
let n = await e.getFile(t), r = await e.md.renderAsync(n.content, {
|
|
262
274
|
path: t,
|
|
@@ -272,32 +284,32 @@ async function I(e, t) {
|
|
|
272
284
|
return;
|
|
273
285
|
}
|
|
274
286
|
}
|
|
275
|
-
function
|
|
287
|
+
function R(e) {
|
|
276
288
|
return [...e.moduleGraph.idToModuleMap.entries()].filter(([e]) => e.endsWith(".td")).map(([, e]) => e);
|
|
277
289
|
}
|
|
278
|
-
function
|
|
279
|
-
for (let t of
|
|
290
|
+
function z(e) {
|
|
291
|
+
for (let t of R(e)) e.moduleGraph.invalidateModule(t);
|
|
280
292
|
e.hot.send({ type: "full-reload" });
|
|
281
293
|
}
|
|
282
|
-
function
|
|
283
|
-
let t =
|
|
294
|
+
function B(e) {
|
|
295
|
+
let t = R(e).map((t) => (e.moduleGraph.invalidateModule(t), U(t)));
|
|
284
296
|
0 < t.length && e.hot.send({
|
|
285
297
|
type: "update",
|
|
286
298
|
updates: t
|
|
287
299
|
});
|
|
288
300
|
}
|
|
289
|
-
async function
|
|
290
|
-
let n = await e.listFiles(), r = await Promise.all(n.map((t) =>
|
|
301
|
+
async function V(e, t) {
|
|
302
|
+
let n = await e.listFiles(), r = await Promise.all(n.map((t) => L(e, t)));
|
|
291
303
|
t.addAll(r.filter((e) => e !== void 0));
|
|
292
304
|
}
|
|
293
|
-
function
|
|
305
|
+
function H(e) {
|
|
294
306
|
let t = e.moduleGraph.getModuleById(a);
|
|
295
307
|
t && (e.moduleGraph.invalidateModule(t), e.hot.send({
|
|
296
308
|
type: "update",
|
|
297
|
-
updates: [
|
|
309
|
+
updates: [U(t)]
|
|
298
310
|
}));
|
|
299
311
|
}
|
|
300
|
-
function
|
|
312
|
+
function U(e) {
|
|
301
313
|
return {
|
|
302
314
|
type: "js-update",
|
|
303
315
|
path: e.url,
|
|
@@ -306,4 +318,4 @@ function H(e) {
|
|
|
306
318
|
};
|
|
307
319
|
}
|
|
308
320
|
//#endregion
|
|
309
|
-
export {
|
|
321
|
+
export { I as n, F as t };
|
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-DPRlAukM.js";
|
|
2
2
|
export { t as generateClientAppEntry, e 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.
|
|
4
|
+
"version": "0.5.1",
|
|
5
5
|
"description": "Typedown: A typed content framework.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
"tailwindcss": "^4.3.3",
|
|
82
82
|
"vite": "^6.0.0 || ^7.0.0 || ^8.0.0",
|
|
83
83
|
"vue": "^3.0.0",
|
|
84
|
-
"@typerighter/rpc-client": "0.
|
|
85
|
-
"@typerighter/rpc-server": "0.
|
|
84
|
+
"@typerighter/rpc-client": "0.5.1",
|
|
85
|
+
"@typerighter/rpc-server": "0.5.1"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@hdnax/nuclint": "^0.17.4",
|