@vercel/cli-support 67.0.0 → 68.0.0-snapshot-c9dfd83f2293

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 (200) hide show
  1. package/dist/chunks/add-NIIHCHGH.js +8 -0
  2. package/dist/chunks/{add-SWKAAP2V.js → add-ORZO4EJ7.js} +1 -1
  3. package/dist/chunks/{add-PULH4LLG.js → add-SKRNSMC6.js} +1 -1
  4. package/dist/chunks/{alerts-GXY7LZWX.js → alerts-MNMZH6BO.js} +1 -1
  5. package/dist/chunks/{build-UNR3B22D.js → build-P7KKWO4O.js} +1 -1
  6. package/dist/chunks/{chunk-5CFLIIMP.js → chunk-2HFP22IP.js} +1 -1
  7. package/dist/chunks/{chunk-YBKH3IDY.js → chunk-2ZN4JRDA.js} +1 -1
  8. package/dist/chunks/{chunk-C3KNFAVK.js → chunk-3OPLG6HM.js} +1 -1
  9. package/dist/chunks/{chunk-MFOBJA6M.js → chunk-43XDA7ST.js} +1 -1
  10. package/dist/chunks/{chunk-URJT7V4L.js → chunk-4D5DAM3D.js} +1 -1
  11. package/dist/chunks/{chunk-NJFXR3FN.js → chunk-4Z6R5KHZ.js} +14 -13
  12. package/dist/chunks/{chunk-ANT2GN7F.js → chunk-572VGS6P.js} +1 -1
  13. package/dist/chunks/{chunk-Z5HRQ3IQ.js → chunk-5OGPMRRQ.js} +1 -1
  14. package/dist/chunks/{chunk-YMVS467I.js → chunk-6JTZZSFH.js} +1 -1
  15. package/dist/chunks/{chunk-SGFMVYFR.js → chunk-6OJVCMG5.js} +1 -1
  16. package/dist/chunks/{chunk-EOUT7E7U.js → chunk-7AAYWDIZ.js} +2 -2
  17. package/dist/chunks/{chunk-X3LOIVIS.js → chunk-7GJ37QPL.js} +1 -1
  18. package/dist/chunks/{chunk-GT3JH2FU.js → chunk-7K5ZWVDL.js} +1 -1
  19. package/dist/chunks/{chunk-5DHOC47O.js → chunk-AOPFMMUK.js} +1 -1
  20. package/dist/chunks/{chunk-S6QZTDZ3.js → chunk-AVXX4Q6S.js} +1 -1
  21. package/dist/chunks/{chunk-PKCEKIQP.js → chunk-BGIGZUFG.js} +1 -1
  22. package/dist/chunks/{chunk-5QMXW5KS.js → chunk-BHL2HM6I.js} +1 -1
  23. package/dist/chunks/chunk-CJMNUD2I.js +12 -0
  24. package/dist/chunks/{chunk-NTSJNYRU.js → chunk-CSNP5RIM.js} +2 -2
  25. package/dist/chunks/{chunk-2TJQY7PH.js → chunk-DEFA6XAB.js} +1 -1
  26. package/dist/chunks/{chunk-C7TNFTTK.js → chunk-DEX4QU4S.js} +1 -1
  27. package/dist/chunks/{chunk-HT445TYO.js → chunk-DMA77UYG.js} +1 -1
  28. package/dist/chunks/{chunk-X7TIJWNO.js → chunk-DUSMVY4N.js} +1 -1
  29. package/dist/chunks/{chunk-2OMMOXFL.js → chunk-F4ZKTFQH.js} +1 -1
  30. package/dist/chunks/{chunk-CO5LKOMH.js → chunk-F7X6O4ZC.js} +1 -1
  31. package/dist/chunks/{chunk-H75TYZ4K.js → chunk-FGWYM3SF.js} +1 -1
  32. package/dist/chunks/{chunk-6UWBCYEW.js → chunk-FGXULLNK.js} +1 -1
  33. package/dist/chunks/{chunk-KC5BRLPR.js → chunk-FYM5EUNW.js} +1 -1
  34. package/dist/chunks/{chunk-NBRW54IL.js → chunk-H2QMSLKJ.js} +1 -1
  35. package/dist/chunks/{chunk-PYHNDBNH.js → chunk-HMJR6RVF.js} +1 -1
  36. package/dist/chunks/{chunk-QKK5BAZO.js → chunk-HQ3ZFXXQ.js} +1 -1
  37. package/dist/chunks/{chunk-UT3HLSJV.js → chunk-HYGWJQN6.js} +1 -1
  38. package/dist/chunks/{chunk-PHK4OYIZ.js → chunk-I4O53MKV.js} +1 -1
  39. package/dist/chunks/{chunk-GWYQXFBP.js → chunk-IKNAOU5O.js} +1 -1
  40. package/dist/chunks/{chunk-3C6BMAGB.js → chunk-IY7OKDHU.js} +2 -2
  41. package/dist/chunks/{chunk-WOXLDQR3.js → chunk-J7POLUHY.js} +1 -1
  42. package/dist/chunks/{chunk-RNHPL4C7.js → chunk-JR25PLC7.js} +2 -2
  43. package/dist/chunks/chunk-JV3YIOCO.js +7 -0
  44. package/dist/chunks/{chunk-55WV4RRW.js → chunk-JXE7GYE3.js} +1 -1
  45. package/dist/chunks/{chunk-OBBFWQJ3.js → chunk-K5SM5NIY.js} +1 -1
  46. package/dist/chunks/chunk-K6KS5GZD.js +16 -0
  47. package/dist/chunks/chunk-K7TSWIKR.js +12 -0
  48. package/dist/chunks/{chunk-ME52HBX7.js → chunk-KFBA2MAV.js} +1 -1
  49. package/dist/chunks/{chunk-UEFDCTG6.js → chunk-KHMNANEN.js} +1 -1
  50. package/dist/chunks/chunk-KVXEYKIX.js +7 -0
  51. package/dist/chunks/{chunk-ZNEXVCPE.js → chunk-L3YEI2RW.js} +1 -1
  52. package/dist/chunks/{chunk-MNDFF42B.js → chunk-LD25KYMI.js} +2 -2
  53. package/dist/chunks/{chunk-LIQLOS7B.js → chunk-MJ77FDK2.js} +1 -1
  54. package/dist/chunks/{chunk-FFHV7BRT.js → chunk-N4PID4SD.js} +1 -1
  55. package/dist/chunks/{chunk-YKIKCZQ4.js → chunk-N6MNUNZ4.js} +1 -1
  56. package/dist/chunks/{chunk-VWFFYVJ2.js → chunk-NOAZDAOU.js} +1 -1
  57. package/dist/chunks/{chunk-OOAIU7WR.js → chunk-OVWS4CFW.js} +1 -1
  58. package/dist/chunks/{chunk-N3IQO5HN.js → chunk-PHPJS2G2.js} +1 -1
  59. package/dist/chunks/{chunk-THMCHMVZ.js → chunk-PPCZYUSO.js} +1 -1
  60. package/dist/chunks/{chunk-6D44CCJA.js → chunk-PZL7NSDA.js} +4 -3
  61. package/dist/chunks/{chunk-7W4GWVUP.js → chunk-Q45SQL44.js} +1 -1
  62. package/dist/chunks/{chunk-XXLU5IHA.js → chunk-Q4XCBBWK.js} +1 -1
  63. package/dist/chunks/{chunk-LYQECLRR.js → chunk-Q7HFUXJ4.js} +2 -2
  64. package/dist/chunks/{chunk-KJUFWRZP.js → chunk-QFSIUMC6.js} +1 -1
  65. package/dist/chunks/{chunk-5GKIRBHJ.js → chunk-QG5UBKDA.js} +1 -1
  66. package/dist/chunks/{chunk-XUMXJUE4.js → chunk-QGS3ERDZ.js} +1 -1
  67. package/dist/chunks/{chunk-XTCRLS6X.js → chunk-QU74BFN2.js} +1 -1
  68. package/dist/chunks/{chunk-FHUDTYY7.js → chunk-R3QHEJL6.js} +1 -1
  69. package/dist/chunks/{chunk-EM4OX47A.js → chunk-S7Y24A5X.js} +1 -1
  70. package/dist/chunks/{chunk-VT7UAUY6.js → chunk-SHJ3XTD3.js} +1 -1
  71. package/dist/chunks/{chunk-JYGOOFIW.js → chunk-SHL6BPBV.js} +1 -1
  72. package/dist/chunks/{chunk-TVTGVWCV.js → chunk-T5JHWXS5.js} +1 -1
  73. package/dist/chunks/{chunk-IGJBSAFY.js → chunk-TOCPUQ6N.js} +1 -1
  74. package/dist/chunks/{chunk-L3DJOYTO.js → chunk-UAS3WUFB.js} +1 -1
  75. package/dist/chunks/chunk-VIOIR6II.js +7 -0
  76. package/dist/chunks/{chunk-G2CDEA2E.js → chunk-VMRFCU6F.js} +1 -1
  77. package/dist/chunks/{chunk-B6YVE4WJ.js → chunk-VQZ773A2.js} +1 -1
  78. package/dist/chunks/{chunk-742MHFPK.js → chunk-WBEPIG4S.js} +2 -2
  79. package/dist/chunks/{chunk-MPOK5ZI5.js → chunk-WBXM3W44.js} +1 -1
  80. package/dist/chunks/{chunk-X4ECSRFL.js → chunk-WEL2Y6OH.js} +1 -1
  81. package/dist/chunks/{chunk-QPX6N5CV.js → chunk-WGU2IQPY.js} +1 -1
  82. package/dist/chunks/{chunk-HZRU7VS6.js → chunk-WLD4SGKM.js} +1 -1
  83. package/dist/chunks/{chunk-7J7SOUFS.js → chunk-XQZBXQZ2.js} +1 -1
  84. package/dist/chunks/{chunk-TRDAU3LX.js → chunk-YJJCELMY.js} +1 -1
  85. package/dist/chunks/{chunk-2BI5SSHB.js → chunk-YNMTP26U.js} +1 -1
  86. package/dist/chunks/{chunk-4GYDXPNC.js → chunk-YYDI5Q5K.js} +1 -1
  87. package/dist/chunks/{chunk-V5TIFXUP.js → chunk-Z643WTC4.js} +1 -1
  88. package/dist/chunks/chunk-ZSEFELXB.js +23 -0
  89. package/dist/chunks/{clear-ZYFF7TKK.js → clear-B3I7ZYEY.js} +1 -1
  90. package/dist/chunks/{compile-vercel-config-PM32YSEA.js → compile-vercel-config-ZQMPTEM6.js} +1 -1
  91. package/dist/chunks/{config-PEQFEYH3.js → config-4GZY5MR4.js} +1 -1
  92. package/dist/chunks/{config-BOZHXFS2.js → config-ZY22VRFX.js} +1 -1
  93. package/dist/chunks/{delete-QOXGYAV7.js → delete-K2HS7YCM.js} +1 -1
  94. package/dist/chunks/{delete-5ZT5D2ZC.js → delete-RVTGE4BU.js} +1 -1
  95. package/dist/chunks/{describe-PB4P77HZ.js → describe-5ZCOXUID.js} +2 -2
  96. package/dist/chunks/{detect-projects-YFNBW57H.js → detect-projects-AZXG6BRD.js} +1 -1
  97. package/dist/chunks/detect-services-FLNYWWJS.js +7 -0
  98. package/dist/chunks/disable-AS6DQMHM.js +7 -0
  99. package/dist/chunks/{discard-EDFRCWQJ.js → discard-PYU5CG67.js} +1 -1
  100. package/dist/chunks/{edit-RZUR2MEI.js → edit-HSMIPVPN.js} +1 -1
  101. package/dist/chunks/edit-RLRJSNZY.js +8 -0
  102. package/dist/chunks/enable-JPWR5EPC.js +7 -0
  103. package/dist/chunks/{export-GAUHNKEC.js → export-6WFWSAO4.js} +1 -1
  104. package/dist/chunks/{future-5CMQQWD5.js → future-QLQMHIPL.js} +1 -1
  105. package/dist/chunks/{generate-cert-for-deploy-UIPNZXKH.js → generate-cert-for-deploy-JKVOVQ3B.js} +1 -1
  106. package/dist/chunks/{image-6E4KXK2L.js → image-POIJ2G2Y.js} +1 -1
  107. package/dist/chunks/{import-builders-XWE653DS.js → import-builders-YF5MX6ZA.js} +1 -1
  108. package/dist/chunks/{inspect-D7ABHU5K.js → inspect-4CURZZPU.js} +1 -1
  109. package/dist/chunks/{inspect-INPZEWQW.js → inspect-BAYMK22S.js} +1 -1
  110. package/dist/chunks/{inspect-RAXMU5ZB.js → inspect-JTBMNWWI.js} +1 -1
  111. package/dist/chunks/{inspect-6R3QRA5N.js → inspect-TBQRBTX3.js} +1 -1
  112. package/dist/chunks/{inspect-MTGXZZ56.js → inspect-W4WSFBOF.js} +1 -1
  113. package/dist/chunks/{inspect-CAFSMVCJ.js → inspect-YKSWSH3T.js} +1 -1
  114. package/dist/chunks/{list-FIHRZBUS.js → list-E65OFWSS.js} +1 -1
  115. package/dist/chunks/{list-JBJW5CJ5.js → list-EWYN3F4Y.js} +1 -1
  116. package/dist/chunks/{list-ZVDEIXDS.js → list-ZHES2WYK.js} +1 -1
  117. package/dist/chunks/{list-VMOJ7VVX.js → list-ZWJDFJNY.js} +1 -1
  118. package/dist/chunks/{login-LKMOWVCB.js → login-JAKNSTW3.js} +1 -1
  119. package/dist/chunks/{login-H2G7BS6W.js → login-JRGX6HGZ.js} +1 -1
  120. package/dist/chunks/{logs-VXZM4UHP.js → logs-3DPLX3CB.js} +1 -1
  121. package/dist/chunks/{ls-GDKBTL2S.js → ls-5YLM3ICH.js} +1 -1
  122. package/dist/chunks/{ls-JQ27BRGL.js → ls-6HPMZVYA.js} +1 -1
  123. package/dist/chunks/{ls-C6AD24SN.js → ls-FWOTN6V6.js} +1 -1
  124. package/dist/chunks/{ls-Z6MWIX4Y.js → ls-MW3WIHH5.js} +1 -1
  125. package/dist/chunks/{ls-LAGLNA5S.js → ls-RAVFLQTQ.js} +1 -1
  126. package/dist/chunks/{ls-HDEMDHPT.js → ls-SY2FW3WA.js} +1 -1
  127. package/dist/chunks/{ls-F7VCPUQX.js → ls-ZX5FNEK2.js} +1 -1
  128. package/dist/chunks/{migrate-experimental-services-EDKYGFQN.js → migrate-experimental-services-XYUCY2G6.js} +1 -1
  129. package/dist/chunks/{mutate-QQV7STKJ.js → mutate-4KTZMM3X.js} +1 -1
  130. package/dist/chunks/{notifications-RS7NVKX3.js → notifications-LBZ7KWGS.js} +1 -1
  131. package/dist/chunks/{open-FJ2GR5YN.js → open-PXLVSFII.js} +1 -1
  132. package/dist/chunks/{openapi-TMDHCYVN.js → openapi-6RKKA6JG.js} +1 -1
  133. package/dist/chunks/{permissions-5A7V4SB3.js → permissions-DQ5AF6XL.js} +1 -1
  134. package/dist/chunks/{plugin-offer-EVN7NAJK.js → plugin-offer-VU3R572E.js} +1 -1
  135. package/dist/chunks/{prompt-missing-credentials-KI75QVSM.js → prompt-missing-credentials-AJH3HM36.js} +1 -1
  136. package/dist/chunks/{publish-XSPN4TNJ.js → publish-QJJL3IHG.js} +1 -1
  137. package/dist/chunks/{pull-6UMQJKSF.js → pull-3PQHXMPB.js} +1 -1
  138. package/dist/chunks/{purchase-domain-if-available-CT4I2TPX.js → purchase-domain-if-available-IFCQ4QFP.js} +1 -1
  139. package/dist/chunks/{push-KY26BHB6.js → push-4VIQFKP3.js} +1 -1
  140. package/dist/chunks/{query-RISEG5SJ.js → query-BQ4HYVQ7.js} +1 -1
  141. package/dist/chunks/{raw-query-VVRMDGD2.js → raw-query-VA6VVMR4.js} +1 -1
  142. package/dist/chunks/{reauthenticate-OSPJ3JEZ.js → reauthenticate-2SMCQQHF.js} +1 -1
  143. package/dist/chunks/{remove-2IJXYNP5.js → remove-CSIMGLLS.js} +1 -1
  144. package/dist/chunks/{reorder-V7HLFPNM.js → reorder-ERRB7OJL.js} +1 -1
  145. package/dist/chunks/{reply-DBWSTVHX.js → reply-XCBWXFWS.js} +1 -1
  146. package/dist/chunks/{resolve-NNJNHWK7.js → resolve-VWGZ632M.js} +1 -1
  147. package/dist/chunks/{resolve-agent-team-SDRK736H.js → resolve-agent-team-NWELD5FN.js} +1 -1
  148. package/dist/chunks/{restore-JLS3DHVR.js → restore-SXZUZGZE.js} +1 -1
  149. package/dist/chunks/{rm-TADMPEWP.js → rm-5TRC5YND.js} +1 -1
  150. package/dist/chunks/{rm-44NX26ZY.js → rm-IQ33QTQ2.js} +1 -1
  151. package/dist/chunks/{rm-YCOVLR77.js → rm-KURYLLD6.js} +1 -1
  152. package/dist/chunks/{rm-KX2MW3CD.js → rm-WCE3ISB2.js} +1 -1
  153. package/dist/chunks/{rm-6K2ZAQ26.js → rm-XMWM76JA.js} +1 -1
  154. package/dist/chunks/{rule-inspect-4OICMTIG.js → rule-inspect-USW6K7Y7.js} +1 -1
  155. package/dist/chunks/{schema-NPCCNUH2.js → schema-2G5VJ7EY.js} +1 -1
  156. package/dist/chunks/{schema-JVSAUVFJ.js → schema-LRRKG2KJ.js} +1 -1
  157. package/dist/chunks/{select-org-PQVCQGYR.js → select-org-JG6GRWTS.js} +1 -1
  158. package/dist/chunks/{set-XADF6YK4.js → set-4JTH62JO.js} +1 -1
  159. package/dist/chunks/{set-GBB3DG2V.js → set-BS5KCRE4.js} +1 -1
  160. package/dist/chunks/{setup-and-link-CBVABGTY.js → setup-and-link-GY4O7UJP.js} +1 -1
  161. package/dist/chunks/{skills-VPLIJJQG.js → skills-SUGA6D3G.js} +1 -1
  162. package/dist/chunks/{tags-PVI45KIL.js → tags-B7MKMQKJ.js} +1 -1
  163. package/dist/chunks/{types-MTNJRJKG.js → types-YFDB4QZA.js} +1 -1
  164. package/dist/chunks/{update-KIOGBNX7.js → update-LWRCCEXG.js} +1 -1
  165. package/dist/chunks/{usage-XTWSFFZT.js → usage-HABW5VJ7.js} +1 -1
  166. package/dist/chunks/{validate-config-IREIABSK.js → validate-config-LDOYJ4LL.js} +1 -1
  167. package/dist/commands/build/index.js +1 -1
  168. package/dist/commands/deploy/index.js +5 -5
  169. package/dist/commands/dev/index.js +3 -3
  170. package/dist/commands/env/index.js +3 -3
  171. package/dist/commands/link/index.js +2 -2
  172. package/dist/commands/list/index.js +1 -1
  173. package/dist/commands/project/index.js +1 -1
  174. package/dist/commands/tunnel/index.js +1 -1
  175. package/dist/commands-account.js +5 -5
  176. package/dist/commands-ai.js +3 -3
  177. package/dist/commands-blob.js +1 -1
  178. package/dist/commands-core.js +31 -44
  179. package/dist/commands-deployments.js +1 -1
  180. package/dist/commands-flags.js +3 -3
  181. package/dist/commands-integrations.js +6 -9
  182. package/dist/commands-observability.js +2 -2
  183. package/dist/commands-routing.js +4 -5
  184. package/dist/index.js +5 -5
  185. package/dist/internal-build.js +1 -1
  186. package/dist/package.json +41 -41
  187. package/dist/version.mjs +1 -1
  188. package/package.json +42 -42
  189. package/dist/chunks/add-U3ILHW5T.js +0 -8
  190. package/dist/chunks/chunk-55FPQ5MM.js +0 -16
  191. package/dist/chunks/chunk-5ZL2RRO3.js +0 -7
  192. package/dist/chunks/chunk-AM46JVVN.js +0 -7
  193. package/dist/chunks/chunk-B7IB5CTS.js +0 -7
  194. package/dist/chunks/chunk-IPORRCTF.js +0 -12
  195. package/dist/chunks/chunk-KHDRQS6I.js +0 -12
  196. package/dist/chunks/chunk-VGSSSQFT.js +0 -7
  197. package/dist/chunks/detect-services-ZN2R3RDF.js +0 -7
  198. package/dist/chunks/disable-UB445BYJ.js +0 -7
  199. package/dist/chunks/edit-ZWAA6ERV.js +0 -8
  200. package/dist/chunks/enable-YTPIGKFW.js +0 -7
@@ -4,7 +4,7 @@ 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{sleep}from"./chunk-NJFXR3FN.js";import{fetch}from"./chunk-MY4MONOH.js";import{getCommandNamePlain}from"./chunk-B4KA3ZH2.js";import{output_manager_default}from"./chunk-RYSO5U3E.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);var BYPASS_READY_DELAYS_MS=[250,500,1e3,2e3,2e3,2e3,2e3,2e3],BYPASS_READY_TIMEOUT_MS=12e3,BYPASS_READY_REQUEST_TIMEOUT_MS=3e3,PROTECTION_BODY_MAX_BYTES=16*1024;async function createDeploymentProtectionToken(client,projectId,orgId){if(!client.authConfig.token)throw output_manager_default.debug("No auth token available, skipping deployment protection token"),new Error("Authentication required to create protection bypass token");try{let response=await client.fetch(`/v1/projects/${projectId}/protection-bypass`,{method:"PATCH",body:"{}",headers:{"Content-Type":"application/json"},accountId:orgId}),{protectionBypass}=response,token=getAutomationBypassToken(protectionBypass);return output_manager_default.log(`Added a Protection Bypass for Automation secret to project ${import_chalk.default.bold(projectId)}. It stays on the project until you revoke it.`),output_manager_default.print(` To revoke it, open Deployment Protection in the project settings, or run:
7
+ import{sleep}from"./chunk-4Z6R5KHZ.js";import{fetch}from"./chunk-MY4MONOH.js";import{getCommandNamePlain}from"./chunk-B4KA3ZH2.js";import{output_manager_default}from"./chunk-RYSO5U3E.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);var BYPASS_READY_DELAYS_MS=[250,500,1e3,2e3,2e3,2e3,2e3,2e3],BYPASS_READY_TIMEOUT_MS=12e3,BYPASS_READY_REQUEST_TIMEOUT_MS=3e3,PROTECTION_BODY_MAX_BYTES=16*1024;async function createDeploymentProtectionToken(client,projectId,orgId){if(!client.authConfig.token)throw output_manager_default.debug("No auth token available, skipping deployment protection token"),new Error("Authentication required to create protection bypass token");try{let response=await client.fetch(`/v1/projects/${projectId}/protection-bypass`,{method:"PATCH",body:"{}",headers:{"Content-Type":"application/json"},accountId:orgId}),{protectionBypass}=response,token=getAutomationBypassToken(protectionBypass);return output_manager_default.log(`Added a Protection Bypass for Automation secret to project ${import_chalk.default.bold(projectId)}. It stays on the project until you revoke it.`),output_manager_default.print(` To revoke it, open Deployment Protection in the project settings, or run:
8
8
  ${getCommandNamePlain(`project protection disable ${projectId} --protection-bypass --protection-bypass-secret <secret>`)}
9
9
 
10
10
  `),token}catch(error){throw output_manager_default.debug(`Failed to generate deployment protection bypass token: ${error}`),output_manager_default.note('To bypass deployment protection, create a "Protection Bypass for Automation" secret in your project settings:'),output_manager_default.log(` 1. Visit ${import_chalk.default.cyan("https://vercel.com/dashboard")}`),output_manager_default.log(" 2. Go to your project settings \u2192 Deployment Protection"),output_manager_default.log(' 3. Generate a "Protection Bypass for Automation" secret'),output_manager_default.log(` 4. Use it with ${import_chalk.default.cyan("--protection-bypass")} option or set ${import_chalk.default.cyan("VERCEL_AUTOMATION_BYPASS_SECRET")} env var`),output_manager_default.log(""),new Error("Failed to create deployment protection bypass token")}}function getAutomationBypassToken(protectionBypass){if(!protectionBypass)throw new Error("No protection bypass tokens found");let token=Object.keys(protectionBypass).find(key=>protectionBypass[key].scope==="automation-bypass");if(!token)throw new Error("No automation bypass token found in protection bypass settings");return token}async function getOrCreateDeploymentProtectionToken(client,{project,org},{createIfMissing=!0,readinessUrl}={}){if(process.env.VERCEL_AUTOMATION_BYPASS_SECRET)return output_manager_default.debug("Using protection bypass secret from environment variable"),process.env.VERCEL_AUTOMATION_BYPASS_SECRET;if(project.protectionBypass&&Object.values(project.protectionBypass).length){let protectionBypass;try{protectionBypass=getAutomationBypassToken(project.protectionBypass)}catch(error){if(!createIfMissing)return output_manager_default.debug(`No existing automation bypass token found for project ${project.id}`),null;throw error}if(protectionBypass)return output_manager_default.debug("Using existing protection bypass token from project settings"),protectionBypass}if(!createIfMissing)return output_manager_default.debug(`Not creating an automation bypass token for project ${project.id}`),null;let token=await createDeploymentProtectionToken(client,project.id,org.id);return readinessUrl?(await waitForProtectionBypass(readinessUrl,token)||output_manager_default.warning("The new bypass secret is not active yet, so this request can return the Deployment Protection page. If it does, run the command again in a few seconds."),token):(await sleep(1e3),token)}async function waitForProtectionBypass(url,token){let origin=new URL(url).origin,deadline=Date.now()+BYPASS_READY_TIMEOUT_MS;output_manager_default.spinner("Waiting for the new bypass secret to become active\u2026");try{for(let attempt=0;;attempt++){let remaining=deadline-Date.now(),protectedResponse;try{protectedResponse=await isProtected(origin,token,Math.max(1,Math.min(BYPASS_READY_REQUEST_TIMEOUT_MS,remaining)))}catch(err){return output_manager_default.debug(`Could not check the new bypass secret: ${err}`),!0}if(!protectedResponse)return output_manager_default.debug(`The new bypass secret works after ${attempt+1} checks`),!0;let delay=BYPASS_READY_DELAYS_MS[attempt];if(delay===void 0||Date.now()+delay>=deadline)return output_manager_default.debug(`The new bypass secret did not work after ${attempt+1} checks`),!1;await sleep(delay)}}finally{output_manager_default.stopSpinner()}}async function isProtected(origin,token,timeoutMs){let res=await fetch(`${origin}/`,{headers:{accept:"application/json",...token?{"x-vercel-protection-bypass":token}:{}},redirect:"manual",signal:AbortSignal.timeout(timeoutMs)});try{return await isProtectionResponse(res,origin)}finally{await res.body?.cancel().catch(()=>{})}}async function isProtectionResponse(res,origin){let location=res.headers.get("location");if(res.status>=300&&res.status<400&&location){let target=new URL(location,origin);return target.host==="vercel.com"&&target.pathname==="/sso-api"}let contentType=res.headers.get("content-type")??"";if(res.status!==401||!contentType.includes("application/json"))return!1;try{let text=await readBodyUpTo(res,PROTECTION_BODY_MAX_BYTES);return text===null?!1:JSON.parse(text)?.error?.message==="Protected deployment"}catch{return!1}}async function readBodyUpTo(res,maxBytes){let reader=res.body?.getReader();if(!reader)return"";let chunks=[],size=0;try{for(;;){let{done,value}=await reader.read();if(done)break;if(size+=value.byteLength,size>maxBytes)return await reader.cancel(),null;chunks.push(value)}}finally{reader.releaseLock()}return Buffer.concat(chunks).toString("utf8")}export{getOrCreateDeploymentProtectionToken,isProtected};
@@ -4,7 +4,7 @@ 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{VERCEL_CONFIG_EXTENSIONS,VERCEL_DIR,localConfigFlagPath}from"./chunk-NJFXR3FN.js";import{ConflictingConfigFiles,DeprecatedNowJson}from"./chunk-QFE3RPMA.js";import{output_manager_default}from"./chunk-RYSO5U3E.js";import{require_build_utils}from"./chunk-5MDNVAE6.js";import{__commonJS,__require,__toESM}from"./chunk-BZENIQ7N.js";var require_main=__commonJS({"../../node_modules/.pnpm/dotenv@4.0.0/node_modules/dotenv/lib/main.js"(exports,module){"use strict";var fs=__require("fs");function parse(src){var obj={};return src.toString().split(`
7
+ import{VERCEL_CONFIG_EXTENSIONS,VERCEL_DIR,localConfigFlagPath}from"./chunk-4Z6R5KHZ.js";import{ConflictingConfigFiles,DeprecatedNowJson}from"./chunk-QFE3RPMA.js";import{output_manager_default}from"./chunk-RYSO5U3E.js";import{require_build_utils}from"./chunk-5MDNVAE6.js";import{__commonJS,__require,__toESM}from"./chunk-BZENIQ7N.js";var require_main=__commonJS({"../../node_modules/.pnpm/dotenv@4.0.0/node_modules/dotenv/lib/main.js"(exports,module){"use strict";var fs=__require("fs");function parse(src){var obj={};return src.toString().split(`
8
8
  `).forEach(function(line){var keyValueArr=line.match(/^\s*([\w\.\-]+)\s*=\s*(.*)?\s*$/);if(keyValueArr!=null){var key=keyValueArr[1],value=keyValueArr[2]?keyValueArr[2]:"",len=value?value.length:0;len>0&&value.charAt(0)==='"'&&value.charAt(len-1)==='"'&&(value=value.replace(/\\n/gm,`
9
9
  `)),value=value.replace(/(^['"]|['"]$)/g,"").trim(),obj[key]=value}}),obj}function config(options){var path=".env",encoding="utf8";options&&(options.path&&(path=options.path),options.encoding&&(encoding=options.encoding));try{var parsedObj=parse(fs.readFileSync(path,{encoding}));return Object.keys(parsedObj).forEach(function(key){process.env[key]=process.env[key]||parsedObj[key]}),{parsed:parsedObj}}catch(e){return{error:e}}}module.exports.config=config;module.exports.load=config;module.exports.parse=parse}});var import_dotenv=__toESM(require_main(),1);import{mkdir,readFile,writeFile,unlink,access}from"fs/promises";import{join,basename}from"path";import{fork}from"child_process";async function loadEsbuild(){let nativeLoader=Reflect.get(globalThis,Symbol.for("vercel.cli.loadEsbuild"));return typeof nativeLoader=="function"?nativeLoader():import("esbuild")}var import_build_utils=__toESM(require_build_utils(),1);function toRouteFormat(item){if("src"in item)return item;let{source,destination,headers,statusCode,permanent,...rest}=item,route={src:source,...rest};return destination&&(route.dest=destination),headers&&(route.headers=Object.fromEntries(headers.map(h=>[h.key,h.value]))),statusCode!==void 0?route.status=statusCode:permanent!==void 0&&(route.status=permanent?308:307),route}function normalizeConfig(config){let normalized={...config},{rewrites,redirects,headers}=normalized,allRoutes=normalized.routes||[],hasRoutes=allRoutes.length>0,hasRewrites=(rewrites?.length??0)>0,hasRedirects=(redirects?.length??0)>0,hasHeaders=(headers?.length??0)>0;function hasRouteFormat(items){return items?.some(item=>"src"in item)??!1}if(hasRoutes&&(hasRewrites||hasRedirects||hasHeaders))return normalized;let shouldConvertRewrites=hasRewrites&&hasRouteFormat(rewrites),shouldConvertRedirects=hasRedirects&&hasRouteFormat(redirects),shouldConvertHeaders=hasHeaders&&hasRouteFormat(headers);if((shouldConvertRewrites||shouldConvertRedirects||shouldConvertHeaders)&&(hasRewrites&&!shouldConvertRewrites||hasRedirects&&!shouldConvertRedirects||hasHeaders&&!shouldConvertHeaders))throw new import_build_utils.NowBuildError({code:"INVALID_VERCEL_CONFIG",message:"Transforms (e.g., requestHeaders) require the `routes` format, which cannot be used alongside `rewrites`, `redirects`, or `headers`. Move everything into the `routes` array instead.",link:"https://vercel.com/docs/projects/project-configuration#routes"});return rewrites&&shouldConvertRewrites&&(allRoutes=[...allRoutes,...rewrites.map(toRouteFormat)],delete normalized.rewrites),redirects&&shouldConvertRedirects&&(allRoutes=[...allRoutes,...redirects.map(toRouteFormat)],delete normalized.redirects),headers&&shouldConvertHeaders&&(allRoutes=[...allRoutes,...headers.map(toRouteFormat)],delete normalized.headers),allRoutes.length>0&&(normalized.routes=allRoutes.map(toRouteFormat)),normalized}async function fileExists(filePath){try{return await access(filePath),!0}catch{return!1}}async function findAllVercelConfigFiles(workPath){let foundFiles=[];for(let ext of VERCEL_CONFIG_EXTENSIONS){let configPath=join(workPath,`vercel.${ext}`);await fileExists(configPath)&&foundFiles.push(configPath)}return foundFiles}async function findSourceVercelConfigFile(workPath){for(let ext of VERCEL_CONFIG_EXTENSIONS){let configPath=join(workPath,`vercel.${ext}`);if(await fileExists(configPath))return basename(configPath)}let tomlPath=join(workPath,"vercel.toml");return await fileExists(tomlPath)?"vercel.toml":null}async function findVercelConfigFile(workPath){let foundFiles=await findAllVercelConfigFiles(workPath);if(foundFiles.length>1)throw new ConflictingConfigFiles(foundFiles,"Multiple vercel config files found. Please use only one configuration file.","https://vercel.com/docs/projects/project-configuration");return foundFiles[0]||null}function parseConfigLoaderError(stderr){if(!stderr.trim())return"";let moduleNotFoundMatch=stderr.match(/Error \[ERR_MODULE_NOT_FOUND\]: Cannot find package '([^']+)'/);if(moduleNotFoundMatch)return`Cannot find package '${moduleNotFoundMatch[1]}'. Make sure it's installed in your project dependencies.`;let syntaxErrorMatch=stderr.match(/SyntaxError: (.+?)(?:\n|$)/);if(syntaxErrorMatch)return`Syntax error: ${syntaxErrorMatch[1]}`;let errorMatch=stderr.match(/^(?:Error|TypeError|ReferenceError): (.+?)(?:\n|$)/m);return errorMatch?errorMatch[1]:stderr.trim()}async function compileVercelConfig(workPath){let explicitConfigPath=localConfigFlagPath();if(explicitConfigPath)return{configPath:explicitConfigPath,wasCompiled:!1};let vercelJsonPath=join(workPath,"vercel.json"),nowJsonPath=join(workPath,"now.json"),vercelTomlPath=join(workPath,"vercel.toml"),hasVercelJson=await fileExists(vercelJsonPath),hasNowJson=await fileExists(nowJsonPath),hasVercelToml=await fileExists(vercelTomlPath),vercelConfigPath=await findVercelConfigFile(workPath),vercelDir=join(workPath,VERCEL_DIR),compiledConfigPath=join(vercelDir,"vercel.json");if(hasNowJson)throw new DeprecatedNowJson(nowJsonPath);let foundConfigs=[];if(hasVercelJson&&foundConfigs.push(vercelJsonPath),hasVercelToml&&foundConfigs.push(vercelTomlPath),vercelConfigPath&&foundConfigs.push(vercelConfigPath),foundConfigs.length>1)throw new ConflictingConfigFiles(foundConfigs,`Multiple config files found: ${foundConfigs.map(f=>basename(f)).join(", ")}. Please use only one configuration method.`,"https://vercel.com/docs/projects/project-configuration");if(!vercelConfigPath&&!hasVercelToml)return hasVercelJson?{configPath:vercelJsonPath,wasCompiled:!1}:await fileExists(compiledConfigPath)?{configPath:compiledConfigPath,wasCompiled:!0,sourceFile:await findSourceVercelConfigFile(workPath)??void 0}:{configPath:null,wasCompiled:!1};if(hasVercelToml)try{let{parse:tomlParse}=await import("./dist-RXYNZPEA.js"),tomlContent=await readFile(vercelTomlPath,"utf8"),config=tomlParse(tomlContent),normalizedConfig=normalizeConfig(config);return await mkdir(vercelDir,{recursive:!0}),await writeFile(compiledConfigPath,JSON.stringify(normalizedConfig,null,2),"utf-8"),output_manager_default.debug(`Compiled ${vercelTomlPath} -> ${compiledConfigPath}`),{configPath:compiledConfigPath,wasCompiled:!0,sourceFile:"vercel.toml"}}catch(error){throw new import_build_utils.NowBuildError({code:error.code??"vercel_toml_parse_failed",message:`Failed to parse vercel.toml: ${error.message}`,link:error.link??"https://vercel.com/docs/projects/project-configuration"})}let sourceConfigPath=vercelConfigPath;(0,import_dotenv.config)({path:join(workPath,".env")}),(0,import_dotenv.config)({path:join(workPath,".env.local")});let tempOutPath=join(vercelDir,"vercel-temp.mjs"),loaderPath=join(vercelDir,"vercel-loader.mjs");try{let{build}=await loadEsbuild();await mkdir(vercelDir,{recursive:!0}),await build({entryPoints:[sourceConfigPath],bundle:!0,platform:"node",format:"esm",outfile:tempOutPath,packages:"external",target:"node20",sourcemap:"inline"}),await writeFile(loaderPath,`
10
10
  import { pathToFileURL } from 'url';
@@ -4,4 +4,4 @@ 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{pull}from"./chunk-6D44CCJA.js";import{indent_default}from"./chunk-GZNDA6SV.js";import{getLinkedProject,warnEnvFileSymlink}from"./chunk-NJFXR3FN.js";import{EnvFileSymlinkError}from"./chunk-QFE3RPMA.js";import{output_manager_default}from"./chunk-RYSO5U3E.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";async function createBlobStore(client,input,accountId,requestOptions){let result=await client.fetch("/v1/storage/stores/blob",{...requestOptions,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(input),accountId});if(!result.store?.id)throw new Error("Blob creation returned no store ID.");return{id:result.store.id,region:result.store.region}}async function connectResourceToProject(client,projectId,storeId,environments,options){let path=`/v1/storage/stores/${encodeURIComponent(storeId)}/connections`;return client.fetch(path,{retry:options?.retry,bailOn429:options?.bailOn429,signal:options?.signal,json:!0,method:"POST",body:{envVarEnvironments:environments,projectId,type:"integration",...options?.envVarPrefix!==void 0?{envVarPrefix:options.envVarPrefix}:{}},accountId:options?.accountId})}var import_chalk=__toESM(require_source(),1);var VALID_ENVIRONMENTS=["production","preview","development"],ENV_PULL_FAILED_MESSAGE="Failed to pull environment variables. You can run `vercel env pull` manually.";function validateEnvironments(environments){let invalid=environments.filter(env=>!VALID_ENVIRONMENTS.includes(env));return invalid.length>0?{valid:!1,invalid}:{valid:!0}}async function postProvisionSetup(client,resourceName,resourceId,contextName,options={}){let dashboardUrl=options.integrationSlug&&options.installationId?`https://vercel.com/d/dashboard/integrations/${options.integrationSlug}/${options.installationId}/resources/${resourceId}`:`https://vercel.com/${contextName}/~/stores/integration/${resourceId}`;output_manager_default.log(indent_default(`Dashboard: ${output_manager_default.link(dashboardUrl,dashboardUrl,{fallback:!1})}`,4));let baseResult={exitCode:0,dashboardUrl,connected:!1,environments:[],envPulled:!1};if(options.noConnect)return baseResult;let linkedProject=await getLinkedProject(client);if(linkedProject.status==="error")return{...baseResult,exitCode:linkedProject.exitCode};if(linkedProject.status==="not_linked")return baseResult;let{project}=linkedProject,environments=[...new Set(options.environments&&options.environments.length>0?options.environments:[...VALID_ENVIRONMENTS])];output_manager_default.debug(`Selected environments: ${JSON.stringify(environments)}`),output_manager_default.spinner(`Connecting ${import_chalk.default.bold(resourceName)} to ${import_chalk.default.bold(project.name)}...`),output_manager_default.debug(`Connecting resource ${resourceId} to project ${project.id}`);try{await connectResourceToProject(client,project.id,resourceId,environments,options.prefix?{envVarPrefix:options.prefix}:void 0)}catch(error){return output_manager_default.stopSpinner(),options.onProjectConnectFailed?.(project.id,error),output_manager_default.error(`Failed to connect: ${error.message}`),{...baseResult,exitCode:1,project:{id:project.id,name:project.name},environments,connectError:error.message}}output_manager_default.stopSpinner(),output_manager_default.log(`${import_chalk.default.bold(resourceName)} successfully connected to ${import_chalk.default.bold(project.name)}`),options.onProjectConnected?.(project.id);let envPulled=!1;if(!options.noEnvPull)try{await pull(client,["--yes"],"vercel-cli:integration:add")!==0?output_manager_default.warn(ENV_PULL_FAILED_MESSAGE):envPulled=!0}catch(err){if(!(err instanceof EnvFileSymlinkError))throw err;warnEnvFileSymlink(client,err)}return{...baseResult,project:{id:project.id,name:project.name},connected:!0,environments,envPulled}}async function getLinkedProjectField(client,noConnect,field="name"){if(noConnect)return{value:void 0};let linkedProject=await getLinkedProject(client);return linkedProject.status==="error"?{value:void 0,exitCode:linkedProject.exitCode}:linkedProject.status==="linked"?{value:linkedProject.project[field]}:{value:void 0}}export{createBlobStore,connectResourceToProject,VALID_ENVIRONMENTS,ENV_PULL_FAILED_MESSAGE,validateEnvironments,postProvisionSetup,getLinkedProjectField};
7
+ import{pull}from"./chunk-PZL7NSDA.js";import{indent_default}from"./chunk-GZNDA6SV.js";import{getLinkedProject,warnEnvFileSymlink}from"./chunk-4Z6R5KHZ.js";import{EnvFileSymlinkError}from"./chunk-QFE3RPMA.js";import{output_manager_default}from"./chunk-RYSO5U3E.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";async function createBlobStore(client,input,accountId,requestOptions){let result=await client.fetch("/v1/storage/stores/blob",{...requestOptions,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(input),accountId});if(!result.store?.id)throw new Error("Blob creation returned no store ID.");return{id:result.store.id,region:result.store.region}}async function connectResourceToProject(client,projectId,storeId,environments,options){let path=`/v1/storage/stores/${encodeURIComponent(storeId)}/connections`;return client.fetch(path,{retry:options?.retry,bailOn429:options?.bailOn429,signal:options?.signal,json:!0,method:"POST",body:{envVarEnvironments:environments,projectId,type:"integration",...options?.envVarPrefix!==void 0?{envVarPrefix:options.envVarPrefix}:{}},accountId:options?.accountId})}var import_chalk=__toESM(require_source(),1);var VALID_ENVIRONMENTS=["production","preview","development"],ENV_PULL_FAILED_MESSAGE="Failed to pull environment variables. You can run `vercel env pull` manually.";function validateEnvironments(environments){let invalid=environments.filter(env=>!VALID_ENVIRONMENTS.includes(env));return invalid.length>0?{valid:!1,invalid}:{valid:!0}}async function postProvisionSetup(client,resourceName,resourceId,contextName,options={}){let dashboardUrl=options.integrationSlug&&options.installationId?`https://vercel.com/d/dashboard/integrations/${options.integrationSlug}/${options.installationId}/resources/${resourceId}`:`https://vercel.com/${contextName}/~/stores/integration/${resourceId}`;output_manager_default.log(indent_default(`Dashboard: ${output_manager_default.link(dashboardUrl,dashboardUrl,{fallback:!1})}`,4));let baseResult={exitCode:0,dashboardUrl,connected:!1,environments:[],envPulled:!1};if(options.noConnect)return baseResult;let linkedProject=await getLinkedProject(client);if(linkedProject.status==="error")return{...baseResult,exitCode:linkedProject.exitCode};if(linkedProject.status==="not_linked")return baseResult;let{project}=linkedProject,environments=[...new Set(options.environments&&options.environments.length>0?options.environments:[...VALID_ENVIRONMENTS])];output_manager_default.debug(`Selected environments: ${JSON.stringify(environments)}`),output_manager_default.spinner(`Connecting ${import_chalk.default.bold(resourceName)} to ${import_chalk.default.bold(project.name)}...`),output_manager_default.debug(`Connecting resource ${resourceId} to project ${project.id}`);try{await connectResourceToProject(client,project.id,resourceId,environments,options.prefix?{envVarPrefix:options.prefix}:void 0)}catch(error){return output_manager_default.stopSpinner(),options.onProjectConnectFailed?.(project.id,error),output_manager_default.error(`Failed to connect: ${error.message}`),{...baseResult,exitCode:1,project:{id:project.id,name:project.name},environments,connectError:error.message}}output_manager_default.stopSpinner(),output_manager_default.log(`${import_chalk.default.bold(resourceName)} successfully connected to ${import_chalk.default.bold(project.name)}`),options.onProjectConnected?.(project.id);let envPulled=!1;if(!options.noEnvPull)try{await pull(client,["--yes"],"vercel-cli:integration:add")!==0?output_manager_default.warn(ENV_PULL_FAILED_MESSAGE):envPulled=!0}catch(err){if(!(err instanceof EnvFileSymlinkError))throw err;warnEnvFileSymlink(client,err)}return{...baseResult,project:{id:project.id,name:project.name},connected:!0,environments,envPulled}}async function getLinkedProjectField(client,noConnect,field="name"){if(noConnect)return{value:void 0};let linkedProject=await getLinkedProject(client);return linkedProject.status==="error"?{value:void 0,exitCode:linkedProject.exitCode}:linkedProject.status==="linked"?{value:linkedProject.project[field]}:{value:void 0}}export{createBlobStore,connectResourceToProject,VALID_ENVIRONMENTS,ENV_PULL_FAILED_MESSAGE,validateEnvironments,postProvisionSetup,getLinkedProjectField};
@@ -4,7 +4,7 @@ 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{require_dist as require_dist2}from"./chunk-GT3JH2FU.js";import{validateConfig}from"./chunk-FFHV7BRT.js";import{compileVercelConfig,findSourceVercelConfigFile}from"./chunk-Z5HRQ3IQ.js";import{init_dist,stringify}from"./chunk-U4Z2MMOF.js";import{applyEdits,findNodeAtLocation,init_main,modify,parse,parseTree}from"./chunk-J24BABG4.js";import{require_dist}from"./chunk-EOUT7E7U.js";import{printAlignedLabel}from"./chunk-M2Q2DUHO.js";import{code}from"./chunk-QFE3RPMA.js";import{link_default,output_manager_default}from"./chunk-RYSO5U3E.js";import{require_build_utils}from"./chunk-5MDNVAE6.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);init_main();init_dist();var import_build_utils=__toESM(require_build_utils(),1),import_fs_detectors=__toESM(require_dist(),1),import_service_topology=__toESM(require_dist2(),1);import{readFile,writeFile}from"fs/promises";import{basename}from"path";var EXPERIMENTAL_SERVICES_DOCS_URL="https://vercel.com/docs/services/experimental";async function prepareExperimentalServicesMigration(cwd,detectServicesResult){let compileResult=await compileVercelConfig(cwd);if(!compileResult.configPath)return null;let rawConfig=await readFile(compileResult.configPath,"utf8"),config=parse(rawConfig);if(!config||!(0,import_service_topology.hasLegacyServicesConfig)(config))return null;let resolvedServices=detectServicesResult?.resolved?.source==="configured"?detectServicesResult.services.filter(s=>(0,import_build_utils.isExperimentalService)(s)):void 0,plan=await(0,import_service_topology.migrateExperimentalServices)({fs:new import_fs_detectors.LocalFileSystemDetector(cwd),config,resolvedServices:resolvedServices&&resolvedServices.length>0?resolvedServices:void 0}),sourceFile=compileResult.sourceFile??basename(compileResult.configPath),preparation={plan,sourceFile,snippet:renderSnippet(sourceFile,plan)};if(plan.errors.length>0)return preparation;if(compileResult.wasCompiled)return preparation.writeBlocker=`${sourceFile} can't be updated automatically.`,preparation;let content=applyPlanToJson(rawConfig,config,plan),parseErrors=[],nextConfig=parse(content,parseErrors);if(parseErrors.length>0)return preparation.writeBlocker=`Couldn't produce a valid ${sourceFile}.`,preparation;let validationError=validateConfig(nextConfig);return validationError?(preparation.writeBlocker=validationError.message,preparation):(preparation.write={configPath:compileResult.configPath,content},preparation)}function applyPlanToJson(rawConfig,config,plan){let eol=rawConfig.includes(`\r
7
+ import{require_dist as require_dist2}from"./chunk-7K5ZWVDL.js";import{validateConfig}from"./chunk-N4PID4SD.js";import{compileVercelConfig,findSourceVercelConfigFile}from"./chunk-5OGPMRRQ.js";import{init_dist,stringify}from"./chunk-U4Z2MMOF.js";import{applyEdits,findNodeAtLocation,init_main,modify,parse,parseTree}from"./chunk-J24BABG4.js";import{require_dist}from"./chunk-7AAYWDIZ.js";import{printAlignedLabel}from"./chunk-M2Q2DUHO.js";import{code}from"./chunk-QFE3RPMA.js";import{link_default,output_manager_default}from"./chunk-RYSO5U3E.js";import{require_build_utils}from"./chunk-5MDNVAE6.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);init_main();init_dist();var import_build_utils=__toESM(require_build_utils(),1),import_fs_detectors=__toESM(require_dist(),1),import_service_topology=__toESM(require_dist2(),1);import{readFile,writeFile}from"fs/promises";import{basename}from"path";var EXPERIMENTAL_SERVICES_DOCS_URL="https://vercel.com/docs/services/experimental";async function prepareExperimentalServicesMigration(cwd,detectServicesResult){let compileResult=await compileVercelConfig(cwd);if(!compileResult.configPath)return null;let rawConfig=await readFile(compileResult.configPath,"utf8"),config=parse(rawConfig);if(!config||!(0,import_service_topology.hasLegacyServicesConfig)(config))return null;let resolvedServices=detectServicesResult?.resolved?.source==="configured"?detectServicesResult.services.filter(s=>(0,import_build_utils.isExperimentalService)(s)):void 0,plan=await(0,import_service_topology.migrateExperimentalServices)({fs:new import_fs_detectors.LocalFileSystemDetector(cwd),config,resolvedServices:resolvedServices&&resolvedServices.length>0?resolvedServices:void 0}),sourceFile=compileResult.sourceFile??basename(compileResult.configPath),preparation={plan,sourceFile,snippet:renderSnippet(sourceFile,plan)};if(plan.errors.length>0)return preparation;if(compileResult.wasCompiled)return preparation.writeBlocker=`${sourceFile} can't be updated automatically.`,preparation;let content=applyPlanToJson(rawConfig,config,plan),parseErrors=[],nextConfig=parse(content,parseErrors);if(parseErrors.length>0)return preparation.writeBlocker=`Couldn't produce a valid ${sourceFile}.`,preparation;let validationError=validateConfig(nextConfig);return validationError?(preparation.writeBlocker=validationError.message,preparation):(preparation.write={configPath:compileResult.configPath,content},preparation)}function applyPlanToJson(rawConfig,config,plan){let eol=rawConfig.includes(`\r
8
8
  `)?`\r
9
9
  `:`
10
10
  `,indent2=/^([ \t]+)\S/m.exec(rawConfig)?.[1]??" ",formattingOptions={eol,insertSpaces:!indent2.startsWith(" "),tabSize:indent2.startsWith(" ")?1:indent2.length},legacyKey=config.experimentalServices?"experimentalServices":"experimentalServicesV2",key=findNodeAtLocation(parseTree(rawConfig),[legacyKey]).parent.children[0],text=applyEdits(rawConfig,[{offset:key.offset,length:key.length,content:'"services"'}]);text=applyEdits(text,modify(text,["services"],plan.patch.services,{formattingOptions}));for(let key2 of plan.removeKeys)key2!==legacyKey&&(text=applyEdits(text,modify(text,[key2],void 0,{formattingOptions})));for(let[key2,value]of Object.entries(plan.patch.build?.env??{}))text=applyEdits(text,modify(text,["build","env",key2],value,{formattingOptions}));if(plan.patch.rewrites.length>0)if(Array.isArray(config.rewrites))for(let rewrite of plan.patch.rewrites)text=applyEdits(text,modify(text,["rewrites",-1],rewrite,{formattingOptions}));else text=applyEdits(text,modify(text,["rewrites"],plan.patch.rewrites,{formattingOptions,getInsertionIndex:keys=>keys.indexOf("services")+1}));return text.endsWith(`