vercel 59.15.1 → 59.16.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 (126) hide show
  1. package/dist/chunks/{add-7XFD2OHW.js → add-65ZSJF26.js} +1 -1
  2. package/dist/chunks/{add-HZC7AUBY.js → add-7G6574RA.js} +1 -1
  3. package/dist/chunks/{add-PYUNJZ6K.js → add-MFTI65B7.js} +1 -1
  4. package/dist/chunks/{build-EFKQ6BND.js → build-BLQRFSLM.js} +1 -1
  5. package/dist/chunks/{chunk-KO733OJG.js → chunk-265LYROU.js} +1 -1
  6. package/dist/chunks/{chunk-HZZ5L472.js → chunk-3EBQRPCU.js} +1 -1
  7. package/dist/chunks/{chunk-KNEWCUWF.js → chunk-4XH66IEQ.js} +1 -1
  8. package/dist/chunks/{chunk-EOBD4ZEG.js → chunk-4XO6BRQW.js} +1 -1
  9. package/dist/chunks/{chunk-3QT7VOE3.js → chunk-65JYSI26.js} +1 -1
  10. package/dist/chunks/{chunk-JIYY3B4C.js → chunk-6NVGLVCH.js} +1 -1
  11. package/dist/chunks/{chunk-3IAQUNQH.js → chunk-7FEWFNWG.js} +1 -1
  12. package/dist/chunks/{chunk-NGNOUPWS.js → chunk-7GU2GVQ7.js} +1 -1
  13. package/dist/chunks/{chunk-RKAUVPOQ.js → chunk-7HSQ4ULK.js} +1 -1
  14. package/dist/chunks/{chunk-EE3FVJLV.js → chunk-7V6DZO2T.js} +1 -1
  15. package/dist/chunks/{chunk-ADUYPK2G.js → chunk-AK5EV3WD.js} +1 -1
  16. package/dist/chunks/{chunk-XHOGOH6N.js → chunk-BMOWQEWL.js} +1 -1
  17. package/dist/chunks/{chunk-GTRGQIY2.js → chunk-DFE7LVAK.js} +1 -1
  18. package/dist/chunks/{chunk-7R5FEXZ5.js → chunk-EIXOJUNN.js} +1 -1
  19. package/dist/chunks/{chunk-AFPOIDM5.js → chunk-FANE2VO3.js} +1 -1
  20. package/dist/chunks/{chunk-CGOVWHI3.js → chunk-G4QF3M55.js} +1 -1
  21. package/dist/chunks/{chunk-NHTF332K.js → chunk-GYGIBRFB.js} +1 -1
  22. package/dist/chunks/{chunk-SGWVKRSR.js → chunk-IT3UX6V4.js} +1 -1
  23. package/dist/chunks/chunk-LSBEGBBX.js +9 -0
  24. package/dist/chunks/{chunk-VLZ47RWM.js → chunk-M67S3ZNJ.js} +2 -2
  25. package/dist/chunks/chunk-MPV7JL34.js +29 -0
  26. package/dist/chunks/{chunk-M2XARQBF.js → chunk-NB2UCUFL.js} +1 -1
  27. package/dist/chunks/{chunk-5QQNYN4N.js → chunk-O3QTFKP3.js} +1 -1
  28. package/dist/chunks/chunk-OAKO6LVS.js +7 -0
  29. package/dist/chunks/{chunk-OD6RZ3XZ.js → chunk-OTVTI2GM.js} +1 -1
  30. package/dist/chunks/chunk-PV5PBVER.js +7 -0
  31. package/dist/chunks/{chunk-HSJ6AHWG.js → chunk-PZPLBXHU.js} +1 -1
  32. package/dist/chunks/{chunk-MAVRGZQP.js → chunk-QGHN2WOY.js} +1 -1
  33. package/dist/chunks/{chunk-LDM3SQAU.js → chunk-R3RHRLGI.js} +1 -1
  34. package/dist/chunks/{chunk-AUGK2HIT.js → chunk-RN2EWPUH.js} +2 -2
  35. package/dist/chunks/{chunk-ENS6KX2F.js → chunk-RUJT2JBX.js} +1 -1
  36. package/dist/chunks/chunk-TEAQZXCV.js +9 -0
  37. package/dist/chunks/{chunk-TKBXN4H3.js → chunk-TGVB4DJ4.js} +2 -2
  38. package/dist/chunks/{chunk-WKZ6JSGZ.js → chunk-TKBORMUF.js} +1 -1
  39. package/dist/chunks/{chunk-D3EHMP4U.js → chunk-V4L6NUSW.js} +1 -1
  40. package/dist/chunks/{chunk-OK3S6KFX.js → chunk-V6GSMYQB.js} +2 -2
  41. package/dist/chunks/{chunk-562OXD3F.js → chunk-XK2BQUWV.js} +3 -3
  42. package/dist/chunks/{chunk-OKZDOANA.js → chunk-XZ2JXEXU.js} +1 -1
  43. package/dist/chunks/{chunk-2PPXY24N.js → chunk-YCCBAQIH.js} +2 -2
  44. package/dist/chunks/{chunk-CUAIEGNE.js → chunk-YCD5VEHQ.js} +1 -1
  45. package/dist/chunks/{chunk-HVUHCRZB.js → chunk-ZM2RFVTV.js} +1 -1
  46. package/dist/chunks/{clear-5NQAVWIF.js → clear-OJ6EDV3Q.js} +1 -1
  47. package/dist/chunks/{compile-vercel-config-6J2XUFRK.js → compile-vercel-config-HKMFYX2L.js} +1 -1
  48. package/dist/chunks/{config-CKYRXZXL.js → config-IVZNLEUK.js} +1 -1
  49. package/dist/chunks/{config-VNUY4RJ4.js → config-LULRZCTY.js} +1 -1
  50. package/dist/chunks/config-validator.mjs +1 -1
  51. package/dist/chunks/{constants-G4UYVLOF.js → constants-NCE2LWSS.js} +1 -1
  52. package/dist/chunks/{delete-HRJEO4MI.js → delete-DUHLA627.js} +1 -1
  53. package/dist/chunks/{delete-GTXXCSKQ.js → delete-HBL7TKZ5.js} +1 -1
  54. package/dist/chunks/{detect-services-GHILEGNU.js → detect-services-5GIRISUS.js} +1 -1
  55. package/dist/chunks/{disable-RWCRVG5O.js → disable-XTZ2FN2I.js} +1 -1
  56. package/dist/chunks/{discard-SHFIYCJU.js → discard-4IW37YWA.js} +1 -1
  57. package/dist/chunks/{edit-DMO3NSO2.js → edit-BBEW6J4Y.js} +1 -1
  58. package/dist/chunks/{edit-EVQI2RSS.js → edit-PUQ4NHNH.js} +1 -1
  59. package/dist/chunks/{enable-AWDU6STD.js → enable-4AIU4V44.js} +1 -1
  60. package/dist/chunks/{export-IQKTA4RS.js → export-NQ4SZHRW.js} +1 -1
  61. package/dist/chunks/{generate-cert-for-deploy-VKOWC4PZ.js → generate-cert-for-deploy-IGJNGQLD.js} +1 -1
  62. package/dist/chunks/{image-LDFYNOCA.js → image-PEDML4FR.js} +1 -1
  63. package/dist/chunks/{import-builders-P7CXSX2D.js → import-builders-UAMMKJAT.js} +1 -1
  64. package/dist/chunks/{inspect-53SGDDAH.js → inspect-DXFD47VC.js} +1 -1
  65. package/dist/chunks/{inspect-5INZDUQS.js → inspect-EEGSI64I.js} +1 -1
  66. package/dist/chunks/{inspect-WMT2M335.js → inspect-EZP7WID3.js} +1 -1
  67. package/dist/chunks/{inspect-3N47ODIH.js → inspect-TUXRUGES.js} +1 -1
  68. package/dist/chunks/{inspect-Y6BUCOUV.js → inspect-WY6ISJM6.js} +1 -1
  69. package/dist/chunks/{list-K5J7OULR.js → list-EQBJKUH7.js} +1 -1
  70. package/dist/chunks/{list-BIAPHKFM.js → list-JC24ACBV.js} +1 -1
  71. package/dist/chunks/{list-DMOCRRSE.js → list-QTYHA5QM.js} +1 -1
  72. package/dist/chunks/{login-SRVNHI4Y.js → login-WDMVEUBV.js} +1 -1
  73. package/dist/chunks/{logs-GK7CJBYY.js → logs-JWDSCEI5.js} +1 -1
  74. package/dist/chunks/{ls-AJWN5ZR4.js → ls-3VJGBK3L.js} +1 -1
  75. package/dist/chunks/{ls-UVKTHBTE.js → ls-3ZKP7ZPO.js} +1 -1
  76. package/dist/chunks/{ls-KGIE6HCO.js → ls-BAMHXX2I.js} +1 -1
  77. package/dist/chunks/{ls-WEG45IOC.js → ls-S6JZYPGH.js} +1 -1
  78. package/dist/chunks/ls-TYHGH2W4.js +11 -0
  79. package/dist/chunks/{ls-7ZX6DCJW.js → ls-YA2L3HO5.js} +1 -1
  80. package/dist/chunks/{ls-BFJWCRLZ.js → ls-YXJ4X57G.js} +1 -1
  81. package/dist/chunks/mutate-PE6TUYAM.js +9 -0
  82. package/dist/chunks/notifications-T3RUG34N.js +7 -0
  83. package/dist/chunks/{open-OEWPI5G6.js → open-BAWCRPNZ.js} +1 -1
  84. package/dist/chunks/{permissions-EPQBQFE3.js → permissions-4AXOWGE6.js} +1 -1
  85. package/dist/chunks/{publish-JG7MEPWT.js → publish-2XWTYLVS.js} +1 -1
  86. package/dist/chunks/{pull-MRKXG6TO.js → pull-KCOUWGVC.js} +1 -1
  87. package/dist/chunks/{purchase-domain-if-available-O5ARXEZ5.js → purchase-domain-if-available-BLEETOAR.js} +1 -1
  88. package/dist/chunks/{push-XOXJDFYO.js → push-HVT3DU7K.js} +1 -1
  89. package/dist/chunks/query-MJ7EBPCB.js +12 -0
  90. package/dist/chunks/{reorder-5DMRFDBY.js → reorder-2L5YJSXX.js} +1 -1
  91. package/dist/chunks/{reply-WSRNZWFD.js → reply-PPDMG3MF.js} +1 -1
  92. package/dist/chunks/{resolve-YJUXQVOZ.js → resolve-YJVUNKED.js} +1 -1
  93. package/dist/chunks/{restore-QT3DBGKU.js → restore-V6I26UDI.js} +1 -1
  94. package/dist/chunks/{rm-MVZFU6RG.js → rm-3NXDUNS4.js} +1 -1
  95. package/dist/chunks/{rm-WB2AIP3N.js → rm-43ZFE4U2.js} +1 -1
  96. package/dist/chunks/{rm-XRP6MRUT.js → rm-CD6UH446.js} +1 -1
  97. package/dist/chunks/{rm-PXR4J2US.js → rm-SQNLLMLK.js} +1 -1
  98. package/dist/chunks/{rm-MHPIUEZ5.js → rm-VUOBWXNR.js} +1 -1
  99. package/dist/chunks/{rule-inspect-TT3DRGCS.js → rule-inspect-D6NCXGFR.js} +1 -1
  100. package/dist/chunks/rules-CI4NIZTK.js +7 -0
  101. package/dist/chunks/schema-C2ZBFLA5.js +14 -0
  102. package/dist/chunks/{schema-KCNKVFT3.js → schema-GTOTPNEE.js} +1 -1
  103. package/dist/chunks/{set-7BANEWEL.js → set-5OG2JDEK.js} +1 -1
  104. package/dist/chunks/{setup-and-link-ZAV3EFGC.js → setup-and-link-KW27P3UH.js} +1 -1
  105. package/dist/chunks/{tags-VZR66NUC.js → tags-77GJR6ZK.js} +1 -1
  106. package/dist/chunks/{update-RBFNNSWE.js → update-5BEQ4XCV.js} +2 -2
  107. package/dist/chunks/utils-BG3TNJBX.js +86 -0
  108. package/dist/commands/build/index.js +1 -1
  109. package/dist/commands/deploy/index.js +3 -3
  110. package/dist/commands/dev/index.js +4 -4
  111. package/dist/commands/env/index.js +1 -1
  112. package/dist/commands/link/index.js +1 -1
  113. package/dist/commands/list/index.js +1 -1
  114. package/dist/commands-bulk.js +508 -492
  115. package/dist/index.js +1 -1
  116. package/dist/version.mjs +1 -1
  117. package/package.json +46 -46
  118. package/dist/chunks/chunk-BATE73HA.js +0 -9
  119. package/dist/chunks/chunk-EOCTK4EA.js +0 -7
  120. package/dist/chunks/chunk-FKCOBJFH.js +0 -7
  121. package/dist/chunks/chunk-G5FC5ZCO.js +0 -9
  122. package/dist/chunks/chunk-NWFHHUKZ.js +0 -7
  123. package/dist/chunks/query-AL7C6WV2.js +0 -12
  124. package/dist/chunks/rules-B5GW4KJH.js +0 -7
  125. package/dist/chunks/schema-JY5QTZOG.js +0 -14
  126. package/dist/chunks/utils-B5ZTMQKY.js +0 -58
@@ -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{isNativeBinaryInstall}from"./chunk-7T6TL3GQ.js";import{require_lib}from"./chunk-VLZ47RWM.js";import{packageName}from"./chunk-FI772UVH.js";import{require_build_utils}from"./chunk-XFVGX5HG.js";import{__toESM}from"./chunk-6L236MNA.js";var import_fs_extra=__toESM(require_lib(),1),import_build_utils=__toESM(require_build_utils(),1);import{sep,dirname,join,resolve}from"path";import{execFile}from"child_process";import{promisify}from"util";var nativePackageName="@vercel/vc-native",execFileAsync=promisify(execFile),globalRootQueries={npm:{args:["root","-g"],packageDir:(root,pkg)=>join(root,pkg)},pnpm:{args:["root","-g"],packageDir:(root,pkg)=>join(root,pkg)},yarn:{args:["global","dir"],packageDir:(root,pkg)=>join(root,"node_modules",pkg)}};async function getPackageManagerGlobalRoot(cliType){try{let{stdout}=await execFileAsync(cliType,globalRootQueries[cliType].args,{encoding:"utf8",windowsHide:!0});return stdout.trim()||null}catch{return null}}async function detectGlobalCliType(installPath,pkg){for(let cliType of Object.keys(globalRootQueries)){let root=await getPackageManagerGlobalRoot(cliType);if(!root)continue;let resolvedPackageDir;try{resolvedPackageDir=await(0,import_fs_extra.realpath)(globalRootQueries[cliType].packageDir(root,pkg))}catch{continue}if(installPath===resolvedPackageDir||installPath.startsWith(resolvedPackageDir+sep))return cliType}return null}async function getConfigPrefix(){let paths=[process.env.npm_config_userconfig||process.env.NPM_CONFIG_USERCONFIG,join(process.env.HOME||"/",".npmrc"),process.env.npm_config_globalconfig||process.env.NPM_CONFIG_GLOBALCONFIG].filter(Boolean);for(let configPath of paths){if(!configPath)continue;let content=await(0,import_fs_extra.readFile)(configPath).then(buffer=>buffer.toString()).catch(()=>null);if(content){let[prefix]=content.split(`
7
+ import{isNativeBinaryInstall}from"./chunk-7T6TL3GQ.js";import{require_lib}from"./chunk-M67S3ZNJ.js";import{packageName}from"./chunk-FI772UVH.js";import{require_build_utils}from"./chunk-XFVGX5HG.js";import{__toESM}from"./chunk-6L236MNA.js";var import_fs_extra=__toESM(require_lib(),1),import_build_utils=__toESM(require_build_utils(),1);import{sep,dirname,join,resolve}from"path";import{execFile}from"child_process";import{promisify}from"util";var nativePackageName="@vercel/vc-native",execFileAsync=promisify(execFile),globalRootQueries={npm:{args:["root","-g"],packageDir:(root,pkg)=>join(root,pkg)},pnpm:{args:["root","-g"],packageDir:(root,pkg)=>join(root,pkg)},yarn:{args:["global","dir"],packageDir:(root,pkg)=>join(root,"node_modules",pkg)}};async function getPackageManagerGlobalRoot(cliType){try{let{stdout}=await execFileAsync(cliType,globalRootQueries[cliType].args,{encoding:"utf8",windowsHide:!0});return stdout.trim()||null}catch{return null}}async function detectGlobalCliType(installPath,pkg){for(let cliType of Object.keys(globalRootQueries)){let root=await getPackageManagerGlobalRoot(cliType);if(!root)continue;let resolvedPackageDir;try{resolvedPackageDir=await(0,import_fs_extra.realpath)(globalRootQueries[cliType].packageDir(root,pkg))}catch{continue}if(installPath===resolvedPackageDir||installPath.startsWith(resolvedPackageDir+sep))return cliType}return null}async function getConfigPrefix(){let paths=[process.env.npm_config_userconfig||process.env.NPM_CONFIG_USERCONFIG,join(process.env.HOME||"/",".npmrc"),process.env.npm_config_globalconfig||process.env.NPM_CONFIG_GLOBALCONFIG].filter(Boolean);for(let configPath of paths){if(!configPath)continue;let content=await(0,import_fs_extra.readFile)(configPath).then(buffer=>buffer.toString()).catch(()=>null);if(content){let[prefix]=content.split(`
8
8
  `).map(line=>line&&line.trim()).filter(line=>line&&line.startsWith("prefix")).map(line=>line.slice(line.indexOf("=")+1).trim());if(prefix)return prefix}}return null}async function isPnpmHomeInstall(installPath){let pnpmHome=process.env.PNPM_HOME;if(!pnpmHome)return!1;let candidates=[pnpmHome];try{candidates.push(await(0,import_fs_extra.realpath)(pnpmHome))}catch{}let entrypoint=process.argv[1];for(let home of candidates){let prefix=home.endsWith(sep)?home:home+sep;if(entrypoint?.startsWith(prefix)||installPath.startsWith(prefix))return!0}return!1}function isGlobalByPath(installPath){return!!(dirname(process.argv[0])===dirname(process.argv[1])||installPath.includes(["","yarn","global","node_modules",""].join(sep))||installPath.includes(["","pnpm","global",""].join(sep))||installPath.includes(["","pnpm","store",""].join(sep))&&installPath.includes(sep+"links"+sep)||installPath.includes(["","fnm","node-versions",""].join(sep)))}async function isGlobalByPrefix(installPath){let defaultPath=process.platform==="win32"?process.env.APPDATA:"/usr/local/lib",prefixPath=process.env.PREFIX||process.env.npm_config_prefix||process.env.NPM_CONFIG_PREFIX||await getConfigPrefix()||defaultPath;if(!prefixPath)return!0;try{return installPath.startsWith(await(0,import_fs_extra.realpath)(prefixPath))}catch{return!0}}function asPackageManager(cliType){return cliType==="npm"||cliType==="pnpm"||cliType==="yarn"||cliType==="bun"||cliType==="vlt"?cliType:"npm"}async function resolveInstall(){let pkg=isNativeBinaryInstall()?nativePackageName:packageName,installPath=await(0,import_fs_extra.realpath)(resolve(__dirname));if(await isPnpmHomeInstall(installPath))return{packageManager:"pnpm",global:!0,assumed:!1};let globalCliType=await detectGlobalCliType(installPath,pkg);if(globalCliType)return{packageManager:globalCliType,global:!0,assumed:!1};let lockfileCliType;try{let entrypoint=await(0,import_fs_extra.realpath)(process.argv[1]),{cliType,lockfilePath}=await(0,import_build_utils.scanParentDirs)(dirname(dirname(entrypoint)));lockfilePath&&(lockfileCliType=cliType)}catch{}if(!lockfileCliType)return{packageManager:"npm",global:!0,assumed:!0};let packageManager=asPackageManager(lockfileCliType);return{packageManager,global:isGlobalByPath(installPath)||await isGlobalByPrefix(installPath),assumed:packageManager!==lockfileCliType}}async function isGlobal(){try{return(await resolveInstall()).global}catch{return!0}}async function getUpdateCommandInfo(){let nativeInstall=isNativeBinaryInstall(),pkgAndVersion=`${nativeInstall?nativePackageName:packageName}@latest`;if(nativeInstall){let segments=process.execPath.split(sep),packageManager2="npm";segments.includes("pnpm")||segments.includes(".pnpm")?packageManager2="pnpm":(segments.includes("yarn")||segments.includes(".yarn"))&&(packageManager2="yarn");let install2=packageManager2==="yarn"?"global add":"i -g",force=packageManager2==="npm"?" --force":"",allowBuild2=pnpmAllowBuildFlag(packageManager2,nativePackageName);return{command:`${packageManager2} ${install2} ${pkgAndVersion}${force}${allowBuild2}`,global:!0,packageManager:packageManager2,assumed:packageManager2==="npm"}}let{packageManager,global,assumed}=await resolveInstall(),yarn=packageManager==="yarn",install=yarn?"add":"i";global&&(install=yarn?"global add":"i -g");let allowBuild=global?pnpmAllowBuildFlag(packageManager,"esbuild"):"";return{command:`${packageManager} ${install} ${pkgAndVersion}${allowBuild}`,global,packageManager,assumed}}function pnpmAllowBuildFlag(cliType,pkg){return cliType==="pnpm"?` --allow-build=${pkg}`:""}async function getUpdateCommand(){return(await getUpdateCommandInfo()).command}export{isGlobal,getUpdateCommandInfo,getUpdateCommand};
@@ -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{require_dist,require_dist2}from"./chunk-7RMCBXBB.js";import{require_types}from"./chunk-GHM7V3GG.js";import{require_build_utils}from"./chunk-XFVGX5HG.js";import{__commonJS,__toESM}from"./chunk-6L236MNA.js";var require_dist3=__commonJS({"../../internals/service-topology/dist/index.js"(exports,module){"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),src_exports={};__export(src_exports,{INTERNAL_SERVICE_PREFIX:()=>import_fs_detectors2.INTERNAL_SERVICE_PREFIX,autoDetectServices:()=>import_fs_detectors2.autoDetectServices,detectServices:()=>import_fs_detectors2.detectServices,generateServiceRewrites:()=>import_fs_detectors2.generateServiceRewrites,generateServicesRoutes:()=>import_fs_detectors2.generateServicesRoutes,getInternalServiceCronPath:()=>import_fs_detectors2.getInternalServiceCronPath,getInternalServiceCronPathPrefix:()=>import_fs_detectors2.getInternalServiceCronPathPrefix,getInternalServiceFunctionPath:()=>import_fs_detectors2.getInternalServiceFunctionPath,getInternalServiceWorkerPath:()=>import_fs_detectors2.getInternalServiceWorkerPath,getInternalServiceWorkerPathPrefix:()=>import_fs_detectors2.getInternalServiceWorkerPathPrefix,isExperimentalService:()=>import_fs_detectors2.isExperimentalService,isExperimentalServiceV2:()=>import_fs_detectors2.isExperimentalServiceV2,isRouteOwningBuilder:()=>import_fs_detectors2.isRouteOwningBuilder,isStaticBuild:()=>import_fs_detectors2.isStaticBuild,resolveAllConfiguredServicesV2:()=>import_fs_detectors2.resolveAllConfiguredServicesV2,resolveConfiguredServiceV2:()=>import_fs_detectors2.resolveConfiguredServiceV2,validateServiceConfigV2:()=>import_fs_detectors2.validateServiceConfigV2});module.exports=__toCommonJS(src_exports);var import_fs_detectors2=require_dist2()}});var import_routing_utils=__toESM(require_dist(),1),import_build_utils=__toESM(require_build_utils(),1),import_types=__toESM(require_types(),1),import_fs_detectors=__toESM(require_dist2(),1);import{getConfigValidator}from"./config-validator.mjs";var imagesSchema={type:"object",additionalProperties:!1,required:["sizes"],properties:{contentDispositionType:{enum:["inline","attachment"]},contentSecurityPolicy:{type:"string",minLength:1,maxLength:256},dangerouslyAllowSVG:{type:"boolean"},domains:{type:"array",minItems:0,maxItems:50,items:{type:"string",minLength:1,maxLength:256}},formats:{type:"array",minItems:1,maxItems:4,items:{enum:["image/avif","image/webp","image/jpeg","image/png"]}},localPatterns:{type:"array",minItems:0,maxItems:25,items:{type:"object",additionalProperties:!1,properties:{pathname:{type:"string",minLength:1,maxLength:256},search:{type:"string",minLength:0,maxLength:256}}}},minimumCacheTTL:{type:"integer",minimum:1,maximum:31536e4},qualities:{type:"array",minItems:1,maxItems:20,items:{type:"integer",minimum:1,maximum:100}},remotePatterns:{type:"array",minItems:0,maxItems:50,items:{type:"object",additionalProperties:!1,required:["hostname"],properties:{protocol:{enum:["http","https"]},hostname:{type:"string",minLength:1,maxLength:256},port:{type:"string",minLength:0,maxLength:5},pathname:{type:"string",minLength:1,maxLength:256},search:{type:"string",minLength:0,maxLength:256}}}},sizes:{type:"array",minItems:1,maxItems:50,items:{type:"number"}}}},cronsSchema={type:"array",minItems:0,items:{type:"object",additionalProperties:!1,required:["path","schedule"],properties:{path:{type:"string",minLength:1,maxLength:512,pattern:"^/.*"},schedule:{type:"string",minLength:9,maxLength:256}}}},schedulesSchema={type:"array",minItems:0,maxItems:100,items:{type:"object",additionalProperties:!1,required:["expression","target","name"],properties:{expression:{type:"object",additionalProperties:!1,required:["cron"],properties:{cron:{type:"string"},jitter:{type:"integer",minimum:1,maximum:15}}},target:{oneOf:[{type:"object",additionalProperties:!1,required:["function"],properties:{function:{type:"string",minLength:1}}},{type:"object",additionalProperties:!1,required:["topic"],properties:{topic:{type:"string",minLength:1,maxLength:256}}}]},name:{type:"string",minLength:1,maxLength:256},timezone:{type:"string",minLength:1,maxLength:50,description:"IANA timezone for cron evaluation. Defaults to UTC."},payload:{}}}},experimentalServicesMountSchema={oneOf:[{type:"string",minLength:1,maxLength:512},{type:"object",additionalProperties:!1,properties:{path:{type:"string",minLength:1,maxLength:512},subdomain:{type:"string",minLength:1,maxLength:63}},anyOf:[{required:["path"]},{required:["subdomain"]}]}]},staticExperimentalServiceScheduleSchema={type:"string",minLength:9,maxLength:256,not:{const:"<dynamic>"}},experimentalServiceScheduleSchema={oneOf:[{type:"string",minLength:9,maxLength:256},{type:"array",minItems:1,items:staticExperimentalServiceScheduleSchema}]},experimentalServiceQueueTopicSchema={type:"object",additionalProperties:!1,required:["topic"],properties:{topic:{type:"string",minLength:1,maxLength:256},retryAfterSeconds:{type:"integer",minimum:1,maximum:86400},initialDelaySeconds:{type:"integer",minimum:0,maximum:86400}}},experimentalServiceTopicsSchema={oneOf:[{type:"array",minItems:1,items:{type:"string",minLength:1,maxLength:256}},{type:"array",minItems:1,items:experimentalServiceQueueTopicSchema}]},envVarNamesSchema={pattern:"^[A-Za-z_][A-Za-z0-9_]*$",maxLength:256},getExperimentalServicesCommonProperties=()=>({entrypoint:{type:"string",minLength:1,maxLength:512},root:{type:"string",minLength:1,maxLength:512},workspace:{type:"string",minLength:1,maxLength:512},framework:{type:"string",minLength:1,maxLength:256},builder:{type:"string",minLength:1,maxLength:256},runtime:{type:"string",minLength:1,maxLength:256},buildCommand:{type:"string",minLength:1,maxLength:2048},installCommand:{type:"string",minLength:1,maxLength:2048},preDeployCommand:{type:"string",minLength:1,maxLength:2048},command:{oneOf:[{type:"string",minLength:1,maxLength:2048},{type:"array",minItems:1,items:{type:"string",minLength:1,maxLength:2048}}]},memory:{type:"integer",minimum:128,maximum:10240},maxDuration:(0,import_build_utils.getMaxDurationSchema)(),includeFiles:{oneOf:[{type:"string",minLength:1},{type:"array",items:{type:"string",minLength:1}}]},excludeFiles:{oneOf:[{type:"string",minLength:1},{type:"array",items:{type:"string",minLength:1}}]}}),experimentalServicesRoutableProperties={mount:experimentalServicesMountSchema,routePrefix:{type:"string",minLength:1,maxLength:512},subdomain:{type:"string",minLength:1,maxLength:63}},getExperimentalServicesServiceConfigSchema=()=>({oneOf:[{type:"object",additionalProperties:!1,properties:{...getExperimentalServicesCommonProperties(),...experimentalServicesRoutableProperties,type:{enum:["web"]}}},{type:"object",additionalProperties:!1,required:["type","trigger","schedule"],properties:{...getExperimentalServicesCommonProperties(),type:{const:"job"},trigger:{const:"schedule"},schedule:experimentalServiceScheduleSchema}},{type:"object",additionalProperties:!1,required:["type","trigger","topics"],properties:{...getExperimentalServicesCommonProperties(),type:{const:"job"},trigger:{const:"queue"},topics:experimentalServiceTopicsSchema,consumer:{type:"string",minLength:1,maxLength:256}}},{type:"object",additionalProperties:!1,required:["type","trigger","entrypoint"],properties:{...getExperimentalServicesCommonProperties(),type:{const:"job"},trigger:{const:"workflow"}}},{type:"object",additionalProperties:!1,required:["type"],properties:{...getExperimentalServicesCommonProperties(),type:{const:"worker"},topics:{type:"array",items:{type:"string",minLength:1,maxLength:256},minItems:1},consumer:{type:"string",minLength:1,maxLength:256}}},{type:"object",additionalProperties:!1,required:["type","schedule"],properties:{...getExperimentalServicesCommonProperties(),type:{const:"cron"},schedule:experimentalServiceScheduleSchema}}]}),getExperimentalServicesSchema=()=>({type:"object",propertyNames:{pattern:"^[a-zA-Z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$",maxLength:64},additionalProperties:getExperimentalServicesServiceConfigSchema()}),experimentalServiceGroupsSchema={type:"object",propertyNames:{pattern:"^[a-zA-Z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$",maxLength:64},additionalProperties:{type:"array",items:{type:"string",minLength:1,maxLength:256}}},servicesPathSchema={type:"string",minLength:1,maxLength:512},servicesCommandSchema={type:"string",minLength:1,maxLength:2048},servicesServiceNamePattern="^[a-z]([a-z_-]*[a-z])?$",servicesBindingSchema={type:"object",additionalProperties:!1,required:["service","format","env"],properties:{type:{description:"Optional binding type marker. Currently the only supported type is `service`. When present this must be `service`.",const:"service"},service:{type:"string",minLength:1,maxLength:64,pattern:servicesServiceNamePattern},format:{const:"url"},env:{type:"string",...envVarNamesSchema}}},servicesBindingsSchema={type:"array",maxItems:100,items:servicesBindingSchema},getServicesServiceConfigSchema=()=>({type:"object",additionalProperties:!1,required:["root"],properties:{root:servicesPathSchema,framework:{type:"string",minLength:1,maxLength:256},runtime:{type:"string",minLength:1,maxLength:256},entrypoint:servicesPathSchema,command:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},installCommand:servicesCommandSchema,buildCommand:servicesCommandSchema,devCommand:servicesCommandSchema,ignoreCommand:servicesCommandSchema,outputDirectory:servicesPathSchema,bindings:servicesBindingsSchema,functions:(0,import_build_utils.getFunctionsSchema)(),headers:import_routing_utils.headersSchema,redirects:import_routing_utils.redirectsSchema,rewrites:import_routing_utils.rewritesSchema,routes:import_routing_utils.routesSchema,cleanUrls:import_routing_utils.cleanUrlsSchema,trailingSlash:import_routing_utils.trailingSlashSchema}}),getServicesSchema=()=>({type:"object",propertyNames:{pattern:servicesServiceNamePattern,maxLength:64},additionalProperties:getServicesServiceConfigSchema()}),proxySchema={type:"object",additionalProperties:!1,required:["entrypoint"],properties:{entrypoint:{type:"string",minLength:1},matcher:{oneOf:[{type:"string",minLength:1},{type:"array",minItems:1,items:{type:"string",minLength:1}}]}}};function buildVercelConfigSchema(){return{type:"object",additionalProperties:!0,properties:{builds:import_build_utils.buildsSchema,routes:import_routing_utils.routesSchema,cleanUrls:import_routing_utils.cleanUrlsSchema,headers:import_routing_utils.headersSchema,redirects:import_routing_utils.redirectsSchema,rewrites:import_routing_utils.rewritesSchema,trailingSlash:import_routing_utils.trailingSlashSchema,functions:(0,import_build_utils.getFunctionsSchema)(),images:imagesSchema,crons:cronsSchema,schedules:schedulesSchema,bunVersion:{type:"string"},proxy:proxySchema,experimentalServices:getExperimentalServicesSchema(),experimentalServiceGroups:experimentalServiceGroupsSchema,services:getServicesSchema(),experimentalServicesV2:getServicesSchema()}}}function validateConfig(config){let validate=getConfigValidator(buildVercelConfigSchema);if(!validate(config)&&validate.errors&&validate.errors[0]){let error=validate.errors[0],fileName=config[import_types.fileNameSymbol]||"vercel.json",niceError=(0,import_build_utils.getPrettyError)(error);return niceError.message=`Invalid ${fileName} - ${niceError.message}`,niceError}for(let[index,schedule]of(config.schedules??[]).entries())if(schedule.timezone!==void 0)try{if(!/^[A-Za-z][A-Za-z0-9_+/-]*$/.test(schedule.timezone))throw new RangeError("Expected a named timezone");new Intl.DateTimeFormat("en-US",{timeZone:schedule.timezone})}catch{return new import_build_utils.NowBuildError({code:"INVALID_SCHEDULE_TIMEZONE",message:`Invalid ${config[import_types.fileNameSymbol]||"vercel.json"} - \`schedules[${index}].timezone\` must be a valid IANA timezone, such as "America/New_York". Omit it to use UTC.`})}for(let[pattern,fn]of Object.entries(config.functions??{}))if(fn.affinity!==void 0)return new import_build_utils.NowBuildError({code:"FUNCTION_AFFINITY_REQUIRES_SERVICE",message:`Function affinity can only be configured under a service. Move functions[${JSON.stringify(pattern)}].affinity into the relevant service's functions configuration.`,link:"https://vercel.com/docs/concepts/projects/project-configuration#functions"});let functionMaps=[config.functions,...Object.values(config.services??{}).map(service=>service.functions),...Object.values(config.experimentalServicesV2??{}).map(service=>service.functions)];for(let functions of functionMaps)for(let[pattern,fn]of Object.entries(functions??{})){let regions=[...new Set(fn.regions)];if(fn.affinity?.mode==="strict"&&(regions.includes("all")||regions.length>1))return new import_build_utils.NowBuildError({code:"INVALID_FUNCTION_AFFINITY_REGIONS",message:`Function affinity mode "strict" requires at most one statically configured region. Update \`functions[${JSON.stringify(pattern)}].regions\` to contain a single region.`,link:"https://vercel.com/docs/concepts/projects/project-configuration#functions"})}if(config.proxy){let proxyError=(0,import_fs_detectors.validateProxyConfig)(config.proxy);if(proxyError)return new import_build_utils.NowBuildError({code:proxyError.code.toUpperCase(),message:proxyError.message})}if(config.functions&&config.builds)return new import_build_utils.NowBuildError({code:"FUNCTIONS_AND_BUILDS",message:"The `functions` property cannot be used in conjunction with the `builds` property. Please remove one of them.",link:"https://vercel.link/functions-and-builds"});if(config.proxy&&config.builds)return new import_build_utils.NowBuildError({code:"PROXY_AND_BUILDS",message:"The `proxy` property cannot be used with the `builds` property. Remove `builds` to use an explicit proxy entrypoint."});let hasExperimentalServices=!!config.experimentalServices;if(hasExperimentalServices&&config.builds)return new import_build_utils.NowBuildError({code:"EXPERIMENTAL_SERVICES_AND_BUILDS",message:"The `experimentalServices` property cannot be used in conjunction with the `builds` property. Please remove one of them."});if(hasExperimentalServices&&config.functions)return new import_build_utils.NowBuildError({code:"EXPERIMENTAL_SERVICES_AND_FUNCTIONS",message:"The `experimentalServices` property cannot be used in conjunction with the `functions` property. Please remove one of them."});if(config.experimentalServiceGroups&&!config.experimentalServices)return new import_build_utils.NowBuildError({code:"SERVICE_GROUPS_WITHOUT_SERVICES",message:"The `experimentalServiceGroups` property requires `experimentalServices` to be defined. Service groups reference services by name."});let hasServices=config.services!=null,hasExperimentalServicesV2=config.experimentalServicesV2!=null;if(hasServices&&hasExperimentalServicesV2)return new import_build_utils.NowBuildError({code:"SERVICES_AND_EXPERIMENTAL_SERVICES_V2",message:"The `services` property cannot be used in conjunction with its deprecated alias `experimentalServicesV2`. Please use only `services`."});let servicesConfig=config.services??config.experimentalServicesV2,servicesConfigKey=hasServices?"services":"experimentalServicesV2",servicesErrorCodePrefix=hasServices?"SERVICES":"EXPERIMENTAL_SERVICES_V2";if(servicesConfig&&hasExperimentalServices)return new import_build_utils.NowBuildError({code:`${servicesErrorCodePrefix}_AND_EXPERIMENTAL_SERVICES`,message:`The \`${servicesConfigKey}\` property cannot be used in conjunction with the \`experimentalServices\` property. Please use only one services configuration.`});if(servicesConfig&&config.builds)return new import_build_utils.NowBuildError({code:`${servicesErrorCodePrefix}_AND_BUILDS`,message:`The \`${servicesConfigKey}\` property cannot be used in conjunction with the \`builds\` property. Please remove one of them.`});if(servicesConfig){let ambiguousTopLevel=[];if(config.functions!=null&&ambiguousTopLevel.push("functions"),config.installCommand!=null&&ambiguousTopLevel.push("installCommand"),config.buildCommand!=null&&ambiguousTopLevel.push("buildCommand"),config.devCommand!=null&&ambiguousTopLevel.push("devCommand"),config.ignoreCommand!=null&&ambiguousTopLevel.push("ignoreCommand"),config.outputDirectory!=null&&ambiguousTopLevel.push("outputDirectory"),config.framework!=null&&ambiguousTopLevel.push("framework"),ambiguousTopLevel.length>0){let count=ambiguousTopLevel.length,fields=ambiguousTopLevel.map(field=>`\`${field}\``).join(", ");return new import_build_utils.NowBuildError({code:`${servicesErrorCodePrefix}_AND_TOP_LEVEL_BUILD_SETTINGS`,message:`The top-level ${count>1?"properties":"property"} ${fields} cannot be used with \`${servicesConfigKey}\` because the owning service is ambiguous. Move ${count>1?"them":"it"} under the relevant service in \`${servicesConfigKey}\`.`})}}if(servicesConfig){let serviceNames=new Set(Object.keys(servicesConfig));for(let[serviceName,serviceConfig]of Object.entries(servicesConfig))for(let binding of serviceConfig.bindings??[])if(!serviceNames.has(binding.service))return new import_build_utils.NowBuildError({code:`${servicesErrorCodePrefix}_BINDING_UNKNOWN_SERVICE`,message:`Service "${serviceName}" declares a binding to unknown service "${binding.service}". Add "${binding.service}" to \`${servicesConfigKey}\` or fix the binding.`})}return null}export{require_dist3 as require_dist,validateConfig};
@@ -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,validateConfig}from"./chunk-EOCTK4EA.js";import{require_dist2 as require_dist}from"./chunk-7RMCBXBB.js";import{readJSONFile}from"./chunk-JIYY3B4C.js";import{compileVercelConfig}from"./chunk-KNEWCUWF.js";import{CantParseJSONFile}from"./chunk-R2TGGVCT.js";import{require_build_utils}from"./chunk-XFVGX5HG.js";import{__toESM}from"./chunk-6L236MNA.js";var import_fs_detectors=__toESM(require_dist(),1),import_service_topology=__toESM(require_dist2(),1);import{readFile,writeFile}from"fs/promises";import{basename,join as join2}from"path";import{parse as tomlParse,stringify as tomlStringify}from"smol-toml";var import_build_utils=__toESM(require_build_utils(),1);import{join}from"path";function createDetectEntrypoint(projectRoot){return async({workPath,framework})=>{let absWorkPath=(0,import_build_utils.normalizePath)(join(projectRoot,workPath)),builderName;if((0,import_build_utils.isPythonFramework)(framework))builderName="@vercel/python";else if((0,import_build_utils.isNodeBackendFramework)(framework))builderName="@vercel/backends";else if(framework==="go")builderName="@vercel/go";else if(framework==="rust")builderName="@vercel/rust";else return null;let detectEntrypoint=await loadBuilderDetectEntrypoint(builderName,projectRoot);return detectEntrypoint?detectEntrypoint(builderName==="@vercel/python"?{workPath:absWorkPath,framework}:{workPath:absWorkPath}):null}}async function loadBuilderDetectEntrypoint(name,projectRoot){let{importBuilders}=await import("./import-builders-P7CXSX2D.js"),loaded=(await importBuilders(new Set([name]),projectRoot)).get(name);if(!loaded)return;let detect=loaded.builder.detectEntrypoint;return typeof detect=="function"?detect:void 0}function getServicesConfiguration(config){let configuredServices=config?.services??config?.experimentalServicesV2??config?.experimentalServices,configuredServicesType=config?.services?"services":config?.experimentalServicesV2?"experimentalServicesV2":config?.experimentalServices?"experimentalServices":void 0;return{configuredServices,configuredServicesType}}async function loadVercelConfig(cwd){try{let{configPath}=await compileVercelConfig(cwd);if(!configPath)return null;let config=await readJSONFile(configPath);return config instanceof Error?null:config}catch{return null}}function isServicesEnvEnabled(){let value=process.env.VERCEL_USE_EXPERIMENTAL_SERVICES;return value==="1"||value?.toLowerCase()==="true"}async function isExperimentalServicesEnabled(cwd){let{configuredServices}=getServicesConfiguration(await loadVercelConfig(cwd));return isServicesEnvEnabled()||configuredServices!==void 0}async function tryDetectServices(cwd,config){config===void 0&&(config=await loadVercelConfig(cwd));let configuration=getServicesConfiguration(config);if(!isServicesEnvEnabled()&&!configuration.configuredServices)return null;let fs=new import_fs_detectors.LocalFileSystemDetector(cwd),result=await(0,import_service_topology.detectServices)({fs,configuredServices:configuration.configuredServices,configuredServicesType:configuration.configuredServicesType,detectEntrypoint:createDetectEntrypoint(cwd)});return result.errors.some(e=>e.code==="NO_SERVICES_CONFIGURED")?null:result}async function writeServicesConfig(cwd,config){let prepared=await prepareServicesConfigWrite(cwd,config);return await writeFile(prepared.configPath,prepared.content,"utf8"),{configFileName:basename(prepared.configPath)}}async function getServicesConfigWriteBlocker(cwd,config){try{return await prepareServicesConfigWrite(cwd,config),null}catch(error){return getServicesConfigWriteBlockerFromError(error)}}function toProjectServicesConfigPatch(config){let services={};for(let[name,svc]of Object.entries(config)){let buildCommand=svc.preDeployCommand&&svc.buildCommand?`${svc.buildCommand} && ${svc.preDeployCommand}`:svc.preDeployCommand||svc.buildCommand;services[name]={root:svc.root,...svc.framework?{framework:svc.framework}:{},...svc.entrypoint?{entrypoint:svc.entrypoint}:{},...buildCommand?{buildCommand}:{}}}let rewrites=(0,import_service_topology.generateServiceRewrites)(config);return{services,...rewrites.length>0?{rewrites}:{}}}async function prepareServicesConfigWrite(cwd,config){let compileResult=await compileVercelConfig(cwd),configPath=join2(cwd,"vercel.json");if(compileResult.sourceFile==="vercel.toml")return prepareTomlServicesConfigWrite(join2(cwd,"vercel.toml"),config);if(compileResult.wasCompiled)throw new Error(`Cannot automatically update ${compileResult.sourceFile??"the current Vercel config"}.`);let existingConfig={};if(compileResult.configPath&&basename(compileResult.configPath)==="vercel.json"){let result=await readJSONFile(configPath);if(result instanceof CantParseJSONFile)throw result;existingConfig=result??{}}let patch=toProjectServicesConfigPatch(config),nextConfig={...existingConfig,...patch,...patch.rewrites?{rewrites:[...existingConfig.rewrites??[],...patch.rewrites]}:{}},validationError=validateConfig(nextConfig);if(validationError)throw validationError;return{configPath,content:JSON.stringify(nextConfig,null,2)+`
7
+ import{require_dist as require_dist2,validateConfig}from"./chunk-PV5PBVER.js";import{require_dist2 as require_dist}from"./chunk-7RMCBXBB.js";import{readJSONFile}from"./chunk-6NVGLVCH.js";import{compileVercelConfig}from"./chunk-4XH66IEQ.js";import{CantParseJSONFile}from"./chunk-R2TGGVCT.js";import{require_build_utils}from"./chunk-XFVGX5HG.js";import{__toESM}from"./chunk-6L236MNA.js";var import_fs_detectors=__toESM(require_dist(),1),import_service_topology=__toESM(require_dist2(),1);import{readFile,writeFile}from"fs/promises";import{basename,join as join2}from"path";import{parse as tomlParse,stringify as tomlStringify}from"smol-toml";var import_build_utils=__toESM(require_build_utils(),1);import{join}from"path";function createDetectEntrypoint(projectRoot){return async({workPath,framework})=>{let absWorkPath=(0,import_build_utils.normalizePath)(join(projectRoot,workPath)),builderName;if((0,import_build_utils.isPythonFramework)(framework))builderName="@vercel/python";else if((0,import_build_utils.isNodeBackendFramework)(framework))builderName="@vercel/backends";else if(framework==="go")builderName="@vercel/go";else if(framework==="rust")builderName="@vercel/rust";else return null;let detectEntrypoint=await loadBuilderDetectEntrypoint(builderName,projectRoot);return detectEntrypoint?detectEntrypoint(builderName==="@vercel/python"?{workPath:absWorkPath,framework}:{workPath:absWorkPath}):null}}async function loadBuilderDetectEntrypoint(name,projectRoot){let{importBuilders}=await import("./import-builders-UAMMKJAT.js"),loaded=(await importBuilders(new Set([name]),projectRoot)).get(name);if(!loaded)return;let detect=loaded.builder.detectEntrypoint;return typeof detect=="function"?detect:void 0}function getServicesConfiguration(config){let configuredServices=config?.services??config?.experimentalServicesV2??config?.experimentalServices,configuredServicesType=config?.services?"services":config?.experimentalServicesV2?"experimentalServicesV2":config?.experimentalServices?"experimentalServices":void 0;return{configuredServices,configuredServicesType}}async function loadVercelConfig(cwd){try{let{configPath}=await compileVercelConfig(cwd);if(!configPath)return null;let config=await readJSONFile(configPath);return config instanceof Error?null:config}catch{return null}}function isServicesEnvEnabled(){let value=process.env.VERCEL_USE_EXPERIMENTAL_SERVICES;return value==="1"||value?.toLowerCase()==="true"}async function isExperimentalServicesEnabled(cwd){let{configuredServices}=getServicesConfiguration(await loadVercelConfig(cwd));return isServicesEnvEnabled()||configuredServices!==void 0}async function tryDetectServices(cwd,config){config===void 0&&(config=await loadVercelConfig(cwd));let configuration=getServicesConfiguration(config);if(!isServicesEnvEnabled()&&!configuration.configuredServices)return null;let fs=new import_fs_detectors.LocalFileSystemDetector(cwd),result=await(0,import_service_topology.detectServices)({fs,configuredServices:configuration.configuredServices,configuredServicesType:configuration.configuredServicesType,detectEntrypoint:createDetectEntrypoint(cwd)});return result.errors.some(e=>e.code==="NO_SERVICES_CONFIGURED")?null:result}async function writeServicesConfig(cwd,config){let prepared=await prepareServicesConfigWrite(cwd,config);return await writeFile(prepared.configPath,prepared.content,"utf8"),{configFileName:basename(prepared.configPath)}}async function getServicesConfigWriteBlocker(cwd,config){try{return await prepareServicesConfigWrite(cwd,config),null}catch(error){return getServicesConfigWriteBlockerFromError(error)}}function toProjectServicesConfigPatch(config){let services={};for(let[name,svc]of Object.entries(config)){let buildCommand=svc.preDeployCommand&&svc.buildCommand?`${svc.buildCommand} && ${svc.preDeployCommand}`:svc.preDeployCommand||svc.buildCommand;services[name]={root:svc.root,...svc.framework?{framework:svc.framework}:{},...svc.entrypoint?{entrypoint:svc.entrypoint}:{},...buildCommand?{buildCommand}:{}}}let rewrites=(0,import_service_topology.generateServiceRewrites)(config);return{services,...rewrites.length>0?{rewrites}:{}}}async function prepareServicesConfigWrite(cwd,config){let compileResult=await compileVercelConfig(cwd),configPath=join2(cwd,"vercel.json");if(compileResult.sourceFile==="vercel.toml")return prepareTomlServicesConfigWrite(join2(cwd,"vercel.toml"),config);if(compileResult.wasCompiled)throw new Error(`Cannot automatically update ${compileResult.sourceFile??"the current Vercel config"}.`);let existingConfig={};if(compileResult.configPath&&basename(compileResult.configPath)==="vercel.json"){let result=await readJSONFile(configPath);if(result instanceof CantParseJSONFile)throw result;existingConfig=result??{}}let patch=toProjectServicesConfigPatch(config),nextConfig={...existingConfig,...patch,...patch.rewrites?{rewrites:[...existingConfig.rewrites??[],...patch.rewrites]}:{}},validationError=validateConfig(nextConfig);if(validationError)throw validationError;return{configPath,content:JSON.stringify(nextConfig,null,2)+`
8
8
  `}}async function prepareTomlServicesConfigWrite(configPath,config){let patch=toProjectServicesConfigPatch(config),patchKeys=Object.keys(patch),existingContent;try{existingContent=await readFile(configPath,"utf8")}catch{existingContent=""}if(existingContent.trim()){let existingParsed=tomlParse(existingContent),overlapping=patchKeys.filter(key=>key in existingParsed);if(overlapping.length>0){let plural=overlapping.length>1,keyList=overlapping.map(k=>`"${k}"`).join(", ");throw new Error(`Cannot automatically update vercel.toml: key${plural?"s":""} ${keyList} already exist${plural?"":"s"}.`)}}let patchToml=tomlStringify(patch),content=existingContent.trim()?existingContent.trimEnd()+`
9
9
 
10
10
  `+patchToml+`