mc8yp 2.7.3 → 2.8.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.
|
@@ -286,7 +286,7 @@ function wrapAnsi(string, columns, options) {
|
|
|
286
286
|
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
287
287
|
}
|
|
288
288
|
//#endregion
|
|
289
|
-
//#region node_modules/.pnpm/@clack+core@1.
|
|
289
|
+
//#region node_modules/.pnpm/@clack+core@1.5.0/node_modules/@clack/core/dist/index.mjs
|
|
290
290
|
var import_src = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
291
291
|
const ESC = "\x1B";
|
|
292
292
|
const CSI = `${ESC}[`;
|
|
@@ -362,6 +362,7 @@ const settings = {
|
|
|
362
362
|
error: "Something went wrong"
|
|
363
363
|
},
|
|
364
364
|
withGuide: true,
|
|
365
|
+
accessible: void 0,
|
|
365
366
|
date: {
|
|
366
367
|
monthNames: [...[
|
|
367
368
|
"January",
|
|
@@ -386,6 +387,12 @@ const settings = {
|
|
|
386
387
|
}
|
|
387
388
|
}
|
|
388
389
|
};
|
|
390
|
+
function isAccessible(n) {
|
|
391
|
+
if (n !== void 0) return n;
|
|
392
|
+
if (settings.accessible !== void 0) return settings.accessible;
|
|
393
|
+
const e = process.env.ACCESSIBLE;
|
|
394
|
+
return e !== void 0 && e !== "" && e !== "0" && e !== "false";
|
|
395
|
+
}
|
|
389
396
|
function isActionKey(n, e) {
|
|
390
397
|
if (typeof n == "string") return settings.aliases.get(n) === e;
|
|
391
398
|
for (const s of n) if (s !== void 0 && isActionKey(s, e)) return true;
|
|
@@ -414,15 +421,14 @@ function setRawMode(e, r) {
|
|
|
414
421
|
o.isTTY && o.setRawMode(r);
|
|
415
422
|
}
|
|
416
423
|
const getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
417
|
-
function runValidation(e,
|
|
424
|
+
function runValidation(e, a) {
|
|
418
425
|
if ("~standard" in e) {
|
|
419
|
-
const
|
|
420
|
-
|
|
421
|
-
return a.issues?.at(0)?.message;
|
|
426
|
+
const n = e["~standard"].validate(a);
|
|
427
|
+
return n instanceof Promise ? n.then((r) => r.issues?.at(0)?.message) : n.issues?.at(0)?.message;
|
|
422
428
|
}
|
|
423
|
-
return e(
|
|
429
|
+
return e(a);
|
|
424
430
|
}
|
|
425
|
-
var
|
|
431
|
+
var y = class {
|
|
426
432
|
input;
|
|
427
433
|
output;
|
|
428
434
|
_abortSignal;
|
|
@@ -437,9 +443,17 @@ var V = class {
|
|
|
437
443
|
error = "";
|
|
438
444
|
value;
|
|
439
445
|
userInput = "";
|
|
446
|
+
/**
|
|
447
|
+
* Whether accessible (static, screen-reader friendly) output is enabled for
|
|
448
|
+
* this prompt, resolved from the `accessible` option, the global setting,
|
|
449
|
+
* and the `ACCESSIBLE` env var.
|
|
450
|
+
*/
|
|
451
|
+
get accessible() {
|
|
452
|
+
return isAccessible(this.opts.accessible);
|
|
453
|
+
}
|
|
440
454
|
constructor(t, e = true) {
|
|
441
|
-
const { input: i = stdin, output:
|
|
442
|
-
this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render =
|
|
455
|
+
const { input: i = stdin, output: s = stdout, render: r, signal: n, ...o } = t;
|
|
456
|
+
this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = r.bind(this), this._track = e, this._abortSignal = n, this.input = i, this.output = s;
|
|
443
457
|
}
|
|
444
458
|
/**
|
|
445
459
|
* Unsubscribe all listeners
|
|
@@ -480,9 +494,9 @@ var V = class {
|
|
|
480
494
|
* @param data - The data to pass to the callback
|
|
481
495
|
*/
|
|
482
496
|
emit(t, ...e) {
|
|
483
|
-
const i = this._subscribers.get(t) ?? [],
|
|
484
|
-
for (const
|
|
485
|
-
for (const
|
|
497
|
+
const i = this._subscribers.get(t) ?? [], s = [];
|
|
498
|
+
for (const r of i) r.cb(...e), r.once && s.push(() => i.splice(i.indexOf(r), 1));
|
|
499
|
+
for (const r of s) r();
|
|
486
500
|
}
|
|
487
501
|
prompt() {
|
|
488
502
|
return new Promise((t) => {
|
|
@@ -523,22 +537,25 @@ var V = class {
|
|
|
523
537
|
name: "u"
|
|
524
538
|
}), this._setUserInput("");
|
|
525
539
|
}
|
|
526
|
-
onKeypress(t, e) {
|
|
527
|
-
if (this.
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
540
|
+
async onKeypress(t, e) {
|
|
541
|
+
if (this.state !== "validating") {
|
|
542
|
+
if (this._track && e.name !== "return" && (e.name && this._isActionKey(t, e) && this.rl?.write(null, {
|
|
543
|
+
ctrl: true,
|
|
544
|
+
name: "h"
|
|
545
|
+
}), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t && (t.toLowerCase() === "y" || t.toLowerCase() === "n") && this.emit("confirm", t.toLowerCase() === "y"), this.emit("key", t, e), e?.name === "return" && this._shouldSubmit(t, e)) {
|
|
546
|
+
if (this.opts.validate) {
|
|
547
|
+
const i = runValidation(this.opts.validate, this.value);
|
|
548
|
+
let s;
|
|
549
|
+
i instanceof Promise ? (this.state = "validating", this.render(), s = await i) : s = i, s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
|
|
550
|
+
}
|
|
551
|
+
this.state !== "error" && (this.state = "submit");
|
|
534
552
|
}
|
|
535
|
-
|
|
553
|
+
isActionKey([
|
|
554
|
+
t,
|
|
555
|
+
e?.name,
|
|
556
|
+
e?.sequence
|
|
557
|
+
], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
536
558
|
}
|
|
537
|
-
isActionKey([
|
|
538
|
-
t,
|
|
539
|
-
e?.name,
|
|
540
|
-
e?.sequence
|
|
541
|
-
], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
542
559
|
}
|
|
543
560
|
close() {
|
|
544
561
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
@@ -562,27 +579,27 @@ var V = class {
|
|
|
562
579
|
else {
|
|
563
580
|
const e = diffLines(this._prevFrame, t), i = getRows(this.output);
|
|
564
581
|
if (this.restoreCursor(), e) {
|
|
565
|
-
const
|
|
566
|
-
let
|
|
567
|
-
if (
|
|
582
|
+
const s = Math.max(0, e.numLinesAfter - i), r = Math.max(0, e.numLinesBefore - i);
|
|
583
|
+
let n = e.lines.find((o) => o >= s);
|
|
584
|
+
if (n === void 0) {
|
|
568
585
|
this._prevFrame = t;
|
|
569
586
|
return;
|
|
570
587
|
}
|
|
571
588
|
if (e.lines.length === 1) {
|
|
572
|
-
this.output.write(import_src.cursor.move(0,
|
|
589
|
+
this.output.write(import_src.cursor.move(0, n - r)), this.output.write(import_src.erase.lines(1));
|
|
573
590
|
const o = t.split(`
|
|
574
591
|
`);
|
|
575
|
-
this.output.write(o[
|
|
592
|
+
this.output.write(o[n]), this._prevFrame = t, this.output.write(import_src.cursor.move(0, o.length - n - 1));
|
|
576
593
|
return;
|
|
577
594
|
} else if (e.lines.length > 1) {
|
|
578
|
-
if (
|
|
595
|
+
if (s < r) n = s;
|
|
579
596
|
else {
|
|
580
|
-
const h =
|
|
597
|
+
const h = n - r;
|
|
581
598
|
h > 0 && this.output.write(import_src.cursor.move(0, h));
|
|
582
599
|
}
|
|
583
600
|
this.output.write(import_src.erase.down());
|
|
584
601
|
const f = t.split(`
|
|
585
|
-
`).slice(
|
|
602
|
+
`).slice(n);
|
|
586
603
|
this.output.write(f.join(`
|
|
587
604
|
`)), this._prevFrame = t;
|
|
588
605
|
return;
|
|
@@ -594,7 +611,7 @@ var V = class {
|
|
|
594
611
|
}
|
|
595
612
|
}
|
|
596
613
|
};
|
|
597
|
-
let u$1 = class u extends
|
|
614
|
+
let u$1 = class u extends y {
|
|
598
615
|
_mask = "•";
|
|
599
616
|
get cursor() {
|
|
600
617
|
return this._cursor;
|
|
@@ -621,7 +638,7 @@ let u$1 = class u extends V {
|
|
|
621
638
|
}
|
|
622
639
|
};
|
|
623
640
|
//#endregion
|
|
624
|
-
//#region node_modules/.pnpm/@clack+prompts@1.
|
|
641
|
+
//#region node_modules/.pnpm/@clack+prompts@1.8.0/node_modules/@clack/prompts/dist/index.mjs
|
|
625
642
|
function isUnicodeSupported() {
|
|
626
643
|
if (process$1.platform !== "win32") return process$1.env.TERM !== "linux";
|
|
627
644
|
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";
|
|
@@ -642,6 +659,7 @@ const symbol = (o) => {
|
|
|
642
659
|
case "cancel": return styleText("red", S_STEP_CANCEL);
|
|
643
660
|
case "error": return styleText("yellow", S_STEP_ERROR);
|
|
644
661
|
case "submit": return styleText("green", S_STEP_SUBMIT);
|
|
662
|
+
case "validating": return styleText("dim", S_STEP_ACTIVE);
|
|
645
663
|
}
|
|
646
664
|
};
|
|
647
665
|
`${styleText("dim", "↑/↓")}`, `${styleText("dim", "Space:")}`, `${styleText("dim", "Enter:")}`;
|
|
@@ -708,6 +726,7 @@ const command = defineCommand({
|
|
|
708
726
|
if (isCancel(passwordPrompt)) {
|
|
709
727
|
cancel("Cancelled.");
|
|
710
728
|
exit();
|
|
729
|
+
return;
|
|
711
730
|
}
|
|
712
731
|
if ((await getStoredC8yAuth()).some((cred) => cred.tenantUrl === cleanTenantUrl(tenantUrl))) {
|
|
713
732
|
if (!await consola.prompt("Credentials for this tenant already exist. Overwrite?", {
|