npm-check-updates 18.3.1 → 19.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -374,11 +374,11 @@ Options that take no arguments can be negated by prefixing them with `--no-`, e.
374
374
  <td>Log additional information for debugging. Alias for <code>--loglevel</code> verbose.</td>
375
375
  </tr>
376
376
  <tr>
377
- <td>-w, --workspace &lt;s&gt;</td>
377
+ <td>--workspace &lt;s&gt;</td>
378
378
  <td>Run on one or more specified workspaces. Add <code>--no-root</code> to exclude the root project. (default: [])</td>
379
379
  </tr>
380
380
  <tr>
381
- <td>-ws, --workspaces</td>
381
+ <td>-w, --workspaces</td>
382
382
  <td>Run on all workspaces. Add <code>--no-root</code> to exclude the root project.</td>
383
383
  </tr>
384
384
  </table>
package/build/cli.js CHANGED
@@ -1,29 +1,33 @@
1
1
  #!/usr/bin/env node
2
- "use strict";const E=require("./index.js"),Z=require("node:events"),ee=require("node:child_process"),te=require("node:path"),ie=require("node:fs"),ne=require("node:process");var x={},S={},j={},W;function q(){if(W)return j;W=1;class $ extends Error{constructor(s,r,l){super(l),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=s,this.nestedError=void 0}}class w extends ${constructor(s){super(1,"commander.invalidArgument",s),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}return j.CommanderError=$,j.InvalidArgumentError=w,j}var R;function M(){if(R)return S;R=1;const{InvalidArgumentError:$}=q();class w{constructor(r,l){switch(this.description=l||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,r[0]){case"<":this.required=!0,this._name=r.slice(1,-1);break;case"[":this.required=!1,this._name=r.slice(1,-1);break;default:this.required=!0,this._name=r;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(r,l){return l===this.defaultValue||!Array.isArray(l)?[r]:l.concat(r)}default(r,l){return this.defaultValue=r,this.defaultValueDescription=l,this}argParser(r){return this.parseArg=r,this}choices(r){return this.argChoices=r.slice(),this.parseArg=(l,a)=>{if(!this.argChoices.includes(l))throw new $(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(l,a):l},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function y(s){const r=s.name()+(s.variadic===!0?"...":"");return s.required?"<"+r+">":"["+r+"]"}return S.Argument=w,S.humanReadableArgName=y,S}var F={},N={},B;function Q(){if(B)return N;B=1;const{humanReadableArgName:$}=M();class w{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(s){const r=s.commands.filter(a=>!a._hidden),l=s._getHelpCommand();return l&&!l._hidden&&r.push(l),this.sortSubcommands&&r.sort((a,u)=>a.name().localeCompare(u.name())),r}compareOptions(s,r){const l=a=>a.short?a.short.replace(/^-/,""):a.long.replace(/^--/,"");return l(s).localeCompare(l(r))}visibleOptions(s){const r=s.options.filter(a=>!a.hidden),l=s._getHelpOption();if(l&&!l.hidden){const a=l.short&&s._findOption(l.short),u=l.long&&s._findOption(l.long);!a&&!u?r.push(l):l.long&&!u?r.push(s.createOption(l.long,l.description)):l.short&&!a&&r.push(s.createOption(l.short,l.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(s){if(!this.showGlobalOptions)return[];const r=[];for(let l=s.parent;l;l=l.parent){const a=l.options.filter(u=>!u.hidden);r.push(...a)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(s){return s._argsDescription&&s.registeredArguments.forEach(r=>{r.description=r.description||s._argsDescription[r.name()]||""}),s.registeredArguments.find(r=>r.description)?s.registeredArguments:[]}subcommandTerm(s){const r=s.registeredArguments.map(l=>$(l)).join(" ");return s._name+(s._aliases[0]?"|"+s._aliases[0]:"")+(s.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(s){return s.flags}argumentTerm(s){return s.name()}longestSubcommandTermLength(s,r){return r.visibleCommands(s).reduce((l,a)=>Math.max(l,r.subcommandTerm(a).length),0)}longestOptionTermLength(s,r){return r.visibleOptions(s).reduce((l,a)=>Math.max(l,r.optionTerm(a).length),0)}longestGlobalOptionTermLength(s,r){return r.visibleGlobalOptions(s).reduce((l,a)=>Math.max(l,r.optionTerm(a).length),0)}longestArgumentTermLength(s,r){return r.visibleArguments(s).reduce((l,a)=>Math.max(l,r.argumentTerm(a).length),0)}commandUsage(s){let r=s._name;s._aliases[0]&&(r=r+"|"+s._aliases[0]);let l="";for(let a=s.parent;a;a=a.parent)l=a.name()+" "+l;return l+r+" "+s.usage()}commandDescription(s){return s.description()}subcommandDescription(s){return s.summary()||s.description()}optionDescription(s){const r=[];return s.argChoices&&r.push(`choices: ${s.argChoices.map(l=>JSON.stringify(l)).join(", ")}`),s.defaultValue!==void 0&&(s.required||s.optional||s.isBoolean()&&typeof s.defaultValue=="boolean")&&r.push(`default: ${s.defaultValueDescription||JSON.stringify(s.defaultValue)}`),s.presetArg!==void 0&&s.optional&&r.push(`preset: ${JSON.stringify(s.presetArg)}`),s.envVar!==void 0&&r.push(`env: ${s.envVar}`),r.length>0?`${s.description} (${r.join(", ")})`:s.description}argumentDescription(s){const r=[];if(s.argChoices&&r.push(`choices: ${s.argChoices.map(l=>JSON.stringify(l)).join(", ")}`),s.defaultValue!==void 0&&r.push(`default: ${s.defaultValueDescription||JSON.stringify(s.defaultValue)}`),r.length>0){const l=`(${r.join(", ")})`;return s.description?`${s.description} ${l}`:l}return s.description}formatHelp(s,r){const l=r.padWidth(s,r),a=r.helpWidth||80,u=2,A=2;function p(t,n){if(n){const o=`${t.padEnd(l+A)}${n}`;return r.wrap(o,a-u,l+A)}return t}function _(t){return t.join(`
3
- `).replace(/^/gm," ".repeat(u))}let h=[`Usage: ${r.commandUsage(s)}`,""];const d=r.commandDescription(s);d.length>0&&(h=h.concat([r.wrap(d,a,0),""]));const C=r.visibleArguments(s).map(t=>p(r.argumentTerm(t),r.argumentDescription(t)));C.length>0&&(h=h.concat(["Arguments:",_(C),""]));const g=r.visibleOptions(s).map(t=>p(r.optionTerm(t),r.optionDescription(t)));if(g.length>0&&(h=h.concat(["Options:",_(g),""])),this.showGlobalOptions){const t=r.visibleGlobalOptions(s).map(n=>p(r.optionTerm(n),r.optionDescription(n)));t.length>0&&(h=h.concat(["Global Options:",_(t),""]))}const e=r.visibleCommands(s).map(t=>p(r.subcommandTerm(t),r.subcommandDescription(t)));return e.length>0&&(h=h.concat(["Commands:",_(e),""])),h.join(`
4
- `)}padWidth(s,r){return Math.max(r.longestOptionTermLength(s,r),r.longestGlobalOptionTermLength(s,r),r.longestSubcommandTermLength(s,r),r.longestArgumentTermLength(s,r))}wrap(s,r,l,a=40){const u=" \\f\\t\\v   -    \uFEFF",A=new RegExp(`[\\n][${u}]+`);if(s.match(A))return s;const p=r-l;if(p<a)return s;const _=s.slice(0,l),h=s.slice(l).replace(`\r
5
- `,`
6
- `),d=" ".repeat(l),g="\\s",e=new RegExp(`
7
- |.{1,${p-1}}([${g}]|$)|[^${g}]+?([${g}]|$)`,"g"),t=h.match(e)||[];return _+t.map((n,o)=>n===`
8
- `?"":(o>0?d:"")+n.trimEnd()).join(`
9
- `)}}return N.Help=w,N}var P={},U;function X(){if(U)return P;U=1;const{InvalidArgumentError:$}=q();class w{constructor(a,u){this.flags=a,this.description=u||"",this.required=a.includes("<"),this.optional=a.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(a),this.mandatory=!1;const A=r(a);this.short=A.shortFlag,this.long=A.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(a,u){return this.defaultValue=a,this.defaultValueDescription=u,this}preset(a){return this.presetArg=a,this}conflicts(a){return this.conflictsWith=this.conflictsWith.concat(a),this}implies(a){let u=a;return typeof a=="string"&&(u={[a]:!0}),this.implied=Object.assign(this.implied||{},u),this}env(a){return this.envVar=a,this}argParser(a){return this.parseArg=a,this}makeOptionMandatory(a=!0){return this.mandatory=!!a,this}hideHelp(a=!0){return this.hidden=!!a,this}_concatValue(a,u){return u===this.defaultValue||!Array.isArray(u)?[a]:u.concat(a)}choices(a){return this.argChoices=a.slice(),this.parseArg=(u,A)=>{if(!this.argChoices.includes(u))throw new $(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(u,A):u},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return s(this.name().replace(/^no-/,""))}is(a){return this.short===a||this.long===a}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class y{constructor(a){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,a.forEach(u=>{u.negate?this.negativeOptions.set(u.attributeName(),u):this.positiveOptions.set(u.attributeName(),u)}),this.negativeOptions.forEach((u,A)=>{this.positiveOptions.has(A)&&this.dualOptions.add(A)})}valueFromOption(a,u){const A=u.attributeName();if(!this.dualOptions.has(A))return!0;const p=this.negativeOptions.get(A).presetArg,_=p!==void 0?p:!1;return u.negate===(_===a)}}function s(l){return l.split("-").reduce((a,u)=>a+u[0].toUpperCase()+u.slice(1))}function r(l){let a,u;const A=l.split(/[ |,]+/);return A.length>1&&!/^[[<]/.test(A[1])&&(a=A.shift()),u=A.shift(),!a&&/^-[^-]$/.test(u)&&(a=u,u=void 0),{shortFlag:a,longFlag:u}}return P.Option=w,P.DualOptions=y,P}var T={},G;function re(){if(G)return T;G=1;const $=3;function w(s,r){if(Math.abs(s.length-r.length)>$)return Math.max(s.length,r.length);const l=[];for(let a=0;a<=s.length;a++)l[a]=[a];for(let a=0;a<=r.length;a++)l[0][a]=a;for(let a=1;a<=r.length;a++)for(let u=1;u<=s.length;u++){let A=1;s[u-1]===r[a-1]?A=0:A=1,l[u][a]=Math.min(l[u-1][a]+1,l[u][a-1]+1,l[u-1][a-1]+A),u>1&&a>1&&s[u-1]===r[a-2]&&s[u-2]===r[a-1]&&(l[u][a]=Math.min(l[u][a],l[u-2][a-2]+1))}return l[s.length][r.length]}function y(s,r){if(!r||r.length===0)return"";r=Array.from(new Set(r));const l=s.startsWith("--");l&&(s=s.slice(2),r=r.map(p=>p.slice(2)));let a=[],u=$;const A=.4;return r.forEach(p=>{if(p.length<=1)return;const _=w(s,p),h=Math.max(s.length,p.length);(h-_)/h>A&&(_<u?(u=_,a=[p]):_===u&&a.push(p))}),a.sort((p,_)=>p.localeCompare(_)),l&&(a=a.map(p=>`--${p}`)),a.length>1?`
10
- (Did you mean one of ${a.join(", ")}?)`:a.length===1?`
11
- (Did you mean ${a[0]}?)`:""}return T.suggestSimilar=y,T}var L;function se(){if(L)return F;L=1;const $=Z.EventEmitter,w=ee,y=te,s=ie,r=ne,{Argument:l,humanReadableArgName:a}=M(),{CommanderError:u}=q(),{Help:A}=Q(),{Option:p,DualOptions:_}=X(),{suggestSimilar:h}=re();class d extends ${constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:t=>r.stdout.write(t),writeErr:t=>r.stderr.write(t),getOutHelpWidth:()=>r.stdout.isTTY?r.stdout.columns:void 0,getErrHelpWidth:()=>r.stderr.isTTY?r.stderr.columns:void 0,outputError:(t,n)=>n(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){const e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let o=t,i=n;typeof o=="object"&&o!==null&&(i=o,o=null),i=i||{};const[,c,m]=e.match(/([^ ]+) *(.*)/),f=this.createCommand(c);return o&&(f.description(o),f._executableHandler=!0),i.isDefault&&(this._defaultCommandName=f._name),f._hidden=!!(i.noHelp||i.hidden),f._executableFile=i.executableFile||null,m&&f.arguments(m),this._registerCommand(f),f.parent=this,f.copyInheritedSettings(this),o?this:f}createCommand(e){return new d(e)}createHelp(){return Object.assign(new A,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
12
- - specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new l(e,t)}argument(e,t,n,o){const i=this.createArgument(e,t);return typeof n=="function"?i.default(o).argParser(n):i.default(n),this.addArgument(i),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){const t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,this;e=e??"help [command]";const[,n,o]=e.match(/([^ ]+) *(.*)/),i=t??"display help for command",c=this.createCommand(n);return c.helpOption(!1),o&&c.arguments(o),i&&c.description(i),this._addImplicitHelpCommand=!0,this._helpCommand=c,this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){const n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
13
- Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,n){this._exitCallback&&this._exitCallback(new u(e,t,n)),r.exit(e)}action(e){const t=n=>{const o=this.registeredArguments.length,i=n.slice(0,o);return this._storeOptionsAsProperties?i[o]=this:i[o]=this.opts(),i.push(this),e.apply(this,i)};return this._actionHandler=t,this}createOption(e,t){return new p(e,t)}_callParseArg(e,t,n,o){try{return e.parseArg(t,n)}catch(i){if(i.code==="commander.invalidArgument"){const c=`${o} ${i.message}`;this.error(c,{exitCode:i.exitCode,code:i.code})}throw i}}_registerOption(e){const t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){const n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
14
- - already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){const t=o=>[o.name()].concat(o.aliases()),n=t(e).find(o=>this._findCommand(o));if(n){const o=t(this._findCommand(n)).join("|"),i=t(e).join("|");throw new Error(`cannot add command '${i}' as already have command '${o}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);const t=e.name(),n=e.attributeName();if(e.negate){const i=e.long.replace(/^--no-/,"--");this._findOption(i)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");const o=(i,c,m)=>{i==null&&e.presetArg!==void 0&&(i=e.presetArg);const f=this.getOptionValue(n);i!==null&&e.parseArg?i=this._callParseArg(e,i,f,c):i!==null&&e.variadic&&(i=e._concatValue(i,f)),i==null&&(e.negate?i=!1:e.isBoolean()||e.optional?i=!0:i=""),this.setOptionValueWithSource(n,i,m)};return this.on("option:"+t,i=>{const c=`error: option '${e.flags}' argument '${i}' is invalid.`;o(i,c,"cli")}),e.envVar&&this.on("optionEnv:"+t,i=>{const c=`error: option '${e.flags}' value '${i}' from env '${e.envVar}' is invalid.`;o(i,c,"env")}),this}_optionEx(e,t,n,o,i){if(typeof t=="object"&&t instanceof p)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");const c=this.createOption(t,n);if(c.makeOptionMandatory(!!e.mandatory),typeof o=="function")c.default(i).argParser(o);else if(o instanceof RegExp){const m=o;o=(f,b)=>{const O=m.exec(f);return O?O[0]:b},c.default(i).argParser(o)}else c.default(o);return this.addOption(c)}option(e,t,n,o){return this._optionEx({},e,t,n,o)}requiredOption(e,t,n,o){return this._optionEx({mandatory:!0},e,t,n,o)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_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)`)}storeOptionsAsProperties(e=!0){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");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,n){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(t=n.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){r.versions?.electron&&(t.from="electron");const o=r.execArgv??[];(o.includes("-e")||o.includes("--eval")||o.includes("-p")||o.includes("--print"))&&(t.from="eval")}e===void 0&&(e=r.argv),this.rawArgs=e.slice();let n;switch(t.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":r.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,t){const n=this._prepareUserArgs(e,t);return this._parseCommand([],n),this}async parseAsync(e,t){const n=this._prepareUserArgs(e,t);return await this._parseCommand([],n),this}_executeSubCommand(e,t){t=t.slice();let n=!1;const o=[".js",".ts",".tsx",".mjs",".cjs"];function i(O,v){const V=y.resolve(O,v);if(s.existsSync(V))return V;if(o.includes(y.extname(v)))return;const k=o.find(D=>s.existsSync(`${V}${D}`));if(k)return`${V}${k}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let c=e._executableFile||`${this._name}-${e._name}`,m=this._executableDir||"";if(this._scriptPath){let O;try{O=s.realpathSync(this._scriptPath)}catch{O=this._scriptPath}m=y.resolve(y.dirname(O),m)}if(m){let O=i(m,c);if(!O&&!e._executableFile&&this._scriptPath){const v=y.basename(this._scriptPath,y.extname(this._scriptPath));v!==this._name&&(O=i(m,`${v}-${e._name}`))}c=O||c}n=o.includes(y.extname(c));let f;r.platform!=="win32"?n?(t.unshift(c),t=C(r.execArgv).concat(t),f=w.spawn(r.argv[0],t,{stdio:"inherit"})):f=w.spawn(c,t,{stdio:"inherit"}):(t.unshift(c),t=C(r.execArgv).concat(t),f=w.spawn(r.execPath,t,{stdio:"inherit"})),f.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(v=>{r.on(v,()=>{f.killed===!1&&f.exitCode===null&&f.kill(v)})});const b=this._exitCallback;f.on("close",O=>{O=O??1,b?b(new u(O,"commander.executeSubCommandAsync","(close)")):r.exit(O)}),f.on("error",O=>{if(O.code==="ENOENT"){const v=m?`searched for local subcommand relative to directory '${m}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",V=`'${c}' does not exist
15
- - if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
2
+ "use strict";const H=require("./index.js"),et=require("node:events"),it=require("node:child_process"),nt=require("node:path"),rt=require("node:fs"),st=require("node:process");var S={},T={},j={},M;function F(){if(M)return j;M=1;class x extends Error{constructor(f,i,r){super(r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=i,this.exitCode=f,this.nestedError=void 0}}class v extends x{constructor(f){super(1,"commander.invalidArgument",f),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}return j.CommanderError=x,j.InvalidArgumentError=v,j}var R;function q(){if(R)return T;R=1;const{InvalidArgumentError:x}=F();class v{constructor(i,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,i[0]){case"<":this.required=!0,this._name=i.slice(1,-1);break;case"[":this.required=!1,this._name=i.slice(1,-1);break;default:this.required=!0,this._name=i;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(i,r){return r===this.defaultValue||!Array.isArray(r)?[i]:(r.push(i),r)}default(i,r){return this.defaultValue=i,this.defaultValueDescription=r,this}argParser(i){return this.parseArg=i,this}choices(i){return this.argChoices=i.slice(),this.parseArg=(r,s)=>{if(!this.argChoices.includes(r))throw new x(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,s):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function E(f){const i=f.name()+(f.variadic===!0?"...":"");return f.required?"<"+i+">":"["+i+"]"}return T.Argument=v,T.humanReadableArgName=E,T}var P={},D={},L;function X(){if(L)return D;L=1;const{humanReadableArgName:x}=q();class v{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(i){this.helpWidth=this.helpWidth??i.helpWidth??80}visibleCommands(i){const r=i.commands.filter(u=>!u._hidden),s=i._getHelpCommand();return s&&!s._hidden&&r.push(s),this.sortSubcommands&&r.sort((u,_)=>u.name().localeCompare(_.name())),r}compareOptions(i,r){const s=u=>u.short?u.short.replace(/^-/,""):u.long.replace(/^--/,"");return s(i).localeCompare(s(r))}visibleOptions(i){const r=i.options.filter(u=>!u.hidden),s=i._getHelpOption();if(s&&!s.hidden){const u=s.short&&i._findOption(s.short),_=s.long&&i._findOption(s.long);!u&&!_?r.push(s):s.long&&!_?r.push(i.createOption(s.long,s.description)):s.short&&!u&&r.push(i.createOption(s.short,s.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(i){if(!this.showGlobalOptions)return[];const r=[];for(let s=i.parent;s;s=s.parent){const u=s.options.filter(_=>!_.hidden);r.push(...u)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(i){return i._argsDescription&&i.registeredArguments.forEach(r=>{r.description=r.description||i._argsDescription[r.name()]||""}),i.registeredArguments.find(r=>r.description)?i.registeredArguments:[]}subcommandTerm(i){const r=i.registeredArguments.map(s=>x(s)).join(" ");return i._name+(i._aliases[0]?"|"+i._aliases[0]:"")+(i.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(i){return i.flags}argumentTerm(i){return i.name()}longestSubcommandTermLength(i,r){return r.visibleCommands(i).reduce((s,u)=>Math.max(s,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(u)))),0)}longestOptionTermLength(i,r){return r.visibleOptions(i).reduce((s,u)=>Math.max(s,this.displayWidth(r.styleOptionTerm(r.optionTerm(u)))),0)}longestGlobalOptionTermLength(i,r){return r.visibleGlobalOptions(i).reduce((s,u)=>Math.max(s,this.displayWidth(r.styleOptionTerm(r.optionTerm(u)))),0)}longestArgumentTermLength(i,r){return r.visibleArguments(i).reduce((s,u)=>Math.max(s,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(u)))),0)}commandUsage(i){let r=i._name;i._aliases[0]&&(r=r+"|"+i._aliases[0]);let s="";for(let u=i.parent;u;u=u.parent)s=u.name()+" "+s;return s+r+" "+i.usage()}commandDescription(i){return i.description()}subcommandDescription(i){return i.summary()||i.description()}optionDescription(i){const r=[];if(i.argChoices&&r.push(`choices: ${i.argChoices.map(s=>JSON.stringify(s)).join(", ")}`),i.defaultValue!==void 0&&(i.required||i.optional||i.isBoolean()&&typeof i.defaultValue=="boolean")&&r.push(`default: ${i.defaultValueDescription||JSON.stringify(i.defaultValue)}`),i.presetArg!==void 0&&i.optional&&r.push(`preset: ${JSON.stringify(i.presetArg)}`),i.envVar!==void 0&&r.push(`env: ${i.envVar}`),r.length>0){const s=`(${r.join(", ")})`;return i.description?`${i.description} ${s}`:s}return i.description}argumentDescription(i){const r=[];if(i.argChoices&&r.push(`choices: ${i.argChoices.map(s=>JSON.stringify(s)).join(", ")}`),i.defaultValue!==void 0&&r.push(`default: ${i.defaultValueDescription||JSON.stringify(i.defaultValue)}`),r.length>0){const s=`(${r.join(", ")})`;return i.description?`${i.description} ${s}`:s}return i.description}formatItemList(i,r,s){return r.length===0?[]:[s.styleTitle(i),...r,""]}groupItems(i,r,s){const u=new Map;return i.forEach(_=>{const l=s(_);u.has(l)||u.set(l,[])}),r.forEach(_=>{const l=s(_);u.has(l)||u.set(l,[]),u.get(l).push(_)}),u}formatHelp(i,r){const s=r.padWidth(i,r),u=r.helpWidth??80;function _(d,b){return r.formatItem(d,s,b,r)}let l=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(i))}`,""];const g=r.commandDescription(i);g.length>0&&(l=l.concat([r.boxWrap(r.styleCommandDescription(g),u),""]));const h=r.visibleArguments(i).map(d=>_(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(l=l.concat(this.formatItemList("Arguments:",h,r)),this.groupItems(i.options,r.visibleOptions(i),d=>d.helpGroupHeading??"Options:").forEach((d,b)=>{const V=d.map(t=>_(r.styleOptionTerm(r.optionTerm(t)),r.styleOptionDescription(r.optionDescription(t))));l=l.concat(this.formatItemList(b,V,r))}),r.showGlobalOptions){const d=r.visibleGlobalOptions(i).map(b=>_(r.styleOptionTerm(r.optionTerm(b)),r.styleOptionDescription(r.optionDescription(b))));l=l.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(i.commands,r.visibleCommands(i),d=>d.helpGroup()||"Commands:").forEach((d,b)=>{const V=d.map(t=>_(r.styleSubcommandTerm(r.subcommandTerm(t)),r.styleSubcommandDescription(r.subcommandDescription(t))));l=l.concat(this.formatItemList(b,V,r))}),l.join(`
3
+ `)}displayWidth(i){return E(i).length}styleTitle(i){return i}styleUsage(i){return i.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).join(" ")}styleCommandDescription(i){return this.styleDescriptionText(i)}styleOptionDescription(i){return this.styleDescriptionText(i)}styleSubcommandDescription(i){return this.styleDescriptionText(i)}styleArgumentDescription(i){return this.styleDescriptionText(i)}styleDescriptionText(i){return i}styleOptionTerm(i){return this.styleOptionText(i)}styleSubcommandTerm(i){return i.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(i){return this.styleArgumentText(i)}styleOptionText(i){return i}styleArgumentText(i){return i}styleSubcommandText(i){return i}styleCommandText(i){return i}padWidth(i,r){return Math.max(r.longestOptionTermLength(i,r),r.longestGlobalOptionTermLength(i,r),r.longestSubcommandTermLength(i,r),r.longestArgumentTermLength(i,r))}preformatted(i){return/\n[^\S\r\n]/.test(i)}formatItem(i,r,s,u){const l=" ".repeat(2);if(!s)return l+i;const g=i.padEnd(r+i.length-u.displayWidth(i)),h=2,y=(this.helpWidth??80)-r-h-2;let d;return y<this.minWidthToWrap||u.preformatted(s)?d=s:d=u.boxWrap(s,y).replace(/\n/g,`
4
+ `+" ".repeat(r+h)),l+g+" ".repeat(h)+d.replace(/\n/g,`
5
+ ${l}`)}boxWrap(i,r){if(r<this.minWidthToWrap)return i;const s=i.split(/\r\n|\n/),u=/[\s]*[^\s]+/g,_=[];return s.forEach(l=>{const g=l.match(u);if(g===null){_.push("");return}let h=[g.shift()],p=this.displayWidth(h[0]);g.forEach(y=>{const d=this.displayWidth(y);if(p+d<=r){h.push(y),p+=d;return}_.push(h.join(""));const b=y.trimStart();h=[b],p=this.displayWidth(b)}),_.push(h.join(""))}),_.join(`
6
+ `)}}function E(f){const i=/\x1b\[\d*(;\d*)*m/g;return f.replace(i,"")}return D.Help=v,D.stripColor=E,D}var W={},B;function Z(){if(B)return W;B=1;const{InvalidArgumentError:x}=F();class v{constructor(s,u){this.flags=s,this.description=u||"",this.required=s.includes("<"),this.optional=s.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(s),this.mandatory=!1;const _=i(s);this.short=_.shortFlag,this.long=_.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(s,u){return this.defaultValue=s,this.defaultValueDescription=u,this}preset(s){return this.presetArg=s,this}conflicts(s){return this.conflictsWith=this.conflictsWith.concat(s),this}implies(s){let u=s;return typeof s=="string"&&(u={[s]:!0}),this.implied=Object.assign(this.implied||{},u),this}env(s){return this.envVar=s,this}argParser(s){return this.parseArg=s,this}makeOptionMandatory(s=!0){return this.mandatory=!!s,this}hideHelp(s=!0){return this.hidden=!!s,this}_collectValue(s,u){return u===this.defaultValue||!Array.isArray(u)?[s]:(u.push(s),u)}choices(s){return this.argChoices=s.slice(),this.parseArg=(u,_)=>{if(!this.argChoices.includes(u))throw new x(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(u,_):u},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?f(this.name().replace(/^no-/,"")):f(this.name())}helpGroup(s){return this.helpGroupHeading=s,this}is(s){return this.short===s||this.long===s}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class E{constructor(s){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,s.forEach(u=>{u.negate?this.negativeOptions.set(u.attributeName(),u):this.positiveOptions.set(u.attributeName(),u)}),this.negativeOptions.forEach((u,_)=>{this.positiveOptions.has(_)&&this.dualOptions.add(_)})}valueFromOption(s,u){const _=u.attributeName();if(!this.dualOptions.has(_))return!0;const l=this.negativeOptions.get(_).presetArg,g=l!==void 0?l:!1;return u.negate===(g===s)}}function f(r){return r.split("-").reduce((s,u)=>s+u[0].toUpperCase()+u.slice(1))}function i(r){let s,u;const _=/^-[^-]$/,l=/^--[^-]/,g=r.split(/[ |,]+/).concat("guard");if(_.test(g[0])&&(s=g.shift()),l.test(g[0])&&(u=g.shift()),!s&&_.test(g[0])&&(s=g.shift()),!s&&l.test(g[0])&&(s=u,u=g.shift()),g[0].startsWith("-")){const h=g[0],p=`option creation failed due to '${h}' in option flags '${r}'`;throw/^-[^-][^-]/.test(h)?new Error(`${p}
7
+ - a short flag is a single dash and a single character
8
+ - either use a single dash and a single character (for a short flag)
9
+ - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):_.test(h)?new Error(`${p}
10
+ - too many short flags`):l.test(h)?new Error(`${p}
11
+ - too many long flags`):new Error(`${p}
12
+ - unrecognised flag format`)}if(s===void 0&&u===void 0)throw new Error(`option creation failed due to no flags found in '${r}'.`);return{shortFlag:s,longFlag:u}}return W.Option=v,W.DualOptions=E,W}var G={},U;function ot(){if(U)return G;U=1;const x=3;function v(f,i){if(Math.abs(f.length-i.length)>x)return Math.max(f.length,i.length);const r=[];for(let s=0;s<=f.length;s++)r[s]=[s];for(let s=0;s<=i.length;s++)r[0][s]=s;for(let s=1;s<=i.length;s++)for(let u=1;u<=f.length;u++){let _=1;f[u-1]===i[s-1]?_=0:_=1,r[u][s]=Math.min(r[u-1][s]+1,r[u][s-1]+1,r[u-1][s-1]+_),u>1&&s>1&&f[u-1]===i[s-2]&&f[u-2]===i[s-1]&&(r[u][s]=Math.min(r[u][s],r[u-2][s-2]+1))}return r[f.length][i.length]}function E(f,i){if(!i||i.length===0)return"";i=Array.from(new Set(i));const r=f.startsWith("--");r&&(f=f.slice(2),i=i.map(l=>l.slice(2)));let s=[],u=x;const _=.4;return i.forEach(l=>{if(l.length<=1)return;const g=v(f,l),h=Math.max(f.length,l.length);(h-g)/h>_&&(g<u?(u=g,s=[l]):g===u&&s.push(l))}),s.sort((l,g)=>l.localeCompare(g)),r&&(s=s.map(l=>`--${l}`)),s.length>1?`
13
+ (Did you mean one of ${s.join(", ")}?)`:s.length===1?`
14
+ (Did you mean ${s[0]}?)`:""}return G.suggestSimilar=E,G}var J;function at(){if(J)return P;J=1;const x=et.EventEmitter,v=it,E=nt,f=rt,i=st,{Argument:r,humanReadableArgName:s}=q(),{CommanderError:u}=F(),{Help:_,stripColor:l}=X(),{Option:g,DualOptions:h}=Z(),{suggestSimilar:p}=ot();class y extends x{constructor(t){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=t||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:e=>i.stdout.write(e),writeErr:e=>i.stderr.write(e),outputError:(e,n)=>n(e),getOutHelpWidth:()=>i.stdout.isTTY?i.stdout.columns:void 0,getErrHelpWidth:()=>i.stderr.isTTY?i.stderr.columns:void 0,getOutHasColors:()=>b()??(i.stdout.isTTY&&i.stdout.hasColors?.()),getErrHasColors:()=>b()??(i.stderr.isTTY&&i.stderr.hasColors?.()),stripColor:e=>l(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(t){return this._outputConfiguration=t._outputConfiguration,this._helpOption=t._helpOption,this._helpCommand=t._helpCommand,this._helpConfiguration=t._helpConfiguration,this._exitCallback=t._exitCallback,this._storeOptionsAsProperties=t._storeOptionsAsProperties,this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue,this._allowExcessArguments=t._allowExcessArguments,this._enablePositionalOptions=t._enablePositionalOptions,this._showHelpAfterError=t._showHelpAfterError,this._showSuggestionAfterError=t._showSuggestionAfterError,this}_getCommandAndAncestors(){const t=[];for(let e=this;e;e=e.parent)t.push(e);return t}command(t,e,n){let o=e,a=n;typeof o=="object"&&o!==null&&(a=o,o=null),a=a||{};const[,c,O]=t.match(/([^ ]+) *(.*)/),C=this.createCommand(c);return o&&(C.description(o),C._executableHandler=!0),a.isDefault&&(this._defaultCommandName=C._name),C._hidden=!!(a.noHelp||a.hidden),C._executableFile=a.executableFile||null,O&&C.arguments(O),this._registerCommand(C),C.parent=this,C.copyInheritedSettings(this),o?this:C}createCommand(t){return new y(t)}createHelp(){return Object.assign(new _,this.configureHelp())}configureHelp(t){return t===void 0?this._helpConfiguration:(this._helpConfiguration=t,this)}configureOutput(t){return t===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...t},this)}showHelpAfterError(t=!0){return typeof t!="string"&&(t=!!t),this._showHelpAfterError=t,this}showSuggestionAfterError(t=!0){return this._showSuggestionAfterError=!!t,this}addCommand(t,e){if(!t._name)throw new Error(`Command passed to .addCommand() must have a name
15
+ - specify the name in Command constructor or using .name()`);return e=e||{},e.isDefault&&(this._defaultCommandName=t._name),(e.noHelp||e.hidden)&&(t._hidden=!0),this._registerCommand(t),t.parent=this,t._checkForBrokenPassThrough(),this}createArgument(t,e){return new r(t,e)}argument(t,e,n,o){const a=this.createArgument(t,e);return typeof n=="function"?a.default(o).argParser(n):a.default(n),this.addArgument(a),this}arguments(t){return t.trim().split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(t){const e=this.registeredArguments.slice(-1)[0];if(e?.variadic)throw new Error(`only the last argument can be variadic '${e.name()}'`);if(t.required&&t.defaultValue!==void 0&&t.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${t.name()}'`);return this.registeredArguments.push(t),this}helpCommand(t,e){if(typeof t=="boolean")return this._addImplicitHelpCommand=t,t&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;const n=t??"help [command]",[,o,a]=n.match(/([^ ]+) *(.*)/),c=e??"display help for command",O=this.createCommand(o);return O.helpOption(!1),a&&O.arguments(a),c&&O.description(c),this._addImplicitHelpCommand=!0,this._helpCommand=O,(t||e)&&this._initCommandGroup(O),this}addHelpCommand(t,e){return typeof t!="object"?(this.helpCommand(t,e),this):(this._addImplicitHelpCommand=!0,this._helpCommand=t,this._initCommandGroup(t),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(t,e){const n=["preSubcommand","preAction","postAction"];if(!n.includes(t))throw new Error(`Unexpected value for event passed to hook : '${t}'.
16
+ Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[t]?this._lifeCycleHooks[t].push(e):this._lifeCycleHooks[t]=[e],this}exitOverride(t){return t?this._exitCallback=t:this._exitCallback=e=>{if(e.code!=="commander.executeSubCommandAsync")throw e},this}_exit(t,e,n){this._exitCallback&&this._exitCallback(new u(t,e,n)),i.exit(t)}action(t){const e=n=>{const o=this.registeredArguments.length,a=n.slice(0,o);return this._storeOptionsAsProperties?a[o]=this:a[o]=this.opts(),a.push(this),t.apply(this,a)};return this._actionHandler=e,this}createOption(t,e){return new g(t,e)}_callParseArg(t,e,n,o){try{return t.parseArg(e,n)}catch(a){if(a.code==="commander.invalidArgument"){const c=`${o} ${a.message}`;this.error(c,{exitCode:a.exitCode,code:a.code})}throw a}}_registerOption(t){const e=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(e){const n=t.long&&this._findOption(t.long)?t.long:t.short;throw new Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
17
+ - already used by option '${e.flags}'`)}this._initOptionGroup(t),this.options.push(t)}_registerCommand(t){const e=o=>[o.name()].concat(o.aliases()),n=e(t).find(o=>this._findCommand(o));if(n){const o=e(this._findCommand(n)).join("|"),a=e(t).join("|");throw new Error(`cannot add command '${a}' as already have command '${o}'`)}this._initCommandGroup(t),this.commands.push(t)}addOption(t){this._registerOption(t);const e=t.name(),n=t.attributeName();if(t.negate){const a=t.long.replace(/^--no-/,"--");this._findOption(a)||this.setOptionValueWithSource(n,t.defaultValue===void 0?!0:t.defaultValue,"default")}else t.defaultValue!==void 0&&this.setOptionValueWithSource(n,t.defaultValue,"default");const o=(a,c,O)=>{a==null&&t.presetArg!==void 0&&(a=t.presetArg);const C=this.getOptionValue(n);a!==null&&t.parseArg?a=this._callParseArg(t,a,C,c):a!==null&&t.variadic&&(a=t._collectValue(a,C)),a==null&&(t.negate?a=!1:t.isBoolean()||t.optional?a=!0:a=""),this.setOptionValueWithSource(n,a,O)};return this.on("option:"+e,a=>{const c=`error: option '${t.flags}' argument '${a}' is invalid.`;o(a,c,"cli")}),t.envVar&&this.on("optionEnv:"+e,a=>{const c=`error: option '${t.flags}' value '${a}' from env '${t.envVar}' is invalid.`;o(a,c,"env")}),this}_optionEx(t,e,n,o,a){if(typeof e=="object"&&e instanceof g)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");const c=this.createOption(e,n);if(c.makeOptionMandatory(!!t.mandatory),typeof o=="function")c.default(a).argParser(o);else if(o instanceof RegExp){const O=o;o=(C,w)=>{const m=O.exec(C);return m?m[0]:w},c.default(a).argParser(o)}else c.default(o);return this.addOption(c)}option(t,e,n,o){return this._optionEx({},t,e,n,o)}requiredOption(t,e,n,o){return this._optionEx({mandatory:!0},t,e,n,o)}combineFlagAndOptionalValue(t=!0){return this._combineFlagAndOptionalValue=!!t,this}allowUnknownOption(t=!0){return this._allowUnknownOption=!!t,this}allowExcessArguments(t=!0){return this._allowExcessArguments=!!t,this}enablePositionalOptions(t=!0){return this._enablePositionalOptions=!!t,this}passThroughOptions(t=!0){return this._passThroughOptions=!!t,this._checkForBrokenPassThrough(),this}_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)`)}storeOptionsAsProperties(t=!0){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");return this._storeOptionsAsProperties=!!t,this}getOptionValue(t){return this._storeOptionsAsProperties?this[t]:this._optionValues[t]}setOptionValue(t,e){return this.setOptionValueWithSource(t,e,void 0)}setOptionValueWithSource(t,e,n){return this._storeOptionsAsProperties?this[t]=e:this._optionValues[t]=e,this._optionValueSources[t]=n,this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let e;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(t)!==void 0&&(e=n.getOptionValueSource(t))}),e}_prepareUserArgs(t,e){if(t!==void 0&&!Array.isArray(t))throw new Error("first parameter to parse must be array or undefined");if(e=e||{},t===void 0&&e.from===void 0){i.versions?.electron&&(e.from="electron");const o=i.execArgv??[];(o.includes("-e")||o.includes("--eval")||o.includes("-p")||o.includes("--print"))&&(e.from="eval")}t===void 0&&(t=i.argv),this.rawArgs=t.slice();let n;switch(e.from){case void 0:case"node":this._scriptPath=t[1],n=t.slice(2);break;case"electron":i.defaultApp?(this._scriptPath=t[1],n=t.slice(2)):n=t.slice(1);break;case"user":n=t.slice(0);break;case"eval":n=t.slice(1);break;default:throw new Error(`unexpected parse option { from: '${e.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(t,e){this._prepareForParse();const n=this._prepareUserArgs(t,e);return this._parseCommand([],n),this}async parseAsync(t,e){this._prepareForParse();const n=this._prepareUserArgs(t,e);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
18
+ - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(t,e,n){if(f.existsSync(t))return;const o=e?`searched for local subcommand relative to directory '${e}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",a=`'${t}' does not exist
19
+ - if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
16
20
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
17
- - ${v}`;throw new Error(V)}else if(O.code==="EACCES")throw new Error(`'${c}' not executable`);if(!b)r.exit(1);else{const v=new u(1,"commander.executeSubCommandAsync","(error)");v.nestedError=O,b(v)}}),this.runningCommand=f}_dispatchSubcommand(e,t,n){const o=this._findCommand(e);o||this.help({error:!0});let i;return i=this._chainOrCallSubCommandHook(i,o,"preSubcommand"),i=this._chainOrCall(i,()=>{if(o._executableHandler)this._executeSubCommand(o,t.concat(n));else return o._parseCommand(t,n)}),i}_dispatchHelpCommand(e){e||this.help();const t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){const e=(n,o,i)=>{let c=o;if(o!==null&&n.parseArg){const m=`error: command-argument value '${o}' is invalid for argument '${n.name()}'.`;c=this._callParseArg(n,o,i,m)}return c};this._checkNumberOfArguments();const t=[];this.registeredArguments.forEach((n,o)=>{let i=n.defaultValue;n.variadic?o<this.args.length?(i=this.args.slice(o),n.parseArg&&(i=i.reduce((c,m)=>e(n,m,c),n.defaultValue))):i===void 0&&(i=[]):o<this.args.length&&(i=this.args[o],n.parseArg&&(i=e(n,i,n.defaultValue))),t[o]=i}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e;const o=[];return this._getCommandAndAncestors().reverse().filter(i=>i._lifeCycleHooks[t]!==void 0).forEach(i=>{i._lifeCycleHooks[t].forEach(c=>{o.push({hookedCommand:i,callback:c})})}),t==="postAction"&&o.reverse(),o.forEach(i=>{n=this._chainOrCall(n,()=>i.callback(i.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let o=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(i=>{o=this._chainOrCall(o,()=>i(this,t))}),o}_parseCommand(e,t){const n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();const o=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){o(),this._processArguments();let c;return c=this._chainOrCallHooks(c,"preAction"),c=this._chainOrCall(c,()=>this._actionHandler(this.processedArgs)),this.parent&&(c=this._chainOrCall(c,()=>{this.parent.emit(i,e,t)})),c=this._chainOrCallHooks(c,"postAction"),c}if(this.parent&&this.parent.listenerCount(i))o(),this._processArguments(),this.parent.emit(i,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(o(),this._processArguments())}else this.commands.length?(o(),this.help({error:!0})):(o(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){const e=this.options.filter(n=>{const o=n.attributeName();return this.getOptionValue(o)===void 0?!1:this.getOptionValueSource(o)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{const o=e.find(i=>n.conflictsWith.includes(i.attributeName()));o&&this._conflictingOption(n,o)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){const t=[],n=[];let o=t;const i=e.slice();function c(f){return f.length>1&&f[0]==="-"}let m=null;for(;i.length;){const f=i.shift();if(f==="--"){o===n&&o.push(f),o.push(...i);break}if(m&&!c(f)){this.emit(`option:${m.name()}`,f);continue}if(m=null,c(f)){const b=this._findOption(f);if(b){if(b.required){const O=i.shift();O===void 0&&this.optionMissingArgument(b),this.emit(`option:${b.name()}`,O)}else if(b.optional){let O=null;i.length>0&&!c(i[0])&&(O=i.shift()),this.emit(`option:${b.name()}`,O)}else this.emit(`option:${b.name()}`);m=b.variadic?b:null;continue}}if(f.length>2&&f[0]==="-"&&f[1]!=="-"){const b=this._findOption(`-${f[1]}`);if(b){b.required||b.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${b.name()}`,f.slice(2)):(this.emit(`option:${b.name()}`),i.unshift(`-${f.slice(2)}`));continue}}if(/^--[^=]+=/.test(f)){const b=f.indexOf("="),O=this._findOption(f.slice(0,b));if(O&&(O.required||O.optional)){this.emit(`option:${O.name()}`,f.slice(b+1));continue}}if(c(f)&&(o=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(f)){t.push(f),i.length>0&&n.push(...i);break}else if(this._getHelpCommand()&&f===this._getHelpCommand().name()){t.push(f),i.length>0&&t.push(...i);break}else if(this._defaultCommandName){n.push(f),i.length>0&&n.push(...i);break}}if(this._passThroughOptions){o.push(f),i.length>0&&o.push(...i);break}o.push(f)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){const e={},t=this.options.length;for(let n=0;n<t;n++){const o=this.options[n].attributeName();e[o]=o===this._versionOptionName?this._version:this[o]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
21
+ - ${o}`;throw new Error(a)}_executeSubCommand(t,e){e=e.slice();let n=!1;const o=[".js",".ts",".tsx",".mjs",".cjs"];function a(m,A){const $=E.resolve(m,A);if(f.existsSync($))return $;if(o.includes(E.extname(A)))return;const N=o.find(tt=>f.existsSync(`${$}${tt}`));if(N)return`${$}${N}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let c=t._executableFile||`${this._name}-${t._name}`,O=this._executableDir||"";if(this._scriptPath){let m;try{m=f.realpathSync(this._scriptPath)}catch{m=this._scriptPath}O=E.resolve(E.dirname(m),O)}if(O){let m=a(O,c);if(!m&&!t._executableFile&&this._scriptPath){const A=E.basename(this._scriptPath,E.extname(this._scriptPath));A!==this._name&&(m=a(O,`${A}-${t._name}`))}c=m||c}n=o.includes(E.extname(c));let C;i.platform!=="win32"?n?(e.unshift(c),e=d(i.execArgv).concat(e),C=v.spawn(i.argv[0],e,{stdio:"inherit"})):C=v.spawn(c,e,{stdio:"inherit"}):(this._checkForMissingExecutable(c,O,t._name),e.unshift(c),e=d(i.execArgv).concat(e),C=v.spawn(i.execPath,e,{stdio:"inherit"})),C.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(A=>{i.on(A,()=>{C.killed===!1&&C.exitCode===null&&C.kill(A)})});const w=this._exitCallback;C.on("close",m=>{m=m??1,w?w(new u(m,"commander.executeSubCommandAsync","(close)")):i.exit(m)}),C.on("error",m=>{if(m.code==="ENOENT")this._checkForMissingExecutable(c,O,t._name);else if(m.code==="EACCES")throw new Error(`'${c}' not executable`);if(!w)i.exit(1);else{const A=new u(1,"commander.executeSubCommandAsync","(error)");A.nestedError=m,w(A)}}),this.runningCommand=C}_dispatchSubcommand(t,e,n){const o=this._findCommand(t);o||this.help({error:!0}),o._prepareForParse();let a;return a=this._chainOrCallSubCommandHook(a,o,"preSubcommand"),a=this._chainOrCall(a,()=>{if(o._executableHandler)this._executeSubCommand(o,e.concat(n));else return o._parseCommand(e,n)}),a}_dispatchHelpCommand(t){t||this.help();const e=this._findCommand(t);return e&&!e._executableHandler&&e.help(),this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((t,e)=>{t.required&&this.args[e]==null&&this.missingArgument(t.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){const t=(n,o,a)=>{let c=o;if(o!==null&&n.parseArg){const O=`error: command-argument value '${o}' is invalid for argument '${n.name()}'.`;c=this._callParseArg(n,o,a,O)}return c};this._checkNumberOfArguments();const e=[];this.registeredArguments.forEach((n,o)=>{let a=n.defaultValue;n.variadic?o<this.args.length?(a=this.args.slice(o),n.parseArg&&(a=a.reduce((c,O)=>t(n,O,c),n.defaultValue))):a===void 0&&(a=[]):o<this.args.length&&(a=this.args[o],n.parseArg&&(a=t(n,a,n.defaultValue))),e[o]=a}),this.processedArgs=e}_chainOrCall(t,e){return t?.then&&typeof t.then=="function"?t.then(()=>e()):e()}_chainOrCallHooks(t,e){let n=t;const o=[];return this._getCommandAndAncestors().reverse().filter(a=>a._lifeCycleHooks[e]!==void 0).forEach(a=>{a._lifeCycleHooks[e].forEach(c=>{o.push({hookedCommand:a,callback:c})})}),e==="postAction"&&o.reverse(),o.forEach(a=>{n=this._chainOrCall(n,()=>a.callback(a.hookedCommand,this))}),n}_chainOrCallSubCommandHook(t,e,n){let o=t;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(a=>{o=this._chainOrCall(o,()=>a(this,e))}),o}_parseCommand(t,e){const n=this.parseOptions(e);if(this._parseOptionsEnv(),this._parseOptionsImplied(),t=t.concat(n.operands),e=n.unknown,this.args=t.concat(e),t&&this._findCommand(t[0]))return this._dispatchSubcommand(t[0],t.slice(1),e);if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(t[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(e),this._dispatchSubcommand(this._defaultCommandName,t,e);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();const o=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},a=`command:${this.name()}`;if(this._actionHandler){o(),this._processArguments();let c;return c=this._chainOrCallHooks(c,"preAction"),c=this._chainOrCall(c,()=>this._actionHandler(this.processedArgs)),this.parent&&(c=this._chainOrCall(c,()=>{this.parent.emit(a,t,e)})),c=this._chainOrCallHooks(c,"postAction"),c}if(this.parent?.listenerCount(a))o(),this._processArguments(),this.parent.emit(a,t,e);else if(t.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",t,e);this.listenerCount("command:*")?this.emit("command:*",t,e):this.commands.length?this.unknownCommand():(o(),this._processArguments())}else this.commands.length?(o(),this.help({error:!0})):(o(),this._processArguments())}_findCommand(t){if(t)return this.commands.find(e=>e._name===t||e._aliases.includes(t))}_findOption(t){return this.options.find(e=>e.is(t))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(t=>{t.options.forEach(e=>{e.mandatory&&t.getOptionValue(e.attributeName())===void 0&&t.missingMandatoryOptionValue(e)})})}_checkForConflictingLocalOptions(){const t=this.options.filter(n=>{const o=n.attributeName();return this.getOptionValue(o)===void 0?!1:this.getOptionValueSource(o)!=="default"});t.filter(n=>n.conflictsWith.length>0).forEach(n=>{const o=t.find(a=>n.conflictsWith.includes(a.attributeName()));o&&this._conflictingOption(n,o)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(t=>{t._checkForConflictingLocalOptions()})}parseOptions(t){const e=[],n=[];let o=e;function a(m){return m.length>1&&m[0]==="-"}const c=m=>/^-\d*\.?\d+(e[+-]?\d+)?$/.test(m)?!this._getCommandAndAncestors().some(A=>A.options.map($=>$.short).some($=>/^-\d$/.test($))):!1;let O=null,C=null,w=0;for(;w<t.length||C;){const m=C??t[w++];if(C=null,m==="--"){o===n&&o.push(m),o.push(...t.slice(w));break}if(O&&(!a(m)||c(m))){this.emit(`option:${O.name()}`,m);continue}if(O=null,a(m)){const A=this._findOption(m);if(A){if(A.required){const $=t[w++];$===void 0&&this.optionMissingArgument(A),this.emit(`option:${A.name()}`,$)}else if(A.optional){let $=null;w<t.length&&(!a(t[w])||c(t[w]))&&($=t[w++]),this.emit(`option:${A.name()}`,$)}else this.emit(`option:${A.name()}`);O=A.variadic?A:null;continue}}if(m.length>2&&m[0]==="-"&&m[1]!=="-"){const A=this._findOption(`-${m[1]}`);if(A){A.required||A.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${A.name()}`,m.slice(2)):(this.emit(`option:${A.name()}`),C=`-${m.slice(2)}`);continue}}if(/^--[^=]+=/.test(m)){const A=m.indexOf("="),$=this._findOption(m.slice(0,A));if($&&($.required||$.optional)){this.emit(`option:${$.name()}`,m.slice(A+1));continue}}if(o===e&&a(m)&&!(this.commands.length===0&&c(m))&&(o=n),(this._enablePositionalOptions||this._passThroughOptions)&&e.length===0&&n.length===0){if(this._findCommand(m)){e.push(m),n.push(...t.slice(w));break}else if(this._getHelpCommand()&&m===this._getHelpCommand().name()){e.push(m,...t.slice(w));break}else if(this._defaultCommandName){n.push(m,...t.slice(w));break}}if(this._passThroughOptions){o.push(m,...t.slice(w));break}o.push(m)}return{operands:e,unknown:n}}opts(){if(this._storeOptionsAsProperties){const t={},e=this.options.length;for(let n=0;n<e;n++){const o=this.options[n].attributeName();t[o]=o===this._versionOptionName?this._version:this[o]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((t,e)=>Object.assign(t,e.opts()),{})}error(t,e){this._outputConfiguration.outputError(`${t}
18
22
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
19
23
  `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
20
- `),this.outputHelp({error:!0}));const n=t||{},o=n.exitCode||1,i=n.code||"commander.error";this._exit(o,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in r.env){const t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,r.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){const e=new _(this.options),t=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(o=>!t(o)).forEach(o=>{this.setOptionValueWithSource(o,n.implied[o],"implied")})})}missingArgument(e){const t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){const t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){const t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){const n=c=>{const m=c.attributeName(),f=this.getOptionValue(m),b=this.options.find(v=>v.negate&&m===v.attributeName()),O=this.options.find(v=>!v.negate&&m===v.attributeName());return b&&(b.presetArg===void 0&&f===!1||b.presetArg!==void 0&&f===b.presetArg)?b:O||c},o=c=>{const m=n(c),f=m.attributeName();return this.getOptionValueSource(f)==="env"?`environment variable '${m.envVar}'`:`option '${m.flags}'`},i=`error: ${o(e)} cannot be used with ${o(t)}`;this.error(i,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let o=[],i=this;do{const c=i.createHelp().visibleOptions(i).filter(m=>m.long).map(m=>m.long);o=o.concat(c),i=i.parent}while(i&&!i._enablePositionalOptions);t=h(e,o)}const n=`error: unknown option '${e}'${t}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;const t=this.registeredArguments.length,n=t===1?"":"s",i=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${n} but got ${e.length}.`;this.error(i,{code:"commander.excessArguments"})}unknownCommand(){const e=this.args[0];let t="";if(this._showSuggestionAfterError){const o=[];this.createHelp().visibleCommands(this).forEach(i=>{o.push(i.name()),i.alias()&&o.push(i.alias())}),t=h(e,o)}const n=`error: unknown command '${e}'${t}`;this.error(n,{code:"commander.unknownCommand"})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",n=n||"output the version number";const o=this.createOption(t,n);return this._versionOptionName=o.attributeName(),this._registerOption(o),this.on("option:"+o.name(),()=>{this._outputConfiguration.writeOut(`${e}
21
- `),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");const n=this.parent?._findCommand(e);if(n){const o=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${o}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;const t=this.registeredArguments.map(n=>a(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=y.basename(e,y.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){const t=this.createHelp();return t.helpWidth===void 0&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){e=e||{};const t={error:!!e.error};let n;return t.error?n=o=>this._outputConfiguration.writeErr(o):n=o=>this._outputConfiguration.writeOut(o),t.write=e.write||n,t.command=this,t}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);const n=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(i=>i.emit("beforeAllHelp",n)),this.emit("beforeHelp",n);let o=this.helpInformation(n);if(t&&(o=t(o),typeof o!="string"&&!Buffer.isBuffer(o)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(o),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",n),this._getCommandAndAncestors().forEach(i=>i.emit("afterAllHelp",n))}helpOption(e,t){return typeof e=="boolean"?(e?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=r.exitCode||0;t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){const n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText.
22
- Expecting one of '${n.join("', '")}'`);const o=`${e}Help`;return this.on(o,i=>{let c;typeof t=="function"?c=t({error:i.error,command:i.command}):c=t,c&&i.write(`${c}
23
- `)}),this}_outputHelpIfRequested(e){const t=this._getHelpOption();t&&e.find(o=>t.is(o))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}}function C(g){return g.map(e=>{if(!e.startsWith("--inspect"))return e;let t,n="127.0.0.1",o="9229",i;return(i=e.match(/^(--inspect(-brk)?)$/))!==null?t=i[1]:(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=i[1],/^\d+$/.test(i[3])?o=i[3]:n=i[3]):(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],o=i[4]),t&&o!=="0"?`${t}=${n}:${parseInt(o)+1}`:e})}return F.Command=d,F}var J;function oe(){if(J)return x;J=1;const{Argument:$}=M(),{Command:w}=se(),{CommanderError:y,InvalidArgumentError:s}=q(),{Help:r}=Q(),{Option:l}=X();return x.program=new w,x.createCommand=a=>new w(a),x.createOption=(a,u)=>new l(a,u),x.createArgument=(a,u)=>new $(a,u),x.Command=w,x.Option=l,x.Argument=$,x.Help=r,x.CommanderError=y,x.InvalidArgumentError=s,x.InvalidOptionArgumentError=s,x}var ae=oe();const le=E.getDefaultExportFromCjs(ae),{program:H,createCommand:me,createArgument:ge,createOption:_e,CommanderError:Oe,InvalidArgumentError:Ae,InvalidOptionArgumentError:be,Command:Ce,Argument:we,Option:K,Help:ue}=le;var I,Y;function ce(){if(Y)return I;Y=1,I=w;function $(s){return s instanceof Buffer?Buffer.from(s):new s.constructor(s.buffer.slice(),s.byteOffset,s.length)}function w(s){if(s=s||{},s.circles)return y(s);const r=new Map;if(r.set(Date,p=>new Date(p)),r.set(Map,(p,_)=>new Map(a(Array.from(p),_))),r.set(Set,(p,_)=>new Set(a(Array.from(p),_))),s.constructorHandlers)for(const p of s.constructorHandlers)r.set(p[0],p[1]);let l=null;return s.proto?A:u;function a(p,_){const h=Object.keys(p),d=new Array(h.length);for(let C=0;C<h.length;C++){const g=h[C],e=p[g];typeof e!="object"||e===null?d[g]=e:e.constructor!==Object&&(l=r.get(e.constructor))?d[g]=l(e,_):ArrayBuffer.isView(e)?d[g]=$(e):d[g]=_(e)}return d}function u(p){if(typeof p!="object"||p===null)return p;if(Array.isArray(p))return a(p,u);if(p.constructor!==Object&&(l=r.get(p.constructor)))return l(p,u);const _={};for(const h in p){if(Object.hasOwnProperty.call(p,h)===!1)continue;const d=p[h];typeof d!="object"||d===null?_[h]=d:d.constructor!==Object&&(l=r.get(d.constructor))?_[h]=l(d,u):ArrayBuffer.isView(d)?_[h]=$(d):_[h]=u(d)}return _}function A(p){if(typeof p!="object"||p===null)return p;if(Array.isArray(p))return a(p,A);if(p.constructor!==Object&&(l=r.get(p.constructor)))return l(p,A);const _={};for(const h in p){const d=p[h];typeof d!="object"||d===null?_[h]=d:d.constructor!==Object&&(l=r.get(d.constructor))?_[h]=l(d,A):ArrayBuffer.isView(d)?_[h]=$(d):_[h]=A(d)}return _}}function y(s){const r=[],l=[],a=new Map;if(a.set(Date,h=>new Date(h)),a.set(Map,(h,d)=>new Map(A(Array.from(h),d))),a.set(Set,(h,d)=>new Set(A(Array.from(h),d))),s.constructorHandlers)for(const h of s.constructorHandlers)a.set(h[0],h[1]);let u=null;return s.proto?_:p;function A(h,d){const C=Object.keys(h),g=new Array(C.length);for(let e=0;e<C.length;e++){const t=C[e],n=h[t];if(typeof n!="object"||n===null)g[t]=n;else if(n.constructor!==Object&&(u=a.get(n.constructor)))g[t]=u(n,d);else if(ArrayBuffer.isView(n))g[t]=$(n);else{const o=r.indexOf(n);o!==-1?g[t]=l[o]:g[t]=d(n)}}return g}function p(h){if(typeof h!="object"||h===null)return h;if(Array.isArray(h))return A(h,p);if(h.constructor!==Object&&(u=a.get(h.constructor)))return u(h,p);const d={};r.push(h),l.push(d);for(const C in h){if(Object.hasOwnProperty.call(h,C)===!1)continue;const g=h[C];if(typeof g!="object"||g===null)d[C]=g;else if(g.constructor!==Object&&(u=a.get(g.constructor)))d[C]=u(g,p);else if(ArrayBuffer.isView(g))d[C]=$(g);else{const e=r.indexOf(g);e!==-1?d[C]=l[e]:d[C]=p(g)}}return r.pop(),l.pop(),d}function _(h){if(typeof h!="object"||h===null)return h;if(Array.isArray(h))return A(h,_);if(h.constructor!==Object&&(u=a.get(h.constructor)))return u(h,_);const d={};r.push(h),l.push(d);for(const C in h){const g=h[C];if(typeof g!="object"||g===null)d[C]=g;else if(g.constructor!==Object&&(u=a.get(g.constructor)))d[C]=u(g,_);else if(ArrayBuffer.isView(g))d[C]=$(g);else{const e=r.indexOf(g);e!==-1?d[C]=l[e]:d[C]=_(g)}}return r.pop(),l.pop(),d}}return I}var he=ce();const fe=E.getDefaultExportFromCjs(he),z="Output the version number of npm-check-updates.",pe=$=>$.replace(/`/g,""),de=fe();(async()=>{const{default:$}=await Promise.resolve().then(()=>require("./index-Cx8RNc34.js")),w=$({pkg:E.pkg});if(w.update&&w.update.latest!==E.pkg.version){const{default:i}=await Promise.resolve().then(()=>require("./index-Bl96b__P.js")),c=E.semver.parse(w.update.current)?.major,m=E.semver.parse(w.update.latest)?.major,b=(c&&m&&m>=c?new Array(m-c).fill(0).map((v,V)=>c+V+1):[]).map(v=>`${E.pkg.homepage??""}/releases/tag/v${v}.0.0`),O=`${E.pkg.homepage??""}/compare/v${w.update.current}...v${w.update.latest}`;w.notify({defer:!1,isGlobal:!0,message:`Update available ${i.dim("{currentVersion}")}${i.reset(" → ")}${w.update.type==="major"?i.red("{latestVersion}"):w.update.type==="minor"?i.yellow("{latestVersion}"):i.green("{latestVersion}")}
24
- Run ${i.cyan("{updateCommand}")} to update
25
- ${i.dim.underline(w.update.type==="major"?b.map(v=>i.dim.underline(v)).join(`
26
- `):O)}`})}const y=process.argv.slice(2),s=y.findIndex(i=>i==="--help"||i==="-h");if(s!==-1&&y[s+1]){const i=y[s+1].replace(/^-*/,"");i==="help"||i==="h"?console.info("Would you like some help with your help?"):(await E.chalkInit(),[...y.slice(0,s),...y.slice(s+1)].forEach(m=>{const f=m.replace(/^-*/,""),b=E.cliOptionsSorted.find(O=>f===O.long||f===O.short||f===`no-${O.long}`&&O.type==="boolean");console.info(b?E.renderExtendedHelp(b)+`
27
- `:f==="version"||f==="v"||f==="V"?E.renderExtendedHelp({long:"version",short:"v",description:z,type:"string"})+`
28
- `:`Unknown option: ${m}`)})),process.exit(0)}const r=new Set(E.cliOptionsSorted.filter(i=>i.cli===!1).map(i=>`--${i.long}`));H.description("[filter] is a list or regex of package names to check (all others will be ignored).").usage("[options] [filter]").configureHelp({optionTerm:i=>i.long&&r.has(i.long)?i.long.replace("--","")+"*":i.long==="--version"?"-v, -V, --version":i.flags.replace("[bool]",""),optionDescription:i=>i.long==="--version"?z:i.long==="--help"?`You're lookin' at it. Run "ncu --help <option>" for a specific option.`:ue.prototype.optionDescription(i)}).addOption(new K("-v, --versionAlias").hideHelp()).on("option:versionAlias",()=>{console.info(E.pkg.version),process.exit(0)}),E.cliOptionsSorted.forEach(({long:i,short:c,arg:m,description:f,default:b,help:O,parse:v,type:V})=>{const k=`${c?`-${c}, `:""}--${i}${m?` <${m}>`:""}`,D=`${pe(f)}${O?` Run "ncu --help ${i}" for details.`:""}`;H.option(k,D,v||b,v?b:void 0),V==="boolean"&&H.addOption(new K(`--no-${i}`).default(!1).hideHelp())}),H.version(E.pkg.version);const l=de(H._optionValues);H.parse(process.argv);const a=H.opts(),u=process.argv.slice(2),{color:A,configFileName:p,configFilePath:_,global:h,packageFile:d,mergeConfig:C}=a;await E.chalkInit(A);const g=!process.env.NCU_TESTS||_||C?await E.getNcuRc({configFileName:p,configFilePath:_,global:h,packageFile:d,options:{...a,cli:!0}}):null,e=(g?.args||[]).filter((i,c,m)=>(typeof i!="string"||!i.startsWith("-")||!u.includes(i))&&(typeof m[c-1]!="string"||!m[c-1].startsWith("-")||!u.includes(m[c-1]))),t=[...process.argv.slice(0,2),...e,...u];H._optionValues=l,H.parse(t);const n=H.opts(),o={...g&&Object.keys(g.config).length>0?{rcConfigPath:g.filePath}:null,...E.pickBy(H.opts(),i=>i!==void 0),args:H.args,...n.filter?{filter:n.filter}:null,...n.reject?{reject:n.reject}:null};E.run(o,{cli:!0})})();
24
+ `),this.outputHelp({error:!0}));const n=e||{},o=n.exitCode||1,a=n.code||"commander.error";this._exit(o,a,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in i.env){const e=t.attributeName();(this.getOptionValue(e)===void 0||["default","config","env"].includes(this.getOptionValueSource(e)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,i.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){const t=new h(this.options),e=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&e(n.attributeName())&&t.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(o=>!e(o)).forEach(o=>{this.setOptionValueWithSource(o,n.implied[o],"implied")})})}missingArgument(t){const e=`error: missing required argument '${t}'`;this.error(e,{code:"commander.missingArgument"})}optionMissingArgument(t){const e=`error: option '${t.flags}' argument missing`;this.error(e,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){const e=`error: required option '${t.flags}' not specified`;this.error(e,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,e){const n=c=>{const O=c.attributeName(),C=this.getOptionValue(O),w=this.options.find(A=>A.negate&&O===A.attributeName()),m=this.options.find(A=>!A.negate&&O===A.attributeName());return w&&(w.presetArg===void 0&&C===!1||w.presetArg!==void 0&&C===w.presetArg)?w:m||c},o=c=>{const O=n(c),C=O.attributeName();return this.getOptionValueSource(C)==="env"?`environment variable '${O.envVar}'`:`option '${O.flags}'`},a=`error: ${o(t)} cannot be used with ${o(e)}`;this.error(a,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let e="";if(t.startsWith("--")&&this._showSuggestionAfterError){let o=[],a=this;do{const c=a.createHelp().visibleOptions(a).filter(O=>O.long).map(O=>O.long);o=o.concat(c),a=a.parent}while(a&&!a._enablePositionalOptions);e=p(t,o)}const n=`error: unknown option '${t}'${e}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;const e=this.registeredArguments.length,n=e===1?"":"s",a=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${e} argument${n} but got ${t.length}.`;this.error(a,{code:"commander.excessArguments"})}unknownCommand(){const t=this.args[0];let e="";if(this._showSuggestionAfterError){const o=[];this.createHelp().visibleCommands(this).forEach(a=>{o.push(a.name()),a.alias()&&o.push(a.alias())}),e=p(t,o)}const n=`error: unknown command '${t}'${e}`;this.error(n,{code:"commander.unknownCommand"})}version(t,e,n){if(t===void 0)return this._version;this._version=t,e=e||"-V, --version",n=n||"output the version number";const o=this.createOption(e,n);return this._versionOptionName=o.attributeName(),this._registerOption(o),this.on("option:"+o.name(),()=>{this._outputConfiguration.writeOut(`${t}
25
+ `),this._exit(0,"commander.version",t)}),this}description(t,e){return t===void 0&&e===void 0?this._description:(this._description=t,e&&(this._argsDescription=e),this)}summary(t){return t===void 0?this._summary:(this._summary=t,this)}alias(t){if(t===void 0)return this._aliases[0];let e=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(e=this.commands[this.commands.length-1]),t===e._name)throw new Error("Command alias can't be the same as its name");const n=this.parent?._findCommand(t);if(n){const o=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${o}'`)}return e._aliases.push(t),this}aliases(t){return t===void 0?this._aliases:(t.forEach(e=>this.alias(e)),this)}usage(t){if(t===void 0){if(this._usage)return this._usage;const e=this.registeredArguments.map(n=>s(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?e:[]).join(" ")}return this._usage=t,this}name(t){return t===void 0?this._name:(this._name=t,this)}helpGroup(t){return t===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=t,this)}commandsGroup(t){return t===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=t,this)}optionsGroup(t){return t===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=t,this)}_initOptionGroup(t){this._defaultOptionGroup&&!t.helpGroupHeading&&t.helpGroup(this._defaultOptionGroup)}_initCommandGroup(t){this._defaultCommandGroup&&!t.helpGroup()&&t.helpGroup(this._defaultCommandGroup)}nameFromFilename(t){return this._name=E.basename(t,E.extname(t)),this}executableDir(t){return t===void 0?this._executableDir:(this._executableDir=t,this)}helpInformation(t){const e=this.createHelp(),n=this._getOutputContext(t);e.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});const o=e.formatHelp(this,e);return n.hasColors?o:this._outputConfiguration.stripColor(o)}_getOutputContext(t){t=t||{};const e=!!t.error;let n,o,a;return e?(n=O=>this._outputConfiguration.writeErr(O),o=this._outputConfiguration.getErrHasColors(),a=this._outputConfiguration.getErrHelpWidth()):(n=O=>this._outputConfiguration.writeOut(O),o=this._outputConfiguration.getOutHasColors(),a=this._outputConfiguration.getOutHelpWidth()),{error:e,write:O=>(o||(O=this._outputConfiguration.stripColor(O)),n(O)),hasColors:o,helpWidth:a}}outputHelp(t){let e;typeof t=="function"&&(e=t,t=void 0);const n=this._getOutputContext(t),o={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(c=>c.emit("beforeAllHelp",o)),this.emit("beforeHelp",o);let a=this.helpInformation({error:n.error});if(e&&(a=e(a),typeof a!="string"&&!Buffer.isBuffer(a)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(a),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",o),this._getCommandAndAncestors().forEach(c=>c.emit("afterAllHelp",o))}helpOption(t,e){return typeof t=="boolean"?(t?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(t??"-h, --help",e??"display help for command"),(t||e)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(t){return this._helpOption=t,this._initOptionGroup(t),this}help(t){this.outputHelp(t);let e=Number(i.exitCode??0);e===0&&t&&typeof t!="function"&&t.error&&(e=1),this._exit(e,"commander.help","(outputHelp)")}addHelpText(t,e){const n=["beforeAll","before","after","afterAll"];if(!n.includes(t))throw new Error(`Unexpected value for position to addHelpText.
26
+ Expecting one of '${n.join("', '")}'`);const o=`${t}Help`;return this.on(o,a=>{let c;typeof e=="function"?c=e({error:a.error,command:a.command}):c=e,c&&a.write(`${c}
27
+ `)}),this}_outputHelpIfRequested(t){const e=this._getHelpOption();e&&t.find(o=>e.is(o))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}}function d(V){return V.map(t=>{if(!t.startsWith("--inspect"))return t;let e,n="127.0.0.1",o="9229",a;return(a=t.match(/^(--inspect(-brk)?)$/))!==null?e=a[1]:(a=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(e=a[1],/^\d+$/.test(a[3])?o=a[3]:n=a[3]):(a=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(e=a[1],n=a[3],o=a[4]),e&&o!=="0"?`${e}=${n}:${parseInt(o)+1}`:t})}function b(){if(i.env.NO_COLOR||i.env.FORCE_COLOR==="0"||i.env.FORCE_COLOR==="false")return!1;if(i.env.FORCE_COLOR||i.env.CLICOLOR_FORCE!==void 0)return!0}return P.Command=y,P.useColor=b,P}var Y;function ut(){if(Y)return S;Y=1;const{Argument:x}=q(),{Command:v}=at(),{CommanderError:E,InvalidArgumentError:f}=F(),{Help:i}=X(),{Option:r}=Z();return S.program=new v,S.createCommand=s=>new v(s),S.createOption=(s,u)=>new r(s,u),S.createArgument=(s,u)=>new x(s,u),S.Command=v,S.Option=r,S.Argument=x,S.Help=i,S.CommanderError=E,S.InvalidArgumentError=f,S.InvalidOptionArgumentError=f,S}var lt=ut();const ht=H.getDefaultExportFromCjs(lt),{program:k,createCommand:_t,createArgument:Ot,createOption:Ct,CommanderError:At,InvalidArgumentError:bt,InvalidOptionArgumentError:yt,Command:wt,Argument:vt,Option:K,Help:ct}=ht;var I,z;function pt(){if(z)return I;z=1,I=v;function x(f){return f instanceof Buffer?Buffer.from(f):new f.constructor(f.buffer.slice(),f.byteOffset,f.length)}function v(f){if(f=f||{},f.circles)return E(f);const i=new Map;if(i.set(Date,l=>new Date(l)),i.set(Map,(l,g)=>new Map(s(Array.from(l),g))),i.set(Set,(l,g)=>new Set(s(Array.from(l),g))),f.constructorHandlers)for(const l of f.constructorHandlers)i.set(l[0],l[1]);let r=null;return f.proto?_:u;function s(l,g){const h=Object.keys(l),p=new Array(h.length);for(let y=0;y<h.length;y++){const d=h[y],b=l[d];typeof b!="object"||b===null?p[d]=b:b.constructor!==Object&&(r=i.get(b.constructor))?p[d]=r(b,g):ArrayBuffer.isView(b)?p[d]=x(b):p[d]=g(b)}return p}function u(l){if(typeof l!="object"||l===null)return l;if(Array.isArray(l))return s(l,u);if(l.constructor!==Object&&(r=i.get(l.constructor)))return r(l,u);const g={};for(const h in l){if(Object.hasOwnProperty.call(l,h)===!1)continue;const p=l[h];typeof p!="object"||p===null?g[h]=p:p.constructor!==Object&&(r=i.get(p.constructor))?g[h]=r(p,u):ArrayBuffer.isView(p)?g[h]=x(p):g[h]=u(p)}return g}function _(l){if(typeof l!="object"||l===null)return l;if(Array.isArray(l))return s(l,_);if(l.constructor!==Object&&(r=i.get(l.constructor)))return r(l,_);const g={};for(const h in l){const p=l[h];typeof p!="object"||p===null?g[h]=p:p.constructor!==Object&&(r=i.get(p.constructor))?g[h]=r(p,_):ArrayBuffer.isView(p)?g[h]=x(p):g[h]=_(p)}return g}}function E(f){const i=[],r=[],s=new Map;if(s.set(Date,h=>new Date(h)),s.set(Map,(h,p)=>new Map(_(Array.from(h),p))),s.set(Set,(h,p)=>new Set(_(Array.from(h),p))),f.constructorHandlers)for(const h of f.constructorHandlers)s.set(h[0],h[1]);let u=null;return f.proto?g:l;function _(h,p){const y=Object.keys(h),d=new Array(y.length);for(let b=0;b<y.length;b++){const V=y[b],t=h[V];if(typeof t!="object"||t===null)d[V]=t;else if(t.constructor!==Object&&(u=s.get(t.constructor)))d[V]=u(t,p);else if(ArrayBuffer.isView(t))d[V]=x(t);else{const e=i.indexOf(t);e!==-1?d[V]=r[e]:d[V]=p(t)}}return d}function l(h){if(typeof h!="object"||h===null)return h;if(Array.isArray(h))return _(h,l);if(h.constructor!==Object&&(u=s.get(h.constructor)))return u(h,l);const p={};i.push(h),r.push(p);for(const y in h){if(Object.hasOwnProperty.call(h,y)===!1)continue;const d=h[y];if(typeof d!="object"||d===null)p[y]=d;else if(d.constructor!==Object&&(u=s.get(d.constructor)))p[y]=u(d,l);else if(ArrayBuffer.isView(d))p[y]=x(d);else{const b=i.indexOf(d);b!==-1?p[y]=r[b]:p[y]=l(d)}}return i.pop(),r.pop(),p}function g(h){if(typeof h!="object"||h===null)return h;if(Array.isArray(h))return _(h,g);if(h.constructor!==Object&&(u=s.get(h.constructor)))return u(h,g);const p={};i.push(h),r.push(p);for(const y in h){const d=h[y];if(typeof d!="object"||d===null)p[y]=d;else if(d.constructor!==Object&&(u=s.get(d.constructor)))p[y]=u(d,g);else if(ArrayBuffer.isView(d))p[y]=x(d);else{const b=i.indexOf(d);b!==-1?p[y]=r[b]:p[y]=g(d)}}return i.pop(),r.pop(),p}}return I}var dt=pt();const ft=H.getDefaultExportFromCjs(dt),Q="Output the version number of npm-check-updates.",mt=x=>x.replace(/`/g,""),gt=ft();(async()=>{const{default:x}=await Promise.resolve().then(()=>require("./index-Cx8RNc34.js")),v=x({pkg:H.pkg});if(v.update&&v.update.latest!==H.pkg.version){const{default:n}=await Promise.resolve().then(()=>require("./index-Bl96b__P.js")),o=H.semver.parse(v.update.current)?.major,a=H.semver.parse(v.update.latest)?.major,O=(o&&a&&a>=o?new Array(a-o).fill(0).map((w,m)=>o+m+1):[]).map(w=>`${H.pkg.homepage??""}/releases/tag/v${w}.0.0`),C=`${H.pkg.homepage??""}/compare/v${v.update.current}...v${v.update.latest}`;v.notify({defer:!1,isGlobal:!0,message:`Update available ${n.dim("{currentVersion}")}${n.reset(" → ")}${v.update.type==="major"?n.red("{latestVersion}"):v.update.type==="minor"?n.yellow("{latestVersion}"):n.green("{latestVersion}")}
28
+ Run ${n.cyan("{updateCommand}")} to update
29
+ ${n.dim.underline(v.update.type==="major"?O.map(w=>n.dim.underline(w)).join(`
30
+ `):C)}`})}const E=process.argv.slice(2),f=E.findIndex(n=>n==="--help"||n==="-h");if(f!==-1&&E[f+1]){const n=E[f+1].replace(/^-*/,"");n==="help"||n==="h"?console.info("Would you like some help with your help?"):(await H.chalkInit(),[...E.slice(0,f),...E.slice(f+1)].forEach(a=>{const c=a.replace(/^-*/,""),O=H.cliOptionsSorted.find(C=>c===C.long||c===C.short||c===`no-${C.long}`&&C.type==="boolean");console.info(O?H.renderExtendedHelp(O)+`
31
+ `:c==="version"||c==="v"||c==="V"?H.renderExtendedHelp({long:"version",short:"v",description:Q,type:"string"})+`
32
+ `:`Unknown option: ${a}`)})),process.exit(0)}const i=new Set(H.cliOptionsSorted.filter(n=>n.cli===!1).map(n=>`--${n.long}`));k.description("[filter] is a list or regex of package names to check (all others will be ignored).").usage("[options] [filter]").configureHelp({optionTerm:n=>n.long&&i.has(n.long)?n.long.replace("--","")+"*":n.long==="--version"?"-v, -V, --version":n.flags.replace("[bool]",""),optionDescription:n=>n.long==="--version"?Q:n.long==="--help"?`You're lookin' at it. Run "ncu --help <option>" for a specific option.`:ct.prototype.optionDescription(n)}).addOption(new K("-v, --versionAlias").hideHelp()).on("option:versionAlias",()=>{console.info(H.pkg.version),process.exit(0)}),H.cliOptionsSorted.forEach(({long:n,short:o,arg:a,description:c,default:O,help:C,parse:w,type:m})=>{const A=`${o?`-${o}, `:""}--${n}${a?` <${a}>`:""}`,$=`${mt(c)}${C?` Run "ncu --help ${n}" for details.`:""}`;k.option(A,$,w||O,w?O:void 0),m==="boolean"&&k.addOption(new K(`--no-${n}`).default(!1).hideHelp())}),k.version(H.pkg.version);const r=gt(k._optionValues);k.allowExcessArguments(!0),k.parse(process.argv);const s=k.opts(),u=process.argv.slice(2),{color:_,configFileName:l,configFilePath:g,global:h,packageFile:p,mergeConfig:y}=s;await H.chalkInit(_);const d=!process.env.NCU_TESTS||g||y?await H.getNcuRc({configFileName:l,configFilePath:g,global:h,packageFile:p,options:{...s,cli:!0}}):null,b=(d?.args||[]).filter((n,o,a)=>(typeof n!="string"||!n.startsWith("-")||!u.includes(n))&&(typeof a[o-1]!="string"||!a[o-1].startsWith("-")||!u.includes(a[o-1]))),V=[...process.argv.slice(0,2),...b,...u];k._optionValues=r,k.parse(V);const t=k.opts(),e={...d&&Object.keys(d.config).length>0?{rcConfigPath:d.filePath}:null,...H.pickBy(k.opts(),n=>n!==void 0),args:k.args,...t.filter?{filter:t.filter}:null,...t.reject?{reject:t.reject}:null};H.run(e,{cli:!0})})();
29
33
  //# sourceMappingURL=cli.js.map