@kaynooo/cli-code 0.13.0 → 0.14.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/cli.js +110 -271
- package/dist/hotspots-cli.js +109 -270
- package/dist/peek-cli.js +110 -271
- package/dist/todo-scan-cli.js +109 -270
- package/package.json +5 -2
package/dist/peek-cli.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env -S bun --no-env-file
|
|
1
|
+
#!/usr/bin/env -S bun --no-env-file --config=/dev/null
|
|
2
2
|
// @bun
|
|
3
3
|
|
|
4
4
|
// src/peek-cli.ts
|
|
@@ -9,7 +9,42 @@ import { parseArgs } from "util";
|
|
|
9
9
|
|
|
10
10
|
// ../kit/src/format.ts
|
|
11
11
|
import process7 from "process";
|
|
12
|
-
|
|
12
|
+
// ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-rxztfxgv.js
|
|
13
|
+
var ct = /[aeiou]y$/;
|
|
14
|
+
var N = new Map;
|
|
15
|
+
var Ot = /(?:leaf|loaf|thief|wolf|half|calf|elf|sheaf|scarf|dwarf|hoof|wharf)$/;
|
|
16
|
+
var Gt = /(?:knife|life|wife)$/;
|
|
17
|
+
function K(t, e, { plural: r, zero: n = "singular" } = {}) {
|
|
18
|
+
if (e === 1 || e === 0 && n === "singular")
|
|
19
|
+
return t;
|
|
20
|
+
if (r !== undefined)
|
|
21
|
+
return r;
|
|
22
|
+
if (t.endsWith("y") && !ct.test(t))
|
|
23
|
+
return `${t.slice(0, -1)}ies`;
|
|
24
|
+
if (t.endsWith("s") || t.endsWith("x") || t.endsWith("z") || t.endsWith("ch") || t.endsWith("sh"))
|
|
25
|
+
return `${t}es`;
|
|
26
|
+
if (Ot.test(t))
|
|
27
|
+
return `${t.slice(0, -1)}ves`;
|
|
28
|
+
return Gt.test(t) ? `${t.slice(0, -2)}ves` : `${t}s`;
|
|
29
|
+
}
|
|
30
|
+
function go(t, e, { zero: r = "plural", ...n } = {}) {
|
|
31
|
+
return `${t} ${K(e, t, { ...n, zero: r })}`;
|
|
32
|
+
}
|
|
33
|
+
var Nt = /\s+\S*$/;
|
|
34
|
+
var Y = /\s/;
|
|
35
|
+
function ko(t, e, r = "...") {
|
|
36
|
+
let { suffix: n = "...", includeSuffix: s = false, wordBoundary: o = false } = typeof r === "string" ? { suffix: r } : r;
|
|
37
|
+
if (t.length <= e)
|
|
38
|
+
return t;
|
|
39
|
+
let l = Math.max(0, e), c = t.substring(0, Math.max(0, s ? l - n.length : l));
|
|
40
|
+
if (o && !Y.test(t[c.length] ?? " "))
|
|
41
|
+
c = c.replace(Nt, "") || c;
|
|
42
|
+
if (o)
|
|
43
|
+
c = c.trimEnd();
|
|
44
|
+
return s ? (c + n).slice(0, l) : c + n;
|
|
45
|
+
}
|
|
46
|
+
var be = new Map(["\u20AC", "", "\u201A", "\u0192", "\u201E", "\u2026", "\u2020", "\u2021", "\u02C6", "\u2030", "\u0160", "\u2039", "\u0152", "", "\u017D", "", "", "\u2018", "\u2019", "\u201C", "\u201D", "\u2022", "\u2013", "\u2014", "\u02DC", "\u2122", "\u0161", "\u203A", "\u0153", "", "\u017E", "\u0178"].map((t, e) => [t, 128 + e]).filter(([t]) => t));
|
|
47
|
+
var z = new Map;
|
|
13
48
|
// ../kit/src/mode.ts
|
|
14
49
|
import process2 from "process";
|
|
15
50
|
var MODES = new Set(["terminal", "ci", "agent", "pipe"]);
|
|
@@ -33,266 +68,60 @@ import { resolve as resolve3 } from "path";
|
|
|
33
68
|
import process6 from "process";
|
|
34
69
|
import { pathToFileURL } from "url";
|
|
35
70
|
|
|
36
|
-
// ../../node_modules/.bun/@kaynooo+utils@
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
71
|
+
// ../../node_modules/.bun/@kaynooo+utils@3.0.0+4c7ddab9986847c5/node_modules/@kaynooo/utils/dist/chunk-x450vn3m.js
|
|
72
|
+
var G2 = /^[a-f0-9]+$/i;
|
|
73
|
+
function b(r) {
|
|
74
|
+
let e = r.startsWith("#") ? r.slice(1) : r;
|
|
75
|
+
if (!G2.test(e))
|
|
40
76
|
return [0, 0, 0];
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
let
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (
|
|
56
|
-
return `#${(r << 24 | t << 16 | n << 8 | Math.round((a ?? 1) * 255)).toString(16).padStart(8, "0").toUpperCase()}`;
|
|
57
|
-
return `#${(r << 16 | t << 8 | n).toString(16).padStart(6, "0").toUpperCase()}`;
|
|
58
|
-
}
|
|
59
|
-
function R(s, r, t) {
|
|
60
|
-
s = (s % 360 + 360) % 360, t /= 100;
|
|
61
|
-
let n = r * Math.min(t, 1 - t) / 100, a = (b) => {
|
|
62
|
-
let o = (b + s / 30) % 12, y = t - n * Math.max(Math.min(o - 3, 9 - o, 1), -1);
|
|
63
|
-
return Math.round(255 * y);
|
|
64
|
-
};
|
|
65
|
-
return [a(0), a(8), a(4)];
|
|
66
|
-
}
|
|
67
|
-
function k(s) {
|
|
68
|
-
let [r, t, n] = s;
|
|
69
|
-
r /= 255, t /= 255, n /= 255;
|
|
70
|
-
let a = Math.max(r, t, n), b = Math.min(r, t, n), o = 0, y = 0, c = (a + b) / 2;
|
|
71
|
-
if (a !== b) {
|
|
72
|
-
let u = a - b;
|
|
73
|
-
if (y = c > 0 && c < 1 ? u / (1 - Math.abs(2 * c - 1)) : 0, a === r)
|
|
74
|
-
o = (t - n) / u + (t < n ? 6 : 0);
|
|
75
|
-
else if (a === t)
|
|
76
|
-
o = (n - r) / u + 2;
|
|
77
|
-
else
|
|
78
|
-
o = (r - t) / u + 4;
|
|
79
|
-
o /= 6;
|
|
80
|
-
}
|
|
81
|
-
return [Math.round(o * 360), Math.round(y * 100), Math.round(c * 100)];
|
|
82
|
-
}
|
|
83
|
-
function H(s, r, t) {
|
|
84
|
-
s = (s % 360 + 360) % 360, r /= 100, t /= 100;
|
|
85
|
-
let n = (a) => {
|
|
86
|
-
let b = (a + s / 60) % 6, o = t - t * r * Math.max(Math.min(b, 4 - b, 1), 0);
|
|
87
|
-
return Math.round(255 * o);
|
|
88
|
-
};
|
|
89
|
-
return [n(5), n(3), n(1)];
|
|
90
|
-
}
|
|
91
|
-
function f(s) {
|
|
92
|
-
let [r, t, n] = s;
|
|
93
|
-
r /= 255, t /= 255, n /= 255;
|
|
94
|
-
let a = Math.max(r, t, n), b = Math.min(r, t, n), o = a - b, y = 0, c = a === 0 ? 0 : o / a, u = a;
|
|
95
|
-
if (o !== 0) {
|
|
96
|
-
if (a === r)
|
|
97
|
-
y = (t - n) / o + (t < n ? 6 : 0);
|
|
98
|
-
else if (a === t)
|
|
99
|
-
y = (n - r) / o + 2;
|
|
100
|
-
else
|
|
101
|
-
y = (r - t) / o + 4;
|
|
102
|
-
y /= 6;
|
|
103
|
-
}
|
|
104
|
-
return [Math.round(y * 360), Math.round(c * 100), Math.round(u * 100)];
|
|
105
|
-
}
|
|
106
|
-
function O(s) {
|
|
107
|
-
let r = s[0] / 255, t = s[1] / 255, n = s[2] / 255, a = 1 - Math.max(r, t, n);
|
|
108
|
-
if (a === 1)
|
|
109
|
-
return [0, 0, 0, 100];
|
|
110
|
-
let b = (1 - r - a) / (1 - a), o = (1 - t - a) / (1 - a), y = (1 - n - a) / (1 - a);
|
|
111
|
-
return [Math.round(b * 100), Math.round(o * 100), Math.round(y * 100), Math.round(a * 100)];
|
|
112
|
-
}
|
|
113
|
-
function v(s, r, t, n) {
|
|
114
|
-
return s /= 100, r /= 100, t /= 100, n /= 100, [Math.round(255 * (1 - s) * (1 - n)), Math.round(255 * (1 - r) * (1 - n)), Math.round(255 * (1 - t) * (1 - n))];
|
|
115
|
-
}
|
|
116
|
-
var m = (s) => s <= 0.04045 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
|
|
117
|
-
var p = (s) => s <= 0.0031308 ? 12.92 * s : 1.055 * s ** 0.4166666666666667 - 0.055;
|
|
118
|
-
var i = (s, r) => Math.round(s * 10 ** r) / 10 ** r;
|
|
119
|
-
function T(s) {
|
|
120
|
-
let r = m(s[0] / 255), t = m(s[1] / 255), n = m(s[2] / 255), a = Math.cbrt(0.4122214708 * r + 0.5363325363 * t + 0.0514459929 * n), b = Math.cbrt(0.2119034982 * r + 0.6806995451 * t + 0.1073969566 * n), o = Math.cbrt(0.0883024619 * r + 0.2817188376 * t + 0.6299787005 * n);
|
|
121
|
-
return [i(0.2104542553 * a + 0.793617785 * b - 0.0040720468 * o, 4), i(1.9779984951 * a - 2.428592205 * b + 0.4505937099 * o, 4), i(0.0259040371 * a + 0.7827717662 * b - 0.808675766 * o, 4)];
|
|
122
|
-
}
|
|
123
|
-
function M(s, r, t) {
|
|
124
|
-
let n = (s + 0.3963377774 * r + 0.2158037573 * t) ** 3, a = (s - 0.1055613458 * r - 0.0638541728 * t) ** 3, b = (s - 0.0894841775 * r - 1.291485548 * t) ** 3, o = p(4.0767416621 * n - 3.3077115913 * a + 0.2309699292 * b), y = p(-1.2684380046 * n + 2.6097574011 * a - 0.3413193965 * b), c = p(-0.0041960863 * n - 0.7034186147 * a + 1.707614701 * b), u = (h) => Math.min(255, Math.max(0, Math.round(h * 255)));
|
|
125
|
-
return [u(o), u(y), u(c)];
|
|
126
|
-
}
|
|
127
|
-
function d(s) {
|
|
128
|
-
let [r, t, n] = T(s), a = Math.sqrt(t * t + n * n), b = (Math.atan2(n, t) * 180 / Math.PI + 360) % 360;
|
|
129
|
-
return [i(r, 4), i(a, 4), i(b, 2)];
|
|
130
|
-
}
|
|
131
|
-
function C(s, r, t) {
|
|
132
|
-
let n = t * Math.PI / 180;
|
|
133
|
-
return M(s, r * Math.cos(n), r * Math.sin(n));
|
|
134
|
-
}
|
|
135
|
-
function l(s) {
|
|
136
|
-
let r = s / 255;
|
|
137
|
-
return r <= 0.03928 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
class e {
|
|
141
|
-
r;
|
|
142
|
-
g;
|
|
143
|
-
b;
|
|
144
|
-
a;
|
|
145
|
-
constructor(s, r, t, n = 1) {
|
|
146
|
-
this.r = s, this.g = r, this.b = t, this.a = n;
|
|
147
|
-
}
|
|
148
|
-
static from(s, r) {
|
|
149
|
-
if (s === "hex") {
|
|
150
|
-
let [t, n, a, b] = x(r);
|
|
151
|
-
return new e(t, n, a, b);
|
|
152
|
-
}
|
|
153
|
-
if (s === "rgb") {
|
|
154
|
-
if (Array.isArray(r)) {
|
|
155
|
-
let [o, y, c, u] = r;
|
|
156
|
-
return new e(o, y, c, u);
|
|
157
|
-
}
|
|
158
|
-
let { r: t, g: n, b: a, a: b } = r;
|
|
159
|
-
return new e(t, n, a, b);
|
|
160
|
-
}
|
|
161
|
-
if (s === "hsl") {
|
|
162
|
-
let t, n, a, b;
|
|
163
|
-
if (Array.isArray(r))
|
|
164
|
-
[t, n, a, b] = r;
|
|
165
|
-
else
|
|
166
|
-
({ h: t, s: n, l: a, a: b } = r);
|
|
167
|
-
let [o, y, c] = R(t, n, a);
|
|
168
|
-
return new e(o, y, c, b);
|
|
169
|
-
}
|
|
170
|
-
if (s === "hsv") {
|
|
171
|
-
let t, n, a, b;
|
|
172
|
-
if (Array.isArray(r))
|
|
173
|
-
[t, n, a, b] = r;
|
|
174
|
-
else
|
|
175
|
-
({ h: t, s: n, v: a, a: b } = r);
|
|
176
|
-
let [o, y, c] = H(t, n, a);
|
|
177
|
-
return new e(o, y, c, b);
|
|
178
|
-
}
|
|
179
|
-
if (s === "cmyk") {
|
|
180
|
-
let t, n, a, b, o;
|
|
181
|
-
if (Array.isArray(r))
|
|
182
|
-
[t, n, a, b, o] = r;
|
|
183
|
-
else
|
|
184
|
-
({ c: t, m: n, y: a, k: b, a: o } = r);
|
|
185
|
-
let [y, c, u] = v(t, n, a, b);
|
|
186
|
-
return new e(y, c, u, o);
|
|
187
|
-
}
|
|
188
|
-
if (s === "oklch") {
|
|
189
|
-
let t, n, a, b;
|
|
190
|
-
if (Array.isArray(r))
|
|
191
|
-
[t, n, a, b] = r;
|
|
192
|
-
else
|
|
193
|
-
({ l: t, c: n, h: a, a: b } = r);
|
|
194
|
-
let [o, y, c] = C(t, n, a);
|
|
195
|
-
return new e(o, y, c, b);
|
|
196
|
-
}
|
|
197
|
-
if (s === "oklab") {
|
|
198
|
-
let t, n, a, b;
|
|
199
|
-
if (Array.isArray(r))
|
|
200
|
-
[t, n, a, b] = r;
|
|
201
|
-
else
|
|
202
|
-
({ l: t, a: n, b: a, alpha: b } = r);
|
|
203
|
-
let [o, y, c] = M(t, n, a);
|
|
204
|
-
return new e(o, y, c, b);
|
|
205
|
-
}
|
|
206
|
-
throw Error("Invalid input");
|
|
207
|
-
}
|
|
208
|
-
to(s) {
|
|
209
|
-
switch (s) {
|
|
210
|
-
case "rgb":
|
|
211
|
-
return [this.r, this.g, this.b];
|
|
212
|
-
case "rgba":
|
|
213
|
-
return [this.r, this.g, this.b, this.a];
|
|
214
|
-
case "hex":
|
|
215
|
-
return A([this.r, this.g, this.b]);
|
|
216
|
-
case "hexa":
|
|
217
|
-
return A([this.r, this.g, this.b, this.a]);
|
|
218
|
-
case "hsl":
|
|
219
|
-
return k([this.r, this.g, this.b]);
|
|
220
|
-
case "hsla":
|
|
221
|
-
return [...k([this.r, this.g, this.b]), this.a];
|
|
222
|
-
case "hsv":
|
|
223
|
-
return f([this.r, this.g, this.b]);
|
|
224
|
-
case "hsva":
|
|
225
|
-
return [...f([this.r, this.g, this.b]), this.a];
|
|
226
|
-
case "cmyk":
|
|
227
|
-
return O([this.r, this.g, this.b]);
|
|
228
|
-
case "cmyka":
|
|
229
|
-
return [...O([this.r, this.g, this.b]), this.a];
|
|
230
|
-
case "oklch":
|
|
231
|
-
return d([this.r, this.g, this.b]);
|
|
232
|
-
case "oklcha":
|
|
233
|
-
return [...d([this.r, this.g, this.b]), this.a];
|
|
234
|
-
case "oklab":
|
|
235
|
-
return T([this.r, this.g, this.b]);
|
|
236
|
-
case "oklaba":
|
|
237
|
-
return [...T([this.r, this.g, this.b]), this.a];
|
|
238
|
-
default:
|
|
239
|
-
return [this.r, this.g, this.b];
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
getLuminance() {
|
|
243
|
-
let s = l(this.r), r = l(this.g), t = l(this.b);
|
|
244
|
-
return 0.2126 * s + 0.7152 * r + 0.0722 * t;
|
|
245
|
-
}
|
|
246
|
-
contrastRatio(s) {
|
|
247
|
-
let r = this.getLuminance(), t = s.getLuminance(), [n, a] = r >= t ? [r, t] : [t, r];
|
|
248
|
-
return (n + 0.05) / (a + 0.05);
|
|
249
|
-
}
|
|
250
|
-
bestContrastForeground() {
|
|
251
|
-
let s = new e(255, 255, 255, 1), r = new e(0, 0, 0, 1), t = this.contrastRatio(s), n = this.contrastRatio(r);
|
|
252
|
-
return t >= n ? s : r;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
// ../../node_modules/.bun/@kaynooo+utils@2.31.2+d0769e28dc4dad16/node_modules/@kaynooo/utils/dist/chunk-y1msbssb.js
|
|
257
|
-
var r = 39;
|
|
258
|
-
var o = 49;
|
|
259
|
-
var f2 = "\x1B[";
|
|
260
|
-
var C2 = { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29], black: [30, r], red: [31, r], green: [32, r], yellow: [33, r], blue: [34, r], magenta: [35, r], cyan: [36, r], white: [37, r], gray: [90, r], grey: [90, r], blackBright: [90, r], redBright: [91, r], greenBright: [92, r], yellowBright: [93, r], blueBright: [94, r], magentaBright: [95, r], cyanBright: [96, r], whiteBright: [97, r], bgBlack: [40, o], bgRed: [41, o], bgGreen: [42, o], bgYellow: [43, o], bgBlue: [44, o], bgMagenta: [45, o], bgCyan: [46, o], bgWhite: [47, o], bgBlackBright: [100, o], bgRedBright: [101, o], bgGreenBright: [102, o], bgYellowBright: [103, o], bgBlueBright: [104, o], bgMagentaBright: [105, o], bgCyanBright: [106, o], bgWhiteBright: [107, o], rgb: (i, n, a, l = "fg") => [`${l === "fg" ? 38 : 48};2;${i};${n};${a}`, l === "fg" ? r : o], hex: (i, n = "fg") => {
|
|
261
|
-
let [a, l, s] = e.from("hex", i).to("rgb");
|
|
262
|
-
return [`${n === "fg" ? 38 : 48};2;${a};${l};${s}`, n === "fg" ? r : o];
|
|
263
|
-
}, ansi256: (i, n = "fg") => [`${n === "fg" ? 38 : 48};5;${i}`, n === "fg" ? r : o] };
|
|
264
|
-
var b = new Set(["", "1", "2", "3", "true"]);
|
|
265
|
-
function h(i, n = globalThis.process?.env ?? {}) {
|
|
266
|
-
if (n.FORCE_COLOR !== undefined)
|
|
267
|
-
return b.has(n.FORCE_COLOR);
|
|
268
|
-
if (n.NO_COLOR !== undefined || n.NODE_DISABLE_COLORS !== undefined || n.TERM === "dumb")
|
|
77
|
+
if (e.length === 3 || e.length === 4)
|
|
78
|
+
return [Number.parseInt(e[0] + e[0], 16), Number.parseInt(e[1] + e[1], 16), Number.parseInt(e[2] + e[2], 16)];
|
|
79
|
+
if (e.length !== 6 && e.length !== 8)
|
|
80
|
+
throw Error(`Invalid hex color length: ${e.length}`);
|
|
81
|
+
return [Number.parseInt(e.slice(0, 2), 16), Number.parseInt(e.slice(2, 4), 16), Number.parseInt(e.slice(4, 6), 16)];
|
|
82
|
+
}
|
|
83
|
+
var B2 = { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29], black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], gray: [90, 39], grey: [90, 39], blackBright: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39], whiteBright: [97, 39], bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], bgBlackBright: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49], rgb: (r, e, l, n = "fg") => [`${n === "fg" ? 38 : 48};2;${r};${e};${l}`, n === "fg" ? 39 : 49], hex: (r, e = "fg") => {
|
|
84
|
+
let [l, n, c] = b(r);
|
|
85
|
+
return [`${e === "fg" ? 38 : 48};2;${l};${n};${c}`, e === "fg" ? 39 : 49];
|
|
86
|
+
}, ansi256: (r, e = "fg") => [`${e === "fg" ? 38 : 48};5;${r}`, e === "fg" ? 39 : 49] };
|
|
87
|
+
var h = new Set(["", "1", "2", "3", "true"]);
|
|
88
|
+
function C(r, e = globalThis.process?.env ?? {}) {
|
|
89
|
+
if (e.FORCE_COLOR !== undefined)
|
|
90
|
+
return h.has(e.FORCE_COLOR);
|
|
91
|
+
if (e.NO_COLOR !== undefined || e.NODE_DISABLE_COLORS !== undefined || e.TERM === "dumb")
|
|
269
92
|
return false;
|
|
270
|
-
return
|
|
271
|
-
}
|
|
272
|
-
function
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
if (
|
|
286
|
-
return
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
93
|
+
return r?.isTTY === true;
|
|
94
|
+
}
|
|
95
|
+
function f2(r, e = []) {
|
|
96
|
+
let l = "", n = "";
|
|
97
|
+
for (let t = 0, i = e.length;t < i; t++)
|
|
98
|
+
l += `\x1B[${e[t][0]}m`, n = `\x1B[${e[t][1]}m${n}`;
|
|
99
|
+
let c = (t) => C(r.stream ?? globalThis.process?.stdout, r.env) ? l + t + n : t, g = new Map;
|
|
100
|
+
return new Proxy(c, { get(t, i) {
|
|
101
|
+
let a = B2[i];
|
|
102
|
+
if (Array.isArray(a)) {
|
|
103
|
+
let s = g.get(i);
|
|
104
|
+
if (s === undefined)
|
|
105
|
+
s = f2(r, [...e, a]), g.set(i, s);
|
|
106
|
+
return s;
|
|
107
|
+
}
|
|
108
|
+
if (typeof a === "function")
|
|
109
|
+
return (...s) => {
|
|
110
|
+
let y = `${i}:${s.join(",")}`, u = g.get(y);
|
|
111
|
+
if (u === undefined) {
|
|
112
|
+
if (g.size >= 64)
|
|
113
|
+
g.clear();
|
|
114
|
+
u = f2(r, [...e, a(...s)]), g.set(y, u);
|
|
115
|
+
}
|
|
116
|
+
return u;
|
|
117
|
+
};
|
|
118
|
+
throw Error(`Unknown style: ${String(i)}`);
|
|
290
119
|
} });
|
|
291
120
|
}
|
|
292
|
-
function
|
|
293
|
-
return
|
|
121
|
+
function Fe2(r = {}) {
|
|
122
|
+
return f2(r);
|
|
294
123
|
}
|
|
295
|
-
var
|
|
124
|
+
var o2 = Fe2();
|
|
296
125
|
|
|
297
126
|
// ../kit/src/theme.ts
|
|
298
127
|
import { existsSync as existsSync2, readFileSync, statSync } from "fs";
|
|
@@ -328,19 +157,21 @@ function userConfigPath(bin, where = {}) {
|
|
|
328
157
|
}
|
|
329
158
|
|
|
330
159
|
// ../kit/src/theme.ts
|
|
160
|
+
var ENDS = new Map;
|
|
331
161
|
var DEFAULT = {
|
|
332
|
-
colors: { accent: "cyan", id: "yellow", path: "blue", label: "dim", value: "bold", ok: "green", warn: "yellow", problem: "red", note: "dim", passed: "green", failed: "red", running: "cyan", queued: "yellow", skipped: "dim" },
|
|
333
|
-
glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501", rule: "\u2500", corner: "\u256D" },
|
|
162
|
+
colors: { accent: "cyan", id: "yellow", path: "blue", label: "dim", value: "bold", ok: "green", warn: "yellow", problem: "red", note: "dim", plan: "magenta", passed: "green", failed: "red", running: "cyan", queued: "yellow", skipped: "dim" },
|
|
163
|
+
glyphs: { ok: "\u2713", warn: "\u25B2", problem: "\u2717", note: "\u203A", plan: "\u25C7", passed: "\u2713", failed: "\u2717", running: "\u25CF", queued: "\u25CB", skipped: "-", bar: "\u2501", rule: "\u2500", corner: "\u256D", open: "\u2022", leaf: "\xB7", guide: "\u2502" },
|
|
334
164
|
accents: ["cyan", "magenta", "green", "blue", "yellow", "redBright"],
|
|
335
|
-
bins: {}
|
|
165
|
+
bins: {},
|
|
166
|
+
gradient: ["#c084fc", "#67e8f9"]
|
|
336
167
|
};
|
|
337
|
-
var BRIGHT = { accent: "cyanBright", id: "yellowBright", path: "blueBright", label: "white", value: "bold whiteBright", ok: "greenBright", warn: "yellowBright", problem: "redBright", note: "white", passed: "greenBright", failed: "redBright", running: "cyanBright", queued: "yellowBright", skipped: "white" };
|
|
338
|
-
var MONO = { accent: "bold", id: "bold", path: "underline", label: "dim", value: "bold", ok: "bold", warn: "bold", problem: "bold", note: "dim", passed: "bold", failed: "bold", running: "bold", queued: "dim", skipped: "dim" };
|
|
339
|
-
var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#", rule: "-", corner: "+" };
|
|
168
|
+
var BRIGHT = { accent: "cyanBright", id: "yellowBright", path: "blueBright", label: "white", value: "bold whiteBright", ok: "greenBright", warn: "yellowBright", problem: "redBright", note: "white", plan: "magentaBright", passed: "greenBright", failed: "redBright", running: "cyanBright", queued: "yellowBright", skipped: "white" };
|
|
169
|
+
var MONO = { accent: "bold", id: "bold", path: "underline", label: "dim", value: "bold", ok: "bold", warn: "bold", problem: "bold", note: "dim", plan: "dim", passed: "bold", failed: "bold", running: "bold", queued: "dim", skipped: "dim" };
|
|
170
|
+
var ASCII = { ok: "+", warn: "!", problem: "x", note: ">", plan: "?", passed: "+", failed: "x", running: "*", queued: "o", skipped: "-", bar: "#", rule: "-", corner: "+", open: "*", leaf: "-", guide: "|" };
|
|
340
171
|
var PRESETS = {
|
|
341
172
|
default: {},
|
|
342
|
-
"high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"] },
|
|
343
|
-
mono: { colors: MONO, accents: ["bold"] },
|
|
173
|
+
"high-contrast": { colors: BRIGHT, accents: ["cyanBright", "magentaBright", "greenBright", "blueBright", "yellowBright", "redBright"], gradient: ["#d8b4fe", "#a5f3fc"] },
|
|
174
|
+
mono: { colors: MONO, accents: ["bold"], gradient: undefined },
|
|
344
175
|
ascii: { glyphs: ASCII }
|
|
345
176
|
};
|
|
346
177
|
var STYLES = new Set(["bold", "dim", "italic", "underline", "inverse", "strikethrough", "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "gray", "grey", "blackBright", "redBright", "greenBright", "yellowBright", "blueBright", "magentaBright", "cyanBright", "whiteBright"]);
|
|
@@ -411,6 +242,8 @@ function applyPreset(theme, name, warn, where) {
|
|
|
411
242
|
Object.assign(theme.glyphs, preset.glyphs);
|
|
412
243
|
if (preset.accents !== undefined)
|
|
413
244
|
theme.accents = [...preset.accents];
|
|
245
|
+
if (Object.hasOwn(preset, "gradient"))
|
|
246
|
+
theme.gradient = preset.gradient;
|
|
414
247
|
return name;
|
|
415
248
|
}
|
|
416
249
|
function applyFile(theme, file, where, warn) {
|
|
@@ -438,6 +271,12 @@ function applyFile(theme, file, where, warn) {
|
|
|
438
271
|
theme.accents = [...file.accents];
|
|
439
272
|
else if (file.accents !== undefined)
|
|
440
273
|
warn(`${where}: accents must be a non-empty list of colours`);
|
|
274
|
+
if (file.gradient === null)
|
|
275
|
+
theme.gradient = undefined;
|
|
276
|
+
else if (Array.isArray(file.gradient) && file.gradient.length === 2 && file.gradient.every((end) => typeof end === "string" && HEX.test(end)))
|
|
277
|
+
theme.gradient = [file.gradient[0], file.gradient[1]];
|
|
278
|
+
else if (file.gradient !== undefined)
|
|
279
|
+
warn(`${where}: gradient must be two \`#rrggbb\` colours, or null for none`);
|
|
441
280
|
if (isRecord(file.bins)) {
|
|
442
281
|
for (const [bin, value] of Object.entries(file.bins)) {
|
|
443
282
|
if (isColorSpec(value))
|
|
@@ -461,7 +300,7 @@ function isPath(chosen) {
|
|
|
461
300
|
return chosen.includes("/") || chosen.endsWith(".json");
|
|
462
301
|
}
|
|
463
302
|
function loadTheme({ env = process5.env, from = process5.cwd(), home = homedir2(), warn = warnOnce } = {}) {
|
|
464
|
-
const theme = { colors: { ...DEFAULT.colors }, glyphs: { ...DEFAULT.glyphs }, accents: [...DEFAULT.accents], bins: Object.create(null) };
|
|
303
|
+
const theme = { colors: { ...DEFAULT.colors }, glyphs: { ...DEFAULT.glyphs }, accents: [...DEFAULT.accents], bins: Object.create(null), gradient: DEFAULT.gradient };
|
|
465
304
|
const sources = [];
|
|
466
305
|
const chosen = env.KIT_THEME ?? "";
|
|
467
306
|
const wanted = chosen === "" ? [userConfigPath("theme", { home, xdg: env.XDG_CONFIG_HOME }), findUp(join3(".kaynooo", "theme.json"), from, endsWalk(home))] : [];
|
|
@@ -499,12 +338,12 @@ function activeTheme() {
|
|
|
499
338
|
}
|
|
500
339
|
|
|
501
340
|
// ../kit/src/style.ts
|
|
502
|
-
var MARK_WORDS = { ok: "ok:", warn: "warning:", problem: "error:", note: "note:" };
|
|
341
|
+
var MARK_WORDS = { ok: "ok:", warn: "warning:", problem: "error:", note: "note:", plan: "would:" };
|
|
503
342
|
function takesControlCodes(stream, env = process6.env) {
|
|
504
343
|
return stream.isTTY === true && env.NO_COLOR === undefined && env.NODE_DISABLE_COLORS === undefined && env.TERM !== "dumb" && outputMode(stream, env) === "terminal";
|
|
505
344
|
}
|
|
506
345
|
function paint(stream, env = process6.env) {
|
|
507
|
-
return
|
|
346
|
+
return Fe2({ stream: { isTTY: takesControlCodes(stream, env) }, env });
|
|
508
347
|
}
|
|
509
348
|
function marked(mark, text, stream, detail, env = process6.env) {
|
|
510
349
|
const colors = paint(stream, env);
|
|
@@ -551,7 +390,7 @@ function printHeader(bin, context, stream = process6.stdout, env = process6.env)
|
|
|
551
390
|
console.log(line);
|
|
552
391
|
}
|
|
553
392
|
function hyperlink(text, url, stream, env = process6.env) {
|
|
554
|
-
return takesControlCodes(stream, env) ? link(text, url, stream, env) : text;
|
|
393
|
+
return takesControlCodes(stream, env) ? paint(stream, env).underline(link(text, url, stream, env)) : text;
|
|
555
394
|
}
|
|
556
395
|
function fileLink(text, path, stream, from = process6.cwd(), env = process6.env) {
|
|
557
396
|
return hyperlink(text, pathToFileURL(resolve3(from, path)).href, stream, env);
|
|
@@ -563,7 +402,7 @@ function upTo(text, separator) {
|
|
|
563
402
|
return end === -1 ? text : text.slice(0, end);
|
|
564
403
|
}
|
|
565
404
|
function truncate(text, width) {
|
|
566
|
-
return text
|
|
405
|
+
return ko(text, width, { suffix: "\u2026", includeSuffix: true });
|
|
567
406
|
}
|
|
568
407
|
var LINE_BREAKS = /\s*\n\s*/g;
|
|
569
408
|
var ESCAPE = String.fromCharCode(27);
|
|
@@ -1749,7 +1588,7 @@ async function spanOf(target) {
|
|
|
1749
1588
|
if (from < 1 || to < from)
|
|
1750
1589
|
badUsage(`${target}: a span reads <file>:<from>-<to>, from 1 and from <= to`);
|
|
1751
1590
|
if (from > count)
|
|
1752
|
-
fail(`${path} has ${count
|
|
1591
|
+
fail(`${path} has ${go(count, "line")}, ${target} starts past the end`, 1);
|
|
1753
1592
|
return { path, from, to: Math.min(to, count) };
|
|
1754
1593
|
}
|
|
1755
1594
|
async function* sources(paths) {
|