@stacksjs/rpx 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -5
- package/dist/cli.js +1008 -641
- package/dist/config.d.ts +2 -2
- package/dist/hosts.d.ts +3 -3
- package/dist/https.d.ts +9 -3
- package/dist/index.js +1234 -862
- package/dist/start.d.ts +6 -5
- package/dist/types.d.ts +34 -4
- package/dist/utils.d.ts +4 -4
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -23,26 +23,40 @@ import path from "path";
|
|
|
23
23
|
// node_modules/bun-config/dist/index.js
|
|
24
24
|
import { resolve } from "path";
|
|
25
25
|
import process2 from "process";
|
|
26
|
-
function deepMerge(target,
|
|
27
|
-
if (!
|
|
28
|
-
return
|
|
29
|
-
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
function deepMerge(target, source) {
|
|
27
|
+
if (Array.isArray(source) && !Array.isArray(target)) {
|
|
28
|
+
return source;
|
|
29
|
+
}
|
|
30
|
+
if (Array.isArray(source) && Array.isArray(target)) {
|
|
31
|
+
return source.map((sourceItem, index) => {
|
|
32
|
+
const targetItem = target[index];
|
|
33
|
+
if (isObject(sourceItem) && isObject(targetItem)) {
|
|
34
|
+
return deepMerge(targetItem, sourceItem);
|
|
35
|
+
}
|
|
36
|
+
return sourceItem;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
if (!isObject(source) || !isObject(target)) {
|
|
40
|
+
return source;
|
|
41
|
+
}
|
|
42
|
+
const merged = { ...target };
|
|
43
|
+
for (const key in source) {
|
|
44
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
45
|
+
const sourceValue = source[key];
|
|
46
|
+
const targetValue = merged[key];
|
|
47
|
+
if (sourceValue === null || sourceValue === undefined) {
|
|
48
|
+
merged[key] = sourceValue;
|
|
49
|
+
} else if (isObject(sourceValue) && isObject(targetValue)) {
|
|
50
|
+
merged[key] = deepMerge(targetValue, sourceValue);
|
|
51
|
+
} else {
|
|
52
|
+
merged[key] = sourceValue;
|
|
39
53
|
}
|
|
40
54
|
}
|
|
41
55
|
}
|
|
42
|
-
return
|
|
56
|
+
return merged;
|
|
43
57
|
}
|
|
44
58
|
function isObject(item) {
|
|
45
|
-
return item && typeof item === "object" && !Array.isArray(item);
|
|
59
|
+
return Boolean(item && typeof item === "object" && !Array.isArray(item));
|
|
46
60
|
}
|
|
47
61
|
async function loadConfig({ name, cwd, defaultConfig }) {
|
|
48
62
|
const configPath = resolve(cwd || process2.cwd(), `${name}.config`);
|
|
@@ -62,30 +76,19 @@ var config = await loadConfig({
|
|
|
62
76
|
from: "localhost:5173",
|
|
63
77
|
to: "stacks.localhost",
|
|
64
78
|
https: {
|
|
65
|
-
domain: "stacks.localhost",
|
|
66
|
-
hostCertCN: "stacks.localhost",
|
|
67
79
|
caCertPath: path.join(os.homedir(), ".stacks", "ssl", `stacks.localhost.ca.crt`),
|
|
68
80
|
certPath: path.join(os.homedir(), ".stacks", "ssl", `stacks.localhost.crt`),
|
|
69
|
-
keyPath: path.join(os.homedir(), ".stacks", "ssl", `stacks.localhost.crt.key`)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
organizationName: "stacksjs.org",
|
|
73
|
-
countryName: "US",
|
|
74
|
-
stateName: "California",
|
|
75
|
-
localityName: "Playa Vista",
|
|
76
|
-
commonName: "stacks.localhost",
|
|
77
|
-
validityDays: 180,
|
|
78
|
-
verbose: false
|
|
79
|
-
},
|
|
80
|
-
etcHostsCleanup: false,
|
|
81
|
+
keyPath: path.join(os.homedir(), ".stacks", "ssl", `stacks.localhost.crt.key`)
|
|
82
|
+
},
|
|
83
|
+
etcHostsCleanup: true,
|
|
81
84
|
verbose: true
|
|
82
85
|
}
|
|
83
86
|
});
|
|
84
87
|
// src/hosts.ts
|
|
85
88
|
import { spawn } from "child_process";
|
|
86
|
-
import
|
|
87
|
-
import
|
|
88
|
-
import
|
|
89
|
+
import fs3 from "fs";
|
|
90
|
+
import os7 from "os";
|
|
91
|
+
import path6 from "path";
|
|
89
92
|
import process3 from "process";
|
|
90
93
|
|
|
91
94
|
// node_modules/@stacksjs/cli/dist/index.js
|
|
@@ -395,9 +398,12 @@ class Consola {
|
|
|
395
398
|
}
|
|
396
399
|
if (logObj.additional) {
|
|
397
400
|
if (!Array.isArray(logObj.additional)) {
|
|
398
|
-
logObj.additional = logObj.additional.split(
|
|
401
|
+
logObj.additional = logObj.additional.split(`
|
|
402
|
+
`);
|
|
399
403
|
}
|
|
400
|
-
logObj.args.push(
|
|
404
|
+
logObj.args.push(`
|
|
405
|
+
` + logObj.additional.join(`
|
|
406
|
+
`));
|
|
401
407
|
delete logObj.additional;
|
|
402
408
|
}
|
|
403
409
|
logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
|
|
@@ -542,7 +548,8 @@ var init_core = __esm(() => {
|
|
|
542
548
|
});
|
|
543
549
|
function parseStack(stack) {
|
|
544
550
|
const cwd = process.cwd() + sep;
|
|
545
|
-
const lines = stack.split(
|
|
551
|
+
const lines = stack.split(`
|
|
552
|
+
`).splice(1).map((l2) => l2.trim().replace("file://", "").replace(cwd, ""));
|
|
546
553
|
return lines;
|
|
547
554
|
}
|
|
548
555
|
function writeStream(data, stream) {
|
|
@@ -552,12 +559,14 @@ function writeStream(data, stream) {
|
|
|
552
559
|
|
|
553
560
|
class BasicReporter {
|
|
554
561
|
formatStack(stack, opts) {
|
|
555
|
-
return " " + parseStack(stack).join(
|
|
562
|
+
return " " + parseStack(stack).join(`
|
|
563
|
+
`);
|
|
556
564
|
}
|
|
557
565
|
formatArgs(args, opts) {
|
|
558
566
|
const _args = args.map((arg) => {
|
|
559
567
|
if (arg && typeof arg.stack === "string") {
|
|
560
|
-
return arg.message +
|
|
568
|
+
return arg.message + `
|
|
569
|
+
` + this.formatStack(arg.stack, opts);
|
|
561
570
|
}
|
|
562
571
|
return arg;
|
|
563
572
|
});
|
|
@@ -572,11 +581,15 @@ class BasicReporter {
|
|
|
572
581
|
formatLogObj(logObj, opts) {
|
|
573
582
|
const message = this.formatArgs(logObj.args, opts);
|
|
574
583
|
if (logObj.type === "box") {
|
|
575
|
-
return
|
|
584
|
+
return `
|
|
585
|
+
` + [
|
|
576
586
|
bracket(logObj.tag),
|
|
577
587
|
logObj.title && logObj.title,
|
|
578
|
-
...message.split(
|
|
579
|
-
|
|
588
|
+
...message.split(`
|
|
589
|
+
`)
|
|
590
|
+
].filter(Boolean).map((l2) => " > " + l2).join(`
|
|
591
|
+
`) + `
|
|
592
|
+
`;
|
|
580
593
|
}
|
|
581
594
|
return this.filterAndJoin([
|
|
582
595
|
bracket(logObj.type),
|
|
@@ -589,7 +602,8 @@ class BasicReporter {
|
|
|
589
602
|
columns: ctx.options.stdout.columns || 0,
|
|
590
603
|
...ctx.options.formatOptions
|
|
591
604
|
});
|
|
592
|
-
return writeStream(line +
|
|
605
|
+
return writeStream(line + `
|
|
606
|
+
`, logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout);
|
|
593
607
|
}
|
|
594
608
|
}
|
|
595
609
|
var bracket = (x2) => x2 ? `[${x2}]` : "";
|
|
@@ -624,7 +638,8 @@ function box(text, _opts = {}) {
|
|
|
624
638
|
..._opts.style
|
|
625
639
|
}
|
|
626
640
|
};
|
|
627
|
-
const textLines = text.split(
|
|
641
|
+
const textLines = text.split(`
|
|
642
|
+
`);
|
|
628
643
|
const boxLines = [];
|
|
629
644
|
const _color = getColor(opts.style.borderColor);
|
|
630
645
|
const borderStyle = {
|
|
@@ -665,7 +680,8 @@ function box(text, _opts = {}) {
|
|
|
665
680
|
if (opts.style.marginBottom > 0) {
|
|
666
681
|
boxLines.push("".repeat(opts.style.marginBottom));
|
|
667
682
|
}
|
|
668
|
-
return boxLines.join(
|
|
683
|
+
return boxLines.join(`
|
|
684
|
+
`);
|
|
669
685
|
}
|
|
670
686
|
var env2;
|
|
671
687
|
var argv;
|
|
@@ -953,7 +969,7 @@ class h2 {
|
|
|
953
969
|
}
|
|
954
970
|
this.state !== "error" && (this.state = "submit");
|
|
955
971
|
}
|
|
956
|
-
u === "
|
|
972
|
+
u === "\x03" && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
957
973
|
}
|
|
958
974
|
close() {
|
|
959
975
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
@@ -1224,7 +1240,8 @@ ${colors.yellow(S_BAR_END)} ${colors.yellow(this.error)}
|
|
|
1224
1240
|
return `${title}${colors.gray(S_BAR)} ${colors.dim(this.value || opts.placeholder)}`;
|
|
1225
1241
|
}
|
|
1226
1242
|
case "cancel": {
|
|
1227
|
-
return `${title}${colors.gray(S_BAR)} ${colors.strikethrough(colors.dim(this.value ?? ""))}${this.value?.trim() ?
|
|
1243
|
+
return `${title}${colors.gray(S_BAR)} ${colors.strikethrough(colors.dim(this.value ?? ""))}${this.value?.trim() ? `
|
|
1244
|
+
` + colors.gray(S_BAR) : ""}`;
|
|
1228
1245
|
}
|
|
1229
1246
|
default: {
|
|
1230
1247
|
return `${title}${colors.cyan(S_BAR)} ${value}
|
|
@@ -1352,7 +1369,9 @@ ${symbol(this.state)} ${opts.message}
|
|
|
1352
1369
|
${colors.gray(S_BAR)}` : ""}`;
|
|
1353
1370
|
}
|
|
1354
1371
|
case "error": {
|
|
1355
|
-
const footer = this.error.split(
|
|
1372
|
+
const footer = this.error.split(`
|
|
1373
|
+
`).map((ln, i) => i === 0 ? `${colors.yellow(S_BAR_END)} ${colors.yellow(ln)}` : ` ${ln}`).join(`
|
|
1374
|
+
`);
|
|
1356
1375
|
return title + colors.yellow(S_BAR) + " " + this.options.map((option, i) => {
|
|
1357
1376
|
const selected = this.value.includes(option.value);
|
|
1358
1377
|
const active = i === this.cursor;
|
|
@@ -1364,7 +1383,9 @@ ${colors.gray(S_BAR)}` : ""}`;
|
|
|
1364
1383
|
}
|
|
1365
1384
|
return opt(option, active ? "active" : "inactive");
|
|
1366
1385
|
}).join(`
|
|
1367
|
-
${colors.yellow(S_BAR)} `) +
|
|
1386
|
+
${colors.yellow(S_BAR)} `) + `
|
|
1387
|
+
` + footer + `
|
|
1388
|
+
`;
|
|
1368
1389
|
}
|
|
1369
1390
|
default: {
|
|
1370
1391
|
return `${title}${colors.cyan(S_BAR)} ${this.options.map((option, i) => {
|
|
@@ -1926,7 +1947,9 @@ var init_consola_36c0034f = __esm(() => {
|
|
|
1926
1947
|
};
|
|
1927
1948
|
FancyReporter = class FancyReporter2 extends BasicReporter {
|
|
1928
1949
|
formatStack(stack) {
|
|
1929
|
-
return
|
|
1950
|
+
return `
|
|
1951
|
+
` + parseStack(stack).map((line) => " " + line.replace(/^at +/, (m2) => colors.gray(m2)).replace(/\((.+)\)/, (_2, m2) => `(${colors.cyan(m2)})`)).join(`
|
|
1952
|
+
`);
|
|
1930
1953
|
}
|
|
1931
1954
|
formatType(logObj, isBadge, opts) {
|
|
1932
1955
|
const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
|
|
@@ -1937,9 +1960,12 @@ var init_consola_36c0034f = __esm(() => {
|
|
|
1937
1960
|
return _type ? getColor2(typeColor)(_type) : "";
|
|
1938
1961
|
}
|
|
1939
1962
|
formatLogObj(logObj, opts) {
|
|
1940
|
-
const [message, ...additional] = this.formatArgs(logObj.args, opts).split(
|
|
1963
|
+
const [message, ...additional] = this.formatArgs(logObj.args, opts).split(`
|
|
1964
|
+
`);
|
|
1941
1965
|
if (logObj.type === "box") {
|
|
1942
|
-
return box(characterFormat(message + (additional.length > 0 ?
|
|
1966
|
+
return box(characterFormat(message + (additional.length > 0 ? `
|
|
1967
|
+
` + additional.join(`
|
|
1968
|
+
`) : "")), {
|
|
1943
1969
|
title: logObj.title ? characterFormat(logObj.title) : undefined,
|
|
1944
1970
|
style: logObj.style
|
|
1945
1971
|
});
|
|
@@ -1954,12 +1980,16 @@ var init_consola_36c0034f = __esm(() => {
|
|
|
1954
1980
|
const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
|
|
1955
1981
|
const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
|
|
1956
1982
|
line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
|
|
1957
|
-
line += characterFormat(additional.length > 0 ?
|
|
1983
|
+
line += characterFormat(additional.length > 0 ? `
|
|
1984
|
+
` + additional.join(`
|
|
1985
|
+
`) : "");
|
|
1958
1986
|
if (logObj.type === "trace") {
|
|
1959
1987
|
const _err = new Error("Trace: " + logObj.message);
|
|
1960
1988
|
line += this.formatStack(_err.stack || "");
|
|
1961
1989
|
}
|
|
1962
|
-
return isBadge ?
|
|
1990
|
+
return isBadge ? `
|
|
1991
|
+
` + line + `
|
|
1992
|
+
` : line;
|
|
1963
1993
|
}
|
|
1964
1994
|
};
|
|
1965
1995
|
consola = createConsola2();
|
|
@@ -2179,7 +2209,8 @@ var require_isURL = __commonJS((exports, module) => {
|
|
|
2179
2209
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
2180
2210
|
}
|
|
2181
2211
|
function _nonIterableRest() {
|
|
2182
|
-
throw new TypeError(
|
|
2212
|
+
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2213
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
2183
2214
|
}
|
|
2184
2215
|
function _unsupportedIterableToArray(o, minLen) {
|
|
2185
2216
|
if (!o)
|
|
@@ -2637,7 +2668,7 @@ var require_isEmail = __commonJS((exports, module) => {
|
|
|
2637
2668
|
if (display_name_without_quotes === display_name) {
|
|
2638
2669
|
return false;
|
|
2639
2670
|
}
|
|
2640
|
-
var all_start_with_back_slash = display_name_without_quotes.split('"').length === display_name_without_quotes.split(
|
|
2671
|
+
var all_start_with_back_slash = display_name_without_quotes.split('"').length === display_name_without_quotes.split("\\\"").length;
|
|
2641
2672
|
if (!all_start_with_back_slash) {
|
|
2642
2673
|
return false;
|
|
2643
2674
|
}
|
|
@@ -4302,7 +4333,8 @@ var require_clear = __commonJS((exports, module) => {
|
|
|
4302
4333
|
throw _e;
|
|
4303
4334
|
}, f: F };
|
|
4304
4335
|
}
|
|
4305
|
-
throw new TypeError(
|
|
4336
|
+
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
4337
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
4306
4338
|
}
|
|
4307
4339
|
var normalCompletion = true, didErr = false, err2;
|
|
4308
4340
|
return { s: function s() {
|
|
@@ -4459,7 +4491,9 @@ var require_wrap = __commonJS((exports, module) => {
|
|
|
4459
4491
|
else
|
|
4460
4492
|
arr.push(`${tab}${w2}`);
|
|
4461
4493
|
return arr;
|
|
4462
|
-
}, [tab]).join(
|
|
4494
|
+
}, [tab]).join(`
|
|
4495
|
+
`)).join(`
|
|
4496
|
+
`);
|
|
4463
4497
|
};
|
|
4464
4498
|
});
|
|
4465
4499
|
var require_entriesToDisplay = __commonJS((exports, module) => {
|
|
@@ -4640,7 +4674,8 @@ var require_text = __commonJS((exports, module) => {
|
|
|
4640
4674
|
this.red = false;
|
|
4641
4675
|
this.fire();
|
|
4642
4676
|
this.render();
|
|
4643
|
-
this.out.write(
|
|
4677
|
+
this.out.write(`
|
|
4678
|
+
`);
|
|
4644
4679
|
this.close();
|
|
4645
4680
|
}
|
|
4646
4681
|
validate() {
|
|
@@ -4671,7 +4706,8 @@ var require_text = __commonJS((exports, module) => {
|
|
|
4671
4706
|
_this2.aborted = false;
|
|
4672
4707
|
_this2.fire();
|
|
4673
4708
|
_this2.render();
|
|
4674
|
-
_this2.out.write(
|
|
4709
|
+
_this2.out.write(`
|
|
4710
|
+
`);
|
|
4675
4711
|
_this2.close();
|
|
4676
4712
|
})();
|
|
4677
4713
|
}
|
|
@@ -4764,7 +4800,9 @@ var require_text = __commonJS((exports, module) => {
|
|
|
4764
4800
|
this.outputError = "";
|
|
4765
4801
|
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(` `);
|
|
4766
4802
|
if (this.error) {
|
|
4767
|
-
this.outputError += this.errorMsg.split(
|
|
4803
|
+
this.outputError += this.errorMsg.split(`
|
|
4804
|
+
`).reduce((a, l3, i) => a + `
|
|
4805
|
+
${i ? " " : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
4768
4806
|
}
|
|
4769
4807
|
this.out.write(erase2.line + cursor2.to(0) + this.outputText + cursor2.save + this.outputError + cursor2.restore + cursor2.move(this.cursorOffset, 0));
|
|
4770
4808
|
}
|
|
@@ -4826,7 +4864,8 @@ var require_select = __commonJS((exports, module) => {
|
|
|
4826
4864
|
this.done = this.aborted = true;
|
|
4827
4865
|
this.fire();
|
|
4828
4866
|
this.render();
|
|
4829
|
-
this.out.write(
|
|
4867
|
+
this.out.write(`
|
|
4868
|
+
`);
|
|
4830
4869
|
this.close();
|
|
4831
4870
|
}
|
|
4832
4871
|
submit() {
|
|
@@ -4835,7 +4874,8 @@ var require_select = __commonJS((exports, module) => {
|
|
|
4835
4874
|
this.aborted = false;
|
|
4836
4875
|
this.fire();
|
|
4837
4876
|
this.render();
|
|
4838
|
-
this.out.write(
|
|
4877
|
+
this.out.write(`
|
|
4878
|
+
`);
|
|
4839
4879
|
this.close();
|
|
4840
4880
|
} else
|
|
4841
4881
|
this.bell();
|
|
@@ -4886,7 +4926,8 @@ var require_select = __commonJS((exports, module) => {
|
|
|
4886
4926
|
let _entriesToDisplay = entriesToDisplay(this.cursor, this.choices.length, this.optionsPerPage), startIndex = _entriesToDisplay.startIndex, endIndex = _entriesToDisplay.endIndex;
|
|
4887
4927
|
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(" ");
|
|
4888
4928
|
if (!this.done) {
|
|
4889
|
-
this.outputText +=
|
|
4929
|
+
this.outputText += `
|
|
4930
|
+
`;
|
|
4890
4931
|
for (let i = startIndex;i < endIndex; i++) {
|
|
4891
4932
|
let title, prefix, desc = "", v2 = this.choices[i];
|
|
4892
4933
|
if (i === startIndex && startIndex > 0) {
|
|
@@ -4905,14 +4946,16 @@ var require_select = __commonJS((exports, module) => {
|
|
|
4905
4946
|
if (v2.description && this.cursor === i) {
|
|
4906
4947
|
desc = ` - ${v2.description}`;
|
|
4907
4948
|
if (prefix.length + title.length + desc.length >= this.out.columns || v2.description.split(/\r?\n/).length > 1) {
|
|
4908
|
-
desc =
|
|
4949
|
+
desc = `
|
|
4950
|
+
` + wrap(v2.description, {
|
|
4909
4951
|
margin: 3,
|
|
4910
4952
|
width: this.out.columns
|
|
4911
4953
|
});
|
|
4912
4954
|
}
|
|
4913
4955
|
}
|
|
4914
4956
|
}
|
|
4915
|
-
this.outputText += `${prefix} ${title}${color.gray(desc)}
|
|
4957
|
+
this.outputText += `${prefix} ${title}${color.gray(desc)}
|
|
4958
|
+
`;
|
|
4916
4959
|
}
|
|
4917
4960
|
}
|
|
4918
4961
|
this.out.write(this.outputText);
|
|
@@ -4952,7 +4995,8 @@ var require_toggle = __commonJS((exports, module) => {
|
|
|
4952
4995
|
this.done = this.aborted = true;
|
|
4953
4996
|
this.fire();
|
|
4954
4997
|
this.render();
|
|
4955
|
-
this.out.write(
|
|
4998
|
+
this.out.write(`
|
|
4999
|
+
`);
|
|
4956
5000
|
this.close();
|
|
4957
5001
|
}
|
|
4958
5002
|
submit() {
|
|
@@ -4960,7 +5004,8 @@ var require_toggle = __commonJS((exports, module) => {
|
|
|
4960
5004
|
this.aborted = false;
|
|
4961
5005
|
this.fire();
|
|
4962
5006
|
this.render();
|
|
4963
|
-
this.out.write(
|
|
5007
|
+
this.out.write(`
|
|
5008
|
+
`);
|
|
4964
5009
|
this.close();
|
|
4965
5010
|
}
|
|
4966
5011
|
deactivate() {
|
|
@@ -5393,7 +5438,8 @@ var require_date = __commonJS((exports, module) => {
|
|
|
5393
5438
|
this.error = false;
|
|
5394
5439
|
this.fire();
|
|
5395
5440
|
this.render();
|
|
5396
|
-
this.out.write(
|
|
5441
|
+
this.out.write(`
|
|
5442
|
+
`);
|
|
5397
5443
|
this.close();
|
|
5398
5444
|
}
|
|
5399
5445
|
validate() {
|
|
@@ -5421,7 +5467,8 @@ var require_date = __commonJS((exports, module) => {
|
|
|
5421
5467
|
_this2.aborted = false;
|
|
5422
5468
|
_this2.fire();
|
|
5423
5469
|
_this2.render();
|
|
5424
|
-
_this2.out.write(
|
|
5470
|
+
_this2.out.write(`
|
|
5471
|
+
`);
|
|
5425
5472
|
_this2.close();
|
|
5426
5473
|
})();
|
|
5427
5474
|
}
|
|
@@ -5471,7 +5518,9 @@ var require_date = __commonJS((exports, module) => {
|
|
|
5471
5518
|
super.render();
|
|
5472
5519
|
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(" ");
|
|
5473
5520
|
if (this.error) {
|
|
5474
|
-
this.outputText += this.errorMsg.split(
|
|
5521
|
+
this.outputText += this.errorMsg.split(`
|
|
5522
|
+
`).reduce((a, l3, i) => a + `
|
|
5523
|
+
${i ? ` ` : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
5475
5524
|
}
|
|
5476
5525
|
this.out.write(erase2.line + cursor2.to(0) + this.outputText);
|
|
5477
5526
|
}
|
|
@@ -5581,7 +5630,8 @@ var require_number = __commonJS((exports, module) => {
|
|
|
5581
5630
|
this.error = false;
|
|
5582
5631
|
this.fire();
|
|
5583
5632
|
this.render();
|
|
5584
|
-
this.out.write(
|
|
5633
|
+
this.out.write(`
|
|
5634
|
+
`);
|
|
5585
5635
|
this.close();
|
|
5586
5636
|
}
|
|
5587
5637
|
validate() {
|
|
@@ -5612,7 +5662,8 @@ var require_number = __commonJS((exports, module) => {
|
|
|
5612
5662
|
_this2.error = false;
|
|
5613
5663
|
_this2.fire();
|
|
5614
5664
|
_this2.render();
|
|
5615
|
-
_this2.out.write(
|
|
5665
|
+
_this2.out.write(`
|
|
5666
|
+
`);
|
|
5616
5667
|
_this2.close();
|
|
5617
5668
|
})();
|
|
5618
5669
|
}
|
|
@@ -5688,7 +5739,9 @@ var require_number = __commonJS((exports, module) => {
|
|
|
5688
5739
|
this.outputError = "";
|
|
5689
5740
|
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(` `);
|
|
5690
5741
|
if (this.error) {
|
|
5691
|
-
this.outputError += this.errorMsg.split(
|
|
5742
|
+
this.outputError += this.errorMsg.split(`
|
|
5743
|
+
`).reduce((a, l3, i) => a + `
|
|
5744
|
+
${i ? ` ` : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
5692
5745
|
}
|
|
5693
5746
|
this.out.write(erase2.line + cursor2.to(0) + this.outputText + cursor2.save + this.outputError + cursor2.restore);
|
|
5694
5747
|
}
|
|
@@ -5755,7 +5808,8 @@ var require_multiselect = __commonJS((exports, module) => {
|
|
|
5755
5808
|
this.done = this.aborted = true;
|
|
5756
5809
|
this.fire();
|
|
5757
5810
|
this.render();
|
|
5758
|
-
this.out.write(
|
|
5811
|
+
this.out.write(`
|
|
5812
|
+
`);
|
|
5759
5813
|
this.close();
|
|
5760
5814
|
}
|
|
5761
5815
|
submit() {
|
|
@@ -5768,7 +5822,8 @@ var require_multiselect = __commonJS((exports, module) => {
|
|
|
5768
5822
|
this.aborted = false;
|
|
5769
5823
|
this.fire();
|
|
5770
5824
|
this.render();
|
|
5771
|
-
this.out.write(
|
|
5825
|
+
this.out.write(`
|
|
5826
|
+
`);
|
|
5772
5827
|
this.close();
|
|
5773
5828
|
}
|
|
5774
5829
|
}
|
|
@@ -5844,7 +5899,12 @@ var require_multiselect = __commonJS((exports, module) => {
|
|
|
5844
5899
|
if (typeof this.instructions === "string") {
|
|
5845
5900
|
return this.instructions;
|
|
5846
5901
|
}
|
|
5847
|
-
return
|
|
5902
|
+
return `
|
|
5903
|
+
Instructions:
|
|
5904
|
+
` + ` ${figures.arrowUp}/${figures.arrowDown}: Highlight option
|
|
5905
|
+
` + ` ${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
|
|
5906
|
+
` + (this.maxChoices === undefined ? ` a: Toggle all
|
|
5907
|
+
` : "") + ` enter/return: Complete answer`;
|
|
5848
5908
|
}
|
|
5849
5909
|
return "";
|
|
5850
5910
|
}
|
|
@@ -5858,7 +5918,8 @@ var require_multiselect = __commonJS((exports, module) => {
|
|
|
5858
5918
|
if (cursor3 === i && v2.description) {
|
|
5859
5919
|
desc = ` - ${v2.description}`;
|
|
5860
5920
|
if (prefix.length + title.length + desc.length >= this.out.columns || v2.description.split(/\r?\n/).length > 1) {
|
|
5861
|
-
desc =
|
|
5921
|
+
desc = `
|
|
5922
|
+
` + wrap(v2.description, {
|
|
5862
5923
|
margin: prefix.length,
|
|
5863
5924
|
width: this.out.columns
|
|
5864
5925
|
});
|
|
@@ -5883,7 +5944,9 @@ var require_multiselect = __commonJS((exports, module) => {
|
|
|
5883
5944
|
}
|
|
5884
5945
|
styledOptions.push(this.renderOption(this.cursor, options[i], i, prefix));
|
|
5885
5946
|
}
|
|
5886
|
-
return
|
|
5947
|
+
return `
|
|
5948
|
+
` + styledOptions.join(`
|
|
5949
|
+
`);
|
|
5887
5950
|
}
|
|
5888
5951
|
renderOptions(options) {
|
|
5889
5952
|
if (!this.done) {
|
|
@@ -6049,7 +6112,8 @@ var require_autocomplete = __commonJS((exports, module) => {
|
|
|
6049
6112
|
this.aborted = false;
|
|
6050
6113
|
this.fire();
|
|
6051
6114
|
this.render();
|
|
6052
|
-
this.out.write(
|
|
6115
|
+
this.out.write(`
|
|
6116
|
+
`);
|
|
6053
6117
|
this.close();
|
|
6054
6118
|
}
|
|
6055
6119
|
}
|
|
@@ -6058,7 +6122,8 @@ var require_autocomplete = __commonJS((exports, module) => {
|
|
|
6058
6122
|
this.exited = false;
|
|
6059
6123
|
this.fire();
|
|
6060
6124
|
this.render();
|
|
6061
|
-
this.out.write(
|
|
6125
|
+
this.out.write(`
|
|
6126
|
+
`);
|
|
6062
6127
|
this.close();
|
|
6063
6128
|
}
|
|
6064
6129
|
submit() {
|
|
@@ -6066,7 +6131,8 @@ var require_autocomplete = __commonJS((exports, module) => {
|
|
|
6066
6131
|
this.aborted = this.exited = false;
|
|
6067
6132
|
this.fire();
|
|
6068
6133
|
this.render();
|
|
6069
|
-
this.out.write(
|
|
6134
|
+
this.out.write(`
|
|
6135
|
+
`);
|
|
6070
6136
|
this.close();
|
|
6071
6137
|
}
|
|
6072
6138
|
_(c2, key) {
|
|
@@ -6155,7 +6221,8 @@ var require_autocomplete = __commonJS((exports, module) => {
|
|
|
6155
6221
|
if (v2.description) {
|
|
6156
6222
|
desc = ` - ${v2.description}`;
|
|
6157
6223
|
if (prefix.length + title.length + desc.length >= this.out.columns || v2.description.split(/\r?\n/).length > 1) {
|
|
6158
|
-
desc =
|
|
6224
|
+
desc = `
|
|
6225
|
+
` + wrap(v2.description, {
|
|
6159
6226
|
margin: 3,
|
|
6160
6227
|
width: this.out.columns
|
|
6161
6228
|
});
|
|
@@ -6174,8 +6241,10 @@ var require_autocomplete = __commonJS((exports, module) => {
|
|
|
6174
6241
|
let _entriesToDisplay = entriesToDisplay(this.select, this.choices.length, this.limit), startIndex = _entriesToDisplay.startIndex, endIndex = _entriesToDisplay.endIndex;
|
|
6175
6242
|
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(" ");
|
|
6176
6243
|
if (!this.done) {
|
|
6177
|
-
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(
|
|
6178
|
-
|
|
6244
|
+
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(`
|
|
6245
|
+
`);
|
|
6246
|
+
this.outputText += `
|
|
6247
|
+
` + (suggestions || color.gray(this.fallback.title));
|
|
6179
6248
|
}
|
|
6180
6249
|
this.out.write(erase2.line + cursor2.to(0) + this.outputText);
|
|
6181
6250
|
}
|
|
@@ -6303,7 +6372,8 @@ Instructions:
|
|
|
6303
6372
|
}
|
|
6304
6373
|
renderCurrentInput() {
|
|
6305
6374
|
return `
|
|
6306
|
-
Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
|
|
6375
|
+
Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
|
|
6376
|
+
`;
|
|
6307
6377
|
}
|
|
6308
6378
|
renderOption(cursor3, v2, i) {
|
|
6309
6379
|
let title;
|
|
@@ -6375,7 +6445,8 @@ var require_confirm = __commonJS((exports, module) => {
|
|
|
6375
6445
|
this.done = this.aborted = true;
|
|
6376
6446
|
this.fire();
|
|
6377
6447
|
this.render();
|
|
6378
|
-
this.out.write(
|
|
6448
|
+
this.out.write(`
|
|
6449
|
+
`);
|
|
6379
6450
|
this.close();
|
|
6380
6451
|
}
|
|
6381
6452
|
submit() {
|
|
@@ -6384,7 +6455,8 @@ var require_confirm = __commonJS((exports, module) => {
|
|
|
6384
6455
|
this.aborted = false;
|
|
6385
6456
|
this.fire();
|
|
6386
6457
|
this.render();
|
|
6387
|
-
this.out.write(
|
|
6458
|
+
this.out.write(`
|
|
6459
|
+
`);
|
|
6388
6460
|
this.close();
|
|
6389
6461
|
}
|
|
6390
6462
|
_(c2, key) {
|
|
@@ -6540,7 +6612,8 @@ var require_dist = __commonJS((exports, module) => {
|
|
|
6540
6612
|
throw _e;
|
|
6541
6613
|
}, f: F };
|
|
6542
6614
|
}
|
|
6543
|
-
throw new TypeError(
|
|
6615
|
+
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
6616
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
6544
6617
|
}
|
|
6545
6618
|
var normalCompletion = true, didErr = false, err2;
|
|
6546
6619
|
return { s: function s() {
|
|
@@ -6872,7 +6945,9 @@ var require_wrap2 = __commonJS((exports, module) => {
|
|
|
6872
6945
|
else
|
|
6873
6946
|
arr.push(`${tab}${w2}`);
|
|
6874
6947
|
return arr;
|
|
6875
|
-
}, [tab]).join(
|
|
6948
|
+
}, [tab]).join(`
|
|
6949
|
+
`)).join(`
|
|
6950
|
+
`);
|
|
6876
6951
|
};
|
|
6877
6952
|
});
|
|
6878
6953
|
var require_entriesToDisplay2 = __commonJS((exports, module) => {
|
|
@@ -7009,7 +7084,8 @@ var require_text2 = __commonJS((exports, module) => {
|
|
|
7009
7084
|
this.red = false;
|
|
7010
7085
|
this.fire();
|
|
7011
7086
|
this.render();
|
|
7012
|
-
this.out.write(
|
|
7087
|
+
this.out.write(`
|
|
7088
|
+
`);
|
|
7013
7089
|
this.close();
|
|
7014
7090
|
}
|
|
7015
7091
|
async validate() {
|
|
@@ -7035,7 +7111,8 @@ var require_text2 = __commonJS((exports, module) => {
|
|
|
7035
7111
|
this.aborted = false;
|
|
7036
7112
|
this.fire();
|
|
7037
7113
|
this.render();
|
|
7038
|
-
this.out.write(
|
|
7114
|
+
this.out.write(`
|
|
7115
|
+
`);
|
|
7039
7116
|
this.close();
|
|
7040
7117
|
}
|
|
7041
7118
|
next() {
|
|
@@ -7132,7 +7209,9 @@ var require_text2 = __commonJS((exports, module) => {
|
|
|
7132
7209
|
this.red ? color.red(this.rendered) : this.rendered
|
|
7133
7210
|
].join(` `);
|
|
7134
7211
|
if (this.error) {
|
|
7135
|
-
this.outputError += this.errorMsg.split(
|
|
7212
|
+
this.outputError += this.errorMsg.split(`
|
|
7213
|
+
`).reduce((a, l3, i) => a + `
|
|
7214
|
+
${i ? " " : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
7136
7215
|
}
|
|
7137
7216
|
this.out.write(erase2.line + cursor2.to(0) + this.outputText + cursor2.save + this.outputError + cursor2.restore + cursor2.move(this.cursorOffset, 0));
|
|
7138
7217
|
}
|
|
@@ -7185,7 +7264,8 @@ var require_select2 = __commonJS((exports, module) => {
|
|
|
7185
7264
|
this.done = this.aborted = true;
|
|
7186
7265
|
this.fire();
|
|
7187
7266
|
this.render();
|
|
7188
|
-
this.out.write(
|
|
7267
|
+
this.out.write(`
|
|
7268
|
+
`);
|
|
7189
7269
|
this.close();
|
|
7190
7270
|
}
|
|
7191
7271
|
submit() {
|
|
@@ -7194,7 +7274,8 @@ var require_select2 = __commonJS((exports, module) => {
|
|
|
7194
7274
|
this.aborted = false;
|
|
7195
7275
|
this.fire();
|
|
7196
7276
|
this.render();
|
|
7197
|
-
this.out.write(
|
|
7277
|
+
this.out.write(`
|
|
7278
|
+
`);
|
|
7198
7279
|
this.close();
|
|
7199
7280
|
} else
|
|
7200
7281
|
this.bell();
|
|
@@ -7250,7 +7331,8 @@ var require_select2 = __commonJS((exports, module) => {
|
|
|
7250
7331
|
this.done ? this.selection.title : this.selection.disabled ? color.yellow(this.warn) : color.gray(this.hint)
|
|
7251
7332
|
].join(" ");
|
|
7252
7333
|
if (!this.done) {
|
|
7253
|
-
this.outputText +=
|
|
7334
|
+
this.outputText += `
|
|
7335
|
+
`;
|
|
7254
7336
|
for (let i = startIndex;i < endIndex; i++) {
|
|
7255
7337
|
let title, prefix, desc = "", v2 = this.choices[i];
|
|
7256
7338
|
if (i === startIndex && startIndex > 0) {
|
|
@@ -7269,11 +7351,13 @@ var require_select2 = __commonJS((exports, module) => {
|
|
|
7269
7351
|
if (v2.description && this.cursor === i) {
|
|
7270
7352
|
desc = ` - ${v2.description}`;
|
|
7271
7353
|
if (prefix.length + title.length + desc.length >= this.out.columns || v2.description.split(/\r?\n/).length > 1) {
|
|
7272
|
-
desc =
|
|
7354
|
+
desc = `
|
|
7355
|
+
` + wrap(v2.description, { margin: 3, width: this.out.columns });
|
|
7273
7356
|
}
|
|
7274
7357
|
}
|
|
7275
7358
|
}
|
|
7276
|
-
this.outputText += `${prefix} ${title}${color.gray(desc)}
|
|
7359
|
+
this.outputText += `${prefix} ${title}${color.gray(desc)}
|
|
7360
|
+
`;
|
|
7277
7361
|
}
|
|
7278
7362
|
}
|
|
7279
7363
|
this.out.write(this.outputText);
|
|
@@ -7309,7 +7393,8 @@ var require_toggle2 = __commonJS((exports, module) => {
|
|
|
7309
7393
|
this.done = this.aborted = true;
|
|
7310
7394
|
this.fire();
|
|
7311
7395
|
this.render();
|
|
7312
|
-
this.out.write(
|
|
7396
|
+
this.out.write(`
|
|
7397
|
+
`);
|
|
7313
7398
|
this.close();
|
|
7314
7399
|
}
|
|
7315
7400
|
submit() {
|
|
@@ -7317,7 +7402,8 @@ var require_toggle2 = __commonJS((exports, module) => {
|
|
|
7317
7402
|
this.aborted = false;
|
|
7318
7403
|
this.fire();
|
|
7319
7404
|
this.render();
|
|
7320
|
-
this.out.write(
|
|
7405
|
+
this.out.write(`
|
|
7406
|
+
`);
|
|
7321
7407
|
this.close();
|
|
7322
7408
|
}
|
|
7323
7409
|
deactivate() {
|
|
@@ -7702,7 +7788,8 @@ var require_date2 = __commonJS((exports, module) => {
|
|
|
7702
7788
|
this.error = false;
|
|
7703
7789
|
this.fire();
|
|
7704
7790
|
this.render();
|
|
7705
|
-
this.out.write(
|
|
7791
|
+
this.out.write(`
|
|
7792
|
+
`);
|
|
7706
7793
|
this.close();
|
|
7707
7794
|
}
|
|
7708
7795
|
async validate() {
|
|
@@ -7725,7 +7812,8 @@ var require_date2 = __commonJS((exports, module) => {
|
|
|
7725
7812
|
this.aborted = false;
|
|
7726
7813
|
this.fire();
|
|
7727
7814
|
this.render();
|
|
7728
|
-
this.out.write(
|
|
7815
|
+
this.out.write(`
|
|
7816
|
+
`);
|
|
7729
7817
|
this.close();
|
|
7730
7818
|
}
|
|
7731
7819
|
up() {
|
|
@@ -7779,7 +7867,9 @@ var require_date2 = __commonJS((exports, module) => {
|
|
|
7779
7867
|
this.parts.reduce((arr, p3, idx) => arr.concat(idx === this.cursor && !this.done ? color.cyan().underline(p3.toString()) : p3), []).join("")
|
|
7780
7868
|
].join(" ");
|
|
7781
7869
|
if (this.error) {
|
|
7782
|
-
this.outputText += this.errorMsg.split(
|
|
7870
|
+
this.outputText += this.errorMsg.split(`
|
|
7871
|
+
`).reduce((a, l3, i) => a + `
|
|
7872
|
+
${i ? ` ` : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
7783
7873
|
}
|
|
7784
7874
|
this.out.write(erase2.line + cursor2.to(0) + this.outputText);
|
|
7785
7875
|
}
|
|
@@ -7854,7 +7944,8 @@ var require_number2 = __commonJS((exports, module) => {
|
|
|
7854
7944
|
this.error = false;
|
|
7855
7945
|
this.fire();
|
|
7856
7946
|
this.render();
|
|
7857
|
-
this.out.write(
|
|
7947
|
+
this.out.write(`
|
|
7948
|
+
`);
|
|
7858
7949
|
this.close();
|
|
7859
7950
|
}
|
|
7860
7951
|
async validate() {
|
|
@@ -7880,7 +7971,8 @@ var require_number2 = __commonJS((exports, module) => {
|
|
|
7880
7971
|
this.error = false;
|
|
7881
7972
|
this.fire();
|
|
7882
7973
|
this.render();
|
|
7883
|
-
this.out.write(
|
|
7974
|
+
this.out.write(`
|
|
7975
|
+
`);
|
|
7884
7976
|
this.close();
|
|
7885
7977
|
}
|
|
7886
7978
|
up() {
|
|
@@ -7960,7 +8052,9 @@ var require_number2 = __commonJS((exports, module) => {
|
|
|
7960
8052
|
!this.done || !this.done && !this.placeholder ? color[this.color]().underline(this.rendered) : this.rendered
|
|
7961
8053
|
].join(` `);
|
|
7962
8054
|
if (this.error) {
|
|
7963
|
-
this.outputError += this.errorMsg.split(
|
|
8055
|
+
this.outputError += this.errorMsg.split(`
|
|
8056
|
+
`).reduce((a, l3, i) => a + `
|
|
8057
|
+
${i ? ` ` : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
7964
8058
|
}
|
|
7965
8059
|
this.out.write(erase2.line + cursor2.to(0) + this.outputText + cursor2.save + this.outputError + cursor2.restore);
|
|
7966
8060
|
}
|
|
@@ -8018,7 +8112,8 @@ var require_multiselect2 = __commonJS((exports, module) => {
|
|
|
8018
8112
|
this.done = this.aborted = true;
|
|
8019
8113
|
this.fire();
|
|
8020
8114
|
this.render();
|
|
8021
|
-
this.out.write(
|
|
8115
|
+
this.out.write(`
|
|
8116
|
+
`);
|
|
8022
8117
|
this.close();
|
|
8023
8118
|
}
|
|
8024
8119
|
submit() {
|
|
@@ -8031,7 +8126,8 @@ var require_multiselect2 = __commonJS((exports, module) => {
|
|
|
8031
8126
|
this.aborted = false;
|
|
8032
8127
|
this.fire();
|
|
8033
8128
|
this.render();
|
|
8034
|
-
this.out.write(
|
|
8129
|
+
this.out.write(`
|
|
8130
|
+
`);
|
|
8035
8131
|
this.close();
|
|
8036
8132
|
}
|
|
8037
8133
|
}
|
|
@@ -8107,7 +8203,12 @@ var require_multiselect2 = __commonJS((exports, module) => {
|
|
|
8107
8203
|
if (typeof this.instructions === "string") {
|
|
8108
8204
|
return this.instructions;
|
|
8109
8205
|
}
|
|
8110
|
-
return
|
|
8206
|
+
return `
|
|
8207
|
+
Instructions:
|
|
8208
|
+
` + ` ${figures.arrowUp}/${figures.arrowDown}: Highlight option
|
|
8209
|
+
` + ` ${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
|
|
8210
|
+
` + (this.maxChoices === undefined ? ` a: Toggle all
|
|
8211
|
+
` : "") + ` enter/return: Complete answer`;
|
|
8111
8212
|
}
|
|
8112
8213
|
return "";
|
|
8113
8214
|
}
|
|
@@ -8121,7 +8222,8 @@ var require_multiselect2 = __commonJS((exports, module) => {
|
|
|
8121
8222
|
if (cursor3 === i && v2.description) {
|
|
8122
8223
|
desc = ` - ${v2.description}`;
|
|
8123
8224
|
if (prefix.length + title.length + desc.length >= this.out.columns || v2.description.split(/\r?\n/).length > 1) {
|
|
8124
|
-
desc =
|
|
8225
|
+
desc = `
|
|
8226
|
+
` + wrap(v2.description, { margin: prefix.length, width: this.out.columns });
|
|
8125
8227
|
}
|
|
8126
8228
|
}
|
|
8127
8229
|
}
|
|
@@ -8143,7 +8245,9 @@ var require_multiselect2 = __commonJS((exports, module) => {
|
|
|
8143
8245
|
}
|
|
8144
8246
|
styledOptions.push(this.renderOption(this.cursor, options[i], i, prefix));
|
|
8145
8247
|
}
|
|
8146
|
-
return
|
|
8248
|
+
return `
|
|
8249
|
+
` + styledOptions.join(`
|
|
8250
|
+
`);
|
|
8147
8251
|
}
|
|
8148
8252
|
renderOptions(options) {
|
|
8149
8253
|
if (!this.done) {
|
|
@@ -8265,7 +8369,8 @@ var require_autocomplete2 = __commonJS((exports, module) => {
|
|
|
8265
8369
|
this.aborted = false;
|
|
8266
8370
|
this.fire();
|
|
8267
8371
|
this.render();
|
|
8268
|
-
this.out.write(
|
|
8372
|
+
this.out.write(`
|
|
8373
|
+
`);
|
|
8269
8374
|
this.close();
|
|
8270
8375
|
}
|
|
8271
8376
|
}
|
|
@@ -8274,7 +8379,8 @@ var require_autocomplete2 = __commonJS((exports, module) => {
|
|
|
8274
8379
|
this.exited = false;
|
|
8275
8380
|
this.fire();
|
|
8276
8381
|
this.render();
|
|
8277
|
-
this.out.write(
|
|
8382
|
+
this.out.write(`
|
|
8383
|
+
`);
|
|
8278
8384
|
this.close();
|
|
8279
8385
|
}
|
|
8280
8386
|
submit() {
|
|
@@ -8282,7 +8388,8 @@ var require_autocomplete2 = __commonJS((exports, module) => {
|
|
|
8282
8388
|
this.aborted = this.exited = false;
|
|
8283
8389
|
this.fire();
|
|
8284
8390
|
this.render();
|
|
8285
|
-
this.out.write(
|
|
8391
|
+
this.out.write(`
|
|
8392
|
+
`);
|
|
8286
8393
|
this.close();
|
|
8287
8394
|
}
|
|
8288
8395
|
_(c2, key) {
|
|
@@ -8371,7 +8478,8 @@ var require_autocomplete2 = __commonJS((exports, module) => {
|
|
|
8371
8478
|
if (v2.description) {
|
|
8372
8479
|
desc = ` - ${v2.description}`;
|
|
8373
8480
|
if (prefix.length + title.length + desc.length >= this.out.columns || v2.description.split(/\r?\n/).length > 1) {
|
|
8374
|
-
desc =
|
|
8481
|
+
desc = `
|
|
8482
|
+
` + wrap(v2.description, { margin: 3, width: this.out.columns });
|
|
8375
8483
|
}
|
|
8376
8484
|
}
|
|
8377
8485
|
return prefix + " " + title + color.gray(desc || "");
|
|
@@ -8392,8 +8500,10 @@ var require_autocomplete2 = __commonJS((exports, module) => {
|
|
|
8392
8500
|
this.done && this.suggestions[this.select] ? this.suggestions[this.select].title : this.rendered = this.transform.render(this.input)
|
|
8393
8501
|
].join(" ");
|
|
8394
8502
|
if (!this.done) {
|
|
8395
|
-
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(
|
|
8396
|
-
|
|
8503
|
+
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(`
|
|
8504
|
+
`);
|
|
8505
|
+
this.outputText += `
|
|
8506
|
+
` + (suggestions || color.gray(this.fallback.title));
|
|
8397
8507
|
}
|
|
8398
8508
|
this.out.write(erase2.line + cursor2.to(0) + this.outputText);
|
|
8399
8509
|
}
|
|
@@ -8517,7 +8627,8 @@ Instructions:
|
|
|
8517
8627
|
}
|
|
8518
8628
|
renderCurrentInput() {
|
|
8519
8629
|
return `
|
|
8520
|
-
Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
|
|
8630
|
+
Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
|
|
8631
|
+
`;
|
|
8521
8632
|
}
|
|
8522
8633
|
renderOption(cursor3, v2, i) {
|
|
8523
8634
|
let title;
|
|
@@ -8590,7 +8701,8 @@ var require_confirm2 = __commonJS((exports, module) => {
|
|
|
8590
8701
|
this.done = this.aborted = true;
|
|
8591
8702
|
this.fire();
|
|
8592
8703
|
this.render();
|
|
8593
|
-
this.out.write(
|
|
8704
|
+
this.out.write(`
|
|
8705
|
+
`);
|
|
8594
8706
|
this.close();
|
|
8595
8707
|
}
|
|
8596
8708
|
submit() {
|
|
@@ -8599,7 +8711,8 @@ var require_confirm2 = __commonJS((exports, module) => {
|
|
|
8599
8711
|
this.aborted = false;
|
|
8600
8712
|
this.fire();
|
|
8601
8713
|
this.render();
|
|
8602
|
-
this.out.write(
|
|
8714
|
+
this.out.write(`
|
|
8715
|
+
`);
|
|
8603
8716
|
this.close();
|
|
8604
8717
|
}
|
|
8605
8718
|
_(c2, key) {
|
|
@@ -10622,7 +10735,7 @@ var ut = l((qe, P2) => {
|
|
|
10622
10735
|
return t = t.replace(C, "^$1"), t;
|
|
10623
10736
|
}
|
|
10624
10737
|
function Jt(t, e) {
|
|
10625
|
-
return t = `${t}`, t = t.replace(/(\\*)"/g,
|
|
10738
|
+
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;
|
|
10626
10739
|
}
|
|
10627
10740
|
P2.exports.command = Vt;
|
|
10628
10741
|
P2.exports.argument = Jt;
|
|
@@ -11061,11 +11174,13 @@ class Command {
|
|
|
11061
11174
|
title: "Commands",
|
|
11062
11175
|
body: commands.map((command) => {
|
|
11063
11176
|
return ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`;
|
|
11064
|
-
}).join(
|
|
11177
|
+
}).join(`
|
|
11178
|
+
`)
|
|
11065
11179
|
});
|
|
11066
11180
|
sections.push({
|
|
11067
11181
|
title: `For more info, run any command with the \`--help\` flag`,
|
|
11068
|
-
body: commands.map((command) => ` $ ${name}${command.name === "" ? "" : ` ${command.name}`} --help`).join(
|
|
11182
|
+
body: commands.map((command) => ` $ ${name}${command.name === "" ? "" : ` ${command.name}`} --help`).join(`
|
|
11183
|
+
`)
|
|
11069
11184
|
});
|
|
11070
11185
|
}
|
|
11071
11186
|
let options = this.isGlobalCommand ? globalOptions : [...this.options, ...globalOptions || []];
|
|
@@ -11078,7 +11193,8 @@ class Command {
|
|
|
11078
11193
|
title: "Options",
|
|
11079
11194
|
body: options.map((option) => {
|
|
11080
11195
|
return ` ${padRight(option.rawName, longestOptionName.length)} ${option.description} ${option.config.default === undefined ? "" : `(default: ${option.config.default})`}`;
|
|
11081
|
-
}).join(
|
|
11196
|
+
}).join(`
|
|
11197
|
+
`)
|
|
11082
11198
|
});
|
|
11083
11199
|
}
|
|
11084
11200
|
if (this.examples.length > 0) {
|
|
@@ -11089,7 +11205,8 @@ class Command {
|
|
|
11089
11205
|
return example(name);
|
|
11090
11206
|
}
|
|
11091
11207
|
return example;
|
|
11092
|
-
}).join(
|
|
11208
|
+
}).join(`
|
|
11209
|
+
`)
|
|
11093
11210
|
});
|
|
11094
11211
|
}
|
|
11095
11212
|
if (helpCallback) {
|
|
@@ -11098,7 +11215,9 @@ class Command {
|
|
|
11098
11215
|
console.log(sections.map((section) => {
|
|
11099
11216
|
return section.title ? `${section.title}:
|
|
11100
11217
|
${section.body}` : section.body;
|
|
11101
|
-
}).join(
|
|
11218
|
+
}).join(`
|
|
11219
|
+
|
|
11220
|
+
`));
|
|
11102
11221
|
}
|
|
11103
11222
|
outputVersion() {
|
|
11104
11223
|
const { name } = this.cli;
|
|
@@ -11399,7 +11518,7 @@ var TITLE_TERMINATORS = new Set([
|
|
|
11399
11518
|
...SENTENCE_TERMINATORS,
|
|
11400
11519
|
":",
|
|
11401
11520
|
'"',
|
|
11402
|
-
"
|
|
11521
|
+
"'",
|
|
11403
11522
|
"\u201D"
|
|
11404
11523
|
]);
|
|
11405
11524
|
var SMALL_WORDS = new Set([
|
|
@@ -11745,7 +11864,7 @@ pluralize.addIrregularRule = (single, plural) => {
|
|
|
11745
11864
|
/pox$/i,
|
|
11746
11865
|
/sheep$/i
|
|
11747
11866
|
].forEach(pluralize.addUncountableRule);
|
|
11748
|
-
var charMap = JSON.parse(`{"$":"dollar","%":"percent","&":"and","<":"less",">":"greater","|":"or","\xA2":"cent","\xA3":"pound","\xA4":"currency","\xA5":"yen","\xA9":"(c)","\xAA":"a","\xAE":"(r)","\xBA":"o","\xC0":"A","\xC1":"A","\xC2":"A","\xC3":"A","\xC4":"A","\xC5":"A","\xC6":"AE","\xC7":"C","\xC8":"E","\xC9":"E","\xCA":"E","\xCB":"E","\xCC":"I","\xCD":"I","\xCE":"I","\xCF":"I","\xD0":"D","\xD1":"N","\xD2":"O","\xD3":"O","\xD4":"O","\xD5":"O","\xD6":"O","\xD8":"O","\xD9":"U","\xDA":"U","\xDB":"U","\xDC":"U","\xDD":"Y","\xDE":"TH","\xDF":"ss","\xE0":"a","\xE1":"a","\xE2":"a","\xE3":"a","\xE4":"a","\xE5":"a","\xE6":"ae","\xE7":"c","\xE8":"e","\xE9":"e","\xEA":"e","\xEB":"e","\xEC":"i","\xED":"i","\xEE":"i","\xEF":"i","\xF0":"d","\xF1":"n","\xF2":"o","\xF3":"o","\xF4":"o","\xF5":"o","\xF6":"o","\xF8":"o","\xF9":"u","\xFA":"u","\xFB":"u","\xFC":"u","\xFD":"y","\xFE":"th","\
|
|
11867
|
+
var charMap = JSON.parse(`{"$":"dollar","%":"percent","&":"and","<":"less",">":"greater","|":"or","\xA2":"cent","\xA3":"pound","\xA4":"currency","\xA5":"yen","\xA9":"(c)","\xAA":"a","\xAE":"(r)","\xBA":"o","\xC0":"A","\xC1":"A","\xC2":"A","\xC3":"A","\xC4":"A","\xC5":"A","\xC6":"AE","\xC7":"C","\xC8":"E","\xC9":"E","\xCA":"E","\xCB":"E","\xCC":"I","\xCD":"I","\xCE":"I","\xCF":"I","\xD0":"D","\xD1":"N","\xD2":"O","\xD3":"O","\xD4":"O","\xD5":"O","\xD6":"O","\xD8":"O","\xD9":"U","\xDA":"U","\xDB":"U","\xDC":"U","\xDD":"Y","\xDE":"TH","\xDF":"ss","\xE0":"a","\xE1":"a","\xE2":"a","\xE3":"a","\xE4":"a","\xE5":"a","\xE6":"ae","\xE7":"c","\xE8":"e","\xE9":"e","\xEA":"e","\xEB":"e","\xEC":"i","\xED":"i","\xEE":"i","\xEF":"i","\xF0":"d","\xF1":"n","\xF2":"o","\xF3":"o","\xF4":"o","\xF5":"o","\xF6":"o","\xF8":"o","\xF9":"u","\xFA":"u","\xFB":"u","\xFC":"u","\xFD":"y","\xFE":"th","\u00FF":"y","\u0100":"A","\u0101":"a","\u0102":"A","\u0103":"a","\u0104":"A","\u0105":"a","\u0106":"C","\u0107":"c","\u010C":"C","\u010D":"c","\u010E":"D","\u010F":"d","\u0110":"DJ","\u0111":"dj","\u0112":"E","\u0113":"e","\u0116":"E","\u0117":"e","\u0118":"e","\u0119":"e","\u011A":"E","\u011B":"e","\u011E":"G","\u011F":"g","\u0122":"G","\u0123":"g","\u0128":"I","\u0129":"i","\u012A":"i","\u012B":"i","\u012E":"I","\u012F":"i","\u0130":"I","\u0131":"i","\u0136":"k","\u0137":"k","\u013B":"L","\u013C":"l","\u013D":"L","\u013E":"l","\u0141":"L","\u0142":"l","\u0143":"N","\u0144":"n","\u0145":"N","\u0146":"n","\u0147":"N","\u0148":"n","\u014C":"O","\u014D":"o","\u0150":"O","\u0151":"o","\u0152":"OE","\u0153":"oe","\u0154":"R","\u0155":"r","\u0158":"R","\u0159":"r","\u015A":"S","\u015B":"s","\u015E":"S","\u015F":"s","\u0160":"S","\u0161":"s","\u0162":"T","\u0163":"t","\u0164":"T","\u0165":"t","\u0168":"U","\u0169":"u","\u016A":"u","\u016B":"u","\u016E":"U","\u016F":"u","\u0170":"U","\u0171":"u","\u0172":"U","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017A":"z","\u017B":"Z","\u017C":"z","\u017D":"Z","\u017E":"z","\u018F":"E","\u0192":"f","\u01A0":"O","\u01A1":"o","\u01AF":"U","\u01B0":"u","\u01C8":"LJ","\u01C9":"lj","\u01CB":"NJ","\u01CC":"nj","\u0218":"S","\u0219":"s","\u021A":"T","\u021B":"t","\u0259":"e","\u02DA":"o","\u0386":"A","\u0388":"E","\u0389":"H","\u038A":"I","\u038C":"O","\u038E":"Y","\u038F":"W","\u0390":"i","\u0391":"A","\u0392":"B","\u0393":"G","\u0394":"D","\u0395":"E","\u0396":"Z","\u0397":"H","\u0398":"8","\u0399":"I","\u039A":"K","\u039B":"L","\u039C":"M","\u039D":"N","\u039E":"3","\u039F":"O","\u03A0":"P","\u03A1":"R","\u03A3":"S","\u03A4":"T","\u03A5":"Y","\u03A6":"F","\u03A7":"X","\u03A8":"PS","\u03A9":"W","\u03AA":"I","\u03AB":"Y","\u03AC":"a","\u03AD":"e","\u03AE":"h","\u03AF":"i","\u03B0":"y","\u03B1":"a","\u03B2":"b","\u03B3":"g","\u03B4":"d","\u03B5":"e","\u03B6":"z","\u03B7":"h","\u03B8":"8","\u03B9":"i","\u03BA":"k","\u03BB":"l","\u03BC":"m","\u03BD":"n","\u03BE":"3","\u03BF":"o","\u03C0":"p","\u03C1":"r","\u03C2":"s","\u03C3":"s","\u03C4":"t","\u03C5":"y","\u03C6":"f","\u03C7":"x","\u03C8":"ps","\u03C9":"w","\u03CA":"i","\u03CB":"y","\u03CC":"o","\u03CD":"y","\u03CE":"w","\u0401":"Yo","\u0402":"DJ","\u0404":"Ye","\u0406":"I","\u0407":"Yi","\u0408":"J","\u0409":"LJ","\u040A":"NJ","\u040B":"C","\u040F":"DZ","\u0410":"A","\u0411":"B","\u0412":"V","\u0413":"G","\u0414":"D","\u0415":"E","\u0416":"Zh","\u0417":"Z","\u0418":"I","\u0419":"J","\u041A":"K","\u041B":"L","\u041C":"M","\u041D":"N","\u041E":"O","\u041F":"P","\u0420":"R","\u0421":"S","\u0422":"T","\u0423":"U","\u0424":"F","\u0425":"H","\u0426":"C","\u0427":"Ch","\u0428":"Sh","\u0429":"Sh","\u042A":"U","\u042B":"Y","\u042C":"","\u042D":"E","\u042E":"Yu","\u042F":"Ya","\u0430":"a","\u0431":"b","\u0432":"v","\u0433":"g","\u0434":"d","\u0435":"e","\u0436":"zh","\u0437":"z","\u0438":"i","\u0439":"j","\u043A":"k","\u043B":"l","\u043C":"m","\u043D":"n","\u043E":"o","\u043F":"p","\u0440":"r","\u0441":"s","\u0442":"t","\u0443":"u","\u0444":"f","\u0445":"h","\u0446":"c","\u0447":"ch","\u0448":"sh","\u0449":"sh","\u044A":"u","\u044B":"y","\u044C":"","\u044D":"e","\u044E":"yu","\u044F":"ya","\u0451":"yo","\u0452":"dj","\u0454":"ye","\u0456":"i","\u0457":"yi","\u0458":"j","\u0459":"lj","\u045A":"nj","\u045B":"c","\u045D":"u","\u045F":"dz","\u0490":"G","\u0491":"g","\u0492":"GH","\u0493":"gh","\u049A":"KH","\u049B":"kh","\u04A2":"NG","\u04A3":"ng","\u04AE":"UE","\u04AF":"ue","\u04B0":"U","\u04B1":"u","\u04BA":"H","\u04BB":"h","\u04D8":"AE","\u04D9":"ae","\u04E8":"OE","\u04E9":"oe","\u0531":"A","\u0532":"B","\u0533":"G","\u0534":"D","\u0535":"E","\u0536":"Z","\u0537":"E'","\u0538":"Y'","\u0539":"T'","\u053A":"JH","\u053B":"I","\u053C":"L","\u053D":"X","\u053E":"C'","\u053F":"K","\u0540":"H","\u0541":"D'","\u0542":"GH","\u0543":"TW","\u0544":"M","\u0545":"Y","\u0546":"N","\u0547":"SH","\u0549":"CH","\u054A":"P","\u054B":"J","\u054C":"R'","\u054D":"S","\u054E":"V","\u054F":"T","\u0550":"R","\u0551":"C","\u0553":"P'","\u0554":"Q'","\u0555":"O''","\u0556":"F","\u0587":"EV","\u0621":"a","\u0622":"aa","\u0623":"a","\u0624":"u","\u0625":"i","\u0626":"e","\u0627":"a","\u0628":"b","\u0629":"h","\u062A":"t","\u062B":"th","\u062C":"j","\u062D":"h","\u062E":"kh","\u062F":"d","\u0630":"th","\u0631":"r","\u0632":"z","\u0633":"s","\u0634":"sh","\u0635":"s","\u0636":"dh","\u0637":"t","\u0638":"z","\u0639":"a","\u063A":"gh","\u0641":"f","\u0642":"q","\u0643":"k","\u0644":"l","\u0645":"m","\u0646":"n","\u0647":"h","\u0648":"w","\u0649":"a","\u064A":"y","\u064B":"an","\u064C":"on","\u064D":"en","\u064E":"a","\u064F":"u","\u0650":"e","\u0652":"","\u0660":"0","\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u067E":"p","\u0686":"ch","\u0698":"zh","\u06A9":"k","\u06AF":"g","\u06CC":"y","\u06F0":"0","\u06F1":"1","\u06F2":"2","\u06F3":"3","\u06F4":"4","\u06F5":"5","\u06F6":"6","\u06F7":"7","\u06F8":"8","\u06F9":"9","\u0E3F":"baht","\u10D0":"a","\u10D1":"b","\u10D2":"g","\u10D3":"d","\u10D4":"e","\u10D5":"v","\u10D6":"z","\u10D7":"t","\u10D8":"i","\u10D9":"k","\u10DA":"l","\u10DB":"m","\u10DC":"n","\u10DD":"o","\u10DE":"p","\u10DF":"zh","\u10E0":"r","\u10E1":"s","\u10E2":"t","\u10E3":"u","\u10E4":"f","\u10E5":"k","\u10E6":"gh","\u10E7":"q","\u10E8":"sh","\u10E9":"ch","\u10EA":"ts","\u10EB":"dz","\u10EC":"ts","\u10ED":"ch","\u10EE":"kh","\u10EF":"j","\u10F0":"h","\u1E62":"S","\u1E63":"s","\u1E80":"W","\u1E81":"w","\u1E82":"W","\u1E83":"w","\u1E84":"W","\u1E85":"w","\u1E9E":"SS","\u1EA0":"A","\u1EA1":"a","\u1EA2":"A","\u1EA3":"a","\u1EA4":"A","\u1EA5":"a","\u1EA6":"A","\u1EA7":"a","\u1EA8":"A","\u1EA9":"a","\u1EAA":"A","\u1EAB":"a","\u1EAC":"A","\u1EAD":"a","\u1EAE":"A","\u1EAF":"a","\u1EB0":"A","\u1EB1":"a","\u1EB2":"A","\u1EB3":"a","\u1EB4":"A","\u1EB5":"a","\u1EB6":"A","\u1EB7":"a","\u1EB8":"E","\u1EB9":"e","\u1EBA":"E","\u1EBB":"e","\u1EBC":"E","\u1EBD":"e","\u1EBE":"E","\u1EBF":"e","\u1EC0":"E","\u1EC1":"e","\u1EC2":"E","\u1EC3":"e","\u1EC4":"E","\u1EC5":"e","\u1EC6":"E","\u1EC7":"e","\u1EC8":"I","\u1EC9":"i","\u1ECA":"I","\u1ECB":"i","\u1ECC":"O","\u1ECD":"o","\u1ECE":"O","\u1ECF":"o","\u1ED0":"O","\u1ED1":"o","\u1ED2":"O","\u1ED3":"o","\u1ED4":"O","\u1ED5":"o","\u1ED6":"O","\u1ED7":"o","\u1ED8":"O","\u1ED9":"o","\u1EDA":"O","\u1EDB":"o","\u1EDC":"O","\u1EDD":"o","\u1EDE":"O","\u1EDF":"o","\u1EE0":"O","\u1EE1":"o","\u1EE2":"O","\u1EE3":"o","\u1EE4":"U","\u1EE5":"u","\u1EE6":"U","\u1EE7":"u","\u1EE8":"U","\u1EE9":"u","\u1EEA":"U","\u1EEB":"u","\u1EEC":"U","\u1EED":"u","\u1EEE":"U","\u1EEF":"u","\u1EF0":"U","\u1EF1":"u","\u1EF2":"Y","\u1EF3":"y","\u1EF4":"Y","\u1EF5":"y","\u1EF6":"Y","\u1EF7":"y","\u1EF8":"Y","\u1EF9":"y","\u2013":"-","\u2018":"'","\u2019":"'","\u201C":"\\"","\u201D":"\\"","\u201E":"\\"","\u2020":"+","\u2022":"*","\u2026":"...","\u20A0":"ecu","\u20A2":"cruzeiro","\u20A3":"french franc","\u20A4":"lira","\u20A5":"mill","\u20A6":"naira","\u20A7":"peseta","\u20A8":"rupee","\u20A9":"won","\u20AA":"new shequel","\u20AB":"dong","\u20AC":"euro","\u20AD":"kip","\u20AE":"tugrik","\u20AF":"drachma","\u20B0":"penny","\u20B1":"peso","\u20B2":"guarani","\u20B3":"austral","\u20B4":"hryvnia","\u20B5":"cedi","\u20B8":"kazakhstani tenge","\u20B9":"indian rupee","\u20BA":"turkish lira","\u20BD":"russian ruble","\u20BF":"bitcoin","\u2120":"sm","\u2122":"tm","\u2202":"d","\u2206":"delta","\u2211":"sum","\u221E":"infinity","\u2665":"love","\u5143":"yuan","\u5186":"yen","\uFDFC":"rial","\uFEF5":"laa","\uFEF7":"laa","\uFEF9":"lai","\uFEFB":"la"}`);
|
|
11749
11868
|
var locales = JSON.parse('{"bg":{"\u0419":"Y","\u0426":"Ts","\u0429":"Sht","\u042A":"A","\u042C":"Y","\u0439":"y","\u0446":"ts","\u0449":"sht","\u044A":"a","\u044C":"y"},"de":{"\xC4":"AE","\xE4":"ae","\xD6":"OE","\xF6":"oe","\xDC":"UE","\xFC":"ue","\xDF":"ss","%":"prozent","&":"und","|":"oder","\u2211":"summe","\u221E":"unendlich","\u2665":"liebe"},"es":{"%":"por ciento","&":"y","<":"menor que",">":"mayor que","|":"o","\xA2":"centavos","\xA3":"libras","\xA4":"moneda","\u20A3":"francos","\u2211":"suma","\u221E":"infinito","\u2665":"amor"},"fr":{"%":"pourcent","&":"et","<":"plus petit",">":"plus grand","|":"ou","\xA2":"centime","\xA3":"livre","\xA4":"devise","\u20A3":"franc","\u2211":"somme","\u221E":"infini","\u2665":"amour"},"pt":{"%":"porcento","&":"e","<":"menor",">":"maior","|":"ou","\xA2":"centavo","\u2211":"soma","\xA3":"libra","\u221E":"infinito","\u2665":"amor"},"uk":{"\u0418":"Y","\u0438":"y","\u0419":"Y","\u0439":"y","\u0426":"Ts","\u0446":"ts","\u0425":"Kh","\u0445":"kh","\u0429":"Shch","\u0449":"shch","\u0413":"H","\u0433":"h"},"vi":{"\u0110":"D","\u0111":"d"},"da":{"\xD8":"OE","\xF8":"oe","\xC5":"AA","\xE5":"aa","%":"procent","&":"og","|":"eller","$":"dollar","<":"mindre end",">":"st\xF8rre end"},"nb":{"&":"og","\xC5":"AA","\xC6":"AE","\xD8":"OE","\xE5":"aa","\xE6":"ae","\xF8":"oe"},"it":{"&":"e"},"nl":{"&":"en"},"sv":{"&":"och","\xC5":"AA","\xC4":"AE","\xD6":"OE","\xE5":"aa","\xE4":"ae","\xF6":"oe"}}');
|
|
11750
11869
|
init_consola_36c0034f();
|
|
11751
11870
|
init_core();
|
|
@@ -12096,12 +12215,16 @@ var config2 = {
|
|
|
12096
12215
|
type: "Select the type of change that you\u2019re committing:",
|
|
12097
12216
|
scope: "Select the SCOPE of this change (optional):",
|
|
12098
12217
|
customScope: "Select the SCOPE of this change:",
|
|
12099
|
-
subject:
|
|
12100
|
-
|
|
12101
|
-
|
|
12218
|
+
subject: `Write a SHORT, IMPERATIVE tense description of the change:
|
|
12219
|
+
`,
|
|
12220
|
+
body: `Provide a LONGER description of the change (optional). Use "|" to break new line:
|
|
12221
|
+
`,
|
|
12222
|
+
breaking: `List any BREAKING CHANGES (optional). Use "|" to break new line:
|
|
12223
|
+
`,
|
|
12102
12224
|
footerPrefixesSelect: "Select the ISSUES type of the change list by this change (optional):",
|
|
12103
12225
|
customFooterPrefixes: "Input ISSUES prefix:",
|
|
12104
|
-
footer:
|
|
12226
|
+
footer: `List any ISSUES by this change. E.g.: #31, #34:
|
|
12227
|
+
`,
|
|
12105
12228
|
confirmCommit: "Are you sure you want to proceed with the commit above?"
|
|
12106
12229
|
},
|
|
12107
12230
|
types: [
|
|
@@ -13128,7 +13251,8 @@ var import_escape = __toESM2(require_escape(), 1);
|
|
|
13128
13251
|
var import_normalizeEmail = __toESM2(require_normalizeEmail(), 1);
|
|
13129
13252
|
var CompilerBuffer = class _CompilerBuffer {
|
|
13130
13253
|
#content = "";
|
|
13131
|
-
newLine =
|
|
13254
|
+
newLine = `
|
|
13255
|
+
`;
|
|
13132
13256
|
writeStatement(statement) {
|
|
13133
13257
|
this.#content = `${this.#content}${this.newLine}${statement}`;
|
|
13134
13258
|
}
|
|
@@ -13266,7 +13390,8 @@ function defineFieldValidations({
|
|
|
13266
13390
|
variableName,
|
|
13267
13391
|
dropMissingCheck
|
|
13268
13392
|
}) {
|
|
13269
|
-
return `${validations.map((one) => emitValidationSnippet(one, variableName, bail, dropMissingCheck)).join(
|
|
13393
|
+
return `${validations.map((one) => emitValidationSnippet(one, variableName, bail, dropMissingCheck)).join(`
|
|
13394
|
+
`)}`;
|
|
13270
13395
|
}
|
|
13271
13396
|
function defineArrayInitialOutput({
|
|
13272
13397
|
variableName,
|
|
@@ -16379,12 +16504,16 @@ var git_default = {
|
|
|
16379
16504
|
type: "Select the type of change that you\u2019re committing:",
|
|
16380
16505
|
scope: "Select the SCOPE of this change (optional):",
|
|
16381
16506
|
customScope: "Select the SCOPE of this change:",
|
|
16382
|
-
subject:
|
|
16383
|
-
|
|
16384
|
-
|
|
16507
|
+
subject: `Write a SHORT, IMPERATIVE tense description of the change:
|
|
16508
|
+
`,
|
|
16509
|
+
body: `Provide a LONGER description of the change (optional). Use "|" to break new line:
|
|
16510
|
+
`,
|
|
16511
|
+
breaking: `List any BREAKING CHANGES (optional). Use "|" to break new line:
|
|
16512
|
+
`,
|
|
16385
16513
|
footerPrefixesSelect: "Select the ISSUES type of the change list by this change (optional):",
|
|
16386
16514
|
customFooterPrefixes: "Input ISSUES prefix:",
|
|
16387
|
-
footer:
|
|
16515
|
+
footer: `List any ISSUES by this change. E.g.: #31, #34:
|
|
16516
|
+
`,
|
|
16388
16517
|
confirmCommit: "Are you sure you want to proceed with the commit above?"
|
|
16389
16518
|
},
|
|
16390
16519
|
types: [
|
|
@@ -16924,7 +17053,7 @@ function determineAppEnv() {
|
|
|
16924
17053
|
if (app2.env === "production")
|
|
16925
17054
|
return "prod";
|
|
16926
17055
|
if (!app2.env)
|
|
16927
|
-
throw new Error("Couldn
|
|
17056
|
+
throw new Error("Couldn't determine app environment");
|
|
16928
17057
|
return app2.env;
|
|
16929
17058
|
}
|
|
16930
17059
|
|
|
@@ -16961,7 +17090,8 @@ class ErrorHandler {
|
|
|
16961
17090
|
console.error("Error is not an instance of Error:", err);
|
|
16962
17091
|
return;
|
|
16963
17092
|
}
|
|
16964
|
-
const formattedError = `[${new Date().toISOString()}] ${err.name}: ${err.message}
|
|
17093
|
+
const formattedError = `[${new Date().toISOString()}] ${err.name}: ${err.message}
|
|
17094
|
+
`;
|
|
16965
17095
|
const logFilePath = logsPath("stacks.log") ?? logsPath("errors.log");
|
|
16966
17096
|
try {
|
|
16967
17097
|
await mkdir(dirname(logFilePath), { recursive: true });
|
|
@@ -16999,7 +17129,8 @@ function handleError(err, options) {
|
|
|
16999
17129
|
return ErrorHandler.handle(err, options);
|
|
17000
17130
|
}
|
|
17001
17131
|
async function writeToLogFile(message, options) {
|
|
17002
|
-
const formattedMessage = `[${new Date().toISOString()}] ${message}
|
|
17132
|
+
const formattedMessage = `[${new Date().toISOString()}] ${message}
|
|
17133
|
+
`;
|
|
17003
17134
|
try {
|
|
17004
17135
|
const logFile = options?.logFile ?? exports_config.logging.logsPath ?? "storage/logs/stacks.log";
|
|
17005
17136
|
try {
|
|
@@ -17945,9 +18076,12 @@ function stringEncaseCRLFWithFirstIndex(string2, prefix, postfix, index) {
|
|
|
17945
18076
|
let returnValue = "";
|
|
17946
18077
|
do {
|
|
17947
18078
|
const gotCR = string2[index - 1] === "\r";
|
|
17948
|
-
returnValue += string2.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ?
|
|
18079
|
+
returnValue += string2.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? `\r
|
|
18080
|
+
` : `
|
|
18081
|
+
`) + postfix;
|
|
17949
18082
|
endIndex = index + 1;
|
|
17950
|
-
index = string2.indexOf(
|
|
18083
|
+
index = string2.indexOf(`
|
|
18084
|
+
`, endIndex);
|
|
17951
18085
|
} while (index !== -1);
|
|
17952
18086
|
returnValue += string2.slice(endIndex);
|
|
17953
18087
|
return returnValue;
|
|
@@ -18087,7 +18221,8 @@ var applyStyle = (self2, string2) => {
|
|
|
18087
18221
|
styler = styler.parent;
|
|
18088
18222
|
}
|
|
18089
18223
|
}
|
|
18090
|
-
const lfIndex = string2.indexOf(
|
|
18224
|
+
const lfIndex = string2.indexOf(`
|
|
18225
|
+
`);
|
|
18091
18226
|
if (lfIndex !== -1) {
|
|
18092
18227
|
string2 = stringEncaseCRLFWithFirstIndex(string2, closeAll, openAll, lfIndex);
|
|
18093
18228
|
}
|
|
@@ -18121,7 +18256,8 @@ var changePrototype = (to, from) => {
|
|
|
18121
18256
|
}
|
|
18122
18257
|
Object.setPrototypeOf(to, fromPrototype);
|
|
18123
18258
|
};
|
|
18124
|
-
var wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}
|
|
18259
|
+
var wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
|
|
18260
|
+
${fromBody}`;
|
|
18125
18261
|
var toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
|
|
18126
18262
|
var toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
|
|
18127
18263
|
var changeToString = (to, from, name) => {
|
|
@@ -18722,7 +18858,8 @@ class Ora {
|
|
|
18722
18858
|
const fullSuffixText = this.#getFullSuffixText(this.#suffixText, "-");
|
|
18723
18859
|
const fullText = " ".repeat(this.#indent) + fullPrefixText + "--" + this.#text + "--" + fullSuffixText;
|
|
18724
18860
|
this.#lineCount = 0;
|
|
18725
|
-
for (const line of stripAnsi3(fullText).split(
|
|
18861
|
+
for (const line of stripAnsi3(fullText).split(`
|
|
18862
|
+
`)) {
|
|
18726
18863
|
this.#lineCount += Math.max(1, Math.ceil(stringWidth2(line, { countAnsiEscapeCodes: true }) / columns));
|
|
18727
18864
|
}
|
|
18728
18865
|
}
|
|
@@ -18792,7 +18929,8 @@ class Ora {
|
|
|
18792
18929
|
}
|
|
18793
18930
|
if (!this.#isEnabled) {
|
|
18794
18931
|
if (this.text) {
|
|
18795
|
-
this.#stream.write(`- ${this.text}
|
|
18932
|
+
this.#stream.write(`- ${this.text}
|
|
18933
|
+
`);
|
|
18796
18934
|
}
|
|
18797
18935
|
return this;
|
|
18798
18936
|
}
|
|
@@ -18850,7 +18988,8 @@ class Ora {
|
|
|
18850
18988
|
const fullText = typeof text2 === "string" ? " " + text2 : "";
|
|
18851
18989
|
const suffixText = options2.suffixText ?? this.#suffixText;
|
|
18852
18990
|
const fullSuffixText = this.#getFullSuffixText(suffixText, " ");
|
|
18853
|
-
const textToWrite = fullPrefixText + symbolText + fullText + fullSuffixText +
|
|
18991
|
+
const textToWrite = fullPrefixText + symbolText + fullText + fullSuffixText + `
|
|
18992
|
+
`;
|
|
18854
18993
|
this.stop();
|
|
18855
18994
|
this.#stream.write(textToWrite);
|
|
18856
18995
|
return this;
|
|
@@ -20397,183 +20536,9 @@ var quotes = collect([
|
|
|
20397
20536
|
]);
|
|
20398
20537
|
var export_prompts = import_prompts.default;
|
|
20399
20538
|
|
|
20400
|
-
// src/utils.ts
|
|
20401
|
-
import { homedir } from "os";
|
|
20402
|
-
import { join as join2 } from "path";
|
|
20403
|
-
function keyPath() {
|
|
20404
|
-
if (typeof config.https === "boolean")
|
|
20405
|
-
return join2(homedir(), ".stacks", "ssl", `stacks.localhost.key`);
|
|
20406
|
-
return config.https.keyPath;
|
|
20407
|
-
}
|
|
20408
|
-
function certPath() {
|
|
20409
|
-
if (typeof config.https === "boolean")
|
|
20410
|
-
return join2(homedir(), ".stacks", "ssl", `stacks.localhost.crt`);
|
|
20411
|
-
return config.https.certPath;
|
|
20412
|
-
}
|
|
20413
|
-
function caCertPath() {
|
|
20414
|
-
if (typeof config.https === "boolean")
|
|
20415
|
-
return join2(homedir(), ".stacks", "ssl", `stacks.localhost.ca.crt`);
|
|
20416
|
-
return config.https.caCertPath;
|
|
20417
|
-
}
|
|
20418
|
-
function debugLog(category, message, verbose) {
|
|
20419
|
-
if (verbose || config.verbose) {
|
|
20420
|
-
console.debug(`[rpx:${category}] ${message}`);
|
|
20421
|
-
}
|
|
20422
|
-
}
|
|
20423
|
-
|
|
20424
|
-
// src/hosts.ts
|
|
20425
|
-
var hostsFilePath = process3.platform === "win32" ? path2.join(process3.env.windir || "C:\\Windows", "System32", "drivers", "etc", "hosts") : "/etc/hosts";
|
|
20426
|
-
async function sudoWrite(operation, content) {
|
|
20427
|
-
return new Promise((resolve3, reject) => {
|
|
20428
|
-
if (process3.platform === "win32") {
|
|
20429
|
-
reject(new Error("Administrator privileges required on Windows"));
|
|
20430
|
-
return;
|
|
20431
|
-
}
|
|
20432
|
-
const tmpFile = path2.join(os3.tmpdir(), "hosts.tmp");
|
|
20433
|
-
try {
|
|
20434
|
-
if (operation === "append") {
|
|
20435
|
-
const currentContent = fs.readFileSync(hostsFilePath, "utf8");
|
|
20436
|
-
fs.writeFileSync(tmpFile, currentContent + content, "utf8");
|
|
20437
|
-
} else {
|
|
20438
|
-
fs.writeFileSync(tmpFile, content, "utf8");
|
|
20439
|
-
}
|
|
20440
|
-
const sudo = spawn("sudo", ["cp", tmpFile, hostsFilePath]);
|
|
20441
|
-
sudo.on("close", (code) => {
|
|
20442
|
-
try {
|
|
20443
|
-
fs.unlinkSync(tmpFile);
|
|
20444
|
-
if (code === 0)
|
|
20445
|
-
resolve3();
|
|
20446
|
-
else
|
|
20447
|
-
reject(new Error(`sudo process exited with code ${code}`));
|
|
20448
|
-
} catch (err2) {
|
|
20449
|
-
reject(err2);
|
|
20450
|
-
}
|
|
20451
|
-
});
|
|
20452
|
-
sudo.on("error", (err2) => {
|
|
20453
|
-
try {
|
|
20454
|
-
fs.unlinkSync(tmpFile);
|
|
20455
|
-
} catch {
|
|
20456
|
-
}
|
|
20457
|
-
reject(err2);
|
|
20458
|
-
});
|
|
20459
|
-
} catch (err2) {
|
|
20460
|
-
reject(err2);
|
|
20461
|
-
}
|
|
20462
|
-
});
|
|
20463
|
-
}
|
|
20464
|
-
async function addHosts(hosts) {
|
|
20465
|
-
debugLog("hosts", `Adding hosts: ${hosts.join(", ")}`, config.verbose);
|
|
20466
|
-
debugLog("hosts", `Using hosts file at: ${hostsFilePath}`, config.verbose);
|
|
20467
|
-
try {
|
|
20468
|
-
const existingContent = await fs.promises.readFile(hostsFilePath, "utf-8");
|
|
20469
|
-
const newEntries = hosts.filter((host) => {
|
|
20470
|
-
const ipv4Entry = `127.0.0.1 ${host}`;
|
|
20471
|
-
const ipv6Entry = `::1 ${host}`;
|
|
20472
|
-
return !existingContent.includes(ipv4Entry) && !existingContent.includes(ipv6Entry);
|
|
20473
|
-
});
|
|
20474
|
-
if (newEntries.length === 0) {
|
|
20475
|
-
debugLog("hosts", "All hosts already exist in hosts file", config.verbose);
|
|
20476
|
-
log.info("All hosts are already in the hosts file");
|
|
20477
|
-
return;
|
|
20478
|
-
}
|
|
20479
|
-
const hostEntries = newEntries.map((host) => `\n# Added by rpx\n127.0.0.1 ${host}\n::1 ${host}`).join("\n");
|
|
20480
|
-
try {
|
|
20481
|
-
await fs.promises.appendFile(hostsFilePath, hostEntries, { flag: "a" });
|
|
20482
|
-
log.success(`Added new hosts: ${newEntries.join(", ")}`);
|
|
20483
|
-
} catch (writeErr) {
|
|
20484
|
-
if (writeErr.code === "EACCES") {
|
|
20485
|
-
debugLog("hosts", "Permission denied, attempting with sudo", config.verbose);
|
|
20486
|
-
try {
|
|
20487
|
-
await sudoWrite("append", hostEntries);
|
|
20488
|
-
log.success(`Added new hosts with sudo: ${newEntries.join(", ")}`);
|
|
20489
|
-
} catch (sudoErr) {
|
|
20490
|
-
log.error("Failed to modify hosts file automatically");
|
|
20491
|
-
log.warn("Please add these entries to your hosts file manually:");
|
|
20492
|
-
hostEntries.split("\n").forEach((entry) => log.warn(entry));
|
|
20493
|
-
if (process3.platform === "win32") {
|
|
20494
|
-
log.warn("\nOn Windows:");
|
|
20495
|
-
log.warn("1. Run notepad as administrator");
|
|
20496
|
-
log.warn("2. Open C:\\Windows\\System32\\drivers\\etc\\hosts");
|
|
20497
|
-
} else {
|
|
20498
|
-
log.warn("\nOn Unix systems:");
|
|
20499
|
-
log.warn(`sudo nano ${hostsFilePath}`);
|
|
20500
|
-
}
|
|
20501
|
-
throw new Error("Failed to modify hosts file: manual intervention required");
|
|
20502
|
-
}
|
|
20503
|
-
} else {
|
|
20504
|
-
throw writeErr;
|
|
20505
|
-
}
|
|
20506
|
-
}
|
|
20507
|
-
} catch (err2) {
|
|
20508
|
-
const error = err2;
|
|
20509
|
-
log.error(`Failed to manage hosts file: ${error.message}`);
|
|
20510
|
-
throw error;
|
|
20511
|
-
}
|
|
20512
|
-
}
|
|
20513
|
-
async function removeHosts(hosts) {
|
|
20514
|
-
debugLog("hosts", `Removing hosts: ${hosts.join(", ")}`, config.verbose);
|
|
20515
|
-
try {
|
|
20516
|
-
const content = await fs.promises.readFile(hostsFilePath, "utf-8");
|
|
20517
|
-
const lines = content.split("\n");
|
|
20518
|
-
const filteredLines = lines.filter((line, index) => {
|
|
20519
|
-
if (line.trim() === "# Added by rpx") {
|
|
20520
|
-
lines.splice(index + 1, 2);
|
|
20521
|
-
return false;
|
|
20522
|
-
}
|
|
20523
|
-
return true;
|
|
20524
|
-
});
|
|
20525
|
-
while (filteredLines[filteredLines.length - 1]?.trim() === "")
|
|
20526
|
-
filteredLines.pop();
|
|
20527
|
-
const newContent = `${filteredLines.join("\n")}\n`;
|
|
20528
|
-
try {
|
|
20529
|
-
await fs.promises.writeFile(hostsFilePath, newContent);
|
|
20530
|
-
log.success("Hosts removed successfully");
|
|
20531
|
-
} catch (writeErr) {
|
|
20532
|
-
if (writeErr.code === "EACCES") {
|
|
20533
|
-
debugLog("hosts", "Permission denied, attempting with sudo", config.verbose);
|
|
20534
|
-
try {
|
|
20535
|
-
await sudoWrite("write", newContent);
|
|
20536
|
-
log.success("Hosts removed successfully with sudo");
|
|
20537
|
-
} catch (sudoErr) {
|
|
20538
|
-
log.error("Failed to modify hosts file automatically");
|
|
20539
|
-
log.warn("Please remove these entries from your hosts file manually:");
|
|
20540
|
-
hosts.forEach((host) => {
|
|
20541
|
-
log.warn("# Added by rpx");
|
|
20542
|
-
log.warn(`127.0.0.1 ${host}`);
|
|
20543
|
-
log.warn(`::1 ${host}`);
|
|
20544
|
-
});
|
|
20545
|
-
if (process3.platform === "win32") {
|
|
20546
|
-
log.warn("\nOn Windows:");
|
|
20547
|
-
log.warn("1. Run notepad as administrator");
|
|
20548
|
-
log.warn("2. Open C:\\Windows\\System32\\drivers\\etc\\hosts");
|
|
20549
|
-
} else {
|
|
20550
|
-
log.warn("\nOn Unix systems:");
|
|
20551
|
-
log.warn(`sudo nano ${hostsFilePath}`);
|
|
20552
|
-
}
|
|
20553
|
-
throw new Error("Failed to modify hosts file: manual intervention required");
|
|
20554
|
-
}
|
|
20555
|
-
} else {
|
|
20556
|
-
throw writeErr;
|
|
20557
|
-
}
|
|
20558
|
-
}
|
|
20559
|
-
} catch (err2) {
|
|
20560
|
-
const error = err2;
|
|
20561
|
-
log.error(`Failed to remove hosts: ${error.message}`);
|
|
20562
|
-
throw error;
|
|
20563
|
-
}
|
|
20564
|
-
}
|
|
20565
|
-
async function checkHosts(hosts) {
|
|
20566
|
-
debugLog("hosts", `Checking hosts: ${hosts}`, config.verbose);
|
|
20567
|
-
const content = await fs.promises.readFile(hostsFilePath, "utf-8");
|
|
20568
|
-
return hosts.map((host) => {
|
|
20569
|
-
const ipv4Entry = `127.0.0.1 ${host}`;
|
|
20570
|
-
const ipv6Entry = `::1 ${host}`;
|
|
20571
|
-
return content.includes(ipv4Entry) || content.includes(ipv6Entry);
|
|
20572
|
-
});
|
|
20573
|
-
}
|
|
20574
20539
|
// src/https.ts
|
|
20575
|
-
import
|
|
20576
|
-
import
|
|
20540
|
+
import os5 from "os";
|
|
20541
|
+
import path4 from "path";
|
|
20577
20542
|
|
|
20578
20543
|
// node_modules/@stacksjs/tlsx/dist/index.js
|
|
20579
20544
|
import fs2 from "fs";
|
|
@@ -20597,7 +20562,7 @@ import {
|
|
|
20597
20562
|
dirname as dirname3,
|
|
20598
20563
|
extname as extname2,
|
|
20599
20564
|
isAbsolute as isAbsolute2,
|
|
20600
|
-
join as
|
|
20565
|
+
join as join2,
|
|
20601
20566
|
normalize as normalize2,
|
|
20602
20567
|
parse as parse2,
|
|
20603
20568
|
relative as relative2,
|
|
@@ -20612,7 +20577,7 @@ import process8 from "process";
|
|
|
20612
20577
|
import process102 from "process";
|
|
20613
20578
|
import process182 from "process";
|
|
20614
20579
|
import process112 from "process";
|
|
20615
|
-
import
|
|
20580
|
+
import os3 from "os";
|
|
20616
20581
|
import tty32 from "tty";
|
|
20617
20582
|
import process142 from "process";
|
|
20618
20583
|
import process132 from "process";
|
|
@@ -20621,10 +20586,10 @@ import process162 from "process";
|
|
|
20621
20586
|
import process172 from "process";
|
|
20622
20587
|
import process192 from "process";
|
|
20623
20588
|
import os22 from "os";
|
|
20624
|
-
import
|
|
20589
|
+
import path2 from "path";
|
|
20625
20590
|
import { resolve as resolve3 } from "path";
|
|
20626
20591
|
import process22 from "process";
|
|
20627
|
-
import
|
|
20592
|
+
import fs from "fs";
|
|
20628
20593
|
import path22 from "path";
|
|
20629
20594
|
var __create3 = Object.create;
|
|
20630
20595
|
var __getProtoOf3 = Object.getPrototypeOf;
|
|
@@ -20689,7 +20654,8 @@ var require_baseN = __commonJS2((exports, module) => {
|
|
|
20689
20654
|
}
|
|
20690
20655
|
if (maxline) {
|
|
20691
20656
|
var regex3 = new RegExp(".{1," + maxline + "}", "g");
|
|
20692
|
-
output = output.match(regex3).join(
|
|
20657
|
+
output = output.match(regex3).join(`\r
|
|
20658
|
+
`);
|
|
20693
20659
|
}
|
|
20694
20660
|
return output;
|
|
20695
20661
|
};
|
|
@@ -21546,7 +21512,8 @@ var require_util3 = __commonJS2((exports, module) => {
|
|
|
21546
21512
|
line += isNaN(chr3) ? "=" : _base64.charAt(chr3 & 63);
|
|
21547
21513
|
}
|
|
21548
21514
|
if (maxline && line.length > maxline) {
|
|
21549
|
-
output += line.substr(0, maxline) +
|
|
21515
|
+
output += line.substr(0, maxline) + `\r
|
|
21516
|
+
`;
|
|
21550
21517
|
line = line.substr(maxline);
|
|
21551
21518
|
}
|
|
21552
21519
|
}
|
|
@@ -21639,7 +21606,8 @@ var require_util3 = __commonJS2((exports, module) => {
|
|
|
21639
21606
|
line += isNaN(chr3) ? "=" : _base64.charAt(chr3 & 63);
|
|
21640
21607
|
}
|
|
21641
21608
|
if (maxline && line.length > maxline) {
|
|
21642
|
-
output += line.substr(0, maxline) +
|
|
21609
|
+
output += line.substr(0, maxline) + `\r
|
|
21610
|
+
`;
|
|
21643
21611
|
line = line.substr(maxline);
|
|
21644
21612
|
}
|
|
21645
21613
|
}
|
|
@@ -23843,7 +23811,8 @@ var require_asn1 = __commonJS2((exports, module) => {
|
|
|
23843
23811
|
level = level || 0;
|
|
23844
23812
|
indentation = indentation || 2;
|
|
23845
23813
|
if (level > 0) {
|
|
23846
|
-
rval +=
|
|
23814
|
+
rval += `
|
|
23815
|
+
`;
|
|
23847
23816
|
}
|
|
23848
23817
|
var indent = "";
|
|
23849
23818
|
for (var i = 0;i < level * indentation; ++i) {
|
|
@@ -23934,8 +23903,10 @@ var require_asn1 = __commonJS2((exports, module) => {
|
|
|
23934
23903
|
} else {
|
|
23935
23904
|
rval += obj.type;
|
|
23936
23905
|
}
|
|
23937
|
-
rval +=
|
|
23938
|
-
|
|
23906
|
+
rval += `
|
|
23907
|
+
`;
|
|
23908
|
+
rval += indent + "Constructed: " + obj.constructed + `
|
|
23909
|
+
`;
|
|
23939
23910
|
if (obj.composed) {
|
|
23940
23911
|
var subvalues = 0;
|
|
23941
23912
|
var sub = "";
|
|
@@ -24382,7 +24353,8 @@ var require_pem = __commonJS2((exports, module) => {
|
|
|
24382
24353
|
var pem = module.exports = forge.pem = forge.pem || {};
|
|
24383
24354
|
pem.encode = function(msg, options2) {
|
|
24384
24355
|
options2 = options2 || {};
|
|
24385
|
-
var rval = "-----BEGIN " + msg.type +
|
|
24356
|
+
var rval = "-----BEGIN " + msg.type + `-----\r
|
|
24357
|
+
`;
|
|
24386
24358
|
var header;
|
|
24387
24359
|
if (msg.procType) {
|
|
24388
24360
|
header = {
|
|
@@ -24408,10 +24380,13 @@ var require_pem = __commonJS2((exports, module) => {
|
|
|
24408
24380
|
}
|
|
24409
24381
|
}
|
|
24410
24382
|
if (msg.procType) {
|
|
24411
|
-
rval +=
|
|
24383
|
+
rval += `\r
|
|
24384
|
+
`;
|
|
24412
24385
|
}
|
|
24413
|
-
rval += forge.util.encode64(msg.body, options2.maxline || 64) +
|
|
24414
|
-
|
|
24386
|
+
rval += forge.util.encode64(msg.body, options2.maxline || 64) + `\r
|
|
24387
|
+
`;
|
|
24388
|
+
rval += "-----END " + msg.type + `-----\r
|
|
24389
|
+
`;
|
|
24415
24390
|
return rval;
|
|
24416
24391
|
};
|
|
24417
24392
|
pem.decode = function(str) {
|
|
@@ -24498,7 +24473,8 @@ var require_pem = __commonJS2((exports, module) => {
|
|
|
24498
24473
|
for (var i = 0;i < header.values.length; ++i) {
|
|
24499
24474
|
values2.push(header.values[i].replace(/^(\S+\r\n)/, insertSpace));
|
|
24500
24475
|
}
|
|
24501
|
-
rval += values2.join(",") +
|
|
24476
|
+
rval += values2.join(",") + `\r
|
|
24477
|
+
`;
|
|
24502
24478
|
var length = 0;
|
|
24503
24479
|
var candidate = -1;
|
|
24504
24480
|
for (var i = 0;i < rval.length; ++i, ++length) {
|
|
@@ -24506,9 +24482,11 @@ var require_pem = __commonJS2((exports, module) => {
|
|
|
24506
24482
|
var insert = rval[candidate];
|
|
24507
24483
|
if (insert === ",") {
|
|
24508
24484
|
++candidate;
|
|
24509
|
-
rval = rval.substr(0, candidate) +
|
|
24485
|
+
rval = rval.substr(0, candidate) + `\r
|
|
24486
|
+
` + rval.substr(candidate);
|
|
24510
24487
|
} else {
|
|
24511
|
-
rval = rval.substr(0, candidate) +
|
|
24488
|
+
rval = rval.substr(0, candidate) + `\r
|
|
24489
|
+
` + insert + rval.substr(candidate + 1);
|
|
24512
24490
|
}
|
|
24513
24491
|
length = i - candidate - 1;
|
|
24514
24492
|
candidate = -1;
|
|
@@ -25941,13 +25919,13 @@ var require_jsbn = __commonJS2((exports, module) => {
|
|
|
25941
25919
|
var BI_RC = new Array;
|
|
25942
25920
|
var rr;
|
|
25943
25921
|
var vv;
|
|
25944
|
-
rr =
|
|
25922
|
+
rr = 48;
|
|
25945
25923
|
for (vv = 0;vv <= 9; ++vv)
|
|
25946
25924
|
BI_RC[rr++] = vv;
|
|
25947
|
-
rr =
|
|
25925
|
+
rr = 97;
|
|
25948
25926
|
for (vv = 10;vv < 36; ++vv)
|
|
25949
25927
|
BI_RC[rr++] = vv;
|
|
25950
|
-
rr =
|
|
25928
|
+
rr = 65;
|
|
25951
25929
|
for (vv = 10;vv < 36; ++vv)
|
|
25952
25930
|
BI_RC[rr++] = vv;
|
|
25953
25931
|
function int2char(n) {
|
|
@@ -27427,7 +27405,7 @@ var require_pkcs1 = __commonJS2((exports, module) => {
|
|
|
27427
27405
|
var PS = "";
|
|
27428
27406
|
var PS_length = maxLength - message.length;
|
|
27429
27407
|
for (var i = 0;i < PS_length; i++) {
|
|
27430
|
-
PS += "\
|
|
27408
|
+
PS += "\x00";
|
|
27431
27409
|
}
|
|
27432
27410
|
var DB = lHash.getBytes() + PS + "\x01" + message;
|
|
27433
27411
|
if (!seed) {
|
|
@@ -27442,7 +27420,7 @@ var require_pkcs1 = __commonJS2((exports, module) => {
|
|
|
27442
27420
|
var maskedDB = forge.util.xorBytes(DB, dbMask, DB.length);
|
|
27443
27421
|
var seedMask = rsa_mgf1(maskedDB, md.digestLength, mgf1Md);
|
|
27444
27422
|
var maskedSeed = forge.util.xorBytes(seed, seedMask, seed.length);
|
|
27445
|
-
return "\
|
|
27423
|
+
return "\x00" + maskedSeed + maskedDB;
|
|
27446
27424
|
};
|
|
27447
27425
|
pkcs1.decode_rsa_oaep = function(key, em, options2) {
|
|
27448
27426
|
var label;
|
|
@@ -27489,7 +27467,7 @@ var require_pkcs1 = __commonJS2((exports, module) => {
|
|
|
27489
27467
|
var dbMask = rsa_mgf1(seed, keyLength - md.digestLength - 1, mgf1Md);
|
|
27490
27468
|
var db = forge.util.xorBytes(maskedDB, dbMask, maskedDB.length);
|
|
27491
27469
|
var lHashPrime = db.substring(0, md.digestLength);
|
|
27492
|
-
var error = y !== "\
|
|
27470
|
+
var error = y !== "\x00";
|
|
27493
27471
|
for (var i = 0;i < md.digestLength; ++i) {
|
|
27494
27472
|
error |= lHash.charAt(i) !== lHashPrime.charAt(i);
|
|
27495
27473
|
}
|
|
@@ -30515,7 +30493,7 @@ var require_x509 = __commonJS2((exports, module) => {
|
|
|
30515
30493
|
if (!cert.issued(child)) {
|
|
30516
30494
|
var issuer = child.issuer;
|
|
30517
30495
|
var subject = cert.subject;
|
|
30518
|
-
var error = new Error("The parent certificate did not issue the given child " + "certificate; the child certificate
|
|
30496
|
+
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.");
|
|
30519
30497
|
error.expectedIssuer = subject.attributes;
|
|
30520
30498
|
error.actualIssuer = issuer.attributes;
|
|
30521
30499
|
throw error;
|
|
@@ -31548,7 +31526,7 @@ var require_x509 = __commonJS2((exports, module) => {
|
|
|
31548
31526
|
if (keyUsageExt !== null) {
|
|
31549
31527
|
if (!keyUsageExt.keyCertSign || bcExt === null) {
|
|
31550
31528
|
error = {
|
|
31551
|
-
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
|
|
31529
|
+
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.",
|
|
31552
31530
|
error: pki.certificateError.bad_certificate
|
|
31553
31531
|
};
|
|
31554
31532
|
}
|
|
@@ -36777,16 +36755,20 @@ var require_ssh = __commonJS2((exports, module) => {
|
|
|
36777
36755
|
passphrase = passphrase || "";
|
|
36778
36756
|
var algorithm = "ssh-rsa";
|
|
36779
36757
|
var encryptionAlgorithm = passphrase === "" ? "none" : "aes256-cbc";
|
|
36780
|
-
var ppk = "PuTTY-User-Key-File-2: " + algorithm +
|
|
36781
|
-
|
|
36782
|
-
ppk += "
|
|
36758
|
+
var ppk = "PuTTY-User-Key-File-2: " + algorithm + `\r
|
|
36759
|
+
`;
|
|
36760
|
+
ppk += "Encryption: " + encryptionAlgorithm + `\r
|
|
36761
|
+
`;
|
|
36762
|
+
ppk += "Comment: " + comment + `\r
|
|
36763
|
+
`;
|
|
36783
36764
|
var pubbuffer = forge.util.createBuffer();
|
|
36784
36765
|
_addStringToBuffer(pubbuffer, algorithm);
|
|
36785
36766
|
_addBigIntegerToBuffer(pubbuffer, privateKey.e);
|
|
36786
36767
|
_addBigIntegerToBuffer(pubbuffer, privateKey.n);
|
|
36787
36768
|
var pub = forge.util.encode64(pubbuffer.bytes(), 64);
|
|
36788
36769
|
var length = Math.floor(pub.length / 66) + 1;
|
|
36789
|
-
ppk += "Public-Lines: " + length +
|
|
36770
|
+
ppk += "Public-Lines: " + length + `\r
|
|
36771
|
+
`;
|
|
36790
36772
|
ppk += pub;
|
|
36791
36773
|
var privbuffer = forge.util.createBuffer();
|
|
36792
36774
|
_addBigIntegerToBuffer(privbuffer, privateKey.d);
|
|
@@ -36803,8 +36785,8 @@ var require_ssh = __commonJS2((exports, module) => {
|
|
|
36803
36785
|
padding.truncate(padding.length() - encLen + privbuffer.length());
|
|
36804
36786
|
privbuffer.putBuffer(padding);
|
|
36805
36787
|
var aeskey = forge.util.createBuffer();
|
|
36806
|
-
aeskey.putBuffer(_sha1("\
|
|
36807
|
-
aeskey.putBuffer(_sha1("\
|
|
36788
|
+
aeskey.putBuffer(_sha1("\x00\x00\x00\x00", passphrase));
|
|
36789
|
+
aeskey.putBuffer(_sha1("\x00\x00\x00\x01", passphrase));
|
|
36808
36790
|
var cipher = forge.aes.createEncryptionCipher(aeskey.truncate(8), "CBC");
|
|
36809
36791
|
cipher.start(forge.util.createBuffer().fillWithByte(0, 16));
|
|
36810
36792
|
cipher.update(privbuffer.copy());
|
|
@@ -36814,7 +36796,9 @@ var require_ssh = __commonJS2((exports, module) => {
|
|
|
36814
36796
|
priv = forge.util.encode64(encrypted.bytes(), 64);
|
|
36815
36797
|
}
|
|
36816
36798
|
length = Math.floor(priv.length / 66) + 1;
|
|
36817
|
-
ppk +=
|
|
36799
|
+
ppk += `\r
|
|
36800
|
+
Private-Lines: ` + length + `\r
|
|
36801
|
+
`;
|
|
36818
36802
|
ppk += priv;
|
|
36819
36803
|
var mackey = _sha1("putty-private-key-file-mac-key", passphrase);
|
|
36820
36804
|
var macbuffer = forge.util.createBuffer();
|
|
@@ -36828,7 +36812,9 @@ var require_ssh = __commonJS2((exports, module) => {
|
|
|
36828
36812
|
var hmac = forge.hmac.create();
|
|
36829
36813
|
hmac.start("sha1", mackey);
|
|
36830
36814
|
hmac.update(macbuffer.bytes());
|
|
36831
|
-
ppk +=
|
|
36815
|
+
ppk += `\r
|
|
36816
|
+
Private-MAC: ` + hmac.digest().toHex() + `\r
|
|
36817
|
+
`;
|
|
36832
36818
|
return ppk;
|
|
36833
36819
|
};
|
|
36834
36820
|
ssh.publicKeyToOpenSSH = function(key, comment) {
|
|
@@ -37185,9 +37171,12 @@ class Consola2 {
|
|
|
37185
37171
|
}
|
|
37186
37172
|
if (logObj.additional) {
|
|
37187
37173
|
if (!Array.isArray(logObj.additional)) {
|
|
37188
|
-
logObj.additional = logObj.additional.split(
|
|
37174
|
+
logObj.additional = logObj.additional.split(`
|
|
37175
|
+
`);
|
|
37189
37176
|
}
|
|
37190
|
-
logObj.args.push(
|
|
37177
|
+
logObj.args.push(`
|
|
37178
|
+
` + logObj.additional.join(`
|
|
37179
|
+
`));
|
|
37191
37180
|
delete logObj.additional;
|
|
37192
37181
|
}
|
|
37193
37182
|
logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
|
|
@@ -37332,7 +37321,8 @@ var init_core2 = __esm2(() => {
|
|
|
37332
37321
|
});
|
|
37333
37322
|
function parseStack2(stack) {
|
|
37334
37323
|
const cwd = process.cwd() + sep3;
|
|
37335
|
-
const lines = stack.split(
|
|
37324
|
+
const lines = stack.split(`
|
|
37325
|
+
`).splice(1).map((l22) => l22.trim().replace("file://", "").replace(cwd, ""));
|
|
37336
37326
|
return lines;
|
|
37337
37327
|
}
|
|
37338
37328
|
function writeStream2(data, stream) {
|
|
@@ -37342,12 +37332,14 @@ function writeStream2(data, stream) {
|
|
|
37342
37332
|
|
|
37343
37333
|
class BasicReporter2 {
|
|
37344
37334
|
formatStack(stack, opts) {
|
|
37345
|
-
return " " + parseStack2(stack).join(
|
|
37335
|
+
return " " + parseStack2(stack).join(`
|
|
37336
|
+
`);
|
|
37346
37337
|
}
|
|
37347
37338
|
formatArgs(args, opts) {
|
|
37348
37339
|
const _args = args.map((arg) => {
|
|
37349
37340
|
if (arg && typeof arg.stack === "string") {
|
|
37350
|
-
return arg.message +
|
|
37341
|
+
return arg.message + `
|
|
37342
|
+
` + this.formatStack(arg.stack, opts);
|
|
37351
37343
|
}
|
|
37352
37344
|
return arg;
|
|
37353
37345
|
});
|
|
@@ -37362,11 +37354,15 @@ class BasicReporter2 {
|
|
|
37362
37354
|
formatLogObj(logObj, opts) {
|
|
37363
37355
|
const message = this.formatArgs(logObj.args, opts);
|
|
37364
37356
|
if (logObj.type === "box") {
|
|
37365
|
-
return
|
|
37357
|
+
return `
|
|
37358
|
+
` + [
|
|
37366
37359
|
bracket2(logObj.tag),
|
|
37367
37360
|
logObj.title && logObj.title,
|
|
37368
|
-
...message.split(
|
|
37369
|
-
|
|
37361
|
+
...message.split(`
|
|
37362
|
+
`)
|
|
37363
|
+
].filter(Boolean).map((l22) => " > " + l22).join(`
|
|
37364
|
+
`) + `
|
|
37365
|
+
`;
|
|
37370
37366
|
}
|
|
37371
37367
|
return this.filterAndJoin([
|
|
37372
37368
|
bracket2(logObj.type),
|
|
@@ -37379,7 +37375,8 @@ class BasicReporter2 {
|
|
|
37379
37375
|
columns: ctx.options.stdout.columns || 0,
|
|
37380
37376
|
...ctx.options.formatOptions
|
|
37381
37377
|
});
|
|
37382
|
-
return writeStream2(line +
|
|
37378
|
+
return writeStream2(line + `
|
|
37379
|
+
`, logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout);
|
|
37383
37380
|
}
|
|
37384
37381
|
}
|
|
37385
37382
|
var bracket2 = (x2) => x2 ? `[${x2}]` : "";
|
|
@@ -37414,7 +37411,8 @@ function box2(text2, _opts = {}) {
|
|
|
37414
37411
|
..._opts.style
|
|
37415
37412
|
}
|
|
37416
37413
|
};
|
|
37417
|
-
const textLines = text2.split(
|
|
37414
|
+
const textLines = text2.split(`
|
|
37415
|
+
`);
|
|
37418
37416
|
const boxLines = [];
|
|
37419
37417
|
const _color = getColor3(opts.style.borderColor);
|
|
37420
37418
|
const borderStyle = {
|
|
@@ -37455,7 +37453,8 @@ function box2(text2, _opts = {}) {
|
|
|
37455
37453
|
if (opts.style.marginBottom > 0) {
|
|
37456
37454
|
boxLines.push("".repeat(opts.style.marginBottom));
|
|
37457
37455
|
}
|
|
37458
|
-
return boxLines.join(
|
|
37456
|
+
return boxLines.join(`
|
|
37457
|
+
`);
|
|
37459
37458
|
}
|
|
37460
37459
|
var env22;
|
|
37461
37460
|
var argv2;
|
|
@@ -37743,7 +37742,7 @@ class h22 {
|
|
|
37743
37742
|
}
|
|
37744
37743
|
this.state !== "error" && (this.state = "submit");
|
|
37745
37744
|
}
|
|
37746
|
-
u === "
|
|
37745
|
+
u === "\x03" && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
37747
37746
|
}
|
|
37748
37747
|
close() {
|
|
37749
37748
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
@@ -38014,7 +38013,8 @@ ${colors2.yellow(S_BAR_END2)} ${colors2.yellow(this.error)}
|
|
|
38014
38013
|
return `${title}${colors2.gray(S_BAR2)} ${colors2.dim(this.value || opts.placeholder)}`;
|
|
38015
38014
|
}
|
|
38016
38015
|
case "cancel": {
|
|
38017
|
-
return `${title}${colors2.gray(S_BAR2)} ${colors2.strikethrough(colors2.dim(this.value ?? ""))}${this.value?.trim() ?
|
|
38016
|
+
return `${title}${colors2.gray(S_BAR2)} ${colors2.strikethrough(colors2.dim(this.value ?? ""))}${this.value?.trim() ? `
|
|
38017
|
+
` + colors2.gray(S_BAR2) : ""}`;
|
|
38018
38018
|
}
|
|
38019
38019
|
default: {
|
|
38020
38020
|
return `${title}${colors2.cyan(S_BAR2)} ${value}
|
|
@@ -38142,7 +38142,9 @@ ${symbol2(this.state)} ${opts.message}
|
|
|
38142
38142
|
${colors2.gray(S_BAR2)}` : ""}`;
|
|
38143
38143
|
}
|
|
38144
38144
|
case "error": {
|
|
38145
|
-
const footer = this.error.split(
|
|
38145
|
+
const footer = this.error.split(`
|
|
38146
|
+
`).map((ln, i) => i === 0 ? `${colors2.yellow(S_BAR_END2)} ${colors2.yellow(ln)}` : ` ${ln}`).join(`
|
|
38147
|
+
`);
|
|
38146
38148
|
return title + colors2.yellow(S_BAR2) + " " + this.options.map((option, i) => {
|
|
38147
38149
|
const selected = this.value.includes(option.value);
|
|
38148
38150
|
const active = i === this.cursor;
|
|
@@ -38154,7 +38156,9 @@ ${colors2.gray(S_BAR2)}` : ""}`;
|
|
|
38154
38156
|
}
|
|
38155
38157
|
return opt(option, active ? "active" : "inactive");
|
|
38156
38158
|
}).join(`
|
|
38157
|
-
${colors2.yellow(S_BAR2)} `) +
|
|
38159
|
+
${colors2.yellow(S_BAR2)} `) + `
|
|
38160
|
+
` + footer + `
|
|
38161
|
+
`;
|
|
38158
38162
|
}
|
|
38159
38163
|
default: {
|
|
38160
38164
|
return `${title}${colors2.cyan(S_BAR2)} ${this.options.map((option, i) => {
|
|
@@ -38716,7 +38720,9 @@ var init_consola_36c0034f2 = __esm2(() => {
|
|
|
38716
38720
|
};
|
|
38717
38721
|
FancyReporter2 = class FancyReporter22 extends BasicReporter2 {
|
|
38718
38722
|
formatStack(stack) {
|
|
38719
|
-
return
|
|
38723
|
+
return `
|
|
38724
|
+
` + parseStack2(stack).map((line) => " " + line.replace(/^at +/, (m22) => colors2.gray(m22)).replace(/\((.+)\)/, (_22, m22) => `(${colors2.cyan(m22)})`)).join(`
|
|
38725
|
+
`);
|
|
38720
38726
|
}
|
|
38721
38727
|
formatType(logObj, isBadge, opts) {
|
|
38722
38728
|
const typeColor = TYPE_COLOR_MAP2[logObj.type] || LEVEL_COLOR_MAP2[logObj.level] || "gray";
|
|
@@ -38727,9 +38733,12 @@ var init_consola_36c0034f2 = __esm2(() => {
|
|
|
38727
38733
|
return _type ? getColor22(typeColor)(_type) : "";
|
|
38728
38734
|
}
|
|
38729
38735
|
formatLogObj(logObj, opts) {
|
|
38730
|
-
const [message, ...additional] = this.formatArgs(logObj.args, opts).split(
|
|
38736
|
+
const [message, ...additional] = this.formatArgs(logObj.args, opts).split(`
|
|
38737
|
+
`);
|
|
38731
38738
|
if (logObj.type === "box") {
|
|
38732
|
-
return box2(characterFormat2(message + (additional.length > 0 ?
|
|
38739
|
+
return box2(characterFormat2(message + (additional.length > 0 ? `
|
|
38740
|
+
` + additional.join(`
|
|
38741
|
+
`) : "")), {
|
|
38733
38742
|
title: logObj.title ? characterFormat2(logObj.title) : undefined,
|
|
38734
38743
|
style: logObj.style
|
|
38735
38744
|
});
|
|
@@ -38744,12 +38753,16 @@ var init_consola_36c0034f2 = __esm2(() => {
|
|
|
38744
38753
|
const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
|
|
38745
38754
|
const space = (opts.columns || 0) - stringWidth3(left) - stringWidth3(right) - 2;
|
|
38746
38755
|
line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors2.gray(`[${right}]`)} ` : "") + left;
|
|
38747
|
-
line += characterFormat2(additional.length > 0 ?
|
|
38756
|
+
line += characterFormat2(additional.length > 0 ? `
|
|
38757
|
+
` + additional.join(`
|
|
38758
|
+
`) : "");
|
|
38748
38759
|
if (logObj.type === "trace") {
|
|
38749
38760
|
const _err = new Error("Trace: " + logObj.message);
|
|
38750
38761
|
line += this.formatStack(_err.stack || "");
|
|
38751
38762
|
}
|
|
38752
|
-
return isBadge ?
|
|
38763
|
+
return isBadge ? `
|
|
38764
|
+
` + line + `
|
|
38765
|
+
` : line;
|
|
38753
38766
|
}
|
|
38754
38767
|
};
|
|
38755
38768
|
consola2 = createConsola22();
|
|
@@ -38969,7 +38982,8 @@ var require_isURL2 = __commonJS22((exports, module) => {
|
|
|
38969
38982
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
38970
38983
|
}
|
|
38971
38984
|
function _nonIterableRest() {
|
|
38972
|
-
throw new TypeError(
|
|
38985
|
+
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
38986
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
38973
38987
|
}
|
|
38974
38988
|
function _unsupportedIterableToArray(o, minLen) {
|
|
38975
38989
|
if (!o)
|
|
@@ -39427,7 +39441,7 @@ var require_isEmail2 = __commonJS22((exports, module) => {
|
|
|
39427
39441
|
if (display_name_without_quotes === display_name) {
|
|
39428
39442
|
return false;
|
|
39429
39443
|
}
|
|
39430
|
-
var all_start_with_back_slash = display_name_without_quotes.split('"').length === display_name_without_quotes.split(
|
|
39444
|
+
var all_start_with_back_slash = display_name_without_quotes.split('"').length === display_name_without_quotes.split("\\\"").length;
|
|
39431
39445
|
if (!all_start_with_back_slash) {
|
|
39432
39446
|
return false;
|
|
39433
39447
|
}
|
|
@@ -41092,7 +41106,8 @@ var require_clear3 = __commonJS22((exports, module) => {
|
|
|
41092
41106
|
throw _e;
|
|
41093
41107
|
}, f: F };
|
|
41094
41108
|
}
|
|
41095
|
-
throw new TypeError(
|
|
41109
|
+
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
41110
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
41096
41111
|
}
|
|
41097
41112
|
var normalCompletion = true, didErr = false, err2;
|
|
41098
41113
|
return { s: function s() {
|
|
@@ -41249,7 +41264,9 @@ var require_wrap3 = __commonJS22((exports, module) => {
|
|
|
41249
41264
|
else
|
|
41250
41265
|
arr.push(`${tab}${w22}`);
|
|
41251
41266
|
return arr;
|
|
41252
|
-
}, [tab]).join(
|
|
41267
|
+
}, [tab]).join(`
|
|
41268
|
+
`)).join(`
|
|
41269
|
+
`);
|
|
41253
41270
|
};
|
|
41254
41271
|
});
|
|
41255
41272
|
var require_entriesToDisplay3 = __commonJS22((exports, module) => {
|
|
@@ -41430,7 +41447,8 @@ var require_text3 = __commonJS22((exports, module) => {
|
|
|
41430
41447
|
this.red = false;
|
|
41431
41448
|
this.fire();
|
|
41432
41449
|
this.render();
|
|
41433
|
-
this.out.write(
|
|
41450
|
+
this.out.write(`
|
|
41451
|
+
`);
|
|
41434
41452
|
this.close();
|
|
41435
41453
|
}
|
|
41436
41454
|
validate() {
|
|
@@ -41461,7 +41479,8 @@ var require_text3 = __commonJS22((exports, module) => {
|
|
|
41461
41479
|
_this2.aborted = false;
|
|
41462
41480
|
_this2.fire();
|
|
41463
41481
|
_this2.render();
|
|
41464
|
-
_this2.out.write(
|
|
41482
|
+
_this2.out.write(`
|
|
41483
|
+
`);
|
|
41465
41484
|
_this2.close();
|
|
41466
41485
|
})();
|
|
41467
41486
|
}
|
|
@@ -41554,7 +41573,9 @@ var require_text3 = __commonJS22((exports, module) => {
|
|
|
41554
41573
|
this.outputError = "";
|
|
41555
41574
|
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(` `);
|
|
41556
41575
|
if (this.error) {
|
|
41557
|
-
this.outputError += this.errorMsg.split(
|
|
41576
|
+
this.outputError += this.errorMsg.split(`
|
|
41577
|
+
`).reduce((a, l3, i) => a + `
|
|
41578
|
+
${i ? " " : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
41558
41579
|
}
|
|
41559
41580
|
this.out.write(erase22.line + cursor22.to(0) + this.outputText + cursor22.save + this.outputError + cursor22.restore + cursor22.move(this.cursorOffset, 0));
|
|
41560
41581
|
}
|
|
@@ -41616,7 +41637,8 @@ var require_select3 = __commonJS22((exports, module) => {
|
|
|
41616
41637
|
this.done = this.aborted = true;
|
|
41617
41638
|
this.fire();
|
|
41618
41639
|
this.render();
|
|
41619
|
-
this.out.write(
|
|
41640
|
+
this.out.write(`
|
|
41641
|
+
`);
|
|
41620
41642
|
this.close();
|
|
41621
41643
|
}
|
|
41622
41644
|
submit() {
|
|
@@ -41625,7 +41647,8 @@ var require_select3 = __commonJS22((exports, module) => {
|
|
|
41625
41647
|
this.aborted = false;
|
|
41626
41648
|
this.fire();
|
|
41627
41649
|
this.render();
|
|
41628
|
-
this.out.write(
|
|
41650
|
+
this.out.write(`
|
|
41651
|
+
`);
|
|
41629
41652
|
this.close();
|
|
41630
41653
|
} else
|
|
41631
41654
|
this.bell();
|
|
@@ -41676,7 +41699,8 @@ var require_select3 = __commonJS22((exports, module) => {
|
|
|
41676
41699
|
let _entriesToDisplay = entriesToDisplay(this.cursor, this.choices.length, this.optionsPerPage), startIndex = _entriesToDisplay.startIndex, endIndex = _entriesToDisplay.endIndex;
|
|
41677
41700
|
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(" ");
|
|
41678
41701
|
if (!this.done) {
|
|
41679
|
-
this.outputText +=
|
|
41702
|
+
this.outputText += `
|
|
41703
|
+
`;
|
|
41680
41704
|
for (let i = startIndex;i < endIndex; i++) {
|
|
41681
41705
|
let title, prefix, desc = "", v22 = this.choices[i];
|
|
41682
41706
|
if (i === startIndex && startIndex > 0) {
|
|
@@ -41695,14 +41719,16 @@ var require_select3 = __commonJS22((exports, module) => {
|
|
|
41695
41719
|
if (v22.description && this.cursor === i) {
|
|
41696
41720
|
desc = ` - ${v22.description}`;
|
|
41697
41721
|
if (prefix.length + title.length + desc.length >= this.out.columns || v22.description.split(/\r?\n/).length > 1) {
|
|
41698
|
-
desc =
|
|
41722
|
+
desc = `
|
|
41723
|
+
` + wrap(v22.description, {
|
|
41699
41724
|
margin: 3,
|
|
41700
41725
|
width: this.out.columns
|
|
41701
41726
|
});
|
|
41702
41727
|
}
|
|
41703
41728
|
}
|
|
41704
41729
|
}
|
|
41705
|
-
this.outputText += `${prefix} ${title}${color.gray(desc)}
|
|
41730
|
+
this.outputText += `${prefix} ${title}${color.gray(desc)}
|
|
41731
|
+
`;
|
|
41706
41732
|
}
|
|
41707
41733
|
}
|
|
41708
41734
|
this.out.write(this.outputText);
|
|
@@ -41742,7 +41768,8 @@ var require_toggle3 = __commonJS22((exports, module) => {
|
|
|
41742
41768
|
this.done = this.aborted = true;
|
|
41743
41769
|
this.fire();
|
|
41744
41770
|
this.render();
|
|
41745
|
-
this.out.write(
|
|
41771
|
+
this.out.write(`
|
|
41772
|
+
`);
|
|
41746
41773
|
this.close();
|
|
41747
41774
|
}
|
|
41748
41775
|
submit() {
|
|
@@ -41750,7 +41777,8 @@ var require_toggle3 = __commonJS22((exports, module) => {
|
|
|
41750
41777
|
this.aborted = false;
|
|
41751
41778
|
this.fire();
|
|
41752
41779
|
this.render();
|
|
41753
|
-
this.out.write(
|
|
41780
|
+
this.out.write(`
|
|
41781
|
+
`);
|
|
41754
41782
|
this.close();
|
|
41755
41783
|
}
|
|
41756
41784
|
deactivate() {
|
|
@@ -42183,7 +42211,8 @@ var require_date3 = __commonJS22((exports, module) => {
|
|
|
42183
42211
|
this.error = false;
|
|
42184
42212
|
this.fire();
|
|
42185
42213
|
this.render();
|
|
42186
|
-
this.out.write(
|
|
42214
|
+
this.out.write(`
|
|
42215
|
+
`);
|
|
42187
42216
|
this.close();
|
|
42188
42217
|
}
|
|
42189
42218
|
validate() {
|
|
@@ -42211,7 +42240,8 @@ var require_date3 = __commonJS22((exports, module) => {
|
|
|
42211
42240
|
_this2.aborted = false;
|
|
42212
42241
|
_this2.fire();
|
|
42213
42242
|
_this2.render();
|
|
42214
|
-
_this2.out.write(
|
|
42243
|
+
_this2.out.write(`
|
|
42244
|
+
`);
|
|
42215
42245
|
_this2.close();
|
|
42216
42246
|
})();
|
|
42217
42247
|
}
|
|
@@ -42261,7 +42291,9 @@ var require_date3 = __commonJS22((exports, module) => {
|
|
|
42261
42291
|
super.render();
|
|
42262
42292
|
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(" ");
|
|
42263
42293
|
if (this.error) {
|
|
42264
|
-
this.outputText += this.errorMsg.split(
|
|
42294
|
+
this.outputText += this.errorMsg.split(`
|
|
42295
|
+
`).reduce((a, l3, i) => a + `
|
|
42296
|
+
${i ? ` ` : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
42265
42297
|
}
|
|
42266
42298
|
this.out.write(erase22.line + cursor22.to(0) + this.outputText);
|
|
42267
42299
|
}
|
|
@@ -42371,7 +42403,8 @@ var require_number3 = __commonJS22((exports, module) => {
|
|
|
42371
42403
|
this.error = false;
|
|
42372
42404
|
this.fire();
|
|
42373
42405
|
this.render();
|
|
42374
|
-
this.out.write(
|
|
42406
|
+
this.out.write(`
|
|
42407
|
+
`);
|
|
42375
42408
|
this.close();
|
|
42376
42409
|
}
|
|
42377
42410
|
validate() {
|
|
@@ -42402,7 +42435,8 @@ var require_number3 = __commonJS22((exports, module) => {
|
|
|
42402
42435
|
_this2.error = false;
|
|
42403
42436
|
_this2.fire();
|
|
42404
42437
|
_this2.render();
|
|
42405
|
-
_this2.out.write(
|
|
42438
|
+
_this2.out.write(`
|
|
42439
|
+
`);
|
|
42406
42440
|
_this2.close();
|
|
42407
42441
|
})();
|
|
42408
42442
|
}
|
|
@@ -42478,7 +42512,9 @@ var require_number3 = __commonJS22((exports, module) => {
|
|
|
42478
42512
|
this.outputError = "";
|
|
42479
42513
|
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(` `);
|
|
42480
42514
|
if (this.error) {
|
|
42481
|
-
this.outputError += this.errorMsg.split(
|
|
42515
|
+
this.outputError += this.errorMsg.split(`
|
|
42516
|
+
`).reduce((a, l3, i) => a + `
|
|
42517
|
+
${i ? ` ` : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
42482
42518
|
}
|
|
42483
42519
|
this.out.write(erase22.line + cursor22.to(0) + this.outputText + cursor22.save + this.outputError + cursor22.restore);
|
|
42484
42520
|
}
|
|
@@ -42545,7 +42581,8 @@ var require_multiselect3 = __commonJS22((exports, module) => {
|
|
|
42545
42581
|
this.done = this.aborted = true;
|
|
42546
42582
|
this.fire();
|
|
42547
42583
|
this.render();
|
|
42548
|
-
this.out.write(
|
|
42584
|
+
this.out.write(`
|
|
42585
|
+
`);
|
|
42549
42586
|
this.close();
|
|
42550
42587
|
}
|
|
42551
42588
|
submit() {
|
|
@@ -42558,7 +42595,8 @@ var require_multiselect3 = __commonJS22((exports, module) => {
|
|
|
42558
42595
|
this.aborted = false;
|
|
42559
42596
|
this.fire();
|
|
42560
42597
|
this.render();
|
|
42561
|
-
this.out.write(
|
|
42598
|
+
this.out.write(`
|
|
42599
|
+
`);
|
|
42562
42600
|
this.close();
|
|
42563
42601
|
}
|
|
42564
42602
|
}
|
|
@@ -42634,7 +42672,12 @@ var require_multiselect3 = __commonJS22((exports, module) => {
|
|
|
42634
42672
|
if (typeof this.instructions === "string") {
|
|
42635
42673
|
return this.instructions;
|
|
42636
42674
|
}
|
|
42637
|
-
return
|
|
42675
|
+
return `
|
|
42676
|
+
Instructions:
|
|
42677
|
+
` + ` ${figures.arrowUp}/${figures.arrowDown}: Highlight option
|
|
42678
|
+
` + ` ${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
|
|
42679
|
+
` + (this.maxChoices === undefined ? ` a: Toggle all
|
|
42680
|
+
` : "") + ` enter/return: Complete answer`;
|
|
42638
42681
|
}
|
|
42639
42682
|
return "";
|
|
42640
42683
|
}
|
|
@@ -42648,7 +42691,8 @@ var require_multiselect3 = __commonJS22((exports, module) => {
|
|
|
42648
42691
|
if (cursor3 === i && v22.description) {
|
|
42649
42692
|
desc = ` - ${v22.description}`;
|
|
42650
42693
|
if (prefix.length + title.length + desc.length >= this.out.columns || v22.description.split(/\r?\n/).length > 1) {
|
|
42651
|
-
desc =
|
|
42694
|
+
desc = `
|
|
42695
|
+
` + wrap(v22.description, {
|
|
42652
42696
|
margin: prefix.length,
|
|
42653
42697
|
width: this.out.columns
|
|
42654
42698
|
});
|
|
@@ -42673,7 +42717,9 @@ var require_multiselect3 = __commonJS22((exports, module) => {
|
|
|
42673
42717
|
}
|
|
42674
42718
|
styledOptions.push(this.renderOption(this.cursor, options2[i], i, prefix));
|
|
42675
42719
|
}
|
|
42676
|
-
return
|
|
42720
|
+
return `
|
|
42721
|
+
` + styledOptions.join(`
|
|
42722
|
+
`);
|
|
42677
42723
|
}
|
|
42678
42724
|
renderOptions(options2) {
|
|
42679
42725
|
if (!this.done) {
|
|
@@ -42839,7 +42885,8 @@ var require_autocomplete3 = __commonJS22((exports, module) => {
|
|
|
42839
42885
|
this.aborted = false;
|
|
42840
42886
|
this.fire();
|
|
42841
42887
|
this.render();
|
|
42842
|
-
this.out.write(
|
|
42888
|
+
this.out.write(`
|
|
42889
|
+
`);
|
|
42843
42890
|
this.close();
|
|
42844
42891
|
}
|
|
42845
42892
|
}
|
|
@@ -42848,7 +42895,8 @@ var require_autocomplete3 = __commonJS22((exports, module) => {
|
|
|
42848
42895
|
this.exited = false;
|
|
42849
42896
|
this.fire();
|
|
42850
42897
|
this.render();
|
|
42851
|
-
this.out.write(
|
|
42898
|
+
this.out.write(`
|
|
42899
|
+
`);
|
|
42852
42900
|
this.close();
|
|
42853
42901
|
}
|
|
42854
42902
|
submit() {
|
|
@@ -42856,7 +42904,8 @@ var require_autocomplete3 = __commonJS22((exports, module) => {
|
|
|
42856
42904
|
this.aborted = this.exited = false;
|
|
42857
42905
|
this.fire();
|
|
42858
42906
|
this.render();
|
|
42859
|
-
this.out.write(
|
|
42907
|
+
this.out.write(`
|
|
42908
|
+
`);
|
|
42860
42909
|
this.close();
|
|
42861
42910
|
}
|
|
42862
42911
|
_(c22, key) {
|
|
@@ -42945,7 +42994,8 @@ var require_autocomplete3 = __commonJS22((exports, module) => {
|
|
|
42945
42994
|
if (v22.description) {
|
|
42946
42995
|
desc = ` - ${v22.description}`;
|
|
42947
42996
|
if (prefix.length + title.length + desc.length >= this.out.columns || v22.description.split(/\r?\n/).length > 1) {
|
|
42948
|
-
desc =
|
|
42997
|
+
desc = `
|
|
42998
|
+
` + wrap(v22.description, {
|
|
42949
42999
|
margin: 3,
|
|
42950
43000
|
width: this.out.columns
|
|
42951
43001
|
});
|
|
@@ -42964,8 +43014,10 @@ var require_autocomplete3 = __commonJS22((exports, module) => {
|
|
|
42964
43014
|
let _entriesToDisplay = entriesToDisplay(this.select, this.choices.length, this.limit), startIndex = _entriesToDisplay.startIndex, endIndex = _entriesToDisplay.endIndex;
|
|
42965
43015
|
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(" ");
|
|
42966
43016
|
if (!this.done) {
|
|
42967
|
-
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(
|
|
42968
|
-
|
|
43017
|
+
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(`
|
|
43018
|
+
`);
|
|
43019
|
+
this.outputText += `
|
|
43020
|
+
` + (suggestions || color.gray(this.fallback.title));
|
|
42969
43021
|
}
|
|
42970
43022
|
this.out.write(erase22.line + cursor22.to(0) + this.outputText);
|
|
42971
43023
|
}
|
|
@@ -43093,7 +43145,8 @@ Instructions:
|
|
|
43093
43145
|
}
|
|
43094
43146
|
renderCurrentInput() {
|
|
43095
43147
|
return `
|
|
43096
|
-
Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
|
|
43148
|
+
Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
|
|
43149
|
+
`;
|
|
43097
43150
|
}
|
|
43098
43151
|
renderOption(cursor3, v22, i) {
|
|
43099
43152
|
let title;
|
|
@@ -43165,7 +43218,8 @@ var require_confirm3 = __commonJS22((exports, module) => {
|
|
|
43165
43218
|
this.done = this.aborted = true;
|
|
43166
43219
|
this.fire();
|
|
43167
43220
|
this.render();
|
|
43168
|
-
this.out.write(
|
|
43221
|
+
this.out.write(`
|
|
43222
|
+
`);
|
|
43169
43223
|
this.close();
|
|
43170
43224
|
}
|
|
43171
43225
|
submit() {
|
|
@@ -43174,7 +43228,8 @@ var require_confirm3 = __commonJS22((exports, module) => {
|
|
|
43174
43228
|
this.aborted = false;
|
|
43175
43229
|
this.fire();
|
|
43176
43230
|
this.render();
|
|
43177
|
-
this.out.write(
|
|
43231
|
+
this.out.write(`
|
|
43232
|
+
`);
|
|
43178
43233
|
this.close();
|
|
43179
43234
|
}
|
|
43180
43235
|
_(c22, key) {
|
|
@@ -43330,7 +43385,8 @@ var require_dist2 = __commonJS22((exports, module) => {
|
|
|
43330
43385
|
throw _e;
|
|
43331
43386
|
}, f: F };
|
|
43332
43387
|
}
|
|
43333
|
-
throw new TypeError(
|
|
43388
|
+
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
43389
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
43334
43390
|
}
|
|
43335
43391
|
var normalCompletion = true, didErr = false, err2;
|
|
43336
43392
|
return { s: function s() {
|
|
@@ -43662,7 +43718,9 @@ var require_wrap22 = __commonJS22((exports, module) => {
|
|
|
43662
43718
|
else
|
|
43663
43719
|
arr.push(`${tab}${w22}`);
|
|
43664
43720
|
return arr;
|
|
43665
|
-
}, [tab]).join(
|
|
43721
|
+
}, [tab]).join(`
|
|
43722
|
+
`)).join(`
|
|
43723
|
+
`);
|
|
43666
43724
|
};
|
|
43667
43725
|
});
|
|
43668
43726
|
var require_entriesToDisplay22 = __commonJS22((exports, module) => {
|
|
@@ -43799,7 +43857,8 @@ var require_text22 = __commonJS22((exports, module) => {
|
|
|
43799
43857
|
this.red = false;
|
|
43800
43858
|
this.fire();
|
|
43801
43859
|
this.render();
|
|
43802
|
-
this.out.write(
|
|
43860
|
+
this.out.write(`
|
|
43861
|
+
`);
|
|
43803
43862
|
this.close();
|
|
43804
43863
|
}
|
|
43805
43864
|
async validate() {
|
|
@@ -43825,7 +43884,8 @@ var require_text22 = __commonJS22((exports, module) => {
|
|
|
43825
43884
|
this.aborted = false;
|
|
43826
43885
|
this.fire();
|
|
43827
43886
|
this.render();
|
|
43828
|
-
this.out.write(
|
|
43887
|
+
this.out.write(`
|
|
43888
|
+
`);
|
|
43829
43889
|
this.close();
|
|
43830
43890
|
}
|
|
43831
43891
|
next() {
|
|
@@ -43922,7 +43982,9 @@ var require_text22 = __commonJS22((exports, module) => {
|
|
|
43922
43982
|
this.red ? color.red(this.rendered) : this.rendered
|
|
43923
43983
|
].join(` `);
|
|
43924
43984
|
if (this.error) {
|
|
43925
|
-
this.outputError += this.errorMsg.split(
|
|
43985
|
+
this.outputError += this.errorMsg.split(`
|
|
43986
|
+
`).reduce((a, l3, i) => a + `
|
|
43987
|
+
${i ? " " : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
43926
43988
|
}
|
|
43927
43989
|
this.out.write(erase22.line + cursor22.to(0) + this.outputText + cursor22.save + this.outputError + cursor22.restore + cursor22.move(this.cursorOffset, 0));
|
|
43928
43990
|
}
|
|
@@ -43975,7 +44037,8 @@ var require_select22 = __commonJS22((exports, module) => {
|
|
|
43975
44037
|
this.done = this.aborted = true;
|
|
43976
44038
|
this.fire();
|
|
43977
44039
|
this.render();
|
|
43978
|
-
this.out.write(
|
|
44040
|
+
this.out.write(`
|
|
44041
|
+
`);
|
|
43979
44042
|
this.close();
|
|
43980
44043
|
}
|
|
43981
44044
|
submit() {
|
|
@@ -43984,7 +44047,8 @@ var require_select22 = __commonJS22((exports, module) => {
|
|
|
43984
44047
|
this.aborted = false;
|
|
43985
44048
|
this.fire();
|
|
43986
44049
|
this.render();
|
|
43987
|
-
this.out.write(
|
|
44050
|
+
this.out.write(`
|
|
44051
|
+
`);
|
|
43988
44052
|
this.close();
|
|
43989
44053
|
} else
|
|
43990
44054
|
this.bell();
|
|
@@ -44040,7 +44104,8 @@ var require_select22 = __commonJS22((exports, module) => {
|
|
|
44040
44104
|
this.done ? this.selection.title : this.selection.disabled ? color.yellow(this.warn) : color.gray(this.hint)
|
|
44041
44105
|
].join(" ");
|
|
44042
44106
|
if (!this.done) {
|
|
44043
|
-
this.outputText +=
|
|
44107
|
+
this.outputText += `
|
|
44108
|
+
`;
|
|
44044
44109
|
for (let i = startIndex;i < endIndex; i++) {
|
|
44045
44110
|
let title, prefix, desc = "", v22 = this.choices[i];
|
|
44046
44111
|
if (i === startIndex && startIndex > 0) {
|
|
@@ -44059,11 +44124,13 @@ var require_select22 = __commonJS22((exports, module) => {
|
|
|
44059
44124
|
if (v22.description && this.cursor === i) {
|
|
44060
44125
|
desc = ` - ${v22.description}`;
|
|
44061
44126
|
if (prefix.length + title.length + desc.length >= this.out.columns || v22.description.split(/\r?\n/).length > 1) {
|
|
44062
|
-
desc =
|
|
44127
|
+
desc = `
|
|
44128
|
+
` + wrap(v22.description, { margin: 3, width: this.out.columns });
|
|
44063
44129
|
}
|
|
44064
44130
|
}
|
|
44065
44131
|
}
|
|
44066
|
-
this.outputText += `${prefix} ${title}${color.gray(desc)}
|
|
44132
|
+
this.outputText += `${prefix} ${title}${color.gray(desc)}
|
|
44133
|
+
`;
|
|
44067
44134
|
}
|
|
44068
44135
|
}
|
|
44069
44136
|
this.out.write(this.outputText);
|
|
@@ -44099,7 +44166,8 @@ var require_toggle22 = __commonJS22((exports, module) => {
|
|
|
44099
44166
|
this.done = this.aborted = true;
|
|
44100
44167
|
this.fire();
|
|
44101
44168
|
this.render();
|
|
44102
|
-
this.out.write(
|
|
44169
|
+
this.out.write(`
|
|
44170
|
+
`);
|
|
44103
44171
|
this.close();
|
|
44104
44172
|
}
|
|
44105
44173
|
submit() {
|
|
@@ -44107,7 +44175,8 @@ var require_toggle22 = __commonJS22((exports, module) => {
|
|
|
44107
44175
|
this.aborted = false;
|
|
44108
44176
|
this.fire();
|
|
44109
44177
|
this.render();
|
|
44110
|
-
this.out.write(
|
|
44178
|
+
this.out.write(`
|
|
44179
|
+
`);
|
|
44111
44180
|
this.close();
|
|
44112
44181
|
}
|
|
44113
44182
|
deactivate() {
|
|
@@ -44492,7 +44561,8 @@ var require_date22 = __commonJS22((exports, module) => {
|
|
|
44492
44561
|
this.error = false;
|
|
44493
44562
|
this.fire();
|
|
44494
44563
|
this.render();
|
|
44495
|
-
this.out.write(
|
|
44564
|
+
this.out.write(`
|
|
44565
|
+
`);
|
|
44496
44566
|
this.close();
|
|
44497
44567
|
}
|
|
44498
44568
|
async validate() {
|
|
@@ -44515,7 +44585,8 @@ var require_date22 = __commonJS22((exports, module) => {
|
|
|
44515
44585
|
this.aborted = false;
|
|
44516
44586
|
this.fire();
|
|
44517
44587
|
this.render();
|
|
44518
|
-
this.out.write(
|
|
44588
|
+
this.out.write(`
|
|
44589
|
+
`);
|
|
44519
44590
|
this.close();
|
|
44520
44591
|
}
|
|
44521
44592
|
up() {
|
|
@@ -44569,7 +44640,9 @@ var require_date22 = __commonJS22((exports, module) => {
|
|
|
44569
44640
|
this.parts.reduce((arr, p32, idx) => arr.concat(idx === this.cursor && !this.done ? color.cyan().underline(p32.toString()) : p32), []).join("")
|
|
44570
44641
|
].join(" ");
|
|
44571
44642
|
if (this.error) {
|
|
44572
|
-
this.outputText += this.errorMsg.split(
|
|
44643
|
+
this.outputText += this.errorMsg.split(`
|
|
44644
|
+
`).reduce((a, l3, i) => a + `
|
|
44645
|
+
${i ? ` ` : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
44573
44646
|
}
|
|
44574
44647
|
this.out.write(erase22.line + cursor22.to(0) + this.outputText);
|
|
44575
44648
|
}
|
|
@@ -44644,7 +44717,8 @@ var require_number22 = __commonJS22((exports, module) => {
|
|
|
44644
44717
|
this.error = false;
|
|
44645
44718
|
this.fire();
|
|
44646
44719
|
this.render();
|
|
44647
|
-
this.out.write(
|
|
44720
|
+
this.out.write(`
|
|
44721
|
+
`);
|
|
44648
44722
|
this.close();
|
|
44649
44723
|
}
|
|
44650
44724
|
async validate() {
|
|
@@ -44670,7 +44744,8 @@ var require_number22 = __commonJS22((exports, module) => {
|
|
|
44670
44744
|
this.error = false;
|
|
44671
44745
|
this.fire();
|
|
44672
44746
|
this.render();
|
|
44673
|
-
this.out.write(
|
|
44747
|
+
this.out.write(`
|
|
44748
|
+
`);
|
|
44674
44749
|
this.close();
|
|
44675
44750
|
}
|
|
44676
44751
|
up() {
|
|
@@ -44750,7 +44825,9 @@ var require_number22 = __commonJS22((exports, module) => {
|
|
|
44750
44825
|
!this.done || !this.done && !this.placeholder ? color[this.color]().underline(this.rendered) : this.rendered
|
|
44751
44826
|
].join(` `);
|
|
44752
44827
|
if (this.error) {
|
|
44753
|
-
this.outputError += this.errorMsg.split(
|
|
44828
|
+
this.outputError += this.errorMsg.split(`
|
|
44829
|
+
`).reduce((a, l3, i) => a + `
|
|
44830
|
+
${i ? ` ` : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
44754
44831
|
}
|
|
44755
44832
|
this.out.write(erase22.line + cursor22.to(0) + this.outputText + cursor22.save + this.outputError + cursor22.restore);
|
|
44756
44833
|
}
|
|
@@ -44808,7 +44885,8 @@ var require_multiselect22 = __commonJS22((exports, module) => {
|
|
|
44808
44885
|
this.done = this.aborted = true;
|
|
44809
44886
|
this.fire();
|
|
44810
44887
|
this.render();
|
|
44811
|
-
this.out.write(
|
|
44888
|
+
this.out.write(`
|
|
44889
|
+
`);
|
|
44812
44890
|
this.close();
|
|
44813
44891
|
}
|
|
44814
44892
|
submit() {
|
|
@@ -44821,7 +44899,8 @@ var require_multiselect22 = __commonJS22((exports, module) => {
|
|
|
44821
44899
|
this.aborted = false;
|
|
44822
44900
|
this.fire();
|
|
44823
44901
|
this.render();
|
|
44824
|
-
this.out.write(
|
|
44902
|
+
this.out.write(`
|
|
44903
|
+
`);
|
|
44825
44904
|
this.close();
|
|
44826
44905
|
}
|
|
44827
44906
|
}
|
|
@@ -44897,7 +44976,12 @@ var require_multiselect22 = __commonJS22((exports, module) => {
|
|
|
44897
44976
|
if (typeof this.instructions === "string") {
|
|
44898
44977
|
return this.instructions;
|
|
44899
44978
|
}
|
|
44900
|
-
return
|
|
44979
|
+
return `
|
|
44980
|
+
Instructions:
|
|
44981
|
+
` + ` ${figures.arrowUp}/${figures.arrowDown}: Highlight option
|
|
44982
|
+
` + ` ${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
|
|
44983
|
+
` + (this.maxChoices === undefined ? ` a: Toggle all
|
|
44984
|
+
` : "") + ` enter/return: Complete answer`;
|
|
44901
44985
|
}
|
|
44902
44986
|
return "";
|
|
44903
44987
|
}
|
|
@@ -44911,7 +44995,8 @@ var require_multiselect22 = __commonJS22((exports, module) => {
|
|
|
44911
44995
|
if (cursor3 === i && v22.description) {
|
|
44912
44996
|
desc = ` - ${v22.description}`;
|
|
44913
44997
|
if (prefix.length + title.length + desc.length >= this.out.columns || v22.description.split(/\r?\n/).length > 1) {
|
|
44914
|
-
desc =
|
|
44998
|
+
desc = `
|
|
44999
|
+
` + wrap(v22.description, { margin: prefix.length, width: this.out.columns });
|
|
44915
45000
|
}
|
|
44916
45001
|
}
|
|
44917
45002
|
}
|
|
@@ -44933,7 +45018,9 @@ var require_multiselect22 = __commonJS22((exports, module) => {
|
|
|
44933
45018
|
}
|
|
44934
45019
|
styledOptions.push(this.renderOption(this.cursor, options2[i], i, prefix));
|
|
44935
45020
|
}
|
|
44936
|
-
return
|
|
45021
|
+
return `
|
|
45022
|
+
` + styledOptions.join(`
|
|
45023
|
+
`);
|
|
44937
45024
|
}
|
|
44938
45025
|
renderOptions(options2) {
|
|
44939
45026
|
if (!this.done) {
|
|
@@ -45055,7 +45142,8 @@ var require_autocomplete22 = __commonJS22((exports, module) => {
|
|
|
45055
45142
|
this.aborted = false;
|
|
45056
45143
|
this.fire();
|
|
45057
45144
|
this.render();
|
|
45058
|
-
this.out.write(
|
|
45145
|
+
this.out.write(`
|
|
45146
|
+
`);
|
|
45059
45147
|
this.close();
|
|
45060
45148
|
}
|
|
45061
45149
|
}
|
|
@@ -45064,7 +45152,8 @@ var require_autocomplete22 = __commonJS22((exports, module) => {
|
|
|
45064
45152
|
this.exited = false;
|
|
45065
45153
|
this.fire();
|
|
45066
45154
|
this.render();
|
|
45067
|
-
this.out.write(
|
|
45155
|
+
this.out.write(`
|
|
45156
|
+
`);
|
|
45068
45157
|
this.close();
|
|
45069
45158
|
}
|
|
45070
45159
|
submit() {
|
|
@@ -45072,7 +45161,8 @@ var require_autocomplete22 = __commonJS22((exports, module) => {
|
|
|
45072
45161
|
this.aborted = this.exited = false;
|
|
45073
45162
|
this.fire();
|
|
45074
45163
|
this.render();
|
|
45075
|
-
this.out.write(
|
|
45164
|
+
this.out.write(`
|
|
45165
|
+
`);
|
|
45076
45166
|
this.close();
|
|
45077
45167
|
}
|
|
45078
45168
|
_(c22, key) {
|
|
@@ -45161,7 +45251,8 @@ var require_autocomplete22 = __commonJS22((exports, module) => {
|
|
|
45161
45251
|
if (v22.description) {
|
|
45162
45252
|
desc = ` - ${v22.description}`;
|
|
45163
45253
|
if (prefix.length + title.length + desc.length >= this.out.columns || v22.description.split(/\r?\n/).length > 1) {
|
|
45164
|
-
desc =
|
|
45254
|
+
desc = `
|
|
45255
|
+
` + wrap(v22.description, { margin: 3, width: this.out.columns });
|
|
45165
45256
|
}
|
|
45166
45257
|
}
|
|
45167
45258
|
return prefix + " " + title + color.gray(desc || "");
|
|
@@ -45182,8 +45273,10 @@ var require_autocomplete22 = __commonJS22((exports, module) => {
|
|
|
45182
45273
|
this.done && this.suggestions[this.select] ? this.suggestions[this.select].title : this.rendered = this.transform.render(this.input)
|
|
45183
45274
|
].join(" ");
|
|
45184
45275
|
if (!this.done) {
|
|
45185
|
-
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(
|
|
45186
|
-
|
|
45276
|
+
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(`
|
|
45277
|
+
`);
|
|
45278
|
+
this.outputText += `
|
|
45279
|
+
` + (suggestions || color.gray(this.fallback.title));
|
|
45187
45280
|
}
|
|
45188
45281
|
this.out.write(erase22.line + cursor22.to(0) + this.outputText);
|
|
45189
45282
|
}
|
|
@@ -45307,7 +45400,8 @@ Instructions:
|
|
|
45307
45400
|
}
|
|
45308
45401
|
renderCurrentInput() {
|
|
45309
45402
|
return `
|
|
45310
|
-
Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
|
|
45403
|
+
Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
|
|
45404
|
+
`;
|
|
45311
45405
|
}
|
|
45312
45406
|
renderOption(cursor3, v22, i) {
|
|
45313
45407
|
let title;
|
|
@@ -45380,7 +45474,8 @@ var require_confirm22 = __commonJS22((exports, module) => {
|
|
|
45380
45474
|
this.done = this.aborted = true;
|
|
45381
45475
|
this.fire();
|
|
45382
45476
|
this.render();
|
|
45383
|
-
this.out.write(
|
|
45477
|
+
this.out.write(`
|
|
45478
|
+
`);
|
|
45384
45479
|
this.close();
|
|
45385
45480
|
}
|
|
45386
45481
|
submit() {
|
|
@@ -45389,7 +45484,8 @@ var require_confirm22 = __commonJS22((exports, module) => {
|
|
|
45389
45484
|
this.aborted = false;
|
|
45390
45485
|
this.fire();
|
|
45391
45486
|
this.render();
|
|
45392
|
-
this.out.write(
|
|
45487
|
+
this.out.write(`
|
|
45488
|
+
`);
|
|
45393
45489
|
this.close();
|
|
45394
45490
|
}
|
|
45395
45491
|
_(c22, key) {
|
|
@@ -47412,7 +47508,7 @@ var ut2 = l3((qe, P22) => {
|
|
|
47412
47508
|
return t = t.replace(C, "^$1"), t;
|
|
47413
47509
|
}
|
|
47414
47510
|
function Jt(t, e) {
|
|
47415
|
-
return t = `${t}`, t = t.replace(/(\\*)"/g,
|
|
47511
|
+
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;
|
|
47416
47512
|
}
|
|
47417
47513
|
P22.exports.command = Vt;
|
|
47418
47514
|
P22.exports.argument = Jt;
|
|
@@ -47600,7 +47696,7 @@ var TITLE_TERMINATORS2 = new Set([
|
|
|
47600
47696
|
...SENTENCE_TERMINATORS2,
|
|
47601
47697
|
":",
|
|
47602
47698
|
'"',
|
|
47603
|
-
"
|
|
47699
|
+
"'",
|
|
47604
47700
|
"\u201D"
|
|
47605
47701
|
]);
|
|
47606
47702
|
var SMALL_WORDS2 = new Set([
|
|
@@ -47647,7 +47743,7 @@ var uncountables2 = {};
|
|
|
47647
47743
|
var irregularPlurals2 = {};
|
|
47648
47744
|
var irregularSingles2 = {};
|
|
47649
47745
|
function sanitizeRule2(rule) {
|
|
47650
|
-
return typeof rule === "string" ? new RegExp(`^${rule}
|
|
47746
|
+
return typeof rule === "string" ? new RegExp(`^${rule}$`, "i") : rule;
|
|
47651
47747
|
}
|
|
47652
47748
|
function restoreCase2(word, token) {
|
|
47653
47749
|
if (word === token)
|
|
@@ -47946,7 +48042,7 @@ pluralize2.addIrregularRule = (single, plural) => {
|
|
|
47946
48042
|
/pox$/i,
|
|
47947
48043
|
/sheep$/i
|
|
47948
48044
|
].forEach(pluralize2.addUncountableRule);
|
|
47949
|
-
var charMap2 = JSON.parse(`{"$":"dollar","%":"percent","&":"and","<":"less",">":"greater","|":"or","\xA2":"cent","\xA3":"pound","\xA4":"currency","\xA5":"yen","\xA9":"(c)","\xAA":"a","\xAE":"(r)","\xBA":"o","\xC0":"A","\xC1":"A","\xC2":"A","\xC3":"A","\xC4":"A","\xC5":"A","\xC6":"AE","\xC7":"C","\xC8":"E","\xC9":"E","\xCA":"E","\xCB":"E","\xCC":"I","\xCD":"I","\xCE":"I","\xCF":"I","\xD0":"D","\xD1":"N","\xD2":"O","\xD3":"O","\xD4":"O","\xD5":"O","\xD6":"O","\xD8":"O","\xD9":"U","\xDA":"U","\xDB":"U","\xDC":"U","\xDD":"Y","\xDE":"TH","\xDF":"ss","\xE0":"a","\xE1":"a","\xE2":"a","\xE3":"a","\xE4":"a","\xE5":"a","\xE6":"ae","\xE7":"c","\xE8":"e","\xE9":"e","\xEA":"e","\xEB":"e","\xEC":"i","\xED":"i","\xEE":"i","\xEF":"i","\xF0":"d","\xF1":"n","\xF2":"o","\xF3":"o","\xF4":"o","\xF5":"o","\xF6":"o","\xF8":"o","\xF9":"u","\xFA":"u","\xFB":"u","\xFC":"u","\xFD":"y","\xFE":"th","\
|
|
48045
|
+
var charMap2 = JSON.parse(`{"$":"dollar","%":"percent","&":"and","<":"less",">":"greater","|":"or","\xA2":"cent","\xA3":"pound","\xA4":"currency","\xA5":"yen","\xA9":"(c)","\xAA":"a","\xAE":"(r)","\xBA":"o","\xC0":"A","\xC1":"A","\xC2":"A","\xC3":"A","\xC4":"A","\xC5":"A","\xC6":"AE","\xC7":"C","\xC8":"E","\xC9":"E","\xCA":"E","\xCB":"E","\xCC":"I","\xCD":"I","\xCE":"I","\xCF":"I","\xD0":"D","\xD1":"N","\xD2":"O","\xD3":"O","\xD4":"O","\xD5":"O","\xD6":"O","\xD8":"O","\xD9":"U","\xDA":"U","\xDB":"U","\xDC":"U","\xDD":"Y","\xDE":"TH","\xDF":"ss","\xE0":"a","\xE1":"a","\xE2":"a","\xE3":"a","\xE4":"a","\xE5":"a","\xE6":"ae","\xE7":"c","\xE8":"e","\xE9":"e","\xEA":"e","\xEB":"e","\xEC":"i","\xED":"i","\xEE":"i","\xEF":"i","\xF0":"d","\xF1":"n","\xF2":"o","\xF3":"o","\xF4":"o","\xF5":"o","\xF6":"o","\xF8":"o","\xF9":"u","\xFA":"u","\xFB":"u","\xFC":"u","\xFD":"y","\xFE":"th","\u00FF":"y","\u0100":"A","\u0101":"a","\u0102":"A","\u0103":"a","\u0104":"A","\u0105":"a","\u0106":"C","\u0107":"c","\u010C":"C","\u010D":"c","\u010E":"D","\u010F":"d","\u0110":"DJ","\u0111":"dj","\u0112":"E","\u0113":"e","\u0116":"E","\u0117":"e","\u0118":"e","\u0119":"e","\u011A":"E","\u011B":"e","\u011E":"G","\u011F":"g","\u0122":"G","\u0123":"g","\u0128":"I","\u0129":"i","\u012A":"i","\u012B":"i","\u012E":"I","\u012F":"i","\u0130":"I","\u0131":"i","\u0136":"k","\u0137":"k","\u013B":"L","\u013C":"l","\u013D":"L","\u013E":"l","\u0141":"L","\u0142":"l","\u0143":"N","\u0144":"n","\u0145":"N","\u0146":"n","\u0147":"N","\u0148":"n","\u014C":"O","\u014D":"o","\u0150":"O","\u0151":"o","\u0152":"OE","\u0153":"oe","\u0154":"R","\u0155":"r","\u0158":"R","\u0159":"r","\u015A":"S","\u015B":"s","\u015E":"S","\u015F":"s","\u0160":"S","\u0161":"s","\u0162":"T","\u0163":"t","\u0164":"T","\u0165":"t","\u0168":"U","\u0169":"u","\u016A":"u","\u016B":"u","\u016E":"U","\u016F":"u","\u0170":"U","\u0171":"u","\u0172":"U","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017A":"z","\u017B":"Z","\u017C":"z","\u017D":"Z","\u017E":"z","\u018F":"E","\u0192":"f","\u01A0":"O","\u01A1":"o","\u01AF":"U","\u01B0":"u","\u01C8":"LJ","\u01C9":"lj","\u01CB":"NJ","\u01CC":"nj","\u0218":"S","\u0219":"s","\u021A":"T","\u021B":"t","\u0259":"e","\u02DA":"o","\u0386":"A","\u0388":"E","\u0389":"H","\u038A":"I","\u038C":"O","\u038E":"Y","\u038F":"W","\u0390":"i","\u0391":"A","\u0392":"B","\u0393":"G","\u0394":"D","\u0395":"E","\u0396":"Z","\u0397":"H","\u0398":"8","\u0399":"I","\u039A":"K","\u039B":"L","\u039C":"M","\u039D":"N","\u039E":"3","\u039F":"O","\u03A0":"P","\u03A1":"R","\u03A3":"S","\u03A4":"T","\u03A5":"Y","\u03A6":"F","\u03A7":"X","\u03A8":"PS","\u03A9":"W","\u03AA":"I","\u03AB":"Y","\u03AC":"a","\u03AD":"e","\u03AE":"h","\u03AF":"i","\u03B0":"y","\u03B1":"a","\u03B2":"b","\u03B3":"g","\u03B4":"d","\u03B5":"e","\u03B6":"z","\u03B7":"h","\u03B8":"8","\u03B9":"i","\u03BA":"k","\u03BB":"l","\u03BC":"m","\u03BD":"n","\u03BE":"3","\u03BF":"o","\u03C0":"p","\u03C1":"r","\u03C2":"s","\u03C3":"s","\u03C4":"t","\u03C5":"y","\u03C6":"f","\u03C7":"x","\u03C8":"ps","\u03C9":"w","\u03CA":"i","\u03CB":"y","\u03CC":"o","\u03CD":"y","\u03CE":"w","\u0401":"Yo","\u0402":"DJ","\u0404":"Ye","\u0406":"I","\u0407":"Yi","\u0408":"J","\u0409":"LJ","\u040A":"NJ","\u040B":"C","\u040F":"DZ","\u0410":"A","\u0411":"B","\u0412":"V","\u0413":"G","\u0414":"D","\u0415":"E","\u0416":"Zh","\u0417":"Z","\u0418":"I","\u0419":"J","\u041A":"K","\u041B":"L","\u041C":"M","\u041D":"N","\u041E":"O","\u041F":"P","\u0420":"R","\u0421":"S","\u0422":"T","\u0423":"U","\u0424":"F","\u0425":"H","\u0426":"C","\u0427":"Ch","\u0428":"Sh","\u0429":"Sh","\u042A":"U","\u042B":"Y","\u042C":"","\u042D":"E","\u042E":"Yu","\u042F":"Ya","\u0430":"a","\u0431":"b","\u0432":"v","\u0433":"g","\u0434":"d","\u0435":"e","\u0436":"zh","\u0437":"z","\u0438":"i","\u0439":"j","\u043A":"k","\u043B":"l","\u043C":"m","\u043D":"n","\u043E":"o","\u043F":"p","\u0440":"r","\u0441":"s","\u0442":"t","\u0443":"u","\u0444":"f","\u0445":"h","\u0446":"c","\u0447":"ch","\u0448":"sh","\u0449":"sh","\u044A":"u","\u044B":"y","\u044C":"","\u044D":"e","\u044E":"yu","\u044F":"ya","\u0451":"yo","\u0452":"dj","\u0454":"ye","\u0456":"i","\u0457":"yi","\u0458":"j","\u0459":"lj","\u045A":"nj","\u045B":"c","\u045D":"u","\u045F":"dz","\u0490":"G","\u0491":"g","\u0492":"GH","\u0493":"gh","\u049A":"KH","\u049B":"kh","\u04A2":"NG","\u04A3":"ng","\u04AE":"UE","\u04AF":"ue","\u04B0":"U","\u04B1":"u","\u04BA":"H","\u04BB":"h","\u04D8":"AE","\u04D9":"ae","\u04E8":"OE","\u04E9":"oe","\u0531":"A","\u0532":"B","\u0533":"G","\u0534":"D","\u0535":"E","\u0536":"Z","\u0537":"E'","\u0538":"Y'","\u0539":"T'","\u053A":"JH","\u053B":"I","\u053C":"L","\u053D":"X","\u053E":"C'","\u053F":"K","\u0540":"H","\u0541":"D'","\u0542":"GH","\u0543":"TW","\u0544":"M","\u0545":"Y","\u0546":"N","\u0547":"SH","\u0549":"CH","\u054A":"P","\u054B":"J","\u054C":"R'","\u054D":"S","\u054E":"V","\u054F":"T","\u0550":"R","\u0551":"C","\u0553":"P'","\u0554":"Q'","\u0555":"O''","\u0556":"F","\u0587":"EV","\u0621":"a","\u0622":"aa","\u0623":"a","\u0624":"u","\u0625":"i","\u0626":"e","\u0627":"a","\u0628":"b","\u0629":"h","\u062A":"t","\u062B":"th","\u062C":"j","\u062D":"h","\u062E":"kh","\u062F":"d","\u0630":"th","\u0631":"r","\u0632":"z","\u0633":"s","\u0634":"sh","\u0635":"s","\u0636":"dh","\u0637":"t","\u0638":"z","\u0639":"a","\u063A":"gh","\u0641":"f","\u0642":"q","\u0643":"k","\u0644":"l","\u0645":"m","\u0646":"n","\u0647":"h","\u0648":"w","\u0649":"a","\u064A":"y","\u064B":"an","\u064C":"on","\u064D":"en","\u064E":"a","\u064F":"u","\u0650":"e","\u0652":"","\u0660":"0","\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u067E":"p","\u0686":"ch","\u0698":"zh","\u06A9":"k","\u06AF":"g","\u06CC":"y","\u06F0":"0","\u06F1":"1","\u06F2":"2","\u06F3":"3","\u06F4":"4","\u06F5":"5","\u06F6":"6","\u06F7":"7","\u06F8":"8","\u06F9":"9","\u0E3F":"baht","\u10D0":"a","\u10D1":"b","\u10D2":"g","\u10D3":"d","\u10D4":"e","\u10D5":"v","\u10D6":"z","\u10D7":"t","\u10D8":"i","\u10D9":"k","\u10DA":"l","\u10DB":"m","\u10DC":"n","\u10DD":"o","\u10DE":"p","\u10DF":"zh","\u10E0":"r","\u10E1":"s","\u10E2":"t","\u10E3":"u","\u10E4":"f","\u10E5":"k","\u10E6":"gh","\u10E7":"q","\u10E8":"sh","\u10E9":"ch","\u10EA":"ts","\u10EB":"dz","\u10EC":"ts","\u10ED":"ch","\u10EE":"kh","\u10EF":"j","\u10F0":"h","\u1E62":"S","\u1E63":"s","\u1E80":"W","\u1E81":"w","\u1E82":"W","\u1E83":"w","\u1E84":"W","\u1E85":"w","\u1E9E":"SS","\u1EA0":"A","\u1EA1":"a","\u1EA2":"A","\u1EA3":"a","\u1EA4":"A","\u1EA5":"a","\u1EA6":"A","\u1EA7":"a","\u1EA8":"A","\u1EA9":"a","\u1EAA":"A","\u1EAB":"a","\u1EAC":"A","\u1EAD":"a","\u1EAE":"A","\u1EAF":"a","\u1EB0":"A","\u1EB1":"a","\u1EB2":"A","\u1EB3":"a","\u1EB4":"A","\u1EB5":"a","\u1EB6":"A","\u1EB7":"a","\u1EB8":"E","\u1EB9":"e","\u1EBA":"E","\u1EBB":"e","\u1EBC":"E","\u1EBD":"e","\u1EBE":"E","\u1EBF":"e","\u1EC0":"E","\u1EC1":"e","\u1EC2":"E","\u1EC3":"e","\u1EC4":"E","\u1EC5":"e","\u1EC6":"E","\u1EC7":"e","\u1EC8":"I","\u1EC9":"i","\u1ECA":"I","\u1ECB":"i","\u1ECC":"O","\u1ECD":"o","\u1ECE":"O","\u1ECF":"o","\u1ED0":"O","\u1ED1":"o","\u1ED2":"O","\u1ED3":"o","\u1ED4":"O","\u1ED5":"o","\u1ED6":"O","\u1ED7":"o","\u1ED8":"O","\u1ED9":"o","\u1EDA":"O","\u1EDB":"o","\u1EDC":"O","\u1EDD":"o","\u1EDE":"O","\u1EDF":"o","\u1EE0":"O","\u1EE1":"o","\u1EE2":"O","\u1EE3":"o","\u1EE4":"U","\u1EE5":"u","\u1EE6":"U","\u1EE7":"u","\u1EE8":"U","\u1EE9":"u","\u1EEA":"U","\u1EEB":"u","\u1EEC":"U","\u1EED":"u","\u1EEE":"U","\u1EEF":"u","\u1EF0":"U","\u1EF1":"u","\u1EF2":"Y","\u1EF3":"y","\u1EF4":"Y","\u1EF5":"y","\u1EF6":"Y","\u1EF7":"y","\u1EF8":"Y","\u1EF9":"y","\u2013":"-","\u2018":"'","\u2019":"'","\u201C":"\\"","\u201D":"\\"","\u201E":"\\"","\u2020":"+","\u2022":"*","\u2026":"...","\u20A0":"ecu","\u20A2":"cruzeiro","\u20A3":"french franc","\u20A4":"lira","\u20A5":"mill","\u20A6":"naira","\u20A7":"peseta","\u20A8":"rupee","\u20A9":"won","\u20AA":"new shequel","\u20AB":"dong","\u20AC":"euro","\u20AD":"kip","\u20AE":"tugrik","\u20AF":"drachma","\u20B0":"penny","\u20B1":"peso","\u20B2":"guarani","\u20B3":"austral","\u20B4":"hryvnia","\u20B5":"cedi","\u20B8":"kazakhstani tenge","\u20B9":"indian rupee","\u20BA":"turkish lira","\u20BD":"russian ruble","\u20BF":"bitcoin","\u2120":"sm","\u2122":"tm","\u2202":"d","\u2206":"delta","\u2211":"sum","\u221E":"infinity","\u2665":"love","\u5143":"yuan","\u5186":"yen","\uFDFC":"rial","\uFEF5":"laa","\uFEF7":"laa","\uFEF9":"lai","\uFEFB":"la"}`);
|
|
47950
48046
|
var locales2 = JSON.parse('{"bg":{"\u0419":"Y","\u0426":"Ts","\u0429":"Sht","\u042A":"A","\u042C":"Y","\u0439":"y","\u0446":"ts","\u0449":"sht","\u044A":"a","\u044C":"y"},"de":{"\xC4":"AE","\xE4":"ae","\xD6":"OE","\xF6":"oe","\xDC":"UE","\xFC":"ue","\xDF":"ss","%":"prozent","&":"und","|":"oder","\u2211":"summe","\u221E":"unendlich","\u2665":"liebe"},"es":{"%":"por ciento","&":"y","<":"menor que",">":"mayor que","|":"o","\xA2":"centavos","\xA3":"libras","\xA4":"moneda","\u20A3":"francos","\u2211":"suma","\u221E":"infinito","\u2665":"amor"},"fr":{"%":"pourcent","&":"et","<":"plus petit",">":"plus grand","|":"ou","\xA2":"centime","\xA3":"livre","\xA4":"devise","\u20A3":"franc","\u2211":"somme","\u221E":"infini","\u2665":"amour"},"pt":{"%":"porcento","&":"e","<":"menor",">":"maior","|":"ou","\xA2":"centavo","\u2211":"soma","\xA3":"libra","\u221E":"infinito","\u2665":"amor"},"uk":{"\u0418":"Y","\u0438":"y","\u0419":"Y","\u0439":"y","\u0426":"Ts","\u0446":"ts","\u0425":"Kh","\u0445":"kh","\u0429":"Shch","\u0449":"shch","\u0413":"H","\u0433":"h"},"vi":{"\u0110":"D","\u0111":"d"},"da":{"\xD8":"OE","\xF8":"oe","\xC5":"AA","\xE5":"aa","%":"procent","&":"og","|":"eller","$":"dollar","<":"mindre end",">":"st\xF8rre end"},"nb":{"&":"og","\xC5":"AA","\xC6":"AE","\xD8":"OE","\xE5":"aa","\xE6":"ae","\xF8":"oe"},"it":{"&":"e"},"nl":{"&":"en"},"sv":{"&":"och","\xC5":"AA","\xC4":"AE","\xD6":"OE","\xE5":"aa","\xE4":"ae","\xF6":"oe"}}');
|
|
47951
48047
|
init_consola_36c0034f2();
|
|
47952
48048
|
init_core2();
|
|
@@ -48297,12 +48393,16 @@ var config4 = {
|
|
|
48297
48393
|
type: "Select the type of change that you\u2019re committing:",
|
|
48298
48394
|
scope: "Select the SCOPE of this change (optional):",
|
|
48299
48395
|
customScope: "Select the SCOPE of this change:",
|
|
48300
|
-
subject:
|
|
48301
|
-
|
|
48302
|
-
|
|
48396
|
+
subject: `Write a SHORT, IMPERATIVE tense description of the change:
|
|
48397
|
+
`,
|
|
48398
|
+
body: `Provide a LONGER description of the change (optional). Use "|" to break new line:
|
|
48399
|
+
`,
|
|
48400
|
+
breaking: `List any BREAKING CHANGES (optional). Use "|" to break new line:
|
|
48401
|
+
`,
|
|
48303
48402
|
footerPrefixesSelect: "Select the ISSUES type of the change list by this change (optional):",
|
|
48304
48403
|
customFooterPrefixes: "Input ISSUES prefix:",
|
|
48305
|
-
footer:
|
|
48404
|
+
footer: `List any ISSUES by this change. E.g.: #31, #34:
|
|
48405
|
+
`,
|
|
48306
48406
|
confirmCommit: "Are you sure you want to proceed with the commit above?"
|
|
48307
48407
|
},
|
|
48308
48408
|
types: [
|
|
@@ -49329,7 +49429,8 @@ var import_escape2 = __toESM22(require_escape2(), 1);
|
|
|
49329
49429
|
var import_normalizeEmail2 = __toESM22(require_normalizeEmail2(), 1);
|
|
49330
49430
|
var CompilerBuffer2 = class _CompilerBuffer2 {
|
|
49331
49431
|
#content = "";
|
|
49332
|
-
newLine =
|
|
49432
|
+
newLine = `
|
|
49433
|
+
`;
|
|
49333
49434
|
writeStatement(statement) {
|
|
49334
49435
|
this.#content = `${this.#content}${this.newLine}${statement}`;
|
|
49335
49436
|
}
|
|
@@ -49467,7 +49568,8 @@ function defineFieldValidations2({
|
|
|
49467
49568
|
variableName,
|
|
49468
49569
|
dropMissingCheck
|
|
49469
49570
|
}) {
|
|
49470
|
-
return `${validations.map((one) => emitValidationSnippet2(one, variableName, bail, dropMissingCheck)).join(
|
|
49571
|
+
return `${validations.map((one) => emitValidationSnippet2(one, variableName, bail, dropMissingCheck)).join(`
|
|
49572
|
+
`)}`;
|
|
49471
49573
|
}
|
|
49472
49574
|
function defineArrayInitialOutput2({
|
|
49473
49575
|
variableName,
|
|
@@ -51291,7 +51393,7 @@ var alphaRule2 = createRule2((value, options2, field) => {
|
|
|
51291
51393
|
characterSet += "_";
|
|
51292
51394
|
}
|
|
51293
51395
|
}
|
|
51294
|
-
const expression = new RegExp(`^[${characterSet}]
|
|
51396
|
+
const expression = new RegExp(`^[${characterSet}]+$`);
|
|
51295
51397
|
if (!expression.test(value)) {
|
|
51296
51398
|
field.report(messages2.alpha, "alpha", field);
|
|
51297
51399
|
}
|
|
@@ -51312,7 +51414,7 @@ var alphaNumericRule2 = createRule2((value, options2, field) => {
|
|
|
51312
51414
|
characterSet += "_";
|
|
51313
51415
|
}
|
|
51314
51416
|
}
|
|
51315
|
-
const expression = new RegExp(`^[${characterSet}]
|
|
51417
|
+
const expression = new RegExp(`^[${characterSet}]+$`);
|
|
51316
51418
|
if (!expression.test(value)) {
|
|
51317
51419
|
field.report(messages2.alphaNumeric, "alphaNumeric", field);
|
|
51318
51420
|
}
|
|
@@ -52580,12 +52682,16 @@ var git_default2 = {
|
|
|
52580
52682
|
type: "Select the type of change that you\u2019re committing:",
|
|
52581
52683
|
scope: "Select the SCOPE of this change (optional):",
|
|
52582
52684
|
customScope: "Select the SCOPE of this change:",
|
|
52583
|
-
subject:
|
|
52584
|
-
|
|
52585
|
-
|
|
52685
|
+
subject: `Write a SHORT, IMPERATIVE tense description of the change:
|
|
52686
|
+
`,
|
|
52687
|
+
body: `Provide a LONGER description of the change (optional). Use "|" to break new line:
|
|
52688
|
+
`,
|
|
52689
|
+
breaking: `List any BREAKING CHANGES (optional). Use "|" to break new line:
|
|
52690
|
+
`,
|
|
52586
52691
|
footerPrefixesSelect: "Select the ISSUES type of the change list by this change (optional):",
|
|
52587
52692
|
customFooterPrefixes: "Input ISSUES prefix:",
|
|
52588
|
-
footer:
|
|
52693
|
+
footer: `List any ISSUES by this change. E.g.: #31, #34:
|
|
52694
|
+
`,
|
|
52589
52695
|
confirmCommit: "Are you sure you want to proceed with the commit above?"
|
|
52590
52696
|
},
|
|
52591
52697
|
types: [
|
|
@@ -53125,7 +53231,7 @@ function determineAppEnv2() {
|
|
|
53125
53231
|
if (app22.env === "production")
|
|
53126
53232
|
return "prod";
|
|
53127
53233
|
if (!app22.env)
|
|
53128
|
-
throw new Error("Couldn
|
|
53234
|
+
throw new Error("Couldn't determine app environment");
|
|
53129
53235
|
return app22.env;
|
|
53130
53236
|
}
|
|
53131
53237
|
|
|
@@ -53162,7 +53268,8 @@ class ErrorHandler2 {
|
|
|
53162
53268
|
console.error("Error is not an instance of Error:", err2);
|
|
53163
53269
|
return;
|
|
53164
53270
|
}
|
|
53165
|
-
const formattedError = `[${new Date().toISOString()}] ${err2.name}: ${err2.message}
|
|
53271
|
+
const formattedError = `[${new Date().toISOString()}] ${err2.name}: ${err2.message}
|
|
53272
|
+
`;
|
|
53166
53273
|
const logFilePath = logsPath2("stacks.log") ?? logsPath2("errors.log");
|
|
53167
53274
|
try {
|
|
53168
53275
|
await mkdir2(dirname3(logFilePath), { recursive: true });
|
|
@@ -53200,7 +53307,8 @@ function handleError2(err2, options2) {
|
|
|
53200
53307
|
return ErrorHandler2.handle(err2, options2);
|
|
53201
53308
|
}
|
|
53202
53309
|
async function writeToLogFile2(message, options2) {
|
|
53203
|
-
const formattedMessage = `[${new Date().toISOString()}] ${message}
|
|
53310
|
+
const formattedMessage = `[${new Date().toISOString()}] ${message}
|
|
53311
|
+
`;
|
|
53204
53312
|
try {
|
|
53205
53313
|
const logFile = options2?.logFile ?? exports_config2.logging.logsPath ?? "storage/logs/stacks.log";
|
|
53206
53314
|
try {
|
|
@@ -54115,7 +54223,7 @@ function _supportsColor2(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
54115
54223
|
return min;
|
|
54116
54224
|
}
|
|
54117
54225
|
if (process112.platform === "win32") {
|
|
54118
|
-
const osRelease =
|
|
54226
|
+
const osRelease = os3.release().split(".");
|
|
54119
54227
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
54120
54228
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
54121
54229
|
}
|
|
@@ -54194,9 +54302,12 @@ function stringEncaseCRLFWithFirstIndex2(string2, prefix, postfix, index) {
|
|
|
54194
54302
|
let returnValue = "";
|
|
54195
54303
|
do {
|
|
54196
54304
|
const gotCR = string2[index - 1] === "\r";
|
|
54197
|
-
returnValue += string2.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ?
|
|
54305
|
+
returnValue += string2.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? `\r
|
|
54306
|
+
` : `
|
|
54307
|
+
`) + postfix;
|
|
54198
54308
|
endIndex = index + 1;
|
|
54199
|
-
index = string2.indexOf(
|
|
54309
|
+
index = string2.indexOf(`
|
|
54310
|
+
`, endIndex);
|
|
54200
54311
|
} while (index !== -1);
|
|
54201
54312
|
returnValue += string2.slice(endIndex);
|
|
54202
54313
|
return returnValue;
|
|
@@ -54336,7 +54447,8 @@ var applyStyle2 = (self2, string2) => {
|
|
|
54336
54447
|
styler = styler.parent;
|
|
54337
54448
|
}
|
|
54338
54449
|
}
|
|
54339
|
-
const lfIndex = string2.indexOf(
|
|
54450
|
+
const lfIndex = string2.indexOf(`
|
|
54451
|
+
`);
|
|
54340
54452
|
if (lfIndex !== -1) {
|
|
54341
54453
|
string2 = stringEncaseCRLFWithFirstIndex2(string2, closeAll, openAll, lfIndex);
|
|
54342
54454
|
}
|
|
@@ -54370,7 +54482,8 @@ var changePrototype2 = (to, from) => {
|
|
|
54370
54482
|
}
|
|
54371
54483
|
Object.setPrototypeOf(to, fromPrototype);
|
|
54372
54484
|
};
|
|
54373
|
-
var wrappedToString2 = (withName, fromBody) => `/* Wrapped ${withName}
|
|
54485
|
+
var wrappedToString2 = (withName, fromBody) => `/* Wrapped ${withName}*/
|
|
54486
|
+
${fromBody}`;
|
|
54374
54487
|
var toStringDescriptor2 = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
|
|
54375
54488
|
var toStringName2 = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
|
|
54376
54489
|
var changeToString2 = (to, from, name) => {
|
|
@@ -54971,7 +55084,8 @@ class Ora2 {
|
|
|
54971
55084
|
const fullSuffixText = this.#getFullSuffixText(this.#suffixText, "-");
|
|
54972
55085
|
const fullText = " ".repeat(this.#indent) + fullPrefixText + "--" + this.#text + "--" + fullSuffixText;
|
|
54973
55086
|
this.#lineCount = 0;
|
|
54974
|
-
for (const line of stripAnsi32(fullText).split(
|
|
55087
|
+
for (const line of stripAnsi32(fullText).split(`
|
|
55088
|
+
`)) {
|
|
54975
55089
|
this.#lineCount += Math.max(1, Math.ceil(stringWidth22(line, { countAnsiEscapeCodes: true }) / columns));
|
|
54976
55090
|
}
|
|
54977
55091
|
}
|
|
@@ -55041,7 +55155,8 @@ class Ora2 {
|
|
|
55041
55155
|
}
|
|
55042
55156
|
if (!this.#isEnabled) {
|
|
55043
55157
|
if (this.text) {
|
|
55044
|
-
this.#stream.write(`- ${this.text}
|
|
55158
|
+
this.#stream.write(`- ${this.text}
|
|
55159
|
+
`);
|
|
55045
55160
|
}
|
|
55046
55161
|
return this;
|
|
55047
55162
|
}
|
|
@@ -55099,7 +55214,8 @@ class Ora2 {
|
|
|
55099
55214
|
const fullText = typeof text22 === "string" ? " " + text22 : "";
|
|
55100
55215
|
const suffixText = options22.suffixText ?? this.#suffixText;
|
|
55101
55216
|
const fullSuffixText = this.#getFullSuffixText(suffixText, " ");
|
|
55102
|
-
const textToWrite = fullPrefixText + symbolText + fullText + fullSuffixText +
|
|
55217
|
+
const textToWrite = fullPrefixText + symbolText + fullText + fullSuffixText + `
|
|
55218
|
+
`;
|
|
55103
55219
|
this.stop();
|
|
55104
55220
|
this.#stream.write(textToWrite);
|
|
55105
55221
|
return this;
|
|
@@ -56598,17 +56714,17 @@ class Collection2 {
|
|
|
56598
56714
|
var buildKeyPathMap3 = function buildKeyPathMap22(items) {
|
|
56599
56715
|
const keyPaths = {};
|
|
56600
56716
|
items.forEach((item, index) => {
|
|
56601
|
-
function buildKeyPath(val,
|
|
56717
|
+
function buildKeyPath(val, keyPath) {
|
|
56602
56718
|
if (isObject23(val)) {
|
|
56603
56719
|
Object.keys(val).forEach((prop) => {
|
|
56604
|
-
buildKeyPath(val[prop], `${
|
|
56720
|
+
buildKeyPath(val[prop], `${keyPath}.${prop}`);
|
|
56605
56721
|
});
|
|
56606
56722
|
} else if (isArray2(val)) {
|
|
56607
56723
|
val.forEach((v22, i) => {
|
|
56608
|
-
buildKeyPath(v22, `${
|
|
56724
|
+
buildKeyPath(v22, `${keyPath}.${i}`);
|
|
56609
56725
|
});
|
|
56610
56726
|
}
|
|
56611
|
-
keyPaths[
|
|
56727
|
+
keyPaths[keyPath] = val;
|
|
56612
56728
|
}
|
|
56613
56729
|
buildKeyPath(item, index);
|
|
56614
56730
|
});
|
|
@@ -56646,26 +56762,40 @@ var quotes2 = collect2([
|
|
|
56646
56762
|
]);
|
|
56647
56763
|
var export_prompts2 = import_prompts2.default;
|
|
56648
56764
|
var import_node_forge2 = __toESM3(require_lib2(), 1);
|
|
56649
|
-
function deepMerge2(target,
|
|
56650
|
-
if (!
|
|
56651
|
-
return
|
|
56652
|
-
|
|
56653
|
-
if (
|
|
56654
|
-
|
|
56655
|
-
|
|
56656
|
-
|
|
56657
|
-
|
|
56658
|
-
|
|
56659
|
-
|
|
56660
|
-
|
|
56661
|
-
|
|
56765
|
+
function deepMerge2(target, source) {
|
|
56766
|
+
if (Array.isArray(source) && !Array.isArray(target)) {
|
|
56767
|
+
return source;
|
|
56768
|
+
}
|
|
56769
|
+
if (Array.isArray(source) && Array.isArray(target)) {
|
|
56770
|
+
return source.map((sourceItem, index) => {
|
|
56771
|
+
const targetItem = target[index];
|
|
56772
|
+
if (isObject32(sourceItem) && isObject32(targetItem)) {
|
|
56773
|
+
return deepMerge2(targetItem, sourceItem);
|
|
56774
|
+
}
|
|
56775
|
+
return sourceItem;
|
|
56776
|
+
});
|
|
56777
|
+
}
|
|
56778
|
+
if (!isObject32(source) || !isObject32(target)) {
|
|
56779
|
+
return source;
|
|
56780
|
+
}
|
|
56781
|
+
const merged = { ...target };
|
|
56782
|
+
for (const key in source) {
|
|
56783
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
56784
|
+
const sourceValue = source[key];
|
|
56785
|
+
const targetValue = merged[key];
|
|
56786
|
+
if (sourceValue === null || sourceValue === undefined) {
|
|
56787
|
+
merged[key] = sourceValue;
|
|
56788
|
+
} else if (isObject32(sourceValue) && isObject32(targetValue)) {
|
|
56789
|
+
merged[key] = deepMerge2(targetValue, sourceValue);
|
|
56790
|
+
} else {
|
|
56791
|
+
merged[key] = sourceValue;
|
|
56662
56792
|
}
|
|
56663
56793
|
}
|
|
56664
56794
|
}
|
|
56665
|
-
return
|
|
56795
|
+
return merged;
|
|
56666
56796
|
}
|
|
56667
56797
|
function isObject32(item) {
|
|
56668
|
-
return item && typeof item === "object" && !Array.isArray(item);
|
|
56798
|
+
return Boolean(item && typeof item === "object" && !Array.isArray(item));
|
|
56669
56799
|
}
|
|
56670
56800
|
async function loadConfig2({ name, cwd, defaultConfig }) {
|
|
56671
56801
|
const configPath = resolve3(cwd || process22.cwd(), `${name}.config`);
|
|
@@ -56687,13 +56817,13 @@ var config42 = await loadConfig2({
|
|
|
56687
56817
|
stateName: "California",
|
|
56688
56818
|
localityName: "Playa Vista",
|
|
56689
56819
|
commonName: "stacks.localhost",
|
|
56690
|
-
validityDays:
|
|
56820
|
+
validityDays: 825,
|
|
56691
56821
|
hostCertCN: "stacks.localhost",
|
|
56692
56822
|
domain: "stacks.localhost",
|
|
56693
56823
|
rootCAObject: { certificate: "", privateKey: "" },
|
|
56694
|
-
caCertPath:
|
|
56695
|
-
certPath:
|
|
56696
|
-
keyPath:
|
|
56824
|
+
caCertPath: path2.join(os22.homedir(), ".stacks", "ssl", `stacks.localhost.ca.crt`),
|
|
56825
|
+
certPath: path2.join(os22.homedir(), ".stacks", "ssl", `stacks.localhost.crt`),
|
|
56826
|
+
keyPath: path2.join(os22.homedir(), ".stacks", "ssl", `stacks.localhost.crt.key`),
|
|
56697
56827
|
verbose: false
|
|
56698
56828
|
}
|
|
56699
56829
|
});
|
|
@@ -56709,10 +56839,10 @@ function findFoldersWithFile(rootDir, fileName) {
|
|
|
56709
56839
|
const result = [];
|
|
56710
56840
|
function search(dir) {
|
|
56711
56841
|
try {
|
|
56712
|
-
const files =
|
|
56842
|
+
const files = fs.readdirSync(dir);
|
|
56713
56843
|
for (const file of files) {
|
|
56714
56844
|
const filePath = path22.join(dir, file);
|
|
56715
|
-
const stats =
|
|
56845
|
+
const stats = fs.lstatSync(filePath);
|
|
56716
56846
|
if (stats.isDirectory()) {
|
|
56717
56847
|
search(filePath);
|
|
56718
56848
|
} else if (file === fileName) {
|
|
@@ -56726,66 +56856,83 @@ function findFoldersWithFile(rootDir, fileName) {
|
|
|
56726
56856
|
search(rootDir);
|
|
56727
56857
|
return result;
|
|
56728
56858
|
}
|
|
56729
|
-
function
|
|
56859
|
+
function debugLog(category, message, verbose) {
|
|
56730
56860
|
if (verbose || config42.verbose) {
|
|
56731
56861
|
console.debug(`[tlsx:${category}] ${message}`);
|
|
56732
56862
|
}
|
|
56733
56863
|
}
|
|
56734
|
-
function
|
|
56735
|
-
|
|
56864
|
+
function generateRandomSerial(verbose) {
|
|
56865
|
+
debugLog("cert", "Generating random serial number", verbose);
|
|
56736
56866
|
const serialNumber = makeNumberPositive(import_node_forge2.default.util.bytesToHex(import_node_forge2.default.random.getBytesSync(20)));
|
|
56737
|
-
|
|
56867
|
+
debugLog("cert", `Generated serial number: ${serialNumber}`, verbose);
|
|
56738
56868
|
return serialNumber;
|
|
56739
56869
|
}
|
|
56740
|
-
function
|
|
56741
|
-
|
|
56742
|
-
const
|
|
56743
|
-
|
|
56744
|
-
const
|
|
56745
|
-
const
|
|
56746
|
-
|
|
56747
|
-
|
|
56748
|
-
|
|
56749
|
-
}
|
|
56750
|
-
|
|
56751
|
-
|
|
56752
|
-
const
|
|
56753
|
-
|
|
56754
|
-
|
|
56755
|
-
|
|
56756
|
-
|
|
56757
|
-
|
|
56758
|
-
|
|
56759
|
-
|
|
56760
|
-
|
|
56761
|
-
|
|
56762
|
-
|
|
56763
|
-
|
|
56764
|
-
|
|
56765
|
-
|
|
56766
|
-
|
|
56767
|
-
|
|
56768
|
-
|
|
56769
|
-
|
|
56770
|
-
}
|
|
56771
|
-
|
|
56772
|
-
|
|
56773
|
-
|
|
56774
|
-
|
|
56775
|
-
|
|
56776
|
-
|
|
56777
|
-
|
|
56778
|
-
|
|
56779
|
-
|
|
56870
|
+
function calculateValidityDates(options22) {
|
|
56871
|
+
const notBeforeDays = options22.notBeforeDays ?? 2;
|
|
56872
|
+
const validityDays = options22.validityDays ?? (options22.validityYears ? options22.validityYears * 365 : 180);
|
|
56873
|
+
debugLog("cert", "Calculating certificate validity dates", options22.verbose);
|
|
56874
|
+
const notBefore = new Date(Date.now() - 86400 * notBeforeDays * 1000);
|
|
56875
|
+
const notAfter = new Date(notBefore.getTime() + validityDays * 24 * 60 * 60 * 1000);
|
|
56876
|
+
notBefore.setUTCHours(0, 0, 0, 0);
|
|
56877
|
+
notAfter.setUTCHours(23, 59, 59, 999);
|
|
56878
|
+
debugLog("cert", `Validity period: ${notBefore.toISOString()} to ${notAfter.toISOString()}`, options22.verbose);
|
|
56879
|
+
return { notBefore, notAfter };
|
|
56880
|
+
}
|
|
56881
|
+
function generateCertificateExtensions(options22) {
|
|
56882
|
+
const extensions = [];
|
|
56883
|
+
extensions.push({
|
|
56884
|
+
name: "basicConstraints",
|
|
56885
|
+
cA: options22.isCA ?? false,
|
|
56886
|
+
critical: true,
|
|
56887
|
+
...options22.basicConstraints || {}
|
|
56888
|
+
});
|
|
56889
|
+
if (options22.keyUsage) {
|
|
56890
|
+
extensions.push({
|
|
56891
|
+
name: "keyUsage",
|
|
56892
|
+
critical: true,
|
|
56893
|
+
...options22.keyUsage
|
|
56894
|
+
});
|
|
56895
|
+
}
|
|
56896
|
+
if (options22.extKeyUsage) {
|
|
56897
|
+
extensions.push({
|
|
56898
|
+
name: "extKeyUsage",
|
|
56899
|
+
...options22.extKeyUsage
|
|
56900
|
+
});
|
|
56901
|
+
}
|
|
56902
|
+
if (options22.subjectAltNames && options22.subjectAltNames.length > 0) {
|
|
56903
|
+
extensions.push({
|
|
56904
|
+
name: "subjectAltName",
|
|
56905
|
+
altNames: options22.subjectAltNames
|
|
56906
|
+
});
|
|
56907
|
+
}
|
|
56908
|
+
return extensions;
|
|
56909
|
+
}
|
|
56910
|
+
async function createRootCA(options22 = {}) {
|
|
56911
|
+
debugLog("ca", "Creating new Root CA Certificate", options22.verbose);
|
|
56912
|
+
const keySize = options22.keySize || 2048;
|
|
56913
|
+
debugLog("ca", `Generating ${keySize}-bit RSA key pair`, options22.verbose);
|
|
56914
|
+
const { privateKey, publicKey } = import_node_forge2.pki.rsa.generateKeyPair(keySize);
|
|
56780
56915
|
const attributes = [
|
|
56781
|
-
{ shortName: "C", value:
|
|
56782
|
-
{ shortName: "ST", value:
|
|
56783
|
-
{ shortName: "L", value:
|
|
56784
|
-
{ shortName: "O", value: "Local Development CA" },
|
|
56785
|
-
{ shortName: "
|
|
56916
|
+
{ shortName: "C", value: options22.countryName || config42.countryName },
|
|
56917
|
+
{ shortName: "ST", value: options22.stateName || config42.stateName },
|
|
56918
|
+
{ shortName: "L", value: options22.localityName || config42.localityName },
|
|
56919
|
+
{ shortName: "O", value: options22.organization || "Local Development CA" },
|
|
56920
|
+
{ shortName: "OU", value: options22.organizationalUnit || "Certificate Authority" },
|
|
56921
|
+
{ shortName: "CN", value: options22.commonName || "Local Development Root CA" },
|
|
56922
|
+
...options22.extraAttributes || []
|
|
56786
56923
|
];
|
|
56787
|
-
|
|
56788
|
-
|
|
56924
|
+
const { notBefore, notAfter } = calculateValidityDates({
|
|
56925
|
+
validityYears: options22.validityYears || 100,
|
|
56926
|
+
verbose: options22.verbose
|
|
56927
|
+
});
|
|
56928
|
+
const caCert = import_node_forge2.pki.createCertificate();
|
|
56929
|
+
caCert.publicKey = publicKey;
|
|
56930
|
+
caCert.serialNumber = generateRandomSerial(options22.verbose);
|
|
56931
|
+
caCert.validity.notBefore = notBefore;
|
|
56932
|
+
caCert.validity.notAfter = notAfter;
|
|
56933
|
+
caCert.setSubject(attributes);
|
|
56934
|
+
caCert.setIssuer(attributes);
|
|
56935
|
+
caCert.setExtensions([
|
|
56789
56936
|
{
|
|
56790
56937
|
name: "basicConstraints",
|
|
56791
56938
|
cA: true,
|
|
@@ -56800,295 +56947,472 @@ async function createRootCA(options22) {
|
|
|
56800
56947
|
{
|
|
56801
56948
|
name: "subjectKeyIdentifier"
|
|
56802
56949
|
}
|
|
56803
|
-
];
|
|
56804
|
-
debugLog2("ca", "Creating CA certificate", options22?.verbose);
|
|
56805
|
-
const caCert = import_node_forge2.pki.createCertificate();
|
|
56806
|
-
caCert.publicKey = publicKey;
|
|
56807
|
-
caCert.serialNumber = randomSerialNumber(options22?.verbose);
|
|
56808
|
-
caCert.validity.notBefore = getCertNotBefore(options22?.verbose);
|
|
56809
|
-
caCert.validity.notAfter = getCANotAfter(caCert.validity.notBefore, options22?.verbose);
|
|
56810
|
-
caCert.setSubject(attributes);
|
|
56811
|
-
caCert.setIssuer(attributes);
|
|
56812
|
-
caCert.setExtensions(extensions);
|
|
56813
|
-
debugLog2("ca", "Signing certificate with SHA-256", options22?.verbose);
|
|
56950
|
+
]);
|
|
56814
56951
|
caCert.sign(privateKey, import_node_forge2.default.md.sha256.create());
|
|
56815
|
-
const pemCert = import_node_forge2.pki.certificateToPem(caCert);
|
|
56816
|
-
const pemKey = import_node_forge2.pki.privateKeyToPem(privateKey);
|
|
56817
|
-
debugLog2("ca", "Root CA Certificate created successfully", options22?.verbose);
|
|
56818
56952
|
return {
|
|
56819
|
-
certificate:
|
|
56820
|
-
privateKey:
|
|
56821
|
-
notBefore
|
|
56822
|
-
notAfter
|
|
56953
|
+
certificate: import_node_forge2.pki.certificateToPem(caCert),
|
|
56954
|
+
privateKey: import_node_forge2.pki.privateKeyToPem(privateKey),
|
|
56955
|
+
notBefore,
|
|
56956
|
+
notAfter
|
|
56823
56957
|
};
|
|
56824
56958
|
}
|
|
56825
|
-
async function
|
|
56826
|
-
|
|
56827
|
-
|
|
56828
|
-
if (!options22?.
|
|
56829
|
-
|
|
56830
|
-
throw new Error('"hostCertCN" must be a String');
|
|
56831
|
-
}
|
|
56832
|
-
if (!options22.domain?.trim()) {
|
|
56833
|
-
debugLog2("cert", "Error: domain is required", options22?.verbose);
|
|
56834
|
-
throw new Error('"domain" must be a String');
|
|
56835
|
-
}
|
|
56836
|
-
if (!options22.rootCAObject || !options22.rootCAObject.certificate || !options22.rootCAObject.privateKey) {
|
|
56837
|
-
debugLog2("cert", "Error: rootCAObject is invalid or missing", options22?.verbose);
|
|
56838
|
-
throw new Error('"rootCAObject" must be an Object with the properties "certificate" & "privateKey"');
|
|
56959
|
+
async function generateCertificate(options22) {
|
|
56960
|
+
debugLog("cert", "Generating new certificate", options22.verbose);
|
|
56961
|
+
debugLog("cert", `Options: ${JSON.stringify(options22)}`, options22.verbose);
|
|
56962
|
+
if (!options22.rootCAObject?.certificate || !options22.rootCAObject?.privateKey) {
|
|
56963
|
+
throw new Error("Root CA certificate and private key are required");
|
|
56839
56964
|
}
|
|
56840
|
-
debugLog2("cert", "Converting Root CA PEM to forge objects", options22?.verbose);
|
|
56841
56965
|
const caCert = import_node_forge2.pki.certificateFromPem(options22.rootCAObject.certificate);
|
|
56842
56966
|
const caKey = import_node_forge2.pki.privateKeyFromPem(options22.rootCAObject.privateKey);
|
|
56843
|
-
|
|
56844
|
-
const
|
|
56845
|
-
|
|
56846
|
-
const attributes = [
|
|
56967
|
+
debugLog("cert", "Generating 2048-bit RSA key pair for host certificate", options22?.verbose);
|
|
56968
|
+
const keySize = 2048;
|
|
56969
|
+
const { privateKey, publicKey } = import_node_forge2.pki.rsa.generateKeyPair(keySize);
|
|
56970
|
+
const attributes = options22.certificateAttributes || [
|
|
56847
56971
|
{ shortName: "C", value: options22.countryName || config42.countryName },
|
|
56848
56972
|
{ shortName: "ST", value: options22.stateName || config42.stateName },
|
|
56849
56973
|
{ shortName: "L", value: options22.localityName || config42.localityName },
|
|
56850
56974
|
{ shortName: "O", value: options22.organizationName || config42.organizationName },
|
|
56851
56975
|
{ shortName: "CN", value: options22.commonName || config42.commonName }
|
|
56852
56976
|
];
|
|
56853
|
-
const
|
|
56854
|
-
|
|
56855
|
-
|
|
56856
|
-
|
|
56857
|
-
|
|
56858
|
-
|
|
56859
|
-
|
|
56860
|
-
|
|
56861
|
-
|
|
56862
|
-
|
|
56863
|
-
|
|
56864
|
-
|
|
56865
|
-
|
|
56866
|
-
},
|
|
56867
|
-
{
|
|
56868
|
-
name: "keyUsage",
|
|
56869
|
-
digitalSignature: true,
|
|
56870
|
-
keyEncipherment: true,
|
|
56871
|
-
critical: true
|
|
56872
|
-
},
|
|
56873
|
-
{
|
|
56874
|
-
name: "extKeyUsage",
|
|
56875
|
-
serverAuth: true,
|
|
56876
|
-
clientAuth: false
|
|
56877
|
-
},
|
|
56878
|
-
{
|
|
56879
|
-
name: "subjectAltName",
|
|
56880
|
-
altNames
|
|
56881
|
-
}
|
|
56882
|
-
];
|
|
56883
|
-
debugLog2("cert", "Creating new host certificate", options22?.verbose);
|
|
56884
|
-
const newHostCert = import_node_forge2.pki.createCertificate();
|
|
56885
|
-
newHostCert.publicKey = hostKeys.publicKey;
|
|
56886
|
-
debugLog2("cert", "Setting certificate properties", options22?.verbose);
|
|
56887
|
-
newHostCert.serialNumber = randomSerialNumber(options22?.verbose);
|
|
56888
|
-
newHostCert.validity.notBefore = getCertNotBefore(options22?.verbose);
|
|
56889
|
-
newHostCert.validity.notAfter = getCertNotAfter(newHostCert.validity.notBefore, options22?.verbose);
|
|
56890
|
-
newHostCert.setSubject(attributes);
|
|
56891
|
-
newHostCert.setIssuer(caCert.subject.attributes);
|
|
56892
|
-
newHostCert.setExtensions(extensions);
|
|
56893
|
-
debugLog2("cert", "Signing certificate with SHA-256", options22?.verbose);
|
|
56894
|
-
newHostCert.sign(caKey, import_node_forge2.default.md.sha256.create());
|
|
56895
|
-
debugLog2("cert", "Converting certificate to PEM format", options22?.verbose);
|
|
56896
|
-
const pemHostCert = import_node_forge2.pki.certificateToPem(newHostCert);
|
|
56897
|
-
const pemHostKey = import_node_forge2.pki.privateKeyToPem(hostKeys.privateKey);
|
|
56898
|
-
debugLog2("cert", "Host certificate generated successfully", options22?.verbose);
|
|
56977
|
+
const { notBefore, notAfter } = calculateValidityDates({
|
|
56978
|
+
validityDays: options22.validityDays,
|
|
56979
|
+
verbose: options22.verbose
|
|
56980
|
+
});
|
|
56981
|
+
const cert = import_node_forge2.pki.createCertificate();
|
|
56982
|
+
cert.publicKey = publicKey;
|
|
56983
|
+
cert.serialNumber = generateRandomSerial(options22.verbose);
|
|
56984
|
+
cert.validity.notBefore = notBefore;
|
|
56985
|
+
cert.validity.notAfter = notAfter;
|
|
56986
|
+
cert.setSubject(attributes);
|
|
56987
|
+
cert.setIssuer(caCert.subject.attributes);
|
|
56988
|
+
cert.setExtensions(generateCertificateExtensions(options22));
|
|
56989
|
+
cert.sign(caKey, import_node_forge2.default.md.sha256.create());
|
|
56899
56990
|
return {
|
|
56900
|
-
certificate:
|
|
56901
|
-
privateKey:
|
|
56902
|
-
notBefore
|
|
56903
|
-
notAfter
|
|
56991
|
+
certificate: import_node_forge2.pki.certificateToPem(cert),
|
|
56992
|
+
privateKey: import_node_forge2.pki.privateKeyToPem(privateKey),
|
|
56993
|
+
notBefore,
|
|
56994
|
+
notAfter
|
|
56904
56995
|
};
|
|
56905
56996
|
}
|
|
56906
56997
|
async function addCertToSystemTrustStoreAndSaveCert(cert, caCert, options22) {
|
|
56907
|
-
|
|
56908
|
-
|
|
56909
|
-
const
|
|
56910
|
-
|
|
56911
|
-
const
|
|
56998
|
+
debugLog("trust", `Adding certificate to system trust store with options: ${JSON.stringify(options22)}`, options22?.verbose);
|
|
56999
|
+
debugLog("trust", "Storing certificate and private key", options22?.verbose);
|
|
57000
|
+
const certPath = storeCertificate(cert, options22);
|
|
57001
|
+
debugLog("trust", "Storing CA certificate", options22?.verbose);
|
|
57002
|
+
const caCertPath = storeCACertificate(caCert, options22);
|
|
56912
57003
|
const platform22 = os4.platform();
|
|
56913
|
-
|
|
57004
|
+
debugLog("trust", `Detected platform: ${platform22}`, options22?.verbose);
|
|
56914
57005
|
const args = "TC, C, C";
|
|
56915
57006
|
if (platform22 === "darwin") {
|
|
56916
|
-
|
|
56917
|
-
await runCommand(`sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ${
|
|
57007
|
+
debugLog("trust", "Adding certificate to macOS keychain", options22?.verbose);
|
|
57008
|
+
await runCommand(`sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ${caCertPath}`);
|
|
56918
57009
|
} else if (platform22 === "win32") {
|
|
56919
|
-
|
|
56920
|
-
await runCommand(`certutil -f -v -addstore -enterprise Root ${
|
|
57010
|
+
debugLog("trust", "Adding certificate to Windows certificate store", options22?.verbose);
|
|
57011
|
+
await runCommand(`certutil -f -v -addstore -enterprise Root ${caCertPath}`);
|
|
56921
57012
|
} else if (platform22 === "linux") {
|
|
56922
|
-
|
|
57013
|
+
debugLog("trust", "Adding certificate to Linux certificate store", options22?.verbose);
|
|
56923
57014
|
const rootDirectory = os4.homedir();
|
|
56924
57015
|
const targetFileName = "cert9.db";
|
|
56925
|
-
|
|
57016
|
+
debugLog("trust", `Searching for certificate databases in ${rootDirectory}`, options22?.verbose);
|
|
56926
57017
|
const foldersWithFile = findFoldersWithFile(rootDirectory, targetFileName);
|
|
56927
57018
|
for (const folder of foldersWithFile) {
|
|
56928
|
-
|
|
57019
|
+
debugLog("trust", `Processing certificate database in ${folder}`, options22?.verbose);
|
|
56929
57020
|
try {
|
|
56930
|
-
|
|
57021
|
+
debugLog("trust", `Attempting to delete existing cert for ${config42.commonName}`, options22?.verbose);
|
|
56931
57022
|
await runCommand(`certutil -d sql:${folder} -D -n ${config42.commonName}`);
|
|
56932
57023
|
} catch (error) {
|
|
56933
|
-
|
|
57024
|
+
debugLog("trust", `Warning: Error deleting existing cert: ${error}`, options22?.verbose);
|
|
56934
57025
|
console.warn(`Error deleting existing cert: ${error}`);
|
|
56935
57026
|
}
|
|
56936
|
-
|
|
56937
|
-
await runCommand(`certutil -d sql:${folder} -A -t ${args} -n ${config42.commonName} -i ${
|
|
57027
|
+
debugLog("trust", `Adding new certificate to ${folder}`, options22?.verbose);
|
|
57028
|
+
await runCommand(`certutil -d sql:${folder} -A -t ${args} -n ${config42.commonName} -i ${caCertPath}`);
|
|
56938
57029
|
log2.info(`Cert added to ${folder}`);
|
|
56939
57030
|
}
|
|
56940
57031
|
} else {
|
|
56941
|
-
|
|
57032
|
+
debugLog("trust", `Error: Unsupported platform ${platform22}`, options22?.verbose);
|
|
56942
57033
|
throw new Error(`Unsupported platform: ${platform22}`);
|
|
56943
57034
|
}
|
|
56944
|
-
|
|
56945
|
-
return
|
|
57035
|
+
debugLog("trust", "Certificate successfully added to system trust store", options22?.verbose);
|
|
57036
|
+
return certPath;
|
|
56946
57037
|
}
|
|
56947
|
-
function
|
|
56948
|
-
|
|
56949
|
-
const
|
|
57038
|
+
function storeCertificate(cert, options22) {
|
|
57039
|
+
debugLog("storage", `Storing certificate and private key with options: ${JSON.stringify(options22)}`, options22?.verbose);
|
|
57040
|
+
const certPath = options22?.certPath || config42.certPath;
|
|
56950
57041
|
const certKeyPath = options22?.keyPath || config42.keyPath;
|
|
56951
|
-
|
|
56952
|
-
|
|
56953
|
-
const certDir = path3.dirname(
|
|
57042
|
+
debugLog("storage", `Certificate path: ${certPath}`, options22?.verbose);
|
|
57043
|
+
debugLog("storage", `Private key path: ${certKeyPath}`, options22?.verbose);
|
|
57044
|
+
const certDir = path3.dirname(certPath);
|
|
56954
57045
|
if (!fs2.existsSync(certDir)) {
|
|
56955
|
-
|
|
57046
|
+
debugLog("storage", `Creating certificate directory: ${certDir}`, options22?.verbose);
|
|
56956
57047
|
fs2.mkdirSync(certDir, { recursive: true });
|
|
56957
57048
|
}
|
|
56958
|
-
|
|
56959
|
-
fs2.writeFileSync(
|
|
57049
|
+
debugLog("storage", "Writing certificate file", options22?.verbose);
|
|
57050
|
+
fs2.writeFileSync(certPath, cert.certificate);
|
|
56960
57051
|
const certKeyDir = path3.dirname(certKeyPath);
|
|
56961
57052
|
if (!fs2.existsSync(certKeyDir)) {
|
|
56962
|
-
|
|
57053
|
+
debugLog("storage", `Creating private key directory: ${certKeyDir}`, options22?.verbose);
|
|
56963
57054
|
fs2.mkdirSync(certKeyDir, { recursive: true });
|
|
56964
57055
|
}
|
|
56965
|
-
|
|
57056
|
+
debugLog("storage", "Writing private key file", options22?.verbose);
|
|
56966
57057
|
fs2.writeFileSync(certKeyPath, cert.privateKey);
|
|
56967
|
-
|
|
56968
|
-
return
|
|
56969
|
-
}
|
|
56970
|
-
function
|
|
56971
|
-
|
|
56972
|
-
const
|
|
56973
|
-
|
|
56974
|
-
const caCertDir = path3.dirname(
|
|
57058
|
+
debugLog("storage", "Certificate and private key stored successfully", options22?.verbose);
|
|
57059
|
+
return certPath;
|
|
57060
|
+
}
|
|
57061
|
+
function storeCACertificate(caCert, options22) {
|
|
57062
|
+
debugLog("storage", "Storing CA certificate", options22?.verbose);
|
|
57063
|
+
const caCertPath = options22?.caCertPath || config42.caCertPath;
|
|
57064
|
+
debugLog("storage", `CA certificate path: ${caCertPath}`, options22?.verbose);
|
|
57065
|
+
const caCertDir = path3.dirname(caCertPath);
|
|
56975
57066
|
if (!fs2.existsSync(caCertDir)) {
|
|
56976
|
-
|
|
57067
|
+
debugLog("storage", `Creating CA certificate directory: ${caCertDir}`, options22?.verbose);
|
|
56977
57068
|
fs2.mkdirSync(caCertDir, { recursive: true });
|
|
56978
57069
|
}
|
|
56979
|
-
|
|
56980
|
-
fs2.writeFileSync(
|
|
56981
|
-
|
|
56982
|
-
return
|
|
57070
|
+
debugLog("storage", "Writing CA certificate file", options22?.verbose);
|
|
57071
|
+
fs2.writeFileSync(caCertPath, caCert);
|
|
57072
|
+
debugLog("storage", "CA certificate stored successfully", options22?.verbose);
|
|
57073
|
+
return caCertPath;
|
|
56983
57074
|
}
|
|
56984
57075
|
var export_tls = import_node_forge2.tls;
|
|
56985
57076
|
var export_pki = import_node_forge2.pki;
|
|
56986
57077
|
var export_forge = import_node_forge2.default;
|
|
56987
57078
|
|
|
56988
57079
|
// src/https.ts
|
|
56989
|
-
|
|
56990
|
-
|
|
56991
|
-
|
|
56992
|
-
|
|
56993
|
-
|
|
56994
|
-
|
|
56995
|
-
|
|
56996
|
-
|
|
56997
|
-
|
|
56998
|
-
|
|
56999
|
-
|
|
57080
|
+
var cachedSSLConfig = null;
|
|
57081
|
+
function isMultiProxyConfig(options3) {
|
|
57082
|
+
return "proxies" in options3;
|
|
57083
|
+
}
|
|
57084
|
+
function generateWildcardPatterns(domain) {
|
|
57085
|
+
const patterns = new Set;
|
|
57086
|
+
patterns.add(domain);
|
|
57087
|
+
const parts = domain.split(".");
|
|
57088
|
+
if (parts.length >= 2) {
|
|
57089
|
+
patterns.add(`*.${parts.slice(1).join(".")}`);
|
|
57090
|
+
}
|
|
57091
|
+
return Array.from(patterns);
|
|
57092
|
+
}
|
|
57093
|
+
function generateBaseConfig(options3, verbose) {
|
|
57094
|
+
const domains = extractDomains(options3);
|
|
57095
|
+
const sslBase = path4.join(os5.homedir(), ".stacks", "ssl");
|
|
57096
|
+
const httpsConfig = options3.https === true ? {
|
|
57097
|
+
caCertPath: path4.join(sslBase, "rpx-ca.crt"),
|
|
57098
|
+
certPath: path4.join(sslBase, "rpx.crt"),
|
|
57099
|
+
keyPath: path4.join(sslBase, "rpx.key")
|
|
57100
|
+
} : typeof config.https === "object" ? {
|
|
57101
|
+
...options3.https,
|
|
57102
|
+
...config.https
|
|
57103
|
+
} : {};
|
|
57104
|
+
debugLog2("ssl", `Extracted domains: ${domains.join(", ")}`, verbose);
|
|
57105
|
+
debugLog2("ssl", `Using SSL base path: ${sslBase}`, verbose);
|
|
57106
|
+
debugLog2("ssl", `Using HTTPS config: ${JSON.stringify(httpsConfig)}`, verbose);
|
|
57107
|
+
const allPatterns = new Set;
|
|
57108
|
+
domains.forEach((domain) => {
|
|
57109
|
+
allPatterns.add(domain);
|
|
57110
|
+
generateWildcardPatterns(domain).forEach((pattern) => allPatterns.add(pattern));
|
|
57111
|
+
});
|
|
57112
|
+
allPatterns.add("localhost");
|
|
57113
|
+
allPatterns.add("*.localhost");
|
|
57114
|
+
const uniqueDomains = Array.from(allPatterns);
|
|
57115
|
+
debugLog2("ssl", `Generated domain patterns: ${uniqueDomains.join(", ")}`, verbose);
|
|
57116
|
+
return {
|
|
57117
|
+
domain: domains[0],
|
|
57118
|
+
hostCertCN: domains[0],
|
|
57119
|
+
caCertPath: httpsConfig?.caCertPath ?? path4.join(sslBase, "rpx-ca.crt"),
|
|
57120
|
+
certPath: httpsConfig?.certPath ?? path4.join(sslBase, "rpx.crt"),
|
|
57121
|
+
keyPath: httpsConfig?.keyPath ?? path4.join(sslBase, "rpx.key"),
|
|
57122
|
+
altNameIPs: httpsConfig?.altNameIPs ?? ["127.0.0.1", "::1"],
|
|
57123
|
+
altNameURIs: httpsConfig?.altNameURIs ?? [],
|
|
57124
|
+
commonName: httpsConfig?.commonName ?? domains[0],
|
|
57125
|
+
organizationName: httpsConfig?.organizationName ?? "Local Development",
|
|
57126
|
+
countryName: httpsConfig?.countryName ?? "US",
|
|
57127
|
+
stateName: httpsConfig?.stateName ?? "California",
|
|
57128
|
+
localityName: httpsConfig?.localityName ?? "Playa Vista",
|
|
57129
|
+
validityDays: httpsConfig?.validityDays ?? 825,
|
|
57130
|
+
verbose: verbose ?? false,
|
|
57131
|
+
subjectAltNames: uniqueDomains.map((domain) => ({
|
|
57132
|
+
type: 2,
|
|
57133
|
+
value: domain
|
|
57134
|
+
}))
|
|
57135
|
+
};
|
|
57136
|
+
}
|
|
57137
|
+
function generateRootCAConfig() {
|
|
57138
|
+
const sslBase = path4.join(os5.homedir(), ".stacks", "ssl");
|
|
57139
|
+
return {
|
|
57140
|
+
domain: "stacks.localhost",
|
|
57141
|
+
hostCertCN: "stacks.localhost",
|
|
57142
|
+
caCertPath: path4.join(sslBase, "rpx-root-ca.crt"),
|
|
57143
|
+
certPath: path4.join(sslBase, "rpx-certificate.crt"),
|
|
57144
|
+
keyPath: path4.join(sslBase, "rpx-certificate.key"),
|
|
57145
|
+
altNameIPs: ["127.0.0.1", "::1"],
|
|
57146
|
+
altNameURIs: [],
|
|
57147
|
+
organizationName: "Stacks Local Development",
|
|
57000
57148
|
countryName: "US",
|
|
57001
57149
|
stateName: "California",
|
|
57002
57150
|
localityName: "Playa Vista",
|
|
57003
|
-
commonName:
|
|
57004
|
-
validityDays:
|
|
57005
|
-
verbose:
|
|
57006
|
-
};
|
|
57007
|
-
if (config.https === true)
|
|
57008
|
-
return defaultConfig;
|
|
57009
|
-
return {
|
|
57010
|
-
...defaultConfig,
|
|
57011
|
-
...config.https
|
|
57151
|
+
commonName: "stacks.localhost",
|
|
57152
|
+
validityDays: 3650,
|
|
57153
|
+
verbose: true
|
|
57012
57154
|
};
|
|
57013
57155
|
}
|
|
57014
|
-
|
|
57015
|
-
|
|
57016
|
-
|
|
57017
|
-
|
|
57156
|
+
function httpsConfig(options3) {
|
|
57157
|
+
return generateBaseConfig(options3, options3.verbose);
|
|
57158
|
+
}
|
|
57159
|
+
async function generateCertificate2(options3) {
|
|
57160
|
+
if (cachedSSLConfig) {
|
|
57161
|
+
const verbose2 = isMultiProxyConfig(options3) ? options3.verbose : options3.verbose;
|
|
57162
|
+
debugLog2("ssl", "Using cached SSL configuration", verbose2);
|
|
57018
57163
|
return;
|
|
57019
|
-
|
|
57020
|
-
|
|
57021
|
-
const
|
|
57022
|
-
|
|
57023
|
-
|
|
57024
|
-
|
|
57025
|
-
|
|
57026
|
-
|
|
57027
|
-
|
|
57028
|
-
|
|
57029
|
-
|
|
57030
|
-
organizationName: config.https.organizationName,
|
|
57031
|
-
validityDays: config.https.validityDays,
|
|
57164
|
+
}
|
|
57165
|
+
const domains = isMultiProxyConfig(options3) ? [options3.proxies[0].to, ...options3.proxies.map((proxy) => proxy.to)] : [options3.to];
|
|
57166
|
+
const verbose = isMultiProxyConfig(options3) ? options3.verbose : options3.verbose;
|
|
57167
|
+
debugLog2("ssl", `Generating certificate for domains: ${domains.join(", ")}`, verbose);
|
|
57168
|
+
const rootCAConfig = generateRootCAConfig();
|
|
57169
|
+
log.info("Generating Root CA certificate...");
|
|
57170
|
+
const caCert = await createRootCA(rootCAConfig);
|
|
57171
|
+
const hostConfig = generateBaseConfig(options3, verbose);
|
|
57172
|
+
log.info(`Generating host certificate for: ${domains.join(", ")}`);
|
|
57173
|
+
const hostCert = await generateCertificate({
|
|
57174
|
+
...hostConfig,
|
|
57032
57175
|
rootCAObject: {
|
|
57033
57176
|
certificate: caCert.certificate,
|
|
57034
57177
|
privateKey: caCert.privateKey
|
|
57035
|
-
}
|
|
57036
|
-
|
|
57178
|
+
}
|
|
57179
|
+
});
|
|
57180
|
+
await addCertToSystemTrustStoreAndSaveCert(hostCert, caCert.certificate, hostConfig);
|
|
57181
|
+
cachedSSLConfig = {
|
|
57182
|
+
key: hostCert.privateKey,
|
|
57183
|
+
cert: hostCert.certificate,
|
|
57184
|
+
ca: caCert.certificate
|
|
57185
|
+
};
|
|
57186
|
+
log.success(`Certificate generated successfully for ${domains.length} domain${domains.length > 1 ? "s" : ""}`);
|
|
57187
|
+
debugLog2("ssl", `Certificate includes domains: ${domains.join(", ")}`, verbose);
|
|
57188
|
+
}
|
|
57189
|
+
function getSSLConfig() {
|
|
57190
|
+
return cachedSSLConfig;
|
|
57191
|
+
}
|
|
57192
|
+
|
|
57193
|
+
// src/utils.ts
|
|
57194
|
+
function debugLog2(category, message, verbose) {
|
|
57195
|
+
if (verbose) {
|
|
57196
|
+
console.debug(`[rpx:${category}] ${message}`);
|
|
57197
|
+
}
|
|
57198
|
+
}
|
|
57199
|
+
function extractDomains(options3) {
|
|
57200
|
+
if (isMultiProxyConfig(options3)) {
|
|
57201
|
+
return options3.proxies.map((proxy) => {
|
|
57202
|
+
const domain2 = proxy.to || "stacks.localhost";
|
|
57203
|
+
return domain2.startsWith("http") ? new URL(domain2).hostname : domain2;
|
|
57204
|
+
});
|
|
57205
|
+
}
|
|
57206
|
+
const domain = options3.to || "stacks.localhost";
|
|
57207
|
+
return [domain.startsWith("http") ? new URL(domain).hostname : domain];
|
|
57208
|
+
}
|
|
57209
|
+
|
|
57210
|
+
// src/hosts.ts
|
|
57211
|
+
var hostsFilePath = process3.platform === "win32" ? path6.join(process3.env.windir || "C:\\Windows", "System32", "drivers", "etc", "hosts") : "/etc/hosts";
|
|
57212
|
+
async function sudoWrite(operation, content) {
|
|
57213
|
+
return new Promise((resolve4, reject) => {
|
|
57214
|
+
if (process3.platform === "win32") {
|
|
57215
|
+
reject(new Error("Administrator privileges required on Windows"));
|
|
57216
|
+
return;
|
|
57217
|
+
}
|
|
57218
|
+
const tmpFile = path6.join(os7.tmpdir(), "hosts.tmp");
|
|
57219
|
+
try {
|
|
57220
|
+
if (operation === "append") {
|
|
57221
|
+
const currentContent = fs3.readFileSync(hostsFilePath, "utf8");
|
|
57222
|
+
fs3.writeFileSync(tmpFile, currentContent + content, "utf8");
|
|
57223
|
+
} else {
|
|
57224
|
+
fs3.writeFileSync(tmpFile, content, "utf8");
|
|
57225
|
+
}
|
|
57226
|
+
const sudo = spawn("sudo", ["cp", tmpFile, hostsFilePath]);
|
|
57227
|
+
sudo.on("close", (code) => {
|
|
57228
|
+
try {
|
|
57229
|
+
fs3.unlinkSync(tmpFile);
|
|
57230
|
+
if (code === 0)
|
|
57231
|
+
resolve4();
|
|
57232
|
+
else
|
|
57233
|
+
reject(new Error(`sudo process exited with code ${code}`));
|
|
57234
|
+
} catch (err3) {
|
|
57235
|
+
reject(err3);
|
|
57236
|
+
}
|
|
57237
|
+
});
|
|
57238
|
+
sudo.on("error", (err3) => {
|
|
57239
|
+
try {
|
|
57240
|
+
fs3.unlinkSync(tmpFile);
|
|
57241
|
+
} catch {
|
|
57242
|
+
}
|
|
57243
|
+
reject(err3);
|
|
57244
|
+
});
|
|
57245
|
+
} catch (err3) {
|
|
57246
|
+
reject(err3);
|
|
57247
|
+
}
|
|
57248
|
+
});
|
|
57249
|
+
}
|
|
57250
|
+
async function addHosts(hosts, verbose) {
|
|
57251
|
+
debugLog2("hosts", `Adding hosts: ${hosts.join(", ")}`, verbose);
|
|
57252
|
+
debugLog2("hosts", `Using hosts file at: ${hostsFilePath}`, verbose);
|
|
57253
|
+
try {
|
|
57254
|
+
const existingContent = await fs3.promises.readFile(hostsFilePath, "utf-8");
|
|
57255
|
+
const newEntries = hosts.filter((host) => {
|
|
57256
|
+
const ipv4Entry = `127.0.0.1 ${host}`;
|
|
57257
|
+
const ipv6Entry = `::1 ${host}`;
|
|
57258
|
+
return !existingContent.includes(ipv4Entry) && !existingContent.includes(ipv6Entry);
|
|
57259
|
+
});
|
|
57260
|
+
if (newEntries.length === 0) {
|
|
57261
|
+
debugLog2("hosts", "All hosts already exist in hosts file", verbose);
|
|
57262
|
+
log.info("All hosts are already in the hosts file");
|
|
57263
|
+
return;
|
|
57264
|
+
}
|
|
57265
|
+
const hostEntries = newEntries.map((host) => `
|
|
57266
|
+
# Added by rpx
|
|
57267
|
+
127.0.0.1 ${host}
|
|
57268
|
+
::1 ${host}`).join(`
|
|
57269
|
+
`);
|
|
57270
|
+
try {
|
|
57271
|
+
await fs3.promises.appendFile(hostsFilePath, hostEntries, { flag: "a" });
|
|
57272
|
+
log.success(`Added new hosts: ${newEntries.join(", ")}`);
|
|
57273
|
+
} catch (writeErr) {
|
|
57274
|
+
if (writeErr.code === "EACCES") {
|
|
57275
|
+
debugLog2("hosts", "Permission denied, attempting with sudo", verbose);
|
|
57276
|
+
try {
|
|
57277
|
+
await sudoWrite("append", hostEntries);
|
|
57278
|
+
log.success(`Added new hosts with sudo: ${newEntries.join(", ")}`);
|
|
57279
|
+
} catch (sudoErr) {
|
|
57280
|
+
log.error("Failed to modify hosts file automatically");
|
|
57281
|
+
log.warn("Please add these entries to your hosts file manually:");
|
|
57282
|
+
hostEntries.split(`
|
|
57283
|
+
`).forEach((entry) => log.warn(entry));
|
|
57284
|
+
if (process3.platform === "win32") {
|
|
57285
|
+
log.warn(`
|
|
57286
|
+
On Windows:`);
|
|
57287
|
+
log.warn("1. Run notepad as administrator");
|
|
57288
|
+
log.warn("2. Open C:\\Windows\\System32\\drivers\\etc\\hosts");
|
|
57289
|
+
} else {
|
|
57290
|
+
log.warn(`
|
|
57291
|
+
On Unix systems:`);
|
|
57292
|
+
log.warn(`sudo nano ${hostsFilePath}`);
|
|
57293
|
+
}
|
|
57294
|
+
throw new Error("Failed to modify hosts file: manual intervention required");
|
|
57295
|
+
}
|
|
57296
|
+
} else {
|
|
57297
|
+
throw writeErr;
|
|
57298
|
+
}
|
|
57299
|
+
}
|
|
57300
|
+
} catch (err3) {
|
|
57301
|
+
const error = err3;
|
|
57302
|
+
log.error(`Failed to manage hosts file: ${error.message}`);
|
|
57303
|
+
throw error;
|
|
57304
|
+
}
|
|
57305
|
+
}
|
|
57306
|
+
async function removeHosts(hosts, verbose) {
|
|
57307
|
+
debugLog2("hosts", `Removing hosts: ${hosts.join(", ")}`, verbose);
|
|
57308
|
+
try {
|
|
57309
|
+
const content = await fs3.promises.readFile(hostsFilePath, "utf-8");
|
|
57310
|
+
const lines = content.split(`
|
|
57311
|
+
`);
|
|
57312
|
+
const filteredLines = lines.filter((line, index) => {
|
|
57313
|
+
if (line.trim() === "# Added by rpx") {
|
|
57314
|
+
lines.splice(index + 1, 2);
|
|
57315
|
+
return false;
|
|
57316
|
+
}
|
|
57317
|
+
return true;
|
|
57318
|
+
});
|
|
57319
|
+
while (filteredLines[filteredLines.length - 1]?.trim() === "")
|
|
57320
|
+
filteredLines.pop();
|
|
57321
|
+
const newContent = `${filteredLines.join(`
|
|
57322
|
+
`)}
|
|
57323
|
+
`;
|
|
57324
|
+
try {
|
|
57325
|
+
await fs3.promises.writeFile(hostsFilePath, newContent);
|
|
57326
|
+
log.success("Hosts removed successfully");
|
|
57327
|
+
} catch (writeErr) {
|
|
57328
|
+
if (writeErr.code === "EACCES") {
|
|
57329
|
+
debugLog2("hosts", "Permission denied, attempting with sudo", verbose);
|
|
57330
|
+
try {
|
|
57331
|
+
await sudoWrite("write", newContent);
|
|
57332
|
+
log.success("Hosts removed successfully with sudo");
|
|
57333
|
+
} catch (sudoErr) {
|
|
57334
|
+
log.error("Failed to modify hosts file automatically");
|
|
57335
|
+
log.warn("Please remove these entries from your hosts file manually:");
|
|
57336
|
+
hosts.forEach((host) => {
|
|
57337
|
+
log.warn("# Added by rpx");
|
|
57338
|
+
log.warn(`127.0.0.1 ${host}`);
|
|
57339
|
+
log.warn(`::1 ${host}`);
|
|
57340
|
+
});
|
|
57341
|
+
if (process3.platform === "win32") {
|
|
57342
|
+
log.warn(`
|
|
57343
|
+
On Windows:`);
|
|
57344
|
+
log.warn("1. Run notepad as administrator");
|
|
57345
|
+
log.warn("2. Open C:\\Windows\\System32\\drivers\\etc\\hosts");
|
|
57346
|
+
} else {
|
|
57347
|
+
log.warn(`
|
|
57348
|
+
On Unix systems:`);
|
|
57349
|
+
log.warn(`sudo nano ${hostsFilePath}`);
|
|
57350
|
+
}
|
|
57351
|
+
throw new Error("Failed to modify hosts file: manual intervention required");
|
|
57352
|
+
}
|
|
57353
|
+
} else {
|
|
57354
|
+
throw writeErr;
|
|
57355
|
+
}
|
|
57356
|
+
}
|
|
57357
|
+
} catch (err3) {
|
|
57358
|
+
const error = err3;
|
|
57359
|
+
log.error(`Failed to remove hosts: ${error.message}`);
|
|
57360
|
+
throw error;
|
|
57361
|
+
}
|
|
57362
|
+
}
|
|
57363
|
+
async function checkHosts(hosts, verbose) {
|
|
57364
|
+
debugLog2("hosts", `Checking hosts: ${hosts}`, verbose);
|
|
57365
|
+
const content = await fs3.promises.readFile(hostsFilePath, "utf-8");
|
|
57366
|
+
return hosts.map((host) => {
|
|
57367
|
+
const ipv4Entry = `127.0.0.1 ${host}`;
|
|
57368
|
+
const ipv6Entry = `::1 ${host}`;
|
|
57369
|
+
return content.includes(ipv4Entry) || content.includes(ipv6Entry);
|
|
57037
57370
|
});
|
|
57038
|
-
await addCertToSystemTrustStoreAndSaveCert(hostCert, caCert.certificate, config.https);
|
|
57039
|
-
log.success("Certificate generated");
|
|
57040
57371
|
}
|
|
57041
57372
|
// src/start.ts
|
|
57042
57373
|
import * as fs5 from "fs";
|
|
57043
57374
|
import * as http from "http";
|
|
57044
57375
|
import * as https from "https";
|
|
57045
57376
|
import * as net from "net";
|
|
57046
|
-
import os8 from "os";
|
|
57047
|
-
import path7 from "path";
|
|
57048
57377
|
import process9 from "process";
|
|
57049
57378
|
// package.json
|
|
57050
|
-
var version = "0.
|
|
57379
|
+
var version = "0.4.0";
|
|
57051
57380
|
|
|
57052
57381
|
// src/start.ts
|
|
57053
57382
|
var activeServers = new Set;
|
|
57054
|
-
async function cleanup() {
|
|
57055
|
-
|
|
57056
|
-
console.log(
|
|
57383
|
+
async function cleanup(options3) {
|
|
57384
|
+
debugLog2("cleanup", "Starting cleanup process", options3?.verbose);
|
|
57385
|
+
console.log(`
|
|
57386
|
+
`);
|
|
57057
57387
|
log.info("Shutting down proxy servers...");
|
|
57058
57388
|
const cleanupPromises = [];
|
|
57059
57389
|
const serverClosePromises = Array.from(activeServers).map((server) => new Promise((resolve4) => {
|
|
57060
57390
|
server.close(() => {
|
|
57061
|
-
|
|
57391
|
+
debugLog2("cleanup", "Server closed successfully", options3?.verbose);
|
|
57062
57392
|
resolve4();
|
|
57063
57393
|
});
|
|
57064
57394
|
}));
|
|
57065
57395
|
cleanupPromises.push(...serverClosePromises);
|
|
57066
|
-
if (
|
|
57067
|
-
|
|
57068
|
-
|
|
57069
|
-
|
|
57070
|
-
|
|
57071
|
-
|
|
57072
|
-
|
|
57073
|
-
|
|
57074
|
-
|
|
57075
|
-
|
|
57076
|
-
|
|
57077
|
-
log.warn(`Failed to clean up hosts file entry for ${hostname}:`, err3);
|
|
57078
|
-
}));
|
|
57079
|
-
}
|
|
57080
|
-
} catch (err3) {
|
|
57081
|
-
debugLog("cleanup", `Error parsing URL during hosts cleanup: ${err3}`, config.verbose);
|
|
57082
|
-
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
|
+
}));
|
|
57083
57407
|
}
|
|
57084
57408
|
}
|
|
57085
57409
|
try {
|
|
57086
57410
|
await Promise.all(cleanupPromises);
|
|
57087
|
-
|
|
57411
|
+
debugLog2("cleanup", "All cleanup tasks completed successfully", options3?.verbose);
|
|
57088
57412
|
log.success("All cleanup tasks completed successfully");
|
|
57089
57413
|
process9.exit(0);
|
|
57090
57414
|
} catch (err3) {
|
|
57091
|
-
|
|
57415
|
+
debugLog2("cleanup", `Error during cleanup: ${err3}`, options3?.verbose);
|
|
57092
57416
|
log.error("Error during cleanup:", err3);
|
|
57093
57417
|
process9.exit(1);
|
|
57094
57418
|
}
|
|
@@ -57096,65 +57420,55 @@ async function cleanup() {
|
|
|
57096
57420
|
process9.on("SIGINT", cleanup);
|
|
57097
57421
|
process9.on("SIGTERM", cleanup);
|
|
57098
57422
|
process9.on("uncaughtException", (err3) => {
|
|
57099
|
-
|
|
57423
|
+
debugLog2("process", `Uncaught exception: ${err3}`, true);
|
|
57100
57424
|
log.error("Uncaught exception:", err3);
|
|
57101
57425
|
cleanup();
|
|
57102
57426
|
});
|
|
57103
57427
|
async function loadSSLConfig(options3) {
|
|
57104
|
-
|
|
57428
|
+
debugLog2("ssl", `Loading SSL configuration`, options3.verbose);
|
|
57105
57429
|
if (options3.https === true)
|
|
57106
|
-
options3.https = httpsConfig();
|
|
57430
|
+
options3.https = httpsConfig(options3);
|
|
57107
57431
|
else if (options3.https === false)
|
|
57108
57432
|
return null;
|
|
57109
57433
|
if (!options3.https?.keyPath && !options3.https?.certPath) {
|
|
57110
|
-
|
|
57434
|
+
debugLog2("ssl", "No SSL configuration provided", options3.verbose);
|
|
57111
57435
|
return null;
|
|
57112
57436
|
}
|
|
57113
57437
|
if (options3.https?.keyPath && !options3.https?.certPath || !options3.https?.keyPath && options3.https?.certPath) {
|
|
57114
57438
|
const missing = !options3.https?.keyPath ? "keyPath" : "certPath";
|
|
57115
|
-
|
|
57439
|
+
debugLog2("ssl", `Invalid SSL configuration - missing ${missing}`, options3.verbose);
|
|
57116
57440
|
throw new Error(`SSL Configuration requires both keyPath and certPath. Missing: ${missing}`);
|
|
57117
57441
|
}
|
|
57118
57442
|
try {
|
|
57119
57443
|
if (!options3.https?.keyPath || !options3.https?.certPath)
|
|
57120
57444
|
return null;
|
|
57121
57445
|
try {
|
|
57122
|
-
|
|
57446
|
+
debugLog2("ssl", "Reading SSL certificate files", options3.verbose);
|
|
57123
57447
|
const key = await fs5.promises.readFile(options3.https?.keyPath, "utf8");
|
|
57124
57448
|
const cert = await fs5.promises.readFile(options3.https?.certPath, "utf8");
|
|
57125
|
-
|
|
57449
|
+
debugLog2("ssl", "SSL configuration loaded successfully", options3.verbose);
|
|
57126
57450
|
return { key, cert };
|
|
57127
57451
|
} catch (error) {
|
|
57128
|
-
|
|
57129
|
-
|
|
57130
|
-
await generateCertificate(options3.to);
|
|
57131
|
-
debugLog("ssl", "Reading newly generated certificates", options3.verbose);
|
|
57132
|
-
const key = await fs5.promises.readFile(options3.https?.keyPath, "utf8");
|
|
57133
|
-
const cert = await fs5.promises.readFile(options3.https?.certPath, "utf8");
|
|
57134
|
-
debugLog("ssl", "New SSL certificates loaded successfully", options3.verbose);
|
|
57135
|
-
return { key, cert };
|
|
57136
|
-
}
|
|
57137
|
-
throw error;
|
|
57452
|
+
debugLog2("ssl", `Failed to read certificates: ${error}`, options3.verbose);
|
|
57453
|
+
return null;
|
|
57138
57454
|
}
|
|
57139
57455
|
} catch (err3) {
|
|
57140
|
-
|
|
57141
|
-
|
|
57142
|
-
debugLog("ssl", `SSL configuration error: ${error}`, options3.verbose);
|
|
57143
|
-
throw new Error(`SSL Configuration Error: ${detail}`);
|
|
57456
|
+
debugLog2("ssl", `SSL configuration error: ${err3}`, options3.verbose);
|
|
57457
|
+
throw err3;
|
|
57144
57458
|
}
|
|
57145
57459
|
}
|
|
57146
57460
|
function isPortInUse(port, hostname, verbose) {
|
|
57147
|
-
|
|
57461
|
+
debugLog2("port", `Checking if port ${port} is in use on ${hostname}`, verbose);
|
|
57148
57462
|
return new Promise((resolve4) => {
|
|
57149
57463
|
const server = net.createServer();
|
|
57150
57464
|
server.once("error", (err3) => {
|
|
57151
57465
|
if (err3.code === "EADDRINUSE") {
|
|
57152
|
-
|
|
57466
|
+
debugLog2("port", `Port ${port} is in use`, verbose);
|
|
57153
57467
|
resolve4(true);
|
|
57154
57468
|
}
|
|
57155
57469
|
});
|
|
57156
57470
|
server.once("listening", () => {
|
|
57157
|
-
|
|
57471
|
+
debugLog2("port", `Port ${port} is available`, verbose);
|
|
57158
57472
|
server.close();
|
|
57159
57473
|
resolve4(false);
|
|
57160
57474
|
});
|
|
@@ -57162,17 +57476,17 @@ function isPortInUse(port, hostname, verbose) {
|
|
|
57162
57476
|
});
|
|
57163
57477
|
}
|
|
57164
57478
|
async function findAvailablePort(startPort, hostname, verbose) {
|
|
57165
|
-
|
|
57479
|
+
debugLog2("port", `Finding available port starting from ${startPort}`, verbose);
|
|
57166
57480
|
let port = startPort;
|
|
57167
57481
|
while (await isPortInUse(port, hostname, verbose)) {
|
|
57168
|
-
|
|
57482
|
+
debugLog2("port", `Port ${port} is in use, trying ${port + 1}`, verbose);
|
|
57169
57483
|
port++;
|
|
57170
57484
|
}
|
|
57171
|
-
|
|
57485
|
+
debugLog2("port", `Found available port: ${port}`, verbose);
|
|
57172
57486
|
return port;
|
|
57173
57487
|
}
|
|
57174
57488
|
async function testConnection(hostname, port, verbose) {
|
|
57175
|
-
|
|
57489
|
+
debugLog2("connection", `Testing connection to ${hostname}:${port}`, verbose);
|
|
57176
57490
|
return new Promise((resolve4, reject) => {
|
|
57177
57491
|
const socket = net.connect({
|
|
57178
57492
|
host: hostname,
|
|
@@ -57180,43 +57494,37 @@ async function testConnection(hostname, port, verbose) {
|
|
|
57180
57494
|
timeout: 5000
|
|
57181
57495
|
});
|
|
57182
57496
|
socket.once("connect", () => {
|
|
57183
|
-
|
|
57497
|
+
debugLog2("connection", `Successfully connected to ${hostname}:${port}`, verbose);
|
|
57184
57498
|
socket.end();
|
|
57185
57499
|
resolve4();
|
|
57186
57500
|
});
|
|
57187
57501
|
socket.once("timeout", () => {
|
|
57188
|
-
|
|
57502
|
+
debugLog2("connection", `Connection to ${hostname}:${port} timed out`, verbose);
|
|
57189
57503
|
socket.destroy();
|
|
57190
57504
|
reject(new Error(`Connection to ${hostname}:${port} timed out`));
|
|
57191
57505
|
});
|
|
57192
57506
|
socket.once("error", (err3) => {
|
|
57193
|
-
|
|
57507
|
+
debugLog2("connection", `Failed to connect to ${hostname}:${port}: ${err3}`, verbose);
|
|
57194
57508
|
socket.destroy();
|
|
57195
57509
|
reject(new Error(`Failed to connect to ${hostname}:${port}: ${err3.message}`));
|
|
57196
57510
|
});
|
|
57197
57511
|
});
|
|
57198
57512
|
}
|
|
57199
57513
|
async function startServer(options3) {
|
|
57200
|
-
|
|
57201
|
-
if (!options3)
|
|
57202
|
-
options3 = config;
|
|
57203
|
-
if (!options3.from)
|
|
57204
|
-
options3.from = config.from;
|
|
57205
|
-
if (!options3.to)
|
|
57206
|
-
options3.to = config.to;
|
|
57514
|
+
debugLog2("server", `Starting server with options: ${JSON.stringify(options3)}`, options3.verbose);
|
|
57207
57515
|
const fromUrl = new URL(options3.from.startsWith("http") ? options3.from : `http://${options3.from}`);
|
|
57208
57516
|
const toUrl = new URL(options3.to.startsWith("http") ? options3.to : `http://${options3.to}`);
|
|
57209
57517
|
const fromPort = Number.parseInt(fromUrl.port) || (fromUrl.protocol.includes("https:") ? 443 : 80);
|
|
57210
57518
|
const hostsToCheck = [toUrl.hostname];
|
|
57211
57519
|
if (!toUrl.hostname.includes("localhost") && !toUrl.hostname.includes("127.0.0.1")) {
|
|
57212
|
-
|
|
57520
|
+
debugLog2("hosts", `Checking if hosts file entry exists for: ${toUrl.hostname}`, options3?.verbose);
|
|
57213
57521
|
try {
|
|
57214
|
-
const hostsExist = await checkHosts(hostsToCheck);
|
|
57522
|
+
const hostsExist = await checkHosts(hostsToCheck, options3.verbose);
|
|
57215
57523
|
if (!hostsExist[0]) {
|
|
57216
57524
|
log.info(`Adding ${toUrl.hostname} to hosts file...`);
|
|
57217
57525
|
log.info("This may require sudo/administrator privileges");
|
|
57218
57526
|
try {
|
|
57219
|
-
await addHosts(hostsToCheck);
|
|
57527
|
+
await addHosts(hostsToCheck, options3.verbose);
|
|
57220
57528
|
} catch (addError) {
|
|
57221
57529
|
log.error("Failed to add hosts entry:", addError.message);
|
|
57222
57530
|
log.warn("You can manually add this entry to your hosts file:");
|
|
@@ -57232,40 +57540,61 @@ async function startServer(options3) {
|
|
|
57232
57540
|
}
|
|
57233
57541
|
}
|
|
57234
57542
|
} else {
|
|
57235
|
-
|
|
57543
|
+
debugLog2("hosts", `Host entry already exists for ${toUrl.hostname}`, options3.verbose);
|
|
57236
57544
|
}
|
|
57237
57545
|
} catch (checkError) {
|
|
57238
57546
|
log.error("Failed to check hosts file:", checkError.message);
|
|
57239
57547
|
}
|
|
57240
57548
|
}
|
|
57241
|
-
if (config.https) {
|
|
57242
|
-
if (config.https === true)
|
|
57243
|
-
config.https = httpsConfig();
|
|
57244
|
-
const domain = toUrl.hostname;
|
|
57245
|
-
if (typeof options3.https !== "boolean" && options3.https) {
|
|
57246
|
-
options3.https.keyPath = config.https.keyPath || path7.join(os8.homedir(), ".stacks", "ssl", `${domain}.crt.key`);
|
|
57247
|
-
options3.https.certPath = config.https.certPath || path7.join(os8.homedir(), ".stacks", "ssl", `${domain}.crt`);
|
|
57248
|
-
debugLog("server", `HTTPS enabled, using cert paths: ${options3.https.keyPath}, ${options3.https.certPath}`, options3.verbose);
|
|
57249
|
-
}
|
|
57250
|
-
}
|
|
57251
|
-
debugLog("server", `Parsed URLs - from: ${fromUrl}, to: ${toUrl}`, options3.verbose);
|
|
57252
57549
|
try {
|
|
57253
57550
|
await testConnection(fromUrl.hostname, fromPort, options3.verbose);
|
|
57254
57551
|
} catch (err3) {
|
|
57255
|
-
|
|
57552
|
+
debugLog2("server", `Connection test failed: ${err3}`, options3.verbose);
|
|
57256
57553
|
log.error(err3.message);
|
|
57257
57554
|
process9.exit(1);
|
|
57258
57555
|
}
|
|
57259
|
-
let sslConfig = null;
|
|
57260
|
-
if (
|
|
57556
|
+
let sslConfig = options3._cachedSSLConfig || null;
|
|
57557
|
+
if (options3.https) {
|
|
57261
57558
|
try {
|
|
57262
|
-
|
|
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
|
+
}
|
|
57263
57592
|
} catch (err3) {
|
|
57264
|
-
|
|
57265
|
-
|
|
57266
|
-
sslConfig = await loadSSLConfig(options3);
|
|
57593
|
+
debugLog2("server", `SSL setup failed: ${err3}`, options3.verbose);
|
|
57594
|
+
throw err3;
|
|
57267
57595
|
}
|
|
57268
57596
|
}
|
|
57597
|
+
debugLog2("server", `Setting up reverse proxy with SSL config for ${toUrl.hostname}`, options3.verbose);
|
|
57269
57598
|
await setupReverseProxy({
|
|
57270
57599
|
...options3,
|
|
57271
57600
|
from: options3.from,
|
|
@@ -57279,9 +57608,9 @@ async function startServer(options3) {
|
|
|
57279
57608
|
});
|
|
57280
57609
|
}
|
|
57281
57610
|
async function createProxyServer(from, to, fromPort, listenPort, hostname, sourceUrl, ssl, verbose) {
|
|
57282
|
-
|
|
57611
|
+
debugLog2("proxy", `Creating proxy server ${from} -> ${to}`, verbose);
|
|
57283
57612
|
const requestHandler = (req, res) => {
|
|
57284
|
-
|
|
57613
|
+
debugLog2("request", `Incoming request: ${req.method} ${req.url}`, verbose);
|
|
57285
57614
|
const proxyOptions = {
|
|
57286
57615
|
hostname: sourceUrl.hostname,
|
|
57287
57616
|
port: fromPort,
|
|
@@ -57292,9 +57621,9 @@ async function createProxyServer(from, to, fromPort, listenPort, hostname, sourc
|
|
|
57292
57621
|
host: sourceUrl.host
|
|
57293
57622
|
}
|
|
57294
57623
|
};
|
|
57295
|
-
|
|
57624
|
+
debugLog2("request", `Proxy request options: ${JSON.stringify(proxyOptions)}`, verbose);
|
|
57296
57625
|
const proxyReq = http.request(proxyOptions, (proxyRes) => {
|
|
57297
|
-
|
|
57626
|
+
debugLog2("response", `Proxy response received with status ${proxyRes.statusCode}`, verbose);
|
|
57298
57627
|
const headers = {
|
|
57299
57628
|
...proxyRes.headers,
|
|
57300
57629
|
"Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
|
|
@@ -57304,7 +57633,7 @@ async function createProxyServer(from, to, fromPort, listenPort, hostname, sourc
|
|
|
57304
57633
|
proxyRes.pipe(res);
|
|
57305
57634
|
});
|
|
57306
57635
|
proxyReq.on("error", (err3) => {
|
|
57307
|
-
|
|
57636
|
+
debugLog2("request", `Proxy request failed: ${err3}`, verbose);
|
|
57308
57637
|
log.error("Proxy request failed:", err3);
|
|
57309
57638
|
res.writeHead(502);
|
|
57310
57639
|
res.end(`Proxy Error: ${err3.message}`);
|
|
@@ -57331,11 +57660,11 @@ async function createProxyServer(from, to, fromPort, listenPort, hostname, sourc
|
|
|
57331
57660
|
allowHTTP1: true,
|
|
57332
57661
|
ALPNProtocols: ["h2", "http/1.1"]
|
|
57333
57662
|
} : undefined;
|
|
57334
|
-
|
|
57663
|
+
debugLog2("server", `Creating server with SSL config: ${!!ssl}`, verbose);
|
|
57335
57664
|
const server = ssl && serverOptions ? https.createServer(serverOptions, requestHandler) : http.createServer(requestHandler);
|
|
57336
57665
|
if (ssl) {
|
|
57337
57666
|
server.on("secureConnection", (tlsSocket) => {
|
|
57338
|
-
|
|
57667
|
+
debugLog2("tls", `TLS Connection established: ${JSON.stringify({
|
|
57339
57668
|
protocol: tlsSocket.getProtocol?.(),
|
|
57340
57669
|
cipher: tlsSocket.getCipher?.(),
|
|
57341
57670
|
authorized: tlsSocket.authorized,
|
|
@@ -57346,7 +57675,7 @@ async function createProxyServer(from, to, fromPort, listenPort, hostname, sourc
|
|
|
57346
57675
|
activeServers.add(server);
|
|
57347
57676
|
return new Promise((resolve4, reject) => {
|
|
57348
57677
|
server.listen(listenPort, hostname, () => {
|
|
57349
|
-
|
|
57678
|
+
debugLog2("server", `Server listening on port ${listenPort}`, verbose);
|
|
57350
57679
|
console.log("");
|
|
57351
57680
|
console.log(` ${green(bold("reverse-proxy"))} ${green(`v${version}`)}`);
|
|
57352
57681
|
console.log("");
|
|
@@ -57363,92 +57692,135 @@ async function createProxyServer(from, to, fromPort, listenPort, hostname, sourc
|
|
|
57363
57692
|
resolve4();
|
|
57364
57693
|
});
|
|
57365
57694
|
server.on("error", (err3) => {
|
|
57366
|
-
|
|
57695
|
+
debugLog2("server", `Server error: ${err3}`, verbose);
|
|
57367
57696
|
reject(err3);
|
|
57368
57697
|
});
|
|
57369
57698
|
});
|
|
57370
57699
|
}
|
|
57371
57700
|
async function setupReverseProxy(options3) {
|
|
57372
|
-
|
|
57373
|
-
const { from, to, fromPort, sourceUrl, ssl, verbose } = options3;
|
|
57701
|
+
debugLog2("setup", `Setting up reverse proxy: ${JSON.stringify(options3)}`, options3.verbose);
|
|
57702
|
+
const { from, to, fromPort, sourceUrl, ssl, verbose, etcHostsCleanup, portManager } = options3;
|
|
57374
57703
|
const httpPort = 80;
|
|
57375
57704
|
const httpsPort = 443;
|
|
57376
57705
|
const hostname = "0.0.0.0";
|
|
57377
57706
|
try {
|
|
57378
|
-
if (ssl) {
|
|
57707
|
+
if (ssl && !portManager?.usedPorts.has(httpPort)) {
|
|
57379
57708
|
const isHttpPortBusy = await isPortInUse(httpPort, hostname, verbose);
|
|
57380
57709
|
if (!isHttpPortBusy) {
|
|
57381
|
-
|
|
57710
|
+
debugLog2("setup", "Starting HTTP redirect server", verbose);
|
|
57382
57711
|
startHttpRedirectServer(verbose);
|
|
57712
|
+
portManager?.usedPorts.add(httpPort);
|
|
57383
57713
|
} else {
|
|
57384
|
-
|
|
57714
|
+
debugLog2("setup", "Port 80 is in use, skipping HTTP redirect", verbose);
|
|
57385
57715
|
log.warn("Port 80 is in use, HTTP to HTTPS redirect will not be available");
|
|
57386
57716
|
}
|
|
57387
57717
|
}
|
|
57388
57718
|
const targetPort = ssl ? httpsPort : httpPort;
|
|
57389
|
-
|
|
57390
|
-
if (
|
|
57391
|
-
|
|
57392
|
-
const availablePort = await findAvailablePort(ssl ? 8443 : 8080, hostname, verbose);
|
|
57393
|
-
log.warn(`Port ${targetPort} is in use. Using port ${availablePort} instead.`);
|
|
57394
|
-
log.info(`You can use 'sudo lsof -i :${targetPort}' (Unix) or 'netstat -ano | findstr :${targetPort}' (Windows) to check what's using the port.`);
|
|
57395
|
-
await createProxyServer(from, to, fromPort, availablePort, hostname, sourceUrl, ssl, verbose);
|
|
57719
|
+
let finalPort;
|
|
57720
|
+
if (portManager) {
|
|
57721
|
+
finalPort = await portManager.getNextAvailablePort(targetPort);
|
|
57396
57722
|
} else {
|
|
57397
|
-
|
|
57398
|
-
await
|
|
57723
|
+
const isTargetPortBusy = await isPortInUse(targetPort, hostname, verbose);
|
|
57724
|
+
finalPort = isTargetPortBusy ? await findAvailablePort(ssl ? 8443 : 8080, hostname, verbose) : targetPort;
|
|
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.`);
|
|
57399
57729
|
}
|
|
57730
|
+
await createProxyServer(from, to, fromPort, finalPort, hostname, sourceUrl, ssl, verbose);
|
|
57400
57731
|
} catch (err3) {
|
|
57401
|
-
|
|
57732
|
+
debugLog2("setup", `Setup failed: ${err3}`, verbose);
|
|
57402
57733
|
log.error(`Failed to setup reverse proxy: ${err3.message}`);
|
|
57403
|
-
cleanup(
|
|
57734
|
+
cleanup({
|
|
57735
|
+
domains: [to],
|
|
57736
|
+
etcHostsCleanup,
|
|
57737
|
+
verbose
|
|
57738
|
+
});
|
|
57404
57739
|
}
|
|
57405
57740
|
}
|
|
57406
57741
|
function startHttpRedirectServer(verbose) {
|
|
57407
|
-
|
|
57742
|
+
debugLog2("redirect", "Starting HTTP redirect server", verbose);
|
|
57408
57743
|
const server = http.createServer((req, res) => {
|
|
57409
57744
|
const host = req.headers.host || "";
|
|
57410
|
-
|
|
57745
|
+
debugLog2("redirect", `Redirecting request from ${host}${req.url} to HTTPS`, verbose);
|
|
57411
57746
|
res.writeHead(301, {
|
|
57412
57747
|
Location: `https://${host}${req.url}`
|
|
57413
57748
|
});
|
|
57414
57749
|
res.end();
|
|
57415
57750
|
}).listen(80);
|
|
57416
57751
|
activeServers.add(server);
|
|
57417
|
-
|
|
57752
|
+
debugLog2("redirect", "HTTP redirect server started", verbose);
|
|
57418
57753
|
}
|
|
57419
57754
|
function startProxy(options3) {
|
|
57420
|
-
|
|
57421
|
-
|
|
57422
|
-
|
|
57423
|
-
|
|
57424
|
-
|
|
57425
|
-
|
|
57426
|
-
|
|
57427
|
-
|
|
57428
|
-
|
|
57429
|
-
startServer(
|
|
57430
|
-
|
|
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);
|
|
57431
57766
|
log.error(`Failed to start proxy: ${err3.message}`);
|
|
57432
|
-
cleanup(
|
|
57767
|
+
cleanup({
|
|
57768
|
+
domains: [options3.to],
|
|
57769
|
+
etcHostsCleanup: options3.etcHostsCleanup,
|
|
57770
|
+
verbose: options3.verbose
|
|
57771
|
+
});
|
|
57433
57772
|
});
|
|
57434
57773
|
}
|
|
57435
|
-
function startProxies(options3) {
|
|
57436
|
-
if (
|
|
57437
|
-
|
|
57438
|
-
|
|
57439
|
-
|
|
57440
|
-
|
|
57441
|
-
|
|
57442
|
-
|
|
57443
|
-
|
|
57444
|
-
|
|
57445
|
-
|
|
57446
|
-
|
|
57447
|
-
|
|
57448
|
-
|
|
57449
|
-
|
|
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
|
+
}
|
|
57450
57819
|
}
|
|
57451
57820
|
}
|
|
57821
|
+
function isMultiProxyConfig2(options3) {
|
|
57822
|
+
return "proxies" in options3;
|
|
57823
|
+
}
|
|
57452
57824
|
export {
|
|
57453
57825
|
startServer,
|
|
57454
57826
|
startProxy,
|
|
@@ -57456,15 +57828,15 @@ export {
|
|
|
57456
57828
|
startHttpRedirectServer,
|
|
57457
57829
|
setupReverseProxy,
|
|
57458
57830
|
removeHosts,
|
|
57459
|
-
|
|
57831
|
+
isMultiProxyConfig,
|
|
57460
57832
|
httpsConfig,
|
|
57461
57833
|
hostsFilePath,
|
|
57462
|
-
|
|
57463
|
-
|
|
57834
|
+
getSSLConfig,
|
|
57835
|
+
generateCertificate2 as generateCertificate,
|
|
57836
|
+
extractDomains,
|
|
57837
|
+
debugLog2 as debugLog,
|
|
57464
57838
|
config,
|
|
57465
57839
|
cleanup,
|
|
57466
57840
|
checkHosts,
|
|
57467
|
-
certPath,
|
|
57468
|
-
caCertPath,
|
|
57469
57841
|
addHosts
|
|
57470
57842
|
};
|