Initial commit

This commit is contained in:
2021-08-24 19:21:14 +02:00
commit 02f21f1ccd
2407 changed files with 1130275 additions and 0 deletions

15
node_modules/arg/.editorconfig generated vendored Normal file
View File

@@ -0,0 +1,15 @@
root = true
[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[{*.json,*.json.example,*.gyp,*.yml,*.py}]
indent_style = space
indent_size = 4
[*.md]
trim_trailing_whitespace = false

21
node_modules/arg/LICENSE.md generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017 Zeit, Inc.
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.

163
node_modules/arg/README.md generated vendored Normal file
View File

@@ -0,0 +1,163 @@
# Arg
`arg` is yet another command line option parser.
## Installation
Use Yarn or NPM to install.
```console
$ yarn add arg
```
or
```console
$ npm install arg
```
## Usage
`arg()` takes either 1 or 2 arguments:
1. Command line specification object (see below)
2. Parse options (_Optional_, defaults to `{permissive: false, argv: process.argv.slice(2)}`)
It returns an object with any values present on the command-line (missing options are thus
missing from the resulting object). Arg performs no validation/requirement checking - we
leave that up to the application.
All parameters that aren't consumed by options (commonly referred to as "extra" parameters)
are added to `result._`, which is _always_ an array (even if no extra parameters are passed,
in which case an empty array is returned).
```javascript
const arg = require('arg');
// `argument_array` is an optional parameter
const args = arg(spec, options = {permissive: false, argv: process.argv.slice(2)}]);
```
For example:
```console
$ node ./hello.js --port=1234 -n 'My name' foo bar --tag qux --tag=qix -- --foobar
```
```javascript
// hello.js
const arg = require('arg');
const args = arg({
// Types
'--help': Boolean,
'--version': Boolean,
'--port': Number, // --port <number> or --port=<number>
'--name': String, // --name <string> or --name=<string>
'--tag': [String], // --tag <string> or --tag=<string>
// Aliases
'-v': '--version',
'-n': '--name', // -n <string>; result is stored in --name
'--label': '--name' // --label <string> or --label=<string>;
// result is stored in --name
});
console.log(args);
/*
{
_: ["foo", "bar", "--foobar"],
'--port': 1234,
'--name': "My name",
'--tag': ["qux", "qix"]
}
*/
```
The values for each key=&gt;value pair is either a type (function or [function]) or a string (indicating an alias).
- In the case of a function, the string value of the argument's value is passed to it,
and the return value is used as the ultimate value.
- In the case of an array, the only element _must_ be a type function. Array types indicate
that the argument may be passed multiple times, and as such the resulting value in the returned
object is an array with all of the values that were passed using the specified flag.
- In the case of a string, an alias is established. If a flag is passed that matches the _key_,
then the _value_ is substituted in its place.
Type functions are passed three arguments:
1. The parameter value (always a string)
2. The parameter name (e.g. `--label`)
3. The previous value for the destination (useful for reduce-like operatons or for supporting `-v` multiple times, etc.)
This means the built-in `String`, `Number`, and `Boolean` type constructors "just work" as type functions.
### Options
If a second parameter is specified and is an object, it specifies parsing options to modify the behavior of `arg()`.
#### `argv`
If you have already sliced or generated a number of raw arguments to be parsed (as opposed to letting `arg`
slice them from `process.argv`) you may specify them in the `argv` option.
For example:
```javascript
const args = arg(
{
'--foo': String
}, {
argv: ['hello', '--foo', 'world']
}
);
```
results in:
```javascript
const args = {
_: ['hello'],
'--foo': 'world'
};
```
#### `permissive`
When `permissive` set to `true`, `arg` will push any unknown arguments
onto the "extra" argument array (`result._`) instead of throwing an error about
an unknown flag.
For example:
```javascript
const arg = require('arg');
const argv = ['--foo', 'hello', '--qux', 'qix', '--bar', '12345', 'hello again'];
const args = arg(
{
'--foo': String,
'--bar': Number
}, {
argv,
permissive: true
}
);
```
results in:
```javascript
const args = {
_: ['--qux', 'qix', 'hello again'],
'--foo': 'hello',
'--bar': 12345
}
```
# License
Copyright &copy; 2017-2018 by ZEIT, Inc. Released under the [MIT License](LICENSE.md).

96
node_modules/arg/index.js generated vendored Normal file
View File

@@ -0,0 +1,96 @@
function arg(opts, {argv, permissive = false} = {}) {
if (!opts) {
throw new Error('Argument specification must be specified');
}
const result = {_: []};
argv = argv || process.argv.slice(2);
const aliases = {};
const handlers = {};
for (const key of Object.keys(opts)) {
if (typeof opts[key] === 'string') {
aliases[key] = opts[key];
continue;
}
const type = opts[key];
if (!type || (typeof type !== 'function' && !(Array.isArray(type) && type.length === 1 && typeof type[0] === 'function'))) {
throw new Error(`Type missing or not a function or valid array type: ${key}`);
}
handlers[key] = type;
}
for (let i = 0, len = argv.length; i < len; i++) {
const arg = argv[i];
if (arg.length < 2) {
result._.push(arg);
continue;
}
if (arg === '--') {
result._ = result._.concat(argv.slice(i + 1));
break;
}
if (arg[0] === '-') {
const [originalArgName, argStr] = arg[1] === '-' ? arg.split('=', 2) : [arg, undefined];
let argName = originalArgName;
while (argName in aliases) {
argName = aliases[argName];
}
if (!(argName in handlers)) {
if (permissive) {
result._.push(arg);
continue;
} else {
throw new Error(`Unknown or unexpected option: ${originalArgName}`);
}
}
/* eslint-disable operator-linebreak */
const [type, isArray] = Array.isArray(handlers[argName])
? [handlers[argName][0], true]
: [handlers[argName], false];
/* eslint-enable operator-linebreak */
let value;
if (type === Boolean) {
value = true;
} else if (argStr === undefined) {
if (argv.length < i + 2 || (argv[i + 1].length > 1 && argv[i + 1][0] === '-')) {
const extended = originalArgName === argName ? '' : ` (alias for ${argName})`;
throw new Error(`Option requires argument: ${originalArgName}${extended}`);
}
value = type(argv[i + 1], argName, result[argName]);
++i;
} else {
value = type(argStr, argName, result[argName]);
}
if (isArray) {
if (result[argName]) {
result[argName].push(value);
} else {
result[argName] = [value];
}
} else {
result[argName] = value;
}
} else {
result._.push(arg);
}
}
return result;
}
module.exports = arg;

23
node_modules/arg/package.json generated vendored Normal file
View File

@@ -0,0 +1,23 @@
{
"name": "arg",
"version": "2.0.0",
"description": "Another simple argument parser",
"main": "index.js",
"repository": "zeit/arg",
"author": "Josh Junon <junon@zeit.co>",
"license": "MIT",
"scripts": {
"pretest": "xo",
"test": "WARN_EXIT=1 jest --coverage -w 2"
},
"xo": {
"rules": {
"complexity": 0
}
},
"devDependencies": {
"chai": "^4.1.1",
"jest": "^20.0.4",
"xo": "^0.18.2"
}
}

180
node_modules/arg/test.js generated vendored Normal file
View File

@@ -0,0 +1,180 @@
/* global test */
/* eslint-disable no-unused-expressions */
const expect = require('chai').expect;
const arg = require('.');
test('basic parses arguments from process.argv', () => {
const curArgs = process.argv;
process.argv = ['node', 'test.js', '--foo', '1337', '-B', 'hello', '--mcgee'];
try {
const args = arg({
'--foo': Number,
'--bar': String,
'--mcgee': Boolean,
'-B': '--bar'
});
expect(args).to.exist;
expect(args['--foo']).to.equal(1337);
expect(args['--bar']).to.equal('hello');
expect(args['--mcgee']).to.equal(true);
} finally {
process.argv = curArgs;
}
});
test('arg with no arguments', () => {
expect(() => arg()).to.throw('Argument specification must be specified');
});
test('basic extra arguments parsing', () => {
const argv = ['hi', 'hello', 'there', '-'];
expect(arg({}, {argv})).to.deep.equal({_: argv});
});
test('basic string parsing', () => {
const argv = ['hey', '--foo', 'hi', 'hello'];
expect(arg({'--foo': String}, {argv})).to.deep.equal({_: ['hey', 'hello'], '--foo': 'hi'});
});
test('basic string parsing (equals long-arg)', () => {
const argv = ['hey', '--foo=hi', 'hello'];
expect(arg({'--foo': String}, {argv})).to.deep.equal({_: ['hey', 'hello'], '--foo': 'hi'});
});
test('basic number parsing', () => {
const argv = ['hey', '--foo', '1234', 'hello'];
expect(arg({'--foo': Number}, {argv})).to.deep.equal({_: ['hey', 'hello'], '--foo': 1234});
});
test('basic boolean parsing', () => {
const argv = ['hey', '--foo', '1234', 'hello'];
expect(arg({'--foo': Boolean}, {argv})).to.deep.equal({_: ['hey', '1234', 'hello'], '--foo': true});
});
test('basic custom type parsing', () => {
const argv = ['hey', '--foo', '1234', 'hello'];
const customType = (val, name) => `:${name}:${val}:`;
expect(arg({'--foo': customType}, {argv})).to.deep.equal({_: ['hey', 'hello'], '--foo': ':--foo:1234:'});
});
test('basic string parsing (array)', () => {
const argv = ['hey', '--foo', 'hi', 'hello', '--foo', 'hey'];
expect(arg({'--foo': [String]}, {argv})).to.deep.equal({_: ['hey', 'hello'], '--foo': ['hi', 'hey']});
});
test('basic number parsing (array)', () => {
const argv = ['hey', '--foo', '1234', 'hello', '--foo', '5432'];
expect(arg({'--foo': [Number]}, {argv})).to.deep.equal({_: ['hey', 'hello'], '--foo': [1234, 5432]});
});
test('basic boolean parsing (array)', () => {
const argv = ['hey', '--foo', '1234', 'hello', '--foo', 'hallo'];
expect(arg({'--foo': [Boolean]}, {argv})).to.deep.equal({_: ['hey', '1234', 'hello', 'hallo'], '--foo': [true, true]});
});
test('basic custom type parsing (array)', () => {
const argv = ['hey', '--foo', '1234', 'hello', '--foo', '8911hi'];
const customType = (val, name) => `:${name}:${val}:`;
expect(arg({'--foo': [customType]}, {argv})).to.deep.equal({_: ['hey', 'hello'], '--foo': [':--foo:1234:', ':--foo:8911hi:']});
});
test('basic alias parsing', () => {
const argv = ['--foo', '1234', '-B', '-', 'hello', '--not-foo-or-bar', 'ohai'];
const opts = {
'--foo': Number,
'--bar': String,
'--another-arg': Boolean,
'-a': '--another-arg',
'--not-foo-or-bar': '--another-arg',
'-B': '--bar'
};
expect(arg(opts, {argv})).to.deep.equal({
_: ['hello', 'ohai'],
'--foo': 1234,
'--bar': '-',
'--another-arg': true
});
});
test('double-dash parsing', () => {
const argv = ['--foo', '1234', 'hi', '--foo', '5678', 'there', '--', '--foo', '2468'];
expect(arg({'--foo': Number}, {argv})).to.deep.equal({_: ['hi', 'there', '--foo', '2468'], '--foo': 5678});
});
test('error: invalid option', () => {
const argv = ['--foo', '1234', '--bar', '8765'];
expect(() => arg({'--foo': Number}, {argv})).to.throw('Unknown or unexpected option: --bar');
});
test('error: expected argument', () => {
const argv = ['--foo', '--bar', '1234'];
expect(() => arg({'--foo': String, '--bar': Number}, {argv})).to.throw('Option requires argument: --foo');
});
test('error: expected argument (end flag)', () => {
const argv = ['--foo', '--bar'];
expect(() => arg({'--foo': Boolean, '--bar': Number}, {argv})).to.throw('Option requires argument: --bar');
});
test('error: expected argument (alias)', () => {
const argv = ['--foo', '--bar', '1234'];
expect(() => arg({'--realfoo': String, '--foo': '--realfoo', '--bar': Number}, {argv})).to.throw('Option requires argument: --foo (alias for --realfoo)');
});
test('error: expected argument (end flag) (alias)', () => {
const argv = ['--foo', '--bar'];
expect(() => arg({'--foo': Boolean, '--realbar': Number, '--bar': '--realbar'}, {argv})).to.throw('Option requires argument: --bar (alias for --realbar)');
});
test('error: non-function type', () => {
const argv = [];
expect(() => arg({'--foo': 10}, {argv})).to.throw('Type missing or not a function or valid array type: --foo');
expect(() => arg({'--foo': null}, {argv})).to.throw('Type missing or not a function or valid array type: --foo');
expect(() => arg({'--foo': undefined}, {argv})).to.throw('Type missing or not a function or valid array type: --foo');
});
test('permissive mode allows unknown args', () => {
const argv = ['foo', '--real', 'nice', '--unreal', 'stillnice', '-a', '1', '-b', '2', 'goodbye'];
const result = arg(
{
'--real': String,
'--first': Number,
'-a': '--first'
}, {
argv,
permissive: true
}
);
expect(result).to.deep.equal({
_: ['foo', '--unreal', 'stillnice', '-b', '2', 'goodbye'],
'--real': 'nice',
'--first': 1
});
});
test('permissive mode works with no argv specified', () => {
const curArgs = process.argv;
process.argv = ['node', 'test.js', '--foo', '1337', '-B', 'hello', '--mcgee'];
try {
const result = arg({
'--foo': Number,
'--mcgee': Boolean,
'--unused': Boolean
}, {
permissive: true
});
expect(result).to.deep.equal({
_: ['-B', 'hello'],
'--foo': 1337,
'--mcgee': true
});
} finally {
process.argv = curArgs;
}
});

3431
node_modules/arg/yarn.lock generated vendored Normal file

File diff suppressed because it is too large Load Diff