@stacksjs/rpx 0.3.1 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -5
- package/dist/cli.js +1006 -639
- package/dist/config.d.ts +2 -2
- package/dist/hosts.d.ts +3 -3
- package/dist/https.d.ts +8 -3
- package/dist/index.d.ts +7 -1
- package/dist/index.js +1402 -1024
- package/dist/start.d.ts +7 -6
- package/dist/types.d.ts +50 -7
- package/dist/utils.d.ts +4 -4
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -16,77 +16,12 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
// src/
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
import
|
|
25
|
-
import process2 from "process";
|
|
26
|
-
function deepMerge(target, ...sources) {
|
|
27
|
-
if (!sources.length)
|
|
28
|
-
return target;
|
|
29
|
-
const source = sources.shift();
|
|
30
|
-
if (isObject(target) && isObject(source)) {
|
|
31
|
-
for (const key in source) {
|
|
32
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
33
|
-
const sourceValue = source[key];
|
|
34
|
-
if (isObject(sourceValue) && isObject(target[key])) {
|
|
35
|
-
target[key] = deepMerge(target[key], sourceValue);
|
|
36
|
-
} else {
|
|
37
|
-
target[key] = sourceValue;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return deepMerge(target, ...sources);
|
|
43
|
-
}
|
|
44
|
-
function isObject(item) {
|
|
45
|
-
return item && typeof item === "object" && !Array.isArray(item);
|
|
46
|
-
}
|
|
47
|
-
async function loadConfig({ name, cwd, defaultConfig }) {
|
|
48
|
-
const configPath = resolve(cwd || process2.cwd(), `${name}.config`);
|
|
49
|
-
try {
|
|
50
|
-
const importedConfig = await import(configPath);
|
|
51
|
-
const loadedConfig = importedConfig.default || importedConfig;
|
|
52
|
-
return deepMerge(defaultConfig, loadedConfig);
|
|
53
|
-
} catch (error) {
|
|
54
|
-
return defaultConfig;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// src/config.ts
|
|
59
|
-
var config = await loadConfig({
|
|
60
|
-
name: "reverse-proxy",
|
|
61
|
-
defaultConfig: {
|
|
62
|
-
from: "localhost:5173",
|
|
63
|
-
to: "stacks.localhost",
|
|
64
|
-
https: {
|
|
65
|
-
domain: "stacks.localhost",
|
|
66
|
-
hostCertCN: "stacks.localhost",
|
|
67
|
-
caCertPath: path.join(os.homedir(), ".stacks", "ssl", `stacks.localhost.ca.crt`),
|
|
68
|
-
certPath: path.join(os.homedir(), ".stacks", "ssl", `stacks.localhost.crt`),
|
|
69
|
-
keyPath: path.join(os.homedir(), ".stacks", "ssl", `stacks.localhost.crt.key`),
|
|
70
|
-
altNameIPs: ["127.0.0.1"],
|
|
71
|
-
altNameURIs: ["localhost"],
|
|
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
|
-
verbose: true
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
// src/hosts.ts
|
|
85
|
-
import { spawn } from "child_process";
|
|
86
|
-
import fs from "fs";
|
|
87
|
-
import os3 from "os";
|
|
88
|
-
import path2 from "path";
|
|
89
|
-
import process3 from "process";
|
|
19
|
+
// src/start.ts
|
|
20
|
+
import * as fs5 from "fs";
|
|
21
|
+
import * as http from "http";
|
|
22
|
+
import * as https from "https";
|
|
23
|
+
import * as net from "net";
|
|
24
|
+
import process20 from "process";
|
|
90
25
|
|
|
91
26
|
// node_modules/@stacksjs/cli/dist/index.js
|
|
92
27
|
import { formatWithOptions } from "util";
|
|
@@ -122,7 +57,7 @@ import p2 from "process";
|
|
|
122
57
|
import process10 from "process";
|
|
123
58
|
import process18 from "process";
|
|
124
59
|
import process11 from "process";
|
|
125
|
-
import
|
|
60
|
+
import os from "os";
|
|
126
61
|
import tty3 from "tty";
|
|
127
62
|
import process14 from "process";
|
|
128
63
|
import process13 from "process";
|
|
@@ -157,11 +92,11 @@ var __export = (target, all) => {
|
|
|
157
92
|
});
|
|
158
93
|
};
|
|
159
94
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
160
|
-
function
|
|
95
|
+
function isObject(value) {
|
|
161
96
|
return value !== null && typeof value === "object";
|
|
162
97
|
}
|
|
163
98
|
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
164
|
-
if (!
|
|
99
|
+
if (!isObject(defaults)) {
|
|
165
100
|
return _defu(baseObject, {}, namespace, merger);
|
|
166
101
|
}
|
|
167
102
|
const object = Object.assign({}, defaults);
|
|
@@ -178,7 +113,7 @@ function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
|
178
113
|
}
|
|
179
114
|
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
180
115
|
object[key] = [...value, ...object[key]];
|
|
181
|
-
} else if (
|
|
116
|
+
} else if (isObject(value) && isObject(object[key])) {
|
|
182
117
|
object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
|
|
183
118
|
} else {
|
|
184
119
|
object[key] = value;
|
|
@@ -395,9 +330,12 @@ class Consola {
|
|
|
395
330
|
}
|
|
396
331
|
if (logObj.additional) {
|
|
397
332
|
if (!Array.isArray(logObj.additional)) {
|
|
398
|
-
logObj.additional = logObj.additional.split(
|
|
333
|
+
logObj.additional = logObj.additional.split(`
|
|
334
|
+
`);
|
|
399
335
|
}
|
|
400
|
-
logObj.args.push(
|
|
336
|
+
logObj.args.push(`
|
|
337
|
+
` + logObj.additional.join(`
|
|
338
|
+
`));
|
|
401
339
|
delete logObj.additional;
|
|
402
340
|
}
|
|
403
341
|
logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
|
|
@@ -542,7 +480,8 @@ var init_core = __esm(() => {
|
|
|
542
480
|
});
|
|
543
481
|
function parseStack(stack) {
|
|
544
482
|
const cwd = process.cwd() + sep;
|
|
545
|
-
const lines = stack.split(
|
|
483
|
+
const lines = stack.split(`
|
|
484
|
+
`).splice(1).map((l2) => l2.trim().replace("file://", "").replace(cwd, ""));
|
|
546
485
|
return lines;
|
|
547
486
|
}
|
|
548
487
|
function writeStream(data, stream) {
|
|
@@ -552,12 +491,14 @@ function writeStream(data, stream) {
|
|
|
552
491
|
|
|
553
492
|
class BasicReporter {
|
|
554
493
|
formatStack(stack, opts) {
|
|
555
|
-
return " " + parseStack(stack).join(
|
|
494
|
+
return " " + parseStack(stack).join(`
|
|
495
|
+
`);
|
|
556
496
|
}
|
|
557
497
|
formatArgs(args, opts) {
|
|
558
498
|
const _args = args.map((arg) => {
|
|
559
499
|
if (arg && typeof arg.stack === "string") {
|
|
560
|
-
return arg.message +
|
|
500
|
+
return arg.message + `
|
|
501
|
+
` + this.formatStack(arg.stack, opts);
|
|
561
502
|
}
|
|
562
503
|
return arg;
|
|
563
504
|
});
|
|
@@ -572,11 +513,15 @@ class BasicReporter {
|
|
|
572
513
|
formatLogObj(logObj, opts) {
|
|
573
514
|
const message = this.formatArgs(logObj.args, opts);
|
|
574
515
|
if (logObj.type === "box") {
|
|
575
|
-
return
|
|
516
|
+
return `
|
|
517
|
+
` + [
|
|
576
518
|
bracket(logObj.tag),
|
|
577
519
|
logObj.title && logObj.title,
|
|
578
|
-
...message.split(
|
|
579
|
-
|
|
520
|
+
...message.split(`
|
|
521
|
+
`)
|
|
522
|
+
].filter(Boolean).map((l2) => " > " + l2).join(`
|
|
523
|
+
`) + `
|
|
524
|
+
`;
|
|
580
525
|
}
|
|
581
526
|
return this.filterAndJoin([
|
|
582
527
|
bracket(logObj.type),
|
|
@@ -589,7 +534,8 @@ class BasicReporter {
|
|
|
589
534
|
columns: ctx.options.stdout.columns || 0,
|
|
590
535
|
...ctx.options.formatOptions
|
|
591
536
|
});
|
|
592
|
-
return writeStream(line +
|
|
537
|
+
return writeStream(line + `
|
|
538
|
+
`, logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout);
|
|
593
539
|
}
|
|
594
540
|
}
|
|
595
541
|
var bracket = (x2) => x2 ? `[${x2}]` : "";
|
|
@@ -624,7 +570,8 @@ function box(text, _opts = {}) {
|
|
|
624
570
|
..._opts.style
|
|
625
571
|
}
|
|
626
572
|
};
|
|
627
|
-
const textLines = text.split(
|
|
573
|
+
const textLines = text.split(`
|
|
574
|
+
`);
|
|
628
575
|
const boxLines = [];
|
|
629
576
|
const _color = getColor(opts.style.borderColor);
|
|
630
577
|
const borderStyle = {
|
|
@@ -665,7 +612,8 @@ function box(text, _opts = {}) {
|
|
|
665
612
|
if (opts.style.marginBottom > 0) {
|
|
666
613
|
boxLines.push("".repeat(opts.style.marginBottom));
|
|
667
614
|
}
|
|
668
|
-
return boxLines.join(
|
|
615
|
+
return boxLines.join(`
|
|
616
|
+
`);
|
|
669
617
|
}
|
|
670
618
|
var env2;
|
|
671
619
|
var argv;
|
|
@@ -953,7 +901,7 @@ class h2 {
|
|
|
953
901
|
}
|
|
954
902
|
this.state !== "error" && (this.state = "submit");
|
|
955
903
|
}
|
|
956
|
-
u === "
|
|
904
|
+
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
905
|
}
|
|
958
906
|
close() {
|
|
959
907
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
@@ -1224,7 +1172,8 @@ ${colors.yellow(S_BAR_END)} ${colors.yellow(this.error)}
|
|
|
1224
1172
|
return `${title}${colors.gray(S_BAR)} ${colors.dim(this.value || opts.placeholder)}`;
|
|
1225
1173
|
}
|
|
1226
1174
|
case "cancel": {
|
|
1227
|
-
return `${title}${colors.gray(S_BAR)} ${colors.strikethrough(colors.dim(this.value ?? ""))}${this.value?.trim() ?
|
|
1175
|
+
return `${title}${colors.gray(S_BAR)} ${colors.strikethrough(colors.dim(this.value ?? ""))}${this.value?.trim() ? `
|
|
1176
|
+
` + colors.gray(S_BAR) : ""}`;
|
|
1228
1177
|
}
|
|
1229
1178
|
default: {
|
|
1230
1179
|
return `${title}${colors.cyan(S_BAR)} ${value}
|
|
@@ -1352,7 +1301,9 @@ ${symbol(this.state)} ${opts.message}
|
|
|
1352
1301
|
${colors.gray(S_BAR)}` : ""}`;
|
|
1353
1302
|
}
|
|
1354
1303
|
case "error": {
|
|
1355
|
-
const footer = this.error.split(
|
|
1304
|
+
const footer = this.error.split(`
|
|
1305
|
+
`).map((ln, i) => i === 0 ? `${colors.yellow(S_BAR_END)} ${colors.yellow(ln)}` : ` ${ln}`).join(`
|
|
1306
|
+
`);
|
|
1356
1307
|
return title + colors.yellow(S_BAR) + " " + this.options.map((option, i) => {
|
|
1357
1308
|
const selected = this.value.includes(option.value);
|
|
1358
1309
|
const active = i === this.cursor;
|
|
@@ -1364,7 +1315,9 @@ ${colors.gray(S_BAR)}` : ""}`;
|
|
|
1364
1315
|
}
|
|
1365
1316
|
return opt(option, active ? "active" : "inactive");
|
|
1366
1317
|
}).join(`
|
|
1367
|
-
${colors.yellow(S_BAR)} `) +
|
|
1318
|
+
${colors.yellow(S_BAR)} `) + `
|
|
1319
|
+
` + footer + `
|
|
1320
|
+
`;
|
|
1368
1321
|
}
|
|
1369
1322
|
default: {
|
|
1370
1323
|
return `${title}${colors.cyan(S_BAR)} ${this.options.map((option, i) => {
|
|
@@ -1926,7 +1879,9 @@ var init_consola_36c0034f = __esm(() => {
|
|
|
1926
1879
|
};
|
|
1927
1880
|
FancyReporter = class FancyReporter2 extends BasicReporter {
|
|
1928
1881
|
formatStack(stack) {
|
|
1929
|
-
return
|
|
1882
|
+
return `
|
|
1883
|
+
` + parseStack(stack).map((line) => " " + line.replace(/^at +/, (m2) => colors.gray(m2)).replace(/\((.+)\)/, (_2, m2) => `(${colors.cyan(m2)})`)).join(`
|
|
1884
|
+
`);
|
|
1930
1885
|
}
|
|
1931
1886
|
formatType(logObj, isBadge, opts) {
|
|
1932
1887
|
const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
|
|
@@ -1937,9 +1892,12 @@ var init_consola_36c0034f = __esm(() => {
|
|
|
1937
1892
|
return _type ? getColor2(typeColor)(_type) : "";
|
|
1938
1893
|
}
|
|
1939
1894
|
formatLogObj(logObj, opts) {
|
|
1940
|
-
const [message, ...additional] = this.formatArgs(logObj.args, opts).split(
|
|
1895
|
+
const [message, ...additional] = this.formatArgs(logObj.args, opts).split(`
|
|
1896
|
+
`);
|
|
1941
1897
|
if (logObj.type === "box") {
|
|
1942
|
-
return box(characterFormat(message + (additional.length > 0 ?
|
|
1898
|
+
return box(characterFormat(message + (additional.length > 0 ? `
|
|
1899
|
+
` + additional.join(`
|
|
1900
|
+
`) : "")), {
|
|
1943
1901
|
title: logObj.title ? characterFormat(logObj.title) : undefined,
|
|
1944
1902
|
style: logObj.style
|
|
1945
1903
|
});
|
|
@@ -1954,12 +1912,16 @@ var init_consola_36c0034f = __esm(() => {
|
|
|
1954
1912
|
const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
|
|
1955
1913
|
const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
|
|
1956
1914
|
line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
|
|
1957
|
-
line += characterFormat(additional.length > 0 ?
|
|
1915
|
+
line += characterFormat(additional.length > 0 ? `
|
|
1916
|
+
` + additional.join(`
|
|
1917
|
+
`) : "");
|
|
1958
1918
|
if (logObj.type === "trace") {
|
|
1959
1919
|
const _err = new Error("Trace: " + logObj.message);
|
|
1960
1920
|
line += this.formatStack(_err.stack || "");
|
|
1961
1921
|
}
|
|
1962
|
-
return isBadge ?
|
|
1922
|
+
return isBadge ? `
|
|
1923
|
+
` + line + `
|
|
1924
|
+
` : line;
|
|
1963
1925
|
}
|
|
1964
1926
|
};
|
|
1965
1927
|
consola = createConsola2();
|
|
@@ -2179,7 +2141,8 @@ var require_isURL = __commonJS((exports, module) => {
|
|
|
2179
2141
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
2180
2142
|
}
|
|
2181
2143
|
function _nonIterableRest() {
|
|
2182
|
-
throw new TypeError(
|
|
2144
|
+
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2145
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
2183
2146
|
}
|
|
2184
2147
|
function _unsupportedIterableToArray(o, minLen) {
|
|
2185
2148
|
if (!o)
|
|
@@ -2637,7 +2600,7 @@ var require_isEmail = __commonJS((exports, module) => {
|
|
|
2637
2600
|
if (display_name_without_quotes === display_name) {
|
|
2638
2601
|
return false;
|
|
2639
2602
|
}
|
|
2640
|
-
var all_start_with_back_slash = display_name_without_quotes.split('"').length === display_name_without_quotes.split(
|
|
2603
|
+
var all_start_with_back_slash = display_name_without_quotes.split('"').length === display_name_without_quotes.split("\\\"").length;
|
|
2641
2604
|
if (!all_start_with_back_slash) {
|
|
2642
2605
|
return false;
|
|
2643
2606
|
}
|
|
@@ -4302,7 +4265,8 @@ var require_clear = __commonJS((exports, module) => {
|
|
|
4302
4265
|
throw _e;
|
|
4303
4266
|
}, f: F };
|
|
4304
4267
|
}
|
|
4305
|
-
throw new TypeError(
|
|
4268
|
+
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
4269
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
4306
4270
|
}
|
|
4307
4271
|
var normalCompletion = true, didErr = false, err2;
|
|
4308
4272
|
return { s: function s() {
|
|
@@ -4459,7 +4423,9 @@ var require_wrap = __commonJS((exports, module) => {
|
|
|
4459
4423
|
else
|
|
4460
4424
|
arr.push(`${tab}${w2}`);
|
|
4461
4425
|
return arr;
|
|
4462
|
-
}, [tab]).join(
|
|
4426
|
+
}, [tab]).join(`
|
|
4427
|
+
`)).join(`
|
|
4428
|
+
`);
|
|
4463
4429
|
};
|
|
4464
4430
|
});
|
|
4465
4431
|
var require_entriesToDisplay = __commonJS((exports, module) => {
|
|
@@ -4640,7 +4606,8 @@ var require_text = __commonJS((exports, module) => {
|
|
|
4640
4606
|
this.red = false;
|
|
4641
4607
|
this.fire();
|
|
4642
4608
|
this.render();
|
|
4643
|
-
this.out.write(
|
|
4609
|
+
this.out.write(`
|
|
4610
|
+
`);
|
|
4644
4611
|
this.close();
|
|
4645
4612
|
}
|
|
4646
4613
|
validate() {
|
|
@@ -4671,7 +4638,8 @@ var require_text = __commonJS((exports, module) => {
|
|
|
4671
4638
|
_this2.aborted = false;
|
|
4672
4639
|
_this2.fire();
|
|
4673
4640
|
_this2.render();
|
|
4674
|
-
_this2.out.write(
|
|
4641
|
+
_this2.out.write(`
|
|
4642
|
+
`);
|
|
4675
4643
|
_this2.close();
|
|
4676
4644
|
})();
|
|
4677
4645
|
}
|
|
@@ -4764,7 +4732,9 @@ var require_text = __commonJS((exports, module) => {
|
|
|
4764
4732
|
this.outputError = "";
|
|
4765
4733
|
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
4734
|
if (this.error) {
|
|
4767
|
-
this.outputError += this.errorMsg.split(
|
|
4735
|
+
this.outputError += this.errorMsg.split(`
|
|
4736
|
+
`).reduce((a, l3, i) => a + `
|
|
4737
|
+
${i ? " " : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
4768
4738
|
}
|
|
4769
4739
|
this.out.write(erase2.line + cursor2.to(0) + this.outputText + cursor2.save + this.outputError + cursor2.restore + cursor2.move(this.cursorOffset, 0));
|
|
4770
4740
|
}
|
|
@@ -4826,7 +4796,8 @@ var require_select = __commonJS((exports, module) => {
|
|
|
4826
4796
|
this.done = this.aborted = true;
|
|
4827
4797
|
this.fire();
|
|
4828
4798
|
this.render();
|
|
4829
|
-
this.out.write(
|
|
4799
|
+
this.out.write(`
|
|
4800
|
+
`);
|
|
4830
4801
|
this.close();
|
|
4831
4802
|
}
|
|
4832
4803
|
submit() {
|
|
@@ -4835,7 +4806,8 @@ var require_select = __commonJS((exports, module) => {
|
|
|
4835
4806
|
this.aborted = false;
|
|
4836
4807
|
this.fire();
|
|
4837
4808
|
this.render();
|
|
4838
|
-
this.out.write(
|
|
4809
|
+
this.out.write(`
|
|
4810
|
+
`);
|
|
4839
4811
|
this.close();
|
|
4840
4812
|
} else
|
|
4841
4813
|
this.bell();
|
|
@@ -4886,7 +4858,8 @@ var require_select = __commonJS((exports, module) => {
|
|
|
4886
4858
|
let _entriesToDisplay = entriesToDisplay(this.cursor, this.choices.length, this.optionsPerPage), startIndex = _entriesToDisplay.startIndex, endIndex = _entriesToDisplay.endIndex;
|
|
4887
4859
|
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
4860
|
if (!this.done) {
|
|
4889
|
-
this.outputText +=
|
|
4861
|
+
this.outputText += `
|
|
4862
|
+
`;
|
|
4890
4863
|
for (let i = startIndex;i < endIndex; i++) {
|
|
4891
4864
|
let title, prefix, desc = "", v2 = this.choices[i];
|
|
4892
4865
|
if (i === startIndex && startIndex > 0) {
|
|
@@ -4905,14 +4878,16 @@ var require_select = __commonJS((exports, module) => {
|
|
|
4905
4878
|
if (v2.description && this.cursor === i) {
|
|
4906
4879
|
desc = ` - ${v2.description}`;
|
|
4907
4880
|
if (prefix.length + title.length + desc.length >= this.out.columns || v2.description.split(/\r?\n/).length > 1) {
|
|
4908
|
-
desc =
|
|
4881
|
+
desc = `
|
|
4882
|
+
` + wrap(v2.description, {
|
|
4909
4883
|
margin: 3,
|
|
4910
4884
|
width: this.out.columns
|
|
4911
4885
|
});
|
|
4912
4886
|
}
|
|
4913
4887
|
}
|
|
4914
4888
|
}
|
|
4915
|
-
this.outputText += `${prefix} ${title}${color.gray(desc)}
|
|
4889
|
+
this.outputText += `${prefix} ${title}${color.gray(desc)}
|
|
4890
|
+
`;
|
|
4916
4891
|
}
|
|
4917
4892
|
}
|
|
4918
4893
|
this.out.write(this.outputText);
|
|
@@ -4952,7 +4927,8 @@ var require_toggle = __commonJS((exports, module) => {
|
|
|
4952
4927
|
this.done = this.aborted = true;
|
|
4953
4928
|
this.fire();
|
|
4954
4929
|
this.render();
|
|
4955
|
-
this.out.write(
|
|
4930
|
+
this.out.write(`
|
|
4931
|
+
`);
|
|
4956
4932
|
this.close();
|
|
4957
4933
|
}
|
|
4958
4934
|
submit() {
|
|
@@ -4960,7 +4936,8 @@ var require_toggle = __commonJS((exports, module) => {
|
|
|
4960
4936
|
this.aborted = false;
|
|
4961
4937
|
this.fire();
|
|
4962
4938
|
this.render();
|
|
4963
|
-
this.out.write(
|
|
4939
|
+
this.out.write(`
|
|
4940
|
+
`);
|
|
4964
4941
|
this.close();
|
|
4965
4942
|
}
|
|
4966
4943
|
deactivate() {
|
|
@@ -5393,7 +5370,8 @@ var require_date = __commonJS((exports, module) => {
|
|
|
5393
5370
|
this.error = false;
|
|
5394
5371
|
this.fire();
|
|
5395
5372
|
this.render();
|
|
5396
|
-
this.out.write(
|
|
5373
|
+
this.out.write(`
|
|
5374
|
+
`);
|
|
5397
5375
|
this.close();
|
|
5398
5376
|
}
|
|
5399
5377
|
validate() {
|
|
@@ -5421,7 +5399,8 @@ var require_date = __commonJS((exports, module) => {
|
|
|
5421
5399
|
_this2.aborted = false;
|
|
5422
5400
|
_this2.fire();
|
|
5423
5401
|
_this2.render();
|
|
5424
|
-
_this2.out.write(
|
|
5402
|
+
_this2.out.write(`
|
|
5403
|
+
`);
|
|
5425
5404
|
_this2.close();
|
|
5426
5405
|
})();
|
|
5427
5406
|
}
|
|
@@ -5471,7 +5450,9 @@ var require_date = __commonJS((exports, module) => {
|
|
|
5471
5450
|
super.render();
|
|
5472
5451
|
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
5452
|
if (this.error) {
|
|
5474
|
-
this.outputText += this.errorMsg.split(
|
|
5453
|
+
this.outputText += this.errorMsg.split(`
|
|
5454
|
+
`).reduce((a, l3, i) => a + `
|
|
5455
|
+
${i ? ` ` : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
5475
5456
|
}
|
|
5476
5457
|
this.out.write(erase2.line + cursor2.to(0) + this.outputText);
|
|
5477
5458
|
}
|
|
@@ -5581,7 +5562,8 @@ var require_number = __commonJS((exports, module) => {
|
|
|
5581
5562
|
this.error = false;
|
|
5582
5563
|
this.fire();
|
|
5583
5564
|
this.render();
|
|
5584
|
-
this.out.write(
|
|
5565
|
+
this.out.write(`
|
|
5566
|
+
`);
|
|
5585
5567
|
this.close();
|
|
5586
5568
|
}
|
|
5587
5569
|
validate() {
|
|
@@ -5612,7 +5594,8 @@ var require_number = __commonJS((exports, module) => {
|
|
|
5612
5594
|
_this2.error = false;
|
|
5613
5595
|
_this2.fire();
|
|
5614
5596
|
_this2.render();
|
|
5615
|
-
_this2.out.write(
|
|
5597
|
+
_this2.out.write(`
|
|
5598
|
+
`);
|
|
5616
5599
|
_this2.close();
|
|
5617
5600
|
})();
|
|
5618
5601
|
}
|
|
@@ -5688,7 +5671,9 @@ var require_number = __commonJS((exports, module) => {
|
|
|
5688
5671
|
this.outputError = "";
|
|
5689
5672
|
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
5673
|
if (this.error) {
|
|
5691
|
-
this.outputError += this.errorMsg.split(
|
|
5674
|
+
this.outputError += this.errorMsg.split(`
|
|
5675
|
+
`).reduce((a, l3, i) => a + `
|
|
5676
|
+
${i ? ` ` : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
5692
5677
|
}
|
|
5693
5678
|
this.out.write(erase2.line + cursor2.to(0) + this.outputText + cursor2.save + this.outputError + cursor2.restore);
|
|
5694
5679
|
}
|
|
@@ -5755,7 +5740,8 @@ var require_multiselect = __commonJS((exports, module) => {
|
|
|
5755
5740
|
this.done = this.aborted = true;
|
|
5756
5741
|
this.fire();
|
|
5757
5742
|
this.render();
|
|
5758
|
-
this.out.write(
|
|
5743
|
+
this.out.write(`
|
|
5744
|
+
`);
|
|
5759
5745
|
this.close();
|
|
5760
5746
|
}
|
|
5761
5747
|
submit() {
|
|
@@ -5768,7 +5754,8 @@ var require_multiselect = __commonJS((exports, module) => {
|
|
|
5768
5754
|
this.aborted = false;
|
|
5769
5755
|
this.fire();
|
|
5770
5756
|
this.render();
|
|
5771
|
-
this.out.write(
|
|
5757
|
+
this.out.write(`
|
|
5758
|
+
`);
|
|
5772
5759
|
this.close();
|
|
5773
5760
|
}
|
|
5774
5761
|
}
|
|
@@ -5844,7 +5831,12 @@ var require_multiselect = __commonJS((exports, module) => {
|
|
|
5844
5831
|
if (typeof this.instructions === "string") {
|
|
5845
5832
|
return this.instructions;
|
|
5846
5833
|
}
|
|
5847
|
-
return
|
|
5834
|
+
return `
|
|
5835
|
+
Instructions:
|
|
5836
|
+
` + ` ${figures.arrowUp}/${figures.arrowDown}: Highlight option
|
|
5837
|
+
` + ` ${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
|
|
5838
|
+
` + (this.maxChoices === undefined ? ` a: Toggle all
|
|
5839
|
+
` : "") + ` enter/return: Complete answer`;
|
|
5848
5840
|
}
|
|
5849
5841
|
return "";
|
|
5850
5842
|
}
|
|
@@ -5858,7 +5850,8 @@ var require_multiselect = __commonJS((exports, module) => {
|
|
|
5858
5850
|
if (cursor3 === i && v2.description) {
|
|
5859
5851
|
desc = ` - ${v2.description}`;
|
|
5860
5852
|
if (prefix.length + title.length + desc.length >= this.out.columns || v2.description.split(/\r?\n/).length > 1) {
|
|
5861
|
-
desc =
|
|
5853
|
+
desc = `
|
|
5854
|
+
` + wrap(v2.description, {
|
|
5862
5855
|
margin: prefix.length,
|
|
5863
5856
|
width: this.out.columns
|
|
5864
5857
|
});
|
|
@@ -5883,7 +5876,9 @@ var require_multiselect = __commonJS((exports, module) => {
|
|
|
5883
5876
|
}
|
|
5884
5877
|
styledOptions.push(this.renderOption(this.cursor, options[i], i, prefix));
|
|
5885
5878
|
}
|
|
5886
|
-
return
|
|
5879
|
+
return `
|
|
5880
|
+
` + styledOptions.join(`
|
|
5881
|
+
`);
|
|
5887
5882
|
}
|
|
5888
5883
|
renderOptions(options) {
|
|
5889
5884
|
if (!this.done) {
|
|
@@ -6049,7 +6044,8 @@ var require_autocomplete = __commonJS((exports, module) => {
|
|
|
6049
6044
|
this.aborted = false;
|
|
6050
6045
|
this.fire();
|
|
6051
6046
|
this.render();
|
|
6052
|
-
this.out.write(
|
|
6047
|
+
this.out.write(`
|
|
6048
|
+
`);
|
|
6053
6049
|
this.close();
|
|
6054
6050
|
}
|
|
6055
6051
|
}
|
|
@@ -6058,7 +6054,8 @@ var require_autocomplete = __commonJS((exports, module) => {
|
|
|
6058
6054
|
this.exited = false;
|
|
6059
6055
|
this.fire();
|
|
6060
6056
|
this.render();
|
|
6061
|
-
this.out.write(
|
|
6057
|
+
this.out.write(`
|
|
6058
|
+
`);
|
|
6062
6059
|
this.close();
|
|
6063
6060
|
}
|
|
6064
6061
|
submit() {
|
|
@@ -6066,7 +6063,8 @@ var require_autocomplete = __commonJS((exports, module) => {
|
|
|
6066
6063
|
this.aborted = this.exited = false;
|
|
6067
6064
|
this.fire();
|
|
6068
6065
|
this.render();
|
|
6069
|
-
this.out.write(
|
|
6066
|
+
this.out.write(`
|
|
6067
|
+
`);
|
|
6070
6068
|
this.close();
|
|
6071
6069
|
}
|
|
6072
6070
|
_(c2, key) {
|
|
@@ -6155,7 +6153,8 @@ var require_autocomplete = __commonJS((exports, module) => {
|
|
|
6155
6153
|
if (v2.description) {
|
|
6156
6154
|
desc = ` - ${v2.description}`;
|
|
6157
6155
|
if (prefix.length + title.length + desc.length >= this.out.columns || v2.description.split(/\r?\n/).length > 1) {
|
|
6158
|
-
desc =
|
|
6156
|
+
desc = `
|
|
6157
|
+
` + wrap(v2.description, {
|
|
6159
6158
|
margin: 3,
|
|
6160
6159
|
width: this.out.columns
|
|
6161
6160
|
});
|
|
@@ -6174,8 +6173,10 @@ var require_autocomplete = __commonJS((exports, module) => {
|
|
|
6174
6173
|
let _entriesToDisplay = entriesToDisplay(this.select, this.choices.length, this.limit), startIndex = _entriesToDisplay.startIndex, endIndex = _entriesToDisplay.endIndex;
|
|
6175
6174
|
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
6175
|
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
|
-
|
|
6176
|
+
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(`
|
|
6177
|
+
`);
|
|
6178
|
+
this.outputText += `
|
|
6179
|
+
` + (suggestions || color.gray(this.fallback.title));
|
|
6179
6180
|
}
|
|
6180
6181
|
this.out.write(erase2.line + cursor2.to(0) + this.outputText);
|
|
6181
6182
|
}
|
|
@@ -6303,7 +6304,8 @@ Instructions:
|
|
|
6303
6304
|
}
|
|
6304
6305
|
renderCurrentInput() {
|
|
6305
6306
|
return `
|
|
6306
|
-
Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
|
|
6307
|
+
Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
|
|
6308
|
+
`;
|
|
6307
6309
|
}
|
|
6308
6310
|
renderOption(cursor3, v2, i) {
|
|
6309
6311
|
let title;
|
|
@@ -6375,7 +6377,8 @@ var require_confirm = __commonJS((exports, module) => {
|
|
|
6375
6377
|
this.done = this.aborted = true;
|
|
6376
6378
|
this.fire();
|
|
6377
6379
|
this.render();
|
|
6378
|
-
this.out.write(
|
|
6380
|
+
this.out.write(`
|
|
6381
|
+
`);
|
|
6379
6382
|
this.close();
|
|
6380
6383
|
}
|
|
6381
6384
|
submit() {
|
|
@@ -6384,7 +6387,8 @@ var require_confirm = __commonJS((exports, module) => {
|
|
|
6384
6387
|
this.aborted = false;
|
|
6385
6388
|
this.fire();
|
|
6386
6389
|
this.render();
|
|
6387
|
-
this.out.write(
|
|
6390
|
+
this.out.write(`
|
|
6391
|
+
`);
|
|
6388
6392
|
this.close();
|
|
6389
6393
|
}
|
|
6390
6394
|
_(c2, key) {
|
|
@@ -6540,7 +6544,8 @@ var require_dist = __commonJS((exports, module) => {
|
|
|
6540
6544
|
throw _e;
|
|
6541
6545
|
}, f: F };
|
|
6542
6546
|
}
|
|
6543
|
-
throw new TypeError(
|
|
6547
|
+
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
6548
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
6544
6549
|
}
|
|
6545
6550
|
var normalCompletion = true, didErr = false, err2;
|
|
6546
6551
|
return { s: function s() {
|
|
@@ -6872,7 +6877,9 @@ var require_wrap2 = __commonJS((exports, module) => {
|
|
|
6872
6877
|
else
|
|
6873
6878
|
arr.push(`${tab}${w2}`);
|
|
6874
6879
|
return arr;
|
|
6875
|
-
}, [tab]).join(
|
|
6880
|
+
}, [tab]).join(`
|
|
6881
|
+
`)).join(`
|
|
6882
|
+
`);
|
|
6876
6883
|
};
|
|
6877
6884
|
});
|
|
6878
6885
|
var require_entriesToDisplay2 = __commonJS((exports, module) => {
|
|
@@ -7009,7 +7016,8 @@ var require_text2 = __commonJS((exports, module) => {
|
|
|
7009
7016
|
this.red = false;
|
|
7010
7017
|
this.fire();
|
|
7011
7018
|
this.render();
|
|
7012
|
-
this.out.write(
|
|
7019
|
+
this.out.write(`
|
|
7020
|
+
`);
|
|
7013
7021
|
this.close();
|
|
7014
7022
|
}
|
|
7015
7023
|
async validate() {
|
|
@@ -7035,7 +7043,8 @@ var require_text2 = __commonJS((exports, module) => {
|
|
|
7035
7043
|
this.aborted = false;
|
|
7036
7044
|
this.fire();
|
|
7037
7045
|
this.render();
|
|
7038
|
-
this.out.write(
|
|
7046
|
+
this.out.write(`
|
|
7047
|
+
`);
|
|
7039
7048
|
this.close();
|
|
7040
7049
|
}
|
|
7041
7050
|
next() {
|
|
@@ -7132,7 +7141,9 @@ var require_text2 = __commonJS((exports, module) => {
|
|
|
7132
7141
|
this.red ? color.red(this.rendered) : this.rendered
|
|
7133
7142
|
].join(` `);
|
|
7134
7143
|
if (this.error) {
|
|
7135
|
-
this.outputError += this.errorMsg.split(
|
|
7144
|
+
this.outputError += this.errorMsg.split(`
|
|
7145
|
+
`).reduce((a, l3, i) => a + `
|
|
7146
|
+
${i ? " " : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
7136
7147
|
}
|
|
7137
7148
|
this.out.write(erase2.line + cursor2.to(0) + this.outputText + cursor2.save + this.outputError + cursor2.restore + cursor2.move(this.cursorOffset, 0));
|
|
7138
7149
|
}
|
|
@@ -7185,7 +7196,8 @@ var require_select2 = __commonJS((exports, module) => {
|
|
|
7185
7196
|
this.done = this.aborted = true;
|
|
7186
7197
|
this.fire();
|
|
7187
7198
|
this.render();
|
|
7188
|
-
this.out.write(
|
|
7199
|
+
this.out.write(`
|
|
7200
|
+
`);
|
|
7189
7201
|
this.close();
|
|
7190
7202
|
}
|
|
7191
7203
|
submit() {
|
|
@@ -7194,7 +7206,8 @@ var require_select2 = __commonJS((exports, module) => {
|
|
|
7194
7206
|
this.aborted = false;
|
|
7195
7207
|
this.fire();
|
|
7196
7208
|
this.render();
|
|
7197
|
-
this.out.write(
|
|
7209
|
+
this.out.write(`
|
|
7210
|
+
`);
|
|
7198
7211
|
this.close();
|
|
7199
7212
|
} else
|
|
7200
7213
|
this.bell();
|
|
@@ -7250,7 +7263,8 @@ var require_select2 = __commonJS((exports, module) => {
|
|
|
7250
7263
|
this.done ? this.selection.title : this.selection.disabled ? color.yellow(this.warn) : color.gray(this.hint)
|
|
7251
7264
|
].join(" ");
|
|
7252
7265
|
if (!this.done) {
|
|
7253
|
-
this.outputText +=
|
|
7266
|
+
this.outputText += `
|
|
7267
|
+
`;
|
|
7254
7268
|
for (let i = startIndex;i < endIndex; i++) {
|
|
7255
7269
|
let title, prefix, desc = "", v2 = this.choices[i];
|
|
7256
7270
|
if (i === startIndex && startIndex > 0) {
|
|
@@ -7269,11 +7283,13 @@ var require_select2 = __commonJS((exports, module) => {
|
|
|
7269
7283
|
if (v2.description && this.cursor === i) {
|
|
7270
7284
|
desc = ` - ${v2.description}`;
|
|
7271
7285
|
if (prefix.length + title.length + desc.length >= this.out.columns || v2.description.split(/\r?\n/).length > 1) {
|
|
7272
|
-
desc =
|
|
7286
|
+
desc = `
|
|
7287
|
+
` + wrap(v2.description, { margin: 3, width: this.out.columns });
|
|
7273
7288
|
}
|
|
7274
7289
|
}
|
|
7275
7290
|
}
|
|
7276
|
-
this.outputText += `${prefix} ${title}${color.gray(desc)}
|
|
7291
|
+
this.outputText += `${prefix} ${title}${color.gray(desc)}
|
|
7292
|
+
`;
|
|
7277
7293
|
}
|
|
7278
7294
|
}
|
|
7279
7295
|
this.out.write(this.outputText);
|
|
@@ -7309,7 +7325,8 @@ var require_toggle2 = __commonJS((exports, module) => {
|
|
|
7309
7325
|
this.done = this.aborted = true;
|
|
7310
7326
|
this.fire();
|
|
7311
7327
|
this.render();
|
|
7312
|
-
this.out.write(
|
|
7328
|
+
this.out.write(`
|
|
7329
|
+
`);
|
|
7313
7330
|
this.close();
|
|
7314
7331
|
}
|
|
7315
7332
|
submit() {
|
|
@@ -7317,7 +7334,8 @@ var require_toggle2 = __commonJS((exports, module) => {
|
|
|
7317
7334
|
this.aborted = false;
|
|
7318
7335
|
this.fire();
|
|
7319
7336
|
this.render();
|
|
7320
|
-
this.out.write(
|
|
7337
|
+
this.out.write(`
|
|
7338
|
+
`);
|
|
7321
7339
|
this.close();
|
|
7322
7340
|
}
|
|
7323
7341
|
deactivate() {
|
|
@@ -7702,7 +7720,8 @@ var require_date2 = __commonJS((exports, module) => {
|
|
|
7702
7720
|
this.error = false;
|
|
7703
7721
|
this.fire();
|
|
7704
7722
|
this.render();
|
|
7705
|
-
this.out.write(
|
|
7723
|
+
this.out.write(`
|
|
7724
|
+
`);
|
|
7706
7725
|
this.close();
|
|
7707
7726
|
}
|
|
7708
7727
|
async validate() {
|
|
@@ -7725,7 +7744,8 @@ var require_date2 = __commonJS((exports, module) => {
|
|
|
7725
7744
|
this.aborted = false;
|
|
7726
7745
|
this.fire();
|
|
7727
7746
|
this.render();
|
|
7728
|
-
this.out.write(
|
|
7747
|
+
this.out.write(`
|
|
7748
|
+
`);
|
|
7729
7749
|
this.close();
|
|
7730
7750
|
}
|
|
7731
7751
|
up() {
|
|
@@ -7779,7 +7799,9 @@ var require_date2 = __commonJS((exports, module) => {
|
|
|
7779
7799
|
this.parts.reduce((arr, p3, idx) => arr.concat(idx === this.cursor && !this.done ? color.cyan().underline(p3.toString()) : p3), []).join("")
|
|
7780
7800
|
].join(" ");
|
|
7781
7801
|
if (this.error) {
|
|
7782
|
-
this.outputText += this.errorMsg.split(
|
|
7802
|
+
this.outputText += this.errorMsg.split(`
|
|
7803
|
+
`).reduce((a, l3, i) => a + `
|
|
7804
|
+
${i ? ` ` : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
7783
7805
|
}
|
|
7784
7806
|
this.out.write(erase2.line + cursor2.to(0) + this.outputText);
|
|
7785
7807
|
}
|
|
@@ -7854,7 +7876,8 @@ var require_number2 = __commonJS((exports, module) => {
|
|
|
7854
7876
|
this.error = false;
|
|
7855
7877
|
this.fire();
|
|
7856
7878
|
this.render();
|
|
7857
|
-
this.out.write(
|
|
7879
|
+
this.out.write(`
|
|
7880
|
+
`);
|
|
7858
7881
|
this.close();
|
|
7859
7882
|
}
|
|
7860
7883
|
async validate() {
|
|
@@ -7880,7 +7903,8 @@ var require_number2 = __commonJS((exports, module) => {
|
|
|
7880
7903
|
this.error = false;
|
|
7881
7904
|
this.fire();
|
|
7882
7905
|
this.render();
|
|
7883
|
-
this.out.write(
|
|
7906
|
+
this.out.write(`
|
|
7907
|
+
`);
|
|
7884
7908
|
this.close();
|
|
7885
7909
|
}
|
|
7886
7910
|
up() {
|
|
@@ -7960,7 +7984,9 @@ var require_number2 = __commonJS((exports, module) => {
|
|
|
7960
7984
|
!this.done || !this.done && !this.placeholder ? color[this.color]().underline(this.rendered) : this.rendered
|
|
7961
7985
|
].join(` `);
|
|
7962
7986
|
if (this.error) {
|
|
7963
|
-
this.outputError += this.errorMsg.split(
|
|
7987
|
+
this.outputError += this.errorMsg.split(`
|
|
7988
|
+
`).reduce((a, l3, i) => a + `
|
|
7989
|
+
${i ? ` ` : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
7964
7990
|
}
|
|
7965
7991
|
this.out.write(erase2.line + cursor2.to(0) + this.outputText + cursor2.save + this.outputError + cursor2.restore);
|
|
7966
7992
|
}
|
|
@@ -8018,7 +8044,8 @@ var require_multiselect2 = __commonJS((exports, module) => {
|
|
|
8018
8044
|
this.done = this.aborted = true;
|
|
8019
8045
|
this.fire();
|
|
8020
8046
|
this.render();
|
|
8021
|
-
this.out.write(
|
|
8047
|
+
this.out.write(`
|
|
8048
|
+
`);
|
|
8022
8049
|
this.close();
|
|
8023
8050
|
}
|
|
8024
8051
|
submit() {
|
|
@@ -8031,7 +8058,8 @@ var require_multiselect2 = __commonJS((exports, module) => {
|
|
|
8031
8058
|
this.aborted = false;
|
|
8032
8059
|
this.fire();
|
|
8033
8060
|
this.render();
|
|
8034
|
-
this.out.write(
|
|
8061
|
+
this.out.write(`
|
|
8062
|
+
`);
|
|
8035
8063
|
this.close();
|
|
8036
8064
|
}
|
|
8037
8065
|
}
|
|
@@ -8107,7 +8135,12 @@ var require_multiselect2 = __commonJS((exports, module) => {
|
|
|
8107
8135
|
if (typeof this.instructions === "string") {
|
|
8108
8136
|
return this.instructions;
|
|
8109
8137
|
}
|
|
8110
|
-
return
|
|
8138
|
+
return `
|
|
8139
|
+
Instructions:
|
|
8140
|
+
` + ` ${figures.arrowUp}/${figures.arrowDown}: Highlight option
|
|
8141
|
+
` + ` ${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
|
|
8142
|
+
` + (this.maxChoices === undefined ? ` a: Toggle all
|
|
8143
|
+
` : "") + ` enter/return: Complete answer`;
|
|
8111
8144
|
}
|
|
8112
8145
|
return "";
|
|
8113
8146
|
}
|
|
@@ -8121,7 +8154,8 @@ var require_multiselect2 = __commonJS((exports, module) => {
|
|
|
8121
8154
|
if (cursor3 === i && v2.description) {
|
|
8122
8155
|
desc = ` - ${v2.description}`;
|
|
8123
8156
|
if (prefix.length + title.length + desc.length >= this.out.columns || v2.description.split(/\r?\n/).length > 1) {
|
|
8124
|
-
desc =
|
|
8157
|
+
desc = `
|
|
8158
|
+
` + wrap(v2.description, { margin: prefix.length, width: this.out.columns });
|
|
8125
8159
|
}
|
|
8126
8160
|
}
|
|
8127
8161
|
}
|
|
@@ -8143,7 +8177,9 @@ var require_multiselect2 = __commonJS((exports, module) => {
|
|
|
8143
8177
|
}
|
|
8144
8178
|
styledOptions.push(this.renderOption(this.cursor, options[i], i, prefix));
|
|
8145
8179
|
}
|
|
8146
|
-
return
|
|
8180
|
+
return `
|
|
8181
|
+
` + styledOptions.join(`
|
|
8182
|
+
`);
|
|
8147
8183
|
}
|
|
8148
8184
|
renderOptions(options) {
|
|
8149
8185
|
if (!this.done) {
|
|
@@ -8265,7 +8301,8 @@ var require_autocomplete2 = __commonJS((exports, module) => {
|
|
|
8265
8301
|
this.aborted = false;
|
|
8266
8302
|
this.fire();
|
|
8267
8303
|
this.render();
|
|
8268
|
-
this.out.write(
|
|
8304
|
+
this.out.write(`
|
|
8305
|
+
`);
|
|
8269
8306
|
this.close();
|
|
8270
8307
|
}
|
|
8271
8308
|
}
|
|
@@ -8274,7 +8311,8 @@ var require_autocomplete2 = __commonJS((exports, module) => {
|
|
|
8274
8311
|
this.exited = false;
|
|
8275
8312
|
this.fire();
|
|
8276
8313
|
this.render();
|
|
8277
|
-
this.out.write(
|
|
8314
|
+
this.out.write(`
|
|
8315
|
+
`);
|
|
8278
8316
|
this.close();
|
|
8279
8317
|
}
|
|
8280
8318
|
submit() {
|
|
@@ -8282,7 +8320,8 @@ var require_autocomplete2 = __commonJS((exports, module) => {
|
|
|
8282
8320
|
this.aborted = this.exited = false;
|
|
8283
8321
|
this.fire();
|
|
8284
8322
|
this.render();
|
|
8285
|
-
this.out.write(
|
|
8323
|
+
this.out.write(`
|
|
8324
|
+
`);
|
|
8286
8325
|
this.close();
|
|
8287
8326
|
}
|
|
8288
8327
|
_(c2, key) {
|
|
@@ -8371,7 +8410,8 @@ var require_autocomplete2 = __commonJS((exports, module) => {
|
|
|
8371
8410
|
if (v2.description) {
|
|
8372
8411
|
desc = ` - ${v2.description}`;
|
|
8373
8412
|
if (prefix.length + title.length + desc.length >= this.out.columns || v2.description.split(/\r?\n/).length > 1) {
|
|
8374
|
-
desc =
|
|
8413
|
+
desc = `
|
|
8414
|
+
` + wrap(v2.description, { margin: 3, width: this.out.columns });
|
|
8375
8415
|
}
|
|
8376
8416
|
}
|
|
8377
8417
|
return prefix + " " + title + color.gray(desc || "");
|
|
@@ -8392,8 +8432,10 @@ var require_autocomplete2 = __commonJS((exports, module) => {
|
|
|
8392
8432
|
this.done && this.suggestions[this.select] ? this.suggestions[this.select].title : this.rendered = this.transform.render(this.input)
|
|
8393
8433
|
].join(" ");
|
|
8394
8434
|
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
|
-
|
|
8435
|
+
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(`
|
|
8436
|
+
`);
|
|
8437
|
+
this.outputText += `
|
|
8438
|
+
` + (suggestions || color.gray(this.fallback.title));
|
|
8397
8439
|
}
|
|
8398
8440
|
this.out.write(erase2.line + cursor2.to(0) + this.outputText);
|
|
8399
8441
|
}
|
|
@@ -8517,7 +8559,8 @@ Instructions:
|
|
|
8517
8559
|
}
|
|
8518
8560
|
renderCurrentInput() {
|
|
8519
8561
|
return `
|
|
8520
|
-
Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
|
|
8562
|
+
Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
|
|
8563
|
+
`;
|
|
8521
8564
|
}
|
|
8522
8565
|
renderOption(cursor3, v2, i) {
|
|
8523
8566
|
let title;
|
|
@@ -8590,7 +8633,8 @@ var require_confirm2 = __commonJS((exports, module) => {
|
|
|
8590
8633
|
this.done = this.aborted = true;
|
|
8591
8634
|
this.fire();
|
|
8592
8635
|
this.render();
|
|
8593
|
-
this.out.write(
|
|
8636
|
+
this.out.write(`
|
|
8637
|
+
`);
|
|
8594
8638
|
this.close();
|
|
8595
8639
|
}
|
|
8596
8640
|
submit() {
|
|
@@ -8599,7 +8643,8 @@ var require_confirm2 = __commonJS((exports, module) => {
|
|
|
8599
8643
|
this.aborted = false;
|
|
8600
8644
|
this.fire();
|
|
8601
8645
|
this.render();
|
|
8602
|
-
this.out.write(
|
|
8646
|
+
this.out.write(`
|
|
8647
|
+
`);
|
|
8603
8648
|
this.close();
|
|
8604
8649
|
}
|
|
8605
8650
|
_(c2, key) {
|
|
@@ -10622,7 +10667,7 @@ var ut = l((qe, P2) => {
|
|
|
10622
10667
|
return t = t.replace(C, "^$1"), t;
|
|
10623
10668
|
}
|
|
10624
10669
|
function Jt(t, e) {
|
|
10625
|
-
return t = `${t}`, t = t.replace(/(\\*)"/g,
|
|
10670
|
+
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
10671
|
}
|
|
10627
10672
|
P2.exports.command = Vt;
|
|
10628
10673
|
P2.exports.argument = Jt;
|
|
@@ -10947,10 +10992,10 @@ class CACError extends Error {
|
|
|
10947
10992
|
}
|
|
10948
10993
|
|
|
10949
10994
|
class Option {
|
|
10950
|
-
constructor(rawName, description,
|
|
10995
|
+
constructor(rawName, description, config) {
|
|
10951
10996
|
this.rawName = rawName;
|
|
10952
10997
|
this.description = description;
|
|
10953
|
-
this.config = Object.assign({},
|
|
10998
|
+
this.config = Object.assign({}, config);
|
|
10954
10999
|
rawName = rawName.replace(/\.\*/g, "");
|
|
10955
11000
|
this.negated = false;
|
|
10956
11001
|
this.names = removeBrackets(rawName).split(",").map((v2) => {
|
|
@@ -10978,10 +11023,10 @@ var processArgs = process.argv;
|
|
|
10978
11023
|
var platformInfo = `${process.platform}-${process.arch} node-${process.version}`;
|
|
10979
11024
|
|
|
10980
11025
|
class Command {
|
|
10981
|
-
constructor(rawName, description,
|
|
11026
|
+
constructor(rawName, description, config = {}, cli) {
|
|
10982
11027
|
this.rawName = rawName;
|
|
10983
11028
|
this.description = description;
|
|
10984
|
-
this.config =
|
|
11029
|
+
this.config = config;
|
|
10985
11030
|
this.cli = cli;
|
|
10986
11031
|
this.options = [];
|
|
10987
11032
|
this.aliasNames = [];
|
|
@@ -11010,8 +11055,8 @@ class Command {
|
|
|
11010
11055
|
this.examples.push(example);
|
|
11011
11056
|
return this;
|
|
11012
11057
|
}
|
|
11013
|
-
option(rawName, description,
|
|
11014
|
-
const option = new Option(rawName, description,
|
|
11058
|
+
option(rawName, description, config) {
|
|
11059
|
+
const option = new Option(rawName, description, config);
|
|
11015
11060
|
this.options.push(option);
|
|
11016
11061
|
return this;
|
|
11017
11062
|
}
|
|
@@ -11061,11 +11106,13 @@ class Command {
|
|
|
11061
11106
|
title: "Commands",
|
|
11062
11107
|
body: commands.map((command) => {
|
|
11063
11108
|
return ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`;
|
|
11064
|
-
}).join(
|
|
11109
|
+
}).join(`
|
|
11110
|
+
`)
|
|
11065
11111
|
});
|
|
11066
11112
|
sections.push({
|
|
11067
11113
|
title: `For more info, run any command with the \`--help\` flag`,
|
|
11068
|
-
body: commands.map((command) => ` $ ${name}${command.name === "" ? "" : ` ${command.name}`} --help`).join(
|
|
11114
|
+
body: commands.map((command) => ` $ ${name}${command.name === "" ? "" : ` ${command.name}`} --help`).join(`
|
|
11115
|
+
`)
|
|
11069
11116
|
});
|
|
11070
11117
|
}
|
|
11071
11118
|
let options = this.isGlobalCommand ? globalOptions : [...this.options, ...globalOptions || []];
|
|
@@ -11078,7 +11125,8 @@ class Command {
|
|
|
11078
11125
|
title: "Options",
|
|
11079
11126
|
body: options.map((option) => {
|
|
11080
11127
|
return ` ${padRight(option.rawName, longestOptionName.length)} ${option.description} ${option.config.default === undefined ? "" : `(default: ${option.config.default})`}`;
|
|
11081
|
-
}).join(
|
|
11128
|
+
}).join(`
|
|
11129
|
+
`)
|
|
11082
11130
|
});
|
|
11083
11131
|
}
|
|
11084
11132
|
if (this.examples.length > 0) {
|
|
@@ -11089,7 +11137,8 @@ class Command {
|
|
|
11089
11137
|
return example(name);
|
|
11090
11138
|
}
|
|
11091
11139
|
return example;
|
|
11092
|
-
}).join(
|
|
11140
|
+
}).join(`
|
|
11141
|
+
`)
|
|
11093
11142
|
});
|
|
11094
11143
|
}
|
|
11095
11144
|
if (helpCallback) {
|
|
@@ -11098,7 +11147,9 @@ class Command {
|
|
|
11098
11147
|
console.log(sections.map((section) => {
|
|
11099
11148
|
return section.title ? `${section.title}:
|
|
11100
11149
|
${section.body}` : section.body;
|
|
11101
|
-
}).join(
|
|
11150
|
+
}).join(`
|
|
11151
|
+
|
|
11152
|
+
`));
|
|
11102
11153
|
}
|
|
11103
11154
|
outputVersion() {
|
|
11104
11155
|
const { name } = this.cli;
|
|
@@ -11160,14 +11211,14 @@ class CAC extends EventEmitter {
|
|
|
11160
11211
|
this.globalCommand.usage(text2);
|
|
11161
11212
|
return this;
|
|
11162
11213
|
}
|
|
11163
|
-
command(rawName, description,
|
|
11164
|
-
const command = new Command(rawName, description || "",
|
|
11214
|
+
command(rawName, description, config) {
|
|
11215
|
+
const command = new Command(rawName, description || "", config, this);
|
|
11165
11216
|
command.globalCommand = this.globalCommand;
|
|
11166
11217
|
this.commands.push(command);
|
|
11167
11218
|
return command;
|
|
11168
11219
|
}
|
|
11169
|
-
option(rawName, description,
|
|
11170
|
-
this.globalCommand.option(rawName, description,
|
|
11220
|
+
option(rawName, description, config) {
|
|
11221
|
+
this.globalCommand.option(rawName, description, config);
|
|
11171
11222
|
return this;
|
|
11172
11223
|
}
|
|
11173
11224
|
help(callback) {
|
|
@@ -11399,7 +11450,7 @@ var TITLE_TERMINATORS = new Set([
|
|
|
11399
11450
|
...SENTENCE_TERMINATORS,
|
|
11400
11451
|
":",
|
|
11401
11452
|
'"',
|
|
11402
|
-
"
|
|
11453
|
+
"'",
|
|
11403
11454
|
"\u201D"
|
|
11404
11455
|
]);
|
|
11405
11456
|
var SMALL_WORDS = new Set([
|
|
@@ -11841,7 +11892,7 @@ function projectPath(filePath = "", options) {
|
|
|
11841
11892
|
function storagePath(path2) {
|
|
11842
11893
|
return projectPath(`storage/${path2 || ""}`);
|
|
11843
11894
|
}
|
|
11844
|
-
var
|
|
11895
|
+
var config = {
|
|
11845
11896
|
ai: {
|
|
11846
11897
|
deploy: false,
|
|
11847
11898
|
models: [
|
|
@@ -12096,12 +12147,16 @@ var config2 = {
|
|
|
12096
12147
|
type: "Select the type of change that you\u2019re committing:",
|
|
12097
12148
|
scope: "Select the SCOPE of this change (optional):",
|
|
12098
12149
|
customScope: "Select the SCOPE of this change:",
|
|
12099
|
-
subject:
|
|
12100
|
-
|
|
12101
|
-
|
|
12150
|
+
subject: `Write a SHORT, IMPERATIVE tense description of the change:
|
|
12151
|
+
`,
|
|
12152
|
+
body: `Provide a LONGER description of the change (optional). Use "|" to break new line:
|
|
12153
|
+
`,
|
|
12154
|
+
breaking: `List any BREAKING CHANGES (optional). Use "|" to break new line:
|
|
12155
|
+
`,
|
|
12102
12156
|
footerPrefixesSelect: "Select the ISSUES type of the change list by this change (optional):",
|
|
12103
12157
|
customFooterPrefixes: "Input ISSUES prefix:",
|
|
12104
|
-
footer:
|
|
12158
|
+
footer: `List any ISSUES by this change. E.g.: #31, #34:
|
|
12159
|
+
`,
|
|
12105
12160
|
confirmCommit: "Are you sure you want to proceed with the commit above?"
|
|
12106
12161
|
},
|
|
12107
12162
|
types: [
|
|
@@ -12414,7 +12469,7 @@ var config2 = {
|
|
|
12414
12469
|
}
|
|
12415
12470
|
}
|
|
12416
12471
|
};
|
|
12417
|
-
var defaults_default =
|
|
12472
|
+
var defaults_default = config;
|
|
12418
12473
|
var ai_default = {
|
|
12419
12474
|
default: "meta.llama2-70b-chat-v1",
|
|
12420
12475
|
models: [
|
|
@@ -13128,7 +13183,8 @@ var import_escape = __toESM2(require_escape(), 1);
|
|
|
13128
13183
|
var import_normalizeEmail = __toESM2(require_normalizeEmail(), 1);
|
|
13129
13184
|
var CompilerBuffer = class _CompilerBuffer {
|
|
13130
13185
|
#content = "";
|
|
13131
|
-
newLine =
|
|
13186
|
+
newLine = `
|
|
13187
|
+
`;
|
|
13132
13188
|
writeStatement(statement) {
|
|
13133
13189
|
this.#content = `${this.#content}${this.newLine}${statement}`;
|
|
13134
13190
|
}
|
|
@@ -13266,7 +13322,8 @@ function defineFieldValidations({
|
|
|
13266
13322
|
variableName,
|
|
13267
13323
|
dropMissingCheck
|
|
13268
13324
|
}) {
|
|
13269
|
-
return `${validations.map((one) => emitValidationSnippet(one, variableName, bail, dropMissingCheck)).join(
|
|
13325
|
+
return `${validations.map((one) => emitValidationSnippet(one, variableName, bail, dropMissingCheck)).join(`
|
|
13326
|
+
`)}`;
|
|
13270
13327
|
}
|
|
13271
13328
|
function defineArrayInitialOutput({
|
|
13272
13329
|
variableName,
|
|
@@ -16379,12 +16436,16 @@ var git_default = {
|
|
|
16379
16436
|
type: "Select the type of change that you\u2019re committing:",
|
|
16380
16437
|
scope: "Select the SCOPE of this change (optional):",
|
|
16381
16438
|
customScope: "Select the SCOPE of this change:",
|
|
16382
|
-
subject:
|
|
16383
|
-
|
|
16384
|
-
|
|
16439
|
+
subject: `Write a SHORT, IMPERATIVE tense description of the change:
|
|
16440
|
+
`,
|
|
16441
|
+
body: `Provide a LONGER description of the change (optional). Use "|" to break new line:
|
|
16442
|
+
`,
|
|
16443
|
+
breaking: `List any BREAKING CHANGES (optional). Use "|" to break new line:
|
|
16444
|
+
`,
|
|
16385
16445
|
footerPrefixesSelect: "Select the ISSUES type of the change list by this change (optional):",
|
|
16386
16446
|
customFooterPrefixes: "Input ISSUES prefix:",
|
|
16387
|
-
footer:
|
|
16447
|
+
footer: `List any ISSUES by this change. E.g.: #31, #34:
|
|
16448
|
+
`,
|
|
16388
16449
|
confirmCommit: "Are you sure you want to proceed with the commit above?"
|
|
16389
16450
|
},
|
|
16390
16451
|
types: [
|
|
@@ -16693,7 +16754,7 @@ var ui_default = {
|
|
|
16693
16754
|
}
|
|
16694
16755
|
}
|
|
16695
16756
|
};
|
|
16696
|
-
var
|
|
16757
|
+
var config2 = {
|
|
16697
16758
|
ai: ai_default,
|
|
16698
16759
|
analytics: analytics_default,
|
|
16699
16760
|
app: app_default,
|
|
@@ -16720,7 +16781,7 @@ var config22 = {
|
|
|
16720
16781
|
team: team_default,
|
|
16721
16782
|
ui: ui_default
|
|
16722
16783
|
};
|
|
16723
|
-
var overrides_default =
|
|
16784
|
+
var overrides_default = config2;
|
|
16724
16785
|
async function localTunnel(options) {
|
|
16725
16786
|
const port = 3000;
|
|
16726
16787
|
if (!options?.port)
|
|
@@ -16924,7 +16985,7 @@ function determineAppEnv() {
|
|
|
16924
16985
|
if (app2.env === "production")
|
|
16925
16986
|
return "prod";
|
|
16926
16987
|
if (!app2.env)
|
|
16927
|
-
throw new Error("Couldn
|
|
16988
|
+
throw new Error("Couldn't determine app environment");
|
|
16928
16989
|
return app2.env;
|
|
16929
16990
|
}
|
|
16930
16991
|
|
|
@@ -16961,7 +17022,8 @@ class ErrorHandler {
|
|
|
16961
17022
|
console.error("Error is not an instance of Error:", err);
|
|
16962
17023
|
return;
|
|
16963
17024
|
}
|
|
16964
|
-
const formattedError = `[${new Date().toISOString()}] ${err.name}: ${err.message}
|
|
17025
|
+
const formattedError = `[${new Date().toISOString()}] ${err.name}: ${err.message}
|
|
17026
|
+
`;
|
|
16965
17027
|
const logFilePath = logsPath("stacks.log") ?? logsPath("errors.log");
|
|
16966
17028
|
try {
|
|
16967
17029
|
await mkdir(dirname(logFilePath), { recursive: true });
|
|
@@ -16999,7 +17061,8 @@ function handleError(err, options) {
|
|
|
16999
17061
|
return ErrorHandler.handle(err, options);
|
|
17000
17062
|
}
|
|
17001
17063
|
async function writeToLogFile(message, options) {
|
|
17002
|
-
const formattedMessage = `[${new Date().toISOString()}] ${message}
|
|
17064
|
+
const formattedMessage = `[${new Date().toISOString()}] ${message}
|
|
17065
|
+
`;
|
|
17003
17066
|
try {
|
|
17004
17067
|
const logFile = options?.logFile ?? exports_config.logging.logsPath ?? "storage/logs/stacks.log";
|
|
17005
17068
|
try {
|
|
@@ -17866,7 +17929,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
17866
17929
|
return min;
|
|
17867
17930
|
}
|
|
17868
17931
|
if (process11.platform === "win32") {
|
|
17869
|
-
const osRelease =
|
|
17932
|
+
const osRelease = os.release().split(".");
|
|
17870
17933
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
17871
17934
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
17872
17935
|
}
|
|
@@ -17945,9 +18008,12 @@ function stringEncaseCRLFWithFirstIndex(string2, prefix, postfix, index) {
|
|
|
17945
18008
|
let returnValue = "";
|
|
17946
18009
|
do {
|
|
17947
18010
|
const gotCR = string2[index - 1] === "\r";
|
|
17948
|
-
returnValue += string2.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ?
|
|
18011
|
+
returnValue += string2.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? `\r
|
|
18012
|
+
` : `
|
|
18013
|
+
`) + postfix;
|
|
17949
18014
|
endIndex = index + 1;
|
|
17950
|
-
index = string2.indexOf(
|
|
18015
|
+
index = string2.indexOf(`
|
|
18016
|
+
`, endIndex);
|
|
17951
18017
|
} while (index !== -1);
|
|
17952
18018
|
returnValue += string2.slice(endIndex);
|
|
17953
18019
|
return returnValue;
|
|
@@ -18087,7 +18153,8 @@ var applyStyle = (self2, string2) => {
|
|
|
18087
18153
|
styler = styler.parent;
|
|
18088
18154
|
}
|
|
18089
18155
|
}
|
|
18090
|
-
const lfIndex = string2.indexOf(
|
|
18156
|
+
const lfIndex = string2.indexOf(`
|
|
18157
|
+
`);
|
|
18091
18158
|
if (lfIndex !== -1) {
|
|
18092
18159
|
string2 = stringEncaseCRLFWithFirstIndex(string2, closeAll, openAll, lfIndex);
|
|
18093
18160
|
}
|
|
@@ -18121,7 +18188,8 @@ var changePrototype = (to, from) => {
|
|
|
18121
18188
|
}
|
|
18122
18189
|
Object.setPrototypeOf(to, fromPrototype);
|
|
18123
18190
|
};
|
|
18124
|
-
var wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}
|
|
18191
|
+
var wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
|
|
18192
|
+
${fromBody}`;
|
|
18125
18193
|
var toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
|
|
18126
18194
|
var toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
|
|
18127
18195
|
var changeToString = (to, from, name) => {
|
|
@@ -18722,7 +18790,8 @@ class Ora {
|
|
|
18722
18790
|
const fullSuffixText = this.#getFullSuffixText(this.#suffixText, "-");
|
|
18723
18791
|
const fullText = " ".repeat(this.#indent) + fullPrefixText + "--" + this.#text + "--" + fullSuffixText;
|
|
18724
18792
|
this.#lineCount = 0;
|
|
18725
|
-
for (const line of stripAnsi3(fullText).split(
|
|
18793
|
+
for (const line of stripAnsi3(fullText).split(`
|
|
18794
|
+
`)) {
|
|
18726
18795
|
this.#lineCount += Math.max(1, Math.ceil(stringWidth2(line, { countAnsiEscapeCodes: true }) / columns));
|
|
18727
18796
|
}
|
|
18728
18797
|
}
|
|
@@ -18792,7 +18861,8 @@ class Ora {
|
|
|
18792
18861
|
}
|
|
18793
18862
|
if (!this.#isEnabled) {
|
|
18794
18863
|
if (this.text) {
|
|
18795
|
-
this.#stream.write(`- ${this.text}
|
|
18864
|
+
this.#stream.write(`- ${this.text}
|
|
18865
|
+
`);
|
|
18796
18866
|
}
|
|
18797
18867
|
return this;
|
|
18798
18868
|
}
|
|
@@ -18850,7 +18920,8 @@ class Ora {
|
|
|
18850
18920
|
const fullText = typeof text2 === "string" ? " " + text2 : "";
|
|
18851
18921
|
const suffixText = options2.suffixText ?? this.#suffixText;
|
|
18852
18922
|
const fullSuffixText = this.#getFullSuffixText(suffixText, " ");
|
|
18853
|
-
const textToWrite = fullPrefixText + symbolText + fullText + fullSuffixText +
|
|
18923
|
+
const textToWrite = fullPrefixText + symbolText + fullText + fullSuffixText + `
|
|
18924
|
+
`;
|
|
18854
18925
|
this.stop();
|
|
18855
18926
|
this.#stream.write(textToWrite);
|
|
18856
18927
|
return this;
|
|
@@ -18874,7 +18945,7 @@ function deleteKeys(obj, ...keys) {
|
|
|
18874
18945
|
});
|
|
18875
18946
|
}
|
|
18876
18947
|
var isArray = (item) => Array.isArray(item);
|
|
18877
|
-
function
|
|
18948
|
+
function isObject2(item) {
|
|
18878
18949
|
return typeof item === "object" && !Array.isArray(item) && item !== null;
|
|
18879
18950
|
}
|
|
18880
18951
|
var isFunction = (item) => typeof item === "function";
|
|
@@ -19655,7 +19726,7 @@ class Collection {
|
|
|
19655
19726
|
}
|
|
19656
19727
|
return new this.constructor(this.items.splice(-count));
|
|
19657
19728
|
}
|
|
19658
|
-
if (
|
|
19729
|
+
if (isObject2(this.items)) {
|
|
19659
19730
|
const keys = Object.keys(this.items);
|
|
19660
19731
|
if (count === 1) {
|
|
19661
19732
|
const key = keys[keys.length - 1];
|
|
@@ -19800,7 +19871,7 @@ class Collection {
|
|
|
19800
19871
|
};
|
|
19801
19872
|
if (isArray(this.items)) {
|
|
19802
19873
|
result = this.items.findIndex(find);
|
|
19803
|
-
} else if (
|
|
19874
|
+
} else if (isObject2(this.items)) {
|
|
19804
19875
|
result = Object.keys(this.items).find((key) => find(this.items[key], key));
|
|
19805
19876
|
}
|
|
19806
19877
|
if (result === undefined || result < 0) {
|
|
@@ -19818,7 +19889,7 @@ class Collection {
|
|
|
19818
19889
|
}
|
|
19819
19890
|
return new this.constructor(this.items.splice(0, count));
|
|
19820
19891
|
}
|
|
19821
|
-
if (
|
|
19892
|
+
if (isObject2(this.items)) {
|
|
19822
19893
|
if (count === 1) {
|
|
19823
19894
|
const key = Object.keys(this.items)[0];
|
|
19824
19895
|
const value = this.items[key];
|
|
@@ -19851,7 +19922,7 @@ class Collection {
|
|
|
19851
19922
|
return this;
|
|
19852
19923
|
}
|
|
19853
19924
|
skip(number) {
|
|
19854
|
-
if (
|
|
19925
|
+
if (isObject2(this.items)) {
|
|
19855
19926
|
return new this.constructor(Object.keys(this.items).reduce((accumulator, key, index) => {
|
|
19856
19927
|
if (index + 1 > number) {
|
|
19857
19928
|
accumulator[key] = this.items[key];
|
|
@@ -19876,7 +19947,7 @@ class Collection {
|
|
|
19876
19947
|
return previous;
|
|
19877
19948
|
});
|
|
19878
19949
|
}
|
|
19879
|
-
if (
|
|
19950
|
+
if (isObject2(this.items)) {
|
|
19880
19951
|
items = Object.keys(this.items).reduce((acc, key) => {
|
|
19881
19952
|
if (previous !== true) {
|
|
19882
19953
|
previous = callback(this.items[key]);
|
|
@@ -19904,7 +19975,7 @@ class Collection {
|
|
|
19904
19975
|
return previous;
|
|
19905
19976
|
});
|
|
19906
19977
|
}
|
|
19907
|
-
if (
|
|
19978
|
+
if (isObject2(this.items)) {
|
|
19908
19979
|
items = Object.keys(this.items).reduce((acc, key) => {
|
|
19909
19980
|
if (previous !== true) {
|
|
19910
19981
|
previous = !callback(this.items[key]);
|
|
@@ -20067,7 +20138,7 @@ class Collection {
|
|
|
20067
20138
|
return previous;
|
|
20068
20139
|
});
|
|
20069
20140
|
}
|
|
20070
|
-
if (
|
|
20141
|
+
if (isObject2(this.items)) {
|
|
20071
20142
|
items = Object.keys(this.items).reduce((acc, key) => {
|
|
20072
20143
|
if (previous !== false) {
|
|
20073
20144
|
previous = !callback(this.items[key]);
|
|
@@ -20095,7 +20166,7 @@ class Collection {
|
|
|
20095
20166
|
return previous;
|
|
20096
20167
|
});
|
|
20097
20168
|
}
|
|
20098
|
-
if (
|
|
20169
|
+
if (isObject2(this.items)) {
|
|
20099
20170
|
items = Object.keys(this.items).reduce((acc, key) => {
|
|
20100
20171
|
if (previous !== false) {
|
|
20101
20172
|
previous = callback(this.items[key]);
|
|
@@ -20350,7 +20421,7 @@ var buildKeyPathMap = function buildKeyPathMap2(items) {
|
|
|
20350
20421
|
const keyPaths = {};
|
|
20351
20422
|
items.forEach((item, index) => {
|
|
20352
20423
|
function buildKeyPath(val, keyPath) {
|
|
20353
|
-
if (
|
|
20424
|
+
if (isObject2(val)) {
|
|
20354
20425
|
Object.keys(val).forEach((prop) => {
|
|
20355
20426
|
buildKeyPath(val[prop], `${keyPath}.${prop}`);
|
|
20356
20427
|
});
|
|
@@ -20396,183 +20467,18 @@ var quotes = collect([
|
|
|
20396
20467
|
"Security is mostly a superstition. Life is either a daring adventure or nothing."
|
|
20397
20468
|
]);
|
|
20398
20469
|
var export_prompts = import_prompts.default;
|
|
20399
|
-
|
|
20400
|
-
|
|
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
|
-
}
|
|
20470
|
+
// package.json
|
|
20471
|
+
var version = "0.4.1";
|
|
20423
20472
|
|
|
20424
20473
|
// src/hosts.ts
|
|
20425
|
-
|
|
20426
|
-
|
|
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
|
-
// src/https.ts
|
|
20474
|
+
import { spawn } from "child_process";
|
|
20475
|
+
import fs3 from "fs";
|
|
20575
20476
|
import os7 from "os";
|
|
20477
|
+
import path7 from "path";
|
|
20478
|
+
import process9 from "process";
|
|
20479
|
+
|
|
20480
|
+
// src/https.ts
|
|
20481
|
+
import os5 from "os";
|
|
20576
20482
|
import path6 from "path";
|
|
20577
20483
|
|
|
20578
20484
|
// node_modules/@stacksjs/tlsx/dist/index.js
|
|
@@ -20597,7 +20503,7 @@ import {
|
|
|
20597
20503
|
dirname as dirname3,
|
|
20598
20504
|
extname as extname2,
|
|
20599
20505
|
isAbsolute as isAbsolute2,
|
|
20600
|
-
join as
|
|
20506
|
+
join as join2,
|
|
20601
20507
|
normalize as normalize2,
|
|
20602
20508
|
parse as parse2,
|
|
20603
20509
|
relative as relative2,
|
|
@@ -20612,7 +20518,7 @@ import process8 from "process";
|
|
|
20612
20518
|
import process102 from "process";
|
|
20613
20519
|
import process182 from "process";
|
|
20614
20520
|
import process112 from "process";
|
|
20615
|
-
import
|
|
20521
|
+
import os2 from "os";
|
|
20616
20522
|
import tty32 from "tty";
|
|
20617
20523
|
import process142 from "process";
|
|
20618
20524
|
import process132 from "process";
|
|
@@ -20621,11 +20527,11 @@ import process162 from "process";
|
|
|
20621
20527
|
import process172 from "process";
|
|
20622
20528
|
import process192 from "process";
|
|
20623
20529
|
import os22 from "os";
|
|
20624
|
-
import
|
|
20625
|
-
import { resolve
|
|
20626
|
-
import
|
|
20627
|
-
import
|
|
20628
|
-
import
|
|
20530
|
+
import path from "path";
|
|
20531
|
+
import { resolve } from "path";
|
|
20532
|
+
import process2 from "process";
|
|
20533
|
+
import fs from "fs";
|
|
20534
|
+
import path2 from "path";
|
|
20629
20535
|
var __create3 = Object.create;
|
|
20630
20536
|
var __getProtoOf3 = Object.getPrototypeOf;
|
|
20631
20537
|
var __defProp3 = Object.defineProperty;
|
|
@@ -20689,7 +20595,8 @@ var require_baseN = __commonJS2((exports, module) => {
|
|
|
20689
20595
|
}
|
|
20690
20596
|
if (maxline) {
|
|
20691
20597
|
var regex3 = new RegExp(".{1," + maxline + "}", "g");
|
|
20692
|
-
output = output.match(regex3).join(
|
|
20598
|
+
output = output.match(regex3).join(`\r
|
|
20599
|
+
`);
|
|
20693
20600
|
}
|
|
20694
20601
|
return output;
|
|
20695
20602
|
};
|
|
@@ -21546,7 +21453,8 @@ var require_util3 = __commonJS2((exports, module) => {
|
|
|
21546
21453
|
line += isNaN(chr3) ? "=" : _base64.charAt(chr3 & 63);
|
|
21547
21454
|
}
|
|
21548
21455
|
if (maxline && line.length > maxline) {
|
|
21549
|
-
output += line.substr(0, maxline) +
|
|
21456
|
+
output += line.substr(0, maxline) + `\r
|
|
21457
|
+
`;
|
|
21550
21458
|
line = line.substr(maxline);
|
|
21551
21459
|
}
|
|
21552
21460
|
}
|
|
@@ -21639,7 +21547,8 @@ var require_util3 = __commonJS2((exports, module) => {
|
|
|
21639
21547
|
line += isNaN(chr3) ? "=" : _base64.charAt(chr3 & 63);
|
|
21640
21548
|
}
|
|
21641
21549
|
if (maxline && line.length > maxline) {
|
|
21642
|
-
output += line.substr(0, maxline) +
|
|
21550
|
+
output += line.substr(0, maxline) + `\r
|
|
21551
|
+
`;
|
|
21643
21552
|
line = line.substr(maxline);
|
|
21644
21553
|
}
|
|
21645
21554
|
}
|
|
@@ -23843,7 +23752,8 @@ var require_asn1 = __commonJS2((exports, module) => {
|
|
|
23843
23752
|
level = level || 0;
|
|
23844
23753
|
indentation = indentation || 2;
|
|
23845
23754
|
if (level > 0) {
|
|
23846
|
-
rval +=
|
|
23755
|
+
rval += `
|
|
23756
|
+
`;
|
|
23847
23757
|
}
|
|
23848
23758
|
var indent = "";
|
|
23849
23759
|
for (var i = 0;i < level * indentation; ++i) {
|
|
@@ -23934,8 +23844,10 @@ var require_asn1 = __commonJS2((exports, module) => {
|
|
|
23934
23844
|
} else {
|
|
23935
23845
|
rval += obj.type;
|
|
23936
23846
|
}
|
|
23937
|
-
rval +=
|
|
23938
|
-
|
|
23847
|
+
rval += `
|
|
23848
|
+
`;
|
|
23849
|
+
rval += indent + "Constructed: " + obj.constructed + `
|
|
23850
|
+
`;
|
|
23939
23851
|
if (obj.composed) {
|
|
23940
23852
|
var subvalues = 0;
|
|
23941
23853
|
var sub = "";
|
|
@@ -24382,7 +24294,8 @@ var require_pem = __commonJS2((exports, module) => {
|
|
|
24382
24294
|
var pem = module.exports = forge.pem = forge.pem || {};
|
|
24383
24295
|
pem.encode = function(msg, options2) {
|
|
24384
24296
|
options2 = options2 || {};
|
|
24385
|
-
var rval = "-----BEGIN " + msg.type +
|
|
24297
|
+
var rval = "-----BEGIN " + msg.type + `-----\r
|
|
24298
|
+
`;
|
|
24386
24299
|
var header;
|
|
24387
24300
|
if (msg.procType) {
|
|
24388
24301
|
header = {
|
|
@@ -24408,10 +24321,13 @@ var require_pem = __commonJS2((exports, module) => {
|
|
|
24408
24321
|
}
|
|
24409
24322
|
}
|
|
24410
24323
|
if (msg.procType) {
|
|
24411
|
-
rval +=
|
|
24324
|
+
rval += `\r
|
|
24325
|
+
`;
|
|
24412
24326
|
}
|
|
24413
|
-
rval += forge.util.encode64(msg.body, options2.maxline || 64) +
|
|
24414
|
-
|
|
24327
|
+
rval += forge.util.encode64(msg.body, options2.maxline || 64) + `\r
|
|
24328
|
+
`;
|
|
24329
|
+
rval += "-----END " + msg.type + `-----\r
|
|
24330
|
+
`;
|
|
24415
24331
|
return rval;
|
|
24416
24332
|
};
|
|
24417
24333
|
pem.decode = function(str) {
|
|
@@ -24498,7 +24414,8 @@ var require_pem = __commonJS2((exports, module) => {
|
|
|
24498
24414
|
for (var i = 0;i < header.values.length; ++i) {
|
|
24499
24415
|
values2.push(header.values[i].replace(/^(\S+\r\n)/, insertSpace));
|
|
24500
24416
|
}
|
|
24501
|
-
rval += values2.join(",") +
|
|
24417
|
+
rval += values2.join(",") + `\r
|
|
24418
|
+
`;
|
|
24502
24419
|
var length = 0;
|
|
24503
24420
|
var candidate = -1;
|
|
24504
24421
|
for (var i = 0;i < rval.length; ++i, ++length) {
|
|
@@ -24506,9 +24423,11 @@ var require_pem = __commonJS2((exports, module) => {
|
|
|
24506
24423
|
var insert = rval[candidate];
|
|
24507
24424
|
if (insert === ",") {
|
|
24508
24425
|
++candidate;
|
|
24509
|
-
rval = rval.substr(0, candidate) +
|
|
24426
|
+
rval = rval.substr(0, candidate) + `\r
|
|
24427
|
+
` + rval.substr(candidate);
|
|
24510
24428
|
} else {
|
|
24511
|
-
rval = rval.substr(0, candidate) +
|
|
24429
|
+
rval = rval.substr(0, candidate) + `\r
|
|
24430
|
+
` + insert + rval.substr(candidate + 1);
|
|
24512
24431
|
}
|
|
24513
24432
|
length = i - candidate - 1;
|
|
24514
24433
|
candidate = -1;
|
|
@@ -25941,13 +25860,13 @@ var require_jsbn = __commonJS2((exports, module) => {
|
|
|
25941
25860
|
var BI_RC = new Array;
|
|
25942
25861
|
var rr;
|
|
25943
25862
|
var vv;
|
|
25944
|
-
rr =
|
|
25863
|
+
rr = 48;
|
|
25945
25864
|
for (vv = 0;vv <= 9; ++vv)
|
|
25946
25865
|
BI_RC[rr++] = vv;
|
|
25947
|
-
rr =
|
|
25866
|
+
rr = 97;
|
|
25948
25867
|
for (vv = 10;vv < 36; ++vv)
|
|
25949
25868
|
BI_RC[rr++] = vv;
|
|
25950
|
-
rr =
|
|
25869
|
+
rr = 65;
|
|
25951
25870
|
for (vv = 10;vv < 36; ++vv)
|
|
25952
25871
|
BI_RC[rr++] = vv;
|
|
25953
25872
|
function int2char(n) {
|
|
@@ -27427,7 +27346,7 @@ var require_pkcs1 = __commonJS2((exports, module) => {
|
|
|
27427
27346
|
var PS = "";
|
|
27428
27347
|
var PS_length = maxLength - message.length;
|
|
27429
27348
|
for (var i = 0;i < PS_length; i++) {
|
|
27430
|
-
PS += "\
|
|
27349
|
+
PS += "\x00";
|
|
27431
27350
|
}
|
|
27432
27351
|
var DB = lHash.getBytes() + PS + "\x01" + message;
|
|
27433
27352
|
if (!seed) {
|
|
@@ -27442,7 +27361,7 @@ var require_pkcs1 = __commonJS2((exports, module) => {
|
|
|
27442
27361
|
var maskedDB = forge.util.xorBytes(DB, dbMask, DB.length);
|
|
27443
27362
|
var seedMask = rsa_mgf1(maskedDB, md.digestLength, mgf1Md);
|
|
27444
27363
|
var maskedSeed = forge.util.xorBytes(seed, seedMask, seed.length);
|
|
27445
|
-
return "\
|
|
27364
|
+
return "\x00" + maskedSeed + maskedDB;
|
|
27446
27365
|
};
|
|
27447
27366
|
pkcs1.decode_rsa_oaep = function(key, em, options2) {
|
|
27448
27367
|
var label;
|
|
@@ -27489,7 +27408,7 @@ var require_pkcs1 = __commonJS2((exports, module) => {
|
|
|
27489
27408
|
var dbMask = rsa_mgf1(seed, keyLength - md.digestLength - 1, mgf1Md);
|
|
27490
27409
|
var db = forge.util.xorBytes(maskedDB, dbMask, maskedDB.length);
|
|
27491
27410
|
var lHashPrime = db.substring(0, md.digestLength);
|
|
27492
|
-
var error = y !== "\
|
|
27411
|
+
var error = y !== "\x00";
|
|
27493
27412
|
for (var i = 0;i < md.digestLength; ++i) {
|
|
27494
27413
|
error |= lHash.charAt(i) !== lHashPrime.charAt(i);
|
|
27495
27414
|
}
|
|
@@ -30515,7 +30434,7 @@ var require_x509 = __commonJS2((exports, module) => {
|
|
|
30515
30434
|
if (!cert.issued(child)) {
|
|
30516
30435
|
var issuer = child.issuer;
|
|
30517
30436
|
var subject = cert.subject;
|
|
30518
|
-
var error = new Error("The parent certificate did not issue the given child " + "certificate; the child certificate
|
|
30437
|
+
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
30438
|
error.expectedIssuer = subject.attributes;
|
|
30520
30439
|
error.actualIssuer = issuer.attributes;
|
|
30521
30440
|
throw error;
|
|
@@ -31548,7 +31467,7 @@ var require_x509 = __commonJS2((exports, module) => {
|
|
|
31548
31467
|
if (keyUsageExt !== null) {
|
|
31549
31468
|
if (!keyUsageExt.keyCertSign || bcExt === null) {
|
|
31550
31469
|
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
|
|
31470
|
+
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
31471
|
error: pki.certificateError.bad_certificate
|
|
31553
31472
|
};
|
|
31554
31473
|
}
|
|
@@ -32674,14 +32593,14 @@ var require_tls = __commonJS2((exports, module) => {
|
|
|
32674
32593
|
c2.version = c2.session.version = session.version;
|
|
32675
32594
|
c2.session.sp = session.sp;
|
|
32676
32595
|
} else {
|
|
32677
|
-
var
|
|
32596
|
+
var version2;
|
|
32678
32597
|
for (var i = 1;i < tls.SupportedVersions.length; ++i) {
|
|
32679
|
-
|
|
32680
|
-
if (
|
|
32598
|
+
version2 = tls.SupportedVersions[i];
|
|
32599
|
+
if (version2.minor <= msg.version.minor) {
|
|
32681
32600
|
break;
|
|
32682
32601
|
}
|
|
32683
32602
|
}
|
|
32684
|
-
c2.version = { major:
|
|
32603
|
+
c2.version = { major: version2.major, minor: version2.minor };
|
|
32685
32604
|
c2.session.version = c2.version;
|
|
32686
32605
|
}
|
|
32687
32606
|
if (session !== null) {
|
|
@@ -32852,8 +32771,8 @@ var require_tls = __commonJS2((exports, module) => {
|
|
|
32852
32771
|
try {
|
|
32853
32772
|
var sp = c2.session.sp;
|
|
32854
32773
|
sp.pre_master_secret = privateKey.decrypt(msg.enc_pre_master_secret);
|
|
32855
|
-
var
|
|
32856
|
-
if (
|
|
32774
|
+
var version2 = c2.session.clientHelloVersion;
|
|
32775
|
+
if (version2.major !== sp.pre_master_secret.charCodeAt(0) || version2.minor !== sp.pre_master_secret.charCodeAt(1)) {
|
|
32857
32776
|
throw new Error("TLS version rollback attack detected.");
|
|
32858
32777
|
}
|
|
32859
32778
|
} catch (ex) {
|
|
@@ -36777,16 +36696,20 @@ var require_ssh = __commonJS2((exports, module) => {
|
|
|
36777
36696
|
passphrase = passphrase || "";
|
|
36778
36697
|
var algorithm = "ssh-rsa";
|
|
36779
36698
|
var encryptionAlgorithm = passphrase === "" ? "none" : "aes256-cbc";
|
|
36780
|
-
var ppk = "PuTTY-User-Key-File-2: " + algorithm +
|
|
36781
|
-
|
|
36782
|
-
ppk += "
|
|
36699
|
+
var ppk = "PuTTY-User-Key-File-2: " + algorithm + `\r
|
|
36700
|
+
`;
|
|
36701
|
+
ppk += "Encryption: " + encryptionAlgorithm + `\r
|
|
36702
|
+
`;
|
|
36703
|
+
ppk += "Comment: " + comment + `\r
|
|
36704
|
+
`;
|
|
36783
36705
|
var pubbuffer = forge.util.createBuffer();
|
|
36784
36706
|
_addStringToBuffer(pubbuffer, algorithm);
|
|
36785
36707
|
_addBigIntegerToBuffer(pubbuffer, privateKey.e);
|
|
36786
36708
|
_addBigIntegerToBuffer(pubbuffer, privateKey.n);
|
|
36787
36709
|
var pub = forge.util.encode64(pubbuffer.bytes(), 64);
|
|
36788
36710
|
var length = Math.floor(pub.length / 66) + 1;
|
|
36789
|
-
ppk += "Public-Lines: " + length +
|
|
36711
|
+
ppk += "Public-Lines: " + length + `\r
|
|
36712
|
+
`;
|
|
36790
36713
|
ppk += pub;
|
|
36791
36714
|
var privbuffer = forge.util.createBuffer();
|
|
36792
36715
|
_addBigIntegerToBuffer(privbuffer, privateKey.d);
|
|
@@ -36803,8 +36726,8 @@ var require_ssh = __commonJS2((exports, module) => {
|
|
|
36803
36726
|
padding.truncate(padding.length() - encLen + privbuffer.length());
|
|
36804
36727
|
privbuffer.putBuffer(padding);
|
|
36805
36728
|
var aeskey = forge.util.createBuffer();
|
|
36806
|
-
aeskey.putBuffer(_sha1("\
|
|
36807
|
-
aeskey.putBuffer(_sha1("\
|
|
36729
|
+
aeskey.putBuffer(_sha1("\x00\x00\x00\x00", passphrase));
|
|
36730
|
+
aeskey.putBuffer(_sha1("\x00\x00\x00\x01", passphrase));
|
|
36808
36731
|
var cipher = forge.aes.createEncryptionCipher(aeskey.truncate(8), "CBC");
|
|
36809
36732
|
cipher.start(forge.util.createBuffer().fillWithByte(0, 16));
|
|
36810
36733
|
cipher.update(privbuffer.copy());
|
|
@@ -36814,7 +36737,9 @@ var require_ssh = __commonJS2((exports, module) => {
|
|
|
36814
36737
|
priv = forge.util.encode64(encrypted.bytes(), 64);
|
|
36815
36738
|
}
|
|
36816
36739
|
length = Math.floor(priv.length / 66) + 1;
|
|
36817
|
-
ppk +=
|
|
36740
|
+
ppk += `\r
|
|
36741
|
+
Private-Lines: ` + length + `\r
|
|
36742
|
+
`;
|
|
36818
36743
|
ppk += priv;
|
|
36819
36744
|
var mackey = _sha1("putty-private-key-file-mac-key", passphrase);
|
|
36820
36745
|
var macbuffer = forge.util.createBuffer();
|
|
@@ -36828,7 +36753,9 @@ var require_ssh = __commonJS2((exports, module) => {
|
|
|
36828
36753
|
var hmac = forge.hmac.create();
|
|
36829
36754
|
hmac.start("sha1", mackey);
|
|
36830
36755
|
hmac.update(macbuffer.bytes());
|
|
36831
|
-
ppk +=
|
|
36756
|
+
ppk += `\r
|
|
36757
|
+
Private-MAC: ` + hmac.digest().toHex() + `\r
|
|
36758
|
+
`;
|
|
36832
36759
|
return ppk;
|
|
36833
36760
|
};
|
|
36834
36761
|
ssh.publicKeyToOpenSSH = function(key, comment) {
|
|
@@ -37185,9 +37112,12 @@ class Consola2 {
|
|
|
37185
37112
|
}
|
|
37186
37113
|
if (logObj.additional) {
|
|
37187
37114
|
if (!Array.isArray(logObj.additional)) {
|
|
37188
|
-
logObj.additional = logObj.additional.split(
|
|
37115
|
+
logObj.additional = logObj.additional.split(`
|
|
37116
|
+
`);
|
|
37189
37117
|
}
|
|
37190
|
-
logObj.args.push(
|
|
37118
|
+
logObj.args.push(`
|
|
37119
|
+
` + logObj.additional.join(`
|
|
37120
|
+
`));
|
|
37191
37121
|
delete logObj.additional;
|
|
37192
37122
|
}
|
|
37193
37123
|
logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
|
|
@@ -37332,7 +37262,8 @@ var init_core2 = __esm2(() => {
|
|
|
37332
37262
|
});
|
|
37333
37263
|
function parseStack2(stack) {
|
|
37334
37264
|
const cwd = process.cwd() + sep3;
|
|
37335
|
-
const lines = stack.split(
|
|
37265
|
+
const lines = stack.split(`
|
|
37266
|
+
`).splice(1).map((l22) => l22.trim().replace("file://", "").replace(cwd, ""));
|
|
37336
37267
|
return lines;
|
|
37337
37268
|
}
|
|
37338
37269
|
function writeStream2(data, stream) {
|
|
@@ -37342,12 +37273,14 @@ function writeStream2(data, stream) {
|
|
|
37342
37273
|
|
|
37343
37274
|
class BasicReporter2 {
|
|
37344
37275
|
formatStack(stack, opts) {
|
|
37345
|
-
return " " + parseStack2(stack).join(
|
|
37276
|
+
return " " + parseStack2(stack).join(`
|
|
37277
|
+
`);
|
|
37346
37278
|
}
|
|
37347
37279
|
formatArgs(args, opts) {
|
|
37348
37280
|
const _args = args.map((arg) => {
|
|
37349
37281
|
if (arg && typeof arg.stack === "string") {
|
|
37350
|
-
return arg.message +
|
|
37282
|
+
return arg.message + `
|
|
37283
|
+
` + this.formatStack(arg.stack, opts);
|
|
37351
37284
|
}
|
|
37352
37285
|
return arg;
|
|
37353
37286
|
});
|
|
@@ -37362,11 +37295,15 @@ class BasicReporter2 {
|
|
|
37362
37295
|
formatLogObj(logObj, opts) {
|
|
37363
37296
|
const message = this.formatArgs(logObj.args, opts);
|
|
37364
37297
|
if (logObj.type === "box") {
|
|
37365
|
-
return
|
|
37298
|
+
return `
|
|
37299
|
+
` + [
|
|
37366
37300
|
bracket2(logObj.tag),
|
|
37367
37301
|
logObj.title && logObj.title,
|
|
37368
|
-
...message.split(
|
|
37369
|
-
|
|
37302
|
+
...message.split(`
|
|
37303
|
+
`)
|
|
37304
|
+
].filter(Boolean).map((l22) => " > " + l22).join(`
|
|
37305
|
+
`) + `
|
|
37306
|
+
`;
|
|
37370
37307
|
}
|
|
37371
37308
|
return this.filterAndJoin([
|
|
37372
37309
|
bracket2(logObj.type),
|
|
@@ -37379,7 +37316,8 @@ class BasicReporter2 {
|
|
|
37379
37316
|
columns: ctx.options.stdout.columns || 0,
|
|
37380
37317
|
...ctx.options.formatOptions
|
|
37381
37318
|
});
|
|
37382
|
-
return writeStream2(line +
|
|
37319
|
+
return writeStream2(line + `
|
|
37320
|
+
`, logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout);
|
|
37383
37321
|
}
|
|
37384
37322
|
}
|
|
37385
37323
|
var bracket2 = (x2) => x2 ? `[${x2}]` : "";
|
|
@@ -37414,7 +37352,8 @@ function box2(text2, _opts = {}) {
|
|
|
37414
37352
|
..._opts.style
|
|
37415
37353
|
}
|
|
37416
37354
|
};
|
|
37417
|
-
const textLines = text2.split(
|
|
37355
|
+
const textLines = text2.split(`
|
|
37356
|
+
`);
|
|
37418
37357
|
const boxLines = [];
|
|
37419
37358
|
const _color = getColor3(opts.style.borderColor);
|
|
37420
37359
|
const borderStyle = {
|
|
@@ -37455,7 +37394,8 @@ function box2(text2, _opts = {}) {
|
|
|
37455
37394
|
if (opts.style.marginBottom > 0) {
|
|
37456
37395
|
boxLines.push("".repeat(opts.style.marginBottom));
|
|
37457
37396
|
}
|
|
37458
|
-
return boxLines.join(
|
|
37397
|
+
return boxLines.join(`
|
|
37398
|
+
`);
|
|
37459
37399
|
}
|
|
37460
37400
|
var env22;
|
|
37461
37401
|
var argv2;
|
|
@@ -37743,7 +37683,7 @@ class h22 {
|
|
|
37743
37683
|
}
|
|
37744
37684
|
this.state !== "error" && (this.state = "submit");
|
|
37745
37685
|
}
|
|
37746
|
-
u === "
|
|
37686
|
+
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
37687
|
}
|
|
37748
37688
|
close() {
|
|
37749
37689
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
@@ -38014,7 +37954,8 @@ ${colors2.yellow(S_BAR_END2)} ${colors2.yellow(this.error)}
|
|
|
38014
37954
|
return `${title}${colors2.gray(S_BAR2)} ${colors2.dim(this.value || opts.placeholder)}`;
|
|
38015
37955
|
}
|
|
38016
37956
|
case "cancel": {
|
|
38017
|
-
return `${title}${colors2.gray(S_BAR2)} ${colors2.strikethrough(colors2.dim(this.value ?? ""))}${this.value?.trim() ?
|
|
37957
|
+
return `${title}${colors2.gray(S_BAR2)} ${colors2.strikethrough(colors2.dim(this.value ?? ""))}${this.value?.trim() ? `
|
|
37958
|
+
` + colors2.gray(S_BAR2) : ""}`;
|
|
38018
37959
|
}
|
|
38019
37960
|
default: {
|
|
38020
37961
|
return `${title}${colors2.cyan(S_BAR2)} ${value}
|
|
@@ -38142,7 +38083,9 @@ ${symbol2(this.state)} ${opts.message}
|
|
|
38142
38083
|
${colors2.gray(S_BAR2)}` : ""}`;
|
|
38143
38084
|
}
|
|
38144
38085
|
case "error": {
|
|
38145
|
-
const footer = this.error.split(
|
|
38086
|
+
const footer = this.error.split(`
|
|
38087
|
+
`).map((ln, i) => i === 0 ? `${colors2.yellow(S_BAR_END2)} ${colors2.yellow(ln)}` : ` ${ln}`).join(`
|
|
38088
|
+
`);
|
|
38146
38089
|
return title + colors2.yellow(S_BAR2) + " " + this.options.map((option, i) => {
|
|
38147
38090
|
const selected = this.value.includes(option.value);
|
|
38148
38091
|
const active = i === this.cursor;
|
|
@@ -38154,7 +38097,9 @@ ${colors2.gray(S_BAR2)}` : ""}`;
|
|
|
38154
38097
|
}
|
|
38155
38098
|
return opt(option, active ? "active" : "inactive");
|
|
38156
38099
|
}).join(`
|
|
38157
|
-
${colors2.yellow(S_BAR2)} `) +
|
|
38100
|
+
${colors2.yellow(S_BAR2)} `) + `
|
|
38101
|
+
` + footer + `
|
|
38102
|
+
`;
|
|
38158
38103
|
}
|
|
38159
38104
|
default: {
|
|
38160
38105
|
return `${title}${colors2.cyan(S_BAR2)} ${this.options.map((option, i) => {
|
|
@@ -38716,7 +38661,9 @@ var init_consola_36c0034f2 = __esm2(() => {
|
|
|
38716
38661
|
};
|
|
38717
38662
|
FancyReporter2 = class FancyReporter22 extends BasicReporter2 {
|
|
38718
38663
|
formatStack(stack) {
|
|
38719
|
-
return
|
|
38664
|
+
return `
|
|
38665
|
+
` + parseStack2(stack).map((line) => " " + line.replace(/^at +/, (m22) => colors2.gray(m22)).replace(/\((.+)\)/, (_22, m22) => `(${colors2.cyan(m22)})`)).join(`
|
|
38666
|
+
`);
|
|
38720
38667
|
}
|
|
38721
38668
|
formatType(logObj, isBadge, opts) {
|
|
38722
38669
|
const typeColor = TYPE_COLOR_MAP2[logObj.type] || LEVEL_COLOR_MAP2[logObj.level] || "gray";
|
|
@@ -38727,9 +38674,12 @@ var init_consola_36c0034f2 = __esm2(() => {
|
|
|
38727
38674
|
return _type ? getColor22(typeColor)(_type) : "";
|
|
38728
38675
|
}
|
|
38729
38676
|
formatLogObj(logObj, opts) {
|
|
38730
|
-
const [message, ...additional] = this.formatArgs(logObj.args, opts).split(
|
|
38677
|
+
const [message, ...additional] = this.formatArgs(logObj.args, opts).split(`
|
|
38678
|
+
`);
|
|
38731
38679
|
if (logObj.type === "box") {
|
|
38732
|
-
return box2(characterFormat2(message + (additional.length > 0 ?
|
|
38680
|
+
return box2(characterFormat2(message + (additional.length > 0 ? `
|
|
38681
|
+
` + additional.join(`
|
|
38682
|
+
`) : "")), {
|
|
38733
38683
|
title: logObj.title ? characterFormat2(logObj.title) : undefined,
|
|
38734
38684
|
style: logObj.style
|
|
38735
38685
|
});
|
|
@@ -38744,12 +38694,16 @@ var init_consola_36c0034f2 = __esm2(() => {
|
|
|
38744
38694
|
const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
|
|
38745
38695
|
const space = (opts.columns || 0) - stringWidth3(left) - stringWidth3(right) - 2;
|
|
38746
38696
|
line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors2.gray(`[${right}]`)} ` : "") + left;
|
|
38747
|
-
line += characterFormat2(additional.length > 0 ?
|
|
38697
|
+
line += characterFormat2(additional.length > 0 ? `
|
|
38698
|
+
` + additional.join(`
|
|
38699
|
+
`) : "");
|
|
38748
38700
|
if (logObj.type === "trace") {
|
|
38749
38701
|
const _err = new Error("Trace: " + logObj.message);
|
|
38750
38702
|
line += this.formatStack(_err.stack || "");
|
|
38751
38703
|
}
|
|
38752
|
-
return isBadge ?
|
|
38704
|
+
return isBadge ? `
|
|
38705
|
+
` + line + `
|
|
38706
|
+
` : line;
|
|
38753
38707
|
}
|
|
38754
38708
|
};
|
|
38755
38709
|
consola2 = createConsola22();
|
|
@@ -38796,16 +38750,16 @@ var require_isIP2 = __commonJS22((exports, module) => {
|
|
|
38796
38750
|
var IPv6SegmentFormat = "(?:[0-9a-fA-F]{1,4})";
|
|
38797
38751
|
var IPv6AddressRegExp = new RegExp("^(" + "(?:".concat(IPv6SegmentFormat, ":){7}(?:").concat(IPv6SegmentFormat, "|:)|") + "(?:".concat(IPv6SegmentFormat, ":){6}(?:").concat(IPv4AddressFormat, "|:").concat(IPv6SegmentFormat, "|:)|") + "(?:".concat(IPv6SegmentFormat, ":){5}(?::").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,2}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){4}(?:(:").concat(IPv6SegmentFormat, "){0,1}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,3}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){3}(?:(:").concat(IPv6SegmentFormat, "){0,2}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,4}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){2}(?:(:").concat(IPv6SegmentFormat, "){0,3}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,5}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){1}(?:(:").concat(IPv6SegmentFormat, "){0,4}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,6}|:)|") + "(?::((?::".concat(IPv6SegmentFormat, "){0,5}:").concat(IPv4AddressFormat, "|(?::").concat(IPv6SegmentFormat, "){1,7}|:))") + ")(%[0-9a-zA-Z-.:]{1,})?$");
|
|
38798
38752
|
function isIP(str) {
|
|
38799
|
-
var
|
|
38753
|
+
var version2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
38800
38754
|
(0, _assertString.default)(str);
|
|
38801
|
-
|
|
38802
|
-
if (!
|
|
38755
|
+
version2 = String(version2);
|
|
38756
|
+
if (!version2) {
|
|
38803
38757
|
return isIP(str, 4) || isIP(str, 6);
|
|
38804
38758
|
}
|
|
38805
|
-
if (
|
|
38759
|
+
if (version2 === "4") {
|
|
38806
38760
|
return IPv4AddressRegExp.test(str);
|
|
38807
38761
|
}
|
|
38808
|
-
if (
|
|
38762
|
+
if (version2 === "6") {
|
|
38809
38763
|
return IPv6AddressRegExp.test(str);
|
|
38810
38764
|
}
|
|
38811
38765
|
return false;
|
|
@@ -38969,7 +38923,8 @@ var require_isURL2 = __commonJS22((exports, module) => {
|
|
|
38969
38923
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
38970
38924
|
}
|
|
38971
38925
|
function _nonIterableRest() {
|
|
38972
|
-
throw new TypeError(
|
|
38926
|
+
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
38927
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
38973
38928
|
}
|
|
38974
38929
|
function _unsupportedIterableToArray(o, minLen) {
|
|
38975
38930
|
if (!o)
|
|
@@ -39327,9 +39282,9 @@ var require_isUUID2 = __commonJS22((exports, module) => {
|
|
|
39327
39282
|
7: /^[0-9A-F]{8}-[0-9A-F]{4}-7[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,
|
|
39328
39283
|
all: /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i
|
|
39329
39284
|
};
|
|
39330
|
-
function isUUID(str,
|
|
39285
|
+
function isUUID(str, version2) {
|
|
39331
39286
|
(0, _assertString.default)(str);
|
|
39332
|
-
var pattern = uuid[![undefined, null].includes(
|
|
39287
|
+
var pattern = uuid[![undefined, null].includes(version2) ? version2 : "all"];
|
|
39333
39288
|
return !!pattern && pattern.test(str);
|
|
39334
39289
|
}
|
|
39335
39290
|
module.exports = exports.default;
|
|
@@ -39427,7 +39382,7 @@ var require_isEmail2 = __commonJS22((exports, module) => {
|
|
|
39427
39382
|
if (display_name_without_quotes === display_name) {
|
|
39428
39383
|
return false;
|
|
39429
39384
|
}
|
|
39430
|
-
var all_start_with_back_slash = display_name_without_quotes.split('"').length === display_name_without_quotes.split(
|
|
39385
|
+
var all_start_with_back_slash = display_name_without_quotes.split('"').length === display_name_without_quotes.split("\\\"").length;
|
|
39431
39386
|
if (!all_start_with_back_slash) {
|
|
39432
39387
|
return false;
|
|
39433
39388
|
}
|
|
@@ -41092,7 +41047,8 @@ var require_clear3 = __commonJS22((exports, module) => {
|
|
|
41092
41047
|
throw _e;
|
|
41093
41048
|
}, f: F };
|
|
41094
41049
|
}
|
|
41095
|
-
throw new TypeError(
|
|
41050
|
+
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
41051
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
41096
41052
|
}
|
|
41097
41053
|
var normalCompletion = true, didErr = false, err2;
|
|
41098
41054
|
return { s: function s() {
|
|
@@ -41249,7 +41205,9 @@ var require_wrap3 = __commonJS22((exports, module) => {
|
|
|
41249
41205
|
else
|
|
41250
41206
|
arr.push(`${tab}${w22}`);
|
|
41251
41207
|
return arr;
|
|
41252
|
-
}, [tab]).join(
|
|
41208
|
+
}, [tab]).join(`
|
|
41209
|
+
`)).join(`
|
|
41210
|
+
`);
|
|
41253
41211
|
};
|
|
41254
41212
|
});
|
|
41255
41213
|
var require_entriesToDisplay3 = __commonJS22((exports, module) => {
|
|
@@ -41344,7 +41302,7 @@ var require_prompt3 = __commonJS22((exports, module) => {
|
|
|
41344
41302
|
module.exports = Prompt;
|
|
41345
41303
|
});
|
|
41346
41304
|
var require_text3 = __commonJS22((exports, module) => {
|
|
41347
|
-
function asyncGeneratorStep(gen,
|
|
41305
|
+
function asyncGeneratorStep(gen, resolve3, reject, _next, _throw, key, arg) {
|
|
41348
41306
|
try {
|
|
41349
41307
|
var info = gen[key](arg);
|
|
41350
41308
|
var value = info.value;
|
|
@@ -41353,7 +41311,7 @@ var require_text3 = __commonJS22((exports, module) => {
|
|
|
41353
41311
|
return;
|
|
41354
41312
|
}
|
|
41355
41313
|
if (info.done) {
|
|
41356
|
-
|
|
41314
|
+
resolve3(value);
|
|
41357
41315
|
} else {
|
|
41358
41316
|
Promise.resolve(value).then(_next, _throw);
|
|
41359
41317
|
}
|
|
@@ -41361,13 +41319,13 @@ var require_text3 = __commonJS22((exports, module) => {
|
|
|
41361
41319
|
function _asyncToGenerator(fn) {
|
|
41362
41320
|
return function() {
|
|
41363
41321
|
var self2 = this, args = arguments;
|
|
41364
|
-
return new Promise(function(
|
|
41322
|
+
return new Promise(function(resolve3, reject) {
|
|
41365
41323
|
var gen = fn.apply(self2, args);
|
|
41366
41324
|
function _next(value) {
|
|
41367
|
-
asyncGeneratorStep(gen,
|
|
41325
|
+
asyncGeneratorStep(gen, resolve3, reject, _next, _throw, "next", value);
|
|
41368
41326
|
}
|
|
41369
41327
|
function _throw(err2) {
|
|
41370
|
-
asyncGeneratorStep(gen,
|
|
41328
|
+
asyncGeneratorStep(gen, resolve3, reject, _next, _throw, "throw", err2);
|
|
41371
41329
|
}
|
|
41372
41330
|
_next(undefined);
|
|
41373
41331
|
});
|
|
@@ -41430,7 +41388,8 @@ var require_text3 = __commonJS22((exports, module) => {
|
|
|
41430
41388
|
this.red = false;
|
|
41431
41389
|
this.fire();
|
|
41432
41390
|
this.render();
|
|
41433
|
-
this.out.write(
|
|
41391
|
+
this.out.write(`
|
|
41392
|
+
`);
|
|
41434
41393
|
this.close();
|
|
41435
41394
|
}
|
|
41436
41395
|
validate() {
|
|
@@ -41461,7 +41420,8 @@ var require_text3 = __commonJS22((exports, module) => {
|
|
|
41461
41420
|
_this2.aborted = false;
|
|
41462
41421
|
_this2.fire();
|
|
41463
41422
|
_this2.render();
|
|
41464
|
-
_this2.out.write(
|
|
41423
|
+
_this2.out.write(`
|
|
41424
|
+
`);
|
|
41465
41425
|
_this2.close();
|
|
41466
41426
|
})();
|
|
41467
41427
|
}
|
|
@@ -41554,7 +41514,9 @@ var require_text3 = __commonJS22((exports, module) => {
|
|
|
41554
41514
|
this.outputError = "";
|
|
41555
41515
|
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
41516
|
if (this.error) {
|
|
41557
|
-
this.outputError += this.errorMsg.split(
|
|
41517
|
+
this.outputError += this.errorMsg.split(`
|
|
41518
|
+
`).reduce((a, l3, i) => a + `
|
|
41519
|
+
${i ? " " : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
41558
41520
|
}
|
|
41559
41521
|
this.out.write(erase22.line + cursor22.to(0) + this.outputText + cursor22.save + this.outputError + cursor22.restore + cursor22.move(this.cursorOffset, 0));
|
|
41560
41522
|
}
|
|
@@ -41616,7 +41578,8 @@ var require_select3 = __commonJS22((exports, module) => {
|
|
|
41616
41578
|
this.done = this.aborted = true;
|
|
41617
41579
|
this.fire();
|
|
41618
41580
|
this.render();
|
|
41619
|
-
this.out.write(
|
|
41581
|
+
this.out.write(`
|
|
41582
|
+
`);
|
|
41620
41583
|
this.close();
|
|
41621
41584
|
}
|
|
41622
41585
|
submit() {
|
|
@@ -41625,7 +41588,8 @@ var require_select3 = __commonJS22((exports, module) => {
|
|
|
41625
41588
|
this.aborted = false;
|
|
41626
41589
|
this.fire();
|
|
41627
41590
|
this.render();
|
|
41628
|
-
this.out.write(
|
|
41591
|
+
this.out.write(`
|
|
41592
|
+
`);
|
|
41629
41593
|
this.close();
|
|
41630
41594
|
} else
|
|
41631
41595
|
this.bell();
|
|
@@ -41676,7 +41640,8 @@ var require_select3 = __commonJS22((exports, module) => {
|
|
|
41676
41640
|
let _entriesToDisplay = entriesToDisplay(this.cursor, this.choices.length, this.optionsPerPage), startIndex = _entriesToDisplay.startIndex, endIndex = _entriesToDisplay.endIndex;
|
|
41677
41641
|
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
41642
|
if (!this.done) {
|
|
41679
|
-
this.outputText +=
|
|
41643
|
+
this.outputText += `
|
|
41644
|
+
`;
|
|
41680
41645
|
for (let i = startIndex;i < endIndex; i++) {
|
|
41681
41646
|
let title, prefix, desc = "", v22 = this.choices[i];
|
|
41682
41647
|
if (i === startIndex && startIndex > 0) {
|
|
@@ -41695,14 +41660,16 @@ var require_select3 = __commonJS22((exports, module) => {
|
|
|
41695
41660
|
if (v22.description && this.cursor === i) {
|
|
41696
41661
|
desc = ` - ${v22.description}`;
|
|
41697
41662
|
if (prefix.length + title.length + desc.length >= this.out.columns || v22.description.split(/\r?\n/).length > 1) {
|
|
41698
|
-
desc =
|
|
41663
|
+
desc = `
|
|
41664
|
+
` + wrap(v22.description, {
|
|
41699
41665
|
margin: 3,
|
|
41700
41666
|
width: this.out.columns
|
|
41701
41667
|
});
|
|
41702
41668
|
}
|
|
41703
41669
|
}
|
|
41704
41670
|
}
|
|
41705
|
-
this.outputText += `${prefix} ${title}${color.gray(desc)}
|
|
41671
|
+
this.outputText += `${prefix} ${title}${color.gray(desc)}
|
|
41672
|
+
`;
|
|
41706
41673
|
}
|
|
41707
41674
|
}
|
|
41708
41675
|
this.out.write(this.outputText);
|
|
@@ -41742,7 +41709,8 @@ var require_toggle3 = __commonJS22((exports, module) => {
|
|
|
41742
41709
|
this.done = this.aborted = true;
|
|
41743
41710
|
this.fire();
|
|
41744
41711
|
this.render();
|
|
41745
|
-
this.out.write(
|
|
41712
|
+
this.out.write(`
|
|
41713
|
+
`);
|
|
41746
41714
|
this.close();
|
|
41747
41715
|
}
|
|
41748
41716
|
submit() {
|
|
@@ -41750,7 +41718,8 @@ var require_toggle3 = __commonJS22((exports, module) => {
|
|
|
41750
41718
|
this.aborted = false;
|
|
41751
41719
|
this.fire();
|
|
41752
41720
|
this.render();
|
|
41753
|
-
this.out.write(
|
|
41721
|
+
this.out.write(`
|
|
41722
|
+
`);
|
|
41754
41723
|
this.close();
|
|
41755
41724
|
}
|
|
41756
41725
|
deactivate() {
|
|
@@ -42048,7 +42017,7 @@ var require_dateparts3 = __commonJS22((exports, module) => {
|
|
|
42048
42017
|
};
|
|
42049
42018
|
});
|
|
42050
42019
|
var require_date3 = __commonJS22((exports, module) => {
|
|
42051
|
-
function asyncGeneratorStep(gen,
|
|
42020
|
+
function asyncGeneratorStep(gen, resolve3, reject, _next, _throw, key, arg) {
|
|
42052
42021
|
try {
|
|
42053
42022
|
var info = gen[key](arg);
|
|
42054
42023
|
var value = info.value;
|
|
@@ -42057,7 +42026,7 @@ var require_date3 = __commonJS22((exports, module) => {
|
|
|
42057
42026
|
return;
|
|
42058
42027
|
}
|
|
42059
42028
|
if (info.done) {
|
|
42060
|
-
|
|
42029
|
+
resolve3(value);
|
|
42061
42030
|
} else {
|
|
42062
42031
|
Promise.resolve(value).then(_next, _throw);
|
|
42063
42032
|
}
|
|
@@ -42065,13 +42034,13 @@ var require_date3 = __commonJS22((exports, module) => {
|
|
|
42065
42034
|
function _asyncToGenerator(fn) {
|
|
42066
42035
|
return function() {
|
|
42067
42036
|
var self2 = this, args = arguments;
|
|
42068
|
-
return new Promise(function(
|
|
42037
|
+
return new Promise(function(resolve3, reject) {
|
|
42069
42038
|
var gen = fn.apply(self2, args);
|
|
42070
42039
|
function _next(value) {
|
|
42071
|
-
asyncGeneratorStep(gen,
|
|
42040
|
+
asyncGeneratorStep(gen, resolve3, reject, _next, _throw, "next", value);
|
|
42072
42041
|
}
|
|
42073
42042
|
function _throw(err2) {
|
|
42074
|
-
asyncGeneratorStep(gen,
|
|
42043
|
+
asyncGeneratorStep(gen, resolve3, reject, _next, _throw, "throw", err2);
|
|
42075
42044
|
}
|
|
42076
42045
|
_next(undefined);
|
|
42077
42046
|
});
|
|
@@ -42183,7 +42152,8 @@ var require_date3 = __commonJS22((exports, module) => {
|
|
|
42183
42152
|
this.error = false;
|
|
42184
42153
|
this.fire();
|
|
42185
42154
|
this.render();
|
|
42186
|
-
this.out.write(
|
|
42155
|
+
this.out.write(`
|
|
42156
|
+
`);
|
|
42187
42157
|
this.close();
|
|
42188
42158
|
}
|
|
42189
42159
|
validate() {
|
|
@@ -42211,7 +42181,8 @@ var require_date3 = __commonJS22((exports, module) => {
|
|
|
42211
42181
|
_this2.aborted = false;
|
|
42212
42182
|
_this2.fire();
|
|
42213
42183
|
_this2.render();
|
|
42214
|
-
_this2.out.write(
|
|
42184
|
+
_this2.out.write(`
|
|
42185
|
+
`);
|
|
42215
42186
|
_this2.close();
|
|
42216
42187
|
})();
|
|
42217
42188
|
}
|
|
@@ -42261,7 +42232,9 @@ var require_date3 = __commonJS22((exports, module) => {
|
|
|
42261
42232
|
super.render();
|
|
42262
42233
|
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
42234
|
if (this.error) {
|
|
42264
|
-
this.outputText += this.errorMsg.split(
|
|
42235
|
+
this.outputText += this.errorMsg.split(`
|
|
42236
|
+
`).reduce((a, l3, i) => a + `
|
|
42237
|
+
${i ? ` ` : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
42265
42238
|
}
|
|
42266
42239
|
this.out.write(erase22.line + cursor22.to(0) + this.outputText);
|
|
42267
42240
|
}
|
|
@@ -42269,7 +42242,7 @@ var require_date3 = __commonJS22((exports, module) => {
|
|
|
42269
42242
|
module.exports = DatePrompt;
|
|
42270
42243
|
});
|
|
42271
42244
|
var require_number3 = __commonJS22((exports, module) => {
|
|
42272
|
-
function asyncGeneratorStep(gen,
|
|
42245
|
+
function asyncGeneratorStep(gen, resolve3, reject, _next, _throw, key, arg) {
|
|
42273
42246
|
try {
|
|
42274
42247
|
var info = gen[key](arg);
|
|
42275
42248
|
var value = info.value;
|
|
@@ -42278,7 +42251,7 @@ var require_number3 = __commonJS22((exports, module) => {
|
|
|
42278
42251
|
return;
|
|
42279
42252
|
}
|
|
42280
42253
|
if (info.done) {
|
|
42281
|
-
|
|
42254
|
+
resolve3(value);
|
|
42282
42255
|
} else {
|
|
42283
42256
|
Promise.resolve(value).then(_next, _throw);
|
|
42284
42257
|
}
|
|
@@ -42286,13 +42259,13 @@ var require_number3 = __commonJS22((exports, module) => {
|
|
|
42286
42259
|
function _asyncToGenerator(fn) {
|
|
42287
42260
|
return function() {
|
|
42288
42261
|
var self2 = this, args = arguments;
|
|
42289
|
-
return new Promise(function(
|
|
42262
|
+
return new Promise(function(resolve3, reject) {
|
|
42290
42263
|
var gen = fn.apply(self2, args);
|
|
42291
42264
|
function _next(value) {
|
|
42292
|
-
asyncGeneratorStep(gen,
|
|
42265
|
+
asyncGeneratorStep(gen, resolve3, reject, _next, _throw, "next", value);
|
|
42293
42266
|
}
|
|
42294
42267
|
function _throw(err2) {
|
|
42295
|
-
asyncGeneratorStep(gen,
|
|
42268
|
+
asyncGeneratorStep(gen, resolve3, reject, _next, _throw, "throw", err2);
|
|
42296
42269
|
}
|
|
42297
42270
|
_next(undefined);
|
|
42298
42271
|
});
|
|
@@ -42371,7 +42344,8 @@ var require_number3 = __commonJS22((exports, module) => {
|
|
|
42371
42344
|
this.error = false;
|
|
42372
42345
|
this.fire();
|
|
42373
42346
|
this.render();
|
|
42374
|
-
this.out.write(
|
|
42347
|
+
this.out.write(`
|
|
42348
|
+
`);
|
|
42375
42349
|
this.close();
|
|
42376
42350
|
}
|
|
42377
42351
|
validate() {
|
|
@@ -42402,7 +42376,8 @@ var require_number3 = __commonJS22((exports, module) => {
|
|
|
42402
42376
|
_this2.error = false;
|
|
42403
42377
|
_this2.fire();
|
|
42404
42378
|
_this2.render();
|
|
42405
|
-
_this2.out.write(
|
|
42379
|
+
_this2.out.write(`
|
|
42380
|
+
`);
|
|
42406
42381
|
_this2.close();
|
|
42407
42382
|
})();
|
|
42408
42383
|
}
|
|
@@ -42478,7 +42453,9 @@ var require_number3 = __commonJS22((exports, module) => {
|
|
|
42478
42453
|
this.outputError = "";
|
|
42479
42454
|
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
42455
|
if (this.error) {
|
|
42481
|
-
this.outputError += this.errorMsg.split(
|
|
42456
|
+
this.outputError += this.errorMsg.split(`
|
|
42457
|
+
`).reduce((a, l3, i) => a + `
|
|
42458
|
+
${i ? ` ` : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
42482
42459
|
}
|
|
42483
42460
|
this.out.write(erase22.line + cursor22.to(0) + this.outputText + cursor22.save + this.outputError + cursor22.restore);
|
|
42484
42461
|
}
|
|
@@ -42545,7 +42522,8 @@ var require_multiselect3 = __commonJS22((exports, module) => {
|
|
|
42545
42522
|
this.done = this.aborted = true;
|
|
42546
42523
|
this.fire();
|
|
42547
42524
|
this.render();
|
|
42548
|
-
this.out.write(
|
|
42525
|
+
this.out.write(`
|
|
42526
|
+
`);
|
|
42549
42527
|
this.close();
|
|
42550
42528
|
}
|
|
42551
42529
|
submit() {
|
|
@@ -42558,7 +42536,8 @@ var require_multiselect3 = __commonJS22((exports, module) => {
|
|
|
42558
42536
|
this.aborted = false;
|
|
42559
42537
|
this.fire();
|
|
42560
42538
|
this.render();
|
|
42561
|
-
this.out.write(
|
|
42539
|
+
this.out.write(`
|
|
42540
|
+
`);
|
|
42562
42541
|
this.close();
|
|
42563
42542
|
}
|
|
42564
42543
|
}
|
|
@@ -42634,7 +42613,12 @@ var require_multiselect3 = __commonJS22((exports, module) => {
|
|
|
42634
42613
|
if (typeof this.instructions === "string") {
|
|
42635
42614
|
return this.instructions;
|
|
42636
42615
|
}
|
|
42637
|
-
return
|
|
42616
|
+
return `
|
|
42617
|
+
Instructions:
|
|
42618
|
+
` + ` ${figures.arrowUp}/${figures.arrowDown}: Highlight option
|
|
42619
|
+
` + ` ${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
|
|
42620
|
+
` + (this.maxChoices === undefined ? ` a: Toggle all
|
|
42621
|
+
` : "") + ` enter/return: Complete answer`;
|
|
42638
42622
|
}
|
|
42639
42623
|
return "";
|
|
42640
42624
|
}
|
|
@@ -42648,7 +42632,8 @@ var require_multiselect3 = __commonJS22((exports, module) => {
|
|
|
42648
42632
|
if (cursor3 === i && v22.description) {
|
|
42649
42633
|
desc = ` - ${v22.description}`;
|
|
42650
42634
|
if (prefix.length + title.length + desc.length >= this.out.columns || v22.description.split(/\r?\n/).length > 1) {
|
|
42651
|
-
desc =
|
|
42635
|
+
desc = `
|
|
42636
|
+
` + wrap(v22.description, {
|
|
42652
42637
|
margin: prefix.length,
|
|
42653
42638
|
width: this.out.columns
|
|
42654
42639
|
});
|
|
@@ -42673,7 +42658,9 @@ var require_multiselect3 = __commonJS22((exports, module) => {
|
|
|
42673
42658
|
}
|
|
42674
42659
|
styledOptions.push(this.renderOption(this.cursor, options2[i], i, prefix));
|
|
42675
42660
|
}
|
|
42676
|
-
return
|
|
42661
|
+
return `
|
|
42662
|
+
` + styledOptions.join(`
|
|
42663
|
+
`);
|
|
42677
42664
|
}
|
|
42678
42665
|
renderOptions(options2) {
|
|
42679
42666
|
if (!this.done) {
|
|
@@ -42710,7 +42697,7 @@ var require_multiselect3 = __commonJS22((exports, module) => {
|
|
|
42710
42697
|
module.exports = MultiselectPrompt;
|
|
42711
42698
|
});
|
|
42712
42699
|
var require_autocomplete3 = __commonJS22((exports, module) => {
|
|
42713
|
-
function asyncGeneratorStep(gen,
|
|
42700
|
+
function asyncGeneratorStep(gen, resolve3, reject, _next, _throw, key, arg) {
|
|
42714
42701
|
try {
|
|
42715
42702
|
var info = gen[key](arg);
|
|
42716
42703
|
var value = info.value;
|
|
@@ -42719,7 +42706,7 @@ var require_autocomplete3 = __commonJS22((exports, module) => {
|
|
|
42719
42706
|
return;
|
|
42720
42707
|
}
|
|
42721
42708
|
if (info.done) {
|
|
42722
|
-
|
|
42709
|
+
resolve3(value);
|
|
42723
42710
|
} else {
|
|
42724
42711
|
Promise.resolve(value).then(_next, _throw);
|
|
42725
42712
|
}
|
|
@@ -42727,13 +42714,13 @@ var require_autocomplete3 = __commonJS22((exports, module) => {
|
|
|
42727
42714
|
function _asyncToGenerator(fn) {
|
|
42728
42715
|
return function() {
|
|
42729
42716
|
var self2 = this, args = arguments;
|
|
42730
|
-
return new Promise(function(
|
|
42717
|
+
return new Promise(function(resolve3, reject) {
|
|
42731
42718
|
var gen = fn.apply(self2, args);
|
|
42732
42719
|
function _next(value) {
|
|
42733
|
-
asyncGeneratorStep(gen,
|
|
42720
|
+
asyncGeneratorStep(gen, resolve3, reject, _next, _throw, "next", value);
|
|
42734
42721
|
}
|
|
42735
42722
|
function _throw(err2) {
|
|
42736
|
-
asyncGeneratorStep(gen,
|
|
42723
|
+
asyncGeneratorStep(gen, resolve3, reject, _next, _throw, "throw", err2);
|
|
42737
42724
|
}
|
|
42738
42725
|
_next(undefined);
|
|
42739
42726
|
});
|
|
@@ -42839,7 +42826,8 @@ var require_autocomplete3 = __commonJS22((exports, module) => {
|
|
|
42839
42826
|
this.aborted = false;
|
|
42840
42827
|
this.fire();
|
|
42841
42828
|
this.render();
|
|
42842
|
-
this.out.write(
|
|
42829
|
+
this.out.write(`
|
|
42830
|
+
`);
|
|
42843
42831
|
this.close();
|
|
42844
42832
|
}
|
|
42845
42833
|
}
|
|
@@ -42848,7 +42836,8 @@ var require_autocomplete3 = __commonJS22((exports, module) => {
|
|
|
42848
42836
|
this.exited = false;
|
|
42849
42837
|
this.fire();
|
|
42850
42838
|
this.render();
|
|
42851
|
-
this.out.write(
|
|
42839
|
+
this.out.write(`
|
|
42840
|
+
`);
|
|
42852
42841
|
this.close();
|
|
42853
42842
|
}
|
|
42854
42843
|
submit() {
|
|
@@ -42856,7 +42845,8 @@ var require_autocomplete3 = __commonJS22((exports, module) => {
|
|
|
42856
42845
|
this.aborted = this.exited = false;
|
|
42857
42846
|
this.fire();
|
|
42858
42847
|
this.render();
|
|
42859
|
-
this.out.write(
|
|
42848
|
+
this.out.write(`
|
|
42849
|
+
`);
|
|
42860
42850
|
this.close();
|
|
42861
42851
|
}
|
|
42862
42852
|
_(c22, key) {
|
|
@@ -42945,7 +42935,8 @@ var require_autocomplete3 = __commonJS22((exports, module) => {
|
|
|
42945
42935
|
if (v22.description) {
|
|
42946
42936
|
desc = ` - ${v22.description}`;
|
|
42947
42937
|
if (prefix.length + title.length + desc.length >= this.out.columns || v22.description.split(/\r?\n/).length > 1) {
|
|
42948
|
-
desc =
|
|
42938
|
+
desc = `
|
|
42939
|
+
` + wrap(v22.description, {
|
|
42949
42940
|
margin: 3,
|
|
42950
42941
|
width: this.out.columns
|
|
42951
42942
|
});
|
|
@@ -42964,8 +42955,10 @@ var require_autocomplete3 = __commonJS22((exports, module) => {
|
|
|
42964
42955
|
let _entriesToDisplay = entriesToDisplay(this.select, this.choices.length, this.limit), startIndex = _entriesToDisplay.startIndex, endIndex = _entriesToDisplay.endIndex;
|
|
42965
42956
|
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
42957
|
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
|
-
|
|
42958
|
+
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(`
|
|
42959
|
+
`);
|
|
42960
|
+
this.outputText += `
|
|
42961
|
+
` + (suggestions || color.gray(this.fallback.title));
|
|
42969
42962
|
}
|
|
42970
42963
|
this.out.write(erase22.line + cursor22.to(0) + this.outputText);
|
|
42971
42964
|
}
|
|
@@ -43093,7 +43086,8 @@ Instructions:
|
|
|
43093
43086
|
}
|
|
43094
43087
|
renderCurrentInput() {
|
|
43095
43088
|
return `
|
|
43096
|
-
Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
|
|
43089
|
+
Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
|
|
43090
|
+
`;
|
|
43097
43091
|
}
|
|
43098
43092
|
renderOption(cursor3, v22, i) {
|
|
43099
43093
|
let title;
|
|
@@ -43165,7 +43159,8 @@ var require_confirm3 = __commonJS22((exports, module) => {
|
|
|
43165
43159
|
this.done = this.aborted = true;
|
|
43166
43160
|
this.fire();
|
|
43167
43161
|
this.render();
|
|
43168
|
-
this.out.write(
|
|
43162
|
+
this.out.write(`
|
|
43163
|
+
`);
|
|
43169
43164
|
this.close();
|
|
43170
43165
|
}
|
|
43171
43166
|
submit() {
|
|
@@ -43174,7 +43169,8 @@ var require_confirm3 = __commonJS22((exports, module) => {
|
|
|
43174
43169
|
this.aborted = false;
|
|
43175
43170
|
this.fire();
|
|
43176
43171
|
this.render();
|
|
43177
|
-
this.out.write(
|
|
43172
|
+
this.out.write(`
|
|
43173
|
+
`);
|
|
43178
43174
|
this.close();
|
|
43179
43175
|
}
|
|
43180
43176
|
_(c22, key) {
|
|
@@ -43330,7 +43326,8 @@ var require_dist2 = __commonJS22((exports, module) => {
|
|
|
43330
43326
|
throw _e;
|
|
43331
43327
|
}, f: F };
|
|
43332
43328
|
}
|
|
43333
|
-
throw new TypeError(
|
|
43329
|
+
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
43330
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
43334
43331
|
}
|
|
43335
43332
|
var normalCompletion = true, didErr = false, err2;
|
|
43336
43333
|
return { s: function s() {
|
|
@@ -43372,7 +43369,7 @@ var require_dist2 = __commonJS22((exports, module) => {
|
|
|
43372
43369
|
arr2[i] = arr[i];
|
|
43373
43370
|
return arr2;
|
|
43374
43371
|
}
|
|
43375
|
-
function asyncGeneratorStep(gen,
|
|
43372
|
+
function asyncGeneratorStep(gen, resolve3, reject, _next, _throw, key, arg) {
|
|
43376
43373
|
try {
|
|
43377
43374
|
var info = gen[key](arg);
|
|
43378
43375
|
var value = info.value;
|
|
@@ -43381,7 +43378,7 @@ var require_dist2 = __commonJS22((exports, module) => {
|
|
|
43381
43378
|
return;
|
|
43382
43379
|
}
|
|
43383
43380
|
if (info.done) {
|
|
43384
|
-
|
|
43381
|
+
resolve3(value);
|
|
43385
43382
|
} else {
|
|
43386
43383
|
Promise.resolve(value).then(_next, _throw);
|
|
43387
43384
|
}
|
|
@@ -43389,13 +43386,13 @@ var require_dist2 = __commonJS22((exports, module) => {
|
|
|
43389
43386
|
function _asyncToGenerator(fn) {
|
|
43390
43387
|
return function() {
|
|
43391
43388
|
var self2 = this, args = arguments;
|
|
43392
|
-
return new Promise(function(
|
|
43389
|
+
return new Promise(function(resolve3, reject) {
|
|
43393
43390
|
var gen = fn.apply(self2, args);
|
|
43394
43391
|
function _next(value) {
|
|
43395
|
-
asyncGeneratorStep(gen,
|
|
43392
|
+
asyncGeneratorStep(gen, resolve3, reject, _next, _throw, "next", value);
|
|
43396
43393
|
}
|
|
43397
43394
|
function _throw(err2) {
|
|
43398
|
-
asyncGeneratorStep(gen,
|
|
43395
|
+
asyncGeneratorStep(gen, resolve3, reject, _next, _throw, "throw", err2);
|
|
43399
43396
|
}
|
|
43400
43397
|
_next(undefined);
|
|
43401
43398
|
});
|
|
@@ -43662,7 +43659,9 @@ var require_wrap22 = __commonJS22((exports, module) => {
|
|
|
43662
43659
|
else
|
|
43663
43660
|
arr.push(`${tab}${w22}`);
|
|
43664
43661
|
return arr;
|
|
43665
|
-
}, [tab]).join(
|
|
43662
|
+
}, [tab]).join(`
|
|
43663
|
+
`)).join(`
|
|
43664
|
+
`);
|
|
43666
43665
|
};
|
|
43667
43666
|
});
|
|
43668
43667
|
var require_entriesToDisplay22 = __commonJS22((exports, module) => {
|
|
@@ -43799,7 +43798,8 @@ var require_text22 = __commonJS22((exports, module) => {
|
|
|
43799
43798
|
this.red = false;
|
|
43800
43799
|
this.fire();
|
|
43801
43800
|
this.render();
|
|
43802
|
-
this.out.write(
|
|
43801
|
+
this.out.write(`
|
|
43802
|
+
`);
|
|
43803
43803
|
this.close();
|
|
43804
43804
|
}
|
|
43805
43805
|
async validate() {
|
|
@@ -43825,7 +43825,8 @@ var require_text22 = __commonJS22((exports, module) => {
|
|
|
43825
43825
|
this.aborted = false;
|
|
43826
43826
|
this.fire();
|
|
43827
43827
|
this.render();
|
|
43828
|
-
this.out.write(
|
|
43828
|
+
this.out.write(`
|
|
43829
|
+
`);
|
|
43829
43830
|
this.close();
|
|
43830
43831
|
}
|
|
43831
43832
|
next() {
|
|
@@ -43922,7 +43923,9 @@ var require_text22 = __commonJS22((exports, module) => {
|
|
|
43922
43923
|
this.red ? color.red(this.rendered) : this.rendered
|
|
43923
43924
|
].join(` `);
|
|
43924
43925
|
if (this.error) {
|
|
43925
|
-
this.outputError += this.errorMsg.split(
|
|
43926
|
+
this.outputError += this.errorMsg.split(`
|
|
43927
|
+
`).reduce((a, l3, i) => a + `
|
|
43928
|
+
${i ? " " : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
43926
43929
|
}
|
|
43927
43930
|
this.out.write(erase22.line + cursor22.to(0) + this.outputText + cursor22.save + this.outputError + cursor22.restore + cursor22.move(this.cursorOffset, 0));
|
|
43928
43931
|
}
|
|
@@ -43975,7 +43978,8 @@ var require_select22 = __commonJS22((exports, module) => {
|
|
|
43975
43978
|
this.done = this.aborted = true;
|
|
43976
43979
|
this.fire();
|
|
43977
43980
|
this.render();
|
|
43978
|
-
this.out.write(
|
|
43981
|
+
this.out.write(`
|
|
43982
|
+
`);
|
|
43979
43983
|
this.close();
|
|
43980
43984
|
}
|
|
43981
43985
|
submit() {
|
|
@@ -43984,7 +43988,8 @@ var require_select22 = __commonJS22((exports, module) => {
|
|
|
43984
43988
|
this.aborted = false;
|
|
43985
43989
|
this.fire();
|
|
43986
43990
|
this.render();
|
|
43987
|
-
this.out.write(
|
|
43991
|
+
this.out.write(`
|
|
43992
|
+
`);
|
|
43988
43993
|
this.close();
|
|
43989
43994
|
} else
|
|
43990
43995
|
this.bell();
|
|
@@ -44040,7 +44045,8 @@ var require_select22 = __commonJS22((exports, module) => {
|
|
|
44040
44045
|
this.done ? this.selection.title : this.selection.disabled ? color.yellow(this.warn) : color.gray(this.hint)
|
|
44041
44046
|
].join(" ");
|
|
44042
44047
|
if (!this.done) {
|
|
44043
|
-
this.outputText +=
|
|
44048
|
+
this.outputText += `
|
|
44049
|
+
`;
|
|
44044
44050
|
for (let i = startIndex;i < endIndex; i++) {
|
|
44045
44051
|
let title, prefix, desc = "", v22 = this.choices[i];
|
|
44046
44052
|
if (i === startIndex && startIndex > 0) {
|
|
@@ -44059,11 +44065,13 @@ var require_select22 = __commonJS22((exports, module) => {
|
|
|
44059
44065
|
if (v22.description && this.cursor === i) {
|
|
44060
44066
|
desc = ` - ${v22.description}`;
|
|
44061
44067
|
if (prefix.length + title.length + desc.length >= this.out.columns || v22.description.split(/\r?\n/).length > 1) {
|
|
44062
|
-
desc =
|
|
44068
|
+
desc = `
|
|
44069
|
+
` + wrap(v22.description, { margin: 3, width: this.out.columns });
|
|
44063
44070
|
}
|
|
44064
44071
|
}
|
|
44065
44072
|
}
|
|
44066
|
-
this.outputText += `${prefix} ${title}${color.gray(desc)}
|
|
44073
|
+
this.outputText += `${prefix} ${title}${color.gray(desc)}
|
|
44074
|
+
`;
|
|
44067
44075
|
}
|
|
44068
44076
|
}
|
|
44069
44077
|
this.out.write(this.outputText);
|
|
@@ -44099,7 +44107,8 @@ var require_toggle22 = __commonJS22((exports, module) => {
|
|
|
44099
44107
|
this.done = this.aborted = true;
|
|
44100
44108
|
this.fire();
|
|
44101
44109
|
this.render();
|
|
44102
|
-
this.out.write(
|
|
44110
|
+
this.out.write(`
|
|
44111
|
+
`);
|
|
44103
44112
|
this.close();
|
|
44104
44113
|
}
|
|
44105
44114
|
submit() {
|
|
@@ -44107,7 +44116,8 @@ var require_toggle22 = __commonJS22((exports, module) => {
|
|
|
44107
44116
|
this.aborted = false;
|
|
44108
44117
|
this.fire();
|
|
44109
44118
|
this.render();
|
|
44110
|
-
this.out.write(
|
|
44119
|
+
this.out.write(`
|
|
44120
|
+
`);
|
|
44111
44121
|
this.close();
|
|
44112
44122
|
}
|
|
44113
44123
|
deactivate() {
|
|
@@ -44492,7 +44502,8 @@ var require_date22 = __commonJS22((exports, module) => {
|
|
|
44492
44502
|
this.error = false;
|
|
44493
44503
|
this.fire();
|
|
44494
44504
|
this.render();
|
|
44495
|
-
this.out.write(
|
|
44505
|
+
this.out.write(`
|
|
44506
|
+
`);
|
|
44496
44507
|
this.close();
|
|
44497
44508
|
}
|
|
44498
44509
|
async validate() {
|
|
@@ -44515,7 +44526,8 @@ var require_date22 = __commonJS22((exports, module) => {
|
|
|
44515
44526
|
this.aborted = false;
|
|
44516
44527
|
this.fire();
|
|
44517
44528
|
this.render();
|
|
44518
|
-
this.out.write(
|
|
44529
|
+
this.out.write(`
|
|
44530
|
+
`);
|
|
44519
44531
|
this.close();
|
|
44520
44532
|
}
|
|
44521
44533
|
up() {
|
|
@@ -44569,7 +44581,9 @@ var require_date22 = __commonJS22((exports, module) => {
|
|
|
44569
44581
|
this.parts.reduce((arr, p32, idx) => arr.concat(idx === this.cursor && !this.done ? color.cyan().underline(p32.toString()) : p32), []).join("")
|
|
44570
44582
|
].join(" ");
|
|
44571
44583
|
if (this.error) {
|
|
44572
|
-
this.outputText += this.errorMsg.split(
|
|
44584
|
+
this.outputText += this.errorMsg.split(`
|
|
44585
|
+
`).reduce((a, l3, i) => a + `
|
|
44586
|
+
${i ? ` ` : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
44573
44587
|
}
|
|
44574
44588
|
this.out.write(erase22.line + cursor22.to(0) + this.outputText);
|
|
44575
44589
|
}
|
|
@@ -44644,7 +44658,8 @@ var require_number22 = __commonJS22((exports, module) => {
|
|
|
44644
44658
|
this.error = false;
|
|
44645
44659
|
this.fire();
|
|
44646
44660
|
this.render();
|
|
44647
|
-
this.out.write(
|
|
44661
|
+
this.out.write(`
|
|
44662
|
+
`);
|
|
44648
44663
|
this.close();
|
|
44649
44664
|
}
|
|
44650
44665
|
async validate() {
|
|
@@ -44670,7 +44685,8 @@ var require_number22 = __commonJS22((exports, module) => {
|
|
|
44670
44685
|
this.error = false;
|
|
44671
44686
|
this.fire();
|
|
44672
44687
|
this.render();
|
|
44673
|
-
this.out.write(
|
|
44688
|
+
this.out.write(`
|
|
44689
|
+
`);
|
|
44674
44690
|
this.close();
|
|
44675
44691
|
}
|
|
44676
44692
|
up() {
|
|
@@ -44750,7 +44766,9 @@ var require_number22 = __commonJS22((exports, module) => {
|
|
|
44750
44766
|
!this.done || !this.done && !this.placeholder ? color[this.color]().underline(this.rendered) : this.rendered
|
|
44751
44767
|
].join(` `);
|
|
44752
44768
|
if (this.error) {
|
|
44753
|
-
this.outputError += this.errorMsg.split(
|
|
44769
|
+
this.outputError += this.errorMsg.split(`
|
|
44770
|
+
`).reduce((a, l3, i) => a + `
|
|
44771
|
+
${i ? ` ` : figures.pointerSmall} ${color.red().italic(l3)}`, ``);
|
|
44754
44772
|
}
|
|
44755
44773
|
this.out.write(erase22.line + cursor22.to(0) + this.outputText + cursor22.save + this.outputError + cursor22.restore);
|
|
44756
44774
|
}
|
|
@@ -44808,7 +44826,8 @@ var require_multiselect22 = __commonJS22((exports, module) => {
|
|
|
44808
44826
|
this.done = this.aborted = true;
|
|
44809
44827
|
this.fire();
|
|
44810
44828
|
this.render();
|
|
44811
|
-
this.out.write(
|
|
44829
|
+
this.out.write(`
|
|
44830
|
+
`);
|
|
44812
44831
|
this.close();
|
|
44813
44832
|
}
|
|
44814
44833
|
submit() {
|
|
@@ -44821,7 +44840,8 @@ var require_multiselect22 = __commonJS22((exports, module) => {
|
|
|
44821
44840
|
this.aborted = false;
|
|
44822
44841
|
this.fire();
|
|
44823
44842
|
this.render();
|
|
44824
|
-
this.out.write(
|
|
44843
|
+
this.out.write(`
|
|
44844
|
+
`);
|
|
44825
44845
|
this.close();
|
|
44826
44846
|
}
|
|
44827
44847
|
}
|
|
@@ -44897,7 +44917,12 @@ var require_multiselect22 = __commonJS22((exports, module) => {
|
|
|
44897
44917
|
if (typeof this.instructions === "string") {
|
|
44898
44918
|
return this.instructions;
|
|
44899
44919
|
}
|
|
44900
|
-
return
|
|
44920
|
+
return `
|
|
44921
|
+
Instructions:
|
|
44922
|
+
` + ` ${figures.arrowUp}/${figures.arrowDown}: Highlight option
|
|
44923
|
+
` + ` ${figures.arrowLeft}/${figures.arrowRight}/[space]: Toggle selection
|
|
44924
|
+
` + (this.maxChoices === undefined ? ` a: Toggle all
|
|
44925
|
+
` : "") + ` enter/return: Complete answer`;
|
|
44901
44926
|
}
|
|
44902
44927
|
return "";
|
|
44903
44928
|
}
|
|
@@ -44911,7 +44936,8 @@ var require_multiselect22 = __commonJS22((exports, module) => {
|
|
|
44911
44936
|
if (cursor3 === i && v22.description) {
|
|
44912
44937
|
desc = ` - ${v22.description}`;
|
|
44913
44938
|
if (prefix.length + title.length + desc.length >= this.out.columns || v22.description.split(/\r?\n/).length > 1) {
|
|
44914
|
-
desc =
|
|
44939
|
+
desc = `
|
|
44940
|
+
` + wrap(v22.description, { margin: prefix.length, width: this.out.columns });
|
|
44915
44941
|
}
|
|
44916
44942
|
}
|
|
44917
44943
|
}
|
|
@@ -44933,7 +44959,9 @@ var require_multiselect22 = __commonJS22((exports, module) => {
|
|
|
44933
44959
|
}
|
|
44934
44960
|
styledOptions.push(this.renderOption(this.cursor, options2[i], i, prefix));
|
|
44935
44961
|
}
|
|
44936
|
-
return
|
|
44962
|
+
return `
|
|
44963
|
+
` + styledOptions.join(`
|
|
44964
|
+
`);
|
|
44937
44965
|
}
|
|
44938
44966
|
renderOptions(options2) {
|
|
44939
44967
|
if (!this.done) {
|
|
@@ -45055,7 +45083,8 @@ var require_autocomplete22 = __commonJS22((exports, module) => {
|
|
|
45055
45083
|
this.aborted = false;
|
|
45056
45084
|
this.fire();
|
|
45057
45085
|
this.render();
|
|
45058
|
-
this.out.write(
|
|
45086
|
+
this.out.write(`
|
|
45087
|
+
`);
|
|
45059
45088
|
this.close();
|
|
45060
45089
|
}
|
|
45061
45090
|
}
|
|
@@ -45064,7 +45093,8 @@ var require_autocomplete22 = __commonJS22((exports, module) => {
|
|
|
45064
45093
|
this.exited = false;
|
|
45065
45094
|
this.fire();
|
|
45066
45095
|
this.render();
|
|
45067
|
-
this.out.write(
|
|
45096
|
+
this.out.write(`
|
|
45097
|
+
`);
|
|
45068
45098
|
this.close();
|
|
45069
45099
|
}
|
|
45070
45100
|
submit() {
|
|
@@ -45072,7 +45102,8 @@ var require_autocomplete22 = __commonJS22((exports, module) => {
|
|
|
45072
45102
|
this.aborted = this.exited = false;
|
|
45073
45103
|
this.fire();
|
|
45074
45104
|
this.render();
|
|
45075
|
-
this.out.write(
|
|
45105
|
+
this.out.write(`
|
|
45106
|
+
`);
|
|
45076
45107
|
this.close();
|
|
45077
45108
|
}
|
|
45078
45109
|
_(c22, key) {
|
|
@@ -45161,7 +45192,8 @@ var require_autocomplete22 = __commonJS22((exports, module) => {
|
|
|
45161
45192
|
if (v22.description) {
|
|
45162
45193
|
desc = ` - ${v22.description}`;
|
|
45163
45194
|
if (prefix.length + title.length + desc.length >= this.out.columns || v22.description.split(/\r?\n/).length > 1) {
|
|
45164
|
-
desc =
|
|
45195
|
+
desc = `
|
|
45196
|
+
` + wrap(v22.description, { margin: 3, width: this.out.columns });
|
|
45165
45197
|
}
|
|
45166
45198
|
}
|
|
45167
45199
|
return prefix + " " + title + color.gray(desc || "");
|
|
@@ -45182,8 +45214,10 @@ var require_autocomplete22 = __commonJS22((exports, module) => {
|
|
|
45182
45214
|
this.done && this.suggestions[this.select] ? this.suggestions[this.select].title : this.rendered = this.transform.render(this.input)
|
|
45183
45215
|
].join(" ");
|
|
45184
45216
|
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
|
-
|
|
45217
|
+
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(`
|
|
45218
|
+
`);
|
|
45219
|
+
this.outputText += `
|
|
45220
|
+
` + (suggestions || color.gray(this.fallback.title));
|
|
45187
45221
|
}
|
|
45188
45222
|
this.out.write(erase22.line + cursor22.to(0) + this.outputText);
|
|
45189
45223
|
}
|
|
@@ -45307,7 +45341,8 @@ Instructions:
|
|
|
45307
45341
|
}
|
|
45308
45342
|
renderCurrentInput() {
|
|
45309
45343
|
return `
|
|
45310
|
-
Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
|
|
45344
|
+
Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter something to filter")}
|
|
45345
|
+
`;
|
|
45311
45346
|
}
|
|
45312
45347
|
renderOption(cursor3, v22, i) {
|
|
45313
45348
|
let title;
|
|
@@ -45380,7 +45415,8 @@ var require_confirm22 = __commonJS22((exports, module) => {
|
|
|
45380
45415
|
this.done = this.aborted = true;
|
|
45381
45416
|
this.fire();
|
|
45382
45417
|
this.render();
|
|
45383
|
-
this.out.write(
|
|
45418
|
+
this.out.write(`
|
|
45419
|
+
`);
|
|
45384
45420
|
this.close();
|
|
45385
45421
|
}
|
|
45386
45422
|
submit() {
|
|
@@ -45389,7 +45425,8 @@ var require_confirm22 = __commonJS22((exports, module) => {
|
|
|
45389
45425
|
this.aborted = false;
|
|
45390
45426
|
this.fire();
|
|
45391
45427
|
this.render();
|
|
45392
|
-
this.out.write(
|
|
45428
|
+
this.out.write(`
|
|
45429
|
+
`);
|
|
45393
45430
|
this.close();
|
|
45394
45431
|
}
|
|
45395
45432
|
_(c22, key) {
|
|
@@ -47412,7 +47449,7 @@ var ut2 = l3((qe, P22) => {
|
|
|
47412
47449
|
return t = t.replace(C, "^$1"), t;
|
|
47413
47450
|
}
|
|
47414
47451
|
function Jt(t, e) {
|
|
47415
|
-
return t = `${t}`, t = t.replace(/(\\*)"/g,
|
|
47452
|
+
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
47453
|
}
|
|
47417
47454
|
P22.exports.command = Vt;
|
|
47418
47455
|
P22.exports.argument = Jt;
|
|
@@ -47600,7 +47637,7 @@ var TITLE_TERMINATORS2 = new Set([
|
|
|
47600
47637
|
...SENTENCE_TERMINATORS2,
|
|
47601
47638
|
":",
|
|
47602
47639
|
'"',
|
|
47603
|
-
"
|
|
47640
|
+
"'",
|
|
47604
47641
|
"\u201D"
|
|
47605
47642
|
]);
|
|
47606
47643
|
var SMALL_WORDS2 = new Set([
|
|
@@ -47647,7 +47684,7 @@ var uncountables2 = {};
|
|
|
47647
47684
|
var irregularPlurals2 = {};
|
|
47648
47685
|
var irregularSingles2 = {};
|
|
47649
47686
|
function sanitizeRule2(rule) {
|
|
47650
|
-
return typeof rule === "string" ? new RegExp(`^${rule}
|
|
47687
|
+
return typeof rule === "string" ? new RegExp(`^${rule}$`, "i") : rule;
|
|
47651
47688
|
}
|
|
47652
47689
|
function restoreCase2(word, token) {
|
|
47653
47690
|
if (word === token)
|
|
@@ -48018,29 +48055,29 @@ var log2 = {
|
|
|
48018
48055
|
},
|
|
48019
48056
|
echo: (...args) => console.log(...args)
|
|
48020
48057
|
};
|
|
48021
|
-
function userDatabasePath2(
|
|
48022
|
-
return projectPath2(`database/${
|
|
48058
|
+
function userDatabasePath2(path22) {
|
|
48059
|
+
return projectPath2(`database/${path22 || ""}`);
|
|
48023
48060
|
}
|
|
48024
|
-
function appPath2(
|
|
48025
|
-
return projectPath2(`app/${
|
|
48061
|
+
function appPath2(path22) {
|
|
48062
|
+
return projectPath2(`app/${path22 || ""}`);
|
|
48026
48063
|
}
|
|
48027
|
-
function commandsPath2(
|
|
48028
|
-
return appPath2(`Commands/${
|
|
48064
|
+
function commandsPath2(path22) {
|
|
48065
|
+
return appPath2(`Commands/${path22 || ""}`);
|
|
48029
48066
|
}
|
|
48030
|
-
function logsPath2(
|
|
48031
|
-
return storagePath2(`logs/${
|
|
48067
|
+
function logsPath2(path22) {
|
|
48068
|
+
return storagePath2(`logs/${path22 || ""}`);
|
|
48032
48069
|
}
|
|
48033
48070
|
function projectPath2(filePath = "", options2) {
|
|
48034
|
-
let
|
|
48035
|
-
while (
|
|
48036
|
-
|
|
48037
|
-
const finalPath = resolve22(
|
|
48071
|
+
let path22 = process52.cwd();
|
|
48072
|
+
while (path22.includes("storage"))
|
|
48073
|
+
path22 = resolve22(path22, "..");
|
|
48074
|
+
const finalPath = resolve22(path22, filePath);
|
|
48038
48075
|
if (options2?.relative)
|
|
48039
48076
|
return relative2(process52.cwd(), finalPath);
|
|
48040
48077
|
return finalPath;
|
|
48041
48078
|
}
|
|
48042
|
-
function storagePath2(
|
|
48043
|
-
return projectPath2(`storage/${
|
|
48079
|
+
function storagePath2(path22) {
|
|
48080
|
+
return projectPath2(`storage/${path22 || ""}`);
|
|
48044
48081
|
}
|
|
48045
48082
|
var config4 = {
|
|
48046
48083
|
ai: {
|
|
@@ -48297,12 +48334,16 @@ var config4 = {
|
|
|
48297
48334
|
type: "Select the type of change that you\u2019re committing:",
|
|
48298
48335
|
scope: "Select the SCOPE of this change (optional):",
|
|
48299
48336
|
customScope: "Select the SCOPE of this change:",
|
|
48300
|
-
subject:
|
|
48301
|
-
|
|
48302
|
-
|
|
48337
|
+
subject: `Write a SHORT, IMPERATIVE tense description of the change:
|
|
48338
|
+
`,
|
|
48339
|
+
body: `Provide a LONGER description of the change (optional). Use "|" to break new line:
|
|
48340
|
+
`,
|
|
48341
|
+
breaking: `List any BREAKING CHANGES (optional). Use "|" to break new line:
|
|
48342
|
+
`,
|
|
48303
48343
|
footerPrefixesSelect: "Select the ISSUES type of the change list by this change (optional):",
|
|
48304
48344
|
customFooterPrefixes: "Input ISSUES prefix:",
|
|
48305
|
-
footer:
|
|
48345
|
+
footer: `List any ISSUES by this change. E.g.: #31, #34:
|
|
48346
|
+
`,
|
|
48306
48347
|
confirmCommit: "Are you sure you want to proceed with the commit above?"
|
|
48307
48348
|
},
|
|
48308
48349
|
types: [
|
|
@@ -49329,7 +49370,8 @@ var import_escape2 = __toESM22(require_escape2(), 1);
|
|
|
49329
49370
|
var import_normalizeEmail2 = __toESM22(require_normalizeEmail2(), 1);
|
|
49330
49371
|
var CompilerBuffer2 = class _CompilerBuffer2 {
|
|
49331
49372
|
#content = "";
|
|
49332
|
-
newLine =
|
|
49373
|
+
newLine = `
|
|
49374
|
+
`;
|
|
49333
49375
|
writeStatement(statement) {
|
|
49334
49376
|
this.#content = `${this.#content}${this.newLine}${statement}`;
|
|
49335
49377
|
}
|
|
@@ -49467,7 +49509,8 @@ function defineFieldValidations2({
|
|
|
49467
49509
|
variableName,
|
|
49468
49510
|
dropMissingCheck
|
|
49469
49511
|
}) {
|
|
49470
|
-
return `${validations.map((one) => emitValidationSnippet2(one, variableName, bail, dropMissingCheck)).join(
|
|
49512
|
+
return `${validations.map((one) => emitValidationSnippet2(one, variableName, bail, dropMissingCheck)).join(`
|
|
49513
|
+
`)}`;
|
|
49471
49514
|
}
|
|
49472
49515
|
function defineArrayInitialOutput2({
|
|
49473
49516
|
variableName,
|
|
@@ -51291,7 +51334,7 @@ var alphaRule2 = createRule2((value, options2, field) => {
|
|
|
51291
51334
|
characterSet += "_";
|
|
51292
51335
|
}
|
|
51293
51336
|
}
|
|
51294
|
-
const expression = new RegExp(`^[${characterSet}]
|
|
51337
|
+
const expression = new RegExp(`^[${characterSet}]+$`);
|
|
51295
51338
|
if (!expression.test(value)) {
|
|
51296
51339
|
field.report(messages2.alpha, "alpha", field);
|
|
51297
51340
|
}
|
|
@@ -51312,7 +51355,7 @@ var alphaNumericRule2 = createRule2((value, options2, field) => {
|
|
|
51312
51355
|
characterSet += "_";
|
|
51313
51356
|
}
|
|
51314
51357
|
}
|
|
51315
|
-
const expression = new RegExp(`^[${characterSet}]
|
|
51358
|
+
const expression = new RegExp(`^[${characterSet}]+$`);
|
|
51316
51359
|
if (!expression.test(value)) {
|
|
51317
51360
|
field.report(messages2.alphaNumeric, "alphaNumeric", field);
|
|
51318
51361
|
}
|
|
@@ -51506,7 +51549,7 @@ var uuidRule2 = createRule2((value, options2, field) => {
|
|
|
51506
51549
|
field.report(messages2.uuid, "uuid", field);
|
|
51507
51550
|
}
|
|
51508
51551
|
} else {
|
|
51509
|
-
const matchesAnyVersion = options2.version.find((
|
|
51552
|
+
const matchesAnyVersion = options2.version.find((version2) => helpers32.isUUID(value, version2));
|
|
51510
51553
|
if (!matchesAnyVersion) {
|
|
51511
51554
|
field.report(messages2.uuid, "uuid", field, options2);
|
|
51512
51555
|
}
|
|
@@ -51601,8 +51644,8 @@ var VineString2 = class _VineString2 extends BaseLiteralType2 {
|
|
|
51601
51644
|
mobile(...args) {
|
|
51602
51645
|
return this.use(mobileRule2(...args));
|
|
51603
51646
|
}
|
|
51604
|
-
ipAddress(
|
|
51605
|
-
return this.use(ipAddressRule2(
|
|
51647
|
+
ipAddress(version2) {
|
|
51648
|
+
return this.use(ipAddressRule2(version2 ? { version: version2 } : undefined));
|
|
51606
51649
|
}
|
|
51607
51650
|
hexCode() {
|
|
51608
51651
|
return this.use(hexCodeRule2());
|
|
@@ -52580,12 +52623,16 @@ var git_default2 = {
|
|
|
52580
52623
|
type: "Select the type of change that you\u2019re committing:",
|
|
52581
52624
|
scope: "Select the SCOPE of this change (optional):",
|
|
52582
52625
|
customScope: "Select the SCOPE of this change:",
|
|
52583
|
-
subject:
|
|
52584
|
-
|
|
52585
|
-
|
|
52626
|
+
subject: `Write a SHORT, IMPERATIVE tense description of the change:
|
|
52627
|
+
`,
|
|
52628
|
+
body: `Provide a LONGER description of the change (optional). Use "|" to break new line:
|
|
52629
|
+
`,
|
|
52630
|
+
breaking: `List any BREAKING CHANGES (optional). Use "|" to break new line:
|
|
52631
|
+
`,
|
|
52586
52632
|
footerPrefixesSelect: "Select the ISSUES type of the change list by this change (optional):",
|
|
52587
52633
|
customFooterPrefixes: "Input ISSUES prefix:",
|
|
52588
|
-
footer:
|
|
52634
|
+
footer: `List any ISSUES by this change. E.g.: #31, #34:
|
|
52635
|
+
`,
|
|
52589
52636
|
confirmCommit: "Are you sure you want to proceed with the commit above?"
|
|
52590
52637
|
},
|
|
52591
52638
|
types: [
|
|
@@ -52894,7 +52941,7 @@ var ui_default2 = {
|
|
|
52894
52941
|
}
|
|
52895
52942
|
}
|
|
52896
52943
|
};
|
|
52897
|
-
var
|
|
52944
|
+
var config22 = {
|
|
52898
52945
|
ai: ai_default2,
|
|
52899
52946
|
analytics: analytics_default2,
|
|
52900
52947
|
app: app_default2,
|
|
@@ -52921,7 +52968,7 @@ var config23 = {
|
|
|
52921
52968
|
team: team_default2,
|
|
52922
52969
|
ui: ui_default2
|
|
52923
52970
|
};
|
|
52924
|
-
var overrides_default2 =
|
|
52971
|
+
var overrides_default2 = config22;
|
|
52925
52972
|
async function localTunnel2(options2) {
|
|
52926
52973
|
const port = 3000;
|
|
52927
52974
|
if (!options2?.port)
|
|
@@ -53125,7 +53172,7 @@ function determineAppEnv2() {
|
|
|
53125
53172
|
if (app22.env === "production")
|
|
53126
53173
|
return "prod";
|
|
53127
53174
|
if (!app22.env)
|
|
53128
|
-
throw new Error("Couldn
|
|
53175
|
+
throw new Error("Couldn't determine app environment");
|
|
53129
53176
|
return app22.env;
|
|
53130
53177
|
}
|
|
53131
53178
|
|
|
@@ -53162,7 +53209,8 @@ class ErrorHandler2 {
|
|
|
53162
53209
|
console.error("Error is not an instance of Error:", err2);
|
|
53163
53210
|
return;
|
|
53164
53211
|
}
|
|
53165
|
-
const formattedError = `[${new Date().toISOString()}] ${err2.name}: ${err2.message}
|
|
53212
|
+
const formattedError = `[${new Date().toISOString()}] ${err2.name}: ${err2.message}
|
|
53213
|
+
`;
|
|
53166
53214
|
const logFilePath = logsPath2("stacks.log") ?? logsPath2("errors.log");
|
|
53167
53215
|
try {
|
|
53168
53216
|
await mkdir2(dirname3(logFilePath), { recursive: true });
|
|
@@ -53200,7 +53248,8 @@ function handleError2(err2, options2) {
|
|
|
53200
53248
|
return ErrorHandler2.handle(err2, options2);
|
|
53201
53249
|
}
|
|
53202
53250
|
async function writeToLogFile2(message, options2) {
|
|
53203
|
-
const formattedMessage = `[${new Date().toISOString()}] ${message}
|
|
53251
|
+
const formattedMessage = `[${new Date().toISOString()}] ${message}
|
|
53252
|
+
`;
|
|
53204
53253
|
try {
|
|
53205
53254
|
const logFile = options2?.logFile ?? exports_config2.logging.logsPath ?? "storage/logs/stacks.log";
|
|
53206
53255
|
try {
|
|
@@ -53227,11 +53276,11 @@ var createNeverThrowError2 = (message, result, config5 = defaultErrorConfig2) =>
|
|
|
53227
53276
|
};
|
|
53228
53277
|
function __awaiter2(thisArg, _arguments, P22, generator) {
|
|
53229
53278
|
function adopt(value) {
|
|
53230
|
-
return value instanceof P22 ? value : new P22(function(
|
|
53231
|
-
|
|
53279
|
+
return value instanceof P22 ? value : new P22(function(resolve3) {
|
|
53280
|
+
resolve3(value);
|
|
53232
53281
|
});
|
|
53233
53282
|
}
|
|
53234
|
-
return new (P22 || (P22 = Promise))(function(
|
|
53283
|
+
return new (P22 || (P22 = Promise))(function(resolve3, reject) {
|
|
53235
53284
|
function fulfilled(value) {
|
|
53236
53285
|
try {
|
|
53237
53286
|
step(generator.next(value));
|
|
@@ -53247,7 +53296,7 @@ function __awaiter2(thisArg, _arguments, P22, generator) {
|
|
|
53247
53296
|
}
|
|
53248
53297
|
}
|
|
53249
53298
|
function step(result) {
|
|
53250
|
-
result.done ?
|
|
53299
|
+
result.done ? resolve3(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
53251
53300
|
}
|
|
53252
53301
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
53253
53302
|
});
|
|
@@ -53335,14 +53384,14 @@ function __asyncValues2(o) {
|
|
|
53335
53384
|
}, i);
|
|
53336
53385
|
function verb(n) {
|
|
53337
53386
|
i[n] = o[n] && function(v22) {
|
|
53338
|
-
return new Promise(function(
|
|
53339
|
-
v22 = o[n](v22), settle(
|
|
53387
|
+
return new Promise(function(resolve3, reject) {
|
|
53388
|
+
v22 = o[n](v22), settle(resolve3, reject, v22.done, v22.value);
|
|
53340
53389
|
});
|
|
53341
53390
|
};
|
|
53342
53391
|
}
|
|
53343
|
-
function settle(
|
|
53392
|
+
function settle(resolve3, reject, d, v22) {
|
|
53344
53393
|
Promise.resolve(v22).then(function(v3) {
|
|
53345
|
-
|
|
53394
|
+
resolve3({ value: v3, done: d });
|
|
53346
53395
|
}, reject);
|
|
53347
53396
|
}
|
|
53348
53397
|
}
|
|
@@ -54115,7 +54164,7 @@ function _supportsColor2(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
54115
54164
|
return min;
|
|
54116
54165
|
}
|
|
54117
54166
|
if (process112.platform === "win32") {
|
|
54118
|
-
const osRelease =
|
|
54167
|
+
const osRelease = os2.release().split(".");
|
|
54119
54168
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
54120
54169
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
54121
54170
|
}
|
|
@@ -54194,9 +54243,12 @@ function stringEncaseCRLFWithFirstIndex2(string2, prefix, postfix, index) {
|
|
|
54194
54243
|
let returnValue = "";
|
|
54195
54244
|
do {
|
|
54196
54245
|
const gotCR = string2[index - 1] === "\r";
|
|
54197
|
-
returnValue += string2.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ?
|
|
54246
|
+
returnValue += string2.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? `\r
|
|
54247
|
+
` : `
|
|
54248
|
+
`) + postfix;
|
|
54198
54249
|
endIndex = index + 1;
|
|
54199
|
-
index = string2.indexOf(
|
|
54250
|
+
index = string2.indexOf(`
|
|
54251
|
+
`, endIndex);
|
|
54200
54252
|
} while (index !== -1);
|
|
54201
54253
|
returnValue += string2.slice(endIndex);
|
|
54202
54254
|
return returnValue;
|
|
@@ -54336,7 +54388,8 @@ var applyStyle2 = (self2, string2) => {
|
|
|
54336
54388
|
styler = styler.parent;
|
|
54337
54389
|
}
|
|
54338
54390
|
}
|
|
54339
|
-
const lfIndex = string2.indexOf(
|
|
54391
|
+
const lfIndex = string2.indexOf(`
|
|
54392
|
+
`);
|
|
54340
54393
|
if (lfIndex !== -1) {
|
|
54341
54394
|
string2 = stringEncaseCRLFWithFirstIndex2(string2, closeAll, openAll, lfIndex);
|
|
54342
54395
|
}
|
|
@@ -54370,7 +54423,8 @@ var changePrototype2 = (to, from) => {
|
|
|
54370
54423
|
}
|
|
54371
54424
|
Object.setPrototypeOf(to, fromPrototype);
|
|
54372
54425
|
};
|
|
54373
|
-
var wrappedToString2 = (withName, fromBody) => `/* Wrapped ${withName}
|
|
54426
|
+
var wrappedToString2 = (withName, fromBody) => `/* Wrapped ${withName}*/
|
|
54427
|
+
${fromBody}`;
|
|
54374
54428
|
var toStringDescriptor2 = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
|
|
54375
54429
|
var toStringName2 = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
|
|
54376
54430
|
var changeToString2 = (to, from, name) => {
|
|
@@ -54971,7 +55025,8 @@ class Ora2 {
|
|
|
54971
55025
|
const fullSuffixText = this.#getFullSuffixText(this.#suffixText, "-");
|
|
54972
55026
|
const fullText = " ".repeat(this.#indent) + fullPrefixText + "--" + this.#text + "--" + fullSuffixText;
|
|
54973
55027
|
this.#lineCount = 0;
|
|
54974
|
-
for (const line of stripAnsi32(fullText).split(
|
|
55028
|
+
for (const line of stripAnsi32(fullText).split(`
|
|
55029
|
+
`)) {
|
|
54975
55030
|
this.#lineCount += Math.max(1, Math.ceil(stringWidth22(line, { countAnsiEscapeCodes: true }) / columns));
|
|
54976
55031
|
}
|
|
54977
55032
|
}
|
|
@@ -55041,7 +55096,8 @@ class Ora2 {
|
|
|
55041
55096
|
}
|
|
55042
55097
|
if (!this.#isEnabled) {
|
|
55043
55098
|
if (this.text) {
|
|
55044
|
-
this.#stream.write(`- ${this.text}
|
|
55099
|
+
this.#stream.write(`- ${this.text}
|
|
55100
|
+
`);
|
|
55045
55101
|
}
|
|
55046
55102
|
return this;
|
|
55047
55103
|
}
|
|
@@ -55099,7 +55155,8 @@ class Ora2 {
|
|
|
55099
55155
|
const fullText = typeof text22 === "string" ? " " + text22 : "";
|
|
55100
55156
|
const suffixText = options22.suffixText ?? this.#suffixText;
|
|
55101
55157
|
const fullSuffixText = this.#getFullSuffixText(suffixText, " ");
|
|
55102
|
-
const textToWrite = fullPrefixText + symbolText + fullText + fullSuffixText +
|
|
55158
|
+
const textToWrite = fullPrefixText + symbolText + fullText + fullSuffixText + `
|
|
55159
|
+
`;
|
|
55103
55160
|
this.stop();
|
|
55104
55161
|
this.#stream.write(textToWrite);
|
|
55105
55162
|
return this;
|
|
@@ -55123,7 +55180,7 @@ function deleteKeys2(obj, ...keys) {
|
|
|
55123
55180
|
});
|
|
55124
55181
|
}
|
|
55125
55182
|
var isArray2 = (item) => Array.isArray(item);
|
|
55126
|
-
function
|
|
55183
|
+
function isObject22(item) {
|
|
55127
55184
|
return typeof item === "object" && !Array.isArray(item) && item !== null;
|
|
55128
55185
|
}
|
|
55129
55186
|
var isFunction2 = (item) => typeof item === "function";
|
|
@@ -55904,7 +55961,7 @@ class Collection2 {
|
|
|
55904
55961
|
}
|
|
55905
55962
|
return new this.constructor(this.items.splice(-count));
|
|
55906
55963
|
}
|
|
55907
|
-
if (
|
|
55964
|
+
if (isObject22(this.items)) {
|
|
55908
55965
|
const keys = Object.keys(this.items);
|
|
55909
55966
|
if (count === 1) {
|
|
55910
55967
|
const key = keys[keys.length - 1];
|
|
@@ -56049,7 +56106,7 @@ class Collection2 {
|
|
|
56049
56106
|
};
|
|
56050
56107
|
if (isArray2(this.items)) {
|
|
56051
56108
|
result = this.items.findIndex(find);
|
|
56052
|
-
} else if (
|
|
56109
|
+
} else if (isObject22(this.items)) {
|
|
56053
56110
|
result = Object.keys(this.items).find((key) => find(this.items[key], key));
|
|
56054
56111
|
}
|
|
56055
56112
|
if (result === undefined || result < 0) {
|
|
@@ -56067,7 +56124,7 @@ class Collection2 {
|
|
|
56067
56124
|
}
|
|
56068
56125
|
return new this.constructor(this.items.splice(0, count));
|
|
56069
56126
|
}
|
|
56070
|
-
if (
|
|
56127
|
+
if (isObject22(this.items)) {
|
|
56071
56128
|
if (count === 1) {
|
|
56072
56129
|
const key = Object.keys(this.items)[0];
|
|
56073
56130
|
const value = this.items[key];
|
|
@@ -56100,7 +56157,7 @@ class Collection2 {
|
|
|
56100
56157
|
return this;
|
|
56101
56158
|
}
|
|
56102
56159
|
skip(number) {
|
|
56103
|
-
if (
|
|
56160
|
+
if (isObject22(this.items)) {
|
|
56104
56161
|
return new this.constructor(Object.keys(this.items).reduce((accumulator, key, index) => {
|
|
56105
56162
|
if (index + 1 > number) {
|
|
56106
56163
|
accumulator[key] = this.items[key];
|
|
@@ -56125,7 +56182,7 @@ class Collection2 {
|
|
|
56125
56182
|
return previous;
|
|
56126
56183
|
});
|
|
56127
56184
|
}
|
|
56128
|
-
if (
|
|
56185
|
+
if (isObject22(this.items)) {
|
|
56129
56186
|
items = Object.keys(this.items).reduce((acc, key) => {
|
|
56130
56187
|
if (previous !== true) {
|
|
56131
56188
|
previous = callback(this.items[key]);
|
|
@@ -56153,7 +56210,7 @@ class Collection2 {
|
|
|
56153
56210
|
return previous;
|
|
56154
56211
|
});
|
|
56155
56212
|
}
|
|
56156
|
-
if (
|
|
56213
|
+
if (isObject22(this.items)) {
|
|
56157
56214
|
items = Object.keys(this.items).reduce((acc, key) => {
|
|
56158
56215
|
if (previous !== true) {
|
|
56159
56216
|
previous = !callback(this.items[key]);
|
|
@@ -56316,7 +56373,7 @@ class Collection2 {
|
|
|
56316
56373
|
return previous;
|
|
56317
56374
|
});
|
|
56318
56375
|
}
|
|
56319
|
-
if (
|
|
56376
|
+
if (isObject22(this.items)) {
|
|
56320
56377
|
items = Object.keys(this.items).reduce((acc, key) => {
|
|
56321
56378
|
if (previous !== false) {
|
|
56322
56379
|
previous = !callback(this.items[key]);
|
|
@@ -56344,7 +56401,7 @@ class Collection2 {
|
|
|
56344
56401
|
return previous;
|
|
56345
56402
|
});
|
|
56346
56403
|
}
|
|
56347
|
-
if (
|
|
56404
|
+
if (isObject22(this.items)) {
|
|
56348
56405
|
items = Object.keys(this.items).reduce((acc, key) => {
|
|
56349
56406
|
if (previous !== false) {
|
|
56350
56407
|
previous = callback(this.items[key]);
|
|
@@ -56598,17 +56655,17 @@ class Collection2 {
|
|
|
56598
56655
|
var buildKeyPathMap3 = function buildKeyPathMap22(items) {
|
|
56599
56656
|
const keyPaths = {};
|
|
56600
56657
|
items.forEach((item, index) => {
|
|
56601
|
-
function buildKeyPath(val,
|
|
56602
|
-
if (
|
|
56658
|
+
function buildKeyPath(val, keyPath) {
|
|
56659
|
+
if (isObject22(val)) {
|
|
56603
56660
|
Object.keys(val).forEach((prop) => {
|
|
56604
|
-
buildKeyPath(val[prop], `${
|
|
56661
|
+
buildKeyPath(val[prop], `${keyPath}.${prop}`);
|
|
56605
56662
|
});
|
|
56606
56663
|
} else if (isArray2(val)) {
|
|
56607
56664
|
val.forEach((v22, i) => {
|
|
56608
|
-
buildKeyPath(v22, `${
|
|
56665
|
+
buildKeyPath(v22, `${keyPath}.${i}`);
|
|
56609
56666
|
});
|
|
56610
56667
|
}
|
|
56611
|
-
keyPaths[
|
|
56668
|
+
keyPaths[keyPath] = val;
|
|
56612
56669
|
}
|
|
56613
56670
|
buildKeyPath(item, index);
|
|
56614
56671
|
});
|
|
@@ -56646,38 +56703,52 @@ var quotes2 = collect2([
|
|
|
56646
56703
|
]);
|
|
56647
56704
|
var export_prompts2 = import_prompts2.default;
|
|
56648
56705
|
var import_node_forge2 = __toESM3(require_lib2(), 1);
|
|
56649
|
-
function
|
|
56650
|
-
if (!
|
|
56651
|
-
return
|
|
56652
|
-
|
|
56653
|
-
if (
|
|
56654
|
-
|
|
56655
|
-
|
|
56656
|
-
|
|
56657
|
-
|
|
56658
|
-
|
|
56659
|
-
|
|
56660
|
-
|
|
56661
|
-
|
|
56706
|
+
function deepMerge(target, source) {
|
|
56707
|
+
if (Array.isArray(source) && !Array.isArray(target)) {
|
|
56708
|
+
return source;
|
|
56709
|
+
}
|
|
56710
|
+
if (Array.isArray(source) && Array.isArray(target)) {
|
|
56711
|
+
return source.map((sourceItem, index) => {
|
|
56712
|
+
const targetItem = target[index];
|
|
56713
|
+
if (isObject32(sourceItem) && isObject32(targetItem)) {
|
|
56714
|
+
return deepMerge(targetItem, sourceItem);
|
|
56715
|
+
}
|
|
56716
|
+
return sourceItem;
|
|
56717
|
+
});
|
|
56718
|
+
}
|
|
56719
|
+
if (!isObject32(source) || !isObject32(target)) {
|
|
56720
|
+
return source;
|
|
56721
|
+
}
|
|
56722
|
+
const merged = { ...target };
|
|
56723
|
+
for (const key in source) {
|
|
56724
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
56725
|
+
const sourceValue = source[key];
|
|
56726
|
+
const targetValue = merged[key];
|
|
56727
|
+
if (sourceValue === null || sourceValue === undefined) {
|
|
56728
|
+
merged[key] = sourceValue;
|
|
56729
|
+
} else if (isObject32(sourceValue) && isObject32(targetValue)) {
|
|
56730
|
+
merged[key] = deepMerge(targetValue, sourceValue);
|
|
56731
|
+
} else {
|
|
56732
|
+
merged[key] = sourceValue;
|
|
56662
56733
|
}
|
|
56663
56734
|
}
|
|
56664
56735
|
}
|
|
56665
|
-
return
|
|
56736
|
+
return merged;
|
|
56666
56737
|
}
|
|
56667
56738
|
function isObject32(item) {
|
|
56668
|
-
return item && typeof item === "object" && !Array.isArray(item);
|
|
56739
|
+
return Boolean(item && typeof item === "object" && !Array.isArray(item));
|
|
56669
56740
|
}
|
|
56670
|
-
async function
|
|
56671
|
-
const configPath =
|
|
56741
|
+
async function loadConfig({ name, cwd, defaultConfig }) {
|
|
56742
|
+
const configPath = resolve(cwd || process2.cwd(), `${name}.config`);
|
|
56672
56743
|
try {
|
|
56673
56744
|
const importedConfig = await import(configPath);
|
|
56674
56745
|
const loadedConfig = importedConfig.default || importedConfig;
|
|
56675
|
-
return
|
|
56746
|
+
return deepMerge(defaultConfig, loadedConfig);
|
|
56676
56747
|
} catch (error) {
|
|
56677
56748
|
return defaultConfig;
|
|
56678
56749
|
}
|
|
56679
56750
|
}
|
|
56680
|
-
var config42 = await
|
|
56751
|
+
var config42 = await loadConfig({
|
|
56681
56752
|
name: "tls",
|
|
56682
56753
|
defaultConfig: {
|
|
56683
56754
|
altNameIPs: ["127.0.0.1"],
|
|
@@ -56687,13 +56758,13 @@ var config42 = await loadConfig2({
|
|
|
56687
56758
|
stateName: "California",
|
|
56688
56759
|
localityName: "Playa Vista",
|
|
56689
56760
|
commonName: "stacks.localhost",
|
|
56690
|
-
validityDays:
|
|
56761
|
+
validityDays: 825,
|
|
56691
56762
|
hostCertCN: "stacks.localhost",
|
|
56692
56763
|
domain: "stacks.localhost",
|
|
56693
56764
|
rootCAObject: { certificate: "", privateKey: "" },
|
|
56694
|
-
caCertPath:
|
|
56695
|
-
certPath:
|
|
56696
|
-
keyPath:
|
|
56765
|
+
caCertPath: path.join(os22.homedir(), ".stacks", "ssl", `stacks.localhost.ca.crt`),
|
|
56766
|
+
certPath: path.join(os22.homedir(), ".stacks", "ssl", `stacks.localhost.crt`),
|
|
56767
|
+
keyPath: path.join(os22.homedir(), ".stacks", "ssl", `stacks.localhost.crt.key`),
|
|
56697
56768
|
verbose: false
|
|
56698
56769
|
}
|
|
56699
56770
|
});
|
|
@@ -56709,10 +56780,10 @@ function findFoldersWithFile(rootDir, fileName) {
|
|
|
56709
56780
|
const result = [];
|
|
56710
56781
|
function search(dir) {
|
|
56711
56782
|
try {
|
|
56712
|
-
const files =
|
|
56783
|
+
const files = fs.readdirSync(dir);
|
|
56713
56784
|
for (const file of files) {
|
|
56714
|
-
const filePath =
|
|
56715
|
-
const stats =
|
|
56785
|
+
const filePath = path2.join(dir, file);
|
|
56786
|
+
const stats = fs.lstatSync(filePath);
|
|
56716
56787
|
if (stats.isDirectory()) {
|
|
56717
56788
|
search(filePath);
|
|
56718
56789
|
} else if (file === fileName) {
|
|
@@ -56726,66 +56797,83 @@ function findFoldersWithFile(rootDir, fileName) {
|
|
|
56726
56797
|
search(rootDir);
|
|
56727
56798
|
return result;
|
|
56728
56799
|
}
|
|
56729
|
-
function
|
|
56800
|
+
function debugLog(category, message, verbose) {
|
|
56730
56801
|
if (verbose || config42.verbose) {
|
|
56731
56802
|
console.debug(`[tlsx:${category}] ${message}`);
|
|
56732
56803
|
}
|
|
56733
56804
|
}
|
|
56734
|
-
function
|
|
56735
|
-
|
|
56805
|
+
function generateRandomSerial(verbose) {
|
|
56806
|
+
debugLog("cert", "Generating random serial number", verbose);
|
|
56736
56807
|
const serialNumber = makeNumberPositive(import_node_forge2.default.util.bytesToHex(import_node_forge2.default.random.getBytesSync(20)));
|
|
56737
|
-
|
|
56808
|
+
debugLog("cert", `Generated serial number: ${serialNumber}`, verbose);
|
|
56738
56809
|
return serialNumber;
|
|
56739
56810
|
}
|
|
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
|
-
|
|
56811
|
+
function calculateValidityDates(options22) {
|
|
56812
|
+
const notBeforeDays = options22.notBeforeDays ?? 2;
|
|
56813
|
+
const validityDays = options22.validityDays ?? (options22.validityYears ? options22.validityYears * 365 : 180);
|
|
56814
|
+
debugLog("cert", "Calculating certificate validity dates", options22.verbose);
|
|
56815
|
+
const notBefore = new Date(Date.now() - 86400 * notBeforeDays * 1000);
|
|
56816
|
+
const notAfter = new Date(notBefore.getTime() + validityDays * 24 * 60 * 60 * 1000);
|
|
56817
|
+
notBefore.setUTCHours(0, 0, 0, 0);
|
|
56818
|
+
notAfter.setUTCHours(23, 59, 59, 999);
|
|
56819
|
+
debugLog("cert", `Validity period: ${notBefore.toISOString()} to ${notAfter.toISOString()}`, options22.verbose);
|
|
56820
|
+
return { notBefore, notAfter };
|
|
56821
|
+
}
|
|
56822
|
+
function generateCertificateExtensions(options22) {
|
|
56823
|
+
const extensions = [];
|
|
56824
|
+
extensions.push({
|
|
56825
|
+
name: "basicConstraints",
|
|
56826
|
+
cA: options22.isCA ?? false,
|
|
56827
|
+
critical: true,
|
|
56828
|
+
...options22.basicConstraints || {}
|
|
56829
|
+
});
|
|
56830
|
+
if (options22.keyUsage) {
|
|
56831
|
+
extensions.push({
|
|
56832
|
+
name: "keyUsage",
|
|
56833
|
+
critical: true,
|
|
56834
|
+
...options22.keyUsage
|
|
56835
|
+
});
|
|
56836
|
+
}
|
|
56837
|
+
if (options22.extKeyUsage) {
|
|
56838
|
+
extensions.push({
|
|
56839
|
+
name: "extKeyUsage",
|
|
56840
|
+
...options22.extKeyUsage
|
|
56841
|
+
});
|
|
56842
|
+
}
|
|
56843
|
+
if (options22.subjectAltNames && options22.subjectAltNames.length > 0) {
|
|
56844
|
+
extensions.push({
|
|
56845
|
+
name: "subjectAltName",
|
|
56846
|
+
altNames: options22.subjectAltNames
|
|
56847
|
+
});
|
|
56848
|
+
}
|
|
56849
|
+
return extensions;
|
|
56850
|
+
}
|
|
56851
|
+
async function createRootCA(options22 = {}) {
|
|
56852
|
+
debugLog("ca", "Creating new Root CA Certificate", options22.verbose);
|
|
56853
|
+
const keySize = options22.keySize || 2048;
|
|
56854
|
+
debugLog("ca", `Generating ${keySize}-bit RSA key pair`, options22.verbose);
|
|
56855
|
+
const { privateKey, publicKey } = import_node_forge2.pki.rsa.generateKeyPair(keySize);
|
|
56780
56856
|
const attributes = [
|
|
56781
|
-
{ shortName: "C", value:
|
|
56782
|
-
{ shortName: "ST", value:
|
|
56783
|
-
{ shortName: "L", value:
|
|
56784
|
-
{ shortName: "O", value: "Local Development CA" },
|
|
56785
|
-
{ shortName: "
|
|
56857
|
+
{ shortName: "C", value: options22.countryName || config42.countryName },
|
|
56858
|
+
{ shortName: "ST", value: options22.stateName || config42.stateName },
|
|
56859
|
+
{ shortName: "L", value: options22.localityName || config42.localityName },
|
|
56860
|
+
{ shortName: "O", value: options22.organization || "Local Development CA" },
|
|
56861
|
+
{ shortName: "OU", value: options22.organizationalUnit || "Certificate Authority" },
|
|
56862
|
+
{ shortName: "CN", value: options22.commonName || "Local Development Root CA" },
|
|
56863
|
+
...options22.extraAttributes || []
|
|
56786
56864
|
];
|
|
56787
|
-
|
|
56788
|
-
|
|
56865
|
+
const { notBefore, notAfter } = calculateValidityDates({
|
|
56866
|
+
validityYears: options22.validityYears || 100,
|
|
56867
|
+
verbose: options22.verbose
|
|
56868
|
+
});
|
|
56869
|
+
const caCert = import_node_forge2.pki.createCertificate();
|
|
56870
|
+
caCert.publicKey = publicKey;
|
|
56871
|
+
caCert.serialNumber = generateRandomSerial(options22.verbose);
|
|
56872
|
+
caCert.validity.notBefore = notBefore;
|
|
56873
|
+
caCert.validity.notAfter = notAfter;
|
|
56874
|
+
caCert.setSubject(attributes);
|
|
56875
|
+
caCert.setIssuer(attributes);
|
|
56876
|
+
caCert.setExtensions([
|
|
56789
56877
|
{
|
|
56790
56878
|
name: "basicConstraints",
|
|
56791
56879
|
cA: true,
|
|
@@ -56800,361 +56888,589 @@ async function createRootCA(options22) {
|
|
|
56800
56888
|
{
|
|
56801
56889
|
name: "subjectKeyIdentifier"
|
|
56802
56890
|
}
|
|
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);
|
|
56891
|
+
]);
|
|
56814
56892
|
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
56893
|
return {
|
|
56819
|
-
certificate:
|
|
56820
|
-
privateKey:
|
|
56821
|
-
notBefore
|
|
56822
|
-
notAfter
|
|
56894
|
+
certificate: import_node_forge2.pki.certificateToPem(caCert),
|
|
56895
|
+
privateKey: import_node_forge2.pki.privateKeyToPem(privateKey),
|
|
56896
|
+
notBefore,
|
|
56897
|
+
notAfter
|
|
56823
56898
|
};
|
|
56824
56899
|
}
|
|
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');
|
|
56900
|
+
async function generateCertificate(options22) {
|
|
56901
|
+
debugLog("cert", "Generating new certificate", options22.verbose);
|
|
56902
|
+
debugLog("cert", `Options: ${JSON.stringify(options22)}`, options22.verbose);
|
|
56903
|
+
if (!options22.rootCAObject?.certificate || !options22.rootCAObject?.privateKey) {
|
|
56904
|
+
throw new Error("Root CA certificate and private key are required");
|
|
56835
56905
|
}
|
|
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"');
|
|
56839
|
-
}
|
|
56840
|
-
debugLog2("cert", "Converting Root CA PEM to forge objects", options22?.verbose);
|
|
56841
56906
|
const caCert = import_node_forge2.pki.certificateFromPem(options22.rootCAObject.certificate);
|
|
56842
56907
|
const caKey = import_node_forge2.pki.privateKeyFromPem(options22.rootCAObject.privateKey);
|
|
56843
|
-
|
|
56844
|
-
const
|
|
56845
|
-
|
|
56846
|
-
const attributes = [
|
|
56908
|
+
debugLog("cert", "Generating 2048-bit RSA key pair for host certificate", options22?.verbose);
|
|
56909
|
+
const keySize = 2048;
|
|
56910
|
+
const { privateKey, publicKey } = import_node_forge2.pki.rsa.generateKeyPair(keySize);
|
|
56911
|
+
const attributes = options22.certificateAttributes || [
|
|
56847
56912
|
{ shortName: "C", value: options22.countryName || config42.countryName },
|
|
56848
56913
|
{ shortName: "ST", value: options22.stateName || config42.stateName },
|
|
56849
56914
|
{ shortName: "L", value: options22.localityName || config42.localityName },
|
|
56850
56915
|
{ shortName: "O", value: options22.organizationName || config42.organizationName },
|
|
56851
56916
|
{ shortName: "CN", value: options22.commonName || config42.commonName }
|
|
56852
56917
|
];
|
|
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);
|
|
56918
|
+
const { notBefore, notAfter } = calculateValidityDates({
|
|
56919
|
+
validityDays: options22.validityDays,
|
|
56920
|
+
verbose: options22.verbose
|
|
56921
|
+
});
|
|
56922
|
+
const cert = import_node_forge2.pki.createCertificate();
|
|
56923
|
+
cert.publicKey = publicKey;
|
|
56924
|
+
cert.serialNumber = generateRandomSerial(options22.verbose);
|
|
56925
|
+
cert.validity.notBefore = notBefore;
|
|
56926
|
+
cert.validity.notAfter = notAfter;
|
|
56927
|
+
cert.setSubject(attributes);
|
|
56928
|
+
cert.setIssuer(caCert.subject.attributes);
|
|
56929
|
+
cert.setExtensions(generateCertificateExtensions(options22));
|
|
56930
|
+
cert.sign(caKey, import_node_forge2.default.md.sha256.create());
|
|
56899
56931
|
return {
|
|
56900
|
-
certificate:
|
|
56901
|
-
privateKey:
|
|
56902
|
-
notBefore
|
|
56903
|
-
notAfter
|
|
56932
|
+
certificate: import_node_forge2.pki.certificateToPem(cert),
|
|
56933
|
+
privateKey: import_node_forge2.pki.privateKeyToPem(privateKey),
|
|
56934
|
+
notBefore,
|
|
56935
|
+
notAfter
|
|
56904
56936
|
};
|
|
56905
56937
|
}
|
|
56906
56938
|
async function addCertToSystemTrustStoreAndSaveCert(cert, caCert, options22) {
|
|
56907
|
-
|
|
56908
|
-
|
|
56909
|
-
const
|
|
56910
|
-
|
|
56911
|
-
const
|
|
56939
|
+
debugLog("trust", `Adding certificate to system trust store with options: ${JSON.stringify(options22)}`, options22?.verbose);
|
|
56940
|
+
debugLog("trust", "Storing certificate and private key", options22?.verbose);
|
|
56941
|
+
const certPath = storeCertificate(cert, options22);
|
|
56942
|
+
debugLog("trust", "Storing CA certificate", options22?.verbose);
|
|
56943
|
+
const caCertPath = storeCACertificate(caCert, options22);
|
|
56912
56944
|
const platform22 = os4.platform();
|
|
56913
|
-
|
|
56945
|
+
debugLog("trust", `Detected platform: ${platform22}`, options22?.verbose);
|
|
56914
56946
|
const args = "TC, C, C";
|
|
56915
56947
|
if (platform22 === "darwin") {
|
|
56916
|
-
|
|
56917
|
-
await runCommand(`sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ${
|
|
56948
|
+
debugLog("trust", "Adding certificate to macOS keychain", options22?.verbose);
|
|
56949
|
+
await runCommand(`sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ${caCertPath}`);
|
|
56918
56950
|
} else if (platform22 === "win32") {
|
|
56919
|
-
|
|
56920
|
-
await runCommand(`certutil -f -v -addstore -enterprise Root ${
|
|
56951
|
+
debugLog("trust", "Adding certificate to Windows certificate store", options22?.verbose);
|
|
56952
|
+
await runCommand(`certutil -f -v -addstore -enterprise Root ${caCertPath}`);
|
|
56921
56953
|
} else if (platform22 === "linux") {
|
|
56922
|
-
|
|
56954
|
+
debugLog("trust", "Adding certificate to Linux certificate store", options22?.verbose);
|
|
56923
56955
|
const rootDirectory = os4.homedir();
|
|
56924
56956
|
const targetFileName = "cert9.db";
|
|
56925
|
-
|
|
56957
|
+
debugLog("trust", `Searching for certificate databases in ${rootDirectory}`, options22?.verbose);
|
|
56926
56958
|
const foldersWithFile = findFoldersWithFile(rootDirectory, targetFileName);
|
|
56927
56959
|
for (const folder of foldersWithFile) {
|
|
56928
|
-
|
|
56960
|
+
debugLog("trust", `Processing certificate database in ${folder}`, options22?.verbose);
|
|
56929
56961
|
try {
|
|
56930
|
-
|
|
56962
|
+
debugLog("trust", `Attempting to delete existing cert for ${config42.commonName}`, options22?.verbose);
|
|
56931
56963
|
await runCommand(`certutil -d sql:${folder} -D -n ${config42.commonName}`);
|
|
56932
56964
|
} catch (error) {
|
|
56933
|
-
|
|
56965
|
+
debugLog("trust", `Warning: Error deleting existing cert: ${error}`, options22?.verbose);
|
|
56934
56966
|
console.warn(`Error deleting existing cert: ${error}`);
|
|
56935
56967
|
}
|
|
56936
|
-
|
|
56937
|
-
await runCommand(`certutil -d sql:${folder} -A -t ${args} -n ${config42.commonName} -i ${
|
|
56968
|
+
debugLog("trust", `Adding new certificate to ${folder}`, options22?.verbose);
|
|
56969
|
+
await runCommand(`certutil -d sql:${folder} -A -t ${args} -n ${config42.commonName} -i ${caCertPath}`);
|
|
56938
56970
|
log2.info(`Cert added to ${folder}`);
|
|
56939
56971
|
}
|
|
56940
56972
|
} else {
|
|
56941
|
-
|
|
56973
|
+
debugLog("trust", `Error: Unsupported platform ${platform22}`, options22?.verbose);
|
|
56942
56974
|
throw new Error(`Unsupported platform: ${platform22}`);
|
|
56943
56975
|
}
|
|
56944
|
-
|
|
56945
|
-
return
|
|
56976
|
+
debugLog("trust", "Certificate successfully added to system trust store", options22?.verbose);
|
|
56977
|
+
return certPath;
|
|
56946
56978
|
}
|
|
56947
|
-
function
|
|
56948
|
-
|
|
56949
|
-
const
|
|
56979
|
+
function storeCertificate(cert, options22) {
|
|
56980
|
+
debugLog("storage", `Storing certificate and private key with options: ${JSON.stringify(options22)}`, options22?.verbose);
|
|
56981
|
+
const certPath = options22?.certPath || config42.certPath;
|
|
56950
56982
|
const certKeyPath = options22?.keyPath || config42.keyPath;
|
|
56951
|
-
|
|
56952
|
-
|
|
56953
|
-
const certDir = path3.dirname(
|
|
56983
|
+
debugLog("storage", `Certificate path: ${certPath}`, options22?.verbose);
|
|
56984
|
+
debugLog("storage", `Private key path: ${certKeyPath}`, options22?.verbose);
|
|
56985
|
+
const certDir = path3.dirname(certPath);
|
|
56954
56986
|
if (!fs2.existsSync(certDir)) {
|
|
56955
|
-
|
|
56987
|
+
debugLog("storage", `Creating certificate directory: ${certDir}`, options22?.verbose);
|
|
56956
56988
|
fs2.mkdirSync(certDir, { recursive: true });
|
|
56957
56989
|
}
|
|
56958
|
-
|
|
56959
|
-
fs2.writeFileSync(
|
|
56990
|
+
debugLog("storage", "Writing certificate file", options22?.verbose);
|
|
56991
|
+
fs2.writeFileSync(certPath, cert.certificate);
|
|
56960
56992
|
const certKeyDir = path3.dirname(certKeyPath);
|
|
56961
56993
|
if (!fs2.existsSync(certKeyDir)) {
|
|
56962
|
-
|
|
56994
|
+
debugLog("storage", `Creating private key directory: ${certKeyDir}`, options22?.verbose);
|
|
56963
56995
|
fs2.mkdirSync(certKeyDir, { recursive: true });
|
|
56964
56996
|
}
|
|
56965
|
-
|
|
56997
|
+
debugLog("storage", "Writing private key file", options22?.verbose);
|
|
56966
56998
|
fs2.writeFileSync(certKeyPath, cert.privateKey);
|
|
56967
|
-
|
|
56968
|
-
return
|
|
56969
|
-
}
|
|
56970
|
-
function
|
|
56971
|
-
|
|
56972
|
-
const
|
|
56973
|
-
|
|
56974
|
-
const caCertDir = path3.dirname(
|
|
56999
|
+
debugLog("storage", "Certificate and private key stored successfully", options22?.verbose);
|
|
57000
|
+
return certPath;
|
|
57001
|
+
}
|
|
57002
|
+
function storeCACertificate(caCert, options22) {
|
|
57003
|
+
debugLog("storage", "Storing CA certificate", options22?.verbose);
|
|
57004
|
+
const caCertPath = options22?.caCertPath || config42.caCertPath;
|
|
57005
|
+
debugLog("storage", `CA certificate path: ${caCertPath}`, options22?.verbose);
|
|
57006
|
+
const caCertDir = path3.dirname(caCertPath);
|
|
56975
57007
|
if (!fs2.existsSync(caCertDir)) {
|
|
56976
|
-
|
|
57008
|
+
debugLog("storage", `Creating CA certificate directory: ${caCertDir}`, options22?.verbose);
|
|
56977
57009
|
fs2.mkdirSync(caCertDir, { recursive: true });
|
|
56978
57010
|
}
|
|
56979
|
-
|
|
56980
|
-
fs2.writeFileSync(
|
|
56981
|
-
|
|
56982
|
-
return
|
|
57011
|
+
debugLog("storage", "Writing CA certificate file", options22?.verbose);
|
|
57012
|
+
fs2.writeFileSync(caCertPath, caCert);
|
|
57013
|
+
debugLog("storage", "CA certificate stored successfully", options22?.verbose);
|
|
57014
|
+
return caCertPath;
|
|
56983
57015
|
}
|
|
56984
57016
|
var export_tls = import_node_forge2.tls;
|
|
56985
57017
|
var export_pki = import_node_forge2.pki;
|
|
56986
57018
|
var export_forge = import_node_forge2.default;
|
|
56987
57019
|
|
|
57020
|
+
// src/config.ts
|
|
57021
|
+
import os3 from "os";
|
|
57022
|
+
import path4 from "path";
|
|
57023
|
+
|
|
57024
|
+
// node_modules/bun-config/dist/index.js
|
|
57025
|
+
import { resolve as resolve3 } from "path";
|
|
57026
|
+
import process3 from "process";
|
|
57027
|
+
function deepMerge2(target, source) {
|
|
57028
|
+
if (Array.isArray(source) && !Array.isArray(target)) {
|
|
57029
|
+
return source;
|
|
57030
|
+
}
|
|
57031
|
+
if (Array.isArray(source) && Array.isArray(target)) {
|
|
57032
|
+
return source.map((sourceItem, index) => {
|
|
57033
|
+
const targetItem = target[index];
|
|
57034
|
+
if (isObject5(sourceItem) && isObject5(targetItem)) {
|
|
57035
|
+
return deepMerge2(targetItem, sourceItem);
|
|
57036
|
+
}
|
|
57037
|
+
return sourceItem;
|
|
57038
|
+
});
|
|
57039
|
+
}
|
|
57040
|
+
if (!isObject5(source) || !isObject5(target)) {
|
|
57041
|
+
return source;
|
|
57042
|
+
}
|
|
57043
|
+
const merged = { ...target };
|
|
57044
|
+
for (const key in source) {
|
|
57045
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
57046
|
+
const sourceValue = source[key];
|
|
57047
|
+
const targetValue = merged[key];
|
|
57048
|
+
if (sourceValue === null || sourceValue === undefined) {
|
|
57049
|
+
merged[key] = sourceValue;
|
|
57050
|
+
} else if (isObject5(sourceValue) && isObject5(targetValue)) {
|
|
57051
|
+
merged[key] = deepMerge2(targetValue, sourceValue);
|
|
57052
|
+
} else {
|
|
57053
|
+
merged[key] = sourceValue;
|
|
57054
|
+
}
|
|
57055
|
+
}
|
|
57056
|
+
}
|
|
57057
|
+
return merged;
|
|
57058
|
+
}
|
|
57059
|
+
function isObject5(item) {
|
|
57060
|
+
return Boolean(item && typeof item === "object" && !Array.isArray(item));
|
|
57061
|
+
}
|
|
57062
|
+
async function loadConfig2({ name, cwd, defaultConfig }) {
|
|
57063
|
+
const configPath = resolve3(cwd || process3.cwd(), `${name}.config`);
|
|
57064
|
+
try {
|
|
57065
|
+
const importedConfig = await import(configPath);
|
|
57066
|
+
const loadedConfig = importedConfig.default || importedConfig;
|
|
57067
|
+
return deepMerge2(defaultConfig, loadedConfig);
|
|
57068
|
+
} catch (error) {
|
|
57069
|
+
return defaultConfig;
|
|
57070
|
+
}
|
|
57071
|
+
}
|
|
57072
|
+
|
|
57073
|
+
// src/config.ts
|
|
57074
|
+
var config6 = await loadConfig2({
|
|
57075
|
+
name: "reverse-proxy",
|
|
57076
|
+
defaultConfig: {
|
|
57077
|
+
from: "localhost:5173",
|
|
57078
|
+
to: "stacks.localhost",
|
|
57079
|
+
https: {
|
|
57080
|
+
caCertPath: path4.join(os3.homedir(), ".stacks", "ssl", `stacks.localhost.ca.crt`),
|
|
57081
|
+
certPath: path4.join(os3.homedir(), ".stacks", "ssl", `stacks.localhost.crt`),
|
|
57082
|
+
keyPath: path4.join(os3.homedir(), ".stacks", "ssl", `stacks.localhost.crt.key`)
|
|
57083
|
+
},
|
|
57084
|
+
etcHostsCleanup: true,
|
|
57085
|
+
verbose: false
|
|
57086
|
+
}
|
|
57087
|
+
});
|
|
57088
|
+
|
|
56988
57089
|
// src/https.ts
|
|
56989
|
-
|
|
56990
|
-
|
|
56991
|
-
|
|
56992
|
-
|
|
56993
|
-
|
|
56994
|
-
|
|
56995
|
-
|
|
56996
|
-
|
|
56997
|
-
|
|
56998
|
-
|
|
56999
|
-
|
|
57090
|
+
var cachedSSLConfig = null;
|
|
57091
|
+
function isMultiProxyConfig(options3) {
|
|
57092
|
+
return "proxies" in options3;
|
|
57093
|
+
}
|
|
57094
|
+
function generateWildcardPatterns(domain) {
|
|
57095
|
+
const patterns = new Set;
|
|
57096
|
+
patterns.add(domain);
|
|
57097
|
+
const parts = domain.split(".");
|
|
57098
|
+
if (parts.length >= 2) {
|
|
57099
|
+
patterns.add(`*.${parts.slice(1).join(".")}`);
|
|
57100
|
+
}
|
|
57101
|
+
return Array.from(patterns);
|
|
57102
|
+
}
|
|
57103
|
+
function generateBaseConfig(options3, verbose) {
|
|
57104
|
+
const domains = extractDomains(options3);
|
|
57105
|
+
const sslBase = path6.join(os5.homedir(), ".stacks", "ssl");
|
|
57106
|
+
const httpsConfig = options3.https === true ? {
|
|
57107
|
+
caCertPath: path6.join(sslBase, "rpx-ca.crt"),
|
|
57108
|
+
certPath: path6.join(sslBase, "rpx.crt"),
|
|
57109
|
+
keyPath: path6.join(sslBase, "rpx.key")
|
|
57110
|
+
} : typeof config6.https === "object" ? {
|
|
57111
|
+
...options3.https,
|
|
57112
|
+
...config6.https
|
|
57113
|
+
} : {};
|
|
57114
|
+
debugLog2("ssl", `Extracted domains: ${domains.join(", ")}`, verbose);
|
|
57115
|
+
debugLog2("ssl", `Using SSL base path: ${sslBase}`, verbose);
|
|
57116
|
+
debugLog2("ssl", `Using HTTPS config: ${JSON.stringify(httpsConfig)}`, verbose);
|
|
57117
|
+
const allPatterns = new Set;
|
|
57118
|
+
domains.forEach((domain) => {
|
|
57119
|
+
allPatterns.add(domain);
|
|
57120
|
+
generateWildcardPatterns(domain).forEach((pattern) => allPatterns.add(pattern));
|
|
57121
|
+
});
|
|
57122
|
+
allPatterns.add("localhost");
|
|
57123
|
+
allPatterns.add("*.localhost");
|
|
57124
|
+
const uniqueDomains = Array.from(allPatterns);
|
|
57125
|
+
debugLog2("ssl", `Generated domain patterns: ${uniqueDomains.join(", ")}`, verbose);
|
|
57126
|
+
return {
|
|
57127
|
+
domain: domains[0],
|
|
57128
|
+
hostCertCN: domains[0],
|
|
57129
|
+
caCertPath: httpsConfig?.caCertPath ?? path6.join(sslBase, "rpx-ca.crt"),
|
|
57130
|
+
certPath: httpsConfig?.certPath ?? path6.join(sslBase, "rpx.crt"),
|
|
57131
|
+
keyPath: httpsConfig?.keyPath ?? path6.join(sslBase, "rpx.key"),
|
|
57132
|
+
altNameIPs: httpsConfig?.altNameIPs ?? ["127.0.0.1", "::1"],
|
|
57133
|
+
altNameURIs: httpsConfig?.altNameURIs ?? [],
|
|
57134
|
+
commonName: httpsConfig?.commonName ?? domains[0],
|
|
57135
|
+
organizationName: httpsConfig?.organizationName ?? "Local Development",
|
|
57136
|
+
countryName: httpsConfig?.countryName ?? "US",
|
|
57137
|
+
stateName: httpsConfig?.stateName ?? "California",
|
|
57138
|
+
localityName: httpsConfig?.localityName ?? "Playa Vista",
|
|
57139
|
+
validityDays: httpsConfig?.validityDays ?? 825,
|
|
57140
|
+
verbose: verbose ?? false,
|
|
57141
|
+
subjectAltNames: uniqueDomains.map((domain) => ({
|
|
57142
|
+
type: 2,
|
|
57143
|
+
value: domain
|
|
57144
|
+
}))
|
|
57145
|
+
};
|
|
57146
|
+
}
|
|
57147
|
+
function generateRootCAConfig(verbose = false) {
|
|
57148
|
+
const sslBase = path6.join(os5.homedir(), ".stacks", "ssl");
|
|
57149
|
+
return {
|
|
57150
|
+
domain: "stacks.localhost",
|
|
57151
|
+
hostCertCN: "stacks.localhost",
|
|
57152
|
+
caCertPath: path6.join(sslBase, "rpx-root-ca.crt"),
|
|
57153
|
+
certPath: path6.join(sslBase, "rpx-certificate.crt"),
|
|
57154
|
+
keyPath: path6.join(sslBase, "rpx-certificate.key"),
|
|
57155
|
+
altNameIPs: ["127.0.0.1", "::1"],
|
|
57156
|
+
altNameURIs: [],
|
|
57157
|
+
organizationName: "Stacks Local Development",
|
|
57000
57158
|
countryName: "US",
|
|
57001
57159
|
stateName: "California",
|
|
57002
57160
|
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
|
|
57161
|
+
commonName: "stacks.localhost",
|
|
57162
|
+
validityDays: 3650,
|
|
57163
|
+
verbose
|
|
57012
57164
|
};
|
|
57013
57165
|
}
|
|
57014
|
-
|
|
57015
|
-
|
|
57016
|
-
|
|
57017
|
-
|
|
57166
|
+
function httpsConfig(options3) {
|
|
57167
|
+
return generateBaseConfig(options3, options3.verbose);
|
|
57168
|
+
}
|
|
57169
|
+
async function generateCertificate2(options3) {
|
|
57170
|
+
if (cachedSSLConfig) {
|
|
57171
|
+
const verbose2 = isMultiProxyConfig(options3) ? options3.verbose : options3.verbose;
|
|
57172
|
+
debugLog2("ssl", "Using cached SSL configuration", verbose2);
|
|
57018
57173
|
return;
|
|
57019
|
-
|
|
57020
|
-
|
|
57021
|
-
const
|
|
57022
|
-
|
|
57023
|
-
|
|
57024
|
-
|
|
57025
|
-
|
|
57026
|
-
|
|
57027
|
-
|
|
57028
|
-
|
|
57029
|
-
|
|
57030
|
-
organizationName: config.https.organizationName,
|
|
57031
|
-
validityDays: config.https.validityDays,
|
|
57174
|
+
}
|
|
57175
|
+
const domains = isMultiProxyConfig(options3) ? [options3.proxies[0].to, ...options3.proxies.map((proxy) => proxy.to)] : [options3.to];
|
|
57176
|
+
const verbose = isMultiProxyConfig(options3) ? options3.verbose : options3.verbose;
|
|
57177
|
+
debugLog2("ssl", `Generating certificate for domains: ${domains.join(", ")}`, verbose);
|
|
57178
|
+
const rootCAConfig = generateRootCAConfig(verbose);
|
|
57179
|
+
log.info("Generating Root CA certificate...");
|
|
57180
|
+
const caCert = await createRootCA(rootCAConfig);
|
|
57181
|
+
const hostConfig = generateBaseConfig(options3, verbose);
|
|
57182
|
+
log.info(`Generating host certificate for: ${domains.join(", ")}`);
|
|
57183
|
+
const hostCert = await generateCertificate({
|
|
57184
|
+
...hostConfig,
|
|
57032
57185
|
rootCAObject: {
|
|
57033
57186
|
certificate: caCert.certificate,
|
|
57034
57187
|
privateKey: caCert.privateKey
|
|
57035
|
-
}
|
|
57036
|
-
|
|
57188
|
+
}
|
|
57189
|
+
});
|
|
57190
|
+
await addCertToSystemTrustStoreAndSaveCert(hostCert, caCert.certificate, hostConfig);
|
|
57191
|
+
cachedSSLConfig = {
|
|
57192
|
+
key: hostCert.privateKey,
|
|
57193
|
+
cert: hostCert.certificate,
|
|
57194
|
+
ca: caCert.certificate
|
|
57195
|
+
};
|
|
57196
|
+
log.success(`Certificate generated successfully for ${domains.length} domain${domains.length > 1 ? "s" : ""}`);
|
|
57197
|
+
debugLog2("ssl", `Certificate includes domains: ${domains.join(", ")}`, verbose);
|
|
57198
|
+
}
|
|
57199
|
+
function getSSLConfig() {
|
|
57200
|
+
return cachedSSLConfig;
|
|
57201
|
+
}
|
|
57202
|
+
|
|
57203
|
+
// src/utils.ts
|
|
57204
|
+
function debugLog2(category, message, verbose) {
|
|
57205
|
+
if (verbose) {
|
|
57206
|
+
console.debug(`[rpx:${category}] ${message}`);
|
|
57207
|
+
}
|
|
57208
|
+
}
|
|
57209
|
+
function extractDomains(options3) {
|
|
57210
|
+
if (isMultiProxyConfig(options3)) {
|
|
57211
|
+
return options3.proxies.map((proxy) => {
|
|
57212
|
+
const domain2 = proxy.to || "stacks.localhost";
|
|
57213
|
+
return domain2.startsWith("http") ? new URL(domain2).hostname : domain2;
|
|
57214
|
+
});
|
|
57215
|
+
}
|
|
57216
|
+
const domain = options3.to || "stacks.localhost";
|
|
57217
|
+
return [domain.startsWith("http") ? new URL(domain).hostname : domain];
|
|
57218
|
+
}
|
|
57219
|
+
|
|
57220
|
+
// src/hosts.ts
|
|
57221
|
+
var hostsFilePath = process9.platform === "win32" ? path7.join(process9.env.windir || "C:\\Windows", "System32", "drivers", "etc", "hosts") : "/etc/hosts";
|
|
57222
|
+
async function sudoWrite(operation, content) {
|
|
57223
|
+
return new Promise((resolve4, reject) => {
|
|
57224
|
+
if (process9.platform === "win32") {
|
|
57225
|
+
reject(new Error("Administrator privileges required on Windows"));
|
|
57226
|
+
return;
|
|
57227
|
+
}
|
|
57228
|
+
const tmpFile = path7.join(os7.tmpdir(), "hosts.tmp");
|
|
57229
|
+
try {
|
|
57230
|
+
if (operation === "append") {
|
|
57231
|
+
const currentContent = fs3.readFileSync(hostsFilePath, "utf8");
|
|
57232
|
+
fs3.writeFileSync(tmpFile, currentContent + content, "utf8");
|
|
57233
|
+
} else {
|
|
57234
|
+
fs3.writeFileSync(tmpFile, content, "utf8");
|
|
57235
|
+
}
|
|
57236
|
+
const sudo = spawn("sudo", ["cp", tmpFile, hostsFilePath]);
|
|
57237
|
+
sudo.on("close", (code) => {
|
|
57238
|
+
try {
|
|
57239
|
+
fs3.unlinkSync(tmpFile);
|
|
57240
|
+
if (code === 0)
|
|
57241
|
+
resolve4();
|
|
57242
|
+
else
|
|
57243
|
+
reject(new Error(`sudo process exited with code ${code}`));
|
|
57244
|
+
} catch (err3) {
|
|
57245
|
+
reject(err3);
|
|
57246
|
+
}
|
|
57247
|
+
});
|
|
57248
|
+
sudo.on("error", (err3) => {
|
|
57249
|
+
try {
|
|
57250
|
+
fs3.unlinkSync(tmpFile);
|
|
57251
|
+
} catch {
|
|
57252
|
+
}
|
|
57253
|
+
reject(err3);
|
|
57254
|
+
});
|
|
57255
|
+
} catch (err3) {
|
|
57256
|
+
reject(err3);
|
|
57257
|
+
}
|
|
57258
|
+
});
|
|
57259
|
+
}
|
|
57260
|
+
async function addHosts(hosts, verbose) {
|
|
57261
|
+
debugLog2("hosts", `Adding hosts: ${hosts.join(", ")}`, verbose);
|
|
57262
|
+
debugLog2("hosts", `Using hosts file at: ${hostsFilePath}`, verbose);
|
|
57263
|
+
try {
|
|
57264
|
+
const existingContent = await fs3.promises.readFile(hostsFilePath, "utf-8");
|
|
57265
|
+
const newEntries = hosts.filter((host) => {
|
|
57266
|
+
const ipv4Entry = `127.0.0.1 ${host}`;
|
|
57267
|
+
const ipv6Entry = `::1 ${host}`;
|
|
57268
|
+
return !existingContent.includes(ipv4Entry) && !existingContent.includes(ipv6Entry);
|
|
57269
|
+
});
|
|
57270
|
+
if (newEntries.length === 0) {
|
|
57271
|
+
debugLog2("hosts", "All hosts already exist in hosts file", verbose);
|
|
57272
|
+
log.info("All hosts are already in the hosts file");
|
|
57273
|
+
return;
|
|
57274
|
+
}
|
|
57275
|
+
const hostEntries = newEntries.map((host) => `
|
|
57276
|
+
# Added by rpx
|
|
57277
|
+
127.0.0.1 ${host}
|
|
57278
|
+
::1 ${host}`).join(`
|
|
57279
|
+
`);
|
|
57280
|
+
try {
|
|
57281
|
+
await fs3.promises.appendFile(hostsFilePath, hostEntries, { flag: "a" });
|
|
57282
|
+
log.success(`Added new hosts: ${newEntries.join(", ")}`);
|
|
57283
|
+
} catch (writeErr) {
|
|
57284
|
+
if (writeErr.code === "EACCES") {
|
|
57285
|
+
debugLog2("hosts", "Permission denied, attempting with sudo", verbose);
|
|
57286
|
+
try {
|
|
57287
|
+
await sudoWrite("append", hostEntries);
|
|
57288
|
+
log.success(`Added new hosts with sudo: ${newEntries.join(", ")}`);
|
|
57289
|
+
} catch (sudoErr) {
|
|
57290
|
+
log.error("Failed to modify hosts file automatically");
|
|
57291
|
+
log.warn("Please add these entries to your hosts file manually:");
|
|
57292
|
+
hostEntries.split(`
|
|
57293
|
+
`).forEach((entry) => log.warn(entry));
|
|
57294
|
+
if (process9.platform === "win32") {
|
|
57295
|
+
log.warn(`
|
|
57296
|
+
On Windows:`);
|
|
57297
|
+
log.warn("1. Run notepad as administrator");
|
|
57298
|
+
log.warn("2. Open C:\\Windows\\System32\\drivers\\etc\\hosts");
|
|
57299
|
+
} else {
|
|
57300
|
+
log.warn(`
|
|
57301
|
+
On Unix systems:`);
|
|
57302
|
+
log.warn(`sudo nano ${hostsFilePath}`);
|
|
57303
|
+
}
|
|
57304
|
+
throw new Error("Failed to modify hosts file: manual intervention required");
|
|
57305
|
+
}
|
|
57306
|
+
} else {
|
|
57307
|
+
throw writeErr;
|
|
57308
|
+
}
|
|
57309
|
+
}
|
|
57310
|
+
} catch (err3) {
|
|
57311
|
+
const error = err3;
|
|
57312
|
+
log.error(`Failed to manage hosts file: ${error.message}`);
|
|
57313
|
+
throw error;
|
|
57314
|
+
}
|
|
57315
|
+
}
|
|
57316
|
+
async function removeHosts(hosts, verbose) {
|
|
57317
|
+
debugLog2("hosts", `Removing hosts: ${hosts.join(", ")}`, verbose);
|
|
57318
|
+
try {
|
|
57319
|
+
const content = await fs3.promises.readFile(hostsFilePath, "utf-8");
|
|
57320
|
+
const lines = content.split(`
|
|
57321
|
+
`);
|
|
57322
|
+
const filteredLines = lines.filter((line, index) => {
|
|
57323
|
+
if (line.trim() === "# Added by rpx") {
|
|
57324
|
+
lines.splice(index + 1, 2);
|
|
57325
|
+
return false;
|
|
57326
|
+
}
|
|
57327
|
+
return true;
|
|
57328
|
+
});
|
|
57329
|
+
while (filteredLines[filteredLines.length - 1]?.trim() === "")
|
|
57330
|
+
filteredLines.pop();
|
|
57331
|
+
const newContent = `${filteredLines.join(`
|
|
57332
|
+
`)}
|
|
57333
|
+
`;
|
|
57334
|
+
try {
|
|
57335
|
+
await fs3.promises.writeFile(hostsFilePath, newContent);
|
|
57336
|
+
log.success("Hosts removed successfully");
|
|
57337
|
+
} catch (writeErr) {
|
|
57338
|
+
if (writeErr.code === "EACCES") {
|
|
57339
|
+
debugLog2("hosts", "Permission denied, attempting with sudo", verbose);
|
|
57340
|
+
try {
|
|
57341
|
+
await sudoWrite("write", newContent);
|
|
57342
|
+
log.success("Hosts removed successfully with sudo");
|
|
57343
|
+
} catch (sudoErr) {
|
|
57344
|
+
log.error("Failed to modify hosts file automatically");
|
|
57345
|
+
log.warn("Please remove these entries from your hosts file manually:");
|
|
57346
|
+
hosts.forEach((host) => {
|
|
57347
|
+
log.warn("# Added by rpx");
|
|
57348
|
+
log.warn(`127.0.0.1 ${host}`);
|
|
57349
|
+
log.warn(`::1 ${host}`);
|
|
57350
|
+
});
|
|
57351
|
+
if (process9.platform === "win32") {
|
|
57352
|
+
log.warn(`
|
|
57353
|
+
On Windows:`);
|
|
57354
|
+
log.warn("1. Run notepad as administrator");
|
|
57355
|
+
log.warn("2. Open C:\\Windows\\System32\\drivers\\etc\\hosts");
|
|
57356
|
+
} else {
|
|
57357
|
+
log.warn(`
|
|
57358
|
+
On Unix systems:`);
|
|
57359
|
+
log.warn(`sudo nano ${hostsFilePath}`);
|
|
57360
|
+
}
|
|
57361
|
+
throw new Error("Failed to modify hosts file: manual intervention required");
|
|
57362
|
+
}
|
|
57363
|
+
} else {
|
|
57364
|
+
throw writeErr;
|
|
57365
|
+
}
|
|
57366
|
+
}
|
|
57367
|
+
} catch (err3) {
|
|
57368
|
+
const error = err3;
|
|
57369
|
+
log.error(`Failed to remove hosts: ${error.message}`);
|
|
57370
|
+
throw error;
|
|
57371
|
+
}
|
|
57372
|
+
}
|
|
57373
|
+
async function checkHosts(hosts, verbose) {
|
|
57374
|
+
debugLog2("hosts", `Checking hosts: ${hosts}`, verbose);
|
|
57375
|
+
const content = await fs3.promises.readFile(hostsFilePath, "utf-8");
|
|
57376
|
+
return hosts.map((host) => {
|
|
57377
|
+
const ipv4Entry = `127.0.0.1 ${host}`;
|
|
57378
|
+
const ipv6Entry = `::1 ${host}`;
|
|
57379
|
+
return content.includes(ipv4Entry) || content.includes(ipv6Entry);
|
|
57037
57380
|
});
|
|
57038
|
-
await addCertToSystemTrustStoreAndSaveCert(hostCert, caCert.certificate, config.https);
|
|
57039
|
-
log.success("Certificate generated");
|
|
57040
57381
|
}
|
|
57041
|
-
// src/start.ts
|
|
57042
|
-
import * as fs5 from "fs";
|
|
57043
|
-
import * as http from "http";
|
|
57044
|
-
import * as https from "https";
|
|
57045
|
-
import * as net from "net";
|
|
57046
|
-
import os8 from "os";
|
|
57047
|
-
import path7 from "path";
|
|
57048
|
-
import process9 from "process";
|
|
57049
|
-
// package.json
|
|
57050
|
-
var version = "0.3.1";
|
|
57051
57382
|
|
|
57052
57383
|
// src/start.ts
|
|
57053
57384
|
var activeServers = new Set;
|
|
57054
|
-
async function cleanup() {
|
|
57055
|
-
|
|
57056
|
-
console.log(
|
|
57385
|
+
async function cleanup(options3) {
|
|
57386
|
+
debugLog2("cleanup", "Starting cleanup process", options3?.verbose);
|
|
57387
|
+
console.log(`
|
|
57388
|
+
`);
|
|
57057
57389
|
log.info("Shutting down proxy servers...");
|
|
57058
57390
|
const cleanupPromises = [];
|
|
57059
57391
|
const serverClosePromises = Array.from(activeServers).map((server) => new Promise((resolve4) => {
|
|
57060
57392
|
server.close(() => {
|
|
57061
|
-
|
|
57393
|
+
debugLog2("cleanup", "Server closed successfully", options3?.verbose);
|
|
57062
57394
|
resolve4();
|
|
57063
57395
|
});
|
|
57064
57396
|
}));
|
|
57065
57397
|
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);
|
|
57398
|
+
if (options3?.etcHostsCleanup && options3.domains?.length) {
|
|
57399
|
+
debugLog2("cleanup", "Cleaning up hosts file entries", options3?.verbose);
|
|
57400
|
+
const domainsToClean = options3.domains.filter((domain) => !domain.includes("localhost"));
|
|
57401
|
+
if (domainsToClean.length > 0) {
|
|
57402
|
+
log.info("Cleaning up hosts file entries...");
|
|
57403
|
+
cleanupPromises.push(removeHosts(domainsToClean, options3?.verbose).then(() => {
|
|
57404
|
+
debugLog2("cleanup", `Removed hosts entries for ${domainsToClean.join(", ")}`, options3?.verbose);
|
|
57405
|
+
}).catch((err3) => {
|
|
57406
|
+
debugLog2("cleanup", `Failed to remove hosts entries: ${err3}`, options3?.verbose);
|
|
57407
|
+
log.warn(`Failed to clean up hosts file entries for ${domainsToClean.join(", ")}:`, err3);
|
|
57408
|
+
}));
|
|
57083
57409
|
}
|
|
57084
57410
|
}
|
|
57085
57411
|
try {
|
|
57086
57412
|
await Promise.all(cleanupPromises);
|
|
57087
|
-
|
|
57413
|
+
debugLog2("cleanup", "All cleanup tasks completed successfully", options3?.verbose);
|
|
57088
57414
|
log.success("All cleanup tasks completed successfully");
|
|
57089
|
-
|
|
57415
|
+
process20.exit(0);
|
|
57090
57416
|
} catch (err3) {
|
|
57091
|
-
|
|
57417
|
+
debugLog2("cleanup", `Error during cleanup: ${err3}`, options3?.verbose);
|
|
57092
57418
|
log.error("Error during cleanup:", err3);
|
|
57093
|
-
|
|
57419
|
+
process20.exit(1);
|
|
57094
57420
|
}
|
|
57095
57421
|
}
|
|
57096
|
-
|
|
57097
|
-
|
|
57098
|
-
|
|
57099
|
-
|
|
57422
|
+
process20.on("SIGINT", cleanup);
|
|
57423
|
+
process20.on("SIGTERM", cleanup);
|
|
57424
|
+
process20.on("uncaughtException", (err3) => {
|
|
57425
|
+
debugLog2("process", `Uncaught exception: ${err3}`, true);
|
|
57100
57426
|
log.error("Uncaught exception:", err3);
|
|
57101
57427
|
cleanup();
|
|
57102
57428
|
});
|
|
57103
57429
|
async function loadSSLConfig(options3) {
|
|
57104
|
-
|
|
57430
|
+
debugLog2("ssl", `Loading SSL configuration`, options3.verbose);
|
|
57105
57431
|
if (options3.https === true)
|
|
57106
|
-
options3.https = httpsConfig();
|
|
57432
|
+
options3.https = httpsConfig(options3);
|
|
57107
57433
|
else if (options3.https === false)
|
|
57108
57434
|
return null;
|
|
57109
57435
|
if (!options3.https?.keyPath && !options3.https?.certPath) {
|
|
57110
|
-
|
|
57436
|
+
debugLog2("ssl", "No SSL configuration provided", options3.verbose);
|
|
57111
57437
|
return null;
|
|
57112
57438
|
}
|
|
57113
57439
|
if (options3.https?.keyPath && !options3.https?.certPath || !options3.https?.keyPath && options3.https?.certPath) {
|
|
57114
57440
|
const missing = !options3.https?.keyPath ? "keyPath" : "certPath";
|
|
57115
|
-
|
|
57441
|
+
debugLog2("ssl", `Invalid SSL configuration - missing ${missing}`, options3.verbose);
|
|
57116
57442
|
throw new Error(`SSL Configuration requires both keyPath and certPath. Missing: ${missing}`);
|
|
57117
57443
|
}
|
|
57118
57444
|
try {
|
|
57119
57445
|
if (!options3.https?.keyPath || !options3.https?.certPath)
|
|
57120
57446
|
return null;
|
|
57121
57447
|
try {
|
|
57122
|
-
|
|
57448
|
+
debugLog2("ssl", "Reading SSL certificate files", options3.verbose);
|
|
57123
57449
|
const key = await fs5.promises.readFile(options3.https?.keyPath, "utf8");
|
|
57124
57450
|
const cert = await fs5.promises.readFile(options3.https?.certPath, "utf8");
|
|
57125
|
-
|
|
57451
|
+
debugLog2("ssl", "SSL configuration loaded successfully", options3.verbose);
|
|
57126
57452
|
return { key, cert };
|
|
57127
57453
|
} 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;
|
|
57454
|
+
debugLog2("ssl", `Failed to read certificates: ${error}`, options3.verbose);
|
|
57455
|
+
return null;
|
|
57138
57456
|
}
|
|
57139
57457
|
} catch (err3) {
|
|
57140
|
-
|
|
57141
|
-
|
|
57142
|
-
debugLog("ssl", `SSL configuration error: ${error}`, options3.verbose);
|
|
57143
|
-
throw new Error(`SSL Configuration Error: ${detail}`);
|
|
57458
|
+
debugLog2("ssl", `SSL configuration error: ${err3}`, options3.verbose);
|
|
57459
|
+
throw err3;
|
|
57144
57460
|
}
|
|
57145
57461
|
}
|
|
57146
57462
|
function isPortInUse(port, hostname, verbose) {
|
|
57147
|
-
|
|
57463
|
+
debugLog2("port", `Checking if port ${port} is in use on ${hostname}`, verbose);
|
|
57148
57464
|
return new Promise((resolve4) => {
|
|
57149
57465
|
const server = net.createServer();
|
|
57150
57466
|
server.once("error", (err3) => {
|
|
57151
57467
|
if (err3.code === "EADDRINUSE") {
|
|
57152
|
-
|
|
57468
|
+
debugLog2("port", `Port ${port} is in use`, verbose);
|
|
57153
57469
|
resolve4(true);
|
|
57154
57470
|
}
|
|
57155
57471
|
});
|
|
57156
57472
|
server.once("listening", () => {
|
|
57157
|
-
|
|
57473
|
+
debugLog2("port", `Port ${port} is available`, verbose);
|
|
57158
57474
|
server.close();
|
|
57159
57475
|
resolve4(false);
|
|
57160
57476
|
});
|
|
@@ -57162,17 +57478,17 @@ function isPortInUse(port, hostname, verbose) {
|
|
|
57162
57478
|
});
|
|
57163
57479
|
}
|
|
57164
57480
|
async function findAvailablePort(startPort, hostname, verbose) {
|
|
57165
|
-
|
|
57481
|
+
debugLog2("port", `Finding available port starting from ${startPort}`, verbose);
|
|
57166
57482
|
let port = startPort;
|
|
57167
57483
|
while (await isPortInUse(port, hostname, verbose)) {
|
|
57168
|
-
|
|
57484
|
+
debugLog2("port", `Port ${port} is in use, trying ${port + 1}`, verbose);
|
|
57169
57485
|
port++;
|
|
57170
57486
|
}
|
|
57171
|
-
|
|
57487
|
+
debugLog2("port", `Found available port: ${port}`, verbose);
|
|
57172
57488
|
return port;
|
|
57173
57489
|
}
|
|
57174
57490
|
async function testConnection(hostname, port, verbose) {
|
|
57175
|
-
|
|
57491
|
+
debugLog2("connection", `Testing connection to ${hostname}:${port}`, verbose);
|
|
57176
57492
|
return new Promise((resolve4, reject) => {
|
|
57177
57493
|
const socket = net.connect({
|
|
57178
57494
|
host: hostname,
|
|
@@ -57180,49 +57496,43 @@ async function testConnection(hostname, port, verbose) {
|
|
|
57180
57496
|
timeout: 5000
|
|
57181
57497
|
});
|
|
57182
57498
|
socket.once("connect", () => {
|
|
57183
|
-
|
|
57499
|
+
debugLog2("connection", `Successfully connected to ${hostname}:${port}`, verbose);
|
|
57184
57500
|
socket.end();
|
|
57185
57501
|
resolve4();
|
|
57186
57502
|
});
|
|
57187
57503
|
socket.once("timeout", () => {
|
|
57188
|
-
|
|
57504
|
+
debugLog2("connection", `Connection to ${hostname}:${port} timed out`, verbose);
|
|
57189
57505
|
socket.destroy();
|
|
57190
57506
|
reject(new Error(`Connection to ${hostname}:${port} timed out`));
|
|
57191
57507
|
});
|
|
57192
57508
|
socket.once("error", (err3) => {
|
|
57193
|
-
|
|
57509
|
+
debugLog2("connection", `Failed to connect to ${hostname}:${port}: ${err3}`, verbose);
|
|
57194
57510
|
socket.destroy();
|
|
57195
57511
|
reject(new Error(`Failed to connect to ${hostname}:${port}: ${err3.message}`));
|
|
57196
57512
|
});
|
|
57197
57513
|
});
|
|
57198
57514
|
}
|
|
57199
57515
|
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;
|
|
57516
|
+
debugLog2("server", `Starting server with options: ${JSON.stringify(options3)}`, options3.verbose);
|
|
57207
57517
|
const fromUrl = new URL(options3.from.startsWith("http") ? options3.from : `http://${options3.from}`);
|
|
57208
57518
|
const toUrl = new URL(options3.to.startsWith("http") ? options3.to : `http://${options3.to}`);
|
|
57209
57519
|
const fromPort = Number.parseInt(fromUrl.port) || (fromUrl.protocol.includes("https:") ? 443 : 80);
|
|
57210
57520
|
const hostsToCheck = [toUrl.hostname];
|
|
57211
57521
|
if (!toUrl.hostname.includes("localhost") && !toUrl.hostname.includes("127.0.0.1")) {
|
|
57212
|
-
|
|
57522
|
+
debugLog2("hosts", `Checking if hosts file entry exists for: ${toUrl.hostname}`, options3?.verbose);
|
|
57213
57523
|
try {
|
|
57214
|
-
const hostsExist = await checkHosts(hostsToCheck);
|
|
57524
|
+
const hostsExist = await checkHosts(hostsToCheck, options3.verbose);
|
|
57215
57525
|
if (!hostsExist[0]) {
|
|
57216
57526
|
log.info(`Adding ${toUrl.hostname} to hosts file...`);
|
|
57217
57527
|
log.info("This may require sudo/administrator privileges");
|
|
57218
57528
|
try {
|
|
57219
|
-
await addHosts(hostsToCheck);
|
|
57529
|
+
await addHosts(hostsToCheck, options3.verbose);
|
|
57220
57530
|
} catch (addError) {
|
|
57221
57531
|
log.error("Failed to add hosts entry:", addError.message);
|
|
57222
57532
|
log.warn("You can manually add this entry to your hosts file:");
|
|
57223
57533
|
log.warn(`127.0.0.1 ${toUrl.hostname}`);
|
|
57224
57534
|
log.warn(`::1 ${toUrl.hostname}`);
|
|
57225
|
-
if (
|
|
57535
|
+
if (process20.platform === "win32") {
|
|
57226
57536
|
log.warn("On Windows:");
|
|
57227
57537
|
log.warn("1. Run notepad as administrator");
|
|
57228
57538
|
log.warn("2. Open C:\\Windows\\System32\\drivers\\etc\\hosts");
|
|
@@ -57232,40 +57542,61 @@ async function startServer(options3) {
|
|
|
57232
57542
|
}
|
|
57233
57543
|
}
|
|
57234
57544
|
} else {
|
|
57235
|
-
|
|
57545
|
+
debugLog2("hosts", `Host entry already exists for ${toUrl.hostname}`, options3.verbose);
|
|
57236
57546
|
}
|
|
57237
57547
|
} catch (checkError) {
|
|
57238
57548
|
log.error("Failed to check hosts file:", checkError.message);
|
|
57239
57549
|
}
|
|
57240
57550
|
}
|
|
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
57551
|
try {
|
|
57253
57552
|
await testConnection(fromUrl.hostname, fromPort, options3.verbose);
|
|
57254
57553
|
} catch (err3) {
|
|
57255
|
-
|
|
57554
|
+
debugLog2("server", `Connection test failed: ${err3}`, options3.verbose);
|
|
57256
57555
|
log.error(err3.message);
|
|
57257
|
-
|
|
57556
|
+
process20.exit(1);
|
|
57258
57557
|
}
|
|
57259
|
-
let sslConfig = null;
|
|
57260
|
-
if (
|
|
57558
|
+
let sslConfig = options3._cachedSSLConfig || null;
|
|
57559
|
+
if (options3.https) {
|
|
57261
57560
|
try {
|
|
57262
|
-
|
|
57561
|
+
if (options3.https === true) {
|
|
57562
|
+
options3.https = httpsConfig({
|
|
57563
|
+
...options3,
|
|
57564
|
+
to: toUrl.hostname
|
|
57565
|
+
});
|
|
57566
|
+
}
|
|
57567
|
+
try {
|
|
57568
|
+
debugLog2("ssl", `Attempting to load SSL configuration for ${toUrl.hostname}`, options3.verbose);
|
|
57569
|
+
sslConfig = await loadSSLConfig({
|
|
57570
|
+
...options3,
|
|
57571
|
+
to: toUrl.hostname,
|
|
57572
|
+
https: options3.https
|
|
57573
|
+
});
|
|
57574
|
+
} catch (loadError) {
|
|
57575
|
+
debugLog2("ssl", `Failed to load certificates, will generate new ones: ${loadError}`, options3.verbose);
|
|
57576
|
+
}
|
|
57577
|
+
if (!sslConfig) {
|
|
57578
|
+
debugLog2("ssl", `Generating new certificates for ${toUrl.hostname}`, options3.verbose);
|
|
57579
|
+
await generateCertificate2({
|
|
57580
|
+
...options3,
|
|
57581
|
+
from: fromUrl.toString(),
|
|
57582
|
+
to: toUrl.hostname,
|
|
57583
|
+
https: options3.https
|
|
57584
|
+
});
|
|
57585
|
+
sslConfig = await loadSSLConfig({
|
|
57586
|
+
...options3,
|
|
57587
|
+
to: toUrl.hostname,
|
|
57588
|
+
https: options3.https
|
|
57589
|
+
});
|
|
57590
|
+
if (!sslConfig) {
|
|
57591
|
+
throw new Error(`Failed to load SSL configuration after generating certificates for ${toUrl.hostname}`);
|
|
57592
|
+
}
|
|
57593
|
+
}
|
|
57263
57594
|
} catch (err3) {
|
|
57264
|
-
|
|
57265
|
-
|
|
57266
|
-
sslConfig = await loadSSLConfig(options3);
|
|
57595
|
+
debugLog2("server", `SSL setup failed: ${err3}`, options3.verbose);
|
|
57596
|
+
throw err3;
|
|
57267
57597
|
}
|
|
57268
57598
|
}
|
|
57599
|
+
debugLog2("server", `Setting up reverse proxy with SSL config for ${toUrl.hostname}`, options3.verbose);
|
|
57269
57600
|
await setupReverseProxy({
|
|
57270
57601
|
...options3,
|
|
57271
57602
|
from: options3.from,
|
|
@@ -57279,9 +57610,9 @@ async function startServer(options3) {
|
|
|
57279
57610
|
});
|
|
57280
57611
|
}
|
|
57281
57612
|
async function createProxyServer(from, to, fromPort, listenPort, hostname, sourceUrl, ssl, verbose) {
|
|
57282
|
-
|
|
57613
|
+
debugLog2("proxy", `Creating proxy server ${from} -> ${to}`, verbose);
|
|
57283
57614
|
const requestHandler = (req, res) => {
|
|
57284
|
-
|
|
57615
|
+
debugLog2("request", `Incoming request: ${req.method} ${req.url}`, verbose);
|
|
57285
57616
|
const proxyOptions = {
|
|
57286
57617
|
hostname: sourceUrl.hostname,
|
|
57287
57618
|
port: fromPort,
|
|
@@ -57292,9 +57623,9 @@ async function createProxyServer(from, to, fromPort, listenPort, hostname, sourc
|
|
|
57292
57623
|
host: sourceUrl.host
|
|
57293
57624
|
}
|
|
57294
57625
|
};
|
|
57295
|
-
|
|
57626
|
+
debugLog2("request", `Proxy request options: ${JSON.stringify(proxyOptions)}`, verbose);
|
|
57296
57627
|
const proxyReq = http.request(proxyOptions, (proxyRes) => {
|
|
57297
|
-
|
|
57628
|
+
debugLog2("response", `Proxy response received with status ${proxyRes.statusCode}`, verbose);
|
|
57298
57629
|
const headers = {
|
|
57299
57630
|
...proxyRes.headers,
|
|
57300
57631
|
"Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
|
|
@@ -57304,7 +57635,7 @@ async function createProxyServer(from, to, fromPort, listenPort, hostname, sourc
|
|
|
57304
57635
|
proxyRes.pipe(res);
|
|
57305
57636
|
});
|
|
57306
57637
|
proxyReq.on("error", (err3) => {
|
|
57307
|
-
|
|
57638
|
+
debugLog2("request", `Proxy request failed: ${err3}`, verbose);
|
|
57308
57639
|
log.error("Proxy request failed:", err3);
|
|
57309
57640
|
res.writeHead(502);
|
|
57310
57641
|
res.end(`Proxy Error: ${err3.message}`);
|
|
@@ -57331,11 +57662,11 @@ async function createProxyServer(from, to, fromPort, listenPort, hostname, sourc
|
|
|
57331
57662
|
allowHTTP1: true,
|
|
57332
57663
|
ALPNProtocols: ["h2", "http/1.1"]
|
|
57333
57664
|
} : undefined;
|
|
57334
|
-
|
|
57665
|
+
debugLog2("server", `Creating server with SSL config: ${!!ssl}`, verbose);
|
|
57335
57666
|
const server = ssl && serverOptions ? https.createServer(serverOptions, requestHandler) : http.createServer(requestHandler);
|
|
57336
57667
|
if (ssl) {
|
|
57337
57668
|
server.on("secureConnection", (tlsSocket) => {
|
|
57338
|
-
|
|
57669
|
+
debugLog2("tls", `TLS Connection established: ${JSON.stringify({
|
|
57339
57670
|
protocol: tlsSocket.getProtocol?.(),
|
|
57340
57671
|
cipher: tlsSocket.getCipher?.(),
|
|
57341
57672
|
authorized: tlsSocket.authorized,
|
|
@@ -57346,7 +57677,7 @@ async function createProxyServer(from, to, fromPort, listenPort, hostname, sourc
|
|
|
57346
57677
|
activeServers.add(server);
|
|
57347
57678
|
return new Promise((resolve4, reject) => {
|
|
57348
57679
|
server.listen(listenPort, hostname, () => {
|
|
57349
|
-
|
|
57680
|
+
debugLog2("server", `Server listening on port ${listenPort}`, verbose);
|
|
57350
57681
|
console.log("");
|
|
57351
57682
|
console.log(` ${green(bold("reverse-proxy"))} ${green(`v${version}`)}`);
|
|
57352
57683
|
console.log("");
|
|
@@ -57363,92 +57694,138 @@ async function createProxyServer(from, to, fromPort, listenPort, hostname, sourc
|
|
|
57363
57694
|
resolve4();
|
|
57364
57695
|
});
|
|
57365
57696
|
server.on("error", (err3) => {
|
|
57366
|
-
|
|
57697
|
+
debugLog2("server", `Server error: ${err3}`, verbose);
|
|
57367
57698
|
reject(err3);
|
|
57368
57699
|
});
|
|
57369
57700
|
});
|
|
57370
57701
|
}
|
|
57371
57702
|
async function setupReverseProxy(options3) {
|
|
57372
|
-
|
|
57373
|
-
const { from, to, fromPort, sourceUrl, ssl, verbose } = options3;
|
|
57703
|
+
debugLog2("setup", `Setting up reverse proxy: ${JSON.stringify(options3)}`, options3.verbose);
|
|
57704
|
+
const { from, to, fromPort, sourceUrl, ssl, verbose, etcHostsCleanup, portManager } = options3;
|
|
57374
57705
|
const httpPort = 80;
|
|
57375
57706
|
const httpsPort = 443;
|
|
57376
57707
|
const hostname = "0.0.0.0";
|
|
57377
57708
|
try {
|
|
57378
|
-
if (ssl) {
|
|
57709
|
+
if (ssl && !portManager?.usedPorts.has(httpPort)) {
|
|
57379
57710
|
const isHttpPortBusy = await isPortInUse(httpPort, hostname, verbose);
|
|
57380
57711
|
if (!isHttpPortBusy) {
|
|
57381
|
-
|
|
57712
|
+
debugLog2("setup", "Starting HTTP redirect server", verbose);
|
|
57382
57713
|
startHttpRedirectServer(verbose);
|
|
57714
|
+
portManager?.usedPorts.add(httpPort);
|
|
57383
57715
|
} else {
|
|
57384
|
-
|
|
57716
|
+
debugLog2("setup", "Port 80 is in use, skipping HTTP redirect", verbose);
|
|
57385
57717
|
log.warn("Port 80 is in use, HTTP to HTTPS redirect will not be available");
|
|
57386
57718
|
}
|
|
57387
57719
|
}
|
|
57388
57720
|
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);
|
|
57721
|
+
let finalPort;
|
|
57722
|
+
if (portManager) {
|
|
57723
|
+
finalPort = await portManager.getNextAvailablePort(targetPort);
|
|
57396
57724
|
} else {
|
|
57397
|
-
|
|
57398
|
-
await
|
|
57725
|
+
const isTargetPortBusy = await isPortInUse(targetPort, hostname, verbose);
|
|
57726
|
+
finalPort = isTargetPortBusy ? await findAvailablePort(ssl ? 8443 : 8080, hostname, verbose) : targetPort;
|
|
57399
57727
|
}
|
|
57728
|
+
if (finalPort !== targetPort) {
|
|
57729
|
+
log.warn(`Port ${targetPort} is in use. Using port ${finalPort} instead.`);
|
|
57730
|
+
log.info(`You can use 'sudo lsof -i :${targetPort}' (Unix) or 'netstat -ano | findstr :${targetPort}' (Windows) to check what's using the port.`);
|
|
57731
|
+
}
|
|
57732
|
+
await createProxyServer(from, to, fromPort, finalPort, hostname, sourceUrl, ssl, verbose);
|
|
57400
57733
|
} catch (err3) {
|
|
57401
|
-
|
|
57734
|
+
debugLog2("setup", `Setup failed: ${err3}`, verbose);
|
|
57402
57735
|
log.error(`Failed to setup reverse proxy: ${err3.message}`);
|
|
57403
|
-
cleanup(
|
|
57736
|
+
cleanup({
|
|
57737
|
+
domains: [to],
|
|
57738
|
+
etcHostsCleanup,
|
|
57739
|
+
verbose
|
|
57740
|
+
});
|
|
57404
57741
|
}
|
|
57405
57742
|
}
|
|
57406
57743
|
function startHttpRedirectServer(verbose) {
|
|
57407
|
-
|
|
57744
|
+
debugLog2("redirect", "Starting HTTP redirect server", verbose);
|
|
57408
57745
|
const server = http.createServer((req, res) => {
|
|
57409
57746
|
const host = req.headers.host || "";
|
|
57410
|
-
|
|
57747
|
+
debugLog2("redirect", `Redirecting request from ${host}${req.url} to HTTPS`, verbose);
|
|
57411
57748
|
res.writeHead(301, {
|
|
57412
57749
|
Location: `https://${host}${req.url}`
|
|
57413
57750
|
});
|
|
57414
57751
|
res.end();
|
|
57415
57752
|
}).listen(80);
|
|
57416
57753
|
activeServers.add(server);
|
|
57417
|
-
|
|
57754
|
+
debugLog2("redirect", "HTTP redirect server started", verbose);
|
|
57418
57755
|
}
|
|
57419
57756
|
function startProxy(options3) {
|
|
57420
|
-
|
|
57421
|
-
|
|
57422
|
-
|
|
57423
|
-
|
|
57424
|
-
|
|
57425
|
-
|
|
57426
|
-
|
|
57427
|
-
|
|
57428
|
-
|
|
57429
|
-
startServer(
|
|
57430
|
-
|
|
57757
|
+
debugLog2("proxy", `Starting proxy with options: ${JSON.stringify(options3)}`, options3?.verbose);
|
|
57758
|
+
const serverOptions = {
|
|
57759
|
+
from: options3?.from || "localhost:5173",
|
|
57760
|
+
to: options3?.to || "stacks.localhost",
|
|
57761
|
+
https: httpsConfig(options3),
|
|
57762
|
+
etcHostsCleanup: options3?.etcHostsCleanup || false,
|
|
57763
|
+
verbose: options3?.verbose || false
|
|
57764
|
+
};
|
|
57765
|
+
console.log("serverOptions", serverOptions);
|
|
57766
|
+
startServer(serverOptions).catch((err3) => {
|
|
57767
|
+
debugLog2("proxy", `Failed to start proxy: ${err3}`, options3.verbose);
|
|
57431
57768
|
log.error(`Failed to start proxy: ${err3.message}`);
|
|
57432
|
-
cleanup(
|
|
57769
|
+
cleanup({
|
|
57770
|
+
domains: [options3.to],
|
|
57771
|
+
etcHostsCleanup: options3.etcHostsCleanup,
|
|
57772
|
+
verbose: options3.verbose
|
|
57773
|
+
});
|
|
57433
57774
|
});
|
|
57434
57775
|
}
|
|
57435
|
-
function startProxies(options3) {
|
|
57436
|
-
if (
|
|
57437
|
-
|
|
57438
|
-
|
|
57439
|
-
|
|
57440
|
-
|
|
57441
|
-
|
|
57442
|
-
|
|
57443
|
-
|
|
57444
|
-
|
|
57445
|
-
|
|
57446
|
-
|
|
57447
|
-
|
|
57448
|
-
|
|
57449
|
-
|
|
57776
|
+
async function startProxies(options3) {
|
|
57777
|
+
if (!options3)
|
|
57778
|
+
return;
|
|
57779
|
+
debugLog2("proxies", "Starting proxies setup", isMultiProxyConfig2(options3) ? options3.verbose : options3.verbose);
|
|
57780
|
+
if (options3.https) {
|
|
57781
|
+
await generateCertificate2(options3);
|
|
57782
|
+
}
|
|
57783
|
+
const proxyOptions = isMultiProxyConfig2(options3) ? options3.proxies.map((proxy) => ({
|
|
57784
|
+
...proxy,
|
|
57785
|
+
https: options3.https,
|
|
57786
|
+
etcHostsCleanup: options3.etcHostsCleanup,
|
|
57787
|
+
verbose: options3.verbose,
|
|
57788
|
+
_cachedSSLConfig: options3._cachedSSLConfig
|
|
57789
|
+
})) : [options3];
|
|
57790
|
+
const domains = extractDomains(options3);
|
|
57791
|
+
const sslConfig = options3.https ? getSSLConfig() : null;
|
|
57792
|
+
const cleanupHandler = () => cleanup({
|
|
57793
|
+
domains,
|
|
57794
|
+
etcHostsCleanup: isMultiProxyConfig2(options3) ? options3.etcHostsCleanup : options3.etcHostsCleanup || false,
|
|
57795
|
+
verbose: isMultiProxyConfig2(options3) ? options3.verbose : options3.verbose || false
|
|
57796
|
+
});
|
|
57797
|
+
process20.on("SIGINT", cleanupHandler);
|
|
57798
|
+
process20.on("SIGTERM", cleanupHandler);
|
|
57799
|
+
process20.on("uncaughtException", (err3) => {
|
|
57800
|
+
debugLog2("process", `Uncaught exception: ${err3}`, true);
|
|
57801
|
+
log.error("Uncaught exception:", err3);
|
|
57802
|
+
cleanupHandler();
|
|
57803
|
+
});
|
|
57804
|
+
for (const option of proxyOptions) {
|
|
57805
|
+
try {
|
|
57806
|
+
const domain = option.to || "stacks.localhost";
|
|
57807
|
+
debugLog2("proxy", `Starting proxy for ${domain} with SSL config: ${!!sslConfig}`, option.verbose);
|
|
57808
|
+
await startServer({
|
|
57809
|
+
from: option.from || "localhost:5173",
|
|
57810
|
+
to: domain,
|
|
57811
|
+
https: option.https ?? false,
|
|
57812
|
+
etcHostsCleanup: option.etcHostsCleanup || false,
|
|
57813
|
+
verbose: option.verbose || false,
|
|
57814
|
+
_cachedSSLConfig: sslConfig
|
|
57815
|
+
});
|
|
57816
|
+
} catch (err3) {
|
|
57817
|
+
debugLog2("proxies", `Failed to start proxy for ${option.to}: ${err3}`, option.verbose);
|
|
57818
|
+
log.error(`Failed to start proxy for ${option.to}:`, err3);
|
|
57819
|
+
cleanupHandler();
|
|
57820
|
+
}
|
|
57450
57821
|
}
|
|
57451
57822
|
}
|
|
57823
|
+
function isMultiProxyConfig2(options3) {
|
|
57824
|
+
return "proxies" in options3;
|
|
57825
|
+
}
|
|
57826
|
+
|
|
57827
|
+
// src/index.ts
|
|
57828
|
+
var src_default = startProxies;
|
|
57452
57829
|
export {
|
|
57453
57830
|
startServer,
|
|
57454
57831
|
startProxy,
|
|
@@ -57456,15 +57833,16 @@ export {
|
|
|
57456
57833
|
startHttpRedirectServer,
|
|
57457
57834
|
setupReverseProxy,
|
|
57458
57835
|
removeHosts,
|
|
57459
|
-
|
|
57836
|
+
isMultiProxyConfig,
|
|
57460
57837
|
httpsConfig,
|
|
57461
57838
|
hostsFilePath,
|
|
57462
|
-
|
|
57463
|
-
|
|
57464
|
-
|
|
57839
|
+
getSSLConfig,
|
|
57840
|
+
generateCertificate2 as generateCertificate,
|
|
57841
|
+
extractDomains,
|
|
57842
|
+
src_default as default,
|
|
57843
|
+
debugLog2 as debugLog,
|
|
57844
|
+
config6 as config,
|
|
57465
57845
|
cleanup,
|
|
57466
57846
|
checkHosts,
|
|
57467
|
-
certPath,
|
|
57468
|
-
caCertPath,
|
|
57469
57847
|
addHosts
|
|
57470
57848
|
};
|