@vercel/cli-support 65.7.0 → 65.8.0-snapshot-c4f338842961

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/dist/chunks/add-6R2L3B6P.js +8 -0
  2. package/dist/chunks/add-O4YI4D5H.js +8 -0
  3. package/dist/chunks/add-W7MDOZMC.js +8 -0
  4. package/dist/chunks/build-UOKGUTFN.js +7 -0
  5. package/dist/chunks/chunk-2EYHCJQO.js +22 -0
  6. package/dist/chunks/{chunk-I64T5ZML.js → chunk-2NMEPXG3.js} +1 -1
  7. package/dist/chunks/{chunk-H3E4YX2M.js → chunk-3IRPFJ2G.js} +1 -1
  8. package/dist/chunks/{chunk-DCX2PBSX.js → chunk-3P4Y46MS.js} +1 -1
  9. package/dist/chunks/{chunk-E32IBIXV.js → chunk-4BIGNS67.js} +1 -1
  10. package/dist/chunks/{chunk-LIXU6EGC.js → chunk-4JE57EBL.js} +1 -1
  11. package/dist/chunks/{chunk-RD2VHI66.js → chunk-4K3O7QWS.js} +1 -1
  12. package/dist/chunks/{chunk-SKDLXVRO.js → chunk-4NDWIUKJ.js} +1 -1
  13. package/dist/chunks/{chunk-KBFHUWSQ.js → chunk-4UIMSZZB.js} +1 -1
  14. package/dist/chunks/{chunk-3E364MJE.js → chunk-5O7CRJE5.js} +1 -1
  15. package/dist/chunks/{chunk-N36OHJVQ.js → chunk-64VMAYM6.js} +1 -1
  16. package/dist/chunks/{chunk-S52O6DKC.js → chunk-AA3JM33J.js} +1 -1
  17. package/dist/chunks/{chunk-OS5I5TXU.js → chunk-APWCVJAG.js} +1 -1
  18. package/dist/chunks/chunk-BPR5CLQM.js +8 -0
  19. package/dist/chunks/{chunk-A7E3WORN.js → chunk-C7D43G3N.js} +1 -1
  20. package/dist/chunks/{chunk-EOK43KMC.js → chunk-CCD7E322.js} +1 -1
  21. package/dist/chunks/chunk-CNOJCW2I.js +21 -0
  22. package/dist/chunks/{chunk-UWGWRZP5.js → chunk-CS6E5XNQ.js} +1 -1
  23. package/dist/chunks/{chunk-MJ7JIQL3.js → chunk-D2XEF6G4.js} +1 -1
  24. package/dist/chunks/{chunk-HOOQ7ZMB.js → chunk-DPZFKHW3.js} +1 -1
  25. package/dist/chunks/{chunk-OORHGYZ3.js → chunk-EDLTSAD2.js} +1 -1
  26. package/dist/chunks/{chunk-JPEIHA57.js → chunk-EMORYAJQ.js} +1 -1
  27. package/dist/chunks/{chunk-HKZKGIBQ.js → chunk-ET5ARPPO.js} +1 -1
  28. package/dist/chunks/{chunk-TYL6IYR4.js → chunk-F34TG2V3.js} +1 -1
  29. package/dist/chunks/{chunk-RNTS4MJP.js → chunk-FJ5CNQDD.js} +1 -1
  30. package/dist/chunks/chunk-FOQK3VTY.js +8 -0
  31. package/dist/chunks/{chunk-767IBETW.js → chunk-FXF3NEJM.js} +3 -3
  32. package/dist/chunks/{chunk-G62JX3C5.js → chunk-GSXTCMKC.js} +1 -1
  33. package/dist/chunks/{chunk-2KINJIWA.js → chunk-H73G2ROF.js} +1 -1
  34. package/dist/chunks/{chunk-GKCTMBCM.js → chunk-IFXMG2WQ.js} +1 -1
  35. package/dist/chunks/{chunk-WRHQTUHU.js → chunk-J4OVLASZ.js} +1 -1
  36. package/dist/chunks/{chunk-VT2IZBPL.js → chunk-JAOYF7AW.js} +1 -1
  37. package/dist/chunks/{chunk-FSBAVQQP.js → chunk-JQTSETXH.js} +1 -1
  38. package/dist/chunks/{chunk-MYTOHLYZ.js → chunk-JYK7ZIZW.js} +1 -1
  39. package/dist/chunks/{chunk-5ULKEPKM.js → chunk-K3TCWYVX.js} +1 -1
  40. package/dist/chunks/{chunk-SAUBWYQJ.js → chunk-KPO6VDR2.js} +1 -1
  41. package/dist/chunks/{chunk-QRYQADGN.js → chunk-LBTMGBAK.js} +1 -1
  42. package/dist/chunks/{chunk-X4K3UJN7.js → chunk-MBJT3CNI.js} +1 -1
  43. package/dist/chunks/{chunk-GAGROISK.js → chunk-OCRNZT7G.js} +1 -1
  44. package/dist/chunks/chunk-OER4YAWM.js +7 -0
  45. package/dist/chunks/{chunk-GV2ZL4IE.js → chunk-OETX5QG4.js} +1 -1
  46. package/dist/chunks/{chunk-OEPDTNS3.js → chunk-P2SVNHTJ.js} +1 -1
  47. package/dist/chunks/{chunk-HTOZY5SI.js → chunk-QAYWROXQ.js} +1 -1
  48. package/dist/chunks/{chunk-VKJVYR4T.js → chunk-QGGJ5VVZ.js} +1 -1
  49. package/dist/chunks/{chunk-F6MHQRDG.js → chunk-RGQZXLV4.js} +1 -1
  50. package/dist/chunks/chunk-RHFPMM4R.js +70 -0
  51. package/dist/chunks/{chunk-WZAJYSJZ.js → chunk-RKWPLZJX.js} +1 -1
  52. package/dist/chunks/{chunk-43WS2YU4.js → chunk-RPWGUQSE.js} +1 -1
  53. package/dist/chunks/{chunk-FN3W5CJQ.js → chunk-RUXABBNV.js} +1 -1
  54. package/dist/chunks/{chunk-3DFEM7ZL.js → chunk-RVXE4MXS.js} +1 -1
  55. package/dist/chunks/chunk-SJA2LZ4O.js +24 -0
  56. package/dist/chunks/{chunk-2H4UEVTG.js → chunk-SOGL2HOD.js} +1 -1
  57. package/dist/chunks/{chunk-5XCOIFBD.js → chunk-SUMMI76H.js} +1 -1
  58. package/dist/chunks/{chunk-RCUDI7OF.js → chunk-T34C75TI.js} +1 -1
  59. package/dist/chunks/{chunk-FBYA6LLM.js → chunk-U3J7VS56.js} +1 -1
  60. package/dist/chunks/{chunk-4P6IRBBK.js → chunk-UF7QYHFU.js} +1 -1
  61. package/dist/chunks/{chunk-CNE5UGJC.js → chunk-UKJAWDQX.js} +1 -1
  62. package/dist/chunks/{chunk-DPM33VFZ.js → chunk-UMMQR6WI.js} +1 -1
  63. package/dist/chunks/{chunk-GTHPBDPB.js → chunk-VM3R6MAM.js} +2 -2
  64. package/dist/chunks/{chunk-A4UOBMZR.js → chunk-WGPYUXIC.js} +1 -1
  65. package/dist/chunks/{chunk-RQVIMYKN.js → chunk-WZ2R4Z7N.js} +1 -1
  66. package/dist/chunks/{chunk-YT3QAZQF.js → chunk-YEOOTTBB.js} +1 -1
  67. package/dist/chunks/clear-P2GBQ7OM.js +8 -0
  68. package/dist/chunks/compile-vercel-config-SPFLKB2T.js +7 -0
  69. package/dist/chunks/{config-3AXLL3GO.js → config-BI7WYZWB.js} +1 -1
  70. package/dist/chunks/config-PR2PEOA7.js +8 -0
  71. package/dist/chunks/delete-BZ3NLCTU.js +9 -0
  72. package/dist/chunks/delete-PUEGS2CP.js +10 -0
  73. package/dist/chunks/{detect-projects-EYF4ZSYF.js → detect-projects-A4H2ZEAP.js} +1 -1
  74. package/dist/chunks/detect-services-HHGBWOND.js +7 -0
  75. package/dist/chunks/disable-UYLN3HPM.js +7 -0
  76. package/dist/chunks/discard-NMRN5PS4.js +14 -0
  77. package/dist/chunks/edit-KA7OSMJA.js +9 -0
  78. package/dist/chunks/edit-UQ4J2OQ7.js +8 -0
  79. package/dist/chunks/enable-7FM67BEJ.js +7 -0
  80. package/dist/chunks/{exec-PX4GTZNE.js → exec-R5BDGSGP.js} +1 -1
  81. package/dist/chunks/{export-4RZRCFX7.js → export-FV6WM43O.js} +1 -1
  82. package/dist/chunks/future-3WF7CSGN.js +7 -0
  83. package/dist/chunks/generate-cert-for-deploy-3OBDQ2R3.js +7 -0
  84. package/dist/chunks/{image-UPFKBULX.js → image-SYY2IBOV.js} +1 -1
  85. package/dist/chunks/import-builders-IJYZSEBY.js +7 -0
  86. package/dist/chunks/inspect-3NZE4UWJ.js +13 -0
  87. package/dist/chunks/{inspect-2SCDEURI.js → inspect-DLADA2SX.js} +1 -1
  88. package/dist/chunks/inspect-J4WU7N2Z.js +9 -0
  89. package/dist/chunks/{inspect-IOKO45PV.js → inspect-W3RVFJLM.js} +1 -1
  90. package/dist/chunks/{inspect-UJAAVGJT.js → inspect-ZUHCIZFW.js} +1 -1
  91. package/dist/chunks/{list-PC4ZVIHQ.js → list-6EZHEJGK.js} +1 -1
  92. package/dist/chunks/list-GLYYBTWD.js +12 -0
  93. package/dist/chunks/{list-34Z62YFO.js → list-L4ZCXNAN.js} +1 -1
  94. package/dist/chunks/login-4OUKTVIZ.js +7 -0
  95. package/dist/chunks/login-E6L7CG3P.js +9 -0
  96. package/dist/chunks/logs-XHJPPHQ7.js +7 -0
  97. package/dist/chunks/{ls-PQBYVYPW.js → ls-36K3OMRV.js} +1 -1
  98. package/dist/chunks/{ls-ZK5ESMRT.js → ls-E75T2PHD.js} +1 -1
  99. package/dist/chunks/{ls-HQHXDVPG.js → ls-EIGVX2LB.js} +1 -1
  100. package/dist/chunks/{ls-MDTI26PW.js → ls-GSMTVAMC.js} +1 -1
  101. package/dist/chunks/{ls-FL3FCE2T.js → ls-IGICS6HZ.js} +1 -1
  102. package/dist/chunks/ls-PA4OVQ43.js +11 -0
  103. package/dist/chunks/ls-RKILAXZ4.js +8 -0
  104. package/dist/chunks/mutate-4L6XPD7X.js +9 -0
  105. package/dist/chunks/{notifications-A46PC7QX.js → notifications-IAKFNMTC.js} +1 -1
  106. package/dist/chunks/open-62S7LSPT.js +7 -0
  107. package/dist/chunks/{openapi-5QWHDLKR.js → openapi-SO34WDBK.js} +1 -1
  108. package/dist/chunks/{permissions-MCOS247Q.js → permissions-T2KL34JP.js} +1 -1
  109. package/dist/chunks/{plugin-offer-ZMTZG6FR.js → plugin-offer-HMNGWYIC.js} +1 -1
  110. package/dist/chunks/prompt-missing-credentials-WTRJREZF.js +7 -0
  111. package/dist/chunks/publish-EFZO7IO2.js +15 -0
  112. package/dist/chunks/pull-GVFCZAHC.js +7 -0
  113. package/dist/chunks/purchase-domain-if-available-PJMKV5BI.js +7 -0
  114. package/dist/chunks/push-PHTW37LC.js +7 -0
  115. package/dist/chunks/{query-OG4FG2AO.js → query-CUU7RRG6.js} +1 -1
  116. package/dist/chunks/reauthenticate-7P3C7ASY.js +7 -0
  117. package/dist/chunks/reorder-EBYXIVUZ.js +10 -0
  118. package/dist/chunks/reply-CBBADKE5.js +9 -0
  119. package/dist/chunks/resolve-KKFBXTIX.js +12 -0
  120. package/dist/chunks/resolve-agent-team-BBBIQWFZ.js +7 -0
  121. package/dist/chunks/restore-D4JUHPJ7.js +16 -0
  122. package/dist/chunks/rm-CRDLGD4Y.js +8 -0
  123. package/dist/chunks/rm-DSAXELZD.js +8 -0
  124. package/dist/chunks/rm-HXDTYZ3G.js +8 -0
  125. package/dist/chunks/rm-TDI6GXCE.js +8 -0
  126. package/dist/chunks/rm-XAUKTN2C.js +8 -0
  127. package/dist/chunks/{routes-LQGTKBXU.js → routes-RWILS4LA.js} +1 -1
  128. package/dist/chunks/rule-inspect-RKUBC35D.js +8 -0
  129. package/dist/chunks/{schema-H5RRV4J3.js → schema-5G57LHUD.js} +1 -1
  130. package/dist/chunks/schema-WSHKYL5H.js +14 -0
  131. package/dist/chunks/select-org-OKHCDXNF.js +7 -0
  132. package/dist/chunks/set-PBM7ZMZ7.js +7 -0
  133. package/dist/chunks/setup-and-link-PVMEKIYD.js +7 -0
  134. package/dist/chunks/{skills-CY57F35A.js → skills-4WEJZT7E.js} +1 -1
  135. package/dist/chunks/{tags-WAVSTC2G.js → tags-WUAMDEUU.js} +1 -1
  136. package/dist/chunks/{update-4LNUD2AB.js → update-IKZXIUYB.js} +1 -1
  137. package/dist/commands/build/index.js +1 -1
  138. package/dist/commands/deploy/index.js +5 -5
  139. package/dist/commands/dev/index.js +3 -3
  140. package/dist/commands/env/index.js +5 -2
  141. package/dist/commands/link/index.js +1 -1
  142. package/dist/commands/list/index.js +1 -1
  143. package/dist/commands/project/index.js +2 -2
  144. package/dist/commands-account.js +1 -1
  145. package/dist/commands-ai.js +2 -2
  146. package/dist/commands-blob.js +1 -1
  147. package/dist/commands-core.js +5 -5
  148. package/dist/commands-deployments.js +1 -1
  149. package/dist/commands-flags.js +82 -64
  150. package/dist/commands-integrations.js +1 -1
  151. package/dist/commands-observability.js +2 -2
  152. package/dist/commands-routing.js +3 -3
  153. package/dist/index.js +5 -5
  154. package/dist/internal-build.js +1 -1
  155. package/dist/native-download.js +1 -1
  156. package/dist/package.json +59 -59
  157. package/dist/version.mjs +1 -1
  158. package/package.json +52 -52
  159. package/dist/chunks/add-7G5PAIUN.js +0 -8
  160. package/dist/chunks/add-LA2T477X.js +0 -8
  161. package/dist/chunks/add-TPDABQQA.js +0 -8
  162. package/dist/chunks/build-A463NBA2.js +0 -7
  163. package/dist/chunks/chunk-DFXYDOFX.js +0 -20
  164. package/dist/chunks/chunk-I7YEXDVF.js +0 -22
  165. package/dist/chunks/chunk-LAINBICC.js +0 -7
  166. package/dist/chunks/chunk-MY4MONOH.js +0 -7
  167. package/dist/chunks/chunk-PH3ZOT3L.js +0 -21
  168. package/dist/chunks/chunk-QBP6E2YB.js +0 -24
  169. package/dist/chunks/chunk-QDQ4NHQN.js +0 -8
  170. package/dist/chunks/chunk-S22GZWJS.js +0 -8
  171. package/dist/chunks/chunk-TKKGZI7O.js +0 -57
  172. package/dist/chunks/clear-ISIDZTUZ.js +0 -8
  173. package/dist/chunks/compile-vercel-config-CZVX4OWQ.js +0 -7
  174. package/dist/chunks/config-MAFBMJV3.js +0 -8
  175. package/dist/chunks/delete-LLQFSC7R.js +0 -10
  176. package/dist/chunks/delete-PIFKRZEO.js +0 -9
  177. package/dist/chunks/detect-services-LNYPPBJP.js +0 -7
  178. package/dist/chunks/disable-7JLE53D2.js +0 -7
  179. package/dist/chunks/discard-EXDT6QIK.js +0 -14
  180. package/dist/chunks/edit-3NOKVF5V.js +0 -9
  181. package/dist/chunks/edit-BQCPB3ZR.js +0 -8
  182. package/dist/chunks/enable-KYVZIXZM.js +0 -7
  183. package/dist/chunks/future-YZGJX6FF.js +0 -7
  184. package/dist/chunks/generate-cert-for-deploy-I236CHA2.js +0 -7
  185. package/dist/chunks/import-builders-JEJRMLNC.js +0 -7
  186. package/dist/chunks/inspect-BMBFYISW.js +0 -13
  187. package/dist/chunks/inspect-P246VXF5.js +0 -9
  188. package/dist/chunks/list-WL3WA7CS.js +0 -12
  189. package/dist/chunks/login-BOBO3TKA.js +0 -9
  190. package/dist/chunks/login-RAN3UBFA.js +0 -7
  191. package/dist/chunks/logs-L3VFH7SK.js +0 -7
  192. package/dist/chunks/ls-FKECGTP3.js +0 -11
  193. package/dist/chunks/ls-NQVH63KO.js +0 -8
  194. package/dist/chunks/mutate-6OEPBAJF.js +0 -9
  195. package/dist/chunks/open-QWJQWDZD.js +0 -7
  196. package/dist/chunks/prompt-missing-credentials-AUJFBZRC.js +0 -7
  197. package/dist/chunks/publish-CQ5FHKNN.js +0 -15
  198. package/dist/chunks/pull-RVNTGJ4C.js +0 -7
  199. package/dist/chunks/purchase-domain-if-available-6FAGFFWC.js +0 -7
  200. package/dist/chunks/push-IBOUSKO7.js +0 -7
  201. package/dist/chunks/reauthenticate-TVQDXIFS.js +0 -7
  202. package/dist/chunks/reorder-LWKTDFSH.js +0 -10
  203. package/dist/chunks/reply-5CE2KUD7.js +0 -9
  204. package/dist/chunks/resolve-S35UEM35.js +0 -12
  205. package/dist/chunks/resolve-agent-team-DXHF7XLU.js +0 -7
  206. package/dist/chunks/restore-K66POLY7.js +0 -16
  207. package/dist/chunks/rm-6PBYTCDC.js +0 -8
  208. package/dist/chunks/rm-C4FXH2RT.js +0 -8
  209. package/dist/chunks/rm-C73EKJS4.js +0 -8
  210. package/dist/chunks/rm-MNT5XIGK.js +0 -8
  211. package/dist/chunks/rm-VJOHV243.js +0 -8
  212. package/dist/chunks/rule-inspect-4EBB5IDK.js +0 -8
  213. package/dist/chunks/schema-S32JRZH5.js +0 -14
  214. package/dist/chunks/select-org-VTLOMQYC.js +0 -7
  215. package/dist/chunks/set-52J54LJU.js +0 -7
  216. package/dist/chunks/setup-and-link-XGBTMVW7.js +0 -7
@@ -1,8 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{require_dist}from"./chunk-DFXYDOFX.js";import{canPrompt}from"./chunk-IQ7FPAI4.js";import{AGENT_REASON,AGENT_STATUS,outputActionRequired}from"./chunk-I7U2XP4X.js";import{humanizePath,require_lib}from"./chunk-TKKGZI7O.js";import{output_manager_default}from"./chunk-DWOJP4ST.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_client=__toESM(require_dist(),1);import{dirname,isAbsolute,relative,sep}from"path";var singleFileConfig={framework:null,buildCommand:"",installCommand:"",outputDirectory:null},singleFileProjectSettings={...singleFileConfig,rootDirectory:null};async function isIgnoredFile(file,cwd){let roots=new Set([dirname(file)]),fromCwd=relative(cwd,file);fromCwd&&!fromCwd.startsWith(`..${sep}`)&&!isAbsolute(fromCwd)&&roots.add(cwd);for(let root of roots){let{ig}=await(0,import_client.getVercelIgnore)(root);if(ig.ignores(relative(root,file).split(sep).join("/")))return!0}return!1}var import_fs_extra=__toESM(require_lib(),1),import_chalk=__toESM(require_source(),1);import{homedir}from"os";import{resolve,sep as sep2}from"path";async function validateRootDirectory(cwd,path,errorSuffix=""){let pathStat=await(0,import_fs_extra.lstat)(path).catch(()=>null),suffix=errorSuffix?` ${errorSuffix}`:"";if(!pathStat)return output_manager_default.error(`The provided path ${import_chalk.default.cyan(`\u201C${humanizePath(path)}\u201D`)} does not exist.${suffix}`),!1;if(!pathStat.isDirectory())return output_manager_default.error(`The provided path ${import_chalk.default.cyan(`\u201C${humanizePath(path)}\u201D`)} is a file, but expected a directory.${suffix}`),!1;let base=resolve(cwd),target=resolve(path);return target!==base&&!target.startsWith(base+sep2)?(output_manager_default.error(`The provided path ${import_chalk.default.cyan(`\u201C${humanizePath(path)}\u201D`)} is outside of the project.${suffix}`),!1):!0}async function validatePaths(client,paths,{allowFiles=!1}={}){if(paths.length>1)return output_manager_default.error("Can't deploy more than one path."),{valid:!1,exitCode:1};let path=paths[0],pathStat=await(0,import_fs_extra.lstat)(path).catch(()=>null);if(!pathStat)return output_manager_default.error(`Could not find ${import_chalk.default.cyan(`\u201C${humanizePath(path)}\u201D`)}`),{valid:!1,exitCode:1};let isFile=pathStat.isFile();if(!pathStat.isDirectory()&&!(allowFiles&&isFile))return output_manager_default.fatal(allowFiles?"Deploy a regular file or directory. Symbolic links and special files are not supported as deployment paths.":"This command requires a directory. Use `vercel <file>` to deploy a single file."),{valid:!1,exitCode:1};if(path===homedir()){if(!canPrompt(client)){let message="Can't deploy your home directory without interactive confirmation. Run from your project directory, or run in a terminal to confirm deploying your home directory.";return outputActionRequired(client,{status:AGENT_STATUS.ACTION_REQUIRED,reason:AGENT_REASON.INTERACTIVE_CONFIRMATION_REQUIRED,message,userActionRequired:!0},2),output_manager_default.error(message),{valid:!1,exitCode:2}}if(!await client.input.confirm("You are deploying your home directory. Do you want to continue?",!1))return output_manager_default.print(`Canceled
8
- `),{valid:!1,exitCode:0}}return{valid:!0,path,isFile}}export{singleFileConfig,singleFileProjectSettings,isIgnoredFile,validateRootDirectory,validatePaths};
@@ -1,8 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{login}from"./chunk-I7YEXDVF.js";import{loginCommand}from"./chunk-LFOWP74R.js";import{printError}from"./chunk-LCMNJNSQ.js";import{help}from"./chunk-SLDWAIO3.js";import{TelemetryClient}from"./chunk-E32IBIXV.js";import{parseArguments}from"./chunk-F22QLVTX.js";import{output_manager_default}from"./chunk-DWOJP4ST.js";import{getFlagsSpecification}from"./chunk-A2UZ2O7H.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);var LoginTelemetryClient=class extends TelemetryClient{trackState(...args){this.trackLoginState(...args)}};async function login2(client,options){let parsedArgs=null,flagsSpecification=getFlagsSpecification(loginCommand.options),telemetry=new LoginTelemetryClient({opts:{store:client.telemetryEventStore}});try{options.shouldParseArgs&&(parsedArgs=parseArguments(client.argv.slice(2),flagsSpecification))}catch(error){return printError(error),2}if(parsedArgs?.flags["--help"])return telemetry.trackCliFlagHelp("login"),output_manager_default.print(help(loginCommand,{stream:client.stderr,columns:client.stderr.columns})),0;if(parsedArgs?.flags["--token"])return output_manager_default.error('`--token` may not be used with the "login" command'),2;if(options.shouldParseArgs&&parsedArgs){let obsoleteFlags=Object.keys(parsedArgs.flags).filter(flag=>{let flagKey=flag.replace("--",""),option=loginCommand.options.find(o=>o.name===flagKey);if(!(!option||typeof option=="number"))return"deprecated"in option&&option.deprecated});if(obsoleteFlags.length){let flags=obsoleteFlags.map(f=>import_chalk.default.bold(f)).join(", ");output_manager_default.warn(`The following options are deprecated: ${flags}`)}let obsoleteArguments=parsedArgs.args.slice(1);if(obsoleteArguments.length){let args=obsoleteArguments.map(a=>import_chalk.default.bold(a)).join(", ");output_manager_default.warn(`The following arguments are deprecated: ${args}`)}(obsoleteArguments.length||obsoleteFlags.length)&&output_manager_default.print(`Read more in our ${output_manager_default.link("changelog","https://vercel.com/changelog/new-vercel-cli-login-flow")}.
8
- `)}telemetry.trackState("started");let scope=parsedArgs?.flags["--scope"]||parsedArgs?.flags["--team"];return await login(client,telemetry,options.shouldParseArgs,scope)}export{login2 as login};
@@ -1,57 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{printAlignedLabel}from"./chunk-26QK3I2S.js";import{getGlobalPathConfig}from"./chunk-55H6G46X.js";import{require_graceful_fs,require_load_json_file}from"./chunk-4NTBYNFR.js";import{parseArguments}from"./chunk-F22QLVTX.js";import{getTeamByIdOrSlug}from"./chunk-F53OKXYI.js";import{require_lib}from"./chunk-LUX4PBJL.js";import{require_cli_config}from"./chunk-4SAVH3H7.js";import{APIError,ConflictingConfigFiles,DeprecatedNowJson,InvalidLocalConfig,InvalidToken,MissingUser,NowError,ProjectNotFound,code,isAPIError}from"./chunk-YCJHUYBJ.js";import{emoji,link_default,output_manager_default,prependEmoji,require_build_utils}from"./chunk-DWOJP4ST.js";import{require_dist}from"./chunk-RM3ZDRYE.js";import{pkg_default}from"./chunk-OO572JUC.js";import{require_source}from"./chunk-NB2WLB3J.js";import{fetch}from"./chunk-MY4MONOH.js";import{__commonJS,__require,__toESM}from"./chunk-BZENIQ7N.js";var require_universalify=__commonJS({"../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js"(exports){"use strict";exports.fromCallback=function(fn){return Object.defineProperty(function(...args){if(typeof args[args.length-1]=="function")fn.apply(this,args);else return new Promise((resolve6,reject)=>{args.push((err,res)=>err!=null?reject(err):resolve6(res)),fn.apply(this,args)})},"name",{value:fn.name})};exports.fromPromise=function(fn){return Object.defineProperty(function(...args){let cb=args[args.length-1];if(typeof cb!="function")return fn.apply(this,args);args.pop(),fn.apply(this,args).then(r=>cb(null,r),cb)},"name",{value:fn.name})}}});var require_fs=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/fs/index.js"(exports){"use strict";var u=require_universalify().fromCallback,fs4=require_graceful_fs(),api=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(key=>typeof fs4[key]=="function");Object.assign(exports,fs4);api.forEach(method=>{exports[method]=u(fs4[method])});exports.realpath.native=u(fs4.realpath.native);exports.exists=function(filename,callback){return typeof callback=="function"?fs4.exists(filename,callback):new Promise(resolve6=>fs4.exists(filename,resolve6))};exports.read=function(fd,buffer,offset,length,position,callback){return typeof callback=="function"?fs4.read(fd,buffer,offset,length,position,callback):new Promise((resolve6,reject)=>{fs4.read(fd,buffer,offset,length,position,(err,bytesRead,buffer2)=>{if(err)return reject(err);resolve6({bytesRead,buffer:buffer2})})})};exports.write=function(fd,buffer,...args){return typeof args[args.length-1]=="function"?fs4.write(fd,buffer,...args):new Promise((resolve6,reject)=>{fs4.write(fd,buffer,...args,(err,bytesWritten,buffer2)=>{if(err)return reject(err);resolve6({bytesWritten,buffer:buffer2})})})};typeof fs4.writev=="function"&&(exports.writev=function(fd,buffers,...args){return typeof args[args.length-1]=="function"?fs4.writev(fd,buffers,...args):new Promise((resolve6,reject)=>{fs4.writev(fd,buffers,...args,(err,bytesWritten,buffers2)=>{if(err)return reject(err);resolve6({bytesWritten,buffers:buffers2})})})})}});var require_utils=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/mkdirs/utils.js"(exports,module){"use strict";var path2=__require("path");module.exports.checkPath=function(pth){if(process.platform==="win32"&&/[<>:"|?*]/.test(pth.replace(path2.parse(pth).root,""))){let error=new Error(`Path contains invalid characters: ${pth}`);throw error.code="EINVAL",error}}}});var require_make_dir=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/mkdirs/make-dir.js"(exports,module){"use strict";var fs4=require_fs(),{checkPath}=require_utils(),getMode=options=>{let defaults={mode:511};return typeof options=="number"?options:{...defaults,...options}.mode};module.exports.makeDir=async(dir,options)=>(checkPath(dir),fs4.mkdir(dir,{mode:getMode(options),recursive:!0}));module.exports.makeDirSync=(dir,options)=>(checkPath(dir),fs4.mkdirSync(dir,{mode:getMode(options),recursive:!0}))}});var require_mkdirs=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/mkdirs/index.js"(exports,module){"use strict";var u=require_universalify().fromPromise,{makeDir:_makeDir,makeDirSync}=require_make_dir(),makeDir=u(_makeDir);module.exports={mkdirs:makeDir,mkdirsSync:makeDirSync,mkdirp:makeDir,mkdirpSync:makeDirSync,ensureDir:makeDir,ensureDirSync:makeDirSync}}});var require_utimes=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/util/utimes.js"(exports,module){"use strict";var fs4=require_graceful_fs();function utimesMillis(path2,atime,mtime,callback){fs4.open(path2,"r+",(err,fd)=>{if(err)return callback(err);fs4.futimes(fd,atime,mtime,futimesErr=>{fs4.close(fd,closeErr=>{callback&&callback(futimesErr||closeErr)})})})}function utimesMillisSync(path2,atime,mtime){let fd=fs4.openSync(path2,"r+");return fs4.futimesSync(fd,atime,mtime),fs4.closeSync(fd)}module.exports={utimesMillis,utimesMillisSync}}});var require_stat=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/util/stat.js"(exports,module){"use strict";var fs4=require_fs(),path2=__require("path"),util=__require("util");function getStats(src,dest,opts){let statFunc=opts.dereference?file=>fs4.stat(file,{bigint:!0}):file=>fs4.lstat(file,{bigint:!0});return Promise.all([statFunc(src),statFunc(dest).catch(err=>{if(err.code==="ENOENT")return null;throw err})]).then(([srcStat,destStat])=>({srcStat,destStat}))}function getStatsSync(src,dest,opts){let destStat,statFunc=opts.dereference?file=>fs4.statSync(file,{bigint:!0}):file=>fs4.lstatSync(file,{bigint:!0}),srcStat=statFunc(src);try{destStat=statFunc(dest)}catch(err){if(err.code==="ENOENT")return{srcStat,destStat:null};throw err}return{srcStat,destStat}}function checkPaths(src,dest,funcName,opts,cb){util.callbackify(getStats)(src,dest,opts,(err,stats)=>{if(err)return cb(err);let{srcStat,destStat}=stats;if(destStat){if(areIdentical(srcStat,destStat)){let srcBaseName=path2.basename(src),destBaseName=path2.basename(dest);return funcName==="move"&&srcBaseName!==destBaseName&&srcBaseName.toLowerCase()===destBaseName.toLowerCase()?cb(null,{srcStat,destStat,isChangingCase:!0}):cb(new Error("Source and destination must not be the same."))}if(srcStat.isDirectory()&&!destStat.isDirectory())return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`));if(!srcStat.isDirectory()&&destStat.isDirectory())return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`))}return srcStat.isDirectory()&&isSrcSubdir(src,dest)?cb(new Error(errMsg(src,dest,funcName))):cb(null,{srcStat,destStat})})}function checkPathsSync(src,dest,funcName,opts){let{srcStat,destStat}=getStatsSync(src,dest,opts);if(destStat){if(areIdentical(srcStat,destStat)){let srcBaseName=path2.basename(src),destBaseName=path2.basename(dest);if(funcName==="move"&&srcBaseName!==destBaseName&&srcBaseName.toLowerCase()===destBaseName.toLowerCase())return{srcStat,destStat,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(srcStat.isDirectory()&&!destStat.isDirectory())throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);if(!srcStat.isDirectory()&&destStat.isDirectory())throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)}if(srcStat.isDirectory()&&isSrcSubdir(src,dest))throw new Error(errMsg(src,dest,funcName));return{srcStat,destStat}}function checkParentPaths(src,srcStat,dest,funcName,cb){let srcParent=path2.resolve(path2.dirname(src)),destParent=path2.resolve(path2.dirname(dest));if(destParent===srcParent||destParent===path2.parse(destParent).root)return cb();fs4.stat(destParent,{bigint:!0},(err,destStat)=>err?err.code==="ENOENT"?cb():cb(err):areIdentical(srcStat,destStat)?cb(new Error(errMsg(src,dest,funcName))):checkParentPaths(src,srcStat,destParent,funcName,cb))}function checkParentPathsSync(src,srcStat,dest,funcName){let srcParent=path2.resolve(path2.dirname(src)),destParent=path2.resolve(path2.dirname(dest));if(destParent===srcParent||destParent===path2.parse(destParent).root)return;let destStat;try{destStat=fs4.statSync(destParent,{bigint:!0})}catch(err){if(err.code==="ENOENT")return;throw err}if(areIdentical(srcStat,destStat))throw new Error(errMsg(src,dest,funcName));return checkParentPathsSync(src,srcStat,destParent,funcName)}function areIdentical(srcStat,destStat){return destStat.ino&&destStat.dev&&destStat.ino===srcStat.ino&&destStat.dev===srcStat.dev}function isSrcSubdir(src,dest){let srcArr=path2.resolve(src).split(path2.sep).filter(i=>i),destArr=path2.resolve(dest).split(path2.sep).filter(i=>i);return srcArr.reduce((acc,cur,i)=>acc&&destArr[i]===cur,!0)}function errMsg(src,dest,funcName){return`Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`}module.exports={checkPaths,checkPathsSync,checkParentPaths,checkParentPathsSync,isSrcSubdir,areIdentical}}});var require_copy_sync=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/copy-sync/copy-sync.js"(exports,module){"use strict";var fs4=require_graceful_fs(),path2=__require("path"),mkdirsSync=require_mkdirs().mkdirsSync,utimesMillisSync=require_utimes().utimesMillisSync,stat2=require_stat();function copySync(src,dest,opts){typeof opts=="function"&&(opts={filter:opts}),opts=opts||{},opts.clobber="clobber"in opts?!!opts.clobber:!0,opts.overwrite="overwrite"in opts?!!opts.overwrite:opts.clobber,opts.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
8
-
9
- see https://github.com/jprichardson/node-fs-extra/issues/269`);let{srcStat,destStat}=stat2.checkPathsSync(src,dest,"copy",opts);return stat2.checkParentPathsSync(src,srcStat,dest,"copy"),handleFilterAndCopy(destStat,src,dest,opts)}function handleFilterAndCopy(destStat,src,dest,opts){if(opts.filter&&!opts.filter(src,dest))return;let destParent=path2.dirname(dest);return fs4.existsSync(destParent)||mkdirsSync(destParent),getStats(destStat,src,dest,opts)}function startCopy(destStat,src,dest,opts){if(!(opts.filter&&!opts.filter(src,dest)))return getStats(destStat,src,dest,opts)}function getStats(destStat,src,dest,opts){let srcStat=(opts.dereference?fs4.statSync:fs4.lstatSync)(src);if(srcStat.isDirectory())return onDir(srcStat,destStat,src,dest,opts);if(srcStat.isFile()||srcStat.isCharacterDevice()||srcStat.isBlockDevice())return onFile(srcStat,destStat,src,dest,opts);if(srcStat.isSymbolicLink())return onLink(destStat,src,dest,opts);throw srcStat.isSocket()?new Error(`Cannot copy a socket file: ${src}`):srcStat.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${src}`):new Error(`Unknown file: ${src}`)}function onFile(srcStat,destStat,src,dest,opts){return destStat?mayCopyFile(srcStat,src,dest,opts):copyFile(srcStat,src,dest,opts)}function mayCopyFile(srcStat,src,dest,opts){if(opts.overwrite)return fs4.unlinkSync(dest),copyFile(srcStat,src,dest,opts);if(opts.errorOnExist)throw new Error(`'${dest}' already exists`)}function copyFile(srcStat,src,dest,opts){return fs4.copyFileSync(src,dest),opts.preserveTimestamps&&handleTimestamps(srcStat.mode,src,dest),setDestMode(dest,srcStat.mode)}function handleTimestamps(srcMode,src,dest){return fileIsNotWritable(srcMode)&&makeFileWritable(dest,srcMode),setDestTimestamps(src,dest)}function fileIsNotWritable(srcMode){return(srcMode&128)===0}function makeFileWritable(dest,srcMode){return setDestMode(dest,srcMode|128)}function setDestMode(dest,srcMode){return fs4.chmodSync(dest,srcMode)}function setDestTimestamps(src,dest){let updatedSrcStat=fs4.statSync(src);return utimesMillisSync(dest,updatedSrcStat.atime,updatedSrcStat.mtime)}function onDir(srcStat,destStat,src,dest,opts){return destStat?copyDir(src,dest,opts):mkDirAndCopy(srcStat.mode,src,dest,opts)}function mkDirAndCopy(srcMode,src,dest,opts){return fs4.mkdirSync(dest),copyDir(src,dest,opts),setDestMode(dest,srcMode)}function copyDir(src,dest,opts){fs4.readdirSync(src).forEach(item=>copyDirItem(item,src,dest,opts))}function copyDirItem(item,src,dest,opts){let srcItem=path2.join(src,item),destItem=path2.join(dest,item),{destStat}=stat2.checkPathsSync(srcItem,destItem,"copy",opts);return startCopy(destStat,srcItem,destItem,opts)}function onLink(destStat,src,dest,opts){let resolvedSrc=fs4.readlinkSync(src);if(opts.dereference&&(resolvedSrc=path2.resolve(process.cwd(),resolvedSrc)),destStat){let resolvedDest;try{resolvedDest=fs4.readlinkSync(dest)}catch(err){if(err.code==="EINVAL"||err.code==="UNKNOWN")return fs4.symlinkSync(resolvedSrc,dest);throw err}if(opts.dereference&&(resolvedDest=path2.resolve(process.cwd(),resolvedDest)),stat2.isSrcSubdir(resolvedSrc,resolvedDest))throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);if(fs4.statSync(dest).isDirectory()&&stat2.isSrcSubdir(resolvedDest,resolvedSrc))throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);return copyLink(resolvedSrc,dest)}else return fs4.symlinkSync(resolvedSrc,dest)}function copyLink(resolvedSrc,dest){return fs4.unlinkSync(dest),fs4.symlinkSync(resolvedSrc,dest)}module.exports=copySync}});var require_copy_sync2=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/copy-sync/index.js"(exports,module){"use strict";module.exports={copySync:require_copy_sync()}}});var require_path_exists=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/path-exists/index.js"(exports,module){"use strict";var u=require_universalify().fromPromise,fs4=require_fs();function pathExists2(path2){return fs4.access(path2).then(()=>!0).catch(()=>!1)}module.exports={pathExists:u(pathExists2),pathExistsSync:fs4.existsSync}}});var require_copy=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/copy/copy.js"(exports,module){"use strict";var fs4=require_graceful_fs(),path2=__require("path"),mkdirs=require_mkdirs().mkdirs,pathExists2=require_path_exists().pathExists,utimesMillis=require_utimes().utimesMillis,stat2=require_stat();function copy(src,dest,opts,cb){typeof opts=="function"&&!cb?(cb=opts,opts={}):typeof opts=="function"&&(opts={filter:opts}),cb=cb||function(){},opts=opts||{},opts.clobber="clobber"in opts?!!opts.clobber:!0,opts.overwrite="overwrite"in opts?!!opts.overwrite:opts.clobber,opts.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
10
-
11
- see https://github.com/jprichardson/node-fs-extra/issues/269`),stat2.checkPaths(src,dest,"copy",opts,(err,stats)=>{if(err)return cb(err);let{srcStat,destStat}=stats;stat2.checkParentPaths(src,srcStat,dest,"copy",err2=>err2?cb(err2):opts.filter?handleFilter(checkParentDir,destStat,src,dest,opts,cb):checkParentDir(destStat,src,dest,opts,cb))})}function checkParentDir(destStat,src,dest,opts,cb){let destParent=path2.dirname(dest);pathExists2(destParent,(err,dirExists)=>{if(err)return cb(err);if(dirExists)return getStats(destStat,src,dest,opts,cb);mkdirs(destParent,err2=>err2?cb(err2):getStats(destStat,src,dest,opts,cb))})}function handleFilter(onInclude,destStat,src,dest,opts,cb){Promise.resolve(opts.filter(src,dest)).then(include=>include?onInclude(destStat,src,dest,opts,cb):cb(),error=>cb(error))}function startCopy(destStat,src,dest,opts,cb){return opts.filter?handleFilter(getStats,destStat,src,dest,opts,cb):getStats(destStat,src,dest,opts,cb)}function getStats(destStat,src,dest,opts,cb){(opts.dereference?fs4.stat:fs4.lstat)(src,(err,srcStat)=>err?cb(err):srcStat.isDirectory()?onDir(srcStat,destStat,src,dest,opts,cb):srcStat.isFile()||srcStat.isCharacterDevice()||srcStat.isBlockDevice()?onFile(srcStat,destStat,src,dest,opts,cb):srcStat.isSymbolicLink()?onLink(destStat,src,dest,opts,cb):srcStat.isSocket()?cb(new Error(`Cannot copy a socket file: ${src}`)):srcStat.isFIFO()?cb(new Error(`Cannot copy a FIFO pipe: ${src}`)):cb(new Error(`Unknown file: ${src}`)))}function onFile(srcStat,destStat,src,dest,opts,cb){return destStat?mayCopyFile(srcStat,src,dest,opts,cb):copyFile(srcStat,src,dest,opts,cb)}function mayCopyFile(srcStat,src,dest,opts,cb){if(opts.overwrite)fs4.unlink(dest,err=>err?cb(err):copyFile(srcStat,src,dest,opts,cb));else return opts.errorOnExist?cb(new Error(`'${dest}' already exists`)):cb()}function copyFile(srcStat,src,dest,opts,cb){fs4.copyFile(src,dest,err=>err?cb(err):opts.preserveTimestamps?handleTimestampsAndMode(srcStat.mode,src,dest,cb):setDestMode(dest,srcStat.mode,cb))}function handleTimestampsAndMode(srcMode,src,dest,cb){return fileIsNotWritable(srcMode)?makeFileWritable(dest,srcMode,err=>err?cb(err):setDestTimestampsAndMode(srcMode,src,dest,cb)):setDestTimestampsAndMode(srcMode,src,dest,cb)}function fileIsNotWritable(srcMode){return(srcMode&128)===0}function makeFileWritable(dest,srcMode,cb){return setDestMode(dest,srcMode|128,cb)}function setDestTimestampsAndMode(srcMode,src,dest,cb){setDestTimestamps(src,dest,err=>err?cb(err):setDestMode(dest,srcMode,cb))}function setDestMode(dest,srcMode,cb){return fs4.chmod(dest,srcMode,cb)}function setDestTimestamps(src,dest,cb){fs4.stat(src,(err,updatedSrcStat)=>err?cb(err):utimesMillis(dest,updatedSrcStat.atime,updatedSrcStat.mtime,cb))}function onDir(srcStat,destStat,src,dest,opts,cb){return destStat?copyDir(src,dest,opts,cb):mkDirAndCopy(srcStat.mode,src,dest,opts,cb)}function mkDirAndCopy(srcMode,src,dest,opts,cb){fs4.mkdir(dest,err=>{if(err)return cb(err);copyDir(src,dest,opts,err2=>err2?cb(err2):setDestMode(dest,srcMode,cb))})}function copyDir(src,dest,opts,cb){fs4.readdir(src,(err,items)=>err?cb(err):copyDirItems(items,src,dest,opts,cb))}function copyDirItems(items,src,dest,opts,cb){let item=items.pop();return item?copyDirItem(items,item,src,dest,opts,cb):cb()}function copyDirItem(items,item,src,dest,opts,cb){let srcItem=path2.join(src,item),destItem=path2.join(dest,item);stat2.checkPaths(srcItem,destItem,"copy",opts,(err,stats)=>{if(err)return cb(err);let{destStat}=stats;startCopy(destStat,srcItem,destItem,opts,err2=>err2?cb(err2):copyDirItems(items,src,dest,opts,cb))})}function onLink(destStat,src,dest,opts,cb){fs4.readlink(src,(err,resolvedSrc)=>{if(err)return cb(err);if(opts.dereference&&(resolvedSrc=path2.resolve(process.cwd(),resolvedSrc)),destStat)fs4.readlink(dest,(err2,resolvedDest)=>err2?err2.code==="EINVAL"||err2.code==="UNKNOWN"?fs4.symlink(resolvedSrc,dest,cb):cb(err2):(opts.dereference&&(resolvedDest=path2.resolve(process.cwd(),resolvedDest)),stat2.isSrcSubdir(resolvedSrc,resolvedDest)?cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)):destStat.isDirectory()&&stat2.isSrcSubdir(resolvedDest,resolvedSrc)?cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)):copyLink(resolvedSrc,dest,cb)));else return fs4.symlink(resolvedSrc,dest,cb)})}function copyLink(resolvedSrc,dest,cb){fs4.unlink(dest,err=>err?cb(err):fs4.symlink(resolvedSrc,dest,cb))}module.exports=copy}});var require_copy2=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/copy/index.js"(exports,module){"use strict";var u=require_universalify().fromCallback;module.exports={copy:u(require_copy())}}});var require_rimraf=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/remove/rimraf.js"(exports,module){"use strict";var fs4=require_graceful_fs(),path2=__require("path"),assert=__require("assert"),isWindows=process.platform==="win32";function defaults(options){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach(m=>{options[m]=options[m]||fs4[m],m=m+"Sync",options[m]=options[m]||fs4[m]}),options.maxBusyTries=options.maxBusyTries||3}function rimraf(p,options,cb){let busyTries=0;typeof options=="function"&&(cb=options,options={}),assert(p,"rimraf: missing path"),assert.strictEqual(typeof p,"string","rimraf: path should be a string"),assert.strictEqual(typeof cb,"function","rimraf: callback function required"),assert(options,"rimraf: invalid options argument provided"),assert.strictEqual(typeof options,"object","rimraf: options should be object"),defaults(options),rimraf_(p,options,function CB(er){if(er){if((er.code==="EBUSY"||er.code==="ENOTEMPTY"||er.code==="EPERM")&&busyTries<options.maxBusyTries){busyTries++;let time=busyTries*100;return setTimeout(()=>rimraf_(p,options,CB),time)}er.code==="ENOENT"&&(er=null)}cb(er)})}function rimraf_(p,options,cb){assert(p),assert(options),assert(typeof cb=="function"),options.lstat(p,(er,st)=>{if(er&&er.code==="ENOENT")return cb(null);if(er&&er.code==="EPERM"&&isWindows)return fixWinEPERM(p,options,er,cb);if(st&&st.isDirectory())return rmdir(p,options,er,cb);options.unlink(p,er2=>{if(er2){if(er2.code==="ENOENT")return cb(null);if(er2.code==="EPERM")return isWindows?fixWinEPERM(p,options,er2,cb):rmdir(p,options,er2,cb);if(er2.code==="EISDIR")return rmdir(p,options,er2,cb)}return cb(er2)})})}function fixWinEPERM(p,options,er,cb){assert(p),assert(options),assert(typeof cb=="function"),options.chmod(p,438,er2=>{er2?cb(er2.code==="ENOENT"?null:er):options.stat(p,(er3,stats)=>{er3?cb(er3.code==="ENOENT"?null:er):stats.isDirectory()?rmdir(p,options,er,cb):options.unlink(p,cb)})})}function fixWinEPERMSync(p,options,er){let stats;assert(p),assert(options);try{options.chmodSync(p,438)}catch(er2){if(er2.code==="ENOENT")return;throw er}try{stats=options.statSync(p)}catch(er3){if(er3.code==="ENOENT")return;throw er}stats.isDirectory()?rmdirSync(p,options,er):options.unlinkSync(p)}function rmdir(p,options,originalEr,cb){assert(p),assert(options),assert(typeof cb=="function"),options.rmdir(p,er=>{er&&(er.code==="ENOTEMPTY"||er.code==="EEXIST"||er.code==="EPERM")?rmkids(p,options,cb):er&&er.code==="ENOTDIR"?cb(originalEr):cb(er)})}function rmkids(p,options,cb){assert(p),assert(options),assert(typeof cb=="function"),options.readdir(p,(er,files)=>{if(er)return cb(er);let n=files.length,errState;if(n===0)return options.rmdir(p,cb);files.forEach(f=>{rimraf(path2.join(p,f),options,er2=>{if(!errState){if(er2)return cb(errState=er2);--n===0&&options.rmdir(p,cb)}})})})}function rimrafSync(p,options){let st;options=options||{},defaults(options),assert(p,"rimraf: missing path"),assert.strictEqual(typeof p,"string","rimraf: path should be a string"),assert(options,"rimraf: missing options"),assert.strictEqual(typeof options,"object","rimraf: options should be object");try{st=options.lstatSync(p)}catch(er){if(er.code==="ENOENT")return;er.code==="EPERM"&&isWindows&&fixWinEPERMSync(p,options,er)}try{st&&st.isDirectory()?rmdirSync(p,options,null):options.unlinkSync(p)}catch(er){if(er.code==="ENOENT")return;if(er.code==="EPERM")return isWindows?fixWinEPERMSync(p,options,er):rmdirSync(p,options,er);if(er.code!=="EISDIR")throw er;rmdirSync(p,options,er)}}function rmdirSync(p,options,originalEr){assert(p),assert(options);try{options.rmdirSync(p)}catch(er){if(er.code==="ENOTDIR")throw originalEr;if(er.code==="ENOTEMPTY"||er.code==="EEXIST"||er.code==="EPERM")rmkidsSync(p,options);else if(er.code!=="ENOENT")throw er}}function rmkidsSync(p,options){if(assert(p),assert(options),options.readdirSync(p).forEach(f=>rimrafSync(path2.join(p,f),options)),isWindows){let startTime=Date.now();do try{return options.rmdirSync(p,options)}catch{}while(Date.now()-startTime<500)}else return options.rmdirSync(p,options)}module.exports=rimraf;rimraf.sync=rimrafSync}});var require_remove=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/remove/index.js"(exports,module){"use strict";var fs4=require_graceful_fs(),u=require_universalify().fromCallback,rimraf=require_rimraf();function remove(path2,callback){if(fs4.rm)return fs4.rm(path2,{recursive:!0,force:!0},callback);rimraf(path2,callback)}function removeSync(path2){if(fs4.rmSync)return fs4.rmSync(path2,{recursive:!0,force:!0});rimraf.sync(path2)}module.exports={remove:u(remove),removeSync}}});var require_empty=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/empty/index.js"(exports,module){"use strict";var u=require_universalify().fromPromise,fs4=require_fs(),path2=__require("path"),mkdir=require_mkdirs(),remove=require_remove(),emptyDir=u(async function(dir){let items;try{items=await fs4.readdir(dir)}catch{return mkdir.mkdirs(dir)}return Promise.all(items.map(item=>remove.remove(path2.join(dir,item))))});function emptyDirSync(dir){let items;try{items=fs4.readdirSync(dir)}catch{return mkdir.mkdirsSync(dir)}items.forEach(item=>{item=path2.join(dir,item),remove.removeSync(item)})}module.exports={emptyDirSync,emptydirSync:emptyDirSync,emptyDir,emptydir:emptyDir}}});var require_file=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/ensure/file.js"(exports,module){"use strict";var u=require_universalify().fromCallback,path2=__require("path"),fs4=require_graceful_fs(),mkdir=require_mkdirs();function createFile(file,callback){function makeFile(){fs4.writeFile(file,"",err=>{if(err)return callback(err);callback()})}fs4.stat(file,(err,stats)=>{if(!err&&stats.isFile())return callback();let dir=path2.dirname(file);fs4.stat(dir,(err2,stats2)=>{if(err2)return err2.code==="ENOENT"?mkdir.mkdirs(dir,err3=>{if(err3)return callback(err3);makeFile()}):callback(err2);stats2.isDirectory()?makeFile():fs4.readdir(dir,err3=>{if(err3)return callback(err3)})})})}function createFileSync(file){let stats;try{stats=fs4.statSync(file)}catch{}if(stats&&stats.isFile())return;let dir=path2.dirname(file);try{fs4.statSync(dir).isDirectory()||fs4.readdirSync(dir)}catch(err){if(err&&err.code==="ENOENT")mkdir.mkdirsSync(dir);else throw err}fs4.writeFileSync(file,"")}module.exports={createFile:u(createFile),createFileSync}}});var require_link=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/ensure/link.js"(exports,module){"use strict";var u=require_universalify().fromCallback,path2=__require("path"),fs4=require_graceful_fs(),mkdir=require_mkdirs(),pathExists2=require_path_exists().pathExists,{areIdentical}=require_stat();function createLink(srcpath,dstpath,callback){function makeLink(srcpath2,dstpath2){fs4.link(srcpath2,dstpath2,err=>{if(err)return callback(err);callback(null)})}fs4.lstat(dstpath,(_,dstStat)=>{fs4.lstat(srcpath,(err,srcStat)=>{if(err)return err.message=err.message.replace("lstat","ensureLink"),callback(err);if(dstStat&&areIdentical(srcStat,dstStat))return callback(null);let dir=path2.dirname(dstpath);pathExists2(dir,(err2,dirExists)=>{if(err2)return callback(err2);if(dirExists)return makeLink(srcpath,dstpath);mkdir.mkdirs(dir,err3=>{if(err3)return callback(err3);makeLink(srcpath,dstpath)})})})})}function createLinkSync(srcpath,dstpath){let dstStat;try{dstStat=fs4.lstatSync(dstpath)}catch{}try{let srcStat=fs4.lstatSync(srcpath);if(dstStat&&areIdentical(srcStat,dstStat))return}catch(err){throw err.message=err.message.replace("lstat","ensureLink"),err}let dir=path2.dirname(dstpath);return fs4.existsSync(dir)||mkdir.mkdirsSync(dir),fs4.linkSync(srcpath,dstpath)}module.exports={createLink:u(createLink),createLinkSync}}});var require_symlink_paths=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports,module){"use strict";var path2=__require("path"),fs4=require_graceful_fs(),pathExists2=require_path_exists().pathExists;function symlinkPaths(srcpath,dstpath,callback){if(path2.isAbsolute(srcpath))return fs4.lstat(srcpath,err=>err?(err.message=err.message.replace("lstat","ensureSymlink"),callback(err)):callback(null,{toCwd:srcpath,toDst:srcpath}));{let dstdir=path2.dirname(dstpath),relativeToDst=path2.join(dstdir,srcpath);return pathExists2(relativeToDst,(err,exists)=>err?callback(err):exists?callback(null,{toCwd:relativeToDst,toDst:srcpath}):fs4.lstat(srcpath,err2=>err2?(err2.message=err2.message.replace("lstat","ensureSymlink"),callback(err2)):callback(null,{toCwd:srcpath,toDst:path2.relative(dstdir,srcpath)})))}}function symlinkPathsSync(srcpath,dstpath){let exists;if(path2.isAbsolute(srcpath)){if(exists=fs4.existsSync(srcpath),!exists)throw new Error("absolute srcpath does not exist");return{toCwd:srcpath,toDst:srcpath}}else{let dstdir=path2.dirname(dstpath),relativeToDst=path2.join(dstdir,srcpath);if(exists=fs4.existsSync(relativeToDst),exists)return{toCwd:relativeToDst,toDst:srcpath};if(exists=fs4.existsSync(srcpath),!exists)throw new Error("relative srcpath does not exist");return{toCwd:srcpath,toDst:path2.relative(dstdir,srcpath)}}}module.exports={symlinkPaths,symlinkPathsSync}}});var require_symlink_type=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/ensure/symlink-type.js"(exports,module){"use strict";var fs4=require_graceful_fs();function symlinkType(srcpath,type,callback){if(callback=typeof type=="function"?type:callback,type=typeof type=="function"?!1:type,type)return callback(null,type);fs4.lstat(srcpath,(err,stats)=>{if(err)return callback(null,"file");type=stats&&stats.isDirectory()?"dir":"file",callback(null,type)})}function symlinkTypeSync(srcpath,type){let stats;if(type)return type;try{stats=fs4.lstatSync(srcpath)}catch{return"file"}return stats&&stats.isDirectory()?"dir":"file"}module.exports={symlinkType,symlinkTypeSync}}});var require_symlink=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/ensure/symlink.js"(exports,module){"use strict";var u=require_universalify().fromCallback,path2=__require("path"),fs4=require_fs(),_mkdirs=require_mkdirs(),mkdirs=_mkdirs.mkdirs,mkdirsSync=_mkdirs.mkdirsSync,_symlinkPaths=require_symlink_paths(),symlinkPaths=_symlinkPaths.symlinkPaths,symlinkPathsSync=_symlinkPaths.symlinkPathsSync,_symlinkType=require_symlink_type(),symlinkType=_symlinkType.symlinkType,symlinkTypeSync=_symlinkType.symlinkTypeSync,pathExists2=require_path_exists().pathExists,{areIdentical}=require_stat();function createSymlink(srcpath,dstpath,type,callback){callback=typeof type=="function"?type:callback,type=typeof type=="function"?!1:type,fs4.lstat(dstpath,(err,stats)=>{!err&&stats.isSymbolicLink()?Promise.all([fs4.stat(srcpath),fs4.stat(dstpath)]).then(([srcStat,dstStat])=>{if(areIdentical(srcStat,dstStat))return callback(null);_createSymlink(srcpath,dstpath,type,callback)}):_createSymlink(srcpath,dstpath,type,callback)})}function _createSymlink(srcpath,dstpath,type,callback){symlinkPaths(srcpath,dstpath,(err,relative3)=>{if(err)return callback(err);srcpath=relative3.toDst,symlinkType(relative3.toCwd,type,(err2,type2)=>{if(err2)return callback(err2);let dir=path2.dirname(dstpath);pathExists2(dir,(err3,dirExists)=>{if(err3)return callback(err3);if(dirExists)return fs4.symlink(srcpath,dstpath,type2,callback);mkdirs(dir,err4=>{if(err4)return callback(err4);fs4.symlink(srcpath,dstpath,type2,callback)})})})})}function createSymlinkSync(srcpath,dstpath,type){let stats;try{stats=fs4.lstatSync(dstpath)}catch{}if(stats&&stats.isSymbolicLink()){let srcStat=fs4.statSync(srcpath),dstStat=fs4.statSync(dstpath);if(areIdentical(srcStat,dstStat))return}let relative3=symlinkPathsSync(srcpath,dstpath);srcpath=relative3.toDst,type=symlinkTypeSync(relative3.toCwd,type);let dir=path2.dirname(dstpath);return fs4.existsSync(dir)||mkdirsSync(dir),fs4.symlinkSync(srcpath,dstpath,type)}module.exports={createSymlink:u(createSymlink),createSymlinkSync}}});var require_ensure=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/ensure/index.js"(exports,module){"use strict";var file=require_file(),link=require_link(),symlink=require_symlink();module.exports={createFile:file.createFile,createFileSync:file.createFileSync,ensureFile:file.createFile,ensureFileSync:file.createFileSync,createLink:link.createLink,createLinkSync:link.createLinkSync,ensureLink:link.createLink,ensureLinkSync:link.createLinkSync,createSymlink:symlink.createSymlink,createSymlinkSync:symlink.createSymlinkSync,ensureSymlink:symlink.createSymlink,ensureSymlinkSync:symlink.createSymlinkSync}}});var require_utils2=__commonJS({"../../node_modules/.pnpm/jsonfile@6.2.1/node_modules/jsonfile/utils.js"(exports,module){function stringify(obj,{EOL=`
12
- `,finalEOL=!0,replacer=null,spaces}={}){let EOF=finalEOL?EOL:"",str=JSON.stringify(obj,replacer,spaces);if(str===void 0)throw new TypeError(`Converting ${typeof obj} value to JSON is not supported`);return str.replace(/\n/g,EOL)+EOF}function stripBom(content){return Buffer.isBuffer(content)&&(content=content.toString("utf8")),content.replace(/^\uFEFF/,"")}module.exports={stringify,stripBom}}});var require_jsonfile=__commonJS({"../../node_modules/.pnpm/jsonfile@6.2.1/node_modules/jsonfile/index.js"(exports,module){var _fs;try{_fs=require_graceful_fs()}catch{_fs=__require("fs")}var universalify=require_universalify(),{stringify,stripBom}=require_utils2();async function _readFile(file,options={}){typeof options=="string"&&(options={encoding:options});let fs4=options.fs||_fs,shouldThrow="throws"in options?options.throws:!0,data=await universalify.fromCallback(fs4.readFile)(file,options);data=stripBom(data);let obj;try{obj=JSON.parse(data,options?options.reviver:null)}catch(err){if(shouldThrow)throw err.message=`${file}: ${err.message}`,err;return null}return obj}var readFile3=universalify.fromPromise(_readFile);function readFileSync(file,options={}){typeof options=="string"&&(options={encoding:options});let fs4=options.fs||_fs,shouldThrow="throws"in options?options.throws:!0;try{let content=fs4.readFileSync(file,options);return content=stripBom(content),JSON.parse(content,options.reviver)}catch(err){if(shouldThrow)throw err.message=`${file}: ${err.message}`,err;return null}}async function _writeFile(file,obj,options={}){let fs4=options.fs||_fs,str=stringify(obj,options);await universalify.fromCallback(fs4.writeFile)(file,str,options)}var writeFile3=universalify.fromPromise(_writeFile);function writeFileSync(file,obj,options={}){let fs4=options.fs||_fs,str=stringify(obj,options);return fs4.writeFileSync(file,str,options)}module.exports={readFile:readFile3,readFileSync,writeFile:writeFile3,writeFileSync}}});var require_jsonfile2=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/json/jsonfile.js"(exports,module){"use strict";var jsonFile=require_jsonfile();module.exports={readJson:jsonFile.readFile,readJsonSync:jsonFile.readFileSync,writeJson:jsonFile.writeFile,writeJsonSync:jsonFile.writeFileSync}}});var require_output=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/output/index.js"(exports,module){"use strict";var u=require_universalify().fromCallback,fs4=require_graceful_fs(),path2=__require("path"),mkdir=require_mkdirs(),pathExists2=require_path_exists().pathExists;function outputFile(file,data,encoding,callback){typeof encoding=="function"&&(callback=encoding,encoding="utf8");let dir=path2.dirname(file);pathExists2(dir,(err,itDoes)=>{if(err)return callback(err);if(itDoes)return fs4.writeFile(file,data,encoding,callback);mkdir.mkdirs(dir,err2=>{if(err2)return callback(err2);fs4.writeFile(file,data,encoding,callback)})})}function outputFileSync(file,...args){let dir=path2.dirname(file);if(fs4.existsSync(dir))return fs4.writeFileSync(file,...args);mkdir.mkdirsSync(dir),fs4.writeFileSync(file,...args)}module.exports={outputFile:u(outputFile),outputFileSync}}});var require_output_json=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/json/output-json.js"(exports,module){"use strict";var{stringify}=require_utils2(),{outputFile}=require_output();async function outputJson(file,data,options={}){let str=stringify(data,options);await outputFile(file,str,options)}module.exports=outputJson}});var require_output_json_sync=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/json/output-json-sync.js"(exports,module){"use strict";var{stringify}=require_utils2(),{outputFileSync}=require_output();function outputJsonSync(file,data,options){let str=stringify(data,options);outputFileSync(file,str,options)}module.exports=outputJsonSync}});var require_json=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/json/index.js"(exports,module){"use strict";var u=require_universalify().fromPromise,jsonFile=require_jsonfile2();jsonFile.outputJson=u(require_output_json());jsonFile.outputJsonSync=require_output_json_sync();jsonFile.outputJSON=jsonFile.outputJson;jsonFile.outputJSONSync=jsonFile.outputJsonSync;jsonFile.writeJSON=jsonFile.writeJson;jsonFile.writeJSONSync=jsonFile.writeJsonSync;jsonFile.readJSON=jsonFile.readJson;jsonFile.readJSONSync=jsonFile.readJsonSync;module.exports=jsonFile}});var require_move_sync=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/move-sync/move-sync.js"(exports,module){"use strict";var fs4=require_graceful_fs(),path2=__require("path"),copySync=require_copy_sync2().copySync,removeSync=require_remove().removeSync,mkdirpSync=require_mkdirs().mkdirpSync,stat2=require_stat();function moveSync(src,dest,opts){opts=opts||{};let overwrite=opts.overwrite||opts.clobber||!1,{srcStat,isChangingCase=!1}=stat2.checkPathsSync(src,dest,"move",opts);return stat2.checkParentPathsSync(src,srcStat,dest,"move"),isParentRoot(dest)||mkdirpSync(path2.dirname(dest)),doRename(src,dest,overwrite,isChangingCase)}function isParentRoot(dest){let parent=path2.dirname(dest);return path2.parse(parent).root===parent}function doRename(src,dest,overwrite,isChangingCase){if(isChangingCase)return rename(src,dest,overwrite);if(overwrite)return removeSync(dest),rename(src,dest,overwrite);if(fs4.existsSync(dest))throw new Error("dest already exists.");return rename(src,dest,overwrite)}function rename(src,dest,overwrite){try{fs4.renameSync(src,dest)}catch(err){if(err.code!=="EXDEV")throw err;return moveAcrossDevice(src,dest,overwrite)}}function moveAcrossDevice(src,dest,overwrite){return copySync(src,dest,{overwrite,errorOnExist:!0}),removeSync(src)}module.exports=moveSync}});var require_move_sync2=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/move-sync/index.js"(exports,module){"use strict";module.exports={moveSync:require_move_sync()}}});var require_move=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/move/move.js"(exports,module){"use strict";var fs4=require_graceful_fs(),path2=__require("path"),copy=require_copy2().copy,remove=require_remove().remove,mkdirp=require_mkdirs().mkdirp,pathExists2=require_path_exists().pathExists,stat2=require_stat();function move(src,dest,opts,cb){typeof opts=="function"&&(cb=opts,opts={});let overwrite=opts.overwrite||opts.clobber||!1;stat2.checkPaths(src,dest,"move",opts,(err,stats)=>{if(err)return cb(err);let{srcStat,isChangingCase=!1}=stats;stat2.checkParentPaths(src,srcStat,dest,"move",err2=>{if(err2)return cb(err2);if(isParentRoot(dest))return doRename(src,dest,overwrite,isChangingCase,cb);mkdirp(path2.dirname(dest),err3=>err3?cb(err3):doRename(src,dest,overwrite,isChangingCase,cb))})})}function isParentRoot(dest){let parent=path2.dirname(dest);return path2.parse(parent).root===parent}function doRename(src,dest,overwrite,isChangingCase,cb){if(isChangingCase)return rename(src,dest,overwrite,cb);if(overwrite)return remove(dest,err=>err?cb(err):rename(src,dest,overwrite,cb));pathExists2(dest,(err,destExists)=>err?cb(err):destExists?cb(new Error("dest already exists.")):rename(src,dest,overwrite,cb))}function rename(src,dest,overwrite,cb){fs4.rename(src,dest,err=>err?err.code!=="EXDEV"?cb(err):moveAcrossDevice(src,dest,overwrite,cb):cb())}function moveAcrossDevice(src,dest,overwrite,cb){copy(src,dest,{overwrite,errorOnExist:!0},err=>err?cb(err):remove(src,cb))}module.exports=move}});var require_move2=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/move/index.js"(exports,module){"use strict";var u=require_universalify().fromCallback;module.exports={move:u(require_move())}}});var require_lib2=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/index.js"(exports,module){"use strict";module.exports={...require_fs(),...require_copy_sync2(),...require_copy2(),...require_empty(),...require_ensure(),...require_json(),...require_mkdirs(),...require_move_sync2(),...require_move2(),...require_output(),...require_path_exists(),...require_remove()}}});var require_pluralize=__commonJS({"../../node_modules/.pnpm/pluralize@7.0.0/node_modules/pluralize/pluralize.js"(exports,module){(function(root,pluralize2){typeof __require=="function"&&typeof exports=="object"&&typeof module=="object"?module.exports=pluralize2():typeof define=="function"&&define.amd?define(function(){return pluralize2()}):root.pluralize=pluralize2()})(exports,function(){var pluralRules=[],singularRules=[],uncountables={},irregularPlurals={},irregularSingles={};function sanitizeRule(rule){return typeof rule=="string"?new RegExp("^"+rule+"$","i"):rule}function restoreCase(word,token){return word===token?token:word===word.toUpperCase()?token.toUpperCase():word[0]===word[0].toUpperCase()?token.charAt(0).toUpperCase()+token.substr(1).toLowerCase():token.toLowerCase()}function interpolate(str,args){return str.replace(/\$(\d{1,2})/g,function(match,index){return args[index]||""})}function replace(word,rule){return word.replace(rule[0],function(match,index){var result=interpolate(rule[1],arguments);return restoreCase(match===""?word[index-1]:match,result)})}function sanitizeWord(token,word,rules){if(!token.length||uncountables.hasOwnProperty(token))return word;for(var len=rules.length;len--;){var rule=rules[len];if(rule[0].test(word))return replace(word,rule)}return word}function replaceWord(replaceMap,keepMap,rules){return function(word){var token=word.toLowerCase();return keepMap.hasOwnProperty(token)?restoreCase(word,token):replaceMap.hasOwnProperty(token)?restoreCase(word,replaceMap[token]):sanitizeWord(token,word,rules)}}function checkWord(replaceMap,keepMap,rules,bool){return function(word){var token=word.toLowerCase();return keepMap.hasOwnProperty(token)?!0:replaceMap.hasOwnProperty(token)?!1:sanitizeWord(token,token,rules)===token}}function pluralize2(word,count,inclusive){var pluralized=count===1?pluralize2.singular(word):pluralize2.plural(word);return(inclusive?count+" ":"")+pluralized}return pluralize2.plural=replaceWord(irregularSingles,irregularPlurals,pluralRules),pluralize2.isPlural=checkWord(irregularSingles,irregularPlurals,pluralRules),pluralize2.singular=replaceWord(irregularPlurals,irregularSingles,singularRules),pluralize2.isSingular=checkWord(irregularPlurals,irregularSingles,singularRules),pluralize2.addPluralRule=function(rule,replacement){pluralRules.push([sanitizeRule(rule),replacement])},pluralize2.addSingularRule=function(rule,replacement){singularRules.push([sanitizeRule(rule),replacement])},pluralize2.addUncountableRule=function(word){if(typeof word=="string"){uncountables[word.toLowerCase()]=!0;return}pluralize2.addPluralRule(word,"$0"),pluralize2.addSingularRule(word,"$0")},pluralize2.addIrregularRule=function(single,plural){plural=plural.toLowerCase(),single=single.toLowerCase(),irregularSingles[single]=plural,irregularPlurals[plural]=single},[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["was","were"],["has","have"],["this","these"],["that","those"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["looey","looies"],["thief","thieves"],["groove","grooves"],["pickaxe","pickaxes"],["whiskey","whiskies"]].forEach(function(rule){return pluralize2.addIrregularRule(rule[0],rule[1])}),[[/s?$/i,"s"],[/[^\u0000-\u007F]$/i,"$0"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|tlas|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[emjzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|octop|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/(m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach(function(rule){return pluralize2.addPluralRule(rule[0],rule[1])}),[[/s$/i,""],[/(ss)$/i,"$1"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/ies$/i,"y"],[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i,"$1ie"],[/\b(mon|smil)ies$/i,"$1ey"],[/(m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|tlas|gas|(?:her|at|gr)o|ris)(?:es)?$/i,"$1"],[/(analy|ba|diagno|parenthe|progno|synop|the|empha|cri)(?:sis|ses)$/i,"$1sis"],[/(movie|twelve|abuse|e[mn]u)s$/i,"$1"],[/(test)(?:is|es)$/i,"$1is"],[/(alumn|syllab|octop|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach(function(rule){return pluralize2.addSingularRule(rule[0],rule[1])}),["adulthood","advice","agenda","aid","alcohol","ammo","anime","athletics","audio","bison","blood","bream","buffalo","butter","carp","cash","chassis","chess","clothing","cod","commerce","cooperation","corps","debris","diabetes","digestion","elk","energy","equipment","excretion","expertise","flounder","fun","gallows","garbage","graffiti","headquarters","health","herpes","highjinks","homework","housework","information","jeans","justice","kudos","labour","literature","machinery","mackerel","mail","media","mews","moose","music","manga","news","pike","plankton","pliers","pollution","premises","rain","research","rice","salmon","scissors","series","sewage","shambles","shrimp","species","staff","swine","tennis","traffic","transporation","trout","tuna","wealth","welfare","whiting","wildebeest","wildlife","you",/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(pluralize2.addUncountableRule),pluralize2})}});var require_ini=__commonJS({"../../node_modules/.pnpm/ini@3.0.0/node_modules/ini/lib/ini.js"(exports,module){var{hasOwnProperty}=Object.prototype,eol=typeof process<"u"&&process.platform==="win32"?`\r
13
- `:`
14
- `,encode=(obj,opt)=>{let children=[],out="";typeof opt=="string"?opt={section:opt,whitespace:!1}:(opt=opt||Object.create(null),opt.whitespace=opt.whitespace===!0);let separator=opt.whitespace?" = ":"=";for(let k of Object.keys(obj)){let val=obj[k];if(val&&Array.isArray(val))for(let item of val)out+=safe(k+"[]")+separator+safe(item)+eol;else val&&typeof val=="object"?children.push(k):out+=safe(k)+separator+safe(val)+eol}opt.section&&out.length&&(out="["+safe(opt.section)+"]"+eol+out);for(let k of children){let nk=dotSplit(k).join("\\."),section=(opt.section?opt.section+".":"")+nk,{whitespace}=opt,child=encode(obj[k],{section,whitespace});out.length&&child.length&&(out+=eol),out+=child}return out},dotSplit=str=>str.replace(/\1/g,"LITERAL\\1LITERAL").replace(/\\\./g,"").split(/\./).map(part=>part.replace(/\1/g,"\\.").replace(/\2LITERAL\\1LITERAL\2/g,"")),decode=str=>{let out=Object.create(null),p=out,section=null,re=/^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i,lines=str.split(/[\r\n]+/g);for(let line of lines){if(!line||line.match(/^\s*[;#]/))continue;let match=line.match(re);if(!match)continue;if(match[1]!==void 0){if(section=unsafe(match[1]),section==="__proto__"){p=Object.create(null);continue}p=out[section]=out[section]||Object.create(null);continue}let keyRaw=unsafe(match[2]),isArray=keyRaw.length>2&&keyRaw.slice(-2)==="[]",key=isArray?keyRaw.slice(0,-2):keyRaw;if(key==="__proto__")continue;let valueRaw=match[3]?unsafe(match[4]):!0,value=valueRaw==="true"||valueRaw==="false"||valueRaw==="null"?JSON.parse(valueRaw):valueRaw;isArray&&(hasOwnProperty.call(p,key)?Array.isArray(p[key])||(p[key]=[p[key]]):p[key]=[]),Array.isArray(p[key])?p[key].push(value):p[key]=value}let remove=[];for(let k of Object.keys(out)){if(!hasOwnProperty.call(out,k)||typeof out[k]!="object"||Array.isArray(out[k]))continue;let parts=dotSplit(k);p=out;let l=parts.pop(),nl=l.replace(/\\\./g,".");for(let part of parts)part!=="__proto__"&&((!hasOwnProperty.call(p,part)||typeof p[part]!="object")&&(p[part]=Object.create(null)),p=p[part]);p===out&&nl===l||(p[nl]=out[k],remove.push(k))}for(let del of remove)delete out[del];return out},isQuoted=val=>val.startsWith('"')&&val.endsWith('"')||val.startsWith("'")&&val.endsWith("'"),safe=val=>typeof val!="string"||val.match(/[=\r\n]/)||val.match(/^\[/)||val.length>1&&isQuoted(val)||val!==val.trim()?JSON.stringify(val):val.split(";").join("\\;").split("#").join("\\#"),unsafe=(val,doUnesc)=>{if(val=(val||"").trim(),isQuoted(val)){val.charAt(0)==="'"&&(val=val.slice(1,-1));try{val=JSON.parse(val)}catch{}}else{let esc=!1,unesc="";for(let i=0,l=val.length;i<l;i++){let c=val.charAt(i);if(esc)"\\;#".indexOf(c)!==-1?unesc+=c:unesc+="\\"+c,esc=!1;else{if(";#".indexOf(c)!==-1)break;c==="\\"?esc=!0:unesc+=c}}return esc&&(unesc+="\\"),unesc.trim()}return val};module.exports={parse:decode,decode,stringify:encode,encode,safe,unsafe}}});var require_retry_operation=__commonJS({"../../node_modules/.pnpm/retry@0.10.1/node_modules/retry/lib/retry_operation.js"(exports,module){function RetryOperation(timeouts,options){typeof options=="boolean"&&(options={forever:options}),this._timeouts=timeouts,this._options=options||{},this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}module.exports=RetryOperation;RetryOperation.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};RetryOperation.prototype.retry=function(err){if(this._timeout&&clearTimeout(this._timeout),!err)return!1;this._errors.push(err);var timeout=this._timeouts.shift();if(timeout===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),timeout=this._timeouts.shift();else return!1;var self=this,timer=setTimeout(function(){self._attempts++,self._operationTimeoutCb&&(self._timeout=setTimeout(function(){self._operationTimeoutCb(self._attempts)},self._operationTimeout),this._options.unref&&self._timeout.unref()),self._fn(self._attempts)},timeout);return this._options.unref&&timer.unref(),!0};RetryOperation.prototype.attempt=function(fn,timeoutOps){this._fn=fn,timeoutOps&&(timeoutOps.timeout&&(this._operationTimeout=timeoutOps.timeout),timeoutOps.cb&&(this._operationTimeoutCb=timeoutOps.cb));var self=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){self._operationTimeoutCb()},self._operationTimeout)),this._fn(this._attempts)};RetryOperation.prototype.try=function(fn){console.log("Using RetryOperation.try() is deprecated"),this.attempt(fn)};RetryOperation.prototype.start=function(fn){console.log("Using RetryOperation.start() is deprecated"),this.attempt(fn)};RetryOperation.prototype.start=RetryOperation.prototype.try;RetryOperation.prototype.errors=function(){return this._errors};RetryOperation.prototype.attempts=function(){return this._attempts};RetryOperation.prototype.mainError=function(){if(this._errors.length===0)return null;for(var counts={},mainError=null,mainErrorCount=0,i=0;i<this._errors.length;i++){var error=this._errors[i],message=error.message,count=(counts[message]||0)+1;counts[message]=count,count>=mainErrorCount&&(mainError=error,mainErrorCount=count)}return mainError}}});var require_retry=__commonJS({"../../node_modules/.pnpm/retry@0.10.1/node_modules/retry/lib/retry.js"(exports){var RetryOperation=require_retry_operation();exports.operation=function(options){var timeouts=exports.timeouts(options);return new RetryOperation(timeouts,{forever:options&&options.forever,unref:options&&options.unref})};exports.timeouts=function(options){if(options instanceof Array)return[].concat(options);var opts={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var key in options)opts[key]=options[key];if(opts.minTimeout>opts.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var timeouts=[],i=0;i<opts.retries;i++)timeouts.push(this.createTimeout(i,opts));return options&&options.forever&&!timeouts.length&&timeouts.push(this.createTimeout(i,opts)),timeouts.sort(function(a,b){return a-b}),timeouts};exports.createTimeout=function(attempt,opts){var random=opts.randomize?Math.random()+1:1,timeout=Math.round(random*opts.minTimeout*Math.pow(opts.factor,attempt));return timeout=Math.min(timeout,opts.maxTimeout),timeout};exports.wrap=function(obj,options,methods){if(options instanceof Array&&(methods=options,options=null),!methods){methods=[];for(var key in obj)typeof obj[key]=="function"&&methods.push(key)}for(var i=0;i<methods.length;i++){var method=methods[i],original=obj[method];obj[method]=function(){var op=exports.operation(options),args=Array.prototype.slice.call(arguments),callback=args.pop();args.push(function(err){op.retry(err)||(err&&(arguments[0]=op.mainError()),callback.apply(this,arguments))}),op.attempt(function(){original.apply(obj,args)})},obj[method].options=options}}}});var require_retry2=__commonJS({"../../node_modules/.pnpm/retry@0.10.1/node_modules/retry/index.js"(exports,module){module.exports=require_retry()}});var require_dist2=__commonJS({"../../node_modules/.pnpm/async-retry@1.1.3/node_modules/async-retry/dist/index.js"(exports,module){"use strict";var retrier=require_retry2();module.exports=function(fn,opts){return opts=opts||{},new Promise(function(resolve6,reject){var op=retrier.operation(opts),bail=function(err){return reject(err||new Error("Aborted"))},onError=function(err){if(err.bail)return bail(err);op.retry(err)?opts.onRetry&&opts.onRetry(err):reject(op.mainError())};op.attempt(function(num){var val=void 0;try{val=fn(bail,num)}catch(err){return onError(err)}Promise.resolve(val).then(resolve6,onError)})})}}});var require_types=__commonJS({"../client/dist/types.js"(exports,module){"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),types_exports={};__export(types_exports,{VALID_ARCHIVE_FORMATS:()=>VALID_ARCHIVE_FORMATS,fileNameSymbol:()=>fileNameSymbol2});module.exports=__toCommonJS(types_exports);var VALID_ARCHIVE_FORMATS=["tgz"],fileNameSymbol2=Symbol("fileName")}});import{homedir}from"os";import{resolve}from"path";function humanizePath(path2){let resolved=resolve(path2),_homedir=homedir();return resolved.indexOf(_homedir)===0?`~${resolved.slice(_homedir.length)}`:resolved}var import_chalk=__toESM(require_source(),1);function highlight(text){return import_chalk.default.bold.underline(text)}import os from"os";var ua_default=`${pkg_default.name} ${pkg_default.version} node-${process.version} ${os.platform()} (${os.arch()})`;async function getProjectByNameOrId(client,projectNameOrId,accountId,includeRollbackInfo){try{let qs=includeRollbackInfo?"?rollbackInfo=true":"";return await client.fetch(`/v9/projects/${encodeURIComponent(projectNameOrId)}${qs}`,{accountId})}catch(err){if(isAPIError(err)&&err.status===404)return new ProjectNotFound(projectNameOrId);throw err}}import fs from"node:fs";function isDirectory(targetPath){try{return fs.lstatSync(targetPath).isDirectory()}catch{return!1}}var import_which=__toESM(require_lib(),1);import{accessSync,constants}from"node:fs";import{platform}from"node:os";import{delimiter,isAbsolute,resolve as resolve2}from"node:path";import{execFile}from"node:child_process";function execFileAsync(file,args,options={}){return new Promise((resolve6,reject)=>{execFile(file,args,{...options,encoding:"utf8"},(error,stdout,stderr)=>{error?reject(Object.assign(error,{stdout,stderr})):resolve6({stdout,stderr})})})}var executables=new Map;function getGitExecutable(cwd){if(platform()!=="darwin")return Promise.resolve("git");let searchPath=(process.env.PATH??"/usr/bin:/bin").split(delimiter).map(directory=>resolve2(cwd,directory)).join(delimiter),key=JSON.stringify([searchPath,cwd,process.env.DEVELOPER_DIR,process.env.SDKROOT,process.env.TOOLCHAINS]),executable=executables.get(key);return executable||(executable=resolveExecutable(searchPath,cwd),executables.set(key,executable)),executable}async function resolveExecutable(searchPath,cwd){try{if(import_which.default.sync("git",{path:searchPath,nothrow:!0})!=="/usr/bin/git")return"git";let{stdout}=await execFileAsync("/usr/bin/xcrun",["--find","git"],{cwd}),executable=stdout.trim();if(isAbsolute(executable)&&executable!=="/usr/bin/git")return accessSync(executable,constants.X_OK),executable}catch{}return"git"}import{execFileSync}from"node:child_process";import{join,resolve as resolve3}from"node:path";var DEFAULT_GIT_EXEC_OPTS={unsafe:!1};function getGitRootDirectory(opts){let{cwd,unsafe}={...DEFAULT_GIT_EXEC_OPTS,...opts};try{return execFileSync("git",["rev-parse","--show-toplevel"],{cwd,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch(error){if(unsafe)throw error;return null}}function getGitCommonDirectory(opts){let{cwd,unsafe}={...DEFAULT_GIT_EXEC_OPTS,...opts};try{return execFileSync("git",["rev-parse","--git-common-dir"],{cwd,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch(error){if(unsafe)throw error;return null}}function getGitConfigPath(opts){let{cwd}={...DEFAULT_GIT_EXEC_OPTS,...opts},gitCommonDir=getGitCommonDirectory(opts);if(gitCommonDir===null)return null;let absoluteGitCommonDir=resolve3(cwd,gitCommonDir);return join(absoluteGitCommonDir,"config")}var import_fs_extra=__toESM(require_lib2(),1),import_ini=__toESM(require_ini(),1),import_error_utils=__toESM(require_dist(),1);import{join as join2,relative,resolve as resolve4}from"path";import{execFile as execFile2}from"child_process";async function createGitMeta(directory,project){let git=await getGitExecutable(directory),metadata=Promise.allSettled([getLastCommit(directory,git),isDirty(directory)]),gitRoot,branch;try{let{stdout,stderr}=await execFileAsync(git,["rev-parse","--show-toplevel","--abbrev-ref","HEAD"],{cwd:directory});if(stderr.trim())throw new Error(stderr);let lines=stdout.trim().split(/\r?\n/);branch=lines.pop(),gitRoot=lines.join(`
15
- `)}catch(error){await metadata,output_manager_default.debug(`Failed to get last commit. The directory is likely not a Git repo, there are no latest commits, or it is corrupted.
16
- ${(0,import_error_utils.errorToString)(error)}`);return}let gitConfigPath=join2(gitRoot||directory,".git/config"),remoteUrl;if(project?.link){let{repo}=project.link,remoteUrls=await getRemoteUrls(gitConfigPath);if(remoteUrls)for(let urlValue of Object.values(remoteUrls))urlValue.includes(repo)&&(remoteUrl=urlValue)}remoteUrl||(remoteUrl=await getOriginUrl(gitConfigPath));let[commitResult,dirtyResult]=await metadata;if(commitResult.status==="rejected"){output_manager_default.debug(`Failed to get last commit. The directory is likely not a Git repo, there are no latest commits, or it is corrupted.
17
- ${commitResult.reason}`);return}if(dirtyResult.status==="rejected"){output_manager_default.debug(`Failed to determine if Git repo has been modified:
18
- ${dirtyResult.reason}`);return}let dirty=dirtyResult.value,commit=commitResult.value;return{remoteUrl:remoteUrl||void 0,commitAuthorName:commit.author.name,commitAuthorEmail:commit.author.email,commitMessage:commit.subject,commitRef:branch,commitSha:commit.hash,dirty,rootDirectory:getRootDirectory(directory,gitRoot)}}function getRootDirectory(directory,gitRoot=getGitRootDirectory({cwd:directory})){if(!gitRoot)return;let rootDirectory=relative(gitRoot,resolve4(directory)).replace(/\\/g,"/");if(!(rootDirectory===".."||rootDirectory.startsWith("../")))return rootDirectory==="."?"":rootDirectory}async function getLastCommit(directory,git){let commit=await execFileAsync(git,["log","-1","--format=%H%x00%s%x00%an%x00%ae"],{cwd:directory});if(commit.stderr)throw new Error(commit.stderr);let[hash,subject,name,email]=commit.stdout.replace(/\r?\n$/,"").split("\0");return{hash,subject,author:{name,email}}}async function isDirty(directory){let git=await getGitExecutable(directory);return new Promise((resolve6,reject)=>{execFile2(git,["--no-optional-locks","status","-s"],{cwd:directory},function(err,stdout,stderr){if(err)return reject(err);if(stderr!==void 0&&stderr.trim().length>0)return reject(new Error(stderr));resolve6(stdout.trim().length>0)})})}async function parseGitConfig(configPath){try{return import_ini.default.parse(await import_fs_extra.default.readFile(configPath,"utf-8"))}catch(err){output_manager_default.debug(`Error while parsing repo data: ${(0,import_error_utils.errorToString)(err)}`)}}function pluckRemoteUrls(gitConfig){let remoteUrls={};for(let key of Object.keys(gitConfig))if(key.includes("remote")){let remoteName=key.match(/(?<=").*(?=")/g)?.[0],remoteUrl=gitConfig[key]?.url;remoteName&&remoteUrl&&(remoteUrls[remoteName]=remoteUrl)}if(Object.keys(remoteUrls).length!==0)return remoteUrls}async function getRemoteUrls(configPath){let config2=await parseGitConfig(configPath);return config2?pluckRemoteUrls(config2):void 0}function pluckOriginUrl(gitConfig){return gitConfig['remote "origin"']?.url}async function getOriginUrl(configPath){let gitConfig=await parseGitConfig(configPath);if(!gitConfig)return null;let originUrl=pluckOriginUrl(gitConfig);return originUrl||null}var import_fs_extra5=__toESM(require_lib2(),1);import os2 from"os";import{join as join8}from"path";var import_fs_extra4=__toESM(require_lib2(),1);import fs3 from"fs";import{join as join7,relative as relative2}from"path";import{promisify}from"util";var import_chalk3=__toESM(require_source(),1),import_cli_config=__toESM(require_cli_config(),1),import_async_retry=__toESM(require_dist2(),1);import{AsyncLocalStorage}from"node:async_hooks";import{join as join4,resolve as resolve5}from"node:path";import{EventEmitter}from"events";import{URL as URL2}from"url";async function responseError(res,fallbackMessage=null,parsedBody={}){let bodyError;if(!res.ok){let body;try{body=await res.json()}catch{body=parsedBody}bodyError=body.error||body.err||body}let msg=bodyError?.message||fallbackMessage||"Response Error";return new APIError(msg,res,bodyError)}var import_chalk2=__toESM(require_source(),1);function printIndications(res){let indications=new Set(["warning","notice","tip"]),regex=/^x-(?:vercel|now)-(warning|notice|tip)-(.*)$/;for(let[name,payload]of res.headers){let match=name.match(regex);if(match){let[,type,identifier]=match,action=res.headers.get(`x-vercel-action-${identifier}`),link=res.headers.get(`x-vercel-link-${identifier}`);if(indications.has(type)){let newline=`
19
- `,message=prependEmoji(import_chalk2.default.dim(payload),emoji(type))+newline,finalLink="";link&&(finalLink=import_chalk2.default.dim(`${action||"Learn More"}: ${link_default(link)}`)+newline),output_manager_default.print(message+finalLink)}}}}var import_load_json_file=__toESM(require_load_json_file(),1),config=__toESM(require_cli_config(),1),import_error_utils2=__toESM(require_dist(),1),import_types=__toESM(require_types(),1);import{join as join3,basename,dirname}from"path";import{accessSync as accessSync2,constants as constants2}from"fs";import{persistCliAuthConfig,readCliAuthConfig}from"@vercel/cli-auth/credentials-store.js";import path from"path";import{existsSync}from"fs";function localConfigFlagPath(){let customPath=parseArguments(process.argv.slice(2),{},{permissive:!0}).flags["--local-config"];if(customPath){if(typeof customPath!="string")throw new InvalidLocalConfig(customPath);return path.resolve(process.cwd(),customPath)}}function getLocalPathConfig(prefix,useCompiledConfig=!0){let customPath=localConfigFlagPath();if(customPath)return customPath;let vercelConfigPath=path.join(prefix,"vercel.json"),vercelTomlPath=path.join(prefix,"vercel.toml"),nowConfigPath=path.join(prefix,"now.json"),vercelConfigExists=existsSync(vercelConfigPath),vercelTomlExists=existsSync(vercelTomlPath),nowConfigExists=existsSync(nowConfigPath),foundConfigs=[];if(vercelConfigExists&&foundConfigs.push(vercelConfigPath),vercelTomlExists&&foundConfigs.push(vercelTomlPath),nowConfigExists)throw new DeprecatedNowJson(nowConfigPath);if(foundConfigs.length>1)throw new ConflictingConfigFiles(foundConfigs);let compiledConfigPath=path.join(prefix,VERCEL_DIR,"vercel.json"),compiledConfigExists=existsSync(compiledConfigPath);return useCompiledConfig&&compiledConfigExists?compiledConfigPath:vercelConfigPath}var VERCEL_CONFIG_EXTENSIONS=["ts","mts","js","mjs","cjs"],DEFAULT_VERCEL_CONFIG_FILENAME="Vercel config";var globalDir,getVercelDir=()=>globalDir??=getGlobalPathConfig(),readConfigFile=()=>config.readGlobalConfigFile(getConfigFilePath2()),writeToConfigFile=stuff=>{try{config.writeGlobalConfigFile(getConfigFilePath2(),stuff)}catch(err){throw(0,import_error_utils2.isErrnoException)(err)&&((0,import_error_utils2.isErrnoException)(err)&&err.code==="EPERM"?(output_manager_default.error(`Not able to create ${highlight(getConfigFilePath2())} (operation not permitted).`),process.exit(1)):err.code==="EBADF"&&(output_manager_default.error(`Not able to create ${highlight(getConfigFilePath2())} (bad file descriptor).`),process.exit(1))),err}},readAuthConfigFile=_globalConfig=>({...config.getDefaultAuthConfig(),...readCliAuthConfig(getVercelDir())}),persistAuthConfig=(authConfig,_globalConfig)=>{try{return persistCliAuthConfig(getVercelDir(),authConfig)}catch(err){let wrappedError=new Error(`Not able to create ${humanizePath(getAuthConfigFilePath2())} (${(0,import_error_utils2.errorToStringFriendly)(err)}).`);throw wrappedError.cause=err,wrappedError}};function getConfigFilePath2(){return config.getConfigFilePath(getVercelDir())}function getAuthConfigFilePath2(){return config.getAuthConfigFilePath(getVercelDir())}function readLocalConfig(prefix=process.cwd()){let config2,target="";try{target=getLocalPathConfig(prefix)}catch(err){if(err instanceof NowError)output_manager_default.error(err.message),process.exit(1);else throw err}if(!target)return;try{accessSync2(target,constants2.F_OK),config2=import_load_json_file.default.sync(target)}catch(err){if(!((0,import_error_utils2.isErrnoException)(err)&&err.code==="ENOENT"))if((0,import_error_utils2.isError)(err)&&err.name==="JSONError")output_manager_default.error(err.message),process.exit(1);else if((0,import_error_utils2.isErrnoException)(err)){let code2=err.code?` (${err.code})`:"";output_manager_default.error(`Failed to read config file: ${target}${code2}`),process.exit(1)}else output_manager_default.prettyError(err),process.exit(1)}if(!config2)return;if(basename(target)==="vercel.json"&&basename(dirname(target))===VERCEL_DIR){let workPath=dirname(dirname(target)),sourceFile=null;for(let ext of VERCEL_CONFIG_EXTENSIONS){let configPath=join3(workPath,`vercel.${ext}`);try{accessSync2(configPath,constants2.F_OK),sourceFile=basename(configPath);break}catch{}}if(!sourceFile){let tomlPath=join3(workPath,"vercel.toml");try{accessSync2(tomlPath,constants2.F_OK),sourceFile="vercel.toml"}catch{}}config2[import_types.fileNameSymbol]=sourceFile||DEFAULT_VERCEL_CONFIG_FILENAME}else config2[import_types.fileNameSymbol]=basename(target);return config2}function createTraceContext(span){return{span,budget:{remaining:1e3,dropped:0}}}function startTrace(parent,name,attrs){if(parent){if(parent.budget.remaining<=0){parent.budget.dropped++;return}return parent.budget.remaining--,{span:parent.span.child(name,attrs),budget:parent.budget}}}function stopTrace(trace,droppedBefore){if(!trace)return;let dropped=trace.budget.dropped-droppedBefore;dropped&&trace.span.setAttributes({dropped_spans:String(dropped)}),trace.span.stop()}async function traceOperation(parent,name,operation,attrs){let droppedBefore=parent?.budget.dropped??0,trace=startTrace(parent,name,attrs);try{return await operation(trace)}catch(error){throw trace?.span.setAttributes({error:"true"}),error}finally{stopTrace(trace,droppedBefore)}}var ROUTES=[["files","/v*/files"],["(?:now/)?deployments/[^/]+/events","/v*/deployments/:deployment/events"],["env/pull/[^/]+","/v*/env/pull/:deployment"],["deployments/[^/]+/builds/function-descriptors","/v*/deployments/:deployment/builds/function-descriptors"],["user","/v*/user"],["teams","/v*/teams"],["teams/[^/]+","/v*/teams/:team"],["projects","/v*/projects"],["projects/[^/]+","/v*/projects/:project"],["projects/[^/]+/env","/v*/projects/:project/env"],["projects/[^/]+/logs","/v*/projects/:project/logs"],["deployments","/v*/deployments"],["deployments/[^/]+","/v*/deployments/:deployment"],["deployments/[^/]+/builds","/v*/deployments/:deployment/builds"]].map(([pattern,route])=>({pattern:new RegExp(`^/v[0-9]+/${pattern}/?$`),route}));function requestTraceAttributes(url,method="GET"){let path2=String(url).split(/[?#]/,1)[0].replace(/^https?:\/\/[^/]+/i,""),normalizedMethod=method.toUpperCase();return{http_method:["GET","HEAD","POST","PUT","PATCH","DELETE","OPTIONS"].includes(normalizedMethod)?normalizedMethod:"OTHER",http_route:ROUTES.find(route=>route.pattern.test(path2))?.route??"other"}}function traceResponseBody(response,request,budget={remaining:1e3,dropped:0}){if(!request)return;for(let method of["json","text","arrayBuffer","blob","formData"]){let original=response[method];if(typeof original!="function")continue;let read=original.bind(response);Object.defineProperty(response,method,{configurable:!0,writable:!0,value:async()=>{let span=startTrace({span:request,budget},"vc.cli.api.body")?.span;try{return await read()}catch(error){throw span?.setAttributes({error:"true"}),error}finally{span?.stop()}}})}let clone=response.clone.bind(response);Object.defineProperty(response,"clone",{configurable:!0,writable:!0,value:()=>{let copy=clone();return traceResponseBody(copy,request,budget),copy}})}function sharedPromise(fn){let promise=null;return function(...args){return promise||(promise=fn.apply(this,args),promise.finally(()=>{promise=null})),promise}}var import_error_utils3=__toESM(require_dist(),1);function sleep(ms){return new Promise(resolve6=>{setTimeout(resolve6,ms)})}import{hostname}from"os";var VERCEL_ISSUER=new URL("https://vercel.com"),VERCEL_CLI_CLIENT_ID="cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp",userAgent=`${hostname()} @ ${ua_default}`,_as;async function as(){if(!_as){let discoveryResponse=await discoveryEndpointRequest(VERCEL_ISSUER),[discoveryResponseError,as2]=await processDiscoveryEndpointResponse(discoveryResponse);if(discoveryResponseError)throw discoveryResponseError;_as=as2}return _as}async function discoveryEndpointRequest(issuer){return await fetch(new URL(".well-known/openid-configuration",issuer),{headers:{"Content-Type":"application/json","user-agent":userAgent}})}async function processDiscoveryEndpointResponse(response){let json=await response.json();if(!response.ok)return[new Error("Discovery endpoint request failed")];if(typeof json!="object"||json===null||!canParseURL(json.issuer)||!canParseURL(json.device_authorization_endpoint)||!canParseURL(json.token_endpoint)||!canParseURL(json.revocation_endpoint)||!canParseURL(json.jwks_uri)||!canParseURL(json.introspection_endpoint))return[new TypeError("Invalid discovery response")];let issuer=new URL(json.issuer);return issuer.href!==VERCEL_ISSUER.href?[new Error("Issuer mismatch")]:[null,{issuer,device_authorization_endpoint:new URL(json.device_authorization_endpoint),token_endpoint:new URL(json.token_endpoint),revocation_endpoint:new URL(json.revocation_endpoint),jwks_uri:new URL(json.jwks_uri),introspection_endpoint:new URL(json.introspection_endpoint)}]}async function deviceAuthorizationRequest(options){let body=new URLSearchParams({client_id:VERCEL_CLI_CLIENT_ID});return options?.refresh_token?(body.set("refresh_token",options.refresh_token),options.acr_values&&body.set("acr_values",options.acr_values)):body.set("scope","openid offline_access"),await fetch((await as()).device_authorization_endpoint,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","user-agent":userAgent},body})}async function processDeviceAuthorizationResponse(response){let json=await response.json();return response.ok?typeof json!="object"||json===null?[new TypeError("Expected response to be an object")]:!("device_code"in json)||typeof json.device_code!="string"?[new TypeError("Expected `device_code` to be a string")]:!("user_code"in json)||typeof json.user_code!="string"?[new TypeError("Expected `user_code` to be a string")]:!("verification_uri"in json)||typeof json.verification_uri!="string"||!canParseURL(json.verification_uri)?[new TypeError("Expected `verification_uri` to be a string")]:!("verification_uri_complete"in json)||typeof json.verification_uri_complete!="string"||!canParseURL(json.verification_uri_complete)?[new TypeError("Expected `verification_uri_complete` to be a string")]:!("expires_in"in json)||typeof json.expires_in!="number"?[new TypeError("Expected `expires_in` to be a number")]:!("interval"in json)||typeof json.interval!="number"?[new TypeError("Expected `interval` to be a number")]:[null,{device_code:json.device_code,user_code:json.user_code,verification_uri:json.verification_uri,verification_uri_complete:json.verification_uri_complete,expiresAt:Date.now()+json.expires_in*1e3,interval:json.interval}]:[new OAuthError("Device authorization request failed",json)]}async function deviceAccessTokenRequest(options){try{return[null,await fetch((await as()).token_endpoint,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","user-agent":userAgent},body:new URLSearchParams({client_id:VERCEL_CLI_CLIENT_ID,grant_type:"urn:ietf:params:oauth:grant-type:device_code",...options}),signal:AbortSignal.timeout(10*1e3)})]}catch(error){return error instanceof Error?[error]:[new Error("An unknown error occurred. See the logs for details.",{cause:error})]}}async function processTokenResponse(response){let json=await response.json();return response.ok?typeof json!="object"||json===null?[new TypeError("Expected response to be an object")]:!("access_token"in json)||typeof json.access_token!="string"?[new TypeError("Expected `access_token` to be a string")]:!("token_type"in json)||json.token_type!=="Bearer"?[new TypeError('Expected `token_type` to be "Bearer"')]:!("expires_in"in json)||typeof json.expires_in!="number"?[new TypeError("Expected `expires_in` to be a number")]:"refresh_token"in json&&(typeof json.refresh_token!="string"||!json.refresh_token)?[new TypeError("Expected `refresh_token` to be a string")]:"scope"in json&&typeof json.scope!="string"?[new TypeError("Expected `scope` to be a string")]:[null,json]:[new OAuthError("Device access token request failed",json)]}async function revocationRequest(options){return await fetch((await as()).revocation_endpoint,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","user-agent":userAgent},body:new URLSearchParams({...options,client_id:VERCEL_CLI_CLIENT_ID})})}async function processRevocationResponse(response){if(response.ok)return[null,null];let json=await response.json();return[new OAuthError("Revocation request failed",json)]}async function refreshTokenRequest(options){return await fetch((await as()).token_endpoint,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","user-agent":userAgent},body:new URLSearchParams({client_id:VERCEL_CLI_CLIENT_ID,grant_type:"refresh_token",...options})})}function processOAuthErrorResponse(json){return typeof json!="object"||json===null?new TypeError("Expected response to be an object"):!("error"in json)||typeof json.error!="string"?new TypeError("Expected `error` to be a string"):"error_description"in json&&typeof json.error_description!="string"?new TypeError("Expected `error_description` to be a string"):"error_uri"in json&&typeof json.error_uri!="string"?new TypeError("Expected `error_uri` to be a string"):json}var OAuthError=class extends Error{constructor(message,response){var __super=(...args)=>{super(...args)};let error=processOAuthErrorResponse(response);if(error instanceof TypeError){let message2=`Unexpected server response: ${JSON.stringify(response)}`;__super(message2),this.cause=new Error(message2,{cause:error}),this.code="server_error";return}let cause=error.error;error.error_description&&(cause+=`: ${error.error_description}`),error.error_uri&&(cause+=` (${error.error_uri})`),__super(message,{cause}),this.cause=new Error(cause),this.code=error.error}};function isOAuthError(error){return error instanceof OAuthError}function canParseURL(url){try{return!!new URL(url)}catch{return!1}}async function inspectTokenRequest(token){return fetch((await as()).introspection_endpoint,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","user-agent":userAgent},body:new URLSearchParams({token})})}async function processInspectTokenResponse(response){try{let token=await response.json();if(!token||typeof token!="object"||!("active"in token))throw new IntrospectionError("Invalid token introspection response");return[null,token]}catch(cause){return[new IntrospectionError("Could not introspect token.",{cause})]}}var IntrospectionError=class extends Error{constructor(){super(...arguments);this.name="IntrospectionError"}};var PromptCanceledError=class extends Error{constructor(){super("Prompt canceled"),this.name="PromptCanceledError"}},PromptBackError=class extends Error{constructor(){super("Prompt back"),this.name="PromptBackError"}};function isPromptBackError(error){return error instanceof PromptBackError}function isPromptCanceledError(error){return error instanceof PromptCanceledError?!0:error instanceof Error&&error.message.includes("User force closed the prompt")}var TEAM_NOT_CHOSEN="",DOMAINS_API_PATH=/^\/v\d+\/(?:domains|registrar)(?:\/|$)/,MAX_TRACED_REQUESTS=200,isSAMLError=v=>v&&v.saml,isJSONObject=v=>v&&typeof v=="object"&&v.constructor===Object;function isValidAccessToken(authConfig){if(!authConfig.token)return!1;if(typeof authConfig.expiresAt!="number")return!0;let nowInSeconds=Math.floor(Date.now()/1e3);return authConfig.expiresAt>=nowInSeconds}function hasRefreshToken(authConfig){return"refreshToken"in authConfig}var Client=class extends EventEmitter{constructor(opts){super();this._argv=[];this.traceStorage=new AsyncLocalStorage;this.tracedRequests=0;this._loggedTokenSource=!1;this.escapePromptCancellationDepth=0;this.promptBackNavigationDepth=0;this.reauthenticate=sharedPromise(async function(error){let{default:reauthenticate}=await import("./reauthenticate-TVQDXIFS.js");if(typeof await reauthenticate(this,error)=="number")throw error instanceof APIError?output_manager_default.prettyError(error):output_manager_default.error(`Failed to re-authenticate for ${(0,import_chalk3.bold)(error.scope)} scope`),error});this._onRetry=error=>{output_manager_default.debug(`Retrying: ${error}
20
- ${error.stack}`)};this.setArgv(opts.argv),this.apiUrl=opts.apiUrl,this.authConfig=opts.authConfig,this.stdin=opts.stdin,this.stdout=opts.stdout,this.stderr=opts.stderr,this.config=opts.config,this.savedTeam=opts.config.currentTeam,this.localConfig=opts.localConfig,this.localConfigPath=opts.localConfigPath,this.requestIdCounter=1,this.telemetryEventStore=opts.telemetryEventStore,this.isAgent=opts.isAgent??!1,this.agentName=opts.agentName,this.nonInteractive=opts.nonInteractive??this.isAgent,this.ignoresSavedTeam=this.isAgent&&this.nonInteractive,this.dangerouslySkipPermissions=opts.dangerouslySkipPermissions??!1;let theme={prefix:(0,import_chalk3.gray)("?"),style:{answer:import_chalk3.gray}};this.input={text:async opts2=>{let{default:input}=await import("./esm-IF453UWS.js");return this.runPrompt(input({theme,...opts2},{input:this.stdin,output:this.stderr}))},password:async opts2=>{let{default:password}=await import("./esm-LABWDJ72.js");return this.runPrompt(password({theme,...opts2},{input:this.stdin,output:this.stderr}))},checkbox:async opts2=>{let{default:checkbox}=await import("./esm-BYG5BWYH.js");return this.runPrompt(checkbox({theme,...opts2},{input:this.stdin,output:this.stderr}))},expand:async opts2=>{let{default:expand}=await import("./esm-TG37FXTU.js");return this.runPrompt(expand({theme,...opts2},{input:this.stdin,output:this.stderr}))},confirm:async(message,default_value,opts2)=>{let{default:confirm}=await import("./esm-33752ISR.js"),prompt=confirm({theme,message,default:default_value},{input:this.stdin,output:this.stderr}),signal=opts2?.signal,cancel=()=>prompt.cancel();return signal?.aborted&&cancel(),signal?.addEventListener("abort",cancel,{once:!0}),this.runPrompt(prompt).finally(()=>signal?.removeEventListener("abort",cancel))},select:async opts2=>{let{default:select}=await import("./esm-4JKEE7PC.js");return this.runPrompt(select({theme,...opts2},{input:this.stdin,output:this.stderr}))},search:async opts2=>{let{default:search}=await import("./esm-DFFBNKNU.js");return this.runPrompt(search({theme,...opts2},{input:this.stdin,output:this.stderr}))}}}getTraceContext(){if(!this.telemetryEventStore.enabled||!this.rootSpan)return;let active=this.traceStorage.getStore();return active||(this.invocationTrace?.span!==this.rootSpan&&(this.invocationTrace=createTraceContext(this.rootSpan)),this.invocationTrace)}withTrace(name,operation,attrs){return traceOperation(this.getTraceContext(),name,trace=>trace?this.traceStorage.run(trace,()=>operation(trace)):operation(trace),attrs)}async withEscapePromptCancellation(run){this.escapePromptCancellationDepth++;try{return await run()}finally{this.escapePromptCancellationDepth--}}async withPromptBackNavigation(run){this.promptBackNavigationDepth++;try{return await run()}finally{this.promptBackNavigationDepth--}}runPrompt(prompt){let escapeCancellationEnabled=this.escapePromptCancellationDepth>0,backNavigationEnabled=this.promptBackNavigationDepth>0;if(!escapeCancellationEnabled&&!backNavigationEnabled||!this.stdin.isTTY||!prompt.cancel)return prompt;let cancellation,onKeypress=(_input,key)=>{key?.name==="escape"&&escapeCancellationEnabled&&!cancellation?(cancellation="escape",prompt.cancel?.()):key?.name==="up"&&backNavigationEnabled&&!cancellation&&(cancellation="back",prompt.cancel?.())};return this.stdin.on("keypress",onKeypress),prompt.catch(error=>{throw cancellation==="escape"?new PromptCanceledError:cancellation==="back"?new PromptBackError:error}).finally(()=>{this.stdin.off("keypress",onKeypress)})}get argv(){return this._argv}setArgv(argvOrFirst,...rest){let argv=Array.isArray(argvOrFirst)?argvOrFirst:[argvOrFirst,...rest];this._argv=argv,this._parsedArgsCache=void 0}getParsedArgs(){return this._parsedArgsCache||(this._parsedArgsCache=parseArguments(this.argv.slice(2),{},{permissive:!0})),this._parsedArgsCache}retry(fn,{retries=3,maxTimeout=1/0}={}){return(0,import_async_retry.default)(fn,{retries,maxTimeout,onRetry:this._onRetry})}async ensureAuthorized(){let{authConfig}=this;if(isValidAccessToken(authConfig)){this._loggedTokenSource||(authConfig.tokenSource==="flag"?output_manager_default.debug("Using token from the `--token` option, skipping token refresh."):authConfig.tokenSource==="env"?output_manager_default.debug("Using token from VERCEL_TOKEN environment variable, skipping token refresh."):output_manager_default.debug("Valid access token, skipping token refresh."),this._loggedTokenSource=!0);return}if(!hasRefreshToken(authConfig)){output_manager_default.debug("No refresh token found, emptying auth config."),this.emptyAuthConfig(),this.persistAuthConfig();return}let tokenResponse=await refreshTokenRequest({refresh_token:authConfig.refreshToken}),[tokensError,tokens]=await processTokenResponse(tokenResponse);if(isOAuthError(tokensError)&&tokensError.code==="invalid_grant"&&!authConfig.tokenSource&&this.stdin.isTTY&&!this.nonInteractive){output_manager_default.debug(`Stored session refresh failed: ${tokensError.cause.message}`),output_manager_default.log("Couldn't refresh the saved login. Starting a new login.");let{performDeviceCodeFlow}=await import("./future-YZGJX6FF.js"),recoveredTokens=await performDeviceCodeFlow(this);if(recoveredTokens){this.updateAuthConfig({token:recoveredTokens.access_token,userId:void 0,expiresAt:Math.floor(Date.now()/1e3)+recoveredTokens.expires_in,refreshToken:recoveredTokens.refresh_token}),this.persistAuthConfig();return}}if(tokensError){output_manager_default.debug("Error refreshing token, emptying auth config."),this.emptyAuthConfig(),this.persistAuthConfig();return}this.updateAuthConfig({token:tokens.access_token,expiresAt:Math.floor(Date.now()/1e3)+tokens.expires_in}),tokens.refresh_token&&this.updateAuthConfig({refreshToken:tokens.refresh_token}),this.persistAuthConfig(),this.writeToConfigFile(),output_manager_default.debug("Tokens refreshed successfully.")}getGlobalPathConfig(){let confFlag=this.getParsedArgs().flags["--global-config"];return typeof confFlag=="string"?resolve5(this.cwd,confFlag):(0,import_cli_config.getGlobalPathConfig)()}async readConfig(fileName,schema){let filePath=join4(this.getGlobalPathConfig(),fileName);return(0,import_cli_config.readConfigFile)(filePath,schema)}async maybeReadConfig(fileName,schema){try{return await this.readConfig(fileName,schema)}catch{return null}}async writeConfig(fileName,schema,value){let filePath=join4(this.getGlobalPathConfig(),fileName);(0,import_cli_config.writeConfigFile)(filePath,schema,value)}updateConfig(config2){this.config={...this.config,...config2},"currentTeam"in config2&&(this.savedTeam=config2.currentTeam)}writeToConfigFile(config2=this.config){writeToConfigFile({...config2,currentTeam:this.savedTeam})}isTeamUnchosen(){return this.ignoresSavedTeam&&this.config.currentTeam===TEAM_NOT_CHOSEN}needsTeamChoice(url,opts){return this.isTeamUnchosen()&&!opts.teamOptional&&!opts.accountId&&opts.useCurrentTeam!==!1&&!new URL2(url,this.apiUrl).searchParams.has("teamId")}chooseTeam({ask=!0}={}){return ask?(this.teamChoice??=this.applyTeamChoice(!0).finally(()=>{this.teamChoice=void 0}),this.teamChoice):this.applyTeamChoice(!1)}async applyTeamChoice(ask){let{resolveAgentTeam}=await import("./resolve-agent-team-DXHF7XLU.js"),team=await resolveAgentTeam(this,{ask});team!==null&&this.isTeamUnchosen()&&(this.config.currentTeam=team)}async resolveCurrentTeam({ask=!0}={}){return this.isTeamUnchosen()&&await this.chooseTeam({ask}),this.isTeamUnchosen()?void 0:this.config.currentTeam}updateAuthConfig(authConfig){authConfig.token&&authConfig.token!==this.authConfig.token&&(this.user=void 0,this.userPromise=void 0,this.teams=void 0,this.teamsPromise=void 0),this.authConfig={...this.authConfig,...authConfig}}emptyAuthConfig(){this.user=void 0,this.userPromise=void 0,this.teams=void 0,this.teamsPromise=void 0,this.authConfig=this.authConfig.skipWrite?{skipWrite:!0}:{}}persistAuthConfig(){persistAuthConfig(this.authConfig,this.config)}async confirmMutatingOperation(url,method){if(!((method||"GET").toUpperCase()==="DELETE"))return!0;if(this.isAgent&&this.dangerouslySkipPermissions){let agentInfo=this.agentName?` (${this.agentName})`:"";output_manager_default.print(`
21
- `),output_manager_default.print((0,import_chalk3.bgRed)((0,import_chalk3.white)((0,import_chalk3.bold)(" \u26A0 WARNING ")))+(0,import_chalk3.red)((0,import_chalk3.bold)(` AGENT MODE - DELETE CONFIRMATION BYPASSED
22
- `))),output_manager_default.print((0,import_chalk3.yellow)(` An AI agent${agentInfo} is executing a ${(0,import_chalk3.bold)("DELETE")} request with --dangerously-skip-permissions option.
23
- `)),output_manager_default.print((0,import_chalk3.yellow)(` This operation will delete data: ${(0,import_chalk3.bold)(url)}
24
- `)),output_manager_default.print((0,import_chalk3.yellow)(` The --dangerously-skip-permissions option has bypassed the confirmation prompt.
25
-
26
- `))}if(this.dangerouslySkipPermissions)return!0;if(!this.stdin.isTTY)return output_manager_default.error(`DELETE operations require confirmation. Use ${(0,import_chalk3.bold)("--dangerously-skip-permissions")} to skip confirmation in non-interactive mode.`),!1;let message=`You are about to perform a ${(0,import_chalk3.red)((0,import_chalk3.bold)("DELETE"))} operation on:
27
- ${(0,import_chalk3.bold)(url)}
28
-
29
- Are you sure you want to proceed?`;output_manager_default.print(`
30
- `);let confirmed=await this.input.confirm(message,!1);return output_manager_default.print(`
31
- `),confirmed||output_manager_default.log("Operation canceled by user."),confirmed}async _fetch(_url,opts={},request){let url=new URL2(_url,this.apiUrl);(opts.accountId||opts.useCurrentTeam!==!1)&&(opts.accountId?opts.accountId.startsWith("team_")?url.searchParams.set("teamId",opts.accountId):url.searchParams.delete("teamId"):opts.useCurrentTeam!==!1&&this.config.currentTeam&&!url.searchParams.has("teamId")&&url.searchParams.set("teamId",this.config.currentTeam));let headers=new globalThis.Headers(opts.headers);headers.set("user-agent",ua_default),DOMAINS_API_PATH.test(url.pathname)&&headers.set("x-vercel-cli-version",pkg_default.version),this.agentName&&headers.set("x-ai-agent",this.agentName),headers.set("x-vercel-cli-session-id",this.telemetryEventStore.currentSessionId),headers.set("x-vercel-cli-invocation-id",this.telemetryEventStore.currentInvocationId),await this.ensureAuthorized(),this.authConfig.token&&headers.set("authorization",`Bearer ${this.authConfig.token}`);let body;isJSONObject(opts.body)?(body=JSON.stringify(opts.body),headers.set("content-type","application/json; charset=utf-8")):body=opts.body;let requestId=this.requestIdCounter++,headersSpan=startTrace(request,"vc.cli.api.headers")?.span;try{let response=await output_manager_default.time(res=>res?`#${requestId} \u2190 ${res.status} ${res.statusText}: ${res.headers.get("x-vercel-id")}`:`#${requestId} \u2192 ${opts.method||"GET"} ${url.href}`,fetch(url,{...opts,headers,body}));return headersSpan?.setAttributes({http_status_code:String(response.status)}),request?.span.setAttributes({http_status_code:String(response.status)}),traceResponseBody(response,request?.span,request?.budget),response}catch(error){throw headersSpan?.setAttributes({error:"true"}),error}finally{headersSpan?.stop()}}async fetch(url,opts={}){this.needsTeamChoice(url,opts)&&await this.chooseTeam();let request;this.rootSpan&&this.telemetryEventStore.enabled&&this.tracedRequests<MAX_TRACED_REQUESTS&&(this.tracedRequests++,request=startTrace(this.getTraceContext(),"vc.cli.api.request",requestTraceAttributes(url,opts.method)));try{return await this.fetchWithRetry(url,opts,request)}catch(error){throw request?.span.setAttributes({error:"true"}),error}finally{request?.span.stop()}}fetchWithRetry(url,opts,request){return this.retry(async bail=>{let res;try{res=await this._fetch(url,opts,request)}catch(err){if(err instanceof Error&&(err.name==="AbortError"||err.name==="TimeoutError"))return bail(err);throw err}if(printIndications(res),!res.ok){if(opts.redirect==="manual"&&res.status>=300&&res.status<400)return res;let error=await responseError(res);if(isSAMLError(error)&&error.teamId)try{await this.reauthenticate(error)}catch(reauthError){return bail((0,import_error_utils3.normalizeError)(reauthError))}else{if(res.status===429&&opts.bailOn429)return bail(error);if(typeof error.retryAfterMs=="number"){if(opts.retry?.retries===0)return bail(error);let randomSkewMs=3e4*Math.random();await sleep(error.retryAfterMs+randomSkewMs)}else if(res.status>=400&&res.status<500)return bail(error)}throw error}if(opts.json===!1)return res;let contentType=res.headers.get("content-type");return contentType?contentType.includes("application/json")?res.json():res:null},opts.retry)}async*fetchPaginated(url,opts){let endpoint=typeof url=="string"?new URL2(url,this.apiUrl):new URL2(url.href);endpoint.searchParams.has("limit")||endpoint.searchParams.set("limit","100");let next;do{next&&(await sleep(100),endpoint.searchParams.set("until",String(next)));let res=await this.fetch(endpoint.href,opts);yield res,next=res.pagination?.next}while(next)}get cwd(){return process.cwd()}set cwd(v){process.chdir(v)}};function getCachedUsername(authConfig){let{cachedUser,userId}=authConfig;if(!(!cachedUser||cachedUser.id!==userId)&&!(!isValidAccessToken(authConfig)&&!hasRefreshToken(authConfig)))return cachedUser.username}async function getUser(client){return client.user?client.user:(client.userPromise||(client.userPromise=fetchUser(client).finally(()=>{client.userPromise=void 0})),client.userPromise)}async function fetchUser(client){try{let res=await client.fetch("/v2/user",{useCurrentTeam:!1});if(!res.user)throw new MissingUser;let{userId,cachedUser}=client.authConfig;if(userId!==res.user.id||cachedUser?.id!==res.user.id||cachedUser.username!==res.user.username){client.updateAuthConfig({userId:res.user.id,cachedUser:{id:res.user.id,username:res.user.username}});try{client.persistAuthConfig()}catch{output_manager_default.debug("Failed to persist cached userId to auth config.")}}return client.telemetryEventStore.updateUserId(res.user.id),client.user=res.user,res.user}catch(error){if(error instanceof APIError&&error.status===403){if(client.user=void 0,client.userPromise=void 0,client.authConfig.userId||client.authConfig.cachedUser){client.updateAuthConfig({userId:void 0,cachedUser:void 0});try{client.persistAuthConfig()}catch{output_manager_default.debug("Failed to persist cached userId to auth config.")}}throw new InvalidToken(client.authConfig.tokenSource)}throw error}}async function getOrgById(client,orgId){if(orgId.startsWith("team_"))try{let team=await getTeamByIdOrSlug(client,orgId,{useCurrentTeam:!1});return team?{type:"team",id:team.id,slug:team.slug}:null}catch(err){if(isAPIError(err)&&(err.status===404||err.code==="not_found"||err.code==="mock_unimplemented"))return null;throw err}let user=await getUser(client);return user.id!==orgId?null:{type:"user",id:orgId,slug:user.username}}var import_build_utils2=__toESM(require_build_utils(),1);var import_error_utils4=__toESM(require_dist(),1);var import_chalk4=__toESM(require_source(),1),import_pluralize=__toESM(require_pluralize(),1),import_build_utils=__toESM(require_build_utils(),1),import_fs_extra2=__toESM(require_lib2(),1);import{homedir as homedir2}from"os";import{basename as basename2,join as join5}from"path";var home=homedir2();async function getRepoLink(client,cwd){let rootPath=await findRepoRoot(cwd);if(!rootPath)return;let repoConfigPath=join5(rootPath,VERCEL_DIR,VERCEL_DIR_REPO),repoConfig=await(0,import_fs_extra2.readJSON)(repoConfigPath).catch(err=>{if(err.code!=="ENOENT")throw err});return{rootPath,repoConfig,repoConfigPath}}async function resolveGitRemote(client,rootPath,{yes,existingRemoteName}){let gitConfigPath=getGitConfigPath({cwd:rootPath})??join5(rootPath,".git/config"),remoteUrls=await getRemoteUrls(gitConfigPath);if(!remoteUrls)return;let remoteName;if(existingRemoteName){if(remoteName=existingRemoteName,!remoteUrls[remoteName])throw new Error(`Git remote "${remoteName}" from repo.json no longer exists`)}else remoteName=await selectGitRemote(client,Object.keys(remoteUrls),yes);return{rootPath,remoteName,repoUrl:remoteUrls[remoteName]}}async function selectGitRemote(client,names,yes=!1){let remoteNames=[...names].sort(),defaultRemote=remoteNames.includes("origin")?"origin":remoteNames[0];return remoteNames.length===1||yes?defaultRemote:client.input.select({message:"Which Git remote should be used?",choices:remoteNames.map(name=>({name,value:name})),default:defaultRemote})}async function fetchProjectsForRepoUrl(client,repoUrl,orgId){let query=new URLSearchParams({repoUrl}),projectsIterator=client.fetchPaginated(`/v9/projects?${query}`,{accountId:orgId}),projects=[];for await(let chunk of projectsIterator)projects=projects.concat(chunk.projects);return projects}async function linkRepoProject(client,cwd,{project,orgId,orgSlug,remoteName,successEmoji="link"}){let repoLink=await getRepoLink(client,cwd);if(!repoLink)throw new Error("Could not determine Git repository root directory");let directory=(0,import_build_utils.normalizePath)(project.rootDirectory||"."),projectConfig={id:project.id,name:project.name,directory,orgId},filteredProjects=(repoLink.repoConfig?.projects??[]).filter(p=>p.id!==project.id&&(0,import_build_utils.normalizePath)(p.directory)!==directory),repoConfig={remoteName,projects:[...filteredProjects,projectConfig]};return await(0,import_fs_extra2.outputJSON)(repoLink.repoConfigPath,repoConfig,{spaces:2}),await writeReadme(repoLink.rootPath),await addToGitIgnore(repoLink.rootPath),output_manager_default.print(`
32
- `),printAlignedLabel("Linked",`${orgSlug}/${project.name}`,{gutter:"\u2713"}),{repoConfig,repoConfigPath:repoLink.repoConfigPath,rootPath:repoLink.rootPath}}async function discoverRepoProjects(client,rootPath,{yes,existingProjectIds,existingDirectories,existingRemoteName}){let{Separator}=await import("./esm-BYG5BWYH.js"),{default:slugify}=await import("./slugify-NMMUASYK.js"),{default:selectOrg}=await import("./select-org-VTLOMQYC.js"),{default:createProject}=await import("./create-project-IKCB6MB2.js"),{repoInfoToUrl}=await import("./repo-info-to-url-XQSULSEO.js"),{connectGitProvider,parseRepoUrl}=await import("./connect-git-provider-IQ7N2NPY.js"),detectedProjectsPromise=import("./detect-projects-EYF4ZSYF.js").then(({detectProjects})=>detectProjects(rootPath)).catch(err=>(output_manager_default.debug(`Failed to detect local projects: ${err}`),new Map)),confirmMessage=(existingRemoteName?"add":"link")==="add"?`Add Project(s) for Git repository at ${import_chalk4.default.dim(`"${humanizePath(rootPath)}"`)}?`:`Link Git repository at ${import_chalk4.default.dim(`"${humanizePath(rootPath)}"`)} to your Project(s)?`;if(!(yes||await client.input.confirm(confirmMessage,!0))){output_manager_default.print(` Canceled. Repository not linked.
33
- `);return}let org=await selectOrg(client,"Which team?",yes);client.config.currentTeam=org.type==="team"?org.id:void 0;let remote=await resolveGitRemote(client,rootPath,{yes,existingRemoteName});if(!remote)throw new Error("Could not determine Git remote URLs");let{remoteName,repoUrl}=remote,parsedRepoUrl=parseRepoUrl(repoUrl);if(!parsedRepoUrl)throw new Error(`Failed to parse Git URL: ${repoUrl}`);let repoUrlLink=output_manager_default.link(repoUrl,repoInfoToUrl(parsedRepoUrl),{fallback:()=>link_default(repoUrl)});output_manager_default.spinner(`Fetching Projects for ${repoUrlLink} under ${import_chalk4.default.bold(org.slug)}\u2026`);let detectedProjects=await detectedProjectsPromise,projects=await fetchProjectsForRepoUrl(client,repoUrl,org.id);(existingProjectIds||existingDirectories)&&(projects=projects.filter(p=>!(existingProjectIds?.has(p.id)||existingDirectories?.has((0,import_build_utils.normalizePath)(p.rootDirectory||"."))))),projects.length===0?output_manager_default.print(` No Projects are linked to ${repoUrlLink} under ${import_chalk4.default.bold(org.slug)}.
34
- `):output_manager_default.print(` Found ${(0,import_pluralize.default)("Project",projects.length,!0)} linked to ${repoUrlLink} under ${import_chalk4.default.bold(org.slug)}
35
- `);for(let project of projects)detectedProjects.delete(project.rootDirectory??"");if(existingDirectories)for(let dir of existingDirectories)detectedProjects.delete(dir==="."?"":dir);let detectedProjectsCount=Array.from(detectedProjects.values()).reduce((o,f)=>o+f.length,0);detectedProjectsCount>0&&output_manager_default.print(` Detected ${(0,import_pluralize.default)("new Project",detectedProjectsCount,!0)} that may be created.
36
- `);let selected;if(yes)selected=projects;else{let addSeparators=projects.length>0&&detectedProjectsCount>0;selected=await client.input.checkbox({message:`Which Projects should be ${projects.length?"linked to":"created"}?`,choices:[...addSeparators?[new Separator("----- Existing Projects -----")]:[],...projects.map(project=>{let dir=project.rootDirectory||".";return{name:`${org.slug}/${project.name} ${import_chalk4.default.gray(`(${dir})`)}`,value:project,checked:!0}}),...addSeparators?[new Separator("----- New Projects to be created -----")]:[],...Array.from(detectedProjects.entries()).flatMap(([rootDirectory,frameworks])=>frameworks.map((framework,i)=>{let name=slugify([basename2(rootDirectory)||basename2(rootPath),i>0?framework.slug:""].filter(Boolean).join("-"));return{name:`${org.slug}/${name} ${import_chalk4.default.gray(`(${rootDirectory||"."} \xB7 ${framework.name})`)}`,value:{newProject:!0,rootDirectory,name,framework},checked:projects.length===0}}))]})}if(selected.length===0){output_manager_default.print(` No Projects were selected. Repository not linked.
37
- `);return}for(let i=0;i<selected.length;i++){let selection=selected[i];if(!("newProject"in selection&&selection.newProject))continue;let orgAndName=`${org.slug}/${selection.name}`;output_manager_default.spinner(`Creating new Project: ${orgAndName}`),delete selection.newProject,selection.rootDirectory||delete selection.rootDirectory;let project=selected[i]=await createProject(client,{...selection,framework:selection.framework.slug});await connectGitProvider(client,project.id,parsedRepoUrl.provider,`${parsedRepoUrl.org}/${parsedRepoUrl.repo}`),output_manager_default.print(` Created new Project: ${output_manager_default.link(orgAndName,`https://vercel.com/${orgAndName}`,{fallback:!1})}
38
- `)}let repoProjects=selected.map(project=>{if(!("id"in project))throw new TypeError(`Not a Project: ${JSON.stringify(project)}`);return{id:project.id,name:project.name,directory:(0,import_build_utils.normalizePath)(project.rootDirectory||"."),orgId:org.id}});return{remoteName,projects:repoProjects,orgSlug:org.slug}}async function ensureRepoLink(client,cwd,{yes,overwrite}){let repoLink=await getRepoLink(client,cwd);if(repoLink)output_manager_default.debug(`Found Git repository root directory: ${repoLink.rootPath}`);else throw new Error("Could not determine Git repository root directory");let{rootPath,repoConfig,repoConfigPath}=repoLink;if(overwrite||!repoConfig){let result=await discoverRepoProjects(client,rootPath,{yes});if(!result)return;repoConfig={remoteName:result.remoteName,projects:result.projects},await(0,import_fs_extra2.outputJSON)(repoConfigPath,repoConfig,{spaces:2}),await writeReadme(rootPath),await addToGitIgnore(rootPath),printAlignedLabel("Linked",`${(0,import_pluralize.default)("Project",result.projects.length,!0)} under ${result.orgSlug}`,{gutter:"\u2713"})}return{repoConfig,repoConfigPath,rootPath}}async function addRepoLink(client,cwd,{yes}){let repoLink=await getRepoLink(client,cwd);if(!repoLink)throw new Error("Could not determine Git repository root directory");let{rootPath,repoConfig,repoConfigPath}=repoLink;if(!repoConfig)throw new Error("No existing repository link found. Run `vc link --repo` first to link the repository.");output_manager_default.debug(`Found Git repository root directory: ${rootPath}`);let existingProjectIds=new Set(repoConfig.projects.map(p=>p.id)),existingDirectories=new Set(repoConfig.projects.map(p=>p.directory)),result=await discoverRepoProjects(client,rootPath,{yes,existingProjectIds,existingDirectories,existingRemoteName:repoConfig.remoteName});if(!result)return;if(result.projects.length===0)return output_manager_default.print(` No new Projects were added.
39
- `),{repoConfig,repoConfigPath,rootPath};let mergedProjects=[...repoConfig.projects];for(let project of result.projects)existingProjectIds.has(project.id)||mergedProjects.push(project);let updatedConfig={...repoConfig,projects:mergedProjects};return await(0,import_fs_extra2.outputJSON)(repoConfigPath,updatedConfig,{spaces:2}),printAlignedLabel("Added",`${(0,import_pluralize.default)("Project",result.projects.length,!0)} under ${result.orgSlug}`,{gutter:"\u2713"}),{repoConfig:updatedConfig,repoConfigPath,rootPath}}async function findRepoRoot(start){let{debug}=output_manager_default,REPO_JSON_PATH=join5(VERCEL_DIR,VERCEL_DIR_REPO);for(let current of(0,import_build_utils.traverseUpDirectories)({start})){if(current===home){debug("Arrived at home directory");break}let repoConfigPath=join5(current,REPO_JSON_PATH);if(await(0,import_fs_extra2.lstat)(repoConfigPath).catch(err=>{if(err.code!=="ENOENT")throw err}))return debug(`Found "${REPO_JSON_PATH}" - detected "${current}" as repo root`),current}let gitRoot=getGitRootDirectory({cwd:start});if(gitRoot)return debug(`Found git root via "git rev-parse --show-toplevel" - detected "${gitRoot}" as repo root`),gitRoot;for(let current of(0,import_build_utils.traverseUpDirectories)({start})){if(current===home){debug("Arrived at home directory");break}let gitPath=join5(current,".git");if(await(0,import_fs_extra2.lstat)(gitPath).catch(err=>{if(err.code!=="ENOENT")throw err}))return debug(`Found ".git" - detected "${current}" as repo root`),current}debug("Aborting search for repo root")}function sortByDirectory(a,b){let aParts=a.directory.split("/");return b.directory.split("/").length-aParts.length}function findProjectsFromPath(projects,path2){let normalizedPath=(0,import_build_utils.normalizePath)(path2),matches=projects.slice().sort(sortByDirectory).filter(project=>project.directory==="."?!0:normalizedPath===project.directory||normalizedPath.startsWith(`${project.directory}/`)),firstMatch=matches[0];return firstMatch?matches.filter(match=>match.directory===firstMatch.directory):[]}var import_chalk5=__toESM(require_source(),1),import_fs_extra3=__toESM(require_lib2(),1);import{stat}from"fs/promises";import{join as join6,dirname as dirname2}from"path";async function findProjectRoot(startDir){let cwdDev;try{cwdDev=(await stat(startDir)).dev}catch{return null}let dir=dirname2(startDir);for(;dirname2(dir)!==dir;){try{if((await stat(dir)).dev!==cwdDev)return null}catch{return null}let hasVercelDir=await(0,import_fs_extra3.pathExists)(join6(dir,".vercel")),hasVercelJson=await(0,import_fs_extra3.pathExists)(join6(dir,"vercel.json")),hasVercelToml=await(0,import_fs_extra3.pathExists)(join6(dir,"vercel.toml")),hasGit=await(0,import_fs_extra3.pathExists)(join6(dir,".git"));if(hasVercelDir||hasVercelJson||hasVercelToml||hasGit)return dir;dir=dirname2(dir)}return null}async function resolveProjectCwd(cwd){let projectRoot=await findProjectRoot(cwd);if(!projectRoot||projectRoot===cwd)return cwd;let{isExperimentalServicesEnabled,tryDetectServices}=await import("./detect-services-LNYPPBJP.js");if(!await isExperimentalServicesEnabled(projectRoot))return cwd;let result=await tryDetectServices(projectRoot);return result&&(result.services?.length??0)>0?(output_manager_default.debug(`Running from project root: ${import_chalk5.default.cyan(projectRoot)}`),projectRoot):cwd}var readFile=promisify(fs3.readFile),writeFile=promisify(fs3.writeFile),VERCEL_DIR=".vercel",VERCEL_DIR_FALLBACK=".now",VERCEL_DIR_README="README.txt",VERCEL_DIR_PROJECT="project.json",VERCEL_DIR_REPO="repo.json";function isOwnerLookupUnavailableLink(link){return"ownerLookupUnavailable"in link&&link.ownerLookupUnavailable===!0}function isRemoteLookupSkippedLink(link){return"remoteLookupSkipped"in link&&link.remoteLookupSkipped===!0}function isOwnerLookupUnavailableError(error){return isAPIError(error)&&error.status===403&&error.code==="team_unauthorized"}function isValidProjectLink(value){if(!value||typeof value!="object"||Array.isArray(value))return!1;let link=value;return typeof link.projectId=="string"&&link.projectId.length>0&&typeof link.orgId=="string"&&link.orgId.length>0&&(link.projectName===void 0||typeof link.projectName=="string"&&link.projectName.length>0)}function getVercelDirectory(cwd){let possibleDirs=[join7(cwd,VERCEL_DIR),join7(cwd,VERCEL_DIR_FALLBACK)],existingDirs=possibleDirs.filter(d=>isDirectory(d));if(existingDirs.length>1)throw new import_build_utils2.NowBuildError({code:"CONFLICTING_CONFIG_DIRECTORIES",message:"Both `.vercel` and `.now` directories exist. Please remove the `.now` directory.",link:"https://vercel.link/combining-old-and-new-config"});return existingDirs[0]||possibleDirs[0]}async function getProjectLink(client,path2,projectName,projectNameIsExplicit){let dirLink=await getLinkFromDir(getVercelDirectory(path2));return dirLink&&(!projectNameIsExplicit||!projectName||dirLink.projectId===projectName||dirLink.projectName===projectName)?dirLink:await getProjectLinkFromRepoLink(client,path2,projectName,projectNameIsExplicit)}async function getProjectLinkFromRepoLink(client,path2,projectName,projectNameIsExplicit){let repoLink=await getRepoLink(client,path2);if(!repoLink?.repoConfig)return null;let projects=findProjectsFromPath(repoLink.repoConfig.projects,relative2(repoLink.rootPath,path2)),project;if(projectName&&projectNameIsExplicit)project=repoLink.repoConfig.projects.find(p=>p.id===projectName||p.name===projectName);else if(projects.length===1)project=projects[0];else{let selectableProjects=projects.length>0?projects:repoLink.repoConfig.projects;if(projectName&&(project=selectableProjects.find(p=>p.id===projectName||p.name===projectName)),!project)if(client.nonInteractive)if(selectableProjects.length===1)project=selectableProjects[0];else return null;else project=await client.input.select({message:"Please select a Project:",choices:selectableProjects.map(p=>({value:p,name:p.name}))})}if(project){let orgId=project.orgId??repoLink.repoConfig.orgId;if(!orgId){let projectInfo=[project.name?`name: "${project.name}"`:"",project.directory?`directory: "${project.directory}"`:""].filter(Boolean).join(", "),details=projectInfo?` Project: { ${projectInfo} }.`:"";throw new Error(`Could not determine org ID from repo.json config at "${repoLink.repoConfigPath}".${details} Please re-link the repository.`)}return{repoRoot:repoLink.rootPath,orgId,projectId:project.id,projectName:project.name,projectRootDirectory:project.directory}}return null}function getLinkedProjectIdSync(dir){try{let link=JSON.parse(fs3.readFileSync(join7(dir,VERCEL_DIR_PROJECT),"utf8"));return isValidProjectLink(link)?link.projectId:void 0}catch{return}}async function getLinkFromDir(dir){try{let json=await readFile(join7(dir,VERCEL_DIR_PROJECT),"utf8"),link=JSON.parse(json);if(!isValidProjectLink(link)){let raw=link,projectId=raw.projectId,orgId=raw.orgId;if(!(typeof projectId=="string"&&projectId.length>0&&typeof orgId=="string"&&orgId.length>0))return null;throw new Error(`Project Settings are invalid. To link your project again, remove the ${dir} directory.`)}return link}catch(err){if((0,import_error_utils4.isErrnoException)(err)&&err.code&&["ENOENT","ENOTDIR"].includes(err.code))return null;throw(0,import_error_utils4.isError)(err)&&err.name==="SyntaxError"?new Error(`Project Settings could not be retrieved. To link your project again, remove the ${dir} directory.`):err}}async function hasLocalProjectLink(client,cwd){try{if(await getLinkFromDir(getVercelDirectory(cwd)))return!0}catch{}try{let repoLink=await getRepoLink(client,cwd);return repoLink?.repoConfig?findProjectsFromPath(repoLink.repoConfig.projects,relative2(repoLink.rootPath,cwd)).length>0:!1}catch{return!1}}async function hasProjectLink(client,projectLink,path2){let VERCEL_ORG_ID=(0,import_build_utils2.getPlatformEnv)("ORG_ID"),VERCEL_PROJECT_ID=(0,import_build_utils2.getPlatformEnv)("PROJECT_ID");if(VERCEL_ORG_ID===projectLink.orgId&&VERCEL_PROJECT_ID===projectLink.projectId)return!0;let repoLink=await getRepoLink(client,path2);if(repoLink?.repoConfig){let matchingProject=repoLink.repoConfig.projects.find(p=>p.id===projectLink.projectId);if(matchingProject){let orgId=matchingProject.orgId??repoLink.repoConfig.orgId;if(!orgId)throw new Error(`Invalid "repo.json": missing "orgId" for project "${matchingProject.id}" and no top-level "orgId" is defined.`);if(orgId===projectLink.orgId)return!0}}let link=await getLinkFromDir(getVercelDirectory(path2));return!!(link&&link.orgId===projectLink.orgId&&link.projectId===projectLink.projectId)}async function getLinkedProject(client,options={}){let path2=options.cwd??client.cwd;options.skipProjectRootResolution||(path2=await resolveProjectCwd(path2));let VERCEL_ORG_ID=(0,import_build_utils2.getPlatformEnv)("ORG_ID"),VERCEL_PROJECT_ID=(0,import_build_utils2.getPlatformEnv)("PROJECT_ID"),shouldUseEnv=!!(VERCEL_ORG_ID&&VERCEL_PROJECT_ID),projectName=options.projectName,projectNameIsExplicit=options.projectNameIsExplicit===!0,explicitProjectName=projectNameIsExplicit?projectName:void 0,hasExplicitProject=!!explicitProjectName,shouldUseEnvContext=shouldUseEnv&&!hasExplicitProject;if(!hasExplicitProject&&(VERCEL_ORG_ID||VERCEL_PROJECT_ID)&&!shouldUseEnv)return options.quiet||output_manager_default.error(`You specified ${VERCEL_ORG_ID?"`VERCEL_ORG_ID`":"`VERCEL_PROJECT_ID`"} but you forgot to specify ${VERCEL_ORG_ID?"`VERCEL_PROJECT_ID`":"`VERCEL_ORG_ID`"}. You need to specify both to deploy to a custom project.
40
- `),{status:"error",exitCode:1};let link,explicitlyResolvedProject=null,orgId;if(explicitProjectName){let hasExplicitScope=options.scopeIsExplicit===!0,matchingLocalLink=hasExplicitScope||shouldUseEnv?null:await getProjectLink(client,path2,explicitProjectName,!0),fallbackOrgId=shouldUseEnv?VERCEL_ORG_ID:matchingLocalLink?.orgId??client.config.currentTeam,lookupOrgId=hasExplicitScope?client.config.currentTeam:fallbackOrgId;orgId=lookupOrgId;let apiProject=await getProjectByNameOrId(client,explicitProjectName,lookupOrgId);if(explicitlyResolvedProject=apiProject instanceof ProjectNotFound?null:apiProject,explicitlyResolvedProject===null)link=null;else{let resolvedOrgId=explicitlyResolvedProject.accountId??lookupOrgId??matchingLocalLink?.orgId,localLink=matchingLocalLink?.projectId===explicitlyResolvedProject.id?matchingLocalLink:null;if(!localLink)try{localLink=await getProjectLink(client,path2,explicitlyResolvedProject.id,!0)}catch(err){output_manager_default.debug(`Ignoring local project metadata after explicit project resolution: ${err}`)}link=resolvedOrgId?{...localLink?.projectId===explicitlyResolvedProject.id&&localLink.orgId===resolvedOrgId?localLink:{},projectId:explicitlyResolvedProject.id,orgId:resolvedOrgId}:null}}else link=shouldUseEnvContext?{orgId:VERCEL_ORG_ID,projectId:VERCEL_PROJECT_ID}:await getProjectLink(client,path2,projectName,projectNameIsExplicit),link&&(orgId=link.orgId);if(!link)return{status:"not_linked",org:null,project:null,orgId};if(options.skipRemoteLookup&&link.projectName){let settings=link.settings,localRootDirectory=link.projectRootDirectory??settings?.rootDirectory??null,rootDirectory=localRootDirectory==="."?null:localRootDirectory,project2={...settings,id:link.projectId,accountId:link.orgId,name:link.projectName,createdAt:settings?.createdAt??0,updatedAt:settings?.updatedAt??settings?.createdAt??0,rootDirectory};return{...{status:"linked",org:{type:link.orgId.startsWith("team_")?"team":"user",id:link.orgId,slug:""},project:project2,repoRoot:link.repoRoot,remoteLookupSkipped:!0},projectRootDirectory:link.projectRootDirectory,orgId:link.orgId}}options.quiet||output_manager_default.spinner("Retrieving project\u2026",1e3);let org=null,project=null,ownerLookupUnavailable=!1;try{let[orgResult,projectResult]=await Promise.allSettled([options.skipOwnerLookup?Promise.resolve({type:link.orgId.startsWith("team_")?"team":"user",id:link.orgId,slug:""}):getOrgById(client,link.orgId),explicitlyResolvedProject?Promise.resolve(explicitlyResolvedProject):getProjectByNameOrId(client,link.projectId,link.orgId)]);if(orgResult.status==="fulfilled")org=orgResult.value;else if(isAPIError(orgResult.reason)&&(orgResult.reason.status===404||orgResult.reason.code==="not_found"||orgResult.reason.code==="mock_unimplemented"))org=null;else if(options.allowOwnerLookupFallback&&isOwnerLookupUnavailableError(orgResult.reason))ownerLookupUnavailable=!0;else throw orgResult.reason;if(projectResult.status==="fulfilled")project=projectResult.value;else if(isAPIError(projectResult.reason)&&(projectResult.reason.status===404||projectResult.reason.code==="not_found"||projectResult.reason.code==="mock_unimplemented"))project=new ProjectNotFound(link.projectId);else throw projectResult.reason}catch(err){if(isAPIError(err)&&err.status===403){if(output_manager_default.stopSpinner(),err.missingToken||err.invalidToken)throw new InvalidToken(client.authConfig.tokenSource);if(err.code==="forbidden"||err.code==="team_unauthorized")throw new import_build_utils2.NowBuildError({message:`Could not retrieve Project Settings. To link your Project, remove the ${code(VERCEL_DIR)} directory and deploy again.`,code:"PROJECT_UNAUTHORIZED",link:"https://vercel.link/cannot-load-project-settings"})}throw err}finally{output_manager_default.stopSpinner()}if(ownerLookupUnavailable&&project&&!(project instanceof ProjectNotFound)){let ownerId=project.accountId||link.orgId;return{status:"linked",org:{type:ownerId.startsWith("team_")?"team":"user",id:ownerId,slug:ownerId},project,repoRoot:link.repoRoot,projectRootDirectory:link.projectRootDirectory,orgId:link.orgId,ownerLookupUnavailable:!0}}return!org||!project||project instanceof ProjectNotFound?shouldUseEnvContext?(options.quiet||output_manager_default.error(`Project not found (${JSON.stringify({VERCEL_PROJECT_ID,VERCEL_ORG_ID})})
41
- `),{status:"error",exitCode:1,orgId}):(options.quiet||output_manager_default.print(prependEmoji(`Your Project was either deleted, transferred to a new Team, or you don\u2019t have access to it anymore.
42
- `,emoji("warning"))),{status:"not_linked",org:null,project:null,orgId:link.orgId}):{status:"linked",org,project,repoRoot:link.repoRoot,projectRootDirectory:link.projectRootDirectory,orgId:link.orgId}}var VERCEL_DIR_README_CONTENT=`> Why do I have a folder named ".vercel" in my project?
43
- The ".vercel" folder is created when you link a directory to a Vercel project.
44
-
45
- > What does the "project.json" file contain?
46
- The "project.json" file contains:
47
- - The ID of the Vercel project that you linked ("projectId")
48
- - The ID of the user or team your Vercel project is owned by ("orgId")
49
-
50
- > Should I commit the ".vercel" folder?
51
- No, you should not share the ".vercel" folder with anyone.
52
- Upon creation, it will be automatically added to your ".gitignore" file.
53
- `;async function writeReadme(path2){await writeFile(join7(path2,VERCEL_DIR,VERCEL_DIR_README),VERCEL_DIR_README_CONTENT)}async function linkFolderToProject(client,path2,projectLink,projectName,orgSlug,successEmoji="link",autoConfirm=!1,pullEnv=!0,resultLabel="Linked"){if(await hasProjectLink(client,projectLink,path2))return;try{await(0,import_fs_extra4.ensureDir)(join7(path2,VERCEL_DIR))}catch(err){if((0,import_error_utils4.isErrnoException)(err)&&err.code==="ENOTDIR")return;throw err}if(await writeFile(join7(path2,VERCEL_DIR,VERCEL_DIR_PROJECT),JSON.stringify({...projectLink,projectName})),await writeReadme(path2),await addToGitIgnore(path2),output_manager_default.print(`
54
- `),printAlignedLabel(resultLabel,`${orgSlug}/${projectName}`,{gutter:"\u2713"}),!pullEnv||!client.stdin.isTTY||client.nonInteractive)return;if(output_manager_default.print(`
55
- `),autoConfirm||await client.input.confirm("Pull development environment variables into .env.local?",!0)){let originalCwd=client.cwd;try{client.cwd=path2;let args=autoConfirm?["--yes"]:[],{default:pull}=await import("./pull-RVNTGJ4C.js");await pull(client,args,"vercel-cli:link")!==0&&output_manager_default.error("Failed to pull environment variables. You can run `vc env pull` manually.")}catch{output_manager_default.error("Failed to pull environment variables. You can run `vc env pull` manually.")}finally{client.cwd=originalCwd}}}async function addToGitIgnore(path2,ignore=VERCEL_DIR){let isGitIgnoreUpdated=!1;try{let gitIgnorePath=join8(path2,".gitignore"),gitIgnore=await(0,import_fs_extra5.readFile)(gitIgnorePath,"utf8").catch(()=>null)??"",EOL=gitIgnore.includes(`\r
56
- `)?`\r
57
- `:os2.EOL,contentModified=!1;gitIgnore.split(EOL).includes(ignore)||(gitIgnore+=`${gitIgnore.endsWith(EOL)||gitIgnore.length===0?"":EOL}${ignore}${EOL}`,contentModified=!0),contentModified&&(await(0,import_fs_extra5.writeFile)(gitIgnorePath,gitIgnore),isGitIgnoreUpdated=!0)}catch{}return isGitIgnoreUpdated}export{require_lib2 as require_lib,humanizePath,highlight,require_dist2 as require_dist,ua_default,responseError,printIndications,require_types,getProjectByNameOrId,getOrgById,isDirectory,require_pluralize,execFileAsync,getGitExecutable,getGitConfigPath,createGitMeta,parseGitConfig,pluckRemoteUrls,getRemoteUrls,addToGitIgnore,getRepoLink,resolveGitRemote,selectGitRemote,fetchProjectsForRepoUrl,linkRepoProject,ensureRepoLink,addRepoLink,findRepoRoot,findProjectsFromPath,VERCEL_CONFIG_EXTENSIONS,DEFAULT_VERCEL_CONFIG_FILENAME,resolveProjectCwd,deviceAuthorizationRequest,processDeviceAuthorizationResponse,deviceAccessTokenRequest,processTokenResponse,revocationRequest,processRevocationResponse,isOAuthError,inspectTokenRequest,processInspectTokenResponse,isPromptBackError,isPromptCanceledError,VERCEL_DIR,VERCEL_DIR_README,VERCEL_DIR_PROJECT,isOwnerLookupUnavailableLink,isRemoteLookupSkippedLink,getVercelDirectory,getProjectLink,getLinkedProjectIdSync,getLinkFromDir,hasLocalProjectLink,getLinkedProject,linkFolderToProject,localConfigFlagPath,getLocalPathConfig,readConfigFile,writeToConfigFile,readAuthConfigFile,persistAuthConfig,getConfigFilePath2 as getConfigFilePath,getAuthConfigFilePath2 as getAuthConfigFilePath,readLocalConfig,startTrace,traceOperation,sleep,TEAM_NOT_CHOSEN,isJSONObject,isValidAccessToken,Client,getCachedUsername,getUser};
@@ -1,8 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{repositoryPermissionsClearPath}from"./chunk-DFVNL5ML.js";import{emitVcrArgParseError,handleVcrApiError,requireVcrRepository,resolveVcrScope,validateVcrJsonOutput}from"./chunk-TYL6IYR4.js";import"./chunk-XSQVCDSD.js";import"./chunk-RCUDI7OF.js";import"./chunk-GD7AV7BO.js";import{permissionsClearSubcommand}from"./chunk-QNL22LAW.js";import{printError}from"./chunk-LCMNJNSQ.js";import"./chunk-GKCTMBCM.js";import"./chunk-MXTC4ZAQ.js";import{AGENT_REASON,buildCommandWithYes,outputAgentError}from"./chunk-I7U2XP4X.js";import"./chunk-EPO7P734.js";import"./chunk-TKKGZI7O.js";import"./chunk-26QK3I2S.js";import"./chunk-55H6G46X.js";import"./chunk-4NTBYNFR.js";import{parseArguments}from"./chunk-F22QLVTX.js";import"./chunk-F53OKXYI.js";import"./chunk-7SAEZ4NC.js";import"./chunk-LUX4PBJL.js";import"./chunk-OPORM35X.js";import"./chunk-4SAVH3H7.js";import{isAPIError}from"./chunk-YCJHUYBJ.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-DWOJP4ST.js";import"./chunk-BLUPZPAS.js";import"./chunk-RM3ZDRYE.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-OO572JUC.js";import{getFlagsSpecification}from"./chunk-A2UZ2O7H.js";import"./chunk-2BKALEOP.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-FBYA6LLM.js";import"./chunk-SCV7XEEO.js";import"./chunk-MY4MONOH.js";import"./chunk-BZENIQ7N.js";async function clear(client,argv,telemetry){let parsedArgs;try{parsedArgs=parseArguments(argv,getFlagsSpecification(permissionsClearSubcommand.options))}catch(err){return emitVcrArgParseError(client,err,"vcr permissions <repository> clear"),printError(err),2}let fr=validateVcrJsonOutput(client,parsedArgs.flags);if(typeof fr=="number")return fr;let repository=parsedArgs.args[0],project=parsedArgs.flags["--project"],skipConfirmation=!!parsedArgs.flags["--yes"];telemetry.trackCliOptionProject(project),telemetry.trackCliFlagYes(parsedArgs.flags["--yes"]),telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]);let missingRepository=requireVcrRepository(client,repository,fr.jsonOutput,"vcr permissions <repository> clear");if(typeof missingRepository=="number")return missingRepository;let scope=await resolveVcrScope(client,{project,jsonOutput:fr.jsonOutput});if(typeof scope=="number")return scope;if(!skipConfirmation&&(outputAgentError(client,{status:"error",reason:AGENT_REASON.CONFIRMATION_REQUIRED,message:"Clearing repository permissions removes access for every team. Re-run with --yes.",next:[{command:buildCommandWithYes(client.argv)}]},1),!await client.input.confirm(`Remove access to ${repository} for all teams? They will no longer be able to pull its images.`,!1)))return output_manager_default.log("Canceled"),0;let path=repositoryPermissionsClearPath(scope,repository);output_manager_default.spinner("Clearing repository permissions...");try{return await client.fetch(path,{method:"DELETE"}),fr.jsonOutput?client.stdout.write(`${JSON.stringify({repository,cleared:!0},null,2)}
8
- `):output_manager_default.success(`Cleared repository permissions for ${repository}`),0}catch(err){if(isAPIError(err))return handleVcrApiError(client,err,fr.jsonOutput);throw err}finally{output_manager_default.stopSpinner()}}export{clear as default};
@@ -1,7 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{compileVercelConfig,findSourceVercelConfigFile,getVercelConfigPath,normalizeConfig}from"./chunk-UWGWRZP5.js";import{DEFAULT_VERCEL_CONFIG_FILENAME,VERCEL_CONFIG_EXTENSIONS}from"./chunk-TKKGZI7O.js";import"./chunk-26QK3I2S.js";import"./chunk-55H6G46X.js";import"./chunk-4NTBYNFR.js";import"./chunk-F22QLVTX.js";import"./chunk-F53OKXYI.js";import"./chunk-7SAEZ4NC.js";import"./chunk-LUX4PBJL.js";import"./chunk-OPORM35X.js";import"./chunk-4SAVH3H7.js";import"./chunk-YCJHUYBJ.js";import"./chunk-JESNVRVR.js";import"./chunk-DWOJP4ST.js";import"./chunk-BLUPZPAS.js";import"./chunk-RM3ZDRYE.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-OO572JUC.js";import"./chunk-A2UZ2O7H.js";import"./chunk-2BKALEOP.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-MY4MONOH.js";import"./chunk-BZENIQ7N.js";export{DEFAULT_VERCEL_CONFIG_FILENAME,VERCEL_CONFIG_EXTENSIONS,compileVercelConfig,findSourceVercelConfigFile,getVercelConfigPath,normalizeConfig};
@@ -1,8 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{repositoryPath}from"./chunk-DFVNL5ML.js";import{emitVcrArgParseError,handleVcrApiError,requireVcrRepository,resolveVcrScope,validateVcrJsonOutput}from"./chunk-TYL6IYR4.js";import{outputError}from"./chunk-XSQVCDSD.js";import{readOnOffOption,rewriteLegacyOnOffValues}from"./chunk-RMW2FDXS.js";import"./chunk-RCUDI7OF.js";import"./chunk-GD7AV7BO.js";import{configSubcommand}from"./chunk-HMWDOAWO.js";import"./chunk-QNL22LAW.js";import"./chunk-UWMPVTXG.js";import"./chunk-5CZNUB7Y.js";import{printError}from"./chunk-LCMNJNSQ.js";import"./chunk-GKCTMBCM.js";import"./chunk-MXTC4ZAQ.js";import{AGENT_REASON,buildCommandWithGlobalFlags,outputAgentError}from"./chunk-I7U2XP4X.js";import"./chunk-EPO7P734.js";import"./chunk-TKKGZI7O.js";import"./chunk-26QK3I2S.js";import"./chunk-55H6G46X.js";import"./chunk-4NTBYNFR.js";import{parseArguments}from"./chunk-F22QLVTX.js";import"./chunk-F53OKXYI.js";import"./chunk-7SAEZ4NC.js";import"./chunk-LUX4PBJL.js";import"./chunk-OPORM35X.js";import"./chunk-4SAVH3H7.js";import{isAPIError}from"./chunk-YCJHUYBJ.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-DWOJP4ST.js";import"./chunk-BLUPZPAS.js";import"./chunk-RM3ZDRYE.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-OO572JUC.js";import{getFlagsSpecification}from"./chunk-A2UZ2O7H.js";import"./chunk-2BKALEOP.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-FBYA6LLM.js";import"./chunk-SCV7XEEO.js";import"./chunk-MY4MONOH.js";import"./chunk-BZENIQ7N.js";var USAGE="vcr update <repository> --public";async function config(client,argv,telemetry){let rewritten=rewriteLegacyOnOffValues(argv,configSubcommand.options,client),parsedArgs;try{parsedArgs=parseArguments("error"in rewritten?argv:rewritten.args,getFlagsSpecification(configSubcommand.options))}catch(err){return emitVcrArgParseError(client,err,USAGE),printError(err),2}let fr=validateVcrJsonOutput(client,parsedArgs.flags);if(typeof fr=="number")return fr;if("error"in rewritten)return outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message:rewritten.error},2),outputError(client,fr.jsonOutput,"INVALID_ARGUMENTS",rewritten.error);let repository=parsedArgs.args[0],project=parsedArgs.flags["--project"],visibility=readOnOffOption(client,parsedArgs.flags,{on:"--public",off:"--no-public"});if("error"in visibility){let err=new Error(visibility.error);return emitVcrArgParseError(client,err,USAGE),outputError(client,fr.jsonOutput,"INVALID_ARGUMENTS",visibility.error)}let desiredPublic=visibility.value;telemetry.trackCliOptionProject(project),telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]),telemetry.trackCliOptionPublic(rewritten.legacy.get("--public")),rewritten.legacy.has("--public")||(telemetry.trackCliFlagPublic(parsedArgs.flags["--public"]),telemetry.trackCliFlagNoPublic(parsedArgs.flags["--no-public"]));let missingRepository=requireVcrRepository(client,repository,fr.jsonOutput,USAGE);if(typeof missingRepository=="number")return missingRepository;if(parsedArgs.args.length>1){let message="`vcr update` takes one repository. Pass --public or --no-public without a value.";return outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message,next:[{command:buildCommandWithGlobalFlags(client.argv,USAGE),when:"Re-run with one repository"}]},2),outputError(client,fr.jsonOutput,"INVALID_ARGUMENTS",message)}if(desiredPublic===void 0){let message="Missing a setting to change. Pass --public to make the repository public, or --no-public to make it private.";return outputAgentError(client,{status:"error",reason:AGENT_REASON.MISSING_ARGUMENTS,message,next:[{command:buildCommandWithGlobalFlags(client.argv,USAGE),when:"Re-run with --public or --no-public"}]},2),outputError(client,fr.jsonOutput,"MISSING_ARGUMENTS",message)}let scope=await resolveVcrScope(client,{project,jsonOutput:fr.jsonOutput});if(typeof scope=="number")return scope;let path=repositoryPath(scope,repository);output_manager_default.spinner("Updating repository...");try{let updated=await client.fetch(path,{method:"PATCH",body:{public:desiredPublic}});if(fr.jsonOutput)client.stdout.write(`${JSON.stringify(updated,null,2)}
8
- `);else{let isPublic=updated.repository?.public??desiredPublic;output_manager_default.success(`Repository ${updated.repository?.name??repository} is now ${isPublic?"public":"private"}`)}return 0}catch(err){if(isAPIError(err))return handleVcrApiError(client,err,fr.jsonOutput,{retry:{command:buildCommandWithGlobalFlags(client.argv,"vcr ls"),when:"List repositories to confirm the name or id"}});throw err}finally{output_manager_default.stopSpinner()}}export{config as default};
@@ -1,10 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{getRouteVersions}from"./chunk-BVH2AEFE.js";import{getRouteTypeLabel,getRoutes,offerAutoPromote,parseSubcommandArgs,resolveRoutes,withGlobalFlags}from"./chunk-WZAJYSJZ.js";import{requireProjectContext}from"./chunk-2KINJIWA.js";import"./chunk-RNTS4MJP.js";import"./chunk-MJ7JIQL3.js";import{stamp_default}from"./chunk-A2RZZQEP.js";import"./chunk-Q7D7RGXM.js";import{deleteSubcommand}from"./chunk-O7COT3YB.js";import"./chunk-LCMNJNSQ.js";import"./chunk-GKCTMBCM.js";import"./chunk-MXTC4ZAQ.js";import{AGENT_REASON,AGENT_STATUS,outputAgentError}from"./chunk-I7U2XP4X.js";import"./chunk-EPO7P734.js";import"./chunk-TKKGZI7O.js";import"./chunk-26QK3I2S.js";import"./chunk-55H6G46X.js";import"./chunk-4NTBYNFR.js";import"./chunk-F22QLVTX.js";import"./chunk-F53OKXYI.js";import"./chunk-7SAEZ4NC.js";import"./chunk-LUX4PBJL.js";import"./chunk-OPORM35X.js";import"./chunk-4SAVH3H7.js";import"./chunk-YCJHUYBJ.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-DWOJP4ST.js";import"./chunk-BLUPZPAS.js";import"./chunk-RM3ZDRYE.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-OO572JUC.js";import"./chunk-A2UZ2O7H.js";import"./chunk-2BKALEOP.js";import{require_source}from"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-MY4MONOH.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);async function deleteRoutes(client,projectId,routeIds,options={}){let{teamId}=options,query=new URLSearchParams;teamId&&query.set("teamId",teamId);let queryString=query.toString(),url=`/v1/projects/${projectId}/routes${queryString?`?${queryString}`:""}`;return await client.fetch(url,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({routeIds})})}async function deleteRoute(client,argv){let parsed=await parseSubcommandArgs(argv,deleteSubcommand,client);if(typeof parsed=="number")return parsed;let link=await requireProjectContext(client,"routes",parsed.flags["--project"]);if(typeof link=="number")return link;let{project,org}=link,teamId=org.type==="team"?org.id:void 0,{args,flags}=parsed,skipConfirmation=flags["--yes"];if(args.length===0)return client.nonInteractive&&outputAgentError(client,{status:AGENT_STATUS.ERROR,reason:AGENT_REASON.MISSING_ARGUMENTS,message:"At least one route name or ID is required.",next:[{command:withGlobalFlags(client,"routes remove <name-or-id> --yes"),when:"pass one or more ids/names and --yes to skip confirm"}]},2),output_manager_default.error(`At least one route name or ID is required. Usage: ${withGlobalFlags(client,"routes remove <name-or-id> [...]")}`),2;let{versions}=await getRouteVersions(client,project.id,{teamId}),existingStagingVersion=versions.find(v=>v.isStaging);output_manager_default.spinner("Fetching routes");let{routes}=await getRoutes(client,project.id,{teamId});if(output_manager_default.stopSpinner(),routes.length===0)return client.nonInteractive&&outputAgentError(client,{status:AGENT_STATUS.ERROR,reason:AGENT_REASON.NOT_FOUND,message:"No routes found in this project."},1),output_manager_default.error("No routes found in this project."),1;let resolved=await resolveRoutes(client,routes,args);if(!resolved)return 1;output_manager_default.print(`
8
- `),output_manager_default.log(`The following ${resolved.length===1?"route":`${resolved.length} routes`} will be removed:`);for(let route of resolved){let typeLabels=getRouteTypeLabel(route);output_manager_default.print(` ${import_chalk.default.red("\xD7")} ${route.name} ${import_chalk.default.gray(`(${route.route.src})`)} ${import_chalk.default.gray(`[${typeLabels}]`)}
9
- `)}if(output_manager_default.print(`
10
- `),!skipConfirmation&&(client.nonInteractive&&outputAgentError(client,{status:AGENT_STATUS.ERROR,reason:AGENT_REASON.CONFIRMATION_REQUIRED,message:"Removing routes requires confirmation. Pass --yes to skip the prompt in non-interactive mode.",next:[{command:withGlobalFlags(client,`routes remove ${args.join(" ")} --yes`),when:"re-run with --yes to confirm without prompt"}]},1),!await client.input.confirm(`Remove ${resolved.length===1?"this route":`these ${resolved.length} routes`}?`,!1)))return output_manager_default.log("Aborted."),0;let deleteStamp=stamp_default();output_manager_default.spinner(`Removing ${resolved.length===1?"route":`${resolved.length} routes`}`);try{let{deletedCount,version}=await deleteRoutes(client,project.id,resolved.map(r=>r.id),{teamId});return output_manager_default.log(`${import_chalk.default.cyan("Removed")} ${deletedCount} ${deletedCount===1?"route":"routes"} ${import_chalk.default.gray(deleteStamp())}`),await offerAutoPromote(client,project.id,version,!!existingStagingVersion,{teamId,skipPrompts:skipConfirmation}),0}catch(e){let error=e;return client.nonInteractive&&outputAgentError(client,{status:AGENT_STATUS.ERROR,reason:AGENT_REASON.API_ERROR,message:"Failed to remove routes for this project. See hint for error details.",hint:error.message||"Retry with the same command once transient issues are resolved."},1),output_manager_default.error(error.message||"Failed to remove routes"),1}}export{deleteRoute as default};
@@ -1,9 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{parseThreadArg}from"./chunk-2S6PE6GB.js";import{deleteMessage,handleCommentsParseError,resolveCommentsScope,threadNotFoundMessage,toApiErrorParts}from"./chunk-EOK43KMC.js";import"./chunk-RNTS4MJP.js";import{outputError}from"./chunk-XSQVCDSD.js";import"./chunk-MJ7JIQL3.js";import{canPrompt}from"./chunk-IQ7FPAI4.js";import{deleteSubcommand}from"./chunk-OTYF3ZZW.js";import"./chunk-LCMNJNSQ.js";import"./chunk-GKCTMBCM.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-I7U2XP4X.js";import"./chunk-EPO7P734.js";import"./chunk-TKKGZI7O.js";import"./chunk-26QK3I2S.js";import"./chunk-55H6G46X.js";import"./chunk-4NTBYNFR.js";import{parseArguments}from"./chunk-F22QLVTX.js";import"./chunk-F53OKXYI.js";import{validateJsonOutput}from"./chunk-7SAEZ4NC.js";import"./chunk-LUX4PBJL.js";import"./chunk-OPORM35X.js";import"./chunk-4SAVH3H7.js";import{isAPIError}from"./chunk-YCJHUYBJ.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-DWOJP4ST.js";import"./chunk-BLUPZPAS.js";import"./chunk-RM3ZDRYE.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-OO572JUC.js";import{getFlagsSpecification}from"./chunk-A2UZ2O7H.js";import"./chunk-2BKALEOP.js";import{require_source}from"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-MY4MONOH.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);async function deleteCommentMessage(client,telemetry){let parsedArgs,flagsSpecification=getFlagsSpecification(deleteSubcommand.options);try{parsedArgs=parseArguments(client.argv.slice(2),flagsSpecification)}catch(err){return handleCommentsParseError(err,"delete")}let formatResult=validateJsonOutput(parsedArgs.flags);if(!formatResult.valid)return output_manager_default.error(formatResult.error),2;let jsonOutput=formatResult.jsonOutput,yes=!!parsedArgs.flags["--yes"];telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]),telemetry.trackCliFlagYes(parsedArgs.flags["--yes"]);let[threadInput,messageId]=parsedArgs.args.slice(2);if(telemetry.trackCliArgumentThread(threadInput),telemetry.trackCliArgumentMessageId(messageId),!threadInput||!messageId)return outputError(client,jsonOutput,"MISSING_ARGUMENT","Usage: `vercel comments delete <thread> <message-id>` \u2014 message IDs are shown in `vercel comments inspect`.");let threadRef=parseThreadArg(threadInput);if(!threadRef)return outputError(client,jsonOutput,"INVALID_THREAD",`Could not extract a thread ID from "${threadInput}".`);let threadId=threadRef.id,scope=await resolveCommentsScope(client,{project:parsedArgs.flags["--project"],requireProject:!1,jsonOutput,urlTeamSlug:threadRef.teamSlug});if(typeof scope=="number")return scope;if(!yes){if(!canPrompt(client)||jsonOutput)return outputError(client,jsonOutput,"CONFIRMATION_REQUIRED","Pass --yes to delete the message non-interactively.");if(!await client.input.confirm(`${import_chalk.default.red("Delete")} message ${messageId} from ${threadId} in team ${scope.teamSlug??scope.teamId}? This cannot be undone.`,!1))return output_manager_default.log("Canceled."),0}telemetry.trackCliOptionProject(parsedArgs.flags["--project"]);try{let result=await deleteMessage(client,scope.teamId,threadId,messageId);return jsonOutput?(client.stdout.write(`${JSON.stringify(result,null,2)}
8
- `),0):(output_manager_default.print(`${import_chalk.default.green("\u2713")} Deleted message ${messageId}
9
- `),0)}catch(err){if(isAPIError(err)){let{code,message}=toApiErrorParts(err);return outputError(client,jsonOutput,code,err.status===404?threadNotFoundMessage(threadId,scope):message)}throw err}}export{deleteCommentMessage as default};
@@ -1,7 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{getServicesConfigWriteBlocker,isExperimentalServicesEnabled,loadVercelConfig,tryDetectServices,writeServicesConfig}from"./chunk-FSBAVQQP.js";import"./chunk-OS5I5TXU.js";import"./chunk-DCX2PBSX.js";import"./chunk-OCR5CRTH.js";import"./chunk-6Y2ZL5XJ.js";import"./chunk-VKJVYR4T.js";import"./chunk-25565AGS.js";import"./chunk-UWGWRZP5.js";import"./chunk-7EJQLVWX.js";import"./chunk-U4Z2MMOF.js";import"./chunk-TKKGZI7O.js";import"./chunk-26QK3I2S.js";import"./chunk-55H6G46X.js";import"./chunk-4NTBYNFR.js";import"./chunk-F22QLVTX.js";import"./chunk-F53OKXYI.js";import"./chunk-7SAEZ4NC.js";import"./chunk-LUX4PBJL.js";import"./chunk-OPORM35X.js";import"./chunk-4SAVH3H7.js";import"./chunk-YCJHUYBJ.js";import"./chunk-JESNVRVR.js";import"./chunk-DWOJP4ST.js";import"./chunk-BLUPZPAS.js";import"./chunk-RM3ZDRYE.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-OO572JUC.js";import"./chunk-A2UZ2O7H.js";import"./chunk-2BKALEOP.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-SCV7XEEO.js";import"./chunk-MY4MONOH.js";import"./chunk-BZENIQ7N.js";export{getServicesConfigWriteBlocker,isExperimentalServicesEnabled,loadVercelConfig,tryDetectServices,writeServicesConfig};
@@ -1,7 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{editRoute}from"./chunk-AM46JVVN.js";import{getRouteVersions}from"./chunk-BVH2AEFE.js";import{getRoutes,offerAutoPromote,parseSubcommandArgs,resolveRoute,withGlobalFlags}from"./chunk-WZAJYSJZ.js";import{requireProjectContext}from"./chunk-2KINJIWA.js";import"./chunk-RNTS4MJP.js";import"./chunk-MJ7JIQL3.js";import{stamp_default}from"./chunk-A2RZZQEP.js";import"./chunk-Q7D7RGXM.js";import{disableSubcommand}from"./chunk-O7COT3YB.js";import"./chunk-LCMNJNSQ.js";import"./chunk-GKCTMBCM.js";import"./chunk-MXTC4ZAQ.js";import{outputAgentError}from"./chunk-I7U2XP4X.js";import"./chunk-EPO7P734.js";import"./chunk-TKKGZI7O.js";import"./chunk-26QK3I2S.js";import"./chunk-55H6G46X.js";import"./chunk-4NTBYNFR.js";import"./chunk-F22QLVTX.js";import"./chunk-F53OKXYI.js";import"./chunk-7SAEZ4NC.js";import"./chunk-LUX4PBJL.js";import"./chunk-OPORM35X.js";import"./chunk-4SAVH3H7.js";import"./chunk-YCJHUYBJ.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-DWOJP4ST.js";import"./chunk-BLUPZPAS.js";import"./chunk-RM3ZDRYE.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-OO572JUC.js";import"./chunk-A2UZ2O7H.js";import"./chunk-2BKALEOP.js";import{require_source}from"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-MY4MONOH.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);async function disable(client,argv){let parsed=await parseSubcommandArgs(argv,disableSubcommand,client);if(typeof parsed=="number")return parsed;let link=await requireProjectContext(client,"routes",parsed.flags["--project"]);if(typeof link=="number")return link;let{project,org}=link,teamId=org.type==="team"?org.id:void 0,{args}=parsed,identifier=args[0];if(!identifier)return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"missing_arguments",message:"Route name or ID is required.",next:[{command:withGlobalFlags(client,"routes disable <name-or-id>"),when:"replace <name-or-id>"},{command:withGlobalFlags(client,"routes list"),when:"list routes"}]},2),output_manager_default.error(`Route name or ID is required. Usage: ${withGlobalFlags(client,"routes disable <name-or-id>")}`),2;let{versions}=await getRouteVersions(client,project.id,{teamId}),existingStagingVersion=versions.find(v=>v.isStaging);output_manager_default.spinner("Fetching routes");let{routes}=await getRoutes(client,project.id,{teamId});if(output_manager_default.stopSpinner(),routes.length===0)return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"not_found",message:"No routes found in this project."},1),output_manager_default.error("No routes found in this project."),1;let route=await resolveRoute(client,routes,identifier);if(!route)return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"not_found",message:`No route found matching "${identifier}".`,next:[{command:withGlobalFlags(client,"routes list"),when:"list routes"}]},1),output_manager_default.error(`No route found matching "${identifier}". Run ${import_chalk.default.cyan(withGlobalFlags(client,"routes list"))} to see all routes.`),1;if(route.enabled===!1)return output_manager_default.log(`Route "${route.name}" is already disabled.`),0;let disableStamp=stamp_default();output_manager_default.spinner(`Disabling route "${route.name}"`);try{let{version}=await editRoute(client,project.id,route.id,{route:{name:route.name,description:route.description,enabled:!1,srcSyntax:route.srcSyntax,route:route.route}},{teamId});return output_manager_default.log(`${import_chalk.default.cyan("Disabled")} route "${route.name}" ${import_chalk.default.gray(disableStamp())}`),await offerAutoPromote(client,project.id,version,!!existingStagingVersion,{teamId}),0}catch(e){let error=e;return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"api_error",message:error.message||"Failed to disable route"},1),output_manager_default.error(error.message||"Failed to disable route"),1}}export{disable as default};
@@ -1,14 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{updateRouteVersion}from"./chunk-6QKS6QK7.js";import{getRouteVersions}from"./chunk-BVH2AEFE.js";import{confirmAction,getRoutes,parseSubcommandArgs,printDiffSummary,withGlobalFlags}from"./chunk-WZAJYSJZ.js";import{requireProjectContext}from"./chunk-2KINJIWA.js";import"./chunk-RNTS4MJP.js";import"./chunk-MJ7JIQL3.js";import{stamp_default}from"./chunk-A2RZZQEP.js";import"./chunk-Q7D7RGXM.js";import{discardSubcommand}from"./chunk-O7COT3YB.js";import"./chunk-LCMNJNSQ.js";import"./chunk-GKCTMBCM.js";import"./chunk-MXTC4ZAQ.js";import{outputAgentError}from"./chunk-I7U2XP4X.js";import"./chunk-EPO7P734.js";import"./chunk-TKKGZI7O.js";import"./chunk-26QK3I2S.js";import"./chunk-55H6G46X.js";import"./chunk-4NTBYNFR.js";import"./chunk-F22QLVTX.js";import"./chunk-F53OKXYI.js";import"./chunk-7SAEZ4NC.js";import"./chunk-LUX4PBJL.js";import"./chunk-OPORM35X.js";import"./chunk-4SAVH3H7.js";import"./chunk-YCJHUYBJ.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-DWOJP4ST.js";import"./chunk-BLUPZPAS.js";import"./chunk-RM3ZDRYE.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-OO572JUC.js";import"./chunk-A2UZ2O7H.js";import"./chunk-2BKALEOP.js";import{require_source}from"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-MY4MONOH.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);async function discard(client,argv){let parsed=await parseSubcommandArgs(argv,discardSubcommand,client);if(typeof parsed=="number")return parsed;let link=await requireProjectContext(client,"routes",parsed.flags["--project"]);if(typeof link=="number")return link;let{project,org}=link,teamId=org.type==="team"?org.id:void 0;output_manager_default.spinner(`Fetching route versions for ${import_chalk.default.bold(project.name)}`);let{versions}=await getRouteVersions(client,project.id,{teamId}),stagingVersion=versions.find(v=>v.isStaging);if(!stagingVersion)return output_manager_default.warn(`No staged changes to discard. Make changes first with ${import_chalk.default.cyan(withGlobalFlags(client,"routes add"))}.`),0;output_manager_default.spinner("Fetching staged changes");let{routes:diffRoutes}=await getRoutes(client,project.id,{teamId,versionId:stagingVersion.id,diff:!0}),changedRoutes=diffRoutes.filter(r=>r.action!==void 0);if(changedRoutes.length>0?(output_manager_default.print(`
8
- ${import_chalk.default.bold("Changes to be discarded:")}
9
-
10
- `),printDiffSummary(changedRoutes),output_manager_default.print(`
11
- `)):output_manager_default.print(`
12
- ${import_chalk.default.gray("No changes detected in staging version.")}
13
-
14
- `),!await confirmAction(client,parsed.flags["--yes"],"Discard all staged changes?","This action cannot be undone."))return output_manager_default.log("Canceled"),0;let updateStamp=stamp_default();output_manager_default.spinner("Discarding staged changes");try{return await updateRouteVersion(client,project.id,stagingVersion.id,"discard",{teamId}),output_manager_default.log(`${import_chalk.default.cyan("Success!")} Staged changes discarded ${import_chalk.default.gray(updateStamp())}`),0}catch(e){let msg=e.message||"Failed to discard staged changes";return client.nonInteractive?(outputAgentError(client,{status:"error",reason:"api_error",message:msg,next:[{command:withGlobalFlags(client,"routes discard --yes")}]}),process.exit(1),1):(output_manager_default.error(msg),1)}}export{discard as default};
@@ -1,9 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{resolveMessageContent}from"./chunk-DSY2S2YT.js";import{parseThreadArg}from"./chunk-2S6PE6GB.js";import{handleCommentsParseError,resolveCommentsScope,threadNotFoundMessage,toApiErrorParts,updateMessage}from"./chunk-EOK43KMC.js";import"./chunk-RNTS4MJP.js";import{outputError}from"./chunk-XSQVCDSD.js";import"./chunk-MJ7JIQL3.js";import"./chunk-IQ7FPAI4.js";import{editSubcommand}from"./chunk-OTYF3ZZW.js";import"./chunk-LCMNJNSQ.js";import"./chunk-GKCTMBCM.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-I7U2XP4X.js";import"./chunk-EPO7P734.js";import"./chunk-TKKGZI7O.js";import"./chunk-26QK3I2S.js";import"./chunk-55H6G46X.js";import"./chunk-4NTBYNFR.js";import{parseArguments}from"./chunk-F22QLVTX.js";import"./chunk-F53OKXYI.js";import{validateJsonOutput}from"./chunk-7SAEZ4NC.js";import"./chunk-LUX4PBJL.js";import"./chunk-OPORM35X.js";import"./chunk-4SAVH3H7.js";import{isAPIError}from"./chunk-YCJHUYBJ.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-DWOJP4ST.js";import"./chunk-BLUPZPAS.js";import"./chunk-RM3ZDRYE.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-OO572JUC.js";import{getFlagsSpecification}from"./chunk-A2UZ2O7H.js";import"./chunk-2BKALEOP.js";import{require_source}from"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-MY4MONOH.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);async function edit(client,telemetry){let parsedArgs,flagsSpecification=getFlagsSpecification(editSubcommand.options);try{parsedArgs=parseArguments(client.argv.slice(2),flagsSpecification)}catch(err){return handleCommentsParseError(err,"update")}let formatResult=validateJsonOutput(parsedArgs.flags);if(!formatResult.valid)return output_manager_default.error(formatResult.error),2;let jsonOutput=formatResult.jsonOutput;telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]),telemetry.trackCliOptionMessage(parsedArgs.flags["--message"]),telemetry.trackCliOptionFile(parsedArgs.flags["--file"]);let[threadInput,messageId]=parsedArgs.args.slice(2);if(telemetry.trackCliArgumentThread(threadInput),telemetry.trackCliArgumentMessageId(messageId),!threadInput||!messageId)return outputError(client,jsonOutput,"MISSING_ARGUMENT","Usage: `vercel comments update <thread> <message-id> --message <text>` \u2014 message IDs are shown in `vercel comments inspect`.");let threadRef=parseThreadArg(threadInput);if(!threadRef)return outputError(client,jsonOutput,"INVALID_THREAD",`Could not extract a thread ID from "${threadInput}".`);let threadId=threadRef.id,content=await resolveMessageContent(client,{message:parsedArgs.flags["--message"],file:parsedArgs.flags["--file"]},jsonOutput);if(typeof content=="number")return content;if(content===void 0)return outputError(client,jsonOutput,"MISSING_CONTENT","Pass the new content with --message <text> or --file <path>.");telemetry.trackCliOptionProject(parsedArgs.flags["--project"]);let scope=await resolveCommentsScope(client,{project:parsedArgs.flags["--project"],requireProject:!1,jsonOutput,urlTeamSlug:threadRef.teamSlug});if(typeof scope=="number")return scope;try{let message=await updateMessage(client,scope.teamId,threadId,messageId,{markdown:content});return jsonOutput?(client.stdout.write(`${JSON.stringify(message,null,2)}
8
- `),0):(output_manager_default.print(`${import_chalk.default.green("\u2713")} Updated message ${messageId}
9
- `),0)}catch(err){if(isAPIError(err)){let{code,message}=toApiErrorParts(err);return outputError(client,jsonOutput,code,err.status===404?threadNotFoundMessage(threadId,scope):message)}throw err}}export{edit as default};