vercel 59.17.0 → 59.19.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 (220) hide show
  1. package/dist/chunks/add-EM223ILV.js +8 -0
  2. package/dist/chunks/{add-7VKP56JJ.js → add-G5SYPCB4.js} +1 -1
  3. package/dist/chunks/add-SKKI525V.js +8 -0
  4. package/dist/chunks/build-JEZ2ELHZ.js +7 -0
  5. package/dist/chunks/{chunk-JTVVBRW7.js → chunk-2Q47GHFX.js} +1 -1
  6. package/dist/chunks/{chunk-ZB6NNKOB.js → chunk-327GP3PO.js} +1 -1
  7. package/dist/chunks/{chunk-MVAM5QXS.js → chunk-33FG2PIV.js} +1 -1
  8. package/dist/chunks/chunk-4P66SQRS.js +9 -0
  9. package/dist/chunks/{chunk-XSVBYDYI.js → chunk-4VGOAPFY.js} +1 -1
  10. package/dist/chunks/{chunk-3EZENL67.js → chunk-556CXJRE.js} +1 -1
  11. package/dist/chunks/{chunk-QY4UZGLW.js → chunk-5XK67SSI.js} +1 -1
  12. package/dist/chunks/{chunk-V6GSMYQB.js → chunk-5ZIZD5ZG.js} +1 -1
  13. package/dist/chunks/{chunk-AJQZAHAG.js → chunk-6RHRDUSK.js} +1 -1
  14. package/dist/chunks/{chunk-GRNTLNC7.js → chunk-7NYQ7CTP.js} +1 -1
  15. package/dist/chunks/{chunk-HBFPLBTX.js → chunk-7O3KGTQ3.js} +1 -1
  16. package/dist/chunks/{chunk-A5SVOPQK.js → chunk-AGDWVTJV.js} +4 -4
  17. package/dist/chunks/{chunk-HJWWMWLL.js → chunk-AJAO4Q3T.js} +1 -1
  18. package/dist/chunks/{chunk-CKKCHHEZ.js → chunk-B7XCF45C.js} +1 -1
  19. package/dist/chunks/{chunk-CN2QZO4U.js → chunk-BW24TEUN.js} +1 -1
  20. package/dist/chunks/chunk-CJPM2DXZ.js +7 -0
  21. package/dist/chunks/{chunk-OTSU5NS3.js → chunk-CQPIWP7K.js} +1 -1
  22. package/dist/chunks/{chunk-L243RUIR.js → chunk-CWTXZPUV.js} +1 -1
  23. package/dist/chunks/{chunk-YV6CTDHR.js → chunk-DLKR2CG6.js} +1 -1
  24. package/dist/chunks/{chunk-G7Y77DFH.js → chunk-E4CRGS56.js} +1 -1
  25. package/dist/chunks/{chunk-6YAADRQB.js → chunk-EGG7SPNM.js} +1 -1
  26. package/dist/chunks/chunk-F5HAX74T.js +18 -0
  27. package/dist/chunks/{chunk-ZYTGXCXP.js → chunk-FBVWXFCP.js} +1 -1
  28. package/dist/chunks/{chunk-XGWR4HFH.js → chunk-FCC3LYIB.js} +1 -1
  29. package/dist/chunks/{chunk-UVOVAU43.js → chunk-FNYAHJIZ.js} +1 -1
  30. package/dist/chunks/{chunk-O67S7BW6.js → chunk-FUK2JEKI.js} +1 -1
  31. package/dist/chunks/{chunk-UMCKAEPK.js → chunk-GCHDJ44X.js} +1 -1
  32. package/dist/chunks/{chunk-4QX77CP7.js → chunk-GGZODU6S.js} +1 -1
  33. package/dist/chunks/chunk-GI6G3FJJ.js +19 -0
  34. package/dist/chunks/{chunk-EVZRQGNK.js → chunk-GTK7TBLW.js} +1 -1
  35. package/dist/chunks/{chunk-ZZQRMRWD.js → chunk-GWPIATTW.js} +1 -1
  36. package/dist/chunks/{chunk-MPV7JL34.js → chunk-HBF4YJR2.js} +1 -1
  37. package/dist/chunks/chunk-HKKKVW7W.js +8 -0
  38. package/dist/chunks/{chunk-75CPY75D.js → chunk-IERVS47L.js} +1 -1
  39. package/dist/chunks/chunk-IH2HZFLM.js +8 -0
  40. package/dist/chunks/{chunk-5QNKMAN3.js → chunk-IX4MMEGJ.js} +3 -3
  41. package/dist/chunks/{chunk-AB4GEWGP.js → chunk-JB45UWGT.js} +1 -1
  42. package/dist/chunks/{chunk-K3KJZLBD.js → chunk-JDQP267R.js} +1 -1
  43. package/dist/chunks/{chunk-ZJLMBHD6.js → chunk-KU32YRCG.js} +1 -1
  44. package/dist/chunks/{chunk-HEE6XLHF.js → chunk-LASMHNUP.js} +2 -2
  45. package/dist/chunks/{chunk-JYAUUIR4.js → chunk-LZTGSYL3.js} +1 -1
  46. package/dist/chunks/chunk-MBHVWCFE.js +7 -0
  47. package/dist/chunks/{chunk-QMY5EY5M.js → chunk-MIGWUMB3.js} +1 -1
  48. package/dist/chunks/{chunk-KH4SXKLD.js → chunk-NLQNFWX2.js} +1 -1
  49. package/dist/chunks/{chunk-3DRX67W4.js → chunk-OROPHBHW.js} +1 -1
  50. package/dist/chunks/{chunk-QGIGNMII.js → chunk-OWEH7BYO.js} +1 -1
  51. package/dist/chunks/{chunk-ZIPVX7LD.js → chunk-OXH3RM6U.js} +1 -1
  52. package/dist/chunks/{chunk-G6CTAHKY.js → chunk-PIKD5KTH.js} +1 -1
  53. package/dist/chunks/{chunk-EGMJRU5P.js → chunk-PNRWNSM2.js} +1 -1
  54. package/dist/chunks/chunk-Q2Z6EXCT.js +11 -0
  55. package/dist/chunks/{chunk-UZBQDJR7.js → chunk-QYPQGOSO.js} +1 -1
  56. package/dist/chunks/chunk-RIQFJ2MY.js +27 -0
  57. package/dist/chunks/{chunk-Z6Y55QJW.js → chunk-RTRCTYW6.js} +2 -2
  58. package/dist/chunks/{chunk-4NE5IQ25.js → chunk-RVJ2E3BM.js} +1 -1
  59. package/dist/chunks/{chunk-G77VJ754.js → chunk-SPPD6HZ7.js} +1 -1
  60. package/dist/chunks/{chunk-3TXEXPUW.js → chunk-TCS3FDID.js} +1 -1
  61. package/dist/chunks/{chunk-PCFGV4Y7.js → chunk-TEFZFCIF.js} +1 -1
  62. package/dist/chunks/{chunk-WKZ6JSGZ.js → chunk-TKBORMUF.js} +1 -1
  63. package/dist/chunks/{chunk-XQ73QIQ3.js → chunk-U6TAKLJ6.js} +1 -1
  64. package/dist/chunks/{chunk-NUGLE4QY.js → chunk-UED2PPFP.js} +1 -1
  65. package/dist/chunks/{chunk-QIM3U2QM.js → chunk-VDYU5GXV.js} +1 -1
  66. package/dist/chunks/chunk-VOZEB6PD.js +7 -0
  67. package/dist/chunks/{chunk-JSFWLEP3.js → chunk-VRBSHDYH.js} +1 -1
  68. package/dist/chunks/chunk-W2XUH2WW.js +25 -0
  69. package/dist/chunks/chunk-WR5OOWD6.js +10 -0
  70. package/dist/chunks/{chunk-RAIBQIKB.js → chunk-XKNCIFFB.js} +1 -1
  71. package/dist/chunks/chunk-XM3JW6AL.js +7 -0
  72. package/dist/chunks/{chunk-LVWXFCBP.js → chunk-XPTHZQSQ.js} +1 -1
  73. package/dist/chunks/chunk-XPV22OOJ.js +9 -0
  74. package/dist/chunks/{chunk-TJCIHDPZ.js → chunk-XQWBEAKZ.js} +1 -1
  75. package/dist/chunks/{chunk-2B2MN3U5.js → chunk-XV6SDZIO.js} +1 -1
  76. package/dist/chunks/{chunk-6MSXYTO7.js → chunk-XZYKYDQO.js} +1 -1
  77. package/dist/chunks/{chunk-V3N37D4D.js → chunk-Z2LUKMI6.js} +1 -1
  78. package/dist/chunks/{chunk-PQCAYAZ3.js → chunk-ZOI3EEL3.js} +1 -1
  79. package/dist/chunks/chunk-ZRS5X7M2.js +7 -0
  80. package/dist/chunks/{chunk-6RIQPTJA.js → chunk-ZVFZIWBV.js} +1 -1
  81. package/dist/chunks/clear-D6L6DOJX.js +8 -0
  82. package/dist/chunks/{compile-vercel-config-QSK54DR5.js → compile-vercel-config-HTWCKOXQ.js} +1 -1
  83. package/dist/chunks/config-3PKXC765.js +7 -0
  84. package/dist/chunks/config-UC3QD67B.js +8 -0
  85. package/dist/chunks/connect-git-provider-LSTDI4TC.js +7 -0
  86. package/dist/chunks/{constants-G4UYVLOF.js → constants-NCE2LWSS.js} +1 -1
  87. package/dist/chunks/delete-6QE6SZFG.js +9 -0
  88. package/dist/chunks/delete-KIBUBKS5.js +10 -0
  89. package/dist/chunks/{detect-projects-KARO5GUW.js → detect-projects-64MZJZ6M.js} +1 -1
  90. package/dist/chunks/{detect-services-E6YHXKW4.js → detect-services-HCM5D7CD.js} +1 -1
  91. package/dist/chunks/disable-2SIGN57F.js +7 -0
  92. package/dist/chunks/discard-SU4KZRF4.js +14 -0
  93. package/dist/chunks/edit-UPPFWMDP.js +8 -0
  94. package/dist/chunks/edit-XSC7KTWU.js +9 -0
  95. package/dist/chunks/enable-ON2Z35WD.js +7 -0
  96. package/dist/chunks/{exec-4AISDHUV.js → exec-ZLT5KH2Z.js} +1 -1
  97. package/dist/chunks/{export-NHFTH2RG.js → export-4WCA27XL.js} +1 -1
  98. package/dist/chunks/future-LU77KNDL.js +7 -0
  99. package/dist/chunks/{generate-cert-for-deploy-XRP7KJJT.js → generate-cert-for-deploy-UFWA55HF.js} +1 -1
  100. package/dist/chunks/image-OUAKVKKW.js +7 -0
  101. package/dist/chunks/import-builders-GAOM5PLP.js +7 -0
  102. package/dist/chunks/inspect-2U2ZS6BV.js +9 -0
  103. package/dist/chunks/{inspect-2ODMUOBD.js → inspect-CPKV2YRR.js} +1 -1
  104. package/dist/chunks/inspect-HSMBKUSW.js +13 -0
  105. package/dist/chunks/{inspect-BDBUAW64.js → inspect-N3RXYOHT.js} +1 -1
  106. package/dist/chunks/{inspect-PG2FOH2K.js → inspect-VVRA6JZQ.js} +1 -1
  107. package/dist/chunks/list-A7WJ266A.js +11 -0
  108. package/dist/chunks/{list-DPSVL3LB.js → list-EPOTOCMN.js} +1 -1
  109. package/dist/chunks/{list-XTWDVN6W.js → list-XGP6PIS5.js} +1 -1
  110. package/dist/chunks/login-7ALV7XD4.js +9 -0
  111. package/dist/chunks/login-YQ7QPK4A.js +7 -0
  112. package/dist/chunks/{logs-ZMEAEAT2.js → logs-4WPTTXCS.js} +1 -1
  113. package/dist/chunks/{ls-HV6R6EFU.js → ls-62NGKVG2.js} +1 -1
  114. package/dist/chunks/{ls-FGCLFYVB.js → ls-FOS2BGO3.js} +1 -1
  115. package/dist/chunks/{ls-M6LA6GW2.js → ls-FUXVU2FM.js} +1 -1
  116. package/dist/chunks/{ls-ITZ7B6PN.js → ls-L5IRHEBU.js} +1 -1
  117. package/dist/chunks/{ls-AOKYY6S4.js → ls-OGLSDDB5.js} +1 -1
  118. package/dist/chunks/{ls-AD6U4YKQ.js → ls-UDE66BQH.js} +1 -1
  119. package/dist/chunks/{ls-TQCHJ433.js → ls-WLDQKOJX.js} +1 -1
  120. package/dist/chunks/{mutate-ECYH3M3M.js → mutate-TA3QMCKY.js} +1 -1
  121. package/dist/chunks/notifications-4XNZKXKP.js +7 -0
  122. package/dist/chunks/open-G2NKF4KL.js +7 -0
  123. package/dist/chunks/openapi-YEDROCHV.js +7 -0
  124. package/dist/chunks/permissions-35SS45VZ.js +7 -0
  125. package/dist/chunks/prompt-missing-credentials-YVS4S7X2.js +7 -0
  126. package/dist/chunks/publish-LSRQFUBZ.js +15 -0
  127. package/dist/chunks/pull-BOJ3ZTIE.js +7 -0
  128. package/dist/chunks/{purchase-domain-if-available-GLGUG72T.js → purchase-domain-if-available-KEMVAHHF.js} +1 -1
  129. package/dist/chunks/push-FLK45IKR.js +7 -0
  130. package/dist/chunks/{query-CDQJX2Z7.js → query-XP27OAHW.js} +2 -2
  131. package/dist/chunks/reauthenticate-APC7ZYFC.js +7 -0
  132. package/dist/chunks/reorder-F22Q63TM.js +10 -0
  133. package/dist/chunks/reply-CPWRB47S.js +9 -0
  134. package/dist/chunks/resolve-L7Y4FLIS.js +12 -0
  135. package/dist/chunks/restore-FOQ5TF47.js +16 -0
  136. package/dist/chunks/{rm-H3UFGM5B.js → rm-7CH7JXQR.js} +1 -1
  137. package/dist/chunks/rm-IBIBN3TV.js +8 -0
  138. package/dist/chunks/rm-OQL6ZGQM.js +8 -0
  139. package/dist/chunks/rm-PWMT2FES.js +8 -0
  140. package/dist/chunks/{rm-7YF4FPRG.js → rm-QTAD3MMN.js} +1 -1
  141. package/dist/chunks/routes-ZD7XUKLY.js +7 -0
  142. package/dist/chunks/{rule-inspect-QJKXA6GM.js → rule-inspect-SGVM6FEZ.js} +1 -1
  143. package/dist/chunks/rules-MMAVDLJB.js +7 -0
  144. package/dist/chunks/{schema-2OJNI6A5.js → schema-B74HJNER.js} +1 -1
  145. package/dist/chunks/{schema-BIFEX4HY.js → schema-JYYQBTCL.js} +1 -1
  146. package/dist/chunks/select-org-5OUQKTNI.js +7 -0
  147. package/dist/chunks/{set-GYCTXDOC.js → set-6MRJYM56.js} +1 -1
  148. package/dist/chunks/setup-and-link-M6GYPEQY.js +7 -0
  149. package/dist/chunks/tags-SWK66ZCK.js +7 -0
  150. package/dist/chunks/{types-LRXQEDYI.js → types-BTHJ46LC.js} +1 -1
  151. package/dist/chunks/{update-4ZU5XKA2.js → update-UVXYG3Q7.js} +1 -1
  152. package/dist/chunks/{chunk-XFVGX5HG.js → vlt-builder-graph-B4DFIUS6.js} +1 -1
  153. package/dist/commands/build/index.js +1 -1
  154. package/dist/commands/deploy/index.js +6 -6
  155. package/dist/commands/dev/index.js +12 -11
  156. package/dist/commands/env/index.js +1 -1
  157. package/dist/commands/link/index.js +1 -1
  158. package/dist/commands/list/index.js +1 -1
  159. package/dist/commands-bulk.js +605 -574
  160. package/dist/index.js +6 -6
  161. package/dist/version.mjs +1 -1
  162. package/package.json +19 -19
  163. package/dist/chunks/add-EVIN2PRI.js +0 -8
  164. package/dist/chunks/add-KHUJ5BSP.js +0 -8
  165. package/dist/chunks/build-JX4MLRH3.js +0 -7
  166. package/dist/chunks/chunk-3AKI2QN6.js +0 -13
  167. package/dist/chunks/chunk-57GHYR4Y.js +0 -25
  168. package/dist/chunks/chunk-6SLI6JAA.js +0 -8
  169. package/dist/chunks/chunk-HODOBPBQ.js +0 -7
  170. package/dist/chunks/chunk-HTC6KO2B.js +0 -7
  171. package/dist/chunks/chunk-LNPMDXBJ.js +0 -7
  172. package/dist/chunks/chunk-LSBEGBBX.js +0 -9
  173. package/dist/chunks/chunk-NS4FH2TY.js +0 -11
  174. package/dist/chunks/chunk-OMHZEZGJ.js +0 -8
  175. package/dist/chunks/chunk-R2TGGVCT.js +0 -19
  176. package/dist/chunks/chunk-UETTIYUQ.js +0 -8
  177. package/dist/chunks/chunk-WIOGEJOJ.js +0 -9
  178. package/dist/chunks/chunk-YKZLKOOD.js +0 -12
  179. package/dist/chunks/chunk-ZCPBIHDL.js +0 -18
  180. package/dist/chunks/clear-X4OSHTWA.js +0 -8
  181. package/dist/chunks/config-CYB2D7JW.js +0 -8
  182. package/dist/chunks/config-OMS5PWMD.js +0 -7
  183. package/dist/chunks/connect-git-provider-GIU5WZ52.js +0 -7
  184. package/dist/chunks/delete-FGAGJXOB.js +0 -9
  185. package/dist/chunks/delete-VCTCCONO.js +0 -10
  186. package/dist/chunks/disable-HH54G52S.js +0 -7
  187. package/dist/chunks/discard-5WINBWIU.js +0 -14
  188. package/dist/chunks/edit-VRGGDLHE.js +0 -9
  189. package/dist/chunks/edit-XPCNKJWN.js +0 -8
  190. package/dist/chunks/enable-YDUGO5UD.js +0 -7
  191. package/dist/chunks/future-E2FHKPJN.js +0 -7
  192. package/dist/chunks/image-F7YIEOEF.js +0 -7
  193. package/dist/chunks/import-builders-QRQT4S2U.js +0 -7
  194. package/dist/chunks/inspect-3FLLLXNZ.js +0 -9
  195. package/dist/chunks/inspect-IGC2Q4VF.js +0 -13
  196. package/dist/chunks/list-DPLMC7O6.js +0 -11
  197. package/dist/chunks/login-DEAEVUHM.js +0 -7
  198. package/dist/chunks/login-XBBIV5CZ.js +0 -9
  199. package/dist/chunks/native-self-update-KOJVRMHR.js +0 -7
  200. package/dist/chunks/notifications-ZOG67PRF.js +0 -7
  201. package/dist/chunks/open-H6UQKAZ4.js +0 -7
  202. package/dist/chunks/openapi-MO5HYMHR.js +0 -7
  203. package/dist/chunks/permissions-UXSL3L5W.js +0 -7
  204. package/dist/chunks/prompt-missing-credentials-IUHLYSQU.js +0 -7
  205. package/dist/chunks/publish-LVRMJU7C.js +0 -15
  206. package/dist/chunks/pull-N73PO6QD.js +0 -7
  207. package/dist/chunks/push-BR24ODVX.js +0 -7
  208. package/dist/chunks/reauthenticate-SH4XR7NH.js +0 -7
  209. package/dist/chunks/reorder-4CT3NI3X.js +0 -10
  210. package/dist/chunks/reply-6SBUWKEV.js +0 -9
  211. package/dist/chunks/resolve-4YRSE3DN.js +0 -12
  212. package/dist/chunks/restore-HKI7YSAI.js +0 -16
  213. package/dist/chunks/rm-4WGNHC36.js +0 -8
  214. package/dist/chunks/rm-EHWULTJ4.js +0 -8
  215. package/dist/chunks/rm-ZZYVVAWZ.js +0 -8
  216. package/dist/chunks/routes-5DERZV5M.js +0 -7
  217. package/dist/chunks/rules-LG2IKQ7A.js +0 -7
  218. package/dist/chunks/select-org-KSCYSESV.js +0 -7
  219. package/dist/chunks/setup-and-link-FV35BKJV.js +0 -7
  220. package/dist/chunks/tags-C7RMO53H.js +0 -7
@@ -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{getGlobalPathConfig}from"./chunk-ZIPVX7LD.js";import{output_manager_default}from"./chunk-Z6Y55QJW.js";var OPENAPI_URL="https://openapi.vercel.sh/",SSO_API_URL="https://vercel.com/sso-api",CACHE_FILE="openapi-spec.json",CACHE_TTL_MS=864e5,FETCH_TIMEOUT_MS=1e4,MAX_OPENAPI_SPEC_BYTES=52428800,VERCEL_CLI_ROOT_DISPLAY_KEY="__root__";async function readSpecResponse(response,url,maxBytes=52428800){let contentLength=response.headers.get("content-length");if(contentLength){let bytes=Number(contentLength);if(Number.isFinite(bytes)&&bytes>maxBytes)throw new Error(`OpenAPI spec from ${url} exceeds the ${maxBytes} byte limit.`)}if(!response.body)throw new Error(`OpenAPI spec from ${url} returned an empty response.`);let reader=response.body.getReader(),chunks=[],totalBytes=0;for(;;){let{done,value}=await reader.read();if(done)break;if(value){if(totalBytes+=value.byteLength,totalBytes>maxBytes)throw await reader.cancel(),new Error(`OpenAPI spec from ${url} exceeds the ${maxBytes} byte limit.`);chunks.push(value)}}let buffer=new Uint8Array(totalBytes),offset=0;for(let chunk of chunks)buffer.set(chunk,offset),offset+=chunk.byteLength;return JSON.parse(new TextDecoder().decode(buffer))}var ALLOWED_SPEC_HOSTS=["vercel.sh","vercel.tools"];function assertAllowedSpecUrl(specUrl){let parsedUrl=new URL(specUrl);if(parsedUrl.protocol!=="https:")throw new Error("OpenAPI spec URL must use https");if(!ALLOWED_SPEC_HOSTS.some(host=>isHostOrSubdomain(parsedUrl,host)))throw new Error("OpenAPI spec URL must be on an allowed origin.");return parsedUrl}function isHostOrSubdomain(url,host){return url.hostname===host||url.hostname.endsWith(`.${host}`)}import{join}from"path";import{readFile,writeFile,mkdir}from"fs/promises";var OpenApiCache=class{constructor(options){this.spec=null;this.error=null;this.cachePath=join(getGlobalPathConfig(),CACHE_FILE),this.specUrl=options?.specUrl,this.fetchSpecUrl=options?.fetchSpecUrl}get isLoaded(){return this.spec!==null}get loadError(){return this.error}async load(forceRefresh=!1){return this.loadSpec(forceRefresh)}async loadSpec(forceRefresh=!1){if(this.error=null,this.specUrl)return this.loadCustomSpec(this.specUrl);if(!forceRefresh){let cached=await this.readCache(this.cachePath);if(cached&&!this.isExpired(cached.fetchedAt))return output_manager_default.debug("Using cached OpenAPI spec"),this.spec=cached.spec,!0}try{return output_manager_default.debug("Fetching OpenAPI spec from "+OPENAPI_URL),this.spec=await this.fetchSpec(OPENAPI_URL),await this.saveCache(this.cachePath,this.spec),!0}catch(err){output_manager_default.debug(`Failed to fetch OpenAPI spec: ${err}`);let stale=await this.readCache(this.cachePath);return stale?(output_manager_default.debug("Using stale cached OpenAPI spec"),this.spec=stale.spec,!0):!1}}async loadCustomSpec(specUrl){try{assertAllowedSpecUrl(specUrl),output_manager_default.debug("Fetching OpenAPI spec from "+specUrl);let spec=this.fetchSpecUrl?await this.fetchSpecUrl(specUrl):await this.fetchSpec(specUrl);return spec?(this.validateSpec(spec,specUrl),this.spec=spec,!!this.spec):(this.error=`Could not load OpenAPI spec from ${specUrl}.`,!1)}catch(err){let message=err instanceof Error?err.message:String(err);return this.error=message,output_manager_default.debug(`Failed to fetch OpenAPI spec from ${specUrl}: ${message}`),!1}}async loadWithSpinner(forceRefresh=!1){output_manager_default.spinner(forceRefresh?"Refreshing API endpoints...":"Loading API endpoints...");let success=await this.load(forceRefresh);return output_manager_default.stopSpinner(),success}getEndpoints(){this.ensureLoaded();let endpoints=this.extractEndpoints();return this.sortEndpoints(endpoints)}getBodyFields(endpoint){if(this.ensureLoaded(),!endpoint.requestBody?.content)return[];let jsonContent=endpoint.requestBody.content["application/json"];if(!jsonContent?.schema)return[];let schema=this.resolveSchemaRef(jsonContent.schema);if(!schema?.properties)return[];let requiredFields=new Set(schema.required||[]),fields=[];for(let[name,propSchema]of Object.entries(schema.properties)){let resolvedProp=this.resolveSchemaRef(propSchema),enumValues=resolvedProp?.enum||propSchema.enum;if(!enumValues&&(resolvedProp?.type==="array"||propSchema.type==="array")){let items=resolvedProp?.items||propSchema.items;items&&(enumValues=this.resolveSchemaRef(items)?.enum||items.enum)}fields.push({name,required:requiredFields.has(name),description:resolvedProp?.description||propSchema.description,type:resolvedProp?.type||propSchema.type,enumValues})}return fields.sort((a,b)=>a.required!==b.required?a.required?-1:1:a.name.localeCompare(b.name)),fields}getDisplayColumns(endpoint){this.ensureLoaded();let pathItem=this.spec.paths[endpoint.path];if(!pathItem)return null;let operation=pathItem[endpoint.method.toLowerCase()];if(!operation?.responses)return null;let ok=operation.responses[200]||operation.responses[201];if(!ok)return null;let jsonContent=ok.content?.["application/json"];return jsonContent?.schema?this.findDisplayColumns(jsonContent.schema):null}findDisplayColumns(schema){let xCli=schema["x-vercel-cli"];if(xCli?.displayColumns)return xCli.displayColumns;for(let key of["oneOf","allOf","anyOf"]){let variants=schema[key];if(variants)for(let sub of variants){let found=this.findDisplayColumns(sub);if(found)return found}}return null}ensureLoaded(){if(!this.spec)throw new Error("OpenAPI spec not loaded. Call load() or loadWithSpinner() first.")}async readCache(cachePath){try{let content=await readFile(cachePath,"utf-8");return JSON.parse(content)}catch{return null}}async saveCache(cachePath,spec){let cached={fetchedAt:Date.now(),spec},dir=join(cachePath,"..");await mkdir(dir,{recursive:!0}),await writeFile(cachePath,JSON.stringify(cached)),output_manager_default.debug("Saved OpenAPI spec to cache")}async fetchSpec(url){let controller=new AbortController,timeoutId=setTimeout(()=>controller.abort(),1e4);try{let response=await fetch(url,{signal:controller.signal});if(!response.ok)throw new Error(`Failed to fetch OpenAPI spec: ${response.status}`);let spec=await readSpecResponse(response,url);return this.validateSpec(spec,url),spec}finally{clearTimeout(timeoutId)}}validateSpec(spec,url){if(!spec||typeof spec!="object")throw new Error(`Invalid OpenAPI spec from ${url}: expected a JSON object.`);if(typeof spec.openapi!="string"||!spec.openapi.startsWith("3."))throw new Error(`Invalid OpenAPI spec from ${url}: expected an OpenAPI 3.x document with an "openapi" field.`);if(!spec.paths||typeof spec.paths!="object")throw new Error(`Invalid OpenAPI spec from ${url}: expected a "paths" object.`);for(let path of Object.keys(spec.paths))if(!path.startsWith("/")||path.startsWith("//"))throw new Error(`Invalid OpenAPI spec from ${url}: path "${path}" must be a relative API path.`)}isExpired(fetchedAt){return Date.now()-fetchedAt>864e5}sortEndpoints(endpoints){return endpoints.sort((a,b)=>{let pathCompare=a.path.localeCompare(b.path);return pathCompare!==0?pathCompare:a.method.localeCompare(b.method)})}extractEndpoints(){let endpoints=[];for(let[path,pathItem]of Object.entries(this.spec.paths)){let methods=["get","post","put","patch","delete"];for(let method of methods){let operation=pathItem[method];if(operation){let pathParams=pathItem.parameters||[],opParams=operation.parameters||[],allParams=[...pathParams,...opParams];endpoints.push({path,method:method.toUpperCase(),summary:operation.summary||pathItem.summary||"",description:operation.description||pathItem.description||"",operationId:operation.operationId||"",tags:operation.tags||[],parameters:allParams,requestBody:operation.requestBody})}}}return endpoints}resolveSchemaRef(schema,spec=this.spec){if(schema){if(schema.$ref){let match=schema.$ref.match(/^#\/components\/schemas\/(.+)$/);if(match&&spec.components?.schemas){let resolved=spec.components.schemas[match[1]];return this.resolveSchemaRef(resolved,spec)}return}if(schema.allOf&&schema.allOf.length>0){let merged={type:"object",properties:{},required:[]};for(let subSchema of schema.allOf){let resolved=this.resolveSchemaRef(subSchema,spec);resolved&&(resolved.properties&&(merged.properties={...merged.properties,...resolved.properties}),resolved.required&&(merged.required=[...merged.required||[],...resolved.required]))}return merged}return schema}}};async function matchesCliApiTag(tagHint){if(!tagHint||tagHint.startsWith("-")||tagHint.includes("/"))return!1;let cache=new OpenApiCache;if(!await cache.load())return!1;let endpoints=cache.getEndpoints(),lower=tagHint.toLowerCase();return endpoints.some(ep=>ep.tags.some(t=>t.toLowerCase()===lower))}async function resolveOpenApiTagForProjectsCli(){return await matchesCliApiTag("projects")?"projects":await matchesCliApiTag("project")?"project":null}async function resolveOpenApiTagForTeamsCli(){return await matchesCliApiTag("teams")?"teams":await matchesCliApiTag("team")?"team":null}export{OPENAPI_URL,SSO_API_URL,CACHE_FILE,CACHE_TTL_MS,FETCH_TIMEOUT_MS,MAX_OPENAPI_SPEC_BYTES,VERCEL_CLI_ROOT_DISPLAY_KEY,readSpecResponse,assertAllowedSpecUrl,OpenApiCache,matchesCliApiTag,resolveOpenApiTagForProjectsCli,resolveOpenApiTagForTeamsCli};
7
+ import{getGlobalPathConfig}from"./chunk-OXH3RM6U.js";import{output_manager_default}from"./chunk-RTRCTYW6.js";var OPENAPI_URL="https://openapi.vercel.sh/",SSO_API_URL="https://vercel.com/sso-api",CACHE_FILE="openapi-spec.json",CACHE_TTL_MS=864e5,FETCH_TIMEOUT_MS=1e4,MAX_OPENAPI_SPEC_BYTES=52428800,VERCEL_CLI_ROOT_DISPLAY_KEY="__root__";async function readSpecResponse(response,url,maxBytes=52428800){let contentLength=response.headers.get("content-length");if(contentLength){let bytes=Number(contentLength);if(Number.isFinite(bytes)&&bytes>maxBytes)throw new Error(`OpenAPI spec from ${url} exceeds the ${maxBytes} byte limit.`)}if(!response.body)throw new Error(`OpenAPI spec from ${url} returned an empty response.`);let reader=response.body.getReader(),chunks=[],totalBytes=0;for(;;){let{done,value}=await reader.read();if(done)break;if(value){if(totalBytes+=value.byteLength,totalBytes>maxBytes)throw await reader.cancel(),new Error(`OpenAPI spec from ${url} exceeds the ${maxBytes} byte limit.`);chunks.push(value)}}let buffer=new Uint8Array(totalBytes),offset=0;for(let chunk of chunks)buffer.set(chunk,offset),offset+=chunk.byteLength;return JSON.parse(new TextDecoder().decode(buffer))}var ALLOWED_SPEC_HOSTS=["vercel.sh","vercel.tools"];function assertAllowedSpecUrl(specUrl){let parsedUrl=new URL(specUrl);if(parsedUrl.protocol!=="https:")throw new Error("OpenAPI spec URL must use https");if(!ALLOWED_SPEC_HOSTS.some(host=>isHostOrSubdomain(parsedUrl,host)))throw new Error("OpenAPI spec URL must be on an allowed origin.");return parsedUrl}function isHostOrSubdomain(url,host){return url.hostname===host||url.hostname.endsWith(`.${host}`)}import{join}from"path";import{readFile,writeFile,mkdir}from"fs/promises";var OpenApiCache=class{constructor(options){this.spec=null;this.error=null;this.cachePath=join(getGlobalPathConfig(),CACHE_FILE),this.specUrl=options?.specUrl,this.fetchSpecUrl=options?.fetchSpecUrl}get isLoaded(){return this.spec!==null}get loadError(){return this.error}async load(forceRefresh=!1){return this.loadSpec(forceRefresh)}async loadSpec(forceRefresh=!1){if(this.error=null,this.specUrl)return this.loadCustomSpec(this.specUrl);if(!forceRefresh){let cached=await this.readCache(this.cachePath);if(cached&&!this.isExpired(cached.fetchedAt))return output_manager_default.debug("Using cached OpenAPI spec"),this.spec=cached.spec,!0}try{return output_manager_default.debug("Fetching OpenAPI spec from "+OPENAPI_URL),this.spec=await this.fetchSpec(OPENAPI_URL),await this.saveCache(this.cachePath,this.spec),!0}catch(err){output_manager_default.debug(`Failed to fetch OpenAPI spec: ${err}`);let stale=await this.readCache(this.cachePath);return stale?(output_manager_default.debug("Using stale cached OpenAPI spec"),this.spec=stale.spec,!0):!1}}async loadCustomSpec(specUrl){try{assertAllowedSpecUrl(specUrl),output_manager_default.debug("Fetching OpenAPI spec from "+specUrl);let spec=this.fetchSpecUrl?await this.fetchSpecUrl(specUrl):await this.fetchSpec(specUrl);return spec?(this.validateSpec(spec,specUrl),this.spec=spec,!!this.spec):(this.error=`Could not load OpenAPI spec from ${specUrl}.`,!1)}catch(err){let message=err instanceof Error?err.message:String(err);return this.error=message,output_manager_default.debug(`Failed to fetch OpenAPI spec from ${specUrl}: ${message}`),!1}}async loadWithSpinner(forceRefresh=!1){output_manager_default.spinner(forceRefresh?"Refreshing API endpoints...":"Loading API endpoints...");let success=await this.load(forceRefresh);return output_manager_default.stopSpinner(),success}getEndpoints(){this.ensureLoaded();let endpoints=this.extractEndpoints();return this.sortEndpoints(endpoints)}getBodyFields(endpoint){if(this.ensureLoaded(),!endpoint.requestBody?.content)return[];let jsonContent=endpoint.requestBody.content["application/json"];if(!jsonContent?.schema)return[];let schema=this.resolveSchemaRef(jsonContent.schema);if(!schema?.properties)return[];let requiredFields=new Set(schema.required||[]),fields=[];for(let[name,propSchema]of Object.entries(schema.properties)){let resolvedProp=this.resolveSchemaRef(propSchema),enumValues=resolvedProp?.enum||propSchema.enum;if(!enumValues&&(resolvedProp?.type==="array"||propSchema.type==="array")){let items=resolvedProp?.items||propSchema.items;items&&(enumValues=this.resolveSchemaRef(items)?.enum||items.enum)}fields.push({name,required:requiredFields.has(name),description:resolvedProp?.description||propSchema.description,type:resolvedProp?.type||propSchema.type,enumValues})}return fields.sort((a,b)=>a.required!==b.required?a.required?-1:1:a.name.localeCompare(b.name)),fields}getDisplayColumns(endpoint){this.ensureLoaded();let pathItem=this.spec.paths[endpoint.path];if(!pathItem)return null;let operation=pathItem[endpoint.method.toLowerCase()];if(!operation?.responses)return null;let ok=operation.responses[200]||operation.responses[201];if(!ok)return null;let jsonContent=ok.content?.["application/json"];return jsonContent?.schema?this.findDisplayColumns(jsonContent.schema):null}findDisplayColumns(schema){let xCli=schema["x-vercel-cli"];if(xCli?.displayColumns)return xCli.displayColumns;for(let key of["oneOf","allOf","anyOf"]){let variants=schema[key];if(variants)for(let sub of variants){let found=this.findDisplayColumns(sub);if(found)return found}}return null}ensureLoaded(){if(!this.spec)throw new Error("OpenAPI spec not loaded. Call load() or loadWithSpinner() first.")}async readCache(cachePath){try{let content=await readFile(cachePath,"utf-8");return JSON.parse(content)}catch{return null}}async saveCache(cachePath,spec){let cached={fetchedAt:Date.now(),spec},dir=join(cachePath,"..");await mkdir(dir,{recursive:!0}),await writeFile(cachePath,JSON.stringify(cached)),output_manager_default.debug("Saved OpenAPI spec to cache")}async fetchSpec(url){let controller=new AbortController,timeoutId=setTimeout(()=>controller.abort(),1e4);try{let response=await fetch(url,{signal:controller.signal});if(!response.ok)throw new Error(`Failed to fetch OpenAPI spec: ${response.status}`);let spec=await readSpecResponse(response,url);return this.validateSpec(spec,url),spec}finally{clearTimeout(timeoutId)}}validateSpec(spec,url){if(!spec||typeof spec!="object")throw new Error(`Invalid OpenAPI spec from ${url}: expected a JSON object.`);if(typeof spec.openapi!="string"||!spec.openapi.startsWith("3."))throw new Error(`Invalid OpenAPI spec from ${url}: expected an OpenAPI 3.x document with an "openapi" field.`);if(!spec.paths||typeof spec.paths!="object")throw new Error(`Invalid OpenAPI spec from ${url}: expected a "paths" object.`);for(let path of Object.keys(spec.paths))if(!path.startsWith("/")||path.startsWith("//"))throw new Error(`Invalid OpenAPI spec from ${url}: path "${path}" must be a relative API path.`)}isExpired(fetchedAt){return Date.now()-fetchedAt>864e5}sortEndpoints(endpoints){return endpoints.sort((a,b)=>{let pathCompare=a.path.localeCompare(b.path);return pathCompare!==0?pathCompare:a.method.localeCompare(b.method)})}extractEndpoints(){let endpoints=[];for(let[path,pathItem]of Object.entries(this.spec.paths)){let methods=["get","post","put","patch","delete"];for(let method of methods){let operation=pathItem[method];if(operation){let pathParams=pathItem.parameters||[],opParams=operation.parameters||[],allParams=[...pathParams,...opParams];endpoints.push({path,method:method.toUpperCase(),summary:operation.summary||pathItem.summary||"",description:operation.description||pathItem.description||"",operationId:operation.operationId||"",tags:operation.tags||[],parameters:allParams,requestBody:operation.requestBody})}}}return endpoints}resolveSchemaRef(schema,spec=this.spec){if(schema){if(schema.$ref){let match=schema.$ref.match(/^#\/components\/schemas\/(.+)$/);if(match&&spec.components?.schemas){let resolved=spec.components.schemas[match[1]];return this.resolveSchemaRef(resolved,spec)}return}if(schema.allOf&&schema.allOf.length>0){let merged={type:"object",properties:{},required:[]};for(let subSchema of schema.allOf){let resolved=this.resolveSchemaRef(subSchema,spec);resolved&&(resolved.properties&&(merged.properties={...merged.properties,...resolved.properties}),resolved.required&&(merged.required=[...merged.required||[],...resolved.required]))}return merged}return schema}}};async function matchesCliApiTag(tagHint){if(!tagHint||tagHint.startsWith("-")||tagHint.includes("/"))return!1;let cache=new OpenApiCache;if(!await cache.load())return!1;let endpoints=cache.getEndpoints(),lower=tagHint.toLowerCase();return endpoints.some(ep=>ep.tags.some(t=>t.toLowerCase()===lower))}async function resolveOpenApiTagForProjectsCli(){return await matchesCliApiTag("projects")?"projects":await matchesCliApiTag("project")?"project":null}async function resolveOpenApiTagForTeamsCli(){return await matchesCliApiTag("teams")?"teams":await matchesCliApiTag("team")?"team":null}export{OPENAPI_URL,SSO_API_URL,CACHE_FILE,CACHE_TTL_MS,FETCH_TIMEOUT_MS,MAX_OPENAPI_SPEC_BYTES,VERCEL_CLI_ROOT_DISPLAY_KEY,readSpecResponse,assertAllowedSpecUrl,OpenApiCache,matchesCliApiTag,resolveOpenApiTagForProjectsCli,resolveOpenApiTagForTeamsCli};
@@ -0,0 +1,7 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __dirname_ } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __dirname_(__filename);
7
+ import{isNativeBinaryInstall}from"./chunk-7T6TL3GQ.js";import{require_lib}from"./chunk-AGDWVTJV.js";import{packageName}from"./chunk-FI772UVH.js";import{__toESM}from"./chunk-6L236MNA.js";var import_fs_extra=__toESM(require_lib(),1);import{join as join2,sep}from"path";import{execFile}from"child_process";import{promisify}from"util";import{tmpdir}from"node:os";import{resolve}from"node:path";var trustedUpgradeEnvironment=Object.freeze({...process.env}),trustedUpgradeDirectory=resolve(tmpdir());import{join}from"path";var packageManagers={npm:{metadataArgs:specifier=>["view",specifier,"version","--json","--global"],installArgs:specifier=>["i","-g",specifier],releaseAgeBypassArgs:["--min-release-age=0"],globalDetection:{args:["root","-g"],packageDir:(root,pkg)=>join(root,pkg)}},pnpm:{metadataArgs:specifier=>["view",specifier,"version","--json"],installArgs:specifier=>["i","-g",specifier],releaseAgeBypassArgs:["--config.minimumReleaseAge=0"],globalDetection:{args:pkg=>["list","-g",pkg,"--depth=0","--json"],packageDir:(output,pkg)=>{try{let projects=JSON.parse(output),path=(Array.isArray(projects)?projects[0]:projects)?.dependencies?.[pkg]?.path;return typeof path=="string"?path:void 0}catch{return}}}},yarn:{metadataArgs:specifier=>["info",specifier.endsWith("@latest")?specifier.slice(0,-7):specifier,"version","--json"],installArgs:specifier=>["global","add",specifier],releaseAgeBypassArgs:[],globalDetection:{args:["--silent","global","dir"],packageDir:(root,pkg)=>join(root,"node_modules",pkg)}},bun:{metadataArgs:specifier=>["info",specifier,"version","--json","--global"],installArgs:specifier=>["add","-g",specifier],releaseAgeBypassArgs:[],globalDetection:{args:["pm","bin","-g"],binaryNames:["vercel","vc"]}}};function getUpgradePackageManager(name){return packageManagers[name]}var nativePackageName="@vercel/vc-native",execFileAsync=promisify(execFile),UnsupportedUpgradeInstallError=class extends Error{},globalCliTypes=["npm","pnpm","yarn","bun"];async function getPackageManagerGlobalRoot(cliType,pkg,env=trustedUpgradeEnvironment){try{let detectionArgs=getUpgradePackageManager(cliType).globalDetection.args,{stdout}=await execFileAsync(cliType,typeof detectionArgs=="function"?detectionArgs(pkg):detectionArgs,{encoding:"utf8",windowsHide:!0,cwd:trustedUpgradeDirectory,timeout:15e3,env});return stdout.trim()||null}catch{return null}}async function detectGlobalPackageManager(installPath,pkg,cliTypes=globalCliTypes,env=trustedUpgradeEnvironment){for(let cliType of cliTypes){let root=await getPackageManagerGlobalRoot(cliType,pkg,env);if(!root)continue;let detection=getUpgradePackageManager(cliType).globalDetection;if(detection.packageDir)try{let packageDir=detection.packageDir(root,pkg);if(!packageDir)continue;let resolvedPackageDir=await(0,import_fs_extra.realpath)(packageDir);if(installPath===resolvedPackageDir||installPath.startsWith(resolvedPackageDir+sep))return cliType}catch{}for(let binary of detection.binaryNames||[])try{let target=await(0,import_fs_extra.realpath)(join2(root,binary));if(target===installPath||target.startsWith(installPath+sep)||installPath.startsWith(target+sep))return cliType;let entrypoint=await(0,import_fs_extra.realpath)(process.argv[1]);if(!isNativeBinaryInstall()&&target===entrypoint)return cliType}catch{}}return null}async function resolveInstall(env=trustedUpgradeEnvironment){let nativeInstall=isNativeBinaryInstall(),pkg=nativeInstall?nativePackageName:packageName,installPath=nativeInstall?process.execPath:process.argv[1];try{installPath=await(0,import_fs_extra.realpath)(installPath)}catch{throw new UnsupportedUpgradeInstallError("Could not resolve this Vercel CLI installation. Update it with the package manager that installed it.")}let packageManager=await detectGlobalPackageManager(installPath,pkg,globalCliTypes,env);if(!packageManager)throw new UnsupportedUpgradeInstallError("Could not detect a supported global npm, pnpm, Yarn, or Bun installation of Vercel CLI. Update it with the package manager that installed it.");return{packageManager,global:!0,assumed:!1}}async function isGlobal(){try{return await resolveInstall(),!0}catch{return!1}}async function getUpdateCommandInfo(env=trustedUpgradeEnvironment){let nativeInstall=isNativeBinaryInstall(),pkg=nativeInstall?nativePackageName:packageName,{packageManager}=await resolveInstall(env),args=getUpgradePackageManager(packageManager).installArgs(`${pkg}@latest`),force=nativeInstall&&packageManager==="npm"?" --force":"",allowBuild=pnpmAllowBuildFlag(packageManager,nativeInstall?nativePackageName:"esbuild");return{command:`${packageManager} ${args.join(" ")}${force}${allowBuild}`,global:!0,packageManager,assumed:!1}}function pnpmAllowBuildFlag(cliType,pkg){return cliType==="pnpm"?` --allow-build=${pkg}`:""}async function getUpdateCommand(){return(await getUpdateCommandInfo()).command}export{trustedUpgradeEnvironment,trustedUpgradeDirectory,getUpgradePackageManager,isGlobal,getUpdateCommandInfo,getUpdateCommand};
@@ -4,5 +4,5 @@ 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_lib}from"./chunk-A5SVOPQK.js";import{humanizePath}from"./chunk-PPCFQQSU.js";import{output_manager_default}from"./chunk-Z6Y55QJW.js";import{require_source}from"./chunk-U7KCDTCH.js";import{__toESM}from"./chunk-6L236MNA.js";var import_fs_extra=__toESM(require_lib(),1),import_chalk=__toESM(require_source(),1);import{homedir}from"os";import{resolve,sep}from"path";async function validateRootDirectory(cwd,path,errorSuffix=""){let pathStat=await(0,import_fs_extra.lstat)(path).catch(()=>null),suffix=errorSuffix?` ${errorSuffix}`:"";if(!pathStat)return output_manager_default.error(`The provided path ${import_chalk.default.cyan(`\u201C${humanizePath(path)}\u201D`)} does not exist.${suffix}`),!1;if(!pathStat.isDirectory())return output_manager_default.error(`The provided path ${import_chalk.default.cyan(`\u201C${humanizePath(path)}\u201D`)} is a file, but expected a directory.${suffix}`),!1;let base=resolve(cwd),target=resolve(path);return target!==base&&!target.startsWith(base+sep)?(output_manager_default.error(`The provided path ${import_chalk.default.cyan(`\u201C${humanizePath(path)}\u201D`)} is outside of the project.${suffix}`),!1):!0}async function validatePaths(client,paths){if(paths.length>1)return output_manager_default.error("Can't deploy more than one path."),{valid:!1,exitCode:1};let path=paths[0],pathStat=await(0,import_fs_extra.lstat)(path).catch(()=>null);return pathStat?pathStat.isDirectory()?path===homedir()&&!await client.input.confirm("You are deploying your home directory. Do you want to continue?",!1)?(output_manager_default.print(`Canceled
7
+ import{require_lib}from"./chunk-AGDWVTJV.js";import{humanizePath}from"./chunk-PPCFQQSU.js";import{output_manager_default}from"./chunk-RTRCTYW6.js";import{require_source}from"./chunk-U7KCDTCH.js";import{__toESM}from"./chunk-6L236MNA.js";var import_fs_extra=__toESM(require_lib(),1),import_chalk=__toESM(require_source(),1);import{homedir}from"os";import{resolve,sep}from"path";async function validateRootDirectory(cwd,path,errorSuffix=""){let pathStat=await(0,import_fs_extra.lstat)(path).catch(()=>null),suffix=errorSuffix?` ${errorSuffix}`:"";if(!pathStat)return output_manager_default.error(`The provided path ${import_chalk.default.cyan(`\u201C${humanizePath(path)}\u201D`)} does not exist.${suffix}`),!1;if(!pathStat.isDirectory())return output_manager_default.error(`The provided path ${import_chalk.default.cyan(`\u201C${humanizePath(path)}\u201D`)} is a file, but expected a directory.${suffix}`),!1;let base=resolve(cwd),target=resolve(path);return target!==base&&!target.startsWith(base+sep)?(output_manager_default.error(`The provided path ${import_chalk.default.cyan(`\u201C${humanizePath(path)}\u201D`)} is outside of the project.${suffix}`),!1):!0}async function validatePaths(client,paths){if(paths.length>1)return output_manager_default.error("Can't deploy more than one path."),{valid:!1,exitCode:1};let path=paths[0],pathStat=await(0,import_fs_extra.lstat)(path).catch(()=>null);return pathStat?pathStat.isDirectory()?path===homedir()&&!await client.input.confirm("You are deploying your home directory. Do you want to continue?",!1)?(output_manager_default.print(`Canceled
8
8
  `),{valid:!1,exitCode:0}):{valid:!0,path}:(output_manager_default.prettyError({message:"Support for single file deployments has been removed.",link:"https://vercel.link/no-single-file-deployments"}),{valid:!1,exitCode:1}):(output_manager_default.error(`Could not find ${import_chalk.default.cyan(`\u201C${humanizePath(path)}\u201D`)}`),{valid:!1,exitCode:1})}export{validateRootDirectory,validatePaths};