typerighter 0.11.5 → 0.12.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/client.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as e, c as t, i as n, l as r, o as i, t as a, u as o } from "./app-C35j_dTB.js";
1
+ import { a as e, c as t, i as n, l as r, o as i, t as a, u as o } from "./app-5DaKZ6wW.js";
2
2
  export { t as Content, a as createTypedownApp, r as useRoute, o as useRouter, n as useSiteConfig, e as useSiteData, i as useTdContent };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as e, t } from "./vite-ofOi3oqG.js";
1
+ import { n as e, t } from "./vite-BqxagMts.js";
2
2
  import "./vite.js";
3
- import { n, t as r } from "./cli-kT3xfgwK.js";
3
+ import { n, t as r } from "./cli-Be6DoesE.js";
4
4
  export { n as buildSite, r as cli, t as generateClientAppEntry, e as typedown };
@@ -1,5 +1,5 @@
1
- import { V as e, s as t } from "./shared-xivlz-gA.js";
2
- import { i as n, r } from "./vite-ofOi3oqG.js";
1
+ import { H as e, s as t } from "./shared-D_aJCGWs.js";
2
+ import { i as n, r } from "./vite-BqxagMts.js";
3
3
  import { a as i, i as a, n as o, r as s, t as c } from "./brand-CG1fQshq.js";
4
4
  import "node:fs";
5
5
  import l from "node:path";
@@ -2303,7 +2303,7 @@ function ai(e) {
2303
2303
  build: "typerighter build",
2304
2304
  preview: "typerighter preview"
2305
2305
  },
2306
- devDependencies: { typerighter: "^0.11.5" }
2306
+ devDependencies: { typerighter: "^0.12.1" }
2307
2307
  }, void 0, 2) + "\n";
2308
2308
  }
2309
2309
  function oi() {
@@ -2318,8 +2318,7 @@ function ci() {
2318
2318
  function li(e) {
2319
2319
  return `version: "1.0.0"
2320
2320
  vault:
2321
- content_dir: vault/content
2322
- schema_dir: vault/schemas
2321
+ root_dir: "vault"
2323
2322
  site:
2324
2323
  title: "${e.siteTitle}"
2325
2324
  description: "${e.siteDescription}"
@@ -2338,7 +2337,7 @@ async function di(e, t) {
2338
2337
  return br(n) && (qr("Cancelled."), process.exit(0)), n;
2339
2338
  }
2340
2339
  async function fi(e, t) {
2341
- let n = l.join(e, "vault", "content"), r = l.join(e, "vault", "schemas"), i = l.join(e, "public"), a = l.join(e, ".typedown", ".local");
2340
+ let n = l.join(e, "vault"), r = l.join(e, "vault", "_types"), i = l.join(e, "public"), a = l.join(e, ".typedown", ".local");
2342
2341
  await Promise.all([
2343
2342
  u.mkdir(n, { recursive: !0 }),
2344
2343
  u.mkdir(r, { recursive: !0 }),
@@ -19,7 +19,6 @@ export declare class TypedownContext {
19
19
  listFiles(): Promise<string[]>;
20
20
  listFilesGroupedBySchema(): Promise<SchemaGroups>;
21
21
  getConfig(): Promise<TdSiteConfig>;
22
- getAssetDir(filepath: string): Promise<string>;
23
22
  getSchema(schema: string): Promise<TdSchemaInfo>;
24
23
  listSchemas(): Promise<string[]>;
25
24
  checkVault(): Promise<TdDiagnosticReport>;
@@ -1 +1 @@
1
- {"version":3,"file":"typedown-context.d.ts","sourceRoot":"","sources":["../../../src/node/lib/typedown-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EAAE,kBAAkB,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAChF,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACmB,KAAK,gBAAgB,EAC9C,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EACV,YAAY,EACb,MAAM,UAAU,CAAC;AAIlB,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,GAAG,CAAmB;gBAEjB,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,gBAAgB;IAMpD,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,0BAA0B,CAA2B;IAC7D,OAAO,CAAC,aAAa,CAAu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EAAE,gBAAgB;IAMpD,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,0BAA0B,CAA2B;IAC7D,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,eAAe,CAAmC;IAC1D,OAAO,CAAC,aAAa,CAAsC;IAE3D,OAAO,CAAC,aAAa,CAAK;IAE1B,OAAO,CAAC,4BAA4B;IA8DpC,IAAI,GAAG,IAAK,SAAS,CAEpB;IAIK,OAAO,CAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAIpD,QAAQ,CAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAatD,SAAS,IAAK,OAAO,CAAC,MAAM,EAAE,CAAC;IAQ/B,wBAAwB,IAAK,OAAO,CAAC,YAAY,CAAC;IAgBlD,SAAS,IAAK,OAAO,CAAC,YAAY,CAAC;IAQnC,SAAS,CAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAYjD,WAAW,IAAK,OAAO,CAAC,MAAM,EAAE,CAAC;IAQjC,UAAU,IAAK,OAAO,CAAC,kBAAkB,CAAC;IAI1C,UAAU,CAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAI5D,IAAI,EAAE,IAAK,gBAAgB,CAE1B;CACF"}
@@ -2,8 +2,8 @@ import { type Plugin } from 'vite';
2
2
  import { type AppContext } from '../../context';
3
3
  import type { ContentTree } from '@/shared';
4
4
  export interface ClientAppEntryOptions {
5
- /** Content directory relative to project root */
6
- contentDir: string;
5
+ /** Vault root directory relative to project root */
6
+ rootDir?: string;
7
7
  /** URL base path */
8
8
  basePath?: string;
9
9
  /** Site title */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/node/plugin/vite/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAEL,KAAK,MAAM,EAC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E,MAAM,CAAC;IACd,kDAAkD;IAClD,WAAW,EAAE,WAAW,CAAC;IACzB,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAGD,MAAM,WAAW,qBAAqB;IAEpC,OAAO,CAAC,EAAE,UAAU,CAAC;CACtB;AAED,wBAAgB,sBAAsB,CAAE,OAAO,EAAE,qBAAqB,GAAG,MAAM,CAoE9E;AAED,wBAAgB,QAAQ,CAAE,OAAO,GAAE,qBAA0B,GAAG,MAAM,EAAE,CAiVvE"}
@@ -3,6 +3,7 @@ export declare function dirname(filepath: string): string;
3
3
  export declare function extname(filepath: string): string;
4
4
  export declare function filestem(filepath: string): string;
5
5
  export declare function isContentFile(filepath: string): boolean;
6
+ export declare function isTypeFile(filepath: string): boolean;
6
7
  export declare function join(...segments: string[]): string;
7
8
  export declare function stripExtension(filepath: string): string;
8
9
  //# sourceMappingURL=path.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/path.ts"],"names":[],"mappings":"AAOA,wBAAgB,QAAQ,CAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAStE;AAED,wBAAgB,OAAO,CAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAMjD;AAED,wBAAgB,OAAO,CAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKjD;AAED,wBAAgB,QAAQ,CAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKlD;AAED,wBAAgB,aAAa,CAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,wBAAgB,IAAI,CAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAOnD;AAED,wBAAgB,cAAc,CAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIxD"}
1
+ {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/path.ts"],"names":[],"mappings":"AAOA,wBAAgB,QAAQ,CAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAStE;AAED,wBAAgB,OAAO,CAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAMjD;AAED,wBAAgB,OAAO,CAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKjD;AAED,wBAAgB,QAAQ,CAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKlD;AAED,wBAAgB,aAAa,CAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAExD;AAGD,wBAAgB,UAAU,CAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAErD;AAED,wBAAgB,IAAI,CAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAOnD;AAED,wBAAgB,cAAc,CAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIxD"}
@@ -19,10 +19,10 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
19
19
  "title",
20
20
  "titles",
21
21
  "text"
22
- ], m = ["title", "titles"], h = /^[a-z]+:/i;
22
+ ], ee = ["title", "titles"], m = /^[a-z]+:/i;
23
23
  //#endregion
24
24
  //#region src/shared/utils/format.ts
25
- function g(e) {
25
+ function h(e) {
26
26
  let t = e.match(/^(\d+)[-_](.+)$/);
27
27
  return t ? {
28
28
  order: Number(t[1]),
@@ -32,45 +32,49 @@ function g(e) {
32
32
  rest: e
33
33
  };
34
34
  }
35
- function _(e) {
36
- let { rest: t } = g(e), n = t.replace(/[-_]/g, " ").split(" ");
35
+ function g(e) {
36
+ let { rest: t } = h(e), n = t.replace(/[-_]/g, " ").split(" ");
37
37
  return 0 < n.length && (n[0] = n[0].charAt(0).toUpperCase() + n[0].slice(1)), n.join(" ");
38
38
  }
39
39
  //#endregion
40
40
  //#region src/shared/utils/path.ts
41
- var v = /* @__PURE__ */ s({
42
- basename: () => y,
43
- dirname: () => b,
44
- extname: () => x,
45
- filestem: () => S,
46
- isContentFile: () => C,
41
+ var _ = /* @__PURE__ */ s({
42
+ basename: () => v,
43
+ dirname: () => y,
44
+ extname: () => b,
45
+ filestem: () => x,
46
+ isContentFile: () => S,
47
+ isTypeFile: () => C,
47
48
  join: () => w,
48
49
  stripExtension: () => T
49
50
  });
50
- function y(e, t) {
51
+ function v(e, t) {
51
52
  let n = E(e).split("/").pop() ?? "";
52
53
  return t !== void 0 && n.endsWith(t) ? n.slice(0, -t.length) : n;
53
54
  }
54
- function b(e) {
55
+ function y(e) {
55
56
  let t = E(e).split("/");
56
57
  return t.pop(), t.join("/");
57
58
  }
58
- function x(e) {
59
- let t = y(e), n = t.lastIndexOf(".");
59
+ function b(e) {
60
+ let t = v(e), n = t.lastIndexOf(".");
60
61
  return n <= 0 ? "" : t.slice(n);
61
62
  }
62
- function S(e) {
63
- let t = y(e), n = t.lastIndexOf(".");
63
+ function x(e) {
64
+ let t = v(e), n = t.lastIndexOf(".");
64
65
  return n <= 0 ? t : t.slice(0, n);
65
66
  }
67
+ function S(e) {
68
+ return d.includes(b(e));
69
+ }
66
70
  function C(e) {
67
- return d.includes(x(e));
71
+ return S(e) && e.split("/").includes("_types");
68
72
  }
69
73
  function w(...e) {
70
74
  return e.filter(Boolean).join("/").replace(/\\+/g, "/").replace(/\/+/g, "/").replace(/\/$/, "") || "/";
71
75
  }
72
76
  function T(e) {
73
- let t = x(e);
77
+ let t = b(e);
74
78
  return t ? e.slice(0, -t.length) : e;
75
79
  }
76
80
  function E(e) {
@@ -78,40 +82,40 @@ function E(e) {
78
82
  }
79
83
  //#endregion
80
84
  //#region src/shared/utils/url.ts
81
- var ee = new Set("3g2,3gp,aac,ai,apng,au,avif,bin,bmp,cer,class,conf,crl,css,csv,dll,doc,eps,epub,exe,gif,gz,ics,ief,jar,jpe,jpeg,jpg,js,json,jsonld,m4a,man,mid,midi,mjs,mov,mp2,mp3,mp4,mpe,mpeg,mpg,mpp,oga,ogg,ogv,ogx,opus,otf,p10,p7c,p7m,p7s,pdf,png,ps,qt,roff,rtf,rtx,ser,svg,t,tif,tiff,tr,ts,tsv,ttf,txt,vtt,wav,weba,webm,webp,woff,woff2,xhtml,xml,yaml,yml,zip".split(","));
82
- function D(e) {
83
- return M(e) ? A(e) : e;
85
+ var D = new Set("3g2,3gp,aac,ai,apng,au,avif,bin,bmp,cer,class,conf,crl,css,csv,dll,doc,eps,epub,exe,gif,gz,ics,ief,jar,jpe,jpeg,jpg,js,json,jsonld,m4a,man,mid,midi,mjs,mov,mp2,mp3,mp4,mpe,mpeg,mpg,mpp,oga,ogg,ogv,ogx,opus,otf,p10,p7c,p7m,p7s,pdf,png,ps,qt,roff,rtf,rtx,ser,svg,t,tif,tiff,tr,ts,tsv,ttf,txt,vtt,wav,weba,webm,webp,woff,woff2,xhtml,xml,yaml,yml,zip".split(","));
86
+ function O(e) {
87
+ return N(e) ? j(e) : e;
84
88
  }
85
- function O(e, t) {
89
+ function k(e, t) {
86
90
  return `${e}/${t}`;
87
91
  }
88
- function k(e) {
89
- return e === "/" ? "/index" : e + "/index";
90
- }
91
92
  function A(e) {
92
- return b(P(e)) || "/";
93
+ return e === "/" ? "/index" : e + "/index";
93
94
  }
94
95
  function j(e) {
95
- let t = S(e);
96
- return "/" + w(b(e), t);
96
+ return y(P(e)) || "/";
97
97
  }
98
98
  function M(e) {
99
+ let t = x(e);
100
+ return "/" + w(y(e), t);
101
+ }
102
+ function N(e) {
99
103
  return e === "/index" || e.endsWith("/index");
100
104
  }
101
- function N(e, t) {
105
+ function te(e, t) {
102
106
  return t.startsWith(e + "/") || t === e;
103
107
  }
104
- function te(e) {
105
- return h.test(e);
106
- }
107
108
  function ne(e) {
108
- let t = x(e).slice(1);
109
- return t === "" || !ee.has(t.toLowerCase());
109
+ return m.test(e);
110
110
  }
111
111
  function re(e) {
112
- return e === "/" ? "/index" : e;
112
+ let t = b(e).slice(1);
113
+ return t === "" || !D.has(t.toLowerCase());
113
114
  }
114
115
  function ie(e) {
116
+ return e === "/" ? "/index" : e;
117
+ }
118
+ function ae(e) {
115
119
  let t = e.indexOf("#");
116
120
  return 0 <= t ? e.slice(0, t) : e;
117
121
  }
@@ -151,23 +155,23 @@ function I(e, t) {
151
155
  return t;
152
156
  }
153
157
  function i(e, t) {
154
- let n = e.items.find((e) => S(e.filepath) === u);
155
- return n ? j(n.filepath) : k(`${t}/${e.name}`);
158
+ let n = e.items.find((e) => x(e.filepath) === u);
159
+ return n ? M(n.filepath) : A(`${t}/${e.name}`);
156
160
  }
157
161
  function a(e, t) {
158
162
  for (let o of e) {
159
163
  let e = t ? `${t}/${o.name}` : `/${o.name}`;
160
164
  n[e] = {
161
- title: _(o.name),
165
+ title: g(o.name),
162
166
  url: e,
163
167
  subdirectories: o.children.map((t) => ({
164
- name: _(t.name),
168
+ name: g(t.name),
165
169
  url: i(t, e),
166
170
  count: r(t)
167
171
  })),
168
172
  items: o.items.map((e) => ({
169
173
  name: R(e.header, e.filepath),
170
- url: j(e.filepath)
174
+ url: M(e.filepath)
171
175
  }))
172
176
  }, a(o.children, e);
173
177
  }
@@ -176,7 +180,7 @@ function I(e, t) {
176
180
  title: t,
177
181
  url: "/",
178
182
  subdirectories: e.map((e) => ({
179
- name: _(e.name),
183
+ name: g(e.name),
180
184
  url: i(e, ""),
181
185
  count: r(e)
182
186
  })),
@@ -184,24 +188,24 @@ function I(e, t) {
184
188
  }, a(e, ""), n;
185
189
  }
186
190
  function L(e, t) {
187
- let n = y(b(e));
188
- return n ? _(n) : t;
191
+ let n = v(y(e));
192
+ return n ? g(n) : t;
189
193
  }
190
194
  function R(e, t) {
191
195
  if (e._label !== void 0) return String(e._label);
192
- let n = S(t);
196
+ let n = x(t);
193
197
  if (n === "index") {
194
- let e = y(b(t));
195
- return e ? _(e) : n;
198
+ let e = v(y(t));
199
+ return e ? g(e) : n;
196
200
  }
197
- return _(n);
201
+ return g(n);
198
202
  }
199
203
  function z(e) {
200
204
  e.children.sort((e, t) => {
201
- let n = g(e.name), r = g(t.name);
205
+ let n = h(e.name), r = h(t.name);
202
206
  return n.order === r.order ? n.rest.localeCompare(r.rest) : n.order - r.order;
203
207
  }), e.items.sort((e, t) => {
204
- let n = g(S(e.filepath)), r = g(S(t.filepath));
208
+ let n = h(x(e.filepath)), r = h(x(t.filepath));
205
209
  return n.order === r.order ? R(e.header, e.filepath).localeCompare(R(t.header, t.filepath)) : n.order - r.order;
206
210
  });
207
211
  for (let t of e.children) z(t);
@@ -242,24 +246,24 @@ function Q(e) {
242
246
  day: "numeric"
243
247
  });
244
248
  }
245
- function ae(e, t) {
249
+ function oe(e, t) {
246
250
  return Math.floor(Date.now() / 1e3) - e < Z ? `${t} ${$(e)}` : `${t} at ${Q(e)}`;
247
251
  }
248
252
  function $(e) {
249
253
  let t = Math.floor(Date.now() / 1e3) - e;
250
254
  return t < G ? "just now" : t < K ? `${Math.floor(t / G)}m ago` : t < q ? `${Math.floor(t / K)}h ago` : t < J ? `${Math.floor(t / q)}d ago` : t < Y ? `${Math.floor(t / J)}w ago` : t < X ? `${Math.floor(t / Y)}mo ago` : `${Math.floor(t / X)}y ago`;
251
255
  }
252
- var oe = new Intl.DateTimeFormat("en-US", {
256
+ var se = new Intl.DateTimeFormat("en-US", {
253
257
  year: "numeric",
254
258
  month: "short",
255
259
  day: "numeric"
256
260
  });
257
- function se(e) {
261
+ function ce(e) {
258
262
  let t = new Date(e);
259
- return Number.isNaN(t.getTime()) ? e : oe.format(t);
263
+ return Number.isNaN(t.getTime()) ? e : se.format(t);
260
264
  }
261
- function ce(e) {
265
+ function le(e) {
262
266
  return Math.floor(Date.now() / 1e3) - e < Z ? $(e) : Q(e);
263
267
  }
264
268
  //#endregion
265
- export { C as A, m as B, ne as C, y as D, P as E, h as F, l as H, d as I, f as L, T as M, g as N, x as O, _ as P, u as R, te as S, ie as T, o as V, k as _, ce as a, M as b, U as c, F as d, I as f, O as g, D as h, $ as i, v as j, S as k, V as l, R as m, se as n, W as o, L as p, ae as r, H as s, Q as t, B as u, A as v, re as w, N as x, j as y, p as z };
269
+ export { S as A, p as B, re as C, v as D, P as E, g as F, o as H, m as I, d as L, _ as M, T as N, b as O, h as P, f as R, ne as S, ae as T, l as U, ee as V, A as _, le as a, N as b, U as c, F as d, I as f, k as g, O as h, $ as i, C as j, x as k, V as l, R as m, ce as n, W as o, L as p, oe as r, H as s, Q as t, B as u, j as v, ie as w, te as x, M as y, u as z };
package/dist/shared.js CHANGED
@@ -1,2 +1,2 @@
1
- import { B as e, C as t, E as n, F as r, I as i, L as a, N as o, P as s, R as c, S as l, T as u, _ as d, a as f, b as p, c as m, d as h, f as g, g as _, h as v, i as y, j as b, l as x, m as S, n as C, o as w, p as T, r as E, s as D, t as O, u as k, v as A, w as j, x as M, y as N, z as P } from "./shared-xivlz-gA.js";
2
- export { i as CONTENT_EXTENSIONS, a as CONTENT_GLOB, r as EXTERNAL_URL_RE, c as INDEX_FILENAME, P as SEARCH_FIELDS, e as SEARCH_STORE_FIELDS, h as buildContentTree, g as buildDirectoryListingMap, k as debounce, D as escapeHtml, w as escapeRegex, O as formatAbsoluteTime, C as formatDateString, E as formatEditTime, y as formatRelativeTime, f as formatTime, v as getDirectoryFromPageUrl, _ as getDirectoryUrl, d as getIndexUrl, A as getParentUrl, N as getTdContentUrl, T as getTdIndexTitle, S as getTdResourceTitle, x as isBuiltinField, p as isIndexUrl, M as isUrlAncestorOf, l as isUrlExternal, t as isUrlToPage, o as parseNumericPrefix, b as path, j as resolveRootUrl, u as stripAnchor, m as stripHtml, n as stripTrailingSlash, s as unslugify };
1
+ import { B as e, C as t, E as n, F as r, I as i, L as a, M as o, P as s, R as c, S as l, T as u, V as d, _ as f, a as p, b as m, c as h, d as g, f as _, g as v, h as y, i as b, l as x, m as S, n as C, o as w, p as T, r as E, s as D, t as O, u as k, v as A, w as j, x as M, y as N, z as P } from "./shared-D_aJCGWs.js";
2
+ export { a as CONTENT_EXTENSIONS, c as CONTENT_GLOB, i as EXTERNAL_URL_RE, P as INDEX_FILENAME, e as SEARCH_FIELDS, d as SEARCH_STORE_FIELDS, g as buildContentTree, _ as buildDirectoryListingMap, k as debounce, D as escapeHtml, w as escapeRegex, O as formatAbsoluteTime, C as formatDateString, E as formatEditTime, b as formatRelativeTime, p as formatTime, y as getDirectoryFromPageUrl, v as getDirectoryUrl, f as getIndexUrl, A as getParentUrl, N as getTdContentUrl, T as getTdIndexTitle, S as getTdResourceTitle, x as isBuiltinField, m as isIndexUrl, M as isUrlAncestorOf, l as isUrlExternal, t as isUrlToPage, s as parseNumericPrefix, o as path, j as resolveRootUrl, u as stripAnchor, h as stripHtml, n as stripTrailingSlash, r as unslugify };
@@ -1,4 +1,4 @@
1
- import { A as isContentFile, B as SEARCH_STORE_FIELDS, C as isUrlToPage, F as EXTERNAL_URL_RE, H as __toESM, I as CONTENT_EXTENSIONS, O as extname, R as INDEX_FILENAME, S as isUrlExternal, V as __commonJSMin, c as stripHtml, d as buildContentTree, f as buildDirectoryListingMap, k as filestem, m as getTdResourceTitle, p as getTdIndexTitle, s as escapeHtml$2, y as getTdContentUrl, z as SEARCH_FIELDS } from "./shared-xivlz-gA.js";
1
+ import { A as isContentFile, B as SEARCH_FIELDS, C as isUrlToPage, H as __commonJSMin, I as EXTERNAL_URL_RE, L as CONTENT_EXTENSIONS, O as extname, S as isUrlExternal, U as __toESM, V as SEARCH_STORE_FIELDS, c as stripHtml, d as buildContentTree, f as buildDirectoryListingMap, j as isTypeFile, k as filestem, m as getTdResourceTitle, p as getTdIndexTitle, s as escapeHtml$2, y as getTdContentUrl, z as INDEX_FILENAME } from "./shared-D_aJCGWs.js";
2
2
  import { i as renderToString, n as ParseError, t as MiniSearch } from "./es-CG8rP6j5.js";
3
3
  import fs, { createReadStream, existsSync, statSync } from "node:fs";
4
4
  import path, { resolve } from "node:path";
@@ -10306,10 +10306,6 @@ var TypedownContext = class {
10306
10306
  async getConfig() {
10307
10307
  return this.cachedConfig ||= await this.rpc.getConfig(), this.cachedConfig;
10308
10308
  }
10309
- async getAssetDir(A) {
10310
- let j = await this.getConfig();
10311
- return path.join(path.dirname(A), j.assetsDir.path);
10312
- }
10313
10309
  async getSchema(A) {
10314
10310
  let j = this.cachedSchemaMap.get(A);
10315
10311
  if (j) return j;
@@ -10490,7 +10486,7 @@ var COMMON_MIME_TYPES = {
10490
10486
  ttf: "font/ttf"
10491
10487
  };
10492
10488
  function generateClientAppEntry(A) {
10493
- let { contentDir: j } = A, M = `/${j}/**/*.{td,md}`, N = JSON.stringify({
10489
+ let { rootDir: j = "." } = A, M = j === "." ? "/**/*.{td,md}" : `/${j}/**/*.{td,md}`, N = JSON.stringify({
10494
10490
  title: A.siteTitle,
10495
10491
  description: A.siteDescription,
10496
10492
  basePath: A.basePath ?? "/",
@@ -10570,12 +10566,9 @@ function typedown(A = {}) {
10570
10566
  };
10571
10567
  },
10572
10568
  async buildStart() {
10569
+ if (M) return;
10573
10570
  let A = await (await F()).checkVault();
10574
- if (0 < A.errorCount || 0 < A.warningCount) for (let j of A.diagnostics) {
10575
- let A = `${j.filepath}:${j.line}:${j.column}`, M = j.severity === "error" ? pc.red("error") : pc.yellow("warn");
10576
- console.error(` ${M} ${A} ${j.message} ${pc.dim(`(${j.code})`)}`);
10577
- }
10578
- if (!M && 0 < A.errorCount) {
10571
+ if (printDiagnostics(A.diagnostics), 0 < A.errorCount) {
10579
10572
  let j = A.diagnostics.filter((A) => A.severity === "error").map((A) => ` ${A.filepath}:${A.line}:${A.column} - ${A.message} (${A.code})`);
10580
10573
  this.error(`Vault check failed with ${A.errorCount} error(s):\n${j.join("\n")}`);
10581
10574
  }
@@ -10594,6 +10587,7 @@ function typedown(A = {}) {
10594
10587
  ]), R = await Promise.all(L.map(async (A) => [A, (await j.getSchema(A)).properties])), z = Object.fromEntries(R), B = buildContentTree(Object.values(I).flat());
10595
10588
  return generateClientAppEntry({
10596
10589
  ...M,
10590
+ rootDir: M.rootDir,
10597
10591
  contentTree: B,
10598
10592
  schemas: z
10599
10593
  });
@@ -10601,12 +10595,14 @@ function typedown(A = {}) {
10601
10595
  async configureServer(A) {
10602
10596
  M = A;
10603
10597
  let j = await F();
10604
- j.rpc.onConfigChanged(() => M && hmrFullReload(M)), j.rpc.onContentChanged(({ content: A }) => {
10598
+ A.httpServer?.once("listening", async () => {
10599
+ printDiagnostics((await j.checkVault()).diagnostics);
10600
+ }), j.rpc.onConfigChanged(() => M && hmrFullReload(M)), j.rpc.onContentChanged(({ content: A }) => {
10605
10601
  M && (getPageIndexInput(j, A).then((A) => {
10606
10602
  A && M && (N.addPage(A), invalidateSearchIndex(M));
10607
10603
  }).catch(() => {}), j.getConfig().then((j) => {
10608
10604
  if (!M) return;
10609
- let N = normalizePath(resolve(M.config.root, j.contentDir, A)), P = M.moduleGraph.getModulesByFile(N);
10605
+ let N = normalizePath(resolve(M.config.root, j.rootDir, A)), P = M.moduleGraph.getModulesByFile(N);
10610
10606
  if (!P?.size) return;
10611
10607
  let F = [...P].map((A) => (M?.moduleGraph.invalidateModule(A), makeHmrUpdate(A)));
10612
10608
  M.hot.send({
@@ -10621,9 +10617,9 @@ function typedown(A = {}) {
10621
10617
  }), hmrInvalidateAll(M));
10622
10618
  }
10623
10619
  j.rpc.onContentCreated(I), j.rpc.onContentDeleted(I), j.rpc.onSchemaChanged(() => M && hmrInvalidateAll(M)), j.rpc.onSchemaCreated(() => M && hmrInvalidateAll(M)), j.rpc.onSchemaDeleted(() => M && hmrInvalidateAll(M));
10624
- let L = "vault/content";
10620
+ let L = "vault";
10625
10621
  return j.getConfig().then((A) => {
10626
- L = A.contentDir;
10622
+ L = A.rootDir;
10627
10623
  }).catch(() => {}), A.middlewares.use((A, j, N) => {
10628
10624
  if (!A.url || A.method !== "GET" || j.writableEnded || !M) return N();
10629
10625
  let P = A.url.split("?")[0].split("#")[0];
@@ -10672,11 +10668,21 @@ function typedown(A = {}) {
10672
10668
  async transform(A, j) {
10673
10669
  let M = j.split("?")[0];
10674
10670
  if (!isContentFile(M)) return;
10675
- let N = await F(), P = (await N.getConfig()).contentDir, I = M.includes(P) ? M.slice(M.indexOf(P) + P.length + 1) : M, { vueSrc: L } = await renderToVueSfc(N, await N.getFile(I), I);
10676
- return {
10677
- code: L,
10671
+ if (isTypeFile(M)) return {
10672
+ code: "<script>import { TdNotFound } from 'typerighter/client/theme-default'; export default TdNotFound; export const __pageData = { frontmatter: {}, headings: [], title: '' };<\/script>",
10678
10673
  map: null
10679
10674
  };
10675
+ let N = await F(), P = (await N.getConfig()).rootDir, I = M.includes(P) ? M.slice(M.indexOf(P) + P.length + 1) : M;
10676
+ try {
10677
+ let { vueSrc: A } = await renderToVueSfc(N, await N.getFile(I), I);
10678
+ return {
10679
+ code: A,
10680
+ map: null
10681
+ };
10682
+ } catch (A) {
10683
+ let j = A instanceof Error ? A.message : String(A);
10684
+ this.error(`[typedown] Failed to transform ${I}: ${j}`);
10685
+ }
10680
10686
  },
10681
10687
  handleHotUpdate({ file: A }) {
10682
10688
  if (isContentFile(A)) return [];
@@ -10735,5 +10741,11 @@ function makeHmrUpdate(A) {
10735
10741
  timestamp: Date.now()
10736
10742
  };
10737
10743
  }
10744
+ function printDiagnostics(A) {
10745
+ for (let j of A) {
10746
+ let A = `${j.filepath}:${j.line}:${j.column}`, M = j.severity === "error" ? pc.red("error") : pc.yellow("warn");
10747
+ console.error(` ${M} ${A} ${j.message} ${pc.dim(`(${j.code})`)}`);
10748
+ }
10749
+ }
10738
10750
  //#endregion
10739
10751
  export { createAppContext as a, CONFIG_FILE_NAMES as i, typedown as n, VIRTUAL_APP_ID as r, generateClientAppEntry as t };
package/dist/vite.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as e, t } from "./vite-ofOi3oqG.js";
1
+ import { n as e, t } from "./vite-BqxagMts.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.11.5",
4
+ "version": "0.12.1",
5
5
  "description": "Typedown: A typed content framework.",
6
6
  "repository": {
7
7
  "type": "git",
@@ -85,8 +85,8 @@
85
85
  "tailwindcss": "^4.3.3",
86
86
  "vite": "^6.0.0 || ^7.0.0 || ^8.0.0",
87
87
  "vue": "^3.0.0",
88
- "@typerighter/rpc-client": "0.11.5",
89
- "@typerighter/rpc-server": "0.11.5"
88
+ "@typerighter/rpc-client": "0.12.1",
89
+ "@typerighter/rpc-server": "0.12.1"
90
90
  },
91
91
  "devDependencies": {
92
92
  "@hdnax/nuclint": "^0.17.4",