From cd4338b15234d0a95ec7ed1193c979f20ffacd97 Mon Sep 17 00:00:00 2001 From: Wee Bit Date: Thu, 17 Aug 2023 10:13:27 +0200 Subject: [PATCH] Use @package instead of @api private in JSDoc Fixes #1949 --- lib/argument.js | 4 ++-- lib/command.js | 62 ++++++++++++++++++++++++------------------------- lib/option.js | 12 +++++----- 3 files changed, 39 insertions(+), 39 deletions(-) diff --git a/lib/argument.js b/lib/argument.js index 51b967616..aac92fcbf 100644 --- a/lib/argument.js +++ b/lib/argument.js @@ -50,7 +50,7 @@ class Argument { } /** - * @api private + * @package */ _concatValue(value, previous) { @@ -131,7 +131,7 @@ class Argument { * * @param {Argument} arg * @return {string} - * @api private + * @package */ function humanReadableArgName(arg) { diff --git a/lib/command.js b/lib/command.js index 2db552762..bbe2f0351 100644 --- a/lib/command.js +++ b/lib/command.js @@ -380,7 +380,7 @@ class Command extends EventEmitter { /** * @return {boolean} - * @api private + * @package */ _hasImplicitHelpCommand() { @@ -443,7 +443,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 + * @package */ _exit(exitCode, code, message) { @@ -581,7 +581,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Internal implementation shared by .option() and .requiredOption() * - * @api private + * @package */ _optionEx(config, flags, description, fn, defaultValue) { if (typeof flags === 'object' && flags instanceof Option) { @@ -839,7 +839,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 + * @package */ _prepareUserArgs(argv, parseOptions) { @@ -942,7 +942,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Execute a sub-command executable. * - * @api private + * @package */ _executeSubCommand(subcommand, args) { @@ -1067,7 +1067,7 @@ Expecting one of '${allowedValues.join("', '")}'`); } /** - * @api private + * @package */ _dispatchSubcommand(commandName, operands, unknown) { @@ -1090,7 +1090,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Invoke help directly if possible, or dispatch if necessary. * e.g. help foo * - * @api private + * @package */ _dispatchHelpCommand(subcommandName) { @@ -1109,7 +1109,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Check this.args against expected this._args. * - * @api private + * @package */ _checkNumberOfArguments() { @@ -1131,7 +1131,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Process this.args using this._args and save as this.processedArgs! * - * @api private + * @package */ _processArguments() { @@ -1186,7 +1186,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * @param {Promise|undefined} promise * @param {Function} fn * @return {Promise|undefined} - * @api private + * @package */ _chainOrCall(promise, fn) { @@ -1204,7 +1204,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * @param {Promise|undefined} promise * @param {string} event * @return {Promise|undefined} - * @api private + * @package */ _chainOrCallHooks(promise, event) { @@ -1236,7 +1236,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * @param {Command} subCommand * @param {string} event * @return {Promise|undefined} - * @api private + * @package */ _chainOrCallSubCommandHook(promise, subCommand, event) { @@ -1255,7 +1255,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Process arguments in context of this command. * Returns action result, in case it is a promise. * - * @api private + * @package */ _parseCommand(operands, unknown) { @@ -1341,7 +1341,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Find matching command. * - * @api private + * @package */ _findCommand(name) { if (!name) return undefined; @@ -1353,7 +1353,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * * @param {string} arg * @return {Option | undefined} - * @api private + * @package */ _findOption(arg) { @@ -1364,7 +1364,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 + * @package */ _checkForMissingMandatoryOptions() { @@ -1381,7 +1381,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Display an error message if conflicting options are used together in this. * - * @api private + * @package */ _checkForConflictingLocalOptions() { const definedNonDefaultOptions = this.options.filter( @@ -1412,7 +1412,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 + * @package */ _checkForConflictingOptions() { // Walk up hierarchy so can call in subcommand after checking for displaying help. @@ -1616,7 +1616,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 + * @package */ _parseOptionsEnv() { this.options.forEach((option) => { @@ -1643,7 +1643,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Apply any implied option values, if option is undefined or default value. * - * @api private + * @package */ _parseOptionsImplied() { const dualHelper = new DualOptions(this.options); @@ -1671,7 +1671,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Argument `name` is missing. * * @param {string} name - * @api private + * @package */ missingArgument(name) { @@ -1683,7 +1683,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * `Option` is missing an argument. * * @param {Option} option - * @api private + * @package */ optionMissingArgument(option) { @@ -1695,7 +1695,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * `Option` does not have a value, and is a mandatory option. * * @param {Option} option - * @api private + * @package */ missingMandatoryOptionValue(option) { @@ -1708,7 +1708,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * * @param {Option} option * @param {Option} conflictingOption - * @api private + * @package */ _conflictingOption(option, conflictingOption) { // The calling code does not know whether a negated option is the source of the @@ -1745,7 +1745,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Unknown option `flag`. * * @param {string} flag - * @api private + * @package */ unknownOption(flag) { @@ -1774,7 +1774,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * Excess arguments, more than expected. * * @param {string[]} receivedArgs - * @api private + * @package */ _excessArguments(receivedArgs) { @@ -1790,7 +1790,7 @@ Expecting one of '${allowedValues.join("', '")}'`); /** * Unknown command. * - * @api private + * @package */ unknownCommand() { @@ -2003,7 +2003,7 @@ Expecting one of '${allowedValues.join("', '")}'`); } /** - * @api private + * @package */ _getHelpContext(contextOptions) { @@ -2134,7 +2134,7 @@ Expecting one of '${allowedValues.join("', '")}'`); * * @param {Command} cmd - command to output help for * @param {Array} args - array of options to search for help flags - * @api private + * @package */ function outputHelpIfRequested(cmd, args) { @@ -2151,7 +2151,7 @@ function outputHelpIfRequested(cmd, args) { * * @param {string[]} args - array of arguments from node.execArgv * @returns {string[]} - * @api private + * @package */ function incrementNodeInspectorPort(args) { @@ -2196,7 +2196,7 @@ function incrementNodeInspectorPort(args) { /** * @param {Command} startCommand * @returns {Command[]} - * @api private + * @package */ function getCommandAndParents(startCommand) { diff --git a/lib/option.js b/lib/option.js index bfba9410b..2370c547e 100644 --- a/lib/option.js +++ b/lib/option.js @@ -158,7 +158,7 @@ class Option { } /** - * @api private + * @package */ _concatValue(value, previous) { @@ -209,7 +209,7 @@ class Option { * as a object attribute key. * * @return {string} - * @api private + * @package */ attributeName() { @@ -221,7 +221,7 @@ class Option { * * @param {string} arg * @return {boolean} - * @api private + * @package */ is(arg) { @@ -234,7 +234,7 @@ class Option { * Options are one of boolean, negated, required argument, or optional argument. * * @return {boolean} - * @api private + * @package */ isBoolean() { @@ -294,7 +294,7 @@ class DualOptions { * * @param {string} str * @return {string} - * @api private + * @package */ function camelcase(str) { @@ -306,7 +306,7 @@ function camelcase(str) { /** * Split the short and long flag out of something like '-m,--mixed ' * - * @api private + * @package */ function splitOptionFlags(flags) {