typerighter 0.5.1 → 0.6.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-BZKg-fe3.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-BoWAaUci.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-BrwFwz0T.js";
2
2
  import "./vite.js";
3
- import { n, t as r } from "./cli-CAvgSpyx.js";
3
+ import { n, t as r } from "./cli-D5-gYw26.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-Dq357AVO.js";
2
+ import "./shared-BoWAaUci.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.6.0" }
2302
2303
  }, void 0, 2) + "\n";
2303
2304
  }
2304
2305
  function ti() {
@@ -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,12 +98,12 @@ 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) {
106
+ function T(e, t) {
103
107
  let n = {};
104
108
  function r(e) {
105
109
  let t = e.items.length;
@@ -109,8 +113,8 @@ function w(e, t) {
109
113
  function i(e, t) {
110
114
  let n = e.items[0] ?? e.children[0]?.items[0];
111
115
  if (!n) return `${t}/${e.name}`;
112
- let r = b(n.filepath);
113
- return d(n.filepath) === "index" ? r : y(r);
116
+ let r = y(n.filepath);
117
+ return d(n.filepath) === "index" ? r : v(r);
114
118
  }
115
119
  function a(e, t) {
116
120
  for (let o of e) {
@@ -124,8 +128,8 @@ function w(e, t) {
124
128
  count: r(t)
125
129
  })),
126
130
  items: o.items.map((e) => ({
127
- name: E(e.header, e.filepath),
128
- url: b(e.filepath)
131
+ name: D(e.header, e.filepath),
132
+ url: y(e.filepath)
129
133
  }))
130
134
  }, a(o.children, e);
131
135
  }
@@ -141,59 +145,48 @@ function w(e, t) {
141
145
  items: []
142
146
  }, a(e, ""), n;
143
147
  }
144
- function T(e, t) {
148
+ function E(e, t) {
145
149
  let n = c(l(e));
146
150
  return n ? s(n) : t;
147
151
  }
148
- function E(e, t) {
152
+ function D(e, t) {
149
153
  return e._label === void 0 ? e.name === void 0 ? s(d(t)) : String(e.name) : String(e._label);
150
154
  }
151
- function D(e) {
155
+ function O(e) {
152
156
  e.children.sort((e, t) => {
153
157
  let n = o(e.name), r = o(t.name);
154
158
  return n.order === r.order ? n.rest.localeCompare(r.rest) : n.order - r.order;
155
159
  }), e.items.sort((e, t) => {
156
160
  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;
161
+ return n.order === r.order ? D(e.header, e.filepath).localeCompare(D(t.header, t.filepath)) : n.order - r.order;
158
162
  });
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();
163
+ for (let t of e.children) O(t);
168
164
  }
169
165
  //#endregion
170
166
  //#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) {
167
+ var k = 60, A = 60 * k, j = 24 * A, M = 7 * j, N = 30 * j, P = 365 * j, F = 2 * M;
168
+ function I(e) {
173
169
  return (/* @__PURE__ */ new Date(e * 1e3)).toLocaleDateString("en-US", {
174
170
  year: "numeric",
175
171
  month: "short",
176
172
  day: "numeric"
177
173
  });
178
174
  }
179
- function R(e, t) {
180
- return Math.floor(Date.now() / 1e3) - e < I ? `${t} ${z(e)}` : `${t} at ${L(e)}`;
175
+ function L(e, t) {
176
+ return Math.floor(Date.now() / 1e3) - e < F ? `${t} ${R(e)}` : `${t} at ${I(e)}`;
181
177
  }
182
- function z(e) {
178
+ function R(e) {
183
179
  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`;
180
+ 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
181
  }
186
- var B = new Intl.DateTimeFormat("en-US", {
182
+ var z = new Intl.DateTimeFormat("en-US", {
187
183
  year: "numeric",
188
184
  month: "short",
189
185
  day: "numeric"
190
186
  });
191
- function V(e) {
187
+ function B(e) {
192
188
  let t = new Date(e);
193
- return Number.isNaN(t.getTime()) ? e : B.format(t);
189
+ return Number.isNaN(t.getTime()) ? e : z.format(t);
194
190
  }
195
191
  //#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 };
192
+ 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 };