@socketsecurity/lib 3.2.8 → 3.3.1
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 +22 -0
- package/README.md +19 -240
- package/dist/agent.js +10 -10
- package/dist/bin.js +4 -4
- package/dist/colors.d.ts +37 -0
- package/dist/colors.js +58 -0
- package/dist/constants/node.js +1 -1
- package/dist/constants/packages.js +9 -9
- package/dist/constants/process.js +1 -1
- package/dist/constants/socket.d.ts +1 -0
- package/dist/constants/socket.js +3 -0
- package/dist/debug.js +3 -3
- package/dist/dlx-binary.js +4 -4
- package/dist/effects/text-shimmer.js +1 -1
- package/dist/env/ci.js +2 -2
- package/dist/env/debug.js +1 -1
- package/dist/env/github.js +1 -1
- package/dist/env/home.js +1 -1
- package/dist/env/locale.js +1 -1
- package/dist/env/node-auth-token.js +1 -1
- package/dist/env/node-env.js +1 -1
- package/dist/env/npm.js +1 -1
- package/dist/env/package-manager.js +1 -1
- package/dist/env/path.js +1 -1
- package/dist/env/pre-commit.js +2 -2
- package/dist/env/rewire.d.ts +5 -5
- package/dist/env/rewire.js +22 -14
- package/dist/env/shell.js +1 -1
- package/dist/env/socket-cli-shadow.js +2 -2
- package/dist/env/socket-cli.js +2 -2
- package/dist/env/socket.js +2 -2
- package/dist/env/temp-dir.js +1 -1
- package/dist/env/term.js +1 -1
- package/dist/env/test.js +3 -3
- package/dist/env/windows.js +1 -1
- package/dist/env/xdg.js +1 -1
- package/dist/external/@inquirer/checkbox.js +3361 -3
- package/dist/external/@inquirer/confirm.js +1 -0
- package/dist/external/@inquirer/input.js +1 -0
- package/dist/external/@inquirer/password.js +1 -0
- package/dist/external/@inquirer/search.js +1 -0
- package/dist/external/@inquirer/select.js +1 -0
- package/dist/fs.js +4 -6
- package/dist/git.js +1 -1
- package/dist/github.js +2 -2
- package/dist/globs.js +3 -4
- package/dist/lifecycle-script-names.d.ts +8 -2
- package/dist/lifecycle-script-names.js +9 -4
- package/dist/logger.d.ts +106 -81
- package/dist/logger.js +234 -205
- package/dist/maintained-node-versions.d.ts +2 -2
- package/dist/maintained-node-versions.js +9 -4
- package/dist/objects.js +1 -1
- package/dist/package-default-node-range.d.ts +2 -2
- package/dist/package-default-node-range.js +10 -5
- package/dist/package-default-socket-categories.d.ts +6 -2
- package/dist/package-default-socket-categories.js +9 -4
- package/dist/package-extensions.d.ts +2 -2
- package/dist/package-extensions.js +9 -4
- package/dist/packages/exports.js +1 -1
- package/dist/packages/isolation.js +2 -2
- package/dist/packages/licenses.js +2 -2
- package/dist/packages/manifest.js +3 -3
- package/dist/packages/normalize.js +1 -1
- package/dist/packages/operations.js +5 -5
- package/dist/packages/provenance.js +1 -1
- package/dist/path.d.ts +11 -0
- package/dist/path.js +1 -1
- package/dist/paths.js +14 -14
- package/dist/promises.js +2 -2
- package/dist/spawn.js +1 -1
- package/dist/spinner.d.ts +29 -51
- package/dist/spinner.js +155 -149
- package/dist/stdio/prompts.d.ts +17 -0
- package/dist/stdio/prompts.js +11 -12
- package/dist/temporary-executor.js +1 -1
- package/dist/themes/types.d.ts +2 -1
- package/dist/themes/utils.d.ts +1 -1
- package/dist/utils/get-ipc.d.ts +0 -1
- package/dist/utils/get-ipc.js +4 -4
- package/dist/versions.d.ts +1 -1
- package/package.json +15 -11
- package/dist/external/@inquirer/core.js +0 -4
- package/dist/external/@inquirer/prompts.js +0 -4
package/dist/spinner.js
CHANGED
|
@@ -33,13 +33,13 @@ __export(spinner_exports, {
|
|
|
33
33
|
ciSpinner: () => ciSpinner,
|
|
34
34
|
getCliSpinners: () => getCliSpinners,
|
|
35
35
|
getDefaultSpinner: () => getDefaultSpinner,
|
|
36
|
-
toRgb: () => toRgb,
|
|
37
36
|
withSpinner: () => withSpinner,
|
|
38
37
|
withSpinnerRestore: () => withSpinnerRestore,
|
|
39
38
|
withSpinnerSync: () => withSpinnerSync
|
|
40
39
|
});
|
|
41
40
|
module.exports = __toCommonJS(spinner_exports);
|
|
42
|
-
var
|
|
41
|
+
var import_colors = require("./colors");
|
|
42
|
+
var import_ci = require("#env/ci");
|
|
43
43
|
var import_debug = require("./debug");
|
|
44
44
|
var import_pulse_frames = require("./effects/pulse-frames");
|
|
45
45
|
var import_text_shimmer = require("./effects/text-shimmer");
|
|
@@ -50,34 +50,6 @@ var import_strings = require("./strings");
|
|
|
50
50
|
var import_context = require("./themes/context");
|
|
51
51
|
var import_themes = require("./themes/themes");
|
|
52
52
|
var import_utils = require("./themes/utils");
|
|
53
|
-
const colorToRgb = {
|
|
54
|
-
__proto__: null,
|
|
55
|
-
black: [0, 0, 0],
|
|
56
|
-
blue: [0, 0, 255],
|
|
57
|
-
blueBright: [100, 149, 237],
|
|
58
|
-
cyan: [0, 255, 255],
|
|
59
|
-
cyanBright: [0, 255, 255],
|
|
60
|
-
gray: [128, 128, 128],
|
|
61
|
-
green: [0, 128, 0],
|
|
62
|
-
greenBright: [0, 255, 0],
|
|
63
|
-
magenta: [255, 0, 255],
|
|
64
|
-
magentaBright: [255, 105, 180],
|
|
65
|
-
red: [255, 0, 0],
|
|
66
|
-
redBright: [255, 69, 0],
|
|
67
|
-
white: [255, 255, 255],
|
|
68
|
-
whiteBright: [255, 255, 255],
|
|
69
|
-
yellow: [255, 255, 0],
|
|
70
|
-
yellowBright: [255, 255, 153]
|
|
71
|
-
};
|
|
72
|
-
function isRgbTuple(value) {
|
|
73
|
-
return Array.isArray(value);
|
|
74
|
-
}
|
|
75
|
-
function toRgb(color) {
|
|
76
|
-
if (isRgbTuple(color)) {
|
|
77
|
-
return color;
|
|
78
|
-
}
|
|
79
|
-
return colorToRgb[color];
|
|
80
|
-
}
|
|
81
53
|
const ciSpinner = {
|
|
82
54
|
frames: [""],
|
|
83
55
|
interval: 2147483647
|
|
@@ -163,14 +135,14 @@ function Spinner(options) {
|
|
|
163
135
|
}
|
|
164
136
|
}
|
|
165
137
|
const spinnerColor = opts.color ?? defaultColor;
|
|
166
|
-
if (isRgbTuple(spinnerColor) && (spinnerColor.length !== 3 || !spinnerColor.every(
|
|
138
|
+
if ((0, import_colors.isRgbTuple)(spinnerColor) && (spinnerColor.length !== 3 || !spinnerColor.every(
|
|
167
139
|
(n) => typeof n === "number" && n >= 0 && n <= 255
|
|
168
140
|
))) {
|
|
169
141
|
throw new TypeError(
|
|
170
142
|
"RGB color must be an array of 3 numbers between 0 and 255"
|
|
171
143
|
);
|
|
172
144
|
}
|
|
173
|
-
const spinnerColorRgb = toRgb(spinnerColor);
|
|
145
|
+
const spinnerColorRgb = (0, import_colors.toRgb)(spinnerColor);
|
|
174
146
|
let shimmerInfo;
|
|
175
147
|
if (opts.shimmer) {
|
|
176
148
|
let shimmerDir;
|
|
@@ -197,7 +169,7 @@ function Spinner(options) {
|
|
|
197
169
|
};
|
|
198
170
|
}
|
|
199
171
|
super({
|
|
200
|
-
signal: require("
|
|
172
|
+
signal: require("#constants/process").getAbortSignal(),
|
|
201
173
|
...opts,
|
|
202
174
|
// Pass RGB color directly to yocto-spinner (it now supports RGB).
|
|
203
175
|
color: spinnerColorRgb,
|
|
@@ -222,11 +194,11 @@ function Spinner(options) {
|
|
|
222
194
|
// Override color getter to ensure it's always RGB.
|
|
223
195
|
get color() {
|
|
224
196
|
const value = super.color;
|
|
225
|
-
return isRgbTuple(value) ? value : toRgb(value);
|
|
197
|
+
return (0, import_colors.isRgbTuple)(value) ? value : (0, import_colors.toRgb)(value);
|
|
226
198
|
}
|
|
227
199
|
// Override color setter to always convert to RGB before passing to yocto-spinner.
|
|
228
200
|
set color(value) {
|
|
229
|
-
super.color = isRgbTuple(value) ? value : toRgb(value);
|
|
201
|
+
super.color = (0, import_colors.isRgbTuple)(value) ? value : (0, import_colors.toRgb)(value);
|
|
230
202
|
}
|
|
231
203
|
// Getter to expose current shimmer state.
|
|
232
204
|
get shimmerState() {
|
|
@@ -295,7 +267,7 @@ function Spinner(options) {
|
|
|
295
267
|
} else if (Array.isArray(this.#shimmer.color[0])) {
|
|
296
268
|
shimmerColor = this.#shimmer.color;
|
|
297
269
|
} else {
|
|
298
|
-
shimmerColor = toRgb(this.#shimmer.color);
|
|
270
|
+
shimmerColor = (0, import_colors.toRgb)(this.#shimmer.color);
|
|
299
271
|
}
|
|
300
272
|
displayText = (0, import_text_shimmer.applyShimmer)(displayText, this.#shimmer, {
|
|
301
273
|
color: shimmerColor,
|
|
@@ -310,6 +282,7 @@ function Spinner(options) {
|
|
|
310
282
|
/**
|
|
311
283
|
* Show a status message without stopping the spinner.
|
|
312
284
|
* Outputs the symbol and message to stderr, then continues spinning.
|
|
285
|
+
* @private
|
|
313
286
|
*/
|
|
314
287
|
#showStatusAndKeepSpinning(symbolType, args) {
|
|
315
288
|
let text = args.at(0);
|
|
@@ -387,6 +360,20 @@ function Spinner(options) {
|
|
|
387
360
|
this.#updateSpinnerText();
|
|
388
361
|
return this;
|
|
389
362
|
}
|
|
363
|
+
/**
|
|
364
|
+
* Disable shimmer effect.
|
|
365
|
+
* Preserves config for later re-enable via enableShimmer().
|
|
366
|
+
*
|
|
367
|
+
* @returns This spinner for chaining
|
|
368
|
+
*
|
|
369
|
+
* @example
|
|
370
|
+
* spinner.disableShimmer()
|
|
371
|
+
*/
|
|
372
|
+
disableShimmer() {
|
|
373
|
+
this.#shimmer = void 0;
|
|
374
|
+
this.#updateSpinnerText();
|
|
375
|
+
return this;
|
|
376
|
+
}
|
|
390
377
|
/**
|
|
391
378
|
* Show a done/success message (✓) without stopping the spinner.
|
|
392
379
|
* Alias for `success()` with a shorter name.
|
|
@@ -412,6 +399,31 @@ function Spinner(options) {
|
|
|
412
399
|
doneAndStop(text, ...extras) {
|
|
413
400
|
return this.#apply("success", [text, ...extras]);
|
|
414
401
|
}
|
|
402
|
+
/**
|
|
403
|
+
* Enable shimmer effect.
|
|
404
|
+
* Restores saved config or uses defaults if no saved config exists.
|
|
405
|
+
*
|
|
406
|
+
* @returns This spinner for chaining
|
|
407
|
+
*
|
|
408
|
+
* @example
|
|
409
|
+
* spinner.enableShimmer()
|
|
410
|
+
*/
|
|
411
|
+
enableShimmer() {
|
|
412
|
+
if (this.#shimmerSavedConfig) {
|
|
413
|
+
this.#shimmer = { ...this.#shimmerSavedConfig };
|
|
414
|
+
} else {
|
|
415
|
+
this.#shimmer = {
|
|
416
|
+
color: import_text_shimmer.COLOR_INHERIT,
|
|
417
|
+
currentDir: import_text_shimmer.DIR_LTR,
|
|
418
|
+
mode: import_text_shimmer.DIR_LTR,
|
|
419
|
+
speed: 1 / 3,
|
|
420
|
+
step: 0
|
|
421
|
+
};
|
|
422
|
+
this.#shimmerSavedConfig = this.#shimmer;
|
|
423
|
+
}
|
|
424
|
+
this.#updateSpinnerText();
|
|
425
|
+
return this;
|
|
426
|
+
}
|
|
415
427
|
/**
|
|
416
428
|
* Show a failure message (✗) without stopping the spinner.
|
|
417
429
|
* DESIGN DECISION: Unlike yocto-spinner, our `fail()` does NOT stop the spinner.
|
|
@@ -559,6 +571,67 @@ function Spinner(options) {
|
|
|
559
571
|
}
|
|
560
572
|
return this;
|
|
561
573
|
}
|
|
574
|
+
/**
|
|
575
|
+
* Show a reasoning/working message (∴) without stopping the spinner.
|
|
576
|
+
* Outputs to stderr and continues spinning.
|
|
577
|
+
*
|
|
578
|
+
* @param text - Reasoning message to display
|
|
579
|
+
* @param extras - Additional values to log
|
|
580
|
+
* @returns This spinner for chaining
|
|
581
|
+
*/
|
|
582
|
+
reason(text, ...extras) {
|
|
583
|
+
return this.#showStatusAndKeepSpinning("reason", [text, ...extras]);
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* Show a reasoning/working message (∴) and stop the spinner.
|
|
587
|
+
* Auto-clears the spinner line before displaying the message.
|
|
588
|
+
*
|
|
589
|
+
* Implementation note: Unlike other *AndStop methods (successAndStop, failAndStop, etc.),
|
|
590
|
+
* this method cannot use #apply() with a 'reason' method name because yocto-spinner
|
|
591
|
+
* doesn't have a built-in 'reason' method. Instead, we manually stop the spinner then
|
|
592
|
+
* log the message with the reason symbol. This matches the pattern used by methods
|
|
593
|
+
* like debugAndStop() and maintains consistency with normalizeText() usage and empty
|
|
594
|
+
* string handling (see #apply's stop method handling for the pattern).
|
|
595
|
+
*
|
|
596
|
+
* @param text - Reasoning message to display
|
|
597
|
+
* @param extras - Additional values to log
|
|
598
|
+
* @returns This spinner for chaining
|
|
599
|
+
*/
|
|
600
|
+
reasonAndStop(text, ...extras) {
|
|
601
|
+
this.#apply("stop", []);
|
|
602
|
+
const normalized = normalizeText(text);
|
|
603
|
+
if (normalized) {
|
|
604
|
+
logger.error(`${import_logger.LOG_SYMBOLS.reason} ${normalized}`, ...extras);
|
|
605
|
+
}
|
|
606
|
+
return this;
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Set complete shimmer configuration.
|
|
610
|
+
* Replaces any existing shimmer config with the provided values.
|
|
611
|
+
* Undefined properties will use default values.
|
|
612
|
+
*
|
|
613
|
+
* @param config - Complete shimmer configuration
|
|
614
|
+
* @returns This spinner for chaining
|
|
615
|
+
*
|
|
616
|
+
* @example
|
|
617
|
+
* spinner.setShimmer({
|
|
618
|
+
* color: [255, 0, 0],
|
|
619
|
+
* dir: 'rtl',
|
|
620
|
+
* speed: 0.5
|
|
621
|
+
* })
|
|
622
|
+
*/
|
|
623
|
+
setShimmer(config) {
|
|
624
|
+
this.#shimmer = {
|
|
625
|
+
color: config.color ?? import_text_shimmer.COLOR_INHERIT,
|
|
626
|
+
currentDir: import_text_shimmer.DIR_LTR,
|
|
627
|
+
mode: config.dir ?? import_text_shimmer.DIR_LTR,
|
|
628
|
+
speed: config.speed ?? 1 / 3,
|
|
629
|
+
step: 0
|
|
630
|
+
};
|
|
631
|
+
this.#shimmerSavedConfig = this.#shimmer;
|
|
632
|
+
this.#updateSpinnerText();
|
|
633
|
+
return this;
|
|
634
|
+
}
|
|
562
635
|
/**
|
|
563
636
|
* Start the spinner animation with optional text.
|
|
564
637
|
* Begins displaying the animated spinner on stderr.
|
|
@@ -610,28 +683,6 @@ function Spinner(options) {
|
|
|
610
683
|
}
|
|
611
684
|
return this;
|
|
612
685
|
}
|
|
613
|
-
/**
|
|
614
|
-
* Log an indented substep message to stderr without stopping the spinner.
|
|
615
|
-
* Adds 2-space indentation to the message.
|
|
616
|
-
* Aligns with `logger.substep()` to use stderr for status messages.
|
|
617
|
-
*
|
|
618
|
-
* @param text - Substep message to display
|
|
619
|
-
* @param extras - Additional values to log
|
|
620
|
-
* @returns This spinner for chaining
|
|
621
|
-
*
|
|
622
|
-
* @example
|
|
623
|
-
* ```ts
|
|
624
|
-
* spinner.step('Building application')
|
|
625
|
-
* spinner.substep('Compiling TypeScript')
|
|
626
|
-
* spinner.substep('Bundling assets')
|
|
627
|
-
* ```
|
|
628
|
-
*/
|
|
629
|
-
substep(text, ...extras) {
|
|
630
|
-
if (typeof text === "string") {
|
|
631
|
-
logger.error(` ${text}`, ...extras);
|
|
632
|
-
}
|
|
633
|
-
return this;
|
|
634
|
-
}
|
|
635
686
|
/**
|
|
636
687
|
* Stop the spinner animation and clear internal state.
|
|
637
688
|
* Auto-clears the spinner line via yocto-spinner.stop().
|
|
@@ -663,6 +714,28 @@ function Spinner(options) {
|
|
|
663
714
|
super.text = "";
|
|
664
715
|
return result;
|
|
665
716
|
}
|
|
717
|
+
/**
|
|
718
|
+
* Log an indented substep message to stderr without stopping the spinner.
|
|
719
|
+
* Adds 2-space indentation to the message.
|
|
720
|
+
* Aligns with `logger.substep()` to use stderr for status messages.
|
|
721
|
+
*
|
|
722
|
+
* @param text - Substep message to display
|
|
723
|
+
* @param extras - Additional values to log
|
|
724
|
+
* @returns This spinner for chaining
|
|
725
|
+
*
|
|
726
|
+
* @example
|
|
727
|
+
* ```ts
|
|
728
|
+
* spinner.step('Building application')
|
|
729
|
+
* spinner.substep('Compiling TypeScript')
|
|
730
|
+
* spinner.substep('Bundling assets')
|
|
731
|
+
* ```
|
|
732
|
+
*/
|
|
733
|
+
substep(text, ...extras) {
|
|
734
|
+
if (typeof text === "string") {
|
|
735
|
+
logger.error(` ${text}`, ...extras);
|
|
736
|
+
}
|
|
737
|
+
return this;
|
|
738
|
+
}
|
|
666
739
|
/**
|
|
667
740
|
* Show a success message (✓) without stopping the spinner.
|
|
668
741
|
* DESIGN DECISION: Unlike yocto-spinner, our `success()` does NOT stop the spinner.
|
|
@@ -695,94 +768,6 @@ function Spinner(options) {
|
|
|
695
768
|
this.#updateSpinnerText();
|
|
696
769
|
return this;
|
|
697
770
|
}
|
|
698
|
-
/**
|
|
699
|
-
* Show a warning message (⚠) without stopping the spinner.
|
|
700
|
-
* Outputs to stderr and continues spinning.
|
|
701
|
-
*
|
|
702
|
-
* @param text - Warning message to display
|
|
703
|
-
* @param extras - Additional values to log
|
|
704
|
-
* @returns This spinner for chaining
|
|
705
|
-
*/
|
|
706
|
-
warn(text, ...extras) {
|
|
707
|
-
return this.#showStatusAndKeepSpinning("warn", [text, ...extras]);
|
|
708
|
-
}
|
|
709
|
-
/**
|
|
710
|
-
* Show a warning message (⚠) and stop the spinner.
|
|
711
|
-
* Auto-clears the spinner line before displaying the warning message.
|
|
712
|
-
*
|
|
713
|
-
* @param text - Warning message to display
|
|
714
|
-
* @param extras - Additional values to log
|
|
715
|
-
* @returns This spinner for chaining
|
|
716
|
-
*/
|
|
717
|
-
warnAndStop(text, ...extras) {
|
|
718
|
-
return this.#apply("warning", [text, ...extras]);
|
|
719
|
-
}
|
|
720
|
-
/**
|
|
721
|
-
* Enable shimmer effect.
|
|
722
|
-
* Restores saved config or uses defaults if no saved config exists.
|
|
723
|
-
*
|
|
724
|
-
* @returns This spinner for chaining
|
|
725
|
-
*
|
|
726
|
-
* @example
|
|
727
|
-
* spinner.enableShimmer()
|
|
728
|
-
*/
|
|
729
|
-
enableShimmer() {
|
|
730
|
-
if (this.#shimmerSavedConfig) {
|
|
731
|
-
this.#shimmer = { ...this.#shimmerSavedConfig };
|
|
732
|
-
} else {
|
|
733
|
-
this.#shimmer = {
|
|
734
|
-
color: import_text_shimmer.COLOR_INHERIT,
|
|
735
|
-
currentDir: import_text_shimmer.DIR_LTR,
|
|
736
|
-
mode: import_text_shimmer.DIR_LTR,
|
|
737
|
-
speed: 1 / 3,
|
|
738
|
-
step: 0
|
|
739
|
-
};
|
|
740
|
-
this.#shimmerSavedConfig = this.#shimmer;
|
|
741
|
-
}
|
|
742
|
-
this.#updateSpinnerText();
|
|
743
|
-
return this;
|
|
744
|
-
}
|
|
745
|
-
/**
|
|
746
|
-
* Disable shimmer effect.
|
|
747
|
-
* Preserves config for later re-enable via enableShimmer().
|
|
748
|
-
*
|
|
749
|
-
* @returns This spinner for chaining
|
|
750
|
-
*
|
|
751
|
-
* @example
|
|
752
|
-
* spinner.disableShimmer()
|
|
753
|
-
*/
|
|
754
|
-
disableShimmer() {
|
|
755
|
-
this.#shimmer = void 0;
|
|
756
|
-
this.#updateSpinnerText();
|
|
757
|
-
return this;
|
|
758
|
-
}
|
|
759
|
-
/**
|
|
760
|
-
* Set complete shimmer configuration.
|
|
761
|
-
* Replaces any existing shimmer config with the provided values.
|
|
762
|
-
* Undefined properties will use default values.
|
|
763
|
-
*
|
|
764
|
-
* @param config - Complete shimmer configuration
|
|
765
|
-
* @returns This spinner for chaining
|
|
766
|
-
*
|
|
767
|
-
* @example
|
|
768
|
-
* spinner.setShimmer({
|
|
769
|
-
* color: [255, 0, 0],
|
|
770
|
-
* dir: 'rtl',
|
|
771
|
-
* speed: 0.5
|
|
772
|
-
* })
|
|
773
|
-
*/
|
|
774
|
-
setShimmer(config) {
|
|
775
|
-
this.#shimmer = {
|
|
776
|
-
color: config.color ?? import_text_shimmer.COLOR_INHERIT,
|
|
777
|
-
currentDir: import_text_shimmer.DIR_LTR,
|
|
778
|
-
mode: config.dir ?? import_text_shimmer.DIR_LTR,
|
|
779
|
-
speed: config.speed ?? 1 / 3,
|
|
780
|
-
step: 0
|
|
781
|
-
};
|
|
782
|
-
this.#shimmerSavedConfig = this.#shimmer;
|
|
783
|
-
this.#updateSpinnerText();
|
|
784
|
-
return this;
|
|
785
|
-
}
|
|
786
771
|
/**
|
|
787
772
|
* Update partial shimmer configuration.
|
|
788
773
|
* Merges with existing config, enabling shimmer if currently disabled.
|
|
@@ -834,6 +819,28 @@ function Spinner(options) {
|
|
|
834
819
|
this.#updateSpinnerText();
|
|
835
820
|
return this;
|
|
836
821
|
}
|
|
822
|
+
/**
|
|
823
|
+
* Show a warning message (⚠) without stopping the spinner.
|
|
824
|
+
* Outputs to stderr and continues spinning.
|
|
825
|
+
*
|
|
826
|
+
* @param text - Warning message to display
|
|
827
|
+
* @param extras - Additional values to log
|
|
828
|
+
* @returns This spinner for chaining
|
|
829
|
+
*/
|
|
830
|
+
warn(text, ...extras) {
|
|
831
|
+
return this.#showStatusAndKeepSpinning("warn", [text, ...extras]);
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* Show a warning message (⚠) and stop the spinner.
|
|
835
|
+
* Auto-clears the spinner line before displaying the warning message.
|
|
836
|
+
*
|
|
837
|
+
* @param text - Warning message to display
|
|
838
|
+
* @param extras - Additional values to log
|
|
839
|
+
* @returns This spinner for chaining
|
|
840
|
+
*/
|
|
841
|
+
warnAndStop(text, ...extras) {
|
|
842
|
+
return this.#apply("warning", [text, ...extras]);
|
|
843
|
+
}
|
|
837
844
|
};
|
|
838
845
|
Object.defineProperties(_Spinner.prototype, {
|
|
839
846
|
error: desc(_Spinner.prototype.fail),
|
|
@@ -866,7 +873,7 @@ async function withSpinner(options) {
|
|
|
866
873
|
const savedColor = withOptions?.color !== void 0 ? spinner.color : void 0;
|
|
867
874
|
const savedShimmerState = withOptions?.shimmer !== void 0 ? spinner.shimmerState : void 0;
|
|
868
875
|
if (withOptions?.color !== void 0) {
|
|
869
|
-
spinner.color = toRgb(withOptions.color);
|
|
876
|
+
spinner.color = (0, import_colors.toRgb)(withOptions.color);
|
|
870
877
|
}
|
|
871
878
|
if (withOptions?.shimmer !== void 0) {
|
|
872
879
|
if (typeof withOptions.shimmer === "string") {
|
|
@@ -920,7 +927,7 @@ function withSpinnerSync(options) {
|
|
|
920
927
|
const savedColor = withOptions?.color !== void 0 ? spinner.color : void 0;
|
|
921
928
|
const savedShimmerState = withOptions?.shimmer !== void 0 ? spinner.shimmerState : void 0;
|
|
922
929
|
if (withOptions?.color !== void 0) {
|
|
923
|
-
spinner.color = toRgb(withOptions.color);
|
|
930
|
+
spinner.color = (0, import_colors.toRgb)(withOptions.color);
|
|
924
931
|
}
|
|
925
932
|
if (withOptions?.shimmer !== void 0) {
|
|
926
933
|
if (typeof withOptions.shimmer === "string") {
|
|
@@ -956,7 +963,6 @@ function withSpinnerSync(options) {
|
|
|
956
963
|
ciSpinner,
|
|
957
964
|
getCliSpinners,
|
|
958
965
|
getDefaultSpinner,
|
|
959
|
-
toRgb,
|
|
960
966
|
withSpinner,
|
|
961
967
|
withSpinnerRestore,
|
|
962
968
|
withSpinnerSync
|
package/dist/stdio/prompts.d.ts
CHANGED
|
@@ -98,6 +98,8 @@ export declare function createInquirerTheme(theme: Theme | ThemeName | unknown):
|
|
|
98
98
|
*/
|
|
99
99
|
/*@__NO_SIDE_EFFECTS__*/
|
|
100
100
|
export declare function wrapPrompt<T = unknown>(inquirerPrompt: (...args: unknown[]) => Promise<T>): (...args: unknown[]) => Promise<T | undefined>;
|
|
101
|
+
// c8 ignore start - Third-party inquirer library requires and exports not testable in isolation.
|
|
102
|
+
declare const checkboxRaw: any;
|
|
101
103
|
declare const confirmRaw: any;
|
|
102
104
|
declare const inputRaw: any;
|
|
103
105
|
declare const passwordRaw: any;
|
|
@@ -105,6 +107,21 @@ declare const searchRaw: any;
|
|
|
105
107
|
declare const selectRaw: any;
|
|
106
108
|
declare const ActualSeparator: any;
|
|
107
109
|
// c8 ignore stop
|
|
110
|
+
/**
|
|
111
|
+
* Prompt to select multiple items from a list of choices.
|
|
112
|
+
* Wrapped with spinner handling and abort signal support.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* const choices = await checkbox({
|
|
116
|
+
* message: 'Select options:',
|
|
117
|
+
* choices: [
|
|
118
|
+
* { name: 'Option 1', value: 'opt1' },
|
|
119
|
+
* { name: 'Option 2', value: 'opt2' },
|
|
120
|
+
* { name: 'Option 3', value: 'opt3' }
|
|
121
|
+
* ]
|
|
122
|
+
* })
|
|
123
|
+
*/
|
|
124
|
+
export declare const checkbox: typeof checkboxRaw;
|
|
108
125
|
/**
|
|
109
126
|
* Prompt for a yes/no confirmation.
|
|
110
127
|
* Wrapped with spinner handling and abort signal support.
|
package/dist/stdio/prompts.js
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
var prompts_exports = {};
|
|
31
31
|
__export(prompts_exports, {
|
|
32
32
|
Separator: () => ActualSeparator,
|
|
33
|
+
checkbox: () => checkbox,
|
|
33
34
|
confirm: () => confirm,
|
|
34
35
|
createInquirerTheme: () => createInquirerTheme,
|
|
35
36
|
createSeparator: () => createSeparator,
|
|
@@ -40,7 +41,7 @@ __export(prompts_exports, {
|
|
|
40
41
|
wrapPrompt: () => wrapPrompt
|
|
41
42
|
});
|
|
42
43
|
module.exports = __toCommonJS(prompts_exports);
|
|
43
|
-
var import_process = require("
|
|
44
|
+
var import_process = require("#constants/process");
|
|
44
45
|
var import_context = require("../themes/context");
|
|
45
46
|
var import_themes = require("../themes/themes");
|
|
46
47
|
var import_utils = require("../themes/utils");
|
|
@@ -140,17 +141,14 @@ function wrapPrompt(inquirerPrompt) {
|
|
|
140
141
|
return typeof result === "string" ? result.trim() : result;
|
|
141
142
|
};
|
|
142
143
|
}
|
|
143
|
-
const
|
|
144
|
-
const
|
|
145
|
-
const
|
|
146
|
-
const
|
|
147
|
-
const
|
|
148
|
-
const
|
|
149
|
-
const
|
|
150
|
-
const
|
|
151
|
-
const searchRaw = searchExport.default ?? searchExport;
|
|
152
|
-
const selectRaw = selectExport.default ?? selectExport;
|
|
153
|
-
const ActualSeparator = selectExport.Separator;
|
|
144
|
+
const checkboxRaw = require("../external/@inquirer/checkbox");
|
|
145
|
+
const confirmRaw = require("../external/@inquirer/confirm");
|
|
146
|
+
const inputRaw = require("../external/@inquirer/input");
|
|
147
|
+
const passwordRaw = require("../external/@inquirer/password");
|
|
148
|
+
const searchRaw = require("../external/@inquirer/search");
|
|
149
|
+
const selectRaw = require("../external/@inquirer/select");
|
|
150
|
+
const ActualSeparator = selectRaw.Separator;
|
|
151
|
+
const checkbox = /* @__PURE__ */ wrapPrompt(checkboxRaw);
|
|
154
152
|
const confirm = /* @__PURE__ */ wrapPrompt(confirmRaw);
|
|
155
153
|
const input = /* @__PURE__ */ wrapPrompt(inputRaw);
|
|
156
154
|
const password = /* @__PURE__ */ wrapPrompt(passwordRaw);
|
|
@@ -162,6 +160,7 @@ function createSeparator(text) {
|
|
|
162
160
|
// Annotate the CommonJS export names for ESM import in node:
|
|
163
161
|
0 && (module.exports = {
|
|
164
162
|
Separator,
|
|
163
|
+
checkbox,
|
|
165
164
|
confirm,
|
|
166
165
|
createInquirerTheme,
|
|
167
166
|
createSeparator,
|
|
@@ -22,7 +22,7 @@ __export(temporary_executor_exports, {
|
|
|
22
22
|
isRunningInTemporaryExecutor: () => isRunningInTemporaryExecutor
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(temporary_executor_exports);
|
|
25
|
-
var import_platform = require("
|
|
25
|
+
var import_platform = require("#constants/platform");
|
|
26
26
|
var import_path = require("./path");
|
|
27
27
|
function isRunningInTemporaryExecutor(cwd = process.cwd()) {
|
|
28
28
|
const userAgent = process.env["npm_config_user_agent"];
|
package/dist/themes/types.d.ts
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* @fileoverview Elegant theme type system.
|
|
3
3
|
* Type-safe theming for spinners, loggers, prompts, and links.
|
|
4
4
|
*/
|
|
5
|
-
import type { ColorValue
|
|
5
|
+
import type { ColorValue } from '../colors';
|
|
6
|
+
import type { SpinnerStyle } from '../spinner';
|
|
6
7
|
import type { ShimmerDirection } from '../effects/text-shimmer';
|
|
7
8
|
/**
|
|
8
9
|
* Color reference — direct value or semantic keyword.
|
package/dist/themes/utils.d.ts
CHANGED
package/dist/utils/get-ipc.d.ts
CHANGED
package/dist/utils/get-ipc.js
CHANGED
|
@@ -18,7 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
20
|
var get_ipc_exports = {};
|
|
21
|
-
|
|
21
|
+
__export(get_ipc_exports, {
|
|
22
|
+
getIpc: () => getIpc
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(get_ipc_exports);
|
|
22
25
|
let _ipcObject;
|
|
23
26
|
async function getIpc(key) {
|
|
24
27
|
if (_ipcObject === void 0) {
|
|
@@ -49,10 +52,7 @@ async function getIpc(key) {
|
|
|
49
52
|
}
|
|
50
53
|
return key ? _ipcObject[key] : _ipcObject;
|
|
51
54
|
}
|
|
52
|
-
var get_ipc_default = getIpc;
|
|
53
55
|
// Annotate the CommonJS export names for ESM import in node:
|
|
54
56
|
0 && (module.exports = {
|
|
55
57
|
getIpc
|
|
56
58
|
});
|
|
57
|
-
|
|
58
|
-
module.exports = get_ipc_default;
|
package/dist/versions.d.ts
CHANGED
|
@@ -84,4 +84,4 @@ export declare function sortVersionsDesc(versions: string[]): string[];
|
|
|
84
84
|
/**
|
|
85
85
|
* Get the difference between two versions.
|
|
86
86
|
*/
|
|
87
|
-
export declare function versionDiff(version1: string, version2: string): 'major' | 'premajor' | 'minor' | 'preminor' | 'patch' | 'prepatch' | 'prerelease' | undefined;
|
|
87
|
+
export declare function versionDiff(version1: string, version2: string): 'major' | 'premajor' | 'minor' | 'preminor' | 'patch' | 'prepatch' | 'prerelease' | 'release' | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@socketsecurity/lib",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
|
+
"packageManager": "pnpm@10.21.0",
|
|
4
5
|
"license": "MIT",
|
|
5
6
|
"description": "Core utilities and infrastructure for Socket.dev security tools",
|
|
6
7
|
"keywords": [
|
|
@@ -56,6 +57,10 @@
|
|
|
56
57
|
"types": "./dist/cache-with-ttl.d.ts",
|
|
57
58
|
"default": "./dist/cache-with-ttl.js"
|
|
58
59
|
},
|
|
60
|
+
"./colors": {
|
|
61
|
+
"types": "./dist/colors.d.ts",
|
|
62
|
+
"default": "./dist/colors.js"
|
|
63
|
+
},
|
|
59
64
|
"./constants/agents": {
|
|
60
65
|
"types": "./dist/constants/agents.d.ts",
|
|
61
66
|
"default": "./dist/constants/agents.js"
|
|
@@ -574,23 +579,21 @@
|
|
|
574
579
|
"CHANGELOG.md"
|
|
575
580
|
],
|
|
576
581
|
"engines": {
|
|
577
|
-
"node": ">=22"
|
|
582
|
+
"node": ">=22",
|
|
583
|
+
"pnpm": ">=10.21.0"
|
|
578
584
|
},
|
|
579
585
|
"sideEffects": false,
|
|
580
586
|
"scripts": {
|
|
581
|
-
"build": "node scripts/build.mjs",
|
|
582
|
-
"build:watch": "node scripts/build-js.mjs --watch",
|
|
587
|
+
"build": "node scripts/build/main.mjs",
|
|
583
588
|
"check": "node scripts/check.mjs",
|
|
584
|
-
"
|
|
585
|
-
"
|
|
586
|
-
"
|
|
587
|
-
"dev": "pnpm run build:watch",
|
|
589
|
+
"clean": "node scripts/build/clean.mjs",
|
|
590
|
+
"cover": "node scripts/test/cover.mjs",
|
|
591
|
+
"dev": "node scripts/build/main.mjs --watch",
|
|
588
592
|
"fix": "node scripts/lint.mjs --fix",
|
|
589
|
-
"fix:build": "node scripts/fix-build.mjs",
|
|
590
593
|
"lint": "node scripts/lint.mjs",
|
|
591
594
|
"prepare": "husky",
|
|
592
595
|
"prepublishOnly": "pnpm run build",
|
|
593
|
-
"test": "node scripts/test.mjs",
|
|
596
|
+
"test": "node scripts/test/main.mjs",
|
|
594
597
|
"update": "node scripts/update.mjs"
|
|
595
598
|
},
|
|
596
599
|
"devDependencies": {
|
|
@@ -601,6 +604,7 @@
|
|
|
601
604
|
"@biomejs/biome": "2.2.4",
|
|
602
605
|
"@eslint/compat": "1.4.0",
|
|
603
606
|
"@eslint/js": "9.38.0",
|
|
607
|
+
"@inquirer/checkbox": "4.3.1",
|
|
604
608
|
"@inquirer/confirm": "5.1.16",
|
|
605
609
|
"@inquirer/input": "4.2.2",
|
|
606
610
|
"@inquirer/password": "4.0.18",
|
|
@@ -611,7 +615,7 @@
|
|
|
611
615
|
"@socketregistry/is-unicode-supported": "1.0.5",
|
|
612
616
|
"@socketregistry/packageurl-js": "1.3.5",
|
|
613
617
|
"@socketregistry/yocto-spinner": "1.0.25",
|
|
614
|
-
"@socketsecurity/lib-stable": "https://registry.npmjs.org/@socketsecurity/lib/-/lib-3.
|
|
618
|
+
"@socketsecurity/lib-stable": "https://registry.npmjs.org/@socketsecurity/lib/-/lib-3.3.0.tgz",
|
|
615
619
|
"@types/node": "24.9.2",
|
|
616
620
|
"@typescript/native-preview": "7.0.0-dev.20250920.1",
|
|
617
621
|
"@vitest/coverage-v8": "4.0.3",
|