typerighter 0.5.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

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-DZLkaV9-.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-Bf0aLzaG.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 };
@@ -1,4 +1,4 @@
1
- import { T as EXTERNAL_URL_RE, b as isUrlToPage, y as isUrlExternal } from "./brand-C6VJ3Tpf.js";
1
+ import { f as isUrlExternal, p as isUrlToPage, y as EXTERNAL_URL_RE } from "./shared-CpPZZ8IH.js";
2
2
  import path from "node:path";
3
3
  import pc from "picocolors";
4
4
  import { createLogger } from "vite";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as e, t } from "./vite-DPRlAukM.js";
1
+ import { n as e, t } from "./vite-DnP-_NzR.js";
2
2
  import "./vite.js";
3
- import { n, t as r } from "./cli-CAvgSpyx.js";
3
+ import { n, t as r } from "./cli-CDd4TNg1.js";
4
4
  export { n as buildSite, r as cli, t as generateClientAppEntry, e as typedown };
@@ -1,5 +1,6 @@
1
- import { a as e, c as t, i as n } from "./constants-BVW9e5iH.js";
2
- import { l as r, r as i } from "./brand-C6VJ3Tpf.js";
1
+ import { a as e, c as t, i as n } from "./constants-DJbUAb1-.js";
2
+ import "./shared-CpPZZ8IH.js";
3
+ import { o as r, r as i } from "./brand-BfamszbH.js";
3
4
  import a from "node:path";
4
5
  import "node:fs";
5
6
  import o from "node:fs/promises";
@@ -2298,7 +2299,7 @@ function ei(e) {
2298
2299
  build: "typerighter build",
2299
2300
  preview: "typerighter preview"
2300
2301
  },
2301
- devDependencies: { typerighter: "^0.5.1" }
2302
+ devDependencies: { typerighter: "^0.7.0" }
2302
2303
  }, void 0, 2) + "\n";
2303
2304
  }
2304
2305
  function ti() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/build/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACE,KAAK,YAAY,EACzB,MAAM,MAAM,CAAC;AAcd,OAAO,KAAK,EACV,UAAU,EACX,MAAM,YAAY,CAAC;AAIpB,MAAM,WAAW,YAAY;IAC3B,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,UAAU,CAAC,EAAE,YAAY,CAAC;CAC3B;AAGD,wBAAsB,SAAS,CAAE,GAAG,EAAE,UAAU,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA+J3F"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/build/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACE,KAAK,YAAY,EACzB,MAAM,MAAM,CAAC;AAcd,OAAO,KAAK,EACV,UAAU,EACX,MAAM,YAAY,CAAC;AAIpB,MAAM,WAAW,YAAY;IAC3B,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,UAAU,CAAC,EAAE,YAAY,CAAC;CAC3B;AAGD,wBAAsB,SAAS,CAAE,GAAG,EAAE,UAAU,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgK3F"}
@@ -4,10 +4,14 @@ import type { ContentTree } from '@/shared';
4
4
  export interface ClientAppEntryOptions {
5
5
  /** Content directory relative to project root */
6
6
  contentDir: string;
7
+ /** URL base path */
8
+ basePath?: string;
7
9
  /** Site title */
8
10
  siteTitle: string;
9
11
  /** Site description */
10
12
  siteDescription: string;
13
+ /** Repository URL */
14
+ repo?: string;
11
15
  /** Content files as a recursive directory tree */
12
16
  contentTree: ContentTree;
13
17
  /** Schema definitions keyed by schema name */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/node/plugin/vite/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,KAAK,MAAM,EACZ,MAAM,MAAM,CAAC;AAId,OAAO,EACiC,KAAK,UAAU,EACtD,MAAM,eAAe,CAAC;AAuBvB,OAAO,KAAK,EACV,WAAW,EACZ,MAAM,UAAU,CAAC;AAKlB,MAAM,WAAW,qBAAqB;IACpC,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,uBAAuB;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,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,CAgE9E;AAED,wBAAgB,QAAQ,CAAE,OAAO,GAAE,qBAA0B,GAAG,MAAM,EAAE,CAuQvE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/node/plugin/vite/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,KAAK,MAAM,EACZ,MAAM,MAAM,CAAC;AAId,OAAO,EACiC,KAAK,UAAU,EACtD,MAAM,eAAe,CAAC;AAuBvB,OAAO,KAAK,EACV,WAAW,EACZ,MAAM,UAAU,CAAC;AAKlB,MAAM,WAAW,qBAAqB;IACpC,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,oBAAoB;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,uBAAuB;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,qBAAqB;IACrB,IAAI,CAAC,EAAE,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,CAuQvE"}
@@ -1 +1 @@
1
- {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/content.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,cAAc,EAAE,WAAW,EAAE,eAAe,EAAE,gBAAgB,EAC/D,MAAM,kBAAkB,CAAC;AAY1B,wBAAgB,gBAAgB,CAAE,KAAK,EAAE,cAAc,EAAE,GAAG,WAAW,CAqCtE;AAGD,wBAAgB,wBAAwB,CAAE,IAAI,EAAE,eAAe,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAiEtH;AAED,wBAAgB,eAAe,CAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAI5E;AAGD,wBAAgB,kBAAkB,CAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAK7F"}
1
+ {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/content.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,cAAc,EAAE,WAAW,EAAE,eAAe,EAAE,gBAAgB,EAC/D,MAAM,kBAAkB,CAAC;AAY1B,wBAAgB,gBAAgB,CAAE,KAAK,EAAE,cAAc,EAAE,GAAG,WAAW,CAqCtE;AAGD,wBAAgB,wBAAwB,CAAE,IAAI,EAAE,eAAe,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CA6DtH;AAED,wBAAgB,eAAe,CAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAI5E;AAGD,wBAAgB,kBAAkB,CAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAa7F"}
@@ -1,7 +1,8 @@
1
- export declare function isUrlExternal(path: string): boolean;
2
1
  export declare function getDirectoryUrl(urlPrefix: string, name: string): string;
3
2
  export declare function getParentUrl(urlPath: string): string;
4
3
  export declare function getTdContentUrl(filepath: string): string;
5
4
  export declare function isUrlAncestorOf(directoryUrl: string, path: string): boolean;
5
+ export declare function isUrlExternal(path: string): boolean;
6
6
  export declare function isUrlToPage(filename: string): boolean;
7
+ export declare function stripAnchor(url: string): string;
7
8
  //# sourceMappingURL=url.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/url.ts"],"names":[],"mappings":"AAQA,wBAAgB,aAAa,CAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAeD,wBAAgB,eAAe,CAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAExE;AAED,wBAAgB,YAAY,CAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,eAAe,CAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIzD;AAED,wBAAgB,eAAe,CAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAE5E;AAGD,wBAAgB,WAAW,CAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAItD"}
1
+ {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/url.ts"],"names":[],"mappings":"AAoBA,wBAAgB,eAAe,CAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAExE;AAED,wBAAgB,YAAY,CAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,eAAe,CAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIzD;AAED,wBAAgB,eAAe,CAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAE5E;AAGD,wBAAgB,aAAa,CAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAGD,wBAAgB,WAAW,CAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAItD;AAGD,wBAAgB,WAAW,CAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAIhD"}
@@ -53,30 +53,34 @@ function h(e) {
53
53
  }
54
54
  //#endregion
55
55
  //#region src/shared/utils/url.ts
56
- function g(e) {
57
- return a.test(e);
58
- }
59
- var _ = 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(","));
60
- function v(e, t) {
56
+ var g = 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(","));
57
+ function _(e, t) {
61
58
  return `${e}/${t}`;
62
59
  }
63
- function y(e) {
60
+ function v(e) {
64
61
  return l(e.replace(/\/$/, "")) || "/";
65
62
  }
66
- function b(e) {
63
+ function y(e) {
67
64
  let t = d(e);
68
65
  return "/" + p(l(e), t);
69
66
  }
70
- function x(e, t) {
67
+ function b(e, t) {
71
68
  return t.startsWith(e + "/") || t === e;
72
69
  }
70
+ function x(e) {
71
+ return a.test(e);
72
+ }
73
73
  function S(e) {
74
74
  let t = u(e).slice(1);
75
- return t === "" || !_.has(t.toLowerCase());
75
+ return t === "" || !g.has(t.toLowerCase());
76
+ }
77
+ function C(e) {
78
+ let t = e.indexOf("#");
79
+ return 0 <= t ? e.slice(0, t) : e;
76
80
  }
77
81
  //#endregion
78
82
  //#region src/shared/utils/content.ts
79
- function C(e) {
83
+ function w(e) {
80
84
  let t = {
81
85
  name: "",
82
86
  children: [],
@@ -94,106 +98,99 @@ function C(e) {
94
98
  }
95
99
  r.items.push(n);
96
100
  }
97
- return D(t), {
101
+ return O(t), {
98
102
  rootItems: t.items,
99
103
  children: t.children
100
104
  };
101
105
  }
102
- function w(e, t) {
103
- let n = {};
104
- function r(e) {
106
+ function T(t, n) {
107
+ let r = {};
108
+ function i(e) {
105
109
  let t = e.items.length;
106
- for (let n of e.children) t += r(n);
110
+ for (let n of e.children) t += i(n);
107
111
  return t;
108
112
  }
109
- function i(e, t) {
110
- let n = e.items[0] ?? e.children[0]?.items[0];
111
- if (!n) return `${t}/${e.name}`;
112
- let r = b(n.filepath);
113
- return d(n.filepath) === "index" ? r : y(r);
113
+ function a(t, n) {
114
+ let r = t.items.find((t) => d(t.filepath) === e);
115
+ return r ? y(r.filepath) : `${n}/${t.name}/index`;
114
116
  }
115
- function a(e, t) {
116
- for (let o of e) {
117
- let e = t ? `${t}/${o.name}` : `/${o.name}`;
118
- n[e] = {
119
- title: s(o.name),
117
+ function o(e, t) {
118
+ for (let n of e) {
119
+ let e = t ? `${t}/${n.name}` : `/${n.name}`;
120
+ r[e] = {
121
+ title: s(n.name),
120
122
  url: e,
121
- subdirectories: o.children.map((t) => ({
123
+ subdirectories: n.children.map((t) => ({
122
124
  name: s(t.name),
123
- url: i(t, e),
124
- count: r(t)
125
+ url: a(t, e),
126
+ count: i(t)
125
127
  })),
126
- items: o.items.map((e) => ({
127
- name: E(e.header, e.filepath),
128
- url: b(e.filepath)
128
+ items: n.items.map((e) => ({
129
+ name: D(e.header, e.filepath),
130
+ url: y(e.filepath)
129
131
  }))
130
- }, a(o.children, e);
132
+ }, o(n.children, e);
131
133
  }
132
134
  }
133
- return n["/"] = {
134
- title: t,
135
+ return r["/"] = {
136
+ title: n,
135
137
  url: "/",
136
- subdirectories: e.map((e) => ({
138
+ subdirectories: t.map((e) => ({
137
139
  name: s(e.name),
138
- url: i(e, ""),
139
- count: r(e)
140
+ url: a(e, ""),
141
+ count: i(e)
140
142
  })),
141
143
  items: []
142
- }, a(e, ""), n;
144
+ }, o(t, ""), r;
143
145
  }
144
- function T(e, t) {
146
+ function E(e, t) {
145
147
  let n = c(l(e));
146
148
  return n ? s(n) : t;
147
149
  }
148
- function E(e, t) {
149
- return e._label === void 0 ? e.name === void 0 ? s(d(t)) : String(e.name) : String(e._label);
150
+ function D(e, t) {
151
+ if (e._label !== void 0) return String(e._label);
152
+ let n = d(t);
153
+ if (n === "index") {
154
+ let e = c(l(t));
155
+ return e ? s(e) : n;
156
+ }
157
+ return s(n);
150
158
  }
151
- function D(e) {
159
+ function O(e) {
152
160
  e.children.sort((e, t) => {
153
161
  let n = o(e.name), r = o(t.name);
154
162
  return n.order === r.order ? n.rest.localeCompare(r.rest) : n.order - r.order;
155
163
  }), e.items.sort((e, t) => {
156
164
  let n = o(d(e.filepath)), r = o(d(t.filepath));
157
- return n.order === r.order ? E(e.header, e.filepath).localeCompare(E(t.header, t.filepath)) : n.order - r.order;
165
+ return n.order === r.order ? D(e.header, e.filepath).localeCompare(D(t.header, t.filepath)) : n.order - r.order;
158
166
  });
159
- for (let t of e.children) D(t);
160
- }
161
- //#endregion
162
- //#region src/shared/utils/html.ts
163
- function O(e) {
164
- return e.replaceAll("&", "&amp;").replaceAll("\"", "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
165
- }
166
- function k(e) {
167
- return e.replace(/<(style|script)[^>]*>[\s\S]*?<\/\1>/gi, "").replace(/<[^>]*>/g, "").replace(/\s+/g, " ").trim();
167
+ for (let t of e.children) O(t);
168
168
  }
169
169
  //#endregion
170
170
  //#region src/shared/utils/time.ts
171
- var A = 60, j = 60 * A, M = 24 * j, N = 7 * M, P = 30 * M, F = 365 * M, I = 2 * N;
172
- function L(e) {
171
+ var k = 60, A = 60 * k, j = 24 * A, M = 7 * j, N = 30 * j, P = 365 * j, F = 2 * M;
172
+ function I(e) {
173
173
  return (/* @__PURE__ */ new Date(e * 1e3)).toLocaleDateString("en-US", {
174
174
  year: "numeric",
175
175
  month: "short",
176
176
  day: "numeric"
177
177
  });
178
178
  }
179
- function R(e, t) {
180
- return Math.floor(Date.now() / 1e3) - e < I ? `${t} ${z(e)}` : `${t} at ${L(e)}`;
179
+ function L(e, t) {
180
+ return Math.floor(Date.now() / 1e3) - e < F ? `${t} ${R(e)}` : `${t} at ${I(e)}`;
181
181
  }
182
- function z(e) {
182
+ function R(e) {
183
183
  let t = Math.floor(Date.now() / 1e3) - e;
184
- return t < A ? "just now" : t < j ? `${Math.floor(t / A)}m ago` : t < M ? `${Math.floor(t / j)}h ago` : t < N ? `${Math.floor(t / M)}d ago` : t < P ? `${Math.floor(t / N)}w ago` : t < F ? `${Math.floor(t / P)}mo ago` : `${Math.floor(t / F)}y ago`;
184
+ return t < k ? "just now" : t < A ? `${Math.floor(t / k)}m ago` : t < j ? `${Math.floor(t / A)}h ago` : t < M ? `${Math.floor(t / j)}d ago` : t < N ? `${Math.floor(t / M)}w ago` : t < P ? `${Math.floor(t / N)}mo ago` : `${Math.floor(t / P)}y ago`;
185
185
  }
186
- var B = new Intl.DateTimeFormat("en-US", {
186
+ var z = new Intl.DateTimeFormat("en-US", {
187
187
  year: "numeric",
188
188
  month: "short",
189
189
  day: "numeric"
190
190
  });
191
- function V(e) {
191
+ function B(e) {
192
192
  let t = new Date(e);
193
- return Number.isNaN(t.getTime()) ? e : B.format(t);
193
+ return Number.isNaN(t.getTime()) ? e : z.format(t);
194
194
  }
195
195
  //#endregion
196
- //#region src/shared/brand.ts
197
- var H = "m15 10c-2.7614 0-5 2.2386-5 5v98c0 2.761 2.2386 5 5 5h178c2.761 0 5-2.239 5-5v-98c0-2.7614-2.239-5-5-5zm-15 5c0-8.28427 6.71573-15 15-15h178c8.284 0 15 6.71573 15 15v98c0 8.284-6.716 15-15 15h-178c-8.28427 0-15-6.716-15-15z", U = "M30 30h70v16h-27v52h-16v-52h-27z", W = "m155 98-30-33h20v-35h20v35h20z", G = "0 0 208 128", K = "#a0522d", q = `<svg fill='none' viewBox='${G}' xmlns='http://www.w3.org/2000/svg'><path clip-rule='evenodd' d='${H}' fill-rule='evenodd' fill='${K}'/><path d='${U}' fill='${K}'/><path d='${W}' fill='${K}'/></svg>`, J = `data:image/svg+xml,${encodeURIComponent(q)}`;
198
- //#endregion
199
- export { i as A, m as C, n as D, t as E, e as O, f as S, a as T, b as _, G as a, S as b, z as c, C as d, w as f, y as g, v as h, U as i, r as k, O as l, E as m, H as n, V as o, T as p, J as r, R as s, W as t, k as u, x as v, s as w, d as x, g as y };
196
+ export { r as C, e as S, m as _, T as a, t as b, _ as c, b as d, x as f, f as g, d as h, w as i, v as l, C as m, L as n, E as o, S as p, R as r, D as s, B as t, y as u, s as v, i as w, n as x, a as y };