@manot40/genql-cli 1.0.0 → 1.0.2
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/LICENSE +21 -21
- package/README.md +41 -41
- package/dist/chunk-BBnsswwY.mjs +31 -0
- package/dist/cli-truncate-D9-H5ZcK.mjs +155 -0
- package/dist/cli.d.mts +0 -0
- package/dist/cli.mjs +4248 -8
- package/dist/get-east-asian-width-BrRn4isQ.mjs +24 -0
- package/dist/index.mjs +1 -1
- package/dist/log-update-C7F4wEC4.mjs +432 -0
- package/dist/main-DnxPgNLv.mjs +4937 -0
- package/dist/runtime/createClient.ts +3 -2
- package/dist/slice-ansi-BXJtqwp2.mjs +282 -0
- package/dist/wrap-ansi-B5Z_xwBN.mjs +3 -0
- package/dist/wrap-ansi-BLh1Umdy.mjs +359 -0
- package/package.json +24 -28
- package/dist/main-BVWRj669.mjs +0 -798
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region node_modules/get-east-asian-width/lookup.js
|
|
2
|
+
function isAmbiguous(x) {
|
|
3
|
+
return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
|
|
4
|
+
}
|
|
5
|
+
function isFullWidth(x) {
|
|
6
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
7
|
+
}
|
|
8
|
+
function isWide(x) {
|
|
9
|
+
return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x >= 94192 && x <= 94198 || x >= 94208 && x <= 101589 || x >= 101631 && x <= 101662 || x >= 101760 && x <= 101874 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128728 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129674 || x >= 129678 && x <= 129734 || x === 129736 || x >= 129741 && x <= 129756 || x >= 129759 && x <= 129770 || x >= 129775 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region node_modules/get-east-asian-width/index.js
|
|
14
|
+
function validate(codePoint) {
|
|
15
|
+
if (!Number.isSafeInteger(codePoint)) throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
16
|
+
}
|
|
17
|
+
function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
|
|
18
|
+
validate(codePoint);
|
|
19
|
+
if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) return 2;
|
|
20
|
+
return 1;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { isFullWidth as n, isWide as r, eastAsianWidth as t };
|
package/dist/index.mjs
CHANGED
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
import { t as wrapAnsi } from "./wrap-ansi-BLh1Umdy.mjs";
|
|
2
|
+
import { t as sliceAnsi } from "./slice-ansi-BXJtqwp2.mjs";
|
|
3
|
+
import process$1 from "node:process";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
|
|
6
|
+
//#region node_modules/environment/index.js
|
|
7
|
+
const isBrowser = globalThis.window?.document !== void 0;
|
|
8
|
+
const isNode = globalThis.process?.versions?.node !== void 0;
|
|
9
|
+
const isBun = globalThis.process?.versions?.bun !== void 0;
|
|
10
|
+
const isDeno = globalThis.Deno?.version?.deno !== void 0;
|
|
11
|
+
const isElectron = globalThis.process?.versions?.electron !== void 0;
|
|
12
|
+
const isJsDom = globalThis.navigator?.userAgent?.includes("jsdom") === true;
|
|
13
|
+
const isWebWorker = typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
|
|
14
|
+
const isDedicatedWorker = typeof DedicatedWorkerGlobalScope !== "undefined" && globalThis instanceof DedicatedWorkerGlobalScope;
|
|
15
|
+
const isSharedWorker = typeof SharedWorkerGlobalScope !== "undefined" && globalThis instanceof SharedWorkerGlobalScope;
|
|
16
|
+
const isServiceWorker = typeof ServiceWorkerGlobalScope !== "undefined" && globalThis instanceof ServiceWorkerGlobalScope;
|
|
17
|
+
const platform = globalThis.navigator?.userAgentData?.platform;
|
|
18
|
+
const isMacOs = platform === "macOS" || globalThis.navigator?.platform === "MacIntel" || globalThis.navigator?.userAgent?.includes(" Mac ") === true || globalThis.process?.platform === "darwin";
|
|
19
|
+
const isWindows$1 = platform === "Windows" || globalThis.navigator?.platform === "Win32" || globalThis.process?.platform === "win32";
|
|
20
|
+
const isLinux = platform === "Linux" || globalThis.navigator?.platform?.startsWith("Linux") === true || globalThis.navigator?.userAgent?.includes(" Linux ") === true || globalThis.process?.platform === "linux";
|
|
21
|
+
const isIos = platform === "iOS" || globalThis.navigator?.platform === "MacIntel" && globalThis.navigator?.maxTouchPoints > 1 || /iPad|iPhone|iPod/.test(globalThis.navigator?.platform);
|
|
22
|
+
const isAndroid = platform === "Android" || globalThis.navigator?.platform === "Android" || globalThis.navigator?.userAgent?.includes(" Android ") === true || globalThis.process?.platform === "android";
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region node_modules/log-update/node_modules/ansi-escapes/base.js
|
|
26
|
+
const ESC = "\x1B[";
|
|
27
|
+
const isTerminalApp = !isBrowser && process$1.env.TERM_PROGRAM === "Apple_Terminal";
|
|
28
|
+
const isWindows = !isBrowser && process$1.platform === "win32";
|
|
29
|
+
const isTmux = !isBrowser && (process$1.env.TERM?.startsWith("screen") || process$1.env.TERM?.startsWith("tmux") || process$1.env.TMUX !== void 0);
|
|
30
|
+
const cwdFunction = isBrowser ? () => {
|
|
31
|
+
throw new Error("`process.cwd()` only works in Node.js, not the browser.");
|
|
32
|
+
} : process$1.cwd;
|
|
33
|
+
const cursorUp = (count = 1) => ESC + count + "A";
|
|
34
|
+
const cursorLeft = ESC + "G";
|
|
35
|
+
const cursorSavePosition = isTerminalApp ? "\x1B7" : ESC + "s";
|
|
36
|
+
const cursorRestorePosition = isTerminalApp ? "\x1B8" : ESC + "u";
|
|
37
|
+
const cursorGetPosition = ESC + "6n";
|
|
38
|
+
const cursorNextLine = ESC + "E";
|
|
39
|
+
const cursorPrevLine = ESC + "F";
|
|
40
|
+
const cursorHide = ESC + "?25l";
|
|
41
|
+
const cursorShow = ESC + "?25h";
|
|
42
|
+
const eraseLines = (count) => {
|
|
43
|
+
let clear = "";
|
|
44
|
+
for (let i = 0; i < count; i++) clear += eraseLine + (i < count - 1 ? cursorUp() : "");
|
|
45
|
+
if (count) clear += cursorLeft;
|
|
46
|
+
return clear;
|
|
47
|
+
};
|
|
48
|
+
const eraseEndLine = ESC + "K";
|
|
49
|
+
const eraseStartLine = ESC + "1K";
|
|
50
|
+
const eraseLine = ESC + "2K";
|
|
51
|
+
const eraseDown = ESC + "J";
|
|
52
|
+
const eraseUp = ESC + "1J";
|
|
53
|
+
const eraseScreen = ESC + "2J";
|
|
54
|
+
const scrollUp = ESC + "S";
|
|
55
|
+
const scrollDown = ESC + "T";
|
|
56
|
+
const clearViewport = `${eraseScreen}${ESC}H`;
|
|
57
|
+
const isOldWindows = () => {
|
|
58
|
+
if (isBrowser || !isWindows) return false;
|
|
59
|
+
const parts = os.release().split(".");
|
|
60
|
+
const major = Number(parts[0]);
|
|
61
|
+
const build = Number(parts[2] ?? 0);
|
|
62
|
+
if (major < 10) return true;
|
|
63
|
+
if (major === 10 && build < 10586) return true;
|
|
64
|
+
return false;
|
|
65
|
+
};
|
|
66
|
+
const clearTerminal = isOldWindows() ? `${eraseScreen}${ESC}0f` : `${eraseScreen}${ESC}3J${ESC}H`;
|
|
67
|
+
const enterAlternativeScreen = ESC + "?1049h";
|
|
68
|
+
const exitAlternativeScreen = ESC + "?1049l";
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region node_modules/mimic-function/index.js
|
|
72
|
+
const copyProperty = (to, from, property, ignoreNonConfigurable) => {
|
|
73
|
+
if (property === "length" || property === "prototype") return;
|
|
74
|
+
if (property === "arguments" || property === "caller") return;
|
|
75
|
+
const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
|
|
76
|
+
const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
|
|
77
|
+
if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) return;
|
|
78
|
+
Object.defineProperty(to, property, fromDescriptor);
|
|
79
|
+
};
|
|
80
|
+
const canCopyProperty = function(toDescriptor, fromDescriptor) {
|
|
81
|
+
return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
|
|
82
|
+
};
|
|
83
|
+
const changePrototype = (to, from) => {
|
|
84
|
+
const fromPrototype = Object.getPrototypeOf(from);
|
|
85
|
+
if (fromPrototype === Object.getPrototypeOf(to)) return;
|
|
86
|
+
Object.setPrototypeOf(to, fromPrototype);
|
|
87
|
+
};
|
|
88
|
+
const wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/\n${fromBody}`;
|
|
89
|
+
const toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
|
|
90
|
+
const toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
|
|
91
|
+
const changeToString = (to, from, name) => {
|
|
92
|
+
const withName = name === "" ? "" : `with ${name.trim()}() `;
|
|
93
|
+
const newToString = wrappedToString.bind(null, withName, from.toString());
|
|
94
|
+
Object.defineProperty(newToString, "name", toStringName);
|
|
95
|
+
const { writable, enumerable, configurable } = toStringDescriptor;
|
|
96
|
+
Object.defineProperty(to, "toString", {
|
|
97
|
+
value: newToString,
|
|
98
|
+
writable,
|
|
99
|
+
enumerable,
|
|
100
|
+
configurable
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
|
|
104
|
+
const { name } = to;
|
|
105
|
+
for (const property of Reflect.ownKeys(from)) copyProperty(to, from, property, ignoreNonConfigurable);
|
|
106
|
+
changePrototype(to, from);
|
|
107
|
+
changeToString(to, from, name);
|
|
108
|
+
return to;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region node_modules/restore-cursor/node_modules/onetime/index.js
|
|
113
|
+
const calledFunctions = /* @__PURE__ */ new WeakMap();
|
|
114
|
+
const onetime = (function_, options = {}) => {
|
|
115
|
+
if (typeof function_ !== "function") throw new TypeError("Expected a function");
|
|
116
|
+
let returnValue;
|
|
117
|
+
let callCount = 0;
|
|
118
|
+
const functionName = function_.displayName || function_.name || "<anonymous>";
|
|
119
|
+
const onetime$1 = function(...arguments_) {
|
|
120
|
+
calledFunctions.set(onetime$1, ++callCount);
|
|
121
|
+
if (callCount === 1) {
|
|
122
|
+
returnValue = function_.apply(this, arguments_);
|
|
123
|
+
function_ = void 0;
|
|
124
|
+
} else if (options.throw === true) throw new Error(`Function \`${functionName}\` can only be called once`);
|
|
125
|
+
return returnValue;
|
|
126
|
+
};
|
|
127
|
+
mimicFunction(onetime$1, function_);
|
|
128
|
+
calledFunctions.set(onetime$1, callCount);
|
|
129
|
+
return onetime$1;
|
|
130
|
+
};
|
|
131
|
+
onetime.callCount = (function_) => {
|
|
132
|
+
if (!calledFunctions.has(function_)) throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
|
|
133
|
+
return calledFunctions.get(function_);
|
|
134
|
+
};
|
|
135
|
+
var onetime_default = onetime;
|
|
136
|
+
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region node_modules/restore-cursor/node_modules/signal-exit/dist/mjs/signals.js
|
|
139
|
+
/**
|
|
140
|
+
* This is not the set of all possible signals.
|
|
141
|
+
*
|
|
142
|
+
* It IS, however, the set of all signals that trigger
|
|
143
|
+
* an exit on either Linux or BSD systems. Linux is a
|
|
144
|
+
* superset of the signal names supported on BSD, and
|
|
145
|
+
* the unknown signals just fail to register, so we can
|
|
146
|
+
* catch that easily enough.
|
|
147
|
+
*
|
|
148
|
+
* Windows signals are a different set, since there are
|
|
149
|
+
* signals that terminate Windows processes, but don't
|
|
150
|
+
* terminate (or don't even exist) on Posix systems.
|
|
151
|
+
*
|
|
152
|
+
* Don't bother with SIGKILL. It's uncatchable, which
|
|
153
|
+
* means that we can't fire any callbacks anyway.
|
|
154
|
+
*
|
|
155
|
+
* If a user does happen to register a handler on a non-
|
|
156
|
+
* fatal signal like SIGWINCH or something, and then
|
|
157
|
+
* exit, it'll end up firing `process.emit('exit')`, so
|
|
158
|
+
* the handler will be fired anyway.
|
|
159
|
+
*
|
|
160
|
+
* SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
|
|
161
|
+
* artificially, inherently leave the process in a
|
|
162
|
+
* state from which it is not safe to try and enter JS
|
|
163
|
+
* listeners.
|
|
164
|
+
*/
|
|
165
|
+
const signals = [];
|
|
166
|
+
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
167
|
+
if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
168
|
+
if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
169
|
+
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region node_modules/restore-cursor/node_modules/signal-exit/dist/mjs/index.js
|
|
172
|
+
const processOk = (process$3) => !!process$3 && typeof process$3 === "object" && typeof process$3.removeListener === "function" && typeof process$3.emit === "function" && typeof process$3.reallyExit === "function" && typeof process$3.listeners === "function" && typeof process$3.kill === "function" && typeof process$3.pid === "number" && typeof process$3.on === "function";
|
|
173
|
+
const kExitEmitter = Symbol.for("signal-exit emitter");
|
|
174
|
+
const global = globalThis;
|
|
175
|
+
const ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
176
|
+
var Emitter = class {
|
|
177
|
+
emitted = {
|
|
178
|
+
afterExit: false,
|
|
179
|
+
exit: false
|
|
180
|
+
};
|
|
181
|
+
listeners = {
|
|
182
|
+
afterExit: [],
|
|
183
|
+
exit: []
|
|
184
|
+
};
|
|
185
|
+
count = 0;
|
|
186
|
+
id = Math.random();
|
|
187
|
+
constructor() {
|
|
188
|
+
if (global[kExitEmitter]) return global[kExitEmitter];
|
|
189
|
+
ObjectDefineProperty(global, kExitEmitter, {
|
|
190
|
+
value: this,
|
|
191
|
+
writable: false,
|
|
192
|
+
enumerable: false,
|
|
193
|
+
configurable: false
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
on(ev, fn) {
|
|
197
|
+
this.listeners[ev].push(fn);
|
|
198
|
+
}
|
|
199
|
+
removeListener(ev, fn) {
|
|
200
|
+
const list = this.listeners[ev];
|
|
201
|
+
const i = list.indexOf(fn);
|
|
202
|
+
/* c8 ignore start */
|
|
203
|
+
if (i === -1) return;
|
|
204
|
+
/* c8 ignore stop */
|
|
205
|
+
if (i === 0 && list.length === 1) list.length = 0;
|
|
206
|
+
else list.splice(i, 1);
|
|
207
|
+
}
|
|
208
|
+
emit(ev, code, signal) {
|
|
209
|
+
if (this.emitted[ev]) return false;
|
|
210
|
+
this.emitted[ev] = true;
|
|
211
|
+
let ret = false;
|
|
212
|
+
for (const fn of this.listeners[ev]) ret = fn(code, signal) === true || ret;
|
|
213
|
+
if (ev === "exit") ret = this.emit("afterExit", code, signal) || ret;
|
|
214
|
+
return ret;
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
var SignalExitBase = class {};
|
|
218
|
+
const signalExitWrap = (handler) => {
|
|
219
|
+
return {
|
|
220
|
+
onExit(cb, opts) {
|
|
221
|
+
return handler.onExit(cb, opts);
|
|
222
|
+
},
|
|
223
|
+
load() {
|
|
224
|
+
return handler.load();
|
|
225
|
+
},
|
|
226
|
+
unload() {
|
|
227
|
+
return handler.unload();
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
var SignalExitFallback = class extends SignalExitBase {
|
|
232
|
+
onExit() {
|
|
233
|
+
return () => {};
|
|
234
|
+
}
|
|
235
|
+
load() {}
|
|
236
|
+
unload() {}
|
|
237
|
+
};
|
|
238
|
+
var SignalExit = class extends SignalExitBase {
|
|
239
|
+
/* c8 ignore start */
|
|
240
|
+
#hupSig = process$2.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
241
|
+
/* c8 ignore stop */
|
|
242
|
+
#emitter = new Emitter();
|
|
243
|
+
#process;
|
|
244
|
+
#originalProcessEmit;
|
|
245
|
+
#originalProcessReallyExit;
|
|
246
|
+
#sigListeners = {};
|
|
247
|
+
#loaded = false;
|
|
248
|
+
constructor(process$3) {
|
|
249
|
+
super();
|
|
250
|
+
this.#process = process$3;
|
|
251
|
+
this.#sigListeners = {};
|
|
252
|
+
for (const sig of signals) this.#sigListeners[sig] = () => {
|
|
253
|
+
const listeners = this.#process.listeners(sig);
|
|
254
|
+
let { count } = this.#emitter;
|
|
255
|
+
/* c8 ignore start */
|
|
256
|
+
const p = process$3;
|
|
257
|
+
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") count += p.__signal_exit_emitter__.count;
|
|
258
|
+
/* c8 ignore stop */
|
|
259
|
+
if (listeners.length === count) {
|
|
260
|
+
this.unload();
|
|
261
|
+
const ret = this.#emitter.emit("exit", null, sig);
|
|
262
|
+
/* c8 ignore start */
|
|
263
|
+
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
264
|
+
if (!ret) process$3.kill(process$3.pid, s);
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
this.#originalProcessReallyExit = process$3.reallyExit;
|
|
268
|
+
this.#originalProcessEmit = process$3.emit;
|
|
269
|
+
}
|
|
270
|
+
onExit(cb, opts) {
|
|
271
|
+
/* c8 ignore start */
|
|
272
|
+
if (!processOk(this.#process)) return () => {};
|
|
273
|
+
/* c8 ignore stop */
|
|
274
|
+
if (this.#loaded === false) this.load();
|
|
275
|
+
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
276
|
+
this.#emitter.on(ev, cb);
|
|
277
|
+
return () => {
|
|
278
|
+
this.#emitter.removeListener(ev, cb);
|
|
279
|
+
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) this.unload();
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
load() {
|
|
283
|
+
if (this.#loaded) return;
|
|
284
|
+
this.#loaded = true;
|
|
285
|
+
this.#emitter.count += 1;
|
|
286
|
+
for (const sig of signals) try {
|
|
287
|
+
const fn = this.#sigListeners[sig];
|
|
288
|
+
if (fn) this.#process.on(sig, fn);
|
|
289
|
+
} catch (_) {}
|
|
290
|
+
this.#process.emit = (ev, ...a) => {
|
|
291
|
+
return this.#processEmit(ev, ...a);
|
|
292
|
+
};
|
|
293
|
+
this.#process.reallyExit = (code) => {
|
|
294
|
+
return this.#processReallyExit(code);
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
unload() {
|
|
298
|
+
if (!this.#loaded) return;
|
|
299
|
+
this.#loaded = false;
|
|
300
|
+
signals.forEach((sig) => {
|
|
301
|
+
const listener = this.#sigListeners[sig];
|
|
302
|
+
/* c8 ignore start */
|
|
303
|
+
if (!listener) throw new Error("Listener not defined for signal: " + sig);
|
|
304
|
+
/* c8 ignore stop */
|
|
305
|
+
try {
|
|
306
|
+
this.#process.removeListener(sig, listener);
|
|
307
|
+
} catch (_) {}
|
|
308
|
+
/* c8 ignore stop */
|
|
309
|
+
});
|
|
310
|
+
this.#process.emit = this.#originalProcessEmit;
|
|
311
|
+
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
312
|
+
this.#emitter.count -= 1;
|
|
313
|
+
}
|
|
314
|
+
#processReallyExit(code) {
|
|
315
|
+
/* c8 ignore start */
|
|
316
|
+
if (!processOk(this.#process)) return 0;
|
|
317
|
+
this.#process.exitCode = code || 0;
|
|
318
|
+
/* c8 ignore stop */
|
|
319
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
320
|
+
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
321
|
+
}
|
|
322
|
+
#processEmit(ev, ...args) {
|
|
323
|
+
const og = this.#originalProcessEmit;
|
|
324
|
+
if (ev === "exit" && processOk(this.#process)) {
|
|
325
|
+
if (typeof args[0] === "number") this.#process.exitCode = args[0];
|
|
326
|
+
/* c8 ignore start */
|
|
327
|
+
const ret = og.call(this.#process, ev, ...args);
|
|
328
|
+
/* c8 ignore start */
|
|
329
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
330
|
+
/* c8 ignore stop */
|
|
331
|
+
return ret;
|
|
332
|
+
} else return og.call(this.#process, ev, ...args);
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
const process$2 = globalThis.process;
|
|
336
|
+
const { onExit, load, unload } = signalExitWrap(processOk(process$2) ? new SignalExit(process$2) : new SignalExitFallback());
|
|
337
|
+
|
|
338
|
+
//#endregion
|
|
339
|
+
//#region node_modules/restore-cursor/index.js
|
|
340
|
+
const terminal = process$1.stderr.isTTY ? process$1.stderr : process$1.stdout.isTTY ? process$1.stdout : void 0;
|
|
341
|
+
const restoreCursor = terminal ? onetime_default(() => {
|
|
342
|
+
onExit(() => {
|
|
343
|
+
terminal.write("\x1B[?25h");
|
|
344
|
+
}, { alwaysLast: true });
|
|
345
|
+
}) : () => {};
|
|
346
|
+
var restore_cursor_default = restoreCursor;
|
|
347
|
+
|
|
348
|
+
//#endregion
|
|
349
|
+
//#region node_modules/cli-cursor/index.js
|
|
350
|
+
let isHidden = false;
|
|
351
|
+
const cliCursor = {};
|
|
352
|
+
cliCursor.show = (writableStream = process$1.stderr) => {
|
|
353
|
+
if (!writableStream.isTTY) return;
|
|
354
|
+
isHidden = false;
|
|
355
|
+
writableStream.write("\x1B[?25h");
|
|
356
|
+
};
|
|
357
|
+
cliCursor.hide = (writableStream = process$1.stderr) => {
|
|
358
|
+
if (!writableStream.isTTY) return;
|
|
359
|
+
restore_cursor_default();
|
|
360
|
+
isHidden = true;
|
|
361
|
+
writableStream.write("\x1B[?25l");
|
|
362
|
+
};
|
|
363
|
+
cliCursor.toggle = (force, writableStream) => {
|
|
364
|
+
if (force !== void 0) isHidden = force;
|
|
365
|
+
if (isHidden) cliCursor.show(writableStream);
|
|
366
|
+
else cliCursor.hide(writableStream);
|
|
367
|
+
};
|
|
368
|
+
var cli_cursor_default = cliCursor;
|
|
369
|
+
|
|
370
|
+
//#endregion
|
|
371
|
+
//#region node_modules/log-update/node_modules/strip-ansi/node_modules/ansi-regex/index.js
|
|
372
|
+
function ansiRegex({ onlyFirst = false } = {}) {
|
|
373
|
+
return new RegExp(`(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`, onlyFirst ? void 0 : "g");
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
//#endregion
|
|
377
|
+
//#region node_modules/log-update/node_modules/strip-ansi/index.js
|
|
378
|
+
const regex = ansiRegex();
|
|
379
|
+
function stripAnsi(string) {
|
|
380
|
+
if (typeof string !== "string") throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
381
|
+
return string.replace(regex, "");
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
//#endregion
|
|
385
|
+
//#region node_modules/log-update/index.js
|
|
386
|
+
const defaultTerminalHeight = 24;
|
|
387
|
+
const getWidth = ({ columns = 80 }) => columns;
|
|
388
|
+
const fitToTerminalHeight = (stream, text) => {
|
|
389
|
+
const terminalHeight = stream.rows ?? defaultTerminalHeight;
|
|
390
|
+
const lines = text.split("\n");
|
|
391
|
+
const toRemove = Math.max(0, lines.length - terminalHeight);
|
|
392
|
+
return toRemove ? sliceAnsi(text, stripAnsi(lines.slice(0, toRemove).join("\n")).length + 1) : text;
|
|
393
|
+
};
|
|
394
|
+
function createLogUpdate(stream, { showCursor = false } = {}) {
|
|
395
|
+
let previousLineCount = 0;
|
|
396
|
+
let previousWidth = getWidth(stream);
|
|
397
|
+
let previousOutput = "";
|
|
398
|
+
const reset = () => {
|
|
399
|
+
previousOutput = "";
|
|
400
|
+
previousWidth = getWidth(stream);
|
|
401
|
+
previousLineCount = 0;
|
|
402
|
+
};
|
|
403
|
+
const render = (...arguments_) => {
|
|
404
|
+
if (!showCursor) cli_cursor_default.hide();
|
|
405
|
+
let output = fitToTerminalHeight(stream, arguments_.join(" ") + "\n");
|
|
406
|
+
const width = getWidth(stream);
|
|
407
|
+
if (output === previousOutput && previousWidth === width) return;
|
|
408
|
+
previousOutput = output;
|
|
409
|
+
previousWidth = width;
|
|
410
|
+
output = wrapAnsi(output, width, {
|
|
411
|
+
trim: false,
|
|
412
|
+
hard: true,
|
|
413
|
+
wordWrap: false
|
|
414
|
+
});
|
|
415
|
+
stream.write(eraseLines(previousLineCount) + output);
|
|
416
|
+
previousLineCount = output.split("\n").length;
|
|
417
|
+
};
|
|
418
|
+
render.clear = () => {
|
|
419
|
+
stream.write(eraseLines(previousLineCount));
|
|
420
|
+
reset();
|
|
421
|
+
};
|
|
422
|
+
render.done = () => {
|
|
423
|
+
reset();
|
|
424
|
+
if (!showCursor) cli_cursor_default.show();
|
|
425
|
+
};
|
|
426
|
+
return render;
|
|
427
|
+
}
|
|
428
|
+
const logUpdate = createLogUpdate(process$1.stdout);
|
|
429
|
+
const logUpdateStderr = createLogUpdate(process$1.stderr);
|
|
430
|
+
|
|
431
|
+
//#endregion
|
|
432
|
+
export { createLogUpdate };
|