typerighter 0.5.0 → 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-Bw90hv7G.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-CmL-6h9U.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-DaD9YRkN.js";
1
+ import { n as e, t } from "./vite-BrwFwz0T.js";
2
2
  import "./vite.js";
3
- import { n, t as r } from "./cli-9LGeV7cc.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-Bo603IxE.js";
2
- import { l as r, r as i } from "./brand-CmL-6h9U.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.0" }
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":"AAWA,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,CAUzD;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,34 +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
- if (t === "index") {
69
- let t = l(e);
70
- return t ? "/" + t : "/";
71
- }
72
65
  return "/" + p(l(e), t);
73
66
  }
74
- function x(e, t) {
67
+ function b(e, t) {
75
68
  return t.startsWith(e + "/") || t === e;
76
69
  }
70
+ function x(e) {
71
+ return a.test(e);
72
+ }
77
73
  function S(e) {
78
74
  let t = u(e).slice(1);
79
- 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;
80
80
  }
81
81
  //#endregion
82
82
  //#region src/shared/utils/content.ts
83
- function C(e) {
83
+ function w(e) {
84
84
  let t = {
85
85
  name: "",
86
86
  children: [],
@@ -98,12 +98,12 @@ function C(e) {
98
98
  }
99
99
  r.items.push(n);
100
100
  }
101
- return D(t), {
101
+ return O(t), {
102
102
  rootItems: t.items,
103
103
  children: t.children
104
104
  };
105
105
  }
106
- function w(e, t) {
106
+ function T(e, t) {
107
107
  let n = {};
108
108
  function r(e) {
109
109
  let t = e.items.length;
@@ -113,8 +113,8 @@ function w(e, t) {
113
113
  function i(e, t) {
114
114
  let n = e.items[0] ?? e.children[0]?.items[0];
115
115
  if (!n) return `${t}/${e.name}`;
116
- let r = b(n.filepath);
117
- return d(n.filepath) === "index" ? r : y(r);
116
+ let r = y(n.filepath);
117
+ return d(n.filepath) === "index" ? r : v(r);
118
118
  }
119
119
  function a(e, t) {
120
120
  for (let o of e) {
@@ -128,8 +128,8 @@ function w(e, t) {
128
128
  count: r(t)
129
129
  })),
130
130
  items: o.items.map((e) => ({
131
- name: E(e.header, e.filepath),
132
- url: b(e.filepath)
131
+ name: D(e.header, e.filepath),
132
+ url: y(e.filepath)
133
133
  }))
134
134
  }, a(o.children, e);
135
135
  }
@@ -145,59 +145,48 @@ function w(e, t) {
145
145
  items: []
146
146
  }, a(e, ""), n;
147
147
  }
148
- function T(e, t) {
148
+ function E(e, t) {
149
149
  let n = c(l(e));
150
150
  return n ? s(n) : t;
151
151
  }
152
- function E(e, t) {
152
+ function D(e, t) {
153
153
  return e._label === void 0 ? e.name === void 0 ? s(d(t)) : String(e.name) : String(e._label);
154
154
  }
155
- function D(e) {
155
+ function O(e) {
156
156
  e.children.sort((e, t) => {
157
157
  let n = o(e.name), r = o(t.name);
158
158
  return n.order === r.order ? n.rest.localeCompare(r.rest) : n.order - r.order;
159
159
  }), e.items.sort((e, t) => {
160
160
  let n = o(d(e.filepath)), r = o(d(t.filepath));
161
- 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;
162
162
  });
163
- for (let t of e.children) D(t);
164
- }
165
- //#endregion
166
- //#region src/shared/utils/html.ts
167
- function O(e) {
168
- return e.replaceAll("&", "&amp;").replaceAll("\"", "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
169
- }
170
- function k(e) {
171
- return e.replace(/<(style|script)[^>]*>[\s\S]*?<\/\1>/gi, "").replace(/<[^>]*>/g, "").replace(/\s+/g, " ").trim();
163
+ for (let t of e.children) O(t);
172
164
  }
173
165
  //#endregion
174
166
  //#region src/shared/utils/time.ts
175
- var A = 60, j = 60 * A, M = 24 * j, N = 7 * M, P = 30 * M, F = 365 * M, I = 2 * N;
176
- 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) {
177
169
  return (/* @__PURE__ */ new Date(e * 1e3)).toLocaleDateString("en-US", {
178
170
  year: "numeric",
179
171
  month: "short",
180
172
  day: "numeric"
181
173
  });
182
174
  }
183
- function R(e, t) {
184
- 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)}`;
185
177
  }
186
- function z(e) {
178
+ function R(e) {
187
179
  let t = Math.floor(Date.now() / 1e3) - e;
188
- 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`;
189
181
  }
190
- var B = new Intl.DateTimeFormat("en-US", {
182
+ var z = new Intl.DateTimeFormat("en-US", {
191
183
  year: "numeric",
192
184
  month: "short",
193
185
  day: "numeric"
194
186
  });
195
- function V(e) {
187
+ function B(e) {
196
188
  let t = new Date(e);
197
- return Number.isNaN(t.getTime()) ? e : B.format(t);
189
+ return Number.isNaN(t.getTime()) ? e : z.format(t);
198
190
  }
199
191
  //#endregion
200
- //#region src/shared/brand.ts
201
- 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)}`;
202
- //#endregion
203
- 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 };