bfi-cli 0.1.87 → 0.1.91

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.
@@ -2,6 +2,8 @@ import { __exportAll } from "../../rolldown-runtime.mjs";
2
2
  import { a, block, fastStringWidth, getColumns, getRows, n$1, r, require_src, settings, u$2, wrapAnsi, wrapTextWithPrefix } from "./core.mjs";
3
3
  import { styleText } from "node:util";
4
4
  import process$1 from "node:process";
5
+ import "node:fs";
6
+ import "node:path";
5
7
  var dist_exports = /* @__PURE__ */ __exportAll({
6
8
  MULTISELECT_INSTRUCTIONS: () => MULTISELECT_INSTRUCTIONS,
7
9
  SELECT_INSTRUCTIONS: () => SELECT_INSTRUCTIONS,
@@ -80,6 +82,7 @@ const symbol = (o) => {
80
82
  case "cancel": return styleText("red", S_STEP_CANCEL);
81
83
  case "error": return styleText("yellow", S_STEP_ERROR);
82
84
  case "submit": return styleText("green", S_STEP_SUBMIT);
85
+ case "validating": return styleText("dim", S_STEP_ACTIVE);
83
86
  }
84
87
  };
85
88
  const symbolBar = (o) => {
@@ -120,7 +123,7 @@ const limitOptions = ({ cursor: l, options: e, style: w, output: p = process.std
120
123
  d && g++, c && g++;
121
124
  const T = f + (d ? 1 : 0), y = W - (c ? 1 : 0);
122
125
  for (let t = T; t < y; t++) {
123
- const n = e[t], h = wrapAnsi(n ? w(n, t === l) : "", i, {
126
+ const n = e[t], o = n ? w(n, t === l) : "", h = wrapAnsi(o, i, {
124
127
  hard: true,
125
128
  trim: false
126
129
  }).split(`
@@ -139,28 +142,28 @@ const limitOptions = ({ cursor: l, options: e, style: w, output: p = process.std
139
142
  for (const t of s) for (const n of t) x.push(n);
140
143
  return c && x.push(M), x;
141
144
  };
142
- const confirm = (i) => {
143
- const a = i.active ?? "Yes", s = i.inactive ?? "No";
145
+ const confirm = (e) => {
146
+ const a = e.active ?? "Yes", o = e.inactive ?? "No";
144
147
  return new r({
145
148
  active: a,
146
- inactive: s,
147
- signal: i.signal,
148
- input: i.input,
149
- output: i.output,
150
- initialValue: i.initialValue ?? true,
149
+ inactive: o,
150
+ signal: e.signal,
151
+ input: e.input,
152
+ output: e.output,
153
+ initialValue: e.initialValue ?? true,
151
154
  render() {
152
- const e = i.withGuide ?? settings.withGuide, u = `${symbol(this.state)} `, l = e ? `${styleText("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(i.output, i.message, l, u), o = `${e ? `${styleText("gray", S_BAR)}
155
+ const i = e.withGuide ?? settings.withGuide, u = `${symbol(this.state)} `, l = i ? `${styleText("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(e.output, e.message, l, u), s = `${i ? `${styleText("gray", S_BAR)}
153
156
  ` : ""}${f}
154
- `, c = this.value ? a : s;
157
+ `, c = this.value ? a : o;
155
158
  switch (this.state) {
156
- case "submit": return `${o}${e ? `${styleText("gray", S_BAR)} ` : ""}${styleText("dim", c)}`;
157
- case "cancel": return `${o}${e ? `${styleText("gray", S_BAR)} ` : ""}${styleText(["strikethrough", "dim"], c)}${e ? `
159
+ case "submit": return `${s}${i ? `${styleText("gray", S_BAR)} ` : ""}${styleText("dim", c)}`;
160
+ case "cancel": return `${s}${i ? `${styleText("gray", S_BAR)} ` : ""}${styleText(["strikethrough", "dim"], c)}${i ? `
158
161
  ${styleText("gray", S_BAR)}` : ""}`;
159
162
  default: {
160
- const r = e ? `${styleText("cyan", S_BAR)} ` : "", g = e ? styleText("cyan", S_BAR_END) : "";
161
- return `${o}${r}${this.value ? `${styleText("green", S_RADIO_ACTIVE)} ${a}` : `${styleText("dim", S_RADIO_INACTIVE)} ${styleText("dim", a)}`}${i.vertical ? e ? `
163
+ const r = i ? `${styleText("cyan", S_BAR)} ` : "", g = i ? styleText("cyan", S_BAR_END) : "";
164
+ return `${s}${r}${this.value ? `${styleText("green", S_RADIO_ACTIVE)} ${a}` : `${styleText("dim", S_RADIO_INACTIVE)} ${styleText("dim", a)}`}${e.vertical ? i ? `
162
165
  ${styleText("cyan", S_BAR)} ` : `
163
- ` : ` ${styleText("dim", "/")} `}${this.value ? `${styleText("dim", S_RADIO_INACTIVE)} ${styleText("dim", s)}` : `${styleText("green", S_RADIO_ACTIVE)} ${s}`}
166
+ ` : ` ${styleText("dim", "/")} `}${this.value ? `${styleText("dim", S_RADIO_INACTIVE)} ${styleText("dim", o)}` : `${styleText("green", S_RADIO_ACTIVE)} ${o}`}
164
167
  ${g}
165
168
  `;
166
169
  }
@@ -180,7 +183,7 @@ const multiselect = (i) => {
180
183
  const u = (t, a) => {
181
184
  const r = t.label ?? String(t.value);
182
185
  return a === "disabled" ? `${styleText("gray", S_CHECKBOX_INACTIVE)} ${m(r, (o) => styleText(["strikethrough", "gray"], o))}${t.hint ? ` ${styleText("dim", `(${t.hint ?? "disabled"})`)}` : ""}` : a === "active" ? `${styleText("cyan", S_CHECKBOX_ACTIVE)} ${r}${t.hint ? ` ${styleText("dim", `(${t.hint})`)}` : ""}` : a === "selected" ? `${styleText("green", S_CHECKBOX_SELECTED)} ${m(r, (o) => styleText("dim", o))}${t.hint ? ` ${styleText("dim", `(${t.hint})`)}` : ""}` : a === "cancelled" ? `${m(r, (o) => styleText(["strikethrough", "dim"], o))}` : a === "active-selected" ? `${styleText("green", S_CHECKBOX_SELECTED)} ${r}${t.hint ? ` ${styleText("dim", `(${t.hint})`)}` : ""}` : a === "submitted" ? `${m(r, (o) => styleText("dim", o))}` : `${styleText("dim", S_CHECKBOX_INACTIVE)} ${m(r, (o) => styleText("dim", o))}`;
183
- }, d = i.required ?? true, v = i.showInstructions ?? true;
186
+ }, d = i.required ?? true, x = i.showInstructions ?? true;
184
187
  return new a({
185
188
  options: i.options,
186
189
  signal: i.signal,
@@ -200,7 +203,7 @@ ${styleText("reset", styleText("dim", `Press ${styleText([
200
203
  render() {
201
204
  const t = i.withGuide ?? settings.withGuide, a = wrapTextWithPrefix(i.output, i.message, t ? `${symbolBar(this.state)} ` : "", `${symbol(this.state)} `), r = `${t ? `${styleText("gray", S_BAR)}
202
205
  ` : ""}${a}
203
- `, o = this.value ?? [], p = (n, l) => {
206
+ `, o = this.value ?? [], g = (n, l) => {
204
207
  if (n.disabled) return u(n, "disabled");
205
208
  const s = o.includes(n.value);
206
209
  return l && s ? u(n, "active-selected") : s ? u(n, "selected") : u(n, l ? "active" : "inactive");
@@ -218,7 +221,7 @@ ${styleText("gray", S_BAR)}` : ""}`;
218
221
  }
219
222
  case "error": {
220
223
  const n = t ? `${styleText("yellow", S_BAR)} ` : "", l = this.error.split(`
221
- `).map(($, C) => C === 0 ? `${t ? `${styleText("yellow", S_BAR_END)} ` : ""}${styleText("yellow", $)}` : ` ${$}`).join(`
224
+ `).map(($, v) => v === 0 ? `${t ? `${styleText("yellow", S_BAR_END)} ` : ""}${styleText("yellow", $)}` : ` ${$}`).join(`
222
225
  `), s = r.split(`
223
226
  `).length, h = l.split(`
224
227
  `).length + 1;
@@ -229,7 +232,7 @@ ${styleText("gray", S_BAR)}` : ""}`;
229
232
  maxItems: i.maxItems,
230
233
  columnPadding: n.length,
231
234
  rowPadding: s + h,
232
- style: p
235
+ style: g
233
236
  }).join(`
234
237
  ${n}`)}
235
238
  ${l}
@@ -237,7 +240,7 @@ ${l}
237
240
  }
238
241
  default: {
239
242
  const n = t ? `${styleText("cyan", S_BAR)} ` : "", l = r.split(`
240
- `).length, s = v ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, t) : t ? [styleText("cyan", S_BAR_END)] : [], h = s.join(`
243
+ `).length, s = x ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, t) : t ? [styleText("cyan", S_BAR_END)] : [], h = s.join(`
241
244
  `), $ = s.length + 1;
242
245
  return `${r}${n}${limitOptions({
243
246
  output: i.output,
@@ -246,7 +249,7 @@ ${l}
246
249
  maxItems: i.maxItems,
247
250
  columnPadding: n.length,
248
251
  rowPadding: l + $,
249
- style: p
252
+ style: g
250
253
  }).join(`
251
254
  ${n}`)}
252
255
  ${h}
@@ -257,25 +260,25 @@ ${h}
257
260
  }).prompt();
258
261
  };
259
262
  const groupMultiselect = (o) => {
260
- const { selectableGroups: h = true, groupSpacing: x = 0 } = o, m = (n, l, g = []) => {
261
- const a = n.label ?? String(n.value), t = typeof n.group == "string", s = t && (g[g.indexOf(n) + 1] ?? { group: true }), u = t && s && s.group === true;
263
+ const { selectableGroups: f = true, groupSpacing: x = 0 } = o, d = (n, l, p = []) => {
264
+ const a = n.label ?? String(n.value), t = typeof n.group == "string", s = t && (p[p.indexOf(n) + 1] ?? { group: true }), u = t && s && s.group === true;
262
265
  let r = "", c = "";
263
- t && (h ? (r = u ? `${S_BAR_END} ` : `${S_BAR} `, c = u ? " " : `${S_BAR} `) : r = " ");
266
+ t && (f ? (r = u ? `${S_BAR_END} ` : `${S_BAR} `, c = u ? " " : `${S_BAR} `) : r = " ");
264
267
  let i = "";
265
268
  if (x > 0 && !t && (i = `
266
269
  `.repeat(x)), l === "active") return wrapTextWithPrefix(o.output, `${a}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`, `${i}${styleText("dim", r)} `, `${i}${styleText("dim", r)}${styleText("cyan", S_CHECKBOX_ACTIVE)} `, `${i}${styleText("dim", c)} `);
267
- if (l === "group-active") return wrapTextWithPrefix(o.output, a, `${i}${r} `, `${i}${r}${styleText("cyan", S_CHECKBOX_ACTIVE)} `, `${i}${c} `, (d) => styleText("dim", d));
268
- if (l === "group-active-selected") return wrapTextWithPrefix(o.output, a, `${i}${r} `, `${i}${r}${styleText("green", S_CHECKBOX_SELECTED)} `, `${i}${c} `, (d) => styleText("dim", d));
270
+ if (l === "group-active") return wrapTextWithPrefix(o.output, a, `${i}${r} `, `${i}${r}${styleText("cyan", S_CHECKBOX_ACTIVE)} `, `${i}${c} `, (m) => styleText("dim", m));
271
+ if (l === "group-active-selected") return wrapTextWithPrefix(o.output, a, `${i}${r} `, `${i}${r}${styleText("green", S_CHECKBOX_SELECTED)} `, `${i}${c} `, (m) => styleText("dim", m));
269
272
  if (l === "selected") {
270
- const d = t || h ? styleText("green", S_CHECKBOX_SELECTED) : "";
271
- return wrapTextWithPrefix(o.output, `${a}${n.hint ? ` (${n.hint})` : ""}`, `${i}${styleText("dim", r)} `, `${i}${styleText("dim", r)}${d} `, `${i}${styleText("dim", c)} `, (S) => styleText("dim", S));
273
+ const m = t || f ? styleText("green", S_CHECKBOX_SELECTED) : "";
274
+ return wrapTextWithPrefix(o.output, `${a}${n.hint ? ` (${n.hint})` : ""}`, `${i}${styleText("dim", r)} `, `${i}${styleText("dim", r)}${m} `, `${i}${styleText("dim", c)} `, (I) => styleText("dim", I));
272
275
  }
273
276
  if (l === "cancelled") return `${styleText(["strikethrough", "dim"], a)}`;
274
277
  if (l === "active-selected") return wrapTextWithPrefix(o.output, `${a}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`, `${i}${styleText("dim", r)} `, `${i}${styleText("dim", r)}${styleText("green", S_CHECKBOX_SELECTED)} `, `${i}${styleText("dim", c)} `);
275
278
  if (l === "submitted") return `${styleText("dim", a)}`;
276
- const f = t || h ? styleText("dim", S_CHECKBOX_INACTIVE) : "";
277
- return wrapTextWithPrefix(o.output, a, `${i}${styleText("dim", r)} `, `${i}${styleText("dim", r)}${f} `, `${i}${styleText("dim", c)} `, (d) => styleText("dim", d));
278
- }, y = o.required ?? true, I = o.showInstructions ?? true;
279
+ const h = t || f ? styleText("dim", S_CHECKBOX_INACTIVE) : "";
280
+ return wrapTextWithPrefix(o.output, a, `${i}${styleText("dim", r)} `, `${i}${styleText("dim", r)}${h} `, `${i}${styleText("dim", c)} `, (m) => styleText("dim", m));
281
+ }, y = o.required ?? true, S = o.showInstructions ?? true;
279
282
  return new u$2({
280
283
  options: o.options,
281
284
  signal: o.signal,
@@ -284,7 +287,7 @@ const groupMultiselect = (o) => {
284
287
  initialValues: o.initialValues,
285
288
  required: y,
286
289
  cursorAt: o.cursorAt,
287
- selectableGroups: h,
290
+ selectableGroups: f,
288
291
  validate(n) {
289
292
  if (y && (n === void 0 || n.length === 0)) return `Please select at least one option.
290
293
  ${styleText("reset", styleText("dim", `Press ${styleText([
@@ -296,23 +299,23 @@ ${styleText("reset", styleText("dim", `Press ${styleText([
296
299
  render() {
297
300
  const n = o.withGuide ?? settings.withGuide, l = `${n ? `${styleText("gray", S_BAR)}
298
301
  ` : ""}${symbol(this.state)} ${o.message}
299
- `, g = this.value ?? [], a = (t, s) => {
300
- const u = this.options, r = g.includes(t.value) || t.group === true && this.isGroupSelected(`${t.value}`);
301
- return !s && typeof t.group == "string" && this.options[this.cursor]?.value === t.group ? m(t, r ? "group-active-selected" : "group-active", u) : s && r ? m(t, "active-selected", u) : r ? m(t, "selected", u) : m(t, s ? "active" : "inactive", u);
302
+ `, p = this.value ?? [], a = (t, s) => {
303
+ const u = this.options, r = p.includes(t.value) || t.group === true && this.isGroupSelected(`${t.value}`);
304
+ return !s && typeof t.group == "string" && this.options[this.cursor]?.value === t.group ? d(t, r ? "group-active-selected" : "group-active", u) : s && r ? d(t, "active-selected", u) : r ? d(t, "selected", u) : d(t, s ? "active" : "inactive", u);
302
305
  };
303
306
  switch (this.state) {
304
307
  case "submit": {
305
- const t = this.options.filter(({ value: u }) => g.includes(u)).map((u) => m(u, "submitted")), s = t.length === 0 ? "" : ` ${t.join(styleText("dim", ", "))}`;
308
+ const t = this.options.filter(({ value: u }) => p.includes(u)).map((u) => d(u, "submitted")), s = t.length === 0 ? "" : ` ${t.join(styleText("dim", ", "))}`;
306
309
  return `${l}${n ? styleText("gray", S_BAR) : ""}${s}`;
307
310
  }
308
311
  case "cancel": {
309
- const t = this.options.filter(({ value: s }) => g.includes(s)).map((s) => m(s, "cancelled")).join(styleText("dim", ", "));
312
+ const t = this.options.filter(({ value: s }) => p.includes(s)).map((s) => d(s, "cancelled")).join(styleText("dim", ", "));
310
313
  return `${l}${n ? `${styleText("gray", S_BAR)} ` : ""}${t.trim() ? `${t}${n ? `
311
314
  ${styleText("gray", S_BAR)}` : ""}` : ""}`;
312
315
  }
313
316
  case "error": {
314
317
  const t = n ? `${styleText("yellow", S_BAR)} ` : "", s = this.error.split(`
315
- `).map((i, f) => f === 0 ? `${n ? `${styleText("yellow", S_BAR_END)} ` : ""}${styleText("yellow", i)}` : ` ${i}`).join(`
318
+ `).map((i, h) => h === 0 ? `${n ? `${styleText("yellow", S_BAR_END)} ` : ""}${styleText("yellow", i)}` : ` ${i}`).join(`
316
319
  `), u = l.split(`
317
320
  `).length, r = s.split(`
318
321
  `).length + 1;
@@ -331,7 +334,7 @@ ${s}
331
334
  }
332
335
  default: {
333
336
  const t = n ? `${styleText("cyan", S_BAR)} ` : "", s = l.split(`
334
- `).length, u = I ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, n) : n ? [styleText("cyan", S_BAR_END)] : [], r = u.join(`
337
+ `).length, u = S ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, n) : n ? [styleText("cyan", S_BAR_END)] : [], r = u.join(`
335
338
  `), c = u.length + 1;
336
339
  return `${l}${t}${limitOptions({
337
340
  output: o.output,
@@ -423,8 +426,8 @@ const C = (o, e, s) => {
423
426
  hard: true,
424
427
  trim: false
425
428
  }, i = wrapAnsi(o, e, a).split(`
426
- `), c = i.reduce((n, t) => Math.max(fastStringWidth(t), n), 0);
427
- return wrapAnsi(o, e - (i.map(s).reduce((n, t) => Math.max(fastStringWidth(t), n), 0) - c), a);
429
+ `), c = i.reduce((n, t) => Math.max(fastStringWidth(t), n), 0), g = e - (i.map(s).reduce((n, t) => Math.max(fastStringWidth(t), n), 0) - c);
430
+ return wrapAnsi(o, g, a);
428
431
  };
429
432
  const note = (o = "", e = "", s) => {
430
433
  const a = s?.output ?? process$1.stdout, i = s?.withGuide ?? settings.withGuide, c = s?.format ?? W$1, g = [
@@ -559,19 +562,19 @@ ${styleText("gray", S_BAR)}` : ""}`;
559
562
  }
560
563
  default: {
561
564
  const r = n ? `${styleText("cyan", S_BAR)} ` : "", a = u.split(`
562
- `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n) : n ? [styleText("cyan", S_BAR_END)] : [], b = p.join(`
563
- `), f = p.length + 1;
565
+ `).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n) : n ? [styleText("cyan", S_BAR_END)] : [], f = p.join(`
566
+ `), b = p.length + 1;
564
567
  return `${u}${r}${limitOptions({
565
568
  output: t.output,
566
569
  cursor: this.cursor,
567
570
  options: this.options,
568
571
  maxItems: t.maxItems,
569
572
  columnPadding: r.length,
570
- rowPadding: a + f,
573
+ rowPadding: a + b,
571
574
  style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
572
575
  }).join(`
573
576
  ${r}`)}
574
- ${b}
577
+ ${f}
575
578
  `;
576
579
  }
577
580
  }
@@ -173,15 +173,16 @@ var require_common = /* @__PURE__ */ __commonJSMin(((exports, module) => {
173
173
  let templateIndex = 0;
174
174
  let starIndex = -1;
175
175
  let matchIndex = 0;
176
- while (searchIndex < search.length) if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) if (template[templateIndex] === "*") {
177
- starIndex = templateIndex;
178
- matchIndex = searchIndex;
179
- templateIndex++;
180
- } else {
181
- searchIndex++;
182
- templateIndex++;
183
- }
184
- else if (starIndex !== -1) {
176
+ while (searchIndex < search.length) if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
177
+ if (template[templateIndex] === "*") {
178
+ starIndex = templateIndex;
179
+ matchIndex = searchIndex;
180
+ templateIndex++;
181
+ } else {
182
+ searchIndex++;
183
+ templateIndex++;
184
+ }
185
+ } else if (starIndex !== -1) {
185
186
  templateIndex = starIndex + 1;
186
187
  matchIndex++;
187
188
  searchIndex = matchIndex;
@@ -3404,8 +3404,10 @@ function isBadArgument(arg) {
3404
3404
  }
3405
3405
  function toBinaryConfig(input, allowUnsafe) {
3406
3406
  if (input.length < 1 || input.length > 2) throw new GitPluginError(void 0, "binary", WRONG_NUMBER_ERR);
3407
- if (input.some(isBadArgument)) if (allowUnsafe) console.warn(WRONG_CHARS_ERR);
3408
- else throw new GitPluginError(void 0, "binary", WRONG_CHARS_ERR);
3407
+ if (input.some(isBadArgument)) {
3408
+ if (allowUnsafe) console.warn(WRONG_CHARS_ERR);
3409
+ else throw new GitPluginError(void 0, "binary", WRONG_CHARS_ERR);
3410
+ }
3409
3411
  const [binary, prefix] = input;
3410
3412
  return {
3411
3413
  binary,