@depup/ora 9.3.0-depup.0 → 9.4.1-depup.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/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # @depup/ora
2
+
3
+ > Dependency-bumped version of [ora](https://www.npmjs.com/package/ora)
4
+
5
+ Generated by [DepUp](https://github.com/depup/npm) -- all production
6
+ dependencies bumped to latest versions.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ npm install @depup/ora
12
+ ```
13
+
14
+ | Field | Value |
15
+ |-------|-------|
16
+ | Original | [ora](https://www.npmjs.com/package/ora) @ 9.4.1 |
17
+ | Processed | 2026-07-21 |
18
+ | Smoke test | passed |
19
+ | Deps updated | 2 |
20
+
21
+ ## Dependency Changes
22
+
23
+ | Dependency | From | To |
24
+ |------------|------|-----|
25
+ | cli-spinners | ^3.2.0 | ^3.4.0 |
26
+ | string-width | ^8.1.0 | ^8.2.2 |
27
+
28
+ ---
29
+
30
+ Source: https://github.com/depup/npm | Original: https://www.npmjs.com/package/ora
31
+
32
+ License inherited from the original package.
package/changes.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "bumped": {
3
+ "cli-spinners": {
4
+ "from": "^3.2.0",
5
+ "to": "^3.4.0"
6
+ },
7
+ "string-width": {
8
+ "from": "^8.1.0",
9
+ "to": "^8.2.2"
10
+ }
11
+ },
12
+ "timestamp": "2026-07-21T17:26:55.866Z",
13
+ "totalUpdated": 2
14
+ }
package/index.d.ts CHANGED
@@ -56,9 +56,11 @@ export type Options = {
56
56
  /**
57
57
  The color of the spinner.
58
58
 
59
+ Set to `false` to disable the color.
60
+
59
61
  @default 'cyan'
60
62
  */
61
- readonly color?: Color | boolean;
63
+ readonly color?: Color | false | undefined;
62
64
 
63
65
  /**
64
66
  Set to `false` to stop Ora from hiding the cursor.
@@ -161,7 +163,39 @@ export type PromiseOptions<T> = {
161
163
 
162
164
  Keeps the existing text if `undefined`.
163
165
  */
164
- failText?: string | ((error: Error) => string) | undefined;
166
+ failText?: string | ((error: unknown) => string) | undefined;
167
+
168
+ /**
169
+ The symbol to use when the promise is resolved, instead of the default success symbol.
170
+
171
+ Useful if you want to customize or disable the symbol.
172
+
173
+ Uses the default success symbol if `undefined`.
174
+
175
+ @example
176
+ ```
177
+ import {oraPromise} from 'ora';
178
+
179
+ await oraPromise(somePromise, {successSymbol: '🦄'});
180
+ ```
181
+ */
182
+ successSymbol?: string | undefined;
183
+
184
+ /**
185
+ The symbol to use when the promise is rejected, instead of the default failure symbol.
186
+
187
+ Useful if you want to customize or disable the symbol.
188
+
189
+ Uses the default failure symbol if `undefined`.
190
+
191
+ @example
192
+ ```
193
+ import {oraPromise} from 'ora';
194
+
195
+ await oraPromise(somePromise, {failSymbol: '💥'});
196
+ ```
197
+ */
198
+ failSymbol?: string | undefined;
165
199
  } & Options;
166
200
 
167
201
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
@@ -176,19 +210,21 @@ export interface Ora {
176
210
 
177
211
  No prefix text will be displayed if set to an empty string.
178
212
  */
179
- prefixText: string;
213
+ prefixText: string | PrefixTextGenerator;
180
214
 
181
215
  /**
182
216
  Change the text or function that returns text after the spinner text.
183
217
 
184
218
  No suffix text will be displayed if set to an empty string.
185
219
  */
186
- suffixText: string;
220
+ suffixText: string | SuffixTextGenerator;
187
221
 
188
222
  /**
189
223
  Change the spinner color.
224
+
225
+ Set to `false` to disable the color.
190
226
  */
191
- color: Color | boolean;
227
+ color: Color | false | undefined;
192
228
 
193
229
  /**
194
230
  Change the spinner indent.
@@ -210,6 +246,16 @@ export interface Ora {
210
246
  */
211
247
  get isSpinning(): boolean;
212
248
 
249
+ /**
250
+ A boolean indicating whether the spinner and log text are enabled.
251
+ */
252
+ isEnabled: boolean;
253
+
254
+ /**
255
+ A boolean indicating whether all output is suppressed.
256
+ */
257
+ isSilent: boolean;
258
+
213
259
  /**
214
260
  The interval between each frame.
215
261
 
@@ -288,7 +334,7 @@ export interface Ora {
288
334
  /**
289
335
  Get a new frame.
290
336
 
291
- @returns The spinner instance text.
337
+ @returns The rendered frame text.
292
338
  */
293
339
  frame(): string;
294
340
  }
package/index.js CHANGED
@@ -17,6 +17,8 @@ const SYNCHRONIZED_OUTPUT_DISABLE = '\u001B[?2026l';
17
17
  // Global state for concurrent spinner detection
18
18
  const activeHooksPerStream = new Map(); // Stream → ora instance
19
19
 
20
+ const validColors = new Set(['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'gray']);
21
+
20
22
  class Ora {
21
23
  #linesToClear = 0;
22
24
  #frameIndex = -1;
@@ -30,7 +32,7 @@ class Ora {
30
32
  #drainHandler;
31
33
  #deferRenderTimer;
32
34
  #isDiscardingStdin = false;
33
- color;
35
+ #color;
34
36
 
35
37
  // Helper to execute writes while preventing hook recursion
36
38
  #internalWrite(fn) {
@@ -141,6 +143,10 @@ class Ora {
141
143
  this.#options.isSilent = false;
142
144
  }
143
145
 
146
+ if (this.#options.interval !== undefined && !(Number.isInteger(this.#options.interval) && this.#options.interval > 0)) {
147
+ throw new Error('The `interval` option must be a positive integer');
148
+ }
149
+
144
150
  // Set *after* `this.#stream`.
145
151
  // Store original interval before spinner setter clears it
146
152
  const userInterval = this.#options.interval;
@@ -286,6 +292,18 @@ class Ora {
286
292
  return count;
287
293
  }
288
294
 
295
+ get color() {
296
+ return this.#color;
297
+ }
298
+
299
+ set color(value) {
300
+ if (value !== undefined && value !== false && !validColors.has(value)) {
301
+ throw new Error('The `color` option must be a valid color or `false` to disable');
302
+ }
303
+
304
+ this.#color = value;
305
+ }
306
+
289
307
  get isEnabled() {
290
308
  return this.#options.isEnabled && !this.#options.isSilent;
291
309
  }
@@ -321,8 +339,8 @@ class Ora {
321
339
  const {frames} = this.#spinner;
322
340
  let frame = frames[this.#frameIndex];
323
341
 
324
- if (this.color) {
325
- frame = chalk[this.color](frame);
342
+ if (this.#color) {
343
+ frame = chalk[this.#color](frame);
326
344
  }
327
345
 
328
346
  const fullPrefixText = this.#getFullPrefixText(this.#options.prefixText, ' ');
@@ -490,7 +508,7 @@ class Ora {
490
508
  }
491
509
 
492
510
  start(text) {
493
- if (text) {
511
+ if (text !== undefined) {
494
512
  this.text = text;
495
513
  }
496
514
 
@@ -600,15 +618,20 @@ export default function ora(options) {
600
618
 
601
619
  export async function oraPromise(action, options) {
602
620
  const actionIsFunction = typeof action === 'function';
603
- const actionIsPromise = typeof action.then === 'function';
621
+ const actionIsPromise = typeof action?.then === 'function';
604
622
 
605
623
  if (!actionIsFunction && !actionIsPromise) {
606
624
  throw new TypeError('Parameter `action` must be a Function or a Promise');
607
625
  }
608
626
 
609
- const {successText, failText} = typeof options === 'object'
627
+ const {
628
+ successText,
629
+ failText,
630
+ successSymbol,
631
+ failSymbol,
632
+ } = (typeof options === 'object' && options !== null)
610
633
  ? options
611
- : {successText: undefined, failText: undefined};
634
+ : {};
612
635
 
613
636
  const spinner = ora(options).start();
614
637
 
@@ -616,15 +639,27 @@ export async function oraPromise(action, options) {
616
639
  const promise = actionIsFunction ? action(spinner) : action;
617
640
  const result = await promise;
618
641
 
619
- spinner.succeed(successText === undefined
642
+ const text = successText === undefined
620
643
  ? undefined
621
- : (typeof successText === 'string' ? successText : successText(result)));
644
+ : (typeof successText === 'string' ? successText : successText(result));
645
+
646
+ if (successSymbol === undefined) {
647
+ spinner.succeed(text);
648
+ } else {
649
+ spinner.stopAndPersist({symbol: successSymbol, text});
650
+ }
622
651
 
623
652
  return result;
624
653
  } catch (error) {
625
- spinner.fail(failText === undefined
654
+ const text = failText === undefined
626
655
  ? undefined
627
- : (typeof failText === 'string' ? failText : failText(error)));
656
+ : (typeof failText === 'string' ? failText : failText(error));
657
+
658
+ if (failSymbol === undefined) {
659
+ spinner.fail(text);
660
+ } else {
661
+ spinner.stopAndPersist({symbol: failSymbol, text});
662
+ }
628
663
 
629
664
  throw error;
630
665
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@depup/ora",
3
- "version": "9.3.0-depup.0",
4
- "description": "Elegant terminal spinner",
3
+ "version": "9.4.1-depup.0",
4
+ "description": "Elegant terminal spinner (with updated dependencies)",
5
5
  "license": "MIT",
6
6
  "repository": "sindresorhus/ora",
7
7
  "funding": "https://github.com/sponsors/sindresorhus",
@@ -24,9 +24,17 @@
24
24
  },
25
25
  "files": [
26
26
  "index.js",
27
- "index.d.ts"
27
+ "index.d.ts",
28
+ "changes.json",
29
+ "README.md"
28
30
  ],
29
31
  "keywords": [
32
+ "ora",
33
+ "depup",
34
+ "updated-dependencies",
35
+ "security",
36
+ "latest",
37
+ "patched",
30
38
  "cli",
31
39
  "spinner",
32
40
  "spinners",
@@ -49,15 +57,31 @@
49
57
  "is-interactive": "^2.0.0",
50
58
  "is-unicode-supported": "^2.1.0",
51
59
  "log-symbols": "^7.0.1",
52
- "stdin-discarder": "^0.3.1",
53
- "string-width": "^8.2.0"
60
+ "stdin-discarder": "^0.3.2",
61
+ "string-width": "^8.2.2"
54
62
  },
55
63
  "devDependencies": {
56
64
  "@types/node": "^24.5.0",
57
65
  "ava": "^6.4.1",
58
66
  "get-stream": "^9.0.1",
59
- "transform-tty": "^1.0.11",
60
67
  "tsd": "^0.33.0",
61
68
  "xo": "^1.2.2"
69
+ },
70
+ "depup": {
71
+ "changes": {
72
+ "cli-spinners": {
73
+ "from": "^3.2.0",
74
+ "to": "^3.4.0"
75
+ },
76
+ "string-width": {
77
+ "from": "^8.1.0",
78
+ "to": "^8.2.2"
79
+ }
80
+ },
81
+ "depsUpdated": 2,
82
+ "originalPackage": "ora",
83
+ "originalVersion": "9.4.1",
84
+ "processedAt": "2026-07-21T17:27:07.551Z",
85
+ "smokeTest": "passed"
62
86
  }
63
87
  }
package/readme.md CHANGED
@@ -76,9 +76,9 @@ Or an object like:
76
76
 
77
77
  ##### color
78
78
 
79
- Type: `string | boolean`\
79
+ Type: `string | false`\
80
80
  Default: `'cyan'`\
81
- Values: `'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray' | boolean`
81
+ Values: `'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray' | false`
82
82
 
83
83
  The color of the spinner. Set to `false` to disable coloring.
84
84
 
@@ -174,6 +174,14 @@ Change the spinner indent.
174
174
 
175
175
  A boolean indicating whether the instance is currently spinning.
176
176
 
177
+ #### .isEnabled <sup>get/set</sup>
178
+
179
+ A boolean indicating whether the spinner and log text are enabled.
180
+
181
+ #### .isSilent <sup>get/set</sup>
182
+
183
+ A boolean indicating whether all output is suppressed.
184
+
177
185
  #### .interval <sup>get</sup>
178
186
 
179
187
  The interval between each frame.
@@ -267,7 +275,7 @@ await oraPromise(somePromise);
267
275
 
268
276
  #### action
269
277
 
270
- Type: `Promise | ((spinner: ora.Ora) => Promise)`
278
+ Type: `Promise | ((spinner: Ora) => Promise)`
271
279
 
272
280
  #### options
273
281
 
@@ -285,12 +293,32 @@ Keeps the existing text if `undefined`.
285
293
 
286
294
  ##### failText
287
295
 
288
- Type: `string | ((error: Error) => string) | undefined`
296
+ Type: `string | ((error: unknown) => string) | undefined`
289
297
 
290
298
  The new text of the spinner when the promise is rejected.
291
299
 
292
300
  Keeps the existing text if `undefined`.
293
301
 
302
+ ##### successSymbol
303
+
304
+ Type: `string | undefined`
305
+
306
+ The symbol to use when the promise is resolved, instead of the default success symbol.
307
+
308
+ Useful if you want to customize or disable the symbol.
309
+
310
+ Uses the default success symbol if `undefined`.
311
+
312
+ ##### failSymbol
313
+
314
+ Type: `string | undefined`
315
+
316
+ The symbol to use when the promise is rejected, instead of the default failure symbol.
317
+
318
+ Useful if you want to customize or disable the symbol.
319
+
320
+ Uses the default failure symbol if `undefined`.
321
+
294
322
  ### spinners
295
323
 
296
324
  Type: `Record<string, Spinner>`