create-windy 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/cli.js +1879 -20
- package/package.json +5 -2
- package/template/.windy-template.json +2 -2
- package/template/_gitignore +7 -0
- /package/template/{bunfig.toml → _bunfig.toml} +0 -0
package/dist/cli.js
CHANGED
|
@@ -1,4 +1,197 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
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);
|
|
34
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
35
|
+
|
|
36
|
+
// ../../node_modules/.bun/cli-width@4.1.0/node_modules/cli-width/index.js
|
|
37
|
+
var require_cli_width = __commonJS((exports, module3) => {
|
|
38
|
+
module3.exports = cliWidth;
|
|
39
|
+
function normalizeOpts(options) {
|
|
40
|
+
const defaultOpts = {
|
|
41
|
+
defaultWidth: 0,
|
|
42
|
+
output: process.stdout,
|
|
43
|
+
tty: __require("tty")
|
|
44
|
+
};
|
|
45
|
+
if (!options) {
|
|
46
|
+
return defaultOpts;
|
|
47
|
+
}
|
|
48
|
+
Object.keys(defaultOpts).forEach(function(key) {
|
|
49
|
+
if (!options[key]) {
|
|
50
|
+
options[key] = defaultOpts[key];
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
return options;
|
|
54
|
+
}
|
|
55
|
+
function cliWidth(options) {
|
|
56
|
+
const opts = normalizeOpts(options);
|
|
57
|
+
if (opts.output.getWindowSize) {
|
|
58
|
+
return opts.output.getWindowSize()[0] || opts.defaultWidth;
|
|
59
|
+
}
|
|
60
|
+
if (opts.tty.getWindowSize) {
|
|
61
|
+
return opts.tty.getWindowSize()[1] || opts.defaultWidth;
|
|
62
|
+
}
|
|
63
|
+
if (opts.output.columns) {
|
|
64
|
+
return opts.output.columns;
|
|
65
|
+
}
|
|
66
|
+
if (process.env.CLI_WIDTH) {
|
|
67
|
+
const width = parseInt(process.env.CLI_WIDTH, 10);
|
|
68
|
+
if (!isNaN(width) && width !== 0) {
|
|
69
|
+
return width;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return opts.defaultWidth;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// ../../node_modules/.bun/mute-stream@3.0.0/node_modules/mute-stream/lib/index.js
|
|
77
|
+
var require_lib = __commonJS((exports, module3) => {
|
|
78
|
+
var Stream = __require("stream");
|
|
79
|
+
|
|
80
|
+
class MuteStream extends Stream {
|
|
81
|
+
#isTTY = null;
|
|
82
|
+
constructor(opts = {}) {
|
|
83
|
+
super(opts);
|
|
84
|
+
this.writable = this.readable = true;
|
|
85
|
+
this.muted = false;
|
|
86
|
+
this.on("pipe", this._onpipe);
|
|
87
|
+
this.replace = opts.replace;
|
|
88
|
+
this._prompt = opts.prompt || null;
|
|
89
|
+
this._hadControl = false;
|
|
90
|
+
}
|
|
91
|
+
#destSrc(key, def) {
|
|
92
|
+
if (this._dest) {
|
|
93
|
+
return this._dest[key];
|
|
94
|
+
}
|
|
95
|
+
if (this._src) {
|
|
96
|
+
return this._src[key];
|
|
97
|
+
}
|
|
98
|
+
return def;
|
|
99
|
+
}
|
|
100
|
+
#proxy(method, ...args) {
|
|
101
|
+
if (typeof this._dest?.[method] === "function") {
|
|
102
|
+
this._dest[method](...args);
|
|
103
|
+
}
|
|
104
|
+
if (typeof this._src?.[method] === "function") {
|
|
105
|
+
this._src[method](...args);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
get isTTY() {
|
|
109
|
+
if (this.#isTTY !== null) {
|
|
110
|
+
return this.#isTTY;
|
|
111
|
+
}
|
|
112
|
+
return this.#destSrc("isTTY", false);
|
|
113
|
+
}
|
|
114
|
+
set isTTY(val) {
|
|
115
|
+
this.#isTTY = val;
|
|
116
|
+
}
|
|
117
|
+
get rows() {
|
|
118
|
+
return this.#destSrc("rows");
|
|
119
|
+
}
|
|
120
|
+
get columns() {
|
|
121
|
+
return this.#destSrc("columns");
|
|
122
|
+
}
|
|
123
|
+
mute() {
|
|
124
|
+
this.muted = true;
|
|
125
|
+
}
|
|
126
|
+
unmute() {
|
|
127
|
+
this.muted = false;
|
|
128
|
+
}
|
|
129
|
+
_onpipe(src) {
|
|
130
|
+
this._src = src;
|
|
131
|
+
}
|
|
132
|
+
pipe(dest, options) {
|
|
133
|
+
this._dest = dest;
|
|
134
|
+
return super.pipe(dest, options);
|
|
135
|
+
}
|
|
136
|
+
pause() {
|
|
137
|
+
if (this._src) {
|
|
138
|
+
return this._src.pause();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
resume() {
|
|
142
|
+
if (this._src) {
|
|
143
|
+
return this._src.resume();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
write(c) {
|
|
147
|
+
if (this.muted) {
|
|
148
|
+
if (!this.replace) {
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
if (c.match(/^\u001b/)) {
|
|
152
|
+
if (c.indexOf(this._prompt) === 0) {
|
|
153
|
+
c = c.slice(this._prompt.length);
|
|
154
|
+
c = c.replace(/./g, this.replace);
|
|
155
|
+
c = this._prompt + c;
|
|
156
|
+
}
|
|
157
|
+
this._hadControl = true;
|
|
158
|
+
return this.emit("data", c);
|
|
159
|
+
} else {
|
|
160
|
+
if (this._prompt && this._hadControl && c.indexOf(this._prompt) === 0) {
|
|
161
|
+
this._hadControl = false;
|
|
162
|
+
this.emit("data", this._prompt);
|
|
163
|
+
c = c.slice(this._prompt.length);
|
|
164
|
+
}
|
|
165
|
+
c = c.toString().replace(/./g, this.replace);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
this.emit("data", c);
|
|
169
|
+
}
|
|
170
|
+
end(c) {
|
|
171
|
+
if (this.muted) {
|
|
172
|
+
if (c && this.replace) {
|
|
173
|
+
c = c.toString().replace(/./g, this.replace);
|
|
174
|
+
} else {
|
|
175
|
+
c = null;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (c) {
|
|
179
|
+
this.emit("data", c);
|
|
180
|
+
}
|
|
181
|
+
this.emit("end");
|
|
182
|
+
}
|
|
183
|
+
destroy(...args) {
|
|
184
|
+
return this.#proxy("destroy", ...args);
|
|
185
|
+
}
|
|
186
|
+
destroySoon(...args) {
|
|
187
|
+
return this.#proxy("destroySoon", ...args);
|
|
188
|
+
}
|
|
189
|
+
close(...args) {
|
|
190
|
+
return this.#proxy("close", ...args);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
module3.exports = MuteStream;
|
|
194
|
+
});
|
|
2
195
|
|
|
3
196
|
// src/arguments.ts
|
|
4
197
|
import { resolve } from "node:path";
|
|
@@ -1307,6 +1500,10 @@ var templatePaths = [
|
|
|
1307
1500
|
...templateDirectories,
|
|
1308
1501
|
...templateDocumentationFiles
|
|
1309
1502
|
];
|
|
1503
|
+
var npmTemplateAliases = {
|
|
1504
|
+
".gitignore": "_gitignore",
|
|
1505
|
+
"bunfig.toml": "_bunfig.toml"
|
|
1506
|
+
};
|
|
1310
1507
|
function generationTemplatePaths(includeExample, includeOxc = true) {
|
|
1311
1508
|
return templatePaths.filter((path) => (includeExample || path !== "packages/example-work-order") && (includeOxc || path !== ".oxfmtrc.json" && path !== ".oxlintrc.json"));
|
|
1312
1509
|
}
|
|
@@ -1392,7 +1589,7 @@ async function generateProject(input) {
|
|
|
1392
1589
|
const templateMetadata = await readTemplateMetadata(input.sourceRoot);
|
|
1393
1590
|
const selectedModules = input.selectedModules ?? templateMetadata.modules.filter(({ name }) => includeExample || name !== "work-order").map(({ name }) => name);
|
|
1394
1591
|
for (const relativePath2 of generationTemplatePaths(true, includeOxc)) {
|
|
1395
|
-
await copyTree(
|
|
1592
|
+
await copyTree(await resolveTemplateSource(input.sourceRoot, relativePath2), join7(input.targetDirectory, relativePath2));
|
|
1396
1593
|
}
|
|
1397
1594
|
await materializeSelectedModules(input.targetDirectory, selectedModules);
|
|
1398
1595
|
const packagePath = join7(input.targetDirectory, "package.json");
|
|
@@ -1410,6 +1607,20 @@ async function generateProject(input) {
|
|
|
1410
1607
|
await rm3(join7(input.targetDirectory, "bun.lock"), { force: true });
|
|
1411
1608
|
await writeManagedFilesManifest(input.targetDirectory, templateMetadata.generatorVersion);
|
|
1412
1609
|
}
|
|
1610
|
+
async function resolveTemplateSource(sourceRoot, relativePath2) {
|
|
1611
|
+
const source = join7(sourceRoot, relativePath2);
|
|
1612
|
+
try {
|
|
1613
|
+
await lstat3(source);
|
|
1614
|
+
return source;
|
|
1615
|
+
} catch (error) {
|
|
1616
|
+
if (!isMissing2(error))
|
|
1617
|
+
throw error;
|
|
1618
|
+
}
|
|
1619
|
+
const alias = npmTemplateAliases[relativePath2];
|
|
1620
|
+
if (!alias)
|
|
1621
|
+
return source;
|
|
1622
|
+
return join7(sourceRoot, alias);
|
|
1623
|
+
}
|
|
1413
1624
|
async function assertGeneratedProjectIsClean(targetDirectory) {
|
|
1414
1625
|
const violations = [];
|
|
1415
1626
|
await walk(targetDirectory, async (path) => {
|
|
@@ -1561,8 +1772,1655 @@ function isMissing3(error) {
|
|
|
1561
1772
|
}
|
|
1562
1773
|
|
|
1563
1774
|
// src/interactive-selection.ts
|
|
1564
|
-
import { createInterface } from "node:readline/promises";
|
|
1775
|
+
import { createInterface as createInterface2 } from "node:readline/promises";
|
|
1565
1776
|
import { stdin, stdout } from "node:process";
|
|
1777
|
+
|
|
1778
|
+
// ../../node_modules/.bun/@inquirer+core@11.2.1+e154a6929a67600d/node_modules/@inquirer/core/dist/lib/key.js
|
|
1779
|
+
var keybindings = ["emacs", "vim"];
|
|
1780
|
+
var keybindingLookup = new Set(keybindings);
|
|
1781
|
+
function isKeybinding(value) {
|
|
1782
|
+
return keybindingLookup.has(value);
|
|
1783
|
+
}
|
|
1784
|
+
function getDefaultKeybindings() {
|
|
1785
|
+
const env = process.env["INQUIRER_KEYBINDINGS"];
|
|
1786
|
+
if (!env)
|
|
1787
|
+
return [];
|
|
1788
|
+
return Array.from(new Set(env.toLowerCase().split(/[\s,]+/).filter(isKeybinding)));
|
|
1789
|
+
}
|
|
1790
|
+
var isUpKey = (key, keybindings2 = []) => key.name === "up" || keybindings2.includes("vim") && key.name === "k" || keybindings2.includes("emacs") && key.ctrl && key.name === "p";
|
|
1791
|
+
var isDownKey = (key, keybindings2 = []) => key.name === "down" || keybindings2.includes("vim") && key.name === "j" || keybindings2.includes("emacs") && key.ctrl && key.name === "n";
|
|
1792
|
+
var isSpaceKey = (key) => key.name === "space";
|
|
1793
|
+
var isNumberKey = (key) => "1234567890".includes(key.name);
|
|
1794
|
+
var isEnterKey = (key) => key.name === "enter" || key.name === "return";
|
|
1795
|
+
// ../../node_modules/.bun/@inquirer+core@11.2.1+e154a6929a67600d/node_modules/@inquirer/core/dist/lib/errors.js
|
|
1796
|
+
class AbortPromptError extends Error {
|
|
1797
|
+
name = "AbortPromptError";
|
|
1798
|
+
message = "Prompt was aborted";
|
|
1799
|
+
constructor(options) {
|
|
1800
|
+
super();
|
|
1801
|
+
this.cause = options?.cause;
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1805
|
+
class CancelPromptError extends Error {
|
|
1806
|
+
name = "CancelPromptError";
|
|
1807
|
+
message = "Prompt was canceled";
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
class ExitPromptError extends Error {
|
|
1811
|
+
name = "ExitPromptError";
|
|
1812
|
+
}
|
|
1813
|
+
|
|
1814
|
+
class HookError extends Error {
|
|
1815
|
+
name = "HookError";
|
|
1816
|
+
}
|
|
1817
|
+
|
|
1818
|
+
class ValidationError extends Error {
|
|
1819
|
+
name = "ValidationError";
|
|
1820
|
+
}
|
|
1821
|
+
// ../../node_modules/.bun/@inquirer+core@11.2.1+e154a6929a67600d/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
1822
|
+
import { AsyncResource as AsyncResource2 } from "node:async_hooks";
|
|
1823
|
+
|
|
1824
|
+
// ../../node_modules/.bun/@inquirer+core@11.2.1+e154a6929a67600d/node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
1825
|
+
import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
|
|
1826
|
+
var hookStorage = new AsyncLocalStorage;
|
|
1827
|
+
function createStore(rl) {
|
|
1828
|
+
const store = {
|
|
1829
|
+
rl,
|
|
1830
|
+
hooks: [],
|
|
1831
|
+
hooksCleanup: [],
|
|
1832
|
+
hooksEffect: [],
|
|
1833
|
+
index: 0,
|
|
1834
|
+
handleChange() {}
|
|
1835
|
+
};
|
|
1836
|
+
return store;
|
|
1837
|
+
}
|
|
1838
|
+
function withHooks(rl, cb) {
|
|
1839
|
+
const store = createStore(rl);
|
|
1840
|
+
return hookStorage.run(store, () => {
|
|
1841
|
+
function cycle(render) {
|
|
1842
|
+
store.handleChange = () => {
|
|
1843
|
+
store.index = 0;
|
|
1844
|
+
render();
|
|
1845
|
+
};
|
|
1846
|
+
store.handleChange();
|
|
1847
|
+
}
|
|
1848
|
+
return cb(cycle);
|
|
1849
|
+
});
|
|
1850
|
+
}
|
|
1851
|
+
function getStore() {
|
|
1852
|
+
const store = hookStorage.getStore();
|
|
1853
|
+
if (!store) {
|
|
1854
|
+
throw new HookError("[Inquirer] Hook functions can only be called from within a prompt");
|
|
1855
|
+
}
|
|
1856
|
+
return store;
|
|
1857
|
+
}
|
|
1858
|
+
function readline() {
|
|
1859
|
+
return getStore().rl;
|
|
1860
|
+
}
|
|
1861
|
+
function withUpdates(fn) {
|
|
1862
|
+
const wrapped = (...args) => {
|
|
1863
|
+
const store = getStore();
|
|
1864
|
+
let shouldUpdate = false;
|
|
1865
|
+
const oldHandleChange = store.handleChange;
|
|
1866
|
+
store.handleChange = () => {
|
|
1867
|
+
shouldUpdate = true;
|
|
1868
|
+
};
|
|
1869
|
+
const returnValue = fn(...args);
|
|
1870
|
+
if (shouldUpdate) {
|
|
1871
|
+
oldHandleChange();
|
|
1872
|
+
}
|
|
1873
|
+
store.handleChange = oldHandleChange;
|
|
1874
|
+
return returnValue;
|
|
1875
|
+
};
|
|
1876
|
+
return AsyncResource.bind(wrapped);
|
|
1877
|
+
}
|
|
1878
|
+
function withPointer(cb) {
|
|
1879
|
+
const store = getStore();
|
|
1880
|
+
const { index } = store;
|
|
1881
|
+
const pointer = {
|
|
1882
|
+
get() {
|
|
1883
|
+
return store.hooks[index];
|
|
1884
|
+
},
|
|
1885
|
+
set(value) {
|
|
1886
|
+
store.hooks[index] = value;
|
|
1887
|
+
},
|
|
1888
|
+
initialized: index in store.hooks
|
|
1889
|
+
};
|
|
1890
|
+
const returnValue = cb(pointer);
|
|
1891
|
+
store.index++;
|
|
1892
|
+
return returnValue;
|
|
1893
|
+
}
|
|
1894
|
+
function handleChange() {
|
|
1895
|
+
getStore().handleChange();
|
|
1896
|
+
}
|
|
1897
|
+
var effectScheduler = {
|
|
1898
|
+
queue(cb) {
|
|
1899
|
+
const store = getStore();
|
|
1900
|
+
const { index } = store;
|
|
1901
|
+
store.hooksEffect.push(() => {
|
|
1902
|
+
store.hooksCleanup[index]?.();
|
|
1903
|
+
const cleanFn = cb(readline());
|
|
1904
|
+
if (cleanFn != null && typeof cleanFn !== "function") {
|
|
1905
|
+
throw new ValidationError("useEffect return value must be a cleanup function or nothing.");
|
|
1906
|
+
}
|
|
1907
|
+
store.hooksCleanup[index] = cleanFn;
|
|
1908
|
+
});
|
|
1909
|
+
},
|
|
1910
|
+
run() {
|
|
1911
|
+
const store = getStore();
|
|
1912
|
+
withUpdates(() => {
|
|
1913
|
+
store.hooksEffect.forEach((effect) => {
|
|
1914
|
+
effect();
|
|
1915
|
+
});
|
|
1916
|
+
store.hooksEffect.length = 0;
|
|
1917
|
+
})();
|
|
1918
|
+
},
|
|
1919
|
+
clearAll() {
|
|
1920
|
+
const store = getStore();
|
|
1921
|
+
store.hooksCleanup.forEach((cleanFn) => {
|
|
1922
|
+
cleanFn?.();
|
|
1923
|
+
});
|
|
1924
|
+
store.hooksEffect.length = 0;
|
|
1925
|
+
store.hooksCleanup.length = 0;
|
|
1926
|
+
}
|
|
1927
|
+
};
|
|
1928
|
+
|
|
1929
|
+
// ../../node_modules/.bun/@inquirer+core@11.2.1+e154a6929a67600d/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
1930
|
+
function isFactory(value) {
|
|
1931
|
+
return typeof value === "function";
|
|
1932
|
+
}
|
|
1933
|
+
function useState(defaultValue) {
|
|
1934
|
+
return withPointer((pointer) => {
|
|
1935
|
+
const setState = AsyncResource2.bind(function setState2(newValue) {
|
|
1936
|
+
if (pointer.get() !== newValue) {
|
|
1937
|
+
pointer.set(newValue);
|
|
1938
|
+
handleChange();
|
|
1939
|
+
}
|
|
1940
|
+
});
|
|
1941
|
+
if (pointer.initialized) {
|
|
1942
|
+
return [pointer.get(), setState];
|
|
1943
|
+
}
|
|
1944
|
+
const value = isFactory(defaultValue) ? defaultValue() : defaultValue;
|
|
1945
|
+
pointer.set(value);
|
|
1946
|
+
return [value, setState];
|
|
1947
|
+
});
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
// ../../node_modules/.bun/@inquirer+core@11.2.1+e154a6929a67600d/node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
1951
|
+
function useEffect(cb, depArray) {
|
|
1952
|
+
withPointer((pointer) => {
|
|
1953
|
+
const oldDeps = pointer.get();
|
|
1954
|
+
const hasChanged = !Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]));
|
|
1955
|
+
if (hasChanged) {
|
|
1956
|
+
effectScheduler.queue(cb);
|
|
1957
|
+
}
|
|
1958
|
+
pointer.set(depArray);
|
|
1959
|
+
});
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
// ../../node_modules/.bun/@inquirer+core@11.2.1+e154a6929a67600d/node_modules/@inquirer/core/dist/lib/theme.js
|
|
1963
|
+
import { styleText } from "node:util";
|
|
1964
|
+
|
|
1965
|
+
// ../../node_modules/.bun/@inquirer+figures@2.0.7/node_modules/@inquirer/figures/dist/index.js
|
|
1966
|
+
import process2 from "node:process";
|
|
1967
|
+
function isUnicodeSupported() {
|
|
1968
|
+
if (!process2.platform.startsWith("win")) {
|
|
1969
|
+
return process2.env["TERM"] !== "linux";
|
|
1970
|
+
}
|
|
1971
|
+
return Boolean(process2.env["CI"]) || Boolean(process2.env["WT_SESSION"]) || Boolean(process2.env["TERMINUS_SUBLIME"]) || process2.env["ConEmuTask"] === "{cmd::Cmder}" || process2.env["TERM_PROGRAM"] === "Terminus-Sublime" || process2.env["TERM_PROGRAM"] === "vscode" || process2.env["TERM"] === "xterm-256color" || process2.env["TERM"] === "alacritty" || process2.env["TERMINAL_EMULATOR"] === "JetBrains-JediTerm";
|
|
1972
|
+
}
|
|
1973
|
+
var common = {
|
|
1974
|
+
circleQuestionMark: "(?)",
|
|
1975
|
+
questionMarkPrefix: "(?)",
|
|
1976
|
+
square: "█",
|
|
1977
|
+
squareDarkShade: "▓",
|
|
1978
|
+
squareMediumShade: "▒",
|
|
1979
|
+
squareLightShade: "░",
|
|
1980
|
+
squareTop: "▀",
|
|
1981
|
+
squareBottom: "▄",
|
|
1982
|
+
squareLeft: "▌",
|
|
1983
|
+
squareRight: "▐",
|
|
1984
|
+
squareCenter: "■",
|
|
1985
|
+
bullet: "●",
|
|
1986
|
+
dot: "․",
|
|
1987
|
+
ellipsis: "…",
|
|
1988
|
+
pointerSmall: "›",
|
|
1989
|
+
triangleUp: "▲",
|
|
1990
|
+
triangleUpSmall: "▴",
|
|
1991
|
+
triangleDown: "▼",
|
|
1992
|
+
triangleDownSmall: "▾",
|
|
1993
|
+
triangleLeftSmall: "◂",
|
|
1994
|
+
triangleRightSmall: "▸",
|
|
1995
|
+
home: "⌂",
|
|
1996
|
+
heart: "♥",
|
|
1997
|
+
musicNote: "♪",
|
|
1998
|
+
musicNoteBeamed: "♫",
|
|
1999
|
+
arrowUp: "↑",
|
|
2000
|
+
arrowDown: "↓",
|
|
2001
|
+
arrowLeft: "←",
|
|
2002
|
+
arrowRight: "→",
|
|
2003
|
+
arrowLeftRight: "↔",
|
|
2004
|
+
arrowUpDown: "↕",
|
|
2005
|
+
almostEqual: "≈",
|
|
2006
|
+
notEqual: "≠",
|
|
2007
|
+
lessOrEqual: "≤",
|
|
2008
|
+
greaterOrEqual: "≥",
|
|
2009
|
+
identical: "≡",
|
|
2010
|
+
infinity: "∞",
|
|
2011
|
+
subscriptZero: "₀",
|
|
2012
|
+
subscriptOne: "₁",
|
|
2013
|
+
subscriptTwo: "₂",
|
|
2014
|
+
subscriptThree: "₃",
|
|
2015
|
+
subscriptFour: "₄",
|
|
2016
|
+
subscriptFive: "₅",
|
|
2017
|
+
subscriptSix: "₆",
|
|
2018
|
+
subscriptSeven: "₇",
|
|
2019
|
+
subscriptEight: "₈",
|
|
2020
|
+
subscriptNine: "₉",
|
|
2021
|
+
oneHalf: "½",
|
|
2022
|
+
oneThird: "⅓",
|
|
2023
|
+
oneQuarter: "¼",
|
|
2024
|
+
oneFifth: "⅕",
|
|
2025
|
+
oneSixth: "⅙",
|
|
2026
|
+
oneEighth: "⅛",
|
|
2027
|
+
twoThirds: "⅔",
|
|
2028
|
+
twoFifths: "⅖",
|
|
2029
|
+
threeQuarters: "¾",
|
|
2030
|
+
threeFifths: "⅗",
|
|
2031
|
+
threeEighths: "⅜",
|
|
2032
|
+
fourFifths: "⅘",
|
|
2033
|
+
fiveSixths: "⅚",
|
|
2034
|
+
fiveEighths: "⅝",
|
|
2035
|
+
sevenEighths: "⅞",
|
|
2036
|
+
line: "─",
|
|
2037
|
+
lineBold: "━",
|
|
2038
|
+
lineDouble: "═",
|
|
2039
|
+
lineDashed0: "┄",
|
|
2040
|
+
lineDashed1: "┅",
|
|
2041
|
+
lineDashed2: "┈",
|
|
2042
|
+
lineDashed3: "┉",
|
|
2043
|
+
lineDashed4: "╌",
|
|
2044
|
+
lineDashed5: "╍",
|
|
2045
|
+
lineDashed6: "╴",
|
|
2046
|
+
lineDashed7: "╶",
|
|
2047
|
+
lineDashed8: "╸",
|
|
2048
|
+
lineDashed9: "╺",
|
|
2049
|
+
lineDashed10: "╼",
|
|
2050
|
+
lineDashed11: "╾",
|
|
2051
|
+
lineDashed12: "−",
|
|
2052
|
+
lineDashed13: "–",
|
|
2053
|
+
lineDashed14: "‐",
|
|
2054
|
+
lineDashed15: "⁃",
|
|
2055
|
+
lineVertical: "│",
|
|
2056
|
+
lineVerticalBold: "┃",
|
|
2057
|
+
lineVerticalDouble: "║",
|
|
2058
|
+
lineVerticalDashed0: "┆",
|
|
2059
|
+
lineVerticalDashed1: "┇",
|
|
2060
|
+
lineVerticalDashed2: "┊",
|
|
2061
|
+
lineVerticalDashed3: "┋",
|
|
2062
|
+
lineVerticalDashed4: "╎",
|
|
2063
|
+
lineVerticalDashed5: "╏",
|
|
2064
|
+
lineVerticalDashed6: "╵",
|
|
2065
|
+
lineVerticalDashed7: "╷",
|
|
2066
|
+
lineVerticalDashed8: "╹",
|
|
2067
|
+
lineVerticalDashed9: "╻",
|
|
2068
|
+
lineVerticalDashed10: "╽",
|
|
2069
|
+
lineVerticalDashed11: "╿",
|
|
2070
|
+
lineDownLeft: "┐",
|
|
2071
|
+
lineDownLeftArc: "╮",
|
|
2072
|
+
lineDownBoldLeftBold: "┓",
|
|
2073
|
+
lineDownBoldLeft: "┒",
|
|
2074
|
+
lineDownLeftBold: "┑",
|
|
2075
|
+
lineDownDoubleLeftDouble: "╗",
|
|
2076
|
+
lineDownDoubleLeft: "╖",
|
|
2077
|
+
lineDownLeftDouble: "╕",
|
|
2078
|
+
lineDownRight: "┌",
|
|
2079
|
+
lineDownRightArc: "╭",
|
|
2080
|
+
lineDownBoldRightBold: "┏",
|
|
2081
|
+
lineDownBoldRight: "┎",
|
|
2082
|
+
lineDownRightBold: "┍",
|
|
2083
|
+
lineDownDoubleRightDouble: "╔",
|
|
2084
|
+
lineDownDoubleRight: "╓",
|
|
2085
|
+
lineDownRightDouble: "╒",
|
|
2086
|
+
lineUpLeft: "┘",
|
|
2087
|
+
lineUpLeftArc: "╯",
|
|
2088
|
+
lineUpBoldLeftBold: "┛",
|
|
2089
|
+
lineUpBoldLeft: "┚",
|
|
2090
|
+
lineUpLeftBold: "┙",
|
|
2091
|
+
lineUpDoubleLeftDouble: "╝",
|
|
2092
|
+
lineUpDoubleLeft: "╜",
|
|
2093
|
+
lineUpLeftDouble: "╛",
|
|
2094
|
+
lineUpRight: "└",
|
|
2095
|
+
lineUpRightArc: "╰",
|
|
2096
|
+
lineUpBoldRightBold: "┗",
|
|
2097
|
+
lineUpBoldRight: "┖",
|
|
2098
|
+
lineUpRightBold: "┕",
|
|
2099
|
+
lineUpDoubleRightDouble: "╚",
|
|
2100
|
+
lineUpDoubleRight: "╙",
|
|
2101
|
+
lineUpRightDouble: "╘",
|
|
2102
|
+
lineUpDownLeft: "┤",
|
|
2103
|
+
lineUpBoldDownBoldLeftBold: "┫",
|
|
2104
|
+
lineUpBoldDownBoldLeft: "┨",
|
|
2105
|
+
lineUpDownLeftBold: "┥",
|
|
2106
|
+
lineUpBoldDownLeftBold: "┩",
|
|
2107
|
+
lineUpDownBoldLeftBold: "┪",
|
|
2108
|
+
lineUpDownBoldLeft: "┧",
|
|
2109
|
+
lineUpBoldDownLeft: "┦",
|
|
2110
|
+
lineUpDoubleDownDoubleLeftDouble: "╣",
|
|
2111
|
+
lineUpDoubleDownDoubleLeft: "╢",
|
|
2112
|
+
lineUpDownLeftDouble: "╡",
|
|
2113
|
+
lineUpDownRight: "├",
|
|
2114
|
+
lineUpBoldDownBoldRightBold: "┣",
|
|
2115
|
+
lineUpBoldDownBoldRight: "┠",
|
|
2116
|
+
lineUpDownRightBold: "┝",
|
|
2117
|
+
lineUpBoldDownRightBold: "┡",
|
|
2118
|
+
lineUpDownBoldRightBold: "┢",
|
|
2119
|
+
lineUpDownBoldRight: "┟",
|
|
2120
|
+
lineUpBoldDownRight: "┞",
|
|
2121
|
+
lineUpDoubleDownDoubleRightDouble: "╠",
|
|
2122
|
+
lineUpDoubleDownDoubleRight: "╟",
|
|
2123
|
+
lineUpDownRightDouble: "╞",
|
|
2124
|
+
lineDownLeftRight: "┬",
|
|
2125
|
+
lineDownBoldLeftBoldRightBold: "┳",
|
|
2126
|
+
lineDownLeftBoldRightBold: "┯",
|
|
2127
|
+
lineDownBoldLeftRight: "┰",
|
|
2128
|
+
lineDownBoldLeftBoldRight: "┱",
|
|
2129
|
+
lineDownBoldLeftRightBold: "┲",
|
|
2130
|
+
lineDownLeftRightBold: "┮",
|
|
2131
|
+
lineDownLeftBoldRight: "┭",
|
|
2132
|
+
lineDownDoubleLeftDoubleRightDouble: "╦",
|
|
2133
|
+
lineDownDoubleLeftRight: "╥",
|
|
2134
|
+
lineDownLeftDoubleRightDouble: "╤",
|
|
2135
|
+
lineUpLeftRight: "┴",
|
|
2136
|
+
lineUpBoldLeftBoldRightBold: "┻",
|
|
2137
|
+
lineUpLeftBoldRightBold: "┷",
|
|
2138
|
+
lineUpBoldLeftRight: "┸",
|
|
2139
|
+
lineUpBoldLeftBoldRight: "┹",
|
|
2140
|
+
lineUpBoldLeftRightBold: "┺",
|
|
2141
|
+
lineUpLeftRightBold: "┶",
|
|
2142
|
+
lineUpLeftBoldRight: "┵",
|
|
2143
|
+
lineUpDoubleLeftDoubleRightDouble: "╩",
|
|
2144
|
+
lineUpDoubleLeftRight: "╨",
|
|
2145
|
+
lineUpLeftDoubleRightDouble: "╧",
|
|
2146
|
+
lineUpDownLeftRight: "┼",
|
|
2147
|
+
lineUpBoldDownBoldLeftBoldRightBold: "╋",
|
|
2148
|
+
lineUpDownBoldLeftBoldRightBold: "╈",
|
|
2149
|
+
lineUpBoldDownLeftBoldRightBold: "╇",
|
|
2150
|
+
lineUpBoldDownBoldLeftRightBold: "╊",
|
|
2151
|
+
lineUpBoldDownBoldLeftBoldRight: "╉",
|
|
2152
|
+
lineUpBoldDownLeftRight: "╀",
|
|
2153
|
+
lineUpDownBoldLeftRight: "╁",
|
|
2154
|
+
lineUpDownLeftBoldRight: "┽",
|
|
2155
|
+
lineUpDownLeftRightBold: "┾",
|
|
2156
|
+
lineUpBoldDownBoldLeftRight: "╂",
|
|
2157
|
+
lineUpDownLeftBoldRightBold: "┿",
|
|
2158
|
+
lineUpBoldDownLeftBoldRight: "╃",
|
|
2159
|
+
lineUpBoldDownLeftRightBold: "╄",
|
|
2160
|
+
lineUpDownBoldLeftBoldRight: "╅",
|
|
2161
|
+
lineUpDownBoldLeftRightBold: "╆",
|
|
2162
|
+
lineUpDoubleDownDoubleLeftDoubleRightDouble: "╬",
|
|
2163
|
+
lineUpDoubleDownDoubleLeftRight: "╫",
|
|
2164
|
+
lineUpDownLeftDoubleRightDouble: "╪",
|
|
2165
|
+
lineCross: "╳",
|
|
2166
|
+
lineBackslash: "╲",
|
|
2167
|
+
lineSlash: "╱"
|
|
2168
|
+
};
|
|
2169
|
+
var specialMainSymbols = {
|
|
2170
|
+
tick: "✔",
|
|
2171
|
+
info: "ℹ",
|
|
2172
|
+
warning: "⚠",
|
|
2173
|
+
cross: "✘",
|
|
2174
|
+
squareSmall: "◻",
|
|
2175
|
+
squareSmallFilled: "◼",
|
|
2176
|
+
circle: "◯",
|
|
2177
|
+
circleFilled: "◉",
|
|
2178
|
+
circleDotted: "◌",
|
|
2179
|
+
circleDouble: "◎",
|
|
2180
|
+
circleCircle: "ⓞ",
|
|
2181
|
+
circleCross: "ⓧ",
|
|
2182
|
+
circlePipe: "Ⓘ",
|
|
2183
|
+
radioOn: "◉",
|
|
2184
|
+
radioOff: "◯",
|
|
2185
|
+
checkboxOn: "☒",
|
|
2186
|
+
checkboxOff: "☐",
|
|
2187
|
+
checkboxCircleOn: "ⓧ",
|
|
2188
|
+
checkboxCircleOff: "Ⓘ",
|
|
2189
|
+
pointer: "❯",
|
|
2190
|
+
triangleUpOutline: "△",
|
|
2191
|
+
triangleLeft: "◀",
|
|
2192
|
+
triangleRight: "▶",
|
|
2193
|
+
lozenge: "◆",
|
|
2194
|
+
lozengeOutline: "◇",
|
|
2195
|
+
hamburger: "☰",
|
|
2196
|
+
smiley: "㋡",
|
|
2197
|
+
mustache: "෴",
|
|
2198
|
+
star: "★",
|
|
2199
|
+
play: "▶",
|
|
2200
|
+
nodejs: "⬢",
|
|
2201
|
+
oneSeventh: "⅐",
|
|
2202
|
+
oneNinth: "⅑",
|
|
2203
|
+
oneTenth: "⅒"
|
|
2204
|
+
};
|
|
2205
|
+
var specialFallbackSymbols = {
|
|
2206
|
+
tick: "√",
|
|
2207
|
+
info: "i",
|
|
2208
|
+
warning: "‼",
|
|
2209
|
+
cross: "×",
|
|
2210
|
+
squareSmall: "□",
|
|
2211
|
+
squareSmallFilled: "■",
|
|
2212
|
+
circle: "( )",
|
|
2213
|
+
circleFilled: "(*)",
|
|
2214
|
+
circleDotted: "( )",
|
|
2215
|
+
circleDouble: "( )",
|
|
2216
|
+
circleCircle: "(○)",
|
|
2217
|
+
circleCross: "(×)",
|
|
2218
|
+
circlePipe: "(│)",
|
|
2219
|
+
radioOn: "(*)",
|
|
2220
|
+
radioOff: "( )",
|
|
2221
|
+
checkboxOn: "[×]",
|
|
2222
|
+
checkboxOff: "[ ]",
|
|
2223
|
+
checkboxCircleOn: "(×)",
|
|
2224
|
+
checkboxCircleOff: "( )",
|
|
2225
|
+
pointer: ">",
|
|
2226
|
+
triangleUpOutline: "∆",
|
|
2227
|
+
triangleLeft: "◄",
|
|
2228
|
+
triangleRight: "►",
|
|
2229
|
+
lozenge: "♦",
|
|
2230
|
+
lozengeOutline: "◊",
|
|
2231
|
+
hamburger: "≡",
|
|
2232
|
+
smiley: "☺",
|
|
2233
|
+
mustache: "┌─┐",
|
|
2234
|
+
star: "✶",
|
|
2235
|
+
play: "►",
|
|
2236
|
+
nodejs: "♦",
|
|
2237
|
+
oneSeventh: "1/7",
|
|
2238
|
+
oneNinth: "1/9",
|
|
2239
|
+
oneTenth: "1/10"
|
|
2240
|
+
};
|
|
2241
|
+
var mainSymbols = {
|
|
2242
|
+
...common,
|
|
2243
|
+
...specialMainSymbols
|
|
2244
|
+
};
|
|
2245
|
+
var fallbackSymbols = {
|
|
2246
|
+
...common,
|
|
2247
|
+
...specialFallbackSymbols
|
|
2248
|
+
};
|
|
2249
|
+
var shouldUseMain = isUnicodeSupported();
|
|
2250
|
+
var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
|
|
2251
|
+
var dist_default = figures;
|
|
2252
|
+
var replacements = Object.entries(specialMainSymbols);
|
|
2253
|
+
|
|
2254
|
+
// ../../node_modules/.bun/@inquirer+core@11.2.1+e154a6929a67600d/node_modules/@inquirer/core/dist/lib/theme.js
|
|
2255
|
+
var defaultTheme = {
|
|
2256
|
+
prefix: {
|
|
2257
|
+
idle: styleText("blue", "?"),
|
|
2258
|
+
done: styleText("green", dist_default.tick)
|
|
2259
|
+
},
|
|
2260
|
+
spinner: {
|
|
2261
|
+
interval: 80,
|
|
2262
|
+
frames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"].map((frame) => styleText("yellow", frame))
|
|
2263
|
+
},
|
|
2264
|
+
keybindings: [],
|
|
2265
|
+
style: {
|
|
2266
|
+
answer: (text) => styleText("cyan", text),
|
|
2267
|
+
message: (text) => styleText("bold", text),
|
|
2268
|
+
error: (text) => styleText("red", `> ${text}`),
|
|
2269
|
+
defaultAnswer: (text) => styleText("dim", `(${text})`),
|
|
2270
|
+
help: (text) => styleText("dim", text),
|
|
2271
|
+
highlight: (text) => styleText("cyan", text),
|
|
2272
|
+
key: (text) => styleText("cyan", styleText("bold", `<${text}>`))
|
|
2273
|
+
}
|
|
2274
|
+
};
|
|
2275
|
+
function getDefaultTheme() {
|
|
2276
|
+
return {
|
|
2277
|
+
...defaultTheme,
|
|
2278
|
+
keybindings: getDefaultKeybindings()
|
|
2279
|
+
};
|
|
2280
|
+
}
|
|
2281
|
+
|
|
2282
|
+
// ../../node_modules/.bun/@inquirer+core@11.2.1+e154a6929a67600d/node_modules/@inquirer/core/dist/lib/make-theme.js
|
|
2283
|
+
function isPlainObject(value) {
|
|
2284
|
+
if (typeof value !== "object" || value === null)
|
|
2285
|
+
return false;
|
|
2286
|
+
let proto = value;
|
|
2287
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
2288
|
+
proto = Object.getPrototypeOf(proto);
|
|
2289
|
+
}
|
|
2290
|
+
return Object.getPrototypeOf(value) === proto;
|
|
2291
|
+
}
|
|
2292
|
+
function deepMerge(...objects) {
|
|
2293
|
+
const output = {};
|
|
2294
|
+
for (const obj of objects) {
|
|
2295
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
2296
|
+
const prevValue = output[key];
|
|
2297
|
+
output[key] = isPlainObject(prevValue) && isPlainObject(value) ? deepMerge(prevValue, value) : value;
|
|
2298
|
+
}
|
|
2299
|
+
}
|
|
2300
|
+
return output;
|
|
2301
|
+
}
|
|
2302
|
+
function makeTheme(...themes) {
|
|
2303
|
+
const themesToMerge = [
|
|
2304
|
+
getDefaultTheme(),
|
|
2305
|
+
...themes.filter((theme) => theme != null)
|
|
2306
|
+
];
|
|
2307
|
+
return deepMerge(...themesToMerge);
|
|
2308
|
+
}
|
|
2309
|
+
|
|
2310
|
+
// ../../node_modules/.bun/@inquirer+core@11.2.1+e154a6929a67600d/node_modules/@inquirer/core/dist/lib/use-prefix.js
|
|
2311
|
+
function usePrefix({ status = "idle", theme }) {
|
|
2312
|
+
const [showLoader, setShowLoader] = useState(false);
|
|
2313
|
+
const [tick, setTick] = useState(0);
|
|
2314
|
+
const { prefix, spinner } = makeTheme(theme);
|
|
2315
|
+
useEffect(() => {
|
|
2316
|
+
if (status === "loading") {
|
|
2317
|
+
let tickInterval;
|
|
2318
|
+
let inc = -1;
|
|
2319
|
+
const delayTimeout = setTimeout(() => {
|
|
2320
|
+
setShowLoader(true);
|
|
2321
|
+
tickInterval = setInterval(() => {
|
|
2322
|
+
inc = inc + 1;
|
|
2323
|
+
setTick(inc % spinner.frames.length);
|
|
2324
|
+
}, spinner.interval);
|
|
2325
|
+
}, 300);
|
|
2326
|
+
return () => {
|
|
2327
|
+
clearTimeout(delayTimeout);
|
|
2328
|
+
clearInterval(tickInterval);
|
|
2329
|
+
};
|
|
2330
|
+
} else {
|
|
2331
|
+
setShowLoader(false);
|
|
2332
|
+
}
|
|
2333
|
+
}, [status]);
|
|
2334
|
+
if (showLoader) {
|
|
2335
|
+
return spinner.frames[tick];
|
|
2336
|
+
}
|
|
2337
|
+
const iconName = status === "loading" ? "idle" : status;
|
|
2338
|
+
return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
|
|
2339
|
+
}
|
|
2340
|
+
// ../../node_modules/.bun/@inquirer+core@11.2.1+e154a6929a67600d/node_modules/@inquirer/core/dist/lib/use-memo.js
|
|
2341
|
+
function useMemo(fn, dependencies) {
|
|
2342
|
+
return withPointer((pointer) => {
|
|
2343
|
+
const prev = pointer.get();
|
|
2344
|
+
if (!prev || prev.dependencies.length !== dependencies.length || prev.dependencies.some((dep, i) => dep !== dependencies[i])) {
|
|
2345
|
+
const value = fn();
|
|
2346
|
+
pointer.set({ value, dependencies });
|
|
2347
|
+
return value;
|
|
2348
|
+
}
|
|
2349
|
+
return prev.value;
|
|
2350
|
+
});
|
|
2351
|
+
}
|
|
2352
|
+
// ../../node_modules/.bun/@inquirer+core@11.2.1+e154a6929a67600d/node_modules/@inquirer/core/dist/lib/use-ref.js
|
|
2353
|
+
function useRef(val) {
|
|
2354
|
+
return useState({ current: val })[0];
|
|
2355
|
+
}
|
|
2356
|
+
|
|
2357
|
+
// ../../node_modules/.bun/@inquirer+core@11.2.1+e154a6929a67600d/node_modules/@inquirer/core/dist/lib/use-keypress.js
|
|
2358
|
+
function useKeypress(userHandler) {
|
|
2359
|
+
const signal = useRef(userHandler);
|
|
2360
|
+
signal.current = userHandler;
|
|
2361
|
+
useEffect((rl) => {
|
|
2362
|
+
let ignore = false;
|
|
2363
|
+
const handler = withUpdates((_input, event) => {
|
|
2364
|
+
if (ignore)
|
|
2365
|
+
return;
|
|
2366
|
+
signal.current(event, rl);
|
|
2367
|
+
});
|
|
2368
|
+
rl.input.on("keypress", handler);
|
|
2369
|
+
return () => {
|
|
2370
|
+
ignore = true;
|
|
2371
|
+
rl.input.removeListener("keypress", handler);
|
|
2372
|
+
};
|
|
2373
|
+
}, []);
|
|
2374
|
+
}
|
|
2375
|
+
// ../../node_modules/.bun/@inquirer+core@11.2.1+e154a6929a67600d/node_modules/@inquirer/core/dist/lib/utils.js
|
|
2376
|
+
var import_cli_width = __toESM(require_cli_width(), 1);
|
|
2377
|
+
|
|
2378
|
+
// ../../node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
2379
|
+
var getCodePointsLength = (() => {
|
|
2380
|
+
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
2381
|
+
return (input) => {
|
|
2382
|
+
let surrogatePairsNr = 0;
|
|
2383
|
+
SURROGATE_PAIR_RE.lastIndex = 0;
|
|
2384
|
+
while (SURROGATE_PAIR_RE.test(input)) {
|
|
2385
|
+
surrogatePairsNr += 1;
|
|
2386
|
+
}
|
|
2387
|
+
return input.length - surrogatePairsNr;
|
|
2388
|
+
};
|
|
2389
|
+
})();
|
|
2390
|
+
var isFullWidth = (x) => {
|
|
2391
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
2392
|
+
};
|
|
2393
|
+
var isWideNotCJKTNotEmoji = (x) => {
|
|
2394
|
+
return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
2395
|
+
};
|
|
2396
|
+
|
|
2397
|
+
// ../../node_modules/.bun/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
|
|
2398
|
+
var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
2399
|
+
var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
2400
|
+
var CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu;
|
|
2401
|
+
var TAB_RE = /\t{1,1000}/y;
|
|
2402
|
+
var EMOJI_RE = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu;
|
|
2403
|
+
var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
2404
|
+
var MODIFIER_RE = /\p{M}+/gu;
|
|
2405
|
+
var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
|
|
2406
|
+
var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
|
|
2407
|
+
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
2408
|
+
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
2409
|
+
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
|
|
2410
|
+
const ANSI_WIDTH = 0;
|
|
2411
|
+
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
2412
|
+
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
2413
|
+
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
2414
|
+
const FULL_WIDTH_WIDTH = 2;
|
|
2415
|
+
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
2416
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
|
|
2417
|
+
const PARSE_BLOCKS = [
|
|
2418
|
+
[LATIN_RE, REGULAR_WIDTH],
|
|
2419
|
+
[ANSI_RE, ANSI_WIDTH],
|
|
2420
|
+
[CONTROL_RE, CONTROL_WIDTH],
|
|
2421
|
+
[TAB_RE, TAB_WIDTH],
|
|
2422
|
+
[EMOJI_RE, EMOJI_WIDTH],
|
|
2423
|
+
[CJKT_WIDE_RE, WIDE_WIDTH]
|
|
2424
|
+
];
|
|
2425
|
+
let indexPrev = 0;
|
|
2426
|
+
let index = 0;
|
|
2427
|
+
let length = input.length;
|
|
2428
|
+
let lengthExtra = 0;
|
|
2429
|
+
let truncationEnabled = false;
|
|
2430
|
+
let truncationIndex = length;
|
|
2431
|
+
let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
|
|
2432
|
+
let unmatchedStart = 0;
|
|
2433
|
+
let unmatchedEnd = 0;
|
|
2434
|
+
let width = 0;
|
|
2435
|
+
let widthExtra = 0;
|
|
2436
|
+
outer:
|
|
2437
|
+
while (true) {
|
|
2438
|
+
if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
|
|
2439
|
+
const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
|
|
2440
|
+
lengthExtra = 0;
|
|
2441
|
+
for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
|
|
2442
|
+
const codePoint = char.codePointAt(0) || 0;
|
|
2443
|
+
if (isFullWidth(codePoint)) {
|
|
2444
|
+
widthExtra = FULL_WIDTH_WIDTH;
|
|
2445
|
+
} else if (isWideNotCJKTNotEmoji(codePoint)) {
|
|
2446
|
+
widthExtra = WIDE_WIDTH;
|
|
2447
|
+
} else {
|
|
2448
|
+
widthExtra = REGULAR_WIDTH;
|
|
2449
|
+
}
|
|
2450
|
+
if (width + widthExtra > truncationLimit) {
|
|
2451
|
+
truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
2452
|
+
}
|
|
2453
|
+
if (width + widthExtra > LIMIT) {
|
|
2454
|
+
truncationEnabled = true;
|
|
2455
|
+
break outer;
|
|
2456
|
+
}
|
|
2457
|
+
lengthExtra += char.length;
|
|
2458
|
+
width += widthExtra;
|
|
2459
|
+
}
|
|
2460
|
+
unmatchedStart = unmatchedEnd = 0;
|
|
2461
|
+
}
|
|
2462
|
+
if (index >= length) {
|
|
2463
|
+
break outer;
|
|
2464
|
+
}
|
|
2465
|
+
for (let i = 0, l = PARSE_BLOCKS.length;i < l; i++) {
|
|
2466
|
+
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
|
|
2467
|
+
BLOCK_RE.lastIndex = index;
|
|
2468
|
+
if (BLOCK_RE.test(input)) {
|
|
2469
|
+
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
|
|
2470
|
+
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
2471
|
+
if (width + widthExtra > truncationLimit) {
|
|
2472
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
|
|
2473
|
+
}
|
|
2474
|
+
if (width + widthExtra > LIMIT) {
|
|
2475
|
+
truncationEnabled = true;
|
|
2476
|
+
break outer;
|
|
2477
|
+
}
|
|
2478
|
+
width += widthExtra;
|
|
2479
|
+
unmatchedStart = indexPrev;
|
|
2480
|
+
unmatchedEnd = index;
|
|
2481
|
+
index = indexPrev = BLOCK_RE.lastIndex;
|
|
2482
|
+
continue outer;
|
|
2483
|
+
}
|
|
2484
|
+
}
|
|
2485
|
+
index += 1;
|
|
2486
|
+
}
|
|
2487
|
+
return {
|
|
2488
|
+
width: truncationEnabled ? truncationLimit : width,
|
|
2489
|
+
index: truncationEnabled ? truncationIndex : length,
|
|
2490
|
+
truncated: truncationEnabled,
|
|
2491
|
+
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
2492
|
+
};
|
|
2493
|
+
};
|
|
2494
|
+
var dist_default2 = getStringTruncatedWidth;
|
|
2495
|
+
|
|
2496
|
+
// ../../node_modules/.bun/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
|
|
2497
|
+
var NO_TRUNCATION2 = {
|
|
2498
|
+
limit: Infinity,
|
|
2499
|
+
ellipsis: "",
|
|
2500
|
+
ellipsisWidth: 0
|
|
2501
|
+
};
|
|
2502
|
+
var fastStringWidth = (input, options = {}) => {
|
|
2503
|
+
return dist_default2(input, NO_TRUNCATION2, options).width;
|
|
2504
|
+
};
|
|
2505
|
+
var dist_default3 = fastStringWidth;
|
|
2506
|
+
|
|
2507
|
+
// ../../node_modules/.bun/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js
|
|
2508
|
+
var ESC = "\x1B";
|
|
2509
|
+
var CSI = "";
|
|
2510
|
+
var END_CODE = 39;
|
|
2511
|
+
var ANSI_ESCAPE_BELL = "\x07";
|
|
2512
|
+
var ANSI_CSI = "[";
|
|
2513
|
+
var ANSI_OSC = "]";
|
|
2514
|
+
var ANSI_SGR_TERMINATOR = "m";
|
|
2515
|
+
var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
2516
|
+
var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
|
|
2517
|
+
var getClosingCode = (openingCode) => {
|
|
2518
|
+
if (openingCode >= 30 && openingCode <= 37)
|
|
2519
|
+
return 39;
|
|
2520
|
+
if (openingCode >= 90 && openingCode <= 97)
|
|
2521
|
+
return 39;
|
|
2522
|
+
if (openingCode >= 40 && openingCode <= 47)
|
|
2523
|
+
return 49;
|
|
2524
|
+
if (openingCode >= 100 && openingCode <= 107)
|
|
2525
|
+
return 49;
|
|
2526
|
+
if (openingCode === 1 || openingCode === 2)
|
|
2527
|
+
return 22;
|
|
2528
|
+
if (openingCode === 3)
|
|
2529
|
+
return 23;
|
|
2530
|
+
if (openingCode === 4)
|
|
2531
|
+
return 24;
|
|
2532
|
+
if (openingCode === 7)
|
|
2533
|
+
return 27;
|
|
2534
|
+
if (openingCode === 8)
|
|
2535
|
+
return 28;
|
|
2536
|
+
if (openingCode === 9)
|
|
2537
|
+
return 29;
|
|
2538
|
+
if (openingCode === 0)
|
|
2539
|
+
return 0;
|
|
2540
|
+
return;
|
|
2541
|
+
};
|
|
2542
|
+
var wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
2543
|
+
var wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
2544
|
+
var wrapWord = (rows, word, columns) => {
|
|
2545
|
+
const characters = word[Symbol.iterator]();
|
|
2546
|
+
let isInsideEscape = false;
|
|
2547
|
+
let isInsideLinkEscape = false;
|
|
2548
|
+
let lastRow = rows.at(-1);
|
|
2549
|
+
let visible = lastRow === undefined ? 0 : dist_default3(lastRow);
|
|
2550
|
+
let currentCharacter = characters.next();
|
|
2551
|
+
let nextCharacter = characters.next();
|
|
2552
|
+
let rawCharacterIndex = 0;
|
|
2553
|
+
while (!currentCharacter.done) {
|
|
2554
|
+
const character = currentCharacter.value;
|
|
2555
|
+
const characterLength = dist_default3(character);
|
|
2556
|
+
if (visible + characterLength <= columns) {
|
|
2557
|
+
rows[rows.length - 1] += character;
|
|
2558
|
+
} else {
|
|
2559
|
+
rows.push(character);
|
|
2560
|
+
visible = 0;
|
|
2561
|
+
}
|
|
2562
|
+
if (character === ESC || character === CSI) {
|
|
2563
|
+
isInsideEscape = true;
|
|
2564
|
+
isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
|
|
2565
|
+
}
|
|
2566
|
+
if (isInsideEscape) {
|
|
2567
|
+
if (isInsideLinkEscape) {
|
|
2568
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
2569
|
+
isInsideEscape = false;
|
|
2570
|
+
isInsideLinkEscape = false;
|
|
2571
|
+
}
|
|
2572
|
+
} else if (character === ANSI_SGR_TERMINATOR) {
|
|
2573
|
+
isInsideEscape = false;
|
|
2574
|
+
}
|
|
2575
|
+
} else {
|
|
2576
|
+
visible += characterLength;
|
|
2577
|
+
if (visible === columns && !nextCharacter.done) {
|
|
2578
|
+
rows.push("");
|
|
2579
|
+
visible = 0;
|
|
2580
|
+
}
|
|
2581
|
+
}
|
|
2582
|
+
currentCharacter = nextCharacter;
|
|
2583
|
+
nextCharacter = characters.next();
|
|
2584
|
+
rawCharacterIndex += character.length;
|
|
2585
|
+
}
|
|
2586
|
+
lastRow = rows.at(-1);
|
|
2587
|
+
if (!visible && lastRow !== undefined && lastRow.length && rows.length > 1) {
|
|
2588
|
+
rows[rows.length - 2] += rows.pop();
|
|
2589
|
+
}
|
|
2590
|
+
};
|
|
2591
|
+
var stringVisibleTrimSpacesRight = (string) => {
|
|
2592
|
+
const words = string.split(" ");
|
|
2593
|
+
let last = words.length;
|
|
2594
|
+
while (last) {
|
|
2595
|
+
if (dist_default3(words[last - 1])) {
|
|
2596
|
+
break;
|
|
2597
|
+
}
|
|
2598
|
+
last--;
|
|
2599
|
+
}
|
|
2600
|
+
if (last === words.length) {
|
|
2601
|
+
return string;
|
|
2602
|
+
}
|
|
2603
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
2604
|
+
};
|
|
2605
|
+
var exec = (string, columns, options = {}) => {
|
|
2606
|
+
if (options.trim !== false && string.trim() === "") {
|
|
2607
|
+
return "";
|
|
2608
|
+
}
|
|
2609
|
+
let returnValue = "";
|
|
2610
|
+
let escapeCode;
|
|
2611
|
+
let escapeUrl;
|
|
2612
|
+
const words = string.split(" ");
|
|
2613
|
+
let rows = [""];
|
|
2614
|
+
let rowLength = 0;
|
|
2615
|
+
for (let index = 0;index < words.length; index++) {
|
|
2616
|
+
const word = words[index];
|
|
2617
|
+
if (options.trim !== false) {
|
|
2618
|
+
const row = rows.at(-1) ?? "";
|
|
2619
|
+
const trimmed = row.trimStart();
|
|
2620
|
+
if (row.length !== trimmed.length) {
|
|
2621
|
+
rows[rows.length - 1] = trimmed;
|
|
2622
|
+
rowLength = dist_default3(trimmed);
|
|
2623
|
+
}
|
|
2624
|
+
}
|
|
2625
|
+
if (index !== 0) {
|
|
2626
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
2627
|
+
rows.push("");
|
|
2628
|
+
rowLength = 0;
|
|
2629
|
+
}
|
|
2630
|
+
if (rowLength || options.trim === false) {
|
|
2631
|
+
rows[rows.length - 1] += " ";
|
|
2632
|
+
rowLength++;
|
|
2633
|
+
}
|
|
2634
|
+
}
|
|
2635
|
+
const wordLength = dist_default3(word);
|
|
2636
|
+
if (options.hard && wordLength > columns) {
|
|
2637
|
+
const remainingColumns = columns - rowLength;
|
|
2638
|
+
const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
|
|
2639
|
+
const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
|
|
2640
|
+
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
2641
|
+
rows.push("");
|
|
2642
|
+
}
|
|
2643
|
+
wrapWord(rows, word, columns);
|
|
2644
|
+
rowLength = dist_default3(rows.at(-1) ?? "");
|
|
2645
|
+
continue;
|
|
2646
|
+
}
|
|
2647
|
+
if (rowLength + wordLength > columns && rowLength && wordLength) {
|
|
2648
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
2649
|
+
wrapWord(rows, word, columns);
|
|
2650
|
+
rowLength = dist_default3(rows.at(-1) ?? "");
|
|
2651
|
+
continue;
|
|
2652
|
+
}
|
|
2653
|
+
rows.push("");
|
|
2654
|
+
rowLength = 0;
|
|
2655
|
+
}
|
|
2656
|
+
if (rowLength + wordLength > columns && options.wordWrap === false) {
|
|
2657
|
+
wrapWord(rows, word, columns);
|
|
2658
|
+
rowLength = dist_default3(rows.at(-1) ?? "");
|
|
2659
|
+
continue;
|
|
2660
|
+
}
|
|
2661
|
+
rows[rows.length - 1] += word;
|
|
2662
|
+
rowLength += wordLength;
|
|
2663
|
+
}
|
|
2664
|
+
if (options.trim !== false) {
|
|
2665
|
+
rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
2666
|
+
}
|
|
2667
|
+
const preString = rows.join(`
|
|
2668
|
+
`);
|
|
2669
|
+
let inSurrogate = false;
|
|
2670
|
+
for (let i = 0;i < preString.length; i++) {
|
|
2671
|
+
const character = preString[i];
|
|
2672
|
+
returnValue += character;
|
|
2673
|
+
if (!inSurrogate) {
|
|
2674
|
+
inSurrogate = character >= "\uD800" && character <= "\uDBFF";
|
|
2675
|
+
if (inSurrogate) {
|
|
2676
|
+
continue;
|
|
2677
|
+
}
|
|
2678
|
+
} else {
|
|
2679
|
+
inSurrogate = false;
|
|
2680
|
+
}
|
|
2681
|
+
if (character === ESC || character === CSI) {
|
|
2682
|
+
GROUP_REGEX.lastIndex = i + 1;
|
|
2683
|
+
const groupsResult = GROUP_REGEX.exec(preString);
|
|
2684
|
+
const groups = groupsResult?.groups;
|
|
2685
|
+
if (groups?.code !== undefined) {
|
|
2686
|
+
const code = Number.parseFloat(groups.code);
|
|
2687
|
+
escapeCode = code === END_CODE ? undefined : code;
|
|
2688
|
+
} else if (groups?.uri !== undefined) {
|
|
2689
|
+
escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2692
|
+
if (preString[i + 1] === `
|
|
2693
|
+
`) {
|
|
2694
|
+
if (escapeUrl) {
|
|
2695
|
+
returnValue += wrapAnsiHyperlink("");
|
|
2696
|
+
}
|
|
2697
|
+
const closingCode = escapeCode ? getClosingCode(escapeCode) : undefined;
|
|
2698
|
+
if (escapeCode && closingCode) {
|
|
2699
|
+
returnValue += wrapAnsiCode(closingCode);
|
|
2700
|
+
}
|
|
2701
|
+
} else if (character === `
|
|
2702
|
+
`) {
|
|
2703
|
+
if (escapeCode && getClosingCode(escapeCode)) {
|
|
2704
|
+
returnValue += wrapAnsiCode(escapeCode);
|
|
2705
|
+
}
|
|
2706
|
+
if (escapeUrl) {
|
|
2707
|
+
returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
2708
|
+
}
|
|
2709
|
+
}
|
|
2710
|
+
}
|
|
2711
|
+
return returnValue;
|
|
2712
|
+
};
|
|
2713
|
+
var CRLF_OR_LF = /\r?\n/;
|
|
2714
|
+
function wrapAnsi(string, columns, options) {
|
|
2715
|
+
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join(`
|
|
2716
|
+
`);
|
|
2717
|
+
}
|
|
2718
|
+
|
|
2719
|
+
// ../../node_modules/.bun/@inquirer+core@11.2.1+e154a6929a67600d/node_modules/@inquirer/core/dist/lib/utils.js
|
|
2720
|
+
function breakLines(content, width) {
|
|
2721
|
+
return content.split(`
|
|
2722
|
+
`).flatMap((line) => wrapAnsi(line, width, { trim: false, wordWrap: false }).split(`
|
|
2723
|
+
`).map((str) => str.trimEnd())).join(`
|
|
2724
|
+
`);
|
|
2725
|
+
}
|
|
2726
|
+
function readlineWidth() {
|
|
2727
|
+
return import_cli_width.default({ defaultWidth: 80, output: readline().output });
|
|
2728
|
+
}
|
|
2729
|
+
|
|
2730
|
+
// ../../node_modules/.bun/@inquirer+core@11.2.1+e154a6929a67600d/node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js
|
|
2731
|
+
function usePointerPosition({ active, renderedItems, pageSize, loop }) {
|
|
2732
|
+
const state = useRef({
|
|
2733
|
+
lastPointer: active,
|
|
2734
|
+
lastActive: undefined
|
|
2735
|
+
});
|
|
2736
|
+
const { lastPointer, lastActive } = state.current;
|
|
2737
|
+
const middle = Math.floor(pageSize / 2);
|
|
2738
|
+
const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
|
|
2739
|
+
const defaultPointerPosition = renderedItems.slice(0, active).reduce((acc, item) => acc + item.length, 0);
|
|
2740
|
+
let pointer = defaultPointerPosition;
|
|
2741
|
+
if (renderedLength > pageSize) {
|
|
2742
|
+
if (loop) {
|
|
2743
|
+
pointer = lastPointer;
|
|
2744
|
+
if (lastActive != null && lastActive < active && active - lastActive < pageSize) {
|
|
2745
|
+
pointer = Math.min(middle, Math.abs(active - lastActive) === 1 ? Math.min(lastPointer + (renderedItems[lastActive]?.length ?? 0), Math.max(defaultPointerPosition, lastPointer)) : lastPointer + active - lastActive);
|
|
2746
|
+
}
|
|
2747
|
+
} else {
|
|
2748
|
+
const spaceUnderActive = renderedItems.slice(active).reduce((acc, item) => acc + item.length, 0);
|
|
2749
|
+
pointer = spaceUnderActive < pageSize - middle ? pageSize - spaceUnderActive : Math.min(defaultPointerPosition, middle);
|
|
2750
|
+
}
|
|
2751
|
+
}
|
|
2752
|
+
state.current.lastPointer = pointer;
|
|
2753
|
+
state.current.lastActive = active;
|
|
2754
|
+
return pointer;
|
|
2755
|
+
}
|
|
2756
|
+
function usePagination({ items, active, renderItem, pageSize, loop = true }) {
|
|
2757
|
+
const width = readlineWidth();
|
|
2758
|
+
const bound = (num) => (num % items.length + items.length) % items.length;
|
|
2759
|
+
const renderedItems = items.map((item, index) => {
|
|
2760
|
+
if (item == null)
|
|
2761
|
+
return [];
|
|
2762
|
+
return breakLines(renderItem({ item, index, isActive: index === active }), width).split(`
|
|
2763
|
+
`);
|
|
2764
|
+
});
|
|
2765
|
+
const renderedLength = renderedItems.reduce((acc, item) => acc + item.length, 0);
|
|
2766
|
+
const renderItemAtIndex = (index) => renderedItems[index] ?? [];
|
|
2767
|
+
const pointer = usePointerPosition({ active, renderedItems, pageSize, loop });
|
|
2768
|
+
const activeItem = renderItemAtIndex(active).slice(0, pageSize);
|
|
2769
|
+
const activeItemPosition = pointer + activeItem.length <= pageSize ? pointer : pageSize - activeItem.length;
|
|
2770
|
+
const pageBuffer = Array.from({ length: pageSize });
|
|
2771
|
+
pageBuffer.splice(activeItemPosition, activeItem.length, ...activeItem);
|
|
2772
|
+
const itemVisited = new Set([active]);
|
|
2773
|
+
let bufferPointer = activeItemPosition + activeItem.length;
|
|
2774
|
+
let itemPointer = bound(active + 1);
|
|
2775
|
+
while (bufferPointer < pageSize && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer > active)) {
|
|
2776
|
+
const lines = renderItemAtIndex(itemPointer);
|
|
2777
|
+
const linesToAdd = lines.slice(0, pageSize - bufferPointer);
|
|
2778
|
+
pageBuffer.splice(bufferPointer, linesToAdd.length, ...linesToAdd);
|
|
2779
|
+
itemVisited.add(itemPointer);
|
|
2780
|
+
bufferPointer += linesToAdd.length;
|
|
2781
|
+
itemPointer = bound(itemPointer + 1);
|
|
2782
|
+
}
|
|
2783
|
+
bufferPointer = activeItemPosition - 1;
|
|
2784
|
+
itemPointer = bound(active - 1);
|
|
2785
|
+
while (bufferPointer >= 0 && !itemVisited.has(itemPointer) && (loop && renderedLength > pageSize ? itemPointer !== active : itemPointer < active)) {
|
|
2786
|
+
const lines = renderItemAtIndex(itemPointer);
|
|
2787
|
+
const linesToAdd = lines.slice(Math.max(0, lines.length - bufferPointer - 1));
|
|
2788
|
+
pageBuffer.splice(bufferPointer - linesToAdd.length + 1, linesToAdd.length, ...linesToAdd);
|
|
2789
|
+
itemVisited.add(itemPointer);
|
|
2790
|
+
bufferPointer -= linesToAdd.length;
|
|
2791
|
+
itemPointer = bound(itemPointer - 1);
|
|
2792
|
+
}
|
|
2793
|
+
return pageBuffer.filter((line) => typeof line === "string").join(`
|
|
2794
|
+
`);
|
|
2795
|
+
}
|
|
2796
|
+
// ../../node_modules/.bun/@inquirer+core@11.2.1+e154a6929a67600d/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
2797
|
+
var import_mute_stream = __toESM(require_lib(), 1);
|
|
2798
|
+
import * as readline2 from "node:readline";
|
|
2799
|
+
import { AsyncResource as AsyncResource3 } from "node:async_hooks";
|
|
2800
|
+
|
|
2801
|
+
// ../../node_modules/.bun/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
2802
|
+
var signals = [];
|
|
2803
|
+
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
2804
|
+
if (process.platform !== "win32") {
|
|
2805
|
+
signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
2806
|
+
}
|
|
2807
|
+
if (process.platform === "linux") {
|
|
2808
|
+
signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
2809
|
+
}
|
|
2810
|
+
|
|
2811
|
+
// ../../node_modules/.bun/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
|
|
2812
|
+
var processOk = (process3) => !!process3 && typeof process3 === "object" && typeof process3.removeListener === "function" && typeof process3.emit === "function" && typeof process3.reallyExit === "function" && typeof process3.listeners === "function" && typeof process3.kill === "function" && typeof process3.pid === "number" && typeof process3.on === "function";
|
|
2813
|
+
var kExitEmitter = Symbol.for("signal-exit emitter");
|
|
2814
|
+
var global = globalThis;
|
|
2815
|
+
var ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
2816
|
+
|
|
2817
|
+
class Emitter {
|
|
2818
|
+
emitted = {
|
|
2819
|
+
afterExit: false,
|
|
2820
|
+
exit: false
|
|
2821
|
+
};
|
|
2822
|
+
listeners = {
|
|
2823
|
+
afterExit: [],
|
|
2824
|
+
exit: []
|
|
2825
|
+
};
|
|
2826
|
+
count = 0;
|
|
2827
|
+
id = Math.random();
|
|
2828
|
+
constructor() {
|
|
2829
|
+
if (global[kExitEmitter]) {
|
|
2830
|
+
return global[kExitEmitter];
|
|
2831
|
+
}
|
|
2832
|
+
ObjectDefineProperty(global, kExitEmitter, {
|
|
2833
|
+
value: this,
|
|
2834
|
+
writable: false,
|
|
2835
|
+
enumerable: false,
|
|
2836
|
+
configurable: false
|
|
2837
|
+
});
|
|
2838
|
+
}
|
|
2839
|
+
on(ev, fn) {
|
|
2840
|
+
this.listeners[ev].push(fn);
|
|
2841
|
+
}
|
|
2842
|
+
removeListener(ev, fn) {
|
|
2843
|
+
const list = this.listeners[ev];
|
|
2844
|
+
const i = list.indexOf(fn);
|
|
2845
|
+
if (i === -1) {
|
|
2846
|
+
return;
|
|
2847
|
+
}
|
|
2848
|
+
if (i === 0 && list.length === 1) {
|
|
2849
|
+
list.length = 0;
|
|
2850
|
+
} else {
|
|
2851
|
+
list.splice(i, 1);
|
|
2852
|
+
}
|
|
2853
|
+
}
|
|
2854
|
+
emit(ev, code, signal) {
|
|
2855
|
+
if (this.emitted[ev]) {
|
|
2856
|
+
return false;
|
|
2857
|
+
}
|
|
2858
|
+
this.emitted[ev] = true;
|
|
2859
|
+
let ret = false;
|
|
2860
|
+
for (const fn of this.listeners[ev]) {
|
|
2861
|
+
ret = fn(code, signal) === true || ret;
|
|
2862
|
+
}
|
|
2863
|
+
if (ev === "exit") {
|
|
2864
|
+
ret = this.emit("afterExit", code, signal) || ret;
|
|
2865
|
+
}
|
|
2866
|
+
return ret;
|
|
2867
|
+
}
|
|
2868
|
+
}
|
|
2869
|
+
|
|
2870
|
+
class SignalExitBase {
|
|
2871
|
+
}
|
|
2872
|
+
var signalExitWrap = (handler) => {
|
|
2873
|
+
return {
|
|
2874
|
+
onExit(cb, opts) {
|
|
2875
|
+
return handler.onExit(cb, opts);
|
|
2876
|
+
},
|
|
2877
|
+
load() {
|
|
2878
|
+
return handler.load();
|
|
2879
|
+
},
|
|
2880
|
+
unload() {
|
|
2881
|
+
return handler.unload();
|
|
2882
|
+
}
|
|
2883
|
+
};
|
|
2884
|
+
};
|
|
2885
|
+
|
|
2886
|
+
class SignalExitFallback extends SignalExitBase {
|
|
2887
|
+
onExit() {
|
|
2888
|
+
return () => {};
|
|
2889
|
+
}
|
|
2890
|
+
load() {}
|
|
2891
|
+
unload() {}
|
|
2892
|
+
}
|
|
2893
|
+
|
|
2894
|
+
class SignalExit extends SignalExitBase {
|
|
2895
|
+
#hupSig = process3.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
2896
|
+
#emitter = new Emitter;
|
|
2897
|
+
#process;
|
|
2898
|
+
#originalProcessEmit;
|
|
2899
|
+
#originalProcessReallyExit;
|
|
2900
|
+
#sigListeners = {};
|
|
2901
|
+
#loaded = false;
|
|
2902
|
+
constructor(process3) {
|
|
2903
|
+
super();
|
|
2904
|
+
this.#process = process3;
|
|
2905
|
+
this.#sigListeners = {};
|
|
2906
|
+
for (const sig of signals) {
|
|
2907
|
+
this.#sigListeners[sig] = () => {
|
|
2908
|
+
const listeners = this.#process.listeners(sig);
|
|
2909
|
+
let { count } = this.#emitter;
|
|
2910
|
+
const p = process3;
|
|
2911
|
+
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
|
|
2912
|
+
count += p.__signal_exit_emitter__.count;
|
|
2913
|
+
}
|
|
2914
|
+
if (listeners.length === count) {
|
|
2915
|
+
this.unload();
|
|
2916
|
+
const ret = this.#emitter.emit("exit", null, sig);
|
|
2917
|
+
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
2918
|
+
if (!ret)
|
|
2919
|
+
process3.kill(process3.pid, s);
|
|
2920
|
+
}
|
|
2921
|
+
};
|
|
2922
|
+
}
|
|
2923
|
+
this.#originalProcessReallyExit = process3.reallyExit;
|
|
2924
|
+
this.#originalProcessEmit = process3.emit;
|
|
2925
|
+
}
|
|
2926
|
+
onExit(cb, opts) {
|
|
2927
|
+
if (!processOk(this.#process)) {
|
|
2928
|
+
return () => {};
|
|
2929
|
+
}
|
|
2930
|
+
if (this.#loaded === false) {
|
|
2931
|
+
this.load();
|
|
2932
|
+
}
|
|
2933
|
+
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
2934
|
+
this.#emitter.on(ev, cb);
|
|
2935
|
+
return () => {
|
|
2936
|
+
this.#emitter.removeListener(ev, cb);
|
|
2937
|
+
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
|
|
2938
|
+
this.unload();
|
|
2939
|
+
}
|
|
2940
|
+
};
|
|
2941
|
+
}
|
|
2942
|
+
load() {
|
|
2943
|
+
if (this.#loaded) {
|
|
2944
|
+
return;
|
|
2945
|
+
}
|
|
2946
|
+
this.#loaded = true;
|
|
2947
|
+
this.#emitter.count += 1;
|
|
2948
|
+
for (const sig of signals) {
|
|
2949
|
+
try {
|
|
2950
|
+
const fn = this.#sigListeners[sig];
|
|
2951
|
+
if (fn)
|
|
2952
|
+
this.#process.on(sig, fn);
|
|
2953
|
+
} catch (_) {}
|
|
2954
|
+
}
|
|
2955
|
+
this.#process.emit = (ev, ...a) => {
|
|
2956
|
+
return this.#processEmit(ev, ...a);
|
|
2957
|
+
};
|
|
2958
|
+
this.#process.reallyExit = (code) => {
|
|
2959
|
+
return this.#processReallyExit(code);
|
|
2960
|
+
};
|
|
2961
|
+
}
|
|
2962
|
+
unload() {
|
|
2963
|
+
if (!this.#loaded) {
|
|
2964
|
+
return;
|
|
2965
|
+
}
|
|
2966
|
+
this.#loaded = false;
|
|
2967
|
+
signals.forEach((sig) => {
|
|
2968
|
+
const listener = this.#sigListeners[sig];
|
|
2969
|
+
if (!listener) {
|
|
2970
|
+
throw new Error("Listener not defined for signal: " + sig);
|
|
2971
|
+
}
|
|
2972
|
+
try {
|
|
2973
|
+
this.#process.removeListener(sig, listener);
|
|
2974
|
+
} catch (_) {}
|
|
2975
|
+
});
|
|
2976
|
+
this.#process.emit = this.#originalProcessEmit;
|
|
2977
|
+
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
2978
|
+
this.#emitter.count -= 1;
|
|
2979
|
+
}
|
|
2980
|
+
#processReallyExit(code) {
|
|
2981
|
+
if (!processOk(this.#process)) {
|
|
2982
|
+
return 0;
|
|
2983
|
+
}
|
|
2984
|
+
this.#process.exitCode = code || 0;
|
|
2985
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
2986
|
+
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
2987
|
+
}
|
|
2988
|
+
#processEmit(ev, ...args) {
|
|
2989
|
+
const og = this.#originalProcessEmit;
|
|
2990
|
+
if (ev === "exit" && processOk(this.#process)) {
|
|
2991
|
+
if (typeof args[0] === "number") {
|
|
2992
|
+
this.#process.exitCode = args[0];
|
|
2993
|
+
}
|
|
2994
|
+
const ret = og.call(this.#process, ev, ...args);
|
|
2995
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
2996
|
+
return ret;
|
|
2997
|
+
} else {
|
|
2998
|
+
return og.call(this.#process, ev, ...args);
|
|
2999
|
+
}
|
|
3000
|
+
}
|
|
3001
|
+
}
|
|
3002
|
+
var process3 = globalThis.process;
|
|
3003
|
+
var {
|
|
3004
|
+
onExit,
|
|
3005
|
+
load,
|
|
3006
|
+
unload
|
|
3007
|
+
} = signalExitWrap(processOk(process3) ? new SignalExit(process3) : new SignalExitFallback);
|
|
3008
|
+
|
|
3009
|
+
// ../../node_modules/.bun/@inquirer+core@11.2.1+e154a6929a67600d/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
3010
|
+
import { stripVTControlCharacters } from "node:util";
|
|
3011
|
+
|
|
3012
|
+
// ../../node_modules/.bun/@inquirer+ansi@2.0.7/node_modules/@inquirer/ansi/dist/index.js
|
|
3013
|
+
var ESC2 = "\x1B[";
|
|
3014
|
+
var cursorLeft = ESC2 + "G";
|
|
3015
|
+
var cursorHide = ESC2 + "?25l";
|
|
3016
|
+
var cursorShow = ESC2 + "?25h";
|
|
3017
|
+
var cursorUp = (rows = 1) => rows > 0 ? `${ESC2}${rows}A` : "";
|
|
3018
|
+
var cursorDown = (rows = 1) => rows > 0 ? `${ESC2}${rows}B` : "";
|
|
3019
|
+
var cursorTo = (x, y) => {
|
|
3020
|
+
if (typeof y === "number" && !Number.isNaN(y)) {
|
|
3021
|
+
return `${ESC2}${y + 1};${x + 1}H`;
|
|
3022
|
+
}
|
|
3023
|
+
return `${ESC2}${x + 1}G`;
|
|
3024
|
+
};
|
|
3025
|
+
var eraseLine = ESC2 + "2K";
|
|
3026
|
+
var eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : "";
|
|
3027
|
+
|
|
3028
|
+
// ../../node_modules/.bun/@inquirer+core@11.2.1+e154a6929a67600d/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
3029
|
+
var height = (content) => content.split(`
|
|
3030
|
+
`).length;
|
|
3031
|
+
var lastLine = (content) => content.split(`
|
|
3032
|
+
`).pop() ?? "";
|
|
3033
|
+
|
|
3034
|
+
class ScreenManager {
|
|
3035
|
+
height = 0;
|
|
3036
|
+
extraLinesUnderPrompt = 0;
|
|
3037
|
+
cursorPos;
|
|
3038
|
+
rl;
|
|
3039
|
+
constructor(rl) {
|
|
3040
|
+
this.rl = rl;
|
|
3041
|
+
this.cursorPos = rl.getCursorPos();
|
|
3042
|
+
}
|
|
3043
|
+
write(content) {
|
|
3044
|
+
this.rl.output.unmute();
|
|
3045
|
+
this.rl.output.write(content);
|
|
3046
|
+
this.rl.output.mute();
|
|
3047
|
+
}
|
|
3048
|
+
render(content, bottomContent = "") {
|
|
3049
|
+
const promptLine = lastLine(content);
|
|
3050
|
+
const rawPromptLine = stripVTControlCharacters(promptLine);
|
|
3051
|
+
let prompt = rawPromptLine;
|
|
3052
|
+
if (this.rl.line.length > 0) {
|
|
3053
|
+
prompt = prompt.slice(0, -this.rl.line.length);
|
|
3054
|
+
}
|
|
3055
|
+
this.rl.setPrompt(prompt);
|
|
3056
|
+
this.cursorPos = this.rl.getCursorPos();
|
|
3057
|
+
const width = readlineWidth();
|
|
3058
|
+
content = breakLines(content, width);
|
|
3059
|
+
bottomContent = breakLines(bottomContent, width);
|
|
3060
|
+
if (rawPromptLine.length % width === 0) {
|
|
3061
|
+
content += `
|
|
3062
|
+
`;
|
|
3063
|
+
}
|
|
3064
|
+
let output = content + (bottomContent ? `
|
|
3065
|
+
` + bottomContent : "");
|
|
3066
|
+
const promptLineUpDiff = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows;
|
|
3067
|
+
const bottomContentHeight = promptLineUpDiff + (bottomContent ? height(bottomContent) : 0);
|
|
3068
|
+
if (bottomContentHeight > 0)
|
|
3069
|
+
output += cursorUp(bottomContentHeight);
|
|
3070
|
+
output += cursorTo(this.cursorPos.cols);
|
|
3071
|
+
this.write(cursorDown(this.extraLinesUnderPrompt) + eraseLines(this.height) + output);
|
|
3072
|
+
this.extraLinesUnderPrompt = bottomContentHeight;
|
|
3073
|
+
this.height = height(output);
|
|
3074
|
+
}
|
|
3075
|
+
checkCursorPos() {
|
|
3076
|
+
const cursorPos = this.rl.getCursorPos();
|
|
3077
|
+
if (cursorPos.cols !== this.cursorPos.cols) {
|
|
3078
|
+
this.write(cursorTo(cursorPos.cols));
|
|
3079
|
+
this.cursorPos = cursorPos;
|
|
3080
|
+
}
|
|
3081
|
+
}
|
|
3082
|
+
done({ clearContent }) {
|
|
3083
|
+
this.rl.setPrompt("");
|
|
3084
|
+
let output = cursorDown(this.extraLinesUnderPrompt);
|
|
3085
|
+
output += clearContent ? eraseLines(this.height) : `
|
|
3086
|
+
`;
|
|
3087
|
+
output += cursorLeft;
|
|
3088
|
+
output += cursorShow;
|
|
3089
|
+
this.write(output);
|
|
3090
|
+
this.rl.close();
|
|
3091
|
+
}
|
|
3092
|
+
}
|
|
3093
|
+
|
|
3094
|
+
// ../../node_modules/.bun/@inquirer+core@11.2.1+e154a6929a67600d/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
|
|
3095
|
+
class PromisePolyfill extends Promise {
|
|
3096
|
+
static withResolver() {
|
|
3097
|
+
let resolve4;
|
|
3098
|
+
let reject;
|
|
3099
|
+
const promise = new Promise((res, rej) => {
|
|
3100
|
+
resolve4 = res;
|
|
3101
|
+
reject = rej;
|
|
3102
|
+
});
|
|
3103
|
+
return { promise, resolve: resolve4, reject };
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3106
|
+
|
|
3107
|
+
// ../../node_modules/.bun/@inquirer+core@11.2.1+e154a6929a67600d/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
3108
|
+
import path from "node:path";
|
|
3109
|
+
var nativeSetImmediate = globalThis.setImmediate;
|
|
3110
|
+
function getCallSites() {
|
|
3111
|
+
const savedPrepareStackTrace = Error.prepareStackTrace;
|
|
3112
|
+
let result = [];
|
|
3113
|
+
try {
|
|
3114
|
+
Error.prepareStackTrace = (_, callSites) => {
|
|
3115
|
+
const callSitesWithoutCurrent = callSites.slice(1);
|
|
3116
|
+
result = callSitesWithoutCurrent;
|
|
3117
|
+
return callSitesWithoutCurrent;
|
|
3118
|
+
};
|
|
3119
|
+
new Error().stack;
|
|
3120
|
+
} catch {
|
|
3121
|
+
return result;
|
|
3122
|
+
}
|
|
3123
|
+
Error.prepareStackTrace = savedPrepareStackTrace;
|
|
3124
|
+
return result;
|
|
3125
|
+
}
|
|
3126
|
+
function createPrompt(view) {
|
|
3127
|
+
const callSites = getCallSites();
|
|
3128
|
+
const prompt = (config, context = {}) => {
|
|
3129
|
+
const { input = process.stdin, signal } = context;
|
|
3130
|
+
const cleanups = new Set;
|
|
3131
|
+
const output = new import_mute_stream.default;
|
|
3132
|
+
output.pipe(context.output ?? process.stdout);
|
|
3133
|
+
const rl = readline2.createInterface({
|
|
3134
|
+
terminal: true,
|
|
3135
|
+
input,
|
|
3136
|
+
output
|
|
3137
|
+
});
|
|
3138
|
+
output.mute();
|
|
3139
|
+
const screen = new ScreenManager(rl);
|
|
3140
|
+
const { promise, resolve: resolve4, reject } = PromisePolyfill.withResolver();
|
|
3141
|
+
const cancel = () => reject(new CancelPromptError);
|
|
3142
|
+
if (signal) {
|
|
3143
|
+
const abort = () => reject(new AbortPromptError({ cause: signal.reason }));
|
|
3144
|
+
if (signal.aborted) {
|
|
3145
|
+
abort();
|
|
3146
|
+
return Object.assign(promise, { cancel });
|
|
3147
|
+
}
|
|
3148
|
+
signal.addEventListener("abort", abort);
|
|
3149
|
+
cleanups.add(() => signal.removeEventListener("abort", abort));
|
|
3150
|
+
}
|
|
3151
|
+
cleanups.add(onExit((code, signal2) => {
|
|
3152
|
+
reject(new ExitPromptError(`User force closed the prompt with ${code} ${signal2}`));
|
|
3153
|
+
}));
|
|
3154
|
+
const sigint = () => reject(new ExitPromptError(`User force closed the prompt with SIGINT`));
|
|
3155
|
+
rl.on("SIGINT", sigint);
|
|
3156
|
+
cleanups.add(() => rl.removeListener("SIGINT", sigint));
|
|
3157
|
+
return withHooks(rl, (cycle) => {
|
|
3158
|
+
const hooksCleanup = AsyncResource3.bind(() => effectScheduler.clearAll());
|
|
3159
|
+
rl.on("close", hooksCleanup);
|
|
3160
|
+
cleanups.add(() => rl.removeListener("close", hooksCleanup));
|
|
3161
|
+
const startCycle = () => {
|
|
3162
|
+
const checkCursorPos = () => screen.checkCursorPos();
|
|
3163
|
+
rl.input.on("keypress", checkCursorPos);
|
|
3164
|
+
cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
|
|
3165
|
+
let pendingDone = null;
|
|
3166
|
+
cycle(() => {
|
|
3167
|
+
let effectsSettled = false;
|
|
3168
|
+
try {
|
|
3169
|
+
const nextView = view(config, (value) => {
|
|
3170
|
+
if (effectsSettled) {
|
|
3171
|
+
resolve4(value);
|
|
3172
|
+
} else {
|
|
3173
|
+
pendingDone = { value };
|
|
3174
|
+
}
|
|
3175
|
+
});
|
|
3176
|
+
if (nextView === undefined) {
|
|
3177
|
+
let callerFilename = callSites[1]?.getFileName();
|
|
3178
|
+
if (callerFilename && !callerFilename.startsWith("file://")) {
|
|
3179
|
+
callerFilename = path.resolve(callerFilename);
|
|
3180
|
+
}
|
|
3181
|
+
throw new Error(`Prompt functions must return a string.
|
|
3182
|
+
at ${callerFilename}`);
|
|
3183
|
+
}
|
|
3184
|
+
const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
|
|
3185
|
+
screen.render(content, bottomContent);
|
|
3186
|
+
effectScheduler.run();
|
|
3187
|
+
} catch (error) {
|
|
3188
|
+
reject(error);
|
|
3189
|
+
}
|
|
3190
|
+
effectsSettled = true;
|
|
3191
|
+
if (pendingDone !== null) {
|
|
3192
|
+
const { value } = pendingDone;
|
|
3193
|
+
pendingDone = null;
|
|
3194
|
+
resolve4(value);
|
|
3195
|
+
}
|
|
3196
|
+
});
|
|
3197
|
+
};
|
|
3198
|
+
if ("readableFlowing" in input) {
|
|
3199
|
+
nativeSetImmediate(startCycle);
|
|
3200
|
+
} else {
|
|
3201
|
+
startCycle();
|
|
3202
|
+
}
|
|
3203
|
+
return Object.assign(promise.then((answer) => {
|
|
3204
|
+
effectScheduler.clearAll();
|
|
3205
|
+
return answer;
|
|
3206
|
+
}, (error) => {
|
|
3207
|
+
effectScheduler.clearAll();
|
|
3208
|
+
throw error;
|
|
3209
|
+
}).finally(() => {
|
|
3210
|
+
cleanups.forEach((cleanup) => cleanup());
|
|
3211
|
+
screen.done({ clearContent: Boolean(context.clearPromptOnDone) });
|
|
3212
|
+
output.end();
|
|
3213
|
+
}).then(() => promise), { cancel });
|
|
3214
|
+
});
|
|
3215
|
+
};
|
|
3216
|
+
return prompt;
|
|
3217
|
+
}
|
|
3218
|
+
// ../../node_modules/.bun/@inquirer+core@11.2.1+e154a6929a67600d/node_modules/@inquirer/core/dist/lib/Separator.js
|
|
3219
|
+
import { styleText as styleText2 } from "node:util";
|
|
3220
|
+
class Separator {
|
|
3221
|
+
separator = styleText2("dim", Array.from({ length: 15 }).join(dist_default.line));
|
|
3222
|
+
type = "separator";
|
|
3223
|
+
constructor(separator) {
|
|
3224
|
+
if (separator) {
|
|
3225
|
+
this.separator = separator;
|
|
3226
|
+
}
|
|
3227
|
+
}
|
|
3228
|
+
static isSeparator(choice) {
|
|
3229
|
+
return Boolean(choice && typeof choice === "object" && "type" in choice && choice.type === "separator");
|
|
3230
|
+
}
|
|
3231
|
+
}
|
|
3232
|
+
// ../../node_modules/.bun/@inquirer+checkbox@5.2.1+e154a6929a67600d/node_modules/@inquirer/checkbox/dist/index.js
|
|
3233
|
+
import { styleText as styleText3 } from "node:util";
|
|
3234
|
+
var checkboxTheme = {
|
|
3235
|
+
icon: {
|
|
3236
|
+
checked: styleText3("green", dist_default.circleFilled),
|
|
3237
|
+
unchecked: dist_default.circle,
|
|
3238
|
+
cursor: dist_default.pointer,
|
|
3239
|
+
disabledChecked: styleText3("green", dist_default.circleDouble),
|
|
3240
|
+
disabledUnchecked: "-"
|
|
3241
|
+
},
|
|
3242
|
+
style: {
|
|
3243
|
+
disabled: (text) => styleText3("dim", text),
|
|
3244
|
+
renderSelectedChoices: (selectedChoices) => selectedChoices.map((choice) => choice.short).join(", "),
|
|
3245
|
+
description: (text) => styleText3("cyan", text),
|
|
3246
|
+
keysHelpTip: (keys) => keys.map(([key, action]) => `${styleText3("bold", key)} ${styleText3("dim", action)}`).join(styleText3("dim", " • "))
|
|
3247
|
+
},
|
|
3248
|
+
i18n: { disabledError: "This option is disabled and cannot be toggled." }
|
|
3249
|
+
};
|
|
3250
|
+
function isSelectable(item) {
|
|
3251
|
+
return !Separator.isSeparator(item) && !item.disabled;
|
|
3252
|
+
}
|
|
3253
|
+
function isNavigable(item) {
|
|
3254
|
+
return !Separator.isSeparator(item);
|
|
3255
|
+
}
|
|
3256
|
+
function isChecked(item) {
|
|
3257
|
+
return !Separator.isSeparator(item) && item.checked;
|
|
3258
|
+
}
|
|
3259
|
+
function toggle(item) {
|
|
3260
|
+
return isSelectable(item) ? { ...item, checked: !item.checked } : item;
|
|
3261
|
+
}
|
|
3262
|
+
function check(checked) {
|
|
3263
|
+
return function(item) {
|
|
3264
|
+
return isSelectable(item) ? { ...item, checked } : item;
|
|
3265
|
+
};
|
|
3266
|
+
}
|
|
3267
|
+
function normalizeChoices(choices) {
|
|
3268
|
+
return choices.map((choice) => {
|
|
3269
|
+
if (Separator.isSeparator(choice))
|
|
3270
|
+
return choice;
|
|
3271
|
+
if (typeof choice !== "object" || choice === null || !("value" in choice)) {
|
|
3272
|
+
const name2 = String(choice);
|
|
3273
|
+
return {
|
|
3274
|
+
value: choice,
|
|
3275
|
+
name: name2,
|
|
3276
|
+
short: name2,
|
|
3277
|
+
checkedName: name2,
|
|
3278
|
+
disabled: false,
|
|
3279
|
+
checked: false
|
|
3280
|
+
};
|
|
3281
|
+
}
|
|
3282
|
+
const name = choice.name ?? String(choice.value);
|
|
3283
|
+
const normalizedChoice = {
|
|
3284
|
+
value: choice.value,
|
|
3285
|
+
name,
|
|
3286
|
+
short: choice.short ?? name,
|
|
3287
|
+
checkedName: choice.checkedName ?? name,
|
|
3288
|
+
disabled: choice.disabled ?? false,
|
|
3289
|
+
checked: choice.checked ?? false
|
|
3290
|
+
};
|
|
3291
|
+
if (choice.description) {
|
|
3292
|
+
normalizedChoice.description = choice.description;
|
|
3293
|
+
}
|
|
3294
|
+
return normalizedChoice;
|
|
3295
|
+
});
|
|
3296
|
+
}
|
|
3297
|
+
var dist_default4 = createPrompt((config, done) => {
|
|
3298
|
+
const { pageSize = 7, loop = true, required, validate = () => true } = config;
|
|
3299
|
+
const shortcuts = { all: "a", invert: "i", ...config.shortcuts };
|
|
3300
|
+
const theme = makeTheme(checkboxTheme, config.theme);
|
|
3301
|
+
const { keybindings: keybindings2 } = theme;
|
|
3302
|
+
const [status, setStatus] = useState("idle");
|
|
3303
|
+
const prefix = usePrefix({ status, theme });
|
|
3304
|
+
const [items, setItems] = useState(normalizeChoices(config.choices));
|
|
3305
|
+
const bounds = useMemo(() => {
|
|
3306
|
+
const first = items.findIndex(isNavigable);
|
|
3307
|
+
const last = items.findLastIndex(isNavigable);
|
|
3308
|
+
if (first === -1) {
|
|
3309
|
+
throw new ValidationError("[checkbox prompt] No selectable choices. All choices are disabled.");
|
|
3310
|
+
}
|
|
3311
|
+
return { first, last };
|
|
3312
|
+
}, [items]);
|
|
3313
|
+
const [active, setActive] = useState(bounds.first);
|
|
3314
|
+
const [errorMsg, setError] = useState();
|
|
3315
|
+
useKeypress(async (key) => {
|
|
3316
|
+
if (isEnterKey(key)) {
|
|
3317
|
+
const selection = items.filter(isChecked);
|
|
3318
|
+
const isValid = await validate([...selection]);
|
|
3319
|
+
if (required && !selection.length) {
|
|
3320
|
+
setError("At least one choice must be selected");
|
|
3321
|
+
} else if (isValid === true) {
|
|
3322
|
+
setStatus("done");
|
|
3323
|
+
done(selection.map((choice) => choice.value));
|
|
3324
|
+
} else {
|
|
3325
|
+
setError(isValid || "You must select a valid value");
|
|
3326
|
+
}
|
|
3327
|
+
} else if (isUpKey(key, keybindings2) || isDownKey(key, keybindings2)) {
|
|
3328
|
+
if (errorMsg) {
|
|
3329
|
+
setError(undefined);
|
|
3330
|
+
}
|
|
3331
|
+
if (loop || isUpKey(key, keybindings2) && active !== bounds.first || isDownKey(key, keybindings2) && active !== bounds.last) {
|
|
3332
|
+
const offset = isUpKey(key, keybindings2) ? -1 : 1;
|
|
3333
|
+
let next = active;
|
|
3334
|
+
do {
|
|
3335
|
+
next = (next + offset + items.length) % items.length;
|
|
3336
|
+
} while (!isNavigable(items[next]));
|
|
3337
|
+
setActive(next);
|
|
3338
|
+
}
|
|
3339
|
+
} else if (isSpaceKey(key)) {
|
|
3340
|
+
const activeItem = items[active];
|
|
3341
|
+
if (activeItem && !Separator.isSeparator(activeItem)) {
|
|
3342
|
+
if (activeItem.disabled) {
|
|
3343
|
+
setError(theme.i18n.disabledError);
|
|
3344
|
+
} else {
|
|
3345
|
+
setError(undefined);
|
|
3346
|
+
setItems(items.map((choice, i) => i === active ? toggle(choice) : choice));
|
|
3347
|
+
}
|
|
3348
|
+
}
|
|
3349
|
+
} else if (key.name === shortcuts.all) {
|
|
3350
|
+
const selectAll = items.some((choice) => isSelectable(choice) && !choice.checked);
|
|
3351
|
+
setItems(items.map(check(selectAll)));
|
|
3352
|
+
} else if (key.name === shortcuts.invert) {
|
|
3353
|
+
setItems(items.map(toggle));
|
|
3354
|
+
} else if (isNumberKey(key)) {
|
|
3355
|
+
const selectedIndex = Number(key.name) - 1;
|
|
3356
|
+
let selectableIndex = -1;
|
|
3357
|
+
const position = items.findIndex((item) => {
|
|
3358
|
+
if (Separator.isSeparator(item))
|
|
3359
|
+
return false;
|
|
3360
|
+
selectableIndex++;
|
|
3361
|
+
return selectableIndex === selectedIndex;
|
|
3362
|
+
});
|
|
3363
|
+
const selectedItem = items[position];
|
|
3364
|
+
if (selectedItem && isSelectable(selectedItem)) {
|
|
3365
|
+
setActive(position);
|
|
3366
|
+
setItems(items.map((choice, i) => i === position ? toggle(choice) : choice));
|
|
3367
|
+
}
|
|
3368
|
+
}
|
|
3369
|
+
});
|
|
3370
|
+
const message = theme.style.message(config.message, status);
|
|
3371
|
+
let description;
|
|
3372
|
+
const page = usePagination({
|
|
3373
|
+
items,
|
|
3374
|
+
active,
|
|
3375
|
+
renderItem({ item, isActive }) {
|
|
3376
|
+
if (Separator.isSeparator(item)) {
|
|
3377
|
+
return ` ${item.separator}`;
|
|
3378
|
+
}
|
|
3379
|
+
const cursor = isActive ? theme.icon.cursor : " ";
|
|
3380
|
+
if (item.disabled) {
|
|
3381
|
+
const disabledLabel = typeof item.disabled === "string" ? item.disabled : "(disabled)";
|
|
3382
|
+
const checkbox2 = item.checked ? theme.icon.disabledChecked : theme.icon.disabledUnchecked;
|
|
3383
|
+
return theme.style.disabled(`${cursor}${checkbox2} ${item.name} ${disabledLabel}`);
|
|
3384
|
+
}
|
|
3385
|
+
if (isActive) {
|
|
3386
|
+
description = item.description;
|
|
3387
|
+
}
|
|
3388
|
+
const checkbox = item.checked ? theme.icon.checked : theme.icon.unchecked;
|
|
3389
|
+
const name = item.checked ? item.checkedName : item.name;
|
|
3390
|
+
const color = isActive ? theme.style.highlight : (x) => x;
|
|
3391
|
+
return color(`${cursor}${checkbox} ${name}`);
|
|
3392
|
+
},
|
|
3393
|
+
pageSize,
|
|
3394
|
+
loop
|
|
3395
|
+
});
|
|
3396
|
+
if (status === "done") {
|
|
3397
|
+
const selection = items.filter(isChecked);
|
|
3398
|
+
const answer = theme.style.answer(theme.style.renderSelectedChoices(selection, items));
|
|
3399
|
+
return [prefix, message, answer].filter(Boolean).join(" ");
|
|
3400
|
+
}
|
|
3401
|
+
const keys = [
|
|
3402
|
+
["↑↓", "navigate"],
|
|
3403
|
+
["space", "select"]
|
|
3404
|
+
];
|
|
3405
|
+
if (shortcuts.all)
|
|
3406
|
+
keys.push([shortcuts.all, "all"]);
|
|
3407
|
+
if (shortcuts.invert)
|
|
3408
|
+
keys.push([shortcuts.invert, "invert"]);
|
|
3409
|
+
keys.push(["⏎", "submit"]);
|
|
3410
|
+
const helpLine = theme.style.keysHelpTip(keys);
|
|
3411
|
+
const lines = [
|
|
3412
|
+
[prefix, message].filter(Boolean).join(" "),
|
|
3413
|
+
page,
|
|
3414
|
+
" ",
|
|
3415
|
+
description ? theme.style.description(description) : "",
|
|
3416
|
+
errorMsg ? theme.style.error(errorMsg) : "",
|
|
3417
|
+
helpLine
|
|
3418
|
+
].filter(Boolean).join(`
|
|
3419
|
+
`).trimEnd();
|
|
3420
|
+
return `${lines}${cursorHide}`;
|
|
3421
|
+
});
|
|
3422
|
+
|
|
3423
|
+
// src/interactive-selection.ts
|
|
1566
3424
|
async function applyInteractiveSelection(options, prompter = terminalPrompter()) {
|
|
1567
3425
|
if (!options.interactive)
|
|
1568
3426
|
return options;
|
|
@@ -1597,31 +3455,32 @@ async function applyInteractiveSelection(options, prompter = terminalPrompter())
|
|
|
1597
3455
|
}
|
|
1598
3456
|
function terminalPrompter() {
|
|
1599
3457
|
const question = async (message) => {
|
|
1600
|
-
const
|
|
3458
|
+
const readline3 = createInterface2({ input: stdin, output: stdout });
|
|
1601
3459
|
try {
|
|
1602
|
-
return await
|
|
3460
|
+
return await readline3.question(message);
|
|
1603
3461
|
} finally {
|
|
1604
|
-
|
|
3462
|
+
readline3.close();
|
|
1605
3463
|
}
|
|
1606
3464
|
};
|
|
1607
3465
|
return {
|
|
1608
3466
|
async selectModules({ choices, defaults }) {
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
3467
|
+
return dist_default4({
|
|
3468
|
+
message: "请选择要生成的平台模块",
|
|
3469
|
+
choices: choices.map((choice) => ({
|
|
3470
|
+
value: choice.value,
|
|
3471
|
+
name: choice.label,
|
|
3472
|
+
description: choice.hint,
|
|
3473
|
+
checked: defaults.includes(choice.value)
|
|
3474
|
+
})),
|
|
3475
|
+
pageSize: choices.length,
|
|
3476
|
+
loop: false,
|
|
3477
|
+
shortcuts: { all: null, invert: null },
|
|
3478
|
+
theme: {
|
|
3479
|
+
style: {
|
|
3480
|
+
keysHelpTip: () => "↑/↓ 切换 · 空格 选中或取消 · 回车 提交"
|
|
3481
|
+
}
|
|
3482
|
+
}
|
|
1616
3483
|
});
|
|
1617
|
-
const answer = (await question("> ")).trim();
|
|
1618
|
-
if (!answer)
|
|
1619
|
-
return defaults;
|
|
1620
|
-
const indexes = answer.split(",").map((part) => Number(part.trim()) - 1);
|
|
1621
|
-
if (indexes.some((index) => !Number.isSafeInteger(index) || !choices[index])) {
|
|
1622
|
-
throw new Error("模块选择包含无效编号");
|
|
1623
|
-
}
|
|
1624
|
-
return [...new Set(indexes.map((index) => choices[index].value))];
|
|
1625
3484
|
},
|
|
1626
3485
|
async confirm(message, defaultValue) {
|
|
1627
3486
|
const hint = defaultValue ? "Y/n" : "y/N";
|