dnscmp 0.0.6 → 0.1.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/dist/index.js +1766 -17
- package/package.json +11 -4
package/dist/index.js
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
3
5
|
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
function __accessProp(key) {
|
|
9
|
+
return this[key];
|
|
10
|
+
}
|
|
11
|
+
var __toESMCache_node;
|
|
12
|
+
var __toESMCache_esm;
|
|
13
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
14
|
+
var canCache = mod != null && typeof mod === "object";
|
|
15
|
+
if (canCache) {
|
|
16
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
17
|
+
var cached = cache.get(mod);
|
|
18
|
+
if (cached)
|
|
19
|
+
return cached;
|
|
20
|
+
}
|
|
21
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
22
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
23
|
+
for (let key of __getOwnPropNames(mod))
|
|
24
|
+
if (!__hasOwnProp.call(to, key))
|
|
25
|
+
__defProp(to, key, {
|
|
26
|
+
get: __accessProp.bind(mod, key),
|
|
27
|
+
enumerable: true
|
|
28
|
+
});
|
|
29
|
+
if (canCache)
|
|
30
|
+
cache.set(mod, to);
|
|
31
|
+
return to;
|
|
32
|
+
};
|
|
33
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
4
34
|
var __returnValue = (v) => v;
|
|
5
35
|
function __exportSetter(name, newValue) {
|
|
6
36
|
this[name] = __returnValue.bind(null, newValue);
|
|
@@ -17,6 +47,13 @@ var __export = (target, all) => {
|
|
|
17
47
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
18
48
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
19
49
|
|
|
50
|
+
// ../../node_modules/.bun/emoji-regex@10.6.0/node_modules/emoji-regex/index.js
|
|
51
|
+
var require_emoji_regex = __commonJS((exports, module) => {
|
|
52
|
+
module.exports = () => {
|
|
53
|
+
return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\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?|[\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](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\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-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
|
|
20
57
|
// src/parse-file.ts
|
|
21
58
|
var exports_parse_file = {};
|
|
22
59
|
__export(exports_parse_file, {
|
|
@@ -47,17 +84,272 @@ var init_parse_file = () => {};
|
|
|
47
84
|
// src/index.ts
|
|
48
85
|
import { dnscmp } from "@dnscmp/core";
|
|
49
86
|
import { parseArgs } from "node:util";
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
87
|
+
|
|
88
|
+
// ../../node_modules/.bun/supports-color@10.2.2/node_modules/supports-color/index.js
|
|
89
|
+
import process2 from "node:process";
|
|
90
|
+
import os from "node:os";
|
|
91
|
+
import tty from "node:tty";
|
|
92
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
|
|
93
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
94
|
+
const position = argv.indexOf(prefix + flag);
|
|
95
|
+
const terminatorPosition = argv.indexOf("--");
|
|
96
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
97
|
+
}
|
|
98
|
+
var { env } = process2;
|
|
99
|
+
var flagForceColor;
|
|
100
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
101
|
+
flagForceColor = 0;
|
|
102
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
103
|
+
flagForceColor = 1;
|
|
104
|
+
}
|
|
105
|
+
function envForceColor() {
|
|
106
|
+
if (!("FORCE_COLOR" in env)) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (env.FORCE_COLOR === "true") {
|
|
110
|
+
return 1;
|
|
111
|
+
}
|
|
112
|
+
if (env.FORCE_COLOR === "false") {
|
|
113
|
+
return 0;
|
|
114
|
+
}
|
|
115
|
+
if (env.FORCE_COLOR.length === 0) {
|
|
116
|
+
return 1;
|
|
117
|
+
}
|
|
118
|
+
const level = Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
119
|
+
if (![0, 1, 2, 3].includes(level)) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
return level;
|
|
123
|
+
}
|
|
124
|
+
function translateLevel(level) {
|
|
125
|
+
if (level === 0) {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
level,
|
|
130
|
+
hasBasic: true,
|
|
131
|
+
has256: level >= 2,
|
|
132
|
+
has16m: level >= 3
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
136
|
+
const noFlagForceColor = envForceColor();
|
|
137
|
+
if (noFlagForceColor !== undefined) {
|
|
138
|
+
flagForceColor = noFlagForceColor;
|
|
139
|
+
}
|
|
140
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
141
|
+
if (forceColor === 0) {
|
|
142
|
+
return 0;
|
|
143
|
+
}
|
|
144
|
+
if (sniffFlags) {
|
|
145
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
146
|
+
return 3;
|
|
147
|
+
}
|
|
148
|
+
if (hasFlag("color=256")) {
|
|
149
|
+
return 2;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
|
153
|
+
return 1;
|
|
154
|
+
}
|
|
155
|
+
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
156
|
+
return 0;
|
|
157
|
+
}
|
|
158
|
+
const min = forceColor || 0;
|
|
159
|
+
if (env.TERM === "dumb") {
|
|
160
|
+
return min;
|
|
161
|
+
}
|
|
162
|
+
if (process2.platform === "win32") {
|
|
163
|
+
const osRelease = os.release().split(".");
|
|
164
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
165
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
166
|
+
}
|
|
167
|
+
return 1;
|
|
168
|
+
}
|
|
169
|
+
if ("CI" in env) {
|
|
170
|
+
if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => (key in env))) {
|
|
171
|
+
return 3;
|
|
172
|
+
}
|
|
173
|
+
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => (sign in env)) || env.CI_NAME === "codeship") {
|
|
174
|
+
return 1;
|
|
175
|
+
}
|
|
176
|
+
return min;
|
|
177
|
+
}
|
|
178
|
+
if ("TEAMCITY_VERSION" in env) {
|
|
179
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
180
|
+
}
|
|
181
|
+
if (env.COLORTERM === "truecolor") {
|
|
182
|
+
return 3;
|
|
183
|
+
}
|
|
184
|
+
if (env.TERM === "xterm-kitty") {
|
|
185
|
+
return 3;
|
|
186
|
+
}
|
|
187
|
+
if (env.TERM === "xterm-ghostty") {
|
|
188
|
+
return 3;
|
|
189
|
+
}
|
|
190
|
+
if (env.TERM === "wezterm") {
|
|
191
|
+
return 3;
|
|
192
|
+
}
|
|
193
|
+
if ("TERM_PROGRAM" in env) {
|
|
194
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
195
|
+
switch (env.TERM_PROGRAM) {
|
|
196
|
+
case "iTerm.app": {
|
|
197
|
+
return version >= 3 ? 3 : 2;
|
|
198
|
+
}
|
|
199
|
+
case "Apple_Terminal": {
|
|
200
|
+
return 2;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
205
|
+
return 2;
|
|
206
|
+
}
|
|
207
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
208
|
+
return 1;
|
|
209
|
+
}
|
|
210
|
+
if ("COLORTERM" in env) {
|
|
211
|
+
return 1;
|
|
212
|
+
}
|
|
213
|
+
return min;
|
|
214
|
+
}
|
|
215
|
+
function createSupportsColor(stream, options = {}) {
|
|
216
|
+
const level = _supportsColor(stream, {
|
|
217
|
+
streamIsTTY: stream && stream.isTTY,
|
|
218
|
+
...options
|
|
219
|
+
});
|
|
220
|
+
return translateLevel(level);
|
|
221
|
+
}
|
|
222
|
+
var supportsColor = {
|
|
223
|
+
stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
|
|
224
|
+
stderr: createSupportsColor({ isTTY: tty.isatty(2) })
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
// ../../node_modules/.bun/supports-hyperlinks@4.4.0/node_modules/supports-hyperlinks/index.js
|
|
228
|
+
import process4 from "node:process";
|
|
229
|
+
|
|
230
|
+
// ../../node_modules/.bun/has-flag@5.0.1/node_modules/has-flag/index.js
|
|
231
|
+
import process3 from "process";
|
|
232
|
+
function hasFlag2(flag, argv = process3.argv) {
|
|
233
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
234
|
+
const position = argv.indexOf(prefix + flag);
|
|
235
|
+
const terminatorPosition = argv.indexOf("--");
|
|
236
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// ../../node_modules/.bun/supports-hyperlinks@4.4.0/node_modules/supports-hyperlinks/index.js
|
|
240
|
+
function parseVersion(versionString = "") {
|
|
241
|
+
if (/^\d{3,4}$/.test(versionString)) {
|
|
242
|
+
const match = /(\d{1,2})(\d{2})/.exec(versionString) ?? [];
|
|
243
|
+
return {
|
|
244
|
+
major: 0,
|
|
245
|
+
minor: Number.parseInt(match[1], 10),
|
|
246
|
+
patch: Number.parseInt(match[2], 10)
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
const versions = (versionString ?? "").split(".").map((n) => Number.parseInt(n, 10));
|
|
250
|
+
return {
|
|
251
|
+
major: versions[0],
|
|
252
|
+
minor: versions[1],
|
|
253
|
+
patch: versions[2]
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
function createSupportsHyperlinks(stream) {
|
|
257
|
+
const {
|
|
258
|
+
CI,
|
|
259
|
+
CURSOR_TRACE_ID,
|
|
260
|
+
FORCE_HYPERLINK,
|
|
261
|
+
NETLIFY,
|
|
262
|
+
TEAMCITY_VERSION,
|
|
263
|
+
TERM_PROGRAM,
|
|
264
|
+
TERM_PROGRAM_VERSION,
|
|
265
|
+
VTE_VERSION,
|
|
266
|
+
TERM
|
|
267
|
+
} = process4.env;
|
|
268
|
+
if (FORCE_HYPERLINK) {
|
|
269
|
+
return !(FORCE_HYPERLINK.length > 0 && Number.parseInt(FORCE_HYPERLINK, 10) === 0);
|
|
270
|
+
}
|
|
271
|
+
if (hasFlag2("no-hyperlink") || hasFlag2("no-hyperlinks") || hasFlag2("hyperlink=false") || hasFlag2("hyperlink=never")) {
|
|
272
|
+
return false;
|
|
273
|
+
}
|
|
274
|
+
if (hasFlag2("hyperlink=true") || hasFlag2("hyperlink=always")) {
|
|
275
|
+
return true;
|
|
276
|
+
}
|
|
277
|
+
if (NETLIFY) {
|
|
278
|
+
return true;
|
|
279
|
+
}
|
|
280
|
+
if (!createSupportsColor(stream)) {
|
|
281
|
+
return false;
|
|
282
|
+
}
|
|
283
|
+
if (stream && !stream.isTTY) {
|
|
284
|
+
return false;
|
|
285
|
+
}
|
|
286
|
+
if ("WT_SESSION" in process4.env) {
|
|
287
|
+
return true;
|
|
288
|
+
}
|
|
289
|
+
if (process4.platform === "win32") {
|
|
290
|
+
return false;
|
|
291
|
+
}
|
|
292
|
+
if (CI) {
|
|
293
|
+
return false;
|
|
294
|
+
}
|
|
295
|
+
if (TEAMCITY_VERSION) {
|
|
296
|
+
return false;
|
|
297
|
+
}
|
|
298
|
+
if (TERM_PROGRAM) {
|
|
299
|
+
const version = parseVersion(TERM_PROGRAM_VERSION);
|
|
300
|
+
switch (TERM_PROGRAM) {
|
|
301
|
+
case "iTerm.app": {
|
|
302
|
+
if (version.major === 3) {
|
|
303
|
+
return version.minor >= 1;
|
|
304
|
+
}
|
|
305
|
+
return version.major > 3;
|
|
306
|
+
}
|
|
307
|
+
case "WezTerm": {
|
|
308
|
+
if (/^0-unstable-\d{4}-\d{2}-\d{2}$/.test(TERM_PROGRAM_VERSION)) {
|
|
309
|
+
const date = TERM_PROGRAM_VERSION.slice("0-unstable-".length);
|
|
310
|
+
return date >= "2020-06-20";
|
|
311
|
+
}
|
|
312
|
+
return version.major >= 20200620;
|
|
313
|
+
}
|
|
314
|
+
case "vscode": {
|
|
315
|
+
if (CURSOR_TRACE_ID) {
|
|
316
|
+
return true;
|
|
317
|
+
}
|
|
318
|
+
return version.major > 1 || version.major === 1 && version.minor >= 72;
|
|
319
|
+
}
|
|
320
|
+
case "ghostty": {
|
|
321
|
+
return true;
|
|
322
|
+
}
|
|
323
|
+
case "zed": {
|
|
324
|
+
return true;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
if (VTE_VERSION) {
|
|
329
|
+
if (VTE_VERSION === "0.50.0") {
|
|
330
|
+
return false;
|
|
331
|
+
}
|
|
332
|
+
const version = parseVersion(VTE_VERSION);
|
|
333
|
+
return version.major > 0 || version.minor >= 50;
|
|
334
|
+
}
|
|
335
|
+
switch (TERM) {
|
|
336
|
+
case "alacritty": {
|
|
337
|
+
return true;
|
|
338
|
+
}
|
|
339
|
+
case "xterm-kitty": {
|
|
340
|
+
return true;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
return false;
|
|
344
|
+
}
|
|
345
|
+
var supportsHyperlinks = {
|
|
346
|
+
stdout: createSupportsHyperlinks(process4.stdout),
|
|
347
|
+
stderr: createSupportsHyperlinks(process4.stderr)
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
// src/help.ts
|
|
351
|
+
function printHelp(out) {
|
|
352
|
+
out.stream.write([
|
|
61
353
|
"Usage: dnscmp [options] [resolver...]",
|
|
62
354
|
"",
|
|
63
355
|
" dnscmp Test default providers",
|
|
@@ -72,8 +364,1457 @@ if (values.help) {
|
|
|
72
364
|
""
|
|
73
365
|
].join(`
|
|
74
366
|
`));
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// src/is-owned-console.ts
|
|
370
|
+
import { dlopen, FFIType, ptr } from "bun:ffi";
|
|
371
|
+
function isOwnedConsole() {
|
|
372
|
+
if (process.platform !== "win32")
|
|
373
|
+
return false;
|
|
374
|
+
try {
|
|
375
|
+
const { symbols } = dlopen("kernel32.dll", {
|
|
376
|
+
GetConsoleProcessList: {
|
|
377
|
+
args: [FFIType.ptr, FFIType.u32],
|
|
378
|
+
returns: FFIType.u32
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
const buf = new Uint32Array(64);
|
|
382
|
+
const count = symbols.GetConsoleProcessList(ptr(buf), 64);
|
|
383
|
+
return count === 1;
|
|
384
|
+
} catch {
|
|
385
|
+
return false;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// ../../node_modules/.bun/log-update@6.1.0/node_modules/log-update/index.js
|
|
390
|
+
import process9 from "node:process";
|
|
391
|
+
|
|
392
|
+
// ../../node_modules/.bun/ansi-escapes@7.3.0/node_modules/ansi-escapes/base.js
|
|
393
|
+
var exports_base = {};
|
|
394
|
+
__export(exports_base, {
|
|
395
|
+
synchronizedOutput: () => synchronizedOutput,
|
|
396
|
+
setCwd: () => setCwd,
|
|
397
|
+
scrollUp: () => scrollUp,
|
|
398
|
+
scrollDown: () => scrollDown,
|
|
399
|
+
link: () => link,
|
|
400
|
+
image: () => image,
|
|
401
|
+
iTerm: () => iTerm,
|
|
402
|
+
exitAlternativeScreen: () => exitAlternativeScreen,
|
|
403
|
+
eraseUp: () => eraseUp,
|
|
404
|
+
eraseStartLine: () => eraseStartLine,
|
|
405
|
+
eraseScreen: () => eraseScreen,
|
|
406
|
+
eraseLines: () => eraseLines,
|
|
407
|
+
eraseLine: () => eraseLine,
|
|
408
|
+
eraseEndLine: () => eraseEndLine,
|
|
409
|
+
eraseDown: () => eraseDown,
|
|
410
|
+
enterAlternativeScreen: () => enterAlternativeScreen,
|
|
411
|
+
endSynchronizedOutput: () => endSynchronizedOutput,
|
|
412
|
+
cursorUp: () => cursorUp,
|
|
413
|
+
cursorTo: () => cursorTo,
|
|
414
|
+
cursorShow: () => cursorShow,
|
|
415
|
+
cursorSavePosition: () => cursorSavePosition,
|
|
416
|
+
cursorRestorePosition: () => cursorRestorePosition,
|
|
417
|
+
cursorPrevLine: () => cursorPrevLine,
|
|
418
|
+
cursorNextLine: () => cursorNextLine,
|
|
419
|
+
cursorMove: () => cursorMove,
|
|
420
|
+
cursorLeft: () => cursorLeft,
|
|
421
|
+
cursorHide: () => cursorHide,
|
|
422
|
+
cursorGetPosition: () => cursorGetPosition,
|
|
423
|
+
cursorForward: () => cursorForward,
|
|
424
|
+
cursorDown: () => cursorDown,
|
|
425
|
+
cursorBackward: () => cursorBackward,
|
|
426
|
+
clearViewport: () => clearViewport,
|
|
427
|
+
clearTerminal: () => clearTerminal,
|
|
428
|
+
clearScreen: () => clearScreen,
|
|
429
|
+
beginSynchronizedOutput: () => beginSynchronizedOutput,
|
|
430
|
+
beep: () => beep,
|
|
431
|
+
ConEmu: () => ConEmu
|
|
432
|
+
});
|
|
433
|
+
import process5 from "node:process";
|
|
434
|
+
import os2 from "node:os";
|
|
435
|
+
|
|
436
|
+
// ../../node_modules/.bun/environment@1.1.0/node_modules/environment/index.js
|
|
437
|
+
var isBrowser = globalThis.window?.document !== undefined;
|
|
438
|
+
var isNode = globalThis.process?.versions?.node !== undefined;
|
|
439
|
+
var isBun = globalThis.process?.versions?.bun !== undefined;
|
|
440
|
+
var isDeno = globalThis.Deno?.version?.deno !== undefined;
|
|
441
|
+
var isElectron = globalThis.process?.versions?.electron !== undefined;
|
|
442
|
+
var isJsDom = globalThis.navigator?.userAgent?.includes("jsdom") === true;
|
|
443
|
+
var isWebWorker = typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
|
|
444
|
+
var isDedicatedWorker = typeof DedicatedWorkerGlobalScope !== "undefined" && globalThis instanceof DedicatedWorkerGlobalScope;
|
|
445
|
+
var isSharedWorker = typeof SharedWorkerGlobalScope !== "undefined" && globalThis instanceof SharedWorkerGlobalScope;
|
|
446
|
+
var isServiceWorker = typeof ServiceWorkerGlobalScope !== "undefined" && globalThis instanceof ServiceWorkerGlobalScope;
|
|
447
|
+
var platform = globalThis.navigator?.userAgentData?.platform;
|
|
448
|
+
var isMacOs = platform === "macOS" || globalThis.navigator?.platform === "MacIntel" || globalThis.navigator?.userAgent?.includes(" Mac ") === true || globalThis.process?.platform === "darwin";
|
|
449
|
+
var isWindows = platform === "Windows" || globalThis.navigator?.platform === "Win32" || globalThis.process?.platform === "win32";
|
|
450
|
+
var isLinux = platform === "Linux" || globalThis.navigator?.platform?.startsWith("Linux") === true || globalThis.navigator?.userAgent?.includes(" Linux ") === true || globalThis.process?.platform === "linux";
|
|
451
|
+
var isIos = platform === "iOS" || globalThis.navigator?.platform === "MacIntel" && globalThis.navigator?.maxTouchPoints > 1 || /iPad|iPhone|iPod/.test(globalThis.navigator?.platform);
|
|
452
|
+
var isAndroid = platform === "Android" || globalThis.navigator?.platform === "Android" || globalThis.navigator?.userAgent?.includes(" Android ") === true || globalThis.process?.platform === "android";
|
|
453
|
+
|
|
454
|
+
// ../../node_modules/.bun/ansi-escapes@7.3.0/node_modules/ansi-escapes/base.js
|
|
455
|
+
var ESC = "\x1B[";
|
|
456
|
+
var OSC = "\x1B]";
|
|
457
|
+
var BEL = "\x07";
|
|
458
|
+
var SEP = ";";
|
|
459
|
+
var isTerminalApp = !isBrowser && process5.env.TERM_PROGRAM === "Apple_Terminal";
|
|
460
|
+
var isWindows2 = !isBrowser && process5.platform === "win32";
|
|
461
|
+
var isTmux = !isBrowser && (process5.env.TERM?.startsWith("screen") || process5.env.TERM?.startsWith("tmux") || process5.env.TMUX !== undefined);
|
|
462
|
+
var cwdFunction = isBrowser ? () => {
|
|
463
|
+
throw new Error("`process.cwd()` only works in Node.js, not the browser.");
|
|
464
|
+
} : process5.cwd;
|
|
465
|
+
var wrapOsc = (sequence) => {
|
|
466
|
+
if (isTmux) {
|
|
467
|
+
return "\x1BPtmux;" + sequence.replaceAll("\x1B", "\x1B\x1B") + "\x1B\\";
|
|
468
|
+
}
|
|
469
|
+
return sequence;
|
|
470
|
+
};
|
|
471
|
+
var cursorTo = (x, y) => {
|
|
472
|
+
if (typeof x !== "number") {
|
|
473
|
+
throw new TypeError("The `x` argument is required");
|
|
474
|
+
}
|
|
475
|
+
if (typeof y !== "number") {
|
|
476
|
+
return ESC + (x + 1) + "G";
|
|
477
|
+
}
|
|
478
|
+
return ESC + (y + 1) + SEP + (x + 1) + "H";
|
|
479
|
+
};
|
|
480
|
+
var cursorMove = (x, y) => {
|
|
481
|
+
if (typeof x !== "number") {
|
|
482
|
+
throw new TypeError("The `x` argument is required");
|
|
483
|
+
}
|
|
484
|
+
let returnValue = "";
|
|
485
|
+
if (x < 0) {
|
|
486
|
+
returnValue += ESC + -x + "D";
|
|
487
|
+
} else if (x > 0) {
|
|
488
|
+
returnValue += ESC + x + "C";
|
|
489
|
+
}
|
|
490
|
+
if (y < 0) {
|
|
491
|
+
returnValue += ESC + -y + "A";
|
|
492
|
+
} else if (y > 0) {
|
|
493
|
+
returnValue += ESC + y + "B";
|
|
494
|
+
}
|
|
495
|
+
return returnValue;
|
|
496
|
+
};
|
|
497
|
+
var cursorUp = (count = 1) => ESC + count + "A";
|
|
498
|
+
var cursorDown = (count = 1) => ESC + count + "B";
|
|
499
|
+
var cursorForward = (count = 1) => ESC + count + "C";
|
|
500
|
+
var cursorBackward = (count = 1) => ESC + count + "D";
|
|
501
|
+
var cursorLeft = ESC + "G";
|
|
502
|
+
var cursorSavePosition = isTerminalApp ? "\x1B7" : ESC + "s";
|
|
503
|
+
var cursorRestorePosition = isTerminalApp ? "\x1B8" : ESC + "u";
|
|
504
|
+
var cursorGetPosition = ESC + "6n";
|
|
505
|
+
var cursorNextLine = ESC + "E";
|
|
506
|
+
var cursorPrevLine = ESC + "F";
|
|
507
|
+
var cursorHide = ESC + "?25l";
|
|
508
|
+
var cursorShow = ESC + "?25h";
|
|
509
|
+
var eraseLines = (count) => {
|
|
510
|
+
let clear = "";
|
|
511
|
+
for (let i = 0;i < count; i++) {
|
|
512
|
+
clear += eraseLine + (i < count - 1 ? cursorUp() : "");
|
|
513
|
+
}
|
|
514
|
+
if (count) {
|
|
515
|
+
clear += cursorLeft;
|
|
516
|
+
}
|
|
517
|
+
return clear;
|
|
518
|
+
};
|
|
519
|
+
var eraseEndLine = ESC + "K";
|
|
520
|
+
var eraseStartLine = ESC + "1K";
|
|
521
|
+
var eraseLine = ESC + "2K";
|
|
522
|
+
var eraseDown = ESC + "J";
|
|
523
|
+
var eraseUp = ESC + "1J";
|
|
524
|
+
var eraseScreen = ESC + "2J";
|
|
525
|
+
var scrollUp = ESC + "S";
|
|
526
|
+
var scrollDown = ESC + "T";
|
|
527
|
+
var clearScreen = "\x1Bc";
|
|
528
|
+
var clearViewport = `${eraseScreen}${ESC}H`;
|
|
529
|
+
var isOldWindows = () => {
|
|
530
|
+
if (isBrowser || !isWindows2) {
|
|
531
|
+
return false;
|
|
532
|
+
}
|
|
533
|
+
const parts = os2.release().split(".");
|
|
534
|
+
const major = Number(parts[0]);
|
|
535
|
+
const build = Number(parts[2] ?? 0);
|
|
536
|
+
if (major < 10) {
|
|
537
|
+
return true;
|
|
538
|
+
}
|
|
539
|
+
if (major === 10 && build < 10586) {
|
|
540
|
+
return true;
|
|
541
|
+
}
|
|
542
|
+
return false;
|
|
543
|
+
};
|
|
544
|
+
var clearTerminal = isOldWindows() ? `${eraseScreen}${ESC}0f` : `${eraseScreen}${ESC}3J${ESC}H`;
|
|
545
|
+
var enterAlternativeScreen = ESC + "?1049h";
|
|
546
|
+
var exitAlternativeScreen = ESC + "?1049l";
|
|
547
|
+
var beginSynchronizedOutput = ESC + "?2026h";
|
|
548
|
+
var endSynchronizedOutput = ESC + "?2026l";
|
|
549
|
+
var synchronizedOutput = (text) => beginSynchronizedOutput + text + endSynchronizedOutput;
|
|
550
|
+
var beep = BEL;
|
|
551
|
+
var link = (text, url) => {
|
|
552
|
+
const openLink = wrapOsc(`${OSC}8${SEP}${SEP}${url}${BEL}`);
|
|
553
|
+
const closeLink = wrapOsc(`${OSC}8${SEP}${SEP}${BEL}`);
|
|
554
|
+
return openLink + text + closeLink;
|
|
555
|
+
};
|
|
556
|
+
var image = (data, options = {}) => {
|
|
557
|
+
let returnValue = `${OSC}1337;File=inline=1`;
|
|
558
|
+
if (options.width) {
|
|
559
|
+
returnValue += `;width=${options.width}`;
|
|
560
|
+
}
|
|
561
|
+
if (options.height) {
|
|
562
|
+
returnValue += `;height=${options.height}`;
|
|
563
|
+
}
|
|
564
|
+
if (options.preserveAspectRatio === false) {
|
|
565
|
+
returnValue += ";preserveAspectRatio=0";
|
|
566
|
+
}
|
|
567
|
+
const imageBuffer = Buffer.from(data);
|
|
568
|
+
return wrapOsc(returnValue + `;size=${imageBuffer.byteLength}` + ":" + imageBuffer.toString("base64") + BEL);
|
|
569
|
+
};
|
|
570
|
+
var iTerm = {
|
|
571
|
+
setCwd: (cwd = cwdFunction()) => wrapOsc(`${OSC}50;CurrentDir=${cwd}${BEL}`),
|
|
572
|
+
annotation(message, options = {}) {
|
|
573
|
+
let returnValue = `${OSC}1337;`;
|
|
574
|
+
const hasX = options.x !== undefined;
|
|
575
|
+
const hasY = options.y !== undefined;
|
|
576
|
+
if ((hasX || hasY) && !(hasX && hasY && options.length !== undefined)) {
|
|
577
|
+
throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");
|
|
578
|
+
}
|
|
579
|
+
message = message.replaceAll("|", "");
|
|
580
|
+
returnValue += options.isHidden ? "AddHiddenAnnotation=" : "AddAnnotation=";
|
|
581
|
+
if (options.length > 0) {
|
|
582
|
+
returnValue += (hasX ? [message, options.length, options.x, options.y] : [options.length, message]).join("|");
|
|
583
|
+
} else {
|
|
584
|
+
returnValue += message;
|
|
585
|
+
}
|
|
586
|
+
return wrapOsc(returnValue + BEL);
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
var ConEmu = {
|
|
590
|
+
setCwd: (cwd = cwdFunction()) => wrapOsc(`${OSC}9;9;${cwd}${BEL}`)
|
|
591
|
+
};
|
|
592
|
+
var setCwd = (cwd = cwdFunction()) => iTerm.setCwd(cwd) + ConEmu.setCwd(cwd);
|
|
593
|
+
// ../../node_modules/.bun/cli-cursor@5.0.0/node_modules/cli-cursor/index.js
|
|
594
|
+
import process8 from "node:process";
|
|
595
|
+
|
|
596
|
+
// ../../node_modules/.bun/restore-cursor@5.1.0/node_modules/restore-cursor/index.js
|
|
597
|
+
import process7 from "node:process";
|
|
598
|
+
|
|
599
|
+
// ../../node_modules/.bun/mimic-function@5.0.1/node_modules/mimic-function/index.js
|
|
600
|
+
var copyProperty = (to, from, property, ignoreNonConfigurable) => {
|
|
601
|
+
if (property === "length" || property === "prototype") {
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
604
|
+
if (property === "arguments" || property === "caller") {
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
|
|
608
|
+
const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
|
|
609
|
+
if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
|
|
610
|
+
return;
|
|
611
|
+
}
|
|
612
|
+
Object.defineProperty(to, property, fromDescriptor);
|
|
613
|
+
};
|
|
614
|
+
var canCopyProperty = function(toDescriptor, fromDescriptor) {
|
|
615
|
+
return toDescriptor === undefined || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
|
|
616
|
+
};
|
|
617
|
+
var changePrototype = (to, from) => {
|
|
618
|
+
const fromPrototype = Object.getPrototypeOf(from);
|
|
619
|
+
if (fromPrototype === Object.getPrototypeOf(to)) {
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
Object.setPrototypeOf(to, fromPrototype);
|
|
623
|
+
};
|
|
624
|
+
var wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
|
|
625
|
+
${fromBody}`;
|
|
626
|
+
var toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
|
|
627
|
+
var toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
|
|
628
|
+
var changeToString = (to, from, name) => {
|
|
629
|
+
const withName = name === "" ? "" : `with ${name.trim()}() `;
|
|
630
|
+
const newToString = wrappedToString.bind(null, withName, from.toString());
|
|
631
|
+
Object.defineProperty(newToString, "name", toStringName);
|
|
632
|
+
const { writable, enumerable, configurable } = toStringDescriptor;
|
|
633
|
+
Object.defineProperty(to, "toString", { value: newToString, writable, enumerable, configurable });
|
|
634
|
+
};
|
|
635
|
+
function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
|
|
636
|
+
const { name } = to;
|
|
637
|
+
for (const property of Reflect.ownKeys(from)) {
|
|
638
|
+
copyProperty(to, from, property, ignoreNonConfigurable);
|
|
639
|
+
}
|
|
640
|
+
changePrototype(to, from);
|
|
641
|
+
changeToString(to, from, name);
|
|
642
|
+
return to;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
// ../../node_modules/.bun/onetime@7.0.0/node_modules/onetime/index.js
|
|
646
|
+
var calledFunctions = new WeakMap;
|
|
647
|
+
var onetime = (function_, options = {}) => {
|
|
648
|
+
if (typeof function_ !== "function") {
|
|
649
|
+
throw new TypeError("Expected a function");
|
|
650
|
+
}
|
|
651
|
+
let returnValue;
|
|
652
|
+
let callCount = 0;
|
|
653
|
+
const functionName = function_.displayName || function_.name || "<anonymous>";
|
|
654
|
+
const onetime2 = function(...arguments_) {
|
|
655
|
+
calledFunctions.set(onetime2, ++callCount);
|
|
656
|
+
if (callCount === 1) {
|
|
657
|
+
returnValue = function_.apply(this, arguments_);
|
|
658
|
+
function_ = undefined;
|
|
659
|
+
} else if (options.throw === true) {
|
|
660
|
+
throw new Error(`Function \`${functionName}\` can only be called once`);
|
|
661
|
+
}
|
|
662
|
+
return returnValue;
|
|
663
|
+
};
|
|
664
|
+
mimicFunction(onetime2, function_);
|
|
665
|
+
calledFunctions.set(onetime2, callCount);
|
|
666
|
+
return onetime2;
|
|
667
|
+
};
|
|
668
|
+
onetime.callCount = (function_) => {
|
|
669
|
+
if (!calledFunctions.has(function_)) {
|
|
670
|
+
throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
|
|
671
|
+
}
|
|
672
|
+
return calledFunctions.get(function_);
|
|
673
|
+
};
|
|
674
|
+
var onetime_default = onetime;
|
|
675
|
+
|
|
676
|
+
// ../../node_modules/.bun/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
677
|
+
var signals = [];
|
|
678
|
+
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
679
|
+
if (process.platform !== "win32") {
|
|
680
|
+
signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
681
|
+
}
|
|
682
|
+
if (process.platform === "linux") {
|
|
683
|
+
signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
// ../../node_modules/.bun/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
|
|
687
|
+
var processOk = (process6) => !!process6 && typeof process6 === "object" && typeof process6.removeListener === "function" && typeof process6.emit === "function" && typeof process6.reallyExit === "function" && typeof process6.listeners === "function" && typeof process6.kill === "function" && typeof process6.pid === "number" && typeof process6.on === "function";
|
|
688
|
+
var kExitEmitter = Symbol.for("signal-exit emitter");
|
|
689
|
+
var global = globalThis;
|
|
690
|
+
var ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
691
|
+
|
|
692
|
+
class Emitter {
|
|
693
|
+
emitted = {
|
|
694
|
+
afterExit: false,
|
|
695
|
+
exit: false
|
|
696
|
+
};
|
|
697
|
+
listeners = {
|
|
698
|
+
afterExit: [],
|
|
699
|
+
exit: []
|
|
700
|
+
};
|
|
701
|
+
count = 0;
|
|
702
|
+
id = Math.random();
|
|
703
|
+
constructor() {
|
|
704
|
+
if (global[kExitEmitter]) {
|
|
705
|
+
return global[kExitEmitter];
|
|
706
|
+
}
|
|
707
|
+
ObjectDefineProperty(global, kExitEmitter, {
|
|
708
|
+
value: this,
|
|
709
|
+
writable: false,
|
|
710
|
+
enumerable: false,
|
|
711
|
+
configurable: false
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
on(ev, fn) {
|
|
715
|
+
this.listeners[ev].push(fn);
|
|
716
|
+
}
|
|
717
|
+
removeListener(ev, fn) {
|
|
718
|
+
const list = this.listeners[ev];
|
|
719
|
+
const i = list.indexOf(fn);
|
|
720
|
+
if (i === -1) {
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
if (i === 0 && list.length === 1) {
|
|
724
|
+
list.length = 0;
|
|
725
|
+
} else {
|
|
726
|
+
list.splice(i, 1);
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
emit(ev, code, signal) {
|
|
730
|
+
if (this.emitted[ev]) {
|
|
731
|
+
return false;
|
|
732
|
+
}
|
|
733
|
+
this.emitted[ev] = true;
|
|
734
|
+
let ret = false;
|
|
735
|
+
for (const fn of this.listeners[ev]) {
|
|
736
|
+
ret = fn(code, signal) === true || ret;
|
|
737
|
+
}
|
|
738
|
+
if (ev === "exit") {
|
|
739
|
+
ret = this.emit("afterExit", code, signal) || ret;
|
|
740
|
+
}
|
|
741
|
+
return ret;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
class SignalExitBase {
|
|
746
|
+
}
|
|
747
|
+
var signalExitWrap = (handler) => {
|
|
748
|
+
return {
|
|
749
|
+
onExit(cb, opts) {
|
|
750
|
+
return handler.onExit(cb, opts);
|
|
751
|
+
},
|
|
752
|
+
load() {
|
|
753
|
+
return handler.load();
|
|
754
|
+
},
|
|
755
|
+
unload() {
|
|
756
|
+
return handler.unload();
|
|
757
|
+
}
|
|
758
|
+
};
|
|
759
|
+
};
|
|
760
|
+
|
|
761
|
+
class SignalExitFallback extends SignalExitBase {
|
|
762
|
+
onExit() {
|
|
763
|
+
return () => {};
|
|
764
|
+
}
|
|
765
|
+
load() {}
|
|
766
|
+
unload() {}
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
class SignalExit extends SignalExitBase {
|
|
770
|
+
#hupSig = process6.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
771
|
+
#emitter = new Emitter;
|
|
772
|
+
#process;
|
|
773
|
+
#originalProcessEmit;
|
|
774
|
+
#originalProcessReallyExit;
|
|
775
|
+
#sigListeners = {};
|
|
776
|
+
#loaded = false;
|
|
777
|
+
constructor(process6) {
|
|
778
|
+
super();
|
|
779
|
+
this.#process = process6;
|
|
780
|
+
this.#sigListeners = {};
|
|
781
|
+
for (const sig of signals) {
|
|
782
|
+
this.#sigListeners[sig] = () => {
|
|
783
|
+
const listeners = this.#process.listeners(sig);
|
|
784
|
+
let { count } = this.#emitter;
|
|
785
|
+
const p = process6;
|
|
786
|
+
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
|
|
787
|
+
count += p.__signal_exit_emitter__.count;
|
|
788
|
+
}
|
|
789
|
+
if (listeners.length === count) {
|
|
790
|
+
this.unload();
|
|
791
|
+
const ret = this.#emitter.emit("exit", null, sig);
|
|
792
|
+
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
793
|
+
if (!ret)
|
|
794
|
+
process6.kill(process6.pid, s);
|
|
795
|
+
}
|
|
796
|
+
};
|
|
797
|
+
}
|
|
798
|
+
this.#originalProcessReallyExit = process6.reallyExit;
|
|
799
|
+
this.#originalProcessEmit = process6.emit;
|
|
800
|
+
}
|
|
801
|
+
onExit(cb, opts) {
|
|
802
|
+
if (!processOk(this.#process)) {
|
|
803
|
+
return () => {};
|
|
804
|
+
}
|
|
805
|
+
if (this.#loaded === false) {
|
|
806
|
+
this.load();
|
|
807
|
+
}
|
|
808
|
+
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
809
|
+
this.#emitter.on(ev, cb);
|
|
810
|
+
return () => {
|
|
811
|
+
this.#emitter.removeListener(ev, cb);
|
|
812
|
+
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
|
|
813
|
+
this.unload();
|
|
814
|
+
}
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
load() {
|
|
818
|
+
if (this.#loaded) {
|
|
819
|
+
return;
|
|
820
|
+
}
|
|
821
|
+
this.#loaded = true;
|
|
822
|
+
this.#emitter.count += 1;
|
|
823
|
+
for (const sig of signals) {
|
|
824
|
+
try {
|
|
825
|
+
const fn = this.#sigListeners[sig];
|
|
826
|
+
if (fn)
|
|
827
|
+
this.#process.on(sig, fn);
|
|
828
|
+
} catch (_) {}
|
|
829
|
+
}
|
|
830
|
+
this.#process.emit = (ev, ...a) => {
|
|
831
|
+
return this.#processEmit(ev, ...a);
|
|
832
|
+
};
|
|
833
|
+
this.#process.reallyExit = (code) => {
|
|
834
|
+
return this.#processReallyExit(code);
|
|
835
|
+
};
|
|
836
|
+
}
|
|
837
|
+
unload() {
|
|
838
|
+
if (!this.#loaded) {
|
|
839
|
+
return;
|
|
840
|
+
}
|
|
841
|
+
this.#loaded = false;
|
|
842
|
+
signals.forEach((sig) => {
|
|
843
|
+
const listener = this.#sigListeners[sig];
|
|
844
|
+
if (!listener) {
|
|
845
|
+
throw new Error("Listener not defined for signal: " + sig);
|
|
846
|
+
}
|
|
847
|
+
try {
|
|
848
|
+
this.#process.removeListener(sig, listener);
|
|
849
|
+
} catch (_) {}
|
|
850
|
+
});
|
|
851
|
+
this.#process.emit = this.#originalProcessEmit;
|
|
852
|
+
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
853
|
+
this.#emitter.count -= 1;
|
|
854
|
+
}
|
|
855
|
+
#processReallyExit(code) {
|
|
856
|
+
if (!processOk(this.#process)) {
|
|
857
|
+
return 0;
|
|
858
|
+
}
|
|
859
|
+
this.#process.exitCode = code || 0;
|
|
860
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
861
|
+
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
862
|
+
}
|
|
863
|
+
#processEmit(ev, ...args) {
|
|
864
|
+
const og = this.#originalProcessEmit;
|
|
865
|
+
if (ev === "exit" && processOk(this.#process)) {
|
|
866
|
+
if (typeof args[0] === "number") {
|
|
867
|
+
this.#process.exitCode = args[0];
|
|
868
|
+
}
|
|
869
|
+
const ret = og.call(this.#process, ev, ...args);
|
|
870
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
871
|
+
return ret;
|
|
872
|
+
} else {
|
|
873
|
+
return og.call(this.#process, ev, ...args);
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
var process6 = globalThis.process;
|
|
878
|
+
var {
|
|
879
|
+
onExit,
|
|
880
|
+
load,
|
|
881
|
+
unload
|
|
882
|
+
} = signalExitWrap(processOk(process6) ? new SignalExit(process6) : new SignalExitFallback);
|
|
883
|
+
|
|
884
|
+
// ../../node_modules/.bun/restore-cursor@5.1.0/node_modules/restore-cursor/index.js
|
|
885
|
+
var terminal = process7.stderr.isTTY ? process7.stderr : process7.stdout.isTTY ? process7.stdout : undefined;
|
|
886
|
+
var restoreCursor = terminal ? onetime_default(() => {
|
|
887
|
+
onExit(() => {
|
|
888
|
+
terminal.write("\x1B[?25h");
|
|
889
|
+
}, { alwaysLast: true });
|
|
890
|
+
}) : () => {};
|
|
891
|
+
var restore_cursor_default = restoreCursor;
|
|
892
|
+
|
|
893
|
+
// ../../node_modules/.bun/cli-cursor@5.0.0/node_modules/cli-cursor/index.js
|
|
894
|
+
var isHidden = false;
|
|
895
|
+
var cliCursor = {};
|
|
896
|
+
cliCursor.show = (writableStream = process8.stderr) => {
|
|
897
|
+
if (!writableStream.isTTY) {
|
|
898
|
+
return;
|
|
899
|
+
}
|
|
900
|
+
isHidden = false;
|
|
901
|
+
writableStream.write("\x1B[?25h");
|
|
902
|
+
};
|
|
903
|
+
cliCursor.hide = (writableStream = process8.stderr) => {
|
|
904
|
+
if (!writableStream.isTTY) {
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
restore_cursor_default();
|
|
908
|
+
isHidden = true;
|
|
909
|
+
writableStream.write("\x1B[?25l");
|
|
910
|
+
};
|
|
911
|
+
cliCursor.toggle = (force, writableStream) => {
|
|
912
|
+
if (force !== undefined) {
|
|
913
|
+
isHidden = force;
|
|
914
|
+
}
|
|
915
|
+
if (isHidden) {
|
|
916
|
+
cliCursor.show(writableStream);
|
|
917
|
+
} else {
|
|
918
|
+
cliCursor.hide(writableStream);
|
|
919
|
+
}
|
|
920
|
+
};
|
|
921
|
+
var cli_cursor_default = cliCursor;
|
|
922
|
+
|
|
923
|
+
// ../../node_modules/.bun/ansi-regex@6.2.2/node_modules/ansi-regex/index.js
|
|
924
|
+
function ansiRegex({ onlyFirst = false } = {}) {
|
|
925
|
+
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
926
|
+
const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
|
|
927
|
+
const csi = "[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";
|
|
928
|
+
const pattern = `${osc}|${csi}`;
|
|
929
|
+
return new RegExp(pattern, onlyFirst ? undefined : "g");
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
// ../../node_modules/.bun/strip-ansi@7.2.0/node_modules/strip-ansi/index.js
|
|
933
|
+
var regex = ansiRegex();
|
|
934
|
+
function stripAnsi(string) {
|
|
935
|
+
if (typeof string !== "string") {
|
|
936
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
937
|
+
}
|
|
938
|
+
if (!string.includes("\x1B") && !string.includes("")) {
|
|
939
|
+
return string;
|
|
940
|
+
}
|
|
941
|
+
return string.replace(regex, "");
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
// ../../node_modules/.bun/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/lookup-data.js
|
|
945
|
+
var ambiguousRanges = [161, 161, 164, 164, 167, 168, 170, 170, 173, 174, 176, 180, 182, 186, 188, 191, 198, 198, 208, 208, 215, 216, 222, 225, 230, 230, 232, 234, 236, 237, 240, 240, 242, 243, 247, 250, 252, 252, 254, 254, 257, 257, 273, 273, 275, 275, 283, 283, 294, 295, 299, 299, 305, 307, 312, 312, 319, 322, 324, 324, 328, 331, 333, 333, 338, 339, 358, 359, 363, 363, 462, 462, 464, 464, 466, 466, 468, 468, 470, 470, 472, 472, 474, 474, 476, 476, 593, 593, 609, 609, 708, 708, 711, 711, 713, 715, 717, 717, 720, 720, 728, 731, 733, 733, 735, 735, 768, 879, 913, 929, 931, 937, 945, 961, 963, 969, 1025, 1025, 1040, 1103, 1105, 1105, 8208, 8208, 8211, 8214, 8216, 8217, 8220, 8221, 8224, 8226, 8228, 8231, 8240, 8240, 8242, 8243, 8245, 8245, 8251, 8251, 8254, 8254, 8308, 8308, 8319, 8319, 8321, 8324, 8364, 8364, 8451, 8451, 8453, 8453, 8457, 8457, 8467, 8467, 8470, 8470, 8481, 8482, 8486, 8486, 8491, 8491, 8531, 8532, 8539, 8542, 8544, 8555, 8560, 8569, 8585, 8585, 8592, 8601, 8632, 8633, 8658, 8658, 8660, 8660, 8679, 8679, 8704, 8704, 8706, 8707, 8711, 8712, 8715, 8715, 8719, 8719, 8721, 8721, 8725, 8725, 8730, 8730, 8733, 8736, 8739, 8739, 8741, 8741, 8743, 8748, 8750, 8750, 8756, 8759, 8764, 8765, 8776, 8776, 8780, 8780, 8786, 8786, 8800, 8801, 8804, 8807, 8810, 8811, 8814, 8815, 8834, 8835, 8838, 8839, 8853, 8853, 8857, 8857, 8869, 8869, 8895, 8895, 8978, 8978, 9312, 9449, 9451, 9547, 9552, 9587, 9600, 9615, 9618, 9621, 9632, 9633, 9635, 9641, 9650, 9651, 9654, 9655, 9660, 9661, 9664, 9665, 9670, 9672, 9675, 9675, 9678, 9681, 9698, 9701, 9711, 9711, 9733, 9734, 9737, 9737, 9742, 9743, 9756, 9756, 9758, 9758, 9792, 9792, 9794, 9794, 9824, 9825, 9827, 9829, 9831, 9834, 9836, 9837, 9839, 9839, 9886, 9887, 9919, 9919, 9926, 9933, 9935, 9939, 9941, 9953, 9955, 9955, 9960, 9961, 9963, 9969, 9972, 9972, 9974, 9977, 9979, 9980, 9982, 9983, 10045, 10045, 10102, 10111, 11094, 11097, 12872, 12879, 57344, 63743, 65024, 65039, 65533, 65533, 127232, 127242, 127248, 127277, 127280, 127337, 127344, 127373, 127375, 127376, 127387, 127404, 917760, 917999, 983040, 1048573, 1048576, 1114109];
|
|
946
|
+
var fullwidthRanges = [12288, 12288, 65281, 65376, 65504, 65510];
|
|
947
|
+
var halfwidthRanges = [8361, 8361, 65377, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65512, 65518];
|
|
948
|
+
var narrowRanges = [32, 126, 162, 163, 165, 166, 172, 172, 175, 175, 10214, 10221, 10629, 10630];
|
|
949
|
+
var wideRanges = [4352, 4447, 8986, 8987, 9001, 9002, 9193, 9196, 9200, 9200, 9203, 9203, 9725, 9726, 9748, 9749, 9776, 9783, 9800, 9811, 9855, 9855, 9866, 9871, 9875, 9875, 9889, 9889, 9898, 9899, 9917, 9918, 9924, 9925, 9934, 9934, 9940, 9940, 9962, 9962, 9970, 9971, 9973, 9973, 9978, 9978, 9981, 9981, 9989, 9989, 9994, 9995, 10024, 10024, 10060, 10060, 10062, 10062, 10067, 10069, 10071, 10071, 10133, 10135, 10160, 10160, 10175, 10175, 11035, 11036, 11088, 11088, 11093, 11093, 11904, 11929, 11931, 12019, 12032, 12245, 12272, 12287, 12289, 12350, 12353, 12438, 12441, 12543, 12549, 12591, 12593, 12686, 12688, 12773, 12783, 12830, 12832, 12871, 12880, 42124, 42128, 42182, 43360, 43388, 44032, 55203, 63744, 64255, 65040, 65049, 65072, 65106, 65108, 65126, 65128, 65131, 94176, 94180, 94192, 94198, 94208, 101589, 101631, 101662, 101760, 101874, 110576, 110579, 110581, 110587, 110589, 110590, 110592, 110882, 110898, 110898, 110928, 110930, 110933, 110933, 110948, 110951, 110960, 111355, 119552, 119638, 119648, 119670, 126980, 126980, 127183, 127183, 127374, 127374, 127377, 127386, 127488, 127490, 127504, 127547, 127552, 127560, 127568, 127569, 127584, 127589, 127744, 127776, 127789, 127797, 127799, 127868, 127870, 127891, 127904, 127946, 127951, 127955, 127968, 127984, 127988, 127988, 127992, 128062, 128064, 128064, 128066, 128252, 128255, 128317, 128331, 128334, 128336, 128359, 128378, 128378, 128405, 128406, 128420, 128420, 128507, 128591, 128640, 128709, 128716, 128716, 128720, 128722, 128725, 128728, 128732, 128735, 128747, 128748, 128756, 128764, 128992, 129003, 129008, 129008, 129292, 129338, 129340, 129349, 129351, 129535, 129648, 129660, 129664, 129674, 129678, 129734, 129736, 129736, 129741, 129756, 129759, 129770, 129775, 129784, 131072, 196605, 196608, 262141];
|
|
950
|
+
|
|
951
|
+
// ../../node_modules/.bun/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/utilities.js
|
|
952
|
+
var isInRange = (ranges, codePoint) => {
|
|
953
|
+
let low = 0;
|
|
954
|
+
let high = Math.floor(ranges.length / 2) - 1;
|
|
955
|
+
while (low <= high) {
|
|
956
|
+
const mid = Math.floor((low + high) / 2);
|
|
957
|
+
const i = mid * 2;
|
|
958
|
+
if (codePoint < ranges[i]) {
|
|
959
|
+
high = mid - 1;
|
|
960
|
+
} else if (codePoint > ranges[i + 1]) {
|
|
961
|
+
low = mid + 1;
|
|
962
|
+
} else {
|
|
963
|
+
return true;
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
return false;
|
|
967
|
+
};
|
|
968
|
+
|
|
969
|
+
// ../../node_modules/.bun/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/lookup.js
|
|
970
|
+
var minimumAmbiguousCodePoint = ambiguousRanges[0];
|
|
971
|
+
var maximumAmbiguousCodePoint = ambiguousRanges.at(-1);
|
|
972
|
+
var minimumFullWidthCodePoint = fullwidthRanges[0];
|
|
973
|
+
var maximumFullWidthCodePoint = fullwidthRanges.at(-1);
|
|
974
|
+
var minimumHalfWidthCodePoint = halfwidthRanges[0];
|
|
975
|
+
var maximumHalfWidthCodePoint = halfwidthRanges.at(-1);
|
|
976
|
+
var minimumNarrowCodePoint = narrowRanges[0];
|
|
977
|
+
var maximumNarrowCodePoint = narrowRanges.at(-1);
|
|
978
|
+
var minimumWideCodePoint = wideRanges[0];
|
|
979
|
+
var maximumWideCodePoint = wideRanges.at(-1);
|
|
980
|
+
var commonCjkCodePoint = 19968;
|
|
981
|
+
var [wideFastPathStart, wideFastPathEnd] = findWideFastPathRange(wideRanges);
|
|
982
|
+
function findWideFastPathRange(ranges) {
|
|
983
|
+
let fastPathStart = ranges[0];
|
|
984
|
+
let fastPathEnd = ranges[1];
|
|
985
|
+
for (let index = 0;index < ranges.length; index += 2) {
|
|
986
|
+
const start = ranges[index];
|
|
987
|
+
const end = ranges[index + 1];
|
|
988
|
+
if (commonCjkCodePoint >= start && commonCjkCodePoint <= end) {
|
|
989
|
+
return [start, end];
|
|
990
|
+
}
|
|
991
|
+
if (end - start > fastPathEnd - fastPathStart) {
|
|
992
|
+
fastPathStart = start;
|
|
993
|
+
fastPathEnd = end;
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
return [fastPathStart, fastPathEnd];
|
|
997
|
+
}
|
|
998
|
+
var isAmbiguous = (codePoint) => {
|
|
999
|
+
if (codePoint < minimumAmbiguousCodePoint || codePoint > maximumAmbiguousCodePoint) {
|
|
1000
|
+
return false;
|
|
1001
|
+
}
|
|
1002
|
+
return isInRange(ambiguousRanges, codePoint);
|
|
1003
|
+
};
|
|
1004
|
+
var isFullWidth = (codePoint) => {
|
|
1005
|
+
if (codePoint < minimumFullWidthCodePoint || codePoint > maximumFullWidthCodePoint) {
|
|
1006
|
+
return false;
|
|
1007
|
+
}
|
|
1008
|
+
return isInRange(fullwidthRanges, codePoint);
|
|
1009
|
+
};
|
|
1010
|
+
var isWide = (codePoint) => {
|
|
1011
|
+
if (codePoint >= wideFastPathStart && codePoint <= wideFastPathEnd) {
|
|
1012
|
+
return true;
|
|
1013
|
+
}
|
|
1014
|
+
if (codePoint < minimumWideCodePoint || codePoint > maximumWideCodePoint) {
|
|
1015
|
+
return false;
|
|
1016
|
+
}
|
|
1017
|
+
return isInRange(wideRanges, codePoint);
|
|
1018
|
+
};
|
|
1019
|
+
|
|
1020
|
+
// ../../node_modules/.bun/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/index.js
|
|
1021
|
+
function validate(codePoint) {
|
|
1022
|
+
if (!Number.isSafeInteger(codePoint)) {
|
|
1023
|
+
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
|
|
1027
|
+
validate(codePoint);
|
|
1028
|
+
if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
|
|
1029
|
+
return 2;
|
|
1030
|
+
}
|
|
1031
|
+
return 1;
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
// ../../node_modules/.bun/string-width@7.2.0/node_modules/string-width/index.js
|
|
1035
|
+
var import_emoji_regex = __toESM(require_emoji_regex(), 1);
|
|
1036
|
+
var segmenter = new Intl.Segmenter;
|
|
1037
|
+
var defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
1038
|
+
function stringWidth(string, options = {}) {
|
|
1039
|
+
if (typeof string !== "string" || string.length === 0) {
|
|
1040
|
+
return 0;
|
|
1041
|
+
}
|
|
1042
|
+
const {
|
|
1043
|
+
ambiguousIsNarrow = true,
|
|
1044
|
+
countAnsiEscapeCodes = false
|
|
1045
|
+
} = options;
|
|
1046
|
+
if (!countAnsiEscapeCodes) {
|
|
1047
|
+
string = stripAnsi(string);
|
|
1048
|
+
}
|
|
1049
|
+
if (string.length === 0) {
|
|
1050
|
+
return 0;
|
|
1051
|
+
}
|
|
1052
|
+
let width = 0;
|
|
1053
|
+
const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
|
|
1054
|
+
for (const { segment: character } of segmenter.segment(string)) {
|
|
1055
|
+
const codePoint = character.codePointAt(0);
|
|
1056
|
+
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
|
|
1057
|
+
continue;
|
|
1058
|
+
}
|
|
1059
|
+
if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
|
|
1060
|
+
continue;
|
|
1061
|
+
}
|
|
1062
|
+
if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
|
|
1063
|
+
continue;
|
|
1064
|
+
}
|
|
1065
|
+
if (codePoint >= 55296 && codePoint <= 57343) {
|
|
1066
|
+
continue;
|
|
1067
|
+
}
|
|
1068
|
+
if (codePoint >= 65024 && codePoint <= 65039) {
|
|
1069
|
+
continue;
|
|
1070
|
+
}
|
|
1071
|
+
if (defaultIgnorableCodePointRegex.test(character)) {
|
|
1072
|
+
continue;
|
|
1073
|
+
}
|
|
1074
|
+
if (import_emoji_regex.default().test(character)) {
|
|
1075
|
+
width += 2;
|
|
1076
|
+
continue;
|
|
1077
|
+
}
|
|
1078
|
+
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
1079
|
+
}
|
|
1080
|
+
return width;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
// ../../node_modules/.bun/ansi-styles@6.2.3/node_modules/ansi-styles/index.js
|
|
1084
|
+
var ANSI_BACKGROUND_OFFSET = 10;
|
|
1085
|
+
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
1086
|
+
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
1087
|
+
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
1088
|
+
var styles = {
|
|
1089
|
+
modifier: {
|
|
1090
|
+
reset: [0, 0],
|
|
1091
|
+
bold: [1, 22],
|
|
1092
|
+
dim: [2, 22],
|
|
1093
|
+
italic: [3, 23],
|
|
1094
|
+
underline: [4, 24],
|
|
1095
|
+
overline: [53, 55],
|
|
1096
|
+
inverse: [7, 27],
|
|
1097
|
+
hidden: [8, 28],
|
|
1098
|
+
strikethrough: [9, 29]
|
|
1099
|
+
},
|
|
1100
|
+
color: {
|
|
1101
|
+
black: [30, 39],
|
|
1102
|
+
red: [31, 39],
|
|
1103
|
+
green: [32, 39],
|
|
1104
|
+
yellow: [33, 39],
|
|
1105
|
+
blue: [34, 39],
|
|
1106
|
+
magenta: [35, 39],
|
|
1107
|
+
cyan: [36, 39],
|
|
1108
|
+
white: [37, 39],
|
|
1109
|
+
blackBright: [90, 39],
|
|
1110
|
+
gray: [90, 39],
|
|
1111
|
+
grey: [90, 39],
|
|
1112
|
+
redBright: [91, 39],
|
|
1113
|
+
greenBright: [92, 39],
|
|
1114
|
+
yellowBright: [93, 39],
|
|
1115
|
+
blueBright: [94, 39],
|
|
1116
|
+
magentaBright: [95, 39],
|
|
1117
|
+
cyanBright: [96, 39],
|
|
1118
|
+
whiteBright: [97, 39]
|
|
1119
|
+
},
|
|
1120
|
+
bgColor: {
|
|
1121
|
+
bgBlack: [40, 49],
|
|
1122
|
+
bgRed: [41, 49],
|
|
1123
|
+
bgGreen: [42, 49],
|
|
1124
|
+
bgYellow: [43, 49],
|
|
1125
|
+
bgBlue: [44, 49],
|
|
1126
|
+
bgMagenta: [45, 49],
|
|
1127
|
+
bgCyan: [46, 49],
|
|
1128
|
+
bgWhite: [47, 49],
|
|
1129
|
+
bgBlackBright: [100, 49],
|
|
1130
|
+
bgGray: [100, 49],
|
|
1131
|
+
bgGrey: [100, 49],
|
|
1132
|
+
bgRedBright: [101, 49],
|
|
1133
|
+
bgGreenBright: [102, 49],
|
|
1134
|
+
bgYellowBright: [103, 49],
|
|
1135
|
+
bgBlueBright: [104, 49],
|
|
1136
|
+
bgMagentaBright: [105, 49],
|
|
1137
|
+
bgCyanBright: [106, 49],
|
|
1138
|
+
bgWhiteBright: [107, 49]
|
|
1139
|
+
}
|
|
1140
|
+
};
|
|
1141
|
+
var modifierNames = Object.keys(styles.modifier);
|
|
1142
|
+
var foregroundColorNames = Object.keys(styles.color);
|
|
1143
|
+
var backgroundColorNames = Object.keys(styles.bgColor);
|
|
1144
|
+
var colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
1145
|
+
function assembleStyles() {
|
|
1146
|
+
const codes = new Map;
|
|
1147
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
1148
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
1149
|
+
styles[styleName] = {
|
|
1150
|
+
open: `\x1B[${style[0]}m`,
|
|
1151
|
+
close: `\x1B[${style[1]}m`
|
|
1152
|
+
};
|
|
1153
|
+
group[styleName] = styles[styleName];
|
|
1154
|
+
codes.set(style[0], style[1]);
|
|
1155
|
+
}
|
|
1156
|
+
Object.defineProperty(styles, groupName, {
|
|
1157
|
+
value: group,
|
|
1158
|
+
enumerable: false
|
|
1159
|
+
});
|
|
1160
|
+
}
|
|
1161
|
+
Object.defineProperty(styles, "codes", {
|
|
1162
|
+
value: codes,
|
|
1163
|
+
enumerable: false
|
|
1164
|
+
});
|
|
1165
|
+
styles.color.close = "\x1B[39m";
|
|
1166
|
+
styles.bgColor.close = "\x1B[49m";
|
|
1167
|
+
styles.color.ansi = wrapAnsi16();
|
|
1168
|
+
styles.color.ansi256 = wrapAnsi256();
|
|
1169
|
+
styles.color.ansi16m = wrapAnsi16m();
|
|
1170
|
+
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
1171
|
+
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
1172
|
+
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
1173
|
+
Object.defineProperties(styles, {
|
|
1174
|
+
rgbToAnsi256: {
|
|
1175
|
+
value(red, green, blue) {
|
|
1176
|
+
if (red === green && green === blue) {
|
|
1177
|
+
if (red < 8) {
|
|
1178
|
+
return 16;
|
|
1179
|
+
}
|
|
1180
|
+
if (red > 248) {
|
|
1181
|
+
return 231;
|
|
1182
|
+
}
|
|
1183
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
1184
|
+
}
|
|
1185
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
1186
|
+
},
|
|
1187
|
+
enumerable: false
|
|
1188
|
+
},
|
|
1189
|
+
hexToRgb: {
|
|
1190
|
+
value(hex) {
|
|
1191
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
1192
|
+
if (!matches) {
|
|
1193
|
+
return [0, 0, 0];
|
|
1194
|
+
}
|
|
1195
|
+
let [colorString] = matches;
|
|
1196
|
+
if (colorString.length === 3) {
|
|
1197
|
+
colorString = [...colorString].map((character) => character + character).join("");
|
|
1198
|
+
}
|
|
1199
|
+
const integer = Number.parseInt(colorString, 16);
|
|
1200
|
+
return [
|
|
1201
|
+
integer >> 16 & 255,
|
|
1202
|
+
integer >> 8 & 255,
|
|
1203
|
+
integer & 255
|
|
1204
|
+
];
|
|
1205
|
+
},
|
|
1206
|
+
enumerable: false
|
|
1207
|
+
},
|
|
1208
|
+
hexToAnsi256: {
|
|
1209
|
+
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
1210
|
+
enumerable: false
|
|
1211
|
+
},
|
|
1212
|
+
ansi256ToAnsi: {
|
|
1213
|
+
value(code) {
|
|
1214
|
+
if (code < 8) {
|
|
1215
|
+
return 30 + code;
|
|
1216
|
+
}
|
|
1217
|
+
if (code < 16) {
|
|
1218
|
+
return 90 + (code - 8);
|
|
1219
|
+
}
|
|
1220
|
+
let red;
|
|
1221
|
+
let green;
|
|
1222
|
+
let blue;
|
|
1223
|
+
if (code >= 232) {
|
|
1224
|
+
red = ((code - 232) * 10 + 8) / 255;
|
|
1225
|
+
green = red;
|
|
1226
|
+
blue = red;
|
|
1227
|
+
} else {
|
|
1228
|
+
code -= 16;
|
|
1229
|
+
const remainder = code % 36;
|
|
1230
|
+
red = Math.floor(code / 36) / 5;
|
|
1231
|
+
green = Math.floor(remainder / 6) / 5;
|
|
1232
|
+
blue = remainder % 6 / 5;
|
|
1233
|
+
}
|
|
1234
|
+
const value = Math.max(red, green, blue) * 2;
|
|
1235
|
+
if (value === 0) {
|
|
1236
|
+
return 30;
|
|
1237
|
+
}
|
|
1238
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
1239
|
+
if (value === 2) {
|
|
1240
|
+
result += 60;
|
|
1241
|
+
}
|
|
1242
|
+
return result;
|
|
1243
|
+
},
|
|
1244
|
+
enumerable: false
|
|
1245
|
+
},
|
|
1246
|
+
rgbToAnsi: {
|
|
1247
|
+
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
1248
|
+
enumerable: false
|
|
1249
|
+
},
|
|
1250
|
+
hexToAnsi: {
|
|
1251
|
+
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
1252
|
+
enumerable: false
|
|
1253
|
+
}
|
|
1254
|
+
});
|
|
1255
|
+
return styles;
|
|
1256
|
+
}
|
|
1257
|
+
var ansiStyles = assembleStyles();
|
|
1258
|
+
var ansi_styles_default = ansiStyles;
|
|
1259
|
+
|
|
1260
|
+
// ../../node_modules/.bun/wrap-ansi@9.0.2/node_modules/wrap-ansi/index.js
|
|
1261
|
+
var ESCAPES = new Set([
|
|
1262
|
+
"\x1B",
|
|
1263
|
+
""
|
|
1264
|
+
]);
|
|
1265
|
+
var END_CODE = 39;
|
|
1266
|
+
var ANSI_ESCAPE_BELL = "\x07";
|
|
1267
|
+
var ANSI_CSI = "[";
|
|
1268
|
+
var ANSI_OSC = "]";
|
|
1269
|
+
var ANSI_SGR_TERMINATOR = "m";
|
|
1270
|
+
var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
1271
|
+
var wrapAnsiCode = (code) => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
1272
|
+
var wrapAnsiHyperlink = (url) => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
1273
|
+
var wordLengths = (string) => string.split(" ").map((character) => stringWidth(character));
|
|
1274
|
+
var wrapWord = (rows, word, columns) => {
|
|
1275
|
+
const characters = [...word];
|
|
1276
|
+
let isInsideEscape = false;
|
|
1277
|
+
let isInsideLinkEscape = false;
|
|
1278
|
+
let visible = stringWidth(stripAnsi(rows.at(-1)));
|
|
1279
|
+
for (const [index, character] of characters.entries()) {
|
|
1280
|
+
const characterLength = stringWidth(character);
|
|
1281
|
+
if (visible + characterLength <= columns) {
|
|
1282
|
+
rows[rows.length - 1] += character;
|
|
1283
|
+
} else {
|
|
1284
|
+
rows.push(character);
|
|
1285
|
+
visible = 0;
|
|
1286
|
+
}
|
|
1287
|
+
if (ESCAPES.has(character)) {
|
|
1288
|
+
isInsideEscape = true;
|
|
1289
|
+
const ansiEscapeLinkCandidate = characters.slice(index + 1, index + 1 + ANSI_ESCAPE_LINK.length).join("");
|
|
1290
|
+
isInsideLinkEscape = ansiEscapeLinkCandidate === ANSI_ESCAPE_LINK;
|
|
1291
|
+
}
|
|
1292
|
+
if (isInsideEscape) {
|
|
1293
|
+
if (isInsideLinkEscape) {
|
|
1294
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
1295
|
+
isInsideEscape = false;
|
|
1296
|
+
isInsideLinkEscape = false;
|
|
1297
|
+
}
|
|
1298
|
+
} else if (character === ANSI_SGR_TERMINATOR) {
|
|
1299
|
+
isInsideEscape = false;
|
|
1300
|
+
}
|
|
1301
|
+
continue;
|
|
1302
|
+
}
|
|
1303
|
+
visible += characterLength;
|
|
1304
|
+
if (visible === columns && index < characters.length - 1) {
|
|
1305
|
+
rows.push("");
|
|
1306
|
+
visible = 0;
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
if (!visible && rows.at(-1).length > 0 && rows.length > 1) {
|
|
1310
|
+
rows[rows.length - 2] += rows.pop();
|
|
1311
|
+
}
|
|
1312
|
+
};
|
|
1313
|
+
var stringVisibleTrimSpacesRight = (string) => {
|
|
1314
|
+
const words = string.split(" ");
|
|
1315
|
+
let last = words.length;
|
|
1316
|
+
while (last > 0) {
|
|
1317
|
+
if (stringWidth(words[last - 1]) > 0) {
|
|
1318
|
+
break;
|
|
1319
|
+
}
|
|
1320
|
+
last--;
|
|
1321
|
+
}
|
|
1322
|
+
if (last === words.length) {
|
|
1323
|
+
return string;
|
|
1324
|
+
}
|
|
1325
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
1326
|
+
};
|
|
1327
|
+
var exec = (string, columns, options = {}) => {
|
|
1328
|
+
if (options.trim !== false && string.trim() === "") {
|
|
1329
|
+
return "";
|
|
1330
|
+
}
|
|
1331
|
+
let returnValue = "";
|
|
1332
|
+
let escapeCode;
|
|
1333
|
+
let escapeUrl;
|
|
1334
|
+
const lengths = wordLengths(string);
|
|
1335
|
+
let rows = [""];
|
|
1336
|
+
for (const [index, word] of string.split(" ").entries()) {
|
|
1337
|
+
if (options.trim !== false) {
|
|
1338
|
+
rows[rows.length - 1] = rows.at(-1).trimStart();
|
|
1339
|
+
}
|
|
1340
|
+
let rowLength = stringWidth(rows.at(-1));
|
|
1341
|
+
if (index !== 0) {
|
|
1342
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
1343
|
+
rows.push("");
|
|
1344
|
+
rowLength = 0;
|
|
1345
|
+
}
|
|
1346
|
+
if (rowLength > 0 || options.trim === false) {
|
|
1347
|
+
rows[rows.length - 1] += " ";
|
|
1348
|
+
rowLength++;
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
if (options.hard && lengths[index] > columns) {
|
|
1352
|
+
const remainingColumns = columns - rowLength;
|
|
1353
|
+
const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);
|
|
1354
|
+
const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);
|
|
1355
|
+
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
1356
|
+
rows.push("");
|
|
1357
|
+
}
|
|
1358
|
+
wrapWord(rows, word, columns);
|
|
1359
|
+
continue;
|
|
1360
|
+
}
|
|
1361
|
+
if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {
|
|
1362
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
1363
|
+
wrapWord(rows, word, columns);
|
|
1364
|
+
continue;
|
|
1365
|
+
}
|
|
1366
|
+
rows.push("");
|
|
1367
|
+
}
|
|
1368
|
+
if (rowLength + lengths[index] > columns && options.wordWrap === false) {
|
|
1369
|
+
wrapWord(rows, word, columns);
|
|
1370
|
+
continue;
|
|
1371
|
+
}
|
|
1372
|
+
rows[rows.length - 1] += word;
|
|
1373
|
+
}
|
|
1374
|
+
if (options.trim !== false) {
|
|
1375
|
+
rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
1376
|
+
}
|
|
1377
|
+
const preString = rows.join(`
|
|
1378
|
+
`);
|
|
1379
|
+
const pre = [...preString];
|
|
1380
|
+
let preStringIndex = 0;
|
|
1381
|
+
for (const [index, character] of pre.entries()) {
|
|
1382
|
+
returnValue += character;
|
|
1383
|
+
if (ESCAPES.has(character)) {
|
|
1384
|
+
const { groups } = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(preString.slice(preStringIndex)) || { groups: {} };
|
|
1385
|
+
if (groups.code !== undefined) {
|
|
1386
|
+
const code2 = Number.parseFloat(groups.code);
|
|
1387
|
+
escapeCode = code2 === END_CODE ? undefined : code2;
|
|
1388
|
+
} else if (groups.uri !== undefined) {
|
|
1389
|
+
escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
const code = ansi_styles_default.codes.get(Number(escapeCode));
|
|
1393
|
+
if (pre[index + 1] === `
|
|
1394
|
+
`) {
|
|
1395
|
+
if (escapeUrl) {
|
|
1396
|
+
returnValue += wrapAnsiHyperlink("");
|
|
1397
|
+
}
|
|
1398
|
+
if (escapeCode && code) {
|
|
1399
|
+
returnValue += wrapAnsiCode(code);
|
|
1400
|
+
}
|
|
1401
|
+
} else if (character === `
|
|
1402
|
+
`) {
|
|
1403
|
+
if (escapeCode && code) {
|
|
1404
|
+
returnValue += wrapAnsiCode(escapeCode);
|
|
1405
|
+
}
|
|
1406
|
+
if (escapeUrl) {
|
|
1407
|
+
returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
preStringIndex += character.length;
|
|
1411
|
+
}
|
|
1412
|
+
return returnValue;
|
|
1413
|
+
};
|
|
1414
|
+
function wrapAnsi(string, columns, options) {
|
|
1415
|
+
return String(string).normalize().replaceAll(`\r
|
|
1416
|
+
`, `
|
|
1417
|
+
`).split(`
|
|
1418
|
+
`).map((line) => exec(line, columns, options)).join(`
|
|
1419
|
+
`);
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
// ../../node_modules/.bun/is-fullwidth-code-point@5.1.0/node_modules/is-fullwidth-code-point/index.js
|
|
1423
|
+
function isFullwidthCodePoint(codePoint) {
|
|
1424
|
+
if (!Number.isInteger(codePoint)) {
|
|
1425
|
+
return false;
|
|
1426
|
+
}
|
|
1427
|
+
return isFullWidth(codePoint) || isWide(codePoint);
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
// ../../node_modules/.bun/slice-ansi@7.1.2/node_modules/slice-ansi/index.js
|
|
1431
|
+
var ESCAPES2 = new Set([27, 155]);
|
|
1432
|
+
var CODE_POINT_0 = "0".codePointAt(0);
|
|
1433
|
+
var CODE_POINT_9 = "9".codePointAt(0);
|
|
1434
|
+
var MAX_ANSI_SEQUENCE_LENGTH = 19;
|
|
1435
|
+
var endCodesSet = new Set;
|
|
1436
|
+
var endCodesMap = new Map;
|
|
1437
|
+
for (const [start, end] of ansi_styles_default.codes) {
|
|
1438
|
+
endCodesSet.add(ansi_styles_default.color.ansi(end));
|
|
1439
|
+
endCodesMap.set(ansi_styles_default.color.ansi(start), ansi_styles_default.color.ansi(end));
|
|
1440
|
+
}
|
|
1441
|
+
function getEndCode(code) {
|
|
1442
|
+
if (endCodesSet.has(code)) {
|
|
1443
|
+
return code;
|
|
1444
|
+
}
|
|
1445
|
+
if (endCodesMap.has(code)) {
|
|
1446
|
+
return endCodesMap.get(code);
|
|
1447
|
+
}
|
|
1448
|
+
code = code.slice(2);
|
|
1449
|
+
if (code.includes(";")) {
|
|
1450
|
+
code = code[0] + "0";
|
|
1451
|
+
}
|
|
1452
|
+
const returnValue = ansi_styles_default.codes.get(Number.parseInt(code, 10));
|
|
1453
|
+
if (returnValue) {
|
|
1454
|
+
return ansi_styles_default.color.ansi(returnValue);
|
|
1455
|
+
}
|
|
1456
|
+
return ansi_styles_default.reset.open;
|
|
1457
|
+
}
|
|
1458
|
+
function findNumberIndex(string) {
|
|
1459
|
+
for (let index = 0;index < string.length; index++) {
|
|
1460
|
+
const codePoint = string.codePointAt(index);
|
|
1461
|
+
if (codePoint >= CODE_POINT_0 && codePoint <= CODE_POINT_9) {
|
|
1462
|
+
return index;
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
return -1;
|
|
1466
|
+
}
|
|
1467
|
+
function parseAnsiCode(string, offset) {
|
|
1468
|
+
string = string.slice(offset, offset + MAX_ANSI_SEQUENCE_LENGTH);
|
|
1469
|
+
const startIndex = findNumberIndex(string);
|
|
1470
|
+
if (startIndex !== -1) {
|
|
1471
|
+
let endIndex = string.indexOf("m", startIndex);
|
|
1472
|
+
if (endIndex === -1) {
|
|
1473
|
+
endIndex = string.length;
|
|
1474
|
+
}
|
|
1475
|
+
return string.slice(0, endIndex + 1);
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
function tokenize(string, endCharacter = Number.POSITIVE_INFINITY) {
|
|
1479
|
+
const returnValue = [];
|
|
1480
|
+
let index = 0;
|
|
1481
|
+
let visibleCount = 0;
|
|
1482
|
+
while (index < string.length) {
|
|
1483
|
+
const codePoint = string.codePointAt(index);
|
|
1484
|
+
if (ESCAPES2.has(codePoint)) {
|
|
1485
|
+
const code = parseAnsiCode(string, index);
|
|
1486
|
+
if (code) {
|
|
1487
|
+
returnValue.push({
|
|
1488
|
+
type: "ansi",
|
|
1489
|
+
code,
|
|
1490
|
+
endCode: getEndCode(code)
|
|
1491
|
+
});
|
|
1492
|
+
index += code.length;
|
|
1493
|
+
continue;
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
const isFullWidth2 = isFullwidthCodePoint(codePoint);
|
|
1497
|
+
const character = String.fromCodePoint(codePoint);
|
|
1498
|
+
returnValue.push({
|
|
1499
|
+
type: "character",
|
|
1500
|
+
value: character,
|
|
1501
|
+
isFullWidth: isFullWidth2
|
|
1502
|
+
});
|
|
1503
|
+
index += character.length;
|
|
1504
|
+
visibleCount += isFullWidth2 ? 2 : character.length;
|
|
1505
|
+
if (visibleCount >= endCharacter) {
|
|
1506
|
+
break;
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
return returnValue;
|
|
1510
|
+
}
|
|
1511
|
+
function reduceAnsiCodes(codes) {
|
|
1512
|
+
let returnValue = [];
|
|
1513
|
+
for (const code of codes) {
|
|
1514
|
+
if (code.code === ansi_styles_default.reset.open) {
|
|
1515
|
+
returnValue = [];
|
|
1516
|
+
} else if (endCodesSet.has(code.code)) {
|
|
1517
|
+
returnValue = returnValue.filter((returnValueCode) => returnValueCode.endCode !== code.code);
|
|
1518
|
+
} else {
|
|
1519
|
+
returnValue = returnValue.filter((returnValueCode) => returnValueCode.endCode !== code.endCode);
|
|
1520
|
+
returnValue.push(code);
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
return returnValue;
|
|
1524
|
+
}
|
|
1525
|
+
function undoAnsiCodes(codes) {
|
|
1526
|
+
const reduced = reduceAnsiCodes(codes);
|
|
1527
|
+
const endCodes = reduced.map(({ endCode }) => endCode);
|
|
1528
|
+
return endCodes.reverse().join("");
|
|
1529
|
+
}
|
|
1530
|
+
function sliceAnsi(string, start, end) {
|
|
1531
|
+
const tokens = tokenize(string, end);
|
|
1532
|
+
let activeCodes = [];
|
|
1533
|
+
let position = 0;
|
|
1534
|
+
let returnValue = "";
|
|
1535
|
+
let include = false;
|
|
1536
|
+
for (const token of tokens) {
|
|
1537
|
+
if (end !== undefined && position >= end) {
|
|
1538
|
+
break;
|
|
1539
|
+
}
|
|
1540
|
+
if (token.type === "ansi") {
|
|
1541
|
+
activeCodes.push(token);
|
|
1542
|
+
if (include) {
|
|
1543
|
+
returnValue += token.code;
|
|
1544
|
+
}
|
|
1545
|
+
} else {
|
|
1546
|
+
if (!include && position >= start) {
|
|
1547
|
+
include = true;
|
|
1548
|
+
activeCodes = reduceAnsiCodes(activeCodes);
|
|
1549
|
+
returnValue = activeCodes.map(({ code }) => code).join("");
|
|
1550
|
+
}
|
|
1551
|
+
if (include) {
|
|
1552
|
+
returnValue += token.value;
|
|
1553
|
+
}
|
|
1554
|
+
position += token.isFullWidth ? 2 : token.value.length;
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
returnValue += undoAnsiCodes(activeCodes);
|
|
1558
|
+
return returnValue;
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
// ../../node_modules/.bun/log-update@6.1.0/node_modules/log-update/index.js
|
|
1562
|
+
var defaultTerminalHeight = 24;
|
|
1563
|
+
var getWidth = ({ columns = 80 }) => columns;
|
|
1564
|
+
var fitToTerminalHeight = (stream, text) => {
|
|
1565
|
+
const terminalHeight = stream.rows ?? defaultTerminalHeight;
|
|
1566
|
+
const lines = text.split(`
|
|
1567
|
+
`);
|
|
1568
|
+
const toRemove = Math.max(0, lines.length - terminalHeight);
|
|
1569
|
+
return toRemove ? sliceAnsi(text, stripAnsi(lines.slice(0, toRemove).join(`
|
|
1570
|
+
`)).length + 1) : text;
|
|
1571
|
+
};
|
|
1572
|
+
function createLogUpdate(stream, { showCursor = false } = {}) {
|
|
1573
|
+
let previousLineCount = 0;
|
|
1574
|
+
let previousWidth = getWidth(stream);
|
|
1575
|
+
let previousOutput = "";
|
|
1576
|
+
const reset = () => {
|
|
1577
|
+
previousOutput = "";
|
|
1578
|
+
previousWidth = getWidth(stream);
|
|
1579
|
+
previousLineCount = 0;
|
|
1580
|
+
};
|
|
1581
|
+
const render = (...arguments_) => {
|
|
1582
|
+
if (!showCursor) {
|
|
1583
|
+
cli_cursor_default.hide();
|
|
1584
|
+
}
|
|
1585
|
+
let output = fitToTerminalHeight(stream, arguments_.join(" ") + `
|
|
1586
|
+
`);
|
|
1587
|
+
const width = getWidth(stream);
|
|
1588
|
+
if (output === previousOutput && previousWidth === width) {
|
|
1589
|
+
return;
|
|
1590
|
+
}
|
|
1591
|
+
previousOutput = output;
|
|
1592
|
+
previousWidth = width;
|
|
1593
|
+
output = wrapAnsi(output, width, { trim: false, hard: true, wordWrap: false });
|
|
1594
|
+
stream.write(exports_base.eraseLines(previousLineCount) + output);
|
|
1595
|
+
previousLineCount = output.split(`
|
|
1596
|
+
`).length;
|
|
1597
|
+
};
|
|
1598
|
+
render.clear = () => {
|
|
1599
|
+
stream.write(exports_base.eraseLines(previousLineCount));
|
|
1600
|
+
reset();
|
|
1601
|
+
};
|
|
1602
|
+
render.done = () => {
|
|
1603
|
+
reset();
|
|
1604
|
+
if (!showCursor) {
|
|
1605
|
+
cli_cursor_default.show();
|
|
1606
|
+
}
|
|
1607
|
+
};
|
|
1608
|
+
return render;
|
|
1609
|
+
}
|
|
1610
|
+
var logUpdate = createLogUpdate(process9.stdout);
|
|
1611
|
+
var logUpdateStderr = createLogUpdate(process9.stderr);
|
|
1612
|
+
|
|
1613
|
+
// src/style.ts
|
|
1614
|
+
import { styleText } from "node:util";
|
|
1615
|
+
function style(format, text, out) {
|
|
1616
|
+
if (!out.supportsColor)
|
|
1617
|
+
return text;
|
|
1618
|
+
return styleText(format, text, { stream: out.stream });
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
// src/table-model.ts
|
|
1622
|
+
function compareByAvg(a, b) {
|
|
1623
|
+
if (a.avg === null && b.avg === null)
|
|
1624
|
+
return 0;
|
|
1625
|
+
if (a.avg === null)
|
|
1626
|
+
return 1;
|
|
1627
|
+
if (b.avg === null)
|
|
1628
|
+
return -1;
|
|
1629
|
+
return a.avg - b.avg;
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
class TableModel {
|
|
1633
|
+
rows;
|
|
1634
|
+
constructor(providers) {
|
|
1635
|
+
this.rows = providers.map((p) => ({ status: "pending", name: p.name }));
|
|
1636
|
+
}
|
|
1637
|
+
update(result) {
|
|
1638
|
+
const idx = this.rows.findIndex((r) => r.status === "pending" && r.name === result.name);
|
|
1639
|
+
if (idx !== -1) {
|
|
1640
|
+
this.rows[idx] = { status: "done", result };
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
sortedRows() {
|
|
1644
|
+
const done = this.rows.filter((r) => r.status === "done");
|
|
1645
|
+
const pending = this.rows.filter((r) => r.status === "pending");
|
|
1646
|
+
done.sort((a, b) => compareByAvg(a.result, b.result));
|
|
1647
|
+
return [...done, ...pending];
|
|
1648
|
+
}
|
|
1649
|
+
pendingCount() {
|
|
1650
|
+
return this.rows.filter((r) => r.status === "pending").length;
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
// src/live-table.ts
|
|
1655
|
+
var BOUNCE_INNER = 4;
|
|
1656
|
+
var BOUNCE_PERIOD = BOUNCE_INNER * 2;
|
|
1657
|
+
function bouncingBar(frame, out) {
|
|
1658
|
+
const t = frame % BOUNCE_PERIOD;
|
|
1659
|
+
const pos = t <= BOUNCE_INNER ? t : BOUNCE_PERIOD - t;
|
|
1660
|
+
const inner = " ".repeat(pos) + "●" + " ".repeat(BOUNCE_INNER - pos);
|
|
1661
|
+
return style("dim", `[${inner}]`, out);
|
|
1662
|
+
}
|
|
1663
|
+
function formatResult(result, out) {
|
|
1664
|
+
const ip = result.name === result.resolver ? "" : ` ${style("gray", `(${result.resolver})`, out)}`;
|
|
1665
|
+
const label = `${result.name}${ip}`;
|
|
1666
|
+
if (result.avg === null) {
|
|
1667
|
+
return `${label}: ${style("red", "failed", out)}`;
|
|
1668
|
+
}
|
|
1669
|
+
const value = `${result.avg.toFixed(2)}ms`;
|
|
1670
|
+
const colored = result.avg < 10 ? style("green", value, out) : result.avg < 50 ? style("yellow", value, out) : style("red", value, out);
|
|
1671
|
+
return `${label}: ${colored}`;
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
class LiveTable {
|
|
1675
|
+
model;
|
|
1676
|
+
frame = 0;
|
|
1677
|
+
interval = null;
|
|
1678
|
+
out;
|
|
1679
|
+
err;
|
|
1680
|
+
logger;
|
|
1681
|
+
constructor(providers, out, err) {
|
|
1682
|
+
this.model = new TableModel(providers);
|
|
1683
|
+
this.out = out;
|
|
1684
|
+
this.err = err;
|
|
1685
|
+
this.logger = createLogUpdate(err.stream);
|
|
1686
|
+
}
|
|
1687
|
+
start() {
|
|
1688
|
+
if (this.err.stream.isTTY) {
|
|
1689
|
+
this.redraw();
|
|
1690
|
+
this.interval = setInterval(() => {
|
|
1691
|
+
this.frame++;
|
|
1692
|
+
this.redraw();
|
|
1693
|
+
}, 80);
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
update(result) {
|
|
1697
|
+
this.model.update(result);
|
|
1698
|
+
if (this.err.stream.isTTY) {
|
|
1699
|
+
this.redraw();
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
redraw() {
|
|
1703
|
+
const pendingCount = this.model.pendingCount();
|
|
1704
|
+
const footer = pendingCount > 0 ? style("dim", " Testing...", this.err) : ` ${style("green", "✓", this.err)} ${style("bold", "Done", this.err)}`;
|
|
1705
|
+
const bar = bouncingBar(this.frame, this.err);
|
|
1706
|
+
const lines = [];
|
|
1707
|
+
for (const row of this.model.sortedRows()) {
|
|
1708
|
+
if (row.status === "done") {
|
|
1709
|
+
lines.push(` ${formatResult(row.result, this.err)}`);
|
|
1710
|
+
} else {
|
|
1711
|
+
lines.push(` ${row.name} ${bar}`);
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
lines.push("", footer);
|
|
1715
|
+
this.logger(lines.join(`
|
|
1716
|
+
`));
|
|
1717
|
+
}
|
|
1718
|
+
stop() {
|
|
1719
|
+
if (this.interval) {
|
|
1720
|
+
clearInterval(this.interval);
|
|
1721
|
+
this.interval = null;
|
|
1722
|
+
}
|
|
1723
|
+
if (this.err.stream.isTTY) {
|
|
1724
|
+
this.logger.clear();
|
|
1725
|
+
this.logger.done();
|
|
1726
|
+
}
|
|
1727
|
+
for (const row of this.model.sortedRows()) {
|
|
1728
|
+
if (row.status === "done") {
|
|
1729
|
+
this.out.stream.write(` ${formatResult(row.result, this.out)}
|
|
1730
|
+
`);
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
this.err.stream.write(`
|
|
1734
|
+
${style("green", "✓", this.err)} ${style("bold", "Done", this.err)}
|
|
1735
|
+
`);
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
// package.json
|
|
1739
|
+
var version = "0.1.0";
|
|
1740
|
+
|
|
1741
|
+
// src/logo.ts
|
|
1742
|
+
var COLOR_SPLIT_COLUMN = 18;
|
|
1743
|
+
var LOGO_BLOCK = `
|
|
1744
|
+
▄▄
|
|
1745
|
+
██
|
|
1746
|
+
▄████ ████▄ ▄█▀▀▀ ▄████ ███▄███▄ ████▄
|
|
1747
|
+
██ ██ ██ ██ ▀███▄ ██ ██ ██ ██ ██ ██
|
|
1748
|
+
▀████ ██ ██ ▄▄▄█▀ ▀████ ██ ██ ██ ████▀
|
|
1749
|
+
github.com/oBusk/dnscmp ${`v${version}`.padStart(8)} ██
|
|
1750
|
+
▀▀
|
|
1751
|
+
`;
|
|
1752
|
+
var LINK_TEXT = "github.com/oBusk/dnscmp";
|
|
1753
|
+
var LINK_URL = "https://github.com/oBusk/dnscmp";
|
|
1754
|
+
function toTerminalLink(text, url) {
|
|
1755
|
+
return `\x1B]8;;${url}\x07${text}\x1B]8;;\x07`;
|
|
1756
|
+
}
|
|
1757
|
+
function colorBySplit(text, startColumn, out) {
|
|
1758
|
+
if (text.length === 0)
|
|
1759
|
+
return "";
|
|
1760
|
+
const endColumn = startColumn + text.length;
|
|
1761
|
+
if (endColumn <= COLOR_SPLIT_COLUMN) {
|
|
1762
|
+
return style("gray", text, out);
|
|
1763
|
+
}
|
|
1764
|
+
if (startColumn >= COLOR_SPLIT_COLUMN) {
|
|
1765
|
+
return style("cyan", text, out);
|
|
1766
|
+
}
|
|
1767
|
+
const leftLen = COLOR_SPLIT_COLUMN - startColumn;
|
|
1768
|
+
return style("gray", text.slice(0, leftLen), out) + style("cyan", text.slice(leftLen), out);
|
|
1769
|
+
}
|
|
1770
|
+
function buildLogo(out) {
|
|
1771
|
+
const normalized = LOGO_BLOCK.replace(/^\n/, "").replace(/\n$/, "");
|
|
1772
|
+
const hyperlinkText = out.supportsHyperlinks ? toTerminalLink(LINK_TEXT, LINK_URL) : LINK_TEXT;
|
|
1773
|
+
const hyperlink = style("gray", hyperlinkText, out);
|
|
1774
|
+
const lines = normalized.split(`
|
|
1775
|
+
`).map((line) => {
|
|
1776
|
+
if (!out.stream.isTTY) {
|
|
1777
|
+
return line.replace(LINK_TEXT, hyperlink);
|
|
1778
|
+
}
|
|
1779
|
+
const linkIndex = line.indexOf(LINK_TEXT);
|
|
1780
|
+
if (linkIndex === -1) {
|
|
1781
|
+
return colorBySplit(line, 0, out);
|
|
1782
|
+
}
|
|
1783
|
+
const before = line.slice(0, linkIndex);
|
|
1784
|
+
const after = line.slice(linkIndex + LINK_TEXT.length);
|
|
1785
|
+
return colorBySplit(before, 0, out) + hyperlink + colorBySplit(after, linkIndex + LINK_TEXT.length, out);
|
|
1786
|
+
});
|
|
1787
|
+
return `
|
|
1788
|
+
` + lines.join(`
|
|
1789
|
+
`) + `
|
|
1790
|
+
`;
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
// src/index.ts
|
|
1794
|
+
function makeOutputStream(stream) {
|
|
1795
|
+
return {
|
|
1796
|
+
stream,
|
|
1797
|
+
supportsColor: !!createSupportsColor(stream),
|
|
1798
|
+
supportsHyperlinks: createSupportsHyperlinks(stream) || process.env.TERM_PROGRAM === "vscode"
|
|
1799
|
+
};
|
|
1800
|
+
}
|
|
1801
|
+
var out = makeOutputStream(process.stdout);
|
|
1802
|
+
var err = makeOutputStream(process.stderr);
|
|
1803
|
+
var { values, positionals } = parseArgs({
|
|
1804
|
+
args: process.argv.slice(2),
|
|
1805
|
+
options: {
|
|
1806
|
+
defaults: { type: "boolean", short: "d", default: false },
|
|
1807
|
+
file: { type: "string", short: "f" },
|
|
1808
|
+
help: { type: "boolean", short: "h", default: false }
|
|
1809
|
+
},
|
|
1810
|
+
allowPositionals: true
|
|
1811
|
+
});
|
|
1812
|
+
if (values.help) {
|
|
1813
|
+
printHelp(err);
|
|
75
1814
|
process.exit(0);
|
|
76
1815
|
}
|
|
1816
|
+
err.stream.write(buildLogo(err) + `
|
|
1817
|
+
`);
|
|
77
1818
|
var hasExplicitInput = positionals.length > 0 || values.file != null;
|
|
78
1819
|
var input = [];
|
|
79
1820
|
if (!hasExplicitInput || values.defaults) {
|
|
@@ -87,11 +1828,19 @@ if (values.file != null) {
|
|
|
87
1828
|
for (const ip of positionals) {
|
|
88
1829
|
input.push({ name: ip, resolvers: [ip] });
|
|
89
1830
|
}
|
|
90
|
-
var
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
1831
|
+
var table = new LiveTable(input, out, err);
|
|
1832
|
+
table.start();
|
|
1833
|
+
await dnscmp({
|
|
1834
|
+
providers: input,
|
|
1835
|
+
onResult: (result) => table.update(result)
|
|
1836
|
+
});
|
|
1837
|
+
table.stop();
|
|
1838
|
+
if (process.stdin.isTTY && isOwnedConsole()) {
|
|
1839
|
+
process.stdout.write(`
|
|
1840
|
+
Press any key to exit...`);
|
|
1841
|
+
process.stdin.setRawMode(true);
|
|
1842
|
+
process.stdin.resume();
|
|
1843
|
+
await new Promise((resolve) => process.stdin.once("data", resolve));
|
|
1844
|
+
process.stdout.write(`
|
|
95
1845
|
`);
|
|
96
1846
|
}
|
|
97
|
-
process.exit(0);
|