Comparing version 5.1.0 to 5.4.1
@@ -1,2 +0,1 @@ | ||
/// <reference types="node"/> | ||
import {SpinnerName} from 'cli-spinners'; | ||
@@ -35,3 +34,3 @@ | ||
/** | ||
Name of one of the provided spinners. See [`example.js`](https://github.com/BendingBender/ora/blob/master/example.js) in this repo if you want to test out different spinners. On Windows, it will always use the line spinner as the Windows command-line doesn't have proper Unicode support. | ||
Name of one of the provided spinners. See [`example.js`](https://github.com/BendingBender/ora/blob/main/example.js) in this repo if you want to test out different spinners. On Windows, it will always use the line spinner as the Windows command-line doesn't have proper Unicode support. | ||
@@ -38,0 +37,0 @@ @default 'dots' |
44
index.js
@@ -10,7 +10,7 @@ 'use strict'; | ||
const isInteractive = require('is-interactive'); | ||
const MuteStream = require('mute-stream'); | ||
const isUnicodeSupported = require('is-unicode-supported'); | ||
const {BufferListStream} = require('bl'); | ||
const TEXT = Symbol('text'); | ||
const PREFIX_TEXT = Symbol('prefixText'); | ||
const ASCII_ETX_CODE = 0x03; // Ctrl+C emits this code | ||
@@ -22,7 +22,6 @@ | ||
this.mutedStream = new MuteStream(); | ||
this.mutedStream = new BufferListStream(); | ||
this.mutedStream.pipe(process.stdout); | ||
this.mutedStream.mute(); | ||
const self = this; | ||
const self = this; // eslint-disable-line unicorn/no-this-assignment | ||
this.ourEmit = function (event, data, ...args) { | ||
@@ -169,3 +168,3 @@ const {stdin} = process; | ||
this._spinner = spinner; | ||
} else if (process.platform === 'win32') { | ||
} else if (!isUnicodeSupported()) { | ||
this._spinner = cliSpinners.line; | ||
@@ -175,6 +174,6 @@ } else if (spinner === undefined) { | ||
this._spinner = cliSpinners.dots; | ||
} else if (cliSpinners[spinner]) { | ||
} else if (spinner !== 'default' && cliSpinners[spinner]) { | ||
this._spinner = cliSpinners[spinner]; | ||
} else { | ||
throw new Error(`There is no built-in spinner named '${spinner}'. See https://github.com/sindresorhus/cli-spinners/blob/master/spinners.json for a full list.`); | ||
throw new Error(`There is no built-in spinner named '${spinner}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`); | ||
} | ||
@@ -189,2 +188,7 @@ | ||
set text(value) { | ||
this[TEXT] = value; | ||
this.updateLineCount(); | ||
} | ||
get prefixText() { | ||
@@ -194,2 +198,7 @@ return this[PREFIX_TEXT]; | ||
set prefixText(value) { | ||
this[PREFIX_TEXT] = value; | ||
this.updateLineCount(); | ||
} | ||
get isSpinning() { | ||
@@ -214,17 +223,8 @@ return this.id !== undefined; | ||
const fullPrefixText = this.getFullPrefixText(this.prefixText, '-'); | ||
this.lineCount = stripAnsi(fullPrefixText + '--' + this[TEXT]).split('\n').reduce((count, line) => { | ||
return count + Math.max(1, Math.ceil(wcwidth(line) / columns)); | ||
}, 0); | ||
this.lineCount = 0; | ||
for (const line of stripAnsi(fullPrefixText + '--' + this[TEXT]).split('\n')) { | ||
this.lineCount += Math.max(1, Math.ceil(wcwidth(line) / columns)); | ||
} | ||
} | ||
set text(value) { | ||
this[TEXT] = value; | ||
this.updateLineCount(); | ||
} | ||
set prefixText(value) { | ||
this[PREFIX_TEXT] = value; | ||
this.updateLineCount(); | ||
} | ||
get isEnabled() { | ||
@@ -408,3 +408,3 @@ return this._isEnabled && !this.isSilent; | ||
spinner.succeed(); | ||
} catch (_) { | ||
} catch { | ||
spinner.fail(); | ||
@@ -411,0 +411,0 @@ } |
{ | ||
"name": "ora", | ||
"version": "5.1.0", | ||
"version": "5.4.1", | ||
"description": "Elegant terminal spinner", | ||
@@ -40,8 +40,9 @@ "license": "MIT", | ||
"dependencies": { | ||
"bl": "^4.1.0", | ||
"chalk": "^4.1.0", | ||
"cli-cursor": "^3.1.0", | ||
"cli-spinners": "^2.4.0", | ||
"cli-spinners": "^2.5.0", | ||
"is-interactive": "^1.0.0", | ||
"log-symbols": "^4.0.0", | ||
"mute-stream": "0.0.8", | ||
"is-unicode-supported": "^0.1.0", | ||
"log-symbols": "^4.1.0", | ||
"strip-ansi": "^6.0.0", | ||
@@ -51,8 +52,8 @@ "wcwidth": "^1.0.1" | ||
"devDependencies": { | ||
"@types/node": "^14.0.27", | ||
"@types/node": "^14.14.35", | ||
"ava": "^2.4.0", | ||
"get-stream": "^5.1.0", | ||
"tsd": "^0.13.1", | ||
"xo": "^0.25.0" | ||
"get-stream": "^6.0.0", | ||
"tsd": "^0.14.0", | ||
"xo": "^0.38.2" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# ora [![Build Status](https://travis-ci.com/sindresorhus/ora.svg?branch=master)](https://travis-ci.com/github/sindresorhus/ora) | ||
# ora | ||
@@ -58,3 +58,3 @@ > Elegant terminal spinner | ||
Name of one of the [provided spinners](https://github.com/sindresorhus/cli-spinners/blob/master/spinners.json). See `example.js` in this repo if you want to test out different spinners. On Windows, it will always use the `line` spinner as the Windows command-line doesn't have proper Unicode support. | ||
Name of one of the [provided spinners](https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json). See `example.js` in this repo if you want to test out different spinners. On Windows, it will always use the `line` spinner as the Windows command-line doesn't have proper Unicode support. | ||
@@ -265,1 +265,2 @@ Or an object like: | ||
- [spinnies](https://github.com/jcarpanelli/spinnies) - Terminal multi-spinner library for Node.js | ||
- [kia](https://github.com/HarryPeach/kia) - Simple terminal spinners for Deno 🦕 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23247
265
9
+ Addedbl@^4.1.0
+ Addedis-unicode-supported@^0.1.0
+ Addedbase64-js@1.5.1(transitive)
+ Addedbl@4.1.0(transitive)
+ Addedbuffer@5.7.1(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
- Removedmute-stream@0.0.8
- Removedmute-stream@0.0.8(transitive)
Updatedcli-spinners@^2.5.0
Updatedlog-symbols@^4.1.0