platform/tools/apm/apm.js

35 lines
180 KiB
JavaScript
Raw Normal View History

"use strict";var Ns=Object.create;var Fe=Object.defineProperty,_s=Object.defineProperties,Is=Object.getOwnPropertyDescriptor,Ps=Object.getOwnPropertyDescriptors,Os=Object.getOwnPropertyNames,ft=Object.getOwnPropertySymbols,Ms=Object.getPrototypeOf,dt=Object.prototype.hasOwnProperty,Ls=Object.prototype.propertyIsEnumerable;var mt=(h,e,s)=>e in h?Fe(h,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):h[e]=s,xt=(h,e)=>{for(var s in e||={})dt.call(e,s)&&mt(h,s,e[s]);if(ft)for(var s of ft(e))Ls.call(e,s)&&mt(h,s,e[s]);return h},Dt=(h,e)=>_s(h,Ps(e));var _=(h,e)=>()=>(e||h((e={exports:{}}).exports,e),e.exports);var Xs=(h,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let u of Os(e))!dt.call(h,u)&&u!==s&&Fe(h,u,{get:()=>e[u],enumerable:!(r=Is(e,u))||r.enumerable});return h};var we=(h,e,s)=>(s=h!=null?Ns(Ms(h)):{},Xs(e||!h||!h.__esModule?Fe(s,"default",{value:h,enumerable:!0}):s,h));var te=_(ke=>{var pe=class extends Error{constructor(e,s,r){super(r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=s,this.exitCode=e,this.nestedError=void 0}},be=class extends pe{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};ke.CommanderError=pe;ke.InvalidArgumentError=be});var fe=_(Te=>{var{InvalidArgumentError:Rs}=te(),Be=class{constructor(e,s){switch(this.description=s||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,s){return s===this.defaultValue||!Array.isArray(s)?[e]:s.concat(e)}default(e,s){return this.defaultValue=e,this.defaultValueDescription=s,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e,this.parseArg=(s,r)=>{if(!e.includes(s))throw new Rs(`Allowed choices are ${e.join(", ")}.`);return this.variadic?this._concatValue(s,r):s},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Js(h){let e=h.name()+(h.variadic===!0?"...":"");return h.required?"<"+e+">":"["+e+"]"}Te.Argument=Be;Te.humanReadableArgName=Js});var _e=_(Et=>{var{humanReadableArgName:Us}=fe(),Ne=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1}visibleCommands(e){let s=e.commands.filter(r=>!r._hidden);if(e._hasImplicitHelpCommand()){let[,r,u]=e._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),l=e.createCommand(r).helpOption(!1);l.description(e._helpCommandDescription),u&&l.arguments(u),s.push(l)}return this.sortSubcommands&&s.sort((r,u)=>r.name().localeCompare(u.name())),s}visibleOptions(e){let s=e.options.filter(l=>!l.hidden),r=e._hasHelpOption&&e._helpShortFlag&&!e._findOption(e._helpShortFlag),u=e._hasHelpOption&&!e._findOption(e._helpLongFlag);if(r||u){let l;r?u?l=e.createOption(e._helpFlags,e._helpDescription):l=e.createOption(e._helpShortFlag,e._helpDescription):l=e.createOption(e._helpLongFlag,e._helpDescription),s.push(l)}if(this.sortOptions){let l=o=>o.short?o.short.replace(/^-/,""):o.long.replace(/^--/,"");s.sort((o,D)=>l(o).localeCompare(l(D)))}return s}visibleArguments(e){return e._argsDescription&&e._args.forEach(s=>{s.description=s.description||e._argsDescription[s.name()]||""}),e._args.find(s=>s.description)?e._args:[]}subcommandTerm(e){let s=e._args.map(r=>Us(r)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(s?" "+s:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,s){return s.visibleCommands(e).reduce((r,u)=>Math.max(r,s.subcommandTerm(u).length),0)}longestOptionTermLength(e,s){return s.visibleOptions(e).reduce((r,u)=>Math.max(r,s.optionTerm(u).length),0)}longestArgumentTermLength(e,s){return s.visibleArguments(e).reduce((r,u)
`).replace(/^/gm," ".repeat(l))}let f=[`Usage: ${s.commandUsage(e)}`,""],p=s.commandDescription(e);p.length>0&&(f=f.concat([p,""]));let d=s.visibleArguments(e).map(i=>D(s.argumentTerm(i),s.argumentDescription(i)));d.length>0&&(f=f.concat(["Arguments:",m(d),""]));let c=s.visibleOptions(e).map(i=>D(s.optionTerm(i),s.optionDescription(i)));c.length>0&&(f=f.concat(["Options:",m(c),""]));let t=s.visibleCommands(e).map(i=>D(s.subcommandTerm(i),s.subcommandDescription(i)));return t.length>0&&(f=f.concat(["Commands:",m(t),""])),f.join(`
`)}padWidth(e,s){return Math.max(s.longestOptionTermLength(e,s),s.longestSubcommandTermLength(e,s),s.longestArgumentTermLength(e,s))}wrap(e,s,r,u=40){if(e.match(/[\n]\s+/))return e;let l=s-r;if(l<u)return e;let o=e.substr(0,r),D=e.substr(r),m=" ".repeat(r),f=new RegExp(".{1,"+(l-1)+"}([\\s\u200B]|$)|[^\\s\u200B]+?([\\s\u200B]|$)","g"),p=D.match(f)||[];return o+p.map((d,c)=>(d.slice(-1)===`
`&&(d=d.slice(0,d.length-1)),(c>0?m:"")+d.trimRight())).join(`
`)}};Et.Help=Ne});var Oe=_(Pe=>{var{InvalidArgumentError:zs}=te(),Ie=class{constructor(e,s){this.flags=e,this.description=s||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let r=gt(e);this.short=r.shortFlag,this.long=r.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0}default(e,s){return this.defaultValue=e,this.defaultValueDescription=s,this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,s){return s===this.defaultValue||!Array.isArray(s)?[e]:s.concat(e)}choices(e){return this.argChoices=e,this.parseArg=(s,r)=>{if(!e.includes(s))throw new zs(`Allowed choices are ${e.join(", ")}.`);return this.variadic?this._concatValue(s,r):s},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return Hs(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}};function Hs(h){return h.split("-").reduce((e,s)=>e+s[0].toUpperCase()+s.slice(1))}function gt(h){let e,s,r=h.split(/[ |,]+/);return r.length>1&&!/^[[<]/.test(r[1])&&(e=r.shift()),s=r.shift(),!e&&/^-[^-]$/.test(s)&&(e=s,s=void 0),{shortFlag:e,longFlag:s}}Pe.Option=Ie;Pe.splitOptionFlags=gt});var Ct=_(vt=>{function js(h,e){if(Math.abs(h.length-e.length)>3)return Math.max(h.length,e.length);let s=[];for(let r=0;r<=h.length;r++)s[r]=[r];for(let r=0;r<=e.length;r++)s[0][r]=r;for(let r=1;r<=e.length;r++)for(let u=1;u<=h.length;u++){let l=1;h[u-1]===e[r-1]?l=0:l=1,s[u][r]=Math.min(s[u-1][r]+1,s[u][r-1]+1,s[u-1][r-1]+l),u>1&&r>1&&h[u-1]===e[r-2]&&h[u-2]===e[r-1]&&(s[u][r]=Math.min(s[u][r],s[u-2][r-2]+1))}return s[h.length][e.length]}function Vs(h,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let s=h.startsWith("--");s&&(h=h.slice(2),e=e.map(o=>o.slice(2)));let r=[],u=3,l=.4;return e.forEach(o=>{if(o.length<=1)return;let D=js(h,o),m=Math.max(h.length,o.length);(m-D)/m>l&&(D<u?(u=D,r=[o]):D===u&&r.push(o))}),r.sort((o,D)=>o.localeCompare(D)),s&&(r=r.map(o=>`--${o}`)),r.length>1?`
(Did you mean one of ${r.join(", ")}?)`:r.length===1?`
(Did you mean ${r[0]}?)`:""}vt.suggestSimilar=Vs});var wt=_(Ft=>{var Ks=require("events").EventEmitter,Me=require("child_process"),G=require("path"),Le=require("fs"),{Argument:$s,humanReadableArgName:Gs}=fe(),{CommanderError:Xe}=te(),{Help:Ws}=_e(),{Option:qs,splitOptionFlags:Ys}=Oe(),{suggestSimilar:At}=Ct(),ie=class extends Ks{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this._args=[],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._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!1,this._outputConfiguration={writeOut:s=>process.stdout.write(s),writeErr:s=>process.stderr.write(s),getOutHelpWidth:()=>process.stdout.isTTY?process.stdout.columns:void 0,getErrHelpWidth:()=>process.stderr.isTTY?process.stderr.columns:void 0,outputError:(s,r)=>r(s)},this._hidden=!1,this._hasHelpOption=!0,this._helpFlags="-h, --help",this._helpDescription="display help for command",this._helpShortFlag="-h",this._helpLongFlag="--help",this._addImplicitHelpCommand=void 0,this._helpCommandName="help",this._helpCommandnameAndArgs="help [command]",this._helpCommandDescription="display help for command",this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._hasHelpOption=e._hasHelpOption,this._helpFlags=e._helpFlags,this._helpDescription=e._helpDescription,this._helpShortFlag=e._helpShortFlag,this._helpLongFlag=e._helpLongFlag,this._helpCommandName=e._helpCommandName,this._helpCommandnameAndArgs=e._helpCommandnameAndArgs,this._helpCommandDescription=e._helpCommandDescription,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}command(e,s,r){let u=s,l=r;typeof u=="object"&&u!==null&&(l=u,u=null),l=l||{};let[,o,D]=e.match(/([^ ]+) *(.*)/),m=this.createCommand(o);return u&&(m.description(u),m._executableHandler=!0),l.isDefault&&(this._defaultCommandName=m._name),m._hidden=!!(l.noHelp||l.hidden),m._executableFile=l.executableFile||null,D&&m.arguments(D),this.commands.push(m),m.parent=this,m.copyInheritedSettings(this),u?this:m}createCommand(e){return new ie(e)}createHelp(){return Object.assign(new Ws,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,s){if(!e._name)throw new Error("Command passed to .addCommand() must have a name");function r(u){u.forEach(l=>{if(l._executableHandler&&!l._executableFile)throw new Error(`Must specify executableFile for deeply nested executable: ${l.name()}`);r(l.commands)})}return r(e.commands),s=s||{},s.isDefault&&(this._defaultCommandName=e._name),(s.noHelp||s.hidden)&&(e._hidden=!0),this.commands.push(e),e.parent=this,this}createArgument(e,s){return new $s(e,s)}argument(e,s,r,u){let l=this.createArgument(e,s);return typeof r=="function"?l.default(u).argParser(r):l.default(r),this.addArgument(l),this}arguments(e){return e.split(/ +/).forEach(s=>{this.argument(s)}),this}addArgument(e){let s=this._args.slice(-1)[0
Expecting one of '${r.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(s):this._lifeCycleHooks[e]=[s],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=s=>{if(s.code!=="commander.executeSubCommandAsync")throw s},this}_exit(e,s,r){this._exitCallback&&this._exitCallback(new Xe(e,s,r)),process.exit(e)}action(e){let s=r=>{let u=this._args.length,l=r.slice(0,u);return this._storeOptionsAsProperties?l[u]=this:l[u]=this.opts(),l.push(this),e.apply(this,l)};return this._actionHandler=s,this}createOption(e,s){return new qs(e,s)}addOption(e){let s=e.name(),r=e.attributeName(),u=e.defaultValue;if(e.negate||e.optional||e.required||typeof u=="boolean"){if(e.negate){let o=e.long.replace(/^--no-/,"--");u=this._findOption(o)?this.getOptionValue(r):!0}u!==void 0&&this.setOptionValueWithSource(r,u,"default")}this.options.push(e);let l=(o,D,m)=>{let f=this.getOptionValue(r);if(o!==null&&e.parseArg)try{o=e.parseArg(o,f===void 0?u:f)}catch(p){if(p.code==="commander.invalidArgument"){let d=`${D} ${p.message}`;this._displayError(p.exitCode,p.code,d)}throw p}else o!==null&&e.variadic&&(o=e._concatValue(o,f));typeof f=="boolean"||typeof f>"u"?o==null?this.setOptionValueWithSource(r,e.negate?!1:u||!0,m):this.setOptionValueWithSource(r,o,m):o!==null&&this.setOptionValueWithSource(r,e.negate?!1:o,m)};return this.on("option:"+s,o=>{let D=`error: option '${e.flags}' argument '${o}' is invalid.`;l(o,D,"cli")}),e.envVar&&this.on("optionEnv:"+s,o=>{let D=`error: option '${e.flags}' value '${o}' from env '${e.envVar}' is invalid.`;l(o,D,"env")}),this}_optionEx(e,s,r,u,l){let o=this.createOption(s,r);if(o.makeOptionMandatory(!!e.mandatory),typeof u=="function")o.default(l).argParser(u);else if(u instanceof RegExp){let D=u;u=(m,f)=>{let p=D.exec(m);return p?p[0]:f},o.default(l).argParser(u)}else o.default(u);return this.addOption(o)}option(e,s,r,u){return this._optionEx({},e,s,r,u)}requiredOption(e,s,r,u){return this._optionEx({mandatory:!0},e,s,r,u)}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){if(this._passThroughOptions=!!e,this.parent&&e&&!this.parent._enablePositionalOptions)throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");return this}storeOptionsAsProperties(e=!0){if(this._storeOptionsAsProperties=!!e,this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");return this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,s){return this._storeOptionsAsProperties?this[e]=s:this._optionValues[e]=s,this}setOptionValueWithSource(e,s,r){return this.setOptionValue(e,s),this._optionValueSources[e]=r,this}getOptionValueSource(e){return this._optionValueSources[e]}_prepareUserArgs(e,s){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");s=s||{},e===void 0&&(e=process.argv,process.versions&&process.versions.electron&&(s.from="electron")),this.rawArgs=e.slice();let r;switch(s.from){case void 0:case"node":this._scriptPath=e[1],r=e.slice(2);break;case"electron":process.defaultApp?(this._scriptPath=e[1],r=e.slice(2)):r=e.slice(1);break;case"user":r=e.slice(0);break;default:throw new Error(`unexpected parse option { from: '${s.from}' }`)}return!this._scriptPath&&require.main&&(this._scriptPath=require.main.filename),this._name=this._name||this._scriptPath&&G.basename(this._scriptPath,G.extname(this._scriptPath)),r}parse(e,s){let r=this._prepareUserArgs(e,s);return this._parseCommand([],r),this}async parseAsync(e,s){let r=this._prepareUserArgs(e,s);return await this._parseCommand([],r),this}_executeSubCommand(e,s){s=s.slice();let r=!1,u=[".js",".ts",".tsx",".mjs",".cjs"];this._checkForMissingMandatoryOptions();let l=this._scriptPath;!l&&require
- if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
- if the default executable name is not suitable, use the executableFile option to supply a custom name`;throw new Error(t)}else if(c.code==="EACCES")throw new Error(`'${D}' not executable`);if(!d)process.exit(1);else{let t=new Xe(1,"commander.executeSubCommandAsync","(error)");t.nestedError=c,d(t)}}),this.runningCommand=f}_dispatchSubcommand(e,s,r){let u=this._findCommand(e);if(u||this.help({error:!0}),u._executableHandler)this._executeSubCommand(u,s.concat(r));else return u._parseCommand(s,r)}_checkNumberOfArguments(){this._args.forEach((e,s)=>{e.required&&this.args[s]==null&&this.missingArgument(e.name())}),!(this._args.length>0&&this._args[this._args.length-1].variadic)&&this.args.length>this._args.length&&this._excessArguments(this.args)}_processArguments(){let e=(r,u,l)=>{let o=u;if(u!==null&&r.parseArg)try{o=r.parseArg(u,l)}catch(D){if(D.code==="commander.invalidArgument"){let m=`error: command-argument value '${u}' is invalid for argument '${r.name()}'. ${D.message}`;this._displayError(D.exitCode,D.code,m)}throw D}return o};this._checkNumberOfArguments();let s=[];this._args.forEach((r,u)=>{let l=r.defaultValue;r.variadic?u<this.args.length?(l=this.args.slice(u),r.parseArg&&(l=l.reduce((o,D)=>e(r,D,o),r.defaultValue))):l===void 0&&(l=[]):u<this.args.length&&(l=this.args[u],r.parseArg&&(l=e(r,l,r.defaultValue))),s[u]=l}),this.processedArgs=s}_chainOrCall(e,s){return e&&e.then&&typeof e.then=="function"?e.then(()=>s()):s()}_chainOrCallHooks(e,s){let r=e,u=[];return Re(this).reverse().filter(l=>l._lifeCycleHooks[s]!==void 0).forEach(l=>{l._lifeCycleHooks[s].forEach(o=>{u.push({hookedCommand:l,callback:o})})}),s==="postAction"&&u.reverse(),u.forEach(l=>{r=this._chainOrCall(r,()=>l.callback(l.hookedCommand,this))}),r}_parseCommand(e,s){let r=this.parseOptions(s);if(this._parseOptionsEnv(),e=e.concat(r.operands),s=r.unknown,this.args=e.concat(s),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),s);if(this._hasImplicitHelpCommand()&&e[0]===this._helpCommandName)return e.length===1&&this.help(),this._dispatchSubcommand(e[1],[],[this._helpLongFlag]);if(this._defaultCommandName)return yt(this,s),this._dispatchSubcommand(this._defaultCommandName,e,s);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),yt(this,r.unknown),this._checkForMissingMandatoryOptions();let u=()=>{r.unknown.length>0&&this.unknownOption(r.unknown[0])},l=`command:${this.name()}`;if(this._actionHandler){u(),this._processArguments();let o;return o=this._chainOrCallHooks(o,"preAction"),o=this._chainOrCall(o,()=>this._actionHandler(this.processedArgs)),this.parent&&this.parent.emit(l,e,s),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent&&this.parent.listenerCount(l))u(),this._processArguments(),this.parent.emit(l,e,s);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,s);this.listenerCount("command:*")?this.emit("command:*",e,s):this.commands.length?this.unknownCommand():(u(),this._processArguments())}else this.commands.length?(u(),this.help({error:!0})):(u(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(s=>s._name===e||s._aliases.includes(e))}_findOption(e){return this.options.find(s=>s.is(e))}_checkForMissingMandatoryOptions(){for(let e=this;e;e=e.parent)e.options.forEach(s=>{s.mandatory&&e.getOptionValue(s.attributeName())===void 0&&e.missingMandatoryOptionValue(s)})}parseOptions(e){let s=[],r=[],u=s,l=e.slice();function o(m){return m.length>1&&m[0]==="-"}let D=null;for(;l.length;){let m=l.shift();if(m==="--"){u===r&&u.push(m),u.push(...l);break}if(D&&!o(m)){this.emit(`option:${D.name()}`,m);continue}if(D=null,o(m)){let f=this._findOption(m);if(f){if(f.required){let p=l.shift();p===void 0&&this.optionMissingArgument(f),this.emit(`option:${f.name()}`,p)}else if(f.optional){let p=null;l.length>0&&!o(l[0])&&(p=l.shift()),this.emit(`option:${f.name()}`,p)}else this.emit(`option:${f.name()}`);D=f.variadic?f:null;continue}}if(m.length>2&&m[0]==="-"&&m[1]!=="-"){let f=this._findOption(`-${m[1]}`);if(f){f.req
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
`),this.outputHelp({error:!0})),this._exit(e,s,r)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in process.env){let s=e.attributeName();(this.getOptionValue(s)===void 0||["default","config","env"].includes(this.getOptionValueSource(s)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,process.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}missingArgument(e){let s=`error: missing required argument '${e}'`;this._displayError(1,"commander.missingArgument",s)}optionMissingArgument(e){let s=`error: option '${e.flags}' argument missing`;this._displayError(1,"commander.optionMissingArgument",s)}missingMandatoryOptionValue(e){let s=`error: required option '${e.flags}' not specified`;this._displayError(1,"commander.missingMandatoryOptionValue",s)}unknownOption(e){if(this._allowUnknownOption)return;let s="";if(e.startsWith("--")&&this._showSuggestionAfterError){let u=[],l=this;do{let o=l.createHelp().visibleOptions(l).filter(D=>D.long).map(D=>D.long);u=u.concat(o),l=l.parent}while(l&&!l._enablePositionalOptions);s=At(e,u)}let r=`error: unknown option '${e}'${s}`;this._displayError(1,"commander.unknownOption",r)}_excessArguments(e){if(this._allowExcessArguments)return;let s=this._args.length,r=s===1?"":"s",l=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${s} argument${r} but got ${e.length}.`;this._displayError(1,"commander.excessArguments",l)}unknownCommand(){let e=this.args[0],s="";if(this._showSuggestionAfterError){let u=[];this.createHelp().visibleCommands(this).forEach(l=>{u.push(l.name()),l.alias()&&u.push(l.alias())}),s=At(e,u)}let r=`error: unknown command '${e}'${s}`;this._displayError(1,"commander.unknownCommand",r)}version(e,s,r){if(e===void 0)return this._version;this._version=e,s=s||"-V, --version",r=r||"output the version number";let u=this.createOption(s,r);return this._versionOptionName=u.attributeName(),this.options.push(u),this.on("option:"+u.name(),()=>{this._outputConfiguration.writeOut(`${e}
`),this._exit(0,"commander.version",e)}),this}description(e,s){return e===void 0&&s===void 0?this._description:(this._description=e,s&&(this._argsDescription=s),this)}alias(e){if(e===void 0)return this._aliases[0];let s=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(s=this.commands[this.commands.length-1]),e===s._name)throw new Error("Command alias can't be the same as its name");return s._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(s=>this.alias(s)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let s=this._args.map(r=>Gs(r));return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this._args.length?s:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpInformation(e){let s=this.createHelp();return s.helpWidth===void 0&&(s.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),s.formatHelp(this,s)}_getHelpContext(e){e=e||{};let s={error:!!e.error},r;return s.error?r=u=>this._outputConfiguration.writeErr(u):r=u=>this._outputConfiguration.writeOut(u),s.write=e.write||r,s.command=this,s}outputHelp(e){let s;typeof e=="function"&&(s=e,e=void 0);let r=this._getHelpContext(e);Re(this).reverse().forEach(l=>l.emit("beforeAllHelp",r)),this.emit("beforeHelp",r);let u=this.helpInformation(r);if(s&&(u=s(u),typeof u!="string"&&!Buffer.isBuffer(u)))throw new Error("outputHelp callback must return a string or a Buffer");r.write(u),this.emit(this._helpLongFlag),this.emit("afterHelp",r),Re(this).forEach(l=>l.emit("afterAllHelp",r))}helpOption(e,s){if(typeof e=="boolean")return this._hasHelpOption=e,this;this._helpFlags=e||this._helpFlags,this._helpDescription=s||this._helpDescription;let r=Ys(this._helpFlags);return this._helpShortFlag=r.shortFlag,this._helpLongFlag=r.longFlag,this}help(e){this.outputHelp(e);let s=process.exitCode||0;s===0&&e&&typeof e!="function"&&e.error&&(s=1),this._exit(s,"commander.help","(outputHelp)")}addHelpText(e,s){let r=["beforeAll","before","after","afterAll"];if(!r.includes(e))throw new Error(`Unexpected value for position to addHelpText.
Expecting one of '${r.join("', '")}'`);let u=`${e}Help`;return this.on(u,l=>{let o;typeof s=="function"?o=s({error:l.error,command:l.command}):o=s,o&&l.write(`${o}
`)}),this}};function yt(h,e){h._hasHelpOption&&e.find(r=>r===h._helpLongFlag||r===h._helpShortFlag)&&(h.outputHelp(),h._exit(0,"commander.helpDisplayed","(outputHelp)"))}function St(h){return h.map(e=>{if(!e.startsWith("--inspect"))return e;let s,r="127.0.0.1",u="9229",l;return(l=e.match(/^(--inspect(-brk)?)$/))!==null?s=l[1]:(l=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(s=l[1],/^\d+$/.test(l[3])?u=l[3]:r=l[3]):(l=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(s=l[1],r=l[3],u=l[4]),s&&u!=="0"?`${s}=${r}:${parseInt(u)+1}`:e})}function Re(h){let e=[];for(let s=h;s;s=s.parent)e.push(s);return e}Ft.Command=ie});var Tt=_((U,Bt)=>{var{Argument:Qs}=fe(),{Command:bt}=wt(),{CommanderError:Zs,InvalidArgumentError:kt}=te(),{Help:er}=_e(),{Option:tr}=Oe();U=Bt.exports=new bt;U.program=U;U.Argument=Qs;U.Command=bt;U.CommanderError=Zs;U.Help=er;U.InvalidArgumentError=kt;U.InvalidOptionArgumentError=kt;U.Option=tr});var Nt=_((se,Je)=>{(function(e,s){typeof se=="object"&&typeof Je=="object"?Je.exports=s():typeof define=="function"&&define.amd?define([],s):typeof se=="object"?se.esprima=s():e.esprima=s()})(se,function(){return function(h){var e={};function s(r){if(e[r])return e[r].exports;var u=e[r]={exports:{},id:r,loaded:!1};return h[r].call(u.exports,u,u.exports,s),u.loaded=!0,u.exports}return s.m=h,s.c=e,s.p="",s(0)}([function(h,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=s(1),u=s(3),l=s(8),o=s(15);function D(c,t,i){var n=null,a=function(B,T){i&&i(B,T),n&&n.visit(B,T)},x=typeof i=="function"?a:null,E=!1;if(t){E=typeof t.comment=="boolean"&&t.comment;var C=typeof t.attachComment=="boolean"&&t.attachComment;(E||C)&&(n=new r.CommentHandler,n.attach=C,t.comment=!0,x=a)}var y=!1;t&&typeof t.sourceType=="string"&&(y=t.sourceType==="module");var S;t&&typeof t.jsx=="boolean"&&t.jsx?S=new u.JSXParser(c,t,x):S=new l.Parser(c,t,x);var w=y?S.parseModule():S.parseScript(),b=w;return E&&n&&(b.comments=n.comments),S.config.tokens&&(b.tokens=S.tokens),S.config.tolerant&&(b.errors=S.errorHandler.errors),b}e.parse=D;function m(c,t,i){var n=t||{};return n.sourceType="module",D(c,n,i)}e.parseModule=m;function f(c,t,i){var n=t||{};return n.sourceType="script",D(c,n,i)}e.parseScript=f;function p(c,t,i){var n=new o.Tokenizer(c,t),a;a=[];try{for(;;){var x=n.getNextToken();if(!x)break;i&&(x=i(x)),a.push(x)}}catch(E){n.errorHandler.tolerate(E)}return n.errorHandler.tolerant&&(a.errors=n.errors()),a}e.tokenize=p;var d=s(2);e.Syntax=d.Syntax,e.version="4.0.1"},function(h,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=s(2),u=function(){function l(){this.attach=!1,this.comments=[],this.stack=[],this.leading=[],this.trailing=[]}return l.prototype.insertInnerComments=function(o,D){if(o.type===r.Syntax.BlockStatement&&o.body.length===0){for(var m=[],f=this.leading.length-1;f>=0;--f){var p=this.leading[f];D.end.offset>=p.start&&(m.unshift(p.comment),this.leading.splice(f,1),this.trailing.splice(f,1))}m.length&&(o.innerComments=m)}},l.prototype.findTrailingComments=function(o){var D=[];if(this.trailing.length>0){for(var m=this.trailing.length-1;m>=0;--m){var f=this.trailing[m];f.start>=o.end.offset&&D.unshift(f.comment)}return this.trailing.length=0,D}var p=this.stack[this.stack.length-1];if(p&&p.node.trailingComments){var d=p.node.trailingComments[0];d&&d.range[0]>=o.end.offset&&(D=p.node.trailingComments,delete p.node.trailingComments)}return D},l.prototype.findLeadingComments=function(o){for(var D=[],m;this.stack.length>0;){var f=this.stack[this.stack.length-1];if(f&&f.start>=o.start.offset)m=f.node,this.stack.pop();else break}if(m){for(var p=m.leadingComments?m.leadingComments.length:0,d=p-1;d>=0;--d){var c=m.leadingComments[d];c.range[1]<=o.start.offset&&(D.unshift(c),m.leadingComments.splice(d,1))}return m.leadingComments&&m.leadingComments.length===0&&delete m.leadingComments,D}for(var d=this.leading.length-1;d>=0;--d){var f=this.leading[d];f.start<=o.start.offset&&(D.unshift(f.comment),this.leading.splice(d,1))}return D},l.prototype.visitNode=function(o,D){if(!(o.type===r.Syntax
`&&++this.scanner.index,this.scanner.lineStart=this.scanner.index)}this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart;var E={type:101,value:a,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:n,end:this.scanner.index};return a.length>0&&this.config.tokens&&this.tokens.push(this.convertToken(E)),E},i.prototype.peekJSXToken=function(){var n=this.scanner.saveState();this.scanner.scanComments();var a=this.lexJSX();return this.scanner.restoreState(n),a},i.prototype.expectJSX=function(n){var a=this.nextJSXToken();(a.type!==7||a.value!==n)&&this.throwUnexpectedToken(a)},i.prototype.matchJSX=function(n){var a=this.peekJSXToken();return a.type===7&&a.value===n},i.prototype.parseJSXIdentifier=function(){var n=this.createJSXNode(),a=this.nextJSXToken();return a.type!==100&&this.throwUnexpectedToken(a),this.finalize(n,new l.JSXIdentifier(a.value))},i.prototype.parseJSXElementName=function(){var n=this.createJSXNode(),a=this.parseJSXIdentifier();if(this.matchJSX(":")){var x=a;this.expectJSX(":");var E=this.parseJSXIdentifier();a=this.finalize(n,new l.JSXNamespacedName(x,E))}else if(this.matchJSX("."))for(;this.matchJSX(".");){var C=a;this.expectJSX(".");var y=this.parseJSXIdentifier();a=this.finalize(n,new l.JSXMemberExpression(C,y))}return a},i.prototype.parseJSXAttributeName=function(){var n=this.createJSXNode(),a,x=this.parseJSXIdentifier();if(this.matchJSX(":")){var E=x;this.expectJSX(":");var C=this.parseJSXIdentifier();a=this.finalize(n,new l.JSXNamespacedName(E,C))}else a=x;return a},i.prototype.parseJSXStringLiteralAttribute=function(){var n=this.createJSXNode(),a=this.nextJSXToken();a.type!==8&&this.throwUnexpectedToken(a);var x=this.getTokenRaw(a);return this.finalize(n,new D.Literal(a.value,x))},i.prototype.parseJSXExpressionAttribute=function(){var n=this.createJSXNode();this.expectJSX("{"),this.finishJSX(),this.match("}")&&this.tolerateError("JSX attributes must only be assigned a non-empty expression");var a=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(n,new l.JSXExpressionContainer(a))},i.prototype.parseJSXAttributeValue=function(){return this.matchJSX("{")?this.parseJSXExpressionAttribute():this.matchJSX("<")?this.parseJSXElement():this.parseJSXStringLiteralAttribute()},i.prototype.parseJSXNameValueAttribute=function(){var n=this.createJSXNode(),a=this.parseJSXAttributeName(),x=null;return this.matchJSX("=")&&(this.expectJSX("="),x=this.parseJSXAttributeValue()),this.finalize(n,new l.JSXAttribute(a,x))},i.prototype.parseJSXSpreadAttribute=function(){var n=this.createJSXNode();this.expectJSX("{"),this.expectJSX("..."),this.finishJSX();var a=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(n,new l.JSXSpreadAttribute(a))},i.prototype.parseJSXAttributes=function(){for(var n=[];!this.matchJSX("/")&&!this.matchJSX(">");){var a=this.matchJSX("{")?this.parseJSXSpreadAttribute():this.parseJSXNameValueAttribute();n.push(a)}return n},i.prototype.parseJSXOpeningElement=function(){var n=this.createJSXNode();this.expectJSX("<");var a=this.parseJSXElementName(),x=this.parseJSXAttributes(),E=this.matchJSX("/");return E&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(n,new l.JSXOpeningElement(a,E,x))},i.prototype.parseJSXBoundaryElement=function(){var n=this.createJSXNode();if(this.expectJSX("<"),this.matchJSX("/")){this.expectJSX("/");var a=this.parseJSXElementName();return this.expectJSX(">"),this.finalize(n,new l.JSXClosingElement(a))}var x=this.parseJSXElementName(),E=this.parseJSXAttributes(),C=this.matchJSX("/");return C&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(n,new l.JSXOpeningElement(x,C,E))},i.prototype.parseJSXEmptyExpression=function(){var n=this.createJSXChildNode();return this.collectComments(),this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.finalize(n,new l.JSXEmptyExpression)},i.prototype.parseJSXExpressionContainer=func
`;break;case"r":t+="\r";break;case"t":t+=" ";break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;case"8":case"9":t+=i,this.tolerateUnexpectedToken();break;default:if(i&&u.Character.isOctalDigit(i.charCodeAt(0))){var x=this.octalToDecimal(i);c=x.octal||c,t+=String.fromCharCode(x.code)}else t+=i;break}else++this.lineNumber,i==="\r"&&this.source[this.index]===`
`&&++this.index,this.lineStart=this.index;else{if(u.Character.isLineTerminator(i.charCodeAt(0)))break;t+=i}}return d!==""&&(this.index=p,this.throwUnexpectedToken()),{type:8,value:t,octal:c,lineNumber:this.lineNumber,lineStart:this.lineStart,start:p,end:this.index}},f.prototype.scanTemplate=function(){var p="",d=!1,c=this.index,t=this.source[c]==="`",i=!1,n=2;for(++this.index;!this.eof();){var a=this.source[this.index++];if(a==="`"){n=1,i=!0,d=!0;break}else if(a==="$"){if(this.source[this.index]==="{"){this.curlyStack.push("${"),++this.index,d=!0;break}p+=a}else if(a==="\\")if(a=this.source[this.index++],u.Character.isLineTerminator(a.charCodeAt(0)))++this.lineNumber,a==="\r"&&this.source[this.index]===`
`&&++this.index,this.lineStart=this.index;else switch(a){case"n":p+=`
`;break;case"r":p+="\r";break;case"t":p+=" ";break;case"u":if(this.source[this.index]==="{")++this.index,p+=this.scanUnicodeCodePointEscape();else{var x=this.index,E=this.scanHexEscape(a);E!==null?p+=E:(this.index=x,p+=a)}break;case"x":var C=this.scanHexEscape(a);C===null&&this.throwUnexpectedToken(l.Messages.InvalidHexEscapeSequence),p+=C;break;case"b":p+="\b";break;case"f":p+="\f";break;case"v":p+="\v";break;default:a==="0"?(u.Character.isDecimalDigit(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(l.Messages.TemplateOctalLiteral),p+="\0"):u.Character.isOctalDigit(a.charCodeAt(0))?this.throwUnexpectedToken(l.Messages.TemplateOctalLiteral):p+=a;break}else u.Character.isLineTerminator(a.charCodeAt(0))?(++this.lineNumber,a==="\r"&&this.source[this.index]===`
`&&++this.index,this.lineStart=this.index,p+=`
`):p+=a}return d||this.throwUnexpectedToken(),t||this.curlyStack.pop(),{type:10,value:this.source.slice(c+1,this.index-n),cooked:p,head:t,tail:i,lineNumber:this.lineNumber,lineStart:this.lineStart,start:c,end:this.index}},f.prototype.testRegExp=function(p,d){var c="\uFFFF",t=p,i=this;d.indexOf("u")>=0&&(t=t.replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g,function(n,a,x){var E=parseInt(a||x,16);return E>1114111&&i.throwUnexpectedToken(l.Messages.InvalidRegExp),E<=65535?String.fromCharCode(E):c}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,c));try{RegExp(t)}catch{this.throwUnexpectedToken(l.Messages.InvalidRegExp)}try{return new RegExp(p,d)}catch{return null}},f.prototype.scanRegExpBody=function(){var p=this.source[this.index];r.assert(p==="/","Regular expression literal must start with a slash");for(var d=this.source[this.index++],c=!1,t=!1;!this.eof();)if(p=this.source[this.index++],d+=p,p==="\\")p=this.source[this.index++],u.Character.isLineTerminator(p.charCodeAt(0))&&this.throwUnexpectedToken(l.Messages.UnterminatedRegExp),d+=p;else if(u.Character.isLineTerminator(p.charCodeAt(0)))this.throwUnexpectedToken(l.Messages.UnterminatedRegExp);else if(c)p==="]"&&(c=!1);else if(p==="/"){t=!0;break}else p==="["&&(c=!0);return t||this.throwUnexpectedToken(l.Messages.UnterminatedRegExp),d.substr(1,d.length-2)},f.prototype.scanRegExpFlags=function(){for(var p="",d="";!this.eof();){var c=this.source[this.index];if(!u.Character.isIdentifierPart(c.charCodeAt(0)))break;if(++this.index,c==="\\"&&!this.eof())if(c=this.source[this.index],c==="u"){++this.index;var t=this.index,i=this.scanHexEscape("u");if(i!==null)for(d+=i,p+="\\u";t<this.index;++t)p+=this.source[t];else this.index=t,d+="u",p+="\\u";this.tolerateUnexpectedToken()}else p+="\\",this.tolerateUnexpectedToken();else d+=c,p+=c}return d},f.prototype.scanRegExp=function(){var p=this.index,d=this.scanRegExpBody(),c=this.scanRegExpFlags(),t=this.testRegExp(d,c);return{type:9,value:"",pattern:d,flags:c,regex:t,lineNumber:this.lineNumber,lineStart:this.lineStart,start:p,end:this.index}},f.prototype.lex=function(){if(this.eof())return{type:2,value:"",lineNumber:this.lineNumber,lineStart:this.lineStart,start:this.index,end:this.index};var p=this.source.charCodeAt(this.index);return u.Character.isIdentifierStart(p)?this.scanIdentifier():p===40||p===41||p===59?this.scanPunctuator():p===39||p===34?this.scanStringLiteral():p===46?u.Character.isDecimalDigit(this.source.charCodeAt(this.index+1))?this.scanNumericLiteral():this.scanPunctuator():u.Character.isDecimalDigit(p)?this.scanNumericLiteral():p===96||p===125&&this.curlyStack[this.curlyStack.length-1]==="${"?this.scanTemplate():p>=55296&&p<57343&&u.Character.isIdentifierStart(this.codePointAt(this.index))?this.scanIdentifier():this.scanPunctuator()},f}();e.Scanner=m},function(h,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TokenName={},e.TokenName[1]="Boolean",e.TokenName[2]="<end>",e.TokenName[3]="Identifier",e.TokenName[4]="Keyword",e.TokenName[5]="Null",e.TokenName[6]="Numeric",e.TokenName[7]="Punctuator",e.TokenName[8]="String",e.TokenName[9]="RegularExpression",e.TokenName[10]="Template"},function(h,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.XHTMLEntities={quot:'"',amp:"&",apos:"'",gt:">",nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xD
`,wi="null",bi=h=>`${Si}:${h}`,xn=h=>`${an}:${h}`,Dn=h=>`${on}:${h}`,ki=h=>`${un}:${h}`,Bi=h=>`${lt}:${h}`,En={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},gn=h=>(ot.lastIndex=0,ot.test(h)?h.replace(ot,e=>{let s=En[e];return typeof s=="string"?s:e}):h),Ti=h=>`"${gn(h)}"`,vn=(h,e)=>e?`//${h}`:`/*${h}*/`,L=(h,e,s,r)=>{let u=h[Symbol.for(e)];if(!u||!u.length)return X;let l=!1,o=u.reduce((D,{inline:m,type:f,value:p})=>{let d=m?ct:q+s;return l=f==="LineComment",D+d+vn(p,l)},X);return r||l?o+q+s:o},ee=null,he=X,Cn=()=>{ee=null,he=X},ue=(h,e,s)=>h?e?h+e.trim()+q+s:h.trimRight()+q+s:e?e.trimRight()+q+s:X,Ni=(h,e,s)=>{let r=L(e,Si,s+he,!0);return ue(r,h,s)},An=(h,e)=>{let s=e+he,{length:r}=h,u=X,l=X;for(let o=0;o<r;o++){o!==0&&(u+=Fi);let D=ue(l,L(h,bi(o),s),s);u+=D||q+s,u+=pt(o,h,s)||wi,u+=L(h,ki(o),s),l=L(h,Bi(o),s)}return u+=ue(l,L(h,lt,s),s),ln+Ni(u,h,e)+cn},yn=(h,e)=>{if(!h)return"null";let s=e+he,r=X,u=X,l=!0,o=ht(ee)?ee:Object.keys(h),D=m=>{let f=pt(m,h,s);if(f===dn)return;l||(r+=Fi),l=!1;let p=ue(u,L(h,bi(m),s),s);r+=p||q+s,r+=Ti(m)+L(h,xn(m),s)+mn+L(h,Dn(m),s)+ct+f+L(h,ki(m),s),u=L(h,Bi(m),s)};return o.forEach(D),r+=ue(u,L(h,lt,s),s),pn+Ni(r,h,e)+fn};function pt(h,e,s){let r=e[h];switch(yi(r)&&ut(r.toJSON)&&(r=r.toJSON(h)),ut(ee)&&(r=ee.call(e,h,r)),typeof r){case"string":return Ti(r);case"number":return Number.isFinite(r)?String(r):wi;case"boolean":case"null":return String(r);case"object":return ht(r)?An(r,s):yn(r,s);default:}}var Sn=h=>sn(h)?h:tn(h)?rn(ct,h):X,{toString:Fn}=Object.prototype,wn=["[object Number]","[object String]","[object Boolean]"],bn=h=>{if(typeof h!="object")return!1;let e=Fn.call(h);return wn.includes(e)};_i.exports=(h,e,s)=>{let r=Sn(s);if(!r)return JSON.stringify(h,e);!ut(e)&&!ht(e)&&(e=null),ee=e,he=r;let u=bn(h)?JSON.stringify(h):pt("",{"":h},X);return Cn(),yi(h)?L(h,nn,X).trimLeft()+u+L(h,hn,X).trimRight():u}});var Oi=_((Gn,Pi)=>{var{parse:kn,tokenize:Bn}=vi(),Tn=Ii(),{CommentArray:Nn}=We(),{assign:_n}=ne();Pi.exports={parse:kn,stringify:Tn,tokenize:Bn,CommentArray:Nn,assign:_n}});var Ae=we(Tt()),Li=require("path");var le=we(Oi()),ce=require("fs/promises"),J=we(require("path"));async function Mi(h,e,s,r,u){let l=(0,le.parse)((await(0,ce.readFile)((0,J.join)(process.cwd(),s,"rush.json"))).toString()),o=(0,J.join)(e,"rush.json"),D=J.default.resolve(e).split(J.default.sep),m=[];for(let f of[(0,J.join)(s,"rush.json"),...h]){let p=J.default.dirname(J.default.resolve(f)).split(J.default.sep),d=J.default.join(...p.slice(D.length)),c=await(0,le.parse)((await(0,ce.readFile)(f)).toString()),t=c.projects;for(let[i,n]of Object.entries(c))l[i]=n;m.push(...t.map(i=>Dt(xt({},i),{projectFolder:(0,J.join)(d,i.projectFolder),shouldPublish:d==="."?i.shouldPublish:!1})))}l.projects=m,await(0,ce.writeFile)(o,(0,le.stringify)(l,void 0,2))}console.info("Anticrm Platform Manager");Ae.program.version("0.6.0");Ae.program.command("rush-sync <root>").description("Synchronized rush.js files with platform.").option("-e, --exclude <exclude>","List of exclude patterns to override excludes (comma separated)","").option("-i, --include <include>","List of include patterns to override excludes (comma separated)","").option("-s, --source <source>","Comma separated list of rush_source.json files","rush_source.json").action(async(h,e)=>{await Mi(e.source.split(",").map(s=>(0,Li.join)(process.cwd(),s.trim())),process.cwd(),h,e.include.split(","),e.exclude.split(","))});Ae.program.parse(process.argv);
/*! Bundled license information:
repeat-string/index.js:
(*!
* repeat-string <https://github.com/jonschlinkert/repeat-string>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*)
*/