@socketsecurity/lib 1.0.4 → 1.1.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/abort.js.map +2 -2
  3. package/dist/argv/parse.js.map +2 -2
  4. package/dist/arrays.d.ts +143 -0
  5. package/dist/arrays.js.map +2 -2
  6. package/dist/bin.js +1 -4
  7. package/dist/bin.js.map +2 -2
  8. package/dist/cacache.d.ts +0 -2
  9. package/dist/cacache.js +0 -1
  10. package/dist/cacache.js.map +2 -2
  11. package/dist/cache-with-ttl.js.map +2 -2
  12. package/dist/dlx.js.map +2 -2
  13. package/dist/external/@yarnpkg/extensions.d.ts +0 -1
  14. package/dist/external/cacache.d.ts +0 -7
  15. package/dist/external/debug.d.ts +0 -3
  16. package/dist/external/fast-sort.d.ts +0 -1
  17. package/dist/external/libnpmpack.d.ts +0 -1
  18. package/dist/external/make-fetch-happen.d.ts +0 -1
  19. package/dist/external/pacote.d.ts +0 -5
  20. package/dist/external/semver.d.ts +0 -1
  21. package/dist/external/validate-npm-package-name.js +1 -1
  22. package/dist/external/yargs-parser.d.ts +0 -1
  23. package/dist/external/yoctocolors-cjs.js +1 -1
  24. package/dist/external/zod.js +9 -9
  25. package/dist/fs.d.ts +595 -23
  26. package/dist/fs.js.map +2 -2
  27. package/dist/git.d.ts +488 -41
  28. package/dist/git.js.map +2 -2
  29. package/dist/github.d.ts +361 -12
  30. package/dist/github.js.map +2 -2
  31. package/dist/http-request.d.ts +463 -4
  32. package/dist/http-request.js.map +2 -2
  33. package/dist/json.d.ts +177 -4
  34. package/dist/json.js.map +2 -2
  35. package/dist/logger.d.ts +823 -70
  36. package/dist/logger.js +654 -51
  37. package/dist/logger.js.map +2 -2
  38. package/dist/objects.d.ts +386 -10
  39. package/dist/objects.js.map +2 -2
  40. package/dist/path.d.ts +270 -6
  41. package/dist/path.js.map +2 -2
  42. package/dist/promises.d.ts +432 -27
  43. package/dist/promises.js +3 -0
  44. package/dist/promises.js.map +2 -2
  45. package/dist/signal-exit.js.map +2 -2
  46. package/dist/sorts.js.map +2 -2
  47. package/dist/spawn.d.ts +242 -33
  48. package/dist/spawn.js.map +2 -2
  49. package/dist/spinner.d.ts +260 -20
  50. package/dist/spinner.js +201 -63
  51. package/dist/spinner.js.map +2 -2
  52. package/dist/stdio/clear.d.ts +130 -9
  53. package/dist/stdio/clear.js.map +2 -2
  54. package/dist/stdio/divider.d.ts +106 -10
  55. package/dist/stdio/divider.js +10 -0
  56. package/dist/stdio/divider.js.map +2 -2
  57. package/dist/stdio/footer.d.ts +70 -3
  58. package/dist/stdio/footer.js.map +2 -2
  59. package/dist/stdio/header.d.ts +93 -12
  60. package/dist/stdio/header.js.map +2 -2
  61. package/dist/stdio/mask.d.ts +82 -14
  62. package/dist/stdio/mask.js +25 -4
  63. package/dist/stdio/mask.js.map +2 -2
  64. package/dist/stdio/progress.d.ts +112 -15
  65. package/dist/stdio/progress.js +43 -3
  66. package/dist/stdio/progress.js.map +2 -2
  67. package/dist/stdio/prompts.d.ts +95 -5
  68. package/dist/stdio/prompts.js.map +2 -2
  69. package/dist/stdio/stderr.d.ts +114 -11
  70. package/dist/stdio/stderr.js.map +2 -2
  71. package/dist/stdio/stdout.d.ts +107 -11
  72. package/dist/stdio/stdout.js.map +2 -2
  73. package/dist/strings.d.ts +357 -28
  74. package/dist/strings.js.map +2 -2
  75. package/dist/suppress-warnings.js.map +2 -2
  76. package/dist/validation/json-parser.d.ts +226 -7
  77. package/dist/validation/json-parser.js.map +2 -2
  78. package/dist/validation/types.d.ts +114 -12
  79. package/dist/validation/types.js.map +1 -1
  80. package/package.json +5 -3
package/dist/spinner.d.ts CHANGED
@@ -4,119 +4,327 @@
4
4
  */
5
5
  import type { Writable } from 'node:stream';
6
6
  import type { ShimmerColorGradient, ShimmerConfig, ShimmerDirection, ShimmerState } from './effects/text-shimmer';
7
+ /**
8
+ * Named color values supported by the spinner.
9
+ * Maps to standard terminal colors with bright variants.
10
+ */
7
11
  export type ColorName = 'black' | 'blue' | 'blueBright' | 'cyan' | 'cyanBright' | 'gray' | 'green' | 'greenBright' | 'magenta' | 'magentaBright' | 'red' | 'redBright' | 'white' | 'whiteBright' | 'yellow' | 'yellowBright';
12
+ /**
13
+ * Special 'inherit' color value that uses the spinner's current color.
14
+ * Used with shimmer effects to dynamically inherit the spinner color.
15
+ */
8
16
  export type ColorInherit = 'inherit';
17
+ /**
18
+ * RGB color tuple with values 0-255 for red, green, and blue channels.
19
+ * @example [140, 82, 255] // Socket purple
20
+ * @example [255, 0, 0] // Red
21
+ */
9
22
  export type ColorRgb = readonly [number, number, number];
23
+ /**
24
+ * Union of all supported color types: named colors or RGB tuples.
25
+ */
10
26
  export type ColorValue = ColorName | ColorRgb;
27
+ /**
28
+ * Symbol types for status messages.
29
+ * Maps to log symbols: success (✓), fail (✗), info (ℹ), warn (⚠).
30
+ */
11
31
  export type SymbolType = 'fail' | 'info' | 'success' | 'warn';
32
+ /**
33
+ * Progress tracking information for display in spinner.
34
+ * Used by `progress()` and `progressStep()` methods to show animated progress bars.
35
+ */
12
36
  export type ProgressInfo = {
37
+ /** Current progress value */
13
38
  current: number;
39
+ /** Total/maximum progress value */
14
40
  total: number;
41
+ /** Optional unit label displayed after the progress count (e.g., 'files', 'items') */
15
42
  unit?: string | undefined;
16
43
  };
44
+ /**
45
+ * Internal shimmer state with color configuration.
46
+ * Extends `ShimmerState` with additional color property that can be inherited from spinner.
47
+ */
17
48
  export type ShimmerInfo = ShimmerState & {
49
+ /** Color for shimmer effect - can inherit from spinner, use explicit color, or gradient */
18
50
  color: ColorInherit | ColorValue | ShimmerColorGradient;
19
51
  };
52
+ /**
53
+ * Spinner instance for displaying animated loading indicators.
54
+ * Provides methods for status updates, progress tracking, and text shimmer effects.
55
+ *
56
+ * KEY BEHAVIORS:
57
+ * - Methods WITHOUT "AndStop" keep the spinner running (e.g., `success()`, `fail()`)
58
+ * - Methods WITH "AndStop" auto-clear the spinner line (e.g., `successAndStop()`, `failAndStop()`)
59
+ * - Status messages (done, success, fail, info, warn, step, substep) go to stderr
60
+ * - Data messages (`log()`) go to stdout
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * import { Spinner } from '@socketsecurity/registry/lib/spinner'
65
+ *
66
+ * const spinner = Spinner({ text: 'Loading…' })
67
+ * spinner.start()
68
+ *
69
+ * // Show success while continuing to spin
70
+ * spinner.success('Step 1 complete')
71
+ *
72
+ * // Stop the spinner with success message
73
+ * spinner.successAndStop('All done!')
74
+ * ```
75
+ */
20
76
  export type Spinner = {
77
+ /** Current spinner color as RGB tuple */
21
78
  color: ColorRgb;
79
+ /** Current spinner animation style */
22
80
  spinner: SpinnerStyle;
81
+ /** Whether spinner is currently animating */
23
82
  get isSpinning(): boolean;
83
+ /** Clear the current line without stopping the spinner */
24
84
  clear(): Spinner;
85
+ /** Show debug message without stopping (only if debug mode enabled) */
25
86
  debug(text?: string | undefined, ...extras: unknown[]): Spinner;
87
+ /** Show debug message and stop the spinner (only if debug mode enabled) */
26
88
  debugAndStop(text?: string | undefined, ...extras: unknown[]): Spinner;
89
+ /** Alias for `fail()` - show error without stopping */
27
90
  error(text?: string | undefined, ...extras: unknown[]): Spinner;
91
+ /** Alias for `failAndStop()` - show error and stop */
28
92
  errorAndStop(text?: string | undefined, ...extras: unknown[]): Spinner;
93
+ /** Show failure (✗) without stopping the spinner */
29
94
  fail(text?: string | undefined, ...extras: unknown[]): Spinner;
95
+ /** Show failure (✗) and stop the spinner, auto-clearing the line */
30
96
  failAndStop(text?: string | undefined, ...extras: unknown[]): Spinner;
31
- // text property returns a method via _textMethod override
97
+ /** Get current spinner text (getter) or set new text (setter) */
32
98
  text(value: string): Spinner;
33
99
  text(): string;
100
+ /** Increase indentation by specified spaces (default: 2) */
34
101
  indent(spaces?: number | undefined): Spinner;
102
+ /** Decrease indentation by specified spaces (default: 2) */
35
103
  dedent(spaces?: number | undefined): Spinner;
104
+ /** Show info (ℹ) message without stopping the spinner */
36
105
  info(text?: string | undefined, ...extras: unknown[]): Spinner;
106
+ /** Show info (ℹ) message and stop the spinner, auto-clearing the line */
37
107
  infoAndStop(text?: string | undefined, ...extras: unknown[]): Spinner;
108
+ /** Log to stdout without stopping the spinner */
38
109
  log(text?: string | undefined, ...extras: unknown[]): Spinner;
110
+ /** Log and stop the spinner, auto-clearing the line */
39
111
  logAndStop(text?: string | undefined, ...extras: unknown[]): Spinner;
112
+ /** Start spinning with optional text */
40
113
  start(text?: string | undefined): Spinner;
114
+ /** Stop spinning and clear internal state, auto-clearing the line */
41
115
  stop(text?: string | undefined): Spinner;
116
+ /** Stop and show final text without clearing the line */
42
117
  stopAndPersist(text?: string | undefined): Spinner;
118
+ /** Show main step message to stderr without stopping */
43
119
  step(text?: string | undefined, ...extras: unknown[]): Spinner;
120
+ /** Show indented substep message to stderr without stopping */
44
121
  substep(text?: string | undefined, ...extras: unknown[]): Spinner;
122
+ /** Show success (✓) without stopping the spinner */
45
123
  success(text?: string | undefined, ...extras: unknown[]): Spinner;
124
+ /** Show success (✓) and stop the spinner, auto-clearing the line */
46
125
  successAndStop(text?: string | undefined, ...extras: unknown[]): Spinner;
126
+ /** Alias for `success()` - show success without stopping */
47
127
  done(text?: string | undefined, ...extras: unknown[]): Spinner;
128
+ /** Alias for `successAndStop()` - show success and stop */
48
129
  doneAndStop(text?: string | undefined, ...extras: unknown[]): Spinner;
130
+ /** Update progress bar with current/total values and optional unit */
49
131
  progress(current: number, total: number, unit?: string | undefined): Spinner;
132
+ /** Increment progress by specified amount (default: 1) */
50
133
  progressStep(amount?: number): Spinner;
134
+ /** Toggle shimmer effect on/off */
51
135
  shimmer(enabled: boolean): Spinner;
136
+ /** Update shimmer configuration or set direction */
52
137
  shimmer(config: Partial<ShimmerConfig> | ShimmerDirection): Spinner;
138
+ /** Show warning (⚠) without stopping the spinner */
53
139
  warn(text?: string | undefined, ...extras: unknown[]): Spinner;
140
+ /** Show warning (⚠) and stop the spinner, auto-clearing the line */
54
141
  warnAndStop(text?: string | undefined, ...extras: unknown[]): Spinner;
55
142
  };
143
+ /**
144
+ * Configuration options for creating a spinner instance.
145
+ */
56
146
  export type SpinnerOptions = {
147
+ /**
148
+ * Spinner color as RGB tuple or color name.
149
+ * @default [140, 82, 255] Socket purple
150
+ */
57
151
  readonly color?: ColorValue | undefined;
152
+ /**
153
+ * Shimmer effect configuration or direction string.
154
+ * When enabled, text will have an animated shimmer effect.
155
+ * @default undefined No shimmer effect
156
+ */
58
157
  readonly shimmer?: ShimmerConfig | ShimmerDirection | undefined;
158
+ /**
159
+ * Animation style with frames and timing.
160
+ * @default 'socket' Custom Socket animation in CLI, minimal in CI
161
+ */
59
162
  readonly spinner?: SpinnerStyle | undefined;
163
+ /**
164
+ * Abort signal for cancelling the spinner.
165
+ * @default getAbortSignal() from process constants
166
+ */
60
167
  readonly signal?: AbortSignal | undefined;
168
+ /**
169
+ * Output stream for spinner rendering.
170
+ * @default process.stderr
171
+ */
61
172
  readonly stream?: Writable | undefined;
173
+ /**
174
+ * Initial text to display with the spinner.
175
+ * @default undefined No initial text
176
+ */
62
177
  readonly text?: string | undefined;
63
178
  };
179
+ /**
180
+ * Animation style definition for spinner frames.
181
+ * Defines the visual appearance and timing of the spinner animation.
182
+ */
64
183
  export type SpinnerStyle = {
184
+ /** Array of animation frames (strings to display sequentially) */
65
185
  readonly frames: string[];
186
+ /**
187
+ * Milliseconds between frame changes.
188
+ * @default 80 Standard frame rate
189
+ */
66
190
  readonly interval?: number | undefined;
67
191
  };
192
+ /**
193
+ * Minimal spinner style for CI environments.
194
+ * Uses empty frame and max interval to effectively disable animation in CI.
195
+ */
68
196
  export declare const ciSpinner: SpinnerStyle;
69
197
  /**
70
198
  * Get available CLI spinner styles or a specific style by name.
71
199
  * Extends the standard cli-spinners collection with Socket custom spinners.
72
200
  *
73
- * @see https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json
74
- *
75
201
  * Custom spinners:
76
202
  * - `socket` (default): Socket pulse animation with sparkles and lightning
203
+ *
204
+ * @param styleName - Optional name of specific spinner style to retrieve
205
+ * @returns Specific spinner style if name provided, all styles if omitted, `undefined` if style not found
206
+ * @see https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json
207
+ *
208
+ * @example
209
+ * ```ts
210
+ * // Get all available spinner styles
211
+ * const allSpinners = getCliSpinners()
212
+ *
213
+ * // Get specific style
214
+ * const socketStyle = getCliSpinners('socket')
215
+ * const dotsStyle = getCliSpinners('dots')
216
+ * ```
77
217
  */
78
218
  /*@__NO_SIDE_EFFECTS__*/
79
219
  export declare function getCliSpinners(styleName?: string | undefined): SpinnerStyle | Record<string, SpinnerStyle> | undefined;
80
220
  /**
81
221
  * Create a spinner instance for displaying loading indicators.
222
+ * Provides an animated CLI spinner with status messages, progress tracking, and shimmer effects.
82
223
  *
83
224
  * AUTO-CLEAR BEHAVIOR:
84
225
  * - All *AndStop() methods AUTO-CLEAR the spinner line via yocto-spinner.stop()
85
- * Examples: doneAndStop(), successAndStop(), failAndStop(), etc.
226
+ * Examples: `doneAndStop()`, `successAndStop()`, `failAndStop()`, etc.
86
227
  *
87
228
  * - Methods WITHOUT "AndStop" do NOT clear (spinner keeps spinning)
88
- * Examples: done(), success(), fail(), etc.
229
+ * Examples: `done()`, `success()`, `fail()`, etc.
89
230
  *
90
231
  * STREAM USAGE:
91
232
  * - Spinner animation: stderr (yocto-spinner default)
92
233
  * - Status methods (done, success, fail, info, warn, step, substep): stderr
93
- * - Data methods (log): stdout
234
+ * - Data methods (`log()`): stdout
94
235
  *
95
236
  * COMPARISON WITH LOGGER:
96
- * - logger.done() does NOT auto-clear (requires manual logger.clearLine())
97
- * - spinner.doneAndStop() DOES auto-clear (built into yocto-spinner.stop())
98
- * - Pattern: logger.clearLine().done() vs spinner.doneAndStop()
237
+ * - `logger.done()` does NOT auto-clear (requires manual `logger.clearLine()`)
238
+ * - `spinner.doneAndStop()` DOES auto-clear (built into yocto-spinner.stop())
239
+ * - Pattern: `logger.clearLine().done()` vs `spinner.doneAndStop()`
240
+ *
241
+ * @param options - Configuration options for the spinner
242
+ * @returns New spinner instance
243
+ *
244
+ * @example
245
+ * ```ts
246
+ * import { Spinner } from '@socketsecurity/registry/lib/spinner'
247
+ *
248
+ * // Basic usage
249
+ * const spinner = Spinner({ text: 'Loading data…' })
250
+ * spinner.start()
251
+ * await fetchData()
252
+ * spinner.successAndStop('Data loaded!')
253
+ *
254
+ * // With custom color
255
+ * const spinner = Spinner({
256
+ * text: 'Processing…',
257
+ * color: [255, 0, 0] // Red
258
+ * })
259
+ *
260
+ * // With shimmer effect
261
+ * const spinner = Spinner({
262
+ * text: 'Building…',
263
+ * shimmer: { dir: 'ltr', speed: 0.5 }
264
+ * })
265
+ *
266
+ * // Show progress
267
+ * spinner.progress(5, 10, 'files')
268
+ * spinner.progressStep() // Increment by 1
269
+ * ```
99
270
  */
100
271
  /*@__NO_SIDE_EFFECTS__*/
101
272
  export declare function Spinner(options?: SpinnerOptions | undefined): Spinner;
102
273
  /**
103
274
  * Get the default spinner instance.
104
275
  * Lazily creates the spinner to avoid circular dependencies during module initialization.
276
+ * Reuses the same instance across calls.
277
+ *
278
+ * @returns Shared default spinner instance
279
+ *
280
+ * @example
281
+ * ```ts
282
+ * import { getDefaultSpinner } from '@socketsecurity/registry/lib/spinner'
283
+ *
284
+ * const spinner = getDefaultSpinner()
285
+ * spinner.start('Loading…')
286
+ * ```
105
287
  */
106
288
  export declare function getDefaultSpinner(): ReturnType<typeof Spinner>;
107
289
  /**
290
+ * Default shared spinner instance (lazily initialized).
291
+ *
108
292
  * @deprecated Use `getDefaultSpinner()` function instead for better tree-shaking and to avoid circular dependencies.
293
+ *
294
+ * @example
295
+ * ```ts
296
+ * // Old (deprecated):
297
+ * import { spinner } from '@socketsecurity/registry/lib/spinner'
298
+ * spinner.start('Loading…')
299
+ *
300
+ * // New (recommended):
301
+ * import { getDefaultSpinner } from '@socketsecurity/registry/lib/spinner'
302
+ * const spinner = getDefaultSpinner()
303
+ * spinner.start('Loading…')
304
+ * ```
109
305
  */
110
306
  export declare const spinner: Spinner;
307
+ /**
308
+ * Configuration options for `withSpinner()` helper.
309
+ * @template T - Return type of the async operation
310
+ */
111
311
  export type WithSpinnerOptions<T> = {
312
+ /** Message to display while the spinner is running */
112
313
  message: string;
314
+ /** Async function to execute while spinner is active */
113
315
  operation: () => Promise<T>;
316
+ /**
317
+ * Optional spinner instance to use.
318
+ * If not provided, operation runs without spinner.
319
+ */
114
320
  spinner?: Spinner | undefined;
115
321
  };
116
322
  /**
117
323
  * Execute an async operation with spinner lifecycle management.
118
- * Ensures spinner.stop() is always called via try/finally, even if the operation throws.
324
+ * Ensures `spinner.stop()` is always called via try/finally, even if the operation throws.
325
+ * Provides safe cleanup and consistent spinner behavior.
119
326
  *
327
+ * @template T - Return type of the operation
120
328
  * @param options - Configuration object
121
329
  * @param options.message - Message to display while spinner is running
122
330
  * @param options.operation - Async function to execute
@@ -125,10 +333,13 @@ export type WithSpinnerOptions<T> = {
125
333
  * @throws Re-throws any error from operation after stopping spinner
126
334
  *
127
335
  * @example
128
- * import { spinner, withSpinner } from '@socketsecurity/registry/lib/spinner'
336
+ * ```ts
337
+ * import { Spinner, withSpinner } from '@socketsecurity/registry/lib/spinner'
338
+ *
339
+ * const spinner = Spinner()
129
340
  *
130
341
  * // With spinner instance
131
- * await withSpinner({
342
+ * const result = await withSpinner({
132
343
  * message: 'Processing…',
133
344
  * operation: async () => {
134
345
  * return await processData()
@@ -136,35 +347,46 @@ export type WithSpinnerOptions<T> = {
136
347
  * spinner
137
348
  * })
138
349
  *
139
- * // Without spinner instance (no-op)
140
- * await withSpinner({
350
+ * // Without spinner instance (no-op, just runs operation)
351
+ * const result = await withSpinner({
141
352
  * message: 'Processing…',
142
353
  * operation: async () => {
143
354
  * return await processData()
144
355
  * }
145
356
  * })
357
+ * ```
146
358
  */
147
359
  export declare function withSpinner<T>(options: WithSpinnerOptions<T>): Promise<T>;
360
+ /**
361
+ * Configuration options for `withSpinnerRestore()` helper.
362
+ * @template T - Return type of the async operation
363
+ */
148
364
  export type WithSpinnerRestoreOptions<T> = {
365
+ /** Async function to execute while spinner is stopped */
149
366
  operation: () => Promise<T>;
367
+ /** Optional spinner instance to restore after operation */
150
368
  spinner?: Spinner | undefined;
369
+ /** Whether spinner was spinning before the operation (used to conditionally restart) */
151
370
  wasSpinning: boolean;
152
371
  };
153
372
  /**
154
373
  * Execute an async operation with conditional spinner restart.
155
374
  * Useful when you need to temporarily stop a spinner for an operation,
156
- * then restore it to its previous state.
375
+ * then restore it to its previous state (if it was spinning).
157
376
  *
377
+ * @template T - Return type of the operation
158
378
  * @param options - Configuration object
159
379
  * @param options.operation - Async function to execute
160
380
  * @param options.spinner - Optional spinner instance to manage
161
- * @param options.wasSpinning - Whether spinner was spinning before
381
+ * @param options.wasSpinning - Whether spinner was spinning before the operation
162
382
  * @returns Result of the operation
163
383
  * @throws Re-throws any error from operation after restoring spinner state
164
384
  *
165
385
  * @example
166
- * import { spinner, withSpinnerRestore } from '@socketsecurity/registry/lib/spinner'
386
+ * ```ts
387
+ * import { getDefaultSpinner, withSpinnerRestore } from '@socketsecurity/registry/lib/spinner'
167
388
  *
389
+ * const spinner = getDefaultSpinner()
168
390
  * const wasSpinning = spinner.isSpinning
169
391
  * spinner.stop()
170
392
  *
@@ -176,26 +398,43 @@ export type WithSpinnerRestoreOptions<T> = {
176
398
  * spinner,
177
399
  * wasSpinning
178
400
  * })
401
+ * // Spinner is automatically restarted if wasSpinning was true
402
+ * ```
179
403
  */
180
404
  export declare function withSpinnerRestore<T>(options: WithSpinnerRestoreOptions<T>): Promise<T>;
405
+ /**
406
+ * Configuration options for `withSpinnerSync()` helper.
407
+ * @template T - Return type of the sync operation
408
+ */
181
409
  export type WithSpinnerSyncOptions<T> = {
410
+ /** Message to display while the spinner is running */
182
411
  message: string;
412
+ /** Synchronous function to execute while spinner is active */
183
413
  operation: () => T;
414
+ /**
415
+ * Optional spinner instance to use.
416
+ * If not provided, operation runs without spinner.
417
+ */
184
418
  spinner?: Spinner | undefined;
185
419
  };
186
420
  /**
187
421
  * Execute a synchronous operation with spinner lifecycle management.
188
- * Ensures spinner.stop() is always called via try/finally, even if the operation throws.
422
+ * Ensures `spinner.stop()` is always called via try/finally, even if the operation throws.
423
+ * Provides safe cleanup and consistent spinner behavior for sync operations.
189
424
  *
425
+ * @template T - Return type of the operation
190
426
  * @param options - Configuration object
191
427
  * @param options.message - Message to display while spinner is running
192
- * @param options.operation - Function to execute
428
+ * @param options.operation - Synchronous function to execute
193
429
  * @param options.spinner - Optional spinner instance (if not provided, no spinner is used)
194
430
  * @returns Result of the operation
195
431
  * @throws Re-throws any error from operation after stopping spinner
196
432
  *
197
433
  * @example
198
- * import { spinner, withSpinnerSync} from '@socketsecurity/registry/lib/spinner'
434
+ * ```ts
435
+ * import { Spinner, withSpinnerSync } from '@socketsecurity/registry/lib/spinner'
436
+ *
437
+ * const spinner = Spinner()
199
438
  *
200
439
  * const result = withSpinnerSync({
201
440
  * message: 'Processing…',
@@ -204,5 +443,6 @@ export type WithSpinnerSyncOptions<T> = {
204
443
  * },
205
444
  * spinner
206
445
  * })
446
+ * ```
207
447
  */
208
448
  export declare function withSpinnerSync<T>(options: WithSpinnerSyncOptions<T>): T;