@vercel/cli-support 65.7.0 → 65.8.0-snapshot-c4f338842961
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/add-6R2L3B6P.js +8 -0
- package/dist/chunks/add-O4YI4D5H.js +8 -0
- package/dist/chunks/add-W7MDOZMC.js +8 -0
- package/dist/chunks/build-UOKGUTFN.js +7 -0
- package/dist/chunks/chunk-2EYHCJQO.js +22 -0
- package/dist/chunks/{chunk-I64T5ZML.js → chunk-2NMEPXG3.js} +1 -1
- package/dist/chunks/{chunk-H3E4YX2M.js → chunk-3IRPFJ2G.js} +1 -1
- package/dist/chunks/{chunk-DCX2PBSX.js → chunk-3P4Y46MS.js} +1 -1
- package/dist/chunks/{chunk-E32IBIXV.js → chunk-4BIGNS67.js} +1 -1
- package/dist/chunks/{chunk-LIXU6EGC.js → chunk-4JE57EBL.js} +1 -1
- package/dist/chunks/{chunk-RD2VHI66.js → chunk-4K3O7QWS.js} +1 -1
- package/dist/chunks/{chunk-SKDLXVRO.js → chunk-4NDWIUKJ.js} +1 -1
- package/dist/chunks/{chunk-KBFHUWSQ.js → chunk-4UIMSZZB.js} +1 -1
- package/dist/chunks/{chunk-3E364MJE.js → chunk-5O7CRJE5.js} +1 -1
- package/dist/chunks/{chunk-N36OHJVQ.js → chunk-64VMAYM6.js} +1 -1
- package/dist/chunks/{chunk-S52O6DKC.js → chunk-AA3JM33J.js} +1 -1
- package/dist/chunks/{chunk-OS5I5TXU.js → chunk-APWCVJAG.js} +1 -1
- package/dist/chunks/chunk-BPR5CLQM.js +8 -0
- package/dist/chunks/{chunk-A7E3WORN.js → chunk-C7D43G3N.js} +1 -1
- package/dist/chunks/{chunk-EOK43KMC.js → chunk-CCD7E322.js} +1 -1
- package/dist/chunks/chunk-CNOJCW2I.js +21 -0
- package/dist/chunks/{chunk-UWGWRZP5.js → chunk-CS6E5XNQ.js} +1 -1
- package/dist/chunks/{chunk-MJ7JIQL3.js → chunk-D2XEF6G4.js} +1 -1
- package/dist/chunks/{chunk-HOOQ7ZMB.js → chunk-DPZFKHW3.js} +1 -1
- package/dist/chunks/{chunk-OORHGYZ3.js → chunk-EDLTSAD2.js} +1 -1
- package/dist/chunks/{chunk-JPEIHA57.js → chunk-EMORYAJQ.js} +1 -1
- package/dist/chunks/{chunk-HKZKGIBQ.js → chunk-ET5ARPPO.js} +1 -1
- package/dist/chunks/{chunk-TYL6IYR4.js → chunk-F34TG2V3.js} +1 -1
- package/dist/chunks/{chunk-RNTS4MJP.js → chunk-FJ5CNQDD.js} +1 -1
- package/dist/chunks/chunk-FOQK3VTY.js +8 -0
- package/dist/chunks/{chunk-767IBETW.js → chunk-FXF3NEJM.js} +3 -3
- package/dist/chunks/{chunk-G62JX3C5.js → chunk-GSXTCMKC.js} +1 -1
- package/dist/chunks/{chunk-2KINJIWA.js → chunk-H73G2ROF.js} +1 -1
- package/dist/chunks/{chunk-GKCTMBCM.js → chunk-IFXMG2WQ.js} +1 -1
- package/dist/chunks/{chunk-WRHQTUHU.js → chunk-J4OVLASZ.js} +1 -1
- package/dist/chunks/{chunk-VT2IZBPL.js → chunk-JAOYF7AW.js} +1 -1
- package/dist/chunks/{chunk-FSBAVQQP.js → chunk-JQTSETXH.js} +1 -1
- package/dist/chunks/{chunk-MYTOHLYZ.js → chunk-JYK7ZIZW.js} +1 -1
- package/dist/chunks/{chunk-5ULKEPKM.js → chunk-K3TCWYVX.js} +1 -1
- package/dist/chunks/{chunk-SAUBWYQJ.js → chunk-KPO6VDR2.js} +1 -1
- package/dist/chunks/{chunk-QRYQADGN.js → chunk-LBTMGBAK.js} +1 -1
- package/dist/chunks/{chunk-X4K3UJN7.js → chunk-MBJT3CNI.js} +1 -1
- package/dist/chunks/{chunk-GAGROISK.js → chunk-OCRNZT7G.js} +1 -1
- package/dist/chunks/chunk-OER4YAWM.js +7 -0
- package/dist/chunks/{chunk-GV2ZL4IE.js → chunk-OETX5QG4.js} +1 -1
- package/dist/chunks/{chunk-OEPDTNS3.js → chunk-P2SVNHTJ.js} +1 -1
- package/dist/chunks/{chunk-HTOZY5SI.js → chunk-QAYWROXQ.js} +1 -1
- package/dist/chunks/{chunk-VKJVYR4T.js → chunk-QGGJ5VVZ.js} +1 -1
- package/dist/chunks/{chunk-F6MHQRDG.js → chunk-RGQZXLV4.js} +1 -1
- package/dist/chunks/chunk-RHFPMM4R.js +70 -0
- package/dist/chunks/{chunk-WZAJYSJZ.js → chunk-RKWPLZJX.js} +1 -1
- package/dist/chunks/{chunk-43WS2YU4.js → chunk-RPWGUQSE.js} +1 -1
- package/dist/chunks/{chunk-FN3W5CJQ.js → chunk-RUXABBNV.js} +1 -1
- package/dist/chunks/{chunk-3DFEM7ZL.js → chunk-RVXE4MXS.js} +1 -1
- package/dist/chunks/chunk-SJA2LZ4O.js +24 -0
- package/dist/chunks/{chunk-2H4UEVTG.js → chunk-SOGL2HOD.js} +1 -1
- package/dist/chunks/{chunk-5XCOIFBD.js → chunk-SUMMI76H.js} +1 -1
- package/dist/chunks/{chunk-RCUDI7OF.js → chunk-T34C75TI.js} +1 -1
- package/dist/chunks/{chunk-FBYA6LLM.js → chunk-U3J7VS56.js} +1 -1
- package/dist/chunks/{chunk-4P6IRBBK.js → chunk-UF7QYHFU.js} +1 -1
- package/dist/chunks/{chunk-CNE5UGJC.js → chunk-UKJAWDQX.js} +1 -1
- package/dist/chunks/{chunk-DPM33VFZ.js → chunk-UMMQR6WI.js} +1 -1
- package/dist/chunks/{chunk-GTHPBDPB.js → chunk-VM3R6MAM.js} +2 -2
- package/dist/chunks/{chunk-A4UOBMZR.js → chunk-WGPYUXIC.js} +1 -1
- package/dist/chunks/{chunk-RQVIMYKN.js → chunk-WZ2R4Z7N.js} +1 -1
- package/dist/chunks/{chunk-YT3QAZQF.js → chunk-YEOOTTBB.js} +1 -1
- package/dist/chunks/clear-P2GBQ7OM.js +8 -0
- package/dist/chunks/compile-vercel-config-SPFLKB2T.js +7 -0
- package/dist/chunks/{config-3AXLL3GO.js → config-BI7WYZWB.js} +1 -1
- package/dist/chunks/config-PR2PEOA7.js +8 -0
- package/dist/chunks/delete-BZ3NLCTU.js +9 -0
- package/dist/chunks/delete-PUEGS2CP.js +10 -0
- package/dist/chunks/{detect-projects-EYF4ZSYF.js → detect-projects-A4H2ZEAP.js} +1 -1
- package/dist/chunks/detect-services-HHGBWOND.js +7 -0
- package/dist/chunks/disable-UYLN3HPM.js +7 -0
- package/dist/chunks/discard-NMRN5PS4.js +14 -0
- package/dist/chunks/edit-KA7OSMJA.js +9 -0
- package/dist/chunks/edit-UQ4J2OQ7.js +8 -0
- package/dist/chunks/enable-7FM67BEJ.js +7 -0
- package/dist/chunks/{exec-PX4GTZNE.js → exec-R5BDGSGP.js} +1 -1
- package/dist/chunks/{export-4RZRCFX7.js → export-FV6WM43O.js} +1 -1
- package/dist/chunks/future-3WF7CSGN.js +7 -0
- package/dist/chunks/generate-cert-for-deploy-3OBDQ2R3.js +7 -0
- package/dist/chunks/{image-UPFKBULX.js → image-SYY2IBOV.js} +1 -1
- package/dist/chunks/import-builders-IJYZSEBY.js +7 -0
- package/dist/chunks/inspect-3NZE4UWJ.js +13 -0
- package/dist/chunks/{inspect-2SCDEURI.js → inspect-DLADA2SX.js} +1 -1
- package/dist/chunks/inspect-J4WU7N2Z.js +9 -0
- package/dist/chunks/{inspect-IOKO45PV.js → inspect-W3RVFJLM.js} +1 -1
- package/dist/chunks/{inspect-UJAAVGJT.js → inspect-ZUHCIZFW.js} +1 -1
- package/dist/chunks/{list-PC4ZVIHQ.js → list-6EZHEJGK.js} +1 -1
- package/dist/chunks/list-GLYYBTWD.js +12 -0
- package/dist/chunks/{list-34Z62YFO.js → list-L4ZCXNAN.js} +1 -1
- package/dist/chunks/login-4OUKTVIZ.js +7 -0
- package/dist/chunks/login-E6L7CG3P.js +9 -0
- package/dist/chunks/logs-XHJPPHQ7.js +7 -0
- package/dist/chunks/{ls-PQBYVYPW.js → ls-36K3OMRV.js} +1 -1
- package/dist/chunks/{ls-ZK5ESMRT.js → ls-E75T2PHD.js} +1 -1
- package/dist/chunks/{ls-HQHXDVPG.js → ls-EIGVX2LB.js} +1 -1
- package/dist/chunks/{ls-MDTI26PW.js → ls-GSMTVAMC.js} +1 -1
- package/dist/chunks/{ls-FL3FCE2T.js → ls-IGICS6HZ.js} +1 -1
- package/dist/chunks/ls-PA4OVQ43.js +11 -0
- package/dist/chunks/ls-RKILAXZ4.js +8 -0
- package/dist/chunks/mutate-4L6XPD7X.js +9 -0
- package/dist/chunks/{notifications-A46PC7QX.js → notifications-IAKFNMTC.js} +1 -1
- package/dist/chunks/open-62S7LSPT.js +7 -0
- package/dist/chunks/{openapi-5QWHDLKR.js → openapi-SO34WDBK.js} +1 -1
- package/dist/chunks/{permissions-MCOS247Q.js → permissions-T2KL34JP.js} +1 -1
- package/dist/chunks/{plugin-offer-ZMTZG6FR.js → plugin-offer-HMNGWYIC.js} +1 -1
- package/dist/chunks/prompt-missing-credentials-WTRJREZF.js +7 -0
- package/dist/chunks/publish-EFZO7IO2.js +15 -0
- package/dist/chunks/pull-GVFCZAHC.js +7 -0
- package/dist/chunks/purchase-domain-if-available-PJMKV5BI.js +7 -0
- package/dist/chunks/push-PHTW37LC.js +7 -0
- package/dist/chunks/{query-OG4FG2AO.js → query-CUU7RRG6.js} +1 -1
- package/dist/chunks/reauthenticate-7P3C7ASY.js +7 -0
- package/dist/chunks/reorder-EBYXIVUZ.js +10 -0
- package/dist/chunks/reply-CBBADKE5.js +9 -0
- package/dist/chunks/resolve-KKFBXTIX.js +12 -0
- package/dist/chunks/resolve-agent-team-BBBIQWFZ.js +7 -0
- package/dist/chunks/restore-D4JUHPJ7.js +16 -0
- package/dist/chunks/rm-CRDLGD4Y.js +8 -0
- package/dist/chunks/rm-DSAXELZD.js +8 -0
- package/dist/chunks/rm-HXDTYZ3G.js +8 -0
- package/dist/chunks/rm-TDI6GXCE.js +8 -0
- package/dist/chunks/rm-XAUKTN2C.js +8 -0
- package/dist/chunks/{routes-LQGTKBXU.js → routes-RWILS4LA.js} +1 -1
- package/dist/chunks/rule-inspect-RKUBC35D.js +8 -0
- package/dist/chunks/{schema-H5RRV4J3.js → schema-5G57LHUD.js} +1 -1
- package/dist/chunks/schema-WSHKYL5H.js +14 -0
- package/dist/chunks/select-org-OKHCDXNF.js +7 -0
- package/dist/chunks/set-PBM7ZMZ7.js +7 -0
- package/dist/chunks/setup-and-link-PVMEKIYD.js +7 -0
- package/dist/chunks/{skills-CY57F35A.js → skills-4WEJZT7E.js} +1 -1
- package/dist/chunks/{tags-WAVSTC2G.js → tags-WUAMDEUU.js} +1 -1
- package/dist/chunks/{update-4LNUD2AB.js → update-IKZXIUYB.js} +1 -1
- package/dist/commands/build/index.js +1 -1
- package/dist/commands/deploy/index.js +5 -5
- package/dist/commands/dev/index.js +3 -3
- package/dist/commands/env/index.js +5 -2
- package/dist/commands/link/index.js +1 -1
- package/dist/commands/list/index.js +1 -1
- package/dist/commands/project/index.js +2 -2
- package/dist/commands-account.js +1 -1
- package/dist/commands-ai.js +2 -2
- package/dist/commands-blob.js +1 -1
- package/dist/commands-core.js +5 -5
- package/dist/commands-deployments.js +1 -1
- package/dist/commands-flags.js +82 -64
- package/dist/commands-integrations.js +1 -1
- package/dist/commands-observability.js +2 -2
- package/dist/commands-routing.js +3 -3
- package/dist/index.js +5 -5
- package/dist/internal-build.js +1 -1
- package/dist/native-download.js +1 -1
- package/dist/package.json +59 -59
- package/dist/version.mjs +1 -1
- package/package.json +52 -52
- package/dist/chunks/add-7G5PAIUN.js +0 -8
- package/dist/chunks/add-LA2T477X.js +0 -8
- package/dist/chunks/add-TPDABQQA.js +0 -8
- package/dist/chunks/build-A463NBA2.js +0 -7
- package/dist/chunks/chunk-DFXYDOFX.js +0 -20
- package/dist/chunks/chunk-I7YEXDVF.js +0 -22
- package/dist/chunks/chunk-LAINBICC.js +0 -7
- package/dist/chunks/chunk-MY4MONOH.js +0 -7
- package/dist/chunks/chunk-PH3ZOT3L.js +0 -21
- package/dist/chunks/chunk-QBP6E2YB.js +0 -24
- package/dist/chunks/chunk-QDQ4NHQN.js +0 -8
- package/dist/chunks/chunk-S22GZWJS.js +0 -8
- package/dist/chunks/chunk-TKKGZI7O.js +0 -57
- package/dist/chunks/clear-ISIDZTUZ.js +0 -8
- package/dist/chunks/compile-vercel-config-CZVX4OWQ.js +0 -7
- package/dist/chunks/config-MAFBMJV3.js +0 -8
- package/dist/chunks/delete-LLQFSC7R.js +0 -10
- package/dist/chunks/delete-PIFKRZEO.js +0 -9
- package/dist/chunks/detect-services-LNYPPBJP.js +0 -7
- package/dist/chunks/disable-7JLE53D2.js +0 -7
- package/dist/chunks/discard-EXDT6QIK.js +0 -14
- package/dist/chunks/edit-3NOKVF5V.js +0 -9
- package/dist/chunks/edit-BQCPB3ZR.js +0 -8
- package/dist/chunks/enable-KYVZIXZM.js +0 -7
- package/dist/chunks/future-YZGJX6FF.js +0 -7
- package/dist/chunks/generate-cert-for-deploy-I236CHA2.js +0 -7
- package/dist/chunks/import-builders-JEJRMLNC.js +0 -7
- package/dist/chunks/inspect-BMBFYISW.js +0 -13
- package/dist/chunks/inspect-P246VXF5.js +0 -9
- package/dist/chunks/list-WL3WA7CS.js +0 -12
- package/dist/chunks/login-BOBO3TKA.js +0 -9
- package/dist/chunks/login-RAN3UBFA.js +0 -7
- package/dist/chunks/logs-L3VFH7SK.js +0 -7
- package/dist/chunks/ls-FKECGTP3.js +0 -11
- package/dist/chunks/ls-NQVH63KO.js +0 -8
- package/dist/chunks/mutate-6OEPBAJF.js +0 -9
- package/dist/chunks/open-QWJQWDZD.js +0 -7
- package/dist/chunks/prompt-missing-credentials-AUJFBZRC.js +0 -7
- package/dist/chunks/publish-CQ5FHKNN.js +0 -15
- package/dist/chunks/pull-RVNTGJ4C.js +0 -7
- package/dist/chunks/purchase-domain-if-available-6FAGFFWC.js +0 -7
- package/dist/chunks/push-IBOUSKO7.js +0 -7
- package/dist/chunks/reauthenticate-TVQDXIFS.js +0 -7
- package/dist/chunks/reorder-LWKTDFSH.js +0 -10
- package/dist/chunks/reply-5CE2KUD7.js +0 -9
- package/dist/chunks/resolve-S35UEM35.js +0 -12
- package/dist/chunks/resolve-agent-team-DXHF7XLU.js +0 -7
- package/dist/chunks/restore-K66POLY7.js +0 -16
- package/dist/chunks/rm-6PBYTCDC.js +0 -8
- package/dist/chunks/rm-C4FXH2RT.js +0 -8
- package/dist/chunks/rm-C73EKJS4.js +0 -8
- package/dist/chunks/rm-MNT5XIGK.js +0 -8
- package/dist/chunks/rm-VJOHV243.js +0 -8
- package/dist/chunks/rule-inspect-4EBB5IDK.js +0 -8
- package/dist/chunks/schema-S32JRZH5.js +0 -14
- package/dist/chunks/select-org-VTLOMQYC.js +0 -7
- package/dist/chunks/set-52J54LJU.js +0 -7
- package/dist/chunks/setup-and-link-XGBTMVW7.js +0 -7
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{parseTeamRefs,teamRefBody}from"./chunk-LSF7FY6X.js";import{repositoryPermissionsPath}from"./chunk-DFVNL5ML.js";import{emitVcrArgParseError,resolveVcrScope,validateVcrJsonOutput}from"./chunk-F34TG2V3.js";import{outputError}from"./chunk-XSQVCDSD.js";import{require_async_sema}from"./chunk-NZ2TFADV.js";import"./chunk-T34C75TI.js";import"./chunk-GD7AV7BO.js";import{permissionsAddSubcommand}from"./chunk-QNL22LAW.js";import{printError}from"./chunk-LCMNJNSQ.js";import"./chunk-IFXMG2WQ.js";import{AGENT_REASON,buildCommandWithGlobalFlags,outputAgentError}from"./chunk-I7U2XP4X.js";import"./chunk-EPO7P734.js";import"./chunk-RHFPMM4R.js";import"./chunk-26QK3I2S.js";import"./chunk-55H6G46X.js";import"./chunk-4NTBYNFR.js";import{parseArguments}from"./chunk-F22QLVTX.js";import"./chunk-F53OKXYI.js";import"./chunk-7SAEZ4NC.js";import"./chunk-LUX4PBJL.js";import"./chunk-OPORM35X.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-OCR5CRTH.js";import"./chunk-4SAVH3H7.js";import{isAPIError}from"./chunk-YCJHUYBJ.js";import{packageName}from"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-DWOJP4ST.js";import"./chunk-BLUPZPAS.js";import"./chunk-RM3ZDRYE.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-OO572JUC.js";import{getFlagsSpecification}from"./chunk-A2UZ2O7H.js";import"./chunk-2BKALEOP.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-5O7CRJE5.js";import"./chunk-U3J7VS56.js";import"./chunk-7EJQLVWX.js";import"./chunk-SCV7XEEO.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_async_sema=__toESM(require_async_sema(),1);var USAGE="vcr permissions <repository> add <team>[,<team>...]";async function add(client,argv,telemetry){let parsedArgs;try{parsedArgs=parseArguments(argv,getFlagsSpecification(permissionsAddSubcommand.options))}catch(err){return emitVcrArgParseError(client,err,USAGE),printError(err),2}let fr=validateVcrJsonOutput(client,parsedArgs.flags);if(typeof fr=="number")return fr;let repository=parsedArgs.args[0],teamRefs=parseTeamRefs(parsedArgs.args.slice(2)),project=parsedArgs.flags["--project"];if(telemetry.trackCliOptionProject(project),telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]),teamRefs.length===0)return outputAgentError(client,{status:"error",reason:AGENT_REASON.MISSING_ARGUMENTS,message:`Missing team. Example: ${packageName} vcr permissions ${repository} add team_1a2b3c4d`,next:[{command:buildCommandWithGlobalFlags(client.argv,USAGE),when:"Replace <team> with a team id or slug (comma-separate multiple teams)"}]},2),outputError(client,fr.jsonOutput,"MISSING_ARGUMENTS",`Usage: \`vercel ${USAGE}\``);let scope=await resolveVcrScope(client,{project,jsonOutput:fr.jsonOutput});if(typeof scope=="number")return scope;let path=repositoryPermissionsPath(scope,repository),added=[],failed=[];output_manager_default.spinner(`Sharing ${repository} with ${teamRefs.length===1?teamRefs[0]:`${teamRefs.length} teams`}...`);let sema=new import_async_sema.default(10),results;try{results=await Promise.all(teamRefs.map(async team=>{await sema.acquire();try{let result=await client.fetch(path,{method:"POST",body:teamRefBody(team)});return{ok:!0,team,permission:result.permission}}catch(err){if(!isAPIError(err))throw err;let message=err.serverMessage||`API error (${err.status}).`;return{ok:!1,team,failure:{team,code:err.code||"API_ERROR",message}}}finally{sema.release()}}))}finally{output_manager_default.stopSpinner()}for(let result of results)result.ok?(added.push(result.permission),fr.jsonOutput||output_manager_default.success(`Shared ${repository} with ${result.permission?.teamSlug??result.team}`)):(failed.push(result.failure),fr.jsonOutput||output_manager_default.error(`Failed to share ${repository} with ${result.team}: ${result.failure.message}`));return failed.length>0&&outputAgentError(client,{status:"error",reason:AGENT_REASON.API_ERROR,message:`Failed to share ${repository} with ${failed.map(f=>`${f.team} (${f.message})`).join(", ")}`},1),fr.jsonOutput&&client.stdout.write(`${JSON.stringify({permissions:added,failed},null,2)}
|
|
8
|
+
`),failed.length>0?1:0}export{add as default};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{emitVcrArgParseError,handleVcrApiError,resolveVcrScope,validateVcrJsonOutput}from"./chunk-F34TG2V3.js";import{outputError}from"./chunk-XSQVCDSD.js";import"./chunk-T34C75TI.js";import"./chunk-GD7AV7BO.js";import{addSubcommand}from"./chunk-HMWDOAWO.js";import"./chunk-QNL22LAW.js";import"./chunk-UWMPVTXG.js";import"./chunk-5CZNUB7Y.js";import{printError}from"./chunk-LCMNJNSQ.js";import"./chunk-IFXMG2WQ.js";import{AGENT_REASON,buildCommandWithGlobalFlags,outputAgentError}from"./chunk-I7U2XP4X.js";import"./chunk-EPO7P734.js";import"./chunk-RHFPMM4R.js";import"./chunk-26QK3I2S.js";import"./chunk-55H6G46X.js";import"./chunk-4NTBYNFR.js";import{parseArguments}from"./chunk-F22QLVTX.js";import"./chunk-F53OKXYI.js";import"./chunk-7SAEZ4NC.js";import"./chunk-LUX4PBJL.js";import"./chunk-OPORM35X.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-OCR5CRTH.js";import"./chunk-4SAVH3H7.js";import{isAPIError}from"./chunk-YCJHUYBJ.js";import{packageName}from"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-DWOJP4ST.js";import"./chunk-BLUPZPAS.js";import"./chunk-RM3ZDRYE.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-OO572JUC.js";import{getFlagsSpecification}from"./chunk-A2UZ2O7H.js";import"./chunk-2BKALEOP.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-5O7CRJE5.js";import"./chunk-U3J7VS56.js";import"./chunk-7EJQLVWX.js";import"./chunk-SCV7XEEO.js";import"./chunk-BZENIQ7N.js";async function add(client,argv,telemetry){let parsedArgs;try{parsedArgs=parseArguments(argv,getFlagsSpecification(addSubcommand.options))}catch(err){return emitVcrArgParseError(client,err,"vcr create <name> --project <name-or-id>"),printError(err),2}let fr=validateVcrJsonOutput(client,parsedArgs.flags);if(typeof fr=="number")return fr;let name=parsedArgs.args[0],project=parsedArgs.flags["--project"];if(telemetry.trackCliOptionProject(project),telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]),!name)return outputAgentError(client,{status:"error",reason:AGENT_REASON.MISSING_ARGUMENTS,message:`Missing repository name. Example: ${packageName} vcr create <name>`,next:[{command:buildCommandWithGlobalFlags(client.argv,"vcr create <name>"),when:"Replace <name> with the repository name to create"}]},2),outputError(client,fr.jsonOutput,"MISSING_ARGUMENTS","Usage: `vercel vcr create <name>`");let scope=await resolveVcrScope(client,{project,jsonOutput:fr.jsonOutput});if(typeof scope=="number")return scope;let path=`/v1/vcr/repository?teamId=${encodeURIComponent(scope.teamId)}`;output_manager_default.spinner("Creating repository...");try{let created=await client.fetch(path,{method:"POST",body:{projectId:scope.projectId,name}});return fr.jsonOutput?client.stdout.write(`${JSON.stringify(created,null,2)}
|
|
8
|
+
`):output_manager_default.success(`Created repository ${created.repository?.name??name}`),0}catch(err){if(isAPIError(err))return handleVcrApiError(client,err,fr.jsonOutput,{retry:{command:buildCommandWithGlobalFlags(client.argv,"vcr ls"),when:"List existing repositories (a name conflict means it already exists)"}});throw err}finally{output_manager_default.stopSpinner()}}export{add as default};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{printRuleMutationReceipt}from"./chunk-OGSTNJJ5.js";import"./chunk-SKSOCUDZ.js";import{resolveRulesProject,resolveRulesTeam}from"./chunk-ET5ARPPO.js";import"./chunk-SOGL2HOD.js";import"./chunk-GZNDA6SV.js";import{emitRulesArgParseError,getBodyType,handleRulesApiError,outputRulesError,readRuleBody,rulesCollectionPath}from"./chunk-DPZFKHW3.js";import"./chunk-GHAY4PSD.js";import"./chunk-XSQVCDSD.js";import"./chunk-ID663OJ7.js";import"./chunk-HRR57QNP.js";import"./chunk-PFD7LETF.js";import"./chunk-5SIC5273.js";import{monitorsAddSubcommand}from"./chunk-BGWS5R5R.js";import{printError}from"./chunk-LCMNJNSQ.js";import"./chunk-67GZ5REA.js";import"./chunk-BS32OUOC.js";import"./chunk-IFXMG2WQ.js";import"./chunk-I7U2XP4X.js";import"./chunk-EPO7P734.js";import"./chunk-RHFPMM4R.js";import"./chunk-26QK3I2S.js";import"./chunk-55H6G46X.js";import"./chunk-4NTBYNFR.js";import{parseArguments}from"./chunk-F22QLVTX.js";import"./chunk-F53OKXYI.js";import{validateJsonOutput}from"./chunk-7SAEZ4NC.js";import"./chunk-LUX4PBJL.js";import"./chunk-OPORM35X.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-OCR5CRTH.js";import"./chunk-4SAVH3H7.js";import{isAPIError}from"./chunk-YCJHUYBJ.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-DWOJP4ST.js";import"./chunk-BLUPZPAS.js";import"./chunk-RM3ZDRYE.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-OO572JUC.js";import{getFlagsSpecification}from"./chunk-A2UZ2O7H.js";import"./chunk-2BKALEOP.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-5O7CRJE5.js";import"./chunk-U3J7VS56.js";import"./chunk-7EJQLVWX.js";import"./chunk-SCV7XEEO.js";import"./chunk-BZENIQ7N.js";function applyScopeFlag(client,body,type,scope,flags,jsonOutput){if(Object.hasOwn(body,"ruleScope"))return flags["--project"]||flags["--all"]?outputRulesError(client,jsonOutput,"SCOPE_CONFLICT","Specify monitor scope either in the body or with --project/--all, not both."):void 0;if(flags["--project"]){body.ruleScope=type==="custom"?{type:"project",projectId:scope.projectId}:{type:"include",projectIds:[scope.projectId]};return}if(flags["--all"]){if(type==="custom")return outputRulesError(client,jsonOutput,"INVALID_SCOPE","Custom monitors must target one project. Use --project <name-or-id>.");body.ruleScope={type:"all"};return}return outputRulesError(client,jsonOutput,"MISSING_SCOPE","Missing monitor scope. Add ruleScope to the body, or pass --project or --all.")}async function resolveCreateScope(client,flags,jsonOutput){return flags["--project"]&&flags["--all"]?outputRulesError(client,jsonOutput,"MUTUAL_EXCLUSIVITY","Cannot specify both --all and --project. Use one or the other."):flags["--project"]?resolveRulesProject(client,flags["--project"],jsonOutput,"monitors add"):resolveRulesTeam(client,jsonOutput)}async function add(client,argv,api){let parsedArgs;try{parsedArgs=parseArguments(argv,getFlagsSpecification(monitorsAddSubcommand.options))}catch(error){return emitRulesArgParseError(client,error,"monitors add --project <name-or-id> --body <path>"),printError(error),2}let flags=parsedArgs.flags,format=validateJsonOutput(flags);if(!format.valid)return outputRulesError(client,!1,"INVALID_ARGUMENTS",format.error);if(!flags["--body"])return outputRulesError(client,format.jsonOutput,"MISSING_ARGUMENTS","Missing required option: --body <PATH>.");let body=readRuleBody(client,flags["--body"],format.jsonOutput);if(typeof body=="number")return body;let type=getBodyType(body);if(!type)return outputRulesError(client,format.jsonOutput,"INVALID_RULE_TYPE","Create body must set a supported monitor type.");if(Object.hasOwn(body,"ruleScope")&&(flags["--project"]||flags["--all"]))return outputRulesError(client,format.jsonOutput,"SCOPE_CONFLICT","Specify monitor scope either in the body or with --project/--all, not both.");if(type==="custom"&&flags["--all"])return outputRulesError(client,format.jsonOutput,"INVALID_SCOPE","Custom monitors must target one project. Use --project <name-or-id>.");let scope=await resolveCreateScope(client,flags,format.jsonOutput);if(typeof scope=="number")return scope;let scopeError=applyScopeFlag(client,body,type,scope,flags,format.jsonOutput);if(scopeError!==void 0)return scopeError;output_manager_default.spinner("Creating monitor\u2026");try{let response=await client.fetch(rulesCollectionPath(api,scope.teamId),{method:"POST",body});return format.jsonOutput?client.stdout.write(`${JSON.stringify(response,null,2)}
|
|
8
|
+
`):printRuleMutationReceipt("Created",response[api.itemKey],client.argv),0}catch(error){if(isAPIError(error))return handleRulesApiError(client,error,format.jsonOutput);throw error}finally{output_manager_default.stopSpinner()}}export{add as default};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{DEFAULT_TAG,buildRepositoryReference,parseNameArg,validateImageParts}from"./chunk-HEGJZJO7.js";import{VCR_ENGINES,emitVcrArgParseError,isBuildxAvailable,isEngineInstalled,pushCompressionArgs,reportEngineCommandFailure,reportEnginePushFailure,resolveRegistry,resolveVcrScope,runEngine,splitPassthrough,validateVcrChoice}from"./chunk-F34TG2V3.js";import{outputError}from"./chunk-XSQVCDSD.js";import"./chunk-T34C75TI.js";import"./chunk-GD7AV7BO.js";import{buildSubcommand}from"./chunk-HMWDOAWO.js";import"./chunk-QNL22LAW.js";import"./chunk-UWMPVTXG.js";import"./chunk-5CZNUB7Y.js";import{printError}from"./chunk-LCMNJNSQ.js";import"./chunk-IFXMG2WQ.js";import{AGENT_REASON,buildCommandWithGlobalFlags,outputAgentError}from"./chunk-I7U2XP4X.js";import"./chunk-EPO7P734.js";import"./chunk-RHFPMM4R.js";import"./chunk-26QK3I2S.js";import"./chunk-55H6G46X.js";import"./chunk-4NTBYNFR.js";import{parseArguments}from"./chunk-F22QLVTX.js";import"./chunk-F53OKXYI.js";import"./chunk-7SAEZ4NC.js";import"./chunk-LUX4PBJL.js";import"./chunk-OPORM35X.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-OCR5CRTH.js";import"./chunk-4SAVH3H7.js";import"./chunk-YCJHUYBJ.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-DWOJP4ST.js";import"./chunk-BLUPZPAS.js";import"./chunk-RM3ZDRYE.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-OO572JUC.js";import{getFlagsSpecification}from"./chunk-A2UZ2O7H.js";import"./chunk-2BKALEOP.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-5O7CRJE5.js";import"./chunk-U3J7VS56.js";import"./chunk-7EJQLVWX.js";import"./chunk-SCV7XEEO.js";import"./chunk-BZENIQ7N.js";var DEFAULT_PLATFORM="linux/amd64";async function build(client,telemetry){let{own,passthrough}=splitPassthrough(client.argv),parsedArgs;try{parsedArgs=parseArguments(own,getFlagsSpecification(buildSubcommand.options))}catch(err){return emitVcrArgParseError(client,err,"vcr build <engine> [path] [name[:tag]]"),printError(err),2}let[engineArg,pathArg,nameArg]=parsedArgs.args.slice(2),project=parsedArgs.flags["--project"],platform=parsedArgs.flags["--platform"],push=!!parsedArgs.flags["--push"];if(telemetry.trackCliArgumentEngine(engineArg),telemetry.trackCliArgumentPath(pathArg),telemetry.trackCliArgumentName(nameArg),telemetry.trackCliOptionProject(project),telemetry.trackCliOptionPlatform(platform),telemetry.trackCliFlagPush(push),!engineArg){let message=`Missing engine. Choose one of: ${VCR_ENGINES.join(", ")}.`;return outputAgentError(client,{status:"error",reason:AGENT_REASON.MISSING_ARGUMENTS,message,next:[{command:buildCommandWithGlobalFlags(client.argv,"vcr build docker"),when:"Replace docker with the container tool you use"}]},2),outputError(client,!1,"MISSING_ARGUMENTS",message)}let choiceError=validateVcrChoice(client,"engine",engineArg,VCR_ENGINES,!1);if(typeof choiceError=="number")return choiceError;let engine=engineArg;if(!isEngineInstalled(engine)){let message=`\`${engine}\` is not installed or not on your PATH. Install it and try again.`;return outputAgentError(client,{status:"error",reason:"engine_not_found",message},1),outputError(client,!1,"ENGINE_NOT_FOUND",message)}let scope=await resolveVcrScope(client,{project,jsonOutput:!1});if(typeof scope=="number")return scope;let parsed=parseNameArg(nameArg,scope.projectName);if("error"in parsed)return outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message:parsed.error},2),outputError(client,!1,"INVALID_ARGUMENTS",parsed.error);let validationError=validateImageParts(parsed);if(validationError)return outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message:validationError},2),outputError(client,!1,"INVALID_ARGUMENTS",validationError);let ref=`${buildRepositoryReference({registry:resolveRegistry(),teamSlug:scope.teamSlug,projectName:scope.projectName,repository:parsed.repository})}:${parsed.tag??DEFAULT_TAG}`,contextPath=pathArg??".",buildPlatform=platform??DEFAULT_PLATFORM;if(push&&engine==="docker"&&await isBuildxAvailable()){let outputSpec=`type=image,name=${ref},push=true,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true`,engineArgs2=["buildx","build","--platform",buildPlatform,"--output",outputSpec,...passthrough,contextPath];output_manager_default.log(`Running: ${engine} ${engineArgs2.join(" ")}`);let result2=await runEngine(engine,engineArgs2,{cwd:client.cwd,captureStderr:!0});return result2.exitCode!==0?reportEnginePushFailure(client,engine,"buildx build",result2):(output_manager_default.success(`Built and pushed ${ref} (zstd compression)`),0)}push&&engine==="docker"&&output_manager_default.warn("Docker Buildx is not available; building and pushing without zstd compression. Install Buildx for smaller, faster image pushes.");let engineArgs=["build","--platform",buildPlatform,"--tag",ref,...passthrough,contextPath];output_manager_default.log(`Running: ${engine} ${engineArgs.join(" ")}`);let result=await runEngine(engine,engineArgs,{cwd:client.cwd});if(result.exitCode!==0)return reportEngineCommandFailure(client,engine,"build",result);if(!push)return output_manager_default.success(`Built ${ref}`),output_manager_default.log(`Push it with \`${buildCommandWithGlobalFlags(client.argv,`vcr push ${engine}${nameArg?` ${nameArg}`:""}`)}\`.`),0;let pushArgs=["push",...pushCompressionArgs(engine),ref];output_manager_default.log(`Running: ${engine} ${pushArgs.join(" ")}`);let pushResult=await runEngine(engine,pushArgs,{cwd:client.cwd,captureStderr:!0});if(pushResult.exitCode!==0)return reportEnginePushFailure(client,engine,"push",pushResult);let compressed=engine!=="docker";return output_manager_default.success(`Built and pushed ${ref}${compressed?" (zstd compression)":""}`),0}export{build as default};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{require_open}from"./chunk-PVASGBEF.js";import{getTeams}from"./chunk-P6ZTEDX2.js";import{printError}from"./chunk-LCMNJNSQ.js";import{TelemetryClient}from"./chunk-4BIGNS67.js";import{createDpopKey,deleteDpopKey,deviceAccessTokenRequest,deviceAuthorizationRequest,getUser,humanizePath,isDpopLoginEnabled,isOAuthError,processDeviceAuthorizationResponse,processTokenResponse}from"./chunk-RHFPMM4R.js";import{getTeamByIdOrSlug}from"./chunk-F53OKXYI.js";import{getCommandName}from"./chunk-JESNVRVR.js";import{emoji,output_manager_default}from"./chunk-DWOJP4ST.js";import{require_dist}from"./chunk-RM3ZDRYE.js";import{require_ansi_escapes}from"./chunk-YHPPP3SF.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1),import_error_utils=__toESM(require_dist(),1),open=__toESM(require_open(),1),import_ansi_escapes=__toESM(require_ansi_escapes(),1);import readline from"node:readline";import{KNOWN_AGENTS}from"@vercel/detect-agent";async function updateCurrentTeamAfterLogin(client,ssoTeamId){if(ssoTeamId)client.updateConfig({currentTeam:ssoTeamId});else{let user=null;try{user=await getUser(client)}catch{return output_manager_default.error("Failed to fetch the logged in user. Please try again."),1}client.updateConfig({currentTeam:user.version==="northstar"&&user.defaultTeamId?user.defaultTeamId:void 0})}}var LoginTelemetryClient=class extends TelemetryClient{trackState(...args){this.trackLoginState(...args)}trackDpopKey(storage){this.trackDpopKeyStorage(storage)}};function getSignupVerificationUrl(verificationUriComplete,email){let deviceUrl=new URL(verificationUriComplete),signupUrl=new URL("/signup",deviceUrl.origin);return signupUrl.searchParams.set("email",email),signupUrl.searchParams.set("autoSubmit","1"),signupUrl.searchParams.set("next",`${deviceUrl.pathname}${deviceUrl.search}`),signupUrl.toString()}async function performDeviceCodeFlow(client,options){let dpopKey=getDpopKeyForLogin(client,options),isNewKey=dpopKey!==client.authConfig.dpop?.key,tokens=null;try{return tokens=await runDeviceCodeFlow(client,options,dpopKey),tokens}finally{dpopKey&&isNewKey&&!tokens&&deleteDpopKey(dpopKey)}}async function runDeviceCodeFlow(client,options,dpopKey){let deviceAuthorizationResponse=await deviceAuthorizationRequest({refresh_token:options?.refreshToken,acr_values:options?.acrValues});output_manager_default.debug(`'Device Authorization response:', ${await deviceAuthorizationResponse.clone().text()}`);let[deviceAuthorizationError,deviceAuthorization]=await processDeviceAuthorizationResponse(deviceAuthorizationResponse);if(deviceAuthorizationError)return options?.fallbackToLoginOnStepUpFailure&&options.refreshToken&&isOAuthError(deviceAuthorizationError)&&(deviceAuthorizationError.code==="invalid_grant"||deviceAuthorizationError.code==="invalid_scope")?(output_manager_default.debug(`Step-up device authorization failed: ${deviceAuthorizationError.cause.message}`),output_manager_default.log("Couldn't refresh the saved login. Starting a new login."),performDeviceCodeFlow(client,options.teamId?{teamId:options.teamId}:void 0)):(printError(isOAuthError(deviceAuthorizationError)?deviceAuthorizationError.cause:deviceAuthorizationError),null);let{device_code,user_code,verification_uri,expiresAt,interval}=deviceAuthorization,{verification_uri_complete}=deviceAuthorization;if(options?.teamId){let url=new URL(verification_uri_complete);url.searchParams.set("team_id",options.teamId),verification_uri_complete=url.toString()}let isCursorAgent=client.agentName===KNOWN_AGENTS.CURSOR||client.agentName===KNOWN_AGENTS.CURSOR_CLI,shouldSkipBrowser=process.env.CI&&!isCursorAgent,browserUrl=verification_uri_complete;if(options?.signupEmail?(browserUrl=getSignupVerificationUrl(verification_uri_complete,options.signupEmail),output_manager_default.log(`
|
|
8
|
+
Visit ${import_chalk.default.bold(output_manager_default.link(new URL(browserUrl).host+"/signup",browserUrl,{color:!1,fallback:()=>browserUrl}))} to create your account with ${import_chalk.default.bold(options.signupEmail)} (device code ${import_chalk.default.bold(user_code)}).
|
|
9
|
+
`)):output_manager_default.log(`
|
|
10
|
+
Visit ${import_chalk.default.bold(output_manager_default.link(verification_uri.replace("https://",""),verification_uri_complete,{color:!1,fallback:()=>verification_uri_complete}))}${output_manager_default.supportsHyperlink?` and enter ${import_chalk.default.bold(user_code)}`:""}
|
|
11
|
+
`),!shouldSkipBrowser)try{(await open.default(browserUrl)).on("error",error=>{output_manager_default.debug(`Failed to open browser: ${error}`)})}catch(error){output_manager_default.debug(`Failed to open browser: ${error}`),client.isAgent&&client.nonInteractive&&(output_manager_default.log(`
|
|
12
|
+
${import_chalk.default.yellow("\u26A0")} ${import_chalk.default.bold("Browser could not be opened automatically.")}
|
|
13
|
+
`),output_manager_default.log(`Please ask the user to manually visit the URL above and complete the authentication process.
|
|
14
|
+
`))}let rl=readline.createInterface({input:process.stdin,output:process.stdout}).on("SIGINT",()=>{process.exit(0)});output_manager_default.spinner("Waiting for authentication...");let intervalMs=interval*1e3,result=null,flowError=new Error("Timed out waiting for authentication. Please try again.");async function pollForToken(){for(;Date.now()<expiresAt;){let[tokenResponseError,tokenResponse]=await deviceAccessTokenRequest({device_code,dpopKey});if(tokenResponseError){if(tokenResponseError.message.includes("timeout")){intervalMs*=2,output_manager_default.debug(`Connection timeout. Slowing down, polling every ${intervalMs/1e3}s...`),await wait(intervalMs);continue}return tokenResponseError}output_manager_default.debug(`'Device Access Token response:', ${await tokenResponse.clone().text()}`);let[tokensError,tokens]=await processTokenResponse(tokenResponse,{dpop:!!dpopKey});if(isOAuthError(tokensError)){let{code}=tokensError;switch(code){case"authorization_pending":await wait(intervalMs);continue;case"slow_down":intervalMs+=5*1e3,output_manager_default.debug(`Authorization server requests to slow down. Polling every ${intervalMs/1e3}s...`),await wait(intervalMs);continue;default:return tokensError.cause}}if(tokensError)return tokensError;output_manager_default.print((0,import_ansi_escapes.eraseLines)(2)),result={access_token:tokens.access_token,expires_in:tokens.expires_in,refresh_token:tokens.refresh_token,dpop:dpopKey&&{key:dpopKey}};return}}return flowError=await pollForToken(),output_manager_default.stopSpinner(),rl.close(),flowError?(printError(flowError),null):result}function getDpopKeyForLogin(client,options){if(options?.refreshToken)return client.authConfig.dpop?.key;if(!isDpopLoginEnabled())return;let telemetry=new LoginTelemetryClient({opts:{store:client.telemetryEventStore}});return createDpopKey(storage=>telemetry.trackDpopKey(storage))}async function login(client,telemetry,standalone=!0,scope){let tokens=await performDeviceCodeFlow(client);return tokens?(await saveDeviceCodeTokens(client,tokens,scope),standalone?output_manager_default.print(`
|
|
15
|
+
${import_chalk.default.cyan("Congratulations!")} You are now signed in.
|
|
16
|
+
|
|
17
|
+
To deploy something, run ${getCommandName()}.
|
|
18
|
+
To set up the Vercel plugin and connect your coding agents to the AI Gateway, run ${getCommandName("setup")}.
|
|
19
|
+
|
|
20
|
+
${emoji("tip")} To deploy every commit automatically,
|
|
21
|
+
connect a Git Repository (${import_chalk.default.bold(output_manager_default.link("vercel.link/git","https://vercel.link/git",{color:!1}))}).
|
|
22
|
+
`):output_manager_default.success("Logged in."),telemetry.trackState("success"),0):(telemetry.trackState("error"),1)}async function saveDeviceCodeTokens(client,tokens,scope){let runTeam=client.config.currentTeam,previousTeamId=client.ignoresSavedTeam?client.savedTeam:runTeam;client.updateAuthConfig({token:tokens.access_token,userId:void 0,expiresAt:Math.floor(Date.now()/1e3)+tokens.expires_in,refreshToken:tokens.refresh_token,dpop:tokens.dpop});let scopeTeamId=scope?await findScopeTeamId(client,scope):void 0;if(scopeTeamId)client.updateConfig({currentTeam:scopeTeamId});else if(previousTeamId){let isMember=!0;try{isMember=(await getTeams(client)).some(team=>team.id===previousTeamId)}catch{}isMember||(output_manager_default.warn("Your previously selected team is no longer accessible; switching to your default scope."),client.updateConfig({currentTeam:void 0}),await updateCurrentTeamAfterLogin(client))}else client.updateConfig({currentTeam:void 0}),await updateCurrentTeamAfterLogin(client);client.persistAuthConfig(),client.writeToConfigFile(),client.ignoresSavedTeam&&(client.config.currentTeam=runTeam),output_manager_default.debug(`Saved credentials in "${humanizePath(client.getGlobalPathConfig())}"`)}async function findScopeTeamId(client,scope){try{return(await getTeamByIdOrSlug(client,scope,{useCurrentTeam:!1})).id}catch(err){output_manager_default.debug(`Could not resolve --scope "${scope}": ${(0,import_error_utils.errorToString)(err)}`),output_manager_default.warn(`Couldn't find the team "${scope}", so it wasn't saved. Run ${getCommandName("switch")} to choose a team.`);return}}async function wait(intervalMs){await new Promise(resolve=>setTimeout(resolve,intervalMs))}export{LoginTelemetryClient,getSignupVerificationUrl,performDeviceCodeFlow,login,saveDeviceCodeTokens};
|
|
@@ -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{HOMEBREW_UPGRADE_COMMAND,getUpdateCommandInfo,getUpgradePackageManager,isGlobal,trustedUpgradeDirectory,trustedUpgradeEnvironment}from"./chunk-5ULKEPKM.js";import{require_semver}from"./chunk-BPUANOGW.js";import{progress}from"./chunk-U56NHYAH.js";import{require_tar_fs}from"./chunk-RQVIMYKN.js";import{require_ci_info}from"./chunk-2EYYB6YN.js";import{getInstallRoot,isNativeBinaryInstall}from"./chunk-NWGBDBZI.js";import{getCachedUsername,require_lib}from"./chunk-TKKGZI7O.js";import{output_manager_default}from"./chunk-DWOJP4ST.js";import{pkg_default}from"./chunk-OO572JUC.js";import{fetch,toNodeReadable}from"./chunk-MY4MONOH.js";import{__commonJS,__require,__toESM}from"./chunk-BZENIQ7N.js";var require_lib2=__commonJS({"../../node_modules/.pnpm/os-paths@4.4.0/node_modules/os-paths/src/lib/index.js"(exports,module){"use strict";var os=__require("os"),paths=__require("path"),isWinOS=/^win/i.test(process.platform);function normalize_path(path){return paths.normalize(paths.join(path,"."))}var base=()=>{let{env}=process,object={};return object.home=()=>normalize_path(os.homedir?os.homedir():env.HOME),object.temp=()=>normalize_path(os.tmpdir?os.tmpdir():env.TMPDIR||env.TEMP||env.TMP),object},windows=()=>{let{env}=process,object={};return object.home=()=>normalize_path(os.homedir?os.homedir():env.USERPROFILE||paths.join(env.HOMEDRIVE,env.HOMEPATH)||env.HOME),object.temp=()=>normalize_path(os.tmpdir?os.tmpdir():env.TEMP||env.TMP||paths.join(env.LOCALAPPDATA||env.SystemRoot||env.windir,"Temp")),object},_OSPaths=class __OSPaths{constructor(){let OSPaths=function(){return new __OSPaths};this._fn=OSPaths;let extension=isWinOS?windows():base();return Object.keys(extension).forEach(key=>{this._fn[key]=extension[key]}),this._fn}};module.exports=new _OSPaths}});var require_lib3=__commonJS({"../../node_modules/.pnpm/xdg-portable@7.3.0/node_modules/xdg-portable/src/lib/index.js"(exports,module){"use strict";var path=__require("path"),osPaths=require_lib2(),linux=()=>{let object={};return object.cache=()=>process.env.XDG_CACHE_HOME||path.join(osPaths.home()||osPaths.temp(),".cache"),object.config=()=>process.env.XDG_CONFIG_HOME||path.join(osPaths.home()||osPaths.temp(),".config"),object.data=()=>process.env.XDG_DATA_HOME||path.join(osPaths.home()||osPaths.temp(),".local","share"),object.runtime=()=>process.env.XDG_RUNTIME_DIR||void 0,object.state=()=>process.env.XDG_STATE_HOME||path.join(osPaths.home()||osPaths.temp(),".local","state"),object},macos=()=>{let object={};return object.cache=()=>process.env.XDG_CACHE_HOME||path.join(path.join(osPaths.home()||osPaths.temp(),"Library"),"Caches"),object.config=()=>process.env.XDG_CONFIG_HOME||path.join(path.join(osPaths.home()||osPaths.temp(),"Library"),"Preferences"),object.data=()=>process.env.XDG_DATA_HOME||path.join(path.join(osPaths.home()||osPaths.temp(),"Library"),"Application Support"),object.runtime=()=>process.env.XDG_RUNTIME_DIR||void 0,object.state=()=>process.env.XDG_STATE_HOME||path.join(path.join(osPaths.home()||osPaths.temp(),"Library"),"State"),object},windows=()=>{let object={};return object.cache=()=>{let localAppData=process.env.LOCALAPPDATA||path.join(osPaths.home()||osPaths.temp(),"AppData","Local");return process.env.XDG_CACHE_HOME||path.join(localAppData,"xdg.cache")},object.config=()=>{let appData=process.env.APPDATA||path.join(osPaths.home()||osPaths.temp(),"AppData","Roaming");return process.env.XDG_CONFIG_HOME||path.join(appData,"xdg.config")},object.data=()=>{let appData=process.env.APPDATA||path.join(osPaths.home()||osPaths.temp(),"AppData","Roaming");return process.env.XDG_DATA_HOME||path.join(appData,"xdg.data")},object.runtime=()=>process.env.XDG_RUNTIME_DIR||void 0,object.state=()=>{let localAppData=process.env.LOCALAPPDATA||path.join(osPaths.home()||osPaths.temp(),"AppData","Local");return process.env.XDG_STATE_HOME||path.join(localAppData,"xdg.state")},object},_XDGPortable=()=>{let XDGPortable=function(){return _XDGPortable()},extension={};return/^darwin$/i.test(process.platform)?extension=macos():/^win/i.test(process.platform)?extension=windows():extension=linux(),extension.configDirs=()=>{let dirs=[];return dirs.push(extension.config()),process.env.XDG_CONFIG_DIRS&&dirs.push(...process.env.XDG_CONFIG_DIRS.split(path.delimiter)),dirs},extension.dataDirs=()=>{let dirs=[];return dirs.push(extension.data()),process.env.XDG_DATA_DIRS&&dirs.push(...process.env.XDG_DATA_DIRS.split(path.delimiter)),dirs},Object.keys(extension).forEach(key=>{XDGPortable[key]=extension[key]}),XDGPortable};module.exports=_XDGPortable()}});var require_xdg_app_paths=__commonJS({"../../node_modules/.pnpm/xdg-app-paths@5.1.0/node_modules/xdg-app-paths/index.js"(exports,module){"use strict";var path=__require("path"),os=__require("os"),xdg=require_lib3(),isWinOS=/^win/i.test(process.platform);function _normalizeOptions(options,isolated){if(options=options||{},typeof options!="object"&&(options={isolated:options}),options.isolated=options.isolated===void 0||options.isolated===null?isolated:options.isolated,typeof options.isolated!="boolean")throw new TypeError(`Expected boolean for "isolated" argument, got ${typeof options.isolated}`);return options}var base=(name,isolated)=>{let object={};return object.cache=(options={isolated:null})=>(options=_normalizeOptions(options,isolated),path.join(xdg.cache(),options.isolated?name:"")),object.config=(options={isolated:null})=>(options=_normalizeOptions(options,isolated),path.join(xdg.config(),options.isolated?name:"")),object.data=(options={isolated:null})=>(options=_normalizeOptions(options,isolated),path.join(xdg.data(),options.isolated?name:"")),object.runtime=(options={isolated:null})=>(options=_normalizeOptions(options,isolated),xdg.runtime()?path.join(xdg.runtime(),options.isolated?name:""):void 0),object.state=(options={isolated:null})=>(options=_normalizeOptions(options,isolated),path.join(xdg.state(),options.isolated?name:"")),object.configDirs=(options={isolated:null})=>(options=_normalizeOptions(options,isolated),xdg.configDirs().map(s=>path.join(s,options.isolated?name:""))),object.dataDirs=(options={isolated:null})=>(options=_normalizeOptions(options,isolated),xdg.dataDirs().map(s=>path.join(s,options.isolated?name:""))),object},windows=(name,isolated)=>{let{env}=process,homedir=os.homedir(),tmpdir2=os.tmpdir(),appData=env.APPDATA||path.join(homedir||tmpdir2,"AppData","Roaming"),localAppData=env.LOCALAPPDATA||path.join(homedir||tmpdir2,"AppData","Local"),object={};return object.cache=(options={isolated:null})=>(options=_normalizeOptions(options,isolated),!options.isolated||env.XDG_CACHE_HOME?path.join(xdg.cache(),options.isolated?name:""):path.join(localAppData,options.isolated?name:"","Cache")),object.config=(options={isolated:null})=>(options=_normalizeOptions(options,isolated),!options.isolated||env.XDG_CONFIG_HOME?path.join(xdg.config(),options.isolated?name:""):path.join(appData,options.isolated?name:"","Config")),object.data=(options={isolated:null})=>(options=_normalizeOptions(options,isolated),!options.isolated||env.XDG_DATA_HOME?path.join(xdg.data(),options.isolated?name:""):path.join(appData,options.isolated?name:"","Data")),object.runtime=(options={isolated:null})=>(options=_normalizeOptions(options,isolated),xdg.runtime()?path.join(xdg.runtime(),options.isolated?name:""):void 0),object.state=(options={isolated:null})=>(options=_normalizeOptions(options,isolated),!options.isolated||env.XDG_STATE_HOME?path.join(xdg.state(),options.isolated?name:""):path.join(localAppData,options.isolated?name:"","State")),object.configDirs=(options={isolated:null})=>{options=_normalizeOptions(options,isolated);let dirs=[object.config(options)];return env.XDG_CONFIG_DIRS&&dirs.push(...env.XDG_CONFIG_DIRS.split(path.delimiter).map(s=>path.join(s,options.isolated?name:""))),dirs},object.dataDirs=(options={isolated:null})=>{options=_normalizeOptions(options,isolated);let dirs=[object.data(options)];return env.XDG_DATA_DIRS&&dirs.push(...env.XDG_DATA_DIRS.split(path.delimiter).map(s=>path.join(s,options.isolated?name:""))),dirs},object},_XDGAppPaths=class __XDGAppPaths{constructor(options={name:null,suffix:null,isolated:!0}){let XDGAppPaths2=function(options2={name:null,suffix:null,isolated:!0}){return new __XDGAppPaths(options2)};this._fn=XDGAppPaths2,options=options||{},typeof options!="object"&&(options={name:options});let name=options.name||"";if(typeof name!="string")throw new TypeError(`Expected string for "name" argument, got ${typeof name}`);let suffix=options.suffix||"";if(typeof suffix!="string")throw new TypeError(`Expected string for "suffix" argument, got ${typeof suffix}`);let isolated=options.isolated===void 0||options.isolated===null?!0:options.isolated;if(typeof isolated!="boolean")throw new TypeError(`Expected boolean for "isolated" argument, got ${typeof isolated}`);name||(name=path.parse(process.pkg?process.execPath:__require.main?__require.main.filename:process.argv[0]).name),suffix&&(name+=suffix),this._fn.$name=()=>name,this._fn.$isolated=()=>isolated;let extension=isWinOS?windows(name,isolated):base(name,isolated);return Object.keys(extension).forEach(key=>{this._fn[key]=extension[key]}),this._fn}};module.exports=new _XDGAppPaths}});function getWhoamiCachedAnswer(args,authConfig){return args.includes("--cached")?getCachedUsername(authConfig):void 0}var import_semver=__toESM(require_semver(),1);import{spawn,execFile}from"child_process";function renderUpgradeProgress(current,total,phase){let bar=progress(current,total);output_manager_default.spinner(bar?`Upgrading Vercel CLI [${bar}] (${current}/${total})${phase?` ${phase}`:""}`:phase||"Upgrading Vercel CLI\u2026",0)}function execFileStdout(command,args,cwd,env=trustedUpgradeEnvironment){return new Promise((resolve3,reject)=>{execFile(command,args,{encoding:"utf8",windowsHide:!0,cwd,timeout:15e3,env:{...env}},(error,stdout)=>{if(error){reject(error);return}resolve3(stdout.toString())})})}function parseVersionOutput(stdout){for(let line of[stdout.trim(),...stdout.trim().split(`
|
|
7
|
+
import{HOMEBREW_UPGRADE_COMMAND,getUpdateCommandInfo,getUpgradePackageManager,isGlobal,trustedUpgradeDirectory,trustedUpgradeEnvironment}from"./chunk-K3TCWYVX.js";import{require_semver}from"./chunk-BPUANOGW.js";import{progress}from"./chunk-U56NHYAH.js";import{require_tar_fs}from"./chunk-WZ2R4Z7N.js";import{require_ci_info}from"./chunk-2EYYB6YN.js";import{getInstallRoot,isNativeBinaryInstall}from"./chunk-NWGBDBZI.js";import{getCachedUsername,require_lib}from"./chunk-RHFPMM4R.js";import{output_manager_default}from"./chunk-DWOJP4ST.js";import{pkg_default}from"./chunk-OO572JUC.js";import{fetch,toNodeReadable}from"./chunk-U3J7VS56.js";import{__commonJS,__require,__toESM}from"./chunk-BZENIQ7N.js";var require_lib2=__commonJS({"../../node_modules/.pnpm/os-paths@4.4.0/node_modules/os-paths/src/lib/index.js"(exports,module){"use strict";var os=__require("os"),paths=__require("path"),isWinOS=/^win/i.test(process.platform);function normalize_path(path){return paths.normalize(paths.join(path,"."))}var base=()=>{let{env}=process,object={};return object.home=()=>normalize_path(os.homedir?os.homedir():env.HOME),object.temp=()=>normalize_path(os.tmpdir?os.tmpdir():env.TMPDIR||env.TEMP||env.TMP),object},windows=()=>{let{env}=process,object={};return object.home=()=>normalize_path(os.homedir?os.homedir():env.USERPROFILE||paths.join(env.HOMEDRIVE,env.HOMEPATH)||env.HOME),object.temp=()=>normalize_path(os.tmpdir?os.tmpdir():env.TEMP||env.TMP||paths.join(env.LOCALAPPDATA||env.SystemRoot||env.windir,"Temp")),object},_OSPaths=class __OSPaths{constructor(){let OSPaths=function(){return new __OSPaths};this._fn=OSPaths;let extension=isWinOS?windows():base();return Object.keys(extension).forEach(key=>{this._fn[key]=extension[key]}),this._fn}};module.exports=new _OSPaths}});var require_lib3=__commonJS({"../../node_modules/.pnpm/xdg-portable@7.3.0/node_modules/xdg-portable/src/lib/index.js"(exports,module){"use strict";var path=__require("path"),osPaths=require_lib2(),linux=()=>{let object={};return object.cache=()=>process.env.XDG_CACHE_HOME||path.join(osPaths.home()||osPaths.temp(),".cache"),object.config=()=>process.env.XDG_CONFIG_HOME||path.join(osPaths.home()||osPaths.temp(),".config"),object.data=()=>process.env.XDG_DATA_HOME||path.join(osPaths.home()||osPaths.temp(),".local","share"),object.runtime=()=>process.env.XDG_RUNTIME_DIR||void 0,object.state=()=>process.env.XDG_STATE_HOME||path.join(osPaths.home()||osPaths.temp(),".local","state"),object},macos=()=>{let object={};return object.cache=()=>process.env.XDG_CACHE_HOME||path.join(path.join(osPaths.home()||osPaths.temp(),"Library"),"Caches"),object.config=()=>process.env.XDG_CONFIG_HOME||path.join(path.join(osPaths.home()||osPaths.temp(),"Library"),"Preferences"),object.data=()=>process.env.XDG_DATA_HOME||path.join(path.join(osPaths.home()||osPaths.temp(),"Library"),"Application Support"),object.runtime=()=>process.env.XDG_RUNTIME_DIR||void 0,object.state=()=>process.env.XDG_STATE_HOME||path.join(path.join(osPaths.home()||osPaths.temp(),"Library"),"State"),object},windows=()=>{let object={};return object.cache=()=>{let localAppData=process.env.LOCALAPPDATA||path.join(osPaths.home()||osPaths.temp(),"AppData","Local");return process.env.XDG_CACHE_HOME||path.join(localAppData,"xdg.cache")},object.config=()=>{let appData=process.env.APPDATA||path.join(osPaths.home()||osPaths.temp(),"AppData","Roaming");return process.env.XDG_CONFIG_HOME||path.join(appData,"xdg.config")},object.data=()=>{let appData=process.env.APPDATA||path.join(osPaths.home()||osPaths.temp(),"AppData","Roaming");return process.env.XDG_DATA_HOME||path.join(appData,"xdg.data")},object.runtime=()=>process.env.XDG_RUNTIME_DIR||void 0,object.state=()=>{let localAppData=process.env.LOCALAPPDATA||path.join(osPaths.home()||osPaths.temp(),"AppData","Local");return process.env.XDG_STATE_HOME||path.join(localAppData,"xdg.state")},object},_XDGPortable=()=>{let XDGPortable=function(){return _XDGPortable()},extension={};return/^darwin$/i.test(process.platform)?extension=macos():/^win/i.test(process.platform)?extension=windows():extension=linux(),extension.configDirs=()=>{let dirs=[];return dirs.push(extension.config()),process.env.XDG_CONFIG_DIRS&&dirs.push(...process.env.XDG_CONFIG_DIRS.split(path.delimiter)),dirs},extension.dataDirs=()=>{let dirs=[];return dirs.push(extension.data()),process.env.XDG_DATA_DIRS&&dirs.push(...process.env.XDG_DATA_DIRS.split(path.delimiter)),dirs},Object.keys(extension).forEach(key=>{XDGPortable[key]=extension[key]}),XDGPortable};module.exports=_XDGPortable()}});var require_xdg_app_paths=__commonJS({"../../node_modules/.pnpm/xdg-app-paths@5.1.0/node_modules/xdg-app-paths/index.js"(exports,module){"use strict";var path=__require("path"),os=__require("os"),xdg=require_lib3(),isWinOS=/^win/i.test(process.platform);function _normalizeOptions(options,isolated){if(options=options||{},typeof options!="object"&&(options={isolated:options}),options.isolated=options.isolated===void 0||options.isolated===null?isolated:options.isolated,typeof options.isolated!="boolean")throw new TypeError(`Expected boolean for "isolated" argument, got ${typeof options.isolated}`);return options}var base=(name,isolated)=>{let object={};return object.cache=(options={isolated:null})=>(options=_normalizeOptions(options,isolated),path.join(xdg.cache(),options.isolated?name:"")),object.config=(options={isolated:null})=>(options=_normalizeOptions(options,isolated),path.join(xdg.config(),options.isolated?name:"")),object.data=(options={isolated:null})=>(options=_normalizeOptions(options,isolated),path.join(xdg.data(),options.isolated?name:"")),object.runtime=(options={isolated:null})=>(options=_normalizeOptions(options,isolated),xdg.runtime()?path.join(xdg.runtime(),options.isolated?name:""):void 0),object.state=(options={isolated:null})=>(options=_normalizeOptions(options,isolated),path.join(xdg.state(),options.isolated?name:"")),object.configDirs=(options={isolated:null})=>(options=_normalizeOptions(options,isolated),xdg.configDirs().map(s=>path.join(s,options.isolated?name:""))),object.dataDirs=(options={isolated:null})=>(options=_normalizeOptions(options,isolated),xdg.dataDirs().map(s=>path.join(s,options.isolated?name:""))),object},windows=(name,isolated)=>{let{env}=process,homedir=os.homedir(),tmpdir2=os.tmpdir(),appData=env.APPDATA||path.join(homedir||tmpdir2,"AppData","Roaming"),localAppData=env.LOCALAPPDATA||path.join(homedir||tmpdir2,"AppData","Local"),object={};return object.cache=(options={isolated:null})=>(options=_normalizeOptions(options,isolated),!options.isolated||env.XDG_CACHE_HOME?path.join(xdg.cache(),options.isolated?name:""):path.join(localAppData,options.isolated?name:"","Cache")),object.config=(options={isolated:null})=>(options=_normalizeOptions(options,isolated),!options.isolated||env.XDG_CONFIG_HOME?path.join(xdg.config(),options.isolated?name:""):path.join(appData,options.isolated?name:"","Config")),object.data=(options={isolated:null})=>(options=_normalizeOptions(options,isolated),!options.isolated||env.XDG_DATA_HOME?path.join(xdg.data(),options.isolated?name:""):path.join(appData,options.isolated?name:"","Data")),object.runtime=(options={isolated:null})=>(options=_normalizeOptions(options,isolated),xdg.runtime()?path.join(xdg.runtime(),options.isolated?name:""):void 0),object.state=(options={isolated:null})=>(options=_normalizeOptions(options,isolated),!options.isolated||env.XDG_STATE_HOME?path.join(xdg.state(),options.isolated?name:""):path.join(localAppData,options.isolated?name:"","State")),object.configDirs=(options={isolated:null})=>{options=_normalizeOptions(options,isolated);let dirs=[object.config(options)];return env.XDG_CONFIG_DIRS&&dirs.push(...env.XDG_CONFIG_DIRS.split(path.delimiter).map(s=>path.join(s,options.isolated?name:""))),dirs},object.dataDirs=(options={isolated:null})=>{options=_normalizeOptions(options,isolated);let dirs=[object.data(options)];return env.XDG_DATA_DIRS&&dirs.push(...env.XDG_DATA_DIRS.split(path.delimiter).map(s=>path.join(s,options.isolated?name:""))),dirs},object},_XDGAppPaths=class __XDGAppPaths{constructor(options={name:null,suffix:null,isolated:!0}){let XDGAppPaths2=function(options2={name:null,suffix:null,isolated:!0}){return new __XDGAppPaths(options2)};this._fn=XDGAppPaths2,options=options||{},typeof options!="object"&&(options={name:options});let name=options.name||"";if(typeof name!="string")throw new TypeError(`Expected string for "name" argument, got ${typeof name}`);let suffix=options.suffix||"";if(typeof suffix!="string")throw new TypeError(`Expected string for "suffix" argument, got ${typeof suffix}`);let isolated=options.isolated===void 0||options.isolated===null?!0:options.isolated;if(typeof isolated!="boolean")throw new TypeError(`Expected boolean for "isolated" argument, got ${typeof isolated}`);name||(name=path.parse(process.pkg?process.execPath:__require.main?__require.main.filename:process.argv[0]).name),suffix&&(name+=suffix),this._fn.$name=()=>name,this._fn.$isolated=()=>isolated;let extension=isWinOS?windows(name,isolated):base(name,isolated);return Object.keys(extension).forEach(key=>{this._fn[key]=extension[key]}),this._fn}};module.exports=new _XDGAppPaths}});function getWhoamiCachedAnswer(args,authConfig){return args.includes("--cached")?getCachedUsername(authConfig):void 0}var import_semver=__toESM(require_semver(),1);import{spawn,execFile}from"child_process";function renderUpgradeProgress(current,total,phase){let bar=progress(current,total);output_manager_default.spinner(bar?`Upgrading Vercel CLI [${bar}] (${current}/${total})${phase?` ${phase}`:""}`:phase||"Upgrading Vercel CLI\u2026",0)}function execFileStdout(command,args,cwd,env=trustedUpgradeEnvironment){return new Promise((resolve3,reject)=>{execFile(command,args,{encoding:"utf8",windowsHide:!0,cwd,timeout:15e3,env:{...env}},(error,stdout)=>{if(error){reject(error);return}resolve3(stdout.toString())})})}function parseVersionOutput(stdout){for(let line of[stdout.trim(),...stdout.trim().split(`
|
|
8
8
|
`).reverse()])try{let value=JSON.parse(line),parsed=Array.isArray(value)&&value.length===1?value[0]:value,version=typeof parsed=="string"?parsed:typeof parsed?.data=="string"?parsed.data:void 0;if(version&&import_semver.default.valid(version))return version}catch{let version=line.trim();if(import_semver.default.valid(version))return version}}async function getLatestPackageVersion(packageManager,installArgs,cwd,global,env,bypassMinReleaseAge=!0){let packageSpecifier=installArgs.find(arg=>arg.endsWith("@latest"));if(!packageSpecifier)return;let manager=getUpgradePackageManager(packageManager),queryArgs=[...manager.metadataArgs(packageSpecifier),...bypassMinReleaseAge?manager.releaseAgeBypassArgs:[]];try{let stdout=await execFileStdout(packageManager,queryArgs,cwd,env);return parseVersionOutput(stdout)}catch(error){output_manager_default.debug(`Failed to resolve the latest Vercel CLI version: ${error instanceof Error?error.message:String(error)}`);return}}async function getInstalledPackageVersion(packageManager,installArgs,cwd,global){let packageSpecifier=installArgs.find(arg=>arg.endsWith("@latest"));if(!packageSpecifier)return;let packageName=packageSpecifier.slice(0,-7);try{let stdout=await execFileStdout(packageManager,["list",packageName,"--depth=0","--json",...global?["--global"]:[]],cwd),parsed=JSON.parse(stdout),projects=Array.isArray(parsed)?parsed:[parsed];for(let project of projects){let version=project?.dependencies?.[packageName]?.version??project?.devDependencies?.[packageName]?.version??project?.optionalDependencies?.[packageName]?.version;if(typeof version=="string"&&import_semver.default.valid(version))return version}}catch(error){output_manager_default.debug(`Failed to read the installed Vercel CLI version: ${error instanceof Error?error.message:String(error)}`)}}function isVersionCurrent(current,latest){return import_semver.default.valid(current)&&import_semver.default.valid(latest)?import_semver.default.gte(current,latest):current===latest}function pinPackageVersion(args,version){return args.map(arg=>arg.endsWith("@latest")?`${arg.slice(0,-6)}${version}`:arg)}async function getMinReleaseAgeContext(packageManager,cwd,global){let setting=packageManager==="pnpm"?"minimumReleaseAge":"min-release-age";try{let raw=(await execFileStdout(packageManager,["config","get",setting,"--json",...global?["--global"]:[]],cwd)).trim(),value=raw===""||raw==="undefined"?void 0:JSON.parse(raw);if(!(value==null||value===""||value==="undefined")){let age=typeof value=="number"||typeof value=="string"&&value.trim()!==""?Number(value):NaN;if(!Number.isFinite(age)||age<0)return`Could not determine ${packageManager}'s configured minimum release age.`;let minutes=packageManager==="pnpm"?age:age*1440,duration=minutes>0&&minutes%60===0?`${minutes/60} ${minutes===60?"hour":"hours"}`:`${minutes} ${minutes===1?"minute":"minutes"}`;return`${packageManager} ${setting} is configured to ${duration}.`}if(packageManager==="pnpm"){let version=parseVersionOutput(await execFileStdout(packageManager,["--version"],cwd));if(version&&!import_semver.default.prerelease(version)&&import_semver.default.gte(version,"11.0.0"))return`pnpm ${version} defaults to a minimum release age of 24 hours (1440 minutes); no explicit minimumReleaseAge setting was reported.`}return`${packageManager} did not report a configured minimum release age.`}catch{return`Could not determine ${packageManager}'s configured minimum release age.`}}function isMinReleaseAgeError(packageManager,stdout,stderr){let installerOutput=`${stdout}
|
|
9
9
|
${stderr}`;return packageManager==="pnpm"?installerOutput.includes("ERR_PNPM_NO_MATURE_MATCHING_VERSION")||installerOutput.includes("ERR_PNPM_NO_MATCHING_VERSION")&&installerOutput.includes("satisfies the specs but was released at"):packageManager==="npm"?/\bETARGET\b/.test(installerOutput)&&installerOutput.includes("with a date before")||/min-release-age cannot be provided/i.test(installerOutput):!1}function setMinReleaseAgeBypass(client,enabled){client.config={...client.config,updates:{...client.config.updates,bypassMinReleaseAge:enabled}},client.writeToConfigFile()}async function executeHomebrewUpgrade(env=trustedUpgradeEnvironment){let[brew,...args]=HOMEBREW_UPGRADE_COMMAND.split(" ");output_manager_default.debug(`Executing: ${HOMEBREW_UPGRADE_COMMAND}`);let result=await new Promise(resolve3=>{let settled=!1,brewProcess=spawn(brew,args,{cwd:trustedUpgradeDirectory,env:{...env},stdio:"inherit",shell:!1});brewProcess.on("error",spawnError=>{settled||(settled=!0,resolve3({code:1,spawnError}))}),brewProcess.on("close",code=>{settled||(settled=!0,resolve3({code:code??1}))})});return result.spawnError?(output_manager_default.error(`Failed to run Homebrew: ${result.spawnError.message}`),output_manager_default.log(`You can try running the command manually: ${HOMEBREW_UPGRADE_COMMAND}`),1):(result.code!==0&&(output_manager_default.error(`Homebrew upgrade failed with exit code ${result.code}`),output_manager_default.log(`You can try running the command manually: ${HOMEBREW_UPGRADE_COMMAND}`)),result.code)}function executeAutomaticUpgrade(client,env=trustedUpgradeEnvironment){return executeUpgrade("latest",client,!1,!0,env,"package-manager")}async function executeUpgrade(targetVersion,client,bypassMinReleaseAge=!1,explicitTarget=!1,env=trustedUpgradeEnvironment,releaseAgePolicy="newest"){let totalSteps=targetVersion?2:3;renderUpgradeProgress(0,totalSteps,"Resolving installer\u2026");let{command:updateCommand,global,packageManager}=await getUpdateCommandInfo(env).catch(error=>{throw output_manager_default.stopSpinner(),error}),[command,...args]=updateCommand.split(" "),cwd=global?trustedUpgradeDirectory:process.cwd(),bypassArgs=getUpgradePackageManager(packageManager).releaseAgeBypassArgs;if(bypassMinReleaseAge&&bypassArgs.length===0)return output_manager_default.stopSpinner(),output_manager_default.error(`Minimum release-age bypass is not supported for ${packageManager}. Run the upgrade without --bypass-min-release-age, or configure release-age settings in ${packageManager} directly.`),1;bypassMinReleaseAge&&client&&client.config.updates?.bypassMinReleaseAge!==!0&&setMinReleaseAgeBypass(client,!0);let versionBefore=pkg_default.version,installLatestTag=explicitTarget&&targetVersion==="latest",resolvedTargetVersion=installLatestTag?void 0:targetVersion;if(targetVersion||(renderUpgradeProgress(1,totalSteps,"Checking for updates\u2026"),resolvedTargetVersion=await getLatestPackageVersion(packageManager,args,cwd,global,env,releaseAgePolicy==="newest")),!resolvedTargetVersion&&!installLatestTag)return output_manager_default.stopSpinner(),output_manager_default.error("Failed to resolve the latest Vercel CLI version."),1;if(!explicitTarget&&resolvedTargetVersion&&isVersionCurrent(versionBefore,resolvedTargetVersion))return renderUpgradeProgress(totalSteps,totalSteps),output_manager_default.stopSpinner(),output_manager_default.log(`No upgrade available. Vercel CLI is already up to date (v${versionBefore}).`),0;let installArgs=resolvedTargetVersion?pinPackageVersion(args,resolvedTargetVersion):args,shouldBypass=releaseAgePolicy==="newest"&&bypassArgs.length>0&&(bypassMinReleaseAge||client?.config.updates?.bypassMinReleaseAge===!0);shouldBypass&&(installArgs=[...installArgs,...bypassArgs]);let runInstall=currentArgs=>{let installCommand=[command,...currentArgs].join(" ");return output_manager_default.debug(`Executing: ${installCommand} (cwd: ${cwd})`),new Promise(resolve3=>{let stdout=[],stderr=[],upgradeProcess=spawn(command,currentArgs,{cwd,env:{...env},stdio:["inherit","pipe","pipe"],shell:!1});upgradeProcess.stdout?.on("data",data=>{stdout.push(Uint8Array.from(data)),output_manager_default.debug(`[upgrade stdout] ${data.toString().trimEnd()}`)}),upgradeProcess.stderr?.on("data",data=>{stderr.push(Uint8Array.from(data)),output_manager_default.debug(`[upgrade stderr] ${data.toString().trimEnd()}`)});let settled=!1;upgradeProcess.on("error",spawnError=>{settled||(settled=!0,resolve3({code:1,stdout:"",stderr:"",spawnError}))}),upgradeProcess.on("close",code=>{settled||(settled=!0,resolve3({code:code??1,stdout:Buffer.concat(stdout).toString(),stderr:Buffer.concat(stderr).toString()}))})})};renderUpgradeProgress(targetVersion?1:2,totalSteps,"Installing\u2026");let result=await runInstall(installArgs),usedAllowedRelease=!1;if(result.code!==0&&!result.spawnError&&releaseAgePolicy==="newest"&&!shouldBypass&&bypassArgs.length>0&&isMinReleaseAgeError(packageManager,result.stdout,result.stderr)){let context=await getMinReleaseAgeContext(packageManager,cwd,global);output_manager_default.stopSpinner();let blockedMessage=`The package manager blocked this Vercel CLI release because of its minimum release-age setting. ${context}`;if(!client||client.nonInteractive||!client.stdin.isTTY)return output_manager_default.error(`${blockedMessage}
|
|
10
10
|
To install the newest release allowed by your settings:
|
|
@@ -4,6 +4,6 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{readJSONFile}from"./chunk-
|
|
7
|
+
import{readJSONFile}from"./chunk-QGGJ5VVZ.js";import{getScope}from"./chunk-IFXMG2WQ.js";import{humanizePath,require_types}from"./chunk-RHFPMM4R.js";import{getArgs}from"./chunk-F22QLVTX.js";import{CantFindConfig,CantParseJSONFile,DeprecatedNowJson,WorkingDirectoryDoesNotExist}from"./chunk-YCJHUYBJ.js";import{cliErrorFromUnknown,output_manager_default,recordCliError}from"./chunk-DWOJP4ST.js";import{require_dist}from"./chunk-RM3ZDRYE.js";import{__commonJS,__toESM}from"./chunk-BZENIQ7N.js";var require_epipebomb=__commonJS({"../../node_modules/.pnpm/epipebomb@1.0.0/node_modules/epipebomb/epipebomb.js"(exports,module){module.exports=epipeBomb;function epipeBomb(stream,callback){stream==null&&(stream=process.stdout),callback==null&&(callback=process.exit);function epipeFilter(err){if(err.code==="EPIPE")return callback();stream.listeners("error").length<=1&&(stream.removeAllListeners(),stream.emit("error",err),stream.on("error",epipeFilter))}stream.on("error",epipeFilter)}}});var sentry;async function getSentry(){if(!sentry){let[SentryModule,{SENTRY_DSN},{default:pkg}]=await Promise.all([import("./cjs-2SMN43VH.js"),import("./constants-JAB7MRSK.js"),import("./pkg-EDJQLCNP.js")]),Sentry="init"in SentryModule?SentryModule:SentryModule.default;Sentry.init({dsn:SENTRY_DSN,release:`vercel-cli@${pkg.version}`,environment:"stable",autoSessionTracking:!1}),sentry=Sentry}return sentry}function isOutputDebugEnabled(debugFlag){return debugFlag===!0||process.env.VERCEL_CLI_DEBUG==="1"}var import_epipebomb=__toESM(require_epipebomb(),1),SILENCED_ERRORS=["DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead."],installed=!1;function installProcessGuards(){if(installed)return;installed=!0;let originalError=console.error;console.error=msg=>{SILENCED_ERRORS.some(error=>typeof msg=="string"&&msg.includes(error))||originalError(msg)},(0,import_epipebomb.default)()}var import_error_utils=__toESM(require_dist(),1);async function reportError(sentry2,client,error){if(ignoreError(error))return;let user,team,scopeError;try{({user,team}=await getScope(client))}catch(err){(0,import_error_utils.isError)(err)&&(scopeError=err)}sentry2.withScope(scope=>{if(user){let spec={email:user.email,id:user.id,username:user.username,name:user.name};scope.setUser(spec)}team&&scope.setTag("currentTeam",team.id),scopeError&&scope.setExtra("scopeError",{name:scopeError.name,message:scopeError.message,stack:scopeError.stack});let args,argsError;try{args=getArgs(process.argv.slice(2),{})}catch(err){(0,import_error_utils.isError)(err)&&(argsError=err)}if(args){let flags=["--env","--build-env","--token"];for(let flag of flags)args[flag]&&(args[flag]="REDACTED");args._.length>=4&&args._[0].startsWith("secret")&&args._[1]==="add"&&(args._[3]="REDACTED"),scope.setExtra("args",args)}else{let msg="Unable to parse args";argsError&&(msg+=`: ${argsError}`),scope.setExtra("args",msg)}scope.setExtra("node",{execPath:process.execPath,version:process.version,platform:process.platform}),sentry2.captureException(error)});let sentryClient=sentry2.getCurrentHub().getClient();sentryClient&&await sentryClient.close()}function ignoreError(error){return(0,import_error_utils.isError)(error)&&error.message.includes("uv_cwd")}var fatalErrorHandlerSymbol=Symbol.for("vercel.cli.fatal-error-handler");async function exitWithUnexpectedError(error){let handler=globalThis[fatalErrorHandlerSymbol];if(typeof handler=="function")try{await handler(error)}catch{}process.exit(1)}async function handleUnexpectedError(client,err){let{message}=err;return message.includes("sentry")&&message.includes("ENOTFOUND")?(output_manager_default.debug(`Sentry is not reachable: ${err}`),!1):(output_manager_default.error(`An unexpected error occurred!
|
|
8
8
|
${err.stack}`),await reportError(await getSentry(),client,err),!0)}function registerUnexpectedErrorHandlers(getClient){process.on("unhandledRejection",async err=>{recordCliError(cliErrorFromUnknown(err)),err?err instanceof Error?await handleUnexpectedError(getClient(),err):(output_manager_default.error(`An unexpected rejection occurred
|
|
9
9
|
${err}`),await reportError(await getSentry(),getClient(),err)):output_manager_default.error("An unexpected empty rejection occurred"),await exitWithUnexpectedError(err)}),process.on("uncaughtException",async error=>{await handleUnexpectedError(getClient(),error)&&await exitWithUnexpectedError(error)})}var import_types=__toESM(require_types(),1);import path from"path";var import_error_utils2=__toESM(require_dist(),1);var config;async function earlyGetConfig(configFile){if(config)return config;let localPath;try{localPath=process.cwd()}catch(err){if((0,import_error_utils2.isErrnoException)(err)&&err.code==="ENOENT")return new WorkingDirectoryDoesNotExist;throw err}if(configFile){let localFilePath=path.resolve(localPath,configFile);output_manager_default.debug(`Found config in provided --local-config path ${localFilePath}`);let localConfig=await readJSONFile(localFilePath);return localConfig instanceof CantParseJSONFile?localConfig:localConfig===null?new CantFindConfig([humanizePath(localFilePath)]):(config=localConfig,config[import_types.fileNameSymbol]=configFile,config)}let vercelFilePath=path.resolve(localPath,"vercel.json"),nowFilePath=path.resolve(localPath,"now.json"),[vercelConfig,nowConfig]=await Promise.all([readJSONFile(vercelFilePath),readJSONFile(nowFilePath)]);return vercelConfig instanceof CantParseJSONFile?vercelConfig:nowConfig instanceof CantParseJSONFile?nowConfig:vercelConfig!==null?(output_manager_default.debug(`Found config in file "${vercelFilePath}"`),config=vercelConfig,config[import_types.fileNameSymbol]="vercel.json",config):nowConfig!==null?new DeprecatedNowJson(nowFilePath):new CantFindConfig([vercelFilePath].map(humanizePath))}var fallbackReason;function recordDirectBuildFallback(reason){fallbackReason=reason}function getDirectBuildFallbackAttributes(){return fallbackReason===void 0?void 0:{directBuild:"false",fallbackReason}}export{getSentry,isOutputDebugEnabled,installProcessGuards,reportError,exitWithUnexpectedError,handleUnexpectedError,registerUnexpectedErrorHandlers,earlyGetConfig,recordDirectBuildFallback,getDirectBuildFallbackAttributes};
|