typerighter 0.1.3 → 0.1.5

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.

Files changed (53) hide show
  1. package/bin/typedown.js +5 -0
  2. package/dist/{app-bn8sNpDS.js → app-CM3biamr.js} +18 -14
  3. package/dist/cli-2dHfEihR.js +158 -0
  4. package/dist/cli.js +2 -0
  5. package/dist/client/app/composables/useTdContent.d.ts +2 -1
  6. package/dist/client/app/composables/useTdContent.d.ts.map +1 -1
  7. package/dist/client/theme-default.js +1 -1
  8. package/dist/client.js +1 -1
  9. package/dist/html-cZxXrc6x.js +24 -0
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +4 -187
  13. package/dist/init-fZWFQnOM.js +646 -0
  14. package/dist/node/build/html.d.ts +1 -0
  15. package/dist/node/build/html.d.ts.map +1 -1
  16. package/dist/node/build/html.test.d.ts +2 -0
  17. package/dist/node/build/html.test.d.ts.map +1 -0
  18. package/dist/node/build/index.d.ts +0 -4
  19. package/dist/node/build/index.d.ts.map +1 -1
  20. package/dist/node/cli/index.d.ts +1 -1
  21. package/dist/node/cli/index.d.ts.map +1 -1
  22. package/dist/node/cli/init.d.ts +2 -0
  23. package/dist/node/cli/init.d.ts.map +1 -0
  24. package/dist/node/index.d.ts +1 -1
  25. package/dist/node/index.d.ts.map +1 -1
  26. package/dist/node/lib/typedown-context.d.ts.map +1 -1
  27. package/dist/node/plugin/{codegen.d.ts → vite/codegen.d.ts} +11 -0
  28. package/dist/node/plugin/vite/codegen.d.ts.map +1 -0
  29. package/dist/node/plugin/vite/codegen.test.d.ts.map +1 -0
  30. package/dist/node/plugin/vite/constants.d.ts.map +1 -0
  31. package/dist/node/plugin/{vite.d.ts → vite/index.d.ts} +1 -1
  32. package/dist/node/plugin/vite/index.d.ts.map +1 -0
  33. package/dist/plugin-t6FyO8wM.js +1 -0
  34. package/dist/rolldown-runtime-Dqa2HsxW.js +20 -0
  35. package/dist/{typedown-context-CWA07Yb7.js → typedown-context-C5kvAxE0.js} +65 -5
  36. package/dist/typedown-context-uGzfOyIE.js +2 -0
  37. package/dist/vite-CrIemqE7.js +206 -0
  38. package/dist/vite.js +3 -174
  39. package/package.json +9 -5
  40. package/dist/logger-DZLd8EDg.js +0 -78
  41. package/dist/node/build/codegen.d.ts +0 -13
  42. package/dist/node/build/codegen.d.ts.map +0 -1
  43. package/dist/node/cli/server.d.ts +0 -5
  44. package/dist/node/cli/server.d.ts.map +0 -1
  45. package/dist/node/plugin/codegen.d.ts.map +0 -1
  46. package/dist/node/plugin/codegen.test.d.ts.map +0 -1
  47. package/dist/node/plugin/constants.d.ts.map +0 -1
  48. package/dist/node/plugin/vite.d.ts.map +0 -1
  49. package/dist/node/plugin.d.ts +0 -3
  50. package/dist/node/plugin.d.ts.map +0 -1
  51. package/dist/typedown-context-D78bYNhH.js +0 -2
  52. /package/dist/node/plugin/{codegen.test.d.ts → vite/codegen.test.d.ts} +0 -0
  53. /package/dist/node/plugin/{constants.d.ts → vite/constants.d.ts} +0 -0
@@ -0,0 +1,646 @@
1
+ import { t as e } from "./rolldown-runtime-Dqa2HsxW.js";
2
+ import { t } from "./html-cZxXrc6x.js";
3
+ import n from "node:path";
4
+ import "node:fs";
5
+ import r from "node:fs/promises";
6
+ import { styleText as i } from "node:util";
7
+ import a, { stdin as o, stdout as s } from "node:process";
8
+ import c from "node:readline";
9
+ import "node:tty";
10
+ //#region ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
11
+ var l = (() => {
12
+ let e = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
13
+ return (t) => {
14
+ let n = 0;
15
+ for (e.lastIndex = 0; e.test(t);) n += 1;
16
+ return t.length - n;
17
+ };
18
+ })(), u = (e) => e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510, d = (e) => e === 8987 || e === 9001 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12771 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 19903 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141, f = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y, ee = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, p = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy, te = /\t{1,1000}/y, m = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy, ne = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, re = /\p{M}+/gu, h = {
19
+ limit: Infinity,
20
+ ellipsis: ""
21
+ }, g = (e, t = {}, n = {}) => {
22
+ let r = t.limit ?? Infinity, i = t.ellipsis ?? "", a = t?.ellipsisWidth ?? (i ? g(i, h, n).width : 0), o = n.controlWidth ?? 0, s = n.tabWidth ?? 8, c = n.emojiWidth ?? 2, _ = n.regularWidth ?? 1, v = n.wideWidth ?? 2, y = [
23
+ [ne, _],
24
+ [f, 0],
25
+ [ee, o],
26
+ [te, s],
27
+ [m, c],
28
+ [p, v]
29
+ ], b = 0, x = 0, S = e.length, C = 0, w = !1, T = S, E = Math.max(0, r - a), D = 0, O = 0, k = 0, A = 0;
30
+ outer: for (;;) {
31
+ if (O > D || x >= S && x > b) {
32
+ let t = e.slice(D, O) || e.slice(b, x);
33
+ C = 0;
34
+ for (let e of t.replaceAll(re, "")) {
35
+ let t = e.codePointAt(0) || 0;
36
+ if (A = u(t) ? 2 : d(t) ? v : _, k + A > E && (T = Math.min(T, Math.max(D, b) + C)), k + A > r) {
37
+ w = !0;
38
+ break outer;
39
+ }
40
+ C += e.length, k += A;
41
+ }
42
+ D = O = 0;
43
+ }
44
+ if (x >= S) break outer;
45
+ for (let t = 0, n = y.length; t < n; t++) {
46
+ let [n, i] = y[t];
47
+ if (n.lastIndex = x, n.test(e)) {
48
+ if (C = n === p ? l(e.slice(x, n.lastIndex)) : n === m ? 1 : n.lastIndex - x, A = C * i, k + A > E && (T = Math.min(T, x + Math.floor((E - k) / i))), k + A > r) {
49
+ w = !0;
50
+ break outer;
51
+ }
52
+ k += A, D = b, O = x, x = b = n.lastIndex;
53
+ continue outer;
54
+ }
55
+ }
56
+ x += 1;
57
+ }
58
+ return {
59
+ width: w ? E : k,
60
+ index: w ? T : S,
61
+ truncated: w,
62
+ ellipsed: w && r >= a
63
+ };
64
+ }, _ = {
65
+ limit: Infinity,
66
+ ellipsis: "",
67
+ ellipsisWidth: 0
68
+ }, v = (e, t = {}) => g(e, _, t).width, y = "\x1B", b = "›", x = 39, S = "\x07", C = "[", w = "]", T = "m", E = `${w}8;;`, D = RegExp(`(?:\\${C}(?<code>\\d+)m|\\${E}(?<uri>.*)${S})`, "y"), O = (e) => {
69
+ if (e >= 30 && e <= 37 || e >= 90 && e <= 97) return 39;
70
+ if (e >= 40 && e <= 47 || e >= 100 && e <= 107) return 49;
71
+ if (e === 1 || e === 2) return 22;
72
+ if (e === 3) return 23;
73
+ if (e === 4) return 24;
74
+ if (e === 7) return 27;
75
+ if (e === 8) return 28;
76
+ if (e === 9) return 29;
77
+ if (e === 0) return 0;
78
+ }, k = (e) => `${y}${C}${e}${T}`, A = (e) => `${y}${E}${e}${S}`, j = (e, t, n) => {
79
+ let r = t[Symbol.iterator](), i = !1, a = !1, o = e.at(-1), s = o === void 0 ? 0 : v(o), c = r.next(), l = r.next(), u = 0;
80
+ for (; !c.done;) {
81
+ let o = c.value, d = v(o);
82
+ s + d <= n ? e[e.length - 1] += o : (e.push(o), s = 0), (o === y || o === b) && (i = !0, a = t.startsWith(E, u + 1)), i ? a ? o === S && (i = !1, a = !1) : o === T && (i = !1) : (s += d, s === n && !l.done && (e.push(""), s = 0)), c = l, l = r.next(), u += o.length;
83
+ }
84
+ o = e.at(-1), !s && o !== void 0 && o.length && e.length > 1 && (e[e.length - 2] += e.pop());
85
+ }, ie = (e) => {
86
+ let t = e.split(" "), n = t.length;
87
+ for (; n && !v(t[n - 1]);) n--;
88
+ return n === t.length ? e : t.slice(0, n).join(" ") + t.slice(n).join("");
89
+ }, ae = (e, t, n = {}) => {
90
+ if (n.trim !== !1 && e.trim() === "") return "";
91
+ let r = "", i, a, o = e.split(" "), s = [""], c = 0;
92
+ for (let e = 0; e < o.length; e++) {
93
+ let r = o[e];
94
+ if (n.trim !== !1) {
95
+ let e = s.at(-1) ?? "", t = e.trimStart();
96
+ e.length !== t.length && (s[s.length - 1] = t, c = v(t));
97
+ }
98
+ e !== 0 && (c >= t && (n.wordWrap === !1 || n.trim === !1) && (s.push(""), c = 0), (c || n.trim === !1) && (s[s.length - 1] += " ", c++));
99
+ let i = v(r);
100
+ if (n.hard && i > t) {
101
+ let e = t - c, n = 1 + Math.floor((i - e - 1) / t);
102
+ Math.floor((i - 1) / t) < n && s.push(""), j(s, r, t), c = v(s.at(-1) ?? "");
103
+ continue;
104
+ }
105
+ if (c + i > t && c && i) {
106
+ if (n.wordWrap === !1 && c < t) {
107
+ j(s, r, t), c = v(s.at(-1) ?? "");
108
+ continue;
109
+ }
110
+ s.push(""), c = 0;
111
+ }
112
+ if (c + i > t && n.wordWrap === !1) {
113
+ j(s, r, t), c = v(s.at(-1) ?? "");
114
+ continue;
115
+ }
116
+ s[s.length - 1] += r, c += i;
117
+ }
118
+ n.trim !== !1 && (s = s.map((e) => ie(e)));
119
+ let l = s.join("\n"), u = !1;
120
+ for (let e = 0; e < l.length; e++) {
121
+ let t = l[e];
122
+ if (r += t, u) u = !1;
123
+ else if (u = t >= "\ud800" && t <= "\udbff", u) continue;
124
+ if (t === y || t === b) {
125
+ D.lastIndex = e + 1;
126
+ let t = D.exec(l)?.groups;
127
+ if (t?.code !== void 0) {
128
+ let e = Number.parseFloat(t.code);
129
+ i = e === x ? void 0 : e;
130
+ } else t?.uri !== void 0 && (a = t.uri.length === 0 ? void 0 : t.uri);
131
+ }
132
+ if (l[e + 1] === "\n") {
133
+ a && (r += A(""));
134
+ let e = i ? O(i) : void 0;
135
+ i && e && (r += k(e));
136
+ } else t === "\n" && (i && O(i) && (r += k(i)), a && (r += A(a)));
137
+ }
138
+ return r;
139
+ }, oe = /\r?\n/;
140
+ function M(e, t, n) {
141
+ return String(e).normalize().split(oe).map((e) => ae(e, t, n)).join("\n");
142
+ }
143
+ //#endregion
144
+ //#region ../../node_modules/.pnpm/@clack+core@1.4.3/node_modules/@clack/core/dist/index.mjs
145
+ var N = (/* @__PURE__ */ e(((e, t) => {
146
+ var n = "\x1B", r = `${n}[`, i = "\x07", a = {
147
+ to(e, t) {
148
+ return t ? `${r}${t + 1};${e + 1}H` : `${r}${e + 1}G`;
149
+ },
150
+ move(e, t) {
151
+ let n = "";
152
+ return e < 0 ? n += `${r}${-e}D` : e > 0 && (n += `${r}${e}C`), t < 0 ? n += `${r}${-t}A` : t > 0 && (n += `${r}${t}B`), n;
153
+ },
154
+ up: (e = 1) => `${r}${e}A`,
155
+ down: (e = 1) => `${r}${e}B`,
156
+ forward: (e = 1) => `${r}${e}C`,
157
+ backward: (e = 1) => `${r}${e}D`,
158
+ nextLine: (e = 1) => `${r}E`.repeat(e),
159
+ prevLine: (e = 1) => `${r}F`.repeat(e),
160
+ left: `${r}G`,
161
+ hide: `${r}?25l`,
162
+ show: `${r}?25h`,
163
+ save: `${n}7`,
164
+ restore: `${n}8`
165
+ };
166
+ t.exports = {
167
+ cursor: a,
168
+ scroll: {
169
+ up: (e = 1) => `${r}S`.repeat(e),
170
+ down: (e = 1) => `${r}T`.repeat(e)
171
+ },
172
+ erase: {
173
+ screen: `${r}2J`,
174
+ up: (e = 1) => `${r}1J`.repeat(e),
175
+ down: (e = 1) => `${r}J`.repeat(e),
176
+ line: `${r}2K`,
177
+ lineEnd: `${r}K`,
178
+ lineStart: `${r}1K`,
179
+ lines(e) {
180
+ let t = "";
181
+ for (let n = 0; n < e; n++) t += this.line + (n < e - 1 ? a.up() : "");
182
+ return e && (t += a.left), t;
183
+ }
184
+ },
185
+ beep: i
186
+ };
187
+ })))(), P = {
188
+ actions: /* @__PURE__ */ new Set([
189
+ "up",
190
+ "down",
191
+ "left",
192
+ "right",
193
+ "space",
194
+ "enter",
195
+ "cancel"
196
+ ]),
197
+ aliases: /* @__PURE__ */ new Map([
198
+ ["k", "up"],
199
+ ["j", "down"],
200
+ ["h", "left"],
201
+ ["l", "right"],
202
+ ["", "cancel"],
203
+ ["escape", "cancel"]
204
+ ]),
205
+ messages: {
206
+ cancel: "Canceled",
207
+ error: "Something went wrong"
208
+ },
209
+ withGuide: !0,
210
+ date: {
211
+ monthNames: [
212
+ "January",
213
+ "February",
214
+ "March",
215
+ "April",
216
+ "May",
217
+ "June",
218
+ "July",
219
+ "August",
220
+ "September",
221
+ "October",
222
+ "November",
223
+ "December"
224
+ ],
225
+ messages: {
226
+ required: "Please enter a valid date",
227
+ invalidMonth: "There are only 12 months in a year",
228
+ invalidDay: (e, t) => `There are only ${e} days in ${t}`,
229
+ afterMin: (e) => `Date must be on or after ${e.toISOString().slice(0, 10)}`,
230
+ beforeMax: (e) => `Date must be on or before ${e.toISOString().slice(0, 10)}`
231
+ }
232
+ }
233
+ };
234
+ function F(e, t) {
235
+ if (typeof e == "string") return P.aliases.get(e) === t;
236
+ for (let n of e) if (n !== void 0 && F(n, t)) return !0;
237
+ return !1;
238
+ }
239
+ function se(e, t) {
240
+ if (e === t) return;
241
+ let n = e.split("\n"), r = t.split("\n"), i = Math.max(n.length, r.length), a = [];
242
+ for (let e = 0; e < i; e++) n[e] !== r[e] && a.push(e);
243
+ return {
244
+ lines: a,
245
+ numLinesBefore: n.length,
246
+ numLinesAfter: r.length,
247
+ numLines: i
248
+ };
249
+ }
250
+ globalThis.process.platform.startsWith("win");
251
+ var I = Symbol("clack:cancel");
252
+ function L(e) {
253
+ return e === I;
254
+ }
255
+ function R(e, t) {
256
+ let n = e;
257
+ n.isTTY && n.setRawMode(t);
258
+ }
259
+ var ce = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
260
+ function z(e, t) {
261
+ if ("~standard" in e) {
262
+ let n = e["~standard"].validate(t);
263
+ if (n instanceof Promise) throw TypeError("Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic.");
264
+ return n.issues?.at(0)?.message;
265
+ }
266
+ return e(t);
267
+ }
268
+ var B = class {
269
+ input;
270
+ output;
271
+ _abortSignal;
272
+ rl;
273
+ opts;
274
+ _render;
275
+ _track = !1;
276
+ _prevFrame = "";
277
+ _subscribers = /* @__PURE__ */ new Map();
278
+ _cursor = 0;
279
+ state = "initial";
280
+ error = "";
281
+ value;
282
+ userInput = "";
283
+ constructor(e, t = !0) {
284
+ let { input: n = o, output: r = s, render: i, signal: a, ...c } = e;
285
+ this.opts = c, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i.bind(this), this._track = t, this._abortSignal = a, this.input = n, this.output = r;
286
+ }
287
+ unsubscribe() {
288
+ this._subscribers.clear();
289
+ }
290
+ setSubscriber(e, t) {
291
+ let n = this._subscribers.get(e) ?? [];
292
+ n.push(t), this._subscribers.set(e, n);
293
+ }
294
+ on(e, t) {
295
+ this.setSubscriber(e, { cb: t });
296
+ }
297
+ once(e, t) {
298
+ this.setSubscriber(e, {
299
+ cb: t,
300
+ once: !0
301
+ });
302
+ }
303
+ emit(e, ...t) {
304
+ let n = this._subscribers.get(e) ?? [], r = [];
305
+ for (let e of n) e.cb(...t), e.once && r.push(() => n.splice(n.indexOf(e), 1));
306
+ for (let e of r) e();
307
+ }
308
+ prompt() {
309
+ return new Promise((e) => {
310
+ if (this._abortSignal) {
311
+ if (this._abortSignal.aborted) return this.state = "cancel", this.close(), e(I);
312
+ this._abortSignal.addEventListener("abort", () => {
313
+ this.state = "cancel", this.close();
314
+ }, { once: !0 });
315
+ }
316
+ this.rl = c.createInterface({
317
+ input: this.input,
318
+ tabSize: 2,
319
+ prompt: "",
320
+ escapeCodeTimeout: 50,
321
+ terminal: !0
322
+ }), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress), R(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
323
+ this.output.write(N.cursor.show), this.output.off("resize", this.render), R(this.input, !1), e(this.value);
324
+ }), this.once("cancel", () => {
325
+ this.output.write(N.cursor.show), this.output.off("resize", this.render), R(this.input, !1), e(I);
326
+ });
327
+ });
328
+ }
329
+ _isActionKey(e, t) {
330
+ return e === " ";
331
+ }
332
+ _shouldSubmit(e, t) {
333
+ return !0;
334
+ }
335
+ _setValue(e) {
336
+ this.value = e, this.emit("value", this.value);
337
+ }
338
+ _setUserInput(e, t) {
339
+ this.userInput = e ?? "", this.emit("userInput", this.userInput), t && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
340
+ }
341
+ _clearUserInput() {
342
+ this.rl?.write(null, {
343
+ ctrl: !0,
344
+ name: "u"
345
+ }), this._setUserInput("");
346
+ }
347
+ onKeypress(e, t) {
348
+ if (this._track && t.name !== "return" && (t.name && this._isActionKey(e, t) && this.rl?.write(null, {
349
+ ctrl: !0,
350
+ name: "h"
351
+ }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), t?.name && (!this._track && P.aliases.has(t.name) && this.emit("cursor", P.aliases.get(t.name)), P.actions.has(t.name) && this.emit("cursor", t.name)), e && (e.toLowerCase() === "y" || e.toLowerCase() === "n") && this.emit("confirm", e.toLowerCase() === "y"), this.emit("key", e, t), t?.name === "return" && this._shouldSubmit(e, t)) {
352
+ if (this.opts.validate) {
353
+ let e = z(this.opts.validate, this.value);
354
+ e && (this.error = e instanceof Error ? e.message : e, this.state = "error", this.rl?.write(this.userInput));
355
+ }
356
+ this.state !== "error" && (this.state = "submit");
357
+ }
358
+ F([
359
+ e,
360
+ t?.name,
361
+ t?.sequence
362
+ ], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
363
+ }
364
+ close() {
365
+ this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write("\n"), R(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
366
+ }
367
+ restoreCursor() {
368
+ let e = M(this._prevFrame, process.stdout.columns, {
369
+ hard: !0,
370
+ trim: !1
371
+ }).split("\n").length - 1;
372
+ this.output.write(N.cursor.move(-999, e * -1));
373
+ }
374
+ render() {
375
+ let e = M(this._render(this) ?? "", process.stdout.columns, {
376
+ hard: !0,
377
+ trim: !1
378
+ });
379
+ if (e !== this._prevFrame) {
380
+ if (this.state === "initial") this.output.write(N.cursor.hide);
381
+ else {
382
+ let t = se(this._prevFrame, e), n = ce(this.output);
383
+ if (this.restoreCursor(), t) {
384
+ let r = Math.max(0, t.numLinesAfter - n), i = Math.max(0, t.numLinesBefore - n), a = t.lines.find((e) => e >= r);
385
+ if (a === void 0) {
386
+ this._prevFrame = e;
387
+ return;
388
+ }
389
+ if (t.lines.length === 1) {
390
+ this.output.write(N.cursor.move(0, a - i)), this.output.write(N.erase.lines(1));
391
+ let t = e.split("\n");
392
+ this.output.write(t[a]), this._prevFrame = e, this.output.write(N.cursor.move(0, t.length - a - 1));
393
+ return;
394
+ } else if (t.lines.length > 1) {
395
+ if (r < i) a = r;
396
+ else {
397
+ let e = a - i;
398
+ e > 0 && this.output.write(N.cursor.move(0, e));
399
+ }
400
+ this.output.write(N.erase.down());
401
+ let t = e.split("\n").slice(a);
402
+ this.output.write(t.join("\n")), this._prevFrame = e;
403
+ return;
404
+ }
405
+ }
406
+ this.output.write(N.erase.down());
407
+ }
408
+ this.output.write(e), this.state === "initial" && (this.state = "active"), this._prevFrame = e;
409
+ }
410
+ }
411
+ }, V = class extends B {
412
+ get userInputWithCursor() {
413
+ if (this.state === "submit") return this.userInput;
414
+ let e = this.userInput;
415
+ if (this.cursor >= e.length) return `${this.userInput}\u2588`;
416
+ let t = e.slice(0, this.cursor), n = e.slice(this.cursor, this.cursor + 1), r = e.slice(this.cursor + 1);
417
+ return `${t}${i("inverse", n)}${r}`;
418
+ }
419
+ get cursor() {
420
+ return this._cursor;
421
+ }
422
+ constructor(e) {
423
+ super({
424
+ ...e,
425
+ initialUserInput: e.initialUserInput ?? e.initialValue
426
+ }), this.on("userInput", (e) => {
427
+ this._setValue(e);
428
+ }), this.on("finalize", () => {
429
+ this.value ||= e.defaultValue, this.value === void 0 && (this.value = "");
430
+ });
431
+ }
432
+ };
433
+ //#endregion
434
+ //#region ../../node_modules/.pnpm/@clack+prompts@1.7.0/node_modules/@clack/prompts/dist/index.mjs
435
+ function H() {
436
+ return a.platform === "win32" ? !!a.env.CI || !!a.env.WT_SESSION || !!a.env.TERMINUS_SUBLIME || a.env.ConEmuTask === "{cmd::Cmder}" || a.env.TERM_PROGRAM === "Terminus-Sublime" || a.env.TERM_PROGRAM === "vscode" || a.env.TERM === "xterm-256color" || a.env.TERM === "alacritty" || a.env.TERMINAL_EMULATOR === "JetBrains-JediTerm" : a.env.TERM !== "linux";
437
+ }
438
+ var U = H(), W = (e, t) => U ? e : t, G = W("◆", "*"), le = W("■", "x"), ue = W("▲", "x"), K = W("◇", "o"), de = W("┌", "T"), q = W("│", "|"), J = W("└", "—"), fe = W("●", "•"), pe = W("◆", "*"), me = W("▲", "!"), he = W("■", "x"), ge = (e) => {
439
+ switch (e) {
440
+ case "initial":
441
+ case "active": return i("cyan", G);
442
+ case "cancel": return i("red", le);
443
+ case "error": return i("yellow", ue);
444
+ case "submit": return i("green", K);
445
+ }
446
+ };
447
+ `${i("dim", "↑/↓")}`, `${i("dim", "Space:")}`, `${i("dim", "Enter:")}`;
448
+ var Y = {
449
+ message: (e = [], { symbol: t = i("gray", q), secondarySymbol: n = i("gray", q), output: r = process.stdout, spacing: a = 1, withGuide: o } = {}) => {
450
+ let s = [], c = o ?? P.withGuide, l = c ? n : "", u = c ? `${t} ` : "", d = c ? `${n} ` : "";
451
+ for (let e = 0; e < a; e++) s.push(l);
452
+ let f = Array.isArray(e) ? e : e.split("\n");
453
+ if (f.length > 0) {
454
+ let [e, ...r] = f;
455
+ e.length > 0 ? s.push(`${u}${e}`) : s.push(c ? t : "");
456
+ for (let e of r) e.length > 0 ? s.push(`${d}${e}`) : s.push(c ? n : "");
457
+ }
458
+ r.write(`${s.join("\n")}
459
+ `);
460
+ },
461
+ info: (e, t) => {
462
+ Y.message(e, {
463
+ ...t,
464
+ symbol: i("blue", fe)
465
+ });
466
+ },
467
+ success: (e, t) => {
468
+ Y.message(e, {
469
+ ...t,
470
+ symbol: i("green", pe)
471
+ });
472
+ },
473
+ step: (e, t) => {
474
+ Y.message(e, {
475
+ ...t,
476
+ symbol: i("green", K)
477
+ });
478
+ },
479
+ warn: (e, t) => {
480
+ Y.message(e, {
481
+ ...t,
482
+ symbol: i("yellow", me)
483
+ });
484
+ },
485
+ warning: (e, t) => {
486
+ Y.warn(e, t);
487
+ },
488
+ error: (e, t) => {
489
+ Y.message(e, {
490
+ ...t,
491
+ symbol: i("red", he)
492
+ });
493
+ }
494
+ }, X = (e = "", t) => {
495
+ let n = t?.output ?? process.stdout, r = t?.withGuide ?? P.withGuide ? `${i("gray", J)} ` : "";
496
+ n.write(`${r}${i("red", e)}
497
+
498
+ `);
499
+ }, _e = (e = "", t) => {
500
+ let n = t?.output ?? process.stdout, r = t?.withGuide ?? P.withGuide ? `${i("gray", de)} ` : "";
501
+ n.write(`${r}${e}
502
+ `);
503
+ }, Z = (e = "", t) => {
504
+ let n = t?.output ?? process.stdout, r = t?.withGuide ?? P.withGuide ? `${i("gray", q)}
505
+ ${i("gray", J)} ` : "";
506
+ n.write(`${r}${e}
507
+
508
+ `);
509
+ };
510
+ `${i("dim", "↑/↓")}`, `${i("dim", "Enter:")}`, `${i("gray", q)}`;
511
+ var Q = (e) => new V({
512
+ validate: e.validate,
513
+ placeholder: e.placeholder,
514
+ defaultValue: e.defaultValue,
515
+ initialValue: e.initialValue,
516
+ output: e.output,
517
+ signal: e.signal,
518
+ input: e.input,
519
+ render() {
520
+ let t = e?.withGuide ?? P.withGuide, n = `${`${t ? `${i("gray", q)}
521
+ ` : ""}${ge(this.state)} `}${e.message}
522
+ `, r = e.placeholder && e.placeholder.length > 0 ? i("inverse", e.placeholder[0]) + i("dim", e.placeholder.slice(1)) : i(["inverse", "hidden"], "_"), a = this.userInput ? this.userInputWithCursor : r, o = this.value ?? "";
523
+ switch (this.state) {
524
+ case "error": {
525
+ let e = this.error ? ` ${i("yellow", this.error)}` : "", r = t ? `${i("yellow", q)} ` : "", o = t ? i("yellow", J) : "";
526
+ return `${n.trim()}
527
+ ${r}${a}
528
+ ${o}${e}
529
+ `;
530
+ }
531
+ case "submit": {
532
+ let e = o ? ` ${i("dim", o)}` : "";
533
+ return `${n}${t ? i("gray", q) : ""}${e}`;
534
+ }
535
+ case "cancel": {
536
+ let e = o ? ` ${i(["strikethrough", "dim"], o)}` : "", r = t ? i("gray", q) : "";
537
+ return `${n}${r}${e}${o.trim() ? `
538
+ ${r}` : ""}`;
539
+ }
540
+ default: return `${n}${t ? `${i("cyan", q)} ` : ""}${a}
541
+ ${t ? i("cyan", J) : ""}
542
+ `;
543
+ }
544
+ }
545
+ }).prompt();
546
+ //#endregion
547
+ //#region src/node/cli/init.ts
548
+ async function ve(e) {
549
+ _e("typedown");
550
+ let t = n.basename(n.resolve(e)), r = await Q({
551
+ message: "Project name",
552
+ placeholder: t,
553
+ defaultValue: t
554
+ });
555
+ L(r) && (X("Cancelled."), process.exit(0));
556
+ let i = await Q({
557
+ message: "Site title",
558
+ placeholder: r,
559
+ defaultValue: r
560
+ });
561
+ L(i) && (X("Cancelled."), process.exit(0));
562
+ let a = await Q({
563
+ message: "Site description",
564
+ placeholder: "A typedown site",
565
+ defaultValue: "A typedown site"
566
+ });
567
+ L(a) && (X("Cancelled."), process.exit(0)), await Ce(e, {
568
+ projectName: r,
569
+ siteTitle: i,
570
+ siteDescription: a
571
+ });
572
+ let o = [];
573
+ e !== "." && o.push(`cd ${e}`), o.push("pnpm install", "pnpm dev"), Y.info(o.join("\n")), Z("Done");
574
+ }
575
+ function ye(e) {
576
+ return `<!doctype html>
577
+ <html lang="en">
578
+ <head>
579
+ <meta charset="UTF-8" />
580
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
581
+ <title>${t(e.siteTitle)}</title>
582
+ </head>
583
+ <body>
584
+ <div id="app"></div>
585
+ </body>
586
+ </html>
587
+ `;
588
+ }
589
+ function be(e) {
590
+ return JSON.stringify({
591
+ name: e.projectName,
592
+ version: "0.0.0",
593
+ private: !0,
594
+ type: "module",
595
+ scripts: {
596
+ dev: "typedown dev",
597
+ build: "typedown build",
598
+ preview: "typedown preview"
599
+ },
600
+ dependencies: {
601
+ typerighter: "^0.1.3",
602
+ vue: "^3.5.0"
603
+ },
604
+ devDependencies: { vite: "^8.0.0" }
605
+ }, void 0, 2) + "\n";
606
+ }
607
+ function xe() {
608
+ return "---\n_type: Article\ntitle: \"Hello, world\"\n---\n\nWelcome to your new typedown site.\n";
609
+ }
610
+ function Se() {
611
+ return "---\n_type: schema\nproperties:\n title:\n type: string\n tags:\n type: list[string]\n optional: true\n---\n";
612
+ }
613
+ async function Ce(e, t) {
614
+ let i = n.resolve(e), a = n.join(i, "vault", "content"), o = n.join(i, "vault", "schemas");
615
+ await r.mkdir(a, { recursive: !0 }), await r.mkdir(o, { recursive: !0 }), await Promise.all([
616
+ $(i, "package.json", be(t)),
617
+ $(i, "vite.config.ts", Te()),
618
+ $(i, "typedown.yaml", we(t)),
619
+ $(i, "index.html", ye(t)),
620
+ $(o, "Article.td", Se()),
621
+ $(a, "hello.td", xe())
622
+ ]);
623
+ }
624
+ function we(e) {
625
+ return `version: "1.0.0"
626
+ vault:
627
+ content_dir: vault/content
628
+ schema_dir: vault/schemas
629
+ site:
630
+ title: "${e.siteTitle}"
631
+ description: "${e.siteDescription}"
632
+ `;
633
+ }
634
+ function Te() {
635
+ return "import { defineConfig } from \"vite\";\nimport { typedown } from \"typerighter/vite\";\n\nexport default defineConfig({\n plugins: [typedown()],\n});\n";
636
+ }
637
+ async function $(e, t, i) {
638
+ let a = n.join(e, t);
639
+ if (await r.access(a).then(() => !0).catch(() => !1)) {
640
+ Y.warn(`skip ${t} (already exists)`);
641
+ return;
642
+ }
643
+ await r.writeFile(a, i), Y.success(`created ${t}`);
644
+ }
645
+ //#endregion
646
+ export { ve as initialize };
@@ -17,4 +17,5 @@ export interface HtmlTemplateContext {
17
17
  lang?: string;
18
18
  }
19
19
  export declare function renderHtml(context: HtmlTemplateContext): string;
20
+ export declare function escapeHtml(string_: string): string;
20
21
  //# sourceMappingURL=html.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../../src/node/build/html.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,gDAAgD;IAChD,WAAW,EAAE,MAAM,CAAC;IACpB,gCAAgC;IAChC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,qDAAqD;IACrD,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAGD,wBAAgB,UAAU,CAAE,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAwBhE"}
1
+ {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../../src/node/build/html.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,gDAAgD;IAChD,WAAW,EAAE,MAAM,CAAC;IACpB,gCAAgC;IAChC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,qDAAqD;IACrD,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAGD,wBAAgB,UAAU,CAAE,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAwBhE;AAGD,wBAAgB,UAAU,CAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAMnD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=html.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html.test.d.ts","sourceRoot":"","sources":["../../../src/node/build/html.test.ts"],"names":[],"mappings":""}
@@ -6,10 +6,6 @@ export interface BuildOptions {
6
6
  outDir?: string;
7
7
  /** Base public path (default: "/") */
8
8
  base?: string;
9
- /** Import path for the theme's Layout component */
10
- layoutImport: string;
11
- /** Import path for the theme's NotFound component */
12
- notFoundImport: string;
13
9
  /** Additional Vite config overrides */
14
10
  viteConfig?: InlineConfig;
15
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/build/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACE,KAAK,YAAY,EACzB,MAAM,MAAM,CAAC;AAWd,MAAM,WAAW,YAAY;IAC3B,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,YAAY,EAAE,MAAM,CAAC;IACrB,qDAAqD;IACrD,cAAc,EAAE,MAAM,CAAC;IACvB,uCAAuC;IACvC,UAAU,CAAC,EAAE,YAAY,CAAC;CAC3B;AAGD,wBAAsB,SAAS,CAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA4GrE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/build/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACE,KAAK,YAAY,EACzB,MAAM,MAAM,CAAC;AAad,MAAM,WAAW,YAAY;IAC3B,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,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,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAuHrE"}
@@ -1,2 +1,2 @@
1
- export * from './server';
1
+ export declare function cli(): Promise<void>;
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/cli/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/cli/index.ts"],"names":[],"mappings":"AAWA,wBAAsB,GAAG,kBAyCxB"}