@turbo/codemod 2.0.0-canary.3 → 2.0.0-canary.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -36,7 +36,7 @@ ${i.message}`:y,R=[x,e,t].filter(Boolean).join(`
36
36
  `+t.slice(n,s),n=s+1),o=a;return l+=`
37
37
  `,t.length-n>e&&o>n?l+=t.slice(n,o)+`
38
38
  `+t.slice(o+1):l+=t.slice(n),l.slice(1)}function Qb(t){for(var e="",r=0,i,n=0;n<t.length;r>=65536?n+=2:n++)r=bi(t,n),i=pe[r],!i&&Ri(r)?(e+=t[n],r>=65536&&(e+=t[n+1])):e+=i||Gb(r);return e}function Jb(t,e,r){var i="",n=t.tag,s,o,a;for(s=0,o=r.length;s<o;s+=1)a=r[s],t.replacer&&(a=t.replacer.call(r,String(s),a)),(pt(t,e,a,!1,!1)||typeof a=="undefined"&&pt(t,e,null,!1,!1))&&(i!==""&&(i+=","+(t.condenseFlow?"":" ")),i+=t.dump);t.tag=n,t.dump="["+i+"]"}function Qu(t,e,r,i){var n="",s=t.tag,o,a,l;for(o=0,a=r.length;o<a;o+=1)l=r[o],t.replacer&&(l=t.replacer.call(r,String(o),l)),(pt(t,e+1,l,!0,!0,!1,!0)||typeof l=="undefined"&&pt(t,e+1,null,!0,!0,!1,!0))&&((!i||n!=="")&&(n+=Lo(t,e)),t.dump&&xi===t.dump.charCodeAt(0)?n+="-":n+="- ",n+=t.dump);t.tag=s,t.dump=n||"[]"}function e0(t,e,r){var i="",n=t.tag,s=Object.keys(r),o,a,l,c,u;for(o=0,a=s.length;o<a;o+=1)u="",i!==""&&(u+=", "),t.condenseFlow&&(u+='"'),l=s[o],c=r[l],t.replacer&&(c=t.replacer.call(r,l,c)),pt(t,e,l,!1,!1)&&(t.dump.length>1024&&(u+="? "),u+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),pt(t,e,c,!1,!1)&&(u+=t.dump,i+=u));t.tag=n,t.dump="{"+i+"}"}function t0(t,e,r,i){var n="",s=t.tag,o=Object.keys(r),a,l,c,u,h,f;if(t.sortKeys===!0)o.sort();else if(typeof t.sortKeys=="function")o.sort(t.sortKeys);else if(t.sortKeys)throw new xe("sortKeys must be a boolean or a function");for(a=0,l=o.length;a<l;a+=1)f="",(!i||n!=="")&&(f+=Lo(t,e)),c=o[a],u=r[c],t.replacer&&(u=t.replacer.call(r,c,u)),pt(t,e+1,c,!0,!0,!0)&&(h=t.tag!==null&&t.tag!=="?"||t.dump&&t.dump.length>1024,h&&(t.dump&&xi===t.dump.charCodeAt(0)?f+="?":f+="? "),f+=t.dump,h&&(f+=Lo(t,e)),pt(t,e+1,u,!0,h)&&(t.dump&&xi===t.dump.charCodeAt(0)?f+=":":f+=": ",f+=t.dump,n+=f));t.tag=s,t.dump=n||"{}"}function Ju(t,e,r){var i,n,s,o,a,l;for(n=r?t.explicitTypes:t.implicitTypes,s=0,o=n.length;s<o;s+=1)if(a=n[s],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof e=="object"&&e instanceof a.instanceOf)&&(!a.predicate||a.predicate(e))){if(r?a.multi&&a.representName?t.tag=a.representName(e):t.tag=a.tag:t.tag="?",a.represent){if(l=t.styleMap[a.tag]||a.defaultStyle,Lh.call(a.represent)==="[object Function]")i=a.represent(e,l);else if(Ph.call(a.represent,l))i=a.represent[l](e,l);else throw new xe("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');t.dump=i}return!0}return!1}function pt(t,e,r,i,n,s,o){t.tag=null,t.dump=r,Ju(t,r,!1)||Ju(t,r,!0);var a=Lh.call(t.dump),l=i,c;i&&(i=t.flowLevel<0||t.flowLevel>e);var u=a==="[object Object]"||a==="[object Array]",h,f;if(u&&(h=t.duplicates.indexOf(r),f=h!==-1),(t.tag!==null&&t.tag!=="?"||f||t.indent!==2&&e>0)&&(n=!1),f&&t.usedDuplicates[h])t.dump="*ref_"+h;else{if(u&&f&&!t.usedDuplicates[h]&&(t.usedDuplicates[h]=!0),a==="[object Object]")i&&Object.keys(t.dump).length!==0?(t0(t,e,t.dump,n),f&&(t.dump="&ref_"+h+t.dump)):(e0(t,e,t.dump),f&&(t.dump="&ref_"+h+" "+t.dump));else if(a==="[object Array]")i&&t.dump.length!==0?(t.noArrayIndent&&!o&&e>0?Qu(t,e-1,t.dump,n):Qu(t,e,t.dump,n),f&&(t.dump="&ref_"+h+t.dump)):(Jb(t,e,t.dump),f&&(t.dump="&ref_"+h+" "+t.dump));else if(a==="[object String]")t.tag!=="?"&&Xb(t,t.dump,e,s,l);else{if(a==="[object Undefined]")return!1;if(t.skipInvalid)return!1;throw new xe("unacceptable kind of an object to dump "+a)}t.tag!==null&&t.tag!=="?"&&(c=encodeURI(t.tag[0]==="!"?t.tag.slice(1):t.tag).replace(/!/g,"%21"),t.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",t.dump=c+" "+t.dump)}return!0}function r0(t,e){var r=[],i=[],n,s;for(Io(t,r,i),n=0,s=i.length;n<s;n+=1)e.duplicates.push(r[i[n]]);e.usedDuplicates=new Array(s)}function Io(t,e,r){var i,n,s;if(t!==null&&typeof t=="object")if(n=e.indexOf(t),n!==-1)r.indexOf(n)===-1&&r.push(n);else if(e.push(t),Array.isArray(t))for(n=0,s=t.length;n<s;n+=1)Io(t[n],e,r);else for(i=Object.keys(t),n=0,s=i.length;n<s;n+=1)Io(t[i[n]],e,r)}function i0(t,e){e=e||{};var r=new Wb(e);r.noRefs||r0(t,r);var i=t;return r.replacer&&(i=r.replacer.call({"":i},"",i)),pt(r,0,i,!0,!0)?r.dump+`
39
- `:""}var n0=i0,s0={dump:n0};function Bo(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var o0=fe,a0=rh,l0=oh,c0=hh,u0=fh,h0=No,f0=Ch.load,p0=Ch.loadAll,d0=s0.dump,m0=xe,g0={binary:yh,float:uh,map:sh,null:ah,pairs:Eh,set:Sh,timestamp:mh,bool:lh,int:ch,merge:gh,omap:_h,seq:nh,str:ih},y0=Bo("safeLoad","load"),_0=Bo("safeLoadAll","loadAll"),E0=Bo("safeDump","dump"),S0={Type:o0,Schema:a0,FAILSAFE_SCHEMA:l0,JSON_SCHEMA:c0,CORE_SCHEMA:u0,DEFAULT_SCHEMA:h0,load:f0,loadAll:p0,dump:d0,YAMLException:m0,types:g0,safeLoad:y0,safeLoadAll:_0,safeDump:E0},$h=S0;var Bd=U(Cd()),qd=U(require("json5"));var He={};Cu(He,{bold:()=>AR,dimmed:()=>OR,error:()=>Md,grey:()=>CR,info:()=>RR,item:()=>LR,log:()=>qt,turboBlue:()=>qr,turboGradient:()=>vR,turboLoader:()=>Fd,turboRed:()=>Nd,underline:()=>TR,warn:()=>Sl,yellow:()=>Dd});var Bt=U(require("chalk")),Ld=U(require("ora")),Pd=U(require("gradient-string")),Id="#0099F7",kd="#F11712",xR="#FFFF00",vR=(0,Pd.default)(Id,kd),qr=Bt.default.hex(Id),Nd=Bt.default.hex(kd),Dd=Bt.default.hex(xR),Fd=t=>(0,Ld.default)({text:t,spinner:{frames:[" ",qr("> "),qr(">> "),qr(">>>")]}}),RR=(...t)=>{qt(qr.bold(">>>"),...t)},AR=(...t)=>{qt(Bt.default.bold(...t))},TR=(...t)=>{qt(Bt.default.underline(...t))},OR=(...t)=>{qt(Bt.default.dim(...t))},CR=(...t)=>{qt(Bt.default.grey(...t))},LR=(...t)=>{qt(qr.bold(" \u2022"),...t)},qt=(...t)=>{console.log(...t)},Sl=(...t)=>{console.error(Dd.bold(">>>"),...t)},Md=(...t)=>{console.error(Nd.bold(">>>"),...t)};var PR="turbo.json";var bl={};function IR(t){try{if(Li.default.existsSync(lr.default.join(t,"pnpm-workspace.yaml")))return $h.load(Li.default.readFileSync(lr.default.join(t,"pnpm-workspace.yaml"),"utf8")).packages||[];let e=JSON.parse(Li.default.readFileSync(lr.default.join(t,"package.json"),"utf8"));if(e.workspaces){if("packages"in e.workspaces)return e.workspaces.packages||[];if(Array.isArray(e.workspaces))return e.workspaces}return[]}catch{return[]}}function wl(t,e){var s;let r=vo(t,e),i=[],n=(s=e==null?void 0:e.cache)!=null?s:!0;if(n&&t&&t in bl)return bl[t];if(r){let a=IR(r).map(c=>`${c}/turbo.json`);(0,Bd.sync)([PR,...a],{cwd:r,onlyFiles:!0,followSymbolicLinks:!1,suppressErrors:!0}).map(c=>lr.default.join(r,c)).forEach(c=>{try{let u=Li.default.readFileSync(c,"utf8"),h=qd.default.parse(u),f=lr.default.dirname(c)===r;if(f){if("extends"in h)return}else if(!("extends"in h))return;i.push({config:h,turboConfigPath:c,workspacePath:lr.default.dirname(c),isRootConfig:f})}catch(u){Sl(u)}})}return n&&t&&(bl[t]=i),i}var AT=U(require("os")),TT=U(wg());var OT=U(require("fs-extra"));var CT=U(require("path")),LT=U(require("fs-extra")),PT=U(require("chalk"));var bE=require("stream"),wE=require("util"),p1=require("path"),d1=require("os"),xE=require("fs"),m1=U(SE());var Sk=(0,wE.promisify)(bE.Stream.pipeline);var vE=require("fs-extra");var R1=U(require("path")),A1=U(PE()),T1=U(require("chalk")),Tu=require("fs-extra");var uo=U(require("chalk"));var Ve=U(require("chalk")),yi=class{constructor(e){this.transform=e.transformer,this.dry=e.dry}_log(...e){console.log(...e)}modified(...e){this._log(Ve.default.green(" MODIFIED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}unchanged(...e){this._log(Ve.default.gray(" UNCHANGED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}skipped(...e){this._log(Ve.default.yellow(" SKIPPED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}error(...e){this._log(Ve.default.red(" ERROR "),...e,this.dry?Ve.default.dim("(dry run)"):"")}info(...e){this._log(Ve.default.bold(" INFO "),...e,this.dry?Ve.default.dim("(dry run)"):"")}};var IE=U(require("os")),Ou=U(require("path"));var ao=U(require("chalk")),co=require("diff"),Jt=require("fs-extra"),lo=class{constructor(e){this.changes=[];if(this.filePath=e.filePath,this.rootPath=e.rootPath,this.after=e.after,this.error=e.error,e.before===void 0)try{Ou.default.extname(e.filePath)===".json"?this.before=(0,Jt.readJsonSync)(e.filePath):this.before=(0,Jt.readFileSync)(e.filePath)}catch{this.before=""}else e.before===null?this.before="":this.before=e.before;e.after?typeof this.before=="object"||typeof e.after=="object"?this.changes=(0,co.diffJson)(this.before,e.after):this.changes=(0,co.diffLines)(this.before,e.after):this.changes=[]}fileName(){return Ou.default.relative(this.rootPath,this.filePath)}write(){this.after&&(typeof this.after=="object"?(0,Jt.writeJsonSync)(this.filePath,this.after,{spaces:2}):(0,Jt.writeFileSync)(this.filePath,this.after))}additions(){return this.changes.filter(e=>e.added).length}deletions(){return this.changes.filter(e=>e.removed).length}hasChanges(){return this.additions()>0||this.deletions()>0}log(e){e.diff?(this.changes.forEach(r=>{r.added?process.stdout.write(ao.default.green(r.value)):r.removed?process.stdout.write(ao.default.red(r.value)):process.stdout.write(ao.default.dim(r.value))}),He.log(IE.default.EOL)):He.log(this.after)}};var rn=class{constructor(e){this.modifications={};this.transform=e.transformer,this.rootPath=e.rootPath,this.dry=e.dry,this.print=e.print,this.logger=new yi(e)}abortTransform(e){return this.logger.error(e.reason),{fatalError:new Error(e.reason),changes:e.changes||{}}}modifyFile(e){this.modifications[e.filePath]=new lo({rootPath:this.rootPath,...e})}finish(){let e={changes:{}};return Object.keys(this.modifications).forEach(i=>{let n=this.modifications[i],s={action:"unchanged",additions:n.additions(),deletions:n.deletions()};if(n.hasChanges()){if(this.dry)s.action="skipped",this.logger.skipped(uo.default.dim(n.fileName()));else try{n.write(),s.action="modified",this.logger.modified(uo.default.bold(n.fileName()))}catch(o){let a="Unknown error";o instanceof Error&&(a=o.message),s.error=new Error(a),s.action="error",this.logger.error(n.fileName(),a)}this.print&&n.log({diff:!0})}else this.logger.unchanged(uo.default.dim(n.fileName()));e.changes[n.fileName()]=s}),Object.keys(e.changes).some(i=>e.changes[i].action==="error")?this.abortTransform({reason:"Encountered an error while transforming files",changes:e.changes}):e}static logResults(e){let r=Object.keys(e.changes);if(He.log(),r.length>0){He.bold("Results:");let i={};r.forEach(n=>{var o;let s=e.changes[n];i[n]={action:s.action,additions:s.additions,deletions:s.deletions,error:((o=s.error)==null?void 0:o.message)||"None"}}),console.table(i),He.log()}}};function kE({transformer:t,rootPath:e,options:r}){let i={transformer:t,rootPath:e,...r},n=new yi(i),s=new rn(i);return{log:n,runner:s}}var NE=require("fs-extra"),DE=require("json5");function FE(t){let e=(0,NE.readFileSync)(t,"utf8");return(0,DE.parse)(e)}var qE="clean-globs",O1="Automatically clean up invalid globs from your 'turbo.json' file",C1="1.11.0";function HE({root:t,options:e}){let{runner:r}=kE({transformer:qE,rootPath:t,options:e}),i=BE.default.join(t,"turbo.json"),n=FE(i);return r.modifyFile({filePath:i,after:ME(n)}),wl(t).forEach(o=>{let{config:a,turboConfigPath:l}=o;"pipeline"in a&&r.modifyFile({filePath:l,after:ME(a)})}),r.finish()}function ME(t){var r,i;let e=n=>$E(n);for(let[n,s]of Object.entries(t.pipeline))s.inputs=(r=s.inputs)==null?void 0:r.map(e),s.outputs=(i=s.outputs)==null?void 0:i.map(e);return t}function $E(t){let e=t,r=e.replace(/\*\*\/\*\*/g,"**");for(;r!==e;)e=r,r=e.replace(/\*\*\/\*\*/g,"**");return r=e.replace(/(\*\*)([^*/]+)/g,"$1/*$2"),r!==e&&(e=r),r=e.replace(/([^*/]+)(\*\*)/g,"$1*/$2"),r!==e&&(e=r),e}var L1={name:qE,description:O1,introducedIn:C1,transformer:HE},P1=L1;0&&(module.exports={fixGlobPattern,transformer});
39
+ `:""}var n0=i0,s0={dump:n0};function Bo(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var o0=fe,a0=rh,l0=oh,c0=hh,u0=fh,h0=No,f0=Ch.load,p0=Ch.loadAll,d0=s0.dump,m0=xe,g0={binary:yh,float:uh,map:sh,null:ah,pairs:Eh,set:Sh,timestamp:mh,bool:lh,int:ch,merge:gh,omap:_h,seq:nh,str:ih},y0=Bo("safeLoad","load"),_0=Bo("safeLoadAll","loadAll"),E0=Bo("safeDump","dump"),S0={Type:o0,Schema:a0,FAILSAFE_SCHEMA:l0,JSON_SCHEMA:c0,CORE_SCHEMA:u0,DEFAULT_SCHEMA:h0,load:f0,loadAll:p0,dump:d0,YAMLException:m0,types:g0,safeLoad:y0,safeLoadAll:_0,safeDump:E0},$h=S0;var Bd=U(Cd()),qd=U(require("json5"));var He={};Cu(He,{bold:()=>AR,dimmed:()=>OR,error:()=>Md,grey:()=>CR,info:()=>RR,item:()=>LR,log:()=>qt,turboBlue:()=>qr,turboGradient:()=>vR,turboLoader:()=>Fd,turboRed:()=>Nd,underline:()=>TR,warn:()=>Sl,yellow:()=>Dd});var Bt=U(require("chalk")),Ld=U(require("ora")),Pd=U(require("gradient-string")),Id="#0099F7",kd="#F11712",xR="#FFFF00",vR=(0,Pd.default)(Id,kd),qr=Bt.default.hex(Id),Nd=Bt.default.hex(kd),Dd=Bt.default.hex(xR),Fd=t=>(0,Ld.default)({text:t,spinner:{frames:[" ",qr("> "),qr(">> "),qr(">>>")]}}),RR=(...t)=>{qt(qr.bold(">>>"),...t)},AR=(...t)=>{qt(Bt.default.bold(...t))},TR=(...t)=>{qt(Bt.default.underline(...t))},OR=(...t)=>{qt(Bt.default.dim(...t))},CR=(...t)=>{qt(Bt.default.grey(...t))},LR=(...t)=>{qt(qr.bold(" \u2022"),...t)},qt=(...t)=>{console.log(...t)},Sl=(...t)=>{console.error(Dd.bold(">>>"),...t)},Md=(...t)=>{console.error(Nd.bold(">>>"),...t)};var PR="turbo.json";var bl={};function IR(t){try{if(Li.default.existsSync(lr.default.join(t,"pnpm-workspace.yaml")))return $h.load(Li.default.readFileSync(lr.default.join(t,"pnpm-workspace.yaml"),"utf8")).packages||[];let e=JSON.parse(Li.default.readFileSync(lr.default.join(t,"package.json"),"utf8"));if(e.workspaces){if("packages"in e.workspaces)return e.workspaces.packages||[];if(Array.isArray(e.workspaces))return e.workspaces}return[]}catch{return[]}}function wl(t,e){var s;let r=vo(t,e),i=[],n=(s=e==null?void 0:e.cache)!=null?s:!0;if(n&&t&&t in bl)return bl[t];if(r){let a=IR(r).map(c=>`${c}/turbo.json`);(0,Bd.sync)([PR,...a],{cwd:r,onlyFiles:!0,followSymbolicLinks:!1,suppressErrors:!0}).map(c=>lr.default.join(r,c)).forEach(c=>{try{let u=Li.default.readFileSync(c,"utf8"),h=qd.default.parse(u),f=lr.default.dirname(c)===r;if(f){if("extends"in h)return}else if(!("extends"in h))return;i.push({config:h,turboConfigPath:c,workspacePath:lr.default.dirname(c),isRootConfig:f})}catch(u){Sl(u)}})}return n&&t&&(bl[t]=i),i}var AT=U(require("os")),TT=U(wg());var OT=U(require("fs-extra"));var CT=U(require("path")),LT=U(require("fs-extra")),PT=U(require("chalk"));var bE=require("stream"),wE=require("util"),p1=require("path"),d1=require("os"),xE=require("fs"),m1=U(SE());var Sk=(0,wE.promisify)(bE.Stream.pipeline);var vE=require("fs-extra");var R1=U(require("path")),A1=U(PE()),T1=U(require("chalk")),Tu=require("fs-extra");var uo=U(require("chalk"));var Ve=U(require("chalk")),yi=class{constructor(e){this.transform=e.transformer,this.dry=e.dryRun}_log(...e){console.log(...e)}modified(...e){this._log(Ve.default.green(" MODIFIED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}unchanged(...e){this._log(Ve.default.gray(" UNCHANGED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}skipped(...e){this._log(Ve.default.yellow(" SKIPPED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}error(...e){this._log(Ve.default.red(" ERROR "),...e,this.dry?Ve.default.dim("(dry run)"):"")}info(...e){this._log(Ve.default.bold(" INFO "),...e,this.dry?Ve.default.dim("(dry run)"):"")}};var IE=U(require("os")),Ou=U(require("path"));var ao=U(require("chalk")),co=require("diff"),Jt=require("fs-extra"),lo=class{constructor(e){this.changes=[];if(this.filePath=e.filePath,this.rootPath=e.rootPath,this.after=e.after,this.error=e.error,e.before===void 0)try{Ou.default.extname(e.filePath)===".json"?this.before=(0,Jt.readJsonSync)(e.filePath):this.before=(0,Jt.readFileSync)(e.filePath)}catch{this.before=""}else e.before===null?this.before="":this.before=e.before;e.after?typeof this.before=="object"||typeof e.after=="object"?this.changes=(0,co.diffJson)(this.before,e.after):this.changes=(0,co.diffLines)(this.before,e.after):this.changes=[]}fileName(){return Ou.default.relative(this.rootPath,this.filePath)}write(){this.after&&(typeof this.after=="object"?(0,Jt.writeJsonSync)(this.filePath,this.after,{spaces:2}):(0,Jt.writeFileSync)(this.filePath,this.after))}additions(){return this.changes.filter(e=>e.added).length}deletions(){return this.changes.filter(e=>e.removed).length}hasChanges(){return this.additions()>0||this.deletions()>0}log(e){e.diff?(this.changes.forEach(r=>{r.added?process.stdout.write(ao.default.green(r.value)):r.removed?process.stdout.write(ao.default.red(r.value)):process.stdout.write(ao.default.dim(r.value))}),He.log(IE.default.EOL)):He.log(this.after)}};var rn=class{constructor(e){this.modifications={};this.transform=e.transformer,this.rootPath=e.rootPath,this.dry=e.dryRun,this.print=e.print,this.logger=new yi(e)}abortTransform(e){return this.logger.error(e.reason),{fatalError:new Error(e.reason),changes:e.changes||{}}}modifyFile(e){this.modifications[e.filePath]=new lo({rootPath:this.rootPath,...e})}finish(){let e={changes:{}};return Object.keys(this.modifications).forEach(i=>{let n=this.modifications[i],s={action:"unchanged",additions:n.additions(),deletions:n.deletions()};if(n.hasChanges()){if(this.dry)s.action="skipped",this.logger.skipped(uo.default.dim(n.fileName()));else try{n.write(),s.action="modified",this.logger.modified(uo.default.bold(n.fileName()))}catch(o){let a="Unknown error";o instanceof Error&&(a=o.message),s.error=new Error(a),s.action="error",this.logger.error(n.fileName(),a)}this.print&&n.log({diff:!0})}else this.logger.unchanged(uo.default.dim(n.fileName()));e.changes[n.fileName()]=s}),Object.keys(e.changes).some(i=>e.changes[i].action==="error")?this.abortTransform({reason:"Encountered an error while transforming files",changes:e.changes}):e}static logResults(e){let r=Object.keys(e.changes);if(He.log(),r.length>0){He.bold("Results:");let i={};r.forEach(n=>{var o;let s=e.changes[n];i[n]={action:s.action,additions:s.additions,deletions:s.deletions,error:((o=s.error)==null?void 0:o.message)||"None"}}),console.table(i),He.log()}}};function kE({transformer:t,rootPath:e,options:r}){let i={transformer:t,rootPath:e,...r},n=new yi(i),s=new rn(i);return{log:n,runner:s}}var NE=require("fs-extra"),DE=require("json5");function FE(t){let e=(0,NE.readFileSync)(t,"utf8");return(0,DE.parse)(e)}var qE="clean-globs",O1="Automatically clean up invalid globs from your 'turbo.json' file",C1="1.11.0";function HE({root:t,options:e}){let{runner:r}=kE({transformer:qE,rootPath:t,options:e}),i=BE.default.join(t,"turbo.json"),n=FE(i);return r.modifyFile({filePath:i,after:ME(n)}),wl(t).forEach(o=>{let{config:a,turboConfigPath:l}=o;"pipeline"in a&&r.modifyFile({filePath:l,after:ME(a)})}),r.finish()}function ME(t){var r,i;let e=n=>$E(n);for(let[n,s]of Object.entries(t.pipeline))s.inputs=(r=s.inputs)==null?void 0:r.map(e),s.outputs=(i=s.outputs)==null?void 0:i.map(e);return t}function $E(t){let e=t,r=e.replace(/\*\*\/\*\*/g,"**");for(;r!==e;)e=r,r=e.replace(/\*\*\/\*\*/g,"**");return r=e.replace(/(\*\*)([^*/]+)/g,"$1/*$2"),r!==e&&(e=r),r=e.replace(/([^*/]+)(\*\*)/g,"$1*/$2"),r!==e&&(e=r),e}var L1={name:qE,description:O1,introducedIn:C1,transformer:HE},P1=L1;0&&(module.exports={fixGlobPattern,transformer});
40
40
  /*! Bundled license information:
41
41
 
42
42
  @babel/runtime/helpers/regeneratorRuntime.js:
@@ -36,7 +36,7 @@ ${i.message}`:y,R=[x,e,t].filter(Boolean).join(`
36
36
  `+t.slice(n,s),n=s+1),o=a;return l+=`
37
37
  `,t.length-n>e&&o>n?l+=t.slice(n,o)+`
38
38
  `+t.slice(o+1):l+=t.slice(n),l.slice(1)}function Ib(t){for(var e="",r=0,i,n=0;n<t.length;r>=65536?n+=2:n++)r=Ei(t,n),i=pe[r],!i&&xi(r)?(e+=t[n],r>=65536&&(e+=t[n+1])):e+=i||xb(r);return e}function kb(t,e,r){var i="",n=t.tag,s,o,a;for(s=0,o=r.length;s<o;s+=1)a=r[s],t.replacer&&(a=t.replacer.call(r,String(s),a)),(pt(t,e,a,!1,!1)||typeof a=="undefined"&&pt(t,e,null,!1,!1))&&(i!==""&&(i+=","+(t.condenseFlow?"":" ")),i+=t.dump);t.tag=n,t.dump="["+i+"]"}function qu(t,e,r,i){var n="",s=t.tag,o,a,l;for(o=0,a=r.length;o<a;o+=1)l=r[o],t.replacer&&(l=t.replacer.call(r,String(o),l)),(pt(t,e+1,l,!0,!0,!1,!0)||typeof l=="undefined"&&pt(t,e+1,null,!0,!0,!1,!0))&&((!i||n!=="")&&(n+=bo(t,e)),t.dump&&bi===t.dump.charCodeAt(0)?n+="-":n+="- ",n+=t.dump);t.tag=s,t.dump=n||"[]"}function Nb(t,e,r){var i="",n=t.tag,s=Object.keys(r),o,a,l,c,u;for(o=0,a=s.length;o<a;o+=1)u="",i!==""&&(u+=", "),t.condenseFlow&&(u+='"'),l=s[o],c=r[l],t.replacer&&(c=t.replacer.call(r,l,c)),pt(t,e,l,!1,!1)&&(t.dump.length>1024&&(u+="? "),u+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),pt(t,e,c,!1,!1)&&(u+=t.dump,i+=u));t.tag=n,t.dump="{"+i+"}"}function Db(t,e,r,i){var n="",s=t.tag,o=Object.keys(r),a,l,c,u,h,f;if(t.sortKeys===!0)o.sort();else if(typeof t.sortKeys=="function")o.sort(t.sortKeys);else if(t.sortKeys)throw new xe("sortKeys must be a boolean or a function");for(a=0,l=o.length;a<l;a+=1)f="",(!i||n!=="")&&(f+=bo(t,e)),c=o[a],u=r[c],t.replacer&&(u=t.replacer.call(r,c,u)),pt(t,e+1,c,!0,!0,!0)&&(h=t.tag!==null&&t.tag!=="?"||t.dump&&t.dump.length>1024,h&&(t.dump&&bi===t.dump.charCodeAt(0)?f+="?":f+="? "),f+=t.dump,h&&(f+=bo(t,e)),pt(t,e+1,u,!0,h)&&(t.dump&&bi===t.dump.charCodeAt(0)?f+=":":f+=": ",f+=t.dump,n+=f));t.tag=s,t.dump=n||"{}"}function Hu(t,e,r){var i,n,s,o,a,l;for(n=r?t.explicitTypes:t.implicitTypes,s=0,o=n.length;s<o;s+=1)if(a=n[s],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof e=="object"&&e instanceof a.instanceOf)&&(!a.predicate||a.predicate(e))){if(r?a.multi&&a.representName?t.tag=a.representName(e):t.tag=a.tag:t.tag="?",a.represent){if(l=t.styleMap[a.tag]||a.defaultStyle,th.call(a.represent)==="[object Function]")i=a.represent(e,l);else if(rh.call(a.represent,l))i=a.represent[l](e,l);else throw new xe("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');t.dump=i}return!0}return!1}function pt(t,e,r,i,n,s,o){t.tag=null,t.dump=r,Hu(t,r,!1)||Hu(t,r,!0);var a=th.call(t.dump),l=i,c;i&&(i=t.flowLevel<0||t.flowLevel>e);var u=a==="[object Object]"||a==="[object Array]",h,f;if(u&&(h=t.duplicates.indexOf(r),f=h!==-1),(t.tag!==null&&t.tag!=="?"||f||t.indent!==2&&e>0)&&(n=!1),f&&t.usedDuplicates[h])t.dump="*ref_"+h;else{if(u&&f&&!t.usedDuplicates[h]&&(t.usedDuplicates[h]=!0),a==="[object Object]")i&&Object.keys(t.dump).length!==0?(Db(t,e,t.dump,n),f&&(t.dump="&ref_"+h+t.dump)):(Nb(t,e,t.dump),f&&(t.dump="&ref_"+h+" "+t.dump));else if(a==="[object Array]")i&&t.dump.length!==0?(t.noArrayIndent&&!o&&e>0?qu(t,e-1,t.dump,n):qu(t,e,t.dump,n),f&&(t.dump="&ref_"+h+t.dump)):(kb(t,e,t.dump),f&&(t.dump="&ref_"+h+" "+t.dump));else if(a==="[object String]")t.tag!=="?"&&Lb(t,t.dump,e,s,l);else{if(a==="[object Undefined]")return!1;if(t.skipInvalid)return!1;throw new xe("unacceptable kind of an object to dump "+a)}t.tag!==null&&t.tag!=="?"&&(c=encodeURI(t.tag[0]==="!"?t.tag.slice(1):t.tag).replace(/!/g,"%21"),t.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",t.dump=c+" "+t.dump)}return!0}function Fb(t,e){var r=[],i=[],n,s;for(xo(t,r,i),n=0,s=i.length;n<s;n+=1)e.duplicates.push(r[i[n]]);e.usedDuplicates=new Array(s)}function xo(t,e,r){var i,n,s;if(t!==null&&typeof t=="object")if(n=e.indexOf(t),n!==-1)r.indexOf(n)===-1&&r.push(n);else if(e.push(t),Array.isArray(t))for(n=0,s=t.length;n<s;n+=1)xo(t[n],e,r);else for(i=Object.keys(t),n=0,s=i.length;n<s;n+=1)xo(t[i[n]],e,r)}function Mb(t,e){e=e||{};var r=new Rb(e);r.noRefs||Fb(t,r);var i=t;return r.replacer&&(i=r.replacer.call({"":i},"",i)),pt(r,0,i,!0,!0)?r.dump+`
39
- `:""}var Bb=Mb,qb={dump:Bb};function Oo(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var H1=eh.load,U1=eh.loadAll,$1=qb.dump;var G1=Oo("safeLoad","load"),j1=Oo("safeLoadAll","loadAll"),W1=Oo("safeDump","dump");var Jv=G(Jp()),eR=G(require("json5"));var He={};yu(He,{bold:()=>Wv,dimmed:()=>zv,error:()=>ld,grey:()=>Kv,info:()=>jv,item:()=>Vv,log:()=>qt,turboBlue:()=>Br,turboGradient:()=>Gv,turboLoader:()=>od,turboRed:()=>nd,underline:()=>Yv,warn:()=>ad,yellow:()=>sd});var Bt=G(require("chalk")),ed=G(require("ora")),td=G(require("gradient-string")),rd="#0099F7",id="#F11712",$v="#FFFF00",Gv=(0,td.default)(rd,id),Br=Bt.default.hex(rd),nd=Bt.default.hex(id),sd=Bt.default.hex($v),od=t=>(0,ed.default)({text:t,spinner:{frames:[" ",Br("> "),Br(">> "),Br(">>>")]}}),jv=(...t)=>{qt(Br.bold(">>>"),...t)},Wv=(...t)=>{qt(Bt.default.bold(...t))},Yv=(...t)=>{qt(Bt.default.underline(...t))},zv=(...t)=>{qt(Bt.default.dim(...t))},Kv=(...t)=>{qt(Bt.default.grey(...t))},Vv=(...t)=>{qt(Br.bold(" \u2022"),...t)},qt=(...t)=>{console.log(...t)},ad=(...t)=>{console.error(sd.bold(">>>"),...t)},ld=(...t)=>{console.error(nd.bold(">>>"),...t)};var KA=G(require("os")),VA=G(Wm());var XA=G(require("fs-extra"));var ZA=G(require("path")),QA=G(require("fs-extra")),JA=G(require("chalk"));var j_=require("stream"),W_=require("util"),DC=require("path"),FC=require("os"),Y_=require("fs"),MC=G(G_());var ZI=(0,W_.promisify)(j_.Stream.pipeline);var z_=require("fs-extra");var zC=G(require("path")),KC=G(eE()),VC=G(require("chalk")),du=require("fs-extra");var Ve=G(require("chalk")),gi=class{constructor(e){this.transform=e.transformer,this.dry=e.dry}_log(...e){console.log(...e)}modified(...e){this._log(Ve.default.green(" MODIFIED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}unchanged(...e){this._log(Ve.default.gray(" UNCHANGED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}skipped(...e){this._log(Ve.default.yellow(" SKIPPED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}error(...e){this._log(Ve.default.red(" ERROR "),...e,this.dry?Ve.default.dim("(dry run)"):"")}info(...e){this._log(Ve.default.bold(" INFO "),...e,this.dry?Ve.default.dim("(dry run)"):"")}};var tE=G(require("os")),mu=G(require("path"));var io=G(require("chalk")),so=require("diff"),Jt=require("fs-extra"),no=class{constructor(e){this.changes=[];if(this.filePath=e.filePath,this.rootPath=e.rootPath,this.after=e.after,this.error=e.error,e.before===void 0)try{mu.default.extname(e.filePath)===".json"?this.before=(0,Jt.readJsonSync)(e.filePath):this.before=(0,Jt.readFileSync)(e.filePath)}catch{this.before=""}else e.before===null?this.before="":this.before=e.before;e.after?typeof this.before=="object"||typeof e.after=="object"?this.changes=(0,so.diffJson)(this.before,e.after):this.changes=(0,so.diffLines)(this.before,e.after):this.changes=[]}fileName(){return mu.default.relative(this.rootPath,this.filePath)}write(){this.after&&(typeof this.after=="object"?(0,Jt.writeJsonSync)(this.filePath,this.after,{spaces:2}):(0,Jt.writeFileSync)(this.filePath,this.after))}additions(){return this.changes.filter(e=>e.added).length}deletions(){return this.changes.filter(e=>e.removed).length}hasChanges(){return this.additions()>0||this.deletions()>0}log(e){e.diff?(this.changes.forEach(r=>{r.added?process.stdout.write(io.default.green(r.value)):r.removed?process.stdout.write(io.default.red(r.value)):process.stdout.write(io.default.dim(r.value))}),He.log(tE.default.EOL)):He.log(this.after)}};var Ji=class{constructor(e){this.modifications={};this.transform=e.transformer,this.rootPath=e.rootPath,this.dry=e.dry,this.print=e.print,this.logger=new gi(e)}abortTransform(e){return this.logger.error(e.reason),{fatalError:new Error(e.reason),changes:e.changes||{}}}modifyFile(e){this.modifications[e.filePath]=new no({rootPath:this.rootPath,...e})}finish(){let e={changes:{}};return Object.keys(this.modifications).forEach(i=>{let n=this.modifications[i],s={action:"unchanged",additions:n.additions(),deletions:n.deletions()};if(n.hasChanges()){if(this.dry)s.action="skipped",this.logger.skipped(oo.default.dim(n.fileName()));else try{n.write(),s.action="modified",this.logger.modified(oo.default.bold(n.fileName()))}catch(o){let a="Unknown error";o instanceof Error&&(a=o.message),s.error=new Error(a),s.action="error",this.logger.error(n.fileName(),a)}this.print&&n.log({diff:!0})}else this.logger.unchanged(oo.default.dim(n.fileName()));e.changes[n.fileName()]=s}),Object.keys(e.changes).some(i=>e.changes[i].action==="error")?this.abortTransform({reason:"Encountered an error while transforming files",changes:e.changes}):e}static logResults(e){let r=Object.keys(e.changes);if(He.log(),r.length>0){He.bold("Results:");let i={};r.forEach(n=>{var o;let s=e.changes[n];i[n]={action:s.action,additions:s.additions,deletions:s.deletions,error:((o=s.error)==null?void 0:o.message)||"None"}}),console.table(i),He.log()}}};function rE({transformer:t,rootPath:e,options:r}){let i={transformer:t,rootPath:e,...r},n=new gi(i),s=new Ji(i);return{log:n,runner:s}}var iE="create-turbo-config",XC='Create the `turbo.json` file from an existing "turbo" key in `package.json`',ZC="1.1.0";function nE({root:t,options:e}){let{log:r,runner:i}=rE({transformer:iE,rootPath:t,options:e});r.info('Migrating "package.json" "turbo" key to "turbo.json" file...');let n=gu.default.join(t,"turbo.json"),s=gu.default.join(t,"package.json");if(!(0,en.existsSync)(s))return i.abortTransform({reason:`No package.json found at ${t}. Is the path correct?`});let o=(0,en.readJsonSync)(s),a=null;try{a=(0,en.readJsonSync)(n)}catch{a=null}let l=o,c=a;if(!a&&o.turbo){let{turbo:u,...h}=o;c=u,l=h}return i.modifyFile({filePath:n,after:c}),i.modifyFile({filePath:s,after:l}),i.finish()}var QC={name:iE,description:XC,introducedIn:ZC,transformer:nE},JC=QC;0&&(module.exports={transformer});
39
+ `:""}var Bb=Mb,qb={dump:Bb};function Oo(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var H1=eh.load,U1=eh.loadAll,$1=qb.dump;var G1=Oo("safeLoad","load"),j1=Oo("safeLoadAll","loadAll"),W1=Oo("safeDump","dump");var Jv=G(Jp()),eR=G(require("json5"));var He={};yu(He,{bold:()=>Wv,dimmed:()=>zv,error:()=>ld,grey:()=>Kv,info:()=>jv,item:()=>Vv,log:()=>qt,turboBlue:()=>Br,turboGradient:()=>Gv,turboLoader:()=>od,turboRed:()=>nd,underline:()=>Yv,warn:()=>ad,yellow:()=>sd});var Bt=G(require("chalk")),ed=G(require("ora")),td=G(require("gradient-string")),rd="#0099F7",id="#F11712",$v="#FFFF00",Gv=(0,td.default)(rd,id),Br=Bt.default.hex(rd),nd=Bt.default.hex(id),sd=Bt.default.hex($v),od=t=>(0,ed.default)({text:t,spinner:{frames:[" ",Br("> "),Br(">> "),Br(">>>")]}}),jv=(...t)=>{qt(Br.bold(">>>"),...t)},Wv=(...t)=>{qt(Bt.default.bold(...t))},Yv=(...t)=>{qt(Bt.default.underline(...t))},zv=(...t)=>{qt(Bt.default.dim(...t))},Kv=(...t)=>{qt(Bt.default.grey(...t))},Vv=(...t)=>{qt(Br.bold(" \u2022"),...t)},qt=(...t)=>{console.log(...t)},ad=(...t)=>{console.error(sd.bold(">>>"),...t)},ld=(...t)=>{console.error(nd.bold(">>>"),...t)};var KA=G(require("os")),VA=G(Wm());var XA=G(require("fs-extra"));var ZA=G(require("path")),QA=G(require("fs-extra")),JA=G(require("chalk"));var j_=require("stream"),W_=require("util"),DC=require("path"),FC=require("os"),Y_=require("fs"),MC=G(G_());var ZI=(0,W_.promisify)(j_.Stream.pipeline);var z_=require("fs-extra");var zC=G(require("path")),KC=G(eE()),VC=G(require("chalk")),du=require("fs-extra");var Ve=G(require("chalk")),gi=class{constructor(e){this.transform=e.transformer,this.dry=e.dryRun}_log(...e){console.log(...e)}modified(...e){this._log(Ve.default.green(" MODIFIED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}unchanged(...e){this._log(Ve.default.gray(" UNCHANGED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}skipped(...e){this._log(Ve.default.yellow(" SKIPPED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}error(...e){this._log(Ve.default.red(" ERROR "),...e,this.dry?Ve.default.dim("(dry run)"):"")}info(...e){this._log(Ve.default.bold(" INFO "),...e,this.dry?Ve.default.dim("(dry run)"):"")}};var tE=G(require("os")),mu=G(require("path"));var io=G(require("chalk")),so=require("diff"),Jt=require("fs-extra"),no=class{constructor(e){this.changes=[];if(this.filePath=e.filePath,this.rootPath=e.rootPath,this.after=e.after,this.error=e.error,e.before===void 0)try{mu.default.extname(e.filePath)===".json"?this.before=(0,Jt.readJsonSync)(e.filePath):this.before=(0,Jt.readFileSync)(e.filePath)}catch{this.before=""}else e.before===null?this.before="":this.before=e.before;e.after?typeof this.before=="object"||typeof e.after=="object"?this.changes=(0,so.diffJson)(this.before,e.after):this.changes=(0,so.diffLines)(this.before,e.after):this.changes=[]}fileName(){return mu.default.relative(this.rootPath,this.filePath)}write(){this.after&&(typeof this.after=="object"?(0,Jt.writeJsonSync)(this.filePath,this.after,{spaces:2}):(0,Jt.writeFileSync)(this.filePath,this.after))}additions(){return this.changes.filter(e=>e.added).length}deletions(){return this.changes.filter(e=>e.removed).length}hasChanges(){return this.additions()>0||this.deletions()>0}log(e){e.diff?(this.changes.forEach(r=>{r.added?process.stdout.write(io.default.green(r.value)):r.removed?process.stdout.write(io.default.red(r.value)):process.stdout.write(io.default.dim(r.value))}),He.log(tE.default.EOL)):He.log(this.after)}};var Ji=class{constructor(e){this.modifications={};this.transform=e.transformer,this.rootPath=e.rootPath,this.dry=e.dryRun,this.print=e.print,this.logger=new gi(e)}abortTransform(e){return this.logger.error(e.reason),{fatalError:new Error(e.reason),changes:e.changes||{}}}modifyFile(e){this.modifications[e.filePath]=new no({rootPath:this.rootPath,...e})}finish(){let e={changes:{}};return Object.keys(this.modifications).forEach(i=>{let n=this.modifications[i],s={action:"unchanged",additions:n.additions(),deletions:n.deletions()};if(n.hasChanges()){if(this.dry)s.action="skipped",this.logger.skipped(oo.default.dim(n.fileName()));else try{n.write(),s.action="modified",this.logger.modified(oo.default.bold(n.fileName()))}catch(o){let a="Unknown error";o instanceof Error&&(a=o.message),s.error=new Error(a),s.action="error",this.logger.error(n.fileName(),a)}this.print&&n.log({diff:!0})}else this.logger.unchanged(oo.default.dim(n.fileName()));e.changes[n.fileName()]=s}),Object.keys(e.changes).some(i=>e.changes[i].action==="error")?this.abortTransform({reason:"Encountered an error while transforming files",changes:e.changes}):e}static logResults(e){let r=Object.keys(e.changes);if(He.log(),r.length>0){He.bold("Results:");let i={};r.forEach(n=>{var o;let s=e.changes[n];i[n]={action:s.action,additions:s.additions,deletions:s.deletions,error:((o=s.error)==null?void 0:o.message)||"None"}}),console.table(i),He.log()}}};function rE({transformer:t,rootPath:e,options:r}){let i={transformer:t,rootPath:e,...r},n=new gi(i),s=new Ji(i);return{log:n,runner:s}}var iE="create-turbo-config",XC='Create the `turbo.json` file from an existing "turbo" key in `package.json`',ZC="1.1.0";function nE({root:t,options:e}){let{log:r,runner:i}=rE({transformer:iE,rootPath:t,options:e});r.info('Migrating "package.json" "turbo" key to "turbo.json" file...');let n=gu.default.join(t,"turbo.json"),s=gu.default.join(t,"package.json");if(!(0,en.existsSync)(s))return i.abortTransform({reason:`No package.json found at ${t}. Is the path correct?`});let o=(0,en.readJsonSync)(s),a=null;try{a=(0,en.readJsonSync)(n)}catch{a=null}let l=o,c=a;if(!a&&o.turbo){let{turbo:u,...h}=o;c=u,l=h}return i.modifyFile({filePath:n,after:c}),i.modifyFile({filePath:s,after:l}),i.finish()}var QC={name:iE,description:XC,introducedIn:ZC,transformer:nE},JC=QC;0&&(module.exports={transformer});
40
40
  /*! Bundled license information:
41
41
 
42
42
  @babel/runtime/helpers/regeneratorRuntime.js:
@@ -36,7 +36,7 @@ ${i.message}`:y,R=[x,e,t].filter(Boolean).join(`
36
36
  `+t.slice(n,s),n=s+1),o=a;return l+=`
37
37
  `,t.length-n>e&&o>n?l+=t.slice(n,o)+`
38
38
  `+t.slice(o+1):l+=t.slice(n),l.slice(1)}function Jb(t){for(var e="",r=0,i,n=0;n<t.length;r>=65536?n+=2:n++)r=bi(t,n),i=pe[r],!i&&Ri(r)?(e+=t[n],r>=65536&&(e+=t[n+1])):e+=i||jb(r);return e}function e0(t,e,r){var i="",n=t.tag,s,o,a;for(s=0,o=r.length;s<o;s+=1)a=r[s],t.replacer&&(a=t.replacer.call(r,String(s),a)),(pt(t,e,a,!1,!1)||typeof a=="undefined"&&pt(t,e,null,!1,!1))&&(i!==""&&(i+=","+(t.condenseFlow?"":" ")),i+=t.dump);t.tag=n,t.dump="["+i+"]"}function th(t,e,r,i){var n="",s=t.tag,o,a,l;for(o=0,a=r.length;o<a;o+=1)l=r[o],t.replacer&&(l=t.replacer.call(r,String(o),l)),(pt(t,e+1,l,!0,!0,!1,!0)||typeof l=="undefined"&&pt(t,e+1,null,!0,!0,!1,!0))&&((!i||n!=="")&&(n+=Po(t,e)),t.dump&&xi===t.dump.charCodeAt(0)?n+="-":n+="- ",n+=t.dump);t.tag=s,t.dump=n||"[]"}function t0(t,e,r){var i="",n=t.tag,s=Object.keys(r),o,a,l,c,u;for(o=0,a=s.length;o<a;o+=1)u="",i!==""&&(u+=", "),t.condenseFlow&&(u+='"'),l=s[o],c=r[l],t.replacer&&(c=t.replacer.call(r,l,c)),pt(t,e,l,!1,!1)&&(t.dump.length>1024&&(u+="? "),u+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),pt(t,e,c,!1,!1)&&(u+=t.dump,i+=u));t.tag=n,t.dump="{"+i+"}"}function r0(t,e,r,i){var n="",s=t.tag,o=Object.keys(r),a,l,c,u,h,f;if(t.sortKeys===!0)o.sort();else if(typeof t.sortKeys=="function")o.sort(t.sortKeys);else if(t.sortKeys)throw new xe("sortKeys must be a boolean or a function");for(a=0,l=o.length;a<l;a+=1)f="",(!i||n!=="")&&(f+=Po(t,e)),c=o[a],u=r[c],t.replacer&&(u=t.replacer.call(r,c,u)),pt(t,e+1,c,!0,!0,!0)&&(h=t.tag!==null&&t.tag!=="?"||t.dump&&t.dump.length>1024,h&&(t.dump&&xi===t.dump.charCodeAt(0)?f+="?":f+="? "),f+=t.dump,h&&(f+=Po(t,e)),pt(t,e+1,u,!0,h)&&(t.dump&&xi===t.dump.charCodeAt(0)?f+=":":f+=": ",f+=t.dump,n+=f));t.tag=s,t.dump=n||"{}"}function rh(t,e,r){var i,n,s,o,a,l;for(n=r?t.explicitTypes:t.implicitTypes,s=0,o=n.length;s<o;s+=1)if(a=n[s],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof e=="object"&&e instanceof a.instanceOf)&&(!a.predicate||a.predicate(e))){if(r?a.multi&&a.representName?t.tag=a.representName(e):t.tag=a.tag:t.tag="?",a.represent){if(l=t.styleMap[a.tag]||a.defaultStyle,kh.call(a.represent)==="[object Function]")i=a.represent(e,l);else if(Nh.call(a.represent,l))i=a.represent[l](e,l);else throw new xe("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');t.dump=i}return!0}return!1}function pt(t,e,r,i,n,s,o){t.tag=null,t.dump=r,rh(t,r,!1)||rh(t,r,!0);var a=kh.call(t.dump),l=i,c;i&&(i=t.flowLevel<0||t.flowLevel>e);var u=a==="[object Object]"||a==="[object Array]",h,f;if(u&&(h=t.duplicates.indexOf(r),f=h!==-1),(t.tag!==null&&t.tag!=="?"||f||t.indent!==2&&e>0)&&(n=!1),f&&t.usedDuplicates[h])t.dump="*ref_"+h;else{if(u&&f&&!t.usedDuplicates[h]&&(t.usedDuplicates[h]=!0),a==="[object Object]")i&&Object.keys(t.dump).length!==0?(r0(t,e,t.dump,n),f&&(t.dump="&ref_"+h+t.dump)):(t0(t,e,t.dump),f&&(t.dump="&ref_"+h+" "+t.dump));else if(a==="[object Array]")i&&t.dump.length!==0?(t.noArrayIndent&&!o&&e>0?th(t,e-1,t.dump,n):th(t,e,t.dump,n),f&&(t.dump="&ref_"+h+t.dump)):(e0(t,e,t.dump),f&&(t.dump="&ref_"+h+" "+t.dump));else if(a==="[object String]")t.tag!=="?"&&Zb(t,t.dump,e,s,l);else{if(a==="[object Undefined]")return!1;if(t.skipInvalid)return!1;throw new xe("unacceptable kind of an object to dump "+a)}t.tag!==null&&t.tag!=="?"&&(c=encodeURI(t.tag[0]==="!"?t.tag.slice(1):t.tag).replace(/!/g,"%21"),t.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",t.dump=c+" "+t.dump)}return!0}function i0(t,e){var r=[],i=[],n,s;for(ko(t,r,i),n=0,s=i.length;n<s;n+=1)e.duplicates.push(r[i[n]]);e.usedDuplicates=new Array(s)}function ko(t,e,r){var i,n,s;if(t!==null&&typeof t=="object")if(n=e.indexOf(t),n!==-1)r.indexOf(n)===-1&&r.push(n);else if(e.push(t),Array.isArray(t))for(n=0,s=t.length;n<s;n+=1)ko(t[n],e,r);else for(i=Object.keys(t),n=0,s=i.length;n<s;n+=1)ko(t[i[n]],e,r)}function n0(t,e){e=e||{};var r=new Yb(e);r.noRefs||i0(t,r);var i=t;return r.replacer&&(i=r.replacer.call({"":i},"",i)),pt(r,0,i,!0,!0)?r.dump+`
39
- `:""}var s0=n0,o0={dump:s0};function qo(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var a0=fe,l0=sh,c0=ch,u0=dh,h0=mh,f0=Do,p0=Ih.load,d0=Ih.loadAll,m0=o0.dump,g0=xe,y0={binary:Sh,float:ph,map:lh,null:uh,pairs:wh,set:xh,timestamp:_h,bool:hh,int:fh,merge:Eh,omap:bh,seq:ah,str:oh},_0=qo("safeLoad","load"),E0=qo("safeLoadAll","loadAll"),S0=qo("safeDump","dump"),b0={Type:a0,Schema:l0,FAILSAFE_SCHEMA:c0,JSON_SCHEMA:u0,CORE_SCHEMA:h0,DEFAULT_SCHEMA:f0,load:p0,loadAll:d0,dump:m0,YAMLException:g0,types:y0,safeLoad:_0,safeLoadAll:E0,safeDump:S0},jh=b0;var Ud=$(Id()),$d=$(require("json5"));var He={};Iu(He,{bold:()=>TR,dimmed:()=>CR,error:()=>Hd,grey:()=>LR,info:()=>AR,item:()=>PR,log:()=>qt,turboBlue:()=>qr,turboGradient:()=>RR,turboLoader:()=>qd,turboRed:()=>Md,underline:()=>OR,warn:()=>bl,yellow:()=>Bd});var Bt=$(require("chalk")),kd=$(require("ora")),Nd=$(require("gradient-string")),Dd="#0099F7",Fd="#F11712",vR="#FFFF00",RR=(0,Nd.default)(Dd,Fd),qr=Bt.default.hex(Dd),Md=Bt.default.hex(Fd),Bd=Bt.default.hex(vR),qd=t=>(0,kd.default)({text:t,spinner:{frames:[" ",qr("> "),qr(">> "),qr(">>>")]}}),AR=(...t)=>{qt(qr.bold(">>>"),...t)},TR=(...t)=>{qt(Bt.default.bold(...t))},OR=(...t)=>{qt(Bt.default.underline(...t))},CR=(...t)=>{qt(Bt.default.dim(...t))},LR=(...t)=>{qt(Bt.default.grey(...t))},PR=(...t)=>{qt(qr.bold(" \u2022"),...t)},qt=(...t)=>{console.log(...t)},bl=(...t)=>{console.error(Bd.bold(">>>"),...t)},Hd=(...t)=>{console.error(Md.bold(">>>"),...t)};var IR="turbo.json";var wl={};function kR(t){try{if(Li.default.existsSync(lr.default.join(t,"pnpm-workspace.yaml")))return jh.load(Li.default.readFileSync(lr.default.join(t,"pnpm-workspace.yaml"),"utf8")).packages||[];let e=JSON.parse(Li.default.readFileSync(lr.default.join(t,"package.json"),"utf8"));if(e.workspaces){if("packages"in e.workspaces)return e.workspaces.packages||[];if(Array.isArray(e.workspaces))return e.workspaces}return[]}catch{return[]}}function xl(t,e){var s;let r=Ro(t,e),i=[],n=(s=e==null?void 0:e.cache)!=null?s:!0;if(n&&t&&t in wl)return wl[t];if(r){let a=kR(r).map(c=>`${c}/turbo.json`);(0,Ud.sync)([IR,...a],{cwd:r,onlyFiles:!0,followSymbolicLinks:!1,suppressErrors:!0}).map(c=>lr.default.join(r,c)).forEach(c=>{try{let u=Li.default.readFileSync(c,"utf8"),h=$d.default.parse(u),f=lr.default.dirname(c)===r;if(f){if("extends"in h)return}else if(!("extends"in h))return;i.push({config:h,turboConfigPath:c,workspacePath:lr.default.dirname(c),isRootConfig:f})}catch(u){bl(u)}})}return n&&t&&(wl[t]=i),i}function vl(t,e){"pipeline"in t?Object.entries(t.pipeline).forEach(e):Object.entries(t.tasks).forEach(e)}var TT=$(require("os")),OT=$(Rg());var CT=$(require("fs-extra"));var LT=$(require("path")),PT=$(require("fs-extra")),IT=$(require("chalk"));var vE=require("stream"),RE=require("util"),dL=require("path"),mL=require("os"),AE=require("fs"),gL=$(xE());var bk=(0,RE.promisify)(vE.Stream.pipeline);var TE=require("fs-extra");var AL=$(require("path")),TL=$(NE()),OL=$(require("chalk")),Cu=require("fs-extra");var uo=$(require("chalk"));var Ve=$(require("chalk")),yi=class{constructor(e){this.transform=e.transformer,this.dry=e.dry}_log(...e){console.log(...e)}modified(...e){this._log(Ve.default.green(" MODIFIED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}unchanged(...e){this._log(Ve.default.gray(" UNCHANGED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}skipped(...e){this._log(Ve.default.yellow(" SKIPPED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}error(...e){this._log(Ve.default.red(" ERROR "),...e,this.dry?Ve.default.dim("(dry run)"):"")}info(...e){this._log(Ve.default.bold(" INFO "),...e,this.dry?Ve.default.dim("(dry run)"):"")}};var DE=$(require("os")),Lu=$(require("path"));var ao=$(require("chalk")),co=require("diff"),Jt=require("fs-extra"),lo=class{constructor(e){this.changes=[];if(this.filePath=e.filePath,this.rootPath=e.rootPath,this.after=e.after,this.error=e.error,e.before===void 0)try{Lu.default.extname(e.filePath)===".json"?this.before=(0,Jt.readJsonSync)(e.filePath):this.before=(0,Jt.readFileSync)(e.filePath)}catch{this.before=""}else e.before===null?this.before="":this.before=e.before;e.after?typeof this.before=="object"||typeof e.after=="object"?this.changes=(0,co.diffJson)(this.before,e.after):this.changes=(0,co.diffLines)(this.before,e.after):this.changes=[]}fileName(){return Lu.default.relative(this.rootPath,this.filePath)}write(){this.after&&(typeof this.after=="object"?(0,Jt.writeJsonSync)(this.filePath,this.after,{spaces:2}):(0,Jt.writeFileSync)(this.filePath,this.after))}additions(){return this.changes.filter(e=>e.added).length}deletions(){return this.changes.filter(e=>e.removed).length}hasChanges(){return this.additions()>0||this.deletions()>0}log(e){e.diff?(this.changes.forEach(r=>{r.added?process.stdout.write(ao.default.green(r.value)):r.removed?process.stdout.write(ao.default.red(r.value)):process.stdout.write(ao.default.dim(r.value))}),He.log(DE.default.EOL)):He.log(this.after)}};var rn=class{constructor(e){this.modifications={};this.transform=e.transformer,this.rootPath=e.rootPath,this.dry=e.dry,this.print=e.print,this.logger=new yi(e)}abortTransform(e){return this.logger.error(e.reason),{fatalError:new Error(e.reason),changes:e.changes||{}}}modifyFile(e){this.modifications[e.filePath]=new lo({rootPath:this.rootPath,...e})}finish(){let e={changes:{}};return Object.keys(this.modifications).forEach(i=>{let n=this.modifications[i],s={action:"unchanged",additions:n.additions(),deletions:n.deletions()};if(n.hasChanges()){if(this.dry)s.action="skipped",this.logger.skipped(uo.default.dim(n.fileName()));else try{n.write(),s.action="modified",this.logger.modified(uo.default.bold(n.fileName()))}catch(o){let a="Unknown error";o instanceof Error&&(a=o.message),s.error=new Error(a),s.action="error",this.logger.error(n.fileName(),a)}this.print&&n.log({diff:!0})}else this.logger.unchanged(uo.default.dim(n.fileName()));e.changes[n.fileName()]=s}),Object.keys(e.changes).some(i=>e.changes[i].action==="error")?this.abortTransform({reason:"Encountered an error while transforming files",changes:e.changes}):e}static logResults(e){let r=Object.keys(e.changes);if(He.log(),r.length>0){He.bold("Results:");let i={};r.forEach(n=>{var o;let s=e.changes[n];i[n]={action:s.action,additions:s.additions,deletions:s.deletions,error:((o=s.error)==null?void 0:o.message)||"None"}}),console.table(i),He.log()}}};function FE({transformer:t,rootPath:e,options:r}){let i={transformer:t,rootPath:e,...r},n=new yi(i),s=new rn(i);return{log:n,runner:s}}var ME=require("fs-extra"),BE=require("json5");function qE(t){let e=(0,ME.readFileSync)(t,"utf8");return(0,BE.parse)(e)}var UE="migrate-dot-env",CL='Migrate the "dotEnv" entries to "inputs" in `turbo.json`',LL="2.0.0-canary.0";function HE(t){var e;if("globalDotEnv"in t){if(t.globalDotEnv){t.globalDependencies=(e=t.globalDependencies)!=null?e:[];for(let r of t.globalDotEnv)t.globalDependencies.push(r)}delete t.globalDotEnv}return vl(t,([r,i])=>{var n;if("dotEnv"in i){if(i.dotEnv){i.inputs=(n=i.inputs)!=null?n:["$TURBO_DEFAULT$"];for(let s of i.dotEnv)i.inputs.push(s)}delete i.dotEnv}}),t}function $E({root:t,options:e}){let{log:r,runner:i}=FE({transformer:UE,rootPath:t,options:e}),n=Pu.default.join(t,"package.json"),s={};try{s=(0,ho.readJsonSync)(n)}catch{}if("turbo"in s)return i.abortTransform({reason:'"turbo" key detected in package.json. Run `npx @turbo/codemod transform create-turbo-config` first'});r.info("Moving entries in `dotEnv` key in task config to `inputs`");let o=Pu.default.join(t,"turbo.json");if(!(0,ho.existsSync)(o))return i.abortTransform({reason:`No turbo.json found at ${t}. Is the path correct?`});let a=qE(o);return i.modifyFile({filePath:o,after:HE(a)}),xl(t).forEach(c=>{let{config:u,turboConfigPath:h}=c;i.modifyFile({filePath:h,after:HE(u)})}),i.finish()}var PL={name:UE,description:CL,introducedIn:LL,transformer:$E},IL=PL;0&&(module.exports={transformer});
39
+ `:""}var s0=n0,o0={dump:s0};function qo(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var a0=fe,l0=sh,c0=ch,u0=dh,h0=mh,f0=Do,p0=Ih.load,d0=Ih.loadAll,m0=o0.dump,g0=xe,y0={binary:Sh,float:ph,map:lh,null:uh,pairs:wh,set:xh,timestamp:_h,bool:hh,int:fh,merge:Eh,omap:bh,seq:ah,str:oh},_0=qo("safeLoad","load"),E0=qo("safeLoadAll","loadAll"),S0=qo("safeDump","dump"),b0={Type:a0,Schema:l0,FAILSAFE_SCHEMA:c0,JSON_SCHEMA:u0,CORE_SCHEMA:h0,DEFAULT_SCHEMA:f0,load:p0,loadAll:d0,dump:m0,YAMLException:g0,types:y0,safeLoad:_0,safeLoadAll:E0,safeDump:S0},jh=b0;var Ud=$(Id()),$d=$(require("json5"));var He={};Iu(He,{bold:()=>TR,dimmed:()=>CR,error:()=>Hd,grey:()=>LR,info:()=>AR,item:()=>PR,log:()=>qt,turboBlue:()=>qr,turboGradient:()=>RR,turboLoader:()=>qd,turboRed:()=>Md,underline:()=>OR,warn:()=>bl,yellow:()=>Bd});var Bt=$(require("chalk")),kd=$(require("ora")),Nd=$(require("gradient-string")),Dd="#0099F7",Fd="#F11712",vR="#FFFF00",RR=(0,Nd.default)(Dd,Fd),qr=Bt.default.hex(Dd),Md=Bt.default.hex(Fd),Bd=Bt.default.hex(vR),qd=t=>(0,kd.default)({text:t,spinner:{frames:[" ",qr("> "),qr(">> "),qr(">>>")]}}),AR=(...t)=>{qt(qr.bold(">>>"),...t)},TR=(...t)=>{qt(Bt.default.bold(...t))},OR=(...t)=>{qt(Bt.default.underline(...t))},CR=(...t)=>{qt(Bt.default.dim(...t))},LR=(...t)=>{qt(Bt.default.grey(...t))},PR=(...t)=>{qt(qr.bold(" \u2022"),...t)},qt=(...t)=>{console.log(...t)},bl=(...t)=>{console.error(Bd.bold(">>>"),...t)},Hd=(...t)=>{console.error(Md.bold(">>>"),...t)};var IR="turbo.json";var wl={};function kR(t){try{if(Li.default.existsSync(lr.default.join(t,"pnpm-workspace.yaml")))return jh.load(Li.default.readFileSync(lr.default.join(t,"pnpm-workspace.yaml"),"utf8")).packages||[];let e=JSON.parse(Li.default.readFileSync(lr.default.join(t,"package.json"),"utf8"));if(e.workspaces){if("packages"in e.workspaces)return e.workspaces.packages||[];if(Array.isArray(e.workspaces))return e.workspaces}return[]}catch{return[]}}function xl(t,e){var s;let r=Ro(t,e),i=[],n=(s=e==null?void 0:e.cache)!=null?s:!0;if(n&&t&&t in wl)return wl[t];if(r){let a=kR(r).map(c=>`${c}/turbo.json`);(0,Ud.sync)([IR,...a],{cwd:r,onlyFiles:!0,followSymbolicLinks:!1,suppressErrors:!0}).map(c=>lr.default.join(r,c)).forEach(c=>{try{let u=Li.default.readFileSync(c,"utf8"),h=$d.default.parse(u),f=lr.default.dirname(c)===r;if(f){if("extends"in h)return}else if(!("extends"in h))return;i.push({config:h,turboConfigPath:c,workspacePath:lr.default.dirname(c),isRootConfig:f})}catch(u){bl(u)}})}return n&&t&&(wl[t]=i),i}function vl(t,e){"pipeline"in t?Object.entries(t.pipeline).forEach(e):Object.entries(t.tasks).forEach(e)}var TT=$(require("os")),OT=$(Rg());var CT=$(require("fs-extra"));var LT=$(require("path")),PT=$(require("fs-extra")),IT=$(require("chalk"));var vE=require("stream"),RE=require("util"),dL=require("path"),mL=require("os"),AE=require("fs"),gL=$(xE());var bk=(0,RE.promisify)(vE.Stream.pipeline);var TE=require("fs-extra");var AL=$(require("path")),TL=$(NE()),OL=$(require("chalk")),Cu=require("fs-extra");var uo=$(require("chalk"));var Ve=$(require("chalk")),yi=class{constructor(e){this.transform=e.transformer,this.dry=e.dryRun}_log(...e){console.log(...e)}modified(...e){this._log(Ve.default.green(" MODIFIED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}unchanged(...e){this._log(Ve.default.gray(" UNCHANGED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}skipped(...e){this._log(Ve.default.yellow(" SKIPPED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}error(...e){this._log(Ve.default.red(" ERROR "),...e,this.dry?Ve.default.dim("(dry run)"):"")}info(...e){this._log(Ve.default.bold(" INFO "),...e,this.dry?Ve.default.dim("(dry run)"):"")}};var DE=$(require("os")),Lu=$(require("path"));var ao=$(require("chalk")),co=require("diff"),Jt=require("fs-extra"),lo=class{constructor(e){this.changes=[];if(this.filePath=e.filePath,this.rootPath=e.rootPath,this.after=e.after,this.error=e.error,e.before===void 0)try{Lu.default.extname(e.filePath)===".json"?this.before=(0,Jt.readJsonSync)(e.filePath):this.before=(0,Jt.readFileSync)(e.filePath)}catch{this.before=""}else e.before===null?this.before="":this.before=e.before;e.after?typeof this.before=="object"||typeof e.after=="object"?this.changes=(0,co.diffJson)(this.before,e.after):this.changes=(0,co.diffLines)(this.before,e.after):this.changes=[]}fileName(){return Lu.default.relative(this.rootPath,this.filePath)}write(){this.after&&(typeof this.after=="object"?(0,Jt.writeJsonSync)(this.filePath,this.after,{spaces:2}):(0,Jt.writeFileSync)(this.filePath,this.after))}additions(){return this.changes.filter(e=>e.added).length}deletions(){return this.changes.filter(e=>e.removed).length}hasChanges(){return this.additions()>0||this.deletions()>0}log(e){e.diff?(this.changes.forEach(r=>{r.added?process.stdout.write(ao.default.green(r.value)):r.removed?process.stdout.write(ao.default.red(r.value)):process.stdout.write(ao.default.dim(r.value))}),He.log(DE.default.EOL)):He.log(this.after)}};var rn=class{constructor(e){this.modifications={};this.transform=e.transformer,this.rootPath=e.rootPath,this.dry=e.dryRun,this.print=e.print,this.logger=new yi(e)}abortTransform(e){return this.logger.error(e.reason),{fatalError:new Error(e.reason),changes:e.changes||{}}}modifyFile(e){this.modifications[e.filePath]=new lo({rootPath:this.rootPath,...e})}finish(){let e={changes:{}};return Object.keys(this.modifications).forEach(i=>{let n=this.modifications[i],s={action:"unchanged",additions:n.additions(),deletions:n.deletions()};if(n.hasChanges()){if(this.dry)s.action="skipped",this.logger.skipped(uo.default.dim(n.fileName()));else try{n.write(),s.action="modified",this.logger.modified(uo.default.bold(n.fileName()))}catch(o){let a="Unknown error";o instanceof Error&&(a=o.message),s.error=new Error(a),s.action="error",this.logger.error(n.fileName(),a)}this.print&&n.log({diff:!0})}else this.logger.unchanged(uo.default.dim(n.fileName()));e.changes[n.fileName()]=s}),Object.keys(e.changes).some(i=>e.changes[i].action==="error")?this.abortTransform({reason:"Encountered an error while transforming files",changes:e.changes}):e}static logResults(e){let r=Object.keys(e.changes);if(He.log(),r.length>0){He.bold("Results:");let i={};r.forEach(n=>{var o;let s=e.changes[n];i[n]={action:s.action,additions:s.additions,deletions:s.deletions,error:((o=s.error)==null?void 0:o.message)||"None"}}),console.table(i),He.log()}}};function FE({transformer:t,rootPath:e,options:r}){let i={transformer:t,rootPath:e,...r},n=new yi(i),s=new rn(i);return{log:n,runner:s}}var ME=require("fs-extra"),BE=require("json5");function qE(t){let e=(0,ME.readFileSync)(t,"utf8");return(0,BE.parse)(e)}var UE="migrate-dot-env",CL='Migrate the "dotEnv" entries to "inputs" in `turbo.json`',LL="2.0.0-canary.0";function HE(t){var e;if("globalDotEnv"in t){if(t.globalDotEnv){t.globalDependencies=(e=t.globalDependencies)!=null?e:[];for(let r of t.globalDotEnv)t.globalDependencies.push(r)}delete t.globalDotEnv}return vl(t,([r,i])=>{var n;if("dotEnv"in i){if(i.dotEnv){i.inputs=(n=i.inputs)!=null?n:["$TURBO_DEFAULT$"];for(let s of i.dotEnv)i.inputs.push(s)}delete i.dotEnv}}),t}function $E({root:t,options:e}){let{log:r,runner:i}=FE({transformer:UE,rootPath:t,options:e}),n=Pu.default.join(t,"package.json"),s={};try{s=(0,ho.readJsonSync)(n)}catch{}if("turbo"in s)return i.abortTransform({reason:'"turbo" key detected in package.json. Run `npx @turbo/codemod transform create-turbo-config` first'});r.info("Moving entries in `dotEnv` key in task config to `inputs`");let o=Pu.default.join(t,"turbo.json");if(!(0,ho.existsSync)(o))return i.abortTransform({reason:`No turbo.json found at ${t}. Is the path correct?`});let a=qE(o);return i.modifyFile({filePath:o,after:HE(a)}),xl(t).forEach(c=>{let{config:u,turboConfigPath:h}=c;i.modifyFile({filePath:h,after:HE(u)})}),i.finish()}var PL={name:UE,description:CL,introducedIn:LL,transformer:$E},IL=PL;0&&(module.exports={transformer});
40
40
  /*! Bundled license information:
41
41
 
42
42
  @babel/runtime/helpers/regeneratorRuntime.js:
@@ -36,7 +36,7 @@ ${i.message}`:y,R=[x,e,t].filter(Boolean).join(`
36
36
  `+t.slice(n,s),n=s+1),o=a;return l+=`
37
37
  `,t.length-n>e&&o>n?l+=t.slice(n,o)+`
38
38
  `+t.slice(o+1):l+=t.slice(n),l.slice(1)}function r0(t){for(var e="",r=0,i,n=0;n<t.length;r>=65536?n+=2:n++)r=bi(t,n),i=pe[r],!i&&Ri(r)?(e+=t[n],r>=65536&&(e+=t[n+1])):e+=i||zb(r);return e}function i0(t,e,r){var i="",n=t.tag,s,o,a;for(s=0,o=r.length;s<o;s+=1)a=r[s],t.replacer&&(a=t.replacer.call(r,String(s),a)),(pt(t,e,a,!1,!1)||typeof a=="undefined"&&pt(t,e,null,!1,!1))&&(i!==""&&(i+=","+(t.condenseFlow?"":" ")),i+=t.dump);t.tag=n,t.dump="["+i+"]"}function ih(t,e,r,i){var n="",s=t.tag,o,a,l;for(o=0,a=r.length;o<a;o+=1)l=r[o],t.replacer&&(l=t.replacer.call(r,String(o),l)),(pt(t,e+1,l,!0,!0,!1,!0)||typeof l=="undefined"&&pt(t,e+1,null,!0,!0,!1,!0))&&((!i||n!=="")&&(n+=Po(t,e)),t.dump&&xi===t.dump.charCodeAt(0)?n+="-":n+="- ",n+=t.dump);t.tag=s,t.dump=n||"[]"}function n0(t,e,r){var i="",n=t.tag,s=Object.keys(r),o,a,l,c,u;for(o=0,a=s.length;o<a;o+=1)u="",i!==""&&(u+=", "),t.condenseFlow&&(u+='"'),l=s[o],c=r[l],t.replacer&&(c=t.replacer.call(r,l,c)),pt(t,e,l,!1,!1)&&(t.dump.length>1024&&(u+="? "),u+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),pt(t,e,c,!1,!1)&&(u+=t.dump,i+=u));t.tag=n,t.dump="{"+i+"}"}function s0(t,e,r,i){var n="",s=t.tag,o=Object.keys(r),a,l,c,u,h,f;if(t.sortKeys===!0)o.sort();else if(typeof t.sortKeys=="function")o.sort(t.sortKeys);else if(t.sortKeys)throw new xe("sortKeys must be a boolean or a function");for(a=0,l=o.length;a<l;a+=1)f="",(!i||n!=="")&&(f+=Po(t,e)),c=o[a],u=r[c],t.replacer&&(u=t.replacer.call(r,c,u)),pt(t,e+1,c,!0,!0,!0)&&(h=t.tag!==null&&t.tag!=="?"||t.dump&&t.dump.length>1024,h&&(t.dump&&xi===t.dump.charCodeAt(0)?f+="?":f+="? "),f+=t.dump,h&&(f+=Po(t,e)),pt(t,e+1,u,!0,h)&&(t.dump&&xi===t.dump.charCodeAt(0)?f+=":":f+=": ",f+=t.dump,n+=f));t.tag=s,t.dump=n||"{}"}function nh(t,e,r){var i,n,s,o,a,l;for(n=r?t.explicitTypes:t.implicitTypes,s=0,o=n.length;s<o;s+=1)if(a=n[s],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof e=="object"&&e instanceof a.instanceOf)&&(!a.predicate||a.predicate(e))){if(r?a.multi&&a.representName?t.tag=a.representName(e):t.tag=a.tag:t.tag="?",a.represent){if(l=t.styleMap[a.tag]||a.defaultStyle,Dh.call(a.represent)==="[object Function]")i=a.represent(e,l);else if(Fh.call(a.represent,l))i=a.represent[l](e,l);else throw new xe("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');t.dump=i}return!0}return!1}function pt(t,e,r,i,n,s,o){t.tag=null,t.dump=r,nh(t,r,!1)||nh(t,r,!0);var a=Dh.call(t.dump),l=i,c;i&&(i=t.flowLevel<0||t.flowLevel>e);var u=a==="[object Object]"||a==="[object Array]",h,f;if(u&&(h=t.duplicates.indexOf(r),f=h!==-1),(t.tag!==null&&t.tag!=="?"||f||t.indent!==2&&e>0)&&(n=!1),f&&t.usedDuplicates[h])t.dump="*ref_"+h;else{if(u&&f&&!t.usedDuplicates[h]&&(t.usedDuplicates[h]=!0),a==="[object Object]")i&&Object.keys(t.dump).length!==0?(s0(t,e,t.dump,n),f&&(t.dump="&ref_"+h+t.dump)):(n0(t,e,t.dump),f&&(t.dump="&ref_"+h+" "+t.dump));else if(a==="[object Array]")i&&t.dump.length!==0?(t.noArrayIndent&&!o&&e>0?ih(t,e-1,t.dump,n):ih(t,e,t.dump,n),f&&(t.dump="&ref_"+h+t.dump)):(i0(t,e,t.dump),f&&(t.dump="&ref_"+h+" "+t.dump));else if(a==="[object String]")t.tag!=="?"&&e0(t,t.dump,e,s,l);else{if(a==="[object Undefined]")return!1;if(t.skipInvalid)return!1;throw new xe("unacceptable kind of an object to dump "+a)}t.tag!==null&&t.tag!=="?"&&(c=encodeURI(t.tag[0]==="!"?t.tag.slice(1):t.tag).replace(/!/g,"%21"),t.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",t.dump=c+" "+t.dump)}return!0}function o0(t,e){var r=[],i=[],n,s;for(ko(t,r,i),n=0,s=i.length;n<s;n+=1)e.duplicates.push(r[i[n]]);e.usedDuplicates=new Array(s)}function ko(t,e,r){var i,n,s;if(t!==null&&typeof t=="object")if(n=e.indexOf(t),n!==-1)r.indexOf(n)===-1&&r.push(n);else if(e.push(t),Array.isArray(t))for(n=0,s=t.length;n<s;n+=1)ko(t[n],e,r);else for(i=Object.keys(t),n=0,s=i.length;n<s;n+=1)ko(t[i[n]],e,r)}function a0(t,e){e=e||{};var r=new Vb(e);r.noRefs||o0(t,r);var i=t;return r.replacer&&(i=r.replacer.call({"":i},"",i)),pt(r,0,i,!0,!0)?r.dump+`
39
- `:""}var l0=a0,c0={dump:l0};function qo(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var u0=fe,h0=ah,f0=hh,p0=gh,d0=yh,m0=Do,g0=Nh.load,y0=Nh.loadAll,_0=c0.dump,E0=xe,S0={binary:wh,float:mh,map:uh,null:fh,pairs:vh,set:Rh,timestamp:Sh,bool:ph,int:dh,merge:bh,omap:xh,seq:ch,str:lh},b0=qo("safeLoad","load"),w0=qo("safeLoadAll","loadAll"),x0=qo("safeDump","dump"),v0={Type:u0,Schema:h0,FAILSAFE_SCHEMA:f0,JSON_SCHEMA:p0,CORE_SCHEMA:d0,DEFAULT_SCHEMA:m0,load:g0,loadAll:y0,dump:_0,YAMLException:E0,types:S0,safeLoad:b0,safeLoadAll:w0,safeDump:x0},Yh=v0;var Gd=U(Nd()),jd=U(require("json5"));var He={};Nu(He,{bold:()=>LR,dimmed:()=>IR,error:()=>Ud,grey:()=>kR,info:()=>CR,item:()=>NR,log:()=>qt,turboBlue:()=>qr,turboGradient:()=>OR,turboLoader:()=>$d,turboRed:()=>qd,underline:()=>PR,warn:()=>bl,yellow:()=>Hd});var Bt=U(require("chalk")),Dd=U(require("ora")),Fd=U(require("gradient-string")),Md="#0099F7",Bd="#F11712",TR="#FFFF00",OR=(0,Fd.default)(Md,Bd),qr=Bt.default.hex(Md),qd=Bt.default.hex(Bd),Hd=Bt.default.hex(TR),$d=t=>(0,Dd.default)({text:t,spinner:{frames:[" ",qr("> "),qr(">> "),qr(">>>")]}}),CR=(...t)=>{qt(qr.bold(">>>"),...t)},LR=(...t)=>{qt(Bt.default.bold(...t))},PR=(...t)=>{qt(Bt.default.underline(...t))},IR=(...t)=>{qt(Bt.default.dim(...t))},kR=(...t)=>{qt(Bt.default.grey(...t))},NR=(...t)=>{qt(qr.bold(" \u2022"),...t)},qt=(...t)=>{console.log(...t)},bl=(...t)=>{console.error(Hd.bold(">>>"),...t)},Ud=(...t)=>{console.error(qd.bold(">>>"),...t)};var DR="turbo.json";var wl={};function FR(t){try{if(Li.default.existsSync(lr.default.join(t,"pnpm-workspace.yaml")))return Yh.load(Li.default.readFileSync(lr.default.join(t,"pnpm-workspace.yaml"),"utf8")).packages||[];let e=JSON.parse(Li.default.readFileSync(lr.default.join(t,"package.json"),"utf8"));if(e.workspaces){if("packages"in e.workspaces)return e.workspaces.packages||[];if(Array.isArray(e.workspaces))return e.workspaces}return[]}catch{return[]}}function xl(t,e){var s;let r=Ro(t,e),i=[],n=(s=e==null?void 0:e.cache)!=null?s:!0;if(n&&t&&t in wl)return wl[t];if(r){let a=FR(r).map(c=>`${c}/turbo.json`);(0,Gd.sync)([DR,...a],{cwd:r,onlyFiles:!0,followSymbolicLinks:!1,suppressErrors:!0}).map(c=>lr.default.join(r,c)).forEach(c=>{try{let u=Li.default.readFileSync(c,"utf8"),h=jd.default.parse(u),f=lr.default.dirname(c)===r;if(f){if("extends"in h)return}else if(!("extends"in h))return;i.push({config:h,turboConfigPath:c,workspacePath:lr.default.dirname(c),isRootConfig:f})}catch(u){bl(u)}})}return n&&t&&(wl[t]=i),i}var LT=U(require("os")),PT=U(Tg());var IT=U(require("fs-extra"));var kT=U(require("path")),NT=U(require("fs-extra")),DT=U(require("chalk"));var AE=require("stream"),TE=require("util"),y1=require("path"),_1=require("os"),OE=require("fs"),E1=U(RE());var vk=(0,TE.promisify)(AE.Stream.pipeline);var CE=require("fs-extra");var C1=U(require("path")),L1=U(FE()),P1=U(require("chalk")),Ou=require("fs-extra");var uo=U(require("chalk"));var Ve=U(require("chalk")),yi=class{constructor(e){this.transform=e.transformer,this.dry=e.dry}_log(...e){console.log(...e)}modified(...e){this._log(Ve.default.green(" MODIFIED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}unchanged(...e){this._log(Ve.default.gray(" UNCHANGED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}skipped(...e){this._log(Ve.default.yellow(" SKIPPED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}error(...e){this._log(Ve.default.red(" ERROR "),...e,this.dry?Ve.default.dim("(dry run)"):"")}info(...e){this._log(Ve.default.bold(" INFO "),...e,this.dry?Ve.default.dim("(dry run)"):"")}};var ME=U(require("os")),Cu=U(require("path"));var ao=U(require("chalk")),co=require("diff"),Jt=require("fs-extra"),lo=class{constructor(e){this.changes=[];if(this.filePath=e.filePath,this.rootPath=e.rootPath,this.after=e.after,this.error=e.error,e.before===void 0)try{Cu.default.extname(e.filePath)===".json"?this.before=(0,Jt.readJsonSync)(e.filePath):this.before=(0,Jt.readFileSync)(e.filePath)}catch{this.before=""}else e.before===null?this.before="":this.before=e.before;e.after?typeof this.before=="object"||typeof e.after=="object"?this.changes=(0,co.diffJson)(this.before,e.after):this.changes=(0,co.diffLines)(this.before,e.after):this.changes=[]}fileName(){return Cu.default.relative(this.rootPath,this.filePath)}write(){this.after&&(typeof this.after=="object"?(0,Jt.writeJsonSync)(this.filePath,this.after,{spaces:2}):(0,Jt.writeFileSync)(this.filePath,this.after))}additions(){return this.changes.filter(e=>e.added).length}deletions(){return this.changes.filter(e=>e.removed).length}hasChanges(){return this.additions()>0||this.deletions()>0}log(e){e.diff?(this.changes.forEach(r=>{r.added?process.stdout.write(ao.default.green(r.value)):r.removed?process.stdout.write(ao.default.red(r.value)):process.stdout.write(ao.default.dim(r.value))}),He.log(ME.default.EOL)):He.log(this.after)}};var rn=class{constructor(e){this.modifications={};this.transform=e.transformer,this.rootPath=e.rootPath,this.dry=e.dry,this.print=e.print,this.logger=new yi(e)}abortTransform(e){return this.logger.error(e.reason),{fatalError:new Error(e.reason),changes:e.changes||{}}}modifyFile(e){this.modifications[e.filePath]=new lo({rootPath:this.rootPath,...e})}finish(){let e={changes:{}};return Object.keys(this.modifications).forEach(i=>{let n=this.modifications[i],s={action:"unchanged",additions:n.additions(),deletions:n.deletions()};if(n.hasChanges()){if(this.dry)s.action="skipped",this.logger.skipped(uo.default.dim(n.fileName()));else try{n.write(),s.action="modified",this.logger.modified(uo.default.bold(n.fileName()))}catch(o){let a="Unknown error";o instanceof Error&&(a=o.message),s.error=new Error(a),s.action="error",this.logger.error(n.fileName(),a)}this.print&&n.log({diff:!0})}else this.logger.unchanged(uo.default.dim(n.fileName()));e.changes[n.fileName()]=s}),Object.keys(e.changes).some(i=>e.changes[i].action==="error")?this.abortTransform({reason:"Encountered an error while transforming files",changes:e.changes}):e}static logResults(e){let r=Object.keys(e.changes);if(He.log(),r.length>0){He.bold("Results:");let i={};r.forEach(n=>{var o;let s=e.changes[n];i[n]={action:s.action,additions:s.additions,deletions:s.deletions,error:((o=s.error)==null?void 0:o.message)||"None"}}),console.table(i),He.log()}}};function BE({transformer:t,rootPath:e,options:r}){let i={transformer:t,rootPath:e,...r},n=new yi(i),s=new rn(i);return{log:n,runner:s}}var qE=require("fs-extra"),HE=require("json5");function $E(t){let e=(0,qE.readFileSync)(t,"utf8");return(0,HE.parse)(e)}var UE="migrate-env-var-dependencies",I1='Migrate environment variable dependencies from "dependsOn" to "env" in `turbo.json`',k1="1.5.0";function Pu(t){let r=["extends"in t?[]:t.globalDependencies,Object.values(t.pipeline).flatMap(i=>{var n;return(n=i.dependsOn)!=null?n:[]})].flat().filter(i=>i==null?void 0:i.startsWith("$"));return{hasKeys:!!r.length,envVars:r}}function ku({env:t,deps:e}){let r=new Set(t),i=[];return e==null||e.forEach(n=>{n.startsWith("$")?r.add(n.slice(1)):i.push(n)}),r.size?{deps:i,env:Array.from(r)}:{env:t,deps:e}}function GE(t){let{deps:e,env:r}=ku({env:t.env,deps:t.dependsOn}),i={...t};return e?i.dependsOn=e:delete i.dependsOn,r!=null&&r.length?i.env=r:delete i.env,i}function jE(t){if("extends"in t)return t;let{deps:e,env:r}=ku({env:t.globalEnv,deps:t.globalDependencies}),i={...t};return e!=null&&e.length?i.globalDependencies=e:delete i.globalDependencies,r!=null&&r.length?i.globalEnv=r:delete i.globalEnv,i}function Iu(t){let e=jE(t);return Object.keys(t.pipeline).forEach(r=>{if(t.pipeline,r in t.pipeline){let i=e.pipeline[r];e.pipeline[r]={...i,...GE(i)}}}),e}function WE({root:t,options:e}){let{log:r,runner:i}=BE({transformer:UE,rootPath:t,options:e});r.info('Migrating environment variable dependencies from "globalDependencies" and "dependsOn" to "env" in "turbo.json"...');let n=Lu.default.join(t,"package.json"),s={};try{s=(0,ho.readJsonSync)(n)}catch{}if("turbo"in s)return i.abortTransform({reason:'"turbo" key detected in package.json. Run `npx @turbo/codemod transform create-turbo-config` first'});let o=Lu.default.join(t,"turbo.json");if(!(0,ho.existsSync)(o))return i.abortTransform({reason:`No turbo.json found at ${t}. Is the path correct?`});let a=$E(o);return Pu(a).hasKeys&&(a=Iu(a)),i.modifyFile({filePath:o,after:a}),xl(t).forEach(c=>{let{config:u,turboConfigPath:h}=c;"pipeline"in u&&Pu(u).hasKeys&&i.modifyFile({filePath:h,after:Iu(u)})}),i.finish()}var N1={name:UE,description:I1,introducedIn:k1,transformer:WE},D1=N1;0&&(module.exports={hasLegacyEnvVarDependencies,migrateConfig,migrateDependencies,migrateGlobal,migratePipeline,transformer});
39
+ `:""}var l0=a0,c0={dump:l0};function qo(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var u0=fe,h0=ah,f0=hh,p0=gh,d0=yh,m0=Do,g0=Nh.load,y0=Nh.loadAll,_0=c0.dump,E0=xe,S0={binary:wh,float:mh,map:uh,null:fh,pairs:vh,set:Rh,timestamp:Sh,bool:ph,int:dh,merge:bh,omap:xh,seq:ch,str:lh},b0=qo("safeLoad","load"),w0=qo("safeLoadAll","loadAll"),x0=qo("safeDump","dump"),v0={Type:u0,Schema:h0,FAILSAFE_SCHEMA:f0,JSON_SCHEMA:p0,CORE_SCHEMA:d0,DEFAULT_SCHEMA:m0,load:g0,loadAll:y0,dump:_0,YAMLException:E0,types:S0,safeLoad:b0,safeLoadAll:w0,safeDump:x0},Yh=v0;var Gd=U(Nd()),jd=U(require("json5"));var He={};Nu(He,{bold:()=>LR,dimmed:()=>IR,error:()=>Ud,grey:()=>kR,info:()=>CR,item:()=>NR,log:()=>qt,turboBlue:()=>qr,turboGradient:()=>OR,turboLoader:()=>$d,turboRed:()=>qd,underline:()=>PR,warn:()=>bl,yellow:()=>Hd});var Bt=U(require("chalk")),Dd=U(require("ora")),Fd=U(require("gradient-string")),Md="#0099F7",Bd="#F11712",TR="#FFFF00",OR=(0,Fd.default)(Md,Bd),qr=Bt.default.hex(Md),qd=Bt.default.hex(Bd),Hd=Bt.default.hex(TR),$d=t=>(0,Dd.default)({text:t,spinner:{frames:[" ",qr("> "),qr(">> "),qr(">>>")]}}),CR=(...t)=>{qt(qr.bold(">>>"),...t)},LR=(...t)=>{qt(Bt.default.bold(...t))},PR=(...t)=>{qt(Bt.default.underline(...t))},IR=(...t)=>{qt(Bt.default.dim(...t))},kR=(...t)=>{qt(Bt.default.grey(...t))},NR=(...t)=>{qt(qr.bold(" \u2022"),...t)},qt=(...t)=>{console.log(...t)},bl=(...t)=>{console.error(Hd.bold(">>>"),...t)},Ud=(...t)=>{console.error(qd.bold(">>>"),...t)};var DR="turbo.json";var wl={};function FR(t){try{if(Li.default.existsSync(lr.default.join(t,"pnpm-workspace.yaml")))return Yh.load(Li.default.readFileSync(lr.default.join(t,"pnpm-workspace.yaml"),"utf8")).packages||[];let e=JSON.parse(Li.default.readFileSync(lr.default.join(t,"package.json"),"utf8"));if(e.workspaces){if("packages"in e.workspaces)return e.workspaces.packages||[];if(Array.isArray(e.workspaces))return e.workspaces}return[]}catch{return[]}}function xl(t,e){var s;let r=Ro(t,e),i=[],n=(s=e==null?void 0:e.cache)!=null?s:!0;if(n&&t&&t in wl)return wl[t];if(r){let a=FR(r).map(c=>`${c}/turbo.json`);(0,Gd.sync)([DR,...a],{cwd:r,onlyFiles:!0,followSymbolicLinks:!1,suppressErrors:!0}).map(c=>lr.default.join(r,c)).forEach(c=>{try{let u=Li.default.readFileSync(c,"utf8"),h=jd.default.parse(u),f=lr.default.dirname(c)===r;if(f){if("extends"in h)return}else if(!("extends"in h))return;i.push({config:h,turboConfigPath:c,workspacePath:lr.default.dirname(c),isRootConfig:f})}catch(u){bl(u)}})}return n&&t&&(wl[t]=i),i}var LT=U(require("os")),PT=U(Tg());var IT=U(require("fs-extra"));var kT=U(require("path")),NT=U(require("fs-extra")),DT=U(require("chalk"));var AE=require("stream"),TE=require("util"),y1=require("path"),_1=require("os"),OE=require("fs"),E1=U(RE());var vk=(0,TE.promisify)(AE.Stream.pipeline);var CE=require("fs-extra");var C1=U(require("path")),L1=U(FE()),P1=U(require("chalk")),Ou=require("fs-extra");var uo=U(require("chalk"));var Ve=U(require("chalk")),yi=class{constructor(e){this.transform=e.transformer,this.dry=e.dryRun}_log(...e){console.log(...e)}modified(...e){this._log(Ve.default.green(" MODIFIED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}unchanged(...e){this._log(Ve.default.gray(" UNCHANGED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}skipped(...e){this._log(Ve.default.yellow(" SKIPPED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}error(...e){this._log(Ve.default.red(" ERROR "),...e,this.dry?Ve.default.dim("(dry run)"):"")}info(...e){this._log(Ve.default.bold(" INFO "),...e,this.dry?Ve.default.dim("(dry run)"):"")}};var ME=U(require("os")),Cu=U(require("path"));var ao=U(require("chalk")),co=require("diff"),Jt=require("fs-extra"),lo=class{constructor(e){this.changes=[];if(this.filePath=e.filePath,this.rootPath=e.rootPath,this.after=e.after,this.error=e.error,e.before===void 0)try{Cu.default.extname(e.filePath)===".json"?this.before=(0,Jt.readJsonSync)(e.filePath):this.before=(0,Jt.readFileSync)(e.filePath)}catch{this.before=""}else e.before===null?this.before="":this.before=e.before;e.after?typeof this.before=="object"||typeof e.after=="object"?this.changes=(0,co.diffJson)(this.before,e.after):this.changes=(0,co.diffLines)(this.before,e.after):this.changes=[]}fileName(){return Cu.default.relative(this.rootPath,this.filePath)}write(){this.after&&(typeof this.after=="object"?(0,Jt.writeJsonSync)(this.filePath,this.after,{spaces:2}):(0,Jt.writeFileSync)(this.filePath,this.after))}additions(){return this.changes.filter(e=>e.added).length}deletions(){return this.changes.filter(e=>e.removed).length}hasChanges(){return this.additions()>0||this.deletions()>0}log(e){e.diff?(this.changes.forEach(r=>{r.added?process.stdout.write(ao.default.green(r.value)):r.removed?process.stdout.write(ao.default.red(r.value)):process.stdout.write(ao.default.dim(r.value))}),He.log(ME.default.EOL)):He.log(this.after)}};var rn=class{constructor(e){this.modifications={};this.transform=e.transformer,this.rootPath=e.rootPath,this.dry=e.dryRun,this.print=e.print,this.logger=new yi(e)}abortTransform(e){return this.logger.error(e.reason),{fatalError:new Error(e.reason),changes:e.changes||{}}}modifyFile(e){this.modifications[e.filePath]=new lo({rootPath:this.rootPath,...e})}finish(){let e={changes:{}};return Object.keys(this.modifications).forEach(i=>{let n=this.modifications[i],s={action:"unchanged",additions:n.additions(),deletions:n.deletions()};if(n.hasChanges()){if(this.dry)s.action="skipped",this.logger.skipped(uo.default.dim(n.fileName()));else try{n.write(),s.action="modified",this.logger.modified(uo.default.bold(n.fileName()))}catch(o){let a="Unknown error";o instanceof Error&&(a=o.message),s.error=new Error(a),s.action="error",this.logger.error(n.fileName(),a)}this.print&&n.log({diff:!0})}else this.logger.unchanged(uo.default.dim(n.fileName()));e.changes[n.fileName()]=s}),Object.keys(e.changes).some(i=>e.changes[i].action==="error")?this.abortTransform({reason:"Encountered an error while transforming files",changes:e.changes}):e}static logResults(e){let r=Object.keys(e.changes);if(He.log(),r.length>0){He.bold("Results:");let i={};r.forEach(n=>{var o;let s=e.changes[n];i[n]={action:s.action,additions:s.additions,deletions:s.deletions,error:((o=s.error)==null?void 0:o.message)||"None"}}),console.table(i),He.log()}}};function BE({transformer:t,rootPath:e,options:r}){let i={transformer:t,rootPath:e,...r},n=new yi(i),s=new rn(i);return{log:n,runner:s}}var qE=require("fs-extra"),HE=require("json5");function $E(t){let e=(0,qE.readFileSync)(t,"utf8");return(0,HE.parse)(e)}var UE="migrate-env-var-dependencies",I1='Migrate environment variable dependencies from "dependsOn" to "env" in `turbo.json`',k1="1.5.0";function Pu(t){let r=["extends"in t?[]:t.globalDependencies,Object.values(t.pipeline).flatMap(i=>{var n;return(n=i.dependsOn)!=null?n:[]})].flat().filter(i=>i==null?void 0:i.startsWith("$"));return{hasKeys:!!r.length,envVars:r}}function ku({env:t,deps:e}){let r=new Set(t),i=[];return e==null||e.forEach(n=>{n.startsWith("$")?r.add(n.slice(1)):i.push(n)}),r.size?{deps:i,env:Array.from(r)}:{env:t,deps:e}}function GE(t){let{deps:e,env:r}=ku({env:t.env,deps:t.dependsOn}),i={...t};return e?i.dependsOn=e:delete i.dependsOn,r!=null&&r.length?i.env=r:delete i.env,i}function jE(t){if("extends"in t)return t;let{deps:e,env:r}=ku({env:t.globalEnv,deps:t.globalDependencies}),i={...t};return e!=null&&e.length?i.globalDependencies=e:delete i.globalDependencies,r!=null&&r.length?i.globalEnv=r:delete i.globalEnv,i}function Iu(t){let e=jE(t);return Object.keys(t.pipeline).forEach(r=>{if(t.pipeline,r in t.pipeline){let i=e.pipeline[r];e.pipeline[r]={...i,...GE(i)}}}),e}function WE({root:t,options:e}){let{log:r,runner:i}=BE({transformer:UE,rootPath:t,options:e});r.info('Migrating environment variable dependencies from "globalDependencies" and "dependsOn" to "env" in "turbo.json"...');let n=Lu.default.join(t,"package.json"),s={};try{s=(0,ho.readJsonSync)(n)}catch{}if("turbo"in s)return i.abortTransform({reason:'"turbo" key detected in package.json. Run `npx @turbo/codemod transform create-turbo-config` first'});let o=Lu.default.join(t,"turbo.json");if(!(0,ho.existsSync)(o))return i.abortTransform({reason:`No turbo.json found at ${t}. Is the path correct?`});let a=$E(o);return Pu(a).hasKeys&&(a=Iu(a)),i.modifyFile({filePath:o,after:a}),xl(t).forEach(c=>{let{config:u,turboConfigPath:h}=c;"pipeline"in u&&Pu(u).hasKeys&&i.modifyFile({filePath:h,after:Iu(u)})}),i.finish()}var N1={name:UE,description:I1,introducedIn:k1,transformer:WE},D1=N1;0&&(module.exports={hasLegacyEnvVarDependencies,migrateConfig,migrateDependencies,migrateGlobal,migratePipeline,transformer});
40
40
  /*! Bundled license information:
41
41
 
42
42
  @babel/runtime/helpers/regeneratorRuntime.js:
@@ -36,7 +36,7 @@ ${i.message}`:y,R=[x,e,t].filter(Boolean).join(`
36
36
  `+t.slice(n,s),n=s+1),o=a;return l+=`
37
37
  `,t.length-n>e&&o>n?l+=t.slice(n,o)+`
38
38
  `+t.slice(o+1):l+=t.slice(n),l.slice(1)}function Qb(t){for(var e="",r=0,i,n=0;n<t.length;r>=65536?n+=2:n++)r=bi(t,n),i=pe[r],!i&&Ri(r)?(e+=t[n],r>=65536&&(e+=t[n+1])):e+=i||Gb(r);return e}function Jb(t,e,r){var i="",n=t.tag,s,o,a;for(s=0,o=r.length;s<o;s+=1)a=r[s],t.replacer&&(a=t.replacer.call(r,String(s),a)),(pt(t,e,a,!1,!1)||typeof a=="undefined"&&pt(t,e,null,!1,!1))&&(i!==""&&(i+=","+(t.condenseFlow?"":" ")),i+=t.dump);t.tag=n,t.dump="["+i+"]"}function eh(t,e,r,i){var n="",s=t.tag,o,a,l;for(o=0,a=r.length;o<a;o+=1)l=r[o],t.replacer&&(l=t.replacer.call(r,String(o),l)),(pt(t,e+1,l,!0,!0,!1,!0)||typeof l=="undefined"&&pt(t,e+1,null,!0,!0,!1,!0))&&((!i||n!=="")&&(n+=Po(t,e)),t.dump&&xi===t.dump.charCodeAt(0)?n+="-":n+="- ",n+=t.dump);t.tag=s,t.dump=n||"[]"}function e0(t,e,r){var i="",n=t.tag,s=Object.keys(r),o,a,l,c,u;for(o=0,a=s.length;o<a;o+=1)u="",i!==""&&(u+=", "),t.condenseFlow&&(u+='"'),l=s[o],c=r[l],t.replacer&&(c=t.replacer.call(r,l,c)),pt(t,e,l,!1,!1)&&(t.dump.length>1024&&(u+="? "),u+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),pt(t,e,c,!1,!1)&&(u+=t.dump,i+=u));t.tag=n,t.dump="{"+i+"}"}function t0(t,e,r,i){var n="",s=t.tag,o=Object.keys(r),a,l,c,u,h,f;if(t.sortKeys===!0)o.sort();else if(typeof t.sortKeys=="function")o.sort(t.sortKeys);else if(t.sortKeys)throw new xe("sortKeys must be a boolean or a function");for(a=0,l=o.length;a<l;a+=1)f="",(!i||n!=="")&&(f+=Po(t,e)),c=o[a],u=r[c],t.replacer&&(u=t.replacer.call(r,c,u)),pt(t,e+1,c,!0,!0,!0)&&(h=t.tag!==null&&t.tag!=="?"||t.dump&&t.dump.length>1024,h&&(t.dump&&xi===t.dump.charCodeAt(0)?f+="?":f+="? "),f+=t.dump,h&&(f+=Po(t,e)),pt(t,e+1,u,!0,h)&&(t.dump&&xi===t.dump.charCodeAt(0)?f+=":":f+=": ",f+=t.dump,n+=f));t.tag=s,t.dump=n||"{}"}function th(t,e,r){var i,n,s,o,a,l;for(n=r?t.explicitTypes:t.implicitTypes,s=0,o=n.length;s<o;s+=1)if(a=n[s],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof e=="object"&&e instanceof a.instanceOf)&&(!a.predicate||a.predicate(e))){if(r?a.multi&&a.representName?t.tag=a.representName(e):t.tag=a.tag:t.tag="?",a.represent){if(l=t.styleMap[a.tag]||a.defaultStyle,Ih.call(a.represent)==="[object Function]")i=a.represent(e,l);else if(kh.call(a.represent,l))i=a.represent[l](e,l);else throw new xe("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');t.dump=i}return!0}return!1}function pt(t,e,r,i,n,s,o){t.tag=null,t.dump=r,th(t,r,!1)||th(t,r,!0);var a=Ih.call(t.dump),l=i,c;i&&(i=t.flowLevel<0||t.flowLevel>e);var u=a==="[object Object]"||a==="[object Array]",h,f;if(u&&(h=t.duplicates.indexOf(r),f=h!==-1),(t.tag!==null&&t.tag!=="?"||f||t.indent!==2&&e>0)&&(n=!1),f&&t.usedDuplicates[h])t.dump="*ref_"+h;else{if(u&&f&&!t.usedDuplicates[h]&&(t.usedDuplicates[h]=!0),a==="[object Object]")i&&Object.keys(t.dump).length!==0?(t0(t,e,t.dump,n),f&&(t.dump="&ref_"+h+t.dump)):(e0(t,e,t.dump),f&&(t.dump="&ref_"+h+" "+t.dump));else if(a==="[object Array]")i&&t.dump.length!==0?(t.noArrayIndent&&!o&&e>0?eh(t,e-1,t.dump,n):eh(t,e,t.dump,n),f&&(t.dump="&ref_"+h+t.dump)):(Jb(t,e,t.dump),f&&(t.dump="&ref_"+h+" "+t.dump));else if(a==="[object String]")t.tag!=="?"&&Xb(t,t.dump,e,s,l);else{if(a==="[object Undefined]")return!1;if(t.skipInvalid)return!1;throw new xe("unacceptable kind of an object to dump "+a)}t.tag!==null&&t.tag!=="?"&&(c=encodeURI(t.tag[0]==="!"?t.tag.slice(1):t.tag).replace(/!/g,"%21"),t.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",t.dump=c+" "+t.dump)}return!0}function r0(t,e){var r=[],i=[],n,s;for(ko(t,r,i),n=0,s=i.length;n<s;n+=1)e.duplicates.push(r[i[n]]);e.usedDuplicates=new Array(s)}function ko(t,e,r){var i,n,s;if(t!==null&&typeof t=="object")if(n=e.indexOf(t),n!==-1)r.indexOf(n)===-1&&r.push(n);else if(e.push(t),Array.isArray(t))for(n=0,s=t.length;n<s;n+=1)ko(t[n],e,r);else for(i=Object.keys(t),n=0,s=i.length;n<s;n+=1)ko(t[i[n]],e,r)}function i0(t,e){e=e||{};var r=new Wb(e);r.noRefs||r0(t,r);var i=t;return r.replacer&&(i=r.replacer.call({"":i},"",i)),pt(r,0,i,!0,!0)?r.dump+`
39
- `:""}var n0=i0,s0={dump:n0};function qo(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var o0=fe,a0=nh,l0=lh,c0=ph,u0=dh,h0=Do,f0=Ph.load,p0=Ph.loadAll,d0=s0.dump,m0=xe,g0={binary:Eh,float:fh,map:ah,null:ch,pairs:bh,set:wh,timestamp:yh,bool:uh,int:hh,merge:_h,omap:Sh,seq:oh,str:sh},y0=qo("safeLoad","load"),_0=qo("safeLoadAll","loadAll"),E0=qo("safeDump","dump"),S0={Type:o0,Schema:a0,FAILSAFE_SCHEMA:l0,JSON_SCHEMA:c0,CORE_SCHEMA:u0,DEFAULT_SCHEMA:h0,load:f0,loadAll:p0,dump:d0,YAMLException:m0,types:g0,safeLoad:y0,safeLoadAll:_0,safeDump:E0},Gh=S0;var Hd=$(Pd()),Ud=$(require("json5"));var He={};Pu(He,{bold:()=>AR,dimmed:()=>OR,error:()=>qd,grey:()=>CR,info:()=>RR,item:()=>LR,log:()=>qt,turboBlue:()=>qr,turboGradient:()=>vR,turboLoader:()=>Bd,turboRed:()=>Fd,underline:()=>TR,warn:()=>bl,yellow:()=>Md});var Bt=$(require("chalk")),Id=$(require("ora")),kd=$(require("gradient-string")),Nd="#0099F7",Dd="#F11712",xR="#FFFF00",vR=(0,kd.default)(Nd,Dd),qr=Bt.default.hex(Nd),Fd=Bt.default.hex(Dd),Md=Bt.default.hex(xR),Bd=t=>(0,Id.default)({text:t,spinner:{frames:[" ",qr("> "),qr(">> "),qr(">>>")]}}),RR=(...t)=>{qt(qr.bold(">>>"),...t)},AR=(...t)=>{qt(Bt.default.bold(...t))},TR=(...t)=>{qt(Bt.default.underline(...t))},OR=(...t)=>{qt(Bt.default.dim(...t))},CR=(...t)=>{qt(Bt.default.grey(...t))},LR=(...t)=>{qt(qr.bold(" \u2022"),...t)},qt=(...t)=>{console.log(...t)},bl=(...t)=>{console.error(Md.bold(">>>"),...t)},qd=(...t)=>{console.error(Fd.bold(">>>"),...t)};var PR="turbo.json";var wl={};function IR(t){try{if(Li.default.existsSync(lr.default.join(t,"pnpm-workspace.yaml")))return Gh.load(Li.default.readFileSync(lr.default.join(t,"pnpm-workspace.yaml"),"utf8")).packages||[];let e=JSON.parse(Li.default.readFileSync(lr.default.join(t,"package.json"),"utf8"));if(e.workspaces){if("packages"in e.workspaces)return e.workspaces.packages||[];if(Array.isArray(e.workspaces))return e.workspaces}return[]}catch{return[]}}function xl(t,e){var s;let r=Ro(t,e),i=[],n=(s=e==null?void 0:e.cache)!=null?s:!0;if(n&&t&&t in wl)return wl[t];if(r){let a=IR(r).map(c=>`${c}/turbo.json`);(0,Hd.sync)([PR,...a],{cwd:r,onlyFiles:!0,followSymbolicLinks:!1,suppressErrors:!0}).map(c=>lr.default.join(r,c)).forEach(c=>{try{let u=Li.default.readFileSync(c,"utf8"),h=Ud.default.parse(u),f=lr.default.dirname(c)===r;if(f){if("extends"in h)return}else if(!("extends"in h))return;i.push({config:h,turboConfigPath:c,workspacePath:lr.default.dirname(c),isRootConfig:f})}catch(u){bl(u)}})}return n&&t&&(wl[t]=i),i}var AT=$(require("os")),TT=$(vg());var OT=$(require("fs-extra"));var CT=$(require("path")),LT=$(require("fs-extra")),PT=$(require("chalk"));var xE=require("stream"),vE=require("util"),pL=require("path"),dL=require("os"),RE=require("fs"),mL=$(wE());var Sk=(0,vE.promisify)(xE.Stream.pipeline);var AE=require("fs-extra");var RL=$(require("path")),AL=$(kE()),TL=$(require("chalk")),Ou=require("fs-extra");var uo=$(require("chalk"));var Ve=$(require("chalk")),yi=class{constructor(e){this.transform=e.transformer,this.dry=e.dry}_log(...e){console.log(...e)}modified(...e){this._log(Ve.default.green(" MODIFIED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}unchanged(...e){this._log(Ve.default.gray(" UNCHANGED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}skipped(...e){this._log(Ve.default.yellow(" SKIPPED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}error(...e){this._log(Ve.default.red(" ERROR "),...e,this.dry?Ve.default.dim("(dry run)"):"")}info(...e){this._log(Ve.default.bold(" INFO "),...e,this.dry?Ve.default.dim("(dry run)"):"")}};var NE=$(require("os")),Cu=$(require("path"));var ao=$(require("chalk")),co=require("diff"),Jt=require("fs-extra"),lo=class{constructor(e){this.changes=[];if(this.filePath=e.filePath,this.rootPath=e.rootPath,this.after=e.after,this.error=e.error,e.before===void 0)try{Cu.default.extname(e.filePath)===".json"?this.before=(0,Jt.readJsonSync)(e.filePath):this.before=(0,Jt.readFileSync)(e.filePath)}catch{this.before=""}else e.before===null?this.before="":this.before=e.before;e.after?typeof this.before=="object"||typeof e.after=="object"?this.changes=(0,co.diffJson)(this.before,e.after):this.changes=(0,co.diffLines)(this.before,e.after):this.changes=[]}fileName(){return Cu.default.relative(this.rootPath,this.filePath)}write(){this.after&&(typeof this.after=="object"?(0,Jt.writeJsonSync)(this.filePath,this.after,{spaces:2}):(0,Jt.writeFileSync)(this.filePath,this.after))}additions(){return this.changes.filter(e=>e.added).length}deletions(){return this.changes.filter(e=>e.removed).length}hasChanges(){return this.additions()>0||this.deletions()>0}log(e){e.diff?(this.changes.forEach(r=>{r.added?process.stdout.write(ao.default.green(r.value)):r.removed?process.stdout.write(ao.default.red(r.value)):process.stdout.write(ao.default.dim(r.value))}),He.log(NE.default.EOL)):He.log(this.after)}};var rn=class{constructor(e){this.modifications={};this.transform=e.transformer,this.rootPath=e.rootPath,this.dry=e.dry,this.print=e.print,this.logger=new yi(e)}abortTransform(e){return this.logger.error(e.reason),{fatalError:new Error(e.reason),changes:e.changes||{}}}modifyFile(e){this.modifications[e.filePath]=new lo({rootPath:this.rootPath,...e})}finish(){let e={changes:{}};return Object.keys(this.modifications).forEach(i=>{let n=this.modifications[i],s={action:"unchanged",additions:n.additions(),deletions:n.deletions()};if(n.hasChanges()){if(this.dry)s.action="skipped",this.logger.skipped(uo.default.dim(n.fileName()));else try{n.write(),s.action="modified",this.logger.modified(uo.default.bold(n.fileName()))}catch(o){let a="Unknown error";o instanceof Error&&(a=o.message),s.error=new Error(a),s.action="error",this.logger.error(n.fileName(),a)}this.print&&n.log({diff:!0})}else this.logger.unchanged(uo.default.dim(n.fileName()));e.changes[n.fileName()]=s}),Object.keys(e.changes).some(i=>e.changes[i].action==="error")?this.abortTransform({reason:"Encountered an error while transforming files",changes:e.changes}):e}static logResults(e){let r=Object.keys(e.changes);if(He.log(),r.length>0){He.bold("Results:");let i={};r.forEach(n=>{var o;let s=e.changes[n];i[n]={action:s.action,additions:s.additions,deletions:s.deletions,error:((o=s.error)==null?void 0:o.message)||"None"}}),console.table(i),He.log()}}};function DE({transformer:t,rootPath:e,options:r}){let i={transformer:t,rootPath:e,...r},n=new yi(i),s=new rn(i);return{log:n,runner:s}}var FE=require("fs-extra"),ME=require("json5");function BE(t){let e=(0,FE.readFileSync)(t,"utf8");return(0,ME.parse)(e)}var HE="rename-output-mode",OL='Rename the "outputMode" key to "outputLogs" in `turbo.json`',CL="2.0.0-canary.0";function qE(t){for(let[e,r]of Object.entries(t.pipeline))Object.prototype.hasOwnProperty.call(r,"outputMode")&&(r.outputLogs=r.outputMode,delete r.outputMode);return t}function UE({root:t,options:e}){let{log:r,runner:i}=DE({transformer:HE,rootPath:t,options:e}),n=Lu.default.join(t,"package.json"),s={};try{s=(0,ho.readJsonSync)(n)}catch{}if("turbo"in s)return i.abortTransform({reason:'"turbo" key detected in package.json. Run `npx @turbo/codemod transform create-turbo-config` first'});r.info("Renaming `outputMode` key in task config to `outputLogs`");let o=Lu.default.join(t,"turbo.json");if(!(0,ho.existsSync)(o))return i.abortTransform({reason:`No turbo.json found at ${t}. Is the path correct?`});let a=BE(o);return i.modifyFile({filePath:o,after:qE(a)}),xl(t).forEach(c=>{let{config:u,turboConfigPath:h}=c;"pipeline"in u&&i.modifyFile({filePath:h,after:qE(u)})}),i.finish()}var LL={name:HE,description:OL,introducedIn:CL,transformer:UE},PL=LL;0&&(module.exports={transformer});
39
+ `:""}var n0=i0,s0={dump:n0};function qo(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var o0=fe,a0=nh,l0=lh,c0=ph,u0=dh,h0=Do,f0=Ph.load,p0=Ph.loadAll,d0=s0.dump,m0=xe,g0={binary:Eh,float:fh,map:ah,null:ch,pairs:bh,set:wh,timestamp:yh,bool:uh,int:hh,merge:_h,omap:Sh,seq:oh,str:sh},y0=qo("safeLoad","load"),_0=qo("safeLoadAll","loadAll"),E0=qo("safeDump","dump"),S0={Type:o0,Schema:a0,FAILSAFE_SCHEMA:l0,JSON_SCHEMA:c0,CORE_SCHEMA:u0,DEFAULT_SCHEMA:h0,load:f0,loadAll:p0,dump:d0,YAMLException:m0,types:g0,safeLoad:y0,safeLoadAll:_0,safeDump:E0},Gh=S0;var Hd=$(Pd()),Ud=$(require("json5"));var He={};Pu(He,{bold:()=>AR,dimmed:()=>OR,error:()=>qd,grey:()=>CR,info:()=>RR,item:()=>LR,log:()=>qt,turboBlue:()=>qr,turboGradient:()=>vR,turboLoader:()=>Bd,turboRed:()=>Fd,underline:()=>TR,warn:()=>bl,yellow:()=>Md});var Bt=$(require("chalk")),Id=$(require("ora")),kd=$(require("gradient-string")),Nd="#0099F7",Dd="#F11712",xR="#FFFF00",vR=(0,kd.default)(Nd,Dd),qr=Bt.default.hex(Nd),Fd=Bt.default.hex(Dd),Md=Bt.default.hex(xR),Bd=t=>(0,Id.default)({text:t,spinner:{frames:[" ",qr("> "),qr(">> "),qr(">>>")]}}),RR=(...t)=>{qt(qr.bold(">>>"),...t)},AR=(...t)=>{qt(Bt.default.bold(...t))},TR=(...t)=>{qt(Bt.default.underline(...t))},OR=(...t)=>{qt(Bt.default.dim(...t))},CR=(...t)=>{qt(Bt.default.grey(...t))},LR=(...t)=>{qt(qr.bold(" \u2022"),...t)},qt=(...t)=>{console.log(...t)},bl=(...t)=>{console.error(Md.bold(">>>"),...t)},qd=(...t)=>{console.error(Fd.bold(">>>"),...t)};var PR="turbo.json";var wl={};function IR(t){try{if(Li.default.existsSync(lr.default.join(t,"pnpm-workspace.yaml")))return Gh.load(Li.default.readFileSync(lr.default.join(t,"pnpm-workspace.yaml"),"utf8")).packages||[];let e=JSON.parse(Li.default.readFileSync(lr.default.join(t,"package.json"),"utf8"));if(e.workspaces){if("packages"in e.workspaces)return e.workspaces.packages||[];if(Array.isArray(e.workspaces))return e.workspaces}return[]}catch{return[]}}function xl(t,e){var s;let r=Ro(t,e),i=[],n=(s=e==null?void 0:e.cache)!=null?s:!0;if(n&&t&&t in wl)return wl[t];if(r){let a=IR(r).map(c=>`${c}/turbo.json`);(0,Hd.sync)([PR,...a],{cwd:r,onlyFiles:!0,followSymbolicLinks:!1,suppressErrors:!0}).map(c=>lr.default.join(r,c)).forEach(c=>{try{let u=Li.default.readFileSync(c,"utf8"),h=Ud.default.parse(u),f=lr.default.dirname(c)===r;if(f){if("extends"in h)return}else if(!("extends"in h))return;i.push({config:h,turboConfigPath:c,workspacePath:lr.default.dirname(c),isRootConfig:f})}catch(u){bl(u)}})}return n&&t&&(wl[t]=i),i}var AT=$(require("os")),TT=$(vg());var OT=$(require("fs-extra"));var CT=$(require("path")),LT=$(require("fs-extra")),PT=$(require("chalk"));var xE=require("stream"),vE=require("util"),pL=require("path"),dL=require("os"),RE=require("fs"),mL=$(wE());var Sk=(0,vE.promisify)(xE.Stream.pipeline);var AE=require("fs-extra");var RL=$(require("path")),AL=$(kE()),TL=$(require("chalk")),Ou=require("fs-extra");var uo=$(require("chalk"));var Ve=$(require("chalk")),yi=class{constructor(e){this.transform=e.transformer,this.dry=e.dryRun}_log(...e){console.log(...e)}modified(...e){this._log(Ve.default.green(" MODIFIED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}unchanged(...e){this._log(Ve.default.gray(" UNCHANGED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}skipped(...e){this._log(Ve.default.yellow(" SKIPPED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}error(...e){this._log(Ve.default.red(" ERROR "),...e,this.dry?Ve.default.dim("(dry run)"):"")}info(...e){this._log(Ve.default.bold(" INFO "),...e,this.dry?Ve.default.dim("(dry run)"):"")}};var NE=$(require("os")),Cu=$(require("path"));var ao=$(require("chalk")),co=require("diff"),Jt=require("fs-extra"),lo=class{constructor(e){this.changes=[];if(this.filePath=e.filePath,this.rootPath=e.rootPath,this.after=e.after,this.error=e.error,e.before===void 0)try{Cu.default.extname(e.filePath)===".json"?this.before=(0,Jt.readJsonSync)(e.filePath):this.before=(0,Jt.readFileSync)(e.filePath)}catch{this.before=""}else e.before===null?this.before="":this.before=e.before;e.after?typeof this.before=="object"||typeof e.after=="object"?this.changes=(0,co.diffJson)(this.before,e.after):this.changes=(0,co.diffLines)(this.before,e.after):this.changes=[]}fileName(){return Cu.default.relative(this.rootPath,this.filePath)}write(){this.after&&(typeof this.after=="object"?(0,Jt.writeJsonSync)(this.filePath,this.after,{spaces:2}):(0,Jt.writeFileSync)(this.filePath,this.after))}additions(){return this.changes.filter(e=>e.added).length}deletions(){return this.changes.filter(e=>e.removed).length}hasChanges(){return this.additions()>0||this.deletions()>0}log(e){e.diff?(this.changes.forEach(r=>{r.added?process.stdout.write(ao.default.green(r.value)):r.removed?process.stdout.write(ao.default.red(r.value)):process.stdout.write(ao.default.dim(r.value))}),He.log(NE.default.EOL)):He.log(this.after)}};var rn=class{constructor(e){this.modifications={};this.transform=e.transformer,this.rootPath=e.rootPath,this.dry=e.dryRun,this.print=e.print,this.logger=new yi(e)}abortTransform(e){return this.logger.error(e.reason),{fatalError:new Error(e.reason),changes:e.changes||{}}}modifyFile(e){this.modifications[e.filePath]=new lo({rootPath:this.rootPath,...e})}finish(){let e={changes:{}};return Object.keys(this.modifications).forEach(i=>{let n=this.modifications[i],s={action:"unchanged",additions:n.additions(),deletions:n.deletions()};if(n.hasChanges()){if(this.dry)s.action="skipped",this.logger.skipped(uo.default.dim(n.fileName()));else try{n.write(),s.action="modified",this.logger.modified(uo.default.bold(n.fileName()))}catch(o){let a="Unknown error";o instanceof Error&&(a=o.message),s.error=new Error(a),s.action="error",this.logger.error(n.fileName(),a)}this.print&&n.log({diff:!0})}else this.logger.unchanged(uo.default.dim(n.fileName()));e.changes[n.fileName()]=s}),Object.keys(e.changes).some(i=>e.changes[i].action==="error")?this.abortTransform({reason:"Encountered an error while transforming files",changes:e.changes}):e}static logResults(e){let r=Object.keys(e.changes);if(He.log(),r.length>0){He.bold("Results:");let i={};r.forEach(n=>{var o;let s=e.changes[n];i[n]={action:s.action,additions:s.additions,deletions:s.deletions,error:((o=s.error)==null?void 0:o.message)||"None"}}),console.table(i),He.log()}}};function DE({transformer:t,rootPath:e,options:r}){let i={transformer:t,rootPath:e,...r},n=new yi(i),s=new rn(i);return{log:n,runner:s}}var FE=require("fs-extra"),ME=require("json5");function BE(t){let e=(0,FE.readFileSync)(t,"utf8");return(0,ME.parse)(e)}var HE="rename-output-mode",OL='Rename the "outputMode" key to "outputLogs" in `turbo.json`',CL="2.0.0-canary.0";function qE(t){for(let[e,r]of Object.entries(t.pipeline))Object.prototype.hasOwnProperty.call(r,"outputMode")&&(r.outputLogs=r.outputMode,delete r.outputMode);return t}function UE({root:t,options:e}){let{log:r,runner:i}=DE({transformer:HE,rootPath:t,options:e}),n=Lu.default.join(t,"package.json"),s={};try{s=(0,ho.readJsonSync)(n)}catch{}if("turbo"in s)return i.abortTransform({reason:'"turbo" key detected in package.json. Run `npx @turbo/codemod transform create-turbo-config` first'});r.info("Renaming `outputMode` key in task config to `outputLogs`");let o=Lu.default.join(t,"turbo.json");if(!(0,ho.existsSync)(o))return i.abortTransform({reason:`No turbo.json found at ${t}. Is the path correct?`});let a=BE(o);return i.modifyFile({filePath:o,after:qE(a)}),xl(t).forEach(c=>{let{config:u,turboConfigPath:h}=c;"pipeline"in u&&i.modifyFile({filePath:h,after:qE(u)})}),i.finish()}var LL={name:HE,description:OL,introducedIn:CL,transformer:UE},PL=LL;0&&(module.exports={transformer});
40
40
  /*! Bundled license information:
41
41
 
42
42
  @babel/runtime/helpers/regeneratorRuntime.js:
@@ -36,7 +36,7 @@ ${i.message}`:y,R=[x,e,t].filter(Boolean).join(`
36
36
  `+t.slice(n,s),n=s+1),o=a;return l+=`
37
37
  `,t.length-n>e&&o>n?l+=t.slice(n,o)+`
38
38
  `+t.slice(o+1):l+=t.slice(n),l.slice(1)}function Qb(t){for(var e="",r=0,i,n=0;n<t.length;r>=65536?n+=2:n++)r=bi(t,n),i=pe[r],!i&&Ri(r)?(e+=t[n],r>=65536&&(e+=t[n+1])):e+=i||Gb(r);return e}function Jb(t,e,r){var i="",n=t.tag,s,o,a;for(s=0,o=r.length;s<o;s+=1)a=r[s],t.replacer&&(a=t.replacer.call(r,String(s),a)),(pt(t,e,a,!1,!1)||typeof a=="undefined"&&pt(t,e,null,!1,!1))&&(i!==""&&(i+=","+(t.condenseFlow?"":" ")),i+=t.dump);t.tag=n,t.dump="["+i+"]"}function Qu(t,e,r,i){var n="",s=t.tag,o,a,l;for(o=0,a=r.length;o<a;o+=1)l=r[o],t.replacer&&(l=t.replacer.call(r,String(o),l)),(pt(t,e+1,l,!0,!0,!1,!0)||typeof l=="undefined"&&pt(t,e+1,null,!0,!0,!1,!0))&&((!i||n!=="")&&(n+=Lo(t,e)),t.dump&&xi===t.dump.charCodeAt(0)?n+="-":n+="- ",n+=t.dump);t.tag=s,t.dump=n||"[]"}function e0(t,e,r){var i="",n=t.tag,s=Object.keys(r),o,a,l,c,u;for(o=0,a=s.length;o<a;o+=1)u="",i!==""&&(u+=", "),t.condenseFlow&&(u+='"'),l=s[o],c=r[l],t.replacer&&(c=t.replacer.call(r,l,c)),pt(t,e,l,!1,!1)&&(t.dump.length>1024&&(u+="? "),u+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),pt(t,e,c,!1,!1)&&(u+=t.dump,i+=u));t.tag=n,t.dump="{"+i+"}"}function t0(t,e,r,i){var n="",s=t.tag,o=Object.keys(r),a,l,c,u,h,f;if(t.sortKeys===!0)o.sort();else if(typeof t.sortKeys=="function")o.sort(t.sortKeys);else if(t.sortKeys)throw new xe("sortKeys must be a boolean or a function");for(a=0,l=o.length;a<l;a+=1)f="",(!i||n!=="")&&(f+=Lo(t,e)),c=o[a],u=r[c],t.replacer&&(u=t.replacer.call(r,c,u)),pt(t,e+1,c,!0,!0,!0)&&(h=t.tag!==null&&t.tag!=="?"||t.dump&&t.dump.length>1024,h&&(t.dump&&xi===t.dump.charCodeAt(0)?f+="?":f+="? "),f+=t.dump,h&&(f+=Lo(t,e)),pt(t,e+1,u,!0,h)&&(t.dump&&xi===t.dump.charCodeAt(0)?f+=":":f+=": ",f+=t.dump,n+=f));t.tag=s,t.dump=n||"{}"}function Ju(t,e,r){var i,n,s,o,a,l;for(n=r?t.explicitTypes:t.implicitTypes,s=0,o=n.length;s<o;s+=1)if(a=n[s],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof e=="object"&&e instanceof a.instanceOf)&&(!a.predicate||a.predicate(e))){if(r?a.multi&&a.representName?t.tag=a.representName(e):t.tag=a.tag:t.tag="?",a.represent){if(l=t.styleMap[a.tag]||a.defaultStyle,Lh.call(a.represent)==="[object Function]")i=a.represent(e,l);else if(Ph.call(a.represent,l))i=a.represent[l](e,l);else throw new xe("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');t.dump=i}return!0}return!1}function pt(t,e,r,i,n,s,o){t.tag=null,t.dump=r,Ju(t,r,!1)||Ju(t,r,!0);var a=Lh.call(t.dump),l=i,c;i&&(i=t.flowLevel<0||t.flowLevel>e);var u=a==="[object Object]"||a==="[object Array]",h,f;if(u&&(h=t.duplicates.indexOf(r),f=h!==-1),(t.tag!==null&&t.tag!=="?"||f||t.indent!==2&&e>0)&&(n=!1),f&&t.usedDuplicates[h])t.dump="*ref_"+h;else{if(u&&f&&!t.usedDuplicates[h]&&(t.usedDuplicates[h]=!0),a==="[object Object]")i&&Object.keys(t.dump).length!==0?(t0(t,e,t.dump,n),f&&(t.dump="&ref_"+h+t.dump)):(e0(t,e,t.dump),f&&(t.dump="&ref_"+h+" "+t.dump));else if(a==="[object Array]")i&&t.dump.length!==0?(t.noArrayIndent&&!o&&e>0?Qu(t,e-1,t.dump,n):Qu(t,e,t.dump,n),f&&(t.dump="&ref_"+h+t.dump)):(Jb(t,e,t.dump),f&&(t.dump="&ref_"+h+" "+t.dump));else if(a==="[object String]")t.tag!=="?"&&Xb(t,t.dump,e,s,l);else{if(a==="[object Undefined]")return!1;if(t.skipInvalid)return!1;throw new xe("unacceptable kind of an object to dump "+a)}t.tag!==null&&t.tag!=="?"&&(c=encodeURI(t.tag[0]==="!"?t.tag.slice(1):t.tag).replace(/!/g,"%21"),t.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",t.dump=c+" "+t.dump)}return!0}function r0(t,e){var r=[],i=[],n,s;for(Io(t,r,i),n=0,s=i.length;n<s;n+=1)e.duplicates.push(r[i[n]]);e.usedDuplicates=new Array(s)}function Io(t,e,r){var i,n,s;if(t!==null&&typeof t=="object")if(n=e.indexOf(t),n!==-1)r.indexOf(n)===-1&&r.push(n);else if(e.push(t),Array.isArray(t))for(n=0,s=t.length;n<s;n+=1)Io(t[n],e,r);else for(i=Object.keys(t),n=0,s=i.length;n<s;n+=1)Io(t[i[n]],e,r)}function i0(t,e){e=e||{};var r=new Wb(e);r.noRefs||r0(t,r);var i=t;return r.replacer&&(i=r.replacer.call({"":i},"",i)),pt(r,0,i,!0,!0)?r.dump+`
39
- `:""}var n0=i0,s0={dump:n0};function Bo(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var o0=fe,a0=rh,l0=oh,c0=hh,u0=fh,h0=No,f0=Ch.load,p0=Ch.loadAll,d0=s0.dump,m0=xe,g0={binary:yh,float:uh,map:sh,null:ah,pairs:Eh,set:Sh,timestamp:mh,bool:lh,int:ch,merge:gh,omap:_h,seq:nh,str:ih},y0=Bo("safeLoad","load"),_0=Bo("safeLoadAll","loadAll"),E0=Bo("safeDump","dump"),S0={Type:o0,Schema:a0,FAILSAFE_SCHEMA:l0,JSON_SCHEMA:c0,CORE_SCHEMA:u0,DEFAULT_SCHEMA:h0,load:f0,loadAll:p0,dump:d0,YAMLException:m0,types:g0,safeLoad:y0,safeLoadAll:_0,safeDump:E0},Uh=S0;var Bd=$(Cd()),qd=$(require("json5"));var He={};Cu(He,{bold:()=>AR,dimmed:()=>OR,error:()=>Md,grey:()=>CR,info:()=>RR,item:()=>LR,log:()=>qt,turboBlue:()=>qr,turboGradient:()=>vR,turboLoader:()=>Fd,turboRed:()=>Nd,underline:()=>TR,warn:()=>Sl,yellow:()=>Dd});var Bt=$(require("chalk")),Ld=$(require("ora")),Pd=$(require("gradient-string")),Id="#0099F7",kd="#F11712",xR="#FFFF00",vR=(0,Pd.default)(Id,kd),qr=Bt.default.hex(Id),Nd=Bt.default.hex(kd),Dd=Bt.default.hex(xR),Fd=t=>(0,Ld.default)({text:t,spinner:{frames:[" ",qr("> "),qr(">> "),qr(">>>")]}}),RR=(...t)=>{qt(qr.bold(">>>"),...t)},AR=(...t)=>{qt(Bt.default.bold(...t))},TR=(...t)=>{qt(Bt.default.underline(...t))},OR=(...t)=>{qt(Bt.default.dim(...t))},CR=(...t)=>{qt(Bt.default.grey(...t))},LR=(...t)=>{qt(qr.bold(" \u2022"),...t)},qt=(...t)=>{console.log(...t)},Sl=(...t)=>{console.error(Dd.bold(">>>"),...t)},Md=(...t)=>{console.error(Nd.bold(">>>"),...t)};var PR="turbo.json";var bl={};function IR(t){try{if(Li.default.existsSync(lr.default.join(t,"pnpm-workspace.yaml")))return Uh.load(Li.default.readFileSync(lr.default.join(t,"pnpm-workspace.yaml"),"utf8")).packages||[];let e=JSON.parse(Li.default.readFileSync(lr.default.join(t,"package.json"),"utf8"));if(e.workspaces){if("packages"in e.workspaces)return e.workspaces.packages||[];if(Array.isArray(e.workspaces))return e.workspaces}return[]}catch{return[]}}function wl(t,e){var s;let r=vo(t,e),i=[],n=(s=e==null?void 0:e.cache)!=null?s:!0;if(n&&t&&t in bl)return bl[t];if(r){let a=IR(r).map(c=>`${c}/turbo.json`);(0,Bd.sync)([PR,...a],{cwd:r,onlyFiles:!0,followSymbolicLinks:!1,suppressErrors:!0}).map(c=>lr.default.join(r,c)).forEach(c=>{try{let u=Li.default.readFileSync(c,"utf8"),h=qd.default.parse(u),f=lr.default.dirname(c)===r;if(f){if("extends"in h)return}else if(!("extends"in h))return;i.push({config:h,turboConfigPath:c,workspacePath:lr.default.dirname(c),isRootConfig:f})}catch(u){Sl(u)}})}return n&&t&&(bl[t]=i),i}var AT=$(require("os")),TT=$(wg());var OT=$(require("fs-extra"));var CT=$(require("path")),LT=$(require("fs-extra")),PT=$(require("chalk"));var bE=require("stream"),wE=require("util"),p1=require("path"),d1=require("os"),xE=require("fs"),m1=$(SE());var Sk=(0,wE.promisify)(bE.Stream.pipeline);var vE=require("fs-extra");var R1=$(require("path")),A1=$(PE()),T1=$(require("chalk")),Tu=require("fs-extra");var uo=$(require("chalk"));var Ve=$(require("chalk")),yi=class{constructor(e){this.transform=e.transformer,this.dry=e.dry}_log(...e){console.log(...e)}modified(...e){this._log(Ve.default.green(" MODIFIED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}unchanged(...e){this._log(Ve.default.gray(" UNCHANGED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}skipped(...e){this._log(Ve.default.yellow(" SKIPPED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}error(...e){this._log(Ve.default.red(" ERROR "),...e,this.dry?Ve.default.dim("(dry run)"):"")}info(...e){this._log(Ve.default.bold(" INFO "),...e,this.dry?Ve.default.dim("(dry run)"):"")}};var IE=$(require("os")),Ou=$(require("path"));var ao=$(require("chalk")),co=require("diff"),Jt=require("fs-extra"),lo=class{constructor(e){this.changes=[];if(this.filePath=e.filePath,this.rootPath=e.rootPath,this.after=e.after,this.error=e.error,e.before===void 0)try{Ou.default.extname(e.filePath)===".json"?this.before=(0,Jt.readJsonSync)(e.filePath):this.before=(0,Jt.readFileSync)(e.filePath)}catch{this.before=""}else e.before===null?this.before="":this.before=e.before;e.after?typeof this.before=="object"||typeof e.after=="object"?this.changes=(0,co.diffJson)(this.before,e.after):this.changes=(0,co.diffLines)(this.before,e.after):this.changes=[]}fileName(){return Ou.default.relative(this.rootPath,this.filePath)}write(){this.after&&(typeof this.after=="object"?(0,Jt.writeJsonSync)(this.filePath,this.after,{spaces:2}):(0,Jt.writeFileSync)(this.filePath,this.after))}additions(){return this.changes.filter(e=>e.added).length}deletions(){return this.changes.filter(e=>e.removed).length}hasChanges(){return this.additions()>0||this.deletions()>0}log(e){e.diff?(this.changes.forEach(r=>{r.added?process.stdout.write(ao.default.green(r.value)):r.removed?process.stdout.write(ao.default.red(r.value)):process.stdout.write(ao.default.dim(r.value))}),He.log(IE.default.EOL)):He.log(this.after)}};var rn=class{constructor(e){this.modifications={};this.transform=e.transformer,this.rootPath=e.rootPath,this.dry=e.dry,this.print=e.print,this.logger=new yi(e)}abortTransform(e){return this.logger.error(e.reason),{fatalError:new Error(e.reason),changes:e.changes||{}}}modifyFile(e){this.modifications[e.filePath]=new lo({rootPath:this.rootPath,...e})}finish(){let e={changes:{}};return Object.keys(this.modifications).forEach(i=>{let n=this.modifications[i],s={action:"unchanged",additions:n.additions(),deletions:n.deletions()};if(n.hasChanges()){if(this.dry)s.action="skipped",this.logger.skipped(uo.default.dim(n.fileName()));else try{n.write(),s.action="modified",this.logger.modified(uo.default.bold(n.fileName()))}catch(o){let a="Unknown error";o instanceof Error&&(a=o.message),s.error=new Error(a),s.action="error",this.logger.error(n.fileName(),a)}this.print&&n.log({diff:!0})}else this.logger.unchanged(uo.default.dim(n.fileName()));e.changes[n.fileName()]=s}),Object.keys(e.changes).some(i=>e.changes[i].action==="error")?this.abortTransform({reason:"Encountered an error while transforming files",changes:e.changes}):e}static logResults(e){let r=Object.keys(e.changes);if(He.log(),r.length>0){He.bold("Results:");let i={};r.forEach(n=>{var o;let s=e.changes[n];i[n]={action:s.action,additions:s.additions,deletions:s.deletions,error:((o=s.error)==null?void 0:o.message)||"None"}}),console.table(i),He.log()}}};function kE({transformer:t,rootPath:e,options:r}){let i={transformer:t,rootPath:e,...r},n=new yi(i),s=new rn(i);return{log:n,runner:s}}var NE=require("fs-extra"),DE=require("json5");function FE(t){let e=(0,NE.readFileSync)(t,"utf8");return(0,DE.parse)(e)}var HE="rename-pipeline",O1='Rename the "pipeline" key to "tasks" in `turbo.json`',C1="2.0.0-canary.0";function ME(t){let{pipeline:e,...r}=t;return{...r,tasks:e}}function UE({root:t,options:e}){let{log:r,runner:i}=kE({transformer:HE,rootPath:t,options:e});r.info("Renaming `pipeline` key in turbo.json to `tasks`");let n=BE.default.join(t,"turbo.json");if(!(0,qE.existsSync)(n))return i.abortTransform({reason:`No turbo.json found at ${t}. Is the path correct?`});let s=FE(n);return i.modifyFile({filePath:n,after:ME(s)}),wl(t).forEach(a=>{let{config:l,turboConfigPath:c}=a;"pipeline"in l&&i.modifyFile({filePath:c,after:ME(l)})}),i.finish()}var L1={name:HE,description:O1,introducedIn:C1,transformer:UE},P1=L1;0&&(module.exports={transformer});
39
+ `:""}var n0=i0,s0={dump:n0};function Bo(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var o0=fe,a0=rh,l0=oh,c0=hh,u0=fh,h0=No,f0=Ch.load,p0=Ch.loadAll,d0=s0.dump,m0=xe,g0={binary:yh,float:uh,map:sh,null:ah,pairs:Eh,set:Sh,timestamp:mh,bool:lh,int:ch,merge:gh,omap:_h,seq:nh,str:ih},y0=Bo("safeLoad","load"),_0=Bo("safeLoadAll","loadAll"),E0=Bo("safeDump","dump"),S0={Type:o0,Schema:a0,FAILSAFE_SCHEMA:l0,JSON_SCHEMA:c0,CORE_SCHEMA:u0,DEFAULT_SCHEMA:h0,load:f0,loadAll:p0,dump:d0,YAMLException:m0,types:g0,safeLoad:y0,safeLoadAll:_0,safeDump:E0},Uh=S0;var Bd=$(Cd()),qd=$(require("json5"));var He={};Cu(He,{bold:()=>AR,dimmed:()=>OR,error:()=>Md,grey:()=>CR,info:()=>RR,item:()=>LR,log:()=>qt,turboBlue:()=>qr,turboGradient:()=>vR,turboLoader:()=>Fd,turboRed:()=>Nd,underline:()=>TR,warn:()=>Sl,yellow:()=>Dd});var Bt=$(require("chalk")),Ld=$(require("ora")),Pd=$(require("gradient-string")),Id="#0099F7",kd="#F11712",xR="#FFFF00",vR=(0,Pd.default)(Id,kd),qr=Bt.default.hex(Id),Nd=Bt.default.hex(kd),Dd=Bt.default.hex(xR),Fd=t=>(0,Ld.default)({text:t,spinner:{frames:[" ",qr("> "),qr(">> "),qr(">>>")]}}),RR=(...t)=>{qt(qr.bold(">>>"),...t)},AR=(...t)=>{qt(Bt.default.bold(...t))},TR=(...t)=>{qt(Bt.default.underline(...t))},OR=(...t)=>{qt(Bt.default.dim(...t))},CR=(...t)=>{qt(Bt.default.grey(...t))},LR=(...t)=>{qt(qr.bold(" \u2022"),...t)},qt=(...t)=>{console.log(...t)},Sl=(...t)=>{console.error(Dd.bold(">>>"),...t)},Md=(...t)=>{console.error(Nd.bold(">>>"),...t)};var PR="turbo.json";var bl={};function IR(t){try{if(Li.default.existsSync(lr.default.join(t,"pnpm-workspace.yaml")))return Uh.load(Li.default.readFileSync(lr.default.join(t,"pnpm-workspace.yaml"),"utf8")).packages||[];let e=JSON.parse(Li.default.readFileSync(lr.default.join(t,"package.json"),"utf8"));if(e.workspaces){if("packages"in e.workspaces)return e.workspaces.packages||[];if(Array.isArray(e.workspaces))return e.workspaces}return[]}catch{return[]}}function wl(t,e){var s;let r=vo(t,e),i=[],n=(s=e==null?void 0:e.cache)!=null?s:!0;if(n&&t&&t in bl)return bl[t];if(r){let a=IR(r).map(c=>`${c}/turbo.json`);(0,Bd.sync)([PR,...a],{cwd:r,onlyFiles:!0,followSymbolicLinks:!1,suppressErrors:!0}).map(c=>lr.default.join(r,c)).forEach(c=>{try{let u=Li.default.readFileSync(c,"utf8"),h=qd.default.parse(u),f=lr.default.dirname(c)===r;if(f){if("extends"in h)return}else if(!("extends"in h))return;i.push({config:h,turboConfigPath:c,workspacePath:lr.default.dirname(c),isRootConfig:f})}catch(u){Sl(u)}})}return n&&t&&(bl[t]=i),i}var AT=$(require("os")),TT=$(wg());var OT=$(require("fs-extra"));var CT=$(require("path")),LT=$(require("fs-extra")),PT=$(require("chalk"));var bE=require("stream"),wE=require("util"),p1=require("path"),d1=require("os"),xE=require("fs"),m1=$(SE());var Sk=(0,wE.promisify)(bE.Stream.pipeline);var vE=require("fs-extra");var R1=$(require("path")),A1=$(PE()),T1=$(require("chalk")),Tu=require("fs-extra");var uo=$(require("chalk"));var Ve=$(require("chalk")),yi=class{constructor(e){this.transform=e.transformer,this.dry=e.dryRun}_log(...e){console.log(...e)}modified(...e){this._log(Ve.default.green(" MODIFIED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}unchanged(...e){this._log(Ve.default.gray(" UNCHANGED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}skipped(...e){this._log(Ve.default.yellow(" SKIPPED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}error(...e){this._log(Ve.default.red(" ERROR "),...e,this.dry?Ve.default.dim("(dry run)"):"")}info(...e){this._log(Ve.default.bold(" INFO "),...e,this.dry?Ve.default.dim("(dry run)"):"")}};var IE=$(require("os")),Ou=$(require("path"));var ao=$(require("chalk")),co=require("diff"),Jt=require("fs-extra"),lo=class{constructor(e){this.changes=[];if(this.filePath=e.filePath,this.rootPath=e.rootPath,this.after=e.after,this.error=e.error,e.before===void 0)try{Ou.default.extname(e.filePath)===".json"?this.before=(0,Jt.readJsonSync)(e.filePath):this.before=(0,Jt.readFileSync)(e.filePath)}catch{this.before=""}else e.before===null?this.before="":this.before=e.before;e.after?typeof this.before=="object"||typeof e.after=="object"?this.changes=(0,co.diffJson)(this.before,e.after):this.changes=(0,co.diffLines)(this.before,e.after):this.changes=[]}fileName(){return Ou.default.relative(this.rootPath,this.filePath)}write(){this.after&&(typeof this.after=="object"?(0,Jt.writeJsonSync)(this.filePath,this.after,{spaces:2}):(0,Jt.writeFileSync)(this.filePath,this.after))}additions(){return this.changes.filter(e=>e.added).length}deletions(){return this.changes.filter(e=>e.removed).length}hasChanges(){return this.additions()>0||this.deletions()>0}log(e){e.diff?(this.changes.forEach(r=>{r.added?process.stdout.write(ao.default.green(r.value)):r.removed?process.stdout.write(ao.default.red(r.value)):process.stdout.write(ao.default.dim(r.value))}),He.log(IE.default.EOL)):He.log(this.after)}};var rn=class{constructor(e){this.modifications={};this.transform=e.transformer,this.rootPath=e.rootPath,this.dry=e.dryRun,this.print=e.print,this.logger=new yi(e)}abortTransform(e){return this.logger.error(e.reason),{fatalError:new Error(e.reason),changes:e.changes||{}}}modifyFile(e){this.modifications[e.filePath]=new lo({rootPath:this.rootPath,...e})}finish(){let e={changes:{}};return Object.keys(this.modifications).forEach(i=>{let n=this.modifications[i],s={action:"unchanged",additions:n.additions(),deletions:n.deletions()};if(n.hasChanges()){if(this.dry)s.action="skipped",this.logger.skipped(uo.default.dim(n.fileName()));else try{n.write(),s.action="modified",this.logger.modified(uo.default.bold(n.fileName()))}catch(o){let a="Unknown error";o instanceof Error&&(a=o.message),s.error=new Error(a),s.action="error",this.logger.error(n.fileName(),a)}this.print&&n.log({diff:!0})}else this.logger.unchanged(uo.default.dim(n.fileName()));e.changes[n.fileName()]=s}),Object.keys(e.changes).some(i=>e.changes[i].action==="error")?this.abortTransform({reason:"Encountered an error while transforming files",changes:e.changes}):e}static logResults(e){let r=Object.keys(e.changes);if(He.log(),r.length>0){He.bold("Results:");let i={};r.forEach(n=>{var o;let s=e.changes[n];i[n]={action:s.action,additions:s.additions,deletions:s.deletions,error:((o=s.error)==null?void 0:o.message)||"None"}}),console.table(i),He.log()}}};function kE({transformer:t,rootPath:e,options:r}){let i={transformer:t,rootPath:e,...r},n=new yi(i),s=new rn(i);return{log:n,runner:s}}var NE=require("fs-extra"),DE=require("json5");function FE(t){let e=(0,NE.readFileSync)(t,"utf8");return(0,DE.parse)(e)}var HE="rename-pipeline",O1='Rename the "pipeline" key to "tasks" in `turbo.json`',C1="2.0.0-canary.0";function ME(t){let{pipeline:e,...r}=t;return{...r,tasks:e}}function UE({root:t,options:e}){let{log:r,runner:i}=kE({transformer:HE,rootPath:t,options:e});r.info("Renaming `pipeline` key in turbo.json to `tasks`");let n=BE.default.join(t,"turbo.json");if(!(0,qE.existsSync)(n))return i.abortTransform({reason:`No turbo.json found at ${t}. Is the path correct?`});let s=FE(n);return i.modifyFile({filePath:n,after:ME(s)}),wl(t).forEach(a=>{let{config:l,turboConfigPath:c}=a;"pipeline"in l&&i.modifyFile({filePath:c,after:ME(l)})}),i.finish()}var L1={name:HE,description:O1,introducedIn:C1,transformer:UE},P1=L1;0&&(module.exports={transformer});
40
40
  /*! Bundled license information:
41
41
 
42
42
  @babel/runtime/helpers/regeneratorRuntime.js:
@@ -36,7 +36,7 @@ ${i.message}`:y,R=[x,e,t].filter(Boolean).join(`
36
36
  `+t.slice(n,s),n=s+1),o=a;return l+=`
37
37
  `,t.length-n>e&&o>n?l+=t.slice(n,o)+`
38
38
  `+t.slice(o+1):l+=t.slice(n),l.slice(1)}function Qb(t){for(var e="",r=0,i,n=0;n<t.length;r>=65536?n+=2:n++)r=bi(t,n),i=pe[r],!i&&Ri(r)?(e+=t[n],r>=65536&&(e+=t[n+1])):e+=i||Gb(r);return e}function Jb(t,e,r){var i="",n=t.tag,s,o,a;for(s=0,o=r.length;s<o;s+=1)a=r[s],t.replacer&&(a=t.replacer.call(r,String(s),a)),(pt(t,e,a,!1,!1)||typeof a=="undefined"&&pt(t,e,null,!1,!1))&&(i!==""&&(i+=","+(t.condenseFlow?"":" ")),i+=t.dump);t.tag=n,t.dump="["+i+"]"}function eh(t,e,r,i){var n="",s=t.tag,o,a,l;for(o=0,a=r.length;o<a;o+=1)l=r[o],t.replacer&&(l=t.replacer.call(r,String(o),l)),(pt(t,e+1,l,!0,!0,!1,!0)||typeof l=="undefined"&&pt(t,e+1,null,!0,!0,!1,!0))&&((!i||n!=="")&&(n+=Po(t,e)),t.dump&&xi===t.dump.charCodeAt(0)?n+="-":n+="- ",n+=t.dump);t.tag=s,t.dump=n||"[]"}function e0(t,e,r){var i="",n=t.tag,s=Object.keys(r),o,a,l,c,u;for(o=0,a=s.length;o<a;o+=1)u="",i!==""&&(u+=", "),t.condenseFlow&&(u+='"'),l=s[o],c=r[l],t.replacer&&(c=t.replacer.call(r,l,c)),pt(t,e,l,!1,!1)&&(t.dump.length>1024&&(u+="? "),u+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),pt(t,e,c,!1,!1)&&(u+=t.dump,i+=u));t.tag=n,t.dump="{"+i+"}"}function t0(t,e,r,i){var n="",s=t.tag,o=Object.keys(r),a,l,c,u,h,f;if(t.sortKeys===!0)o.sort();else if(typeof t.sortKeys=="function")o.sort(t.sortKeys);else if(t.sortKeys)throw new xe("sortKeys must be a boolean or a function");for(a=0,l=o.length;a<l;a+=1)f="",(!i||n!=="")&&(f+=Po(t,e)),c=o[a],u=r[c],t.replacer&&(u=t.replacer.call(r,c,u)),pt(t,e+1,c,!0,!0,!0)&&(h=t.tag!==null&&t.tag!=="?"||t.dump&&t.dump.length>1024,h&&(t.dump&&xi===t.dump.charCodeAt(0)?f+="?":f+="? "),f+=t.dump,h&&(f+=Po(t,e)),pt(t,e+1,u,!0,h)&&(t.dump&&xi===t.dump.charCodeAt(0)?f+=":":f+=": ",f+=t.dump,n+=f));t.tag=s,t.dump=n||"{}"}function th(t,e,r){var i,n,s,o,a,l;for(n=r?t.explicitTypes:t.implicitTypes,s=0,o=n.length;s<o;s+=1)if(a=n[s],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof e=="object"&&e instanceof a.instanceOf)&&(!a.predicate||a.predicate(e))){if(r?a.multi&&a.representName?t.tag=a.representName(e):t.tag=a.tag:t.tag="?",a.represent){if(l=t.styleMap[a.tag]||a.defaultStyle,Ih.call(a.represent)==="[object Function]")i=a.represent(e,l);else if(kh.call(a.represent,l))i=a.represent[l](e,l);else throw new xe("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');t.dump=i}return!0}return!1}function pt(t,e,r,i,n,s,o){t.tag=null,t.dump=r,th(t,r,!1)||th(t,r,!0);var a=Ih.call(t.dump),l=i,c;i&&(i=t.flowLevel<0||t.flowLevel>e);var u=a==="[object Object]"||a==="[object Array]",h,f;if(u&&(h=t.duplicates.indexOf(r),f=h!==-1),(t.tag!==null&&t.tag!=="?"||f||t.indent!==2&&e>0)&&(n=!1),f&&t.usedDuplicates[h])t.dump="*ref_"+h;else{if(u&&f&&!t.usedDuplicates[h]&&(t.usedDuplicates[h]=!0),a==="[object Object]")i&&Object.keys(t.dump).length!==0?(t0(t,e,t.dump,n),f&&(t.dump="&ref_"+h+t.dump)):(e0(t,e,t.dump),f&&(t.dump="&ref_"+h+" "+t.dump));else if(a==="[object Array]")i&&t.dump.length!==0?(t.noArrayIndent&&!o&&e>0?eh(t,e-1,t.dump,n):eh(t,e,t.dump,n),f&&(t.dump="&ref_"+h+t.dump)):(Jb(t,e,t.dump),f&&(t.dump="&ref_"+h+" "+t.dump));else if(a==="[object String]")t.tag!=="?"&&Xb(t,t.dump,e,s,l);else{if(a==="[object Undefined]")return!1;if(t.skipInvalid)return!1;throw new xe("unacceptable kind of an object to dump "+a)}t.tag!==null&&t.tag!=="?"&&(c=encodeURI(t.tag[0]==="!"?t.tag.slice(1):t.tag).replace(/!/g,"%21"),t.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",t.dump=c+" "+t.dump)}return!0}function r0(t,e){var r=[],i=[],n,s;for(ko(t,r,i),n=0,s=i.length;n<s;n+=1)e.duplicates.push(r[i[n]]);e.usedDuplicates=new Array(s)}function ko(t,e,r){var i,n,s;if(t!==null&&typeof t=="object")if(n=e.indexOf(t),n!==-1)r.indexOf(n)===-1&&r.push(n);else if(e.push(t),Array.isArray(t))for(n=0,s=t.length;n<s;n+=1)ko(t[n],e,r);else for(i=Object.keys(t),n=0,s=i.length;n<s;n+=1)ko(t[i[n]],e,r)}function i0(t,e){e=e||{};var r=new Wb(e);r.noRefs||r0(t,r);var i=t;return r.replacer&&(i=r.replacer.call({"":i},"",i)),pt(r,0,i,!0,!0)?r.dump+`
39
- `:""}var n0=i0,s0={dump:n0};function qo(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var o0=fe,a0=nh,l0=lh,c0=ph,u0=dh,h0=Do,f0=Ph.load,p0=Ph.loadAll,d0=s0.dump,m0=xe,g0={binary:Eh,float:fh,map:ah,null:ch,pairs:bh,set:wh,timestamp:yh,bool:uh,int:hh,merge:_h,omap:Sh,seq:oh,str:sh},y0=qo("safeLoad","load"),_0=qo("safeLoadAll","loadAll"),E0=qo("safeDump","dump"),S0={Type:o0,Schema:a0,FAILSAFE_SCHEMA:l0,JSON_SCHEMA:c0,CORE_SCHEMA:u0,DEFAULT_SCHEMA:h0,load:f0,loadAll:p0,dump:d0,YAMLException:m0,types:g0,safeLoad:y0,safeLoadAll:_0,safeDump:E0},Gh=S0;var Hd=$(Pd()),Ud=$(require("json5"));var He={};Pu(He,{bold:()=>AR,dimmed:()=>OR,error:()=>qd,grey:()=>CR,info:()=>RR,item:()=>LR,log:()=>qt,turboBlue:()=>qr,turboGradient:()=>vR,turboLoader:()=>Bd,turboRed:()=>Fd,underline:()=>TR,warn:()=>bl,yellow:()=>Md});var Bt=$(require("chalk")),Id=$(require("ora")),kd=$(require("gradient-string")),Nd="#0099F7",Dd="#F11712",xR="#FFFF00",vR=(0,kd.default)(Nd,Dd),qr=Bt.default.hex(Nd),Fd=Bt.default.hex(Dd),Md=Bt.default.hex(xR),Bd=t=>(0,Id.default)({text:t,spinner:{frames:[" ",qr("> "),qr(">> "),qr(">>>")]}}),RR=(...t)=>{qt(qr.bold(">>>"),...t)},AR=(...t)=>{qt(Bt.default.bold(...t))},TR=(...t)=>{qt(Bt.default.underline(...t))},OR=(...t)=>{qt(Bt.default.dim(...t))},CR=(...t)=>{qt(Bt.default.grey(...t))},LR=(...t)=>{qt(qr.bold(" \u2022"),...t)},qt=(...t)=>{console.log(...t)},bl=(...t)=>{console.error(Md.bold(">>>"),...t)},qd=(...t)=>{console.error(Fd.bold(">>>"),...t)};var PR="turbo.json";var wl={};function IR(t){try{if(Li.default.existsSync(lr.default.join(t,"pnpm-workspace.yaml")))return Gh.load(Li.default.readFileSync(lr.default.join(t,"pnpm-workspace.yaml"),"utf8")).packages||[];let e=JSON.parse(Li.default.readFileSync(lr.default.join(t,"package.json"),"utf8"));if(e.workspaces){if("packages"in e.workspaces)return e.workspaces.packages||[];if(Array.isArray(e.workspaces))return e.workspaces}return[]}catch{return[]}}function xl(t,e){var s;let r=Ro(t,e),i=[],n=(s=e==null?void 0:e.cache)!=null?s:!0;if(n&&t&&t in wl)return wl[t];if(r){let a=IR(r).map(c=>`${c}/turbo.json`);(0,Hd.sync)([PR,...a],{cwd:r,onlyFiles:!0,followSymbolicLinks:!1,suppressErrors:!0}).map(c=>lr.default.join(r,c)).forEach(c=>{try{let u=Li.default.readFileSync(c,"utf8"),h=Ud.default.parse(u),f=lr.default.dirname(c)===r;if(f){if("extends"in h)return}else if(!("extends"in h))return;i.push({config:h,turboConfigPath:c,workspacePath:lr.default.dirname(c),isRootConfig:f})}catch(u){bl(u)}})}return n&&t&&(wl[t]=i),i}var AT=$(require("os")),TT=$(vg());var OT=$(require("fs-extra"));var CT=$(require("path")),LT=$(require("fs-extra")),PT=$(require("chalk"));var xE=require("stream"),vE=require("util"),p1=require("path"),d1=require("os"),RE=require("fs"),m1=$(wE());var wk=(0,vE.promisify)(xE.Stream.pipeline);var AE=require("fs-extra");var R1=$(require("path")),A1=$(kE()),T1=$(require("chalk")),Ou=require("fs-extra");var uo=$(require("chalk"));var Ve=$(require("chalk")),yi=class{constructor(e){this.transform=e.transformer,this.dry=e.dry}_log(...e){console.log(...e)}modified(...e){this._log(Ve.default.green(" MODIFIED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}unchanged(...e){this._log(Ve.default.gray(" UNCHANGED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}skipped(...e){this._log(Ve.default.yellow(" SKIPPED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}error(...e){this._log(Ve.default.red(" ERROR "),...e,this.dry?Ve.default.dim("(dry run)"):"")}info(...e){this._log(Ve.default.bold(" INFO "),...e,this.dry?Ve.default.dim("(dry run)"):"")}};var NE=$(require("os")),Cu=$(require("path"));var ao=$(require("chalk")),co=require("diff"),Jt=require("fs-extra"),lo=class{constructor(e){this.changes=[];if(this.filePath=e.filePath,this.rootPath=e.rootPath,this.after=e.after,this.error=e.error,e.before===void 0)try{Cu.default.extname(e.filePath)===".json"?this.before=(0,Jt.readJsonSync)(e.filePath):this.before=(0,Jt.readFileSync)(e.filePath)}catch{this.before=""}else e.before===null?this.before="":this.before=e.before;e.after?typeof this.before=="object"||typeof e.after=="object"?this.changes=(0,co.diffJson)(this.before,e.after):this.changes=(0,co.diffLines)(this.before,e.after):this.changes=[]}fileName(){return Cu.default.relative(this.rootPath,this.filePath)}write(){this.after&&(typeof this.after=="object"?(0,Jt.writeJsonSync)(this.filePath,this.after,{spaces:2}):(0,Jt.writeFileSync)(this.filePath,this.after))}additions(){return this.changes.filter(e=>e.added).length}deletions(){return this.changes.filter(e=>e.removed).length}hasChanges(){return this.additions()>0||this.deletions()>0}log(e){e.diff?(this.changes.forEach(r=>{r.added?process.stdout.write(ao.default.green(r.value)):r.removed?process.stdout.write(ao.default.red(r.value)):process.stdout.write(ao.default.dim(r.value))}),He.log(NE.default.EOL)):He.log(this.after)}};var rn=class{constructor(e){this.modifications={};this.transform=e.transformer,this.rootPath=e.rootPath,this.dry=e.dry,this.print=e.print,this.logger=new yi(e)}abortTransform(e){return this.logger.error(e.reason),{fatalError:new Error(e.reason),changes:e.changes||{}}}modifyFile(e){this.modifications[e.filePath]=new lo({rootPath:this.rootPath,...e})}finish(){let e={changes:{}};return Object.keys(this.modifications).forEach(i=>{let n=this.modifications[i],s={action:"unchanged",additions:n.additions(),deletions:n.deletions()};if(n.hasChanges()){if(this.dry)s.action="skipped",this.logger.skipped(uo.default.dim(n.fileName()));else try{n.write(),s.action="modified",this.logger.modified(uo.default.bold(n.fileName()))}catch(o){let a="Unknown error";o instanceof Error&&(a=o.message),s.error=new Error(a),s.action="error",this.logger.error(n.fileName(),a)}this.print&&n.log({diff:!0})}else this.logger.unchanged(uo.default.dim(n.fileName()));e.changes[n.fileName()]=s}),Object.keys(e.changes).some(i=>e.changes[i].action==="error")?this.abortTransform({reason:"Encountered an error while transforming files",changes:e.changes}):e}static logResults(e){let r=Object.keys(e.changes);if(He.log(),r.length>0){He.bold("Results:");let i={};r.forEach(n=>{var o;let s=e.changes[n];i[n]={action:s.action,additions:s.additions,deletions:s.deletions,error:((o=s.error)==null?void 0:o.message)||"None"}}),console.table(i),He.log()}}};function DE({transformer:t,rootPath:e,options:r}){let i={transformer:t,rootPath:e,...r},n=new yi(i),s=new rn(i);return{log:n,runner:s}}var FE=require("fs-extra"),ME=require("json5");function BE(t){let e=(0,FE.readFileSync)(t,"utf8");return(0,ME.parse)(e)}var O1=["dist/**","build/**"],HE="set-default-outputs",C1='Add the "outputs" key with defaults where it is missing in `turbo.json`',L1="1.7.0",P1=!1;function qE(t){for(let[e,r]of Object.entries(t.pipeline))r.cache!==!1&&(r.outputs?Array.isArray(r.outputs)&&r.outputs.length===0&&delete r.outputs:r.outputs=O1);return t}function UE({root:t,options:e}){let{log:r,runner:i}=DE({transformer:HE,rootPath:t,options:e}),n=Lu.default.join(t,"package.json"),s={};try{s=(0,ho.readJsonSync)(n)}catch{}if("turbo"in s)return i.abortTransform({reason:'"turbo" key detected in package.json. Run `npx @turbo/codemod transform create-turbo-config` first'});r.info("Adding default `outputs` key into tasks if it doesn't exist");let o=Lu.default.join(t,"turbo.json");if(!(0,ho.existsSync)(o))return i.abortTransform({reason:`No turbo.json found at ${t}. Is the path correct?`});let a=BE(o);return i.modifyFile({filePath:o,after:qE(a)}),xl(t).forEach(c=>{let{config:u,turboConfigPath:h}=c;"pipeline"in u&&i.modifyFile({filePath:h,after:qE(u)})}),i.finish()}var I1={name:HE,description:C1,introducedIn:L1,idempotent:P1,transformer:UE},k1=I1;0&&(module.exports={transformer});
39
+ `:""}var n0=i0,s0={dump:n0};function qo(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var o0=fe,a0=nh,l0=lh,c0=ph,u0=dh,h0=Do,f0=Ph.load,p0=Ph.loadAll,d0=s0.dump,m0=xe,g0={binary:Eh,float:fh,map:ah,null:ch,pairs:bh,set:wh,timestamp:yh,bool:uh,int:hh,merge:_h,omap:Sh,seq:oh,str:sh},y0=qo("safeLoad","load"),_0=qo("safeLoadAll","loadAll"),E0=qo("safeDump","dump"),S0={Type:o0,Schema:a0,FAILSAFE_SCHEMA:l0,JSON_SCHEMA:c0,CORE_SCHEMA:u0,DEFAULT_SCHEMA:h0,load:f0,loadAll:p0,dump:d0,YAMLException:m0,types:g0,safeLoad:y0,safeLoadAll:_0,safeDump:E0},Gh=S0;var Hd=$(Pd()),Ud=$(require("json5"));var He={};Pu(He,{bold:()=>AR,dimmed:()=>OR,error:()=>qd,grey:()=>CR,info:()=>RR,item:()=>LR,log:()=>qt,turboBlue:()=>qr,turboGradient:()=>vR,turboLoader:()=>Bd,turboRed:()=>Fd,underline:()=>TR,warn:()=>bl,yellow:()=>Md});var Bt=$(require("chalk")),Id=$(require("ora")),kd=$(require("gradient-string")),Nd="#0099F7",Dd="#F11712",xR="#FFFF00",vR=(0,kd.default)(Nd,Dd),qr=Bt.default.hex(Nd),Fd=Bt.default.hex(Dd),Md=Bt.default.hex(xR),Bd=t=>(0,Id.default)({text:t,spinner:{frames:[" ",qr("> "),qr(">> "),qr(">>>")]}}),RR=(...t)=>{qt(qr.bold(">>>"),...t)},AR=(...t)=>{qt(Bt.default.bold(...t))},TR=(...t)=>{qt(Bt.default.underline(...t))},OR=(...t)=>{qt(Bt.default.dim(...t))},CR=(...t)=>{qt(Bt.default.grey(...t))},LR=(...t)=>{qt(qr.bold(" \u2022"),...t)},qt=(...t)=>{console.log(...t)},bl=(...t)=>{console.error(Md.bold(">>>"),...t)},qd=(...t)=>{console.error(Fd.bold(">>>"),...t)};var PR="turbo.json";var wl={};function IR(t){try{if(Li.default.existsSync(lr.default.join(t,"pnpm-workspace.yaml")))return Gh.load(Li.default.readFileSync(lr.default.join(t,"pnpm-workspace.yaml"),"utf8")).packages||[];let e=JSON.parse(Li.default.readFileSync(lr.default.join(t,"package.json"),"utf8"));if(e.workspaces){if("packages"in e.workspaces)return e.workspaces.packages||[];if(Array.isArray(e.workspaces))return e.workspaces}return[]}catch{return[]}}function xl(t,e){var s;let r=Ro(t,e),i=[],n=(s=e==null?void 0:e.cache)!=null?s:!0;if(n&&t&&t in wl)return wl[t];if(r){let a=IR(r).map(c=>`${c}/turbo.json`);(0,Hd.sync)([PR,...a],{cwd:r,onlyFiles:!0,followSymbolicLinks:!1,suppressErrors:!0}).map(c=>lr.default.join(r,c)).forEach(c=>{try{let u=Li.default.readFileSync(c,"utf8"),h=Ud.default.parse(u),f=lr.default.dirname(c)===r;if(f){if("extends"in h)return}else if(!("extends"in h))return;i.push({config:h,turboConfigPath:c,workspacePath:lr.default.dirname(c),isRootConfig:f})}catch(u){bl(u)}})}return n&&t&&(wl[t]=i),i}var AT=$(require("os")),TT=$(vg());var OT=$(require("fs-extra"));var CT=$(require("path")),LT=$(require("fs-extra")),PT=$(require("chalk"));var xE=require("stream"),vE=require("util"),p1=require("path"),d1=require("os"),RE=require("fs"),m1=$(wE());var wk=(0,vE.promisify)(xE.Stream.pipeline);var AE=require("fs-extra");var R1=$(require("path")),A1=$(kE()),T1=$(require("chalk")),Ou=require("fs-extra");var uo=$(require("chalk"));var Ve=$(require("chalk")),yi=class{constructor(e){this.transform=e.transformer,this.dry=e.dryRun}_log(...e){console.log(...e)}modified(...e){this._log(Ve.default.green(" MODIFIED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}unchanged(...e){this._log(Ve.default.gray(" UNCHANGED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}skipped(...e){this._log(Ve.default.yellow(" SKIPPED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}error(...e){this._log(Ve.default.red(" ERROR "),...e,this.dry?Ve.default.dim("(dry run)"):"")}info(...e){this._log(Ve.default.bold(" INFO "),...e,this.dry?Ve.default.dim("(dry run)"):"")}};var NE=$(require("os")),Cu=$(require("path"));var ao=$(require("chalk")),co=require("diff"),Jt=require("fs-extra"),lo=class{constructor(e){this.changes=[];if(this.filePath=e.filePath,this.rootPath=e.rootPath,this.after=e.after,this.error=e.error,e.before===void 0)try{Cu.default.extname(e.filePath)===".json"?this.before=(0,Jt.readJsonSync)(e.filePath):this.before=(0,Jt.readFileSync)(e.filePath)}catch{this.before=""}else e.before===null?this.before="":this.before=e.before;e.after?typeof this.before=="object"||typeof e.after=="object"?this.changes=(0,co.diffJson)(this.before,e.after):this.changes=(0,co.diffLines)(this.before,e.after):this.changes=[]}fileName(){return Cu.default.relative(this.rootPath,this.filePath)}write(){this.after&&(typeof this.after=="object"?(0,Jt.writeJsonSync)(this.filePath,this.after,{spaces:2}):(0,Jt.writeFileSync)(this.filePath,this.after))}additions(){return this.changes.filter(e=>e.added).length}deletions(){return this.changes.filter(e=>e.removed).length}hasChanges(){return this.additions()>0||this.deletions()>0}log(e){e.diff?(this.changes.forEach(r=>{r.added?process.stdout.write(ao.default.green(r.value)):r.removed?process.stdout.write(ao.default.red(r.value)):process.stdout.write(ao.default.dim(r.value))}),He.log(NE.default.EOL)):He.log(this.after)}};var rn=class{constructor(e){this.modifications={};this.transform=e.transformer,this.rootPath=e.rootPath,this.dry=e.dryRun,this.print=e.print,this.logger=new yi(e)}abortTransform(e){return this.logger.error(e.reason),{fatalError:new Error(e.reason),changes:e.changes||{}}}modifyFile(e){this.modifications[e.filePath]=new lo({rootPath:this.rootPath,...e})}finish(){let e={changes:{}};return Object.keys(this.modifications).forEach(i=>{let n=this.modifications[i],s={action:"unchanged",additions:n.additions(),deletions:n.deletions()};if(n.hasChanges()){if(this.dry)s.action="skipped",this.logger.skipped(uo.default.dim(n.fileName()));else try{n.write(),s.action="modified",this.logger.modified(uo.default.bold(n.fileName()))}catch(o){let a="Unknown error";o instanceof Error&&(a=o.message),s.error=new Error(a),s.action="error",this.logger.error(n.fileName(),a)}this.print&&n.log({diff:!0})}else this.logger.unchanged(uo.default.dim(n.fileName()));e.changes[n.fileName()]=s}),Object.keys(e.changes).some(i=>e.changes[i].action==="error")?this.abortTransform({reason:"Encountered an error while transforming files",changes:e.changes}):e}static logResults(e){let r=Object.keys(e.changes);if(He.log(),r.length>0){He.bold("Results:");let i={};r.forEach(n=>{var o;let s=e.changes[n];i[n]={action:s.action,additions:s.additions,deletions:s.deletions,error:((o=s.error)==null?void 0:o.message)||"None"}}),console.table(i),He.log()}}};function DE({transformer:t,rootPath:e,options:r}){let i={transformer:t,rootPath:e,...r},n=new yi(i),s=new rn(i);return{log:n,runner:s}}var FE=require("fs-extra"),ME=require("json5");function BE(t){let e=(0,FE.readFileSync)(t,"utf8");return(0,ME.parse)(e)}var O1=["dist/**","build/**"],HE="set-default-outputs",C1='Add the "outputs" key with defaults where it is missing in `turbo.json`',L1="1.7.0",P1=!1;function qE(t){for(let[e,r]of Object.entries(t.pipeline))r.cache!==!1&&(r.outputs?Array.isArray(r.outputs)&&r.outputs.length===0&&delete r.outputs:r.outputs=O1);return t}function UE({root:t,options:e}){let{log:r,runner:i}=DE({transformer:HE,rootPath:t,options:e}),n=Lu.default.join(t,"package.json"),s={};try{s=(0,ho.readJsonSync)(n)}catch{}if("turbo"in s)return i.abortTransform({reason:'"turbo" key detected in package.json. Run `npx @turbo/codemod transform create-turbo-config` first'});r.info("Adding default `outputs` key into tasks if it doesn't exist");let o=Lu.default.join(t,"turbo.json");if(!(0,ho.existsSync)(o))return i.abortTransform({reason:`No turbo.json found at ${t}. Is the path correct?`});let a=BE(o);return i.modifyFile({filePath:o,after:qE(a)}),xl(t).forEach(c=>{let{config:u,turboConfigPath:h}=c;"pipeline"in u&&i.modifyFile({filePath:h,after:qE(u)})}),i.finish()}var I1={name:HE,description:C1,introducedIn:L1,idempotent:P1,transformer:UE},k1=I1;0&&(module.exports={transformer});
40
40
  /*! Bundled license information:
41
41
 
42
42
  @babel/runtime/helpers/regeneratorRuntime.js:
@@ -36,7 +36,7 @@ ${i.message}`:y,R=[x,e,t].filter(Boolean).join(`
36
36
  `+t.slice(n,s),n=s+1),o=a;return l+=`
37
37
  `,t.length-n>e&&o>n?l+=t.slice(n,o)+`
38
38
  `+t.slice(o+1):l+=t.slice(n),l.slice(1)}function Qb(t){for(var e="",r=0,i,n=0;n<t.length;r>=65536?n+=2:n++)r=bi(t,n),i=pe[r],!i&&Ri(r)?(e+=t[n],r>=65536&&(e+=t[n+1])):e+=i||Gb(r);return e}function Jb(t,e,r){var i="",n=t.tag,s,o,a;for(s=0,o=r.length;s<o;s+=1)a=r[s],t.replacer&&(a=t.replacer.call(r,String(s),a)),(pt(t,e,a,!1,!1)||typeof a=="undefined"&&pt(t,e,null,!1,!1))&&(i!==""&&(i+=","+(t.condenseFlow?"":" ")),i+=t.dump);t.tag=n,t.dump="["+i+"]"}function eh(t,e,r,i){var n="",s=t.tag,o,a,l;for(o=0,a=r.length;o<a;o+=1)l=r[o],t.replacer&&(l=t.replacer.call(r,String(o),l)),(pt(t,e+1,l,!0,!0,!1,!0)||typeof l=="undefined"&&pt(t,e+1,null,!0,!0,!1,!0))&&((!i||n!=="")&&(n+=Lo(t,e)),t.dump&&xi===t.dump.charCodeAt(0)?n+="-":n+="- ",n+=t.dump);t.tag=s,t.dump=n||"[]"}function e0(t,e,r){var i="",n=t.tag,s=Object.keys(r),o,a,l,c,u;for(o=0,a=s.length;o<a;o+=1)u="",i!==""&&(u+=", "),t.condenseFlow&&(u+='"'),l=s[o],c=r[l],t.replacer&&(c=t.replacer.call(r,l,c)),pt(t,e,l,!1,!1)&&(t.dump.length>1024&&(u+="? "),u+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),pt(t,e,c,!1,!1)&&(u+=t.dump,i+=u));t.tag=n,t.dump="{"+i+"}"}function t0(t,e,r,i){var n="",s=t.tag,o=Object.keys(r),a,l,c,u,h,f;if(t.sortKeys===!0)o.sort();else if(typeof t.sortKeys=="function")o.sort(t.sortKeys);else if(t.sortKeys)throw new xe("sortKeys must be a boolean or a function");for(a=0,l=o.length;a<l;a+=1)f="",(!i||n!=="")&&(f+=Lo(t,e)),c=o[a],u=r[c],t.replacer&&(u=t.replacer.call(r,c,u)),pt(t,e+1,c,!0,!0,!0)&&(h=t.tag!==null&&t.tag!=="?"||t.dump&&t.dump.length>1024,h&&(t.dump&&xi===t.dump.charCodeAt(0)?f+="?":f+="? "),f+=t.dump,h&&(f+=Lo(t,e)),pt(t,e+1,u,!0,h)&&(t.dump&&xi===t.dump.charCodeAt(0)?f+=":":f+=": ",f+=t.dump,n+=f));t.tag=s,t.dump=n||"{}"}function th(t,e,r){var i,n,s,o,a,l;for(n=r?t.explicitTypes:t.implicitTypes,s=0,o=n.length;s<o;s+=1)if(a=n[s],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof e=="object"&&e instanceof a.instanceOf)&&(!a.predicate||a.predicate(e))){if(r?a.multi&&a.representName?t.tag=a.representName(e):t.tag=a.tag:t.tag="?",a.represent){if(l=t.styleMap[a.tag]||a.defaultStyle,Ih.call(a.represent)==="[object Function]")i=a.represent(e,l);else if(kh.call(a.represent,l))i=a.represent[l](e,l);else throw new xe("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');t.dump=i}return!0}return!1}function pt(t,e,r,i,n,s,o){t.tag=null,t.dump=r,th(t,r,!1)||th(t,r,!0);var a=Ih.call(t.dump),l=i,c;i&&(i=t.flowLevel<0||t.flowLevel>e);var u=a==="[object Object]"||a==="[object Array]",h,f;if(u&&(h=t.duplicates.indexOf(r),f=h!==-1),(t.tag!==null&&t.tag!=="?"||f||t.indent!==2&&e>0)&&(n=!1),f&&t.usedDuplicates[h])t.dump="*ref_"+h;else{if(u&&f&&!t.usedDuplicates[h]&&(t.usedDuplicates[h]=!0),a==="[object Object]")i&&Object.keys(t.dump).length!==0?(t0(t,e,t.dump,n),f&&(t.dump="&ref_"+h+t.dump)):(e0(t,e,t.dump),f&&(t.dump="&ref_"+h+" "+t.dump));else if(a==="[object Array]")i&&t.dump.length!==0?(t.noArrayIndent&&!o&&e>0?eh(t,e-1,t.dump,n):eh(t,e,t.dump,n),f&&(t.dump="&ref_"+h+t.dump)):(Jb(t,e,t.dump),f&&(t.dump="&ref_"+h+" "+t.dump));else if(a==="[object String]")t.tag!=="?"&&Xb(t,t.dump,e,s,l);else{if(a==="[object Undefined]")return!1;if(t.skipInvalid)return!1;throw new xe("unacceptable kind of an object to dump "+a)}t.tag!==null&&t.tag!=="?"&&(c=encodeURI(t.tag[0]==="!"?t.tag.slice(1):t.tag).replace(/!/g,"%21"),t.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",t.dump=c+" "+t.dump)}return!0}function r0(t,e){var r=[],i=[],n,s;for(ko(t,r,i),n=0,s=i.length;n<s;n+=1)e.duplicates.push(r[i[n]]);e.usedDuplicates=new Array(s)}function ko(t,e,r){var i,n,s;if(t!==null&&typeof t=="object")if(n=e.indexOf(t),n!==-1)r.indexOf(n)===-1&&r.push(n);else if(e.push(t),Array.isArray(t))for(n=0,s=t.length;n<s;n+=1)ko(t[n],e,r);else for(i=Object.keys(t),n=0,s=i.length;n<s;n+=1)ko(t[i[n]],e,r)}function i0(t,e){e=e||{};var r=new Wb(e);r.noRefs||r0(t,r);var i=t;return r.replacer&&(i=r.replacer.call({"":i},"",i)),pt(r,0,i,!0,!0)?r.dump+`
39
- `:""}var n0=i0,s0={dump:n0};function qo(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var o0=fe,a0=nh,l0=lh,c0=ph,u0=dh,h0=Do,f0=Lh.load,p0=Lh.loadAll,d0=s0.dump,m0=xe,g0={binary:Eh,float:fh,map:ah,null:ch,pairs:bh,set:wh,timestamp:yh,bool:uh,int:hh,merge:_h,omap:Sh,seq:oh,str:sh},y0=qo("safeLoad","load"),_0=qo("safeLoadAll","loadAll"),E0=qo("safeDump","dump"),S0={Type:o0,Schema:a0,FAILSAFE_SCHEMA:l0,JSON_SCHEMA:c0,CORE_SCHEMA:u0,DEFAULT_SCHEMA:h0,load:f0,loadAll:p0,dump:d0,YAMLException:m0,types:g0,safeLoad:y0,safeLoadAll:_0,safeDump:E0},Gh=S0;var Hd=$(Ld()),Ud=$(require("json5"));var He={};Lu(He,{bold:()=>AR,dimmed:()=>OR,error:()=>qd,grey:()=>CR,info:()=>RR,item:()=>PR,log:()=>qt,turboBlue:()=>qr,turboGradient:()=>vR,turboLoader:()=>Bd,turboRed:()=>Fd,underline:()=>TR,warn:()=>bl,yellow:()=>Md});var Bt=$(require("chalk")),Id=$(require("ora")),kd=$(require("gradient-string")),Nd="#0099F7",Dd="#F11712",xR="#FFFF00",vR=(0,kd.default)(Nd,Dd),qr=Bt.default.hex(Nd),Fd=Bt.default.hex(Dd),Md=Bt.default.hex(xR),Bd=t=>(0,Id.default)({text:t,spinner:{frames:[" ",qr("> "),qr(">> "),qr(">>>")]}}),RR=(...t)=>{qt(qr.bold(">>>"),...t)},AR=(...t)=>{qt(Bt.default.bold(...t))},TR=(...t)=>{qt(Bt.default.underline(...t))},OR=(...t)=>{qt(Bt.default.dim(...t))},CR=(...t)=>{qt(Bt.default.grey(...t))},PR=(...t)=>{qt(qr.bold(" \u2022"),...t)},qt=(...t)=>{console.log(...t)},bl=(...t)=>{console.error(Md.bold(">>>"),...t)},qd=(...t)=>{console.error(Fd.bold(">>>"),...t)};var LR="turbo.json";var wl={};function IR(t){try{if(Pi.default.existsSync(lr.default.join(t,"pnpm-workspace.yaml")))return Gh.load(Pi.default.readFileSync(lr.default.join(t,"pnpm-workspace.yaml"),"utf8")).packages||[];let e=JSON.parse(Pi.default.readFileSync(lr.default.join(t,"package.json"),"utf8"));if(e.workspaces){if("packages"in e.workspaces)return e.workspaces.packages||[];if(Array.isArray(e.workspaces))return e.workspaces}return[]}catch{return[]}}function xl(t,e){var s;let r=Ro(t,e),i=[],n=(s=e==null?void 0:e.cache)!=null?s:!0;if(n&&t&&t in wl)return wl[t];if(r){let a=IR(r).map(c=>`${c}/turbo.json`);(0,Hd.sync)([LR,...a],{cwd:r,onlyFiles:!0,followSymbolicLinks:!1,suppressErrors:!0}).map(c=>lr.default.join(r,c)).forEach(c=>{try{let u=Pi.default.readFileSync(c,"utf8"),h=Ud.default.parse(u),f=lr.default.dirname(c)===r;if(f){if("extends"in h)return}else if(!("extends"in h))return;i.push({config:h,turboConfigPath:c,workspacePath:lr.default.dirname(c),isRootConfig:f})}catch(u){bl(u)}})}return n&&t&&(wl[t]=i),i}var AT=$(require("os")),TT=$(vg());var OT=$(require("fs-extra"));var CT=$(require("path")),PT=$(require("fs-extra")),LT=$(require("chalk"));var xE=require("stream"),vE=require("util"),p1=require("path"),d1=require("os"),RE=require("fs"),m1=$(wE());var bk=(0,vE.promisify)(xE.Stream.pipeline);var AE=require("fs-extra");var R1=$(require("path")),A1=$(kE()),T1=$(require("chalk")),Ou=require("fs-extra");var uo=$(require("chalk"));var Ve=$(require("chalk")),yi=class{constructor(e){this.transform=e.transformer,this.dry=e.dry}_log(...e){console.log(...e)}modified(...e){this._log(Ve.default.green(" MODIFIED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}unchanged(...e){this._log(Ve.default.gray(" UNCHANGED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}skipped(...e){this._log(Ve.default.yellow(" SKIPPED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}error(...e){this._log(Ve.default.red(" ERROR "),...e,this.dry?Ve.default.dim("(dry run)"):"")}info(...e){this._log(Ve.default.bold(" INFO "),...e,this.dry?Ve.default.dim("(dry run)"):"")}};var NE=$(require("os")),Cu=$(require("path"));var ao=$(require("chalk")),co=require("diff"),Jt=require("fs-extra"),lo=class{constructor(e){this.changes=[];if(this.filePath=e.filePath,this.rootPath=e.rootPath,this.after=e.after,this.error=e.error,e.before===void 0)try{Cu.default.extname(e.filePath)===".json"?this.before=(0,Jt.readJsonSync)(e.filePath):this.before=(0,Jt.readFileSync)(e.filePath)}catch{this.before=""}else e.before===null?this.before="":this.before=e.before;e.after?typeof this.before=="object"||typeof e.after=="object"?this.changes=(0,co.diffJson)(this.before,e.after):this.changes=(0,co.diffLines)(this.before,e.after):this.changes=[]}fileName(){return Cu.default.relative(this.rootPath,this.filePath)}write(){this.after&&(typeof this.after=="object"?(0,Jt.writeJsonSync)(this.filePath,this.after,{spaces:2}):(0,Jt.writeFileSync)(this.filePath,this.after))}additions(){return this.changes.filter(e=>e.added).length}deletions(){return this.changes.filter(e=>e.removed).length}hasChanges(){return this.additions()>0||this.deletions()>0}log(e){e.diff?(this.changes.forEach(r=>{r.added?process.stdout.write(ao.default.green(r.value)):r.removed?process.stdout.write(ao.default.red(r.value)):process.stdout.write(ao.default.dim(r.value))}),He.log(NE.default.EOL)):He.log(this.after)}};var rn=class{constructor(e){this.modifications={};this.transform=e.transformer,this.rootPath=e.rootPath,this.dry=e.dry,this.print=e.print,this.logger=new yi(e)}abortTransform(e){return this.logger.error(e.reason),{fatalError:new Error(e.reason),changes:e.changes||{}}}modifyFile(e){this.modifications[e.filePath]=new lo({rootPath:this.rootPath,...e})}finish(){let e={changes:{}};return Object.keys(this.modifications).forEach(i=>{let n=this.modifications[i],s={action:"unchanged",additions:n.additions(),deletions:n.deletions()};if(n.hasChanges()){if(this.dry)s.action="skipped",this.logger.skipped(uo.default.dim(n.fileName()));else try{n.write(),s.action="modified",this.logger.modified(uo.default.bold(n.fileName()))}catch(o){let a="Unknown error";o instanceof Error&&(a=o.message),s.error=new Error(a),s.action="error",this.logger.error(n.fileName(),a)}this.print&&n.log({diff:!0})}else this.logger.unchanged(uo.default.dim(n.fileName()));e.changes[n.fileName()]=s}),Object.keys(e.changes).some(i=>e.changes[i].action==="error")?this.abortTransform({reason:"Encountered an error while transforming files",changes:e.changes}):e}static logResults(e){let r=Object.keys(e.changes);if(He.log(),r.length>0){He.bold("Results:");let i={};r.forEach(n=>{var o;let s=e.changes[n];i[n]={action:s.action,additions:s.additions,deletions:s.deletions,error:((o=s.error)==null?void 0:o.message)||"None"}}),console.table(i),He.log()}}};function DE({transformer:t,rootPath:e,options:r}){let i={transformer:t,rootPath:e,...r},n=new yi(i),s=new rn(i);return{log:n,runner:s}}var FE=require("fs-extra"),ME=require("json5");function BE(t){let e=(0,FE.readFileSync)(t,"utf8");return(0,ME.parse)(e)}var qE="stabilize-env-mode",O1="Rewrite experimentalPassThroughEnv and experimentalGlobalPassThroughEnv",C1="1.10.0";function P1(t){let e=t.experimentalGlobalPassThroughEnv,r=t.globalPassThroughEnv,i;return(Array.isArray(e)||Array.isArray(r))&&(i=[],Array.isArray(e)&&(i=i.concat(e)),Array.isArray(r)&&(i=i.concat(r)),i=[...new Set(i)],i.sort()),delete t.experimentalGlobalPassThroughEnv,delete t.globalPassThroughEnv,Array.isArray(i)&&(t.globalPassThroughEnv=i),HE(t)}function HE(t){for(let[e,r]of Object.entries(t.pipeline)){let i=r.experimentalPassThroughEnv,n=r.passThroughEnv,s;(Array.isArray(i)||Array.isArray(n))&&(s=[],Array.isArray(i)&&(s=s.concat(i)),Array.isArray(n)&&(s=s.concat(n)),s=[...new Set(s)],s.sort()),delete r.experimentalPassThroughEnv,delete r.passThroughEnv,Array.isArray(s)&&(r.passThroughEnv=s)}return t}function UE({root:t,options:e}){let{log:r,runner:i}=DE({transformer:qE,rootPath:t,options:e}),n=Pu.default.join(t,"package.json"),s={};try{s=(0,ho.readJsonSync)(n)}catch{}if("turbo"in s)return i.abortTransform({reason:'"turbo" key detected in package.json. Run `npx @turbo/codemod transform create-turbo-config` first'});r.info("Rewriting `experimentalPassThroughEnv` and `experimentalGlobalPassThroughEnv`");let o=Pu.default.join(t,"turbo.json");if(!(0,ho.existsSync)(o))return i.abortTransform({reason:`No turbo.json found at ${t}. Is the path correct?`});let a=BE(o);return i.modifyFile({filePath:o,after:P1(a)}),xl(t).forEach(c=>{let{config:u,turboConfigPath:h,isRootConfig:f}=c;!f&&"pipeline"in u&&i.modifyFile({filePath:h,after:HE(u)})}),i.finish()}var L1={name:qE,description:O1,introducedIn:C1,transformer:UE},I1=L1;0&&(module.exports={transformer});
39
+ `:""}var n0=i0,s0={dump:n0};function qo(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var o0=fe,a0=nh,l0=lh,c0=ph,u0=dh,h0=Do,f0=Lh.load,p0=Lh.loadAll,d0=s0.dump,m0=xe,g0={binary:Eh,float:fh,map:ah,null:ch,pairs:bh,set:wh,timestamp:yh,bool:uh,int:hh,merge:_h,omap:Sh,seq:oh,str:sh},y0=qo("safeLoad","load"),_0=qo("safeLoadAll","loadAll"),E0=qo("safeDump","dump"),S0={Type:o0,Schema:a0,FAILSAFE_SCHEMA:l0,JSON_SCHEMA:c0,CORE_SCHEMA:u0,DEFAULT_SCHEMA:h0,load:f0,loadAll:p0,dump:d0,YAMLException:m0,types:g0,safeLoad:y0,safeLoadAll:_0,safeDump:E0},Gh=S0;var Hd=$(Ld()),Ud=$(require("json5"));var He={};Lu(He,{bold:()=>AR,dimmed:()=>OR,error:()=>qd,grey:()=>CR,info:()=>RR,item:()=>PR,log:()=>qt,turboBlue:()=>qr,turboGradient:()=>vR,turboLoader:()=>Bd,turboRed:()=>Fd,underline:()=>TR,warn:()=>bl,yellow:()=>Md});var Bt=$(require("chalk")),Id=$(require("ora")),kd=$(require("gradient-string")),Nd="#0099F7",Dd="#F11712",xR="#FFFF00",vR=(0,kd.default)(Nd,Dd),qr=Bt.default.hex(Nd),Fd=Bt.default.hex(Dd),Md=Bt.default.hex(xR),Bd=t=>(0,Id.default)({text:t,spinner:{frames:[" ",qr("> "),qr(">> "),qr(">>>")]}}),RR=(...t)=>{qt(qr.bold(">>>"),...t)},AR=(...t)=>{qt(Bt.default.bold(...t))},TR=(...t)=>{qt(Bt.default.underline(...t))},OR=(...t)=>{qt(Bt.default.dim(...t))},CR=(...t)=>{qt(Bt.default.grey(...t))},PR=(...t)=>{qt(qr.bold(" \u2022"),...t)},qt=(...t)=>{console.log(...t)},bl=(...t)=>{console.error(Md.bold(">>>"),...t)},qd=(...t)=>{console.error(Fd.bold(">>>"),...t)};var LR="turbo.json";var wl={};function IR(t){try{if(Pi.default.existsSync(lr.default.join(t,"pnpm-workspace.yaml")))return Gh.load(Pi.default.readFileSync(lr.default.join(t,"pnpm-workspace.yaml"),"utf8")).packages||[];let e=JSON.parse(Pi.default.readFileSync(lr.default.join(t,"package.json"),"utf8"));if(e.workspaces){if("packages"in e.workspaces)return e.workspaces.packages||[];if(Array.isArray(e.workspaces))return e.workspaces}return[]}catch{return[]}}function xl(t,e){var s;let r=Ro(t,e),i=[],n=(s=e==null?void 0:e.cache)!=null?s:!0;if(n&&t&&t in wl)return wl[t];if(r){let a=IR(r).map(c=>`${c}/turbo.json`);(0,Hd.sync)([LR,...a],{cwd:r,onlyFiles:!0,followSymbolicLinks:!1,suppressErrors:!0}).map(c=>lr.default.join(r,c)).forEach(c=>{try{let u=Pi.default.readFileSync(c,"utf8"),h=Ud.default.parse(u),f=lr.default.dirname(c)===r;if(f){if("extends"in h)return}else if(!("extends"in h))return;i.push({config:h,turboConfigPath:c,workspacePath:lr.default.dirname(c),isRootConfig:f})}catch(u){bl(u)}})}return n&&t&&(wl[t]=i),i}var AT=$(require("os")),TT=$(vg());var OT=$(require("fs-extra"));var CT=$(require("path")),PT=$(require("fs-extra")),LT=$(require("chalk"));var xE=require("stream"),vE=require("util"),p1=require("path"),d1=require("os"),RE=require("fs"),m1=$(wE());var bk=(0,vE.promisify)(xE.Stream.pipeline);var AE=require("fs-extra");var R1=$(require("path")),A1=$(kE()),T1=$(require("chalk")),Ou=require("fs-extra");var uo=$(require("chalk"));var Ve=$(require("chalk")),yi=class{constructor(e){this.transform=e.transformer,this.dry=e.dryRun}_log(...e){console.log(...e)}modified(...e){this._log(Ve.default.green(" MODIFIED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}unchanged(...e){this._log(Ve.default.gray(" UNCHANGED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}skipped(...e){this._log(Ve.default.yellow(" SKIPPED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}error(...e){this._log(Ve.default.red(" ERROR "),...e,this.dry?Ve.default.dim("(dry run)"):"")}info(...e){this._log(Ve.default.bold(" INFO "),...e,this.dry?Ve.default.dim("(dry run)"):"")}};var NE=$(require("os")),Cu=$(require("path"));var ao=$(require("chalk")),co=require("diff"),Jt=require("fs-extra"),lo=class{constructor(e){this.changes=[];if(this.filePath=e.filePath,this.rootPath=e.rootPath,this.after=e.after,this.error=e.error,e.before===void 0)try{Cu.default.extname(e.filePath)===".json"?this.before=(0,Jt.readJsonSync)(e.filePath):this.before=(0,Jt.readFileSync)(e.filePath)}catch{this.before=""}else e.before===null?this.before="":this.before=e.before;e.after?typeof this.before=="object"||typeof e.after=="object"?this.changes=(0,co.diffJson)(this.before,e.after):this.changes=(0,co.diffLines)(this.before,e.after):this.changes=[]}fileName(){return Cu.default.relative(this.rootPath,this.filePath)}write(){this.after&&(typeof this.after=="object"?(0,Jt.writeJsonSync)(this.filePath,this.after,{spaces:2}):(0,Jt.writeFileSync)(this.filePath,this.after))}additions(){return this.changes.filter(e=>e.added).length}deletions(){return this.changes.filter(e=>e.removed).length}hasChanges(){return this.additions()>0||this.deletions()>0}log(e){e.diff?(this.changes.forEach(r=>{r.added?process.stdout.write(ao.default.green(r.value)):r.removed?process.stdout.write(ao.default.red(r.value)):process.stdout.write(ao.default.dim(r.value))}),He.log(NE.default.EOL)):He.log(this.after)}};var rn=class{constructor(e){this.modifications={};this.transform=e.transformer,this.rootPath=e.rootPath,this.dry=e.dryRun,this.print=e.print,this.logger=new yi(e)}abortTransform(e){return this.logger.error(e.reason),{fatalError:new Error(e.reason),changes:e.changes||{}}}modifyFile(e){this.modifications[e.filePath]=new lo({rootPath:this.rootPath,...e})}finish(){let e={changes:{}};return Object.keys(this.modifications).forEach(i=>{let n=this.modifications[i],s={action:"unchanged",additions:n.additions(),deletions:n.deletions()};if(n.hasChanges()){if(this.dry)s.action="skipped",this.logger.skipped(uo.default.dim(n.fileName()));else try{n.write(),s.action="modified",this.logger.modified(uo.default.bold(n.fileName()))}catch(o){let a="Unknown error";o instanceof Error&&(a=o.message),s.error=new Error(a),s.action="error",this.logger.error(n.fileName(),a)}this.print&&n.log({diff:!0})}else this.logger.unchanged(uo.default.dim(n.fileName()));e.changes[n.fileName()]=s}),Object.keys(e.changes).some(i=>e.changes[i].action==="error")?this.abortTransform({reason:"Encountered an error while transforming files",changes:e.changes}):e}static logResults(e){let r=Object.keys(e.changes);if(He.log(),r.length>0){He.bold("Results:");let i={};r.forEach(n=>{var o;let s=e.changes[n];i[n]={action:s.action,additions:s.additions,deletions:s.deletions,error:((o=s.error)==null?void 0:o.message)||"None"}}),console.table(i),He.log()}}};function DE({transformer:t,rootPath:e,options:r}){let i={transformer:t,rootPath:e,...r},n=new yi(i),s=new rn(i);return{log:n,runner:s}}var FE=require("fs-extra"),ME=require("json5");function BE(t){let e=(0,FE.readFileSync)(t,"utf8");return(0,ME.parse)(e)}var qE="stabilize-env-mode",O1="Rewrite experimentalPassThroughEnv and experimentalGlobalPassThroughEnv",C1="1.10.0";function P1(t){let e=t.experimentalGlobalPassThroughEnv,r=t.globalPassThroughEnv,i;return(Array.isArray(e)||Array.isArray(r))&&(i=[],Array.isArray(e)&&(i=i.concat(e)),Array.isArray(r)&&(i=i.concat(r)),i=[...new Set(i)],i.sort()),delete t.experimentalGlobalPassThroughEnv,delete t.globalPassThroughEnv,Array.isArray(i)&&(t.globalPassThroughEnv=i),HE(t)}function HE(t){for(let[e,r]of Object.entries(t.pipeline)){let i=r.experimentalPassThroughEnv,n=r.passThroughEnv,s;(Array.isArray(i)||Array.isArray(n))&&(s=[],Array.isArray(i)&&(s=s.concat(i)),Array.isArray(n)&&(s=s.concat(n)),s=[...new Set(s)],s.sort()),delete r.experimentalPassThroughEnv,delete r.passThroughEnv,Array.isArray(s)&&(r.passThroughEnv=s)}return t}function UE({root:t,options:e}){let{log:r,runner:i}=DE({transformer:qE,rootPath:t,options:e}),n=Pu.default.join(t,"package.json"),s={};try{s=(0,ho.readJsonSync)(n)}catch{}if("turbo"in s)return i.abortTransform({reason:'"turbo" key detected in package.json. Run `npx @turbo/codemod transform create-turbo-config` first'});r.info("Rewriting `experimentalPassThroughEnv` and `experimentalGlobalPassThroughEnv`");let o=Pu.default.join(t,"turbo.json");if(!(0,ho.existsSync)(o))return i.abortTransform({reason:`No turbo.json found at ${t}. Is the path correct?`});let a=BE(o);return i.modifyFile({filePath:o,after:P1(a)}),xl(t).forEach(c=>{let{config:u,turboConfigPath:h,isRootConfig:f}=c;!f&&"pipeline"in u&&i.modifyFile({filePath:h,after:HE(u)})}),i.finish()}var L1={name:qE,description:O1,introducedIn:C1,transformer:UE},I1=L1;0&&(module.exports={transformer});
40
40
  /*! Bundled license information:
41
41
 
42
42
  @babel/runtime/helpers/regeneratorRuntime.js:
@@ -36,7 +36,7 @@ ${i.message}`:y,R=[w,e,t].filter(Boolean).join(`
36
36
  `+t.slice(n,s),n=s+1),o=a;return l+=`
37
37
  `,t.length-n>e&&o>n?l+=t.slice(n,o)+`
38
38
  `+t.slice(o+1):l+=t.slice(n),l.slice(1)}function Db(t){for(var e="",r=0,i,n=0;n<t.length;r>=65536?n+=2:n++)r=Ei(t,n),i=pe[r],!i&&wi(r)?(e+=t[n],r>=65536&&(e+=t[n+1])):e+=i||Ab(r);return e}function Fb(t,e,r){var i="",n=t.tag,s,o,a;for(s=0,o=r.length;s<o;s+=1)a=r[s],t.replacer&&(a=t.replacer.call(r,String(s),a)),(pt(t,e,a,!1,!1)||typeof a=="undefined"&&pt(t,e,null,!1,!1))&&(i!==""&&(i+=","+(t.condenseFlow?"":" ")),i+=t.dump);t.tag=n,t.dump="["+i+"]"}function Mu(t,e,r,i){var n="",s=t.tag,o,a,l;for(o=0,a=r.length;o<a;o+=1)l=r[o],t.replacer&&(l=t.replacer.call(r,String(o),l)),(pt(t,e+1,l,!0,!0,!1,!0)||typeof l=="undefined"&&pt(t,e+1,null,!0,!0,!1,!0))&&((!i||n!=="")&&(n+=So(t,e)),t.dump&&bi===t.dump.charCodeAt(0)?n+="-":n+="- ",n+=t.dump);t.tag=s,t.dump=n||"[]"}function Mb(t,e,r){var i="",n=t.tag,s=Object.keys(r),o,a,l,c,u;for(o=0,a=s.length;o<a;o+=1)u="",i!==""&&(u+=", "),t.condenseFlow&&(u+='"'),l=s[o],c=r[l],t.replacer&&(c=t.replacer.call(r,l,c)),pt(t,e,l,!1,!1)&&(t.dump.length>1024&&(u+="? "),u+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),pt(t,e,c,!1,!1)&&(u+=t.dump,i+=u));t.tag=n,t.dump="{"+i+"}"}function Bb(t,e,r,i){var n="",s=t.tag,o=Object.keys(r),a,l,c,u,h,f;if(t.sortKeys===!0)o.sort();else if(typeof t.sortKeys=="function")o.sort(t.sortKeys);else if(t.sortKeys)throw new we("sortKeys must be a boolean or a function");for(a=0,l=o.length;a<l;a+=1)f="",(!i||n!=="")&&(f+=So(t,e)),c=o[a],u=r[c],t.replacer&&(u=t.replacer.call(r,c,u)),pt(t,e+1,c,!0,!0,!0)&&(h=t.tag!==null&&t.tag!=="?"||t.dump&&t.dump.length>1024,h&&(t.dump&&bi===t.dump.charCodeAt(0)?f+="?":f+="? "),f+=t.dump,h&&(f+=So(t,e)),pt(t,e+1,u,!0,h)&&(t.dump&&bi===t.dump.charCodeAt(0)?f+=":":f+=": ",f+=t.dump,n+=f));t.tag=s,t.dump=n||"{}"}function Bu(t,e,r){var i,n,s,o,a,l;for(n=r?t.explicitTypes:t.implicitTypes,s=0,o=n.length;s<o;s+=1)if(a=n[s],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof e=="object"&&e instanceof a.instanceOf)&&(!a.predicate||a.predicate(e))){if(r?a.multi&&a.representName?t.tag=a.representName(e):t.tag=a.tag:t.tag="?",a.represent){if(l=t.styleMap[a.tag]||a.defaultStyle,Ju.call(a.represent)==="[object Function]")i=a.represent(e,l);else if(eh.call(a.represent,l))i=a.represent[l](e,l);else throw new we("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');t.dump=i}return!0}return!1}function pt(t,e,r,i,n,s,o){t.tag=null,t.dump=r,Bu(t,r,!1)||Bu(t,r,!0);var a=Ju.call(t.dump),l=i,c;i&&(i=t.flowLevel<0||t.flowLevel>e);var u=a==="[object Object]"||a==="[object Array]",h,f;if(u&&(h=t.duplicates.indexOf(r),f=h!==-1),(t.tag!==null&&t.tag!=="?"||f||t.indent!==2&&e>0)&&(n=!1),f&&t.usedDuplicates[h])t.dump="*ref_"+h;else{if(u&&f&&!t.usedDuplicates[h]&&(t.usedDuplicates[h]=!0),a==="[object Object]")i&&Object.keys(t.dump).length!==0?(Bb(t,e,t.dump,n),f&&(t.dump="&ref_"+h+t.dump)):(Mb(t,e,t.dump),f&&(t.dump="&ref_"+h+" "+t.dump));else if(a==="[object Array]")i&&t.dump.length!==0?(t.noArrayIndent&&!o&&e>0?Mu(t,e-1,t.dump,n):Mu(t,e,t.dump,n),f&&(t.dump="&ref_"+h+t.dump)):(Fb(t,e,t.dump),f&&(t.dump="&ref_"+h+" "+t.dump));else if(a==="[object String]")t.tag!=="?"&&kb(t,t.dump,e,s,l);else{if(a==="[object Undefined]")return!1;if(t.skipInvalid)return!1;throw new we("unacceptable kind of an object to dump "+a)}t.tag!==null&&t.tag!=="?"&&(c=encodeURI(t.tag[0]==="!"?t.tag.slice(1):t.tag).replace(/!/g,"%21"),t.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",t.dump=c+" "+t.dump)}return!0}function qb(t,e){var r=[],i=[],n,s;for(xo(t,r,i),n=0,s=i.length;n<s;n+=1)e.duplicates.push(r[i[n]]);e.usedDuplicates=new Array(s)}function xo(t,e,r){var i,n,s;if(t!==null&&typeof t=="object")if(n=e.indexOf(t),n!==-1)r.indexOf(n)===-1&&r.push(n);else if(e.push(t),Array.isArray(t))for(n=0,s=t.length;n<s;n+=1)xo(t[n],e,r);else for(i=Object.keys(t),n=0,s=i.length;n<s;n+=1)xo(t[i[n]],e,r)}function Hb(t,e){e=e||{};var r=new Ob(e);r.noRefs||qb(t,r);var i=t;return r.replacer&&(i=r.replacer.call({"":i},"",i)),pt(r,0,i,!0,!0)?r.dump+`
39
- `:""}var Ub=Hb,$b={dump:Ub};function To(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var jL=Qu.load,WL=Qu.loadAll,YL=$b.dump;var zL=To("safeLoad","load"),KL=To("safeLoadAll","loadAll"),VL=To("safeDump","dump");var rR=G(Zp()),iR=G(require("json5"));var He={};mu(He,{bold:()=>Kv,dimmed:()=>Xv,error:()=>od,grey:()=>Zv,info:()=>zv,item:()=>Qv,log:()=>qt,turboBlue:()=>Br,turboGradient:()=>Yv,turboLoader:()=>nd,turboRed:()=>rd,underline:()=>Vv,warn:()=>sd,yellow:()=>id});var Bt=G(require("chalk")),Qp=G(require("ora")),Jp=G(require("gradient-string")),ed="#0099F7",td="#F11712",Wv="#FFFF00",Yv=(0,Jp.default)(ed,td),Br=Bt.default.hex(ed),rd=Bt.default.hex(td),id=Bt.default.hex(Wv),nd=t=>(0,Qp.default)({text:t,spinner:{frames:[" ",Br("> "),Br(">> "),Br(">>>")]}}),zv=(...t)=>{qt(Br.bold(">>>"),...t)},Kv=(...t)=>{qt(Bt.default.bold(...t))},Vv=(...t)=>{qt(Bt.default.underline(...t))},Xv=(...t)=>{qt(Bt.default.dim(...t))},Zv=(...t)=>{qt(Bt.default.grey(...t))},Qv=(...t)=>{qt(Br.bold(" \u2022"),...t)},qt=(...t)=>{console.log(...t)},sd=(...t)=>{console.error(id.bold(">>>"),...t)},od=(...t)=>{console.error(rd.bold(">>>"),...t)};var ZA=G(require("os")),QA=G(Gm());var JA=G(require("fs-extra"));var eT=G(require("path")),tT=G(require("fs-extra")),rT=G(require("chalk"));var $_=require("stream"),G_=require("util"),BC=require("path"),qC=require("os"),j_=require("fs"),HC=G(U_());var tk=(0,G_.promisify)($_.Stream.pipeline);var W_=require("fs-extra");var XC=G(require("path")),ZC=G(Q_()),QC=G(require("chalk")),pu=require("fs-extra");var Ve=G(require("chalk")),gi=class{constructor(e){this.transform=e.transformer,this.dry=e.dry}_log(...e){console.log(...e)}modified(...e){this._log(Ve.default.green(" MODIFIED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}unchanged(...e){this._log(Ve.default.gray(" UNCHANGED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}skipped(...e){this._log(Ve.default.yellow(" SKIPPED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}error(...e){this._log(Ve.default.red(" ERROR "),...e,this.dry?Ve.default.dim("(dry run)"):"")}info(...e){this._log(Ve.default.bold(" INFO "),...e,this.dry?Ve.default.dim("(dry run)"):"")}};var J_=G(require("os")),du=G(require("path"));var ro=G(require("chalk")),no=require("diff"),Jt=require("fs-extra"),io=class{constructor(e){this.changes=[];if(this.filePath=e.filePath,this.rootPath=e.rootPath,this.after=e.after,this.error=e.error,e.before===void 0)try{du.default.extname(e.filePath)===".json"?this.before=(0,Jt.readJsonSync)(e.filePath):this.before=(0,Jt.readFileSync)(e.filePath)}catch{this.before=""}else e.before===null?this.before="":this.before=e.before;e.after?typeof this.before=="object"||typeof e.after=="object"?this.changes=(0,no.diffJson)(this.before,e.after):this.changes=(0,no.diffLines)(this.before,e.after):this.changes=[]}fileName(){return du.default.relative(this.rootPath,this.filePath)}write(){this.after&&(typeof this.after=="object"?(0,Jt.writeJsonSync)(this.filePath,this.after,{spaces:2}):(0,Jt.writeFileSync)(this.filePath,this.after))}additions(){return this.changes.filter(e=>e.added).length}deletions(){return this.changes.filter(e=>e.removed).length}hasChanges(){return this.additions()>0||this.deletions()>0}log(e){e.diff?(this.changes.forEach(r=>{r.added?process.stdout.write(ro.default.green(r.value)):r.removed?process.stdout.write(ro.default.red(r.value)):process.stdout.write(ro.default.dim(r.value))}),He.log(J_.default.EOL)):He.log(this.after)}};var Ji=class{constructor(e){this.modifications={};this.transform=e.transformer,this.rootPath=e.rootPath,this.dry=e.dry,this.print=e.print,this.logger=new gi(e)}abortTransform(e){return this.logger.error(e.reason),{fatalError:new Error(e.reason),changes:e.changes||{}}}modifyFile(e){this.modifications[e.filePath]=new io({rootPath:this.rootPath,...e})}finish(){let e={changes:{}};return Object.keys(this.modifications).forEach(i=>{let n=this.modifications[i],s={action:"unchanged",additions:n.additions(),deletions:n.deletions()};if(n.hasChanges()){if(this.dry)s.action="skipped",this.logger.skipped(so.default.dim(n.fileName()));else try{n.write(),s.action="modified",this.logger.modified(so.default.bold(n.fileName()))}catch(o){let a="Unknown error";o instanceof Error&&(a=o.message),s.error=new Error(a),s.action="error",this.logger.error(n.fileName(),a)}this.print&&n.log({diff:!0})}else this.logger.unchanged(so.default.dim(n.fileName()));e.changes[n.fileName()]=s}),Object.keys(e.changes).some(i=>e.changes[i].action==="error")?this.abortTransform({reason:"Encountered an error while transforming files",changes:e.changes}):e}static logResults(e){let r=Object.keys(e.changes);if(He.log(),r.length>0){He.bold("Results:");let i={};r.forEach(n=>{var o;let s=e.changes[n];i[n]={action:s.action,additions:s.additions,deletions:s.deletions,error:((o=s.error)==null?void 0:o.message)||"None"}}),console.table(i),He.log()}}};function eE({transformer:t,rootPath:e,options:r}){let i={transformer:t,rootPath:e,...r},n=new gi(i),s=new Ji(i);return{log:n,runner:s}}var tE=require("fs-extra"),rE=require("json5");function iE(t){let e=(0,tE.readFileSync)(t,"utf8");return(0,rE.parse)(e)}var oE="stabilize-ui",JC='Rename the "experimentalUI" key to "ui" in `turbo.json`',eL="2.0.0-canary.0";function tL(t){let e=t.experimentalUI;return delete t.experimentalUI,e!==void 0&&!e&&(t.ui=e),t}function aE({root:t,options:e}){let{log:r,runner:i}=eE({transformer:oE,rootPath:t,options:e});r.info("Renaming `experimentalUI` key in turbo.json to `ui`");let n=nE.default.join(t,"turbo.json");if(!(0,sE.existsSync)(n))return i.abortTransform({reason:`No turbo.json found at ${t}. Is the path correct?`});let s=iE(n);return i.modifyFile({filePath:n,after:tL(s)}),i.finish()}var rL={name:oE,description:JC,introducedIn:eL,transformer:aE},iL=rL;0&&(module.exports={transformer});
39
+ `:""}var Ub=Hb,$b={dump:Ub};function To(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var jL=Qu.load,WL=Qu.loadAll,YL=$b.dump;var zL=To("safeLoad","load"),KL=To("safeLoadAll","loadAll"),VL=To("safeDump","dump");var rR=G(Zp()),iR=G(require("json5"));var He={};mu(He,{bold:()=>Kv,dimmed:()=>Xv,error:()=>od,grey:()=>Zv,info:()=>zv,item:()=>Qv,log:()=>qt,turboBlue:()=>Br,turboGradient:()=>Yv,turboLoader:()=>nd,turboRed:()=>rd,underline:()=>Vv,warn:()=>sd,yellow:()=>id});var Bt=G(require("chalk")),Qp=G(require("ora")),Jp=G(require("gradient-string")),ed="#0099F7",td="#F11712",Wv="#FFFF00",Yv=(0,Jp.default)(ed,td),Br=Bt.default.hex(ed),rd=Bt.default.hex(td),id=Bt.default.hex(Wv),nd=t=>(0,Qp.default)({text:t,spinner:{frames:[" ",Br("> "),Br(">> "),Br(">>>")]}}),zv=(...t)=>{qt(Br.bold(">>>"),...t)},Kv=(...t)=>{qt(Bt.default.bold(...t))},Vv=(...t)=>{qt(Bt.default.underline(...t))},Xv=(...t)=>{qt(Bt.default.dim(...t))},Zv=(...t)=>{qt(Bt.default.grey(...t))},Qv=(...t)=>{qt(Br.bold(" \u2022"),...t)},qt=(...t)=>{console.log(...t)},sd=(...t)=>{console.error(id.bold(">>>"),...t)},od=(...t)=>{console.error(rd.bold(">>>"),...t)};var ZA=G(require("os")),QA=G(Gm());var JA=G(require("fs-extra"));var eT=G(require("path")),tT=G(require("fs-extra")),rT=G(require("chalk"));var $_=require("stream"),G_=require("util"),BC=require("path"),qC=require("os"),j_=require("fs"),HC=G(U_());var tk=(0,G_.promisify)($_.Stream.pipeline);var W_=require("fs-extra");var XC=G(require("path")),ZC=G(Q_()),QC=G(require("chalk")),pu=require("fs-extra");var Ve=G(require("chalk")),gi=class{constructor(e){this.transform=e.transformer,this.dry=e.dryRun}_log(...e){console.log(...e)}modified(...e){this._log(Ve.default.green(" MODIFIED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}unchanged(...e){this._log(Ve.default.gray(" UNCHANGED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}skipped(...e){this._log(Ve.default.yellow(" SKIPPED "),...e,this.dry?Ve.default.dim("(dry run)"):"")}error(...e){this._log(Ve.default.red(" ERROR "),...e,this.dry?Ve.default.dim("(dry run)"):"")}info(...e){this._log(Ve.default.bold(" INFO "),...e,this.dry?Ve.default.dim("(dry run)"):"")}};var J_=G(require("os")),du=G(require("path"));var ro=G(require("chalk")),no=require("diff"),Jt=require("fs-extra"),io=class{constructor(e){this.changes=[];if(this.filePath=e.filePath,this.rootPath=e.rootPath,this.after=e.after,this.error=e.error,e.before===void 0)try{du.default.extname(e.filePath)===".json"?this.before=(0,Jt.readJsonSync)(e.filePath):this.before=(0,Jt.readFileSync)(e.filePath)}catch{this.before=""}else e.before===null?this.before="":this.before=e.before;e.after?typeof this.before=="object"||typeof e.after=="object"?this.changes=(0,no.diffJson)(this.before,e.after):this.changes=(0,no.diffLines)(this.before,e.after):this.changes=[]}fileName(){return du.default.relative(this.rootPath,this.filePath)}write(){this.after&&(typeof this.after=="object"?(0,Jt.writeJsonSync)(this.filePath,this.after,{spaces:2}):(0,Jt.writeFileSync)(this.filePath,this.after))}additions(){return this.changes.filter(e=>e.added).length}deletions(){return this.changes.filter(e=>e.removed).length}hasChanges(){return this.additions()>0||this.deletions()>0}log(e){e.diff?(this.changes.forEach(r=>{r.added?process.stdout.write(ro.default.green(r.value)):r.removed?process.stdout.write(ro.default.red(r.value)):process.stdout.write(ro.default.dim(r.value))}),He.log(J_.default.EOL)):He.log(this.after)}};var Ji=class{constructor(e){this.modifications={};this.transform=e.transformer,this.rootPath=e.rootPath,this.dry=e.dryRun,this.print=e.print,this.logger=new gi(e)}abortTransform(e){return this.logger.error(e.reason),{fatalError:new Error(e.reason),changes:e.changes||{}}}modifyFile(e){this.modifications[e.filePath]=new io({rootPath:this.rootPath,...e})}finish(){let e={changes:{}};return Object.keys(this.modifications).forEach(i=>{let n=this.modifications[i],s={action:"unchanged",additions:n.additions(),deletions:n.deletions()};if(n.hasChanges()){if(this.dry)s.action="skipped",this.logger.skipped(so.default.dim(n.fileName()));else try{n.write(),s.action="modified",this.logger.modified(so.default.bold(n.fileName()))}catch(o){let a="Unknown error";o instanceof Error&&(a=o.message),s.error=new Error(a),s.action="error",this.logger.error(n.fileName(),a)}this.print&&n.log({diff:!0})}else this.logger.unchanged(so.default.dim(n.fileName()));e.changes[n.fileName()]=s}),Object.keys(e.changes).some(i=>e.changes[i].action==="error")?this.abortTransform({reason:"Encountered an error while transforming files",changes:e.changes}):e}static logResults(e){let r=Object.keys(e.changes);if(He.log(),r.length>0){He.bold("Results:");let i={};r.forEach(n=>{var o;let s=e.changes[n];i[n]={action:s.action,additions:s.additions,deletions:s.deletions,error:((o=s.error)==null?void 0:o.message)||"None"}}),console.table(i),He.log()}}};function eE({transformer:t,rootPath:e,options:r}){let i={transformer:t,rootPath:e,...r},n=new gi(i),s=new Ji(i);return{log:n,runner:s}}var tE=require("fs-extra"),rE=require("json5");function iE(t){let e=(0,tE.readFileSync)(t,"utf8");return(0,rE.parse)(e)}var oE="stabilize-ui",JC='Rename the "experimentalUI" key to "ui" in `turbo.json`',eL="2.0.0-canary.0";function tL(t){let e=t.experimentalUI;return delete t.experimentalUI,e!==void 0&&!e&&(t.ui="stream"),t}function aE({root:t,options:e}){let{log:r,runner:i}=eE({transformer:oE,rootPath:t,options:e});r.info("Renaming `experimentalUI` key in turbo.json to `ui`");let n=nE.default.join(t,"turbo.json");if(!(0,sE.existsSync)(n))return i.abortTransform({reason:`No turbo.json found at ${t}. Is the path correct?`});let s=iE(n);return i.modifyFile({filePath:n,after:tL(s)}),i.finish()}var rL={name:oE,description:JC,introducedIn:eL,transformer:aE},iL=rL;0&&(module.exports={transformer});
40
40
  /*! Bundled license information:
41
41
 
42
42
  @babel/runtime/helpers/regeneratorRuntime.js: