Update ava to 4.3.3
The [release notes](https://github.com/avajs/ava/releases/tag/v4.3.3) mention compatibility with Node 18.8.
This commit is contained in:
parent
21530f507f
commit
bea5e4b220
160 changed files with 2647 additions and 2263 deletions
45
node_modules/yargs/build/lib/command.js
generated
vendored
45
node_modules/yargs/build/lib/command.js
generated
vendored
|
|
@ -149,7 +149,7 @@ export class CommandInstance {
|
|||
}
|
||||
parseAndUpdateUsage(isDefaultCommand, commandHandler, innerYargs, parentCommands, commandIndex, helpOnly) {
|
||||
if (isDefaultCommand)
|
||||
innerYargs.getInternalMethods().getUsageInstance().unfreeze();
|
||||
innerYargs.getInternalMethods().getUsageInstance().unfreeze(true);
|
||||
if (this.shouldUpdateUsage(innerYargs)) {
|
||||
innerYargs
|
||||
.getInternalMethods()
|
||||
|
|
@ -183,18 +183,7 @@ export class CommandInstance {
|
|||
pc.push(c);
|
||||
return `$0 ${pc.join(' ')}`;
|
||||
}
|
||||
applyMiddlewareAndGetResult(isDefaultCommand, commandHandler, innerArgv, currentContext, helpOnly, aliases, yargs) {
|
||||
let positionalMap = {};
|
||||
if (helpOnly)
|
||||
return innerArgv;
|
||||
if (!yargs.getInternalMethods().getHasOutput()) {
|
||||
positionalMap = this.populatePositionals(commandHandler, innerArgv, currentContext, yargs);
|
||||
}
|
||||
const middlewares = this.globalMiddleware
|
||||
.getMiddleware()
|
||||
.slice(0)
|
||||
.concat(commandHandler.middlewares);
|
||||
innerArgv = applyMiddleware(innerArgv, yargs, middlewares, true);
|
||||
handleValidationAndGetResult(isDefaultCommand, commandHandler, innerArgv, currentContext, aliases, yargs, middlewares, positionalMap) {
|
||||
if (!yargs.getInternalMethods().getHasOutput()) {
|
||||
const validation = yargs
|
||||
.getInternalMethods()
|
||||
|
|
@ -237,6 +226,22 @@ export class CommandInstance {
|
|||
}
|
||||
return innerArgv;
|
||||
}
|
||||
applyMiddlewareAndGetResult(isDefaultCommand, commandHandler, innerArgv, currentContext, helpOnly, aliases, yargs) {
|
||||
let positionalMap = {};
|
||||
if (helpOnly)
|
||||
return innerArgv;
|
||||
if (!yargs.getInternalMethods().getHasOutput()) {
|
||||
positionalMap = this.populatePositionals(commandHandler, innerArgv, currentContext, yargs);
|
||||
}
|
||||
const middlewares = this.globalMiddleware
|
||||
.getMiddleware()
|
||||
.slice(0)
|
||||
.concat(commandHandler.middlewares);
|
||||
const maybePromiseArgv = applyMiddleware(innerArgv, yargs, middlewares, true);
|
||||
return isPromise(maybePromiseArgv)
|
||||
? maybePromiseArgv.then(resolvedInnerArgv => this.handleValidationAndGetResult(isDefaultCommand, commandHandler, resolvedInnerArgv, currentContext, aliases, yargs, middlewares, positionalMap))
|
||||
: this.handleValidationAndGetResult(isDefaultCommand, commandHandler, maybePromiseArgv, currentContext, aliases, yargs, middlewares, positionalMap);
|
||||
}
|
||||
populatePositionals(commandHandler, argv, context, yargs) {
|
||||
argv._ = argv._.slice(context.commands.length);
|
||||
const demanded = commandHandler.demanded.slice(0);
|
||||
|
|
@ -328,12 +333,12 @@ export class CommandInstance {
|
|||
Object.keys(positionalMap).forEach(key => {
|
||||
positionalKeys.push(...parsed.aliases[key]);
|
||||
});
|
||||
const defaults = yargs.getOptions().default;
|
||||
Object.keys(parsed.argv).forEach(key => {
|
||||
if (positionalKeys.includes(key)) {
|
||||
if (!positionalMap[key])
|
||||
positionalMap[key] = parsed.argv[key];
|
||||
if (!Object.prototype.hasOwnProperty.call(defaults, key) &&
|
||||
if (!this.isInConfigs(yargs, key) &&
|
||||
!this.isDefaulted(yargs, key) &&
|
||||
Object.prototype.hasOwnProperty.call(argv, key) &&
|
||||
Object.prototype.hasOwnProperty.call(parsed.argv, key) &&
|
||||
(Array.isArray(argv[key]) || Array.isArray(parsed.argv[key]))) {
|
||||
|
|
@ -346,6 +351,16 @@ export class CommandInstance {
|
|||
});
|
||||
}
|
||||
}
|
||||
isDefaulted(yargs, key) {
|
||||
const { default: defaults } = yargs.getOptions();
|
||||
return (Object.prototype.hasOwnProperty.call(defaults, key) ||
|
||||
Object.prototype.hasOwnProperty.call(defaults, this.shim.Parser.camelCase(key)));
|
||||
}
|
||||
isInConfigs(yargs, key) {
|
||||
const { configObjects } = yargs.getOptions();
|
||||
return (configObjects.some(c => Object.prototype.hasOwnProperty.call(c, key)) ||
|
||||
configObjects.some(c => Object.prototype.hasOwnProperty.call(c, this.shim.Parser.camelCase(key))));
|
||||
}
|
||||
runDefaultBuilderOn(yargs) {
|
||||
if (!this.defaultCommand)
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue