typerighter 0.44.1 → 0.45.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.
- package/dist/{app-C-CwtIly.js → app-D0bX_TJ8.js} +1 -1
- package/dist/builtin-components.json +95 -0
- package/dist/{cli-BYbSBUOA.js → cli-_m_a7JaO.js} +5 -5
- package/dist/cli.js +1 -1
- package/dist/client/theme-default.js +194 -194
- package/dist/client.js +1 -1
- package/dist/index.js +2 -2
- package/dist/{init-C3xKB6xH.js → init-CbYgEsOM.js} +203 -189
- package/dist/{jsonld-CrXLLdKW.js → jsonld-CRHOaFMj.js} +15 -15
- package/dist/node/build/builtin-contract.d.ts +3 -0
- package/dist/node/build/builtin-contract.d.ts.map +1 -0
- package/dist/node/cli/init.d.ts.map +1 -1
- package/dist/node/lib/codegen/app-entry.d.ts +1 -0
- package/dist/node/lib/codegen/app-entry.d.ts.map +1 -1
- package/dist/node/lib/components.d.ts +9 -7
- package/dist/node/lib/components.d.ts.map +1 -1
- package/dist/node/lib/prop-schema.d.ts +17 -0
- package/dist/node/lib/prop-schema.d.ts.map +1 -0
- package/dist/node/plugin/vite/subplugins/component-contract.d.ts.map +1 -1
- package/dist/node/plugin/vite/virtual/app.d.ts +2 -0
- package/dist/node/plugin/vite/virtual/app.d.ts.map +1 -1
- package/dist/node/plugin/vite/virtual/pages.d.ts +2 -0
- package/dist/node/plugin/vite/virtual/pages.d.ts.map +1 -1
- package/dist/prerenderWorker.js +2 -2
- package/dist/{renderMath-DBw8KV_4.js → renderMath-C59kPnxc.js} +1 -1
- package/dist/shared/types/json-schema.d.ts +12 -3
- package/dist/shared/types/json-schema.d.ts.map +1 -1
- package/dist/shared/utils/format.d.ts +1 -0
- package/dist/shared/utils/format.d.ts.map +1 -1
- package/dist/{shared-B-wDtFX6.js → shared-C5ERr4vS.js} +64 -54
- package/dist/shared.js +1 -1
- package/dist/typerighter.css +1 -1
- package/dist/{vite-B7uvklyW.js → vite-KkSlWwFu.js} +428 -367
- package/dist/vite.js +1 -1
- package/package.json +6 -4
|
@@ -3,70 +3,70 @@ import { t } from "./context-CSvoDxVt.js";
|
|
|
3
3
|
import { a as n, i as r, n as i, r as a, t as o } from "./brand-CG1fQshq.js";
|
|
4
4
|
import s from "node:path";
|
|
5
5
|
import c from "node:fs/promises";
|
|
6
|
-
import "node:fs";
|
|
7
|
-
import { styleText as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
6
|
+
import { existsSync as l } from "node:fs";
|
|
7
|
+
import { styleText as u } from "node:util";
|
|
8
|
+
import d, { stdin as f, stdout as p } from "node:process";
|
|
9
|
+
import m from "node:readline";
|
|
10
10
|
import "node:tty";
|
|
11
11
|
//#region ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
12
|
-
var
|
|
12
|
+
var h = (() => {
|
|
13
13
|
let e = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
14
14
|
return (t) => {
|
|
15
15
|
let n = 0;
|
|
16
16
|
for (e.lastIndex = 0; e.test(t);) n += 1;
|
|
17
17
|
return t.length - n;
|
|
18
18
|
};
|
|
19
|
-
})(),
|
|
19
|
+
})(), g = (e) => e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510, _ = (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, v = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y, y = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, b = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy, x = /\t{1,1000}/y, S = /[\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, ee = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, te = /\p{M}+/gu, ne = {
|
|
20
20
|
limit: Infinity,
|
|
21
21
|
ellipsis: ""
|
|
22
|
-
},
|
|
23
|
-
let r = t.limit ?? Infinity, i = t.ellipsis ?? "", a = t?.ellipsisWidth ?? (i ?
|
|
24
|
-
[
|
|
25
|
-
[
|
|
26
|
-
[
|
|
27
|
-
[
|
|
28
|
-
[
|
|
29
|
-
[
|
|
30
|
-
], f = 0, p = 0,
|
|
22
|
+
}, re = (e, t = {}, n = {}) => {
|
|
23
|
+
let r = t.limit ?? Infinity, i = t.ellipsis ?? "", a = t?.ellipsisWidth ?? (i ? re(i, ne, n).width : 0), o = n.controlWidth ?? 0, s = n.tabWidth ?? 8, c = n.emojiWidth ?? 2, l = n.regularWidth ?? 1, u = n.wideWidth ?? 2, d = [
|
|
24
|
+
[ee, l],
|
|
25
|
+
[v, 0],
|
|
26
|
+
[y, o],
|
|
27
|
+
[x, s],
|
|
28
|
+
[S, c],
|
|
29
|
+
[b, u]
|
|
30
|
+
], f = 0, p = 0, m = e.length, C = 0, w = !1, T = m, E = Math.max(0, r - a), D = 0, O = 0, k = 0, A = 0;
|
|
31
31
|
outer: for (;;) {
|
|
32
|
-
if (
|
|
33
|
-
let t = e.slice(
|
|
34
|
-
|
|
35
|
-
for (let e of t.replaceAll(
|
|
32
|
+
if (O > D || p >= m && p > f) {
|
|
33
|
+
let t = e.slice(D, O) || e.slice(f, p);
|
|
34
|
+
C = 0;
|
|
35
|
+
for (let e of t.replaceAll(te, "")) {
|
|
36
36
|
let t = e.codePointAt(0) || 0;
|
|
37
|
-
if (
|
|
38
|
-
|
|
37
|
+
if (A = g(t) ? 2 : _(t) ? u : l, k + A > E && (T = Math.min(T, Math.max(D, f) + C)), k + A > r) {
|
|
38
|
+
w = !0;
|
|
39
39
|
break outer;
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
C += e.length, k += A;
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
D = O = 0;
|
|
44
44
|
}
|
|
45
|
-
if (p >=
|
|
45
|
+
if (p >= m) break outer;
|
|
46
46
|
for (let t = 0, n = d.length; t < n; t++) {
|
|
47
47
|
let [n, i] = d[t];
|
|
48
48
|
if (n.lastIndex = p, n.test(e)) {
|
|
49
|
-
if (
|
|
50
|
-
|
|
49
|
+
if (C = n === b ? h(e.slice(p, n.lastIndex)) : n === S ? 1 : n.lastIndex - p, A = C * i, k + A > E && (T = Math.min(T, p + Math.floor((E - k) / i))), k + A > r) {
|
|
50
|
+
w = !0;
|
|
51
51
|
break outer;
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
k += A, D = f, O = p, p = f = n.lastIndex;
|
|
54
54
|
continue outer;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
p += 1;
|
|
58
58
|
}
|
|
59
59
|
return {
|
|
60
|
-
width:
|
|
61
|
-
index:
|
|
62
|
-
truncated:
|
|
63
|
-
ellipsed:
|
|
60
|
+
width: w ? E : k,
|
|
61
|
+
index: w ? T : m,
|
|
62
|
+
truncated: w,
|
|
63
|
+
ellipsed: w && r >= a
|
|
64
64
|
};
|
|
65
|
-
},
|
|
65
|
+
}, C = {
|
|
66
66
|
limit: Infinity,
|
|
67
67
|
ellipsis: "",
|
|
68
68
|
ellipsisWidth: 0
|
|
69
|
-
},
|
|
69
|
+
}, w = (e, t = {}) => re(e, C, t).width, T = "\x1B", E = "", D = 39, O = "\x07", k = "[", A = "]", j = "m", M = `${A}8;;`, N = RegExp(`(?:\\${k}(?<code>\\d+)m|\\${M}(?<uri>.*)${O})`, "y"), P = (e) => {
|
|
70
70
|
if (e >= 30 && e <= 37 || e >= 90 && e <= 97) return 39;
|
|
71
71
|
if (e >= 40 && e <= 47 || e >= 100 && e <= 107) return 49;
|
|
72
72
|
if (e === 1 || e === 2) return 22;
|
|
@@ -76,66 +76,66 @@ var m = (() => {
|
|
|
76
76
|
if (e === 8) return 28;
|
|
77
77
|
if (e === 9) return 29;
|
|
78
78
|
if (e === 0) return 0;
|
|
79
|
-
},
|
|
80
|
-
let r = t[Symbol.iterator](), i = !1, a = !1, o = e.at(-1), s = o === void 0 ? 0 :
|
|
79
|
+
}, ie = (e) => `${T}${k}${e}${j}`, ae = (e) => `${T}${M}${e}${O}`, F = (e, t, n) => {
|
|
80
|
+
let r = t[Symbol.iterator](), i = !1, a = !1, o = e.at(-1), s = o === void 0 ? 0 : w(o), c = r.next(), l = r.next(), u = 0;
|
|
81
81
|
for (; !c.done;) {
|
|
82
|
-
let o = c.value, d =
|
|
83
|
-
s + d <= n ? e[e.length - 1] += o : (e.push(o), s = 0), (o ===
|
|
82
|
+
let o = c.value, d = w(o);
|
|
83
|
+
s + d <= n ? e[e.length - 1] += o : (e.push(o), s = 0), (o === T || o === E) && (i = !0, a = t.startsWith(M, u + 1)), i ? a ? o === O && (i = !1, a = !1) : o === j && (i = !1) : (s += d, s === n && !l.done && (e.push(""), s = 0)), c = l, l = r.next(), u += o.length;
|
|
84
84
|
}
|
|
85
85
|
o = e.at(-1), !s && o !== void 0 && o.length && e.length > 1 && (e[e.length - 2] += e.pop());
|
|
86
|
-
},
|
|
86
|
+
}, oe = (e) => {
|
|
87
87
|
let t = e.split(" "), n = t.length;
|
|
88
|
-
for (; n && !
|
|
88
|
+
for (; n && !w(t[n - 1]);) n--;
|
|
89
89
|
return n === t.length ? e : t.slice(0, n).join(" ") + t.slice(n).join("");
|
|
90
|
-
},
|
|
90
|
+
}, se = (e, t, n = {}) => {
|
|
91
91
|
if (n.trim !== !1 && e.trim() === "") return "";
|
|
92
92
|
let r = "", i, a, o = e.split(" "), s = [""], c = 0;
|
|
93
93
|
for (let e = 0; e < o.length; e++) {
|
|
94
94
|
let r = o[e];
|
|
95
95
|
if (n.trim !== !1) {
|
|
96
96
|
let e = s.at(-1) ?? "", t = e.trimStart();
|
|
97
|
-
e.length !== t.length && (s[s.length - 1] = t, c =
|
|
97
|
+
e.length !== t.length && (s[s.length - 1] = t, c = w(t));
|
|
98
98
|
}
|
|
99
99
|
e !== 0 && (c >= t && (n.wordWrap === !1 || n.trim === !1) && (s.push(""), c = 0), (c || n.trim === !1) && (s[s.length - 1] += " ", c++));
|
|
100
|
-
let i =
|
|
100
|
+
let i = w(r);
|
|
101
101
|
if (n.hard && i > t) {
|
|
102
102
|
let e = t - c, n = 1 + Math.floor((i - e - 1) / t);
|
|
103
|
-
Math.floor((i - 1) / t) < n && s.push(""), F(s, r, t), c =
|
|
103
|
+
Math.floor((i - 1) / t) < n && s.push(""), F(s, r, t), c = w(s.at(-1) ?? "");
|
|
104
104
|
} else {
|
|
105
105
|
if (c + i > t && c && i) {
|
|
106
106
|
if (n.wordWrap === !1 && c < t) {
|
|
107
|
-
F(s, r, t), c =
|
|
107
|
+
F(s, r, t), c = w(s.at(-1) ?? "");
|
|
108
108
|
continue;
|
|
109
109
|
}
|
|
110
110
|
s.push(""), c = 0;
|
|
111
111
|
}
|
|
112
|
-
c + i > t && n.wordWrap === !1 ? (F(s, r, t), c =
|
|
112
|
+
c + i > t && n.wordWrap === !1 ? (F(s, r, t), c = w(s.at(-1) ?? "")) : (s[s.length - 1] += r, c += i);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
n.trim !== !1 && (s = s.map((e) =>
|
|
115
|
+
n.trim !== !1 && (s = s.map((e) => oe(e)));
|
|
116
116
|
let l = s.join("\n"), u = !1;
|
|
117
117
|
for (let e = 0; e < l.length; e++) {
|
|
118
118
|
let t = l[e];
|
|
119
119
|
if (r += t, u) u = !1;
|
|
120
120
|
else if (u = t >= "\ud800" && t <= "\udbff", u) continue;
|
|
121
|
-
if (t ===
|
|
122
|
-
|
|
123
|
-
let t =
|
|
121
|
+
if (t === T || t === E) {
|
|
122
|
+
N.lastIndex = e + 1;
|
|
123
|
+
let t = N.exec(l)?.groups;
|
|
124
124
|
if (t?.code !== void 0) {
|
|
125
125
|
let e = Number.parseFloat(t.code);
|
|
126
|
-
i = e ===
|
|
126
|
+
i = e === D ? void 0 : e;
|
|
127
127
|
} else t?.uri !== void 0 && (a = t.uri.length === 0 ? void 0 : t.uri);
|
|
128
128
|
}
|
|
129
129
|
if (l[e + 1] === "\n") {
|
|
130
|
-
a && (r +=
|
|
131
|
-
let e = i ?
|
|
132
|
-
i && e && (r +=
|
|
133
|
-
} else t === "\n" && (i &&
|
|
130
|
+
a && (r += ae(""));
|
|
131
|
+
let e = i ? P(i) : void 0;
|
|
132
|
+
i && e && (r += ie(e));
|
|
133
|
+
} else t === "\n" && (i && P(i) && (r += ie(i)), a && (r += ae(a)));
|
|
134
134
|
}
|
|
135
135
|
return r;
|
|
136
|
-
},
|
|
136
|
+
}, ce = /\r?\n/;
|
|
137
137
|
function I(e, t, n) {
|
|
138
|
-
return String(e).normalize().split(
|
|
138
|
+
return String(e).normalize().split(ce).map((e) => se(e, t, n)).join("\n");
|
|
139
139
|
}
|
|
140
140
|
//#endregion
|
|
141
141
|
//#region ../../node_modules/.pnpm/@clack+core@1.4.3/node_modules/@clack/core/dist/index.mjs
|
|
@@ -234,9 +234,9 @@ var z = {
|
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
};
|
|
237
|
-
function
|
|
237
|
+
function B(e, t) {
|
|
238
238
|
if (typeof e == "string") return z.aliases.get(e) === t;
|
|
239
|
-
for (let n of e) if (n !== void 0 &&
|
|
239
|
+
for (let n of e) if (n !== void 0 && B(n, t)) return !0;
|
|
240
240
|
return !1;
|
|
241
241
|
}
|
|
242
242
|
function le(e, t) {
|
|
@@ -251,17 +251,17 @@ function le(e, t) {
|
|
|
251
251
|
};
|
|
252
252
|
}
|
|
253
253
|
globalThis.process.platform.startsWith("win");
|
|
254
|
-
var
|
|
255
|
-
function
|
|
256
|
-
return e ===
|
|
254
|
+
var V = Symbol("clack:cancel");
|
|
255
|
+
function H(e) {
|
|
256
|
+
return e === V;
|
|
257
257
|
}
|
|
258
|
-
function
|
|
258
|
+
function U(e, t) {
|
|
259
259
|
let n = e;
|
|
260
260
|
n.isTTY && n.setRawMode(t);
|
|
261
261
|
}
|
|
262
|
-
var
|
|
263
|
-
function
|
|
264
|
-
return I(t,
|
|
262
|
+
var W = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80, G = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
263
|
+
function K(e, t, n, r = n, i = n, a) {
|
|
264
|
+
return I(t, W(e ?? p) - n.length, {
|
|
265
265
|
hard: !0,
|
|
266
266
|
trim: !1
|
|
267
267
|
}).split("\n").map((e, t, o) => {
|
|
@@ -269,7 +269,7 @@ function U(e, t, n, r = n, i = n, a) {
|
|
|
269
269
|
return t === 0 ? `${r}${s}` : t === o.length - 1 ? `${i}${s}` : `${n}${s}`;
|
|
270
270
|
}).join("\n");
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function ue(e, t) {
|
|
273
273
|
if ("~standard" in e) {
|
|
274
274
|
let n = e["~standard"].validate(t);
|
|
275
275
|
if (n instanceof Promise) throw TypeError("Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic.");
|
|
@@ -277,7 +277,7 @@ function fe(e, t) {
|
|
|
277
277
|
}
|
|
278
278
|
return e(t);
|
|
279
279
|
}
|
|
280
|
-
var
|
|
280
|
+
var de = class {
|
|
281
281
|
input;
|
|
282
282
|
output;
|
|
283
283
|
_abortSignal;
|
|
@@ -293,7 +293,7 @@ var W = class {
|
|
|
293
293
|
value;
|
|
294
294
|
userInput = "";
|
|
295
295
|
constructor(e, t = !0) {
|
|
296
|
-
let { input: n =
|
|
296
|
+
let { input: n = f, output: r = p, render: i, signal: a, ...o } = e;
|
|
297
297
|
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;
|
|
298
298
|
}
|
|
299
299
|
unsubscribe() {
|
|
@@ -320,21 +320,21 @@ var W = class {
|
|
|
320
320
|
prompt() {
|
|
321
321
|
return new Promise((e) => {
|
|
322
322
|
if (this._abortSignal) {
|
|
323
|
-
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), e(
|
|
323
|
+
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), e(V);
|
|
324
324
|
this._abortSignal.addEventListener("abort", () => {
|
|
325
325
|
this.state = "cancel", this.close();
|
|
326
326
|
}, { once: !0 });
|
|
327
327
|
}
|
|
328
|
-
this.rl =
|
|
328
|
+
this.rl = m.createInterface({
|
|
329
329
|
input: this.input,
|
|
330
330
|
tabSize: 2,
|
|
331
331
|
prompt: "",
|
|
332
332
|
escapeCodeTimeout: 50,
|
|
333
333
|
terminal: !0
|
|
334
|
-
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress),
|
|
335
|
-
this.output.write(L.cursor.show), this.output.off("resize", this.render),
|
|
334
|
+
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress), U(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
335
|
+
this.output.write(L.cursor.show), this.output.off("resize", this.render), U(this.input, !1), e(this.value);
|
|
336
336
|
}), this.once("cancel", () => {
|
|
337
|
-
this.output.write(L.cursor.show), this.output.off("resize", this.render),
|
|
337
|
+
this.output.write(L.cursor.show), this.output.off("resize", this.render), U(this.input, !1), e(V);
|
|
338
338
|
});
|
|
339
339
|
});
|
|
340
340
|
}
|
|
@@ -362,19 +362,19 @@ var W = class {
|
|
|
362
362
|
name: "h"
|
|
363
363
|
}), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), t?.name && (!this._track && z.aliases.has(t.name) && this.emit("cursor", z.aliases.get(t.name)), z.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)) {
|
|
364
364
|
if (this.opts.validate) {
|
|
365
|
-
let e =
|
|
365
|
+
let e = ue(this.opts.validate, this.value);
|
|
366
366
|
e && (this.error = e instanceof Error ? e.message : e, this.state = "error", this.rl?.write(this.userInput));
|
|
367
367
|
}
|
|
368
368
|
this.state !== "error" && (this.state = "submit");
|
|
369
369
|
}
|
|
370
|
-
|
|
370
|
+
B([
|
|
371
371
|
e,
|
|
372
372
|
t?.name,
|
|
373
373
|
t?.sequence
|
|
374
374
|
], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
375
375
|
}
|
|
376
376
|
close() {
|
|
377
|
-
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write("\n"),
|
|
377
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write("\n"), U(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
378
378
|
}
|
|
379
379
|
restoreCursor() {
|
|
380
380
|
let e = I(this._prevFrame, process.stdout.columns, {
|
|
@@ -391,7 +391,7 @@ var W = class {
|
|
|
391
391
|
if (e !== this._prevFrame) {
|
|
392
392
|
if (this.state === "initial") this.output.write(L.cursor.hide);
|
|
393
393
|
else {
|
|
394
|
-
let t = le(this._prevFrame, e), n =
|
|
394
|
+
let t = le(this._prevFrame, e), n = G(this.output);
|
|
395
395
|
if (this.restoreCursor(), t) {
|
|
396
396
|
let r = Math.max(0, t.numLinesAfter - n), i = Math.max(0, t.numLinesBefore - n), a = t.lines.find((e) => e >= r);
|
|
397
397
|
if (a === void 0) {
|
|
@@ -421,7 +421,7 @@ var W = class {
|
|
|
421
421
|
this.output.write(e), this.state === "initial" && (this.state = "active"), this._prevFrame = e;
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
|
-
},
|
|
424
|
+
}, fe = class extends de {
|
|
425
425
|
options;
|
|
426
426
|
cursor = 0;
|
|
427
427
|
get _selectedValue() {
|
|
@@ -446,13 +446,13 @@ var W = class {
|
|
|
446
446
|
this.changeValue();
|
|
447
447
|
});
|
|
448
448
|
}
|
|
449
|
-
},
|
|
449
|
+
}, pe = class extends de {
|
|
450
450
|
get userInputWithCursor() {
|
|
451
451
|
if (this.state === "submit") return this.userInput;
|
|
452
452
|
let e = this.userInput;
|
|
453
453
|
if (this.cursor >= e.length) return `${this.userInput}\u2588`;
|
|
454
454
|
let t = e.slice(0, this.cursor), n = e.slice(this.cursor, this.cursor + 1), r = e.slice(this.cursor + 1);
|
|
455
|
-
return `${t}${
|
|
455
|
+
return `${t}${u("inverse", n)}${r}`;
|
|
456
456
|
}
|
|
457
457
|
get cursor() {
|
|
458
458
|
return this._cursor;
|
|
@@ -470,31 +470,31 @@ var W = class {
|
|
|
470
470
|
};
|
|
471
471
|
//#endregion
|
|
472
472
|
//#region ../../node_modules/.pnpm/@clack+prompts@1.7.0/node_modules/@clack/prompts/dist/index.mjs
|
|
473
|
-
function
|
|
474
|
-
return
|
|
473
|
+
function me() {
|
|
474
|
+
return d.platform === "win32" ? !!d.env.CI || !!d.env.WT_SESSION || !!d.env.TERMINUS_SUBLIME || d.env.ConEmuTask === "{cmd::Cmder}" || d.env.TERM_PROGRAM === "Terminus-Sublime" || d.env.TERM_PROGRAM === "vscode" || d.env.TERM === "xterm-256color" || d.env.TERM === "alacritty" || d.env.TERMINAL_EMULATOR === "JetBrains-JediTerm" : d.env.TERM !== "linux";
|
|
475
475
|
}
|
|
476
|
-
var
|
|
476
|
+
var he = me(), q = (e, t) => he ? e : t, ge = q("◆", "*"), _e = q("■", "x"), ve = q("▲", "x"), ye = q("◇", "o"), be = q("┌", "T"), J = q("│", "|"), Y = q("└", "—"), xe = q("●", ">"), Se = q("○", " "), Ce = q("●", "•"), we = q("◆", "*"), Te = q("▲", "!"), Ee = q("■", "x"), De = (e) => {
|
|
477
477
|
switch (e) {
|
|
478
478
|
case "initial":
|
|
479
|
-
case "active": return
|
|
480
|
-
case "cancel": return
|
|
481
|
-
case "error": return
|
|
482
|
-
case "submit": return
|
|
479
|
+
case "active": return u("cyan", ge);
|
|
480
|
+
case "cancel": return u("red", _e);
|
|
481
|
+
case "error": return u("yellow", ve);
|
|
482
|
+
case "submit": return u("green", ye);
|
|
483
483
|
}
|
|
484
|
-
},
|
|
484
|
+
}, Oe = (e) => {
|
|
485
485
|
switch (e) {
|
|
486
486
|
case "initial":
|
|
487
|
-
case "active": return
|
|
488
|
-
case "cancel": return
|
|
489
|
-
case "error": return
|
|
490
|
-
case "submit": return
|
|
487
|
+
case "active": return u("cyan", J);
|
|
488
|
+
case "cancel": return u("red", J);
|
|
489
|
+
case "error": return u("yellow", J);
|
|
490
|
+
case "submit": return u("green", J);
|
|
491
491
|
}
|
|
492
492
|
};
|
|
493
|
-
function
|
|
494
|
-
let n = [`${t ? `${
|
|
495
|
-
return t && n.push(
|
|
493
|
+
function ke(e, t) {
|
|
494
|
+
let n = [`${t ? `${u("cyan", J)} ` : ""}${e.join(" • ")}`];
|
|
495
|
+
return t && n.push(u("cyan", Y)), n;
|
|
496
496
|
}
|
|
497
|
-
var
|
|
497
|
+
var Ae = (e, t, n, r, i, a = !1) => {
|
|
498
498
|
let o = t, s = 0;
|
|
499
499
|
if (a) for (let t = r - 1; t >= n; t--) {
|
|
500
500
|
let n = e[t];
|
|
@@ -508,37 +508,37 @@ var ke = (e, t, n, r, i, a = !1) => {
|
|
|
508
508
|
lineCount: o,
|
|
509
509
|
removals: s
|
|
510
510
|
};
|
|
511
|
-
},
|
|
512
|
-
let s =
|
|
511
|
+
}, je = ({ cursor: e, options: t, style: n, output: r = process.stdout, maxItems: i = Infinity, columnPadding: a = 0, rowPadding: o = 4 }) => {
|
|
512
|
+
let s = W(r) - a, c = G(r), l = u("dim", "..."), d = Math.max(c - o, 0), f = Math.max(Math.min(i, d), 5), p = 0;
|
|
513
513
|
e >= f - 3 && (p = Math.max(Math.min(e - f + 3, t.length - f), 0));
|
|
514
|
-
let m = f < t.length && p > 0, h = f < t.length && p + f < t.length,
|
|
515
|
-
m &&
|
|
516
|
-
let
|
|
517
|
-
for (let r =
|
|
514
|
+
let m = f < t.length && p > 0, h = f < t.length && p + f < t.length, g = Math.min(p + f, t.length), _ = [], v = 0;
|
|
515
|
+
m && v++, h && v++;
|
|
516
|
+
let y = p + +!!m, b = g - +!!h;
|
|
517
|
+
for (let r = y; r < b; r++) {
|
|
518
518
|
let i = t[r], a = I(i ? n(i, r === e) : "", s, {
|
|
519
519
|
hard: !0,
|
|
520
520
|
trim: !1
|
|
521
521
|
}).split("\n");
|
|
522
|
-
|
|
522
|
+
_.push(a), v += a.length;
|
|
523
523
|
}
|
|
524
|
-
if (
|
|
525
|
-
let t = 0, n = 0, r =
|
|
526
|
-
m ? ({lineCount: r, removals: t} = o(), r > a && (h || --a, {lineCount: r, removals: n} = s())) : (h || --a, {lineCount: r, removals: n} = s(), r > a && (--a, {lineCount: r, removals: t} = o())), t > 0 && (m = !0,
|
|
524
|
+
if (v > d) {
|
|
525
|
+
let t = 0, n = 0, r = v, i = e - y, a = d, o = () => Ae(_, r, 0, i, a), s = () => Ae(_, r, i + 1, _.length, a, !0);
|
|
526
|
+
m ? ({lineCount: r, removals: t} = o(), r > a && (h || --a, {lineCount: r, removals: n} = s())) : (h || --a, {lineCount: r, removals: n} = s(), r > a && (--a, {lineCount: r, removals: t} = o())), t > 0 && (m = !0, _.splice(0, t)), n > 0 && (h = !0, _.splice(_.length - n, n));
|
|
527
527
|
}
|
|
528
|
-
let
|
|
529
|
-
m &&
|
|
530
|
-
for (let e of
|
|
531
|
-
return h &&
|
|
528
|
+
let x = [];
|
|
529
|
+
m && x.push(l);
|
|
530
|
+
for (let e of _) for (let t of e) x.push(t);
|
|
531
|
+
return h && x.push(l), x;
|
|
532
532
|
};
|
|
533
|
-
`${
|
|
533
|
+
`${u("dim", "↑/↓")}`, `${u("dim", "Space:")}`, `${u("dim", "Enter:")}`;
|
|
534
534
|
var X = {
|
|
535
|
-
message: (e = [], { symbol: t =
|
|
536
|
-
let o = [], s = a ?? z.withGuide, c = s ? n : "",
|
|
535
|
+
message: (e = [], { symbol: t = u("gray", J), secondarySymbol: n = u("gray", J), output: r = process.stdout, spacing: i = 1, withGuide: a } = {}) => {
|
|
536
|
+
let o = [], s = a ?? z.withGuide, c = s ? n : "", l = s ? `${t} ` : "", d = s ? `${n} ` : "";
|
|
537
537
|
for (let e = 0; e < i; e++) o.push(c);
|
|
538
538
|
let f = Array.isArray(e) ? e : e.split("\n");
|
|
539
539
|
if (f.length > 0) {
|
|
540
540
|
let [e, ...r] = f;
|
|
541
|
-
e.length > 0 ? o.push(`${
|
|
541
|
+
e.length > 0 ? o.push(`${l}${e}`) : o.push(s ? t : "");
|
|
542
542
|
for (let e of r) e.length > 0 ? o.push(`${d}${e}`) : o.push(s ? n : "");
|
|
543
543
|
}
|
|
544
544
|
r.write(`${o.join("\n")}
|
|
@@ -547,25 +547,25 @@ var X = {
|
|
|
547
547
|
info: (e, t) => {
|
|
548
548
|
X.message(e, {
|
|
549
549
|
...t,
|
|
550
|
-
symbol:
|
|
550
|
+
symbol: u("blue", Ce)
|
|
551
551
|
});
|
|
552
552
|
},
|
|
553
553
|
success: (e, t) => {
|
|
554
554
|
X.message(e, {
|
|
555
555
|
...t,
|
|
556
|
-
symbol:
|
|
556
|
+
symbol: u("green", we)
|
|
557
557
|
});
|
|
558
558
|
},
|
|
559
559
|
step: (e, t) => {
|
|
560
560
|
X.message(e, {
|
|
561
561
|
...t,
|
|
562
|
-
symbol:
|
|
562
|
+
symbol: u("green", ye)
|
|
563
563
|
});
|
|
564
564
|
},
|
|
565
565
|
warn: (e, t) => {
|
|
566
566
|
X.message(e, {
|
|
567
567
|
...t,
|
|
568
|
-
symbol:
|
|
568
|
+
symbol: u("yellow", Te)
|
|
569
569
|
});
|
|
570
570
|
},
|
|
571
571
|
warning: (e, t) => {
|
|
@@ -574,65 +574,65 @@ var X = {
|
|
|
574
574
|
error: (e, t) => {
|
|
575
575
|
X.message(e, {
|
|
576
576
|
...t,
|
|
577
|
-
symbol:
|
|
577
|
+
symbol: u("red", Ee)
|
|
578
578
|
});
|
|
579
579
|
}
|
|
580
|
-
},
|
|
581
|
-
let n = t?.output ?? process.stdout, r = t?.withGuide ?? z.withGuide ? `${
|
|
582
|
-
n.write(`${r}${
|
|
580
|
+
}, Me = (e = "", t) => {
|
|
581
|
+
let n = t?.output ?? process.stdout, r = t?.withGuide ?? z.withGuide ? `${u("gray", Y)} ` : "";
|
|
582
|
+
n.write(`${r}${u("red", e)}
|
|
583
583
|
|
|
584
584
|
`);
|
|
585
|
-
},
|
|
586
|
-
let n = t?.output ?? process.stdout, r = t?.withGuide ?? z.withGuide ? `${
|
|
585
|
+
}, Ne = (e = "", t) => {
|
|
586
|
+
let n = t?.output ?? process.stdout, r = t?.withGuide ?? z.withGuide ? `${u("gray", be)} ` : "";
|
|
587
587
|
n.write(`${r}${e}
|
|
588
588
|
`);
|
|
589
|
-
},
|
|
590
|
-
let n = t?.output ?? process.stdout, r = t?.withGuide ?? z.withGuide ? `${
|
|
591
|
-
${
|
|
589
|
+
}, Pe = (e = "", t) => {
|
|
590
|
+
let n = t?.output ?? process.stdout, r = t?.withGuide ?? z.withGuide ? `${u("gray", J)}
|
|
591
|
+
${u("gray", Y)} ` : "";
|
|
592
592
|
n.write(`${r}${e}
|
|
593
593
|
|
|
594
594
|
`);
|
|
595
|
-
},
|
|
595
|
+
}, Fe = [`${u("dim", "↑/↓")} to navigate`, `${u("dim", "Enter:")} confirm`], Z = (e, t) => e.includes("\n") ? e.split("\n").map((e) => t(e)).join("\n") : t(e), Ie = (e) => {
|
|
596
596
|
let t = (e, t) => {
|
|
597
597
|
if (e === void 0) return "";
|
|
598
598
|
let n = e.label ?? String(e.value);
|
|
599
599
|
switch (t) {
|
|
600
|
-
case "disabled": return `${
|
|
601
|
-
case "selected": return `${Z(n, (e) =>
|
|
602
|
-
case "active": return `${
|
|
603
|
-
case "cancelled": return `${Z(n, (e) =>
|
|
604
|
-
default: return `${
|
|
600
|
+
case "disabled": return `${u("gray", Se)} ${Z(n, (e) => u("gray", e))}${e.hint ? ` ${u("dim", `(${e.hint ?? "disabled"})`)}` : ""}`;
|
|
601
|
+
case "selected": return `${Z(n, (e) => u("dim", e))}`;
|
|
602
|
+
case "active": return `${u("green", xe)} ${n}${e.hint ? ` ${u("dim", `(${e.hint})`)}` : ""}`;
|
|
603
|
+
case "cancelled": return `${Z(n, (e) => u(["strikethrough", "dim"], e))}`;
|
|
604
|
+
default: return `${u("dim", Se)} ${Z(n, (e) => u("dim", e))}`;
|
|
605
605
|
}
|
|
606
606
|
}, n = e.showInstructions ?? !0;
|
|
607
|
-
return new
|
|
607
|
+
return new fe({
|
|
608
608
|
options: e.options,
|
|
609
609
|
signal: e.signal,
|
|
610
610
|
input: e.input,
|
|
611
611
|
output: e.output,
|
|
612
612
|
initialValue: e.initialValue,
|
|
613
613
|
render() {
|
|
614
|
-
let r = e.withGuide ?? z.withGuide, i = `${
|
|
614
|
+
let r = e.withGuide ?? z.withGuide, i = `${De(this.state)} `, a = `${Oe(this.state)} `, o = K(e.output, e.message, a, i), s = `${r ? `${u("gray", J)}
|
|
615
615
|
` : ""}${o}
|
|
616
616
|
`;
|
|
617
617
|
switch (this.state) {
|
|
618
618
|
case "submit": {
|
|
619
|
-
let n = r ? `${
|
|
620
|
-
return `${s}${
|
|
619
|
+
let n = r ? `${u("gray", J)} ` : "";
|
|
620
|
+
return `${s}${K(e.output, t(this.options[this.cursor], "selected"), n)}`;
|
|
621
621
|
}
|
|
622
622
|
case "cancel": {
|
|
623
|
-
let n = r ? `${
|
|
624
|
-
return `${s}${
|
|
625
|
-
${
|
|
623
|
+
let n = r ? `${u("gray", J)} ` : "";
|
|
624
|
+
return `${s}${K(e.output, t(this.options[this.cursor], "cancelled"), n)}${r ? `
|
|
625
|
+
${u("gray", J)}` : ""}`;
|
|
626
626
|
}
|
|
627
627
|
default: {
|
|
628
|
-
let i = r ? `${
|
|
629
|
-
return `${s}${i}${
|
|
628
|
+
let i = r ? `${u("cyan", J)} ` : "", a = s.split("\n").length, o = n ? ke(Fe, r) : r ? [u("cyan", Y)] : [], c = o.join("\n"), l = o.length + 1;
|
|
629
|
+
return `${s}${i}${je({
|
|
630
630
|
output: e.output,
|
|
631
631
|
cursor: this.cursor,
|
|
632
632
|
options: this.options,
|
|
633
633
|
maxItems: e.maxItems,
|
|
634
634
|
columnPadding: i.length,
|
|
635
|
-
rowPadding: a +
|
|
635
|
+
rowPadding: a + l,
|
|
636
636
|
style: (e, n) => t(e, e.disabled ? "disabled" : n ? "active" : "inactive")
|
|
637
637
|
}).join(`
|
|
638
638
|
${i}`)}
|
|
@@ -643,8 +643,8 @@ ${c}
|
|
|
643
643
|
}
|
|
644
644
|
}).prompt();
|
|
645
645
|
};
|
|
646
|
-
`${
|
|
647
|
-
var
|
|
646
|
+
`${u("gray", J)}`;
|
|
647
|
+
var Le = (e) => new pe({
|
|
648
648
|
validate: e.validate,
|
|
649
649
|
placeholder: e.placeholder,
|
|
650
650
|
defaultValue: e.defaultValue,
|
|
@@ -653,42 +653,42 @@ var Ie = (e) => new me({
|
|
|
653
653
|
signal: e.signal,
|
|
654
654
|
input: e.input,
|
|
655
655
|
render() {
|
|
656
|
-
let t = e?.withGuide ?? z.withGuide, n = `${`${t ? `${
|
|
657
|
-
` : ""}${
|
|
658
|
-
`, r = e.placeholder && e.placeholder.length > 0 ?
|
|
656
|
+
let t = e?.withGuide ?? z.withGuide, n = `${`${t ? `${u("gray", J)}
|
|
657
|
+
` : ""}${De(this.state)} `}${e.message}
|
|
658
|
+
`, r = e.placeholder && e.placeholder.length > 0 ? u("inverse", e.placeholder[0]) + u("dim", e.placeholder.slice(1)) : u(["inverse", "hidden"], "_"), i = this.userInput ? this.userInputWithCursor : r, a = this.value ?? "";
|
|
659
659
|
switch (this.state) {
|
|
660
660
|
case "error": {
|
|
661
|
-
let e = this.error ? ` ${
|
|
661
|
+
let e = this.error ? ` ${u("yellow", this.error)}` : "", r = t ? `${u("yellow", J)} ` : "", a = t ? u("yellow", Y) : "";
|
|
662
662
|
return `${n.trim()}
|
|
663
663
|
${r}${i}
|
|
664
664
|
${a}${e}
|
|
665
665
|
`;
|
|
666
666
|
}
|
|
667
667
|
case "submit": {
|
|
668
|
-
let e = a ? ` ${
|
|
669
|
-
return `${n}${t ?
|
|
668
|
+
let e = a ? ` ${u("dim", a)}` : "";
|
|
669
|
+
return `${n}${t ? u("gray", J) : ""}${e}`;
|
|
670
670
|
}
|
|
671
671
|
case "cancel": {
|
|
672
|
-
let e = a ? ` ${
|
|
672
|
+
let e = a ? ` ${u(["strikethrough", "dim"], a)}` : "", r = t ? u("gray", J) : "";
|
|
673
673
|
return `${n}${r}${e}${a.trim() ? `
|
|
674
674
|
${r}` : ""}`;
|
|
675
675
|
}
|
|
676
|
-
default: return `${n}${t ? `${
|
|
677
|
-
${t ?
|
|
676
|
+
default: return `${n}${t ? `${u("cyan", J)} ` : ""}${i}
|
|
677
|
+
${t ? u("cyan", Y) : ""}
|
|
678
678
|
`;
|
|
679
679
|
}
|
|
680
680
|
}
|
|
681
681
|
}).prompt();
|
|
682
682
|
//#endregion
|
|
683
683
|
//#region src/node/cli/init.ts
|
|
684
|
-
async function
|
|
685
|
-
let n = !
|
|
686
|
-
await
|
|
684
|
+
async function Re(e, t = {}) {
|
|
685
|
+
let n = !Xe(t);
|
|
686
|
+
await Qe(e, n ? await ze(e, t) : $e(t)), n && Ze(e);
|
|
687
687
|
}
|
|
688
|
-
async function
|
|
689
|
-
|
|
690
|
-
let n = await
|
|
691
|
-
n.hasTypedownYaml && !t.yes && await
|
|
688
|
+
async function ze(e, t) {
|
|
689
|
+
Ne("typedown");
|
|
690
|
+
let n = await Ve(e);
|
|
691
|
+
n.hasTypedownYaml && !t.yes && await Be();
|
|
692
692
|
let r = t.name ?? await Q("Project name", n.packageName ?? s.basename(e));
|
|
693
693
|
return {
|
|
694
694
|
projectName: r,
|
|
@@ -697,9 +697,9 @@ async function Re(e, t) {
|
|
|
697
697
|
siteOrigin: await Q("Site origin (used for sitemap and robots.txt)", "https://example.com")
|
|
698
698
|
};
|
|
699
699
|
}
|
|
700
|
-
async function
|
|
700
|
+
async function Be() {
|
|
701
701
|
X.warn("typedown.yaml already exists in this directory");
|
|
702
|
-
let e = await
|
|
702
|
+
let e = await Ie({
|
|
703
703
|
message: "What would you like to do?",
|
|
704
704
|
options: [{
|
|
705
705
|
value: "scaffold",
|
|
@@ -709,9 +709,9 @@ async function ze() {
|
|
|
709
709
|
label: "Cancel"
|
|
710
710
|
}]
|
|
711
711
|
});
|
|
712
|
-
(
|
|
712
|
+
(H(e) || e === "cancel") && (Me("Cancelled."), process.exit(0));
|
|
713
713
|
}
|
|
714
|
-
async function
|
|
714
|
+
async function Ve(e) {
|
|
715
715
|
let n = {
|
|
716
716
|
hasPackageJson: !1,
|
|
717
717
|
hasTypedownYaml: !1,
|
|
@@ -727,7 +727,13 @@ async function Be(e) {
|
|
|
727
727
|
} catch {}
|
|
728
728
|
return n;
|
|
729
729
|
}
|
|
730
|
-
function
|
|
730
|
+
function He(e) {
|
|
731
|
+
return l(s.join(e, "pnpm-lock.yaml")) ? "pnpm" : l(s.join(e, "yarn.lock")) ? "yarn" : l(s.join(e, "bun.lock")) || l(s.join(e, "bun.lockb")) ? "bun" : "npm";
|
|
732
|
+
}
|
|
733
|
+
function Ue() {
|
|
734
|
+
return "---\n_type: Article\ntitle: \"Built-in components\"\ndescription: \"Components that ship with the default theme\"\n---\n\nTypedown's default theme ships two built-in Vue components you can use in any `.td` file.\n\n## Flashcard\n\nUse a `flashcard` container fence to create a flip card for study or review.\n\n```\n::: flashcard\nWhat does `fref` stand for in Typedown?\n=== key\nFile reference: a typed link from one `.td` node to another.\n:::\n```\n\nThe rendered result is interactive: click or press Space to reveal the answer.\n\n::: flashcard\nWhat does `fref` stand for in Typedown?\n=== key\nFile reference: a typed link from one `.td` node to another.\n:::\n\nThe card starts face-down. Pass `revealed` to start with the answer visible, or `disabled` to prevent flipping.\n\n## Glossary index\n\n`TdGlossaryIndex` renders all sibling pages in the current directory as a searchable, alphabetical index. Place it on a folder's `index.td` page.\n\nInformative mode (default) shows the `description` and `tags` from each page's frontmatter:\n\n```html\n<TdGlossaryIndex />\n```\n\nDense mode renders a compact three-column link list suited for large directories:\n\n```html\n<TdGlossaryIndex mode=\"dense\" />\n```\n\nFor each entry the component reads the `description` and `tags` fields from the page's schema, so make sure your schema exposes them.\n";
|
|
735
|
+
}
|
|
736
|
+
function We() {
|
|
731
737
|
return `<svg fill="none" viewBox="${n}" xmlns="http://www.w3.org/2000/svg">
|
|
732
738
|
<path clip-rule="evenodd" d="${i}" fill-rule="evenodd" fill="${a}"/>
|
|
733
739
|
<path d="${r}" fill="${a}"/>
|
|
@@ -735,7 +741,7 @@ function Ve() {
|
|
|
735
741
|
</svg>
|
|
736
742
|
`;
|
|
737
743
|
}
|
|
738
|
-
function
|
|
744
|
+
function Ge(e) {
|
|
739
745
|
return JSON.stringify({
|
|
740
746
|
name: e.projectName,
|
|
741
747
|
version: "0.0.0",
|
|
@@ -744,21 +750,25 @@ function He(e) {
|
|
|
744
750
|
scripts: {
|
|
745
751
|
dev: "typerighter dev",
|
|
746
752
|
build: "typerighter build",
|
|
747
|
-
preview: "typerighter preview"
|
|
753
|
+
preview: "typerighter preview",
|
|
754
|
+
check: "typerighter check"
|
|
748
755
|
},
|
|
749
|
-
devDependencies: {
|
|
756
|
+
devDependencies: {
|
|
757
|
+
typerighter: "^0.45.0",
|
|
758
|
+
typescript: "^5.0.0"
|
|
759
|
+
}
|
|
750
760
|
}, void 0, 2) + "\n";
|
|
751
761
|
}
|
|
752
|
-
function
|
|
762
|
+
function Ke() {
|
|
753
763
|
return "User-agent: *\nAllow: /\n\nSitemap: /sitemap.xml\n";
|
|
754
764
|
}
|
|
755
|
-
function
|
|
756
|
-
return "---\n_type: Article\ntitle: \"Hello, world\"\n---\n\nWelcome to your new typedown site.\n";
|
|
765
|
+
function qe() {
|
|
766
|
+
return "---\n_type: Article\ntitle: \"Hello, world\"\ndescription: \"The starting point of your vault\"\n---\n\nWelcome to your new typedown site.\n\nRead `components.td` to learn about the built-in components.\n";
|
|
757
767
|
}
|
|
758
|
-
function
|
|
759
|
-
return "---\n_type: schema\nproperties:\n title:\n type: string\n tags:\n type: list[string]
|
|
768
|
+
function Je() {
|
|
769
|
+
return "---\n_type: schema\nproperties:\n title:\n type: string\n description:\n type: string?\n tags:\n type: list[string]?\n---\n";
|
|
760
770
|
}
|
|
761
|
-
function
|
|
771
|
+
function Ye(e) {
|
|
762
772
|
let t = e.siteOrigin === "" ? "" : `\n origin: "${e.siteOrigin}"`;
|
|
763
773
|
return `# yaml-language-server: $schema=./node_modules/typerighter/dist/typedown.schema.json
|
|
764
774
|
version: "1.0.0"
|
|
@@ -769,22 +779,22 @@ site:
|
|
|
769
779
|
description: "${e.siteDescription}"${t}
|
|
770
780
|
`;
|
|
771
781
|
}
|
|
772
|
-
function
|
|
782
|
+
function Xe(e) {
|
|
773
783
|
return e.name !== void 0 && e.title !== void 0 && e.description !== void 0;
|
|
774
784
|
}
|
|
775
|
-
function
|
|
776
|
-
let t = ["Done scaffolding."];
|
|
777
|
-
e !== "." &&
|
|
785
|
+
function Ze(e) {
|
|
786
|
+
let t = He(e), n = t === "npm" ? "npm run dev" : `${t} dev`, r = ["Done scaffolding."];
|
|
787
|
+
e !== "." && r.push(`cd ${e}`), r.push(`${t} install`), r.push(n), Pe(r.join("\n"));
|
|
778
788
|
}
|
|
779
789
|
async function Q(e, t) {
|
|
780
|
-
let n = await
|
|
790
|
+
let n = await Le({
|
|
781
791
|
message: e,
|
|
782
792
|
placeholder: t,
|
|
783
793
|
defaultValue: t
|
|
784
794
|
});
|
|
785
|
-
return
|
|
795
|
+
return H(n) && (Me("Cancelled."), process.exit(0)), n;
|
|
786
796
|
}
|
|
787
|
-
async function
|
|
797
|
+
async function Qe(e, t) {
|
|
788
798
|
let n = s.join(e, "vault"), r = s.join(e, "vault", "_types"), i = s.join(e, "public"), a = s.join(e, ".typedown", ".local");
|
|
789
799
|
await Promise.all([
|
|
790
800
|
c.mkdir(n, { recursive: !0 }),
|
|
@@ -793,15 +803,19 @@ async function Ye(e, t) {
|
|
|
793
803
|
c.mkdir(a, { recursive: !0 })
|
|
794
804
|
]), await $(a, ".gitignore", "*\n", { silent: !0 }), await Promise.all([
|
|
795
805
|
$(e, ".gitignore", "node_modules/\ndist/\n", { silent: !0 }),
|
|
796
|
-
$(e, "package.json",
|
|
797
|
-
$(e, "typedown.yaml",
|
|
798
|
-
$(i, "favicon.svg",
|
|
799
|
-
$(i, "robots.txt",
|
|
806
|
+
$(e, "package.json", Ge(t)),
|
|
807
|
+
$(e, "typedown.yaml", Ye(t)),
|
|
808
|
+
$(i, "favicon.svg", We(), { silent: !0 }),
|
|
809
|
+
$(i, "robots.txt", Ke(), { silent: !0 })
|
|
800
810
|
]);
|
|
801
|
-
let o = await Promise.all([
|
|
811
|
+
let o = await Promise.all([
|
|
812
|
+
$(r, "Article.td", Je(), { silent: !0 }),
|
|
813
|
+
$(n, "hello.td", qe(), { silent: !0 }),
|
|
814
|
+
$(n, "components.td", Ue(), { silent: !0 })
|
|
815
|
+
]), l = o.filter(Boolean), u = o.filter((e) => !e);
|
|
802
816
|
0 < l.length && X.success(`created sample schema and content (${l.length} files)`), 0 < u.length && X.warn(`skipped ${u.length} sample files (already exist)`);
|
|
803
817
|
}
|
|
804
|
-
function
|
|
818
|
+
function $e(e) {
|
|
805
819
|
return {
|
|
806
820
|
projectName: e.name,
|
|
807
821
|
siteTitle: e.title,
|
|
@@ -818,4 +832,4 @@ async function $(e, t, n, r = {}) {
|
|
|
818
832
|
}
|
|
819
833
|
}
|
|
820
834
|
//#endregion
|
|
821
|
-
export {
|
|
835
|
+
export { Re as initialize };
|