codemod 0.11.4 → 0.11.5
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 +3 -3
- package/package.json +18 -21
- package/LICENSE +0 -201
package/dist/index.cjs
CHANGED
|
@@ -796,7 +796,7 @@ ${Se.join(`
|
|
|
796
796
|
`;oe.forEach(Se=>{ue+=Se}),e.fail(ue)}};let O={};_.conflicts=function(Z,oe){Ow("<string|object> [array|string]",[Z,oe],arguments.length),typeof Z=="object"?Object.keys(Z).forEach(ue=>{_.conflicts(ue,Z[ue])}):(t.global(Z),O[Z]||(O[Z]=[]),Array.isArray(oe)?oe.forEach(ue=>_.conflicts(Z,ue)):O[Z].push(oe))},_.getConflicting=()=>O,_.conflicting=function(Z){Object.keys(Z).forEach(oe=>{O[oe]&&O[oe].forEach(ue=>{ue&&Z[oe]!==void 0&&Z[ue]!==void 0&&e.fail(r("Arguments %s and %s are mutually exclusive",oe,ue))})}),t.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(O).forEach(oe=>{O[oe].forEach(ue=>{ue&&Z[n.Parser.camelCase(oe)]!==void 0&&Z[n.Parser.camelCase(ue)]!==void 0&&e.fail(r("Arguments %s and %s are mutually exclusive",oe,ue))})})},_.recommendCommands=function(Z,oe){oe=oe.sort((Me,ze)=>ze.length-Me.length);let Se=null,ye=1/0;for(let Me=0,ze;(ze=oe[Me])!==void 0;Me++){let it=tPr(Z,ze);it<=3&&it<ye&&(ye=it,Se=ze)}Se&&e.fail(r("Did you mean %s?",Se))},_.reset=function(Z){return y=ODt(y,oe=>!Z[oe]),O=ODt(O,oe=>!Z[oe]),_};let L=[];return _.freeze=function(){L.push({implied:y,conflicting:O})},_.unfreeze=function(){let Z=L.pop();tUe(Z,void 0,n),{implied:y,conflicting:O}=Z},_}var rPr,sPr=za(()=>{wnn();FLt();nPr();Nnn();rPr=["$0","--","_"]});function kUt(t,e,n,r){DUt=r;let u={};if(Object.prototype.hasOwnProperty.call(t,"extends")){if(typeof t.extends!="string")return u;let _=/\.json|\..*rc$/.test(t.extends),y=null;if(_)y=Mos(e,t.extends);else try{y=require.resolve(t.extends)}catch{return t}Ros(y),Y7n.push(y),u=_?JSON.parse(DUt.readFileSync(y,"utf8")):require(t.extends),delete t.extends,u=kUt(u,DUt.path.dirname(y),n,DUt)}return Y7n=[],n?aPr(u,t):Object.assign({},u,t)}function Ros(t){if(Y7n.indexOf(t)>-1)throw new jte(`Circular extended configurations: '${t}'.`)}function Mos(t,e){return DUt.path.resolve(t,e)}function aPr(t,e){let n={};function r(u){return u&&typeof u=="object"&&!Array.isArray(u)}Object.assign(n,t);for(let u of Object.keys(e))r(e[u])&&r(n[u])?n[u]=aPr(t[u],e[u]):n[u]=e[u];return n}var Y7n,DUt,Q7n=za(()=>{LLt();Y7n=[]});function APr(t){return(e=[],n=t.process.cwd(),r)=>{let u=new lLn(e,n,r,t);return Object.defineProperty(u,"argv",{get:()=>u.parse(),enumerable:!0}),u.help(),u.version(),u}}function HIr(t){return!!t&&typeof t.getInternalMethods=="function"}var Vw,Cf,vye,f6t,wUt,_ut,Ont,Lnn,RDt,p6t,Rnn,mut,Mnn,hut,U1t,Lnt,gut,Fnn,WLt,Fwe,hN,Bnn,jnn,Rnt,d6t,GLt,_6t,MDt,Wnn,jO,m6t,h6t,g6t,PL,Gnn,V1t,Dme,oPr,cPr,Z7n,lPr,uPr,fPr,y6t,pPr,eLn,dPr,_Pr,tLn,FDt,ULt,nLn,rLn,iLn,sLn,aLn,mPr,hPr,gPr,yPr,vPr,xPr,bPr,SPr,Unn,EPr,v6t,TPr,oLn,IUt,cLn,CPr,x6t,lLn,J7n=za(()=>{H7n();FLt();LLt();$Ir();wnn();ePr();sPr();Nnn();Q7n();U7n();BLt();V7n();K7n();Vw=function(t,e,n,r,u){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!u)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!u:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?u.call(t,n):u?u.value=n:e.set(t,n),n},Cf=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)};oPr=Symbol("copyDoubleDash"),cPr=Symbol("copyDoubleDash"),Z7n=Symbol("deleteFromParserHintObject"),lPr=Symbol("emitWarning"),uPr=Symbol("freeze"),fPr=Symbol("getDollarZero"),y6t=Symbol("getParserConfiguration"),pPr=Symbol("getUsageConfiguration"),eLn=Symbol("guessLocale"),dPr=Symbol("guessVersion"),_Pr=Symbol("parsePositionalNumbers"),tLn=Symbol("pkgUp"),FDt=Symbol("populateParserHintArray"),ULt=Symbol("populateParserHintSingleValueDictionary"),nLn=Symbol("populateParserHintArrayDictionary"),rLn=Symbol("populateParserHintDictionary"),iLn=Symbol("sanitizeKey"),sLn=Symbol("setKey"),aLn=Symbol("unfreeze"),mPr=Symbol("validateAsync"),hPr=Symbol("getCommandInstance"),gPr=Symbol("getContext"),yPr=Symbol("getHasOutput"),vPr=Symbol("getLoggerInstance"),xPr=Symbol("getParseContext"),bPr=Symbol("getUsageInstance"),SPr=Symbol("getValidationInstance"),Unn=Symbol("hasParseCallback"),EPr=Symbol("isGlobalContext"),v6t=Symbol("postProcess"),TPr=Symbol("rebase"),oLn=Symbol("reset"),IUt=Symbol("runYargsParserAndExecuteCommands"),cLn=Symbol("runValidation"),CPr=Symbol("setHasOutput"),x6t=Symbol("kTrackManuallySetKeys"),lLn=class{constructor(e=[],n,r,u){this.customScriptName=!1,this.parsed=!1,vye.set(this,void 0),f6t.set(this,void 0),wUt.set(this,{commands:[],fullCommands:[]}),_ut.set(this,null),Ont.set(this,null),Lnn.set(this,"show-hidden"),RDt.set(this,null),p6t.set(this,!0),Rnn.set(this,{}),mut.set(this,!0),Mnn.set(this,[]),hut.set(this,void 0),U1t.set(this,{}),Lnt.set(this,!1),gut.set(this,null),Fnn.set(this,!0),WLt.set(this,void 0),Fwe.set(this,""),hN.set(this,void 0),Bnn.set(this,void 0),jnn.set(this,{}),Rnt.set(this,null),d6t.set(this,null),GLt.set(this,{}),_6t.set(this,{}),MDt.set(this,void 0),Wnn.set(this,!1),jO.set(this,void 0),m6t.set(this,!1),h6t.set(this,!1),g6t.set(this,!1),PL.set(this,void 0),Gnn.set(this,{}),V1t.set(this,null),Dme.set(this,void 0),Vw(this,jO,u,"f"),Vw(this,MDt,e,"f"),Vw(this,f6t,n,"f"),Vw(this,Bnn,r,"f"),Vw(this,hut,new Inn(this),"f"),this.$0=this[fPr](),this[oLn](),Vw(this,vye,Cf(this,vye,"f"),"f"),Vw(this,PL,Cf(this,PL,"f"),"f"),Vw(this,Dme,Cf(this,Dme,"f"),"f"),Vw(this,hN,Cf(this,hN,"f"),"f"),Cf(this,hN,"f").showHiddenOpt=Cf(this,Lnn,"f"),Vw(this,WLt,this[cPr](),"f")}addHelpOpt(e,n){let r="help";return Ow("[string|boolean] [string]",[e,n],arguments.length),Cf(this,gut,"f")&&(this[Z7n](Cf(this,gut,"f")),Vw(this,gut,null,"f")),e===!1&&n===void 0?this:(Vw(this,gut,typeof e=="string"?e:r,"f"),this.boolean(Cf(this,gut,"f")),this.describe(Cf(this,gut,"f"),n||Cf(this,PL,"f").deferY18nLookup("Show help")),this)}help(e,n){return this.addHelpOpt(e,n)}addShowHiddenOpt(e,n){if(Ow("[string|boolean] [string]",[e,n],arguments.length),e===!1&&n===void 0)return this;let r=typeof e=="string"?e:Cf(this,Lnn,"f");return this.boolean(r),this.describe(r,n||Cf(this,PL,"f").deferY18nLookup("Show hidden options")),Cf(this,hN,"f").showHiddenOpt=r,this}showHidden(e,n){return this.addShowHiddenOpt(e,n)}alias(e,n){return Ow("<object|string|array> [string|array]",[e,n],arguments.length),this[nLn](this.alias.bind(this),"alias",e,n),this}array(e){return Ow("<array|string>",[e],arguments.length),this[FDt]("array",e),this[x6t](e),this}boolean(e){return Ow("<array|string>",[e],arguments.length),this[FDt]("boolean",e),this[x6t](e),this}check(e,n){return Ow("<function> [boolean]",[e,n],arguments.length),this.middleware((r,u)=>u6t(()=>e(r,u.getOptions()),_=>(_?(typeof _=="string"||_ instanceof Error)&&Cf(this,PL,"f").fail(_.toString(),_):Cf(this,PL,"f").fail(Cf(this,jO,"f").y18n.__("Argument check failed: %s",e.toString())),r),_=>(Cf(this,PL,"f").fail(_.message?_.message:_.toString(),_),r)),!1,n),this}choices(e,n){return Ow("<object|string|array> [string|array]",[e,n],arguments.length),this[nLn](this.choices.bind(this),"choices",e,n),this}coerce(e,n){if(Ow("<object|string|array> [function]",[e,n],arguments.length),Array.isArray(e)){if(!n)throw new jte("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 jte("coerce callback must be provided");return Cf(this,hN,"f").key[e]=!0,Cf(this,hut,"f").addCoerceMiddleware((r,u)=>{let _;return Object.prototype.hasOwnProperty.call(r,e)?u6t(()=>(_=u.getAliases(),n(r[e])),k=>{r[e]=k;let O=u.getInternalMethods().getParserConfiguration()["strip-aliased"];if(_[e]&&O!==!0)for(let L of _[e])r[L]=k;return r},k=>{throw new jte(k.message)}):r},e),this}conflicts(e,n){return Ow("<string|object> [string|array]",[e,n],arguments.length),Cf(this,Dme,"f").conflicts(e,n),this}config(e="config",n,r){return Ow("[object|string] [string|function] [function]",[e,n,r],arguments.length),typeof e=="object"&&!Array.isArray(e)?(e=kUt(e,Cf(this,f6t,"f"),this[y6t]()["deep-merge-config"]||!1,Cf(this,jO,"f")),Cf(this,hN,"f").configObjects=(Cf(this,hN,"f").configObjects||[]).concat(e),this):(typeof n=="function"&&(r=n,n=void 0),this.describe(e,n||Cf(this,PL,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(e)?e:[e]).forEach(u=>{Cf(this,hN,"f").config[u]=r||!0}),this)}completion(e,n,r){return Ow("[string] [string|boolean|function] [function]",[e,n,r],arguments.length),typeof n=="function"&&(r=n,n=void 0),Vw(this,Ont,e||Cf(this,Ont,"f")||"completion","f"),!n&&n!==!1&&(n="generate completion script"),this.command(Cf(this,Ont,"f"),n),r&&Cf(this,_ut,"f").registerFunction(r),this}command(e,n,r,u,_,y){return Ow("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[e,n,r,u,_,y],arguments.length),Cf(this,vye,"f").addHandler(e,n,r,u,_,y),this}commands(e,n,r,u,_,y){return this.command(e,n,r,u,_,y)}commandDir(e,n){Ow("<string> [object]",[e,n],arguments.length);let r=Cf(this,Bnn,"f")||Cf(this,jO,"f").require;return Cf(this,vye,"f").addDirectory(e,r,Cf(this,jO,"f").getCallerFile(),n),this}count(e){return Ow("<array|string>",[e],arguments.length),this[FDt]("count",e),this[x6t](e),this}default(e,n,r){return Ow("<object|string|array> [*] [string]",[e,n,r],arguments.length),r&&(G7n(e,Cf(this,jO,"f")),Cf(this,hN,"f").defaultDescription[e]=r),typeof n=="function"&&(G7n(e,Cf(this,jO,"f")),Cf(this,hN,"f").defaultDescription[e]||(Cf(this,hN,"f").defaultDescription[e]=Cf(this,PL,"f").functionDescription(n)),n=n.call()),this[ULt](this.default.bind(this),"default",e,n),this}defaults(e,n,r){return this.default(e,n,r)}demandCommand(e=1,n,r,u){return Ow("[number] [number|string] [string|null|undefined] [string|null|undefined]",[e,n,r,u],arguments.length),typeof n!="number"&&(r=n,n=1/0),this.global("_",!1),Cf(this,hN,"f").demandedCommands._={min:e,max:n,minMsg:r,maxMsg:u},this}demand(e,n,r){return Array.isArray(n)?(n.forEach(u=>{tUe(r,!0,Cf(this,jO,"f")),this.demandOption(u,r)}),n=1/0):typeof n!="number"&&(r=n,n=1/0),typeof e=="number"?(tUe(r,!0,Cf(this,jO,"f")),this.demandCommand(e,n,r,r)):Array.isArray(e)?e.forEach(u=>{tUe(r,!0,Cf(this,jO,"f")),this.demandOption(u,r)}):typeof r=="string"?this.demandOption(e,r):(r===!0||typeof r>"u")&&this.demandOption(e),this}demandOption(e,n){return Ow("<object|string|array> [string]",[e,n],arguments.length),this[ULt](this.demandOption.bind(this),"demandedOptions",e,n),this}deprecateOption(e,n){return Ow("<string> [string|boolean]",[e,n],arguments.length),Cf(this,hN,"f").deprecatedOptions[e]=n,this}describe(e,n){return Ow("<object|string|array> [string]",[e,n],arguments.length),this[sLn](e,!0),Cf(this,PL,"f").describe(e,n),this}detectLocale(e){return Ow("<boolean>",[e],arguments.length),Vw(this,p6t,e,"f"),this}env(e){return Ow("[string|boolean]",[e],arguments.length),e===!1?delete Cf(this,hN,"f").envPrefix:Cf(this,hN,"f").envPrefix=e||"",this}epilogue(e){return Ow("<string>",[e],arguments.length),Cf(this,PL,"f").epilog(e),this}epilog(e){return this.epilogue(e)}example(e,n){return Ow("<string|array> [string]",[e,n],arguments.length),Array.isArray(e)?e.forEach(r=>this.example(...r)):Cf(this,PL,"f").example(e,n),this}exit(e,n){Vw(this,Lnt,!0,"f"),Vw(this,RDt,n,"f"),Cf(this,mut,"f")&&Cf(this,jO,"f").process.exit(e)}exitProcess(e=!0){return Ow("[boolean]",[e],arguments.length),Vw(this,mut,e,"f"),this}fail(e){if(Ow("<function|boolean>",[e],arguments.length),typeof e=="boolean"&&e!==!1)throw new jte("Invalid first argument. Expected function or boolean 'false'");return Cf(this,PL,"f").failFn(e),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(e,n){return Ow("<array> [function]",[e,n],arguments.length),n?Cf(this,_ut,"f").getCompletion(e,n):new Promise((r,u)=>{Cf(this,_ut,"f").getCompletion(e,(_,y)=>{_?u(_):r(y)})})}getDemandedOptions(){return Ow([],0),Cf(this,hN,"f").demandedOptions}getDemandedCommands(){return Ow([],0),Cf(this,hN,"f").demandedCommands}getDeprecatedOptions(){return Ow([],0),Cf(this,hN,"f").deprecatedOptions}getDetectLocale(){return Cf(this,p6t,"f")}getExitProcess(){return Cf(this,mut,"f")}getGroups(){return Object.assign({},Cf(this,U1t,"f"),Cf(this,_6t,"f"))}getHelp(){if(Vw(this,Lnt,!0,"f"),!Cf(this,PL,"f").hasCachedHelpMessage()){if(!this.parsed){let n=this[IUt](Cf(this,MDt,"f"),void 0,void 0,0,!0);if(kae(n))return n.then(()=>Cf(this,PL,"f").help())}let e=Cf(this,vye,"f").runDefaultBuilderOn(this);if(kae(e))return e.then(()=>Cf(this,PL,"f").help())}return Promise.resolve(Cf(this,PL,"f").help())}getOptions(){return Cf(this,hN,"f")}getStrict(){return Cf(this,m6t,"f")}getStrictCommands(){return Cf(this,h6t,"f")}getStrictOptions(){return Cf(this,g6t,"f")}global(e,n){return Ow("<string|array> [boolean]",[e,n],arguments.length),e=[].concat(e),n!==!1?Cf(this,hN,"f").local=Cf(this,hN,"f").local.filter(r=>e.indexOf(r)===-1):e.forEach(r=>{Cf(this,hN,"f").local.includes(r)||Cf(this,hN,"f").local.push(r)}),this}group(e,n){Ow("<string|array> <string>",[e,n],arguments.length);let r=Cf(this,_6t,"f")[n]||Cf(this,U1t,"f")[n];Cf(this,_6t,"f")[n]&&delete Cf(this,_6t,"f")[n];let u={};return Cf(this,U1t,"f")[n]=(r||[]).concat(e).filter(_=>u[_]?!1:u[_]=!0),this}hide(e){return Ow("<string>",[e],arguments.length),Cf(this,hN,"f").hiddenOptions.push(e),this}implies(e,n){return Ow("<string|object> [number|string|array]",[e,n],arguments.length),Cf(this,Dme,"f").implies(e,n),this}locale(e){return Ow("[string]",[e],arguments.length),e===void 0?(this[eLn](),Cf(this,jO,"f").y18n.getLocale()):(Vw(this,p6t,!1,"f"),Cf(this,jO,"f").y18n.setLocale(e),this)}middleware(e,n,r){return Cf(this,hut,"f").addMiddleware(e,!!n,r)}nargs(e,n){return Ow("<string|object|array> [number]",[e,n],arguments.length),this[ULt](this.nargs.bind(this),"narg",e,n),this}normalize(e){return Ow("<array|string>",[e],arguments.length),this[FDt]("normalize",e),this}number(e){return Ow("<array|string>",[e],arguments.length),this[FDt]("number",e),this[x6t](e),this}option(e,n){if(Ow("<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[x6t](e),Cf(this,V1t,"f")&&(e==="version"||n?.alias==="version")&&this[lPr](['"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(`
|
|
797
797
|
`),void 0,"versionWarning"),Cf(this,hN,"f").key[e]=!0,n.alias&&this.alias(e,n.alias);let r=n.deprecate||n.deprecated;r&&this.deprecateOption(e,r);let u=n.demand||n.required||n.require;u&&this.demand(e,u),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&&(Cf(this,hN,"f").defaultDescription[e]=n.defaultDescription),n.skipValidation&&this.skipValidation(e);let _=n.describe||n.description||n.desc,y=Cf(this,PL,"f").getDescriptions();(!Object.prototype.hasOwnProperty.call(y,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){Ow("[string|array] [function|boolean|object] [function]",[e,n,r],arguments.length),this[uPr](),typeof e>"u"&&(e=Cf(this,MDt,"f")),typeof n=="object"&&(Vw(this,d6t,n,"f"),n=r),typeof n=="function"&&(Vw(this,Rnt,n,"f"),n=!1),n||Vw(this,MDt,e,"f"),Cf(this,Rnt,"f")&&Vw(this,mut,!1,"f");let u=this[IUt](e,!!n),_=this.parsed;return Cf(this,_ut,"f").setParsed(this.parsed),kae(u)?u.then(y=>(Cf(this,Rnt,"f")&&Cf(this,Rnt,"f").call(this,Cf(this,RDt,"f"),y,Cf(this,Fwe,"f")),y)).catch(y=>{throw Cf(this,Rnt,"f")&&Cf(this,Rnt,"f")(y,this.parsed.argv,Cf(this,Fwe,"f")),y}).finally(()=>{this[aLn](),this.parsed=_}):(Cf(this,Rnt,"f")&&Cf(this,Rnt,"f").call(this,Cf(this,RDt,"f"),u,Cf(this,Fwe,"f")),this[aLn](),this.parsed=_,u)}parseAsync(e,n,r){let u=this.parse(e,n,r);return kae(u)?u:Promise.resolve(u)}parseSync(e,n,r){let u=this.parse(e,n,r);if(kae(u))throw new jte(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return u}parserConfiguration(e){return Ow("<object>",[e],arguments.length),Vw(this,jnn,e,"f"),this}pkgConf(e,n){Ow("<string> [string]",[e,n],arguments.length);let r=null,u=this[tLn](n||Cf(this,f6t,"f"));return u[e]&&typeof u[e]=="object"&&(r=kUt(u[e],n||Cf(this,f6t,"f"),this[y6t]()["deep-merge-config"]||!1,Cf(this,jO,"f")),Cf(this,hN,"f").configObjects=(Cf(this,hN,"f").configObjects||[]).concat(r)),this}positional(e,n){Ow("<string> <object>",[e,n],arguments.length);let r=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];n=ODt(n,(y,k)=>y==="type"&&!["string","number","boolean"].includes(k)?!1:r.includes(y));let u=Cf(this,wUt,"f").fullCommands[Cf(this,wUt,"f").fullCommands.length-1],_=u?Cf(this,vye,"f").cmdToParseOptions(u):{array:[],alias:{},default:{},demand:{}};return MLt(_).forEach(y=>{let k=_[y];Array.isArray(k)?k.indexOf(e)!==-1&&(n[y]=!0):k[e]&&!(y in n)&&(n[y]=k[e])}),this.group(e,Cf(this,PL,"f").getPositionalGroupName()),this.option(e,n)}recommendCommands(e=!0){return Ow("[boolean]",[e],arguments.length),Vw(this,Wnn,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 Ow("<array|string|object> [number]",[e],arguments.length),typeof e=="string"&&Cf(this,hN,"f").narg[e]?this:(this[ULt](this.requiresArg.bind(this),"narg",e,NaN),this)}showCompletionScript(e,n){return Ow("[string] [string]",[e,n],arguments.length),e=e||this.$0,Cf(this,WLt,"f").log(Cf(this,_ut,"f").generateCompletionScript(e,n||Cf(this,Ont,"f")||"completion")),this}showHelp(e){if(Ow("[string|function]",[e],arguments.length),Vw(this,Lnt,!0,"f"),!Cf(this,PL,"f").hasCachedHelpMessage()){if(!this.parsed){let r=this[IUt](Cf(this,MDt,"f"),void 0,void 0,0,!0);if(kae(r))return r.then(()=>{Cf(this,PL,"f").showHelp(e)}),this}let n=Cf(this,vye,"f").runDefaultBuilderOn(this);if(kae(n))return n.then(()=>{Cf(this,PL,"f").showHelp(e)}),this}return Cf(this,PL,"f").showHelp(e),this}scriptName(e){return this.customScriptName=!0,this.$0=e,this}showHelpOnFail(e,n){return Ow("[boolean|string] [string]",[e,n],arguments.length),Cf(this,PL,"f").showHelpOnFail(e,n),this}showVersion(e){return Ow("[string|function]",[e],arguments.length),Cf(this,PL,"f").showVersion(e),this}skipValidation(e){return Ow("<array|string>",[e],arguments.length),this[FDt]("skipValidation",e),this}strict(e){return Ow("[boolean]",[e],arguments.length),Vw(this,m6t,e!==!1,"f"),this}strictCommands(e){return Ow("[boolean]",[e],arguments.length),Vw(this,h6t,e!==!1,"f"),this}strictOptions(e){return Ow("[boolean]",[e],arguments.length),Vw(this,g6t,e!==!1,"f"),this}string(e){return Ow("<array|string>",[e],arguments.length),this[FDt]("string",e),this[x6t](e),this}terminalWidth(){return Ow([],0),Cf(this,jO,"f").process.stdColumns}updateLocale(e){return this.updateStrings(e)}updateStrings(e){return Ow("<object>",[e],arguments.length),Vw(this,p6t,!1,"f"),Cf(this,jO,"f").y18n.updateLocale(e),this}usage(e,n,r,u){if(Ow("<string|null|undefined> [string|boolean] [function|object] [function]",[e,n,r,u],arguments.length),n!==void 0){if(tUe(e,null,Cf(this,jO,"f")),(e||"").match(/^\$0( |$)/))return this.command(e,n,r,u);throw new jte(".usage() description must start with $0 if being used as alias for .command()")}else return Cf(this,PL,"f").usage(e),this}usageConfiguration(e){return Ow("<object>",[e],arguments.length),Vw(this,Gnn,e,"f"),this}version(e,n,r){let u="version";if(Ow("[boolean|string] [string] [string]",[e,n,r],arguments.length),Cf(this,V1t,"f")&&(this[Z7n](Cf(this,V1t,"f")),Cf(this,PL,"f").version(void 0),Vw(this,V1t,null,"f")),arguments.length===0)r=this[dPr](),e=u;else if(arguments.length===1){if(e===!1)return this;r=e,e=u}else arguments.length===2&&(r=n,n=void 0);return Vw(this,V1t,typeof e=="string"?e:u,"f"),n=n||Cf(this,PL,"f").deferY18nLookup("Show version number"),Cf(this,PL,"f").version(r||void 0),this.boolean(Cf(this,V1t,"f")),this.describe(Cf(this,V1t,"f"),n),this}wrap(e){return Ow("<number|null|undefined>",[e],arguments.length),Cf(this,PL,"f").wrap(e),this}[(vye=new WeakMap,f6t=new WeakMap,wUt=new WeakMap,_ut=new WeakMap,Ont=new WeakMap,Lnn=new WeakMap,RDt=new WeakMap,p6t=new WeakMap,Rnn=new WeakMap,mut=new WeakMap,Mnn=new WeakMap,hut=new WeakMap,U1t=new WeakMap,Lnt=new WeakMap,gut=new WeakMap,Fnn=new WeakMap,WLt=new WeakMap,Fwe=new WeakMap,hN=new WeakMap,Bnn=new WeakMap,jnn=new WeakMap,Rnt=new WeakMap,d6t=new WeakMap,GLt=new WeakMap,_6t=new WeakMap,MDt=new WeakMap,Wnn=new WeakMap,jO=new WeakMap,m6t=new WeakMap,h6t=new WeakMap,g6t=new WeakMap,PL=new WeakMap,Gnn=new WeakMap,V1t=new WeakMap,Dme=new WeakMap,oPr)](e){if(!e._||!e["--"])return e;e._.push.apply(e._,e["--"]);try{delete e["--"]}catch{}return e}[cPr](){return{log:(...e)=>{this[Unn]()||console.log(...e),Vw(this,Lnt,!0,"f"),Cf(this,Fwe,"f").length&&Vw(this,Fwe,Cf(this,Fwe,"f")+`
|
|
798
798
|
`,"f"),Vw(this,Fwe,Cf(this,Fwe,"f")+e.join(" "),"f")},error:(...e)=>{this[Unn]()||console.error(...e),Vw(this,Lnt,!0,"f"),Cf(this,Fwe,"f").length&&Vw(this,Fwe,Cf(this,Fwe,"f")+`
|
|
799
|
-
`,"f"),Vw(this,Fwe,Cf(this,Fwe,"f")+e.join(" "),"f")}}}[Z7n](e){MLt(Cf(this,hN,"f")).forEach(n=>{if((u=>u==="configObjects")(n))return;let r=Cf(this,hN,"f")[n];Array.isArray(r)?r.includes(e)&&r.splice(r.indexOf(e),1):typeof r=="object"&&delete r[e]}),delete Cf(this,PL,"f").getDescriptions()[e]}[lPr](e,n,r){Cf(this,Rnn,"f")[r]||(Cf(this,jO,"f").process.emitWarning(e,n),Cf(this,Rnn,"f")[r]=!0)}[uPr](){Cf(this,Mnn,"f").push({options:Cf(this,hN,"f"),configObjects:Cf(this,hN,"f").configObjects.slice(0),exitProcess:Cf(this,mut,"f"),groups:Cf(this,U1t,"f"),strict:Cf(this,m6t,"f"),strictCommands:Cf(this,h6t,"f"),strictOptions:Cf(this,g6t,"f"),completionCommand:Cf(this,Ont,"f"),output:Cf(this,Fwe,"f"),exitError:Cf(this,RDt,"f"),hasOutput:Cf(this,Lnt,"f"),parsed:this.parsed,parseFn:Cf(this,Rnt,"f"),parseContext:Cf(this,d6t,"f")}),Cf(this,PL,"f").freeze(),Cf(this,Dme,"f").freeze(),Cf(this,vye,"f").freeze(),Cf(this,hut,"f").freeze()}[fPr](){let e="",n;return/\b(node|iojs|electron)(\.exe)?$/.test(Cf(this,jO,"f").process.argv()[0])?n=Cf(this,jO,"f").process.argv().slice(1,2):n=Cf(this,jO,"f").process.argv().slice(0,1),e=n.map(r=>{let u=this[TPr](Cf(this,f6t,"f"),r);return r.match(/^(\/|([a-zA-Z]:)?\\)/)&&u.length<r.length?u:r}).join(" ").trim(),Cf(this,jO,"f").getEnv("_")&&Cf(this,jO,"f").getProcessArgvBin()===Cf(this,jO,"f").getEnv("_")&&(e=Cf(this,jO,"f").getEnv("_").replace(`${Cf(this,jO,"f").path.dirname(Cf(this,jO,"f").process.execPath())}/`,"")),e}[y6t](){return Cf(this,jnn,"f")}[pPr](){return Cf(this,Gnn,"f")}[eLn](){if(!Cf(this,p6t,"f"))return;let e=Cf(this,jO,"f").getEnv("LC_ALL")||Cf(this,jO,"f").getEnv("LC_MESSAGES")||Cf(this,jO,"f").getEnv("LANG")||Cf(this,jO,"f").getEnv("LANGUAGE")||"en_US";this.locale(e.replace(/[.:].*/,""))}[dPr](){return this[tLn]().version||"unknown"}[_Pr](e){let n=e["--"]?e["--"]:e._;for(let r=0,u;(u=n[r])!==void 0;r++)Cf(this,jO,"f").Parser.looksLikeNumber(u)&&Number.isSafeInteger(Math.floor(parseFloat(`${u}`)))&&(n[r]=Number(u));return e}[tLn](e){let n=e||"*";if(Cf(this,GLt,"f")[n])return Cf(this,GLt,"f")[n];let r={};try{let u=e||Cf(this,jO,"f").mainFilename;!e&&Cf(this,jO,"f").path.extname(u)&&(u=Cf(this,jO,"f").path.dirname(u));let _=Cf(this,jO,"f").findUp(u,(y,k)=>{if(k.includes("package.json"))return"package.json"});tUe(_,void 0,Cf(this,jO,"f")),r=JSON.parse(Cf(this,jO,"f").readFileSync(_,"utf8"))}catch{}return Cf(this,GLt,"f")[n]=r||{},Cf(this,GLt,"f")[n]}[FDt](e,n){n=[].concat(n),n.forEach(r=>{r=this[iLn](r),Cf(this,hN,"f")[e].push(r)})}[ULt](e,n,r,u){this[rLn](e,n,r,u,(_,y,k)=>{Cf(this,hN,"f")[_][y]=k})}[nLn](e,n,r,u){this[rLn](e,n,r,u,(_,y,k)=>{Cf(this,hN,"f")[_][y]=(Cf(this,hN,"f")[_][y]||[]).concat(k)})}[rLn](e,n,r,u,_){if(Array.isArray(r))r.forEach(y=>{e(y,u)});else if((y=>typeof y=="object")(r))for(let y of MLt(r))e(y,r[y]);else _(n,this[iLn](r),u)}[iLn](e){return e==="__proto__"?"___proto___":e}[sLn](e,n){return this[ULt](this[sLn].bind(this),"key",e,n),this}[aLn](){var e,n,r,u,_,y,k,O,L,B,Z,oe;let ue=Cf(this,Mnn,"f").pop();tUe(ue,void 0,Cf(this,jO,"f"));let Se;e=this,n=this,r=this,u=this,_=this,y=this,k=this,O=this,L=this,B=this,Z=this,oe=this,{options:{set value(ye){Vw(e,hN,ye,"f")}}.value,configObjects:Se,exitProcess:{set value(ye){Vw(n,mut,ye,"f")}}.value,groups:{set value(ye){Vw(r,U1t,ye,"f")}}.value,output:{set value(ye){Vw(u,Fwe,ye,"f")}}.value,exitError:{set value(ye){Vw(_,RDt,ye,"f")}}.value,hasOutput:{set value(ye){Vw(y,Lnt,ye,"f")}}.value,parsed:this.parsed,strict:{set value(ye){Vw(k,m6t,ye,"f")}}.value,strictCommands:{set value(ye){Vw(O,h6t,ye,"f")}}.value,strictOptions:{set value(ye){Vw(L,g6t,ye,"f")}}.value,completionCommand:{set value(ye){Vw(B,Ont,ye,"f")}}.value,parseFn:{set value(ye){Vw(Z,Rnt,ye,"f")}}.value,parseContext:{set value(ye){Vw(oe,d6t,ye,"f")}}.value}=ue,Cf(this,hN,"f").configObjects=Se,Cf(this,PL,"f").unfreeze(),Cf(this,Dme,"f").unfreeze(),Cf(this,vye,"f").unfreeze(),Cf(this,hut,"f").unfreeze()}[mPr](e,n){return u6t(n,r=>(e(r),r))}getInternalMethods(){return{getCommandInstance:this[hPr].bind(this),getContext:this[gPr].bind(this),getHasOutput:this[yPr].bind(this),getLoggerInstance:this[vPr].bind(this),getParseContext:this[xPr].bind(this),getParserConfiguration:this[y6t].bind(this),getUsageConfiguration:this[pPr].bind(this),getUsageInstance:this[bPr].bind(this),getValidationInstance:this[SPr].bind(this),hasParseCallback:this[Unn].bind(this),isGlobalContext:this[EPr].bind(this),postProcess:this[v6t].bind(this),reset:this[oLn].bind(this),runValidation:this[cLn].bind(this),runYargsParserAndExecuteCommands:this[IUt].bind(this),setHasOutput:this[CPr].bind(this)}}[hPr](){return Cf(this,vye,"f")}[gPr](){return Cf(this,wUt,"f")}[yPr](){return Cf(this,Lnt,"f")}[vPr](){return Cf(this,WLt,"f")}[xPr](){return Cf(this,d6t,"f")||{}}[bPr](){return Cf(this,PL,"f")}[SPr](){return Cf(this,Dme,"f")}[Unn](){return!!Cf(this,Rnt,"f")}[EPr](){return Cf(this,Fnn,"f")}[v6t](e,n,r,u){return r||kae(e)||(n||(e=this[oPr](e)),(this[y6t]()["parse-positional-numbers"]||this[y6t]()["parse-positional-numbers"]===void 0)&&(e=this[_Pr](e)),u&&(e=l6t(e,this,Cf(this,hut,"f").getMiddleware(),!1))),e}[oLn](e={}){Vw(this,hN,Cf(this,hN,"f")||{},"f");let n={};n.local=Cf(this,hN,"f").local||[],n.configObjects=Cf(this,hN,"f").configObjects||[];let r={};n.local.forEach(y=>{r[y]=!0,(e[y]||[]).forEach(k=>{r[k]=!0})}),Object.assign(Cf(this,_6t,"f"),Object.keys(Cf(this,U1t,"f")).reduce((y,k)=>{let O=Cf(this,U1t,"f")[k].filter(L=>!(L in r));return O.length>0&&(y[k]=O),y},{})),Vw(this,U1t,{},"f");let u=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],_=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return u.forEach(y=>{n[y]=(Cf(this,hN,"f")[y]||[]).filter(k=>!r[k])}),_.forEach(y=>{n[y]=ODt(Cf(this,hN,"f")[y],k=>!r[k])}),n.envPrefix=Cf(this,hN,"f").envPrefix,Vw(this,hN,n,"f"),Vw(this,PL,Cf(this,PL,"f")?Cf(this,PL,"f").reset(r):KIr(this,Cf(this,jO,"f")),"f"),Vw(this,Dme,Cf(this,Dme,"f")?Cf(this,Dme,"f").reset(r):iPr(this,Cf(this,PL,"f"),Cf(this,jO,"f")),"f"),Vw(this,vye,Cf(this,vye,"f")?Cf(this,vye,"f").reset():qIr(Cf(this,PL,"f"),Cf(this,Dme,"f"),Cf(this,hut,"f"),Cf(this,jO,"f")),"f"),Cf(this,_ut,"f")||Vw(this,_ut,ZIr(this,Cf(this,PL,"f"),Cf(this,vye,"f"),Cf(this,jO,"f")),"f"),Cf(this,hut,"f").reset(),Vw(this,Ont,null,"f"),Vw(this,Fwe,"","f"),Vw(this,RDt,null,"f"),Vw(this,Lnt,!1,"f"),this.parsed=!1,this}[TPr](e,n){return Cf(this,jO,"f").path.relative(e,n)}[IUt](e,n,r,u=0,_=!1){let y=!!r||_;e=e||Cf(this,MDt,"f"),Cf(this,hN,"f").__=Cf(this,jO,"f").y18n.__,Cf(this,hN,"f").configuration=this[y6t]();let k=!!Cf(this,hN,"f").configuration["populate--"],O=Object.assign({},Cf(this,hN,"f").configuration,{"populate--":!0}),L=Cf(this,jO,"f").Parser.detailed(e,Object.assign({},Cf(this,hN,"f"),{configuration:{"parse-positional-numbers":!1,...O}})),B=Object.assign(L.argv,Cf(this,d6t,"f")),Z,oe=L.aliases,ue=!1,Se=!1;Object.keys(B).forEach(ye=>{ye===Cf(this,gut,"f")&&B[ye]?ue=!0:ye===Cf(this,V1t,"f")&&B[ye]&&(Se=!0)}),B.$0=this.$0,this.parsed=L,u===0&&Cf(this,PL,"f").clearCachedHelpMessage();try{if(this[eLn](),n)return this[v6t](B,k,!!r,!1);Cf(this,gut,"f")&&[Cf(this,gut,"f")].concat(oe[Cf(this,gut,"f")]||[]).filter(cn=>cn.length>1).includes(""+B._[B._.length-1])&&(B._.pop(),ue=!0),Vw(this,Fnn,!1,"f");let ye=Cf(this,vye,"f").getCommands(),Me=Cf(this,_ut,"f").completionKey in B,ze=ue||Me||_;if(B._.length){if(ye.length){let it;for(let cn=u||0,Et;B._[cn]!==void 0;cn++)if(Et=String(B._[cn]),ye.includes(Et)&&Et!==Cf(this,Ont,"f")){let zn=Cf(this,vye,"f").runCommand(Et,this,L,cn+1,_,ue||Se||_);return this[v6t](zn,k,!!r,!1)}else if(!it&&Et!==Cf(this,Ont,"f")){it=Et;break}!Cf(this,vye,"f").hasDefaultCommand()&&Cf(this,Wnn,"f")&&it&&!ze&&Cf(this,Dme,"f").recommendCommands(it,ye)}Cf(this,Ont,"f")&&B._.includes(Cf(this,Ont,"f"))&&!Me&&(Cf(this,mut,"f")&&LDt(!0),this.showCompletionScript(),this.exit(0))}if(Cf(this,vye,"f").hasDefaultCommand()&&!ze){let it=Cf(this,vye,"f").runCommand(null,this,L,0,_,ue||Se||_);return this[v6t](it,k,!!r,!1)}if(Me){Cf(this,mut,"f")&&LDt(!0),e=[].concat(e);let it=e.slice(e.indexOf(`--${Cf(this,_ut,"f").completionKey}`)+1);return Cf(this,_ut,"f").getCompletion(it,(cn,Et)=>{if(cn)throw new jte(cn.message);(Et||[]).forEach(zn=>{Cf(this,WLt,"f").log(zn)}),this.exit(0)}),this[v6t](B,!k,!!r,!1)}if(Cf(this,Lnt,"f")||(ue?(Cf(this,mut,"f")&&LDt(!0),y=!0,this.showHelp("log"),this.exit(0)):Se&&(Cf(this,mut,"f")&&LDt(!0),y=!0,Cf(this,PL,"f").showVersion("log"),this.exit(0))),!y&&Cf(this,hN,"f").skipValidation.length>0&&(y=Object.keys(B).some(it=>Cf(this,hN,"f").skipValidation.indexOf(it)>=0&&B[it]===!0)),!y){if(L.error)throw new jte(L.error.message);if(!Me){let it=this[cLn](oe,{},L.error);r||(Z=l6t(B,this,Cf(this,hut,"f").getMiddleware(),!0)),Z=this[mPr](it,Z??B),kae(Z)&&!r&&(Z=Z.then(()=>l6t(B,this,Cf(this,hut,"f").getMiddleware(),!1)))}}}catch(ye){if(ye instanceof jte)Cf(this,PL,"f").fail(ye.message,ye);else throw ye}return this[v6t](Z??B,k,!!r,!0)}[cLn](e,n,r,u){let _={...this.getDemandedOptions()};return y=>{if(r)throw new jte(r.message);Cf(this,Dme,"f").nonOptionCount(y),Cf(this,Dme,"f").requiredArguments(y,_);let k=!1;Cf(this,h6t,"f")&&(k=Cf(this,Dme,"f").unknownCommands(y)),Cf(this,m6t,"f")&&!k?Cf(this,Dme,"f").unknownArguments(y,e,n,!!u):Cf(this,g6t,"f")&&Cf(this,Dme,"f").unknownArguments(y,e,{},!1,!1),Cf(this,Dme,"f").limitedChoices(y),Cf(this,Dme,"f").implications(y),Cf(this,Dme,"f").conflicting(y)}}[CPr](){Vw(this,Lnt,!0,"f")}[x6t](e){if(typeof e=="string")Cf(this,hN,"f").key[e]=!0;else for(let n of e)Cf(this,hN,"f").key[n]=!0}}});var Fos,DPr,kPr=za(()=>{"use strict";W7n();J7n();Fos=APr(j7n),DPr=Fos});var wPr=za(()=>{Q7n();F7n();R7n();W7n()});var Vnn,IPr=za(()=>{Vnn="0.11.4"});var VLt,PPr,NPr,OPr,LPr,RPr,MPr,FPr,BPr,jPr,vEt=za(()=>{"use strict";PDt();VLt="X-Codemod-Access-Token".toLocaleLowerCase(),PPr=async t=>(await I4e.post("https://backend.codemod.com/validateAccessToken",{},{headers:{[VLt]:t},timeout:5e3})).data,NPr=async(t,e)=>{await I4e.post("https://backend.codemod.com/publish",e,{headers:{[VLt]:t,"Content-Type":"multipart/form-data"},timeout:1e4})},OPr=async(t,e)=>{await I4e.post("https://backend.codemod.com/unpublish",{name:e},{headers:{[VLt]:t},timeout:1e4})},LPr=async t=>{await I4e.delete("https://backend.codemod.com/revokeToken",{headers:{[VLt]:t},timeout:1e4})},RPr=async(t,e)=>{let n=new URL("https://backend.codemod.com/codemods/downloadLink");t&&n.searchParams.set("name",t);let r={};return e&&(r[VLt]=e),(await I4e.get(n.toString(),{headers:r,timeout:1e4})).data},MPr=async t=>{let{accessToken:e,search:n}=t??{},r={};e&&(r[VLt]=e);let u=new URL("https://backend.codemod.com/codemods/list");return n&&u.searchParams.set("search",n),(await I4e.get(u.toString(),{headers:r,timeout:1e4})).data},FPr=async()=>(await I4e.post("https://backend.codemod.com/intents",{})).data,BPr=async(t,e)=>(await I4e.get(`https://backend.codemod.com/intents/${t}?iv=${e}`)).data.token,jPr=async t=>(await I4e.post("https://backend.codemod.com/diffs",{before:t.beforeSnippet,after:t.afterSnippet,source:"cli"})).data});var WPr,GPr,UPr,VPr,uLn,znn,$Me,zPr,qnn,Hnn,yut=za(()=>{"use strict";WPr=require("node:child_process"),GPr=require("node:os"),UPr=require("node:path");xpe();VPr=V1($lt(),1),uLn=V1(require("keytar"),1);vEt();znn=t=>{let e=process.platform==="win32"?"start":"open",n=[t];try{return(0,WPr.spawnSync)(e,n,{stdio:"ignore",shell:!1}),!0}catch(r){return console.error("Error while opening URL:",r),!1}},$Me=async()=>{let[t]=await uLn.default.findCredentials("codemod.com");if(!a$e(t))return null;let{account:e,password:n}=t,r;try{r=await PPr(n)}catch{return await uLn.default.deletePassword("codemod.com",e),null}return{user:r,token:n}},zPr=(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(a$e)},qnn=t=>(0,UPr.join)(String(t)==="runOnPreCommit"?process.cwd():(0,GPr.homedir)(),".codemod"),Hnn=async t=>{let{globPattern:e,source:n,errorText:r,onSuccess:u,onFail:_}=t,y=async()=>(await(0,VPr.glob)(e,{absolute:!0,ignore:["**/node_modules/**"],cwd:n,onlyFiles:!0})).at(0),k=await y();try{if(await Sae("codemod build",{cwd:n}),k=await y(),k===void 0)throw new Error;u?.()}catch{throw _?.(),new Error(r)}return k}});var qPr,zLt,fLn,jos,Wos,HPr,JPr=za(()=>{"use strict";qPr=require("node:crypto"),zLt=require("node:fs/promises"),fLn=require("node:path");yut();jos=async t=>{try{let e=await(0,zLt.readFile)((0,fLn.join)(t,"session.json"),"utf-8");return JSON.parse(e).id}catch{return null}},Wos=async t=>{await(0,zLt.mkdir)(t,{recursive:!0});let e=(0,qPr.randomBytes)(16).toString("hex");return await(0,zLt.writeFile)((0,fLn.join)(t,"session.json"),JSON.stringify({id:e})),e},HPr=async()=>{let t=qnn(),e=await $Me();if(e!==null)return e.user.userId;let n=await jos(t);return n!==null?n:await Wos(t)}});var dLn,z1t,qLt,KPr,Gos,$Pr,pLn,XPr,HLt,YPr,JLt,KLt,QPr,$Lt,PUt=za(()=>{"use strict";dLn=require("node:crypto"),z1t=require("node:path");xpe();qLt=function(t,e,n,r){function u(_){return _ instanceof n?_:new n(function(y){y(_)})}return new(n||(n=Promise))(function(_,y){function k(B){try{L(r.next(B))}catch(Z){y(Z)}}function O(B){try{L(r.throw(B))}catch(Z){y(Z)}}function L(B){B.done?_(B.value):u(B.value).then(k,O)}L((r=r.apply(t,e||[])).next())})},KPr={tabWidth:4,useTabs:!0,semi:!0,singleQuote:!0,quoteProps:"as-needed",trailingComma:"all",bracketSpacing:!0,arrowParens:"always",endOfLine:"lf",parser:"typescript"},Gos=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"]]),$Pr=t=>qLt(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=KPr);let u=(e=Gos.get((0,z1t.extname)(t).slice(1)))!==null&&e!==void 0?e:"typescript";return Object.assign(Object.assign({},r),{parser:u})}),pLn=(t,e,n)=>qLt(void 0,void 0,void 0,function*(){let r=e.replace(/\/\*\* \*\*\//gm,"");if(!n)return r;try{let{format:u}=yield import("prettier"),_=yield $Pr(t);return yield u(r,_)}catch{return r}}),XPr=t=>qLt(void 0,void 0,void 0,function*(){if(t.kind==="createFile"){let e=yield pLn(t.newPath,t.newData,t.formatWithPrettier);return Object.assign(Object.assign({},t),{newData:e,formatted:!0})}if(t.kind==="updateFile"){let e=yield pLn(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})}),HLt=t=>qLt(void 0,void 0,void 0,function*(){return(yield Promise.all(t.map(n=>XPr(n)))).filter(a$e)}),YPr=(t,e)=>qLt(void 0,void 0,void 0,function*(){if(e.kind==="createFile"){let n=(0,z1t.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,z1t.dirname)(e.newPath);return yield t.promises.mkdir(n,{recursive:!0}),t.promises.copyFile(e.oldPath,e.newPath)}}),JLt=(t,e)=>{let n=(0,dLn.createHash)("md5").update(e.kind).update(e.newPath).update(e.newData).digest("base64url"),r=(0,z1t.extname)(e.newPath);return(0,z1t.join)(t,`${n}${r}`)},KLt=(t,e)=>{let n=(0,dLn.createHash)("md5").update(e.kind).update(e.oldPath).update(e.newData).digest("base64url"),r=(0,z1t.extname)(e.oldPath);return(0,z1t.join)(t,`${n}${r}`)},QPr=(t,e,n)=>qLt(void 0,void 0,void 0,function*(){if(n.kind==="createFile"){let r=JLt(e,n);yield t.promises.writeFile(r,n.newData)}if(n.kind==="updateFile"){let r=KLt(e,n);yield t.promises.writeFile(r,n.newData)}}),$Lt=(t,e,n)=>e.dryRun===!0?QPr(t,e.outputDirectoryPath,n):YPr(t,n)});var ZPr=za(()=>{"use strict"});var eNr,Uos,Vos,tNr,nNr=za(()=>{"use strict";eNr=require("node:fs");$Ge();Uos=BY([_k("jscodeshift"),_k("filemod"),_k("ts-morph"),_k("ast-grep"),_k("workflow")]),Vos=aR({_:Sme(iD()),source:tO(iD()),engine:tO(Uos)}),tNr=t=>{var e,n;let r=Wle(Vos,t);if(r._.includes("runOnPreCommit"))return{kind:"runOnPreCommit"};let u=r._.at(0);if(!u)throw new Error("Codemod to run was not specified!");return(0,eNr.existsSync)(u)||r.source?{kind:"runSourced",source:(e=r.source)!==null&&e!==void 0?e:u,engine:(n=r.engine)!==null&&n!==void 0?n:null}:{kind:"runNamed",name:u}}});var rNr,iNr,sNr,zos,_Ln,mLn,hLn,gLn,yLn,aNr,oNr,qos,cNr,vLn=za(()=>{"use strict";rNr=require("node:path");MTe();$Ge();iNr=["*.d.ts","node_modules/",".next/","dist/","build/"],sNr=[".git/",".svn/",".hg/",".bzr/","_darcs/","_MTN/","_FOSSIL_",".fslckout",".view/"],zos=process.cwd(),_Ln=!0,mLn=!0,hLn=!0,gLn=!1,yLn=4,aNr=!1,oNr=!0,qos=aR({_:Sme(iD()),include:tO(Sme(iD())),exclude:tO(Sme(iD()),[]),target:tO(iD()),files:tO(Sme(iD())),format:tO(T4e(),_Ln),cache:tO(T4e(),mLn),install:tO(T4e(),hLn),json:tO(T4e(),gLn),threads:tO(ROt([Vfr(0)]),yLn)}),cNr=(t,e)=>{var n;let r=Wle(qos,t),u=r._.at(1),_=r.target,y;return u&&_?(e.printConsoleMessage("info",nm.yellow("Both positional and argument target options are passed. Defaulting to the argument target option...")),y=_):y=(n=u??_)!==null&&n!==void 0?n:zos,Object.assign(Object.assign({},r),{target:(0,rNr.resolve)(y)})}});var lNr,uNr,Hos,fNr,pNr=za(()=>{"use strict";lNr=require("node:crypto"),uNr=require("node:path");$Ge();Hos=BY([aR({dry:tO(_k(!1),!1)}),aR({dry:_k(!0),output:tO(iD())})]),fNr=(t,e)=>{let n=(0,lNr.randomBytes)(20);return Wle(Hos,e).dry===!1?{dryRun:!1,caseHashDigest:n}:{dryRun:!0,streamingEnabled:!0,outputDirectoryPath:(0,uNr.join)(t,".codemod","cases",n.toString("base64url")),caseHashDigest:n}}});var _Nr=Jt((Qbo,dNr)=>{var Jos=Object.prototype.toString,xLn=typeof Buffer<"u"&&typeof Buffer.alloc=="function"&&typeof Buffer.allocUnsafe=="function"&&typeof Buffer.from=="function";function Kos(t){return Jos.call(t).slice(8,-1)==="ArrayBuffer"}function $os(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 xLn?Buffer.from(t.slice(e,e+n)):new Buffer(new Uint8Array(t.slice(e,e+n)))}function Xos(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!Buffer.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');return xLn?Buffer.from(t,e):new Buffer(t,e)}function Yos(t,e,n){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return Kos(t)?$os(t,e,n):typeof t=="string"?Xos(t,e):xLn?Buffer.from(t):new Buffer(t)}dNr.exports=Yos});var LUt=Jt((S6t,TLn)=>{var Qos=eZt().SourceMapConsumer,bLn=require("path"),q1t;try{q1t=require("fs"),(!q1t.existsSync||!q1t.readFileSync)&&(q1t=null)}catch{}var Zos=_Nr();function mNr(t,e){return t.require(e)}var hNr=!1,gNr=!1,SLn=!1,NUt="auto",b6t={},OUt={},ecs=/^data:application\/json[^,]+base64,/,BDt=[],jDt=[];function CLn(){return NUt==="browser"?!0:NUt==="node"?!1:typeof window<"u"&&typeof XMLHttpRequest=="function"&&!(window.require&&window.module&&window.process&&window.process.type==="renderer")}function tcs(){return typeof process=="object"&&process!==null&&typeof process.on=="function"}function ncs(){return typeof process=="object"&&process!==null?process.version:""}function rcs(){if(typeof process=="object"&&process!==null)return process.stderr}function ics(t){if(typeof process=="object"&&process!==null&&typeof process.exit=="function")return process.exit(t)}function Jnn(t){return function(e){for(var n=0;n<t.length;n++){var r=t[n](e);if(r)return r}return null}}var ALn=Jnn(BDt);BDt.push(function(t){if(t=t.trim(),/^file:/.test(t)&&(t=t.replace(/file:\/\/\/(\w:)?/,function(r,u){return u?"":"/"})),t in b6t)return b6t[t];var e="";try{if(q1t)q1t.existsSync(t)&&(e=q1t.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 b6t[t]=e});function ELn(t,e){if(!t)return e;var n=bLn.dirname(t),r=/^\w+:\/\/[^\/]*/.exec(n),u=r?r[0]:"",_=n.slice(u.length);return u&&/^\/\w\:/.test(_)?(u+="/",u+bLn.resolve(n.slice(u.length),e).replace(/\\/g,"/")):u+bLn.resolve(n.slice(u.length),e)}function scs(t){var e;if(CLn())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=ALn(t);for(var u=/(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg,_,y;y=u.exec(e);)_=y;return _?_[1]:null}var DLn=Jnn(jDt);jDt.push(function(t){var e=scs(t);if(!e)return null;var n;if(ecs.test(e)){var r=e.slice(e.indexOf(",")+1);n=Zos(r,"base64").toString(),e=t}else e=ELn(t,e),n=ALn(e);return n?{url:e,map:n}:null});function kLn(t){var e=OUt[t.source];if(!e){var n=DLn(t.source);n?(e=OUt[t.source]={url:n.url,map:new Qos(n.map)},e.map.sourcesContent&&e.map.sources.forEach(function(u,_){var y=e.map.sourcesContent[_];if(y){var k=ELn(e.url,u);b6t[k]=y}})):e=OUt[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=ELn(e.url,r.source),r}return t}function vNr(t){var e=/^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(t);if(e){var n=kLn({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]+" ("+vNr(e[2])+")":t}function acs(){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 u="",_=this.getFunctionName(),y=!0,k=this.isConstructor(),O=!(this.isToplevel()||k);if(O){var L=this.getTypeName();L==="[object Object]"&&(L="null");var B=this.getMethodName();_?(L&&_.indexOf(L)!=0&&(u+=L+"."),u+=_,B&&_.indexOf("."+B)!=_.length-B.length-1&&(u+=" [as "+B+"]")):u+=L+"."+(B||"<anonymous>")}else k?u+="new "+(_||"<anonymous>"):_?u+=_:(u+=e,y=!1);return y&&(u+=" ("+e+")"),u}function yNr(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=acs,e}function xNr(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(),u=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)/,y=_.test(ncs())?0:62;r===1&&u>y&&!CLn()&&!t.isEval()&&(u-=y);var k=kLn({source:n,line:r,column:u});e.curPosition=k,t=yNr(t);var O=t.getFunctionName;return t.getFunctionName=function(){return e.nextPosition==null?O():e.nextPosition.name||O()},t.getFileName=function(){return k.source},t.getLineNumber=function(){return k.line},t.getColumnNumber=function(){return k.column+1},t.getScriptNameOrSourceURL=function(){return k.source},t}var L=t.isEval()&&t.getEvalOrigin();return L&&(L=vNr(L),t=yNr(t),t.getEvalOrigin=function(){return L}),t}function ocs(t,e){SLn&&(b6t={},OUt={});for(var n=t.name||"Error",r=t.message||"",u=n+": "+r,_={nextPosition:null,curPosition:null},y=[],k=e.length-1;k>=0;k--)y.push(`
|
|
799
|
+
`,"f"),Vw(this,Fwe,Cf(this,Fwe,"f")+e.join(" "),"f")}}}[Z7n](e){MLt(Cf(this,hN,"f")).forEach(n=>{if((u=>u==="configObjects")(n))return;let r=Cf(this,hN,"f")[n];Array.isArray(r)?r.includes(e)&&r.splice(r.indexOf(e),1):typeof r=="object"&&delete r[e]}),delete Cf(this,PL,"f").getDescriptions()[e]}[lPr](e,n,r){Cf(this,Rnn,"f")[r]||(Cf(this,jO,"f").process.emitWarning(e,n),Cf(this,Rnn,"f")[r]=!0)}[uPr](){Cf(this,Mnn,"f").push({options:Cf(this,hN,"f"),configObjects:Cf(this,hN,"f").configObjects.slice(0),exitProcess:Cf(this,mut,"f"),groups:Cf(this,U1t,"f"),strict:Cf(this,m6t,"f"),strictCommands:Cf(this,h6t,"f"),strictOptions:Cf(this,g6t,"f"),completionCommand:Cf(this,Ont,"f"),output:Cf(this,Fwe,"f"),exitError:Cf(this,RDt,"f"),hasOutput:Cf(this,Lnt,"f"),parsed:this.parsed,parseFn:Cf(this,Rnt,"f"),parseContext:Cf(this,d6t,"f")}),Cf(this,PL,"f").freeze(),Cf(this,Dme,"f").freeze(),Cf(this,vye,"f").freeze(),Cf(this,hut,"f").freeze()}[fPr](){let e="",n;return/\b(node|iojs|electron)(\.exe)?$/.test(Cf(this,jO,"f").process.argv()[0])?n=Cf(this,jO,"f").process.argv().slice(1,2):n=Cf(this,jO,"f").process.argv().slice(0,1),e=n.map(r=>{let u=this[TPr](Cf(this,f6t,"f"),r);return r.match(/^(\/|([a-zA-Z]:)?\\)/)&&u.length<r.length?u:r}).join(" ").trim(),Cf(this,jO,"f").getEnv("_")&&Cf(this,jO,"f").getProcessArgvBin()===Cf(this,jO,"f").getEnv("_")&&(e=Cf(this,jO,"f").getEnv("_").replace(`${Cf(this,jO,"f").path.dirname(Cf(this,jO,"f").process.execPath())}/`,"")),e}[y6t](){return Cf(this,jnn,"f")}[pPr](){return Cf(this,Gnn,"f")}[eLn](){if(!Cf(this,p6t,"f"))return;let e=Cf(this,jO,"f").getEnv("LC_ALL")||Cf(this,jO,"f").getEnv("LC_MESSAGES")||Cf(this,jO,"f").getEnv("LANG")||Cf(this,jO,"f").getEnv("LANGUAGE")||"en_US";this.locale(e.replace(/[.:].*/,""))}[dPr](){return this[tLn]().version||"unknown"}[_Pr](e){let n=e["--"]?e["--"]:e._;for(let r=0,u;(u=n[r])!==void 0;r++)Cf(this,jO,"f").Parser.looksLikeNumber(u)&&Number.isSafeInteger(Math.floor(parseFloat(`${u}`)))&&(n[r]=Number(u));return e}[tLn](e){let n=e||"*";if(Cf(this,GLt,"f")[n])return Cf(this,GLt,"f")[n];let r={};try{let u=e||Cf(this,jO,"f").mainFilename;!e&&Cf(this,jO,"f").path.extname(u)&&(u=Cf(this,jO,"f").path.dirname(u));let _=Cf(this,jO,"f").findUp(u,(y,k)=>{if(k.includes("package.json"))return"package.json"});tUe(_,void 0,Cf(this,jO,"f")),r=JSON.parse(Cf(this,jO,"f").readFileSync(_,"utf8"))}catch{}return Cf(this,GLt,"f")[n]=r||{},Cf(this,GLt,"f")[n]}[FDt](e,n){n=[].concat(n),n.forEach(r=>{r=this[iLn](r),Cf(this,hN,"f")[e].push(r)})}[ULt](e,n,r,u){this[rLn](e,n,r,u,(_,y,k)=>{Cf(this,hN,"f")[_][y]=k})}[nLn](e,n,r,u){this[rLn](e,n,r,u,(_,y,k)=>{Cf(this,hN,"f")[_][y]=(Cf(this,hN,"f")[_][y]||[]).concat(k)})}[rLn](e,n,r,u,_){if(Array.isArray(r))r.forEach(y=>{e(y,u)});else if((y=>typeof y=="object")(r))for(let y of MLt(r))e(y,r[y]);else _(n,this[iLn](r),u)}[iLn](e){return e==="__proto__"?"___proto___":e}[sLn](e,n){return this[ULt](this[sLn].bind(this),"key",e,n),this}[aLn](){var e,n,r,u,_,y,k,O,L,B,Z,oe;let ue=Cf(this,Mnn,"f").pop();tUe(ue,void 0,Cf(this,jO,"f"));let Se;e=this,n=this,r=this,u=this,_=this,y=this,k=this,O=this,L=this,B=this,Z=this,oe=this,{options:{set value(ye){Vw(e,hN,ye,"f")}}.value,configObjects:Se,exitProcess:{set value(ye){Vw(n,mut,ye,"f")}}.value,groups:{set value(ye){Vw(r,U1t,ye,"f")}}.value,output:{set value(ye){Vw(u,Fwe,ye,"f")}}.value,exitError:{set value(ye){Vw(_,RDt,ye,"f")}}.value,hasOutput:{set value(ye){Vw(y,Lnt,ye,"f")}}.value,parsed:this.parsed,strict:{set value(ye){Vw(k,m6t,ye,"f")}}.value,strictCommands:{set value(ye){Vw(O,h6t,ye,"f")}}.value,strictOptions:{set value(ye){Vw(L,g6t,ye,"f")}}.value,completionCommand:{set value(ye){Vw(B,Ont,ye,"f")}}.value,parseFn:{set value(ye){Vw(Z,Rnt,ye,"f")}}.value,parseContext:{set value(ye){Vw(oe,d6t,ye,"f")}}.value}=ue,Cf(this,hN,"f").configObjects=Se,Cf(this,PL,"f").unfreeze(),Cf(this,Dme,"f").unfreeze(),Cf(this,vye,"f").unfreeze(),Cf(this,hut,"f").unfreeze()}[mPr](e,n){return u6t(n,r=>(e(r),r))}getInternalMethods(){return{getCommandInstance:this[hPr].bind(this),getContext:this[gPr].bind(this),getHasOutput:this[yPr].bind(this),getLoggerInstance:this[vPr].bind(this),getParseContext:this[xPr].bind(this),getParserConfiguration:this[y6t].bind(this),getUsageConfiguration:this[pPr].bind(this),getUsageInstance:this[bPr].bind(this),getValidationInstance:this[SPr].bind(this),hasParseCallback:this[Unn].bind(this),isGlobalContext:this[EPr].bind(this),postProcess:this[v6t].bind(this),reset:this[oLn].bind(this),runValidation:this[cLn].bind(this),runYargsParserAndExecuteCommands:this[IUt].bind(this),setHasOutput:this[CPr].bind(this)}}[hPr](){return Cf(this,vye,"f")}[gPr](){return Cf(this,wUt,"f")}[yPr](){return Cf(this,Lnt,"f")}[vPr](){return Cf(this,WLt,"f")}[xPr](){return Cf(this,d6t,"f")||{}}[bPr](){return Cf(this,PL,"f")}[SPr](){return Cf(this,Dme,"f")}[Unn](){return!!Cf(this,Rnt,"f")}[EPr](){return Cf(this,Fnn,"f")}[v6t](e,n,r,u){return r||kae(e)||(n||(e=this[oPr](e)),(this[y6t]()["parse-positional-numbers"]||this[y6t]()["parse-positional-numbers"]===void 0)&&(e=this[_Pr](e)),u&&(e=l6t(e,this,Cf(this,hut,"f").getMiddleware(),!1))),e}[oLn](e={}){Vw(this,hN,Cf(this,hN,"f")||{},"f");let n={};n.local=Cf(this,hN,"f").local||[],n.configObjects=Cf(this,hN,"f").configObjects||[];let r={};n.local.forEach(y=>{r[y]=!0,(e[y]||[]).forEach(k=>{r[k]=!0})}),Object.assign(Cf(this,_6t,"f"),Object.keys(Cf(this,U1t,"f")).reduce((y,k)=>{let O=Cf(this,U1t,"f")[k].filter(L=>!(L in r));return O.length>0&&(y[k]=O),y},{})),Vw(this,U1t,{},"f");let u=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],_=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return u.forEach(y=>{n[y]=(Cf(this,hN,"f")[y]||[]).filter(k=>!r[k])}),_.forEach(y=>{n[y]=ODt(Cf(this,hN,"f")[y],k=>!r[k])}),n.envPrefix=Cf(this,hN,"f").envPrefix,Vw(this,hN,n,"f"),Vw(this,PL,Cf(this,PL,"f")?Cf(this,PL,"f").reset(r):KIr(this,Cf(this,jO,"f")),"f"),Vw(this,Dme,Cf(this,Dme,"f")?Cf(this,Dme,"f").reset(r):iPr(this,Cf(this,PL,"f"),Cf(this,jO,"f")),"f"),Vw(this,vye,Cf(this,vye,"f")?Cf(this,vye,"f").reset():qIr(Cf(this,PL,"f"),Cf(this,Dme,"f"),Cf(this,hut,"f"),Cf(this,jO,"f")),"f"),Cf(this,_ut,"f")||Vw(this,_ut,ZIr(this,Cf(this,PL,"f"),Cf(this,vye,"f"),Cf(this,jO,"f")),"f"),Cf(this,hut,"f").reset(),Vw(this,Ont,null,"f"),Vw(this,Fwe,"","f"),Vw(this,RDt,null,"f"),Vw(this,Lnt,!1,"f"),this.parsed=!1,this}[TPr](e,n){return Cf(this,jO,"f").path.relative(e,n)}[IUt](e,n,r,u=0,_=!1){let y=!!r||_;e=e||Cf(this,MDt,"f"),Cf(this,hN,"f").__=Cf(this,jO,"f").y18n.__,Cf(this,hN,"f").configuration=this[y6t]();let k=!!Cf(this,hN,"f").configuration["populate--"],O=Object.assign({},Cf(this,hN,"f").configuration,{"populate--":!0}),L=Cf(this,jO,"f").Parser.detailed(e,Object.assign({},Cf(this,hN,"f"),{configuration:{"parse-positional-numbers":!1,...O}})),B=Object.assign(L.argv,Cf(this,d6t,"f")),Z,oe=L.aliases,ue=!1,Se=!1;Object.keys(B).forEach(ye=>{ye===Cf(this,gut,"f")&&B[ye]?ue=!0:ye===Cf(this,V1t,"f")&&B[ye]&&(Se=!0)}),B.$0=this.$0,this.parsed=L,u===0&&Cf(this,PL,"f").clearCachedHelpMessage();try{if(this[eLn](),n)return this[v6t](B,k,!!r,!1);Cf(this,gut,"f")&&[Cf(this,gut,"f")].concat(oe[Cf(this,gut,"f")]||[]).filter(cn=>cn.length>1).includes(""+B._[B._.length-1])&&(B._.pop(),ue=!0),Vw(this,Fnn,!1,"f");let ye=Cf(this,vye,"f").getCommands(),Me=Cf(this,_ut,"f").completionKey in B,ze=ue||Me||_;if(B._.length){if(ye.length){let it;for(let cn=u||0,Et;B._[cn]!==void 0;cn++)if(Et=String(B._[cn]),ye.includes(Et)&&Et!==Cf(this,Ont,"f")){let zn=Cf(this,vye,"f").runCommand(Et,this,L,cn+1,_,ue||Se||_);return this[v6t](zn,k,!!r,!1)}else if(!it&&Et!==Cf(this,Ont,"f")){it=Et;break}!Cf(this,vye,"f").hasDefaultCommand()&&Cf(this,Wnn,"f")&&it&&!ze&&Cf(this,Dme,"f").recommendCommands(it,ye)}Cf(this,Ont,"f")&&B._.includes(Cf(this,Ont,"f"))&&!Me&&(Cf(this,mut,"f")&&LDt(!0),this.showCompletionScript(),this.exit(0))}if(Cf(this,vye,"f").hasDefaultCommand()&&!ze){let it=Cf(this,vye,"f").runCommand(null,this,L,0,_,ue||Se||_);return this[v6t](it,k,!!r,!1)}if(Me){Cf(this,mut,"f")&&LDt(!0),e=[].concat(e);let it=e.slice(e.indexOf(`--${Cf(this,_ut,"f").completionKey}`)+1);return Cf(this,_ut,"f").getCompletion(it,(cn,Et)=>{if(cn)throw new jte(cn.message);(Et||[]).forEach(zn=>{Cf(this,WLt,"f").log(zn)}),this.exit(0)}),this[v6t](B,!k,!!r,!1)}if(Cf(this,Lnt,"f")||(ue?(Cf(this,mut,"f")&&LDt(!0),y=!0,this.showHelp("log"),this.exit(0)):Se&&(Cf(this,mut,"f")&&LDt(!0),y=!0,Cf(this,PL,"f").showVersion("log"),this.exit(0))),!y&&Cf(this,hN,"f").skipValidation.length>0&&(y=Object.keys(B).some(it=>Cf(this,hN,"f").skipValidation.indexOf(it)>=0&&B[it]===!0)),!y){if(L.error)throw new jte(L.error.message);if(!Me){let it=this[cLn](oe,{},L.error);r||(Z=l6t(B,this,Cf(this,hut,"f").getMiddleware(),!0)),Z=this[mPr](it,Z??B),kae(Z)&&!r&&(Z=Z.then(()=>l6t(B,this,Cf(this,hut,"f").getMiddleware(),!1)))}}}catch(ye){if(ye instanceof jte)Cf(this,PL,"f").fail(ye.message,ye);else throw ye}return this[v6t](Z??B,k,!!r,!0)}[cLn](e,n,r,u){let _={...this.getDemandedOptions()};return y=>{if(r)throw new jte(r.message);Cf(this,Dme,"f").nonOptionCount(y),Cf(this,Dme,"f").requiredArguments(y,_);let k=!1;Cf(this,h6t,"f")&&(k=Cf(this,Dme,"f").unknownCommands(y)),Cf(this,m6t,"f")&&!k?Cf(this,Dme,"f").unknownArguments(y,e,n,!!u):Cf(this,g6t,"f")&&Cf(this,Dme,"f").unknownArguments(y,e,{},!1,!1),Cf(this,Dme,"f").limitedChoices(y),Cf(this,Dme,"f").implications(y),Cf(this,Dme,"f").conflicting(y)}}[CPr](){Vw(this,Lnt,!0,"f")}[x6t](e){if(typeof e=="string")Cf(this,hN,"f").key[e]=!0;else for(let n of e)Cf(this,hN,"f").key[n]=!0}}});var Fos,DPr,kPr=za(()=>{"use strict";W7n();J7n();Fos=APr(j7n),DPr=Fos});var wPr=za(()=>{Q7n();F7n();R7n();W7n()});var Vnn,IPr=za(()=>{Vnn="0.11.5"});var VLt,PPr,NPr,OPr,LPr,RPr,MPr,FPr,BPr,jPr,vEt=za(()=>{"use strict";PDt();VLt="X-Codemod-Access-Token".toLocaleLowerCase(),PPr=async t=>(await I4e.post("https://backend.codemod.com/validateAccessToken",{},{headers:{[VLt]:t},timeout:5e3})).data,NPr=async(t,e)=>{await I4e.post("https://backend.codemod.com/publish",e,{headers:{[VLt]:t,"Content-Type":"multipart/form-data"},timeout:1e4})},OPr=async(t,e)=>{await I4e.post("https://backend.codemod.com/unpublish",{name:e},{headers:{[VLt]:t},timeout:1e4})},LPr=async t=>{await I4e.delete("https://backend.codemod.com/revokeToken",{headers:{[VLt]:t},timeout:1e4})},RPr=async(t,e)=>{let n=new URL("https://backend.codemod.com/codemods/downloadLink");t&&n.searchParams.set("name",t);let r={};return e&&(r[VLt]=e),(await I4e.get(n.toString(),{headers:r,timeout:1e4})).data},MPr=async t=>{let{accessToken:e,search:n}=t??{},r={};e&&(r[VLt]=e);let u=new URL("https://backend.codemod.com/codemods/list");return n&&u.searchParams.set("search",n),(await I4e.get(u.toString(),{headers:r,timeout:1e4})).data},FPr=async()=>(await I4e.post("https://backend.codemod.com/intents",{})).data,BPr=async(t,e)=>(await I4e.get(`https://backend.codemod.com/intents/${t}?iv=${e}`)).data.token,jPr=async t=>(await I4e.post("https://backend.codemod.com/diffs",{before:t.beforeSnippet,after:t.afterSnippet,source:"cli"})).data});var WPr,GPr,UPr,VPr,uLn,znn,$Me,zPr,qnn,Hnn,yut=za(()=>{"use strict";WPr=require("node:child_process"),GPr=require("node:os"),UPr=require("node:path");xpe();VPr=V1($lt(),1),uLn=V1(require("keytar"),1);vEt();znn=t=>{let e=process.platform==="win32"?"start":"open",n=[t];try{return(0,WPr.spawnSync)(e,n,{stdio:"ignore",shell:!1}),!0}catch(r){return console.error("Error while opening URL:",r),!1}},$Me=async()=>{let[t]=await uLn.default.findCredentials("codemod.com");if(!a$e(t))return null;let{account:e,password:n}=t,r;try{r=await PPr(n)}catch{return await uLn.default.deletePassword("codemod.com",e),null}return{user:r,token:n}},zPr=(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(a$e)},qnn=t=>(0,UPr.join)(String(t)==="runOnPreCommit"?process.cwd():(0,GPr.homedir)(),".codemod"),Hnn=async t=>{let{globPattern:e,source:n,errorText:r,onSuccess:u,onFail:_}=t,y=async()=>(await(0,VPr.glob)(e,{absolute:!0,ignore:["**/node_modules/**"],cwd:n,onlyFiles:!0})).at(0),k=await y();try{if(await Sae("codemod build",{cwd:n}),k=await y(),k===void 0)throw new Error;u?.()}catch{throw _?.(),new Error(r)}return k}});var qPr,zLt,fLn,jos,Wos,HPr,JPr=za(()=>{"use strict";qPr=require("node:crypto"),zLt=require("node:fs/promises"),fLn=require("node:path");yut();jos=async t=>{try{let e=await(0,zLt.readFile)((0,fLn.join)(t,"session.json"),"utf-8");return JSON.parse(e).id}catch{return null}},Wos=async t=>{await(0,zLt.mkdir)(t,{recursive:!0});let e=(0,qPr.randomBytes)(16).toString("hex");return await(0,zLt.writeFile)((0,fLn.join)(t,"session.json"),JSON.stringify({id:e})),e},HPr=async()=>{let t=qnn(),e=await $Me();if(e!==null)return e.user.userId;let n=await jos(t);return n!==null?n:await Wos(t)}});var dLn,z1t,qLt,KPr,Gos,$Pr,pLn,XPr,HLt,YPr,JLt,KLt,QPr,$Lt,PUt=za(()=>{"use strict";dLn=require("node:crypto"),z1t=require("node:path");xpe();qLt=function(t,e,n,r){function u(_){return _ instanceof n?_:new n(function(y){y(_)})}return new(n||(n=Promise))(function(_,y){function k(B){try{L(r.next(B))}catch(Z){y(Z)}}function O(B){try{L(r.throw(B))}catch(Z){y(Z)}}function L(B){B.done?_(B.value):u(B.value).then(k,O)}L((r=r.apply(t,e||[])).next())})},KPr={tabWidth:4,useTabs:!0,semi:!0,singleQuote:!0,quoteProps:"as-needed",trailingComma:"all",bracketSpacing:!0,arrowParens:"always",endOfLine:"lf",parser:"typescript"},Gos=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"]]),$Pr=t=>qLt(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=KPr);let u=(e=Gos.get((0,z1t.extname)(t).slice(1)))!==null&&e!==void 0?e:"typescript";return Object.assign(Object.assign({},r),{parser:u})}),pLn=(t,e,n)=>qLt(void 0,void 0,void 0,function*(){let r=e.replace(/\/\*\* \*\*\//gm,"");if(!n)return r;try{let{format:u}=yield import("prettier"),_=yield $Pr(t);return yield u(r,_)}catch{return r}}),XPr=t=>qLt(void 0,void 0,void 0,function*(){if(t.kind==="createFile"){let e=yield pLn(t.newPath,t.newData,t.formatWithPrettier);return Object.assign(Object.assign({},t),{newData:e,formatted:!0})}if(t.kind==="updateFile"){let e=yield pLn(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})}),HLt=t=>qLt(void 0,void 0,void 0,function*(){return(yield Promise.all(t.map(n=>XPr(n)))).filter(a$e)}),YPr=(t,e)=>qLt(void 0,void 0,void 0,function*(){if(e.kind==="createFile"){let n=(0,z1t.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,z1t.dirname)(e.newPath);return yield t.promises.mkdir(n,{recursive:!0}),t.promises.copyFile(e.oldPath,e.newPath)}}),JLt=(t,e)=>{let n=(0,dLn.createHash)("md5").update(e.kind).update(e.newPath).update(e.newData).digest("base64url"),r=(0,z1t.extname)(e.newPath);return(0,z1t.join)(t,`${n}${r}`)},KLt=(t,e)=>{let n=(0,dLn.createHash)("md5").update(e.kind).update(e.oldPath).update(e.newData).digest("base64url"),r=(0,z1t.extname)(e.oldPath);return(0,z1t.join)(t,`${n}${r}`)},QPr=(t,e,n)=>qLt(void 0,void 0,void 0,function*(){if(n.kind==="createFile"){let r=JLt(e,n);yield t.promises.writeFile(r,n.newData)}if(n.kind==="updateFile"){let r=KLt(e,n);yield t.promises.writeFile(r,n.newData)}}),$Lt=(t,e,n)=>e.dryRun===!0?QPr(t,e.outputDirectoryPath,n):YPr(t,n)});var ZPr=za(()=>{"use strict"});var eNr,Uos,Vos,tNr,nNr=za(()=>{"use strict";eNr=require("node:fs");$Ge();Uos=BY([_k("jscodeshift"),_k("filemod"),_k("ts-morph"),_k("ast-grep"),_k("workflow")]),Vos=aR({_:Sme(iD()),source:tO(iD()),engine:tO(Uos)}),tNr=t=>{var e,n;let r=Wle(Vos,t);if(r._.includes("runOnPreCommit"))return{kind:"runOnPreCommit"};let u=r._.at(0);if(!u)throw new Error("Codemod to run was not specified!");return(0,eNr.existsSync)(u)||r.source?{kind:"runSourced",source:(e=r.source)!==null&&e!==void 0?e:u,engine:(n=r.engine)!==null&&n!==void 0?n:null}:{kind:"runNamed",name:u}}});var rNr,iNr,sNr,zos,_Ln,mLn,hLn,gLn,yLn,aNr,oNr,qos,cNr,vLn=za(()=>{"use strict";rNr=require("node:path");MTe();$Ge();iNr=["*.d.ts","node_modules/",".next/","dist/","build/"],sNr=[".git/",".svn/",".hg/",".bzr/","_darcs/","_MTN/","_FOSSIL_",".fslckout",".view/"],zos=process.cwd(),_Ln=!0,mLn=!0,hLn=!0,gLn=!1,yLn=4,aNr=!1,oNr=!0,qos=aR({_:Sme(iD()),include:tO(Sme(iD())),exclude:tO(Sme(iD()),[]),target:tO(iD()),files:tO(Sme(iD())),format:tO(T4e(),_Ln),cache:tO(T4e(),mLn),install:tO(T4e(),hLn),json:tO(T4e(),gLn),threads:tO(ROt([Vfr(0)]),yLn)}),cNr=(t,e)=>{var n;let r=Wle(qos,t),u=r._.at(1),_=r.target,y;return u&&_?(e.printConsoleMessage("info",nm.yellow("Both positional and argument target options are passed. Defaulting to the argument target option...")),y=_):y=(n=u??_)!==null&&n!==void 0?n:zos,Object.assign(Object.assign({},r),{target:(0,rNr.resolve)(y)})}});var lNr,uNr,Hos,fNr,pNr=za(()=>{"use strict";lNr=require("node:crypto"),uNr=require("node:path");$Ge();Hos=BY([aR({dry:tO(_k(!1),!1)}),aR({dry:_k(!0),output:tO(iD())})]),fNr=(t,e)=>{let n=(0,lNr.randomBytes)(20);return Wle(Hos,e).dry===!1?{dryRun:!1,caseHashDigest:n}:{dryRun:!0,streamingEnabled:!0,outputDirectoryPath:(0,uNr.join)(t,".codemod","cases",n.toString("base64url")),caseHashDigest:n}}});var _Nr=Jt((Qbo,dNr)=>{var Jos=Object.prototype.toString,xLn=typeof Buffer<"u"&&typeof Buffer.alloc=="function"&&typeof Buffer.allocUnsafe=="function"&&typeof Buffer.from=="function";function Kos(t){return Jos.call(t).slice(8,-1)==="ArrayBuffer"}function $os(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 xLn?Buffer.from(t.slice(e,e+n)):new Buffer(new Uint8Array(t.slice(e,e+n)))}function Xos(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!Buffer.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');return xLn?Buffer.from(t,e):new Buffer(t,e)}function Yos(t,e,n){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return Kos(t)?$os(t,e,n):typeof t=="string"?Xos(t,e):xLn?Buffer.from(t):new Buffer(t)}dNr.exports=Yos});var LUt=Jt((S6t,TLn)=>{var Qos=eZt().SourceMapConsumer,bLn=require("path"),q1t;try{q1t=require("fs"),(!q1t.existsSync||!q1t.readFileSync)&&(q1t=null)}catch{}var Zos=_Nr();function mNr(t,e){return t.require(e)}var hNr=!1,gNr=!1,SLn=!1,NUt="auto",b6t={},OUt={},ecs=/^data:application\/json[^,]+base64,/,BDt=[],jDt=[];function CLn(){return NUt==="browser"?!0:NUt==="node"?!1:typeof window<"u"&&typeof XMLHttpRequest=="function"&&!(window.require&&window.module&&window.process&&window.process.type==="renderer")}function tcs(){return typeof process=="object"&&process!==null&&typeof process.on=="function"}function ncs(){return typeof process=="object"&&process!==null?process.version:""}function rcs(){if(typeof process=="object"&&process!==null)return process.stderr}function ics(t){if(typeof process=="object"&&process!==null&&typeof process.exit=="function")return process.exit(t)}function Jnn(t){return function(e){for(var n=0;n<t.length;n++){var r=t[n](e);if(r)return r}return null}}var ALn=Jnn(BDt);BDt.push(function(t){if(t=t.trim(),/^file:/.test(t)&&(t=t.replace(/file:\/\/\/(\w:)?/,function(r,u){return u?"":"/"})),t in b6t)return b6t[t];var e="";try{if(q1t)q1t.existsSync(t)&&(e=q1t.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 b6t[t]=e});function ELn(t,e){if(!t)return e;var n=bLn.dirname(t),r=/^\w+:\/\/[^\/]*/.exec(n),u=r?r[0]:"",_=n.slice(u.length);return u&&/^\/\w\:/.test(_)?(u+="/",u+bLn.resolve(n.slice(u.length),e).replace(/\\/g,"/")):u+bLn.resolve(n.slice(u.length),e)}function scs(t){var e;if(CLn())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=ALn(t);for(var u=/(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg,_,y;y=u.exec(e);)_=y;return _?_[1]:null}var DLn=Jnn(jDt);jDt.push(function(t){var e=scs(t);if(!e)return null;var n;if(ecs.test(e)){var r=e.slice(e.indexOf(",")+1);n=Zos(r,"base64").toString(),e=t}else e=ELn(t,e),n=ALn(e);return n?{url:e,map:n}:null});function kLn(t){var e=OUt[t.source];if(!e){var n=DLn(t.source);n?(e=OUt[t.source]={url:n.url,map:new Qos(n.map)},e.map.sourcesContent&&e.map.sources.forEach(function(u,_){var y=e.map.sourcesContent[_];if(y){var k=ELn(e.url,u);b6t[k]=y}})):e=OUt[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=ELn(e.url,r.source),r}return t}function vNr(t){var e=/^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(t);if(e){var n=kLn({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]+" ("+vNr(e[2])+")":t}function acs(){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 u="",_=this.getFunctionName(),y=!0,k=this.isConstructor(),O=!(this.isToplevel()||k);if(O){var L=this.getTypeName();L==="[object Object]"&&(L="null");var B=this.getMethodName();_?(L&&_.indexOf(L)!=0&&(u+=L+"."),u+=_,B&&_.indexOf("."+B)!=_.length-B.length-1&&(u+=" [as "+B+"]")):u+=L+"."+(B||"<anonymous>")}else k?u+="new "+(_||"<anonymous>"):_?u+=_:(u+=e,y=!1);return y&&(u+=" ("+e+")"),u}function yNr(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=acs,e}function xNr(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(),u=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)/,y=_.test(ncs())?0:62;r===1&&u>y&&!CLn()&&!t.isEval()&&(u-=y);var k=kLn({source:n,line:r,column:u});e.curPosition=k,t=yNr(t);var O=t.getFunctionName;return t.getFunctionName=function(){return e.nextPosition==null?O():e.nextPosition.name||O()},t.getFileName=function(){return k.source},t.getLineNumber=function(){return k.line},t.getColumnNumber=function(){return k.column+1},t.getScriptNameOrSourceURL=function(){return k.source},t}var L=t.isEval()&&t.getEvalOrigin();return L&&(L=vNr(L),t=yNr(t),t.getEvalOrigin=function(){return L}),t}function ocs(t,e){SLn&&(b6t={},OUt={});for(var n=t.name||"Error",r=t.message||"",u=n+": "+r,_={nextPosition:null,curPosition:null},y=[],k=e.length-1;k>=0;k--)y.push(`
|
|
800
800
|
at `+xNr(e[k],_)),_.nextPosition=_.curPosition;return _.curPosition=_.nextPosition=null,u+y.reverse().join("")}function bNr(t){var e=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(t.stack);if(e){var n=e[1],r=+e[2],u=+e[3],_=b6t[n];if(!_&&q1t&&q1t.existsSync(n))try{_=q1t.readFileSync(n,"utf8")}catch{_=""}if(_){var y=_.split(/(?:\r\n|\r|\n)/)[r-1];if(y)return n+":"+r+`
|
|
801
801
|
`+y+`
|
|
802
802
|
`+new Array(u).join(" ")+"^"}}return null}function ccs(t){var e=bNr(t),n=rcs();n&&n._handle&&n._handle.setBlocking&&n._handle.setBlocking(!0),e&&(console.error(),console.error(e)),console.error(t.stack),ics(1)}function lcs(){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 ccs(arguments[1])}return t.apply(this,arguments)}}var ucs=BDt.slice(0),fcs=jDt.slice(0);S6t.wrapCallSite=xNr;S6t.getErrorSource=bNr;S6t.mapSourcePosition=kLn;S6t.retrieveSourceMap=DLn;S6t.install=function(t){if(t=t||{},t.environment&&(NUt=t.environment,["node","browser","auto"].indexOf(NUt)===-1))throw new Error("environment "+NUt+" was unknown. Available options are {auto, browser, node}");if(t.retrieveFile&&(t.overrideRetrieveFile&&(BDt.length=0),BDt.unshift(t.retrieveFile)),t.retrieveSourceMap&&(t.overrideRetrieveSourceMap&&(jDt.length=0),jDt.unshift(t.retrieveSourceMap)),t.hookRequire&&!CLn()){var e=mNr(TLn,"module"),n=e.prototype._compile;n.__sourceMapSupport||(e.prototype._compile=function(_,y){return b6t[y]=_,OUt[y]=void 0,n.call(this,_,y)},e.prototype._compile.__sourceMapSupport=!0)}if(SLn||(SLn="emptyCacheBetweenOperations"in t?t.emptyCacheBetweenOperations:!1),hNr||(hNr=!0,Error.prepareStackTrace=ocs),!gNr){var r="handleUncaughtExceptions"in t?t.handleUncaughtExceptions:!0;try{var u=mNr(TLn,"worker_threads");u.isMainThread===!1&&(r=!1)}catch{}r&&tcs()&&(gNr=!0,lcs())}};S6t.resetRetrieveHandlers=function(){BDt.length=0,jDt.length=0,BDt=ucs.slice(0),jDt=fcs.slice(0),DLn=Jnn(jDt),ALn=Jnn(BDt)}});var wNr=Jt((Zbo,RUt)=>{"use strict";/*! *****************************************************************************
|
|
@@ -34175,7 +34175,7 @@ ${kl}`),_.s.appendRight(Et,"}"));if(_.helperImports.size>0){let il=(u=(r=e.templ
|
|
|
34175
34175
|
const sourceFile = project.createSourceFile(__CODEMODCOM__oldPath, __CODEMODCOM__oldData);
|
|
34176
34176
|
|
|
34177
34177
|
handleSourceFile(sourceFile, __CODEMODCOM__argumentRecord);
|
|
34178
|
-
`,y=Object.freeze({}),k=wZn.default.createContext({module:Object.freeze({exports:y}),exports:y,__CODEMODCOM__oldPath:e,__CODEMODCOM__oldData:n,__CODEMODCOM__argumentRecord:r,__CODEMODCOM__console__:bMt(u),__CODEMOD_SOURCE__:t,require:L=>{if(L==="ts-morph")return Wui.default}}),O=wZn.default.runInContext(_,k,{timeout:3e4});return Wle(RYt(iD()),O)},Gui=(t,e,n,r,u,_)=>{let y=$0n((0,jui.extname)(e)),O=(y!==null?y(Bui):Bui)(t,e,n,u,_);return typeof O!="string"||n===O?[]:[{kind:"updateFile",oldPath:e,oldData:n,newData:O,formatWithPrettier:r}]}});var oKt=za(()=>{PUt();ZPr();nNr();vLn();pNr();WFn();hGn();GGr();w5n();Fui();Uui()});var Vui,IZn,zui=za(()=>{"use strict";oKt();Vui=t=>t.option("telemetry",{type:"boolean",default:oNr,hidden:!0}).option("no-telemetry",{type:"boolean",description:"Disable telemetry"}).option("clientIdentifier",{type:"string",description:"Telemetry client ID",hidden:!0}).option("version",{alias:"v",description:"Show version number"}).option("json",{alias:"j",type:"boolean",description:"Respond with JSON",default:gLn}).option("cache",{type:"boolean",default:mLn,hidden:!0}).option("no-cache",{type:"boolean",description:"Disable cache for HTTP(S) requests"}),IZn=t=>t.option("include",{alias:"i",type:"string",array:!0,description:"Glob pattern(s) for files to include"}).option("exclude",{alias:"e",type:"string",array:!0,description:"Glob pattern(s) for files to exclude",defaultDescription:"node_modules, .next, dist, build, *.d.ts, version control folders, gitignore entries"}).option("target",{alias:"t",type:"string",description:"Input directory path"}).option("source",{alias:"s",type:"string",description:"Source path of the local codemod to run"}).option("engine",{type:"string",description:'The engine to use with the local codemod: "jscodeshift", "ts-morph", "filemod", "ast-grep"',hidden:!0}).option("format",{type:"boolean",default:_Ln,hidden:!0}).option("no-format",{type:"boolean",description:"Disable formatting output with Prettier",hidden:!0}).option("threads",{alias:"n",type:"number",description:"Number of worker threads",default:yLn}).option("dry",{alias:"d",type:"boolean",description:"Perform a dry run",default:aNr}).option("install",{type:"boolean",default:hLn,hidden:!0}).option("no-install",{type:"boolean",description:"Disable packages installation for the codemod run if there is `deps` field declared in its configuration"})});var jwt,wTt,qui,PZn,GEa,Hui,Jui=za(()=>{"use strict";jwt=require("node:fs/promises"),wTt=require("node:path");xpe();qui=V1(require("esbuild"),1),PZn=V1($lt(),1),GEa=["jscodeshift","ts-morph","@ast-grep/napi"],Hui=async(t,e)=>{let n=(0,wTt.resolve)(e),r;try{r=await(0,jwt.readFile)((0,wTt.resolve)((0,wTt.join)(n,".codemodrc.json")),"utf-8")}catch{throw new Error(`Could not find the .codemodrc.json file in the codemod directory: ${n}.`)}let u=Tnt(JSON.parse(r)),_;u.build?.input?_=await(0,PZn.glob)(u.build.input,{absolute:!0,cwd:n,onlyFiles:!0}):_=await(0,PZn.glob)("./src/index.{ts,js}",{absolute:!0,cwd:n,onlyFiles:!0});let y=_.at(0);if(!a$e(y))throw u.build?.input?new Error(`Could not find entry point file in ${(0,wTt.join)(n,u.build.input)}.
|
|
34178
|
+
`,y=Object.freeze({}),k=wZn.default.createContext({module:Object.freeze({exports:y}),exports:y,__CODEMODCOM__oldPath:e,__CODEMODCOM__oldData:n,__CODEMODCOM__argumentRecord:r,__CODEMODCOM__console__:bMt(u),__CODEMOD_SOURCE__:t,require:L=>{if(L==="ts-morph")return Wui.default}}),O=wZn.default.runInContext(_,k,{timeout:3e4});return Wle(RYt(iD()),O)},Gui=(t,e,n,r,u,_)=>{let y=$0n((0,jui.extname)(e)),O=(y!==null?y(Bui):Bui)(t,e,n,u,_);return typeof O!="string"||n===O?[]:[{kind:"updateFile",oldPath:e,oldData:n,newData:O,formatWithPrettier:r}]}});var oKt=za(()=>{PUt();ZPr();nNr();vLn();pNr();WFn();hGn();GGr();w5n();Fui();Uui()});var Vui,IZn,zui=za(()=>{"use strict";oKt();Vui=t=>t.option("telemetry",{type:"boolean",default:oNr,hidden:!0}).option("no-telemetry",{type:"boolean",description:"Disable telemetry"}).option("clientIdentifier",{type:"string",description:"Telemetry client ID",hidden:!0}).option("version",{alias:"v",description:"Show version number"}).option("json",{alias:"j",type:"boolean",description:"Respond with JSON",default:gLn}).option("cache",{type:"boolean",default:mLn,hidden:!0}).option("no-cache",{type:"boolean",description:"Disable cache for HTTP(S) requests"}),IZn=t=>t.option("include",{alias:"i",type:"string",array:!0,description:"Glob pattern(s) for files to include"}).option("exclude",{alias:"e",type:"string",array:!0,description:"Glob pattern(s) for files to exclude",defaultDescription:"node_modules, .next, dist, build, *.d.ts, version control folders, gitignore entries"}).option("target",{alias:"t",type:"string",description:"Input directory path"}).option("source",{alias:"s",type:"string",description:"Source path of the local codemod to run"}).option("engine",{type:"string",description:'The engine to use with the local codemod: "jscodeshift", "ts-morph", "filemod", "ast-grep"',hidden:!0}).option("format",{type:"boolean",default:_Ln,hidden:!0}).option("no-format",{type:"boolean",description:"Disable formatting output with Prettier",hidden:!0}).option("threads",{alias:"n",type:"number",description:"Number of worker threads",default:yLn}).option("dry",{alias:"d",type:"boolean",description:"Perform a dry run",default:aNr}).option("install",{type:"boolean",default:hLn,hidden:!0}).option("no-install",{type:"boolean",description:"Disable packages installation for the codemod run if there is `deps` field declared in its configuration"}).option("disable-tree-version-check",{type:"boolean",description:"Disable the tree version check"})});var jwt,wTt,qui,PZn,GEa,Hui,Jui=za(()=>{"use strict";jwt=require("node:fs/promises"),wTt=require("node:path");xpe();qui=V1(require("esbuild"),1),PZn=V1($lt(),1),GEa=["jscodeshift","ts-morph","@ast-grep/napi"],Hui=async(t,e)=>{let n=(0,wTt.resolve)(e),r;try{r=await(0,jwt.readFile)((0,wTt.resolve)((0,wTt.join)(n,".codemodrc.json")),"utf-8")}catch{throw new Error(`Could not find the .codemodrc.json file in the codemod directory: ${n}.`)}let u=Tnt(JSON.parse(r)),_;u.build?.input?_=await(0,PZn.glob)(u.build.input,{absolute:!0,cwd:n,onlyFiles:!0}):_=await(0,PZn.glob)("./src/index.{ts,js}",{absolute:!0,cwd:n,onlyFiles:!0});let y=_.at(0);if(!a$e(y))throw u.build?.input?new Error(`Could not find entry point file in ${(0,wTt.join)(n,u.build.input)}.
|
|
34179
34179
|
Please make sure custom build input path in .codemodrc.json under "build.input" flag is correct and file has the correct permissions.`):new Error(`Could not find the entry point file at ${n}/src/index.{js,ts}. Make sure ${n}/src/index.{js,ts} exists or specify a custom build input path by adding the "build.input" field to the codemodrc.json file.`);try{await(0,jwt.readFile)(y,"utf-8")}catch{throw new Error(`Could not read entry point file in ${y}. Please make sure it has the correct permissions.`)}let k=(0,wTt.join)(n,u.build?.output??"./dist/index.cjs"),O;try{O=(await(0,jwt.readFile)("./LICENSE","utf8")).replace(/\/\*/gm,"\\/*").replace(/\*\//gm,"*\\/")}catch{O=""}let L={entryPoints:[y],bundle:!0,external:GEa,platform:"node",minify:!0,minifyWhitespace:!0,format:"cjs",legalComments:"inline",outfile:k,write:!1},{outputFiles:B}=await qui.default.build(L),Z=B?.find(ue=>ue.path===k)?.contents??null;if(Z===null)throw new Error(`Could not find ${k} in output files`);let oe=Buffer.concat([Buffer.from(`/*! @license
|
|
34180
34180
|
`),Buffer.from(O),Buffer.from(`*/
|
|
34181
34181
|
`),Z]);return await(0,jwt.mkdir)((0,wTt.dirname)(k),{recursive:!0}),await(0,jwt.writeFile)(k,oe),console.log("The bundled CommonJS contents have been written into %s",k),{outputFilePath:k}}});function UEa(){return d0t.default.platform!=="win32"?d0t.default.env.TERM!=="linux":!!d0t.default.env.WT_SESSION||!!d0t.default.env.TERMINUS_SUBLIME||d0t.default.env.ConEmuTask==="{cmd::Cmder}"||d0t.default.env.TERM_PROGRAM==="Terminus-Sublime"||d0t.default.env.TERM_PROGRAM==="vscode"||d0t.default.env.TERM==="xterm-256color"||d0t.default.env.TERM==="alacritty"||d0t.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var d0t,Kui,$ui,VEa,zEa,qEa,HEa,JEa,Wwt,$Jo,X0n=za(()=>{d0t=V1(require("node:process"),1);Kui={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},$ui={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},VEa={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},zEa={...Kui,...$ui},qEa={...Kui,...VEa},HEa=UEa(),JEa=HEa?zEa:qEa,Wwt=JEa,$Jo=Object.entries($ui)});var Yui=Jt((YJo,Xui)=>{"use strict";var KEa=NDn(),$Ea=RDn();Xui.exports=KEa(()=>{$Ea(()=>{process.stderr.write("\x1B[?25h")},{alwaysLast:!0})})});var Q0n=Jt(z5t=>{"use strict";var XEa=Yui(),Y0n=!1;z5t.show=(t=process.stderr)=>{t.isTTY&&(Y0n=!1,t.write("\x1B[?25h"))};z5t.hide=(t=process.stderr)=>{t.isTTY&&(XEa(),Y0n=!0,t.write("\x1B[?25l"))};z5t.toggle=(t,e)=>{t!==void 0&&(Y0n=t),Y0n?z5t.show(e):z5t.hide(e)}});var cKt=Jt((ZJo,efi)=>{"use strict";function Qui(t){return!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}var Zui=efi.exports=function(t,e,n="async"){return typeof e=="string"&&(n=e,e=void 0),e=e||function(){},function(){var r=arguments,u=this,_=new Promise(function(y,k){var O=!1;let L=function(it){O&&console.warn("Run-async promise already resolved."),O=!0,y(it)};var B=!1;let Z=function(it){B&&console.warn("Run-async promise already rejected."),B=!0,k(it)};var oe=!1,ue=!1,Se=!1,ye=function(){return Se?(console.warn("Run-async async() called outside a valid run-async context, callback will be ignored."),function(){}):(ue&&console.warn(`Run-async wrapped function (async) returned a promise.
|
|
@@ -55394,7 +55394,7 @@ ${k}
|
|
|
55394
55394
|
Make sure provided values are correct.`)}return Object.keys(r).length>0&&n.printConsoleMessage("info",nm.cyan(`
|
|
55395
55395
|
Using following arguments:
|
|
55396
55396
|
-`,nm.bold(Object.entries(r).map(([k,O])=>nm(`${k}:`,O,_.includes(k)?nm.grey("(default value)"):"")).join(`
|
|
55397
|
-
- `)))),r}});var Slr,cOt,g8i,y8i,EAn,dlo,Elr,v8i=za(()=>{"use strict";Slr=require("node:crypto"),cOt=V1(require("node:fs"),1),g8i=require("node:fs/promises"),y8i=require("node:os"),EAn=require("node:path");MTe();oKt();xpe();PDt();y8t();Fxn();Z6i();e3i();r3i();s3i();Ecr();l3i();m8i();h8i();yut();dlo=async t=>{let e=!0;try{(await Sae("git status --porcelain",{cwd:t})).stdout.trim()&&(e=(await YTe.prompt({type:"confirm",name:"force",message:"Current git state contains uncommitted changes. Proceed anyway?",default:!1})).force)}catch(n){if(!(n instanceof Error))return;if("stderr"in n&&typeof n.stderr=="string"&&n.stderr.trim().startsWith("fatal: not a git repository")){e=(await YTe.prompt({type:"confirm",name:"force",message:"Target folder is not tracked by git. Codemod changes might be irreversible. Proceed anyway?",default:!1})).force;return}e=(await YTe.prompt({type:"confirm",name:"force",message:"Could not run git working tree check. Codemod changes might be irreversible. Proceed anyway?",default:!1})).force}e||process.exit(0)},Elr=async(t,e,n)=>{let r=tNr(e),u=cNr(e,t),_=fNr((0,y8i.homedir)(),e)
|
|
55397
|
+
- `)))),r}});var Slr,cOt,g8i,y8i,EAn,dlo,Elr,v8i=za(()=>{"use strict";Slr=require("node:crypto"),cOt=V1(require("node:fs"),1),g8i=require("node:fs/promises"),y8i=require("node:os"),EAn=require("node:path");MTe();oKt();xpe();PDt();y8t();Fxn();Z6i();e3i();r3i();s3i();Ecr();l3i();m8i();h8i();yut();dlo=async t=>{let e=!0;try{(await Sae("git status --porcelain",{cwd:t})).stdout.trim()&&(e=(await YTe.prompt({type:"confirm",name:"force",message:"Current git state contains uncommitted changes. Proceed anyway?",default:!1})).force)}catch(n){if(!(n instanceof Error))return;if("stderr"in n&&typeof n.stderr=="string"&&n.stderr.trim().startsWith("fatal: not a git repository")){e=(await YTe.prompt({type:"confirm",name:"force",message:"Target folder is not tracked by git. Codemod changes might be irreversible. Proceed anyway?",default:!1})).force;return}e=(await YTe.prompt({type:"confirm",name:"force",message:"Could not run git working tree check. Codemod changes might be irreversible. Proceed anyway?",default:!1})).force}e||process.exit(0)},Elr=async(t,e,n)=>{let r=tNr(e),u=cNr(e,t),_=fNr((0,y8i.homedir)(),e);!_.dryRun&&!e["disable-tree-version-check"]&&await dlo(u.target);let y=new tjt(e.cache,cOt,t),k=new XGt(cOt),O=qnn(e._),L=new njt(t,O,e.cache,y,k),B=null;if(r.kind==="runSourced"){let ye=await sAn(cOt,t,r,L,k),Me=await aAn(ye.engine,e);B={kind:r.kind,codemod:{...ye,source:"local",hashDigest:(0,Slr.createHash)("ripemd160").update(r.source).digest(),safeArgumentRecord:await SAn(ye,e,t),engineOptions:Me}}}else if(r.kind==="runNamed"){let ye;try{ye=await L.download(r.name)}catch(ze){throw ze instanceof IDt&&ze.response?.status===400&&ze.response.data.error==="Codemod not found"&&(t.printConsoleMessage("error",nm.red("The specified command or codemod name could not be recognized.",`
|
|
55398
55398
|
To view available commands, execute`,`${nm.yellow.bold(_z("codemod --help"))}.`,`
|
|
55399
55399
|
To see a list of existing codemods, run`,`${nm.yellow.bold(_z("codemod search"))}`,"or",`${nm.yellow.bold(_z("codemod list"))}`,"with a query representing the codemod you are looking for.")),process.exit(1)),new Error(`Error while downloading codemod ${r.name}: ${ze}`)}let Me=aAn(ye.engine,e);B={kind:r.kind,codemod:{...ye,hashDigest:(0,Slr.createHash)("ripemd160").update(ye.name).digest(),safeArgumentRecord:await SAn(ye,e,t),engineOptions:Me}}}else{let{preCommitCodemods:ye}=await _8i(),Me=[];for(let ze of ye){if(ze.source==="package"){let it=await L.download(ze.name),cn=aAn(it.engine,e);Me.push({...it,safeArgumentRecord:await SAn(it,ze.arguments,t),engineOptions:cn})}B={kind:r.kind,codemods:Me}}}if(!B)throw new Error("Codemod definition could not be resolved.");let Z=B.kind==="runOnPreCommit"?B.codemods:[B.codemod],oe=new Xzt(Z,cOt,_,u);_.dryRun&&t.printConsoleMessage("log",dft("Click to view the live results of this run in the Codemod VSCode Extension!",`vscode://codemod.codemod-vscode-extension/cases/${_.caseHashDigest.toString("base64url")}`));let ue={},Se=await oe.run(async(ye,Me)=>{let ze="Standalone codemod (from user machine)";if(ye.bundleType==="package"){r.kind==="runSourced"?ze=`${ye.name} (from user machine)`:ze=ye.name;let it=await(0,g8i.readFile)((0,EAn.join)(ye.directoryPath,".codemodrc.json"),{encoding:"utf8"}),cn=Tnt(JSON.parse(it));cn.deps&&(ue[ze]={affectedFiles:Me,deps:cn.deps})}n.sendDangerousEvent({kind:"codemodExecuted",codemodName:ze,executionId:_.caseHashDigest.toString("base64url"),fileCount:Me.length})},ye=>{ye instanceof Error&&(t.printOperationMessage({kind:"error",message:`Error while running the codemod:
|
|
55400
55400
|
${ye.message}`}),n.sendEvent({kind:"failedToExecuteCommand",commandName:"codemod.executeCodemod"}))},ye=>{let Me=i3i(_,ye);Me&&t.printOperationMessage(Me)},ye=>t.printMessage(ye));if(_.dryRun&&t.printConsoleMessage("log",dft("The run has finished! Click to open the Codemod VSCode Extension and view the results.",`vscode://codemod.codemod-vscode-extension/cases/${_.caseHashDigest.toString("base64url")}`)),Se&&Se.length>0){let ye=(0,EAn.join)(O,"logs",`${new Date().toISOString()}-error.log`);try{await cOt.promises.mkdir((0,EAn.join)(O,"logs"),{recursive:!0}),await cOt.promises.writeFile(ye,Se.map(Me=>`Error at ${Me.filePath}${Me.codemodName?` (${Me.codemodName})`:""}:
|
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.5",
|
|
5
5
|
"description": "A codemod engine for Node.js libraries (jscodeshift, ts-morph, etc.)",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": null,
|
|
@@ -30,6 +30,12 @@
|
|
|
30
30
|
"main": "./dist/index.cjs",
|
|
31
31
|
"bin": "./dist/index.cjs",
|
|
32
32
|
"devDependencies": {
|
|
33
|
+
"@codemod-com/filemod": "workspace:*",
|
|
34
|
+
"@codemod-com/printer": "workspace:*",
|
|
35
|
+
"@codemod-com/runner": "workspace:*",
|
|
36
|
+
"@codemod-com/telemetry": "workspace:*",
|
|
37
|
+
"@codemod-com/utilities": "workspace:*",
|
|
38
|
+
"@codemod.com/workflow": "workspace:*",
|
|
33
39
|
"@types/cli-progress": "^3.11.5",
|
|
34
40
|
"@types/columnify": "^1.5.4",
|
|
35
41
|
"@types/inquirer": "^9.0.7",
|
|
@@ -55,13 +61,15 @@
|
|
|
55
61
|
"unzipper": "^0.11.6",
|
|
56
62
|
"valibot": "^0.24.1",
|
|
57
63
|
"vitest": "^1.0.1",
|
|
58
|
-
"yargs": "^17.6.2"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
64
|
+
"yargs": "^17.6.2"
|
|
65
|
+
},
|
|
66
|
+
"scripts": {
|
|
67
|
+
"build": "tsc && node ./build.js",
|
|
68
|
+
"build:local": "npm run build -- --local",
|
|
69
|
+
"package": "pkg --compress GZip .",
|
|
70
|
+
"test": "TEST=1 vitest run",
|
|
71
|
+
"coverage": "TEST=1 vitest run --coverage",
|
|
72
|
+
"prepublishOnly": "turbo run build --filter codemod"
|
|
65
73
|
},
|
|
66
74
|
"engines": {
|
|
67
75
|
"node": ">=18.5.0"
|
|
@@ -70,11 +78,7 @@
|
|
|
70
78
|
"outputPath": "./package/"
|
|
71
79
|
},
|
|
72
80
|
"license": "Apache License, Version 2.0",
|
|
73
|
-
"files": [
|
|
74
|
-
"./dist/index.cjs",
|
|
75
|
-
"LICENSE",
|
|
76
|
-
"README.md"
|
|
77
|
-
],
|
|
81
|
+
"files": ["./dist/index.cjs", "LICENSE", "README.md"],
|
|
78
82
|
"publishConfig": {
|
|
79
83
|
"access": "public"
|
|
80
84
|
},
|
|
@@ -84,12 +88,5 @@
|
|
|
84
88
|
"esbuild": "^0.17.14",
|
|
85
89
|
"keytar": "^7.9.0",
|
|
86
90
|
"prettier": "^3.2.5"
|
|
87
|
-
},
|
|
88
|
-
"scripts": {
|
|
89
|
-
"build": "tsc && node ./build.js",
|
|
90
|
-
"build:local": "npm run build -- --local",
|
|
91
|
-
"package": "pkg --compress GZip .",
|
|
92
|
-
"test": "TEST=1 vitest run",
|
|
93
|
-
"coverage": "TEST=1 vitest run --coverage"
|
|
94
91
|
}
|
|
95
|
-
}
|
|
92
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright 2023 Codemod, Inc.
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|