mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-26 04:23:58 +03:00
31 lines
180 KiB
JavaScript
31 lines
180 KiB
JavaScript
|
"use strict";var Nr=Object.create;var Fe=Object.defineProperty,_r=Object.defineProperties,Ir=Object.getOwnPropertyDescriptor,Pr=Object.getOwnPropertyDescriptors,Or=Object.getOwnPropertyNames,pt=Object.getOwnPropertySymbols,Mr=Object.getPrototypeOf,mt=Object.prototype.hasOwnProperty,Lr=Object.prototype.propertyIsEnumerable;var ft=(u,e,r)=>e in u?Fe(u,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):u[e]=r,dt=(u,e)=>{for(var r in e||={})mt.call(e,r)&&ft(u,r,e[r]);if(pt)for(var r of pt(e))Lr.call(e,r)&&ft(u,r,e[r]);return u},xt=(u,e)=>_r(u,Pr(e));var _=(u,e)=>()=>(e||u((e={exports:{}}).exports,e),e.exports);var Rr=(u,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let h of Or(e))!mt.call(u,h)&&h!==r&&Fe(u,h,{get:()=>e[h],enumerable:!(s=Ir(e,h))||s.enumerable});return u};var Dt=(u,e,r)=>(r=u!=null?Nr(Mr(u)):{},Rr(e||!u||!u.__esModule?Fe(r,"default",{value:u,enumerable:!0}):r,u));var ee=_(be=>{var fe=class extends Error{constructor(e,r,s){super(s),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=e,this.nestedError=void 0}},we=class extends fe{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};be.CommanderError=fe;be.InvalidArgumentError=we});var me=_(Be=>{var{InvalidArgumentError:Xr}=ee(),ke=class{constructor(e,r){switch(this.description=r||"",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,r){return r===this.defaultValue||!Array.isArray(r)?[e]:r.concat(e)}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e,this.parseArg=(r,s)=>{if(!e.includes(r))throw new Xr(`Allowed choices are ${e.join(", ")}.`);return this.variadic?this._concatValue(r,s):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Jr(u){let e=u.name()+(u.variadic===!0?"...":"");return u.required?"<"+e+">":"["+e+"]"}Be.Argument=ke;Be.humanReadableArgName=Jr});var Ne=_(Et=>{var{humanReadableArgName:Ur}=me(),Te=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1}visibleCommands(e){let r=e.commands.filter(s=>!s._hidden);if(e._hasImplicitHelpCommand()){let[,s,h]=e._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),l=e.createCommand(s).helpOption(!1);l.description(e._helpCommandDescription),h&&l.arguments(h),r.push(l)}return this.sortSubcommands&&r.sort((s,h)=>s.name().localeCompare(h.name())),r}visibleOptions(e){let r=e.options.filter(l=>!l.hidden),s=e._hasHelpOption&&e._helpShortFlag&&!e._findOption(e._helpShortFlag),h=e._hasHelpOption&&!e._findOption(e._helpLongFlag);if(s||h){let l;s?h?l=e.createOption(e._helpFlags,e._helpDescription):l=e.createOption(e._helpShortFlag,e._helpDescription):l=e.createOption(e._helpLongFlag,e._helpDescription),r.push(l)}if(this.sortOptions){let l=o=>o.short?o.short.replace(/^-/,""):o.long.replace(/^--/,"");r.sort((o,D)=>l(o).localeCompare(l(D)))}return r}visibleArguments(e){return e._argsDescription&&e._args.forEach(r=>{r.description=r.description||e._argsDescription[r.name()]||""}),e._args.find(r=>r.description)?e._args:[]}subcommandTerm(e){let r=e._args.map(s=>Ur(s)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,r){return r.visibleCommands(e).reduce((s,h)=>Math.max(s,r.subcommandTerm(h).length),0)}longestOptionTermLength(e,r){return r.visibleOptions(e).reduce((s,h)=>Math.max(s,r.optionTerm(h).length),0)}longestArgumentTermLength(e,r){return r.visibleArguments(e).reduce((s,h)
|
||
|
`).replace(/^/gm," ".repeat(l))}let f=[`Usage: ${r.commandUsage(e)}`,""],p=r.commandDescription(e);p.length>0&&(f=f.concat([p,""]));let d=r.visibleArguments(e).map(i=>D(r.argumentTerm(i),r.argumentDescription(i)));d.length>0&&(f=f.concat(["Arguments:",m(d),""]));let c=r.visibleOptions(e).map(i=>D(r.optionTerm(i),r.optionDescription(i)));c.length>0&&(f=f.concat(["Options:",m(c),""]));let t=r.visibleCommands(e).map(i=>D(r.subcommandTerm(i),r.subcommandDescription(i)));return t.length>0&&(f=f.concat(["Commands:",m(t),""])),f.join(`
|
||
|
`)}padWidth(e,r){return Math.max(r.longestOptionTermLength(e,r),r.longestSubcommandTermLength(e,r),r.longestArgumentTermLength(e,r))}wrap(e,r,s,h=40){if(e.match(/[\n]\s+/))return e;let l=r-s;if(l<h)return e;let o=e.substr(0,s),D=e.substr(s),m=" ".repeat(s),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=Te});var Pe=_(Ie=>{var{InvalidArgumentError:zr}=ee(),_e=class{constructor(e,r){this.flags=e,this.description=r||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let s=gt(e);this.short=s.shortFlag,this.long=s.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,r){return this.defaultValue=e,this.defaultValueDescription=r,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,r){return r===this.defaultValue||!Array.isArray(r)?[e]:r.concat(e)}choices(e){return this.argChoices=e,this.parseArg=(r,s)=>{if(!e.includes(r))throw new zr(`Allowed choices are ${e.join(", ")}.`);return this.variadic?this._concatValue(r,s):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return Hr(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}};function Hr(u){return u.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function gt(u){let e,r,s=u.split(/[ |,]+/);return s.length>1&&!/^[[<]/.test(s[1])&&(e=s.shift()),r=s.shift(),!e&&/^-[^-]$/.test(r)&&(e=r,r=void 0),{shortFlag:e,longFlag:r}}Ie.Option=_e;Ie.splitOptionFlags=gt});var Ct=_(vt=>{function jr(u,e){if(Math.abs(u.length-e.length)>3)return Math.max(u.length,e.length);let r=[];for(let s=0;s<=u.length;s++)r[s]=[s];for(let s=0;s<=e.length;s++)r[0][s]=s;for(let s=1;s<=e.length;s++)for(let h=1;h<=u.length;h++){let l=1;u[h-1]===e[s-1]?l=0:l=1,r[h][s]=Math.min(r[h-1][s]+1,r[h][s-1]+1,r[h-1][s-1]+l),h>1&&s>1&&u[h-1]===e[s-2]&&u[h-2]===e[s-1]&&(r[h][s]=Math.min(r[h][s],r[h-2][s-2]+1))}return r[u.length][e.length]}function Vr(u,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let r=u.startsWith("--");r&&(u=u.slice(2),e=e.map(o=>o.slice(2)));let s=[],h=3,l=.4;return e.forEach(o=>{if(o.length<=1)return;let D=jr(u,o),m=Math.max(u.length,o.length);(m-D)/m>l&&(D<h?(h=D,s=[o]):D===h&&s.push(o))}),s.sort((o,D)=>o.localeCompare(D)),r&&(s=s.map(o=>`--${o}`)),s.length>1?`
|
||
|
(Did you mean one of ${s.join(", ")}?)`:s.length===1?`
|
||
|
(Did you mean ${s[0]}?)`:""}vt.suggestSimilar=Vr});var wt=_(Ft=>{var Kr=require("events").EventEmitter,Oe=require("child_process"),$=require("path"),Me=require("fs"),{Argument:$r,humanReadableArgName:Gr}=me(),{CommanderError:Le}=ee(),{Help:Wr}=Ne(),{Option:qr,splitOptionFlags:Yr}=Pe(),{suggestSimilar:At}=Ct(),te=class extends Kr{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:r=>process.stdout.write(r),writeErr:r=>process.stderr.write(r),getOutHelpWidth:()=>process.stdout.isTTY?process.stdout.columns:void 0,getErrHelpWidth:()=>process.stderr.isTTY?process.stderr.columns:void 0,outputError:(r,s)=>s(r)},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,r,s){let h=r,l=s;typeof h=="object"&&h!==null&&(l=h,h=null),l=l||{};let[,o,D]=e.match(/([^ ]+) *(.*)/),m=this.createCommand(o);return h&&(m.description(h),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),h?this:m}createCommand(e){return new te(e)}createHelp(){return Object.assign(new Wr,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,r){if(!e._name)throw new Error("Command passed to .addCommand() must have a name");function s(h){h.forEach(l=>{if(l._executableHandler&&!l._executableFile)throw new Error(`Must specify executableFile for deeply nested executable: ${l.name()}`);s(l.commands)})}return s(e.commands),r=r||{},r.isDefault&&(this._defaultCommandName=e._name),(r.noHelp||r.hidden)&&(e._hidden=!0),this.commands.push(e),e.parent=this,this}createArgument(e,r){return new $r(e,r)}argument(e,r,s,h){let l=this.createArgument(e,r);return typeof s=="function"?l.default(h).argParser(s):l.default(s),this.addArgument(l),this}arguments(e){return e.split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(e){let r=this._args.slice(-1)[0
|
||
|
Expecting one of '${s.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(r):this._lifeCycleHooks[e]=[r],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(e,r,s){this._exitCallback&&this._exitCallback(new Le(e,r,s)),process.exit(e)}action(e){let r=s=>{let h=this._args.length,l=s.slice(0,h);return this._storeOptionsAsProperties?l[h]=this:l[h]=this.opts(),l.push(this),e.apply(this,l)};return this._actionHandler=r,this}createOption(e,r){return new qr(e,r)}addOption(e){let r=e.name(),s=e.attributeName(),h=e.defaultValue;if(e.negate||e.optional||e.required||typeof h=="boolean"){if(e.negate){let o=e.long.replace(/^--no-/,"--");h=this._findOption(o)?this.getOptionValue(s):!0}h!==void 0&&this.setOptionValueWithSource(s,h,"default")}this.options.push(e);let l=(o,D,m)=>{let f=this.getOptionValue(s);if(o!==null&&e.parseArg)try{o=e.parseArg(o,f===void 0?h: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(s,e.negate?!1:h||!0,m):this.setOptionValueWithSource(s,o,m):o!==null&&this.setOptionValueWithSource(s,e.negate?!1:o,m)};return this.on("option:"+r,o=>{let D=`error: option '${e.flags}' argument '${o}' is invalid.`;l(o,D,"cli")}),e.envVar&&this.on("optionEnv:"+r,o=>{let D=`error: option '${e.flags}' value '${o}' from env '${e.envVar}' is invalid.`;l(o,D,"env")}),this}_optionEx(e,r,s,h,l){let o=this.createOption(r,s);if(o.makeOptionMandatory(!!e.mandatory),typeof h=="function")o.default(l).argParser(h);else if(h instanceof RegExp){let D=h;h=(m,f)=>{let p=D.exec(m);return p?p[0]:f},o.default(l).argParser(h)}else o.default(h);return this.addOption(o)}option(e,r,s,h){return this._optionEx({},e,r,s,h)}requiredOption(e,r,s,h){return this._optionEx({mandatory:!0},e,r,s,h)}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,r){return this._storeOptionsAsProperties?this[e]=r:this._optionValues[e]=r,this}setOptionValueWithSource(e,r,s){return this.setOptionValue(e,r),this._optionValueSources[e]=s,this}getOptionValueSource(e){return this._optionValueSources[e]}_prepareUserArgs(e,r){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");r=r||{},e===void 0&&(e=process.argv,process.versions&&process.versions.electron&&(r.from="electron")),this.rawArgs=e.slice();let s;switch(r.from){case void 0:case"node":this._scriptPath=e[1],s=e.slice(2);break;case"electron":process.defaultApp?(this._scriptPath=e[1],s=e.slice(2)):s=e.slice(1);break;case"user":s=e.slice(0);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._scriptPath&&require.main&&(this._scriptPath=require.main.filename),this._name=this._name||this._scriptPath&&$.basename(this._scriptPath,$.extname(this._scriptPath)),s}parse(e,r){let s=this._prepareUserArgs(e,r);return this._parseCommand([],s),this}async parseAsync(e,r){let s=this._prepareUserArgs(e,r);return await this._parseCommand([],s),this}_executeSubCommand(e,r){r=r.slice();let s=!1,h=[".js",".ts",".tsx",".mjs",".cjs"];this._checkForMissingMandatoryOptions();let l=this._scriptPath;!l&&requi
|
||
|
- 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 Le(1,"commander.executeSubCommandAsync","(error)");t.nestedError=c,d(t)}}),this.runningCommand=f}_dispatchSubcommand(e,r,s){let h=this._findCommand(e);if(h||this.help({error:!0}),h._executableHandler)this._executeSubCommand(h,r.concat(s));else return h._parseCommand(r,s)}_checkNumberOfArguments(){this._args.forEach((e,r)=>{e.required&&this.args[r]==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=(s,h,l)=>{let o=h;if(h!==null&&s.parseArg)try{o=s.parseArg(h,l)}catch(D){if(D.code==="commander.invalidArgument"){let m=`error: command-argument value '${h}' is invalid for argument '${s.name()}'. ${D.message}`;this._displayError(D.exitCode,D.code,m)}throw D}return o};this._checkNumberOfArguments();let r=[];this._args.forEach((s,h)=>{let l=s.defaultValue;s.variadic?h<this.args.length?(l=this.args.slice(h),s.parseArg&&(l=l.reduce((o,D)=>e(s,D,o),s.defaultValue))):l===void 0&&(l=[]):h<this.args.length&&(l=this.args[h],s.parseArg&&(l=e(s,l,s.defaultValue))),r[h]=l}),this.processedArgs=r}_chainOrCall(e,r){return e&&e.then&&typeof e.then=="function"?e.then(()=>r()):r()}_chainOrCallHooks(e,r){let s=e,h=[];return Re(this).reverse().filter(l=>l._lifeCycleHooks[r]!==void 0).forEach(l=>{l._lifeCycleHooks[r].forEach(o=>{h.push({hookedCommand:l,callback:o})})}),r==="postAction"&&h.reverse(),h.forEach(l=>{s=this._chainOrCall(s,()=>l.callback(l.hookedCommand,this))}),s}_parseCommand(e,r){let s=this.parseOptions(r);if(this._parseOptionsEnv(),e=e.concat(s.operands),r=s.unknown,this.args=e.concat(r),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),r);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,r),this._dispatchSubcommand(this._defaultCommandName,e,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),yt(this,s.unknown),this._checkForMissingMandatoryOptions();let h=()=>{s.unknown.length>0&&this.unknownOption(s.unknown[0])},l=`command:${this.name()}`;if(this._actionHandler){h(),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,r),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent&&this.parent.listenerCount(l))h(),this._processArguments(),this.parent.emit(l,e,r);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,r);this.listenerCount("command:*")?this.emit("command:*",e,r):this.commands.length?this.unknownCommand():(h(),this._processArguments())}else this.commands.length?(h(),this.help({error:!0})):(h(),this._processArguments())}_findCommand(e){if(!!e)return this.commands.find(r=>r._name===e||r._aliases.includes(e))}_findOption(e){return this.options.find(r=>r.is(e))}_checkForMissingMandatoryOptions(){for(let e=this;e;e=e.parent)e.options.forEach(r=>{r.mandatory&&e.getOptionValue(r.attributeName())===void 0&&e.missingMandatoryOptionValue(r)})}parseOptions(e){let r=[],s=[],h=r,l=e.slice();function o(m){return m.length>1&&m[0]==="-"}let D=null;for(;l.length;){let m=l.shift();if(m==="--"){h===s&&h.push(m),h.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.r
|
||
|
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
||
|
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
||
|
`),this.outputHelp({error:!0})),this._exit(e,r,s)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in process.env){let r=e.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,process.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}missingArgument(e){let r=`error: missing required argument '${e}'`;this._displayError(1,"commander.missingArgument",r)}optionMissingArgument(e){let r=`error: option '${e.flags}' argument missing`;this._displayError(1,"commander.optionMissingArgument",r)}missingMandatoryOptionValue(e){let r=`error: required option '${e.flags}' not specified`;this._displayError(1,"commander.missingMandatoryOptionValue",r)}unknownOption(e){if(this._allowUnknownOption)return;let r="";if(e.startsWith("--")&&this._showSuggestionAfterError){let h=[],l=this;do{let o=l.createHelp().visibleOptions(l).filter(D=>D.long).map(D=>D.long);h=h.concat(o),l=l.parent}while(l&&!l._enablePositionalOptions);r=At(e,h)}let s=`error: unknown option '${e}'${r}`;this._displayError(1,"commander.unknownOption",s)}_excessArguments(e){if(this._allowExcessArguments)return;let r=this._args.length,s=r===1?"":"s",l=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${s} but got ${e.length}.`;this._displayError(1,"commander.excessArguments",l)}unknownCommand(){let e=this.args[0],r="";if(this._showSuggestionAfterError){let h=[];this.createHelp().visibleCommands(this).forEach(l=>{h.push(l.name()),l.alias()&&h.push(l.alias())}),r=At(e,h)}let s=`error: unknown command '${e}'${r}`;this._displayError(1,"commander.unknownCommand",s)}version(e,r,s){if(e===void 0)return this._version;this._version=e,r=r||"-V, --version",s=s||"output the version number";let h=this.createOption(r,s);return this._versionOptionName=h.attributeName(),this.options.push(h),this.on("option:"+h.name(),()=>{this._outputConfiguration.writeOut(`${e}
|
||
|
`),this._exit(0,"commander.version",e)}),this}description(e,r){return e===void 0&&r===void 0?this._description:(this._description=e,r&&(this._argsDescription=r),this)}alias(e){if(e===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),e===r._name)throw new Error("Command alias can't be the same as its name");return r._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(r=>this.alias(r)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let r=this._args.map(s=>Gr(s));return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this._args.length?r:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpInformation(e){let r=this.createHelp();return r.helpWidth===void 0&&(r.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),r.formatHelp(this,r)}_getHelpContext(e){e=e||{};let r={error:!!e.error},s;return r.error?s=h=>this._outputConfiguration.writeErr(h):s=h=>this._outputConfiguration.writeOut(h),r.write=e.write||s,r.command=this,r}outputHelp(e){let r;typeof e=="function"&&(r=e,e=void 0);let s=this._getHelpContext(e);Re(this).reverse().forEach(l=>l.emit("beforeAllHelp",s)),this.emit("beforeHelp",s);let h=this.helpInformation(s);if(r&&(h=r(h),typeof h!="string"&&!Buffer.isBuffer(h)))throw new Error("outputHelp callback must return a string or a Buffer");s.write(h),this.emit(this._helpLongFlag),this.emit("afterHelp",s),Re(this).forEach(l=>l.emit("afterAllHelp",s))}helpOption(e,r){if(typeof e=="boolean")return this._hasHelpOption=e,this;this._helpFlags=e||this._helpFlags,this._helpDescription=r||this._helpDescription;let s=Yr(this._helpFlags);return this._helpShortFlag=s.shortFlag,this._helpLongFlag=s.longFlag,this}help(e){this.outputHelp(e);let r=process.exitCode||0;r===0&&e&&typeof e!="function"&&e.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(e,r){let s=["beforeAll","before","after","afterAll"];if(!s.includes(e))throw new Error(`Unexpected value for position to addHelpText.
|
||
|
Expecting one of '${s.join("', '")}'`);let h=`${e}Help`;return this.on(h,l=>{let o;typeof r=="function"?o=r({error:l.error,command:l.command}):o=r,o&&l.write(`${o}
|
||
|
`)}),this}};function yt(u,e){u._hasHelpOption&&e.find(s=>s===u._helpLongFlag||s===u._helpShortFlag)&&(u.outputHelp(),u._exit(0,"commander.helpDisplayed","(outputHelp)"))}function St(u){return u.map(e=>{if(!e.startsWith("--inspect"))return e;let r,s="127.0.0.1",h="9229",l;return(l=e.match(/^(--inspect(-brk)?)$/))!==null?r=l[1]:(l=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=l[1],/^\d+$/.test(l[3])?h=l[3]:s=l[3]):(l=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=l[1],s=l[3],h=l[4]),r&&h!=="0"?`${r}=${s}:${parseInt(h)+1}`:e})}function Re(u){let e=[];for(let r=u;r;r=r.parent)e.push(r);return e}Ft.Command=te});var Tt=_((J,Bt)=>{var{Argument:Qr}=me(),{Command:bt}=wt(),{CommanderError:Zr,InvalidArgumentError:kt}=ee(),{Help:es}=Ne(),{Option:ts}=Pe();J=Bt.exports=new bt;J.program=J;J.Argument=Qr;J.Command=bt;J.CommanderError=Zr;J.Help=es;J.InvalidArgumentError=kt;J.InvalidOptionArgumentError=kt;J.Option=ts});var Nt=_((ie,Xe)=>{(function(e,r){typeof ie=="object"&&typeof Xe=="object"?Xe.exports=r():typeof define=="function"&&define.amd?define([],r):typeof ie=="object"?ie.esprima=r():e.esprima=r()})(ie,function(){return function(u){var e={};function r(s){if(e[s])return e[s].exports;var h=e[s]={exports:{},id:s,loaded:!1};return u[s].call(h.exports,h,h.exports,r),h.loaded=!0,h.exports}return r.m=u,r.c=e,r.p="",r(0)}([function(u,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=r(1),h=r(3),l=r(8),o=r(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 s.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 h.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=r(2);e.Syntax=d.Syntax,e.version="4.0.1"},function(u,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=r(2),h=function(){function l(){this.attach=!1,this.comments=[],this.stack=[],this.leading=[],this.trailing=[]}return l.prototype.insertInnerComments=function(o,D){if(o.type===s.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===s.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&&h.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(h.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++],h.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"?(h.Character.isDecimalDigit(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(l.Messages.TemplateOctalLiteral),p+="\0"):h.Character.isOctalDigit(a.charCodeAt(0))?this.throwUnexpectedToken(l.Messages.TemplateOctalLiteral):p+=a;break}else h.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];s.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++],h.Character.isLineTerminator(p.charCodeAt(0))&&this.throwUnexpectedToken(l.Messages.UnterminatedRegExp),d+=p;else if(h.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(!h.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 h.Character.isIdentifierStart(p)?this.scanIdentifier():p===40||p===41||p===59?this.scanPunctuator():p===39||p===34?this.scanStringLiteral():p===46?h.Character.isDecimalDigit(this.source.charCodeAt(this.index+1))?this.scanNumericLiteral():this.scanPunctuator():h.Character.isDecimalDigit(p)?this.scanNumericLiteral():p===96||p===125&&this.curlyStack[this.curlyStack.length-1]==="${"?this.scanTemplate():p>=55296&&p<57343&&h.Character.isIdentifierStart(this.codePointAt(this.index))?this.scanIdentifier():this.scanPunctuator()},f}();e.Scanner=m},function(u,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(u,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=u=>`${Si}:${u}`,xn=u=>`${an}:${u}`,Dn=u=>`${on}:${u}`,ki=u=>`${un}:${u}`,Bi=u=>`${ht}:${u}`,En={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},gn=u=>(at.lastIndex=0,at.test(u)?u.replace(at,e=>{let r=En[e];return typeof r=="string"?r:e}):u),Ti=u=>`"${gn(u)}"`,vn=(u,e)=>e?`//${u}`:`/*${u}*/`,L=(u,e,r,s)=>{let h=u[Symbol.for(e)];if(!h||!h.length)return R;let l=!1,o=h.reduce((D,{inline:m,type:f,value:p})=>{let d=m?lt:W+r;return l=f==="LineComment",D+d+vn(p,l)},R);return s||l?o+W+r:o},Z=null,ue=R,Cn=()=>{Z=null,ue=R},oe=(u,e,r)=>u?e?u+e.trim()+W+r:u.trimRight()+W+r:e?e.trimRight()+W+r:R,Ni=(u,e,r)=>{let s=L(e,Si,r+ue,!0);return oe(s,u,r)},An=(u,e)=>{let r=e+ue,{length:s}=u,h=R,l=R;for(let o=0;o<s;o++){o!==0&&(h+=Fi);let D=oe(l,L(u,bi(o),r),r);h+=D||W+r,h+=ct(o,u,r)||wi,h+=L(u,ki(o),r),l=L(u,Bi(o),r)}return h+=oe(l,L(u,ht,r),r),ln+Ni(h,u,e)+cn},yn=(u,e)=>{if(!u)return"null";let r=e+ue,s=R,h=R,l=!0,o=ut(Z)?Z:Object.keys(u),D=m=>{let f=ct(m,u,r);if(f===dn)return;l||(s+=Fi),l=!1;let p=oe(h,L(u,bi(m),r),r);s+=p||W+r,s+=Ti(m)+L(u,xn(m),r)+mn+L(u,Dn(m),r)+lt+f+L(u,ki(m),r),h=L(u,Bi(m),r)};return o.forEach(D),s+=oe(h,L(u,ht,r),r),pn+Ni(s,u,e)+fn};function ct(u,e,r){let s=e[u];switch(yi(s)&&ot(s.toJSON)&&(s=s.toJSON(u)),ot(Z)&&(s=Z.call(e,u,s)),typeof s){case"string":return Ti(s);case"number":return Number.isFinite(s)?String(s):wi;case"boolean":case"null":return String(s);case"object":return ut(s)?An(s,r):yn(s,r);default:}}var Sn=u=>rn(u)?u:tn(u)?sn(lt,u):R,{toString:Fn}=Object.prototype,wn=["[object Number]","[object String]","[object Boolean]"],bn=u=>{if(typeof u!="object")return!1;let e=Fn.call(u);return wn.includes(e)};_i.exports=(u,e,r)=>{let s=Sn(r);if(!s)return JSON.stringify(u,e);!ot(e)&&!ut(e)&&(e=null),Z=e,ue=s;let h=bn(u)?JSON.stringify(u):ct("",{"":u},R);return Cn(),yi(u)?L(u,nn,R).trimLeft()+h+L(u,hn,R).trimRight():h}});var Oi=_((qn,Pi)=>{var{parse:kn,tokenize:Bn}=vi(),Tn=Ii(),{CommentArray:Nn}=Ge(),{assign:_n}=se();Pi.exports={parse:kn,stringify:Tn,tokenize:Bn,CommentArray:Nn,assign:_n}});var pe=Dt(Tt());var le=Dt(Oi()),ce=require("fs/promises"),he=require("path");var In=new Set(["@hcengineering/prod","@hcengineering/pod-front","@hcengineering/pod-server","@hcengineering/pod-account"]);function Pn(u){return e=>!e.projectFolder.startsWith(u)}async function Mi(u,e){let r=(0,le.parse)((await(0,ce.readFile)((0,he.join)(u,e,"rush.json"))).toString()),s=(0,he.join)(u,"rush.json"),h=(0,he.join)(u,"rush_source.json"),l=(0,le.parse)((await(0,ce.readFile)(h)).toString()),o=r.projects.filter(f=>!In.has(f.packageName)),m=l.projects.filter(Pn(e));m.push(...o.map(f=>xt(dt({},f),{projectFolder:(0,he.join)(e,f.projectFolder),shouldPublish:!1}))),l.projects=m,await(0,ce.writeFile)(s,(0,le.stringify)(l,void 0,2))}async function Li(u,e){}console.info("Anticrm Platform Manager");pe.program.version("0.6.0");pe.program.command("rush-sync <root>").description("Synchronized rush.js files with platform.").action(async(u,e)=>{await Mi(process.cwd(),u)});pe.program.command("template-apply <root>").description("Create necessary startup packages").requiredOption("--root <root>","user password","platform").action(async(u,e)=>{await Li(process.cwd(),u)});pe.program.parse(process.argv);
|
||
|
/*!
|
||
|
* repeat-string <https://github.com/jonschlinkert/repeat-string>
|
||
|
*
|
||
|
* Copyright (c) 2014-2015, Jon Schlinkert.
|
||
|
* Licensed under the MIT License.
|
||
|
*/
|