typerighter 0.32.1 → 0.32.3

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/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  ![Status](https://img.shields.io/badge/status-alpha-orange)
7
7
  ![License](https://img.shields.io/badge/license-AGPL--3.0-green)
8
8
 
9
- **[Homepage](https://huydo862003.github.io/typerighter/) · [Getting Started](https://huydo862003.github.io/typerighter/guide/01-getting-started) · [GitHub](https://github.com/huydo862003/typerighter) · [Issues](https://github.com/huydo862003/typerighter/issues)**
9
+ **[Homepage](https://huydo862003.github.io/typerighter/) · [Getting Started](https://huydo862003.github.io/typerighter/) · [GitHub](https://github.com/huydo862003/typerighter) · [Issues](https://github.com/huydo862003/typerighter/issues)**
10
10
 
11
11
  Vite plugin and static site generator for [Typedown](https://huydo862003.github.io/typerighter/), a typed content framework built on markdown.
12
12
 
@@ -23,4 +23,4 @@ Vite plugin and static site generator for [Typedown](https://huydo862003.github.
23
23
  npm install typerighter
24
24
  ```
25
25
 
26
- See the [getting started guide](https://huydo862003.github.io/typerighter/guide/01-getting-started) for full setup and usage instructions.
26
+ See the [getting started guide](https://huydo862003.github.io/typerighter/) for full setup and usage instructions.
package/README.npm.md CHANGED
@@ -6,7 +6,7 @@
6
6
  ![Status](https://img.shields.io/badge/status-alpha-orange)
7
7
  ![License](https://img.shields.io/badge/license-AGPL--3.0-green)
8
8
 
9
- **[Homepage](https://huydo862003.github.io/typerighter/) · [Getting Started](https://huydo862003.github.io/typerighter/guide/01-getting-started) · [GitHub](https://github.com/huydo862003/typerighter) · [Issues](https://github.com/huydo862003/typerighter/issues)**
9
+ **[Homepage](https://huydo862003.github.io/typerighter/) · [Getting Started](https://huydo862003.github.io/typerighter/) · [GitHub](https://github.com/huydo862003/typerighter) · [Issues](https://github.com/huydo862003/typerighter/issues)**
10
10
 
11
11
  Vite plugin and static site generator for [Typedown](https://huydo862003.github.io/typerighter/), a typed content framework built on markdown.
12
12
 
@@ -23,4 +23,4 @@ Vite plugin and static site generator for [Typedown](https://huydo862003.github.
23
23
  npm install typerighter
24
24
  ```
25
25
 
26
- See the [getting started guide](https://huydo862003.github.io/typerighter/guide/01-getting-started) for full setup and usage instructions.
26
+ See the [getting started guide](https://huydo862003.github.io/typerighter/) for full setup and usage instructions.
@@ -1,4 +1,4 @@
1
- import { a as e, i as t, t as n } from "./vite-OiCh59kk.js";
1
+ import { a as e, i as t, t as n } from "./vite-oRX7_Z5q.js";
2
2
  import r from "node:path";
3
3
  import i from "picocolors";
4
4
  import { createServer as a } from "vite";
@@ -362,7 +362,7 @@ function k() {
362
362
  }), process.on("unhandledRejection", (e) => {
363
363
  A("runtime", e instanceof Error ? e : Error(String(e)));
364
364
  }), i.command("[root]", "Start dev server").alias("dev").option("--port <port>", "Port to listen on").option("--host", "Expose to network").option("--verbose", "Print version and build info").action(async (e, t) => {
365
- t.verbose && console.log(`${O} cli v0.32.1 (built 9/15/2026, 3:32:35 AM)\n`);
365
+ t.verbose && console.log(`${O} cli v0.32.3 (built 9/15/2026, 6:17:52 AM)\n`);
366
366
  let r = await a({
367
367
  root: M(e),
368
368
  configFile: !1,
@@ -385,7 +385,7 @@ function k() {
385
385
  i.dispose();
386
386
  }
387
387
  }), i.command("init [root]", "Scaffold a new project").option("--name <name>", "Project name").option("--title <title>", "Site title").option("--description <description>", "Site description").option("--yes", "Skip confirmation for existing projects").action(async (e, t) => {
388
- let { initialize: n } = await import("./init-BmuDA5rB.js");
388
+ let { initialize: n } = await import("./init-6X7B3gmt.js");
389
389
  await n(M(e), t);
390
390
  }), i.command("preview [root]", "Preview production build").option("--port <port>", "Port to listen on").action(async (e, n) => {
391
391
  let r = M(e), i = t(r);
@@ -423,7 +423,7 @@ function k() {
423
423
  } finally {
424
424
  i.dispose();
425
425
  }
426
- }), i.help(), i.version("0.32.1"), i.parse();
426
+ }), i.help(), i.version("0.32.3"), i.parse();
427
427
  }
428
428
  function A(e, t) {
429
429
  let n = t instanceof Error ? t.message : String(t);
@@ -431,7 +431,7 @@ function A(e, t) {
431
431
  }
432
432
  async function j(e) {
433
433
  let t = await (await e.getTdContext()).rpc.getVersion();
434
- console.log(`${O} cli v0.32.1 (built 9/15/2026, 3:32:35 AM)`), console.log(`${O} rpc v${t}`), console.log("");
434
+ console.log(`${O} cli v0.32.3 (built 9/15/2026, 6:17:52 AM)`), console.log(`${O} rpc v${t}`), console.log("");
435
435
  }
436
436
  function M(e) {
437
437
  return r.resolve(e ?? process.cwd());
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as e } from "./cli-DTAPMZcc.js";
1
+ import { t as e } from "./cli-nsy8rxpy.js";
2
2
  export { e as cli };
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { a as e, n as t, t as n } from "./vite-OiCh59kk.js";
2
- import { t as r } from "./cli-DTAPMZcc.js";
1
+ import { a as e, n as t, t as n } from "./vite-oRX7_Z5q.js";
2
+ import { t as r } from "./cli-nsy8rxpy.js";
3
3
  export { e as buildSite, r as cli, t as generateClientAppEntry, n as typedown };
@@ -1,5 +1,5 @@
1
1
  import { q as e } from "./shared-B-n46X4N.js";
2
- import { r as t } from "./vite-OiCh59kk.js";
2
+ import { r as t } from "./vite-oRX7_Z5q.js";
3
3
  import { a as n, i as r, n as i, r as a, t as o } from "./brand-CG1fQshq.js";
4
4
  import s from "node:path";
5
5
  import c from "node:fs/promises";
@@ -749,7 +749,7 @@ function He(e) {
749
749
  build: "typerighter build",
750
750
  preview: "typerighter preview"
751
751
  },
752
- devDependencies: { typerighter: "^0.32.1" }
752
+ devDependencies: { typerighter: "^0.32.3" }
753
753
  }, void 0, 2) + "\n";
754
754
  }
755
755
  function Ue() {
@@ -1 +1 @@
1
- {"version":3,"file":"prerender.d.ts","sourceRoot":"","sources":["../../../src/node/build/prerender.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,cAAc,EACf,MAAM,iBAAiB,CAAC;AAKzB,MAAM,WAAW,gBAAgB;IAC/B,4CAA4C;IAC5C,YAAY,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,YAAY,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAID,wBAAsB,kBAAkB,CAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CA+ClF"}
1
+ {"version":3,"file":"prerender.d.ts","sourceRoot":"","sources":["../../../src/node/build/prerender.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,cAAc,EACf,MAAM,iBAAiB,CAAC;AAKzB,MAAM,WAAW,gBAAgB;IAC/B,4CAA4C;IAC5C,YAAY,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,YAAY,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAID,wBAAsB,kBAAkB,CAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAmDlF"}
@@ -5,15 +5,15 @@ import C, { resolve as w } from "node:path";
5
5
  import T from "picocolors";
6
6
  import ee from "@tailwindcss/vite";
7
7
  import te from "@vitejs/plugin-vue";
8
- import { build as ne, createLogger as re, normalizePath as ie } from "vite";
9
- import E from "node:fs/promises";
10
- import { createHighlighter as ae, guessEmbeddedLanguages as oe, isSpecialLang as se } from "shiki";
11
- import D, { createReadStream as ce, existsSync as le, globSync as O, readFileSync as ue, statSync as de } from "node:fs";
8
+ import { build as E, createLogger as ne, normalizePath as re } from "vite";
9
+ import D from "node:fs/promises";
10
+ import { createHighlighter as ie, guessEmbeddedLanguages as ae, isSpecialLang as oe } from "shiki";
11
+ import O, { createReadStream as se, existsSync as ce, globSync as le, readFileSync as ue, statSync as de } from "node:fs";
12
12
  import { RpcServer as fe } from "@typerighter/rpc-server";
13
13
  import { RPC_CANCELLED_CODE as pe, RpcClient as me } from "@typerighter/rpc-client";
14
14
  import { createRequire as he } from "node:module";
15
15
  //#region src/node/lib/html-template.ts
16
- function k(e) {
16
+ function ge(e) {
17
17
  let t = _(e.title), n = _(e.description), r = e.siteTitle !== void 0 && e.title !== e.siteTitle ? `${t} - ${_(e.siteTitle)}` : t, i = e.canonicalUrl === void 0 ? "" : `\n <link rel="canonical" href="${_(e.canonicalUrl)}">`, a = e.headExtra === void 0 ? "" : e.headExtra + "\n", o = JSON.stringify({
18
18
  "@context": "https://schema.org",
19
19
  "@type": "Article",
@@ -53,24 +53,27 @@ ${a} </head>
53
53
  }
54
54
  //#endregion
55
55
  //#region src/node/build/prerender.ts
56
- async function ge(e) {
57
- let t = await import(e.ssrEntryPath), { clientEntry: n, cssFiles: r, jsFiles: i } = await _e(e.clientOutDir), a = e.pagePaths.length, o = 0;
58
- await Promise.all(e.pagePaths.map(async (s) => {
59
- let c = await t.render(s), l = r.map((t) => ` <link rel="stylesheet" href="${e.base}${t}">`).join("\n"), u = i.map((t) => ` <link rel="modulepreload" href="${e.base}${t}">`).join("\n"), d = k({
60
- title: c.pageData.title,
61
- description: c.pageData.frontmatter.description === void 0 ? "" : String(c.pageData.frontmatter.description),
62
- siteTitle: e.siteTitle,
63
- base: e.base,
64
- entryScript: n,
65
- canonicalUrl: e.base + s.replace(/^\//, ""),
66
- headExtra: [l, u].filter(Boolean).join("\n") || void 0,
67
- appContent: c.html
68
- }), f = s === "/" ? "index.html" : `${s.replace(/^\//, "")}.html`, p = C.join(e.outDir, f);
69
- await E.mkdir(C.dirname(p), { recursive: !0 }), await E.writeFile(p, d), o++, e.progress?.update(o, a);
70
- }));
71
- }
72
56
  async function _e(e) {
73
- let t = C.join(e, ".vite", "manifest.json"), n = await E.readFile(t, "utf-8"), r = JSON.parse(n), i = "", a = [], o = [];
57
+ let t = await import(e.ssrEntryPath), { clientEntry: n, cssFiles: r, jsFiles: i } = await ve(e.clientOutDir), a = e.pagePaths.length, o = 0, s = [r.map((t) => ` <link rel="stylesheet" href="${e.base}${t}">`).join("\n"), i.map((t) => ` <link rel="modulepreload" href="${e.base}${t}">`).join("\n")].filter(Boolean).join("\n") || void 0;
58
+ for (let r = 0; r < a; r += 32) {
59
+ let i = e.pagePaths.slice(r, r + 32);
60
+ await Promise.all(i.map(async (r) => {
61
+ let i = await t.render(r), c = ge({
62
+ title: i.pageData.title,
63
+ description: i.pageData.frontmatter.description === void 0 ? "" : String(i.pageData.frontmatter.description),
64
+ siteTitle: e.siteTitle,
65
+ base: e.base,
66
+ entryScript: n,
67
+ canonicalUrl: e.base + r.replace(/^\//, ""),
68
+ headExtra: s,
69
+ appContent: i.html
70
+ }), l = r === "/" ? "index.html" : `${r.replace(/^\//, "")}.html`, u = C.join(e.outDir, l);
71
+ await D.mkdir(C.dirname(u), { recursive: !0 }), await D.writeFile(u, c), o++, e.progress?.update(o, a);
72
+ }));
73
+ }
74
+ }
75
+ async function ve(e) {
76
+ let t = C.join(e, ".vite", "manifest.json"), n = await D.readFile(t, "utf-8"), r = JSON.parse(n), i = "", a = [], o = [];
74
77
  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);
75
78
  return {
76
79
  clientEntry: i,
@@ -80,12 +83,12 @@ async function _e(e) {
80
83
  }
81
84
  //#endregion
82
85
  //#region src/node/lib/progress.ts
83
- var A = [
86
+ var k = [
84
87
  "◐",
85
88
  "◓",
86
89
  "◑",
87
90
  "◒"
88
- ], j = class {
91
+ ], A = class {
89
92
  logger;
90
93
  label;
91
94
  start;
@@ -93,8 +96,8 @@ var A = [
93
96
  constructor(e, t) {
94
97
  if (this.logger = e, this.label = t, this.start = performance.now(), process.stdout.isTTY) {
95
98
  let e = 0;
96
- process.stdout.write(T.cyan(`${A[0]} ${t}`)), this.spinnerInterval = setInterval(() => {
97
- e = (e + 1) % A.length, process.stdout.write(`\r${T.cyan(`${A[e]} ${this.label}`)}`);
99
+ process.stdout.write(T.cyan(`${k[0]} ${t}`)), this.spinnerInterval = setInterval(() => {
100
+ e = (e + 1) % k.length, process.stdout.write(`\r${T.cyan(`${k[e]} ${this.label}`)}`);
98
101
  }, 120).unref();
99
102
  } else this.logger.start(t);
100
103
  }
@@ -106,21 +109,21 @@ var A = [
106
109
  done(e) {
107
110
  this.stopSpinner(), process.stdout.isTTY && process.stdout.write("\r\x1B[K");
108
111
  let t = Math.round(performance.now() - this.start);
109
- this.logger.success(`${e} (${ve(t)})`);
112
+ this.logger.success(`${e} (${ye(t)})`);
110
113
  }
111
114
  stopSpinner() {
112
115
  this.spinnerInterval &&= (clearInterval(this.spinnerInterval), void 0);
113
116
  }
114
117
  };
115
- function ve(e) {
118
+ function ye(e) {
116
119
  return e < 1e3 ? `${Math.round(e)}ms` : `${(e / 1e3).toFixed(1)}s`;
117
120
  }
118
121
  //#endregion
119
122
  //#region src/node/build/index.ts
120
- var ye = "typerighter/client/theme-default";
121
- async function M(e, t = {}) {
123
+ var be = "typerighter/client/theme-default";
124
+ async function j(e, t = {}) {
122
125
  let { root: n, logger: r } = e, i = C.resolve(n, t.outDir ?? "dist"), a = C.join(i, ".client"), o = C.join(i, ".server");
123
- await E.rm(i, {
126
+ await D.rm(i, {
124
127
  recursive: !0,
125
128
  force: !0
126
129
  });
@@ -141,9 +144,9 @@ async function M(e, t = {}) {
141
144
  ready: !0,
142
145
  contentTree: _
143
146
  }), b = C.join(n, "node_modules", ".typerighter");
144
- await E.mkdir(b, { recursive: !0 });
147
+ await D.mkdir(b, { recursive: !0 });
145
148
  let x = C.join(b, "client-entry.js"), S = C.join(b, "ssr-entry.js");
146
- await Promise.all([E.writeFile(x, Q({
149
+ await Promise.all([D.writeFile(x, Q({
147
150
  rootDir: l.rootDir,
148
151
  basePath: m,
149
152
  siteTitle: l.siteTitle,
@@ -152,15 +155,15 @@ async function M(e, t = {}) {
152
155
  author: l.author,
153
156
  license: l.license,
154
157
  nav: l.nav
155
- })), E.writeFile(S, be({
158
+ })), D.writeFile(S, xe({
156
159
  rootDir: l.rootDir,
157
- layoutImport: ye,
160
+ layoutImport: be,
158
161
  siteConfig: v,
159
162
  siteData: y
160
163
  }))]);
161
164
  try {
162
- let c = $({ context: e }), d = e.createViteLogger(), f = new j(r, "Building client bundle...");
163
- await ne({
165
+ let c = $({ context: e }), d = e.createViteLogger(), f = new A(r, "Building client bundle...");
166
+ await E({
164
167
  ...t.viteConfig,
165
168
  root: n,
166
169
  base: m,
@@ -178,10 +181,10 @@ async function M(e, t = {}) {
178
181
  }
179
182
  }
180
183
  });
181
- let p = await E.readdir(C.join(a, "assets")).catch(() => []);
184
+ let p = await D.readdir(C.join(a, "assets")).catch(() => []);
182
185
  f.done(`Client bundle (${p.length} chunks)`);
183
- let h = new j(r, "Building SSR bundle...");
184
- await ne({
186
+ let h = new A(r, "Building SSR bundle...");
187
+ await E({
185
188
  ...t.viteConfig,
186
189
  root: n,
187
190
  base: m,
@@ -199,9 +202,9 @@ async function M(e, t = {}) {
199
202
  let t = s(e);
200
203
  return t === "index" ? "/" : `/${t}`;
201
204
  });
202
- g.push("/"), N(_.entries, "", g);
203
- let v = new j(r, "Pre-rendering pages...");
204
- await ge({
205
+ g.push("/"), M(_.entries, "", g);
206
+ let v = new A(r, "Pre-rendering pages...");
207
+ await _e({
205
208
  ssrEntryPath: C.join(o, "ssr-entry.js"),
206
209
  clientOutDir: a,
207
210
  outDir: i,
@@ -210,23 +213,23 @@ async function M(e, t = {}) {
210
213
  siteTitle: l.siteTitle,
211
214
  progress: v
212
215
  }), v.done(`Pre-rendered ${g.length} pages`);
213
- let y = Se(g, m);
214
- await E.writeFile(C.join(i, "sitemap.xml"), y);
216
+ let y = Ce(g, m);
217
+ await D.writeFile(C.join(i, "sitemap.xml"), y);
215
218
  let b = C.join(a, "assets"), w = C.join(i, "assets");
216
- await E.cp(b, w, { recursive: !0 }).catch(() => {}), await xe(C.join(n, l.rootDir), i);
219
+ await D.cp(b, w, { recursive: !0 }).catch(() => {}), await Se(C.join(n, l.rootDir), i);
217
220
  let T = C.join(n, l.publicDir);
218
- await E.cp(T, i, { recursive: !0 }).catch(() => {});
221
+ await D.cp(T, i, { recursive: !0 }).catch(() => {});
219
222
  } finally {
220
223
  await Promise.all([
221
- E.rm(b, {
224
+ D.rm(b, {
222
225
  recursive: !0,
223
226
  force: !0
224
227
  }),
225
- E.rm(a, {
228
+ D.rm(a, {
226
229
  recursive: !0,
227
230
  force: !0
228
231
  }),
229
- E.rm(o, {
232
+ D.rm(o, {
230
233
  recursive: !0,
231
234
  force: !0
232
235
  })
@@ -234,7 +237,7 @@ async function M(e, t = {}) {
234
237
  }
235
238
  r.log(`\nBuild complete. Output: ${i}`);
236
239
  }
237
- function be(e) {
240
+ function xe(e) {
238
241
  let t = `/${e.rootDir}/${u}`, r = JSON.parse(e.siteConfig), i = JSON.parse(e.siteData), a = i.contentTree ?? { entries: [] }, o = h(a.entries ?? [], r.title ?? ""), s = JSON.stringify({
239
242
  ...i,
240
243
  directoryListings: o
@@ -283,39 +286,39 @@ export async function render(url) {
283
286
  }
284
287
  `;
285
288
  }
286
- async function xe(t, n) {
287
- let r = (await E.readdir(t, {
289
+ async function Se(t, n) {
290
+ let r = (await D.readdir(t, {
288
291
  recursive: !0,
289
292
  withFileTypes: !0
290
293
  })).filter((t) => t.isFile() && !e(t.name)).map(async (e) => {
291
294
  let r = C.join(e.parentPath, e.name), i = C.relative(t, r), a = C.join(n, i);
292
- return E.mkdir(C.dirname(a), { recursive: !0 }).then(() => E.copyFile(r, a));
295
+ return D.mkdir(C.dirname(a), { recursive: !0 }).then(() => D.copyFile(r, a));
293
296
  });
294
297
  await Promise.all(r);
295
298
  }
296
- function Se(e, t) {
299
+ function Ce(e, t) {
297
300
  return `<?xml version="1.0" encoding="UTF-8"?>
298
301
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
299
302
  ${e.map((e) => ` <url><loc>${_(t + e.replace(/^\//, ""))}</loc></url>`).join("\n")}
300
303
  </urlset>
301
304
  `;
302
305
  }
303
- function N(e, t, n) {
306
+ function M(e, t, n) {
304
307
  for (let r of e) {
305
308
  if (r.kind !== "dir") continue;
306
309
  let e = `${t}/${r.node.name}`;
307
- m(r.node) || n.push(c(e)), N(r.node.entries, e, n);
310
+ m(r.node) || n.push(c(e)), M(r.node.entries, e, n);
308
311
  }
309
312
  }
310
313
  //#endregion
311
314
  //#region ../../node_modules/.pnpm/@shikijs+transformers@4.4.3/node_modules/@shikijs/transformers/dist/index.mjs
312
- var Ce = /(\s+\/\/)/, we = /(?:\/\/|["'#]|;{1,2}|%{1,2}|--)(\s*)$/, Te = /(?:\/\/|#|;{1,2}|%{1,2}|--)(\s*)$/, Ee = [
315
+ var we = /(\s+\/\/)/, Te = /(?:\/\/|["'#]|;{1,2}|%{1,2}|--)(\s*)$/, Ee = /(?:\/\/|#|;{1,2}|%{1,2}|--)(\s*)$/, De = [
313
316
  [/^(<!--)(.+)(-->)$/, !1],
314
317
  [/^(\/\*)(.+)(\*\/)$/, !1],
315
318
  [/^(\/\/|["'#]|;{1,2}|%{1,2}|--)(.*)$/, !0],
316
319
  [/^(\*)(.+)$/, !0]
317
320
  ];
318
- function De(e, t, n) {
321
+ function Oe(e, t, n) {
319
322
  let r = [];
320
323
  for (let i of e) {
321
324
  if (n === "v3") {
@@ -324,8 +327,8 @@ function De(e, t, n) {
324
327
  let n = e.children[0];
325
328
  if (n.type !== "text") return e;
326
329
  let r = t === i.children.length - 1;
327
- if (!F(n.value, r)) return e;
328
- let a = n.value.split(Ce);
330
+ if (!P(n.value, r)) return e;
331
+ let a = n.value.split(we);
329
332
  if (a.length <= 1) return e;
330
333
  let o = [a[0]];
331
334
  for (let e = 1; e < a.length; e += 2) o.push(a[e] + (a[e + 1] || ""));
@@ -346,13 +349,13 @@ function De(e, t, n) {
346
349
  if (a.type !== "element") continue;
347
350
  let o = a.children.at(0);
348
351
  if (o?.type !== "text") continue;
349
- let s = n === e.length - 1, c = F(o.value, s), l;
352
+ let s = n === e.length - 1, c = P(o.value, s), l;
350
353
  if (!c && n > 0 && o.value.trim().startsWith("[!code")) {
351
354
  let t = e[n - 1];
352
355
  if (t?.type === "element") {
353
356
  let n = t.children.at(0);
354
357
  if (n?.type === "text" && n.value.includes("//")) {
355
- let l = F(n.value + o.value, s);
358
+ let l = P(n.value + o.value, s);
356
359
  if (l) {
357
360
  c = l, r.push({
358
361
  info: l,
@@ -369,7 +372,7 @@ function De(e, t, n) {
369
372
  }
370
373
  if (c) {
371
374
  if (t && !s && n !== 0) {
372
- let t = P(e[n - 1], "{") && P(e[n + 1], "}");
375
+ let t = N(e[n - 1], "{") && N(e[n + 1], "}");
373
376
  r.push({
374
377
  info: c,
375
378
  line: i,
@@ -391,16 +394,16 @@ function De(e, t, n) {
391
394
  }
392
395
  return r;
393
396
  }
394
- function P(e, t) {
397
+ function N(e, t) {
395
398
  if (e.type !== "element") return !1;
396
399
  let n = e.children[0];
397
400
  return n.type === "text" && n.value.trim() === t;
398
401
  }
399
- function F(e, t) {
402
+ function P(e, t) {
400
403
  let n = e.trimStart(), r = e.length - n.length;
401
404
  n = n.trimEnd();
402
405
  let i = e.length - n.length - r;
403
- for (let [e, a] of Ee) {
406
+ for (let [e, a] of De) {
404
407
  if (a && !t) continue;
405
408
  let o = e.exec(n);
406
409
  if (o) return [
@@ -410,22 +413,22 @@ function F(e, t) {
410
413
  ];
411
414
  }
412
415
  }
413
- function Oe(e) {
414
- let t = e.match(we);
415
- return t && t[1].trim().length === 0 ? e.slice(0, t.index) : e;
416
- }
417
416
  function ke(e) {
418
417
  let t = e.match(Te);
418
+ return t && t[1].trim().length === 0 ? e.slice(0, t.index) : e;
419
+ }
420
+ function Ae(e) {
421
+ let t = e.match(Ee);
419
422
  return t && t[1].trim().length === 0 ? e.slice(0, t.index).trimEnd() : e;
420
423
  }
421
- function Ae(e, t, n, r) {
424
+ function je(e, t, n, r) {
422
425
  return r ??= "v3", {
423
426
  name: e,
424
427
  code(e) {
425
428
  let i = e.children.filter((e) => e.type === "element"), a = [];
426
429
  e.data ??= {};
427
430
  let o = e.data;
428
- o._shiki_notation ??= De(i, ["jsx", "tsx"].includes(this.options.lang), r);
431
+ o._shiki_notation ??= Oe(i, ["jsx", "tsx"].includes(this.options.lang), r);
429
432
  let s = o._shiki_notation;
430
433
  for (let e of s) {
431
434
  if (e.info[1].length === 0) continue;
@@ -433,7 +436,7 @@ function Ae(e, t, n, r) {
433
436
  e.isLineCommentOnly && r !== "v1" && o++;
434
437
  let s = !1;
435
438
  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;
436
- r === "v1" ? e.info[1] = Oe(e.info[1]) : r === "v3" && (e.info[1] = ke(e.info[1]));
439
+ r === "v1" ? e.info[1] = ke(e.info[1]) : r === "v3" && (e.info[1] = Ae(e.info[1]));
437
440
  let c = e.info[1].trim().length === 0;
438
441
  if (c && (e.info[1] = ""), c && e.isLineCommentOnly) a.push(e.line);
439
442
  else if (c && e.isJsxStyle) e.line.children.splice(e.line.children.indexOf(e.token) - 1, 3);
@@ -458,44 +461,44 @@ function Ae(e, t, n, r) {
458
461
  }
459
462
  };
460
463
  }
461
- var je = /\{([\d,-]+)\}/;
462
- function Me(e) {
464
+ var Me = /\{([\d,-]+)\}/;
465
+ function Ne(e) {
463
466
  if (!e) return null;
464
- let t = e.match(je);
467
+ let t = e.match(Me);
465
468
  return t ? t[1].split(",").flatMap((e) => {
466
469
  let t = e.split("-").map((e) => Number.parseInt(e, 10));
467
470
  return t.length === 1 ? [t[0]] : Array.from({ length: t[1] - t[0] + 1 }, (e, n) => t[0] + n);
468
471
  }) : null;
469
472
  }
470
- var Ne = Symbol("highlighted-lines");
471
- function Pe(e = {}) {
473
+ var Pe = Symbol("highlighted-lines");
474
+ function Fe(e = {}) {
472
475
  let { className: t = "highlighted", zeroIndexed: n = !1 } = e;
473
476
  return {
474
477
  name: "@shikijs/transformers:meta-highlight",
475
478
  line(e, r) {
476
479
  if (!this.options.meta?.__raw) return;
477
480
  let i = this.meta;
478
- i[Ne] ??= Me(this.options.meta.__raw);
479
- let a = i[Ne] ?? [], o = n ? r - 1 : r;
481
+ i[Pe] ??= Ne(this.options.meta.__raw);
482
+ let a = i[Pe] ?? [], o = n ? r - 1 : r;
480
483
  return a.includes(o) && this.addClassToHast(e, t), e;
481
484
  }
482
485
  };
483
486
  }
484
- var Fe = /[.*+?^${}()|[\]\\]/g;
485
- function Ie(e) {
486
- return e.replace(Fe, "\\$&");
487
+ var Ie = /[.*+?^${}()|[\]\\]/g;
488
+ function Le(e) {
489
+ return e.replace(Ie, "\\$&");
487
490
  }
488
- function I(e = {}, t = "@shikijs/transformers:notation-map") {
491
+ function F(e = {}, t = "@shikijs/transformers:notation-map") {
489
492
  let { classMap: n = {}, classActivePre: r = void 0, classActiveCode: i = void 0 } = e;
490
- return Ae(t, RegExp(`#?\\s*\\[!code (${Object.keys(n).map(Ie).join("|")})(:\\d+)?\\]`, "gi"), function([e, t, a = ":1"], o, s, c, l) {
493
+ return je(t, RegExp(`#?\\s*\\[!code (${Object.keys(n).map(Le).join("|")})(:\\d+)?\\]`, "gi"), function([e, t, a = ":1"], o, s, c, l) {
491
494
  let u = Number.parseInt(a.slice(1), 10);
492
495
  for (let e = l; e < Math.min(l + u, c.length); e++) this.addClassToHast(c[e], n[t]);
493
496
  return r && this.addClassToHast(this.pre, r), i && this.addClassToHast(this.code, i), !0;
494
497
  }, e.matchAlgorithm);
495
498
  }
496
- function Le(e = {}) {
499
+ function Re(e = {}) {
497
500
  let { classLineAdd: t = "diff add", classLineRemove: n = "diff remove", classActivePre: r = "has-diff", classActiveCode: i } = e;
498
- return I({
501
+ return F({
499
502
  classMap: {
500
503
  "++": t,
501
504
  "--": n
@@ -505,31 +508,31 @@ function Le(e = {}) {
505
508
  matchAlgorithm: e.matchAlgorithm
506
509
  }, "@shikijs/transformers:notation-diff");
507
510
  }
508
- function Re(e = {}) {
511
+ function ze(e = {}) {
509
512
  let { classMap: t = {
510
513
  error: ["highlighted", "error"],
511
514
  warning: ["highlighted", "warning"],
512
515
  info: ["highlighted", "info"]
513
516
  }, classActivePre: n = "has-highlighted", classActiveCode: r } = e;
514
- return I({
517
+ return F({
515
518
  classMap: t,
516
519
  classActivePre: n,
517
520
  classActiveCode: r,
518
521
  matchAlgorithm: e.matchAlgorithm
519
522
  }, "@shikijs/transformers:notation-error-level");
520
523
  }
521
- function ze(e = {}) {
524
+ function Be(e = {}) {
522
525
  let { classActiveLine: t = "focused", classActivePre: n = "has-focused", classActiveCode: r } = e;
523
- return I({
526
+ return F({
524
527
  classMap: { focus: t },
525
528
  classActivePre: n,
526
529
  classActiveCode: r,
527
530
  matchAlgorithm: e.matchAlgorithm
528
531
  }, "@shikijs/transformers:notation-focus");
529
532
  }
530
- function Be(e = {}) {
533
+ function Ve(e = {}) {
531
534
  let { classActiveLine: t = "highlighted", classActivePre: n = "has-highlighted", classActiveCode: r } = e;
532
- return I({
535
+ return F({
533
536
  classMap: {
534
537
  highlight: t,
535
538
  hl: t
@@ -541,26 +544,26 @@ function Be(e = {}) {
541
544
  }
542
545
  //#endregion
543
546
  //#region src/node/lib/render/highlight/language.ts
544
- var Ve = [
547
+ var He = [
545
548
  "shellscript",
546
549
  "shell",
547
550
  "bash",
548
551
  "sh",
549
552
  "zsh"
550
553
  ];
551
- function He(e) {
552
- return Ve.includes(e);
554
+ function Ue(e) {
555
+ return He.includes(e);
553
556
  }
554
- var Ue = /^[a-zA-Z0-9-_]+/;
555
- function We(e) {
556
- return Ue.exec(e)?.[0] || "";
557
+ var We = /^[a-zA-Z0-9-_]+/;
558
+ function Ge(e) {
559
+ return We.exec(e)?.[0] || "";
557
560
  }
558
561
  //#endregion
559
562
  //#region src/node/lib/logger.ts
560
- var Ge = /\u001B\[[0-9;]*m/g, Ke = class {
563
+ var Ke = /\u001B\[[0-9;]*m/g, I = class {
561
564
  logStream;
562
565
  constructor(e) {
563
- e !== void 0 && (this.logStream = D.createWriteStream(e, { flags: "a" }), process.once("exit", () => this.close()));
566
+ e !== void 0 && (this.logStream = O.createWriteStream(e, { flags: "a" }), process.once("exit", () => this.close()));
564
567
  }
565
568
  info(e) {
566
569
  console.log(T.cyan(`ℹ ${e}`)), this.writeToFile("INFO", e);
@@ -582,31 +585,31 @@ var Ge = /\u001B\[[0-9;]*m/g, Ke = class {
582
585
  }
583
586
  writeToFile(e, t) {
584
587
  if (!this.logStream) return;
585
- let n = (/* @__PURE__ */ new Date()).toISOString(), r = t.replace(Ge, "");
588
+ let n = (/* @__PURE__ */ new Date()).toISOString(), r = t.replace(Ke, "");
586
589
  this.logStream.write(`${n} [${e}] ${r}\n`);
587
590
  }
588
591
  close() {
589
592
  this.logStream?.end(), this.logStream = void 0;
590
593
  }
591
- }, qe = new Ke(), Je = new FinalizationRegistry((e) => {
594
+ }, qe = new I(), Je = new FinalizationRegistry((e) => {
592
595
  e();
593
596
  }), L = {
594
597
  light: "github-light",
595
598
  dark: "github-dark"
596
599
  };
597
600
  async function Ye() {
598
- let e = await ae({
601
+ let e = await ie({
599
602
  themes: [L.light, L.dark],
600
603
  langs: []
601
604
  }), t = [
602
- Pe(),
603
- Le(),
604
- ze({
605
+ Fe(),
606
+ Re(),
607
+ Be({
605
608
  classActiveLine: "has-focus",
606
609
  classActivePre: "has-focused-lines"
607
610
  }),
608
- Be(),
609
- Re(),
611
+ Ve(),
612
+ ze(),
610
613
  Xe(),
611
614
  {
612
615
  name: "typedown:add-dir",
@@ -616,19 +619,19 @@ async function Ye() {
616
619
  }
617
620
  ], n = new Set(e.getLoadedLanguages());
618
621
  async function r(r, i, a) {
619
- let o = We(i);
622
+ let o = Ge(i);
620
623
  if (o) {
621
624
  let e = i;
622
625
  i = o.toLowerCase(), a = e.slice(i.length).replace(/(?<!=)\{/g, " {") + " " + a, a = a.trim().replace(/\s+/g, " ");
623
626
  }
624
627
  i ||= "txt";
625
628
  try {
626
- !se(i) && !n.has(i) && (await e.loadLanguage(i), n.add(i));
629
+ !oe(i) && !n.has(i) && (await e.loadLanguage(i), n.add(i));
627
630
  } catch {
628
631
  qe.warn(`\nThe language '${i}' is not loaded, falling back to 'txt' for syntax highlighting.`), i = "txt";
629
632
  }
630
633
  r = r.trimEnd();
631
- let s = oe(r, i, e);
634
+ let s = ae(r, i, e);
632
635
  return await e.loadLanguage(...s), e.codeToHtml(r, {
633
636
  lang: i,
634
637
  transformers: [...t, {
@@ -676,7 +679,7 @@ function Xe() {
676
679
  return {
677
680
  name: "typedown:disable-shell-symbol-select",
678
681
  tokens(e) {
679
- if (He(this.options.lang)) for (let t of e) {
682
+ if (Ue(this.options.lang)) for (let t of e) {
680
683
  if (t.length < 2) continue;
681
684
  let e = t[0].content.trim();
682
685
  (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));
@@ -875,9 +878,9 @@ async function H(e, t = 5) {
875
878
  //#region src/node/context.ts
876
879
  var U = ["typedown.yaml", "typedown.yml"];
877
880
  function W(e) {
878
- let t = new Ke(dt(e));
881
+ let t = new I(dt(e));
879
882
  function n() {
880
- let e = re("warn");
883
+ let e = ne("warn");
881
884
  return {
882
885
  ...e,
883
886
  info(e) {
@@ -931,14 +934,14 @@ function lt(e) {
931
934
  return C.resolve(e);
932
935
  }
933
936
  function ut(e) {
934
- return U.some((t) => D.existsSync(C.join(e, t)));
937
+ return U.some((t) => O.existsSync(C.join(e, t)));
935
938
  }
936
939
  function dt(e) {
937
940
  try {
938
941
  let t = C.join(e, ".typedown", ".local"), n = C.join(t, "logs");
939
- D.mkdirSync(n, { recursive: !0 });
942
+ O.mkdirSync(n, { recursive: !0 });
940
943
  let r = C.join(t, ".gitignore");
941
- D.existsSync(r) || D.writeFileSync(r, "*\n");
944
+ O.existsSync(r) || O.writeFileSync(r, "*\n");
942
945
  let i = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
943
946
  return C.join(n, `${i}.log`);
944
947
  } catch {
@@ -1092,7 +1095,7 @@ var _t = class {
1092
1095
  }, bt = class {
1093
1096
  data;
1094
1097
  scan(e) {
1095
- let t = O("**/*.td", {
1098
+ let t = le("**/*.td", {
1096
1099
  cwd: e,
1097
1100
  exclude: (e) => e.startsWith("_")
1098
1101
  }).map((e) => ({
@@ -1216,7 +1219,7 @@ function Et(e, t) {
1216
1219
  };
1217
1220
  }
1218
1221
  function Dt(e) {
1219
- return O("**/*.td", {
1222
+ return le("**/*.td", {
1220
1223
  cwd: e,
1221
1224
  exclude: (e) => e.startsWith("_")
1222
1225
  }).map((t) => w(e, t));
@@ -1273,11 +1276,11 @@ function Nt(e, t) {
1273
1276
  let a = l(n.url);
1274
1277
  if (a.startsWith("/@") || a.startsWith("/node_modules")) return i();
1275
1278
  let s = a.replace(/^\//, ""), c = w(e.config.root, t.rootDirectory, s);
1276
- if (le(c)) try {
1279
+ if (ce(c)) try {
1277
1280
  let e = de(c);
1278
1281
  if (e.isFile()) {
1279
1282
  let t = Mt[o(c).slice(1).toLowerCase()] ?? "application/octet-stream";
1280
- r.setHeader("Content-Type", t), r.setHeader("Content-Length", e.size), ce(c).pipe(r);
1283
+ r.setHeader("Content-Type", t), r.setHeader("Content-Length", e.size), se(c).pipe(r);
1281
1284
  return;
1282
1285
  }
1283
1286
  } catch {}
@@ -1300,7 +1303,7 @@ function Pt(e, t, n) {
1300
1303
  };
1301
1304
  }
1302
1305
  function Ft(e, t) {
1303
- return e.devHtml === void 0 && (e.devHtml = k({
1306
+ return e.devHtml === void 0 && (e.devHtml = ge({
1304
1307
  title: t.siteTitle,
1305
1308
  description: t.siteDescription,
1306
1309
  base: "/",
@@ -1381,7 +1384,7 @@ function $(t = {}) {
1381
1384
  if (!i) return;
1382
1385
  let r = [e, ...n], a = [];
1383
1386
  for (let e of r) {
1384
- let n = ie(w(i.config.root, t.rootDir, e)), r = i.moduleGraph.getModulesByFile(n);
1387
+ let n = re(w(i.config.root, t.rootDir, e)), r = i.moduleGraph.getModulesByFile(n);
1385
1388
  if (r?.size) {
1386
1389
  for (let e of r) i?.moduleGraph.invalidateModule(e), a.push(zt(e));
1387
1390
  c.invalidatePageData(i, e);
@@ -1432,7 +1435,7 @@ function $(t = {}) {
1432
1435
  async closeBundle() {
1433
1436
  if (!t.context && n) try {
1434
1437
  let e = (await (await n.getTdContext()).getConfig()).basePath, t = e.startsWith(o) ? e.slice(o.length) : e.replace(/^\//, "");
1435
- await M(n, {
1438
+ await j(n, {
1436
1439
  outDir: w(a, t),
1437
1440
  base: e
1438
1441
  });
@@ -1477,4 +1480,4 @@ function Bt(e) {
1477
1480
  }
1478
1481
  }
1479
1482
  //#endregion
1480
- export { M as a, W as i, Q as n, U as r, $ as t };
1483
+ export { j as a, W as i, Q as n, U as r, $ as t };
package/dist/vite.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as e, t } from "./vite-OiCh59kk.js";
1
+ import { n as e, t } from "./vite-oRX7_Z5q.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.32.1",
4
+ "version": "0.32.3",
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.32.1",
74
- "@typerighter/rpc-server": "0.32.1"
73
+ "@typerighter/rpc-server": "0.32.3",
74
+ "@typerighter/rpc-client": "0.32.3"
75
75
  },
76
76
  "devDependencies": {
77
77
  "@hdnax/nuclint": "^0.17.5",