/var/www/greso.tech/server/nsm/node_modules/yargs/build/lib
Edit: /var/www/greso.tech/server/nsm/node_modules/yargs/build/lib/yargs-factory.js (77635B)
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _YargsInstance_command, _YargsInstance_cwd, _YargsInstance_context, _YargsInstance_completion, _YargsInstance_completionCommand, _YargsInstance_defaultShowHiddenOpt, _YargsInstance_exitError, _YargsInstance_detectLocale, _YargsInstance_emittedWarnings, _YargsInstance_exitProcess, _YargsInstance_frozens, _YargsInstance_globalMiddleware, _YargsInstance_groups, _YargsInstance_hasOutput, _YargsInstance_helpOpt, _YargsInstance_isGlobalContext, _YargsInstance_logger, _YargsInstance_output, _YargsInstance_options, _YargsInstance_parentRequire, _YargsInstance_parserConfig, _YargsInstance_parseFn, _YargsInstance_parseContext, _YargsInstance_pkgs, _YargsInstance_preservedGroups, _YargsInstance_processArgs, _YargsInstance_recommendCommands, _YargsInstance_shim, _YargsInstance_strict, _YargsInstance_strictCommands, _YargsInstance_strictOptions, _YargsInstance_usage, _YargsInstance_usageConfig, _YargsInstance_versionOpt, _YargsInstance_validation;
import { command as Command, } from './command.js';
import { assertNotStrictEqual, assertSingleKey, objectKeys, } from './typings/common-types.js';
import { YError } from './yerror.js';
import { usage as Usage } from './usage.js';
import { argsert } from './argsert.js';
import { completion as Completion, } from './completion.js';
import { validation as Validation, } from './validation.js';
import { objFilter } from './utils/obj-filter.js';
import { applyExtends } from './utils/apply-extends.js';
import { applyMiddleware, GlobalMiddleware, } from './middleware.js';
import { isPromise } from './utils/is-promise.js';
import { maybeAsyncResult } from './utils/maybe-async-result.js';
import setBlocking from './utils/set-blocking.js';
export function YargsFactory(_shim) {
return (processArgs = [], cwd = _shim.process.cwd(), parentRequire) => {
const yargs = new YargsInstance(processArgs, cwd, parentRequire, _shim);
Object.defineProperty(yargs, 'argv', {
get: () => {
return yargs.parse();
},
enumerable: true,
});
yargs.help();
yargs.version();
return yargs;
};
}
const kCopyDoubleDash = Symbol('copyDoubleDash');
const kCreateLogger = Symbol('copyDoubleDash');
const kDeleteFromParserHintObject = Symbol('deleteFromParserHintObject');
const kEmitWarning = Symbol('emitWarning');
const kFreeze = Symbol('freeze');
const kGetDollarZero = Symbol('getDollarZero');
const kGetParserConfiguration = Symbol('getParserConfiguration');
const kGetUsageConfiguration = Symbol('getUsageConfiguration');
const kGuessLocale = Symbol('guessLocale');
const kGuessVersion = Symbol('guessVersion');
const kParsePositionalNumbers = Symbol('parsePositionalNumbers');
const kPkgUp = Symbol('pkgUp');
const kPopulateParserHintArray = Symbol('populateParserHintArray');
const kPopulateParserHintSingleValueDictionary = Symbol('populateParserHintSingleValueDictionary');
const kPopulateParserHintArrayDictionary = Symbol('populateParserHintArrayDictionary');
const kPopulateParserHintDictionary = Symbol('populateParserHintDictionary');
const kSanitizeKey = Symbol('sanitizeKey');
const kSetKey = Symbol('setKey');
const kUnfreeze = Symbol('unfreeze');
const kValidateAsync = Symbol('validateAsync');
const kGetCommandInstance = Symbol('getCommandInstance');
const kGetContext = Symbol('getContext');
const kGetHasOutput = Symbol('getHasOutput');
const kGetLoggerInstance = Symbol('getLoggerInstance');
const kGetParseContext = Symbol('getParseContext');
const kGetUsageInstance = Symbol('getUsageInstance');
const kGetValidationInstance = Symbol('getValidationInstance');
const kHasParseCallback = Symbol('hasParseCallback');
const kIsGlobalContext = Symbol('isGlobalContext');
const kPostProcess = Symbol('postProcess');
const kRebase = Symbol('rebase');
const kReset = Symbol('reset');
const kRunYargsParserAndExecuteCommands = Symbol('runYargsParserAndExecuteCommands');
const kRunValidation = Symbol('runValidation');
const kSetHasOutput = Symbol('setHasOutput');
const kTrackManuallySetKeys = Symbol('kTrackManuallySetKeys');
export class YargsInstance {
constructor(processArgs = [], cwd, parentRequire, shim) {
this.customScriptName = false;
this.parsed = false;
_YargsInstance_command.set(this, void 0);
_YargsInstance_cwd.set(this, void 0);
_YargsInstance_context.set(this, { commands: [], fullCommands: [] });
_YargsInstance_completion.set(this, null);
_YargsInstance_completionCommand.set(this, null);
_YargsInstance_defaultShowHiddenOpt.set(this, 'show-hidden');
_YargsInstance_exitError.set(this, null);
_YargsInstance_detectLocale.set(this, true);
_YargsInstance_emittedWarnings.set(this, {});
_YargsInstance_exitProcess.set(this, true);
_YargsInstance_frozens.set(this, []);
_YargsInstance_globalMiddleware.set(this, void 0);
_YargsInstance_groups.set(this, {});
_YargsInstance_hasOutput.set(this, false);
_YargsInstance_helpOpt.set(this, null);
_YargsInstance_isGlobalContext.set(this, true);
_YargsInstance_logger.set(this, void 0);
_YargsInstance_output.set(this, '');
_YargsInstance_options.set(this, void 0);
_YargsInstance_parentRequire.set(this, void 0);
_YargsInstance_parserConfig.set(this, {});
_YargsInstance_parseFn.set(this, null);
_YargsInstance_parseContext.set(this, null);
_YargsInstance_pkgs.set(this, {});
_YargsInstance_preservedGroups.set(this, {});
_YargsInstance_processArgs.set(this, void 0);
_YargsInstance_recommendCommands.set(this, false);
_YargsInstance_shim.set(this, void 0);
_YargsInstance_strict.set(this, false);
_YargsInstance_strictCommands.set(this, false);
_YargsInstance_strictOptions.set(this, false);
_YargsInstance_usage.set(this, void 0);
_YargsInstance_usageConfig.set(this, {});
_YargsInstance_versionOpt.set(this, null);
_YargsInstance_validation.set(this, void 0);
__classPrivateFieldSet(this, _YargsInstance_shim, shim, "f");
__classPrivateFieldSet(this, _YargsInstance_processArgs, processArgs, "f");
__classPrivateFieldSet(this, _YargsInstance_cwd, cwd, "f");
__classPrivateFieldSet(this, _YargsInstance_parentRequire, parentRequire, "f");
__classPrivateFieldSet(this, _YargsInstance_globalMiddleware, new GlobalMiddleware(this), "f");
this.$0 = this[kGetDollarZero]();
this[kReset]();
__classPrivateFieldSet(this, _YargsInstance_command, __classPrivateFieldGet(this, _YargsInstance_command, "f"), "f");
__classPrivateFieldSet(this, _YargsInstance_usage, __classPrivateFieldGet(this, _YargsInstance_usage, "f"), "f");
__classPrivateFieldSet(this, _YargsInstance_validation, __classPrivateFieldGet(this, _YargsInstance_validation, "f"), "f");
__classPrivateFieldSet(this, _YargsInstance_options, __classPrivateFieldGet(this, _YargsInstance_options, "f"), "f");
__classPrivateFieldGet(this, _YargsInstance_options, "f").showHiddenOpt = __classPrivateFieldGet(this, _YargsInstance_defaultShowHiddenOpt, "f");
__classPrivateFieldSet(this, _YargsInstance_logger, this[kCreateLogger](), "f");
}
addHelpOpt(opt, msg) {
const defaultHelpOpt = 'help';
argsert('[string|boolean] [string]', [opt, msg], arguments.length);
if (__classPrivateFieldGet(this, _YargsInstance_helpOpt, "f")) {
this[kDeleteFromParserHintObject](__classPrivateFieldGet(this, _YargsInstance_helpOpt, "f"));
__classPrivateFieldSet(this, _YargsInstance_helpOpt, null, "f");
}
if (opt === false && msg === undefined)
return this;
__classPrivateFieldSet(this, _YargsInstance_helpOpt, typeof opt === 'string' ? opt : defaultHelpOpt, "f");
this.boolean(__classPrivateFieldGet(this, _YargsInstance_helpOpt, "f"));
this.describe(__classPrivateFieldGet(this, _YargsInstance_helpOpt, "f"), msg || __classPrivateFieldGet(this, _YargsInstance_usage, "f").deferY18nLookup('Show help'));
return this;
}
help(opt, msg) {
return this.addHelpOpt(opt, msg);
}
addShowHiddenOpt(opt, msg) {
argsert('[string|boolean] [string]', [opt, msg], arguments.length);
if (opt === false && msg === undefined)
return this;
const showHiddenOpt = typeof opt === 'string' ? opt : __classPrivateFieldGet(this, _YargsInstance_defaultShowHiddenOpt, "f");
this.boolean(showHiddenOpt);
this.describe(showHiddenOpt, msg || __classPrivateFieldGet(this, _YargsInstance_usage, "f").deferY18nLookup('Show hidden options'));
__classPrivateFieldGet(this, _YargsInstance_options, "f").showHiddenOpt = showHiddenOpt;
return this;
}
showHidden(opt, msg) {
return this.addShowHiddenOpt(opt, msg);
}
alias(key, value) {
argsert('