codemod 0.11.0 → 0.11.1
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/dist/index.cjs +2 -2
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -821,7 +821,7 @@ ${Ie.join(`
|
|
|
821
821
|
`;ce.forEach(Ie=>{_e+=Ie}),e.fail(_e)}};let N={};_.conflicts=function(te,ce){Nw("<string|object> [array|string]",[te,ce],arguments.length),typeof te=="object"?Object.keys(te).forEach(_e=>{_.conflicts(_e,te[_e])}):(t.global(te),N[te]||(N[te]=[]),Array.isArray(ce)?ce.forEach(_e=>_.conflicts(te,_e)):N[te].push(ce))},_.getConflicting=()=>N,_.conflicting=function(te){Object.keys(te).forEach(ce=>{N[ce]&&N[ce].forEach(_e=>{_e&&te[ce]!==void 0&&te[_e]!==void 0&&e.fail(r("Arguments %s and %s are mutually exclusive",ce,_e))})}),t.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(N).forEach(ce=>{N[ce].forEach(_e=>{_e&&te[n.Parser.camelCase(ce)]!==void 0&&te[n.Parser.camelCase(_e)]!==void 0&&e.fail(r("Arguments %s and %s are mutually exclusive",ce,_e))})})},_.recommendCommands=function(te,ce){ce=ce.sort((Ue,Ke)=>Ke.length-Ue.length);let Ie=null,Se=1/0;for(let Ue=0,Ke;(Ke=ce[Ue])!==void 0;Ue++){let ft=Pwr(te,Ke);ft<=3&&ft<Se&&(Se=ft,Ie=Ke)}Ie&&e.fail(r("Did you mean %s?",Ie))},_.reset=function(te){return v=mDt(v,ce=>!te[ce]),N=mDt(N,ce=>!te[ce]),_};let L=[];return _.freeze=function(){L.push({implied:v,conflicting:N})},_.unfreeze=function(){let te=L.pop();zGe(te,void 0,n),{implied:v,conflicting:N}=te},_}var Owr,Rwr=Ma(()=>{Stn();eLt();Nwr();Ctn();Owr=["$0","--","_"]});function UGt(t,e,n,r){GGt=r;let l={};if(Object.prototype.hasOwnProperty.call(t,"extends")){if(typeof t.extends!="string")return l;let _=/\.json|\..*rc$/.test(t.extends),v=null;if(_)v=_is(e,t.extends);else try{v=require.resolve(t.extends)}catch{return t}dis(v),hOn.push(v),l=_?JSON.parse(GGt.readFileSync(v,"utf8")):require(t.extends),delete t.extends,l=UGt(l,GGt.path.dirname(v),n,GGt)}return hOn=[],n?Mwr(l,t):Object.assign({},l,t)}function dis(t){if(hOn.indexOf(t)>-1)throw new Fte(`Circular extended configurations: '${t}'.`)}function _is(t,e){return GGt.path.resolve(t,e)}function Mwr(t,e){let n={};function r(l){return l&&typeof l=="object"&&!Array.isArray(l)}Object.assign(n,t);for(let l of Object.keys(e))r(e[l])&&r(n[l])?n[l]=Mwr(t[l],e[l]):n[l]=e[l];return n}var hOn,GGt,gOn=Ma(()=>{Y7t();hOn=[]});function nIr(t){return(e=[],n=t.process.cwd(),r)=>{let l=new kOn(e,n,r,t);return Object.defineProperty(l,"argv",{get:()=>l.parse(),enumerable:!0}),l.help(),l.version(),l}}function Swr(t){return!!t&&typeof t.getInternalMethods=="function"}var Uw,mf,_ye,MNt,VGt,rut,Snt,Dtn,gDt,FNt,ktn,iut,wtn,sut,Ixt,Ent,aut,Itn,rLt,Iwe,mN,Ptn,Ntn,Tnt,BNt,iLt,jNt,yDt,Otn,WO,WNt,GNt,UNt,NL,Ltn,Pxt,Sme,Fwr,Bwr,yOn,jwr,Wwr,Gwr,VNt,Uwr,vOn,Vwr,zwr,xOn,vDt,sLt,bOn,SOn,EOn,TOn,COn,qwr,Hwr,Jwr,Kwr,$wr,Xwr,Ywr,Qwr,Rtn,Zwr,zNt,eIr,AOn,zGt,DOn,tIr,qNt,kOn,pOn=Ma(()=>{fOn();eLt();Y7t();Cwr();Stn();Iwr();Rwr();Ctn();gOn();oOn();tLt();cOn();dOn();Uw=function(t,e,n,r,l){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!l)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!l:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?l.call(t,n):l?l.value=n:e.set(t,n),n},mf=function(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)};Fwr=Symbol("copyDoubleDash"),Bwr=Symbol("copyDoubleDash"),yOn=Symbol("deleteFromParserHintObject"),jwr=Symbol("emitWarning"),Wwr=Symbol("freeze"),Gwr=Symbol("getDollarZero"),VNt=Symbol("getParserConfiguration"),Uwr=Symbol("getUsageConfiguration"),vOn=Symbol("guessLocale"),Vwr=Symbol("guessVersion"),zwr=Symbol("parsePositionalNumbers"),xOn=Symbol("pkgUp"),vDt=Symbol("populateParserHintArray"),sLt=Symbol("populateParserHintSingleValueDictionary"),bOn=Symbol("populateParserHintArrayDictionary"),SOn=Symbol("populateParserHintDictionary"),EOn=Symbol("sanitizeKey"),TOn=Symbol("setKey"),COn=Symbol("unfreeze"),qwr=Symbol("validateAsync"),Hwr=Symbol("getCommandInstance"),Jwr=Symbol("getContext"),Kwr=Symbol("getHasOutput"),$wr=Symbol("getLoggerInstance"),Xwr=Symbol("getParseContext"),Ywr=Symbol("getUsageInstance"),Qwr=Symbol("getValidationInstance"),Rtn=Symbol("hasParseCallback"),Zwr=Symbol("isGlobalContext"),zNt=Symbol("postProcess"),eIr=Symbol("rebase"),AOn=Symbol("reset"),zGt=Symbol("runYargsParserAndExecuteCommands"),DOn=Symbol("runValidation"),tIr=Symbol("setHasOutput"),qNt=Symbol("kTrackManuallySetKeys"),kOn=class{constructor(e=[],n,r,l){this.customScriptName=!1,this.parsed=!1,_ye.set(this,void 0),MNt.set(this,void 0),VGt.set(this,{commands:[],fullCommands:[]}),rut.set(this,null),Snt.set(this,null),Dtn.set(this,"show-hidden"),gDt.set(this,null),FNt.set(this,!0),ktn.set(this,{}),iut.set(this,!0),wtn.set(this,[]),sut.set(this,void 0),Ixt.set(this,{}),Ent.set(this,!1),aut.set(this,null),Itn.set(this,!0),rLt.set(this,void 0),Iwe.set(this,""),mN.set(this,void 0),Ptn.set(this,void 0),Ntn.set(this,{}),Tnt.set(this,null),BNt.set(this,null),iLt.set(this,{}),jNt.set(this,{}),yDt.set(this,void 0),Otn.set(this,!1),WO.set(this,void 0),WNt.set(this,!1),GNt.set(this,!1),UNt.set(this,!1),NL.set(this,void 0),Ltn.set(this,{}),Pxt.set(this,null),Sme.set(this,void 0),Uw(this,WO,l,"f"),Uw(this,yDt,e,"f"),Uw(this,MNt,n,"f"),Uw(this,Ptn,r,"f"),Uw(this,sut,new Etn(this),"f"),this.$0=this[Gwr](),this[AOn](),Uw(this,_ye,mf(this,_ye,"f"),"f"),Uw(this,NL,mf(this,NL,"f"),"f"),Uw(this,Sme,mf(this,Sme,"f"),"f"),Uw(this,mN,mf(this,mN,"f"),"f"),mf(this,mN,"f").showHiddenOpt=mf(this,Dtn,"f"),Uw(this,rLt,this[Bwr](),"f")}addHelpOpt(e,n){let r="help";return Nw("[string|boolean] [string]",[e,n],arguments.length),mf(this,aut,"f")&&(this[yOn](mf(this,aut,"f")),Uw(this,aut,null,"f")),e===!1&&n===void 0?this:(Uw(this,aut,typeof e=="string"?e:r,"f"),this.boolean(mf(this,aut,"f")),this.describe(mf(this,aut,"f"),n||mf(this,NL,"f").deferY18nLookup("Show help")),this)}help(e,n){return this.addHelpOpt(e,n)}addShowHiddenOpt(e,n){if(Nw("[string|boolean] [string]",[e,n],arguments.length),e===!1&&n===void 0)return this;let r=typeof e=="string"?e:mf(this,Dtn,"f");return this.boolean(r),this.describe(r,n||mf(this,NL,"f").deferY18nLookup("Show hidden options")),mf(this,mN,"f").showHiddenOpt=r,this}showHidden(e,n){return this.addShowHiddenOpt(e,n)}alias(e,n){return Nw("<object|string|array> [string|array]",[e,n],arguments.length),this[bOn](this.alias.bind(this),"alias",e,n),this}array(e){return Nw("<array|string>",[e],arguments.length),this[vDt]("array",e),this[qNt](e),this}boolean(e){return Nw("<array|string>",[e],arguments.length),this[vDt]("boolean",e),this[qNt](e),this}check(e,n){return Nw("<function> [boolean]",[e,n],arguments.length),this.middleware((r,l)=>RNt(()=>e(r,l.getOptions()),_=>(_?(typeof _=="string"||_ instanceof Error)&&mf(this,NL,"f").fail(_.toString(),_):mf(this,NL,"f").fail(mf(this,WO,"f").y18n.__("Argument check failed: %s",e.toString())),r),_=>(mf(this,NL,"f").fail(_.message?_.message:_.toString(),_),r)),!1,n),this}choices(e,n){return Nw("<object|string|array> [string|array]",[e,n],arguments.length),this[bOn](this.choices.bind(this),"choices",e,n),this}coerce(e,n){if(Nw("<object|string|array> [function]",[e,n],arguments.length),Array.isArray(e)){if(!n)throw new Fte("coerce callback must be provided");for(let r of e)this.coerce(r,n);return this}else if(typeof e=="object"){for(let r of Object.keys(e))this.coerce(r,e[r]);return this}if(!n)throw new Fte("coerce callback must be provided");return mf(this,mN,"f").key[e]=!0,mf(this,sut,"f").addCoerceMiddleware((r,l)=>{let _;return Object.prototype.hasOwnProperty.call(r,e)?RNt(()=>(_=l.getAliases(),n(r[e])),D=>{r[e]=D;let N=l.getInternalMethods().getParserConfiguration()["strip-aliased"];if(_[e]&&N!==!0)for(let L of _[e])r[L]=D;return r},D=>{throw new Fte(D.message)}):r},e),this}conflicts(e,n){return Nw("<string|object> [string|array]",[e,n],arguments.length),mf(this,Sme,"f").conflicts(e,n),this}config(e="config",n,r){return Nw("[object|string] [string|function] [function]",[e,n,r],arguments.length),typeof e=="object"&&!Array.isArray(e)?(e=UGt(e,mf(this,MNt,"f"),this[VNt]()["deep-merge-config"]||!1,mf(this,WO,"f")),mf(this,mN,"f").configObjects=(mf(this,mN,"f").configObjects||[]).concat(e),this):(typeof n=="function"&&(r=n,n=void 0),this.describe(e,n||mf(this,NL,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(e)?e:[e]).forEach(l=>{mf(this,mN,"f").config[l]=r||!0}),this)}completion(e,n,r){return Nw("[string] [string|boolean|function] [function]",[e,n,r],arguments.length),typeof n=="function"&&(r=n,n=void 0),Uw(this,Snt,e||mf(this,Snt,"f")||"completion","f"),!n&&n!==!1&&(n="generate completion script"),this.command(mf(this,Snt,"f"),n),r&&mf(this,rut,"f").registerFunction(r),this}command(e,n,r,l,_,v){return Nw("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[e,n,r,l,_,v],arguments.length),mf(this,_ye,"f").addHandler(e,n,r,l,_,v),this}commands(e,n,r,l,_,v){return this.command(e,n,r,l,_,v)}commandDir(e,n){Nw("<string> [object]",[e,n],arguments.length);let r=mf(this,Ptn,"f")||mf(this,WO,"f").require;return mf(this,_ye,"f").addDirectory(e,r,mf(this,WO,"f").getCallerFile(),n),this}count(e){return Nw("<array|string>",[e],arguments.length),this[vDt]("count",e),this[qNt](e),this}default(e,n,r){return Nw("<object|string|array> [*] [string]",[e,n,r],arguments.length),r&&(aOn(e,mf(this,WO,"f")),mf(this,mN,"f").defaultDescription[e]=r),typeof n=="function"&&(aOn(e,mf(this,WO,"f")),mf(this,mN,"f").defaultDescription[e]||(mf(this,mN,"f").defaultDescription[e]=mf(this,NL,"f").functionDescription(n)),n=n.call()),this[sLt](this.default.bind(this),"default",e,n),this}defaults(e,n,r){return this.default(e,n,r)}demandCommand(e=1,n,r,l){return Nw("[number] [number|string] [string|null|undefined] [string|null|undefined]",[e,n,r,l],arguments.length),typeof n!="number"&&(r=n,n=1/0),this.global("_",!1),mf(this,mN,"f").demandedCommands._={min:e,max:n,minMsg:r,maxMsg:l},this}demand(e,n,r){return Array.isArray(n)?(n.forEach(l=>{zGe(r,!0,mf(this,WO,"f")),this.demandOption(l,r)}),n=1/0):typeof n!="number"&&(r=n,n=1/0),typeof e=="number"?(zGe(r,!0,mf(this,WO,"f")),this.demandCommand(e,n,r,r)):Array.isArray(e)?e.forEach(l=>{zGe(r,!0,mf(this,WO,"f")),this.demandOption(l,r)}):typeof r=="string"?this.demandOption(e,r):(r===!0||typeof r>"u")&&this.demandOption(e),this}demandOption(e,n){return Nw("<object|string|array> [string]",[e,n],arguments.length),this[sLt](this.demandOption.bind(this),"demandedOptions",e,n),this}deprecateOption(e,n){return Nw("<string> [string|boolean]",[e,n],arguments.length),mf(this,mN,"f").deprecatedOptions[e]=n,this}describe(e,n){return Nw("<object|string|array> [string]",[e,n],arguments.length),this[TOn](e,!0),mf(this,NL,"f").describe(e,n),this}detectLocale(e){return Nw("<boolean>",[e],arguments.length),Uw(this,FNt,e,"f"),this}env(e){return Nw("[string|boolean]",[e],arguments.length),e===!1?delete mf(this,mN,"f").envPrefix:mf(this,mN,"f").envPrefix=e||"",this}epilogue(e){return Nw("<string>",[e],arguments.length),mf(this,NL,"f").epilog(e),this}epilog(e){return this.epilogue(e)}example(e,n){return Nw("<string|array> [string]",[e,n],arguments.length),Array.isArray(e)?e.forEach(r=>this.example(...r)):mf(this,NL,"f").example(e,n),this}exit(e,n){Uw(this,Ent,!0,"f"),Uw(this,gDt,n,"f"),mf(this,iut,"f")&&mf(this,WO,"f").process.exit(e)}exitProcess(e=!0){return Nw("[boolean]",[e],arguments.length),Uw(this,iut,e,"f"),this}fail(e){if(Nw("<function|boolean>",[e],arguments.length),typeof e=="boolean"&&e!==!1)throw new Fte("Invalid first argument. Expected function or boolean 'false'");return mf(this,NL,"f").failFn(e),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(e,n){return Nw("<array> [function]",[e,n],arguments.length),n?mf(this,rut,"f").getCompletion(e,n):new Promise((r,l)=>{mf(this,rut,"f").getCompletion(e,(_,v)=>{_?l(_):r(v)})})}getDemandedOptions(){return Nw([],0),mf(this,mN,"f").demandedOptions}getDemandedCommands(){return Nw([],0),mf(this,mN,"f").demandedCommands}getDeprecatedOptions(){return Nw([],0),mf(this,mN,"f").deprecatedOptions}getDetectLocale(){return mf(this,FNt,"f")}getExitProcess(){return mf(this,iut,"f")}getGroups(){return Object.assign({},mf(this,Ixt,"f"),mf(this,jNt,"f"))}getHelp(){if(Uw(this,Ent,!0,"f"),!mf(this,NL,"f").hasCachedHelpMessage()){if(!this.parsed){let n=this[zGt](mf(this,yDt,"f"),void 0,void 0,0,!0);if(Cae(n))return n.then(()=>mf(this,NL,"f").help())}let e=mf(this,_ye,"f").runDefaultBuilderOn(this);if(Cae(e))return e.then(()=>mf(this,NL,"f").help())}return Promise.resolve(mf(this,NL,"f").help())}getOptions(){return mf(this,mN,"f")}getStrict(){return mf(this,WNt,"f")}getStrictCommands(){return mf(this,GNt,"f")}getStrictOptions(){return mf(this,UNt,"f")}global(e,n){return Nw("<string|array> [boolean]",[e,n],arguments.length),e=[].concat(e),n!==!1?mf(this,mN,"f").local=mf(this,mN,"f").local.filter(r=>e.indexOf(r)===-1):e.forEach(r=>{mf(this,mN,"f").local.includes(r)||mf(this,mN,"f").local.push(r)}),this}group(e,n){Nw("<string|array> <string>",[e,n],arguments.length);let r=mf(this,jNt,"f")[n]||mf(this,Ixt,"f")[n];mf(this,jNt,"f")[n]&&delete mf(this,jNt,"f")[n];let l={};return mf(this,Ixt,"f")[n]=(r||[]).concat(e).filter(_=>l[_]?!1:l[_]=!0),this}hide(e){return Nw("<string>",[e],arguments.length),mf(this,mN,"f").hiddenOptions.push(e),this}implies(e,n){return Nw("<string|object> [number|string|array]",[e,n],arguments.length),mf(this,Sme,"f").implies(e,n),this}locale(e){return Nw("[string]",[e],arguments.length),e===void 0?(this[vOn](),mf(this,WO,"f").y18n.getLocale()):(Uw(this,FNt,!1,"f"),mf(this,WO,"f").y18n.setLocale(e),this)}middleware(e,n,r){return mf(this,sut,"f").addMiddleware(e,!!n,r)}nargs(e,n){return Nw("<string|object|array> [number]",[e,n],arguments.length),this[sLt](this.nargs.bind(this),"narg",e,n),this}normalize(e){return Nw("<array|string>",[e],arguments.length),this[vDt]("normalize",e),this}number(e){return Nw("<array|string>",[e],arguments.length),this[vDt]("number",e),this[qNt](e),this}option(e,n){if(Nw("<string|object> [object]",[e,n],arguments.length),typeof e=="object")Object.keys(e).forEach(r=>{this.options(r,e[r])});else{typeof n!="object"&&(n={}),this[qNt](e),mf(this,Pxt,"f")&&(e==="version"||n?.alias==="version")&&this[jwr](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join(`
|
|
822
822
|
`),void 0,"versionWarning"),mf(this,mN,"f").key[e]=!0,n.alias&&this.alias(e,n.alias);let r=n.deprecate||n.deprecated;r&&this.deprecateOption(e,r);let l=n.demand||n.required||n.require;l&&this.demand(e,l),n.demandOption&&this.demandOption(e,typeof n.demandOption=="string"?n.demandOption:void 0),n.conflicts&&this.conflicts(e,n.conflicts),"default"in n&&this.default(e,n.default),n.implies!==void 0&&this.implies(e,n.implies),n.nargs!==void 0&&this.nargs(e,n.nargs),n.config&&this.config(e,n.configParser),n.normalize&&this.normalize(e),n.choices&&this.choices(e,n.choices),n.coerce&&this.coerce(e,n.coerce),n.group&&this.group(e,n.group),(n.boolean||n.type==="boolean")&&(this.boolean(e),n.alias&&this.boolean(n.alias)),(n.array||n.type==="array")&&(this.array(e),n.alias&&this.array(n.alias)),(n.number||n.type==="number")&&(this.number(e),n.alias&&this.number(n.alias)),(n.string||n.type==="string")&&(this.string(e),n.alias&&this.string(n.alias)),(n.count||n.type==="count")&&this.count(e),typeof n.global=="boolean"&&this.global(e,n.global),n.defaultDescription&&(mf(this,mN,"f").defaultDescription[e]=n.defaultDescription),n.skipValidation&&this.skipValidation(e);let _=n.describe||n.description||n.desc,v=mf(this,NL,"f").getDescriptions();(!Object.prototype.hasOwnProperty.call(v,e)||typeof _=="string")&&this.describe(e,_),n.hidden&&this.hide(e),n.requiresArg&&this.requiresArg(e)}return this}options(e,n){return this.option(e,n)}parse(e,n,r){Nw("[string|array] [function|boolean|object] [function]",[e,n,r],arguments.length),this[Wwr](),typeof e>"u"&&(e=mf(this,yDt,"f")),typeof n=="object"&&(Uw(this,BNt,n,"f"),n=r),typeof n=="function"&&(Uw(this,Tnt,n,"f"),n=!1),n||Uw(this,yDt,e,"f"),mf(this,Tnt,"f")&&Uw(this,iut,!1,"f");let l=this[zGt](e,!!n),_=this.parsed;return mf(this,rut,"f").setParsed(this.parsed),Cae(l)?l.then(v=>(mf(this,Tnt,"f")&&mf(this,Tnt,"f").call(this,mf(this,gDt,"f"),v,mf(this,Iwe,"f")),v)).catch(v=>{throw mf(this,Tnt,"f")&&mf(this,Tnt,"f")(v,this.parsed.argv,mf(this,Iwe,"f")),v}).finally(()=>{this[COn](),this.parsed=_}):(mf(this,Tnt,"f")&&mf(this,Tnt,"f").call(this,mf(this,gDt,"f"),l,mf(this,Iwe,"f")),this[COn](),this.parsed=_,l)}parseAsync(e,n,r){let l=this.parse(e,n,r);return Cae(l)?l:Promise.resolve(l)}parseSync(e,n,r){let l=this.parse(e,n,r);if(Cae(l))throw new Fte(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return l}parserConfiguration(e){return Nw("<object>",[e],arguments.length),Uw(this,Ntn,e,"f"),this}pkgConf(e,n){Nw("<string> [string]",[e,n],arguments.length);let r=null,l=this[xOn](n||mf(this,MNt,"f"));return l[e]&&typeof l[e]=="object"&&(r=UGt(l[e],n||mf(this,MNt,"f"),this[VNt]()["deep-merge-config"]||!1,mf(this,WO,"f")),mf(this,mN,"f").configObjects=(mf(this,mN,"f").configObjects||[]).concat(r)),this}positional(e,n){Nw("<string> <object>",[e,n],arguments.length);let r=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];n=mDt(n,(v,D)=>v==="type"&&!["string","number","boolean"].includes(D)?!1:r.includes(v));let l=mf(this,VGt,"f").fullCommands[mf(this,VGt,"f").fullCommands.length-1],_=l?mf(this,_ye,"f").cmdToParseOptions(l):{array:[],alias:{},default:{},demand:{}};return Z7t(_).forEach(v=>{let D=_[v];Array.isArray(D)?D.indexOf(e)!==-1&&(n[v]=!0):D[e]&&!(v in n)&&(n[v]=D[e])}),this.group(e,mf(this,NL,"f").getPositionalGroupName()),this.option(e,n)}recommendCommands(e=!0){return Nw("[boolean]",[e],arguments.length),Uw(this,Otn,e,"f"),this}required(e,n,r){return this.demand(e,n,r)}require(e,n,r){return this.demand(e,n,r)}requiresArg(e){return Nw("<array|string|object> [number]",[e],arguments.length),typeof e=="string"&&mf(this,mN,"f").narg[e]?this:(this[sLt](this.requiresArg.bind(this),"narg",e,NaN),this)}showCompletionScript(e,n){return Nw("[string] [string]",[e,n],arguments.length),e=e||this.$0,mf(this,rLt,"f").log(mf(this,rut,"f").generateCompletionScript(e,n||mf(this,Snt,"f")||"completion")),this}showHelp(e){if(Nw("[string|function]",[e],arguments.length),Uw(this,Ent,!0,"f"),!mf(this,NL,"f").hasCachedHelpMessage()){if(!this.parsed){let r=this[zGt](mf(this,yDt,"f"),void 0,void 0,0,!0);if(Cae(r))return r.then(()=>{mf(this,NL,"f").showHelp(e)}),this}let n=mf(this,_ye,"f").runDefaultBuilderOn(this);if(Cae(n))return n.then(()=>{mf(this,NL,"f").showHelp(e)}),this}return mf(this,NL,"f").showHelp(e),this}scriptName(e){return this.customScriptName=!0,this.$0=e,this}showHelpOnFail(e,n){return Nw("[boolean|string] [string]",[e,n],arguments.length),mf(this,NL,"f").showHelpOnFail(e,n),this}showVersion(e){return Nw("[string|function]",[e],arguments.length),mf(this,NL,"f").showVersion(e),this}skipValidation(e){return Nw("<array|string>",[e],arguments.length),this[vDt]("skipValidation",e),this}strict(e){return Nw("[boolean]",[e],arguments.length),Uw(this,WNt,e!==!1,"f"),this}strictCommands(e){return Nw("[boolean]",[e],arguments.length),Uw(this,GNt,e!==!1,"f"),this}strictOptions(e){return Nw("[boolean]",[e],arguments.length),Uw(this,UNt,e!==!1,"f"),this}string(e){return Nw("<array|string>",[e],arguments.length),this[vDt]("string",e),this[qNt](e),this}terminalWidth(){return Nw([],0),mf(this,WO,"f").process.stdColumns}updateLocale(e){return this.updateStrings(e)}updateStrings(e){return Nw("<object>",[e],arguments.length),Uw(this,FNt,!1,"f"),mf(this,WO,"f").y18n.updateLocale(e),this}usage(e,n,r,l){if(Nw("<string|null|undefined> [string|boolean] [function|object] [function]",[e,n,r,l],arguments.length),n!==void 0){if(zGe(e,null,mf(this,WO,"f")),(e||"").match(/^\$0( |$)/))return this.command(e,n,r,l);throw new Fte(".usage() description must start with $0 if being used as alias for .command()")}else return mf(this,NL,"f").usage(e),this}usageConfiguration(e){return Nw("<object>",[e],arguments.length),Uw(this,Ltn,e,"f"),this}version(e,n,r){let l="version";if(Nw("[boolean|string] [string] [string]",[e,n,r],arguments.length),mf(this,Pxt,"f")&&(this[yOn](mf(this,Pxt,"f")),mf(this,NL,"f").version(void 0),Uw(this,Pxt,null,"f")),arguments.length===0)r=this[Vwr](),e=l;else if(arguments.length===1){if(e===!1)return this;r=e,e=l}else arguments.length===2&&(r=n,n=void 0);return Uw(this,Pxt,typeof e=="string"?e:l,"f"),n=n||mf(this,NL,"f").deferY18nLookup("Show version number"),mf(this,NL,"f").version(r||void 0),this.boolean(mf(this,Pxt,"f")),this.describe(mf(this,Pxt,"f"),n),this}wrap(e){return Nw("<number|null|undefined>",[e],arguments.length),mf(this,NL,"f").wrap(e),this}[(_ye=new WeakMap,MNt=new WeakMap,VGt=new WeakMap,rut=new WeakMap,Snt=new WeakMap,Dtn=new WeakMap,gDt=new WeakMap,FNt=new WeakMap,ktn=new WeakMap,iut=new WeakMap,wtn=new WeakMap,sut=new WeakMap,Ixt=new WeakMap,Ent=new WeakMap,aut=new WeakMap,Itn=new WeakMap,rLt=new WeakMap,Iwe=new WeakMap,mN=new WeakMap,Ptn=new WeakMap,Ntn=new WeakMap,Tnt=new WeakMap,BNt=new WeakMap,iLt=new WeakMap,jNt=new WeakMap,yDt=new WeakMap,Otn=new WeakMap,WO=new WeakMap,WNt=new WeakMap,GNt=new WeakMap,UNt=new WeakMap,NL=new WeakMap,Ltn=new WeakMap,Pxt=new WeakMap,Sme=new WeakMap,Fwr)](e){if(!e._||!e["--"])return e;e._.push.apply(e._,e["--"]);try{delete e["--"]}catch{}return e}[Bwr](){return{log:(...e)=>{this[Rtn]()||console.log(...e),Uw(this,Ent,!0,"f"),mf(this,Iwe,"f").length&&Uw(this,Iwe,mf(this,Iwe,"f")+`
|
|
823
823
|
`,"f"),Uw(this,Iwe,mf(this,Iwe,"f")+e.join(" "),"f")},error:(...e)=>{this[Rtn]()||console.error(...e),Uw(this,Ent,!0,"f"),mf(this,Iwe,"f").length&&Uw(this,Iwe,mf(this,Iwe,"f")+`
|
|
824
|
-
`,"f"),Uw(this,Iwe,mf(this,Iwe,"f")+e.join(" "),"f")}}}[yOn](e){Z7t(mf(this,mN,"f")).forEach(n=>{if((l=>l==="configObjects")(n))return;let r=mf(this,mN,"f")[n];Array.isArray(r)?r.includes(e)&&r.splice(r.indexOf(e),1):typeof r=="object"&&delete r[e]}),delete mf(this,NL,"f").getDescriptions()[e]}[jwr](e,n,r){mf(this,ktn,"f")[r]||(mf(this,WO,"f").process.emitWarning(e,n),mf(this,ktn,"f")[r]=!0)}[Wwr](){mf(this,wtn,"f").push({options:mf(this,mN,"f"),configObjects:mf(this,mN,"f").configObjects.slice(0),exitProcess:mf(this,iut,"f"),groups:mf(this,Ixt,"f"),strict:mf(this,WNt,"f"),strictCommands:mf(this,GNt,"f"),strictOptions:mf(this,UNt,"f"),completionCommand:mf(this,Snt,"f"),output:mf(this,Iwe,"f"),exitError:mf(this,gDt,"f"),hasOutput:mf(this,Ent,"f"),parsed:this.parsed,parseFn:mf(this,Tnt,"f"),parseContext:mf(this,BNt,"f")}),mf(this,NL,"f").freeze(),mf(this,Sme,"f").freeze(),mf(this,_ye,"f").freeze(),mf(this,sut,"f").freeze()}[Gwr](){let e="",n;return/\b(node|iojs|electron)(\.exe)?$/.test(mf(this,WO,"f").process.argv()[0])?n=mf(this,WO,"f").process.argv().slice(1,2):n=mf(this,WO,"f").process.argv().slice(0,1),e=n.map(r=>{let l=this[eIr](mf(this,MNt,"f"),r);return r.match(/^(\/|([a-zA-Z]:)?\\)/)&&l.length<r.length?l:r}).join(" ").trim(),mf(this,WO,"f").getEnv("_")&&mf(this,WO,"f").getProcessArgvBin()===mf(this,WO,"f").getEnv("_")&&(e=mf(this,WO,"f").getEnv("_").replace(`${mf(this,WO,"f").path.dirname(mf(this,WO,"f").process.execPath())}/`,"")),e}[VNt](){return mf(this,Ntn,"f")}[Uwr](){return mf(this,Ltn,"f")}[vOn](){if(!mf(this,FNt,"f"))return;let e=mf(this,WO,"f").getEnv("LC_ALL")||mf(this,WO,"f").getEnv("LC_MESSAGES")||mf(this,WO,"f").getEnv("LANG")||mf(this,WO,"f").getEnv("LANGUAGE")||"en_US";this.locale(e.replace(/[.:].*/,""))}[Vwr](){return this[xOn]().version||"unknown"}[zwr](e){let n=e["--"]?e["--"]:e._;for(let r=0,l;(l=n[r])!==void 0;r++)mf(this,WO,"f").Parser.looksLikeNumber(l)&&Number.isSafeInteger(Math.floor(parseFloat(`${l}`)))&&(n[r]=Number(l));return e}[xOn](e){let n=e||"*";if(mf(this,iLt,"f")[n])return mf(this,iLt,"f")[n];let r={};try{let l=e||mf(this,WO,"f").mainFilename;!e&&mf(this,WO,"f").path.extname(l)&&(l=mf(this,WO,"f").path.dirname(l));let _=mf(this,WO,"f").findUp(l,(v,D)=>{if(D.includes("package.json"))return"package.json"});zGe(_,void 0,mf(this,WO,"f")),r=JSON.parse(mf(this,WO,"f").readFileSync(_,"utf8"))}catch{}return mf(this,iLt,"f")[n]=r||{},mf(this,iLt,"f")[n]}[vDt](e,n){n=[].concat(n),n.forEach(r=>{r=this[EOn](r),mf(this,mN,"f")[e].push(r)})}[sLt](e,n,r,l){this[SOn](e,n,r,l,(_,v,D)=>{mf(this,mN,"f")[_][v]=D})}[bOn](e,n,r,l){this[SOn](e,n,r,l,(_,v,D)=>{mf(this,mN,"f")[_][v]=(mf(this,mN,"f")[_][v]||[]).concat(D)})}[SOn](e,n,r,l,_){if(Array.isArray(r))r.forEach(v=>{e(v,l)});else if((v=>typeof v=="object")(r))for(let v of Z7t(r))e(v,r[v]);else _(n,this[EOn](r),l)}[EOn](e){return e==="__proto__"?"___proto___":e}[TOn](e,n){return this[sLt](this[TOn].bind(this),"key",e,n),this}[COn](){var e,n,r,l,_,v,D,N,L,G,te,ce;let _e=mf(this,wtn,"f").pop();zGe(_e,void 0,mf(this,WO,"f"));let Ie;e=this,n=this,r=this,l=this,_=this,v=this,D=this,N=this,L=this,G=this,te=this,ce=this,{options:{set value(Se){Uw(e,mN,Se,"f")}}.value,configObjects:Ie,exitProcess:{set value(Se){Uw(n,iut,Se,"f")}}.value,groups:{set value(Se){Uw(r,Ixt,Se,"f")}}.value,output:{set value(Se){Uw(l,Iwe,Se,"f")}}.value,exitError:{set value(Se){Uw(_,gDt,Se,"f")}}.value,hasOutput:{set value(Se){Uw(v,Ent,Se,"f")}}.value,parsed:this.parsed,strict:{set value(Se){Uw(D,WNt,Se,"f")}}.value,strictCommands:{set value(Se){Uw(N,GNt,Se,"f")}}.value,strictOptions:{set value(Se){Uw(L,UNt,Se,"f")}}.value,completionCommand:{set value(Se){Uw(G,Snt,Se,"f")}}.value,parseFn:{set value(Se){Uw(te,Tnt,Se,"f")}}.value,parseContext:{set value(Se){Uw(ce,BNt,Se,"f")}}.value}=_e,mf(this,mN,"f").configObjects=Ie,mf(this,NL,"f").unfreeze(),mf(this,Sme,"f").unfreeze(),mf(this,_ye,"f").unfreeze(),mf(this,sut,"f").unfreeze()}[qwr](e,n){return RNt(n,r=>(e(r),r))}getInternalMethods(){return{getCommandInstance:this[Hwr].bind(this),getContext:this[Jwr].bind(this),getHasOutput:this[Kwr].bind(this),getLoggerInstance:this[$wr].bind(this),getParseContext:this[Xwr].bind(this),getParserConfiguration:this[VNt].bind(this),getUsageConfiguration:this[Uwr].bind(this),getUsageInstance:this[Ywr].bind(this),getValidationInstance:this[Qwr].bind(this),hasParseCallback:this[Rtn].bind(this),isGlobalContext:this[Zwr].bind(this),postProcess:this[zNt].bind(this),reset:this[AOn].bind(this),runValidation:this[DOn].bind(this),runYargsParserAndExecuteCommands:this[zGt].bind(this),setHasOutput:this[tIr].bind(this)}}[Hwr](){return mf(this,_ye,"f")}[Jwr](){return mf(this,VGt,"f")}[Kwr](){return mf(this,Ent,"f")}[$wr](){return mf(this,rLt,"f")}[Xwr](){return mf(this,BNt,"f")||{}}[Ywr](){return mf(this,NL,"f")}[Qwr](){return mf(this,Sme,"f")}[Rtn](){return!!mf(this,Tnt,"f")}[Zwr](){return mf(this,Itn,"f")}[zNt](e,n,r,l){return r||Cae(e)||(n||(e=this[Fwr](e)),(this[VNt]()["parse-positional-numbers"]||this[VNt]()["parse-positional-numbers"]===void 0)&&(e=this[zwr](e)),l&&(e=LNt(e,this,mf(this,sut,"f").getMiddleware(),!1))),e}[AOn](e={}){Uw(this,mN,mf(this,mN,"f")||{},"f");let n={};n.local=mf(this,mN,"f").local||[],n.configObjects=mf(this,mN,"f").configObjects||[];let r={};n.local.forEach(v=>{r[v]=!0,(e[v]||[]).forEach(D=>{r[D]=!0})}),Object.assign(mf(this,jNt,"f"),Object.keys(mf(this,Ixt,"f")).reduce((v,D)=>{let N=mf(this,Ixt,"f")[D].filter(L=>!(L in r));return N.length>0&&(v[D]=N),v},{})),Uw(this,Ixt,{},"f");let l=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],_=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return l.forEach(v=>{n[v]=(mf(this,mN,"f")[v]||[]).filter(D=>!r[D])}),_.forEach(v=>{n[v]=mDt(mf(this,mN,"f")[v],D=>!r[D])}),n.envPrefix=mf(this,mN,"f").envPrefix,Uw(this,mN,n,"f"),Uw(this,NL,mf(this,NL,"f")?mf(this,NL,"f").reset(r):Twr(this,mf(this,WO,"f")),"f"),Uw(this,Sme,mf(this,Sme,"f")?mf(this,Sme,"f").reset(r):Lwr(this,mf(this,NL,"f"),mf(this,WO,"f")),"f"),Uw(this,_ye,mf(this,_ye,"f")?mf(this,_ye,"f").reset():bwr(mf(this,NL,"f"),mf(this,Sme,"f"),mf(this,sut,"f"),mf(this,WO,"f")),"f"),mf(this,rut,"f")||Uw(this,rut,wwr(this,mf(this,NL,"f"),mf(this,_ye,"f"),mf(this,WO,"f")),"f"),mf(this,sut,"f").reset(),Uw(this,Snt,null,"f"),Uw(this,Iwe,"","f"),Uw(this,gDt,null,"f"),Uw(this,Ent,!1,"f"),this.parsed=!1,this}[eIr](e,n){return mf(this,WO,"f").path.relative(e,n)}[zGt](e,n,r,l=0,_=!1){let v=!!r||_;e=e||mf(this,yDt,"f"),mf(this,mN,"f").__=mf(this,WO,"f").y18n.__,mf(this,mN,"f").configuration=this[VNt]();let D=!!mf(this,mN,"f").configuration["populate--"],N=Object.assign({},mf(this,mN,"f").configuration,{"populate--":!0}),L=mf(this,WO,"f").Parser.detailed(e,Object.assign({},mf(this,mN,"f"),{configuration:{"parse-positional-numbers":!1,...N}})),G=Object.assign(L.argv,mf(this,BNt,"f")),te,ce=L.aliases,_e=!1,Ie=!1;Object.keys(G).forEach(Se=>{Se===mf(this,aut,"f")&&G[Se]?_e=!0:Se===mf(this,Pxt,"f")&&G[Se]&&(Ie=!0)}),G.$0=this.$0,this.parsed=L,l===0&&mf(this,NL,"f").clearCachedHelpMessage();try{if(this[vOn](),n)return this[zNt](G,D,!!r,!1);mf(this,aut,"f")&&[mf(this,aut,"f")].concat(ce[mf(this,aut,"f")]||[]).filter(Tn=>Tn.length>1).includes(""+G._[G._.length-1])&&(G._.pop(),_e=!0),Uw(this,Itn,!1,"f");let Se=mf(this,_ye,"f").getCommands(),Ue=mf(this,rut,"f").completionKey in G,Ke=_e||Ue||_;if(G._.length){if(Se.length){let ft;for(let Tn=l||0,It;G._[Tn]!==void 0;Tn++)if(It=String(G._[Tn]),Se.includes(It)&&It!==mf(this,Snt,"f")){let Xn=mf(this,_ye,"f").runCommand(It,this,L,Tn+1,_,_e||Ie||_);return this[zNt](Xn,D,!!r,!1)}else if(!ft&&It!==mf(this,Snt,"f")){ft=It;break}!mf(this,_ye,"f").hasDefaultCommand()&&mf(this,Otn,"f")&&ft&&!Ke&&mf(this,Sme,"f").recommendCommands(ft,Se)}mf(this,Snt,"f")&&G._.includes(mf(this,Snt,"f"))&&!Ue&&(mf(this,iut,"f")&&hDt(!0),this.showCompletionScript(),this.exit(0))}if(mf(this,_ye,"f").hasDefaultCommand()&&!Ke){let ft=mf(this,_ye,"f").runCommand(null,this,L,0,_,_e||Ie||_);return this[zNt](ft,D,!!r,!1)}if(Ue){mf(this,iut,"f")&&hDt(!0),e=[].concat(e);let ft=e.slice(e.indexOf(`--${mf(this,rut,"f").completionKey}`)+1);return mf(this,rut,"f").getCompletion(ft,(Tn,It)=>{if(Tn)throw new Fte(Tn.message);(It||[]).forEach(Xn=>{mf(this,rLt,"f").log(Xn)}),this.exit(0)}),this[zNt](G,!D,!!r,!1)}if(mf(this,Ent,"f")||(_e?(mf(this,iut,"f")&&hDt(!0),v=!0,this.showHelp("log"),this.exit(0)):Ie&&(mf(this,iut,"f")&&hDt(!0),v=!0,mf(this,NL,"f").showVersion("log"),this.exit(0))),!v&&mf(this,mN,"f").skipValidation.length>0&&(v=Object.keys(G).some(ft=>mf(this,mN,"f").skipValidation.indexOf(ft)>=0&&G[ft]===!0)),!v){if(L.error)throw new Fte(L.error.message);if(!Ue){let ft=this[DOn](ce,{},L.error);r||(te=LNt(G,this,mf(this,sut,"f").getMiddleware(),!0)),te=this[qwr](ft,te??G),Cae(te)&&!r&&(te=te.then(()=>LNt(G,this,mf(this,sut,"f").getMiddleware(),!1)))}}}catch(Se){if(Se instanceof Fte)mf(this,NL,"f").fail(Se.message,Se);else throw Se}return this[zNt](te??G,D,!!r,!0)}[DOn](e,n,r,l){let _={...this.getDemandedOptions()};return v=>{if(r)throw new Fte(r.message);mf(this,Sme,"f").nonOptionCount(v),mf(this,Sme,"f").requiredArguments(v,_);let D=!1;mf(this,GNt,"f")&&(D=mf(this,Sme,"f").unknownCommands(v)),mf(this,WNt,"f")&&!D?mf(this,Sme,"f").unknownArguments(v,e,n,!!l):mf(this,UNt,"f")&&mf(this,Sme,"f").unknownArguments(v,e,{},!1,!1),mf(this,Sme,"f").limitedChoices(v),mf(this,Sme,"f").implications(v),mf(this,Sme,"f").conflicting(v)}}[tIr](){Uw(this,Ent,!0,"f")}[qNt](e){if(typeof e=="string")mf(this,mN,"f").key[e]=!0;else for(let n of e)mf(this,mN,"f").key[n]=!0}}});var mis,rIr,iIr=Ma(()=>{"use strict";sOn();pOn();mis=nIr(iOn),rIr=mis});var sIr=Ma(()=>{gOn();nOn();eOn();sOn()});var Mtn,aIr=Ma(()=>{Mtn="0.11.0"});var aLt,oIr,cIr,lIr,uIr,fIr,pIr,dIr,_Ir,mIr,aEt=Ma(()=>{"use strict";dDt();aLt="X-Codemod-Access-Token".toLocaleLowerCase(),oIr=async t=>(await S4e.post("https://backend.codemod.com/validateAccessToken",{},{headers:{[aLt]:t},timeout:5e3})).data,cIr=async(t,e)=>{await S4e.post("https://backend.codemod.com/publish",e,{headers:{[aLt]:t,"Content-Type":"multipart/form-data"},timeout:1e4})},lIr=async(t,e)=>{await S4e.post("https://backend.codemod.com/unpublish",{name:e},{headers:{[aLt]:t},timeout:1e4})},uIr=async t=>{await S4e.delete("https://backend.codemod.com/revokeToken",{headers:{[aLt]:t},timeout:1e4})},fIr=async(t,e)=>{let n=new URL("https://backend.codemod.com/codemods/downloadLink");t&&n.searchParams.set("name",t);let r={};return e&&(r[aLt]=e),(await S4e.get(n.toString(),{headers:r,timeout:1e4})).data},pIr=async t=>{let{accessToken:e,search:n}=t??{},r={};e&&(r[aLt]=e);let l=new URL("https://backend.codemod.com/codemods/list");return n&&l.searchParams.set("search",n),(await S4e.get(l.toString(),{headers:r,timeout:1e4})).data},dIr=async()=>(await S4e.post("https://backend.codemod.com/intents",{})).data,_Ir=async(t,e)=>(await S4e.get(`https://backend.codemod.com/intents/${t}?iv=${e}`)).data.token,mIr=async t=>(await S4e.post("https://backend.codemod.com/diffs",{before:t.beforeSnippet,after:t.afterSnippet,source:"cli"})).data});var hIr,gIr,yIr,vIr,wOn,Ftn,BMe,xIr,Btn,jtn,out=Ma(()=>{"use strict";hIr=require("node:child_process"),gIr=require("node:os"),yIr=require("node:path");Ble();vIr=Dx(r0t(),1),wOn=Dx(require("keytar"),1);aEt();Ftn=t=>{let e=process.platform==="win32"?"start":"open",n=[t];try{return(0,hIr.spawnSync)(e,n,{stdio:"ignore",shell:!1}),!0}catch(r){return console.error("Error while opening URL:",r),!1}},BMe=async()=>{let[t]=await wOn.default.findCredentials("codemod.com");if(!JKe(t))return null;let{account:e,password:n}=t,r;try{r=await oIr(n)}catch{return await wOn.default.deletePassword("codemod.com",e),null}return{user:r,token:n}},xIr=(t,e="slug")=>{let n;switch(e){case"slug":n=r=>r.slug;break;case"name":n=r=>r.name;break;case"slug-and-name":n=r=>r.name===r.slug?r.name:`${r.name} (${r.slug})`;break;default:throw new Error("Invalid type")}return t.user.organizations.map(n).filter(JKe)},Btn=t=>(0,yIr.join)(String(t)==="runOnPreCommit"?process.cwd():(0,gIr.homedir)(),".codemod"),jtn=async t=>{let{globPattern:e,source:n,errorText:r,onSuccess:l,onFail:_}=t,v=async()=>(await(0,vIr.glob)(e,{absolute:!0,ignore:["**/node_modules/**"],cwd:n,onlyFiles:!0})).at(0),D=await v();try{if(await yae("codemod build",{cwd:n}),D=await v(),D===void 0)throw new Error;l?.()}catch{throw _?.(),new Error(r)}return D}});var bIr,oLt,IOn,gis,yis,SIr,EIr=Ma(()=>{"use strict";bIr=require("node:crypto"),oLt=require("node:fs/promises"),IOn=require("node:path");out();gis=async t=>{try{let e=await(0,oLt.readFile)((0,IOn.join)(t,"session.json"),"utf-8");return JSON.parse(e).id}catch{return null}},yis=async t=>{await(0,oLt.mkdir)(t,{recursive:!0});let e=(0,bIr.randomBytes)(16).toString("hex");return await(0,oLt.writeFile)((0,IOn.join)(t,"session.json"),JSON.stringify({id:e})),e},SIr=async()=>{let t=Btn(),e=await BMe();if(e!==null)return e.user.userId;let n=await gis(t);return n!==null?n:await yis(t)}});var NOn,Nxt,cLt,TIr,vis,CIr,POn,AIr,lLt,DIr,uLt,fLt,kIr,pLt,qGt=Ma(()=>{"use strict";NOn=require("node:crypto"),Nxt=require("node:path");Ble();cLt=function(t,e,n,r){function l(_){return _ instanceof n?_:new n(function(v){v(_)})}return new(n||(n=Promise))(function(_,v){function D(G){try{L(r.next(G))}catch(te){v(te)}}function N(G){try{L(r.throw(G))}catch(te){v(te)}}function L(G){G.done?_(G.value):l(G.value).then(D,N)}L((r=r.apply(t,e||[])).next())})},TIr={tabWidth:4,useTabs:!0,semi:!0,singleQuote:!0,quoteProps:"as-needed",trailingComma:"all",bracketSpacing:!0,arrowParens:"always",endOfLine:"lf",parser:"typescript"},vis=new Map([["ts","typescript"],["tsx","typescript"],["js","babel"],["jsx","babel"],["json","json"],["json5","json5"],["jsonc","json"],["css","css"],["scss","scss"],["less","less"],["graphql","graphql"],["md","markdown"],["mdx","mdx"],["html","html"],["vue","vue"],["yaml","yaml"],["yml","yaml"]]),CIr=t=>cLt(void 0,void 0,void 0,function*(){var e;let{resolveConfig:n}=yield import("prettier"),r=yield n(t,{editorconfig:!1});(r===null||Object.keys(r).length===0)&&(r=TIr);let l=(e=vis.get((0,Nxt.extname)(t).slice(1)))!==null&&e!==void 0?e:"typescript";return Object.assign(Object.assign({},r),{parser:l})}),POn=(t,e,n)=>cLt(void 0,void 0,void 0,function*(){let r=e.replace(/\/\*\* \*\*\//gm,"");if(!n)return r;try{let{format:l}=yield import("prettier"),_=yield CIr(t);return yield l(r,_)}catch{return r}}),AIr=t=>cLt(void 0,void 0,void 0,function*(){if(t.kind==="createFile"){let e=yield POn(t.newPath,t.newData,t.formatWithPrettier);return Object.assign(Object.assign({},t),{newData:e,formatted:!0})}if(t.kind==="updateFile"){let e=yield POn(t.oldPath,t.newData,t.formatWithPrettier);return t.oldData===e?null:Object.assign(Object.assign({},t),{newData:e,formatted:!0})}return Object.assign(Object.assign({},t),{formatted:!0})}),lLt=t=>cLt(void 0,void 0,void 0,function*(){return(yield Promise.all(t.map(n=>AIr(n)))).filter(JKe)}),DIr=(t,e)=>cLt(void 0,void 0,void 0,function*(){if(e.kind==="createFile"){let n=(0,Nxt.dirname)(e.newPath);return yield t.promises.mkdir(n,{recursive:!0}),t.promises.writeFile(e.newPath,e.newData)}if(e.kind==="deleteFile")return t.promises.unlink(e.oldPath);if(e.kind==="moveFile")return yield t.promises.copyFile(e.oldPath,e.newPath),t.promises.unlink(e.oldPath);if(e.kind==="updateFile")return t.promises.writeFile(e.oldPath,e.newData);if(e.kind==="copyFile"){let n=(0,Nxt.dirname)(e.newPath);return yield t.promises.mkdir(n,{recursive:!0}),t.promises.copyFile(e.oldPath,e.newPath)}}),uLt=(t,e)=>{let n=(0,NOn.createHash)("md5").update(e.kind).update(e.newPath).update(e.newData).digest("base64url"),r=(0,Nxt.extname)(e.newPath);return(0,Nxt.join)(t,`${n}${r}`)},fLt=(t,e)=>{let n=(0,NOn.createHash)("md5").update(e.kind).update(e.oldPath).update(e.newData).digest("base64url"),r=(0,Nxt.extname)(e.oldPath);return(0,Nxt.join)(t,`${n}${r}`)},kIr=(t,e,n)=>cLt(void 0,void 0,void 0,function*(){if(n.kind==="createFile"){let r=uLt(e,n);yield t.promises.writeFile(r,n.newData)}if(n.kind==="updateFile"){let r=fLt(e,n);yield t.promises.writeFile(r,n.newData)}}),pLt=(t,e,n)=>e.dryRun===!0?kIr(t,e.outputDirectoryPath,n):DIr(t,n)});var wIr=Ma(()=>{"use strict"});var IIr,xis,bis,PIr,NIr=Ma(()=>{"use strict";IIr=require("node:fs");MGe();xis=MY([pk("jscodeshift"),pk("filemod"),pk("ts-morph"),pk("ast-grep"),pk("workflow")]),bis=oR({_:gme(vD()),source:jO(vD()),engine:jO(xis)}),PIr=t=>{var e,n;let r=Mle(bis,t);if(r._.includes("runOnPreCommit"))return{kind:"runOnPreCommit"};let l=r._.at(0);if(!l)throw new Error("Codemod to run was not specified!");return(0,IIr.existsSync)(l)||r.source?{kind:"runSourced",source:(e=r.source)!==null&&e!==void 0?e:l,engine:(n=r.engine)!==null&&n!==void 0?n:null}:{kind:"runNamed",name:l}}});var OIr,HGt,Sis,OOn,LOn,ROn,MOn,FOn,LIr,RIr,Eis,MIr,BOn=Ma(()=>{"use strict";OIr=require("node:path");ITe();MGe();HGt=["**/node_modules/**/*.*","**/*.d.ts","**/.next/**/*.*","**/dist/**/*.*","**/build/**/*.*"],Sis=process.cwd(),OOn=!0,LOn=!0,ROn=!0,MOn=!1,FOn=4,LIr=!1,RIr=!0,Eis=oR({_:gme(vD()),include:jO(gme(vD())),exclude:jO(gme(vD())),target:jO(vD()),files:jO(gme(vD())),format:jO(h4e(),OOn),cache:jO(h4e(),LOn),install:jO(h4e(),ROn),json:jO(h4e(),MOn),threads:jO(J8t([bcr(0)]),FOn)}),MIr=(t,e)=>{var n,r;let l=Mle(Eis,t),_=l._.at(1),v=l.target,D;return _&&v?(e.printConsoleMessage("info",bm.yellow("Both positional and argument target options are passed. Defaulting to the argument target option...")),D=v):D=(n=_??v)!==null&&n!==void 0?n:Sis,Object.assign(Object.assign({},l),{target:(0,OIr.resolve)(D),exclude:((r=l.exclude)!==null&&r!==void 0?r:[]).concat(HGt)})}});var FIr,BIr,Tis,jIr,WIr=Ma(()=>{"use strict";FIr=require("node:crypto"),BIr=require("node:path");MGe();Tis=MY([oR({dry:jO(pk(!1),!1)}),oR({dry:pk(!0),output:jO(vD())})]),jIr=(t,e)=>{let n=(0,FIr.randomBytes)(20);return Mle(Tis,e).dry===!1?{dryRun:!1,caseHashDigest:n}:{dryRun:!0,streamingEnabled:!0,outputDirectoryPath:(0,BIr.join)(t,".codemod","cases",n.toString("base64url")),caseHashDigest:n}}});var UIr=nn((v0o,GIr)=>{var Cis=Object.prototype.toString,jOn=typeof Buffer<"u"&&typeof Buffer.alloc=="function"&&typeof Buffer.allocUnsafe=="function"&&typeof Buffer.from=="function";function Ais(t){return Cis.call(t).slice(8,-1)==="ArrayBuffer"}function Dis(t,e,n){e>>>=0;var r=t.byteLength-e;if(r<0)throw new RangeError("'offset' is out of bounds");if(n===void 0)n=r;else if(n>>>=0,n>r)throw new RangeError("'length' is out of bounds");return jOn?Buffer.from(t.slice(e,e+n)):new Buffer(new Uint8Array(t.slice(e,e+n)))}function kis(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!Buffer.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');return jOn?Buffer.from(t,e):new Buffer(t,e)}function wis(t,e,n){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return Ais(t)?Dis(t,e,n):typeof t=="string"?kis(t,e):jOn?Buffer.from(t):new Buffer(t)}GIr.exports=wis});var $Gt=nn((JNt,VOn)=>{var Iis=FYt().SourceMapConsumer,WOn=require("path"),Oxt;try{Oxt=require("fs"),(!Oxt.existsSync||!Oxt.readFileSync)&&(Oxt=null)}catch{}var Pis=UIr();function VIr(t,e){return t.require(e)}var zIr=!1,qIr=!1,GOn=!1,JGt="auto",HNt={},KGt={},Nis=/^data:application\/json[^,]+base64,/,xDt=[],bDt=[];function zOn(){return JGt==="browser"?!0:JGt==="node"?!1:typeof window<"u"&&typeof XMLHttpRequest=="function"&&!(window.require&&window.module&&window.process&&window.process.type==="renderer")}function Ois(){return typeof process=="object"&&process!==null&&typeof process.on=="function"}function Lis(){return typeof process=="object"&&process!==null?process.version:""}function Ris(){if(typeof process=="object"&&process!==null)return process.stderr}function Mis(t){if(typeof process=="object"&&process!==null&&typeof process.exit=="function")return process.exit(t)}function Wtn(t){return function(e){for(var n=0;n<t.length;n++){var r=t[n](e);if(r)return r}return null}}var qOn=Wtn(xDt);xDt.push(function(t){if(t=t.trim(),/^file:/.test(t)&&(t=t.replace(/file:\/\/\/(\w:)?/,function(r,l){return l?"":"/"})),t in HNt)return HNt[t];var e="";try{if(Oxt)Oxt.existsSync(t)&&(e=Oxt.readFileSync(t,"utf8"));else{var n=new XMLHttpRequest;n.open("GET",t,!1),n.send(null),n.readyState===4&&n.status===200&&(e=n.responseText)}}catch{}return HNt[t]=e});function UOn(t,e){if(!t)return e;var n=WOn.dirname(t),r=/^\w+:\/\/[^\/]*/.exec(n),l=r?r[0]:"",_=n.slice(l.length);return l&&/^\/\w\:/.test(_)?(l+="/",l+WOn.resolve(n.slice(l.length),e).replace(/\\/g,"/")):l+WOn.resolve(n.slice(l.length),e)}function Fis(t){var e;if(zOn())try{var n=new XMLHttpRequest;n.open("GET",t,!1),n.send(null),e=n.readyState===4?n.responseText:null;var r=n.getResponseHeader("SourceMap")||n.getResponseHeader("X-SourceMap");if(r)return r}catch{}e=qOn(t);for(var l=/(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg,_,v;v=l.exec(e);)_=v;return _?_[1]:null}var HOn=Wtn(bDt);bDt.push(function(t){var e=Fis(t);if(!e)return null;var n;if(Nis.test(e)){var r=e.slice(e.indexOf(",")+1);n=Pis(r,"base64").toString(),e=t}else e=UOn(t,e),n=qOn(e);return n?{url:e,map:n}:null});function JOn(t){var e=KGt[t.source];if(!e){var n=HOn(t.source);n?(e=KGt[t.source]={url:n.url,map:new Iis(n.map)},e.map.sourcesContent&&e.map.sources.forEach(function(l,_){var v=e.map.sourcesContent[_];if(v){var D=UOn(e.url,l);HNt[D]=v}})):e=KGt[t.source]={url:null,map:null}}if(e&&e.map&&typeof e.map.originalPositionFor=="function"){var r=e.map.originalPositionFor(t);if(r.source!==null)return r.source=UOn(e.url,r.source),r}return t}function JIr(t){var e=/^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(t);if(e){var n=JOn({source:e[2],line:+e[3],column:e[4]-1});return"eval at "+e[1]+" ("+n.source+":"+n.line+":"+(n.column+1)+")"}return e=/^eval at ([^(]+) \((.+)\)$/.exec(t),e?"eval at "+e[1]+" ("+JIr(e[2])+")":t}function Bis(){var t,e="";if(this.isNative())e="native";else{t=this.getScriptNameOrSourceURL(),!t&&this.isEval()&&(e=this.getEvalOrigin(),e+=", "),t?e+=t:e+="<anonymous>";var n=this.getLineNumber();if(n!=null){e+=":"+n;var r=this.getColumnNumber();r&&(e+=":"+r)}}var l="",_=this.getFunctionName(),v=!0,D=this.isConstructor(),N=!(this.isToplevel()||D);if(N){var L=this.getTypeName();L==="[object Object]"&&(L="null");var G=this.getMethodName();_?(L&&_.indexOf(L)!=0&&(l+=L+"."),l+=_,G&&_.indexOf("."+G)!=_.length-G.length-1&&(l+=" [as "+G+"]")):l+=L+"."+(G||"<anonymous>")}else D?l+="new "+(_||"<anonymous>"):_?l+=_:(l+=e,v=!1);return v&&(l+=" ("+e+")"),l}function HIr(t){var e={};return Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(function(n){e[n]=/^(?:is|get)/.test(n)?function(){return t[n].call(t)}:t[n]}),e.toString=Bis,e}function KIr(t,e){if(e===void 0&&(e={nextPosition:null,curPosition:null}),t.isNative())return e.curPosition=null,t;var n=t.getFileName()||t.getScriptNameOrSourceURL();if(n){var r=t.getLineNumber(),l=t.getColumnNumber()-1,_=/^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/,v=_.test(Lis())?0:62;r===1&&l>v&&!zOn()&&!t.isEval()&&(l-=v);var D=JOn({source:n,line:r,column:l});e.curPosition=D,t=HIr(t);var N=t.getFunctionName;return t.getFunctionName=function(){return e.nextPosition==null?N():e.nextPosition.name||N()},t.getFileName=function(){return D.source},t.getLineNumber=function(){return D.line},t.getColumnNumber=function(){return D.column+1},t.getScriptNameOrSourceURL=function(){return D.source},t}var L=t.isEval()&&t.getEvalOrigin();return L&&(L=JIr(L),t=HIr(t),t.getEvalOrigin=function(){return L}),t}function jis(t,e){GOn&&(HNt={},KGt={});for(var n=t.name||"Error",r=t.message||"",l=n+": "+r,_={nextPosition:null,curPosition:null},v=[],D=e.length-1;D>=0;D--)v.push(`
|
|
824
|
+
`,"f"),Uw(this,Iwe,mf(this,Iwe,"f")+e.join(" "),"f")}}}[yOn](e){Z7t(mf(this,mN,"f")).forEach(n=>{if((l=>l==="configObjects")(n))return;let r=mf(this,mN,"f")[n];Array.isArray(r)?r.includes(e)&&r.splice(r.indexOf(e),1):typeof r=="object"&&delete r[e]}),delete mf(this,NL,"f").getDescriptions()[e]}[jwr](e,n,r){mf(this,ktn,"f")[r]||(mf(this,WO,"f").process.emitWarning(e,n),mf(this,ktn,"f")[r]=!0)}[Wwr](){mf(this,wtn,"f").push({options:mf(this,mN,"f"),configObjects:mf(this,mN,"f").configObjects.slice(0),exitProcess:mf(this,iut,"f"),groups:mf(this,Ixt,"f"),strict:mf(this,WNt,"f"),strictCommands:mf(this,GNt,"f"),strictOptions:mf(this,UNt,"f"),completionCommand:mf(this,Snt,"f"),output:mf(this,Iwe,"f"),exitError:mf(this,gDt,"f"),hasOutput:mf(this,Ent,"f"),parsed:this.parsed,parseFn:mf(this,Tnt,"f"),parseContext:mf(this,BNt,"f")}),mf(this,NL,"f").freeze(),mf(this,Sme,"f").freeze(),mf(this,_ye,"f").freeze(),mf(this,sut,"f").freeze()}[Gwr](){let e="",n;return/\b(node|iojs|electron)(\.exe)?$/.test(mf(this,WO,"f").process.argv()[0])?n=mf(this,WO,"f").process.argv().slice(1,2):n=mf(this,WO,"f").process.argv().slice(0,1),e=n.map(r=>{let l=this[eIr](mf(this,MNt,"f"),r);return r.match(/^(\/|([a-zA-Z]:)?\\)/)&&l.length<r.length?l:r}).join(" ").trim(),mf(this,WO,"f").getEnv("_")&&mf(this,WO,"f").getProcessArgvBin()===mf(this,WO,"f").getEnv("_")&&(e=mf(this,WO,"f").getEnv("_").replace(`${mf(this,WO,"f").path.dirname(mf(this,WO,"f").process.execPath())}/`,"")),e}[VNt](){return mf(this,Ntn,"f")}[Uwr](){return mf(this,Ltn,"f")}[vOn](){if(!mf(this,FNt,"f"))return;let e=mf(this,WO,"f").getEnv("LC_ALL")||mf(this,WO,"f").getEnv("LC_MESSAGES")||mf(this,WO,"f").getEnv("LANG")||mf(this,WO,"f").getEnv("LANGUAGE")||"en_US";this.locale(e.replace(/[.:].*/,""))}[Vwr](){return this[xOn]().version||"unknown"}[zwr](e){let n=e["--"]?e["--"]:e._;for(let r=0,l;(l=n[r])!==void 0;r++)mf(this,WO,"f").Parser.looksLikeNumber(l)&&Number.isSafeInteger(Math.floor(parseFloat(`${l}`)))&&(n[r]=Number(l));return e}[xOn](e){let n=e||"*";if(mf(this,iLt,"f")[n])return mf(this,iLt,"f")[n];let r={};try{let l=e||mf(this,WO,"f").mainFilename;!e&&mf(this,WO,"f").path.extname(l)&&(l=mf(this,WO,"f").path.dirname(l));let _=mf(this,WO,"f").findUp(l,(v,D)=>{if(D.includes("package.json"))return"package.json"});zGe(_,void 0,mf(this,WO,"f")),r=JSON.parse(mf(this,WO,"f").readFileSync(_,"utf8"))}catch{}return mf(this,iLt,"f")[n]=r||{},mf(this,iLt,"f")[n]}[vDt](e,n){n=[].concat(n),n.forEach(r=>{r=this[EOn](r),mf(this,mN,"f")[e].push(r)})}[sLt](e,n,r,l){this[SOn](e,n,r,l,(_,v,D)=>{mf(this,mN,"f")[_][v]=D})}[bOn](e,n,r,l){this[SOn](e,n,r,l,(_,v,D)=>{mf(this,mN,"f")[_][v]=(mf(this,mN,"f")[_][v]||[]).concat(D)})}[SOn](e,n,r,l,_){if(Array.isArray(r))r.forEach(v=>{e(v,l)});else if((v=>typeof v=="object")(r))for(let v of Z7t(r))e(v,r[v]);else _(n,this[EOn](r),l)}[EOn](e){return e==="__proto__"?"___proto___":e}[TOn](e,n){return this[sLt](this[TOn].bind(this),"key",e,n),this}[COn](){var e,n,r,l,_,v,D,N,L,G,te,ce;let _e=mf(this,wtn,"f").pop();zGe(_e,void 0,mf(this,WO,"f"));let Ie;e=this,n=this,r=this,l=this,_=this,v=this,D=this,N=this,L=this,G=this,te=this,ce=this,{options:{set value(Se){Uw(e,mN,Se,"f")}}.value,configObjects:Ie,exitProcess:{set value(Se){Uw(n,iut,Se,"f")}}.value,groups:{set value(Se){Uw(r,Ixt,Se,"f")}}.value,output:{set value(Se){Uw(l,Iwe,Se,"f")}}.value,exitError:{set value(Se){Uw(_,gDt,Se,"f")}}.value,hasOutput:{set value(Se){Uw(v,Ent,Se,"f")}}.value,parsed:this.parsed,strict:{set value(Se){Uw(D,WNt,Se,"f")}}.value,strictCommands:{set value(Se){Uw(N,GNt,Se,"f")}}.value,strictOptions:{set value(Se){Uw(L,UNt,Se,"f")}}.value,completionCommand:{set value(Se){Uw(G,Snt,Se,"f")}}.value,parseFn:{set value(Se){Uw(te,Tnt,Se,"f")}}.value,parseContext:{set value(Se){Uw(ce,BNt,Se,"f")}}.value}=_e,mf(this,mN,"f").configObjects=Ie,mf(this,NL,"f").unfreeze(),mf(this,Sme,"f").unfreeze(),mf(this,_ye,"f").unfreeze(),mf(this,sut,"f").unfreeze()}[qwr](e,n){return RNt(n,r=>(e(r),r))}getInternalMethods(){return{getCommandInstance:this[Hwr].bind(this),getContext:this[Jwr].bind(this),getHasOutput:this[Kwr].bind(this),getLoggerInstance:this[$wr].bind(this),getParseContext:this[Xwr].bind(this),getParserConfiguration:this[VNt].bind(this),getUsageConfiguration:this[Uwr].bind(this),getUsageInstance:this[Ywr].bind(this),getValidationInstance:this[Qwr].bind(this),hasParseCallback:this[Rtn].bind(this),isGlobalContext:this[Zwr].bind(this),postProcess:this[zNt].bind(this),reset:this[AOn].bind(this),runValidation:this[DOn].bind(this),runYargsParserAndExecuteCommands:this[zGt].bind(this),setHasOutput:this[tIr].bind(this)}}[Hwr](){return mf(this,_ye,"f")}[Jwr](){return mf(this,VGt,"f")}[Kwr](){return mf(this,Ent,"f")}[$wr](){return mf(this,rLt,"f")}[Xwr](){return mf(this,BNt,"f")||{}}[Ywr](){return mf(this,NL,"f")}[Qwr](){return mf(this,Sme,"f")}[Rtn](){return!!mf(this,Tnt,"f")}[Zwr](){return mf(this,Itn,"f")}[zNt](e,n,r,l){return r||Cae(e)||(n||(e=this[Fwr](e)),(this[VNt]()["parse-positional-numbers"]||this[VNt]()["parse-positional-numbers"]===void 0)&&(e=this[zwr](e)),l&&(e=LNt(e,this,mf(this,sut,"f").getMiddleware(),!1))),e}[AOn](e={}){Uw(this,mN,mf(this,mN,"f")||{},"f");let n={};n.local=mf(this,mN,"f").local||[],n.configObjects=mf(this,mN,"f").configObjects||[];let r={};n.local.forEach(v=>{r[v]=!0,(e[v]||[]).forEach(D=>{r[D]=!0})}),Object.assign(mf(this,jNt,"f"),Object.keys(mf(this,Ixt,"f")).reduce((v,D)=>{let N=mf(this,Ixt,"f")[D].filter(L=>!(L in r));return N.length>0&&(v[D]=N),v},{})),Uw(this,Ixt,{},"f");let l=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],_=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return l.forEach(v=>{n[v]=(mf(this,mN,"f")[v]||[]).filter(D=>!r[D])}),_.forEach(v=>{n[v]=mDt(mf(this,mN,"f")[v],D=>!r[D])}),n.envPrefix=mf(this,mN,"f").envPrefix,Uw(this,mN,n,"f"),Uw(this,NL,mf(this,NL,"f")?mf(this,NL,"f").reset(r):Twr(this,mf(this,WO,"f")),"f"),Uw(this,Sme,mf(this,Sme,"f")?mf(this,Sme,"f").reset(r):Lwr(this,mf(this,NL,"f"),mf(this,WO,"f")),"f"),Uw(this,_ye,mf(this,_ye,"f")?mf(this,_ye,"f").reset():bwr(mf(this,NL,"f"),mf(this,Sme,"f"),mf(this,sut,"f"),mf(this,WO,"f")),"f"),mf(this,rut,"f")||Uw(this,rut,wwr(this,mf(this,NL,"f"),mf(this,_ye,"f"),mf(this,WO,"f")),"f"),mf(this,sut,"f").reset(),Uw(this,Snt,null,"f"),Uw(this,Iwe,"","f"),Uw(this,gDt,null,"f"),Uw(this,Ent,!1,"f"),this.parsed=!1,this}[eIr](e,n){return mf(this,WO,"f").path.relative(e,n)}[zGt](e,n,r,l=0,_=!1){let v=!!r||_;e=e||mf(this,yDt,"f"),mf(this,mN,"f").__=mf(this,WO,"f").y18n.__,mf(this,mN,"f").configuration=this[VNt]();let D=!!mf(this,mN,"f").configuration["populate--"],N=Object.assign({},mf(this,mN,"f").configuration,{"populate--":!0}),L=mf(this,WO,"f").Parser.detailed(e,Object.assign({},mf(this,mN,"f"),{configuration:{"parse-positional-numbers":!1,...N}})),G=Object.assign(L.argv,mf(this,BNt,"f")),te,ce=L.aliases,_e=!1,Ie=!1;Object.keys(G).forEach(Se=>{Se===mf(this,aut,"f")&&G[Se]?_e=!0:Se===mf(this,Pxt,"f")&&G[Se]&&(Ie=!0)}),G.$0=this.$0,this.parsed=L,l===0&&mf(this,NL,"f").clearCachedHelpMessage();try{if(this[vOn](),n)return this[zNt](G,D,!!r,!1);mf(this,aut,"f")&&[mf(this,aut,"f")].concat(ce[mf(this,aut,"f")]||[]).filter(Tn=>Tn.length>1).includes(""+G._[G._.length-1])&&(G._.pop(),_e=!0),Uw(this,Itn,!1,"f");let Se=mf(this,_ye,"f").getCommands(),Ue=mf(this,rut,"f").completionKey in G,Ke=_e||Ue||_;if(G._.length){if(Se.length){let ft;for(let Tn=l||0,It;G._[Tn]!==void 0;Tn++)if(It=String(G._[Tn]),Se.includes(It)&&It!==mf(this,Snt,"f")){let Xn=mf(this,_ye,"f").runCommand(It,this,L,Tn+1,_,_e||Ie||_);return this[zNt](Xn,D,!!r,!1)}else if(!ft&&It!==mf(this,Snt,"f")){ft=It;break}!mf(this,_ye,"f").hasDefaultCommand()&&mf(this,Otn,"f")&&ft&&!Ke&&mf(this,Sme,"f").recommendCommands(ft,Se)}mf(this,Snt,"f")&&G._.includes(mf(this,Snt,"f"))&&!Ue&&(mf(this,iut,"f")&&hDt(!0),this.showCompletionScript(),this.exit(0))}if(mf(this,_ye,"f").hasDefaultCommand()&&!Ke){let ft=mf(this,_ye,"f").runCommand(null,this,L,0,_,_e||Ie||_);return this[zNt](ft,D,!!r,!1)}if(Ue){mf(this,iut,"f")&&hDt(!0),e=[].concat(e);let ft=e.slice(e.indexOf(`--${mf(this,rut,"f").completionKey}`)+1);return mf(this,rut,"f").getCompletion(ft,(Tn,It)=>{if(Tn)throw new Fte(Tn.message);(It||[]).forEach(Xn=>{mf(this,rLt,"f").log(Xn)}),this.exit(0)}),this[zNt](G,!D,!!r,!1)}if(mf(this,Ent,"f")||(_e?(mf(this,iut,"f")&&hDt(!0),v=!0,this.showHelp("log"),this.exit(0)):Ie&&(mf(this,iut,"f")&&hDt(!0),v=!0,mf(this,NL,"f").showVersion("log"),this.exit(0))),!v&&mf(this,mN,"f").skipValidation.length>0&&(v=Object.keys(G).some(ft=>mf(this,mN,"f").skipValidation.indexOf(ft)>=0&&G[ft]===!0)),!v){if(L.error)throw new Fte(L.error.message);if(!Ue){let ft=this[DOn](ce,{},L.error);r||(te=LNt(G,this,mf(this,sut,"f").getMiddleware(),!0)),te=this[qwr](ft,te??G),Cae(te)&&!r&&(te=te.then(()=>LNt(G,this,mf(this,sut,"f").getMiddleware(),!1)))}}}catch(Se){if(Se instanceof Fte)mf(this,NL,"f").fail(Se.message,Se);else throw Se}return this[zNt](te??G,D,!!r,!0)}[DOn](e,n,r,l){let _={...this.getDemandedOptions()};return v=>{if(r)throw new Fte(r.message);mf(this,Sme,"f").nonOptionCount(v),mf(this,Sme,"f").requiredArguments(v,_);let D=!1;mf(this,GNt,"f")&&(D=mf(this,Sme,"f").unknownCommands(v)),mf(this,WNt,"f")&&!D?mf(this,Sme,"f").unknownArguments(v,e,n,!!l):mf(this,UNt,"f")&&mf(this,Sme,"f").unknownArguments(v,e,{},!1,!1),mf(this,Sme,"f").limitedChoices(v),mf(this,Sme,"f").implications(v),mf(this,Sme,"f").conflicting(v)}}[tIr](){Uw(this,Ent,!0,"f")}[qNt](e){if(typeof e=="string")mf(this,mN,"f").key[e]=!0;else for(let n of e)mf(this,mN,"f").key[n]=!0}}});var mis,rIr,iIr=Ma(()=>{"use strict";sOn();pOn();mis=nIr(iOn),rIr=mis});var sIr=Ma(()=>{gOn();nOn();eOn();sOn()});var Mtn,aIr=Ma(()=>{Mtn="0.11.1"});var aLt,oIr,cIr,lIr,uIr,fIr,pIr,dIr,_Ir,mIr,aEt=Ma(()=>{"use strict";dDt();aLt="X-Codemod-Access-Token".toLocaleLowerCase(),oIr=async t=>(await S4e.post("https://backend.codemod.com/validateAccessToken",{},{headers:{[aLt]:t},timeout:5e3})).data,cIr=async(t,e)=>{await S4e.post("https://backend.codemod.com/publish",e,{headers:{[aLt]:t,"Content-Type":"multipart/form-data"},timeout:1e4})},lIr=async(t,e)=>{await S4e.post("https://backend.codemod.com/unpublish",{name:e},{headers:{[aLt]:t},timeout:1e4})},uIr=async t=>{await S4e.delete("https://backend.codemod.com/revokeToken",{headers:{[aLt]:t},timeout:1e4})},fIr=async(t,e)=>{let n=new URL("https://backend.codemod.com/codemods/downloadLink");t&&n.searchParams.set("name",t);let r={};return e&&(r[aLt]=e),(await S4e.get(n.toString(),{headers:r,timeout:1e4})).data},pIr=async t=>{let{accessToken:e,search:n}=t??{},r={};e&&(r[aLt]=e);let l=new URL("https://backend.codemod.com/codemods/list");return n&&l.searchParams.set("search",n),(await S4e.get(l.toString(),{headers:r,timeout:1e4})).data},dIr=async()=>(await S4e.post("https://backend.codemod.com/intents",{})).data,_Ir=async(t,e)=>(await S4e.get(`https://backend.codemod.com/intents/${t}?iv=${e}`)).data.token,mIr=async t=>(await S4e.post("https://backend.codemod.com/diffs",{before:t.beforeSnippet,after:t.afterSnippet,source:"cli"})).data});var hIr,gIr,yIr,vIr,wOn,Ftn,BMe,xIr,Btn,jtn,out=Ma(()=>{"use strict";hIr=require("node:child_process"),gIr=require("node:os"),yIr=require("node:path");Ble();vIr=Dx(r0t(),1),wOn=Dx(require("keytar"),1);aEt();Ftn=t=>{let e=process.platform==="win32"?"start":"open",n=[t];try{return(0,hIr.spawnSync)(e,n,{stdio:"ignore",shell:!1}),!0}catch(r){return console.error("Error while opening URL:",r),!1}},BMe=async()=>{let[t]=await wOn.default.findCredentials("codemod.com");if(!JKe(t))return null;let{account:e,password:n}=t,r;try{r=await oIr(n)}catch{return await wOn.default.deletePassword("codemod.com",e),null}return{user:r,token:n}},xIr=(t,e="slug")=>{let n;switch(e){case"slug":n=r=>r.slug;break;case"name":n=r=>r.name;break;case"slug-and-name":n=r=>r.name===r.slug?r.name:`${r.name} (${r.slug})`;break;default:throw new Error("Invalid type")}return t.user.organizations.map(n).filter(JKe)},Btn=t=>(0,yIr.join)(String(t)==="runOnPreCommit"?process.cwd():(0,gIr.homedir)(),".codemod"),jtn=async t=>{let{globPattern:e,source:n,errorText:r,onSuccess:l,onFail:_}=t,v=async()=>(await(0,vIr.glob)(e,{absolute:!0,ignore:["**/node_modules/**"],cwd:n,onlyFiles:!0})).at(0),D=await v();try{if(await yae("codemod build",{cwd:n}),D=await v(),D===void 0)throw new Error;l?.()}catch{throw _?.(),new Error(r)}return D}});var bIr,oLt,IOn,gis,yis,SIr,EIr=Ma(()=>{"use strict";bIr=require("node:crypto"),oLt=require("node:fs/promises"),IOn=require("node:path");out();gis=async t=>{try{let e=await(0,oLt.readFile)((0,IOn.join)(t,"session.json"),"utf-8");return JSON.parse(e).id}catch{return null}},yis=async t=>{await(0,oLt.mkdir)(t,{recursive:!0});let e=(0,bIr.randomBytes)(16).toString("hex");return await(0,oLt.writeFile)((0,IOn.join)(t,"session.json"),JSON.stringify({id:e})),e},SIr=async()=>{let t=Btn(),e=await BMe();if(e!==null)return e.user.userId;let n=await gis(t);return n!==null?n:await yis(t)}});var NOn,Nxt,cLt,TIr,vis,CIr,POn,AIr,lLt,DIr,uLt,fLt,kIr,pLt,qGt=Ma(()=>{"use strict";NOn=require("node:crypto"),Nxt=require("node:path");Ble();cLt=function(t,e,n,r){function l(_){return _ instanceof n?_:new n(function(v){v(_)})}return new(n||(n=Promise))(function(_,v){function D(G){try{L(r.next(G))}catch(te){v(te)}}function N(G){try{L(r.throw(G))}catch(te){v(te)}}function L(G){G.done?_(G.value):l(G.value).then(D,N)}L((r=r.apply(t,e||[])).next())})},TIr={tabWidth:4,useTabs:!0,semi:!0,singleQuote:!0,quoteProps:"as-needed",trailingComma:"all",bracketSpacing:!0,arrowParens:"always",endOfLine:"lf",parser:"typescript"},vis=new Map([["ts","typescript"],["tsx","typescript"],["js","babel"],["jsx","babel"],["json","json"],["json5","json5"],["jsonc","json"],["css","css"],["scss","scss"],["less","less"],["graphql","graphql"],["md","markdown"],["mdx","mdx"],["html","html"],["vue","vue"],["yaml","yaml"],["yml","yaml"]]),CIr=t=>cLt(void 0,void 0,void 0,function*(){var e;let{resolveConfig:n}=yield import("prettier"),r=yield n(t,{editorconfig:!1});(r===null||Object.keys(r).length===0)&&(r=TIr);let l=(e=vis.get((0,Nxt.extname)(t).slice(1)))!==null&&e!==void 0?e:"typescript";return Object.assign(Object.assign({},r),{parser:l})}),POn=(t,e,n)=>cLt(void 0,void 0,void 0,function*(){let r=e.replace(/\/\*\* \*\*\//gm,"");if(!n)return r;try{let{format:l}=yield import("prettier"),_=yield CIr(t);return yield l(r,_)}catch{return r}}),AIr=t=>cLt(void 0,void 0,void 0,function*(){if(t.kind==="createFile"){let e=yield POn(t.newPath,t.newData,t.formatWithPrettier);return Object.assign(Object.assign({},t),{newData:e,formatted:!0})}if(t.kind==="updateFile"){let e=yield POn(t.oldPath,t.newData,t.formatWithPrettier);return t.oldData===e?null:Object.assign(Object.assign({},t),{newData:e,formatted:!0})}return Object.assign(Object.assign({},t),{formatted:!0})}),lLt=t=>cLt(void 0,void 0,void 0,function*(){return(yield Promise.all(t.map(n=>AIr(n)))).filter(JKe)}),DIr=(t,e)=>cLt(void 0,void 0,void 0,function*(){if(e.kind==="createFile"){let n=(0,Nxt.dirname)(e.newPath);return yield t.promises.mkdir(n,{recursive:!0}),t.promises.writeFile(e.newPath,e.newData)}if(e.kind==="deleteFile")return t.promises.unlink(e.oldPath);if(e.kind==="moveFile")return yield t.promises.copyFile(e.oldPath,e.newPath),t.promises.unlink(e.oldPath);if(e.kind==="updateFile")return t.promises.writeFile(e.oldPath,e.newData);if(e.kind==="copyFile"){let n=(0,Nxt.dirname)(e.newPath);return yield t.promises.mkdir(n,{recursive:!0}),t.promises.copyFile(e.oldPath,e.newPath)}}),uLt=(t,e)=>{let n=(0,NOn.createHash)("md5").update(e.kind).update(e.newPath).update(e.newData).digest("base64url"),r=(0,Nxt.extname)(e.newPath);return(0,Nxt.join)(t,`${n}${r}`)},fLt=(t,e)=>{let n=(0,NOn.createHash)("md5").update(e.kind).update(e.oldPath).update(e.newData).digest("base64url"),r=(0,Nxt.extname)(e.oldPath);return(0,Nxt.join)(t,`${n}${r}`)},kIr=(t,e,n)=>cLt(void 0,void 0,void 0,function*(){if(n.kind==="createFile"){let r=uLt(e,n);yield t.promises.writeFile(r,n.newData)}if(n.kind==="updateFile"){let r=fLt(e,n);yield t.promises.writeFile(r,n.newData)}}),pLt=(t,e,n)=>e.dryRun===!0?kIr(t,e.outputDirectoryPath,n):DIr(t,n)});var wIr=Ma(()=>{"use strict"});var IIr,xis,bis,PIr,NIr=Ma(()=>{"use strict";IIr=require("node:fs");MGe();xis=MY([pk("jscodeshift"),pk("filemod"),pk("ts-morph"),pk("ast-grep"),pk("workflow")]),bis=oR({_:gme(vD()),source:jO(vD()),engine:jO(xis)}),PIr=t=>{var e,n;let r=Mle(bis,t);if(r._.includes("runOnPreCommit"))return{kind:"runOnPreCommit"};let l=r._.at(0);if(!l)throw new Error("Codemod to run was not specified!");return(0,IIr.existsSync)(l)||r.source?{kind:"runSourced",source:(e=r.source)!==null&&e!==void 0?e:l,engine:(n=r.engine)!==null&&n!==void 0?n:null}:{kind:"runNamed",name:l}}});var OIr,HGt,Sis,OOn,LOn,ROn,MOn,FOn,LIr,RIr,Eis,MIr,BOn=Ma(()=>{"use strict";OIr=require("node:path");ITe();MGe();HGt=["**/node_modules/**/*.*","**/*.d.ts","**/.next/**/*.*","**/dist/**/*.*","**/build/**/*.*"],Sis=process.cwd(),OOn=!0,LOn=!0,ROn=!0,MOn=!1,FOn=4,LIr=!1,RIr=!0,Eis=oR({_:gme(vD()),include:jO(gme(vD())),exclude:jO(gme(vD())),target:jO(vD()),files:jO(gme(vD())),format:jO(h4e(),OOn),cache:jO(h4e(),LOn),install:jO(h4e(),ROn),json:jO(h4e(),MOn),threads:jO(J8t([bcr(0)]),FOn)}),MIr=(t,e)=>{var n,r;let l=Mle(Eis,t),_=l._.at(1),v=l.target,D;return _&&v?(e.printConsoleMessage("info",bm.yellow("Both positional and argument target options are passed. Defaulting to the argument target option...")),D=v):D=(n=_??v)!==null&&n!==void 0?n:Sis,Object.assign(Object.assign({},l),{target:(0,OIr.resolve)(D),exclude:((r=l.exclude)!==null&&r!==void 0?r:[]).concat(HGt)})}});var FIr,BIr,Tis,jIr,WIr=Ma(()=>{"use strict";FIr=require("node:crypto"),BIr=require("node:path");MGe();Tis=MY([oR({dry:jO(pk(!1),!1)}),oR({dry:pk(!0),output:jO(vD())})]),jIr=(t,e)=>{let n=(0,FIr.randomBytes)(20);return Mle(Tis,e).dry===!1?{dryRun:!1,caseHashDigest:n}:{dryRun:!0,streamingEnabled:!0,outputDirectoryPath:(0,BIr.join)(t,".codemod","cases",n.toString("base64url")),caseHashDigest:n}}});var UIr=nn((v0o,GIr)=>{var Cis=Object.prototype.toString,jOn=typeof Buffer<"u"&&typeof Buffer.alloc=="function"&&typeof Buffer.allocUnsafe=="function"&&typeof Buffer.from=="function";function Ais(t){return Cis.call(t).slice(8,-1)==="ArrayBuffer"}function Dis(t,e,n){e>>>=0;var r=t.byteLength-e;if(r<0)throw new RangeError("'offset' is out of bounds");if(n===void 0)n=r;else if(n>>>=0,n>r)throw new RangeError("'length' is out of bounds");return jOn?Buffer.from(t.slice(e,e+n)):new Buffer(new Uint8Array(t.slice(e,e+n)))}function kis(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!Buffer.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');return jOn?Buffer.from(t,e):new Buffer(t,e)}function wis(t,e,n){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return Ais(t)?Dis(t,e,n):typeof t=="string"?kis(t,e):jOn?Buffer.from(t):new Buffer(t)}GIr.exports=wis});var $Gt=nn((JNt,VOn)=>{var Iis=FYt().SourceMapConsumer,WOn=require("path"),Oxt;try{Oxt=require("fs"),(!Oxt.existsSync||!Oxt.readFileSync)&&(Oxt=null)}catch{}var Pis=UIr();function VIr(t,e){return t.require(e)}var zIr=!1,qIr=!1,GOn=!1,JGt="auto",HNt={},KGt={},Nis=/^data:application\/json[^,]+base64,/,xDt=[],bDt=[];function zOn(){return JGt==="browser"?!0:JGt==="node"?!1:typeof window<"u"&&typeof XMLHttpRequest=="function"&&!(window.require&&window.module&&window.process&&window.process.type==="renderer")}function Ois(){return typeof process=="object"&&process!==null&&typeof process.on=="function"}function Lis(){return typeof process=="object"&&process!==null?process.version:""}function Ris(){if(typeof process=="object"&&process!==null)return process.stderr}function Mis(t){if(typeof process=="object"&&process!==null&&typeof process.exit=="function")return process.exit(t)}function Wtn(t){return function(e){for(var n=0;n<t.length;n++){var r=t[n](e);if(r)return r}return null}}var qOn=Wtn(xDt);xDt.push(function(t){if(t=t.trim(),/^file:/.test(t)&&(t=t.replace(/file:\/\/\/(\w:)?/,function(r,l){return l?"":"/"})),t in HNt)return HNt[t];var e="";try{if(Oxt)Oxt.existsSync(t)&&(e=Oxt.readFileSync(t,"utf8"));else{var n=new XMLHttpRequest;n.open("GET",t,!1),n.send(null),n.readyState===4&&n.status===200&&(e=n.responseText)}}catch{}return HNt[t]=e});function UOn(t,e){if(!t)return e;var n=WOn.dirname(t),r=/^\w+:\/\/[^\/]*/.exec(n),l=r?r[0]:"",_=n.slice(l.length);return l&&/^\/\w\:/.test(_)?(l+="/",l+WOn.resolve(n.slice(l.length),e).replace(/\\/g,"/")):l+WOn.resolve(n.slice(l.length),e)}function Fis(t){var e;if(zOn())try{var n=new XMLHttpRequest;n.open("GET",t,!1),n.send(null),e=n.readyState===4?n.responseText:null;var r=n.getResponseHeader("SourceMap")||n.getResponseHeader("X-SourceMap");if(r)return r}catch{}e=qOn(t);for(var l=/(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg,_,v;v=l.exec(e);)_=v;return _?_[1]:null}var HOn=Wtn(bDt);bDt.push(function(t){var e=Fis(t);if(!e)return null;var n;if(Nis.test(e)){var r=e.slice(e.indexOf(",")+1);n=Pis(r,"base64").toString(),e=t}else e=UOn(t,e),n=qOn(e);return n?{url:e,map:n}:null});function JOn(t){var e=KGt[t.source];if(!e){var n=HOn(t.source);n?(e=KGt[t.source]={url:n.url,map:new Iis(n.map)},e.map.sourcesContent&&e.map.sources.forEach(function(l,_){var v=e.map.sourcesContent[_];if(v){var D=UOn(e.url,l);HNt[D]=v}})):e=KGt[t.source]={url:null,map:null}}if(e&&e.map&&typeof e.map.originalPositionFor=="function"){var r=e.map.originalPositionFor(t);if(r.source!==null)return r.source=UOn(e.url,r.source),r}return t}function JIr(t){var e=/^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(t);if(e){var n=JOn({source:e[2],line:+e[3],column:e[4]-1});return"eval at "+e[1]+" ("+n.source+":"+n.line+":"+(n.column+1)+")"}return e=/^eval at ([^(]+) \((.+)\)$/.exec(t),e?"eval at "+e[1]+" ("+JIr(e[2])+")":t}function Bis(){var t,e="";if(this.isNative())e="native";else{t=this.getScriptNameOrSourceURL(),!t&&this.isEval()&&(e=this.getEvalOrigin(),e+=", "),t?e+=t:e+="<anonymous>";var n=this.getLineNumber();if(n!=null){e+=":"+n;var r=this.getColumnNumber();r&&(e+=":"+r)}}var l="",_=this.getFunctionName(),v=!0,D=this.isConstructor(),N=!(this.isToplevel()||D);if(N){var L=this.getTypeName();L==="[object Object]"&&(L="null");var G=this.getMethodName();_?(L&&_.indexOf(L)!=0&&(l+=L+"."),l+=_,G&&_.indexOf("."+G)!=_.length-G.length-1&&(l+=" [as "+G+"]")):l+=L+"."+(G||"<anonymous>")}else D?l+="new "+(_||"<anonymous>"):_?l+=_:(l+=e,v=!1);return v&&(l+=" ("+e+")"),l}function HIr(t){var e={};return Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(function(n){e[n]=/^(?:is|get)/.test(n)?function(){return t[n].call(t)}:t[n]}),e.toString=Bis,e}function KIr(t,e){if(e===void 0&&(e={nextPosition:null,curPosition:null}),t.isNative())return e.curPosition=null,t;var n=t.getFileName()||t.getScriptNameOrSourceURL();if(n){var r=t.getLineNumber(),l=t.getColumnNumber()-1,_=/^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/,v=_.test(Lis())?0:62;r===1&&l>v&&!zOn()&&!t.isEval()&&(l-=v);var D=JOn({source:n,line:r,column:l});e.curPosition=D,t=HIr(t);var N=t.getFunctionName;return t.getFunctionName=function(){return e.nextPosition==null?N():e.nextPosition.name||N()},t.getFileName=function(){return D.source},t.getLineNumber=function(){return D.line},t.getColumnNumber=function(){return D.column+1},t.getScriptNameOrSourceURL=function(){return D.source},t}var L=t.isEval()&&t.getEvalOrigin();return L&&(L=JIr(L),t=HIr(t),t.getEvalOrigin=function(){return L}),t}function jis(t,e){GOn&&(HNt={},KGt={});for(var n=t.name||"Error",r=t.message||"",l=n+": "+r,_={nextPosition:null,curPosition:null},v=[],D=e.length-1;D>=0;D--)v.push(`
|
|
825
825
|
at `+KIr(e[D],_)),_.nextPosition=_.curPosition;return _.curPosition=_.nextPosition=null,l+v.reverse().join("")}function $Ir(t){var e=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(t.stack);if(e){var n=e[1],r=+e[2],l=+e[3],_=HNt[n];if(!_&&Oxt&&Oxt.existsSync(n))try{_=Oxt.readFileSync(n,"utf8")}catch{_=""}if(_){var v=_.split(/(?:\r\n|\r|\n)/)[r-1];if(v)return n+":"+r+`
|
|
826
826
|
`+v+`
|
|
827
827
|
`+new Array(l).join(" ")+"^"}}return null}function Wis(t){var e=$Ir(t),n=Ris();n&&n._handle&&n._handle.setBlocking&&n._handle.setBlocking(!0),e&&(console.error(),console.error(e)),console.error(t.stack),Mis(1)}function Gis(){var t=process.emit;process.emit=function(e){if(e==="uncaughtException"){var n=arguments[1]&&arguments[1].stack,r=this.listeners(e).length>0;if(n&&!r)return Wis(arguments[1])}return t.apply(this,arguments)}}var Uis=xDt.slice(0),Vis=bDt.slice(0);JNt.wrapCallSite=KIr;JNt.getErrorSource=$Ir;JNt.mapSourcePosition=JOn;JNt.retrieveSourceMap=HOn;JNt.install=function(t){if(t=t||{},t.environment&&(JGt=t.environment,["node","browser","auto"].indexOf(JGt)===-1))throw new Error("environment "+JGt+" was unknown. Available options are {auto, browser, node}");if(t.retrieveFile&&(t.overrideRetrieveFile&&(xDt.length=0),xDt.unshift(t.retrieveFile)),t.retrieveSourceMap&&(t.overrideRetrieveSourceMap&&(bDt.length=0),bDt.unshift(t.retrieveSourceMap)),t.hookRequire&&!zOn()){var e=VIr(VOn,"module"),n=e.prototype._compile;n.__sourceMapSupport||(e.prototype._compile=function(_,v){return HNt[v]=_,KGt[v]=void 0,n.call(this,_,v)},e.prototype._compile.__sourceMapSupport=!0)}if(GOn||(GOn="emptyCacheBetweenOperations"in t?t.emptyCacheBetweenOperations:!1),zIr||(zIr=!0,Error.prepareStackTrace=jis),!qIr){var r="handleUncaughtExceptions"in t?t.handleUncaughtExceptions:!0;try{var l=VIr(VOn,"worker_threads");l.isMainThread===!1&&(r=!1)}catch{}r&&Ois()&&(qIr=!0,Gis())}};JNt.resetRetrieveHandlers=function(){xDt.length=0,bDt.length=0,xDt=Uis.slice(0),bDt=Vis.slice(0),HOn=Wtn(bDt),qOn=Wtn(xDt)}});var rPr=nn((x0o,XGt)=>{"use strict";/*! *****************************************************************************
|
|
@@ -55246,4 +55246,4 @@ ${L}`;t.printOperationMessage({kind:"error",message:G});return}t.printConsoleMes
|
|
|
55246
55246
|
`,bm.bold(`- ${xIr(e).join(`
|
|
55247
55247
|
- `)}`)))}});var dIi={};aAt(dIi,{executeMainThread:()=>eto});var rar,Zeo,cft,eto,_Ii=Ma(()=>{"use strict";ITe();mCr();Ble();dDt();rar=Dx(z8n(),1);iIr();sIr();aIr();EIr();gli();xli();Qtr();pDi();SDi();LDi();MDi();WDi();cIi();uIi();pIi();Zeo=async()=>{try{let t=(await yae("npm view codemod version",{timeout:3e3})).stdout.trim(),e=rar.default.coerce(t)?.version;e&&rar.default.gt(e,Mtn)&&console.log(U8t(bm("Update available",bm.dim(Mtn),">",bm.green(e),`
|
|
55248
55248
|
|
|
55249
|
-
Run`,bm.bold.cyan(hz("npm i -g codemod@latest")),"to upgrade"),{padding:1,textAlignment:"center",borderColor:"yellowBright",borderStyle:"round"}))}catch{}},cft=async t=>{let e=typeof t.clientIdentifier=="string"?t.clientIdentifier:"CLI";S4e.interceptors.request.use(v=>(v.headers["X-Client-Identifier"]=e,v));let n=new HBt(t.json),r=t.telemetry?new vGt({cloudRole:e,distinctId:await SIr()}):new xGt,l=async()=>{await r.dispose(),process.exit(0)};return{printer:n,telemetryService:r,exit:l,executeCliCommand:async v=>{try{await v()}catch(D){if(!(D instanceof Error))return;n.printOperationMessage({kind:"error",message:D.message})}l()}}},eto=async()=>{await Zeo();let t=tOn(process.argv),e=hli(rIr(t).help().version(!1));if(e.scriptName("codemod").usage("Usage: <command> [options]").command("*","runs a codemod or recipe",r=>$Yn(r),async r=>{let{printer:l,telemetryService:_,executeCliCommand:v}=await cft(r);return v(()=>nar(l,r,_))}).command("runOnPreCommit [files...]","run pre-commit codemods against staged files passed positionally",r=>$Yn(r),async r=>{let{executeCliCommand:l,printer:_,telemetryService:v}=await cft(r);return l(()=>nar(_,r,v))}).command(["list","ls","search"],"lists all the codemods & recipes in the public registry. can be used to search by name and tags",r=>r,async r=>{let l=r._.length>1?String(r._.at(-1)):null;if(l&&l.length<2)throw new Error("Search term must be at least 2 characters long. Aborting...");let{executeCliCommand:_,printer:v}=await cft(r);return _(()=>bDi(v,l))}).command("learn","exports the current `git diff` in a file to before/after panels in the Codemod Studio",r=>r.option("target",{alias:"t",type:"string",description:"path to the file to be learned"}),async r=>{let{executeCliCommand:l,printer:_}=await cft(r);return l(()=>fDi(_,r.target??null))}).command("login","logs in through authentication in the Codemod Studio",r=>r,async r=>{let{executeCliCommand:l,printer:_}=await cft(r);return l(()=>ODi(_))}).command("logout","logs out",r=>r,async r=>{let{executeCliCommand:l,printer:_}=await cft(r);return l(()=>RDi(_))}).command("whoami","prints the user data of currently logged in user",r=>r,async r=>{let{executeCliCommand:l,printer:_}=await cft(r);return l(()=>fIi(_))}).command("build","build the JavaScript engine codemod",r=>r.option("source",{alias:"s",type:"string",description:"path to the codemod to be built"}),async r=>{let{executeCliCommand:l,printer:_}=await cft(r);return l(()=>vli(_,r.source??process.cwd()))}).command("publish","publish the codemod to Codemod Registry",r=>r.option("source",{type:"string",description:"path to the codemod to be published"}),async r=>{let{executeCliCommand:l,printer:_}=await cft(r);return l(()=>jDi(_,r.source??process.cwd()))}).command("unpublish","unpublish previously published codemod from Codemod Registry",r=>r.option("force",{type:"boolean",alias:"f",boolean:!0,description:"whether to remove all versions"}),async r=>{let l=r._.length>1?String(r._.at(-1)):null,{executeCliCommand:_,printer:v,exit:D}=await cft(r);return l?_(()=>lIi(v,l,r.force)):(v.printOperationMessage({kind:"error",message:"You must provide the name of the codemod to unpublish. Aborting..."}),D())}).command("init","initialize a codemod package",r=>r.option("target",{alias:"t",type:"string",description:"Path to init codemod in",default:process.cwd()}).option("no-prompt",{alias:"y",type:"boolean",description:"skip all prompts and use default values"}),async r=>{let{executeCliCommand:l,printer:_}=await cft(r);return l(()=>Nxn({printer:_,noPrompt:r.noPrompt,target:r.target}))}),t.length===0)return e.showHelp();let n=await e.parse();
|
|
55249
|
+
Run`,bm.bold.cyan(hz("npm i -g codemod@latest")),"to upgrade"),{padding:1,textAlignment:"center",borderColor:"yellowBright",borderStyle:"round"}))}catch{}},cft=async t=>{let e=typeof t.clientIdentifier=="string"?t.clientIdentifier:"CLI";S4e.interceptors.request.use(v=>(v.headers["X-Client-Identifier"]=e,v));let n=new HBt(t.json),r=t.telemetry?new vGt({cloudRole:e,distinctId:await SIr()}):new xGt,l=async()=>{await r.dispose(),process.exit(0)};return{printer:n,telemetryService:r,exit:l,executeCliCommand:async v=>{try{await v()}catch(D){if(!(D instanceof Error))return;n.printOperationMessage({kind:"error",message:D.message})}l()}}},eto=async()=>{await Zeo();let t=tOn(process.argv),e=hli(rIr(t).help().version(!1));if(t.includes("--version")||t.includes("-v"))return console.log(Mtn);if(e.scriptName("codemod").usage("Usage: <command> [options]").command("*","runs a codemod or recipe",r=>$Yn(r),async r=>{let{printer:l,telemetryService:_,executeCliCommand:v}=await cft(r);return v(()=>nar(l,r,_))}).command("runOnPreCommit [files...]","run pre-commit codemods against staged files passed positionally",r=>$Yn(r),async r=>{let{executeCliCommand:l,printer:_,telemetryService:v}=await cft(r);return l(()=>nar(_,r,v))}).command(["list","ls","search"],"lists all the codemods & recipes in the public registry. can be used to search by name and tags",r=>r,async r=>{let l=r._.length>1?String(r._.at(-1)):null;if(l&&l.length<2)throw new Error("Search term must be at least 2 characters long. Aborting...");let{executeCliCommand:_,printer:v}=await cft(r);return _(()=>bDi(v,l))}).command("learn","exports the current `git diff` in a file to before/after panels in the Codemod Studio",r=>r.option("target",{alias:"t",type:"string",description:"path to the file to be learned"}),async r=>{let{executeCliCommand:l,printer:_}=await cft(r);return l(()=>fDi(_,r.target??null))}).command("login","logs in through authentication in the Codemod Studio",r=>r,async r=>{let{executeCliCommand:l,printer:_}=await cft(r);return l(()=>ODi(_))}).command("logout","logs out",r=>r,async r=>{let{executeCliCommand:l,printer:_}=await cft(r);return l(()=>RDi(_))}).command("whoami","prints the user data of currently logged in user",r=>r,async r=>{let{executeCliCommand:l,printer:_}=await cft(r);return l(()=>fIi(_))}).command("build","build the JavaScript engine codemod",r=>r.option("source",{alias:"s",type:"string",description:"path to the codemod to be built"}),async r=>{let{executeCliCommand:l,printer:_}=await cft(r);return l(()=>vli(_,r.source??process.cwd()))}).command("publish","publish the codemod to Codemod Registry",r=>r.option("source",{type:"string",description:"path to the codemod to be published"}),async r=>{let{executeCliCommand:l,printer:_}=await cft(r);return l(()=>jDi(_,r.source??process.cwd()))}).command("unpublish","unpublish previously published codemod from Codemod Registry",r=>r.option("force",{type:"boolean",alias:"f",boolean:!0,description:"whether to remove all versions"}),async r=>{let l=r._.length>1?String(r._.at(-1)):null,{executeCliCommand:_,printer:v,exit:D}=await cft(r);return l?_(()=>lIi(v,l,r.force)):(v.printOperationMessage({kind:"error",message:"You must provide the name of the codemod to unpublish. Aborting..."}),D())}).command("init","initialize a codemod package",r=>r.option("target",{alias:"t",type:"string",description:"Path to init codemod in",default:process.cwd()}).option("no-prompt",{alias:"y",type:"boolean",description:"skip all prompts and use default values"}),async r=>{let{executeCliCommand:l,printer:_}=await cft(r);return l(()=>Nxn({printer:_,noPrompt:r.noPrompt,target:r.target}))}),t.length===0)return e.showHelp();let n=await e.parse();{let{exit:r}=await cft(n);process.on("SIGINT",r)}}});var gIi={};aAt(gIi,{executeWorkerThread:()=>tto});var hBt,ATn,mIi,ort,hIi,tto,yIi=Ma(()=>{"use strict";hBt=require("node:worker_threads");ITe();AJt();ATn=class extends Error{constructor(n,r){super(r);this.path=n}},mIi=(t,e)=>{hBt.parentPort?.postMessage({kind:"console",consoleKind:t,message:e})},ort=null,hIi=async t=>{try{let e;try{e=nEr(t)}catch(n){throw new Error(`Failed to decode message: ${String(n)}`)}if(e.kind==="initialization"){ort=e;return}if(e.kind==="exit"){hBt.parentPort?.off("message",hIi);return}if(ort===null)throw new Error;try{let n=[];switch(ort.codemodEngine){case"jscodeshift":n=lli(ort.codemodSource,e.path,e.data,ort.enablePrettier,ort.safeArgumentRecord,ort.engineOptions,mIi);break;case"ts-morph":n=_li(ort.codemodSource,e.path,e.data,ort.enablePrettier,ort.safeArgumentRecord,mIi);break;case"ast-grep":n=await GOr(ort.codemodPath,e.path,e.data,ort.enablePrettier);break;case"workflow":throw new Error("Workflow engine is not supported in worker threads");default:throw new Error(`Unknown codemod engine: ${ort.codemodEngine}`)}let r=await lLt(n);hBt.parentPort?.postMessage({kind:"commands",commands:r,path:e.path})}catch(n){throw new ATn(e.path,n instanceof Error?n.message:String(n))}}catch(e){hBt.parentPort?.postMessage({kind:"error",message:e instanceof Error?e.message:String(e),path:e instanceof ATn?e.path:void 0})}},tto=()=>{hBt.parentPort?.on("message",hIi)}});var vIi=require("node:worker_threads");vIi.isMainThread?Promise.resolve().then(()=>(_Ii(),dIi)).then(({executeMainThread:t})=>t()).catch(t=>{t instanceof Error&&console.error(JSON.stringify({message:t.message}))}):Promise.resolve().then(()=>(yIi(),gIi)).then(({executeWorkerThread:t})=>t());
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codemod",
|
|
3
3
|
"author": "Codemod, Inc.",
|
|
4
|
-
"version": "0.11.
|
|
4
|
+
"version": "0.11.1",
|
|
5
5
|
"description": "A codemod engine for Node.js libraries (jscodeshift, ts-morph, etc.)",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": null,
|
|
@@ -55,11 +55,11 @@
|
|
|
55
55
|
"vitest": "^1.0.1",
|
|
56
56
|
"yargs": "^17.6.2",
|
|
57
57
|
"@codemod-com/filemod": "2.0.3",
|
|
58
|
-
"@codemod-com/runner": "1.0.1",
|
|
59
58
|
"@codemod-com/printer": "1.0.1",
|
|
60
|
-
"@codemod-com/
|
|
59
|
+
"@codemod-com/runner": "1.0.1",
|
|
61
60
|
"@codemod-com/utilities": "1.1.4",
|
|
62
|
-
"@codemod.com/workflow": "0.0.2"
|
|
61
|
+
"@codemod.com/workflow": "0.0.2",
|
|
62
|
+
"@codemod-com/telemetry": "1.1.0"
|
|
63
63
|
},
|
|
64
64
|
"engines": {
|
|
65
65
|
"node": ">=18.5.0"
|