@socketsecurity/lib 3.2.8 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +18 -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 +7 -7
- package/dist/constants/process.js +1 -1
- 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/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 +9 -2
- package/dist/lifecycle-script-names.js +11 -4
- package/dist/logger.d.ts +106 -81
- package/dist/logger.js +234 -205
- package/dist/maintained-node-versions.d.ts +3 -2
- package/dist/maintained-node-versions.js +11 -4
- package/dist/objects.js +1 -1
- package/dist/package-default-node-range.d.ts +3 -2
- package/dist/package-default-node-range.js +12 -5
- package/dist/package-default-socket-categories.d.ts +7 -2
- package/dist/package-default-socket-categories.js +11 -4
- package/dist/package-extensions.d.ts +3 -2
- package/dist/package-extensions.js +11 -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.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.js +1 -1
- 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 +10 -9
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.js
CHANGED
|
@@ -40,7 +40,7 @@ __export(prompts_exports, {
|
|
|
40
40
|
wrapPrompt: () => wrapPrompt
|
|
41
41
|
});
|
|
42
42
|
module.exports = __toCommonJS(prompts_exports);
|
|
43
|
-
var import_process = require("
|
|
43
|
+
var import_process = require("#constants/process");
|
|
44
44
|
var import_context = require("../themes/context");
|
|
45
45
|
var import_themes = require("../themes/themes");
|
|
46
46
|
var import_utils = require("../themes/utils");
|
|
@@ -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,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@socketsecurity/lib",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Core utilities and infrastructure for Socket.dev security tools",
|
|
6
6
|
"keywords": [
|
|
@@ -56,6 +56,10 @@
|
|
|
56
56
|
"types": "./dist/cache-with-ttl.d.ts",
|
|
57
57
|
"default": "./dist/cache-with-ttl.js"
|
|
58
58
|
},
|
|
59
|
+
"./colors": {
|
|
60
|
+
"types": "./dist/colors.d.ts",
|
|
61
|
+
"default": "./dist/colors.js"
|
|
62
|
+
},
|
|
59
63
|
"./constants/agents": {
|
|
60
64
|
"types": "./dist/constants/agents.d.ts",
|
|
61
65
|
"default": "./dist/constants/agents.js"
|
|
@@ -578,19 +582,16 @@
|
|
|
578
582
|
},
|
|
579
583
|
"sideEffects": false,
|
|
580
584
|
"scripts": {
|
|
581
|
-
"build": "node scripts/build.mjs",
|
|
582
|
-
"build:watch": "node scripts/build-js.mjs --watch",
|
|
585
|
+
"build": "node scripts/build/main.mjs",
|
|
583
586
|
"check": "node scripts/check.mjs",
|
|
584
|
-
"
|
|
585
|
-
"
|
|
586
|
-
"
|
|
587
|
-
"dev": "pnpm run build:watch",
|
|
587
|
+
"clean": "node scripts/build/clean.mjs",
|
|
588
|
+
"cover": "node scripts/test/cover.mjs",
|
|
589
|
+
"dev": "node scripts/build/main.mjs --watch",
|
|
588
590
|
"fix": "node scripts/lint.mjs --fix",
|
|
589
|
-
"fix:build": "node scripts/fix-build.mjs",
|
|
590
591
|
"lint": "node scripts/lint.mjs",
|
|
591
592
|
"prepare": "husky",
|
|
592
593
|
"prepublishOnly": "pnpm run build",
|
|
593
|
-
"test": "node scripts/test.mjs",
|
|
594
|
+
"test": "node scripts/test/main.mjs",
|
|
594
595
|
"update": "node scripts/update.mjs"
|
|
595
596
|
},
|
|
596
597
|
"devDependencies": {
|