update node_modules
This commit is contained in:
parent
4889aac148
commit
195fbc52ad
431 changed files with 52587 additions and 0 deletions
26
node_modules/@colors/colors/LICENSE
generated
vendored
Normal file
26
node_modules/@colors/colors/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Original Library
|
||||||
|
- Copyright (c) Marak Squires
|
||||||
|
|
||||||
|
Additional Functionality
|
||||||
|
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||||
|
- Copyright (c) DABH (https://github.com/DABH)
|
||||||
|
|
||||||
|
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.
|
||||||
219
node_modules/@colors/colors/README.md
generated
vendored
Normal file
219
node_modules/@colors/colors/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,219 @@
|
||||||
|
# @colors/colors ("colors.js")
|
||||||
|
[](https://github.com/DABH/colors.js/actions/workflows/ci.yml)
|
||||||
|
[](https://www.npmjs.org/package/@colors/colors)
|
||||||
|
|
||||||
|
Please check out the [roadmap](ROADMAP.md) for upcoming features and releases. Please open Issues to provide feedback.
|
||||||
|
|
||||||
|
## get color and style in your node.js console
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
npm install @colors/colors
|
||||||
|
|
||||||
|
## colors and styles!
|
||||||
|
|
||||||
|
### text colors
|
||||||
|
|
||||||
|
- black
|
||||||
|
- red
|
||||||
|
- green
|
||||||
|
- yellow
|
||||||
|
- blue
|
||||||
|
- magenta
|
||||||
|
- cyan
|
||||||
|
- white
|
||||||
|
- gray
|
||||||
|
- grey
|
||||||
|
|
||||||
|
### bright text colors
|
||||||
|
|
||||||
|
- brightRed
|
||||||
|
- brightGreen
|
||||||
|
- brightYellow
|
||||||
|
- brightBlue
|
||||||
|
- brightMagenta
|
||||||
|
- brightCyan
|
||||||
|
- brightWhite
|
||||||
|
|
||||||
|
### background colors
|
||||||
|
|
||||||
|
- bgBlack
|
||||||
|
- bgRed
|
||||||
|
- bgGreen
|
||||||
|
- bgYellow
|
||||||
|
- bgBlue
|
||||||
|
- bgMagenta
|
||||||
|
- bgCyan
|
||||||
|
- bgWhite
|
||||||
|
- bgGray
|
||||||
|
- bgGrey
|
||||||
|
|
||||||
|
### bright background colors
|
||||||
|
|
||||||
|
- bgBrightRed
|
||||||
|
- bgBrightGreen
|
||||||
|
- bgBrightYellow
|
||||||
|
- bgBrightBlue
|
||||||
|
- bgBrightMagenta
|
||||||
|
- bgBrightCyan
|
||||||
|
- bgBrightWhite
|
||||||
|
|
||||||
|
### styles
|
||||||
|
|
||||||
|
- reset
|
||||||
|
- bold
|
||||||
|
- dim
|
||||||
|
- italic
|
||||||
|
- underline
|
||||||
|
- inverse
|
||||||
|
- hidden
|
||||||
|
- strikethrough
|
||||||
|
|
||||||
|
### extras
|
||||||
|
|
||||||
|
- rainbow
|
||||||
|
- zebra
|
||||||
|
- america
|
||||||
|
- trap
|
||||||
|
- random
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
By popular demand, `@colors/colors` now ships with two types of usages!
|
||||||
|
|
||||||
|
The super nifty way
|
||||||
|
|
||||||
|
```js
|
||||||
|
var colors = require('@colors/colors');
|
||||||
|
|
||||||
|
console.log('hello'.green); // outputs green text
|
||||||
|
console.log('i like cake and pies'.underline.red); // outputs red underlined text
|
||||||
|
console.log('inverse the color'.inverse); // inverses the color
|
||||||
|
console.log('OMG Rainbows!'.rainbow); // rainbow
|
||||||
|
console.log('Run the trap'.trap); // Drops the bass
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
or a slightly less nifty way which doesn't extend `String.prototype`
|
||||||
|
|
||||||
|
```js
|
||||||
|
var colors = require('@colors/colors/safe');
|
||||||
|
|
||||||
|
console.log(colors.green('hello')); // outputs green text
|
||||||
|
console.log(colors.red.underline('i like cake and pies')); // outputs red underlined text
|
||||||
|
console.log(colors.inverse('inverse the color')); // inverses the color
|
||||||
|
console.log(colors.rainbow('OMG Rainbows!')); // rainbow
|
||||||
|
console.log(colors.trap('Run the trap')); // Drops the bass
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
I prefer the first way. Some people seem to be afraid of extending `String.prototype` and prefer the second way.
|
||||||
|
|
||||||
|
If you are writing good code you will never have an issue with the first approach. If you really don't want to touch `String.prototype`, the second usage will not touch `String` native object.
|
||||||
|
|
||||||
|
## Enabling/Disabling Colors
|
||||||
|
|
||||||
|
The package will auto-detect whether your terminal can use colors and enable/disable accordingly. When colors are disabled, the color functions do nothing. You can override this with a command-line flag:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node myapp.js --no-color
|
||||||
|
node myapp.js --color=false
|
||||||
|
|
||||||
|
node myapp.js --color
|
||||||
|
node myapp.js --color=true
|
||||||
|
node myapp.js --color=always
|
||||||
|
|
||||||
|
FORCE_COLOR=1 node myapp.js
|
||||||
|
```
|
||||||
|
|
||||||
|
Or in code:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var colors = require('@colors/colors');
|
||||||
|
colors.enable();
|
||||||
|
colors.disable();
|
||||||
|
```
|
||||||
|
|
||||||
|
## Console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data)
|
||||||
|
|
||||||
|
```js
|
||||||
|
var name = 'Beowulf';
|
||||||
|
console.log(colors.green('Hello %s'), name);
|
||||||
|
// outputs -> 'Hello Beowulf'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Custom themes
|
||||||
|
|
||||||
|
### Using standard API
|
||||||
|
|
||||||
|
```js
|
||||||
|
|
||||||
|
var colors = require('@colors/colors');
|
||||||
|
|
||||||
|
colors.setTheme({
|
||||||
|
silly: 'rainbow',
|
||||||
|
input: 'grey',
|
||||||
|
verbose: 'cyan',
|
||||||
|
prompt: 'grey',
|
||||||
|
info: 'green',
|
||||||
|
data: 'grey',
|
||||||
|
help: 'cyan',
|
||||||
|
warn: 'yellow',
|
||||||
|
debug: 'blue',
|
||||||
|
error: 'red'
|
||||||
|
});
|
||||||
|
|
||||||
|
// outputs red text
|
||||||
|
console.log("this is an error".error);
|
||||||
|
|
||||||
|
// outputs yellow text
|
||||||
|
console.log("this is a warning".warn);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using string safe API
|
||||||
|
|
||||||
|
```js
|
||||||
|
var colors = require('@colors/colors/safe');
|
||||||
|
|
||||||
|
// set single property
|
||||||
|
var error = colors.red;
|
||||||
|
error('this is red');
|
||||||
|
|
||||||
|
// set theme
|
||||||
|
colors.setTheme({
|
||||||
|
silly: 'rainbow',
|
||||||
|
input: 'grey',
|
||||||
|
verbose: 'cyan',
|
||||||
|
prompt: 'grey',
|
||||||
|
info: 'green',
|
||||||
|
data: 'grey',
|
||||||
|
help: 'cyan',
|
||||||
|
warn: 'yellow',
|
||||||
|
debug: 'blue',
|
||||||
|
error: 'red'
|
||||||
|
});
|
||||||
|
|
||||||
|
// outputs red text
|
||||||
|
console.log(colors.error("this is an error"));
|
||||||
|
|
||||||
|
// outputs yellow text
|
||||||
|
console.log(colors.warn("this is a warning"));
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### Combining Colors
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var colors = require('@colors/colors');
|
||||||
|
|
||||||
|
colors.setTheme({
|
||||||
|
custom: ['red', 'underline']
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('test'.custom);
|
||||||
|
```
|
||||||
|
|
||||||
|
*Protip: There is a secret undocumented style in `colors`. If you find the style you can summon him.*
|
||||||
83
node_modules/@colors/colors/examples/normal-usage.js
generated
vendored
Normal file
83
node_modules/@colors/colors/examples/normal-usage.js
generated
vendored
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
var colors = require('../lib/index');
|
||||||
|
|
||||||
|
console.log('First some yellow text'.yellow);
|
||||||
|
|
||||||
|
console.log('Underline that text'.yellow.underline);
|
||||||
|
|
||||||
|
console.log('Make it bold and red'.red.bold);
|
||||||
|
|
||||||
|
console.log(('Double Raindows All Day Long').rainbow);
|
||||||
|
|
||||||
|
console.log('Drop the bass'.trap);
|
||||||
|
|
||||||
|
console.log('DROP THE RAINBOW BASS'.trap.rainbow);
|
||||||
|
|
||||||
|
// styles not widely supported
|
||||||
|
console.log('Chains are also cool.'.bold.italic.underline.red);
|
||||||
|
|
||||||
|
// styles not widely supported
|
||||||
|
console.log('So '.green + 'are'.underline + ' ' + 'inverse'.inverse
|
||||||
|
+ ' styles! '.yellow.bold);
|
||||||
|
console.log('Zebras are so fun!'.zebra);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Remark: .strikethrough may not work with Mac OS Terminal App
|
||||||
|
//
|
||||||
|
console.log('This is ' + 'not'.strikethrough + ' fun.');
|
||||||
|
|
||||||
|
console.log('Background color attack!'.black.bgWhite);
|
||||||
|
console.log('Use random styles on everything!'.random);
|
||||||
|
console.log('America, Heck Yeah!'.america);
|
||||||
|
|
||||||
|
// eslint-disable-next-line max-len
|
||||||
|
console.log('Blindingly '.brightCyan + 'bright? '.brightRed + 'Why '.brightYellow + 'not?!'.brightGreen);
|
||||||
|
|
||||||
|
console.log('Setting themes is useful');
|
||||||
|
|
||||||
|
//
|
||||||
|
// Custom themes
|
||||||
|
//
|
||||||
|
console.log('Generic logging theme as JSON'.green.bold.underline);
|
||||||
|
// Load theme with JSON literal
|
||||||
|
colors.setTheme({
|
||||||
|
silly: 'rainbow',
|
||||||
|
input: 'grey',
|
||||||
|
verbose: 'cyan',
|
||||||
|
prompt: 'grey',
|
||||||
|
info: 'green',
|
||||||
|
data: 'grey',
|
||||||
|
help: 'cyan',
|
||||||
|
warn: 'yellow',
|
||||||
|
debug: 'blue',
|
||||||
|
error: 'red',
|
||||||
|
});
|
||||||
|
|
||||||
|
// outputs red text
|
||||||
|
console.log('this is an error'.error);
|
||||||
|
|
||||||
|
// outputs yellow text
|
||||||
|
console.log('this is a warning'.warn);
|
||||||
|
|
||||||
|
// outputs grey text
|
||||||
|
console.log('this is an input'.input);
|
||||||
|
|
||||||
|
console.log('Generic logging theme as file'.green.bold.underline);
|
||||||
|
|
||||||
|
// Load a theme from file
|
||||||
|
try {
|
||||||
|
colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
// outputs red text
|
||||||
|
console.log('this is an error'.error);
|
||||||
|
|
||||||
|
// outputs yellow text
|
||||||
|
console.log('this is a warning'.warn);
|
||||||
|
|
||||||
|
// outputs grey text
|
||||||
|
console.log('this is an input'.input);
|
||||||
|
|
||||||
|
// console.log("Don't summon".zalgo)
|
||||||
|
|
||||||
80
node_modules/@colors/colors/examples/safe-string.js
generated
vendored
Normal file
80
node_modules/@colors/colors/examples/safe-string.js
generated
vendored
Normal file
|
|
@ -0,0 +1,80 @@
|
||||||
|
var colors = require('../safe');
|
||||||
|
|
||||||
|
console.log(colors.yellow('First some yellow text'));
|
||||||
|
|
||||||
|
console.log(colors.yellow.underline('Underline that text'));
|
||||||
|
|
||||||
|
console.log(colors.red.bold('Make it bold and red'));
|
||||||
|
|
||||||
|
console.log(colors.rainbow('Double Raindows All Day Long'));
|
||||||
|
|
||||||
|
console.log(colors.trap('Drop the bass'));
|
||||||
|
|
||||||
|
console.log(colors.rainbow(colors.trap('DROP THE RAINBOW BASS')));
|
||||||
|
|
||||||
|
// styles not widely supported
|
||||||
|
console.log(colors.bold.italic.underline.red('Chains are also cool.'));
|
||||||
|
|
||||||
|
// styles not widely supported
|
||||||
|
console.log(colors.green('So ') + colors.underline('are') + ' '
|
||||||
|
+ colors.inverse('inverse') + colors.yellow.bold(' styles! '));
|
||||||
|
|
||||||
|
console.log(colors.zebra('Zebras are so fun!'));
|
||||||
|
|
||||||
|
console.log('This is ' + colors.strikethrough('not') + ' fun.');
|
||||||
|
|
||||||
|
|
||||||
|
console.log(colors.black.bgWhite('Background color attack!'));
|
||||||
|
console.log(colors.random('Use random styles on everything!'));
|
||||||
|
console.log(colors.america('America, Heck Yeah!'));
|
||||||
|
|
||||||
|
// eslint-disable-next-line max-len
|
||||||
|
console.log(colors.brightCyan('Blindingly ') + colors.brightRed('bright? ') + colors.brightYellow('Why ') + colors.brightGreen('not?!'));
|
||||||
|
|
||||||
|
console.log('Setting themes is useful');
|
||||||
|
|
||||||
|
//
|
||||||
|
// Custom themes
|
||||||
|
//
|
||||||
|
// console.log('Generic logging theme as JSON'.green.bold.underline);
|
||||||
|
// Load theme with JSON literal
|
||||||
|
colors.setTheme({
|
||||||
|
silly: 'rainbow',
|
||||||
|
input: 'blue',
|
||||||
|
verbose: 'cyan',
|
||||||
|
prompt: 'grey',
|
||||||
|
info: 'green',
|
||||||
|
data: 'grey',
|
||||||
|
help: 'cyan',
|
||||||
|
warn: 'yellow',
|
||||||
|
debug: 'blue',
|
||||||
|
error: 'red',
|
||||||
|
});
|
||||||
|
|
||||||
|
// outputs red text
|
||||||
|
console.log(colors.error('this is an error'));
|
||||||
|
|
||||||
|
// outputs yellow text
|
||||||
|
console.log(colors.warn('this is a warning'));
|
||||||
|
|
||||||
|
// outputs blue text
|
||||||
|
console.log(colors.input('this is an input'));
|
||||||
|
|
||||||
|
|
||||||
|
// console.log('Generic logging theme as file'.green.bold.underline);
|
||||||
|
|
||||||
|
// Load a theme from file
|
||||||
|
colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));
|
||||||
|
|
||||||
|
// outputs red text
|
||||||
|
console.log(colors.error('this is an error'));
|
||||||
|
|
||||||
|
// outputs yellow text
|
||||||
|
console.log(colors.warn('this is a warning'));
|
||||||
|
|
||||||
|
// outputs grey text
|
||||||
|
console.log(colors.input('this is an input'));
|
||||||
|
|
||||||
|
// console.log(colors.zalgo("Don't summon him"))
|
||||||
|
|
||||||
|
|
||||||
184
node_modules/@colors/colors/index.d.ts
generated
vendored
Normal file
184
node_modules/@colors/colors/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,184 @@
|
||||||
|
// Type definitions for @colors/colors 1.4+
|
||||||
|
// Project: https://github.com/Marak/colors.js
|
||||||
|
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>, Staffan Eketorp <https://github.com/staeke>
|
||||||
|
// Definitions: https://github.com/DABH/colors.js
|
||||||
|
|
||||||
|
export interface Color {
|
||||||
|
(text: string): string;
|
||||||
|
|
||||||
|
strip: Color;
|
||||||
|
stripColors: Color;
|
||||||
|
|
||||||
|
black: Color;
|
||||||
|
red: Color;
|
||||||
|
green: Color;
|
||||||
|
yellow: Color;
|
||||||
|
blue: Color;
|
||||||
|
magenta: Color;
|
||||||
|
cyan: Color;
|
||||||
|
white: Color;
|
||||||
|
gray: Color;
|
||||||
|
grey: Color;
|
||||||
|
|
||||||
|
brightRed: Color;
|
||||||
|
brightGreen: Color;
|
||||||
|
brightYellow: Color;
|
||||||
|
brightBlue: Color;
|
||||||
|
brightMagenta: Color;
|
||||||
|
brightCyan: Color;
|
||||||
|
brightWhite: Color;
|
||||||
|
|
||||||
|
bgBlack: Color;
|
||||||
|
bgRed: Color;
|
||||||
|
bgGreen: Color;
|
||||||
|
bgYellow: Color;
|
||||||
|
bgBlue: Color;
|
||||||
|
bgMagenta: Color;
|
||||||
|
bgCyan: Color;
|
||||||
|
bgWhite: Color;
|
||||||
|
|
||||||
|
bgBrightRed: Color;
|
||||||
|
bgBrightGreen: Color;
|
||||||
|
bgBrightYellow: Color;
|
||||||
|
bgBrightBlue: Color;
|
||||||
|
bgBrightMagenta: Color;
|
||||||
|
bgBrightCyan: Color;
|
||||||
|
bgBrightWhite: Color;
|
||||||
|
|
||||||
|
reset: Color;
|
||||||
|
bold: Color;
|
||||||
|
dim: Color;
|
||||||
|
italic: Color;
|
||||||
|
underline: Color;
|
||||||
|
inverse: Color;
|
||||||
|
hidden: Color;
|
||||||
|
strikethrough: Color;
|
||||||
|
|
||||||
|
rainbow: Color;
|
||||||
|
zebra: Color;
|
||||||
|
america: Color;
|
||||||
|
trap: Color;
|
||||||
|
random: Color;
|
||||||
|
zalgo: Color;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function enable(): void;
|
||||||
|
export function disable(): void;
|
||||||
|
export function setTheme(theme: any): void;
|
||||||
|
|
||||||
|
export let enabled: boolean;
|
||||||
|
|
||||||
|
export const strip: Color;
|
||||||
|
export const stripColors: Color;
|
||||||
|
|
||||||
|
export const black: Color;
|
||||||
|
export const red: Color;
|
||||||
|
export const green: Color;
|
||||||
|
export const yellow: Color;
|
||||||
|
export const blue: Color;
|
||||||
|
export const magenta: Color;
|
||||||
|
export const cyan: Color;
|
||||||
|
export const white: Color;
|
||||||
|
export const gray: Color;
|
||||||
|
export const grey: Color;
|
||||||
|
|
||||||
|
export const brightRed: Color;
|
||||||
|
export const brightGreen: Color;
|
||||||
|
export const brightYellow: Color;
|
||||||
|
export const brightBlue: Color;
|
||||||
|
export const brightMagenta: Color;
|
||||||
|
export const brightCyan: Color;
|
||||||
|
export const brightWhite: Color;
|
||||||
|
|
||||||
|
export const bgBlack: Color;
|
||||||
|
export const bgRed: Color;
|
||||||
|
export const bgGreen: Color;
|
||||||
|
export const bgYellow: Color;
|
||||||
|
export const bgBlue: Color;
|
||||||
|
export const bgMagenta: Color;
|
||||||
|
export const bgCyan: Color;
|
||||||
|
export const bgWhite: Color;
|
||||||
|
|
||||||
|
export const bgBrightRed: Color;
|
||||||
|
export const bgBrightGreen: Color;
|
||||||
|
export const bgBrightYellow: Color;
|
||||||
|
export const bgBrightBlue: Color;
|
||||||
|
export const bgBrightMagenta: Color;
|
||||||
|
export const bgBrightCyan: Color;
|
||||||
|
export const bgBrightWhite: Color;
|
||||||
|
|
||||||
|
export const reset: Color;
|
||||||
|
export const bold: Color;
|
||||||
|
export const dim: Color;
|
||||||
|
export const italic: Color;
|
||||||
|
export const underline: Color;
|
||||||
|
export const inverse: Color;
|
||||||
|
export const hidden: Color;
|
||||||
|
export const strikethrough: Color;
|
||||||
|
|
||||||
|
export const rainbow: Color;
|
||||||
|
export const zebra: Color;
|
||||||
|
export const america: Color;
|
||||||
|
export const trap: Color;
|
||||||
|
export const random: Color;
|
||||||
|
export const zalgo: Color;
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface String {
|
||||||
|
strip: string;
|
||||||
|
stripColors: string;
|
||||||
|
|
||||||
|
black: string;
|
||||||
|
red: string;
|
||||||
|
green: string;
|
||||||
|
yellow: string;
|
||||||
|
blue: string;
|
||||||
|
magenta: string;
|
||||||
|
cyan: string;
|
||||||
|
white: string;
|
||||||
|
gray: string;
|
||||||
|
grey: string;
|
||||||
|
|
||||||
|
brightRed: string;
|
||||||
|
brightGreen: string;
|
||||||
|
brightYellow: string;
|
||||||
|
brightBlue: string;
|
||||||
|
brightMagenta: string;
|
||||||
|
brightCyan: string;
|
||||||
|
brightWhite: string;
|
||||||
|
|
||||||
|
bgBlack: string;
|
||||||
|
bgRed: string;
|
||||||
|
bgGreen: string;
|
||||||
|
bgYellow: string;
|
||||||
|
bgBlue: string;
|
||||||
|
bgMagenta: string;
|
||||||
|
bgCyan: string;
|
||||||
|
bgWhite: string;
|
||||||
|
|
||||||
|
bgBrightRed: string;
|
||||||
|
bgBrightGreen: string;
|
||||||
|
bgBrightYellow: string;
|
||||||
|
bgBrightBlue: string;
|
||||||
|
bgBrightMagenta: string;
|
||||||
|
bgBrightCyan: string;
|
||||||
|
bgBrightWhite: string;
|
||||||
|
|
||||||
|
reset: string;
|
||||||
|
// @ts-ignore
|
||||||
|
bold: string;
|
||||||
|
dim: string;
|
||||||
|
italic: string;
|
||||||
|
underline: string;
|
||||||
|
inverse: string;
|
||||||
|
hidden: string;
|
||||||
|
strikethrough: string;
|
||||||
|
|
||||||
|
rainbow: string;
|
||||||
|
zebra: string;
|
||||||
|
america: string;
|
||||||
|
trap: string;
|
||||||
|
random: string;
|
||||||
|
zalgo: string;
|
||||||
|
}
|
||||||
|
}
|
||||||
211
node_modules/@colors/colors/lib/colors.js
generated
vendored
Normal file
211
node_modules/@colors/colors/lib/colors.js
generated
vendored
Normal file
|
|
@ -0,0 +1,211 @@
|
||||||
|
/*
|
||||||
|
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Original Library
|
||||||
|
- Copyright (c) Marak Squires
|
||||||
|
|
||||||
|
Additional functionality
|
||||||
|
- 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.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
var colors = {};
|
||||||
|
module['exports'] = colors;
|
||||||
|
|
||||||
|
colors.themes = {};
|
||||||
|
|
||||||
|
var util = require('util');
|
||||||
|
var ansiStyles = colors.styles = require('./styles');
|
||||||
|
var defineProps = Object.defineProperties;
|
||||||
|
var newLineRegex = new RegExp(/[\r\n]+/g);
|
||||||
|
|
||||||
|
colors.supportsColor = require('./system/supports-colors').supportsColor;
|
||||||
|
|
||||||
|
if (typeof colors.enabled === 'undefined') {
|
||||||
|
colors.enabled = colors.supportsColor() !== false;
|
||||||
|
}
|
||||||
|
|
||||||
|
colors.enable = function() {
|
||||||
|
colors.enabled = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
colors.disable = function() {
|
||||||
|
colors.enabled = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
colors.stripColors = colors.strip = function(str) {
|
||||||
|
return ('' + str).replace(/\x1B\[\d+m/g, '');
|
||||||
|
};
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
var stylize = colors.stylize = function stylize(str, style) {
|
||||||
|
if (!colors.enabled) {
|
||||||
|
return str+'';
|
||||||
|
}
|
||||||
|
|
||||||
|
var styleMap = ansiStyles[style];
|
||||||
|
|
||||||
|
// Stylize should work for non-ANSI styles, too
|
||||||
|
if (!styleMap && style in colors) {
|
||||||
|
// Style maps like trap operate as functions on strings;
|
||||||
|
// they don't have properties like open or close.
|
||||||
|
return colors[style](str);
|
||||||
|
}
|
||||||
|
|
||||||
|
return styleMap.open + str + styleMap.close;
|
||||||
|
};
|
||||||
|
|
||||||
|
var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
|
||||||
|
var escapeStringRegexp = function(str) {
|
||||||
|
if (typeof str !== 'string') {
|
||||||
|
throw new TypeError('Expected a string');
|
||||||
|
}
|
||||||
|
return str.replace(matchOperatorsRe, '\\$&');
|
||||||
|
};
|
||||||
|
|
||||||
|
function build(_styles) {
|
||||||
|
var builder = function builder() {
|
||||||
|
return applyStyle.apply(builder, arguments);
|
||||||
|
};
|
||||||
|
builder._styles = _styles;
|
||||||
|
// __proto__ is used because we must return a function, but there is
|
||||||
|
// no way to create a function with a different prototype.
|
||||||
|
builder.__proto__ = proto;
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
var styles = (function() {
|
||||||
|
var ret = {};
|
||||||
|
ansiStyles.grey = ansiStyles.gray;
|
||||||
|
Object.keys(ansiStyles).forEach(function(key) {
|
||||||
|
ansiStyles[key].closeRe =
|
||||||
|
new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
|
||||||
|
ret[key] = {
|
||||||
|
get: function() {
|
||||||
|
return build(this._styles.concat(key));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
return ret;
|
||||||
|
})();
|
||||||
|
|
||||||
|
var proto = defineProps(function colors() {}, styles);
|
||||||
|
|
||||||
|
function applyStyle() {
|
||||||
|
var args = Array.prototype.slice.call(arguments);
|
||||||
|
|
||||||
|
var str = args.map(function(arg) {
|
||||||
|
// Use weak equality check so we can colorize null/undefined in safe mode
|
||||||
|
if (arg != null && arg.constructor === String) {
|
||||||
|
return arg;
|
||||||
|
} else {
|
||||||
|
return util.inspect(arg);
|
||||||
|
}
|
||||||
|
}).join(' ');
|
||||||
|
|
||||||
|
if (!colors.enabled || !str) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
var newLinesPresent = str.indexOf('\n') != -1;
|
||||||
|
|
||||||
|
var nestedStyles = this._styles;
|
||||||
|
|
||||||
|
var i = nestedStyles.length;
|
||||||
|
while (i--) {
|
||||||
|
var code = ansiStyles[nestedStyles[i]];
|
||||||
|
str = code.open + str.replace(code.closeRe, code.open) + code.close;
|
||||||
|
if (newLinesPresent) {
|
||||||
|
str = str.replace(newLineRegex, function(match) {
|
||||||
|
return code.close + match + code.open;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
colors.setTheme = function(theme) {
|
||||||
|
if (typeof theme === 'string') {
|
||||||
|
console.log('colors.setTheme now only accepts an object, not a string. ' +
|
||||||
|
'If you are trying to set a theme from a file, it is now your (the ' +
|
||||||
|
'caller\'s) responsibility to require the file. The old syntax ' +
|
||||||
|
'looked like colors.setTheme(__dirname + ' +
|
||||||
|
'\'/../themes/generic-logging.js\'); The new syntax looks like '+
|
||||||
|
'colors.setTheme(require(__dirname + ' +
|
||||||
|
'\'/../themes/generic-logging.js\'));');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (var style in theme) {
|
||||||
|
(function(style) {
|
||||||
|
colors[style] = function(str) {
|
||||||
|
if (typeof theme[style] === 'object') {
|
||||||
|
var out = str;
|
||||||
|
for (var i in theme[style]) {
|
||||||
|
out = colors[theme[style][i]](out);
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
return colors[theme[style]](str);
|
||||||
|
};
|
||||||
|
})(style);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
var ret = {};
|
||||||
|
Object.keys(styles).forEach(function(name) {
|
||||||
|
ret[name] = {
|
||||||
|
get: function() {
|
||||||
|
return build([name]);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
var sequencer = function sequencer(map, str) {
|
||||||
|
var exploded = str.split('');
|
||||||
|
exploded = exploded.map(map);
|
||||||
|
return exploded.join('');
|
||||||
|
};
|
||||||
|
|
||||||
|
// custom formatter methods
|
||||||
|
colors.trap = require('./custom/trap');
|
||||||
|
colors.zalgo = require('./custom/zalgo');
|
||||||
|
|
||||||
|
// maps
|
||||||
|
colors.maps = {};
|
||||||
|
colors.maps.america = require('./maps/america')(colors);
|
||||||
|
colors.maps.zebra = require('./maps/zebra')(colors);
|
||||||
|
colors.maps.rainbow = require('./maps/rainbow')(colors);
|
||||||
|
colors.maps.random = require('./maps/random')(colors);
|
||||||
|
|
||||||
|
for (var map in colors.maps) {
|
||||||
|
(function(map) {
|
||||||
|
colors[map] = function(str) {
|
||||||
|
return sequencer(colors.maps[map], str);
|
||||||
|
};
|
||||||
|
})(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
defineProps(colors, init());
|
||||||
46
node_modules/@colors/colors/lib/custom/trap.js
generated
vendored
Normal file
46
node_modules/@colors/colors/lib/custom/trap.js
generated
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
module['exports'] = function runTheTrap(text, options) {
|
||||||
|
var result = '';
|
||||||
|
text = text || 'Run the trap, drop the bass';
|
||||||
|
text = text.split('');
|
||||||
|
var trap = {
|
||||||
|
a: ['\u0040', '\u0104', '\u023a', '\u0245', '\u0394', '\u039b', '\u0414'],
|
||||||
|
b: ['\u00df', '\u0181', '\u0243', '\u026e', '\u03b2', '\u0e3f'],
|
||||||
|
c: ['\u00a9', '\u023b', '\u03fe'],
|
||||||
|
d: ['\u00d0', '\u018a', '\u0500', '\u0501', '\u0502', '\u0503'],
|
||||||
|
e: ['\u00cb', '\u0115', '\u018e', '\u0258', '\u03a3', '\u03be', '\u04bc',
|
||||||
|
'\u0a6c'],
|
||||||
|
f: ['\u04fa'],
|
||||||
|
g: ['\u0262'],
|
||||||
|
h: ['\u0126', '\u0195', '\u04a2', '\u04ba', '\u04c7', '\u050a'],
|
||||||
|
i: ['\u0f0f'],
|
||||||
|
j: ['\u0134'],
|
||||||
|
k: ['\u0138', '\u04a0', '\u04c3', '\u051e'],
|
||||||
|
l: ['\u0139'],
|
||||||
|
m: ['\u028d', '\u04cd', '\u04ce', '\u0520', '\u0521', '\u0d69'],
|
||||||
|
n: ['\u00d1', '\u014b', '\u019d', '\u0376', '\u03a0', '\u048a'],
|
||||||
|
o: ['\u00d8', '\u00f5', '\u00f8', '\u01fe', '\u0298', '\u047a', '\u05dd',
|
||||||
|
'\u06dd', '\u0e4f'],
|
||||||
|
p: ['\u01f7', '\u048e'],
|
||||||
|
q: ['\u09cd'],
|
||||||
|
r: ['\u00ae', '\u01a6', '\u0210', '\u024c', '\u0280', '\u042f'],
|
||||||
|
s: ['\u00a7', '\u03de', '\u03df', '\u03e8'],
|
||||||
|
t: ['\u0141', '\u0166', '\u0373'],
|
||||||
|
u: ['\u01b1', '\u054d'],
|
||||||
|
v: ['\u05d8'],
|
||||||
|
w: ['\u0428', '\u0460', '\u047c', '\u0d70'],
|
||||||
|
x: ['\u04b2', '\u04fe', '\u04fc', '\u04fd'],
|
||||||
|
y: ['\u00a5', '\u04b0', '\u04cb'],
|
||||||
|
z: ['\u01b5', '\u0240'],
|
||||||
|
};
|
||||||
|
text.forEach(function(c) {
|
||||||
|
c = c.toLowerCase();
|
||||||
|
var chars = trap[c] || [' '];
|
||||||
|
var rand = Math.floor(Math.random() * chars.length);
|
||||||
|
if (typeof trap[c] !== 'undefined') {
|
||||||
|
result += trap[c][rand];
|
||||||
|
} else {
|
||||||
|
result += c;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
};
|
||||||
110
node_modules/@colors/colors/lib/custom/zalgo.js
generated
vendored
Normal file
110
node_modules/@colors/colors/lib/custom/zalgo.js
generated
vendored
Normal file
|
|
@ -0,0 +1,110 @@
|
||||||
|
// please no
|
||||||
|
module['exports'] = function zalgo(text, options) {
|
||||||
|
text = text || ' he is here ';
|
||||||
|
var soul = {
|
||||||
|
'up': [
|
||||||
|
'̍', '̎', '̄', '̅',
|
||||||
|
'̿', '̑', '̆', '̐',
|
||||||
|
'͒', '͗', '͑', '̇',
|
||||||
|
'̈', '̊', '͂', '̓',
|
||||||
|
'̈', '͊', '͋', '͌',
|
||||||
|
'̃', '̂', '̌', '͐',
|
||||||
|
'̀', '́', '̋', '̏',
|
||||||
|
'̒', '̓', '̔', '̽',
|
||||||
|
'̉', 'ͣ', 'ͤ', 'ͥ',
|
||||||
|
'ͦ', 'ͧ', 'ͨ', 'ͩ',
|
||||||
|
'ͪ', 'ͫ', 'ͬ', 'ͭ',
|
||||||
|
'ͮ', 'ͯ', '̾', '͛',
|
||||||
|
'͆', '̚',
|
||||||
|
],
|
||||||
|
'down': [
|
||||||
|
'̖', '̗', '̘', '̙',
|
||||||
|
'̜', '̝', '̞', '̟',
|
||||||
|
'̠', '̤', '̥', '̦',
|
||||||
|
'̩', '̪', '̫', '̬',
|
||||||
|
'̭', '̮', '̯', '̰',
|
||||||
|
'̱', '̲', '̳', '̹',
|
||||||
|
'̺', '̻', '̼', 'ͅ',
|
||||||
|
'͇', '͈', '͉', '͍',
|
||||||
|
'͎', '͓', '͔', '͕',
|
||||||
|
'͖', '͙', '͚', '̣',
|
||||||
|
],
|
||||||
|
'mid': [
|
||||||
|
'̕', '̛', '̀', '́',
|
||||||
|
'͘', '̡', '̢', '̧',
|
||||||
|
'̨', '̴', '̵', '̶',
|
||||||
|
'͜', '͝', '͞',
|
||||||
|
'͟', '͠', '͢', '̸',
|
||||||
|
'̷', '͡', ' ҉',
|
||||||
|
],
|
||||||
|
};
|
||||||
|
var all = [].concat(soul.up, soul.down, soul.mid);
|
||||||
|
|
||||||
|
function randomNumber(range) {
|
||||||
|
var r = Math.floor(Math.random() * range);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isChar(character) {
|
||||||
|
var bool = false;
|
||||||
|
all.filter(function(i) {
|
||||||
|
bool = (i === character);
|
||||||
|
});
|
||||||
|
return bool;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function heComes(text, options) {
|
||||||
|
var result = '';
|
||||||
|
var counts;
|
||||||
|
var l;
|
||||||
|
options = options || {};
|
||||||
|
options['up'] =
|
||||||
|
typeof options['up'] !== 'undefined' ? options['up'] : true;
|
||||||
|
options['mid'] =
|
||||||
|
typeof options['mid'] !== 'undefined' ? options['mid'] : true;
|
||||||
|
options['down'] =
|
||||||
|
typeof options['down'] !== 'undefined' ? options['down'] : true;
|
||||||
|
options['size'] =
|
||||||
|
typeof options['size'] !== 'undefined' ? options['size'] : 'maxi';
|
||||||
|
text = text.split('');
|
||||||
|
for (l in text) {
|
||||||
|
if (isChar(l)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
result = result + text[l];
|
||||||
|
counts = {'up': 0, 'down': 0, 'mid': 0};
|
||||||
|
switch (options.size) {
|
||||||
|
case 'mini':
|
||||||
|
counts.up = randomNumber(8);
|
||||||
|
counts.mid = randomNumber(2);
|
||||||
|
counts.down = randomNumber(8);
|
||||||
|
break;
|
||||||
|
case 'maxi':
|
||||||
|
counts.up = randomNumber(16) + 3;
|
||||||
|
counts.mid = randomNumber(4) + 1;
|
||||||
|
counts.down = randomNumber(64) + 3;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
counts.up = randomNumber(8) + 1;
|
||||||
|
counts.mid = randomNumber(6) / 2;
|
||||||
|
counts.down = randomNumber(8) + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
var arr = ['up', 'mid', 'down'];
|
||||||
|
for (var d in arr) {
|
||||||
|
var index = arr[d];
|
||||||
|
for (var i = 0; i <= counts[index]; i++) {
|
||||||
|
if (options[index]) {
|
||||||
|
result = result + soul[index][randomNumber(soul[index].length)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
// don't summon him
|
||||||
|
return heComes(text, options);
|
||||||
|
};
|
||||||
|
|
||||||
110
node_modules/@colors/colors/lib/extendStringPrototype.js
generated
vendored
Normal file
110
node_modules/@colors/colors/lib/extendStringPrototype.js
generated
vendored
Normal file
|
|
@ -0,0 +1,110 @@
|
||||||
|
var colors = require('./colors');
|
||||||
|
|
||||||
|
module['exports'] = function() {
|
||||||
|
//
|
||||||
|
// Extends prototype of native string object to allow for "foo".red syntax
|
||||||
|
//
|
||||||
|
var addProperty = function(color, func) {
|
||||||
|
String.prototype.__defineGetter__(color, func);
|
||||||
|
};
|
||||||
|
|
||||||
|
addProperty('strip', function() {
|
||||||
|
return colors.strip(this);
|
||||||
|
});
|
||||||
|
|
||||||
|
addProperty('stripColors', function() {
|
||||||
|
return colors.strip(this);
|
||||||
|
});
|
||||||
|
|
||||||
|
addProperty('trap', function() {
|
||||||
|
return colors.trap(this);
|
||||||
|
});
|
||||||
|
|
||||||
|
addProperty('zalgo', function() {
|
||||||
|
return colors.zalgo(this);
|
||||||
|
});
|
||||||
|
|
||||||
|
addProperty('zebra', function() {
|
||||||
|
return colors.zebra(this);
|
||||||
|
});
|
||||||
|
|
||||||
|
addProperty('rainbow', function() {
|
||||||
|
return colors.rainbow(this);
|
||||||
|
});
|
||||||
|
|
||||||
|
addProperty('random', function() {
|
||||||
|
return colors.random(this);
|
||||||
|
});
|
||||||
|
|
||||||
|
addProperty('america', function() {
|
||||||
|
return colors.america(this);
|
||||||
|
});
|
||||||
|
|
||||||
|
//
|
||||||
|
// Iterate through all default styles and colors
|
||||||
|
//
|
||||||
|
var x = Object.keys(colors.styles);
|
||||||
|
x.forEach(function(style) {
|
||||||
|
addProperty(style, function() {
|
||||||
|
return colors.stylize(this, style);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function applyTheme(theme) {
|
||||||
|
//
|
||||||
|
// Remark: This is a list of methods that exist
|
||||||
|
// on String that you should not overwrite.
|
||||||
|
//
|
||||||
|
var stringPrototypeBlacklist = [
|
||||||
|
'__defineGetter__', '__defineSetter__', '__lookupGetter__',
|
||||||
|
'__lookupSetter__', 'charAt', 'constructor', 'hasOwnProperty',
|
||||||
|
'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString',
|
||||||
|
'valueOf', 'charCodeAt', 'indexOf', 'lastIndexOf', 'length',
|
||||||
|
'localeCompare', 'match', 'repeat', 'replace', 'search', 'slice',
|
||||||
|
'split', 'substring', 'toLocaleLowerCase', 'toLocaleUpperCase',
|
||||||
|
'toLowerCase', 'toUpperCase', 'trim', 'trimLeft', 'trimRight',
|
||||||
|
];
|
||||||
|
|
||||||
|
Object.keys(theme).forEach(function(prop) {
|
||||||
|
if (stringPrototypeBlacklist.indexOf(prop) !== -1) {
|
||||||
|
console.log('warn: '.red + ('String.prototype' + prop).magenta +
|
||||||
|
' is probably something you don\'t want to override. ' +
|
||||||
|
'Ignoring style name');
|
||||||
|
} else {
|
||||||
|
if (typeof(theme[prop]) === 'string') {
|
||||||
|
colors[prop] = colors[theme[prop]];
|
||||||
|
addProperty(prop, function() {
|
||||||
|
return colors[prop](this);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
var themePropApplicator = function(str) {
|
||||||
|
var ret = str || this;
|
||||||
|
for (var t = 0; t < theme[prop].length; t++) {
|
||||||
|
ret = colors[theme[prop][t]](ret);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
addProperty(prop, themePropApplicator);
|
||||||
|
colors[prop] = function(str) {
|
||||||
|
return themePropApplicator(str);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
colors.setTheme = function(theme) {
|
||||||
|
if (typeof theme === 'string') {
|
||||||
|
console.log('colors.setTheme now only accepts an object, not a string. ' +
|
||||||
|
'If you are trying to set a theme from a file, it is now your (the ' +
|
||||||
|
'caller\'s) responsibility to require the file. The old syntax ' +
|
||||||
|
'looked like colors.setTheme(__dirname + ' +
|
||||||
|
'\'/../themes/generic-logging.js\'); The new syntax looks like '+
|
||||||
|
'colors.setTheme(require(__dirname + ' +
|
||||||
|
'\'/../themes/generic-logging.js\'));');
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
applyTheme(theme);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
13
node_modules/@colors/colors/lib/index.js
generated
vendored
Normal file
13
node_modules/@colors/colors/lib/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
var colors = require('./colors');
|
||||||
|
module['exports'] = colors;
|
||||||
|
|
||||||
|
// Remark: By default, colors will add style properties to String.prototype.
|
||||||
|
//
|
||||||
|
// If you don't wish to extend String.prototype, you can do this instead and
|
||||||
|
// native String will not be touched:
|
||||||
|
//
|
||||||
|
// var colors = require('@colors/colors/safe');
|
||||||
|
// colors.red("foo")
|
||||||
|
//
|
||||||
|
//
|
||||||
|
require('./extendStringPrototype')();
|
||||||
10
node_modules/@colors/colors/lib/maps/america.js
generated
vendored
Normal file
10
node_modules/@colors/colors/lib/maps/america.js
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
module['exports'] = function(colors) {
|
||||||
|
return function(letter, i, exploded) {
|
||||||
|
if (letter === ' ') return letter;
|
||||||
|
switch (i%3) {
|
||||||
|
case 0: return colors.red(letter);
|
||||||
|
case 1: return colors.white(letter);
|
||||||
|
case 2: return colors.blue(letter);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
12
node_modules/@colors/colors/lib/maps/rainbow.js
generated
vendored
Normal file
12
node_modules/@colors/colors/lib/maps/rainbow.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
module['exports'] = function(colors) {
|
||||||
|
// RoY G BiV
|
||||||
|
var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta'];
|
||||||
|
return function(letter, i, exploded) {
|
||||||
|
if (letter === ' ') {
|
||||||
|
return letter;
|
||||||
|
} else {
|
||||||
|
return colors[rainbowColors[i++ % rainbowColors.length]](letter);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
11
node_modules/@colors/colors/lib/maps/random.js
generated
vendored
Normal file
11
node_modules/@colors/colors/lib/maps/random.js
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
module['exports'] = function(colors) {
|
||||||
|
var available = ['underline', 'inverse', 'grey', 'yellow', 'red', 'green',
|
||||||
|
'blue', 'white', 'cyan', 'magenta', 'brightYellow', 'brightRed',
|
||||||
|
'brightGreen', 'brightBlue', 'brightWhite', 'brightCyan', 'brightMagenta'];
|
||||||
|
return function(letter, i, exploded) {
|
||||||
|
return letter === ' ' ? letter :
|
||||||
|
colors[
|
||||||
|
available[Math.round(Math.random() * (available.length - 2))]
|
||||||
|
](letter);
|
||||||
|
};
|
||||||
|
};
|
||||||
5
node_modules/@colors/colors/lib/maps/zebra.js
generated
vendored
Normal file
5
node_modules/@colors/colors/lib/maps/zebra.js
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
module['exports'] = function(colors) {
|
||||||
|
return function(letter, i, exploded) {
|
||||||
|
return i % 2 === 0 ? letter : colors.inverse(letter);
|
||||||
|
};
|
||||||
|
};
|
||||||
95
node_modules/@colors/colors/lib/styles.js
generated
vendored
Normal file
95
node_modules/@colors/colors/lib/styles.js
generated
vendored
Normal file
|
|
@ -0,0 +1,95 @@
|
||||||
|
/*
|
||||||
|
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.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
var styles = {};
|
||||||
|
module['exports'] = styles;
|
||||||
|
|
||||||
|
var codes = {
|
||||||
|
reset: [0, 0],
|
||||||
|
|
||||||
|
bold: [1, 22],
|
||||||
|
dim: [2, 22],
|
||||||
|
italic: [3, 23],
|
||||||
|
underline: [4, 24],
|
||||||
|
inverse: [7, 27],
|
||||||
|
hidden: [8, 28],
|
||||||
|
strikethrough: [9, 29],
|
||||||
|
|
||||||
|
black: [30, 39],
|
||||||
|
red: [31, 39],
|
||||||
|
green: [32, 39],
|
||||||
|
yellow: [33, 39],
|
||||||
|
blue: [34, 39],
|
||||||
|
magenta: [35, 39],
|
||||||
|
cyan: [36, 39],
|
||||||
|
white: [37, 39],
|
||||||
|
gray: [90, 39],
|
||||||
|
grey: [90, 39],
|
||||||
|
|
||||||
|
brightRed: [91, 39],
|
||||||
|
brightGreen: [92, 39],
|
||||||
|
brightYellow: [93, 39],
|
||||||
|
brightBlue: [94, 39],
|
||||||
|
brightMagenta: [95, 39],
|
||||||
|
brightCyan: [96, 39],
|
||||||
|
brightWhite: [97, 39],
|
||||||
|
|
||||||
|
bgBlack: [40, 49],
|
||||||
|
bgRed: [41, 49],
|
||||||
|
bgGreen: [42, 49],
|
||||||
|
bgYellow: [43, 49],
|
||||||
|
bgBlue: [44, 49],
|
||||||
|
bgMagenta: [45, 49],
|
||||||
|
bgCyan: [46, 49],
|
||||||
|
bgWhite: [47, 49],
|
||||||
|
bgGray: [100, 49],
|
||||||
|
bgGrey: [100, 49],
|
||||||
|
|
||||||
|
bgBrightRed: [101, 49],
|
||||||
|
bgBrightGreen: [102, 49],
|
||||||
|
bgBrightYellow: [103, 49],
|
||||||
|
bgBrightBlue: [104, 49],
|
||||||
|
bgBrightMagenta: [105, 49],
|
||||||
|
bgBrightCyan: [106, 49],
|
||||||
|
bgBrightWhite: [107, 49],
|
||||||
|
|
||||||
|
// legacy styles for colors pre v1.0.0
|
||||||
|
blackBG: [40, 49],
|
||||||
|
redBG: [41, 49],
|
||||||
|
greenBG: [42, 49],
|
||||||
|
yellowBG: [43, 49],
|
||||||
|
blueBG: [44, 49],
|
||||||
|
magentaBG: [45, 49],
|
||||||
|
cyanBG: [46, 49],
|
||||||
|
whiteBG: [47, 49],
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
Object.keys(codes).forEach(function(key) {
|
||||||
|
var val = codes[key];
|
||||||
|
var style = styles[key] = [];
|
||||||
|
style.open = '\u001b[' + val[0] + 'm';
|
||||||
|
style.close = '\u001b[' + val[1] + 'm';
|
||||||
|
});
|
||||||
35
node_modules/@colors/colors/lib/system/has-flag.js
generated
vendored
Normal file
35
node_modules/@colors/colors/lib/system/has-flag.js
generated
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = function(flag, argv) {
|
||||||
|
argv = argv || process.argv || [];
|
||||||
|
|
||||||
|
var terminatorPos = argv.indexOf('--');
|
||||||
|
var prefix = /^-{1,2}/.test(flag) ? '' : '--';
|
||||||
|
var pos = argv.indexOf(prefix + flag);
|
||||||
|
|
||||||
|
return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
|
||||||
|
};
|
||||||
151
node_modules/@colors/colors/lib/system/supports-colors.js
generated
vendored
Normal file
151
node_modules/@colors/colors/lib/system/supports-colors.js
generated
vendored
Normal file
|
|
@ -0,0 +1,151 @@
|
||||||
|
/*
|
||||||
|
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.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var os = require('os');
|
||||||
|
var hasFlag = require('./has-flag.js');
|
||||||
|
|
||||||
|
var env = process.env;
|
||||||
|
|
||||||
|
var forceColor = void 0;
|
||||||
|
if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) {
|
||||||
|
forceColor = false;
|
||||||
|
} else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true')
|
||||||
|
|| hasFlag('color=always')) {
|
||||||
|
forceColor = true;
|
||||||
|
}
|
||||||
|
if ('FORCE_COLOR' in env) {
|
||||||
|
forceColor = env.FORCE_COLOR.length === 0
|
||||||
|
|| parseInt(env.FORCE_COLOR, 10) !== 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function translateLevel(level) {
|
||||||
|
if (level === 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
level: level,
|
||||||
|
hasBasic: true,
|
||||||
|
has256: level >= 2,
|
||||||
|
has16m: level >= 3,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function supportsColor(stream) {
|
||||||
|
if (forceColor === false) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasFlag('color=16m') || hasFlag('color=full')
|
||||||
|
|| hasFlag('color=truecolor')) {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasFlag('color=256')) {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stream && !stream.isTTY && forceColor !== true) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
var min = forceColor ? 1 : 0;
|
||||||
|
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
// Node.js 7.5.0 is the first version of Node.js to include a patch to
|
||||||
|
// libuv that enables 256 color output on Windows. Anything earlier and it
|
||||||
|
// won't work. However, here we target Node.js 8 at minimum as it is an LTS
|
||||||
|
// release, and Node.js 7 is not. Windows 10 build 10586 is the first
|
||||||
|
// Windows release that supports 256 colors. Windows 10 build 14931 is the
|
||||||
|
// first release that supports 16m/TrueColor.
|
||||||
|
var osRelease = os.release().split('.');
|
||||||
|
if (Number(process.versions.node.split('.')[0]) >= 8
|
||||||
|
&& Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
||||||
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('CI' in env) {
|
||||||
|
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(function(sign) {
|
||||||
|
return sign in env;
|
||||||
|
}) || env.CI_NAME === 'codeship') {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return min;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('TEAMCITY_VERSION' in env) {
|
||||||
|
return (/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('TERM_PROGRAM' in env) {
|
||||||
|
var version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
||||||
|
|
||||||
|
switch (env.TERM_PROGRAM) {
|
||||||
|
case 'iTerm.app':
|
||||||
|
return version >= 3 ? 3 : 2;
|
||||||
|
case 'Hyper':
|
||||||
|
return 3;
|
||||||
|
case 'Apple_Terminal':
|
||||||
|
return 2;
|
||||||
|
// No default
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (/-256(color)?$/i.test(env.TERM)) {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('COLORTERM' in env) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (env.TERM === 'dumb') {
|
||||||
|
return min;
|
||||||
|
}
|
||||||
|
|
||||||
|
return min;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSupportLevel(stream) {
|
||||||
|
var level = supportsColor(stream);
|
||||||
|
return translateLevel(level);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
supportsColor: getSupportLevel,
|
||||||
|
stdout: getSupportLevel(process.stdout),
|
||||||
|
stderr: getSupportLevel(process.stderr),
|
||||||
|
};
|
||||||
45
node_modules/@colors/colors/package.json
generated
vendored
Normal file
45
node_modules/@colors/colors/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
{
|
||||||
|
"name": "@colors/colors",
|
||||||
|
"description": "get colors in your node.js console",
|
||||||
|
"version": "1.6.0",
|
||||||
|
"author": "DABH",
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "DABH",
|
||||||
|
"url": "https://github.com/DABH"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/DABH/colors.js",
|
||||||
|
"bugs": "https://github.com/DABH/colors.js/issues",
|
||||||
|
"keywords": [
|
||||||
|
"ansi",
|
||||||
|
"terminal",
|
||||||
|
"colors"
|
||||||
|
],
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "http://github.com/DABH/colors.js.git"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"scripts": {
|
||||||
|
"lint": "eslint . --fix",
|
||||||
|
"test": "export FORCE_COLOR=1 && node tests/basic-test.js && node tests/safe-test.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.1.90"
|
||||||
|
},
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"files": [
|
||||||
|
"examples",
|
||||||
|
"lib",
|
||||||
|
"LICENSE",
|
||||||
|
"safe.js",
|
||||||
|
"themes",
|
||||||
|
"index.d.ts",
|
||||||
|
"safe.d.ts"
|
||||||
|
],
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "^8.9.0",
|
||||||
|
"eslint-config-google": "^0.14.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
64
node_modules/@colors/colors/safe.d.ts
generated
vendored
Normal file
64
node_modules/@colors/colors/safe.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
// Type definitions for Colors.js 1.2
|
||||||
|
// Project: https://github.com/Marak/colors.js
|
||||||
|
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>, Staffan Eketorp <https://github.com/staeke>
|
||||||
|
// Definitions: https://github.com/Marak/colors.js
|
||||||
|
|
||||||
|
export const enabled: boolean;
|
||||||
|
export function enable(): void;
|
||||||
|
export function disable(): void;
|
||||||
|
export function setTheme(theme: any): void;
|
||||||
|
|
||||||
|
export function strip(str: string): string;
|
||||||
|
export function stripColors(str: string): string;
|
||||||
|
|
||||||
|
export function black(str: string): string;
|
||||||
|
export function red(str: string): string;
|
||||||
|
export function green(str: string): string;
|
||||||
|
export function yellow(str: string): string;
|
||||||
|
export function blue(str: string): string;
|
||||||
|
export function magenta(str: string): string;
|
||||||
|
export function cyan(str: string): string;
|
||||||
|
export function white(str: string): string;
|
||||||
|
export function gray(str: string): string;
|
||||||
|
export function grey(str: string): string;
|
||||||
|
|
||||||
|
export function brightRed(str: string): string;
|
||||||
|
export function brightGreen(str: string): string;
|
||||||
|
export function brightYellow(str: string): string;
|
||||||
|
export function brightBlue(str: string): string;
|
||||||
|
export function brightMagenta(str: string): string;
|
||||||
|
export function brightCyan(str: string): string;
|
||||||
|
export function brightWhite(str: string): string;
|
||||||
|
|
||||||
|
export function bgBlack(str: string): string;
|
||||||
|
export function bgRed(str: string): string;
|
||||||
|
export function bgGreen(str: string): string;
|
||||||
|
export function bgYellow(str: string): string;
|
||||||
|
export function bgBlue(str: string): string;
|
||||||
|
export function bgMagenta(str: string): string;
|
||||||
|
export function bgCyan(str: string): string;
|
||||||
|
export function bgWhite(str: string): string;
|
||||||
|
|
||||||
|
export function bgBrightRed(str: string): string;
|
||||||
|
export function bgBrightGreen(str: string): string;
|
||||||
|
export function bgBrightYellow(str: string): string;
|
||||||
|
export function bgBrightBlue(str: string): string;
|
||||||
|
export function bgBrightMagenta(str: string): string;
|
||||||
|
export function bgBrightCyan(str: string): string;
|
||||||
|
export function bgBrightWhite(str: string): string;
|
||||||
|
|
||||||
|
export function reset(str: string): string;
|
||||||
|
export function bold(str: string): string;
|
||||||
|
export function dim(str: string): string;
|
||||||
|
export function italic(str: string): string;
|
||||||
|
export function underline(str: string): string;
|
||||||
|
export function inverse(str: string): string;
|
||||||
|
export function hidden(str: string): string;
|
||||||
|
export function strikethrough(str: string): string;
|
||||||
|
|
||||||
|
export function rainbow(str: string): string;
|
||||||
|
export function zebra(str: string): string;
|
||||||
|
export function america(str: string): string;
|
||||||
|
export function trap(str: string): string;
|
||||||
|
export function random(str: string): string;
|
||||||
|
export function zalgo(str: string): string;
|
||||||
10
node_modules/@colors/colors/safe.js
generated
vendored
Normal file
10
node_modules/@colors/colors/safe.js
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
//
|
||||||
|
// Remark: Requiring this file will use the "safe" colors API,
|
||||||
|
// which will not touch String.prototype.
|
||||||
|
//
|
||||||
|
// var colors = require('colors/safe');
|
||||||
|
// colors.red("foo")
|
||||||
|
//
|
||||||
|
//
|
||||||
|
var colors = require('./lib/colors');
|
||||||
|
module['exports'] = colors;
|
||||||
12
node_modules/@colors/colors/themes/generic-logging.js
generated
vendored
Normal file
12
node_modules/@colors/colors/themes/generic-logging.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
module['exports'] = {
|
||||||
|
silly: 'rainbow',
|
||||||
|
input: 'grey',
|
||||||
|
verbose: 'cyan',
|
||||||
|
prompt: 'grey',
|
||||||
|
info: 'green',
|
||||||
|
data: 'grey',
|
||||||
|
help: 'cyan',
|
||||||
|
warn: 'yellow',
|
||||||
|
debug: 'blue',
|
||||||
|
error: 'red',
|
||||||
|
};
|
||||||
26
node_modules/@dabh/diagnostics/CHANGELOG.md
generated
vendored
Normal file
26
node_modules/@dabh/diagnostics/CHANGELOG.md
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
# CHANGELOG
|
||||||
|
|
||||||
|
### 2.0.2
|
||||||
|
|
||||||
|
- Bump to kuler 2.0, which removes colornames as dependency, which we
|
||||||
|
never used. So smaller install size, less dependencies for all.
|
||||||
|
|
||||||
|
### 2.0.1
|
||||||
|
|
||||||
|
- Use `storag-engine@3.0` which will automatically detect the correct
|
||||||
|
AsyncStorage implementation.
|
||||||
|
- The upgrade also fixes a bug where it the `debug` and `diagnostics` values
|
||||||
|
to be JSON encoded instead of regular plain text.
|
||||||
|
|
||||||
|
### 2.0.0
|
||||||
|
|
||||||
|
- Documentation improvements.
|
||||||
|
- Fixed a issue where async adapters were incorrectly detected.
|
||||||
|
- Correctly inherit colors after applying colors the browser's console.
|
||||||
|
|
||||||
|
### 2.0.0-alpha
|
||||||
|
|
||||||
|
- Complete rewrite of all internals, now comes with separate builds for `browser`
|
||||||
|
`node` and `react-native` as well as dedicated builds for `production` and
|
||||||
|
`development` environments. Various utility methods and properties have
|
||||||
|
been added to the returned logger to make your lives even easier.
|
||||||
20
node_modules/@dabh/diagnostics/LICENSE
generated
vendored
Normal file
20
node_modules/@dabh/diagnostics/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2015 Arnout Kazemier, Martijn Swaagman, the Contributors.
|
||||||
|
|
||||||
|
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.
|
||||||
473
node_modules/@dabh/diagnostics/README.md
generated
vendored
Normal file
473
node_modules/@dabh/diagnostics/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,473 @@
|
||||||
|
# `diagnostics`
|
||||||
|
|
||||||
|
Diagnostics in the evolution of debug pattern that is used in the Node.js core,
|
||||||
|
this extremely small but powerful technique can best be compared as feature
|
||||||
|
flags for loggers. The created debug logger is disabled by default but can be
|
||||||
|
enabled without changing a line of code, using flags.
|
||||||
|
|
||||||
|
- Allows debugging in multiple JavaScript environments such as Node.js, browsers
|
||||||
|
and React-Native.
|
||||||
|
- Separated development and production builds to minimize impact on your
|
||||||
|
application when bundled.
|
||||||
|
- Allows for customization of logger, messages, and much more.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
The module is released in the public npm registry and can be installed by
|
||||||
|
running:
|
||||||
|
|
||||||
|
```
|
||||||
|
npm install --save @dabh/diagnostics
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
- [Introduction](#introduction)
|
||||||
|
- [Advanced usage](#advanced-usage)
|
||||||
|
- [Production and development builds](#production-and-development-builds)
|
||||||
|
- [WebPack](#webpack)
|
||||||
|
- [Node.js](#nodejs)
|
||||||
|
- [API](#api)
|
||||||
|
- [.enabled](#enabled)
|
||||||
|
- [.namespace](#namespace)
|
||||||
|
- [.dev/prod](#devprod)
|
||||||
|
- [set](#set)
|
||||||
|
- [modify](#modify)
|
||||||
|
- [use](#use)
|
||||||
|
- [Modifiers](#modifiers)
|
||||||
|
- [namespace](#namespace-1)
|
||||||
|
- [Adapters](#adapters)
|
||||||
|
- [process.env](#process-env)
|
||||||
|
- [hash](#hash)
|
||||||
|
- [localStorage](#localstorage)
|
||||||
|
- [AsyncStorage](#asyncstorage)
|
||||||
|
- [Loggers](#loggers)
|
||||||
|
|
||||||
|
### Introduction
|
||||||
|
|
||||||
|
To create a new logger simply `require` the `@dabh/diagnostics` module and call
|
||||||
|
the returned function. It accepts 2 arguments:
|
||||||
|
|
||||||
|
1. `namespace` **Required** This is the namespace of your logger so we know if we need to
|
||||||
|
enable your logger when a debug flag is used. Generally you use the name of
|
||||||
|
your library or application as first root namespace. For example if you're
|
||||||
|
building a parser in a library (example) you would set namespace
|
||||||
|
`example:parser`.
|
||||||
|
2. `options` An object with additional configuration for the logger.
|
||||||
|
following keys are recognized:
|
||||||
|
- `force` Force the logger to be enabled.
|
||||||
|
- `colors` Colors are enabled by default for the logs, but you can set this
|
||||||
|
option to `false` to disable it.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const debug = require('@dabh/diagnostics')('foo:bar:baz');
|
||||||
|
const debug = require('@dabh/diagnostics')('foo:bar:baz', { options });
|
||||||
|
|
||||||
|
debug('this is a log message %s', 'that will only show up when enabled');
|
||||||
|
debug('that is pretty neat', { log: 'more', data: 1337 });
|
||||||
|
```
|
||||||
|
|
||||||
|
Unlike `console.log` statements that add and remove during your development
|
||||||
|
lifecycle you create meaningful log statements that will give you insight in
|
||||||
|
the library or application that you're developing.
|
||||||
|
|
||||||
|
The created debugger uses different "adapters" to extract the debug flag
|
||||||
|
out of the JavaScript environment. To learn more about enabling the debug flag
|
||||||
|
in your specific environment click on one of the enabled adapters below.
|
||||||
|
|
||||||
|
- **browser**: [localStorage](#localstorage), [hash](#hash)
|
||||||
|
- **node.js**: [environment variables](#processenv)
|
||||||
|
- **react-native**: [AsyncStorage](#asyncstorage)
|
||||||
|
|
||||||
|
Please note that the returned logger is fully configured out of the box, you
|
||||||
|
do not need to set any of the adapters/modifiers your self, they are there
|
||||||
|
for when you want more advanced control over the process. But if you want to
|
||||||
|
learn more about that, read the next section.
|
||||||
|
|
||||||
|
### Advanced usage
|
||||||
|
|
||||||
|
There are 2 specific usage patterns for `diagnostic`, library developers who
|
||||||
|
implement it as part of their modules and applications developers who either
|
||||||
|
use it in their application or are searching for ways to consume the messages.
|
||||||
|
|
||||||
|
With the simple log interface as discussed in the [introduction](#introduction)
|
||||||
|
section we make it easy for developers to add it as part of their libraries
|
||||||
|
and applications, and with powerful [API](#api) we allow infinite customization
|
||||||
|
by allowing custom adapters, loggers and modifiers to ensure that this library
|
||||||
|
maintains relevant. These methods not only allow introduction of new loggers,
|
||||||
|
but allow you think outside the box. For example you can maintain a history
|
||||||
|
of past log messages, and output those when an uncaught exception happens in
|
||||||
|
your application so you have additional context
|
||||||
|
|
||||||
|
```js
|
||||||
|
const diagnostics = require('@dabh/diagnostics');
|
||||||
|
|
||||||
|
let index = 0;
|
||||||
|
const limit = 200;
|
||||||
|
const history = new Array(limit);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Force all `diagnostic` loggers to be enabled.
|
||||||
|
//
|
||||||
|
diagnostics.force = process.env.NODE_ENV === 'prod';
|
||||||
|
diagnostics.set(function customLogger(meta, message) {
|
||||||
|
history[index]= { meta, message, now: Date.now() };
|
||||||
|
if (index++ === limit) index = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// We're running a development build, so output.
|
||||||
|
//
|
||||||
|
if (meta.dev) console.log.apply(console, message);
|
||||||
|
});
|
||||||
|
|
||||||
|
process.on('uncaughtException', async function (err) {
|
||||||
|
await saveErrorToDisk(err, history);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
The small snippet above will maintain a 200 limited FIFO (First In First Out)
|
||||||
|
queue of all debug messages that can be referenced when your application crashes
|
||||||
|
|
||||||
|
#### Production and development builds
|
||||||
|
|
||||||
|
When you `require` the `@dabh/diagnostics` module you will be given a logger that is
|
||||||
|
optimized for `development` so it can provide the best developer experience
|
||||||
|
possible.
|
||||||
|
|
||||||
|
The development logger enables all the [adapters](#adapters) for your
|
||||||
|
JavaScript environment, adds a logger that outputs the messages to `console.log`
|
||||||
|
and registers our message modifiers so log messages will be prefixed with the
|
||||||
|
supplied namespace so you know where the log messages originates from.
|
||||||
|
|
||||||
|
The development logger does not have any adapter, modifier and logger enabled
|
||||||
|
by default. This ensures that your log messages never accidentally show up in
|
||||||
|
production. However this does not mean that it's not possible to get debug
|
||||||
|
messages in production. You can `force` the debugger to be enabled, and
|
||||||
|
supply a [custom logger](#loggers).
|
||||||
|
|
||||||
|
```js
|
||||||
|
const diagnostics = require('@dabh/diagnostics');
|
||||||
|
const debug = debug('foo:bar', { force: true });
|
||||||
|
|
||||||
|
//
|
||||||
|
// Or enable _every_ diagnostic instance:
|
||||||
|
//
|
||||||
|
diagnostics.force = true;
|
||||||
|
```
|
||||||
|
|
||||||
|
##### WebPack
|
||||||
|
|
||||||
|
WebPack has the concept of [mode](https://webpack.js.org/concepts/mode/#usage)'s
|
||||||
|
which creates different
|
||||||
|
|
||||||
|
```js
|
||||||
|
module.exports = {
|
||||||
|
mode: 'development' // 'production'
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
When you are building your app using the WebPack CLI you can use the `--mode`
|
||||||
|
flag:
|
||||||
|
|
||||||
|
```
|
||||||
|
webpack --mode=production app.js -o /dist/bundle.js
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Node.js
|
||||||
|
|
||||||
|
When you are running your app using `Node.js` you should the `NODE_ENV`
|
||||||
|
environment variable to `production` to ensure that you libraries that you
|
||||||
|
import are optimized for production.
|
||||||
|
|
||||||
|
```
|
||||||
|
NODE_ENV=production node app.js
|
||||||
|
```
|
||||||
|
|
||||||
|
### API
|
||||||
|
|
||||||
|
The returned logger exposes some addition properties that can be used used in
|
||||||
|
your application or library:
|
||||||
|
|
||||||
|
#### .enabled
|
||||||
|
|
||||||
|
The returned logger will have a `.enabled` property assigned to it. This boolean
|
||||||
|
can be used to check if the logger was enabled:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const debug = require('@dabh/diagnostics')('foo:bar');
|
||||||
|
|
||||||
|
if (debug.enabled) {
|
||||||
|
//
|
||||||
|
// Do something special
|
||||||
|
//
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This property is exposed as:
|
||||||
|
|
||||||
|
- Property on the logger.
|
||||||
|
- Property on the meta/options object.
|
||||||
|
|
||||||
|
#### .namespace
|
||||||
|
|
||||||
|
This is the namespace that you originally provided to the function.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const debug = require('@dabh/diagnostics')('foo:bar');
|
||||||
|
|
||||||
|
console.log(debug.namespace); // foo:bar
|
||||||
|
```
|
||||||
|
|
||||||
|
This property is exposed as:
|
||||||
|
|
||||||
|
- Property on the logger.
|
||||||
|
- Property on the meta/options object.
|
||||||
|
|
||||||
|
#### .dev/prod
|
||||||
|
|
||||||
|
There are different builds available of `diagnostics`, when you create a
|
||||||
|
production build of your application using `NODE_ENV=production` you will be
|
||||||
|
given an optimized, smaller build of `diagnostics` to reduce your bundle size.
|
||||||
|
The `dev` and `prod` booleans on the returned logger indicate if you have a
|
||||||
|
production or development version of the logger.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const debug = require('@dabh/diagnostics')('foo:bar');
|
||||||
|
|
||||||
|
if (debug.prod) {
|
||||||
|
// do stuff
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This property is exposed as:
|
||||||
|
|
||||||
|
- Property on the logger.
|
||||||
|
- Property on the meta/options object.
|
||||||
|
|
||||||
|
#### set
|
||||||
|
|
||||||
|
Sets a new logger as default for **all** `diagnostic` instances. The passed
|
||||||
|
argument should be a function that write the log messages to where ever you
|
||||||
|
want. It receives 2 arguments:
|
||||||
|
|
||||||
|
1. `meta` An object with all the options that was provided to the original
|
||||||
|
logger that wants to write the log message as well as properties of the
|
||||||
|
debugger such as `prod`, `dev`, `namespace`, `enabled`. See [API](#api) for
|
||||||
|
all exposed properties.
|
||||||
|
2. `args` An array of the log messages that needs to be written.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const debug = require('@dabh/diagnostics')('foo:more:namespaces');
|
||||||
|
|
||||||
|
debug.use(function logger(meta, args) {
|
||||||
|
console.log(meta);
|
||||||
|
console.debug(...args);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
This method is exposed as:
|
||||||
|
|
||||||
|
- Method on the logger.
|
||||||
|
- Method on the meta/options object.
|
||||||
|
- Method on `diagnostics` module.
|
||||||
|
|
||||||
|
#### modify
|
||||||
|
|
||||||
|
The modify method allows you add a new message modifier to **all** `diagnostic`
|
||||||
|
instances. The passed argument should be a function that returns the passed
|
||||||
|
message after modification. The function receives 2 arguments:
|
||||||
|
|
||||||
|
1. `message`, Array, the log message.
|
||||||
|
2. `options`, Object, the options that were passed into the logger when it was
|
||||||
|
initially created.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const debug = require('@dabh/diagnostics')('example:modifiers');
|
||||||
|
|
||||||
|
debug.modify(function (message, options) {
|
||||||
|
return messages;
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
This method is exposed as:
|
||||||
|
|
||||||
|
- Method on the logger.
|
||||||
|
- Method on the meta/options object.
|
||||||
|
- Method on `diagnostics` module.
|
||||||
|
|
||||||
|
See [modifiers](#modifiers) for more information.
|
||||||
|
|
||||||
|
#### use
|
||||||
|
|
||||||
|
Adds a new `adapter` to **all** `diagnostic` instances. The passed argument
|
||||||
|
should be a function returns a boolean that indicates if the passed in
|
||||||
|
`namespace` is allowed to write log messages.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const diagnostics = require('@dabh/diagnostics');
|
||||||
|
const debug = diagnostics('foo:bar');
|
||||||
|
|
||||||
|
debug.use(function (namespace) {
|
||||||
|
return namespace === 'foo:bar';
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
This method is exposed as:
|
||||||
|
|
||||||
|
- Method on the logger.
|
||||||
|
- Method on the meta/options object.
|
||||||
|
- Method on `diagnostics` module.
|
||||||
|
|
||||||
|
See [adapters](#adapters) for more information.
|
||||||
|
|
||||||
|
### Modifiers
|
||||||
|
|
||||||
|
To be as flexible as possible when it comes to transforming messages we've
|
||||||
|
come up with the concept of `modifiers` which can enhance the debug messages.
|
||||||
|
This allows you to introduce functionality or details that you find important
|
||||||
|
for debug messages, and doesn't require us to add additional bloat to the
|
||||||
|
`diagnostic` core.
|
||||||
|
|
||||||
|
For example, you want the messages to be prefixed with the date-time of when
|
||||||
|
the log message occured:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const diagnostics = require('@dabh/diagnostics');
|
||||||
|
|
||||||
|
diagnostics.modify(function datetime(args, options) {
|
||||||
|
args.unshift(new Date());
|
||||||
|
return args;
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
Now all messages will be prefixed with date that is outputted by `new Date()`.
|
||||||
|
The following modifiers are shipped with `diagnostics` and are enabled in
|
||||||
|
**development** mode only:
|
||||||
|
|
||||||
|
- [namespace](#namespace)
|
||||||
|
|
||||||
|
#### namespace
|
||||||
|
|
||||||
|
This modifier is enabled for all debug instances and prefixes the messages
|
||||||
|
with the name of namespace under which it is logged. The namespace is colored
|
||||||
|
using the `colorspace` module which groups similar namespaces under the same
|
||||||
|
colorspace. You can have multiple namespaces for the debuggers where each
|
||||||
|
namespace should be separated by a `:`
|
||||||
|
|
||||||
|
```
|
||||||
|
foo
|
||||||
|
foo:bar
|
||||||
|
foo:bar:baz
|
||||||
|
```
|
||||||
|
|
||||||
|
For console based output the `namespace-ansi` is used.
|
||||||
|
|
||||||
|
### Adapters
|
||||||
|
|
||||||
|
Adapters allows `diagnostics` to pull the `DEBUG` and `DIAGNOSTICS` environment
|
||||||
|
variables from different sources. Not every JavaScript environment has a
|
||||||
|
`process.env` that we can leverage. Adapters allows us to have different
|
||||||
|
adapters for different environments. It means you can write your own custom
|
||||||
|
adapter if needed as well.
|
||||||
|
|
||||||
|
The `adapter` function should be passed a function as argument, this function
|
||||||
|
will receive the `namespace` of a logger as argument and it should return a
|
||||||
|
boolean that indicates if that logger should be enabled or not.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const debug = require('@dabh/diagnostics')('example:namespace');
|
||||||
|
|
||||||
|
debug.adapter(require('@dabh/diagnostics/adapters/localstorage'));
|
||||||
|
```
|
||||||
|
|
||||||
|
The modifiers are only enabled for `development`. The following adapters are
|
||||||
|
available are available:
|
||||||
|
|
||||||
|
#### process.env
|
||||||
|
|
||||||
|
This adapter is enabled for `node.js`.
|
||||||
|
|
||||||
|
Uses the `DEBUG` or `DIAGNOSTICS` (both are recognized) environment variables to
|
||||||
|
pass in debug flag:
|
||||||
|
|
||||||
|
**UNIX/Linux/Mac**
|
||||||
|
```
|
||||||
|
DEBUG=foo* node index.js
|
||||||
|
```
|
||||||
|
|
||||||
|
Using environment variables on Windows is a bit different, and also depends on
|
||||||
|
toolchain you are using:
|
||||||
|
|
||||||
|
**Windows**
|
||||||
|
```
|
||||||
|
set DEBUG=foo* & node index.js
|
||||||
|
```
|
||||||
|
|
||||||
|
**Powershell**
|
||||||
|
```
|
||||||
|
$env:DEBUG='foo*';node index.js
|
||||||
|
```
|
||||||
|
|
||||||
|
#### hash
|
||||||
|
|
||||||
|
This adapter is enabled for `browsers`.
|
||||||
|
|
||||||
|
This adapter uses the `window.location.hash` of as source for the environment
|
||||||
|
variables. It assumes that hash is formatted using the same syntax as query
|
||||||
|
strings:
|
||||||
|
|
||||||
|
```js
|
||||||
|
http://example.com/foo/bar#debug=foo*
|
||||||
|
```
|
||||||
|
|
||||||
|
It triggers on both the `debug=` and `diagnostics=` names.
|
||||||
|
|
||||||
|
#### localStorage
|
||||||
|
|
||||||
|
This adapter is enabled for `browsers`.
|
||||||
|
|
||||||
|
This adapter uses the `localStorage` of the browser to store the debug flags.
|
||||||
|
You can set the debug flag your self in your application code, but you can
|
||||||
|
also open browser WebInspector and enable it through the console.
|
||||||
|
|
||||||
|
```js
|
||||||
|
localStorage.setItem('debug', 'foo*');
|
||||||
|
```
|
||||||
|
|
||||||
|
It triggers on both the `debug` and `diagnostics` storage items. (Please note
|
||||||
|
that these keys should be entered in lowercase)
|
||||||
|
|
||||||
|
#### AsyncStorage
|
||||||
|
|
||||||
|
This adapter is enabled for `react-native`.
|
||||||
|
|
||||||
|
This adapter uses the `AsyncStorage` API that is exposed by the `react-native`
|
||||||
|
library to store and read the `debug` or `diagnostics` storage items.
|
||||||
|
|
||||||
|
```js
|
||||||
|
import { AsyncStorage } from 'react-native';
|
||||||
|
|
||||||
|
AsyncStorage.setItem('debug', 'foo*');
|
||||||
|
```
|
||||||
|
|
||||||
|
Unlike other adapters, this is the only adapter that is `async` so that means
|
||||||
|
that we're not able to instantly determine if a created logger should be
|
||||||
|
enabled or disabled. So when a logger is created in `react-native` we initially
|
||||||
|
assume it's disabled, any message that send during period will be queued
|
||||||
|
internally.
|
||||||
|
|
||||||
|
Once we've received the data from the `AsyncStorage` API we will determine
|
||||||
|
if the logger should be enabled, flush the queued messages if needed and set
|
||||||
|
all `enabled` properties accordingly on the returned logger.
|
||||||
|
|
||||||
|
### Loggers
|
||||||
|
|
||||||
|
By default it will log all messages to `console.log` in when the logger is
|
||||||
|
enabled using the debug flag that is set using one of the adapters.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[MIT](LICENSE)
|
||||||
11
node_modules/@dabh/diagnostics/adapters/hash.js
generated
vendored
Normal file
11
node_modules/@dabh/diagnostics/adapters/hash.js
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
var adapter = require('./');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extracts the values from process.env.
|
||||||
|
*
|
||||||
|
* @type {Function}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
module.exports = adapter(function hash() {
|
||||||
|
return /(debug|diagnostics)=([^&]+)/i.exec(window.location.hash)[2];
|
||||||
|
});
|
||||||
18
node_modules/@dabh/diagnostics/adapters/index.js
generated
vendored
Normal file
18
node_modules/@dabh/diagnostics/adapters/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
var enabled = require('enabled');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Adapter.
|
||||||
|
*
|
||||||
|
* @param {Function} fn Function that returns the value.
|
||||||
|
* @returns {Function} The adapter logic.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
module.exports = function create(fn) {
|
||||||
|
return function adapter(namespace) {
|
||||||
|
try {
|
||||||
|
return enabled(namespace, fn());
|
||||||
|
} catch (e) { /* Any failure means that we found nothing */ }
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
}
|
||||||
11
node_modules/@dabh/diagnostics/adapters/localstorage.js
generated
vendored
Normal file
11
node_modules/@dabh/diagnostics/adapters/localstorage.js
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
var adapter = require('./');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extracts the values from process.env.
|
||||||
|
*
|
||||||
|
* @type {Function}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
module.exports = adapter(function storage() {
|
||||||
|
return localStorage.getItem('debug') || localStorage.getItem('diagnostics');
|
||||||
|
});
|
||||||
11
node_modules/@dabh/diagnostics/adapters/process.env.js
generated
vendored
Normal file
11
node_modules/@dabh/diagnostics/adapters/process.env.js
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
var adapter = require('./');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extracts the values from process.env.
|
||||||
|
*
|
||||||
|
* @type {Function}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
module.exports = adapter(function processenv() {
|
||||||
|
return process.env.DEBUG || process.env.DIAGNOSTICS;
|
||||||
|
});
|
||||||
35
node_modules/@dabh/diagnostics/browser/development.js
generated
vendored
Normal file
35
node_modules/@dabh/diagnostics/browser/development.js
generated
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
var create = require('../diagnostics');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new diagnostics logger.
|
||||||
|
*
|
||||||
|
* @param {String} namespace The namespace it should enable.
|
||||||
|
* @param {Object} options Additional options.
|
||||||
|
* @returns {Function} The logger.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
var diagnostics = create(function dev(namespace, options) {
|
||||||
|
options = options || {};
|
||||||
|
options.namespace = namespace;
|
||||||
|
options.prod = false;
|
||||||
|
options.dev = true;
|
||||||
|
|
||||||
|
if (!dev.enabled(namespace) && !(options.force || dev.force)) {
|
||||||
|
return dev.nope(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dev.yep(options);
|
||||||
|
});
|
||||||
|
|
||||||
|
//
|
||||||
|
// Configure the logger for the given environment.
|
||||||
|
//
|
||||||
|
diagnostics.modify(require('../modifiers/namespace'));
|
||||||
|
diagnostics.use(require('../adapters/localstorage'));
|
||||||
|
diagnostics.use(require('../adapters/hash'));
|
||||||
|
diagnostics.set(require('../logger/console'));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Expose the diagnostics logger.
|
||||||
|
//
|
||||||
|
module.exports = diagnostics;
|
||||||
8
node_modules/@dabh/diagnostics/browser/index.js
generated
vendored
Normal file
8
node_modules/@dabh/diagnostics/browser/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
//
|
||||||
|
// Select the correct build version depending on the environment.
|
||||||
|
//
|
||||||
|
if (process.env.NODE_ENV === 'production') {
|
||||||
|
module.exports = require('./production.js');
|
||||||
|
} else {
|
||||||
|
module.exports = require('./development.js');
|
||||||
|
}
|
||||||
6
node_modules/@dabh/diagnostics/browser/override.js
generated
vendored
Normal file
6
node_modules/@dabh/diagnostics/browser/override.js
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
var diagnostics = require('./');
|
||||||
|
|
||||||
|
//
|
||||||
|
// No way to override `debug` with `diagnostics` in the browser.
|
||||||
|
//
|
||||||
|
module.exports = diagnostics;
|
||||||
24
node_modules/@dabh/diagnostics/browser/production.js
generated
vendored
Normal file
24
node_modules/@dabh/diagnostics/browser/production.js
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
var create = require('../diagnostics');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new diagnostics logger.
|
||||||
|
*
|
||||||
|
* @param {String} namespace The namespace it should enable.
|
||||||
|
* @param {Object} options Additional options.
|
||||||
|
* @returns {Function} The logger.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
var diagnostics = create(function prod(namespace, options) {
|
||||||
|
options = options || {};
|
||||||
|
options.namespace = namespace;
|
||||||
|
options.prod = true;
|
||||||
|
options.dev = false;
|
||||||
|
|
||||||
|
if (!(options.force || prod.force)) return prod.nope(options);
|
||||||
|
return prod.yep(options);
|
||||||
|
});
|
||||||
|
|
||||||
|
//
|
||||||
|
// Expose the diagnostics logger.
|
||||||
|
//
|
||||||
|
module.exports = diagnostics;
|
||||||
212
node_modules/@dabh/diagnostics/diagnostics.js
generated
vendored
Normal file
212
node_modules/@dabh/diagnostics/diagnostics.js
generated
vendored
Normal file
|
|
@ -0,0 +1,212 @@
|
||||||
|
/**
|
||||||
|
* Contains all configured adapters for the given environment.
|
||||||
|
*
|
||||||
|
* @type {Array}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
var adapters = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains all modifier functions.
|
||||||
|
*
|
||||||
|
* @typs {Array}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
var modifiers = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Our default logger.
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
var logger = function devnull() {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register a new adapter that will used to find environments.
|
||||||
|
*
|
||||||
|
* @param {Function} adapter A function that will return the possible env.
|
||||||
|
* @returns {Boolean} Indication of a successful add.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
function use(adapter) {
|
||||||
|
if (~adapters.indexOf(adapter)) return false;
|
||||||
|
|
||||||
|
adapters.push(adapter);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assign a new log method.
|
||||||
|
*
|
||||||
|
* @param {Function} custom The log method.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
function set(custom) {
|
||||||
|
logger = custom;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the namespace is allowed by any of our adapters.
|
||||||
|
*
|
||||||
|
* @param {String} namespace The namespace that needs to be enabled
|
||||||
|
* @returns {Boolean|Promise} Indication if the namespace is enabled by our adapters.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
function enabled(namespace) {
|
||||||
|
var async = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < adapters.length; i++) {
|
||||||
|
if (adapters[i].async) {
|
||||||
|
async.push(adapters[i]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (adapters[i](namespace)) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!async.length) return false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Now that we know that we Async functions, we know we run in an ES6
|
||||||
|
// environment and can use all the API's that they offer, in this case
|
||||||
|
// we want to return a Promise so that we can `await` in React-Native
|
||||||
|
// for an async adapter.
|
||||||
|
//
|
||||||
|
return new Promise(function pinky(resolve) {
|
||||||
|
Promise.all(
|
||||||
|
async.map(function prebind(fn) {
|
||||||
|
return fn(namespace);
|
||||||
|
})
|
||||||
|
).then(function resolved(values) {
|
||||||
|
resolve(values.some(Boolean));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new message modifier to the debugger.
|
||||||
|
*
|
||||||
|
* @param {Function} fn Modification function.
|
||||||
|
* @returns {Boolean} Indication of a successful add.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
function modify(fn) {
|
||||||
|
if (~modifiers.indexOf(fn)) return false;
|
||||||
|
|
||||||
|
modifiers.push(fn);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write data to the supplied logger.
|
||||||
|
*
|
||||||
|
* @param {Object} meta Meta information about the log.
|
||||||
|
* @param {Array} args Arguments for console.log.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
function write() {
|
||||||
|
logger.apply(logger, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process the message with the modifiers.
|
||||||
|
*
|
||||||
|
* @param {Mixed} message The message to be transformed by modifers.
|
||||||
|
* @returns {String} Transformed message.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
function process(message) {
|
||||||
|
for (var i = 0; i < modifiers.length; i++) {
|
||||||
|
message = modifiers[i].apply(modifiers[i], arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Introduce options to the logger function.
|
||||||
|
*
|
||||||
|
* @param {Function} fn Calback function.
|
||||||
|
* @param {Object} options Properties to introduce on fn.
|
||||||
|
* @returns {Function} The passed function
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
function introduce(fn, options) {
|
||||||
|
var has = Object.prototype.hasOwnProperty;
|
||||||
|
|
||||||
|
for (var key in options) {
|
||||||
|
if (has.call(options, key)) {
|
||||||
|
fn[key] = options[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return fn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Nope, we're not allowed to write messages.
|
||||||
|
*
|
||||||
|
* @returns {Boolean} false
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
function nope(options) {
|
||||||
|
options.enabled = false;
|
||||||
|
options.modify = modify;
|
||||||
|
options.set = set;
|
||||||
|
options.use = use;
|
||||||
|
|
||||||
|
return introduce(function diagnopes() {
|
||||||
|
return false;
|
||||||
|
}, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Yep, we're allowed to write debug messages.
|
||||||
|
*
|
||||||
|
* @param {Object} options The options for the process.
|
||||||
|
* @returns {Function} The function that does the logging.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
function yep(options) {
|
||||||
|
/**
|
||||||
|
* The function that receives the actual debug information.
|
||||||
|
*
|
||||||
|
* @returns {Boolean} indication that we're logging.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
function diagnostics() {
|
||||||
|
var args = Array.prototype.slice.call(arguments, 0);
|
||||||
|
|
||||||
|
write.call(write, options, process(args, options));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
options.enabled = true;
|
||||||
|
options.modify = modify;
|
||||||
|
options.set = set;
|
||||||
|
options.use = use;
|
||||||
|
|
||||||
|
return introduce(diagnostics, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple helper function to introduce various of helper methods to our given
|
||||||
|
* diagnostics function.
|
||||||
|
*
|
||||||
|
* @param {Function} diagnostics The diagnostics function.
|
||||||
|
* @returns {Function} diagnostics
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
module.exports = function create(diagnostics) {
|
||||||
|
diagnostics.introduce = introduce;
|
||||||
|
diagnostics.enabled = enabled;
|
||||||
|
diagnostics.process = process;
|
||||||
|
diagnostics.modify = modify;
|
||||||
|
diagnostics.write = write;
|
||||||
|
diagnostics.nope = nope;
|
||||||
|
diagnostics.yep = yep;
|
||||||
|
diagnostics.set = set;
|
||||||
|
diagnostics.use = use;
|
||||||
|
|
||||||
|
return diagnostics;
|
||||||
|
}
|
||||||
19
node_modules/@dabh/diagnostics/logger/console.js
generated
vendored
Normal file
19
node_modules/@dabh/diagnostics/logger/console.js
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
/**
|
||||||
|
* An idiot proof logger to be used as default. We've wrapped it in a try/catch
|
||||||
|
* statement to ensure the environments without the `console` API do not crash
|
||||||
|
* as well as an additional fix for ancient browsers like IE8 where the
|
||||||
|
* `console.log` API doesn't have an `apply`, so we need to use the Function's
|
||||||
|
* apply functionality to apply the arguments.
|
||||||
|
*
|
||||||
|
* @param {Object} meta Options of the logger.
|
||||||
|
* @param {Array} messages The actuall message that needs to be logged.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
module.exports = function (meta, messages) {
|
||||||
|
//
|
||||||
|
// So yea. IE8 doesn't have an apply so we need a work around to puke the
|
||||||
|
// arguments in place.
|
||||||
|
//
|
||||||
|
try { Function.prototype.apply.call(console.log, console, messages); }
|
||||||
|
catch (e) {}
|
||||||
|
}
|
||||||
20
node_modules/@dabh/diagnostics/modifiers/namespace-ansi.js
generated
vendored
Normal file
20
node_modules/@dabh/diagnostics/modifiers/namespace-ansi.js
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
var colorspace = require('@so-ric/colorspace');
|
||||||
|
var kuler = require('kuler');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prefix the messages with a colored namespace.
|
||||||
|
*
|
||||||
|
* @param {Array} args The messages array that is getting written.
|
||||||
|
* @param {Object} options Options for diagnostics.
|
||||||
|
* @returns {Array} Altered messages array.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
module.exports = function ansiModifier(args, options) {
|
||||||
|
var namespace = options.namespace;
|
||||||
|
var ansi = options.colors !== false
|
||||||
|
? kuler(namespace +':', colorspace(namespace))
|
||||||
|
: namespace +':';
|
||||||
|
|
||||||
|
args[0] = ansi +' '+ args[0];
|
||||||
|
return args;
|
||||||
|
};
|
||||||
32
node_modules/@dabh/diagnostics/modifiers/namespace.js
generated
vendored
Normal file
32
node_modules/@dabh/diagnostics/modifiers/namespace.js
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
var colorspace = require('@so-ric/colorspace');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prefix the messages with a colored namespace.
|
||||||
|
*
|
||||||
|
* @param {Array} messages The messages array that is getting written.
|
||||||
|
* @param {Object} options Options for diagnostics.
|
||||||
|
* @returns {Array} Altered messages array.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
module.exports = function colorNamespace(args, options) {
|
||||||
|
var namespace = options.namespace;
|
||||||
|
|
||||||
|
if (options.colors === false) {
|
||||||
|
args[0] = namespace +': '+ args[0];
|
||||||
|
return args;
|
||||||
|
}
|
||||||
|
|
||||||
|
var color = colorspace(namespace);
|
||||||
|
|
||||||
|
//
|
||||||
|
// The console API supports a special %c formatter in browsers. This is used
|
||||||
|
// to style console messages with any CSS styling, in our case we want to
|
||||||
|
// use colorize the namespace for clarity. As these are formatters, and
|
||||||
|
// we need to inject our CSS string as second messages argument so it
|
||||||
|
// gets picked up correctly.
|
||||||
|
//
|
||||||
|
args[0] = '%c'+ namespace +':%c '+ args[0];
|
||||||
|
args.splice(1, 0, 'color:'+ color, 'color:inherit');
|
||||||
|
|
||||||
|
return args;
|
||||||
|
};
|
||||||
36
node_modules/@dabh/diagnostics/node/development.js
generated
vendored
Normal file
36
node_modules/@dabh/diagnostics/node/development.js
generated
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
var create = require('../diagnostics');
|
||||||
|
var tty = require('tty').isatty(1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new diagnostics logger.
|
||||||
|
*
|
||||||
|
* @param {String} namespace The namespace it should enable.
|
||||||
|
* @param {Object} options Additional options.
|
||||||
|
* @returns {Function} The logger.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
var diagnostics = create(function dev(namespace, options) {
|
||||||
|
options = options || {};
|
||||||
|
options.colors = 'colors' in options ? options.colors : tty;
|
||||||
|
options.namespace = namespace;
|
||||||
|
options.prod = false;
|
||||||
|
options.dev = true;
|
||||||
|
|
||||||
|
if (!dev.enabled(namespace) && !(options.force || dev.force)) {
|
||||||
|
return dev.nope(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dev.yep(options);
|
||||||
|
});
|
||||||
|
|
||||||
|
//
|
||||||
|
// Configure the logger for the given environment.
|
||||||
|
//
|
||||||
|
diagnostics.modify(require('../modifiers/namespace-ansi'));
|
||||||
|
diagnostics.use(require('../adapters/process.env'));
|
||||||
|
diagnostics.set(require('../logger/console'));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Expose the diagnostics logger.
|
||||||
|
//
|
||||||
|
module.exports = diagnostics;
|
||||||
8
node_modules/@dabh/diagnostics/node/index.js
generated
vendored
Normal file
8
node_modules/@dabh/diagnostics/node/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
//
|
||||||
|
// Select the correct build version depending on the environment.
|
||||||
|
//
|
||||||
|
if (process.env.NODE_ENV === 'production') {
|
||||||
|
module.exports = require('./production.js');
|
||||||
|
} else {
|
||||||
|
module.exports = require('./development.js');
|
||||||
|
}
|
||||||
21
node_modules/@dabh/diagnostics/node/override.js
generated
vendored
Normal file
21
node_modules/@dabh/diagnostics/node/override.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
const diagnostics = require('./');
|
||||||
|
|
||||||
|
//
|
||||||
|
// Override the existing `debug` call so it will use `diagnostics` instead
|
||||||
|
// of the `debug` module.
|
||||||
|
//
|
||||||
|
try {
|
||||||
|
var key = require.resolve('debug');
|
||||||
|
|
||||||
|
require.cache[key] = {
|
||||||
|
exports: diagnostics,
|
||||||
|
filename: key,
|
||||||
|
loaded: true,
|
||||||
|
id: key
|
||||||
|
};
|
||||||
|
} catch (e) { /* We don't really care if it fails */ }
|
||||||
|
|
||||||
|
//
|
||||||
|
// Export the default import as exports again.
|
||||||
|
//
|
||||||
|
module.exports = diagnostics;
|
||||||
24
node_modules/@dabh/diagnostics/node/production.js
generated
vendored
Normal file
24
node_modules/@dabh/diagnostics/node/production.js
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
var create = require('../diagnostics');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new diagnostics logger.
|
||||||
|
*
|
||||||
|
* @param {String} namespace The namespace it should enable.
|
||||||
|
* @param {Object} options Additional options.
|
||||||
|
* @returns {Function} The logger.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
var diagnostics = create(function prod(namespace, options) {
|
||||||
|
options = options || {};
|
||||||
|
options.namespace = namespace;
|
||||||
|
options.prod = true;
|
||||||
|
options.dev = false;
|
||||||
|
|
||||||
|
if (!(options.force || prod.force)) return prod.nope(options);
|
||||||
|
return prod.yep(options);
|
||||||
|
});
|
||||||
|
|
||||||
|
//
|
||||||
|
// Expose the diagnostics logger.
|
||||||
|
//
|
||||||
|
module.exports = diagnostics;
|
||||||
64
node_modules/@dabh/diagnostics/package.json
generated
vendored
Normal file
64
node_modules/@dabh/diagnostics/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
{
|
||||||
|
"name": "@dabh/diagnostics",
|
||||||
|
"version": "2.0.8",
|
||||||
|
"description": "Tools for debugging your node.js modules and event loop",
|
||||||
|
"main": "./node",
|
||||||
|
"browser": "./browser",
|
||||||
|
"scripts": {
|
||||||
|
"test:basic": "mocha --require test/mock.js test/*.test.js",
|
||||||
|
"test:node": "mocha --require test/mock test/node.js",
|
||||||
|
"test:browser": "mocha --require test/mock test/browser.js",
|
||||||
|
"test:runner": "npm run test:basic && npm run test:node && npm run test:browser",
|
||||||
|
"webpack:node:prod": "webpack --mode=production node/index.js -o /dev/null --json | webpack-bundle-size-analyzer",
|
||||||
|
"webpack:node:dev": "webpack --mode=development node/index.js -o /dev/null --json | webpack-bundle-size-analyzer",
|
||||||
|
"webpack:browser:prod": "webpack --mode=production browser/index.js -o /dev/null --json | webpack-bundle-size-analyzer",
|
||||||
|
"webpack:browser:dev": "webpack --mode=development browser/index.js -o /dev/null --json | webpack-bundle-size-analyzer",
|
||||||
|
"test": "nyc --reporter=text --reporter=lcov npm run test:runner"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/DABH/diagnostics.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"debug",
|
||||||
|
"debugger",
|
||||||
|
"debugging",
|
||||||
|
"diagnostic",
|
||||||
|
"diagnostics",
|
||||||
|
"event",
|
||||||
|
"loop",
|
||||||
|
"metrics",
|
||||||
|
"stats"
|
||||||
|
],
|
||||||
|
"author": "Arnout Kazemier",
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/DABH/diagnostics/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/DABH/diagnostics",
|
||||||
|
"devDependencies": {
|
||||||
|
"assume": "2.3.x",
|
||||||
|
"asyncstorageapi": "^1.0.2",
|
||||||
|
"mocha": "^11.7.2",
|
||||||
|
"nyc": "^17.1.0",
|
||||||
|
"objstorage": "^1.0.0",
|
||||||
|
"pre-commit": "github:metcalfc/pre-commit#b36c649fd5348d7604a86b7b2f3429c780d1478f",
|
||||||
|
"require-poisoning": "^2.0.0",
|
||||||
|
"webpack": "5.x",
|
||||||
|
"webpack-bundle-size-analyzer": "^3.0.0",
|
||||||
|
"webpack-cli": "6.x"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@so-ric/colorspace": "^1.1.6",
|
||||||
|
"enabled": "2.0.x",
|
||||||
|
"kuler": "^2.0.0"
|
||||||
|
},
|
||||||
|
"contributors": [
|
||||||
|
"Martijn Swaagman (https://github.com/swaagie)",
|
||||||
|
"Jarrett Cruger (https://github.com/jcrugzz)",
|
||||||
|
"Sevastos (https://github.com/sevastos)"
|
||||||
|
],
|
||||||
|
"directories": {
|
||||||
|
"test": "test"
|
||||||
|
}
|
||||||
|
}
|
||||||
9
node_modules/@so-ric/colorspace/CHANGELOG.md
generated
vendored
Normal file
9
node_modules/@so-ric/colorspace/CHANGELOG.md
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
# CHANGELOG
|
||||||
|
|
||||||
|
## 1.1.4
|
||||||
|
|
||||||
|
- Revert release 1.1.3 which introduced a breaking change
|
||||||
|
|
||||||
|
## 1.1.3
|
||||||
|
|
||||||
|
- Apply security patches
|
||||||
20
node_modules/@so-ric/colorspace/LICENSE.md
generated
vendored
Normal file
20
node_modules/@so-ric/colorspace/LICENSE.md
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2015 Arnout Kazemier, Martijn Swaagman, the Contributors.
|
||||||
|
|
||||||
|
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/@so-ric/colorspace/README.md
generated
vendored
Normal file
46
node_modules/@so-ric/colorspace/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
Based on Arnout Kazemier's https://github.com/3rd-Eden/colorspace, only difference is updated packages to remove security vulnerbilities.
|
||||||
|
All credit goes to him.
|
||||||
|
|
||||||
|
# colorspace
|
||||||
|
|
||||||
|
Colorspace is a simple module which generates HEX color codes for namespaces.
|
||||||
|
The base color is decided by the first part of the namespace. All other parts of
|
||||||
|
the namespace alters the color tone. This way you can visually see which
|
||||||
|
namespaces belong together and which does not.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
The module is released in the public npm registry and can be installed by
|
||||||
|
running:
|
||||||
|
|
||||||
|
```
|
||||||
|
npm install --save @so-ric/colorspace
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
We assume that you've already required the module using the following code:
|
||||||
|
|
||||||
|
```js
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var colorspace = require('@so-ric/colorspace');
|
||||||
|
```
|
||||||
|
|
||||||
|
The returned function accepts 2 arguments:
|
||||||
|
|
||||||
|
1. `namespace` **string**, The namespace that needs to have a HEX color
|
||||||
|
generated.
|
||||||
|
2. `delimiter`, **string**, **optional**, Delimiter to find the different
|
||||||
|
sections of the namespace. Defaults to `:`
|
||||||
|
|
||||||
|
#### Example
|
||||||
|
|
||||||
|
```js
|
||||||
|
console.log(colorspace('color')) // #6b4b3a
|
||||||
|
console.log(colorspace('color:space')) // #796B67
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT
|
||||||
2071
node_modules/@so-ric/colorspace/dist/index.cjs.js
generated
vendored
Normal file
2071
node_modules/@so-ric/colorspace/dist/index.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
29
node_modules/@so-ric/colorspace/index.js
generated
vendored
Normal file
29
node_modules/@so-ric/colorspace/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
import color from 'color';
|
||||||
|
import hex from 'text-hex';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a color for a given name. But be reasonably smart about it by
|
||||||
|
* understanding name spaces and coloring each namespace a bit lighter so they
|
||||||
|
* still have the same base color as the root.
|
||||||
|
*
|
||||||
|
* @param {string} namespace The namespace
|
||||||
|
* @param {string} [delimiter] The delimiter
|
||||||
|
* @returns {string} color
|
||||||
|
*/
|
||||||
|
export default function colorspace(namespace, delimiter) {
|
||||||
|
const split = namespace.split(delimiter || ':');
|
||||||
|
let base = hex(split[0]);
|
||||||
|
|
||||||
|
if (!split.length) return base;
|
||||||
|
|
||||||
|
for (let i = 0, l = split.length - 1; i < l; i++) {
|
||||||
|
base = color(base)
|
||||||
|
.mix(color(hex(split[i + 1])))
|
||||||
|
.saturate(1)
|
||||||
|
.hex();
|
||||||
|
}
|
||||||
|
|
||||||
|
return base;
|
||||||
|
};
|
||||||
45
node_modules/@so-ric/colorspace/package.json
generated
vendored
Normal file
45
node_modules/@so-ric/colorspace/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
{
|
||||||
|
"name": "@so-ric/colorspace",
|
||||||
|
"version": "1.1.6",
|
||||||
|
"description": "Generate HEX colors for a given namespace using color v5",
|
||||||
|
"main": "dist/index.cjs.js",
|
||||||
|
"scripts": {
|
||||||
|
"build": "rollup -c",
|
||||||
|
"prepare": "npm run build",
|
||||||
|
"test": "mocha test.js"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"namespace",
|
||||||
|
"color",
|
||||||
|
"hex",
|
||||||
|
"colorize",
|
||||||
|
"name",
|
||||||
|
"space",
|
||||||
|
"colorspace"
|
||||||
|
],
|
||||||
|
"author": "Arnout Kazemier",
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/so-ric/colorspace/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/so-ric/colorspace",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/so-ric/colorspace"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"color": "^5.0.2",
|
||||||
|
"text-hex": "1.0.x"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"assume": "2.3.x",
|
||||||
|
"mocha": "11.7.x",
|
||||||
|
"pre-commit": "1.2.x",
|
||||||
|
"rollup": "^3.0.0",
|
||||||
|
"@rollup/plugin-node-resolve": "^15.0.0",
|
||||||
|
"@rollup/plugin-commonjs": "^25.0.0",
|
||||||
|
"@rollup/plugin-json": "^5.0.0",
|
||||||
|
"@rollup/plugin-babel": "^6.0.0",
|
||||||
|
"rimraf": "^5.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
25
node_modules/@so-ric/colorspace/rollup.config.js
generated
vendored
Normal file
25
node_modules/@so-ric/colorspace/rollup.config.js
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
import resolve from '@rollup/plugin-node-resolve';
|
||||||
|
import commonjs from '@rollup/plugin-commonjs';
|
||||||
|
import json from '@rollup/plugin-json';
|
||||||
|
import { babel } from '@rollup/plugin-babel';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
input: 'index.js',
|
||||||
|
plugins: [
|
||||||
|
resolve({
|
||||||
|
preferBuiltins: true,
|
||||||
|
browser: false
|
||||||
|
}),
|
||||||
|
commonjs(),
|
||||||
|
json(),
|
||||||
|
babel({
|
||||||
|
babelHelpers: 'bundled',
|
||||||
|
exclude: 'node_modules/**'
|
||||||
|
})
|
||||||
|
],
|
||||||
|
output: {
|
||||||
|
file: 'dist/index.cjs.js',
|
||||||
|
format: 'cjs',
|
||||||
|
exports: 'auto'
|
||||||
|
}
|
||||||
|
};
|
||||||
21
node_modules/@types/triple-beam/LICENSE
generated
vendored
Normal file
21
node_modules/@types/triple-beam/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Microsoft Corporation.
|
||||||
|
|
||||||
|
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
|
||||||
36
node_modules/@types/triple-beam/README.md
generated
vendored
Normal file
36
node_modules/@types/triple-beam/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
# Installation
|
||||||
|
> `npm install --save @types/triple-beam`
|
||||||
|
|
||||||
|
# Summary
|
||||||
|
This package contains type definitions for triple-beam (https://github.com/winstonjs/triple-beam).
|
||||||
|
|
||||||
|
# Details
|
||||||
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/triple-beam.
|
||||||
|
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/triple-beam/index.d.ts)
|
||||||
|
````ts
|
||||||
|
export as namespace TripleBeam;
|
||||||
|
|
||||||
|
export const LEVEL: unique symbol;
|
||||||
|
export const MESSAGE: unique symbol;
|
||||||
|
export const SPLAT: unique symbol;
|
||||||
|
export const configs: Configs;
|
||||||
|
|
||||||
|
export interface Config {
|
||||||
|
readonly levels: { [k: string]: number };
|
||||||
|
readonly colors: { [k: string]: string };
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Configs {
|
||||||
|
readonly cli: Config;
|
||||||
|
readonly npm: Config;
|
||||||
|
readonly syslog: Config;
|
||||||
|
}
|
||||||
|
|
||||||
|
````
|
||||||
|
|
||||||
|
### Additional Details
|
||||||
|
* Last updated: Tue, 07 Nov 2023 15:11:36 GMT
|
||||||
|
* Dependencies: none
|
||||||
|
|
||||||
|
# Credits
|
||||||
|
These definitions were written by [Daniel Byrne](https://github.com/danwbyrne).
|
||||||
17
node_modules/@types/triple-beam/index.d.ts
generated
vendored
Normal file
17
node_modules/@types/triple-beam/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
export as namespace TripleBeam;
|
||||||
|
|
||||||
|
export const LEVEL: unique symbol;
|
||||||
|
export const MESSAGE: unique symbol;
|
||||||
|
export const SPLAT: unique symbol;
|
||||||
|
export const configs: Configs;
|
||||||
|
|
||||||
|
export interface Config {
|
||||||
|
readonly levels: { [k: string]: number };
|
||||||
|
readonly colors: { [k: string]: string };
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Configs {
|
||||||
|
readonly cli: Config;
|
||||||
|
readonly npm: Config;
|
||||||
|
readonly syslog: Config;
|
||||||
|
}
|
||||||
25
node_modules/@types/triple-beam/package.json
generated
vendored
Normal file
25
node_modules/@types/triple-beam/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"name": "@types/triple-beam",
|
||||||
|
"version": "1.3.5",
|
||||||
|
"description": "TypeScript definitions for triple-beam",
|
||||||
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/triple-beam",
|
||||||
|
"license": "MIT",
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Daniel Byrne",
|
||||||
|
"githubUsername": "danwbyrne",
|
||||||
|
"url": "https://github.com/danwbyrne"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"main": "",
|
||||||
|
"types": "index.d.ts",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||||
|
"directory": "types/triple-beam"
|
||||||
|
},
|
||||||
|
"scripts": {},
|
||||||
|
"dependencies": {},
|
||||||
|
"typesPublisherContentHash": "aba808a8cd292b633d60f24f8ed117bf7f4f83771da677fe4d557c4e1ad3211b",
|
||||||
|
"typeScriptVersion": "4.5"
|
||||||
|
}
|
||||||
21
node_modules/@types/winston/LICENSE
generated
vendored
Normal file
21
node_modules/@types/winston/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
|
||||||
|
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
|
||||||
3
node_modules/@types/winston/README.md
generated
vendored
Normal file
3
node_modules/@types/winston/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
This is a stub types definition for winston (https://github.com/winstonjs/winston.git).
|
||||||
|
|
||||||
|
winston provides its own type definitions, so you don't need @types/winston installed!
|
||||||
14
node_modules/@types/winston/package.json
generated
vendored
Normal file
14
node_modules/@types/winston/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"name": "@types/winston",
|
||||||
|
"version": "2.4.4",
|
||||||
|
"typings": null,
|
||||||
|
"description": "Stub TypeScript definitions entry for winston, which provides its own types definitions",
|
||||||
|
"main": "",
|
||||||
|
"scripts": {},
|
||||||
|
"author": "",
|
||||||
|
"repository": "https://github.com/winstonjs/winston.git",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"winston": "*"
|
||||||
|
}
|
||||||
|
}
|
||||||
351
node_modules/async/CHANGELOG.md
generated
vendored
Normal file
351
node_modules/async/CHANGELOG.md
generated
vendored
Normal file
|
|
@ -0,0 +1,351 @@
|
||||||
|
# v3.2.5
|
||||||
|
- Ensure `Error` objects such as `AggregateError` are propagated without modification (#1920)
|
||||||
|
|
||||||
|
# v3.2.4
|
||||||
|
- Fix a bug in `priorityQueue` where it didn't wait for the result. (#1725)
|
||||||
|
- Fix a bug where `unshiftAsync` was included in `priorityQueue`. (#1790)
|
||||||
|
|
||||||
|
# v3.2.3
|
||||||
|
- Fix bugs in comment parsing in `autoInject`. (#1767, #1780)
|
||||||
|
|
||||||
|
# v3.2.2
|
||||||
|
- Fix potential prototype pollution exploit
|
||||||
|
|
||||||
|
# v3.2.1
|
||||||
|
- Use `queueMicrotask` if available to the environment (#1761)
|
||||||
|
- Minor perf improvement in `priorityQueue` (#1727)
|
||||||
|
- More examples in documentation (#1726)
|
||||||
|
- Various doc fixes (#1708, #1712, #1717, #1740, #1739, #1749, #1756)
|
||||||
|
- Improved test coverage (#1754)
|
||||||
|
|
||||||
|
# v3.2.0
|
||||||
|
- Fix a bug in Safari related to overwriting `func.name`
|
||||||
|
- Remove built-in browserify configuration (#1653)
|
||||||
|
- Varios doc fixes (#1688, #1703, #1704)
|
||||||
|
|
||||||
|
# v3.1.1
|
||||||
|
- Allow redefining `name` property on wrapped functions.
|
||||||
|
|
||||||
|
# v3.1.0
|
||||||
|
|
||||||
|
- Added `q.pushAsync` and `q.unshiftAsync`, analagous to `q.push` and `q.unshift`, except they always do not accept a callback, and reject if processing the task errors. (#1659)
|
||||||
|
- Promises returned from `q.push` and `q.unshift` when a callback is not passed now resolve even if an error ocurred. (#1659)
|
||||||
|
- Fixed a parsing bug in `autoInject` with complicated function bodies (#1663)
|
||||||
|
- Added ES6+ configuration for Browserify bundlers (#1653)
|
||||||
|
- Various doc fixes (#1664, #1658, #1665, #1652)
|
||||||
|
|
||||||
|
# v3.0.1
|
||||||
|
|
||||||
|
## Bug fixes
|
||||||
|
- Fixed a regression where arrays passed to `queue` and `cargo` would be completely flattened. (#1645)
|
||||||
|
- Clarified Async's browser support (#1643)
|
||||||
|
|
||||||
|
|
||||||
|
# v3.0.0
|
||||||
|
|
||||||
|
The `async`/`await` release!
|
||||||
|
|
||||||
|
There are a lot of new features and subtle breaking changes in this major version, but the biggest feature is that most Async methods return a Promise if you omit the callback, meaning you can `await` them from within an `async` function.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const results = await async.mapLimit(urls, 5, async url => {
|
||||||
|
const resp = await fetch(url)
|
||||||
|
return resp.body
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
## Breaking Changes
|
||||||
|
- Most Async methods return a Promise when the final callback is omitted, making them `await`-able! (#1572)
|
||||||
|
- We are now making heavy use of ES2015 features, this means we have dropped out-of-the-box support for Node 4 and earlier, and many old versions of browsers. (#1541, #1553)
|
||||||
|
- In `queue`, `priorityQueue`, `cargo` and `cargoQueue`, the "event"-style methods, like `q.drain` and `q.saturated` are now methods that register a callback, rather than properties you assign a callback to. They are now of the form `q.drain(callback)`. If you do not pass a callback a Promise will be returned for the next occurrence of the event, making them `await`-able, e.g. `await q.drain()`. (#1586, #1641)
|
||||||
|
- Calling `callback(false)` will cancel an async method, preventing further iteration and callback calls. This is useful for preventing memory leaks when you break out of an async flow by calling an outer callback. (#1064, #1542)
|
||||||
|
- `during` and `doDuring` have been removed, and instead `whilst`, `doWhilst`, `until` and `doUntil` now have asynchronous `test` functions. (#850, #1557)
|
||||||
|
- `limits` of less than 1 now cause an error to be thrown in queues and collection methods. (#1249, #1552)
|
||||||
|
- `memoize` no longer memoizes errors (#1465, #1466)
|
||||||
|
- `applyEach`/`applyEachSeries` have a simpler interface, to make them more easily type-able. It always returns a function that takes in a single callback argument. If that callback is omitted, a promise is returned, making it awaitable. (#1228, #1640)
|
||||||
|
|
||||||
|
## New Features
|
||||||
|
- Async generators are now supported in all the Collection methods. (#1560)
|
||||||
|
- Added `cargoQueue`, a queue with both `concurrency` and `payload` size parameters. (#1567)
|
||||||
|
- Queue objects returned from `queue` now have a `Symbol.iterator` method, meaning they can be iterated over to inspect the current list of items in the queue. (#1459, #1556)
|
||||||
|
- A ESM-flavored `async.mjs` is included in the `async` package. This is described in the `package.json` `"module"` field, meaning it should be automatically used by Webpack and other compatible bundlers.
|
||||||
|
|
||||||
|
## Bug fixes
|
||||||
|
- Better handle arbitrary error objects in `asyncify` (#1568, #1569)
|
||||||
|
|
||||||
|
## Other
|
||||||
|
- Removed Lodash as a dependency (#1283, #1528)
|
||||||
|
- Miscellaneous docs fixes (#1393, #1501, #1540, #1543, #1558, #1563, #1564, #1579, #1581)
|
||||||
|
- Miscellaneous test fixes (#1538)
|
||||||
|
|
||||||
|
-------
|
||||||
|
|
||||||
|
# v2.6.1
|
||||||
|
- Updated lodash to prevent `npm audit` warnings. (#1532, #1533)
|
||||||
|
- Made `async-es` more optimized for webpack users (#1517)
|
||||||
|
- Fixed a stack overflow with large collections and a synchronous iterator (#1514)
|
||||||
|
- Various small fixes/chores (#1505, #1511, #1527, #1530)
|
||||||
|
|
||||||
|
# v2.6.0
|
||||||
|
- Added missing aliases for many methods. Previously, you could not (e.g.) `require('async/find')` or use `async.anyLimit`. (#1483)
|
||||||
|
- Improved `queue` performance. (#1448, #1454)
|
||||||
|
- Add missing sourcemap (#1452, #1453)
|
||||||
|
- Various doc updates (#1448, #1471, #1483)
|
||||||
|
|
||||||
|
# v2.5.0
|
||||||
|
- Added `concatLimit`, the `Limit` equivalent of [`concat`](https://caolan.github.io/async/docs.html#concat) ([#1426](https://github.com/caolan/async/issues/1426), [#1430](https://github.com/caolan/async/pull/1430))
|
||||||
|
- `concat` improvements: it now preserves order, handles falsy values and the `iteratee` callback takes a variable number of arguments ([#1437](https://github.com/caolan/async/issues/1437), [#1436](https://github.com/caolan/async/pull/1436))
|
||||||
|
- Fixed an issue in `queue` where there was a size discrepancy between `workersList().length` and `running()` ([#1428](https://github.com/caolan/async/issues/1428), [#1429](https://github.com/caolan/async/pull/1429))
|
||||||
|
- Various doc fixes ([#1422](https://github.com/caolan/async/issues/1422), [#1424](https://github.com/caolan/async/pull/1424))
|
||||||
|
|
||||||
|
# v2.4.1
|
||||||
|
- Fixed a bug preventing functions wrapped with `timeout()` from being re-used. ([#1418](https://github.com/caolan/async/issues/1418), [#1419](https://github.com/caolan/async/issues/1419))
|
||||||
|
|
||||||
|
# v2.4.0
|
||||||
|
- Added `tryEach`, for running async functions in parallel, where you only expect one to succeed. ([#1365](https://github.com/caolan/async/issues/1365), [#687](https://github.com/caolan/async/issues/687))
|
||||||
|
- Improved performance, most notably in `parallel` and `waterfall` ([#1395](https://github.com/caolan/async/issues/1395))
|
||||||
|
- Added `queue.remove()`, for removing items in a `queue` ([#1397](https://github.com/caolan/async/issues/1397), [#1391](https://github.com/caolan/async/issues/1391))
|
||||||
|
- Fixed using `eval`, preventing Async from running in pages with Content Security Policy ([#1404](https://github.com/caolan/async/issues/1404), [#1403](https://github.com/caolan/async/issues/1403))
|
||||||
|
- Fixed errors thrown in an `asyncify`ed function's callback being caught by the underlying Promise ([#1408](https://github.com/caolan/async/issues/1408))
|
||||||
|
- Fixed timing of `queue.empty()` ([#1367](https://github.com/caolan/async/issues/1367))
|
||||||
|
- Various doc fixes ([#1314](https://github.com/caolan/async/issues/1314), [#1394](https://github.com/caolan/async/issues/1394), [#1412](https://github.com/caolan/async/issues/1412))
|
||||||
|
|
||||||
|
# v2.3.0
|
||||||
|
- Added support for ES2017 `async` functions. Wherever you can pass a Node-style/CPS function that uses a callback, you can also pass an `async` function. Previously, you had to wrap `async` functions with `asyncify`. The caveat is that it will only work if `async` functions are supported natively in your environment, transpiled implementations can't be detected. ([#1386](https://github.com/caolan/async/issues/1386), [#1390](https://github.com/caolan/async/issues/1390))
|
||||||
|
- Small doc fix ([#1392](https://github.com/caolan/async/issues/1392))
|
||||||
|
|
||||||
|
# v2.2.0
|
||||||
|
- Added `groupBy`, and the `Series`/`Limit` equivalents, analogous to [`_.groupBy`](http://lodash.com/docs#groupBy) ([#1364](https://github.com/caolan/async/issues/1364))
|
||||||
|
- Fixed `transform` bug when `callback` was not passed ([#1381](https://github.com/caolan/async/issues/1381))
|
||||||
|
- Added note about `reflect` to `parallel` docs ([#1385](https://github.com/caolan/async/issues/1385))
|
||||||
|
|
||||||
|
# v2.1.5
|
||||||
|
- Fix `auto` bug when function names collided with Array.prototype ([#1358](https://github.com/caolan/async/issues/1358))
|
||||||
|
- Improve some error messages ([#1349](https://github.com/caolan/async/issues/1349))
|
||||||
|
- Avoid stack overflow case in queue
|
||||||
|
- Fixed an issue in `some`, `every` and `find` where processing would continue after the result was determined.
|
||||||
|
- Cleanup implementations of `some`, `every` and `find`
|
||||||
|
|
||||||
|
# v2.1.3
|
||||||
|
- Make bundle size smaller
|
||||||
|
- Create optimized hotpath for `filter` in array case.
|
||||||
|
|
||||||
|
# v2.1.2
|
||||||
|
- Fixed a stackoverflow bug with `detect`, `some`, `every` on large inputs ([#1293](https://github.com/caolan/async/issues/1293)).
|
||||||
|
|
||||||
|
# v2.1.0
|
||||||
|
|
||||||
|
- `retry` and `retryable` now support an optional `errorFilter` function that determines if the `task` should retry on the error ([#1256](https://github.com/caolan/async/issues/1256), [#1261](https://github.com/caolan/async/issues/1261))
|
||||||
|
- Optimized array iteration in `race`, `cargo`, `queue`, and `priorityQueue` ([#1253](https://github.com/caolan/async/issues/1253))
|
||||||
|
- Added alias documentation to doc site ([#1251](https://github.com/caolan/async/issues/1251), [#1254](https://github.com/caolan/async/issues/1254))
|
||||||
|
- Added [BootStrap scrollspy](http://getbootstrap.com/javascript/#scrollspy) to docs to highlight in the sidebar the current method being viewed ([#1289](https://github.com/caolan/async/issues/1289), [#1300](https://github.com/caolan/async/issues/1300))
|
||||||
|
- Various minor doc fixes ([#1263](https://github.com/caolan/async/issues/1263), [#1264](https://github.com/caolan/async/issues/1264), [#1271](https://github.com/caolan/async/issues/1271), [#1278](https://github.com/caolan/async/issues/1278), [#1280](https://github.com/caolan/async/issues/1280), [#1282](https://github.com/caolan/async/issues/1282), [#1302](https://github.com/caolan/async/issues/1302))
|
||||||
|
|
||||||
|
# v2.0.1
|
||||||
|
|
||||||
|
- Significantly optimized all iteration based collection methods such as `each`, `map`, `filter`, etc ([#1245](https://github.com/caolan/async/issues/1245), [#1246](https://github.com/caolan/async/issues/1246), [#1247](https://github.com/caolan/async/issues/1247)).
|
||||||
|
|
||||||
|
# v2.0.0
|
||||||
|
|
||||||
|
Lots of changes here!
|
||||||
|
|
||||||
|
First and foremost, we have a slick new [site for docs](https://caolan.github.io/async/). Special thanks to [**@hargasinski**](https://github.com/hargasinski) for his work converting our old docs to `jsdoc` format and implementing the new website. Also huge ups to [**@ivanseidel**](https://github.com/ivanseidel) for designing our new logo. It was a long process for both of these tasks, but I think these changes turned out extraordinary well.
|
||||||
|
|
||||||
|
The biggest feature is modularization. You can now `require("async/series")` to only require the `series` function. Every Async library function is available this way. You still can `require("async")` to require the entire library, like you could do before.
|
||||||
|
|
||||||
|
We also provide Async as a collection of ES2015 modules. You can now `import {each} from 'async-es'` or `import waterfall from 'async-es/waterfall'`. If you are using only a few Async functions, and are using a ES bundler such as Rollup, this can significantly lower your build size.
|
||||||
|
|
||||||
|
Major thanks to [**@Kikobeats**](github.com/Kikobeats), [**@aearly**](github.com/aearly) and [**@megawac**](github.com/megawac) for doing the majority of the modularization work, as well as [**@jdalton**](github.com/jdalton) and [**@Rich-Harris**](github.com/Rich-Harris) for advisory work on the general modularization strategy.
|
||||||
|
|
||||||
|
Another one of the general themes of the 2.0 release is standardization of what an "async" function is. We are now more strictly following the node-style continuation passing style. That is, an async function is a function that:
|
||||||
|
|
||||||
|
1. Takes a variable number of arguments
|
||||||
|
2. The last argument is always a callback
|
||||||
|
3. The callback can accept any number of arguments
|
||||||
|
4. The first argument passed to the callback will be treated as an error result, if the argument is truthy
|
||||||
|
5. Any number of result arguments can be passed after the "error" argument
|
||||||
|
6. The callback is called once and exactly once, either on the same tick or later tick of the JavaScript event loop.
|
||||||
|
|
||||||
|
There were several cases where Async accepted some functions that did not strictly have these properties, most notably `auto`, `every`, `some`, `filter`, `reject` and `detect`.
|
||||||
|
|
||||||
|
Another theme is performance. We have eliminated internal deferrals in all cases where they make sense. For example, in `waterfall` and `auto`, there was a `setImmediate` between each task -- these deferrals have been removed. A `setImmediate` call can add up to 1ms of delay. This might not seem like a lot, but it can add up if you are using many Async functions in the course of processing a HTTP request, for example. Nearly all asynchronous functions that do I/O already have some sort of deferral built in, so the extra deferral is unnecessary. The trade-off of this change is removing our built-in stack-overflow defense. Many synchronous callback calls in series can quickly overflow the JS call stack. If you do have a function that is sometimes synchronous (calling its callback on the same tick), and are running into stack overflows, wrap it with `async.ensureAsync()`.
|
||||||
|
|
||||||
|
Another big performance win has been re-implementing `queue`, `cargo`, and `priorityQueue` with [doubly linked lists](https://en.wikipedia.org/wiki/Doubly_linked_list) instead of arrays. This has lead to queues being an order of [magnitude faster on large sets of tasks](https://github.com/caolan/async/pull/1205).
|
||||||
|
|
||||||
|
## New Features
|
||||||
|
|
||||||
|
- Async is now modularized. Individual functions can be `require()`d from the main package. (`require('async/auto')`) ([#984](https://github.com/caolan/async/issues/984), [#996](https://github.com/caolan/async/issues/996))
|
||||||
|
- Async is also available as a collection of ES2015 modules in the new `async-es` package. (`import {forEachSeries} from 'async-es'`) ([#984](https://github.com/caolan/async/issues/984), [#996](https://github.com/caolan/async/issues/996))
|
||||||
|
- Added `race`, analogous to `Promise.race()`. It will run an array of async tasks in parallel and will call its callback with the result of the first task to respond. ([#568](https://github.com/caolan/async/issues/568), [#1038](https://github.com/caolan/async/issues/1038))
|
||||||
|
- Collection methods now accept ES2015 iterators. Maps, Sets, and anything that implements the iterator spec can now be passed directly to `each`, `map`, `parallel`, etc.. ([#579](https://github.com/caolan/async/issues/579), [#839](https://github.com/caolan/async/issues/839), [#1074](https://github.com/caolan/async/issues/1074))
|
||||||
|
- Added `mapValues`, for mapping over the properties of an object and returning an object with the same keys. ([#1157](https://github.com/caolan/async/issues/1157), [#1177](https://github.com/caolan/async/issues/1177))
|
||||||
|
- Added `timeout`, a wrapper for an async function that will make the task time-out after the specified time. ([#1007](https://github.com/caolan/async/issues/1007), [#1027](https://github.com/caolan/async/issues/1027))
|
||||||
|
- Added `reflect` and `reflectAll`, analagous to [`Promise.reflect()`](http://bluebirdjs.com/docs/api/reflect.html), a wrapper for async tasks that always succeeds, by gathering results and errors into an object. ([#942](https://github.com/caolan/async/issues/942), [#1012](https://github.com/caolan/async/issues/1012), [#1095](https://github.com/caolan/async/issues/1095))
|
||||||
|
- `constant` supports dynamic arguments -- it will now always use its last argument as the callback. ([#1016](https://github.com/caolan/async/issues/1016), [#1052](https://github.com/caolan/async/issues/1052))
|
||||||
|
- `setImmediate` and `nextTick` now support arguments to partially apply to the deferred function, like the node-native versions do. ([#940](https://github.com/caolan/async/issues/940), [#1053](https://github.com/caolan/async/issues/1053))
|
||||||
|
- `auto` now supports resolving cyclic dependencies using [Kahn's algorithm](https://en.wikipedia.org/wiki/Topological_sorting#Kahn.27s_algorithm) ([#1140](https://github.com/caolan/async/issues/1140)).
|
||||||
|
- Added `autoInject`, a relative of `auto` that automatically spreads a task's dependencies as arguments to the task function. ([#608](https://github.com/caolan/async/issues/608), [#1055](https://github.com/caolan/async/issues/1055), [#1099](https://github.com/caolan/async/issues/1099), [#1100](https://github.com/caolan/async/issues/1100))
|
||||||
|
- You can now limit the concurrency of `auto` tasks. ([#635](https://github.com/caolan/async/issues/635), [#637](https://github.com/caolan/async/issues/637))
|
||||||
|
- Added `retryable`, a relative of `retry` that wraps an async function, making it retry when called. ([#1058](https://github.com/caolan/async/issues/1058))
|
||||||
|
- `retry` now supports specifying a function that determines the next time interval, useful for exponential backoff, logging and other retry strategies. ([#1161](https://github.com/caolan/async/issues/1161))
|
||||||
|
- `retry` will now pass all of the arguments the task function was resolved with to the callback ([#1231](https://github.com/caolan/async/issues/1231)).
|
||||||
|
- Added `q.unsaturated` -- callback called when a `queue`'s number of running workers falls below a threshold. ([#868](https://github.com/caolan/async/issues/868), [#1030](https://github.com/caolan/async/issues/1030), [#1033](https://github.com/caolan/async/issues/1033), [#1034](https://github.com/caolan/async/issues/1034))
|
||||||
|
- Added `q.error` -- a callback called whenever a `queue` task calls its callback with an error. ([#1170](https://github.com/caolan/async/issues/1170))
|
||||||
|
- `applyEach` and `applyEachSeries` now pass results to the final callback. ([#1088](https://github.com/caolan/async/issues/1088))
|
||||||
|
|
||||||
|
## Breaking changes
|
||||||
|
|
||||||
|
- Calling a callback more than once is considered an error, and an error will be thrown. This had an explicit breaking change in `waterfall`. If you were relying on this behavior, you should more accurately represent your control flow as an event emitter or stream. ([#814](https://github.com/caolan/async/issues/814), [#815](https://github.com/caolan/async/issues/815), [#1048](https://github.com/caolan/async/issues/1048), [#1050](https://github.com/caolan/async/issues/1050))
|
||||||
|
- `auto` task functions now always take the callback as the last argument. If a task has dependencies, the `results` object will be passed as the first argument. To migrate old task functions, wrap them with [`_.flip`](https://lodash.com/docs#flip) ([#1036](https://github.com/caolan/async/issues/1036), [#1042](https://github.com/caolan/async/issues/1042))
|
||||||
|
- Internal `setImmediate` calls have been refactored away. This may make existing flows vulnerable to stack overflows if you use many synchronous functions in series. Use `ensureAsync` to work around this. ([#696](https://github.com/caolan/async/issues/696), [#704](https://github.com/caolan/async/issues/704), [#1049](https://github.com/caolan/async/issues/1049), [#1050](https://github.com/caolan/async/issues/1050))
|
||||||
|
- `map` used to return an object when iterating over an object. `map` now always returns an array, like in other libraries. The previous object behavior has been split out into `mapValues`. ([#1157](https://github.com/caolan/async/issues/1157), [#1177](https://github.com/caolan/async/issues/1177))
|
||||||
|
- `filter`, `reject`, `some`, `every`, `detect` and their families like `{METHOD}Series` and `{METHOD}Limit` now expect an error as the first callback argument, rather than just a simple boolean. Pass `null` as the first argument, or use `fs.access` instead of `fs.exists`. ([#118](https://github.com/caolan/async/issues/118), [#774](https://github.com/caolan/async/issues/774), [#1028](https://github.com/caolan/async/issues/1028), [#1041](https://github.com/caolan/async/issues/1041))
|
||||||
|
- `{METHOD}` and `{METHOD}Series` are now implemented in terms of `{METHOD}Limit`. This is a major internal simplification, and is not expected to cause many problems, but it does subtly affect how functions execute internally. ([#778](https://github.com/caolan/async/issues/778), [#847](https://github.com/caolan/async/issues/847))
|
||||||
|
- `retry`'s callback is now optional. Previously, omitting the callback would partially apply the function, meaning it could be passed directly as a task to `series` or `auto`. The partially applied "control-flow" behavior has been separated out into `retryable`. ([#1054](https://github.com/caolan/async/issues/1054), [#1058](https://github.com/caolan/async/issues/1058))
|
||||||
|
- The test function for `whilst`, `until`, and `during` used to be passed non-error args from the iteratee function's callback, but this led to weirdness where the first call of the test function would be passed no args. We have made it so the test function is never passed extra arguments, and only the `doWhilst`, `doUntil`, and `doDuring` functions pass iteratee callback arguments to the test function ([#1217](https://github.com/caolan/async/issues/1217), [#1224](https://github.com/caolan/async/issues/1224))
|
||||||
|
- The `q.tasks` array has been renamed `q._tasks` and is now implemented as a doubly linked list (DLL). Any code that used to interact with this array will need to be updated to either use the provided helpers or support DLLs ([#1205](https://github.com/caolan/async/issues/1205)).
|
||||||
|
- The timing of the `q.saturated()` callback in a `queue` has been modified to better reflect when tasks pushed to the queue will start queueing. ([#724](https://github.com/caolan/async/issues/724), [#1078](https://github.com/caolan/async/issues/1078))
|
||||||
|
- Removed `iterator` method in favour of [ES2015 iterator protocol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators ) which natively supports arrays ([#1237](https://github.com/caolan/async/issues/1237))
|
||||||
|
- Dropped support for Component, Jam, SPM, and Volo ([#1175](https://github.com/caolan/async/issues/1175), #[#176](https://github.com/caolan/async/issues/176))
|
||||||
|
|
||||||
|
## Bug Fixes
|
||||||
|
|
||||||
|
- Improved handling of no dependency cases in `auto` & `autoInject` ([#1147](https://github.com/caolan/async/issues/1147)).
|
||||||
|
- Fixed a bug where the callback generated by `asyncify` with `Promises` could resolve twice ([#1197](https://github.com/caolan/async/issues/1197)).
|
||||||
|
- Fixed several documented optional callbacks not actually being optional ([#1223](https://github.com/caolan/async/issues/1223)).
|
||||||
|
|
||||||
|
## Other
|
||||||
|
|
||||||
|
- Added `someSeries` and `everySeries` for symmetry, as well as a complete set of `any`/`anyLimit`/`anySeries` and `all`/`/allLmit`/`allSeries` aliases.
|
||||||
|
- Added `find` as an alias for `detect. (as well as `findLimit` and `findSeries`).
|
||||||
|
- Various doc fixes ([#1005](https://github.com/caolan/async/issues/1005), [#1008](https://github.com/caolan/async/issues/1008), [#1010](https://github.com/caolan/async/issues/1010), [#1015](https://github.com/caolan/async/issues/1015), [#1021](https://github.com/caolan/async/issues/1021), [#1037](https://github.com/caolan/async/issues/1037), [#1039](https://github.com/caolan/async/issues/1039), [#1051](https://github.com/caolan/async/issues/1051), [#1102](https://github.com/caolan/async/issues/1102), [#1107](https://github.com/caolan/async/issues/1107), [#1121](https://github.com/caolan/async/issues/1121), [#1123](https://github.com/caolan/async/issues/1123), [#1129](https://github.com/caolan/async/issues/1129), [#1135](https://github.com/caolan/async/issues/1135), [#1138](https://github.com/caolan/async/issues/1138), [#1141](https://github.com/caolan/async/issues/1141), [#1153](https://github.com/caolan/async/issues/1153), [#1216](https://github.com/caolan/async/issues/1216), [#1217](https://github.com/caolan/async/issues/1217), [#1232](https://github.com/caolan/async/issues/1232), [#1233](https://github.com/caolan/async/issues/1233), [#1236](https://github.com/caolan/async/issues/1236), [#1238](https://github.com/caolan/async/issues/1238))
|
||||||
|
|
||||||
|
Thank you [**@aearly**](github.com/aearly) and [**@megawac**](github.com/megawac) for taking the lead on version 2 of async.
|
||||||
|
|
||||||
|
------------------------------------------
|
||||||
|
|
||||||
|
# v1.5.2
|
||||||
|
- Allow using `"constructor"` as an argument in `memoize` ([#998](https://github.com/caolan/async/issues/998))
|
||||||
|
- Give a better error messsage when `auto` dependency checking fails ([#994](https://github.com/caolan/async/issues/994))
|
||||||
|
- Various doc updates ([#936](https://github.com/caolan/async/issues/936), [#956](https://github.com/caolan/async/issues/956), [#979](https://github.com/caolan/async/issues/979), [#1002](https://github.com/caolan/async/issues/1002))
|
||||||
|
|
||||||
|
# v1.5.1
|
||||||
|
- Fix issue with `pause` in `queue` with concurrency enabled ([#946](https://github.com/caolan/async/issues/946))
|
||||||
|
- `while` and `until` now pass the final result to callback ([#963](https://github.com/caolan/async/issues/963))
|
||||||
|
- `auto` will properly handle concurrency when there is no callback ([#966](https://github.com/caolan/async/issues/966))
|
||||||
|
- `auto` will no. properly stop execution when an error occurs ([#988](https://github.com/caolan/async/issues/988), [#993](https://github.com/caolan/async/issues/993))
|
||||||
|
- Various doc fixes ([#971](https://github.com/caolan/async/issues/971), [#980](https://github.com/caolan/async/issues/980))
|
||||||
|
|
||||||
|
# v1.5.0
|
||||||
|
|
||||||
|
- Added `transform`, analogous to [`_.transform`](http://lodash.com/docs#transform) ([#892](https://github.com/caolan/async/issues/892))
|
||||||
|
- `map` now returns an object when an object is passed in, rather than array with non-numeric keys. `map` will begin always returning an array with numeric indexes in the next major release. ([#873](https://github.com/caolan/async/issues/873))
|
||||||
|
- `auto` now accepts an optional `concurrency` argument to limit the number o. running tasks ([#637](https://github.com/caolan/async/issues/637))
|
||||||
|
- Added `queue#workersList()`, to retrieve the lis. of currently running tasks. ([#891](https://github.com/caolan/async/issues/891))
|
||||||
|
- Various code simplifications ([#896](https://github.com/caolan/async/issues/896), [#904](https://github.com/caolan/async/issues/904))
|
||||||
|
- Various doc fixes :scroll: ([#890](https://github.com/caolan/async/issues/890), [#894](https://github.com/caolan/async/issues/894), [#903](https://github.com/caolan/async/issues/903), [#905](https://github.com/caolan/async/issues/905), [#912](https://github.com/caolan/async/issues/912))
|
||||||
|
|
||||||
|
# v1.4.2
|
||||||
|
|
||||||
|
- Ensure coverage files don't get published on npm ([#879](https://github.com/caolan/async/issues/879))
|
||||||
|
|
||||||
|
# v1.4.1
|
||||||
|
|
||||||
|
- Add in overlooked `detectLimit` method ([#866](https://github.com/caolan/async/issues/866))
|
||||||
|
- Removed unnecessary files from npm releases ([#861](https://github.com/caolan/async/issues/861))
|
||||||
|
- Removed usage of a reserved word to prevent :boom: in older environments ([#870](https://github.com/caolan/async/issues/870))
|
||||||
|
|
||||||
|
# v1.4.0
|
||||||
|
|
||||||
|
- `asyncify` now supports promises ([#840](https://github.com/caolan/async/issues/840))
|
||||||
|
- Added `Limit` versions of `filter` and `reject` ([#836](https://github.com/caolan/async/issues/836))
|
||||||
|
- Add `Limit` versions of `detect`, `some` and `every` ([#828](https://github.com/caolan/async/issues/828), [#829](https://github.com/caolan/async/issues/829))
|
||||||
|
- `some`, `every` and `detect` now short circuit early ([#828](https://github.com/caolan/async/issues/828), [#829](https://github.com/caolan/async/issues/829))
|
||||||
|
- Improve detection of the global object ([#804](https://github.com/caolan/async/issues/804)), enabling use in WebWorkers
|
||||||
|
- `whilst` now called with arguments from iterator ([#823](https://github.com/caolan/async/issues/823))
|
||||||
|
- `during` now gets called with arguments from iterator ([#824](https://github.com/caolan/async/issues/824))
|
||||||
|
- Code simplifications and optimizations aplenty ([diff](https://github.com/caolan/async/compare/v1.3.0...v1.4.0))
|
||||||
|
|
||||||
|
|
||||||
|
# v1.3.0
|
||||||
|
|
||||||
|
New Features:
|
||||||
|
- Added `constant`
|
||||||
|
- Added `asyncify`/`wrapSync` for making sync functions work with callbacks. ([#671](https://github.com/caolan/async/issues/671), [#806](https://github.com/caolan/async/issues/806))
|
||||||
|
- Added `during` and `doDuring`, which are like `whilst` with an async truth test. ([#800](https://github.com/caolan/async/issues/800))
|
||||||
|
- `retry` now accepts an `interval` parameter to specify a delay between retries. ([#793](https://github.com/caolan/async/issues/793))
|
||||||
|
- `async` should work better in Web Workers due to better `root` detection ([#804](https://github.com/caolan/async/issues/804))
|
||||||
|
- Callbacks are now optional in `whilst`, `doWhilst`, `until`, and `doUntil` ([#642](https://github.com/caolan/async/issues/642))
|
||||||
|
- Various internal updates ([#786](https://github.com/caolan/async/issues/786), [#801](https://github.com/caolan/async/issues/801), [#802](https://github.com/caolan/async/issues/802), [#803](https://github.com/caolan/async/issues/803))
|
||||||
|
- Various doc fixes ([#790](https://github.com/caolan/async/issues/790), [#794](https://github.com/caolan/async/issues/794))
|
||||||
|
|
||||||
|
Bug Fixes:
|
||||||
|
- `cargo` now exposes the `payload` size, and `cargo.payload` can be changed on the fly after the `cargo` is created. ([#740](https://github.com/caolan/async/issues/740), [#744](https://github.com/caolan/async/issues/744), [#783](https://github.com/caolan/async/issues/783))
|
||||||
|
|
||||||
|
|
||||||
|
# v1.2.1
|
||||||
|
|
||||||
|
Bug Fix:
|
||||||
|
|
||||||
|
- Small regression with synchronous iterator behavior in `eachSeries` with a 1-element array. Before 1.1.0, `eachSeries`'s callback was called on the same tick, which this patch restores. In 2.0.0, it will be called on the next tick. ([#782](https://github.com/caolan/async/issues/782))
|
||||||
|
|
||||||
|
|
||||||
|
# v1.2.0
|
||||||
|
|
||||||
|
New Features:
|
||||||
|
|
||||||
|
- Added `timesLimit` ([#743](https://github.com/caolan/async/issues/743))
|
||||||
|
- `concurrency` can be changed after initialization in `queue` by setting `q.concurrency`. The new concurrency will be reflected the next time a task is processed. ([#747](https://github.com/caolan/async/issues/747), [#772](https://github.com/caolan/async/issues/772))
|
||||||
|
|
||||||
|
Bug Fixes:
|
||||||
|
|
||||||
|
- Fixed a regression in `each` and family with empty arrays that have additional properties. ([#775](https://github.com/caolan/async/issues/775), [#777](https://github.com/caolan/async/issues/777))
|
||||||
|
|
||||||
|
|
||||||
|
# v1.1.1
|
||||||
|
|
||||||
|
Bug Fix:
|
||||||
|
|
||||||
|
- Small regression with synchronous iterator behavior in `eachSeries` with a 1-element array. Before 1.1.0, `eachSeries`'s callback was called on the same tick, which this patch restores. In 2.0.0, it will be called on the next tick. ([#782](https://github.com/caolan/async/issues/782))
|
||||||
|
|
||||||
|
|
||||||
|
# v1.1.0
|
||||||
|
|
||||||
|
New Features:
|
||||||
|
|
||||||
|
- `cargo` now supports all of the same methods and event callbacks as `queue`.
|
||||||
|
- Added `ensureAsync` - A wrapper that ensures an async function calls its callback on a later tick. ([#769](https://github.com/caolan/async/issues/769))
|
||||||
|
- Optimized `map`, `eachOf`, and `waterfall` families of functions
|
||||||
|
- Passing a `null` or `undefined` array to `map`, `each`, `parallel` and families will be treated as an empty array ([#667](https://github.com/caolan/async/issues/667)).
|
||||||
|
- The callback is now optional for the composed results of `compose` and `seq`. ([#618](https://github.com/caolan/async/issues/618))
|
||||||
|
- Reduced file size by 4kb, (minified version by 1kb)
|
||||||
|
- Added code coverage through `nyc` and `coveralls` ([#768](https://github.com/caolan/async/issues/768))
|
||||||
|
|
||||||
|
Bug Fixes:
|
||||||
|
|
||||||
|
- `forever` will no longer stack overflow with a synchronous iterator ([#622](https://github.com/caolan/async/issues/622))
|
||||||
|
- `eachLimit` and other limit functions will stop iterating once an error occurs ([#754](https://github.com/caolan/async/issues/754))
|
||||||
|
- Always pass `null` in callbacks when there is no error ([#439](https://github.com/caolan/async/issues/439))
|
||||||
|
- Ensure proper conditions when calling `drain()` after pushing an empty data set to a queue ([#668](https://github.com/caolan/async/issues/668))
|
||||||
|
- `each` and family will properly handle an empty array ([#578](https://github.com/caolan/async/issues/578))
|
||||||
|
- `eachSeries` and family will finish if the underlying array is modified during execution ([#557](https://github.com/caolan/async/issues/557))
|
||||||
|
- `queue` will throw if a non-function is passed to `q.push()` ([#593](https://github.com/caolan/async/issues/593))
|
||||||
|
- Doc fixes ([#629](https://github.com/caolan/async/issues/629), [#766](https://github.com/caolan/async/issues/766))
|
||||||
|
|
||||||
|
|
||||||
|
# v1.0.0
|
||||||
|
|
||||||
|
No known breaking changes, we are simply complying with semver from here on out.
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
|
||||||
|
- Start using a changelog!
|
||||||
|
- Add `forEachOf` for iterating over Objects (or to iterate Arrays with indexes available) ([#168](https://github.com/caolan/async/issues/168) [#704](https://github.com/caolan/async/issues/704) [#321](https://github.com/caolan/async/issues/321))
|
||||||
|
- Detect deadlocks in `auto` ([#663](https://github.com/caolan/async/issues/663))
|
||||||
|
- Better support for require.js ([#527](https://github.com/caolan/async/issues/527))
|
||||||
|
- Throw if queue created with concurrency `0` ([#714](https://github.com/caolan/async/issues/714))
|
||||||
|
- Fix unneeded iteration in `queue.resume()` ([#758](https://github.com/caolan/async/issues/758))
|
||||||
|
- Guard against timer mocking overriding `setImmediate` ([#609](https://github.com/caolan/async/issues/609) [#611](https://github.com/caolan/async/issues/611))
|
||||||
|
- Miscellaneous doc fixes ([#542](https://github.com/caolan/async/issues/542) [#596](https://github.com/caolan/async/issues/596) [#615](https://github.com/caolan/async/issues/615) [#628](https://github.com/caolan/async/issues/628) [#631](https://github.com/caolan/async/issues/631) [#690](https://github.com/caolan/async/issues/690) [#729](https://github.com/caolan/async/issues/729))
|
||||||
|
- Use single noop function internally ([#546](https://github.com/caolan/async/issues/546))
|
||||||
|
- Optimize internal `_each`, `_map` and `_keys` functions.
|
||||||
19
node_modules/async/LICENSE
generated
vendored
Normal file
19
node_modules/async/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
Copyright (c) 2010-2018 Caolan McMahon
|
||||||
|
|
||||||
|
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.
|
||||||
59
node_modules/async/README.md
generated
vendored
Normal file
59
node_modules/async/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
[](https://www.npmjs.com/package/async)
|
||||||
|
[](https://coveralls.io/r/caolan/async?branch=master)
|
||||||
|
[](https://gitter.im/caolan/async?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||||
|
[](https://www.jsdelivr.com/package/npm/async)
|
||||||
|
|
||||||
|
<!--
|
||||||
|
|Linux|Windows|MacOS|
|
||||||
|
|-|-|-|
|
||||||
|
|[](https://dev.azure.com/caolanmcmahon/async/_build/latest?definitionId=1&branchName=master) | [](https://dev.azure.com/caolanmcmahon/async/_build/latest?definitionId=1&branchName=master) | [](https://dev.azure.com/caolanmcmahon/async/_build/latest?definitionId=1&branchName=master)| -->
|
||||||
|
|
||||||
|
Async is a utility module which provides straight-forward, powerful functions for working with [asynchronous JavaScript](http://caolan.github.io/async/v3/global.html). Although originally designed for use with [Node.js](https://nodejs.org/) and installable via `npm i async`, it can also be used directly in the browser. An ESM/MJS version is included in the main `async` package that should automatically be used with compatible bundlers such as Webpack and Rollup.
|
||||||
|
|
||||||
|
A pure ESM version of Async is available as [`async-es`](https://www.npmjs.com/package/async-es).
|
||||||
|
|
||||||
|
For Documentation, visit <https://caolan.github.io/async/>
|
||||||
|
|
||||||
|
*For Async v1.5.x documentation, go [HERE](https://github.com/caolan/async/blob/v1.5.2/README.md)*
|
||||||
|
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// for use with Node-style callbacks...
|
||||||
|
var async = require("async");
|
||||||
|
|
||||||
|
var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"};
|
||||||
|
var configs = {};
|
||||||
|
|
||||||
|
async.forEachOf(obj, (value, key, callback) => {
|
||||||
|
fs.readFile(__dirname + value, "utf8", (err, data) => {
|
||||||
|
if (err) return callback(err);
|
||||||
|
try {
|
||||||
|
configs[key] = JSON.parse(data);
|
||||||
|
} catch (e) {
|
||||||
|
return callback(e);
|
||||||
|
}
|
||||||
|
callback();
|
||||||
|
});
|
||||||
|
}, err => {
|
||||||
|
if (err) console.error(err.message);
|
||||||
|
// configs is now a map of JSON data
|
||||||
|
doSomethingWith(configs);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var async = require("async");
|
||||||
|
|
||||||
|
// ...or ES2017 async functions
|
||||||
|
async.mapLimit(urls, 5, async function(url) {
|
||||||
|
const response = await fetch(url)
|
||||||
|
return response.body
|
||||||
|
}, (err, results) => {
|
||||||
|
if (err) throw err
|
||||||
|
// results is now an array of the response bodies
|
||||||
|
console.log(results)
|
||||||
|
})
|
||||||
|
```
|
||||||
119
node_modules/async/all.js
generated
vendored
Normal file
119
node_modules/async/all.js
generated
vendored
Normal file
|
|
@ -0,0 +1,119 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _createTester = require('./internal/createTester.js');
|
||||||
|
|
||||||
|
var _createTester2 = _interopRequireDefault(_createTester);
|
||||||
|
|
||||||
|
var _eachOf = require('./eachOf.js');
|
||||||
|
|
||||||
|
var _eachOf2 = _interopRequireDefault(_eachOf);
|
||||||
|
|
||||||
|
var _awaitify = require('./internal/awaitify.js');
|
||||||
|
|
||||||
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns `true` if every element in `coll` satisfies an async test. If any
|
||||||
|
* iteratee call returns `false`, the main `callback` is immediately called.
|
||||||
|
*
|
||||||
|
* @name every
|
||||||
|
* @static
|
||||||
|
* @memberOf module:Collections
|
||||||
|
* @method
|
||||||
|
* @alias all
|
||||||
|
* @category Collection
|
||||||
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||||
|
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
|
||||||
|
* in the collection in parallel.
|
||||||
|
* The iteratee must complete with a boolean result value.
|
||||||
|
* Invoked with (item, callback).
|
||||||
|
* @param {Function} [callback] - A callback which is called after all the
|
||||||
|
* `iteratee` functions have finished. Result will be either `true` or `false`
|
||||||
|
* depending on the values of the async tests. Invoked with (err, result).
|
||||||
|
* @returns {Promise} a promise, if no callback provided
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* // dir1 is a directory that contains file1.txt, file2.txt
|
||||||
|
* // dir2 is a directory that contains file3.txt, file4.txt
|
||||||
|
* // dir3 is a directory that contains file5.txt
|
||||||
|
* // dir4 does not exist
|
||||||
|
*
|
||||||
|
* const fileList = ['dir1/file1.txt','dir2/file3.txt','dir3/file5.txt'];
|
||||||
|
* const withMissingFileList = ['file1.txt','file2.txt','file4.txt'];
|
||||||
|
*
|
||||||
|
* // asynchronous function that checks if a file exists
|
||||||
|
* function fileExists(file, callback) {
|
||||||
|
* fs.access(file, fs.constants.F_OK, (err) => {
|
||||||
|
* callback(null, !err);
|
||||||
|
* });
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* // Using callbacks
|
||||||
|
* async.every(fileList, fileExists, function(err, result) {
|
||||||
|
* console.log(result);
|
||||||
|
* // true
|
||||||
|
* // result is true since every file exists
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* async.every(withMissingFileList, fileExists, function(err, result) {
|
||||||
|
* console.log(result);
|
||||||
|
* // false
|
||||||
|
* // result is false since NOT every file exists
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Using Promises
|
||||||
|
* async.every(fileList, fileExists)
|
||||||
|
* .then( result => {
|
||||||
|
* console.log(result);
|
||||||
|
* // true
|
||||||
|
* // result is true since every file exists
|
||||||
|
* }).catch( err => {
|
||||||
|
* console.log(err);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* async.every(withMissingFileList, fileExists)
|
||||||
|
* .then( result => {
|
||||||
|
* console.log(result);
|
||||||
|
* // false
|
||||||
|
* // result is false since NOT every file exists
|
||||||
|
* }).catch( err => {
|
||||||
|
* console.log(err);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Using async/await
|
||||||
|
* async () => {
|
||||||
|
* try {
|
||||||
|
* let result = await async.every(fileList, fileExists);
|
||||||
|
* console.log(result);
|
||||||
|
* // true
|
||||||
|
* // result is true since every file exists
|
||||||
|
* }
|
||||||
|
* catch (err) {
|
||||||
|
* console.log(err);
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* async () => {
|
||||||
|
* try {
|
||||||
|
* let result = await async.every(withMissingFileList, fileExists);
|
||||||
|
* console.log(result);
|
||||||
|
* // false
|
||||||
|
* // result is false since NOT every file exists
|
||||||
|
* }
|
||||||
|
* catch (err) {
|
||||||
|
* console.log(err);
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function every(coll, iteratee, callback) {
|
||||||
|
return (0, _createTester2.default)(bool => !bool, res => !res)(_eachOf2.default, coll, iteratee, callback);
|
||||||
|
}
|
||||||
|
exports.default = (0, _awaitify2.default)(every, 3);
|
||||||
|
module.exports = exports.default;
|
||||||
46
node_modules/async/allLimit.js
generated
vendored
Normal file
46
node_modules/async/allLimit.js
generated
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _createTester = require('./internal/createTester.js');
|
||||||
|
|
||||||
|
var _createTester2 = _interopRequireDefault(_createTester);
|
||||||
|
|
||||||
|
var _eachOfLimit = require('./internal/eachOfLimit.js');
|
||||||
|
|
||||||
|
var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
|
||||||
|
|
||||||
|
var _awaitify = require('./internal/awaitify.js');
|
||||||
|
|
||||||
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The same as [`every`]{@link module:Collections.every} but runs a maximum of `limit` async operations at a time.
|
||||||
|
*
|
||||||
|
* @name everyLimit
|
||||||
|
* @static
|
||||||
|
* @memberOf module:Collections
|
||||||
|
* @method
|
||||||
|
* @see [async.every]{@link module:Collections.every}
|
||||||
|
* @alias allLimit
|
||||||
|
* @category Collection
|
||||||
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||||
|
* @param {number} limit - The maximum number of async operations at a time.
|
||||||
|
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
|
||||||
|
* in the collection in parallel.
|
||||||
|
* The iteratee must complete with a boolean result value.
|
||||||
|
* Invoked with (item, callback).
|
||||||
|
* @param {Function} [callback] - A callback which is called after all the
|
||||||
|
* `iteratee` functions have finished. Result will be either `true` or `false`
|
||||||
|
* depending on the values of the async tests. Invoked with (err, result).
|
||||||
|
* @returns {Promise} a promise, if no callback provided
|
||||||
|
*/
|
||||||
|
function everyLimit(coll, limit, iteratee, callback) {
|
||||||
|
return (0, _createTester2.default)(bool => !bool, res => !res)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback);
|
||||||
|
}
|
||||||
|
exports.default = (0, _awaitify2.default)(everyLimit, 4);
|
||||||
|
module.exports = exports.default;
|
||||||
45
node_modules/async/allSeries.js
generated
vendored
Normal file
45
node_modules/async/allSeries.js
generated
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _createTester = require('./internal/createTester.js');
|
||||||
|
|
||||||
|
var _createTester2 = _interopRequireDefault(_createTester);
|
||||||
|
|
||||||
|
var _eachOfSeries = require('./eachOfSeries.js');
|
||||||
|
|
||||||
|
var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
|
||||||
|
|
||||||
|
var _awaitify = require('./internal/awaitify.js');
|
||||||
|
|
||||||
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The same as [`every`]{@link module:Collections.every} but runs only a single async operation at a time.
|
||||||
|
*
|
||||||
|
* @name everySeries
|
||||||
|
* @static
|
||||||
|
* @memberOf module:Collections
|
||||||
|
* @method
|
||||||
|
* @see [async.every]{@link module:Collections.every}
|
||||||
|
* @alias allSeries
|
||||||
|
* @category Collection
|
||||||
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||||
|
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
|
||||||
|
* in the collection in series.
|
||||||
|
* The iteratee must complete with a boolean result value.
|
||||||
|
* Invoked with (item, callback).
|
||||||
|
* @param {Function} [callback] - A callback which is called after all the
|
||||||
|
* `iteratee` functions have finished. Result will be either `true` or `false`
|
||||||
|
* depending on the values of the async tests. Invoked with (err, result).
|
||||||
|
* @returns {Promise} a promise, if no callback provided
|
||||||
|
*/
|
||||||
|
function everySeries(coll, iteratee, callback) {
|
||||||
|
return (0, _createTester2.default)(bool => !bool, res => !res)(_eachOfSeries2.default, coll, iteratee, callback);
|
||||||
|
}
|
||||||
|
exports.default = (0, _awaitify2.default)(everySeries, 3);
|
||||||
|
module.exports = exports.default;
|
||||||
122
node_modules/async/any.js
generated
vendored
Normal file
122
node_modules/async/any.js
generated
vendored
Normal file
|
|
@ -0,0 +1,122 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _createTester = require('./internal/createTester.js');
|
||||||
|
|
||||||
|
var _createTester2 = _interopRequireDefault(_createTester);
|
||||||
|
|
||||||
|
var _eachOf = require('./eachOf.js');
|
||||||
|
|
||||||
|
var _eachOf2 = _interopRequireDefault(_eachOf);
|
||||||
|
|
||||||
|
var _awaitify = require('./internal/awaitify.js');
|
||||||
|
|
||||||
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns `true` if at least one element in the `coll` satisfies an async test.
|
||||||
|
* If any iteratee call returns `true`, the main `callback` is immediately
|
||||||
|
* called.
|
||||||
|
*
|
||||||
|
* @name some
|
||||||
|
* @static
|
||||||
|
* @memberOf module:Collections
|
||||||
|
* @method
|
||||||
|
* @alias any
|
||||||
|
* @category Collection
|
||||||
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||||
|
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
|
||||||
|
* in the collections in parallel.
|
||||||
|
* The iteratee should complete with a boolean `result` value.
|
||||||
|
* Invoked with (item, callback).
|
||||||
|
* @param {Function} [callback] - A callback which is called as soon as any
|
||||||
|
* iteratee returns `true`, or after all the iteratee functions have finished.
|
||||||
|
* Result will be either `true` or `false` depending on the values of the async
|
||||||
|
* tests. Invoked with (err, result).
|
||||||
|
* @returns {Promise} a promise, if no callback provided
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* // dir1 is a directory that contains file1.txt, file2.txt
|
||||||
|
* // dir2 is a directory that contains file3.txt, file4.txt
|
||||||
|
* // dir3 is a directory that contains file5.txt
|
||||||
|
* // dir4 does not exist
|
||||||
|
*
|
||||||
|
* // asynchronous function that checks if a file exists
|
||||||
|
* function fileExists(file, callback) {
|
||||||
|
* fs.access(file, fs.constants.F_OK, (err) => {
|
||||||
|
* callback(null, !err);
|
||||||
|
* });
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* // Using callbacks
|
||||||
|
* async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists,
|
||||||
|
* function(err, result) {
|
||||||
|
* console.log(result);
|
||||||
|
* // true
|
||||||
|
* // result is true since some file in the list exists
|
||||||
|
* }
|
||||||
|
*);
|
||||||
|
*
|
||||||
|
* async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists,
|
||||||
|
* function(err, result) {
|
||||||
|
* console.log(result);
|
||||||
|
* // false
|
||||||
|
* // result is false since none of the files exists
|
||||||
|
* }
|
||||||
|
*);
|
||||||
|
*
|
||||||
|
* // Using Promises
|
||||||
|
* async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists)
|
||||||
|
* .then( result => {
|
||||||
|
* console.log(result);
|
||||||
|
* // true
|
||||||
|
* // result is true since some file in the list exists
|
||||||
|
* }).catch( err => {
|
||||||
|
* console.log(err);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists)
|
||||||
|
* .then( result => {
|
||||||
|
* console.log(result);
|
||||||
|
* // false
|
||||||
|
* // result is false since none of the files exists
|
||||||
|
* }).catch( err => {
|
||||||
|
* console.log(err);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Using async/await
|
||||||
|
* async () => {
|
||||||
|
* try {
|
||||||
|
* let result = await async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists);
|
||||||
|
* console.log(result);
|
||||||
|
* // true
|
||||||
|
* // result is true since some file in the list exists
|
||||||
|
* }
|
||||||
|
* catch (err) {
|
||||||
|
* console.log(err);
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* async () => {
|
||||||
|
* try {
|
||||||
|
* let result = await async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists);
|
||||||
|
* console.log(result);
|
||||||
|
* // false
|
||||||
|
* // result is false since none of the files exists
|
||||||
|
* }
|
||||||
|
* catch (err) {
|
||||||
|
* console.log(err);
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function some(coll, iteratee, callback) {
|
||||||
|
return (0, _createTester2.default)(Boolean, res => res)(_eachOf2.default, coll, iteratee, callback);
|
||||||
|
}
|
||||||
|
exports.default = (0, _awaitify2.default)(some, 3);
|
||||||
|
module.exports = exports.default;
|
||||||
47
node_modules/async/anyLimit.js
generated
vendored
Normal file
47
node_modules/async/anyLimit.js
generated
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _createTester = require('./internal/createTester.js');
|
||||||
|
|
||||||
|
var _createTester2 = _interopRequireDefault(_createTester);
|
||||||
|
|
||||||
|
var _eachOfLimit = require('./internal/eachOfLimit.js');
|
||||||
|
|
||||||
|
var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
|
||||||
|
|
||||||
|
var _awaitify = require('./internal/awaitify.js');
|
||||||
|
|
||||||
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The same as [`some`]{@link module:Collections.some} but runs a maximum of `limit` async operations at a time.
|
||||||
|
*
|
||||||
|
* @name someLimit
|
||||||
|
* @static
|
||||||
|
* @memberOf module:Collections
|
||||||
|
* @method
|
||||||
|
* @see [async.some]{@link module:Collections.some}
|
||||||
|
* @alias anyLimit
|
||||||
|
* @category Collection
|
||||||
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||||
|
* @param {number} limit - The maximum number of async operations at a time.
|
||||||
|
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
|
||||||
|
* in the collections in parallel.
|
||||||
|
* The iteratee should complete with a boolean `result` value.
|
||||||
|
* Invoked with (item, callback).
|
||||||
|
* @param {Function} [callback] - A callback which is called as soon as any
|
||||||
|
* iteratee returns `true`, or after all the iteratee functions have finished.
|
||||||
|
* Result will be either `true` or `false` depending on the values of the async
|
||||||
|
* tests. Invoked with (err, result).
|
||||||
|
* @returns {Promise} a promise, if no callback provided
|
||||||
|
*/
|
||||||
|
function someLimit(coll, limit, iteratee, callback) {
|
||||||
|
return (0, _createTester2.default)(Boolean, res => res)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback);
|
||||||
|
}
|
||||||
|
exports.default = (0, _awaitify2.default)(someLimit, 4);
|
||||||
|
module.exports = exports.default;
|
||||||
46
node_modules/async/anySeries.js
generated
vendored
Normal file
46
node_modules/async/anySeries.js
generated
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _createTester = require('./internal/createTester.js');
|
||||||
|
|
||||||
|
var _createTester2 = _interopRequireDefault(_createTester);
|
||||||
|
|
||||||
|
var _eachOfSeries = require('./eachOfSeries.js');
|
||||||
|
|
||||||
|
var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
|
||||||
|
|
||||||
|
var _awaitify = require('./internal/awaitify.js');
|
||||||
|
|
||||||
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The same as [`some`]{@link module:Collections.some} but runs only a single async operation at a time.
|
||||||
|
*
|
||||||
|
* @name someSeries
|
||||||
|
* @static
|
||||||
|
* @memberOf module:Collections
|
||||||
|
* @method
|
||||||
|
* @see [async.some]{@link module:Collections.some}
|
||||||
|
* @alias anySeries
|
||||||
|
* @category Collection
|
||||||
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||||
|
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
|
||||||
|
* in the collections in series.
|
||||||
|
* The iteratee should complete with a boolean `result` value.
|
||||||
|
* Invoked with (item, callback).
|
||||||
|
* @param {Function} [callback] - A callback which is called as soon as any
|
||||||
|
* iteratee returns `true`, or after all the iteratee functions have finished.
|
||||||
|
* Result will be either `true` or `false` depending on the values of the async
|
||||||
|
* tests. Invoked with (err, result).
|
||||||
|
* @returns {Promise} a promise, if no callback provided
|
||||||
|
*/
|
||||||
|
function someSeries(coll, iteratee, callback) {
|
||||||
|
return (0, _createTester2.default)(Boolean, res => res)(_eachOfSeries2.default, coll, iteratee, callback);
|
||||||
|
}
|
||||||
|
exports.default = (0, _awaitify2.default)(someSeries, 3);
|
||||||
|
module.exports = exports.default;
|
||||||
11
node_modules/async/apply.js
generated
vendored
Normal file
11
node_modules/async/apply.js
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
exports.default = function (fn, ...args) {
|
||||||
|
return (...callArgs) => fn(...args, ...callArgs);
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = exports.default;
|
||||||
57
node_modules/async/applyEach.js
generated
vendored
Normal file
57
node_modules/async/applyEach.js
generated
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _applyEach = require('./internal/applyEach.js');
|
||||||
|
|
||||||
|
var _applyEach2 = _interopRequireDefault(_applyEach);
|
||||||
|
|
||||||
|
var _map = require('./map.js');
|
||||||
|
|
||||||
|
var _map2 = _interopRequireDefault(_map);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Applies the provided arguments to each function in the array, calling
|
||||||
|
* `callback` after all functions have completed. If you only provide the first
|
||||||
|
* argument, `fns`, then it will return a function which lets you pass in the
|
||||||
|
* arguments as if it were a single function call. If more arguments are
|
||||||
|
* provided, `callback` is required while `args` is still optional. The results
|
||||||
|
* for each of the applied async functions are passed to the final callback
|
||||||
|
* as an array.
|
||||||
|
*
|
||||||
|
* @name applyEach
|
||||||
|
* @static
|
||||||
|
* @memberOf module:ControlFlow
|
||||||
|
* @method
|
||||||
|
* @category Control Flow
|
||||||
|
* @param {Array|Iterable|AsyncIterable|Object} fns - A collection of {@link AsyncFunction}s
|
||||||
|
* to all call with the same arguments
|
||||||
|
* @param {...*} [args] - any number of separate arguments to pass to the
|
||||||
|
* function.
|
||||||
|
* @param {Function} [callback] - the final argument should be the callback,
|
||||||
|
* called when all functions have completed processing.
|
||||||
|
* @returns {AsyncFunction} - Returns a function that takes no args other than
|
||||||
|
* an optional callback, that is the result of applying the `args` to each
|
||||||
|
* of the functions.
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* const appliedFn = async.applyEach([enableSearch, updateSchema], 'bucket')
|
||||||
|
*
|
||||||
|
* appliedFn((err, results) => {
|
||||||
|
* // results[0] is the results for `enableSearch`
|
||||||
|
* // results[1] is the results for `updateSchema`
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // partial application example:
|
||||||
|
* async.each(
|
||||||
|
* buckets,
|
||||||
|
* async (bucket) => async.applyEach([enableSearch, updateSchema], bucket)(),
|
||||||
|
* callback
|
||||||
|
* );
|
||||||
|
*/
|
||||||
|
exports.default = (0, _applyEach2.default)(_map2.default);
|
||||||
|
module.exports = exports.default;
|
||||||
37
node_modules/async/applyEachSeries.js
generated
vendored
Normal file
37
node_modules/async/applyEachSeries.js
generated
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _applyEach = require('./internal/applyEach.js');
|
||||||
|
|
||||||
|
var _applyEach2 = _interopRequireDefault(_applyEach);
|
||||||
|
|
||||||
|
var _mapSeries = require('./mapSeries.js');
|
||||||
|
|
||||||
|
var _mapSeries2 = _interopRequireDefault(_mapSeries);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The same as [`applyEach`]{@link module:ControlFlow.applyEach} but runs only a single async operation at a time.
|
||||||
|
*
|
||||||
|
* @name applyEachSeries
|
||||||
|
* @static
|
||||||
|
* @memberOf module:ControlFlow
|
||||||
|
* @method
|
||||||
|
* @see [async.applyEach]{@link module:ControlFlow.applyEach}
|
||||||
|
* @category Control Flow
|
||||||
|
* @param {Array|Iterable|AsyncIterable|Object} fns - A collection of {@link AsyncFunction}s to all
|
||||||
|
* call with the same arguments
|
||||||
|
* @param {...*} [args] - any number of separate arguments to pass to the
|
||||||
|
* function.
|
||||||
|
* @param {Function} [callback] - the final argument should be the callback,
|
||||||
|
* called when all functions have completed processing.
|
||||||
|
* @returns {AsyncFunction} - A function, that when called, is the result of
|
||||||
|
* appling the `args` to the list of functions. It takes no args, other than
|
||||||
|
* a callback.
|
||||||
|
*/
|
||||||
|
exports.default = (0, _applyEach2.default)(_mapSeries2.default);
|
||||||
|
module.exports = exports.default;
|
||||||
118
node_modules/async/asyncify.js
generated
vendored
Normal file
118
node_modules/async/asyncify.js
generated
vendored
Normal file
|
|
@ -0,0 +1,118 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = asyncify;
|
||||||
|
|
||||||
|
var _initialParams = require('./internal/initialParams.js');
|
||||||
|
|
||||||
|
var _initialParams2 = _interopRequireDefault(_initialParams);
|
||||||
|
|
||||||
|
var _setImmediate = require('./internal/setImmediate.js');
|
||||||
|
|
||||||
|
var _setImmediate2 = _interopRequireDefault(_setImmediate);
|
||||||
|
|
||||||
|
var _wrapAsync = require('./internal/wrapAsync.js');
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Take a sync function and make it async, passing its return value to a
|
||||||
|
* callback. This is useful for plugging sync functions into a waterfall,
|
||||||
|
* series, or other async functions. Any arguments passed to the generated
|
||||||
|
* function will be passed to the wrapped function (except for the final
|
||||||
|
* callback argument). Errors thrown will be passed to the callback.
|
||||||
|
*
|
||||||
|
* If the function passed to `asyncify` returns a Promise, that promises's
|
||||||
|
* resolved/rejected state will be used to call the callback, rather than simply
|
||||||
|
* the synchronous return value.
|
||||||
|
*
|
||||||
|
* This also means you can asyncify ES2017 `async` functions.
|
||||||
|
*
|
||||||
|
* @name asyncify
|
||||||
|
* @static
|
||||||
|
* @memberOf module:Utils
|
||||||
|
* @method
|
||||||
|
* @alias wrapSync
|
||||||
|
* @category Util
|
||||||
|
* @param {Function} func - The synchronous function, or Promise-returning
|
||||||
|
* function to convert to an {@link AsyncFunction}.
|
||||||
|
* @returns {AsyncFunction} An asynchronous wrapper of the `func`. To be
|
||||||
|
* invoked with `(args..., callback)`.
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* // passing a regular synchronous function
|
||||||
|
* async.waterfall([
|
||||||
|
* async.apply(fs.readFile, filename, "utf8"),
|
||||||
|
* async.asyncify(JSON.parse),
|
||||||
|
* function (data, next) {
|
||||||
|
* // data is the result of parsing the text.
|
||||||
|
* // If there was a parsing error, it would have been caught.
|
||||||
|
* }
|
||||||
|
* ], callback);
|
||||||
|
*
|
||||||
|
* // passing a function returning a promise
|
||||||
|
* async.waterfall([
|
||||||
|
* async.apply(fs.readFile, filename, "utf8"),
|
||||||
|
* async.asyncify(function (contents) {
|
||||||
|
* return db.model.create(contents);
|
||||||
|
* }),
|
||||||
|
* function (model, next) {
|
||||||
|
* // `model` is the instantiated model object.
|
||||||
|
* // If there was an error, this function would be skipped.
|
||||||
|
* }
|
||||||
|
* ], callback);
|
||||||
|
*
|
||||||
|
* // es2017 example, though `asyncify` is not needed if your JS environment
|
||||||
|
* // supports async functions out of the box
|
||||||
|
* var q = async.queue(async.asyncify(async function(file) {
|
||||||
|
* var intermediateStep = await processFile(file);
|
||||||
|
* return await somePromise(intermediateStep)
|
||||||
|
* }));
|
||||||
|
*
|
||||||
|
* q.push(files);
|
||||||
|
*/
|
||||||
|
function asyncify(func) {
|
||||||
|
if ((0, _wrapAsync.isAsync)(func)) {
|
||||||
|
return function (...args /*, callback*/) {
|
||||||
|
const callback = args.pop();
|
||||||
|
const promise = func.apply(this, args);
|
||||||
|
return handlePromise(promise, callback);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return (0, _initialParams2.default)(function (args, callback) {
|
||||||
|
var result;
|
||||||
|
try {
|
||||||
|
result = func.apply(this, args);
|
||||||
|
} catch (e) {
|
||||||
|
return callback(e);
|
||||||
|
}
|
||||||
|
// if result is Promise object
|
||||||
|
if (result && typeof result.then === 'function') {
|
||||||
|
return handlePromise(result, callback);
|
||||||
|
} else {
|
||||||
|
callback(null, result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePromise(promise, callback) {
|
||||||
|
return promise.then(value => {
|
||||||
|
invokeCallback(callback, null, value);
|
||||||
|
}, err => {
|
||||||
|
invokeCallback(callback, err && (err instanceof Error || err.message) ? err : new Error(err));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function invokeCallback(callback, error, value) {
|
||||||
|
try {
|
||||||
|
callback(error, value);
|
||||||
|
} catch (err) {
|
||||||
|
(0, _setImmediate2.default)(e => {
|
||||||
|
throw e;
|
||||||
|
}, err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
module.exports = exports.default;
|
||||||
333
node_modules/async/auto.js
generated
vendored
Normal file
333
node_modules/async/auto.js
generated
vendored
Normal file
|
|
@ -0,0 +1,333 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = auto;
|
||||||
|
|
||||||
|
var _once = require('./internal/once.js');
|
||||||
|
|
||||||
|
var _once2 = _interopRequireDefault(_once);
|
||||||
|
|
||||||
|
var _onlyOnce = require('./internal/onlyOnce.js');
|
||||||
|
|
||||||
|
var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
|
||||||
|
|
||||||
|
var _wrapAsync = require('./internal/wrapAsync.js');
|
||||||
|
|
||||||
|
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
||||||
|
|
||||||
|
var _promiseCallback = require('./internal/promiseCallback.js');
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines the best order for running the {@link AsyncFunction}s in `tasks`, based on
|
||||||
|
* their requirements. Each function can optionally depend on other functions
|
||||||
|
* being completed first, and each function is run as soon as its requirements
|
||||||
|
* are satisfied.
|
||||||
|
*
|
||||||
|
* If any of the {@link AsyncFunction}s pass an error to their callback, the `auto` sequence
|
||||||
|
* will stop. Further tasks will not execute (so any other functions depending
|
||||||
|
* on it will not run), and the main `callback` is immediately called with the
|
||||||
|
* error.
|
||||||
|
*
|
||||||
|
* {@link AsyncFunction}s also receive an object containing the results of functions which
|
||||||
|
* have completed so far as the first argument, if they have dependencies. If a
|
||||||
|
* task function has no dependencies, it will only be passed a callback.
|
||||||
|
*
|
||||||
|
* @name auto
|
||||||
|
* @static
|
||||||
|
* @memberOf module:ControlFlow
|
||||||
|
* @method
|
||||||
|
* @category Control Flow
|
||||||
|
* @param {Object} tasks - An object. Each of its properties is either a
|
||||||
|
* function or an array of requirements, with the {@link AsyncFunction} itself the last item
|
||||||
|
* in the array. The object's key of a property serves as the name of the task
|
||||||
|
* defined by that property, i.e. can be used when specifying requirements for
|
||||||
|
* other tasks. The function receives one or two arguments:
|
||||||
|
* * a `results` object, containing the results of the previously executed
|
||||||
|
* functions, only passed if the task has any dependencies,
|
||||||
|
* * a `callback(err, result)` function, which must be called when finished,
|
||||||
|
* passing an `error` (which can be `null`) and the result of the function's
|
||||||
|
* execution.
|
||||||
|
* @param {number} [concurrency=Infinity] - An optional `integer` for
|
||||||
|
* determining the maximum number of tasks that can be run in parallel. By
|
||||||
|
* default, as many as possible.
|
||||||
|
* @param {Function} [callback] - An optional callback which is called when all
|
||||||
|
* the tasks have been completed. It receives the `err` argument if any `tasks`
|
||||||
|
* pass an error to their callback. Results are always returned; however, if an
|
||||||
|
* error occurs, no further `tasks` will be performed, and the results object
|
||||||
|
* will only contain partial results. Invoked with (err, results).
|
||||||
|
* @returns {Promise} a promise, if a callback is not passed
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* //Using Callbacks
|
||||||
|
* async.auto({
|
||||||
|
* get_data: function(callback) {
|
||||||
|
* // async code to get some data
|
||||||
|
* callback(null, 'data', 'converted to array');
|
||||||
|
* },
|
||||||
|
* make_folder: function(callback) {
|
||||||
|
* // async code to create a directory to store a file in
|
||||||
|
* // this is run at the same time as getting the data
|
||||||
|
* callback(null, 'folder');
|
||||||
|
* },
|
||||||
|
* write_file: ['get_data', 'make_folder', function(results, callback) {
|
||||||
|
* // once there is some data and the directory exists,
|
||||||
|
* // write the data to a file in the directory
|
||||||
|
* callback(null, 'filename');
|
||||||
|
* }],
|
||||||
|
* email_link: ['write_file', function(results, callback) {
|
||||||
|
* // once the file is written let's email a link to it...
|
||||||
|
* callback(null, {'file':results.write_file, 'email':'user@example.com'});
|
||||||
|
* }]
|
||||||
|
* }, function(err, results) {
|
||||||
|
* if (err) {
|
||||||
|
* console.log('err = ', err);
|
||||||
|
* }
|
||||||
|
* console.log('results = ', results);
|
||||||
|
* // results = {
|
||||||
|
* // get_data: ['data', 'converted to array']
|
||||||
|
* // make_folder; 'folder',
|
||||||
|
* // write_file: 'filename'
|
||||||
|
* // email_link: { file: 'filename', email: 'user@example.com' }
|
||||||
|
* // }
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* //Using Promises
|
||||||
|
* async.auto({
|
||||||
|
* get_data: function(callback) {
|
||||||
|
* console.log('in get_data');
|
||||||
|
* // async code to get some data
|
||||||
|
* callback(null, 'data', 'converted to array');
|
||||||
|
* },
|
||||||
|
* make_folder: function(callback) {
|
||||||
|
* console.log('in make_folder');
|
||||||
|
* // async code to create a directory to store a file in
|
||||||
|
* // this is run at the same time as getting the data
|
||||||
|
* callback(null, 'folder');
|
||||||
|
* },
|
||||||
|
* write_file: ['get_data', 'make_folder', function(results, callback) {
|
||||||
|
* // once there is some data and the directory exists,
|
||||||
|
* // write the data to a file in the directory
|
||||||
|
* callback(null, 'filename');
|
||||||
|
* }],
|
||||||
|
* email_link: ['write_file', function(results, callback) {
|
||||||
|
* // once the file is written let's email a link to it...
|
||||||
|
* callback(null, {'file':results.write_file, 'email':'user@example.com'});
|
||||||
|
* }]
|
||||||
|
* }).then(results => {
|
||||||
|
* console.log('results = ', results);
|
||||||
|
* // results = {
|
||||||
|
* // get_data: ['data', 'converted to array']
|
||||||
|
* // make_folder; 'folder',
|
||||||
|
* // write_file: 'filename'
|
||||||
|
* // email_link: { file: 'filename', email: 'user@example.com' }
|
||||||
|
* // }
|
||||||
|
* }).catch(err => {
|
||||||
|
* console.log('err = ', err);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* //Using async/await
|
||||||
|
* async () => {
|
||||||
|
* try {
|
||||||
|
* let results = await async.auto({
|
||||||
|
* get_data: function(callback) {
|
||||||
|
* // async code to get some data
|
||||||
|
* callback(null, 'data', 'converted to array');
|
||||||
|
* },
|
||||||
|
* make_folder: function(callback) {
|
||||||
|
* // async code to create a directory to store a file in
|
||||||
|
* // this is run at the same time as getting the data
|
||||||
|
* callback(null, 'folder');
|
||||||
|
* },
|
||||||
|
* write_file: ['get_data', 'make_folder', function(results, callback) {
|
||||||
|
* // once there is some data and the directory exists,
|
||||||
|
* // write the data to a file in the directory
|
||||||
|
* callback(null, 'filename');
|
||||||
|
* }],
|
||||||
|
* email_link: ['write_file', function(results, callback) {
|
||||||
|
* // once the file is written let's email a link to it...
|
||||||
|
* callback(null, {'file':results.write_file, 'email':'user@example.com'});
|
||||||
|
* }]
|
||||||
|
* });
|
||||||
|
* console.log('results = ', results);
|
||||||
|
* // results = {
|
||||||
|
* // get_data: ['data', 'converted to array']
|
||||||
|
* // make_folder; 'folder',
|
||||||
|
* // write_file: 'filename'
|
||||||
|
* // email_link: { file: 'filename', email: 'user@example.com' }
|
||||||
|
* // }
|
||||||
|
* }
|
||||||
|
* catch (err) {
|
||||||
|
* console.log(err);
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function auto(tasks, concurrency, callback) {
|
||||||
|
if (typeof concurrency !== 'number') {
|
||||||
|
// concurrency is optional, shift the args.
|
||||||
|
callback = concurrency;
|
||||||
|
concurrency = null;
|
||||||
|
}
|
||||||
|
callback = (0, _once2.default)(callback || (0, _promiseCallback.promiseCallback)());
|
||||||
|
var numTasks = Object.keys(tasks).length;
|
||||||
|
if (!numTasks) {
|
||||||
|
return callback(null);
|
||||||
|
}
|
||||||
|
if (!concurrency) {
|
||||||
|
concurrency = numTasks;
|
||||||
|
}
|
||||||
|
|
||||||
|
var results = {};
|
||||||
|
var runningTasks = 0;
|
||||||
|
var canceled = false;
|
||||||
|
var hasError = false;
|
||||||
|
|
||||||
|
var listeners = Object.create(null);
|
||||||
|
|
||||||
|
var readyTasks = [];
|
||||||
|
|
||||||
|
// for cycle detection:
|
||||||
|
var readyToCheck = []; // tasks that have been identified as reachable
|
||||||
|
// without the possibility of returning to an ancestor task
|
||||||
|
var uncheckedDependencies = {};
|
||||||
|
|
||||||
|
Object.keys(tasks).forEach(key => {
|
||||||
|
var task = tasks[key];
|
||||||
|
if (!Array.isArray(task)) {
|
||||||
|
// no dependencies
|
||||||
|
enqueueTask(key, [task]);
|
||||||
|
readyToCheck.push(key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var dependencies = task.slice(0, task.length - 1);
|
||||||
|
var remainingDependencies = dependencies.length;
|
||||||
|
if (remainingDependencies === 0) {
|
||||||
|
enqueueTask(key, task);
|
||||||
|
readyToCheck.push(key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uncheckedDependencies[key] = remainingDependencies;
|
||||||
|
|
||||||
|
dependencies.forEach(dependencyName => {
|
||||||
|
if (!tasks[dependencyName]) {
|
||||||
|
throw new Error('async.auto task `' + key + '` has a non-existent dependency `' + dependencyName + '` in ' + dependencies.join(', '));
|
||||||
|
}
|
||||||
|
addListener(dependencyName, () => {
|
||||||
|
remainingDependencies--;
|
||||||
|
if (remainingDependencies === 0) {
|
||||||
|
enqueueTask(key, task);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
checkForDeadlocks();
|
||||||
|
processQueue();
|
||||||
|
|
||||||
|
function enqueueTask(key, task) {
|
||||||
|
readyTasks.push(() => runTask(key, task));
|
||||||
|
}
|
||||||
|
|
||||||
|
function processQueue() {
|
||||||
|
if (canceled) return;
|
||||||
|
if (readyTasks.length === 0 && runningTasks === 0) {
|
||||||
|
return callback(null, results);
|
||||||
|
}
|
||||||
|
while (readyTasks.length && runningTasks < concurrency) {
|
||||||
|
var run = readyTasks.shift();
|
||||||
|
run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addListener(taskName, fn) {
|
||||||
|
var taskListeners = listeners[taskName];
|
||||||
|
if (!taskListeners) {
|
||||||
|
taskListeners = listeners[taskName] = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
taskListeners.push(fn);
|
||||||
|
}
|
||||||
|
|
||||||
|
function taskComplete(taskName) {
|
||||||
|
var taskListeners = listeners[taskName] || [];
|
||||||
|
taskListeners.forEach(fn => fn());
|
||||||
|
processQueue();
|
||||||
|
}
|
||||||
|
|
||||||
|
function runTask(key, task) {
|
||||||
|
if (hasError) return;
|
||||||
|
|
||||||
|
var taskCallback = (0, _onlyOnce2.default)((err, ...result) => {
|
||||||
|
runningTasks--;
|
||||||
|
if (err === false) {
|
||||||
|
canceled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (result.length < 2) {
|
||||||
|
[result] = result;
|
||||||
|
}
|
||||||
|
if (err) {
|
||||||
|
var safeResults = {};
|
||||||
|
Object.keys(results).forEach(rkey => {
|
||||||
|
safeResults[rkey] = results[rkey];
|
||||||
|
});
|
||||||
|
safeResults[key] = result;
|
||||||
|
hasError = true;
|
||||||
|
listeners = Object.create(null);
|
||||||
|
if (canceled) return;
|
||||||
|
callback(err, safeResults);
|
||||||
|
} else {
|
||||||
|
results[key] = result;
|
||||||
|
taskComplete(key);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
runningTasks++;
|
||||||
|
var taskFn = (0, _wrapAsync2.default)(task[task.length - 1]);
|
||||||
|
if (task.length > 1) {
|
||||||
|
taskFn(results, taskCallback);
|
||||||
|
} else {
|
||||||
|
taskFn(taskCallback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkForDeadlocks() {
|
||||||
|
// Kahn's algorithm
|
||||||
|
// https://en.wikipedia.org/wiki/Topological_sorting#Kahn.27s_algorithm
|
||||||
|
// http://connalle.blogspot.com/2013/10/topological-sortingkahn-algorithm.html
|
||||||
|
var currentTask;
|
||||||
|
var counter = 0;
|
||||||
|
while (readyToCheck.length) {
|
||||||
|
currentTask = readyToCheck.pop();
|
||||||
|
counter++;
|
||||||
|
getDependents(currentTask).forEach(dependent => {
|
||||||
|
if (--uncheckedDependencies[dependent] === 0) {
|
||||||
|
readyToCheck.push(dependent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (counter !== numTasks) {
|
||||||
|
throw new Error('async.auto cannot execute tasks due to a recursive dependency');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDependents(taskName) {
|
||||||
|
var result = [];
|
||||||
|
Object.keys(tasks).forEach(key => {
|
||||||
|
const task = tasks[key];
|
||||||
|
if (Array.isArray(task) && task.indexOf(taskName) >= 0) {
|
||||||
|
result.push(key);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return callback[_promiseCallback.PROMISE_SYMBOL];
|
||||||
|
}
|
||||||
|
module.exports = exports.default;
|
||||||
182
node_modules/async/autoInject.js
generated
vendored
Normal file
182
node_modules/async/autoInject.js
generated
vendored
Normal file
|
|
@ -0,0 +1,182 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = autoInject;
|
||||||
|
|
||||||
|
var _auto = require('./auto.js');
|
||||||
|
|
||||||
|
var _auto2 = _interopRequireDefault(_auto);
|
||||||
|
|
||||||
|
var _wrapAsync = require('./internal/wrapAsync.js');
|
||||||
|
|
||||||
|
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
var FN_ARGS = /^(?:async\s)?(?:function)?\s*(?:\w+\s*)?\(([^)]+)\)(?:\s*{)/;
|
||||||
|
var ARROW_FN_ARGS = /^(?:async\s)?\s*(?:\(\s*)?((?:[^)=\s]\s*)*)(?:\)\s*)?=>/;
|
||||||
|
var FN_ARG_SPLIT = /,/;
|
||||||
|
var FN_ARG = /(=.+)?(\s*)$/;
|
||||||
|
|
||||||
|
function stripComments(string) {
|
||||||
|
let stripped = '';
|
||||||
|
let index = 0;
|
||||||
|
let endBlockComment = string.indexOf('*/');
|
||||||
|
while (index < string.length) {
|
||||||
|
if (string[index] === '/' && string[index + 1] === '/') {
|
||||||
|
// inline comment
|
||||||
|
let endIndex = string.indexOf('\n', index);
|
||||||
|
index = endIndex === -1 ? string.length : endIndex;
|
||||||
|
} else if (endBlockComment !== -1 && string[index] === '/' && string[index + 1] === '*') {
|
||||||
|
// block comment
|
||||||
|
let endIndex = string.indexOf('*/', index);
|
||||||
|
if (endIndex !== -1) {
|
||||||
|
index = endIndex + 2;
|
||||||
|
endBlockComment = string.indexOf('*/', index);
|
||||||
|
} else {
|
||||||
|
stripped += string[index];
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
stripped += string[index];
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return stripped;
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseParams(func) {
|
||||||
|
const src = stripComments(func.toString());
|
||||||
|
let match = src.match(FN_ARGS);
|
||||||
|
if (!match) {
|
||||||
|
match = src.match(ARROW_FN_ARGS);
|
||||||
|
}
|
||||||
|
if (!match) throw new Error('could not parse args in autoInject\nSource:\n' + src);
|
||||||
|
let [, args] = match;
|
||||||
|
return args.replace(/\s/g, '').split(FN_ARG_SPLIT).map(arg => arg.replace(FN_ARG, '').trim());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A dependency-injected version of the [async.auto]{@link module:ControlFlow.auto} function. Dependent
|
||||||
|
* tasks are specified as parameters to the function, after the usual callback
|
||||||
|
* parameter, with the parameter names matching the names of the tasks it
|
||||||
|
* depends on. This can provide even more readable task graphs which can be
|
||||||
|
* easier to maintain.
|
||||||
|
*
|
||||||
|
* If a final callback is specified, the task results are similarly injected,
|
||||||
|
* specified as named parameters after the initial error parameter.
|
||||||
|
*
|
||||||
|
* The autoInject function is purely syntactic sugar and its semantics are
|
||||||
|
* otherwise equivalent to [async.auto]{@link module:ControlFlow.auto}.
|
||||||
|
*
|
||||||
|
* @name autoInject
|
||||||
|
* @static
|
||||||
|
* @memberOf module:ControlFlow
|
||||||
|
* @method
|
||||||
|
* @see [async.auto]{@link module:ControlFlow.auto}
|
||||||
|
* @category Control Flow
|
||||||
|
* @param {Object} tasks - An object, each of whose properties is an {@link AsyncFunction} of
|
||||||
|
* the form 'func([dependencies...], callback). The object's key of a property
|
||||||
|
* serves as the name of the task defined by that property, i.e. can be used
|
||||||
|
* when specifying requirements for other tasks.
|
||||||
|
* * The `callback` parameter is a `callback(err, result)` which must be called
|
||||||
|
* when finished, passing an `error` (which can be `null`) and the result of
|
||||||
|
* the function's execution. The remaining parameters name other tasks on
|
||||||
|
* which the task is dependent, and the results from those tasks are the
|
||||||
|
* arguments of those parameters.
|
||||||
|
* @param {Function} [callback] - An optional callback which is called when all
|
||||||
|
* the tasks have been completed. It receives the `err` argument if any `tasks`
|
||||||
|
* pass an error to their callback, and a `results` object with any completed
|
||||||
|
* task results, similar to `auto`.
|
||||||
|
* @returns {Promise} a promise, if no callback is passed
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* // The example from `auto` can be rewritten as follows:
|
||||||
|
* async.autoInject({
|
||||||
|
* get_data: function(callback) {
|
||||||
|
* // async code to get some data
|
||||||
|
* callback(null, 'data', 'converted to array');
|
||||||
|
* },
|
||||||
|
* make_folder: function(callback) {
|
||||||
|
* // async code to create a directory to store a file in
|
||||||
|
* // this is run at the same time as getting the data
|
||||||
|
* callback(null, 'folder');
|
||||||
|
* },
|
||||||
|
* write_file: function(get_data, make_folder, callback) {
|
||||||
|
* // once there is some data and the directory exists,
|
||||||
|
* // write the data to a file in the directory
|
||||||
|
* callback(null, 'filename');
|
||||||
|
* },
|
||||||
|
* email_link: function(write_file, callback) {
|
||||||
|
* // once the file is written let's email a link to it...
|
||||||
|
* // write_file contains the filename returned by write_file.
|
||||||
|
* callback(null, {'file':write_file, 'email':'user@example.com'});
|
||||||
|
* }
|
||||||
|
* }, function(err, results) {
|
||||||
|
* console.log('err = ', err);
|
||||||
|
* console.log('email_link = ', results.email_link);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // If you are using a JS minifier that mangles parameter names, `autoInject`
|
||||||
|
* // will not work with plain functions, since the parameter names will be
|
||||||
|
* // collapsed to a single letter identifier. To work around this, you can
|
||||||
|
* // explicitly specify the names of the parameters your task function needs
|
||||||
|
* // in an array, similar to Angular.js dependency injection.
|
||||||
|
*
|
||||||
|
* // This still has an advantage over plain `auto`, since the results a task
|
||||||
|
* // depends on are still spread into arguments.
|
||||||
|
* async.autoInject({
|
||||||
|
* //...
|
||||||
|
* write_file: ['get_data', 'make_folder', function(get_data, make_folder, callback) {
|
||||||
|
* callback(null, 'filename');
|
||||||
|
* }],
|
||||||
|
* email_link: ['write_file', function(write_file, callback) {
|
||||||
|
* callback(null, {'file':write_file, 'email':'user@example.com'});
|
||||||
|
* }]
|
||||||
|
* //...
|
||||||
|
* }, function(err, results) {
|
||||||
|
* console.log('err = ', err);
|
||||||
|
* console.log('email_link = ', results.email_link);
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
function autoInject(tasks, callback) {
|
||||||
|
var newTasks = {};
|
||||||
|
|
||||||
|
Object.keys(tasks).forEach(key => {
|
||||||
|
var taskFn = tasks[key];
|
||||||
|
var params;
|
||||||
|
var fnIsAsync = (0, _wrapAsync.isAsync)(taskFn);
|
||||||
|
var hasNoDeps = !fnIsAsync && taskFn.length === 1 || fnIsAsync && taskFn.length === 0;
|
||||||
|
|
||||||
|
if (Array.isArray(taskFn)) {
|
||||||
|
params = [...taskFn];
|
||||||
|
taskFn = params.pop();
|
||||||
|
|
||||||
|
newTasks[key] = params.concat(params.length > 0 ? newTask : taskFn);
|
||||||
|
} else if (hasNoDeps) {
|
||||||
|
// no dependencies, use the function as-is
|
||||||
|
newTasks[key] = taskFn;
|
||||||
|
} else {
|
||||||
|
params = parseParams(taskFn);
|
||||||
|
if (taskFn.length === 0 && !fnIsAsync && params.length === 0) {
|
||||||
|
throw new Error("autoInject task functions require explicit parameters.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove callback param
|
||||||
|
if (!fnIsAsync) params.pop();
|
||||||
|
|
||||||
|
newTasks[key] = params.concat(newTask);
|
||||||
|
}
|
||||||
|
|
||||||
|
function newTask(results, taskCb) {
|
||||||
|
var newArgs = params.map(name => results[name]);
|
||||||
|
newArgs.push(taskCb);
|
||||||
|
(0, _wrapAsync2.default)(taskFn)(...newArgs);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return (0, _auto2.default)(newTasks, callback);
|
||||||
|
}
|
||||||
|
module.exports = exports.default;
|
||||||
17
node_modules/async/bower.json
generated
vendored
Normal file
17
node_modules/async/bower.json
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"name": "async",
|
||||||
|
"main": "dist/async.js",
|
||||||
|
"ignore": [
|
||||||
|
"bower_components",
|
||||||
|
"lib",
|
||||||
|
"test",
|
||||||
|
"node_modules",
|
||||||
|
"perf",
|
||||||
|
"support",
|
||||||
|
"**/.*",
|
||||||
|
"*.config.js",
|
||||||
|
"*.json",
|
||||||
|
"index.js",
|
||||||
|
"Makefile"
|
||||||
|
]
|
||||||
|
}
|
||||||
63
node_modules/async/cargo.js
generated
vendored
Normal file
63
node_modules/async/cargo.js
generated
vendored
Normal file
|
|
@ -0,0 +1,63 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = cargo;
|
||||||
|
|
||||||
|
var _queue = require('./internal/queue.js');
|
||||||
|
|
||||||
|
var _queue2 = _interopRequireDefault(_queue);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a `cargo` object with the specified payload. Tasks added to the
|
||||||
|
* cargo will be processed altogether (up to the `payload` limit). If the
|
||||||
|
* `worker` is in progress, the task is queued until it becomes available. Once
|
||||||
|
* the `worker` has completed some tasks, each callback of those tasks is
|
||||||
|
* called. Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966)
|
||||||
|
* for how `cargo` and `queue` work.
|
||||||
|
*
|
||||||
|
* While [`queue`]{@link module:ControlFlow.queue} passes only one task to one of a group of workers
|
||||||
|
* at a time, cargo passes an array of tasks to a single worker, repeating
|
||||||
|
* when the worker is finished.
|
||||||
|
*
|
||||||
|
* @name cargo
|
||||||
|
* @static
|
||||||
|
* @memberOf module:ControlFlow
|
||||||
|
* @method
|
||||||
|
* @see [async.queue]{@link module:ControlFlow.queue}
|
||||||
|
* @category Control Flow
|
||||||
|
* @param {AsyncFunction} worker - An asynchronous function for processing an array
|
||||||
|
* of queued tasks. Invoked with `(tasks, callback)`.
|
||||||
|
* @param {number} [payload=Infinity] - An optional `integer` for determining
|
||||||
|
* how many tasks should be processed per round; if omitted, the default is
|
||||||
|
* unlimited.
|
||||||
|
* @returns {module:ControlFlow.QueueObject} A cargo object to manage the tasks. Callbacks can
|
||||||
|
* attached as certain properties to listen for specific events during the
|
||||||
|
* lifecycle of the cargo and inner queue.
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* // create a cargo object with payload 2
|
||||||
|
* var cargo = async.cargo(function(tasks, callback) {
|
||||||
|
* for (var i=0; i<tasks.length; i++) {
|
||||||
|
* console.log('hello ' + tasks[i].name);
|
||||||
|
* }
|
||||||
|
* callback();
|
||||||
|
* }, 2);
|
||||||
|
*
|
||||||
|
* // add some items
|
||||||
|
* cargo.push({name: 'foo'}, function(err) {
|
||||||
|
* console.log('finished processing foo');
|
||||||
|
* });
|
||||||
|
* cargo.push({name: 'bar'}, function(err) {
|
||||||
|
* console.log('finished processing bar');
|
||||||
|
* });
|
||||||
|
* await cargo.push({name: 'baz'});
|
||||||
|
* console.log('finished processing baz');
|
||||||
|
*/
|
||||||
|
function cargo(worker, payload) {
|
||||||
|
return (0, _queue2.default)(worker, 1, payload);
|
||||||
|
}
|
||||||
|
module.exports = exports.default;
|
||||||
71
node_modules/async/cargoQueue.js
generated
vendored
Normal file
71
node_modules/async/cargoQueue.js
generated
vendored
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = cargo;
|
||||||
|
|
||||||
|
var _queue = require('./internal/queue.js');
|
||||||
|
|
||||||
|
var _queue2 = _interopRequireDefault(_queue);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a `cargoQueue` object with the specified payload. Tasks added to the
|
||||||
|
* cargoQueue will be processed together (up to the `payload` limit) in `concurrency` parallel workers.
|
||||||
|
* If the all `workers` are in progress, the task is queued until one becomes available. Once
|
||||||
|
* a `worker` has completed some tasks, each callback of those tasks is
|
||||||
|
* called. Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966)
|
||||||
|
* for how `cargo` and `queue` work.
|
||||||
|
*
|
||||||
|
* While [`queue`]{@link module:ControlFlow.queue} passes only one task to one of a group of workers
|
||||||
|
* at a time, and [`cargo`]{@link module:ControlFlow.cargo} passes an array of tasks to a single worker,
|
||||||
|
* the cargoQueue passes an array of tasks to multiple parallel workers.
|
||||||
|
*
|
||||||
|
* @name cargoQueue
|
||||||
|
* @static
|
||||||
|
* @memberOf module:ControlFlow
|
||||||
|
* @method
|
||||||
|
* @see [async.queue]{@link module:ControlFlow.queue}
|
||||||
|
* @see [async.cargo]{@link module:ControlFLow.cargo}
|
||||||
|
* @category Control Flow
|
||||||
|
* @param {AsyncFunction} worker - An asynchronous function for processing an array
|
||||||
|
* of queued tasks. Invoked with `(tasks, callback)`.
|
||||||
|
* @param {number} [concurrency=1] - An `integer` for determining how many
|
||||||
|
* `worker` functions should be run in parallel. If omitted, the concurrency
|
||||||
|
* defaults to `1`. If the concurrency is `0`, an error is thrown.
|
||||||
|
* @param {number} [payload=Infinity] - An optional `integer` for determining
|
||||||
|
* how many tasks should be processed per round; if omitted, the default is
|
||||||
|
* unlimited.
|
||||||
|
* @returns {module:ControlFlow.QueueObject} A cargoQueue object to manage the tasks. Callbacks can
|
||||||
|
* attached as certain properties to listen for specific events during the
|
||||||
|
* lifecycle of the cargoQueue and inner queue.
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* // create a cargoQueue object with payload 2 and concurrency 2
|
||||||
|
* var cargoQueue = async.cargoQueue(function(tasks, callback) {
|
||||||
|
* for (var i=0; i<tasks.length; i++) {
|
||||||
|
* console.log('hello ' + tasks[i].name);
|
||||||
|
* }
|
||||||
|
* callback();
|
||||||
|
* }, 2, 2);
|
||||||
|
*
|
||||||
|
* // add some items
|
||||||
|
* cargoQueue.push({name: 'foo'}, function(err) {
|
||||||
|
* console.log('finished processing foo');
|
||||||
|
* });
|
||||||
|
* cargoQueue.push({name: 'bar'}, function(err) {
|
||||||
|
* console.log('finished processing bar');
|
||||||
|
* });
|
||||||
|
* cargoQueue.push({name: 'baz'}, function(err) {
|
||||||
|
* console.log('finished processing baz');
|
||||||
|
* });
|
||||||
|
* cargoQueue.push({name: 'boo'}, function(err) {
|
||||||
|
* console.log('finished processing boo');
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
function cargo(worker, concurrency, payload) {
|
||||||
|
return (0, _queue2.default)(worker, concurrency, payload);
|
||||||
|
}
|
||||||
|
module.exports = exports.default;
|
||||||
55
node_modules/async/compose.js
generated
vendored
Normal file
55
node_modules/async/compose.js
generated
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = compose;
|
||||||
|
|
||||||
|
var _seq = require('./seq.js');
|
||||||
|
|
||||||
|
var _seq2 = _interopRequireDefault(_seq);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a function which is a composition of the passed asynchronous
|
||||||
|
* functions. Each function consumes the return value of the function that
|
||||||
|
* follows. Composing functions `f()`, `g()`, and `h()` would produce the result
|
||||||
|
* of `f(g(h()))`, only this version uses callbacks to obtain the return values.
|
||||||
|
*
|
||||||
|
* If the last argument to the composed function is not a function, a promise
|
||||||
|
* is returned when you call it.
|
||||||
|
*
|
||||||
|
* Each function is executed with the `this` binding of the composed function.
|
||||||
|
*
|
||||||
|
* @name compose
|
||||||
|
* @static
|
||||||
|
* @memberOf module:ControlFlow
|
||||||
|
* @method
|
||||||
|
* @category Control Flow
|
||||||
|
* @param {...AsyncFunction} functions - the asynchronous functions to compose
|
||||||
|
* @returns {Function} an asynchronous function that is the composed
|
||||||
|
* asynchronous `functions`
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* function add1(n, callback) {
|
||||||
|
* setTimeout(function () {
|
||||||
|
* callback(null, n + 1);
|
||||||
|
* }, 10);
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* function mul3(n, callback) {
|
||||||
|
* setTimeout(function () {
|
||||||
|
* callback(null, n * 3);
|
||||||
|
* }, 10);
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* var add1mul3 = async.compose(mul3, add1);
|
||||||
|
* add1mul3(4, function (err, result) {
|
||||||
|
* // result now equals 15
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
function compose(...args) {
|
||||||
|
return (0, _seq2.default)(...args.reverse());
|
||||||
|
}
|
||||||
|
module.exports = exports.default;
|
||||||
115
node_modules/async/concat.js
generated
vendored
Normal file
115
node_modules/async/concat.js
generated
vendored
Normal file
|
|
@ -0,0 +1,115 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _concatLimit = require('./concatLimit.js');
|
||||||
|
|
||||||
|
var _concatLimit2 = _interopRequireDefault(_concatLimit);
|
||||||
|
|
||||||
|
var _awaitify = require('./internal/awaitify.js');
|
||||||
|
|
||||||
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Applies `iteratee` to each item in `coll`, concatenating the results. Returns
|
||||||
|
* the concatenated list. The `iteratee`s are called in parallel, and the
|
||||||
|
* results are concatenated as they return. The results array will be returned in
|
||||||
|
* the original order of `coll` passed to the `iteratee` function.
|
||||||
|
*
|
||||||
|
* @name concat
|
||||||
|
* @static
|
||||||
|
* @memberOf module:Collections
|
||||||
|
* @method
|
||||||
|
* @category Collection
|
||||||
|
* @alias flatMap
|
||||||
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||||
|
* @param {AsyncFunction} iteratee - A function to apply to each item in `coll`,
|
||||||
|
* which should use an array as its result. Invoked with (item, callback).
|
||||||
|
* @param {Function} [callback] - A callback which is called after all the
|
||||||
|
* `iteratee` functions have finished, or an error occurs. Results is an array
|
||||||
|
* containing the concatenated results of the `iteratee` function. Invoked with
|
||||||
|
* (err, results).
|
||||||
|
* @returns A Promise, if no callback is passed
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* // dir1 is a directory that contains file1.txt, file2.txt
|
||||||
|
* // dir2 is a directory that contains file3.txt, file4.txt
|
||||||
|
* // dir3 is a directory that contains file5.txt
|
||||||
|
* // dir4 does not exist
|
||||||
|
*
|
||||||
|
* let directoryList = ['dir1','dir2','dir3'];
|
||||||
|
* let withMissingDirectoryList = ['dir1','dir2','dir3', 'dir4'];
|
||||||
|
*
|
||||||
|
* // Using callbacks
|
||||||
|
* async.concat(directoryList, fs.readdir, function(err, results) {
|
||||||
|
* if (err) {
|
||||||
|
* console.log(err);
|
||||||
|
* } else {
|
||||||
|
* console.log(results);
|
||||||
|
* // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
|
||||||
|
* }
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Error Handling
|
||||||
|
* async.concat(withMissingDirectoryList, fs.readdir, function(err, results) {
|
||||||
|
* if (err) {
|
||||||
|
* console.log(err);
|
||||||
|
* // [ Error: ENOENT: no such file or directory ]
|
||||||
|
* // since dir4 does not exist
|
||||||
|
* } else {
|
||||||
|
* console.log(results);
|
||||||
|
* }
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Using Promises
|
||||||
|
* async.concat(directoryList, fs.readdir)
|
||||||
|
* .then(results => {
|
||||||
|
* console.log(results);
|
||||||
|
* // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
|
||||||
|
* }).catch(err => {
|
||||||
|
* console.log(err);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Error Handling
|
||||||
|
* async.concat(withMissingDirectoryList, fs.readdir)
|
||||||
|
* .then(results => {
|
||||||
|
* console.log(results);
|
||||||
|
* }).catch(err => {
|
||||||
|
* console.log(err);
|
||||||
|
* // [ Error: ENOENT: no such file or directory ]
|
||||||
|
* // since dir4 does not exist
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Using async/await
|
||||||
|
* async () => {
|
||||||
|
* try {
|
||||||
|
* let results = await async.concat(directoryList, fs.readdir);
|
||||||
|
* console.log(results);
|
||||||
|
* // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
|
||||||
|
* } catch (err) {
|
||||||
|
* console.log(err);
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* // Error Handling
|
||||||
|
* async () => {
|
||||||
|
* try {
|
||||||
|
* let results = await async.concat(withMissingDirectoryList, fs.readdir);
|
||||||
|
* console.log(results);
|
||||||
|
* } catch (err) {
|
||||||
|
* console.log(err);
|
||||||
|
* // [ Error: ENOENT: no such file or directory ]
|
||||||
|
* // since dir4 does not exist
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function concat(coll, iteratee, callback) {
|
||||||
|
return (0, _concatLimit2.default)(coll, Infinity, iteratee, callback);
|
||||||
|
}
|
||||||
|
exports.default = (0, _awaitify2.default)(concat, 3);
|
||||||
|
module.exports = exports.default;
|
||||||
60
node_modules/async/concatLimit.js
generated
vendored
Normal file
60
node_modules/async/concatLimit.js
generated
vendored
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _wrapAsync = require('./internal/wrapAsync.js');
|
||||||
|
|
||||||
|
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
||||||
|
|
||||||
|
var _mapLimit = require('./mapLimit.js');
|
||||||
|
|
||||||
|
var _mapLimit2 = _interopRequireDefault(_mapLimit);
|
||||||
|
|
||||||
|
var _awaitify = require('./internal/awaitify.js');
|
||||||
|
|
||||||
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The same as [`concat`]{@link module:Collections.concat} but runs a maximum of `limit` async operations at a time.
|
||||||
|
*
|
||||||
|
* @name concatLimit
|
||||||
|
* @static
|
||||||
|
* @memberOf module:Collections
|
||||||
|
* @method
|
||||||
|
* @see [async.concat]{@link module:Collections.concat}
|
||||||
|
* @category Collection
|
||||||
|
* @alias flatMapLimit
|
||||||
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||||
|
* @param {number} limit - The maximum number of async operations at a time.
|
||||||
|
* @param {AsyncFunction} iteratee - A function to apply to each item in `coll`,
|
||||||
|
* which should use an array as its result. Invoked with (item, callback).
|
||||||
|
* @param {Function} [callback] - A callback which is called after all the
|
||||||
|
* `iteratee` functions have finished, or an error occurs. Results is an array
|
||||||
|
* containing the concatenated results of the `iteratee` function. Invoked with
|
||||||
|
* (err, results).
|
||||||
|
* @returns A Promise, if no callback is passed
|
||||||
|
*/
|
||||||
|
function concatLimit(coll, limit, iteratee, callback) {
|
||||||
|
var _iteratee = (0, _wrapAsync2.default)(iteratee);
|
||||||
|
return (0, _mapLimit2.default)(coll, limit, (val, iterCb) => {
|
||||||
|
_iteratee(val, (err, ...args) => {
|
||||||
|
if (err) return iterCb(err);
|
||||||
|
return iterCb(err, args);
|
||||||
|
});
|
||||||
|
}, (err, mapResults) => {
|
||||||
|
var result = [];
|
||||||
|
for (var i = 0; i < mapResults.length; i++) {
|
||||||
|
if (mapResults[i]) {
|
||||||
|
result = result.concat(...mapResults[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return callback(err, result);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.default = (0, _awaitify2.default)(concatLimit, 4);
|
||||||
|
module.exports = exports.default;
|
||||||
41
node_modules/async/concatSeries.js
generated
vendored
Normal file
41
node_modules/async/concatSeries.js
generated
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _concatLimit = require('./concatLimit.js');
|
||||||
|
|
||||||
|
var _concatLimit2 = _interopRequireDefault(_concatLimit);
|
||||||
|
|
||||||
|
var _awaitify = require('./internal/awaitify.js');
|
||||||
|
|
||||||
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The same as [`concat`]{@link module:Collections.concat} but runs only a single async operation at a time.
|
||||||
|
*
|
||||||
|
* @name concatSeries
|
||||||
|
* @static
|
||||||
|
* @memberOf module:Collections
|
||||||
|
* @method
|
||||||
|
* @see [async.concat]{@link module:Collections.concat}
|
||||||
|
* @category Collection
|
||||||
|
* @alias flatMapSeries
|
||||||
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||||
|
* @param {AsyncFunction} iteratee - A function to apply to each item in `coll`.
|
||||||
|
* The iteratee should complete with an array an array of results.
|
||||||
|
* Invoked with (item, callback).
|
||||||
|
* @param {Function} [callback] - A callback which is called after all the
|
||||||
|
* `iteratee` functions have finished, or an error occurs. Results is an array
|
||||||
|
* containing the concatenated results of the `iteratee` function. Invoked with
|
||||||
|
* (err, results).
|
||||||
|
* @returns A Promise, if no callback is passed
|
||||||
|
*/
|
||||||
|
function concatSeries(coll, iteratee, callback) {
|
||||||
|
return (0, _concatLimit2.default)(coll, 1, iteratee, callback);
|
||||||
|
}
|
||||||
|
exports.default = (0, _awaitify2.default)(concatSeries, 3);
|
||||||
|
module.exports = exports.default;
|
||||||
14
node_modules/async/constant.js
generated
vendored
Normal file
14
node_modules/async/constant.js
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
exports.default = function (...args) {
|
||||||
|
return function (...ignoredArgs /*, callback*/) {
|
||||||
|
var callback = ignoredArgs.pop();
|
||||||
|
return callback(null, ...args);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = exports.default;
|
||||||
96
node_modules/async/detect.js
generated
vendored
Normal file
96
node_modules/async/detect.js
generated
vendored
Normal file
|
|
@ -0,0 +1,96 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _createTester = require('./internal/createTester.js');
|
||||||
|
|
||||||
|
var _createTester2 = _interopRequireDefault(_createTester);
|
||||||
|
|
||||||
|
var _eachOf = require('./eachOf.js');
|
||||||
|
|
||||||
|
var _eachOf2 = _interopRequireDefault(_eachOf);
|
||||||
|
|
||||||
|
var _awaitify = require('./internal/awaitify.js');
|
||||||
|
|
||||||
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the first value in `coll` that passes an async truth test. The
|
||||||
|
* `iteratee` is applied in parallel, meaning the first iteratee to return
|
||||||
|
* `true` will fire the detect `callback` with that result. That means the
|
||||||
|
* result might not be the first item in the original `coll` (in terms of order)
|
||||||
|
* that passes the test.
|
||||||
|
|
||||||
|
* If order within the original `coll` is important, then look at
|
||||||
|
* [`detectSeries`]{@link module:Collections.detectSeries}.
|
||||||
|
*
|
||||||
|
* @name detect
|
||||||
|
* @static
|
||||||
|
* @memberOf module:Collections
|
||||||
|
* @method
|
||||||
|
* @alias find
|
||||||
|
* @category Collections
|
||||||
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||||
|
* @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
|
||||||
|
* The iteratee must complete with a boolean value as its result.
|
||||||
|
* Invoked with (item, callback).
|
||||||
|
* @param {Function} [callback] - A callback which is called as soon as any
|
||||||
|
* iteratee returns `true`, or after all the `iteratee` functions have finished.
|
||||||
|
* Result will be the first item in the array that passes the truth test
|
||||||
|
* (iteratee) or the value `undefined` if none passed. Invoked with
|
||||||
|
* (err, result).
|
||||||
|
* @returns {Promise} a promise, if a callback is omitted
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* // dir1 is a directory that contains file1.txt, file2.txt
|
||||||
|
* // dir2 is a directory that contains file3.txt, file4.txt
|
||||||
|
* // dir3 is a directory that contains file5.txt
|
||||||
|
*
|
||||||
|
* // asynchronous function that checks if a file exists
|
||||||
|
* function fileExists(file, callback) {
|
||||||
|
* fs.access(file, fs.constants.F_OK, (err) => {
|
||||||
|
* callback(null, !err);
|
||||||
|
* });
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists,
|
||||||
|
* function(err, result) {
|
||||||
|
* console.log(result);
|
||||||
|
* // dir1/file1.txt
|
||||||
|
* // result now equals the first file in the list that exists
|
||||||
|
* }
|
||||||
|
*);
|
||||||
|
*
|
||||||
|
* // Using Promises
|
||||||
|
* async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists)
|
||||||
|
* .then(result => {
|
||||||
|
* console.log(result);
|
||||||
|
* // dir1/file1.txt
|
||||||
|
* // result now equals the first file in the list that exists
|
||||||
|
* }).catch(err => {
|
||||||
|
* console.log(err);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Using async/await
|
||||||
|
* async () => {
|
||||||
|
* try {
|
||||||
|
* let result = await async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists);
|
||||||
|
* console.log(result);
|
||||||
|
* // dir1/file1.txt
|
||||||
|
* // result now equals the file in the list that exists
|
||||||
|
* }
|
||||||
|
* catch (err) {
|
||||||
|
* console.log(err);
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function detect(coll, iteratee, callback) {
|
||||||
|
return (0, _createTester2.default)(bool => bool, (res, item) => item)(_eachOf2.default, coll, iteratee, callback);
|
||||||
|
}
|
||||||
|
exports.default = (0, _awaitify2.default)(detect, 3);
|
||||||
|
module.exports = exports.default;
|
||||||
48
node_modules/async/detectLimit.js
generated
vendored
Normal file
48
node_modules/async/detectLimit.js
generated
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _createTester = require('./internal/createTester.js');
|
||||||
|
|
||||||
|
var _createTester2 = _interopRequireDefault(_createTester);
|
||||||
|
|
||||||
|
var _eachOfLimit = require('./internal/eachOfLimit.js');
|
||||||
|
|
||||||
|
var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
|
||||||
|
|
||||||
|
var _awaitify = require('./internal/awaitify.js');
|
||||||
|
|
||||||
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The same as [`detect`]{@link module:Collections.detect} but runs a maximum of `limit` async operations at a
|
||||||
|
* time.
|
||||||
|
*
|
||||||
|
* @name detectLimit
|
||||||
|
* @static
|
||||||
|
* @memberOf module:Collections
|
||||||
|
* @method
|
||||||
|
* @see [async.detect]{@link module:Collections.detect}
|
||||||
|
* @alias findLimit
|
||||||
|
* @category Collections
|
||||||
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||||
|
* @param {number} limit - The maximum number of async operations at a time.
|
||||||
|
* @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
|
||||||
|
* The iteratee must complete with a boolean value as its result.
|
||||||
|
* Invoked with (item, callback).
|
||||||
|
* @param {Function} [callback] - A callback which is called as soon as any
|
||||||
|
* iteratee returns `true`, or after all the `iteratee` functions have finished.
|
||||||
|
* Result will be the first item in the array that passes the truth test
|
||||||
|
* (iteratee) or the value `undefined` if none passed. Invoked with
|
||||||
|
* (err, result).
|
||||||
|
* @returns {Promise} a promise, if a callback is omitted
|
||||||
|
*/
|
||||||
|
function detectLimit(coll, limit, iteratee, callback) {
|
||||||
|
return (0, _createTester2.default)(bool => bool, (res, item) => item)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback);
|
||||||
|
}
|
||||||
|
exports.default = (0, _awaitify2.default)(detectLimit, 4);
|
||||||
|
module.exports = exports.default;
|
||||||
47
node_modules/async/detectSeries.js
generated
vendored
Normal file
47
node_modules/async/detectSeries.js
generated
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _createTester = require('./internal/createTester.js');
|
||||||
|
|
||||||
|
var _createTester2 = _interopRequireDefault(_createTester);
|
||||||
|
|
||||||
|
var _eachOfLimit = require('./internal/eachOfLimit.js');
|
||||||
|
|
||||||
|
var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
|
||||||
|
|
||||||
|
var _awaitify = require('./internal/awaitify.js');
|
||||||
|
|
||||||
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The same as [`detect`]{@link module:Collections.detect} but runs only a single async operation at a time.
|
||||||
|
*
|
||||||
|
* @name detectSeries
|
||||||
|
* @static
|
||||||
|
* @memberOf module:Collections
|
||||||
|
* @method
|
||||||
|
* @see [async.detect]{@link module:Collections.detect}
|
||||||
|
* @alias findSeries
|
||||||
|
* @category Collections
|
||||||
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||||
|
* @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
|
||||||
|
* The iteratee must complete with a boolean value as its result.
|
||||||
|
* Invoked with (item, callback).
|
||||||
|
* @param {Function} [callback] - A callback which is called as soon as any
|
||||||
|
* iteratee returns `true`, or after all the `iteratee` functions have finished.
|
||||||
|
* Result will be the first item in the array that passes the truth test
|
||||||
|
* (iteratee) or the value `undefined` if none passed. Invoked with
|
||||||
|
* (err, result).
|
||||||
|
* @returns {Promise} a promise, if a callback is omitted
|
||||||
|
*/
|
||||||
|
function detectSeries(coll, iteratee, callback) {
|
||||||
|
return (0, _createTester2.default)(bool => bool, (res, item) => item)((0, _eachOfLimit2.default)(1), coll, iteratee, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.default = (0, _awaitify2.default)(detectSeries, 3);
|
||||||
|
module.exports = exports.default;
|
||||||
43
node_modules/async/dir.js
generated
vendored
Normal file
43
node_modules/async/dir.js
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _consoleFunc = require('./internal/consoleFunc.js');
|
||||||
|
|
||||||
|
var _consoleFunc2 = _interopRequireDefault(_consoleFunc);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs the result of an [`async` function]{@link AsyncFunction} to the
|
||||||
|
* `console` using `console.dir` to display the properties of the resulting object.
|
||||||
|
* Only works in Node.js or in browsers that support `console.dir` and
|
||||||
|
* `console.error` (such as FF and Chrome).
|
||||||
|
* If multiple arguments are returned from the async function,
|
||||||
|
* `console.dir` is called on each argument in order.
|
||||||
|
*
|
||||||
|
* @name dir
|
||||||
|
* @static
|
||||||
|
* @memberOf module:Utils
|
||||||
|
* @method
|
||||||
|
* @category Util
|
||||||
|
* @param {AsyncFunction} function - The function you want to eventually apply
|
||||||
|
* all arguments to.
|
||||||
|
* @param {...*} arguments... - Any number of arguments to apply to the function.
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* // in a module
|
||||||
|
* var hello = function(name, callback) {
|
||||||
|
* setTimeout(function() {
|
||||||
|
* callback(null, {hello: name});
|
||||||
|
* }, 1000);
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* // in the node repl
|
||||||
|
* node> async.dir(hello, 'world');
|
||||||
|
* {hello: 'world'}
|
||||||
|
*/
|
||||||
|
exports.default = (0, _consoleFunc2.default)('dir');
|
||||||
|
module.exports = exports.default;
|
||||||
6061
node_modules/async/dist/async.js
generated
vendored
Normal file
6061
node_modules/async/dist/async.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
node_modules/async/dist/async.min.js
generated
vendored
Normal file
1
node_modules/async/dist/async.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
5948
node_modules/async/dist/async.mjs
generated
vendored
Normal file
5948
node_modules/async/dist/async.mjs
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
68
node_modules/async/doDuring.js
generated
vendored
Normal file
68
node_modules/async/doDuring.js
generated
vendored
Normal file
|
|
@ -0,0 +1,68 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _onlyOnce = require('./internal/onlyOnce.js');
|
||||||
|
|
||||||
|
var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
|
||||||
|
|
||||||
|
var _wrapAsync = require('./internal/wrapAsync.js');
|
||||||
|
|
||||||
|
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
||||||
|
|
||||||
|
var _awaitify = require('./internal/awaitify.js');
|
||||||
|
|
||||||
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The post-check version of [`whilst`]{@link module:ControlFlow.whilst}. To reflect the difference in
|
||||||
|
* the order of operations, the arguments `test` and `iteratee` are switched.
|
||||||
|
*
|
||||||
|
* `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript.
|
||||||
|
*
|
||||||
|
* @name doWhilst
|
||||||
|
* @static
|
||||||
|
* @memberOf module:ControlFlow
|
||||||
|
* @method
|
||||||
|
* @see [async.whilst]{@link module:ControlFlow.whilst}
|
||||||
|
* @category Control Flow
|
||||||
|
* @param {AsyncFunction} iteratee - A function which is called each time `test`
|
||||||
|
* passes. Invoked with (callback).
|
||||||
|
* @param {AsyncFunction} test - asynchronous truth test to perform after each
|
||||||
|
* execution of `iteratee`. Invoked with (...args, callback), where `...args` are the
|
||||||
|
* non-error args from the previous callback of `iteratee`.
|
||||||
|
* @param {Function} [callback] - A callback which is called after the test
|
||||||
|
* function has failed and repeated execution of `iteratee` has stopped.
|
||||||
|
* `callback` will be passed an error and any arguments passed to the final
|
||||||
|
* `iteratee`'s callback. Invoked with (err, [results]);
|
||||||
|
* @returns {Promise} a promise, if no callback is passed
|
||||||
|
*/
|
||||||
|
function doWhilst(iteratee, test, callback) {
|
||||||
|
callback = (0, _onlyOnce2.default)(callback);
|
||||||
|
var _fn = (0, _wrapAsync2.default)(iteratee);
|
||||||
|
var _test = (0, _wrapAsync2.default)(test);
|
||||||
|
var results;
|
||||||
|
|
||||||
|
function next(err, ...args) {
|
||||||
|
if (err) return callback(err);
|
||||||
|
if (err === false) return;
|
||||||
|
results = args;
|
||||||
|
_test(...args, check);
|
||||||
|
}
|
||||||
|
|
||||||
|
function check(err, truth) {
|
||||||
|
if (err) return callback(err);
|
||||||
|
if (err === false) return;
|
||||||
|
if (!truth) return callback(null, ...results);
|
||||||
|
_fn(next);
|
||||||
|
}
|
||||||
|
|
||||||
|
return check(null, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.default = (0, _awaitify2.default)(doWhilst, 3);
|
||||||
|
module.exports = exports.default;
|
||||||
46
node_modules/async/doUntil.js
generated
vendored
Normal file
46
node_modules/async/doUntil.js
generated
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = doUntil;
|
||||||
|
|
||||||
|
var _doWhilst = require('./doWhilst.js');
|
||||||
|
|
||||||
|
var _doWhilst2 = _interopRequireDefault(_doWhilst);
|
||||||
|
|
||||||
|
var _wrapAsync = require('./internal/wrapAsync.js');
|
||||||
|
|
||||||
|
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Like ['doWhilst']{@link module:ControlFlow.doWhilst}, except the `test` is inverted. Note the
|
||||||
|
* argument ordering differs from `until`.
|
||||||
|
*
|
||||||
|
* @name doUntil
|
||||||
|
* @static
|
||||||
|
* @memberOf module:ControlFlow
|
||||||
|
* @method
|
||||||
|
* @see [async.doWhilst]{@link module:ControlFlow.doWhilst}
|
||||||
|
* @category Control Flow
|
||||||
|
* @param {AsyncFunction} iteratee - An async function which is called each time
|
||||||
|
* `test` fails. Invoked with (callback).
|
||||||
|
* @param {AsyncFunction} test - asynchronous truth test to perform after each
|
||||||
|
* execution of `iteratee`. Invoked with (...args, callback), where `...args` are the
|
||||||
|
* non-error args from the previous callback of `iteratee`
|
||||||
|
* @param {Function} [callback] - A callback which is called after the test
|
||||||
|
* function has passed and repeated execution of `iteratee` has stopped. `callback`
|
||||||
|
* will be passed an error and any arguments passed to the final `iteratee`'s
|
||||||
|
* callback. Invoked with (err, [results]);
|
||||||
|
* @returns {Promise} a promise, if no callback is passed
|
||||||
|
*/
|
||||||
|
function doUntil(iteratee, test, callback) {
|
||||||
|
const _test = (0, _wrapAsync2.default)(test);
|
||||||
|
return (0, _doWhilst2.default)(iteratee, (...args) => {
|
||||||
|
const cb = args.pop();
|
||||||
|
_test(...args, (err, truth) => cb(err, !truth));
|
||||||
|
}, callback);
|
||||||
|
}
|
||||||
|
module.exports = exports.default;
|
||||||
68
node_modules/async/doWhilst.js
generated
vendored
Normal file
68
node_modules/async/doWhilst.js
generated
vendored
Normal file
|
|
@ -0,0 +1,68 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _onlyOnce = require('./internal/onlyOnce.js');
|
||||||
|
|
||||||
|
var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
|
||||||
|
|
||||||
|
var _wrapAsync = require('./internal/wrapAsync.js');
|
||||||
|
|
||||||
|
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
||||||
|
|
||||||
|
var _awaitify = require('./internal/awaitify.js');
|
||||||
|
|
||||||
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The post-check version of [`whilst`]{@link module:ControlFlow.whilst}. To reflect the difference in
|
||||||
|
* the order of operations, the arguments `test` and `iteratee` are switched.
|
||||||
|
*
|
||||||
|
* `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript.
|
||||||
|
*
|
||||||
|
* @name doWhilst
|
||||||
|
* @static
|
||||||
|
* @memberOf module:ControlFlow
|
||||||
|
* @method
|
||||||
|
* @see [async.whilst]{@link module:ControlFlow.whilst}
|
||||||
|
* @category Control Flow
|
||||||
|
* @param {AsyncFunction} iteratee - A function which is called each time `test`
|
||||||
|
* passes. Invoked with (callback).
|
||||||
|
* @param {AsyncFunction} test - asynchronous truth test to perform after each
|
||||||
|
* execution of `iteratee`. Invoked with (...args, callback), where `...args` are the
|
||||||
|
* non-error args from the previous callback of `iteratee`.
|
||||||
|
* @param {Function} [callback] - A callback which is called after the test
|
||||||
|
* function has failed and repeated execution of `iteratee` has stopped.
|
||||||
|
* `callback` will be passed an error and any arguments passed to the final
|
||||||
|
* `iteratee`'s callback. Invoked with (err, [results]);
|
||||||
|
* @returns {Promise} a promise, if no callback is passed
|
||||||
|
*/
|
||||||
|
function doWhilst(iteratee, test, callback) {
|
||||||
|
callback = (0, _onlyOnce2.default)(callback);
|
||||||
|
var _fn = (0, _wrapAsync2.default)(iteratee);
|
||||||
|
var _test = (0, _wrapAsync2.default)(test);
|
||||||
|
var results;
|
||||||
|
|
||||||
|
function next(err, ...args) {
|
||||||
|
if (err) return callback(err);
|
||||||
|
if (err === false) return;
|
||||||
|
results = args;
|
||||||
|
_test(...args, check);
|
||||||
|
}
|
||||||
|
|
||||||
|
function check(err, truth) {
|
||||||
|
if (err) return callback(err);
|
||||||
|
if (err === false) return;
|
||||||
|
if (!truth) return callback(null, ...results);
|
||||||
|
_fn(next);
|
||||||
|
}
|
||||||
|
|
||||||
|
return check(null, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.default = (0, _awaitify2.default)(doWhilst, 3);
|
||||||
|
module.exports = exports.default;
|
||||||
78
node_modules/async/during.js
generated
vendored
Normal file
78
node_modules/async/during.js
generated
vendored
Normal file
|
|
@ -0,0 +1,78 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _onlyOnce = require('./internal/onlyOnce.js');
|
||||||
|
|
||||||
|
var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
|
||||||
|
|
||||||
|
var _wrapAsync = require('./internal/wrapAsync.js');
|
||||||
|
|
||||||
|
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
||||||
|
|
||||||
|
var _awaitify = require('./internal/awaitify.js');
|
||||||
|
|
||||||
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repeatedly call `iteratee`, while `test` returns `true`. Calls `callback` when
|
||||||
|
* stopped, or an error occurs.
|
||||||
|
*
|
||||||
|
* @name whilst
|
||||||
|
* @static
|
||||||
|
* @memberOf module:ControlFlow
|
||||||
|
* @method
|
||||||
|
* @category Control Flow
|
||||||
|
* @param {AsyncFunction} test - asynchronous truth test to perform before each
|
||||||
|
* execution of `iteratee`. Invoked with (callback).
|
||||||
|
* @param {AsyncFunction} iteratee - An async function which is called each time
|
||||||
|
* `test` passes. Invoked with (callback).
|
||||||
|
* @param {Function} [callback] - A callback which is called after the test
|
||||||
|
* function has failed and repeated execution of `iteratee` has stopped. `callback`
|
||||||
|
* will be passed an error and any arguments passed to the final `iteratee`'s
|
||||||
|
* callback. Invoked with (err, [results]);
|
||||||
|
* @returns {Promise} a promise, if no callback is passed
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* var count = 0;
|
||||||
|
* async.whilst(
|
||||||
|
* function test(cb) { cb(null, count < 5); },
|
||||||
|
* function iter(callback) {
|
||||||
|
* count++;
|
||||||
|
* setTimeout(function() {
|
||||||
|
* callback(null, count);
|
||||||
|
* }, 1000);
|
||||||
|
* },
|
||||||
|
* function (err, n) {
|
||||||
|
* // 5 seconds have passed, n = 5
|
||||||
|
* }
|
||||||
|
* );
|
||||||
|
*/
|
||||||
|
function whilst(test, iteratee, callback) {
|
||||||
|
callback = (0, _onlyOnce2.default)(callback);
|
||||||
|
var _fn = (0, _wrapAsync2.default)(iteratee);
|
||||||
|
var _test = (0, _wrapAsync2.default)(test);
|
||||||
|
var results = [];
|
||||||
|
|
||||||
|
function next(err, ...rest) {
|
||||||
|
if (err) return callback(err);
|
||||||
|
results = rest;
|
||||||
|
if (err === false) return;
|
||||||
|
_test(check);
|
||||||
|
}
|
||||||
|
|
||||||
|
function check(err, truth) {
|
||||||
|
if (err) return callback(err);
|
||||||
|
if (err === false) return;
|
||||||
|
if (!truth) return callback(null, ...results);
|
||||||
|
_fn(next);
|
||||||
|
}
|
||||||
|
|
||||||
|
return _test(check);
|
||||||
|
}
|
||||||
|
exports.default = (0, _awaitify2.default)(whilst, 3);
|
||||||
|
module.exports = exports.default;
|
||||||
129
node_modules/async/each.js
generated
vendored
Normal file
129
node_modules/async/each.js
generated
vendored
Normal file
|
|
@ -0,0 +1,129 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _eachOf = require('./eachOf.js');
|
||||||
|
|
||||||
|
var _eachOf2 = _interopRequireDefault(_eachOf);
|
||||||
|
|
||||||
|
var _withoutIndex = require('./internal/withoutIndex.js');
|
||||||
|
|
||||||
|
var _withoutIndex2 = _interopRequireDefault(_withoutIndex);
|
||||||
|
|
||||||
|
var _wrapAsync = require('./internal/wrapAsync.js');
|
||||||
|
|
||||||
|
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
||||||
|
|
||||||
|
var _awaitify = require('./internal/awaitify.js');
|
||||||
|
|
||||||
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Applies the function `iteratee` to each item in `coll`, in parallel.
|
||||||
|
* The `iteratee` is called with an item from the list, and a callback for when
|
||||||
|
* it has finished. If the `iteratee` passes an error to its `callback`, the
|
||||||
|
* main `callback` (for the `each` function) is immediately called with the
|
||||||
|
* error.
|
||||||
|
*
|
||||||
|
* Note, that since this function applies `iteratee` to each item in parallel,
|
||||||
|
* there is no guarantee that the iteratee functions will complete in order.
|
||||||
|
*
|
||||||
|
* @name each
|
||||||
|
* @static
|
||||||
|
* @memberOf module:Collections
|
||||||
|
* @method
|
||||||
|
* @alias forEach
|
||||||
|
* @category Collection
|
||||||
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||||
|
* @param {AsyncFunction} iteratee - An async function to apply to
|
||||||
|
* each item in `coll`. Invoked with (item, callback).
|
||||||
|
* The array index is not passed to the iteratee.
|
||||||
|
* If you need the index, use `eachOf`.
|
||||||
|
* @param {Function} [callback] - A callback which is called when all
|
||||||
|
* `iteratee` functions have finished, or an error occurs. Invoked with (err).
|
||||||
|
* @returns {Promise} a promise, if a callback is omitted
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* // dir1 is a directory that contains file1.txt, file2.txt
|
||||||
|
* // dir2 is a directory that contains file3.txt, file4.txt
|
||||||
|
* // dir3 is a directory that contains file5.txt
|
||||||
|
* // dir4 does not exist
|
||||||
|
*
|
||||||
|
* const fileList = [ 'dir1/file2.txt', 'dir2/file3.txt', 'dir/file5.txt'];
|
||||||
|
* const withMissingFileList = ['dir1/file1.txt', 'dir4/file2.txt'];
|
||||||
|
*
|
||||||
|
* // asynchronous function that deletes a file
|
||||||
|
* const deleteFile = function(file, callback) {
|
||||||
|
* fs.unlink(file, callback);
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* // Using callbacks
|
||||||
|
* async.each(fileList, deleteFile, function(err) {
|
||||||
|
* if( err ) {
|
||||||
|
* console.log(err);
|
||||||
|
* } else {
|
||||||
|
* console.log('All files have been deleted successfully');
|
||||||
|
* }
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Error Handling
|
||||||
|
* async.each(withMissingFileList, deleteFile, function(err){
|
||||||
|
* console.log(err);
|
||||||
|
* // [ Error: ENOENT: no such file or directory ]
|
||||||
|
* // since dir4/file2.txt does not exist
|
||||||
|
* // dir1/file1.txt could have been deleted
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Using Promises
|
||||||
|
* async.each(fileList, deleteFile)
|
||||||
|
* .then( () => {
|
||||||
|
* console.log('All files have been deleted successfully');
|
||||||
|
* }).catch( err => {
|
||||||
|
* console.log(err);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Error Handling
|
||||||
|
* async.each(fileList, deleteFile)
|
||||||
|
* .then( () => {
|
||||||
|
* console.log('All files have been deleted successfully');
|
||||||
|
* }).catch( err => {
|
||||||
|
* console.log(err);
|
||||||
|
* // [ Error: ENOENT: no such file or directory ]
|
||||||
|
* // since dir4/file2.txt does not exist
|
||||||
|
* // dir1/file1.txt could have been deleted
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Using async/await
|
||||||
|
* async () => {
|
||||||
|
* try {
|
||||||
|
* await async.each(files, deleteFile);
|
||||||
|
* }
|
||||||
|
* catch (err) {
|
||||||
|
* console.log(err);
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* // Error Handling
|
||||||
|
* async () => {
|
||||||
|
* try {
|
||||||
|
* await async.each(withMissingFileList, deleteFile);
|
||||||
|
* }
|
||||||
|
* catch (err) {
|
||||||
|
* console.log(err);
|
||||||
|
* // [ Error: ENOENT: no such file or directory ]
|
||||||
|
* // since dir4/file2.txt does not exist
|
||||||
|
* // dir1/file1.txt could have been deleted
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function eachLimit(coll, iteratee, callback) {
|
||||||
|
return (0, _eachOf2.default)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.default = (0, _awaitify2.default)(eachLimit, 3);
|
||||||
|
module.exports = exports.default;
|
||||||
50
node_modules/async/eachLimit.js
generated
vendored
Normal file
50
node_modules/async/eachLimit.js
generated
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _eachOfLimit = require('./internal/eachOfLimit.js');
|
||||||
|
|
||||||
|
var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
|
||||||
|
|
||||||
|
var _withoutIndex = require('./internal/withoutIndex.js');
|
||||||
|
|
||||||
|
var _withoutIndex2 = _interopRequireDefault(_withoutIndex);
|
||||||
|
|
||||||
|
var _wrapAsync = require('./internal/wrapAsync.js');
|
||||||
|
|
||||||
|
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
||||||
|
|
||||||
|
var _awaitify = require('./internal/awaitify.js');
|
||||||
|
|
||||||
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time.
|
||||||
|
*
|
||||||
|
* @name eachLimit
|
||||||
|
* @static
|
||||||
|
* @memberOf module:Collections
|
||||||
|
* @method
|
||||||
|
* @see [async.each]{@link module:Collections.each}
|
||||||
|
* @alias forEachLimit
|
||||||
|
* @category Collection
|
||||||
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||||
|
* @param {number} limit - The maximum number of async operations at a time.
|
||||||
|
* @param {AsyncFunction} iteratee - An async function to apply to each item in
|
||||||
|
* `coll`.
|
||||||
|
* The array index is not passed to the iteratee.
|
||||||
|
* If you need the index, use `eachOfLimit`.
|
||||||
|
* Invoked with (item, callback).
|
||||||
|
* @param {Function} [callback] - A callback which is called when all
|
||||||
|
* `iteratee` functions have finished, or an error occurs. Invoked with (err).
|
||||||
|
* @returns {Promise} a promise, if a callback is omitted
|
||||||
|
*/
|
||||||
|
function eachLimit(coll, limit, iteratee, callback) {
|
||||||
|
return (0, _eachOfLimit2.default)(limit)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback);
|
||||||
|
}
|
||||||
|
exports.default = (0, _awaitify2.default)(eachLimit, 4);
|
||||||
|
module.exports = exports.default;
|
||||||
185
node_modules/async/eachOf.js
generated
vendored
Normal file
185
node_modules/async/eachOf.js
generated
vendored
Normal file
|
|
@ -0,0 +1,185 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _isArrayLike = require('./internal/isArrayLike.js');
|
||||||
|
|
||||||
|
var _isArrayLike2 = _interopRequireDefault(_isArrayLike);
|
||||||
|
|
||||||
|
var _breakLoop = require('./internal/breakLoop.js');
|
||||||
|
|
||||||
|
var _breakLoop2 = _interopRequireDefault(_breakLoop);
|
||||||
|
|
||||||
|
var _eachOfLimit = require('./eachOfLimit.js');
|
||||||
|
|
||||||
|
var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
|
||||||
|
|
||||||
|
var _once = require('./internal/once.js');
|
||||||
|
|
||||||
|
var _once2 = _interopRequireDefault(_once);
|
||||||
|
|
||||||
|
var _onlyOnce = require('./internal/onlyOnce.js');
|
||||||
|
|
||||||
|
var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
|
||||||
|
|
||||||
|
var _wrapAsync = require('./internal/wrapAsync.js');
|
||||||
|
|
||||||
|
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
||||||
|
|
||||||
|
var _awaitify = require('./internal/awaitify.js');
|
||||||
|
|
||||||
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
// eachOf implementation optimized for array-likes
|
||||||
|
function eachOfArrayLike(coll, iteratee, callback) {
|
||||||
|
callback = (0, _once2.default)(callback);
|
||||||
|
var index = 0,
|
||||||
|
completed = 0,
|
||||||
|
{ length } = coll,
|
||||||
|
canceled = false;
|
||||||
|
if (length === 0) {
|
||||||
|
callback(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
function iteratorCallback(err, value) {
|
||||||
|
if (err === false) {
|
||||||
|
canceled = true;
|
||||||
|
}
|
||||||
|
if (canceled === true) return;
|
||||||
|
if (err) {
|
||||||
|
callback(err);
|
||||||
|
} else if (++completed === length || value === _breakLoop2.default) {
|
||||||
|
callback(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (; index < length; index++) {
|
||||||
|
iteratee(coll[index], index, (0, _onlyOnce2.default)(iteratorCallback));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// a generic version of eachOf which can handle array, object, and iterator cases.
|
||||||
|
function eachOfGeneric(coll, iteratee, callback) {
|
||||||
|
return (0, _eachOfLimit2.default)(coll, Infinity, iteratee, callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Like [`each`]{@link module:Collections.each}, except that it passes the key (or index) as the second argument
|
||||||
|
* to the iteratee.
|
||||||
|
*
|
||||||
|
* @name eachOf
|
||||||
|
* @static
|
||||||
|
* @memberOf module:Collections
|
||||||
|
* @method
|
||||||
|
* @alias forEachOf
|
||||||
|
* @category Collection
|
||||||
|
* @see [async.each]{@link module:Collections.each}
|
||||||
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||||
|
* @param {AsyncFunction} iteratee - A function to apply to each
|
||||||
|
* item in `coll`.
|
||||||
|
* The `key` is the item's key, or index in the case of an array.
|
||||||
|
* Invoked with (item, key, callback).
|
||||||
|
* @param {Function} [callback] - A callback which is called when all
|
||||||
|
* `iteratee` functions have finished, or an error occurs. Invoked with (err).
|
||||||
|
* @returns {Promise} a promise, if a callback is omitted
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* // dev.json is a file containing a valid json object config for dev environment
|
||||||
|
* // dev.json is a file containing a valid json object config for test environment
|
||||||
|
* // prod.json is a file containing a valid json object config for prod environment
|
||||||
|
* // invalid.json is a file with a malformed json object
|
||||||
|
*
|
||||||
|
* let configs = {}; //global variable
|
||||||
|
* let validConfigFileMap = {dev: 'dev.json', test: 'test.json', prod: 'prod.json'};
|
||||||
|
* let invalidConfigFileMap = {dev: 'dev.json', test: 'test.json', invalid: 'invalid.json'};
|
||||||
|
*
|
||||||
|
* // asynchronous function that reads a json file and parses the contents as json object
|
||||||
|
* function parseFile(file, key, callback) {
|
||||||
|
* fs.readFile(file, "utf8", function(err, data) {
|
||||||
|
* if (err) return calback(err);
|
||||||
|
* try {
|
||||||
|
* configs[key] = JSON.parse(data);
|
||||||
|
* } catch (e) {
|
||||||
|
* return callback(e);
|
||||||
|
* }
|
||||||
|
* callback();
|
||||||
|
* });
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* // Using callbacks
|
||||||
|
* async.forEachOf(validConfigFileMap, parseFile, function (err) {
|
||||||
|
* if (err) {
|
||||||
|
* console.error(err);
|
||||||
|
* } else {
|
||||||
|
* console.log(configs);
|
||||||
|
* // configs is now a map of JSON data, e.g.
|
||||||
|
* // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
|
||||||
|
* }
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* //Error handing
|
||||||
|
* async.forEachOf(invalidConfigFileMap, parseFile, function (err) {
|
||||||
|
* if (err) {
|
||||||
|
* console.error(err);
|
||||||
|
* // JSON parse error exception
|
||||||
|
* } else {
|
||||||
|
* console.log(configs);
|
||||||
|
* }
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Using Promises
|
||||||
|
* async.forEachOf(validConfigFileMap, parseFile)
|
||||||
|
* .then( () => {
|
||||||
|
* console.log(configs);
|
||||||
|
* // configs is now a map of JSON data, e.g.
|
||||||
|
* // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
|
||||||
|
* }).catch( err => {
|
||||||
|
* console.error(err);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* //Error handing
|
||||||
|
* async.forEachOf(invalidConfigFileMap, parseFile)
|
||||||
|
* .then( () => {
|
||||||
|
* console.log(configs);
|
||||||
|
* }).catch( err => {
|
||||||
|
* console.error(err);
|
||||||
|
* // JSON parse error exception
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Using async/await
|
||||||
|
* async () => {
|
||||||
|
* try {
|
||||||
|
* let result = await async.forEachOf(validConfigFileMap, parseFile);
|
||||||
|
* console.log(configs);
|
||||||
|
* // configs is now a map of JSON data, e.g.
|
||||||
|
* // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json}
|
||||||
|
* }
|
||||||
|
* catch (err) {
|
||||||
|
* console.log(err);
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* //Error handing
|
||||||
|
* async () => {
|
||||||
|
* try {
|
||||||
|
* let result = await async.forEachOf(invalidConfigFileMap, parseFile);
|
||||||
|
* console.log(configs);
|
||||||
|
* }
|
||||||
|
* catch (err) {
|
||||||
|
* console.log(err);
|
||||||
|
* // JSON parse error exception
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function eachOf(coll, iteratee, callback) {
|
||||||
|
var eachOfImplementation = (0, _isArrayLike2.default)(coll) ? eachOfArrayLike : eachOfGeneric;
|
||||||
|
return eachOfImplementation(coll, (0, _wrapAsync2.default)(iteratee), callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.default = (0, _awaitify2.default)(eachOf, 3);
|
||||||
|
module.exports = exports.default;
|
||||||
47
node_modules/async/eachOfLimit.js
generated
vendored
Normal file
47
node_modules/async/eachOfLimit.js
generated
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _eachOfLimit2 = require('./internal/eachOfLimit.js');
|
||||||
|
|
||||||
|
var _eachOfLimit3 = _interopRequireDefault(_eachOfLimit2);
|
||||||
|
|
||||||
|
var _wrapAsync = require('./internal/wrapAsync.js');
|
||||||
|
|
||||||
|
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
||||||
|
|
||||||
|
var _awaitify = require('./internal/awaitify.js');
|
||||||
|
|
||||||
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The same as [`eachOf`]{@link module:Collections.eachOf} but runs a maximum of `limit` async operations at a
|
||||||
|
* time.
|
||||||
|
*
|
||||||
|
* @name eachOfLimit
|
||||||
|
* @static
|
||||||
|
* @memberOf module:Collections
|
||||||
|
* @method
|
||||||
|
* @see [async.eachOf]{@link module:Collections.eachOf}
|
||||||
|
* @alias forEachOfLimit
|
||||||
|
* @category Collection
|
||||||
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||||
|
* @param {number} limit - The maximum number of async operations at a time.
|
||||||
|
* @param {AsyncFunction} iteratee - An async function to apply to each
|
||||||
|
* item in `coll`. The `key` is the item's key, or index in the case of an
|
||||||
|
* array.
|
||||||
|
* Invoked with (item, key, callback).
|
||||||
|
* @param {Function} [callback] - A callback which is called when all
|
||||||
|
* `iteratee` functions have finished, or an error occurs. Invoked with (err).
|
||||||
|
* @returns {Promise} a promise, if a callback is omitted
|
||||||
|
*/
|
||||||
|
function eachOfLimit(coll, limit, iteratee, callback) {
|
||||||
|
return (0, _eachOfLimit3.default)(limit)(coll, (0, _wrapAsync2.default)(iteratee), callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.default = (0, _awaitify2.default)(eachOfLimit, 4);
|
||||||
|
module.exports = exports.default;
|
||||||
39
node_modules/async/eachOfSeries.js
generated
vendored
Normal file
39
node_modules/async/eachOfSeries.js
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _eachOfLimit = require('./eachOfLimit.js');
|
||||||
|
|
||||||
|
var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
|
||||||
|
|
||||||
|
var _awaitify = require('./internal/awaitify.js');
|
||||||
|
|
||||||
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The same as [`eachOf`]{@link module:Collections.eachOf} but runs only a single async operation at a time.
|
||||||
|
*
|
||||||
|
* @name eachOfSeries
|
||||||
|
* @static
|
||||||
|
* @memberOf module:Collections
|
||||||
|
* @method
|
||||||
|
* @see [async.eachOf]{@link module:Collections.eachOf}
|
||||||
|
* @alias forEachOfSeries
|
||||||
|
* @category Collection
|
||||||
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||||
|
* @param {AsyncFunction} iteratee - An async function to apply to each item in
|
||||||
|
* `coll`.
|
||||||
|
* Invoked with (item, key, callback).
|
||||||
|
* @param {Function} [callback] - A callback which is called when all `iteratee`
|
||||||
|
* functions have finished, or an error occurs. Invoked with (err).
|
||||||
|
* @returns {Promise} a promise, if a callback is omitted
|
||||||
|
*/
|
||||||
|
function eachOfSeries(coll, iteratee, callback) {
|
||||||
|
return (0, _eachOfLimit2.default)(coll, 1, iteratee, callback);
|
||||||
|
}
|
||||||
|
exports.default = (0, _awaitify2.default)(eachOfSeries, 3);
|
||||||
|
module.exports = exports.default;
|
||||||
44
node_modules/async/eachSeries.js
generated
vendored
Normal file
44
node_modules/async/eachSeries.js
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _eachLimit = require('./eachLimit.js');
|
||||||
|
|
||||||
|
var _eachLimit2 = _interopRequireDefault(_eachLimit);
|
||||||
|
|
||||||
|
var _awaitify = require('./internal/awaitify.js');
|
||||||
|
|
||||||
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The same as [`each`]{@link module:Collections.each} but runs only a single async operation at a time.
|
||||||
|
*
|
||||||
|
* Note, that unlike [`each`]{@link module:Collections.each}, this function applies iteratee to each item
|
||||||
|
* in series and therefore the iteratee functions will complete in order.
|
||||||
|
|
||||||
|
* @name eachSeries
|
||||||
|
* @static
|
||||||
|
* @memberOf module:Collections
|
||||||
|
* @method
|
||||||
|
* @see [async.each]{@link module:Collections.each}
|
||||||
|
* @alias forEachSeries
|
||||||
|
* @category Collection
|
||||||
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||||
|
* @param {AsyncFunction} iteratee - An async function to apply to each
|
||||||
|
* item in `coll`.
|
||||||
|
* The array index is not passed to the iteratee.
|
||||||
|
* If you need the index, use `eachOfSeries`.
|
||||||
|
* Invoked with (item, callback).
|
||||||
|
* @param {Function} [callback] - A callback which is called when all
|
||||||
|
* `iteratee` functions have finished, or an error occurs. Invoked with (err).
|
||||||
|
* @returns {Promise} a promise, if a callback is omitted
|
||||||
|
*/
|
||||||
|
function eachSeries(coll, iteratee, callback) {
|
||||||
|
return (0, _eachLimit2.default)(coll, 1, iteratee, callback);
|
||||||
|
}
|
||||||
|
exports.default = (0, _awaitify2.default)(eachSeries, 3);
|
||||||
|
module.exports = exports.default;
|
||||||
67
node_modules/async/ensureAsync.js
generated
vendored
Normal file
67
node_modules/async/ensureAsync.js
generated
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = ensureAsync;
|
||||||
|
|
||||||
|
var _setImmediate = require('./internal/setImmediate.js');
|
||||||
|
|
||||||
|
var _setImmediate2 = _interopRequireDefault(_setImmediate);
|
||||||
|
|
||||||
|
var _wrapAsync = require('./internal/wrapAsync.js');
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrap an async function and ensure it calls its callback on a later tick of
|
||||||
|
* the event loop. If the function already calls its callback on a next tick,
|
||||||
|
* no extra deferral is added. This is useful for preventing stack overflows
|
||||||
|
* (`RangeError: Maximum call stack size exceeded`) and generally keeping
|
||||||
|
* [Zalgo](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony)
|
||||||
|
* contained. ES2017 `async` functions are returned as-is -- they are immune
|
||||||
|
* to Zalgo's corrupting influences, as they always resolve on a later tick.
|
||||||
|
*
|
||||||
|
* @name ensureAsync
|
||||||
|
* @static
|
||||||
|
* @memberOf module:Utils
|
||||||
|
* @method
|
||||||
|
* @category Util
|
||||||
|
* @param {AsyncFunction} fn - an async function, one that expects a node-style
|
||||||
|
* callback as its last argument.
|
||||||
|
* @returns {AsyncFunction} Returns a wrapped function with the exact same call
|
||||||
|
* signature as the function passed in.
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* function sometimesAsync(arg, callback) {
|
||||||
|
* if (cache[arg]) {
|
||||||
|
* return callback(null, cache[arg]); // this would be synchronous!!
|
||||||
|
* } else {
|
||||||
|
* doSomeIO(arg, callback); // this IO would be asynchronous
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* // this has a risk of stack overflows if many results are cached in a row
|
||||||
|
* async.mapSeries(args, sometimesAsync, done);
|
||||||
|
*
|
||||||
|
* // this will defer sometimesAsync's callback if necessary,
|
||||||
|
* // preventing stack overflows
|
||||||
|
* async.mapSeries(args, async.ensureAsync(sometimesAsync), done);
|
||||||
|
*/
|
||||||
|
function ensureAsync(fn) {
|
||||||
|
if ((0, _wrapAsync.isAsync)(fn)) return fn;
|
||||||
|
return function (...args /*, callback*/) {
|
||||||
|
var callback = args.pop();
|
||||||
|
var sync = true;
|
||||||
|
args.push((...innerArgs) => {
|
||||||
|
if (sync) {
|
||||||
|
(0, _setImmediate2.default)(() => callback(...innerArgs));
|
||||||
|
} else {
|
||||||
|
callback(...innerArgs);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
fn.apply(this, args);
|
||||||
|
sync = false;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
module.exports = exports.default;
|
||||||
119
node_modules/async/every.js
generated
vendored
Normal file
119
node_modules/async/every.js
generated
vendored
Normal file
|
|
@ -0,0 +1,119 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _createTester = require('./internal/createTester.js');
|
||||||
|
|
||||||
|
var _createTester2 = _interopRequireDefault(_createTester);
|
||||||
|
|
||||||
|
var _eachOf = require('./eachOf.js');
|
||||||
|
|
||||||
|
var _eachOf2 = _interopRequireDefault(_eachOf);
|
||||||
|
|
||||||
|
var _awaitify = require('./internal/awaitify.js');
|
||||||
|
|
||||||
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns `true` if every element in `coll` satisfies an async test. If any
|
||||||
|
* iteratee call returns `false`, the main `callback` is immediately called.
|
||||||
|
*
|
||||||
|
* @name every
|
||||||
|
* @static
|
||||||
|
* @memberOf module:Collections
|
||||||
|
* @method
|
||||||
|
* @alias all
|
||||||
|
* @category Collection
|
||||||
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||||
|
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
|
||||||
|
* in the collection in parallel.
|
||||||
|
* The iteratee must complete with a boolean result value.
|
||||||
|
* Invoked with (item, callback).
|
||||||
|
* @param {Function} [callback] - A callback which is called after all the
|
||||||
|
* `iteratee` functions have finished. Result will be either `true` or `false`
|
||||||
|
* depending on the values of the async tests. Invoked with (err, result).
|
||||||
|
* @returns {Promise} a promise, if no callback provided
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* // dir1 is a directory that contains file1.txt, file2.txt
|
||||||
|
* // dir2 is a directory that contains file3.txt, file4.txt
|
||||||
|
* // dir3 is a directory that contains file5.txt
|
||||||
|
* // dir4 does not exist
|
||||||
|
*
|
||||||
|
* const fileList = ['dir1/file1.txt','dir2/file3.txt','dir3/file5.txt'];
|
||||||
|
* const withMissingFileList = ['file1.txt','file2.txt','file4.txt'];
|
||||||
|
*
|
||||||
|
* // asynchronous function that checks if a file exists
|
||||||
|
* function fileExists(file, callback) {
|
||||||
|
* fs.access(file, fs.constants.F_OK, (err) => {
|
||||||
|
* callback(null, !err);
|
||||||
|
* });
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* // Using callbacks
|
||||||
|
* async.every(fileList, fileExists, function(err, result) {
|
||||||
|
* console.log(result);
|
||||||
|
* // true
|
||||||
|
* // result is true since every file exists
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* async.every(withMissingFileList, fileExists, function(err, result) {
|
||||||
|
* console.log(result);
|
||||||
|
* // false
|
||||||
|
* // result is false since NOT every file exists
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Using Promises
|
||||||
|
* async.every(fileList, fileExists)
|
||||||
|
* .then( result => {
|
||||||
|
* console.log(result);
|
||||||
|
* // true
|
||||||
|
* // result is true since every file exists
|
||||||
|
* }).catch( err => {
|
||||||
|
* console.log(err);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* async.every(withMissingFileList, fileExists)
|
||||||
|
* .then( result => {
|
||||||
|
* console.log(result);
|
||||||
|
* // false
|
||||||
|
* // result is false since NOT every file exists
|
||||||
|
* }).catch( err => {
|
||||||
|
* console.log(err);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Using async/await
|
||||||
|
* async () => {
|
||||||
|
* try {
|
||||||
|
* let result = await async.every(fileList, fileExists);
|
||||||
|
* console.log(result);
|
||||||
|
* // true
|
||||||
|
* // result is true since every file exists
|
||||||
|
* }
|
||||||
|
* catch (err) {
|
||||||
|
* console.log(err);
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* async () => {
|
||||||
|
* try {
|
||||||
|
* let result = await async.every(withMissingFileList, fileExists);
|
||||||
|
* console.log(result);
|
||||||
|
* // false
|
||||||
|
* // result is false since NOT every file exists
|
||||||
|
* }
|
||||||
|
* catch (err) {
|
||||||
|
* console.log(err);
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function every(coll, iteratee, callback) {
|
||||||
|
return (0, _createTester2.default)(bool => !bool, res => !res)(_eachOf2.default, coll, iteratee, callback);
|
||||||
|
}
|
||||||
|
exports.default = (0, _awaitify2.default)(every, 3);
|
||||||
|
module.exports = exports.default;
|
||||||
46
node_modules/async/everyLimit.js
generated
vendored
Normal file
46
node_modules/async/everyLimit.js
generated
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _createTester = require('./internal/createTester.js');
|
||||||
|
|
||||||
|
var _createTester2 = _interopRequireDefault(_createTester);
|
||||||
|
|
||||||
|
var _eachOfLimit = require('./internal/eachOfLimit.js');
|
||||||
|
|
||||||
|
var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
|
||||||
|
|
||||||
|
var _awaitify = require('./internal/awaitify.js');
|
||||||
|
|
||||||
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The same as [`every`]{@link module:Collections.every} but runs a maximum of `limit` async operations at a time.
|
||||||
|
*
|
||||||
|
* @name everyLimit
|
||||||
|
* @static
|
||||||
|
* @memberOf module:Collections
|
||||||
|
* @method
|
||||||
|
* @see [async.every]{@link module:Collections.every}
|
||||||
|
* @alias allLimit
|
||||||
|
* @category Collection
|
||||||
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||||
|
* @param {number} limit - The maximum number of async operations at a time.
|
||||||
|
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
|
||||||
|
* in the collection in parallel.
|
||||||
|
* The iteratee must complete with a boolean result value.
|
||||||
|
* Invoked with (item, callback).
|
||||||
|
* @param {Function} [callback] - A callback which is called after all the
|
||||||
|
* `iteratee` functions have finished. Result will be either `true` or `false`
|
||||||
|
* depending on the values of the async tests. Invoked with (err, result).
|
||||||
|
* @returns {Promise} a promise, if no callback provided
|
||||||
|
*/
|
||||||
|
function everyLimit(coll, limit, iteratee, callback) {
|
||||||
|
return (0, _createTester2.default)(bool => !bool, res => !res)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback);
|
||||||
|
}
|
||||||
|
exports.default = (0, _awaitify2.default)(everyLimit, 4);
|
||||||
|
module.exports = exports.default;
|
||||||
45
node_modules/async/everySeries.js
generated
vendored
Normal file
45
node_modules/async/everySeries.js
generated
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _createTester = require('./internal/createTester.js');
|
||||||
|
|
||||||
|
var _createTester2 = _interopRequireDefault(_createTester);
|
||||||
|
|
||||||
|
var _eachOfSeries = require('./eachOfSeries.js');
|
||||||
|
|
||||||
|
var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
|
||||||
|
|
||||||
|
var _awaitify = require('./internal/awaitify.js');
|
||||||
|
|
||||||
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The same as [`every`]{@link module:Collections.every} but runs only a single async operation at a time.
|
||||||
|
*
|
||||||
|
* @name everySeries
|
||||||
|
* @static
|
||||||
|
* @memberOf module:Collections
|
||||||
|
* @method
|
||||||
|
* @see [async.every]{@link module:Collections.every}
|
||||||
|
* @alias allSeries
|
||||||
|
* @category Collection
|
||||||
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||||
|
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
|
||||||
|
* in the collection in series.
|
||||||
|
* The iteratee must complete with a boolean result value.
|
||||||
|
* Invoked with (item, callback).
|
||||||
|
* @param {Function} [callback] - A callback which is called after all the
|
||||||
|
* `iteratee` functions have finished. Result will be either `true` or `false`
|
||||||
|
* depending on the values of the async tests. Invoked with (err, result).
|
||||||
|
* @returns {Promise} a promise, if no callback provided
|
||||||
|
*/
|
||||||
|
function everySeries(coll, iteratee, callback) {
|
||||||
|
return (0, _createTester2.default)(bool => !bool, res => !res)(_eachOfSeries2.default, coll, iteratee, callback);
|
||||||
|
}
|
||||||
|
exports.default = (0, _awaitify2.default)(everySeries, 3);
|
||||||
|
module.exports = exports.default;
|
||||||
93
node_modules/async/filter.js
generated
vendored
Normal file
93
node_modules/async/filter.js
generated
vendored
Normal file
|
|
@ -0,0 +1,93 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var _filter2 = require('./internal/filter.js');
|
||||||
|
|
||||||
|
var _filter3 = _interopRequireDefault(_filter2);
|
||||||
|
|
||||||
|
var _eachOf = require('./eachOf.js');
|
||||||
|
|
||||||
|
var _eachOf2 = _interopRequireDefault(_eachOf);
|
||||||
|
|
||||||
|
var _awaitify = require('./internal/awaitify.js');
|
||||||
|
|
||||||
|
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new array of all the values in `coll` which pass an async truth
|
||||||
|
* test. This operation is performed in parallel, but the results array will be
|
||||||
|
* in the same order as the original.
|
||||||
|
*
|
||||||
|
* @name filter
|
||||||
|
* @static
|
||||||
|
* @memberOf module:Collections
|
||||||
|
* @method
|
||||||
|
* @alias select
|
||||||
|
* @category Collection
|
||||||
|
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||||
|
* @param {Function} iteratee - A truth test to apply to each item in `coll`.
|
||||||
|
* The `iteratee` is passed a `callback(err, truthValue)`, which must be called
|
||||||
|
* with a boolean argument once it has completed. Invoked with (item, callback).
|
||||||
|
* @param {Function} [callback] - A callback which is called after all the
|
||||||
|
* `iteratee` functions have finished. Invoked with (err, results).
|
||||||
|
* @returns {Promise} a promise, if no callback provided
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* // dir1 is a directory that contains file1.txt, file2.txt
|
||||||
|
* // dir2 is a directory that contains file3.txt, file4.txt
|
||||||
|
* // dir3 is a directory that contains file5.txt
|
||||||
|
*
|
||||||
|
* const files = ['dir1/file1.txt','dir2/file3.txt','dir3/file6.txt'];
|
||||||
|
*
|
||||||
|
* // asynchronous function that checks if a file exists
|
||||||
|
* function fileExists(file, callback) {
|
||||||
|
* fs.access(file, fs.constants.F_OK, (err) => {
|
||||||
|
* callback(null, !err);
|
||||||
|
* });
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* // Using callbacks
|
||||||
|
* async.filter(files, fileExists, function(err, results) {
|
||||||
|
* if(err) {
|
||||||
|
* console.log(err);
|
||||||
|
* } else {
|
||||||
|
* console.log(results);
|
||||||
|
* // [ 'dir1/file1.txt', 'dir2/file3.txt' ]
|
||||||
|
* // results is now an array of the existing files
|
||||||
|
* }
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Using Promises
|
||||||
|
* async.filter(files, fileExists)
|
||||||
|
* .then(results => {
|
||||||
|
* console.log(results);
|
||||||
|
* // [ 'dir1/file1.txt', 'dir2/file3.txt' ]
|
||||||
|
* // results is now an array of the existing files
|
||||||
|
* }).catch(err => {
|
||||||
|
* console.log(err);
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* // Using async/await
|
||||||
|
* async () => {
|
||||||
|
* try {
|
||||||
|
* let results = await async.filter(files, fileExists);
|
||||||
|
* console.log(results);
|
||||||
|
* // [ 'dir1/file1.txt', 'dir2/file3.txt' ]
|
||||||
|
* // results is now an array of the existing files
|
||||||
|
* }
|
||||||
|
* catch (err) {
|
||||||
|
* console.log(err);
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function filter(coll, iteratee, callback) {
|
||||||
|
return (0, _filter3.default)(_eachOf2.default, coll, iteratee, callback);
|
||||||
|
}
|
||||||
|
exports.default = (0, _awaitify2.default)(filter, 3);
|
||||||
|
module.exports = exports.default;
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue