Update capacitor version
This commit is contained in:
parent
91155bce0a
commit
f3b3a86b32
610 changed files with 28718 additions and 7101 deletions
42
@capacitor/cli/node_modules/commander/lib/option.js
generated
vendored
42
@capacitor/cli/node_modules/commander/lib/option.js
generated
vendored
|
@ -1,7 +1,5 @@
|
|||
const { InvalidArgumentError } = require('./error.js');
|
||||
|
||||
// @ts-check
|
||||
|
||||
class Option {
|
||||
/**
|
||||
* Initialize a new `Option` with the given `flags` and `description`.
|
||||
|
@ -40,7 +38,7 @@ class Option {
|
|||
/**
|
||||
* Set the default value, and optionally supply the description to be displayed in the help.
|
||||
*
|
||||
* @param {any} value
|
||||
* @param {*} value
|
||||
* @param {string} [description]
|
||||
* @return {Option}
|
||||
*/
|
||||
|
@ -59,7 +57,7 @@ class Option {
|
|||
* new Option('--color').default('GREYSCALE').preset('RGB');
|
||||
* new Option('--donate [amount]').preset('20').argParser(parseFloat);
|
||||
*
|
||||
* @param {any} arg
|
||||
* @param {*} arg
|
||||
* @return {Option}
|
||||
*/
|
||||
|
||||
|
@ -76,7 +74,7 @@ class Option {
|
|||
* new Option('--rgb').conflicts('cmyk');
|
||||
* new Option('--js').conflicts(['ts', 'jsx']);
|
||||
*
|
||||
* @param {string | string[]} names
|
||||
* @param {(string | string[])} names
|
||||
* @return {Option}
|
||||
*/
|
||||
|
||||
|
@ -95,11 +93,16 @@ class Option {
|
|||
* .addOption(new Option('--log', 'write logging information to file'))
|
||||
* .addOption(new Option('--trace', 'log extra details').implies({ log: 'trace.txt' }));
|
||||
*
|
||||
* @param {Object} impliedOptionValues
|
||||
* @param {object} impliedOptionValues
|
||||
* @return {Option}
|
||||
*/
|
||||
implies(impliedOptionValues) {
|
||||
this.implied = Object.assign(this.implied || {}, impliedOptionValues);
|
||||
let newImplied = impliedOptionValues;
|
||||
if (typeof impliedOptionValues === 'string') {
|
||||
// string is not documented, but easy mistake and we can do what user probably intended.
|
||||
newImplied = { [impliedOptionValues]: true };
|
||||
}
|
||||
this.implied = Object.assign(this.implied || {}, newImplied);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -155,7 +158,7 @@ class Option {
|
|||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
* @package
|
||||
*/
|
||||
|
||||
_concatValue(value, previous) {
|
||||
|
@ -177,7 +180,9 @@ class Option {
|
|||
this.argChoices = values.slice();
|
||||
this.parseArg = (arg, previous) => {
|
||||
if (!this.argChoices.includes(arg)) {
|
||||
throw new InvalidArgumentError(`Allowed choices are ${this.argChoices.join(', ')}.`);
|
||||
throw new InvalidArgumentError(
|
||||
`Allowed choices are ${this.argChoices.join(', ')}.`,
|
||||
);
|
||||
}
|
||||
if (this.variadic) {
|
||||
return this._concatValue(arg, previous);
|
||||
|
@ -205,7 +210,6 @@ class Option {
|
|||
* as a object attribute key.
|
||||
*
|
||||
* @return {string}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
attributeName() {
|
||||
|
@ -217,7 +221,7 @@ class Option {
|
|||
*
|
||||
* @param {string} arg
|
||||
* @return {boolean}
|
||||
* @api private
|
||||
* @package
|
||||
*/
|
||||
|
||||
is(arg) {
|
||||
|
@ -230,7 +234,7 @@ class Option {
|
|||
* Options are one of boolean, negated, required argument, or optional argument.
|
||||
*
|
||||
* @return {boolean}
|
||||
* @api private
|
||||
* @package
|
||||
*/
|
||||
|
||||
isBoolean() {
|
||||
|
@ -253,7 +257,7 @@ class DualOptions {
|
|||
this.positiveOptions = new Map();
|
||||
this.negativeOptions = new Map();
|
||||
this.dualOptions = new Set();
|
||||
options.forEach(option => {
|
||||
options.forEach((option) => {
|
||||
if (option.negate) {
|
||||
this.negativeOptions.set(option.attributeName(), option);
|
||||
} else {
|
||||
|
@ -270,7 +274,7 @@ class DualOptions {
|
|||
/**
|
||||
* Did the value come from the option, and not from possible matching dual option?
|
||||
*
|
||||
* @param {any} value
|
||||
* @param {*} value
|
||||
* @param {Option} option
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
@ -280,7 +284,7 @@ class DualOptions {
|
|||
|
||||
// Use the value to deduce if (probably) came from the option.
|
||||
const preset = this.negativeOptions.get(optionKey).presetArg;
|
||||
const negativeValue = (preset !== undefined) ? preset : false;
|
||||
const negativeValue = preset !== undefined ? preset : false;
|
||||
return option.negate === (negativeValue === value);
|
||||
}
|
||||
}
|
||||
|
@ -290,7 +294,7 @@ class DualOptions {
|
|||
*
|
||||
* @param {string} str
|
||||
* @return {string}
|
||||
* @api private
|
||||
* @private
|
||||
*/
|
||||
|
||||
function camelcase(str) {
|
||||
|
@ -302,7 +306,7 @@ function camelcase(str) {
|
|||
/**
|
||||
* Split the short and long flag out of something like '-m,--mixed <value>'
|
||||
*
|
||||
* @api private
|
||||
* @private
|
||||
*/
|
||||
|
||||
function splitOptionFlags(flags) {
|
||||
|
@ -311,7 +315,8 @@ function splitOptionFlags(flags) {
|
|||
// Use original very loose parsing to maintain backwards compatibility for now,
|
||||
// which allowed for example unintended `-sw, --short-word` [sic].
|
||||
const flagParts = flags.split(/[ |,]+/);
|
||||
if (flagParts.length > 1 && !/^[[<]/.test(flagParts[1])) shortFlag = flagParts.shift();
|
||||
if (flagParts.length > 1 && !/^[[<]/.test(flagParts[1]))
|
||||
shortFlag = flagParts.shift();
|
||||
longFlag = flagParts.shift();
|
||||
// Add support for lone short flag without significantly changing parsing!
|
||||
if (!shortFlag && /^-[^-]$/.test(longFlag)) {
|
||||
|
@ -322,5 +327,4 @@ function splitOptionFlags(flags) {
|
|||
}
|
||||
|
||||
exports.Option = Option;
|
||||
exports.splitOptionFlags = splitOptionFlags;
|
||||
exports.DualOptions = DualOptions;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue