diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 38b7c6759..5f836193d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [16.x, 18.x, 20.x] + node-version: [18.x, 20.x] os: [ubuntu-latest, windows-latest, macos-latest] steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index c9933eb9d..ab9955aab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,63 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. +## [12.0.0] (2024-02-03) + +### Added + +- `.addHelpOption()` as another way of configuring built-in help option ([#2006]) +- `.helpCommand()` for configuring built-in help command ([#2087]) + +### Fixed + +- *Breaking:* use non-zero exit code when spawned executable subcommand terminates due to a signal ([#2023]) +- *Breaking:* check `passThroughOptions` constraints when using `.addCommand` and throw if parent command does not have `.enablePositionalOptions()` enabled ([#1937]) + +### Changed + +- *Breaking:* Commander 12 requires Node.js v18 or higher ([#2027]) +- *Breaking:* throw an error if add an option with a flag which is already in use ([#2055]) +- *Breaking:* throw an error if add a command with name or alias which is already in use ([#2059]) +- *Breaking:* throw error when calling `.storeOptionsAsProperties()` after setting an option value ([#1928]) +- replace non-standard JSDoc of `@api private` with documented `@private` ([#1949]) +- `.addHelpCommand()` now takes a Command (passing string or boolean still works as before but deprecated) ([#2087]) +- refactor internal implementation of built-in help option ([#2006]) +- refactor internal implementation of built-in help command ([#2087]) + +### Deprecated + +- `.addHelpCommand()` passing string or boolean (use `.helpCommand()` or pass a Command) ([#2087]) + +### Removed + +- *Breaking:* removed default export of a global Command instance from CommonJS (use the named `program` export instead) ([#2017]) + +### Migration Tips + +**global program** + +If you are using the [deprecated](./docs/deprecated.md#default-import-of-global-command-object) default import of the global Command object, you need to switch to using a named import (or create a new `Command`). + +```js +// const program = require('commander'); +const { program } = require('commander'); +``` + +**option and command clashes** + +A couple of configuration problems now throw an error, which will pick up issues in existing programs: + +- adding an option which uses the same flag as a previous option +- adding a command which uses the same name or alias as a previous command + +## [12.0.0-1] (2024-01-20) + +(Released in 12.0.0) + +## [12.0.0-0] (2023-11-11) + +(Released in 12.0.0) + ## [11.1.0] (2023-10-13) ### Fixed @@ -1188,13 +1245,23 @@ program [#1874]: https://github.com/tj/commander.js/pull/1874 [#1886]: https://github.com/tj/commander.js/pull/1886 [#1896]: https://github.com/tj/commander.js/pull/1896 +[#1928]: https://github.com/tj/commander.js/pull/1928 [#1930]: https://github.com/tj/commander.js/pull/1930 +[#1937]: https://github.com/tj/commander.js/pull/1937 +[#1949]: https://github.com/tj/commander.js/pull/1949 [#1965]: https://github.com/tj/commander.js/pull/1965 [#1969]: https://github.com/tj/commander.js/pull/1969 [#1982]: https://github.com/tj/commander.js/pull/1982 [#1983]: https://github.com/tj/commander.js/pull/1983 +[#2006]: https://github.com/tj/commander.js/pull/2006 [#2010]: https://github.com/tj/commander.js/pull/2010 +[#2017]: https://github.com/tj/commander.js/pull/2017 [#2019]: https://github.com/tj/commander.js/pull/2019 +[#2023]: https://github.com/tj/commander.js/pull/2023 +[#2027]: https://github.com/tj/commander.js/pull/2027 +[#2055]: https://github.com/tj/commander.js/pull/2055 +[#2059]: https://github.com/tj/commander.js/pull/2059 +[#2087]: https://github.com/tj/commander.js/pull/2087 [#1]: https://github.com/tj/commander.js/issues/1 @@ -1274,6 +1341,9 @@ program [#1028]: https://github.com/tj/commander.js/pull/1028 [Unreleased]: https://github.com/tj/commander.js/compare/master...develop +[12.0.0]: https://github.com/tj/commander.js/compare/v11.1.0...v12.0.0 +[12.0.0-1]: https://github.com/tj/commander.js/compare/v12.0.0-0...v12.0.0-1 +[12.0.0-0]: https://github.com/tj/commander.js/compare/v11.1.0...v12.0.0-0 [11.1.0]: https://github.com/tj/commander.js/compare/v11.0.0...v11.1.0 [11.0.0]: https://github.com/tj/commander.js/compare/v10.0.1...v11.0.0 [10.0.1]: https://github.com/tj/commander.js/compare/v10.0.0...v10.0.1 diff --git a/Readme.md b/Readme.md index c2619d71c..cdd43ed58 100644 --- a/Readme.md +++ b/Readme.md @@ -37,7 +37,7 @@ Read this in other languages: English | [简体中文](./Readme_zh-CN.md) - [.usage](#usage) - [.description and .summary](#description-and-summary) - [.helpOption(flags, description)](#helpoptionflags-description) - - [.addHelpCommand()](#addhelpcommand) + - [.helpCommand()](#helpcommand) - [More configuration](#more-configuration-2) - [Custom event listeners](#custom-event-listeners) - [Bits and pieces](#bits-and-pieces) @@ -904,16 +904,20 @@ program .helpOption('-e, --HELP', 'read more information'); ``` -### .addHelpCommand() +(Or use `.addHelpOption()` to add an option you construct yourself.) -A help command is added by default if your command has subcommands. You can explicitly turn on or off the implicit help command with `.addHelpCommand()` and `.addHelpCommand(false)`. +### .helpCommand() + +A help command is added by default if your command has subcommands. You can explicitly turn on or off the implicit help command with `.helpCommand(true)` and `.helpCommand(false)`. You can both turn on and customise the help command by supplying the name and description: ```js -program.addHelpCommand('assist [command]', 'show assistance'); +program.helpCommand('assist [command]', 'show assistance'); ``` +(Or use `.addHelpCommand()` to add a command you construct yourself.) + ### More configuration The built-in help is formatted using the Help class. @@ -1139,7 +1143,7 @@ There is more information available about: ## Support -The current version of Commander is fully supported on Long Term Support versions of Node.js, and requires at least v16. +The current version of Commander is fully supported on Long Term Support versions of Node.js, and requires at least v18. (For older versions of Node.js, use an older version of Commander.) The main forum for free and community support is the project [Issues](https://github.com/tj/commander.js/issues) on GitHub. diff --git a/Readme_zh-CN.md b/Readme_zh-CN.md index b6c6ff238..fc3bd0c41 100644 --- a/Readme_zh-CN.md +++ b/Readme_zh-CN.md @@ -1059,7 +1059,7 @@ program ## 支持 -当前版本的 Commander 在 LTS 版本的 Node.js 上完全支持。并且至少需要 v16。 +当前版本的 Commander 在 LTS 版本的 Node.js 上完全支持。并且至少需要 v18。 (使用更低版本 Node.js 的用户建议安装更低版本的 Commander) 社区支持请访问项目的 [Issues](https://github.com/tj/commander.js/issues)。 diff --git a/SECURITY.md b/SECURITY.md index 206825ea1..d0cadc185 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -6,8 +6,8 @@ Old versions receive security updates for six months. | Version | Supported | | ------- | ------------------------------------------ | -| 10.x | :white_check_mark: support ends 2024-01-16 | -| < 10 | :x: | +| 11.x | :white_check_mark: support ends 2024-07-03 | +| < 11 | :x: | Pull Requests for security issues will be considered for older versions back to 2.x. diff --git a/docs/deprecated.md b/docs/deprecated.md index e8913cbfd..7dc5bad23 100644 --- a/docs/deprecated.md +++ b/docs/deprecated.md @@ -4,20 +4,22 @@ These features are deprecated, which means they may go away in a future major ve They are currently still available for backwards compatibility, but should not be used in new code. - [Deprecated](#deprecated) - - [RegExp .option() parameter](#regexp-option-parameter) - - [noHelp](#nohelp) - - [Default import of global Command object](#default-import-of-global-command-object) - - [Callback to .help() and .outputHelp()](#callback-to-help-and-outputhelp) - - [.on('--help')](#on--help) - - [.on('command:\*')](#oncommand) - - [.command('\*')](#command) - - [cmd.description(cmdDescription, argDescriptions)](#cmddescriptioncmddescription-argdescriptions) - - [InvalidOptionArgumentError](#invalidoptionargumenterror) - - [Short option flag longer than a single character](#short-option-flag-longer-than-a-single-character) - - [Import from `commander/esm.mjs`](#import-from-commanderesmmjs) - - [cmd.\_args](#cmd_args) - -## RegExp .option() parameter + - [RegExp .option() parameter](#regexp-option-parameter) + - [noHelp](#nohelp) + - [Callback to .help() and .outputHelp()](#callback-to-help-and-outputhelp) + - [.on('--help')](#on--help) + - [.on('command:\*')](#oncommand) + - [.command('\*')](#command) + - [cmd.description(cmdDescription, argDescriptions)](#cmddescriptioncmddescription-argdescriptions) + - [InvalidOptionArgumentError](#invalidoptionargumenterror) + - [Short option flag longer than a single character](#short-option-flag-longer-than-a-single-character) + - [Import from `commander/esm.mjs`](#import-from-commanderesmmjs) + - [cmd.\_args](#cmd_args) + - [.addHelpCommand(string|boolean|undefined)](#addhelpcommandstringbooleanundefined) + - [Removed](#removed) + - [Default import of global Command object](#default-import-of-global-command-object) + +### RegExp .option() parameter The `.option()` method allowed a RegExp as the third parameter to restrict what values were accepted. @@ -29,7 +31,7 @@ Removed from README in Commander v3. Deprecated from Commander v7. The newer functionality is the Option `.choices()` method, or using a custom option processing function. -## noHelp +### noHelp This was an option passed to `.command()` to hide the command from the built-in help: @@ -39,28 +41,7 @@ program.command('example', 'example command', { noHelp: true }); The option was renamed `hidden` in Commander v5.1. Deprecated from Commander v7. -## Default import of global Command object - -The default import was a global Command object. - -```js -const program = require('commander'); -``` - -The global Command object is exported as `program` from Commander v5, or import the Command object. - -```js -const { program } = require('commander'); -// or -const { Command } = require('commander'); -const program = new Command() -``` - -- Removed from README in Commander v5. -- Deprecated from Commander v7. -- Removed from TypeScript declarations in Commander v8. - -## Callback to .help() and .outputHelp() +### Callback to .help() and .outputHelp() These routines allowed a callback parameter to process the built-in help before display. @@ -78,7 +59,7 @@ console.error(colors.red(program.helpInformation())); Deprecated from Commander v7. -## .on('--help') +### .on('--help') This was the way to add custom help after the built-in help. From Commander v3.0.0 this used the custom long help option flags, if changed. @@ -103,7 +84,7 @@ Examples: Deprecated from Commander v7. -## .on('command:*') +### .on('command:*') This was emitted when the command argument did not match a known subcommand (as part of the implementation of `.command('*')`). @@ -114,7 +95,7 @@ or for custom behaviour catch the `commander.unknownCommand` error. Deprecated from Commander v8.3. -## .command('*') +### .command('*') This was used to add a default command to the program. @@ -134,7 +115,7 @@ program Removed from README in Commander v5. Deprecated from Commander v8.3. -## cmd.description(cmdDescription, argDescriptions) +### cmd.description(cmdDescription, argDescriptions) This was used to add command argument descriptions for the help. @@ -157,7 +138,7 @@ program Deprecated from Commander v8. -## InvalidOptionArgumentError +### InvalidOptionArgumentError This was used for throwing an error from custom option processing, for a nice error message. @@ -187,13 +168,13 @@ function myParseInt(value, dummyPrevious) { Deprecated from Commander v8. -## Short option flag longer than a single character +### Short option flag longer than a single character Short option flags like `-ws` were never supported, but the old README did not make this clear. The README now states that short options are a single character. README updated in Commander v3. Deprecated from Commander v9. -## Import from `commander/esm.mjs` +### Import from `commander/esm.mjs` The first support for named imports required an explicit entry file. @@ -209,7 +190,7 @@ import { Command } from 'commander'; README updated in Commander v9. Deprecated from Commander v9. -## cmd._args +### cmd._args This was always private, but was previously the only way to access the command `Argument` array. @@ -224,3 +205,48 @@ const registeredArguments = program.registeredArguments; ``` Deprecated from Commander v11. + +### .addHelpCommand(string|boolean|undefined) + +This was originally used with a variety of parameters, but not by passing a Command object despite the "add" name. + +```js +program.addHelpCommand('assist [command]'); +program.addHelpCommand('assist', 'show assistance'); +program.addHelpCommand(false); + +``` + +In new code you configure the help command with `.helpCommand()`. Or use `.addHelpCommand()` which now takes a Command object, like `.addCommand()`. + +```js +program.helpCommand('assist [command]'); +program.helpCommand('assist', 'show assistance'); +program.helpCommand(false); + +program.addHelpCommand(new Command('assist').argument('[command]').description('show assistance')); + +``` +## Removed + +### Default import of global Command object + +The default import was a global Command object. + +```js +const program = require('commander'); +``` + +The global Command object is exported as `program` from Commander v5, or import the Command object. + +```js +const { program } = require('commander'); +// or +const { Command } = require('commander'); +const program = new Command() +``` + +- Removed from README in Commander v5. +- Deprecated from Commander v7. +- Removed from TypeScript declarations in Commander v8. +- Removed from CommonJS in Commander v12. Deprecated and gone! diff --git a/index.js b/index.js index d2f4a8528..c30bb21a6 100644 --- a/index.js +++ b/index.js @@ -4,13 +4,11 @@ const { CommanderError, InvalidArgumentError } = require('./lib/error.js'); const { Help } = require('./lib/help.js'); const { Option } = require('./lib/option.js'); -/** - * Expose the root command. - */ +exports.program = new Command(); -exports = module.exports = new Command(); -exports.program = exports; // More explicit access to global command. -// createArgument, createCommand, and createOption are implicitly available as they are methods on program. +exports.createCommand = (name) => new Command(name); +exports.createOption = (flags, description) => new Option(flags, description); +exports.createArgument = (name, description) => new Argument(name, description); /** * Expose classes diff --git a/lib/argument.js b/lib/argument.js index f2835726d..388620711 100644 --- a/lib/argument.js +++ b/lib/argument.js @@ -50,7 +50,7 @@ class Argument { } /** - * @api private + * @package internal use only */ _concatValue(value, previous) { @@ -130,7 +130,7 @@ class Argument { * * @param {Argument} arg * @return {string} - * @api private + * @private */ function humanReadableArgName(arg) { diff --git a/lib/command.js b/lib/command.js index 21e90e40b..5b16e6031 100644 --- a/lib/command.js +++ b/lib/command.js @@ -7,7 +7,7 @@ const process = require('process'); const { Argument, humanReadableArgName } = require('./argument.js'); const { CommanderError } = require('./error.js'); const { Help } = require('./help.js'); -const { Option, splitOptionFlags, DualOptions } = require('./option.js'); +const { Option, DualOptions } = require('./option.js'); const { suggestSimilar } = require('./suggestSimilar'); class Command extends EventEmitter { @@ -52,7 +52,7 @@ class Command extends EventEmitter { this._enablePositionalOptions = false; this._passThroughOptions = false; this._lifeCycleHooks = {}; // a hash of arrays - /** @type {boolean | string} */ + /** @type {(boolean | string)} */ this._showHelpAfterError = false; this._showSuggestionAfterError = true; @@ -66,15 +66,11 @@ class Command extends EventEmitter { }; this._hidden = false; - this._hasHelpOption = true; - this._helpFlags = '-h, --help'; - this._helpDescription = 'display help for command'; - this._helpShortFlag = '-h'; - this._helpLongFlag = '--help'; - this._addImplicitHelpCommand = undefined; // Deliberately undefined, not decided whether true or false - this._helpCommandName = 'help'; - this._helpCommandnameAndArgs = 'help [command]'; - this._helpCommandDescription = 'display help for command'; + /** @type {(Option | null | undefined)} */ + this._helpOption = undefined; // Lazy created on demand. May be null if help option is disabled. + this._addImplicitHelpCommand = undefined; // undecided whether true or false yet, not inherited + /** @type {Command} */ + this._helpCommand = undefined; // lazy initialised, inherited this._helpConfiguration = {}; } @@ -88,14 +84,8 @@ class Command extends EventEmitter { */ copyInheritedSettings(sourceCommand) { this._outputConfiguration = sourceCommand._outputConfiguration; - this._hasHelpOption = sourceCommand._hasHelpOption; - this._helpFlags = sourceCommand._helpFlags; - this._helpDescription = sourceCommand._helpDescription; - this._helpShortFlag = sourceCommand._helpShortFlag; - this._helpLongFlag = sourceCommand._helpLongFlag; - this._helpCommandName = sourceCommand._helpCommandName; - this._helpCommandnameAndArgs = sourceCommand._helpCommandnameAndArgs; - this._helpCommandDescription = sourceCommand._helpCommandDescription; + this._helpOption = sourceCommand._helpOption; + this._helpCommand = sourceCommand._helpCommand; this._helpConfiguration = sourceCommand._helpConfiguration; this._exitCallback = sourceCommand._exitCallback; this._storeOptionsAsProperties = sourceCommand._storeOptionsAsProperties; @@ -110,7 +100,7 @@ class Command extends EventEmitter { /** * @returns {Command[]} - * @api private + * @private */ _getCommandAndAncestors() { @@ -141,7 +131,7 @@ class Command extends EventEmitter { * .command('stop [service]', 'stop named service, or all if no name supplied'); * * @param {string} nameAndArgs - command name and arguments, args are `` or `[optional]` and last may also be `variadic...` - * @param {Object|string} [actionOptsOrExecDesc] - configuration options (for action), or description (for executable) + * @param {(Object|string)} [actionOptsOrExecDesc] - configuration options (for action), or description (for executable) * @param {Object} [execOpts] - configuration options (for executable) * @return {Command} returns new command for action handler, or `this` for executable command */ @@ -165,7 +155,7 @@ class Command extends EventEmitter { cmd._hidden = !!(opts.noHelp || opts.hidden); // noHelp is deprecated old name for hidden cmd._executableFile = opts.executableFile || null; // Custom name for executable file, set missing to null to match constructor if (args) cmd.arguments(args); - this.commands.push(cmd); + this._registerCommand(cmd); cmd.parent = this; cmd.copyInheritedSettings(this); @@ -203,7 +193,7 @@ class Command extends EventEmitter { * or with a subclass of Help by overriding createHelp(). * * @param {Object} [configuration] - configuration options - * @return {Command|Object} `this` command for chaining, or stored configuration + * @return {(Command|Object)} `this` command for chaining, or stored configuration */ configureHelp(configuration) { @@ -229,7 +219,7 @@ class Command extends EventEmitter { * outputError(str, write) // used for displaying errors, and not used for displaying help * * @param {Object} [configuration] - configuration options - * @return {Command|Object} `this` command for chaining, or stored configuration + * @return {(Command|Object)} `this` command for chaining, or stored configuration */ configureOutput(configuration) { @@ -242,7 +232,7 @@ class Command extends EventEmitter { /** * Display the help or a custom message after an error occurs. * - * @param {boolean|string} [displayHelp] + * @param {(boolean|string)} [displayHelp] * @return {Command} `this` command for chaining */ showHelpAfterError(displayHelp = true) { @@ -282,8 +272,10 @@ class Command extends EventEmitter { if (opts.isDefault) this._defaultCommandName = cmd._name; if (opts.noHelp || opts.hidden) cmd._hidden = true; // modifying passed command due to existing implementation - this.commands.push(cmd); + this._registerCommand(cmd); cmd.parent = this; + cmd._checkForBrokenPassThrough(); + return this; } @@ -314,7 +306,7 @@ class Command extends EventEmitter { * * @param {string} name * @param {string} [description] - * @param {Function|*} [fn] - custom argument processing function + * @param {(Function|*)} [fn] - custom argument processing function * @param {*} [defaultValue] * @return {Command} `this` command for chaining */ @@ -367,39 +359,76 @@ class Command extends EventEmitter { } /** - * Override default decision whether to add implicit help command. + * Customise or override default help command. By default a help command is automatically added if your command has subcommands. * - * addHelpCommand() // force on - * addHelpCommand(false); // force off - * addHelpCommand('help [cmd]', 'display help for [cmd]'); // force on with custom details + * program.helpCommand('help [cmd]'); + * program.helpCommand('help [cmd]', 'show help'); + * program.helpCommand(false); // suppress default help command + * program.helpCommand(true); // add help command even if no subcommands * + * @param {string|boolean} enableOrNameAndArgs - enable with custom name and/or arguments, or boolean to override whether added + * @param {string} [description] - custom description * @return {Command} `this` command for chaining */ - addHelpCommand(enableOrNameAndArgs, description) { - if (enableOrNameAndArgs === false) { - this._addImplicitHelpCommand = false; - } else { - this._addImplicitHelpCommand = true; - if (typeof enableOrNameAndArgs === 'string') { - this._helpCommandName = enableOrNameAndArgs.split(' ')[0]; - this._helpCommandnameAndArgs = enableOrNameAndArgs; - } - this._helpCommandDescription = description || this._helpCommandDescription; + helpCommand(enableOrNameAndArgs, description) { + if (typeof enableOrNameAndArgs === 'boolean') { + this._addImplicitHelpCommand = enableOrNameAndArgs; + return this; } + + enableOrNameAndArgs = enableOrNameAndArgs ?? 'help [command]'; + const [, helpName, helpArgs] = enableOrNameAndArgs.match(/([^ ]+) *(.*)/); + const helpDescription = description ?? 'display help for command'; + + const helpCommand = this.createCommand(helpName); + helpCommand.helpOption(false); + if (helpArgs) helpCommand.arguments(helpArgs); + if (helpDescription) helpCommand.description(helpDescription); + + this._addImplicitHelpCommand = true; + this._helpCommand = helpCommand; + return this; } /** - * @return {boolean} - * @api private + * Add prepared custom help command. + * + * @param {(Command|string|boolean)} helpCommand - custom help command, or deprecated enableOrNameAndArgs as for `.helpCommand()` + * @param {string} [deprecatedDescription] - deprecated custom description used with custom name only + * @return {Command} `this` command for chaining + */ + addHelpCommand(helpCommand, deprecatedDescription) { + // If not passed an object, call through to helpCommand for backwards compatibility, + // as addHelpCommand was originally used like helpCommand is now. + if (typeof helpCommand !== 'object') { + this.helpCommand(helpCommand, deprecatedDescription); + return this; + } + + this._addImplicitHelpCommand = true; + this._helpCommand = helpCommand; + return this; + } + + /** + * Lazy create help command. + * + * @return {(Command|null)} + * @package */ + _getHelpCommand() { + const hasImplicitHelpCommand = this._addImplicitHelpCommand ?? + (this.commands.length && !this._actionHandler && !this._findCommand('help')); - _hasImplicitHelpCommand() { - if (this._addImplicitHelpCommand === undefined) { - return this.commands.length && !this._actionHandler && !this._findCommand('help'); + if (hasImplicitHelpCommand) { + if (this._helpCommand === undefined) { + this.helpCommand(undefined, undefined); // use default name and description + } + return this._helpCommand; } - return this._addImplicitHelpCommand; + return null; } /** @@ -453,7 +482,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * @param {string} code an id string representing the error * @param {string} message human-readable description of the error * @return never - * @api private + * @private */ _exit(exitCode, code, message) { @@ -515,11 +544,11 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Wrap parseArgs to catch 'commander.invalidArgument'. * - * @param {Option | Argument} target + * @param {(Option | Argument)} target * @param {string} value * @param {*} previous * @param {string} invalidArgumentMessage - * @api private + * @private */ _callParseArg(target, value, previous, invalidArgumentMessage) { @@ -534,6 +563,49 @@ Expecting one of '${allowedValues.join("', '")}'`); } } + /** + * Check for option flag conflicts. + * Register option if no conflicts found, or throw on conflict. + * + * @param {Option} option + * @api private + */ + + _registerOption(option) { + const matchingOption = (option.short && this._findOption(option.short)) || + (option.long && this._findOption(option.long)); + if (matchingOption) { + const matchingFlag = (option.long && this._findOption(option.long)) ? option.long : option.short; + throw new Error(`Cannot add option '${option.flags}'${this._name && ` to command '${this._name}'`} due to conflicting flag '${matchingFlag}' +- already used by option '${matchingOption.flags}'`); + } + + this.options.push(option); + } + + /** + * Check for command name and alias conflicts with existing commands. + * Register command if no conflicts found, or throw on conflict. + * + * @param {Command} command + * @api private + */ + + _registerCommand(command) { + const knownBy = (cmd) => { + return [cmd.name()].concat(cmd.aliases()); + }; + + const alreadyUsed = knownBy(command).find((name) => this._findCommand(name)); + if (alreadyUsed) { + const existingCmd = knownBy(this._findCommand(alreadyUsed)).join('|'); + const newCmd = knownBy(command).join('|'); + throw new Error(`cannot add command '${newCmd}' as already have command '${existingCmd}'`); + } + + this.commands.push(command); + } + /** * Add an option. * @@ -541,6 +613,8 @@ Expecting one of '${allowedValues.join("', '")}'`); * @return {Command} `this` command for chaining */ addOption(option) { + this._registerOption(option); + const oname = option.name(); const name = option.attributeName(); @@ -555,9 +629,6 @@ Expecting one of '${allowedValues.join("', '")}'`); this.setOptionValueWithSource(name, option.defaultValue, 'default'); } - // register the option - this.options.push(option); - // handler for cli and env supplied values const handleOptionValue = (val, invalidValueMessage, valueSource) => { // val is null for optional option used without an optional-argument. @@ -605,7 +676,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Internal implementation shared by .option() and .requiredOption() * - * @api private + * @private */ _optionEx(config, flags, description, fn, defaultValue) { if (typeof flags === 'object' && flags instanceof Option) { @@ -647,7 +718,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * * @param {string} flags * @param {string} [description] - * @param {Function|*} [parseArg] - custom option processing function or default value + * @param {(Function|*)} [parseArg] - custom option processing function or default value * @param {*} [defaultValue] * @return {Command} `this` command for chaining */ @@ -664,7 +735,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * * @param {string} flags * @param {string} [description] - * @param {Function|*} [parseArg] - custom option processing function or default value + * @param {(Function|*)} [parseArg] - custom option processing function or default value * @param {*} [defaultValue] * @return {Command} `this` command for chaining */ @@ -681,7 +752,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * program.combineFlagAndOptionalValue(true); // `-f80` is treated like `--flag=80`, this is the default behaviour * program.combineFlagAndOptionalValue(false) // `-fb` is treated like `-f -b` * - * @param {Boolean} [combine=true] - if `true` or omitted, an optional value can be specified directly after the flag. + * @param {boolean} [combine=true] - if `true` or omitted, an optional value can be specified directly after the flag. */ combineFlagAndOptionalValue(combine = true) { this._combineFlagAndOptionalValue = !!combine; @@ -691,7 +762,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Allow unknown options on the command line. * - * @param {Boolean} [allowUnknown=true] - if `true` or omitted, no error will be thrown + * @param {boolean} [allowUnknown=true] - if `true` or omitted, no error will be thrown * for unknown options. */ allowUnknownOption(allowUnknown = true) { @@ -702,7 +773,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Allow excess command-arguments on the command line. Pass false to make excess arguments an error. * - * @param {Boolean} [allowExcess=true] - if `true` or omitted, no error will be thrown + * @param {boolean} [allowExcess=true] - if `true` or omitted, no error will be thrown * for excess arguments. */ allowExcessArguments(allowExcess = true) { @@ -715,7 +786,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * subcommands reuse the same option names, and also enables subcommands to turn on passThroughOptions. * The default behaviour is non-positional and global options may appear anywhere on the command line. * - * @param {Boolean} [positional=true] + * @param {boolean} [positional=true] */ enablePositionalOptions(positional = true) { this._enablePositionalOptions = !!positional; @@ -728,17 +799,25 @@ Expecting one of '${allowedValues.join("', '")}'`); * positional options to have been enabled on the program (parent commands). * The default behaviour is non-positional and options may appear before or after command-arguments. * - * @param {Boolean} [passThrough=true] + * @param {boolean} [passThrough=true] * for unknown options. */ passThroughOptions(passThrough = true) { this._passThroughOptions = !!passThrough; - if (!!this.parent && passThrough && !this.parent._enablePositionalOptions) { - throw new Error('passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)'); - } + this._checkForBrokenPassThrough(); return this; } + /** + * @private + */ + + _checkForBrokenPassThrough() { + if (this.parent && this._passThroughOptions && !this.parent._enablePositionalOptions) { + throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`); + } + } + /** * Whether to store option values as properties on command object, * or store separately (specify false). In both cases the option values can be accessed using .opts(). @@ -751,9 +830,9 @@ Expecting one of '${allowedValues.join("', '")}'`); if (this.options.length) { throw new Error('call .storeOptionsAsProperties() before adding options'); } - // if (Object.keys(this._optionValues).length) { - // throw new Error('call .storeOptionsAsProperties() before setting option values'); - // } + if (Object.keys(this._optionValues).length) { + throw new Error('call .storeOptionsAsProperties() before setting option values'); + } this._storeOptionsAsProperties = !!storeAsProperties; return this; } @@ -838,7 +917,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Get user arguments from implied or explicit arguments. * Side-effects: set _scriptPath if args included script. Used for default program name, and subcommand searches. * - * @api private + * @private */ _prepareUserArgs(argv, parseOptions) { @@ -941,7 +1020,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Execute a sub-command executable. * - * @api private + * @private */ _executeSubCommand(subcommand, args) { @@ -1028,15 +1107,15 @@ Expecting one of '${allowedValues.join("', '")}'`); } // By default terminate process when spawned process terminates. - // Suppressing the exit if exitCallback defined is a bit messy and of limited use, but does allow process to stay running! const exitCallback = this._exitCallback; - if (!exitCallback) { - proc.on('close', process.exit.bind(process)); - } else { - proc.on('close', () => { - exitCallback(new CommanderError(process.exitCode || 0, 'commander.executeSubCommandAsync', '(close)')); - }); - } + proc.on('close', (code, _signal) => { + code = code ?? 1; // code is null if spawned process terminated due to a signal + if (!exitCallback) { + process.exit(code); + } else { + exitCallback(new CommanderError(code, 'commander.executeSubCommandAsync', '(close)')); + } + }); proc.on('error', (err) => { // @ts-ignore if (err.code === 'ENOENT') { @@ -1066,7 +1145,7 @@ Expecting one of '${allowedValues.join("', '")}'`); } /** - * @api private + * @private */ _dispatchSubcommand(commandName, operands, unknown) { @@ -1089,7 +1168,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Invoke help directly if possible, or dispatch if necessary. * e.g. help foo * - * @api private + * @private */ _dispatchHelpCommand(subcommandName) { @@ -1103,14 +1182,14 @@ Expecting one of '${allowedValues.join("', '")}'`); // Fallback to parsing the help flag to invoke the help. return this._dispatchSubcommand(subcommandName, [], [ - this._helpLongFlag || this._helpShortFlag + this._getHelpOption()?.long ?? this._getHelpOption()?.short ?? '--help' ]); } /** * Check this.args against expected this.registeredArguments. * - * @api private + * @private */ _checkNumberOfArguments() { @@ -1132,7 +1211,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Process this.args using this.registeredArguments and save as this.processedArgs! * - * @api private + * @private */ _processArguments() { @@ -1177,10 +1256,10 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Once we have a promise we chain, but call synchronously until then. * - * @param {Promise|undefined} promise + * @param {(Promise|undefined)} promise * @param {Function} fn - * @return {Promise|undefined} - * @api private + * @return {(Promise|undefined)} + * @private */ _chainOrCall(promise, fn) { @@ -1195,10 +1274,10 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * - * @param {Promise|undefined} promise + * @param {(Promise|undefined)} promise * @param {string} event - * @return {Promise|undefined} - * @api private + * @return {(Promise|undefined)} + * @private */ _chainOrCallHooks(promise, event) { @@ -1226,11 +1305,11 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * - * @param {Promise|undefined} promise + * @param {(Promise|undefined)} promise * @param {Command} subCommand * @param {string} event - * @return {Promise|undefined} - * @api private + * @return {(Promise|undefined)} + * @private */ _chainOrCallSubCommandHook(promise, subCommand, event) { @@ -1249,7 +1328,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Process arguments in context of this command. * Returns action result, in case it is a promise. * - * @api private + * @private */ _parseCommand(operands, unknown) { @@ -1263,11 +1342,11 @@ Expecting one of '${allowedValues.join("', '")}'`); if (operands && this._findCommand(operands[0])) { return this._dispatchSubcommand(operands[0], operands.slice(1), unknown); } - if (this._hasImplicitHelpCommand() && operands[0] === this._helpCommandName) { + if (this._getHelpCommand() && operands[0] === this._getHelpCommand().name()) { return this._dispatchHelpCommand(operands[1]); } if (this._defaultCommandName) { - outputHelpIfRequested(this, unknown); // Run the help for default command from parent rather than passing to default command + this._outputHelpIfRequested(unknown); // Run the help for default command from parent rather than passing to default command return this._dispatchSubcommand(this._defaultCommandName, operands, unknown); } if (this.commands.length && this.args.length === 0 && !this._actionHandler && !this._defaultCommandName) { @@ -1275,7 +1354,7 @@ Expecting one of '${allowedValues.join("', '")}'`); this.help({ error: true }); } - outputHelpIfRequested(this, parsed.unknown); + this._outputHelpIfRequested(parsed.unknown); this._checkForMissingMandatoryOptions(); this._checkForConflictingOptions(); @@ -1333,7 +1412,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Find matching command. * - * @api private + * @private */ _findCommand(name) { if (!name) return undefined; @@ -1345,7 +1424,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * * @param {string} arg * @return {Option} - * @api private + * @package internal use only */ _findOption(arg) { @@ -1356,7 +1435,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Display an error message if a mandatory option does not have a value. * Called after checking for help flags in leaf subcommand. * - * @api private + * @private */ _checkForMissingMandatoryOptions() { @@ -1373,7 +1452,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Display an error message if conflicting options are used together in this. * - * @api private + * @private */ _checkForConflictingLocalOptions() { const definedNonDefaultOptions = this.options.filter( @@ -1404,7 +1483,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Display an error message if conflicting options are used together. * Called after checking for help flags in leaf subcommand. * - * @api private + * @private */ _checkForConflictingOptions() { // Walk up hierarchy so can call in subcommand after checking for displaying help. @@ -1425,8 +1504,8 @@ Expecting one of '${allowedValues.join("', '")}'`); * sub --unknown uuu op => [sub], [--unknown uuu op] * sub -- --unknown uuu op => [sub --unknown uuu op], [] * - * @param {String[]} argv - * @return {{operands: String[], unknown: String[]}} + * @param {string[]} argv + * @return {{operands: string[], unknown: string[]}} */ parseOptions(argv) { @@ -1520,7 +1599,7 @@ Expecting one of '${allowedValues.join("', '")}'`); operands.push(arg); if (args.length > 0) unknown.push(...args); break; - } else if (arg === this._helpCommandName && this._hasImplicitHelpCommand()) { + } else if (this._getHelpCommand() && arg === this._getHelpCommand().name()) { operands.push(arg); if (args.length > 0) operands.push(...args); break; @@ -1608,7 +1687,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Apply any option related environment variables, if option does * not have a value from cli or client code. * - * @api private + * @private */ _parseOptionsEnv() { this.options.forEach((option) => { @@ -1631,7 +1710,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Apply any implied option values, if option is undefined or default value. * - * @api private + * @private */ _parseOptionsImplied() { const dualHelper = new DualOptions(this.options); @@ -1655,7 +1734,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Argument `name` is missing. * * @param {string} name - * @api private + * @private */ missingArgument(name) { @@ -1667,7 +1746,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * `Option` is missing an argument. * * @param {Option} option - * @api private + * @private */ optionMissingArgument(option) { @@ -1679,7 +1758,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * `Option` does not have a value, and is a mandatory option. * * @param {Option} option - * @api private + * @private */ missingMandatoryOptionValue(option) { @@ -1692,7 +1771,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * * @param {Option} option * @param {Option} conflictingOption - * @api private + * @private */ _conflictingOption(option, conflictingOption) { // The calling code does not know whether a negated option is the source of the @@ -1729,7 +1808,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Unknown option `flag`. * * @param {string} flag - * @api private + * @private */ unknownOption(flag) { @@ -1758,7 +1837,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Excess arguments, more than expected. * * @param {string[]} receivedArgs - * @api private + * @private */ _excessArguments(receivedArgs) { @@ -1774,7 +1853,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Unknown command. * - * @api private + * @private */ unknownCommand() { @@ -1805,7 +1884,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * @param {string} [str] * @param {string} [flags] * @param {string} [description] - * @return {this | string | undefined} `this` command for chaining, or version string if no arguments + * @return {(this | string | undefined)} `this` command for chaining, or version string if no arguments */ version(str, flags, description) { @@ -1814,8 +1893,9 @@ Expecting one of '${allowedValues.join("', '")}'`); flags = flags || '-V, --version'; description = description || 'output the version number'; const versionOption = this.createOption(flags, description); - this._versionOptionName = versionOption.attributeName(); // [sic] not defined in constructor, partly legacy, partly only needed at root - this.options.push(versionOption); + this._versionOptionName = versionOption.attributeName(); + this._registerOption(versionOption); + this.on('option:' + versionOption.name(), () => { this._outputConfiguration.writeOut(`${str}\n`); this._exit(0, 'commander.version', str); @@ -1828,7 +1908,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * * @param {string} [str] * @param {Object} [argsDescription] - * @return {string|Command} + * @return {(string|Command)} */ description(str, argsDescription) { if (str === undefined && argsDescription === undefined) return this._description; @@ -1843,7 +1923,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Set the summary. Used when listed as subcommand of parent. * * @param {string} [str] - * @return {string|Command} + * @return {(string|Command)} */ summary(str) { if (str === undefined) return this._summary; @@ -1857,7 +1937,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * You may call more than once to add multiple aliases. Only the first alias is shown in the auto-generated help. * * @param {string} [alias] - * @return {string|Command} + * @return {(string|Command)} */ alias(alias) { @@ -1871,6 +1951,12 @@ Expecting one of '${allowedValues.join("', '")}'`); } if (alias === command._name) throw new Error('Command alias can\'t be the same as its name'); + const matchingCommand = this.parent?._findCommand(alias); + if (matchingCommand) { + // c.f. _registerCommand + const existingCmd = [matchingCommand.name()].concat(matchingCommand.aliases()).join('|'); + throw new Error(`cannot add alias '${alias}' to command '${this.name()}' as already have command '${existingCmd}'`); + } command._aliases.push(alias); return this; @@ -1882,7 +1968,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Only the first alias is shown in the auto-generated help. * * @param {string[]} [aliases] - * @return {string[]|Command} + * @return {(string[]|Command)} */ aliases(aliases) { @@ -1897,7 +1983,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Set / get the command usage `str`. * * @param {string} [str] - * @return {String|Command} + * @return {(string|Command)} */ usage(str) { @@ -1908,7 +1994,7 @@ Expecting one of '${allowedValues.join("', '")}'`); return humanReadableArgName(arg); }); return [].concat( - (this.options.length || this._hasHelpOption ? '[options]' : []), + (this.options.length || (this._helpOption !== null) ? '[options]' : []), (this.commands.length ? '[command]' : []), (this.registeredArguments.length ? args : []) ).join(' '); @@ -1922,7 +2008,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Get or set the name of the command. * * @param {string} [str] - * @return {string|Command} + * @return {(string|Command)} */ name(str) { @@ -1959,7 +2045,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * program.executableDir('subcommands'); * * @param {string} [path] - * @return {string|null|Command} + * @return {(string|null|Command)} */ executableDir(path) { @@ -1984,7 +2070,7 @@ Expecting one of '${allowedValues.join("', '")}'`); } /** - * @api private + * @private */ _getHelpContext(contextOptions) { @@ -2029,38 +2115,72 @@ Expecting one of '${allowedValues.join("', '")}'`); } context.write(helpInformation); - if (this._helpLongFlag) { - this.emit(this._helpLongFlag); // deprecated + if (this._getHelpOption()?.long) { + this.emit(this._getHelpOption().long); // deprecated } this.emit('afterHelp', context); this._getCommandAndAncestors().forEach(command => command.emit('afterAllHelp', context)); } /** - * You can pass in flags and a description to override the help - * flags and help description for your command. Pass in false to - * disable the built-in help option. + * You can pass in flags and a description to customise the built-in help option. + * Pass in false to disable the built-in help option. + * + * @example + * program.helpOption('-?, --help' 'show help'); // customise + * program.helpOption(false); // disable * - * @param {string | boolean} [flags] + * @param {(string | boolean)} flags * @param {string} [description] * @return {Command} `this` command for chaining */ helpOption(flags, description) { + // Support disabling built-in help option. if (typeof flags === 'boolean') { - this._hasHelpOption = flags; + if (flags) { + this._helpOption = this._helpOption ?? undefined; // preserve existing option + } else { + this._helpOption = null; // disable + } return this; } - this._helpFlags = flags || this._helpFlags; - this._helpDescription = description || this._helpDescription; - const helpFlags = splitOptionFlags(this._helpFlags); - this._helpShortFlag = helpFlags.shortFlag; - this._helpLongFlag = helpFlags.longFlag; + // Customise flags and description. + flags = flags ?? '-h, --help'; + description = description ?? 'display help for command'; + this._helpOption = this.createOption(flags, description); return this; } + /** + * Lazy create help option. + * Returns null if has been disabled with .helpOption(false). + * + * @returns {(Option | null)} the help option + * @package internal use only + */ + _getHelpOption() { + // Lazy create help option on demand. + if (this._helpOption === undefined) { + this.helpOption(undefined, undefined); + } + return this._helpOption; + } + + /** + * Supply your own option to use for the built-in help option. + * This is an alternative to using helpOption() to customise the flags and description etc. + * + * @param {Option} option + * @return {Command} `this` command for chaining + */ + addHelpOption(option) { + this._helpOption = option; + return this; + } + /** * Output help information and exit. * @@ -2086,7 +2206,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * and 'beforeAll' or 'afterAll' to affect this command and all its subcommands. * * @param {string} position - before or after built-in help - * @param {string | Function} text - string to add, or a function returning a string + * @param {(string | Function)} text - string to add, or a function returning a string * @return {Command} `this` command for chaining */ addHelpText(position, text) { @@ -2110,22 +2230,22 @@ Expecting one of '${allowedValues.join("', '")}'`); }); return this; } -} -/** - * Output help information if help flags specified - * - * @param {Command} cmd - command to output help for - * @param {Array} args - array of options to search for help flags - * @api private - */ + /** + * Output help information if help flags specified + * + * @param {Array} args - array of options to search for help flags + * @private + */ -function outputHelpIfRequested(cmd, args) { - const helpOption = cmd._hasHelpOption && args.find(arg => arg === cmd._helpLongFlag || arg === cmd._helpShortFlag); - if (helpOption) { - cmd.outputHelp(); - // (Do not have all displayed text available so only passing placeholder.) - cmd._exit(0, 'commander.helpDisplayed', '(outputHelp)'); + _outputHelpIfRequested(args) { + const helpOption = this._getHelpOption(); + const helpRequested = helpOption && args.find(arg => helpOption.is(arg)); + if (helpRequested) { + this.outputHelp(); + // (Do not have all displayed text available so only passing placeholder.) + this._exit(0, 'commander.helpDisplayed', '(outputHelp)'); + } } } @@ -2134,7 +2254,7 @@ function outputHelpIfRequested(cmd, args) { * * @param {string[]} args - array of arguments from node.execArgv * @returns {string[]} - * @api private + * @private */ function incrementNodeInspectorPort(args) { diff --git a/lib/help.js b/lib/help.js index e2441ed87..64e358a0b 100644 --- a/lib/help.js +++ b/lib/help.js @@ -26,13 +26,8 @@ class Help { visibleCommands(cmd) { const visibleCommands = cmd.commands.filter(cmd => !cmd._hidden); - if (cmd._hasImplicitHelpCommand()) { - // Create a command matching the implicit help command. - const [, helpName, helpArgs] = cmd._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/); - const helpCommand = cmd.createCommand(helpName) - .helpOption(false); - helpCommand.description(cmd._helpCommandDescription); - if (helpArgs) helpCommand.arguments(helpArgs); + const helpCommand = cmd._getHelpCommand(); + if (helpCommand && !helpCommand._hidden) { visibleCommands.push(helpCommand); } if (this.sortSubcommands) { @@ -68,19 +63,19 @@ class Help { visibleOptions(cmd) { const visibleOptions = cmd.options.filter((option) => !option.hidden); - // Implicit help - const showShortHelpFlag = cmd._hasHelpOption && cmd._helpShortFlag && !cmd._findOption(cmd._helpShortFlag); - const showLongHelpFlag = cmd._hasHelpOption && !cmd._findOption(cmd._helpLongFlag); - if (showShortHelpFlag || showLongHelpFlag) { - let helpOption; - if (!showShortHelpFlag) { - helpOption = cmd.createOption(cmd._helpLongFlag, cmd._helpDescription); - } else if (!showLongHelpFlag) { - helpOption = cmd.createOption(cmd._helpShortFlag, cmd._helpDescription); - } else { - helpOption = cmd.createOption(cmd._helpFlags, cmd._helpDescription); + // Built-in help option. + const helpOption = cmd._getHelpOption(); + if (helpOption && !helpOption.hidden) { + // Automatically hide conflicting flags. Bit dubious but a historical behaviour that is convenient for single-command programs. + const removeShort = helpOption.short && cmd._findOption(helpOption.short); + const removeLong = helpOption.long && cmd._findOption(helpOption.long); + if (!removeShort && !removeLong) { + visibleOptions.push(helpOption); // no changes needed + } else if (helpOption.long && !removeLong) { + visibleOptions.push(cmd.createOption(helpOption.long, helpOption.description)); + } else if (helpOption.short && !removeShort) { + visibleOptions.push(cmd.createOption(helpOption.short, helpOption.description)); } - visibleOptions.push(helpOption); } if (this.sortOptions) { visibleOptions.sort(this.compareOptions); diff --git a/lib/option.js b/lib/option.js index 048b2fc21..4e047041e 100644 --- a/lib/option.js +++ b/lib/option.js @@ -74,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} */ @@ -158,7 +158,7 @@ class Option { } /** - * @api private + * @package internal use only */ _concatValue(value, previous) { @@ -208,7 +208,6 @@ class Option { * as a object attribute key. * * @return {string} - * @api private */ attributeName() { @@ -220,7 +219,7 @@ class Option { * * @param {string} arg * @return {boolean} - * @api private + * @package internal use only */ is(arg) { @@ -233,7 +232,7 @@ class Option { * Options are one of boolean, negated, required argument, or optional argument. * * @return {boolean} - * @api private + * @package internal use only */ isBoolean() { @@ -293,7 +292,7 @@ class DualOptions { * * @param {string} str * @return {string} - * @api private + * @private */ function camelcase(str) { @@ -305,7 +304,7 @@ function camelcase(str) { /** * Split the short and long flag out of something like '-m,--mixed ' * - * @api private + * @private */ function splitOptionFlags(flags) { @@ -325,5 +324,4 @@ function splitOptionFlags(flags) { } exports.Option = Option; -exports.splitOptionFlags = splitOptionFlags; exports.DualOptions = DualOptions; diff --git a/package-lock.json b/package-lock.json index beecce48e..cebb7b769 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "commander", - "version": "11.1.0", + "version": "12.0.0-1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "commander", - "version": "11.1.0", + "version": "12.0.0-1", "license": "MIT", "devDependencies": { "@types/jest": "^29.2.4", @@ -22,11 +22,11 @@ "eslint-plugin-promise": "^6.1.1", "jest": "^29.3.1", "ts-jest": "^29.0.3", - "tsd": "^0.29.0", + "tsd": "^0.30.4", "typescript": "^5.0.4" }, "engines": { - "node": ">=16" + "node": ">=18" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -52,12 +52,12 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.22.13", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz", - "integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==", + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz", + "integrity": "sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==", "dev": true, "dependencies": { - "@babel/highlight": "^7.22.13", + "@babel/highlight": "^7.23.4", "chalk": "^2.4.2" }, "engines": { @@ -136,30 +136,30 @@ } }, "node_modules/@babel/compat-data": { - "version": "7.23.2", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.23.2.tgz", - "integrity": "sha512-0S9TQMmDHlqAZ2ITT95irXKfxN9bncq8ZCoJhun3nHL/lLUxd2NKBJYoNGWH7S0hz6fRQwWlAWn/ILM0C70KZQ==", + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.23.5.tgz", + "integrity": "sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/core": { - "version": "7.23.2", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.2.tgz", - "integrity": "sha512-n7s51eWdaWZ3vGT2tD4T7J6eJs3QoBXydv7vkUM06Bf1cbVD2Kc2UrkzhiQwobfV7NwOnQXYL7UBJ5VPU+RGoQ==", + "version": "7.23.9", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.9.tgz", + "integrity": "sha512-5q0175NOjddqpvvzU+kDiSOAk4PfdO6FvwCWoQ6RO7rTzEe8vlo+4HVfcnAREhD4npMs0e9uZypjTwzZPCf/cw==", "dev": true, "dependencies": { "@ampproject/remapping": "^2.2.0", - "@babel/code-frame": "^7.22.13", - "@babel/generator": "^7.23.0", - "@babel/helper-compilation-targets": "^7.22.15", - "@babel/helper-module-transforms": "^7.23.0", - "@babel/helpers": "^7.23.2", - "@babel/parser": "^7.23.0", - "@babel/template": "^7.22.15", - "@babel/traverse": "^7.23.2", - "@babel/types": "^7.23.0", + "@babel/code-frame": "^7.23.5", + "@babel/generator": "^7.23.6", + "@babel/helper-compilation-targets": "^7.23.6", + "@babel/helper-module-transforms": "^7.23.3", + "@babel/helpers": "^7.23.9", + "@babel/parser": "^7.23.9", + "@babel/template": "^7.23.9", + "@babel/traverse": "^7.23.9", + "@babel/types": "^7.23.9", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -184,12 +184,12 @@ } }, "node_modules/@babel/generator": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.0.tgz", - "integrity": "sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==", + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.6.tgz", + "integrity": "sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw==", "dev": true, "dependencies": { - "@babel/types": "^7.23.0", + "@babel/types": "^7.23.6", "@jridgewell/gen-mapping": "^0.3.2", "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" @@ -199,14 +199,14 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.15.tgz", - "integrity": "sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw==", + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.23.6.tgz", + "integrity": "sha512-9JB548GZoQVmzrFgp8o7KxdgkTGm6xs9DW0o/Pim72UDjzr5ObUQ6ZzYPqA+g9OTS2bBQoctLJrky0RDCAWRgQ==", "dev": true, "dependencies": { - "@babel/compat-data": "^7.22.9", - "@babel/helper-validator-option": "^7.22.15", - "browserslist": "^4.21.9", + "@babel/compat-data": "^7.23.5", + "@babel/helper-validator-option": "^7.23.5", + "browserslist": "^4.22.2", "lru-cache": "^5.1.1", "semver": "^6.3.1" }, @@ -270,9 +270,9 @@ } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.23.0.tgz", - "integrity": "sha512-WhDWw1tdrlT0gMgUJSlX0IQvoO1eN279zrAUbVB+KpV2c3Tylz8+GnKOLllCS6Z/iZQEyVYxhZVUdPTqs2YYPw==", + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.23.3.tgz", + "integrity": "sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ==", "dev": true, "dependencies": { "@babel/helper-environment-visitor": "^7.22.20", @@ -322,9 +322,9 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz", - "integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==", + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz", + "integrity": "sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==", "dev": true, "engines": { "node": ">=6.9.0" @@ -340,32 +340,32 @@ } }, "node_modules/@babel/helper-validator-option": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.22.15.tgz", - "integrity": "sha512-bMn7RmyFjY/mdECUbgn9eoSY4vqvacUnS9i9vGAGttgFWesO6B4CYWA7XlpbWgBt71iv/hfbPlynohStqnu5hA==", + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.23.5.tgz", + "integrity": "sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helpers": { - "version": "7.23.2", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.2.tgz", - "integrity": "sha512-lzchcp8SjTSVe/fPmLwtWVBFC7+Tbn8LGHDVfDp9JGxpAY5opSaEFgt8UQvrnECWOTdji2mOWMz1rOhkHscmGQ==", + "version": "7.23.9", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.9.tgz", + "integrity": "sha512-87ICKgU5t5SzOT7sBMfCOZQ2rHjRU+Pcb9BoILMYz600W6DkVRLFBPwQ18gwUVvggqXivaUakpnxWQGbpywbBQ==", "dev": true, "dependencies": { - "@babel/template": "^7.22.15", - "@babel/traverse": "^7.23.2", - "@babel/types": "^7.23.0" + "@babel/template": "^7.23.9", + "@babel/traverse": "^7.23.9", + "@babel/types": "^7.23.9" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/highlight": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz", - "integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==", + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz", + "integrity": "sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==", "dev": true, "dependencies": { "@babel/helper-validator-identifier": "^7.22.20", @@ -448,9 +448,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz", - "integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==", + "version": "7.23.9", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.9.tgz", + "integrity": "sha512-9tcKgqKbs3xGJ+NtKF2ndOBBLVwPjl1SHxPQkd36r3Dlirw3xWUeGaTbqr7uGZcTaxkVNwc+03SVP7aCdWrTlA==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -520,9 +520,9 @@ } }, "node_modules/@babel/plugin-syntax-jsx": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.22.5.tgz", - "integrity": "sha512-gvyP4hZrgrs/wWMaocvxZ44Hw0b3W8Pe+cMxc8V1ULQ07oh8VNbIRaoD1LRZVTvD+0nieDKjfgKg89sD7rrKrg==", + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.23.3.tgz", + "integrity": "sha512-EB2MELswq55OHUoRZLGg/zC7QWUKfNLpE57m/S2yr1uEneIgsTgrSzXP3NXEsMkVn76OlaVVnzN+ugObuYGwhg==", "dev": true, "dependencies": { "@babel/helper-plugin-utils": "^7.22.5" @@ -622,9 +622,9 @@ } }, "node_modules/@babel/plugin-syntax-typescript": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.22.5.tgz", - "integrity": "sha512-1mS2o03i7t1c6VzH6fdQ3OA8tcEIxwG18zIPRp+UY1Ihv6W+XZzBCVxExF9upussPXJ0xE9XRHwMoNs1ep/nRQ==", + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.23.3.tgz", + "integrity": "sha512-9EiNjVJOMwCO+43TqoTrgQ8jMwcAd0sWyXi9RPfIsLTj4R2MADDDQXELhffaUx/uJv2AYcxBgPwH6j4TIA4ytQ==", "dev": true, "dependencies": { "@babel/helper-plugin-utils": "^7.22.5" @@ -637,34 +637,34 @@ } }, "node_modules/@babel/template": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", - "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", + "version": "7.23.9", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.23.9.tgz", + "integrity": "sha512-+xrD2BWLpvHKNmX2QbpdpsBaWnRxahMwJjO+KZk2JOElj5nSmKezyS1B4u+QbHMTX69t4ukm6hh9lsYQ7GHCKA==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.22.13", - "@babel/parser": "^7.22.15", - "@babel/types": "^7.22.15" + "@babel/code-frame": "^7.23.5", + "@babel/parser": "^7.23.9", + "@babel/types": "^7.23.9" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.23.2", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.2.tgz", - "integrity": "sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==", + "version": "7.23.9", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.9.tgz", + "integrity": "sha512-I/4UJ9vs90OkBtY6iiiTORVMyIhJ4kAVmsKo9KFc8UOxMeUfi2hvtIBsET5u9GizXE6/GFSuKCTNfgCswuEjRg==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.22.13", - "@babel/generator": "^7.23.0", + "@babel/code-frame": "^7.23.5", + "@babel/generator": "^7.23.6", "@babel/helper-environment-visitor": "^7.22.20", "@babel/helper-function-name": "^7.23.0", "@babel/helper-hoist-variables": "^7.22.5", "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/parser": "^7.23.0", - "@babel/types": "^7.23.0", - "debug": "^4.1.0", + "@babel/parser": "^7.23.9", + "@babel/types": "^7.23.9", + "debug": "^4.3.1", "globals": "^11.1.0" }, "engines": { @@ -681,12 +681,12 @@ } }, "node_modules/@babel/types": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", - "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", + "version": "7.23.9", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.9.tgz", + "integrity": "sha512-dQjSq/7HaSjRM43FFGnv5keM2HsxpmyV1PfaSVm0nzzjwwTmjOe6J4bC8e3+pTEIgHaHj+1ZlLThRJ2auc/w1Q==", "dev": true, "dependencies": { - "@babel/helper-string-parser": "^7.22.5", + "@babel/helper-string-parser": "^7.23.4", "@babel/helper-validator-identifier": "^7.22.20", "to-fast-properties": "^2.0.0" }, @@ -716,9 +716,9 @@ } }, "node_modules/@eslint-community/regexpp": { - "version": "4.9.1", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.9.1.tgz", - "integrity": "sha512-Y27x+MBLjXa+0JWDhykM3+JE+il3kHKAEqabfEWq3SDhZjLYb6/BHL/JKFnH3fe207JaXkyDo685Oc2Glt6ifA==", + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", + "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", "dev": true, "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" @@ -747,6 +747,28 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@eslint/eslintrc/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/@eslint/js": { "version": "8.56.0", "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.56.0.tgz", @@ -757,19 +779,41 @@ } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.11.13", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", - "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==", + "version": "0.11.14", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", + "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", "dev": true, "dependencies": { - "@humanwhocodes/object-schema": "^2.0.1", - "debug": "^4.1.1", + "@humanwhocodes/object-schema": "^2.0.2", + "debug": "^4.3.1", "minimatch": "^3.0.5" }, "engines": { "node": ">=10.10.0" } }, + "node_modules/@humanwhocodes/config-array/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/@humanwhocodes/module-importer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", @@ -784,9 +828,9 @@ } }, "node_modules/@humanwhocodes/object-schema": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", - "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz", + "integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==", "dev": true }, "node_modules/@istanbuljs/load-nyc-config": { @@ -1214,9 +1258,9 @@ "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.19", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz", - "integrity": "sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw==", + "version": "0.3.22", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz", + "integrity": "sha512-Wf963MzWtA2sjrNt+g18IAln9lKnlRp+K2eH4jjIoF1wYeq3aMREpG09xhlhdzS0EjwU7qmUJYangWa+151vZw==", "dev": true, "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", @@ -1265,9 +1309,9 @@ "dev": true }, "node_modules/@sinonjs/commons": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz", - "integrity": "sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", + "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==", "dev": true, "dependencies": { "type-detect": "4.0.8" @@ -1283,18 +1327,18 @@ } }, "node_modules/@tsd/typescript": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/@tsd/typescript/-/typescript-5.2.2.tgz", - "integrity": "sha512-VtjHPAKJqLJoHHKBDNofzvQB2+ZVxjXU/Gw6INAS9aINLQYVsxfzrQ2s84huCeYWZRTtrr7R0J7XgpZHjNwBCw==", + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/@tsd/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-CQlfzol0ldaU+ftWuG52vH29uRoKboLinLy84wS8TQOu+m+tWoaUfk4svL4ij2V8M5284KymJBlHUusKj6k34w==", "dev": true, "engines": { "node": ">=14.17" } }, "node_modules/@types/babel__core": { - "version": "7.20.2", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.2.tgz", - "integrity": "sha512-pNpr1T1xLUc2l3xJKuPtsEky3ybxN3m4fJkknfIpTCTfIZCDW57oAg+EfCgIIp2rvCe0Wn++/FfodDS4YXxBwA==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", "dev": true, "dependencies": { "@babel/parser": "^7.20.7", @@ -1305,18 +1349,18 @@ } }, "node_modules/@types/babel__generator": { - "version": "7.6.5", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.5.tgz", - "integrity": "sha512-h9yIuWbJKdOPLJTbmSpPzkF67e659PbQDba7ifWm5BJ8xTv+sDmS7rFmywkWOvXedGTivCdeGSIIX8WLcRTz8w==", + "version": "7.6.8", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.8.tgz", + "integrity": "sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==", "dev": true, "dependencies": { "@babel/types": "^7.0.0" } }, "node_modules/@types/babel__template": { - "version": "7.4.2", - "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.2.tgz", - "integrity": "sha512-/AVzPICMhMOMYoSx9MoKpGDKdBRsIXMNByh1PXSZoa+v6ZoLa8xxtsT/uLQ/NJm0XVAWl/BvId4MlDeXJaeIZQ==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", "dev": true, "dependencies": { "@babel/parser": "^7.1.0", @@ -1324,9 +1368,9 @@ } }, "node_modules/@types/babel__traverse": { - "version": "7.20.2", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.2.tgz", - "integrity": "sha512-ojlGK1Hsfce93J0+kn3H5R73elidKUaZonirN33GSmgTUMpzI/MIFfSpF3haANe3G1bEBS9/9/QEqwTzwqFsKw==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.5.tgz", + "integrity": "sha512-WXCyOcRtH37HAUkpXhUduaxdm82b4GSlyTqajXviN4EfiuPgNYR109xMCKvpl6zPIpua0DGlMEDCq+g8EdoheQ==", "dev": true, "dependencies": { "@babel/types": "^7.20.7" @@ -1343,39 +1387,39 @@ } }, "node_modules/@types/estree": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.2.tgz", - "integrity": "sha512-VeiPZ9MMwXjO32/Xu7+OwflfmeoRwkE/qzndw42gGtgJwZopBnzy2gD//NN1+go1mADzkDcqf/KnFRSjTJ8xJA==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", + "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", "dev": true }, "node_modules/@types/graceful-fs": { - "version": "4.1.7", - "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.7.tgz", - "integrity": "sha512-MhzcwU8aUygZroVwL2jeYk6JisJrPl/oov/gsgGCue9mkgl9wjGbzReYQClxiUgFDnib9FuHqTndccKeZKxTRw==", + "version": "4.1.9", + "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", + "integrity": "sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==", "dev": true, "dependencies": { "@types/node": "*" } }, "node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", - "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", + "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", "dev": true }, "node_modules/@types/istanbul-lib-report": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", - "integrity": "sha512-gPQuzaPR5h/djlAv2apEG1HVOyj1IUs7GpfMZixU0/0KXT3pm64ylHuMUI1/Akh+sq/iikxg6Z2j+fcMDXaaTQ==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz", + "integrity": "sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==", "dev": true, "dependencies": { "@types/istanbul-lib-coverage": "*" } }, "node_modules/@types/istanbul-reports": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.2.tgz", - "integrity": "sha512-kv43F9eb3Lhj+lr/Hn6OcLCs/sSM8bt+fIaP11rCYngfV6NVjzWXJ17owQtDQTL9tQ8WSLUrGsSJ6rJz0F1w1A==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz", + "integrity": "sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==", "dev": true, "dependencies": { "@types/istanbul-lib-report": "*" @@ -1392,9 +1436,9 @@ } }, "node_modules/@types/json-schema": { - "version": "7.0.13", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.13.tgz", - "integrity": "sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ==", + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", "dev": true }, "node_modules/@types/json5": { @@ -1404,64 +1448,64 @@ "dev": true }, "node_modules/@types/minimist": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.3.tgz", - "integrity": "sha512-ZYFzrvyWUNhaPomn80dsMNgMeXxNWZBdkuG/hWlUvXvbdUH8ZERNBGXnU87McuGcWDsyzX2aChCv/SVN348k3A==", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==", "dev": true }, "node_modules/@types/node": { - "version": "20.9.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.0.tgz", - "integrity": "sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==", + "version": "20.11.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.7.tgz", + "integrity": "sha512-GPmeN1C3XAyV5uybAf4cMLWT9fDWcmQhZVtMFu7OR32WjrqGG+Wnk2V1d0bmtUyE/Zy1QJ9BxyiTih9z8Oks8A==", "dev": true, "dependencies": { "undici-types": "~5.26.4" } }, "node_modules/@types/normalize-package-data": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.2.tgz", - "integrity": "sha512-lqa4UEhhv/2sjjIQgjX8B+RBjj47eo0mzGasklVJ78UKGQY1r0VpB9XHDaZZO9qzEFDdy4MrXLuEaSmPrPSe/A==", + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz", + "integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==", "dev": true }, "node_modules/@types/semver": { - "version": "7.5.3", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.3.tgz", - "integrity": "sha512-OxepLK9EuNEIPxWNME+C6WwbRAOOI2o2BaQEGzz5Lu2e4Z5eDnEo+/aVEDMIXywoJitJ7xWd641wrGLZdtwRyw==", + "version": "7.5.6", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.6.tgz", + "integrity": "sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==", "dev": true }, "node_modules/@types/stack-utils": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", - "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", + "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==", "dev": true }, "node_modules/@types/yargs": { - "version": "17.0.28", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.28.tgz", - "integrity": "sha512-N3e3fkS86hNhtk6BEnc0rj3zcehaxx8QWhCROJkqpl5Zaoi7nAic3jH8q94jVD3zu5LGk+PUB6KAiDmimYOEQw==", + "version": "17.0.32", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.32.tgz", + "integrity": "sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog==", "dev": true, "dependencies": { "@types/yargs-parser": "*" } }, "node_modules/@types/yargs-parser": { - "version": "21.0.1", - "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.1.tgz", - "integrity": "sha512-axdPBuLuEJt0c4yI5OZssC19K2Mq1uKdrfZBzuxLvaztgqUtFYZUNw7lETExPYJR9jdEoIg4mb7RQKRQzOkeGQ==", + "version": "21.0.3", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz", + "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==", "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.18.0.tgz", - "integrity": "sha512-3lqEvQUdCozi6d1mddWqd+kf8KxmGq2Plzx36BlkjuQe3rSTm/O98cLf0A4uDO+a5N1KD2SeEEl6fW97YHY+6w==", + "version": "6.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.19.1.tgz", + "integrity": "sha512-roQScUGFruWod9CEyoV5KlCYrubC/fvG8/1zXuT0WTcxX87GnMMmnksMwSg99lo1xiKrBzw2icsJPMAw1OtKxg==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.18.0", - "@typescript-eslint/type-utils": "6.18.0", - "@typescript-eslint/utils": "6.18.0", - "@typescript-eslint/visitor-keys": "6.18.0", + "@typescript-eslint/scope-manager": "6.19.1", + "@typescript-eslint/type-utils": "6.19.1", + "@typescript-eslint/utils": "6.19.1", + "@typescript-eslint/visitor-keys": "6.19.1", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -1487,15 +1531,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "6.13.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.13.1.tgz", - "integrity": "sha512-fs2XOhWCzRhqMmQf0eicLa/CWSaYss2feXsy7xBD/pLyWke/jCIVc2s1ikEAtSW7ina1HNhv7kONoEfVNEcdDQ==", + "version": "6.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.19.1.tgz", + "integrity": "sha512-WEfX22ziAh6pRE9jnbkkLGp/4RhTpffr2ZK5bJ18M8mIfA8A+k97U9ZyaXCEJRlmMHh7R9MJZWXp/r73DzINVQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.13.1", - "@typescript-eslint/types": "6.13.1", - "@typescript-eslint/typescript-estree": "6.13.1", - "@typescript-eslint/visitor-keys": "6.13.1", + "@typescript-eslint/scope-manager": "6.19.1", + "@typescript-eslint/types": "6.19.1", + "@typescript-eslint/typescript-estree": "6.19.1", + "@typescript-eslint/visitor-keys": "6.19.1", "debug": "^4.3.4" }, "engines": { @@ -1514,88 +1558,14 @@ } } }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": { - "version": "6.13.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.13.1.tgz", - "integrity": "sha512-BW0kJ7ceiKi56GbT2KKzZzN+nDxzQK2DS6x0PiSMPjciPgd/JRQGMibyaN2cPt2cAvuoH0oNvn2fwonHI+4QUQ==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.13.1", - "@typescript-eslint/visitor-keys": "6.13.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": { - "version": "6.13.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.13.1.tgz", - "integrity": "sha512-gjeEskSmiEKKFIbnhDXUyiqVma1gRCQNbVZ1C8q7Zjcxh3WZMbzWVfGE9rHfWd1msQtPS0BVD9Jz9jded44eKg==", - "dev": true, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": { - "version": "6.13.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.13.1.tgz", - "integrity": "sha512-sBLQsvOC0Q7LGcUHO5qpG1HxRgePbT6wwqOiGLpR8uOJvPJbfs0mW3jPA3ujsDvfiVwVlWUDESNXv44KtINkUQ==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.13.1", - "@typescript-eslint/visitor-keys": "6.13.1", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { - "version": "6.13.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.13.1.tgz", - "integrity": "sha512-NDhQUy2tg6XGNBGDRm1XybOHSia8mcXmlbKWoQP+nm1BIIMxa55shyJfZkHpEBN62KNPLrocSM2PdPcaLgDKMQ==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "6.13.1", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.18.0.tgz", - "integrity": "sha512-o/UoDT2NgOJ2VfHpfr+KBY2ErWvCySNUIX/X7O9g8Zzt/tXdpfEU43qbNk8LVuWUT2E0ptzTWXh79i74PP0twA==", + "version": "6.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.19.1.tgz", + "integrity": "sha512-4CdXYjKf6/6aKNMSly/BP4iCSOpvMmqtDzRtqFyyAae3z5kkqEjKndR5vDHL8rSuMIIWP8u4Mw4VxLyxZW6D5w==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.18.0", - "@typescript-eslint/visitor-keys": "6.18.0" + "@typescript-eslint/types": "6.19.1", + "@typescript-eslint/visitor-keys": "6.19.1" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -1606,13 +1576,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.18.0.tgz", - "integrity": "sha512-ZeMtrXnGmTcHciJN1+u2CigWEEXgy1ufoxtWcHORt5kGvpjjIlK9MUhzHm4RM8iVy6dqSaZA/6PVkX6+r+ChjQ==", + "version": "6.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.19.1.tgz", + "integrity": "sha512-0vdyld3ecfxJuddDjACUvlAeYNrHP/pDeQk2pWBR2ESeEzQhg52DF53AbI9QCBkYE23lgkhLCZNkHn2hEXXYIg==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.18.0", - "@typescript-eslint/utils": "6.18.0", + "@typescript-eslint/typescript-estree": "6.19.1", + "@typescript-eslint/utils": "6.19.1", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -1633,9 +1603,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.18.0.tgz", - "integrity": "sha512-/RFVIccwkwSdW/1zeMx3hADShWbgBxBnV/qSrex6607isYjj05t36P6LyONgqdUrNLl5TYU8NIKdHUYpFvExkA==", + "version": "6.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.19.1.tgz", + "integrity": "sha512-6+bk6FEtBhvfYvpHsDgAL3uo4BfvnTnoge5LrrCj2eJN8g3IJdLTD4B/jK3Q6vo4Ql/Hoip9I8aB6fF+6RfDqg==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -1646,13 +1616,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.18.0.tgz", - "integrity": "sha512-klNvl+Ql4NsBNGB4W9TZ2Od03lm7aGvTbs0wYaFYsplVPhr+oeXjlPZCDI4U9jgJIDK38W1FKhacCFzCC+nbIg==", + "version": "6.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.19.1.tgz", + "integrity": "sha512-aFdAxuhzBFRWhy+H20nYu19+Km+gFfwNO4TEqyszkMcgBDYQjmPJ61erHxuT2ESJXhlhrO7I5EFIlZ+qGR8oVA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.18.0", - "@typescript-eslint/visitor-keys": "6.18.0", + "@typescript-eslint/types": "6.19.1", + "@typescript-eslint/visitor-keys": "6.19.1", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1673,42 +1643,18 @@ } } }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/@typescript-eslint/utils": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.18.0.tgz", - "integrity": "sha512-wiKKCbUeDPGaYEYQh1S580dGxJ/V9HI7K5sbGAVklyf+o5g3O+adnS4UNJajplF4e7z2q0uVBaTdT/yLb4XAVA==", + "version": "6.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.19.1.tgz", + "integrity": "sha512-JvjfEZuP5WoMqwh9SPAPDSHSg9FBHHGhjPugSRxu5jMfjvBpq5/sGTD+9M9aQ5sh6iJ8AY/Kk/oUYVEMAPwi7w==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.18.0", - "@typescript-eslint/types": "6.18.0", - "@typescript-eslint/typescript-estree": "6.18.0", + "@typescript-eslint/scope-manager": "6.19.1", + "@typescript-eslint/types": "6.19.1", + "@typescript-eslint/typescript-estree": "6.19.1", "semver": "^7.5.4" }, "engines": { @@ -1723,12 +1669,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.18.0.tgz", - "integrity": "sha512-1wetAlSZpewRDb2h9p/Q8kRjdGuqdTAQbkJIOUMLug2LBLG+QOjiWoSj6/3B/hA9/tVTFFdtiKvAYoYnSRW/RA==", + "version": "6.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.19.1.tgz", + "integrity": "sha512-gkdtIO+xSO/SmI0W68DBg4u1KElmIUo3vXzgHyGPs6cxgB0sa3TlptRAAE0hUY1hM6FcDKEv7aIwiTGm76cXfQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.18.0", + "@typescript-eslint/types": "6.19.1", "eslint-visitor-keys": "^3.4.1" }, "engines": { @@ -2113,13 +2059,12 @@ "dev": true }, "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "balanced-match": "^1.0.0" } }, "node_modules/braces": { @@ -2135,9 +2080,9 @@ } }, "node_modules/browserslist": { - "version": "4.22.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.1.tgz", - "integrity": "sha512-FEVc202+2iuClEhZhrWy6ZiAcRLvNMyYcxZ8raemul1DYVOVdFsbqckWLdsixQZCpJlwe77Z3UTalE7jsjnKfQ==", + "version": "4.22.3", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.3.tgz", + "integrity": "sha512-UAp55yfwNv0klWNapjs/ktHoguxuQNGnOzxYmfnXIS+8AsRDZkSDxg7R1AX3GKzn078SBI5dzwzj/Yx0Or0e3A==", "dev": true, "funding": [ { @@ -2154,9 +2099,9 @@ } ], "dependencies": { - "caniuse-lite": "^1.0.30001541", - "electron-to-chromium": "^1.4.535", - "node-releases": "^2.0.13", + "caniuse-lite": "^1.0.30001580", + "electron-to-chromium": "^1.4.648", + "node-releases": "^2.0.14", "update-browserslist-db": "^1.0.13" }, "bin": { @@ -2215,13 +2160,14 @@ } }, "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.5.tgz", + "integrity": "sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==", "dev": true, "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.1", + "set-function-length": "^1.1.1" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -2263,9 +2209,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001549", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001549.tgz", - "integrity": "sha512-qRp48dPYSCYaP+KurZLhDYdVE+yEyht/3NlmcJgVQ2VMGt6JL36ndQ/7rgspdZsJuxDPFIo/OzBT2+GmIJ53BA==", + "version": "1.0.30001580", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001580.tgz", + "integrity": "sha512-mtj5ur2FFPZcCEpXFy8ADXbDACuNFXg6mxVDqp7tqooX6l3zwm+d8EPoeOSIFRDvHs8qu7/SLFOGniULkcH2iA==", "dev": true, "funding": [ { @@ -2577,9 +2523,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.554", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.554.tgz", - "integrity": "sha512-Q0umzPJjfBrrj8unkONTgbKQXzXRrH7sVV7D9ea2yBV3Oaogz991yhbpfvo2LMNkJItmruXTEzVpP9cp7vaIiQ==", + "version": "1.4.648", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.648.tgz", + "integrity": "sha512-EmFMarXeqJp9cUKu/QEciEApn0S/xRcpZWuAm32U7NgoZCimjsilKXHRO9saeEW55eHZagIDg6XTUOv32w9pjg==", "dev": true }, "node_modules/emittery": { @@ -2610,26 +2556,26 @@ } }, "node_modules/es-abstract": { - "version": "1.22.2", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.2.tgz", - "integrity": "sha512-YoxfFcDmhjOgWPWsV13+2RNjq1F6UQnfs+8TftwNqtzlmFzEXvlUwdrNrYeaizfjQzRMxkZ6ElWMOJIFKdVqwA==", + "version": "1.22.3", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.3.tgz", + "integrity": "sha512-eiiY8HQeYfYH2Con2berK+To6GrK2RxbPawDkGq4UiCQQfZHb6wX9qQqkbpPqaxQFcl8d9QzZqo0tGE0VcrdwA==", "dev": true, "dependencies": { "array-buffer-byte-length": "^1.0.0", "arraybuffer.prototype.slice": "^1.0.2", "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", + "call-bind": "^1.0.5", "es-set-tostringtag": "^2.0.1", "es-to-primitive": "^1.2.1", "function.prototype.name": "^1.1.6", - "get-intrinsic": "^1.2.1", + "get-intrinsic": "^1.2.2", "get-symbol-description": "^1.0.0", "globalthis": "^1.0.3", "gopd": "^1.0.1", - "has": "^1.0.3", "has-property-descriptors": "^1.0.0", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", + "hasown": "^2.0.0", "internal-slot": "^1.0.5", "is-array-buffer": "^3.0.2", "is-callable": "^1.2.7", @@ -2639,7 +2585,7 @@ "is-string": "^1.0.7", "is-typed-array": "^1.1.12", "is-weakref": "^1.0.2", - "object-inspect": "^1.12.3", + "object-inspect": "^1.13.1", "object-keys": "^1.1.1", "object.assign": "^4.1.4", "regexp.prototype.flags": "^1.5.1", @@ -2653,7 +2599,7 @@ "typed-array-byte-offset": "^1.0.0", "typed-array-length": "^1.0.4", "unbox-primitive": "^1.0.2", - "which-typed-array": "^1.1.11" + "which-typed-array": "^1.1.13" }, "engines": { "node": ">= 0.4" @@ -2663,26 +2609,26 @@ } }, "node_modules/es-set-tostringtag": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz", - "integrity": "sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.2.tgz", + "integrity": "sha512-BuDyupZt65P9D2D2vA/zqcI3G5xRsklm5N3xCwuiy+/vKy8i0ifdsQP1sLgO4tZDSCaQUSnmC48khknGMV3D2Q==", "dev": true, "dependencies": { - "get-intrinsic": "^1.1.3", - "has": "^1.0.3", - "has-tostringtag": "^1.0.0" + "get-intrinsic": "^1.2.2", + "has-tostringtag": "^1.0.0", + "hasown": "^2.0.0" }, "engines": { "node": ">= 0.4" } }, "node_modules/es-shim-unscopables": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz", - "integrity": "sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.2.tgz", + "integrity": "sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==", "dev": true, "dependencies": { - "has": "^1.0.3" + "hasown": "^2.0.0" } }, "node_modules/es-to-primitive": { @@ -2778,6 +2724,18 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint-compat-utils": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/eslint-compat-utils/-/eslint-compat-utils-0.1.2.tgz", + "integrity": "sha512-Jia4JDldWnFNIru1Ehx1H5s9/yxiRHY/TimCuUc0jNexew3cF1gI6CYZil1ociakfWO3rRqFjl1mskBblB3RYg==", + "dev": true, + "engines": { + "node": ">=12" + }, + "peerDependencies": { + "eslint": ">=6.0.0" + } + }, "node_modules/eslint-config-standard": { "version": "17.1.0", "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-17.1.0.tgz", @@ -2894,13 +2852,14 @@ } }, "node_modules/eslint-plugin-es-x": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-es-x/-/eslint-plugin-es-x-7.2.0.tgz", - "integrity": "sha512-9dvv5CcvNjSJPqnS5uZkqb3xmbeqRLnvXKK7iI5+oK/yTusyc46zbBZKENGsOfojm/mKfszyZb+wNqNPAPeGXA==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-es-x/-/eslint-plugin-es-x-7.5.0.tgz", + "integrity": "sha512-ODswlDSO0HJDzXU0XvgZ3lF3lS3XAZEossh15Q2UHjwrJggWeBoKqqEsLTZLXl+dh5eOAozG0zRcYtuE35oTuQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.1.2", - "@eslint-community/regexpp": "^4.6.0" + "@eslint-community/regexpp": "^4.6.0", + "eslint-compat-utils": "^0.1.2" }, "engines": { "node": "^14.18.0 || >=16.0.0" @@ -2913,9 +2872,9 @@ } }, "node_modules/eslint-plugin-import": { - "version": "2.29.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.0.tgz", - "integrity": "sha512-QPOO5NO6Odv5lpoTkddtutccQjysJuFxoPS7fAHO+9m9udNHvTCPSAMW9zGAYj8lAIdr40I8yPCdUYrncXtrwg==", + "version": "2.29.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz", + "integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==", "dev": true, "dependencies": { "array-includes": "^3.1.7", @@ -2934,7 +2893,7 @@ "object.groupby": "^1.0.1", "object.values": "^1.1.7", "semver": "^6.3.1", - "tsconfig-paths": "^3.14.2" + "tsconfig-paths": "^3.15.0" }, "engines": { "node": ">=4" @@ -2943,6 +2902,16 @@ "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" } }, + "node_modules/eslint-plugin-import/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "node_modules/eslint-plugin-import/node_modules/debug": { "version": "3.2.7", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", @@ -2964,6 +2933,18 @@ "node": ">=0.10.0" } }, + "node_modules/eslint-plugin-import/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/eslint-plugin-import/node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -2974,9 +2955,9 @@ } }, "node_modules/eslint-plugin-jest": { - "version": "27.6.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.6.0.tgz", - "integrity": "sha512-MTlusnnDMChbElsszJvrwD1dN3x6nZl//s4JD23BxB6MgR66TZlL064su24xEIS3VACfAoHV1vgyMgPw8nkdng==", + "version": "27.6.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.6.3.tgz", + "integrity": "sha512-+YsJFVH6R+tOiO3gCJon5oqn4KWc+mDq2leudk8mrp8RFubLOo9CVyi3cib4L7XMpxExmkmBZQTPDYVBzgpgOA==", "dev": true, "dependencies": { "@typescript-eslint/utils": "^5.10.0" @@ -3121,15 +3102,16 @@ } }, "node_modules/eslint-plugin-n": { - "version": "16.3.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-16.3.1.tgz", - "integrity": "sha512-w46eDIkxQ2FaTHcey7G40eD+FhTXOdKudDXPUO2n9WNcslze/i/HT2qJ3GXjHngYSGDISIgPNhwGtgoix4zeOw==", + "version": "16.6.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-16.6.2.tgz", + "integrity": "sha512-6TyDmZ1HXoFQXnhCTUjVFULReoBPOAjpuiKELMkeP40yffI/1ZRO+d9ug/VC6fqISo2WkuIBk3cvuRPALaWlOQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "builtins": "^5.0.1", - "eslint-plugin-es-x": "^7.1.0", + "eslint-plugin-es-x": "^7.5.0", "get-tsconfig": "^4.7.0", + "globals": "^13.24.0", "ignore": "^5.2.4", "is-builtin-module": "^3.2.1", "is-core-module": "^2.12.1", @@ -3147,6 +3129,28 @@ "eslint": ">=7.0.0" } }, + "node_modules/eslint-plugin-n/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/eslint-plugin-n/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/eslint-plugin-promise": { "version": "6.1.1", "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-6.1.1.tgz", @@ -3193,6 +3197,28 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/eslint/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/espree": { "version": "9.6.1", "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", @@ -3320,9 +3346,9 @@ "dev": true }, "node_modules/fast-glob": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", - "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", "dev": true, "dependencies": { "@nodelib/fs.stat": "^2.0.2", @@ -3360,9 +3386,9 @@ "dev": true }, "node_modules/fastq": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", - "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.0.tgz", + "integrity": "sha512-zGygtijUMT7jnk3h26kUms3BkSDp4IfIKjmnqI2tvx6nuBfiF1UqOxbnLfzdv+apBy+53oaImsKtMw/xYbW+1w==", "dev": true, "dependencies": { "reusify": "^1.0.4" @@ -3418,9 +3444,9 @@ } }, "node_modules/flat-cache": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.1.1.tgz", - "integrity": "sha512-/qM2b3LUIaIgviBQovTLvijfyOQXPtSRnRK26ksj2J7rzPIecePUIpJsZ4T02Qg+xiAEKIs5K8dsHEd+VaKa/Q==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", + "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", "dev": true, "dependencies": { "flatted": "^3.2.9", @@ -3428,7 +3454,7 @@ "rimraf": "^3.0.2" }, "engines": { - "node": ">=12.0.0" + "node": "^10.12.0 || >=12.0.0" } }, "node_modules/flatted": { @@ -3521,15 +3547,15 @@ } }, "node_modules/get-intrinsic": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", - "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz", + "integrity": "sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==", "dev": true, "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", + "function-bind": "^1.1.2", "has-proto": "^1.0.1", - "has-symbols": "^1.0.3" + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -3616,6 +3642,28 @@ "node": ">=10.13.0" } }, + "node_modules/glob/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/glob/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/globals": { "version": "13.24.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", @@ -3699,15 +3747,6 @@ "node": ">=6" } }, - "node_modules/has": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.4.tgz", - "integrity": "sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ==", - "dev": true, - "engines": { - "node": ">= 0.4.0" - } - }, "node_modules/has-bigints": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", @@ -3727,12 +3766,12 @@ } }, "node_modules/has-property-descriptors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", - "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz", + "integrity": "sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==", "dev": true, "dependencies": { - "get-intrinsic": "^1.1.1" + "get-intrinsic": "^1.2.2" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -3835,9 +3874,9 @@ } }, "node_modules/ignore": { - "version": "5.2.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", - "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.0.tgz", + "integrity": "sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==", "dev": true, "engines": { "node": ">= 4" @@ -3913,13 +3952,13 @@ "dev": true }, "node_modules/internal-slot": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz", - "integrity": "sha512-Y+R5hJrzs52QCG2laLn4udYVnxsfny9CpOhNhUvk/SSSVyF6T27FzRbF0sroPidSu3X8oEAkOn2K804mjpt6UQ==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.6.tgz", + "integrity": "sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg==", "dev": true, "dependencies": { - "get-intrinsic": "^1.2.0", - "has": "^1.0.3", + "get-intrinsic": "^1.2.2", + "hasown": "^2.0.0", "side-channel": "^1.0.4" }, "engines": { @@ -4252,9 +4291,9 @@ "dev": true }, "node_modules/istanbul-lib-coverage": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", - "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", + "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", "dev": true, "engines": { "node": ">=8" @@ -5181,15 +5220,18 @@ } }, "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", "dev": true, "dependencies": { - "brace-expansion": "^1.1.7" + "brace-expansion": "^2.0.1" }, "engines": { - "node": "*" + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/minimist": { @@ -5234,9 +5276,9 @@ "dev": true }, "node_modules/node-releases": { - "version": "2.0.13", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", - "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==", + "version": "2.0.14", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", + "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==", "dev": true }, "node_modules/normalize-package-data": { @@ -5276,9 +5318,9 @@ } }, "node_modules/object-inspect": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.0.tgz", - "integrity": "sha512-HQ4J+ic8hKrgIt3mqk6cVOVrW2ozL4KdvHlqpBv9vDYWx9ysAgENAdvy4FoGF+KFdhR7nQTNm5J0ctAeOwn+3g==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", + "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -5294,13 +5336,13 @@ } }, "node_modules/object.assign": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", - "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.5.tgz", + "integrity": "sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.4", + "call-bind": "^1.0.5", + "define-properties": "^1.2.1", "has-symbols": "^1.0.3", "object-keys": "^1.1.1" }, @@ -6005,13 +6047,13 @@ } }, "node_modules/safe-array-concat": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.1.tgz", - "integrity": "sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.0.tgz", + "integrity": "sha512-ZdQ0Jeb9Ofti4hbt5lX3T2JcAamT9hfzYU1MNB+z/jaEbB6wfFfPIR/zEORmZqobkCCJhSjodobH6WHNmJ97dg==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.2.1", + "call-bind": "^1.0.5", + "get-intrinsic": "^1.2.2", "has-symbols": "^1.0.3", "isarray": "^2.0.5" }, @@ -6023,15 +6065,18 @@ } }, "node_modules/safe-regex-test": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", - "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.2.tgz", + "integrity": "sha512-83S9w6eFq12BBIJYvjMux6/dkirb8+4zJRA9cxNBVb7Wq5fJBW+Xze48WqR8pxua7bDuAaaAxtVVd4Idjp1dBQ==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.3", + "call-bind": "^1.0.5", + "get-intrinsic": "^1.2.2", "is-regex": "^1.1.4" }, + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -6069,6 +6114,22 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, + "node_modules/set-function-length": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.0.tgz", + "integrity": "sha512-4DBHDoyHlM1IRPGYcoxexgh67y4ueR53FKV1yyxwFMY7aCqcN/38M1+SwZ/qJQ8iLv7+ck385ot4CcisOAPT9w==", + "dev": true, + "dependencies": { + "define-data-property": "^1.1.1", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.2", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/set-function-name": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.1.tgz", @@ -6169,9 +6230,9 @@ } }, "node_modules/spdx-exceptions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", - "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.4.0.tgz", + "integrity": "sha512-hcjppoJ68fhxA/cjbN4T8N6uCUejN8yFw69ttpqtBeCbF3u13n7mb31NB9jKwGTTWWnt9IbRA/mf1FprYS8wfw==", "dev": true }, "node_modules/spdx-expression-parse": { @@ -6394,6 +6455,28 @@ "node": ">=8" } }, + "node_modules/test-exclude/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/test-exclude/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -6449,9 +6532,9 @@ } }, "node_modules/ts-jest": { - "version": "29.1.1", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.1.tgz", - "integrity": "sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA==", + "version": "29.1.2", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.2.tgz", + "integrity": "sha512-br6GJoH/WUX4pu7FbZXuWGKGNDuU7b8Uj77g/Sp7puZV6EXzuByl6JrECvm0MzVzSTkSHWTihsXt+5XYER5b+g==", "dev": true, "dependencies": { "bs-logger": "0.x", @@ -6467,7 +6550,7 @@ "ts-jest": "cli.js" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^16.10.0 || ^18.0.0 || >=20.0.0" }, "peerDependencies": { "@babel/core": ">=7.0.0-beta.0 <8", @@ -6492,9 +6575,9 @@ } }, "node_modules/tsconfig-paths": { - "version": "3.14.2", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz", - "integrity": "sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==", + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", + "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", "dev": true, "dependencies": { "@types/json5": "^0.0.29", @@ -6525,12 +6608,12 @@ } }, "node_modules/tsd": { - "version": "0.29.0", - "resolved": "https://registry.npmjs.org/tsd/-/tsd-0.29.0.tgz", - "integrity": "sha512-5B7jbTj+XLMg6rb9sXRBGwzv7h8KJlGOkTHxY63eWpZJiQ5vJbXEjL0u7JkIxwi5EsrRE1kRVUWmy6buK/ii8A==", + "version": "0.30.4", + "resolved": "https://registry.npmjs.org/tsd/-/tsd-0.30.4.tgz", + "integrity": "sha512-ncC4SwAeUk0OTcXt5h8l0/gOLHJSp9ogosvOADT6QYzrl0ITm398B3wkz8YESqefIsEEwvYAU8bvo7/rcN/M0Q==", "dev": true, "dependencies": { - "@tsd/typescript": "~5.2.2", + "@tsd/typescript": "~5.3.3", "eslint-formatter-pretty": "^4.1.0", "globby": "^11.0.1", "jest-diff": "^29.0.3", @@ -6738,9 +6821,9 @@ } }, "node_modules/v8-to-istanbul": { - "version": "9.1.3", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.3.tgz", - "integrity": "sha512-9lDD+EVI2fjFsMWXc6dy5JJzBsVTcQ2fVkfBvncZ6xJWG9wtBhOldG+mHkSL0+V1K/xgZz0JDO5UT5hFwHUghg==", + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz", + "integrity": "sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA==", "dev": true, "dependencies": { "@jridgewell/trace-mapping": "^0.3.12", @@ -6802,13 +6885,13 @@ } }, "node_modules/which-typed-array": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.11.tgz", - "integrity": "sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew==", + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.13.tgz", + "integrity": "sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow==", "dev": true, "dependencies": { "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", + "call-bind": "^1.0.4", "for-each": "^0.3.3", "gopd": "^1.0.1", "has-tostringtag": "^1.0.0" diff --git a/package.json b/package.json index e5a54dc29..f2e583f66 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "commander", - "version": "11.1.0", + "version": "12.0.0-1", "description": "the complete solution for node.js command-line programs", "keywords": [ "commander", @@ -16,7 +16,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/tj/commander.js.git" + "url": "git+https://github.com/tj/commander.js.git" }, "scripts": { "lint": "npm run lint:javascript && npm run lint:typescript", @@ -69,12 +69,12 @@ "eslint-plugin-promise": "^6.1.1", "jest": "^29.3.1", "ts-jest": "^29.0.3", - "tsd": "^0.29.0", + "tsd": "^0.30.4", "typescript": "^5.0.4" }, "types": "typings/index.d.ts", "engines": { - "node": ">=16" + "node": ">=18" }, "support": true } diff --git a/tests/command.addHelpOption.test.js b/tests/command.addHelpOption.test.js new file mode 100644 index 000000000..48c8e9932 --- /dev/null +++ b/tests/command.addHelpOption.test.js @@ -0,0 +1,54 @@ +const { Command, Option } = require('../'); + +// More complete tests are in command.helpOption.test.js. + +describe('addHelpOption', () => { + let writeSpy; + let writeErrorSpy; + + beforeAll(() => { + // Optional. Suppress expected output to keep test output clean. + writeSpy = jest.spyOn(process.stdout, 'write').mockImplementation(() => { }); + writeErrorSpy = jest.spyOn(process.stderr, 'write').mockImplementation(() => { }); + }); + + afterEach(() => { + writeSpy.mockClear(); + writeErrorSpy.mockClear(); + }); + + afterAll(() => { + writeSpy.mockRestore(); + writeErrorSpy.mockRestore(); + }); + + test('when addHelpOption has custom flags then custom short flag invokes help', () => { + const program = new Command(); + program + .exitOverride() + .addHelpOption(new Option('-c,--custom-help')); + + expect(() => { + program.parse(['-c'], { from: 'user' }); + }).toThrow('(outputHelp)'); + }); + + test('when addHelpOption has custom flags then custom long flag invokes help', () => { + const program = new Command(); + program + .exitOverride() + .addHelpOption(new Option('-c,--custom-help')); + + expect(() => { + program.parse(['--custom-help'], { from: 'user' }); + }).toThrow('(outputHelp)'); + }); + + test('when addHelpOption with hidden help option then help does not include help option', () => { + const program = new Command(); + program + .addHelpOption(new Option('-c,--custom-help', 'help help help').hideHelp()); + const helpInfo = program.helpInformation(); + expect(helpInfo).not.toMatch(/help/); + }); +}); diff --git a/tests/command.chain.test.js b/tests/command.chain.test.js index 3f907c869..b3872f66b 100644 --- a/tests/command.chain.test.js +++ b/tests/command.chain.test.js @@ -34,12 +34,54 @@ describe('Command methods that should return this for chaining', () => { expect(result).toBe(program); }); - test('when call .addHelpCommand() then returns this', () => { + test('when call .addHelpCommand(cmd) then returns this', () => { const program = new Command(); - const result = program.addHelpCommand(false); + const result = program.addHelpCommand(new Command('assist')); expect(result).toBe(program); }); + test('when call deprecated .addHelpCommand() then returns this', () => { + const program = new Command(); + const result = program.addHelpCommand(); + expect(result).toBe(program); + }); + + test('when call deprecated .addHelpCommand(boolean) then returns this', () => { + const program = new Command(); + const result1 = program.addHelpCommand(true); + expect(result1).toBe(program); + const result2 = program.addHelpCommand(false); + expect(result2).toBe(program); + }); + + test('when call deprecated .addHelpCommand(string[, string]) then returns this', () => { + const program = new Command(); + const result1 = program.addHelpCommand('assist'); + expect(result1).toBe(program); + const result2 = program.addHelpCommand('assist', 'assist description'); + expect(result2).toBe(program); + }); + + test('when call .helpCommand(name) then returns this', () => { + const program = new Command(); + const result = program.helpCommand(); + expect(result).toBe(program); + }); + + test('when call .helpCommand(name, description) then returns this', () => { + const program = new Command(); + const result1 = program.helpCommand('assist', 'assist description'); + expect(result1).toBe(program); + }); + + test('when call .helpCommand(boolean) then returns this', () => { + const program = new Command(); + const result1 = program.helpCommand(true); + expect(result1).toBe(program); + const result2 = program.helpCommand(false); + expect(result2).toBe(program); + }); + test('when call .exitOverride() then returns this', () => { const program = new Command(); const result = program.exitOverride(() => { }); @@ -130,9 +172,16 @@ describe('Command methods that should return this for chaining', () => { expect(result).toBe(program); }); - test('when call .helpOption() then returns this', () => { + test('when call .helpOption(flags) then returns this', () => { + const program = new Command(); + const flags = '-h, --help'; + const result = program.helpOption(flags); + expect(result).toBe(program); + }); + + test('when call .addHelpOption() then returns this', () => { const program = new Command(); - const result = program.helpOption(false); + const result = program.addHelpOption(new Option('-h, --help')); expect(result).toBe(program); }); diff --git a/tests/command.copySettings.test.js b/tests/command.copySettings.test.js index 79722d78b..1127b3c60 100644 --- a/tests/command.copySettings.test.js +++ b/tests/command.copySettings.test.js @@ -31,11 +31,10 @@ describe('copyInheritedSettings property tests', () => { test('when copyInheritedSettings then copies helpOption(false)', () => { const source = new commander.Command(); const cmd = new commander.Command(); - expect(cmd._hasHelpOption).toBeTruthy(); source.helpOption(false); cmd.copyInheritedSettings(source); - expect(cmd._hasHelpOption).toBeFalsy(); + expect(cmd._getHelpOption()).toBe(null); }); test('when copyInheritedSettings then copies helpOption(flags, description)', () => { @@ -44,21 +43,36 @@ describe('copyInheritedSettings property tests', () => { source.helpOption('-Z, --zz', 'ddd'); cmd.copyInheritedSettings(source); - expect(cmd._helpFlags).toBe('-Z, --zz'); - expect(cmd._helpDescription).toBe('ddd'); - expect(cmd._helpShortFlag).toBe('-Z'); - expect(cmd._helpLongFlag).toBe('--zz'); + expect(cmd._getHelpOption()).toBe(source._getHelpOption()); + // const helpOption = cmd._getHelpOption(); + // expect(helpOption.flags).toBe('-Z, --zz'); + // expect(helpOption.description).toBe('ddd'); + // expect(helpOption.short).toBe('-Z'); + // expect(helpOption.long).toBe('--zz'); }); - test('when copyInheritedSettings then copies addHelpCommand(name, description)', () => { + test('when copyInheritedSettings then copies custom help command', () => { const source = new commander.Command(); const cmd = new commander.Command(); - source.addHelpCommand('HELP [cmd]', 'ddd'); + source.helpCommand('HELP [cmd]', 'ddd'); cmd.copyInheritedSettings(source); - expect(cmd._helpCommandName).toBe('HELP'); - expect(cmd._helpCommandnameAndArgs).toBe('HELP [cmd]'); - expect(cmd._helpCommandDescription).toBe('ddd'); + cmd.helpCommand(true); // force enable + const helpCommand = cmd._getHelpCommand(); + expect(helpCommand).toBeTruthy(); + expect(helpCommand.name()).toBe('HELP'); + expect(helpCommand.description()).toBe('ddd'); + }); + + test('when copyInheritedSettings then does not copy help enable override', () => { + const source = new commander.Command(); + const cmd = new commander.Command(); + + // Existing behaviour, force enable/disable does not inherit, + // largely so (probably redundant) program.helpCommand(true) does not inherit to leaf subcommands. + source.helpCommand(true); + cmd.copyInheritedSettings(source); + expect(cmd._addHelpOption).toBeUndefined(); }); test('when copyInheritedSettings then copies configureHelp(config)', () => { diff --git a/tests/command.executableSubcommand.signals.test.js b/tests/command.executableSubcommand.signals.test.js index a5eb23081..d97ebb2bf 100644 --- a/tests/command.executableSubcommand.signals.test.js +++ b/tests/command.executableSubcommand.signals.test.js @@ -1,39 +1,46 @@ const childProcess = require('child_process'); const path = require('path'); -// Test that a signal sent to the parent process is received by the executable subcommand process (which is listening). +const pmPath = path.join(__dirname, 'fixtures', 'pm'); -// Disabling tests on Windows as: +// Disabling some tests on Windows as: // "Windows does not support sending signals" // https://nodejs.org/api/process.html#process_signal_events const describeOrSkipOnWindows = (process.platform === 'win32') ? describe.skip : describe; -// Note: the previous (sinon) test had custom code for SIGUSR1, revisit if required: -// As described at https://nodejs.org/api/process.html#process_signal_events -// this signal will start a debugger and thus the process might output an -// additional error message: -// "Failed to open socket on port 5858, waiting 1000 ms before retrying". +describeOrSkipOnWindows('signals', () => { + test.each(['SIGINT', 'SIGHUP', 'SIGTERM', 'SIGUSR1', 'SIGUSR2'])('when program sent %s then executableSubcommand sent signal too', (signal, done) => { + // Spawn program. The listen subcommand waits for a signal and writes the name of the signal to stdout. + const proc = childProcess.spawn(pmPath, ['listen'], {}); -describeOrSkipOnWindows.each([['SIGINT'], ['SIGHUP'], ['SIGTERM'], ['SIGUSR1'], ['SIGUSR2']])( - 'test signal handling in executableSubcommand', (value) => { - // Slightly tricky test, stick with callback and disable lint warning. - // eslint-disable-next-line jest/no-done-callback - test(`when command killed with ${value} then executableSubcommand receives ${value}`, (done) => { - const pmPath = path.join(__dirname, './fixtures/pm'); + let processOutput = ''; + proc.stdout.on('data', (data) => { + if (processOutput.length === 0) { + // Send signal to program. + proc.kill(`${signal}`); + } + processOutput += data.toString(); + }); + proc.on('close', (code) => { + // Check the child subcommand received the signal too. + expect(processOutput).toBe(`Listening for signal...${signal}`); + done(); + }); + }); - // The child process writes to stdout. - const proc = childProcess.spawn(pmPath, ['listen'], {}); + test('when executable subcommand sent signal then program exit code is non-zero', () => { + const { status } = childProcess.spawnSync(pmPath, ['terminate'], {}); + expect(status).toBeGreaterThan(0); + }); - let processOutput = ''; - proc.stdout.on('data', (data) => { - if (processOutput.length === 0) { - proc.kill(`${value}`); - } - processOutput += data.toString(); - }); - proc.on('close', (code) => { - expect(processOutput).toBe(`Listening for signal...${value}`); - done(); - }); - }); + test('when command has exitOverride and executable subcommand sent signal then exit code is non-zero', () => { + const { status } = childProcess.spawnSync(pmPath, ['exit-override', 'terminate'], {}); + expect(status).toBeGreaterThan(0); + }); + + // Not a signal test, but closely related code so adding here. + test('when command has exitOverride and executable subcommand fails then program exit code is subcommand exit code', () => { + const { status } = childProcess.spawnSync(pmPath, ['exit-override', 'fail'], {}); + expect(status).toEqual(42); }); +}); diff --git a/tests/command.positionalOptions.test.js b/tests/command.positionalOptions.test.js index d130b7835..82011e136 100644 --- a/tests/command.positionalOptions.test.js +++ b/tests/command.positionalOptions.test.js @@ -362,13 +362,25 @@ describe('program with action handler and positionalOptions and subcommand', () // ------------------------------------------------------------------------------ -test('when program not positional and turn on passthrough in subcommand then error', () => { - const program = new commander.Command(); - const sub = program.command('sub'); +describe('broken passThrough', () => { + test('when program not positional and turn on passThroughOptions in subcommand then error', () => { + const program = new commander.Command(); + const sub = program.command('sub'); + + expect(() => { + sub.passThroughOptions(); + }).toThrow(); + }); - expect(() => { - sub.passThroughOptions(); - }).toThrow(); + test('when program not positional and add subcommand with passThroughOptions then error', () => { + const program = new commander.Command(); + const sub = new commander.Command('sub') + .passThroughOptions(); + + expect(() => { + program.addCommand(sub); + }).toThrow(); + }); }); // ------------------------------------------------------------------------------ diff --git a/tests/command.registerClash.test.js b/tests/command.registerClash.test.js new file mode 100644 index 000000000..4930ecccc --- /dev/null +++ b/tests/command.registerClash.test.js @@ -0,0 +1,49 @@ +const { Command } = require('../'); + +test('when command name conflicts with existing name then throw', () => { + expect(() => { + const program = new Command(); + program.command('one'); + program.command('one'); + }).toThrow('cannot add command'); +}); + +test('when command name conflicts with existing alias then throw', () => { + expect(() => { + const program = new Command(); + program.command('one').alias('1'); + program.command('1'); + }).toThrow('cannot add command'); +}); + +test('when command alias conflicts with existing name then throw', () => { + expect(() => { + const program = new Command(); + program.command('one'); + program.command('1').alias('one'); + }).toThrow('cannot add alias'); +}); + +test('when command alias conflicts with existing alias then throw', () => { + expect(() => { + const program = new Command(); + program.command('one').alias('1'); + program.command('unity').alias('1'); + }).toThrow('cannot add alias'); +}); + +test('when .addCommand name conflicts with existing name then throw', () => { + expect(() => { + const program = new Command(); + program.command('one'); + program.addCommand(new Command('one')); + }).toThrow('cannot add command'); +}); + +test('when .addCommand alias conflicts with existing name then throw', () => { + expect(() => { + const program = new Command(); + program.command('one'); + program.addCommand(new Command('unity').alias('one')); + }).toThrow('cannot add command'); +}); diff --git a/tests/commander.configureCommand.test.js b/tests/commander.configureCommand.test.js index 9c5a72d03..60940ec18 100644 --- a/tests/commander.configureCommand.test.js +++ b/tests/commander.configureCommand.test.js @@ -85,10 +85,10 @@ test('when storeOptionsAsProperties() after adding option then throw', () => { }).toThrow(); }); -// test('when storeOptionsAsProperties() after setting option value then throw', () => { -// const program = new commander.Command(); -// program.setOptionValue('foo', 'bar'); -// expect(() => { -// program.storeOptionsAsProperties(); -// }).toThrow(); -// }); +test('when storeOptionsAsProperties() after setting option value then throw', () => { + const program = new commander.Command(); + program.setOptionValue('foo', 'bar'); + expect(() => { + program.storeOptionsAsProperties(); + }).toThrow(); +}); diff --git a/tests/fixtures-extensions/pm.js b/tests/fixtures-extensions/pm.js index 8aff56027..d05bb2a82 100644 --- a/tests/fixtures-extensions/pm.js +++ b/tests/fixtures-extensions/pm.js @@ -1,6 +1,6 @@ #!/usr/bin/env node -const program = require('../../'); +const { program } = require('../../'); program .command('try-ts', 'test file extension lookup') diff --git a/tests/fixtures/inspect.js b/tests/fixtures/inspect.js index 6ef39b047..43782b4ea 100644 --- a/tests/fixtures/inspect.js +++ b/tests/fixtures/inspect.js @@ -1,6 +1,6 @@ #!/usr/bin/env node -const program = require('../../'); +const { program } = require('../../'); process.env.FORCE_COLOR = 0; // work-around bug in Jest: https://github.com/jestjs/jest/issues/14391 diff --git a/tests/fixtures/pm b/tests/fixtures/pm index 2890430e9..1e7cd302e 100755 --- a/tests/fixtures/pm +++ b/tests/fixtures/pm @@ -1,8 +1,9 @@ #!/usr/bin/env node -process.env.FORCE_COLOR = 0; // work-around bug in Jest: https://github.com/jestjs/jest/issues/14391 +const path = require('node:path'); +const { program } = require('../../'); -var program = require('../../'); +process.env.FORCE_COLOR = 0; // work-around bug in Jest: https://github.com/jestjs/jest/issues/14391 program .version('0.0.1') @@ -17,4 +18,14 @@ program .command('specifyInstall', 'specify install subcommand', { executableFile: 'pm-install' }) .command('specifyPublish', 'specify publish subcommand', { executableFile: 'pm-publish' }) .command('silent', 'silently succeed') + .command('fail', 'exit with non-zero status code') + .command('terminate', 'terminate due to signal'); + +program + .command('exit-override') + .exitOverride((err) => { process.exit(err.exitCode); }) + .command('fail', 'exit with non-zero status code', { executableFile: path.join(__dirname, 'pm-fail.js') }) + .command('terminate', 'terminate due to signal', { executableFile: path.join(__dirname, 'pm-terminate.js') }); + +program .parse(process.argv); diff --git a/tests/fixtures/pm-cache.js b/tests/fixtures/pm-cache.js index 121eca247..58346dcf2 100644 --- a/tests/fixtures/pm-cache.js +++ b/tests/fixtures/pm-cache.js @@ -1,4 +1,4 @@ -const program = require('../../'); +const { program } = require('../../'); program .command('clear', 'clear the cache') diff --git a/tests/fixtures/pm-fail.js b/tests/fixtures/pm-fail.js new file mode 100644 index 000000000..6427ca060 --- /dev/null +++ b/tests/fixtures/pm-fail.js @@ -0,0 +1 @@ +process.exit(42); diff --git a/tests/fixtures/pm-terminate.js b/tests/fixtures/pm-terminate.js new file mode 100644 index 000000000..70066ae49 --- /dev/null +++ b/tests/fixtures/pm-terminate.js @@ -0,0 +1 @@ +process.kill(process.pid, 'SIGINT'); diff --git a/tests/options.registerClash.test.js b/tests/options.registerClash.test.js new file mode 100644 index 000000000..b5d531379 --- /dev/null +++ b/tests/options.registerClash.test.js @@ -0,0 +1,59 @@ +const { Command, Option } = require('../'); + +describe('.option()', () => { + test('when short option flag conflicts then throws', () => { + expect(() => { + const program = new Command(); + program + .option('-c, --cheese ', 'cheese type') + .option('-c, --conflict'); + }).toThrow('Cannot add option'); + }); + + test('when long option flag conflicts then throws', () => { + expect(() => { + const program = new Command(); + program + .option('-c, --cheese ', 'cheese type') + .option('-H, --cheese'); + }).toThrow('Cannot add option'); + }); + + test('when use help options separately then does not throw', () => { + expect(() => { + const program = new Command(); + program + .option('-h, --help', 'display help'); + }).not.toThrow(); + }); + + test('when reuse flags in subcommand then does not throw', () => { + expect(() => { + const program = new Command(); + program + .option('e, --example'); + program.command('sub') + .option('e, --example'); + }).not.toThrow(); + }); +}); + +describe('.addOption()', () => { + test('when short option flags conflicts then throws', () => { + expect(() => { + const program = new Command(); + program + .option('-c, --cheese ', 'cheese type') + .addOption(new Option('-c, --conflict')); + }).toThrow('Cannot add option'); + }); + + test('when long option flags conflicts then throws', () => { + expect(() => { + const program = new Command(); + program + .option('-c, --cheese ', 'cheese type') + .addOption(new Option('-H, --cheese')); + }).toThrow('Cannot add option'); + }); +}); diff --git a/tests/program.test.js b/tests/program.test.js index 3d5faaf82..51c1b0ee8 100644 --- a/tests/program.test.js +++ b/tests/program.test.js @@ -1,20 +1,67 @@ -const commander = require('../'); +const { + program, + Command, + Option, + Argument, + Help, + CommanderError, + InvalidArgumentError, + InvalidOptionArgumentError, + createCommand, + createOption, + createArgument +} = require('../index.js'); // Do some testing of the default export(s). +// Similar tests to ts-imports.test.ts and esm-imports-test.js. -test('when require commander then is a Command (default export of global)', () => { - // Deprecated global command - const program = commander; - expect(program.constructor.name).toBe('Command'); +/* eslint jest/expect-expect: ["error", { "assertFunctionNames": ["expect", "checkClass"] }] */ + +function checkClass(obj, name) { + expect(typeof obj).toEqual('object'); + expect(obj.constructor.name).toEqual(name); +} + +test('program', () => { + checkClass(program, 'Command'); +}); + +test('Command', () => { + checkClass(new Command('name'), 'Command'); +}); + +test('Option', () => { + checkClass(new Option('-e, --example', 'description'), 'Option'); +}); + +test('Argument', () => { + checkClass(new Argument('', 'description'), 'Argument'); +}); + +test('Help', () => { + checkClass(new Help(), 'Help'); +}); + +test('CommanderError', () => { + checkClass(new CommanderError(1, 'code', 'failed'), 'CommanderError'); +}); + +test('InvalidArgumentError', () => { + checkClass(new InvalidArgumentError('failed'), 'InvalidArgumentError'); +}); + +test('InvalidOptionArgumentError', () => { // Deprecated + checkClass(new InvalidOptionArgumentError('failed'), 'InvalidArgumentError'); +}); + +test('createCommand', () => { + checkClass(createCommand('foo'), 'Command'); }); -test('when require commander then has program (named export of global)', () => { - // program added in v5 - const program = commander.program; - expect(program.constructor.name).toBe('Command'); +test('createOption', () => { + checkClass(createOption('-e, --example', 'description'), 'Option'); }); -test('when require commander then has newable Command', () => { - const cmd = new commander.Command(); - expect(cmd.constructor.name).toBe('Command'); +test('createArgument', () => { + checkClass(createArgument('', 'description'), 'Argument'); }); diff --git a/tests/ts-imports.test.ts b/tests/ts-imports.test.ts index 82cfbc1af..e766bcb5f 100644 --- a/tests/ts-imports.test.ts +++ b/tests/ts-imports.test.ts @@ -1,18 +1,4 @@ -import { - program, - Command, - Option, - Argument, - Help, - CommanderError, - InvalidArgumentError, - InvalidOptionArgumentError, - createCommand, - createOption, - createArgument -} from '../'; - -import * as commander from '../'; // This does interesting things when esModuleInterop is true! +import { program, Command, Option, CommanderError, InvalidArgumentError, InvalidOptionArgumentError, Help, createCommand } from '../'; // Do some simple checks that expected imports are available at runtime. // Similar tests to esm-imports-test.js @@ -23,97 +9,34 @@ function checkClass(obj: object, name: string): void { expect(obj.constructor.name).toEqual(name); } -describe('named imports', () => { - test('program', () => { - checkClass(program, 'Command'); - }); - - test('Command', () => { - checkClass(new Command('name'), 'Command'); - }); - - test('Option', () => { - checkClass(new Option('-e, --example', 'description'), 'Option'); - }); - - test('Argument', () => { - checkClass(new Argument('', 'description'), 'Argument'); - }); - - test('Help', () => { - checkClass(new Help(), 'Help'); - }); - - test('CommanderError', () => { - checkClass(new CommanderError(1, 'code', 'failed'), 'CommanderError'); - }); - - test('InvalidArgumentError', () => { - checkClass(new InvalidArgumentError('failed'), 'InvalidArgumentError'); - }); - - test('InvalidOptionArgumentError', () => { // Deprecated - checkClass(new InvalidOptionArgumentError('failed'), 'InvalidArgumentError'); - }); - - test('createCommand', () => { - checkClass(createCommand('foo'), 'Command'); - }); - - test('createOption', () => { - checkClass(createOption('-e, --example', 'description'), 'Option'); - }); - - test('createArgument', () => { - checkClass(createArgument('', 'description'), 'Argument'); - }); +test('program', () => { + checkClass(program, 'Command'); }); -describe('import * as commander', () => { - test('program', () => { - checkClass(commander.program, 'Command'); - }); - - test('Command', () => { - checkClass(new commander.Command('name'), 'Command'); - }); - - test('Option', () => { - checkClass(new commander.Option('-e, --example', 'description'), 'Option'); - }); - - test('Argument', () => { - checkClass(new commander.Argument('', 'description'), 'Argument'); - }); - - test('Help', () => { - checkClass(new commander.Help(), 'Help'); - }); - - test('CommanderError', () => { - checkClass(new commander.CommanderError(1, 'code', 'failed'), 'CommanderError'); - }); +test('createCommand', () => { + checkClass(createCommand(), 'Command'); +}); - test('InvalidArgumentError', () => { - checkClass(new commander.InvalidArgumentError('failed'), 'InvalidArgumentError'); - }); +test('Command', () => { + checkClass(new Command('name'), 'Command'); +}); - test('InvalidOptionArgumentError', () => { // Deprecated - checkClass(new commander.InvalidOptionArgumentError('failed'), 'InvalidArgumentError'); - }); +test('Option', () => { + checkClass(new Option('-e, --example', 'description'), 'Option'); +}); - // Factory functions are not found if esModuleInterop is true, so comment out tests for now. - // Can uncomment these again when we drop the default export of global program and add the factory functions explicitly. +test('CommanderError', () => { + checkClass(new CommanderError(1, 'code', 'failed'), 'CommanderError'); +}); - // test('createCommand', () => { - // checkClass(commander.createCommand('foo'), 'Command'); - // }); +test('InvalidArgumentError', () => { + checkClass(new InvalidArgumentError('failed'), 'InvalidArgumentError'); +}); - // test('createOption', () => { - // checkClass(commander.createOption('-e, --example', 'description'), 'Option'); - // }); +test('InvalidOptionArgumentError', () => { // Deprecated + checkClass(new InvalidOptionArgumentError('failed'), 'InvalidArgumentError'); +}); - // test('createArgument', () => { - // checkClass(commander.createArgument('', 'description'), 'Argument'); - // }); +test('Help', () => { + checkClass(new Help(), 'Help'); }); diff --git a/typings/index.d.ts b/typings/index.d.ts index e77cb1bf3..632511c18 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -419,18 +419,27 @@ export class Command { arguments(names: string): this; /** - * Override default decision whether to add implicit help command. + * Customise or override default help command. By default a help command is automatically added if your command has subcommands. * * @example + * ```ts + * program.helpCommand('help [cmd]'); + * program.helpCommand('help [cmd]', 'show help'); + * program.helpCommand(false); // suppress default help command + * program.helpCommand(true); // add help command even if no subcommands * ``` - * addHelpCommand() // force on - * addHelpCommand(false); // force off - * addHelpCommand('help [cmd]', 'display help for [cmd]'); // force on with custom details - * ``` - * - * @returns `this` command for chaining */ - addHelpCommand(enableOrNameAndArgs?: string | boolean, description?: string): this; + helpCommand(nameAndArgs: string, description?: string): this; + helpCommand(enable: boolean): this; + + /** + * Add prepared custom help command. + */ + addHelpCommand(cmd: Command): this; + /** @deprecated since v12, instead use helpCommand */ + addHelpCommand(nameAndArgs: string, description?: string): this; + /** @deprecated since v12, instead use helpCommand */ + addHelpCommand(enable?: boolean): this; /** * Add hook for life cycle event. @@ -838,6 +847,12 @@ export class Command { */ helpOption(flags?: string | boolean, description?: string): this; + /** + * Supply your own option to use for the built-in help option. + * This is an alternative to using helpOption() to customise the flags and description etc. + */ + addHelpOption(option: Option): this; + /** * Output help information and exit. * diff --git a/typings/index.test-d.ts b/typings/index.test-d.ts index 22706982b..12d621ea5 100644 --- a/typings/index.test-d.ts +++ b/typings/index.test-d.ts @@ -59,11 +59,19 @@ expectType(program.argument('[value]', 'description', parseFl expectType(program.arguments(' [env]')); // addHelpCommand +expectType(program.addHelpCommand(new commander.Command('assist'))); +// Deprecated uses expectType(program.addHelpCommand()); expectType(program.addHelpCommand(false)); expectType(program.addHelpCommand(true)); -expectType(program.addHelpCommand('compress ')); -expectType(program.addHelpCommand('compress ', 'compress target file')); +expectType(program.addHelpCommand('assist [cmd]')); +expectType(program.addHelpCommand('assist [file]', 'display help')); + +// helpCommand +expectType(program.helpCommand(false)); +expectType(program.helpCommand(true)); +expectType(program.helpCommand('assist [cmd]')); +expectType(program.helpCommand('assist [file]', 'display help')); // exitOverride expectType(program.exitOverride()); @@ -302,6 +310,9 @@ expectType(program.helpOption('-h,--help', 'custom descriptio expectType(program.helpOption(undefined, 'custom description')); expectType(program.helpOption(false)); +// addHelpOption +expectType(program.addHelpOption(new commander.Option('-h,--help'))); + // addHelpText expectType(program.addHelpText('after', 'text')); expectType(program.addHelpText('afterAll', 'text'));