first commit

This commit is contained in:
jefferyzhao
2025-07-31 17:44:12 +08:00
commit b9bdc8598b
42390 changed files with 4467935 additions and 0 deletions

257
node_modules/ora/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,257 @@
/// <reference types="node"/>
import {SpinnerName} from 'cli-spinners';
declare namespace ora {
interface Spinner {
readonly interval?: number;
readonly frames: string[];
}
type Color =
| 'black'
| 'red'
| 'green'
| 'yellow'
| 'blue'
| 'magenta'
| 'cyan'
| 'white'
| 'gray';
interface Options {
/**
Text to display after the spinner.
*/
readonly text?: string;
/**
Text to display before the spinner.
*/
readonly prefixText?: string;
/**
Name of one of the provided spinners. See [`example.js`](https://github.com/BendingBender/ora/blob/master/example.js) in this repo if you want to test out different spinners. On Windows, it will always use the line spinner as the Windows command-line doesn't have proper Unicode support.
@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 value: 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;
}
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 to be persisted before the symbol. Default: Current `prefixText`.
*/
readonly prefixText?: string;
}
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 before the spinner.
*/
prefixText: string;
/**
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.
*/
frame(): Ora;
}
}
declare const ora: {
/**
Elegant terminal spinner.
@param options - If a string is provided, it is treated as a shortcut for `options.text`.
@example
```
import ora = require('ora');
const spinner = ora('Loading unicorns').start();
setTimeout(() => {
spinner.color = 'yellow';
spinner.text = 'Loading rainbows';
}, 1000);
```
*/
(options?: ora.Options | string): ora.Ora;
/**
Starts a spinner for a promise. 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.
@param options - If a string is provided, it is treated as a shortcut for `options.text`.
@returns The spinner instance.
*/
promise(
action: PromiseLike<unknown>,
options?: ora.Options | string
): ora.Ora;
// TODO: Remove this for the next major release
default: typeof ora;
};
export = ora;

246
node_modules/ora/index.js generated vendored Normal file
View File

@ -0,0 +1,246 @@
'use strict';
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 TEXT = Symbol('text');
const PREFIX_TEXT = Symbol('prefixText');
class Ora {
constructor(options) {
if (typeof options === 'string') {
options = {
text: options
};
}
this.options = Object.assign({
text: '',
color: 'cyan',
stream: process.stderr
}, 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 = null;
this.isEnabled = typeof this.options.isEnabled === 'boolean' ? this.options.isEnabled : ((this.stream && this.stream.isTTY) && !process.env.CI);
// Set *after* `this.stream`
this.text = this.options.text;
this.prefixText = this.options.prefixText;
this.linesToClear = 0;
this.indent = this.options.indent;
}
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;
}
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 (process.platform === 'win32') {
this._spinner = cliSpinners.line;
} else if (spinner === undefined) {
// Set default spinner
this._spinner = cliSpinners.dots;
} else if (cliSpinners[spinner]) {
this._spinner = cliSpinners[spinner];
} else {
throw new Error(`There is no built-in spinner named '${spinner}'. See https://github.com/sindresorhus/cli-spinners/blob/master/spinners.json for a full list.`);
}
}
get text() {
return this[TEXT];
}
get prefixText() {
return this[PREFIX_TEXT];
}
get isSpinning() {
return this.id !== null;
}
updateLineCount() {
const columns = this.stream.columns || 80;
const fullPrefixText = (typeof this[PREFIX_TEXT] === 'string') ? this[PREFIX_TEXT] + '-' : '';
this.lineCount = stripAnsi(fullPrefixText + '--' + this[TEXT]).split('\n').reduce((count, line) => {
return count + Math.max(1, Math.ceil(wcwidth(line) / columns));
}, 0);
}
set text(value) {
this[TEXT] = value;
this.updateLineCount();
}
set prefixText(value) {
this[PREFIX_TEXT] = value;
this.updateLineCount();
}
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 + ' ' : '';
const fullText = typeof this.text === 'string' ? ' ' + this.text : '';
return fullPrefixText + frame + fullText;
}
clear() {
if (!this.isEnabled || !this.stream.isTTY) {
return this;
}
for (let i = 0; i < this.linesToClear; i++) {
if (i > 0) {
this.stream.moveCursor(0, -1);
}
this.stream.clearLine();
this.stream.cursorTo(this.indent);
}
this.linesToClear = 0;
return this;
}
render() {
this.clear();
this.stream.write(this.frame());
this.linesToClear = this.lineCount;
return this;
}
start(text) {
if (text) {
this.text = text;
}
if (!this.isEnabled) {
this.stream.write(`- ${this.text}\n`);
return this;
}
if (this.isSpinning) {
return this;
}
if (this.hideCursor) {
cliCursor.hide(this.stream);
}
this.render();
this.id = setInterval(this.render.bind(this), this.interval);
return this;
}
stop() {
if (!this.isEnabled) {
return this;
}
clearInterval(this.id);
this.id = null;
this.frameIndex = 0;
this.clear();
if (this.hideCursor) {
cliCursor.show(this.stream);
}
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 = {}) {
const prefixText = options.prefixText || this.prefixText;
const fullPrefixText = (typeof prefixText === 'string') ? prefixText + ' ' : '';
const text = options.text || this.text;
const fullText = (typeof text === 'string') ? ' ' + text : '';
this.stop();
this.stream.write(`${fullPrefixText}${options.symbol || ' '}${fullText}\n`);
return this;
}
}
const oraFactory = function (opts) {
return new Ora(opts);
};
module.exports = oraFactory;
// TODO: Remove this for the next major release
module.exports.default = oraFactory;
module.exports.promise = (action, options) => {
if (typeof action.then !== 'function') {
throw new TypeError('Parameter `action` must be a Promise');
}
const spinner = new Ora(options);
spinner.start();
action.then(
() => {
spinner.succeed();
},
() => {
spinner.fail();
}
);
return spinner;
};

9
node_modules/ora/license generated vendored Normal file
View File

@ -0,0 +1,9 @@
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.

14
node_modules/ora/node_modules/ansi-regex/index.js generated vendored Normal file
View File

@ -0,0 +1,14 @@
'use strict';
module.exports = options => {
options = Object.assign({
onlyFirst: false
}, options);
const pattern = [
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
].join('|');
return new RegExp(pattern, options.onlyFirst ? undefined : 'g');
};

9
node_modules/ora/node_modules/ansi-regex/license generated vendored Normal file
View File

@ -0,0 +1,9 @@
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.

53
node_modules/ora/node_modules/ansi-regex/package.json generated vendored Normal file
View File

@ -0,0 +1,53 @@
{
"name": "ansi-regex",
"version": "4.1.1",
"description": "Regular expression for matching ANSI escape codes",
"license": "MIT",
"repository": "chalk/ansi-regex",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava",
"view-supported": "node fixtures/view-codes.js"
},
"files": [
"index.js"
],
"keywords": [
"ansi",
"styles",
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"string",
"tty",
"escape",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"command-line",
"text",
"regex",
"regexp",
"re",
"match",
"test",
"find",
"pattern"
],
"devDependencies": {
"ava": "^0.25.0",
"xo": "^0.23.0"
}
}

87
node_modules/ora/node_modules/ansi-regex/readme.md generated vendored Normal file
View File

@ -0,0 +1,87 @@
# ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex)
> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code)
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-ansi-regex?utm_source=npm-ansi-regex&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>
---
## Install
```
$ npm install ansi-regex
```
## Usage
```js
const ansiRegex = require('ansi-regex');
ansiRegex().test('\u001B[4mcake\u001B[0m');
//=> true
ansiRegex().test('cake');
//=> false
'\u001B[4mcake\u001B[0m'.match(ansiRegex());
//=> ['\u001B[4m', '\u001B[0m']
'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
//=> ['\u001B[4m']
'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
```
## API
### ansiRegex([options])
Returns a regex for matching ANSI escape codes.
#### options
##### onlyFirst
Type: `boolean`<br>
Default: `false` *(Matches any ANSI escape codes in a string)*
Match only the first ANSI escape.
## FAQ
### Why do you test for codes not in the ECMA 48 standard?
Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.
On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out.
## Security
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
## Maintainers
- [Sindre Sorhus](https://github.com/sindresorhus)
- [Josh Junon](https://github.com/qix-)
## License
MIT

39
node_modules/ora/node_modules/cli-cursor/index.js generated vendored Normal file
View File

@ -0,0 +1,39 @@
'use strict';
const restoreCursor = require('restore-cursor');
let hidden = false;
exports.show = stream => {
const s = stream || process.stderr;
if (!s.isTTY) {
return;
}
hidden = false;
s.write('\u001b[?25h');
};
exports.hide = stream => {
const s = stream || process.stderr;
if (!s.isTTY) {
return;
}
restoreCursor();
hidden = true;
s.write('\u001b[?25l');
};
exports.toggle = (force, stream) => {
if (force !== undefined) {
hidden = force;
}
if (hidden) {
exports.show(stream);
} else {
exports.hide(stream);
}
};

21
node_modules/ora/node_modules/cli-cursor/license generated vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
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.

46
node_modules/ora/node_modules/cli-cursor/package.json generated vendored Normal file
View File

@ -0,0 +1,46 @@
{
"name": "cli-cursor",
"version": "2.1.0",
"description": "Toggle the CLI cursor",
"license": "MIT",
"repository": "sindresorhus/cli-cursor",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"cli",
"cursor",
"ansi",
"toggle",
"display",
"show",
"hide",
"term",
"terminal",
"console",
"tty",
"shell",
"command-line"
],
"dependencies": {
"restore-cursor": "^2.0.0"
},
"devDependencies": {
"ava": "*",
"xo": "*"
},
"xo": {
"esnext": true
}
}

45
node_modules/ora/node_modules/cli-cursor/readme.md generated vendored Normal file
View File

@ -0,0 +1,45 @@
# cli-cursor [![Build Status](https://travis-ci.org/sindresorhus/cli-cursor.svg?branch=master)](https://travis-ci.org/sindresorhus/cli-cursor)
> Toggle the CLI cursor
The cursor is [gracefully restored](https://github.com/sindresorhus/restore-cursor) if the process exits.
## Install
```
$ npm install --save cli-cursor
```
## Usage
```js
const cliCursor = require('cli-cursor');
cliCursor.hide();
const unicornsAreAwesome = true;
cliCursor.toggle(unicornsAreAwesome);
```
## API
### .show([stream])
### .hide([stream])
### .toggle(force, [stream])
`force` is useful to show or hide the cursor based on a boolean.
#### stream
Type: `Stream`<br>
Default: `process.stderr`
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

9
node_modules/ora/node_modules/mimic-fn/index.js generated vendored Normal file
View File

@ -0,0 +1,9 @@
'use strict';
module.exports = (to, from) => {
// TODO: use `Reflect.ownKeys()` when targeting Node.js 6
for (const prop of Object.getOwnPropertyNames(from).concat(Object.getOwnPropertySymbols(from))) {
Object.defineProperty(to, prop, Object.getOwnPropertyDescriptor(from, prop));
}
return to;
};

9
node_modules/ora/node_modules/mimic-fn/license generated vendored Normal file
View File

@ -0,0 +1,9 @@
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.

40
node_modules/ora/node_modules/mimic-fn/package.json generated vendored Normal file
View File

@ -0,0 +1,40 @@
{
"name": "mimic-fn",
"version": "1.2.0",
"description": "Make a function mimic another one",
"license": "MIT",
"repository": "sindresorhus/mimic-fn",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"function",
"mimic",
"imitate",
"rename",
"copy",
"inherit",
"properties",
"name",
"func",
"fn",
"set",
"infer",
"change"
],
"devDependencies": {
"ava": "*",
"xo": "*"
}
}

68
node_modules/ora/node_modules/mimic-fn/readme.md generated vendored Normal file
View File

@ -0,0 +1,68 @@
# mimic-fn [![Build Status](https://travis-ci.org/sindresorhus/mimic-fn.svg?branch=master)](https://travis-ci.org/sindresorhus/mimic-fn)
> Make a function mimic another one
Useful when you wrap a function in another function and like to preserve the original name and other properties.
## Install
```
$ npm install mimic-fn
```
## Usage
```js
const mimicFn = require('mimic-fn');
function foo() {}
foo.unicorn = '🦄';
function wrapper() {
return foo() {};
}
console.log(wrapper.name);
//=> 'wrapper'
mimicFn(wrapper, foo);
console.log(wrapper.name);
//=> 'foo'
console.log(wrapper.unicorn);
//=> '🦄'
```
## API
It will copy over the properties `name`, `length`, `displayName`, and any custom properties you may have set.
### mimicFn(to, from)
It will modify `to` and return it.
#### to
Type: `Function`
Mimicking function.
#### from
Type: `Function`
Function to mimic.
## Related
- [rename-fn](https://github.com/sindresorhus/rename-fn) - Rename a function
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

39
node_modules/ora/node_modules/onetime/index.js generated vendored Normal file
View File

@ -0,0 +1,39 @@
'use strict';
const mimicFn = require('mimic-fn');
module.exports = (fn, opts) => {
// TODO: Remove this in v3
if (opts === true) {
throw new TypeError('The second argument is now an options object');
}
if (typeof fn !== 'function') {
throw new TypeError('Expected a function');
}
opts = opts || {};
let ret;
let called = false;
const fnName = fn.displayName || fn.name || '<anonymous>';
const onetime = function () {
if (called) {
if (opts.throw === true) {
throw new Error(`Function \`${fnName}\` can only be called once`);
}
return ret;
}
called = true;
ret = fn.apply(this, arguments);
fn = null;
return ret;
};
mimicFn(onetime, fn);
return onetime;
};

21
node_modules/ora/node_modules/onetime/license generated vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
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.

40
node_modules/ora/node_modules/onetime/package.json generated vendored Normal file
View File

@ -0,0 +1,40 @@
{
"name": "onetime",
"version": "2.0.1",
"description": "Ensure a function is only called once",
"license": "MIT",
"repository": "sindresorhus/onetime",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"once",
"function",
"one",
"onetime",
"func",
"fn",
"single",
"call",
"called",
"prevent"
],
"dependencies": {
"mimic-fn": "^1.0.0"
},
"devDependencies": {
"ava": "*",
"xo": "*"
}
}

65
node_modules/ora/node_modules/onetime/readme.md generated vendored Normal file
View File

@ -0,0 +1,65 @@
# onetime [![Build Status](https://travis-ci.org/sindresorhus/onetime.svg?branch=master)](https://travis-ci.org/sindresorhus/onetime)
> Ensure a function is only called once
When called multiple times it will return the return value from the first call.
*Unlike the module [once](https://github.com/isaacs/once), this one isn't naughty extending `Function.prototype`.*
## Install
```
$ npm install --save onetime
```
## Usage
```js
let i = 0;
const foo = onetime(() => i++);
foo(); //=> 0
foo(); //=> 0
foo(); //=> 0
```
```js
const foo = onetime(() => {}, {throw: true});
foo();
foo();
//=> Error: Function `foo` can only be called once
```
## API
### onetime(fn, [options])
Returns a function that only calls `fn` once.
#### fn
Type: `Function`
Function that should only be called once.
#### options
Type: `Object`
##### throw
Type: `boolean`<br>
Default: `false`
Throw an error when called more than once.
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

View File

@ -0,0 +1,9 @@
'use strict';
const onetime = require('onetime');
const signalExit = require('signal-exit');
module.exports = onetime(() => {
signalExit(() => {
process.stderr.write('\u001b[?25h');
}, {alwaysLast: true});
});

21
node_modules/ora/node_modules/restore-cursor/license generated vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
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.

View File

@ -0,0 +1,44 @@
{
"name": "restore-cursor",
"version": "2.0.0",
"description": "Gracefully restore the CLI cursor on exit",
"license": "MIT",
"repository": "sindresorhus/restore-cursor",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"files": [
"index.js"
],
"keywords": [
"exit",
"quit",
"process",
"graceful",
"shutdown",
"sigterm",
"sigint",
"terminate",
"kill",
"stop",
"cli",
"cursor",
"ansi",
"show",
"term",
"terminal",
"console",
"tty",
"shell",
"command-line"
],
"dependencies": {
"onetime": "^2.0.0",
"signal-exit": "^3.0.2"
}
}

25
node_modules/ora/node_modules/restore-cursor/readme.md generated vendored Normal file
View File

@ -0,0 +1,25 @@
# restore-cursor
> Gracefully restore the CLI cursor on exit
Prevent the cursor you've hidden interactively from remaining hidden if the process crashes.
## Install
```
$ npm install --save restore-cursor
```
## Usage
```js
const restoreCursor = require('restore-cursor');
restoreCursor();
```
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

15
node_modules/ora/node_modules/strip-ansi/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,15 @@
/**
Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string.
@example
```
import stripAnsi from 'strip-ansi';
stripAnsi('\u001B[4mUnicorn\u001B[0m');
//=> 'Unicorn'
stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007');
//=> 'Click'
```
*/
export default function stripAnsi(string: string): string;

7
node_modules/ora/node_modules/strip-ansi/index.js generated vendored Normal file
View File

@ -0,0 +1,7 @@
'use strict';
const ansiRegex = require('ansi-regex');
const stripAnsi = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string;
module.exports = stripAnsi;
module.exports.default = stripAnsi;

9
node_modules/ora/node_modules/strip-ansi/license generated vendored Normal file
View File

@ -0,0 +1,9 @@
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.

54
node_modules/ora/node_modules/strip-ansi/package.json generated vendored Normal file
View File

@ -0,0 +1,54 @@
{
"name": "strip-ansi",
"version": "5.2.0",
"description": "Strip ANSI escape codes from a string",
"license": "MIT",
"repository": "chalk/strip-ansi",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava && tsd-check"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"strip",
"trim",
"remove",
"ansi",
"styles",
"color",
"colour",
"colors",
"terminal",
"console",
"string",
"tty",
"escape",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"log",
"logging",
"command-line",
"text"
],
"dependencies": {
"ansi-regex": "^4.1.0"
},
"devDependencies": {
"ava": "^1.3.1",
"tsd-check": "^0.5.0",
"xo": "^0.24.0"
}
}

61
node_modules/ora/node_modules/strip-ansi/readme.md generated vendored Normal file
View File

@ -0,0 +1,61 @@
# strip-ansi [![Build Status](https://travis-ci.org/chalk/strip-ansi.svg?branch=master)](https://travis-ci.org/chalk/strip-ansi)
> Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-strip-ansi?utm_source=npm-strip-ansi&utm_medium=referral&utm_campaign=readme">Get professional support for 'strip-ansi' 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>
---
## Install
```
$ npm install strip-ansi
```
## Usage
```js
const stripAnsi = require('strip-ansi');
stripAnsi('\u001B[4mUnicorn\u001B[0m');
//=> 'Unicorn'
stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007');
//=> 'Click'
```
## Security
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
## Related
- [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module
- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Streaming version of this module
- [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
- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
## Maintainers
- [Sindre Sorhus](https://github.com/sindresorhus)
- [Josh Junon](https://github.com/qix-)
## License
MIT

53
node_modules/ora/package.json generated vendored Normal file
View File

@ -0,0 +1,53 @@
{
"name": "ora",
"version": "3.4.0",
"description": "Elegant terminal spinner",
"license": "MIT",
"repository": "sindresorhus/ora",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"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": {
"chalk": "^2.4.2",
"cli-cursor": "^2.1.0",
"cli-spinners": "^2.0.0",
"log-symbols": "^2.2.0",
"strip-ansi": "^5.2.0",
"wcwidth": "^1.0.1"
},
"devDependencies": {
"@types/node": "^11.13.0",
"ava": "^1.4.1",
"get-stream": "^4.1.0",
"tsd": "^0.7.2",
"xo": "^0.24.0"
}
}

239
node_modules/ora/readme.md generated vendored Normal file
View File

@ -0,0 +1,239 @@
# ora [![Build Status](https://travis-ci.org/sindresorhus/ora.svg?branch=master)](https://travis-ci.org/sindresorhus/ora)
> Elegant terminal spinner
<p align="center">
<br>
<img src="screenshot.svg" width="500">
<br>
</p>
## Install
```
$ npm install ora
```
<a href="https://www.patreon.com/sindresorhus">
<img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="160">
</a>
## Usage
```js
const ora = require('ora');
const spinner = ora('Loading unicorns').start();
setTimeout(() => {
spinner.color = 'yellow';
spinner.text = 'Loading rainbows';
}, 1000);
```
## API
### ora([options|text])
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`
Text to display before the spinner.
##### spinner
Type: `string` `Object`<br>
Default: `dots` <img src="screenshot-spinner.gif" width="14">
Name of one of the [provided spinners](https://github.com/sindresorhus/cli-spinners/blob/master/spinners.json). See `example.js` in this repo if you want to test out different spinners. On Windows, it will always use the `line` spinner as the Windows command-line doesn't have proper Unicode support.
Or an object like:
```js
{
interval: 80, // Optional
frames: ['-', '+', '-']
}
```
##### color
Type: `string`<br>
Default: `cyan`<br>
Values: `black` `red` `green` `yellow` `blue` `magenta` `cyan` `white` `gray`
Color of the spinner.
##### hideCursor
Type: `boolean`<br>
Default: `true`
Set to `false` to stop Ora from hiding the cursor.
##### indent
Type: `number`<br>
Default: `0`
Indent the spinner with the given number of spaces.
##### interval
Type: `number`<br>
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`<br>
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.
### 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`<br>
Default: `' '`
Symbol to replace the spinner with.
###### text
Type: `string`<br>
Default: Current `text`
Text to be persisted after the symbol
###### prefixText
Type: `string`<br>
Default: Current `prefixText`
Text to be persisted before the symbol.
<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.
#### .color
Change the spinner color.
#### .spinner
Change the spinner.
#### .indent
Change the spinner indent.
### ora.promise(action, [options|text])
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`
## 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
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)