@stacksjs/rpx 0.3.1 → 0.4.1
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 +39 -5
- package/dist/cli.js +1006 -639
- package/dist/config.d.ts +2 -2
- package/dist/hosts.d.ts +3 -3
- package/dist/https.d.ts +8 -3
- package/dist/index.d.ts +7 -1
- package/dist/index.js +1402 -1024
- package/dist/start.d.ts +7 -6
- package/dist/types.d.ts +50 -7
- package/dist/utils.d.ts +4 -4
- package/package.json +6 -6
package/dist/cli.js
CHANGED
|
@@ -323,9 +323,12 @@ class Consola {
|
|
|
323
323
|
}
|
|
324
324
|
if (logObj.additional) {
|
|
325
325
|
if (!Array.isArray(logObj.additional)) {
|
|
326
|
-
logObj.additional = logObj.additional.split(
|
|
326
|
+
logObj.additional = logObj.additional.split(`
|
|
327
|
+
`);
|
|
327
328
|
}
|
|
328
|
-
logObj.args.push(
|
|
329
|
+
logObj.args.push(`
|
|
330
|
+
` + logObj.additional.join(`
|
|
331
|
+
`));
|
|
329
332
|
delete logObj.additional;
|
|
330
333
|
}
|
|
331
334
|
logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
|
|
@@ -470,7 +473,8 @@ var init_core = __esm(() => {
|
|
|
470
473
|
});
|
|
471
474
|
function parseStack(stack) {
|
|
472
475
|
const cwd = process.cwd() + sep;
|
|
473
|
-
const lines = stack.split(
|
|
476
|
+
const lines = stack.split(`
|
|
477
|
+
`).splice(1).map((l2) => l2.trim().replace("file://", "").replace(cwd, ""));
|
|
474
478
|
return lines;
|
|
475
479
|
}
|
|
476
480
|
function writeStream(data, stream) {
|
|
@@ -480,12 +484,14 @@ function writeStream(data, stream) {
|
|
|
480
484
|
|
|
481
485
|
class BasicReporter {
|
|
482
486
|
formatStack(stack, opts) {
|
|
483
|
-
return " " + parseStack(stack).join(
|
|
487
|
+
return " " + parseStack(stack).join(`
|
|
488
|
+
`);
|
|
484
489
|
}
|
|
485
490
|
formatArgs(args, opts) {
|
|
486
491
|
const _args = args.map((arg) => {
|
|
487
492
|
if (arg && typeof arg.stack === "string") {
|
|
488
|
-
return arg.message +
|
|
493
|
+
return arg.message + `
|
|
494
|
+
` + this.formatStack(arg.stack, opts);
|
|
489
495
|
}
|
|
490
496
|
return arg;
|
|
491
497
|
});
|
|
@@ -500,11 +506,15 @@ class BasicReporter {
|
|
|
500
506
|
formatLogObj(logObj, opts) {
|
|
501
507
|
const message = this.formatArgs(logObj.args, opts);
|
|
502
508
|
if (logObj.type === "box") {
|
|
503
|
-
return
|
|
509
|
+
return `
|
|
510
|
+
` + [
|
|
504
511
|
bracket(logObj.tag),
|
|
505
512
|
logObj.title && logObj.title,
|
|
506
|
-
...message.split(
|
|
507
|
-
|
|
513
|
+
...message.split(`
|
|
514
|
+
`)
|
|
515
|
+
].filter(Boolean).map((l2) => " > " + l2).join(`
|
|
516
|
+
`) + `
|
|
517
|
+
`;
|
|
508
518
|
}
|
|
509
519
|
return this.filterAndJoin([
|
|
510
520
|
bracket(logObj.type),
|
|
@@ -517,7 +527,8 @@ class BasicReporter {
|
|
|
517
527
|
columns: ctx.options.stdout.columns || 0,
|
|
518
528
|
...ctx.options.formatOptions
|
|
519
529
|
});
|
|
520
|
-
return writeStream(line +
|
|
530
|
+
return writeStream(line + `
|
|
531
|
+
`, logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout);
|
|
521
532
|
}
|
|
522
533
|
}
|
|
523
534
|
var bracket = (x2) => x2 ? `[${x2}]` : "";
|
|
@@ -552,7 +563,8 @@ function box(text, _opts = {}) {
|
|
|
552
563
|
..._opts.style
|
|
553
564
|
}
|
|
554
565
|
};
|
|
555
|
-
const textLines = text.split(
|
|
566
|
+
const textLines = text.split(`
|
|
567
|
+
`);
|
|
556
568
|
const boxLines = [];
|
|
557
569
|
const _color = getColor(opts.style.borderColor);
|
|
558
570
|
const borderStyle = {
|
|
@@ -593,7 +605,8 @@ function box(text, _opts = {}) {
|
|
|
593
605
|
if (opts.style.marginBottom > 0) {
|
|
594
606
|
boxLines.push("".repeat(opts.style.marginBottom));
|
|
595
607
|
}
|
|
596
|
-
return boxLines.join(
|
|
608
|
+
return boxLines.join(`
|
|
609
|
+
`);
|
|
597
610
|
}
|
|
598
611
|
var env2;
|
|
599
612
|
var argv;
|
|
@@ -881,7 +894,7 @@ class h2 {
|
|
|
881
894
|
}
|
|
882
895
|
this.state !== "error" && (this.state = "submit");
|
|
883
896
|
}
|
|
884
|
-
u === "
|
|
897
|
+
u === "\x03" && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
885
898
|
}
|
|
886
899
|
close() {
|
|
887
900
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
@@ -1152,7 +1165,8 @@ ${colors.yellow(S_BAR_END)} ${colors.yellow(this.error)}
|
|
|
1152
1165
|
return `${title}${colors.gray(S_BAR)} ${colors.dim(this.value || opts.placeholder)}`;
|
|
1153
1166
|
}
|
|
1154
1167
|
case "cancel": {
|
|
1155
|
-
return `${title}${colors.gray(S_BAR)} ${colors.strikethrough(colors.dim(this.value ?? ""))}${this.value?.trim() ?
|
|
1168
|
+
return `${title}${colors.gray(S_BAR)} ${colors.strikethrough(colors.dim(this.value ?? ""))}${this.value?.trim() ? `
|
|
1169
|
+
` + colors.gray(S_BAR) : ""}`;
|
|
1156
1170
|
}
|
|
1157
1171
|
default: {
|
|
1158
1172
|
return `${title}${colors.cyan(S_BAR)} ${value}
|
|
@@ -1280,7 +1294,9 @@ ${symbol(this.state)} ${opts.message}
|
|
|
1280
1294
|
${colors.gray(S_BAR)}` : ""}`;
|
|
1281
1295
|
}
|
|
1282
1296
|
case "error": {
|
|
1283
|
-
const footer = this.error.split(
|
|
1297
|
+
const footer = this.error.split(`
|
|
1298
|
+
`).map((ln, i) => i === 0 ? `${colors.yellow(S_BAR_END)} ${colors.yellow(ln)}` : ` ${ln}`).join(`
|
|
1299
|
+
`);
|
|
1284
1300
|
return title + colors.yellow(S_BAR) + " " + this.options.map((option, i) => {
|
|
1285
1301
|
const selected = this.value.includes(option.value);
|
|
1286
1302
|
const active = i === this.cursor;
|
|
@@ -1292,7 +1308,9 @@ ${colors.gray(S_BAR)}` : ""}`;
|
|
|
1292
1308
|
}
|
|
1293
1309
|
return opt(option, active ? "active" : "inactive");
|
|
1294
1310
|
}).join(`
|
|
1295
|
-
${colors.yellow(S_BAR)} `) +
|
|
1311
|
+
${colors.yellow(S_BAR)} `) + `
|
|
1312
|
+
` + footer + `
|
|
1313
|
+
`;
|
|
1296
1314
|
}
|
|
1297
1315
|
default: {
|
|
1298
1316
|
return `${title}${colors.cyan(S_BAR)} ${this.options.map((option, i) => {
|
|
@@ -1854,7 +1872,9 @@ var init_consola_36c0034f = __esm(() => {
|
|
|
1854
1872
|
};
|
|
1855
1873
|
FancyReporter = class FancyReporter2 extends BasicReporter {
|
|
1856
1874
|
formatStack(stack) {
|
|
1857
|
-
return
|
|
1875
|
+
return `
|
|
1876
|
+
` + parseStack(stack).map((line) => " " + line.replace(/^at +/, (m2) => colors.gray(m2)).replace(/\((.+)\)/, (_2, m2) => `(${colors.cyan(m2)})`)).join(`
|
|
1877
|
+
`);
|
|
1858
1878
|
}
|
|
1859
1879
|
formatType(logObj, isBadge, opts) {
|
|
1860
1880
|
const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
|
|
@@ -1865,9 +1885,12 @@ var init_consola_36c0034f = __esm(() => {
|
|
|
1865
1885
|
return _type ? getColor2(typeColor)(_type) : "";
|
|
1866
1886
|
}
|
|
1867
1887
|
formatLogObj(logObj, opts) {
|
|
1868
|
-
const [message, ...additional] = this.formatArgs(logObj.args, opts).split(
|
|
1888
|
+
const [message, ...additional] = this.formatArgs(logObj.args, opts).split(`
|
|
1889
|
+
`);
|
|
1869
1890
|
if (logObj.type === "box") {
|
|
1870
|
-
return box(characterFormat(message + (additional.length > 0 ?
|
|
1891
|
+
return box(characterFormat(message + (additional.length > 0 ? `
|
|
1892
|
+
` + additional.join(`
|
|
1893
|
+
`) : "")), {
|
|
1871
1894
|
title: logObj.title ? characterFormat(logObj.title) : undefined,
|
|
1872
1895
|
style: logObj.style
|
|
1873
1896
|
});
|
|
@@ -1882,12 +1905,16 @@ var init_consola_36c0034f = __esm(() => {
|
|
|
1882
1905
|
const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
|
|
1883
1906
|
const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
|
|
1884
1907
|
line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
|
|
1885
|
-
line += characterFormat(additional.length > 0 ?
|
|
1908
|
+
line += characterFormat(additional.length > 0 ? `
|
|
1909
|
+
` + additional.join(`
|
|
1910
|
+
`) : "");
|
|
1886
1911
|
if (logObj.type === "trace") {
|
|
1887
1912
|
const _err = new Error("Trace: " + logObj.message);
|
|
1888
1913
|
line += this.formatStack(_err.stack || "");
|
|
1889
1914
|
}
|
|
1890
|
-
return isBadge ?
|
|
1915
|
+
return isBadge ? `
|
|
1916
|
+
` + line + `
|
|
1917
|
+
` : line;
|
|
1891
1918
|
}
|
|
1892
1919
|
};
|
|
1893
1920
|
consola = createConsola2();
|
|
@@ -2107,7 +2134,8 @@ var require_isURL = __commonJS((exports, module) => {
|
|
|
2107
2134
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
2108
2135
|
}
|
|
2109
2136
|
function _nonIterableRest() {
|
|
2110
|
-
throw new TypeError(
|
|
2137
|
+
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2138
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
2111
2139
|
}
|
|
2112
2140
|
function _unsupportedIterableToArray(o, minLen) {
|
|
2113
2141
|
if (!o)
|
|
@@ -2565,7 +2593,7 @@ var require_isEmail = __commonJS((exports, module) => {
|
|
|
2565
2593
|
if (display_name_without_quotes === display_name) {
|
|
2566
2594
|
return false;
|
|
2567
2595
|
}
|
|
2568
|
-
var all_start_with_back_slash = display_name_without_quotes.split('"').length === display_name_without_quotes.split(
|
|
2596
|
+
var all_start_with_back_slash = display_name_without_quotes.split('"').length === display_name_without_quotes.split("\\\"").length;
|
|
2569
2597
|
if (!all_start_with_back_slash) {
|
|
2570
2598
|
return false;
|
|
2571
2599
|
}
|
|
@@ -4230,7 +4258,8 @@ var require_clear = __commonJS((exports, module) => {
|
|
|
4230
4258
|
throw _e;
|
|
4231
4259
|
}, f: F };
|
|
4232
4260
|
}
|
|
4233
|
-
throw new TypeError(
|
|
4261
|
+
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
4262
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
4234
4263
|
}
|
|
4235
4264
|
var normalCompletion = true, didErr = false, err2;
|
|
4236
4265
|
return { s: function s() {
|
|
@@ -4387,7 +4416,9 @@ var require_wrap = __commonJS((exports, module) => {
|
|
|
4387
4416
|
else
|
|
4388
4417
|
arr.push(`${tab}${w2}`);
|
|
4389
4418
|
return arr;
|
|
4390
|
-
}, [tab]).join(
|
|
4419
|
+
}, [tab]).join(`
|
|
4420
|
+
`)).join(`
|
|
4421
|
+
`);
|
|
4391
4422
|
};
|
|
4392
4423
|
});
|
|
4393
4424
|
var require_entriesToDisplay = __commonJS((exports, module) => {
|
|
@@ -4568,7 +4599,8 @@ var require_text = __commonJS((exports, module) => {
|
|
|
4568
4599
|
this.red = false;
|
|
4569
4600
|
this.fire();
|
|
4570
4601
|
this.render();
|
|
4571
|
-
this.out.write(
|
|
4602
|
+
this.out.write(`
|
|
4603
|
+
`);
|
|
4572
4604
|
this.close();
|
|
4573
4605
|
}
|
|
4574
4606
|
validate() {
|
|
@@ -4599,7 +4631,8 @@ var require_text = __commonJS((exports, module) => {
|
|
|
4599
4631
|
_this2.aborted = false;
|
|
4600
4632
|
_this2.fire();
|
|
4601
4633
|
_this2.render();
|
|
4602
|
-
_this2.out.write(
|
|
4634
|
+
_this2.out.write(`
|
|
4635
|
+
`);
|
|
4603
4636
|
_this2.close();
|
|
4604
4637
|
})();
|
|
4605
4638
|
}
|
|
@@ -4692,7 +4725,9 @@ var require_text = __commonJS((exports, module) => {
|
|
|
4692
4725
|
this.outputError = "";
|
|
4693
4726
|
this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), this.red ? color.red(this.rendered) : this.rendered].join(` `);
|
|
4694
4727
|
if (this.error) {
|
|
4695
|
-
this.outputError += this.errorMsg.split(
|
|
4728
|
+
this.outputError += this.errorMsg.split(`
|
|
4729
|
+
`).reduce((a, l3, i) => a + `
|
|
4730
|
+
${i ? " " : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
4696
4731
|
}
|
|
4697
4732
|
this.out.write(erase2.line + cursor2.to(0) + this.outputText + cursor2.save + this.outputError + cursor2.restore + cursor2.move(this.cursorOffset, 0));
|
|
4698
4733
|
}
|
|
@@ -4754,7 +4789,8 @@ var require_select = __commonJS((exports, module) => {
|
|
|
4754
4789
|
this.done = this.aborted = true;
|
|
4755
4790
|
this.fire();
|
|
4756
4791
|
this.render();
|
|
4757
|
-
this.out.write(
|
|
4792
|
+
this.out.write(`
|
|
4793
|
+
`);
|
|
4758
4794
|
this.close();
|
|
4759
4795
|
}
|
|
4760
4796
|
submit() {
|
|
@@ -4763,7 +4799,8 @@ var require_select = __commonJS((exports, module) => {
|
|
|
4763
4799
|
this.aborted = false;
|
|
4764
4800
|
this.fire();
|
|
4765
4801
|
this.render();
|
|
4766
|
-
this.out.write(
|
|
4802
|
+
this.out.write(`
|
|
4803
|
+
`);
|
|
4767
4804
|
this.close();
|
|
4768
4805
|
} else
|
|
4769
4806
|
this.bell();
|
|
@@ -4814,7 +4851,8 @@ var require_select = __commonJS((exports, module) => {
|
|
|
4814
4851
|
let _entriesToDisplay = entriesToDisplay(this.cursor, this.choices.length, this.optionsPerPage), startIndex = _entriesToDisplay.startIndex, endIndex = _entriesToDisplay.endIndex;
|
|
4815
4852
|
this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(false), this.done ? this.selection.title : this.selection.disabled ? color.yellow(this.warn) : color.gray(this.hint)].join(" ");
|
|
4816
4853
|
if (!this.done) {
|
|
4817
|
-
this.outputText +=
|
|
4854
|
+
this.outputText += `
|
|
4855
|
+
`;
|
|
4818
4856
|
for (let i = startIndex;i < endIndex; i++) {
|
|
4819
4857
|
let title, prefix, desc = "", v2 = this.choices[i];
|
|
4820
4858
|
if (i === startIndex && startIndex > 0) {
|
|
@@ -4833,14 +4871,16 @@ var require_select = __commonJS((exports, module) => {
|
|
|
4833
4871
|
if (v2.description && this.cursor === i) {
|
|
4834
4872
|
desc = ` - ${v2.description}`;
|
|
4835
4873
|
if (prefix.length + title.length + desc.length >= this.out.columns || v2.description.split(/\r?\n/).length > 1) {
|
|
4836
|
-
desc =
|
|
4874
|
+
desc = `
|
|
4875
|
+
` + wrap(v2.description, {
|
|
4837
4876
|
margin: 3,
|
|
4838
4877
|
width: this.out.columns
|
|
4839
4878
|
});
|
|
4840
4879
|
}
|
|
4841
4880
|
}
|
|
4842
4881
|
}
|
|
4843
|
-
this.outputText += `${prefix} ${title}${color.gray(desc)}
|
|
4882
|
+
this.outputText += `${prefix} ${title}${color.gray(desc)}
|
|
4883
|
+
`;
|
|
4844
4884
|
}
|
|
4845
4885
|
}
|
|
4846
4886
|
this.out.write(this.outputText);
|
|
@@ -4880,7 +4920,8 @@ var require_toggle = __commonJS((exports, module) => {
|
|
|
4880
4920
|
this.done = this.aborted = true;
|
|
4881
4921
|
this.fire();
|
|
4882
4922
|
this.render();
|
|
4883
|
-
this.out.write(
|
|
4923
|
+
this.out.write(`
|
|
4924
|
+
`);
|
|
4884
4925
|
this.close();
|
|
4885
4926
|
}
|
|
4886
4927
|
submit() {
|
|
@@ -4888,7 +4929,8 @@ var require_toggle = __commonJS((exports, module) => {
|
|
|
4888
4929
|
this.aborted = false;
|
|
4889
4930
|
this.fire();
|
|
4890
4931
|
this.render();
|
|
4891
|
-
this.out.write(
|
|
4932
|
+
this.out.write(`
|
|
4933
|
+
`);
|
|
4892
4934
|
this.close();
|
|
4893
4935
|
}
|
|
4894
4936
|
deactivate() {
|
|
@@ -5321,7 +5363,8 @@ var require_date = __commonJS((exports, module) => {
|
|
|
5321
5363
|
this.error = false;
|
|
5322
5364
|
this.fire();
|
|
5323
5365
|
this.render();
|
|
5324
|
-
this.out.write(
|
|
5366
|
+
this.out.write(`
|
|
5367
|
+
`);
|
|
5325
5368
|
this.close();
|
|
5326
5369
|
}
|
|
5327
5370
|
validate() {
|
|
@@ -5349,7 +5392,8 @@ var require_date = __commonJS((exports, module) => {
|
|
|
5349
5392
|
_this2.aborted = false;
|
|
5350
5393
|
_this2.fire();
|
|
5351
5394
|
_this2.render();
|
|
5352
|
-
_this2.out.write(
|
|
5395
|
+
_this2.out.write(`
|
|
5396
|
+
`);
|
|
5353
5397
|
_this2.close();
|
|
5354
5398
|
})();
|
|
5355
5399
|
}
|
|
@@ -5399,7 +5443,9 @@ var require_date = __commonJS((exports, module) => {
|
|
|
5399
5443
|
super.render();
|
|
5400
5444
|
this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(false), this.parts.reduce((arr, p3, idx) => arr.concat(idx === this.cursor && !this.done ? color.cyan().underline(p3.toString()) : p3), []).join("")].join(" ");
|
|
5401
5445
|
if (this.error) {
|
|
5402
|
-
this.outputText += this.errorMsg.split(
|
|
5446
|
+
this.outputText += this.errorMsg.split(`
|
|
5447
|
+
`).reduce((a, l3, i) => a + `
|
|
5448
|
+
${i ? ` ` : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
5403
5449
|
}
|
|
5404
5450
|
this.out.write(erase2.line + cursor2.to(0) + this.outputText);
|
|
5405
5451
|
}
|
|
@@ -5509,7 +5555,8 @@ var require_number = __commonJS((exports, module) => {
|
|
|
5509
5555
|
this.error = false;
|
|
5510
5556
|
this.fire();
|
|
5511
5557
|
this.render();
|
|
5512
|
-
this.out.write(
|
|
5558
|
+
this.out.write(`
|
|
5559
|
+
`);
|
|
5513
5560
|
this.close();
|
|
5514
5561
|
}
|
|
5515
5562
|
validate() {
|
|
@@ -5540,7 +5587,8 @@ var require_number = __commonJS((exports, module) => {
|
|
|
5540
5587
|
_this2.error = false;
|
|
5541
5588
|
_this2.fire();
|
|
5542
5589
|
_this2.render();
|
|
5543
|
-
_this2.out.write(
|
|
5590
|
+
_this2.out.write(`
|
|
5591
|
+
`);
|
|
5544
5592
|
_this2.close();
|
|
5545
5593
|
})();
|
|
5546
5594
|
}
|
|
@@ -5616,7 +5664,9 @@ var require_number = __commonJS((exports, module) => {
|
|
|
5616
5664
|
this.outputError = "";
|
|
5617
5665
|
this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), !this.done || !this.done && !this.placeholder ? color[this.color]().underline(this.rendered) : this.rendered].join(` `);
|
|
5618
5666
|
if (this.error) {
|
|
5619
|
-
this.outputError += this.errorMsg.split(
|
|
5667
|
+
this.outputError += this.errorMsg.split(`
|
|
5668
|
+
`).reduce((a, l3, i) => a + `
|
|
5669
|
+
${i ? ` ` : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
5620
5670
|
}
|
|
5621
5671
|
this.out.write(erase2.line + cursor2.to(0) + this.outputText + cursor2.save + this.outputError + cursor2.restore);
|
|
5622
5672
|
}
|
|
@@ -5683,7 +5733,8 @@ var require_multiselect = __commonJS((exports, module) => {
|
|
|
5683
5733
|
this.done = this.aborted = true;
|
|
5684
5734
|
this.fire();
|
|
5685
5735
|
this.render();
|
|
5686
|
-
this.out.write(
|
|
5736
|
+
this.out.write(`
|
|
5737
|
+
`);
|
|
5687
5738
|
this.close();
|
|
5688
5739
|
}
|
|
5689
5740
|
submit() {
|
|
@@ -5696,7 +5747,8 @@ var require_multiselect = __commonJS((exports, module) => {
|
|
|
5696
5747
|
this.aborted = false;
|
|
5697
5748
|
this.fire();
|
|
5698
5749
|
this.render();
|
|
5699
|
-
this.out.write(
|
|
5750
|
+
this.out.write(`
|
|
5751
|
+
`);
|
|
5700
5752
|
this.close();
|
|
5701
5753
|
}
|
|
5702
5754
|
}
|
|
@@ -5772,7 +5824,12 @@ var require_multiselect = __commonJS((exports, module) => {
|
|
|
5772
5824
|
if (typeof this.instructions === "string") {
|
|
5773
5825
|
return this.instructions;
|
|
5774
5826
|
}
|
|
5775
|
-
return
|
|
5827
|
+
return `
|
|
5828
|
+
Instructions:
|
|
5829
|
+
` + ` ${figures.arrowUp}/${figures.arrowDown}: Highlight option
|
|
5830
|
+
` + ` ${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
|
|
5831
|
+
` + (this.maxChoices === undefined ? ` a: Toggle all
|
|
5832
|
+
` : "") + ` enter/return: Complete answer`;
|
|
5776
5833
|
}
|
|
5777
5834
|
return "";
|
|
5778
5835
|
}
|
|
@@ -5786,7 +5843,8 @@ var require_multiselect = __commonJS((exports, module) => {
|
|
|
5786
5843
|
if (cursor3 === i && v2.description) {
|
|
5787
5844
|
desc = ` - ${v2.description}`;
|
|
5788
5845
|
if (prefix.length + title.length + desc.length >= this.out.columns || v2.description.split(/\r?\n/).length > 1) {
|
|
5789
|
-
desc =
|
|
5846
|
+
desc = `
|
|
5847
|
+
` + wrap(v2.description, {
|
|
5790
5848
|
margin: prefix.length,
|
|
5791
5849
|
width: this.out.columns
|
|
5792
5850
|
});
|
|
@@ -5811,7 +5869,9 @@ var require_multiselect = __commonJS((exports, module) => {
|
|
|
5811
5869
|
}
|
|
5812
5870
|
styledOptions.push(this.renderOption(this.cursor, options[i], i, prefix));
|
|
5813
5871
|
}
|
|
5814
|
-
return
|
|
5872
|
+
return `
|
|
5873
|
+
` + styledOptions.join(`
|
|
5874
|
+
`);
|
|
5815
5875
|
}
|
|
5816
5876
|
renderOptions(options) {
|
|
5817
5877
|
if (!this.done) {
|
|
@@ -5977,7 +6037,8 @@ var require_autocomplete = __commonJS((exports, module) => {
|
|
|
5977
6037
|
this.aborted = false;
|
|
5978
6038
|
this.fire();
|
|
5979
6039
|
this.render();
|
|
5980
|
-
this.out.write(
|
|
6040
|
+
this.out.write(`
|
|
6041
|
+
`);
|
|
5981
6042
|
this.close();
|
|
5982
6043
|
}
|
|
5983
6044
|
}
|
|
@@ -5986,7 +6047,8 @@ var require_autocomplete = __commonJS((exports, module) => {
|
|
|
5986
6047
|
this.exited = false;
|
|
5987
6048
|
this.fire();
|
|
5988
6049
|
this.render();
|
|
5989
|
-
this.out.write(
|
|
6050
|
+
this.out.write(`
|
|
6051
|
+
`);
|
|
5990
6052
|
this.close();
|
|
5991
6053
|
}
|
|
5992
6054
|
submit() {
|
|
@@ -5994,7 +6056,8 @@ var require_autocomplete = __commonJS((exports, module) => {
|
|
|
5994
6056
|
this.aborted = this.exited = false;
|
|
5995
6057
|
this.fire();
|
|
5996
6058
|
this.render();
|
|
5997
|
-
this.out.write(
|
|
6059
|
+
this.out.write(`
|
|
6060
|
+
`);
|
|
5998
6061
|
this.close();
|
|
5999
6062
|
}
|
|
6000
6063
|
_(c2, key) {
|
|
@@ -6083,7 +6146,8 @@ var require_autocomplete = __commonJS((exports, module) => {
|
|
|
6083
6146
|
if (v2.description) {
|
|
6084
6147
|
desc = ` - ${v2.description}`;
|
|
6085
6148
|
if (prefix.length + title.length + desc.length >= this.out.columns || v2.description.split(/\r?\n/).length > 1) {
|
|
6086
|
-
desc =
|
|
6149
|
+
desc = `
|
|
6150
|
+
` + wrap(v2.description, {
|
|
6087
6151
|
margin: 3,
|
|
6088
6152
|
width: this.out.columns
|
|
6089
6153
|
});
|
|
@@ -6102,8 +6166,10 @@ var require_autocomplete = __commonJS((exports, module) => {
|
|
|
6102
6166
|
let _entriesToDisplay = entriesToDisplay(this.select, this.choices.length, this.limit), startIndex = _entriesToDisplay.startIndex, endIndex = _entriesToDisplay.endIndex;
|
|
6103
6167
|
this.outputText = [style.symbol(this.done, this.aborted, this.exited), color.bold(this.msg), style.delimiter(this.completing), this.done && this.suggestions[this.select] ? this.suggestions[this.select].title : this.rendered = this.transform.render(this.input)].join(" ");
|
|
6104
6168
|
if (!this.done) {
|
|
6105
|
-
const suggestions = this.suggestions.slice(startIndex, endIndex).map((item, i) => this.renderOption(item, this.select === i + startIndex, i === 0 && startIndex > 0, i + startIndex === endIndex - 1 && endIndex < this.choices.length)).join(
|
|
6106
|
-
|
|
6169
|
+
const suggestions = this.suggestions.slice(startIndex, endIndex).map((item, i) => this.renderOption(item, this.select === i + startIndex, i === 0 && startIndex > 0, i + startIndex === endIndex - 1 && endIndex < this.choices.length)).join(`
|
|
6170
|
+
`);
|
|
6171
|
+
this.outputText += `
|
|
6172
|
+
` + (suggestions || color.gray(this.fallback.title));
|
|
6107
6173
|
}
|
|
6108
6174
|
this.out.write(erase2.line + cursor2.to(0) + this.outputText);
|
|
6109
6175
|
}
|
|
@@ -6231,7 +6297,8 @@ Instructions:
|
|
|
6231
6297
|
}
|
|
6232
6298
|
renderCurrentInput() {
|
|
6233
6299
|
return `
|
|
6234
|
-
Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
|
|
6300
|
+
Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
|
|
6301
|
+
`;
|
|
6235
6302
|
}
|
|
6236
6303
|
renderOption(cursor3, v2, i) {
|
|
6237
6304
|
let title;
|
|
@@ -6303,7 +6370,8 @@ var require_confirm = __commonJS((exports, module) => {
|
|
|
6303
6370
|
this.done = this.aborted = true;
|
|
6304
6371
|
this.fire();
|
|
6305
6372
|
this.render();
|
|
6306
|
-
this.out.write(
|
|
6373
|
+
this.out.write(`
|
|
6374
|
+
`);
|
|
6307
6375
|
this.close();
|
|
6308
6376
|
}
|
|
6309
6377
|
submit() {
|
|
@@ -6312,7 +6380,8 @@ var require_confirm = __commonJS((exports, module) => {
|
|
|
6312
6380
|
this.aborted = false;
|
|
6313
6381
|
this.fire();
|
|
6314
6382
|
this.render();
|
|
6315
|
-
this.out.write(
|
|
6383
|
+
this.out.write(`
|
|
6384
|
+
`);
|
|
6316
6385
|
this.close();
|
|
6317
6386
|
}
|
|
6318
6387
|
_(c2, key) {
|
|
@@ -6468,7 +6537,8 @@ var require_dist = __commonJS((exports, module) => {
|
|
|
6468
6537
|
throw _e;
|
|
6469
6538
|
}, f: F };
|
|
6470
6539
|
}
|
|
6471
|
-
throw new TypeError(
|
|
6540
|
+
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
6541
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
6472
6542
|
}
|
|
6473
6543
|
var normalCompletion = true, didErr = false, err2;
|
|
6474
6544
|
return { s: function s() {
|
|
@@ -6800,7 +6870,9 @@ var require_wrap2 = __commonJS((exports, module) => {
|
|
|
6800
6870
|
else
|
|
6801
6871
|
arr.push(`${tab}${w2}`);
|
|
6802
6872
|
return arr;
|
|
6803
|
-
}, [tab]).join(
|
|
6873
|
+
}, [tab]).join(`
|
|
6874
|
+
`)).join(`
|
|
6875
|
+
`);
|
|
6804
6876
|
};
|
|
6805
6877
|
});
|
|
6806
6878
|
var require_entriesToDisplay2 = __commonJS((exports, module) => {
|
|
@@ -6937,7 +7009,8 @@ var require_text2 = __commonJS((exports, module) => {
|
|
|
6937
7009
|
this.red = false;
|
|
6938
7010
|
this.fire();
|
|
6939
7011
|
this.render();
|
|
6940
|
-
this.out.write(
|
|
7012
|
+
this.out.write(`
|
|
7013
|
+
`);
|
|
6941
7014
|
this.close();
|
|
6942
7015
|
}
|
|
6943
7016
|
async validate() {
|
|
@@ -6963,7 +7036,8 @@ var require_text2 = __commonJS((exports, module) => {
|
|
|
6963
7036
|
this.aborted = false;
|
|
6964
7037
|
this.fire();
|
|
6965
7038
|
this.render();
|
|
6966
|
-
this.out.write(
|
|
7039
|
+
this.out.write(`
|
|
7040
|
+
`);
|
|
6967
7041
|
this.close();
|
|
6968
7042
|
}
|
|
6969
7043
|
next() {
|
|
@@ -7060,7 +7134,9 @@ var require_text2 = __commonJS((exports, module) => {
|
|
|
7060
7134
|
this.red ? color.red(this.rendered) : this.rendered
|
|
7061
7135
|
].join(` `);
|
|
7062
7136
|
if (this.error) {
|
|
7063
|
-
this.outputError += this.errorMsg.split(
|
|
7137
|
+
this.outputError += this.errorMsg.split(`
|
|
7138
|
+
`).reduce((a, l3, i) => a + `
|
|
7139
|
+
${i ? " " : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
7064
7140
|
}
|
|
7065
7141
|
this.out.write(erase2.line + cursor2.to(0) + this.outputText + cursor2.save + this.outputError + cursor2.restore + cursor2.move(this.cursorOffset, 0));
|
|
7066
7142
|
}
|
|
@@ -7113,7 +7189,8 @@ var require_select2 = __commonJS((exports, module) => {
|
|
|
7113
7189
|
this.done = this.aborted = true;
|
|
7114
7190
|
this.fire();
|
|
7115
7191
|
this.render();
|
|
7116
|
-
this.out.write(
|
|
7192
|
+
this.out.write(`
|
|
7193
|
+
`);
|
|
7117
7194
|
this.close();
|
|
7118
7195
|
}
|
|
7119
7196
|
submit() {
|
|
@@ -7122,7 +7199,8 @@ var require_select2 = __commonJS((exports, module) => {
|
|
|
7122
7199
|
this.aborted = false;
|
|
7123
7200
|
this.fire();
|
|
7124
7201
|
this.render();
|
|
7125
|
-
this.out.write(
|
|
7202
|
+
this.out.write(`
|
|
7203
|
+
`);
|
|
7126
7204
|
this.close();
|
|
7127
7205
|
} else
|
|
7128
7206
|
this.bell();
|
|
@@ -7178,7 +7256,8 @@ var require_select2 = __commonJS((exports, module) => {
|
|
|
7178
7256
|
this.done ? this.selection.title : this.selection.disabled ? color.yellow(this.warn) : color.gray(this.hint)
|
|
7179
7257
|
].join(" ");
|
|
7180
7258
|
if (!this.done) {
|
|
7181
|
-
this.outputText +=
|
|
7259
|
+
this.outputText += `
|
|
7260
|
+
`;
|
|
7182
7261
|
for (let i = startIndex;i < endIndex; i++) {
|
|
7183
7262
|
let title, prefix, desc = "", v2 = this.choices[i];
|
|
7184
7263
|
if (i === startIndex && startIndex > 0) {
|
|
@@ -7197,11 +7276,13 @@ var require_select2 = __commonJS((exports, module) => {
|
|
|
7197
7276
|
if (v2.description && this.cursor === i) {
|
|
7198
7277
|
desc = ` - ${v2.description}`;
|
|
7199
7278
|
if (prefix.length + title.length + desc.length >= this.out.columns || v2.description.split(/\r?\n/).length > 1) {
|
|
7200
|
-
desc =
|
|
7279
|
+
desc = `
|
|
7280
|
+
` + wrap(v2.description, { margin: 3, width: this.out.columns });
|
|
7201
7281
|
}
|
|
7202
7282
|
}
|
|
7203
7283
|
}
|
|
7204
|
-
this.outputText += `${prefix} ${title}${color.gray(desc)}
|
|
7284
|
+
this.outputText += `${prefix} ${title}${color.gray(desc)}
|
|
7285
|
+
`;
|
|
7205
7286
|
}
|
|
7206
7287
|
}
|
|
7207
7288
|
this.out.write(this.outputText);
|
|
@@ -7237,7 +7318,8 @@ var require_toggle2 = __commonJS((exports, module) => {
|
|
|
7237
7318
|
this.done = this.aborted = true;
|
|
7238
7319
|
this.fire();
|
|
7239
7320
|
this.render();
|
|
7240
|
-
this.out.write(
|
|
7321
|
+
this.out.write(`
|
|
7322
|
+
`);
|
|
7241
7323
|
this.close();
|
|
7242
7324
|
}
|
|
7243
7325
|
submit() {
|
|
@@ -7245,7 +7327,8 @@ var require_toggle2 = __commonJS((exports, module) => {
|
|
|
7245
7327
|
this.aborted = false;
|
|
7246
7328
|
this.fire();
|
|
7247
7329
|
this.render();
|
|
7248
|
-
this.out.write(
|
|
7330
|
+
this.out.write(`
|
|
7331
|
+
`);
|
|
7249
7332
|
this.close();
|
|
7250
7333
|
}
|
|
7251
7334
|
deactivate() {
|
|
@@ -7630,7 +7713,8 @@ var require_date2 = __commonJS((exports, module) => {
|
|
|
7630
7713
|
this.error = false;
|
|
7631
7714
|
this.fire();
|
|
7632
7715
|
this.render();
|
|
7633
|
-
this.out.write(
|
|
7716
|
+
this.out.write(`
|
|
7717
|
+
`);
|
|
7634
7718
|
this.close();
|
|
7635
7719
|
}
|
|
7636
7720
|
async validate() {
|
|
@@ -7653,7 +7737,8 @@ var require_date2 = __commonJS((exports, module) => {
|
|
|
7653
7737
|
this.aborted = false;
|
|
7654
7738
|
this.fire();
|
|
7655
7739
|
this.render();
|
|
7656
|
-
this.out.write(
|
|
7740
|
+
this.out.write(`
|
|
7741
|
+
`);
|
|
7657
7742
|
this.close();
|
|
7658
7743
|
}
|
|
7659
7744
|
up() {
|
|
@@ -7707,7 +7792,9 @@ var require_date2 = __commonJS((exports, module) => {
|
|
|
7707
7792
|
this.parts.reduce((arr, p3, idx) => arr.concat(idx === this.cursor && !this.done ? color.cyan().underline(p3.toString()) : p3), []).join("")
|
|
7708
7793
|
].join(" ");
|
|
7709
7794
|
if (this.error) {
|
|
7710
|
-
this.outputText += this.errorMsg.split(
|
|
7795
|
+
this.outputText += this.errorMsg.split(`
|
|
7796
|
+
`).reduce((a, l3, i) => a + `
|
|
7797
|
+
${i ? ` ` : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
7711
7798
|
}
|
|
7712
7799
|
this.out.write(erase2.line + cursor2.to(0) + this.outputText);
|
|
7713
7800
|
}
|
|
@@ -7782,7 +7869,8 @@ var require_number2 = __commonJS((exports, module) => {
|
|
|
7782
7869
|
this.error = false;
|
|
7783
7870
|
this.fire();
|
|
7784
7871
|
this.render();
|
|
7785
|
-
this.out.write(
|
|
7872
|
+
this.out.write(`
|
|
7873
|
+
`);
|
|
7786
7874
|
this.close();
|
|
7787
7875
|
}
|
|
7788
7876
|
async validate() {
|
|
@@ -7808,7 +7896,8 @@ var require_number2 = __commonJS((exports, module) => {
|
|
|
7808
7896
|
this.error = false;
|
|
7809
7897
|
this.fire();
|
|
7810
7898
|
this.render();
|
|
7811
|
-
this.out.write(
|
|
7899
|
+
this.out.write(`
|
|
7900
|
+
`);
|
|
7812
7901
|
this.close();
|
|
7813
7902
|
}
|
|
7814
7903
|
up() {
|
|
@@ -7888,7 +7977,9 @@ var require_number2 = __commonJS((exports, module) => {
|
|
|
7888
7977
|
!this.done || !this.done && !this.placeholder ? color[this.color]().underline(this.rendered) : this.rendered
|
|
7889
7978
|
].join(` `);
|
|
7890
7979
|
if (this.error) {
|
|
7891
|
-
this.outputError += this.errorMsg.split(
|
|
7980
|
+
this.outputError += this.errorMsg.split(`
|
|
7981
|
+
`).reduce((a, l3, i) => a + `
|
|
7982
|
+
${i ? ` ` : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
7892
7983
|
}
|
|
7893
7984
|
this.out.write(erase2.line + cursor2.to(0) + this.outputText + cursor2.save + this.outputError + cursor2.restore);
|
|
7894
7985
|
}
|
|
@@ -7946,7 +8037,8 @@ var require_multiselect2 = __commonJS((exports, module) => {
|
|
|
7946
8037
|
this.done = this.aborted = true;
|
|
7947
8038
|
this.fire();
|
|
7948
8039
|
this.render();
|
|
7949
|
-
this.out.write(
|
|
8040
|
+
this.out.write(`
|
|
8041
|
+
`);
|
|
7950
8042
|
this.close();
|
|
7951
8043
|
}
|
|
7952
8044
|
submit() {
|
|
@@ -7959,7 +8051,8 @@ var require_multiselect2 = __commonJS((exports, module) => {
|
|
|
7959
8051
|
this.aborted = false;
|
|
7960
8052
|
this.fire();
|
|
7961
8053
|
this.render();
|
|
7962
|
-
this.out.write(
|
|
8054
|
+
this.out.write(`
|
|
8055
|
+
`);
|
|
7963
8056
|
this.close();
|
|
7964
8057
|
}
|
|
7965
8058
|
}
|
|
@@ -8035,7 +8128,12 @@ var require_multiselect2 = __commonJS((exports, module) => {
|
|
|
8035
8128
|
if (typeof this.instructions === "string") {
|
|
8036
8129
|
return this.instructions;
|
|
8037
8130
|
}
|
|
8038
|
-
return
|
|
8131
|
+
return `
|
|
8132
|
+
Instructions:
|
|
8133
|
+
` + ` ${figures.arrowUp}/${figures.arrowDown}: Highlight option
|
|
8134
|
+
` + ` ${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
|
|
8135
|
+
` + (this.maxChoices === undefined ? ` a: Toggle all
|
|
8136
|
+
` : "") + ` enter/return: Complete answer`;
|
|
8039
8137
|
}
|
|
8040
8138
|
return "";
|
|
8041
8139
|
}
|
|
@@ -8049,7 +8147,8 @@ var require_multiselect2 = __commonJS((exports, module) => {
|
|
|
8049
8147
|
if (cursor3 === i && v2.description) {
|
|
8050
8148
|
desc = ` - ${v2.description}`;
|
|
8051
8149
|
if (prefix.length + title.length + desc.length >= this.out.columns || v2.description.split(/\r?\n/).length > 1) {
|
|
8052
|
-
desc =
|
|
8150
|
+
desc = `
|
|
8151
|
+
` + wrap(v2.description, { margin: prefix.length, width: this.out.columns });
|
|
8053
8152
|
}
|
|
8054
8153
|
}
|
|
8055
8154
|
}
|
|
@@ -8071,7 +8170,9 @@ var require_multiselect2 = __commonJS((exports, module) => {
|
|
|
8071
8170
|
}
|
|
8072
8171
|
styledOptions.push(this.renderOption(this.cursor, options[i], i, prefix));
|
|
8073
8172
|
}
|
|
8074
|
-
return
|
|
8173
|
+
return `
|
|
8174
|
+
` + styledOptions.join(`
|
|
8175
|
+
`);
|
|
8075
8176
|
}
|
|
8076
8177
|
renderOptions(options) {
|
|
8077
8178
|
if (!this.done) {
|
|
@@ -8193,7 +8294,8 @@ var require_autocomplete2 = __commonJS((exports, module) => {
|
|
|
8193
8294
|
this.aborted = false;
|
|
8194
8295
|
this.fire();
|
|
8195
8296
|
this.render();
|
|
8196
|
-
this.out.write(
|
|
8297
|
+
this.out.write(`
|
|
8298
|
+
`);
|
|
8197
8299
|
this.close();
|
|
8198
8300
|
}
|
|
8199
8301
|
}
|
|
@@ -8202,7 +8304,8 @@ var require_autocomplete2 = __commonJS((exports, module) => {
|
|
|
8202
8304
|
this.exited = false;
|
|
8203
8305
|
this.fire();
|
|
8204
8306
|
this.render();
|
|
8205
|
-
this.out.write(
|
|
8307
|
+
this.out.write(`
|
|
8308
|
+
`);
|
|
8206
8309
|
this.close();
|
|
8207
8310
|
}
|
|
8208
8311
|
submit() {
|
|
@@ -8210,7 +8313,8 @@ var require_autocomplete2 = __commonJS((exports, module) => {
|
|
|
8210
8313
|
this.aborted = this.exited = false;
|
|
8211
8314
|
this.fire();
|
|
8212
8315
|
this.render();
|
|
8213
|
-
this.out.write(
|
|
8316
|
+
this.out.write(`
|
|
8317
|
+
`);
|
|
8214
8318
|
this.close();
|
|
8215
8319
|
}
|
|
8216
8320
|
_(c2, key) {
|
|
@@ -8299,7 +8403,8 @@ var require_autocomplete2 = __commonJS((exports, module) => {
|
|
|
8299
8403
|
if (v2.description) {
|
|
8300
8404
|
desc = ` - ${v2.description}`;
|
|
8301
8405
|
if (prefix.length + title.length + desc.length >= this.out.columns || v2.description.split(/\r?\n/).length > 1) {
|
|
8302
|
-
desc =
|
|
8406
|
+
desc = `
|
|
8407
|
+
` + wrap(v2.description, { margin: 3, width: this.out.columns });
|
|
8303
8408
|
}
|
|
8304
8409
|
}
|
|
8305
8410
|
return prefix + " " + title + color.gray(desc || "");
|
|
@@ -8320,8 +8425,10 @@ var require_autocomplete2 = __commonJS((exports, module) => {
|
|
|
8320
8425
|
this.done && this.suggestions[this.select] ? this.suggestions[this.select].title : this.rendered = this.transform.render(this.input)
|
|
8321
8426
|
].join(" ");
|
|
8322
8427
|
if (!this.done) {
|
|
8323
|
-
const suggestions = this.suggestions.slice(startIndex, endIndex).map((item, i) => this.renderOption(item, this.select === i + startIndex, i === 0 && startIndex > 0, i + startIndex === endIndex - 1 && endIndex < this.choices.length)).join(
|
|
8324
|
-
|
|
8428
|
+
const suggestions = this.suggestions.slice(startIndex, endIndex).map((item, i) => this.renderOption(item, this.select === i + startIndex, i === 0 && startIndex > 0, i + startIndex === endIndex - 1 && endIndex < this.choices.length)).join(`
|
|
8429
|
+
`);
|
|
8430
|
+
this.outputText += `
|
|
8431
|
+
` + (suggestions || color.gray(this.fallback.title));
|
|
8325
8432
|
}
|
|
8326
8433
|
this.out.write(erase2.line + cursor2.to(0) + this.outputText);
|
|
8327
8434
|
}
|
|
@@ -8445,7 +8552,8 @@ Instructions:
|
|
|
8445
8552
|
}
|
|
8446
8553
|
renderCurrentInput() {
|
|
8447
8554
|
return `
|
|
8448
|
-
Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
|
|
8555
|
+
Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
|
|
8556
|
+
`;
|
|
8449
8557
|
}
|
|
8450
8558
|
renderOption(cursor3, v2, i) {
|
|
8451
8559
|
let title;
|
|
@@ -8518,7 +8626,8 @@ var require_confirm2 = __commonJS((exports, module) => {
|
|
|
8518
8626
|
this.done = this.aborted = true;
|
|
8519
8627
|
this.fire();
|
|
8520
8628
|
this.render();
|
|
8521
|
-
this.out.write(
|
|
8629
|
+
this.out.write(`
|
|
8630
|
+
`);
|
|
8522
8631
|
this.close();
|
|
8523
8632
|
}
|
|
8524
8633
|
submit() {
|
|
@@ -8527,7 +8636,8 @@ var require_confirm2 = __commonJS((exports, module) => {
|
|
|
8527
8636
|
this.aborted = false;
|
|
8528
8637
|
this.fire();
|
|
8529
8638
|
this.render();
|
|
8530
|
-
this.out.write(
|
|
8639
|
+
this.out.write(`
|
|
8640
|
+
`);
|
|
8531
8641
|
this.close();
|
|
8532
8642
|
}
|
|
8533
8643
|
_(c2, key) {
|
|
@@ -10550,7 +10660,7 @@ var ut = l((qe, P2) => {
|
|
|
10550
10660
|
return t = t.replace(C, "^$1"), t;
|
|
10551
10661
|
}
|
|
10552
10662
|
function Jt(t, e) {
|
|
10553
|
-
return t = `${t}`, t = t.replace(/(\\*)"/g,
|
|
10663
|
+
return t = `${t}`, t = t.replace(/(\\*)"/g, "$1$1\\\""), t = t.replace(/(\\*)$/, "$1$1"), t = `"${t}"`, t = t.replace(C, "^$1"), e && (t = t.replace(C, "^$1")), t;
|
|
10554
10664
|
}
|
|
10555
10665
|
P2.exports.command = Vt;
|
|
10556
10666
|
P2.exports.argument = Jt;
|
|
@@ -10989,11 +11099,13 @@ class Command {
|
|
|
10989
11099
|
title: "Commands",
|
|
10990
11100
|
body: commands.map((command) => {
|
|
10991
11101
|
return ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`;
|
|
10992
|
-
}).join(
|
|
11102
|
+
}).join(`
|
|
11103
|
+
`)
|
|
10993
11104
|
});
|
|
10994
11105
|
sections.push({
|
|
10995
11106
|
title: `For more info, run any command with the \`--help\` flag`,
|
|
10996
|
-
body: commands.map((command) => ` $ ${name}${command.name === "" ? "" : ` ${command.name}`} --help`).join(
|
|
11107
|
+
body: commands.map((command) => ` $ ${name}${command.name === "" ? "" : ` ${command.name}`} --help`).join(`
|
|
11108
|
+
`)
|
|
10997
11109
|
});
|
|
10998
11110
|
}
|
|
10999
11111
|
let options = this.isGlobalCommand ? globalOptions : [...this.options, ...globalOptions || []];
|
|
@@ -11006,7 +11118,8 @@ class Command {
|
|
|
11006
11118
|
title: "Options",
|
|
11007
11119
|
body: options.map((option) => {
|
|
11008
11120
|
return ` ${padRight(option.rawName, longestOptionName.length)} ${option.description} ${option.config.default === undefined ? "" : `(default: ${option.config.default})`}`;
|
|
11009
|
-
}).join(
|
|
11121
|
+
}).join(`
|
|
11122
|
+
`)
|
|
11010
11123
|
});
|
|
11011
11124
|
}
|
|
11012
11125
|
if (this.examples.length > 0) {
|
|
@@ -11017,7 +11130,8 @@ class Command {
|
|
|
11017
11130
|
return example(name);
|
|
11018
11131
|
}
|
|
11019
11132
|
return example;
|
|
11020
|
-
}).join(
|
|
11133
|
+
}).join(`
|
|
11134
|
+
`)
|
|
11021
11135
|
});
|
|
11022
11136
|
}
|
|
11023
11137
|
if (helpCallback) {
|
|
@@ -11026,7 +11140,9 @@ class Command {
|
|
|
11026
11140
|
console.log(sections.map((section) => {
|
|
11027
11141
|
return section.title ? `${section.title}:
|
|
11028
11142
|
${section.body}` : section.body;
|
|
11029
|
-
}).join(
|
|
11143
|
+
}).join(`
|
|
11144
|
+
|
|
11145
|
+
`));
|
|
11030
11146
|
}
|
|
11031
11147
|
outputVersion() {
|
|
11032
11148
|
const { name } = this.cli;
|
|
@@ -11327,7 +11443,7 @@ var TITLE_TERMINATORS = new Set([
|
|
|
11327
11443
|
...SENTENCE_TERMINATORS,
|
|
11328
11444
|
":",
|
|
11329
11445
|
'"',
|
|
11330
|
-
"
|
|
11446
|
+
"'",
|
|
11331
11447
|
"\u201D"
|
|
11332
11448
|
]);
|
|
11333
11449
|
var SMALL_WORDS = new Set([
|
|
@@ -12024,12 +12140,16 @@ var config = {
|
|
|
12024
12140
|
type: "Select the type of change that you\u2019re committing:",
|
|
12025
12141
|
scope: "Select the SCOPE of this change (optional):",
|
|
12026
12142
|
customScope: "Select the SCOPE of this change:",
|
|
12027
|
-
subject:
|
|
12028
|
-
|
|
12029
|
-
|
|
12143
|
+
subject: `Write a SHORT, IMPERATIVE tense description of the change:
|
|
12144
|
+
`,
|
|
12145
|
+
body: `Provide a LONGER description of the change (optional). Use "|" to break new line:
|
|
12146
|
+
`,
|
|
12147
|
+
breaking: `List any BREAKING CHANGES (optional). Use "|" to break new line:
|
|
12148
|
+
`,
|
|
12030
12149
|
footerPrefixesSelect: "Select the ISSUES type of the change list by this change (optional):",
|
|
12031
12150
|
customFooterPrefixes: "Input ISSUES prefix:",
|
|
12032
|
-
footer:
|
|
12151
|
+
footer: `List any ISSUES by this change. E.g.: #31, #34:
|
|
12152
|
+
`,
|
|
12033
12153
|
confirmCommit: "Are you sure you want to proceed with the commit above?"
|
|
12034
12154
|
},
|
|
12035
12155
|
types: [
|
|
@@ -13056,7 +13176,8 @@ var import_escape = __toESM2(require_escape(), 1);
|
|
|
13056
13176
|
var import_normalizeEmail = __toESM2(require_normalizeEmail(), 1);
|
|
13057
13177
|
var CompilerBuffer = class _CompilerBuffer {
|
|
13058
13178
|
#content = "";
|
|
13059
|
-
newLine =
|
|
13179
|
+
newLine = `
|
|
13180
|
+
`;
|
|
13060
13181
|
writeStatement(statement) {
|
|
13061
13182
|
this.#content = `${this.#content}${this.newLine}${statement}`;
|
|
13062
13183
|
}
|
|
@@ -13194,7 +13315,8 @@ function defineFieldValidations({
|
|
|
13194
13315
|
variableName,
|
|
13195
13316
|
dropMissingCheck
|
|
13196
13317
|
}) {
|
|
13197
|
-
return `${validations.map((one) => emitValidationSnippet(one, variableName, bail, dropMissingCheck)).join(
|
|
13318
|
+
return `${validations.map((one) => emitValidationSnippet(one, variableName, bail, dropMissingCheck)).join(`
|
|
13319
|
+
`)}`;
|
|
13198
13320
|
}
|
|
13199
13321
|
function defineArrayInitialOutput({
|
|
13200
13322
|
variableName,
|
|
@@ -16307,12 +16429,16 @@ var git_default = {
|
|
|
16307
16429
|
type: "Select the type of change that you\u2019re committing:",
|
|
16308
16430
|
scope: "Select the SCOPE of this change (optional):",
|
|
16309
16431
|
customScope: "Select the SCOPE of this change:",
|
|
16310
|
-
subject:
|
|
16311
|
-
|
|
16312
|
-
|
|
16432
|
+
subject: `Write a SHORT, IMPERATIVE tense description of the change:
|
|
16433
|
+
`,
|
|
16434
|
+
body: `Provide a LONGER description of the change (optional). Use "|" to break new line:
|
|
16435
|
+
`,
|
|
16436
|
+
breaking: `List any BREAKING CHANGES (optional). Use "|" to break new line:
|
|
16437
|
+
`,
|
|
16313
16438
|
footerPrefixesSelect: "Select the ISSUES type of the change list by this change (optional):",
|
|
16314
16439
|
customFooterPrefixes: "Input ISSUES prefix:",
|
|
16315
|
-
footer:
|
|
16440
|
+
footer: `List any ISSUES by this change. E.g.: #31, #34:
|
|
16441
|
+
`,
|
|
16316
16442
|
confirmCommit: "Are you sure you want to proceed with the commit above?"
|
|
16317
16443
|
},
|
|
16318
16444
|
types: [
|
|
@@ -16852,7 +16978,7 @@ function determineAppEnv() {
|
|
|
16852
16978
|
if (app2.env === "production")
|
|
16853
16979
|
return "prod";
|
|
16854
16980
|
if (!app2.env)
|
|
16855
|
-
throw new Error("Couldn
|
|
16981
|
+
throw new Error("Couldn't determine app environment");
|
|
16856
16982
|
return app2.env;
|
|
16857
16983
|
}
|
|
16858
16984
|
|
|
@@ -16889,7 +17015,8 @@ class ErrorHandler {
|
|
|
16889
17015
|
console.error("Error is not an instance of Error:", err);
|
|
16890
17016
|
return;
|
|
16891
17017
|
}
|
|
16892
|
-
const formattedError = `[${new Date().toISOString()}] ${err.name}: ${err.message}
|
|
17018
|
+
const formattedError = `[${new Date().toISOString()}] ${err.name}: ${err.message}
|
|
17019
|
+
`;
|
|
16893
17020
|
const logFilePath = logsPath("stacks.log") ?? logsPath("errors.log");
|
|
16894
17021
|
try {
|
|
16895
17022
|
await mkdir(dirname(logFilePath), { recursive: true });
|
|
@@ -16927,7 +17054,8 @@ function handleError(err, options) {
|
|
|
16927
17054
|
return ErrorHandler.handle(err, options);
|
|
16928
17055
|
}
|
|
16929
17056
|
async function writeToLogFile(message, options) {
|
|
16930
|
-
const formattedMessage = `[${new Date().toISOString()}] ${message}
|
|
17057
|
+
const formattedMessage = `[${new Date().toISOString()}] ${message}
|
|
17058
|
+
`;
|
|
16931
17059
|
try {
|
|
16932
17060
|
const logFile = options?.logFile ?? exports_config.logging.logsPath ?? "storage/logs/stacks.log";
|
|
16933
17061
|
try {
|
|
@@ -17873,9 +18001,12 @@ function stringEncaseCRLFWithFirstIndex(string2, prefix, postfix, index) {
|
|
|
17873
18001
|
let returnValue = "";
|
|
17874
18002
|
do {
|
|
17875
18003
|
const gotCR = string2[index - 1] === "\r";
|
|
17876
|
-
returnValue += string2.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ?
|
|
18004
|
+
returnValue += string2.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? `\r
|
|
18005
|
+
` : `
|
|
18006
|
+
`) + postfix;
|
|
17877
18007
|
endIndex = index + 1;
|
|
17878
|
-
index = string2.indexOf(
|
|
18008
|
+
index = string2.indexOf(`
|
|
18009
|
+
`, endIndex);
|
|
17879
18010
|
} while (index !== -1);
|
|
17880
18011
|
returnValue += string2.slice(endIndex);
|
|
17881
18012
|
return returnValue;
|
|
@@ -18015,7 +18146,8 @@ var applyStyle = (self2, string2) => {
|
|
|
18015
18146
|
styler = styler.parent;
|
|
18016
18147
|
}
|
|
18017
18148
|
}
|
|
18018
|
-
const lfIndex = string2.indexOf(
|
|
18149
|
+
const lfIndex = string2.indexOf(`
|
|
18150
|
+
`);
|
|
18019
18151
|
if (lfIndex !== -1) {
|
|
18020
18152
|
string2 = stringEncaseCRLFWithFirstIndex(string2, closeAll, openAll, lfIndex);
|
|
18021
18153
|
}
|
|
@@ -18049,7 +18181,8 @@ var changePrototype = (to, from) => {
|
|
|
18049
18181
|
}
|
|
18050
18182
|
Object.setPrototypeOf(to, fromPrototype);
|
|
18051
18183
|
};
|
|
18052
|
-
var wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}
|
|
18184
|
+
var wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
|
|
18185
|
+
${fromBody}`;
|
|
18053
18186
|
var toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
|
|
18054
18187
|
var toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
|
|
18055
18188
|
var changeToString = (to, from, name) => {
|
|
@@ -18650,7 +18783,8 @@ class Ora {
|
|
|
18650
18783
|
const fullSuffixText = this.#getFullSuffixText(this.#suffixText, "-");
|
|
18651
18784
|
const fullText = " ".repeat(this.#indent) + fullPrefixText + "--" + this.#text + "--" + fullSuffixText;
|
|
18652
18785
|
this.#lineCount = 0;
|
|
18653
|
-
for (const line of stripAnsi3(fullText).split(
|
|
18786
|
+
for (const line of stripAnsi3(fullText).split(`
|
|
18787
|
+
`)) {
|
|
18654
18788
|
this.#lineCount += Math.max(1, Math.ceil(stringWidth2(line, { countAnsiEscapeCodes: true }) / columns));
|
|
18655
18789
|
}
|
|
18656
18790
|
}
|
|
@@ -18720,7 +18854,8 @@ class Ora {
|
|
|
18720
18854
|
}
|
|
18721
18855
|
if (!this.#isEnabled) {
|
|
18722
18856
|
if (this.text) {
|
|
18723
|
-
this.#stream.write(`- ${this.text}
|
|
18857
|
+
this.#stream.write(`- ${this.text}
|
|
18858
|
+
`);
|
|
18724
18859
|
}
|
|
18725
18860
|
return this;
|
|
18726
18861
|
}
|
|
@@ -18778,7 +18913,8 @@ class Ora {
|
|
|
18778
18913
|
const fullText = typeof text2 === "string" ? " " + text2 : "";
|
|
18779
18914
|
const suffixText = options2.suffixText ?? this.#suffixText;
|
|
18780
18915
|
const fullSuffixText = this.#getFullSuffixText(suffixText, " ");
|
|
18781
|
-
const textToWrite = fullPrefixText + symbolText + fullText + fullSuffixText +
|
|
18916
|
+
const textToWrite = fullPrefixText + symbolText + fullText + fullSuffixText + `
|
|
18917
|
+
`;
|
|
18782
18918
|
this.stop();
|
|
18783
18919
|
this.#stream.write(textToWrite);
|
|
18784
18920
|
return this;
|
|
@@ -20325,7 +20461,7 @@ var quotes = collect([
|
|
|
20325
20461
|
]);
|
|
20326
20462
|
var export_prompts = import_prompts.default;
|
|
20327
20463
|
// package.json
|
|
20328
|
-
var version = "0.
|
|
20464
|
+
var version = "0.4.1";
|
|
20329
20465
|
|
|
20330
20466
|
// src/config.ts
|
|
20331
20467
|
import os2 from "os";
|
|
@@ -20334,26 +20470,40 @@ import path from "path";
|
|
|
20334
20470
|
// node_modules/bun-config/dist/index.js
|
|
20335
20471
|
import { resolve } from "path";
|
|
20336
20472
|
import process2 from "process";
|
|
20337
|
-
function deepMerge(target,
|
|
20338
|
-
if (!
|
|
20339
|
-
return
|
|
20340
|
-
|
|
20341
|
-
if (
|
|
20342
|
-
|
|
20343
|
-
|
|
20344
|
-
|
|
20345
|
-
|
|
20346
|
-
|
|
20347
|
-
|
|
20348
|
-
|
|
20349
|
-
|
|
20473
|
+
function deepMerge(target, source) {
|
|
20474
|
+
if (Array.isArray(source) && !Array.isArray(target)) {
|
|
20475
|
+
return source;
|
|
20476
|
+
}
|
|
20477
|
+
if (Array.isArray(source) && Array.isArray(target)) {
|
|
20478
|
+
return source.map((sourceItem, index) => {
|
|
20479
|
+
const targetItem = target[index];
|
|
20480
|
+
if (isObject3(sourceItem) && isObject3(targetItem)) {
|
|
20481
|
+
return deepMerge(targetItem, sourceItem);
|
|
20482
|
+
}
|
|
20483
|
+
return sourceItem;
|
|
20484
|
+
});
|
|
20485
|
+
}
|
|
20486
|
+
if (!isObject3(source) || !isObject3(target)) {
|
|
20487
|
+
return source;
|
|
20488
|
+
}
|
|
20489
|
+
const merged = { ...target };
|
|
20490
|
+
for (const key in source) {
|
|
20491
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
20492
|
+
const sourceValue = source[key];
|
|
20493
|
+
const targetValue = merged[key];
|
|
20494
|
+
if (sourceValue === null || sourceValue === undefined) {
|
|
20495
|
+
merged[key] = sourceValue;
|
|
20496
|
+
} else if (isObject3(sourceValue) && isObject3(targetValue)) {
|
|
20497
|
+
merged[key] = deepMerge(targetValue, sourceValue);
|
|
20498
|
+
} else {
|
|
20499
|
+
merged[key] = sourceValue;
|
|
20350
20500
|
}
|
|
20351
20501
|
}
|
|
20352
20502
|
}
|
|
20353
|
-
return
|
|
20503
|
+
return merged;
|
|
20354
20504
|
}
|
|
20355
20505
|
function isObject3(item) {
|
|
20356
|
-
return item && typeof item === "object" && !Array.isArray(item);
|
|
20506
|
+
return Boolean(item && typeof item === "object" && !Array.isArray(item));
|
|
20357
20507
|
}
|
|
20358
20508
|
async function loadConfig({ name, cwd, defaultConfig }) {
|
|
20359
20509
|
const configPath = resolve(cwd || process2.cwd(), `${name}.config`);
|
|
@@ -20373,23 +20523,12 @@ var config4 = await loadConfig({
|
|
|
20373
20523
|
from: "localhost:5173",
|
|
20374
20524
|
to: "stacks.localhost",
|
|
20375
20525
|
https: {
|
|
20376
|
-
domain: "stacks.localhost",
|
|
20377
|
-
hostCertCN: "stacks.localhost",
|
|
20378
20526
|
caCertPath: path.join(os2.homedir(), ".stacks", "ssl", `stacks.localhost.ca.crt`),
|
|
20379
20527
|
certPath: path.join(os2.homedir(), ".stacks", "ssl", `stacks.localhost.crt`),
|
|
20380
|
-
keyPath: path.join(os2.homedir(), ".stacks", "ssl", `stacks.localhost.crt.key`)
|
|
20381
|
-
altNameIPs: ["127.0.0.1"],
|
|
20382
|
-
altNameURIs: ["localhost"],
|
|
20383
|
-
organizationName: "stacksjs.org",
|
|
20384
|
-
countryName: "US",
|
|
20385
|
-
stateName: "California",
|
|
20386
|
-
localityName: "Playa Vista",
|
|
20387
|
-
commonName: "stacks.localhost",
|
|
20388
|
-
validityDays: 180,
|
|
20389
|
-
verbose: false
|
|
20528
|
+
keyPath: path.join(os2.homedir(), ".stacks", "ssl", `stacks.localhost.crt.key`)
|
|
20390
20529
|
},
|
|
20391
|
-
etcHostsCleanup:
|
|
20392
|
-
verbose:
|
|
20530
|
+
etcHostsCleanup: true,
|
|
20531
|
+
verbose: false
|
|
20393
20532
|
}
|
|
20394
20533
|
});
|
|
20395
20534
|
|
|
@@ -20511,7 +20650,8 @@ var require_baseN = __commonJS2((exports, module) => {
|
|
|
20511
20650
|
}
|
|
20512
20651
|
if (maxline) {
|
|
20513
20652
|
var regex3 = new RegExp(".{1," + maxline + "}", "g");
|
|
20514
|
-
output = output.match(regex3).join(
|
|
20653
|
+
output = output.match(regex3).join(`\r
|
|
20654
|
+
`);
|
|
20515
20655
|
}
|
|
20516
20656
|
return output;
|
|
20517
20657
|
};
|
|
@@ -21368,7 +21508,8 @@ var require_util3 = __commonJS2((exports, module) => {
|
|
|
21368
21508
|
line += isNaN(chr3) ? "=" : _base64.charAt(chr3 & 63);
|
|
21369
21509
|
}
|
|
21370
21510
|
if (maxline && line.length > maxline) {
|
|
21371
|
-
output += line.substr(0, maxline) +
|
|
21511
|
+
output += line.substr(0, maxline) + `\r
|
|
21512
|
+
`;
|
|
21372
21513
|
line = line.substr(maxline);
|
|
21373
21514
|
}
|
|
21374
21515
|
}
|
|
@@ -21461,7 +21602,8 @@ var require_util3 = __commonJS2((exports, module) => {
|
|
|
21461
21602
|
line += isNaN(chr3) ? "=" : _base64.charAt(chr3 & 63);
|
|
21462
21603
|
}
|
|
21463
21604
|
if (maxline && line.length > maxline) {
|
|
21464
|
-
output += line.substr(0, maxline) +
|
|
21605
|
+
output += line.substr(0, maxline) + `\r
|
|
21606
|
+
`;
|
|
21465
21607
|
line = line.substr(maxline);
|
|
21466
21608
|
}
|
|
21467
21609
|
}
|
|
@@ -23665,7 +23807,8 @@ var require_asn1 = __commonJS2((exports, module) => {
|
|
|
23665
23807
|
level = level || 0;
|
|
23666
23808
|
indentation = indentation || 2;
|
|
23667
23809
|
if (level > 0) {
|
|
23668
|
-
rval +=
|
|
23810
|
+
rval += `
|
|
23811
|
+
`;
|
|
23669
23812
|
}
|
|
23670
23813
|
var indent = "";
|
|
23671
23814
|
for (var i = 0;i < level * indentation; ++i) {
|
|
@@ -23756,8 +23899,10 @@ var require_asn1 = __commonJS2((exports, module) => {
|
|
|
23756
23899
|
} else {
|
|
23757
23900
|
rval += obj.type;
|
|
23758
23901
|
}
|
|
23759
|
-
rval +=
|
|
23760
|
-
|
|
23902
|
+
rval += `
|
|
23903
|
+
`;
|
|
23904
|
+
rval += indent + "Constructed: " + obj.constructed + `
|
|
23905
|
+
`;
|
|
23761
23906
|
if (obj.composed) {
|
|
23762
23907
|
var subvalues = 0;
|
|
23763
23908
|
var sub = "";
|
|
@@ -24204,7 +24349,8 @@ var require_pem = __commonJS2((exports, module) => {
|
|
|
24204
24349
|
var pem = module.exports = forge.pem = forge.pem || {};
|
|
24205
24350
|
pem.encode = function(msg, options2) {
|
|
24206
24351
|
options2 = options2 || {};
|
|
24207
|
-
var rval = "-----BEGIN " + msg.type +
|
|
24352
|
+
var rval = "-----BEGIN " + msg.type + `-----\r
|
|
24353
|
+
`;
|
|
24208
24354
|
var header;
|
|
24209
24355
|
if (msg.procType) {
|
|
24210
24356
|
header = {
|
|
@@ -24230,10 +24376,13 @@ var require_pem = __commonJS2((exports, module) => {
|
|
|
24230
24376
|
}
|
|
24231
24377
|
}
|
|
24232
24378
|
if (msg.procType) {
|
|
24233
|
-
rval +=
|
|
24379
|
+
rval += `\r
|
|
24380
|
+
`;
|
|
24234
24381
|
}
|
|
24235
|
-
rval += forge.util.encode64(msg.body, options2.maxline || 64) +
|
|
24236
|
-
|
|
24382
|
+
rval += forge.util.encode64(msg.body, options2.maxline || 64) + `\r
|
|
24383
|
+
`;
|
|
24384
|
+
rval += "-----END " + msg.type + `-----\r
|
|
24385
|
+
`;
|
|
24237
24386
|
return rval;
|
|
24238
24387
|
};
|
|
24239
24388
|
pem.decode = function(str) {
|
|
@@ -24320,7 +24469,8 @@ var require_pem = __commonJS2((exports, module) => {
|
|
|
24320
24469
|
for (var i = 0;i < header.values.length; ++i) {
|
|
24321
24470
|
values2.push(header.values[i].replace(/^(\S+\r\n)/, insertSpace));
|
|
24322
24471
|
}
|
|
24323
|
-
rval += values2.join(",") +
|
|
24472
|
+
rval += values2.join(",") + `\r
|
|
24473
|
+
`;
|
|
24324
24474
|
var length = 0;
|
|
24325
24475
|
var candidate = -1;
|
|
24326
24476
|
for (var i = 0;i < rval.length; ++i, ++length) {
|
|
@@ -24328,9 +24478,11 @@ var require_pem = __commonJS2((exports, module) => {
|
|
|
24328
24478
|
var insert = rval[candidate];
|
|
24329
24479
|
if (insert === ",") {
|
|
24330
24480
|
++candidate;
|
|
24331
|
-
rval = rval.substr(0, candidate) +
|
|
24481
|
+
rval = rval.substr(0, candidate) + `\r
|
|
24482
|
+
` + rval.substr(candidate);
|
|
24332
24483
|
} else {
|
|
24333
|
-
rval = rval.substr(0, candidate) +
|
|
24484
|
+
rval = rval.substr(0, candidate) + `\r
|
|
24485
|
+
` + insert + rval.substr(candidate + 1);
|
|
24334
24486
|
}
|
|
24335
24487
|
length = i - candidate - 1;
|
|
24336
24488
|
candidate = -1;
|
|
@@ -25763,13 +25915,13 @@ var require_jsbn = __commonJS2((exports, module) => {
|
|
|
25763
25915
|
var BI_RC = new Array;
|
|
25764
25916
|
var rr;
|
|
25765
25917
|
var vv;
|
|
25766
|
-
rr =
|
|
25918
|
+
rr = 48;
|
|
25767
25919
|
for (vv = 0;vv <= 9; ++vv)
|
|
25768
25920
|
BI_RC[rr++] = vv;
|
|
25769
|
-
rr =
|
|
25921
|
+
rr = 97;
|
|
25770
25922
|
for (vv = 10;vv < 36; ++vv)
|
|
25771
25923
|
BI_RC[rr++] = vv;
|
|
25772
|
-
rr =
|
|
25924
|
+
rr = 65;
|
|
25773
25925
|
for (vv = 10;vv < 36; ++vv)
|
|
25774
25926
|
BI_RC[rr++] = vv;
|
|
25775
25927
|
function int2char(n) {
|
|
@@ -27249,7 +27401,7 @@ var require_pkcs1 = __commonJS2((exports, module) => {
|
|
|
27249
27401
|
var PS = "";
|
|
27250
27402
|
var PS_length = maxLength - message.length;
|
|
27251
27403
|
for (var i = 0;i < PS_length; i++) {
|
|
27252
|
-
PS += "\
|
|
27404
|
+
PS += "\x00";
|
|
27253
27405
|
}
|
|
27254
27406
|
var DB = lHash.getBytes() + PS + "\x01" + message;
|
|
27255
27407
|
if (!seed) {
|
|
@@ -27264,7 +27416,7 @@ var require_pkcs1 = __commonJS2((exports, module) => {
|
|
|
27264
27416
|
var maskedDB = forge.util.xorBytes(DB, dbMask, DB.length);
|
|
27265
27417
|
var seedMask = rsa_mgf1(maskedDB, md.digestLength, mgf1Md);
|
|
27266
27418
|
var maskedSeed = forge.util.xorBytes(seed, seedMask, seed.length);
|
|
27267
|
-
return "\
|
|
27419
|
+
return "\x00" + maskedSeed + maskedDB;
|
|
27268
27420
|
};
|
|
27269
27421
|
pkcs1.decode_rsa_oaep = function(key, em, options2) {
|
|
27270
27422
|
var label;
|
|
@@ -27311,7 +27463,7 @@ var require_pkcs1 = __commonJS2((exports, module) => {
|
|
|
27311
27463
|
var dbMask = rsa_mgf1(seed, keyLength - md.digestLength - 1, mgf1Md);
|
|
27312
27464
|
var db = forge.util.xorBytes(maskedDB, dbMask, maskedDB.length);
|
|
27313
27465
|
var lHashPrime = db.substring(0, md.digestLength);
|
|
27314
|
-
var error = y !== "\
|
|
27466
|
+
var error = y !== "\x00";
|
|
27315
27467
|
for (var i = 0;i < md.digestLength; ++i) {
|
|
27316
27468
|
error |= lHash.charAt(i) !== lHashPrime.charAt(i);
|
|
27317
27469
|
}
|
|
@@ -30337,7 +30489,7 @@ var require_x509 = __commonJS2((exports, module) => {
|
|
|
30337
30489
|
if (!cert.issued(child)) {
|
|
30338
30490
|
var issuer = child.issuer;
|
|
30339
30491
|
var subject = cert.subject;
|
|
30340
|
-
var error = new Error("The parent certificate did not issue the given child " + "certificate; the child certificate
|
|
30492
|
+
var error = new Error("The parent certificate did not issue the given child " + "certificate; the child certificate's issuer does not match the " + "parent's subject.");
|
|
30341
30493
|
error.expectedIssuer = subject.attributes;
|
|
30342
30494
|
error.actualIssuer = issuer.attributes;
|
|
30343
30495
|
throw error;
|
|
@@ -31370,7 +31522,7 @@ var require_x509 = __commonJS2((exports, module) => {
|
|
|
31370
31522
|
if (keyUsageExt !== null) {
|
|
31371
31523
|
if (!keyUsageExt.keyCertSign || bcExt === null) {
|
|
31372
31524
|
error = {
|
|
31373
|
-
message: "Certificate keyUsage or basicConstraints conflict " + "or indicate that the certificate is not a CA. " + "If the certificate is the only one in the chain or " + "isn
|
|
31525
|
+
message: "Certificate keyUsage or basicConstraints conflict " + "or indicate that the certificate is not a CA. " + "If the certificate is the only one in the chain or " + "isn't the first then the certificate must be a " + "valid CA.",
|
|
31374
31526
|
error: pki.certificateError.bad_certificate
|
|
31375
31527
|
};
|
|
31376
31528
|
}
|
|
@@ -36599,16 +36751,20 @@ var require_ssh = __commonJS2((exports, module) => {
|
|
|
36599
36751
|
passphrase = passphrase || "";
|
|
36600
36752
|
var algorithm = "ssh-rsa";
|
|
36601
36753
|
var encryptionAlgorithm = passphrase === "" ? "none" : "aes256-cbc";
|
|
36602
|
-
var ppk = "PuTTY-User-Key-File-2: " + algorithm +
|
|
36603
|
-
|
|
36604
|
-
ppk += "
|
|
36754
|
+
var ppk = "PuTTY-User-Key-File-2: " + algorithm + `\r
|
|
36755
|
+
`;
|
|
36756
|
+
ppk += "Encryption: " + encryptionAlgorithm + `\r
|
|
36757
|
+
`;
|
|
36758
|
+
ppk += "Comment: " + comment + `\r
|
|
36759
|
+
`;
|
|
36605
36760
|
var pubbuffer = forge.util.createBuffer();
|
|
36606
36761
|
_addStringToBuffer(pubbuffer, algorithm);
|
|
36607
36762
|
_addBigIntegerToBuffer(pubbuffer, privateKey.e);
|
|
36608
36763
|
_addBigIntegerToBuffer(pubbuffer, privateKey.n);
|
|
36609
36764
|
var pub = forge.util.encode64(pubbuffer.bytes(), 64);
|
|
36610
36765
|
var length = Math.floor(pub.length / 66) + 1;
|
|
36611
|
-
ppk += "Public-Lines: " + length +
|
|
36766
|
+
ppk += "Public-Lines: " + length + `\r
|
|
36767
|
+
`;
|
|
36612
36768
|
ppk += pub;
|
|
36613
36769
|
var privbuffer = forge.util.createBuffer();
|
|
36614
36770
|
_addBigIntegerToBuffer(privbuffer, privateKey.d);
|
|
@@ -36625,8 +36781,8 @@ var require_ssh = __commonJS2((exports, module) => {
|
|
|
36625
36781
|
padding.truncate(padding.length() - encLen + privbuffer.length());
|
|
36626
36782
|
privbuffer.putBuffer(padding);
|
|
36627
36783
|
var aeskey = forge.util.createBuffer();
|
|
36628
|
-
aeskey.putBuffer(_sha1("\
|
|
36629
|
-
aeskey.putBuffer(_sha1("\
|
|
36784
|
+
aeskey.putBuffer(_sha1("\x00\x00\x00\x00", passphrase));
|
|
36785
|
+
aeskey.putBuffer(_sha1("\x00\x00\x00\x01", passphrase));
|
|
36630
36786
|
var cipher = forge.aes.createEncryptionCipher(aeskey.truncate(8), "CBC");
|
|
36631
36787
|
cipher.start(forge.util.createBuffer().fillWithByte(0, 16));
|
|
36632
36788
|
cipher.update(privbuffer.copy());
|
|
@@ -36636,7 +36792,9 @@ var require_ssh = __commonJS2((exports, module) => {
|
|
|
36636
36792
|
priv = forge.util.encode64(encrypted.bytes(), 64);
|
|
36637
36793
|
}
|
|
36638
36794
|
length = Math.floor(priv.length / 66) + 1;
|
|
36639
|
-
ppk +=
|
|
36795
|
+
ppk += `\r
|
|
36796
|
+
Private-Lines: ` + length + `\r
|
|
36797
|
+
`;
|
|
36640
36798
|
ppk += priv;
|
|
36641
36799
|
var mackey = _sha1("putty-private-key-file-mac-key", passphrase);
|
|
36642
36800
|
var macbuffer = forge.util.createBuffer();
|
|
@@ -36650,7 +36808,9 @@ var require_ssh = __commonJS2((exports, module) => {
|
|
|
36650
36808
|
var hmac = forge.hmac.create();
|
|
36651
36809
|
hmac.start("sha1", mackey);
|
|
36652
36810
|
hmac.update(macbuffer.bytes());
|
|
36653
|
-
ppk +=
|
|
36811
|
+
ppk += `\r
|
|
36812
|
+
Private-MAC: ` + hmac.digest().toHex() + `\r
|
|
36813
|
+
`;
|
|
36654
36814
|
return ppk;
|
|
36655
36815
|
};
|
|
36656
36816
|
ssh.publicKeyToOpenSSH = function(key, comment) {
|
|
@@ -37007,9 +37167,12 @@ class Consola2 {
|
|
|
37007
37167
|
}
|
|
37008
37168
|
if (logObj.additional) {
|
|
37009
37169
|
if (!Array.isArray(logObj.additional)) {
|
|
37010
|
-
logObj.additional = logObj.additional.split(
|
|
37170
|
+
logObj.additional = logObj.additional.split(`
|
|
37171
|
+
`);
|
|
37011
37172
|
}
|
|
37012
|
-
logObj.args.push(
|
|
37173
|
+
logObj.args.push(`
|
|
37174
|
+
` + logObj.additional.join(`
|
|
37175
|
+
`));
|
|
37013
37176
|
delete logObj.additional;
|
|
37014
37177
|
}
|
|
37015
37178
|
logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
|
|
@@ -37154,7 +37317,8 @@ var init_core2 = __esm2(() => {
|
|
|
37154
37317
|
});
|
|
37155
37318
|
function parseStack2(stack) {
|
|
37156
37319
|
const cwd = process.cwd() + sep3;
|
|
37157
|
-
const lines = stack.split(
|
|
37320
|
+
const lines = stack.split(`
|
|
37321
|
+
`).splice(1).map((l22) => l22.trim().replace("file://", "").replace(cwd, ""));
|
|
37158
37322
|
return lines;
|
|
37159
37323
|
}
|
|
37160
37324
|
function writeStream2(data, stream) {
|
|
@@ -37164,12 +37328,14 @@ function writeStream2(data, stream) {
|
|
|
37164
37328
|
|
|
37165
37329
|
class BasicReporter2 {
|
|
37166
37330
|
formatStack(stack, opts) {
|
|
37167
|
-
return " " + parseStack2(stack).join(
|
|
37331
|
+
return " " + parseStack2(stack).join(`
|
|
37332
|
+
`);
|
|
37168
37333
|
}
|
|
37169
37334
|
formatArgs(args, opts) {
|
|
37170
37335
|
const _args = args.map((arg) => {
|
|
37171
37336
|
if (arg && typeof arg.stack === "string") {
|
|
37172
|
-
return arg.message +
|
|
37337
|
+
return arg.message + `
|
|
37338
|
+
` + this.formatStack(arg.stack, opts);
|
|
37173
37339
|
}
|
|
37174
37340
|
return arg;
|
|
37175
37341
|
});
|
|
@@ -37184,11 +37350,15 @@ class BasicReporter2 {
|
|
|
37184
37350
|
formatLogObj(logObj, opts) {
|
|
37185
37351
|
const message = this.formatArgs(logObj.args, opts);
|
|
37186
37352
|
if (logObj.type === "box") {
|
|
37187
|
-
return
|
|
37353
|
+
return `
|
|
37354
|
+
` + [
|
|
37188
37355
|
bracket2(logObj.tag),
|
|
37189
37356
|
logObj.title && logObj.title,
|
|
37190
|
-
...message.split(
|
|
37191
|
-
|
|
37357
|
+
...message.split(`
|
|
37358
|
+
`)
|
|
37359
|
+
].filter(Boolean).map((l22) => " > " + l22).join(`
|
|
37360
|
+
`) + `
|
|
37361
|
+
`;
|
|
37192
37362
|
}
|
|
37193
37363
|
return this.filterAndJoin([
|
|
37194
37364
|
bracket2(logObj.type),
|
|
@@ -37201,7 +37371,8 @@ class BasicReporter2 {
|
|
|
37201
37371
|
columns: ctx.options.stdout.columns || 0,
|
|
37202
37372
|
...ctx.options.formatOptions
|
|
37203
37373
|
});
|
|
37204
|
-
return writeStream2(line +
|
|
37374
|
+
return writeStream2(line + `
|
|
37375
|
+
`, logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout);
|
|
37205
37376
|
}
|
|
37206
37377
|
}
|
|
37207
37378
|
var bracket2 = (x2) => x2 ? `[${x2}]` : "";
|
|
@@ -37236,7 +37407,8 @@ function box2(text2, _opts = {}) {
|
|
|
37236
37407
|
..._opts.style
|
|
37237
37408
|
}
|
|
37238
37409
|
};
|
|
37239
|
-
const textLines = text2.split(
|
|
37410
|
+
const textLines = text2.split(`
|
|
37411
|
+
`);
|
|
37240
37412
|
const boxLines = [];
|
|
37241
37413
|
const _color = getColor3(opts.style.borderColor);
|
|
37242
37414
|
const borderStyle = {
|
|
@@ -37277,7 +37449,8 @@ function box2(text2, _opts = {}) {
|
|
|
37277
37449
|
if (opts.style.marginBottom > 0) {
|
|
37278
37450
|
boxLines.push("".repeat(opts.style.marginBottom));
|
|
37279
37451
|
}
|
|
37280
|
-
return boxLines.join(
|
|
37452
|
+
return boxLines.join(`
|
|
37453
|
+
`);
|
|
37281
37454
|
}
|
|
37282
37455
|
var env22;
|
|
37283
37456
|
var argv2;
|
|
@@ -37565,7 +37738,7 @@ class h22 {
|
|
|
37565
37738
|
}
|
|
37566
37739
|
this.state !== "error" && (this.state = "submit");
|
|
37567
37740
|
}
|
|
37568
|
-
u === "
|
|
37741
|
+
u === "\x03" && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
37569
37742
|
}
|
|
37570
37743
|
close() {
|
|
37571
37744
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
@@ -37836,7 +38009,8 @@ ${colors2.yellow(S_BAR_END2)} ${colors2.yellow(this.error)}
|
|
|
37836
38009
|
return `${title}${colors2.gray(S_BAR2)} ${colors2.dim(this.value || opts.placeholder)}`;
|
|
37837
38010
|
}
|
|
37838
38011
|
case "cancel": {
|
|
37839
|
-
return `${title}${colors2.gray(S_BAR2)} ${colors2.strikethrough(colors2.dim(this.value ?? ""))}${this.value?.trim() ?
|
|
38012
|
+
return `${title}${colors2.gray(S_BAR2)} ${colors2.strikethrough(colors2.dim(this.value ?? ""))}${this.value?.trim() ? `
|
|
38013
|
+
` + colors2.gray(S_BAR2) : ""}`;
|
|
37840
38014
|
}
|
|
37841
38015
|
default: {
|
|
37842
38016
|
return `${title}${colors2.cyan(S_BAR2)} ${value}
|
|
@@ -37964,7 +38138,9 @@ ${symbol2(this.state)} ${opts.message}
|
|
|
37964
38138
|
${colors2.gray(S_BAR2)}` : ""}`;
|
|
37965
38139
|
}
|
|
37966
38140
|
case "error": {
|
|
37967
|
-
const footer = this.error.split(
|
|
38141
|
+
const footer = this.error.split(`
|
|
38142
|
+
`).map((ln, i) => i === 0 ? `${colors2.yellow(S_BAR_END2)} ${colors2.yellow(ln)}` : ` ${ln}`).join(`
|
|
38143
|
+
`);
|
|
37968
38144
|
return title + colors2.yellow(S_BAR2) + " " + this.options.map((option, i) => {
|
|
37969
38145
|
const selected = this.value.includes(option.value);
|
|
37970
38146
|
const active = i === this.cursor;
|
|
@@ -37976,7 +38152,9 @@ ${colors2.gray(S_BAR2)}` : ""}`;
|
|
|
37976
38152
|
}
|
|
37977
38153
|
return opt(option, active ? "active" : "inactive");
|
|
37978
38154
|
}).join(`
|
|
37979
|
-
${colors2.yellow(S_BAR2)} `) +
|
|
38155
|
+
${colors2.yellow(S_BAR2)} `) + `
|
|
38156
|
+
` + footer + `
|
|
38157
|
+
`;
|
|
37980
38158
|
}
|
|
37981
38159
|
default: {
|
|
37982
38160
|
return `${title}${colors2.cyan(S_BAR2)} ${this.options.map((option, i) => {
|
|
@@ -38538,7 +38716,9 @@ var init_consola_36c0034f2 = __esm2(() => {
|
|
|
38538
38716
|
};
|
|
38539
38717
|
FancyReporter2 = class FancyReporter22 extends BasicReporter2 {
|
|
38540
38718
|
formatStack(stack) {
|
|
38541
|
-
return
|
|
38719
|
+
return `
|
|
38720
|
+
` + parseStack2(stack).map((line) => " " + line.replace(/^at +/, (m22) => colors2.gray(m22)).replace(/\((.+)\)/, (_22, m22) => `(${colors2.cyan(m22)})`)).join(`
|
|
38721
|
+
`);
|
|
38542
38722
|
}
|
|
38543
38723
|
formatType(logObj, isBadge, opts) {
|
|
38544
38724
|
const typeColor = TYPE_COLOR_MAP2[logObj.type] || LEVEL_COLOR_MAP2[logObj.level] || "gray";
|
|
@@ -38549,9 +38729,12 @@ var init_consola_36c0034f2 = __esm2(() => {
|
|
|
38549
38729
|
return _type ? getColor22(typeColor)(_type) : "";
|
|
38550
38730
|
}
|
|
38551
38731
|
formatLogObj(logObj, opts) {
|
|
38552
|
-
const [message, ...additional] = this.formatArgs(logObj.args, opts).split(
|
|
38732
|
+
const [message, ...additional] = this.formatArgs(logObj.args, opts).split(`
|
|
38733
|
+
`);
|
|
38553
38734
|
if (logObj.type === "box") {
|
|
38554
|
-
return box2(characterFormat2(message + (additional.length > 0 ?
|
|
38735
|
+
return box2(characterFormat2(message + (additional.length > 0 ? `
|
|
38736
|
+
` + additional.join(`
|
|
38737
|
+
`) : "")), {
|
|
38555
38738
|
title: logObj.title ? characterFormat2(logObj.title) : undefined,
|
|
38556
38739
|
style: logObj.style
|
|
38557
38740
|
});
|
|
@@ -38566,12 +38749,16 @@ var init_consola_36c0034f2 = __esm2(() => {
|
|
|
38566
38749
|
const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
|
|
38567
38750
|
const space = (opts.columns || 0) - stringWidth3(left) - stringWidth3(right) - 2;
|
|
38568
38751
|
line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors2.gray(`[${right}]`)} ` : "") + left;
|
|
38569
|
-
line += characterFormat2(additional.length > 0 ?
|
|
38752
|
+
line += characterFormat2(additional.length > 0 ? `
|
|
38753
|
+
` + additional.join(`
|
|
38754
|
+
`) : "");
|
|
38570
38755
|
if (logObj.type === "trace") {
|
|
38571
38756
|
const _err = new Error("Trace: " + logObj.message);
|
|
38572
38757
|
line += this.formatStack(_err.stack || "");
|
|
38573
38758
|
}
|
|
38574
|
-
return isBadge ?
|
|
38759
|
+
return isBadge ? `
|
|
38760
|
+
` + line + `
|
|
38761
|
+
` : line;
|
|
38575
38762
|
}
|
|
38576
38763
|
};
|
|
38577
38764
|
consola2 = createConsola22();
|
|
@@ -38791,7 +38978,8 @@ var require_isURL2 = __commonJS22((exports, module) => {
|
|
|
38791
38978
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
38792
38979
|
}
|
|
38793
38980
|
function _nonIterableRest() {
|
|
38794
|
-
throw new TypeError(
|
|
38981
|
+
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
38982
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
38795
38983
|
}
|
|
38796
38984
|
function _unsupportedIterableToArray(o, minLen) {
|
|
38797
38985
|
if (!o)
|
|
@@ -39249,7 +39437,7 @@ var require_isEmail2 = __commonJS22((exports, module) => {
|
|
|
39249
39437
|
if (display_name_without_quotes === display_name) {
|
|
39250
39438
|
return false;
|
|
39251
39439
|
}
|
|
39252
|
-
var all_start_with_back_slash = display_name_without_quotes.split('"').length === display_name_without_quotes.split(
|
|
39440
|
+
var all_start_with_back_slash = display_name_without_quotes.split('"').length === display_name_without_quotes.split("\\\"").length;
|
|
39253
39441
|
if (!all_start_with_back_slash) {
|
|
39254
39442
|
return false;
|
|
39255
39443
|
}
|
|
@@ -40914,7 +41102,8 @@ var require_clear3 = __commonJS22((exports, module) => {
|
|
|
40914
41102
|
throw _e;
|
|
40915
41103
|
}, f: F };
|
|
40916
41104
|
}
|
|
40917
|
-
throw new TypeError(
|
|
41105
|
+
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
41106
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
40918
41107
|
}
|
|
40919
41108
|
var normalCompletion = true, didErr = false, err2;
|
|
40920
41109
|
return { s: function s() {
|
|
@@ -41071,7 +41260,9 @@ var require_wrap3 = __commonJS22((exports, module) => {
|
|
|
41071
41260
|
else
|
|
41072
41261
|
arr.push(`${tab}${w22}`);
|
|
41073
41262
|
return arr;
|
|
41074
|
-
}, [tab]).join(
|
|
41263
|
+
}, [tab]).join(`
|
|
41264
|
+
`)).join(`
|
|
41265
|
+
`);
|
|
41075
41266
|
};
|
|
41076
41267
|
});
|
|
41077
41268
|
var require_entriesToDisplay3 = __commonJS22((exports, module) => {
|
|
@@ -41252,7 +41443,8 @@ var require_text3 = __commonJS22((exports, module) => {
|
|
|
41252
41443
|
this.red = false;
|
|
41253
41444
|
this.fire();
|
|
41254
41445
|
this.render();
|
|
41255
|
-
this.out.write(
|
|
41446
|
+
this.out.write(`
|
|
41447
|
+
`);
|
|
41256
41448
|
this.close();
|
|
41257
41449
|
}
|
|
41258
41450
|
validate() {
|
|
@@ -41283,7 +41475,8 @@ var require_text3 = __commonJS22((exports, module) => {
|
|
|
41283
41475
|
_this2.aborted = false;
|
|
41284
41476
|
_this2.fire();
|
|
41285
41477
|
_this2.render();
|
|
41286
|
-
_this2.out.write(
|
|
41478
|
+
_this2.out.write(`
|
|
41479
|
+
`);
|
|
41287
41480
|
_this2.close();
|
|
41288
41481
|
})();
|
|
41289
41482
|
}
|
|
@@ -41376,7 +41569,9 @@ var require_text3 = __commonJS22((exports, module) => {
|
|
|
41376
41569
|
this.outputError = "";
|
|
41377
41570
|
this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), this.red ? color.red(this.rendered) : this.rendered].join(` `);
|
|
41378
41571
|
if (this.error) {
|
|
41379
|
-
this.outputError += this.errorMsg.split(
|
|
41572
|
+
this.outputError += this.errorMsg.split(`
|
|
41573
|
+
`).reduce((a, l3, i) => a + `
|
|
41574
|
+
${i ? " " : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
41380
41575
|
}
|
|
41381
41576
|
this.out.write(erase22.line + cursor22.to(0) + this.outputText + cursor22.save + this.outputError + cursor22.restore + cursor22.move(this.cursorOffset, 0));
|
|
41382
41577
|
}
|
|
@@ -41438,7 +41633,8 @@ var require_select3 = __commonJS22((exports, module) => {
|
|
|
41438
41633
|
this.done = this.aborted = true;
|
|
41439
41634
|
this.fire();
|
|
41440
41635
|
this.render();
|
|
41441
|
-
this.out.write(
|
|
41636
|
+
this.out.write(`
|
|
41637
|
+
`);
|
|
41442
41638
|
this.close();
|
|
41443
41639
|
}
|
|
41444
41640
|
submit() {
|
|
@@ -41447,7 +41643,8 @@ var require_select3 = __commonJS22((exports, module) => {
|
|
|
41447
41643
|
this.aborted = false;
|
|
41448
41644
|
this.fire();
|
|
41449
41645
|
this.render();
|
|
41450
|
-
this.out.write(
|
|
41646
|
+
this.out.write(`
|
|
41647
|
+
`);
|
|
41451
41648
|
this.close();
|
|
41452
41649
|
} else
|
|
41453
41650
|
this.bell();
|
|
@@ -41498,7 +41695,8 @@ var require_select3 = __commonJS22((exports, module) => {
|
|
|
41498
41695
|
let _entriesToDisplay = entriesToDisplay(this.cursor, this.choices.length, this.optionsPerPage), startIndex = _entriesToDisplay.startIndex, endIndex = _entriesToDisplay.endIndex;
|
|
41499
41696
|
this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(false), this.done ? this.selection.title : this.selection.disabled ? color.yellow(this.warn) : color.gray(this.hint)].join(" ");
|
|
41500
41697
|
if (!this.done) {
|
|
41501
|
-
this.outputText +=
|
|
41698
|
+
this.outputText += `
|
|
41699
|
+
`;
|
|
41502
41700
|
for (let i = startIndex;i < endIndex; i++) {
|
|
41503
41701
|
let title, prefix, desc = "", v22 = this.choices[i];
|
|
41504
41702
|
if (i === startIndex && startIndex > 0) {
|
|
@@ -41517,14 +41715,16 @@ var require_select3 = __commonJS22((exports, module) => {
|
|
|
41517
41715
|
if (v22.description && this.cursor === i) {
|
|
41518
41716
|
desc = ` - ${v22.description}`;
|
|
41519
41717
|
if (prefix.length + title.length + desc.length >= this.out.columns || v22.description.split(/\r?\n/).length > 1) {
|
|
41520
|
-
desc =
|
|
41718
|
+
desc = `
|
|
41719
|
+
` + wrap(v22.description, {
|
|
41521
41720
|
margin: 3,
|
|
41522
41721
|
width: this.out.columns
|
|
41523
41722
|
});
|
|
41524
41723
|
}
|
|
41525
41724
|
}
|
|
41526
41725
|
}
|
|
41527
|
-
this.outputText += `${prefix} ${title}${color.gray(desc)}
|
|
41726
|
+
this.outputText += `${prefix} ${title}${color.gray(desc)}
|
|
41727
|
+
`;
|
|
41528
41728
|
}
|
|
41529
41729
|
}
|
|
41530
41730
|
this.out.write(this.outputText);
|
|
@@ -41564,7 +41764,8 @@ var require_toggle3 = __commonJS22((exports, module) => {
|
|
|
41564
41764
|
this.done = this.aborted = true;
|
|
41565
41765
|
this.fire();
|
|
41566
41766
|
this.render();
|
|
41567
|
-
this.out.write(
|
|
41767
|
+
this.out.write(`
|
|
41768
|
+
`);
|
|
41568
41769
|
this.close();
|
|
41569
41770
|
}
|
|
41570
41771
|
submit() {
|
|
@@ -41572,7 +41773,8 @@ var require_toggle3 = __commonJS22((exports, module) => {
|
|
|
41572
41773
|
this.aborted = false;
|
|
41573
41774
|
this.fire();
|
|
41574
41775
|
this.render();
|
|
41575
|
-
this.out.write(
|
|
41776
|
+
this.out.write(`
|
|
41777
|
+
`);
|
|
41576
41778
|
this.close();
|
|
41577
41779
|
}
|
|
41578
41780
|
deactivate() {
|
|
@@ -42005,7 +42207,8 @@ var require_date3 = __commonJS22((exports, module) => {
|
|
|
42005
42207
|
this.error = false;
|
|
42006
42208
|
this.fire();
|
|
42007
42209
|
this.render();
|
|
42008
|
-
this.out.write(
|
|
42210
|
+
this.out.write(`
|
|
42211
|
+
`);
|
|
42009
42212
|
this.close();
|
|
42010
42213
|
}
|
|
42011
42214
|
validate() {
|
|
@@ -42033,7 +42236,8 @@ var require_date3 = __commonJS22((exports, module) => {
|
|
|
42033
42236
|
_this2.aborted = false;
|
|
42034
42237
|
_this2.fire();
|
|
42035
42238
|
_this2.render();
|
|
42036
|
-
_this2.out.write(
|
|
42239
|
+
_this2.out.write(`
|
|
42240
|
+
`);
|
|
42037
42241
|
_this2.close();
|
|
42038
42242
|
})();
|
|
42039
42243
|
}
|
|
@@ -42083,7 +42287,9 @@ var require_date3 = __commonJS22((exports, module) => {
|
|
|
42083
42287
|
super.render();
|
|
42084
42288
|
this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(false), this.parts.reduce((arr, p32, idx) => arr.concat(idx === this.cursor && !this.done ? color.cyan().underline(p32.toString()) : p32), []).join("")].join(" ");
|
|
42085
42289
|
if (this.error) {
|
|
42086
|
-
this.outputText += this.errorMsg.split(
|
|
42290
|
+
this.outputText += this.errorMsg.split(`
|
|
42291
|
+
`).reduce((a, l3, i) => a + `
|
|
42292
|
+
${i ? ` ` : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
42087
42293
|
}
|
|
42088
42294
|
this.out.write(erase22.line + cursor22.to(0) + this.outputText);
|
|
42089
42295
|
}
|
|
@@ -42193,7 +42399,8 @@ var require_number3 = __commonJS22((exports, module) => {
|
|
|
42193
42399
|
this.error = false;
|
|
42194
42400
|
this.fire();
|
|
42195
42401
|
this.render();
|
|
42196
|
-
this.out.write(
|
|
42402
|
+
this.out.write(`
|
|
42403
|
+
`);
|
|
42197
42404
|
this.close();
|
|
42198
42405
|
}
|
|
42199
42406
|
validate() {
|
|
@@ -42224,7 +42431,8 @@ var require_number3 = __commonJS22((exports, module) => {
|
|
|
42224
42431
|
_this2.error = false;
|
|
42225
42432
|
_this2.fire();
|
|
42226
42433
|
_this2.render();
|
|
42227
|
-
_this2.out.write(
|
|
42434
|
+
_this2.out.write(`
|
|
42435
|
+
`);
|
|
42228
42436
|
_this2.close();
|
|
42229
42437
|
})();
|
|
42230
42438
|
}
|
|
@@ -42300,7 +42508,9 @@ var require_number3 = __commonJS22((exports, module) => {
|
|
|
42300
42508
|
this.outputError = "";
|
|
42301
42509
|
this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), !this.done || !this.done && !this.placeholder ? color[this.color]().underline(this.rendered) : this.rendered].join(` `);
|
|
42302
42510
|
if (this.error) {
|
|
42303
|
-
this.outputError += this.errorMsg.split(
|
|
42511
|
+
this.outputError += this.errorMsg.split(`
|
|
42512
|
+
`).reduce((a, l3, i) => a + `
|
|
42513
|
+
${i ? ` ` : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
42304
42514
|
}
|
|
42305
42515
|
this.out.write(erase22.line + cursor22.to(0) + this.outputText + cursor22.save + this.outputError + cursor22.restore);
|
|
42306
42516
|
}
|
|
@@ -42367,7 +42577,8 @@ var require_multiselect3 = __commonJS22((exports, module) => {
|
|
|
42367
42577
|
this.done = this.aborted = true;
|
|
42368
42578
|
this.fire();
|
|
42369
42579
|
this.render();
|
|
42370
|
-
this.out.write(
|
|
42580
|
+
this.out.write(`
|
|
42581
|
+
`);
|
|
42371
42582
|
this.close();
|
|
42372
42583
|
}
|
|
42373
42584
|
submit() {
|
|
@@ -42380,7 +42591,8 @@ var require_multiselect3 = __commonJS22((exports, module) => {
|
|
|
42380
42591
|
this.aborted = false;
|
|
42381
42592
|
this.fire();
|
|
42382
42593
|
this.render();
|
|
42383
|
-
this.out.write(
|
|
42594
|
+
this.out.write(`
|
|
42595
|
+
`);
|
|
42384
42596
|
this.close();
|
|
42385
42597
|
}
|
|
42386
42598
|
}
|
|
@@ -42456,7 +42668,12 @@ var require_multiselect3 = __commonJS22((exports, module) => {
|
|
|
42456
42668
|
if (typeof this.instructions === "string") {
|
|
42457
42669
|
return this.instructions;
|
|
42458
42670
|
}
|
|
42459
|
-
return
|
|
42671
|
+
return `
|
|
42672
|
+
Instructions:
|
|
42673
|
+
` + ` ${figures.arrowUp}/${figures.arrowDown}: Highlight option
|
|
42674
|
+
` + ` ${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
|
|
42675
|
+
` + (this.maxChoices === undefined ? ` a: Toggle all
|
|
42676
|
+
` : "") + ` enter/return: Complete answer`;
|
|
42460
42677
|
}
|
|
42461
42678
|
return "";
|
|
42462
42679
|
}
|
|
@@ -42470,7 +42687,8 @@ var require_multiselect3 = __commonJS22((exports, module) => {
|
|
|
42470
42687
|
if (cursor3 === i && v22.description) {
|
|
42471
42688
|
desc = ` - ${v22.description}`;
|
|
42472
42689
|
if (prefix.length + title.length + desc.length >= this.out.columns || v22.description.split(/\r?\n/).length > 1) {
|
|
42473
|
-
desc =
|
|
42690
|
+
desc = `
|
|
42691
|
+
` + wrap(v22.description, {
|
|
42474
42692
|
margin: prefix.length,
|
|
42475
42693
|
width: this.out.columns
|
|
42476
42694
|
});
|
|
@@ -42495,7 +42713,9 @@ var require_multiselect3 = __commonJS22((exports, module) => {
|
|
|
42495
42713
|
}
|
|
42496
42714
|
styledOptions.push(this.renderOption(this.cursor, options2[i], i, prefix));
|
|
42497
42715
|
}
|
|
42498
|
-
return
|
|
42716
|
+
return `
|
|
42717
|
+
` + styledOptions.join(`
|
|
42718
|
+
`);
|
|
42499
42719
|
}
|
|
42500
42720
|
renderOptions(options2) {
|
|
42501
42721
|
if (!this.done) {
|
|
@@ -42661,7 +42881,8 @@ var require_autocomplete3 = __commonJS22((exports, module) => {
|
|
|
42661
42881
|
this.aborted = false;
|
|
42662
42882
|
this.fire();
|
|
42663
42883
|
this.render();
|
|
42664
|
-
this.out.write(
|
|
42884
|
+
this.out.write(`
|
|
42885
|
+
`);
|
|
42665
42886
|
this.close();
|
|
42666
42887
|
}
|
|
42667
42888
|
}
|
|
@@ -42670,7 +42891,8 @@ var require_autocomplete3 = __commonJS22((exports, module) => {
|
|
|
42670
42891
|
this.exited = false;
|
|
42671
42892
|
this.fire();
|
|
42672
42893
|
this.render();
|
|
42673
|
-
this.out.write(
|
|
42894
|
+
this.out.write(`
|
|
42895
|
+
`);
|
|
42674
42896
|
this.close();
|
|
42675
42897
|
}
|
|
42676
42898
|
submit() {
|
|
@@ -42678,7 +42900,8 @@ var require_autocomplete3 = __commonJS22((exports, module) => {
|
|
|
42678
42900
|
this.aborted = this.exited = false;
|
|
42679
42901
|
this.fire();
|
|
42680
42902
|
this.render();
|
|
42681
|
-
this.out.write(
|
|
42903
|
+
this.out.write(`
|
|
42904
|
+
`);
|
|
42682
42905
|
this.close();
|
|
42683
42906
|
}
|
|
42684
42907
|
_(c22, key) {
|
|
@@ -42767,7 +42990,8 @@ var require_autocomplete3 = __commonJS22((exports, module) => {
|
|
|
42767
42990
|
if (v22.description) {
|
|
42768
42991
|
desc = ` - ${v22.description}`;
|
|
42769
42992
|
if (prefix.length + title.length + desc.length >= this.out.columns || v22.description.split(/\r?\n/).length > 1) {
|
|
42770
|
-
desc =
|
|
42993
|
+
desc = `
|
|
42994
|
+
` + wrap(v22.description, {
|
|
42771
42995
|
margin: 3,
|
|
42772
42996
|
width: this.out.columns
|
|
42773
42997
|
});
|
|
@@ -42786,8 +43010,10 @@ var require_autocomplete3 = __commonJS22((exports, module) => {
|
|
|
42786
43010
|
let _entriesToDisplay = entriesToDisplay(this.select, this.choices.length, this.limit), startIndex = _entriesToDisplay.startIndex, endIndex = _entriesToDisplay.endIndex;
|
|
42787
43011
|
this.outputText = [style.symbol(this.done, this.aborted, this.exited), color.bold(this.msg), style.delimiter(this.completing), this.done && this.suggestions[this.select] ? this.suggestions[this.select].title : this.rendered = this.transform.render(this.input)].join(" ");
|
|
42788
43012
|
if (!this.done) {
|
|
42789
|
-
const suggestions = this.suggestions.slice(startIndex, endIndex).map((item, i) => this.renderOption(item, this.select === i + startIndex, i === 0 && startIndex > 0, i + startIndex === endIndex - 1 && endIndex < this.choices.length)).join(
|
|
42790
|
-
|
|
43013
|
+
const suggestions = this.suggestions.slice(startIndex, endIndex).map((item, i) => this.renderOption(item, this.select === i + startIndex, i === 0 && startIndex > 0, i + startIndex === endIndex - 1 && endIndex < this.choices.length)).join(`
|
|
43014
|
+
`);
|
|
43015
|
+
this.outputText += `
|
|
43016
|
+
` + (suggestions || color.gray(this.fallback.title));
|
|
42791
43017
|
}
|
|
42792
43018
|
this.out.write(erase22.line + cursor22.to(0) + this.outputText);
|
|
42793
43019
|
}
|
|
@@ -42915,7 +43141,8 @@ Instructions:
|
|
|
42915
43141
|
}
|
|
42916
43142
|
renderCurrentInput() {
|
|
42917
43143
|
return `
|
|
42918
|
-
Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
|
|
43144
|
+
Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
|
|
43145
|
+
`;
|
|
42919
43146
|
}
|
|
42920
43147
|
renderOption(cursor3, v22, i) {
|
|
42921
43148
|
let title;
|
|
@@ -42987,7 +43214,8 @@ var require_confirm3 = __commonJS22((exports, module) => {
|
|
|
42987
43214
|
this.done = this.aborted = true;
|
|
42988
43215
|
this.fire();
|
|
42989
43216
|
this.render();
|
|
42990
|
-
this.out.write(
|
|
43217
|
+
this.out.write(`
|
|
43218
|
+
`);
|
|
42991
43219
|
this.close();
|
|
42992
43220
|
}
|
|
42993
43221
|
submit() {
|
|
@@ -42996,7 +43224,8 @@ var require_confirm3 = __commonJS22((exports, module) => {
|
|
|
42996
43224
|
this.aborted = false;
|
|
42997
43225
|
this.fire();
|
|
42998
43226
|
this.render();
|
|
42999
|
-
this.out.write(
|
|
43227
|
+
this.out.write(`
|
|
43228
|
+
`);
|
|
43000
43229
|
this.close();
|
|
43001
43230
|
}
|
|
43002
43231
|
_(c22, key) {
|
|
@@ -43152,7 +43381,8 @@ var require_dist2 = __commonJS22((exports, module) => {
|
|
|
43152
43381
|
throw _e;
|
|
43153
43382
|
}, f: F };
|
|
43154
43383
|
}
|
|
43155
|
-
throw new TypeError(
|
|
43384
|
+
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
43385
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
43156
43386
|
}
|
|
43157
43387
|
var normalCompletion = true, didErr = false, err2;
|
|
43158
43388
|
return { s: function s() {
|
|
@@ -43484,7 +43714,9 @@ var require_wrap22 = __commonJS22((exports, module) => {
|
|
|
43484
43714
|
else
|
|
43485
43715
|
arr.push(`${tab}${w22}`);
|
|
43486
43716
|
return arr;
|
|
43487
|
-
}, [tab]).join(
|
|
43717
|
+
}, [tab]).join(`
|
|
43718
|
+
`)).join(`
|
|
43719
|
+
`);
|
|
43488
43720
|
};
|
|
43489
43721
|
});
|
|
43490
43722
|
var require_entriesToDisplay22 = __commonJS22((exports, module) => {
|
|
@@ -43621,7 +43853,8 @@ var require_text22 = __commonJS22((exports, module) => {
|
|
|
43621
43853
|
this.red = false;
|
|
43622
43854
|
this.fire();
|
|
43623
43855
|
this.render();
|
|
43624
|
-
this.out.write(
|
|
43856
|
+
this.out.write(`
|
|
43857
|
+
`);
|
|
43625
43858
|
this.close();
|
|
43626
43859
|
}
|
|
43627
43860
|
async validate() {
|
|
@@ -43647,7 +43880,8 @@ var require_text22 = __commonJS22((exports, module) => {
|
|
|
43647
43880
|
this.aborted = false;
|
|
43648
43881
|
this.fire();
|
|
43649
43882
|
this.render();
|
|
43650
|
-
this.out.write(
|
|
43883
|
+
this.out.write(`
|
|
43884
|
+
`);
|
|
43651
43885
|
this.close();
|
|
43652
43886
|
}
|
|
43653
43887
|
next() {
|
|
@@ -43744,7 +43978,9 @@ var require_text22 = __commonJS22((exports, module) => {
|
|
|
43744
43978
|
this.red ? color.red(this.rendered) : this.rendered
|
|
43745
43979
|
].join(` `);
|
|
43746
43980
|
if (this.error) {
|
|
43747
|
-
this.outputError += this.errorMsg.split(
|
|
43981
|
+
this.outputError += this.errorMsg.split(`
|
|
43982
|
+
`).reduce((a, l3, i) => a + `
|
|
43983
|
+
${i ? " " : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
43748
43984
|
}
|
|
43749
43985
|
this.out.write(erase22.line + cursor22.to(0) + this.outputText + cursor22.save + this.outputError + cursor22.restore + cursor22.move(this.cursorOffset, 0));
|
|
43750
43986
|
}
|
|
@@ -43797,7 +44033,8 @@ var require_select22 = __commonJS22((exports, module) => {
|
|
|
43797
44033
|
this.done = this.aborted = true;
|
|
43798
44034
|
this.fire();
|
|
43799
44035
|
this.render();
|
|
43800
|
-
this.out.write(
|
|
44036
|
+
this.out.write(`
|
|
44037
|
+
`);
|
|
43801
44038
|
this.close();
|
|
43802
44039
|
}
|
|
43803
44040
|
submit() {
|
|
@@ -43806,7 +44043,8 @@ var require_select22 = __commonJS22((exports, module) => {
|
|
|
43806
44043
|
this.aborted = false;
|
|
43807
44044
|
this.fire();
|
|
43808
44045
|
this.render();
|
|
43809
|
-
this.out.write(
|
|
44046
|
+
this.out.write(`
|
|
44047
|
+
`);
|
|
43810
44048
|
this.close();
|
|
43811
44049
|
} else
|
|
43812
44050
|
this.bell();
|
|
@@ -43862,7 +44100,8 @@ var require_select22 = __commonJS22((exports, module) => {
|
|
|
43862
44100
|
this.done ? this.selection.title : this.selection.disabled ? color.yellow(this.warn) : color.gray(this.hint)
|
|
43863
44101
|
].join(" ");
|
|
43864
44102
|
if (!this.done) {
|
|
43865
|
-
this.outputText +=
|
|
44103
|
+
this.outputText += `
|
|
44104
|
+
`;
|
|
43866
44105
|
for (let i = startIndex;i < endIndex; i++) {
|
|
43867
44106
|
let title, prefix, desc = "", v22 = this.choices[i];
|
|
43868
44107
|
if (i === startIndex && startIndex > 0) {
|
|
@@ -43881,11 +44120,13 @@ var require_select22 = __commonJS22((exports, module) => {
|
|
|
43881
44120
|
if (v22.description && this.cursor === i) {
|
|
43882
44121
|
desc = ` - ${v22.description}`;
|
|
43883
44122
|
if (prefix.length + title.length + desc.length >= this.out.columns || v22.description.split(/\r?\n/).length > 1) {
|
|
43884
|
-
desc =
|
|
44123
|
+
desc = `
|
|
44124
|
+
` + wrap(v22.description, { margin: 3, width: this.out.columns });
|
|
43885
44125
|
}
|
|
43886
44126
|
}
|
|
43887
44127
|
}
|
|
43888
|
-
this.outputText += `${prefix} ${title}${color.gray(desc)}
|
|
44128
|
+
this.outputText += `${prefix} ${title}${color.gray(desc)}
|
|
44129
|
+
`;
|
|
43889
44130
|
}
|
|
43890
44131
|
}
|
|
43891
44132
|
this.out.write(this.outputText);
|
|
@@ -43921,7 +44162,8 @@ var require_toggle22 = __commonJS22((exports, module) => {
|
|
|
43921
44162
|
this.done = this.aborted = true;
|
|
43922
44163
|
this.fire();
|
|
43923
44164
|
this.render();
|
|
43924
|
-
this.out.write(
|
|
44165
|
+
this.out.write(`
|
|
44166
|
+
`);
|
|
43925
44167
|
this.close();
|
|
43926
44168
|
}
|
|
43927
44169
|
submit() {
|
|
@@ -43929,7 +44171,8 @@ var require_toggle22 = __commonJS22((exports, module) => {
|
|
|
43929
44171
|
this.aborted = false;
|
|
43930
44172
|
this.fire();
|
|
43931
44173
|
this.render();
|
|
43932
|
-
this.out.write(
|
|
44174
|
+
this.out.write(`
|
|
44175
|
+
`);
|
|
43933
44176
|
this.close();
|
|
43934
44177
|
}
|
|
43935
44178
|
deactivate() {
|
|
@@ -44314,7 +44557,8 @@ var require_date22 = __commonJS22((exports, module) => {
|
|
|
44314
44557
|
this.error = false;
|
|
44315
44558
|
this.fire();
|
|
44316
44559
|
this.render();
|
|
44317
|
-
this.out.write(
|
|
44560
|
+
this.out.write(`
|
|
44561
|
+
`);
|
|
44318
44562
|
this.close();
|
|
44319
44563
|
}
|
|
44320
44564
|
async validate() {
|
|
@@ -44337,7 +44581,8 @@ var require_date22 = __commonJS22((exports, module) => {
|
|
|
44337
44581
|
this.aborted = false;
|
|
44338
44582
|
this.fire();
|
|
44339
44583
|
this.render();
|
|
44340
|
-
this.out.write(
|
|
44584
|
+
this.out.write(`
|
|
44585
|
+
`);
|
|
44341
44586
|
this.close();
|
|
44342
44587
|
}
|
|
44343
44588
|
up() {
|
|
@@ -44391,7 +44636,9 @@ var require_date22 = __commonJS22((exports, module) => {
|
|
|
44391
44636
|
this.parts.reduce((arr, p32, idx) => arr.concat(idx === this.cursor && !this.done ? color.cyan().underline(p32.toString()) : p32), []).join("")
|
|
44392
44637
|
].join(" ");
|
|
44393
44638
|
if (this.error) {
|
|
44394
|
-
this.outputText += this.errorMsg.split(
|
|
44639
|
+
this.outputText += this.errorMsg.split(`
|
|
44640
|
+
`).reduce((a, l3, i) => a + `
|
|
44641
|
+
${i ? ` ` : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
44395
44642
|
}
|
|
44396
44643
|
this.out.write(erase22.line + cursor22.to(0) + this.outputText);
|
|
44397
44644
|
}
|
|
@@ -44466,7 +44713,8 @@ var require_number22 = __commonJS22((exports, module) => {
|
|
|
44466
44713
|
this.error = false;
|
|
44467
44714
|
this.fire();
|
|
44468
44715
|
this.render();
|
|
44469
|
-
this.out.write(
|
|
44716
|
+
this.out.write(`
|
|
44717
|
+
`);
|
|
44470
44718
|
this.close();
|
|
44471
44719
|
}
|
|
44472
44720
|
async validate() {
|
|
@@ -44492,7 +44740,8 @@ var require_number22 = __commonJS22((exports, module) => {
|
|
|
44492
44740
|
this.error = false;
|
|
44493
44741
|
this.fire();
|
|
44494
44742
|
this.render();
|
|
44495
|
-
this.out.write(
|
|
44743
|
+
this.out.write(`
|
|
44744
|
+
`);
|
|
44496
44745
|
this.close();
|
|
44497
44746
|
}
|
|
44498
44747
|
up() {
|
|
@@ -44572,7 +44821,9 @@ var require_number22 = __commonJS22((exports, module) => {
|
|
|
44572
44821
|
!this.done || !this.done && !this.placeholder ? color[this.color]().underline(this.rendered) : this.rendered
|
|
44573
44822
|
].join(` `);
|
|
44574
44823
|
if (this.error) {
|
|
44575
|
-
this.outputError += this.errorMsg.split(
|
|
44824
|
+
this.outputError += this.errorMsg.split(`
|
|
44825
|
+
`).reduce((a, l3, i) => a + `
|
|
44826
|
+
${i ? ` ` : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
44576
44827
|
}
|
|
44577
44828
|
this.out.write(erase22.line + cursor22.to(0) + this.outputText + cursor22.save + this.outputError + cursor22.restore);
|
|
44578
44829
|
}
|
|
@@ -44630,7 +44881,8 @@ var require_multiselect22 = __commonJS22((exports, module) => {
|
|
|
44630
44881
|
this.done = this.aborted = true;
|
|
44631
44882
|
this.fire();
|
|
44632
44883
|
this.render();
|
|
44633
|
-
this.out.write(
|
|
44884
|
+
this.out.write(`
|
|
44885
|
+
`);
|
|
44634
44886
|
this.close();
|
|
44635
44887
|
}
|
|
44636
44888
|
submit() {
|
|
@@ -44643,7 +44895,8 @@ var require_multiselect22 = __commonJS22((exports, module) => {
|
|
|
44643
44895
|
this.aborted = false;
|
|
44644
44896
|
this.fire();
|
|
44645
44897
|
this.render();
|
|
44646
|
-
this.out.write(
|
|
44898
|
+
this.out.write(`
|
|
44899
|
+
`);
|
|
44647
44900
|
this.close();
|
|
44648
44901
|
}
|
|
44649
44902
|
}
|
|
@@ -44719,7 +44972,12 @@ var require_multiselect22 = __commonJS22((exports, module) => {
|
|
|
44719
44972
|
if (typeof this.instructions === "string") {
|
|
44720
44973
|
return this.instructions;
|
|
44721
44974
|
}
|
|
44722
|
-
return
|
|
44975
|
+
return `
|
|
44976
|
+
Instructions:
|
|
44977
|
+
` + ` ${figures.arrowUp}/${figures.arrowDown}: Highlight option
|
|
44978
|
+
` + ` ${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
|
|
44979
|
+
` + (this.maxChoices === undefined ? ` a: Toggle all
|
|
44980
|
+
` : "") + ` enter/return: Complete answer`;
|
|
44723
44981
|
}
|
|
44724
44982
|
return "";
|
|
44725
44983
|
}
|
|
@@ -44733,7 +44991,8 @@ var require_multiselect22 = __commonJS22((exports, module) => {
|
|
|
44733
44991
|
if (cursor3 === i && v22.description) {
|
|
44734
44992
|
desc = ` - ${v22.description}`;
|
|
44735
44993
|
if (prefix.length + title.length + desc.length >= this.out.columns || v22.description.split(/\r?\n/).length > 1) {
|
|
44736
|
-
desc =
|
|
44994
|
+
desc = `
|
|
44995
|
+
` + wrap(v22.description, { margin: prefix.length, width: this.out.columns });
|
|
44737
44996
|
}
|
|
44738
44997
|
}
|
|
44739
44998
|
}
|
|
@@ -44755,7 +45014,9 @@ var require_multiselect22 = __commonJS22((exports, module) => {
|
|
|
44755
45014
|
}
|
|
44756
45015
|
styledOptions.push(this.renderOption(this.cursor, options2[i], i, prefix));
|
|
44757
45016
|
}
|
|
44758
|
-
return
|
|
45017
|
+
return `
|
|
45018
|
+
` + styledOptions.join(`
|
|
45019
|
+
`);
|
|
44759
45020
|
}
|
|
44760
45021
|
renderOptions(options2) {
|
|
44761
45022
|
if (!this.done) {
|
|
@@ -44877,7 +45138,8 @@ var require_autocomplete22 = __commonJS22((exports, module) => {
|
|
|
44877
45138
|
this.aborted = false;
|
|
44878
45139
|
this.fire();
|
|
44879
45140
|
this.render();
|
|
44880
|
-
this.out.write(
|
|
45141
|
+
this.out.write(`
|
|
45142
|
+
`);
|
|
44881
45143
|
this.close();
|
|
44882
45144
|
}
|
|
44883
45145
|
}
|
|
@@ -44886,7 +45148,8 @@ var require_autocomplete22 = __commonJS22((exports, module) => {
|
|
|
44886
45148
|
this.exited = false;
|
|
44887
45149
|
this.fire();
|
|
44888
45150
|
this.render();
|
|
44889
|
-
this.out.write(
|
|
45151
|
+
this.out.write(`
|
|
45152
|
+
`);
|
|
44890
45153
|
this.close();
|
|
44891
45154
|
}
|
|
44892
45155
|
submit() {
|
|
@@ -44894,7 +45157,8 @@ var require_autocomplete22 = __commonJS22((exports, module) => {
|
|
|
44894
45157
|
this.aborted = this.exited = false;
|
|
44895
45158
|
this.fire();
|
|
44896
45159
|
this.render();
|
|
44897
|
-
this.out.write(
|
|
45160
|
+
this.out.write(`
|
|
45161
|
+
`);
|
|
44898
45162
|
this.close();
|
|
44899
45163
|
}
|
|
44900
45164
|
_(c22, key) {
|
|
@@ -44983,7 +45247,8 @@ var require_autocomplete22 = __commonJS22((exports, module) => {
|
|
|
44983
45247
|
if (v22.description) {
|
|
44984
45248
|
desc = ` - ${v22.description}`;
|
|
44985
45249
|
if (prefix.length + title.length + desc.length >= this.out.columns || v22.description.split(/\r?\n/).length > 1) {
|
|
44986
|
-
desc =
|
|
45250
|
+
desc = `
|
|
45251
|
+
` + wrap(v22.description, { margin: 3, width: this.out.columns });
|
|
44987
45252
|
}
|
|
44988
45253
|
}
|
|
44989
45254
|
return prefix + " " + title + color.gray(desc || "");
|
|
@@ -45004,8 +45269,10 @@ var require_autocomplete22 = __commonJS22((exports, module) => {
|
|
|
45004
45269
|
this.done && this.suggestions[this.select] ? this.suggestions[this.select].title : this.rendered = this.transform.render(this.input)
|
|
45005
45270
|
].join(" ");
|
|
45006
45271
|
if (!this.done) {
|
|
45007
|
-
const suggestions = this.suggestions.slice(startIndex, endIndex).map((item, i) => this.renderOption(item, this.select === i + startIndex, i === 0 && startIndex > 0, i + startIndex === endIndex - 1 && endIndex < this.choices.length)).join(
|
|
45008
|
-
|
|
45272
|
+
const suggestions = this.suggestions.slice(startIndex, endIndex).map((item, i) => this.renderOption(item, this.select === i + startIndex, i === 0 && startIndex > 0, i + startIndex === endIndex - 1 && endIndex < this.choices.length)).join(`
|
|
45273
|
+
`);
|
|
45274
|
+
this.outputText += `
|
|
45275
|
+
` + (suggestions || color.gray(this.fallback.title));
|
|
45009
45276
|
}
|
|
45010
45277
|
this.out.write(erase22.line + cursor22.to(0) + this.outputText);
|
|
45011
45278
|
}
|
|
@@ -45129,7 +45396,8 @@ Instructions:
|
|
|
45129
45396
|
}
|
|
45130
45397
|
renderCurrentInput() {
|
|
45131
45398
|
return `
|
|
45132
|
-
Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
|
|
45399
|
+
Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
|
|
45400
|
+
`;
|
|
45133
45401
|
}
|
|
45134
45402
|
renderOption(cursor3, v22, i) {
|
|
45135
45403
|
let title;
|
|
@@ -45202,7 +45470,8 @@ var require_confirm22 = __commonJS22((exports, module) => {
|
|
|
45202
45470
|
this.done = this.aborted = true;
|
|
45203
45471
|
this.fire();
|
|
45204
45472
|
this.render();
|
|
45205
|
-
this.out.write(
|
|
45473
|
+
this.out.write(`
|
|
45474
|
+
`);
|
|
45206
45475
|
this.close();
|
|
45207
45476
|
}
|
|
45208
45477
|
submit() {
|
|
@@ -45211,7 +45480,8 @@ var require_confirm22 = __commonJS22((exports, module) => {
|
|
|
45211
45480
|
this.aborted = false;
|
|
45212
45481
|
this.fire();
|
|
45213
45482
|
this.render();
|
|
45214
|
-
this.out.write(
|
|
45483
|
+
this.out.write(`
|
|
45484
|
+
`);
|
|
45215
45485
|
this.close();
|
|
45216
45486
|
}
|
|
45217
45487
|
_(c22, key) {
|
|
@@ -47234,7 +47504,7 @@ var ut2 = l3((qe, P22) => {
|
|
|
47234
47504
|
return t = t.replace(C, "^$1"), t;
|
|
47235
47505
|
}
|
|
47236
47506
|
function Jt(t, e) {
|
|
47237
|
-
return t = `${t}`, t = t.replace(/(\\*)"/g,
|
|
47507
|
+
return t = `${t}`, t = t.replace(/(\\*)"/g, "$1$1\\\""), t = t.replace(/(\\*)$/, "$1$1"), t = `"${t}"`, t = t.replace(C, "^$1"), e && (t = t.replace(C, "^$1")), t;
|
|
47238
47508
|
}
|
|
47239
47509
|
P22.exports.command = Vt;
|
|
47240
47510
|
P22.exports.argument = Jt;
|
|
@@ -47422,7 +47692,7 @@ var TITLE_TERMINATORS2 = new Set([
|
|
|
47422
47692
|
...SENTENCE_TERMINATORS2,
|
|
47423
47693
|
":",
|
|
47424
47694
|
'"',
|
|
47425
|
-
"
|
|
47695
|
+
"'",
|
|
47426
47696
|
"\u201D"
|
|
47427
47697
|
]);
|
|
47428
47698
|
var SMALL_WORDS2 = new Set([
|
|
@@ -47469,7 +47739,7 @@ var uncountables2 = {};
|
|
|
47469
47739
|
var irregularPlurals2 = {};
|
|
47470
47740
|
var irregularSingles2 = {};
|
|
47471
47741
|
function sanitizeRule2(rule) {
|
|
47472
|
-
return typeof rule === "string" ? new RegExp(`^${rule}
|
|
47742
|
+
return typeof rule === "string" ? new RegExp(`^${rule}$`, "i") : rule;
|
|
47473
47743
|
}
|
|
47474
47744
|
function restoreCase2(word, token) {
|
|
47475
47745
|
if (word === token)
|
|
@@ -48119,12 +48389,16 @@ var config6 = {
|
|
|
48119
48389
|
type: "Select the type of change that you\u2019re committing:",
|
|
48120
48390
|
scope: "Select the SCOPE of this change (optional):",
|
|
48121
48391
|
customScope: "Select the SCOPE of this change:",
|
|
48122
|
-
subject:
|
|
48123
|
-
|
|
48124
|
-
|
|
48392
|
+
subject: `Write a SHORT, IMPERATIVE tense description of the change:
|
|
48393
|
+
`,
|
|
48394
|
+
body: `Provide a LONGER description of the change (optional). Use "|" to break new line:
|
|
48395
|
+
`,
|
|
48396
|
+
breaking: `List any BREAKING CHANGES (optional). Use "|" to break new line:
|
|
48397
|
+
`,
|
|
48125
48398
|
footerPrefixesSelect: "Select the ISSUES type of the change list by this change (optional):",
|
|
48126
48399
|
customFooterPrefixes: "Input ISSUES prefix:",
|
|
48127
|
-
footer:
|
|
48400
|
+
footer: `List any ISSUES by this change. E.g.: #31, #34:
|
|
48401
|
+
`,
|
|
48128
48402
|
confirmCommit: "Are you sure you want to proceed with the commit above?"
|
|
48129
48403
|
},
|
|
48130
48404
|
types: [
|
|
@@ -49151,7 +49425,8 @@ var import_escape2 = __toESM22(require_escape2(), 1);
|
|
|
49151
49425
|
var import_normalizeEmail2 = __toESM22(require_normalizeEmail2(), 1);
|
|
49152
49426
|
var CompilerBuffer2 = class _CompilerBuffer2 {
|
|
49153
49427
|
#content = "";
|
|
49154
|
-
newLine =
|
|
49428
|
+
newLine = `
|
|
49429
|
+
`;
|
|
49155
49430
|
writeStatement(statement) {
|
|
49156
49431
|
this.#content = `${this.#content}${this.newLine}${statement}`;
|
|
49157
49432
|
}
|
|
@@ -49289,7 +49564,8 @@ function defineFieldValidations2({
|
|
|
49289
49564
|
variableName,
|
|
49290
49565
|
dropMissingCheck
|
|
49291
49566
|
}) {
|
|
49292
|
-
return `${validations.map((one) => emitValidationSnippet2(one, variableName, bail, dropMissingCheck)).join(
|
|
49567
|
+
return `${validations.map((one) => emitValidationSnippet2(one, variableName, bail, dropMissingCheck)).join(`
|
|
49568
|
+
`)}`;
|
|
49293
49569
|
}
|
|
49294
49570
|
function defineArrayInitialOutput2({
|
|
49295
49571
|
variableName,
|
|
@@ -51113,7 +51389,7 @@ var alphaRule2 = createRule2((value, options2, field) => {
|
|
|
51113
51389
|
characterSet += "_";
|
|
51114
51390
|
}
|
|
51115
51391
|
}
|
|
51116
|
-
const expression = new RegExp(`^[${characterSet}]
|
|
51392
|
+
const expression = new RegExp(`^[${characterSet}]+$`);
|
|
51117
51393
|
if (!expression.test(value)) {
|
|
51118
51394
|
field.report(messages2.alpha, "alpha", field);
|
|
51119
51395
|
}
|
|
@@ -51134,7 +51410,7 @@ var alphaNumericRule2 = createRule2((value, options2, field) => {
|
|
|
51134
51410
|
characterSet += "_";
|
|
51135
51411
|
}
|
|
51136
51412
|
}
|
|
51137
|
-
const expression = new RegExp(`^[${characterSet}]
|
|
51413
|
+
const expression = new RegExp(`^[${characterSet}]+$`);
|
|
51138
51414
|
if (!expression.test(value)) {
|
|
51139
51415
|
field.report(messages2.alphaNumeric, "alphaNumeric", field);
|
|
51140
51416
|
}
|
|
@@ -52402,12 +52678,16 @@ var git_default2 = {
|
|
|
52402
52678
|
type: "Select the type of change that you\u2019re committing:",
|
|
52403
52679
|
scope: "Select the SCOPE of this change (optional):",
|
|
52404
52680
|
customScope: "Select the SCOPE of this change:",
|
|
52405
|
-
subject:
|
|
52406
|
-
|
|
52407
|
-
|
|
52681
|
+
subject: `Write a SHORT, IMPERATIVE tense description of the change:
|
|
52682
|
+
`,
|
|
52683
|
+
body: `Provide a LONGER description of the change (optional). Use "|" to break new line:
|
|
52684
|
+
`,
|
|
52685
|
+
breaking: `List any BREAKING CHANGES (optional). Use "|" to break new line:
|
|
52686
|
+
`,
|
|
52408
52687
|
footerPrefixesSelect: "Select the ISSUES type of the change list by this change (optional):",
|
|
52409
52688
|
customFooterPrefixes: "Input ISSUES prefix:",
|
|
52410
|
-
footer:
|
|
52689
|
+
footer: `List any ISSUES by this change. E.g.: #31, #34:
|
|
52690
|
+
`,
|
|
52411
52691
|
confirmCommit: "Are you sure you want to proceed with the commit above?"
|
|
52412
52692
|
},
|
|
52413
52693
|
types: [
|
|
@@ -52947,7 +53227,7 @@ function determineAppEnv2() {
|
|
|
52947
53227
|
if (app22.env === "production")
|
|
52948
53228
|
return "prod";
|
|
52949
53229
|
if (!app22.env)
|
|
52950
|
-
throw new Error("Couldn
|
|
53230
|
+
throw new Error("Couldn't determine app environment");
|
|
52951
53231
|
return app22.env;
|
|
52952
53232
|
}
|
|
52953
53233
|
|
|
@@ -52984,7 +53264,8 @@ class ErrorHandler2 {
|
|
|
52984
53264
|
console.error("Error is not an instance of Error:", err2);
|
|
52985
53265
|
return;
|
|
52986
53266
|
}
|
|
52987
|
-
const formattedError = `[${new Date().toISOString()}] ${err2.name}: ${err2.message}
|
|
53267
|
+
const formattedError = `[${new Date().toISOString()}] ${err2.name}: ${err2.message}
|
|
53268
|
+
`;
|
|
52988
53269
|
const logFilePath = logsPath2("stacks.log") ?? logsPath2("errors.log");
|
|
52989
53270
|
try {
|
|
52990
53271
|
await mkdir2(dirname3(logFilePath), { recursive: true });
|
|
@@ -53022,7 +53303,8 @@ function handleError2(err2, options2) {
|
|
|
53022
53303
|
return ErrorHandler2.handle(err2, options2);
|
|
53023
53304
|
}
|
|
53024
53305
|
async function writeToLogFile2(message, options2) {
|
|
53025
|
-
const formattedMessage = `[${new Date().toISOString()}] ${message}
|
|
53306
|
+
const formattedMessage = `[${new Date().toISOString()}] ${message}
|
|
53307
|
+
`;
|
|
53026
53308
|
try {
|
|
53027
53309
|
const logFile = options2?.logFile ?? exports_config2.logging.logsPath ?? "storage/logs/stacks.log";
|
|
53028
53310
|
try {
|
|
@@ -54016,9 +54298,12 @@ function stringEncaseCRLFWithFirstIndex2(string2, prefix, postfix, index) {
|
|
|
54016
54298
|
let returnValue = "";
|
|
54017
54299
|
do {
|
|
54018
54300
|
const gotCR = string2[index - 1] === "\r";
|
|
54019
|
-
returnValue += string2.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ?
|
|
54301
|
+
returnValue += string2.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? `\r
|
|
54302
|
+
` : `
|
|
54303
|
+
`) + postfix;
|
|
54020
54304
|
endIndex = index + 1;
|
|
54021
|
-
index = string2.indexOf(
|
|
54305
|
+
index = string2.indexOf(`
|
|
54306
|
+
`, endIndex);
|
|
54022
54307
|
} while (index !== -1);
|
|
54023
54308
|
returnValue += string2.slice(endIndex);
|
|
54024
54309
|
return returnValue;
|
|
@@ -54158,7 +54443,8 @@ var applyStyle2 = (self2, string2) => {
|
|
|
54158
54443
|
styler = styler.parent;
|
|
54159
54444
|
}
|
|
54160
54445
|
}
|
|
54161
|
-
const lfIndex = string2.indexOf(
|
|
54446
|
+
const lfIndex = string2.indexOf(`
|
|
54447
|
+
`);
|
|
54162
54448
|
if (lfIndex !== -1) {
|
|
54163
54449
|
string2 = stringEncaseCRLFWithFirstIndex2(string2, closeAll, openAll, lfIndex);
|
|
54164
54450
|
}
|
|
@@ -54192,7 +54478,8 @@ var changePrototype2 = (to, from) => {
|
|
|
54192
54478
|
}
|
|
54193
54479
|
Object.setPrototypeOf(to, fromPrototype);
|
|
54194
54480
|
};
|
|
54195
|
-
var wrappedToString2 = (withName, fromBody) => `/* Wrapped ${withName}
|
|
54481
|
+
var wrappedToString2 = (withName, fromBody) => `/* Wrapped ${withName}*/
|
|
54482
|
+
${fromBody}`;
|
|
54196
54483
|
var toStringDescriptor2 = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
|
|
54197
54484
|
var toStringName2 = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
|
|
54198
54485
|
var changeToString2 = (to, from, name) => {
|
|
@@ -54793,7 +55080,8 @@ class Ora2 {
|
|
|
54793
55080
|
const fullSuffixText = this.#getFullSuffixText(this.#suffixText, "-");
|
|
54794
55081
|
const fullText = " ".repeat(this.#indent) + fullPrefixText + "--" + this.#text + "--" + fullSuffixText;
|
|
54795
55082
|
this.#lineCount = 0;
|
|
54796
|
-
for (const line of stripAnsi32(fullText).split(
|
|
55083
|
+
for (const line of stripAnsi32(fullText).split(`
|
|
55084
|
+
`)) {
|
|
54797
55085
|
this.#lineCount += Math.max(1, Math.ceil(stringWidth22(line, { countAnsiEscapeCodes: true }) / columns));
|
|
54798
55086
|
}
|
|
54799
55087
|
}
|
|
@@ -54863,7 +55151,8 @@ class Ora2 {
|
|
|
54863
55151
|
}
|
|
54864
55152
|
if (!this.#isEnabled) {
|
|
54865
55153
|
if (this.text) {
|
|
54866
|
-
this.#stream.write(`- ${this.text}
|
|
55154
|
+
this.#stream.write(`- ${this.text}
|
|
55155
|
+
`);
|
|
54867
55156
|
}
|
|
54868
55157
|
return this;
|
|
54869
55158
|
}
|
|
@@ -54921,7 +55210,8 @@ class Ora2 {
|
|
|
54921
55210
|
const fullText = typeof text22 === "string" ? " " + text22 : "";
|
|
54922
55211
|
const suffixText = options22.suffixText ?? this.#suffixText;
|
|
54923
55212
|
const fullSuffixText = this.#getFullSuffixText(suffixText, " ");
|
|
54924
|
-
const textToWrite = fullPrefixText + symbolText + fullText + fullSuffixText +
|
|
55213
|
+
const textToWrite = fullPrefixText + symbolText + fullText + fullSuffixText + `
|
|
55214
|
+
`;
|
|
54925
55215
|
this.stop();
|
|
54926
55216
|
this.#stream.write(textToWrite);
|
|
54927
55217
|
return this;
|
|
@@ -56468,26 +56758,40 @@ var quotes2 = collect2([
|
|
|
56468
56758
|
]);
|
|
56469
56759
|
var export_prompts2 = import_prompts2.default;
|
|
56470
56760
|
var import_node_forge2 = __toESM3(require_lib2(), 1);
|
|
56471
|
-
function deepMerge2(target,
|
|
56472
|
-
if (!
|
|
56473
|
-
return
|
|
56474
|
-
|
|
56475
|
-
if (
|
|
56476
|
-
|
|
56477
|
-
|
|
56478
|
-
|
|
56479
|
-
|
|
56480
|
-
|
|
56481
|
-
|
|
56482
|
-
|
|
56483
|
-
|
|
56761
|
+
function deepMerge2(target, source) {
|
|
56762
|
+
if (Array.isArray(source) && !Array.isArray(target)) {
|
|
56763
|
+
return source;
|
|
56764
|
+
}
|
|
56765
|
+
if (Array.isArray(source) && Array.isArray(target)) {
|
|
56766
|
+
return source.map((sourceItem, index) => {
|
|
56767
|
+
const targetItem = target[index];
|
|
56768
|
+
if (isObject32(sourceItem) && isObject32(targetItem)) {
|
|
56769
|
+
return deepMerge2(targetItem, sourceItem);
|
|
56770
|
+
}
|
|
56771
|
+
return sourceItem;
|
|
56772
|
+
});
|
|
56773
|
+
}
|
|
56774
|
+
if (!isObject32(source) || !isObject32(target)) {
|
|
56775
|
+
return source;
|
|
56776
|
+
}
|
|
56777
|
+
const merged = { ...target };
|
|
56778
|
+
for (const key in source) {
|
|
56779
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
56780
|
+
const sourceValue = source[key];
|
|
56781
|
+
const targetValue = merged[key];
|
|
56782
|
+
if (sourceValue === null || sourceValue === undefined) {
|
|
56783
|
+
merged[key] = sourceValue;
|
|
56784
|
+
} else if (isObject32(sourceValue) && isObject32(targetValue)) {
|
|
56785
|
+
merged[key] = deepMerge2(targetValue, sourceValue);
|
|
56786
|
+
} else {
|
|
56787
|
+
merged[key] = sourceValue;
|
|
56484
56788
|
}
|
|
56485
56789
|
}
|
|
56486
56790
|
}
|
|
56487
|
-
return
|
|
56791
|
+
return merged;
|
|
56488
56792
|
}
|
|
56489
56793
|
function isObject32(item) {
|
|
56490
|
-
return item && typeof item === "object" && !Array.isArray(item);
|
|
56794
|
+
return Boolean(item && typeof item === "object" && !Array.isArray(item));
|
|
56491
56795
|
}
|
|
56492
56796
|
async function loadConfig2({ name, cwd, defaultConfig }) {
|
|
56493
56797
|
const configPath = resolve3(cwd || process22.cwd(), `${name}.config`);
|
|
@@ -56509,7 +56813,7 @@ var config42 = await loadConfig2({
|
|
|
56509
56813
|
stateName: "California",
|
|
56510
56814
|
localityName: "Playa Vista",
|
|
56511
56815
|
commonName: "stacks.localhost",
|
|
56512
|
-
validityDays:
|
|
56816
|
+
validityDays: 825,
|
|
56513
56817
|
hostCertCN: "stacks.localhost",
|
|
56514
56818
|
domain: "stacks.localhost",
|
|
56515
56819
|
rootCAObject: { certificate: "", privateKey: "" },
|
|
@@ -56553,61 +56857,78 @@ function debugLog(category, message, verbose) {
|
|
|
56553
56857
|
console.debug(`[tlsx:${category}] ${message}`);
|
|
56554
56858
|
}
|
|
56555
56859
|
}
|
|
56556
|
-
function
|
|
56860
|
+
function generateRandomSerial(verbose) {
|
|
56557
56861
|
debugLog("cert", "Generating random serial number", verbose);
|
|
56558
56862
|
const serialNumber = makeNumberPositive(import_node_forge2.default.util.bytesToHex(import_node_forge2.default.random.getBytesSync(20)));
|
|
56559
56863
|
debugLog("cert", `Generated serial number: ${serialNumber}`, verbose);
|
|
56560
56864
|
return serialNumber;
|
|
56561
56865
|
}
|
|
56562
|
-
function
|
|
56563
|
-
|
|
56564
|
-
const
|
|
56565
|
-
|
|
56566
|
-
const
|
|
56567
|
-
const
|
|
56568
|
-
|
|
56569
|
-
|
|
56570
|
-
|
|
56571
|
-
}
|
|
56572
|
-
|
|
56573
|
-
|
|
56574
|
-
const
|
|
56575
|
-
|
|
56576
|
-
|
|
56577
|
-
|
|
56578
|
-
|
|
56579
|
-
|
|
56580
|
-
|
|
56581
|
-
|
|
56582
|
-
|
|
56583
|
-
|
|
56584
|
-
|
|
56585
|
-
|
|
56586
|
-
|
|
56587
|
-
|
|
56588
|
-
|
|
56589
|
-
|
|
56590
|
-
|
|
56591
|
-
|
|
56592
|
-
}
|
|
56593
|
-
|
|
56594
|
-
|
|
56595
|
-
|
|
56596
|
-
|
|
56597
|
-
|
|
56598
|
-
|
|
56599
|
-
|
|
56600
|
-
|
|
56601
|
-
|
|
56866
|
+
function calculateValidityDates(options22) {
|
|
56867
|
+
const notBeforeDays = options22.notBeforeDays ?? 2;
|
|
56868
|
+
const validityDays = options22.validityDays ?? (options22.validityYears ? options22.validityYears * 365 : 180);
|
|
56869
|
+
debugLog("cert", "Calculating certificate validity dates", options22.verbose);
|
|
56870
|
+
const notBefore = new Date(Date.now() - 86400 * notBeforeDays * 1000);
|
|
56871
|
+
const notAfter = new Date(notBefore.getTime() + validityDays * 24 * 60 * 60 * 1000);
|
|
56872
|
+
notBefore.setUTCHours(0, 0, 0, 0);
|
|
56873
|
+
notAfter.setUTCHours(23, 59, 59, 999);
|
|
56874
|
+
debugLog("cert", `Validity period: ${notBefore.toISOString()} to ${notAfter.toISOString()}`, options22.verbose);
|
|
56875
|
+
return { notBefore, notAfter };
|
|
56876
|
+
}
|
|
56877
|
+
function generateCertificateExtensions(options22) {
|
|
56878
|
+
const extensions = [];
|
|
56879
|
+
extensions.push({
|
|
56880
|
+
name: "basicConstraints",
|
|
56881
|
+
cA: options22.isCA ?? false,
|
|
56882
|
+
critical: true,
|
|
56883
|
+
...options22.basicConstraints || {}
|
|
56884
|
+
});
|
|
56885
|
+
if (options22.keyUsage) {
|
|
56886
|
+
extensions.push({
|
|
56887
|
+
name: "keyUsage",
|
|
56888
|
+
critical: true,
|
|
56889
|
+
...options22.keyUsage
|
|
56890
|
+
});
|
|
56891
|
+
}
|
|
56892
|
+
if (options22.extKeyUsage) {
|
|
56893
|
+
extensions.push({
|
|
56894
|
+
name: "extKeyUsage",
|
|
56895
|
+
...options22.extKeyUsage
|
|
56896
|
+
});
|
|
56897
|
+
}
|
|
56898
|
+
if (options22.subjectAltNames && options22.subjectAltNames.length > 0) {
|
|
56899
|
+
extensions.push({
|
|
56900
|
+
name: "subjectAltName",
|
|
56901
|
+
altNames: options22.subjectAltNames
|
|
56902
|
+
});
|
|
56903
|
+
}
|
|
56904
|
+
return extensions;
|
|
56905
|
+
}
|
|
56906
|
+
async function createRootCA(options22 = {}) {
|
|
56907
|
+
debugLog("ca", "Creating new Root CA Certificate", options22.verbose);
|
|
56908
|
+
const keySize = options22.keySize || 2048;
|
|
56909
|
+
debugLog("ca", `Generating ${keySize}-bit RSA key pair`, options22.verbose);
|
|
56910
|
+
const { privateKey, publicKey } = import_node_forge2.pki.rsa.generateKeyPair(keySize);
|
|
56602
56911
|
const attributes = [
|
|
56603
|
-
{ shortName: "C", value:
|
|
56604
|
-
{ shortName: "ST", value:
|
|
56605
|
-
{ shortName: "L", value:
|
|
56606
|
-
{ shortName: "O", value: "Local Development CA" },
|
|
56607
|
-
{ shortName: "
|
|
56912
|
+
{ shortName: "C", value: options22.countryName || config42.countryName },
|
|
56913
|
+
{ shortName: "ST", value: options22.stateName || config42.stateName },
|
|
56914
|
+
{ shortName: "L", value: options22.localityName || config42.localityName },
|
|
56915
|
+
{ shortName: "O", value: options22.organization || "Local Development CA" },
|
|
56916
|
+
{ shortName: "OU", value: options22.organizationalUnit || "Certificate Authority" },
|
|
56917
|
+
{ shortName: "CN", value: options22.commonName || "Local Development Root CA" },
|
|
56918
|
+
...options22.extraAttributes || []
|
|
56608
56919
|
];
|
|
56609
|
-
|
|
56610
|
-
|
|
56920
|
+
const { notBefore, notAfter } = calculateValidityDates({
|
|
56921
|
+
validityYears: options22.validityYears || 100,
|
|
56922
|
+
verbose: options22.verbose
|
|
56923
|
+
});
|
|
56924
|
+
const caCert = import_node_forge2.pki.createCertificate();
|
|
56925
|
+
caCert.publicKey = publicKey;
|
|
56926
|
+
caCert.serialNumber = generateRandomSerial(options22.verbose);
|
|
56927
|
+
caCert.validity.notBefore = notBefore;
|
|
56928
|
+
caCert.validity.notAfter = notAfter;
|
|
56929
|
+
caCert.setSubject(attributes);
|
|
56930
|
+
caCert.setIssuer(attributes);
|
|
56931
|
+
caCert.setExtensions([
|
|
56611
56932
|
{
|
|
56612
56933
|
name: "basicConstraints",
|
|
56613
56934
|
cA: true,
|
|
@@ -56622,115 +56943,59 @@ async function createRootCA(options22) {
|
|
|
56622
56943
|
{
|
|
56623
56944
|
name: "subjectKeyIdentifier"
|
|
56624
56945
|
}
|
|
56625
|
-
];
|
|
56626
|
-
debugLog("ca", "Creating CA certificate", options22?.verbose);
|
|
56627
|
-
const caCert = import_node_forge2.pki.createCertificate();
|
|
56628
|
-
caCert.publicKey = publicKey;
|
|
56629
|
-
caCert.serialNumber = randomSerialNumber(options22?.verbose);
|
|
56630
|
-
caCert.validity.notBefore = getCertNotBefore(options22?.verbose);
|
|
56631
|
-
caCert.validity.notAfter = getCANotAfter(caCert.validity.notBefore, options22?.verbose);
|
|
56632
|
-
caCert.setSubject(attributes);
|
|
56633
|
-
caCert.setIssuer(attributes);
|
|
56634
|
-
caCert.setExtensions(extensions);
|
|
56635
|
-
debugLog("ca", "Signing certificate with SHA-256", options22?.verbose);
|
|
56946
|
+
]);
|
|
56636
56947
|
caCert.sign(privateKey, import_node_forge2.default.md.sha256.create());
|
|
56637
|
-
const pemCert = import_node_forge2.pki.certificateToPem(caCert);
|
|
56638
|
-
const pemKey = import_node_forge2.pki.privateKeyToPem(privateKey);
|
|
56639
|
-
debugLog("ca", "Root CA Certificate created successfully", options22?.verbose);
|
|
56640
56948
|
return {
|
|
56641
|
-
certificate:
|
|
56642
|
-
privateKey:
|
|
56643
|
-
notBefore
|
|
56644
|
-
notAfter
|
|
56949
|
+
certificate: import_node_forge2.pki.certificateToPem(caCert),
|
|
56950
|
+
privateKey: import_node_forge2.pki.privateKeyToPem(privateKey),
|
|
56951
|
+
notBefore,
|
|
56952
|
+
notAfter
|
|
56645
56953
|
};
|
|
56646
56954
|
}
|
|
56647
|
-
async function
|
|
56648
|
-
debugLog("cert", "Generating new
|
|
56649
|
-
debugLog("cert", `Options: ${JSON.stringify(options22)}`, options22
|
|
56650
|
-
if (!options22?.
|
|
56651
|
-
|
|
56652
|
-
throw new Error('"hostCertCN" must be a String');
|
|
56955
|
+
async function generateCertificate(options22) {
|
|
56956
|
+
debugLog("cert", "Generating new certificate", options22.verbose);
|
|
56957
|
+
debugLog("cert", `Options: ${JSON.stringify(options22)}`, options22.verbose);
|
|
56958
|
+
if (!options22.rootCAObject?.certificate || !options22.rootCAObject?.privateKey) {
|
|
56959
|
+
throw new Error("Root CA certificate and private key are required");
|
|
56653
56960
|
}
|
|
56654
|
-
if (!options22.domain?.trim()) {
|
|
56655
|
-
debugLog("cert", "Error: domain is required", options22?.verbose);
|
|
56656
|
-
throw new Error('"domain" must be a String');
|
|
56657
|
-
}
|
|
56658
|
-
if (!options22.rootCAObject || !options22.rootCAObject.certificate || !options22.rootCAObject.privateKey) {
|
|
56659
|
-
debugLog("cert", "Error: rootCAObject is invalid or missing", options22?.verbose);
|
|
56660
|
-
throw new Error('"rootCAObject" must be an Object with the properties "certificate" & "privateKey"');
|
|
56661
|
-
}
|
|
56662
|
-
debugLog("cert", "Converting Root CA PEM to forge objects", options22?.verbose);
|
|
56663
56961
|
const caCert = import_node_forge2.pki.certificateFromPem(options22.rootCAObject.certificate);
|
|
56664
56962
|
const caKey = import_node_forge2.pki.privateKeyFromPem(options22.rootCAObject.privateKey);
|
|
56665
56963
|
debugLog("cert", "Generating 2048-bit RSA key pair for host certificate", options22?.verbose);
|
|
56666
|
-
const
|
|
56667
|
-
|
|
56668
|
-
const attributes = [
|
|
56964
|
+
const keySize = 2048;
|
|
56965
|
+
const { privateKey, publicKey } = import_node_forge2.pki.rsa.generateKeyPair(keySize);
|
|
56966
|
+
const attributes = options22.certificateAttributes || [
|
|
56669
56967
|
{ shortName: "C", value: options22.countryName || config42.countryName },
|
|
56670
56968
|
{ shortName: "ST", value: options22.stateName || config42.stateName },
|
|
56671
56969
|
{ shortName: "L", value: options22.localityName || config42.localityName },
|
|
56672
56970
|
{ shortName: "O", value: options22.organizationName || config42.organizationName },
|
|
56673
56971
|
{ shortName: "CN", value: options22.commonName || config42.commonName }
|
|
56674
56972
|
];
|
|
56675
|
-
const
|
|
56676
|
-
|
|
56677
|
-
|
|
56678
|
-
|
|
56679
|
-
|
|
56680
|
-
|
|
56681
|
-
|
|
56682
|
-
|
|
56683
|
-
|
|
56684
|
-
|
|
56685
|
-
|
|
56686
|
-
|
|
56687
|
-
|
|
56688
|
-
},
|
|
56689
|
-
{
|
|
56690
|
-
name: "keyUsage",
|
|
56691
|
-
digitalSignature: true,
|
|
56692
|
-
keyEncipherment: true,
|
|
56693
|
-
critical: true
|
|
56694
|
-
},
|
|
56695
|
-
{
|
|
56696
|
-
name: "extKeyUsage",
|
|
56697
|
-
serverAuth: true,
|
|
56698
|
-
clientAuth: false
|
|
56699
|
-
},
|
|
56700
|
-
{
|
|
56701
|
-
name: "subjectAltName",
|
|
56702
|
-
altNames
|
|
56703
|
-
}
|
|
56704
|
-
];
|
|
56705
|
-
debugLog("cert", "Creating new host certificate", options22?.verbose);
|
|
56706
|
-
const newHostCert = import_node_forge2.pki.createCertificate();
|
|
56707
|
-
newHostCert.publicKey = hostKeys.publicKey;
|
|
56708
|
-
debugLog("cert", "Setting certificate properties", options22?.verbose);
|
|
56709
|
-
newHostCert.serialNumber = randomSerialNumber(options22?.verbose);
|
|
56710
|
-
newHostCert.validity.notBefore = getCertNotBefore(options22?.verbose);
|
|
56711
|
-
newHostCert.validity.notAfter = getCertNotAfter(newHostCert.validity.notBefore, options22?.verbose);
|
|
56712
|
-
newHostCert.setSubject(attributes);
|
|
56713
|
-
newHostCert.setIssuer(caCert.subject.attributes);
|
|
56714
|
-
newHostCert.setExtensions(extensions);
|
|
56715
|
-
debugLog("cert", "Signing certificate with SHA-256", options22?.verbose);
|
|
56716
|
-
newHostCert.sign(caKey, import_node_forge2.default.md.sha256.create());
|
|
56717
|
-
debugLog("cert", "Converting certificate to PEM format", options22?.verbose);
|
|
56718
|
-
const pemHostCert = import_node_forge2.pki.certificateToPem(newHostCert);
|
|
56719
|
-
const pemHostKey = import_node_forge2.pki.privateKeyToPem(hostKeys.privateKey);
|
|
56720
|
-
debugLog("cert", "Host certificate generated successfully", options22?.verbose);
|
|
56973
|
+
const { notBefore, notAfter } = calculateValidityDates({
|
|
56974
|
+
validityDays: options22.validityDays,
|
|
56975
|
+
verbose: options22.verbose
|
|
56976
|
+
});
|
|
56977
|
+
const cert = import_node_forge2.pki.createCertificate();
|
|
56978
|
+
cert.publicKey = publicKey;
|
|
56979
|
+
cert.serialNumber = generateRandomSerial(options22.verbose);
|
|
56980
|
+
cert.validity.notBefore = notBefore;
|
|
56981
|
+
cert.validity.notAfter = notAfter;
|
|
56982
|
+
cert.setSubject(attributes);
|
|
56983
|
+
cert.setIssuer(caCert.subject.attributes);
|
|
56984
|
+
cert.setExtensions(generateCertificateExtensions(options22));
|
|
56985
|
+
cert.sign(caKey, import_node_forge2.default.md.sha256.create());
|
|
56721
56986
|
return {
|
|
56722
|
-
certificate:
|
|
56723
|
-
privateKey:
|
|
56724
|
-
notBefore
|
|
56725
|
-
notAfter
|
|
56987
|
+
certificate: import_node_forge2.pki.certificateToPem(cert),
|
|
56988
|
+
privateKey: import_node_forge2.pki.privateKeyToPem(privateKey),
|
|
56989
|
+
notBefore,
|
|
56990
|
+
notAfter
|
|
56726
56991
|
};
|
|
56727
56992
|
}
|
|
56728
56993
|
async function addCertToSystemTrustStoreAndSaveCert(cert, caCert, options22) {
|
|
56729
56994
|
debugLog("trust", `Adding certificate to system trust store with options: ${JSON.stringify(options22)}`, options22?.verbose);
|
|
56730
56995
|
debugLog("trust", "Storing certificate and private key", options22?.verbose);
|
|
56731
|
-
const certPath =
|
|
56996
|
+
const certPath = storeCertificate(cert, options22);
|
|
56732
56997
|
debugLog("trust", "Storing CA certificate", options22?.verbose);
|
|
56733
|
-
const caCertPath =
|
|
56998
|
+
const caCertPath = storeCACertificate(caCert, options22);
|
|
56734
56999
|
const platform22 = os4.platform();
|
|
56735
57000
|
debugLog("trust", `Detected platform: ${platform22}`, options22?.verbose);
|
|
56736
57001
|
const args = "TC, C, C";
|
|
@@ -56766,7 +57031,7 @@ async function addCertToSystemTrustStoreAndSaveCert(cert, caCert, options22) {
|
|
|
56766
57031
|
debugLog("trust", "Certificate successfully added to system trust store", options22?.verbose);
|
|
56767
57032
|
return certPath;
|
|
56768
57033
|
}
|
|
56769
|
-
function
|
|
57034
|
+
function storeCertificate(cert, options22) {
|
|
56770
57035
|
debugLog("storage", `Storing certificate and private key with options: ${JSON.stringify(options22)}`, options22?.verbose);
|
|
56771
57036
|
const certPath = options22?.certPath || config42.certPath;
|
|
56772
57037
|
const certKeyPath = options22?.keyPath || config42.keyPath;
|
|
@@ -56789,7 +57054,7 @@ function storeCert(cert, options22) {
|
|
|
56789
57054
|
debugLog("storage", "Certificate and private key stored successfully", options22?.verbose);
|
|
56790
57055
|
return certPath;
|
|
56791
57056
|
}
|
|
56792
|
-
function
|
|
57057
|
+
function storeCACertificate(caCert, options22) {
|
|
56793
57058
|
debugLog("storage", "Storing CA certificate", options22?.verbose);
|
|
56794
57059
|
const caCertPath = options22?.caCertPath || config42.caCertPath;
|
|
56795
57060
|
debugLog("storage", `CA certificate path: ${caCertPath}`, options22?.verbose);
|
|
@@ -56807,58 +57072,135 @@ var export_tls = import_node_forge2.tls;
|
|
|
56807
57072
|
var export_pki = import_node_forge2.pki;
|
|
56808
57073
|
var export_forge = import_node_forge2.default;
|
|
56809
57074
|
|
|
57075
|
+
// src/utils.ts
|
|
57076
|
+
function debugLog2(category, message, verbose) {
|
|
57077
|
+
if (verbose) {
|
|
57078
|
+
console.debug(`[rpx:${category}] ${message}`);
|
|
57079
|
+
}
|
|
57080
|
+
}
|
|
57081
|
+
function extractDomains(options3) {
|
|
57082
|
+
if (isMultiProxyConfig(options3)) {
|
|
57083
|
+
return options3.proxies.map((proxy) => {
|
|
57084
|
+
const domain2 = proxy.to || "stacks.localhost";
|
|
57085
|
+
return domain2.startsWith("http") ? new URL(domain2).hostname : domain2;
|
|
57086
|
+
});
|
|
57087
|
+
}
|
|
57088
|
+
const domain = options3.to || "stacks.localhost";
|
|
57089
|
+
return [domain.startsWith("http") ? new URL(domain).hostname : domain];
|
|
57090
|
+
}
|
|
57091
|
+
|
|
56810
57092
|
// src/https.ts
|
|
56811
|
-
|
|
56812
|
-
|
|
56813
|
-
|
|
56814
|
-
|
|
56815
|
-
|
|
56816
|
-
|
|
56817
|
-
|
|
56818
|
-
|
|
56819
|
-
|
|
56820
|
-
|
|
56821
|
-
|
|
57093
|
+
var cachedSSLConfig = null;
|
|
57094
|
+
function isMultiProxyConfig(options3) {
|
|
57095
|
+
return "proxies" in options3;
|
|
57096
|
+
}
|
|
57097
|
+
function generateWildcardPatterns(domain) {
|
|
57098
|
+
const patterns = new Set;
|
|
57099
|
+
patterns.add(domain);
|
|
57100
|
+
const parts = domain.split(".");
|
|
57101
|
+
if (parts.length >= 2) {
|
|
57102
|
+
patterns.add(`*.${parts.slice(1).join(".")}`);
|
|
57103
|
+
}
|
|
57104
|
+
return Array.from(patterns);
|
|
57105
|
+
}
|
|
57106
|
+
function generateBaseConfig(options3, verbose) {
|
|
57107
|
+
const domains = extractDomains(options3);
|
|
57108
|
+
const sslBase = path4.join(os5.homedir(), ".stacks", "ssl");
|
|
57109
|
+
const httpsConfig = options3.https === true ? {
|
|
57110
|
+
caCertPath: path4.join(sslBase, "rpx-ca.crt"),
|
|
57111
|
+
certPath: path4.join(sslBase, "rpx.crt"),
|
|
57112
|
+
keyPath: path4.join(sslBase, "rpx.key")
|
|
57113
|
+
} : typeof config4.https === "object" ? {
|
|
57114
|
+
...options3.https,
|
|
57115
|
+
...config4.https
|
|
57116
|
+
} : {};
|
|
57117
|
+
debugLog2("ssl", `Extracted domains: ${domains.join(", ")}`, verbose);
|
|
57118
|
+
debugLog2("ssl", `Using SSL base path: ${sslBase}`, verbose);
|
|
57119
|
+
debugLog2("ssl", `Using HTTPS config: ${JSON.stringify(httpsConfig)}`, verbose);
|
|
57120
|
+
const allPatterns = new Set;
|
|
57121
|
+
domains.forEach((domain) => {
|
|
57122
|
+
allPatterns.add(domain);
|
|
57123
|
+
generateWildcardPatterns(domain).forEach((pattern) => allPatterns.add(pattern));
|
|
57124
|
+
});
|
|
57125
|
+
allPatterns.add("localhost");
|
|
57126
|
+
allPatterns.add("*.localhost");
|
|
57127
|
+
const uniqueDomains = Array.from(allPatterns);
|
|
57128
|
+
debugLog2("ssl", `Generated domain patterns: ${uniqueDomains.join(", ")}`, verbose);
|
|
57129
|
+
return {
|
|
57130
|
+
domain: domains[0],
|
|
57131
|
+
hostCertCN: domains[0],
|
|
57132
|
+
caCertPath: httpsConfig?.caCertPath ?? path4.join(sslBase, "rpx-ca.crt"),
|
|
57133
|
+
certPath: httpsConfig?.certPath ?? path4.join(sslBase, "rpx.crt"),
|
|
57134
|
+
keyPath: httpsConfig?.keyPath ?? path4.join(sslBase, "rpx.key"),
|
|
57135
|
+
altNameIPs: httpsConfig?.altNameIPs ?? ["127.0.0.1", "::1"],
|
|
57136
|
+
altNameURIs: httpsConfig?.altNameURIs ?? [],
|
|
57137
|
+
commonName: httpsConfig?.commonName ?? domains[0],
|
|
57138
|
+
organizationName: httpsConfig?.organizationName ?? "Local Development",
|
|
57139
|
+
countryName: httpsConfig?.countryName ?? "US",
|
|
57140
|
+
stateName: httpsConfig?.stateName ?? "California",
|
|
57141
|
+
localityName: httpsConfig?.localityName ?? "Playa Vista",
|
|
57142
|
+
validityDays: httpsConfig?.validityDays ?? 825,
|
|
57143
|
+
verbose: verbose ?? false,
|
|
57144
|
+
subjectAltNames: uniqueDomains.map((domain) => ({
|
|
57145
|
+
type: 2,
|
|
57146
|
+
value: domain
|
|
57147
|
+
}))
|
|
57148
|
+
};
|
|
57149
|
+
}
|
|
57150
|
+
function generateRootCAConfig(verbose = false) {
|
|
57151
|
+
const sslBase = path4.join(os5.homedir(), ".stacks", "ssl");
|
|
57152
|
+
return {
|
|
57153
|
+
domain: "stacks.localhost",
|
|
57154
|
+
hostCertCN: "stacks.localhost",
|
|
57155
|
+
caCertPath: path4.join(sslBase, "rpx-root-ca.crt"),
|
|
57156
|
+
certPath: path4.join(sslBase, "rpx-certificate.crt"),
|
|
57157
|
+
keyPath: path4.join(sslBase, "rpx-certificate.key"),
|
|
57158
|
+
altNameIPs: ["127.0.0.1", "::1"],
|
|
57159
|
+
altNameURIs: [],
|
|
57160
|
+
organizationName: "Stacks Local Development",
|
|
56822
57161
|
countryName: "US",
|
|
56823
57162
|
stateName: "California",
|
|
56824
57163
|
localityName: "Playa Vista",
|
|
56825
|
-
commonName:
|
|
56826
|
-
validityDays:
|
|
56827
|
-
verbose
|
|
56828
|
-
};
|
|
56829
|
-
if (config4.https === true)
|
|
56830
|
-
return defaultConfig;
|
|
56831
|
-
return {
|
|
56832
|
-
...defaultConfig,
|
|
56833
|
-
...config4.https
|
|
57164
|
+
commonName: "stacks.localhost",
|
|
57165
|
+
validityDays: 3650,
|
|
57166
|
+
verbose
|
|
56834
57167
|
};
|
|
56835
57168
|
}
|
|
56836
|
-
|
|
56837
|
-
|
|
56838
|
-
|
|
56839
|
-
|
|
57169
|
+
function httpsConfig(options3) {
|
|
57170
|
+
return generateBaseConfig(options3, options3.verbose);
|
|
57171
|
+
}
|
|
57172
|
+
async function generateCertificate2(options3) {
|
|
57173
|
+
if (cachedSSLConfig) {
|
|
57174
|
+
const verbose2 = isMultiProxyConfig(options3) ? options3.verbose : options3.verbose;
|
|
57175
|
+
debugLog2("ssl", "Using cached SSL configuration", verbose2);
|
|
56840
57176
|
return;
|
|
56841
|
-
|
|
56842
|
-
|
|
56843
|
-
const
|
|
56844
|
-
|
|
56845
|
-
|
|
56846
|
-
|
|
56847
|
-
|
|
56848
|
-
|
|
56849
|
-
|
|
56850
|
-
|
|
56851
|
-
|
|
56852
|
-
organizationName: config4.https.organizationName,
|
|
56853
|
-
validityDays: config4.https.validityDays,
|
|
57177
|
+
}
|
|
57178
|
+
const domains = isMultiProxyConfig(options3) ? [options3.proxies[0].to, ...options3.proxies.map((proxy) => proxy.to)] : [options3.to];
|
|
57179
|
+
const verbose = isMultiProxyConfig(options3) ? options3.verbose : options3.verbose;
|
|
57180
|
+
debugLog2("ssl", `Generating certificate for domains: ${domains.join(", ")}`, verbose);
|
|
57181
|
+
const rootCAConfig = generateRootCAConfig(verbose);
|
|
57182
|
+
log.info("Generating Root CA certificate...");
|
|
57183
|
+
const caCert = await createRootCA(rootCAConfig);
|
|
57184
|
+
const hostConfig = generateBaseConfig(options3, verbose);
|
|
57185
|
+
log.info(`Generating host certificate for: ${domains.join(", ")}`);
|
|
57186
|
+
const hostCert = await generateCertificate({
|
|
57187
|
+
...hostConfig,
|
|
56854
57188
|
rootCAObject: {
|
|
56855
57189
|
certificate: caCert.certificate,
|
|
56856
57190
|
privateKey: caCert.privateKey
|
|
56857
|
-
}
|
|
56858
|
-
verbose: config4.https.verbose || config4.verbose
|
|
57191
|
+
}
|
|
56859
57192
|
});
|
|
56860
|
-
await addCertToSystemTrustStoreAndSaveCert(hostCert, caCert.certificate,
|
|
56861
|
-
|
|
57193
|
+
await addCertToSystemTrustStoreAndSaveCert(hostCert, caCert.certificate, hostConfig);
|
|
57194
|
+
cachedSSLConfig = {
|
|
57195
|
+
key: hostCert.privateKey,
|
|
57196
|
+
cert: hostCert.certificate,
|
|
57197
|
+
ca: caCert.certificate
|
|
57198
|
+
};
|
|
57199
|
+
log.success(`Certificate generated successfully for ${domains.length} domain${domains.length > 1 ? "s" : ""}`);
|
|
57200
|
+
debugLog2("ssl", `Certificate includes domains: ${domains.join(", ")}`, verbose);
|
|
57201
|
+
}
|
|
57202
|
+
function getSSLConfig() {
|
|
57203
|
+
return cachedSSLConfig;
|
|
56862
57204
|
}
|
|
56863
57205
|
|
|
56864
57206
|
// src/start.ts
|
|
@@ -56866,8 +57208,6 @@ import * as fs5 from "fs";
|
|
|
56866
57208
|
import * as http from "http";
|
|
56867
57209
|
import * as https from "https";
|
|
56868
57210
|
import * as net from "net";
|
|
56869
|
-
import os8 from "os";
|
|
56870
|
-
import path7 from "path";
|
|
56871
57211
|
import process9 from "process";
|
|
56872
57212
|
|
|
56873
57213
|
// src/hosts.ts
|
|
@@ -56876,32 +57216,6 @@ import fs3 from "fs";
|
|
|
56876
57216
|
import os7 from "os";
|
|
56877
57217
|
import path6 from "path";
|
|
56878
57218
|
import process3 from "process";
|
|
56879
|
-
|
|
56880
|
-
// src/utils.ts
|
|
56881
|
-
import { homedir } from "os";
|
|
56882
|
-
import { join as join3 } from "path";
|
|
56883
|
-
function keyPath() {
|
|
56884
|
-
if (typeof config4.https === "boolean")
|
|
56885
|
-
return join3(homedir(), ".stacks", "ssl", `stacks.localhost.key`);
|
|
56886
|
-
return config4.https.keyPath;
|
|
56887
|
-
}
|
|
56888
|
-
function certPath() {
|
|
56889
|
-
if (typeof config4.https === "boolean")
|
|
56890
|
-
return join3(homedir(), ".stacks", "ssl", `stacks.localhost.crt`);
|
|
56891
|
-
return config4.https.certPath;
|
|
56892
|
-
}
|
|
56893
|
-
function caCertPath() {
|
|
56894
|
-
if (typeof config4.https === "boolean")
|
|
56895
|
-
return join3(homedir(), ".stacks", "ssl", `stacks.localhost.ca.crt`);
|
|
56896
|
-
return config4.https.caCertPath;
|
|
56897
|
-
}
|
|
56898
|
-
function debugLog2(category, message, verbose) {
|
|
56899
|
-
if (verbose || config4.verbose) {
|
|
56900
|
-
console.debug(`[rpx:${category}] ${message}`);
|
|
56901
|
-
}
|
|
56902
|
-
}
|
|
56903
|
-
|
|
56904
|
-
// src/hosts.ts
|
|
56905
57219
|
var hostsFilePath = process3.platform === "win32" ? path6.join(process3.env.windir || "C:\\Windows", "System32", "drivers", "etc", "hosts") : "/etc/hosts";
|
|
56906
57220
|
async function sudoWrite(operation, content) {
|
|
56907
57221
|
return new Promise((resolve4, reject) => {
|
|
@@ -56941,9 +57255,9 @@ async function sudoWrite(operation, content) {
|
|
|
56941
57255
|
}
|
|
56942
57256
|
});
|
|
56943
57257
|
}
|
|
56944
|
-
async function addHosts(hosts) {
|
|
56945
|
-
debugLog2("hosts", `Adding hosts: ${hosts.join(", ")}`,
|
|
56946
|
-
debugLog2("hosts", `Using hosts file at: ${hostsFilePath}`,
|
|
57258
|
+
async function addHosts(hosts, verbose) {
|
|
57259
|
+
debugLog2("hosts", `Adding hosts: ${hosts.join(", ")}`, verbose);
|
|
57260
|
+
debugLog2("hosts", `Using hosts file at: ${hostsFilePath}`, verbose);
|
|
56947
57261
|
try {
|
|
56948
57262
|
const existingContent = await fs3.promises.readFile(hostsFilePath, "utf-8");
|
|
56949
57263
|
const newEntries = hosts.filter((host) => {
|
|
@@ -56952,30 +57266,37 @@ async function addHosts(hosts) {
|
|
|
56952
57266
|
return !existingContent.includes(ipv4Entry) && !existingContent.includes(ipv6Entry);
|
|
56953
57267
|
});
|
|
56954
57268
|
if (newEntries.length === 0) {
|
|
56955
|
-
debugLog2("hosts", "All hosts already exist in hosts file",
|
|
57269
|
+
debugLog2("hosts", "All hosts already exist in hosts file", verbose);
|
|
56956
57270
|
log.info("All hosts are already in the hosts file");
|
|
56957
57271
|
return;
|
|
56958
57272
|
}
|
|
56959
|
-
const hostEntries = newEntries.map((host) =>
|
|
57273
|
+
const hostEntries = newEntries.map((host) => `
|
|
57274
|
+
# Added by rpx
|
|
57275
|
+
127.0.0.1 ${host}
|
|
57276
|
+
::1 ${host}`).join(`
|
|
57277
|
+
`);
|
|
56960
57278
|
try {
|
|
56961
57279
|
await fs3.promises.appendFile(hostsFilePath, hostEntries, { flag: "a" });
|
|
56962
57280
|
log.success(`Added new hosts: ${newEntries.join(", ")}`);
|
|
56963
57281
|
} catch (writeErr) {
|
|
56964
57282
|
if (writeErr.code === "EACCES") {
|
|
56965
|
-
debugLog2("hosts", "Permission denied, attempting with sudo",
|
|
57283
|
+
debugLog2("hosts", "Permission denied, attempting with sudo", verbose);
|
|
56966
57284
|
try {
|
|
56967
57285
|
await sudoWrite("append", hostEntries);
|
|
56968
57286
|
log.success(`Added new hosts with sudo: ${newEntries.join(", ")}`);
|
|
56969
57287
|
} catch (sudoErr) {
|
|
56970
57288
|
log.error("Failed to modify hosts file automatically");
|
|
56971
57289
|
log.warn("Please add these entries to your hosts file manually:");
|
|
56972
|
-
hostEntries.split(
|
|
57290
|
+
hostEntries.split(`
|
|
57291
|
+
`).forEach((entry) => log.warn(entry));
|
|
56973
57292
|
if (process3.platform === "win32") {
|
|
56974
|
-
log.warn(
|
|
57293
|
+
log.warn(`
|
|
57294
|
+
On Windows:`);
|
|
56975
57295
|
log.warn("1. Run notepad as administrator");
|
|
56976
57296
|
log.warn("2. Open C:\\Windows\\System32\\drivers\\etc\\hosts");
|
|
56977
57297
|
} else {
|
|
56978
|
-
log.warn(
|
|
57298
|
+
log.warn(`
|
|
57299
|
+
On Unix systems:`);
|
|
56979
57300
|
log.warn(`sudo nano ${hostsFilePath}`);
|
|
56980
57301
|
}
|
|
56981
57302
|
throw new Error("Failed to modify hosts file: manual intervention required");
|
|
@@ -56990,11 +57311,12 @@ async function addHosts(hosts) {
|
|
|
56990
57311
|
throw error;
|
|
56991
57312
|
}
|
|
56992
57313
|
}
|
|
56993
|
-
async function removeHosts(hosts) {
|
|
56994
|
-
debugLog2("hosts", `Removing hosts: ${hosts.join(", ")}`,
|
|
57314
|
+
async function removeHosts(hosts, verbose) {
|
|
57315
|
+
debugLog2("hosts", `Removing hosts: ${hosts.join(", ")}`, verbose);
|
|
56995
57316
|
try {
|
|
56996
57317
|
const content = await fs3.promises.readFile(hostsFilePath, "utf-8");
|
|
56997
|
-
const lines = content.split(
|
|
57318
|
+
const lines = content.split(`
|
|
57319
|
+
`);
|
|
56998
57320
|
const filteredLines = lines.filter((line, index) => {
|
|
56999
57321
|
if (line.trim() === "# Added by rpx") {
|
|
57000
57322
|
lines.splice(index + 1, 2);
|
|
@@ -57004,13 +57326,15 @@ async function removeHosts(hosts) {
|
|
|
57004
57326
|
});
|
|
57005
57327
|
while (filteredLines[filteredLines.length - 1]?.trim() === "")
|
|
57006
57328
|
filteredLines.pop();
|
|
57007
|
-
const newContent = `${filteredLines.join(
|
|
57329
|
+
const newContent = `${filteredLines.join(`
|
|
57330
|
+
`)}
|
|
57331
|
+
`;
|
|
57008
57332
|
try {
|
|
57009
57333
|
await fs3.promises.writeFile(hostsFilePath, newContent);
|
|
57010
57334
|
log.success("Hosts removed successfully");
|
|
57011
57335
|
} catch (writeErr) {
|
|
57012
57336
|
if (writeErr.code === "EACCES") {
|
|
57013
|
-
debugLog2("hosts", "Permission denied, attempting with sudo",
|
|
57337
|
+
debugLog2("hosts", "Permission denied, attempting with sudo", verbose);
|
|
57014
57338
|
try {
|
|
57015
57339
|
await sudoWrite("write", newContent);
|
|
57016
57340
|
log.success("Hosts removed successfully with sudo");
|
|
@@ -57023,11 +57347,13 @@ async function removeHosts(hosts) {
|
|
|
57023
57347
|
log.warn(`::1 ${host}`);
|
|
57024
57348
|
});
|
|
57025
57349
|
if (process3.platform === "win32") {
|
|
57026
|
-
log.warn(
|
|
57350
|
+
log.warn(`
|
|
57351
|
+
On Windows:`);
|
|
57027
57352
|
log.warn("1. Run notepad as administrator");
|
|
57028
57353
|
log.warn("2. Open C:\\Windows\\System32\\drivers\\etc\\hosts");
|
|
57029
57354
|
} else {
|
|
57030
|
-
log.warn(
|
|
57355
|
+
log.warn(`
|
|
57356
|
+
On Unix systems:`);
|
|
57031
57357
|
log.warn(`sudo nano ${hostsFilePath}`);
|
|
57032
57358
|
}
|
|
57033
57359
|
throw new Error("Failed to modify hosts file: manual intervention required");
|
|
@@ -57042,8 +57368,8 @@ async function removeHosts(hosts) {
|
|
|
57042
57368
|
throw error;
|
|
57043
57369
|
}
|
|
57044
57370
|
}
|
|
57045
|
-
async function checkHosts(hosts) {
|
|
57046
|
-
debugLog2("hosts", `Checking hosts: ${hosts}`,
|
|
57371
|
+
async function checkHosts(hosts, verbose) {
|
|
57372
|
+
debugLog2("hosts", `Checking hosts: ${hosts}`, verbose);
|
|
57047
57373
|
const content = await fs3.promises.readFile(hostsFilePath, "utf-8");
|
|
57048
57374
|
return hosts.map((host) => {
|
|
57049
57375
|
const ipv4Entry = `127.0.0.1 ${host}`;
|
|
@@ -57054,44 +57380,39 @@ async function checkHosts(hosts) {
|
|
|
57054
57380
|
|
|
57055
57381
|
// src/start.ts
|
|
57056
57382
|
var activeServers = new Set;
|
|
57057
|
-
async function cleanup() {
|
|
57058
|
-
debugLog2("cleanup", "Starting cleanup process",
|
|
57059
|
-
console.log(
|
|
57383
|
+
async function cleanup(options3) {
|
|
57384
|
+
debugLog2("cleanup", "Starting cleanup process", options3?.verbose);
|
|
57385
|
+
console.log(`
|
|
57386
|
+
`);
|
|
57060
57387
|
log.info("Shutting down proxy servers...");
|
|
57061
57388
|
const cleanupPromises = [];
|
|
57062
57389
|
const serverClosePromises = Array.from(activeServers).map((server) => new Promise((resolve4) => {
|
|
57063
57390
|
server.close(() => {
|
|
57064
|
-
debugLog2("cleanup", "Server closed successfully",
|
|
57391
|
+
debugLog2("cleanup", "Server closed successfully", options3?.verbose);
|
|
57065
57392
|
resolve4();
|
|
57066
57393
|
});
|
|
57067
57394
|
}));
|
|
57068
57395
|
cleanupPromises.push(...serverClosePromises);
|
|
57069
|
-
if (
|
|
57070
|
-
debugLog2("cleanup", "Cleaning up hosts file entries",
|
|
57071
|
-
|
|
57072
|
-
|
|
57073
|
-
|
|
57074
|
-
|
|
57075
|
-
|
|
57076
|
-
|
|
57077
|
-
|
|
57078
|
-
|
|
57079
|
-
|
|
57080
|
-
log.warn(`Failed to clean up hosts file entry for ${hostname}:`, err3);
|
|
57081
|
-
}));
|
|
57082
|
-
}
|
|
57083
|
-
} catch (err3) {
|
|
57084
|
-
debugLog2("cleanup", `Error parsing URL during hosts cleanup: ${err3}`, config4.verbose);
|
|
57085
|
-
log.warn("Failed to parse URL for hosts cleanup:", err3);
|
|
57396
|
+
if (options3?.etcHostsCleanup && options3.domains?.length) {
|
|
57397
|
+
debugLog2("cleanup", "Cleaning up hosts file entries", options3?.verbose);
|
|
57398
|
+
const domainsToClean = options3.domains.filter((domain) => !domain.includes("localhost"));
|
|
57399
|
+
if (domainsToClean.length > 0) {
|
|
57400
|
+
log.info("Cleaning up hosts file entries...");
|
|
57401
|
+
cleanupPromises.push(removeHosts(domainsToClean, options3?.verbose).then(() => {
|
|
57402
|
+
debugLog2("cleanup", `Removed hosts entries for ${domainsToClean.join(", ")}`, options3?.verbose);
|
|
57403
|
+
}).catch((err3) => {
|
|
57404
|
+
debugLog2("cleanup", `Failed to remove hosts entries: ${err3}`, options3?.verbose);
|
|
57405
|
+
log.warn(`Failed to clean up hosts file entries for ${domainsToClean.join(", ")}:`, err3);
|
|
57406
|
+
}));
|
|
57086
57407
|
}
|
|
57087
57408
|
}
|
|
57088
57409
|
try {
|
|
57089
57410
|
await Promise.all(cleanupPromises);
|
|
57090
|
-
debugLog2("cleanup", "All cleanup tasks completed successfully",
|
|
57411
|
+
debugLog2("cleanup", "All cleanup tasks completed successfully", options3?.verbose);
|
|
57091
57412
|
log.success("All cleanup tasks completed successfully");
|
|
57092
57413
|
process9.exit(0);
|
|
57093
57414
|
} catch (err3) {
|
|
57094
|
-
debugLog2("cleanup", `Error during cleanup: ${err3}`,
|
|
57415
|
+
debugLog2("cleanup", `Error during cleanup: ${err3}`, options3?.verbose);
|
|
57095
57416
|
log.error("Error during cleanup:", err3);
|
|
57096
57417
|
process9.exit(1);
|
|
57097
57418
|
}
|
|
@@ -57099,14 +57420,14 @@ async function cleanup() {
|
|
|
57099
57420
|
process9.on("SIGINT", cleanup);
|
|
57100
57421
|
process9.on("SIGTERM", cleanup);
|
|
57101
57422
|
process9.on("uncaughtException", (err3) => {
|
|
57102
|
-
debugLog2("process", `Uncaught exception: ${err3}`,
|
|
57423
|
+
debugLog2("process", `Uncaught exception: ${err3}`, true);
|
|
57103
57424
|
log.error("Uncaught exception:", err3);
|
|
57104
57425
|
cleanup();
|
|
57105
57426
|
});
|
|
57106
57427
|
async function loadSSLConfig(options3) {
|
|
57107
|
-
debugLog2("ssl",
|
|
57428
|
+
debugLog2("ssl", `Loading SSL configuration`, options3.verbose);
|
|
57108
57429
|
if (options3.https === true)
|
|
57109
|
-
options3.https = httpsConfig();
|
|
57430
|
+
options3.https = httpsConfig(options3);
|
|
57110
57431
|
else if (options3.https === false)
|
|
57111
57432
|
return null;
|
|
57112
57433
|
if (!options3.https?.keyPath && !options3.https?.certPath) {
|
|
@@ -57128,22 +57449,12 @@ async function loadSSLConfig(options3) {
|
|
|
57128
57449
|
debugLog2("ssl", "SSL configuration loaded successfully", options3.verbose);
|
|
57129
57450
|
return { key, cert };
|
|
57130
57451
|
} catch (error) {
|
|
57131
|
-
|
|
57132
|
-
|
|
57133
|
-
await generateCertificate(options3.to);
|
|
57134
|
-
debugLog2("ssl", "Reading newly generated certificates", options3.verbose);
|
|
57135
|
-
const key = await fs5.promises.readFile(options3.https?.keyPath, "utf8");
|
|
57136
|
-
const cert = await fs5.promises.readFile(options3.https?.certPath, "utf8");
|
|
57137
|
-
debugLog2("ssl", "New SSL certificates loaded successfully", options3.verbose);
|
|
57138
|
-
return { key, cert };
|
|
57139
|
-
}
|
|
57140
|
-
throw error;
|
|
57452
|
+
debugLog2("ssl", `Failed to read certificates: ${error}`, options3.verbose);
|
|
57453
|
+
return null;
|
|
57141
57454
|
}
|
|
57142
57455
|
} catch (err3) {
|
|
57143
|
-
|
|
57144
|
-
|
|
57145
|
-
debugLog2("ssl", `SSL configuration error: ${error}`, options3.verbose);
|
|
57146
|
-
throw new Error(`SSL Configuration Error: ${detail}`);
|
|
57456
|
+
debugLog2("ssl", `SSL configuration error: ${err3}`, options3.verbose);
|
|
57457
|
+
throw err3;
|
|
57147
57458
|
}
|
|
57148
57459
|
}
|
|
57149
57460
|
function isPortInUse(port, hostname, verbose) {
|
|
@@ -57200,26 +57511,20 @@ async function testConnection(hostname, port, verbose) {
|
|
|
57200
57511
|
});
|
|
57201
57512
|
}
|
|
57202
57513
|
async function startServer(options3) {
|
|
57203
|
-
debugLog2("server", `Starting server with options: ${JSON.stringify(options3)}`, options3
|
|
57204
|
-
if (!options3)
|
|
57205
|
-
options3 = config4;
|
|
57206
|
-
if (!options3.from)
|
|
57207
|
-
options3.from = config4.from;
|
|
57208
|
-
if (!options3.to)
|
|
57209
|
-
options3.to = config4.to;
|
|
57514
|
+
debugLog2("server", `Starting server with options: ${JSON.stringify(options3)}`, options3.verbose);
|
|
57210
57515
|
const fromUrl = new URL(options3.from.startsWith("http") ? options3.from : `http://${options3.from}`);
|
|
57211
57516
|
const toUrl = new URL(options3.to.startsWith("http") ? options3.to : `http://${options3.to}`);
|
|
57212
57517
|
const fromPort = Number.parseInt(fromUrl.port) || (fromUrl.protocol.includes("https:") ? 443 : 80);
|
|
57213
57518
|
const hostsToCheck = [toUrl.hostname];
|
|
57214
57519
|
if (!toUrl.hostname.includes("localhost") && !toUrl.hostname.includes("127.0.0.1")) {
|
|
57215
|
-
debugLog2("hosts", `Checking if hosts file entry exists for: ${toUrl.hostname}`, options3
|
|
57520
|
+
debugLog2("hosts", `Checking if hosts file entry exists for: ${toUrl.hostname}`, options3?.verbose);
|
|
57216
57521
|
try {
|
|
57217
|
-
const hostsExist = await checkHosts(hostsToCheck);
|
|
57522
|
+
const hostsExist = await checkHosts(hostsToCheck, options3.verbose);
|
|
57218
57523
|
if (!hostsExist[0]) {
|
|
57219
57524
|
log.info(`Adding ${toUrl.hostname} to hosts file...`);
|
|
57220
57525
|
log.info("This may require sudo/administrator privileges");
|
|
57221
57526
|
try {
|
|
57222
|
-
await addHosts(hostsToCheck);
|
|
57527
|
+
await addHosts(hostsToCheck, options3.verbose);
|
|
57223
57528
|
} catch (addError) {
|
|
57224
57529
|
log.error("Failed to add hosts entry:", addError.message);
|
|
57225
57530
|
log.warn("You can manually add this entry to your hosts file:");
|
|
@@ -57241,17 +57546,6 @@ async function startServer(options3) {
|
|
|
57241
57546
|
log.error("Failed to check hosts file:", checkError.message);
|
|
57242
57547
|
}
|
|
57243
57548
|
}
|
|
57244
|
-
if (config4.https) {
|
|
57245
|
-
if (config4.https === true)
|
|
57246
|
-
config4.https = httpsConfig();
|
|
57247
|
-
const domain = toUrl.hostname;
|
|
57248
|
-
if (typeof options3.https !== "boolean" && options3.https) {
|
|
57249
|
-
options3.https.keyPath = config4.https.keyPath || path7.join(os8.homedir(), ".stacks", "ssl", `${domain}.crt.key`);
|
|
57250
|
-
options3.https.certPath = config4.https.certPath || path7.join(os8.homedir(), ".stacks", "ssl", `${domain}.crt`);
|
|
57251
|
-
debugLog2("server", `HTTPS enabled, using cert paths: ${options3.https.keyPath}, ${options3.https.certPath}`, options3.verbose);
|
|
57252
|
-
}
|
|
57253
|
-
}
|
|
57254
|
-
debugLog2("server", `Parsed URLs - from: ${fromUrl}, to: ${toUrl}`, options3.verbose);
|
|
57255
57549
|
try {
|
|
57256
57550
|
await testConnection(fromUrl.hostname, fromPort, options3.verbose);
|
|
57257
57551
|
} catch (err3) {
|
|
@@ -57259,16 +57553,48 @@ async function startServer(options3) {
|
|
|
57259
57553
|
log.error(err3.message);
|
|
57260
57554
|
process9.exit(1);
|
|
57261
57555
|
}
|
|
57262
|
-
let sslConfig = null;
|
|
57263
|
-
if (
|
|
57556
|
+
let sslConfig = options3._cachedSSLConfig || null;
|
|
57557
|
+
if (options3.https) {
|
|
57264
57558
|
try {
|
|
57265
|
-
|
|
57559
|
+
if (options3.https === true) {
|
|
57560
|
+
options3.https = httpsConfig({
|
|
57561
|
+
...options3,
|
|
57562
|
+
to: toUrl.hostname
|
|
57563
|
+
});
|
|
57564
|
+
}
|
|
57565
|
+
try {
|
|
57566
|
+
debugLog2("ssl", `Attempting to load SSL configuration for ${toUrl.hostname}`, options3.verbose);
|
|
57567
|
+
sslConfig = await loadSSLConfig({
|
|
57568
|
+
...options3,
|
|
57569
|
+
to: toUrl.hostname,
|
|
57570
|
+
https: options3.https
|
|
57571
|
+
});
|
|
57572
|
+
} catch (loadError) {
|
|
57573
|
+
debugLog2("ssl", `Failed to load certificates, will generate new ones: ${loadError}`, options3.verbose);
|
|
57574
|
+
}
|
|
57575
|
+
if (!sslConfig) {
|
|
57576
|
+
debugLog2("ssl", `Generating new certificates for ${toUrl.hostname}`, options3.verbose);
|
|
57577
|
+
await generateCertificate2({
|
|
57578
|
+
...options3,
|
|
57579
|
+
from: fromUrl.toString(),
|
|
57580
|
+
to: toUrl.hostname,
|
|
57581
|
+
https: options3.https
|
|
57582
|
+
});
|
|
57583
|
+
sslConfig = await loadSSLConfig({
|
|
57584
|
+
...options3,
|
|
57585
|
+
to: toUrl.hostname,
|
|
57586
|
+
https: options3.https
|
|
57587
|
+
});
|
|
57588
|
+
if (!sslConfig) {
|
|
57589
|
+
throw new Error(`Failed to load SSL configuration after generating certificates for ${toUrl.hostname}`);
|
|
57590
|
+
}
|
|
57591
|
+
}
|
|
57266
57592
|
} catch (err3) {
|
|
57267
|
-
debugLog2("server", `SSL
|
|
57268
|
-
|
|
57269
|
-
sslConfig = await loadSSLConfig(options3);
|
|
57593
|
+
debugLog2("server", `SSL setup failed: ${err3}`, options3.verbose);
|
|
57594
|
+
throw err3;
|
|
57270
57595
|
}
|
|
57271
57596
|
}
|
|
57597
|
+
debugLog2("server", `Setting up reverse proxy with SSL config for ${toUrl.hostname}`, options3.verbose);
|
|
57272
57598
|
await setupReverseProxy({
|
|
57273
57599
|
...options3,
|
|
57274
57600
|
from: options3.from,
|
|
@@ -57373,37 +57699,43 @@ async function createProxyServer(from, to, fromPort, listenPort, hostname, sourc
|
|
|
57373
57699
|
}
|
|
57374
57700
|
async function setupReverseProxy(options3) {
|
|
57375
57701
|
debugLog2("setup", `Setting up reverse proxy: ${JSON.stringify(options3)}`, options3.verbose);
|
|
57376
|
-
const { from, to, fromPort, sourceUrl, ssl, verbose } = options3;
|
|
57702
|
+
const { from, to, fromPort, sourceUrl, ssl, verbose, etcHostsCleanup, portManager } = options3;
|
|
57377
57703
|
const httpPort = 80;
|
|
57378
57704
|
const httpsPort = 443;
|
|
57379
57705
|
const hostname = "0.0.0.0";
|
|
57380
57706
|
try {
|
|
57381
|
-
if (ssl) {
|
|
57707
|
+
if (ssl && !portManager?.usedPorts.has(httpPort)) {
|
|
57382
57708
|
const isHttpPortBusy = await isPortInUse(httpPort, hostname, verbose);
|
|
57383
57709
|
if (!isHttpPortBusy) {
|
|
57384
57710
|
debugLog2("setup", "Starting HTTP redirect server", verbose);
|
|
57385
57711
|
startHttpRedirectServer(verbose);
|
|
57712
|
+
portManager?.usedPorts.add(httpPort);
|
|
57386
57713
|
} else {
|
|
57387
57714
|
debugLog2("setup", "Port 80 is in use, skipping HTTP redirect", verbose);
|
|
57388
57715
|
log.warn("Port 80 is in use, HTTP to HTTPS redirect will not be available");
|
|
57389
57716
|
}
|
|
57390
57717
|
}
|
|
57391
57718
|
const targetPort = ssl ? httpsPort : httpPort;
|
|
57392
|
-
|
|
57393
|
-
if (
|
|
57394
|
-
|
|
57395
|
-
const availablePort = await findAvailablePort(ssl ? 8443 : 8080, hostname, verbose);
|
|
57396
|
-
log.warn(`Port ${targetPort} is in use. Using port ${availablePort} instead.`);
|
|
57397
|
-
log.info(`You can use 'sudo lsof -i :${targetPort}' (Unix) or 'netstat -ano | findstr :${targetPort}' (Windows) to check what's using the port.`);
|
|
57398
|
-
await createProxyServer(from, to, fromPort, availablePort, hostname, sourceUrl, ssl, verbose);
|
|
57719
|
+
let finalPort;
|
|
57720
|
+
if (portManager) {
|
|
57721
|
+
finalPort = await portManager.getNextAvailablePort(targetPort);
|
|
57399
57722
|
} else {
|
|
57400
|
-
|
|
57401
|
-
await
|
|
57723
|
+
const isTargetPortBusy = await isPortInUse(targetPort, hostname, verbose);
|
|
57724
|
+
finalPort = isTargetPortBusy ? await findAvailablePort(ssl ? 8443 : 8080, hostname, verbose) : targetPort;
|
|
57402
57725
|
}
|
|
57726
|
+
if (finalPort !== targetPort) {
|
|
57727
|
+
log.warn(`Port ${targetPort} is in use. Using port ${finalPort} instead.`);
|
|
57728
|
+
log.info(`You can use 'sudo lsof -i :${targetPort}' (Unix) or 'netstat -ano | findstr :${targetPort}' (Windows) to check what's using the port.`);
|
|
57729
|
+
}
|
|
57730
|
+
await createProxyServer(from, to, fromPort, finalPort, hostname, sourceUrl, ssl, verbose);
|
|
57403
57731
|
} catch (err3) {
|
|
57404
57732
|
debugLog2("setup", `Setup failed: ${err3}`, verbose);
|
|
57405
57733
|
log.error(`Failed to setup reverse proxy: ${err3.message}`);
|
|
57406
|
-
cleanup(
|
|
57734
|
+
cleanup({
|
|
57735
|
+
domains: [to],
|
|
57736
|
+
etcHostsCleanup,
|
|
57737
|
+
verbose
|
|
57738
|
+
});
|
|
57407
57739
|
}
|
|
57408
57740
|
}
|
|
57409
57741
|
function startHttpRedirectServer(verbose) {
|
|
@@ -57420,52 +57752,87 @@ function startHttpRedirectServer(verbose) {
|
|
|
57420
57752
|
debugLog2("redirect", "HTTP redirect server started", verbose);
|
|
57421
57753
|
}
|
|
57422
57754
|
function startProxy(options3) {
|
|
57423
|
-
|
|
57424
|
-
|
|
57425
|
-
|
|
57426
|
-
|
|
57427
|
-
|
|
57428
|
-
|
|
57429
|
-
|
|
57430
|
-
|
|
57431
|
-
|
|
57432
|
-
startServer(
|
|
57433
|
-
debugLog2("proxy", `Failed to start proxy: ${err3}`,
|
|
57755
|
+
debugLog2("proxy", `Starting proxy with options: ${JSON.stringify(options3)}`, options3?.verbose);
|
|
57756
|
+
const serverOptions = {
|
|
57757
|
+
from: options3?.from || "localhost:5173",
|
|
57758
|
+
to: options3?.to || "stacks.localhost",
|
|
57759
|
+
https: httpsConfig(options3),
|
|
57760
|
+
etcHostsCleanup: options3?.etcHostsCleanup || false,
|
|
57761
|
+
verbose: options3?.verbose || false
|
|
57762
|
+
};
|
|
57763
|
+
console.log("serverOptions", serverOptions);
|
|
57764
|
+
startServer(serverOptions).catch((err3) => {
|
|
57765
|
+
debugLog2("proxy", `Failed to start proxy: ${err3}`, options3.verbose);
|
|
57434
57766
|
log.error(`Failed to start proxy: ${err3.message}`);
|
|
57435
|
-
cleanup(
|
|
57767
|
+
cleanup({
|
|
57768
|
+
domains: [options3.to],
|
|
57769
|
+
etcHostsCleanup: options3.etcHostsCleanup,
|
|
57770
|
+
verbose: options3.verbose
|
|
57771
|
+
});
|
|
57436
57772
|
});
|
|
57437
57773
|
}
|
|
57438
|
-
function startProxies(options3) {
|
|
57439
|
-
if (
|
|
57440
|
-
|
|
57441
|
-
|
|
57442
|
-
|
|
57443
|
-
|
|
57444
|
-
|
|
57445
|
-
|
|
57446
|
-
|
|
57447
|
-
|
|
57448
|
-
|
|
57449
|
-
|
|
57450
|
-
|
|
57451
|
-
|
|
57452
|
-
|
|
57774
|
+
async function startProxies(options3) {
|
|
57775
|
+
if (!options3)
|
|
57776
|
+
return;
|
|
57777
|
+
debugLog2("proxies", "Starting proxies setup", isMultiProxyConfig2(options3) ? options3.verbose : options3.verbose);
|
|
57778
|
+
if (options3.https) {
|
|
57779
|
+
await generateCertificate2(options3);
|
|
57780
|
+
}
|
|
57781
|
+
const proxyOptions = isMultiProxyConfig2(options3) ? options3.proxies.map((proxy) => ({
|
|
57782
|
+
...proxy,
|
|
57783
|
+
https: options3.https,
|
|
57784
|
+
etcHostsCleanup: options3.etcHostsCleanup,
|
|
57785
|
+
verbose: options3.verbose,
|
|
57786
|
+
_cachedSSLConfig: options3._cachedSSLConfig
|
|
57787
|
+
})) : [options3];
|
|
57788
|
+
const domains = extractDomains(options3);
|
|
57789
|
+
const sslConfig = options3.https ? getSSLConfig() : null;
|
|
57790
|
+
const cleanupHandler = () => cleanup({
|
|
57791
|
+
domains,
|
|
57792
|
+
etcHostsCleanup: isMultiProxyConfig2(options3) ? options3.etcHostsCleanup : options3.etcHostsCleanup || false,
|
|
57793
|
+
verbose: isMultiProxyConfig2(options3) ? options3.verbose : options3.verbose || false
|
|
57794
|
+
});
|
|
57795
|
+
process9.on("SIGINT", cleanupHandler);
|
|
57796
|
+
process9.on("SIGTERM", cleanupHandler);
|
|
57797
|
+
process9.on("uncaughtException", (err3) => {
|
|
57798
|
+
debugLog2("process", `Uncaught exception: ${err3}`, true);
|
|
57799
|
+
log.error("Uncaught exception:", err3);
|
|
57800
|
+
cleanupHandler();
|
|
57801
|
+
});
|
|
57802
|
+
for (const option of proxyOptions) {
|
|
57803
|
+
try {
|
|
57804
|
+
const domain = option.to || "stacks.localhost";
|
|
57805
|
+
debugLog2("proxy", `Starting proxy for ${domain} with SSL config: ${!!sslConfig}`, option.verbose);
|
|
57806
|
+
await startServer({
|
|
57807
|
+
from: option.from || "localhost:5173",
|
|
57808
|
+
to: domain,
|
|
57809
|
+
https: option.https ?? false,
|
|
57810
|
+
etcHostsCleanup: option.etcHostsCleanup || false,
|
|
57811
|
+
verbose: option.verbose || false,
|
|
57812
|
+
_cachedSSLConfig: sslConfig
|
|
57813
|
+
});
|
|
57814
|
+
} catch (err3) {
|
|
57815
|
+
debugLog2("proxies", `Failed to start proxy for ${option.to}: ${err3}`, option.verbose);
|
|
57816
|
+
log.error(`Failed to start proxy for ${option.to}:`, err3);
|
|
57817
|
+
cleanupHandler();
|
|
57818
|
+
}
|
|
57453
57819
|
}
|
|
57454
57820
|
}
|
|
57821
|
+
function isMultiProxyConfig2(options3) {
|
|
57822
|
+
return "proxies" in options3;
|
|
57823
|
+
}
|
|
57455
57824
|
|
|
57456
57825
|
// bin/cli.ts
|
|
57457
57826
|
var cli = new CAC("reverse-proxy");
|
|
57458
|
-
cli.command("start", "Start the Reverse Proxy Server").option("--from <from>", "The URL to proxy from"
|
|
57459
|
-
|
|
57460
|
-
|
|
57461
|
-
|
|
57462
|
-
|
|
57463
|
-
|
|
57464
|
-
};
|
|
57465
|
-
startProxy({
|
|
57827
|
+
cli.command("start", "Start the Reverse Proxy Server").option("--from <from>", "The URL to proxy from").option("--to <to>", "The URL to proxy to").option("--key-path <path>", "Absolute path to the SSL key").option("--cert-path <path>", "Absolute path to the SSL certificate").option("--ca-cert-path <path>", "Absolute path to the SSL CA certificate").option("--etc-hosts-cleanup", "Cleanup /etc/hosts on exit").option("--verbose", "Enable verbose logging").example("reverse-proxy start --from localhost:5173 --to my-project.localhost").example("reverse-proxy start --from localhost:3000 --to my-project.localhost/api").example("reverse-proxy start --from localhost:3000 --to localhost:3001").example("reverse-proxy start --from localhost:5173 --to my-project.test --key-path /absolute/path/to/key --cert-path /absolute/path/to/cert").action(async (options3) => {
|
|
57828
|
+
if (!options3?.from || !options3.to) {
|
|
57829
|
+
console.log("in here", config4);
|
|
57830
|
+
return startProxies(config4);
|
|
57831
|
+
}
|
|
57832
|
+
return startProxy({
|
|
57466
57833
|
from: options3?.from,
|
|
57467
57834
|
to: options3?.to,
|
|
57468
|
-
https:
|
|
57835
|
+
https: httpsConfig(options3),
|
|
57469
57836
|
etcHostsCleanup: options3?.etcHostsCleanup,
|
|
57470
57837
|
verbose: options3?.verbose
|
|
57471
57838
|
});
|