diff options
Diffstat (limited to 'node_modules/ora')
-rw-r--r-- | node_modules/ora/index.d.ts | 294 | ||||
-rw-r--r-- | node_modules/ora/index.js | 430 | ||||
-rw-r--r-- | node_modules/ora/license | 9 | ||||
-rw-r--r-- | node_modules/ora/node_modules/chalk/index.d.ts | 415 | ||||
-rw-r--r-- | node_modules/ora/node_modules/chalk/license | 9 | ||||
-rw-r--r-- | node_modules/ora/node_modules/chalk/package.json | 68 | ||||
-rw-r--r-- | node_modules/ora/node_modules/chalk/readme.md | 341 | ||||
-rw-r--r-- | node_modules/ora/node_modules/chalk/source/index.js | 229 | ||||
-rw-r--r-- | node_modules/ora/node_modules/chalk/source/templates.js | 134 | ||||
-rw-r--r-- | node_modules/ora/node_modules/chalk/source/util.js | 39 | ||||
-rw-r--r-- | node_modules/ora/package.json | 60 | ||||
-rw-r--r-- | node_modules/ora/readme.md | 292 |
12 files changed, 0 insertions, 2320 deletions
diff --git a/node_modules/ora/index.d.ts b/node_modules/ora/index.d.ts deleted file mode 100644 index b35bba4..0000000 --- a/node_modules/ora/index.d.ts +++ /dev/null @@ -1,294 +0,0 @@ -import {SpinnerName} from 'cli-spinners'; - -export interface Spinner { - readonly interval?: number; - readonly frames: string[]; -} - -export type Color = - | 'black' - | 'red' - | 'green' - | 'yellow' - | 'blue' - | 'magenta' - | 'cyan' - | 'white' - | 'gray'; - -export type PrefixTextGenerator = () => string; - -export interface Options { - /** - Text to display after the spinner. - */ - readonly text?: string; - - /** - Text or a function that returns text to display before the spinner. No prefix text will be displayed if set to an empty string. - */ - readonly prefixText?: string | PrefixTextGenerator; - - /** - 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. - - @default 'dots' - - Or an object like: - - @example - ``` - { - interval: 80, // Optional - frames: ['-', '+', '-'] - } - ``` - */ - readonly spinner?: SpinnerName | Spinner; - - /** - Color of the spinner. - - @default 'cyan' - */ - readonly color?: Color; - - /** - Set to `false` to stop Ora from hiding the cursor. - - @default true - */ - readonly hideCursor?: boolean; - - /** - Indent the spinner with the given number of spaces. - - @default 0 - */ - readonly indent?: number; - - /** - Interval between each frame. - - Spinners provide their own recommended interval, so you don't really need to specify this. - - Default: Provided by the spinner or `100`. - */ - readonly interval?: number; - - /** - Stream to write the output. - - You could for example set this to `process.stdout` instead. - - @default process.stderr - */ - readonly stream?: NodeJS.WritableStream; - - /** - Force enable/disable the spinner. If not specified, the spinner will be enabled if the `stream` is being run inside a TTY context (not spawned or piped) and/or not in a CI environment. - - Note that `{isEnabled: false}` doesn't mean it won't output anything. It just means it won't output the spinner, colors, and other ansi escape codes. It will still log text. - */ - readonly isEnabled?: boolean; - - /** - Disable the spinner and all log text. All output is suppressed and `isEnabled` will be considered `false`. - - @default false - */ - readonly isSilent?: boolean; - - /** - Discard stdin input (except Ctrl+C) while running if it's TTY. This prevents the spinner from twitching on input, outputting broken lines on `Enter` key presses, and prevents buffering of input while the spinner is running. - - This has no effect on Windows as there's no good way to implement discarding stdin properly there. - - @default true - */ - readonly discardStdin?: boolean; -} - -export interface PersistOptions { - /** - Symbol to replace the spinner with. - - @default ' ' - */ - readonly symbol?: string; - - /** - Text to be persisted after the symbol. - - Default: Current `text`. - */ - readonly text?: string; - - /** - Text or a function that returns text to be persisted before the symbol. No prefix text will be displayed if set to an empty string. - - Default: Current `prefixText`. - */ - readonly prefixText?: string | PrefixTextGenerator; -} - -export interface PromiseOptions<T> extends Options { - /** - The new text of the spinner when the promise is resolved. - - Keeps the existing text if `undefined`. - */ - successText?: string | ((result: T) => string) | undefined; - - /** - The new text of the spinner when the promise is rejected. - - Keeps the existing text if `undefined`. - */ - failText?: string | ((error: Error) => string) | undefined; -} - -export interface Ora { - /** - A boolean of whether the instance is currently spinning. - */ - readonly isSpinning: boolean; - - /** - Change the text after the spinner. - */ - text: string; - - /** - Change the text or function that returns text before the spinner. No prefix text will be displayed if set to an empty string. - */ - prefixText: string | PrefixTextGenerator; - - /** - Change the spinner color. - */ - color: Color; - - /** - Change the spinner. - */ - spinner: SpinnerName | Spinner; - - /** - Change the spinner indent. - */ - indent: number; - - /** - Start the spinner. - - @param text - Set the current text. - @returns The spinner instance. - */ - start(text?: string): Ora; - - /** - Stop and clear the spinner. - - @returns The spinner instance. - */ - stop(): Ora; - - /** - Stop the spinner, change it to a green `✔` and persist the current text, or `text` if provided. - - @param text - Will persist text if provided. - @returns The spinner instance. - */ - succeed(text?: string): Ora; - - /** - Stop the spinner, change it to a red `✖` and persist the current text, or `text` if provided. - - @param text - Will persist text if provided. - @returns The spinner instance. - */ - fail(text?: string): Ora; - - /** - Stop the spinner, change it to a yellow `⚠` and persist the current text, or `text` if provided. - - @param text - Will persist text if provided. - @returns The spinner instance. - */ - warn(text?: string): Ora; - - /** - Stop the spinner, change it to a blue `ℹ` and persist the current text, or `text` if provided. - - @param text - Will persist text if provided. - @returns The spinner instance. - */ - info(text?: string): Ora; - - /** - Stop the spinner and change the symbol or text. - - @returns The spinner instance. - */ - stopAndPersist(options?: PersistOptions): Ora; - - /** - Clear the spinner. - - @returns The spinner instance. - */ - clear(): Ora; - - /** - Manually render a new frame. - - @returns The spinner instance. - */ - render(): Ora; - - /** - Get a new frame. - - @returns The spinner instance text. - */ - frame(): string; -} - -/** -Elegant terminal spinner. - -@param options - If a string is provided, it is treated as a shortcut for `options.text`. - -@example -``` -import ora from 'ora'; - -const spinner = ora('Loading unicorns').start(); - -setTimeout(() => { - spinner.color = 'yellow'; - spinner.text = 'Loading rainbows'; -}, 1000); -``` -*/ -export default function ora(options?: string | Options): Ora; - -/** -Starts a spinner for a promise or promise-returning function. The spinner is stopped with `.succeed()` if the promise fulfills or with `.fail()` if it rejects. - -@param action - The promise to start the spinner for or a promise-returning function. -@param options - If a string is provided, it is treated as a shortcut for `options.text`. -@returns The given promise. - -@example -``` -import {oraPromise} from 'ora'; - -await oraPromise(somePromise); -``` -*/ -export function oraPromise<T>( - action: PromiseLike<T> | ((spinner: Ora) => PromiseLike<T>), - options?: string | PromiseOptions<T> -): Promise<T>; diff --git a/node_modules/ora/index.js b/node_modules/ora/index.js deleted file mode 100644 index cd99162..0000000 --- a/node_modules/ora/index.js +++ /dev/null @@ -1,430 +0,0 @@ -import process from 'node:process'; -import readline from 'node:readline'; -import chalk from 'chalk'; -import cliCursor from 'cli-cursor'; -import cliSpinners from 'cli-spinners'; -import logSymbols from 'log-symbols'; -import stripAnsi from 'strip-ansi'; -import wcwidth from 'wcwidth'; -import isInteractive from 'is-interactive'; -import isUnicodeSupported from 'is-unicode-supported'; -import {BufferListStream} from 'bl'; - -const TEXT = Symbol('text'); -const PREFIX_TEXT = Symbol('prefixText'); -const ASCII_ETX_CODE = 0x03; // Ctrl+C emits this code - -// TODO: Use class fields when ESLint 8 is out. - -class StdinDiscarder { - constructor() { - this.requests = 0; - - this.mutedStream = new BufferListStream(); - this.mutedStream.pipe(process.stdout); - - const self = this; // eslint-disable-line unicorn/no-this-assignment - this.ourEmit = function (event, data, ...args) { - const {stdin} = process; - if (self.requests > 0 || stdin.emit === self.ourEmit) { - if (event === 'keypress') { // Fixes readline behavior - return; - } - - if (event === 'data' && data.includes(ASCII_ETX_CODE)) { - process.emit('SIGINT'); - } - - Reflect.apply(self.oldEmit, this, [event, data, ...args]); - } else { - Reflect.apply(process.stdin.emit, this, [event, data, ...args]); - } - }; - } - - start() { - this.requests++; - - if (this.requests === 1) { - this.realStart(); - } - } - - stop() { - if (this.requests <= 0) { - throw new Error('`stop` called more times than `start`'); - } - - this.requests--; - - if (this.requests === 0) { - this.realStop(); - } - } - - realStart() { - // No known way to make it work reliably on Windows - if (process.platform === 'win32') { - return; - } - - this.rl = readline.createInterface({ - input: process.stdin, - output: this.mutedStream, - }); - - this.rl.on('SIGINT', () => { - if (process.listenerCount('SIGINT') === 0) { - process.emit('SIGINT'); - } else { - this.rl.close(); - process.kill(process.pid, 'SIGINT'); - } - }); - } - - realStop() { - if (process.platform === 'win32') { - return; - } - - this.rl.close(); - this.rl = undefined; - } -} - -let stdinDiscarder; - -class Ora { - constructor(options) { - if (!stdinDiscarder) { - stdinDiscarder = new StdinDiscarder(); - } - - if (typeof options === 'string') { - options = { - text: options, - }; - } - - this.options = { - text: '', - color: 'cyan', - stream: process.stderr, - discardStdin: true, - ...options, - }; - - this.spinner = this.options.spinner; - - this.color = this.options.color; - this.hideCursor = this.options.hideCursor !== false; - this.interval = this.options.interval || this.spinner.interval || 100; - this.stream = this.options.stream; - this.id = undefined; - this.isEnabled = typeof this.options.isEnabled === 'boolean' ? this.options.isEnabled : isInteractive({stream: this.stream}); - this.isSilent = typeof this.options.isSilent === 'boolean' ? this.options.isSilent : false; - - // Set *after* `this.stream` - this.text = this.options.text; - this.prefixText = this.options.prefixText; - this.linesToClear = 0; - this.indent = this.options.indent; - this.discardStdin = this.options.discardStdin; - this.isDiscardingStdin = false; - } - - get indent() { - return this._indent; - } - - set indent(indent = 0) { - if (!(indent >= 0 && Number.isInteger(indent))) { - throw new Error('The `indent` option must be an integer from 0 and up'); - } - - this._indent = indent; - this.updateLineCount(); - } - - _updateInterval(interval) { - if (interval !== undefined) { - this.interval = interval; - } - } - - get spinner() { - return this._spinner; - } - - set spinner(spinner) { - this.frameIndex = 0; - - if (typeof spinner === 'object') { - if (spinner.frames === undefined) { - throw new Error('The given spinner must have a `frames` property'); - } - - this._spinner = spinner; - } else if (!isUnicodeSupported()) { - this._spinner = cliSpinners.line; - } else if (spinner === undefined) { - // Set default spinner - this._spinner = cliSpinners.dots; - } 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/main/spinners.json for a full list.`); - } - - this._updateInterval(this._spinner.interval); - } - - get text() { - return this[TEXT]; - } - - set text(value) { - this[TEXT] = value; - this.updateLineCount(); - } - - get prefixText() { - return this[PREFIX_TEXT]; - } - - set prefixText(value) { - this[PREFIX_TEXT] = value; - this.updateLineCount(); - } - - get isSpinning() { - return this.id !== undefined; - } - - getFullPrefixText(prefixText = this[PREFIX_TEXT], postfix = ' ') { - if (typeof prefixText === 'string') { - return prefixText + postfix; - } - - if (typeof prefixText === 'function') { - return prefixText() + postfix; - } - - return ''; - } - - updateLineCount() { - const columns = this.stream.columns || 80; - const fullPrefixText = this.getFullPrefixText(this.prefixText, '-'); - this.lineCount = 0; - for (const line of stripAnsi(' '.repeat(this.indent) + fullPrefixText + '--' + this[TEXT]).split('\n')) { - this.lineCount += Math.max(1, Math.ceil(wcwidth(line) / columns)); - } - } - - get isEnabled() { - return this._isEnabled && !this.isSilent; - } - - set isEnabled(value) { - if (typeof value !== 'boolean') { - throw new TypeError('The `isEnabled` option must be a boolean'); - } - - this._isEnabled = value; - } - - get isSilent() { - return this._isSilent; - } - - set isSilent(value) { - if (typeof value !== 'boolean') { - throw new TypeError('The `isSilent` option must be a boolean'); - } - - this._isSilent = value; - } - - frame() { - const {frames} = this.spinner; - let frame = frames[this.frameIndex]; - - if (this.color) { - frame = chalk[this.color](frame); - } - - this.frameIndex = ++this.frameIndex % frames.length; - const fullPrefixText = (typeof this.prefixText === 'string' && this.prefixText !== '') ? this.prefixText + ' ' : ''; - const fullText = typeof this.text === 'string' ? ' ' + this.text : ''; - - return fullPrefixText + frame + fullText; - } - - clear() { - if (!this.isEnabled || !this.stream.isTTY) { - return this; - } - - this.stream.cursorTo(0); - - for (let index = 0; index < this.linesToClear; index++) { - if (index > 0) { - this.stream.moveCursor(0, -1); - } - - this.stream.clearLine(1); - } - - if (this.indent || this.lastIndent !== this.indent) { - this.stream.cursorTo(this.indent); - } - - this.lastIndent = this.indent; - this.linesToClear = 0; - - return this; - } - - render() { - if (this.isSilent) { - return this; - } - - this.clear(); - this.stream.write(this.frame()); - this.linesToClear = this.lineCount; - - return this; - } - - start(text) { - if (text) { - this.text = text; - } - - if (this.isSilent) { - return this; - } - - if (!this.isEnabled) { - if (this.text) { - this.stream.write(`- ${this.text}\n`); - } - - return this; - } - - if (this.isSpinning) { - return this; - } - - if (this.hideCursor) { - cliCursor.hide(this.stream); - } - - if (this.discardStdin && process.stdin.isTTY) { - this.isDiscardingStdin = true; - stdinDiscarder.start(); - } - - this.render(); - this.id = setInterval(this.render.bind(this), this.interval); - - return this; - } - - stop() { - if (!this.isEnabled) { - return this; - } - - clearInterval(this.id); - this.id = undefined; - this.frameIndex = 0; - this.clear(); - if (this.hideCursor) { - cliCursor.show(this.stream); - } - - if (this.discardStdin && process.stdin.isTTY && this.isDiscardingStdin) { - stdinDiscarder.stop(); - this.isDiscardingStdin = false; - } - - return this; - } - - succeed(text) { - return this.stopAndPersist({symbol: logSymbols.success, text}); - } - - fail(text) { - return this.stopAndPersist({symbol: logSymbols.error, text}); - } - - warn(text) { - return this.stopAndPersist({symbol: logSymbols.warning, text}); - } - - info(text) { - return this.stopAndPersist({symbol: logSymbols.info, text}); - } - - stopAndPersist(options = {}) { - if (this.isSilent) { - return this; - } - - const prefixText = options.prefixText || this.prefixText; - const text = options.text || this.text; - const fullText = (typeof text === 'string') ? ' ' + text : ''; - - this.stop(); - this.stream.write(`${this.getFullPrefixText(prefixText, ' ')}${options.symbol || ' '}${fullText}\n`); - - return this; - } -} - -export default function ora(options) { - return new Ora(options); -} - -export async function oraPromise(action, options) { - const actionIsFunction = typeof action === 'function'; - // eslint-disable-next-line promise/prefer-await-to-then - const actionIsPromise = typeof action.then === 'function'; - - if (!actionIsFunction && !actionIsPromise) { - throw new TypeError('Parameter `action` must be a Function or a Promise'); - } - - const {successText, failText} = typeof options === 'object' - ? options - : {successText: undefined, failText: undefined}; - - const spinner = ora(options).start(); - - try { - const promise = actionIsFunction ? action(spinner) : action; - const result = await promise; - - spinner.succeed( - successText === undefined - ? undefined - : (typeof successText === 'string' ? successText : successText(result)), - ); - - return result; - } catch (error) { - spinner.fail( - failText === undefined - ? undefined - : (typeof failText === 'string' ? failText : failText(error)), - ); - - throw error; - } -} diff --git a/node_modules/ora/license b/node_modules/ora/license deleted file mode 100644 index fa7ceba..0000000 --- a/node_modules/ora/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/ora/node_modules/chalk/index.d.ts b/node_modules/ora/node_modules/chalk/index.d.ts deleted file mode 100644 index 9cd88f3..0000000 --- a/node_modules/ora/node_modules/chalk/index.d.ts +++ /dev/null @@ -1,415 +0,0 @@ -/** -Basic foreground colors. - -[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support) -*/ -declare type ForegroundColor = - | 'black' - | 'red' - | 'green' - | 'yellow' - | 'blue' - | 'magenta' - | 'cyan' - | 'white' - | 'gray' - | 'grey' - | 'blackBright' - | 'redBright' - | 'greenBright' - | 'yellowBright' - | 'blueBright' - | 'magentaBright' - | 'cyanBright' - | 'whiteBright'; - -/** -Basic background colors. - -[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support) -*/ -declare type BackgroundColor = - | 'bgBlack' - | 'bgRed' - | 'bgGreen' - | 'bgYellow' - | 'bgBlue' - | 'bgMagenta' - | 'bgCyan' - | 'bgWhite' - | 'bgGray' - | 'bgGrey' - | 'bgBlackBright' - | 'bgRedBright' - | 'bgGreenBright' - | 'bgYellowBright' - | 'bgBlueBright' - | 'bgMagentaBright' - | 'bgCyanBright' - | 'bgWhiteBright'; - -/** -Basic colors. - -[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support) -*/ -declare type Color = ForegroundColor | BackgroundColor; - -declare type Modifiers = - | 'reset' - | 'bold' - | 'dim' - | 'italic' - | 'underline' - | 'inverse' - | 'hidden' - | 'strikethrough' - | 'visible'; - -declare namespace chalk { - /** - Levels: - - `0` - All colors disabled. - - `1` - Basic 16 colors support. - - `2` - ANSI 256 colors support. - - `3` - Truecolor 16 million colors support. - */ - type Level = 0 | 1 | 2 | 3; - - interface Options { - /** - Specify the color support for Chalk. - - By default, color support is automatically detected based on the environment. - - Levels: - - `0` - All colors disabled. - - `1` - Basic 16 colors support. - - `2` - ANSI 256 colors support. - - `3` - Truecolor 16 million colors support. - */ - level?: Level; - } - - /** - Return a new Chalk instance. - */ - type Instance = new (options?: Options) => Chalk; - - /** - Detect whether the terminal supports color. - */ - interface ColorSupport { - /** - The color level used by Chalk. - */ - level: Level; - - /** - Return whether Chalk supports basic 16 colors. - */ - hasBasic: boolean; - - /** - Return whether Chalk supports ANSI 256 colors. - */ - has256: boolean; - - /** - Return whether Chalk supports Truecolor 16 million colors. - */ - has16m: boolean; - } - - interface ChalkFunction { - /** - Use a template string. - - @remarks Template literals are unsupported for nested calls (see [issue #341](https://github.com/chalk/chalk/issues/341)) - - @example - ``` - import chalk = require('chalk'); - - log(chalk` - CPU: {red ${cpu.totalPercent}%} - RAM: {green ${ram.used / ram.total * 100}%} - DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%} - `); - ``` - - @example - ``` - import chalk = require('chalk'); - - log(chalk.red.bgBlack`2 + 3 = {bold ${2 + 3}}`) - ``` - */ - (text: TemplateStringsArray, ...placeholders: unknown[]): string; - - (...text: unknown[]): string; - } - - interface Chalk extends ChalkFunction { - /** - Return a new Chalk instance. - */ - Instance: Instance; - - /** - The color support for Chalk. - - By default, color support is automatically detected based on the environment. - - Levels: - - `0` - All colors disabled. - - `1` - Basic 16 colors support. - - `2` - ANSI 256 colors support. - - `3` - Truecolor 16 million colors support. - */ - level: Level; - - /** - Use HEX value to set text color. - - @param color - Hexadecimal value representing the desired color. - - @example - ``` - import chalk = require('chalk'); - - chalk.hex('#DEADED'); - ``` - */ - hex(color: string): Chalk; - - /** - Use keyword color value to set text color. - - @param color - Keyword value representing the desired color. - - @example - ``` - import chalk = require('chalk'); - - chalk.keyword('orange'); - ``` - */ - keyword(color: string): Chalk; - - /** - Use RGB values to set text color. - */ - rgb(red: number, green: number, blue: number): Chalk; - - /** - Use HSL values to set text color. - */ - hsl(hue: number, saturation: number, lightness: number): Chalk; - - /** - Use HSV values to set text color. - */ - hsv(hue: number, saturation: number, value: number): Chalk; - - /** - Use HWB values to set text color. - */ - hwb(hue: number, whiteness: number, blackness: number): Chalk; - - /** - Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set text color. - - 30 <= code && code < 38 || 90 <= code && code < 98 - For example, 31 for red, 91 for redBright. - */ - ansi(code: number): Chalk; - - /** - Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color. - */ - ansi256(index: number): Chalk; - - /** - Use HEX value to set background color. - - @param color - Hexadecimal value representing the desired color. - - @example - ``` - import chalk = require('chalk'); - - chalk.bgHex('#DEADED'); - ``` - */ - bgHex(color: string): Chalk; - - /** - Use keyword color value to set background color. - - @param color - Keyword value representing the desired color. - - @example - ``` - import chalk = require('chalk'); - - chalk.bgKeyword('orange'); - ``` - */ - bgKeyword(color: string): Chalk; - - /** - Use RGB values to set background color. - */ - bgRgb(red: number, green: number, blue: number): Chalk; - - /** - Use HSL values to set background color. - */ - bgHsl(hue: number, saturation: number, lightness: number): Chalk; - - /** - Use HSV values to set background color. - */ - bgHsv(hue: number, saturation: number, value: number): Chalk; - - /** - Use HWB values to set background color. - */ - bgHwb(hue: number, whiteness: number, blackness: number): Chalk; - - /** - Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set background color. - - 30 <= code && code < 38 || 90 <= code && code < 98 - For example, 31 for red, 91 for redBright. - Use the foreground code, not the background code (for example, not 41, nor 101). - */ - bgAnsi(code: number): Chalk; - - /** - Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set background color. - */ - bgAnsi256(index: number): Chalk; - - /** - Modifier: Resets the current color chain. - */ - readonly reset: Chalk; - - /** - Modifier: Make text bold. - */ - readonly bold: Chalk; - - /** - Modifier: Emitting only a small amount of light. - */ - readonly dim: Chalk; - - /** - Modifier: Make text italic. (Not widely supported) - */ - readonly italic: Chalk; - - /** - Modifier: Make text underline. (Not widely supported) - */ - readonly underline: Chalk; - - /** - Modifier: Inverse background and foreground colors. - */ - readonly inverse: Chalk; - - /** - Modifier: Prints the text, but makes it invisible. - */ - readonly hidden: Chalk; - - /** - Modifier: Puts a horizontal line through the center of the text. (Not widely supported) - */ - readonly strikethrough: Chalk; - - /** - Modifier: Prints the text only when Chalk has a color support level > 0. - Can be useful for things that are purely cosmetic. - */ - readonly visible: Chalk; - - readonly black: Chalk; - readonly red: Chalk; - readonly green: Chalk; - readonly yellow: Chalk; - readonly blue: Chalk; - readonly magenta: Chalk; - readonly cyan: Chalk; - readonly white: Chalk; - - /* - Alias for `blackBright`. - */ - readonly gray: Chalk; - - /* - Alias for `blackBright`. - */ - readonly grey: Chalk; - - readonly blackBright: Chalk; - readonly redBright: Chalk; - readonly greenBright: Chalk; - readonly yellowBright: Chalk; - readonly blueBright: Chalk; - readonly magentaBright: Chalk; - readonly cyanBright: Chalk; - readonly whiteBright: Chalk; - - readonly bgBlack: Chalk; - readonly bgRed: Chalk; - readonly bgGreen: Chalk; - readonly bgYellow: Chalk; - readonly bgBlue: Chalk; - readonly bgMagenta: Chalk; - readonly bgCyan: Chalk; - readonly bgWhite: Chalk; - - /* - Alias for `bgBlackBright`. - */ - readonly bgGray: Chalk; - - /* - Alias for `bgBlackBright`. - */ - readonly bgGrey: Chalk; - - readonly bgBlackBright: Chalk; - readonly bgRedBright: Chalk; - readonly bgGreenBright: Chalk; - readonly bgYellowBright: Chalk; - readonly bgBlueBright: Chalk; - readonly bgMagentaBright: Chalk; - readonly bgCyanBright: Chalk; - readonly bgWhiteBright: Chalk; - } -} - -/** -Main Chalk object that allows to chain styles together. -Call the last one as a method with a string argument. -Order doesn't matter, and later styles take precedent in case of a conflict. -This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`. -*/ -declare const chalk: chalk.Chalk & chalk.ChalkFunction & { - supportsColor: chalk.ColorSupport | false; - Level: chalk.Level; - Color: Color; - ForegroundColor: ForegroundColor; - BackgroundColor: BackgroundColor; - Modifiers: Modifiers; - stderr: chalk.Chalk & {supportsColor: chalk.ColorSupport | false}; -}; - -export = chalk; diff --git a/node_modules/ora/node_modules/chalk/license b/node_modules/ora/node_modules/chalk/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/ora/node_modules/chalk/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/ora/node_modules/chalk/package.json b/node_modules/ora/node_modules/chalk/package.json deleted file mode 100644 index 47c23f2..0000000 --- a/node_modules/ora/node_modules/chalk/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "chalk", - "version": "4.1.2", - "description": "Terminal string styling done right", - "license": "MIT", - "repository": "chalk/chalk", - "funding": "https://github.com/chalk/chalk?sponsor=1", - "main": "source", - "engines": { - "node": ">=10" - }, - "scripts": { - "test": "xo && nyc ava && tsd", - "bench": "matcha benchmark.js" - }, - "files": [ - "source", - "index.d.ts" - ], - "keywords": [ - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "str", - "ansi", - "style", - "styles", - "tty", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "devDependencies": { - "ava": "^2.4.0", - "coveralls": "^3.0.7", - "execa": "^4.0.0", - "import-fresh": "^3.1.0", - "matcha": "^0.7.0", - "nyc": "^15.0.0", - "resolve-from": "^5.0.0", - "tsd": "^0.7.4", - "xo": "^0.28.2" - }, - "xo": { - "rules": { - "unicorn/prefer-string-slice": "off", - "unicorn/prefer-includes": "off", - "@typescript-eslint/member-ordering": "off", - "no-redeclare": "off", - "unicorn/string-content": "off", - "unicorn/better-regex": "off" - } - } -} diff --git a/node_modules/ora/node_modules/chalk/readme.md b/node_modules/ora/node_modules/chalk/readme.md deleted file mode 100644 index a055d21..0000000 --- a/node_modules/ora/node_modules/chalk/readme.md +++ /dev/null @@ -1,341 +0,0 @@ -<h1 align="center"> - <br> - <br> - <img width="320" src="media/logo.svg" alt="Chalk"> - <br> - <br> - <br> -</h1> - -> Terminal string styling done right - -[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![npm dependents](https://badgen.net/npm/dependents/chalk)](https://www.npmjs.com/package/chalk?activeTab=dependents) [![Downloads](https://badgen.net/npm/dt/chalk)](https://www.npmjs.com/package/chalk) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) ![TypeScript-ready](https://img.shields.io/npm/types/chalk.svg) [![run on repl.it](https://repl.it/badge/github/chalk/chalk)](https://repl.it/github/chalk/chalk) - -<img src="https://cdn.jsdelivr.net/gh/chalk/ansi-styles@8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900"> - -<br> - ---- - -<div align="center"> - <p> - <p> - <sup> - Sindre Sorhus' open source work is supported by the community on <a href="https://github.com/sponsors/sindresorhus">GitHub Sponsors</a> and <a href="https://stakes.social/0x44d871aebF0126Bf646753E2C976Aa7e68A66c15">Dev</a> - </sup> - </p> - <sup>Special thanks to:</sup> - <br> - <br> - <a href="https://standardresume.co/tech"> - <img src="https://sindresorhus.com/assets/thanks/standard-resume-logo.svg" width="160"/> - </a> - <br> - <br> - <a href="https://retool.com/?utm_campaign=sindresorhus"> - <img src="https://sindresorhus.com/assets/thanks/retool-logo.svg" width="230"/> - </a> - <br> - <br> - <a href="https://doppler.com/?utm_campaign=github_repo&utm_medium=referral&utm_content=chalk&utm_source=github"> - <div> - <img src="https://dashboard.doppler.com/imgs/logo-long.svg" width="240" alt="Doppler"> - </div> - <b>All your environment variables, in one place</b> - <div> - <span>Stop struggling with scattered API keys, hacking together home-brewed tools,</span> - <br> - <span>and avoiding access controls. Keep your team and servers in sync with Doppler.</span> - </div> - </a> - <br> - <a href="https://uibakery.io/?utm_source=chalk&utm_medium=sponsor&utm_campaign=github"> - <div> - <img src="https://sindresorhus.com/assets/thanks/uibakery-logo.jpg" width="270" alt="UI Bakery"> - </div> - </a> - </p> -</div> - ---- - -<br> - -## Highlights - -- Expressive API -- Highly performant -- Ability to nest styles -- [256/Truecolor color support](#256-and-truecolor-color-support) -- Auto-detects color support -- Doesn't extend `String.prototype` -- Clean and focused -- Actively maintained -- [Used by ~50,000 packages](https://www.npmjs.com/browse/depended/chalk) as of January 1, 2020 - -## Install - -```console -$ npm install chalk -``` - -## Usage - -```js -const chalk = require('chalk'); - -console.log(chalk.blue('Hello world!')); -``` - -Chalk comes with an easy to use composable API where you just chain and nest the styles you want. - -```js -const chalk = require('chalk'); -const log = console.log; - -// Combine styled and normal strings -log(chalk.blue('Hello') + ' World' + chalk.red('!')); - -// Compose multiple styles using the chainable API -log(chalk.blue.bgRed.bold('Hello world!')); - -// Pass in multiple arguments -log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz')); - -// Nest styles -log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!')); - -// Nest styles of the same type even (color, underline, background) -log(chalk.green( - 'I am a green line ' + - chalk.blue.underline.bold('with a blue substring') + - ' that becomes green again!' -)); - -// ES2015 template literal -log(` -CPU: ${chalk.red('90%')} -RAM: ${chalk.green('40%')} -DISK: ${chalk.yellow('70%')} -`); - -// ES2015 tagged template literal -log(chalk` -CPU: {red ${cpu.totalPercent}%} -RAM: {green ${ram.used / ram.total * 100}%} -DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%} -`); - -// Use RGB colors in terminal emulators that support it. -log(chalk.keyword('orange')('Yay for orange colored text!')); -log(chalk.rgb(123, 45, 67).underline('Underlined reddish color')); -log(chalk.hex('#DEADED').bold('Bold gray!')); -``` - -Easily define your own themes: - -```js -const chalk = require('chalk'); - -const error = chalk.bold.red; -const warning = chalk.keyword('orange'); - -console.log(error('Error!')); -console.log(warning('Warning!')); -``` - -Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args): - -```js -const name = 'Sindre'; -console.log(chalk.green('Hello %s'), name); -//=> 'Hello Sindre' -``` - -## API - -### chalk.`<style>[.<style>...](string, [string...])` - -Example: `chalk.red.bold.underline('Hello', 'world');` - -Chain [styles](#styles) and call the last one as a method with a string argument. Order doesn't matter, and later styles take precedent in case of a conflict. This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`. - -Multiple arguments will be separated by space. - -### chalk.level - -Specifies the level of color support. - -Color support is automatically detected, but you can override it by setting the `level` property. You should however only do this in your own code as it applies globally to all Chalk consumers. - -If you need to change this in a reusable module, create a new instance: - -```js -const ctx = new chalk.Instance({level: 0}); -``` - -| Level | Description | -| :---: | :--- | -| `0` | All colors disabled | -| `1` | Basic color support (16 colors) | -| `2` | 256 color support | -| `3` | Truecolor support (16 million colors) | - -### chalk.supportsColor - -Detect whether the terminal [supports color](https://github.com/chalk/supports-color). Used internally and handled for you, but exposed for convenience. - -Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, use the environment variable `FORCE_COLOR=1` (level 1), `FORCE_COLOR=2` (level 2), or `FORCE_COLOR=3` (level 3) to forcefully enable color, or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks. - -Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively. - -### chalk.stderr and chalk.stderr.supportsColor - -`chalk.stderr` contains a separate instance configured with color support detected for `stderr` stream instead of `stdout`. Override rules from `chalk.supportsColor` apply to this too. `chalk.stderr.supportsColor` is exposed for convenience. - -## Styles - -### Modifiers - -- `reset` - Resets the current color chain. -- `bold` - Make text bold. -- `dim` - Emitting only a small amount of light. -- `italic` - Make text italic. *(Not widely supported)* -- `underline` - Make text underline. *(Not widely supported)* -- `inverse`- Inverse background and foreground colors. -- `hidden` - Prints the text, but makes it invisible. -- `strikethrough` - Puts a horizontal line through the center of the text. *(Not widely supported)* -- `visible`- Prints the text only when Chalk has a color level > 0. Can be useful for things that are purely cosmetic. - -### Colors - -- `black` -- `red` -- `green` -- `yellow` -- `blue` -- `magenta` -- `cyan` -- `white` -- `blackBright` (alias: `gray`, `grey`) -- `redBright` -- `greenBright` -- `yellowBright` -- `blueBright` -- `magentaBright` -- `cyanBright` -- `whiteBright` - -### Background colors - -- `bgBlack` -- `bgRed` -- `bgGreen` -- `bgYellow` -- `bgBlue` -- `bgMagenta` -- `bgCyan` -- `bgWhite` -- `bgBlackBright` (alias: `bgGray`, `bgGrey`) -- `bgRedBright` -- `bgGreenBright` -- `bgYellowBright` -- `bgBlueBright` -- `bgMagentaBright` -- `bgCyanBright` -- `bgWhiteBright` - -## Tagged template literal - -Chalk can be used as a [tagged template literal](https://exploringjs.com/es6/ch_template-literals.html#_tagged-template-literals). - -```js -const chalk = require('chalk'); - -const miles = 18; -const calculateFeet = miles => miles * 5280; - -console.log(chalk` - There are {bold 5280 feet} in a mile. - In {bold ${miles} miles}, there are {green.bold ${calculateFeet(miles)} feet}. -`); -``` - -Blocks are delimited by an opening curly brace (`{`), a style, some content, and a closing curly brace (`}`). - -Template styles are chained exactly like normal Chalk styles. The following three statements are equivalent: - -```js -console.log(chalk.bold.rgb(10, 100, 200)('Hello!')); -console.log(chalk.bold.rgb(10, 100, 200)`Hello!`); -console.log(chalk`{bold.rgb(10,100,200) Hello!}`); -``` - -Note that function styles (`rgb()`, `hsl()`, `keyword()`, etc.) may not contain spaces between parameters. - -All interpolated values (`` chalk`${foo}` ``) are converted to strings via the `.toString()` method. All curly braces (`{` and `}`) in interpolated value strings are escaped. - -## 256 and Truecolor color support - -Chalk supports 256 colors and [Truecolor](https://gist.github.com/XVilka/8346728) (16 million colors) on supported terminal apps. - -Colors are downsampled from 16 million RGB values to an ANSI color format that is supported by the terminal emulator (or by specifying `{level: n}` as a Chalk option). For example, Chalk configured to run at level 1 (basic color support) will downsample an RGB value of #FF0000 (red) to 31 (ANSI escape for red). - -Examples: - -- `chalk.hex('#DEADED').underline('Hello, world!')` -- `chalk.keyword('orange')('Some orange text')` -- `chalk.rgb(15, 100, 204).inverse('Hello!')` - -Background versions of these models are prefixed with `bg` and the first level of the module capitalized (e.g. `keyword` for foreground colors and `bgKeyword` for background colors). - -- `chalk.bgHex('#DEADED').underline('Hello, world!')` -- `chalk.bgKeyword('orange')('Some orange text')` -- `chalk.bgRgb(15, 100, 204).inverse('Hello!')` - -The following color models can be used: - -- [`rgb`](https://en.wikipedia.org/wiki/RGB_color_model) - Example: `chalk.rgb(255, 136, 0).bold('Orange!')` -- [`hex`](https://en.wikipedia.org/wiki/Web_colors#Hex_triplet) - Example: `chalk.hex('#FF8800').bold('Orange!')` -- [`keyword`](https://www.w3.org/wiki/CSS/Properties/color/keywords) (CSS keywords) - Example: `chalk.keyword('orange').bold('Orange!')` -- [`hsl`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsl(32, 100, 50).bold('Orange!')` -- [`hsv`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsv(32, 100, 100).bold('Orange!')` -- [`hwb`](https://en.wikipedia.org/wiki/HWB_color_model) - Example: `chalk.hwb(32, 0, 50).bold('Orange!')` -- [`ansi`](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) - Example: `chalk.ansi(31).bgAnsi(93)('red on yellowBright')` -- [`ansi256`](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) - Example: `chalk.bgAnsi256(194)('Honeydew, more or less')` - -## Windows - -If you're on Windows, do yourself a favor and use [Windows Terminal](https://github.com/microsoft/terminal) instead of `cmd.exe`. - -## Origin story - -[colors.js](https://github.com/Marak/colors.js) used to be the most popular string styling module, but it has serious deficiencies like extending `String.prototype` which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68) and the package is unmaintained. Although there are other packages, they either do too much or not enough. Chalk is a clean and focused alternative. - -## chalk for enterprise - -Available as part of the Tidelift Subscription. - -The maintainers of chalk and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-chalk?utm_source=npm-chalk&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) - -## Related - -- [chalk-cli](https://github.com/chalk/chalk-cli) - CLI for this module -- [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal -- [supports-color](https://github.com/chalk/supports-color) - Detect whether a terminal supports color -- [strip-ansi](https://github.com/chalk/strip-ansi) - Strip ANSI escape codes -- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Strip ANSI escape codes from a stream -- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes -- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes -- [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes -- [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes -- [color-convert](https://github.com/qix-/color-convert) - Converts colors between different models -- [chalk-animation](https://github.com/bokub/chalk-animation) - Animate strings in the terminal -- [gradient-string](https://github.com/bokub/gradient-string) - Apply color gradients to strings -- [chalk-pipe](https://github.com/LitoMore/chalk-pipe) - Create chalk style schemes with simpler style strings -- [terminal-link](https://github.com/sindresorhus/terminal-link) - Create clickable links in the terminal - -## Maintainers - -- [Sindre Sorhus](https://github.com/sindresorhus) -- [Josh Junon](https://github.com/qix-) diff --git a/node_modules/ora/node_modules/chalk/source/index.js b/node_modules/ora/node_modules/chalk/source/index.js deleted file mode 100644 index 75ec663..0000000 --- a/node_modules/ora/node_modules/chalk/source/index.js +++ /dev/null @@ -1,229 +0,0 @@ -'use strict'; -const ansiStyles = require('ansi-styles'); -const {stdout: stdoutColor, stderr: stderrColor} = require('supports-color'); -const { - stringReplaceAll, - stringEncaseCRLFWithFirstIndex -} = require('./util'); - -const {isArray} = Array; - -// `supportsColor.level` → `ansiStyles.color[name]` mapping -const levelMapping = [ - 'ansi', - 'ansi', - 'ansi256', - 'ansi16m' -]; - -const styles = Object.create(null); - -const applyOptions = (object, options = {}) => { - if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) { - throw new Error('The `level` option should be an integer from 0 to 3'); - } - - // Detect level if not set manually - const colorLevel = stdoutColor ? stdoutColor.level : 0; - object.level = options.level === undefined ? colorLevel : options.level; -}; - -class ChalkClass { - constructor(options) { - // eslint-disable-next-line no-constructor-return - return chalkFactory(options); - } -} - -const chalkFactory = options => { - const chalk = {}; - applyOptions(chalk, options); - - chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_); - - Object.setPrototypeOf(chalk, Chalk.prototype); - Object.setPrototypeOf(chalk.template, chalk); - - chalk.template.constructor = () => { - throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.'); - }; - - chalk.template.Instance = ChalkClass; - - return chalk.template; -}; - -function Chalk(options) { - return chalkFactory(options); -} - -for (const [styleName, style] of Object.entries(ansiStyles)) { - styles[styleName] = { - get() { - const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty); - Object.defineProperty(this, styleName, {value: builder}); - return builder; - } - }; -} - -styles.visible = { - get() { - const builder = createBuilder(this, this._styler, true); - Object.defineProperty(this, 'visible', {value: builder}); - return builder; - } -}; - -const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256']; - -for (const model of usedModels) { - styles[model] = { - get() { - const {level} = this; - return function (...arguments_) { - const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler); - return createBuilder(this, styler, this._isEmpty); - }; - } - }; -} - -for (const model of usedModels) { - const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1); - styles[bgModel] = { - get() { - const {level} = this; - return function (...arguments_) { - const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler); - return createBuilder(this, styler, this._isEmpty); - }; - } - }; -} - -const proto = Object.defineProperties(() => {}, { - ...styles, - level: { - enumerable: true, - get() { - return this._generator.level; - }, - set(level) { - this._generator.level = level; - } - } -}); - -const createStyler = (open, close, parent) => { - let openAll; - let closeAll; - if (parent === undefined) { - openAll = open; - closeAll = close; - } else { - openAll = parent.openAll + open; - closeAll = close + parent.closeAll; - } - - return { - open, - close, - openAll, - closeAll, - parent - }; -}; - -const createBuilder = (self, _styler, _isEmpty) => { - const builder = (...arguments_) => { - if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) { - // Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}` - return applyStyle(builder, chalkTag(builder, ...arguments_)); - } - - // Single argument is hot path, implicit coercion is faster than anything - // eslint-disable-next-line no-implicit-coercion - return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' ')); - }; - - // We alter the prototype because we must return a function, but there is - // no way to create a function with a different prototype - Object.setPrototypeOf(builder, proto); - - builder._generator = self; - builder._styler = _styler; - builder._isEmpty = _isEmpty; - - return builder; -}; - -const applyStyle = (self, string) => { - if (self.level <= 0 || !string) { - return self._isEmpty ? '' : string; - } - - let styler = self._styler; - - if (styler === undefined) { - return string; - } - - const {openAll, closeAll} = styler; - if (string.indexOf('\u001B') !== -1) { - while (styler !== undefined) { - // Replace any instances already present with a re-opening code - // otherwise only the part of the string until said closing code - // will be colored, and the rest will simply be 'plain'. - string = stringReplaceAll(string, styler.close, styler.open); - - styler = styler.parent; - } - } - - // We can move both next actions out of loop, because remaining actions in loop won't have - // any/visible effect on parts we add here. Close the styling before a linebreak and reopen - // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92 - const lfIndex = string.indexOf('\n'); - if (lfIndex !== -1) { - string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex); - } - - return openAll + string + closeAll; -}; - -let template; -const chalkTag = (chalk, ...strings) => { - const [firstString] = strings; - - if (!isArray(firstString) || !isArray(firstString.raw)) { - // If chalk() was called by itself or with a string, - // return the string itself as a string. - return strings.join(' '); - } - - const arguments_ = strings.slice(1); - const parts = [firstString.raw[0]]; - - for (let i = 1; i < firstString.length; i++) { - parts.push( - String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'), - String(firstString.raw[i]) - ); - } - - if (template === undefined) { - template = require('./templates'); - } - - return template(chalk, parts.join('')); -}; - -Object.defineProperties(Chalk.prototype, styles); - -const chalk = Chalk(); // eslint-disable-line new-cap -chalk.supportsColor = stdoutColor; -chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap -chalk.stderr.supportsColor = stderrColor; - -module.exports = chalk; diff --git a/node_modules/ora/node_modules/chalk/source/templates.js b/node_modules/ora/node_modules/chalk/source/templates.js deleted file mode 100644 index b130949..0000000 --- a/node_modules/ora/node_modules/chalk/source/templates.js +++ /dev/null @@ -1,134 +0,0 @@ -'use strict'; -const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi; -const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g; -const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/; -const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi; - -const ESCAPES = new Map([ - ['n', '\n'], - ['r', '\r'], - ['t', '\t'], - ['b', '\b'], - ['f', '\f'], - ['v', '\v'], - ['0', '\0'], - ['\\', '\\'], - ['e', '\u001B'], - ['a', '\u0007'] -]); - -function unescape(c) { - const u = c[0] === 'u'; - const bracket = c[1] === '{'; - - if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) { - return String.fromCharCode(parseInt(c.slice(1), 16)); - } - - if (u && bracket) { - return String.fromCodePoint(parseInt(c.slice(2, -1), 16)); - } - - return ESCAPES.get(c) || c; -} - -function parseArguments(name, arguments_) { - const results = []; - const chunks = arguments_.trim().split(/\s*,\s*/g); - let matches; - - for (const chunk of chunks) { - const number = Number(chunk); - if (!Number.isNaN(number)) { - results.push(number); - } else if ((matches = chunk.match(STRING_REGEX))) { - results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character)); - } else { - throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`); - } - } - - return results; -} - -function parseStyle(style) { - STYLE_REGEX.lastIndex = 0; - - const results = []; - let matches; - - while ((matches = STYLE_REGEX.exec(style)) !== null) { - const name = matches[1]; - - if (matches[2]) { - const args = parseArguments(name, matches[2]); - results.push([name].concat(args)); - } else { - results.push([name]); - } - } - - return results; -} - -function buildStyle(chalk, styles) { - const enabled = {}; - - for (const layer of styles) { - for (const style of layer.styles) { - enabled[style[0]] = layer.inverse ? null : style.slice(1); - } - } - - let current = chalk; - for (const [styleName, styles] of Object.entries(enabled)) { - if (!Array.isArray(styles)) { - continue; - } - - if (!(styleName in current)) { - throw new Error(`Unknown Chalk style: ${styleName}`); - } - - current = styles.length > 0 ? current[styleName](...styles) : current[styleName]; - } - - return current; -} - -module.exports = (chalk, temporary) => { - const styles = []; - const chunks = []; - let chunk = []; - - // eslint-disable-next-line max-params - temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => { - if (escapeCharacter) { - chunk.push(unescape(escapeCharacter)); - } else if (style) { - const string = chunk.join(''); - chunk = []; - chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string)); - styles.push({inverse, styles: parseStyle(style)}); - } else if (close) { - if (styles.length === 0) { - throw new Error('Found extraneous } in Chalk template literal'); - } - - chunks.push(buildStyle(chalk, styles)(chunk.join(''))); - chunk = []; - styles.pop(); - } else { - chunk.push(character); - } - }); - - chunks.push(chunk.join('')); - - if (styles.length > 0) { - const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`; - throw new Error(errMessage); - } - - return chunks.join(''); -}; diff --git a/node_modules/ora/node_modules/chalk/source/util.js b/node_modules/ora/node_modules/chalk/source/util.js deleted file mode 100644 index ca466fd..0000000 --- a/node_modules/ora/node_modules/chalk/source/util.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict'; - -const stringReplaceAll = (string, substring, replacer) => { - let index = string.indexOf(substring); - if (index === -1) { - return string; - } - - const substringLength = substring.length; - let endIndex = 0; - let returnValue = ''; - do { - returnValue += string.substr(endIndex, index - endIndex) + substring + replacer; - endIndex = index + substringLength; - index = string.indexOf(substring, endIndex); - } while (index !== -1); - - returnValue += string.substr(endIndex); - return returnValue; -}; - -const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => { - let endIndex = 0; - let returnValue = ''; - do { - const gotCR = string[index - 1] === '\r'; - returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix; - endIndex = index + 1; - index = string.indexOf('\n', endIndex); - } while (index !== -1); - - returnValue += string.substr(endIndex); - return returnValue; -}; - -module.exports = { - stringReplaceAll, - stringEncaseCRLFWithFirstIndex -}; diff --git a/node_modules/ora/package.json b/node_modules/ora/package.json deleted file mode 100644 index 918c52f..0000000 --- a/node_modules/ora/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "ora", - "version": "6.0.1", - "description": "Elegant terminal spinner", - "license": "MIT", - "repository": "sindresorhus/ora", - "funding": "https://github.com/sponsors/sindresorhus", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "https://sindresorhus.com" - }, - "type": "module", - "exports": "./index.js", - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "cli", - "spinner", - "spinners", - "terminal", - "term", - "console", - "ascii", - "unicode", - "loading", - "indicator", - "progress", - "busy", - "wait", - "idle" - ], - "dependencies": { - "bl": "^5.0.0", - "chalk": "^4.1.2", - "cli-cursor": "^4.0.0", - "cli-spinners": "^2.6.0", - "is-interactive": "^2.0.0", - "is-unicode-supported": "^1.1.0", - "log-symbols": "^5.0.0", - "strip-ansi": "^7.0.1", - "wcwidth": "^1.0.1" - }, - "devDependencies": { - "@types/node": "^16.9.1", - "ava": "^3.15.0", - "get-stream": "^6.0.1", - "transform-tty": "^1.0.11", - "tsd": "^0.17.0", - "xo": "^0.44.0" - } -} diff --git a/node_modules/ora/readme.md b/node_modules/ora/readme.md deleted file mode 100644 index eae7e71..0000000 --- a/node_modules/ora/readme.md +++ /dev/null @@ -1,292 +0,0 @@ -# ora - -> Elegant terminal spinner - -<p align="center"> - <br> - <img src="screenshot.svg" width="500"> - <br> -</p> - -## Install - -``` -$ npm install ora -``` - -## Usage - -```js -import ora from 'ora'; - -const spinner = ora('Loading unicorns').start(); - -setTimeout(() => { - spinner.color = 'yellow'; - spinner.text = 'Loading rainbows'; -}, 1000); -``` - -## API - -### ora(text) -### ora(options) - -If a string is provided, it is treated as a shortcut for [`options.text`](#text). - -#### options - -Type: `object` - -##### text - -Type: `string` - -Text to display after the spinner. - -##### prefixText - -Type: `string | () => string` - -Text or a function that returns text to display before the spinner. No prefix text will be displayed if set to an empty string. - -##### spinner - -Type: `string | object`\ -Default: `'dots'` <img src="screenshot-spinner.gif" width="14"> - -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. - -Or an object like: - -```js -{ - interval: 80, // Optional - frames: ['-', '+', '-'] -} -``` - -##### color - -Type: `string`\ -Default: `'cyan'`\ -Values: `'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray'` - -Color of the spinner. - -##### hideCursor - -Type: `boolean`\ -Default: `true` - -Set to `false` to stop Ora from hiding the cursor. - -##### indent - -Type: `number`\ -Default: `0` - -Indent the spinner with the given number of spaces. - -##### interval - -Type: `number`\ -Default: Provided by the spinner or `100` - -Interval between each frame. - -Spinners provide their own recommended interval, so you don't really need to specify this. - -##### stream - -Type: `stream.Writable`\ -Default: `process.stderr` - -Stream to write the output. - -You could for example set this to `process.stdout` instead. - -##### isEnabled - -Type: `boolean` - -Force enable/disable the spinner. If not specified, the spinner will be enabled if the `stream` is being run inside a TTY context (not spawned or piped) and/or not in a CI environment. - -Note that `{isEnabled: false}` doesn't mean it won't output anything. It just means it won't output the spinner, colors, and other ansi escape codes. It will still log text. - -##### isSilent - -Type: `boolean`\ -Default: `false` - -Disable the spinner and all log text. All output is suppressed and `isEnabled` will be considered `false`. - -##### discardStdin - -Type: `boolean`\ -Default: `true` - -Discard stdin input (except Ctrl+C) while running if it's TTY. This prevents the spinner from twitching on input, outputting broken lines on <kbd>Enter</kbd> key presses, and prevents buffering of input while the spinner is running. - -This has no effect on Windows as there's no good way to implement discarding stdin properly there. - -### Instance - -#### .start(text?) - -Start the spinner. Returns the instance. Set the current text if `text` is provided. - -#### .stop() - -Stop and clear the spinner. Returns the instance. - -#### .succeed(text?) - -Stop the spinner, change it to a green `✔` and persist the current text, or `text` if provided. Returns the instance. See the GIF below. - -#### .fail(text?) - -Stop the spinner, change it to a red `✖` and persist the current text, or `text` if provided. Returns the instance. See the GIF below. - -#### .warn(text?) - -Stop the spinner, change it to a yellow `⚠` and persist the current text, or `text` if provided. Returns the instance. - -#### .info(text?) - -Stop the spinner, change it to a blue `ℹ` and persist the current text, or `text` if provided. Returns the instance. - -#### .isSpinning - -A boolean of whether the instance is currently spinning. - -#### .stopAndPersist(options?) - -Stop the spinner and change the symbol or text. Returns the instance. See the GIF below. - -##### options - -Type: `object` - -###### symbol - -Type: `string`\ -Default: `' '` - -Symbol to replace the spinner with. - -###### text - -Type: `string`\ -Default: Current `'text'` - -Text to be persisted after the symbol - -###### prefixText - -Type: `string`\ -Default: Current `prefixText` - -Text to be persisted before the symbol. No prefix text will be displayed if set to an empty string. - -<img src="screenshot-2.gif" width="480"> - -#### .clear() - -Clear the spinner. Returns the instance. - -#### .render() - -Manually render a new frame. Returns the instance. - -#### .frame() - -Get a new frame. - -#### .text - -Change the text after the spinner. - -#### .prefixText - -Change the text before the spinner. No prefix text will be displayed if set to an empty string. - -#### .color - -Change the spinner color. - -#### .spinner - -Change the spinner. - -#### .indent - -Change the spinner indent. - -### oraPromise(action, text) -### oraPromise(action, options) - -Starts a spinner for a promise or promise-returning function. The spinner is stopped with `.succeed()` if the promise fulfills or with `.fail()` if it rejects. Returns the promise. - -```js -import {oraPromise} from 'ora'; - -await oraPromise(somePromise); -``` - -#### action - -Type: `Promise | ((spinner: ora.Ora) => Promise)` - -#### options - -Type: `object` - -All of the [options](#options) plus the following: - -##### successText - -Type: `string | ((result: T) => string) | undefined` - -The new text of the spinner when the promise is resolved. - -Keeps the existing text if `undefined`. - -##### failText - -Type: `string | ((error: Error) => string) | undefined` - -The new text of the spinner when the promise is rejected. - -Keeps the existing text if `undefined`. - -## FAQ - -### How do I change the color of the text? - -Use [Chalk](https://github.com/chalk/chalk): - -```js -import ora from 'ora'; -import chalk from 'chalk'; - -const spinner = ora(`Loading ${chalk.red('unicorns')}`).start(); -``` - -### Why does the spinner freeze? - -JavaScript is single-threaded, so synchronous operations blocks the thread, including the spinner animation. Prefer asynchronous operations whenever possible. - -## Related - -- [cli-spinners](https://github.com/sindresorhus/cli-spinners) - Spinners for use in the terminal -- [listr](https://github.com/SamVerschueren/listr) - Terminal task list -- [CLISpinner](https://github.com/kiliankoe/CLISpinner) - Terminal spinner library for Swift -- [halo](https://github.com/ManrajGrover/halo) - Python port -- [spinners](https://github.com/FGRibreau/spinners) - Terminal spinners for Rust -- [marquee-ora](https://github.com/joeycozza/marquee-ora) - Scrolling marquee spinner for Ora -- [briandowns/spinner](https://github.com/briandowns/spinner) - Terminal spinner/progress indicator for Go -- [tj/go-spin](https://github.com/tj/go-spin) - Terminal spinner package for Go -- [observablehq.com/@victordidenko/ora](https://observablehq.com/@victordidenko/ora) - Ora port to Observable notebooks -- [spinnies](https://github.com/jcarpanelli/spinnies) - Terminal multi-spinner library for Node.js -- [kia](https://github.com/HarryPeach/kia) - Simple terminal spinners for Deno 🦕 |