vercel 59.14.0 → 59.15.0

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 (459) hide show
  1. package/dist/chunks/add-7XFD2OHW.js +8 -0
  2. package/dist/chunks/add-HZC7AUBY.js +8 -0
  3. package/dist/chunks/add-PYUNJZ6K.js +8 -0
  4. package/dist/chunks/build-EFKQ6BND.js +7 -0
  5. package/dist/chunks/chunk-2B2MN3U5.js +8 -0
  6. package/dist/chunks/chunk-2H77IRPI.js +9 -0
  7. package/dist/chunks/chunk-2I64AYHG.js +7 -0
  8. package/dist/chunks/chunk-2PPXY24N.js +20 -0
  9. package/dist/chunks/chunk-2S6PE6GB.js +7 -0
  10. package/dist/chunks/{chunk-PIMIVJYK.js → chunk-3FMJYJUR.js} +7 -32
  11. package/dist/chunks/chunk-3IAQUNQH.js +7 -0
  12. package/dist/chunks/chunk-3QHJYVCY.js +7 -0
  13. package/dist/chunks/chunk-3QT7VOE3.js +7 -0
  14. package/dist/chunks/chunk-3TXEXPUW.js +7 -0
  15. package/dist/chunks/chunk-4MZK6JT6.js +7 -0
  16. package/dist/chunks/chunk-4NE5IQ25.js +7 -0
  17. package/dist/chunks/chunk-4PNSSS3L.js +7 -0
  18. package/dist/chunks/chunk-4QX77CP7.js +7 -0
  19. package/dist/chunks/chunk-57GHYR4Y.js +25 -0
  20. package/dist/chunks/chunk-5QQNYN4N.js +7 -0
  21. package/dist/chunks/chunk-5XJNPXQK.js +7 -0
  22. package/dist/chunks/chunk-6L236MNA.js +7 -0
  23. package/dist/chunks/chunk-6PFC3KWQ.js +7 -0
  24. package/dist/chunks/chunk-6QKS6QK7.js +7 -0
  25. package/dist/chunks/chunk-6RIQPTJA.js +8 -0
  26. package/dist/chunks/chunk-6TAQ6OWD.js +13 -0
  27. package/dist/chunks/chunk-6YAADRQB.js +9 -0
  28. package/dist/chunks/chunk-75CPY75D.js +15 -0
  29. package/dist/chunks/chunk-7HL2RPUO.js +7 -0
  30. package/dist/chunks/chunk-7PNYOSDU.js +9 -0
  31. package/dist/chunks/chunk-7R5FEXZ5.js +7 -0
  32. package/dist/chunks/chunk-7RMCBXBB.js +62 -0
  33. package/dist/chunks/chunk-7RR7MIMT.js +7 -0
  34. package/dist/chunks/chunk-7T6TL3GQ.js +7 -0
  35. package/dist/chunks/chunk-ADUYPK2G.js +13 -0
  36. package/dist/chunks/chunk-AFPOIDM5.js +7 -0
  37. package/dist/chunks/chunk-AM46JVVN.js +7 -0
  38. package/dist/chunks/chunk-AVSPFBLM.js +7 -0
  39. package/dist/chunks/chunk-B4ATVYZW.js +7 -0
  40. package/dist/chunks/chunk-BATE73HA.js +9 -0
  41. package/dist/chunks/{chunk-64IF634X.js → chunk-BRK4OB4B.js} +1 -12
  42. package/dist/chunks/chunk-BVH2AEFE.js +7 -0
  43. package/dist/chunks/chunk-CN2QZO4U.js +7 -0
  44. package/dist/chunks/chunk-COQGD2EI.js +8 -0
  45. package/dist/chunks/chunk-CUAIEGNE.js +7 -0
  46. package/dist/chunks/chunk-CVKB54WW.js +7 -0
  47. package/dist/chunks/{chunk-A3NYPUKZ.js → chunk-CZSOZKHX.js} +1 -11
  48. package/dist/chunks/chunk-D4MW3RDW.js +7 -0
  49. package/dist/chunks/chunk-DFVNL5ML.js +7 -0
  50. package/dist/chunks/chunk-EE3FVJLV.js +16 -0
  51. package/dist/chunks/chunk-EGMJRU5P.js +28 -0
  52. package/dist/chunks/chunk-ENBTTYJR.js +7 -0
  53. package/dist/chunks/chunk-ENS6KX2F.js +7 -0
  54. package/dist/chunks/chunk-EOBD4ZEG.js +8 -0
  55. package/dist/chunks/chunk-EOCTK4EA.js +7 -0
  56. package/dist/chunks/chunk-EQ52F4LH.js +7 -0
  57. package/dist/chunks/chunk-ETV3C2CV.js +7 -0
  58. package/dist/chunks/chunk-EVZRQGNK.js +7 -0
  59. package/dist/chunks/chunk-F2ZWW2IO.js +8 -0
  60. package/dist/chunks/chunk-FAW6NBLQ.js +7 -0
  61. package/dist/chunks/chunk-FI772UVH.js +7 -0
  62. package/dist/chunks/chunk-FKCOBJFH.js +7 -0
  63. package/dist/chunks/chunk-FVGESGJI.js +45 -0
  64. package/dist/chunks/chunk-G5FC5ZCO.js +9 -0
  65. package/dist/chunks/chunk-G6CTAHKY.js +39 -0
  66. package/dist/chunks/chunk-G7Y77DFH.js +7 -0
  67. package/dist/chunks/chunk-GHAY4PSD.js +7 -0
  68. package/dist/chunks/chunk-GHM7V3GG.js +7 -0
  69. package/dist/chunks/chunk-GRNTLNC7.js +7 -0
  70. package/dist/chunks/chunk-GTRGQIY2.js +10 -0
  71. package/dist/chunks/chunk-GU6VIFR5.js +7 -0
  72. package/dist/chunks/{constants-YMCRE6IG.js → chunk-GZNDA6SV.js} +2 -9
  73. package/dist/chunks/chunk-HBFPLBTX.js +10 -0
  74. package/dist/chunks/chunk-HEGJZJO7.js +7 -0
  75. package/dist/chunks/chunk-HSJ6AHWG.js +12 -0
  76. package/dist/chunks/chunk-HTC6KO2B.js +7 -0
  77. package/dist/chunks/chunk-HVUHCRZB.js +18 -0
  78. package/dist/chunks/chunk-HZZ5L472.js +7 -0
  79. package/dist/chunks/chunk-IVSSTHB6.js +7 -0
  80. package/dist/chunks/chunk-IVWPQYIH.js +7 -0
  81. package/dist/chunks/chunk-J3U3L45Y.js +7 -0
  82. package/dist/chunks/chunk-JAJW3P42.js +7 -0
  83. package/dist/chunks/chunk-JEIMW3CO.js +7 -0
  84. package/dist/chunks/chunk-JIYY3B4C.js +7 -0
  85. package/dist/chunks/chunk-JKTQV2QJ.js +7 -0
  86. package/dist/chunks/chunk-JTVVBRW7.js +7 -0
  87. package/dist/chunks/chunk-JYAUUIR4.js +7 -0
  88. package/dist/chunks/chunk-JZRMH5UA.js +7 -0
  89. package/dist/chunks/chunk-K2RAW5DI.js +10 -0
  90. package/dist/chunks/chunk-K3KJZLBD.js +7 -0
  91. package/dist/chunks/chunk-KK4AJES5.js +36 -0
  92. package/dist/chunks/chunk-KKS7XWEX.js +7 -0
  93. package/dist/chunks/chunk-KNEWCUWF.js +14 -0
  94. package/dist/chunks/chunk-KO733OJG.js +9 -0
  95. package/dist/chunks/chunk-L243RUIR.js +19 -0
  96. package/dist/chunks/chunk-L3JDEHCQ.js +7 -0
  97. package/dist/chunks/chunk-LDM3SQAU.js +13 -0
  98. package/dist/chunks/chunk-LNPMDXBJ.js +7 -0
  99. package/dist/chunks/chunk-M2W3HKV3.js +23 -0
  100. package/dist/chunks/chunk-M2XARQBF.js +9 -0
  101. package/dist/chunks/chunk-M5AV545M.js +7 -0
  102. package/dist/chunks/chunk-MAVRGZQP.js +7 -0
  103. package/dist/chunks/chunk-MBL6TXEJ.js +7 -0
  104. package/dist/chunks/chunk-MEAY2K5Z.js +11 -0
  105. package/dist/chunks/chunk-MY4MONOH.js +7 -0
  106. package/dist/chunks/chunk-N3N5UHIL.js +7 -0
  107. package/dist/chunks/chunk-N3ZZ7FHQ.js +7 -0
  108. package/dist/chunks/chunk-N6CNMMSZ.js +7 -0
  109. package/dist/chunks/chunk-NBVY237X.js +7 -0
  110. package/dist/chunks/chunk-NGNOUPWS.js +25 -0
  111. package/dist/chunks/chunk-NHTF332K.js +7 -0
  112. package/dist/chunks/chunk-NNP5NITU.js +15 -0
  113. package/dist/chunks/chunk-NS4FH2TY.js +11 -0
  114. package/dist/chunks/chunk-NUGLE4QY.js +11 -0
  115. package/dist/chunks/chunk-NWFHHUKZ.js +7 -0
  116. package/dist/chunks/chunk-O7G3CZ42.js +7 -0
  117. package/dist/chunks/chunk-OD6RZ3XZ.js +8 -0
  118. package/dist/chunks/chunk-OHDEHZLX.js +7 -0
  119. package/dist/chunks/chunk-OK3S6KFX.js +16 -0
  120. package/dist/chunks/chunk-OKZDOANA.js +23 -0
  121. package/dist/chunks/chunk-OSCCYU74.js +7 -0
  122. package/dist/chunks/chunk-OUHPDA7Q.js +7 -0
  123. package/dist/chunks/chunk-P2O5DOYE.js +7 -0
  124. package/dist/chunks/chunk-PHW54NU5.js +13 -0
  125. package/dist/chunks/chunk-PPCFQQSU.js +7 -0
  126. package/dist/chunks/chunk-QGIGNMII.js +8 -0
  127. package/dist/chunks/chunk-QGIQK47P.js +7 -0
  128. package/dist/chunks/chunk-QHJLRTVY.js +7 -0
  129. package/dist/chunks/{chunk-2473DUBR.js → chunk-QR7QPUFN.js} +1 -9
  130. package/dist/chunks/chunk-QTKJC2O5.js +7 -0
  131. package/dist/chunks/chunk-R2TGGVCT.js +19 -0
  132. package/dist/chunks/chunk-RAIBQIKB.js +7 -0
  133. package/dist/chunks/chunk-RCTYVKM5.js +16 -0
  134. package/dist/chunks/chunk-RKAUVPOQ.js +86 -0
  135. package/dist/chunks/chunk-S5CEIACD.js +7 -0
  136. package/dist/chunks/chunk-SGWVKRSR.js +8 -0
  137. package/dist/chunks/chunk-SOJCELXH.js +7 -0
  138. package/dist/chunks/chunk-SXUEGVWB.js +7 -0
  139. package/dist/chunks/{chunk-GGPE5377.js → chunk-T3GQAMBJ.js} +1 -9
  140. package/dist/chunks/chunk-T52FMXWC.js +7 -0
  141. package/dist/chunks/chunk-TG2RCYTH.js +7 -0
  142. package/dist/chunks/chunk-TJCIHDPZ.js +9 -0
  143. package/dist/chunks/chunk-TKBXN4H3.js +9 -0
  144. package/dist/chunks/chunk-TRTEXGVN.js +7 -0
  145. package/dist/chunks/chunk-TXELFFNK.js +15 -0
  146. package/dist/chunks/chunk-U56NHYAH.js +7 -0
  147. package/dist/chunks/chunk-U7KCDTCH.js +12 -0
  148. package/dist/chunks/chunk-UETTIYUQ.js +8 -0
  149. package/dist/chunks/chunk-UGMZQZJE.js +24 -0
  150. package/dist/chunks/chunk-ULLWCOYC.js +7 -0
  151. package/dist/chunks/chunk-UXTHEQVJ.js +21 -0
  152. package/dist/chunks/chunk-VLZ47RWM.js +44 -0
  153. package/dist/chunks/chunk-WKZ6JSGZ.js +7 -0
  154. package/dist/chunks/chunk-WPS6JZF6.js +7 -0
  155. package/dist/chunks/chunk-WRILLB46.js +7 -0
  156. package/dist/chunks/chunk-WUZD4KBL.js +7 -0
  157. package/dist/chunks/chunk-XCJDGQO7.js +7 -0
  158. package/dist/chunks/{pkg-56KRLZ5K.js → chunk-XD2LZRBS.js} +1 -7
  159. package/dist/chunks/chunk-XFVGX5HG.js +7 -0
  160. package/dist/chunks/chunk-XHOGOH6N.js +7 -0
  161. package/dist/chunks/{update-route-version-E3V47KNI.js → chunk-XPXOV5UO.js} +1 -7
  162. package/dist/chunks/chunk-XQ73QIQ3.js +7 -0
  163. package/dist/chunks/chunk-XSVBYDYI.js +8 -0
  164. package/dist/chunks/chunk-YKZLKOOD.js +12 -0
  165. package/dist/chunks/chunk-YMVDWVMO.js +7 -0
  166. package/dist/chunks/chunk-YPTLSODC.js +7 -0
  167. package/dist/chunks/chunk-YV6CTDHR.js +7 -0
  168. package/dist/chunks/chunk-Z6Y55QJW.js +23 -0
  169. package/dist/chunks/chunk-ZDX75YNZ.js +7 -0
  170. package/dist/chunks/chunk-ZIPVX7LD.js +7 -0
  171. package/dist/chunks/chunk-ZKYS7EAB.js +7 -0
  172. package/dist/chunks/chunk-ZT6KDLLY.js +20 -0
  173. package/dist/chunks/chunk-ZXE4XYIV.js +7 -0
  174. package/dist/chunks/chunk-ZZQRMRWD.js +20 -0
  175. package/dist/chunks/cjs-GOQHXIHX.js +54 -0
  176. package/dist/chunks/clear-5NQAVWIF.js +8 -0
  177. package/dist/chunks/compile-vercel-config-6J2XUFRK.js +7 -0
  178. package/dist/chunks/config-CKYRXZXL.js +7 -0
  179. package/dist/chunks/config-VNUY4RJ4.js +8 -0
  180. package/dist/chunks/connect-git-provider-GIU5WZ52.js +7 -0
  181. package/dist/chunks/constants-G4UYVLOF.js +7 -0
  182. package/dist/chunks/create-project-SRQGD4JY.js +7 -0
  183. package/dist/chunks/delete-GTXXCSKQ.js +10 -0
  184. package/dist/chunks/delete-HRJEO4MI.js +9 -0
  185. package/dist/chunks/detect-projects-2GNCZ4CS.js +7 -0
  186. package/dist/chunks/detect-services-GHILEGNU.js +7 -0
  187. package/dist/chunks/disable-RWCRVG5O.js +7 -0
  188. package/dist/chunks/discard-SHFIYCJU.js +14 -0
  189. package/dist/chunks/edit-DMO3NSO2.js +9 -0
  190. package/dist/chunks/edit-EVQI2RSS.js +8 -0
  191. package/dist/chunks/enable-AWDU6STD.js +7 -0
  192. package/dist/chunks/esm-7HVUFWMN.js +7 -0
  193. package/dist/chunks/esm-BZBEM7YA.js +7 -0
  194. package/dist/chunks/esm-CXICLFA3.js +9 -0
  195. package/dist/chunks/esm-HDEHVK7I.js +9 -0
  196. package/dist/chunks/esm-NQRLKALI.js +20 -0
  197. package/dist/chunks/esm-SZZI53W7.js +7 -0
  198. package/dist/chunks/esm-WGJFGCLK.js +7 -0
  199. package/dist/chunks/exec-4AISDHUV.js +16372 -0
  200. package/dist/chunks/export-IQKTA4RS.js +19 -0
  201. package/dist/chunks/fetch-proxy-AEAWC6MD.js +7 -0
  202. package/dist/chunks/future-E2FHKPJN.js +7 -0
  203. package/dist/chunks/generate-cert-for-deploy-VKOWC4PZ.js +7 -0
  204. package/dist/chunks/image-LDFYNOCA.js +7 -0
  205. package/dist/chunks/import-builders-P7CXSX2D.js +7 -0
  206. package/dist/chunks/inspect-3N47ODIH.js +15 -0
  207. package/dist/chunks/inspect-53SGDDAH.js +20 -0
  208. package/dist/chunks/inspect-5INZDUQS.js +19 -0
  209. package/dist/chunks/inspect-WMT2M335.js +9 -0
  210. package/dist/chunks/inspect-Y6BUCOUV.js +13 -0
  211. package/dist/chunks/list-BIAPHKFM.js +11 -0
  212. package/dist/chunks/list-DMOCRRSE.js +16 -0
  213. package/dist/chunks/list-K5J7OULR.js +10 -0
  214. package/dist/chunks/login-DEAEVUHM.js +7 -0
  215. package/dist/chunks/login-SRVNHI4Y.js +9 -0
  216. package/dist/chunks/logs-GK7CJBYY.js +7 -0
  217. package/dist/chunks/ls-7ZX6DCJW.js +12 -0
  218. package/dist/chunks/ls-AJWN5ZR4.js +12 -0
  219. package/dist/chunks/ls-BFJWCRLZ.js +12 -0
  220. package/dist/chunks/ls-KGIE6HCO.js +12 -0
  221. package/dist/chunks/ls-UVKTHBTE.js +8 -0
  222. package/dist/chunks/ls-WEG45IOC.js +8 -0
  223. package/dist/chunks/native-self-update-KOJVRMHR.js +7 -0
  224. package/dist/chunks/open-OEWPI5G6.js +7 -0
  225. package/dist/chunks/openapi-MO5HYMHR.js +7 -0
  226. package/dist/chunks/permissions-EPQBQFE3.js +7 -0
  227. package/dist/chunks/pkg-YFU67U7I.js +7 -0
  228. package/dist/chunks/prompt-missing-credentials-IUHLYSQU.js +7 -0
  229. package/dist/chunks/publish-JG7MEPWT.js +15 -0
  230. package/dist/chunks/pull-MRKXG6TO.js +7 -0
  231. package/dist/chunks/purchase-domain-if-available-O5ARXEZ5.js +7 -0
  232. package/dist/chunks/push-XOXJDFYO.js +7 -0
  233. package/dist/chunks/query-AL7C6WV2.js +12 -0
  234. package/dist/chunks/reauthenticate-SH4XR7NH.js +7 -0
  235. package/dist/chunks/reorder-5DMRFDBY.js +10 -0
  236. package/dist/chunks/reply-WSRNZWFD.js +9 -0
  237. package/dist/chunks/repo-info-to-url-SK3VX6UL.js +7 -0
  238. package/dist/chunks/resolve-YJUXQVOZ.js +12 -0
  239. package/dist/chunks/resolve-deployment-framework-preset-XF3NJIDS.js +7 -0
  240. package/dist/chunks/restore-QT3DBGKU.js +16 -0
  241. package/dist/chunks/rm-MHPIUEZ5.js +8 -0
  242. package/dist/chunks/rm-MVZFU6RG.js +8 -0
  243. package/dist/chunks/rm-PXR4J2US.js +8 -0
  244. package/dist/chunks/rm-WB2AIP3N.js +8 -0
  245. package/dist/chunks/rm-XRP6MRUT.js +8 -0
  246. package/dist/chunks/routes-5DERZV5M.js +7 -0
  247. package/dist/chunks/rule-inspect-TT3DRGCS.js +8 -0
  248. package/dist/chunks/rules-B5GW4KJH.js +7 -0
  249. package/dist/chunks/schema-JY5QTZOG.js +14 -0
  250. package/dist/chunks/schema-KCNKVFT3.js +44 -0
  251. package/dist/chunks/select-org-KSCYSESV.js +7 -0
  252. package/dist/chunks/set-7BANEWEL.js +7 -0
  253. package/dist/chunks/setup-and-link-ZAV3EFGC.js +7 -0
  254. package/dist/chunks/slugify-O5DBATYT.js +7 -0
  255. package/dist/chunks/stamp-OX4YO3KY.js +7 -0
  256. package/dist/chunks/tags-VZR66NUC.js +7 -0
  257. package/dist/chunks/types-LRXQEDYI.js +14 -0
  258. package/dist/chunks/update-RBFNNSWE.js +8 -0
  259. package/dist/chunks/update-route-version-XZAFPQJC.js +7 -0
  260. package/dist/chunks/utils-B5ZTMQKY.js +58 -0
  261. package/dist/chunks/vlt-builder-importer-YVCYYRVV.js +11 -0
  262. package/dist/commands/build/index.js +24 -4925
  263. package/dist/commands/deploy/index.js +43 -2875
  264. package/dist/commands/dev/index.js +56 -23857
  265. package/dist/commands/env/index.js +26 -3411
  266. package/dist/commands/link/index.js +4 -284
  267. package/dist/commands/list/index.js +6 -566
  268. package/dist/commands-bulk.js +1187 -87691
  269. package/dist/help.js +1 -8
  270. package/dist/index.js +19 -2591
  271. package/dist/version.mjs +1 -1
  272. package/package.json +50 -51
  273. package/dist/chunks/add-EQZRT4XL.js +0 -221
  274. package/dist/chunks/add-KMDROZC3.js +0 -196
  275. package/dist/chunks/add-QPJ3XMBV.js +0 -145
  276. package/dist/chunks/build-W4HPTAOB.js +0 -251
  277. package/dist/chunks/chunk-26CU4Q3C.js +0 -598
  278. package/dist/chunks/chunk-2HSQ7YUK.js +0 -93
  279. package/dist/chunks/chunk-2JIX6UMI.js +0 -4626
  280. package/dist/chunks/chunk-2LCFOK66.js +0 -1536
  281. package/dist/chunks/chunk-332LMJLZ.js +0 -16014
  282. package/dist/chunks/chunk-3HZLXCVL.js +0 -137
  283. package/dist/chunks/chunk-3VM7HWF6.js +0 -104
  284. package/dist/chunks/chunk-3ZE5CFVM.js +0 -346
  285. package/dist/chunks/chunk-4IALDGB7.js +0 -22
  286. package/dist/chunks/chunk-4KD5BYHB.js +0 -127
  287. package/dist/chunks/chunk-4TUMNBEE.js +0 -231
  288. package/dist/chunks/chunk-4WG2MYCI.js +0 -163
  289. package/dist/chunks/chunk-57RHXXXG.js +0 -150
  290. package/dist/chunks/chunk-5AJPMLDV.js +0 -28
  291. package/dist/chunks/chunk-5EIV6LPQ.js +0 -305
  292. package/dist/chunks/chunk-5NF5HOBJ.js +0 -1854
  293. package/dist/chunks/chunk-653QRQAD.js +0 -417
  294. package/dist/chunks/chunk-67CRVWDF.js +0 -81
  295. package/dist/chunks/chunk-6E6KPBXY.js +0 -43
  296. package/dist/chunks/chunk-75VENWDN.js +0 -1892
  297. package/dist/chunks/chunk-7MRDIPJY.js +0 -107
  298. package/dist/chunks/chunk-7NRNFV77.js +0 -875
  299. package/dist/chunks/chunk-7Q45OKWR.js +0 -149
  300. package/dist/chunks/chunk-AHU7WNL2.js +0 -24
  301. package/dist/chunks/chunk-AINIBIP4.js +0 -39
  302. package/dist/chunks/chunk-AJ5HUOWB.js +0 -14059
  303. package/dist/chunks/chunk-AKLTIZCU.js +0 -46
  304. package/dist/chunks/chunk-AQ6P3IGG.js +0 -49
  305. package/dist/chunks/chunk-B5NH7SLK.js +0 -324
  306. package/dist/chunks/chunk-B5XLQKHI.js +0 -849
  307. package/dist/chunks/chunk-BEQV3X2L.js +0 -86
  308. package/dist/chunks/chunk-CAHP7UGE.js +0 -79
  309. package/dist/chunks/chunk-CFDDM4TX.js +0 -13618
  310. package/dist/chunks/chunk-CJV7J7B5.js +0 -314
  311. package/dist/chunks/chunk-CV5YC2EN.js +0 -867
  312. package/dist/chunks/chunk-CXFY6A6W.js +0 -255
  313. package/dist/chunks/chunk-D5SMZXVO.js +0 -233
  314. package/dist/chunks/chunk-E336ZXPP.js +0 -43
  315. package/dist/chunks/chunk-EDMW7SBH.js +0 -246
  316. package/dist/chunks/chunk-EFYMIIER.js +0 -40
  317. package/dist/chunks/chunk-EKPSCRJZ.js +0 -26
  318. package/dist/chunks/chunk-EOZFDJSY.js +0 -18
  319. package/dist/chunks/chunk-EWBCSDTM.js +0 -1708
  320. package/dist/chunks/chunk-EZKW5YJ2.js +0 -177
  321. package/dist/chunks/chunk-F2QLCXCF.js +0 -2399
  322. package/dist/chunks/chunk-FGDKMNEN.js +0 -21
  323. package/dist/chunks/chunk-FRVG4OW3.js +0 -7438
  324. package/dist/chunks/chunk-FVF4UHDM.js +0 -1288
  325. package/dist/chunks/chunk-G5FBSUL4.js +0 -822
  326. package/dist/chunks/chunk-GDOUDU6O.js +0 -74
  327. package/dist/chunks/chunk-GGP5R3FU.js +0 -129
  328. package/dist/chunks/chunk-GVNCVKCI.js +0 -68
  329. package/dist/chunks/chunk-GY5I4AYD.js +0 -122
  330. package/dist/chunks/chunk-GZLPFESR.js +0 -48
  331. package/dist/chunks/chunk-HB4UKFDO.js +0 -1295
  332. package/dist/chunks/chunk-HD4DR3DA.js +0 -818
  333. package/dist/chunks/chunk-HKHXKSXQ.js +0 -152
  334. package/dist/chunks/chunk-HM24ZWQL.js +0 -174
  335. package/dist/chunks/chunk-HRXRELD3.js +0 -338
  336. package/dist/chunks/chunk-IB5L4LKZ.js +0 -1082
  337. package/dist/chunks/chunk-IIMSID24.js +0 -104
  338. package/dist/chunks/chunk-J7JKZM4T.js +0 -58
  339. package/dist/chunks/chunk-JC2O346E.js +0 -137
  340. package/dist/chunks/chunk-JSD4EZL3.js +0 -34
  341. package/dist/chunks/chunk-JZXJZX7O.js +0 -257
  342. package/dist/chunks/chunk-K3RED3VO.js +0 -566
  343. package/dist/chunks/chunk-KFWQ3EFH.js +0 -151
  344. package/dist/chunks/chunk-KW7BS25T.js +0 -466
  345. package/dist/chunks/chunk-KXDWXXJH.js +0 -70
  346. package/dist/chunks/chunk-LERVNZTD.js +0 -90
  347. package/dist/chunks/chunk-LYAAQDNS.js +0 -242
  348. package/dist/chunks/chunk-M5I6INNF.js +0 -61
  349. package/dist/chunks/chunk-N6HP5BLI.js +0 -18190
  350. package/dist/chunks/chunk-ND5CF2H3.js +0 -53
  351. package/dist/chunks/chunk-NFU4XJIR.js +0 -120
  352. package/dist/chunks/chunk-NW34PW6V.js +0 -1772
  353. package/dist/chunks/chunk-OAMU5QO6.js +0 -18
  354. package/dist/chunks/chunk-OCIZ6ZYA.js +0 -253
  355. package/dist/chunks/chunk-ORQZKIIB.js +0 -2914
  356. package/dist/chunks/chunk-P3SKP5WM.js +0 -27
  357. package/dist/chunks/chunk-P4QNYOFB.js +0 -96
  358. package/dist/chunks/chunk-P7VSBDR4.js +0 -827
  359. package/dist/chunks/chunk-PEC3CQSK.js +0 -90
  360. package/dist/chunks/chunk-PMSMUMUO.js +0 -30
  361. package/dist/chunks/chunk-PNGVSHR3.js +0 -40
  362. package/dist/chunks/chunk-POOO7W47.js +0 -916
  363. package/dist/chunks/chunk-PRWJUY5U.js +0 -848
  364. package/dist/chunks/chunk-Q2DGFCO7.js +0 -579
  365. package/dist/chunks/chunk-RBF2NPUP.js +0 -577
  366. package/dist/chunks/chunk-RBIFXFZX.js +0 -52
  367. package/dist/chunks/chunk-RDTRWLWB.js +0 -11441
  368. package/dist/chunks/chunk-RN6V5ODW.js +0 -114
  369. package/dist/chunks/chunk-RNSMTWA6.js +0 -122
  370. package/dist/chunks/chunk-RTJASENB.js +0 -59
  371. package/dist/chunks/chunk-RVBZ64EQ.js +0 -52
  372. package/dist/chunks/chunk-S7KYDPEM.js +0 -1564
  373. package/dist/chunks/chunk-SLPSPYVR.js +0 -334
  374. package/dist/chunks/chunk-SM3F3PYJ.js +0 -522
  375. package/dist/chunks/chunk-TO7QZGYK.js +0 -105
  376. package/dist/chunks/chunk-TSBUHSN7.js +0 -3495
  377. package/dist/chunks/chunk-TSFWMUCY.js +0 -506
  378. package/dist/chunks/chunk-TZ2YI2VH.js +0 -87
  379. package/dist/chunks/chunk-UG2WOB5L.js +0 -150
  380. package/dist/chunks/chunk-UNKHOYMF.js +0 -559
  381. package/dist/chunks/chunk-UOVWUSLG.js +0 -2099
  382. package/dist/chunks/chunk-V4RMJKQP.js +0 -36
  383. package/dist/chunks/chunk-VGIMO3ZK.js +0 -17
  384. package/dist/chunks/chunk-VGKSIKCC.js +0 -92
  385. package/dist/chunks/chunk-VP5Y3SZG.js +0 -106
  386. package/dist/chunks/chunk-VXYGCOKL.js +0 -28
  387. package/dist/chunks/chunk-W7FGI2GZ.js +0 -233
  388. package/dist/chunks/chunk-WGGABYO5.js +0 -31
  389. package/dist/chunks/chunk-XDGOOW3K.js +0 -60
  390. package/dist/chunks/chunk-XFF5TGRA.js +0 -303
  391. package/dist/chunks/chunk-XNIZGCN5.js +0 -58
  392. package/dist/chunks/chunk-XPJLPUKO.js +0 -117
  393. package/dist/chunks/chunk-XUAWTW4W.js +0 -467
  394. package/dist/chunks/chunk-YPQSDAEW.js +0 -29
  395. package/dist/chunks/chunk-YS76T533.js +0 -270
  396. package/dist/chunks/chunk-ZDU2NODC.js +0 -104
  397. package/dist/chunks/chunk-ZW6HETRE.js +0 -97
  398. package/dist/chunks/cjs-DV4RM7XU.js +0 -20743
  399. package/dist/chunks/clear-4IACMLFU.js +0 -141
  400. package/dist/chunks/compile-vercel-config-PQQ3OCLV.js +0 -33
  401. package/dist/chunks/config-BQQKMQBP.js +0 -168
  402. package/dist/chunks/config-OCPNHXQL.js +0 -127
  403. package/dist/chunks/delete-HRKIYPCO.js +0 -159
  404. package/dist/chunks/delete-P2UL3KTU.js +0 -226
  405. package/dist/chunks/detect-projects-ODNU4PK2.js +0 -18
  406. package/dist/chunks/detect-services-U7QGT7VO.js +0 -40
  407. package/dist/chunks/disable-3NYMICQ3.js +0 -198
  408. package/dist/chunks/discard-RNVEJUK3.js +0 -145
  409. package/dist/chunks/edit-63S2RQHR.js +0 -162
  410. package/dist/chunks/edit-CTENFZ7H.js +0 -647
  411. package/dist/chunks/enable-WILWXAHV.js +0 -204
  412. package/dist/chunks/exec-4IPHZ55G.js +0 -1291
  413. package/dist/chunks/export-YHGV3EPK.js +0 -177
  414. package/dist/chunks/fetch-proxy-R3JZNXBZ.js +0 -99
  415. package/dist/chunks/image-MWKS2YMB.js +0 -75
  416. package/dist/chunks/import-builders-H55X5VYD.js +0 -39
  417. package/dist/chunks/inspect-JTJMK6TO.js +0 -596
  418. package/dist/chunks/inspect-KBIPLMGR.js +0 -216
  419. package/dist/chunks/inspect-OP26FDBY.js +0 -171
  420. package/dist/chunks/inspect-SW4UMWTB.js +0 -175
  421. package/dist/chunks/inspect-WPLZPVBO.js +0 -145
  422. package/dist/chunks/list-HE7DWAWH.js +0 -387
  423. package/dist/chunks/list-OUG7WCT7.js +0 -404
  424. package/dist/chunks/list-QUSEURJZ.js +0 -426
  425. package/dist/chunks/login-MIIQJVF3.js +0 -233
  426. package/dist/chunks/ls-24N3DUK4.js +0 -183
  427. package/dist/chunks/ls-3Y7KEFKT.js +0 -175
  428. package/dist/chunks/ls-75F5HIJ5.js +0 -188
  429. package/dist/chunks/ls-REN6X2X5.js +0 -204
  430. package/dist/chunks/ls-W4STUDXK.js +0 -223
  431. package/dist/chunks/ls-Z4CTSD6C.js +0 -210
  432. package/dist/chunks/open-ARMCLPBK.js +0 -116
  433. package/dist/chunks/permissions-JKI67F62.js +0 -99
  434. package/dist/chunks/publish-SMSQ7OX2.js +0 -155
  435. package/dist/chunks/pull-4QZJZELD.js +0 -45
  436. package/dist/chunks/push-T6IYQY2J.js +0 -191
  437. package/dist/chunks/query-CP3JK5LW.js +0 -725
  438. package/dist/chunks/reorder-RAWKFGLV.js +0 -412
  439. package/dist/chunks/reply-235UHUD4.js +0 -176
  440. package/dist/chunks/resolve-5KCLN7QV.js +0 -237
  441. package/dist/chunks/resolve-deployment-framework-preset-NPE6RLV3.js +0 -36
  442. package/dist/chunks/restore-D24WAUAN.js +0 -252
  443. package/dist/chunks/rm-DBQDXSOC.js +0 -162
  444. package/dist/chunks/rm-G5INO77R.js +0 -148
  445. package/dist/chunks/rm-NLKSEKZ5.js +0 -195
  446. package/dist/chunks/rm-QV76CJA4.js +0 -322
  447. package/dist/chunks/rm-TZ4PDDUK.js +0 -147
  448. package/dist/chunks/routes-QVMBXOSX.js +0 -24
  449. package/dist/chunks/rule-inspect-76MC7I2D.js +0 -123
  450. package/dist/chunks/rules-IDUXVTPG.js +0 -89
  451. package/dist/chunks/schema-AV6BHGKY.js +0 -237
  452. package/dist/chunks/schema-QJVQTNB4.js +0 -381
  453. package/dist/chunks/set-L5NFQSCF.js +0 -250
  454. package/dist/chunks/setup-and-link-USSVDKCM.js +0 -65
  455. package/dist/chunks/stamp-AA7R3MZS.js +0 -16
  456. package/dist/chunks/tags-2NLUU4EC.js +0 -69
  457. package/dist/chunks/types-4GAJ7XQQ.js +0 -116
  458. package/dist/chunks/update-WGLBB65M.js +0 -224
  459. package/dist/chunks/vlt-builder-importer-USCFHWPL.js +0 -322
@@ -4,2878 +4,46 @@ import { dirname as __dirname_ } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
- import {
8
- validatePaths,
9
- validateRootDirectory
10
- } from "../../chunks/chunk-VGKSIKCC.js";
11
- import {
12
- promptMissingCredentials
13
- } from "../../chunks/chunk-M5I6INNF.js";
14
- import {
15
- Now,
16
- UploadErrorMissingArchive,
17
- createCertForCns,
18
- displayBuildLogsUntilFinalError,
19
- printDeploymentStatus,
20
- purchaseDomainIfAvailable,
21
- require_cjs,
22
- setupDomain
23
- } from "../../chunks/chunk-F2QLCXCF.js";
24
- import "../../chunks/chunk-PRWJUY5U.js";
25
- import {
26
- login,
27
- require_ci_info
28
- } from "../../chunks/chunk-UNKHOYMF.js";
29
- import {
30
- readLocalConfig
31
- } from "../../chunks/chunk-UOVWUSLG.js";
32
- import {
33
- highlight
34
- } from "../../chunks/chunk-AINIBIP4.js";
35
- import "../../chunks/chunk-J7JKZM4T.js";
36
- import {
37
- isGuidanceEnabled
38
- } from "../../chunks/chunk-AKLTIZCU.js";
39
- import {
40
- parseMeta
41
- } from "../../chunks/chunk-EKPSCRJZ.js";
42
- import {
43
- validateJsonOutput
44
- } from "../../chunks/chunk-KXDWXXJH.js";
45
- import "../../chunks/chunk-V4RMJKQP.js";
46
- import {
47
- getSubcommand
48
- } from "../../chunks/chunk-YPQSDAEW.js";
49
- import {
50
- continueSubcommand,
51
- deployCommand,
52
- deprecatedArchiveSplitTgz,
53
- getCommandAliases,
54
- initSubcommand
55
- } from "../../chunks/chunk-CFDDM4TX.js";
56
- import "../../chunks/chunk-CJV7J7B5.js";
57
- import "../../chunks/chunk-EZKW5YJ2.js";
58
- import "../../chunks/chunk-NFU4XJIR.js";
59
- import "../../chunks/chunk-3HZLXCVL.js";
60
- import "../../chunks/chunk-7Q45OKWR.js";
61
- import "../../chunks/chunk-GY5I4AYD.js";
62
- import "../../chunks/chunk-4TUMNBEE.js";
63
- import "../../chunks/chunk-POOO7W47.js";
64
- import "../../chunks/chunk-SLPSPYVR.js";
65
- import "../../chunks/chunk-HKHXKSXQ.js";
66
- import "../../chunks/chunk-EDMW7SBH.js";
67
- import "../../chunks/chunk-4KD5BYHB.js";
68
- import "../../chunks/chunk-XDGOOW3K.js";
69
- import "../../chunks/chunk-VP5Y3SZG.js";
70
- import {
71
- pickOverrides
72
- } from "../../chunks/chunk-LERVNZTD.js";
73
- import {
74
- require_dist as require_dist2
75
- } from "../../chunks/chunk-N6HP5BLI.js";
76
- import "../../chunks/chunk-P7VSBDR4.js";
77
- import {
78
- compileVercelConfig
79
- } from "../../chunks/chunk-653QRQAD.js";
80
- import {
81
- stamp_default
82
- } from "../../chunks/chunk-64IF634X.js";
83
- import "../../chunks/chunk-ZDU2NODC.js";
84
- import "../../chunks/chunk-PEC3CQSK.js";
85
- import "../../chunks/chunk-VXYGCOKL.js";
86
- import {
87
- require_ms
88
- } from "../../chunks/chunk-GGP5R3FU.js";
89
- import {
90
- ensureLink,
91
- parseEnv
92
- } from "../../chunks/chunk-JC2O346E.js";
93
- import "../../chunks/chunk-67CRVWDF.js";
94
- import {
95
- AGENT_STATUS
96
- } from "../../chunks/chunk-RNSMTWA6.js";
97
- import "../../chunks/chunk-UG2WOB5L.js";
98
- import "../../chunks/chunk-XUAWTW4W.js";
99
- import "../../chunks/chunk-JZXJZX7O.js";
100
- import "../../chunks/chunk-HRXRELD3.js";
101
- import {
102
- getDeployment,
103
- mapCertError,
104
- parseTarget
105
- } from "../../chunks/chunk-RN6V5ODW.js";
106
- import {
107
- help
108
- } from "../../chunks/chunk-YS76T533.js";
109
- import {
110
- TelemetryClient
111
- } from "../../chunks/chunk-HB4UKFDO.js";
112
- import "../../chunks/chunk-B5XLQKHI.js";
113
- import "../../chunks/chunk-SM3F3PYJ.js";
114
- import "../../chunks/chunk-XNIZGCN5.js";
115
- import {
116
- table
117
- } from "../../chunks/chunk-NW34PW6V.js";
118
- import {
119
- printError
120
- } from "../../chunks/chunk-3VM7HWF6.js";
121
- import {
122
- parseArguments
123
- } from "../../chunks/chunk-57RHXXXG.js";
124
- import "../../chunks/chunk-4IALDGB7.js";
125
- import {
126
- VERCEL_DIR,
127
- VERCEL_DIR_PROJECT,
128
- addToGitIgnore,
129
- createGitMeta,
130
- getGitConfigPath,
131
- getLinkFromDir,
132
- getRepoLink,
133
- getVercelDirectory,
134
- isOwnerLookupUnavailableLink,
135
- isRemoteLookupSkippedLink,
136
- linkFolderToProject,
137
- param,
138
- parseGitConfig,
139
- parseRepoUrl,
140
- pluckRemoteUrls,
141
- printAlignedLabel,
142
- require_lib
143
- } from "../../chunks/chunk-AJ5HUOWB.js";
144
- import "../../chunks/chunk-G5FBSUL4.js";
145
- import {
146
- outputAgentError,
147
- quoteArg,
148
- withGlobalFlags
149
- } from "../../chunks/chunk-26CU4Q3C.js";
150
- import "../../chunks/chunk-XPJLPUKO.js";
151
- import {
152
- AliasDomainConfigured,
153
- BuildError,
154
- BuildsRateLimited,
155
- ConflictingConfigFiles,
156
- ConflictingFilePath,
157
- ConflictingPathSegment,
158
- DeploymentNotFound,
159
- DeploymentsRateLimited,
160
- DeprecatedNowJson,
161
- DomainNotFound,
162
- DomainNotVerified,
163
- DomainPermissionDenied,
164
- DomainVerificationFailed,
165
- InvalidDomain,
166
- MissingBuildScript,
167
- NotDomainOwner,
168
- NowError,
169
- SchemaValidationFailed,
170
- TooManyRequests,
171
- UserAborted,
172
- code,
173
- isAPIError,
174
- require_bytes
175
- } from "../../chunks/chunk-CV5YC2EN.js";
176
- import {
177
- getCommandName,
178
- getFlagsSpecification,
179
- packageName
180
- } from "../../chunks/chunk-Q2DGFCO7.js";
181
- import {
182
- emoji,
183
- link_default,
184
- output_manager_default,
185
- prependEmoji
186
- } from "../../chunks/chunk-2JIX6UMI.js";
187
- import "../../chunks/chunk-P4QNYOFB.js";
188
- import {
189
- require_dist
190
- } from "../../chunks/chunk-ZW6HETRE.js";
191
- import {
192
- require_source
193
- } from "../../chunks/chunk-S7KYDPEM.js";
194
- import {
195
- __toESM
196
- } from "../../chunks/chunk-TZ2YI2VH.js";
197
-
198
- // src/commands/deploy/index.ts
199
- var import_client3 = __toESM(require_dist2(), 1);
200
- var import_error_utils2 = __toESM(require_dist(), 1);
201
- var import_bytes = __toESM(require_bytes(), 1);
202
- var import_chalk = __toESM(require_source(), 1);
203
- var import_fs_extra4 = __toESM(require_lib(), 1);
204
- var import_ms = __toESM(require_ms(), 1);
205
- import {
206
- getPrettyError,
207
- getSupportedNodeVersion,
208
- scanParentDirs
209
- } from "@vercel/build-utils";
210
- import { join as join4, resolve as resolve2 } from "path";
211
-
212
- // src/util/deploy/generate-cert-for-deploy.ts
213
- var import_tldts = __toESM(require_cjs(), 1);
214
- async function generateCertForDeploy(client, contextName, deployURL) {
215
- const parsedDomain = (0, import_tldts.parse)(deployURL);
216
- const { domain } = parsedDomain;
217
- if (!domain) {
218
- return new InvalidDomain(deployURL);
219
- }
220
- output_manager_default.spinner(`Setting custom suffix domain ${domain}`);
221
- const result = await setupDomain(client, domain, contextName);
222
- output_manager_default.stopSpinner();
223
- if (result instanceof NowError) {
224
- return result;
225
- }
226
- output_manager_default.spinner(`Generating a wildcard certificate for ${domain}`);
227
- const cert = await createCertForCns(
228
- client,
229
- [domain, `*.${domain}`],
230
- contextName
231
- );
232
- output_manager_default.stopSpinner();
233
- if (cert instanceof NowError) {
234
- return cert;
235
- }
236
- }
237
-
238
- // src/util/deploy/create-deploy.ts
239
- async function createDeploy(client, now, contextName, path, createArgs, org, isSettingUpProject, archive) {
240
- try {
241
- return await now.create(path, createArgs, org, isSettingUpProject, archive);
242
- } catch (err) {
243
- if (isAPIError(err)) {
244
- if (err.code === "rate_limited") {
245
- throw new DeploymentsRateLimited(err.message);
246
- }
247
- if (err.code === "domain_missing") {
248
- throw new DomainNotFound(err.value);
249
- }
250
- if (err.code === "domain_not_found" && err.domain) {
251
- throw new DomainNotFound(err.domain);
252
- }
253
- if (err.code === "domain_not_verified" && err.domain) {
254
- throw new DomainNotVerified(err.domain);
255
- }
256
- if (err.code === "domain_not_verified" && err.value) {
257
- throw new DomainVerificationFailed(err.value);
258
- }
259
- if (err.code === "not_domain_owner") {
260
- throw new NotDomainOwner(err.message);
261
- }
262
- if (err.code === "builds_rate_limited") {
263
- throw new BuildsRateLimited(err.message, {
264
- ctaLabel: err.ctaLabel,
265
- ctaUrl: err.ctaUrl,
266
- action: err.action,
267
- link: err.link
268
- });
269
- }
270
- if (err.code === "forbidden") {
271
- throw new DomainPermissionDenied(err.value, contextName);
272
- }
273
- if (err.code === "bad_request" && err.keyword) {
274
- throw new SchemaValidationFailed(
275
- err.message,
276
- err.keyword,
277
- err.dataPath,
278
- err.params
279
- );
280
- }
281
- if (err.code === "domain_configured") {
282
- throw new AliasDomainConfigured(err);
283
- }
284
- if (err.code === "missing_build_script") {
285
- throw new MissingBuildScript(err);
286
- }
287
- if (err.code === "conflicting_file_path") {
288
- throw new ConflictingFilePath(err);
289
- }
290
- if (err.code === "conflicting_path_segment") {
291
- throw new ConflictingPathSegment(err);
292
- }
293
- if (err.code === "cert_missing") {
294
- const result = await generateCertForDeploy(
295
- client,
296
- contextName,
297
- err.value
298
- );
299
- if (result instanceof NowError) {
300
- return result;
301
- }
302
- return createDeploy(
303
- client,
304
- now,
305
- contextName,
306
- path,
307
- createArgs,
308
- org,
309
- isSettingUpProject
310
- );
311
- }
312
- if (err.code === "not_found") {
313
- throw new DeploymentNotFound({ context: contextName });
314
- }
315
- const certError = mapCertError(err);
316
- if (certError) {
317
- return certError;
318
- }
319
- }
320
- throw err;
321
- }
322
- }
323
-
324
- // src/util/deploy/get-deployment-checks.ts
325
- async function getDeploymentChecks(client, deploymentId) {
326
- const checksResponse = await client.fetch(
327
- `/v1/deployments/${encodeURIComponent(deploymentId)}/checks`
328
- );
329
- return checksResponse;
330
- }
331
-
332
- // src/util/deploy/get-deployment-check-runs.ts
333
- async function getDeploymentCheckRuns(client, deploymentId) {
334
- const response = await client.fetch(
335
- `/v2/deployments/${encodeURIComponent(deploymentId)}/check-runs`
336
- );
337
- return response;
338
- }
339
-
340
- // src/util/deploy/get-deployment-check-run-logs.ts
341
- var MAX_ATTEMPTS = 5;
342
- var POLL_INTERVAL_MS = 2e3;
343
- function parseNdjson(text) {
344
- const entries = [];
345
- for (const line of text.split("\n")) {
346
- if (!line.trim())
347
- continue;
348
- try {
349
- entries.push(JSON.parse(line));
350
- } catch {
351
- }
352
- }
353
- return entries;
354
- }
355
- async function getDeploymentCheckRunLogs(client, deploymentId, checkRunId) {
356
- const url = `/v2/deployments/${encodeURIComponent(deploymentId)}/check-runs/${encodeURIComponent(checkRunId)}/logs`;
357
- await new Promise((resolve3) => setTimeout(resolve3, 1e3));
358
- for (let attempt = 0; attempt < MAX_ATTEMPTS; attempt++) {
359
- if (attempt > 0)
360
- await new Promise((resolve3) => setTimeout(resolve3, POLL_INTERVAL_MS));
361
- const res = await client.fetch(url, { json: false });
362
- const text = typeof res === "string" ? res : await res.text();
363
- const entries = parseNdjson(text);
364
- const hasEof = entries.some((e) => e.level === "eof");
365
- if (hasEof) {
366
- return entries.filter((e) => e.level !== "eof" && e.level !== "debug").map(({ level, timestamp, message }) => ({
367
- level,
368
- timestamp,
369
- message
370
- }));
371
- }
372
- }
373
- return [];
374
- }
375
-
376
- // src/util/deploy/get-prebuilt-json.ts
377
- var import_fs_extra = __toESM(require_lib(), 1);
378
- import { join } from "path";
379
- async function getPrebuiltJson(directory) {
380
- try {
381
- return await import_fs_extra.default.readJSON(join(directory, "builds.json"));
382
- } catch (_error) {
383
- }
384
- return null;
385
- }
386
-
387
- // src/util/deploy/get-git-connect-recommendation.ts
388
- import { resolve } from "path";
389
- var SUPPORTED_PROVIDERS = /* @__PURE__ */ new Set(["github", "gitlab", "bitbucket"]);
390
- var defaultDeps = {
391
- getGitConfigPath,
392
- parseGitConfig,
393
- fetchProject: (client, project) => client.fetch(`/v9/projects/${encodeURIComponent(project.id)}`, {
394
- accountId: project.accountId
395
- }),
396
- buildCommand: (client, command) => withGlobalFlags(client, command, { preserveProject: true })
397
- };
398
- async function getGitConnectRecommendation(client, cwd, project, options = {}) {
399
- const { alreadyOffered = false, deps = defaultDeps } = options;
400
- try {
401
- if (project.link || alreadyOffered)
402
- return void 0;
403
- const gitConfigPath = deps.getGitConfigPath({ cwd });
404
- if (!gitConfigPath)
405
- return void 0;
406
- const gitConfig = await deps.parseGitConfig(gitConfigPath);
407
- const remoteUrls = gitConfig && pluckRemoteUrls(gitConfig);
408
- if (!remoteUrls) {
409
- return void 0;
410
- }
411
- const remotes = Object.values(remoteUrls);
412
- const hasSupportedRemote = remotes.some((remoteUrl) => {
413
- const repo = parseRepoUrl(remoteUrl);
414
- return repo && SUPPORTED_PROVIDERS.has(repo.provider);
415
- });
416
- if (!hasSupportedRemote || client.nonInteractive && remotes.length !== 1) {
417
- return void 0;
418
- }
419
- const remoteProject = await deps.fetchProject(client, project);
420
- if (remoteProject.link)
421
- return void 0;
422
- const cwdFlag = resolve(cwd) === resolve(client.cwd) ? "" : ` --cwd ${quoteArg(cwd)}`;
423
- return deps.buildCommand(client, `git connect${cwdFlag}`);
424
- } catch (error) {
425
- output_manager_default.debug(`Failed to resolve Git connection guidance: ${error}`);
426
- return void 0;
427
- }
428
- }
429
-
430
- // src/util/deploy/validate-archive-format.ts
431
- var import_client = __toESM(require_dist2(), 1);
432
- var validArchiveFormats = new Set(import_client.VALID_ARCHIVE_FORMATS);
433
- function isValidArchive(archive) {
434
- return validArchiveFormats.has(archive);
435
- }
436
-
437
- // src/util/get-error-cta.ts
438
- function getErrorCta(source) {
439
- if (typeof source.ctaLabel === "string" && typeof source.ctaUrl === "string") {
440
- return { label: source.ctaLabel, url: source.ctaUrl };
441
- }
442
- if (typeof source.action === "string" && typeof source.link === "string") {
443
- return { label: source.action, url: source.link };
444
- }
445
- return void 0;
446
- }
447
-
448
- // src/util/telemetry/commands/deploy/index.ts
449
- var import_client2 = __toESM(require_dist2(), 1);
450
- var DeployTelemetryClient = class extends TelemetryClient {
451
- trackCliArgumentProjectPath(projectPaths) {
452
- if (projectPaths) {
453
- this.trackCliArgument({
454
- arg: "project-path",
455
- value: this.redactedValue
456
- });
457
- }
458
- }
459
- trackCliOptionArchive(format) {
460
- if (format) {
461
- const allowedFormat = [
462
- ...import_client2.VALID_ARCHIVE_FORMATS,
463
- deprecatedArchiveSplitTgz
464
- ].includes(format) ? format : this.redactedValue;
465
- this.trackCliOption({
466
- option: "archive",
467
- value: allowedFormat
468
- });
469
- }
470
- }
471
- trackCliOptionBuildEnv(buildEnv) {
472
- if (buildEnv && buildEnv.length > 0) {
473
- this.trackCliOption({
474
- option: "build-env",
475
- value: this.redactedValue
476
- });
477
- }
478
- }
479
- trackCliOptionEnv(env) {
480
- if (env && env.length > 0) {
481
- this.trackCliOption({
482
- option: "env",
483
- value: this.redactedValue
484
- });
485
- }
486
- }
487
- trackCliOptionMeta(meta) {
488
- if (meta && meta.length > 0) {
489
- this.trackCliOption({
490
- option: "meta",
491
- value: this.redactedValue
492
- });
493
- }
494
- }
495
- trackCliOptionName(name) {
496
- if (name) {
497
- this.trackCliOption({
498
- option: "name",
499
- value: this.redactedValue
500
- });
501
- }
502
- }
503
- trackCliOptionRegions(regions) {
504
- if (regions) {
505
- this.trackCliOption({
506
- option: "regions",
507
- // consider revisiting once we come up with a way to query the list of regions
508
- value: this.redactedValue
509
- });
510
- }
511
- }
512
- trackCliOptionTarget(target) {
513
- if (target) {
514
- this.trackCliOption({
515
- option: "target",
516
- value: this.redactedTargetName(target)
517
- });
518
- }
519
- }
520
- trackCliFlagConfirm(flag) {
521
- if (flag) {
522
- this.trackCliFlag("confirm");
523
- }
524
- }
525
- trackCliFlagForce(flag) {
526
- if (flag) {
527
- this.trackCliFlag("force");
528
- }
529
- }
530
- trackCliFlagLogs(flag) {
531
- if (flag) {
532
- this.trackCliFlag("logs");
533
- }
534
- }
535
- trackCliFlagNoLogs(flag) {
536
- if (flag) {
537
- this.trackCliFlag("no-logs");
538
- }
539
- }
540
- trackCliFlagGuidance(flag) {
541
- if (flag) {
542
- this.trackCliFlag("guidance");
543
- }
544
- }
545
- trackCliFlagNoClipboard(flag) {
546
- if (flag) {
547
- this.trackCliFlag("no-clipboard");
548
- }
549
- }
550
- trackCliFlagNoWait(flag) {
551
- if (flag) {
552
- this.trackCliFlag("no-wait");
553
- }
554
- }
555
- trackCliFlagDry(flag) {
556
- if (flag) {
557
- this.trackCliFlag("dry");
558
- }
559
- }
560
- trackCliFlagPrebuilt(flag) {
561
- if (flag) {
562
- this.trackCliFlag("prebuilt");
563
- }
564
- }
565
- trackCliSubcommandInit(actual) {
566
- this.trackCliSubcommand({
567
- subcommand: "init",
568
- value: actual
569
- });
570
- }
571
- trackCliSubcommandContinue(actual) {
572
- this.trackCliSubcommand({
573
- subcommand: "continue",
574
- value: actual
575
- });
576
- }
577
- trackCliFlagProd(flag) {
578
- if (flag) {
579
- this.trackCliFlag("prod");
580
- }
581
- }
582
- trackCliFlagTemporary(flag) {
583
- if (flag) {
584
- this.trackCliFlag("temporary");
585
- }
586
- }
587
- trackTargetEnvironment(target) {
588
- super.trackTargetEnvironment(
589
- target === "production" ? "production" : "preview"
590
- );
591
- }
592
- trackCliFlagPublic(flag) {
593
- if (flag) {
594
- this.trackCliFlag("public");
595
- }
596
- }
597
- trackCliFlagSkipDomain(flag) {
598
- if (flag) {
599
- this.trackCliFlag("skip-domain");
600
- }
601
- }
602
- trackCliFlagWithCache(flag) {
603
- if (flag) {
604
- this.trackCliFlag("with-cache");
605
- }
606
- }
607
- trackCliFlagYes(flag) {
608
- if (flag) {
609
- this.trackCliFlag("yes");
610
- }
611
- }
612
- trackCliFlagJson(flag) {
613
- if (flag) {
614
- this.trackCliFlag("json");
615
- }
616
- }
617
- trackCliOptionFormat(format) {
618
- if (format) {
619
- this.trackCliOption({
620
- option: "format",
621
- value: format
622
- });
623
- }
624
- }
625
- trackDeploymentId(id) {
626
- if (id) {
627
- this.trackCommandOutput({
628
- key: "deployment-id",
629
- value: id
630
- });
631
- }
632
- }
633
- };
634
-
635
- // src/commands/deploy/anonymous.ts
636
- var import_fs_extra3 = __toESM(require_lib(), 1);
637
- import { join as join3 } from "path";
638
-
639
- // src/util/deploy/anonymous.ts
640
- var import_fs_extra2 = __toESM(require_lib(), 1);
641
- var import_ci_info = __toESM(require_ci_info(), 1);
642
- var import_error_utils = __toESM(require_dist(), 1);
643
- import { join as join2 } from "path";
644
- import { getPlatformEnv } from "@vercel/build-utils";
645
- var VERCEL_DIR_ANONYMOUS = "anonymous.json";
646
- function anonymousStatePath(cwd) {
647
- return join2(cwd, VERCEL_DIR, VERCEL_DIR_ANONYMOUS);
648
- }
649
- async function readAnonymousState(cwd) {
650
- try {
651
- const state = await (0, import_fs_extra2.readJSON)(anonymousStatePath(cwd));
652
- if (typeof state?.projectId === "string" && typeof state.token === "string" && typeof state.claimUrl === "string" && typeof state.expiresAt === "number") {
653
- return state;
654
- }
655
- } catch (_error) {
656
- }
657
- return null;
658
- }
659
- async function writeAnonymousState(cwd, state) {
660
- const path = anonymousStatePath(cwd);
661
- await (0, import_fs_extra2.outputJSON)(path, state, { spaces: 2, mode: 384 });
662
- await (0, import_fs_extra2.chmod)(path, 384);
663
- await addToGitIgnore(cwd);
664
- }
665
- async function clearAnonymousState(cwd) {
666
- await (0, import_fs_extra2.remove)(anonymousStatePath(cwd));
667
- }
668
- async function bootstrapAnonymousProject(client) {
669
- const { projectId, token, claimUrl, expiresAt } = await client.fetch("/v1/anonymous/projects?surface=cli", {
670
- method: "POST",
671
- body: {},
672
- useCurrentTeam: false,
673
- // Not idempotent: each attempt creates a project server-side.
674
- retry: { retries: 0 }
675
- });
676
- return { projectId, token, claimUrl, expiresAt };
677
- }
678
- async function ensureAnonymousLink(client, cwd, { requireExistingState = false, confirmed = true } = {}) {
679
- if (import_ci_info.default.isCI) {
680
- return "refused";
681
- }
682
- const linked = Boolean(getPlatformEnv("ORG_ID") && getPlatformEnv("PROJECT_ID")) || Boolean(await getLinkFromDir(getVercelDirectory(cwd))) || Boolean((await getRepoLink(client, cwd))?.repoConfig);
683
- if (linked) {
684
- return "refused";
685
- }
686
- let state = await readAnonymousState(cwd);
687
- if (state && state.expiresAt <= Date.now()) {
688
- output_manager_default.prettyError({
689
- message: `Your temporary deployment has expired. Run ${getCommandName("login")} to create an account and keep deploying this app.`
690
- });
691
- return "failed";
692
- }
693
- if (!state && requireExistingState) {
694
- return "refused";
695
- }
696
- if (!confirmed && !state) {
697
- return "confirmation-required";
698
- }
699
- if (!state) {
700
- try {
701
- state = await bootstrapAnonymousProject(client);
702
- } catch (err) {
703
- output_manager_default.debug(`Anonymous bootstrap failed: ${(0, import_error_utils.errorToString)(err)}`);
704
- return "refused";
705
- }
706
- await writeAnonymousState(cwd, state);
707
- output_manager_default.log("Not authenticated. Deploying anonymously.");
708
- }
709
- client.authConfig = { token: state.token, skipWrite: true };
710
- delete process.env.VERCEL_TEAM_ID;
711
- return {
712
- status: "linked",
713
- anonymous: true,
714
- expiresAt: state.expiresAt,
715
- claimUrl: state.claimUrl,
716
- org: { type: "user", id: "", slug: "anonymous" },
717
- project: { id: state.projectId, name: state.projectId }
718
- };
719
- }
720
-
721
- // src/commands/deploy/anonymous.ts
722
- function validateAnonymousTarget(isAnonymous, target) {
723
- if (isAnonymous && target && target !== "production") {
724
- output_manager_default.error(
725
- `Anonymous deployments always target production, so "${target}" is not available. Remove the ${param(
726
- "--target"
727
- )} option, or run ${getCommandName("login")} to deploy to other environments.`
728
- );
729
- return false;
730
- }
731
- return true;
732
- }
733
- async function setupAnonymousDeployment(client, cwd, { isAnonymous, dryRun }) {
734
- if (!isAnonymous) {
735
- await clearAnonymousState(cwd);
736
- }
737
- let anonymousLink;
738
- if (isAnonymous) {
739
- const anonymous = await ensureAnonymousLink(client, cwd, {
740
- requireExistingState: dryRun
741
- });
742
- if (anonymous === "refused") {
743
- const loginExitCode = await promptMissingCredentials(client);
744
- if (loginExitCode !== 0) {
745
- return loginExitCode;
746
- }
747
- isAnonymous = false;
748
- } else if (anonymous === "failed") {
749
- return 1;
750
- } else if (anonymous === "confirmation-required") {
751
- return 1;
752
- } else {
753
- anonymousLink = anonymous;
754
- }
755
- }
756
- return { isAnonymous, anonymousLink };
757
- }
758
- async function handleAnonymousDeploymentError({
759
- client,
760
- cwd,
761
- error,
762
- link,
763
- isV0,
764
- retry
765
- }) {
766
- if (!link || !isAPIError(error)) {
767
- return;
768
- }
769
- if (error.code === "anonymous_project_claimed") {
770
- if (client.nonInteractive || !client.stdin.isTTY) {
771
- output_manager_default.prettyError({
772
- message: `This project was claimed successfully. Run ${getCommandName("login")} to continue deploying it.`
773
- });
774
- return 1;
775
- }
776
- output_manager_default.log(
777
- "This project was claimed successfully. Log in to continue deploying it."
778
- );
779
- let loginExitCode;
780
- try {
781
- loginExitCode = await login(client, { shouldParseArgs: false });
782
- } catch (loginError) {
783
- printError(loginError);
784
- return 1;
785
- }
786
- if (loginExitCode !== 0) {
787
- return loginExitCode;
788
- }
789
- const claimedProjectLink = await ensureLink("deploy", client, cwd, {
790
- autoConfirm: true,
791
- projectName: link.project.id,
792
- failIfNotFound: true,
793
- allowOwnerLookupFallback: true,
794
- v0: isV0
795
- });
796
- if (typeof claimedProjectLink === "number") {
797
- return claimedProjectLink;
798
- }
799
- await linkFolderToProject(
800
- client,
801
- cwd,
802
- {
803
- projectId: claimedProjectLink.project.id,
804
- orgId: claimedProjectLink.org.id
805
- },
806
- claimedProjectLink.project.name,
807
- claimedProjectLink.org.slug,
808
- "link",
809
- true,
810
- false
811
- );
812
- await clearAnonymousState(cwd);
813
- return retry();
814
- }
815
- if (error.status === 401 || error.status === 410) {
816
- await clearAnonymousState(cwd);
817
- output_manager_default.prettyError({
818
- message: `Your temporary deployment has expired. Run ${getCommandName("login")} to create an account and keep deploying this app.`
819
- });
820
- return 1;
821
- }
822
- }
823
- async function runImplicitBuild(client, cwd) {
824
- const projectJsonPath = join3(cwd, VERCEL_DIR, VERCEL_DIR_PROJECT);
825
- const projectJsonExists = await import_fs_extra3.default.pathExists(projectJsonPath);
826
- if (!projectJsonExists) {
827
- await import_fs_extra3.default.outputJSON(projectJsonPath, { settings: {} }, { spaces: 2 });
828
- }
829
- if (await import_fs_extra3.default.pathExists(join3(cwd, "package.json"))) {
830
- output_manager_default.log("Building your project locally\u2026");
831
- }
832
- const originalArgv = client.argv;
833
- const originalCwd = client.cwd;
834
- const originalStdout = client.stdout;
835
- const previousVercelFirstDeployment = process.env.VERCEL_FIRST_DEPLOYMENT;
836
- client.cwd = cwd;
837
- client.setArgv([...originalArgv.slice(0, 2), "build", "--prod", "--yes"]);
838
- process.env.VERCEL_FIRST_DEPLOYMENT = "1";
839
- client.stdout = createSinkStream();
840
- try {
841
- const build = (await import("../build/index.js")).default;
842
- return await build(client);
843
- } finally {
844
- client.setArgv(originalArgv);
845
- client.cwd = originalCwd;
846
- client.stdout = originalStdout;
847
- if (previousVercelFirstDeployment === void 0) {
848
- delete process.env.VERCEL_FIRST_DEPLOYMENT;
849
- } else {
850
- process.env.VERCEL_FIRST_DEPLOYMENT = previousVercelFirstDeployment;
851
- }
852
- if (!projectJsonExists) {
853
- await import_fs_extra3.default.remove(projectJsonPath);
854
- }
855
- }
856
- }
857
- function createSinkStream() {
858
- return { isTTY: false, write: () => true };
859
- }
860
-
861
- // src/commands/deploy/index.ts
862
- var COMMAND_CONFIG = {
863
- init: getCommandAliases(initSubcommand),
864
- continue: getCommandAliases(continueSubcommand)
865
- };
866
- var deploy_default = async (client) => {
867
- const telemetryClient = new DeployTelemetryClient({
868
- opts: {
869
- store: client.telemetryEventStore
870
- }
871
- });
872
- let parsedArguments = null;
873
- const flagsSpecification = getFlagsSpecification(deployCommand.options);
874
- try {
875
- parsedArguments = parseArguments(client.argv.slice(2), flagsSpecification, {
876
- permissive: true
877
- });
878
- } catch (error) {
879
- printError(error);
880
- return 1;
881
- }
882
- const subArgs = parsedArguments.args[0] === deployCommand.name ? parsedArguments.args.slice(1) : parsedArguments.args;
883
- const { subcommand, subcommandOriginal } = getSubcommand(
884
- subArgs,
885
- COMMAND_CONFIG
886
- );
887
- function printSubcommandHelp(command) {
888
- output_manager_default.print(
889
- help(command, { parent: deployCommand, columns: client.stderr.columns })
890
- );
891
- }
892
- switch (subcommand) {
893
- case "init":
894
- if (parsedArguments.flags["--help"]) {
895
- telemetryClient.trackCliFlagHelp("deploy", subcommandOriginal);
896
- printSubcommandHelp(initSubcommand);
897
- return 2;
898
- }
899
- telemetryClient.trackCliSubcommandInit(subcommandOriginal);
900
- return handleInitDeployment(client, telemetryClient);
901
- case "continue":
902
- if (parsedArguments.flags["--help"]) {
903
- telemetryClient.trackCliFlagHelp("deploy", subcommandOriginal);
904
- printSubcommandHelp(continueSubcommand);
905
- return 2;
906
- }
907
- telemetryClient.trackCliSubcommandContinue(subcommandOriginal);
908
- return handleContinueSubcommand(client, telemetryClient);
909
- default:
910
- if (parsedArguments.flags["--help"]) {
911
- telemetryClient.trackCliFlagHelp("deploy");
912
- output_manager_default.print(help(deployCommand, { columns: client.stderr.columns }));
913
- return 2;
914
- }
915
- return handleDefaultDeploy(client, telemetryClient);
916
- }
917
- };
918
- async function handleInitDeployment(client, telemetryClient) {
919
- const flagsSpecification = getFlagsSpecification(initSubcommand.options);
920
- let parsedArguments;
921
- try {
922
- parsedArguments = parseArguments(client.argv.slice(2), flagsSpecification);
923
- } catch (error2) {
924
- printError(error2);
925
- return 1;
926
- }
927
- telemetryClient.trackCliFlagJson(parsedArguments.flags["--json"]);
928
- telemetryClient.trackCliOptionFormat(parsedArguments.flags["--format"]);
929
- telemetryClient.trackCliOptionProject(parsedArguments.flags["--project"]);
930
- const projectNameOrId = parsedArguments.flags["--project"];
931
- const formatResult = validateJsonOutput(parsedArguments.flags);
932
- if (!formatResult.valid) {
933
- output_manager_default.error(formatResult.error);
934
- return 1;
935
- }
936
- const asJson = formatResult.jsonOutput || client.nonInteractive;
937
- let args = parsedArguments.args;
938
- if (args[0] === "deploy")
939
- args = args.slice(1);
940
- if (args[0] === "init")
941
- args = args.slice(1);
942
- let paths;
943
- if (args.length > 0) {
944
- paths = args.map((item) => resolve2(client.cwd, item));
945
- telemetryClient.trackCliArgumentProjectPath(paths[0]);
946
- } else {
947
- paths = [client.cwd];
948
- }
949
- const pathValidation = await validatePaths(client, paths);
950
- if (!pathValidation.valid) {
951
- return pathValidation.exitCode;
952
- }
953
- await compileVercelConfig(paths[0]);
954
- const shouldUseEarlyLocalConfig = paths[0] === client.cwd;
955
- let localConfig = shouldUseEarlyLocalConfig ? client.localConfig || readLocalConfig(paths[0]) : readLocalConfig(paths[0]);
956
- if (localConfig) {
957
- client.localConfig = localConfig;
958
- const { version } = localConfig;
959
- const file = highlight(localConfig[import_client3.fileNameSymbol]);
960
- const prop = code("version");
961
- if (version) {
962
- if (typeof version === "number") {
963
- if (version !== 2) {
964
- const two = code(String(2));
965
- output_manager_default.error(
966
- `The value of the ${prop} property within ${file} can only be ${two}.`
967
- );
968
- return 1;
969
- }
970
- } else {
971
- output_manager_default.error(
972
- `The ${prop} property inside your ${file} file must be a number.`
973
- );
974
- return 1;
975
- }
976
- }
977
- }
978
- const { log, debug, error } = output_manager_default;
979
- const quiet = !client.stdout.isTTY;
980
- let { path: cwd } = pathValidation;
981
- const autoConfirm = parsedArguments.flags["--yes"];
982
- const target = parseTarget({
983
- flagName: "target",
984
- flags: parsedArguments.flags
985
- });
986
- telemetryClient.trackTargetEnvironment(target);
987
- const parsedArchive = parsedArguments.flags["--archive"];
988
- if (typeof parsedArchive === "string" && !(isValidArchive(parsedArchive) || parsedArchive === deprecatedArchiveSplitTgz)) {
989
- output_manager_default.error(`Format must be one of: ${import_client3.VALID_ARCHIVE_FORMATS.join(", ")}`);
990
- return 1;
991
- }
992
- if (parsedArchive === deprecatedArchiveSplitTgz) {
993
- output_manager_default.print(
994
- `${prependEmoji(
995
- `${param("--archive=tgz")} now has the same behavior as ${param(
996
- "--archive=split-tgz"
997
- )}. Please use ${param("--archive=tgz")} instead.`,
998
- emoji("warning")
999
- )}
1000
- `
1001
- );
1002
- }
1003
- const cliMeta = parseMeta(parsedArguments.flags["--meta"]);
1004
- const isV0 = cliMeta.v0 === "true";
1005
- const link = await ensureLink("deploy", client, cwd, {
1006
- autoConfirm,
1007
- // Only explicit names: the folder-name fallback is derived inside
1008
- // `setupAndLink`, and passing it would suppress Git-match suggestions.
1009
- projectName: projectNameOrId ?? localConfig?.name,
1010
- failIfNotFound: !!projectNameOrId,
1011
- v0: isV0
1012
- });
1013
- if (typeof link === "number") {
1014
- return link;
1015
- }
1016
- const { org, project } = link;
1017
- const rootDirectory = project.rootDirectory;
1018
- const sourceFilesOutsideRootDirectory = project.sourceFilesOutsideRootDirectory ?? true;
1019
- if (link.repoRoot) {
1020
- cwd = link.repoRoot;
1021
- }
1022
- const contextName = org.slug;
1023
- client.config.currentTeam = org.type === "team" ? org.id : void 0;
1024
- if (rootDirectory && await validateRootDirectory(
1025
- cwd,
1026
- join4(cwd, rootDirectory),
1027
- project ? `To change your Project Settings, go to https://vercel.com/${org?.slug}/${project.name}/settings` : ""
1028
- ) === false) {
1029
- return 1;
1030
- }
1031
- if (rootDirectory) {
1032
- const rootDirectoryPath = join4(cwd, rootDirectory);
1033
- await compileVercelConfig(rootDirectoryPath);
1034
- const rootDirectoryConfig = readLocalConfig(rootDirectoryPath);
1035
- if (rootDirectoryConfig) {
1036
- debug(`Read local config from root directory (${rootDirectory})`);
1037
- localConfig = rootDirectoryConfig;
1038
- } else if (localConfig) {
1039
- output_manager_default.print(
1040
- `${prependEmoji(
1041
- `The ${highlight(
1042
- localConfig[import_client3.fileNameSymbol]
1043
- )} file should be inside of the provided root directory.`,
1044
- emoji("warning")
1045
- )}
1046
- `
1047
- );
1048
- }
1049
- }
1050
- localConfig = localConfig || {};
1051
- if (localConfig.name) {
1052
- output_manager_default.print(
1053
- `${prependEmoji(
1054
- `The ${code("name")} property in ${highlight(
1055
- localConfig[import_client3.fileNameSymbol]
1056
- )} is deprecated (https://vercel.link/name-prop)`,
1057
- emoji("warning")
1058
- )}
1059
- `
1060
- );
1061
- }
1062
- const isObject = (item) => Object.prototype.toString.call(item) === "[object Object]";
1063
- if (typeof localConfig.env !== "undefined" && !isObject(localConfig.env)) {
1064
- error(
1065
- `The ${code("env")} property in ${highlight(
1066
- localConfig[import_client3.fileNameSymbol]
1067
- )} needs to be an object`
1068
- );
1069
- return 1;
1070
- }
1071
- if (typeof localConfig.build !== "undefined") {
1072
- if (!isObject(localConfig.build)) {
1073
- error(
1074
- `The ${code("build")} property in ${highlight(
1075
- localConfig[import_client3.fileNameSymbol]
1076
- )} needs to be an object`
1077
- );
1078
- return 1;
1079
- }
1080
- if (typeof localConfig.build.env !== "undefined" && !isObject(localConfig.build.env)) {
1081
- error(
1082
- `The ${code("build.env")} property in ${highlight(
1083
- localConfig[import_client3.fileNameSymbol]
1084
- )} needs to be an object`
1085
- );
1086
- return 1;
1087
- }
1088
- }
1089
- const meta = Object.assign({}, parseMeta(localConfig.meta), cliMeta);
1090
- const gitMetadata = await createGitMeta(
1091
- join4(cwd, project.rootDirectory || ""),
1092
- project
1093
- );
1094
- const deploymentEnv = Object.assign(
1095
- {},
1096
- parseEnv(localConfig.env),
1097
- parseEnv(parsedArguments.flags["--env"])
1098
- );
1099
- const deploymentBuildEnv = Object.assign(
1100
- {},
1101
- parseEnv(localConfig.build && localConfig.build.env),
1102
- parseEnv(parsedArguments.flags["--build-env"])
1103
- );
1104
- try {
1105
- await addProcessEnv(log, deploymentEnv);
1106
- await addProcessEnv(log, deploymentBuildEnv);
1107
- } catch (err) {
1108
- error((0, import_error_utils2.errorToString)(err));
1109
- return 1;
1110
- }
1111
- const regionFlag = (parsedArguments.flags["--regions"] || "").split(",").map((s) => s.trim()).filter(Boolean);
1112
- const regions = regionFlag.length > 0 ? regionFlag : localConfig.regions;
1113
- const currentTeam = org.type === "team" ? org.id : void 0;
1114
- const now = new Now({
1115
- client,
1116
- currentTeam
1117
- });
1118
- const deployStamp = stamp_default();
1119
- const localConfigurationOverrides = pickOverrides(localConfig);
1120
- const name = project.name;
1121
- if (!name) {
1122
- throw new Error(
1123
- "`name` not found on project or provided by existing project"
1124
- );
1125
- }
1126
- const noWait = true;
1127
- try {
1128
- const autoAssignCustomDomains = parsedArguments.flags["--skip-domain"] ? false : void 0;
1129
- const createArgs = {
1130
- name,
1131
- env: deploymentEnv,
1132
- build: { env: deploymentBuildEnv },
1133
- forceNew: parsedArguments.flags["--force"],
1134
- withCache: parsedArguments.flags["--with-cache"],
1135
- prebuilt: true,
1136
- vercelOutputDir: void 0,
1137
- rootDirectory,
1138
- quiet,
1139
- nowConfig: {
1140
- ...localConfig,
1141
- images: void 0
1142
- },
1143
- regions,
1144
- meta,
1145
- gitMetadata,
1146
- deployStamp,
1147
- target,
1148
- skipAutoDetectionConfirmation: autoConfirm,
1149
- noWait,
1150
- withFullLogs: false,
1151
- autoAssignCustomDomains,
1152
- manual: true,
1153
- jsonOutput: asJson,
1154
- linkedProject: project
1155
- };
1156
- if (!localConfig.builds || localConfig.builds.length === 0) {
1157
- createArgs.projectSettings = {
1158
- sourceFilesOutsideRootDirectory,
1159
- rootDirectory,
1160
- ...localConfigurationOverrides
1161
- };
1162
- }
1163
- const { packageJson } = await scanParentDirs(
1164
- join4(cwd, project?.rootDirectory ?? ""),
1165
- true,
1166
- cwd
1167
- );
1168
- let nodeVersion;
1169
- if (packageJson?.engines?.node) {
1170
- try {
1171
- const { range } = await getSupportedNodeVersion(
1172
- packageJson.engines.node
1173
- );
1174
- nodeVersion = range;
1175
- } catch (error2) {
1176
- if (error2 instanceof Error) {
1177
- output_manager_default.warn(error2.message);
1178
- }
1179
- }
1180
- }
1181
- if (!createArgs.projectSettings)
1182
- createArgs.projectSettings = {};
1183
- createArgs.projectSettings.nodeVersion = nodeVersion;
1184
- const deployment = await createDeploy(
1185
- client,
1186
- now,
1187
- contextName,
1188
- cwd,
1189
- createArgs,
1190
- org,
1191
- !project,
1192
- parsedArchive ? "tgz" : void 0
1193
- );
1194
- if (deployment instanceof NotDomainOwner) {
1195
- if (client.nonInteractive) {
1196
- client.stdout.write(
1197
- `${JSON.stringify(
1198
- {
1199
- status: AGENT_STATUS.ERROR,
1200
- reason: "not_domain_owner",
1201
- message: deployment.message,
1202
- next: [
1203
- {
1204
- command: withGlobalFlags(client, "deploy"),
1205
- when: "retry deploy"
1206
- }
1207
- ]
1208
- },
1209
- null,
1210
- 2
1211
- )}
1212
- `
1213
- );
1214
- return 1;
1215
- } else {
1216
- output_manager_default.error(deployment.message);
1217
- return 1;
1218
- }
1219
- }
1220
- if (deployment instanceof Error) {
1221
- const msg = deployment.message || "An unexpected error occurred while deploying your project";
1222
- if (client.nonInteractive) {
1223
- client.stdout.write(
1224
- `${JSON.stringify(
1225
- {
1226
- status: AGENT_STATUS.ERROR,
1227
- reason: "deploy_failed",
1228
- message: msg,
1229
- next: [
1230
- {
1231
- command: withGlobalFlags(client, "deploy"),
1232
- when: "retry deploy"
1233
- }
1234
- ]
1235
- },
1236
- null,
1237
- 2
1238
- )}
1239
- `
1240
- );
1241
- return 1;
1242
- } else {
1243
- output_manager_default.error(
1244
- msg,
1245
- void 0,
1246
- "https://vercel.link/help",
1247
- "Contact Support"
1248
- );
1249
- return 1;
1250
- }
1251
- }
1252
- if (deployment.readyState === "CANCELED") {
1253
- if (asJson) {
1254
- output_manager_default.stopSpinner();
1255
- const deploymentJson = getDeploymentOutputJson(
1256
- deployment,
1257
- client.apiUrl,
1258
- {
1259
- name: "DEPLOYMENT_CANCELED",
1260
- message: "The deployment has been canceled."
1261
- }
1262
- );
1263
- const payload = client.nonInteractive ? {
1264
- status: AGENT_STATUS.ERROR,
1265
- reason: "deployment_canceled",
1266
- message: "The deployment has been canceled.",
1267
- deployment: deploymentJson,
1268
- next: [
1269
- {
1270
- command: withGlobalFlags(client, "deploy"),
1271
- when: "retry deploy"
1272
- }
1273
- ]
1274
- } : deploymentJson;
1275
- client.stdout.write(`${JSON.stringify(payload, null, 2)}
1276
- `);
1277
- } else {
1278
- output_manager_default.print("The deployment has been canceled.\n");
1279
- }
1280
- return 1;
1281
- }
1282
- if (deployment.checks?.["deployment-alias"]?.state === "failed") {
1283
- return handleFailedCheckRuns(client, deployment, asJson);
1284
- }
1285
- if (deployment.checksConclusion === "failed") {
1286
- const { checks } = await getDeploymentChecks(client, deployment.id);
1287
- const counters = /* @__PURE__ */ new Map();
1288
- checks.forEach((c) => {
1289
- counters.set(c.conclusion, (counters.get(c.conclusion) ?? 0) + 1);
1290
- });
1291
- const counterList = Array.from(counters).map(([name2, no]) => `${no} ${name2}`).join(", ");
1292
- if (asJson) {
1293
- output_manager_default.stopSpinner();
1294
- const message = `Running Checks: ${counterList}`;
1295
- const deploymentJson = getDeploymentOutputJson(
1296
- deployment,
1297
- client.apiUrl,
1298
- {
1299
- name: "CHECKS_FAILED",
1300
- message
1301
- }
1302
- );
1303
- const payload = client.nonInteractive ? {
1304
- status: AGENT_STATUS.ERROR,
1305
- reason: "checks_failed",
1306
- message,
1307
- deployment: deploymentJson,
1308
- next: [
1309
- {
1310
- command: withGlobalFlags(client, "deploy"),
1311
- when: "retry deploy"
1312
- }
1313
- ]
1314
- } : deploymentJson;
1315
- client.stdout.write(`${JSON.stringify(payload, null, 2)}
1316
- `);
1317
- } else {
1318
- output_manager_default.error(`Running Checks: ${counterList}`);
1319
- }
1320
- return 1;
1321
- }
1322
- if (deployment === null) {
1323
- if (client.nonInteractive) {
1324
- client.stdout.write(
1325
- `${JSON.stringify(
1326
- {
1327
- status: AGENT_STATUS.ERROR,
1328
- reason: "upload_failed",
1329
- message: "Uploading failed. Please try again.",
1330
- next: [
1331
- {
1332
- command: withGlobalFlags(client, "deploy"),
1333
- when: "retry deploy"
1334
- }
1335
- ]
1336
- },
1337
- null,
1338
- 2
1339
- )}
1340
- `
1341
- );
1342
- return 1;
1343
- } else {
1344
- error("Uploading failed. Please try again.");
1345
- return 1;
1346
- }
1347
- }
1348
- if (asJson) {
1349
- output_manager_default.stopSpinner();
1350
- const deploymentJson = getDeploymentOutputJson(deployment, client.apiUrl);
1351
- const isImplicitProduction = deployment.target === "production" && !target;
1352
- const payload = client.nonInteractive ? {
1353
- status: AGENT_STATUS.OK,
1354
- deployment: deploymentJson,
1355
- message: `Deployment ${deployment.url} ready.`,
1356
- ...isImplicitProduction ? {
1357
- hint: "This is the project\u2019s first deployment, so it was assigned to production. Future deployments will be preview deployments unless you use --prod."
1358
- } : {},
1359
- next: [
1360
- {
1361
- command: withGlobalFlags(client, `inspect ${deployment.url}`),
1362
- when: "Inspect deployment"
1363
- },
1364
- ...isImplicitProduction ? [] : [
1365
- {
1366
- command: withGlobalFlags(client, "deploy --prod"),
1367
- when: "Promote to production"
1368
- }
1369
- ]
1370
- ]
1371
- } : deploymentJson;
1372
- client.stdout.write(`${JSON.stringify(payload, null, 2)}
1373
- `);
1374
- return 0;
1375
- }
1376
- return printDeploymentStatus(
1377
- client,
1378
- deployment,
1379
- deployStamp,
1380
- noWait,
1381
- false,
1382
- true
1383
- );
1384
- } catch (err) {
1385
- if ((0, import_error_utils2.isError)(err)) {
1386
- debug(`Error: ${err}
1387
- ${err.stack}`);
1388
- }
1389
- if (err instanceof UploadErrorMissingArchive) {
1390
- output_manager_default.prettyError(err);
1391
- return 1;
1392
- }
1393
- if (err instanceof NotDomainOwner) {
1394
- output_manager_default.error(err.message);
1395
- return 1;
1396
- }
1397
- if (err instanceof DomainNotFound || err instanceof DomainNotVerified || err instanceof NotDomainOwner || err instanceof DomainPermissionDenied || err instanceof DomainVerificationFailed || err instanceof SchemaValidationFailed || err instanceof InvalidDomain || err instanceof DeploymentNotFound || err instanceof BuildsRateLimited || err instanceof DeploymentsRateLimited || err instanceof AliasDomainConfigured || err instanceof MissingBuildScript || err instanceof ConflictingFilePath || err instanceof ConflictingPathSegment || err instanceof ConflictingConfigFiles || err instanceof DeprecatedNowJson) {
1398
- handleCreateDeployError(err, localConfig);
1399
- return 1;
1400
- }
1401
- if (isAPIError(err) && err.code === "size_limit_exceeded") {
1402
- const { sizeLimit = 0 } = err;
1403
- const message = `File size limit exceeded (${(0, import_bytes.default)(sizeLimit)})`;
1404
- error(message);
1405
- return 1;
1406
- }
1407
- printError(err);
1408
- return 1;
1409
- }
1410
- }
1411
- async function handleContinueSubcommand(client, telemetryClient) {
1412
- const flagsSpecification = getFlagsSpecification(continueSubcommand.options);
1413
- let parsedArguments;
1414
- try {
1415
- parsedArguments = parseArguments(client.argv.slice(2), flagsSpecification);
1416
- } catch (error) {
1417
- printError(error);
1418
- return 1;
1419
- }
1420
- const idFlag = parsedArguments.flags["--id"];
1421
- const parsedArchive = parsedArguments.flags["--archive"];
1422
- const errorMessage = parsedArguments.flags["--error"];
1423
- if (typeof parsedArchive === "string" && !isValidArchive(parsedArchive)) {
1424
- output_manager_default.error(`Format must be one of: ${import_client3.VALID_ARCHIVE_FORMATS.join(", ")}`);
1425
- return 1;
1426
- }
1427
- telemetryClient.trackCliOptionArchive(parsedArchive);
1428
- if (parsedArchive && errorMessage !== void 0) {
1429
- output_manager_default.error(`Cannot use ${param("--archive")} with ${param("--error")}`);
1430
- return 1;
1431
- }
1432
- if (errorMessage !== void 0 && errorMessage.trim() === "") {
1433
- output_manager_default.error(`${param("--error")} requires an error message`);
1434
- return 1;
1435
- }
1436
- if (!idFlag) {
1437
- if (client.nonInteractive) {
1438
- outputAgentError(
1439
- client,
1440
- {
1441
- status: AGENT_STATUS.ERROR,
1442
- reason: "missing_id",
1443
- message: "Missing required --id flag. Provide the deployment ID to continue.",
1444
- next: [
1445
- {
1446
- command: withGlobalFlags(
1447
- client,
1448
- "deploy continue --id <deployment-id>"
1449
- ),
1450
- when: "provide deployment ID"
1451
- }
1452
- ]
1453
- },
1454
- 1
1455
- );
1456
- return 1;
1457
- } else {
1458
- output_manager_default.error(
1459
- `Missing required ${param("--id")} flag. Usage: ${getCommandName("deploy continue --id <deployment-id>")}`
1460
- );
1461
- return 1;
1462
- }
1463
- }
1464
- const paths = [client.cwd];
1465
- const pathValidation = await validatePaths(client, paths);
1466
- if (!pathValidation.valid) {
1467
- return pathValidation.exitCode;
1468
- }
1469
- await compileVercelConfig(paths[0]);
1470
- const localConfig = client.localConfig || readLocalConfig(paths[0]);
1471
- if (localConfig) {
1472
- client.localConfig = localConfig;
1473
- }
1474
- let { path: cwd } = pathValidation;
1475
- const link = await ensureLink("deploy", client, cwd, {
1476
- autoConfirm: true,
1477
- // Only explicit names: the folder-name fallback is derived inside
1478
- // `setupAndLink`, and passing it would suppress Git-match suggestions.
1479
- projectName: localConfig?.name
1480
- });
1481
- if (typeof link === "number") {
1482
- return link;
1483
- }
1484
- const { org } = link;
1485
- if (link.repoRoot) {
1486
- cwd = link.repoRoot;
1487
- }
1488
- client.config.currentTeam = org.type === "team" ? org.id : void 0;
1489
- if (errorMessage !== void 0) {
1490
- try {
1491
- await client.fetch(`/deployments/${idFlag}/continue`, {
1492
- method: "POST",
1493
- body: { errorMessage }
1494
- });
1495
- output_manager_default.success(`Marked deployment ${idFlag} as errored`);
1496
- return 0;
1497
- } catch (error) {
1498
- printError(error);
1499
- return 1;
1500
- }
1501
- }
1502
- let vercelOutputDir = join4(cwd, ".vercel/output");
1503
- if (link.repoRoot && link.project.rootDirectory) {
1504
- vercelOutputDir = join4(cwd, link.project.rootDirectory, ".vercel/output");
1505
- }
1506
- const prebuiltExists = await import_fs_extra4.default.pathExists(vercelOutputDir);
1507
- if (!prebuiltExists) {
1508
- if (client.nonInteractive) {
1509
- outputAgentError(
1510
- client,
1511
- {
1512
- status: AGENT_STATUS.ERROR,
1513
- reason: "prebuilt_not_found",
1514
- message: 'No prebuilt output found in ".vercel/output". Run build first.',
1515
- next: [
1516
- {
1517
- command: withGlobalFlags(client, "build"),
1518
- when: "generate prebuilt output"
1519
- },
1520
- {
1521
- command: withGlobalFlags(
1522
- client,
1523
- `deploy continue --id ${idFlag}`
1524
- ),
1525
- when: "deploy prebuilt output"
1526
- }
1527
- ]
1528
- },
1529
- 1
1530
- );
1531
- return 1;
1532
- } else {
1533
- output_manager_default.error(
1534
- `No prebuilt output found in ".vercel/output". Run ${getCommandName(
1535
- "build"
1536
- )} to generate a local build.`
1537
- );
1538
- return 1;
1539
- }
1540
- }
1541
- const deployStamp = stamp_default();
1542
- return handleContinueDeployment({
1543
- client,
1544
- deploymentId: idFlag,
1545
- cwd,
1546
- deployStamp,
1547
- noWait: false,
1548
- org,
1549
- vercelOutputDir,
1550
- archive: parsedArchive ? "tgz" : void 0
1551
- });
1552
- }
1553
- async function handleDefaultDeploy(client, telemetryClient) {
1554
- const flagsSpecification = getFlagsSpecification(deployCommand.options);
1555
- let parsedArguments;
1556
- try {
1557
- parsedArguments = parseArguments(client.argv.slice(2), flagsSpecification);
1558
- } catch (error2) {
1559
- printError(error2);
1560
- return 1;
1561
- }
1562
- telemetryClient.trackCliOptionArchive(parsedArguments.flags["--archive"]);
1563
- telemetryClient.trackCliOptionEnv(parsedArguments.flags["--env"]);
1564
- telemetryClient.trackCliOptionBuildEnv(parsedArguments.flags["--build-env"]);
1565
- telemetryClient.trackCliOptionMeta(parsedArguments.flags["--meta"]);
1566
- telemetryClient.trackCliFlagPrebuilt(parsedArguments.flags["--prebuilt"]);
1567
- telemetryClient.trackCliOptionRegions(parsedArguments.flags["--regions"]);
1568
- telemetryClient.trackCliFlagNoWait(parsedArguments.flags["--no-wait"]);
1569
- telemetryClient.trackCliFlagDry(parsedArguments.flags["--dry"]);
1570
- telemetryClient.trackCliFlagYes(parsedArguments.flags["--yes"]);
1571
- telemetryClient.trackCliOptionTarget(parsedArguments.flags["--target"]);
1572
- telemetryClient.trackCliFlagProd(parsedArguments.flags["--prod"]);
1573
- telemetryClient.trackCliFlagTemporary(parsedArguments.flags["--temporary"]);
1574
- telemetryClient.trackCliFlagSkipDomain(
1575
- parsedArguments.flags["--skip-domain"]
1576
- );
1577
- telemetryClient.trackCliFlagLogs(parsedArguments.flags["--logs"]);
1578
- telemetryClient.trackCliFlagNoLogs(parsedArguments.flags["--no-logs"]);
1579
- telemetryClient.trackCliFlagGuidance(parsedArguments.flags["--guidance"]);
1580
- telemetryClient.trackCliFlagForce(parsedArguments.flags["--force"]);
1581
- telemetryClient.trackCliFlagWithCache(parsedArguments.flags["--with-cache"]);
1582
- telemetryClient.trackCliFlagJson(parsedArguments.flags["--json"]);
1583
- telemetryClient.trackCliOptionFormat(parsedArguments.flags["--format"]);
1584
- telemetryClient.trackCliOptionProject(parsedArguments.flags["--project"]);
1585
- const projectNameOrId = parsedArguments.flags["--project"];
1586
- const formatResult = validateJsonOutput(parsedArguments.flags);
1587
- if (!formatResult.valid) {
1588
- output_manager_default.error(formatResult.error);
1589
- return 1;
1590
- }
1591
- const asJson = formatResult.jsonOutput || client.nonInteractive;
1592
- if ("--confirm" in parsedArguments.flags) {
1593
- telemetryClient.trackCliFlagConfirm(parsedArguments.flags["--confirm"]);
1594
- output_manager_default.warn("`--confirm` is deprecated, please use `--yes` instead");
1595
- parsedArguments.flags["--yes"] = parsedArguments.flags["--confirm"];
1596
- }
1597
- if ("--no-logs" in parsedArguments.flags) {
1598
- output_manager_default.warn("`--no-logs` is deprecated and now the default behavior.");
1599
- }
1600
- if (parsedArguments.args[0] === deployCommand.name) {
1601
- parsedArguments.args.shift();
1602
- }
1603
- let paths;
1604
- if (parsedArguments.args.length > 0) {
1605
- paths = parsedArguments.args.map((item) => resolve2(client.cwd, item));
1606
- telemetryClient.trackCliArgumentProjectPath(paths[0]);
1607
- } else {
1608
- paths = [client.cwd];
1609
- }
1610
- const pathValidation = await validatePaths(client, paths);
1611
- if (!pathValidation.valid) {
1612
- return pathValidation.exitCode;
1613
- }
1614
- try {
1615
- await compileVercelConfig(paths[0]);
1616
- } catch (err) {
1617
- if (err instanceof ConflictingConfigFiles || err instanceof DeprecatedNowJson) {
1618
- output_manager_default.prettyError(err);
1619
- return 1;
1620
- }
1621
- throw err;
1622
- }
1623
- const shouldUseEarlyLocalConfig = paths[0] === client.cwd;
1624
- let localConfig = shouldUseEarlyLocalConfig ? client.localConfig || readLocalConfig(paths[0]) : readLocalConfig(paths[0]);
1625
- if (localConfig) {
1626
- client.localConfig = localConfig;
1627
- const { version } = localConfig;
1628
- const file = highlight(localConfig[import_client3.fileNameSymbol]);
1629
- const prop = code("version");
1630
- if (version) {
1631
- if (typeof version === "number") {
1632
- if (version !== 2) {
1633
- const two = code(String(2));
1634
- output_manager_default.error(
1635
- `The value of the ${prop} property within ${file} can only be ${two}.`
1636
- );
1637
- return 1;
1638
- }
1639
- } else {
1640
- output_manager_default.error(
1641
- `The ${prop} property inside your ${file} file must be a number.`
1642
- );
1643
- return 1;
1644
- }
1645
- }
1646
- }
1647
- const { log, debug, error, prettyError } = output_manager_default;
1648
- const quiet = !client.stdout.isTTY;
1649
- let { path: cwd } = pathValidation;
1650
- const autoConfirm = parsedArguments.flags["--yes"] || client.nonInteractive;
1651
- if (parsedArguments.flags["--name"]) {
1652
- output_manager_default.print(
1653
- `${prependEmoji(
1654
- `The ${param(
1655
- "--name"
1656
- )} option is deprecated (https://vercel.link/name-flag)`,
1657
- emoji("warning")
1658
- )}
1659
- `
1660
- );
1661
- telemetryClient.trackCliOptionName(parsedArguments.flags["--name"]);
1662
- }
1663
- if (parsedArguments.flags["--no-clipboard"]) {
1664
- output_manager_default.print(
1665
- `${prependEmoji(
1666
- `The ${param(
1667
- "--no-clipboard"
1668
- )} option was ignored because it is the default behavior. Please remove it.`,
1669
- emoji("warning")
1670
- )}
1671
- `
1672
- );
1673
- telemetryClient.trackCliFlagNoClipboard(true);
1674
- }
1675
- let isAnonymous = !client.authConfig.token && Boolean(parsedArguments.flags["--temporary"]);
1676
- if (!client.authConfig.token && !isAnonymous) {
1677
- output_manager_default.prettyError({
1678
- message: `No existing credentials found. Run ${getCommandName("deploy --temporary")} to create a temporary deployment you can claim later, or ${getCommandName("login")} to log in.`,
1679
- link: "https://err.sh/vercel/no-credentials-found"
1680
- });
1681
- return 1;
1682
- }
1683
- let target = parseTarget({
1684
- flagName: "target",
1685
- flags: parsedArguments.flags
1686
- });
1687
- telemetryClient.trackTargetEnvironment(target);
1688
- if (!validateAnonymousTarget(isAnonymous, target)) {
1689
- return 1;
1690
- }
1691
- const skipDomain = parsedArguments.flags["--skip-domain"];
1692
- if (skipDomain && target !== "production") {
1693
- output_manager_default.error(
1694
- "The `--skip-domain` option can only be used with production deployments. Use `--prod` or `--target=production`."
1695
- );
1696
- return 1;
1697
- }
1698
- const parsedArchive = parsedArguments.flags["--archive"];
1699
- if (typeof parsedArchive === "string" && !(isValidArchive(parsedArchive) || parsedArchive === deprecatedArchiveSplitTgz)) {
1700
- output_manager_default.error(`Format must be one of: ${import_client3.VALID_ARCHIVE_FORMATS.join(", ")}`);
1701
- return 1;
1702
- }
1703
- if (parsedArchive === deprecatedArchiveSplitTgz) {
1704
- output_manager_default.print(
1705
- `${prependEmoji(
1706
- `${param("--archive=tgz")} now has the same behavior as ${param(
1707
- "--archive=split-tgz"
1708
- )}. Please use ${param("--archive=tgz")} instead.`,
1709
- emoji("warning")
1710
- )}
1711
- `
1712
- );
1713
- }
1714
- const cliMeta = parseMeta(parsedArguments.flags["--meta"]);
1715
- const isV0 = cliMeta.v0 === "true";
1716
- const anonymousSetup = await setupAnonymousDeployment(client, cwd, {
1717
- isAnonymous,
1718
- dryRun: Boolean(parsedArguments.flags["--dry"])
1719
- });
1720
- if (typeof anonymousSetup === "number") {
1721
- return anonymousSetup;
1722
- }
1723
- isAnonymous = anonymousSetup.isAnonymous;
1724
- const anonymousLink = anonymousSetup.anonymousLink;
1725
- if (anonymousLink) {
1726
- target = "production";
1727
- }
1728
- const link = anonymousLink ?? await ensureLink("deploy", client, cwd, {
1729
- autoConfirm,
1730
- // Only explicit names: the folder-name fallback is derived inside
1731
- // `setupAndLink`, and passing it would suppress Git-match suggestions.
1732
- projectName: projectNameOrId ?? parsedArguments.flags["--name"] ?? localConfig?.name,
1733
- failIfNotFound: !!projectNameOrId,
1734
- requireExistingLink: parsedArguments.flags["--dry"],
1735
- allowOwnerLookupFallback: true,
1736
- skipRemoteLookup: !parsedArguments.flags["--dry"],
1737
- v0: isV0
1738
- });
1739
- if (typeof link === "number") {
1740
- return link;
1741
- }
1742
- const redeployCommand = withGlobalFlags(
1743
- client,
1744
- isAnonymous ? "deploy --temporary" : "deploy"
1745
- );
1746
- const { org, project } = link;
1747
- const rootDirectory = project.rootDirectory;
1748
- const sourceFilesOutsideRootDirectory = project.sourceFilesOutsideRootDirectory ?? true;
1749
- const projectCwd = cwd;
1750
- if (link.repoRoot) {
1751
- cwd = link.repoRoot;
1752
- }
1753
- const postDeployGuidanceEnabled = !anonymousLink && (client.nonInteractive || !asJson) && isGuidanceEnabled(client, parsedArguments.flags["--guidance"], true);
1754
- const prebuilt = isAnonymous || !!parsedArguments.flags["--prebuilt"];
1755
- let vercelOutputDir;
1756
- let prebuiltBuild = null;
1757
- if (prebuilt) {
1758
- vercelOutputDir = join4(cwd, ".vercel/output");
1759
- if (link.repoRoot && link.project.rootDirectory) {
1760
- vercelOutputDir = join4(cwd, link.project.rootDirectory, ".vercel/output");
1761
- }
1762
- let prebuiltExists = await import_fs_extra4.default.pathExists(vercelOutputDir);
1763
- if (isAnonymous && !parsedArguments.flags["--prebuilt"] && !parsedArguments.flags["--dry"]) {
1764
- const buildExitCode = await runImplicitBuild(client, cwd);
1765
- if (buildExitCode !== 0) {
1766
- return buildExitCode;
1767
- }
1768
- prebuiltExists = await import_fs_extra4.default.pathExists(vercelOutputDir);
1769
- }
1770
- if (!prebuiltExists) {
1771
- error(
1772
- `The ${param(
1773
- "--prebuilt"
1774
- )} option was used, but no prebuilt output found in ".vercel/output". Run ${getCommandName(
1775
- "build"
1776
- )} to generate a local build.`
1777
- );
1778
- return 1;
1779
- }
1780
- prebuiltBuild = await getPrebuiltJson(vercelOutputDir);
1781
- const prebuiltError = prebuiltBuild?.error || prebuiltBuild?.builds?.find((build) => "error" in build)?.error;
1782
- if (prebuiltError) {
1783
- output_manager_default.log(
1784
- `Prebuilt deployment cannot be created because ${getCommandName(
1785
- "build"
1786
- )} failed with error:
1787
- `
1788
- );
1789
- prettyError(prebuiltError);
1790
- return 1;
1791
- }
1792
- const assumedTarget = target || "preview";
1793
- if (prebuiltBuild?.target && prebuiltBuild.target !== assumedTarget) {
1794
- let specifyTarget = "";
1795
- if (prebuiltBuild.target === "production") {
1796
- specifyTarget = ` --prod`;
1797
- }
1798
- prettyError({
1799
- message: `The ${param(
1800
- "--prebuilt"
1801
- )} option was used with the target environment "${assumedTarget}", but the prebuilt output found in ".vercel/output" was built with target environment "${prebuiltBuild.target}". Please run ${getCommandName(`--prebuilt${specifyTarget}`)}.`,
1802
- link: "https://vercel.link/prebuilt-environment-mismatch"
1803
- });
1804
- return 1;
1805
- }
1806
- }
1807
- const orgSlug = isRemoteLookupSkippedLink(link) ? void 0 : org.slug;
1808
- const contextName = orgSlug ?? "the linked account";
1809
- const currentTeam = isOwnerLookupUnavailableLink(link) || org.type !== "team" ? void 0 : org.id;
1810
- client.config.currentTeam = currentTeam;
1811
- if (rootDirectory && await validateRootDirectory(
1812
- cwd,
1813
- join4(cwd, rootDirectory),
1814
- project && orgSlug ? `To change your Project Settings, go to https://vercel.com/${orgSlug}/${project.name}/settings` : ""
1815
- ) === false) {
1816
- return 1;
1817
- }
1818
- if (rootDirectory) {
1819
- const rootDirectoryPath = join4(cwd, rootDirectory);
1820
- await compileVercelConfig(rootDirectoryPath);
1821
- const rootDirectoryConfig = readLocalConfig(rootDirectoryPath);
1822
- if (rootDirectoryConfig) {
1823
- debug(`Read local config from root directory (${rootDirectory})`);
1824
- localConfig = rootDirectoryConfig;
1825
- } else if (localConfig) {
1826
- output_manager_default.print(
1827
- `${prependEmoji(
1828
- `The ${highlight(
1829
- localConfig[import_client3.fileNameSymbol]
1830
- )} file should be inside of the provided root directory.`,
1831
- emoji("warning")
1832
- )}
1833
- `
1834
- );
1835
- }
1836
- }
1837
- localConfig = localConfig || {};
1838
- if (parsedArguments.flags["--dry"]) {
1839
- try {
1840
- const summary = await (0, import_client3.inspectDeploymentFiles)({
1841
- path: cwd,
1842
- archive: parsedArchive ? "tgz" : void 0,
1843
- debug: output_manager_default.isDebugEnabled(),
1844
- prebuilt,
1845
- vercelOutputDir,
1846
- projectName: project.name,
1847
- rootDirectory,
1848
- bulkRedirectsPath: localConfig.bulkRedirectsPath
1849
- });
1850
- const { resolveDeploymentFrameworkPreset } = await import("../../chunks/resolve-deployment-framework-preset-NPE6RLV3.js");
1851
- const framework = resolveDeploymentFrameworkPreset({
1852
- localFramework: localConfig.framework,
1853
- projectFramework: project.framework
1854
- });
1855
- printDeploymentDryRun(
1856
- client,
1857
- summary,
1858
- framework,
1859
- asJson || !client.stdout.isTTY
1860
- );
1861
- return 0;
1862
- } catch (err) {
1863
- printError(err);
1864
- return 1;
1865
- }
1866
- }
1867
- if (localConfig.name) {
1868
- output_manager_default.print(
1869
- `${prependEmoji(
1870
- `The ${code("name")} property in ${highlight(
1871
- localConfig[import_client3.fileNameSymbol]
1872
- )} is deprecated (https://vercel.link/name-prop)`,
1873
- emoji("warning")
1874
- )}
1875
- `
1876
- );
1877
- }
1878
- const isObject = (item) => Object.prototype.toString.call(item) === "[object Object]";
1879
- if (typeof localConfig.env !== "undefined" && !isObject(localConfig.env)) {
1880
- error(
1881
- `The ${code("env")} property in ${highlight(
1882
- localConfig[import_client3.fileNameSymbol]
1883
- )} needs to be an object`
1884
- );
1885
- return 1;
1886
- }
1887
- if (typeof localConfig.build !== "undefined") {
1888
- if (!isObject(localConfig.build)) {
1889
- error(
1890
- `The ${code("build")} property in ${highlight(
1891
- localConfig[import_client3.fileNameSymbol]
1892
- )} needs to be an object`
1893
- );
1894
- return 1;
1895
- }
1896
- if (typeof localConfig.build.env !== "undefined" && !isObject(localConfig.build.env)) {
1897
- error(
1898
- `The ${code("build.env")} property in ${highlight(
1899
- localConfig[import_client3.fileNameSymbol]
1900
- )} needs to be an object`
1901
- );
1902
- return 1;
1903
- }
1904
- }
1905
- const meta = Object.assign({}, parseMeta(localConfig.meta), cliMeta);
1906
- const gitMetadata = await createGitMeta(
1907
- join4(cwd, project.rootDirectory || ""),
1908
- project
1909
- );
1910
- const deploymentEnv = Object.assign(
1911
- {},
1912
- parseEnv(localConfig.env),
1913
- parseEnv(parsedArguments.flags["--env"])
1914
- );
1915
- const deploymentBuildEnv = Object.assign(
1916
- {},
1917
- parseEnv(localConfig.build && localConfig.build.env),
1918
- parseEnv(parsedArguments.flags["--build-env"])
1919
- );
1920
- try {
1921
- await addProcessEnv(log, deploymentEnv);
1922
- await addProcessEnv(log, deploymentBuildEnv);
1923
- } catch (err) {
1924
- error((0, import_error_utils2.errorToString)(err));
1925
- return 1;
1926
- }
1927
- const regionFlag = (parsedArguments.flags["--regions"] || "").split(",").map((s) => s.trim()).filter(Boolean);
1928
- const regions = regionFlag.length > 0 ? regionFlag : localConfig.regions;
1929
- const now = new Now({
1930
- client,
1931
- currentTeam
1932
- });
1933
- const deployStamp = stamp_default();
1934
- let deployment = null;
1935
- const noWait = !!parsedArguments.flags["--no-wait"];
1936
- const withFullLogs = !!parsedArguments.flags["--logs"];
1937
- const localConfigurationOverrides = pickOverrides(localConfig);
1938
- const name = project.name;
1939
- if (!name) {
1940
- throw new Error(
1941
- "`name` not found on project or provided by existing project"
1942
- );
1943
- }
1944
- try {
1945
- const autoAssignCustomDomains = parsedArguments.flags["--skip-domain"] ? false : void 0;
1946
- const createArgs = {
1947
- name,
1948
- project: project.id,
1949
- env: deploymentEnv,
1950
- build: { env: deploymentBuildEnv },
1951
- forceNew: parsedArguments.flags["--force"],
1952
- withCache: parsedArguments.flags["--with-cache"],
1953
- prebuilt,
1954
- anonymous: isAnonymous,
1955
- vercelOutputDir,
1956
- rootDirectory,
1957
- quiet,
1958
- nowConfig: {
1959
- ...localConfig,
1960
- images: void 0
1961
- },
1962
- regions,
1963
- meta,
1964
- gitMetadata,
1965
- deployStamp,
1966
- target,
1967
- skipAutoDetectionConfirmation: autoConfirm || isAnonymous,
1968
- noWait,
1969
- withFullLogs,
1970
- autoAssignCustomDomains,
1971
- agentName: client.agentName,
1972
- jsonOutput: asJson,
1973
- linkedProject: project,
1974
- linkedProjectIsPartial: isRemoteLookupSkippedLink(link)
1975
- };
1976
- if (!localConfig.builds || localConfig.builds.length === 0) {
1977
- createArgs.projectSettings = {
1978
- sourceFilesOutsideRootDirectory,
1979
- rootDirectory,
1980
- ...localConfigurationOverrides
1981
- };
1982
- }
1983
- const { packageJson } = await scanParentDirs(
1984
- join4(cwd, project?.rootDirectory ?? ""),
1985
- true,
1986
- cwd
1987
- );
1988
- let nodeVersion;
1989
- if (packageJson?.engines?.node) {
1990
- try {
1991
- const { range } = await getSupportedNodeVersion(
1992
- packageJson.engines.node
1993
- );
1994
- nodeVersion = range;
1995
- } catch (error2) {
1996
- if (error2 instanceof Error) {
1997
- output_manager_default.warn(error2.message);
1998
- }
1999
- }
2000
- }
2001
- if (!createArgs.projectSettings)
2002
- createArgs.projectSettings = {};
2003
- if (isAnonymous && !Object.hasOwn(localConfig, "framework") && createArgs.projectSettings.framework === void 0 && prebuiltBuild?.detectedFramework?.status === "detected" && prebuiltBuild.detectedFramework.slug) {
2004
- createArgs.projectSettings.framework = prebuiltBuild.detectedFramework.slug;
2005
- }
2006
- createArgs.projectSettings.nodeVersion = nodeVersion;
2007
- deployment = await createDeploy(
2008
- client,
2009
- now,
2010
- contextName,
2011
- cwd,
2012
- createArgs,
2013
- org,
2014
- !project,
2015
- parsedArchive ? "tgz" : void 0
2016
- );
2017
- if (deployment && !(deployment instanceof Error)) {
2018
- telemetryClient.trackDeploymentId(deployment.id);
2019
- }
2020
- if (deployment instanceof NotDomainOwner) {
2021
- if (client.nonInteractive) {
2022
- client.stdout.write(
2023
- `${JSON.stringify(
2024
- {
2025
- status: AGENT_STATUS.ERROR,
2026
- reason: "not_domain_owner",
2027
- message: deployment.message,
2028
- next: [
2029
- {
2030
- command: redeployCommand,
2031
- when: "retry deploy"
2032
- }
2033
- ]
2034
- },
2035
- null,
2036
- 2
2037
- )}
2038
- `
2039
- );
2040
- return 1;
2041
- } else {
2042
- output_manager_default.error(deployment.message);
2043
- return 1;
2044
- }
2045
- }
2046
- if (deployment instanceof Error) {
2047
- const msg = deployment.message || "An unexpected error occurred while deploying your project";
2048
- if (client.nonInteractive) {
2049
- client.stdout.write(
2050
- `${JSON.stringify(
2051
- {
2052
- status: AGENT_STATUS.ERROR,
2053
- reason: "deploy_failed",
2054
- message: msg,
2055
- next: [
2056
- {
2057
- command: redeployCommand,
2058
- when: "retry deploy"
2059
- }
2060
- ]
2061
- },
2062
- null,
2063
- 2
2064
- )}
2065
- `
2066
- );
2067
- return 1;
2068
- } else {
2069
- output_manager_default.error(
2070
- msg,
2071
- void 0,
2072
- "https://vercel.link/help",
2073
- "Contact Support"
2074
- );
2075
- return 1;
2076
- }
2077
- }
2078
- if (deployment.readyState === "CANCELED") {
2079
- if (asJson) {
2080
- output_manager_default.stopSpinner();
2081
- const deploymentJson = getDeploymentOutputJson(
2082
- deployment,
2083
- client.apiUrl,
2084
- {
2085
- name: "DEPLOYMENT_CANCELED",
2086
- message: "The deployment has been canceled."
2087
- }
2088
- );
2089
- const payload = client.nonInteractive ? {
2090
- status: AGENT_STATUS.ERROR,
2091
- reason: "deployment_canceled",
2092
- message: "The deployment has been canceled.",
2093
- deployment: deploymentJson,
2094
- next: [
2095
- {
2096
- command: redeployCommand,
2097
- when: "retry deploy"
2098
- }
2099
- ]
2100
- } : deploymentJson;
2101
- client.stdout.write(`${JSON.stringify(payload, null, 2)}
2102
- `);
2103
- } else {
2104
- output_manager_default.print("The deployment has been canceled.\n");
2105
- }
2106
- return 1;
2107
- }
2108
- if (deployment.checks?.["deployment-alias"]?.state === "failed") {
2109
- return handleFailedCheckRuns(client, deployment, asJson, redeployCommand);
2110
- }
2111
- if (deployment.checksConclusion === "failed") {
2112
- const { checks } = await getDeploymentChecks(client, deployment.id);
2113
- const counters = /* @__PURE__ */ new Map();
2114
- checks.forEach((c) => {
2115
- counters.set(c.conclusion, (counters.get(c.conclusion) ?? 0) + 1);
2116
- });
2117
- const counterList = Array.from(counters).map(([name2, no]) => `${no} ${name2}`).join(", ");
2118
- if (asJson) {
2119
- output_manager_default.stopSpinner();
2120
- const message = `Running Checks: ${counterList}`;
2121
- const deploymentJson = getDeploymentOutputJson(
2122
- deployment,
2123
- client.apiUrl,
2124
- {
2125
- name: "CHECKS_FAILED",
2126
- message
2127
- }
2128
- );
2129
- const payload = client.nonInteractive ? {
2130
- status: AGENT_STATUS.ERROR,
2131
- reason: "checks_failed",
2132
- message,
2133
- deployment: deploymentJson,
2134
- next: [
2135
- {
2136
- command: redeployCommand,
2137
- when: "retry deploy"
2138
- }
2139
- ]
2140
- } : deploymentJson;
2141
- client.stdout.write(`${JSON.stringify(payload, null, 2)}
2142
- `);
2143
- } else {
2144
- output_manager_default.error(`Running Checks: ${counterList}`);
2145
- }
2146
- return 1;
2147
- }
2148
- if (!noWait && shouldReconcileFinalDeployment(deployment)) {
2149
- await getDeployment(client, contextName, deployment.id);
2150
- }
2151
- if (deployment === null) {
2152
- if (client.nonInteractive) {
2153
- client.stdout.write(
2154
- `${JSON.stringify(
2155
- {
2156
- status: AGENT_STATUS.ERROR,
2157
- reason: "upload_failed",
2158
- message: "Uploading failed. Please try again.",
2159
- next: [
2160
- {
2161
- command: redeployCommand,
2162
- when: "retry deploy"
2163
- }
2164
- ]
2165
- },
2166
- null,
2167
- 2
2168
- )}
2169
- `
2170
- );
2171
- return 1;
2172
- } else {
2173
- error("Uploading failed. Please try again.");
2174
- return 1;
2175
- }
2176
- }
2177
- } catch (err) {
2178
- if ((0, import_error_utils2.isError)(err)) {
2179
- debug(`Error: ${err}
2180
- ${err.stack}`);
2181
- }
2182
- const anonymousExitCode = await handleAnonymousDeploymentError({
2183
- client,
2184
- cwd,
2185
- error: err,
2186
- link: anonymousLink,
2187
- isV0,
2188
- retry: () => handleDefaultDeploy(client, telemetryClient)
2189
- });
2190
- if (anonymousExitCode !== void 0) {
2191
- return anonymousExitCode;
2192
- }
2193
- if (err instanceof UploadErrorMissingArchive) {
2194
- if (client.nonInteractive) {
2195
- client.stdout.write(
2196
- `${JSON.stringify(
2197
- {
2198
- status: AGENT_STATUS.ERROR,
2199
- reason: "missing_archive",
2200
- message: err.message,
2201
- next: [
2202
- {
2203
- command: redeployCommand,
2204
- when: "retry deploy"
2205
- }
2206
- ]
2207
- },
2208
- null,
2209
- 2
2210
- )}
2211
- `
2212
- );
2213
- return 1;
2214
- } else {
2215
- output_manager_default.prettyError(err);
2216
- return 1;
2217
- }
2218
- }
2219
- if (err instanceof NotDomainOwner) {
2220
- if (client.nonInteractive) {
2221
- client.stdout.write(
2222
- `${JSON.stringify(
2223
- {
2224
- status: AGENT_STATUS.ERROR,
2225
- reason: "not_domain_owner",
2226
- message: err.message,
2227
- next: [
2228
- {
2229
- command: redeployCommand,
2230
- when: "retry deploy"
2231
- }
2232
- ]
2233
- },
2234
- null,
2235
- 2
2236
- )}
2237
- `
2238
- );
2239
- return 1;
2240
- } else {
2241
- output_manager_default.error(err.message);
2242
- return 1;
2243
- }
2244
- }
2245
- if (err instanceof DomainNotFound && err.meta && err.meta.domain) {
2246
- output_manager_default.debug(
2247
- `The domain ${err.meta.domain} was not found, trying to purchase it`
2248
- );
2249
- const purchase = await purchaseDomainIfAvailable(
2250
- client,
2251
- err.meta.domain,
2252
- contextName
2253
- );
2254
- if (purchase === true) {
2255
- output_manager_default.success(`Successfully purchased the domain ${err.meta.domain}!`);
2256
- return 0;
2257
- }
2258
- if (purchase === false || purchase instanceof UserAborted) {
2259
- handleCreateDeployError(deployment, localConfig);
2260
- return 1;
2261
- }
2262
- handleCreateDeployError(purchase, localConfig);
2263
- return 1;
2264
- }
2265
- if (err instanceof DomainNotFound || err instanceof DomainNotVerified || err instanceof NotDomainOwner || err instanceof DomainPermissionDenied || err instanceof DomainVerificationFailed || err instanceof SchemaValidationFailed || err instanceof InvalidDomain || err instanceof DeploymentNotFound || err instanceof BuildsRateLimited || err instanceof DeploymentsRateLimited || err instanceof AliasDomainConfigured || err instanceof MissingBuildScript || err instanceof ConflictingFilePath || err instanceof ConflictingPathSegment || err instanceof ConflictingConfigFiles) {
2266
- if (client.nonInteractive) {
2267
- client.stdout.write(
2268
- `${JSON.stringify(
2269
- {
2270
- status: AGENT_STATUS.ERROR,
2271
- reason: "deploy_failed",
2272
- message: err instanceof Error ? err.message : String(err),
2273
- next: [
2274
- {
2275
- command: redeployCommand,
2276
- when: "retry deploy"
2277
- }
2278
- ]
2279
- },
2280
- null,
2281
- 2
2282
- )}
2283
- `
2284
- );
2285
- }
2286
- handleCreateDeployError(err, localConfig);
2287
- return 1;
2288
- }
2289
- if (err instanceof BuildError) {
2290
- if (now.url) {
2291
- try {
2292
- const failedDeployment = await getDeployment(
2293
- client,
2294
- contextName,
2295
- now.url
2296
- );
2297
- if (asJson) {
2298
- output_manager_default.stopSpinner();
2299
- client.stdout.write(
2300
- `${JSON.stringify(
2301
- getDeploymentOutputJson(failedDeployment, client.apiUrl, {
2302
- name: "BUILD_ERROR",
2303
- message: err.message
2304
- }),
2305
- null,
2306
- 2
2307
- )}
2308
- `
2309
- );
2310
- } else if (withFullLogs === false) {
2311
- await displayBuildLogsUntilFinalError(
2312
- client,
2313
- failedDeployment,
2314
- err.message
2315
- );
2316
- }
2317
- } catch (_) {
2318
- if (asJson) {
2319
- output_manager_default.stopSpinner();
2320
- client.stdout.write(
2321
- `${JSON.stringify(
2322
- {
2323
- error: {
2324
- name: "BUILD_ERROR",
2325
- message: err.message
2326
- },
2327
- url: `https://${now.url}`
2328
- },
2329
- null,
2330
- 2
2331
- )}
2332
- `
2333
- );
2334
- } else {
2335
- output_manager_default.log(
2336
- `To check build logs run: ${getCommandName(
2337
- `inspect ${now.url} --logs`
2338
- )}`
2339
- );
2340
- output_manager_default.log(
2341
- `Or inspect them in your browser at https://${now.url}/_logs`
2342
- );
2343
- }
2344
- }
2345
- }
2346
- return 1;
2347
- }
2348
- if (isAPIError(err) && err.code === "size_limit_exceeded") {
2349
- const { sizeLimit = 0 } = err;
2350
- const message = `File size limit exceeded (${(0, import_bytes.default)(sizeLimit)})`;
2351
- if (client.nonInteractive) {
2352
- client.stdout.write(
2353
- `${JSON.stringify(
2354
- {
2355
- status: AGENT_STATUS.ERROR,
2356
- reason: "size_limit_exceeded",
2357
- message,
2358
- next: [
2359
- {
2360
- command: redeployCommand,
2361
- when: "retry deploy"
2362
- }
2363
- ]
2364
- },
2365
- null,
2366
- 2
2367
- )}
2368
- `
2369
- );
2370
- }
2371
- error(message);
2372
- return 1;
2373
- }
2374
- if (client.nonInteractive) {
2375
- client.stdout.write(
2376
- `${JSON.stringify(
2377
- {
2378
- status: AGENT_STATUS.ERROR,
2379
- reason: "deploy_failed",
2380
- message: err instanceof Error ? err.message : String(err),
2381
- next: [
2382
- {
2383
- command: redeployCommand,
2384
- when: "retry deploy"
2385
- }
2386
- ]
2387
- },
2388
- null,
2389
- 2
2390
- )}
2391
- `
2392
- );
2393
- }
2394
- printError(err);
2395
- return 1;
2396
- }
2397
- const gitConnectCommand = postDeployGuidanceEnabled ? await getGitConnectRecommendation(client, projectCwd, project, {
2398
- alreadyOffered: "gitConnectOffered" in link ? link.gitConnectOffered : false
2399
- }) : void 0;
2400
- if (asJson) {
2401
- output_manager_default.stopSpinner();
2402
- const anonymousUrl = anonymousLink ? deployment.alias?.[0] : void 0;
2403
- const deploymentJson = {
2404
- ...getDeploymentOutputJson(deployment, client.apiUrl),
2405
- ...anonymousLink ? {
2406
- expiresAt: anonymousLink.expiresAt,
2407
- claimUrl: anonymousLink.claimUrl
2408
- } : {},
2409
- ...anonymousUrl ? { url: `https://${anonymousUrl}`, inspectorUrl: null } : {}
2410
- };
2411
- const isImplicitProduction = deployment.target === "production" && !target;
2412
- const payload = client.nonInteractive ? {
2413
- status: AGENT_STATUS.OK,
2414
- deployment: deploymentJson,
2415
- message: anonymousLink ? `Anonymous deployment ${anonymousUrl ?? deployment.url} ready. It expires in ${(0, import_ms.default)(anonymousLink.expiresAt - Date.now(), { long: true })}. Claim it at ${anonymousLink.claimUrl} to keep it.` : `Deployment ${deployment.url} ready.`,
2416
- ...isImplicitProduction ? {
2417
- hint: "This is the project\u2019s first deployment, so it was assigned to production. Future deployments will be preview deployments unless you use --prod."
2418
- } : {},
2419
- next: anonymousLink ? [
2420
- {
2421
- command: redeployCommand,
2422
- when: "Redeploy changes to the same anonymous deployment"
2423
- },
2424
- {
2425
- command: withGlobalFlags(client, "login"),
2426
- when: "Create an account to keep deploying"
2427
- }
2428
- ] : [
2429
- ...gitConnectCommand ? [
2430
- {
2431
- command: gitConnectCommand,
2432
- when: "Automatically deploy changes on every push"
2433
- }
2434
- ] : [],
2435
- {
2436
- command: `${packageName} curl https://${deployment.url}`,
2437
- when: "Verify deployment, including when Deployment Protection is enabled"
2438
- },
2439
- {
2440
- command: withGlobalFlags(client, `inspect ${deployment.url}`),
2441
- when: "Inspect deployment"
2442
- },
2443
- ...isImplicitProduction ? [] : [
2444
- {
2445
- command: withGlobalFlags(client, "deploy --prod"),
2446
- when: "Promote to production"
2447
- }
2448
- ]
2449
- ]
2450
- } : deploymentJson;
2451
- client.stdout.write(`${JSON.stringify(payload, null, 2)}
2452
- `);
2453
- return 0;
2454
- }
2455
- if (anonymousLink) {
2456
- output_manager_default.print("\n");
2457
- log(
2458
- `This deployment expires in ${(0, import_ms.default)(anonymousLink.expiresAt - Date.now(), {
2459
- long: true
2460
- })}. Claim it to keep it live (don't share this link): ${import_chalk.default.cyan(
2461
- anonymousLink.claimUrl
2462
- )}`
2463
- );
2464
- }
2465
- return await printDeploymentStatus(
2466
- client,
2467
- deployment,
2468
- deployStamp,
2469
- noWait,
2470
- postDeployGuidanceEnabled,
2471
- void 0,
2472
- gitConnectCommand
2473
- );
2474
- }
2475
- function handleCreateDeployError(error, localConfig) {
2476
- if (error instanceof InvalidDomain) {
2477
- output_manager_default.error(`The domain ${error.meta.domain} is not valid`);
2478
- return 1;
2479
- }
2480
- if (error instanceof DomainVerificationFailed) {
2481
- output_manager_default.error(
2482
- `The domain used as a suffix ${import_chalk.default.underline(
2483
- error.meta.domain
2484
- )} is not verified and can't be used as custom suffix.`
2485
- );
2486
- return 1;
2487
- }
2488
- if (error instanceof DomainPermissionDenied) {
2489
- output_manager_default.error(
2490
- `You don't have permissions to access the domain used as a suffix ${import_chalk.default.underline(
2491
- error.meta.domain
2492
- )}.`
2493
- );
2494
- return 1;
2495
- }
2496
- if (error instanceof SchemaValidationFailed) {
2497
- const niceError = getPrettyError(error.meta);
2498
- const fileName = localConfig[import_client3.fileNameSymbol] || "vercel.json";
2499
- niceError.message = `Invalid ${fileName} - ${niceError.message}`;
2500
- output_manager_default.prettyError(niceError);
2501
- return 1;
2502
- }
2503
- if (error instanceof TooManyRequests) {
2504
- output_manager_default.error(
2505
- `Too many requests detected for ${error.meta.api} API. Try again in ${(0, import_ms.default)(
2506
- error.meta.retryAfterMs,
2507
- {
2508
- long: true
2509
- }
2510
- )}.`
2511
- );
2512
- return 1;
2513
- }
2514
- if (error instanceof DomainNotVerified) {
2515
- output_manager_default.error(
2516
- `The domain used as an alias ${import_chalk.default.underline(
2517
- error.meta.domain
2518
- )} is not verified yet. Please verify it.`
2519
- );
2520
- return 1;
2521
- }
2522
- if (error instanceof BuildsRateLimited) {
2523
- output_manager_default.error(error.message);
2524
- const cta = getErrorCta(error.meta);
2525
- output_manager_default.note(
2526
- cta ? `${cta.label}: ${link_default(cta.url)}` : "Upgrade your plan to increase your builds limit."
2527
- );
2528
- return 1;
2529
- }
2530
- if (error instanceof DeploymentNotFound || error instanceof NotDomainOwner || error instanceof DeploymentsRateLimited || error instanceof AliasDomainConfigured || error instanceof MissingBuildScript || error instanceof ConflictingFilePath || error instanceof ConflictingPathSegment || error instanceof ConflictingConfigFiles || error instanceof DeprecatedNowJson) {
2531
- output_manager_default.error(error.message);
2532
- return 1;
2533
- }
2534
- return error;
2535
- }
2536
- function printDeploymentDryRun(client, summary, framework, asJson) {
2537
- const directories = getDirectoryDistribution(summary.files);
2538
- const largestFiles = [...summary.files].sort((a, b) => b.size - a.size || a.path.localeCompare(b.path)).slice(0, 10);
2539
- if (asJson) {
2540
- client.stdout.write(
2541
- `${JSON.stringify(
2542
- {
2543
- framework,
2544
- basePath: summary.basePath,
2545
- fileCount: summary.fileCount,
2546
- totalSize: summary.totalSize,
2547
- ignoredCount: summary.ignoredCount,
2548
- ignored: summary.ignored,
2549
- directories,
2550
- largestFiles,
2551
- files: summary.files
2552
- },
2553
- null,
2554
- 2
2555
- )}
2556
- `
2557
- );
2558
- return;
2559
- }
2560
- const lines = [
2561
- `${import_chalk.default.bold("Deployment Dry Run")}
2562
- `,
2563
- `${import_chalk.default.bold("Detected Framework Preset")}: ${framework.name}${framework.slug ? ` (${framework.slug})` : ""}`,
2564
- `Included: ${summary.fileCount} ${pluralize(
2565
- "file",
2566
- summary.fileCount
2567
- )}, ${formatBytes(summary.totalSize)}`,
2568
- `Ignored: ${summary.ignoredCount} ${pluralize(
2569
- "path",
2570
- summary.ignoredCount
2571
- )}
2572
- `
2573
- ];
2574
- if (directories.length > 0) {
2575
- lines.push(
2576
- table(
2577
- [
2578
- ["Path", "Files", "Size"],
2579
- ...directories.map((item) => [
2580
- item.path,
2581
- String(item.fileCount),
2582
- formatBytes(item.size)
2583
- ])
2584
- ],
2585
- { align: ["l", "r", "r"], hsep: 4 }
2586
- ),
2587
- ""
2588
- );
2589
- }
2590
- if (largestFiles.length > 0) {
2591
- lines.push(
2592
- import_chalk.default.bold("Largest Files"),
2593
- table(
2594
- largestFiles.map((file) => [file.path, formatBytes(file.size)]),
2595
- { align: ["l", "r"], hsep: 4 }
2596
- ),
2597
- ""
2598
- );
2599
- }
2600
- output_manager_default.print(`${lines.join("\n")}
2601
- `);
2602
- }
2603
- function getDirectoryDistribution(files) {
2604
- const directories = /* @__PURE__ */ new Map();
2605
- for (const file of files) {
2606
- const [segment] = file.path.split("/");
2607
- const key = file.path.includes("/") ? segment : file.path;
2608
- const current = directories.get(key) ?? {
2609
- path: key,
2610
- fileCount: 0,
2611
- size: 0
2612
- };
2613
- current.fileCount += 1;
2614
- current.size += file.size;
2615
- directories.set(key, current);
2616
- }
2617
- return Array.from(directories.values()).sort(
2618
- (a, b) => b.size - a.size || a.path.localeCompare(b.path)
2619
- );
2620
- }
2621
- function formatBytes(size) {
2622
- return import_bytes.default.format(size, { decimalPlaces: 1 });
2623
- }
2624
- function pluralize(word, count) {
2625
- return count === 1 ? word : `${word}s`;
2626
- }
2627
- var addProcessEnv = async (log, env) => {
2628
- let val;
2629
- for (const key of Object.keys(env)) {
2630
- if (typeof env[key] !== "undefined") {
2631
- continue;
2632
- }
2633
- val = process.env[key];
2634
- if (typeof val === "string") {
2635
- log(
2636
- `Reading ${import_chalk.default.bold(
2637
- `"${import_chalk.default.bold(key)}"`
2638
- )} from your env (as no value was specified)`
2639
- );
2640
- env[key] = val.replace(/^@/, "\\@");
2641
- } else {
2642
- throw new Error(
2643
- `No value specified for env variable ${import_chalk.default.bold(
2644
- `"${import_chalk.default.bold(key)}"`
2645
- )} and it was not found in your env. If you meant to specify an environment to deploy to, use ${param("--target")}`
2646
- );
2647
- }
2648
- }
2649
- };
2650
- async function handleContinueDeployment({
2651
- client,
2652
- deploymentId,
2653
- cwd,
2654
- deployStamp,
2655
- noWait,
2656
- org,
2657
- vercelOutputDir,
2658
- archive
2659
- }) {
2660
- const { debug, error } = output_manager_default;
2661
- debug(`Continuing deployment: ${deploymentId}`);
2662
- if (!vercelOutputDir) {
2663
- error("Could not determine vercel output directory");
2664
- return 1;
2665
- }
2666
- const token = client.authConfig.token;
2667
- if (!token) {
2668
- error("Missing authentication token");
2669
- return 1;
2670
- }
2671
- output_manager_default.spinner(`Continuing deployment\u2026`, 0);
2672
- try {
2673
- let finalDeployment = null;
2674
- for await (const event of (0, import_client3.continueDeployment)({
2675
- apiUrl: client.apiUrl,
2676
- debug: output_manager_default.isDebugEnabled(),
2677
- deploymentId,
2678
- archive,
2679
- path: cwd,
2680
- teamId: org.type === "team" ? org.id : void 0,
2681
- token,
2682
- vercelOutputDir
2683
- })) {
2684
- debug(`Event: ${event.type}`);
2685
- if (event.type === "hashes-calculated") {
2686
- const hashCount = Object.keys(event.payload).length;
2687
- debug(`Calculated ${hashCount} hashes`);
2688
- }
2689
- if (event.type === "file-count") {
2690
- const { total, missing } = event.payload;
2691
- output_manager_default.spinner(
2692
- `Uploading ${missing.length} of ${total.size} files\u2026`,
2693
- 0
2694
- );
2695
- }
2696
- if (event.type === "file-uploaded") {
2697
- debug(`Uploaded: ${event.payload.file.names.join(" ")}`);
2698
- }
2699
- if (event.type === "all-files-uploaded") {
2700
- output_manager_default.spinner("Continuing deployment\u2026", 0);
2701
- }
2702
- if (event.type === "created") {
2703
- finalDeployment = event.payload;
2704
- output_manager_default.stopSpinner();
2705
- if (finalDeployment.inspectorUrl) {
2706
- printAlignedLabel(
2707
- "Inspect",
2708
- import_chalk.default.cyan(finalDeployment.inspectorUrl)
2709
- );
2710
- }
2711
- const isProdDeployment = finalDeployment.target === "production";
2712
- const previewUrl = `https://${finalDeployment.url}`;
2713
- printAlignedLabel(
2714
- isProdDeployment ? "Production" : "Preview",
2715
- import_chalk.default.cyan(previewUrl),
2716
- isProdDeployment && noWait ? { gutter: "\u25B2" } : {}
2717
- );
2718
- if (noWait) {
2719
- return printDeploymentStatus(
2720
- client,
2721
- finalDeployment,
2722
- deployStamp,
2723
- noWait,
2724
- false
2725
- );
2726
- }
2727
- output_manager_default.spinner("Building\u2026", 0);
2728
- }
2729
- if (event.type === "building") {
2730
- output_manager_default.spinner("Building\u2026", 0);
2731
- }
2732
- if (event.type === "ready") {
2733
- finalDeployment = event.payload;
2734
- output_manager_default.stopSpinner();
2735
- }
2736
- if (event.type === "alias-assigned") {
2737
- finalDeployment = event.payload;
2738
- output_manager_default.stopSpinner();
2739
- if (finalDeployment.target === "production" && finalDeployment.alias && finalDeployment.alias.length > 0) {
2740
- const primaryDomain = finalDeployment.alias[0];
2741
- const prodUrl = `https://${primaryDomain}`;
2742
- printAlignedLabel("Aliased", import_chalk.default.cyan(prodUrl), { gutter: "\u25B2" });
2743
- }
2744
- }
2745
- if (event.type === "checks-v2-failed") {
2746
- output_manager_default.stopSpinner();
2747
- return handleFailedCheckRuns(client, event.payload, false);
2748
- }
2749
- if (event.type === "error") {
2750
- output_manager_default.stopSpinner();
2751
- const payload = event.payload;
2752
- error(payload.message || "An error occurred during deployment");
2753
- return 1;
2754
- }
2755
- }
2756
- if (!finalDeployment) {
2757
- error("Deployment failed: no deployment returned");
2758
- return 1;
2759
- }
2760
- return printDeploymentStatus(
2761
- client,
2762
- finalDeployment,
2763
- deployStamp,
2764
- noWait,
2765
- false
2766
- );
2767
- } catch (err) {
2768
- output_manager_default.stopSpinner();
2769
- if ((0, import_error_utils2.isError)(err)) {
2770
- debug(`Error: ${err}
2771
- ${err.stack}`);
2772
- error(err.message);
2773
- } else {
2774
- error("An unexpected error occurred");
2775
- }
2776
- return 1;
2777
- }
2778
- }
2779
- function getDeploymentOutputJson(deployment, apiUrl, error) {
2780
- return {
2781
- id: deployment.id,
2782
- url: `https://${deployment.url}`,
2783
- inspectorUrl: deployment.inspectorUrl ?? null,
2784
- readyState: deployment.readyState,
2785
- target: deployment.target ?? null,
2786
- deploymentApiUrl: `${apiUrl}/v13/deployments/${deployment.id}`,
2787
- ...error ? { error } : {}
2788
- };
2789
- }
2790
- function shouldReconcileFinalDeployment(deployment) {
2791
- if (!deployment) {
2792
- return false;
2793
- }
2794
- if (deployment.readyState !== "READY") {
2795
- return true;
2796
- }
2797
- if (deployment.aliasError || !deployment.aliasAssigned) {
2798
- return true;
2799
- }
2800
- if (deployment.checksConclusion === "failed" || deployment.checks?.["deployment-alias"]?.state === "failed") {
2801
- return true;
2802
- }
2803
- return false;
2804
- }
2805
- async function handleFailedCheckRuns(client, deployment, asJson, retryCommand = withGlobalFlags(client, "deploy")) {
2806
- const { runs } = await getDeploymentCheckRuns(client, deployment.id);
2807
- const failedRuns = (runs ?? []).filter((run) => run.conclusion === "failed");
2808
- const counters = /* @__PURE__ */ new Map();
2809
- (runs ?? []).forEach((r) => {
2810
- counters.set(r.conclusion, (counters.get(r.conclusion) ?? 0) + 1);
2811
- });
2812
- const counterList = Array.from(counters).map(([name, no]) => `${no} ${name}`).join(", ");
2813
- const message = `Running Checks: ${counterList}`;
2814
- const getCheckRunUrl = (run) => {
2815
- if (run.externalUrl)
2816
- return run.externalUrl;
2817
- if (run.detailsUrl)
2818
- return run.detailsUrl;
2819
- return deployment.inspectorUrl ? `${deployment.inspectorUrl}?checkRunLog=${encodeURIComponent(run.id)}` : null;
2820
- };
2821
- if (asJson) {
2822
- output_manager_default.stopSpinner();
2823
- const deploymentJson = getDeploymentOutputJson(deployment, client.apiUrl, {
2824
- name: "CHECKS_FAILED",
2825
- message
2826
- });
2827
- let payload;
2828
- if (client.nonInteractive) {
2829
- const failedCheckRunsWithLogs = await Promise.all(
2830
- failedRuns.map(async (run) => {
2831
- let logs = [];
2832
- try {
2833
- logs = await getDeploymentCheckRunLogs(
2834
- client,
2835
- deployment.id,
2836
- run.id
2837
- );
2838
- } catch {
2839
- }
2840
- return {
2841
- id: run.id,
2842
- name: run.name,
2843
- conclusion: run.conclusion,
2844
- source: run.source,
2845
- url: getCheckRunUrl(run),
2846
- logs
2847
- };
2848
- })
2849
- );
2850
- payload = {
2851
- status: AGENT_STATUS.ERROR,
2852
- reason: "checks_failed",
2853
- message,
2854
- deployment: deploymentJson,
2855
- failedCheckRuns: failedCheckRunsWithLogs,
2856
- next: [
2857
- {
2858
- command: retryCommand,
2859
- when: "retry deploy after fixing check failures"
2860
- }
2861
- ]
2862
- };
2863
- } else {
2864
- payload = deploymentJson;
2865
- }
2866
- client.stdout.write(`${JSON.stringify(payload, null, 2)}
2867
- `);
2868
- } else {
2869
- output_manager_default.error(message);
2870
- for (const run of failedRuns) {
2871
- const dashboardUrl = getCheckRunUrl(run);
2872
- const label = dashboardUrl ? output_manager_default.link(run.name, dashboardUrl) : run.name;
2873
- output_manager_default.print(` ${import_chalk.default.red("\u2717")} ${label}
2874
- `);
2875
- }
2876
- }
2877
- return 1;
2878
- }
2879
- export {
2880
- deploy_default as default
2881
- };
7
+ import{validatePaths,validateRootDirectory}from"../../chunks/chunk-SGWVKRSR.js";import{Now,UploadErrorMissingArchive,printDeploymentStatus}from"../../chunks/chunk-TXELFFNK.js";import"../../chunks/chunk-M2XARQBF.js";import{parseRepoUrl}from"../../chunks/chunk-75CPY75D.js";import"../../chunks/chunk-2H77IRPI.js";import"../../chunks/chunk-OHDEHZLX.js";import"../../chunks/chunk-M2W3HKV3.js";import"../../chunks/chunk-PHW54NU5.js";import"../../chunks/chunk-U56NHYAH.js";import{readLocalConfig}from"../../chunks/chunk-2PPXY24N.js";import"../../chunks/chunk-TRTEXGVN.js";import"../../chunks/chunk-T3GQAMBJ.js";import{require_ci_info}from"../../chunks/chunk-T52FMXWC.js";import{highlight}from"../../chunks/chunk-J3U3L45Y.js";import"../../chunks/chunk-ZIPVX7LD.js";import"../../chunks/chunk-NHTF332K.js";import{isGuidanceEnabled}from"../../chunks/chunk-6YAADRQB.js";import{parseMeta}from"../../chunks/chunk-CZSOZKHX.js";import{validateJsonOutput}from"../../chunks/chunk-D4MW3RDW.js";import"../../chunks/chunk-P2O5DOYE.js";import{getSubcommand}from"../../chunks/chunk-ETV3C2CV.js";import{continueSubcommand,deployCommand,deprecatedArchiveSplitTgz,getCommandAliases,initSubcommand}from"../../chunks/chunk-BATE73HA.js";import"../../chunks/chunk-3QT7VOE3.js";import"../../chunks/chunk-O7G3CZ42.js";import"../../chunks/chunk-N3N5UHIL.js";import"../../chunks/chunk-YMVDWVMO.js";import"../../chunks/chunk-M5AV545M.js";import"../../chunks/chunk-IVWPQYIH.js";import"../../chunks/chunk-3QHJYVCY.js";import"../../chunks/chunk-NBVY237X.js";import"../../chunks/chunk-WUZD4KBL.js";import"../../chunks/chunk-MEAY2K5Z.js";import"../../chunks/chunk-EQ52F4LH.js";import"../../chunks/chunk-7R5FEXZ5.js";import"../../chunks/chunk-FKCOBJFH.js";import"../../chunks/chunk-CVKB54WW.js";import"../../chunks/chunk-JKTQV2QJ.js";import"../../chunks/chunk-JEIMW3CO.js";import"../../chunks/chunk-ZKYS7EAB.js";import{pickOverrides,require_dist as require_dist2}from"../../chunks/chunk-ZT6KDLLY.js";import"../../chunks/chunk-NNP5NITU.js";import"../../chunks/chunk-K2RAW5DI.js";import"../../chunks/chunk-L3JDEHCQ.js";import{compileVercelConfig}from"../../chunks/chunk-KNEWCUWF.js";import{require_types}from"../../chunks/chunk-GHM7V3GG.js";import"../../chunks/chunk-QR7QPUFN.js";import{stamp_default}from"../../chunks/chunk-XPXOV5UO.js";import"../../chunks/chunk-2I64AYHG.js";import"../../chunks/chunk-SOJCELXH.js";import"../../chunks/chunk-JZRMH5UA.js";import{require_ms}from"../../chunks/chunk-QTKJC2O5.js";import{ensureLink,parseEnv}from"../../chunks/chunk-HZZ5L472.js";import"../../chunks/chunk-LDM3SQAU.js";import{AGENT_STATUS}from"../../chunks/chunk-ENBTTYJR.js";import"../../chunks/chunk-XQ73QIQ3.js";import"../../chunks/chunk-K3KJZLBD.js";import{param}from"../../chunks/chunk-SXUEGVWB.js";import{help}from"../../chunks/chunk-2B2MN3U5.js";import{table}from"../../chunks/chunk-6TAQ6OWD.js";import{parseTarget}from"../../chunks/chunk-GRNTLNC7.js";import{getDeployment}from"../../chunks/chunk-G7Y77DFH.js";import{mapCertError}from"../../chunks/chunk-JYAUUIR4.js";import"../../chunks/chunk-WPS6JZF6.js";import{outputAgentError,quoteArg,withGlobalFlags}from"../../chunks/chunk-NS4FH2TY.js";import"../../chunks/chunk-5QQNYN4N.js";import{TelemetryClient}from"../../chunks/chunk-57GHYR4Y.js";import"../../chunks/chunk-RCTYVKM5.js";import{parseArguments}from"../../chunks/chunk-HTC6KO2B.js";import"../../chunks/chunk-5XJNPXQK.js";import{printError}from"../../chunks/chunk-LNPMDXBJ.js";import"../../chunks/chunk-MY4MONOH.js";import"../../chunks/chunk-7T6TL3GQ.js";import"../../chunks/chunk-BRK4OB4B.js";import{VERCEL_DIR,VERCEL_DIR_PROJECT,addToGitIgnore,createGitMeta,getGitConfigPath,getGitExecutable,getLinkFromDir,getRepoLink,getVercelDirectory,isOwnerLookupUnavailableLink,isRemoteLookupSkippedLink,linkFolderToProject,parseGitConfig,pluckRemoteUrls,require_lib}from"../../chunks/chunk-VLZ47RWM.js";import"../../chunks/chunk-F2ZWW2IO.js";import"../../chunks/chunk-B4ATVYZW.js";import"../../chunks/chunk-PPCFQQSU.js";import"../../chunks/chunk-OSCCYU74.js";import{getFlagsSpecification}from"../../chunks/chunk-JAJW3P42.js";import{printAlignedLabel}from"../../chunks/chunk-XSVBYDYI.js";import"../../chunks/chunk-EVZRQGNK.js";import{AliasDomainConfigured,BuildError,BuildsRateLimited,ConflictingConfigFiles,ConflictingFilePath,ConflictingPathSegment,DeploymentNotFound,DeploymentsRateLimited,DeprecatedNowJson,DomainNotFound,DomainNotVerified,DomainPermissionDenied,DomainVerificationFailed,InvalidDomain,MissingBuildScript,NotDomainOwner,NowError,SchemaValidationFailed,TooManyRequests,UserAborted,code,isAPIError,require_bytes}from"../../chunks/chunk-R2TGGVCT.js";import{getCommandName,packageName}from"../../chunks/chunk-FI772UVH.js";import{require_build_utils}from"../../chunks/chunk-XFVGX5HG.js";import{emoji,link_default,output_manager_default,prependEmoji}from"../../chunks/chunk-Z6Y55QJW.js";import{require_dist}from"../../chunks/chunk-QGIQK47P.js";import"../../chunks/chunk-AVSPFBLM.js";import"../../chunks/chunk-XCJDGQO7.js";import"../../chunks/chunk-YPTLSODC.js";import"../../chunks/chunk-7HL2RPUO.js";import{require_source}from"../../chunks/chunk-U7KCDTCH.js";import"../../chunks/chunk-N3ZZ7FHQ.js";import"../../chunks/chunk-GU6VIFR5.js";import{__toESM}from"../../chunks/chunk-6L236MNA.js";var import_build_utils2=__toESM(require_build_utils(),1),import_client=__toESM(require_dist2(),1),import_error_utils2=__toESM(require_dist(),1),import_bytes=__toESM(require_bytes(),1),import_chalk=__toESM(require_source(),1),import_fs_extra4=__toESM(require_lib(),1),import_ms=__toESM(require_ms(),1);import{join as join4,resolve as resolve2}from"path";async function createDeploy(client,now,contextName,path,createArgs,org,isSettingUpProject,archive){try{return await now.create(path,createArgs,org,isSettingUpProject,archive)}catch(err){if(isAPIError(err)){if(err.code==="rate_limited")throw new DeploymentsRateLimited(err.message);if(err.code==="domain_missing")throw new DomainNotFound(err.value);if(err.code==="domain_not_found"&&err.domain)throw new DomainNotFound(err.domain);if(err.code==="domain_not_verified"&&err.domain)throw new DomainNotVerified(err.domain);if(err.code==="domain_not_verified"&&err.value)throw new DomainVerificationFailed(err.value);if(err.code==="not_domain_owner")throw new NotDomainOwner(err.message);if(err.code==="builds_rate_limited")throw new BuildsRateLimited(err.message,{ctaLabel:err.ctaLabel,ctaUrl:err.ctaUrl,action:err.action,link:err.link});if(err.code==="forbidden")throw new DomainPermissionDenied(err.value,contextName);if(err.code==="bad_request"&&err.keyword)throw new SchemaValidationFailed(err.message,err.keyword,err.dataPath,err.params);if(err.code==="domain_configured")throw new AliasDomainConfigured(err);if(err.code==="missing_build_script")throw new MissingBuildScript(err);if(err.code==="conflicting_file_path")throw new ConflictingFilePath(err);if(err.code==="conflicting_path_segment")throw new ConflictingPathSegment(err);if(err.code==="cert_missing"){let{default:generateCertForDeploy}=await import("../../chunks/generate-cert-for-deploy-VKOWC4PZ.js"),result=await generateCertForDeploy(client,contextName,err.value);return result instanceof NowError?result:createDeploy(client,now,contextName,path,createArgs,org,isSettingUpProject)}if(err.code==="not_found")throw new DeploymentNotFound({context:contextName});let certError=mapCertError(err);if(certError)return certError}throw err}}async function getDeploymentChecks(client,deploymentId){return await client.fetch(`/v1/deployments/${encodeURIComponent(deploymentId)}/checks`)}async function getDeploymentCheckRuns(client,deploymentId){return await client.fetch(`/v2/deployments/${encodeURIComponent(deploymentId)}/check-runs`)}function parseNdjson(text){let entries=[];for(let line of text.split(`
8
+ `))if(line.trim())try{entries.push(JSON.parse(line))}catch{}return entries}async function getDeploymentCheckRunLogs(client,deploymentId,checkRunId){let url=`/v2/deployments/${encodeURIComponent(deploymentId)}/check-runs/${encodeURIComponent(checkRunId)}/logs`;await new Promise(resolve3=>setTimeout(resolve3,1e3));for(let attempt=0;attempt<5;attempt++){attempt>0&&await new Promise(resolve3=>setTimeout(resolve3,2e3));let res=await client.fetch(url,{json:!1}),text=typeof res=="string"?res:await res.text(),entries=parseNdjson(text);if(entries.some(e=>e.level==="eof"))return entries.filter(e=>e.level!=="eof"&&e.level!=="debug").map(({level,timestamp,message})=>({level,timestamp,message}))}return[]}var import_fs_extra=__toESM(require_lib(),1);import{join}from"path";async function getPrebuiltJson(directory){try{return await import_fs_extra.default.readJSON(join(directory,"builds.json"))}catch{}return null}import{resolve}from"path";var SUPPORTED_PROVIDERS=new Set(["github","gitlab","bitbucket"]),defaultDeps={getGitConfigPath,parseGitConfig,fetchProject:(client,project)=>client.fetch(`/v9/projects/${encodeURIComponent(project.id)}`,{accountId:project.accountId}),buildCommand:(client,command)=>withGlobalFlags(client,command,{preserveProject:!0})};async function getGitConnectRecommendation(client,cwd,project,options={}){let{alreadyOffered=!1,deps=defaultDeps}=options;try{if(project.link||alreadyOffered)return;let gitConfigPath=deps.getGitConfigPath({cwd});if(!gitConfigPath)return;let gitConfig=await deps.parseGitConfig(gitConfigPath),remoteUrls=gitConfig&&pluckRemoteUrls(gitConfig);if(!remoteUrls)return;let remotes=Object.values(remoteUrls);if(!remotes.some(remoteUrl=>{let repo=parseRepoUrl(remoteUrl);return repo&&SUPPORTED_PROVIDERS.has(repo.provider)})||client.nonInteractive&&remotes.length!==1||(await deps.fetchProject(client,project)).link)return;let cwdFlag=resolve(cwd)===resolve(client.cwd)?"":` --cwd ${quoteArg(cwd)}`;return deps.buildCommand(client,`git connect${cwdFlag}`)}catch(error){output_manager_default.debug(`Failed to resolve Git connection guidance: ${error}`);return}}var import_types=__toESM(require_types(),1),validArchiveFormats=new Set(import_types.VALID_ARCHIVE_FORMATS);function isValidArchive(archive){return validArchiveFormats.has(archive)}function getErrorCta(source){if(typeof source.ctaLabel=="string"&&typeof source.ctaUrl=="string")return{label:source.ctaLabel,url:source.ctaUrl};if(typeof source.action=="string"&&typeof source.link=="string")return{label:source.action,url:source.link}}var import_types2=__toESM(require_types(),1),DeployTelemetryClient=class extends TelemetryClient{trackCliArgumentProjectPath(projectPaths){projectPaths&&this.trackCliArgument({arg:"project-path",value:this.redactedValue})}trackCliOptionArchive(format){if(format){let allowedFormat=[...import_types2.VALID_ARCHIVE_FORMATS,deprecatedArchiveSplitTgz].includes(format)?format:this.redactedValue;this.trackCliOption({option:"archive",value:allowedFormat})}}trackCliOptionBuildEnv(buildEnv){buildEnv&&buildEnv.length>0&&this.trackCliOption({option:"build-env",value:this.redactedValue})}trackCliOptionEnv(env){env&&env.length>0&&this.trackCliOption({option:"env",value:this.redactedValue})}trackCliOptionMeta(meta){meta&&meta.length>0&&this.trackCliOption({option:"meta",value:this.redactedValue})}trackCliOptionName(name){name&&this.trackCliOption({option:"name",value:this.redactedValue})}trackCliOptionRegions(regions){regions&&this.trackCliOption({option:"regions",value:this.redactedValue})}trackCliOptionTarget(target){target&&this.trackCliOption({option:"target",value:this.redactedTargetName(target)})}trackCliFlagConfirm(flag){flag&&this.trackCliFlag("confirm")}trackCliFlagForce(flag){flag&&this.trackCliFlag("force")}trackCliFlagLogs(flag){flag&&this.trackCliFlag("logs")}trackCliFlagNoLogs(flag){flag&&this.trackCliFlag("no-logs")}trackCliFlagGuidance(flag){flag&&this.trackCliFlag("guidance")}trackCliFlagNoClipboard(flag){flag&&this.trackCliFlag("no-clipboard")}trackCliFlagNoWait(flag){flag&&this.trackCliFlag("no-wait")}trackCliFlagDry(flag){flag&&this.trackCliFlag("dry")}trackCliFlagPrebuilt(flag){flag&&this.trackCliFlag("prebuilt")}trackCliSubcommandInit(actual){this.trackCliSubcommand({subcommand:"init",value:actual})}trackCliSubcommandContinue(actual){this.trackCliSubcommand({subcommand:"continue",value:actual})}trackCliFlagProd(flag){flag&&this.trackCliFlag("prod")}trackCliFlagTemporary(flag){flag&&this.trackCliFlag("temporary")}trackTargetEnvironment(target){super.trackTargetEnvironment(target==="production"?"production":"preview")}trackCliFlagPublic(flag){flag&&this.trackCliFlag("public")}trackCliFlagSkipDomain(flag){flag&&this.trackCliFlag("skip-domain")}trackCliFlagWithCache(flag){flag&&this.trackCliFlag("with-cache")}trackCliFlagYes(flag){flag&&this.trackCliFlag("yes")}trackCliFlagJson(flag){flag&&this.trackCliFlag("json")}trackCliOptionFormat(format){format&&this.trackCliOption({option:"format",value:format})}trackDeploymentId(id){id&&this.trackCommandOutput({key:"deployment-id",value:id})}};var import_fs_extra3=__toESM(require_lib(),1);import{join as join3}from"path";var import_fs_extra2=__toESM(require_lib(),1),import_ci_info=__toESM(require_ci_info(),1),import_build_utils=__toESM(require_build_utils(),1),import_error_utils=__toESM(require_dist(),1);import{join as join2}from"path";var VERCEL_DIR_ANONYMOUS="anonymous.json";function anonymousStatePath(cwd){return join2(cwd,VERCEL_DIR,VERCEL_DIR_ANONYMOUS)}async function readAnonymousState(cwd){try{let state=await(0,import_fs_extra2.readJSON)(anonymousStatePath(cwd));if(typeof state?.projectId=="string"&&typeof state.token=="string"&&typeof state.claimUrl=="string"&&typeof state.expiresAt=="number")return state}catch{}return null}async function writeAnonymousState(cwd,state){let path=anonymousStatePath(cwd);await(0,import_fs_extra2.outputJSON)(path,state,{spaces:2,mode:384}),await(0,import_fs_extra2.chmod)(path,384),await addToGitIgnore(cwd)}async function clearAnonymousState(cwd){await(0,import_fs_extra2.remove)(anonymousStatePath(cwd))}async function bootstrapAnonymousProject(client){let{projectId,token,claimUrl,expiresAt}=await client.fetch("/v1/anonymous/projects?surface=cli",{method:"POST",body:{},useCurrentTeam:!1,retry:{retries:0}});return{projectId,token,claimUrl,expiresAt}}async function ensureAnonymousLink(client,cwd,{requireExistingState=!1,confirmed=!0}={}){if(import_ci_info.default.isCI||!!((0,import_build_utils.getPlatformEnv)("ORG_ID")&&(0,import_build_utils.getPlatformEnv)("PROJECT_ID"))||!!await getLinkFromDir(getVercelDirectory(cwd))||!!(await getRepoLink(client,cwd))?.repoConfig)return"refused";let state=await readAnonymousState(cwd);if(state&&state.expiresAt<=Date.now())return output_manager_default.prettyError({message:`Your temporary deployment has expired. Run ${getCommandName("login")} to create an account and keep deploying this app.`}),"failed";if(!state&&requireExistingState)return"refused";if(!confirmed&&!state)return"confirmation-required";if(!state){try{state=await bootstrapAnonymousProject(client)}catch(err){return output_manager_default.debug(`Anonymous bootstrap failed: ${(0,import_error_utils.errorToString)(err)}`),"refused"}await writeAnonymousState(cwd,state),output_manager_default.log("Not authenticated. Deploying anonymously.")}return client.authConfig={token:state.token,skipWrite:!0},delete process.env.VERCEL_TEAM_ID,{status:"linked",anonymous:!0,expiresAt:state.expiresAt,claimUrl:state.claimUrl,org:{type:"user",id:"",slug:"anonymous"},project:{id:state.projectId,name:state.projectId}}}function validateAnonymousTarget(isAnonymous,target){return isAnonymous&&target&&target!=="production"?(output_manager_default.error(`Anonymous deployments always target production, so "${target}" is not available. Remove the ${param("--target")} option, or run ${getCommandName("login")} to deploy to other environments.`),!1):!0}async function setupAnonymousDeployment(client,cwd,{isAnonymous,dryRun}){isAnonymous||await clearAnonymousState(cwd);let anonymousLink;if(isAnonymous){let anonymous=await ensureAnonymousLink(client,cwd,{requireExistingState:dryRun});if(anonymous==="refused"){let{default:promptMissingCredentials}=await import("../../chunks/prompt-missing-credentials-IUHLYSQU.js"),loginExitCode=await promptMissingCredentials(client);if(loginExitCode!==0)return loginExitCode;isAnonymous=!1}else{if(anonymous==="failed")return 1;if(anonymous==="confirmation-required")return 1;anonymousLink=anonymous}}return{isAnonymous,anonymousLink}}async function handleAnonymousDeploymentError({client,cwd,error,link,isV0,retry}){if(!(!link||!isAPIError(error))){if(error.code==="anonymous_project_claimed"){if(client.nonInteractive||!client.stdin.isTTY)return output_manager_default.prettyError({message:`This project was claimed successfully. Run ${getCommandName("login")} to continue deploying it.`}),1;output_manager_default.log("This project was claimed successfully. Log in to continue deploying it.");let loginExitCode;try{let{default:login}=await import("../../chunks/login-DEAEVUHM.js");loginExitCode=await login(client,{shouldParseArgs:!1})}catch(loginError){return printError(loginError),1}if(loginExitCode!==0)return loginExitCode;let claimedProjectLink=await ensureLink("deploy",client,cwd,{autoConfirm:!0,projectName:link.project.id,failIfNotFound:!0,allowOwnerLookupFallback:!0,v0:isV0});return typeof claimedProjectLink=="number"?claimedProjectLink:(await linkFolderToProject(client,cwd,{projectId:claimedProjectLink.project.id,orgId:claimedProjectLink.org.id},claimedProjectLink.project.name,claimedProjectLink.org.slug,"link",!0,!1),await clearAnonymousState(cwd),retry())}if(error.status===401||error.status===410)return await clearAnonymousState(cwd),output_manager_default.prettyError({message:`Your temporary deployment has expired. Run ${getCommandName("login")} to create an account and keep deploying this app.`}),1}}async function runImplicitBuild(client,cwd){let projectJsonPath=join3(cwd,VERCEL_DIR,VERCEL_DIR_PROJECT),projectJsonExists=await import_fs_extra3.default.pathExists(projectJsonPath);projectJsonExists||await import_fs_extra3.default.outputJSON(projectJsonPath,{settings:{}},{spaces:2}),await import_fs_extra3.default.pathExists(join3(cwd,"package.json"))&&output_manager_default.log("Building your project locally\u2026");let originalArgv=client.argv,originalCwd=client.cwd,originalStdout=client.stdout,previousVercelFirstDeployment=process.env.VERCEL_FIRST_DEPLOYMENT;client.cwd=cwd,client.setArgv([...originalArgv.slice(0,2),"build","--prod","--yes"]),process.env.VERCEL_FIRST_DEPLOYMENT="1",client.stdout=createSinkStream();try{let build=(await import("../build/index.js")).default;return await build(client)}finally{client.setArgv(originalArgv),client.cwd=originalCwd,client.stdout=originalStdout,previousVercelFirstDeployment===void 0?delete process.env.VERCEL_FIRST_DEPLOYMENT:process.env.VERCEL_FIRST_DEPLOYMENT=previousVercelFirstDeployment,projectJsonExists||await import_fs_extra3.default.remove(projectJsonPath)}}function createSinkStream(){return{isTTY:!1,write:()=>!0}}var COMMAND_CONFIG={init:getCommandAliases(initSubcommand),continue:getCommandAliases(continueSubcommand)},deploy_default=async client=>{let telemetryClient=new DeployTelemetryClient({opts:{store:client.telemetryEventStore}}),parsedArguments=null,flagsSpecification=getFlagsSpecification(deployCommand.options);try{parsedArguments=parseArguments(client.argv.slice(2),flagsSpecification,{permissive:!0})}catch(error){return printError(error),1}let subArgs=parsedArguments.args[0]===deployCommand.name?parsedArguments.args.slice(1):parsedArguments.args,{subcommand,subcommandOriginal}=getSubcommand(subArgs,COMMAND_CONFIG);function printSubcommandHelp(command){output_manager_default.print(help(command,{parent:deployCommand,columns:client.stderr.columns}))}switch(subcommand){case"init":return parsedArguments.flags["--help"]?(telemetryClient.trackCliFlagHelp("deploy",subcommandOriginal),printSubcommandHelp(initSubcommand),2):(telemetryClient.trackCliSubcommandInit(subcommandOriginal),handleInitDeployment(client,telemetryClient));case"continue":return parsedArguments.flags["--help"]?(telemetryClient.trackCliFlagHelp("deploy",subcommandOriginal),printSubcommandHelp(continueSubcommand),2):(telemetryClient.trackCliSubcommandContinue(subcommandOriginal),handleContinueSubcommand(client,telemetryClient));default:return parsedArguments.flags["--help"]?(telemetryClient.trackCliFlagHelp("deploy"),output_manager_default.print(help(deployCommand,{columns:client.stderr.columns})),2):handleDefaultDeploy(client,telemetryClient)}};async function handleInitDeployment(client,telemetryClient){let flagsSpecification=getFlagsSpecification(initSubcommand.options),parsedArguments;try{parsedArguments=parseArguments(client.argv.slice(2),flagsSpecification)}catch(error2){return printError(error2),1}telemetryClient.trackCliFlagJson(parsedArguments.flags["--json"]),telemetryClient.trackCliOptionFormat(parsedArguments.flags["--format"]),telemetryClient.trackCliOptionProject(parsedArguments.flags["--project"]);let projectNameOrId=parsedArguments.flags["--project"],formatResult=validateJsonOutput(parsedArguments.flags);if(!formatResult.valid)return output_manager_default.error(formatResult.error),1;let asJson=formatResult.jsonOutput||client.nonInteractive,args=parsedArguments.args;args[0]==="deploy"&&(args=args.slice(1)),args[0]==="init"&&(args=args.slice(1));let paths;args.length>0?(paths=args.map(item=>resolve2(client.cwd,item)),telemetryClient.trackCliArgumentProjectPath(paths[0])):paths=[client.cwd];let pathValidation=await validatePaths(client,paths);if(!pathValidation.valid)return pathValidation.exitCode;await compileVercelConfig(paths[0]);let localConfig=paths[0]===client.cwd?client.localConfig||readLocalConfig(paths[0]):readLocalConfig(paths[0]);if(localConfig){client.localConfig=localConfig;let{version}=localConfig,file=highlight(localConfig[import_client.fileNameSymbol]),prop=code("version");if(version)if(typeof version=="number"){if(version!==2){let two=code(String(2));return output_manager_default.error(`The value of the ${prop} property within ${file} can only be ${two}.`),1}}else return output_manager_default.error(`The ${prop} property inside your ${file} file must be a number.`),1}let{log,debug,error}=output_manager_default,quiet=!client.stdout.isTTY,{path:cwd}=pathValidation,autoConfirm=parsedArguments.flags["--yes"],target=parseTarget({flagName:"target",flags:parsedArguments.flags});telemetryClient.trackTargetEnvironment(target);let parsedArchive=parsedArguments.flags["--archive"];if(typeof parsedArchive=="string"&&!(isValidArchive(parsedArchive)||parsedArchive===deprecatedArchiveSplitTgz))return output_manager_default.error(`Format must be one of: ${import_client.VALID_ARCHIVE_FORMATS.join(", ")}`),1;parsedArchive===deprecatedArchiveSplitTgz&&output_manager_default.print(`${prependEmoji(`${param("--archive=tgz")} now has the same behavior as ${param("--archive=split-tgz")}. Please use ${param("--archive=tgz")} instead.`,emoji("warning"))}
9
+ `);let cliMeta=parseMeta(parsedArguments.flags["--meta"]),isV0=cliMeta.v0==="true";getGitExecutable(cwd);let link=await ensureLink("deploy",client,cwd,{autoConfirm,projectName:projectNameOrId??localConfig?.name,failIfNotFound:!!projectNameOrId,v0:isV0});if(typeof link=="number")return link;let{org,project}=link,rootDirectory=project.rootDirectory,sourceFilesOutsideRootDirectory=project.sourceFilesOutsideRootDirectory??!0;link.repoRoot&&(cwd=link.repoRoot);let contextName=org.slug;if(client.config.currentTeam=org.type==="team"?org.id:void 0,rootDirectory&&await validateRootDirectory(cwd,join4(cwd,rootDirectory),project?`To change your Project Settings, go to https://vercel.com/${org?.slug}/${project.name}/settings`:"")===!1)return 1;if(rootDirectory){let rootDirectoryPath=join4(cwd,rootDirectory);await compileVercelConfig(rootDirectoryPath);let rootDirectoryConfig=readLocalConfig(rootDirectoryPath);rootDirectoryConfig?(debug(`Read local config from root directory (${rootDirectory})`),localConfig=rootDirectoryConfig):localConfig&&output_manager_default.print(`${prependEmoji(`The ${highlight(localConfig[import_client.fileNameSymbol])} file should be inside of the provided root directory.`,emoji("warning"))}
10
+ `)}localConfig=localConfig||{},localConfig.name&&output_manager_default.print(`${prependEmoji(`The ${code("name")} property in ${highlight(localConfig[import_client.fileNameSymbol])} is deprecated (https://vercel.link/name-prop)`,emoji("warning"))}
11
+ `);let isObject=item=>Object.prototype.toString.call(item)==="[object Object]";if(typeof localConfig.env<"u"&&!isObject(localConfig.env))return error(`The ${code("env")} property in ${highlight(localConfig[import_client.fileNameSymbol])} needs to be an object`),1;if(typeof localConfig.build<"u"){if(!isObject(localConfig.build))return error(`The ${code("build")} property in ${highlight(localConfig[import_client.fileNameSymbol])} needs to be an object`),1;if(typeof localConfig.build.env<"u"&&!isObject(localConfig.build.env))return error(`The ${code("build.env")} property in ${highlight(localConfig[import_client.fileNameSymbol])} needs to be an object`),1}let meta=Object.assign({},parseMeta(localConfig.meta),cliMeta),gitMetadata=createGitMeta(join4(cwd,project.rootDirectory||""),project);gitMetadata.catch(()=>{});let deploymentEnv=Object.assign({},parseEnv(localConfig.env),parseEnv(parsedArguments.flags["--env"])),deploymentBuildEnv=Object.assign({},parseEnv(localConfig.build&&localConfig.build.env),parseEnv(parsedArguments.flags["--build-env"]));try{await addProcessEnv(log,deploymentEnv),await addProcessEnv(log,deploymentBuildEnv)}catch(err){return error((0,import_error_utils2.errorToString)(err)),1}let regionFlag=(parsedArguments.flags["--regions"]||"").split(",").map(s=>s.trim()).filter(Boolean),regions=regionFlag.length>0?regionFlag:localConfig.regions,currentTeam=org.type==="team"?org.id:void 0,now=new Now({client,currentTeam}),deployStamp=stamp_default(),localConfigurationOverrides=pickOverrides(localConfig),name=project.name;if(!name)throw new Error("`name` not found on project or provided by existing project");let noWait=!0;try{let autoAssignCustomDomains=parsedArguments.flags["--skip-domain"]?!1:void 0,createArgs={name,env:deploymentEnv,build:{env:deploymentBuildEnv},forceNew:parsedArguments.flags["--force"],withCache:parsedArguments.flags["--with-cache"],prebuilt:!0,vercelOutputDir:void 0,rootDirectory,quiet,nowConfig:{...localConfig,images:void 0},regions,meta,gitMetadata,deployStamp,target,skipAutoDetectionConfirmation:autoConfirm,noWait,withFullLogs:!1,autoAssignCustomDomains,manual:!0,jsonOutput:asJson,linkedProject:project};(!localConfig.builds||localConfig.builds.length===0)&&(createArgs.projectSettings={sourceFilesOutsideRootDirectory,rootDirectory,...localConfigurationOverrides});let{packageJson}=await(0,import_build_utils2.findPackageJson)(join4(cwd,project?.rootDirectory??""),!0,cwd),nodeVersion;if(packageJson?.engines?.node)try{let{range}=await(0,import_build_utils2.getSupportedNodeVersion)(packageJson.engines.node);nodeVersion=range}catch(error2){error2 instanceof Error&&output_manager_default.warn(error2.message)}createArgs.projectSettings||(createArgs.projectSettings={}),createArgs.projectSettings.nodeVersion=nodeVersion;let deployment=await createDeploy(client,now,contextName,cwd,createArgs,org,!project,parsedArchive?"tgz":void 0);if(deployment instanceof NotDomainOwner)return client.nonInteractive?(client.stdout.write(`${JSON.stringify({status:AGENT_STATUS.ERROR,reason:"not_domain_owner",message:deployment.message,next:[{command:withGlobalFlags(client,"deploy"),when:"retry deploy"}]},null,2)}
12
+ `),1):(output_manager_default.error(deployment.message),1);if(deployment instanceof Error){let msg=deployment.message||"An unexpected error occurred while deploying your project";return client.nonInteractive?(client.stdout.write(`${JSON.stringify({status:AGENT_STATUS.ERROR,reason:"deploy_failed",message:msg,next:[{command:withGlobalFlags(client,"deploy"),when:"retry deploy"}]},null,2)}
13
+ `),1):(output_manager_default.error(msg,void 0,"https://vercel.link/help","Contact Support"),1)}if(deployment.readyState==="CANCELED"){if(asJson){output_manager_default.stopSpinner();let deploymentJson=getDeploymentOutputJson(deployment,client.apiUrl,{name:"DEPLOYMENT_CANCELED",message:"The deployment has been canceled."}),payload=client.nonInteractive?{status:AGENT_STATUS.ERROR,reason:"deployment_canceled",message:"The deployment has been canceled.",deployment:deploymentJson,next:[{command:withGlobalFlags(client,"deploy"),when:"retry deploy"}]}:deploymentJson;client.stdout.write(`${JSON.stringify(payload,null,2)}
14
+ `)}else output_manager_default.print(`The deployment has been canceled.
15
+ `);return 1}if(deployment.checks?.["deployment-alias"]?.state==="failed")return handleFailedCheckRuns(client,deployment,asJson);if(deployment.checksConclusion==="failed"){let{checks}=await getDeploymentChecks(client,deployment.id),counters=new Map;checks.forEach(c=>{counters.set(c.conclusion,(counters.get(c.conclusion)??0)+1)});let counterList=Array.from(counters).map(([name2,no])=>`${no} ${name2}`).join(", ");if(asJson){output_manager_default.stopSpinner();let message=`Running Checks: ${counterList}`,deploymentJson=getDeploymentOutputJson(deployment,client.apiUrl,{name:"CHECKS_FAILED",message}),payload=client.nonInteractive?{status:AGENT_STATUS.ERROR,reason:"checks_failed",message,deployment:deploymentJson,next:[{command:withGlobalFlags(client,"deploy"),when:"retry deploy"}]}:deploymentJson;client.stdout.write(`${JSON.stringify(payload,null,2)}
16
+ `)}else output_manager_default.error(`Running Checks: ${counterList}`);return 1}if(deployment===null)return client.nonInteractive?(client.stdout.write(`${JSON.stringify({status:AGENT_STATUS.ERROR,reason:"upload_failed",message:"Uploading failed. Please try again.",next:[{command:withGlobalFlags(client,"deploy"),when:"retry deploy"}]},null,2)}
17
+ `),1):(error("Uploading failed. Please try again."),1);if(asJson){output_manager_default.stopSpinner();let deploymentJson=getDeploymentOutputJson(deployment,client.apiUrl),isImplicitProduction=deployment.target==="production"&&!target,payload=client.nonInteractive?{status:AGENT_STATUS.OK,deployment:deploymentJson,message:`Deployment ${deployment.url} ready.`,...isImplicitProduction?{hint:"This is the project\u2019s first deployment, so it was assigned to production. Future deployments will be preview deployments unless you use --prod."}:{},next:[{command:withGlobalFlags(client,`inspect ${deployment.url}`),when:"Inspect deployment"},...isImplicitProduction?[]:[{command:withGlobalFlags(client,"deploy --prod"),when:"Promote to production"}]]}:deploymentJson;return client.stdout.write(`${JSON.stringify(payload,null,2)}
18
+ `),0}return printDeploymentStatus(client,deployment,deployStamp,noWait,!1,!0)}catch(err){if((0,import_error_utils2.isError)(err)&&debug(`Error: ${err}
19
+ ${err.stack}`),err instanceof UploadErrorMissingArchive)return output_manager_default.prettyError(err),1;if(err instanceof NotDomainOwner)return output_manager_default.error(err.message),1;if(err instanceof DomainNotFound||err instanceof DomainNotVerified||err instanceof NotDomainOwner||err instanceof DomainPermissionDenied||err instanceof DomainVerificationFailed||err instanceof SchemaValidationFailed||err instanceof InvalidDomain||err instanceof DeploymentNotFound||err instanceof BuildsRateLimited||err instanceof DeploymentsRateLimited||err instanceof AliasDomainConfigured||err instanceof MissingBuildScript||err instanceof ConflictingFilePath||err instanceof ConflictingPathSegment||err instanceof ConflictingConfigFiles||err instanceof DeprecatedNowJson)return handleCreateDeployError(err,localConfig),1;if(isAPIError(err)&&err.code==="size_limit_exceeded"){let{sizeLimit=0}=err,message=`File size limit exceeded (${(0,import_bytes.default)(sizeLimit)})`;return error(message),1}return printError(err),1}}async function handleContinueSubcommand(client,telemetryClient){let flagsSpecification=getFlagsSpecification(continueSubcommand.options),parsedArguments;try{parsedArguments=parseArguments(client.argv.slice(2),flagsSpecification)}catch(error){return printError(error),1}let idFlag=parsedArguments.flags["--id"],parsedArchive=parsedArguments.flags["--archive"],errorMessage=parsedArguments.flags["--error"];if(typeof parsedArchive=="string"&&!isValidArchive(parsedArchive))return output_manager_default.error(`Format must be one of: ${import_client.VALID_ARCHIVE_FORMATS.join(", ")}`),1;if(telemetryClient.trackCliOptionArchive(parsedArchive),parsedArchive&&errorMessage!==void 0)return output_manager_default.error(`Cannot use ${param("--archive")} with ${param("--error")}`),1;if(errorMessage!==void 0&&errorMessage.trim()==="")return output_manager_default.error(`${param("--error")} requires an error message`),1;if(!idFlag)return client.nonInteractive?(outputAgentError(client,{status:AGENT_STATUS.ERROR,reason:"missing_id",message:"Missing required --id flag. Provide the deployment ID to continue.",next:[{command:withGlobalFlags(client,"deploy continue --id <deployment-id>"),when:"provide deployment ID"}]},1),1):(output_manager_default.error(`Missing required ${param("--id")} flag. Usage: ${getCommandName("deploy continue --id <deployment-id>")}`),1);let paths=[client.cwd],pathValidation=await validatePaths(client,paths);if(!pathValidation.valid)return pathValidation.exitCode;await compileVercelConfig(paths[0]);let localConfig=client.localConfig||readLocalConfig(paths[0]);localConfig&&(client.localConfig=localConfig);let{path:cwd}=pathValidation,link=await ensureLink("deploy",client,cwd,{autoConfirm:!0,projectName:localConfig?.name});if(typeof link=="number")return link;let{org}=link;if(link.repoRoot&&(cwd=link.repoRoot),client.config.currentTeam=org.type==="team"?org.id:void 0,errorMessage!==void 0)try{return await client.fetch(`/deployments/${idFlag}/continue`,{method:"POST",body:{errorMessage}}),output_manager_default.success(`Marked deployment ${idFlag} as errored`),0}catch(error){return printError(error),1}let vercelOutputDir=join4(cwd,".vercel/output");if(link.repoRoot&&link.project.rootDirectory&&(vercelOutputDir=join4(cwd,link.project.rootDirectory,".vercel/output")),!await import_fs_extra4.default.pathExists(vercelOutputDir))return client.nonInteractive?(outputAgentError(client,{status:AGENT_STATUS.ERROR,reason:"prebuilt_not_found",message:'No prebuilt output found in ".vercel/output". Run build first.',next:[{command:withGlobalFlags(client,"build"),when:"generate prebuilt output"},{command:withGlobalFlags(client,`deploy continue --id ${idFlag}`),when:"deploy prebuilt output"}]},1),1):(output_manager_default.error(`No prebuilt output found in ".vercel/output". Run ${getCommandName("build")} to generate a local build.`),1);let deployStamp=stamp_default();return handleContinueDeployment({client,deploymentId:idFlag,cwd,deployStamp,noWait:!1,org,vercelOutputDir,archive:parsedArchive?"tgz":void 0})}async function handleDefaultDeploy(client,telemetryClient){let flagsSpecification=getFlagsSpecification(deployCommand.options),parsedArguments;try{parsedArguments=parseArguments(client.argv.slice(2),flagsSpecification)}catch(error2){return printError(error2),1}telemetryClient.trackCliOptionArchive(parsedArguments.flags["--archive"]),telemetryClient.trackCliOptionEnv(parsedArguments.flags["--env"]),telemetryClient.trackCliOptionBuildEnv(parsedArguments.flags["--build-env"]),telemetryClient.trackCliOptionMeta(parsedArguments.flags["--meta"]),telemetryClient.trackCliFlagPrebuilt(parsedArguments.flags["--prebuilt"]),telemetryClient.trackCliOptionRegions(parsedArguments.flags["--regions"]),telemetryClient.trackCliFlagNoWait(parsedArguments.flags["--no-wait"]),telemetryClient.trackCliFlagDry(parsedArguments.flags["--dry"]),telemetryClient.trackCliFlagYes(parsedArguments.flags["--yes"]),telemetryClient.trackCliOptionTarget(parsedArguments.flags["--target"]),telemetryClient.trackCliFlagProd(parsedArguments.flags["--prod"]),telemetryClient.trackCliFlagTemporary(parsedArguments.flags["--temporary"]),telemetryClient.trackCliFlagSkipDomain(parsedArguments.flags["--skip-domain"]),telemetryClient.trackCliFlagLogs(parsedArguments.flags["--logs"]),telemetryClient.trackCliFlagNoLogs(parsedArguments.flags["--no-logs"]),telemetryClient.trackCliFlagGuidance(parsedArguments.flags["--guidance"]),telemetryClient.trackCliFlagForce(parsedArguments.flags["--force"]),telemetryClient.trackCliFlagWithCache(parsedArguments.flags["--with-cache"]),telemetryClient.trackCliFlagJson(parsedArguments.flags["--json"]),telemetryClient.trackCliOptionFormat(parsedArguments.flags["--format"]),telemetryClient.trackCliOptionProject(parsedArguments.flags["--project"]);let projectNameOrId=parsedArguments.flags["--project"],formatResult=validateJsonOutput(parsedArguments.flags);if(!formatResult.valid)return output_manager_default.error(formatResult.error),1;let asJson=formatResult.jsonOutput||client.nonInteractive;"--confirm"in parsedArguments.flags&&(telemetryClient.trackCliFlagConfirm(parsedArguments.flags["--confirm"]),output_manager_default.warn("`--confirm` is deprecated, please use `--yes` instead"),parsedArguments.flags["--yes"]=parsedArguments.flags["--confirm"]),"--no-logs"in parsedArguments.flags&&output_manager_default.warn("`--no-logs` is deprecated and now the default behavior."),parsedArguments.args[0]===deployCommand.name&&parsedArguments.args.shift();let paths;parsedArguments.args.length>0?(paths=parsedArguments.args.map(item=>resolve2(client.cwd,item)),telemetryClient.trackCliArgumentProjectPath(paths[0])):paths=[client.cwd];let pathValidation=await validatePaths(client,paths);if(!pathValidation.valid)return pathValidation.exitCode;try{await compileVercelConfig(paths[0])}catch(err){if(err instanceof ConflictingConfigFiles||err instanceof DeprecatedNowJson)return output_manager_default.prettyError(err),1;throw err}let localConfig=paths[0]===client.cwd?client.localConfig||readLocalConfig(paths[0]):readLocalConfig(paths[0]);if(localConfig){client.localConfig=localConfig;let{version}=localConfig,file=highlight(localConfig[import_client.fileNameSymbol]),prop=code("version");if(version)if(typeof version=="number"){if(version!==2){let two=code(String(2));return output_manager_default.error(`The value of the ${prop} property within ${file} can only be ${two}.`),1}}else return output_manager_default.error(`The ${prop} property inside your ${file} file must be a number.`),1}let{log,debug,error,prettyError}=output_manager_default,quiet=!client.stdout.isTTY,{path:cwd}=pathValidation,autoConfirm=parsedArguments.flags["--yes"]||client.nonInteractive;parsedArguments.flags["--name"]&&(output_manager_default.print(`${prependEmoji(`The ${param("--name")} option is deprecated (https://vercel.link/name-flag)`,emoji("warning"))}
20
+ `),telemetryClient.trackCliOptionName(parsedArguments.flags["--name"])),parsedArguments.flags["--no-clipboard"]&&(output_manager_default.print(`${prependEmoji(`The ${param("--no-clipboard")} option was ignored because it is the default behavior. Please remove it.`,emoji("warning"))}
21
+ `),telemetryClient.trackCliFlagNoClipboard(!0));let isAnonymous=!client.authConfig.token&&!!parsedArguments.flags["--temporary"];if(!client.authConfig.token&&!isAnonymous)return output_manager_default.prettyError({message:`No existing credentials found. Run ${getCommandName("deploy --temporary")} to create a temporary deployment you can claim later, or ${getCommandName("login")} to log in.`,link:"https://err.sh/vercel/no-credentials-found"}),1;let target=parseTarget({flagName:"target",flags:parsedArguments.flags});if(telemetryClient.trackTargetEnvironment(target),!validateAnonymousTarget(isAnonymous,target))return 1;if(parsedArguments.flags["--skip-domain"]&&target!=="production")return output_manager_default.error("The `--skip-domain` option can only be used with production deployments. Use `--prod` or `--target=production`."),1;let parsedArchive=parsedArguments.flags["--archive"];if(typeof parsedArchive=="string"&&!(isValidArchive(parsedArchive)||parsedArchive===deprecatedArchiveSplitTgz))return output_manager_default.error(`Format must be one of: ${import_client.VALID_ARCHIVE_FORMATS.join(", ")}`),1;parsedArchive===deprecatedArchiveSplitTgz&&output_manager_default.print(`${prependEmoji(`${param("--archive=tgz")} now has the same behavior as ${param("--archive=split-tgz")}. Please use ${param("--archive=tgz")} instead.`,emoji("warning"))}
22
+ `);let cliMeta=parseMeta(parsedArguments.flags["--meta"]),isV0=cliMeta.v0==="true";parsedArguments.flags["--dry"]||getGitExecutable(cwd);let anonymousSetup=await setupAnonymousDeployment(client,cwd,{isAnonymous,dryRun:!!parsedArguments.flags["--dry"]});if(typeof anonymousSetup=="number")return anonymousSetup;isAnonymous=anonymousSetup.isAnonymous;let anonymousLink=anonymousSetup.anonymousLink;anonymousLink&&(target="production");let link=anonymousLink??await ensureLink("deploy",client,cwd,{autoConfirm,projectName:projectNameOrId??parsedArguments.flags["--name"]??localConfig?.name,failIfNotFound:!!projectNameOrId,requireExistingLink:parsedArguments.flags["--dry"],allowOwnerLookupFallback:!0,skipRemoteLookup:!parsedArguments.flags["--dry"],v0:isV0});if(typeof link=="number")return link;let redeployCommand=withGlobalFlags(client,isAnonymous?"deploy --temporary":"deploy"),{org,project}=link,rootDirectory=project.rootDirectory,sourceFilesOutsideRootDirectory=project.sourceFilesOutsideRootDirectory??!0,projectCwd=cwd;link.repoRoot&&(cwd=link.repoRoot);let postDeployGuidanceEnabled=!anonymousLink&&(client.nonInteractive||!asJson)&&isGuidanceEnabled(client,parsedArguments.flags["--guidance"],!0),prebuilt=isAnonymous||!!parsedArguments.flags["--prebuilt"],vercelOutputDir,prebuiltBuild=null;if(prebuilt){vercelOutputDir=join4(cwd,".vercel/output"),link.repoRoot&&link.project.rootDirectory&&(vercelOutputDir=join4(cwd,link.project.rootDirectory,".vercel/output"));let prebuiltExists=await import_fs_extra4.default.pathExists(vercelOutputDir);if(isAnonymous&&!parsedArguments.flags["--prebuilt"]&&!parsedArguments.flags["--dry"]){let buildExitCode=await runImplicitBuild(client,cwd);if(buildExitCode!==0)return buildExitCode;prebuiltExists=await import_fs_extra4.default.pathExists(vercelOutputDir)}if(!prebuiltExists)return error(`The ${param("--prebuilt")} option was used, but no prebuilt output found in ".vercel/output". Run ${getCommandName("build")} to generate a local build.`),1;prebuiltBuild=await getPrebuiltJson(vercelOutputDir);let prebuiltError=prebuiltBuild?.error||prebuiltBuild?.builds?.find(build=>"error"in build)?.error;if(prebuiltError)return output_manager_default.log(`Prebuilt deployment cannot be created because ${getCommandName("build")} failed with error:
23
+ `),prettyError(prebuiltError),1;let assumedTarget=target||"preview";if(prebuiltBuild?.target&&prebuiltBuild.target!==assumedTarget){let specifyTarget="";return prebuiltBuild.target==="production"&&(specifyTarget=" --prod"),prettyError({message:`The ${param("--prebuilt")} option was used with the target environment "${assumedTarget}", but the prebuilt output found in ".vercel/output" was built with target environment "${prebuiltBuild.target}". Please run ${getCommandName(`--prebuilt${specifyTarget}`)}.`,link:"https://vercel.link/prebuilt-environment-mismatch"}),1}}let orgSlug=isRemoteLookupSkippedLink(link)?void 0:org.slug,contextName=orgSlug??"the linked account",currentTeam=isOwnerLookupUnavailableLink(link)||org.type!=="team"?void 0:org.id;if(client.config.currentTeam=currentTeam,rootDirectory&&await validateRootDirectory(cwd,join4(cwd,rootDirectory),project&&orgSlug?`To change your Project Settings, go to https://vercel.com/${orgSlug}/${project.name}/settings`:"")===!1)return 1;if(rootDirectory){let rootDirectoryPath=join4(cwd,rootDirectory);await compileVercelConfig(rootDirectoryPath);let rootDirectoryConfig=readLocalConfig(rootDirectoryPath);rootDirectoryConfig?(debug(`Read local config from root directory (${rootDirectory})`),localConfig=rootDirectoryConfig):localConfig&&output_manager_default.print(`${prependEmoji(`The ${highlight(localConfig[import_client.fileNameSymbol])} file should be inside of the provided root directory.`,emoji("warning"))}
24
+ `)}if(localConfig=localConfig||{},parsedArguments.flags["--dry"])try{let summary=await(0,import_client.inspectDeploymentFiles)({path:cwd,archive:parsedArchive?"tgz":void 0,debug:output_manager_default.isDebugEnabled(),prebuilt,vercelOutputDir,projectName:project.name,rootDirectory,bulkRedirectsPath:localConfig.bulkRedirectsPath}),{resolveDeploymentFrameworkPreset}=await import("../../chunks/resolve-deployment-framework-preset-XF3NJIDS.js"),framework=resolveDeploymentFrameworkPreset({localFramework:localConfig.framework,projectFramework:project.framework});return printDeploymentDryRun(client,summary,framework,asJson||!client.stdout.isTTY),0}catch(err){return printError(err),1}localConfig.name&&output_manager_default.print(`${prependEmoji(`The ${code("name")} property in ${highlight(localConfig[import_client.fileNameSymbol])} is deprecated (https://vercel.link/name-prop)`,emoji("warning"))}
25
+ `);let isObject=item=>Object.prototype.toString.call(item)==="[object Object]";if(typeof localConfig.env<"u"&&!isObject(localConfig.env))return error(`The ${code("env")} property in ${highlight(localConfig[import_client.fileNameSymbol])} needs to be an object`),1;if(typeof localConfig.build<"u"){if(!isObject(localConfig.build))return error(`The ${code("build")} property in ${highlight(localConfig[import_client.fileNameSymbol])} needs to be an object`),1;if(typeof localConfig.build.env<"u"&&!isObject(localConfig.build.env))return error(`The ${code("build.env")} property in ${highlight(localConfig[import_client.fileNameSymbol])} needs to be an object`),1}let meta=Object.assign({},parseMeta(localConfig.meta),cliMeta),gitMetadata=createGitMeta(join4(cwd,project.rootDirectory||""),project);gitMetadata.catch(()=>{});let deploymentEnv=Object.assign({},parseEnv(localConfig.env),parseEnv(parsedArguments.flags["--env"])),deploymentBuildEnv=Object.assign({},parseEnv(localConfig.build&&localConfig.build.env),parseEnv(parsedArguments.flags["--build-env"]));try{await addProcessEnv(log,deploymentEnv),await addProcessEnv(log,deploymentBuildEnv)}catch(err){return error((0,import_error_utils2.errorToString)(err)),1}let regionFlag=(parsedArguments.flags["--regions"]||"").split(",").map(s=>s.trim()).filter(Boolean),regions=regionFlag.length>0?regionFlag:localConfig.regions,now=new Now({client,currentTeam}),deployStamp=stamp_default(),deployment=null,noWait=!!parsedArguments.flags["--no-wait"],withFullLogs=!!parsedArguments.flags["--logs"],localConfigurationOverrides=pickOverrides(localConfig),name=project.name;if(!name)throw new Error("`name` not found on project or provided by existing project");try{let autoAssignCustomDomains=parsedArguments.flags["--skip-domain"]?!1:void 0,createArgs={name,project:project.id,env:deploymentEnv,build:{env:deploymentBuildEnv},forceNew:parsedArguments.flags["--force"],withCache:parsedArguments.flags["--with-cache"],prebuilt,anonymous:isAnonymous,vercelOutputDir,rootDirectory,quiet,nowConfig:{...localConfig,images:void 0},regions,meta,gitMetadata,deployStamp,target,skipAutoDetectionConfirmation:autoConfirm||isAnonymous,noWait,withFullLogs,autoAssignCustomDomains,agentName:client.agentName,jsonOutput:asJson,linkedProject:project,linkedProjectIsPartial:isRemoteLookupSkippedLink(link)};(!localConfig.builds||localConfig.builds.length===0)&&(createArgs.projectSettings={sourceFilesOutsideRootDirectory,rootDirectory,...localConfigurationOverrides});let{packageJson}=await(0,import_build_utils2.findPackageJson)(join4(cwd,project?.rootDirectory??""),!0,cwd),nodeVersion;if(packageJson?.engines?.node)try{let{range}=await(0,import_build_utils2.getSupportedNodeVersion)(packageJson.engines.node);nodeVersion=range}catch(error2){error2 instanceof Error&&output_manager_default.warn(error2.message)}if(createArgs.projectSettings||(createArgs.projectSettings={}),isAnonymous&&!Object.hasOwn(localConfig,"framework")&&createArgs.projectSettings.framework===void 0&&prebuiltBuild?.detectedFramework?.status==="detected"&&prebuiltBuild.detectedFramework.slug&&(createArgs.projectSettings.framework=prebuiltBuild.detectedFramework.slug),createArgs.projectSettings.nodeVersion=nodeVersion,deployment=await createDeploy(client,now,contextName,cwd,createArgs,org,!project,parsedArchive?"tgz":void 0),deployment&&!(deployment instanceof Error)&&telemetryClient.trackDeploymentId(deployment.id),deployment instanceof NotDomainOwner)return client.nonInteractive?(client.stdout.write(`${JSON.stringify({status:AGENT_STATUS.ERROR,reason:"not_domain_owner",message:deployment.message,next:[{command:redeployCommand,when:"retry deploy"}]},null,2)}
26
+ `),1):(output_manager_default.error(deployment.message),1);if(deployment instanceof Error){let msg=deployment.message||"An unexpected error occurred while deploying your project";return client.nonInteractive?(client.stdout.write(`${JSON.stringify({status:AGENT_STATUS.ERROR,reason:"deploy_failed",message:msg,next:[{command:redeployCommand,when:"retry deploy"}]},null,2)}
27
+ `),1):(output_manager_default.error(msg,void 0,"https://vercel.link/help","Contact Support"),1)}if(deployment.readyState==="CANCELED"){if(asJson){output_manager_default.stopSpinner();let deploymentJson=getDeploymentOutputJson(deployment,client.apiUrl,{name:"DEPLOYMENT_CANCELED",message:"The deployment has been canceled."}),payload=client.nonInteractive?{status:AGENT_STATUS.ERROR,reason:"deployment_canceled",message:"The deployment has been canceled.",deployment:deploymentJson,next:[{command:redeployCommand,when:"retry deploy"}]}:deploymentJson;client.stdout.write(`${JSON.stringify(payload,null,2)}
28
+ `)}else output_manager_default.print(`The deployment has been canceled.
29
+ `);return 1}if(deployment.checks?.["deployment-alias"]?.state==="failed")return handleFailedCheckRuns(client,deployment,asJson,redeployCommand);if(deployment.checksConclusion==="failed"){let{checks}=await getDeploymentChecks(client,deployment.id),counters=new Map;checks.forEach(c=>{counters.set(c.conclusion,(counters.get(c.conclusion)??0)+1)});let counterList=Array.from(counters).map(([name2,no])=>`${no} ${name2}`).join(", ");if(asJson){output_manager_default.stopSpinner();let message=`Running Checks: ${counterList}`,deploymentJson=getDeploymentOutputJson(deployment,client.apiUrl,{name:"CHECKS_FAILED",message}),payload=client.nonInteractive?{status:AGENT_STATUS.ERROR,reason:"checks_failed",message,deployment:deploymentJson,next:[{command:redeployCommand,when:"retry deploy"}]}:deploymentJson;client.stdout.write(`${JSON.stringify(payload,null,2)}
30
+ `)}else output_manager_default.error(`Running Checks: ${counterList}`);return 1}if(!noWait&&shouldReconcileFinalDeployment(deployment)&&await getDeployment(client,contextName,deployment.id),deployment===null)return client.nonInteractive?(client.stdout.write(`${JSON.stringify({status:AGENT_STATUS.ERROR,reason:"upload_failed",message:"Uploading failed. Please try again.",next:[{command:redeployCommand,when:"retry deploy"}]},null,2)}
31
+ `),1):(error("Uploading failed. Please try again."),1)}catch(err){(0,import_error_utils2.isError)(err)&&debug(`Error: ${err}
32
+ ${err.stack}`);let anonymousExitCode=await handleAnonymousDeploymentError({client,cwd,error:err,link:anonymousLink,isV0,retry:()=>handleDefaultDeploy(client,telemetryClient)});if(anonymousExitCode!==void 0)return anonymousExitCode;if(err instanceof UploadErrorMissingArchive)return client.nonInteractive?(client.stdout.write(`${JSON.stringify({status:AGENT_STATUS.ERROR,reason:"missing_archive",message:err.message,next:[{command:redeployCommand,when:"retry deploy"}]},null,2)}
33
+ `),1):(output_manager_default.prettyError(err),1);if(err instanceof NotDomainOwner)return client.nonInteractive?(client.stdout.write(`${JSON.stringify({status:AGENT_STATUS.ERROR,reason:"not_domain_owner",message:err.message,next:[{command:redeployCommand,when:"retry deploy"}]},null,2)}
34
+ `),1):(output_manager_default.error(err.message),1);if(err instanceof DomainNotFound&&err.meta&&err.meta.domain){output_manager_default.debug(`The domain ${err.meta.domain} was not found, trying to purchase it`);let{default:purchaseDomainIfAvailable}=await import("../../chunks/purchase-domain-if-available-O5ARXEZ5.js"),purchase=await purchaseDomainIfAvailable(client,err.meta.domain,contextName);return purchase===!0?(output_manager_default.success(`Successfully purchased the domain ${err.meta.domain}!`),0):purchase===!1||purchase instanceof UserAborted?(handleCreateDeployError(deployment,localConfig),1):(handleCreateDeployError(purchase,localConfig),1)}if(err instanceof DomainNotFound||err instanceof DomainNotVerified||err instanceof NotDomainOwner||err instanceof DomainPermissionDenied||err instanceof DomainVerificationFailed||err instanceof SchemaValidationFailed||err instanceof InvalidDomain||err instanceof DeploymentNotFound||err instanceof BuildsRateLimited||err instanceof DeploymentsRateLimited||err instanceof AliasDomainConfigured||err instanceof MissingBuildScript||err instanceof ConflictingFilePath||err instanceof ConflictingPathSegment||err instanceof ConflictingConfigFiles)return client.nonInteractive&&client.stdout.write(`${JSON.stringify({status:AGENT_STATUS.ERROR,reason:"deploy_failed",message:err instanceof Error?err.message:String(err),next:[{command:redeployCommand,when:"retry deploy"}]},null,2)}
35
+ `),handleCreateDeployError(err,localConfig),1;if(err instanceof BuildError){if(now.url)try{let failedDeployment=await getDeployment(client,contextName,now.url);if(asJson)output_manager_default.stopSpinner(),client.stdout.write(`${JSON.stringify(getDeploymentOutputJson(failedDeployment,client.apiUrl,{name:"BUILD_ERROR",message:err.message}),null,2)}
36
+ `);else if(withFullLogs===!1){let{displayBuildLogsUntilFinalError}=await import("../../chunks/logs-GK7CJBYY.js");await displayBuildLogsUntilFinalError(client,failedDeployment,err.message)}}catch{asJson?(output_manager_default.stopSpinner(),client.stdout.write(`${JSON.stringify({error:{name:"BUILD_ERROR",message:err.message},url:`https://${now.url}`},null,2)}
37
+ `)):(output_manager_default.log(`To check build logs run: ${getCommandName(`inspect ${now.url} --logs`)}`),output_manager_default.log(`Or inspect them in your browser at https://${now.url}/_logs`))}return 1}if(isAPIError(err)&&err.code==="size_limit_exceeded"){let{sizeLimit=0}=err,message=`File size limit exceeded (${(0,import_bytes.default)(sizeLimit)})`;return client.nonInteractive&&client.stdout.write(`${JSON.stringify({status:AGENT_STATUS.ERROR,reason:"size_limit_exceeded",message,next:[{command:redeployCommand,when:"retry deploy"}]},null,2)}
38
+ `),error(message),1}return client.nonInteractive&&client.stdout.write(`${JSON.stringify({status:AGENT_STATUS.ERROR,reason:"deploy_failed",message:err instanceof Error?err.message:String(err),next:[{command:redeployCommand,when:"retry deploy"}]},null,2)}
39
+ `),printError(err),1}let gitConnectCommand=postDeployGuidanceEnabled?await getGitConnectRecommendation(client,projectCwd,project,{alreadyOffered:"gitConnectOffered"in link?link.gitConnectOffered:!1}):void 0;if(asJson){output_manager_default.stopSpinner();let anonymousUrl=anonymousLink?deployment.alias?.[0]:void 0,deploymentJson={...getDeploymentOutputJson(deployment,client.apiUrl),...anonymousLink?{expiresAt:anonymousLink.expiresAt,claimUrl:anonymousLink.claimUrl}:{},...anonymousUrl?{url:`https://${anonymousUrl}`,inspectorUrl:null}:{}},isImplicitProduction=deployment.target==="production"&&!target,payload=client.nonInteractive?{status:AGENT_STATUS.OK,deployment:deploymentJson,message:anonymousLink?`Anonymous deployment ${anonymousUrl??deployment.url} ready. It expires in ${(0,import_ms.default)(anonymousLink.expiresAt-Date.now(),{long:!0})}. Claim it at ${anonymousLink.claimUrl} to keep it.`:`Deployment ${deployment.url} ready.`,...isImplicitProduction?{hint:"This is the project\u2019s first deployment, so it was assigned to production. Future deployments will be preview deployments unless you use --prod."}:{},next:anonymousLink?[{command:redeployCommand,when:"Redeploy changes to the same anonymous deployment"},{command:withGlobalFlags(client,"login"),when:"Create an account to keep deploying"}]:[...gitConnectCommand?[{command:gitConnectCommand,when:"Automatically deploy changes on every push"}]:[],{command:`${packageName} curl https://${deployment.url}`,when:"Verify deployment, including when Deployment Protection is enabled"},{command:withGlobalFlags(client,`inspect ${deployment.url}`),when:"Inspect deployment"},...isImplicitProduction?[]:[{command:withGlobalFlags(client,"deploy --prod"),when:"Promote to production"}]]}:deploymentJson;return client.stdout.write(`${JSON.stringify(payload,null,2)}
40
+ `),0}return anonymousLink&&(output_manager_default.print(`
41
+ `),log(`This deployment expires in ${(0,import_ms.default)(anonymousLink.expiresAt-Date.now(),{long:!0})}. Claim it to keep it live (don't share this link): ${import_chalk.default.cyan(anonymousLink.claimUrl)}`)),await printDeploymentStatus(client,deployment,deployStamp,noWait,postDeployGuidanceEnabled,void 0,gitConnectCommand)}function handleCreateDeployError(error,localConfig){if(error instanceof InvalidDomain)return output_manager_default.error(`The domain ${error.meta.domain} is not valid`),1;if(error instanceof DomainVerificationFailed)return output_manager_default.error(`The domain used as a suffix ${import_chalk.default.underline(error.meta.domain)} is not verified and can't be used as custom suffix.`),1;if(error instanceof DomainPermissionDenied)return output_manager_default.error(`You don't have permissions to access the domain used as a suffix ${import_chalk.default.underline(error.meta.domain)}.`),1;if(error instanceof SchemaValidationFailed){let niceError=(0,import_build_utils2.getPrettyError)(error.meta),fileName=localConfig[import_client.fileNameSymbol]||"vercel.json";return niceError.message=`Invalid ${fileName} - ${niceError.message}`,output_manager_default.prettyError(niceError),1}if(error instanceof TooManyRequests)return output_manager_default.error(`Too many requests detected for ${error.meta.api} API. Try again in ${(0,import_ms.default)(error.meta.retryAfterMs,{long:!0})}.`),1;if(error instanceof DomainNotVerified)return output_manager_default.error(`The domain used as an alias ${import_chalk.default.underline(error.meta.domain)} is not verified yet. Please verify it.`),1;if(error instanceof BuildsRateLimited){output_manager_default.error(error.message);let cta=getErrorCta(error.meta);return output_manager_default.note(cta?`${cta.label}: ${link_default(cta.url)}`:"Upgrade your plan to increase your builds limit."),1}return error instanceof DeploymentNotFound||error instanceof NotDomainOwner||error instanceof DeploymentsRateLimited||error instanceof AliasDomainConfigured||error instanceof MissingBuildScript||error instanceof ConflictingFilePath||error instanceof ConflictingPathSegment||error instanceof ConflictingConfigFiles||error instanceof DeprecatedNowJson?(output_manager_default.error(error.message),1):error}function printDeploymentDryRun(client,summary,framework,asJson){let directories=getDirectoryDistribution(summary.files),largestFiles=[...summary.files].sort((a,b)=>b.size-a.size||a.path.localeCompare(b.path)).slice(0,10);if(asJson){client.stdout.write(`${JSON.stringify({framework,basePath:summary.basePath,fileCount:summary.fileCount,totalSize:summary.totalSize,ignoredCount:summary.ignoredCount,ignored:summary.ignored,directories,largestFiles,files:summary.files},null,2)}
42
+ `);return}let lines=[`${import_chalk.default.bold("Deployment Dry Run")}
43
+ `,`${import_chalk.default.bold("Detected Framework Preset")}: ${framework.name}${framework.slug?` (${framework.slug})`:""}`,`Included: ${summary.fileCount} ${pluralize("file",summary.fileCount)}, ${formatBytes(summary.totalSize)}`,`Ignored: ${summary.ignoredCount} ${pluralize("path",summary.ignoredCount)}
44
+ `];directories.length>0&&lines.push(table([["Path","Files","Size"],...directories.map(item=>[item.path,String(item.fileCount),formatBytes(item.size)])],{align:["l","r","r"],hsep:4}),""),largestFiles.length>0&&lines.push(import_chalk.default.bold("Largest Files"),table(largestFiles.map(file=>[file.path,formatBytes(file.size)]),{align:["l","r"],hsep:4}),""),output_manager_default.print(`${lines.join(`
45
+ `)}
46
+ `)}function getDirectoryDistribution(files){let directories=new Map;for(let file of files){let[segment]=file.path.split("/"),key=file.path.includes("/")?segment:file.path,current=directories.get(key)??{path:key,fileCount:0,size:0};current.fileCount+=1,current.size+=file.size,directories.set(key,current)}return Array.from(directories.values()).sort((a,b)=>b.size-a.size||a.path.localeCompare(b.path))}function formatBytes(size){return import_bytes.default.format(size,{decimalPlaces:1})}function pluralize(word,count){return count===1?word:`${word}s`}var addProcessEnv=async(log,env)=>{let val;for(let key of Object.keys(env))if(!(typeof env[key]<"u"))if(val=process.env[key],typeof val=="string")log(`Reading ${import_chalk.default.bold(`"${import_chalk.default.bold(key)}"`)} from your env (as no value was specified)`),env[key]=val.replace(/^@/,"\\@");else throw new Error(`No value specified for env variable ${import_chalk.default.bold(`"${import_chalk.default.bold(key)}"`)} and it was not found in your env. If you meant to specify an environment to deploy to, use ${param("--target")}`)};async function handleContinueDeployment({client,deploymentId,cwd,deployStamp,noWait,org,vercelOutputDir,archive}){let{debug,error}=output_manager_default;if(debug(`Continuing deployment: ${deploymentId}`),!vercelOutputDir)return error("Could not determine vercel output directory"),1;let token=client.authConfig.token;if(!token)return error("Missing authentication token"),1;output_manager_default.spinner("Continuing deployment\u2026",0);try{let finalDeployment=null;for await(let event of(0,import_client.continueDeployment)({apiUrl:client.apiUrl,debug:output_manager_default.isDebugEnabled(),deploymentId,archive,path:cwd,teamId:org.type==="team"?org.id:void 0,token,vercelOutputDir})){if(debug(`Event: ${event.type}`),event.type==="hashes-calculated"){let hashCount=Object.keys(event.payload).length;debug(`Calculated ${hashCount} hashes`)}if(event.type==="file-count"){let{total,missing}=event.payload;output_manager_default.spinner(`Uploading ${missing.length} of ${total.size} files\u2026`,0)}if(event.type==="file-uploaded"&&debug(`Uploaded: ${event.payload.file.names.join(" ")}`),event.type==="all-files-uploaded"&&output_manager_default.spinner("Continuing deployment\u2026",0),event.type==="created"){finalDeployment=event.payload,output_manager_default.stopSpinner(),finalDeployment.inspectorUrl&&printAlignedLabel("Inspect",import_chalk.default.cyan(finalDeployment.inspectorUrl));let isProdDeployment=finalDeployment.target==="production",previewUrl=`https://${finalDeployment.url}`;if(printAlignedLabel(isProdDeployment?"Production":"Preview",import_chalk.default.cyan(previewUrl),isProdDeployment&&noWait?{gutter:"\u25B2"}:{}),noWait)return printDeploymentStatus(client,finalDeployment,deployStamp,noWait,!1);output_manager_default.spinner("Building\u2026",0)}if(event.type==="building"&&output_manager_default.spinner("Building\u2026",0),event.type==="ready"&&(finalDeployment=event.payload,output_manager_default.stopSpinner()),event.type==="alias-assigned"&&(finalDeployment=event.payload,output_manager_default.stopSpinner(),finalDeployment.target==="production"&&finalDeployment.alias&&finalDeployment.alias.length>0)){let prodUrl=`https://${finalDeployment.alias[0]}`;printAlignedLabel("Aliased",import_chalk.default.cyan(prodUrl),{gutter:"\u25B2"})}if(event.type==="checks-v2-failed")return output_manager_default.stopSpinner(),handleFailedCheckRuns(client,event.payload,!1);if(event.type==="error"){output_manager_default.stopSpinner();let payload=event.payload;return error(payload.message||"An error occurred during deployment"),1}}return finalDeployment?printDeploymentStatus(client,finalDeployment,deployStamp,noWait,!1):(error("Deployment failed: no deployment returned"),1)}catch(err){return output_manager_default.stopSpinner(),(0,import_error_utils2.isError)(err)?(debug(`Error: ${err}
47
+ ${err.stack}`),error(err.message)):error("An unexpected error occurred"),1}}function getDeploymentOutputJson(deployment,apiUrl,error){return{id:deployment.id,url:`https://${deployment.url}`,inspectorUrl:deployment.inspectorUrl??null,readyState:deployment.readyState,target:deployment.target??null,deploymentApiUrl:`${apiUrl}/v13/deployments/${deployment.id}`,...error?{error}:{}}}function shouldReconcileFinalDeployment(deployment){return deployment?!!(deployment.readyState!=="READY"||deployment.aliasError||!deployment.aliasAssigned||deployment.checksConclusion==="failed"||deployment.checks?.["deployment-alias"]?.state==="failed"):!1}async function handleFailedCheckRuns(client,deployment,asJson,retryCommand=withGlobalFlags(client,"deploy")){let{runs}=await getDeploymentCheckRuns(client,deployment.id),failedRuns=(runs??[]).filter(run=>run.conclusion==="failed"),counters=new Map;(runs??[]).forEach(r=>{counters.set(r.conclusion,(counters.get(r.conclusion)??0)+1)});let message=`Running Checks: ${Array.from(counters).map(([name,no])=>`${no} ${name}`).join(", ")}`,getCheckRunUrl=run=>run.externalUrl?run.externalUrl:run.detailsUrl?run.detailsUrl:deployment.inspectorUrl?`${deployment.inspectorUrl}?checkRunLog=${encodeURIComponent(run.id)}`:null;if(asJson){output_manager_default.stopSpinner();let deploymentJson=getDeploymentOutputJson(deployment,client.apiUrl,{name:"CHECKS_FAILED",message}),payload;if(client.nonInteractive){let failedCheckRunsWithLogs=await Promise.all(failedRuns.map(async run=>{let logs=[];try{logs=await getDeploymentCheckRunLogs(client,deployment.id,run.id)}catch{}return{id:run.id,name:run.name,conclusion:run.conclusion,source:run.source,url:getCheckRunUrl(run),logs}}));payload={status:AGENT_STATUS.ERROR,reason:"checks_failed",message,deployment:deploymentJson,failedCheckRuns:failedCheckRunsWithLogs,next:[{command:retryCommand,when:"retry deploy after fixing check failures"}]}}else payload=deploymentJson;client.stdout.write(`${JSON.stringify(payload,null,2)}
48
+ `)}else{output_manager_default.error(message);for(let run of failedRuns){let dashboardUrl=getCheckRunUrl(run),label=dashboardUrl?output_manager_default.link(run.name,dashboardUrl):run.name;output_manager_default.print(` ${import_chalk.default.red("\u2717")} ${label}
49
+ `)}}return 1}export{deploy_default as default};