@socketsecurity/lib 3.2.5 → 3.2.7
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/CHANGELOG.md +25 -0
- package/dist/constants/node.js +1 -1
- package/dist/constants/packages.js +4 -4
- package/dist/external/@inquirer/confirm.js +3199 -18
- package/dist/external/@inquirer/input.js +3223 -18
- package/dist/external/@inquirer/password.js +3331 -18
- package/dist/external/@inquirer/search.js +3328 -21
- package/dist/external/@inquirer/select.js +3445 -21
- package/dist/external/@npmcli/package-json/lib/read-package.js +149 -2
- package/dist/external/@npmcli/package-json/lib/sort.js +96 -1
- package/dist/external/@npmcli/package-json.js +16758 -13
- package/dist/external/@npmcli/promise-spawn.js +480 -1
- package/dist/external/@socketregistry/is-unicode-supported.js +42 -1
- package/dist/external/@socketregistry/packageurl-js.js +6493 -2
- package/dist/external/@socketregistry/yocto-spinner.js +460 -4
- package/dist/external/@yarnpkg/extensions.js +1025 -1
- package/dist/external/cacache.js +13016 -12
- package/dist/external/debug.js +27 -1
- package/dist/external/del.js +7088 -2
- package/dist/external/fast-glob.js +5721 -2
- package/dist/external/fast-sort.js +140 -1
- package/dist/external/get-east-asian-width.js +90 -1
- package/dist/external/libnpmexec.js +33 -1
- package/dist/external/libnpmpack.js +67595 -129
- package/dist/external/make-fetch-happen.js +22595 -21
- package/dist/external/normalize-package-data.js +4474 -2
- package/dist/external/npm-package-arg.js +4511 -2
- package/dist/external/pacote.js +50270 -57
- package/dist/external/picomatch.js +1520 -1
- package/dist/external/semver.js +1930 -1
- package/dist/external/spdx-correct.js +1380 -1
- package/dist/external/spdx-expression-parse.js +1043 -1
- package/dist/external/streaming-iterables.js +1056 -1
- package/dist/external/validate-npm-package-name.js +100 -1
- package/dist/external/which.js +258 -1
- package/dist/external/yargs-parser.js +1075 -1
- package/dist/external/yoctocolors-cjs.js +88 -1
- package/dist/external/zod.js +15207 -13
- package/dist/lifecycle-script-names.js +3 -4
- package/dist/logger.js +2 -1
- package/dist/maintained-node-versions.js +3 -4
- package/dist/package-default-node-range.js +4 -5
- package/dist/package-default-socket-categories.js +3 -4
- package/dist/package-extensions.js +3 -4
- package/dist/stdio/prompts.js +2 -1
- package/dist/utils/get-ipc.js +3 -5
- package/package.json +1 -1
|
@@ -3,7 +3,463 @@
|
|
|
3
3
|
* Bundled from @socketregistry/yocto-spinner
|
|
4
4
|
* This is a zero-dependency bundle created by esbuild.
|
|
5
5
|
*/
|
|
6
|
-
"use strict";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
"use strict";
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
9
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
10
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
11
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// node_modules/.pnpm/yoctocolors-cjs@2.1.3/node_modules/yoctocolors-cjs/index.js
|
|
15
|
+
var require_yoctocolors_cjs = __commonJS({
|
|
16
|
+
"node_modules/.pnpm/yoctocolors-cjs@2.1.3/node_modules/yoctocolors-cjs/index.js"(exports2, module2) {
|
|
17
|
+
var tty = require("node:tty");
|
|
18
|
+
var hasColors = tty?.WriteStream?.prototype?.hasColors?.() ?? false;
|
|
19
|
+
var format = /* @__PURE__ */ __name((open, close) => {
|
|
20
|
+
if (!hasColors) {
|
|
21
|
+
return (input) => input;
|
|
22
|
+
}
|
|
23
|
+
const openCode = `\x1B[${open}m`;
|
|
24
|
+
const closeCode = `\x1B[${close}m`;
|
|
25
|
+
return (input) => {
|
|
26
|
+
const string = input + "";
|
|
27
|
+
let index = string.indexOf(closeCode);
|
|
28
|
+
if (index === -1) {
|
|
29
|
+
return openCode + string + closeCode;
|
|
30
|
+
}
|
|
31
|
+
let result = openCode;
|
|
32
|
+
let lastIndex = 0;
|
|
33
|
+
const reopenOnNestedClose = close === 22;
|
|
34
|
+
const replaceCode = (reopenOnNestedClose ? closeCode : "") + openCode;
|
|
35
|
+
while (index !== -1) {
|
|
36
|
+
result += string.slice(lastIndex, index) + replaceCode;
|
|
37
|
+
lastIndex = index + closeCode.length;
|
|
38
|
+
index = string.indexOf(closeCode, lastIndex);
|
|
39
|
+
}
|
|
40
|
+
result += string.slice(lastIndex) + closeCode;
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
}, "format");
|
|
44
|
+
var colors = {};
|
|
45
|
+
colors.reset = format(0, 0);
|
|
46
|
+
colors.bold = format(1, 22);
|
|
47
|
+
colors.dim = format(2, 22);
|
|
48
|
+
colors.italic = format(3, 23);
|
|
49
|
+
colors.underline = format(4, 24);
|
|
50
|
+
colors.overline = format(53, 55);
|
|
51
|
+
colors.inverse = format(7, 27);
|
|
52
|
+
colors.hidden = format(8, 28);
|
|
53
|
+
colors.strikethrough = format(9, 29);
|
|
54
|
+
colors.black = format(30, 39);
|
|
55
|
+
colors.red = format(31, 39);
|
|
56
|
+
colors.green = format(32, 39);
|
|
57
|
+
colors.yellow = format(33, 39);
|
|
58
|
+
colors.blue = format(34, 39);
|
|
59
|
+
colors.magenta = format(35, 39);
|
|
60
|
+
colors.cyan = format(36, 39);
|
|
61
|
+
colors.white = format(37, 39);
|
|
62
|
+
colors.gray = format(90, 39);
|
|
63
|
+
colors.bgBlack = format(40, 49);
|
|
64
|
+
colors.bgRed = format(41, 49);
|
|
65
|
+
colors.bgGreen = format(42, 49);
|
|
66
|
+
colors.bgYellow = format(43, 49);
|
|
67
|
+
colors.bgBlue = format(44, 49);
|
|
68
|
+
colors.bgMagenta = format(45, 49);
|
|
69
|
+
colors.bgCyan = format(46, 49);
|
|
70
|
+
colors.bgWhite = format(47, 49);
|
|
71
|
+
colors.bgGray = format(100, 49);
|
|
72
|
+
colors.redBright = format(91, 39);
|
|
73
|
+
colors.greenBright = format(92, 39);
|
|
74
|
+
colors.yellowBright = format(93, 39);
|
|
75
|
+
colors.blueBright = format(94, 39);
|
|
76
|
+
colors.magentaBright = format(95, 39);
|
|
77
|
+
colors.cyanBright = format(96, 39);
|
|
78
|
+
colors.whiteBright = format(97, 39);
|
|
79
|
+
colors.bgRedBright = format(101, 49);
|
|
80
|
+
colors.bgGreenBright = format(102, 49);
|
|
81
|
+
colors.bgYellowBright = format(103, 49);
|
|
82
|
+
colors.bgBlueBright = format(104, 49);
|
|
83
|
+
colors.bgMagentaBright = format(105, 49);
|
|
84
|
+
colors.bgCyanBright = format(106, 49);
|
|
85
|
+
colors.bgWhiteBright = format(107, 49);
|
|
86
|
+
module2.exports = colors;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// node_modules/.pnpm/@socketregistry+yocto-spinner@1.0.25/node_modules/@socketregistry/yocto-spinner/index.cjs
|
|
91
|
+
var require_yocto_spinner = __commonJS({
|
|
92
|
+
"node_modules/.pnpm/@socketregistry+yocto-spinner@1.0.25/node_modules/@socketregistry/yocto-spinner/index.cjs"(exports2, module2) {
|
|
93
|
+
"use strict";
|
|
94
|
+
var { isArray: ArrayIsArray } = Array;
|
|
95
|
+
var { defineProperty: ObjectDefineProperty } = Object;
|
|
96
|
+
var defaultTtyColumns = 80;
|
|
97
|
+
var _defaultSpinner;
|
|
98
|
+
function getDefaultSpinner() {
|
|
99
|
+
if (_defaultSpinner === void 0) {
|
|
100
|
+
_defaultSpinner = {
|
|
101
|
+
frames: isUnicodeSupported() ? ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"] : ["-", "\\", "|", "/"],
|
|
102
|
+
interval: 80
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
return _defaultSpinner;
|
|
106
|
+
}
|
|
107
|
+
__name(getDefaultSpinner, "getDefaultSpinner");
|
|
108
|
+
var _logSymbols;
|
|
109
|
+
function getLogSymbols() {
|
|
110
|
+
if (_logSymbols === void 0) {
|
|
111
|
+
const supported = isUnicodeSupported();
|
|
112
|
+
const colors = getYoctocolors();
|
|
113
|
+
_logSymbols = {
|
|
114
|
+
error: colors.red(supported ? "✖" : "×"),
|
|
115
|
+
info: colors.blue(supported ? "ℹ" : "i"),
|
|
116
|
+
success: colors.green(supported ? "✔" : "√"),
|
|
117
|
+
warning: colors.yellow(supported ? "⚠" : "‼")
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
return _logSymbols;
|
|
121
|
+
}
|
|
122
|
+
__name(getLogSymbols, "getLogSymbols");
|
|
123
|
+
var _process;
|
|
124
|
+
function getProcess() {
|
|
125
|
+
if (_process === void 0) {
|
|
126
|
+
_process = require("node:process");
|
|
127
|
+
}
|
|
128
|
+
return _process;
|
|
129
|
+
}
|
|
130
|
+
__name(getProcess, "getProcess");
|
|
131
|
+
var _yoctocolors;
|
|
132
|
+
function getYoctocolors() {
|
|
133
|
+
if (_yoctocolors === void 0) {
|
|
134
|
+
_yoctocolors = { ...require_yoctocolors_cjs() };
|
|
135
|
+
}
|
|
136
|
+
return _yoctocolors;
|
|
137
|
+
}
|
|
138
|
+
__name(getYoctocolors, "getYoctocolors");
|
|
139
|
+
var _processInteractive;
|
|
140
|
+
function isProcessInteractive() {
|
|
141
|
+
if (_processInteractive === void 0) {
|
|
142
|
+
const { env } = getProcess();
|
|
143
|
+
_processInteractive = env.TERM !== "dumb" && !("CI" in env);
|
|
144
|
+
}
|
|
145
|
+
return _processInteractive;
|
|
146
|
+
}
|
|
147
|
+
__name(isProcessInteractive, "isProcessInteractive");
|
|
148
|
+
var _unicodeSupported;
|
|
149
|
+
function isUnicodeSupported() {
|
|
150
|
+
if (_unicodeSupported === void 0) {
|
|
151
|
+
const process2 = getProcess();
|
|
152
|
+
if (process2.platform !== "win32") {
|
|
153
|
+
_unicodeSupported = process2.env.TERM !== "linux";
|
|
154
|
+
return _unicodeSupported;
|
|
155
|
+
}
|
|
156
|
+
const { env } = process2;
|
|
157
|
+
if (
|
|
158
|
+
// Windows Terminal.
|
|
159
|
+
env.WT_SESSION || // Terminus (<0.2.27).
|
|
160
|
+
env.TERMINUS_SUBLIME || // ConEmu and cmder.
|
|
161
|
+
env.ConEmuTask === "{cmd::Cmder}"
|
|
162
|
+
) {
|
|
163
|
+
_unicodeSupported = true;
|
|
164
|
+
return _unicodeSupported;
|
|
165
|
+
}
|
|
166
|
+
const { TERM, TERM_PROGRAM } = env;
|
|
167
|
+
_unicodeSupported = TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
168
|
+
}
|
|
169
|
+
return _unicodeSupported;
|
|
170
|
+
}
|
|
171
|
+
__name(isUnicodeSupported, "isUnicodeSupported");
|
|
172
|
+
var _stripVTControlCharacters;
|
|
173
|
+
function stripVTControlCharacters(string) {
|
|
174
|
+
if (_stripVTControlCharacters === void 0) {
|
|
175
|
+
const nodeUtil = require("node:util");
|
|
176
|
+
_stripVTControlCharacters = nodeUtil.stripVTControlCharacters;
|
|
177
|
+
}
|
|
178
|
+
return _stripVTControlCharacters(string);
|
|
179
|
+
}
|
|
180
|
+
__name(stripVTControlCharacters, "stripVTControlCharacters");
|
|
181
|
+
function getFrame(spinner, index) {
|
|
182
|
+
const { frames } = spinner;
|
|
183
|
+
const length = frames?.length ?? 0;
|
|
184
|
+
return index > -1 && index < length ? frames[index] : "";
|
|
185
|
+
}
|
|
186
|
+
__name(getFrame, "getFrame");
|
|
187
|
+
function getFrameCount(spinner) {
|
|
188
|
+
const { frames } = spinner;
|
|
189
|
+
const length = frames?.length ?? 0;
|
|
190
|
+
return length < 1 ? 1 : length;
|
|
191
|
+
}
|
|
192
|
+
__name(getFrameCount, "getFrameCount");
|
|
193
|
+
function normalizeText(value) {
|
|
194
|
+
return typeof value === "string" ? value.trimStart() : "";
|
|
195
|
+
}
|
|
196
|
+
__name(normalizeText, "normalizeText");
|
|
197
|
+
var YoctoSpinner2 = class _YoctoSpinner {
|
|
198
|
+
static {
|
|
199
|
+
__name(this, "YoctoSpinner");
|
|
200
|
+
}
|
|
201
|
+
#color;
|
|
202
|
+
#currentFrame = -1;
|
|
203
|
+
#exitHandlerBound;
|
|
204
|
+
#indention = "";
|
|
205
|
+
#isInteractive;
|
|
206
|
+
#isSpinning = false;
|
|
207
|
+
#lastSpinnerFrameTime = 0;
|
|
208
|
+
#lines = 0;
|
|
209
|
+
#onFrameUpdate;
|
|
210
|
+
#onRenderFrame;
|
|
211
|
+
#skipRender = false;
|
|
212
|
+
#spinner;
|
|
213
|
+
#stream;
|
|
214
|
+
#text;
|
|
215
|
+
#timer;
|
|
216
|
+
static spinners = {
|
|
217
|
+
get default() {
|
|
218
|
+
return getDefaultSpinner();
|
|
219
|
+
},
|
|
220
|
+
set default(spinner) {
|
|
221
|
+
ObjectDefineProperty(this, "default", {
|
|
222
|
+
__proto__: null,
|
|
223
|
+
configurable: true,
|
|
224
|
+
enumerable: true,
|
|
225
|
+
value: spinner,
|
|
226
|
+
writable: true
|
|
227
|
+
});
|
|
228
|
+
},
|
|
229
|
+
ci: {
|
|
230
|
+
frames: [""],
|
|
231
|
+
// The delay argument is converted to a signed 32-bit integer. This effectively
|
|
232
|
+
// limits delay to 2147483647 ms, roughly 24.8 days, since it's specified as a
|
|
233
|
+
// signed integer in the IDL.
|
|
234
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Window/setInterval?utm_source=chatgpt.com#return_value
|
|
235
|
+
interval: 2147483647
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
constructor(options = {}) {
|
|
239
|
+
const opts = { __proto__: null, ...options };
|
|
240
|
+
const stream = opts.stream ?? getProcess().stderr;
|
|
241
|
+
this.#spinner = opts.spinner ?? _YoctoSpinner.spinners.default ?? getDefaultSpinner();
|
|
242
|
+
this.#text = normalizeText(options.text);
|
|
243
|
+
this.#stream = stream ?? process.stderr;
|
|
244
|
+
const color = options.color ?? "cyan";
|
|
245
|
+
if (ArrayIsArray(color) && (color.length !== 3 || !color.every((n) => typeof n === "number" && n >= 0 && n <= 255))) {
|
|
246
|
+
throw new TypeError(
|
|
247
|
+
"RGB color must be an array of 3 numbers between 0 and 255"
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
this.#color = color;
|
|
251
|
+
this.#isInteractive = !!stream.isTTY && isProcessInteractive();
|
|
252
|
+
this.#exitHandlerBound = this.#exitHandler.bind(this);
|
|
253
|
+
this.#onFrameUpdate = options.onFrameUpdate;
|
|
254
|
+
this.#onRenderFrame = options.onRenderFrame;
|
|
255
|
+
}
|
|
256
|
+
#exitHandler(signal) {
|
|
257
|
+
if (this.isSpinning) {
|
|
258
|
+
this.stop();
|
|
259
|
+
}
|
|
260
|
+
const exitCode = signal === "SIGINT" ? 130 : signal === "SIGTERM" ? 143 : 1;
|
|
261
|
+
process.exit(exitCode);
|
|
262
|
+
}
|
|
263
|
+
#hideCursor() {
|
|
264
|
+
if (this.#isInteractive) {
|
|
265
|
+
this.#write("\x1B[?25l");
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
#lineCount(text) {
|
|
269
|
+
const width = this.#stream.columns ?? defaultTtyColumns;
|
|
270
|
+
const lines = stripVTControlCharacters(text).split("\n");
|
|
271
|
+
let lineCount = 0;
|
|
272
|
+
for (const line of lines) {
|
|
273
|
+
lineCount += Math.max(1, Math.ceil(line.length / width));
|
|
274
|
+
}
|
|
275
|
+
return lineCount;
|
|
276
|
+
}
|
|
277
|
+
#render() {
|
|
278
|
+
if (!this.#isSpinning) {
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
const now = Date.now();
|
|
282
|
+
let frameAdvanced = false;
|
|
283
|
+
if (this.#currentFrame === -1 || now - this.#lastSpinnerFrameTime >= this.#spinner.interval) {
|
|
284
|
+
frameAdvanced = true;
|
|
285
|
+
this.#currentFrame = ++this.#currentFrame % getFrameCount(this.#spinner);
|
|
286
|
+
this.#lastSpinnerFrameTime = now;
|
|
287
|
+
}
|
|
288
|
+
if (frameAdvanced && typeof this.#onFrameUpdate === "function") {
|
|
289
|
+
this.#skipRender = true;
|
|
290
|
+
try {
|
|
291
|
+
this.#onFrameUpdate();
|
|
292
|
+
} finally {
|
|
293
|
+
this.#skipRender = false;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
const colors = getYoctocolors();
|
|
297
|
+
const applyColor = ArrayIsArray(this.#color) ? (text) => `\x1B[38;2;${this.#color[0]};${this.#color[1]};${this.#color[2]}m${text}\x1B[39m` : colors[this.#color] ?? colors.cyan;
|
|
298
|
+
const frame = getFrame(this.#spinner, this.#currentFrame);
|
|
299
|
+
let string;
|
|
300
|
+
if (typeof this.#onRenderFrame === "function") {
|
|
301
|
+
string = this.#onRenderFrame(frame, this.#text, applyColor);
|
|
302
|
+
} else {
|
|
303
|
+
string = `${frame ? `${applyColor(frame)} ` : ""}${this.#text}`;
|
|
304
|
+
}
|
|
305
|
+
if (string) {
|
|
306
|
+
if (this.#indention.length) {
|
|
307
|
+
string = `${this.#indention}${string}`;
|
|
308
|
+
}
|
|
309
|
+
if (!this.#isInteractive) {
|
|
310
|
+
string += "\n";
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
if (this.#isInteractive) {
|
|
314
|
+
this.clear();
|
|
315
|
+
}
|
|
316
|
+
if (string) {
|
|
317
|
+
this.#write(string);
|
|
318
|
+
}
|
|
319
|
+
if (this.#isInteractive) {
|
|
320
|
+
this.#lines = this.#lineCount(string);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
#showCursor() {
|
|
324
|
+
if (this.#isInteractive) {
|
|
325
|
+
this.#write("\x1B[?25h");
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
#subscribeToProcessEvents() {
|
|
329
|
+
process.once("SIGINT", this.#exitHandlerBound);
|
|
330
|
+
process.once("SIGTERM", this.#exitHandlerBound);
|
|
331
|
+
}
|
|
332
|
+
#symbolStop(symbolType, text) {
|
|
333
|
+
const symbols = getLogSymbols();
|
|
334
|
+
return this.stop(`${symbols[symbolType]} ${text ?? this.#text}`);
|
|
335
|
+
}
|
|
336
|
+
#write(text) {
|
|
337
|
+
this.#stream.write(text);
|
|
338
|
+
}
|
|
339
|
+
#unsubscribeFromProcessEvents() {
|
|
340
|
+
process.off("SIGINT", this.#exitHandlerBound);
|
|
341
|
+
process.off("SIGTERM", this.#exitHandlerBound);
|
|
342
|
+
}
|
|
343
|
+
get color() {
|
|
344
|
+
return this.#color;
|
|
345
|
+
}
|
|
346
|
+
set color(value) {
|
|
347
|
+
this.#color = value;
|
|
348
|
+
this.#render();
|
|
349
|
+
}
|
|
350
|
+
get isSpinning() {
|
|
351
|
+
return this.#isSpinning;
|
|
352
|
+
}
|
|
353
|
+
get spinner() {
|
|
354
|
+
return this.#spinner;
|
|
355
|
+
}
|
|
356
|
+
set spinner(spinner) {
|
|
357
|
+
this.#spinner = spinner;
|
|
358
|
+
}
|
|
359
|
+
get text() {
|
|
360
|
+
if (this._textMethod) {
|
|
361
|
+
return this._textMethod;
|
|
362
|
+
}
|
|
363
|
+
return this.#text;
|
|
364
|
+
}
|
|
365
|
+
set text(value) {
|
|
366
|
+
if (this._textMethod && !this._inTextSetter) {
|
|
367
|
+
this._inTextSetter = true;
|
|
368
|
+
try {
|
|
369
|
+
this._textMethod(value);
|
|
370
|
+
} finally {
|
|
371
|
+
this._inTextSetter = false;
|
|
372
|
+
}
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
this.#text = normalizeText(value);
|
|
376
|
+
if (!this.#skipRender) {
|
|
377
|
+
this.#render();
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
clear() {
|
|
381
|
+
if (!this.#isInteractive) {
|
|
382
|
+
return this;
|
|
383
|
+
}
|
|
384
|
+
this.#stream.cursorTo(0);
|
|
385
|
+
for (let index = 0; index < this.#lines; index += 1) {
|
|
386
|
+
if (index > 0) {
|
|
387
|
+
this.#stream.moveCursor(0, -1);
|
|
388
|
+
}
|
|
389
|
+
this.#stream.clearLine(1);
|
|
390
|
+
}
|
|
391
|
+
this.#lines = 0;
|
|
392
|
+
return this;
|
|
393
|
+
}
|
|
394
|
+
dedent(spaces = 2) {
|
|
395
|
+
this.#indention = this.#indention.slice(0, -spaces);
|
|
396
|
+
return this;
|
|
397
|
+
}
|
|
398
|
+
error(text) {
|
|
399
|
+
return this.#symbolStop("error", text);
|
|
400
|
+
}
|
|
401
|
+
indent(spaces = 2) {
|
|
402
|
+
this.#indention += " ".repeat(spaces);
|
|
403
|
+
return this;
|
|
404
|
+
}
|
|
405
|
+
info(text) {
|
|
406
|
+
return this.#symbolStop("info", text);
|
|
407
|
+
}
|
|
408
|
+
resetIndent() {
|
|
409
|
+
this.#indention = "";
|
|
410
|
+
return this;
|
|
411
|
+
}
|
|
412
|
+
start(text) {
|
|
413
|
+
const normalized = normalizeText(text);
|
|
414
|
+
if (normalized) {
|
|
415
|
+
this.#text = normalized;
|
|
416
|
+
}
|
|
417
|
+
if (this.isSpinning) {
|
|
418
|
+
return this;
|
|
419
|
+
}
|
|
420
|
+
this.#isSpinning = true;
|
|
421
|
+
this.#hideCursor();
|
|
422
|
+
this.#render();
|
|
423
|
+
this.#subscribeToProcessEvents();
|
|
424
|
+
if (this.#isInteractive) {
|
|
425
|
+
this.#timer = setInterval(() => {
|
|
426
|
+
this.#render();
|
|
427
|
+
}, this.#spinner.interval);
|
|
428
|
+
}
|
|
429
|
+
return this;
|
|
430
|
+
}
|
|
431
|
+
stop(finalText) {
|
|
432
|
+
if (!this.isSpinning) {
|
|
433
|
+
return this;
|
|
434
|
+
}
|
|
435
|
+
if (this.#timer) {
|
|
436
|
+
clearInterval(this.#timer);
|
|
437
|
+
this.#timer = void 0;
|
|
438
|
+
}
|
|
439
|
+
this.#isSpinning = false;
|
|
440
|
+
this.#showCursor();
|
|
441
|
+
this.clear();
|
|
442
|
+
this.#unsubscribeFromProcessEvents();
|
|
443
|
+
if (finalText) {
|
|
444
|
+
this.#write(`${this.#indention}${finalText}
|
|
445
|
+
`);
|
|
446
|
+
}
|
|
447
|
+
return this;
|
|
448
|
+
}
|
|
449
|
+
success(text) {
|
|
450
|
+
return this.#symbolStop("success", text);
|
|
451
|
+
}
|
|
452
|
+
warning(text) {
|
|
453
|
+
return this.#symbolStop("warning", text);
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
module2.exports = /* @__PURE__ */ __name(function yoctoSpinner(options) {
|
|
457
|
+
return new YoctoSpinner2(options);
|
|
458
|
+
}, "yoctoSpinner");
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
// src/external/@socketregistry/yocto-spinner.js
|
|
463
|
+
var YoctoSpinner = require_yocto_spinner();
|
|
464
|
+
module.exports = YoctoSpinner;
|
|
465
|
+
module.module.exports = YoctoSpinner;
|