typerighter 0.1.6 → 0.2.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.
@@ -1,65 +1,65 @@
1
- import { t as e } from "./rolldown-runtime-Dqa2HsxW.js";
2
- import { t } from "./html-cZxXrc6x.js";
3
- import n from "node:path";
1
+ import { i as e, n as t, o as n } from "./constants-BN1OmC7K.js";
2
+ import { r } from "./brand-CeSqpEQ2.js";
3
+ import i from "node:path";
4
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";
5
+ import a from "node:fs/promises";
6
+ import { styleText as o } from "node:util";
7
+ import s, { stdin as c, stdout as l } from "node:process";
8
+ import u from "node:readline";
9
9
  import "node:tty";
10
10
  //#region ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
11
- var l = (() => {
11
+ var d = (() => {
12
12
  let e = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
13
13
  return (t) => {
14
14
  let n = 0;
15
15
  for (e.lastIndex = 0; e.test(t);) n += 1;
16
16
  return t.length - n;
17
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 = {
18
+ })(), f = (e) => e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510, ee = (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, te = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y, ne = /[\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, re = /\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, ie = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, ae = /\p{M}+/gu, h = {
19
19
  limit: Infinity,
20
20
  ellipsis: ""
21
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],
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, l = n.regularWidth ?? 1, u = n.wideWidth ?? 2, _ = [
23
+ [ie, l],
24
+ [te, 0],
25
+ [ne, o],
26
+ [re, s],
27
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;
28
+ [p, u]
29
+ ], v = 0, y = 0, b = e.length, x = 0, S = !1, C = b, w = Math.max(0, r - a), T = 0, E = 0, D = 0, O = 0;
30
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, "")) {
31
+ if (E > T || y >= b && y > v) {
32
+ let t = e.slice(T, E) || e.slice(v, y);
33
+ x = 0;
34
+ for (let e of t.replaceAll(ae, "")) {
35
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;
36
+ if (O = f(t) ? 2 : ee(t) ? u : l, D + O > w && (C = Math.min(C, Math.max(T, v) + x)), D + O > r) {
37
+ S = !0;
38
38
  break outer;
39
39
  }
40
- C += e.length, k += A;
40
+ x += e.length, D += O;
41
41
  }
42
- D = O = 0;
42
+ T = E = 0;
43
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;
44
+ if (y >= b) break outer;
45
+ for (let t = 0, n = _.length; t < n; t++) {
46
+ let [n, i] = _[t];
47
+ if (n.lastIndex = y, n.test(e)) {
48
+ if (x = n === p ? d(e.slice(y, n.lastIndex)) : n === m ? 1 : n.lastIndex - y, O = x * i, D + O > w && (C = Math.min(C, y + Math.floor((w - D) / i))), D + O > r) {
49
+ S = !0;
50
50
  break outer;
51
51
  }
52
- k += A, D = b, O = x, x = b = n.lastIndex;
52
+ D += O, T = v, E = y, y = v = n.lastIndex;
53
53
  continue outer;
54
54
  }
55
55
  }
56
- x += 1;
56
+ y += 1;
57
57
  }
58
58
  return {
59
- width: w ? E : k,
60
- index: w ? T : S,
61
- truncated: w,
62
- ellipsed: w && r >= a
59
+ width: S ? w : D,
60
+ index: S ? C : b,
61
+ truncated: S,
62
+ ellipsed: S && r >= a
63
63
  };
64
64
  }, _ = {
65
65
  limit: Infinity,
@@ -82,11 +82,11 @@ var l = (() => {
82
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
83
  }
84
84
  o = e.at(-1), !s && o !== void 0 && o.length && e.length > 1 && (e[e.length - 2] += e.pop());
85
- }, ie = (e) => {
85
+ }, oe = (e) => {
86
86
  let t = e.split(" "), n = t.length;
87
87
  for (; n && !v(t[n - 1]);) n--;
88
88
  return n === t.length ? e : t.slice(0, n).join(" ") + t.slice(n).join("");
89
- }, ae = (e, t, n = {}) => {
89
+ }, se = (e, t, n = {}) => {
90
90
  if (n.trim !== !1 && e.trim() === "") return "";
91
91
  let r = "", i, a, o = e.split(" "), s = [""], c = 0;
92
92
  for (let e = 0; e < o.length; e++) {
@@ -115,7 +115,7 @@ var l = (() => {
115
115
  }
116
116
  s[s.length - 1] += r, c += i;
117
117
  }
118
- n.trim !== !1 && (s = s.map((e) => ie(e)));
118
+ n.trim !== !1 && (s = s.map((e) => oe(e)));
119
119
  let l = s.join("\n"), u = !1;
120
120
  for (let e = 0; e < l.length; e++) {
121
121
  let t = l[e];
@@ -136,13 +136,13 @@ var l = (() => {
136
136
  } else t === "\n" && (i && O(i) && (r += k(i)), a && (r += A(a)));
137
137
  }
138
138
  return r;
139
- }, oe = /\r?\n/;
139
+ }, ce = /\r?\n/;
140
140
  function M(e, t, n) {
141
- return String(e).normalize().split(oe).map((e) => ae(e, t, n)).join("\n");
141
+ return String(e).normalize().split(ce).map((e) => se(e, t, n)).join("\n");
142
142
  }
143
143
  //#endregion
144
144
  //#region ../../node_modules/.pnpm/@clack+core@1.4.3/node_modules/@clack/core/dist/index.mjs
145
- var N = (/* @__PURE__ */ e(((e, t) => {
145
+ var N = (/* @__PURE__ */ n(((e, t) => {
146
146
  var n = "\x1B", r = `${n}[`, i = "\x07", a = {
147
147
  to(e, t) {
148
148
  return t ? `${r}${t + 1};${e + 1}H` : `${r}${e + 1}G`;
@@ -236,7 +236,7 @@ function F(e, t) {
236
236
  for (let n of e) if (n !== void 0 && F(n, t)) return !0;
237
237
  return !1;
238
238
  }
239
- function se(e, t) {
239
+ function le(e, t) {
240
240
  if (e === t) return;
241
241
  let n = e.split("\n"), r = t.split("\n"), i = Math.max(n.length, r.length), a = [];
242
242
  for (let e = 0; e < i; e++) n[e] !== r[e] && a.push(e);
@@ -256,8 +256,8 @@ function R(e, t) {
256
256
  let n = e;
257
257
  n.isTTY && n.setRawMode(t);
258
258
  }
259
- var ce = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
260
- function z(e, t) {
259
+ var z = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
260
+ function B(e, t) {
261
261
  if ("~standard" in e) {
262
262
  let n = e["~standard"].validate(t);
263
263
  if (n instanceof Promise) throw TypeError("Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic.");
@@ -265,7 +265,7 @@ function z(e, t) {
265
265
  }
266
266
  return e(t);
267
267
  }
268
- var B = class {
268
+ var V = class {
269
269
  input;
270
270
  output;
271
271
  _abortSignal;
@@ -281,8 +281,8 @@ var B = class {
281
281
  value;
282
282
  userInput = "";
283
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;
284
+ let { input: n = c, output: r = l, render: i, signal: a, ...o } = e;
285
+ this.opts = o, 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
286
  }
287
287
  unsubscribe() {
288
288
  this._subscribers.clear();
@@ -313,7 +313,7 @@ var B = class {
313
313
  this.state = "cancel", this.close();
314
314
  }, { once: !0 });
315
315
  }
316
- this.rl = c.createInterface({
316
+ this.rl = u.createInterface({
317
317
  input: this.input,
318
318
  tabSize: 2,
319
319
  prompt: "",
@@ -350,7 +350,7 @@ var B = class {
350
350
  name: "h"
351
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
352
  if (this.opts.validate) {
353
- let e = z(this.opts.validate, this.value);
353
+ let e = B(this.opts.validate, this.value);
354
354
  e && (this.error = e instanceof Error ? e.message : e, this.state = "error", this.rl?.write(this.userInput));
355
355
  }
356
356
  this.state !== "error" && (this.state = "submit");
@@ -379,7 +379,7 @@ var B = class {
379
379
  if (e !== this._prevFrame) {
380
380
  if (this.state === "initial") this.output.write(N.cursor.hide);
381
381
  else {
382
- let t = se(this._prevFrame, e), n = ce(this.output);
382
+ let t = le(this._prevFrame, e), n = z(this.output);
383
383
  if (this.restoreCursor(), t) {
384
384
  let r = Math.max(0, t.numLinesAfter - n), i = Math.max(0, t.numLinesBefore - n), a = t.lines.find((e) => e >= r);
385
385
  if (a === void 0) {
@@ -408,13 +408,13 @@ var B = class {
408
408
  this.output.write(e), this.state === "initial" && (this.state = "active"), this._prevFrame = e;
409
409
  }
410
410
  }
411
- }, V = class extends B {
411
+ }, H = class extends V {
412
412
  get userInputWithCursor() {
413
413
  if (this.state === "submit") return this.userInput;
414
414
  let e = this.userInput;
415
415
  if (this.cursor >= e.length) return `${this.userInput}\u2588`;
416
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}`;
417
+ return `${t}${o("inverse", n)}${r}`;
418
418
  }
419
419
  get cursor() {
420
420
  return this._cursor;
@@ -432,23 +432,23 @@ var B = class {
432
432
  };
433
433
  //#endregion
434
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";
435
+ function U() {
436
+ return s.platform === "win32" ? !!s.env.CI || !!s.env.WT_SESSION || !!s.env.TERMINUS_SUBLIME || s.env.ConEmuTask === "{cmd::Cmder}" || s.env.TERM_PROGRAM === "Terminus-Sublime" || s.env.TERM_PROGRAM === "vscode" || s.env.TERM === "xterm-256color" || s.env.TERM === "alacritty" || s.env.TERMINAL_EMULATOR === "JetBrains-JediTerm" : s.env.TERM !== "linux";
437
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) => {
438
+ var W = U(), G = (e, t) => W ? e : t, ue = G("◆", "*"), de = G("■", "x"), fe = G("▲", "x"), K = G("◇", "o"), pe = G("┌", "T"), q = G("│", "|"), J = G("└", "—"), me = G("●", "•"), he = G("◆", "*"), ge = G("▲", "!"), _e = G("■", "x"), ve = (e) => {
439
439
  switch (e) {
440
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);
441
+ case "active": return o("cyan", ue);
442
+ case "cancel": return o("red", de);
443
+ case "error": return o("yellow", fe);
444
+ case "submit": return o("green", K);
445
445
  }
446
446
  };
447
- `${i("dim", "↑/↓")}`, `${i("dim", "Space:")}`, `${i("dim", "Enter:")}`;
447
+ `${o("dim", "↑/↓")}`, `${o("dim", "Space:")}`, `${o("dim", "Enter:")}`;
448
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);
449
+ message: (e = [], { symbol: t = o("gray", q), secondarySymbol: n = o("gray", q), output: r = process.stdout, spacing: i = 1, withGuide: a } = {}) => {
450
+ let s = [], c = a ?? P.withGuide, l = c ? n : "", u = c ? `${t} ` : "", d = c ? `${n} ` : "";
451
+ for (let e = 0; e < i; e++) s.push(l);
452
452
  let f = Array.isArray(e) ? e : e.split("\n");
453
453
  if (f.length > 0) {
454
454
  let [e, ...r] = f;
@@ -461,25 +461,25 @@ var Y = {
461
461
  info: (e, t) => {
462
462
  Y.message(e, {
463
463
  ...t,
464
- symbol: i("blue", fe)
464
+ symbol: o("blue", me)
465
465
  });
466
466
  },
467
467
  success: (e, t) => {
468
468
  Y.message(e, {
469
469
  ...t,
470
- symbol: i("green", pe)
470
+ symbol: o("green", he)
471
471
  });
472
472
  },
473
473
  step: (e, t) => {
474
474
  Y.message(e, {
475
475
  ...t,
476
- symbol: i("green", K)
476
+ symbol: o("green", K)
477
477
  });
478
478
  },
479
479
  warn: (e, t) => {
480
480
  Y.message(e, {
481
481
  ...t,
482
- symbol: i("yellow", me)
482
+ symbol: o("yellow", ge)
483
483
  });
484
484
  },
485
485
  warning: (e, t) => {
@@ -488,27 +488,27 @@ var Y = {
488
488
  error: (e, t) => {
489
489
  Y.message(e, {
490
490
  ...t,
491
- symbol: i("red", he)
491
+ symbol: o("red", _e)
492
492
  });
493
493
  }
494
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)}
495
+ let n = t?.output ?? process.stdout, r = t?.withGuide ?? P.withGuide ? `${o("gray", J)} ` : "";
496
+ n.write(`${r}${o("red", e)}
497
497
 
498
498
  `);
499
- }, _e = (e = "", t) => {
500
- let n = t?.output ?? process.stdout, r = t?.withGuide ?? P.withGuide ? `${i("gray", de)} ` : "";
499
+ }, ye = (e = "", t) => {
500
+ let n = t?.output ?? process.stdout, r = t?.withGuide ?? P.withGuide ? `${o("gray", pe)} ` : "";
501
501
  n.write(`${r}${e}
502
502
  `);
503
- }, Z = (e = "", t) => {
504
- let n = t?.output ?? process.stdout, r = t?.withGuide ?? P.withGuide ? `${i("gray", q)}
505
- ${i("gray", J)} ` : "";
503
+ }, be = (e = "", t) => {
504
+ let n = t?.output ?? process.stdout, r = t?.withGuide ?? P.withGuide ? `${o("gray", q)}
505
+ ${o("gray", J)} ` : "";
506
506
  n.write(`${r}${e}
507
507
 
508
508
  `);
509
509
  };
510
- `${i("dim", "↑/↓")}`, `${i("dim", "Enter:")}`, `${i("gray", q)}`;
511
- var Q = (e) => new V({
510
+ `${o("dim", "↑/↓")}`, `${o("dim", "Enter:")}`, `${o("gray", q)}`;
511
+ var Z = (e) => new H({
512
512
  validate: e.validate,
513
513
  placeholder: e.placeholder,
514
514
  defaultValue: e.defaultValue,
@@ -517,111 +517,115 @@ var Q = (e) => new V({
517
517
  signal: e.signal,
518
518
  input: e.input,
519
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 ?? "";
520
+ let t = e?.withGuide ?? P.withGuide, n = `${`${t ? `${o("gray", q)}
521
+ ` : ""}${ve(this.state)} `}${e.message}
522
+ `, r = e.placeholder && e.placeholder.length > 0 ? o("inverse", e.placeholder[0]) + o("dim", e.placeholder.slice(1)) : o(["inverse", "hidden"], "_"), i = this.userInput ? this.userInputWithCursor : r, a = this.value ?? "";
523
523
  switch (this.state) {
524
524
  case "error": {
525
- let e = this.error ? ` ${i("yellow", this.error)}` : "", r = t ? `${i("yellow", q)} ` : "", o = t ? i("yellow", J) : "";
525
+ let e = this.error ? ` ${o("yellow", this.error)}` : "", r = t ? `${o("yellow", q)} ` : "", a = t ? o("yellow", J) : "";
526
526
  return `${n.trim()}
527
- ${r}${a}
528
- ${o}${e}
527
+ ${r}${i}
528
+ ${a}${e}
529
529
  `;
530
530
  }
531
531
  case "submit": {
532
- let e = o ? ` ${i("dim", o)}` : "";
533
- return `${n}${t ? i("gray", q) : ""}${e}`;
532
+ let e = a ? ` ${o("dim", a)}` : "";
533
+ return `${n}${t ? o("gray", q) : ""}${e}`;
534
534
  }
535
535
  case "cancel": {
536
- let e = o ? ` ${i(["strikethrough", "dim"], o)}` : "", r = t ? i("gray", q) : "";
537
- return `${n}${r}${e}${o.trim() ? `
536
+ let e = a ? ` ${o(["strikethrough", "dim"], a)}` : "", r = t ? o("gray", q) : "";
537
+ return `${n}${r}${e}${a.trim() ? `
538
538
  ${r}` : ""}`;
539
539
  }
540
- default: return `${n}${t ? `${i("cyan", q)} ` : ""}${a}
541
- ${t ? i("cyan", J) : ""}
540
+ default: return `${n}${t ? `${o("cyan", q)} ` : ""}${i}
541
+ ${t ? o("cyan", J) : ""}
542
542
  `;
543
543
  }
544
544
  }
545
545
  }).prompt();
546
546
  //#endregion
547
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({
548
+ async function xe(e) {
549
+ ye("typedown");
550
+ let t = i.basename(i.resolve(e)), n = await Z({
551
551
  message: "Project name",
552
552
  placeholder: t,
553
553
  defaultValue: t
554
554
  });
555
- L(r) && (X("Cancelled."), process.exit(0));
556
- let i = await Q({
555
+ L(n) && (X("Cancelled."), process.exit(0));
556
+ let r = await Z({
557
557
  message: "Site title",
558
- placeholder: r,
559
- defaultValue: r
558
+ placeholder: n,
559
+ defaultValue: n
560
560
  });
561
- L(i) && (X("Cancelled."), process.exit(0));
562
- let a = await Q({
561
+ L(r) && (X("Cancelled."), process.exit(0));
562
+ let a = await Z({
563
563
  message: "Site description",
564
564
  placeholder: "A typedown site",
565
565
  defaultValue: "A typedown site"
566
566
  });
567
- L(a) && (X("Cancelled."), process.exit(0)), await Ce(e, {
568
- projectName: r,
569
- siteTitle: i,
567
+ L(a) && (X("Cancelled."), process.exit(0)), await Te(e, {
568
+ projectName: n,
569
+ siteTitle: r,
570
570
  siteDescription: a
571
571
  });
572
- let o = [];
573
- e !== "." && o.push(`cd ${e}`), o.push("pnpm install", "pnpm dev"), Y.info(o.join("\n")), Z("Done");
572
+ let o = ["Done scaffolding."];
573
+ e !== "." && o.push(`cd ${e}`), o.push("pnpm install", "pnpm dev"), be(o.join("\n"));
574
574
  }
575
- function ye(e) {
575
+ function Q(n) {
576
576
  return `<!doctype html>
577
577
  <html lang="en">
578
578
  <head>
579
579
  <meta charset="UTF-8" />
580
580
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
581
- <title>${t(e.siteTitle)}</title>
581
+ <title>${e(n.siteTitle)}</title>
582
+ <link
583
+ rel="icon"
584
+ type="image/svg+xml"
585
+ href="${r}"
586
+ >
582
587
  </head>
583
588
  <body>
584
589
  <div id="app"></div>
590
+ <script
591
+ type="module"
592
+ src="/${t}"
593
+ ><\/script>
585
594
  </body>
586
595
  </html>
587
596
  `;
588
597
  }
589
- function be(e) {
598
+ function Se(e) {
590
599
  return JSON.stringify({
591
600
  name: e.projectName,
592
601
  version: "0.0.0",
593
602
  private: !0,
594
603
  type: "module",
595
604
  scripts: {
596
- dev: "typedown dev",
597
- build: "typedown build",
598
- preview: "typedown preview"
605
+ dev: "typerighter dev",
606
+ build: "typerighter build",
607
+ preview: "typerighter preview"
599
608
  },
600
- dependencies: {
601
- typerighter: "^0.1.3",
602
- vue: "^3.5.0"
603
- },
604
- devDependencies: { vite: "^8.0.0" }
609
+ devDependencies: { typerighter: "^0.1.6" }
605
610
  }, void 0, 2) + "\n";
606
611
  }
607
- function xe() {
612
+ function Ce() {
608
613
  return "---\n_type: Article\ntitle: \"Hello, world\"\n---\n\nWelcome to your new typedown site.\n";
609
614
  }
610
- function Se() {
615
+ function we() {
611
616
  return "---\n_type: schema\nproperties:\n title:\n type: string\n tags:\n type: list[string]\n optional: true\n---\n";
612
617
  }
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())
618
+ async function Te(e, t) {
619
+ let n = i.resolve(e), r = i.join(n, "vault", "content"), o = i.join(n, "vault", "schemas");
620
+ await a.mkdir(r, { recursive: !0 }), await a.mkdir(o, { recursive: !0 }), await Promise.all([
621
+ $(n, "package.json", Se(t)),
622
+ $(n, "typedown.yaml", Ee(t)),
623
+ $(n, "index.html", Q(t)),
624
+ $(o, "Article.td", we(), { shouldLog: !1 }),
625
+ $(r, "hello.td", Ce(), { shouldLog: !1 })
622
626
  ]);
623
627
  }
624
- function we(e) {
628
+ function Ee(e) {
625
629
  return `version: "1.0.0"
626
630
  vault:
627
631
  content_dir: vault/content
@@ -631,16 +635,13 @@ site:
631
635
  description: "${e.siteDescription}"
632
636
  `;
633
637
  }
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)) {
638
+ async function $(e, t, n, { shouldLog: r = !0 } = {}) {
639
+ let o = i.join(e, t);
640
+ if (await a.access(o).then(() => !0).catch(() => !1) && r) {
640
641
  Y.warn(`skip ${t} (already exists)`);
641
642
  return;
642
643
  }
643
- await r.writeFile(a, i), Y.success(`created ${t}`);
644
+ await a.writeFile(o, n), r && Y.success(`created ${t}`);
644
645
  }
645
646
  //#endregion
646
- export { ve as initialize };
647
+ export { xe as initialize };
@@ -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;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
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/build/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACE,KAAK,YAAY,EACzB,MAAM,MAAM,CAAC;AAiBd,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,CA+HrE"}
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/node/cli/init.ts"],"names":[],"mappings":"AAUA,wBAAsB,UAAU,CAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDxE"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/node/cli/init.ts"],"names":[],"mappings":"AAgBA,wBAAsB,UAAU,CAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoDxE"}
@@ -25,5 +25,5 @@ export declare class TypedownContext {
25
25
  listSchemas(): Promise<string[]>;
26
26
  get md(): MarkdownRenderer;
27
27
  }
28
- export declare const tdContext: TypedownContext;
28
+ export declare function getTdContext(): Promise<TypedownContext>;
29
29
  //# sourceMappingURL=typedown-context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"typedown-context.d.ts","sourceRoot":"","sources":["../../../src/node/lib/typedown-context.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,SAAS,EACV,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EACV,eAAe,EAAE,YAAY,EAAE,YAAY,EAC5C,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACmB,KAAK,gBAAgB,EAC9C,MAAM,YAAY,CAAC;AAIpB,OAAO,KAAK,EACV,aAAa,EACd,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,CAA4B;IAC9D,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,aAAa,CAAC;IAgBnD,SAAS,IAAK,OAAO,CAAC,YAAY,CAAC;IASnC,WAAW,CAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAM/C,SAAS,CAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAYjD,WAAW,IAAK,OAAO,CAAC,MAAM,EAAE,CAAC;IAQvC,IAAI,EAAE,IAAK,gBAAgB,CAE1B;CACF;AAoDD,eAAO,MAAM,SAAS,iBAAoC,CAAC"}
1
+ {"version":3,"file":"typedown-context.d.ts","sourceRoot":"","sources":["../../../src/node/lib/typedown-context.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,SAAS,EACV,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EACV,eAAe,EAAE,YAAY,EAAE,YAAY,EAC5C,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACmB,KAAK,gBAAgB,EAC9C,MAAM,YAAY,CAAC;AAIpB,OAAO,KAAK,EACV,aAAa,EACd,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,CAA4B;IAC9D,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,aAAa,CAAC;IAgBnD,SAAS,IAAK,OAAO,CAAC,YAAY,CAAC;IASnC,WAAW,CAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAM/C,SAAS,CAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAYjD,WAAW,IAAK,OAAO,CAAC,MAAM,EAAE,CAAC;IAQvC,IAAI,EAAE,IAAK,gBAAgB,CAE1B;CACF;AAsDD,wBAAsB,YAAY,IAAK,OAAO,CAAC,eAAe,CAAC,CAM9D"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/node/plugin/vite/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,MAAM,EACP,MAAM,MAAM,CAAC;AAqBd,wBAAgB,QAAQ,IAAK,MAAM,EAAE,CA4JpC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/node/plugin/vite/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,MAAM,EACP,MAAM,MAAM,CAAC;AAuBd,wBAAgB,QAAQ,IAAK,MAAM,EAAE,CAmLpC"}
@@ -0,0 +1 @@
1
+ import "./vite-Di36EFu3.js";