@learnosity/lib-qti-converter 0.12.1 → 0.12.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 +9 -3
- package/docs/GETTING_STARTED.md +10 -4
- package/docs/TAGS_TO_QTI_METADATA.md +291 -0
- package/docs/_sidebar.md +10 -9
- package/package.json +1 -1
- package/packages/cli/dist/batchProcessors-BfmvnTQ5.js +215 -0
- package/packages/cli/dist/batchProcessors-BfmvnTQ5.js.map +1 -0
- package/packages/cli/dist/batchWorker.js +1 -1
- package/packages/cli/dist/configOutput-FwkFyQmk.js +399 -0
- package/packages/cli/dist/configOutput-FwkFyQmk.js.map +1 -0
- package/packages/cli/dist/create-prompt-COXnAzFl.js +1387 -0
- package/packages/cli/dist/create-prompt-COXnAzFl.js.map +1 -0
- package/packages/cli/dist/dist-CVD-X-DZ.js +278 -0
- package/packages/cli/dist/dist-CVD-X-DZ.js.map +1 -0
- package/packages/cli/dist/learnosityToQti-sKxcj5Hi.js +102 -0
- package/packages/cli/dist/learnosityToQti-sKxcj5Hi.js.map +1 -0
- package/packages/cli/dist/learnosityToQtiPackage-Ij4cM39M.js +632 -0
- package/packages/cli/dist/learnosityToQtiPackage-Ij4cM39M.js.map +1 -0
- package/packages/cli/dist/main.js +32 -37131
- package/packages/cli/dist/main.js.map +1 -1
- package/packages/cli/dist/pathUtils-Cz2GpPEb.js +2386 -0
- package/packages/cli/dist/pathUtils-Cz2GpPEb.js.map +1 -0
- package/packages/cli/dist/qtiPackageToLearnosity-CvXdmwsb.js +354 -0
- package/packages/cli/dist/qtiPackageToLearnosity-CvXdmwsb.js.map +1 -0
- package/packages/cli/dist/qtiToLearnosity-CkD0r1q0.js +97 -0
- package/packages/cli/dist/qtiToLearnosity-CkD0r1q0.js.map +1 -0
- package/packages/cli/dist/resolveOptions-CfXUqGkd.js +31562 -0
- package/packages/cli/dist/resolveOptions-CfXUqGkd.js.map +1 -0
- package/packages/cli/dist/rolldown-runtime-B4iAMlE-.js +35 -0
- package/packages/cli/dist/{batchProcessors-B8EQvMbH.js → table-DYcNeyJ_.js} +906 -1150
- package/packages/cli/dist/table-DYcNeyJ_.js.map +1 -0
- package/packages/core/dist/index.js +3 -1
- package/packages/core/dist/node.js +3 -1
- package/packages/cli/dist/batchProcessors-B8EQvMbH.js.map +0 -1
|
@@ -0,0 +1,1387 @@
|
|
|
1
|
+
import { i as __toESM, r as __require, t as __commonJSMin } from "./rolldown-runtime-B4iAMlE-.js";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import process$1 from "node:process";
|
|
4
|
+
import { stripVTControlCharacters, styleText } from "node:util";
|
|
5
|
+
import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
|
|
6
|
+
import * as readline from "node:readline";
|
|
7
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.2.0/node_modules/@inquirer/core/dist/lib/key.js
|
|
8
|
+
const keybindingLookup = /* @__PURE__ */ new Set(["emacs", "vim"]);
|
|
9
|
+
function isKeybinding(value) {
|
|
10
|
+
return keybindingLookup.has(value);
|
|
11
|
+
}
|
|
12
|
+
function getDefaultKeybindings() {
|
|
13
|
+
const env = process.env["INQUIRER_KEYBINDINGS"];
|
|
14
|
+
if (!env) return [];
|
|
15
|
+
return Array.from(new Set(env.toLowerCase().split(/[\s,]+/).filter(isKeybinding)));
|
|
16
|
+
}
|
|
17
|
+
const isUpKey = (key, keybindings = []) => key.name === "up" || keybindings.includes("vim") && key.name === "k" || keybindings.includes("emacs") && key.ctrl && key.name === "p";
|
|
18
|
+
const isDownKey = (key, keybindings = []) => key.name === "down" || keybindings.includes("vim") && key.name === "j" || keybindings.includes("emacs") && key.ctrl && key.name === "n";
|
|
19
|
+
const isSpaceKey = (key) => key.name === "space";
|
|
20
|
+
const isBackspaceKey = (key) => key.name === "backspace";
|
|
21
|
+
const isTabKey = (key) => key.name === "tab";
|
|
22
|
+
const isNumberKey = (key) => "1234567890".includes(key.name);
|
|
23
|
+
const isEnterKey = (key) => key.name === "enter" || key.name === "return";
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.2.0/node_modules/@inquirer/core/dist/lib/errors.js
|
|
26
|
+
var AbortPromptError = class extends Error {
|
|
27
|
+
name = "AbortPromptError";
|
|
28
|
+
message = "Prompt was aborted";
|
|
29
|
+
constructor(options) {
|
|
30
|
+
super();
|
|
31
|
+
this.cause = options?.cause;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var CancelPromptError = class extends Error {
|
|
35
|
+
name = "CancelPromptError";
|
|
36
|
+
message = "Prompt was canceled";
|
|
37
|
+
};
|
|
38
|
+
var ExitPromptError = class extends Error {
|
|
39
|
+
name = "ExitPromptError";
|
|
40
|
+
};
|
|
41
|
+
var HookError = class extends Error {
|
|
42
|
+
name = "HookError";
|
|
43
|
+
};
|
|
44
|
+
var ValidationError = class extends Error {
|
|
45
|
+
name = "ValidationError";
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.2.0/node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
49
|
+
const hookStorage = new AsyncLocalStorage();
|
|
50
|
+
function createStore(rl) {
|
|
51
|
+
return {
|
|
52
|
+
rl,
|
|
53
|
+
hooks: [],
|
|
54
|
+
hooksCleanup: [],
|
|
55
|
+
hooksEffect: [],
|
|
56
|
+
index: 0,
|
|
57
|
+
handleChange() {}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function withHooks(rl, cb) {
|
|
61
|
+
const store = createStore(rl);
|
|
62
|
+
return hookStorage.run(store, () => {
|
|
63
|
+
function cycle(render) {
|
|
64
|
+
store.handleChange = () => {
|
|
65
|
+
store.index = 0;
|
|
66
|
+
render();
|
|
67
|
+
};
|
|
68
|
+
store.handleChange();
|
|
69
|
+
}
|
|
70
|
+
return cb(cycle);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function getStore() {
|
|
74
|
+
const store = hookStorage.getStore();
|
|
75
|
+
if (!store) throw new HookError("[Inquirer] Hook functions can only be called from within a prompt");
|
|
76
|
+
return store;
|
|
77
|
+
}
|
|
78
|
+
function readline$1() {
|
|
79
|
+
return getStore().rl;
|
|
80
|
+
}
|
|
81
|
+
function withUpdates(fn) {
|
|
82
|
+
const wrapped = (...args) => {
|
|
83
|
+
const store = getStore();
|
|
84
|
+
let shouldUpdate = false;
|
|
85
|
+
const oldHandleChange = store.handleChange;
|
|
86
|
+
store.handleChange = () => {
|
|
87
|
+
shouldUpdate = true;
|
|
88
|
+
};
|
|
89
|
+
const returnValue = fn(...args);
|
|
90
|
+
if (shouldUpdate) oldHandleChange();
|
|
91
|
+
store.handleChange = oldHandleChange;
|
|
92
|
+
return returnValue;
|
|
93
|
+
};
|
|
94
|
+
return AsyncResource.bind(wrapped);
|
|
95
|
+
}
|
|
96
|
+
function withPointer(cb) {
|
|
97
|
+
const store = getStore();
|
|
98
|
+
const { index } = store;
|
|
99
|
+
const returnValue = cb({
|
|
100
|
+
get() {
|
|
101
|
+
return store.hooks[index];
|
|
102
|
+
},
|
|
103
|
+
set(value) {
|
|
104
|
+
store.hooks[index] = value;
|
|
105
|
+
},
|
|
106
|
+
initialized: index in store.hooks
|
|
107
|
+
});
|
|
108
|
+
store.index++;
|
|
109
|
+
return returnValue;
|
|
110
|
+
}
|
|
111
|
+
function handleChange() {
|
|
112
|
+
getStore().handleChange();
|
|
113
|
+
}
|
|
114
|
+
const effectScheduler = {
|
|
115
|
+
queue(cb) {
|
|
116
|
+
const store = getStore();
|
|
117
|
+
const { index } = store;
|
|
118
|
+
store.hooksEffect.push(() => {
|
|
119
|
+
store.hooksCleanup[index]?.();
|
|
120
|
+
const cleanFn = cb(readline$1());
|
|
121
|
+
if (cleanFn != null && typeof cleanFn !== "function") throw new ValidationError("useEffect return value must be a cleanup function or nothing.");
|
|
122
|
+
store.hooksCleanup[index] = cleanFn;
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
run() {
|
|
126
|
+
const store = getStore();
|
|
127
|
+
withUpdates(() => {
|
|
128
|
+
store.hooksEffect.forEach((effect) => {
|
|
129
|
+
effect();
|
|
130
|
+
});
|
|
131
|
+
store.hooksEffect.length = 0;
|
|
132
|
+
})();
|
|
133
|
+
},
|
|
134
|
+
clearAll() {
|
|
135
|
+
const store = getStore();
|
|
136
|
+
store.hooksCleanup.forEach((cleanFn) => {
|
|
137
|
+
cleanFn?.();
|
|
138
|
+
});
|
|
139
|
+
store.hooksEffect.length = 0;
|
|
140
|
+
store.hooksCleanup.length = 0;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.2.0/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
145
|
+
function isFactory(value) {
|
|
146
|
+
return typeof value === "function";
|
|
147
|
+
}
|
|
148
|
+
function useState(defaultValue) {
|
|
149
|
+
return withPointer((pointer) => {
|
|
150
|
+
const setState = AsyncResource.bind(function setState(newValue) {
|
|
151
|
+
if (pointer.get() !== newValue) {
|
|
152
|
+
pointer.set(newValue);
|
|
153
|
+
handleChange();
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
if (pointer.initialized) return [pointer.get(), setState];
|
|
157
|
+
const value = isFactory(defaultValue) ? defaultValue() : defaultValue;
|
|
158
|
+
pointer.set(value);
|
|
159
|
+
return [value, setState];
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
//#endregion
|
|
163
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.2.0/node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
164
|
+
function useEffect(cb, depArray) {
|
|
165
|
+
withPointer((pointer) => {
|
|
166
|
+
const oldDeps = pointer.get();
|
|
167
|
+
if (!Array.isArray(oldDeps) || depArray.some((dep, i) => !Object.is(dep, oldDeps[i]))) effectScheduler.queue(cb);
|
|
168
|
+
pointer.set(depArray);
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region ../../node_modules/.pnpm/@inquirer+figures@2.0.7/node_modules/@inquirer/figures/dist/index.js
|
|
173
|
+
function isUnicodeSupported() {
|
|
174
|
+
if (!process$1.platform.startsWith("win")) return process$1.env["TERM"] !== "linux";
|
|
175
|
+
return Boolean(process$1.env["CI"]) || Boolean(process$1.env["WT_SESSION"]) || Boolean(process$1.env["TERMINUS_SUBLIME"]) || process$1.env["ConEmuTask"] === "{cmd::Cmder}" || process$1.env["TERM_PROGRAM"] === "Terminus-Sublime" || process$1.env["TERM_PROGRAM"] === "vscode" || process$1.env["TERM"] === "xterm-256color" || process$1.env["TERM"] === "alacritty" || process$1.env["TERMINAL_EMULATOR"] === "JetBrains-JediTerm";
|
|
176
|
+
}
|
|
177
|
+
const common = {
|
|
178
|
+
circleQuestionMark: "(?)",
|
|
179
|
+
questionMarkPrefix: "(?)",
|
|
180
|
+
square: "█",
|
|
181
|
+
squareDarkShade: "▓",
|
|
182
|
+
squareMediumShade: "▒",
|
|
183
|
+
squareLightShade: "░",
|
|
184
|
+
squareTop: "▀",
|
|
185
|
+
squareBottom: "▄",
|
|
186
|
+
squareLeft: "▌",
|
|
187
|
+
squareRight: "▐",
|
|
188
|
+
squareCenter: "■",
|
|
189
|
+
bullet: "●",
|
|
190
|
+
dot: "․",
|
|
191
|
+
ellipsis: "…",
|
|
192
|
+
pointerSmall: "›",
|
|
193
|
+
triangleUp: "▲",
|
|
194
|
+
triangleUpSmall: "▴",
|
|
195
|
+
triangleDown: "▼",
|
|
196
|
+
triangleDownSmall: "▾",
|
|
197
|
+
triangleLeftSmall: "◂",
|
|
198
|
+
triangleRightSmall: "▸",
|
|
199
|
+
home: "⌂",
|
|
200
|
+
heart: "♥",
|
|
201
|
+
musicNote: "♪",
|
|
202
|
+
musicNoteBeamed: "♫",
|
|
203
|
+
arrowUp: "↑",
|
|
204
|
+
arrowDown: "↓",
|
|
205
|
+
arrowLeft: "←",
|
|
206
|
+
arrowRight: "→",
|
|
207
|
+
arrowLeftRight: "↔",
|
|
208
|
+
arrowUpDown: "↕",
|
|
209
|
+
almostEqual: "≈",
|
|
210
|
+
notEqual: "≠",
|
|
211
|
+
lessOrEqual: "≤",
|
|
212
|
+
greaterOrEqual: "≥",
|
|
213
|
+
identical: "≡",
|
|
214
|
+
infinity: "∞",
|
|
215
|
+
subscriptZero: "₀",
|
|
216
|
+
subscriptOne: "₁",
|
|
217
|
+
subscriptTwo: "₂",
|
|
218
|
+
subscriptThree: "₃",
|
|
219
|
+
subscriptFour: "₄",
|
|
220
|
+
subscriptFive: "₅",
|
|
221
|
+
subscriptSix: "₆",
|
|
222
|
+
subscriptSeven: "₇",
|
|
223
|
+
subscriptEight: "₈",
|
|
224
|
+
subscriptNine: "₉",
|
|
225
|
+
oneHalf: "½",
|
|
226
|
+
oneThird: "⅓",
|
|
227
|
+
oneQuarter: "¼",
|
|
228
|
+
oneFifth: "⅕",
|
|
229
|
+
oneSixth: "⅙",
|
|
230
|
+
oneEighth: "⅛",
|
|
231
|
+
twoThirds: "⅔",
|
|
232
|
+
twoFifths: "⅖",
|
|
233
|
+
threeQuarters: "¾",
|
|
234
|
+
threeFifths: "⅗",
|
|
235
|
+
threeEighths: "⅜",
|
|
236
|
+
fourFifths: "⅘",
|
|
237
|
+
fiveSixths: "⅚",
|
|
238
|
+
fiveEighths: "⅝",
|
|
239
|
+
sevenEighths: "⅞",
|
|
240
|
+
line: "─",
|
|
241
|
+
lineBold: "━",
|
|
242
|
+
lineDouble: "═",
|
|
243
|
+
lineDashed0: "┄",
|
|
244
|
+
lineDashed1: "┅",
|
|
245
|
+
lineDashed2: "┈",
|
|
246
|
+
lineDashed3: "┉",
|
|
247
|
+
lineDashed4: "╌",
|
|
248
|
+
lineDashed5: "╍",
|
|
249
|
+
lineDashed6: "╴",
|
|
250
|
+
lineDashed7: "╶",
|
|
251
|
+
lineDashed8: "╸",
|
|
252
|
+
lineDashed9: "╺",
|
|
253
|
+
lineDashed10: "╼",
|
|
254
|
+
lineDashed11: "╾",
|
|
255
|
+
lineDashed12: "−",
|
|
256
|
+
lineDashed13: "–",
|
|
257
|
+
lineDashed14: "‐",
|
|
258
|
+
lineDashed15: "⁃",
|
|
259
|
+
lineVertical: "│",
|
|
260
|
+
lineVerticalBold: "┃",
|
|
261
|
+
lineVerticalDouble: "║",
|
|
262
|
+
lineVerticalDashed0: "┆",
|
|
263
|
+
lineVerticalDashed1: "┇",
|
|
264
|
+
lineVerticalDashed2: "┊",
|
|
265
|
+
lineVerticalDashed3: "┋",
|
|
266
|
+
lineVerticalDashed4: "╎",
|
|
267
|
+
lineVerticalDashed5: "╏",
|
|
268
|
+
lineVerticalDashed6: "╵",
|
|
269
|
+
lineVerticalDashed7: "╷",
|
|
270
|
+
lineVerticalDashed8: "╹",
|
|
271
|
+
lineVerticalDashed9: "╻",
|
|
272
|
+
lineVerticalDashed10: "╽",
|
|
273
|
+
lineVerticalDashed11: "╿",
|
|
274
|
+
lineDownLeft: "┐",
|
|
275
|
+
lineDownLeftArc: "╮",
|
|
276
|
+
lineDownBoldLeftBold: "┓",
|
|
277
|
+
lineDownBoldLeft: "┒",
|
|
278
|
+
lineDownLeftBold: "┑",
|
|
279
|
+
lineDownDoubleLeftDouble: "╗",
|
|
280
|
+
lineDownDoubleLeft: "╖",
|
|
281
|
+
lineDownLeftDouble: "╕",
|
|
282
|
+
lineDownRight: "┌",
|
|
283
|
+
lineDownRightArc: "╭",
|
|
284
|
+
lineDownBoldRightBold: "┏",
|
|
285
|
+
lineDownBoldRight: "┎",
|
|
286
|
+
lineDownRightBold: "┍",
|
|
287
|
+
lineDownDoubleRightDouble: "╔",
|
|
288
|
+
lineDownDoubleRight: "╓",
|
|
289
|
+
lineDownRightDouble: "╒",
|
|
290
|
+
lineUpLeft: "┘",
|
|
291
|
+
lineUpLeftArc: "╯",
|
|
292
|
+
lineUpBoldLeftBold: "┛",
|
|
293
|
+
lineUpBoldLeft: "┚",
|
|
294
|
+
lineUpLeftBold: "┙",
|
|
295
|
+
lineUpDoubleLeftDouble: "╝",
|
|
296
|
+
lineUpDoubleLeft: "╜",
|
|
297
|
+
lineUpLeftDouble: "╛",
|
|
298
|
+
lineUpRight: "└",
|
|
299
|
+
lineUpRightArc: "╰",
|
|
300
|
+
lineUpBoldRightBold: "┗",
|
|
301
|
+
lineUpBoldRight: "┖",
|
|
302
|
+
lineUpRightBold: "┕",
|
|
303
|
+
lineUpDoubleRightDouble: "╚",
|
|
304
|
+
lineUpDoubleRight: "╙",
|
|
305
|
+
lineUpRightDouble: "╘",
|
|
306
|
+
lineUpDownLeft: "┤",
|
|
307
|
+
lineUpBoldDownBoldLeftBold: "┫",
|
|
308
|
+
lineUpBoldDownBoldLeft: "┨",
|
|
309
|
+
lineUpDownLeftBold: "┥",
|
|
310
|
+
lineUpBoldDownLeftBold: "┩",
|
|
311
|
+
lineUpDownBoldLeftBold: "┪",
|
|
312
|
+
lineUpDownBoldLeft: "┧",
|
|
313
|
+
lineUpBoldDownLeft: "┦",
|
|
314
|
+
lineUpDoubleDownDoubleLeftDouble: "╣",
|
|
315
|
+
lineUpDoubleDownDoubleLeft: "╢",
|
|
316
|
+
lineUpDownLeftDouble: "╡",
|
|
317
|
+
lineUpDownRight: "├",
|
|
318
|
+
lineUpBoldDownBoldRightBold: "┣",
|
|
319
|
+
lineUpBoldDownBoldRight: "┠",
|
|
320
|
+
lineUpDownRightBold: "┝",
|
|
321
|
+
lineUpBoldDownRightBold: "┡",
|
|
322
|
+
lineUpDownBoldRightBold: "┢",
|
|
323
|
+
lineUpDownBoldRight: "┟",
|
|
324
|
+
lineUpBoldDownRight: "┞",
|
|
325
|
+
lineUpDoubleDownDoubleRightDouble: "╠",
|
|
326
|
+
lineUpDoubleDownDoubleRight: "╟",
|
|
327
|
+
lineUpDownRightDouble: "╞",
|
|
328
|
+
lineDownLeftRight: "┬",
|
|
329
|
+
lineDownBoldLeftBoldRightBold: "┳",
|
|
330
|
+
lineDownLeftBoldRightBold: "┯",
|
|
331
|
+
lineDownBoldLeftRight: "┰",
|
|
332
|
+
lineDownBoldLeftBoldRight: "┱",
|
|
333
|
+
lineDownBoldLeftRightBold: "┲",
|
|
334
|
+
lineDownLeftRightBold: "┮",
|
|
335
|
+
lineDownLeftBoldRight: "┭",
|
|
336
|
+
lineDownDoubleLeftDoubleRightDouble: "╦",
|
|
337
|
+
lineDownDoubleLeftRight: "╥",
|
|
338
|
+
lineDownLeftDoubleRightDouble: "╤",
|
|
339
|
+
lineUpLeftRight: "┴",
|
|
340
|
+
lineUpBoldLeftBoldRightBold: "┻",
|
|
341
|
+
lineUpLeftBoldRightBold: "┷",
|
|
342
|
+
lineUpBoldLeftRight: "┸",
|
|
343
|
+
lineUpBoldLeftBoldRight: "┹",
|
|
344
|
+
lineUpBoldLeftRightBold: "┺",
|
|
345
|
+
lineUpLeftRightBold: "┶",
|
|
346
|
+
lineUpLeftBoldRight: "┵",
|
|
347
|
+
lineUpDoubleLeftDoubleRightDouble: "╩",
|
|
348
|
+
lineUpDoubleLeftRight: "╨",
|
|
349
|
+
lineUpLeftDoubleRightDouble: "╧",
|
|
350
|
+
lineUpDownLeftRight: "┼",
|
|
351
|
+
lineUpBoldDownBoldLeftBoldRightBold: "╋",
|
|
352
|
+
lineUpDownBoldLeftBoldRightBold: "╈",
|
|
353
|
+
lineUpBoldDownLeftBoldRightBold: "╇",
|
|
354
|
+
lineUpBoldDownBoldLeftRightBold: "╊",
|
|
355
|
+
lineUpBoldDownBoldLeftBoldRight: "╉",
|
|
356
|
+
lineUpBoldDownLeftRight: "╀",
|
|
357
|
+
lineUpDownBoldLeftRight: "╁",
|
|
358
|
+
lineUpDownLeftBoldRight: "┽",
|
|
359
|
+
lineUpDownLeftRightBold: "┾",
|
|
360
|
+
lineUpBoldDownBoldLeftRight: "╂",
|
|
361
|
+
lineUpDownLeftBoldRightBold: "┿",
|
|
362
|
+
lineUpBoldDownLeftBoldRight: "╃",
|
|
363
|
+
lineUpBoldDownLeftRightBold: "╄",
|
|
364
|
+
lineUpDownBoldLeftBoldRight: "╅",
|
|
365
|
+
lineUpDownBoldLeftRightBold: "╆",
|
|
366
|
+
lineUpDoubleDownDoubleLeftDoubleRightDouble: "╬",
|
|
367
|
+
lineUpDoubleDownDoubleLeftRight: "╫",
|
|
368
|
+
lineUpDownLeftDoubleRightDouble: "╪",
|
|
369
|
+
lineCross: "╳",
|
|
370
|
+
lineBackslash: "╲",
|
|
371
|
+
lineSlash: "╱"
|
|
372
|
+
};
|
|
373
|
+
const specialMainSymbols = {
|
|
374
|
+
tick: "✔",
|
|
375
|
+
info: "ℹ",
|
|
376
|
+
warning: "⚠",
|
|
377
|
+
cross: "✘",
|
|
378
|
+
squareSmall: "◻",
|
|
379
|
+
squareSmallFilled: "◼",
|
|
380
|
+
circle: "◯",
|
|
381
|
+
circleFilled: "◉",
|
|
382
|
+
circleDotted: "◌",
|
|
383
|
+
circleDouble: "◎",
|
|
384
|
+
circleCircle: "ⓞ",
|
|
385
|
+
circleCross: "ⓧ",
|
|
386
|
+
circlePipe: "Ⓘ",
|
|
387
|
+
radioOn: "◉",
|
|
388
|
+
radioOff: "◯",
|
|
389
|
+
checkboxOn: "☒",
|
|
390
|
+
checkboxOff: "☐",
|
|
391
|
+
checkboxCircleOn: "ⓧ",
|
|
392
|
+
checkboxCircleOff: "Ⓘ",
|
|
393
|
+
pointer: "❯",
|
|
394
|
+
triangleUpOutline: "△",
|
|
395
|
+
triangleLeft: "◀",
|
|
396
|
+
triangleRight: "▶",
|
|
397
|
+
lozenge: "◆",
|
|
398
|
+
lozengeOutline: "◇",
|
|
399
|
+
hamburger: "☰",
|
|
400
|
+
smiley: "㋡",
|
|
401
|
+
mustache: "෴",
|
|
402
|
+
star: "★",
|
|
403
|
+
play: "▶",
|
|
404
|
+
nodejs: "⬢",
|
|
405
|
+
oneSeventh: "⅐",
|
|
406
|
+
oneNinth: "⅑",
|
|
407
|
+
oneTenth: "⅒"
|
|
408
|
+
};
|
|
409
|
+
const specialFallbackSymbols = {
|
|
410
|
+
tick: "√",
|
|
411
|
+
info: "i",
|
|
412
|
+
warning: "‼",
|
|
413
|
+
cross: "×",
|
|
414
|
+
squareSmall: "□",
|
|
415
|
+
squareSmallFilled: "■",
|
|
416
|
+
circle: "( )",
|
|
417
|
+
circleFilled: "(*)",
|
|
418
|
+
circleDotted: "( )",
|
|
419
|
+
circleDouble: "( )",
|
|
420
|
+
circleCircle: "(○)",
|
|
421
|
+
circleCross: "(×)",
|
|
422
|
+
circlePipe: "(│)",
|
|
423
|
+
radioOn: "(*)",
|
|
424
|
+
radioOff: "( )",
|
|
425
|
+
checkboxOn: "[×]",
|
|
426
|
+
checkboxOff: "[ ]",
|
|
427
|
+
checkboxCircleOn: "(×)",
|
|
428
|
+
checkboxCircleOff: "( )",
|
|
429
|
+
pointer: ">",
|
|
430
|
+
triangleUpOutline: "∆",
|
|
431
|
+
triangleLeft: "◄",
|
|
432
|
+
triangleRight: "►",
|
|
433
|
+
lozenge: "♦",
|
|
434
|
+
lozengeOutline: "◊",
|
|
435
|
+
hamburger: "≡",
|
|
436
|
+
smiley: "☺",
|
|
437
|
+
mustache: "┌─┐",
|
|
438
|
+
star: "✶",
|
|
439
|
+
play: "►",
|
|
440
|
+
nodejs: "♦",
|
|
441
|
+
oneSeventh: "1/7",
|
|
442
|
+
oneNinth: "1/9",
|
|
443
|
+
oneTenth: "1/10"
|
|
444
|
+
};
|
|
445
|
+
const mainSymbols = {
|
|
446
|
+
...common,
|
|
447
|
+
...specialMainSymbols
|
|
448
|
+
};
|
|
449
|
+
const fallbackSymbols = {
|
|
450
|
+
...common,
|
|
451
|
+
...specialFallbackSymbols
|
|
452
|
+
};
|
|
453
|
+
const figures = isUnicodeSupported() ? mainSymbols : fallbackSymbols;
|
|
454
|
+
Object.entries(specialMainSymbols);
|
|
455
|
+
//#endregion
|
|
456
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.2.0/node_modules/@inquirer/core/dist/lib/theme.js
|
|
457
|
+
const defaultTheme = {
|
|
458
|
+
prefix: {
|
|
459
|
+
idle: styleText("blue", "?"),
|
|
460
|
+
done: styleText("green", figures.tick)
|
|
461
|
+
},
|
|
462
|
+
spinner: {
|
|
463
|
+
interval: 80,
|
|
464
|
+
frames: [
|
|
465
|
+
"⠋",
|
|
466
|
+
"⠙",
|
|
467
|
+
"⠹",
|
|
468
|
+
"⠸",
|
|
469
|
+
"⠼",
|
|
470
|
+
"⠴",
|
|
471
|
+
"⠦",
|
|
472
|
+
"⠧",
|
|
473
|
+
"⠇",
|
|
474
|
+
"⠏"
|
|
475
|
+
].map((frame) => styleText("yellow", frame))
|
|
476
|
+
},
|
|
477
|
+
keybindings: [],
|
|
478
|
+
style: {
|
|
479
|
+
answer: (text) => styleText("cyan", text),
|
|
480
|
+
message: (text) => styleText("bold", text),
|
|
481
|
+
error: (text) => styleText("red", `> ${text}`),
|
|
482
|
+
defaultAnswer: (text) => styleText("dim", `(${text})`),
|
|
483
|
+
help: (text) => styleText("dim", text),
|
|
484
|
+
highlight: (text) => styleText("cyan", text),
|
|
485
|
+
key: (text) => styleText("cyan", styleText("bold", `<${text}>`))
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
function getDefaultTheme() {
|
|
489
|
+
return {
|
|
490
|
+
...defaultTheme,
|
|
491
|
+
keybindings: getDefaultKeybindings()
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
//#endregion
|
|
495
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.2.0/node_modules/@inquirer/core/dist/lib/make-theme.js
|
|
496
|
+
function isPlainObject(value) {
|
|
497
|
+
if (typeof value !== "object" || value === null) return false;
|
|
498
|
+
let proto = value;
|
|
499
|
+
while (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);
|
|
500
|
+
return Object.getPrototypeOf(value) === proto;
|
|
501
|
+
}
|
|
502
|
+
function deepMerge(...objects) {
|
|
503
|
+
const output = {};
|
|
504
|
+
for (const obj of objects) for (const [key, value] of Object.entries(obj)) {
|
|
505
|
+
const prevValue = output[key];
|
|
506
|
+
output[key] = isPlainObject(prevValue) && isPlainObject(value) ? deepMerge(prevValue, value) : value;
|
|
507
|
+
}
|
|
508
|
+
return output;
|
|
509
|
+
}
|
|
510
|
+
function makeTheme(...themes) {
|
|
511
|
+
return deepMerge(...[getDefaultTheme(), ...themes.filter((theme) => theme != null)]);
|
|
512
|
+
}
|
|
513
|
+
//#endregion
|
|
514
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.2.0/node_modules/@inquirer/core/dist/lib/use-prefix.js
|
|
515
|
+
function usePrefix({ status = "idle", theme }) {
|
|
516
|
+
const [showLoader, setShowLoader] = useState(false);
|
|
517
|
+
const [tick, setTick] = useState(0);
|
|
518
|
+
const { prefix, spinner } = makeTheme(theme);
|
|
519
|
+
useEffect(() => {
|
|
520
|
+
if (status === "loading") {
|
|
521
|
+
let tickInterval;
|
|
522
|
+
let inc = -1;
|
|
523
|
+
const delayTimeout = setTimeout(() => {
|
|
524
|
+
setShowLoader(true);
|
|
525
|
+
tickInterval = setInterval(() => {
|
|
526
|
+
inc = inc + 1;
|
|
527
|
+
setTick(inc % spinner.frames.length);
|
|
528
|
+
}, spinner.interval);
|
|
529
|
+
}, 300);
|
|
530
|
+
return () => {
|
|
531
|
+
clearTimeout(delayTimeout);
|
|
532
|
+
clearInterval(tickInterval);
|
|
533
|
+
};
|
|
534
|
+
} else setShowLoader(false);
|
|
535
|
+
}, [status]);
|
|
536
|
+
if (showLoader) return spinner.frames[tick];
|
|
537
|
+
return typeof prefix === "string" ? prefix : prefix[status === "loading" ? "idle" : status] ?? prefix["idle"];
|
|
538
|
+
}
|
|
539
|
+
//#endregion
|
|
540
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.2.0/node_modules/@inquirer/core/dist/lib/use-ref.js
|
|
541
|
+
function useRef(val) {
|
|
542
|
+
return useState({ current: val })[0];
|
|
543
|
+
}
|
|
544
|
+
//#endregion
|
|
545
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.2.0/node_modules/@inquirer/core/dist/lib/use-keypress.js
|
|
546
|
+
function useKeypress(userHandler) {
|
|
547
|
+
const signal = useRef(userHandler);
|
|
548
|
+
signal.current = userHandler;
|
|
549
|
+
useEffect((rl) => {
|
|
550
|
+
let ignore = false;
|
|
551
|
+
const handler = withUpdates((_input, event) => {
|
|
552
|
+
if (ignore) return;
|
|
553
|
+
signal.current(event, rl);
|
|
554
|
+
});
|
|
555
|
+
rl.input.on("keypress", handler);
|
|
556
|
+
return () => {
|
|
557
|
+
ignore = true;
|
|
558
|
+
rl.input.removeListener("keypress", handler);
|
|
559
|
+
};
|
|
560
|
+
}, []);
|
|
561
|
+
}
|
|
562
|
+
//#endregion
|
|
563
|
+
//#region ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
564
|
+
var import_cli_width = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
565
|
+
module.exports = cliWidth;
|
|
566
|
+
function normalizeOpts(options) {
|
|
567
|
+
const defaultOpts = {
|
|
568
|
+
defaultWidth: 0,
|
|
569
|
+
output: process.stdout,
|
|
570
|
+
tty: __require("tty")
|
|
571
|
+
};
|
|
572
|
+
if (!options) return defaultOpts;
|
|
573
|
+
Object.keys(defaultOpts).forEach(function(key) {
|
|
574
|
+
if (!options[key]) options[key] = defaultOpts[key];
|
|
575
|
+
});
|
|
576
|
+
return options;
|
|
577
|
+
}
|
|
578
|
+
function cliWidth(options) {
|
|
579
|
+
const opts = normalizeOpts(options);
|
|
580
|
+
if (opts.output.getWindowSize) return opts.output.getWindowSize()[0] || opts.defaultWidth;
|
|
581
|
+
if (opts.tty.getWindowSize) return opts.tty.getWindowSize()[1] || opts.defaultWidth;
|
|
582
|
+
if (opts.output.columns) return opts.output.columns;
|
|
583
|
+
if (process.env.CLI_WIDTH) {
|
|
584
|
+
const width = parseInt(process.env.CLI_WIDTH, 10);
|
|
585
|
+
if (!isNaN(width) && width !== 0) return width;
|
|
586
|
+
}
|
|
587
|
+
return opts.defaultWidth;
|
|
588
|
+
}
|
|
589
|
+
})))(), 1);
|
|
590
|
+
const getCodePointsLength = (() => {
|
|
591
|
+
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
592
|
+
return (input) => {
|
|
593
|
+
let surrogatePairsNr = 0;
|
|
594
|
+
SURROGATE_PAIR_RE.lastIndex = 0;
|
|
595
|
+
while (SURROGATE_PAIR_RE.test(input)) surrogatePairsNr += 1;
|
|
596
|
+
return input.length - surrogatePairsNr;
|
|
597
|
+
};
|
|
598
|
+
})();
|
|
599
|
+
const isFullWidth = (x) => {
|
|
600
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
601
|
+
};
|
|
602
|
+
const isWideNotCJKTNotEmoji = (x) => {
|
|
603
|
+
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;
|
|
604
|
+
};
|
|
605
|
+
//#endregion
|
|
606
|
+
//#region ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
|
|
607
|
+
const ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
|
|
608
|
+
const CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
609
|
+
const CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy;
|
|
610
|
+
const TAB_RE = /\t{1,1000}/y;
|
|
611
|
+
const 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?))*/uy;
|
|
612
|
+
const LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
613
|
+
const MODIFIER_RE = /\p{M}+/gu;
|
|
614
|
+
const NO_TRUNCATION$1 = {
|
|
615
|
+
limit: Infinity,
|
|
616
|
+
ellipsis: ""
|
|
617
|
+
};
|
|
618
|
+
const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
|
|
619
|
+
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
620
|
+
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
621
|
+
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION$1, widthOptions).width : 0);
|
|
622
|
+
const ANSI_WIDTH = 0;
|
|
623
|
+
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
624
|
+
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
625
|
+
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
626
|
+
const FULL_WIDTH_WIDTH = 2;
|
|
627
|
+
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
628
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
|
|
629
|
+
const PARSE_BLOCKS = [
|
|
630
|
+
[LATIN_RE, REGULAR_WIDTH],
|
|
631
|
+
[ANSI_RE, ANSI_WIDTH],
|
|
632
|
+
[CONTROL_RE, CONTROL_WIDTH],
|
|
633
|
+
[TAB_RE, TAB_WIDTH],
|
|
634
|
+
[EMOJI_RE, EMOJI_WIDTH],
|
|
635
|
+
[CJKT_WIDE_RE, WIDE_WIDTH]
|
|
636
|
+
];
|
|
637
|
+
let indexPrev = 0;
|
|
638
|
+
let index = 0;
|
|
639
|
+
let length = input.length;
|
|
640
|
+
let lengthExtra = 0;
|
|
641
|
+
let truncationEnabled = false;
|
|
642
|
+
let truncationIndex = length;
|
|
643
|
+
let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
|
|
644
|
+
let unmatchedStart = 0;
|
|
645
|
+
let unmatchedEnd = 0;
|
|
646
|
+
let width = 0;
|
|
647
|
+
let widthExtra = 0;
|
|
648
|
+
outer: while (true) {
|
|
649
|
+
if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
|
|
650
|
+
const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
|
|
651
|
+
lengthExtra = 0;
|
|
652
|
+
for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
|
|
653
|
+
const codePoint = char.codePointAt(0) || 0;
|
|
654
|
+
if (isFullWidth(codePoint)) widthExtra = FULL_WIDTH_WIDTH;
|
|
655
|
+
else if (isWideNotCJKTNotEmoji(codePoint)) widthExtra = WIDE_WIDTH;
|
|
656
|
+
else widthExtra = REGULAR_WIDTH;
|
|
657
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
658
|
+
if (width + widthExtra > LIMIT) {
|
|
659
|
+
truncationEnabled = true;
|
|
660
|
+
break outer;
|
|
661
|
+
}
|
|
662
|
+
lengthExtra += char.length;
|
|
663
|
+
width += widthExtra;
|
|
664
|
+
}
|
|
665
|
+
unmatchedStart = unmatchedEnd = 0;
|
|
666
|
+
}
|
|
667
|
+
if (index >= length) break outer;
|
|
668
|
+
for (let i = 0, l = PARSE_BLOCKS.length; i < l; i++) {
|
|
669
|
+
const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i];
|
|
670
|
+
BLOCK_RE.lastIndex = index;
|
|
671
|
+
if (BLOCK_RE.test(input)) {
|
|
672
|
+
lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
|
|
673
|
+
widthExtra = lengthExtra * BLOCK_WIDTH;
|
|
674
|
+
if (width + widthExtra > truncationLimit) truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / BLOCK_WIDTH));
|
|
675
|
+
if (width + widthExtra > LIMIT) {
|
|
676
|
+
truncationEnabled = true;
|
|
677
|
+
break outer;
|
|
678
|
+
}
|
|
679
|
+
width += widthExtra;
|
|
680
|
+
unmatchedStart = indexPrev;
|
|
681
|
+
unmatchedEnd = index;
|
|
682
|
+
index = indexPrev = BLOCK_RE.lastIndex;
|
|
683
|
+
continue outer;
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
index += 1;
|
|
687
|
+
}
|
|
688
|
+
return {
|
|
689
|
+
width: truncationEnabled ? truncationLimit : width,
|
|
690
|
+
index: truncationEnabled ? truncationIndex : length,
|
|
691
|
+
truncated: truncationEnabled,
|
|
692
|
+
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
693
|
+
};
|
|
694
|
+
};
|
|
695
|
+
//#endregion
|
|
696
|
+
//#region ../../node_modules/.pnpm/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
|
|
697
|
+
const NO_TRUNCATION = {
|
|
698
|
+
limit: Infinity,
|
|
699
|
+
ellipsis: "",
|
|
700
|
+
ellipsisWidth: 0
|
|
701
|
+
};
|
|
702
|
+
const fastStringWidth = (input, options = {}) => {
|
|
703
|
+
return getStringTruncatedWidth(input, NO_TRUNCATION, options).width;
|
|
704
|
+
};
|
|
705
|
+
//#endregion
|
|
706
|
+
//#region ../../node_modules/.pnpm/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js
|
|
707
|
+
const ESC$1 = "\x1B";
|
|
708
|
+
const CSI = "";
|
|
709
|
+
const END_CODE = 39;
|
|
710
|
+
const ANSI_ESCAPE_BELL = "\x07";
|
|
711
|
+
const ANSI_CSI = "[";
|
|
712
|
+
const ANSI_OSC = "]";
|
|
713
|
+
const ANSI_SGR_TERMINATOR = "m";
|
|
714
|
+
const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
715
|
+
const GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
|
|
716
|
+
const getClosingCode = (openingCode) => {
|
|
717
|
+
if (openingCode >= 30 && openingCode <= 37) return 39;
|
|
718
|
+
if (openingCode >= 90 && openingCode <= 97) return 39;
|
|
719
|
+
if (openingCode >= 40 && openingCode <= 47) return 49;
|
|
720
|
+
if (openingCode >= 100 && openingCode <= 107) return 49;
|
|
721
|
+
if (openingCode === 1 || openingCode === 2) return 22;
|
|
722
|
+
if (openingCode === 3) return 23;
|
|
723
|
+
if (openingCode === 4) return 24;
|
|
724
|
+
if (openingCode === 7) return 27;
|
|
725
|
+
if (openingCode === 8) return 28;
|
|
726
|
+
if (openingCode === 9) return 29;
|
|
727
|
+
if (openingCode === 0) return 0;
|
|
728
|
+
};
|
|
729
|
+
const wrapAnsiCode = (code) => `${ESC$1}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
730
|
+
const wrapAnsiHyperlink = (url) => `${ESC$1}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
731
|
+
const wrapWord = (rows, word, columns) => {
|
|
732
|
+
const characters = word[Symbol.iterator]();
|
|
733
|
+
let isInsideEscape = false;
|
|
734
|
+
let isInsideLinkEscape = false;
|
|
735
|
+
let lastRow = rows.at(-1);
|
|
736
|
+
let visible = lastRow === void 0 ? 0 : fastStringWidth(lastRow);
|
|
737
|
+
let currentCharacter = characters.next();
|
|
738
|
+
let nextCharacter = characters.next();
|
|
739
|
+
let rawCharacterIndex = 0;
|
|
740
|
+
while (!currentCharacter.done) {
|
|
741
|
+
const character = currentCharacter.value;
|
|
742
|
+
const characterLength = fastStringWidth(character);
|
|
743
|
+
if (visible + characterLength <= columns) rows[rows.length - 1] += character;
|
|
744
|
+
else {
|
|
745
|
+
rows.push(character);
|
|
746
|
+
visible = 0;
|
|
747
|
+
}
|
|
748
|
+
if (character === ESC$1 || character === CSI) {
|
|
749
|
+
isInsideEscape = true;
|
|
750
|
+
isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
|
|
751
|
+
}
|
|
752
|
+
if (isInsideEscape) {
|
|
753
|
+
if (isInsideLinkEscape) {
|
|
754
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
755
|
+
isInsideEscape = false;
|
|
756
|
+
isInsideLinkEscape = false;
|
|
757
|
+
}
|
|
758
|
+
} else if (character === ANSI_SGR_TERMINATOR) isInsideEscape = false;
|
|
759
|
+
} else {
|
|
760
|
+
visible += characterLength;
|
|
761
|
+
if (visible === columns && !nextCharacter.done) {
|
|
762
|
+
rows.push("");
|
|
763
|
+
visible = 0;
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
currentCharacter = nextCharacter;
|
|
767
|
+
nextCharacter = characters.next();
|
|
768
|
+
rawCharacterIndex += character.length;
|
|
769
|
+
}
|
|
770
|
+
lastRow = rows.at(-1);
|
|
771
|
+
if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) rows[rows.length - 2] += rows.pop();
|
|
772
|
+
};
|
|
773
|
+
const stringVisibleTrimSpacesRight = (string) => {
|
|
774
|
+
const words = string.split(" ");
|
|
775
|
+
let last = words.length;
|
|
776
|
+
while (last) {
|
|
777
|
+
if (fastStringWidth(words[last - 1])) break;
|
|
778
|
+
last--;
|
|
779
|
+
}
|
|
780
|
+
if (last === words.length) return string;
|
|
781
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
782
|
+
};
|
|
783
|
+
const exec = (string, columns, options = {}) => {
|
|
784
|
+
if (options.trim !== false && string.trim() === "") return "";
|
|
785
|
+
let returnValue = "";
|
|
786
|
+
let escapeCode;
|
|
787
|
+
let escapeUrl;
|
|
788
|
+
const words = string.split(" ");
|
|
789
|
+
let rows = [""];
|
|
790
|
+
let rowLength = 0;
|
|
791
|
+
for (let index = 0; index < words.length; index++) {
|
|
792
|
+
const word = words[index];
|
|
793
|
+
if (options.trim !== false) {
|
|
794
|
+
const row = rows.at(-1) ?? "";
|
|
795
|
+
const trimmed = row.trimStart();
|
|
796
|
+
if (row.length !== trimmed.length) {
|
|
797
|
+
rows[rows.length - 1] = trimmed;
|
|
798
|
+
rowLength = fastStringWidth(trimmed);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
if (index !== 0) {
|
|
802
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
803
|
+
rows.push("");
|
|
804
|
+
rowLength = 0;
|
|
805
|
+
}
|
|
806
|
+
if (rowLength || options.trim === false) {
|
|
807
|
+
rows[rows.length - 1] += " ";
|
|
808
|
+
rowLength++;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
const wordLength = fastStringWidth(word);
|
|
812
|
+
if (options.hard && wordLength > columns) {
|
|
813
|
+
const remainingColumns = columns - rowLength;
|
|
814
|
+
const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
|
|
815
|
+
if (Math.floor((wordLength - 1) / columns) < breaksStartingThisLine) rows.push("");
|
|
816
|
+
wrapWord(rows, word, columns);
|
|
817
|
+
rowLength = fastStringWidth(rows.at(-1) ?? "");
|
|
818
|
+
continue;
|
|
819
|
+
}
|
|
820
|
+
if (rowLength + wordLength > columns && rowLength && wordLength) {
|
|
821
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
822
|
+
wrapWord(rows, word, columns);
|
|
823
|
+
rowLength = fastStringWidth(rows.at(-1) ?? "");
|
|
824
|
+
continue;
|
|
825
|
+
}
|
|
826
|
+
rows.push("");
|
|
827
|
+
rowLength = 0;
|
|
828
|
+
}
|
|
829
|
+
if (rowLength + wordLength > columns && options.wordWrap === false) {
|
|
830
|
+
wrapWord(rows, word, columns);
|
|
831
|
+
rowLength = fastStringWidth(rows.at(-1) ?? "");
|
|
832
|
+
continue;
|
|
833
|
+
}
|
|
834
|
+
rows[rows.length - 1] += word;
|
|
835
|
+
rowLength += wordLength;
|
|
836
|
+
}
|
|
837
|
+
if (options.trim !== false) rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
838
|
+
const preString = rows.join("\n");
|
|
839
|
+
let inSurrogate = false;
|
|
840
|
+
for (let i = 0; i < preString.length; i++) {
|
|
841
|
+
const character = preString[i];
|
|
842
|
+
returnValue += character;
|
|
843
|
+
if (!inSurrogate) {
|
|
844
|
+
inSurrogate = character >= "\ud800" && character <= "\udbff";
|
|
845
|
+
if (inSurrogate) continue;
|
|
846
|
+
} else inSurrogate = false;
|
|
847
|
+
if (character === ESC$1 || character === CSI) {
|
|
848
|
+
GROUP_REGEX.lastIndex = i + 1;
|
|
849
|
+
const groups = GROUP_REGEX.exec(preString)?.groups;
|
|
850
|
+
if (groups?.code !== void 0) {
|
|
851
|
+
const code = Number.parseFloat(groups.code);
|
|
852
|
+
escapeCode = code === END_CODE ? void 0 : code;
|
|
853
|
+
} else if (groups?.uri !== void 0) escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
854
|
+
}
|
|
855
|
+
if (preString[i + 1] === "\n") {
|
|
856
|
+
if (escapeUrl) returnValue += wrapAnsiHyperlink("");
|
|
857
|
+
const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
|
|
858
|
+
if (escapeCode && closingCode) returnValue += wrapAnsiCode(closingCode);
|
|
859
|
+
} else if (character === "\n") {
|
|
860
|
+
if (escapeCode && getClosingCode(escapeCode)) returnValue += wrapAnsiCode(escapeCode);
|
|
861
|
+
if (escapeUrl) returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
return returnValue;
|
|
865
|
+
};
|
|
866
|
+
const CRLF_OR_LF = /\r?\n/;
|
|
867
|
+
function wrapAnsi(string, columns, options) {
|
|
868
|
+
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
869
|
+
}
|
|
870
|
+
//#endregion
|
|
871
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.2.0/node_modules/@inquirer/core/dist/lib/utils.js
|
|
872
|
+
/**
|
|
873
|
+
* Force line returns at specific width. This function is ANSI code friendly and it'll
|
|
874
|
+
* ignore invisible codes during width calculation.
|
|
875
|
+
* @param {string} content
|
|
876
|
+
* @param {number} width
|
|
877
|
+
* @return {string}
|
|
878
|
+
*/
|
|
879
|
+
function breakLines(content, width) {
|
|
880
|
+
return content.split("\n").flatMap((line) => wrapAnsi(line, width, {
|
|
881
|
+
trim: false,
|
|
882
|
+
wordWrap: false
|
|
883
|
+
}).split("\n").map((str) => str.trimEnd())).join("\n");
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* Returns the width of the active readline, or 80 as default value.
|
|
887
|
+
* @returns {number}
|
|
888
|
+
*/
|
|
889
|
+
function readlineWidth() {
|
|
890
|
+
return (0, import_cli_width.default)({
|
|
891
|
+
defaultWidth: 80,
|
|
892
|
+
output: readline$1().output
|
|
893
|
+
});
|
|
894
|
+
}
|
|
895
|
+
//#endregion
|
|
896
|
+
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
897
|
+
var import_lib = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
898
|
+
const Stream = __require("stream");
|
|
899
|
+
var MuteStream = class extends Stream {
|
|
900
|
+
#isTTY = null;
|
|
901
|
+
constructor(opts = {}) {
|
|
902
|
+
super(opts);
|
|
903
|
+
this.writable = this.readable = true;
|
|
904
|
+
this.muted = false;
|
|
905
|
+
this.on("pipe", this._onpipe);
|
|
906
|
+
this.replace = opts.replace;
|
|
907
|
+
this._prompt = opts.prompt || null;
|
|
908
|
+
this._hadControl = false;
|
|
909
|
+
}
|
|
910
|
+
#destSrc(key, def) {
|
|
911
|
+
if (this._dest) return this._dest[key];
|
|
912
|
+
if (this._src) return this._src[key];
|
|
913
|
+
return def;
|
|
914
|
+
}
|
|
915
|
+
#proxy(method, ...args) {
|
|
916
|
+
if (typeof this._dest?.[method] === "function") this._dest[method](...args);
|
|
917
|
+
if (typeof this._src?.[method] === "function") this._src[method](...args);
|
|
918
|
+
}
|
|
919
|
+
get isTTY() {
|
|
920
|
+
if (this.#isTTY !== null) return this.#isTTY;
|
|
921
|
+
return this.#destSrc("isTTY", false);
|
|
922
|
+
}
|
|
923
|
+
set isTTY(val) {
|
|
924
|
+
this.#isTTY = val;
|
|
925
|
+
}
|
|
926
|
+
get rows() {
|
|
927
|
+
return this.#destSrc("rows");
|
|
928
|
+
}
|
|
929
|
+
get columns() {
|
|
930
|
+
return this.#destSrc("columns");
|
|
931
|
+
}
|
|
932
|
+
mute() {
|
|
933
|
+
this.muted = true;
|
|
934
|
+
}
|
|
935
|
+
unmute() {
|
|
936
|
+
this.muted = false;
|
|
937
|
+
}
|
|
938
|
+
_onpipe(src) {
|
|
939
|
+
this._src = src;
|
|
940
|
+
}
|
|
941
|
+
pipe(dest, options) {
|
|
942
|
+
this._dest = dest;
|
|
943
|
+
return super.pipe(dest, options);
|
|
944
|
+
}
|
|
945
|
+
pause() {
|
|
946
|
+
if (this._src) return this._src.pause();
|
|
947
|
+
}
|
|
948
|
+
resume() {
|
|
949
|
+
if (this._src) return this._src.resume();
|
|
950
|
+
}
|
|
951
|
+
write(c) {
|
|
952
|
+
if (this.muted) {
|
|
953
|
+
if (!this.replace) return true;
|
|
954
|
+
if (c.match(/^\u001b/)) {
|
|
955
|
+
if (c.indexOf(this._prompt) === 0) {
|
|
956
|
+
c = c.slice(this._prompt.length);
|
|
957
|
+
c = c.replace(/./g, this.replace);
|
|
958
|
+
c = this._prompt + c;
|
|
959
|
+
}
|
|
960
|
+
this._hadControl = true;
|
|
961
|
+
return this.emit("data", c);
|
|
962
|
+
} else {
|
|
963
|
+
if (this._prompt && this._hadControl && c.indexOf(this._prompt) === 0) {
|
|
964
|
+
this._hadControl = false;
|
|
965
|
+
this.emit("data", this._prompt);
|
|
966
|
+
c = c.slice(this._prompt.length);
|
|
967
|
+
}
|
|
968
|
+
c = c.toString().replace(/./g, this.replace);
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
this.emit("data", c);
|
|
972
|
+
}
|
|
973
|
+
end(c) {
|
|
974
|
+
if (this.muted) {
|
|
975
|
+
if (c && this.replace) c = c.toString().replace(/./g, this.replace);
|
|
976
|
+
else c = null;
|
|
977
|
+
}
|
|
978
|
+
if (c) this.emit("data", c);
|
|
979
|
+
this.emit("end");
|
|
980
|
+
}
|
|
981
|
+
destroy(...args) {
|
|
982
|
+
return this.#proxy("destroy", ...args);
|
|
983
|
+
}
|
|
984
|
+
destroySoon(...args) {
|
|
985
|
+
return this.#proxy("destroySoon", ...args);
|
|
986
|
+
}
|
|
987
|
+
close(...args) {
|
|
988
|
+
return this.#proxy("close", ...args);
|
|
989
|
+
}
|
|
990
|
+
};
|
|
991
|
+
module.exports = MuteStream;
|
|
992
|
+
})))(), 1);
|
|
993
|
+
/**
|
|
994
|
+
* This is not the set of all possible signals.
|
|
995
|
+
*
|
|
996
|
+
* It IS, however, the set of all signals that trigger
|
|
997
|
+
* an exit on either Linux or BSD systems. Linux is a
|
|
998
|
+
* superset of the signal names supported on BSD, and
|
|
999
|
+
* the unknown signals just fail to register, so we can
|
|
1000
|
+
* catch that easily enough.
|
|
1001
|
+
*
|
|
1002
|
+
* Windows signals are a different set, since there are
|
|
1003
|
+
* signals that terminate Windows processes, but don't
|
|
1004
|
+
* terminate (or don't even exist) on Posix systems.
|
|
1005
|
+
*
|
|
1006
|
+
* Don't bother with SIGKILL. It's uncatchable, which
|
|
1007
|
+
* means that we can't fire any callbacks anyway.
|
|
1008
|
+
*
|
|
1009
|
+
* If a user does happen to register a handler on a non-
|
|
1010
|
+
* fatal signal like SIGWINCH or something, and then
|
|
1011
|
+
* exit, it'll end up firing `process.emit('exit')`, so
|
|
1012
|
+
* the handler will be fired anyway.
|
|
1013
|
+
*
|
|
1014
|
+
* SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
|
|
1015
|
+
* artificially, inherently leave the process in a
|
|
1016
|
+
* state from which it is not safe to try and enter JS
|
|
1017
|
+
* listeners.
|
|
1018
|
+
*/
|
|
1019
|
+
const signals = [];
|
|
1020
|
+
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
1021
|
+
if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
1022
|
+
if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
1023
|
+
//#endregion
|
|
1024
|
+
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
|
|
1025
|
+
const processOk = (process) => !!process && typeof process === "object" && typeof process.removeListener === "function" && typeof process.emit === "function" && typeof process.reallyExit === "function" && typeof process.listeners === "function" && typeof process.kill === "function" && typeof process.pid === "number" && typeof process.on === "function";
|
|
1026
|
+
const kExitEmitter = Symbol.for("signal-exit emitter");
|
|
1027
|
+
const global = globalThis;
|
|
1028
|
+
const ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
1029
|
+
var Emitter = class {
|
|
1030
|
+
emitted = {
|
|
1031
|
+
afterExit: false,
|
|
1032
|
+
exit: false
|
|
1033
|
+
};
|
|
1034
|
+
listeners = {
|
|
1035
|
+
afterExit: [],
|
|
1036
|
+
exit: []
|
|
1037
|
+
};
|
|
1038
|
+
count = 0;
|
|
1039
|
+
id = Math.random();
|
|
1040
|
+
constructor() {
|
|
1041
|
+
if (global[kExitEmitter]) return global[kExitEmitter];
|
|
1042
|
+
ObjectDefineProperty(global, kExitEmitter, {
|
|
1043
|
+
value: this,
|
|
1044
|
+
writable: false,
|
|
1045
|
+
enumerable: false,
|
|
1046
|
+
configurable: false
|
|
1047
|
+
});
|
|
1048
|
+
}
|
|
1049
|
+
on(ev, fn) {
|
|
1050
|
+
this.listeners[ev].push(fn);
|
|
1051
|
+
}
|
|
1052
|
+
removeListener(ev, fn) {
|
|
1053
|
+
const list = this.listeners[ev];
|
|
1054
|
+
const i = list.indexOf(fn);
|
|
1055
|
+
/* c8 ignore start */
|
|
1056
|
+
if (i === -1) return;
|
|
1057
|
+
/* c8 ignore stop */
|
|
1058
|
+
if (i === 0 && list.length === 1) list.length = 0;
|
|
1059
|
+
else list.splice(i, 1);
|
|
1060
|
+
}
|
|
1061
|
+
emit(ev, code, signal) {
|
|
1062
|
+
if (this.emitted[ev]) return false;
|
|
1063
|
+
this.emitted[ev] = true;
|
|
1064
|
+
let ret = false;
|
|
1065
|
+
for (const fn of this.listeners[ev]) ret = fn(code, signal) === true || ret;
|
|
1066
|
+
if (ev === "exit") ret = this.emit("afterExit", code, signal) || ret;
|
|
1067
|
+
return ret;
|
|
1068
|
+
}
|
|
1069
|
+
};
|
|
1070
|
+
var SignalExitBase = class {};
|
|
1071
|
+
const signalExitWrap = (handler) => {
|
|
1072
|
+
return {
|
|
1073
|
+
onExit(cb, opts) {
|
|
1074
|
+
return handler.onExit(cb, opts);
|
|
1075
|
+
},
|
|
1076
|
+
load() {
|
|
1077
|
+
return handler.load();
|
|
1078
|
+
},
|
|
1079
|
+
unload() {
|
|
1080
|
+
return handler.unload();
|
|
1081
|
+
}
|
|
1082
|
+
};
|
|
1083
|
+
};
|
|
1084
|
+
var SignalExitFallback = class extends SignalExitBase {
|
|
1085
|
+
onExit() {
|
|
1086
|
+
return () => {};
|
|
1087
|
+
}
|
|
1088
|
+
load() {}
|
|
1089
|
+
unload() {}
|
|
1090
|
+
};
|
|
1091
|
+
var SignalExit = class extends SignalExitBase {
|
|
1092
|
+
/* c8 ignore start */
|
|
1093
|
+
#hupSig = process$2.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
1094
|
+
/* c8 ignore stop */
|
|
1095
|
+
#emitter = new Emitter();
|
|
1096
|
+
#process;
|
|
1097
|
+
#originalProcessEmit;
|
|
1098
|
+
#originalProcessReallyExit;
|
|
1099
|
+
#sigListeners = {};
|
|
1100
|
+
#loaded = false;
|
|
1101
|
+
constructor(process) {
|
|
1102
|
+
super();
|
|
1103
|
+
this.#process = process;
|
|
1104
|
+
this.#sigListeners = {};
|
|
1105
|
+
for (const sig of signals) this.#sigListeners[sig] = () => {
|
|
1106
|
+
const listeners = this.#process.listeners(sig);
|
|
1107
|
+
let { count } = this.#emitter;
|
|
1108
|
+
/* c8 ignore start */
|
|
1109
|
+
const p = process;
|
|
1110
|
+
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") count += p.__signal_exit_emitter__.count;
|
|
1111
|
+
/* c8 ignore stop */
|
|
1112
|
+
if (listeners.length === count) {
|
|
1113
|
+
this.unload();
|
|
1114
|
+
const ret = this.#emitter.emit("exit", null, sig);
|
|
1115
|
+
/* c8 ignore start */
|
|
1116
|
+
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
1117
|
+
if (!ret) process.kill(process.pid, s);
|
|
1118
|
+
}
|
|
1119
|
+
};
|
|
1120
|
+
this.#originalProcessReallyExit = process.reallyExit;
|
|
1121
|
+
this.#originalProcessEmit = process.emit;
|
|
1122
|
+
}
|
|
1123
|
+
onExit(cb, opts) {
|
|
1124
|
+
/* c8 ignore start */
|
|
1125
|
+
if (!processOk(this.#process)) return () => {};
|
|
1126
|
+
/* c8 ignore stop */
|
|
1127
|
+
if (this.#loaded === false) this.load();
|
|
1128
|
+
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
1129
|
+
this.#emitter.on(ev, cb);
|
|
1130
|
+
return () => {
|
|
1131
|
+
this.#emitter.removeListener(ev, cb);
|
|
1132
|
+
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) this.unload();
|
|
1133
|
+
};
|
|
1134
|
+
}
|
|
1135
|
+
load() {
|
|
1136
|
+
if (this.#loaded) return;
|
|
1137
|
+
this.#loaded = true;
|
|
1138
|
+
this.#emitter.count += 1;
|
|
1139
|
+
for (const sig of signals) try {
|
|
1140
|
+
const fn = this.#sigListeners[sig];
|
|
1141
|
+
if (fn) this.#process.on(sig, fn);
|
|
1142
|
+
} catch (_) {}
|
|
1143
|
+
this.#process.emit = (ev, ...a) => {
|
|
1144
|
+
return this.#processEmit(ev, ...a);
|
|
1145
|
+
};
|
|
1146
|
+
this.#process.reallyExit = (code) => {
|
|
1147
|
+
return this.#processReallyExit(code);
|
|
1148
|
+
};
|
|
1149
|
+
}
|
|
1150
|
+
unload() {
|
|
1151
|
+
if (!this.#loaded) return;
|
|
1152
|
+
this.#loaded = false;
|
|
1153
|
+
signals.forEach((sig) => {
|
|
1154
|
+
const listener = this.#sigListeners[sig];
|
|
1155
|
+
/* c8 ignore start */
|
|
1156
|
+
if (!listener) throw new Error("Listener not defined for signal: " + sig);
|
|
1157
|
+
/* c8 ignore stop */
|
|
1158
|
+
try {
|
|
1159
|
+
this.#process.removeListener(sig, listener);
|
|
1160
|
+
} catch (_) {}
|
|
1161
|
+
/* c8 ignore stop */
|
|
1162
|
+
});
|
|
1163
|
+
this.#process.emit = this.#originalProcessEmit;
|
|
1164
|
+
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
1165
|
+
this.#emitter.count -= 1;
|
|
1166
|
+
}
|
|
1167
|
+
#processReallyExit(code) {
|
|
1168
|
+
/* c8 ignore start */
|
|
1169
|
+
if (!processOk(this.#process)) return 0;
|
|
1170
|
+
this.#process.exitCode = code || 0;
|
|
1171
|
+
/* c8 ignore stop */
|
|
1172
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
1173
|
+
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
1174
|
+
}
|
|
1175
|
+
#processEmit(ev, ...args) {
|
|
1176
|
+
const og = this.#originalProcessEmit;
|
|
1177
|
+
if (ev === "exit" && processOk(this.#process)) {
|
|
1178
|
+
if (typeof args[0] === "number") this.#process.exitCode = args[0];
|
|
1179
|
+
/* c8 ignore start */
|
|
1180
|
+
const ret = og.call(this.#process, ev, ...args);
|
|
1181
|
+
/* c8 ignore start */
|
|
1182
|
+
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
1183
|
+
/* c8 ignore stop */
|
|
1184
|
+
return ret;
|
|
1185
|
+
} else return og.call(this.#process, ev, ...args);
|
|
1186
|
+
}
|
|
1187
|
+
};
|
|
1188
|
+
const process$2 = globalThis.process;
|
|
1189
|
+
const { onExit, load, unload } = signalExitWrap(processOk(process$2) ? new SignalExit(process$2) : new SignalExitFallback());
|
|
1190
|
+
//#endregion
|
|
1191
|
+
//#region ../../node_modules/.pnpm/@inquirer+ansi@2.0.7/node_modules/@inquirer/ansi/dist/index.js
|
|
1192
|
+
const ESC = "\x1B[";
|
|
1193
|
+
/** Hide the cursor */
|
|
1194
|
+
const cursorHide = "\x1B[?25l";
|
|
1195
|
+
/** Show the cursor */
|
|
1196
|
+
const cursorShow = "\x1B[?25h";
|
|
1197
|
+
/** Move cursor up by count rows */
|
|
1198
|
+
const cursorUp = (rows = 1) => rows > 0 ? `${ESC}${rows}A` : "";
|
|
1199
|
+
/** Move cursor down by count rows */
|
|
1200
|
+
const cursorDown = (rows = 1) => rows > 0 ? `${ESC}${rows}B` : "";
|
|
1201
|
+
/** Move cursor to position (x, y) */
|
|
1202
|
+
const cursorTo = (x, y) => {
|
|
1203
|
+
if (typeof y === "number" && !Number.isNaN(y)) return `${ESC}${y + 1};${x + 1}H`;
|
|
1204
|
+
return `${ESC}${x + 1}G`;
|
|
1205
|
+
};
|
|
1206
|
+
const eraseLine = "\x1B[2K";
|
|
1207
|
+
/** Erase the specified number of lines above the cursor */
|
|
1208
|
+
const eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + "\x1B[2K\x1B[G" : "";
|
|
1209
|
+
//#endregion
|
|
1210
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.2.0/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
1211
|
+
const height = (content) => content.split("\n").length;
|
|
1212
|
+
const lastLine = (content) => content.split("\n").pop() ?? "";
|
|
1213
|
+
var ScreenManager = class {
|
|
1214
|
+
height = 0;
|
|
1215
|
+
extraLinesUnderPrompt = 0;
|
|
1216
|
+
cursorPos;
|
|
1217
|
+
rl;
|
|
1218
|
+
constructor(rl) {
|
|
1219
|
+
this.rl = rl;
|
|
1220
|
+
this.cursorPos = rl.getCursorPos();
|
|
1221
|
+
}
|
|
1222
|
+
write(content) {
|
|
1223
|
+
this.rl.output.unmute();
|
|
1224
|
+
this.rl.output.write(content);
|
|
1225
|
+
this.rl.output.mute();
|
|
1226
|
+
}
|
|
1227
|
+
render(content, bottomContent = "") {
|
|
1228
|
+
const promptLine = lastLine(content);
|
|
1229
|
+
const rawPromptLine = stripVTControlCharacters(promptLine);
|
|
1230
|
+
let prompt = rawPromptLine;
|
|
1231
|
+
if (this.rl.line.length > 0) prompt = prompt.slice(0, -this.rl.line.length);
|
|
1232
|
+
this.rl.setPrompt(prompt);
|
|
1233
|
+
this.cursorPos = this.rl.getCursorPos();
|
|
1234
|
+
const width = readlineWidth();
|
|
1235
|
+
content = breakLines(content, width);
|
|
1236
|
+
bottomContent = breakLines(bottomContent, width);
|
|
1237
|
+
if (rawPromptLine.length % width === 0) content += "\n";
|
|
1238
|
+
let output = content + (bottomContent ? "\n" + bottomContent : "");
|
|
1239
|
+
const bottomContentHeight = Math.floor(rawPromptLine.length / width) - this.cursorPos.rows + (bottomContent ? height(bottomContent) : 0);
|
|
1240
|
+
if (bottomContentHeight > 0) output += cursorUp(bottomContentHeight);
|
|
1241
|
+
output += cursorTo(this.cursorPos.cols);
|
|
1242
|
+
/**
|
|
1243
|
+
* Render and store state for future re-rendering
|
|
1244
|
+
*/
|
|
1245
|
+
this.write(cursorDown(this.extraLinesUnderPrompt) + eraseLines(this.height) + output);
|
|
1246
|
+
this.extraLinesUnderPrompt = bottomContentHeight;
|
|
1247
|
+
this.height = height(output);
|
|
1248
|
+
}
|
|
1249
|
+
checkCursorPos() {
|
|
1250
|
+
const cursorPos = this.rl.getCursorPos();
|
|
1251
|
+
if (cursorPos.cols !== this.cursorPos.cols) {
|
|
1252
|
+
this.write(cursorTo(cursorPos.cols));
|
|
1253
|
+
this.cursorPos = cursorPos;
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
done({ clearContent }) {
|
|
1257
|
+
this.rl.setPrompt("");
|
|
1258
|
+
let output = cursorDown(this.extraLinesUnderPrompt);
|
|
1259
|
+
output += clearContent ? eraseLines(this.height) : "\n";
|
|
1260
|
+
output += "\x1B[G";
|
|
1261
|
+
output += cursorShow;
|
|
1262
|
+
this.write(output);
|
|
1263
|
+
this.rl.close();
|
|
1264
|
+
}
|
|
1265
|
+
};
|
|
1266
|
+
//#endregion
|
|
1267
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.2.0/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
|
|
1268
|
+
var PromisePolyfill = class extends Promise {
|
|
1269
|
+
static withResolver() {
|
|
1270
|
+
let resolve;
|
|
1271
|
+
let reject;
|
|
1272
|
+
return {
|
|
1273
|
+
promise: new Promise((res, rej) => {
|
|
1274
|
+
resolve = res;
|
|
1275
|
+
reject = rej;
|
|
1276
|
+
}),
|
|
1277
|
+
resolve,
|
|
1278
|
+
reject
|
|
1279
|
+
};
|
|
1280
|
+
}
|
|
1281
|
+
};
|
|
1282
|
+
//#endregion
|
|
1283
|
+
//#region ../../node_modules/.pnpm/@inquirer+core@11.2.1_@types+node@26.2.0/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
1284
|
+
const nativeSetImmediate = globalThis.setImmediate;
|
|
1285
|
+
function getCallSites() {
|
|
1286
|
+
const savedPrepareStackTrace = Error.prepareStackTrace;
|
|
1287
|
+
let result = [];
|
|
1288
|
+
try {
|
|
1289
|
+
Error.prepareStackTrace = (_, callSites) => {
|
|
1290
|
+
const callSitesWithoutCurrent = callSites.slice(1);
|
|
1291
|
+
result = callSitesWithoutCurrent;
|
|
1292
|
+
return callSitesWithoutCurrent;
|
|
1293
|
+
};
|
|
1294
|
+
(/* @__PURE__ */ new Error()).stack;
|
|
1295
|
+
} catch {
|
|
1296
|
+
return result;
|
|
1297
|
+
}
|
|
1298
|
+
Error.prepareStackTrace = savedPrepareStackTrace;
|
|
1299
|
+
return result;
|
|
1300
|
+
}
|
|
1301
|
+
function createPrompt(view) {
|
|
1302
|
+
const callSites = getCallSites();
|
|
1303
|
+
const prompt = (config, context = {}) => {
|
|
1304
|
+
const { input = process.stdin, signal } = context;
|
|
1305
|
+
const cleanups = /* @__PURE__ */ new Set();
|
|
1306
|
+
const output = new import_lib.default();
|
|
1307
|
+
output.pipe(context.output ?? process.stdout);
|
|
1308
|
+
const rl = readline.createInterface({
|
|
1309
|
+
terminal: true,
|
|
1310
|
+
input,
|
|
1311
|
+
output
|
|
1312
|
+
});
|
|
1313
|
+
output.mute();
|
|
1314
|
+
const screen = new ScreenManager(rl);
|
|
1315
|
+
const { promise, resolve, reject } = PromisePolyfill.withResolver();
|
|
1316
|
+
const cancel = () => reject(new CancelPromptError());
|
|
1317
|
+
if (signal) {
|
|
1318
|
+
const abort = () => reject(new AbortPromptError({ cause: signal.reason }));
|
|
1319
|
+
if (signal.aborted) {
|
|
1320
|
+
abort();
|
|
1321
|
+
return Object.assign(promise, { cancel });
|
|
1322
|
+
}
|
|
1323
|
+
signal.addEventListener("abort", abort);
|
|
1324
|
+
cleanups.add(() => signal.removeEventListener("abort", abort));
|
|
1325
|
+
}
|
|
1326
|
+
cleanups.add(onExit((code, signal) => {
|
|
1327
|
+
reject(new ExitPromptError(`User force closed the prompt with ${code} ${signal}`));
|
|
1328
|
+
}));
|
|
1329
|
+
const sigint = () => reject(new ExitPromptError(`User force closed the prompt with SIGINT`));
|
|
1330
|
+
rl.on("SIGINT", sigint);
|
|
1331
|
+
cleanups.add(() => rl.removeListener("SIGINT", sigint));
|
|
1332
|
+
return withHooks(rl, (cycle) => {
|
|
1333
|
+
const hooksCleanup = AsyncResource.bind(() => effectScheduler.clearAll());
|
|
1334
|
+
rl.on("close", hooksCleanup);
|
|
1335
|
+
cleanups.add(() => rl.removeListener("close", hooksCleanup));
|
|
1336
|
+
const startCycle = () => {
|
|
1337
|
+
const checkCursorPos = () => screen.checkCursorPos();
|
|
1338
|
+
rl.input.on("keypress", checkCursorPos);
|
|
1339
|
+
cleanups.add(() => rl.input.removeListener("keypress", checkCursorPos));
|
|
1340
|
+
let pendingDone = null;
|
|
1341
|
+
cycle(() => {
|
|
1342
|
+
let effectsSettled = false;
|
|
1343
|
+
try {
|
|
1344
|
+
const nextView = view(config, (value) => {
|
|
1345
|
+
if (effectsSettled) resolve(value);
|
|
1346
|
+
else pendingDone = { value };
|
|
1347
|
+
});
|
|
1348
|
+
if (nextView === void 0) {
|
|
1349
|
+
let callerFilename = callSites[1]?.getFileName();
|
|
1350
|
+
if (callerFilename && !callerFilename.startsWith("file://")) callerFilename = path.resolve(callerFilename);
|
|
1351
|
+
throw new Error(`Prompt functions must return a string.\n at ${callerFilename}`);
|
|
1352
|
+
}
|
|
1353
|
+
const [content, bottomContent] = typeof nextView === "string" ? [nextView] : nextView;
|
|
1354
|
+
screen.render(content, bottomContent);
|
|
1355
|
+
effectScheduler.run();
|
|
1356
|
+
} catch (error) {
|
|
1357
|
+
reject(error);
|
|
1358
|
+
}
|
|
1359
|
+
effectsSettled = true;
|
|
1360
|
+
if (pendingDone !== null) {
|
|
1361
|
+
const { value } = pendingDone;
|
|
1362
|
+
pendingDone = null;
|
|
1363
|
+
resolve(value);
|
|
1364
|
+
}
|
|
1365
|
+
});
|
|
1366
|
+
};
|
|
1367
|
+
if ("readableFlowing" in input) nativeSetImmediate(startCycle);
|
|
1368
|
+
else startCycle();
|
|
1369
|
+
return Object.assign(promise.then((answer) => {
|
|
1370
|
+
effectScheduler.clearAll();
|
|
1371
|
+
return answer;
|
|
1372
|
+
}, (error) => {
|
|
1373
|
+
effectScheduler.clearAll();
|
|
1374
|
+
throw error;
|
|
1375
|
+
}).finally(() => {
|
|
1376
|
+
cleanups.forEach((cleanup) => cleanup());
|
|
1377
|
+
screen.done({ clearContent: Boolean(context.clearPromptOnDone) });
|
|
1378
|
+
output.end();
|
|
1379
|
+
}).then(() => promise), { cancel });
|
|
1380
|
+
});
|
|
1381
|
+
};
|
|
1382
|
+
return prompt;
|
|
1383
|
+
}
|
|
1384
|
+
//#endregion
|
|
1385
|
+
export { isEnterKey as _, readlineWidth as a, isTabKey as b, usePrefix as c, useEffect as d, useState as f, isDownKey as g, isBackspaceKey as h, breakLines as i, makeTheme as l, ValidationError as m, cursorHide as n, useKeypress as o, withPointer as p, onExit as r, useRef as s, createPrompt as t, figures as u, isNumberKey as v, isUpKey as x, isSpaceKey as y };
|
|
1386
|
+
|
|
1387
|
+
//# sourceMappingURL=create-prompt-COXnAzFl.js.map
|