vlt 0.0.0-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/cache-unzip/unzip.js +7830 -0
- package/cache-unzip/unzip.js.map +7 -0
- package/commands/config.js +2158 -0
- package/commands/config.js.map +7 -0
- package/commands/exec.js +11491 -0
- package/commands/exec.js.map +7 -0
- package/commands/help.js +3064 -0
- package/commands/help.js.map +7 -0
- package/commands/install-exec.js +19 -0
- package/commands/install-exec.js.map +7 -0
- package/commands/install.js +38201 -0
- package/commands/install.js.map +7 -0
- package/commands/pkg.js +474 -0
- package/commands/pkg.js.map +7 -0
- package/commands/run-exec.js +11584 -0
- package/commands/run-exec.js.map +7 -0
- package/commands/run.js +11593 -0
- package/commands/run.js.map +7 -0
- package/commands/uninstall.js +38181 -0
- package/commands/uninstall.js.map +7 -0
- package/package.json +15 -0
- package/registry-client/package.json +1 -0
- package/rollback-remove/remove.js +7400 -0
- package/rollback-remove/remove.js.map +7 -0
- package/tar/worker.js +8015 -0
- package/tar/worker.js.map +7 -0
- package/vlix.js +12127 -0
- package/vlix.js.map +7 -0
- package/vlr.js +12127 -0
- package/vlr.js.map +7 -0
- package/vlrx.js +12127 -0
- package/vlrx.js.map +7 -0
- package/vlt.js +12126 -0
- package/vlt.js.map +7 -0
- package/vlx.js +12127 -0
- package/vlx.js.map +7 -0
package/commands/help.js
ADDED
|
@@ -0,0 +1,3064 @@
|
|
|
1
|
+
import process from 'node:process'
|
|
2
|
+
import {Buffer} from 'node:buffer'
|
|
3
|
+
import {setImmediate,clearImmediate} from 'node:timers'
|
|
4
|
+
import {createRequire as createRequire_055fdfe7bd7e} from 'node:module'
|
|
5
|
+
const require = createRequire_055fdfe7bd7e(import.meta.filename)
|
|
6
|
+
const global = globalThis
|
|
7
|
+
var __create = Object.create;
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
11
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
12
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
13
|
+
var __esm = (fn, res) => function __init() {
|
|
14
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
15
|
+
};
|
|
16
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
17
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
18
|
+
};
|
|
19
|
+
var __export = (target, all) => {
|
|
20
|
+
for (var name in all)
|
|
21
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
22
|
+
};
|
|
23
|
+
var __copyProps = (to, from, except, desc) => {
|
|
24
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
25
|
+
for (let key of __getOwnPropNames(from))
|
|
26
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
27
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
28
|
+
}
|
|
29
|
+
return to;
|
|
30
|
+
};
|
|
31
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
32
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
33
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
34
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
35
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
36
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
37
|
+
mod
|
|
38
|
+
));
|
|
39
|
+
|
|
40
|
+
// ../../node_modules/.pnpm/eastasianwidth@0.2.0/node_modules/eastasianwidth/eastasianwidth.js
|
|
41
|
+
var require_eastasianwidth = __commonJS({
|
|
42
|
+
"../../node_modules/.pnpm/eastasianwidth@0.2.0/node_modules/eastasianwidth/eastasianwidth.js"(exports, module) {
|
|
43
|
+
var eaw = {};
|
|
44
|
+
if ("undefined" == typeof module) {
|
|
45
|
+
window.eastasianwidth = eaw;
|
|
46
|
+
} else {
|
|
47
|
+
module.exports = eaw;
|
|
48
|
+
}
|
|
49
|
+
eaw.eastAsianWidth = function(character) {
|
|
50
|
+
var x = character.charCodeAt(0);
|
|
51
|
+
var y = character.length == 2 ? character.charCodeAt(1) : 0;
|
|
52
|
+
var codePoint = x;
|
|
53
|
+
if (55296 <= x && x <= 56319 && (56320 <= y && y <= 57343)) {
|
|
54
|
+
x &= 1023;
|
|
55
|
+
y &= 1023;
|
|
56
|
+
codePoint = x << 10 | y;
|
|
57
|
+
codePoint += 65536;
|
|
58
|
+
}
|
|
59
|
+
if (12288 == codePoint || 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510) {
|
|
60
|
+
return "F";
|
|
61
|
+
}
|
|
62
|
+
if (8361 == codePoint || 65377 <= codePoint && codePoint <= 65470 || 65474 <= codePoint && codePoint <= 65479 || 65482 <= codePoint && codePoint <= 65487 || 65490 <= codePoint && codePoint <= 65495 || 65498 <= codePoint && codePoint <= 65500 || 65512 <= codePoint && codePoint <= 65518) {
|
|
63
|
+
return "H";
|
|
64
|
+
}
|
|
65
|
+
if (4352 <= codePoint && codePoint <= 4447 || 4515 <= codePoint && codePoint <= 4519 || 4602 <= codePoint && codePoint <= 4607 || 9001 <= codePoint && codePoint <= 9002 || 11904 <= codePoint && codePoint <= 11929 || 11931 <= codePoint && codePoint <= 12019 || 12032 <= codePoint && codePoint <= 12245 || 12272 <= codePoint && codePoint <= 12283 || 12289 <= codePoint && codePoint <= 12350 || 12353 <= codePoint && codePoint <= 12438 || 12441 <= codePoint && codePoint <= 12543 || 12549 <= codePoint && codePoint <= 12589 || 12593 <= codePoint && codePoint <= 12686 || 12688 <= codePoint && codePoint <= 12730 || 12736 <= codePoint && codePoint <= 12771 || 12784 <= codePoint && codePoint <= 12830 || 12832 <= codePoint && codePoint <= 12871 || 12880 <= codePoint && codePoint <= 13054 || 13056 <= codePoint && codePoint <= 19903 || 19968 <= codePoint && codePoint <= 42124 || 42128 <= codePoint && codePoint <= 42182 || 43360 <= codePoint && codePoint <= 43388 || 44032 <= codePoint && codePoint <= 55203 || 55216 <= codePoint && codePoint <= 55238 || 55243 <= codePoint && codePoint <= 55291 || 63744 <= codePoint && codePoint <= 64255 || 65040 <= codePoint && codePoint <= 65049 || 65072 <= codePoint && codePoint <= 65106 || 65108 <= codePoint && codePoint <= 65126 || 65128 <= codePoint && codePoint <= 65131 || 110592 <= codePoint && codePoint <= 110593 || 127488 <= codePoint && codePoint <= 127490 || 127504 <= codePoint && codePoint <= 127546 || 127552 <= codePoint && codePoint <= 127560 || 127568 <= codePoint && codePoint <= 127569 || 131072 <= codePoint && codePoint <= 194367 || 177984 <= codePoint && codePoint <= 196605 || 196608 <= codePoint && codePoint <= 262141) {
|
|
66
|
+
return "W";
|
|
67
|
+
}
|
|
68
|
+
if (32 <= codePoint && codePoint <= 126 || 162 <= codePoint && codePoint <= 163 || 165 <= codePoint && codePoint <= 166 || 172 == codePoint || 175 == codePoint || 10214 <= codePoint && codePoint <= 10221 || 10629 <= codePoint && codePoint <= 10630) {
|
|
69
|
+
return "Na";
|
|
70
|
+
}
|
|
71
|
+
if (161 == codePoint || 164 == codePoint || 167 <= codePoint && codePoint <= 168 || 170 == codePoint || 173 <= codePoint && codePoint <= 174 || 176 <= codePoint && codePoint <= 180 || 182 <= codePoint && codePoint <= 186 || 188 <= codePoint && codePoint <= 191 || 198 == codePoint || 208 == codePoint || 215 <= codePoint && codePoint <= 216 || 222 <= codePoint && codePoint <= 225 || 230 == codePoint || 232 <= codePoint && codePoint <= 234 || 236 <= codePoint && codePoint <= 237 || 240 == codePoint || 242 <= codePoint && codePoint <= 243 || 247 <= codePoint && codePoint <= 250 || 252 == codePoint || 254 == codePoint || 257 == codePoint || 273 == codePoint || 275 == codePoint || 283 == codePoint || 294 <= codePoint && codePoint <= 295 || 299 == codePoint || 305 <= codePoint && codePoint <= 307 || 312 == codePoint || 319 <= codePoint && codePoint <= 322 || 324 == codePoint || 328 <= codePoint && codePoint <= 331 || 333 == codePoint || 338 <= codePoint && codePoint <= 339 || 358 <= codePoint && codePoint <= 359 || 363 == codePoint || 462 == codePoint || 464 == codePoint || 466 == codePoint || 468 == codePoint || 470 == codePoint || 472 == codePoint || 474 == codePoint || 476 == codePoint || 593 == codePoint || 609 == codePoint || 708 == codePoint || 711 == codePoint || 713 <= codePoint && codePoint <= 715 || 717 == codePoint || 720 == codePoint || 728 <= codePoint && codePoint <= 731 || 733 == codePoint || 735 == codePoint || 768 <= codePoint && codePoint <= 879 || 913 <= codePoint && codePoint <= 929 || 931 <= codePoint && codePoint <= 937 || 945 <= codePoint && codePoint <= 961 || 963 <= codePoint && codePoint <= 969 || 1025 == codePoint || 1040 <= codePoint && codePoint <= 1103 || 1105 == codePoint || 8208 == codePoint || 8211 <= codePoint && codePoint <= 8214 || 8216 <= codePoint && codePoint <= 8217 || 8220 <= codePoint && codePoint <= 8221 || 8224 <= codePoint && codePoint <= 8226 || 8228 <= codePoint && codePoint <= 8231 || 8240 == codePoint || 8242 <= codePoint && codePoint <= 8243 || 8245 == codePoint || 8251 == codePoint || 8254 == codePoint || 8308 == codePoint || 8319 == codePoint || 8321 <= codePoint && codePoint <= 8324 || 8364 == codePoint || 8451 == codePoint || 8453 == codePoint || 8457 == codePoint || 8467 == codePoint || 8470 == codePoint || 8481 <= codePoint && codePoint <= 8482 || 8486 == codePoint || 8491 == codePoint || 8531 <= codePoint && codePoint <= 8532 || 8539 <= codePoint && codePoint <= 8542 || 8544 <= codePoint && codePoint <= 8555 || 8560 <= codePoint && codePoint <= 8569 || 8585 == codePoint || 8592 <= codePoint && codePoint <= 8601 || 8632 <= codePoint && codePoint <= 8633 || 8658 == codePoint || 8660 == codePoint || 8679 == codePoint || 8704 == codePoint || 8706 <= codePoint && codePoint <= 8707 || 8711 <= codePoint && codePoint <= 8712 || 8715 == codePoint || 8719 == codePoint || 8721 == codePoint || 8725 == codePoint || 8730 == codePoint || 8733 <= codePoint && codePoint <= 8736 || 8739 == codePoint || 8741 == codePoint || 8743 <= codePoint && codePoint <= 8748 || 8750 == codePoint || 8756 <= codePoint && codePoint <= 8759 || 8764 <= codePoint && codePoint <= 8765 || 8776 == codePoint || 8780 == codePoint || 8786 == codePoint || 8800 <= codePoint && codePoint <= 8801 || 8804 <= codePoint && codePoint <= 8807 || 8810 <= codePoint && codePoint <= 8811 || 8814 <= codePoint && codePoint <= 8815 || 8834 <= codePoint && codePoint <= 8835 || 8838 <= codePoint && codePoint <= 8839 || 8853 == codePoint || 8857 == codePoint || 8869 == codePoint || 8895 == codePoint || 8978 == codePoint || 9312 <= codePoint && codePoint <= 9449 || 9451 <= codePoint && codePoint <= 9547 || 9552 <= codePoint && codePoint <= 9587 || 9600 <= codePoint && codePoint <= 9615 || 9618 <= codePoint && codePoint <= 9621 || 9632 <= codePoint && codePoint <= 9633 || 9635 <= codePoint && codePoint <= 9641 || 9650 <= codePoint && codePoint <= 9651 || 9654 <= codePoint && codePoint <= 9655 || 9660 <= codePoint && codePoint <= 9661 || 9664 <= codePoint && codePoint <= 9665 || 9670 <= codePoint && codePoint <= 9672 || 9675 == codePoint || 9678 <= codePoint && codePoint <= 9681 || 9698 <= codePoint && codePoint <= 9701 || 9711 == codePoint || 9733 <= codePoint && codePoint <= 9734 || 9737 == codePoint || 9742 <= codePoint && codePoint <= 9743 || 9748 <= codePoint && codePoint <= 9749 || 9756 == codePoint || 9758 == codePoint || 9792 == codePoint || 9794 == codePoint || 9824 <= codePoint && codePoint <= 9825 || 9827 <= codePoint && codePoint <= 9829 || 9831 <= codePoint && codePoint <= 9834 || 9836 <= codePoint && codePoint <= 9837 || 9839 == codePoint || 9886 <= codePoint && codePoint <= 9887 || 9918 <= codePoint && codePoint <= 9919 || 9924 <= codePoint && codePoint <= 9933 || 9935 <= codePoint && codePoint <= 9953 || 9955 == codePoint || 9960 <= codePoint && codePoint <= 9983 || 10045 == codePoint || 10071 == codePoint || 10102 <= codePoint && codePoint <= 10111 || 11093 <= codePoint && codePoint <= 11097 || 12872 <= codePoint && codePoint <= 12879 || 57344 <= codePoint && codePoint <= 63743 || 65024 <= codePoint && codePoint <= 65039 || 65533 == codePoint || 127232 <= codePoint && codePoint <= 127242 || 127248 <= codePoint && codePoint <= 127277 || 127280 <= codePoint && codePoint <= 127337 || 127344 <= codePoint && codePoint <= 127386 || 917760 <= codePoint && codePoint <= 917999 || 983040 <= codePoint && codePoint <= 1048573 || 1048576 <= codePoint && codePoint <= 1114109) {
|
|
72
|
+
return "A";
|
|
73
|
+
}
|
|
74
|
+
return "N";
|
|
75
|
+
};
|
|
76
|
+
eaw.characterLength = function(character) {
|
|
77
|
+
var code = this.eastAsianWidth(character);
|
|
78
|
+
if (code == "F" || code == "W" || code == "A") {
|
|
79
|
+
return 2;
|
|
80
|
+
} else {
|
|
81
|
+
return 1;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
function stringToArray(string) {
|
|
85
|
+
return string.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
|
86
|
+
}
|
|
87
|
+
eaw.length = function(string) {
|
|
88
|
+
var characters = stringToArray(string);
|
|
89
|
+
var len = 0;
|
|
90
|
+
for (var i = 0; i < characters.length; i++) {
|
|
91
|
+
len = len + this.characterLength(characters[i]);
|
|
92
|
+
}
|
|
93
|
+
return len;
|
|
94
|
+
};
|
|
95
|
+
eaw.slice = function(text, start, end) {
|
|
96
|
+
textLen = eaw.length(text);
|
|
97
|
+
start = start ? start : 0;
|
|
98
|
+
end = end ? end : 1;
|
|
99
|
+
if (start < 0) {
|
|
100
|
+
start = textLen + start;
|
|
101
|
+
}
|
|
102
|
+
if (end < 0) {
|
|
103
|
+
end = textLen + end;
|
|
104
|
+
}
|
|
105
|
+
var result = "";
|
|
106
|
+
var eawLen = 0;
|
|
107
|
+
var chars = stringToArray(text);
|
|
108
|
+
for (var i = 0; i < chars.length; i++) {
|
|
109
|
+
var char = chars[i];
|
|
110
|
+
var charLen = eaw.length(char);
|
|
111
|
+
if (eawLen >= start - (charLen == 2 ? 1 : 0)) {
|
|
112
|
+
if (eawLen + charLen <= end) {
|
|
113
|
+
result += char;
|
|
114
|
+
} else {
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
eawLen += charLen;
|
|
119
|
+
}
|
|
120
|
+
return result;
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// ../../node_modules/.pnpm/emoji-regex@9.2.2/node_modules/emoji-regex/index.js
|
|
126
|
+
var require_emoji_regex = __commonJS({
|
|
127
|
+
"../../node_modules/.pnpm/emoji-regex@9.2.2/node_modules/emoji-regex/index.js"(exports, module) {
|
|
128
|
+
"use strict";
|
|
129
|
+
module.exports = function() {
|
|
130
|
+
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
// ../../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
136
|
+
function assembleStyles2() {
|
|
137
|
+
const codes = /* @__PURE__ */ new Map();
|
|
138
|
+
for (const [groupName, group] of Object.entries(styles2)) {
|
|
139
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
140
|
+
styles2[styleName] = {
|
|
141
|
+
open: `\x1B[${style[0]}m`,
|
|
142
|
+
close: `\x1B[${style[1]}m`
|
|
143
|
+
};
|
|
144
|
+
group[styleName] = styles2[styleName];
|
|
145
|
+
codes.set(style[0], style[1]);
|
|
146
|
+
}
|
|
147
|
+
Object.defineProperty(styles2, groupName, {
|
|
148
|
+
value: group,
|
|
149
|
+
enumerable: false
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
Object.defineProperty(styles2, "codes", {
|
|
153
|
+
value: codes,
|
|
154
|
+
enumerable: false
|
|
155
|
+
});
|
|
156
|
+
styles2.color.close = "\x1B[39m";
|
|
157
|
+
styles2.bgColor.close = "\x1B[49m";
|
|
158
|
+
styles2.color.ansi = wrapAnsi162();
|
|
159
|
+
styles2.color.ansi256 = wrapAnsi2562();
|
|
160
|
+
styles2.color.ansi16m = wrapAnsi16m2();
|
|
161
|
+
styles2.bgColor.ansi = wrapAnsi162(ANSI_BACKGROUND_OFFSET2);
|
|
162
|
+
styles2.bgColor.ansi256 = wrapAnsi2562(ANSI_BACKGROUND_OFFSET2);
|
|
163
|
+
styles2.bgColor.ansi16m = wrapAnsi16m2(ANSI_BACKGROUND_OFFSET2);
|
|
164
|
+
Object.defineProperties(styles2, {
|
|
165
|
+
rgbToAnsi256: {
|
|
166
|
+
value(red, green, blue) {
|
|
167
|
+
if (red === green && green === blue) {
|
|
168
|
+
if (red < 8) {
|
|
169
|
+
return 16;
|
|
170
|
+
}
|
|
171
|
+
if (red > 248) {
|
|
172
|
+
return 231;
|
|
173
|
+
}
|
|
174
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
175
|
+
}
|
|
176
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
177
|
+
},
|
|
178
|
+
enumerable: false
|
|
179
|
+
},
|
|
180
|
+
hexToRgb: {
|
|
181
|
+
value(hex) {
|
|
182
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
183
|
+
if (!matches) {
|
|
184
|
+
return [0, 0, 0];
|
|
185
|
+
}
|
|
186
|
+
let [colorString] = matches;
|
|
187
|
+
if (colorString.length === 3) {
|
|
188
|
+
colorString = [...colorString].map((character) => character + character).join("");
|
|
189
|
+
}
|
|
190
|
+
const integer = Number.parseInt(colorString, 16);
|
|
191
|
+
return [
|
|
192
|
+
/* eslint-disable no-bitwise */
|
|
193
|
+
integer >> 16 & 255,
|
|
194
|
+
integer >> 8 & 255,
|
|
195
|
+
integer & 255
|
|
196
|
+
/* eslint-enable no-bitwise */
|
|
197
|
+
];
|
|
198
|
+
},
|
|
199
|
+
enumerable: false
|
|
200
|
+
},
|
|
201
|
+
hexToAnsi256: {
|
|
202
|
+
value: (hex) => styles2.rgbToAnsi256(...styles2.hexToRgb(hex)),
|
|
203
|
+
enumerable: false
|
|
204
|
+
},
|
|
205
|
+
ansi256ToAnsi: {
|
|
206
|
+
value(code) {
|
|
207
|
+
if (code < 8) {
|
|
208
|
+
return 30 + code;
|
|
209
|
+
}
|
|
210
|
+
if (code < 16) {
|
|
211
|
+
return 90 + (code - 8);
|
|
212
|
+
}
|
|
213
|
+
let red;
|
|
214
|
+
let green;
|
|
215
|
+
let blue;
|
|
216
|
+
if (code >= 232) {
|
|
217
|
+
red = ((code - 232) * 10 + 8) / 255;
|
|
218
|
+
green = red;
|
|
219
|
+
blue = red;
|
|
220
|
+
} else {
|
|
221
|
+
code -= 16;
|
|
222
|
+
const remainder = code % 36;
|
|
223
|
+
red = Math.floor(code / 36) / 5;
|
|
224
|
+
green = Math.floor(remainder / 6) / 5;
|
|
225
|
+
blue = remainder % 6 / 5;
|
|
226
|
+
}
|
|
227
|
+
const value = Math.max(red, green, blue) * 2;
|
|
228
|
+
if (value === 0) {
|
|
229
|
+
return 30;
|
|
230
|
+
}
|
|
231
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
232
|
+
if (value === 2) {
|
|
233
|
+
result += 60;
|
|
234
|
+
}
|
|
235
|
+
return result;
|
|
236
|
+
},
|
|
237
|
+
enumerable: false
|
|
238
|
+
},
|
|
239
|
+
rgbToAnsi: {
|
|
240
|
+
value: (red, green, blue) => styles2.ansi256ToAnsi(styles2.rgbToAnsi256(red, green, blue)),
|
|
241
|
+
enumerable: false
|
|
242
|
+
},
|
|
243
|
+
hexToAnsi: {
|
|
244
|
+
value: (hex) => styles2.ansi256ToAnsi(styles2.hexToAnsi256(hex)),
|
|
245
|
+
enumerable: false
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
return styles2;
|
|
249
|
+
}
|
|
250
|
+
var ANSI_BACKGROUND_OFFSET2, wrapAnsi162, wrapAnsi2562, wrapAnsi16m2, styles2, modifierNames2, foregroundColorNames2, backgroundColorNames2, colorNames2, ansiStyles2, ansi_styles_default2;
|
|
251
|
+
var init_ansi_styles = __esm({
|
|
252
|
+
"../../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js"() {
|
|
253
|
+
ANSI_BACKGROUND_OFFSET2 = 10;
|
|
254
|
+
wrapAnsi162 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
255
|
+
wrapAnsi2562 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
256
|
+
wrapAnsi16m2 = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
257
|
+
styles2 = {
|
|
258
|
+
modifier: {
|
|
259
|
+
reset: [0, 0],
|
|
260
|
+
// 21 isn't widely supported and 22 does the same thing
|
|
261
|
+
bold: [1, 22],
|
|
262
|
+
dim: [2, 22],
|
|
263
|
+
italic: [3, 23],
|
|
264
|
+
underline: [4, 24],
|
|
265
|
+
overline: [53, 55],
|
|
266
|
+
inverse: [7, 27],
|
|
267
|
+
hidden: [8, 28],
|
|
268
|
+
strikethrough: [9, 29]
|
|
269
|
+
},
|
|
270
|
+
color: {
|
|
271
|
+
black: [30, 39],
|
|
272
|
+
red: [31, 39],
|
|
273
|
+
green: [32, 39],
|
|
274
|
+
yellow: [33, 39],
|
|
275
|
+
blue: [34, 39],
|
|
276
|
+
magenta: [35, 39],
|
|
277
|
+
cyan: [36, 39],
|
|
278
|
+
white: [37, 39],
|
|
279
|
+
// Bright color
|
|
280
|
+
blackBright: [90, 39],
|
|
281
|
+
gray: [90, 39],
|
|
282
|
+
// Alias of `blackBright`
|
|
283
|
+
grey: [90, 39],
|
|
284
|
+
// Alias of `blackBright`
|
|
285
|
+
redBright: [91, 39],
|
|
286
|
+
greenBright: [92, 39],
|
|
287
|
+
yellowBright: [93, 39],
|
|
288
|
+
blueBright: [94, 39],
|
|
289
|
+
magentaBright: [95, 39],
|
|
290
|
+
cyanBright: [96, 39],
|
|
291
|
+
whiteBright: [97, 39]
|
|
292
|
+
},
|
|
293
|
+
bgColor: {
|
|
294
|
+
bgBlack: [40, 49],
|
|
295
|
+
bgRed: [41, 49],
|
|
296
|
+
bgGreen: [42, 49],
|
|
297
|
+
bgYellow: [43, 49],
|
|
298
|
+
bgBlue: [44, 49],
|
|
299
|
+
bgMagenta: [45, 49],
|
|
300
|
+
bgCyan: [46, 49],
|
|
301
|
+
bgWhite: [47, 49],
|
|
302
|
+
// Bright color
|
|
303
|
+
bgBlackBright: [100, 49],
|
|
304
|
+
bgGray: [100, 49],
|
|
305
|
+
// Alias of `bgBlackBright`
|
|
306
|
+
bgGrey: [100, 49],
|
|
307
|
+
// Alias of `bgBlackBright`
|
|
308
|
+
bgRedBright: [101, 49],
|
|
309
|
+
bgGreenBright: [102, 49],
|
|
310
|
+
bgYellowBright: [103, 49],
|
|
311
|
+
bgBlueBright: [104, 49],
|
|
312
|
+
bgMagentaBright: [105, 49],
|
|
313
|
+
bgCyanBright: [106, 49],
|
|
314
|
+
bgWhiteBright: [107, 49]
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
modifierNames2 = Object.keys(styles2.modifier);
|
|
318
|
+
foregroundColorNames2 = Object.keys(styles2.color);
|
|
319
|
+
backgroundColorNames2 = Object.keys(styles2.bgColor);
|
|
320
|
+
colorNames2 = [...foregroundColorNames2, ...backgroundColorNames2];
|
|
321
|
+
ansiStyles2 = assembleStyles2();
|
|
322
|
+
ansi_styles_default2 = ansiStyles2;
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
// ../../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js
|
|
327
|
+
import process2 from "node:process";
|
|
328
|
+
import os from "node:os";
|
|
329
|
+
import tty from "node:tty";
|
|
330
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
|
|
331
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
332
|
+
const position = argv.indexOf(prefix + flag);
|
|
333
|
+
const terminatorPosition = argv.indexOf("--");
|
|
334
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
335
|
+
}
|
|
336
|
+
function envForceColor() {
|
|
337
|
+
if ("FORCE_COLOR" in env) {
|
|
338
|
+
if (env.FORCE_COLOR === "true") {
|
|
339
|
+
return 1;
|
|
340
|
+
}
|
|
341
|
+
if (env.FORCE_COLOR === "false") {
|
|
342
|
+
return 0;
|
|
343
|
+
}
|
|
344
|
+
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
function translateLevel(level) {
|
|
348
|
+
if (level === 0) {
|
|
349
|
+
return false;
|
|
350
|
+
}
|
|
351
|
+
return {
|
|
352
|
+
level,
|
|
353
|
+
hasBasic: true,
|
|
354
|
+
has256: level >= 2,
|
|
355
|
+
has16m: level >= 3
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
359
|
+
const noFlagForceColor = envForceColor();
|
|
360
|
+
if (noFlagForceColor !== void 0) {
|
|
361
|
+
flagForceColor = noFlagForceColor;
|
|
362
|
+
}
|
|
363
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
364
|
+
if (forceColor === 0) {
|
|
365
|
+
return 0;
|
|
366
|
+
}
|
|
367
|
+
if (sniffFlags) {
|
|
368
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
369
|
+
return 3;
|
|
370
|
+
}
|
|
371
|
+
if (hasFlag("color=256")) {
|
|
372
|
+
return 2;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
|
376
|
+
return 1;
|
|
377
|
+
}
|
|
378
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
379
|
+
return 0;
|
|
380
|
+
}
|
|
381
|
+
const min = forceColor || 0;
|
|
382
|
+
if (env.TERM === "dumb") {
|
|
383
|
+
return min;
|
|
384
|
+
}
|
|
385
|
+
if (process2.platform === "win32") {
|
|
386
|
+
const osRelease = os.release().split(".");
|
|
387
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
388
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
389
|
+
}
|
|
390
|
+
return 1;
|
|
391
|
+
}
|
|
392
|
+
if ("CI" in env) {
|
|
393
|
+
if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
|
|
394
|
+
return 3;
|
|
395
|
+
}
|
|
396
|
+
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
397
|
+
return 1;
|
|
398
|
+
}
|
|
399
|
+
return min;
|
|
400
|
+
}
|
|
401
|
+
if ("TEAMCITY_VERSION" in env) {
|
|
402
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
403
|
+
}
|
|
404
|
+
if (env.COLORTERM === "truecolor") {
|
|
405
|
+
return 3;
|
|
406
|
+
}
|
|
407
|
+
if (env.TERM === "xterm-kitty") {
|
|
408
|
+
return 3;
|
|
409
|
+
}
|
|
410
|
+
if ("TERM_PROGRAM" in env) {
|
|
411
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
412
|
+
switch (env.TERM_PROGRAM) {
|
|
413
|
+
case "iTerm.app": {
|
|
414
|
+
return version >= 3 ? 3 : 2;
|
|
415
|
+
}
|
|
416
|
+
case "Apple_Terminal": {
|
|
417
|
+
return 2;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
422
|
+
return 2;
|
|
423
|
+
}
|
|
424
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
425
|
+
return 1;
|
|
426
|
+
}
|
|
427
|
+
if ("COLORTERM" in env) {
|
|
428
|
+
return 1;
|
|
429
|
+
}
|
|
430
|
+
return min;
|
|
431
|
+
}
|
|
432
|
+
function createSupportsColor(stream, options = {}) {
|
|
433
|
+
const level = _supportsColor(stream, {
|
|
434
|
+
streamIsTTY: stream && stream.isTTY,
|
|
435
|
+
...options
|
|
436
|
+
});
|
|
437
|
+
return translateLevel(level);
|
|
438
|
+
}
|
|
439
|
+
var env, flagForceColor, supportsColor, supports_color_default;
|
|
440
|
+
var init_supports_color = __esm({
|
|
441
|
+
"../../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js"() {
|
|
442
|
+
({ env } = process2);
|
|
443
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
444
|
+
flagForceColor = 0;
|
|
445
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
446
|
+
flagForceColor = 1;
|
|
447
|
+
}
|
|
448
|
+
supportsColor = {
|
|
449
|
+
stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
|
|
450
|
+
stderr: createSupportsColor({ isTTY: tty.isatty(2) })
|
|
451
|
+
};
|
|
452
|
+
supports_color_default = supportsColor;
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
// ../../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js
|
|
457
|
+
function stringReplaceAll(string, substring, replacer) {
|
|
458
|
+
let index = string.indexOf(substring);
|
|
459
|
+
if (index === -1) {
|
|
460
|
+
return string;
|
|
461
|
+
}
|
|
462
|
+
const substringLength = substring.length;
|
|
463
|
+
let endIndex = 0;
|
|
464
|
+
let returnValue = "";
|
|
465
|
+
do {
|
|
466
|
+
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
467
|
+
endIndex = index + substringLength;
|
|
468
|
+
index = string.indexOf(substring, endIndex);
|
|
469
|
+
} while (index !== -1);
|
|
470
|
+
returnValue += string.slice(endIndex);
|
|
471
|
+
return returnValue;
|
|
472
|
+
}
|
|
473
|
+
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
474
|
+
let endIndex = 0;
|
|
475
|
+
let returnValue = "";
|
|
476
|
+
do {
|
|
477
|
+
const gotCR = string[index - 1] === "\r";
|
|
478
|
+
returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
479
|
+
endIndex = index + 1;
|
|
480
|
+
index = string.indexOf("\n", endIndex);
|
|
481
|
+
} while (index !== -1);
|
|
482
|
+
returnValue += string.slice(endIndex);
|
|
483
|
+
return returnValue;
|
|
484
|
+
}
|
|
485
|
+
var init_utilities = __esm({
|
|
486
|
+
"../../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js"() {
|
|
487
|
+
}
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
// ../../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js
|
|
491
|
+
var source_exports = {};
|
|
492
|
+
__export(source_exports, {
|
|
493
|
+
Chalk: () => Chalk,
|
|
494
|
+
backgroundColorNames: () => backgroundColorNames2,
|
|
495
|
+
backgroundColors: () => backgroundColorNames2,
|
|
496
|
+
chalkStderr: () => chalkStderr,
|
|
497
|
+
colorNames: () => colorNames2,
|
|
498
|
+
colors: () => colorNames2,
|
|
499
|
+
default: () => source_default,
|
|
500
|
+
foregroundColorNames: () => foregroundColorNames2,
|
|
501
|
+
foregroundColors: () => foregroundColorNames2,
|
|
502
|
+
modifierNames: () => modifierNames2,
|
|
503
|
+
modifiers: () => modifierNames2,
|
|
504
|
+
supportsColor: () => stdoutColor,
|
|
505
|
+
supportsColorStderr: () => stderrColor
|
|
506
|
+
});
|
|
507
|
+
function createChalk(options) {
|
|
508
|
+
return chalkFactory(options);
|
|
509
|
+
}
|
|
510
|
+
var stdoutColor, stderrColor, GENERATOR, STYLER, IS_EMPTY, levelMapping, styles3, applyOptions, Chalk, chalkFactory, getModelAnsi, usedModels, proto, createStyler, createBuilder, applyStyle, chalk, chalkStderr, source_default;
|
|
511
|
+
var init_source = __esm({
|
|
512
|
+
"../../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js"() {
|
|
513
|
+
init_ansi_styles();
|
|
514
|
+
init_supports_color();
|
|
515
|
+
init_utilities();
|
|
516
|
+
init_ansi_styles();
|
|
517
|
+
({ stdout: stdoutColor, stderr: stderrColor } = supports_color_default);
|
|
518
|
+
GENERATOR = Symbol("GENERATOR");
|
|
519
|
+
STYLER = Symbol("STYLER");
|
|
520
|
+
IS_EMPTY = Symbol("IS_EMPTY");
|
|
521
|
+
levelMapping = [
|
|
522
|
+
"ansi",
|
|
523
|
+
"ansi",
|
|
524
|
+
"ansi256",
|
|
525
|
+
"ansi16m"
|
|
526
|
+
];
|
|
527
|
+
styles3 = /* @__PURE__ */ Object.create(null);
|
|
528
|
+
applyOptions = (object, options = {}) => {
|
|
529
|
+
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
530
|
+
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
531
|
+
}
|
|
532
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
533
|
+
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
534
|
+
};
|
|
535
|
+
Chalk = class {
|
|
536
|
+
constructor(options) {
|
|
537
|
+
return chalkFactory(options);
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
chalkFactory = (options) => {
|
|
541
|
+
const chalk2 = (...strings) => strings.join(" ");
|
|
542
|
+
applyOptions(chalk2, options);
|
|
543
|
+
Object.setPrototypeOf(chalk2, createChalk.prototype);
|
|
544
|
+
return chalk2;
|
|
545
|
+
};
|
|
546
|
+
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
547
|
+
for (const [styleName, style] of Object.entries(ansi_styles_default2)) {
|
|
548
|
+
styles3[styleName] = {
|
|
549
|
+
get() {
|
|
550
|
+
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
551
|
+
Object.defineProperty(this, styleName, { value: builder });
|
|
552
|
+
return builder;
|
|
553
|
+
}
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
styles3.visible = {
|
|
557
|
+
get() {
|
|
558
|
+
const builder = createBuilder(this, this[STYLER], true);
|
|
559
|
+
Object.defineProperty(this, "visible", { value: builder });
|
|
560
|
+
return builder;
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
getModelAnsi = (model, level, type, ...arguments_) => {
|
|
564
|
+
if (model === "rgb") {
|
|
565
|
+
if (level === "ansi16m") {
|
|
566
|
+
return ansi_styles_default2[type].ansi16m(...arguments_);
|
|
567
|
+
}
|
|
568
|
+
if (level === "ansi256") {
|
|
569
|
+
return ansi_styles_default2[type].ansi256(ansi_styles_default2.rgbToAnsi256(...arguments_));
|
|
570
|
+
}
|
|
571
|
+
return ansi_styles_default2[type].ansi(ansi_styles_default2.rgbToAnsi(...arguments_));
|
|
572
|
+
}
|
|
573
|
+
if (model === "hex") {
|
|
574
|
+
return getModelAnsi("rgb", level, type, ...ansi_styles_default2.hexToRgb(...arguments_));
|
|
575
|
+
}
|
|
576
|
+
return ansi_styles_default2[type][model](...arguments_);
|
|
577
|
+
};
|
|
578
|
+
usedModels = ["rgb", "hex", "ansi256"];
|
|
579
|
+
for (const model of usedModels) {
|
|
580
|
+
styles3[model] = {
|
|
581
|
+
get() {
|
|
582
|
+
const { level } = this;
|
|
583
|
+
return function(...arguments_) {
|
|
584
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default2.color.close, this[STYLER]);
|
|
585
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
590
|
+
styles3[bgModel] = {
|
|
591
|
+
get() {
|
|
592
|
+
const { level } = this;
|
|
593
|
+
return function(...arguments_) {
|
|
594
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default2.bgColor.close, this[STYLER]);
|
|
595
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
proto = Object.defineProperties(() => {
|
|
601
|
+
}, {
|
|
602
|
+
...styles3,
|
|
603
|
+
level: {
|
|
604
|
+
enumerable: true,
|
|
605
|
+
get() {
|
|
606
|
+
return this[GENERATOR].level;
|
|
607
|
+
},
|
|
608
|
+
set(level) {
|
|
609
|
+
this[GENERATOR].level = level;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
});
|
|
613
|
+
createStyler = (open, close, parent) => {
|
|
614
|
+
let openAll;
|
|
615
|
+
let closeAll;
|
|
616
|
+
if (parent === void 0) {
|
|
617
|
+
openAll = open;
|
|
618
|
+
closeAll = close;
|
|
619
|
+
} else {
|
|
620
|
+
openAll = parent.openAll + open;
|
|
621
|
+
closeAll = close + parent.closeAll;
|
|
622
|
+
}
|
|
623
|
+
return {
|
|
624
|
+
open,
|
|
625
|
+
close,
|
|
626
|
+
openAll,
|
|
627
|
+
closeAll,
|
|
628
|
+
parent
|
|
629
|
+
};
|
|
630
|
+
};
|
|
631
|
+
createBuilder = (self, _styler, _isEmpty) => {
|
|
632
|
+
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
633
|
+
Object.setPrototypeOf(builder, proto);
|
|
634
|
+
builder[GENERATOR] = self;
|
|
635
|
+
builder[STYLER] = _styler;
|
|
636
|
+
builder[IS_EMPTY] = _isEmpty;
|
|
637
|
+
return builder;
|
|
638
|
+
};
|
|
639
|
+
applyStyle = (self, string) => {
|
|
640
|
+
if (self.level <= 0 || !string) {
|
|
641
|
+
return self[IS_EMPTY] ? "" : string;
|
|
642
|
+
}
|
|
643
|
+
let styler = self[STYLER];
|
|
644
|
+
if (styler === void 0) {
|
|
645
|
+
return string;
|
|
646
|
+
}
|
|
647
|
+
const { openAll, closeAll } = styler;
|
|
648
|
+
if (string.includes("\x1B")) {
|
|
649
|
+
while (styler !== void 0) {
|
|
650
|
+
string = stringReplaceAll(string, styler.close, styler.open);
|
|
651
|
+
styler = styler.parent;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
const lfIndex = string.indexOf("\n");
|
|
655
|
+
if (lfIndex !== -1) {
|
|
656
|
+
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
657
|
+
}
|
|
658
|
+
return openAll + string + closeAll;
|
|
659
|
+
};
|
|
660
|
+
Object.defineProperties(createChalk.prototype, styles3);
|
|
661
|
+
chalk = createChalk();
|
|
662
|
+
chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
663
|
+
source_default = chalk;
|
|
664
|
+
}
|
|
665
|
+
});
|
|
666
|
+
|
|
667
|
+
// ../../src/error-cause/dist/esm/index.js
|
|
668
|
+
var create = (cls, defaultFrom, message, cause, from = defaultFrom) => {
|
|
669
|
+
const er = new cls(message, cause ? { cause } : void 0);
|
|
670
|
+
Error.captureStackTrace?.(er, from);
|
|
671
|
+
return er;
|
|
672
|
+
};
|
|
673
|
+
var error = (message, cause, from) => create(Error, error, message, cause, from);
|
|
674
|
+
|
|
675
|
+
// ../../src/xdg/dist/esm/index.js
|
|
676
|
+
import { homedir, tmpdir } from "node:os";
|
|
677
|
+
import { resolve } from "node:path";
|
|
678
|
+
var root = homedir();
|
|
679
|
+
var path = (p) => resolve(root, p);
|
|
680
|
+
var defaults = process.platform === "darwin" ? (which) => {
|
|
681
|
+
switch (which) {
|
|
682
|
+
case "config":
|
|
683
|
+
return path("Library/Preferences");
|
|
684
|
+
case "cache":
|
|
685
|
+
return path("Library/Caches");
|
|
686
|
+
case "data":
|
|
687
|
+
return path("Library/Application Support");
|
|
688
|
+
case "state":
|
|
689
|
+
return path("Library/State");
|
|
690
|
+
case "runtime":
|
|
691
|
+
return resolve(
|
|
692
|
+
tmpdir(),
|
|
693
|
+
/* c8 ignore next */
|
|
694
|
+
String(process.getuid?.() ?? ""),
|
|
695
|
+
".run"
|
|
696
|
+
);
|
|
697
|
+
}
|
|
698
|
+
} : process.platform === "win32" ? (which) => {
|
|
699
|
+
const ad = process.env.APPDATA ?? path("AppData/Roaming");
|
|
700
|
+
const lad = process.env.LOCALAPPDATA ?? path("AppData/Local");
|
|
701
|
+
switch (which) {
|
|
702
|
+
case "config":
|
|
703
|
+
return resolve(ad, "xdg.config");
|
|
704
|
+
case "cache":
|
|
705
|
+
return resolve(lad, "xdg.cache");
|
|
706
|
+
case "data":
|
|
707
|
+
return resolve(ad, "xdg.data");
|
|
708
|
+
case "state":
|
|
709
|
+
return resolve(lad, "xdg.state");
|
|
710
|
+
case "runtime":
|
|
711
|
+
return resolve(tmpdir(), "xdg.run");
|
|
712
|
+
}
|
|
713
|
+
} : (which) => {
|
|
714
|
+
switch (which) {
|
|
715
|
+
case "config":
|
|
716
|
+
return path(".config");
|
|
717
|
+
case "cache":
|
|
718
|
+
return path(".cache");
|
|
719
|
+
case "data":
|
|
720
|
+
return path(".local/data");
|
|
721
|
+
case "state":
|
|
722
|
+
return path(".local/state");
|
|
723
|
+
case "runtime":
|
|
724
|
+
return resolve(
|
|
725
|
+
tmpdir(),
|
|
726
|
+
/* c8 ignore next */
|
|
727
|
+
String(process.getuid?.() ?? ""),
|
|
728
|
+
".run"
|
|
729
|
+
);
|
|
730
|
+
}
|
|
731
|
+
};
|
|
732
|
+
var { XDG_CONFIG_HOME = defaults("config"), XDG_CACHE_HOME = defaults("cache"), XDG_DATA_HOME = defaults("data"), XDG_STATE_HOME = defaults("state"), XDG_RUNTIME_DIR = defaults("runtime") } = process.env;
|
|
733
|
+
var XDG = class {
|
|
734
|
+
name;
|
|
735
|
+
base = {
|
|
736
|
+
config: XDG_CONFIG_HOME,
|
|
737
|
+
cache: XDG_CACHE_HOME,
|
|
738
|
+
data: XDG_DATA_HOME,
|
|
739
|
+
state: XDG_STATE_HOME,
|
|
740
|
+
runtime: XDG_RUNTIME_DIR
|
|
741
|
+
};
|
|
742
|
+
constructor(name) {
|
|
743
|
+
this.name = name;
|
|
744
|
+
}
|
|
745
|
+
config(p = "") {
|
|
746
|
+
return resolve(this.base.config, this.name, p);
|
|
747
|
+
}
|
|
748
|
+
cache(p = "") {
|
|
749
|
+
return resolve(this.base.cache, this.name, p);
|
|
750
|
+
}
|
|
751
|
+
data(p = "") {
|
|
752
|
+
return resolve(this.base.data, this.name, p);
|
|
753
|
+
}
|
|
754
|
+
state(p = "") {
|
|
755
|
+
return resolve(this.base.state, this.name, p);
|
|
756
|
+
}
|
|
757
|
+
runtime(p = "") {
|
|
758
|
+
return resolve(this.base.runtime, this.name, p);
|
|
759
|
+
}
|
|
760
|
+
};
|
|
761
|
+
|
|
762
|
+
// ../../src/vlt/dist/esm/config/index.js
|
|
763
|
+
import { readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
764
|
+
import { lstat, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
765
|
+
import { homedir as homedir3 } from "node:os";
|
|
766
|
+
import { dirname as dirname2, resolve as resolve3 } from "node:path";
|
|
767
|
+
|
|
768
|
+
// ../../node_modules/.pnpm/polite-json@5.0.0/node_modules/polite-json/dist/esm/index.js
|
|
769
|
+
var hexify = (s) => Array.from(s).map((c) => "0x" + c.charCodeAt(0).toString(16).toUpperCase().padStart(2, "0")).join("");
|
|
770
|
+
var parseError = (e, txt, context) => {
|
|
771
|
+
if (!txt) {
|
|
772
|
+
return {
|
|
773
|
+
message: e.message + " while parsing empty string",
|
|
774
|
+
position: 0
|
|
775
|
+
};
|
|
776
|
+
}
|
|
777
|
+
const badToken = e.message.match(/^Unexpected (?:token (.*?))?/i);
|
|
778
|
+
const atPos = e.message.match(/at positions? (\d+)/);
|
|
779
|
+
const errIdx = /^Unexpected end of JSON|Unterminated string in JSON/i.test(e.message) ? txt.length - 1 : atPos && atPos[1] ? +atPos[1] : /is not valid JSON$/.test(e.message) ? 0 : null;
|
|
780
|
+
const msg = badToken && badToken[1] ? e.message.replace(/^Unexpected token ./, `Unexpected token ${JSON.stringify(badToken[1])} (${hexify(badToken[1])})`) : e.message;
|
|
781
|
+
if (errIdx !== null && errIdx !== void 0) {
|
|
782
|
+
const start = errIdx <= context ? 0 : errIdx - context;
|
|
783
|
+
const end = errIdx + context >= txt.length ? txt.length : errIdx + context;
|
|
784
|
+
const slice = (start === 0 ? "" : "...") + txt.slice(start, end) + (end === txt.length ? "" : "...");
|
|
785
|
+
const near = txt === slice ? "" : "near ";
|
|
786
|
+
return {
|
|
787
|
+
message: msg + ` while parsing ${near}${JSON.stringify(slice)}`,
|
|
788
|
+
position: errIdx
|
|
789
|
+
};
|
|
790
|
+
} else {
|
|
791
|
+
return {
|
|
792
|
+
message: msg + ` while parsing '${txt.slice(0, context * 2)}'`,
|
|
793
|
+
position: 0
|
|
794
|
+
};
|
|
795
|
+
}
|
|
796
|
+
};
|
|
797
|
+
var JSONParseError = class extends SyntaxError {
|
|
798
|
+
code;
|
|
799
|
+
cause;
|
|
800
|
+
position;
|
|
801
|
+
constructor(er, txt, context = 20, caller) {
|
|
802
|
+
const { message, position } = parseError(er, txt, context);
|
|
803
|
+
super(message);
|
|
804
|
+
this.cause = er;
|
|
805
|
+
this.position = position;
|
|
806
|
+
this.code = "EJSONPARSE";
|
|
807
|
+
Error.captureStackTrace(this, caller || this.constructor);
|
|
808
|
+
}
|
|
809
|
+
get name() {
|
|
810
|
+
return this.constructor.name;
|
|
811
|
+
}
|
|
812
|
+
set name(_) {
|
|
813
|
+
}
|
|
814
|
+
get [Symbol.toStringTag]() {
|
|
815
|
+
return this.constructor.name;
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
var kIndent = Symbol.for("indent");
|
|
819
|
+
var kNewline = Symbol.for("newline");
|
|
820
|
+
var formatRE = /^\s*[{\[]((?:\r?\n)+)([\s\t]*)/;
|
|
821
|
+
var emptyRE = /^(?:\{\}|\[\])((?:\r?\n)+)?$/;
|
|
822
|
+
var parse = (txt, reviver, context) => {
|
|
823
|
+
const parseText = stripBOM(String(txt));
|
|
824
|
+
if (!reviver)
|
|
825
|
+
reviver = void 0;
|
|
826
|
+
context = context || 20;
|
|
827
|
+
try {
|
|
828
|
+
const [, newline = "\n", indent2 = " "] = parseText.match(emptyRE) || parseText.match(formatRE) || [, "", ""];
|
|
829
|
+
const result = JSON.parse(parseText, reviver);
|
|
830
|
+
if (result && typeof result === "object") {
|
|
831
|
+
result[kNewline] = newline;
|
|
832
|
+
result[kIndent] = indent2;
|
|
833
|
+
}
|
|
834
|
+
return result;
|
|
835
|
+
} catch (e) {
|
|
836
|
+
if (typeof txt !== "string" && !Buffer.isBuffer(txt)) {
|
|
837
|
+
const isEmptyArray = Array.isArray(txt) && txt.length === 0;
|
|
838
|
+
throw Object.assign(new TypeError(`Cannot parse ${isEmptyArray ? "an empty array" : String(txt)}`), {
|
|
839
|
+
code: "EJSONPARSE",
|
|
840
|
+
systemError: e
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
throw new JSONParseError(e, parseText, context, parse);
|
|
844
|
+
}
|
|
845
|
+
};
|
|
846
|
+
var stripBOM = (txt) => String(txt).replace(/^\uFEFF/, "");
|
|
847
|
+
var stringify = (obj, replacer, indent2) => {
|
|
848
|
+
const space = indent2 === void 0 ? obj[kIndent] : indent2;
|
|
849
|
+
const res = (
|
|
850
|
+
/* c8 ignore start */
|
|
851
|
+
typeof replacer === "function" ? JSON.stringify(obj, replacer, space) : JSON.stringify(obj, replacer, space)
|
|
852
|
+
);
|
|
853
|
+
const nl = obj[kNewline] || "\n";
|
|
854
|
+
return space ? (nl === "\n" ? res : res.split("\n").join(nl)) + nl : res;
|
|
855
|
+
};
|
|
856
|
+
|
|
857
|
+
// ../../node_modules/.pnpm/walk-up-path@4.0.0/node_modules/walk-up-path/dist/esm/index.js
|
|
858
|
+
import { dirname, resolve as resolve2 } from "node:path";
|
|
859
|
+
var walkUp = function* (path2) {
|
|
860
|
+
for (path2 = resolve2(path2); path2; ) {
|
|
861
|
+
yield path2;
|
|
862
|
+
const pp = dirname(path2);
|
|
863
|
+
if (pp === path2) {
|
|
864
|
+
break;
|
|
865
|
+
} else {
|
|
866
|
+
path2 = pp;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
};
|
|
870
|
+
|
|
871
|
+
// ../../node_modules/.pnpm/jackspeak@4.0.2/node_modules/jackspeak/dist/esm/index.js
|
|
872
|
+
import { inspect, parseArgs } from "node:util";
|
|
873
|
+
|
|
874
|
+
// ../../node_modules/.pnpm/@isaacs+cliui@8.0.2/node_modules/@isaacs/cliui/build/lib/index.js
|
|
875
|
+
var align = {
|
|
876
|
+
right: alignRight,
|
|
877
|
+
center: alignCenter
|
|
878
|
+
};
|
|
879
|
+
var top = 0;
|
|
880
|
+
var right = 1;
|
|
881
|
+
var bottom = 2;
|
|
882
|
+
var left = 3;
|
|
883
|
+
var UI = class {
|
|
884
|
+
constructor(opts) {
|
|
885
|
+
var _a;
|
|
886
|
+
this.width = opts.width;
|
|
887
|
+
this.wrap = (_a = opts.wrap) !== null && _a !== void 0 ? _a : true;
|
|
888
|
+
this.rows = [];
|
|
889
|
+
}
|
|
890
|
+
span(...args) {
|
|
891
|
+
const cols = this.div(...args);
|
|
892
|
+
cols.span = true;
|
|
893
|
+
}
|
|
894
|
+
resetOutput() {
|
|
895
|
+
this.rows = [];
|
|
896
|
+
}
|
|
897
|
+
div(...args) {
|
|
898
|
+
if (args.length === 0) {
|
|
899
|
+
this.div("");
|
|
900
|
+
}
|
|
901
|
+
if (this.wrap && this.shouldApplyLayoutDSL(...args) && typeof args[0] === "string") {
|
|
902
|
+
return this.applyLayoutDSL(args[0]);
|
|
903
|
+
}
|
|
904
|
+
const cols = args.map((arg) => {
|
|
905
|
+
if (typeof arg === "string") {
|
|
906
|
+
return this.colFromString(arg);
|
|
907
|
+
}
|
|
908
|
+
return arg;
|
|
909
|
+
});
|
|
910
|
+
this.rows.push(cols);
|
|
911
|
+
return cols;
|
|
912
|
+
}
|
|
913
|
+
shouldApplyLayoutDSL(...args) {
|
|
914
|
+
return args.length === 1 && typeof args[0] === "string" && /[\t\n]/.test(args[0]);
|
|
915
|
+
}
|
|
916
|
+
applyLayoutDSL(str) {
|
|
917
|
+
const rows = str.split("\n").map((row) => row.split(" "));
|
|
918
|
+
let leftColumnWidth = 0;
|
|
919
|
+
rows.forEach((columns) => {
|
|
920
|
+
if (columns.length > 1 && mixin.stringWidth(columns[0]) > leftColumnWidth) {
|
|
921
|
+
leftColumnWidth = Math.min(Math.floor(this.width * 0.5), mixin.stringWidth(columns[0]));
|
|
922
|
+
}
|
|
923
|
+
});
|
|
924
|
+
rows.forEach((columns) => {
|
|
925
|
+
this.div(...columns.map((r, i) => {
|
|
926
|
+
return {
|
|
927
|
+
text: r.trim(),
|
|
928
|
+
padding: this.measurePadding(r),
|
|
929
|
+
width: i === 0 && columns.length > 1 ? leftColumnWidth : void 0
|
|
930
|
+
};
|
|
931
|
+
}));
|
|
932
|
+
});
|
|
933
|
+
return this.rows[this.rows.length - 1];
|
|
934
|
+
}
|
|
935
|
+
colFromString(text) {
|
|
936
|
+
return {
|
|
937
|
+
text,
|
|
938
|
+
padding: this.measurePadding(text)
|
|
939
|
+
};
|
|
940
|
+
}
|
|
941
|
+
measurePadding(str) {
|
|
942
|
+
const noAnsi = mixin.stripAnsi(str);
|
|
943
|
+
return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length];
|
|
944
|
+
}
|
|
945
|
+
toString() {
|
|
946
|
+
const lines = [];
|
|
947
|
+
this.rows.forEach((row) => {
|
|
948
|
+
this.rowToString(row, lines);
|
|
949
|
+
});
|
|
950
|
+
return lines.filter((line) => !line.hidden).map((line) => line.text).join("\n");
|
|
951
|
+
}
|
|
952
|
+
rowToString(row, lines) {
|
|
953
|
+
this.rasterize(row).forEach((rrow, r) => {
|
|
954
|
+
let str = "";
|
|
955
|
+
rrow.forEach((col, c) => {
|
|
956
|
+
const { width: width2 } = row[c];
|
|
957
|
+
const wrapWidth = this.negatePadding(row[c]);
|
|
958
|
+
let ts = col;
|
|
959
|
+
if (wrapWidth > mixin.stringWidth(col)) {
|
|
960
|
+
ts += " ".repeat(wrapWidth - mixin.stringWidth(col));
|
|
961
|
+
}
|
|
962
|
+
if (row[c].align && row[c].align !== "left" && this.wrap) {
|
|
963
|
+
const fn = align[row[c].align];
|
|
964
|
+
ts = fn(ts, wrapWidth);
|
|
965
|
+
if (mixin.stringWidth(ts) < wrapWidth) {
|
|
966
|
+
const w = width2 || 0;
|
|
967
|
+
ts += " ".repeat(w - mixin.stringWidth(ts) - 1);
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
const padding = row[c].padding || [0, 0, 0, 0];
|
|
971
|
+
if (padding[left]) {
|
|
972
|
+
str += " ".repeat(padding[left]);
|
|
973
|
+
}
|
|
974
|
+
str += addBorder(row[c], ts, "| ");
|
|
975
|
+
str += ts;
|
|
976
|
+
str += addBorder(row[c], ts, " |");
|
|
977
|
+
if (padding[right]) {
|
|
978
|
+
str += " ".repeat(padding[right]);
|
|
979
|
+
}
|
|
980
|
+
if (r === 0 && lines.length > 0) {
|
|
981
|
+
str = this.renderInline(str, lines[lines.length - 1]);
|
|
982
|
+
}
|
|
983
|
+
});
|
|
984
|
+
lines.push({
|
|
985
|
+
text: str.replace(/ +$/, ""),
|
|
986
|
+
span: row.span
|
|
987
|
+
});
|
|
988
|
+
});
|
|
989
|
+
return lines;
|
|
990
|
+
}
|
|
991
|
+
// if the full 'source' can render in
|
|
992
|
+
// the target line, do so.
|
|
993
|
+
renderInline(source, previousLine) {
|
|
994
|
+
const match = source.match(/^ */);
|
|
995
|
+
const leadingWhitespace = match ? match[0].length : 0;
|
|
996
|
+
const target = previousLine.text;
|
|
997
|
+
const targetTextWidth = mixin.stringWidth(target.trimEnd());
|
|
998
|
+
if (!previousLine.span) {
|
|
999
|
+
return source;
|
|
1000
|
+
}
|
|
1001
|
+
if (!this.wrap) {
|
|
1002
|
+
previousLine.hidden = true;
|
|
1003
|
+
return target + source;
|
|
1004
|
+
}
|
|
1005
|
+
if (leadingWhitespace < targetTextWidth) {
|
|
1006
|
+
return source;
|
|
1007
|
+
}
|
|
1008
|
+
previousLine.hidden = true;
|
|
1009
|
+
return target.trimEnd() + " ".repeat(leadingWhitespace - targetTextWidth) + source.trimStart();
|
|
1010
|
+
}
|
|
1011
|
+
rasterize(row) {
|
|
1012
|
+
const rrows = [];
|
|
1013
|
+
const widths = this.columnWidths(row);
|
|
1014
|
+
let wrapped;
|
|
1015
|
+
row.forEach((col, c) => {
|
|
1016
|
+
col.width = widths[c];
|
|
1017
|
+
if (this.wrap) {
|
|
1018
|
+
wrapped = mixin.wrap(col.text, this.negatePadding(col), { hard: true }).split("\n");
|
|
1019
|
+
} else {
|
|
1020
|
+
wrapped = col.text.split("\n");
|
|
1021
|
+
}
|
|
1022
|
+
if (col.border) {
|
|
1023
|
+
wrapped.unshift("." + "-".repeat(this.negatePadding(col) + 2) + ".");
|
|
1024
|
+
wrapped.push("'" + "-".repeat(this.negatePadding(col) + 2) + "'");
|
|
1025
|
+
}
|
|
1026
|
+
if (col.padding) {
|
|
1027
|
+
wrapped.unshift(...new Array(col.padding[top] || 0).fill(""));
|
|
1028
|
+
wrapped.push(...new Array(col.padding[bottom] || 0).fill(""));
|
|
1029
|
+
}
|
|
1030
|
+
wrapped.forEach((str, r) => {
|
|
1031
|
+
if (!rrows[r]) {
|
|
1032
|
+
rrows.push([]);
|
|
1033
|
+
}
|
|
1034
|
+
const rrow = rrows[r];
|
|
1035
|
+
for (let i = 0; i < c; i++) {
|
|
1036
|
+
if (rrow[i] === void 0) {
|
|
1037
|
+
rrow.push("");
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
rrow.push(str);
|
|
1041
|
+
});
|
|
1042
|
+
});
|
|
1043
|
+
return rrows;
|
|
1044
|
+
}
|
|
1045
|
+
negatePadding(col) {
|
|
1046
|
+
let wrapWidth = col.width || 0;
|
|
1047
|
+
if (col.padding) {
|
|
1048
|
+
wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0);
|
|
1049
|
+
}
|
|
1050
|
+
if (col.border) {
|
|
1051
|
+
wrapWidth -= 4;
|
|
1052
|
+
}
|
|
1053
|
+
return wrapWidth;
|
|
1054
|
+
}
|
|
1055
|
+
columnWidths(row) {
|
|
1056
|
+
if (!this.wrap) {
|
|
1057
|
+
return row.map((col) => {
|
|
1058
|
+
return col.width || mixin.stringWidth(col.text);
|
|
1059
|
+
});
|
|
1060
|
+
}
|
|
1061
|
+
let unset = row.length;
|
|
1062
|
+
let remainingWidth = this.width;
|
|
1063
|
+
const widths = row.map((col) => {
|
|
1064
|
+
if (col.width) {
|
|
1065
|
+
unset--;
|
|
1066
|
+
remainingWidth -= col.width;
|
|
1067
|
+
return col.width;
|
|
1068
|
+
}
|
|
1069
|
+
return void 0;
|
|
1070
|
+
});
|
|
1071
|
+
const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0;
|
|
1072
|
+
return widths.map((w, i) => {
|
|
1073
|
+
if (w === void 0) {
|
|
1074
|
+
return Math.max(unsetWidth, _minWidth(row[i]));
|
|
1075
|
+
}
|
|
1076
|
+
return w;
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
1079
|
+
};
|
|
1080
|
+
function addBorder(col, ts, style) {
|
|
1081
|
+
if (col.border) {
|
|
1082
|
+
if (/[.']-+[.']/.test(ts)) {
|
|
1083
|
+
return "";
|
|
1084
|
+
}
|
|
1085
|
+
if (ts.trim().length !== 0) {
|
|
1086
|
+
return style;
|
|
1087
|
+
}
|
|
1088
|
+
return " ";
|
|
1089
|
+
}
|
|
1090
|
+
return "";
|
|
1091
|
+
}
|
|
1092
|
+
function _minWidth(col) {
|
|
1093
|
+
const padding = col.padding || [];
|
|
1094
|
+
const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0);
|
|
1095
|
+
if (col.border) {
|
|
1096
|
+
return minWidth + 4;
|
|
1097
|
+
}
|
|
1098
|
+
return minWidth;
|
|
1099
|
+
}
|
|
1100
|
+
function getWindowWidth() {
|
|
1101
|
+
if (typeof process === "object" && process.stdout && process.stdout.columns) {
|
|
1102
|
+
return process.stdout.columns;
|
|
1103
|
+
}
|
|
1104
|
+
return 80;
|
|
1105
|
+
}
|
|
1106
|
+
function alignRight(str, width2) {
|
|
1107
|
+
str = str.trim();
|
|
1108
|
+
const strWidth = mixin.stringWidth(str);
|
|
1109
|
+
if (strWidth < width2) {
|
|
1110
|
+
return " ".repeat(width2 - strWidth) + str;
|
|
1111
|
+
}
|
|
1112
|
+
return str;
|
|
1113
|
+
}
|
|
1114
|
+
function alignCenter(str, width2) {
|
|
1115
|
+
str = str.trim();
|
|
1116
|
+
const strWidth = mixin.stringWidth(str);
|
|
1117
|
+
if (strWidth >= width2) {
|
|
1118
|
+
return str;
|
|
1119
|
+
}
|
|
1120
|
+
return " ".repeat(width2 - strWidth >> 1) + str;
|
|
1121
|
+
}
|
|
1122
|
+
var mixin;
|
|
1123
|
+
function cliui(opts, _mixin) {
|
|
1124
|
+
mixin = _mixin;
|
|
1125
|
+
return new UI({
|
|
1126
|
+
/* c8 ignore start */
|
|
1127
|
+
width: (opts === null || opts === void 0 ? void 0 : opts.width) || getWindowWidth(),
|
|
1128
|
+
wrap: opts === null || opts === void 0 ? void 0 : opts.wrap
|
|
1129
|
+
/* c8 ignore stop */
|
|
1130
|
+
});
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
// ../../node_modules/.pnpm/ansi-regex@6.0.1/node_modules/ansi-regex/index.js
|
|
1134
|
+
function ansiRegex({ onlyFirst = false } = {}) {
|
|
1135
|
+
const pattern = [
|
|
1136
|
+
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
|
|
1137
|
+
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
|
|
1138
|
+
].join("|");
|
|
1139
|
+
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
// ../../node_modules/.pnpm/strip-ansi@7.1.0/node_modules/strip-ansi/index.js
|
|
1143
|
+
var regex = ansiRegex();
|
|
1144
|
+
function stripAnsi(string) {
|
|
1145
|
+
if (typeof string !== "string") {
|
|
1146
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
1147
|
+
}
|
|
1148
|
+
return string.replace(regex, "");
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
// ../../node_modules/.pnpm/string-width@5.1.2/node_modules/string-width/index.js
|
|
1152
|
+
var import_eastasianwidth = __toESM(require_eastasianwidth(), 1);
|
|
1153
|
+
var import_emoji_regex = __toESM(require_emoji_regex(), 1);
|
|
1154
|
+
function stringWidth(string, options = {}) {
|
|
1155
|
+
if (typeof string !== "string" || string.length === 0) {
|
|
1156
|
+
return 0;
|
|
1157
|
+
}
|
|
1158
|
+
options = {
|
|
1159
|
+
ambiguousIsNarrow: true,
|
|
1160
|
+
...options
|
|
1161
|
+
};
|
|
1162
|
+
string = stripAnsi(string);
|
|
1163
|
+
if (string.length === 0) {
|
|
1164
|
+
return 0;
|
|
1165
|
+
}
|
|
1166
|
+
string = string.replace((0, import_emoji_regex.default)(), " ");
|
|
1167
|
+
const ambiguousCharacterWidth = options.ambiguousIsNarrow ? 1 : 2;
|
|
1168
|
+
let width2 = 0;
|
|
1169
|
+
for (const character of string) {
|
|
1170
|
+
const codePoint = character.codePointAt(0);
|
|
1171
|
+
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
|
|
1172
|
+
continue;
|
|
1173
|
+
}
|
|
1174
|
+
if (codePoint >= 768 && codePoint <= 879) {
|
|
1175
|
+
continue;
|
|
1176
|
+
}
|
|
1177
|
+
const code = import_eastasianwidth.default.eastAsianWidth(character);
|
|
1178
|
+
switch (code) {
|
|
1179
|
+
case "F":
|
|
1180
|
+
case "W":
|
|
1181
|
+
width2 += 2;
|
|
1182
|
+
break;
|
|
1183
|
+
case "A":
|
|
1184
|
+
width2 += ambiguousCharacterWidth;
|
|
1185
|
+
break;
|
|
1186
|
+
default:
|
|
1187
|
+
width2 += 1;
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
return width2;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
// ../../node_modules/.pnpm/ansi-styles@6.2.1/node_modules/ansi-styles/index.js
|
|
1194
|
+
var ANSI_BACKGROUND_OFFSET = 10;
|
|
1195
|
+
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
1196
|
+
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
1197
|
+
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
1198
|
+
var styles = {
|
|
1199
|
+
modifier: {
|
|
1200
|
+
reset: [0, 0],
|
|
1201
|
+
// 21 isn't widely supported and 22 does the same thing
|
|
1202
|
+
bold: [1, 22],
|
|
1203
|
+
dim: [2, 22],
|
|
1204
|
+
italic: [3, 23],
|
|
1205
|
+
underline: [4, 24],
|
|
1206
|
+
overline: [53, 55],
|
|
1207
|
+
inverse: [7, 27],
|
|
1208
|
+
hidden: [8, 28],
|
|
1209
|
+
strikethrough: [9, 29]
|
|
1210
|
+
},
|
|
1211
|
+
color: {
|
|
1212
|
+
black: [30, 39],
|
|
1213
|
+
red: [31, 39],
|
|
1214
|
+
green: [32, 39],
|
|
1215
|
+
yellow: [33, 39],
|
|
1216
|
+
blue: [34, 39],
|
|
1217
|
+
magenta: [35, 39],
|
|
1218
|
+
cyan: [36, 39],
|
|
1219
|
+
white: [37, 39],
|
|
1220
|
+
// Bright color
|
|
1221
|
+
blackBright: [90, 39],
|
|
1222
|
+
gray: [90, 39],
|
|
1223
|
+
// Alias of `blackBright`
|
|
1224
|
+
grey: [90, 39],
|
|
1225
|
+
// Alias of `blackBright`
|
|
1226
|
+
redBright: [91, 39],
|
|
1227
|
+
greenBright: [92, 39],
|
|
1228
|
+
yellowBright: [93, 39],
|
|
1229
|
+
blueBright: [94, 39],
|
|
1230
|
+
magentaBright: [95, 39],
|
|
1231
|
+
cyanBright: [96, 39],
|
|
1232
|
+
whiteBright: [97, 39]
|
|
1233
|
+
},
|
|
1234
|
+
bgColor: {
|
|
1235
|
+
bgBlack: [40, 49],
|
|
1236
|
+
bgRed: [41, 49],
|
|
1237
|
+
bgGreen: [42, 49],
|
|
1238
|
+
bgYellow: [43, 49],
|
|
1239
|
+
bgBlue: [44, 49],
|
|
1240
|
+
bgMagenta: [45, 49],
|
|
1241
|
+
bgCyan: [46, 49],
|
|
1242
|
+
bgWhite: [47, 49],
|
|
1243
|
+
// Bright color
|
|
1244
|
+
bgBlackBright: [100, 49],
|
|
1245
|
+
bgGray: [100, 49],
|
|
1246
|
+
// Alias of `bgBlackBright`
|
|
1247
|
+
bgGrey: [100, 49],
|
|
1248
|
+
// Alias of `bgBlackBright`
|
|
1249
|
+
bgRedBright: [101, 49],
|
|
1250
|
+
bgGreenBright: [102, 49],
|
|
1251
|
+
bgYellowBright: [103, 49],
|
|
1252
|
+
bgBlueBright: [104, 49],
|
|
1253
|
+
bgMagentaBright: [105, 49],
|
|
1254
|
+
bgCyanBright: [106, 49],
|
|
1255
|
+
bgWhiteBright: [107, 49]
|
|
1256
|
+
}
|
|
1257
|
+
};
|
|
1258
|
+
var modifierNames = Object.keys(styles.modifier);
|
|
1259
|
+
var foregroundColorNames = Object.keys(styles.color);
|
|
1260
|
+
var backgroundColorNames = Object.keys(styles.bgColor);
|
|
1261
|
+
var colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
1262
|
+
function assembleStyles() {
|
|
1263
|
+
const codes = /* @__PURE__ */ new Map();
|
|
1264
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
1265
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
1266
|
+
styles[styleName] = {
|
|
1267
|
+
open: `\x1B[${style[0]}m`,
|
|
1268
|
+
close: `\x1B[${style[1]}m`
|
|
1269
|
+
};
|
|
1270
|
+
group[styleName] = styles[styleName];
|
|
1271
|
+
codes.set(style[0], style[1]);
|
|
1272
|
+
}
|
|
1273
|
+
Object.defineProperty(styles, groupName, {
|
|
1274
|
+
value: group,
|
|
1275
|
+
enumerable: false
|
|
1276
|
+
});
|
|
1277
|
+
}
|
|
1278
|
+
Object.defineProperty(styles, "codes", {
|
|
1279
|
+
value: codes,
|
|
1280
|
+
enumerable: false
|
|
1281
|
+
});
|
|
1282
|
+
styles.color.close = "\x1B[39m";
|
|
1283
|
+
styles.bgColor.close = "\x1B[49m";
|
|
1284
|
+
styles.color.ansi = wrapAnsi16();
|
|
1285
|
+
styles.color.ansi256 = wrapAnsi256();
|
|
1286
|
+
styles.color.ansi16m = wrapAnsi16m();
|
|
1287
|
+
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
1288
|
+
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
1289
|
+
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
1290
|
+
Object.defineProperties(styles, {
|
|
1291
|
+
rgbToAnsi256: {
|
|
1292
|
+
value: (red, green, blue) => {
|
|
1293
|
+
if (red === green && green === blue) {
|
|
1294
|
+
if (red < 8) {
|
|
1295
|
+
return 16;
|
|
1296
|
+
}
|
|
1297
|
+
if (red > 248) {
|
|
1298
|
+
return 231;
|
|
1299
|
+
}
|
|
1300
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
1301
|
+
}
|
|
1302
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
1303
|
+
},
|
|
1304
|
+
enumerable: false
|
|
1305
|
+
},
|
|
1306
|
+
hexToRgb: {
|
|
1307
|
+
value: (hex) => {
|
|
1308
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
1309
|
+
if (!matches) {
|
|
1310
|
+
return [0, 0, 0];
|
|
1311
|
+
}
|
|
1312
|
+
let [colorString] = matches;
|
|
1313
|
+
if (colorString.length === 3) {
|
|
1314
|
+
colorString = [...colorString].map((character) => character + character).join("");
|
|
1315
|
+
}
|
|
1316
|
+
const integer = Number.parseInt(colorString, 16);
|
|
1317
|
+
return [
|
|
1318
|
+
/* eslint-disable no-bitwise */
|
|
1319
|
+
integer >> 16 & 255,
|
|
1320
|
+
integer >> 8 & 255,
|
|
1321
|
+
integer & 255
|
|
1322
|
+
/* eslint-enable no-bitwise */
|
|
1323
|
+
];
|
|
1324
|
+
},
|
|
1325
|
+
enumerable: false
|
|
1326
|
+
},
|
|
1327
|
+
hexToAnsi256: {
|
|
1328
|
+
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
1329
|
+
enumerable: false
|
|
1330
|
+
},
|
|
1331
|
+
ansi256ToAnsi: {
|
|
1332
|
+
value: (code) => {
|
|
1333
|
+
if (code < 8) {
|
|
1334
|
+
return 30 + code;
|
|
1335
|
+
}
|
|
1336
|
+
if (code < 16) {
|
|
1337
|
+
return 90 + (code - 8);
|
|
1338
|
+
}
|
|
1339
|
+
let red;
|
|
1340
|
+
let green;
|
|
1341
|
+
let blue;
|
|
1342
|
+
if (code >= 232) {
|
|
1343
|
+
red = ((code - 232) * 10 + 8) / 255;
|
|
1344
|
+
green = red;
|
|
1345
|
+
blue = red;
|
|
1346
|
+
} else {
|
|
1347
|
+
code -= 16;
|
|
1348
|
+
const remainder = code % 36;
|
|
1349
|
+
red = Math.floor(code / 36) / 5;
|
|
1350
|
+
green = Math.floor(remainder / 6) / 5;
|
|
1351
|
+
blue = remainder % 6 / 5;
|
|
1352
|
+
}
|
|
1353
|
+
const value = Math.max(red, green, blue) * 2;
|
|
1354
|
+
if (value === 0) {
|
|
1355
|
+
return 30;
|
|
1356
|
+
}
|
|
1357
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
1358
|
+
if (value === 2) {
|
|
1359
|
+
result += 60;
|
|
1360
|
+
}
|
|
1361
|
+
return result;
|
|
1362
|
+
},
|
|
1363
|
+
enumerable: false
|
|
1364
|
+
},
|
|
1365
|
+
rgbToAnsi: {
|
|
1366
|
+
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
1367
|
+
enumerable: false
|
|
1368
|
+
},
|
|
1369
|
+
hexToAnsi: {
|
|
1370
|
+
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
1371
|
+
enumerable: false
|
|
1372
|
+
}
|
|
1373
|
+
});
|
|
1374
|
+
return styles;
|
|
1375
|
+
}
|
|
1376
|
+
var ansiStyles = assembleStyles();
|
|
1377
|
+
var ansi_styles_default = ansiStyles;
|
|
1378
|
+
|
|
1379
|
+
// ../../node_modules/.pnpm/wrap-ansi@8.1.0/node_modules/wrap-ansi/index.js
|
|
1380
|
+
var ESCAPES = /* @__PURE__ */ new Set([
|
|
1381
|
+
"\x1B",
|
|
1382
|
+
"\x9B"
|
|
1383
|
+
]);
|
|
1384
|
+
var END_CODE = 39;
|
|
1385
|
+
var ANSI_ESCAPE_BELL = "\x07";
|
|
1386
|
+
var ANSI_CSI = "[";
|
|
1387
|
+
var ANSI_OSC = "]";
|
|
1388
|
+
var ANSI_SGR_TERMINATOR = "m";
|
|
1389
|
+
var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
1390
|
+
var wrapAnsiCode = (code) => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
1391
|
+
var wrapAnsiHyperlink = (uri) => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${uri}${ANSI_ESCAPE_BELL}`;
|
|
1392
|
+
var wordLengths = (string) => string.split(" ").map((character) => stringWidth(character));
|
|
1393
|
+
var wrapWord = (rows, word, columns) => {
|
|
1394
|
+
const characters = [...word];
|
|
1395
|
+
let isInsideEscape = false;
|
|
1396
|
+
let isInsideLinkEscape = false;
|
|
1397
|
+
let visible = stringWidth(stripAnsi(rows[rows.length - 1]));
|
|
1398
|
+
for (const [index, character] of characters.entries()) {
|
|
1399
|
+
const characterLength = stringWidth(character);
|
|
1400
|
+
if (visible + characterLength <= columns) {
|
|
1401
|
+
rows[rows.length - 1] += character;
|
|
1402
|
+
} else {
|
|
1403
|
+
rows.push(character);
|
|
1404
|
+
visible = 0;
|
|
1405
|
+
}
|
|
1406
|
+
if (ESCAPES.has(character)) {
|
|
1407
|
+
isInsideEscape = true;
|
|
1408
|
+
isInsideLinkEscape = characters.slice(index + 1).join("").startsWith(ANSI_ESCAPE_LINK);
|
|
1409
|
+
}
|
|
1410
|
+
if (isInsideEscape) {
|
|
1411
|
+
if (isInsideLinkEscape) {
|
|
1412
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
1413
|
+
isInsideEscape = false;
|
|
1414
|
+
isInsideLinkEscape = false;
|
|
1415
|
+
}
|
|
1416
|
+
} else if (character === ANSI_SGR_TERMINATOR) {
|
|
1417
|
+
isInsideEscape = false;
|
|
1418
|
+
}
|
|
1419
|
+
continue;
|
|
1420
|
+
}
|
|
1421
|
+
visible += characterLength;
|
|
1422
|
+
if (visible === columns && index < characters.length - 1) {
|
|
1423
|
+
rows.push("");
|
|
1424
|
+
visible = 0;
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
if (!visible && rows[rows.length - 1].length > 0 && rows.length > 1) {
|
|
1428
|
+
rows[rows.length - 2] += rows.pop();
|
|
1429
|
+
}
|
|
1430
|
+
};
|
|
1431
|
+
var stringVisibleTrimSpacesRight = (string) => {
|
|
1432
|
+
const words = string.split(" ");
|
|
1433
|
+
let last = words.length;
|
|
1434
|
+
while (last > 0) {
|
|
1435
|
+
if (stringWidth(words[last - 1]) > 0) {
|
|
1436
|
+
break;
|
|
1437
|
+
}
|
|
1438
|
+
last--;
|
|
1439
|
+
}
|
|
1440
|
+
if (last === words.length) {
|
|
1441
|
+
return string;
|
|
1442
|
+
}
|
|
1443
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
1444
|
+
};
|
|
1445
|
+
var exec = (string, columns, options = {}) => {
|
|
1446
|
+
if (options.trim !== false && string.trim() === "") {
|
|
1447
|
+
return "";
|
|
1448
|
+
}
|
|
1449
|
+
let returnValue = "";
|
|
1450
|
+
let escapeCode;
|
|
1451
|
+
let escapeUrl;
|
|
1452
|
+
const lengths = wordLengths(string);
|
|
1453
|
+
let rows = [""];
|
|
1454
|
+
for (const [index, word] of string.split(" ").entries()) {
|
|
1455
|
+
if (options.trim !== false) {
|
|
1456
|
+
rows[rows.length - 1] = rows[rows.length - 1].trimStart();
|
|
1457
|
+
}
|
|
1458
|
+
let rowLength = stringWidth(rows[rows.length - 1]);
|
|
1459
|
+
if (index !== 0) {
|
|
1460
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
1461
|
+
rows.push("");
|
|
1462
|
+
rowLength = 0;
|
|
1463
|
+
}
|
|
1464
|
+
if (rowLength > 0 || options.trim === false) {
|
|
1465
|
+
rows[rows.length - 1] += " ";
|
|
1466
|
+
rowLength++;
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
if (options.hard && lengths[index] > columns) {
|
|
1470
|
+
const remainingColumns = columns - rowLength;
|
|
1471
|
+
const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);
|
|
1472
|
+
const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);
|
|
1473
|
+
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
1474
|
+
rows.push("");
|
|
1475
|
+
}
|
|
1476
|
+
wrapWord(rows, word, columns);
|
|
1477
|
+
continue;
|
|
1478
|
+
}
|
|
1479
|
+
if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {
|
|
1480
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
1481
|
+
wrapWord(rows, word, columns);
|
|
1482
|
+
continue;
|
|
1483
|
+
}
|
|
1484
|
+
rows.push("");
|
|
1485
|
+
}
|
|
1486
|
+
if (rowLength + lengths[index] > columns && options.wordWrap === false) {
|
|
1487
|
+
wrapWord(rows, word, columns);
|
|
1488
|
+
continue;
|
|
1489
|
+
}
|
|
1490
|
+
rows[rows.length - 1] += word;
|
|
1491
|
+
}
|
|
1492
|
+
if (options.trim !== false) {
|
|
1493
|
+
rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
1494
|
+
}
|
|
1495
|
+
const pre = [...rows.join("\n")];
|
|
1496
|
+
for (const [index, character] of pre.entries()) {
|
|
1497
|
+
returnValue += character;
|
|
1498
|
+
if (ESCAPES.has(character)) {
|
|
1499
|
+
const { groups } = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(pre.slice(index).join("")) || { groups: {} };
|
|
1500
|
+
if (groups.code !== void 0) {
|
|
1501
|
+
const code2 = Number.parseFloat(groups.code);
|
|
1502
|
+
escapeCode = code2 === END_CODE ? void 0 : code2;
|
|
1503
|
+
} else if (groups.uri !== void 0) {
|
|
1504
|
+
escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
const code = ansi_styles_default.codes.get(Number(escapeCode));
|
|
1508
|
+
if (pre[index + 1] === "\n") {
|
|
1509
|
+
if (escapeUrl) {
|
|
1510
|
+
returnValue += wrapAnsiHyperlink("");
|
|
1511
|
+
}
|
|
1512
|
+
if (escapeCode && code) {
|
|
1513
|
+
returnValue += wrapAnsiCode(code);
|
|
1514
|
+
}
|
|
1515
|
+
} else if (character === "\n") {
|
|
1516
|
+
if (escapeCode && code) {
|
|
1517
|
+
returnValue += wrapAnsiCode(escapeCode);
|
|
1518
|
+
}
|
|
1519
|
+
if (escapeUrl) {
|
|
1520
|
+
returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
return returnValue;
|
|
1525
|
+
};
|
|
1526
|
+
function wrapAnsi(string, columns, options) {
|
|
1527
|
+
return String(string).normalize().replace(/\r\n/g, "\n").split("\n").map((line) => exec(line, columns, options)).join("\n");
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
// ../../node_modules/.pnpm/@isaacs+cliui@8.0.2/node_modules/@isaacs/cliui/index.mjs
|
|
1531
|
+
function ui(opts) {
|
|
1532
|
+
return cliui(opts, {
|
|
1533
|
+
stringWidth,
|
|
1534
|
+
stripAnsi,
|
|
1535
|
+
wrap: wrapAnsi
|
|
1536
|
+
});
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
// ../../node_modules/.pnpm/jackspeak@4.0.2/node_modules/jackspeak/dist/esm/index.js
|
|
1540
|
+
import { basename } from "node:path";
|
|
1541
|
+
var isConfigType = (t) => typeof t === "string" && (t === "string" || t === "number" || t === "boolean");
|
|
1542
|
+
var isValidValue = (v, type, multi) => {
|
|
1543
|
+
if (multi) {
|
|
1544
|
+
if (!Array.isArray(v))
|
|
1545
|
+
return false;
|
|
1546
|
+
return !v.some((v2) => !isValidValue(v2, type, false));
|
|
1547
|
+
}
|
|
1548
|
+
if (Array.isArray(v))
|
|
1549
|
+
return false;
|
|
1550
|
+
return typeof v === type;
|
|
1551
|
+
};
|
|
1552
|
+
var isValidOption = (v, vo) => !!vo && (Array.isArray(v) ? v.every((x) => isValidOption(x, vo)) : vo.includes(v));
|
|
1553
|
+
var isConfigOptionOfType = (o, type, multi) => !!o && typeof o === "object" && isConfigType(o.type) && o.type === type && !!o.multiple === multi;
|
|
1554
|
+
var isConfigOption = (o, type, multi) => isConfigOptionOfType(o, type, multi) && undefOrType(o.short, "string") && undefOrType(o.description, "string") && undefOrType(o.hint, "string") && undefOrType(o.validate, "function") && (o.type === "boolean" ? o.validOptions === void 0 : undefOrTypeArray(o.validOptions, o.type)) && (o.default === void 0 || isValidValue(o.default, type, multi));
|
|
1555
|
+
var isHeading = (r) => r.type === "heading";
|
|
1556
|
+
var isDescription = (r) => r.type === "description";
|
|
1557
|
+
var width = Math.min(process?.stdout?.columns ?? 80, 80);
|
|
1558
|
+
var indent = (n) => (n - 1) * 2;
|
|
1559
|
+
var toEnvKey = (pref, key) => [pref, key.replace(/[^a-zA-Z0-9]+/g, " ")].join(" ").trim().toUpperCase().replace(/ /g, "_");
|
|
1560
|
+
var toEnvVal = (value, delim = "\n") => {
|
|
1561
|
+
const str = typeof value === "string" ? value : typeof value === "boolean" ? value ? "1" : "0" : typeof value === "number" ? String(value) : Array.isArray(value) ? value.map((v) => toEnvVal(v)).join(delim) : (
|
|
1562
|
+
/* c8 ignore start */
|
|
1563
|
+
void 0
|
|
1564
|
+
);
|
|
1565
|
+
if (typeof str !== "string") {
|
|
1566
|
+
throw new Error(`could not serialize value to environment: ${JSON.stringify(value)}`);
|
|
1567
|
+
}
|
|
1568
|
+
return str;
|
|
1569
|
+
};
|
|
1570
|
+
var fromEnvVal = (env2, type, multiple, delim = "\n") => multiple ? env2 ? env2.split(delim).map((v) => fromEnvVal(v, type, false)) : [] : type === "string" ? env2 : type === "boolean" ? env2 === "1" : +env2.trim();
|
|
1571
|
+
var undefOrType = (v, t) => v === void 0 || typeof v === t;
|
|
1572
|
+
var undefOrTypeArray = (v, t) => v === void 0 || Array.isArray(v) && v.every((x) => typeof x === t);
|
|
1573
|
+
var valueType = (v) => typeof v === "string" ? "string" : typeof v === "boolean" ? "boolean" : typeof v === "number" ? "number" : Array.isArray(v) ? `${joinTypes([...new Set(v.map((v2) => valueType(v2)))])}[]` : `${v.type}${v.multiple ? "[]" : ""}`;
|
|
1574
|
+
var joinTypes = (types) => types.length === 1 && typeof types[0] === "string" ? types[0] : `(${types.join("|")})`;
|
|
1575
|
+
var validateFieldMeta = (field, fieldMeta) => {
|
|
1576
|
+
if (fieldMeta) {
|
|
1577
|
+
if (field.type !== void 0 && field.type !== fieldMeta.type) {
|
|
1578
|
+
throw new TypeError(`invalid type`, {
|
|
1579
|
+
cause: {
|
|
1580
|
+
found: field.type,
|
|
1581
|
+
wanted: [fieldMeta.type, void 0]
|
|
1582
|
+
}
|
|
1583
|
+
});
|
|
1584
|
+
}
|
|
1585
|
+
if (field.multiple !== void 0 && !!field.multiple !== fieldMeta.multiple) {
|
|
1586
|
+
throw new TypeError(`invalid multiple`, {
|
|
1587
|
+
cause: {
|
|
1588
|
+
found: field.multiple,
|
|
1589
|
+
wanted: [fieldMeta.multiple, void 0]
|
|
1590
|
+
}
|
|
1591
|
+
});
|
|
1592
|
+
}
|
|
1593
|
+
return fieldMeta;
|
|
1594
|
+
}
|
|
1595
|
+
if (!isConfigType(field.type)) {
|
|
1596
|
+
throw new TypeError(`invalid type`, {
|
|
1597
|
+
cause: {
|
|
1598
|
+
found: field.type,
|
|
1599
|
+
wanted: ["string", "number", "boolean"]
|
|
1600
|
+
}
|
|
1601
|
+
});
|
|
1602
|
+
}
|
|
1603
|
+
return {
|
|
1604
|
+
type: field.type,
|
|
1605
|
+
multiple: !!field.multiple
|
|
1606
|
+
};
|
|
1607
|
+
};
|
|
1608
|
+
var validateField = (o, type, multiple) => {
|
|
1609
|
+
const validateValidOptions = (def, validOptions) => {
|
|
1610
|
+
if (!undefOrTypeArray(validOptions, type)) {
|
|
1611
|
+
throw new TypeError("invalid validOptions", {
|
|
1612
|
+
cause: {
|
|
1613
|
+
found: validOptions,
|
|
1614
|
+
wanted: valueType({ type, multiple: true })
|
|
1615
|
+
}
|
|
1616
|
+
});
|
|
1617
|
+
}
|
|
1618
|
+
if (def !== void 0 && validOptions !== void 0) {
|
|
1619
|
+
const valid = Array.isArray(def) ? def.every((v) => validOptions.includes(v)) : validOptions.includes(def);
|
|
1620
|
+
if (!valid) {
|
|
1621
|
+
throw new TypeError("invalid default value not in validOptions", {
|
|
1622
|
+
cause: {
|
|
1623
|
+
found: def,
|
|
1624
|
+
wanted: validOptions
|
|
1625
|
+
}
|
|
1626
|
+
});
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
};
|
|
1630
|
+
if (o.default !== void 0 && !isValidValue(o.default, type, multiple)) {
|
|
1631
|
+
throw new TypeError("invalid default value", {
|
|
1632
|
+
cause: {
|
|
1633
|
+
found: o.default,
|
|
1634
|
+
wanted: valueType({ type, multiple })
|
|
1635
|
+
}
|
|
1636
|
+
});
|
|
1637
|
+
}
|
|
1638
|
+
if (isConfigOptionOfType(o, "number", false) || isConfigOptionOfType(o, "number", true)) {
|
|
1639
|
+
validateValidOptions(o.default, o.validOptions);
|
|
1640
|
+
} else if (isConfigOptionOfType(o, "string", false) || isConfigOptionOfType(o, "string", true)) {
|
|
1641
|
+
validateValidOptions(o.default, o.validOptions);
|
|
1642
|
+
} else if (isConfigOptionOfType(o, "boolean", false) || isConfigOptionOfType(o, "boolean", true)) {
|
|
1643
|
+
if (o.hint !== void 0) {
|
|
1644
|
+
throw new TypeError("cannot provide hint for flag");
|
|
1645
|
+
}
|
|
1646
|
+
if (o.validOptions !== void 0) {
|
|
1647
|
+
throw new TypeError("cannot provide validOptions for flag");
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
return o;
|
|
1651
|
+
};
|
|
1652
|
+
var toParseArgsOptionsConfig = (options) => {
|
|
1653
|
+
return Object.entries(options).reduce((acc, [longOption, o]) => {
|
|
1654
|
+
const p = {
|
|
1655
|
+
type: "string",
|
|
1656
|
+
multiple: !!o.multiple,
|
|
1657
|
+
...typeof o.short === "string" ? { short: o.short } : void 0
|
|
1658
|
+
};
|
|
1659
|
+
const setNoBool = () => {
|
|
1660
|
+
if (!longOption.startsWith("no-") && !options[`no-${longOption}`]) {
|
|
1661
|
+
acc[`no-${longOption}`] = {
|
|
1662
|
+
type: "boolean",
|
|
1663
|
+
multiple: !!o.multiple
|
|
1664
|
+
};
|
|
1665
|
+
}
|
|
1666
|
+
};
|
|
1667
|
+
const setDefault = (def, fn) => {
|
|
1668
|
+
if (def !== void 0) {
|
|
1669
|
+
p.default = fn(def);
|
|
1670
|
+
}
|
|
1671
|
+
};
|
|
1672
|
+
if (isConfigOption(o, "number", false)) {
|
|
1673
|
+
setDefault(o.default, String);
|
|
1674
|
+
} else if (isConfigOption(o, "number", true)) {
|
|
1675
|
+
setDefault(o.default, (d) => d.map((v) => String(v)));
|
|
1676
|
+
} else if (isConfigOption(o, "string", false) || isConfigOption(o, "string", true)) {
|
|
1677
|
+
setDefault(o.default, (v) => v);
|
|
1678
|
+
} else if (isConfigOption(o, "boolean", false) || isConfigOption(o, "boolean", true)) {
|
|
1679
|
+
p.type = "boolean";
|
|
1680
|
+
setDefault(o.default, (v) => v);
|
|
1681
|
+
setNoBool();
|
|
1682
|
+
}
|
|
1683
|
+
acc[longOption] = p;
|
|
1684
|
+
return acc;
|
|
1685
|
+
}, {});
|
|
1686
|
+
};
|
|
1687
|
+
var Jack = class {
|
|
1688
|
+
#configSet;
|
|
1689
|
+
#shorts;
|
|
1690
|
+
#options;
|
|
1691
|
+
#fields = [];
|
|
1692
|
+
#env;
|
|
1693
|
+
#envPrefix;
|
|
1694
|
+
#allowPositionals;
|
|
1695
|
+
#usage;
|
|
1696
|
+
#usageMarkdown;
|
|
1697
|
+
constructor(options = {}) {
|
|
1698
|
+
this.#options = options;
|
|
1699
|
+
this.#allowPositionals = options.allowPositionals !== false;
|
|
1700
|
+
this.#env = this.#options.env === void 0 ? process.env : this.#options.env;
|
|
1701
|
+
this.#envPrefix = options.envPrefix;
|
|
1702
|
+
this.#configSet = /* @__PURE__ */ Object.create(null);
|
|
1703
|
+
this.#shorts = /* @__PURE__ */ Object.create(null);
|
|
1704
|
+
}
|
|
1705
|
+
/**
|
|
1706
|
+
* Set the default value (which will still be overridden by env or cli)
|
|
1707
|
+
* as if from a parsed config file. The optional `source` param, if
|
|
1708
|
+
* provided, will be included in error messages if a value is invalid or
|
|
1709
|
+
* unknown.
|
|
1710
|
+
*/
|
|
1711
|
+
setConfigValues(values, source = "") {
|
|
1712
|
+
try {
|
|
1713
|
+
this.validate(values);
|
|
1714
|
+
} catch (er) {
|
|
1715
|
+
if (source && er instanceof Error) {
|
|
1716
|
+
const cause = typeof er.cause === "object" ? er.cause : {};
|
|
1717
|
+
er.cause = { ...cause, path: source };
|
|
1718
|
+
}
|
|
1719
|
+
throw er;
|
|
1720
|
+
}
|
|
1721
|
+
for (const [field, value] of Object.entries(values)) {
|
|
1722
|
+
const my = this.#configSet[field];
|
|
1723
|
+
if (!my) {
|
|
1724
|
+
throw new Error("unexpected field in config set: " + field, {
|
|
1725
|
+
cause: { found: field }
|
|
1726
|
+
});
|
|
1727
|
+
}
|
|
1728
|
+
my.default = value;
|
|
1729
|
+
}
|
|
1730
|
+
return this;
|
|
1731
|
+
}
|
|
1732
|
+
/**
|
|
1733
|
+
* Parse a string of arguments, and return the resulting
|
|
1734
|
+
* `{ values, positionals }` object.
|
|
1735
|
+
*
|
|
1736
|
+
* If an {@link JackOptions#envPrefix} is set, then it will read default
|
|
1737
|
+
* values from the environment, and write the resulting values back
|
|
1738
|
+
* to the environment as well.
|
|
1739
|
+
*
|
|
1740
|
+
* Environment values always take precedence over any other value, except
|
|
1741
|
+
* an explicit CLI setting.
|
|
1742
|
+
*/
|
|
1743
|
+
parse(args = process.argv) {
|
|
1744
|
+
this.loadEnvDefaults();
|
|
1745
|
+
const p = this.parseRaw(args);
|
|
1746
|
+
this.applyDefaults(p);
|
|
1747
|
+
this.writeEnv(p);
|
|
1748
|
+
return p;
|
|
1749
|
+
}
|
|
1750
|
+
loadEnvDefaults() {
|
|
1751
|
+
if (this.#envPrefix) {
|
|
1752
|
+
for (const [field, my] of Object.entries(this.#configSet)) {
|
|
1753
|
+
const ek = toEnvKey(this.#envPrefix, field);
|
|
1754
|
+
const env2 = this.#env[ek];
|
|
1755
|
+
if (env2 !== void 0) {
|
|
1756
|
+
my.default = fromEnvVal(env2, my.type, !!my.multiple, my.delim);
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
applyDefaults(p) {
|
|
1762
|
+
for (const [field, c] of Object.entries(this.#configSet)) {
|
|
1763
|
+
if (c.default !== void 0 && !(field in p.values)) {
|
|
1764
|
+
p.values[field] = c.default;
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
/**
|
|
1769
|
+
* Only parse the command line arguments passed in.
|
|
1770
|
+
* Does not strip off the `node script.js` bits, so it must be just the
|
|
1771
|
+
* arguments you wish to have parsed.
|
|
1772
|
+
* Does not read from or write to the environment, or set defaults.
|
|
1773
|
+
*/
|
|
1774
|
+
parseRaw(args) {
|
|
1775
|
+
if (args === process.argv) {
|
|
1776
|
+
args = args.slice(process._eval !== void 0 ? 1 : 2);
|
|
1777
|
+
}
|
|
1778
|
+
const result = parseArgs({
|
|
1779
|
+
args,
|
|
1780
|
+
options: toParseArgsOptionsConfig(this.#configSet),
|
|
1781
|
+
// always strict, but using our own logic
|
|
1782
|
+
strict: false,
|
|
1783
|
+
allowPositionals: this.#allowPositionals,
|
|
1784
|
+
tokens: true
|
|
1785
|
+
});
|
|
1786
|
+
const p = {
|
|
1787
|
+
values: {},
|
|
1788
|
+
positionals: []
|
|
1789
|
+
};
|
|
1790
|
+
for (const token of result.tokens) {
|
|
1791
|
+
if (token.kind === "positional") {
|
|
1792
|
+
p.positionals.push(token.value);
|
|
1793
|
+
if (this.#options.stopAtPositional || this.#options.stopAtPositionalTest?.(token.value)) {
|
|
1794
|
+
p.positionals.push(...args.slice(token.index + 1));
|
|
1795
|
+
break;
|
|
1796
|
+
}
|
|
1797
|
+
} else if (token.kind === "option") {
|
|
1798
|
+
let value = void 0;
|
|
1799
|
+
if (token.name.startsWith("no-")) {
|
|
1800
|
+
const my2 = this.#configSet[token.name];
|
|
1801
|
+
const pname = token.name.substring("no-".length);
|
|
1802
|
+
const pos = this.#configSet[pname];
|
|
1803
|
+
if (pos && pos.type === "boolean" && (!my2 || my2.type === "boolean" && !!my2.multiple === !!pos.multiple)) {
|
|
1804
|
+
value = false;
|
|
1805
|
+
token.name = pname;
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
const my = this.#configSet[token.name];
|
|
1809
|
+
if (!my) {
|
|
1810
|
+
throw new Error(`Unknown option '${token.rawName}'. To specify a positional argument starting with a '-', place it at the end of the command after '--', as in '-- ${token.rawName}'`, {
|
|
1811
|
+
cause: {
|
|
1812
|
+
found: token.rawName + (token.value ? `=${token.value}` : "")
|
|
1813
|
+
}
|
|
1814
|
+
});
|
|
1815
|
+
}
|
|
1816
|
+
if (value === void 0) {
|
|
1817
|
+
if (token.value === void 0) {
|
|
1818
|
+
if (my.type !== "boolean") {
|
|
1819
|
+
throw new Error(`No value provided for ${token.rawName}, expected ${my.type}`, {
|
|
1820
|
+
cause: {
|
|
1821
|
+
name: token.rawName,
|
|
1822
|
+
wanted: valueType(my)
|
|
1823
|
+
}
|
|
1824
|
+
});
|
|
1825
|
+
}
|
|
1826
|
+
value = true;
|
|
1827
|
+
} else {
|
|
1828
|
+
if (my.type === "boolean") {
|
|
1829
|
+
throw new Error(`Flag ${token.rawName} does not take a value, received '${token.value}'`, { cause: { found: token } });
|
|
1830
|
+
}
|
|
1831
|
+
if (my.type === "string") {
|
|
1832
|
+
value = token.value;
|
|
1833
|
+
} else {
|
|
1834
|
+
value = +token.value;
|
|
1835
|
+
if (value !== value) {
|
|
1836
|
+
throw new Error(`Invalid value '${token.value}' provided for '${token.rawName}' option, expected number`, {
|
|
1837
|
+
cause: {
|
|
1838
|
+
name: token.rawName,
|
|
1839
|
+
found: token.value,
|
|
1840
|
+
wanted: "number"
|
|
1841
|
+
}
|
|
1842
|
+
});
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
if (my.multiple) {
|
|
1848
|
+
const pv = p.values;
|
|
1849
|
+
const tn = pv[token.name] ?? [];
|
|
1850
|
+
pv[token.name] = tn;
|
|
1851
|
+
tn.push(value);
|
|
1852
|
+
} else {
|
|
1853
|
+
const pv = p.values;
|
|
1854
|
+
pv[token.name] = value;
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
}
|
|
1858
|
+
for (const [field, value] of Object.entries(p.values)) {
|
|
1859
|
+
const valid = this.#configSet[field]?.validate;
|
|
1860
|
+
const validOptions = this.#configSet[field]?.validOptions;
|
|
1861
|
+
const cause = validOptions && !isValidOption(value, validOptions) ? { name: field, found: value, validOptions } : valid && !valid(value) ? { name: field, found: value } : void 0;
|
|
1862
|
+
if (cause) {
|
|
1863
|
+
throw new Error(`Invalid value provided for --${field}: ${JSON.stringify(value)}`, { cause });
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
return p;
|
|
1867
|
+
}
|
|
1868
|
+
/**
|
|
1869
|
+
* do not set fields as 'no-foo' if 'foo' exists and both are bools
|
|
1870
|
+
* just set foo.
|
|
1871
|
+
*/
|
|
1872
|
+
#noNoFields(f, val, s = f) {
|
|
1873
|
+
if (!f.startsWith("no-") || typeof val !== "boolean")
|
|
1874
|
+
return;
|
|
1875
|
+
const yes = f.substring("no-".length);
|
|
1876
|
+
this.#noNoFields(yes, val, s);
|
|
1877
|
+
if (this.#configSet[yes]?.type === "boolean") {
|
|
1878
|
+
throw new Error(`do not set '${s}', instead set '${yes}' as desired.`, { cause: { found: s, wanted: yes } });
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
/**
|
|
1882
|
+
* Validate that any arbitrary object is a valid configuration `values`
|
|
1883
|
+
* object. Useful when loading config files or other sources.
|
|
1884
|
+
*/
|
|
1885
|
+
validate(o) {
|
|
1886
|
+
if (!o || typeof o !== "object") {
|
|
1887
|
+
throw new Error("Invalid config: not an object", {
|
|
1888
|
+
cause: { found: o }
|
|
1889
|
+
});
|
|
1890
|
+
}
|
|
1891
|
+
const opts = o;
|
|
1892
|
+
for (const field in o) {
|
|
1893
|
+
const value = opts[field];
|
|
1894
|
+
if (value === void 0)
|
|
1895
|
+
continue;
|
|
1896
|
+
this.#noNoFields(field, value);
|
|
1897
|
+
const config = this.#configSet[field];
|
|
1898
|
+
if (!config) {
|
|
1899
|
+
throw new Error(`Unknown config option: ${field}`, {
|
|
1900
|
+
cause: { found: field }
|
|
1901
|
+
});
|
|
1902
|
+
}
|
|
1903
|
+
if (!isValidValue(value, config.type, !!config.multiple)) {
|
|
1904
|
+
throw new Error(`Invalid value ${valueType(value)} for ${field}, expected ${valueType(config)}`, {
|
|
1905
|
+
cause: {
|
|
1906
|
+
name: field,
|
|
1907
|
+
found: value,
|
|
1908
|
+
wanted: valueType(config)
|
|
1909
|
+
}
|
|
1910
|
+
});
|
|
1911
|
+
}
|
|
1912
|
+
const cause = config.validOptions && !isValidOption(value, config.validOptions) ? { name: field, found: value, validOptions: config.validOptions } : config.validate && !config.validate(value) ? { name: field, found: value } : void 0;
|
|
1913
|
+
if (cause) {
|
|
1914
|
+
throw new Error(`Invalid config value for ${field}: ${value}`, {
|
|
1915
|
+
cause
|
|
1916
|
+
});
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
writeEnv(p) {
|
|
1921
|
+
if (!this.#env || !this.#envPrefix)
|
|
1922
|
+
return;
|
|
1923
|
+
for (const [field, value] of Object.entries(p.values)) {
|
|
1924
|
+
const my = this.#configSet[field];
|
|
1925
|
+
this.#env[toEnvKey(this.#envPrefix, field)] = toEnvVal(value, my?.delim);
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
/**
|
|
1929
|
+
* Add a heading to the usage output banner
|
|
1930
|
+
*/
|
|
1931
|
+
heading(text, level, { pre = false } = {}) {
|
|
1932
|
+
if (level === void 0) {
|
|
1933
|
+
level = this.#fields.some((r) => isHeading(r)) ? 2 : 1;
|
|
1934
|
+
}
|
|
1935
|
+
this.#fields.push({ type: "heading", text, level, pre });
|
|
1936
|
+
return this;
|
|
1937
|
+
}
|
|
1938
|
+
/**
|
|
1939
|
+
* Add a long-form description to the usage output at this position.
|
|
1940
|
+
*/
|
|
1941
|
+
description(text, { pre } = {}) {
|
|
1942
|
+
this.#fields.push({ type: "description", text, pre });
|
|
1943
|
+
return this;
|
|
1944
|
+
}
|
|
1945
|
+
/**
|
|
1946
|
+
* Add one or more number fields.
|
|
1947
|
+
*/
|
|
1948
|
+
num(fields) {
|
|
1949
|
+
return this.#addFieldsWith(fields, "number", false);
|
|
1950
|
+
}
|
|
1951
|
+
/**
|
|
1952
|
+
* Add one or more multiple number fields.
|
|
1953
|
+
*/
|
|
1954
|
+
numList(fields) {
|
|
1955
|
+
return this.#addFieldsWith(fields, "number", true);
|
|
1956
|
+
}
|
|
1957
|
+
/**
|
|
1958
|
+
* Add one or more string option fields.
|
|
1959
|
+
*/
|
|
1960
|
+
opt(fields) {
|
|
1961
|
+
return this.#addFieldsWith(fields, "string", false);
|
|
1962
|
+
}
|
|
1963
|
+
/**
|
|
1964
|
+
* Add one or more multiple string option fields.
|
|
1965
|
+
*/
|
|
1966
|
+
optList(fields) {
|
|
1967
|
+
return this.#addFieldsWith(fields, "string", true);
|
|
1968
|
+
}
|
|
1969
|
+
/**
|
|
1970
|
+
* Add one or more flag fields.
|
|
1971
|
+
*/
|
|
1972
|
+
flag(fields) {
|
|
1973
|
+
return this.#addFieldsWith(fields, "boolean", false);
|
|
1974
|
+
}
|
|
1975
|
+
/**
|
|
1976
|
+
* Add one or more multiple flag fields.
|
|
1977
|
+
*/
|
|
1978
|
+
flagList(fields) {
|
|
1979
|
+
return this.#addFieldsWith(fields, "boolean", true);
|
|
1980
|
+
}
|
|
1981
|
+
/**
|
|
1982
|
+
* Generic field definition method. Similar to flag/flagList/number/etc,
|
|
1983
|
+
* but you must specify the `type` (and optionally `multiple` and `delim`)
|
|
1984
|
+
* fields on each one, or Jack won't know how to define them.
|
|
1985
|
+
*/
|
|
1986
|
+
addFields(fields) {
|
|
1987
|
+
return this.#addFields(this, fields);
|
|
1988
|
+
}
|
|
1989
|
+
#addFieldsWith(fields, type, multiple) {
|
|
1990
|
+
return this.#addFields(this, fields, {
|
|
1991
|
+
type,
|
|
1992
|
+
multiple
|
|
1993
|
+
});
|
|
1994
|
+
}
|
|
1995
|
+
#addFields(next, fields, opt) {
|
|
1996
|
+
Object.assign(next.#configSet, Object.fromEntries(Object.entries(fields).map(([name, field]) => {
|
|
1997
|
+
this.#validateName(name, field);
|
|
1998
|
+
const { type, multiple } = validateFieldMeta(field, opt);
|
|
1999
|
+
const value = { ...field, type, multiple };
|
|
2000
|
+
validateField(value, type, multiple);
|
|
2001
|
+
next.#fields.push({ type: "config", name, value });
|
|
2002
|
+
return [name, value];
|
|
2003
|
+
})));
|
|
2004
|
+
return next;
|
|
2005
|
+
}
|
|
2006
|
+
#validateName(name, field) {
|
|
2007
|
+
if (!/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$/.test(name)) {
|
|
2008
|
+
throw new TypeError(`Invalid option name: ${name}, must be '-' delimited ASCII alphanumeric`);
|
|
2009
|
+
}
|
|
2010
|
+
if (this.#configSet[name]) {
|
|
2011
|
+
throw new TypeError(`Cannot redefine option ${field}`);
|
|
2012
|
+
}
|
|
2013
|
+
if (this.#shorts[name]) {
|
|
2014
|
+
throw new TypeError(`Cannot redefine option ${name}, already in use for ${this.#shorts[name]}`);
|
|
2015
|
+
}
|
|
2016
|
+
if (field.short) {
|
|
2017
|
+
if (!/^[a-zA-Z0-9]$/.test(field.short)) {
|
|
2018
|
+
throw new TypeError(`Invalid ${name} short option: ${field.short}, must be 1 ASCII alphanumeric character`);
|
|
2019
|
+
}
|
|
2020
|
+
if (this.#shorts[field.short]) {
|
|
2021
|
+
throw new TypeError(`Invalid ${name} short option: ${field.short}, already in use for ${this.#shorts[field.short]}`);
|
|
2022
|
+
}
|
|
2023
|
+
this.#shorts[field.short] = name;
|
|
2024
|
+
this.#shorts[name] = name;
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
/**
|
|
2028
|
+
* Return the usage banner for the given configuration
|
|
2029
|
+
*/
|
|
2030
|
+
usage() {
|
|
2031
|
+
if (this.#usage)
|
|
2032
|
+
return this.#usage;
|
|
2033
|
+
let headingLevel = 1;
|
|
2034
|
+
const ui2 = ui({ width });
|
|
2035
|
+
const first = this.#fields[0];
|
|
2036
|
+
let start = first?.type === "heading" ? 1 : 0;
|
|
2037
|
+
if (first?.type === "heading") {
|
|
2038
|
+
ui2.div({
|
|
2039
|
+
padding: [0, 0, 0, 0],
|
|
2040
|
+
text: normalize(first.text)
|
|
2041
|
+
});
|
|
2042
|
+
}
|
|
2043
|
+
ui2.div({ padding: [0, 0, 0, 0], text: "Usage:" });
|
|
2044
|
+
if (this.#options.usage) {
|
|
2045
|
+
ui2.div({
|
|
2046
|
+
text: this.#options.usage,
|
|
2047
|
+
padding: [0, 0, 0, 2]
|
|
2048
|
+
});
|
|
2049
|
+
} else {
|
|
2050
|
+
const cmd = basename(String(process.argv[1]));
|
|
2051
|
+
const shortFlags = [];
|
|
2052
|
+
const shorts = [];
|
|
2053
|
+
const flags = [];
|
|
2054
|
+
const opts = [];
|
|
2055
|
+
for (const [field, config] of Object.entries(this.#configSet)) {
|
|
2056
|
+
if (config.short) {
|
|
2057
|
+
if (config.type === "boolean")
|
|
2058
|
+
shortFlags.push(config.short);
|
|
2059
|
+
else
|
|
2060
|
+
shorts.push([config.short, config.hint || field]);
|
|
2061
|
+
} else {
|
|
2062
|
+
if (config.type === "boolean")
|
|
2063
|
+
flags.push(field);
|
|
2064
|
+
else
|
|
2065
|
+
opts.push([field, config.hint || field]);
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
const sf = shortFlags.length ? " -" + shortFlags.join("") : "";
|
|
2069
|
+
const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join("");
|
|
2070
|
+
const lf = flags.map((k) => ` --${k}`).join("");
|
|
2071
|
+
const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join("");
|
|
2072
|
+
const usage2 = `${cmd}${sf}${so}${lf}${lo}`.trim();
|
|
2073
|
+
ui2.div({
|
|
2074
|
+
text: usage2,
|
|
2075
|
+
padding: [0, 0, 0, 2]
|
|
2076
|
+
});
|
|
2077
|
+
}
|
|
2078
|
+
ui2.div({ padding: [0, 0, 0, 0], text: "" });
|
|
2079
|
+
const maybeDesc = this.#fields[start];
|
|
2080
|
+
if (maybeDesc && isDescription(maybeDesc)) {
|
|
2081
|
+
const print = normalize(maybeDesc.text, maybeDesc.pre);
|
|
2082
|
+
start++;
|
|
2083
|
+
ui2.div({ padding: [0, 0, 0, 0], text: print });
|
|
2084
|
+
ui2.div({ padding: [0, 0, 0, 0], text: "" });
|
|
2085
|
+
}
|
|
2086
|
+
const { rows, maxWidth } = this.#usageRows(start);
|
|
2087
|
+
for (const row of rows) {
|
|
2088
|
+
if (row.left) {
|
|
2089
|
+
const configIndent = indent(Math.max(headingLevel, 2));
|
|
2090
|
+
if (row.left.length > maxWidth - 3) {
|
|
2091
|
+
ui2.div({ text: row.left, padding: [0, 0, 0, configIndent] });
|
|
2092
|
+
ui2.div({ text: row.text, padding: [0, 0, 0, maxWidth] });
|
|
2093
|
+
} else {
|
|
2094
|
+
ui2.div({
|
|
2095
|
+
text: row.left,
|
|
2096
|
+
padding: [0, 1, 0, configIndent],
|
|
2097
|
+
width: maxWidth
|
|
2098
|
+
}, { padding: [0, 0, 0, 0], text: row.text });
|
|
2099
|
+
}
|
|
2100
|
+
if (row.skipLine) {
|
|
2101
|
+
ui2.div({ padding: [0, 0, 0, 0], text: "" });
|
|
2102
|
+
}
|
|
2103
|
+
} else {
|
|
2104
|
+
if (isHeading(row)) {
|
|
2105
|
+
const { level } = row;
|
|
2106
|
+
headingLevel = level;
|
|
2107
|
+
const b = level <= 2 ? 1 : 0;
|
|
2108
|
+
ui2.div({ ...row, padding: [0, 0, b, indent(level)] });
|
|
2109
|
+
} else {
|
|
2110
|
+
ui2.div({ ...row, padding: [0, 0, 1, indent(headingLevel + 1)] });
|
|
2111
|
+
}
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
return this.#usage = ui2.toString();
|
|
2115
|
+
}
|
|
2116
|
+
/**
|
|
2117
|
+
* Return the usage banner markdown for the given configuration
|
|
2118
|
+
*/
|
|
2119
|
+
usageMarkdown() {
|
|
2120
|
+
if (this.#usageMarkdown)
|
|
2121
|
+
return this.#usageMarkdown;
|
|
2122
|
+
const out = [];
|
|
2123
|
+
let headingLevel = 1;
|
|
2124
|
+
const first = this.#fields[0];
|
|
2125
|
+
let start = first?.type === "heading" ? 1 : 0;
|
|
2126
|
+
if (first?.type === "heading") {
|
|
2127
|
+
out.push(`# ${normalizeOneLine(first.text)}`);
|
|
2128
|
+
}
|
|
2129
|
+
out.push("Usage:");
|
|
2130
|
+
if (this.#options.usage) {
|
|
2131
|
+
out.push(normalizeMarkdown(this.#options.usage, true));
|
|
2132
|
+
} else {
|
|
2133
|
+
const cmd = basename(String(process.argv[1]));
|
|
2134
|
+
const shortFlags = [];
|
|
2135
|
+
const shorts = [];
|
|
2136
|
+
const flags = [];
|
|
2137
|
+
const opts = [];
|
|
2138
|
+
for (const [field, config] of Object.entries(this.#configSet)) {
|
|
2139
|
+
if (config.short) {
|
|
2140
|
+
if (config.type === "boolean")
|
|
2141
|
+
shortFlags.push(config.short);
|
|
2142
|
+
else
|
|
2143
|
+
shorts.push([config.short, config.hint || field]);
|
|
2144
|
+
} else {
|
|
2145
|
+
if (config.type === "boolean")
|
|
2146
|
+
flags.push(field);
|
|
2147
|
+
else
|
|
2148
|
+
opts.push([field, config.hint || field]);
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
const sf = shortFlags.length ? " -" + shortFlags.join("") : "";
|
|
2152
|
+
const so = shorts.map(([k, v]) => ` --${k}=<${v}>`).join("");
|
|
2153
|
+
const lf = flags.map((k) => ` --${k}`).join("");
|
|
2154
|
+
const lo = opts.map(([k, v]) => ` --${k}=<${v}>`).join("");
|
|
2155
|
+
const usage2 = `${cmd}${sf}${so}${lf}${lo}`.trim();
|
|
2156
|
+
out.push(normalizeMarkdown(usage2, true));
|
|
2157
|
+
}
|
|
2158
|
+
const maybeDesc = this.#fields[start];
|
|
2159
|
+
if (maybeDesc && isDescription(maybeDesc)) {
|
|
2160
|
+
out.push(normalizeMarkdown(maybeDesc.text, maybeDesc.pre));
|
|
2161
|
+
start++;
|
|
2162
|
+
}
|
|
2163
|
+
const { rows } = this.#usageRows(start);
|
|
2164
|
+
for (const row of rows) {
|
|
2165
|
+
if (row.left) {
|
|
2166
|
+
out.push("#".repeat(headingLevel + 1) + " " + normalizeOneLine(row.left, true));
|
|
2167
|
+
if (row.text)
|
|
2168
|
+
out.push(normalizeMarkdown(row.text));
|
|
2169
|
+
} else if (isHeading(row)) {
|
|
2170
|
+
const { level } = row;
|
|
2171
|
+
headingLevel = level;
|
|
2172
|
+
out.push(`${"#".repeat(headingLevel)} ${normalizeOneLine(row.text, row.pre)}`);
|
|
2173
|
+
} else {
|
|
2174
|
+
out.push(normalizeMarkdown(row.text, !!row.pre));
|
|
2175
|
+
}
|
|
2176
|
+
}
|
|
2177
|
+
return this.#usageMarkdown = out.join("\n\n") + "\n";
|
|
2178
|
+
}
|
|
2179
|
+
#usageRows(start) {
|
|
2180
|
+
let maxMax = Math.max(12, Math.min(26, Math.floor(width / 3)));
|
|
2181
|
+
let maxWidth = 8;
|
|
2182
|
+
let prev = void 0;
|
|
2183
|
+
const rows = [];
|
|
2184
|
+
for (const field of this.#fields.slice(start)) {
|
|
2185
|
+
if (field.type !== "config") {
|
|
2186
|
+
if (prev?.type === "config")
|
|
2187
|
+
prev.skipLine = true;
|
|
2188
|
+
prev = void 0;
|
|
2189
|
+
field.text = normalize(field.text, !!field.pre);
|
|
2190
|
+
rows.push(field);
|
|
2191
|
+
continue;
|
|
2192
|
+
}
|
|
2193
|
+
const { value } = field;
|
|
2194
|
+
const desc = value.description || "";
|
|
2195
|
+
const mult = value.multiple ? "Can be set multiple times" : "";
|
|
2196
|
+
const opts = value.validOptions?.length ? `Valid options:${value.validOptions.map((v) => ` ${JSON.stringify(v)}`)}` : "";
|
|
2197
|
+
const dmDelim = desc.includes("\n") ? "\n\n" : "\n";
|
|
2198
|
+
const extra = [opts, mult].join(dmDelim).trim();
|
|
2199
|
+
const text = (normalize(desc) + dmDelim + extra).trim();
|
|
2200
|
+
const hint = value.hint || (value.type === "number" ? "n" : value.type === "string" ? field.name : void 0);
|
|
2201
|
+
const short = !value.short ? "" : value.type === "boolean" ? `-${value.short} ` : `-${value.short}<${hint}> `;
|
|
2202
|
+
const left2 = value.type === "boolean" ? `${short}--${field.name}` : `${short}--${field.name}=<${hint}>`;
|
|
2203
|
+
const row = { text, left: left2, type: "config" };
|
|
2204
|
+
if (text.length > width - maxMax) {
|
|
2205
|
+
row.skipLine = true;
|
|
2206
|
+
}
|
|
2207
|
+
if (prev && left2.length > maxMax)
|
|
2208
|
+
prev.skipLine = true;
|
|
2209
|
+
prev = row;
|
|
2210
|
+
const len = left2.length + 4;
|
|
2211
|
+
if (len > maxWidth && len < maxMax) {
|
|
2212
|
+
maxWidth = len;
|
|
2213
|
+
}
|
|
2214
|
+
rows.push(row);
|
|
2215
|
+
}
|
|
2216
|
+
return { rows, maxWidth };
|
|
2217
|
+
}
|
|
2218
|
+
/**
|
|
2219
|
+
* Return the configuration options as a plain object
|
|
2220
|
+
*/
|
|
2221
|
+
toJSON() {
|
|
2222
|
+
return Object.fromEntries(Object.entries(this.#configSet).map(([field, def]) => [
|
|
2223
|
+
field,
|
|
2224
|
+
{
|
|
2225
|
+
type: def.type,
|
|
2226
|
+
...def.multiple ? { multiple: true } : {},
|
|
2227
|
+
...def.delim ? { delim: def.delim } : {},
|
|
2228
|
+
...def.short ? { short: def.short } : {},
|
|
2229
|
+
...def.description ? { description: normalize(def.description) } : {},
|
|
2230
|
+
...def.validate ? { validate: def.validate } : {},
|
|
2231
|
+
...def.validOptions ? { validOptions: def.validOptions } : {},
|
|
2232
|
+
...def.default !== void 0 ? { default: def.default } : {},
|
|
2233
|
+
...def.hint ? { hint: def.hint } : {}
|
|
2234
|
+
}
|
|
2235
|
+
]));
|
|
2236
|
+
}
|
|
2237
|
+
/**
|
|
2238
|
+
* Custom printer for `util.inspect`
|
|
2239
|
+
*/
|
|
2240
|
+
[inspect.custom](_, options) {
|
|
2241
|
+
return `Jack ${inspect(this.toJSON(), options)}`;
|
|
2242
|
+
}
|
|
2243
|
+
};
|
|
2244
|
+
var jack = (options = {}) => new Jack(options);
|
|
2245
|
+
var normalize = (s, pre = false) => {
|
|
2246
|
+
if (pre)
|
|
2247
|
+
return s.split("\n").map((l) => `\u200B${l}`).join("\n");
|
|
2248
|
+
return s.split(/^\s*```\s*$/gm).map((s2, i) => {
|
|
2249
|
+
if (i % 2 === 1) {
|
|
2250
|
+
if (!s2.trim()) {
|
|
2251
|
+
return `\`\`\`
|
|
2252
|
+
\`\`\`
|
|
2253
|
+
`;
|
|
2254
|
+
}
|
|
2255
|
+
const split = s2.split("\n");
|
|
2256
|
+
split.pop();
|
|
2257
|
+
split.shift();
|
|
2258
|
+
const si = split.reduce((shortest, l) => {
|
|
2259
|
+
const ind = l.match(/^\s*/)?.[0] ?? "";
|
|
2260
|
+
if (ind.length)
|
|
2261
|
+
return Math.min(ind.length, shortest);
|
|
2262
|
+
else
|
|
2263
|
+
return shortest;
|
|
2264
|
+
}, Infinity);
|
|
2265
|
+
const i2 = isFinite(si) ? si : 0;
|
|
2266
|
+
return "\n```\n" + split.map((s3) => `\u200B${s3.substring(i2)}`).join("\n") + "\n```\n";
|
|
2267
|
+
}
|
|
2268
|
+
return s2.replace(/([^\n])\n[ \t]*([^\n])/g, (_, $1, $2) => !/^[-*]/.test($2) ? `${$1} ${$2}` : `${$1}
|
|
2269
|
+
${$2}`).replace(/([^\n])[ \t]+([^\n])/g, "$1 $2").replace(/\n{3,}/g, "\n\n").replace(/\n[ \t]+/g, "\n").trim();
|
|
2270
|
+
}).join("\n");
|
|
2271
|
+
};
|
|
2272
|
+
var normalizeMarkdown = (s, pre = false) => {
|
|
2273
|
+
const n = normalize(s, pre).replace(/\\/g, "\\\\");
|
|
2274
|
+
return pre ? `\`\`\`
|
|
2275
|
+
${n.replace(/\u200b/g, "")}
|
|
2276
|
+
\`\`\`` : n.replace(/\n +/g, "\n").trim();
|
|
2277
|
+
};
|
|
2278
|
+
var normalizeOneLine = (s, pre = false) => {
|
|
2279
|
+
const n = normalize(s, pre).replace(/[\s\u200b]+/g, " ").trim();
|
|
2280
|
+
return pre ? `\`${n}\`` : n;
|
|
2281
|
+
};
|
|
2282
|
+
|
|
2283
|
+
// ../../src/vlt/dist/esm/config/definition.js
|
|
2284
|
+
import { homedir as homedir2 } from "node:os";
|
|
2285
|
+
import { relative, sep } from "node:path";
|
|
2286
|
+
var commands = {
|
|
2287
|
+
i: "install",
|
|
2288
|
+
add: "install",
|
|
2289
|
+
install: "install",
|
|
2290
|
+
rm: "uninstall",
|
|
2291
|
+
u: "uninstall",
|
|
2292
|
+
uninstall: "uninstall",
|
|
2293
|
+
r: "run",
|
|
2294
|
+
"run-script": "run",
|
|
2295
|
+
run: "run",
|
|
2296
|
+
rx: "run-exec",
|
|
2297
|
+
"run-exec": "run-exec",
|
|
2298
|
+
x: "exec",
|
|
2299
|
+
exec: "exec",
|
|
2300
|
+
h: "help",
|
|
2301
|
+
"?": "help",
|
|
2302
|
+
help: "help",
|
|
2303
|
+
conf: "config",
|
|
2304
|
+
config: "config",
|
|
2305
|
+
ix: "install-exec",
|
|
2306
|
+
"install-exec": "install-exec",
|
|
2307
|
+
pkg: "pkg"
|
|
2308
|
+
};
|
|
2309
|
+
var getCommand = (s) => s && s in commands ? commands[s] : void 0;
|
|
2310
|
+
var xdg = new XDG("vlt");
|
|
2311
|
+
var home = homedir2();
|
|
2312
|
+
var confDir = xdg.config("vlt.json");
|
|
2313
|
+
var cacheDir = xdg.cache();
|
|
2314
|
+
var recordFields = [
|
|
2315
|
+
"git-hosts",
|
|
2316
|
+
"registries",
|
|
2317
|
+
"git-host-archives",
|
|
2318
|
+
"scope-registries"
|
|
2319
|
+
];
|
|
2320
|
+
var isRecordField = (s) => recordFields.includes(s);
|
|
2321
|
+
var stopParsingCommands = [
|
|
2322
|
+
"run",
|
|
2323
|
+
"run-exec",
|
|
2324
|
+
"exec",
|
|
2325
|
+
"install-exec"
|
|
2326
|
+
];
|
|
2327
|
+
var stopParsing = void 0;
|
|
2328
|
+
var definition = jack({
|
|
2329
|
+
envPrefix: "VLT",
|
|
2330
|
+
allowPositionals: true,
|
|
2331
|
+
usage: `vlt [<options>] [<cmd> [<args> ...]]`,
|
|
2332
|
+
stopAtPositionalTest: (arg) => {
|
|
2333
|
+
if (stopParsing)
|
|
2334
|
+
return true;
|
|
2335
|
+
const a = arg;
|
|
2336
|
+
if (stopParsingCommands.includes(commands[a])) {
|
|
2337
|
+
stopParsing = true;
|
|
2338
|
+
}
|
|
2339
|
+
return false;
|
|
2340
|
+
}
|
|
2341
|
+
}).heading("vlt - A New Home for JavaScript").description(`Here goes a short description of the vlt command line client.
|
|
2342
|
+
|
|
2343
|
+
Much more documentation available at <https://docs.vlt.sh>`).heading("Subcommands").heading("vlt install [packages ...]", 3, { pre: true }).description(`Install the specified packages, updating package.json and vlt-lock.json
|
|
2344
|
+
appropriately.`).heading("vlt uninstall [packages ...]", 3, { pre: true }).description(`The opposite of \`vlt install\`. Removes deps and updates vlt-lock.json
|
|
2345
|
+
and package.json appropriately.`).heading("vlt run <script> [args ...]", 3, { pre: true }).description(`Run a script defined in 'package.json', passing along any extra
|
|
2346
|
+
arguments. Note that vlt config values must be specified *before*
|
|
2347
|
+
the script name, because everything after that is handed off to
|
|
2348
|
+
the script process.`).heading("vlt exec [args ...]", 3, { pre: true }).description(`Run an arbitrary command, with the local installed packages first in the
|
|
2349
|
+
PATH. Ie, this will run your locally installed package bins.
|
|
2350
|
+
|
|
2351
|
+
If no command is provided, then a shell is spawned in the current working
|
|
2352
|
+
directory, with the locally installed package bins first in the PATH.
|
|
2353
|
+
|
|
2354
|
+
Note that any vlt configs must be specified *before* the command,
|
|
2355
|
+
as the remainder of the command line options are provided to the exec
|
|
2356
|
+
process.`).heading("vlt run-exec [args ...]", 3, { pre: true }).description(`If the first argument is a defined script in package.json, then this is
|
|
2357
|
+
equivalent to \`vlt run\`.
|
|
2358
|
+
|
|
2359
|
+
If not, then this is equivalent to \`vlt exec\`.`).heading("vlt config <subcommand>", 3, { pre: true }).description("Work with vlt configuration").heading("vlt config get <key>", 4, { pre: true }).description("Print the named config value").heading("vlt config list", 4, { pre: true }).description("Print all configuration settings currently in effect").heading("vlt config set <key=value> [<key=value> ...]", 4, {
|
|
2360
|
+
pre: true
|
|
2361
|
+
}).description(`Set config values. By default, these are written to the project config
|
|
2362
|
+
file, \`vlt.json\` in the root of the project. To set things for all
|
|
2363
|
+
projects, run with \`--config=user\``).heading("vlt config del <key> [<key> ...]", 4, { pre: true }).description(`Delete the named config fields. If no values remain in the config file,
|
|
2364
|
+
delete the file as well. By default, operates on the \`vlt.json\` file
|
|
2365
|
+
in the root of the current project. To delete a config field from the
|
|
2366
|
+
user config file, specify \`--config=user\`.`).heading("vlt config help [field ...]", 4, { pre: true }).description(`Get information about a config field, or show a list of known
|
|
2367
|
+
config field names.`).heading("Configuration").description(`If a \`vlt.json\` file is present in the root of the current project,
|
|
2368
|
+
then that will be used as a source of configuration information.
|
|
2369
|
+
|
|
2370
|
+
Next, the file at \`$HOME${sep}${relative(home, confDir)}\`
|
|
2371
|
+
will be checked, and loaded for any fields not set in the local project.
|
|
2372
|
+
|
|
2373
|
+
Object type values will be merged together. Set a field to \`null\` in
|
|
2374
|
+
the JSON configuration to explicitly remove it.
|
|
2375
|
+
|
|
2376
|
+
Command-specific fields may be set in a nested \`command\` object that
|
|
2377
|
+
overrides any options defined at the top level.
|
|
2378
|
+
`).flag({
|
|
2379
|
+
color: {
|
|
2380
|
+
short: "c",
|
|
2381
|
+
description: "Use colors (Default for TTY)"
|
|
2382
|
+
},
|
|
2383
|
+
"no-color": {
|
|
2384
|
+
short: "C",
|
|
2385
|
+
description: "Do not use colors (Default for non-TTY)"
|
|
2386
|
+
}
|
|
2387
|
+
}).opt({
|
|
2388
|
+
registry: {
|
|
2389
|
+
hint: "url",
|
|
2390
|
+
default: "https://registry.npmjs.org/",
|
|
2391
|
+
description: `Sets the registry for fetching packages, when no registry
|
|
2392
|
+
is explicitly set on a specifier.
|
|
2393
|
+
|
|
2394
|
+
For example, \`express@latest\` will be resolved by looking
|
|
2395
|
+
up the metadata from this registry.
|
|
2396
|
+
|
|
2397
|
+
Note that alias specifiers starting with \`npm:\` will
|
|
2398
|
+
still map to \`https://registry.npmjs.org\` if this is
|
|
2399
|
+
changed, unless the a new mapping is created via the
|
|
2400
|
+
\`--registries\` option.
|
|
2401
|
+
`
|
|
2402
|
+
}
|
|
2403
|
+
}).optList({
|
|
2404
|
+
registries: {
|
|
2405
|
+
hint: "name=url",
|
|
2406
|
+
description: `Specify named registry hosts by their prefix. To set the
|
|
2407
|
+
default registry used for non-namespaced specifiers,
|
|
2408
|
+
use the \`--registry\` option.
|
|
2409
|
+
|
|
2410
|
+
Prefixes can be used as a package alias. For example:
|
|
2411
|
+
|
|
2412
|
+
\`\`\`
|
|
2413
|
+
vlt --registries loc=http://reg.local install foo@loc:foo@1.x
|
|
2414
|
+
\`\`\`
|
|
2415
|
+
|
|
2416
|
+
By default, the public npm registry is registered to the
|
|
2417
|
+
\`npm:\` prefix. It is not recommended to change this
|
|
2418
|
+
mapping in most cases.
|
|
2419
|
+
`
|
|
2420
|
+
},
|
|
2421
|
+
"scope-registries": {
|
|
2422
|
+
hint: "@scope=url",
|
|
2423
|
+
description: `Map package name scopes to registry URLs.
|
|
2424
|
+
|
|
2425
|
+
For example,
|
|
2426
|
+
\`--scope-registries @acme=https://registry.acme/\`
|
|
2427
|
+
would tell vlt to fetch any packages named
|
|
2428
|
+
\`@acme/...\` from the \`https://registry.acme/\`
|
|
2429
|
+
registry.
|
|
2430
|
+
|
|
2431
|
+
Note: this way of specifying registries is more ambiguous,
|
|
2432
|
+
compared with using the \`--registries\` field and explicit
|
|
2433
|
+
prefixes, because instead of failing when the configuration
|
|
2434
|
+
is absent, it will instead attempt to fetch from the
|
|
2435
|
+
default registry.
|
|
2436
|
+
|
|
2437
|
+
By comparison, using
|
|
2438
|
+
\`--registries acme=https://registry.acme/\` and then
|
|
2439
|
+
specifying dependencies such as \`"foo": "acme:foo@1.x"\`
|
|
2440
|
+
means that regardless of the name, the package will be
|
|
2441
|
+
fetched from the explicitly named registry, or fail if
|
|
2442
|
+
no registry is defined with that name.
|
|
2443
|
+
|
|
2444
|
+
However, custom registry aliases are not supported by other
|
|
2445
|
+
package managers.`
|
|
2446
|
+
},
|
|
2447
|
+
"git-hosts": {
|
|
2448
|
+
hint: `name=template`,
|
|
2449
|
+
short: "G",
|
|
2450
|
+
description: `Map a shorthand name to a git remote URL template.
|
|
2451
|
+
|
|
2452
|
+
The \`template\` may contain placeholders, which will be
|
|
2453
|
+
swapped with the relevant values.
|
|
2454
|
+
|
|
2455
|
+
\`$1\`, \`$2\`, etc. are replaced with the appropriate
|
|
2456
|
+
n-th path portion. For example, \`github:user/project\`
|
|
2457
|
+
would replace the \`$1\` in the template with \`user\`,
|
|
2458
|
+
and \`$2\` with \`project\`.`
|
|
2459
|
+
},
|
|
2460
|
+
"git-host-archives": {
|
|
2461
|
+
hint: `name=template`,
|
|
2462
|
+
short: "A",
|
|
2463
|
+
description: `Similar to the \`--git-host <name>=<template>\` option,
|
|
2464
|
+
this option can define a template string that will be
|
|
2465
|
+
expanded to provide the URL to download a pre-built
|
|
2466
|
+
tarball of the git repository.
|
|
2467
|
+
|
|
2468
|
+
In addition to the n-th path portion expansions performed
|
|
2469
|
+
by \`--git-host\`, this field will also expand the
|
|
2470
|
+
string \`$committish\` in the template, replacing it with
|
|
2471
|
+
the resolved git committish value to be fetched.`
|
|
2472
|
+
}
|
|
2473
|
+
}).opt({
|
|
2474
|
+
cache: {
|
|
2475
|
+
hint: "path",
|
|
2476
|
+
description: `
|
|
2477
|
+
Location of the vlt on-disk cache. Defaults to the platform-specific
|
|
2478
|
+
directory recommended by the XDG specification.
|
|
2479
|
+
`,
|
|
2480
|
+
default: cacheDir
|
|
2481
|
+
},
|
|
2482
|
+
tag: {
|
|
2483
|
+
description: `Default \`dist-tag\` to install`,
|
|
2484
|
+
default: "latest"
|
|
2485
|
+
},
|
|
2486
|
+
before: {
|
|
2487
|
+
hint: "date",
|
|
2488
|
+
description: `Do not install any packages published after this date`
|
|
2489
|
+
},
|
|
2490
|
+
os: {
|
|
2491
|
+
description: `The operating system to use as the selector when choosing
|
|
2492
|
+
packages based on their \`os\` value.`,
|
|
2493
|
+
default: process.platform
|
|
2494
|
+
},
|
|
2495
|
+
arch: {
|
|
2496
|
+
description: `CPU architecture to use as the selector when choosing
|
|
2497
|
+
packages based on their \`cpu\` value.`,
|
|
2498
|
+
default: process.arch
|
|
2499
|
+
},
|
|
2500
|
+
"node-version": {
|
|
2501
|
+
hint: "version",
|
|
2502
|
+
description: `Node version to use when choosing packages based on
|
|
2503
|
+
their \`engines.node\` value.`,
|
|
2504
|
+
default: process.version
|
|
2505
|
+
}
|
|
2506
|
+
}).flag({
|
|
2507
|
+
"git-shallow": {
|
|
2508
|
+
description: `Set to force \`--depth=1\` on all git clone actions.
|
|
2509
|
+
When set explicitly to false with --no-git-shallow,
|
|
2510
|
+
then \`--depth=1\` will not be used.
|
|
2511
|
+
|
|
2512
|
+
When not set explicitly, \`--depth=1\` will be used for
|
|
2513
|
+
git hosts known to support this behavior.`
|
|
2514
|
+
}
|
|
2515
|
+
}).num({
|
|
2516
|
+
"fetch-retries": {
|
|
2517
|
+
hint: "n",
|
|
2518
|
+
description: `Number of retries to perform when encountering network
|
|
2519
|
+
or other likely-transient errors from git hosts.`,
|
|
2520
|
+
default: 3
|
|
2521
|
+
},
|
|
2522
|
+
"fetch-retry-factor": {
|
|
2523
|
+
hint: "n",
|
|
2524
|
+
description: `The exponential factor to use when retrying`,
|
|
2525
|
+
default: 2
|
|
2526
|
+
},
|
|
2527
|
+
"fetch-retry-mintimeout": {
|
|
2528
|
+
hint: "n",
|
|
2529
|
+
description: `Number of milliseconds before starting first retry`,
|
|
2530
|
+
default: 6e4
|
|
2531
|
+
},
|
|
2532
|
+
"fetch-retry-maxtimeout": {
|
|
2533
|
+
hint: "n",
|
|
2534
|
+
description: `Maximum number of milliseconds between two retries`,
|
|
2535
|
+
default: 1e3
|
|
2536
|
+
}
|
|
2537
|
+
}).optList({
|
|
2538
|
+
workspace: {
|
|
2539
|
+
hint: "ws",
|
|
2540
|
+
short: "w",
|
|
2541
|
+
description: `Set to limit the spaces being worked on when working on
|
|
2542
|
+
workspaces.
|
|
2543
|
+
|
|
2544
|
+
Can be paths or glob patterns matching paths.
|
|
2545
|
+
|
|
2546
|
+
Specifying workspaces by package.json name is not
|
|
2547
|
+
supported.`
|
|
2548
|
+
},
|
|
2549
|
+
"workspace-group": {
|
|
2550
|
+
short: "g",
|
|
2551
|
+
description: `Specify named workspace group names to load and operate on
|
|
2552
|
+
when doing recursive operations on workspaces.`
|
|
2553
|
+
}
|
|
2554
|
+
}).flag({
|
|
2555
|
+
recursive: {
|
|
2556
|
+
short: "r",
|
|
2557
|
+
description: `Run an operation across multiple workspaces.
|
|
2558
|
+
|
|
2559
|
+
No effect when used in non-monorepo projects.
|
|
2560
|
+
|
|
2561
|
+
Implied by setting --workspace or --workspace-group. If
|
|
2562
|
+
not set, then the action is run on the project root.`
|
|
2563
|
+
},
|
|
2564
|
+
bail: {
|
|
2565
|
+
short: "b",
|
|
2566
|
+
description: `When running scripts across multiple workspaces, stop
|
|
2567
|
+
on the first failure.`,
|
|
2568
|
+
default: true
|
|
2569
|
+
},
|
|
2570
|
+
"no-bail": {
|
|
2571
|
+
short: "B",
|
|
2572
|
+
description: `When running scripts across multiple workspaces, continue
|
|
2573
|
+
on failure, running the script for all workspaces.`
|
|
2574
|
+
}
|
|
2575
|
+
}).opt({
|
|
2576
|
+
config: {
|
|
2577
|
+
hint: "user | project",
|
|
2578
|
+
description: `Specify whether to operate on user-level or project-level
|
|
2579
|
+
configuration files when running \`vlt config\` commands.`,
|
|
2580
|
+
validOptions: ["user", "project"],
|
|
2581
|
+
default: "project"
|
|
2582
|
+
},
|
|
2583
|
+
editor: {
|
|
2584
|
+
hint: "program",
|
|
2585
|
+
description: `The blocking editor to use for \`vlt config edit\` and
|
|
2586
|
+
any other cases where a file should be opened for
|
|
2587
|
+
editing.
|
|
2588
|
+
|
|
2589
|
+
Defaults to the \`EDITOR\` or \`VISUAL\` env if set, or
|
|
2590
|
+
\`notepad.exe\` on Windows, or \`vi\` elsewhere.`,
|
|
2591
|
+
default: process.env.EDITOR || process.env.VISUAL || (process.platform === "win32" ? `${process.env.SYSTEMROOT}\\notepad.exe` : "vi")
|
|
2592
|
+
},
|
|
2593
|
+
"script-shell": {
|
|
2594
|
+
hint: "program",
|
|
2595
|
+
description: `The shell to use when executing \`package.json#scripts\`
|
|
2596
|
+
(either as lifecycle scripts or explicitly with
|
|
2597
|
+
\`vlt run\`) and \`vlt exec\`.
|
|
2598
|
+
|
|
2599
|
+
If not set, defaults to \`/bin/sh\` on POSIX systems,
|
|
2600
|
+
and \`cmd.exe\` on Windows.
|
|
2601
|
+
|
|
2602
|
+
When no argument is provided to \`vlt exec\`, the \`SHELL\`
|
|
2603
|
+
environment variable takes precedence if set.`
|
|
2604
|
+
},
|
|
2605
|
+
"fallback-command": {
|
|
2606
|
+
hint: "command",
|
|
2607
|
+
description: `The command to run when the first argument doesn't
|
|
2608
|
+
match any known commands.
|
|
2609
|
+
|
|
2610
|
+
For pnpm-style behavior, set this to 'run-exec'. e.g:
|
|
2611
|
+
\`\`\`
|
|
2612
|
+
vlt config set fallback-command=run-exec
|
|
2613
|
+
\`\`\``,
|
|
2614
|
+
default: "help",
|
|
2615
|
+
validOptions: [...new Set(Object.values(commands))]
|
|
2616
|
+
}
|
|
2617
|
+
}).opt({
|
|
2618
|
+
package: {
|
|
2619
|
+
hint: "p",
|
|
2620
|
+
description: `When running \`vlt install-exec\`, this allows you to
|
|
2621
|
+
explicitly set the package to search for bins. If not
|
|
2622
|
+
provided, then vlt will interpret the first argument as
|
|
2623
|
+
the package, and attempt to run the default executable.`
|
|
2624
|
+
}
|
|
2625
|
+
}).flag({
|
|
2626
|
+
"save-dev": {
|
|
2627
|
+
short: "D",
|
|
2628
|
+
description: `Save installed packages to a package.json file as
|
|
2629
|
+
devDependencies`
|
|
2630
|
+
},
|
|
2631
|
+
"save-optional": {
|
|
2632
|
+
short: "O",
|
|
2633
|
+
description: `Save installed packages to a package.json file as
|
|
2634
|
+
optionalDependencies`
|
|
2635
|
+
},
|
|
2636
|
+
"save-peer": {
|
|
2637
|
+
description: `Save installed packages to a package.json file as
|
|
2638
|
+
peerDependencies`
|
|
2639
|
+
},
|
|
2640
|
+
"save-prod": {
|
|
2641
|
+
short: "P",
|
|
2642
|
+
description: `Save installed packages into dependencies specifically.
|
|
2643
|
+
This is useful if a package already exists in
|
|
2644
|
+
devDependencies or optionalDependencies, but you want to
|
|
2645
|
+
move it to be a non-optional production dependency.`
|
|
2646
|
+
}
|
|
2647
|
+
}).flag({
|
|
2648
|
+
help: {
|
|
2649
|
+
short: "h",
|
|
2650
|
+
description: "Print helpful information"
|
|
2651
|
+
}
|
|
2652
|
+
});
|
|
2653
|
+
|
|
2654
|
+
// ../../src/vlt/dist/esm/config/merge.js
|
|
2655
|
+
var merge = (base, add) => Object.fromEntries(Object.entries(base).map(([k, v]) => [
|
|
2656
|
+
k,
|
|
2657
|
+
add[k] === void 0 ? v : Array.isArray(v) && Array.isArray(add[k]) ? [.../* @__PURE__ */ new Set([...v, ...add[k]])] : Array.isArray(v) || Array.isArray(add[k]) ? add[k] : !!v && typeof v === "object" && !!add[k] && typeof add[k] === "object" ? merge(v, add[k]) : add[k]
|
|
2658
|
+
]).concat(
|
|
2659
|
+
// already merged together if existing, so just get new additions
|
|
2660
|
+
Object.entries(add).filter(([k]) => base[k] === void 0)
|
|
2661
|
+
));
|
|
2662
|
+
|
|
2663
|
+
// ../../src/vlt/dist/esm/config/index.js
|
|
2664
|
+
var reducePairs = (pairs) => {
|
|
2665
|
+
const record = {};
|
|
2666
|
+
for (const kv of pairs) {
|
|
2667
|
+
const eq = kv.indexOf("=");
|
|
2668
|
+
if (eq === -1)
|
|
2669
|
+
record[kv] = "";
|
|
2670
|
+
else {
|
|
2671
|
+
const key = kv.substring(0, eq);
|
|
2672
|
+
const val = kv.substring(eq + 1);
|
|
2673
|
+
record[key] = val;
|
|
2674
|
+
}
|
|
2675
|
+
}
|
|
2676
|
+
return record;
|
|
2677
|
+
};
|
|
2678
|
+
var isRecordFieldValue = (k, v) => Array.isArray(v) && recordFields.includes(k);
|
|
2679
|
+
var pairsToRecords = (obj) => {
|
|
2680
|
+
return Object.fromEntries(Object.entries(obj).map(([k, v]) => [
|
|
2681
|
+
k,
|
|
2682
|
+
k === "command" && v && typeof v === "object" ? Object.fromEntries(Object.entries(v).map(([k2, v2]) => [
|
|
2683
|
+
k2,
|
|
2684
|
+
pairsToRecords(v2)
|
|
2685
|
+
])) : isRecordFieldValue(k, v) ? reducePairs(v) : v
|
|
2686
|
+
]));
|
|
2687
|
+
};
|
|
2688
|
+
var recordsToPairs = (obj) => {
|
|
2689
|
+
return Object.fromEntries(Object.entries(obj).map(([k, v]) => [
|
|
2690
|
+
k,
|
|
2691
|
+
k === "command" && v && typeof v === "object" ? recordsToPairs(v) : !v || typeof v !== "object" || Array.isArray(v) || !isRecordField(k) ? v : Object.entries(v).map(([k2, v2]) => `${k2}=${v2}`)
|
|
2692
|
+
]));
|
|
2693
|
+
};
|
|
2694
|
+
var kRecord = Symbol("parsed key=value record");
|
|
2695
|
+
var exists = (f) => lstat(f).then(() => true, () => false);
|
|
2696
|
+
var home2 = homedir3();
|
|
2697
|
+
var xdg2 = new XDG("vlt");
|
|
2698
|
+
var Config = class _Config {
|
|
2699
|
+
/**
|
|
2700
|
+
* The {@link https://npmjs.com/jackspeak | JackSpeak} object
|
|
2701
|
+
* representing vlt's configuration
|
|
2702
|
+
*/
|
|
2703
|
+
jack;
|
|
2704
|
+
stringifyOptions = { [kIndent]: " ", [kNewline]: "\n" };
|
|
2705
|
+
configFiles = {};
|
|
2706
|
+
/**
|
|
2707
|
+
* Parsed values in effect
|
|
2708
|
+
*/
|
|
2709
|
+
values;
|
|
2710
|
+
/**
|
|
2711
|
+
* Command-specific config values
|
|
2712
|
+
*/
|
|
2713
|
+
commandValues = {};
|
|
2714
|
+
/**
|
|
2715
|
+
* A flattened object of the parsed configuration
|
|
2716
|
+
*/
|
|
2717
|
+
get options() {
|
|
2718
|
+
if (this.#options)
|
|
2719
|
+
return this.#options;
|
|
2720
|
+
this.#options = Object.assign(pairsToRecords(this.parse().values), { projectRoot: this.projectRoot });
|
|
2721
|
+
return this.#options;
|
|
2722
|
+
}
|
|
2723
|
+
// memoized options() getter value
|
|
2724
|
+
#options;
|
|
2725
|
+
/**
|
|
2726
|
+
* positional arguments to the vlt process
|
|
2727
|
+
*/
|
|
2728
|
+
positionals;
|
|
2729
|
+
/**
|
|
2730
|
+
* The root of the project where a vlt.json, vlt-workspaces.json,
|
|
2731
|
+
* package.json, or .git was found. Not necessarily the `process.cwd()`,
|
|
2732
|
+
* though that is the default location.
|
|
2733
|
+
*
|
|
2734
|
+
* Never walks up as far as `$HOME`. So for example, if a project is in
|
|
2735
|
+
* `~/projects/xyz`, then the highest dir it will check is `~/projects`
|
|
2736
|
+
*/
|
|
2737
|
+
projectRoot;
|
|
2738
|
+
/**
|
|
2739
|
+
* Record<alias, canonical name> to dereference command aliases.
|
|
2740
|
+
*/
|
|
2741
|
+
commands;
|
|
2742
|
+
/**
|
|
2743
|
+
* Which command name to use for overriding with command-specific values,
|
|
2744
|
+
* determined from the argv when parse() is called.
|
|
2745
|
+
*/
|
|
2746
|
+
command;
|
|
2747
|
+
constructor(jack2 = definition, projectRoot = process.cwd()) {
|
|
2748
|
+
this.projectRoot = projectRoot;
|
|
2749
|
+
this.commands = commands;
|
|
2750
|
+
this.jack = jack2;
|
|
2751
|
+
}
|
|
2752
|
+
/**
|
|
2753
|
+
* Parse the arguments and set configuration and positionals accordingly.
|
|
2754
|
+
*/
|
|
2755
|
+
parse(args = process.argv) {
|
|
2756
|
+
if (this.values && this.positionals) {
|
|
2757
|
+
return this;
|
|
2758
|
+
}
|
|
2759
|
+
this.jack.loadEnvDefaults();
|
|
2760
|
+
const p = this.jack.parseRaw(args);
|
|
2761
|
+
const fallback = getCommand(p.values["fallback-command"]);
|
|
2762
|
+
this.command = getCommand(p.positionals[0]);
|
|
2763
|
+
const cmdOrFallback = this.command ?? fallback;
|
|
2764
|
+
const cmdSpecific = cmdOrFallback && this.commandValues[cmdOrFallback];
|
|
2765
|
+
if (cmdSpecific) {
|
|
2766
|
+
this.jack.setConfigValues(recordsToPairs(cmdSpecific));
|
|
2767
|
+
}
|
|
2768
|
+
this.jack.applyDefaults(p);
|
|
2769
|
+
this.jack.writeEnv(p);
|
|
2770
|
+
if (this.command)
|
|
2771
|
+
p.positionals.shift();
|
|
2772
|
+
else
|
|
2773
|
+
this.command = getCommand(p.values["fallback-command"]);
|
|
2774
|
+
return Object.assign(this, p);
|
|
2775
|
+
}
|
|
2776
|
+
/**
|
|
2777
|
+
* Get a `key=value` list option value as an object.
|
|
2778
|
+
*
|
|
2779
|
+
* For example, a list option with a vlaue of `['key=value', 'xyz=as=df' ]`
|
|
2780
|
+
* would be returned as `{key: 'value', xyz: 'as=df'}`
|
|
2781
|
+
*
|
|
2782
|
+
* Results are memoized, so subsequent calls for the same key will return the
|
|
2783
|
+
* same object. If new strings are added to the list, then the memoized value
|
|
2784
|
+
* is *not* updated, so only use once configurations have been fully loaded.
|
|
2785
|
+
*
|
|
2786
|
+
* If the config value is not set at all, an empty object is returned.
|
|
2787
|
+
*/
|
|
2788
|
+
getRecord(k) {
|
|
2789
|
+
const pairs = this.get(k);
|
|
2790
|
+
if (!pairs)
|
|
2791
|
+
return {};
|
|
2792
|
+
if (pairs[kRecord])
|
|
2793
|
+
return pairs[kRecord];
|
|
2794
|
+
const kv = pairs.reduce((kv2, pair) => {
|
|
2795
|
+
const eq = pair.indexOf("=");
|
|
2796
|
+
if (eq === -1)
|
|
2797
|
+
return kv2;
|
|
2798
|
+
const key = pair.substring(0, eq);
|
|
2799
|
+
const val = pair.substring(eq + 1);
|
|
2800
|
+
kv2[key] = val;
|
|
2801
|
+
return kv2;
|
|
2802
|
+
}, {});
|
|
2803
|
+
Object.assign(pairs, { [kRecord]: kv });
|
|
2804
|
+
return kv;
|
|
2805
|
+
}
|
|
2806
|
+
/**
|
|
2807
|
+
* Get a configuration value.
|
|
2808
|
+
*
|
|
2809
|
+
* Note: `key=value` pair configs are returned as a string array. To get them
|
|
2810
|
+
* as an object, use {@link Config#getRecord}.
|
|
2811
|
+
*/
|
|
2812
|
+
get(k) {
|
|
2813
|
+
return (this.values ?? this.parse().values)[k];
|
|
2814
|
+
}
|
|
2815
|
+
/**
|
|
2816
|
+
* Write the config values to the user or project config file.
|
|
2817
|
+
*/
|
|
2818
|
+
async writeConfigFile(which, values) {
|
|
2819
|
+
const f = this.getFilename(which);
|
|
2820
|
+
await mkdir(dirname2(f), { recursive: true });
|
|
2821
|
+
const vals = Object.assign(pairsToRecords(values), this.stringifyOptions);
|
|
2822
|
+
await writeFile(f, stringify(vals));
|
|
2823
|
+
this.configFiles[f] = vals;
|
|
2824
|
+
return values;
|
|
2825
|
+
}
|
|
2826
|
+
/**
|
|
2827
|
+
* Fold in the provided fields with the existing properties
|
|
2828
|
+
* in the config file.
|
|
2829
|
+
*/
|
|
2830
|
+
async addConfigToFile(which, values) {
|
|
2831
|
+
const f = this.getFilename(which);
|
|
2832
|
+
return this.writeConfigFile(which, merge(await this.#maybeLoadConfigFile(f) ?? {}, values));
|
|
2833
|
+
}
|
|
2834
|
+
/**
|
|
2835
|
+
* if the file exists, parse and load it. returns object if data was
|
|
2836
|
+
* loaded, or undefined if not.
|
|
2837
|
+
*/
|
|
2838
|
+
async #maybeLoadConfigFile(file) {
|
|
2839
|
+
const result = await this.#readConfigFile(file);
|
|
2840
|
+
if (result) {
|
|
2841
|
+
try {
|
|
2842
|
+
const { command: command2, ...values } = recordsToPairs(result);
|
|
2843
|
+
if (command2) {
|
|
2844
|
+
for (const [c, opts] of Object.entries(command2)) {
|
|
2845
|
+
const cmd = getCommand(c);
|
|
2846
|
+
if (cmd) {
|
|
2847
|
+
this.commandValues[cmd] = merge(this.commandValues[cmd] ?? {}, opts);
|
|
2848
|
+
}
|
|
2849
|
+
}
|
|
2850
|
+
}
|
|
2851
|
+
this.jack.setConfigValues(values, file);
|
|
2852
|
+
return result;
|
|
2853
|
+
} catch (er) {
|
|
2854
|
+
throw error("failed to load config values from file", {
|
|
2855
|
+
path: file,
|
|
2856
|
+
cause: er
|
|
2857
|
+
});
|
|
2858
|
+
}
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
async #readConfigFile(file) {
|
|
2862
|
+
if (this.configFiles[file])
|
|
2863
|
+
return this.configFiles[file];
|
|
2864
|
+
const data = await readFile(file, "utf8").catch(() => {
|
|
2865
|
+
});
|
|
2866
|
+
if (!data)
|
|
2867
|
+
return void 0;
|
|
2868
|
+
let result;
|
|
2869
|
+
try {
|
|
2870
|
+
result = parse(data);
|
|
2871
|
+
if (result[kIndent] !== void 0)
|
|
2872
|
+
this.stringifyOptions[kIndent] = result[kIndent];
|
|
2873
|
+
if (result[kNewline] !== void 0)
|
|
2874
|
+
this.stringifyOptions[kNewline] = result[kNewline];
|
|
2875
|
+
} catch (er) {
|
|
2876
|
+
throw error("failed to parse vlt config file", {
|
|
2877
|
+
path: file,
|
|
2878
|
+
cause: er
|
|
2879
|
+
});
|
|
2880
|
+
}
|
|
2881
|
+
this.configFiles[file] = result;
|
|
2882
|
+
return result;
|
|
2883
|
+
}
|
|
2884
|
+
getFilename(which = "project") {
|
|
2885
|
+
return which === "user" ? xdg2.config("vlt.json") : resolve3(this.projectRoot, "vlt.json");
|
|
2886
|
+
}
|
|
2887
|
+
async deleteConfigKeys(which, fields) {
|
|
2888
|
+
const file = this.getFilename(which);
|
|
2889
|
+
const data = await this.#maybeLoadConfigFile(file);
|
|
2890
|
+
if (!data) {
|
|
2891
|
+
rmSync(file, { force: true });
|
|
2892
|
+
return false;
|
|
2893
|
+
}
|
|
2894
|
+
let didSomething = false;
|
|
2895
|
+
for (const f of fields) {
|
|
2896
|
+
const [key, ...sk] = f.split(".");
|
|
2897
|
+
const subs = sk.join(".");
|
|
2898
|
+
const k = key;
|
|
2899
|
+
const v = data[k];
|
|
2900
|
+
if (v === void 0)
|
|
2901
|
+
continue;
|
|
2902
|
+
if (subs && v && typeof v === "object") {
|
|
2903
|
+
if (Array.isArray(v)) {
|
|
2904
|
+
const i = v.findIndex((subvalue) => subvalue.startsWith(`${subs}=`));
|
|
2905
|
+
if (i !== -1) {
|
|
2906
|
+
v.splice(i, 1);
|
|
2907
|
+
if (v.length === 0)
|
|
2908
|
+
delete data[k];
|
|
2909
|
+
didSomething = true;
|
|
2910
|
+
}
|
|
2911
|
+
} else {
|
|
2912
|
+
if (v[subs] !== void 0) {
|
|
2913
|
+
delete v[subs];
|
|
2914
|
+
if (Object.keys(v).length === 0)
|
|
2915
|
+
delete data[k];
|
|
2916
|
+
didSomething = true;
|
|
2917
|
+
}
|
|
2918
|
+
}
|
|
2919
|
+
} else {
|
|
2920
|
+
didSomething = true;
|
|
2921
|
+
delete data[k];
|
|
2922
|
+
}
|
|
2923
|
+
}
|
|
2924
|
+
const d = stringify(data);
|
|
2925
|
+
if (d.trim() === "{}") {
|
|
2926
|
+
rmSync(file, { force: true });
|
|
2927
|
+
} else {
|
|
2928
|
+
writeFileSync(file, stringify(data));
|
|
2929
|
+
}
|
|
2930
|
+
return didSomething;
|
|
2931
|
+
}
|
|
2932
|
+
/**
|
|
2933
|
+
* Edit the user or project configuration file.
|
|
2934
|
+
*
|
|
2935
|
+
* If the file isn't present, then it starts with `{}` so the user has
|
|
2936
|
+
* something to work with.
|
|
2937
|
+
*
|
|
2938
|
+
* If the result is not valid, or no config settings are contained in the
|
|
2939
|
+
* file after editing, then it's restored to what it was before, which might
|
|
2940
|
+
* mean deleting the file.
|
|
2941
|
+
*/
|
|
2942
|
+
async editConfigFile(which, edit) {
|
|
2943
|
+
const file = this.getFilename(which);
|
|
2944
|
+
const backup = this.configFiles[file];
|
|
2945
|
+
if (!backup) {
|
|
2946
|
+
writeFileSync(file, "{\n\n}\n");
|
|
2947
|
+
}
|
|
2948
|
+
await edit(file);
|
|
2949
|
+
let valid = false;
|
|
2950
|
+
try {
|
|
2951
|
+
const res = parse(readFileSync(file, "utf8"));
|
|
2952
|
+
if (!res || typeof res !== "object" || Array.isArray(res)) {
|
|
2953
|
+
throw error("Invalid configuration, expected object", {
|
|
2954
|
+
path: file,
|
|
2955
|
+
found: res
|
|
2956
|
+
});
|
|
2957
|
+
}
|
|
2958
|
+
if (Object.keys(res).length === 0) {
|
|
2959
|
+
delete this.configFiles[file];
|
|
2960
|
+
rmSync(file, { force: true });
|
|
2961
|
+
} else {
|
|
2962
|
+
this.jack.setConfigValues(recordsToPairs(res));
|
|
2963
|
+
this.configFiles[file] = res;
|
|
2964
|
+
}
|
|
2965
|
+
valid = true;
|
|
2966
|
+
} finally {
|
|
2967
|
+
if (!valid) {
|
|
2968
|
+
if (backup) {
|
|
2969
|
+
writeFileSync(file, stringify(backup));
|
|
2970
|
+
} else {
|
|
2971
|
+
rmSync(file, { force: true });
|
|
2972
|
+
}
|
|
2973
|
+
}
|
|
2974
|
+
}
|
|
2975
|
+
}
|
|
2976
|
+
/**
|
|
2977
|
+
* Find the local config file and load both it and the user-level config in
|
|
2978
|
+
* the XDG config home.
|
|
2979
|
+
*
|
|
2980
|
+
* Note: if working in a workspaces monorepo, then the vlt.json file MUST
|
|
2981
|
+
* be in the same folder as the vlt-workspaces.json file, because we stop
|
|
2982
|
+
* looking when we find either one.
|
|
2983
|
+
*/
|
|
2984
|
+
async loadConfigFile() {
|
|
2985
|
+
const userConfig = xdg2.config("vlt.json");
|
|
2986
|
+
await this.#maybeLoadConfigFile(userConfig);
|
|
2987
|
+
const stops = ["vlt-workspaces.json", ".git"];
|
|
2988
|
+
let foundLikelyRoot = false;
|
|
2989
|
+
const likelies = ["package.json", "node_modules"];
|
|
2990
|
+
for (const dir of walkUp(this.projectRoot)) {
|
|
2991
|
+
if (dir === home2)
|
|
2992
|
+
break;
|
|
2993
|
+
const projectConfig = resolve3(dir, "vlt.json");
|
|
2994
|
+
if (projectConfig === userConfig)
|
|
2995
|
+
break;
|
|
2996
|
+
if (await this.#maybeLoadConfigFile(resolve3(dir, "vlt.json"))) {
|
|
2997
|
+
this.projectRoot = dir;
|
|
2998
|
+
break;
|
|
2999
|
+
}
|
|
3000
|
+
if (!foundLikelyRoot && (await Promise.all(likelies.map((s) => exists(resolve3(dir, s))))).find((x) => x)) {
|
|
3001
|
+
foundLikelyRoot = true;
|
|
3002
|
+
this.projectRoot = dir;
|
|
3003
|
+
}
|
|
3004
|
+
if ((await Promise.all(stops.map((s) => exists(resolve3(dir, s))))).find((x) => x)) {
|
|
3005
|
+
this.projectRoot = dir;
|
|
3006
|
+
break;
|
|
3007
|
+
}
|
|
3008
|
+
}
|
|
3009
|
+
return this;
|
|
3010
|
+
}
|
|
3011
|
+
/**
|
|
3012
|
+
* Determine whether we should use colors in the output. Update
|
|
3013
|
+
* chalk appropriately.
|
|
3014
|
+
*
|
|
3015
|
+
* Implicitly calls this.parse() if it not parsed already.
|
|
3016
|
+
*/
|
|
3017
|
+
async loadColor() {
|
|
3018
|
+
const c = this.get("color");
|
|
3019
|
+
const chalk2 = (await Promise.resolve().then(() => (init_source(), source_exports))).default;
|
|
3020
|
+
let color;
|
|
3021
|
+
if (process.env.NO_COLOR !== "1" && (c === true || c === void 0 && chalk2.level > 0)) {
|
|
3022
|
+
color = true;
|
|
3023
|
+
chalk2.level = Math.max(chalk2.level, 1);
|
|
3024
|
+
process.env.FORCE_COLOR = String(chalk2.level);
|
|
3025
|
+
delete process.env.NO_COLOR;
|
|
3026
|
+
} else {
|
|
3027
|
+
color = false;
|
|
3028
|
+
chalk2.level = 0;
|
|
3029
|
+
process.env.FORCE_COLOR = "0";
|
|
3030
|
+
process.env.NO_COLOR = "1";
|
|
3031
|
+
}
|
|
3032
|
+
const { values = this.parse().values } = this;
|
|
3033
|
+
values.color = color;
|
|
3034
|
+
return this;
|
|
3035
|
+
}
|
|
3036
|
+
/**
|
|
3037
|
+
* cache of the loaded config
|
|
3038
|
+
*/
|
|
3039
|
+
static #loaded;
|
|
3040
|
+
/**
|
|
3041
|
+
* Load the configuration and return a Promise to a
|
|
3042
|
+
* {@link Config} object
|
|
3043
|
+
*/
|
|
3044
|
+
static async load(projectRoot = process.cwd(), argv = process.argv, reload = false) {
|
|
3045
|
+
if (this.#loaded && !reload)
|
|
3046
|
+
return this.#loaded;
|
|
3047
|
+
const a = new _Config(definition, projectRoot);
|
|
3048
|
+
const b = await a.loadConfigFile();
|
|
3049
|
+
const c = await b.parse(argv).loadColor();
|
|
3050
|
+
this.#loaded = c;
|
|
3051
|
+
return this.#loaded;
|
|
3052
|
+
}
|
|
3053
|
+
};
|
|
3054
|
+
|
|
3055
|
+
// ../../src/vlt/dist/esm/commands/help.js
|
|
3056
|
+
var usage = async () => (await Config.load()).jack.usage();
|
|
3057
|
+
var command = async () => {
|
|
3058
|
+
console.log(await usage());
|
|
3059
|
+
};
|
|
3060
|
+
export {
|
|
3061
|
+
command,
|
|
3062
|
+
usage
|
|
3063
|
+
};
|
|
3064
|
+
//# sourceMappingURL=help.js.map
|