@vercel/cli-support 66.5.0 → 66.6.0-snapshot-62deef8da0a0
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/dist/chunks/alerts-72Q42HNT.js +8 -0
- package/dist/chunks/api-endpoints-2IYXPLEG.js +7 -0
- package/dist/chunks/chunk-F2QU46EQ.js +7 -0
- package/dist/chunks/{chunk-ZSGNLAAJ.js → chunk-F37XFLFP.js} +1 -1
- package/dist/chunks/{chunk-GB2ZWZQU.js → chunk-W3ZH27MN.js} +1 -1
- package/dist/chunks/chunk-XR2J7PQN.js +12 -0
- package/dist/chunks/chunk-YEDS2UMW.js +10 -0
- package/dist/chunks/config-BCKJNJPS.js +7 -0
- package/dist/chunks/image-6A2EJP4N.js +7 -0
- package/dist/chunks/{usage-AL4CA45F.js → usage-HT5JXVAA.js} +1 -1
- package/dist/commands/build/index.js +1 -1
- package/dist/commands/deploy/index.js +1 -1
- package/dist/commands/env/index.js +1 -1
- package/dist/commands/link/index.js +1 -1
- package/dist/commands/project/index.js +1 -1
- package/dist/commands-account.js +69 -50
- package/dist/commands-ai.js +1 -1
- package/dist/commands-blob.js +1 -1
- package/dist/commands-core.js +3 -3
- package/dist/commands-deployments.js +1 -1
- package/dist/commands-flags.js +9 -8
- package/dist/commands-integrations.js +1 -1
- package/dist/commands-observability.js +2 -2
- package/dist/commands-routing.js +1 -1
- package/dist/index.js +2 -2
- package/dist/package.json +3 -3
- package/dist/version.mjs +1 -1
- package/package.json +14 -14
- package/dist/chunks/alerts-CIQQJC4S.js +0 -8
- package/dist/chunks/api-endpoints-A6O4YT4B.js +0 -7
- package/dist/chunks/chunk-DEM66DOY.js +0 -12
- package/dist/chunks/chunk-EJLYDHT7.js +0 -7
- package/dist/chunks/chunk-WNB3JZMX.js +0 -7
- package/dist/chunks/chunk-Y4J4STZV.js +0 -10
- package/dist/chunks/config-ZSE26DSM.js +0 -7
- package/dist/chunks/contract-BLCQGFZK.js +0 -11
- package/dist/chunks/image-WKBQLUTQ.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{validatePaths,validateRootDirectory}from"../../chunks/chunk-7W565DJB.js";import{getBuildMachineResourceConfig}from"../../chunks/chunk-ZF27J6FQ.js";import{aliasLonePageInOutput,isIgnoredFile,isStaticFolderDeploy,resolveSingleFileProject,singleFileConfig,singleFileMeta,singleFileProjectSettings,singleFileTargetArgs,stageSingleFile}from"../../chunks/chunk-YOAQNRBN.js";import{FIRST_DEPLOYMENT_PRODUCTION_NOTICE,hasEarlierDeployment,isNonProductionTarget,refuseFirstDeployment}from"../../chunks/chunk-WAFBTC45.js";import"../../chunks/chunk-COD3WAUI.js";import{pickOverrides}from"../../chunks/chunk-VUUU4KDL.js";import{BLOCKED_DEPLOYMENT_REASON,DeployTelemetryClient,Now,UploadErrorMissingArchive,formatVerificationFailure,getBlockedDeploymentDetails,getBlockedDeploymentMessage,getBlockedDeploymentNext,getDeploymentEnvironment,getDeploymentEnvironmentLabel,isBlockedDeployment,printBlockedDeployment,printDeploymentStatus,printPrebuiltFilePathMapIgnoreWarning,verifyDeployment}from"../../chunks/chunk-EFFJUYYS.js";import"../../chunks/chunk-ZFRNVIHI.js";import"../../chunks/chunk-3A3GU62R.js";import{PROJECT_EXPIRATION_TIMEFRAMES}from"../../chunks/chunk-ANIA2G6F.js";import"../../chunks/chunk-UUBPAYTG.js";import"../../chunks/chunk-AMH5MXDW.js";import{parseMeta}from"../../chunks/chunk-CZSOZKHX.js";import{compileVercelConfig,findSourceVercelConfigFile}from"../../chunks/chunk-O7GNYVVM.js";import"../../chunks/chunk-6GE4V7MW.js";import"../../chunks/chunk-U56NHYAH.js";import{getEnabledProtection,getProtectionForDeployment}from"../../chunks/chunk-B7GCRM5I.js";import{getProductionUrl}from"../../chunks/chunk-VT6RIZJH.js";import{formatDate}from"../../chunks/chunk-HRR57QNP.js";import{stamp_default}from"../../chunks/chunk-A2RZZQEP.js";import"../../chunks/chunk-Q7D7RGXM.js";import{parseEnv}from"../../chunks/chunk-KR4DMT3I.js";import{applyDeprecatedTargetFlag,parseTarget}from"../../chunks/chunk-LNZEYUEC.js";import{isGuidanceEnabled}from"../../chunks/chunk-TAAWMNNL.js";import{ensureLink}from"../../chunks/chunk-SXW2G4WD.js";import"../../chunks/chunk-QGHAD5A5.js";import{getDeployment}from"../../chunks/chunk-NBTFAXL4.js";import{mapCertError}from"../../chunks/chunk-TJUZVODP.js";import"../../chunks/chunk-PFD7LETF.js";import"../../chunks/chunk-IQ7FPAI4.js";import{trackCreatedId}from"../../chunks/chunk-YJNMDXEG.js";import{getRenamedOption,reportRenamedOptionError}from"../../chunks/chunk-OF32Z3UP.js";import{getSubcommand}from"../../chunks/chunk-ETV3C2CV.js";import{getCommandAliases}from"../../chunks/chunk-DEM66DOY.js";import"../../chunks/chunk-IIK6GUVI.js";import"../../chunks/chunk-K3MGQQEP.js";import"../../chunks/chunk-DDPH26ZO.js";import"../../chunks/chunk-PIDEH4SJ.js";import"../../chunks/chunk-C35SG42R.js";import"../../chunks/chunk-2GBU6ULJ.js";import"../../chunks/chunk-EJLYDHT7.js";import{continueSubcommand,deployCommand,deprecatedArchiveSplitTgz,describeSubcommand,initSubcommand}from"../../chunks/chunk-DOBV3XLO.js";import"../../chunks/chunk-TUB3APDV.js";import"../../chunks/chunk-BMIYC2MH.js";import"../../chunks/chunk-6CJFPT4F.js";import"../../chunks/chunk-ZZD5W5KT.js";import"../../chunks/chunk-VHSAI6FS.js";import"../../chunks/chunk-F7L5SXJM.js";import"../../chunks/chunk-GLCSWIB4.js";import"../../chunks/chunk-XECELSF5.js";import"../../chunks/chunk-6FYPSSL4.js";import"../../chunks/chunk-UQZZX2J7.js";import"../../chunks/chunk-UDZJCD5W.js";import"../../chunks/chunk-5ZCSFPWG.js";import"../../chunks/chunk-RVIJRFVD.js";import"../../chunks/chunk-XDYVJWGX.js";import"../../chunks/chunk-JALVF3C2.js";import"../../chunks/chunk-VZ4URN3U.js";import"../../chunks/chunk-AB4WXRCO.js";import"../../chunks/chunk-SYJXONEV.js";import{printError}from"../../chunks/chunk-33HVDSWP.js";import"../../chunks/chunk-BDXK4TCN.js";import{help}from"../../chunks/chunk-5KSBRQI2.js";import{param}from"../../chunks/chunk-3G3FQYMW.js";import"../../chunks/chunk-NLK7NGVP.js";import{require_ci_info}from"../../chunks/chunk-KDCODXVL.js";import"../../chunks/chunk-NWGBDBZI.js";import{VERCEL_DIR,VERCEL_DIR_PROJECT,addToGitIgnore,createGitMeta,getGitConfigPath,getGitExecutable,getLinkFromDir,getRepoLink,getVercelDirectory,highlight,isOwnerLookupUnavailableLink,isProjectReadLink,isRemoteLookupSkippedLink,linkFolderToProject,parseGitConfig,pluckRemoteUrls,readLocalConfig,require_dist2,require_lib}from"../../chunks/chunk-Z2KANBOU.js";import{printAlignedLabel}from"../../chunks/chunk-M7FED5YP.js";import"../../chunks/chunk-4HR3I3ML.js";import{getProjectByNameOrId}from"../../chunks/chunk-DJZBJC2A.js";import"../../chunks/chunk-LUX4PBJL.js";import"../../chunks/chunk-MTZYPCZ7.js";import"../../chunks/chunk-OPORM35X.js";import"../../chunks/chunk-D6REP5QQ.js";import"../../chunks/chunk-FBYA6LLM.js";import{getFetchDispatcher}from"../../chunks/chunk-MY4MONOH.js";import"../../chunks/chunk-UG3FZ5Q7.js";import{require_ms}from"../../chunks/chunk-MXTC4ZAQ.js";import{parseArguments}from"../../chunks/chunk-CINNNQDJ.js";import{AGENT_REASON,AGENT_STATUS,argvHasNonInteractive,buildCommandWithYes,outputActionRequired,outputAgentError,withGlobalFlags,writeAgentError}from"../../chunks/chunk-4SS6W6JK.js";import{validateJsonOutput,warnDeprecatedInput}from"../../chunks/chunk-FEJD7MRH.js";import{require_types}from"../../chunks/chunk-AW33SRYY.js";import"../../chunks/chunk-4NTBYNFR.js";import"../../chunks/chunk-4SAVH3H7.js";import{AliasDomainConfigured,BuildError,BuildsRateLimited,ConflictingConfigFiles,ConflictingFilePath,ConflictingPathSegment,DeploymentNotFound,DeploymentsRateLimited,DeprecatedNowJson,DomainNotFound,DomainNotVerified,DomainPermissionDenied,DomainVerificationFailed,InvalidDomain,MissingBuildScript,NotDomainOwner,NowError,ProjectNotFound,SchemaValidationFailed,TooManyRequests,UserAborted,code,isAPIError,require_bytes}from"../../chunks/chunk-GOI2VVI7.js";import{getCommandName,getCommandNamePlain,packageName}from"../../chunks/chunk-B4KA3ZH2.js";import"../../chunks/chunk-BOJDM3O7.js";import{cliErrorFromUnknown,emoji,link_default,output_manager_default,prependEmoji,recordCliError}from"../../chunks/chunk-AP6DZGTK.js";import"../../chunks/chunk-BLUPZPAS.js";import{require_build_utils}from"../../chunks/chunk-5MDNVAE6.js";import"../../chunks/chunk-OCR5CRTH.js";import"../../chunks/chunk-7EJQLVWX.js";import"../../chunks/chunk-SCV7XEEO.js";import{require_dist}from"../../chunks/chunk-MCYG7CCE.js";import"../../chunks/chunk-YHPPP3SF.js";import"../../chunks/chunk-24SIHFEW.js";import"../../chunks/chunk-GLIQ4KNY.js";import{getFlagsSpecification,quoteArg,stripSensitiveAuthArgs}from"../../chunks/chunk-CFJBDBYH.js";import"../../chunks/chunk-2BKALEOP.js";import{require_source}from"../../chunks/chunk-NB2WLB3J.js";import"../../chunks/chunk-ISWW3DKF.js";import"../../chunks/chunk-BRQUZ5NC.js";import"../../chunks/chunk-BULSRTQE.js";import{__toESM}from"../../chunks/chunk-BZENIQ7N.js";var import_build_utils2=__toESM(require_build_utils(),1),import_client=__toESM(require_dist2(),1),import_error_utils2=__toESM(require_dist(),1);var import_bytes=__toESM(require_bytes(),1),import_chalk=__toESM(require_source(),1),import_fs_extra4=__toESM(require_lib(),1),import_ms=__toESM(require_ms(),1);import{tmpdir}from"os";import{basename,dirname,extname,join as join4,resolve as resolve2}from"path";async function createDeploy(client,now,contextName,path,createArgs,org,isSettingUpProject,archive){try{return await now.create(path,createArgs,org,isSettingUpProject,archive)}catch(err){if(isAPIError(err)){if(err.code==="rate_limited")throw new DeploymentsRateLimited(err.message);if(err.code==="domain_missing")throw new DomainNotFound(err.value);if(err.code==="domain_not_found"&&err.domain)throw new DomainNotFound(err.domain);if(err.code==="domain_not_verified"&&err.domain)throw new DomainNotVerified(err.domain);if(err.code==="domain_not_verified"&&err.value)throw new DomainVerificationFailed(err.value);if(err.code==="not_domain_owner")throw new NotDomainOwner(err.message);if(err.code==="builds_rate_limited")throw new BuildsRateLimited(err.message,{ctaLabel:err.ctaLabel,ctaUrl:err.ctaUrl,action:err.action,link:err.link});if(err.code==="forbidden")throw new DomainPermissionDenied(err.value,contextName);if(err.code==="bad_request"&&err.keyword)throw new SchemaValidationFailed(err.message,err.keyword,err.dataPath,err.params);if(err.code==="domain_configured")throw new AliasDomainConfigured(err);if(err.code==="missing_build_script")throw new MissingBuildScript(err);if(err.code==="conflicting_file_path")throw new ConflictingFilePath(err);if(err.code==="conflicting_path_segment")throw new ConflictingPathSegment(err);if(err.code==="cert_missing"){let{default:generateCertForDeploy}=await import("../../chunks/generate-cert-for-deploy-7BX47IPD.js"),result=await generateCertForDeploy(client,contextName,err.value);return result instanceof NowError?result:createDeploy(client,now,contextName,path,createArgs,org,isSettingUpProject)}if(err.code==="not_found")throw new DeploymentNotFound({context:contextName});let certError=mapCertError(err);if(certError)return certError}throw err}}var ENV_PAIR_FLAGS=["--env","--build-env"],ENV_VALUE_PLACEHOLDER="<VALUE>",PROJECT_PLACEHOLDER="<PROJECT>",CANONICAL_FLAGS={"--token":null,"--confirm":"--yes","--target":"--environment","--team":"--scope","--name":null,"--no-clipboard":null,"--no-logs":null};function buildCreateIfMissingCommand(positionals,flags,argv,{createIfMissing=!0,addProjectPlaceholder=!1}={}){let out=["deploy",...positionals],seen=new Set,hasPlaceholder=!1;for(let[typedName,value]of Object.entries(flags)){let name=typedName in CANONICAL_FLAGS?CANONICAL_FLAGS[typedName]:typedName;if(!(!name||name==="--create-if-missing"||seen.has(name))){if(seen.add(name),name==="--non-interactive"){out.push(argvHasNonInteractive(argv)?"--non-interactive":"--non-interactive=false");continue}for(let item of Array.isArray(value)?value:[value])if(item===!0)out.push(name);else if(typeof item=="string"||typeof item=="number"){let text=String(item),shown=ENV_PAIR_FLAGS.includes(name)?withPlaceholder(text):text;hasPlaceholder||=shown!==text,out.push(name,shown)}}}addProjectPlaceholder&&out.push("--project",PROJECT_PLACEHOLDER),createIfMissing&&out.push("--create-if-missing");let command=[packageName,...out.map(quoteToken)].join(" "),notes=[...addProjectPlaceholder?[`replace ${PROJECT_PLACEHOLDER} with the project name`]:[],...hasPlaceholder?[`replace each ${ENV_VALUE_PLACEHOLDER} with the Environment Variable's value`]:[]];return notes.length?{command,note:notes.join(", and ")}:{command}}function findEnvPlaceholder(flags){for(let flag of ENV_PAIR_FLAGS){let value=flags[flag];for(let pair of Array.isArray(value)?value:[value])if(typeof pair=="string"&&pair.endsWith(`=${ENV_VALUE_PLACEHOLDER}`))return{flag,key:pair.slice(0,pair.indexOf("="))}}}function withPlaceholder(pair){let equals=pair.indexOf("=");return equals>=0?`${pair.slice(0,equals)}=${ENV_VALUE_PLACEHOLDER}`:pair}function quoteToken(token){return token===PROJECT_PLACEHOLDER||/^[A-Za-z0-9_./@:=,+-]+$/.test(token)?token:quoteArg(token)}async function getDeploymentChecks(client,deploymentId){return await client.fetch(`/v1/deployments/${encodeURIComponent(deploymentId)}/checks`)}async function getDeploymentCheckRuns(client,deploymentId){return await client.fetch(`/v2/deployments/${encodeURIComponent(deploymentId)}/check-runs`)}function parseNdjson(text){let entries=[];for(let line of text.split(`
|
|
7
|
+
import{validatePaths,validateRootDirectory}from"../../chunks/chunk-7W565DJB.js";import{getBuildMachineResourceConfig}from"../../chunks/chunk-ZF27J6FQ.js";import{aliasLonePageInOutput,isIgnoredFile,isStaticFolderDeploy,resolveSingleFileProject,singleFileConfig,singleFileMeta,singleFileProjectSettings,singleFileTargetArgs,stageSingleFile}from"../../chunks/chunk-YOAQNRBN.js";import{FIRST_DEPLOYMENT_PRODUCTION_NOTICE,hasEarlierDeployment,isNonProductionTarget,refuseFirstDeployment}from"../../chunks/chunk-WAFBTC45.js";import"../../chunks/chunk-COD3WAUI.js";import{pickOverrides}from"../../chunks/chunk-VUUU4KDL.js";import{BLOCKED_DEPLOYMENT_REASON,DeployTelemetryClient,Now,UploadErrorMissingArchive,formatVerificationFailure,getBlockedDeploymentDetails,getBlockedDeploymentMessage,getBlockedDeploymentNext,getDeploymentEnvironment,getDeploymentEnvironmentLabel,isBlockedDeployment,printBlockedDeployment,printDeploymentStatus,printPrebuiltFilePathMapIgnoreWarning,verifyDeployment}from"../../chunks/chunk-EFFJUYYS.js";import"../../chunks/chunk-ZFRNVIHI.js";import"../../chunks/chunk-3A3GU62R.js";import{PROJECT_EXPIRATION_TIMEFRAMES}from"../../chunks/chunk-ANIA2G6F.js";import"../../chunks/chunk-UUBPAYTG.js";import"../../chunks/chunk-AMH5MXDW.js";import{parseMeta}from"../../chunks/chunk-CZSOZKHX.js";import{compileVercelConfig,findSourceVercelConfigFile}from"../../chunks/chunk-O7GNYVVM.js";import"../../chunks/chunk-6GE4V7MW.js";import"../../chunks/chunk-U56NHYAH.js";import{getEnabledProtection,getProtectionForDeployment}from"../../chunks/chunk-B7GCRM5I.js";import{getProductionUrl}from"../../chunks/chunk-VT6RIZJH.js";import{formatDate}from"../../chunks/chunk-HRR57QNP.js";import{stamp_default}from"../../chunks/chunk-A2RZZQEP.js";import"../../chunks/chunk-Q7D7RGXM.js";import{parseEnv}from"../../chunks/chunk-KR4DMT3I.js";import{applyDeprecatedTargetFlag,parseTarget}from"../../chunks/chunk-LNZEYUEC.js";import{isGuidanceEnabled}from"../../chunks/chunk-TAAWMNNL.js";import{ensureLink}from"../../chunks/chunk-SXW2G4WD.js";import"../../chunks/chunk-QGHAD5A5.js";import{getDeployment}from"../../chunks/chunk-NBTFAXL4.js";import{mapCertError}from"../../chunks/chunk-TJUZVODP.js";import"../../chunks/chunk-PFD7LETF.js";import"../../chunks/chunk-IQ7FPAI4.js";import{trackCreatedId}from"../../chunks/chunk-YJNMDXEG.js";import{getRenamedOption,reportRenamedOptionError}from"../../chunks/chunk-OF32Z3UP.js";import{getSubcommand}from"../../chunks/chunk-ETV3C2CV.js";import{getCommandAliases}from"../../chunks/chunk-XR2J7PQN.js";import"../../chunks/chunk-K3MGQQEP.js";import"../../chunks/chunk-DDPH26ZO.js";import"../../chunks/chunk-PIDEH4SJ.js";import"../../chunks/chunk-IIK6GUVI.js";import"../../chunks/chunk-C35SG42R.js";import"../../chunks/chunk-2GBU6ULJ.js";import{continueSubcommand,deployCommand,deprecatedArchiveSplitTgz,describeSubcommand,initSubcommand}from"../../chunks/chunk-DOBV3XLO.js";import"../../chunks/chunk-TUB3APDV.js";import"../../chunks/chunk-BMIYC2MH.js";import"../../chunks/chunk-6CJFPT4F.js";import"../../chunks/chunk-ZZD5W5KT.js";import"../../chunks/chunk-VHSAI6FS.js";import"../../chunks/chunk-F7L5SXJM.js";import"../../chunks/chunk-GLCSWIB4.js";import"../../chunks/chunk-XECELSF5.js";import"../../chunks/chunk-6FYPSSL4.js";import"../../chunks/chunk-UQZZX2J7.js";import"../../chunks/chunk-UDZJCD5W.js";import"../../chunks/chunk-5ZCSFPWG.js";import"../../chunks/chunk-RVIJRFVD.js";import"../../chunks/chunk-XDYVJWGX.js";import"../../chunks/chunk-JALVF3C2.js";import"../../chunks/chunk-VZ4URN3U.js";import"../../chunks/chunk-AB4WXRCO.js";import"../../chunks/chunk-SYJXONEV.js";import{printError}from"../../chunks/chunk-33HVDSWP.js";import"../../chunks/chunk-BDXK4TCN.js";import{help}from"../../chunks/chunk-5KSBRQI2.js";import{param}from"../../chunks/chunk-3G3FQYMW.js";import"../../chunks/chunk-NLK7NGVP.js";import{require_ci_info}from"../../chunks/chunk-KDCODXVL.js";import"../../chunks/chunk-NWGBDBZI.js";import{VERCEL_DIR,VERCEL_DIR_PROJECT,addToGitIgnore,createGitMeta,getGitConfigPath,getGitExecutable,getLinkFromDir,getRepoLink,getVercelDirectory,highlight,isOwnerLookupUnavailableLink,isProjectReadLink,isRemoteLookupSkippedLink,linkFolderToProject,parseGitConfig,pluckRemoteUrls,readLocalConfig,require_dist2,require_lib}from"../../chunks/chunk-Z2KANBOU.js";import{printAlignedLabel}from"../../chunks/chunk-M7FED5YP.js";import"../../chunks/chunk-4HR3I3ML.js";import{getProjectByNameOrId}from"../../chunks/chunk-DJZBJC2A.js";import"../../chunks/chunk-LUX4PBJL.js";import"../../chunks/chunk-MTZYPCZ7.js";import"../../chunks/chunk-OPORM35X.js";import"../../chunks/chunk-D6REP5QQ.js";import"../../chunks/chunk-FBYA6LLM.js";import{getFetchDispatcher}from"../../chunks/chunk-MY4MONOH.js";import"../../chunks/chunk-UG3FZ5Q7.js";import{require_ms}from"../../chunks/chunk-MXTC4ZAQ.js";import{parseArguments}from"../../chunks/chunk-CINNNQDJ.js";import{AGENT_REASON,AGENT_STATUS,argvHasNonInteractive,buildCommandWithYes,outputActionRequired,outputAgentError,withGlobalFlags,writeAgentError}from"../../chunks/chunk-4SS6W6JK.js";import{validateJsonOutput,warnDeprecatedInput}from"../../chunks/chunk-FEJD7MRH.js";import{require_types}from"../../chunks/chunk-AW33SRYY.js";import"../../chunks/chunk-4NTBYNFR.js";import"../../chunks/chunk-4SAVH3H7.js";import{AliasDomainConfigured,BuildError,BuildsRateLimited,ConflictingConfigFiles,ConflictingFilePath,ConflictingPathSegment,DeploymentNotFound,DeploymentsRateLimited,DeprecatedNowJson,DomainNotFound,DomainNotVerified,DomainPermissionDenied,DomainVerificationFailed,InvalidDomain,MissingBuildScript,NotDomainOwner,NowError,ProjectNotFound,SchemaValidationFailed,TooManyRequests,UserAborted,code,isAPIError,require_bytes}from"../../chunks/chunk-GOI2VVI7.js";import{getCommandName,getCommandNamePlain,packageName}from"../../chunks/chunk-B4KA3ZH2.js";import"../../chunks/chunk-BOJDM3O7.js";import{cliErrorFromUnknown,emoji,link_default,output_manager_default,prependEmoji,recordCliError}from"../../chunks/chunk-AP6DZGTK.js";import"../../chunks/chunk-BLUPZPAS.js";import{require_build_utils}from"../../chunks/chunk-5MDNVAE6.js";import"../../chunks/chunk-OCR5CRTH.js";import"../../chunks/chunk-7EJQLVWX.js";import"../../chunks/chunk-SCV7XEEO.js";import{require_dist}from"../../chunks/chunk-MCYG7CCE.js";import"../../chunks/chunk-YHPPP3SF.js";import"../../chunks/chunk-24SIHFEW.js";import"../../chunks/chunk-GLIQ4KNY.js";import{getFlagsSpecification,quoteArg,stripSensitiveAuthArgs}from"../../chunks/chunk-CFJBDBYH.js";import"../../chunks/chunk-2BKALEOP.js";import{require_source}from"../../chunks/chunk-NB2WLB3J.js";import"../../chunks/chunk-ISWW3DKF.js";import"../../chunks/chunk-BRQUZ5NC.js";import"../../chunks/chunk-BULSRTQE.js";import{__toESM}from"../../chunks/chunk-BZENIQ7N.js";var import_build_utils2=__toESM(require_build_utils(),1),import_client=__toESM(require_dist2(),1),import_error_utils2=__toESM(require_dist(),1);var import_bytes=__toESM(require_bytes(),1),import_chalk=__toESM(require_source(),1),import_fs_extra4=__toESM(require_lib(),1),import_ms=__toESM(require_ms(),1);import{tmpdir}from"os";import{basename,dirname,extname,join as join4,resolve as resolve2}from"path";async function createDeploy(client,now,contextName,path,createArgs,org,isSettingUpProject,archive){try{return await now.create(path,createArgs,org,isSettingUpProject,archive)}catch(err){if(isAPIError(err)){if(err.code==="rate_limited")throw new DeploymentsRateLimited(err.message);if(err.code==="domain_missing")throw new DomainNotFound(err.value);if(err.code==="domain_not_found"&&err.domain)throw new DomainNotFound(err.domain);if(err.code==="domain_not_verified"&&err.domain)throw new DomainNotVerified(err.domain);if(err.code==="domain_not_verified"&&err.value)throw new DomainVerificationFailed(err.value);if(err.code==="not_domain_owner")throw new NotDomainOwner(err.message);if(err.code==="builds_rate_limited")throw new BuildsRateLimited(err.message,{ctaLabel:err.ctaLabel,ctaUrl:err.ctaUrl,action:err.action,link:err.link});if(err.code==="forbidden")throw new DomainPermissionDenied(err.value,contextName);if(err.code==="bad_request"&&err.keyword)throw new SchemaValidationFailed(err.message,err.keyword,err.dataPath,err.params);if(err.code==="domain_configured")throw new AliasDomainConfigured(err);if(err.code==="missing_build_script")throw new MissingBuildScript(err);if(err.code==="conflicting_file_path")throw new ConflictingFilePath(err);if(err.code==="conflicting_path_segment")throw new ConflictingPathSegment(err);if(err.code==="cert_missing"){let{default:generateCertForDeploy}=await import("../../chunks/generate-cert-for-deploy-7BX47IPD.js"),result=await generateCertForDeploy(client,contextName,err.value);return result instanceof NowError?result:createDeploy(client,now,contextName,path,createArgs,org,isSettingUpProject)}if(err.code==="not_found")throw new DeploymentNotFound({context:contextName});let certError=mapCertError(err);if(certError)return certError}throw err}}var ENV_PAIR_FLAGS=["--env","--build-env"],ENV_VALUE_PLACEHOLDER="<VALUE>",PROJECT_PLACEHOLDER="<PROJECT>",CANONICAL_FLAGS={"--token":null,"--confirm":"--yes","--target":"--environment","--team":"--scope","--name":null,"--no-clipboard":null,"--no-logs":null};function buildCreateIfMissingCommand(positionals,flags,argv,{createIfMissing=!0,addProjectPlaceholder=!1}={}){let out=["deploy",...positionals],seen=new Set,hasPlaceholder=!1;for(let[typedName,value]of Object.entries(flags)){let name=typedName in CANONICAL_FLAGS?CANONICAL_FLAGS[typedName]:typedName;if(!(!name||name==="--create-if-missing"||seen.has(name))){if(seen.add(name),name==="--non-interactive"){out.push(argvHasNonInteractive(argv)?"--non-interactive":"--non-interactive=false");continue}for(let item of Array.isArray(value)?value:[value])if(item===!0)out.push(name);else if(typeof item=="string"||typeof item=="number"){let text=String(item),shown=ENV_PAIR_FLAGS.includes(name)?withPlaceholder(text):text;hasPlaceholder||=shown!==text,out.push(name,shown)}}}addProjectPlaceholder&&out.push("--project",PROJECT_PLACEHOLDER),createIfMissing&&out.push("--create-if-missing");let command=[packageName,...out.map(quoteToken)].join(" "),notes=[...addProjectPlaceholder?[`replace ${PROJECT_PLACEHOLDER} with the project name`]:[],...hasPlaceholder?[`replace each ${ENV_VALUE_PLACEHOLDER} with the Environment Variable's value`]:[]];return notes.length?{command,note:notes.join(", and ")}:{command}}function findEnvPlaceholder(flags){for(let flag of ENV_PAIR_FLAGS){let value=flags[flag];for(let pair of Array.isArray(value)?value:[value])if(typeof pair=="string"&&pair.endsWith(`=${ENV_VALUE_PLACEHOLDER}`))return{flag,key:pair.slice(0,pair.indexOf("="))}}}function withPlaceholder(pair){let equals=pair.indexOf("=");return equals>=0?`${pair.slice(0,equals)}=${ENV_VALUE_PLACEHOLDER}`:pair}function quoteToken(token){return token===PROJECT_PLACEHOLDER||/^[A-Za-z0-9_./@:=,+-]+$/.test(token)?token:quoteArg(token)}async function getDeploymentChecks(client,deploymentId){return await client.fetch(`/v1/deployments/${encodeURIComponent(deploymentId)}/checks`)}async function getDeploymentCheckRuns(client,deploymentId){return await client.fetch(`/v2/deployments/${encodeURIComponent(deploymentId)}/check-runs`)}function parseNdjson(text){let entries=[];for(let line of text.split(`
|
|
8
8
|
`))if(line.trim())try{entries.push(JSON.parse(line))}catch{}return entries}async function getDeploymentCheckRunLogs(client,deploymentId,checkRunId){let url=`/v2/deployments/${encodeURIComponent(deploymentId)}/check-runs/${encodeURIComponent(checkRunId)}/logs`;await new Promise(resolve3=>setTimeout(resolve3,1e3));for(let attempt=0;attempt<5;attempt++){attempt>0&&await new Promise(resolve3=>setTimeout(resolve3,2e3));let res=await client.fetch(url,{json:!1}),text=typeof res=="string"?res:await res.text(),entries=parseNdjson(text);if(entries.some(e=>e.level==="eof"))return entries.filter(e=>e.level!=="eof"&&e.level!=="debug").map(({level,timestamp,message})=>({level,timestamp,message}))}return[]}var import_fs_extra=__toESM(require_lib(),1);import{join}from"path";async function getPrebuiltJson(directory){try{return await import_fs_extra.default.readJSON(join(directory,"builds.json"))}catch{}return null}import{resolve}from"path";var SUPPORTED_PROVIDERS=new Set(["github","gitlab","bitbucket"]),defaultDeps={getGitConfigPath,parseGitConfig,fetchProject:(client,project)=>client.fetch(`/v9/projects/${encodeURIComponent(project.id)}`,{accountId:project.accountId}),buildCommand:(client,command)=>withGlobalFlags(client,command,{preserveProject:!0})};async function getGitConnectRecommendation(client,cwd,project,options={}){let{alreadyOffered=!1,fetchedProject,deps=defaultDeps}=options;try{if(project.link||alreadyOffered)return;let gitConfigPath=deps.getGitConfigPath({cwd});if(!gitConfigPath)return;let gitConfig=await deps.parseGitConfig(gitConfigPath),remoteUrls=gitConfig&&pluckRemoteUrls(gitConfig);if(!remoteUrls)return;let remotes=Object.values(remoteUrls),{parseRepoUrl}=await import("../../chunks/connect-git-provider-CIRRFPI2.js");if(!remotes.some(remoteUrl=>{let repo=parseRepoUrl(remoteUrl);return repo&&SUPPORTED_PROVIDERS.has(repo.provider)})||client.nonInteractive&&remotes.length!==1||(fetchedProject??await deps.fetchProject(client,project)).link)return;let cwdFlag=resolve(cwd)===resolve(client.cwd)?"":` --cwd ${quoteArg(cwd)}`;return deps.buildCommand(client,`git connect${cwdFlag}`)}catch(error){output_manager_default.debug(`Failed to resolve Git connection guidance: ${error}`);return}}var import_types=__toESM(require_types(),1),validArchiveFormats=new Set(import_types.VALID_ARCHIVE_FORMATS);function isValidArchive(archive){return validArchiveFormats.has(archive)}var DEPRECATED_SHORTHANDS={"-e":"--env","-b":"--build-env"};function getDeployFlagsSpecification(options){return{...getFlagsSpecification(options),...DEPRECATED_SHORTHANDS}}function warnDeprecatedShorthands(client,options){let flags;try{({flags}=parseArguments(client.argv.slice(2),{...getFlagsSpecification(options),"-e":[String],"-b":[String]},{permissive:!0}))}catch{return}for(let[shorthand,name]of Object.entries(DEPRECATED_SHORTHANDS))flags[shorthand]!==void 0&&warnDeprecatedInput(client,shorthand,name)}function getErrorCta(source){if(typeof source.ctaLabel=="string"&&typeof source.ctaUrl=="string")return{label:source.ctaLabel,url:source.ctaUrl};if(typeof source.action=="string"&&typeof source.link=="string")return{label:source.action,url:source.link}}import{readFile}from"fs/promises";async function promptExperimentalServicesMigration(options){return await mayHaveLegacyServicesConfig(options)?(await import("../../chunks/migrate-experimental-services-7ZYHE5WA.js")).promptExperimentalServicesMigration(options):!1}async function mayHaveLegacyServicesConfig({cwd,allowConfigExecution=!0}){try{if(!allowConfigExecution||await findSourceVercelConfigFile(cwd))return!0;let{configPath}=await compileVercelConfig(cwd);return configPath?(await readFile(configPath,"utf8")).includes("experimentalServices"):!1}catch{return!0}}var import_fs_extra3=__toESM(require_lib(),1);import{join as join3}from"path";var import_fs_extra2=__toESM(require_lib(),1),import_ci_info=__toESM(require_ci_info(),1),import_build_utils=__toESM(require_build_utils(),1),import_error_utils=__toESM(require_dist(),1);import{join as join2}from"path";var VERCEL_DIR_ANONYMOUS="anonymous.json";function anonymousStatePath(cwd){return join2(cwd,VERCEL_DIR,VERCEL_DIR_ANONYMOUS)}async function readAnonymousState(cwd){try{let state=await(0,import_fs_extra2.readJSON)(anonymousStatePath(cwd));if(typeof state?.projectId=="string"&&typeof state.token=="string"&&typeof state.claimUrl=="string"&&typeof state.expiresAt=="number")return state}catch{}return null}async function writeAnonymousState(cwd,state){let path=anonymousStatePath(cwd);await(0,import_fs_extra2.outputJSON)(path,state,{spaces:2,mode:384}),await(0,import_fs_extra2.chmod)(path,384),await addToGitIgnore(cwd)}async function clearAnonymousState(cwd){await(0,import_fs_extra2.remove)(anonymousStatePath(cwd))}async function bootstrapAnonymousProject(client){let{projectId,token,claimUrl,expiresAt}=await client.fetch("/v1/anonymous/projects?surface=cli",{method:"POST",body:{},useCurrentTeam:!1,retry:{retries:0}});return{projectId,token,claimUrl,expiresAt}}async function ensureAnonymousLink(client,cwd,{requireExistingState=!1,confirmed=!0}={}){if(import_ci_info.default.isCI||!!((0,import_build_utils.getPlatformEnv)("ORG_ID")&&(0,import_build_utils.getPlatformEnv)("PROJECT_ID"))||!!await getLinkFromDir(getVercelDirectory(cwd))||!!(await getRepoLink(client,cwd))?.repoConfig)return"refused";let state=await readAnonymousState(cwd);if(state&&state.expiresAt<=Date.now())return output_manager_default.prettyError({message:`Your temporary deployment has expired. Run ${getCommandName("login")} to create an account and keep deploying this app.`}),"failed";if(!state&&requireExistingState)return"refused";if(!confirmed&&!state)return"confirmation-required";if(!state){try{state=await bootstrapAnonymousProject(client),trackCreatedId(client,"project",state.projectId)}catch(err){return output_manager_default.debug(`Anonymous bootstrap failed: ${(0,import_error_utils.errorToString)(err)}`),"refused"}await writeAnonymousState(cwd,state),output_manager_default.log("Not authenticated. Deploying anonymously.")}return client.authConfig={token:state.token,skipWrite:!0},delete process.env.VERCEL_TEAM_ID,{status:"linked",anonymous:!0,expiresAt:state.expiresAt,claimUrl:state.claimUrl,org:{type:"user",id:"",slug:"anonymous"},project:{id:state.projectId,name:state.projectId}}}function validateAnonymousTarget(isAnonymous,target){return isAnonymous&&target&&target!=="production"?(output_manager_default.error(`Anonymous deployments always target production, so "${target}" is not available. Remove the ${param("--environment")} option, or run ${getCommandName("login")} to deploy to other environments.`),!1):!0}async function setupAnonymousDeployment(client,cwd,{isAnonymous,dryRun}){isAnonymous||await clearAnonymousState(cwd);let anonymousLink;if(isAnonymous){let anonymous=await ensureAnonymousLink(client,cwd,{requireExistingState:dryRun});if(anonymous==="refused"){output_manager_default.log("Temporary deployments aren't available for this attempt. Log in to continue.");let{default:promptMissingCredentials}=await import("../../chunks/prompt-missing-credentials-AHAH27TZ.js"),loginExitCode=await promptMissingCredentials(client);if(loginExitCode!==0)return loginExitCode;isAnonymous=!1}else{if(anonymous==="failed")return 1;if(anonymous==="confirmation-required")return 1;anonymousLink=anonymous}}return{isAnonymous,anonymousLink}}async function handleAnonymousDeploymentError({client,cwd,error,link,isV0,retry}){if(!(!link||!isAPIError(error))){if(error.code==="anonymous_project_claimed"){if(client.nonInteractive||!client.stdin.isTTY)return output_manager_default.prettyError({message:`This project was claimed successfully. Run ${getCommandName("login")} to continue deploying it.`}),1;output_manager_default.log("This project was claimed successfully. Log in to continue deploying it.");let loginExitCode;try{let{default:login}=await import("../../chunks/login-O6NLJ42W.js");loginExitCode=await login(client,{shouldParseArgs:!1})}catch(loginError){return printError(loginError),1}if(loginExitCode!==0)return loginExitCode;let claimedProjectLink=await ensureLink("deploy",client,cwd,{autoConfirm:!0,projectName:link.project.id,failIfNotFound:!0,allowOwnerLookupFallback:!0,v0:isV0});return typeof claimedProjectLink=="number"?claimedProjectLink:(await linkFolderToProject(client,cwd,{projectId:claimedProjectLink.project.id,orgId:claimedProjectLink.org.id},claimedProjectLink.project.name,claimedProjectLink.org.slug,"link",!0,!1),await clearAnonymousState(cwd),retry())}if(error.status===401||error.status===410)return await clearAnonymousState(cwd),output_manager_default.prettyError({message:`Your temporary deployment has expired. Run ${getCommandName("login")} to create an account and keep deploying this app.`}),1}}async function runImplicitBuild(client,cwd){let projectJsonPath=join3(cwd,VERCEL_DIR,VERCEL_DIR_PROJECT),projectJsonExists=await import_fs_extra3.default.pathExists(projectJsonPath);projectJsonExists||await import_fs_extra3.default.outputJSON(projectJsonPath,{settings:{}},{spaces:2}),await import_fs_extra3.default.pathExists(join3(cwd,"package.json"))&&output_manager_default.log("Building your project locally\u2026");let originalArgv=client.argv,originalCwd=client.cwd,originalStdout=client.stdout,previousVercelFirstDeployment=process.env.VERCEL_FIRST_DEPLOYMENT;client.cwd=cwd,client.setArgv([...originalArgv.slice(0,2),"build","--prod","--yes"]),process.env.VERCEL_FIRST_DEPLOYMENT="1",client.stdout=createSinkStream();try{let build=(await import("../build/index.js")).default;return await build(client)}finally{client.setArgv(originalArgv),client.cwd=originalCwd,client.stdout=originalStdout,previousVercelFirstDeployment===void 0?delete process.env.VERCEL_FIRST_DEPLOYMENT:process.env.VERCEL_FIRST_DEPLOYMENT=previousVercelFirstDeployment,projectJsonExists||await import_fs_extra3.default.remove(projectJsonPath)}}function createSinkStream(){return{isTTY:!1,write:()=>!0}}var COMMAND_CONFIG={init:getCommandAliases(initSubcommand),continue:getCommandAliases(continueSubcommand),describe:getCommandAliases(describeSubcommand)},deploy_default=async client=>{let telemetryClient=new DeployTelemetryClient({opts:{store:client.telemetryEventStore}}),parsedArguments=null,flagsSpecification=getDeployFlagsSpecification(deployCommand.options);try{parsedArguments=parseArguments(client.argv.slice(2),flagsSpecification,{permissive:!0})}catch(error){return printError(error),2}let subArgs=parsedArguments.args[0]===deployCommand.name?parsedArguments.args.slice(1):parsedArguments.args,{subcommand,subcommandOriginal}=getSubcommand(subArgs,COMMAND_CONFIG);function printSubcommandHelp(command){output_manager_default.print(help(command,{stream:client.stderr,parent:deployCommand,columns:client.stderr.columns}))}switch(subcommand){case"init":return parsedArguments.flags["--help"]?(telemetryClient.trackCliFlagHelp("deploy",subcommandOriginal),printSubcommandHelp(initSubcommand),0):(telemetryClient.trackCliSubcommandInit(subcommandOriginal),handleInitDeployment(client,telemetryClient));case"continue":return parsedArguments.flags["--help"]?(telemetryClient.trackCliFlagHelp("deploy",subcommandOriginal),printSubcommandHelp(continueSubcommand),0):(telemetryClient.trackCliSubcommandContinue(subcommandOriginal),handleContinueSubcommand(client,telemetryClient));case"describe":return parsedArguments.flags["--help"]?(telemetryClient.trackCliFlagHelp("deploy",subcommandOriginal),printSubcommandHelp(describeSubcommand),0):(telemetryClient.trackCliSubcommandDescribe(subcommandOriginal),(await import("../../chunks/describe-442UUQIF.js")).default(client));default:return parsedArguments.flags["--help"]?(telemetryClient.trackCliFlagHelp("deploy"),output_manager_default.print(help(deployCommand,{stream:client.stderr,columns:client.stderr.columns})),0):handleDefaultDeploy(client,telemetryClient)}};async function handleInitDeployment(client,telemetryClient){let flagsSpecification=getDeployFlagsSpecification(initSubcommand.options),parsedArguments;try{parsedArguments=parseArguments(client.argv.slice(2),flagsSpecification)}catch(error2){return printError(error2),2}warnDeprecatedShorthands(client,initSubcommand.options),telemetryClient.trackCliFlagJson(parsedArguments.flags["--json"]),telemetryClient.trackCliOptionFormat(parsedArguments.flags["--format"]),telemetryClient.trackCliOptionProject(parsedArguments.flags["--project"]);let projectNameOrId=parsedArguments.flags["--project"],formatResult=validateJsonOutput(parsedArguments.flags);if(!formatResult.valid)return output_manager_default.error(formatResult.error),2;let asJson=formatResult.jsonOutput||client.nonInteractive;if(!applyDeprecatedTargetFlag(client,parsedArguments.flags))return 2;let envPlaceholderExit=rejectEnvPlaceholder(client,parsedArguments.flags,"deploy init --help");if(envPlaceholderExit!==void 0)return envPlaceholderExit;let args=parsedArguments.args;args[0]==="deploy"&&(args=args.slice(1)),args[0]==="init"&&(args=args.slice(1));let paths;args.length>0?(paths=args.map(item=>resolve2(client.cwd,item)),telemetryClient.trackCliArgumentProjectPath(paths[0])):paths=[client.cwd];let pathValidation=await validatePaths(client,paths);if(!pathValidation.valid)return pathValidation.exitCode;await compileVercelConfig(paths[0]);let localConfig=paths[0]===client.cwd?client.localConfig||readLocalConfig(paths[0]):readLocalConfig(paths[0]);if(localConfig){client.localConfig=localConfig;let{version}=localConfig,file=highlight(localConfig[import_client.fileNameSymbol]),prop=code("version");if(version)if(typeof version=="number"){if(version!==2){let two=code(String(2));return output_manager_default.error(`The value of the ${prop} property within ${file} can only be ${two}.`),1}}else return output_manager_default.error(`The ${prop} property inside your ${file} file must be a number.`),1}let{log,debug,error}=output_manager_default,quiet=!client.stdout.isTTY,{path:cwd}=pathValidation,autoConfirm=parsedArguments.flags["--yes"],target=parseTarget({flagName:"environment",flags:parsedArguments.flags});telemetryClient.trackTargetEnvironment(target);let parsedArchive=parsedArguments.flags["--archive"];if(typeof parsedArchive=="string"&&!(isValidArchive(parsedArchive)||parsedArchive===deprecatedArchiveSplitTgz))return output_manager_default.error(`Format must be one of: ${import_client.VALID_ARCHIVE_FORMATS.join(", ")}`),2;parsedArchive===deprecatedArchiveSplitTgz&&output_manager_default.print(`${prependEmoji(`${param("--archive=tgz")} now has the same behavior as ${param("--archive=split-tgz")}. Please use ${param("--archive=tgz")} instead.`,emoji("warning"))}
|
|
9
9
|
`);let cliMeta=parseMeta(parsedArguments.flags["--meta"]),isV0=cliMeta.v0==="true";getGitExecutable(cwd);let refuseInitFirstDeployment=newProject=>refuseFirstDeployment(client,{target,newProject,prodCommand:buildProdCommand(["init",...args],parsedArguments.flags,client.argv)}),link=await ensureLink("deploy",client,cwd,{autoConfirm,projectName:projectNameOrId??localConfig?.name,failIfNotFound:!!projectNameOrId,v0:isV0,beforeCreateProject:isNonProductionTarget(target)?()=>refuseInitFirstDeployment(!0):void 0});if(typeof link=="number")return link;let{org,project}=link,rootDirectory=project.rootDirectory,sourceFilesOutsideRootDirectory=project.sourceFilesOutsideRootDirectory??!0;link.repoRoot&&(cwd=link.repoRoot);let contextName=org.slug;if(client.config.currentTeam=org.type==="team"?org.id:void 0,isNonProductionTarget(target)&&!await hasEarlierDeployment(client,org,project.id,isRemoteLookupSkippedLink(link)?void 0:project.latestDeployments))return refuseInitFirstDeployment(!1);if(rootDirectory&&await validateRootDirectory(cwd,join4(cwd,rootDirectory),project?`To change your Project Settings, go to https://vercel.com/${org?.slug}/${project.name}/settings`:"")===!1)return 1;if(await promptExperimentalServicesMigration({client,cwd:join4(cwd,rootDirectory||""),autoConfirm:!!parsedArguments.flags["--yes"],nonInteractive:client.nonInteractive})&&(localConfig=readLocalConfig(join4(cwd,rootDirectory||""))),rootDirectory){let rootDirectoryPath=join4(cwd,rootDirectory);await compileVercelConfig(rootDirectoryPath);let rootDirectoryConfig=readLocalConfig(rootDirectoryPath);rootDirectoryConfig?(debug(`Read local config from root directory (${rootDirectory})`),localConfig=rootDirectoryConfig):localConfig&&output_manager_default.print(`${prependEmoji(`The ${highlight(localConfig[import_client.fileNameSymbol])} file should be inside of the provided root directory.`,emoji("warning"))}
|
|
10
10
|
`)}localConfig=localConfig||{},localConfig.name&&output_manager_default.print(`${prependEmoji(`The ${code("name")} property in ${highlight(localConfig[import_client.fileNameSymbol])} is deprecated (https://vercel.link/name-prop)`,emoji("warning"))}
|
|
@@ -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_dist3}from"../../chunks/chunk-JELLVPCM.js";import{getCustomEnvironments}from"../../chunks/chunk-Z73UJVGD.js";import{suggestNextCommands}from"../../chunks/chunk-AMH5MXDW.js";import{formatEnvironment}from"../../chunks/chunk-YEUIG3JC.js";import{ellipsis}from"../../chunks/chunk-AKOYIH3A.js";import"../../chunks/chunk-TOTTVS5P.js";import{CHECKBOX_INSTRUCTIONS}from"../../chunks/chunk-OFDTADPQ.js";import{readStandardInput}from"../../chunks/chunk-PSOVLGHP.js";import"../../chunks/chunk-XOETL6DB.js";import{jsonNextStep,runWithJsonOutput,writeJsonResult}from"../../chunks/chunk-EAQAV7UZ.js";import{require_execa}from"../../chunks/chunk-M32HBBPK.js";import{formatTable}from"../../chunks/chunk-YIOMTAUF.js";import"../../chunks/chunk-KRP4EMD2.js";import{stamp_default}from"../../chunks/chunk-A2RZZQEP.js";import"../../chunks/chunk-Q7D7RGXM.js";import{ENV_VISIBILITY_DEPRECATION_MESSAGE,SENSITIVE_ENV_VALUE_PLACEHOLDER,VERCEL_OIDC_TOKEN,formatVisibilityLabel,getApiPublicPrefix,getEnvKeyWarnings,getFrameworkPublicPrefix,getLocalSecretFallbackMessage,getLocalSvelteKitPublicPrefixes,getPublicPrefix,getPublicPrefixSecretVisibilityError,getUnavailableSecretValuesMessage,isFlagsSecretNeedingSplit,isSecretEnvVar,looksLikeSecret,looksLikeSecretValue,normalizeStdinEnvValue,pull,removePublicPrefix,resolveEnvVarTypeOption,resolveEnvVarVisibility,shouldConfirmRotationBeforeDelete,validateEnvValue,visibilityFromEnvType}from"../../chunks/chunk-YI7NKOCU.js";import{getEnvRecords,pullEnvRecords}from"../../chunks/chunk-2AU6O6Z5.js";import"../../chunks/chunk-ZKNEIE44.js";import"../../chunks/chunk-KR4DMT3I.js";import{parseTarget}from"../../chunks/chunk-LNZEYUEC.js";import"../../chunks/chunk-AIXEVICT.js";import"../../chunks/chunk-S4AANAHX.js";import{resolveProjectContext}from"../../chunks/chunk-VF7XWPXA.js";import{STANDARD_ENVIRONMENTS}from"../../chunks/chunk-7YKFF6CE.js";import{formatProject}from"../../chunks/chunk-3UZE566G.js";import"../../chunks/chunk-TSNRTRIM.js";import{isGuidanceEnabled}from"../../chunks/chunk-TAAWMNNL.js";import"../../chunks/chunk-25565AGS.js";import"../../chunks/chunk-PVASGBEF.js";import"../../chunks/chunk-SXW2G4WD.js";import"../../chunks/chunk-QGHAD5A5.js";import"../../chunks/chunk-NBTFAXL4.js";import"../../chunks/chunk-TJUZVODP.js";import"../../chunks/chunk-GD7AV7BO.js";import{buildApprovalCommand,requireApproval}from"../../chunks/chunk-SYVWRGFQ.js";import"../../chunks/chunk-F4UEGELU.js";import"../../chunks/chunk-XDWAUOFO.js";import{getInvalidSubcommand}from"../../chunks/chunk-TG2RCYTH.js";import"../../chunks/chunk-IQ7FPAI4.js";import{trackCreatedId}from"../../chunks/chunk-YJNMDXEG.js";import{withWarnings}from"../../chunks/chunk-OF32Z3UP.js";import{getSubcommand}from"../../chunks/chunk-ETV3C2CV.js";import{validateLsArgs}from"../../chunks/chunk-Q66LJNIV.js";import"../../chunks/chunk-CJZE7647.js";import"../../chunks/chunk-PFOOPXTN.js";import"../../chunks/chunk-DOMBKOLJ.js";import{getCommandAliases}from"../../chunks/chunk-DEM66DOY.js";import"../../chunks/chunk-IIK6GUVI.js";import"../../chunks/chunk-K3MGQQEP.js";import"../../chunks/chunk-DDPH26ZO.js";import"../../chunks/chunk-PIDEH4SJ.js";import"../../chunks/chunk-C35SG42R.js";import"../../chunks/chunk-2GBU6ULJ.js";import"../../chunks/chunk-EJLYDHT7.js";import"../../chunks/chunk-DOBV3XLO.js";import"../../chunks/chunk-TUB3APDV.js";import"../../chunks/chunk-BMIYC2MH.js";import"../../chunks/chunk-6CJFPT4F.js";import"../../chunks/chunk-ZZD5W5KT.js";import"../../chunks/chunk-VHSAI6FS.js";import"../../chunks/chunk-F7L5SXJM.js";import"../../chunks/chunk-GLCSWIB4.js";import"../../chunks/chunk-XECELSF5.js";import"../../chunks/chunk-6FYPSSL4.js";import"../../chunks/chunk-UQZZX2J7.js";import"../../chunks/chunk-UDZJCD5W.js";import"../../chunks/chunk-5ZCSFPWG.js";import"../../chunks/chunk-RVIJRFVD.js";import"../../chunks/chunk-XDYVJWGX.js";import"../../chunks/chunk-JALVF3C2.js";import{addSubcommand,envCommand,envTargetChoices,getEnvTargetPlaceholder,isValidEnvTarget,listSubcommand,parseEnvTargetArg,pullSubcommand,removeSubcommand,resolveEnvTargetInput,runSubcommand,updateSubcommand}from"../../chunks/chunk-VZ4URN3U.js";import"../../chunks/chunk-AB4WXRCO.js";import"../../chunks/chunk-SYJXONEV.js";import{printError}from"../../chunks/chunk-33HVDSWP.js";import"../../chunks/chunk-BDXK4TCN.js";import{help}from"../../chunks/chunk-5KSBRQI2.js";import{param}from"../../chunks/chunk-3G3FQYMW.js";import"../../chunks/chunk-NLK7NGVP.js";import{TelemetryClient,readLaunch}from"../../chunks/chunk-KDCODXVL.js";import"../../chunks/chunk-NWGBDBZI.js";import{getLinkFromDir,getOrgSlug,getVercelDirectory}from"../../chunks/chunk-Z2KANBOU.js";import{printAlignedLabel}from"../../chunks/chunk-M7FED5YP.js";import"../../chunks/chunk-4HR3I3ML.js";import"../../chunks/chunk-DJZBJC2A.js";import"../../chunks/chunk-LUX4PBJL.js";import"../../chunks/chunk-MTZYPCZ7.js";import"../../chunks/chunk-OPORM35X.js";import"../../chunks/chunk-D6REP5QQ.js";import"../../chunks/chunk-FBYA6LLM.js";import"../../chunks/chunk-MY4MONOH.js";import"../../chunks/chunk-UG3FZ5Q7.js";import{require_ms}from"../../chunks/chunk-MXTC4ZAQ.js";import{parseArguments}from"../../chunks/chunk-CINNNQDJ.js";import{buildCommandWithYes,buildEnvAddCommandWithPreservedArgs,buildEnvRmCommandWithPreservedArgs,buildEnvUpdateCommandWithPreservedArgs,getLinkSuggestionArgs,getPreservedArgsForEnvAdd,getPreservedArgsForEnvRm,getPreservedArgsForEnvUpdate,getTeamByIdOrSlug,outputActionRequired,outputAgentError,redactEnvValueArgs,withGlobalFlags}from"../../chunks/chunk-4SS6W6JK.js";import{validateJsonOutput}from"../../chunks/chunk-FEJD7MRH.js";import"../../chunks/chunk-AW33SRYY.js";import"../../chunks/chunk-4NTBYNFR.js";import"../../chunks/chunk-4SAVH3H7.js";import{isAPIError}from"../../chunks/chunk-GOI2VVI7.js";import{getCommandName,getCommandNamePlain,require_lib}from"../../chunks/chunk-B4KA3ZH2.js";import"../../chunks/chunk-BOJDM3O7.js";import{emoji,output_manager_default,prependEmoji}from"../../chunks/chunk-AP6DZGTK.js";import"../../chunks/chunk-BLUPZPAS.js";import{require_build_utils}from"../../chunks/chunk-5MDNVAE6.js";import"../../chunks/chunk-OCR5CRTH.js";import"../../chunks/chunk-7EJQLVWX.js";import"../../chunks/chunk-SCV7XEEO.js";import{require_dist}from"../../chunks/chunk-MCYG7CCE.js";import"../../chunks/chunk-YHPPP3SF.js";import{require_dist as require_dist2}from"../../chunks/chunk-24SIHFEW.js";import"../../chunks/chunk-GLIQ4KNY.js";import{getFlagsSpecification,getGlobalFlagsFromArgs,quoteArg}from"../../chunks/chunk-CFJBDBYH.js";import"../../chunks/chunk-2BKALEOP.js";import{require_source}from"../../chunks/chunk-NB2WLB3J.js";import"../../chunks/chunk-ISWW3DKF.js";import"../../chunks/chunk-BRQUZ5NC.js";import{require_strip_ansi}from"../../chunks/chunk-BULSRTQE.js";import{__toESM}from"../../chunks/chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);var import_constants=__toESM(require_dist2(),1);async function addEnvRecord(client,projectId,upsert,type,key,value,targets,gitBranch,visibility){let actionWord=upsert?"Overriding":"Adding";output_manager_default.debug(`${actionWord} ${type} Environment Variable ${key} to ${targets.length} targets`);let target=[],customEnvironmentIds=[];for(let t of targets)(import_constants.PROJECT_ENV_TARGET.includes(t)?target:customEnvironmentIds).push(t);let body={type,key,value,target,customEnvironmentIds:customEnvironmentIds.length>0?customEnvironmentIds:void 0,gitBranch:gitBranch||void 0,...visibility!==void 0?{visibility}:{}},args=upsert?`?upsert=${upsert}`:"",url=`/v10/projects/${projectId}/env${args}`,result=await client.fetch(url,{method:"POST",body});trackCreatedId(client,"env-var",result?.created?.id)}var import_error_utils=__toESM(require_dist(),1),knownErrorsCodes=new Set(["BAD_REQUEST","ENV_ALREADY_EXISTS","ENV_CONFLICT","EXISTING_KEY_AND_TARGET","FORBIDDEN","ID_NOT_FOUND","INVALID_KEY","INVALID_VALUE","KEY_INVALID_CHARACTERS","KEY_INVALID_LENGTH","KEY_RESERVED","RESERVED_ENV_VARIABLE","MAX_ENVS_EXCEEDED","MISSING_ID","MISSING_KEY","MISSING_TARGET","MISSING_VALUE","NOT_AUTHORIZED","NOT_DECRYPTABLE","SYSTEM_ENV_WITH_VALUE","TEAM_NOT_FOUND","TOO_MANY_IDS","TOO_MANY_KEYS","UNKNOWN_ERROR","VALUE_INVALID_LENGTH","VALUE_INVALID_TYPE"]);function isKnownError(error){let code=(0,import_error_utils.isErrnoException)(error)?error.code:null;return code?knownErrorsCodes.has(code.toUpperCase()):!1}var EnvAddTelemetryClient=class extends TelemetryClient{trackCliArgumentName(name){name&&this.trackCliArgument({arg:"name",value:this.redactedValue})}trackCliArgumentEnvironment(environment){if(environment){let allStandard=environment.split(",").map(t=>t.trim()).every(t=>STANDARD_ENVIRONMENTS.includes(t));this.trackCliArgument({arg:"environment",value:allStandard?environment:this.redactedValue})}}trackCliArgumentGitBranch(gitBranch){gitBranch&&this.trackCliArgument({arg:"git-branch",value:this.redactedValue})}trackCliOptionGitBranch(gitBranch){gitBranch&&this.trackCliOption({option:"git-branch",value:this.redactedValue})}trackCliOptionEnvironment(environments){if(environments&&environments.length>0){let allStandard=environments.flatMap(environment=>environment.split(",")).map(t=>t.trim()).every(t=>STANDARD_ENVIRONMENTS.includes(t));this.trackCliOption({option:"environment",value:allStandard?environments.join(","):this.redactedValue})}}trackCliOptionValue(value){value&&this.trackCliOption({option:"value",value:this.redactedValue})}trackCliOptionVisibility(visibility){if(visibility){let validVisibilities=["config","secret"];this.trackCliOption({option:"visibility",value:validVisibilities.includes(visibility)?visibility:this.redactedValue})}}trackCliOptionType(type){if(type){let validTypes=["config","secret"];this.trackCliOption({option:"type",value:validTypes.includes(type)?type:this.redactedValue})}}trackCliFlagSensitive(sensitive){sensitive&&this.trackCliFlag("sensitive")}trackCliFlagNoSensitive(noSensitive){noSensitive&&this.trackCliFlag("no-sensitive")}trackCliFlagForce(force){force&&this.trackCliFlag("force")}trackCliFlagGuidance(guidance){guidance&&this.trackCliFlag("guidance")}trackCliFlagYes(yes){yes&&this.trackCliFlag("yes")}trackCliFlagJson(json){json&&this.trackCliFlag("json")}};import{determineAgent}from"@vercel/detect-agent";function includesDevelopment(targets){return targets.length===0||targets.includes("development")}function getProductionSecretPolicyErrorKind(message){return/production secrets?.*different value|different value.*production secrets?/i.test(message)?"different-values":/production secrets?.*(?:own environment group|separat)|(?:own environment group|separat).*production secrets?/i.test(message)?"separate-environments":null}function getProductionSecretPolicyRecovery(kind){return kind==="different-values"?"Use different Secret values for Production and non-Production.":"Create separate Production and non-Production variables with different values."}function getSecretStorageChoice(targets,recommendedReason){let availability=includesDevelopment(targets)?"hidden in the dashboard; Development values can be pulled":"hidden in the dashboard and unavailable to pulls",recommendation=recommendedReason?`; recommended ${recommendedReason}`:"";return`Secret (${availability}${recommendation})`}function getDefaultSecretStorageGuidance(targets){return includesDevelopment(targets)?"Stored as Secret by default. This value is hidden in the dashboard; Development values can be pulled. Use `--type config` for other values you need to read later.":"Stored as Secret by default. This value is hidden in the dashboard and unavailable to pulls; use `--type config` for values you need to read later."}var import_strip_ansi=__toESM(require_strip_ansi(),1);function looksLikeCredentialName(key,publicPrefix=getPublicPrefix(key)){return looksLikeSecret(publicPrefix?key.slice(publicPrefix.length):key)}function filterEnvChoicesForSensitivity(choices,opts){return opts.policyOn?choices.filter(c=>c.value==="development"):choices}function getTargetCompatibilityError(envTargets,isSensitive,policyOn){let hasSensitiveCapable=envTargets.some(t=>t!=="development");return!isSensitive&&policyOn&&hasSensitiveCapable?`Your team requires sensitive Environment Variables for Production and Preview. To add a non-sensitive value, add it to the Development Environment only. Run ${getCommandName("env add --environment development")} instead.`:null}function resolveFinalType(envTargets,isSensitive,opts){return envTargets.includes("development")&&!isSensitive||opts.forceEncrypted&&!opts.policyOn?"encrypted":isSensitive||opts.forceSensitive||opts.policyOn?"sensitive":"encrypted"}function fillEnvAddTemplate(template,opts){let targetPlaceholder=getEnvTargetPlaceholder();return template.replace(/<name>/g,opts.envName?quoteArg(opts.envName):"<name>").split(targetPlaceholder).join(opts.envTargetArg?quoteArg(opts.envTargetArg):targetPlaceholder).replace(/<BRANCH>/g,opts.envGitBranch?quoteArg(opts.envGitBranch):"<BRANCH>").replace(/<value>/g,"<value>")}function multiTargetSuggestion(argv,envName,targets,addNoSensitive){let flag=addNoSensitive?" --no-sensitive":"";return{command:buildEnvAddCommandWithPreservedArgs(argv,`env add ${envName} --environment ${targets.join(",")} --value "<value>"${flag} --yes`),when:addNoSensitive?"Add one non-sensitive variable to all listed environments":"Add one variable to multiple environments"}}function filterSensitiveMultiTargetSuggestionTargets(targets,_opts){return targets}function formatEnvironmentTarget(target,customEnvironments){let standardTarget=envTargetChoices.find(choice=>choice.value===target);return standardTarget?standardTarget.name:customEnvironments.find(env=>env.id===target||env.slug===target)?.slug??target}function formatEnvironmentTargets(envTargets,customEnvironments){return envTargets.map(target=>formatEnvironmentTarget(target,customEnvironments)).join(", ")}function printEnvAddResult(projectLabel,envName,envTargets,envGitBranch,customEnvironments,finalType,force,visibility){output_manager_default.print(`
|
|
7
|
+
import{require_dist as require_dist3}from"../../chunks/chunk-JELLVPCM.js";import{getCustomEnvironments}from"../../chunks/chunk-Z73UJVGD.js";import{suggestNextCommands}from"../../chunks/chunk-AMH5MXDW.js";import{formatEnvironment}from"../../chunks/chunk-YEUIG3JC.js";import{ellipsis}from"../../chunks/chunk-AKOYIH3A.js";import"../../chunks/chunk-TOTTVS5P.js";import{CHECKBOX_INSTRUCTIONS}from"../../chunks/chunk-OFDTADPQ.js";import{readStandardInput}from"../../chunks/chunk-PSOVLGHP.js";import"../../chunks/chunk-XOETL6DB.js";import{require_execa}from"../../chunks/chunk-M32HBBPK.js";import{formatTable}from"../../chunks/chunk-YIOMTAUF.js";import{jsonNextStep,runWithJsonOutput,writeJsonResult}from"../../chunks/chunk-EAQAV7UZ.js";import"../../chunks/chunk-KRP4EMD2.js";import{stamp_default}from"../../chunks/chunk-A2RZZQEP.js";import"../../chunks/chunk-Q7D7RGXM.js";import{ENV_VISIBILITY_DEPRECATION_MESSAGE,SENSITIVE_ENV_VALUE_PLACEHOLDER,VERCEL_OIDC_TOKEN,formatVisibilityLabel,getApiPublicPrefix,getEnvKeyWarnings,getFrameworkPublicPrefix,getLocalSecretFallbackMessage,getLocalSvelteKitPublicPrefixes,getPublicPrefix,getPublicPrefixSecretVisibilityError,getUnavailableSecretValuesMessage,isFlagsSecretNeedingSplit,isSecretEnvVar,looksLikeSecret,looksLikeSecretValue,normalizeStdinEnvValue,pull,removePublicPrefix,resolveEnvVarTypeOption,resolveEnvVarVisibility,shouldConfirmRotationBeforeDelete,validateEnvValue,visibilityFromEnvType}from"../../chunks/chunk-YI7NKOCU.js";import{getEnvRecords,pullEnvRecords}from"../../chunks/chunk-2AU6O6Z5.js";import"../../chunks/chunk-ZKNEIE44.js";import"../../chunks/chunk-KR4DMT3I.js";import{parseTarget}from"../../chunks/chunk-LNZEYUEC.js";import"../../chunks/chunk-AIXEVICT.js";import"../../chunks/chunk-S4AANAHX.js";import{resolveProjectContext}from"../../chunks/chunk-VF7XWPXA.js";import{STANDARD_ENVIRONMENTS}from"../../chunks/chunk-7YKFF6CE.js";import{formatProject}from"../../chunks/chunk-3UZE566G.js";import"../../chunks/chunk-TSNRTRIM.js";import{isGuidanceEnabled}from"../../chunks/chunk-TAAWMNNL.js";import"../../chunks/chunk-25565AGS.js";import"../../chunks/chunk-PVASGBEF.js";import"../../chunks/chunk-SXW2G4WD.js";import"../../chunks/chunk-QGHAD5A5.js";import"../../chunks/chunk-NBTFAXL4.js";import"../../chunks/chunk-TJUZVODP.js";import"../../chunks/chunk-GD7AV7BO.js";import{buildApprovalCommand,requireApproval}from"../../chunks/chunk-SYVWRGFQ.js";import"../../chunks/chunk-F4UEGELU.js";import"../../chunks/chunk-XDWAUOFO.js";import{getInvalidSubcommand}from"../../chunks/chunk-TG2RCYTH.js";import"../../chunks/chunk-IQ7FPAI4.js";import{trackCreatedId}from"../../chunks/chunk-YJNMDXEG.js";import{withWarnings}from"../../chunks/chunk-OF32Z3UP.js";import{getSubcommand}from"../../chunks/chunk-ETV3C2CV.js";import{validateLsArgs}from"../../chunks/chunk-Q66LJNIV.js";import"../../chunks/chunk-CJZE7647.js";import"../../chunks/chunk-PFOOPXTN.js";import"../../chunks/chunk-DOMBKOLJ.js";import{getCommandAliases}from"../../chunks/chunk-XR2J7PQN.js";import"../../chunks/chunk-K3MGQQEP.js";import"../../chunks/chunk-DDPH26ZO.js";import"../../chunks/chunk-PIDEH4SJ.js";import"../../chunks/chunk-IIK6GUVI.js";import"../../chunks/chunk-C35SG42R.js";import"../../chunks/chunk-2GBU6ULJ.js";import"../../chunks/chunk-DOBV3XLO.js";import"../../chunks/chunk-TUB3APDV.js";import"../../chunks/chunk-BMIYC2MH.js";import"../../chunks/chunk-6CJFPT4F.js";import"../../chunks/chunk-ZZD5W5KT.js";import"../../chunks/chunk-VHSAI6FS.js";import"../../chunks/chunk-F7L5SXJM.js";import"../../chunks/chunk-GLCSWIB4.js";import"../../chunks/chunk-XECELSF5.js";import"../../chunks/chunk-6FYPSSL4.js";import"../../chunks/chunk-UQZZX2J7.js";import"../../chunks/chunk-UDZJCD5W.js";import"../../chunks/chunk-5ZCSFPWG.js";import"../../chunks/chunk-RVIJRFVD.js";import"../../chunks/chunk-XDYVJWGX.js";import"../../chunks/chunk-JALVF3C2.js";import{addSubcommand,envCommand,envTargetChoices,getEnvTargetPlaceholder,isValidEnvTarget,listSubcommand,parseEnvTargetArg,pullSubcommand,removeSubcommand,resolveEnvTargetInput,runSubcommand,updateSubcommand}from"../../chunks/chunk-VZ4URN3U.js";import"../../chunks/chunk-AB4WXRCO.js";import"../../chunks/chunk-SYJXONEV.js";import{printError}from"../../chunks/chunk-33HVDSWP.js";import"../../chunks/chunk-BDXK4TCN.js";import{help}from"../../chunks/chunk-5KSBRQI2.js";import{param}from"../../chunks/chunk-3G3FQYMW.js";import"../../chunks/chunk-NLK7NGVP.js";import{TelemetryClient,readLaunch}from"../../chunks/chunk-KDCODXVL.js";import"../../chunks/chunk-NWGBDBZI.js";import{getLinkFromDir,getOrgSlug,getVercelDirectory}from"../../chunks/chunk-Z2KANBOU.js";import{printAlignedLabel}from"../../chunks/chunk-M7FED5YP.js";import"../../chunks/chunk-4HR3I3ML.js";import"../../chunks/chunk-DJZBJC2A.js";import"../../chunks/chunk-LUX4PBJL.js";import"../../chunks/chunk-MTZYPCZ7.js";import"../../chunks/chunk-OPORM35X.js";import"../../chunks/chunk-D6REP5QQ.js";import"../../chunks/chunk-FBYA6LLM.js";import"../../chunks/chunk-MY4MONOH.js";import"../../chunks/chunk-UG3FZ5Q7.js";import{require_ms}from"../../chunks/chunk-MXTC4ZAQ.js";import{parseArguments}from"../../chunks/chunk-CINNNQDJ.js";import{buildCommandWithYes,buildEnvAddCommandWithPreservedArgs,buildEnvRmCommandWithPreservedArgs,buildEnvUpdateCommandWithPreservedArgs,getLinkSuggestionArgs,getPreservedArgsForEnvAdd,getPreservedArgsForEnvRm,getPreservedArgsForEnvUpdate,getTeamByIdOrSlug,outputActionRequired,outputAgentError,redactEnvValueArgs,withGlobalFlags}from"../../chunks/chunk-4SS6W6JK.js";import{validateJsonOutput}from"../../chunks/chunk-FEJD7MRH.js";import"../../chunks/chunk-AW33SRYY.js";import"../../chunks/chunk-4NTBYNFR.js";import"../../chunks/chunk-4SAVH3H7.js";import{isAPIError}from"../../chunks/chunk-GOI2VVI7.js";import{getCommandName,getCommandNamePlain,require_lib}from"../../chunks/chunk-B4KA3ZH2.js";import"../../chunks/chunk-BOJDM3O7.js";import{emoji,output_manager_default,prependEmoji}from"../../chunks/chunk-AP6DZGTK.js";import"../../chunks/chunk-BLUPZPAS.js";import{require_build_utils}from"../../chunks/chunk-5MDNVAE6.js";import"../../chunks/chunk-OCR5CRTH.js";import"../../chunks/chunk-7EJQLVWX.js";import"../../chunks/chunk-SCV7XEEO.js";import{require_dist}from"../../chunks/chunk-MCYG7CCE.js";import"../../chunks/chunk-YHPPP3SF.js";import{require_dist as require_dist2}from"../../chunks/chunk-24SIHFEW.js";import"../../chunks/chunk-GLIQ4KNY.js";import{getFlagsSpecification,getGlobalFlagsFromArgs,quoteArg}from"../../chunks/chunk-CFJBDBYH.js";import"../../chunks/chunk-2BKALEOP.js";import{require_source}from"../../chunks/chunk-NB2WLB3J.js";import"../../chunks/chunk-ISWW3DKF.js";import"../../chunks/chunk-BRQUZ5NC.js";import{require_strip_ansi}from"../../chunks/chunk-BULSRTQE.js";import{__toESM}from"../../chunks/chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);var import_constants=__toESM(require_dist2(),1);async function addEnvRecord(client,projectId,upsert,type,key,value,targets,gitBranch,visibility){let actionWord=upsert?"Overriding":"Adding";output_manager_default.debug(`${actionWord} ${type} Environment Variable ${key} to ${targets.length} targets`);let target=[],customEnvironmentIds=[];for(let t of targets)(import_constants.PROJECT_ENV_TARGET.includes(t)?target:customEnvironmentIds).push(t);let body={type,key,value,target,customEnvironmentIds:customEnvironmentIds.length>0?customEnvironmentIds:void 0,gitBranch:gitBranch||void 0,...visibility!==void 0?{visibility}:{}},args=upsert?`?upsert=${upsert}`:"",url=`/v10/projects/${projectId}/env${args}`,result=await client.fetch(url,{method:"POST",body});trackCreatedId(client,"env-var",result?.created?.id)}var import_error_utils=__toESM(require_dist(),1),knownErrorsCodes=new Set(["BAD_REQUEST","ENV_ALREADY_EXISTS","ENV_CONFLICT","EXISTING_KEY_AND_TARGET","FORBIDDEN","ID_NOT_FOUND","INVALID_KEY","INVALID_VALUE","KEY_INVALID_CHARACTERS","KEY_INVALID_LENGTH","KEY_RESERVED","RESERVED_ENV_VARIABLE","MAX_ENVS_EXCEEDED","MISSING_ID","MISSING_KEY","MISSING_TARGET","MISSING_VALUE","NOT_AUTHORIZED","NOT_DECRYPTABLE","SYSTEM_ENV_WITH_VALUE","TEAM_NOT_FOUND","TOO_MANY_IDS","TOO_MANY_KEYS","UNKNOWN_ERROR","VALUE_INVALID_LENGTH","VALUE_INVALID_TYPE"]);function isKnownError(error){let code=(0,import_error_utils.isErrnoException)(error)?error.code:null;return code?knownErrorsCodes.has(code.toUpperCase()):!1}var EnvAddTelemetryClient=class extends TelemetryClient{trackCliArgumentName(name){name&&this.trackCliArgument({arg:"name",value:this.redactedValue})}trackCliArgumentEnvironment(environment){if(environment){let allStandard=environment.split(",").map(t=>t.trim()).every(t=>STANDARD_ENVIRONMENTS.includes(t));this.trackCliArgument({arg:"environment",value:allStandard?environment:this.redactedValue})}}trackCliArgumentGitBranch(gitBranch){gitBranch&&this.trackCliArgument({arg:"git-branch",value:this.redactedValue})}trackCliOptionGitBranch(gitBranch){gitBranch&&this.trackCliOption({option:"git-branch",value:this.redactedValue})}trackCliOptionEnvironment(environments){if(environments&&environments.length>0){let allStandard=environments.flatMap(environment=>environment.split(",")).map(t=>t.trim()).every(t=>STANDARD_ENVIRONMENTS.includes(t));this.trackCliOption({option:"environment",value:allStandard?environments.join(","):this.redactedValue})}}trackCliOptionValue(value){value&&this.trackCliOption({option:"value",value:this.redactedValue})}trackCliOptionVisibility(visibility){if(visibility){let validVisibilities=["config","secret"];this.trackCliOption({option:"visibility",value:validVisibilities.includes(visibility)?visibility:this.redactedValue})}}trackCliOptionType(type){if(type){let validTypes=["config","secret"];this.trackCliOption({option:"type",value:validTypes.includes(type)?type:this.redactedValue})}}trackCliFlagSensitive(sensitive){sensitive&&this.trackCliFlag("sensitive")}trackCliFlagNoSensitive(noSensitive){noSensitive&&this.trackCliFlag("no-sensitive")}trackCliFlagForce(force){force&&this.trackCliFlag("force")}trackCliFlagGuidance(guidance){guidance&&this.trackCliFlag("guidance")}trackCliFlagYes(yes){yes&&this.trackCliFlag("yes")}trackCliFlagJson(json){json&&this.trackCliFlag("json")}};import{determineAgent}from"@vercel/detect-agent";function includesDevelopment(targets){return targets.length===0||targets.includes("development")}function getProductionSecretPolicyErrorKind(message){return/production secrets?.*different value|different value.*production secrets?/i.test(message)?"different-values":/production secrets?.*(?:own environment group|separat)|(?:own environment group|separat).*production secrets?/i.test(message)?"separate-environments":null}function getProductionSecretPolicyRecovery(kind){return kind==="different-values"?"Use different Secret values for Production and non-Production.":"Create separate Production and non-Production variables with different values."}function getSecretStorageChoice(targets,recommendedReason){let availability=includesDevelopment(targets)?"hidden in the dashboard; Development values can be pulled":"hidden in the dashboard and unavailable to pulls",recommendation=recommendedReason?`; recommended ${recommendedReason}`:"";return`Secret (${availability}${recommendation})`}function getDefaultSecretStorageGuidance(targets){return includesDevelopment(targets)?"Stored as Secret by default. This value is hidden in the dashboard; Development values can be pulled. Use `--type config` for other values you need to read later.":"Stored as Secret by default. This value is hidden in the dashboard and unavailable to pulls; use `--type config` for values you need to read later."}var import_strip_ansi=__toESM(require_strip_ansi(),1);function looksLikeCredentialName(key,publicPrefix=getPublicPrefix(key)){return looksLikeSecret(publicPrefix?key.slice(publicPrefix.length):key)}function filterEnvChoicesForSensitivity(choices,opts){return opts.policyOn?choices.filter(c=>c.value==="development"):choices}function getTargetCompatibilityError(envTargets,isSensitive,policyOn){let hasSensitiveCapable=envTargets.some(t=>t!=="development");return!isSensitive&&policyOn&&hasSensitiveCapable?`Your team requires sensitive Environment Variables for Production and Preview. To add a non-sensitive value, add it to the Development Environment only. Run ${getCommandName("env add --environment development")} instead.`:null}function resolveFinalType(envTargets,isSensitive,opts){return envTargets.includes("development")&&!isSensitive||opts.forceEncrypted&&!opts.policyOn?"encrypted":isSensitive||opts.forceSensitive||opts.policyOn?"sensitive":"encrypted"}function fillEnvAddTemplate(template,opts){let targetPlaceholder=getEnvTargetPlaceholder();return template.replace(/<name>/g,opts.envName?quoteArg(opts.envName):"<name>").split(targetPlaceholder).join(opts.envTargetArg?quoteArg(opts.envTargetArg):targetPlaceholder).replace(/<BRANCH>/g,opts.envGitBranch?quoteArg(opts.envGitBranch):"<BRANCH>").replace(/<value>/g,"<value>")}function multiTargetSuggestion(argv,envName,targets,addNoSensitive){let flag=addNoSensitive?" --no-sensitive":"";return{command:buildEnvAddCommandWithPreservedArgs(argv,`env add ${envName} --environment ${targets.join(",")} --value "<value>"${flag} --yes`),when:addNoSensitive?"Add one non-sensitive variable to all listed environments":"Add one variable to multiple environments"}}function filterSensitiveMultiTargetSuggestionTargets(targets,_opts){return targets}function formatEnvironmentTarget(target,customEnvironments){let standardTarget=envTargetChoices.find(choice=>choice.value===target);return standardTarget?standardTarget.name:customEnvironments.find(env=>env.id===target||env.slug===target)?.slug??target}function formatEnvironmentTargets(envTargets,customEnvironments){return envTargets.map(target=>formatEnvironmentTarget(target,customEnvironments)).join(", ")}function printEnvAddResult(projectLabel,envName,envTargets,envGitBranch,customEnvironments,finalType,force,visibility){output_manager_default.print(`
|
|
8
8
|
`),printAlignedLabel(force?"Overrode":"Added",envName,{gutter:"\u2713"}),printAlignedLabel("Project",projectLabel),printAlignedLabel("Environments",formatEnvironmentTargets(envTargets,customEnvironments)),envGitBranch&&printAlignedLabel("Branch",envGitBranch);let visibilityLabel=formatVisibilityLabel(visibility,finalType);visibilityLabel&&printAlignedLabel("Type",visibilityLabel)}var jsonWarnings;function printEnvAddWarning(message,reason){jsonWarnings?.push({reason,message:(0,import_strip_ansi.default)(message)}),output_manager_default.print(`${import_chalk.default.yellow("!")} ${message}
|
|
9
9
|
`)}function promptEnvValue(client,opts){return client.input.text({message:"Value?",...opts.isSensitive?{transformer:value=>"*".repeat(value.length)}:{}})}function buildHumanEnvAddCommand(argv,commandTemplate){let globalFlags=getGlobalFlagsFromArgs(argv.slice(2),{preserveProject:!0}).filter(flag=>!flag.startsWith("--non-interactive")),suffix=globalFlags.length>0?` ${globalFlags.map(quoteArg).join(" ")}`:"";return getCommandNamePlain(`${commandTemplate}${suffix}`)}function isBranchNotFoundError(err){if([err.code,err.slug].filter(v=>typeof v=="string").some(c=>c.toLowerCase()==="branch_not_found"))return!0;let message=(err.serverMessage??"").toLowerCase();return message.includes("branch")&&/not found|(?:doesn't|does not) exist/.test(message)}function branchNotFoundMessage(branch){return`Branch ${branch} was not found in the connected Git repository.`}function branchNotFoundRecovery(branch){return`Push ${branch} to the remote, then run the command again. Or omit --git-branch to apply the variable to all Preview branches.`}function omitGitBranchArgs(argv){let out=[];for(let i=0;i<argv.length;i++){let arg=argv[i];if(arg==="--git-branch"){i+1<argv.length&&!argv[i+1].startsWith("-")&&i++;continue}arg.startsWith("--git-branch=")||out.push(arg)}return out}function buildBranchNotFoundNext(argv,envName,branch){let name=quoteArg(envName);return[{command:buildEnvAddCommandWithPreservedArgs(argv,`env add ${name} --environment preview --git-branch ${quoteArg(branch)} --value "<value>"`),when:`Add the variable after pushing ${branch} to the remote`},{command:buildEnvAddCommandWithPreservedArgs(omitGitBranchArgs(argv),`env add ${name} --environment preview --value "<value>"`),when:"Add the variable to all Preview branches"}]}async function add(client,argv){if(argv.includes("--json")){jsonWarnings=[];try{return await runWithJsonOutput(client,()=>addEnv(client,argv,!0))}finally{jsonWarnings=void 0}}return addEnv(client,argv,!1)}async function addEnv(client,argv,json){let parsedArgs,flagsSpecification=getFlagsSpecification(addSubcommand.options);try{parsedArgs=parseArguments(argv,flagsSpecification)}catch(err){return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"invalid_arguments",message:err instanceof Error?err.message:String(err)},2),printError(err),2}let{args,flags:opts}=parsedArgs,valueFromFlag=typeof opts["--value"]=="string"?opts["--value"]:void 0,stdInput=valueFromFlag===void 0?await readStandardInput(client.stdin):"",[envName]=args,positionalEnvironment=args[1],positionalGitBranch=args[2],optionGitBranch=typeof opts["--git-branch"]=="string"?opts["--git-branch"]:void 0,forceSensitive=!!opts["--sensitive"],forceEncrypted=!!opts["--no-sensitive"],typeOption=resolveEnvVarTypeOption({type:typeof opts["--type"]=="string"?opts["--type"]:void 0,visibility:typeof opts["--visibility"]=="string"?opts["--visibility"]:void 0}),explicitType=typeOption.explicitVisibility,typeSource=explicitType||forceSensitive||forceEncrypted?"argv":void 0,telemetryClient=new EnvAddTelemetryClient({opts:{store:client.telemetryEventStore}});if(telemetryClient.trackCliArgumentName(envName),telemetryClient.trackCliArgumentEnvironment(positionalEnvironment),telemetryClient.trackCliArgumentGitBranch(positionalGitBranch),telemetryClient.trackCliOptionEnvironment(opts["--environment"]),telemetryClient.trackCliOptionGitBranch(optionGitBranch),telemetryClient.trackCliOptionValue(valueFromFlag===void 0?void 0:"<redacted>"),telemetryClient.trackCliFlagSensitive(opts["--sensitive"]),telemetryClient.trackCliFlagNoSensitive(opts["--no-sensitive"]),telemetryClient.trackCliFlagForce(opts["--force"]),telemetryClient.trackCliFlagGuidance(opts["--guidance"]),telemetryClient.trackCliFlagYes(opts["--yes"]),telemetryClient.trackCliOptionType(typeof opts["--type"]=="string"?opts["--type"]:void 0),telemetryClient.trackCliOptionVisibility(typeof opts["--visibility"]=="string"?opts["--visibility"]:void 0),telemetryClient.trackCliOptionProject(opts["--project"]),telemetryClient.trackCliFlagJson(opts["--json"]),typeOption.error)return client.nonInteractive&&outputAgentError(client,{status:"error",reason:typeOption.errorReason??"invalid_type",message:typeOption.error},1),output_manager_default.fatal(typeOption.error),1;typeOption.usedDeprecatedVisibility&&printEnvAddWarning(ENV_VISIBILITY_DEPRECATION_MESSAGE,"deprecated");let typeConflictMessage=forceSensitive?forceEncrypted?"`--sensitive` and `--no-sensitive` cannot be used together. Pick one.":explicitType==="config"?"`--type config` cannot be used with `--sensitive`. Pick one.":null:forceEncrypted&&explicitType==="secret"?"`--type secret` cannot be used with `--no-sensitive`. Pick one.":null;if(typeConflictMessage)return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"conflicting_type_flags",message:typeConflictMessage},2),output_manager_default.fatal(typeConflictMessage),2;if(positionalEnvironment!==void 0&&!parseEnvTargetArg(positionalEnvironment).every(part=>isValidEnvTarget(part))){let message="The environment argument accepts only production, preview, or development. Use --environment for custom environments, and pass the value with --value or stdin.",command=buildEnvAddCommandWithPreservedArgs(redactEnvValueArgs(client.argv),`env add ${envName?quoteArg(envName):"<name>"} --environment ${getEnvTargetPlaceholder()} --value "<value>"`);return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"invalid_arguments",message,next:[{command,when:"replace the placeholders, then run"}]},2),output_manager_default.error(message),output_manager_default.print(`
|
|
10
10
|
Replace the placeholders, then run:
|
|
@@ -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{promptExperimentalServicesMigration}from"../../chunks/chunk-5O4AXCN7.js";import"../../chunks/chunk-KSGN5OCV.js";import"../../chunks/chunk-76DSBD4X.js";import"../../chunks/chunk-O7GNYVVM.js";import"../../chunks/chunk-U4Z2MMOF.js";import"../../chunks/chunk-J24BABG4.js";import{jsonNextStep,runWithJsonOutput,writeJsonResult,writeJsonUsageError}from"../../chunks/chunk-EAQAV7UZ.js";import"../../chunks/chunk-KRP4EMD2.js";import"../../chunks/chunk-VPSR2O55.js";import"../../chunks/chunk-REJLEESP.js";import"../../chunks/chunk-ISSNEDG5.js";import{pull}from"../../chunks/chunk-YI7NKOCU.js";import"../../chunks/chunk-2AU6O6Z5.js";import"../../chunks/chunk-ZKNEIE44.js";import"../../chunks/chunk-KR4DMT3I.js";import"../../chunks/chunk-LNZEYUEC.js";import"../../chunks/chunk-AIXEVICT.js";import"../../chunks/chunk-S4AANAHX.js";import"../../chunks/chunk-VF7XWPXA.js";import"../../chunks/chunk-7YKFF6CE.js";import"../../chunks/chunk-3UZE566G.js";import"../../chunks/chunk-TSNRTRIM.js";import"../../chunks/chunk-TAAWMNNL.js";import"../../chunks/chunk-25565AGS.js";import"../../chunks/chunk-PVASGBEF.js";import{ensureLink}from"../../chunks/chunk-SXW2G4WD.js";import"../../chunks/chunk-QGHAD5A5.js";import"../../chunks/chunk-NBTFAXL4.js";import"../../chunks/chunk-TJUZVODP.js";import"../../chunks/chunk-OF32Z3UP.js";import{getSubcommand}from"../../chunks/chunk-ETV3C2CV.js";import"../../chunks/chunk-DOMBKOLJ.js";import{getCommandAliases}from"../../chunks/chunk-
|
|
7
|
+
import{promptExperimentalServicesMigration}from"../../chunks/chunk-5O4AXCN7.js";import"../../chunks/chunk-KSGN5OCV.js";import"../../chunks/chunk-76DSBD4X.js";import"../../chunks/chunk-O7GNYVVM.js";import"../../chunks/chunk-U4Z2MMOF.js";import"../../chunks/chunk-J24BABG4.js";import{jsonNextStep,runWithJsonOutput,writeJsonResult,writeJsonUsageError}from"../../chunks/chunk-EAQAV7UZ.js";import"../../chunks/chunk-KRP4EMD2.js";import"../../chunks/chunk-VPSR2O55.js";import"../../chunks/chunk-REJLEESP.js";import"../../chunks/chunk-ISSNEDG5.js";import{pull}from"../../chunks/chunk-YI7NKOCU.js";import"../../chunks/chunk-2AU6O6Z5.js";import"../../chunks/chunk-ZKNEIE44.js";import"../../chunks/chunk-KR4DMT3I.js";import"../../chunks/chunk-LNZEYUEC.js";import"../../chunks/chunk-AIXEVICT.js";import"../../chunks/chunk-S4AANAHX.js";import"../../chunks/chunk-VF7XWPXA.js";import"../../chunks/chunk-7YKFF6CE.js";import"../../chunks/chunk-3UZE566G.js";import"../../chunks/chunk-TSNRTRIM.js";import"../../chunks/chunk-TAAWMNNL.js";import"../../chunks/chunk-25565AGS.js";import"../../chunks/chunk-PVASGBEF.js";import{ensureLink}from"../../chunks/chunk-SXW2G4WD.js";import"../../chunks/chunk-QGHAD5A5.js";import"../../chunks/chunk-NBTFAXL4.js";import"../../chunks/chunk-TJUZVODP.js";import"../../chunks/chunk-OF32Z3UP.js";import{getSubcommand}from"../../chunks/chunk-ETV3C2CV.js";import"../../chunks/chunk-DOMBKOLJ.js";import{getCommandAliases}from"../../chunks/chunk-XR2J7PQN.js";import"../../chunks/chunk-K3MGQQEP.js";import"../../chunks/chunk-DDPH26ZO.js";import"../../chunks/chunk-PIDEH4SJ.js";import"../../chunks/chunk-IIK6GUVI.js";import"../../chunks/chunk-C35SG42R.js";import"../../chunks/chunk-2GBU6ULJ.js";import"../../chunks/chunk-DOBV3XLO.js";import"../../chunks/chunk-TUB3APDV.js";import"../../chunks/chunk-BMIYC2MH.js";import"../../chunks/chunk-6CJFPT4F.js";import"../../chunks/chunk-ZZD5W5KT.js";import"../../chunks/chunk-VHSAI6FS.js";import"../../chunks/chunk-F7L5SXJM.js";import"../../chunks/chunk-GLCSWIB4.js";import"../../chunks/chunk-XECELSF5.js";import"../../chunks/chunk-6FYPSSL4.js";import"../../chunks/chunk-UQZZX2J7.js";import"../../chunks/chunk-UDZJCD5W.js";import"../../chunks/chunk-5ZCSFPWG.js";import"../../chunks/chunk-RVIJRFVD.js";import"../../chunks/chunk-XDYVJWGX.js";import"../../chunks/chunk-JALVF3C2.js";import"../../chunks/chunk-VZ4URN3U.js";import"../../chunks/chunk-AB4WXRCO.js";import"../../chunks/chunk-SYJXONEV.js";import{printError}from"../../chunks/chunk-33HVDSWP.js";import"../../chunks/chunk-BDXK4TCN.js";import{help}from"../../chunks/chunk-5KSBRQI2.js";import"../../chunks/chunk-3G3FQYMW.js";import{detectExplicitScope,getScope}from"../../chunks/chunk-NLK7NGVP.js";import{TelemetryClient}from"../../chunks/chunk-KDCODXVL.js";import"../../chunks/chunk-NWGBDBZI.js";import{addRepoLink,ensureRepoLink,findRepoRoot,getLinkedProjectIdSync,getVercelDirectory,isPromptCanceledError,resolveProjectCwd}from"../../chunks/chunk-Z2KANBOU.js";import"../../chunks/chunk-M7FED5YP.js";import"../../chunks/chunk-4HR3I3ML.js";import"../../chunks/chunk-DJZBJC2A.js";import"../../chunks/chunk-LUX4PBJL.js";import"../../chunks/chunk-MTZYPCZ7.js";import"../../chunks/chunk-OPORM35X.js";import"../../chunks/chunk-D6REP5QQ.js";import"../../chunks/chunk-FBYA6LLM.js";import"../../chunks/chunk-MY4MONOH.js";import"../../chunks/chunk-UG3FZ5Q7.js";import"../../chunks/chunk-MXTC4ZAQ.js";import{parseArguments}from"../../chunks/chunk-CINNNQDJ.js";import{AGENT_REASON,AGENT_STATUS,buildCommandWithYes,getExitCodeForReason,writeActionRequired}from"../../chunks/chunk-4SS6W6JK.js";import{addSubcommand,linkCommand}from"../../chunks/chunk-FEJD7MRH.js";import"../../chunks/chunk-AW33SRYY.js";import"../../chunks/chunk-4NTBYNFR.js";import"../../chunks/chunk-4SAVH3H7.js";import"../../chunks/chunk-GOI2VVI7.js";import{cmd}from"../../chunks/chunk-B4KA3ZH2.js";import"../../chunks/chunk-BOJDM3O7.js";import{output_manager_default}from"../../chunks/chunk-AP6DZGTK.js";import"../../chunks/chunk-BLUPZPAS.js";import{require_build_utils}from"../../chunks/chunk-5MDNVAE6.js";import"../../chunks/chunk-OCR5CRTH.js";import"../../chunks/chunk-7EJQLVWX.js";import"../../chunks/chunk-SCV7XEEO.js";import"../../chunks/chunk-MCYG7CCE.js";import"../../chunks/chunk-YHPPP3SF.js";import"../../chunks/chunk-24SIHFEW.js";import"../../chunks/chunk-GLIQ4KNY.js";import{getFlagsSpecification}from"../../chunks/chunk-CFJBDBYH.js";import"../../chunks/chunk-2BKALEOP.js";import{require_source}from"../../chunks/chunk-NB2WLB3J.js";import"../../chunks/chunk-ISWW3DKF.js";import"../../chunks/chunk-BRQUZ5NC.js";import"../../chunks/chunk-BULSRTQE.js";import{__toESM}from"../../chunks/chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);import{join}from"path";var LinkTelemetryClient=class extends TelemetryClient{trackCliArgumentCwd(){this.trackCliArgument({arg:"cwd",value:this.redactedValue})}trackCliFlagRepo(flag){flag&&this.trackCliFlag("repo")}trackCliFlagYes(yes){yes&&this.trackCliFlag("yes")}trackCliFlagConfirm(flag){flag&&this.trackCliFlag("confirm")}trackCliOptionTeam(value){value&&this.trackCliOption({option:"team",value:this.redactedValue})}trackCliOptionProjectId(value){value&&this.trackCliOption({option:"project-id",value:this.redactedValue})}trackCliSubcommandAdd(actual){this.trackCliSubcommand({subcommand:"add",value:actual})}trackCliFlagJson(json){json&&this.trackCliFlag("json")}};var import_build_utils=__toESM(require_build_utils(),1);var COMMAND_CONFIG={add:getCommandAliases(addSubcommand)};function warnOidcRefreshFailed(){output_manager_default.print(`${import_chalk.default.yellow("!")} Linked project, but failed to refresh VERCEL_OIDC_TOKEN in .env.local. Rerun the link command to retry.
|
|
8
8
|
`)}async function refreshOidcTokenAfterLink(client,cwd){let originalCwd=client.cwd;try{return client.cwd=await resolveProjectCwd(cwd),output_manager_default.print(`
|
|
9
9
|
`),await pull(client,["--yes"],"vercel-cli:link",{oidcTokenOnly:!0})!==0?(warnOidcRefreshFailed(),!1):!0}catch{return warnOidcRefreshFailed(),!1}finally{client.cwd=originalCwd}}var OIDC_REFRESH_FAILED_WARNING={reason:"oidc_token_not_refreshed",message:"Linked project, but failed to refresh VERCEL_OIDC_TOKEN in .env.local. Rerun the link command to retry."};async function link(client){try{return await client.withEscapePromptCancellation(()=>linkProject(client))}catch(error){if(isPromptCanceledError(error))return output_manager_default.print(` Canceled.
|
|
10
10
|
`),0;throw error}}async function linkProject(client){let parsedArgs=null,flagsSpecification=getFlagsSpecification(linkCommand.options);try{parsedArgs=parseArguments(client.argv.slice(2),flagsSpecification,{permissive:!0})}catch(error){return printError(error),2}let{subcommand,subcommandOriginal}=getSubcommand(parsedArgs.args.slice(1),COMMAND_CONFIG),telemetry=new LinkTelemetryClient({opts:{store:client.telemetryEventStore}});function printHelp(command){output_manager_default.print(help(command,{stream:client.stderr,parent:linkCommand,columns:client.stderr.columns}))}if(subcommand==="add"){if(parsedArgs.flags["--help"])return telemetry.trackCliFlagHelp("link",subcommandOriginal),printHelp(addSubcommand),0;telemetry.trackCliSubcommandAdd(subcommandOriginal);let yes=!!parsedArgs.flags["--yes"];try{await addRepoLink(client,client.cwd,{yes})}catch(err){if(isPromptCanceledError(err))throw err;return output_manager_default.prettyError(err),1}return 0}try{parsedArgs=parseArguments(client.argv.slice(2),flagsSpecification)}catch(error){return client.argv.includes("--json")?writeJsonUsageError(client,error):(printError(error),2)}if(parsedArgs.flags["--help"])return telemetry.trackCliFlagHelp("link"),output_manager_default.print(help(linkCommand,{stream:client.stderr,columns:client.stderr.columns})),0;telemetry.trackCliFlagRepo(parsedArgs.flags["--repo"]),telemetry.trackCliFlagYes(parsedArgs.flags["--yes"]),telemetry.trackCliOptionProject(parsedArgs.flags["--project"]),telemetry.trackCliFlagJson(parsedArgs.flags["--json"]);let flags=parsedArgs.flags,argument=parsedArgs.args[1],json=!!flags["--json"],run=()=>linkDirectory(client,telemetry,flags,argument,json);return json?runWithJsonOutput(client,run):run()}async function linkDirectory(client,telemetry,flags,argument,json){"--confirm"in flags&&(telemetry.trackCliFlagConfirm(flags["--confirm"]),output_manager_default.warn("`--confirm` is deprecated, please use `--yes` instead"),flags["--yes"]=flags["--confirm"]);let yes=!!flags["--yes"],cwd=argument;if(cwd?(telemetry.trackCliArgumentCwd(),output_manager_default.warn(`The ${cmd("vc link <directory>")} syntax is deprecated, please use ${cmd(`vc link --cwd ${cwd}`)} instead`)):cwd=client.cwd,flags["--repo"]){if(json&&!yes)return writeActionRequired(client,{status:AGENT_STATUS.ACTION_REQUIRED,reason:AGENT_REASON.CONFIRMATION_REQUIRED,message:"Can't link the repository without --yes in non-interactive mode. --yes links its projects with the default team and settings.",next:[{command:buildCommandWithYes(client.argv)}]}),getExitCodeForReason(AGENT_REASON.CONFIRMATION_REQUIRED);output_manager_default.warn(`The ${cmd("--repo")} option is in alpha, please report issues`);let repoLink;try{repoLink=await ensureRepoLink(client,cwd,{yes,overwrite:!0})}catch(err){if(isPromptCanceledError(err)||json)throw err;return output_manager_default.prettyError(err),1}if(json)return writeJsonResult(client,repoLink?.repoConfig?{repoLink:{directory:repoLink.rootPath,remoteName:repoLink.repoConfig.remoteName,projects:repoLink.repoConfig.projects},outcome:"linked",next:[jsonNextStep(client,["project","list"],"List projects")]}:{repoLink:null,outcome:"unchanged"})}else{let selectedOrg=detectExplicitScope(client)?(await getScope(client,{resolveLocalScope:!0})).org:void 0,linkNonInteractive=client.nonInteractive||client.argv.includes("--non-interactive"),previousProjectId=json?getLinkedProjectIdSync(getVercelDirectory(await resolveProjectCwd(cwd))):void 0,link2=await ensureLink("link",client,cwd,{autoConfirm:yes,forceDelete:!0,selectedOrg,projectName:flags["--project"],successEmoji:"success",nonInteractive:linkNonInteractive,pullEnv:!1});if(typeof link2=="number")return link2;let projectCwd=await resolveProjectCwd(cwd),rootDirectory=link2.project.rootDirectory,repoRoot=link2.repoRoot??(rootDirectory?await findRepoRoot(projectCwd):void 0);await promptExperimentalServicesMigration({client,cwd:rootDirectory?join(repoRoot??projectCwd,rootDirectory):link2.repoRoot??projectCwd,autoConfirm:yes,nonInteractive:linkNonInteractive,allowConfigExecution:!1});let oidcRefreshed=await refreshOidcTokenAfterLink(client,cwd);if(json){let unchanged=!!((0,import_build_utils.getPlatformEnv)("ORG_ID")&&(0,import_build_utils.getPlatformEnv)("PROJECT_ID"))||previousProjectId===link2.project.id;return writeJsonResult(client,{link:{teamId:link2.org.id,projectId:link2.project.id,projectName:link2.project.name,directory:projectCwd},outcome:unchanged?"unchanged":"linked",projectCreated:!!link2.projectCreated,previousProjectId:!unchanged&&previousProjectId?previousProjectId:null,...oidcRefreshed?{}:{warnings:[OIDC_REFRESH_FAILED_WARNING]},next:[jsonNextStep(client,["project","inspect",link2.project.name],"Inspect the project")]})}}return 0}export{link as default};
|
|
@@ -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{createProject}from"../../chunks/chunk-ANIA2G6F.js";import{handleCommandTypo}from"../../chunks/chunk-R33HJGYA.js";import{getProjectByCwdOrLink,isTeamExplicit}from"../../chunks/chunk-DZ77BIEV.js";import{apiServerMessage}from"../../chunks/chunk-FCTTEFC5.js";import{joinWords}from"../../chunks/chunk-4VFYJU37.js";import{tryOpenApiFallback}from"../../chunks/chunk-D2TVI7KK.js";import"../../chunks/chunk-GHAY4PSD.js";import{formatRepository}from"../../chunks/chunk-3FVMCV7T.js";import{formatProvider,parseRepoUrl}from"../../chunks/chunk-L75A5BMY.js";import"../../chunks/chunk-5TMHRECT.js";import"../../chunks/chunk-JUAHDOL6.js";import"../../chunks/chunk-YTRKHRL3.js";import"../../chunks/chunk-54FY6GJ5.js";import{did_you_mean_default}from"../../chunks/chunk-DWZBL4NK.js";import{resolveOpenApiTagForProjectsCli}from"../../chunks/chunk-DHKWTBF6.js";import{getNetworkFailureCause,isRequestNotSent}from"../../chunks/chunk-KXK4TF6L.js";import{email}from"../../chunks/chunk-6IDNVZZR.js";import{formatMinorUnits}from"../../chunks/chunk-
|
|
7
|
+
import{createProject}from"../../chunks/chunk-ANIA2G6F.js";import{handleCommandTypo}from"../../chunks/chunk-R33HJGYA.js";import{getProjectByCwdOrLink,isTeamExplicit}from"../../chunks/chunk-DZ77BIEV.js";import{apiServerMessage}from"../../chunks/chunk-FCTTEFC5.js";import{joinWords}from"../../chunks/chunk-4VFYJU37.js";import{tryOpenApiFallback}from"../../chunks/chunk-D2TVI7KK.js";import"../../chunks/chunk-GHAY4PSD.js";import{formatRepository}from"../../chunks/chunk-3FVMCV7T.js";import{formatProvider,parseRepoUrl}from"../../chunks/chunk-L75A5BMY.js";import"../../chunks/chunk-5TMHRECT.js";import"../../chunks/chunk-JUAHDOL6.js";import"../../chunks/chunk-YTRKHRL3.js";import"../../chunks/chunk-54FY6GJ5.js";import{did_you_mean_default}from"../../chunks/chunk-DWZBL4NK.js";import{resolveOpenApiTagForProjectsCli}from"../../chunks/chunk-DHKWTBF6.js";import{getNetworkFailureCause,isRequestNotSent}from"../../chunks/chunk-KXK4TF6L.js";import{email}from"../../chunks/chunk-6IDNVZZR.js";import{formatMinorUnits}from"../../chunks/chunk-F2QU46EQ.js";import{require_async_sema}from"../../chunks/chunk-NZ2TFADV.js";import{INVALID_NEXT_MESSAGE,InvalidNextError,getPaginationOpts,parseNumericCursor}from"../../chunks/chunk-C6GY2G73.js";import{formatDate}from"../../chunks/chunk-HRR57QNP.js";import{writeJsonError}from"../../chunks/chunk-KRP4EMD2.js";import{stamp_default}from"../../chunks/chunk-A2RZZQEP.js";import"../../chunks/chunk-Q7D7RGXM.js";import{require_frameworks}from"../../chunks/chunk-ZKNEIE44.js";import{resolveProjectContext}from"../../chunks/chunk-VF7XWPXA.js";import{formatProject}from"../../chunks/chunk-3UZE566G.js";import{isInteractiveHumanRun}from"../../chunks/chunk-TSNRTRIM.js";import"../../chunks/chunk-SXW2G4WD.js";import"../../chunks/chunk-QGHAD5A5.js";import{readOnOffOption,rewriteLegacyOnOffValues}from"../../chunks/chunk-3OZCZF4N.js";import{getCommandFlags}from"../../chunks/chunk-XGTKHQTT.js";import"../../chunks/chunk-PFD7LETF.js";import{requireApproval}from"../../chunks/chunk-SYVWRGFQ.js";import"../../chunks/chunk-F4UEGELU.js";import"../../chunks/chunk-XDWAUOFO.js";import{getInvalidSubcommand}from"../../chunks/chunk-TG2RCYTH.js";import{canPrompt}from"../../chunks/chunk-IQ7FPAI4.js";import{trackCreatedId}from"../../chunks/chunk-YJNMDXEG.js";import{getRenamedOption,renameOptionInArgs,reportRenamedOptionError,withWarnings}from"../../chunks/chunk-OF32Z3UP.js";import{getSubcommand}from"../../chunks/chunk-ETV3C2CV.js";import{table}from"../../chunks/chunk-CJZE7647.js";import{PaginationError,fetchAllPages,getCommandFromArgv,getNextPageCommand,printNextPageCommand}from"../../chunks/chunk-PFOOPXTN.js";import"../../chunks/chunk-DOMBKOLJ.js";import{PROJECT_MEMBER_ROLES,accessGroupsSubcommand,accessSummarySubcommand,addSubcommand5 as addSubcommand,checksAddFlags,checksRemoveFlags,checksSubcommand,dangerouslyDeleteImmutableStaticAssetSubcommand,getCommandAliases,inspectSubcommand10 as inspectSubcommand,keepSubcommand,listSubcommand15 as listSubcommand,membersAddFlags,membersRemoveFlags,membersSubcommand,observabilityDisableSubcommand,observabilitySubcommand,pauseSubcommand2 as pauseSubcommand,prioritySubcommand,projectCommand,protectionEnableSubcommand,protectionSubcommand,removeSubcommand8 as removeSubcommand,renameSubcommand,resumeSubcommand2 as resumeSubcommand,speedInsightsSubcommand,tokenSubcommand2 as tokenSubcommand,updateSubcommand5 as updateSubcommand,webAnalyticsDisableSubcommand,webAnalyticsSubcommand}from"../../chunks/chunk-XR2J7PQN.js";import"../../chunks/chunk-K3MGQQEP.js";import"../../chunks/chunk-DDPH26ZO.js";import"../../chunks/chunk-PIDEH4SJ.js";import"../../chunks/chunk-IIK6GUVI.js";import"../../chunks/chunk-C35SG42R.js";import"../../chunks/chunk-2GBU6ULJ.js";import"../../chunks/chunk-DOBV3XLO.js";import"../../chunks/chunk-TUB3APDV.js";import"../../chunks/chunk-BMIYC2MH.js";import"../../chunks/chunk-6CJFPT4F.js";import"../../chunks/chunk-ZZD5W5KT.js";import"../../chunks/chunk-VHSAI6FS.js";import"../../chunks/chunk-F7L5SXJM.js";import"../../chunks/chunk-GLCSWIB4.js";import"../../chunks/chunk-XECELSF5.js";import"../../chunks/chunk-6FYPSSL4.js";import"../../chunks/chunk-UQZZX2J7.js";import"../../chunks/chunk-UDZJCD5W.js";import"../../chunks/chunk-5ZCSFPWG.js";import"../../chunks/chunk-RVIJRFVD.js";import"../../chunks/chunk-XDYVJWGX.js";import"../../chunks/chunk-JALVF3C2.js";import"../../chunks/chunk-VZ4URN3U.js";import"../../chunks/chunk-AB4WXRCO.js";import"../../chunks/chunk-SYJXONEV.js";import{printError}from"../../chunks/chunk-33HVDSWP.js";import"../../chunks/chunk-BDXK4TCN.js";import{help}from"../../chunks/chunk-5KSBRQI2.js";import"../../chunks/chunk-3G3FQYMW.js";import{getContextName,getScope,scopeFlagPassed}from"../../chunks/chunk-NLK7NGVP.js";import{TelemetryClient}from"../../chunks/chunk-KDCODXVL.js";import"../../chunks/chunk-NWGBDBZI.js";import{getUser,sleep}from"../../chunks/chunk-Z2KANBOU.js";import{printAlignedLabel}from"../../chunks/chunk-M7FED5YP.js";import{require_pluralize}from"../../chunks/chunk-4HR3I3ML.js";import{getProjectByNameOrId}from"../../chunks/chunk-DJZBJC2A.js";import"../../chunks/chunk-LUX4PBJL.js";import"../../chunks/chunk-MTZYPCZ7.js";import"../../chunks/chunk-OPORM35X.js";import"../../chunks/chunk-D6REP5QQ.js";import"../../chunks/chunk-FBYA6LLM.js";import"../../chunks/chunk-MY4MONOH.js";import"../../chunks/chunk-UG3FZ5Q7.js";import{require_ms}from"../../chunks/chunk-MXTC4ZAQ.js";import{getTypedOptionName,parseArguments,takeCommand}from"../../chunks/chunk-CINNNQDJ.js";import{AGENT_ACTION,AGENT_REASON,AGENT_STATUS,BUY_PRO_COMMAND,PRIORITY_PROJECT_ENABLE_COMMAND,buildCommandWithGlobalFlags,buildCommandWithYes,buyProFix,exitWithNonInteractiveError,getErrorRecovery,getExitCodeForReason,getTeamByIdOrSlug,isInvalidTokenApiError,isProOrEnterprisePlan,outputActionRequired,outputAgentError,shouldEmitNonInteractiveCommandError,targetRecovery,withGlobalFlags,writeAgentError}from"../../chunks/chunk-4SS6W6JK.js";import{validateJsonOutput,wantsMachineReadableOutput,warnDeprecatedSubcommand}from"../../chunks/chunk-FEJD7MRH.js";import"../../chunks/chunk-AW33SRYY.js";import"../../chunks/chunk-4NTBYNFR.js";import"../../chunks/chunk-4SAVH3H7.js";import{LinkRequiredError,ProjectNotFound,isAPIError}from"../../chunks/chunk-GOI2VVI7.js";import{getCommandName,getCommandNamePlain,packageName}from"../../chunks/chunk-B4KA3ZH2.js";import"../../chunks/chunk-BOJDM3O7.js";import{emoji,output_manager_default,prependEmoji}from"../../chunks/chunk-AP6DZGTK.js";import"../../chunks/chunk-BLUPZPAS.js";import{require_build_utils}from"../../chunks/chunk-5MDNVAE6.js";import"../../chunks/chunk-OCR5CRTH.js";import"../../chunks/chunk-7EJQLVWX.js";import"../../chunks/chunk-SCV7XEEO.js";import"../../chunks/chunk-MCYG7CCE.js";import"../../chunks/chunk-YHPPP3SF.js";import"../../chunks/chunk-24SIHFEW.js";import{remoteText}from"../../chunks/chunk-GLIQ4KNY.js";import{getFlagsSpecification,getGlobalFlagsFromArgs,quoteArg}from"../../chunks/chunk-CFJBDBYH.js";import"../../chunks/chunk-2BKALEOP.js";import{require_source}from"../../chunks/chunk-NB2WLB3J.js";import"../../chunks/chunk-ISWW3DKF.js";import"../../chunks/chunk-BRQUZ5NC.js";import"../../chunks/chunk-BULSRTQE.js";import{__toESM}from"../../chunks/chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1),import_ms=__toESM(require_ms(),1);var ProjectAddTelemetryClient=class extends TelemetryClient{trackCliArgumentName(name){name&&this.trackCliArgument({arg:"name",value:this.redactedValue})}};async function add(client,argv){let telemetryClient=new ProjectAddTelemetryClient({opts:{store:client.telemetryEventStore}}),parsedArgs,flagsSpecification=getFlagsSpecification(addSubcommand.options);try{parsedArgs=parseArguments(argv,flagsSpecification)}catch(error){return printError(error),2}let{args}=parsedArgs;if(args.length!==1){if(output_manager_default.error(`Invalid number of arguments. Usage: ${import_chalk.default.cyan(`${getCommandName("project create <name>")}`)}`),args.length>1){let example=import_chalk.default.cyan(`${getCommandName(`project create "${args.join(" ")}"`)}`);output_manager_default.log(`If your project name has spaces, make sure to wrap it in quotes. Example:
|
|
8
8
|
${example} `)}return 2}let start=Date.now(),[name]=args;telemetryClient.trackCliArgumentName(name);try{await createProject(client,{name})}catch(err){if(isAPIError(err)&&err.code==="too_many_projects")return output_manager_default.prettyError(err),1;if(!(isAPIError(err)&&err.status===409))throw err}let elapsed=(0,import_ms.default)(Date.now()-start),contextName=await getContextName(client,{allowOwnerLookupFallback:!0});return output_manager_default.log(`${import_chalk.default.cyan("Success!")} Project ${import_chalk.default.bold(name.toLowerCase())} added (${import_chalk.default.bold(contextName)}) ${import_chalk.default.gray(`[${elapsed}]`)}`),0}var import_chalk2=__toESM(require_source(),1);async function accessSummary(client,argv){let parsedArgs,flagsSpecification=getFlagsSpecification(accessSummarySubcommand.options);try{parsedArgs=parseArguments(argv,flagsSpecification)}catch(error){return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"invalid_arguments",message:error instanceof Error?error.message:String(error)},2),printError(error),2}if(parsedArgs.args.length>1)return output_manager_default.error("Invalid number of arguments. Usage: `vercel project access-summary [name]`"),2;let formatResult=validateJsonOutput(parsedArgs.flags);if(!formatResult.valid)return output_manager_default.error(formatResult.error),2;let asJson=formatResult.jsonOutput,summary;try{let project=await getProjectByCwdOrLink({client,commandName:"project access-summary",projectNameOrId:parsedArgs.args[0],forReadOnlyCommand:!0});summary=await client.fetch(`/v1/projects/${encodeURIComponent(project.id)}/members/summary`)}catch(err){return exitWithNonInteractiveError(client,err,1,{variant:"access-summary"}),printError(err),1}if(asJson)return client.stdout.write(`${JSON.stringify(summary,null,2)}
|
|
9
9
|
`),0;let entries=Object.entries(summary).sort(([a],[b])=>a.localeCompare(b));if(entries.length===0)return output_manager_default.log("No summary data returned."),0;let rows=[["Role","Count"].map(h=>(0,import_chalk2.gray)(h)),...entries.map(([role,count])=>[role,String(count)])];return client.stderr.write(`${table(rows,{hsep:3})}
|
|
10
10
|
`),0}var import_chalk3=__toESM(require_source(),1);import{readFileSync}from"fs";import{resolve}from"path";var REQUIRES=["build-ready","deployment-url","none"],BLOCKING_STAGES=["build-start","deployment-start","deployment-alias","deployment-promotion","none"];function emitValidationError(client,message,exitCode,extra){outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message,...extra},exitCode)}async function checksAdd(client,argv){let parsedArgs,flagsSpecification=getFlagsSpecification([...checksAddFlags]);try{parsedArgs=parseArguments(argv,flagsSpecification)}catch(error){return client.nonInteractive&&outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message:error instanceof Error?error.message:String(error)},2),printError(error),2}if(parsedArgs.args.length>1)return emitValidationError(client,"Invalid number of arguments. Usage: `vercel project checks add [name]`",2),output_manager_default.error("Invalid number of arguments. Usage: `vercel project checks add [name]`"),2;let formatResult=validateJsonOutput(parsedArgs.flags);if(!formatResult.valid)return client.nonInteractive&&emitValidationError(client,formatResult.error,1),output_manager_default.error(formatResult.error),1;let asJson=formatResult.jsonOutput||!!client.nonInteractive,filePath=parsedArgs.flags["--file"],checkName=parsedArgs.flags["--check-name"],requires=parsedArgs.flags["--requires"],blocksFlag=parsedArgs.flags["--blocks"],timeout=parsedArgs.flags["--timeout"],targetsRaw=parsedArgs.flags["--targets"],sourceRaw=parsedArgs.flags["--source"],body;if(typeof filePath=="string"&&filePath.length>0)try{let raw=readFileSync(resolve(client.cwd,filePath),"utf8"),parsed=JSON.parse(raw);if(!parsed||typeof parsed!="object"||Array.isArray(parsed))return emitValidationError(client,"`--file` must contain a JSON object.",1),output_manager_default.error("`--file` must contain a JSON object."),1;body=parsed}catch(err){let msg=err instanceof Error?err.message:String(err);return emitValidationError(client,`Failed to read \`--file\`: ${msg}`,1),output_manager_default.error(`Failed to read \`--file\`: ${msg}`),1}else{if(typeof checkName!="string"||!checkName.trim())return emitValidationError(client,"Provide `--check-name` and `--requires`, or a `--file` with the full JSON body.",1,{hint:'See `vercel project checks --help` and the REST API "Create a check" documentation.',next:[{command:buildCommandWithGlobalFlags(client.argv,"project checks add <name> --file <path>"),when:"Create from a JSON file (replace paths)"}]}),output_manager_default.error("Provide `--check-name` and `--requires`, or a `--file` with the full JSON body. See `vercel project checks add --help`."),1;if(typeof requires!="string"||!requires.trim())return emitValidationError(client,"`--requires` is required when using `--check-name` (build-ready, deployment-url, or none).",1),output_manager_default.error("`--requires` is required when using `--check-name` (build-ready, deployment-url, or none)."),2;if(!REQUIRES.includes(requires))return emitValidationError(client,`\`--requires\` must be one of: ${REQUIRES.join(", ")}`,1),output_manager_default.error(`\`--requires\` must be one of: ${REQUIRES.join(", ")}`),2;if(body={name:checkName.trim(),requires:requires.trim()},typeof blocksFlag=="string"&&blocksFlag.length>0){if(!BLOCKING_STAGES.includes(blocksFlag))return emitValidationError(client,`\`--blocks\` must be one of: ${BLOCKING_STAGES.join(", ")}`,1),output_manager_default.error(`\`--blocks\` must be one of: ${BLOCKING_STAGES.join(", ")}`),2;body.blocks=blocksFlag}if(typeof timeout=="number"&&(body.timeout=timeout),typeof targetsRaw=="string"&&targetsRaw.trim()&&(body.targets=targetsRaw.split(",").map(s=>s.trim()).filter(Boolean)),typeof sourceRaw=="string"&&sourceRaw.trim())try{body.source=JSON.parse(sourceRaw)}catch{return emitValidationError(client,"`--source` must be valid JSON.",1),output_manager_default.error("`--source` must be valid JSON."),1}}try{let project=await getProjectByCwdOrLink({client,commandName:"project checks add",projectNameOrId:parsedArgs.args[0],forReadOnlyCommand:!0}),result=await client.fetch(`/v2/projects/${encodeURIComponent(project.id)}/checks`,{method:"POST",body});if(trackCreatedId(client,"check",typeof result.id=="string"?result.id:void 0),asJson){let id2=String(result.id??"");return client.nonInteractive?client.stdout.write(`${JSON.stringify({status:AGENT_STATUS.OK,check:result,projectId:project.id,projectName:project.name,message:id2?`Created deployment check ${id2} on ${project.name}.`:`Created deployment check on ${project.name}.`,next:[{command:buildCommandWithGlobalFlags(client.argv,"project checks"),when:"List checks for this project"},{command:buildCommandWithGlobalFlags(client.argv,"project checks remove <check_id>"),when:"Remove a check by id if needed"}]},null,2)}
|