@baicie/ncu 0.1.15 → 0.1.16
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/build/chunks/source.js +6 -0
- package/build/chunks/source.js.map +1 -0
- package/build/chunks/src.js +374 -0
- package/build/chunks/src.js.map +1 -0
- package/build/chunks/strip-ansi.js +2 -0
- package/build/chunks/strip-ansi.js.map +1 -0
- package/build/cli.d.ts +1 -1
- package/build/cli.js +7 -32
- package/build/cli.js.map +1 -1
- package/build/index.d.ts +247 -233
- package/build/index.js +1 -598
- package/package.json +71 -62
- package/build/index-Bl96b__P.js +0 -6
- package/build/index-Bl96b__P.js.map +0 -1
- package/build/index-CG9irf3b.js +0 -2
- package/build/index-CG9irf3b.js.map +0 -1
- package/build/index-CiVmsGI5.js +0 -2
- package/build/index-CiVmsGI5.js.map +0 -1
- package/build/index-DDwixysM.js +0 -32
- package/build/index-DDwixysM.js.map +0 -1
- package/build/index.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e({onlyFirst:e=!1}={}){return RegExp(`(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`,e?void 0:`g`)}const t=e();function n(e){if(typeof e!=`string`)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(t,``)}export{n as default};
|
|
2
|
+
//# sourceMappingURL=strip-ansi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strip-ansi.js","names":[],"sources":["../../node_modules/.pnpm/ansi-regex@6.2.2/node_modules/ansi-regex/index.js","../../node_modules/.pnpm/strip-ansi@7.1.2/node_modules/strip-ansi/index.js"],"sourcesContent":["export default function ansiRegex({onlyFirst = false} = {}) {\n\t// Valid string terminator sequences are BEL, ESC\\, and 0x9c\n\tconst ST = '(?:\\\\u0007|\\\\u001B\\\\u005C|\\\\u009C)';\n\n\t// OSC sequences only: ESC ] ... ST (non-greedy until the first ST)\n\tconst osc = `(?:\\\\u001B\\\\][\\\\s\\\\S]*?${ST})`;\n\n\t// CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :) then final byte\n\tconst csi = '[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:\\\\d{1,4}(?:[;:]\\\\d{0,4})*)?[\\\\dA-PR-TZcf-nq-uy=><~]';\n\n\tconst pattern = `${osc}|${csi}`;\n\n\treturn new RegExp(pattern, onlyFirst ? undefined : 'g');\n}\n","import ansiRegex from 'ansi-regex';\n\nconst regex = ansiRegex();\n\nexport default function stripAnsi(string) {\n\tif (typeof string !== 'string') {\n\t\tthrow new TypeError(`Expected a \\`string\\`, got \\`${typeof string}\\``);\n\t}\n\n\t// Even though the regex is global, we don't need to reset the `.lastIndex`\n\t// because unlike `.exec()` and `.test()`, `.replace()` does it automatically\n\t// and doing it manually has a performance penalty.\n\treturn string.replace(regex, '');\n}\n"],"x_google_ignoreList":[0,1],"mappings":"AAAA,SAAwB,EAAU,CAAC,YAAY,IAAS,EAAE,CAAE,CAY3D,OAAW,OAFK,gJAEW,EAAY,IAAA,GAAY,IAAI,CCVxD,MAAM,EAAQ,GAAW,CAEzB,SAAwB,EAAU,EAAQ,CACzC,GAAI,OAAO,GAAW,SACrB,MAAU,UAAU,gCAAgC,OAAO,EAAO,IAAI,CAMvE,OAAO,EAAO,QAAQ,EAAO,GAAG"}
|
package/build/cli.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { }
|
|
1
|
+
export { };
|
package/build/cli.js
CHANGED
|
@@ -1,33 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
`)
|
|
7
|
-
- a short
|
|
8
|
-
|
|
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
|
|
20
|
-
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
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*\.\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}
|
|
22
|
-
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
23
|
-
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
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-DDwixysM.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})})();
|
|
33
|
-
//# sourceMappingURL=cli.js.map
|
|
2
|
+
import{a as e,c as t,d as n,i as r,l as i,n as a,o,s,u as c}from"./chunks/src.js";import l from"semver";import{Help as u,Option as d,program as f}from"commander";import p from"rfdc";const m=`Output the version number of npm-check-updates.`,h=e=>e.replace(/`/g,``),g=p();(async()=>{let{default:p}=await import(`update-notifier`),_=p({pkg:c});if(_.update&&_.update.latest!==n){let{default:e}=await import(`./chunks/source.js`),t=l.parse(_.update.current)?.major,n=l.parse(_.update.latest)?.major,r=(t&&n&&n>=t?Array(n-t).fill(0).map((e,n)=>t+n+1):[]).map(e=>`${i??``}/releases/tag/v${e}.0.0`),a=`${i??``}/compare/v${_.update.current}...v${_.update.latest}`;_.notify({defer:!1,isGlobal:!0,message:`Update available ${e.dim(`{currentVersion}`)}${e.reset(` → `)}${_.update.type===`major`?e.red(`{latestVersion}`):_.update.type===`minor`?e.yellow(`{latestVersion}`):e.green(`{latestVersion}`)}
|
|
3
|
+
Run ${e.cyan(`{updateCommand}`)} to update
|
|
4
|
+
${e.dim.underline(_.update.type===`major`?r.map(t=>e.dim.underline(t)).join(`
|
|
5
|
+
`):a)}`})}let v=process.argv.slice(2),y=v.findIndex(e=>e===`--help`||e===`-h`);if(y!==-1&&v[y+1]){let e=v[y+1].replace(/^-*/,``);e===`help`||e===`h`?console.info(`Would you like some help with your help?`):(await t(),[...v.slice(0,y),...v.slice(y+1)].forEach(e=>{let t=e.replace(/^-*/,``),n=o.find(e=>t===e.long||t===e.short||t===`no-${e.long}`&&e.type===`boolean`);n?console.info(s(n)+`
|
|
6
|
+
`):t===`version`||t===`v`||t===`V`?console.info(s({long:`version`,short:`v`,description:m,type:`string`})+`
|
|
7
|
+
`):console.info(`Unknown option: ${e}`)})),process.exit(0)}let b=new Set(o.filter(e=>e.cli===!1).map(e=>`--${e.long}`));f.description(`[filter] is a list or regex of package names to check (all others will be ignored).`).usage(`[options] [filter]`).configureHelp({optionTerm:e=>e.long&&b.has(e.long)?e.long.replace(`--`,``)+`*`:e.long===`--version`?`-v, -V, --version`:e.flags.replace(`[bool]`,``),optionDescription:e=>e.long===`--version`?m:e.long===`--help`?`You're lookin' at it. Run "ncu --help <option>" for a specific option.`:u.prototype.optionDescription(e)}).addOption(new d(`-v, --versionAlias`).hideHelp()).on(`option:versionAlias`,()=>{console.info(n),process.exit(0)}),o.forEach(({long:e,short:t,arg:n,description:r,default:i,help:a,parse:o,type:s})=>{let c=`${t?`-${t}, `:``}--${e}${n?` <${n}>`:``}`,l=`${h(r)}${a?` Run "ncu --help ${e}" for details.`:``}`;f.option(c,l,o||i,o?i:void 0),s===`boolean`&&f.addOption(new d(`--no-${e}`).default(!1).hideHelp())}),f.version(n);let x=g(f._optionValues);f.allowExcessArguments(!0),f.parse(process.argv);let S=f.opts(),C=process.argv.slice(2),{color:w,configFileName:T,configFilePath:E,global:D,packageFile:O,mergeConfig:k}=S;await t(w);let A=!process.env.NCU_TESTS||E||k?await e({configFileName:T,configFilePath:E,global:D,packageFile:O,options:{...S,cli:!0}}):null,j=(A?.args||[]).filter((e,t,n)=>(typeof e!=`string`||!e.startsWith(`-`)||!C.includes(e))&&(typeof n[t-1]!=`string`||!n[t-1].startsWith(`-`)||!C.includes(n[t-1]))),M=[...process.argv.slice(0,2),...j,...C];f._optionValues=x,f.parse(M);let N=f.opts();a({...A&&Object.keys(A.config).length>0?{rcConfigPath:A.filePath}:null,...r(f.opts(),e=>e!==void 0),args:f.args,...N.filter?{filter:N.filter}:null,...N.reject?{reject:N.reject}:null},{cli:!0})})();
|
|
8
|
+
//# sourceMappingURL=cli.js.map
|