vercel 62.5.0 → 62.7.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.
- package/README.md +2 -0
- package/dist/chunks/{add-SUDX7R63.js → add-OXHI3PVM.js} +1 -1
- package/dist/chunks/{add-UNQJB3SM.js → add-P3FNSVMN.js} +1 -1
- package/dist/chunks/{add-HN4OXQLM.js → add-WUT6QU2J.js} +1 -1
- package/dist/chunks/{build-BRMOQZHW.js → build-J6VW3KHT.js} +1 -1
- package/dist/chunks/{chunk-B3MYIRFE.js → chunk-2KSNNB4B.js} +1 -1
- package/dist/chunks/{chunk-QMTPSHRV.js → chunk-3XLK5ZPD.js} +5 -5
- package/dist/chunks/{chunk-TEYG3UZQ.js → chunk-3ZMD36SU.js} +1 -1
- package/dist/chunks/{chunk-TG6SMD7D.js → chunk-46UCIIJN.js} +1 -1
- package/dist/chunks/{chunk-XMV7OSFJ.js → chunk-4H5LPD3T.js} +1 -1
- package/dist/chunks/{chunk-PQV3QNDG.js → chunk-4KQBTIMZ.js} +1 -1
- package/dist/chunks/{chunk-QCOPZAUC.js → chunk-4QSVBLAS.js} +1 -1
- package/dist/chunks/{chunk-WNG72BRT.js → chunk-5AXNGQJC.js} +1 -1
- package/dist/chunks/{chunk-DOWDSQPG.js → chunk-5JN3FWV2.js} +1 -1
- package/dist/chunks/{chunk-PY6YO4MR.js → chunk-5M45EBVX.js} +2 -2
- package/dist/chunks/{chunk-X7F3567X.js → chunk-5ZQF5WIO.js} +1 -1
- package/dist/chunks/{chunk-6LOW7CGD.js → chunk-6DJ6PMEK.js} +1 -1
- package/dist/chunks/{chunk-NDZOUAFO.js → chunk-6EW4BCMR.js} +1 -1
- package/dist/chunks/{chunk-RHUAFRZX.js → chunk-A73N3QKT.js} +1 -1
- package/dist/chunks/{chunk-CAAD55US.js → chunk-AEEEEOYS.js} +1 -1
- package/dist/chunks/chunk-APSIFBD4.js +7 -0
- package/dist/chunks/{chunk-MCOJUSDV.js → chunk-B2L2QTXT.js} +1 -1
- package/dist/chunks/{chunk-ZXDS7NJI.js → chunk-BHBNTQRT.js} +1 -1
- package/dist/chunks/{chunk-OYWYHFXV.js → chunk-CF2PIWRO.js} +1 -1
- package/dist/chunks/{chunk-733ZK37Y.js → chunk-CR2ZQBDU.js} +1 -1
- package/dist/chunks/{chunk-5CSWEE7J.js → chunk-CRITS7IX.js} +1 -1
- package/dist/chunks/{chunk-4BRFG5HP.js → chunk-DGH5CD6D.js} +1 -1
- package/dist/chunks/{chunk-PD3ZD52Q.js → chunk-ECMWDZTJ.js} +4 -4
- package/dist/chunks/{chunk-AMSFO2VK.js → chunk-EQ24OC5G.js} +1 -1
- package/dist/chunks/{chunk-D6JBONML.js → chunk-FAJB3JV5.js} +1 -1
- package/dist/chunks/chunk-FB3U3RAM.js +9 -0
- package/dist/chunks/{chunk-72YTT324.js → chunk-FEEG5UU2.js} +1 -1
- package/dist/chunks/{chunk-5NSYN7IO.js → chunk-FQJCWZ4C.js} +1 -1
- package/dist/chunks/{chunk-LGFCHU75.js → chunk-GMTLVRN7.js} +1 -1
- package/dist/chunks/{chunk-UXAYYF6I.js → chunk-GUTZ45DE.js} +1 -1
- package/dist/chunks/{chunk-5QVOIOPN.js → chunk-I5JR7PIO.js} +1 -1
- package/dist/chunks/{chunk-ST2X5QRA.js → chunk-IEKUTNKT.js} +1 -1
- package/dist/chunks/{chunk-L57FNGBV.js → chunk-K2RQEX7N.js} +1 -1
- package/dist/chunks/{chunk-O552UV4H.js → chunk-KXMVFT2K.js} +1 -1
- package/dist/chunks/{chunk-ZX2JOGOA.js → chunk-LCH3SUJ7.js} +1 -1
- package/dist/chunks/{chunk-HVJERSGE.js → chunk-LWQVT6YW.js} +1 -1
- package/dist/chunks/chunk-LXNMVWYO.js +9 -0
- package/dist/chunks/{chunk-MQW6DKD2.js → chunk-LYKPLTZ7.js} +1 -1
- package/dist/chunks/chunk-M3HO5CTQ.js +7 -0
- package/dist/chunks/{chunk-WJZV7BI4.js → chunk-M4IVLSNQ.js} +1 -1
- package/dist/chunks/{chunk-ILR6YA2A.js → chunk-M5NWE7EO.js} +1 -1
- package/dist/chunks/{chunk-3J2P52OU.js → chunk-MCBO6LL7.js} +2 -2
- package/dist/chunks/{chunk-2FQCZE6S.js → chunk-MIG67KZ2.js} +1 -1
- package/dist/chunks/{chunk-4WS3D23J.js → chunk-NM67DIPQ.js} +1 -1
- package/dist/chunks/{chunk-W6M24BQ4.js → chunk-NYFB3EYC.js} +1 -1
- package/dist/chunks/chunk-O3UY73UQ.js +7 -0
- package/dist/chunks/chunk-ONPJXQQ6.js +10 -0
- package/dist/chunks/chunk-ORJGSUQT.js +9 -0
- package/dist/chunks/{chunk-HRQQ2N5B.js → chunk-PE7QZUY7.js} +1 -1
- package/dist/chunks/{chunk-MR423MWE.js → chunk-Q2YQSMIB.js} +6 -6
- package/dist/chunks/{chunk-C7SLCL3Z.js → chunk-Q7AYTXUR.js} +1 -1
- package/dist/chunks/{chunk-EPBZNTIJ.js → chunk-QZ2G3AMY.js} +1 -1
- package/dist/chunks/{chunk-P3ZZVBZQ.js → chunk-RMZJP32R.js} +1 -1
- package/dist/chunks/{chunk-P3YADO62.js → chunk-RSLPLRVK.js} +1 -1
- package/dist/chunks/{chunk-AJT64XO2.js → chunk-RYMRVMGD.js} +2 -2
- package/dist/chunks/{chunk-MHKDLJEI.js → chunk-SMC4MGY5.js} +1 -1
- package/dist/chunks/{chunk-ZFYW4CEL.js → chunk-SR5XEF7L.js} +1 -1
- package/dist/chunks/{chunk-PTKSYVXM.js → chunk-TAT5WGDZ.js} +1 -1
- package/dist/chunks/{chunk-GXNSAACA.js → chunk-THB7KY2N.js} +1 -1
- package/dist/chunks/{chunk-TNGDWVMX.js → chunk-UKMRJIIZ.js} +1 -1
- package/dist/chunks/{chunk-MUJP4VPF.js → chunk-UKVEXM5O.js} +1 -1
- package/dist/chunks/{chunk-MJWC4W6J.js → chunk-ULHETT7U.js} +1 -1
- package/dist/chunks/{chunk-2E6XILZC.js → chunk-UOZHC2ZG.js} +1 -1
- package/dist/chunks/{chunk-RERUTI3O.js → chunk-V426AGVC.js} +2 -2
- package/dist/chunks/{chunk-6ALOD3OE.js → chunk-V6Y6UK6B.js} +2 -4
- package/dist/chunks/{chunk-DWPCZHDT.js → chunk-VWBJWUYQ.js} +1 -1
- package/dist/chunks/{chunk-TN4IR2LY.js → chunk-WNTA7DCC.js} +1 -1
- package/dist/chunks/{chunk-VMHUBZRU.js → chunk-XQQ7DTQG.js} +1 -1
- package/dist/chunks/{chunk-UKC3NSS6.js → chunk-YEWZFZ2O.js} +1 -1
- package/dist/chunks/{chunk-P4BGC5RL.js → chunk-YGMOJBSP.js} +2 -2
- package/dist/chunks/{chunk-65Z5UPUC.js → chunk-YKOIVWZI.js} +1 -1
- package/dist/chunks/{chunk-X7U35FBE.js → chunk-YTIANIL7.js} +1 -1
- package/dist/chunks/chunk-YUDKK2QJ.js +7 -0
- package/dist/chunks/{chunk-DQXGNNPB.js → chunk-YZBYL3SH.js} +1 -1
- package/dist/chunks/{chunk-4AY4YYKS.js → chunk-ZN37NQM4.js} +1 -1
- package/dist/chunks/{chunk-W45NZSSK.js → chunk-ZNQI6M3S.js} +1 -1
- package/dist/chunks/{clear-M6LODAMD.js → clear-VMJVLPVR.js} +1 -1
- package/dist/chunks/{compile-vercel-config-NBX5UWHW.js → compile-vercel-config-YCLXPL5H.js} +1 -1
- package/dist/chunks/{config-Q3TRA4NK.js → config-JPX6NJMJ.js} +1 -1
- package/dist/chunks/{config-YQ7FIAFK.js → config-YMUUPO3R.js} +1 -1
- package/dist/chunks/config-validator.mjs +1 -1
- package/dist/chunks/{connect-git-provider-67DJOI6X.js → connect-git-provider-KLSBCSD2.js} +1 -1
- package/dist/chunks/{delete-KSZ7R5V6.js → delete-E7J4B5E5.js} +1 -1
- package/dist/chunks/{delete-NRWKSTCN.js → delete-EEY7M6XT.js} +1 -1
- package/dist/chunks/{detect-services-MWYUJZJZ.js → detect-services-E2TWAKQS.js} +1 -1
- package/dist/chunks/{disable-BUGWQUS7.js → disable-5TKY6JK2.js} +1 -1
- package/dist/chunks/{discard-J5O3C753.js → discard-ALSOF66H.js} +1 -1
- package/dist/chunks/{edit-DMOIBVEP.js → edit-2M3KEE3H.js} +1 -1
- package/dist/chunks/{edit-YRWAXGEI.js → edit-ISUCMYNW.js} +1 -1
- package/dist/chunks/{enable-IL27VHSU.js → enable-2QTTTYQD.js} +1 -1
- package/dist/chunks/{exec-GYSSNCNK.js → exec-XIQJ2A3J.js} +1 -1
- package/dist/chunks/{export-HBUUGMGE.js → export-PV2NDS7C.js} +1 -1
- package/dist/chunks/{future-BXETJ6CT.js → future-SQS5POAL.js} +1 -1
- package/dist/chunks/{generate-cert-for-deploy-K5QDHEEQ.js → generate-cert-for-deploy-4EJRA7MS.js} +1 -1
- package/dist/chunks/{image-M2XIQYXT.js → image-6GL2UOA2.js} +1 -1
- package/dist/chunks/{import-builders-UGIWTKRS.js → import-builders-KAZMYQCR.js} +1 -1
- package/dist/chunks/{inspect-SUEMHSB6.js → inspect-3HGROSZO.js} +1 -1
- package/dist/chunks/{inspect-XANEFWYN.js → inspect-FK6GC5JZ.js} +1 -1
- package/dist/chunks/{inspect-TDHISMRV.js → inspect-LZMU7RIU.js} +1 -1
- package/dist/chunks/{inspect-HASOG2PB.js → inspect-ORVORGUM.js} +1 -1
- package/dist/chunks/{inspect-OGUGKPVK.js → inspect-UNL54246.js} +1 -1
- package/dist/chunks/{list-32NXD7OW.js → list-EWJI2WSQ.js} +1 -1
- package/dist/chunks/{list-Q566PTT4.js → list-FVUIZPC7.js} +1 -1
- package/dist/chunks/{list-Z6DRFZ7F.js → list-WOUJM4WR.js} +1 -1
- package/dist/chunks/{login-GPCBSMHV.js → login-IJLY5XTT.js} +1 -1
- package/dist/chunks/{login-A6R3RQIW.js → login-JREQ7SLY.js} +1 -1
- package/dist/chunks/{logs-L33R4G67.js → logs-Z7IMGFO2.js} +1 -1
- package/dist/chunks/{ls-VSK2ZFSY.js → ls-4COX4SMJ.js} +1 -1
- package/dist/chunks/{ls-6CYMQBX3.js → ls-6CD2OQGA.js} +1 -1
- package/dist/chunks/{ls-CTIACPC5.js → ls-6DOYSBQM.js} +1 -1
- package/dist/chunks/{ls-DUCIK4E6.js → ls-AHT2FRGM.js} +1 -1
- package/dist/chunks/{ls-R442RADW.js → ls-LXBUE4LZ.js} +1 -1
- package/dist/chunks/{ls-JPL3AFIM.js → ls-RBWPVJ5G.js} +1 -1
- package/dist/chunks/{ls-GDR45ANC.js → ls-W5SJUIHD.js} +1 -1
- package/dist/chunks/{mutate-MUWQVZKM.js → mutate-TVUHBRBK.js} +1 -1
- package/dist/chunks/{notifications-YKGIFXKO.js → notifications-OXOSD6UK.js} +1 -1
- package/dist/chunks/{open-OJAIEDS5.js → open-SWPHB54M.js} +1 -1
- package/dist/chunks/{openapi-Y4NWAKUM.js → openapi-32XHDVJL.js} +1 -1
- package/dist/chunks/{permissions-LWKZBBU7.js → permissions-A4WMGETJ.js} +1 -1
- package/dist/chunks/{prompt-missing-credentials-O3GGMOZH.js → prompt-missing-credentials-6IXO6VND.js} +1 -1
- package/dist/chunks/{publish-JHNLZT6K.js → publish-2CS4RYJW.js} +1 -1
- package/dist/chunks/pull-WWUH4M5V.js +7 -0
- package/dist/chunks/{purchase-domain-if-available-CJK3G4DT.js → purchase-domain-if-available-TAXCYIV7.js} +1 -1
- package/dist/chunks/{push-MUMGVOSY.js → push-OPRW7M4I.js} +1 -1
- package/dist/chunks/{query-2TTSDOFF.js → query-22PGP7BC.js} +1 -1
- package/dist/chunks/{reauthenticate-S47X66LM.js → reauthenticate-LMR25CIE.js} +1 -1
- package/dist/chunks/{reorder-NGBZWNZH.js → reorder-Y3NMEA2S.js} +1 -1
- package/dist/chunks/{reply-5WF5YHOM.js → reply-YEZHST2Q.js} +1 -1
- package/dist/chunks/{resolve-MPZBUK5V.js → resolve-QC37E2EB.js} +1 -1
- package/dist/chunks/{restore-NVY4A3T3.js → restore-RMQVGYQB.js} +1 -1
- package/dist/chunks/{rm-ZO5JP3GF.js → rm-42U6SPVV.js} +1 -1
- package/dist/chunks/{rm-HFJCOK2D.js → rm-43MPIHP3.js} +1 -1
- package/dist/chunks/{rm-QXQ2AD4R.js → rm-4MSUYUEP.js} +1 -1
- package/dist/chunks/{rm-DB5K2RI7.js → rm-DPHE34CD.js} +1 -1
- package/dist/chunks/{rm-SMKVHN75.js → rm-JHWXYHJY.js} +1 -1
- package/dist/chunks/{routes-KO5NFCCJ.js → routes-2GTCE542.js} +1 -1
- package/dist/chunks/{rule-inspect-VZARLRS3.js → rule-inspect-7LIPL5YY.js} +1 -1
- package/dist/chunks/{rules-G2WFYCPB.js → rules-6KWBVUF2.js} +1 -1
- package/dist/chunks/{schema-SVYU72YU.js → schema-OUFU5V7Z.js} +1 -1
- package/dist/chunks/{schema-G6BOZBNB.js → schema-S2DE7S5N.js} +1 -1
- package/dist/chunks/{select-org-2W67WKBG.js → select-org-EL66MG67.js} +1 -1
- package/dist/chunks/{set-ILVKMTUD.js → set-VXSNREF4.js} +1 -1
- package/dist/chunks/setup-and-link-I7SGZNGO.js +7 -0
- package/dist/chunks/{tags-C34XXMYO.js → tags-AGLQDT3Z.js} +1 -1
- package/dist/chunks/{types-MATC4UQL.js → types-GQNKYZJH.js} +1 -1
- package/dist/chunks/{update-IVWOZO4P.js → update-TI3YRVQT.js} +1 -1
- package/dist/commands/build/index.js +7 -7
- package/dist/commands/deploy/index.js +44 -28
- package/dist/commands/dev/index.js +8 -8
- package/dist/commands/env/index.js +1 -1
- package/dist/commands/link/index.js +1 -1
- package/dist/commands/list/index.js +1 -1
- package/dist/commands-bulk.js +35 -39
- package/dist/index.js +6 -5
- package/dist/internal-build.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +54 -53
- package/dist/chunks/chunk-2Z47VG5H.js +0 -9
- package/dist/chunks/chunk-EA3BJUUK.js +0 -7
- package/dist/chunks/chunk-EJNFKH6Y.js +0 -10
- package/dist/chunks/chunk-NTRM6VO6.js +0 -9
- package/dist/chunks/chunk-SX64OM5A.js +0 -7
- package/dist/chunks/pull-E4K6BVQW.js +0 -7
- package/dist/chunks/setup-and-link-VFCYLLB5.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{outputError}from"./chunk-
|
|
7
|
+
import{outputError}from"./chunk-Q7AYTXUR.js";import{require_execa}from"./chunk-A73N3QKT.js";import{AGENT_REASON,buildCommandWithGlobalFlags,outputAgentError}from"./chunk-ONPJXQQ6.js";import{validateJsonOutput}from"./chunk-D4MW3RDW.js";import{getScope}from"./chunk-THB7KY2N.js";import{require_ms}from"./chunk-QTKJC2O5.js";import{getLinkedProject,getProjectByNameOrId}from"./chunk-3XLK5ZPD.js";import{require_lib}from"./chunk-B4ATVYZW.js";import{ProjectNotFound,isAPIError,require_bytes}from"./chunk-NM67DIPQ.js";import{packageName}from"./chunk-FI772UVH.js";import{output_manager_default}from"./chunk-Q2YQSMIB.js";import{__toESM}from"./chunk-6L236MNA.js";function emitVcrScopeError(client,jsonOutput,code,message,agent){return outputAgentError(client,{status:"error",reason:agent.reason,message,hint:agent.hint,next:agent.next},1),outputError(client,jsonOutput,code,message)}async function resolveVcrScope(client,opts){if(opts.project){let{team}=await getScope(client);if(!team){let msg="No team context found. Run `vercel switch` to select a team, or use `vercel link` in a project directory.";return emitVcrScopeError(client,opts.jsonOutput,"NO_TEAM",msg,{reason:AGENT_REASON.MISSING_SCOPE,hint:"Select a team scope before using --project with vcr.",next:[{command:buildCommandWithGlobalFlags(client.argv,"whoami"),when:"See current user and team"},{command:buildCommandWithGlobalFlags(client.argv,"teams switch"),when:"Switch to a team that owns the project"}]})}let projectResult;try{projectResult=await getProjectByNameOrId(client,opts.project,team.id)}catch(err){if(isAPIError(err)){let msg=err.serverMessage||(err.status===403?`You do not have permission to access project "${opts.project}" in team "${team.slug}".`:`API error (${err.status}).`),reason=err.status===401?"not_authorized":err.status===403?"forbidden":AGENT_REASON.API_ERROR;return emitVcrScopeError(client,opts.jsonOutput,err.code||"API_ERROR",msg,{reason,next:[{command:buildCommandWithGlobalFlags(client.argv,"vcr ls --project <name_or_id>"),when:"Retry with a project you can access (replace <name_or_id>)"}]})}throw err}if(projectResult instanceof ProjectNotFound){let msg=`Project "${opts.project}" was not found in team "${team.slug}".`;return emitVcrScopeError(client,opts.jsonOutput,"PROJECT_NOT_FOUND",msg,{reason:AGENT_REASON.NOT_FOUND,next:[{command:buildCommandWithGlobalFlags(client.argv,"project ls"),when:"List projects in the current team to pick a name"}]})}return{teamId:team.id,teamSlug:team.slug,projectId:projectResult.id,projectName:projectResult.name}}let linkedProject=await getLinkedProject(client);if(linkedProject.status==="error")return linkedProject.exitCode;if(linkedProject.status==="not_linked"){let msg="No linked project found. Run `vercel link` to link a project, or pass --project <name>.";return emitVcrScopeError(client,opts.jsonOutput,"NOT_LINKED",msg,{reason:AGENT_REASON.NOT_LINKED,hint:"Agents should pass --project when no .vercel link exists in --cwd.",next:[{command:buildCommandWithGlobalFlags(client.argv,"link"),when:"Link this directory to a Vercel project"},{command:buildCommandWithGlobalFlags(client.argv,"vcr ls --project <name_or_id>"),when:"List repositories for a project without linking (replace <name_or_id>)"}]})}return{teamId:linkedProject.org.id,teamSlug:linkedProject.org.slug,projectId:linkedProject.project.id,projectName:linkedProject.project.name}}var import_ms=__toESM(require_ms(),1),import_bytes=__toESM(require_bytes(),1);function formatBytes(size){return typeof size!="number"||Number.isNaN(size)?"-":import_bytes.default.format(size,{decimalPlaces:1})??"-"}function formatRelativeTime(iso){let time=new Date(iso).getTime();return Number.isNaN(time)?"-":`${(0,import_ms.default)(Date.now()-time)} ago`}function formatDigest(digest){return digest?digest.replace(/^sha256:/,"").slice(0,12):"-"}function formatImageStatus(status){switch(status){case"ready":return"Ready";case"preparing":return"Preparing";case"unoptimized":return"Ready (unoptimized)";default:return"-"}}var VCR_REGISTRY="vcr.vercel.com";function formatImageReference(teamSlug,projectName,repositoryName,digest){return digest?`${VCR_REGISTRY}/${teamSlug}/${projectName}/${repositoryName}@${digest}`:"-"}function formatTagReference(teamSlug,projectName,repositoryName,tag){return tag?`${VCR_REGISTRY}/${teamSlug}/${projectName}/${repositoryName}:${tag}`:"-"}function validateVcrJsonOutput(client,flags){let fr=validateJsonOutput(flags);return fr.valid?{jsonOutput:fr.jsonOutput}:(outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message:fr.error},2),output_manager_default.error(fr.error),2)}function validateVcrChoice(client,flag,value,choices,jsonOutput){if(value===void 0||choices.includes(value))return;let message=`Invalid value for ${flag}: "${value}". Must be one of: ${choices.join(", ")}.`;return outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message},2),outputError(client,jsonOutput,"INVALID_ARGUMENTS",message)}function requireVcrRepository(client,repository,jsonOutput,usage){if(!repository)return outputAgentError(client,{status:"error",reason:AGENT_REASON.MISSING_ARGUMENTS,message:`Missing repository. Example: ${packageName} ${usage}`,next:[{command:buildCommandWithGlobalFlags(client.argv,"vcr ls"),when:"List repositories to pick a name or id"}]},2),outputError(client,jsonOutput,"MISSING_ARGUMENTS",`Usage: \`vercel ${usage}\``)}function requireVcrRepositoryAndTag(client,repository,tag,jsonOutput,usage){if(!(repository&&tag))return outputAgentError(client,{status:"error",reason:AGENT_REASON.MISSING_ARGUMENTS,message:`Missing arguments. Example: ${packageName} ${usage}`,next:[{command:buildCommandWithGlobalFlags(client.argv,"vcr tag ls <repository>"),when:"List tags to pick a tag (replace <repository>)"}]},2),outputError(client,jsonOutput,"MISSING_ARGUMENTS",`Usage: \`vercel ${usage}\``)}function requireVcrRepositoryAndImageId(client,repository,imageId,jsonOutput,usage){if(!(repository&&imageId))return outputAgentError(client,{status:"error",reason:AGENT_REASON.MISSING_ARGUMENTS,message:`Missing arguments. Example: ${packageName} ${usage}`,next:[{command:buildCommandWithGlobalFlags(client.argv,"vcr image ls <repository>"),when:"List images to pick an image id (replace <repository>)"}]},2),outputError(client,jsonOutput,"MISSING_ARGUMENTS",`Usage: \`vercel ${usage}\``)}var import_which=__toESM(require_lib(),1),import_execa=__toESM(require_execa(),1);var VCR_ENGINES=["docker","podman","buildah"],VCR_LOGIN_USERNAME="oidc";function resolveRegistry(){return process.env.VERCEL_VCR_REGISTRY||VCR_REGISTRY}function isEngineInstalled(engine){return import_which.default.sync(engine,{nothrow:!0})!==null}function splitPassthrough(argv){let idx=argv.indexOf("--");return idx===-1?{own:argv.slice(2),passthrough:[]}:{own:argv.slice(2,idx),passthrough:argv.slice(idx+1)}}async function isBuildxAvailable(){let result=await(0,import_execa.default)("docker",["buildx","version"],{reject:!1,stdio:"ignore"});return result instanceof Error?!1:result.exitCode===0}function pushCompressionArgs(engine){return engine==="docker"?[]:["--compression-format","zstd","--compression-level","3"]}var AUTH_FAILURE=/\b(?:unauthorized|denied|forbidden)\b\s*:|authentication required|access to the resource is denied|\b(?:401 unauthorized|403 forbidden)\b/i,CREDENTIAL_STORE_CONFLICT=/already exists in the keychain|errSecDuplicateItem/i;function stderrTail(stderr){return stderr.trim().split(`
|
|
8
8
|
`).slice(-5).join(`
|
|
9
9
|
`)}async function engineLogin(engine,registry,token){let result=await(0,import_execa.default)(engine,["login",registry,"--username",VCR_LOGIN_USERNAME,"--password-stdin"],{input:token,reject:!1});return result instanceof Error&&typeof result.exitCode!="number"?{exitCode:1,stderr:result.message}:{exitCode:typeof result.exitCode=="number"?result.exitCode:1,stderr:result.stderr??""}}async function engineLogout(engine,registry){await(0,import_execa.default)(engine,["logout",registry],{reject:!1,stdio:"ignore"})}async function runEngine(engine,args,opts){if(opts.captureStderr){let subprocess=(0,import_execa.default)(engine,args,{cwd:opts.cwd,stdio:["inherit","inherit","pipe"],reject:!1});subprocess.stderr?.pipe(process.stderr);let result2=await subprocess;return result2 instanceof Error&&typeof result2.exitCode!="number"?{exitCode:1,stderr:result2.message}:{exitCode:typeof result2.exitCode=="number"?result2.exitCode:1,stderr:result2.stderr??""}}let result=await(0,import_execa.default)(engine,args,{cwd:opts.cwd,stdio:"inherit",reject:!1});return result instanceof Error&&typeof result.exitCode!="number"?{exitCode:1,stderr:result.message}:{exitCode:typeof result.exitCode=="number"?result.exitCode:1,stderr:""}}var NOT_AUTHORIZED_MESSAGE="You do not have access to the container registry in this scope. Ensure your role can manage the project, or pass --token and --scope.",NOT_AUTHORIZED_HINT="Confirm team scope with whoami; use --scope <team-slug> if the repository lives under another team.",genericMessage=err=>err.serverMessage||`API error (${err.status}).`,STATUS_INFO={401:{reason:"not_authorized",message:()=>NOT_AUTHORIZED_MESSAGE,hint:NOT_AUTHORIZED_HINT,suggestWhoami:!0},403:{reason:"forbidden",message:()=>NOT_AUTHORIZED_MESSAGE,hint:NOT_AUTHORIZED_HINT,suggestWhoami:!0},404:{reason:AGENT_REASON.NOT_FOUND,message:genericMessage},409:{reason:"conflict",message:genericMessage},429:{reason:"rate_limited",message:genericMessage}};function resolveStatusInfo(err){return STATUS_INFO[err.status]?STATUS_INFO[err.status]:err.status>=500?{reason:AGENT_REASON.API_ERROR,message:()=>`The container registry endpoint failed (${err.status}). Re-run with --debug and share the x-vercel-id from the failed request.`}:{reason:AGENT_REASON.API_ERROR,message:genericMessage}}function handleVcrApiError(client,err,jsonOutput,opts={}){let info=resolveStatusInfo(err),message=info.message(err),next=[];return info.suggestWhoami&&next.push({command:buildCommandWithGlobalFlags(client.argv,"whoami"),when:"See current user and team"}),opts.retry&&next.push(opts.retry),outputAgentError(client,{status:"error",reason:info.reason,message,...info.hint?{hint:info.hint}:{},...next.length>0?{next}:{}},1),outputError(client,jsonOutput,err.code||"API_ERROR",message)}function reportEngineCommandFailure(client,engine,verb,result){let tail=stderrTail(result.stderr),message=`\`${engine} ${verb}\` failed (exit code ${result.exitCode}).${tail?`
|
|
10
10
|
${tail}`:""}`;return outputAgentError(client,{status:"error",reason:"command_failed",message},1),outputError(client,!1,"COMMAND_FAILED",message)}function reportEnginePushFailure(client,engine,verb,result){if(AUTH_FAILURE.test(result.stderr)){let message=`Push to ${resolveRegistry()} was rejected. Your registry credentials may be missing or expired.`;return outputAgentError(client,{status:"error",reason:"not_authorized",message,next:[{command:buildCommandWithGlobalFlags(client.argv,`vcr login ${engine}`),when:"Refresh registry credentials (valid ~12 hours)"}]},1),outputError(client,!1,"NOT_AUTHORIZED",message)}return reportEngineCommandFailure(client,engine,verb,result)}function emitVcrArgParseError(client,err,recoverTemplate){let msg=err instanceof Error?err.message:String(err),projectFlagMissingArg=msg.includes("--project")&&msg.includes("requires argument");outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message:projectFlagMissingArg?"`--project` requires a project name or id (for example `--project my-app`).":msg,next:[{command:buildCommandWithGlobalFlags(client.argv,recoverTemplate),when:projectFlagMissingArg?"Re-run with a project name or id (replace placeholder)":"See valid usage"}]},2)}export{resolveVcrScope,formatBytes,formatRelativeTime,formatDigest,formatImageStatus,formatImageReference,formatTagReference,validateVcrJsonOutput,validateVcrChoice,requireVcrRepository,requireVcrRepositoryAndTag,requireVcrRepositoryAndImageId,VCR_ENGINES,VCR_LOGIN_USERNAME,resolveRegistry,isEngineInstalled,splitPassthrough,isBuildxAvailable,pushCompressionArgs,AUTH_FAILURE,CREDENTIAL_STORE_CONFLICT,stderrTail,engineLogin,engineLogout,runEngine,handleVcrApiError,reportEngineCommandFailure,reportEnginePushFailure,emitVcrArgParseError};
|
|
@@ -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{readJSONFile}from"./chunk-
|
|
7
|
+
import{readJSONFile}from"./chunk-RMZJP32R.js";import{require_dist as require_dist2,validateConfig}from"./chunk-APSIFBD4.js";import{require_dist2 as require_dist}from"./chunk-G3NHWIPJ.js";import{compileVercelConfig}from"./chunk-FAJB3JV5.js";import{CantParseJSONFile}from"./chunk-NM67DIPQ.js";import{require_build_utils}from"./chunk-Q2YQSMIB.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-KAZMYQCR.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+`
|