@rotorsoft/act-diagram 2.0.1 → 2.0.3
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/README.md +1 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/@types/client/lib/layout.d.ts +2 -2
- package/dist/@types/client/lib/layout.d.ts.map +1 -1
- package/dist/@types/client/lib/loads.d.ts +0 -2
- package/dist/@types/client/lib/loads.d.ts.map +1 -1
- package/dist/cli/act.js +213 -217
- package/dist/cli/act.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
package/dist/cli/act.js
CHANGED
|
@@ -42,13 +42,13 @@ var require_picocolors = __commonJS({
|
|
|
42
42
|
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
43
43
|
};
|
|
44
44
|
var replaceClose = (string, close, replace, index) => {
|
|
45
|
-
let result = "",
|
|
45
|
+
let result = "", cursor2 = 0;
|
|
46
46
|
do {
|
|
47
|
-
result += string.substring(
|
|
48
|
-
|
|
49
|
-
index = string.indexOf(close,
|
|
47
|
+
result += string.substring(cursor2, index) + replace;
|
|
48
|
+
cursor2 = index + close.length;
|
|
49
|
+
index = string.indexOf(close, cursor2);
|
|
50
50
|
} while (~index);
|
|
51
|
-
return result + string.substring(
|
|
51
|
+
return result + string.substring(cursor2);
|
|
52
52
|
};
|
|
53
53
|
var createColors = (enabled = isColorSupported) => {
|
|
54
54
|
let f = enabled ? formatter : () => String;
|
|
@@ -102,62 +102,6 @@ var require_picocolors = __commonJS({
|
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
|
|
105
|
-
// ../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
|
|
106
|
-
var require_src = __commonJS({
|
|
107
|
-
"../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports, module) {
|
|
108
|
-
"use strict";
|
|
109
|
-
var ESC3 = "\x1B";
|
|
110
|
-
var CSI2 = `${ESC3}[`;
|
|
111
|
-
var beep = "\x07";
|
|
112
|
-
var cursor3 = {
|
|
113
|
-
to(x, y2) {
|
|
114
|
-
if (!y2) return `${CSI2}${x + 1}G`;
|
|
115
|
-
return `${CSI2}${y2 + 1};${x + 1}H`;
|
|
116
|
-
},
|
|
117
|
-
move(x, y2) {
|
|
118
|
-
let ret = "";
|
|
119
|
-
if (x < 0) ret += `${CSI2}${-x}D`;
|
|
120
|
-
else if (x > 0) ret += `${CSI2}${x}C`;
|
|
121
|
-
if (y2 < 0) ret += `${CSI2}${-y2}A`;
|
|
122
|
-
else if (y2 > 0) ret += `${CSI2}${y2}B`;
|
|
123
|
-
return ret;
|
|
124
|
-
},
|
|
125
|
-
up: (count = 1) => `${CSI2}${count}A`,
|
|
126
|
-
down: (count = 1) => `${CSI2}${count}B`,
|
|
127
|
-
forward: (count = 1) => `${CSI2}${count}C`,
|
|
128
|
-
backward: (count = 1) => `${CSI2}${count}D`,
|
|
129
|
-
nextLine: (count = 1) => `${CSI2}E`.repeat(count),
|
|
130
|
-
prevLine: (count = 1) => `${CSI2}F`.repeat(count),
|
|
131
|
-
left: `${CSI2}G`,
|
|
132
|
-
hide: `${CSI2}?25l`,
|
|
133
|
-
show: `${CSI2}?25h`,
|
|
134
|
-
save: `${ESC3}7`,
|
|
135
|
-
restore: `${ESC3}8`
|
|
136
|
-
};
|
|
137
|
-
var scroll = {
|
|
138
|
-
up: (count = 1) => `${CSI2}S`.repeat(count),
|
|
139
|
-
down: (count = 1) => `${CSI2}T`.repeat(count)
|
|
140
|
-
};
|
|
141
|
-
var erase3 = {
|
|
142
|
-
screen: `${CSI2}2J`,
|
|
143
|
-
up: (count = 1) => `${CSI2}1J`.repeat(count),
|
|
144
|
-
down: (count = 1) => `${CSI2}J`.repeat(count),
|
|
145
|
-
line: `${CSI2}2K`,
|
|
146
|
-
lineEnd: `${CSI2}K`,
|
|
147
|
-
lineStart: `${CSI2}1K`,
|
|
148
|
-
lines(count) {
|
|
149
|
-
let clear = "";
|
|
150
|
-
for (let i2 = 0; i2 < count; i2++)
|
|
151
|
-
clear += this.line + (i2 < count - 1 ? cursor3.up() : "");
|
|
152
|
-
if (count)
|
|
153
|
-
clear += cursor3.left;
|
|
154
|
-
return clear;
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
module.exports = { cursor: cursor3, scroll, erase: erase3, beep };
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
|
|
161
105
|
// src/cli/index.ts
|
|
162
106
|
import { resolve as resolve4 } from "path";
|
|
163
107
|
|
|
@@ -165,21 +109,21 @@ import { resolve as resolve4 } from "path";
|
|
|
165
109
|
import { transform } from "sucrase";
|
|
166
110
|
|
|
167
111
|
// src/client/lib/schema-extract.ts
|
|
168
|
-
var is_w_s = (
|
|
169
|
-
var is_ident = (
|
|
112
|
+
var is_w_s = (c3) => c3 === " " || c3 === " " || c3 === "\n" || c3 === "\r";
|
|
113
|
+
var is_ident = (c3) => !!c3 && /[\w$]/.test(c3);
|
|
170
114
|
function skip_trivia(src, from) {
|
|
171
115
|
let i2 = from;
|
|
172
116
|
while (i2 < src.length) {
|
|
173
|
-
const
|
|
174
|
-
if (is_w_s(
|
|
117
|
+
const c3 = src[i2];
|
|
118
|
+
if (is_w_s(c3)) {
|
|
175
119
|
i2++;
|
|
176
120
|
continue;
|
|
177
121
|
}
|
|
178
|
-
if (
|
|
122
|
+
if (c3 === "/" && src[i2 + 1] === "/") {
|
|
179
123
|
while (i2 < src.length && src[i2] !== "\n") i2++;
|
|
180
124
|
continue;
|
|
181
125
|
}
|
|
182
|
-
if (
|
|
126
|
+
if (c3 === "/" && src[i2 + 1] === "*") {
|
|
183
127
|
i2 += 2;
|
|
184
128
|
while (i2 < src.length && !(src[i2 - 1] === "*" && src[i2] === "/")) i2++;
|
|
185
129
|
i2++;
|
|
@@ -193,9 +137,9 @@ function read_value(src, start) {
|
|
|
193
137
|
let i2 = start;
|
|
194
138
|
let depth = 0;
|
|
195
139
|
while (i2 < src.length) {
|
|
196
|
-
const
|
|
197
|
-
if (
|
|
198
|
-
const q =
|
|
140
|
+
const c3 = src[i2];
|
|
141
|
+
if (c3 === '"' || c3 === "'") {
|
|
142
|
+
const q = c3;
|
|
199
143
|
i2++;
|
|
200
144
|
while (i2 < src.length && src[i2] !== q) {
|
|
201
145
|
if (src[i2] === "\\") {
|
|
@@ -207,7 +151,7 @@ function read_value(src, start) {
|
|
|
207
151
|
i2++;
|
|
208
152
|
continue;
|
|
209
153
|
}
|
|
210
|
-
if (
|
|
154
|
+
if (c3 === "`") {
|
|
211
155
|
i2++;
|
|
212
156
|
while (i2 < src.length && src[i2] !== "`") {
|
|
213
157
|
if (src[i2] === "\\") {
|
|
@@ -230,33 +174,33 @@ function read_value(src, start) {
|
|
|
230
174
|
i2++;
|
|
231
175
|
continue;
|
|
232
176
|
}
|
|
233
|
-
if (
|
|
177
|
+
if (c3 === "/" && src[i2 + 1] === "/") {
|
|
234
178
|
while (i2 < src.length && src[i2] !== "\n") i2++;
|
|
235
179
|
continue;
|
|
236
180
|
}
|
|
237
|
-
if (
|
|
181
|
+
if (c3 === "/" && src[i2 + 1] === "*") {
|
|
238
182
|
i2 += 2;
|
|
239
183
|
while (i2 < src.length && !(src[i2 - 1] === "*" && src[i2] === "/")) i2++;
|
|
240
184
|
i2++;
|
|
241
185
|
continue;
|
|
242
186
|
}
|
|
243
|
-
if (
|
|
187
|
+
if (c3 === "(" || c3 === "{" || c3 === "[") {
|
|
244
188
|
depth++;
|
|
245
189
|
i2++;
|
|
246
190
|
continue;
|
|
247
191
|
}
|
|
248
|
-
if (
|
|
192
|
+
if (c3 === ")" || c3 === "]") {
|
|
249
193
|
depth--;
|
|
250
194
|
i2++;
|
|
251
195
|
continue;
|
|
252
196
|
}
|
|
253
|
-
if (
|
|
197
|
+
if (c3 === "}") {
|
|
254
198
|
if (depth === 0) return i2;
|
|
255
199
|
depth--;
|
|
256
200
|
i2++;
|
|
257
201
|
continue;
|
|
258
202
|
}
|
|
259
|
-
if (
|
|
203
|
+
if (c3 === "," && depth === 0) return i2;
|
|
260
204
|
i2++;
|
|
261
205
|
}
|
|
262
206
|
return i2;
|
|
@@ -316,9 +260,9 @@ function read_top_level_expression(src, start) {
|
|
|
316
260
|
let i2 = start;
|
|
317
261
|
let depth = 0;
|
|
318
262
|
while (i2 < src.length) {
|
|
319
|
-
const
|
|
320
|
-
if (
|
|
321
|
-
const q =
|
|
263
|
+
const c3 = src[i2];
|
|
264
|
+
if (c3 === '"' || c3 === "'") {
|
|
265
|
+
const q = c3;
|
|
322
266
|
i2++;
|
|
323
267
|
while (i2 < src.length && src[i2] !== q) {
|
|
324
268
|
if (src[i2] === "\\") {
|
|
@@ -330,7 +274,7 @@ function read_top_level_expression(src, start) {
|
|
|
330
274
|
i2++;
|
|
331
275
|
continue;
|
|
332
276
|
}
|
|
333
|
-
if (
|
|
277
|
+
if (c3 === "`") {
|
|
334
278
|
i2++;
|
|
335
279
|
while (i2 < src.length && src[i2] !== "`") {
|
|
336
280
|
if (src[i2] === "\\") {
|
|
@@ -353,27 +297,27 @@ function read_top_level_expression(src, start) {
|
|
|
353
297
|
i2++;
|
|
354
298
|
continue;
|
|
355
299
|
}
|
|
356
|
-
if (
|
|
300
|
+
if (c3 === "/" && src[i2 + 1] === "/") {
|
|
357
301
|
while (i2 < src.length && src[i2] !== "\n") i2++;
|
|
358
302
|
continue;
|
|
359
303
|
}
|
|
360
|
-
if (
|
|
304
|
+
if (c3 === "/" && src[i2 + 1] === "*") {
|
|
361
305
|
i2 += 2;
|
|
362
306
|
while (i2 < src.length && !(src[i2 - 1] === "*" && src[i2] === "/")) i2++;
|
|
363
307
|
i2++;
|
|
364
308
|
continue;
|
|
365
309
|
}
|
|
366
|
-
if (
|
|
310
|
+
if (c3 === "(" || c3 === "{" || c3 === "[") {
|
|
367
311
|
depth++;
|
|
368
312
|
i2++;
|
|
369
313
|
continue;
|
|
370
314
|
}
|
|
371
|
-
if (
|
|
315
|
+
if (c3 === ")" || c3 === "}" || c3 === "]") {
|
|
372
316
|
depth--;
|
|
373
317
|
i2++;
|
|
374
318
|
continue;
|
|
375
319
|
}
|
|
376
|
-
if (
|
|
320
|
+
if (c3 === ";" && depth === 0) return i2;
|
|
377
321
|
i2++;
|
|
378
322
|
}
|
|
379
323
|
return i2;
|
|
@@ -470,7 +414,7 @@ function build_state(model, st) {
|
|
|
470
414
|
const emits = raw_actions[`__emits_${action_name}`] ?? [];
|
|
471
415
|
const describe = (rule) => rule.description ?? "";
|
|
472
416
|
const preconditions = (st.requires?.[action_name] ?? []).map(describe);
|
|
473
|
-
const loads = (st.loads?.[action_name] ?? []).filter((
|
|
417
|
+
const loads = (st.loads?.[action_name] ?? []).filter((l) => l.state);
|
|
474
418
|
action_nodes.push({
|
|
475
419
|
name: action_name,
|
|
476
420
|
emits,
|
|
@@ -748,7 +692,7 @@ function attach_emit(info, action_name, handler) {
|
|
|
748
692
|
emits.push(handler);
|
|
749
693
|
} else if (typeof handler === "function") {
|
|
750
694
|
const src = String(handler);
|
|
751
|
-
const routed = (info.loads[action_name] ?? []).flatMap((
|
|
695
|
+
const routed = (info.loads[action_name] ?? []).flatMap((l) => l.events);
|
|
752
696
|
for (const event_name of [...Object.keys(info.events), ...routed]) {
|
|
753
697
|
if (src.includes(`"${event_name}"`) || src.includes(`'${event_name}'`) || src.includes(`\`${event_name}\``)) {
|
|
754
698
|
emits.push(event_name);
|
|
@@ -1194,35 +1138,35 @@ var strip_non_code = (src, level = "full") => {
|
|
|
1194
1138
|
out += src.slice(from, to).replace(/[^\n]/g, " ");
|
|
1195
1139
|
};
|
|
1196
1140
|
while (i2 < src.length) {
|
|
1197
|
-
const
|
|
1141
|
+
const c3 = src[i2];
|
|
1198
1142
|
const next = src[i2 + 1];
|
|
1199
|
-
if (
|
|
1143
|
+
if (c3 === "/" && next === "/") {
|
|
1200
1144
|
const end = src.indexOf("\n", i2);
|
|
1201
1145
|
const stop = end === -1 ? src.length : end;
|
|
1202
1146
|
blank(i2, stop);
|
|
1203
1147
|
i2 = stop;
|
|
1204
|
-
} else if (
|
|
1148
|
+
} else if (c3 === "/" && next === "*") {
|
|
1205
1149
|
const end = src.indexOf("*/", i2 + 2);
|
|
1206
1150
|
const stop = end === -1 ? src.length : end + 2;
|
|
1207
1151
|
blank(i2, stop);
|
|
1208
1152
|
i2 = stop;
|
|
1209
|
-
} else if (
|
|
1153
|
+
} else if (c3 === "`" || c3 === '"' || c3 === "'") {
|
|
1210
1154
|
let j = i2 + 1;
|
|
1211
1155
|
while (j < src.length) {
|
|
1212
1156
|
if (src[j] === "\\") {
|
|
1213
1157
|
j += 2;
|
|
1214
1158
|
continue;
|
|
1215
1159
|
}
|
|
1216
|
-
if (src[j] ===
|
|
1217
|
-
if (
|
|
1160
|
+
if (src[j] === c3) break;
|
|
1161
|
+
if (c3 !== "`" && src[j] === "\n") break;
|
|
1218
1162
|
j++;
|
|
1219
1163
|
}
|
|
1220
1164
|
const stop = Math.min(j + 1, src.length);
|
|
1221
|
-
if (
|
|
1165
|
+
if (c3 === "`" || strip_strings) blank(i2, stop);
|
|
1222
1166
|
else out += src.slice(i2, stop);
|
|
1223
1167
|
i2 = stop;
|
|
1224
1168
|
} else {
|
|
1225
|
-
out +=
|
|
1169
|
+
out += c3;
|
|
1226
1170
|
i2++;
|
|
1227
1171
|
}
|
|
1228
1172
|
}
|
|
@@ -1525,9 +1469,9 @@ function search(idx, query, limit = 20) {
|
|
|
1525
1469
|
}
|
|
1526
1470
|
|
|
1527
1471
|
// src/client/lib/loads.ts
|
|
1528
|
-
var appending_loads = (action) => (action.loads ?? []).filter((
|
|
1529
|
-
var read_loads = (action) => (action.loads ?? []).filter((
|
|
1530
|
-
var load_of = (action, event) => action.loads?.find((
|
|
1472
|
+
var appending_loads = (action) => (action.loads ?? []).filter((l) => l.events.length > 0);
|
|
1473
|
+
var read_loads = (action) => (action.loads ?? []).filter((l) => l.events.length === 0);
|
|
1474
|
+
var load_of = (action, event) => action.loads?.find((l) => l.events.includes(event));
|
|
1531
1475
|
var load_label = (load) => load.name === load.state ? load.state : `${load.state} as "${load.name}"`;
|
|
1532
1476
|
var commit_streams = (action, owner) => [
|
|
1533
1477
|
owner,
|
|
@@ -1571,8 +1515,8 @@ var loc = (file, line) => {
|
|
|
1571
1515
|
return line ? `${file}:${line}` : file;
|
|
1572
1516
|
};
|
|
1573
1517
|
var file_note = (file, line) => {
|
|
1574
|
-
const
|
|
1575
|
-
return
|
|
1518
|
+
const l = loc(file, line);
|
|
1519
|
+
return l ? ` ${dim(l)}` : "";
|
|
1576
1520
|
};
|
|
1577
1521
|
var kind_label = (kind) => {
|
|
1578
1522
|
const k = kind_color[kind];
|
|
@@ -1710,13 +1654,13 @@ function format_action(idx, entry) {
|
|
|
1710
1654
|
if (action) {
|
|
1711
1655
|
if (action.loads?.length) {
|
|
1712
1656
|
lines.push(" loads:");
|
|
1713
|
-
for (const
|
|
1657
|
+
for (const l of appending_loads(action))
|
|
1714
1658
|
lines.push(
|
|
1715
|
-
` - ${amber(load_label(
|
|
1659
|
+
` - ${amber(load_label(l))}: appends ${l.events.map((e) => orange(e)).join(", ")}`
|
|
1716
1660
|
);
|
|
1717
|
-
for (const
|
|
1661
|
+
for (const l of read_loads(action))
|
|
1718
1662
|
lines.push(
|
|
1719
|
-
` - ${amber(load_label(
|
|
1663
|
+
` - ${amber(load_label(l))}: ${dim("read, not guarded")}`
|
|
1720
1664
|
);
|
|
1721
1665
|
}
|
|
1722
1666
|
const preconditions = action.preconditions ?? [];
|
|
@@ -1786,7 +1730,7 @@ function format_state(idx, entry) {
|
|
|
1786
1730
|
}
|
|
1787
1731
|
const loaded_by = idx.model.states.flatMap(
|
|
1788
1732
|
(s) => s.actions.flatMap(
|
|
1789
|
-
(a2) => (a2.loads ?? []).filter((
|
|
1733
|
+
(a2) => (a2.loads ?? []).filter((l) => l.state === entry.name).map((l) => ({ state: s.name, action: a2.name, load: l }))
|
|
1790
1734
|
)
|
|
1791
1735
|
);
|
|
1792
1736
|
if (loaded_by.length > 0) {
|
|
@@ -2067,13 +2011,13 @@ async function load_project(root_dir, opts = {}) {
|
|
|
2067
2011
|
|
|
2068
2012
|
// src/cli/markdown.ts
|
|
2069
2013
|
var file_suffix = (file, line) => {
|
|
2070
|
-
const
|
|
2071
|
-
return
|
|
2014
|
+
const l = loc(file, line);
|
|
2015
|
+
return l ? ` *(${l})*` : "";
|
|
2072
2016
|
};
|
|
2073
2017
|
var render_schema = (s) => {
|
|
2074
2018
|
if (!s) return "_(not captured)_";
|
|
2075
2019
|
if (!s.includes("\n")) return `\`${s}\``;
|
|
2076
|
-
const indented = s.split("\n").map((
|
|
2020
|
+
const indented = s.split("\n").map((l) => ` ${l}`).join("\n");
|
|
2077
2021
|
return `
|
|
2078
2022
|
|
|
2079
2023
|
\`\`\`ts
|
|
@@ -2155,9 +2099,9 @@ function format_markdown(idx) {
|
|
|
2155
2099
|
if (action) {
|
|
2156
2100
|
if (action.loads?.length) {
|
|
2157
2101
|
lines.push("- **loads:**");
|
|
2158
|
-
for (const
|
|
2159
|
-
const what =
|
|
2160
|
-
lines.push(` - \`${load_label(
|
|
2102
|
+
for (const l of action.loads) {
|
|
2103
|
+
const what = l.events.length ? `appends ${l.events.map((e) => `\`${e}\``).join(", ")}` : "read, not guarded";
|
|
2104
|
+
lines.push(` - \`${load_label(l)}\`: ${what}`);
|
|
2161
2105
|
}
|
|
2162
2106
|
}
|
|
2163
2107
|
const preconditions = action.preconditions ?? [];
|
|
@@ -2276,11 +2220,11 @@ function format_markdown(idx) {
|
|
|
2276
2220
|
import { writeFile } from "fs/promises";
|
|
2277
2221
|
import { resolve as resolve3 } from "path";
|
|
2278
2222
|
|
|
2279
|
-
// ../../node_modules/.pnpm/@clack+core@1.
|
|
2223
|
+
// ../../node_modules/.pnpm/@clack+core@1.6.0/node_modules/@clack/core/dist/index.mjs
|
|
2280
2224
|
import { styleText } from "util";
|
|
2281
2225
|
import { stdout, stdin } from "process";
|
|
2282
|
-
import * as
|
|
2283
|
-
import
|
|
2226
|
+
import * as f$1 from "readline";
|
|
2227
|
+
import f__default from "readline";
|
|
2284
2228
|
|
|
2285
2229
|
// ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
2286
2230
|
var getCodePointsLength = /* @__PURE__ */ (() => {
|
|
@@ -2368,7 +2312,7 @@ var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {})
|
|
|
2368
2312
|
if (index >= length) {
|
|
2369
2313
|
break outer;
|
|
2370
2314
|
}
|
|
2371
|
-
for (let i2 = 0,
|
|
2315
|
+
for (let i2 = 0, l = PARSE_BLOCKS.length; i2 < l; i2++) {
|
|
2372
2316
|
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i2];
|
|
2373
2317
|
BLOCK_RE.lastIndex = index;
|
|
2374
2318
|
if (BLOCK_RE.test(input)) {
|
|
@@ -2618,14 +2562,66 @@ function wrapAnsi(string, columns, options) {
|
|
|
2618
2562
|
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
2619
2563
|
}
|
|
2620
2564
|
|
|
2621
|
-
// ../../node_modules/.pnpm
|
|
2622
|
-
var
|
|
2565
|
+
// ../../node_modules/.pnpm/sisteransi@2.0.0/node_modules/sisteransi/dist/index.js
|
|
2566
|
+
var ESC2 = "\x1B";
|
|
2567
|
+
var CSI2 = `${ESC2}[`;
|
|
2568
|
+
var cursor = {
|
|
2569
|
+
to(x, y) {
|
|
2570
|
+
if (!y)
|
|
2571
|
+
return `${CSI2}${x + 1}G`;
|
|
2572
|
+
return `${CSI2}${y + 1};${x + 1}H`;
|
|
2573
|
+
},
|
|
2574
|
+
move(x, y) {
|
|
2575
|
+
let ret = "";
|
|
2576
|
+
if (x < 0)
|
|
2577
|
+
ret += `${CSI2}${-x}D`;
|
|
2578
|
+
else if (x > 0)
|
|
2579
|
+
ret += `${CSI2}${x}C`;
|
|
2580
|
+
if (y < 0)
|
|
2581
|
+
ret += `${CSI2}${-y}A`;
|
|
2582
|
+
else if (y > 0)
|
|
2583
|
+
ret += `${CSI2}${y}B`;
|
|
2584
|
+
return ret;
|
|
2585
|
+
},
|
|
2586
|
+
up: (count = 1) => `${CSI2}${count}A`,
|
|
2587
|
+
down: (count = 1) => `${CSI2}${count}B`,
|
|
2588
|
+
forward: (count = 1) => `${CSI2}${count}C`,
|
|
2589
|
+
backward: (count = 1) => `${CSI2}${count}D`,
|
|
2590
|
+
nextLine: (count = 1) => `${CSI2}E`.repeat(count),
|
|
2591
|
+
prevLine: (count = 1) => `${CSI2}F`.repeat(count),
|
|
2592
|
+
left: `${CSI2}G`,
|
|
2593
|
+
hide: `${CSI2}?25l`,
|
|
2594
|
+
show: `${CSI2}?25h`,
|
|
2595
|
+
save: `${ESC2}7`,
|
|
2596
|
+
restore: `${ESC2}8`
|
|
2597
|
+
};
|
|
2598
|
+
var erase = {
|
|
2599
|
+
screen: `${CSI2}2J`,
|
|
2600
|
+
up: (count = 1) => `${CSI2}1J`.repeat(count),
|
|
2601
|
+
down: (count = 1) => `${CSI2}J`.repeat(count),
|
|
2602
|
+
line: `${CSI2}2K`,
|
|
2603
|
+
lineEnd: `${CSI2}K`,
|
|
2604
|
+
lineStart: `${CSI2}1K`,
|
|
2605
|
+
lines(count) {
|
|
2606
|
+
let clear2 = "";
|
|
2607
|
+
for (let i2 = 0; i2 < count; i2++)
|
|
2608
|
+
clear2 += this.line + (i2 < count - 1 ? cursor.up() : "");
|
|
2609
|
+
if (count)
|
|
2610
|
+
clear2 += cursor.left;
|
|
2611
|
+
return clear2;
|
|
2612
|
+
}
|
|
2613
|
+
};
|
|
2614
|
+
var clear = {
|
|
2615
|
+
screen: `${ESC2}c`
|
|
2616
|
+
};
|
|
2617
|
+
|
|
2618
|
+
// ../../node_modules/.pnpm/@clack+core@1.6.0/node_modules/@clack/core/dist/index.mjs
|
|
2623
2619
|
import { ReadStream } from "tty";
|
|
2624
|
-
function findCursor(
|
|
2625
|
-
if (!
|
|
2626
|
-
return
|
|
2627
|
-
const t2 =
|
|
2628
|
-
return
|
|
2620
|
+
function findCursor(o, s, l) {
|
|
2621
|
+
if (!l.some((r2) => !r2.disabled))
|
|
2622
|
+
return o;
|
|
2623
|
+
const t2 = o + s, n3 = Math.max(l.length - 1, 0), e = t2 < 0 ? n3 : t2 > n3 ? 0 : t2;
|
|
2624
|
+
return l[e]?.disabled ? findCursor(e, s < 0 ? -1 : 1, l) : e;
|
|
2629
2625
|
}
|
|
2630
2626
|
var a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
2631
2627
|
var t = [
|
|
@@ -2711,14 +2707,14 @@ function setRawMode(e, r2) {
|
|
|
2711
2707
|
var getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
|
|
2712
2708
|
var getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
2713
2709
|
function wrapTextWithPrefix(e, r2, o, n3 = o, s = o, t2) {
|
|
2714
|
-
const
|
|
2715
|
-
return wrapAnsi(r2,
|
|
2710
|
+
const l = getColumns(e ?? stdout), i2 = dist_default2(o);
|
|
2711
|
+
return wrapAnsi(r2, l - i2, {
|
|
2716
2712
|
hard: true,
|
|
2717
2713
|
trim: false
|
|
2718
2714
|
}).split(`
|
|
2719
|
-
`).map((
|
|
2720
|
-
const
|
|
2721
|
-
return
|
|
2715
|
+
`).map((c3, a2, g) => {
|
|
2716
|
+
const m = t2 ? t2(c3, a2) : c3;
|
|
2717
|
+
return a2 === 0 ? `${n3}${m}` : a2 === g.length - 1 ? `${s}${m}` : `${o}${m}`;
|
|
2722
2718
|
}).join(`
|
|
2723
2719
|
`);
|
|
2724
2720
|
}
|
|
@@ -2729,7 +2725,7 @@ function runValidation(e, a2) {
|
|
|
2729
2725
|
}
|
|
2730
2726
|
return e(a2);
|
|
2731
2727
|
}
|
|
2732
|
-
var
|
|
2728
|
+
var C$1 = class C {
|
|
2733
2729
|
input;
|
|
2734
2730
|
output;
|
|
2735
2731
|
_abortSignal;
|
|
@@ -2811,16 +2807,16 @@ var y = class {
|
|
|
2811
2807
|
{ once: true }
|
|
2812
2808
|
);
|
|
2813
2809
|
}
|
|
2814
|
-
this.rl =
|
|
2810
|
+
this.rl = f__default.createInterface({
|
|
2815
2811
|
input: this.input,
|
|
2816
2812
|
tabSize: 2,
|
|
2817
2813
|
prompt: "",
|
|
2818
2814
|
escapeCodeTimeout: 50,
|
|
2819
2815
|
terminal: true
|
|
2820
2816
|
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
2821
|
-
this.output.write(
|
|
2817
|
+
this.output.write(cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
|
|
2822
2818
|
}), this.once("cancel", () => {
|
|
2823
|
-
this.output.write(
|
|
2819
|
+
this.output.write(cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
|
|
2824
2820
|
});
|
|
2825
2821
|
});
|
|
2826
2822
|
}
|
|
@@ -2857,18 +2853,18 @@ var y = class {
|
|
|
2857
2853
|
`), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
2858
2854
|
}
|
|
2859
2855
|
restoreCursor() {
|
|
2860
|
-
const t2 = wrapAnsi(this._prevFrame,
|
|
2856
|
+
const t2 = wrapAnsi(this._prevFrame, getColumns(this.output), { hard: true, trim: false }).split(`
|
|
2861
2857
|
`).length - 1;
|
|
2862
|
-
this.output.write(
|
|
2858
|
+
this.output.write(cursor.move(-999, t2 * -1));
|
|
2863
2859
|
}
|
|
2864
2860
|
render() {
|
|
2865
|
-
const t2 = wrapAnsi(this._render(this) ?? "",
|
|
2861
|
+
const t2 = wrapAnsi(this._render(this) ?? "", getColumns(this.output), {
|
|
2866
2862
|
hard: true,
|
|
2867
2863
|
trim: false
|
|
2868
2864
|
});
|
|
2869
2865
|
if (t2 !== this._prevFrame) {
|
|
2870
2866
|
if (this.state === "initial")
|
|
2871
|
-
this.output.write(
|
|
2867
|
+
this.output.write(cursor.hide);
|
|
2872
2868
|
else {
|
|
2873
2869
|
const e = diffLines(this._prevFrame, t2), i2 = getRows(this.output);
|
|
2874
2870
|
if (this.restoreCursor(), e) {
|
|
@@ -2879,33 +2875,33 @@ var y = class {
|
|
|
2879
2875
|
return;
|
|
2880
2876
|
}
|
|
2881
2877
|
if (e.lines.length === 1) {
|
|
2882
|
-
this.output.write(
|
|
2878
|
+
this.output.write(cursor.move(0, n3 - r2)), this.output.write(erase.lines(1));
|
|
2883
2879
|
const o = t2.split(`
|
|
2884
2880
|
`);
|
|
2885
|
-
this.output.write(o[n3]), this._prevFrame = t2, this.output.write(
|
|
2881
|
+
this.output.write(o[n3]), this._prevFrame = t2, this.output.write(cursor.move(0, o.length - n3 - 1));
|
|
2886
2882
|
return;
|
|
2887
2883
|
} else if (e.lines.length > 1) {
|
|
2888
2884
|
if (s < r2)
|
|
2889
2885
|
n3 = s;
|
|
2890
2886
|
else {
|
|
2891
2887
|
const h2 = n3 - r2;
|
|
2892
|
-
h2 > 0 && this.output.write(
|
|
2888
|
+
h2 > 0 && this.output.write(cursor.move(0, h2));
|
|
2893
2889
|
}
|
|
2894
|
-
this.output.write(
|
|
2895
|
-
const
|
|
2890
|
+
this.output.write(erase.down());
|
|
2891
|
+
const m = t2.split(`
|
|
2896
2892
|
`).slice(n3);
|
|
2897
|
-
this.output.write(
|
|
2893
|
+
this.output.write(m.join(`
|
|
2898
2894
|
`)), this._prevFrame = t2;
|
|
2899
2895
|
return;
|
|
2900
2896
|
}
|
|
2901
2897
|
}
|
|
2902
|
-
this.output.write(
|
|
2898
|
+
this.output.write(erase.down());
|
|
2903
2899
|
}
|
|
2904
2900
|
this.output.write(t2), this.state === "initial" && (this.state = "active"), this._prevFrame = t2;
|
|
2905
2901
|
}
|
|
2906
2902
|
}
|
|
2907
2903
|
};
|
|
2908
|
-
var n$1 = class n extends
|
|
2904
|
+
var n$1 = class n extends C$1 {
|
|
2909
2905
|
options;
|
|
2910
2906
|
cursor = 0;
|
|
2911
2907
|
get _selectedValue() {
|
|
@@ -2933,7 +2929,7 @@ var n$1 = class n extends y {
|
|
|
2933
2929
|
});
|
|
2934
2930
|
}
|
|
2935
2931
|
};
|
|
2936
|
-
var n2 = class extends
|
|
2932
|
+
var n2 = class extends C$1 {
|
|
2937
2933
|
get userInputWithCursor() {
|
|
2938
2934
|
if (this.state === "submit")
|
|
2939
2935
|
return this.userInput;
|
|
@@ -2958,10 +2954,9 @@ var n2 = class extends y {
|
|
|
2958
2954
|
}
|
|
2959
2955
|
};
|
|
2960
2956
|
|
|
2961
|
-
// ../../node_modules/.pnpm/@clack+prompts@1.
|
|
2957
|
+
// ../../node_modules/.pnpm/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs
|
|
2962
2958
|
import { styleText as styleText2, stripVTControlCharacters } from "util";
|
|
2963
2959
|
import process$1 from "process";
|
|
2964
|
-
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
2965
2960
|
import { existsSync, lstatSync, readdirSync } from "fs";
|
|
2966
2961
|
import { dirname, join } from "path";
|
|
2967
2962
|
function isUnicodeSupported() {
|
|
@@ -2971,7 +2966,7 @@ function isUnicodeSupported() {
|
|
|
2971
2966
|
return Boolean(process$1.env.CI) || Boolean(process$1.env.WT_SESSION) || Boolean(process$1.env.TERMINUS_SUBLIME) || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
2972
2967
|
}
|
|
2973
2968
|
var unicode = isUnicodeSupported();
|
|
2974
|
-
var unicodeOr = (
|
|
2969
|
+
var unicodeOr = (e, o) => unicode ? e : o;
|
|
2975
2970
|
var S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
|
|
2976
2971
|
var S_STEP_CANCEL = unicodeOr("\u25A0", "x");
|
|
2977
2972
|
var S_STEP_ERROR = unicodeOr("\u25B2", "x");
|
|
@@ -2997,8 +2992,8 @@ var S_INFO = unicodeOr("\u25CF", "\u2022");
|
|
|
2997
2992
|
var S_SUCCESS = unicodeOr("\u25C6", "*");
|
|
2998
2993
|
var S_WARN = unicodeOr("\u25B2", "!");
|
|
2999
2994
|
var S_ERROR = unicodeOr("\u25A0", "x");
|
|
3000
|
-
var symbol = (
|
|
3001
|
-
switch (
|
|
2995
|
+
var symbol = (e) => {
|
|
2996
|
+
switch (e) {
|
|
3002
2997
|
case "initial":
|
|
3003
2998
|
case "active":
|
|
3004
2999
|
return styleText2("cyan", S_STEP_ACTIVE);
|
|
@@ -3012,8 +3007,8 @@ var symbol = (o) => {
|
|
|
3012
3007
|
return styleText2("dim", S_STEP_ACTIVE);
|
|
3013
3008
|
}
|
|
3014
3009
|
};
|
|
3015
|
-
var symbolBar = (
|
|
3016
|
-
switch (
|
|
3010
|
+
var symbolBar = (e) => {
|
|
3011
|
+
switch (e) {
|
|
3017
3012
|
case "initial":
|
|
3018
3013
|
case "active":
|
|
3019
3014
|
return styleText2("cyan", S_BAR);
|
|
@@ -3025,49 +3020,50 @@ var symbolBar = (o) => {
|
|
|
3025
3020
|
return styleText2("green", S_BAR);
|
|
3026
3021
|
}
|
|
3027
3022
|
};
|
|
3028
|
-
function formatInstructionFooter(o,
|
|
3029
|
-
const
|
|
3030
|
-
|
|
3023
|
+
function formatInstructionFooter(e, o, r2) {
|
|
3024
|
+
const s = r2 ? `${styleText2("cyan", S_BAR)} ` : "", n3 = wrapTextWithPrefix(e, o.join(" \u2022 "), s).split(`
|
|
3025
|
+
`);
|
|
3026
|
+
return r2 && n3.push(styleText2("cyan", S_BAR_END)), n3;
|
|
3031
3027
|
}
|
|
3032
|
-
var
|
|
3028
|
+
var E$1 = (l, e, w, p, b, C2 = false) => {
|
|
3033
3029
|
let r2 = e, O = 0;
|
|
3034
|
-
if (
|
|
3030
|
+
if (C2)
|
|
3035
3031
|
for (let i2 = p - 1; i2 >= w; i2--) {
|
|
3036
|
-
const m =
|
|
3032
|
+
const m = l[i2];
|
|
3037
3033
|
if (m && (r2 -= m.length), O++, r2 <= b) break;
|
|
3038
3034
|
}
|
|
3039
3035
|
else
|
|
3040
3036
|
for (let i2 = w; i2 < p; i2++) {
|
|
3041
|
-
const m =
|
|
3037
|
+
const m = l[i2];
|
|
3042
3038
|
if (m && (r2 -= m.length), O++, r2 <= b) break;
|
|
3043
3039
|
}
|
|
3044
3040
|
return { lineCount: r2, removals: O };
|
|
3045
3041
|
};
|
|
3046
3042
|
var limitOptions = ({
|
|
3047
|
-
cursor:
|
|
3043
|
+
cursor: l,
|
|
3048
3044
|
options: e,
|
|
3049
3045
|
style: w,
|
|
3050
3046
|
output: p = process.stdout,
|
|
3051
3047
|
maxItems: b = Number.POSITIVE_INFINITY,
|
|
3052
|
-
columnPadding:
|
|
3048
|
+
columnPadding: C2 = 0,
|
|
3053
3049
|
rowPadding: r2 = 4
|
|
3054
3050
|
}) => {
|
|
3055
|
-
const i2 = getColumns(p) -
|
|
3051
|
+
const i2 = getColumns(p) - C2, m = getRows(p), M = styleText2("dim", "..."), v = Math.max(m - r2, 0), a2 = Math.max(Math.min(b, v), 5);
|
|
3056
3052
|
let f = 0;
|
|
3057
|
-
|
|
3058
|
-
Math.min(
|
|
3053
|
+
l >= a2 - 3 && (f = Math.max(
|
|
3054
|
+
Math.min(l - a2 + 3, e.length - a2),
|
|
3059
3055
|
0
|
|
3060
3056
|
));
|
|
3061
|
-
let d = a2 < e.length && f > 0,
|
|
3062
|
-
const
|
|
3057
|
+
let d = a2 < e.length && f > 0, c3 = a2 < e.length && f + a2 < e.length;
|
|
3058
|
+
const I = Math.min(
|
|
3063
3059
|
f + a2,
|
|
3064
3060
|
e.length
|
|
3065
3061
|
), s = [];
|
|
3066
3062
|
let g = 0;
|
|
3067
|
-
d && g++,
|
|
3068
|
-
const T = f + (d ? 1 : 0),
|
|
3069
|
-
for (let t2 = T; t2 <
|
|
3070
|
-
const n3 = e[t2], o = n3 ? w(n3, t2 ===
|
|
3063
|
+
d && g++, c3 && g++;
|
|
3064
|
+
const T = f + (d ? 1 : 0), W = I - (c3 ? 1 : 0);
|
|
3065
|
+
for (let t2 = T; t2 < W; t2++) {
|
|
3066
|
+
const n3 = e[t2], o = n3 !== void 0 ? w(n3, t2 === l) : "", h2 = wrapAnsi(o, i2, {
|
|
3071
3067
|
hard: true,
|
|
3072
3068
|
trim: false
|
|
3073
3069
|
}).split(`
|
|
@@ -3076,9 +3072,9 @@ var limitOptions = ({
|
|
|
3076
3072
|
}
|
|
3077
3073
|
if (g > v) {
|
|
3078
3074
|
let t2 = 0, n3 = 0, o = g;
|
|
3079
|
-
const h2 =
|
|
3075
|
+
const h2 = l - T;
|
|
3080
3076
|
let u3 = v;
|
|
3081
|
-
const L = () =>
|
|
3077
|
+
const L = () => E$1(s, o, 0, h2, u3), y = () => E$1(
|
|
3082
3078
|
s,
|
|
3083
3079
|
o,
|
|
3084
3080
|
h2 + 1,
|
|
@@ -3086,14 +3082,14 @@ var limitOptions = ({
|
|
|
3086
3082
|
u3,
|
|
3087
3083
|
true
|
|
3088
3084
|
);
|
|
3089
|
-
d ? ({ lineCount: o, removals: t2 } = L(), o > u3 && (
|
|
3085
|
+
d ? ({ lineCount: o, removals: t2 } = L(), o > u3 && (c3 || (u3 -= 1), { lineCount: o, removals: n3 } = y())) : (c3 || (u3 -= 1), { lineCount: o, removals: n3 } = y(), o > u3 && (u3 -= 1, { lineCount: o, removals: t2 } = L())), t2 > 0 && (d = true, s.splice(0, t2)), n3 > 0 && (c3 = true, s.splice(s.length - n3, n3));
|
|
3090
3086
|
}
|
|
3091
3087
|
const x = [];
|
|
3092
3088
|
d && x.push(M);
|
|
3093
3089
|
for (const t2 of s)
|
|
3094
3090
|
for (const n3 of t2)
|
|
3095
3091
|
x.push(n3);
|
|
3096
|
-
return
|
|
3092
|
+
return c3 && x.push(M), x;
|
|
3097
3093
|
};
|
|
3098
3094
|
var MULTISELECT_INSTRUCTIONS = [
|
|
3099
3095
|
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
@@ -3105,18 +3101,18 @@ var log = {
|
|
|
3105
3101
|
symbol: e = styleText2("gray", S_BAR),
|
|
3106
3102
|
secondarySymbol: r2 = styleText2("gray", S_BAR),
|
|
3107
3103
|
output: m = process.stdout,
|
|
3108
|
-
spacing:
|
|
3109
|
-
withGuide:
|
|
3104
|
+
spacing: l = 1,
|
|
3105
|
+
withGuide: c3
|
|
3110
3106
|
} = {}) => {
|
|
3111
|
-
const t2 = [], o =
|
|
3112
|
-
for (let i2 = 0; i2 <
|
|
3107
|
+
const t2 = [], o = c3 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
|
|
3108
|
+
for (let i2 = 0; i2 < l; i2++)
|
|
3113
3109
|
t2.push(f);
|
|
3114
3110
|
const g = Array.isArray(s) ? s : s.split(`
|
|
3115
3111
|
`);
|
|
3116
3112
|
if (g.length > 0) {
|
|
3117
|
-
const [i2, ...
|
|
3113
|
+
const [i2, ...y] = g;
|
|
3118
3114
|
i2.length > 0 ? t2.push(`${O}${i2}`) : t2.push(o ? e : "");
|
|
3119
|
-
for (const p of
|
|
3115
|
+
for (const p of y)
|
|
3120
3116
|
p.length > 0 ? t2.push(`${u3}${p}`) : t2.push(o ? r2 : "");
|
|
3121
3117
|
}
|
|
3122
3118
|
m.write(`${t2.join(`
|
|
@@ -3164,7 +3160,7 @@ var SELECT_INSTRUCTIONS = [
|
|
|
3164
3160
|
`${styleText2("dim", "\u2191/\u2193")} to navigate`,
|
|
3165
3161
|
`${styleText2("dim", "Enter:")} confirm`
|
|
3166
3162
|
];
|
|
3167
|
-
var
|
|
3163
|
+
var c2 = (t2, o) => t2.includes(`
|
|
3168
3164
|
`) ? t2.split(`
|
|
3169
3165
|
`).map((d) => o(d)).join(`
|
|
3170
3166
|
`) : o(t2);
|
|
@@ -3175,15 +3171,15 @@ var select = (t2) => {
|
|
|
3175
3171
|
const s = n3.label ?? String(n3.value);
|
|
3176
3172
|
switch (m) {
|
|
3177
3173
|
case "disabled":
|
|
3178
|
-
return `${styleText2("gray", S_RADIO_INACTIVE)} ${
|
|
3174
|
+
return `${styleText2("gray", S_RADIO_INACTIVE)} ${c2(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
|
|
3179
3175
|
case "selected":
|
|
3180
|
-
return `${
|
|
3176
|
+
return `${c2(s, (i2) => styleText2("dim", i2))}`;
|
|
3181
3177
|
case "active":
|
|
3182
3178
|
return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n3.hint ? ` ${styleText2("dim", `(${n3.hint})`)}` : ""}`;
|
|
3183
3179
|
case "cancelled":
|
|
3184
|
-
return `${
|
|
3180
|
+
return `${c2(s, (i2) => styleText2(["strikethrough", "dim"], i2))}`;
|
|
3185
3181
|
default:
|
|
3186
|
-
return `${styleText2("dim", S_RADIO_INACTIVE)} ${
|
|
3182
|
+
return `${styleText2("dim", S_RADIO_INACTIVE)} ${c2(s, (i2) => styleText2("dim", i2))}`;
|
|
3187
3183
|
}
|
|
3188
3184
|
}, d = t2.showInstructions ?? true;
|
|
3189
3185
|
return new n$1({
|
|
@@ -3221,7 +3217,7 @@ ${styleText2("gray", S_BAR)}` : ""}`;
|
|
|
3221
3217
|
}
|
|
3222
3218
|
default: {
|
|
3223
3219
|
const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
|
|
3224
|
-
`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
|
|
3220
|
+
`).length, p = d ? formatInstructionFooter(t2.output, SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
|
|
3225
3221
|
`), b = p.length + 1;
|
|
3226
3222
|
return `${u3}${r2}${limitOptions({
|
|
3227
3223
|
output: t2.output,
|
|
@@ -3250,7 +3246,7 @@ var text = (t2) => new n2({
|
|
|
3250
3246
|
signal: t2.signal,
|
|
3251
3247
|
input: t2.input,
|
|
3252
3248
|
render() {
|
|
3253
|
-
const r2 = t2?.withGuide ?? settings.withGuide,
|
|
3249
|
+
const r2 = t2?.withGuide ?? settings.withGuide, l = `${`${r2 ? `${styleText2("gray", S_BAR)}
|
|
3254
3250
|
` : ""}${symbol(this.state)} `}${t2.message}
|
|
3255
3251
|
`, d = t2.placeholder && t2.placeholder.length > 0 ? (
|
|
3256
3252
|
// biome-ignore lint/style/noNonNullAssertion: guarded by placeholder.length > 0
|
|
@@ -3258,30 +3254,30 @@ var text = (t2) => new n2({
|
|
|
3258
3254
|
) : styleText2(["inverse", "hidden"], "_"), o = this.userInput ? this.userInputWithCursor : d, s = this.value ?? "";
|
|
3259
3255
|
switch (this.state) {
|
|
3260
3256
|
case "validating": {
|
|
3261
|
-
const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "",
|
|
3262
|
-
return `${
|
|
3257
|
+
const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "", c3 = styleText2("dim", o), $ = styleText2("dim", "Validating...");
|
|
3258
|
+
return `${l}${n3}${c3}
|
|
3263
3259
|
${i2} ${$}
|
|
3264
3260
|
`;
|
|
3265
3261
|
}
|
|
3266
3262
|
case "error": {
|
|
3267
|
-
const n3 = this.error ? ` ${styleText2("yellow", this.error)}` : "", i2 = r2 ? `${styleText2("yellow", S_BAR)} ` : "",
|
|
3268
|
-
return `${
|
|
3263
|
+
const n3 = this.error ? ` ${styleText2("yellow", this.error)}` : "", i2 = r2 ? `${styleText2("yellow", S_BAR)} ` : "", c3 = r2 ? styleText2("yellow", S_BAR_END) : "";
|
|
3264
|
+
return `${l.trim()}
|
|
3269
3265
|
${i2}${o}
|
|
3270
|
-
${
|
|
3266
|
+
${c3}${n3}
|
|
3271
3267
|
`;
|
|
3272
3268
|
}
|
|
3273
3269
|
case "submit": {
|
|
3274
3270
|
const n3 = s ? `${r2 ? " " : ""}${styleText2("dim", s)}` : "", i2 = r2 ? styleText2("gray", S_BAR) : "";
|
|
3275
|
-
return `${
|
|
3271
|
+
return `${l}${i2}${n3}`;
|
|
3276
3272
|
}
|
|
3277
3273
|
case "cancel": {
|
|
3278
3274
|
const n3 = s ? ` ${styleText2(["strikethrough", "dim"], s)}` : "", i2 = r2 ? styleText2("gray", S_BAR) : "";
|
|
3279
|
-
return `${
|
|
3275
|
+
return `${l}${i2}${n3}${s.trim() ? `
|
|
3280
3276
|
${i2}` : ""}`;
|
|
3281
3277
|
}
|
|
3282
3278
|
default: {
|
|
3283
3279
|
const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "";
|
|
3284
|
-
return `${
|
|
3280
|
+
return `${l}${n3}${o}
|
|
3285
3281
|
${i2}
|
|
3286
3282
|
`;
|
|
3287
3283
|
}
|
|
@@ -3369,12 +3365,12 @@ function build_patterns(esc, type) {
|
|
|
3369
3365
|
function navigate_to_code(files, name, type, target_file) {
|
|
3370
3366
|
const stripped = /* @__PURE__ */ new Map();
|
|
3371
3367
|
const code = (f) => {
|
|
3372
|
-
let
|
|
3373
|
-
if (
|
|
3374
|
-
|
|
3375
|
-
stripped.set(f.path,
|
|
3368
|
+
let c3 = stripped.get(f.path);
|
|
3369
|
+
if (c3 === void 0) {
|
|
3370
|
+
c3 = strip_non_code(f.content, "nav");
|
|
3371
|
+
stripped.set(f.path, c3);
|
|
3376
3372
|
}
|
|
3377
|
-
return
|
|
3373
|
+
return c3;
|
|
3378
3374
|
};
|
|
3379
3375
|
if (type === "file") {
|
|
3380
3376
|
const file = files.find((f) => f.path === name || f.path.endsWith(name));
|
|
@@ -3391,21 +3387,21 @@ function navigate_to_code(files, name, type, target_file) {
|
|
|
3391
3387
|
if (target_file) {
|
|
3392
3388
|
const file = files.find((f) => f.path === target_file);
|
|
3393
3389
|
if (file) {
|
|
3394
|
-
const
|
|
3390
|
+
const c3 = code(file);
|
|
3395
3391
|
const esc2 = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3396
3392
|
if (type === "event") {
|
|
3397
3393
|
const emits_block_re = new RegExp(
|
|
3398
3394
|
`\\.emits\\([\\s\\S]*?(${esc2})\\s*[,:}]`
|
|
3399
3395
|
);
|
|
3400
|
-
const block_match = emits_block_re.exec(
|
|
3396
|
+
const block_match = emits_block_re.exec(c3);
|
|
3401
3397
|
if (block_match) {
|
|
3402
3398
|
const name_idx = block_match.index + block_match[0].lastIndexOf(name);
|
|
3403
3399
|
const { line, col } = position_at(file.content, name_idx);
|
|
3404
3400
|
return { file: file.path, line, col };
|
|
3405
3401
|
}
|
|
3406
3402
|
const name_re2 = new RegExp(`\\b${esc2}\\b`, "g");
|
|
3407
|
-
if (name_re2.exec(
|
|
3408
|
-
const emits_match = /\.emits\s*\(/.exec(
|
|
3403
|
+
if (name_re2.exec(c3)) {
|
|
3404
|
+
const emits_match = /\.emits\s*\(/.exec(c3);
|
|
3409
3405
|
if (emits_match) {
|
|
3410
3406
|
const { line, col } = position_at(
|
|
3411
3407
|
file.content,
|
|
@@ -3417,9 +3413,9 @@ function navigate_to_code(files, name, type, target_file) {
|
|
|
3417
3413
|
}
|
|
3418
3414
|
if (type === "guard") {
|
|
3419
3415
|
const desc_re = new RegExp(`description:\\s*["'\`]${esc2}["'\`]`);
|
|
3420
|
-
const desc_match = desc_re.exec(
|
|
3416
|
+
const desc_match = desc_re.exec(c3);
|
|
3421
3417
|
if (desc_match) {
|
|
3422
|
-
const before =
|
|
3418
|
+
const before = c3.slice(0, desc_match.index);
|
|
3423
3419
|
const decl_re = /(?:export\s+)?(?:const|let|var)\s+(\w+)\s*(?::\s*Precondition[^=]*)?\s*=/g;
|
|
3424
3420
|
let last_decl = null;
|
|
3425
3421
|
let m;
|
|
@@ -3437,10 +3433,10 @@ function navigate_to_code(files, name, type, target_file) {
|
|
|
3437
3433
|
}
|
|
3438
3434
|
if (type === "action") {
|
|
3439
3435
|
const name_re2 = new RegExp(`\\b${esc2}\\b`, "g");
|
|
3440
|
-
const block_start =
|
|
3436
|
+
const block_start = c3.indexOf(".on(");
|
|
3441
3437
|
if (block_start >= 0) {
|
|
3442
3438
|
name_re2.lastIndex = block_start;
|
|
3443
|
-
const match2 = name_re2.exec(
|
|
3439
|
+
const match2 = name_re2.exec(c3);
|
|
3444
3440
|
if (match2) {
|
|
3445
3441
|
const { line, col } = position_at(file.content, match2.index);
|
|
3446
3442
|
return { file: file.path, line, col };
|
|
@@ -3448,7 +3444,7 @@ function navigate_to_code(files, name, type, target_file) {
|
|
|
3448
3444
|
}
|
|
3449
3445
|
}
|
|
3450
3446
|
const name_re = new RegExp(`\\b${esc2}\\b`);
|
|
3451
|
-
const match = name_re.exec(
|
|
3447
|
+
const match = name_re.exec(c3);
|
|
3452
3448
|
if (match) {
|
|
3453
3449
|
const { line, col } = position_at(file.content, match.index);
|
|
3454
3450
|
return { file: file.path, line, col };
|
|
@@ -3465,10 +3461,10 @@ function navigate_to_code(files, name, type, target_file) {
|
|
|
3465
3461
|
const desc_re = new RegExp(`description:\\s*["'\`]${esc}["'\`]`);
|
|
3466
3462
|
for (const f of sorted_files) {
|
|
3467
3463
|
if (!/\.tsx?$/.test(f.path)) continue;
|
|
3468
|
-
const
|
|
3469
|
-
const desc_match = desc_re.exec(
|
|
3464
|
+
const c3 = code(f);
|
|
3465
|
+
const desc_match = desc_re.exec(c3);
|
|
3470
3466
|
if (desc_match) {
|
|
3471
|
-
const before =
|
|
3467
|
+
const before = c3.slice(0, desc_match.index);
|
|
3472
3468
|
const decl_re = /(?:export\s+)?(?:const|let|var)\s+(\w+)\s*(?::\s*Precondition[^=]*)?\s*=/g;
|
|
3473
3469
|
let last_decl = null;
|
|
3474
3470
|
let m;
|
|
@@ -3487,10 +3483,10 @@ function navigate_to_code(files, name, type, target_file) {
|
|
|
3487
3483
|
for (const re of patterns) {
|
|
3488
3484
|
for (const f of sorted_files) {
|
|
3489
3485
|
if (!/\.tsx?$/.test(f.path)) continue;
|
|
3490
|
-
const
|
|
3486
|
+
const c3 = code(f);
|
|
3491
3487
|
const global_re = new RegExp(re.source, re.flags + "g");
|
|
3492
3488
|
let match;
|
|
3493
|
-
while ((match = global_re.exec(
|
|
3489
|
+
while ((match = global_re.exec(c3)) !== null) {
|
|
3494
3490
|
const match_text = match[0];
|
|
3495
3491
|
const name_offset_in_match = match_text.lastIndexOf(name);
|
|
3496
3492
|
const name_start = match.index + Math.max(0, name_offset_in_match);
|
|
@@ -3539,7 +3535,7 @@ async function open_in_editor(file, line, deps) {
|
|
|
3539
3535
|
// src/cli/vim-keys.ts
|
|
3540
3536
|
var UP = Buffer.from("\x1B[A");
|
|
3541
3537
|
var DOWN = Buffer.from("\x1B[B");
|
|
3542
|
-
var
|
|
3538
|
+
var ESC3 = Buffer.from("\x1B");
|
|
3543
3539
|
var matches = (chunk, key) => chunk.length === key.length && chunk.toString("utf8") === key;
|
|
3544
3540
|
function classify(chunk) {
|
|
3545
3541
|
if (matches(chunk, "j")) return "down";
|
|
@@ -3557,10 +3553,10 @@ function enableVimKeys(stdin2) {
|
|
|
3557
3553
|
const direction = classify(args[0]);
|
|
3558
3554
|
if (direction === "down") return orig_emit("data", DOWN);
|
|
3559
3555
|
if (direction === "up") return orig_emit("data", UP);
|
|
3560
|
-
if (direction === "cancel") return orig_emit("data",
|
|
3556
|
+
if (direction === "cancel") return orig_emit("data", ESC3);
|
|
3561
3557
|
if (direction === "slash") {
|
|
3562
3558
|
for (const cb of slash_listeners) cb();
|
|
3563
|
-
return orig_emit("data",
|
|
3559
|
+
return orig_emit("data", ESC3);
|
|
3564
3560
|
}
|
|
3565
3561
|
}
|
|
3566
3562
|
return orig_emit(event, ...args);
|