Upakovka v Electron.JS no po staroy sborke cherez .cjs
This commit is contained in:
573
node_modules/ora/index.d.ts
generated
vendored
573
node_modules/ora/index.d.ts
generated
vendored
@@ -1,332 +1,277 @@
|
||||
import {type SpinnerName} from 'cli-spinners';
|
||||
import {SpinnerName} from 'cli-spinners';
|
||||
|
||||
export type Spinner = {
|
||||
readonly interval?: number;
|
||||
readonly frames: string[];
|
||||
};
|
||||
declare namespace ora {
|
||||
interface Spinner {
|
||||
readonly interval?: number;
|
||||
readonly frames: string[];
|
||||
}
|
||||
|
||||
export type Color =
|
||||
| 'black'
|
||||
| 'red'
|
||||
| 'green'
|
||||
| 'yellow'
|
||||
| 'blue'
|
||||
| 'magenta'
|
||||
| 'cyan'
|
||||
| 'white'
|
||||
| 'gray';
|
||||
type Color =
|
||||
| 'black'
|
||||
| 'red'
|
||||
| 'green'
|
||||
| 'yellow'
|
||||
| 'blue'
|
||||
| 'magenta'
|
||||
| 'cyan'
|
||||
| 'white'
|
||||
| 'gray';
|
||||
|
||||
export type PrefixTextGenerator = () => string;
|
||||
type PrefixTextGenerator = () => string;
|
||||
|
||||
export type SuffixTextGenerator = () => string;
|
||||
interface Options {
|
||||
/**
|
||||
Text to display after the spinner.
|
||||
*/
|
||||
readonly text?: string;
|
||||
|
||||
export type Options = {
|
||||
/**
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
declare const ora: {
|
||||
/**
|
||||
The text to display next to the spinner.
|
||||
*/
|
||||
readonly text?: string;
|
||||
Elegant terminal spinner.
|
||||
|
||||
/**
|
||||
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;
|
||||
|
||||
/**
|
||||
Text or a function that returns text to display after the spinner text. No suffix text will be displayed if set to an empty string.
|
||||
*/
|
||||
readonly suffixText?: string | SuffixTextGenerator;
|
||||
|
||||
/**
|
||||
The 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 (expect for Windows Terminal), it will always use the line spinner as the Windows command-line doesn't have proper Unicode support.
|
||||
|
||||
@default 'dots'
|
||||
|
||||
Or an object like:
|
||||
@param options - If a string is provided, it is treated as a shortcut for `options.text`.
|
||||
|
||||
@example
|
||||
```
|
||||
{
|
||||
frames: ['-', '+', '-'],
|
||||
interval: 80 // Optional
|
||||
}
|
||||
import ora = require('ora');
|
||||
|
||||
const spinner = ora('Loading unicorns').start();
|
||||
|
||||
setTimeout(() => {
|
||||
spinner.color = 'yellow';
|
||||
spinner.text = 'Loading rainbows';
|
||||
}, 1000);
|
||||
```
|
||||
*/
|
||||
readonly spinner?: SpinnerName | Spinner;
|
||||
(options?: ora.Options | string): ora.Ora;
|
||||
|
||||
/**
|
||||
The color of the spinner.
|
||||
Starts a spinner for a promise. The spinner is stopped with `.succeed()` if the promise fulfills or with `.fail()` if it rejects.
|
||||
|
||||
@default 'cyan'
|
||||
@param action - The promise to start the spinner for.
|
||||
@param options - If a string is provided, it is treated as a shortcut for `options.text`.
|
||||
@returns The spinner instance.
|
||||
*/
|
||||
readonly color?: Color | boolean;
|
||||
|
||||
/**
|
||||
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;
|
||||
promise(
|
||||
action: PromiseLike<unknown>,
|
||||
options?: ora.Options | string
|
||||
): ora.Ora;
|
||||
};
|
||||
|
||||
export type 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;
|
||||
|
||||
/**
|
||||
Text or a function that returns text to be persisted after the text after the symbol. No suffix text will be displayed if set to an empty string.
|
||||
|
||||
Default: Current `suffixText`.
|
||||
*/
|
||||
readonly suffixText?: string | SuffixTextGenerator;
|
||||
};
|
||||
|
||||
export type PromiseOptions<T> = {
|
||||
/**
|
||||
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;
|
||||
} & Options;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
||||
export interface Ora {
|
||||
/**
|
||||
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;
|
||||
|
||||
/**
|
||||
Change the text or function that returns text after the spinner text.
|
||||
|
||||
No suffix text will be displayed if set to an empty string.
|
||||
*/
|
||||
suffixText: string;
|
||||
|
||||
/**
|
||||
Change the spinner color.
|
||||
*/
|
||||
color: Color | boolean;
|
||||
|
||||
/**
|
||||
Change the spinner indent.
|
||||
*/
|
||||
indent: number;
|
||||
|
||||
/**
|
||||
Get the spinner.
|
||||
*/
|
||||
get spinner(): Spinner;
|
||||
|
||||
/**
|
||||
Set the spinner.
|
||||
*/
|
||||
set spinner(spinner: SpinnerName | Spinner);
|
||||
|
||||
/**
|
||||
A boolean indicating whether the instance is currently spinning.
|
||||
*/
|
||||
get isSpinning(): boolean;
|
||||
|
||||
/**
|
||||
The interval between each frame.
|
||||
|
||||
The interval is decided by the chosen spinner.
|
||||
*/
|
||||
get interval(): number;
|
||||
|
||||
/**
|
||||
Start the spinner.
|
||||
|
||||
@param text - Set the current text.
|
||||
@returns The spinner instance.
|
||||
*/
|
||||
start(text?: string): this;
|
||||
|
||||
/**
|
||||
Stop and clear the spinner.
|
||||
|
||||
@returns The spinner instance.
|
||||
*/
|
||||
stop(): this;
|
||||
|
||||
/**
|
||||
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): this;
|
||||
|
||||
/**
|
||||
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): this;
|
||||
|
||||
/**
|
||||
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): this;
|
||||
|
||||
/**
|
||||
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): this;
|
||||
|
||||
/**
|
||||
Stop the spinner and change the symbol or text.
|
||||
|
||||
@returns The spinner instance.
|
||||
*/
|
||||
stopAndPersist(options?: PersistOptions): this;
|
||||
|
||||
/**
|
||||
Clear the spinner.
|
||||
|
||||
@returns The spinner instance.
|
||||
*/
|
||||
clear(): this;
|
||||
|
||||
/**
|
||||
Manually render a new frame.
|
||||
|
||||
@returns The spinner instance.
|
||||
*/
|
||||
render(): this;
|
||||
|
||||
/**
|
||||
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>;
|
||||
|
||||
export {default as spinners} from 'cli-spinners';
|
||||
export = ora;
|
||||
|
||||
447
node_modules/ora/index.js
generated
vendored
447
node_modules/ora/index.js
generated
vendored
@@ -1,95 +1,139 @@
|
||||
import process from 'node:process';
|
||||
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 stringWidth from 'string-width';
|
||||
import isInteractive from 'is-interactive';
|
||||
import isUnicodeSupported from 'is-unicode-supported';
|
||||
import stdinDiscarder from 'stdin-discarder';
|
||||
'use strict';
|
||||
const readline = require('readline');
|
||||
const chalk = require('chalk');
|
||||
const cliCursor = require('cli-cursor');
|
||||
const cliSpinners = require('cli-spinners');
|
||||
const logSymbols = require('log-symbols');
|
||||
const stripAnsi = require('strip-ansi');
|
||||
const wcwidth = require('wcwidth');
|
||||
const isInteractive = require('is-interactive');
|
||||
const isUnicodeSupported = require('is-unicode-supported');
|
||||
const {BufferListStream} = require('bl');
|
||||
|
||||
class Ora {
|
||||
#linesToClear = 0;
|
||||
#isDiscardingStdin = false;
|
||||
#lineCount = 0;
|
||||
#frameIndex = -1;
|
||||
#lastSpinnerFrameTime = 0;
|
||||
#options;
|
||||
#spinner;
|
||||
#stream;
|
||||
#id;
|
||||
#initialInterval;
|
||||
#isEnabled;
|
||||
#isSilent;
|
||||
#indent;
|
||||
#text;
|
||||
#prefixText;
|
||||
#suffixText;
|
||||
color;
|
||||
const TEXT = Symbol('text');
|
||||
const PREFIX_TEXT = Symbol('prefixText');
|
||||
const ASCII_ETX_CODE = 0x03; // Ctrl+C emits this code
|
||||
|
||||
constructor(options) {
|
||||
if (typeof options === 'string') {
|
||||
options = {
|
||||
text: options,
|
||||
};
|
||||
}
|
||||
class StdinDiscarder {
|
||||
constructor() {
|
||||
this.requests = 0;
|
||||
|
||||
this.#options = {
|
||||
color: 'cyan',
|
||||
stream: process.stderr,
|
||||
discardStdin: true,
|
||||
hideCursor: true,
|
||||
...options,
|
||||
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]);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Public
|
||||
this.color = this.#options.color;
|
||||
start() {
|
||||
this.requests++;
|
||||
|
||||
// It's important that these use the public setters.
|
||||
this.spinner = this.#options.spinner;
|
||||
|
||||
this.#initialInterval = this.#options.interval;
|
||||
this.#stream = this.#options.stream;
|
||||
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`.
|
||||
// It's important that these use the public setters.
|
||||
this.text = this.#options.text;
|
||||
this.prefixText = this.#options.prefixText;
|
||||
this.suffixText = this.#options.suffixText;
|
||||
this.indent = this.#options.indent;
|
||||
|
||||
if (process.env.NODE_ENV === 'test') {
|
||||
this._stream = this.#stream;
|
||||
this._isEnabled = this.#isEnabled;
|
||||
|
||||
Object.defineProperty(this, '_linesToClear', {
|
||||
get() {
|
||||
return this.#linesToClear;
|
||||
},
|
||||
set(newValue) {
|
||||
this.#linesToClear = newValue;
|
||||
},
|
||||
});
|
||||
|
||||
Object.defineProperty(this, '_frameIndex', {
|
||||
get() {
|
||||
return this.#frameIndex;
|
||||
},
|
||||
});
|
||||
|
||||
Object.defineProperty(this, '_lineCount', {
|
||||
get() {
|
||||
return this.#lineCount;
|
||||
},
|
||||
});
|
||||
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;
|
||||
return this._indent;
|
||||
}
|
||||
|
||||
set indent(indent = 0) {
|
||||
@@ -97,73 +141,66 @@ class Ora {
|
||||
throw new Error('The `indent` option must be an integer from 0 and up');
|
||||
}
|
||||
|
||||
this.#indent = indent;
|
||||
this.#updateLineCount();
|
||||
this._indent = indent;
|
||||
}
|
||||
|
||||
get interval() {
|
||||
return this.#initialInterval ?? this.#spinner.interval ?? 100;
|
||||
_updateInterval(interval) {
|
||||
if (interval !== undefined) {
|
||||
this.interval = interval;
|
||||
}
|
||||
}
|
||||
|
||||
get spinner() {
|
||||
return this.#spinner;
|
||||
return this._spinner;
|
||||
}
|
||||
|
||||
set spinner(spinner) {
|
||||
this.#frameIndex = -1;
|
||||
this.#initialInterval = undefined;
|
||||
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;
|
||||
this._spinner = spinner;
|
||||
} else if (!isUnicodeSupported()) {
|
||||
this.#spinner = cliSpinners.line;
|
||||
this._spinner = cliSpinners.line;
|
||||
} else if (spinner === undefined) {
|
||||
// Set default spinner
|
||||
this.#spinner = cliSpinners.dots;
|
||||
this._spinner = cliSpinners.dots;
|
||||
} else if (spinner !== 'default' && cliSpinners[spinner]) {
|
||||
this.#spinner = 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;
|
||||
return this[TEXT];
|
||||
}
|
||||
|
||||
set text(value = '') {
|
||||
this.#text = value;
|
||||
this.#updateLineCount();
|
||||
set text(value) {
|
||||
this[TEXT] = value;
|
||||
this.updateLineCount();
|
||||
}
|
||||
|
||||
get prefixText() {
|
||||
return this.#prefixText;
|
||||
return this[PREFIX_TEXT];
|
||||
}
|
||||
|
||||
set prefixText(value = '') {
|
||||
this.#prefixText = value;
|
||||
this.#updateLineCount();
|
||||
}
|
||||
|
||||
get suffixText() {
|
||||
return this.#suffixText;
|
||||
}
|
||||
|
||||
set suffixText(value = '') {
|
||||
this.#suffixText = value;
|
||||
this.#updateLineCount();
|
||||
set prefixText(value) {
|
||||
this[PREFIX_TEXT] = value;
|
||||
this.updateLineCount();
|
||||
}
|
||||
|
||||
get isSpinning() {
|
||||
return this.#id !== undefined;
|
||||
return this.id !== undefined;
|
||||
}
|
||||
|
||||
#getFullPrefixText(prefixText = this.#prefixText, postfix = ' ') {
|
||||
if (typeof prefixText === 'string' && prefixText !== '') {
|
||||
getFullPrefixText(prefixText = this[PREFIX_TEXT], postfix = ' ') {
|
||||
if (typeof prefixText === 'string') {
|
||||
return prefixText + postfix;
|
||||
}
|
||||
|
||||
@@ -174,32 +211,17 @@ class Ora {
|
||||
return '';
|
||||
}
|
||||
|
||||
#getFullSuffixText(suffixText = this.#suffixText, prefix = ' ') {
|
||||
if (typeof suffixText === 'string' && suffixText !== '') {
|
||||
return prefix + suffixText;
|
||||
}
|
||||
|
||||
if (typeof suffixText === 'function') {
|
||||
return prefix + suffixText();
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
#updateLineCount() {
|
||||
const columns = this.#stream.columns ?? 80;
|
||||
const fullPrefixText = this.#getFullPrefixText(this.#prefixText, '-');
|
||||
const fullSuffixText = this.#getFullSuffixText(this.#suffixText, '-');
|
||||
const fullText = ' '.repeat(this.#indent) + fullPrefixText + '--' + this.#text + '--' + fullSuffixText;
|
||||
|
||||
this.#lineCount = 0;
|
||||
for (const line of stripAnsi(fullText).split('\n')) {
|
||||
this.#lineCount += Math.max(1, Math.ceil(stringWidth(line, {countAnsiEscapeCodes: true}) / columns));
|
||||
updateLineCount() {
|
||||
const columns = this.stream.columns || 80;
|
||||
const fullPrefixText = this.getFullPrefixText(this.prefixText, '-');
|
||||
this.lineCount = 0;
|
||||
for (const line of stripAnsi(fullPrefixText + '--' + this[TEXT]).split('\n')) {
|
||||
this.lineCount += Math.max(1, Math.ceil(wcwidth(line) / columns));
|
||||
}
|
||||
}
|
||||
|
||||
get isEnabled() {
|
||||
return this.#isEnabled && !this.#isSilent;
|
||||
return this._isEnabled && !this.isSilent;
|
||||
}
|
||||
|
||||
set isEnabled(value) {
|
||||
@@ -207,11 +229,11 @@ class Ora {
|
||||
throw new TypeError('The `isEnabled` option must be a boolean');
|
||||
}
|
||||
|
||||
this.#isEnabled = value;
|
||||
this._isEnabled = value;
|
||||
}
|
||||
|
||||
get isSilent() {
|
||||
return this.#isSilent;
|
||||
return this._isSilent;
|
||||
}
|
||||
|
||||
set isSilent(value) {
|
||||
@@ -219,65 +241,51 @@ class Ora {
|
||||
throw new TypeError('The `isSilent` option must be a boolean');
|
||||
}
|
||||
|
||||
this.#isSilent = value;
|
||||
this._isSilent = value;
|
||||
}
|
||||
|
||||
frame() {
|
||||
// Ensure we only update the spinner frame at the wanted interval,
|
||||
// even if the render method is called more often.
|
||||
const now = Date.now();
|
||||
if (this.#frameIndex === -1 || now - this.#lastSpinnerFrameTime >= this.interval) {
|
||||
this.#frameIndex = ++this.#frameIndex % this.#spinner.frames.length;
|
||||
this.#lastSpinnerFrameTime = now;
|
||||
}
|
||||
|
||||
const {frames} = this.#spinner;
|
||||
let frame = frames[this.#frameIndex];
|
||||
const {frames} = this.spinner;
|
||||
let frame = frames[this.frameIndex];
|
||||
|
||||
if (this.color) {
|
||||
frame = chalk[this.color](frame);
|
||||
}
|
||||
|
||||
const fullPrefixText = (typeof this.#prefixText === 'string' && this.#prefixText !== '') ? this.#prefixText + ' ' : '';
|
||||
this.frameIndex = ++this.frameIndex % frames.length;
|
||||
const fullPrefixText = (typeof this.prefixText === 'string' && this.prefixText !== '') ? this.prefixText + ' ' : '';
|
||||
const fullText = typeof this.text === 'string' ? ' ' + this.text : '';
|
||||
const fullSuffixText = (typeof this.#suffixText === 'string' && this.#suffixText !== '') ? ' ' + this.#suffixText : '';
|
||||
|
||||
return fullPrefixText + frame + fullText + fullSuffixText;
|
||||
return fullPrefixText + frame + fullText;
|
||||
}
|
||||
|
||||
clear() {
|
||||
if (!this.#isEnabled || !this.#stream.isTTY) {
|
||||
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);
|
||||
for (let i = 0; i < this.linesToClear; i++) {
|
||||
if (i > 0) {
|
||||
this.stream.moveCursor(0, -1);
|
||||
}
|
||||
|
||||
this.#stream.clearLine(1);
|
||||
this.stream.clearLine();
|
||||
this.stream.cursorTo(this.indent);
|
||||
}
|
||||
|
||||
if (this.#indent || this.lastIndent !== this.#indent) {
|
||||
this.#stream.cursorTo(this.#indent);
|
||||
}
|
||||
|
||||
this.lastIndent = this.#indent;
|
||||
this.#linesToClear = 0;
|
||||
this.linesToClear = 0;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.#isSilent) {
|
||||
if (this.isSilent) {
|
||||
return this;
|
||||
}
|
||||
|
||||
this.clear();
|
||||
this.#stream.write(this.frame());
|
||||
this.#linesToClear = this.#lineCount;
|
||||
this.stream.write(this.frame());
|
||||
this.linesToClear = this.lineCount;
|
||||
|
||||
return this;
|
||||
}
|
||||
@@ -287,13 +295,13 @@ class Ora {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
if (this.#isSilent) {
|
||||
if (this.isSilent) {
|
||||
return this;
|
||||
}
|
||||
|
||||
if (!this.#isEnabled) {
|
||||
if (!this.isEnabled) {
|
||||
if (this.text) {
|
||||
this.#stream.write(`- ${this.text}\n`);
|
||||
this.stream.write(`- ${this.text}\n`);
|
||||
}
|
||||
|
||||
return this;
|
||||
@@ -303,37 +311,37 @@ class Ora {
|
||||
return this;
|
||||
}
|
||||
|
||||
if (this.#options.hideCursor) {
|
||||
cliCursor.hide(this.#stream);
|
||||
if (this.hideCursor) {
|
||||
cliCursor.hide(this.stream);
|
||||
}
|
||||
|
||||
if (this.#options.discardStdin && process.stdin.isTTY) {
|
||||
this.#isDiscardingStdin = true;
|
||||
if (this.discardStdin && process.stdin.isTTY) {
|
||||
this.isDiscardingStdin = true;
|
||||
stdinDiscarder.start();
|
||||
}
|
||||
|
||||
this.render();
|
||||
this.#id = setInterval(this.render.bind(this), this.interval);
|
||||
this.id = setInterval(this.render.bind(this), this.interval);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
stop() {
|
||||
if (!this.#isEnabled) {
|
||||
if (!this.isEnabled) {
|
||||
return this;
|
||||
}
|
||||
|
||||
clearInterval(this.#id);
|
||||
this.#id = undefined;
|
||||
this.#frameIndex = 0;
|
||||
clearInterval(this.id);
|
||||
this.id = undefined;
|
||||
this.frameIndex = 0;
|
||||
this.clear();
|
||||
if (this.#options.hideCursor) {
|
||||
cliCursor.show(this.#stream);
|
||||
if (this.hideCursor) {
|
||||
cliCursor.show(this.stream);
|
||||
}
|
||||
|
||||
if (this.#options.discardStdin && process.stdin.isTTY && this.#isDiscardingStdin) {
|
||||
if (this.discardStdin && process.stdin.isTTY && this.isDiscardingStdin) {
|
||||
stdinDiscarder.stop();
|
||||
this.#isDiscardingStdin = false;
|
||||
this.isDiscardingStdin = false;
|
||||
}
|
||||
|
||||
return this;
|
||||
@@ -356,69 +364,44 @@ class Ora {
|
||||
}
|
||||
|
||||
stopAndPersist(options = {}) {
|
||||
if (this.#isSilent) {
|
||||
if (this.isSilent) {
|
||||
return this;
|
||||
}
|
||||
|
||||
const prefixText = options.prefixText ?? this.#prefixText;
|
||||
const fullPrefixText = this.#getFullPrefixText(prefixText, ' ');
|
||||
|
||||
const symbolText = options.symbol ?? ' ';
|
||||
|
||||
const text = options.text ?? this.text;
|
||||
const separatorText = symbolText ? ' ' : '';
|
||||
const fullText = (typeof text === 'string') ? separatorText + text : '';
|
||||
|
||||
const suffixText = options.suffixText ?? this.#suffixText;
|
||||
const fullSuffixText = this.#getFullSuffixText(suffixText, ' ');
|
||||
|
||||
const textToWrite = fullPrefixText + symbolText + fullText + fullSuffixText + '\n';
|
||||
const prefixText = options.prefixText || this.prefixText;
|
||||
const text = options.text || this.text;
|
||||
const fullText = (typeof text === 'string') ? ' ' + text : '';
|
||||
|
||||
this.stop();
|
||||
this.#stream.write(textToWrite);
|
||||
this.stream.write(`${this.getFullPrefixText(prefixText, ' ')}${options.symbol || ' '}${fullText}\n`);
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
export default function ora(options) {
|
||||
const oraFactory = function (options) {
|
||||
return new Ora(options);
|
||||
}
|
||||
};
|
||||
|
||||
export async function oraPromise(action, options) {
|
||||
const actionIsFunction = typeof action === 'function';
|
||||
const actionIsPromise = typeof action.then === 'function';
|
||||
module.exports = oraFactory;
|
||||
|
||||
if (!actionIsFunction && !actionIsPromise) {
|
||||
throw new TypeError('Parameter `action` must be a Function or a Promise');
|
||||
module.exports.promise = (action, options) => {
|
||||
// eslint-disable-next-line promise/prefer-await-to-then
|
||||
if (typeof action.then !== 'function') {
|
||||
throw new TypeError('Parameter `action` must be a Promise');
|
||||
}
|
||||
|
||||
const {successText, failText} = typeof options === 'object'
|
||||
? options
|
||||
: {successText: undefined, failText: undefined};
|
||||
const spinner = new Ora(options);
|
||||
spinner.start();
|
||||
|
||||
const spinner = ora(options).start();
|
||||
(async () => {
|
||||
try {
|
||||
await action;
|
||||
spinner.succeed();
|
||||
} catch {
|
||||
spinner.fail();
|
||||
}
|
||||
})();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
export {default as spinners} from 'cli-spinners';
|
||||
return spinner;
|
||||
};
|
||||
|
||||
20
node_modules/ora/node_modules/emoji-regex/LICENSE-MIT.txt
generated
vendored
20
node_modules/ora/node_modules/emoji-regex/LICENSE-MIT.txt
generated
vendored
@@ -1,20 +0,0 @@
|
||||
Copyright Mathias Bynens <https://mathiasbynens.be/>
|
||||
|
||||
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.
|
||||
107
node_modules/ora/node_modules/emoji-regex/README.md
generated
vendored
107
node_modules/ora/node_modules/emoji-regex/README.md
generated
vendored
@@ -1,107 +0,0 @@
|
||||
# emoji-regex [](https://github.com/mathiasbynens/emoji-regex/actions/workflows/main.yml) [](https://www.npmjs.com/package/emoji-regex)
|
||||
|
||||
_emoji-regex_ offers a regular expression to match all emoji symbols and sequences (including textual representations of emoji) as per the Unicode Standard. It’s based on [_emoji-test-regex-pattern_](https://github.com/mathiasbynens/emoji-test-regex-pattern), which generates (at build time) the regular expression pattern based on the Unicode Standard. As a result, _emoji-regex_ can easily be updated whenever new emoji are added to Unicode.
|
||||
|
||||
Since each version of _emoji-regex_ is tied to the latest Unicode version at the time of release, results are deterministic. This is important for use cases like image replacement, where you want to guarantee that an image asset is available for every possibly matched emoji. If you don’t need a deterministic regex, a lighter-weight, general emoji pattern is available via the [_emoji-regex-xs_](https://github.com/slevithan/emoji-regex-xs) package that follows the same API.
|
||||
|
||||
## Installation
|
||||
|
||||
Via [npm](https://www.npmjs.com/):
|
||||
|
||||
```bash
|
||||
npm install emoji-regex
|
||||
```
|
||||
|
||||
In [Node.js](https://nodejs.org/):
|
||||
|
||||
```js
|
||||
const emojiRegex = require('emoji-regex');
|
||||
// Note: because the regular expression has the global flag set, this module
|
||||
// exports a function that returns the regex rather than exporting the regular
|
||||
// expression itself, to make it impossible to (accidentally) mutate the
|
||||
// original regular expression.
|
||||
|
||||
const text = `
|
||||
\u{231A}: ⌚ default emoji presentation character (Emoji_Presentation)
|
||||
\u{2194}\u{FE0F}: ↔️ default text presentation character rendered as emoji
|
||||
\u{1F469}: 👩 emoji modifier base (Emoji_Modifier_Base)
|
||||
\u{1F469}\u{1F3FF}: 👩🏿 emoji modifier base followed by a modifier
|
||||
`;
|
||||
|
||||
const regex = emojiRegex();
|
||||
for (const match of text.matchAll(regex)) {
|
||||
const emoji = match[0];
|
||||
console.log(`Matched sequence ${ emoji } — code points: ${ [...emoji].length }`);
|
||||
}
|
||||
```
|
||||
|
||||
Console output:
|
||||
|
||||
```
|
||||
Matched sequence ⌚ — code points: 1
|
||||
Matched sequence ⌚ — code points: 1
|
||||
Matched sequence ↔️ — code points: 2
|
||||
Matched sequence ↔️ — code points: 2
|
||||
Matched sequence 👩 — code points: 1
|
||||
Matched sequence 👩 — code points: 1
|
||||
Matched sequence 👩🏿 — code points: 2
|
||||
Matched sequence 👩🏿 — code points: 2
|
||||
```
|
||||
|
||||
## For maintainers
|
||||
|
||||
### How to update emoji-regex after new Unicode Standard releases
|
||||
|
||||
1. [Update _emoji-test-regex-pattern_ as described in its repository](https://github.com/mathiasbynens/emoji-test-regex-pattern#how-to-update-emoji-test-regex-pattern-after-new-uts51-releases).
|
||||
|
||||
1. Bump the _emoji-test-regex-pattern_ dependency to the latest version.
|
||||
|
||||
1. Update the Unicode data dependency in `package.json` by running the following commands:
|
||||
|
||||
```sh
|
||||
# Example: updating from Unicode v13 to Unicode v14.
|
||||
npm uninstall @unicode/unicode-13.0.0
|
||||
npm install @unicode/unicode-14.0.0 --save-dev
|
||||
````
|
||||
|
||||
1. Generate the new output:
|
||||
|
||||
```sh
|
||||
npm run build
|
||||
```
|
||||
|
||||
1. Verify that tests still pass:
|
||||
|
||||
```sh
|
||||
npm test
|
||||
```
|
||||
|
||||
### How to publish a new release
|
||||
|
||||
1. On the `main` branch, bump the emoji-regex version number in `package.json`:
|
||||
|
||||
```sh
|
||||
npm version patch -m 'Release v%s'
|
||||
```
|
||||
|
||||
Instead of `patch`, use `minor` or `major` [as needed](https://semver.org/).
|
||||
|
||||
Note that this produces a Git commit + tag.
|
||||
|
||||
1. Push the release commit and tag:
|
||||
|
||||
```sh
|
||||
git push && git push --tags
|
||||
```
|
||||
|
||||
Our CI then automatically publishes the new release to npm.
|
||||
|
||||
## Author
|
||||
|
||||
| [](https://twitter.com/mathias "Follow @mathias on Twitter") |
|
||||
|---|
|
||||
| [Mathias Bynens](https://mathiasbynens.be/) |
|
||||
|
||||
## License
|
||||
|
||||
_emoji-regex_ is available under the [MIT](https://mths.be/mit) license.
|
||||
3
node_modules/ora/node_modules/emoji-regex/index.d.ts
generated
vendored
3
node_modules/ora/node_modules/emoji-regex/index.d.ts
generated
vendored
@@ -1,3 +0,0 @@
|
||||
declare module 'emoji-regex' {
|
||||
export default function emojiRegex(): RegExp;
|
||||
}
|
||||
4
node_modules/ora/node_modules/emoji-regex/index.js
generated
vendored
4
node_modules/ora/node_modules/emoji-regex/index.js
generated
vendored
File diff suppressed because one or more lines are too long
4
node_modules/ora/node_modules/emoji-regex/index.mjs
generated
vendored
4
node_modules/ora/node_modules/emoji-regex/index.mjs
generated
vendored
File diff suppressed because one or more lines are too long
45
node_modules/ora/node_modules/emoji-regex/package.json
generated
vendored
45
node_modules/ora/node_modules/emoji-regex/package.json
generated
vendored
@@ -1,45 +0,0 @@
|
||||
{
|
||||
"name": "emoji-regex",
|
||||
"version": "10.6.0",
|
||||
"description": "A regular expression to match all Emoji-only symbols as per the Unicode Standard.",
|
||||
"homepage": "https://mths.be/emoji-regex",
|
||||
"main": "index.js",
|
||||
"module": "index.mjs",
|
||||
"types": "index.d.ts",
|
||||
"keywords": [
|
||||
"unicode",
|
||||
"regex",
|
||||
"regexp",
|
||||
"regular expressions",
|
||||
"code points",
|
||||
"symbols",
|
||||
"characters",
|
||||
"emoji"
|
||||
],
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Mathias Bynens",
|
||||
"url": "https://mathiasbynens.be/"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mathiasbynens/emoji-regex.git"
|
||||
},
|
||||
"bugs": "https://github.com/mathiasbynens/emoji-regex/issues",
|
||||
"files": [
|
||||
"LICENSE-MIT.txt",
|
||||
"index.js",
|
||||
"index.d.ts",
|
||||
"index.mjs"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "node script/build.js",
|
||||
"test": "mocha",
|
||||
"test:watch": "npm run test -- --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@unicode/unicode-17.0.0": "^1.6.10",
|
||||
"emoji-test-regex-pattern": "^2.4.0",
|
||||
"mocha": "^11.7.2"
|
||||
}
|
||||
}
|
||||
8
node_modules/ora/node_modules/log-symbols/browser.js
generated
vendored
8
node_modules/ora/node_modules/log-symbols/browser.js
generated
vendored
@@ -1,8 +1,8 @@
|
||||
const logSymbols = {
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
info: 'ℹ️',
|
||||
success: '✅',
|
||||
warning: '⚠️',
|
||||
error: '❌️',
|
||||
error: '❌️'
|
||||
};
|
||||
|
||||
export default logSymbols;
|
||||
|
||||
7
node_modules/ora/node_modules/log-symbols/index.d.ts
generated
vendored
7
node_modules/ora/node_modules/log-symbols/index.d.ts
generated
vendored
@@ -5,7 +5,7 @@ Includes fallbacks for Windows CMD which only supports a [limited character set]
|
||||
|
||||
@example
|
||||
```
|
||||
import logSymbols from 'log-symbols';
|
||||
import logSymbols = require('log-symbols');
|
||||
|
||||
console.log(logSymbols.success, 'Finished successfully!');
|
||||
// Terminals with Unicode support: ✔ Finished successfully!
|
||||
@@ -14,9 +14,12 @@ console.log(logSymbols.success, 'Finished successfully!');
|
||||
*/
|
||||
declare const logSymbols: {
|
||||
readonly info: string;
|
||||
|
||||
readonly success: string;
|
||||
|
||||
readonly warning: string;
|
||||
|
||||
readonly error: string;
|
||||
};
|
||||
|
||||
export default logSymbols;
|
||||
export = logSymbols;
|
||||
|
||||
13
node_modules/ora/node_modules/log-symbols/index.js
generated
vendored
13
node_modules/ora/node_modules/log-symbols/index.js
generated
vendored
@@ -1,20 +1,19 @@
|
||||
import chalk from 'chalk';
|
||||
import isUnicodeSupported from 'is-unicode-supported';
|
||||
'use strict';
|
||||
const chalk = require('chalk');
|
||||
const isUnicodeSupported = require('is-unicode-supported');
|
||||
|
||||
const main = {
|
||||
info: chalk.blue('ℹ'),
|
||||
success: chalk.green('✔'),
|
||||
warning: chalk.yellow('⚠'),
|
||||
error: chalk.red('✖'),
|
||||
error: chalk.red('✖')
|
||||
};
|
||||
|
||||
const fallback = {
|
||||
info: chalk.blue('i'),
|
||||
success: chalk.green('√'),
|
||||
warning: chalk.yellow('‼'),
|
||||
error: chalk.red('×'),
|
||||
error: chalk.red('×')
|
||||
};
|
||||
|
||||
const logSymbols = isUnicodeSupported() ? main : fallback;
|
||||
|
||||
export default logSymbols;
|
||||
module.exports = isUnicodeSupported() ? main : fallback;
|
||||
|
||||
12
node_modules/ora/node_modules/log-symbols/node_modules/is-unicode-supported/index.d.ts
generated
vendored
12
node_modules/ora/node_modules/log-symbols/node_modules/is-unicode-supported/index.d.ts
generated
vendored
@@ -1,12 +0,0 @@
|
||||
/**
|
||||
Detect whether the terminal supports Unicode.
|
||||
|
||||
@example
|
||||
```
|
||||
import isUnicodeSupported from 'is-unicode-supported';
|
||||
|
||||
isUnicodeSupported();
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
export default function isUnicodeSupported(): boolean;
|
||||
17
node_modules/ora/node_modules/log-symbols/node_modules/is-unicode-supported/index.js
generated
vendored
17
node_modules/ora/node_modules/log-symbols/node_modules/is-unicode-supported/index.js
generated
vendored
@@ -1,17 +0,0 @@
|
||||
import process from 'node:process';
|
||||
|
||||
export default function isUnicodeSupported() {
|
||||
if (process.platform !== 'win32') {
|
||||
return process.env.TERM !== 'linux'; // Linux console (kernel)
|
||||
}
|
||||
|
||||
return Boolean(process.env.CI)
|
||||
|| Boolean(process.env.WT_SESSION) // Windows Terminal
|
||||
|| Boolean(process.env.TERMINUS_SUBLIME) // Terminus (<0.2.27)
|
||||
|| process.env.ConEmuTask === '{cmd::Cmder}' // ConEmu and cmder
|
||||
|| process.env.TERM_PROGRAM === 'Terminus-Sublime'
|
||||
|| process.env.TERM_PROGRAM === 'vscode'
|
||||
|| process.env.TERM === 'xterm-256color'
|
||||
|| process.env.TERM === 'alacritty'
|
||||
|| process.env.TERMINAL_EMULATOR === 'JetBrains-JediTerm';
|
||||
}
|
||||
9
node_modules/ora/node_modules/log-symbols/node_modules/is-unicode-supported/license
generated
vendored
9
node_modules/ora/node_modules/log-symbols/node_modules/is-unicode-supported/license
generated
vendored
@@ -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.
|
||||
43
node_modules/ora/node_modules/log-symbols/node_modules/is-unicode-supported/package.json
generated
vendored
43
node_modules/ora/node_modules/log-symbols/node_modules/is-unicode-supported/package.json
generated
vendored
@@ -1,43 +0,0 @@
|
||||
{
|
||||
"name": "is-unicode-supported",
|
||||
"version": "1.3.0",
|
||||
"description": "Detect whether the terminal supports Unicode",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/is-unicode-supported",
|
||||
"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"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"terminal",
|
||||
"unicode",
|
||||
"detect",
|
||||
"utf8",
|
||||
"console",
|
||||
"shell",
|
||||
"support",
|
||||
"supports",
|
||||
"supported",
|
||||
"check",
|
||||
"detection"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^4.0.1",
|
||||
"tsd": "^0.19.1",
|
||||
"xo": "^0.47.0"
|
||||
}
|
||||
}
|
||||
35
node_modules/ora/node_modules/log-symbols/node_modules/is-unicode-supported/readme.md
generated
vendored
35
node_modules/ora/node_modules/log-symbols/node_modules/is-unicode-supported/readme.md
generated
vendored
@@ -1,35 +0,0 @@
|
||||
# is-unicode-supported
|
||||
|
||||
> Detect whether the terminal supports Unicode
|
||||
|
||||
This can be useful to decide whether to use Unicode characters or fallback ASCII characters in command-line output.
|
||||
|
||||
Note that the check is quite naive. It just assumes all non-Windows terminals support Unicode and hard-codes which Windows terminals that do support Unicode. However, I have been using this logic in some popular packages for years without problems.
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install is-unicode-supported
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import isUnicodeSupported from 'is-unicode-supported';
|
||||
|
||||
isUnicodeSupported();
|
||||
//=> true
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### isUnicodeSupported()
|
||||
|
||||
Returns a `boolean` for whether the terminal supports Unicode.
|
||||
|
||||
## Related
|
||||
|
||||
- [is-interactive](https://github.com/sindresorhus/is-interactive) - Check if stdout or stderr is interactive
|
||||
- [supports-color](https://github.com/chalk/supports-color) - Detect whether a terminal supports color
|
||||
- [figures](https://github.com/sindresorhus/figures) - Unicode symbols with Windows fallbacks
|
||||
- [log-symbols](https://github.com/sindresorhus/log-symbols) - Colored symbols for various log levels
|
||||
25
node_modules/ora/node_modules/log-symbols/package.json
generated
vendored
25
node_modules/ora/node_modules/log-symbols/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "log-symbols",
|
||||
"version": "6.0.0",
|
||||
"version": "4.1.0",
|
||||
"description": "Colored symbols for various log levels. Example: `✔︎ Success`",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/log-symbols",
|
||||
@@ -10,14 +10,8 @@
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": {
|
||||
"types": "./index.d.ts",
|
||||
"node": "./index.js",
|
||||
"default": "./browser.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
"node": ">=10"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
@@ -45,13 +39,14 @@
|
||||
"stdout"
|
||||
],
|
||||
"dependencies": {
|
||||
"chalk": "^5.3.0",
|
||||
"is-unicode-supported": "^1.3.0"
|
||||
"chalk": "^4.1.0",
|
||||
"is-unicode-supported": "^0.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^5.3.1",
|
||||
"strip-ansi": "^7.1.0",
|
||||
"tsd": "^0.29.0",
|
||||
"xo": "^0.56.0"
|
||||
}
|
||||
"ava": "^2.4.0",
|
||||
"strip-ansi": "^6.0.0",
|
||||
"tsd": "^0.14.0",
|
||||
"xo": "^0.38.2"
|
||||
},
|
||||
"browser": "browser.js"
|
||||
}
|
||||
|
||||
18
node_modules/ora/node_modules/log-symbols/readme.md
generated
vendored
18
node_modules/ora/node_modules/log-symbols/readme.md
generated
vendored
@@ -8,14 +8,14 @@ Includes fallbacks for Windows CMD which only supports a [limited character set]
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install log-symbols
|
||||
```
|
||||
$ npm install log-symbols
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import logSymbols from 'log-symbols';
|
||||
const logSymbols = require('log-symbols');
|
||||
|
||||
console.log(logSymbols.success, 'Finished successfully!');
|
||||
// Terminals with Unicode support: ✔ Finished successfully!
|
||||
@@ -37,3 +37,15 @@ console.log(logSymbols.success, 'Finished successfully!');
|
||||
- [py-log-symbols](https://github.com/ManrajGrover/py-log-symbols) - Python port
|
||||
- [log-symbols](https://github.com/palash25/log-symbols) - Ruby port
|
||||
- [guumaster/logsymbols](https://github.com/guumaster/logsymbols) - Golang port
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-log-symbols?utm_source=npm-log-symbols&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
|
||||
39
node_modules/ora/node_modules/string-width/index.d.ts
generated
vendored
39
node_modules/ora/node_modules/string-width/index.d.ts
generated
vendored
@@ -1,39 +0,0 @@
|
||||
export type Options = {
|
||||
/**
|
||||
Count [ambiguous width characters](https://www.unicode.org/reports/tr11/#Ambiguous) as having narrow width (count of 1) instead of wide width (count of 2).
|
||||
|
||||
@default true
|
||||
|
||||
> Ambiguous characters behave like wide or narrow characters depending on the context (language tag, script identification, associated font, source of data, or explicit markup; all can provide the context). __If the context cannot be established reliably, they should be treated as narrow characters by default.__
|
||||
> - http://www.unicode.org/reports/tr11/
|
||||
*/
|
||||
readonly ambiguousIsNarrow?: boolean;
|
||||
|
||||
/**
|
||||
Whether [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) should be counted.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly countAnsiEscapeCodes?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
Get the visual width of a string - the number of columns required to display it.
|
||||
|
||||
Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width.
|
||||
|
||||
@example
|
||||
```
|
||||
import stringWidth from 'string-width';
|
||||
|
||||
stringWidth('a');
|
||||
//=> 1
|
||||
|
||||
stringWidth('古');
|
||||
//=> 2
|
||||
|
||||
stringWidth('\u001B[1m古\u001B[22m');
|
||||
//=> 2
|
||||
```
|
||||
*/
|
||||
export default function stringWidth(string: string, options?: Options): number;
|
||||
82
node_modules/ora/node_modules/string-width/index.js
generated
vendored
82
node_modules/ora/node_modules/string-width/index.js
generated
vendored
@@ -1,82 +0,0 @@
|
||||
import stripAnsi from 'strip-ansi';
|
||||
import {eastAsianWidth} from 'get-east-asian-width';
|
||||
import emojiRegex from 'emoji-regex';
|
||||
|
||||
const segmenter = new Intl.Segmenter();
|
||||
|
||||
const defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
|
||||
|
||||
export default function stringWidth(string, options = {}) {
|
||||
if (typeof string !== 'string' || string.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const {
|
||||
ambiguousIsNarrow = true,
|
||||
countAnsiEscapeCodes = false,
|
||||
} = options;
|
||||
|
||||
if (!countAnsiEscapeCodes) {
|
||||
string = stripAnsi(string);
|
||||
}
|
||||
|
||||
if (string.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
let width = 0;
|
||||
const eastAsianWidthOptions = {ambiguousAsWide: !ambiguousIsNarrow};
|
||||
|
||||
for (const {segment: character} of segmenter.segment(string)) {
|
||||
const codePoint = character.codePointAt(0);
|
||||
|
||||
// Ignore control characters
|
||||
if (codePoint <= 0x1F || (codePoint >= 0x7F && codePoint <= 0x9F)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ignore zero-width characters
|
||||
if (
|
||||
(codePoint >= 0x20_0B && codePoint <= 0x20_0F) // Zero-width space, non-joiner, joiner, left-to-right mark, right-to-left mark
|
||||
|| codePoint === 0xFE_FF // Zero-width no-break space
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ignore combining characters
|
||||
if (
|
||||
(codePoint >= 0x3_00 && codePoint <= 0x3_6F) // Combining diacritical marks
|
||||
|| (codePoint >= 0x1A_B0 && codePoint <= 0x1A_FF) // Combining diacritical marks extended
|
||||
|| (codePoint >= 0x1D_C0 && codePoint <= 0x1D_FF) // Combining diacritical marks supplement
|
||||
|| (codePoint >= 0x20_D0 && codePoint <= 0x20_FF) // Combining diacritical marks for symbols
|
||||
|| (codePoint >= 0xFE_20 && codePoint <= 0xFE_2F) // Combining half marks
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ignore surrogate pairs
|
||||
if (codePoint >= 0xD8_00 && codePoint <= 0xDF_FF) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ignore variation selectors
|
||||
if (codePoint >= 0xFE_00 && codePoint <= 0xFE_0F) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// This covers some of the above cases, but we still keep them for performance reasons.
|
||||
if (defaultIgnorableCodePointRegex.test(character)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO: Use `/\p{RGI_Emoji}/v` when targeting Node.js 20.
|
||||
if (emojiRegex().test(character)) {
|
||||
width += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
||||
}
|
||||
|
||||
return width;
|
||||
}
|
||||
9
node_modules/ora/node_modules/string-width/license
generated
vendored
9
node_modules/ora/node_modules/string-width/license
generated
vendored
@@ -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.
|
||||
64
node_modules/ora/node_modules/string-width/package.json
generated
vendored
64
node_modules/ora/node_modules/string-width/package.json
generated
vendored
@@ -1,64 +0,0 @@
|
||||
{
|
||||
"name": "string-width",
|
||||
"version": "7.2.0",
|
||||
"description": "Get the visual width of a string - the number of columns required to display it",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/string-width",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": {
|
||||
"types": "./index.d.ts",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"string",
|
||||
"character",
|
||||
"unicode",
|
||||
"width",
|
||||
"visual",
|
||||
"column",
|
||||
"columns",
|
||||
"fullwidth",
|
||||
"full-width",
|
||||
"full",
|
||||
"ansi",
|
||||
"escape",
|
||||
"codes",
|
||||
"cli",
|
||||
"command-line",
|
||||
"terminal",
|
||||
"console",
|
||||
"cjk",
|
||||
"chinese",
|
||||
"japanese",
|
||||
"korean",
|
||||
"fixed-width",
|
||||
"east-asian-width"
|
||||
],
|
||||
"dependencies": {
|
||||
"emoji-regex": "^10.3.0",
|
||||
"get-east-asian-width": "^1.0.0",
|
||||
"strip-ansi": "^7.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^5.3.1",
|
||||
"tsd": "^0.29.0",
|
||||
"xo": "^0.56.0"
|
||||
}
|
||||
}
|
||||
66
node_modules/ora/node_modules/string-width/readme.md
generated
vendored
66
node_modules/ora/node_modules/string-width/readme.md
generated
vendored
@@ -1,66 +0,0 @@
|
||||
# string-width
|
||||
|
||||
> Get the visual width of a string - the number of columns required to display it
|
||||
|
||||
Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width.
|
||||
|
||||
Useful to be able to measure the actual width of command-line output.
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install string-width
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import stringWidth from 'string-width';
|
||||
|
||||
stringWidth('a');
|
||||
//=> 1
|
||||
|
||||
stringWidth('古');
|
||||
//=> 2
|
||||
|
||||
stringWidth('\u001B[1m古\u001B[22m');
|
||||
//=> 2
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### stringWidth(string, options?)
|
||||
|
||||
#### string
|
||||
|
||||
Type: `string`
|
||||
|
||||
The string to be counted.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### ambiguousIsNarrow
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `true`
|
||||
|
||||
Count [ambiguous width characters](https://www.unicode.org/reports/tr11/#Ambiguous) as having narrow width (count of 1) instead of wide width (count of 2).
|
||||
|
||||
> Ambiguous characters behave like wide or narrow characters depending on the context (language tag, script identification, associated font, source of data, or explicit markup; all can provide the context). **If the context cannot be established reliably, they should be treated as narrow characters by default.**
|
||||
> - http://www.unicode.org/reports/tr11/
|
||||
|
||||
##### countAnsiEscapeCodes
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `false`
|
||||
|
||||
Whether [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) should be counted.
|
||||
|
||||
## Related
|
||||
|
||||
- [string-width-cli](https://github.com/sindresorhus/string-width-cli) - CLI for this module
|
||||
- [string-length](https://github.com/sindresorhus/string-length) - Get the real length of a string
|
||||
- [widest-line](https://github.com/sindresorhus/widest-line) - Get the visual width of the widest line in a string
|
||||
- [get-east-asian-width](https://github.com/sindresorhus/get-east-asian-width) - Determine the East Asian Width of a Unicode character
|
||||
39
node_modules/ora/package.json
generated
vendored
39
node_modules/ora/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ora",
|
||||
"version": "8.2.0",
|
||||
"version": "5.4.1",
|
||||
"description": "Elegant terminal spinner",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/ora",
|
||||
@@ -10,14 +10,8 @@
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": {
|
||||
"types": "./index.d.ts",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
"node": ">=10"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
@@ -43,22 +37,21 @@
|
||||
"idle"
|
||||
],
|
||||
"dependencies": {
|
||||
"chalk": "^5.3.0",
|
||||
"cli-cursor": "^5.0.0",
|
||||
"cli-spinners": "^2.9.2",
|
||||
"is-interactive": "^2.0.0",
|
||||
"is-unicode-supported": "^2.0.0",
|
||||
"log-symbols": "^6.0.0",
|
||||
"stdin-discarder": "^0.2.2",
|
||||
"string-width": "^7.2.0",
|
||||
"strip-ansi": "^7.1.0"
|
||||
"bl": "^4.1.0",
|
||||
"chalk": "^4.1.0",
|
||||
"cli-cursor": "^3.1.0",
|
||||
"cli-spinners": "^2.5.0",
|
||||
"is-interactive": "^1.0.0",
|
||||
"is-unicode-supported": "^0.1.0",
|
||||
"log-symbols": "^4.1.0",
|
||||
"strip-ansi": "^6.0.0",
|
||||
"wcwidth": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.5.0",
|
||||
"ava": "^5.3.1",
|
||||
"get-stream": "^9.0.1",
|
||||
"transform-tty": "^1.0.11",
|
||||
"tsd": "^0.31.1",
|
||||
"xo": "^0.59.3"
|
||||
"@types/node": "^14.14.35",
|
||||
"ava": "^2.4.0",
|
||||
"get-stream": "^6.0.0",
|
||||
"tsd": "^0.14.0",
|
||||
"xo": "^0.38.2"
|
||||
}
|
||||
}
|
||||
|
||||
157
node_modules/ora/readme.md
generated
vendored
157
node_modules/ora/readme.md
generated
vendored
@@ -10,16 +10,14 @@
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install ora
|
||||
```
|
||||
|
||||
*Check out [`yocto-spinner`](https://github.com/sindresorhus/yocto-spinner) for a smaller alternative.*
|
||||
$ npm install ora
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import ora from 'ora';
|
||||
const ora = require('ora');
|
||||
|
||||
const spinner = ora('Loading unicorns').start();
|
||||
|
||||
@@ -44,7 +42,7 @@ Type: `object`
|
||||
|
||||
Type: `string`
|
||||
|
||||
The text to display next to the spinner.
|
||||
Text to display after the spinner.
|
||||
|
||||
##### prefixText
|
||||
|
||||
@@ -52,35 +50,29 @@ 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.
|
||||
|
||||
##### suffixText
|
||||
|
||||
Type: `string | () => string`
|
||||
|
||||
Text or a function that returns text to display after the spinner text. No suffix text will be displayed if set to an empty string.
|
||||
|
||||
##### spinner
|
||||
|
||||
Type: `string | object`\
|
||||
Default: `'dots'` <img src="screenshot-spinner.gif" width="14">
|
||||
|
||||
The name of one of the [provided spinners](#spinners). See `example.js` in this repo if you want to test out different spinners. On Windows (except for Windows Terminal), 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.
|
||||
|
||||
Or an object like:
|
||||
|
||||
```js
|
||||
{
|
||||
frames: ['-', '+', '-'],
|
||||
interval: 80 // Optional
|
||||
interval: 80, // Optional
|
||||
frames: ['-', '+', '-']
|
||||
}
|
||||
```
|
||||
|
||||
##### color
|
||||
|
||||
Type: `string | boolean`\
|
||||
Type: `string`\
|
||||
Default: `'cyan'`\
|
||||
Values: `'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray' | boolean`
|
||||
Values: `'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray'`
|
||||
|
||||
The color of the spinner.
|
||||
Color of the spinner.
|
||||
|
||||
##### hideCursor
|
||||
|
||||
@@ -136,48 +128,10 @@ 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 is no good way to implement discarding stdin properly there.
|
||||
This has no effect on Windows as there's no good way to implement discarding stdin properly there.
|
||||
|
||||
### Instance
|
||||
|
||||
#### .text <sup>get/set</sup>
|
||||
|
||||
Change the text displayed after the spinner.
|
||||
|
||||
#### .prefixText <sup>get/set</sup>
|
||||
|
||||
Change the text before the spinner.
|
||||
|
||||
No prefix text will be displayed if set to an empty string.
|
||||
|
||||
#### .suffixText <sup>get/set</sup>
|
||||
|
||||
Change the text after the spinner text.
|
||||
|
||||
No suffix text will be displayed if set to an empty string.
|
||||
|
||||
#### .color <sup>get/set</sup>
|
||||
|
||||
Change the spinner color.
|
||||
|
||||
#### .spinner <sup>get/set</sup>
|
||||
|
||||
Change the spinner.
|
||||
|
||||
#### .indent <sup>get/set</sup>
|
||||
|
||||
Change the spinner indent.
|
||||
|
||||
#### .isSpinning <sup>get</sup>
|
||||
|
||||
A boolean indicating whether the instance is currently spinning.
|
||||
|
||||
#### .interval <sup>get</sup>
|
||||
|
||||
The interval between each frame.
|
||||
|
||||
The interval is decided by the chosen spinner.
|
||||
|
||||
#### .start(text?)
|
||||
|
||||
Start the spinner. Returns the instance. Set the current text if `text` is provided.
|
||||
@@ -202,6 +156,10 @@ Stop the spinner, change it to a yellow `⚠` and persist the current text, or `
|
||||
|
||||
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.
|
||||
@@ -222,21 +180,14 @@ Symbol to replace the spinner with.
|
||||
Type: `string`\
|
||||
Default: Current `'text'`
|
||||
|
||||
Text to be persisted after the symbol.
|
||||
Text to be persisted after the symbol
|
||||
|
||||
###### prefixText
|
||||
|
||||
Type: `string | () => string`\
|
||||
Type: `string`\
|
||||
Default: Current `prefixText`
|
||||
|
||||
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.
|
||||
|
||||
###### suffixText
|
||||
|
||||
Type: `string | () => string`\
|
||||
Default: Current `suffixText`
|
||||
|
||||
Text or a function that returns text to be persisted after the text after the symbol. No suffix text will be displayed if set to an empty string.
|
||||
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">
|
||||
|
||||
@@ -252,73 +203,56 @@ Manually render a new frame. Returns the instance.
|
||||
|
||||
Get a new frame.
|
||||
|
||||
### oraPromise(action, text)
|
||||
### oraPromise(action, options)
|
||||
#### .text
|
||||
|
||||
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.
|
||||
Change the text after the spinner.
|
||||
|
||||
```js
|
||||
import {oraPromise} from 'ora';
|
||||
#### .prefixText
|
||||
|
||||
await oraPromise(somePromise);
|
||||
```
|
||||
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.
|
||||
|
||||
### ora.promise(action, text)
|
||||
### ora.promise(action, options)
|
||||
|
||||
Starts a spinner for a promise. The spinner is stopped with `.succeed()` if the promise fulfills or with `.fail()` if it rejects. Returns the spinner instance.
|
||||
|
||||
#### 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`.
|
||||
|
||||
### spinners
|
||||
|
||||
Type: `Record<string, Spinner>`
|
||||
|
||||
All [provided spinners](https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json).
|
||||
Type: `Promise`
|
||||
|
||||
## FAQ
|
||||
|
||||
### How do I change the color of the text?
|
||||
|
||||
Use [`chalk`](https://github.com/chalk/chalk) or [`yoctocolors`](https://github.com/sindresorhus/yoctocolors):
|
||||
Use [Chalk](https://github.com/chalk/chalk):
|
||||
|
||||
```js
|
||||
import ora from 'ora';
|
||||
import chalk from 'chalk';
|
||||
const ora = require('ora');
|
||||
const chalk = require('chalk');
|
||||
|
||||
const spinner = ora(`Loading ${chalk.red('unicorns')}`).start();
|
||||
```
|
||||
|
||||
### Why does the spinner freeze?
|
||||
|
||||
JavaScript is single-threaded, so any synchronous operations will block the spinner's animation. To avoid this, prefer using asynchronous operations.
|
||||
JavaScript is single-threaded, so synchronous operations blocks the thread, including the spinner animation. Prefer asynchronous operations whenever possible.
|
||||
|
||||
## Related
|
||||
|
||||
- [yocto-spinner](https://github.com/sindresorhus/yocto-spinner) - Tiny terminal spinner
|
||||
- [cli-spinners](https://github.com/sindresorhus/cli-spinners) - Spinners for use in the terminal
|
||||
|
||||
**Ports**
|
||||
|
||||
- [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
|
||||
@@ -326,4 +260,5 @@ JavaScript is single-threaded, so any synchronous operations will block the spin
|
||||
- [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 🦕
|
||||
|
||||
Reference in New Issue
Block a user