vercel 62.4.0 → 62.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{add-E6SM6YUU.js → add-HN4OXQLM.js} +1 -1
- package/dist/chunks/{add-XZMJUVCZ.js → add-SUDX7R63.js} +1 -1
- package/dist/chunks/{add-K6P7R3M4.js → add-UNQJB3SM.js} +1 -1
- package/dist/chunks/{build-ORM2P3M7.js → build-BRMOQZHW.js} +1 -1
- package/dist/chunks/{chunk-JI2BTGLU.js → chunk-2E6XILZC.js} +1 -1
- package/dist/chunks/{chunk-I46LFJJG.js → chunk-2FQCZE6S.js} +1 -1
- package/dist/chunks/{chunk-J7JW6BBJ.js → chunk-2Z47VG5H.js} +1 -1
- package/dist/chunks/{chunk-54SEEVOA.js → chunk-35QK5NDD.js} +1 -1
- package/dist/chunks/{chunk-MCCL762Q.js → chunk-3J2P52OU.js} +1 -1
- package/dist/chunks/{chunk-7X34JCBW.js → chunk-4AY4YYKS.js} +1 -1
- package/dist/chunks/{chunk-3P7HVGKM.js → chunk-4BRFG5HP.js} +1 -1
- package/dist/chunks/chunk-4CACOKMS.js +7 -0
- package/dist/chunks/{chunk-RINZXCDJ.js → chunk-4WS3D23J.js} +1 -1
- package/dist/chunks/{chunk-ETYHCI6U.js → chunk-5CSWEE7J.js} +1 -1
- package/dist/chunks/{chunk-ROOWZCAB.js → chunk-5IPBCD7K.js} +1 -1
- package/dist/chunks/{chunk-PP36OP55.js → chunk-5NSYN7IO.js} +1 -1
- package/dist/chunks/{chunk-RDC4BJSR.js → chunk-5QVOIOPN.js} +1 -1
- package/dist/chunks/{chunk-3GUBYJN6.js → chunk-65Z5UPUC.js} +1 -1
- package/dist/chunks/{chunk-EWW4GCZY.js → chunk-6ALOD3OE.js} +1 -1
- package/dist/chunks/{chunk-G7AD7DRG.js → chunk-6C4RPAG7.js} +1 -1
- package/dist/chunks/{chunk-SANUW37I.js → chunk-6LOW7CGD.js} +2 -2
- package/dist/chunks/{chunk-DQ2KI6FO.js → chunk-72YTT324.js} +1 -1
- package/dist/chunks/{chunk-VUCFX2G4.js → chunk-733ZK37Y.js} +1 -1
- package/dist/chunks/chunk-774D3BGN.js +7 -0
- package/dist/chunks/chunk-7SNMU7U7.js +7 -0
- package/dist/chunks/{chunk-OL3BQESW.js → chunk-AJT64XO2.js} +1 -1
- package/dist/chunks/{chunk-UV4HOEHC.js → chunk-AMSFO2VK.js} +1 -1
- package/dist/chunks/{chunk-3YAQUAOG.js → chunk-B3MYIRFE.js} +1 -1
- package/dist/chunks/{chunk-J4YZKLVO.js → chunk-C7SLCL3Z.js} +2 -2
- package/dist/chunks/{chunk-GTZDB7IL.js → chunk-CAAD55US.js} +1 -1
- package/dist/chunks/{chunk-57NFMJ6O.js → chunk-D6JBONML.js} +1 -1
- package/dist/chunks/{chunk-KQM2AGUS.js → chunk-DOWDSQPG.js} +1 -1
- package/dist/chunks/{chunk-6NPXWN5F.js → chunk-DQXGNNPB.js} +1 -1
- package/dist/chunks/{chunk-WGPFU3NA.js → chunk-DWPCZHDT.js} +1 -1
- package/dist/chunks/chunk-DZZFEAM6.js +7 -0
- package/dist/chunks/{chunk-VX7JFH7Q.js → chunk-EA3BJUUK.js} +1 -1
- package/dist/chunks/{chunk-WT73KR4Y.js → chunk-EDDOQXEI.js} +1 -1
- package/dist/chunks/{chunk-WVUD3JPC.js → chunk-EJNFKH6Y.js} +1 -1
- package/dist/chunks/{chunk-IIKYA7SM.js → chunk-EPBZNTIJ.js} +1 -1
- package/dist/chunks/chunk-GXNSAACA.js +7 -0
- package/dist/chunks/{chunk-7NEJJJH6.js → chunk-H3QRCTIJ.js} +1 -1
- package/dist/chunks/{chunk-SM5JI6QM.js → chunk-HRQQ2N5B.js} +1 -1
- package/dist/chunks/{chunk-TQ5ETS24.js → chunk-HVJERSGE.js} +1 -1
- package/dist/chunks/{chunk-6BZCSVH6.js → chunk-ILR6YA2A.js} +1 -1
- package/dist/chunks/{chunk-XQVD5V3T.js → chunk-JNLWD6DK.js} +1 -1
- package/dist/chunks/{chunk-VGXFOQ4P.js → chunk-L57FNGBV.js} +1 -1
- package/dist/chunks/chunk-LGFCHU75.js +8 -0
- package/dist/chunks/{chunk-3HO365U7.js → chunk-M4IWOZEG.js} +1 -1
- package/dist/chunks/{chunk-R3B67TKQ.js → chunk-MCOJUSDV.js} +1 -1
- package/dist/chunks/{chunk-QLJ72TJJ.js → chunk-MHKDLJEI.js} +1 -1
- package/dist/chunks/{chunk-5G3VXZB4.js → chunk-MJWC4W6J.js} +1 -1
- package/dist/chunks/{chunk-JEYKXG6O.js → chunk-MOLEXKVC.js} +1 -1
- package/dist/chunks/{chunk-PTUZ7ATN.js → chunk-MQW6DKD2.js} +1 -1
- package/dist/chunks/{chunk-EWWFNMPZ.js → chunk-MR423MWE.js} +3 -1
- package/dist/chunks/{chunk-MKY5IBKK.js → chunk-MUJP4VPF.js} +1 -1
- package/dist/chunks/chunk-NDZOUAFO.js +9 -0
- package/dist/chunks/{chunk-V6MR45PD.js → chunk-NNP5NITU.js} +1 -1
- package/dist/chunks/chunk-NTRM6VO6.js +9 -0
- package/dist/chunks/{chunk-QFVAARN7.js → chunk-O552UV4H.js} +1 -1
- package/dist/chunks/chunk-O5A7CNRV.js +7 -0
- package/dist/chunks/{chunk-LW3HJWXW.js → chunk-OQVE2WXX.js} +1 -1
- package/dist/chunks/{chunk-B4VX6C2E.js → chunk-OYWYHFXV.js} +1 -1
- package/dist/chunks/{chunk-7OBZ2AM6.js → chunk-P3YADO62.js} +1 -1
- package/dist/chunks/{chunk-FSHYI4ZE.js → chunk-P3ZZVBZQ.js} +1 -1
- package/dist/chunks/{chunk-YAJFAGUO.js → chunk-P4BGC5RL.js} +2 -2
- package/dist/chunks/{chunk-MJRZSYU2.js → chunk-PD3ZD52Q.js} +3 -3
- package/dist/chunks/{chunk-SDGWKUST.js → chunk-PQV3QNDG.js} +1 -1
- package/dist/chunks/{chunk-LQBC5QPO.js → chunk-PTKSYVXM.js} +1 -1
- package/dist/chunks/{chunk-HNF6WZ5S.js → chunk-PY6YO4MR.js} +1 -1
- package/dist/chunks/{chunk-YMM3VY3J.js → chunk-QCOPZAUC.js} +1 -1
- package/dist/chunks/{chunk-LOD56FYJ.js → chunk-QMTPSHRV.js} +4 -4
- package/dist/chunks/chunk-RERUTI3O.js +9 -0
- package/dist/chunks/{chunk-HWWHR7H3.js → chunk-RHUAFRZX.js} +1 -1
- package/dist/chunks/{chunk-MB4RN7BI.js → chunk-S54ISKGR.js} +1 -1
- package/dist/chunks/{chunk-TNERVI3E.js → chunk-ST2X5QRA.js} +1 -1
- package/dist/chunks/{chunk-EZU5U2PZ.js → chunk-SX64OM5A.js} +1 -1
- package/dist/chunks/{chunk-TNJVIC27.js → chunk-TEYG3UZQ.js} +1 -1
- package/dist/chunks/{chunk-GV6XYKYC.js → chunk-TG6SMD7D.js} +1 -1
- package/dist/chunks/{chunk-GNJPIPBF.js → chunk-TN4IR2LY.js} +1 -1
- package/dist/chunks/{chunk-XQQGQ55A.js → chunk-TNGDWVMX.js} +1 -1
- package/dist/chunks/{chunk-C5KVTG2O.js → chunk-UKC3NSS6.js} +1 -1
- package/dist/chunks/{chunk-DJC2LX46.js → chunk-UXAYYF6I.js} +1 -1
- package/dist/chunks/{chunk-HTZPGIVL.js → chunk-VMHUBZRU.js} +1 -1
- package/dist/chunks/{chunk-6RNZA3VS.js → chunk-W45NZSSK.js} +1 -1
- package/dist/chunks/{chunk-7W3B5AJR.js → chunk-W6M24BQ4.js} +1 -1
- package/dist/chunks/{chunk-IHXHZBHR.js → chunk-WJZV7BI4.js} +1 -1
- package/dist/chunks/{chunk-TKBORMUF.js → chunk-WKZ6JSGZ.js} +1 -1
- package/dist/chunks/{chunk-Z4VR6CQ2.js → chunk-WNG72BRT.js} +1 -1
- package/dist/chunks/chunk-WOTPEBSH.js +11 -0
- package/dist/chunks/{chunk-UZ2DSUM6.js → chunk-X7F3567X.js} +1 -1
- package/dist/chunks/{chunk-BIFJ5QEB.js → chunk-X7U35FBE.js} +1 -1
- package/dist/chunks/chunk-XMV7OSFJ.js +9 -0
- package/dist/chunks/chunk-YW5R6XQI.js +7 -0
- package/dist/chunks/{chunk-72DVIZTW.js → chunk-ZFYW4CEL.js} +1 -1
- package/dist/chunks/{chunk-ZXEYTD3W.js → chunk-ZTUQEA2X.js} +1 -1
- package/dist/chunks/{chunk-SL5SJUAH.js → chunk-ZX2JOGOA.js} +1 -1
- package/dist/chunks/{chunk-UDVWL4I4.js → chunk-ZXDS7NJI.js} +1 -1
- package/dist/chunks/{clear-IWIBH2TY.js → clear-M6LODAMD.js} +1 -1
- package/dist/chunks/{compile-vercel-config-B2ZES5JB.js → compile-vercel-config-NBX5UWHW.js} +1 -1
- package/dist/chunks/{config-5GNX5VM2.js → config-Q3TRA4NK.js} +1 -1
- package/dist/chunks/{config-BLTCR2NA.js → config-YQ7FIAFK.js} +1 -1
- package/dist/chunks/{connect-git-provider-VYU65KTS.js → connect-git-provider-67DJOI6X.js} +1 -1
- package/dist/chunks/{constants-NCE2LWSS.js → constants-G4UYVLOF.js} +1 -1
- package/dist/chunks/{delete-TN2UUEOF.js → delete-KSZ7R5V6.js} +1 -1
- package/dist/chunks/{delete-DSDSQVG7.js → delete-NRWKSTCN.js} +1 -1
- package/dist/chunks/{detect-services-VQWDU5RR.js → detect-services-MWYUJZJZ.js} +1 -1
- package/dist/chunks/{disable-76QRXL7J.js → disable-BUGWQUS7.js} +1 -1
- package/dist/chunks/{discard-CWXRCRFL.js → discard-J5O3C753.js} +1 -1
- package/dist/chunks/{edit-LYZPKUZY.js → edit-DMOIBVEP.js} +1 -1
- package/dist/chunks/{edit-KC6AK6DA.js → edit-YRWAXGEI.js} +1 -1
- package/dist/chunks/{enable-ZVEULDXQ.js → enable-IL27VHSU.js} +1 -1
- package/dist/chunks/{exec-3RMS2X6B.js → exec-GYSSNCNK.js} +1 -1
- package/dist/chunks/{export-SYT5NHSM.js → export-HBUUGMGE.js} +1 -1
- package/dist/chunks/{future-YNSZJIAG.js → future-BXETJ6CT.js} +1 -1
- package/dist/chunks/{generate-cert-for-deploy-G26VGC4I.js → generate-cert-for-deploy-K5QDHEEQ.js} +1 -1
- package/dist/chunks/{image-XAJFJ6UD.js → image-M2XIQYXT.js} +1 -1
- package/dist/chunks/import-builders-UGIWTKRS.js +7 -0
- package/dist/chunks/{inspect-JEHOMETA.js → inspect-HASOG2PB.js} +1 -1
- package/dist/chunks/{inspect-7CODV4HJ.js → inspect-OGUGKPVK.js} +1 -1
- package/dist/chunks/{inspect-HIRGIJON.js → inspect-SUEMHSB6.js} +1 -1
- package/dist/chunks/{inspect-DF35I6AZ.js → inspect-TDHISMRV.js} +1 -1
- package/dist/chunks/{inspect-A76MME2I.js → inspect-XANEFWYN.js} +1 -1
- package/dist/chunks/{list-XNNJCS5K.js → list-32NXD7OW.js} +1 -1
- package/dist/chunks/{list-3KNHQV4S.js → list-Q566PTT4.js} +1 -1
- package/dist/chunks/{list-M2YCP5HV.js → list-Z6DRFZ7F.js} +1 -1
- package/dist/chunks/{login-UM35IU3S.js → login-A6R3RQIW.js} +1 -1
- package/dist/chunks/login-GPCBSMHV.js +7 -0
- package/dist/chunks/logs-L33R4G67.js +7 -0
- package/dist/chunks/{ls-KGYG3F3A.js → ls-6CYMQBX3.js} +1 -1
- package/dist/chunks/ls-CTIACPC5.js +8 -0
- package/dist/chunks/{ls-ISILCAV4.js → ls-DUCIK4E6.js} +1 -1
- package/dist/chunks/{ls-Y3CBOCK2.js → ls-GDR45ANC.js} +1 -1
- package/dist/chunks/{ls-Z2JKBJKR.js → ls-JPL3AFIM.js} +1 -1
- package/dist/chunks/{ls-YJEUWZFT.js → ls-R442RADW.js} +1 -1
- package/dist/chunks/{ls-M2SGUIZK.js → ls-VSK2ZFSY.js} +1 -1
- package/dist/chunks/{mutate-ZCA7FKDL.js → mutate-MUWQVZKM.js} +1 -1
- package/dist/chunks/{notifications-7QROHXJQ.js → notifications-YKGIFXKO.js} +1 -1
- package/dist/chunks/{open-FU7OJPAY.js → open-OJAIEDS5.js} +1 -1
- package/dist/chunks/{openapi-KGCZ7LB4.js → openapi-Y4NWAKUM.js} +1 -1
- package/dist/chunks/{permissions-I4ZXPUVY.js → permissions-LWKZBBU7.js} +1 -1
- package/dist/chunks/{prompt-missing-credentials-YPLDAGZA.js → prompt-missing-credentials-O3GGMOZH.js} +1 -1
- package/dist/chunks/{publish-6WBGPES3.js → publish-JHNLZT6K.js} +1 -1
- package/dist/chunks/pull-E4K6BVQW.js +7 -0
- package/dist/chunks/purchase-domain-if-available-CJK3G4DT.js +7 -0
- package/dist/chunks/{push-ZRDFCF3D.js → push-MUMGVOSY.js} +1 -1
- package/dist/chunks/{query-RXONIAT5.js → query-2TTSDOFF.js} +1 -1
- package/dist/chunks/{reauthenticate-7RZ2XFR4.js → reauthenticate-S47X66LM.js} +1 -1
- package/dist/chunks/{reorder-P5LWY3FS.js → reorder-NGBZWNZH.js} +1 -1
- package/dist/chunks/{reply-QNIIC2TP.js → reply-5WF5YHOM.js} +1 -1
- package/dist/chunks/{resolve-RQBKN4WL.js → resolve-MPZBUK5V.js} +1 -1
- package/dist/chunks/{restore-NPY7XA3A.js → restore-NVY4A3T3.js} +1 -1
- package/dist/chunks/{rm-XOE3T2QM.js → rm-DB5K2RI7.js} +1 -1
- package/dist/chunks/{rm-5LVIH5IE.js → rm-HFJCOK2D.js} +1 -1
- package/dist/chunks/{rm-4PBTYQBF.js → rm-QXQ2AD4R.js} +1 -1
- package/dist/chunks/{rm-K3V6KVHW.js → rm-SMKVHN75.js} +1 -1
- package/dist/chunks/rm-ZO5JP3GF.js +8 -0
- package/dist/chunks/{routes-FOCZWOGO.js → routes-KO5NFCCJ.js} +1 -1
- package/dist/chunks/{rule-inspect-6UI5XBGA.js → rule-inspect-VZARLRS3.js} +1 -1
- package/dist/chunks/{rules-MJWNYYRT.js → rules-G2WFYCPB.js} +1 -1
- package/dist/chunks/{schema-ABJKQ6AB.js → schema-G6BOZBNB.js} +1 -1
- package/dist/chunks/{schema-SOV2XP24.js → schema-SVYU72YU.js} +1 -1
- package/dist/chunks/{select-org-G4KFHFH3.js → select-org-2W67WKBG.js} +1 -1
- package/dist/chunks/set-ILVKMTUD.js +7 -0
- package/dist/chunks/setup-and-link-VFCYLLB5.js +7 -0
- package/dist/chunks/{tags-DY5IM5QF.js → tags-C34XXMYO.js} +1 -1
- package/dist/chunks/{types-RHUVE4FN.js → types-MATC4UQL.js} +1 -1
- package/dist/chunks/{update-6WSCOLSB.js → update-IVWOZO4P.js} +1 -1
- package/dist/chunks/{vlt-builder-graph-B4DFIUS6.js → vlt-builder-graph-S4YJ5UTQ.js} +1 -1
- package/dist/chunks/vlt-builder-importer-2ITR3DMQ.js +11 -0
- package/dist/commands/build/index.js +2 -2
- package/dist/commands/deploy/index.js +4 -4
- package/dist/commands/dev/index.js +2 -2
- package/dist/commands/env/index.js +1 -1
- package/dist/commands/link/index.js +1 -1
- package/dist/commands/list/index.js +1 -1
- package/dist/commands-bulk.js +405 -388
- package/dist/index.js +6 -8
- package/dist/internal-build-worker.js +4 -4
- package/dist/internal-build.js +11 -0
- package/dist/root-help-commands.mjs +1 -1
- package/dist/vc.js +24 -9
- package/dist/version.mjs +1 -1
- package/package.json +15 -15
- package/dist/chunks/chunk-2KCAQTPM.js +0 -9
- package/dist/chunks/chunk-AUIBCIET.js +0 -7
- package/dist/chunks/chunk-CJPM2DXZ.js +0 -7
- package/dist/chunks/chunk-DBDWXNAR.js +0 -7
- package/dist/chunks/chunk-E4M34FSN.js +0 -9
- package/dist/chunks/chunk-L37LRUIN.js +0 -7
- package/dist/chunks/chunk-LKYVY3SY.js +0 -7
- package/dist/chunks/chunk-OY2H4NBN.js +0 -8
- package/dist/chunks/chunk-QYGA4IKR.js +0 -7
- package/dist/chunks/chunk-TATIUO4V.js +0 -11
- package/dist/chunks/chunk-WQLEYC3T.js +0 -9
- package/dist/chunks/chunk-XP4C5FLG.js +0 -7
- package/dist/chunks/import-builders-JXIILQOI.js +0 -7
- package/dist/chunks/login-2GVRFOQQ.js +0 -7
- package/dist/chunks/logs-HS5YRXDR.js +0 -7
- package/dist/chunks/ls-WROXB2SF.js +0 -8
- package/dist/chunks/pull-BJUOPX3J.js +0 -7
- package/dist/chunks/purchase-domain-if-available-7KTEXJFK.js +0 -7
- package/dist/chunks/rm-GGY4TGSX.js +0 -8
- package/dist/chunks/set-DJO2C6XG.js +0 -7
- package/dist/chunks/setup-and-link-BZCJ74II.js +0 -7
- package/dist/chunks/vlt-builder-importer-W63QEXYX.js +0 -11
|
@@ -4,5 +4,5 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{parseTeamRefs,teamRefBody}from"./chunk-LSF7FY6X.js";import{repositoryPermissionsPath}from"./chunk-DFVNL5ML.js";import{emitVcrArgParseError,resolveVcrScope,validateVcrJsonOutput}from"./chunk-
|
|
7
|
+
import{parseTeamRefs,teamRefBody}from"./chunk-LSF7FY6X.js";import{repositoryPermissionsPath}from"./chunk-DFVNL5ML.js";import{emitVcrArgParseError,resolveVcrScope,validateVcrJsonOutput}from"./chunk-MJWC4W6J.js";import{require_async_sema}from"./chunk-LG4JQAY7.js";import{outputError}from"./chunk-C7SLCL3Z.js";import"./chunk-RHUAFRZX.js";import{permissionsAddSubcommand}from"./chunk-35QK5NDD.js";import"./chunk-2I64AYHG.js";import"./chunk-SOJCELXH.js";import{printError}from"./chunk-2Z47VG5H.js";import{AGENT_REASON,buildCommandWithGlobalFlags,outputAgentError}from"./chunk-EJNFKH6Y.js";import"./chunk-D4MW3RDW.js";import"./chunk-GXNSAACA.js";import"./chunk-CAAD55US.js";import"./chunk-QTKJC2O5.js";import"./chunk-RCTYVKM5.js";import"./chunk-BRK4OB4B.js";import"./chunk-GHM7V3GG.js";import"./chunk-5XJNPXQK.js";import"./chunk-MY4MONOH.js";import{parseArguments}from"./chunk-MQW6DKD2.js";import"./chunk-BKV35LVB.js";import{getFlagsSpecification}from"./chunk-5IPBCD7K.js";import"./chunk-QMTPSHRV.js";import"./chunk-B4ATVYZW.js";import"./chunk-F2ZWW2IO.js";import"./chunk-PPCFQQSU.js";import"./chunk-QCOPZAUC.js";import"./chunk-HRQQ2N5B.js";import"./chunk-VOZEB6PD.js";import{isAPIError}from"./chunk-4WS3D23J.js";import{packageName}from"./chunk-FI772UVH.js";import{output_manager_default}from"./chunk-MR423MWE.js";import"./chunk-QGIQK47P.js";import"./chunk-AVSPFBLM.js";import"./chunk-XCJDGQO7.js";import"./chunk-YPTLSODC.js";import"./chunk-7HL2RPUO.js";import"./chunk-U7KCDTCH.js";import"./chunk-N3ZZ7FHQ.js";import"./chunk-GU6VIFR5.js";import{__toESM}from"./chunk-6L236MNA.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
8
|
`),failed.length>0?1:0}export{add as default};
|
|
@@ -4,5 +4,5 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{emitVcrArgParseError,handleVcrApiError,resolveVcrScope,validateVcrJsonOutput}from"./chunk-
|
|
7
|
+
import{emitVcrArgParseError,handleVcrApiError,resolveVcrScope,validateVcrJsonOutput}from"./chunk-MJWC4W6J.js";import{outputError}from"./chunk-C7SLCL3Z.js";import"./chunk-RHUAFRZX.js";import{addSubcommand}from"./chunk-MOLEXKVC.js";import"./chunk-EDDOQXEI.js";import"./chunk-35QK5NDD.js";import"./chunk-M4IWOZEG.js";import"./chunk-2I64AYHG.js";import"./chunk-SOJCELXH.js";import{printError}from"./chunk-2Z47VG5H.js";import{AGENT_REASON,buildCommandWithGlobalFlags,outputAgentError}from"./chunk-EJNFKH6Y.js";import"./chunk-D4MW3RDW.js";import"./chunk-GXNSAACA.js";import"./chunk-CAAD55US.js";import"./chunk-QTKJC2O5.js";import"./chunk-RCTYVKM5.js";import"./chunk-BRK4OB4B.js";import"./chunk-GHM7V3GG.js";import"./chunk-5XJNPXQK.js";import"./chunk-MY4MONOH.js";import{parseArguments}from"./chunk-MQW6DKD2.js";import"./chunk-BKV35LVB.js";import{getFlagsSpecification}from"./chunk-5IPBCD7K.js";import"./chunk-QMTPSHRV.js";import"./chunk-B4ATVYZW.js";import"./chunk-F2ZWW2IO.js";import"./chunk-PPCFQQSU.js";import"./chunk-QCOPZAUC.js";import"./chunk-HRQQ2N5B.js";import"./chunk-VOZEB6PD.js";import{isAPIError}from"./chunk-4WS3D23J.js";import{packageName}from"./chunk-FI772UVH.js";import{output_manager_default}from"./chunk-MR423MWE.js";import"./chunk-QGIQK47P.js";import"./chunk-AVSPFBLM.js";import"./chunk-XCJDGQO7.js";import"./chunk-YPTLSODC.js";import"./chunk-7HL2RPUO.js";import"./chunk-U7KCDTCH.js";import"./chunk-N3ZZ7FHQ.js";import"./chunk-GU6VIFR5.js";import"./chunk-6L236MNA.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
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};
|
|
@@ -4,5 +4,5 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{printRuleMutationReceipt}from"./chunk-
|
|
7
|
+
import{printRuleMutationReceipt}from"./chunk-UXAYYF6I.js";import"./chunk-7PNYOSDU.js";import{emitRulesArgParseError,getBodyType,handleRulesApiError,outputRulesError,readRuleBody,resolveRulesProject,resolveRulesTeam,rulesCollectionPath}from"./chunk-EPBZNTIJ.js";import"./chunk-733ZK37Y.js";import"./chunk-W26LLGQV.js";import"./chunk-GZNDA6SV.js";import"./chunk-C7SLCL3Z.js";import"./chunk-WRILLB46.js";import"./chunk-GHAY4PSD.js";import"./chunk-PD3ZD52Q.js";import"./chunk-TRTEXGVN.js";import"./chunk-T3GQAMBJ.js";import"./chunk-P2O5DOYE.js";import"./chunk-MBL6TXEJ.js";import{rulesAddSubcommand}from"./chunk-S54ISKGR.js";import"./chunk-6TAQ6OWD.js";import{printError}from"./chunk-2Z47VG5H.js";import"./chunk-EJNFKH6Y.js";import"./chunk-WPS6JZF6.js";import"./chunk-OSCCYU74.js";import{validateJsonOutput}from"./chunk-D4MW3RDW.js";import"./chunk-GXNSAACA.js";import"./chunk-CAAD55US.js";import"./chunk-QTKJC2O5.js";import"./chunk-RCTYVKM5.js";import"./chunk-BRK4OB4B.js";import"./chunk-GHM7V3GG.js";import"./chunk-5XJNPXQK.js";import"./chunk-MY4MONOH.js";import{parseArguments}from"./chunk-MQW6DKD2.js";import"./chunk-BKV35LVB.js";import{getFlagsSpecification}from"./chunk-5IPBCD7K.js";import"./chunk-QMTPSHRV.js";import"./chunk-B4ATVYZW.js";import"./chunk-F2ZWW2IO.js";import"./chunk-PPCFQQSU.js";import"./chunk-QCOPZAUC.js";import"./chunk-HRQQ2N5B.js";import"./chunk-VOZEB6PD.js";import{isAPIError}from"./chunk-4WS3D23J.js";import"./chunk-FI772UVH.js";import{output_manager_default}from"./chunk-MR423MWE.js";import"./chunk-QGIQK47P.js";import"./chunk-AVSPFBLM.js";import"./chunk-XCJDGQO7.js";import"./chunk-YPTLSODC.js";import"./chunk-7HL2RPUO.js";import"./chunk-U7KCDTCH.js";import"./chunk-N3ZZ7FHQ.js";import"./chunk-GU6VIFR5.js";import"./chunk-6L236MNA.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 rule 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 alert rules must target one project. Use --project <name-or-id>.");body.ruleScope={type:"all"};return}return outputRulesError(client,jsonOutput,"MISSING_SCOPE","Missing rule 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,"alerts rules create"):resolveRulesTeam(client,jsonOutput)}async function add(client,argv){let parsedArgs;try{parsedArgs=parseArguments(argv,getFlagsSpecification(rulesAddSubcommand.options))}catch(error){return emitRulesArgParseError(client,error,"alerts rules create --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 flag: --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 rule type.");if(Object.hasOwn(body,"ruleScope")&&(flags["--project"]||flags["--all"]))return outputRulesError(client,format.jsonOutput,"SCOPE_CONFLICT","Specify rule scope either in the body or with --project/--all, not both.");if(type==="custom"&&flags["--all"])return outputRulesError(client,format.jsonOutput,"INVALID_SCOPE","Custom alert rules 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 alert rule\u2026");try{let response=await client.fetch(rulesCollectionPath(scope.teamId),{method:"POST",body});return format.jsonOutput?client.stdout.write(`${JSON.stringify(response,null,2)}
|
|
8
8
|
`):printRuleMutationReceipt("Created",response.rule,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};
|
|
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{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-
|
|
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-MJWC4W6J.js";import{outputError}from"./chunk-C7SLCL3Z.js";import"./chunk-RHUAFRZX.js";import{buildSubcommand}from"./chunk-MOLEXKVC.js";import"./chunk-EDDOQXEI.js";import"./chunk-35QK5NDD.js";import"./chunk-M4IWOZEG.js";import"./chunk-2I64AYHG.js";import"./chunk-SOJCELXH.js";import{printError}from"./chunk-2Z47VG5H.js";import{AGENT_REASON,buildCommandWithGlobalFlags,outputAgentError}from"./chunk-EJNFKH6Y.js";import"./chunk-D4MW3RDW.js";import"./chunk-GXNSAACA.js";import"./chunk-CAAD55US.js";import"./chunk-QTKJC2O5.js";import"./chunk-RCTYVKM5.js";import"./chunk-BRK4OB4B.js";import"./chunk-GHM7V3GG.js";import"./chunk-5XJNPXQK.js";import"./chunk-MY4MONOH.js";import{parseArguments}from"./chunk-MQW6DKD2.js";import"./chunk-BKV35LVB.js";import{getFlagsSpecification}from"./chunk-5IPBCD7K.js";import"./chunk-QMTPSHRV.js";import"./chunk-B4ATVYZW.js";import"./chunk-F2ZWW2IO.js";import"./chunk-PPCFQQSU.js";import"./chunk-QCOPZAUC.js";import"./chunk-HRQQ2N5B.js";import"./chunk-VOZEB6PD.js";import"./chunk-4WS3D23J.js";import"./chunk-FI772UVH.js";import{output_manager_default}from"./chunk-MR423MWE.js";import"./chunk-QGIQK47P.js";import"./chunk-AVSPFBLM.js";import"./chunk-XCJDGQO7.js";import"./chunk-YPTLSODC.js";import"./chunk-7HL2RPUO.js";import"./chunk-U7KCDTCH.js";import"./chunk-N3ZZ7FHQ.js";import"./chunk-GU6VIFR5.js";import"./chunk-6L236MNA.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};
|
|
@@ -4,7 +4,7 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{readJSONFile}from"./chunk-
|
|
7
|
+
import{readJSONFile}from"./chunk-P3ZZVBZQ.js";import{require_dist as require_dist2,validateConfig}from"./chunk-SX64OM5A.js";import{require_dist2 as require_dist}from"./chunk-G3NHWIPJ.js";import{compileVercelConfig}from"./chunk-D6JBONML.js";import{CantParseJSONFile}from"./chunk-4WS3D23J.js";import{require_build_utils}from"./chunk-MR423MWE.js";import{__toESM}from"./chunk-6L236MNA.js";var import_fs_detectors=__toESM(require_dist(),1),import_service_topology=__toESM(require_dist2(),1);import{readFile,writeFile}from"fs/promises";import{basename,join as join2}from"path";import{parse as tomlParse,stringify as tomlStringify}from"smol-toml";var import_build_utils=__toESM(require_build_utils(),1);import{join}from"path";function createDetectEntrypoint(projectRoot){return async({workPath,framework})=>{let absWorkPath=(0,import_build_utils.normalizePath)(join(projectRoot,workPath)),builderName;if((0,import_build_utils.isPythonFramework)(framework))builderName="@vercel/python";else if((0,import_build_utils.isNodeBackendFramework)(framework))builderName="@vercel/backends";else if(framework==="go")builderName="@vercel/go";else if(framework==="rust")builderName="@vercel/rust";else return null;let detectEntrypoint=await loadBuilderDetectEntrypoint(builderName,projectRoot);return detectEntrypoint?detectEntrypoint(builderName==="@vercel/python"?{workPath:absWorkPath,framework}:{workPath:absWorkPath}):null}}async function loadBuilderDetectEntrypoint(name,projectRoot){let{importBuilders}=await import("./import-builders-UGIWTKRS.js"),loaded=(await importBuilders(new Set([name]),projectRoot)).get(name);if(!loaded)return;let detect=loaded.builder.detectEntrypoint;return typeof detect=="function"?detect:void 0}function getServicesConfiguration(config){let configuredServices=config?.services??config?.experimentalServicesV2??config?.experimentalServices,configuredServicesType=config?.services?"services":config?.experimentalServicesV2?"experimentalServicesV2":config?.experimentalServices?"experimentalServices":void 0;return{configuredServices,configuredServicesType}}async function loadVercelConfig(cwd){try{let{configPath}=await compileVercelConfig(cwd);if(!configPath)return null;let config=await readJSONFile(configPath);return config instanceof Error?null:config}catch{return null}}function isServicesEnvEnabled(){let value=process.env.VERCEL_USE_EXPERIMENTAL_SERVICES;return value==="1"||value?.toLowerCase()==="true"}async function isExperimentalServicesEnabled(cwd){let{configuredServices}=getServicesConfiguration(await loadVercelConfig(cwd));return isServicesEnvEnabled()||configuredServices!==void 0}async function tryDetectServices(cwd,config){config===void 0&&(config=await loadVercelConfig(cwd));let configuration=getServicesConfiguration(config);if(!isServicesEnvEnabled()&&!configuration.configuredServices)return null;let fs=new import_fs_detectors.LocalFileSystemDetector(cwd),result=await(0,import_service_topology.detectServices)({fs,configuredServices:configuration.configuredServices,configuredServicesType:configuration.configuredServicesType,detectEntrypoint:createDetectEntrypoint(cwd)});return result.errors.some(e=>e.code==="NO_SERVICES_CONFIGURED")?null:result}async function writeServicesConfig(cwd,config){let prepared=await prepareServicesConfigWrite(cwd,config);return await writeFile(prepared.configPath,prepared.content,"utf8"),{configFileName:basename(prepared.configPath)}}async function getServicesConfigWriteBlocker(cwd,config){try{return await prepareServicesConfigWrite(cwd,config),null}catch(error){return getServicesConfigWriteBlockerFromError(error)}}function toProjectServicesConfigPatch(config){let services={};for(let[name,svc]of Object.entries(config)){let buildCommand=svc.preDeployCommand&&svc.buildCommand?`${svc.buildCommand} && ${svc.preDeployCommand}`:svc.preDeployCommand||svc.buildCommand;services[name]={root:svc.root,...svc.framework?{framework:svc.framework}:{},...svc.entrypoint?{entrypoint:svc.entrypoint}:{},...buildCommand?{buildCommand}:{}}}let rewrites=(0,import_service_topology.generateServiceRewrites)(config);return{services,...rewrites.length>0?{rewrites}:{}}}async function prepareServicesConfigWrite(cwd,config){let compileResult=await compileVercelConfig(cwd),configPath=join2(cwd,"vercel.json");if(compileResult.sourceFile==="vercel.toml")return prepareTomlServicesConfigWrite(join2(cwd,"vercel.toml"),config);if(compileResult.wasCompiled)throw new Error(`Cannot automatically update ${compileResult.sourceFile??"the current Vercel config"}.`);let existingConfig={};if(compileResult.configPath&&basename(compileResult.configPath)==="vercel.json"){let result=await readJSONFile(configPath);if(result instanceof CantParseJSONFile)throw result;existingConfig=result??{}}let patch=toProjectServicesConfigPatch(config),nextConfig={...existingConfig,...patch,...patch.rewrites?{rewrites:[...existingConfig.rewrites??[],...patch.rewrites]}:{}},validationError=validateConfig(nextConfig);if(validationError)throw validationError;return{configPath,content:JSON.stringify(nextConfig,null,2)+`
|
|
8
8
|
`}}async function prepareTomlServicesConfigWrite(configPath,config){let patch=toProjectServicesConfigPatch(config),patchKeys=Object.keys(patch),existingContent;try{existingContent=await readFile(configPath,"utf8")}catch{existingContent=""}if(existingContent.trim()){let existingParsed=tomlParse(existingContent),overlapping=patchKeys.filter(key=>key in existingParsed);if(overlapping.length>0){let plural=overlapping.length>1,keyList=overlapping.map(k=>`"${k}"`).join(", ");throw new Error(`Cannot automatically update vercel.toml: key${plural?"s":""} ${keyList} already exist${plural?"":"s"}.`)}}let patchToml=tomlStringify(patch),content=existingContent.trim()?existingContent.trimEnd()+`
|
|
9
9
|
|
|
10
10
|
`+patchToml+`
|
|
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{teamCache}from"./chunk-VOZEB6PD.js";import{APIError,InvalidToken}from"./chunk-
|
|
7
|
+
import{teamCache}from"./chunk-VOZEB6PD.js";import{APIError,InvalidToken}from"./chunk-4WS3D23J.js";import{URLSearchParams}from"url";async function getTeams(client,opts={}){let{apiVersion=1}=opts;if(apiVersion===1){if(client.teams)return client.teams;if(client.teamsPromise)return client.teamsPromise;client.teamsPromise=fetchTeams(client,opts).then(result=>{let teams=Array.isArray(result)?result:result.teams;return client.teams=teams,teams});try{return await client.teamsPromise}finally{client.teamsPromise=void 0}}return fetchTeams(client,opts)}async function fetchTeams(client,opts={}){let{apiVersion=1}=opts,query="";if(opts.apiVersion===2){let params=new URLSearchParams({limit:String(typeof opts.limit=="number"?opts.limit:20)});opts.next&¶ms.set("next",String(opts.next)),query=`?${params}`}try{let body=await client.fetch(`/v${apiVersion}/teams${query}`,{useCurrentTeam:!1});if(apiVersion===1){let teams=body.teams||[];for(let team of teams)teamCache.set(team.id,team);return teams}return body}catch(error){throw error instanceof APIError&&error.status===403?new InvalidToken(client.authConfig.tokenSource):error}}export{getTeams};
|
|
@@ -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{
|
|
7
|
+
import{getErrorRecovery,shouldEmitNonInteractiveCommandError,trackAgentError,writeAgentError}from"./chunk-EJNFKH6Y.js";import{buildCorrectedCommand,isArgumentError}from"./chunk-MQW6DKD2.js";import{parseRetryAfterHeaderAsMillis,require_bytes}from"./chunk-4WS3D23J.js";import{getCommandName}from"./chunk-FI772UVH.js";import{output_manager_default}from"./chunk-MR423MWE.js";import{pkg_default}from"./chunk-AVSPFBLM.js";import{require_source}from"./chunk-U7KCDTCH.js";import{__toESM}from"./chunk-6L236MNA.js";var import_chalk=__toESM(require_source(),1);var import_bytes=__toESM(require_bytes(),1);async function responseError(res,fallbackMessage=null,parsedBody={}){let message="",bodyError;if(res.status>=400&&res.status<500){let body;try{body=await res.json()}catch{body=parsedBody}bodyError=body.error||body.err||{},message=bodyError.message}message||(message=fallbackMessage===null?"Response Error":fallbackMessage);let err=new Error(`${message} (${res.status})`);if(err.status=res.status,err.serverMessage=message,bodyError)for(let field of Object.keys(bodyError))field!=="message"&&(err[field]=bodyError[field]);if(res.status===429||res.status===503){let parsed=parseRetryAfterHeaderAsMillis(res.headers.get("Retry-After"));err.retryAfterMs=parsed??(res.status===429?0:void 0)}return err}var MAX_SERIALIZED_ERROR_DEPTH=5;function isPlainObject(value){let proto=Object.getPrototypeOf(value);return proto===null||proto===Object.prototype}function toJsonSafe(value,ancestors,depth){if(typeof value=="bigint")return value.toString();if(!(typeof value=="function"||typeof value=="symbol")){if(value===null||typeof value!="object")return value;if(ancestors.has(value))return"[Circular]";if(depth>=MAX_SERIALIZED_ERROR_DEPTH)return"[Truncated]";if(value instanceof Error)return serializeError(value,ancestors,depth+1);if(!Array.isArray(value)&&!isPlainObject(value))return`[${value.constructor?.name||"Object"}]`;ancestors.add(value);try{if(Array.isArray(value))return value.map(item=>toJsonSafe(item,ancestors,depth+1));let copy={};for(let[key,child]of Object.entries(value))copy[key]=toJsonSafe(child,ancestors,depth+1);return copy}finally{ancestors.delete(value)}}}function serializeError(err,ancestors,depth){ancestors.add(err);try{let enumerable={name:err.name};for(let key of Object.getOwnPropertyNames(err))enumerable[key]=toJsonSafe(err[key],ancestors,depth);return enumerable}finally{ancestors.delete(err)}}function toEnumerableError(err){return err===null||typeof err!="object"?{name:"Error",message:String(err)}:serializeError(err,new WeakSet,0)}function printError(error2,client){typeof error2=="string"&&(error2=new Error(error2));let apiError=error2,{message,stack,status,code,sizeLimit}=apiError,argumentError=isArgumentError(error2)?error2:void 0,suggestion=argumentError?.suggestedOption&&argumentError.invalidOption,correction=suggestion&&client&&argumentError?buildCorrectedCommand(client.argv,argumentError.invalidOption,argumentError.suggestedOption,argumentError.flagsSpecification):void 0,recovery=getErrorRecovery(apiError,client),reason=status===403?"forbidden":status===402?"payment_required":status===401?"not_authorized":status===429?"rate_limited":argumentError?"invalid_arguments":"api_error",hint=argumentError?.allowedOptions?`Vercel CLI ${pkg_default.version} accepts: ${argumentError.allowedOptions.join(", ")}.${suggestion?` Did you mean ${argumentError.suggestedOption}?`:""}`:recovery.hint;if(client&&(status||argumentError?.allowedOptions)){let payload={...recovery,status:"error",reason,message:apiError.serverMessage||message,hint,...argumentError?.allowedOptions&&{allowedOptions:argumentError.allowedOptions,suggestedOption:argumentError.suggestedOption,cliVersion:pkg_default.version},...correction&&{next:[{command:correction,when:correction.includes("<")?"Replace placeholders with the intended values, then run the corrected command":"Run the corrected command"}]}};if(shouldEmitNonInteractiveCommandError(client)){output_manager_default.stopSpinner(),writeAgentError(client,payload);return}trackAgentError(client,payload)}if(hint){output_manager_default.stopSpinner(),output_manager_default.fatal(apiError.serverMessage||message||"The request failed."),output_manager_default.print(` ${hint}
|
|
8
8
|
`),correction&&output_manager_default.print(` ${correction}
|
|
9
9
|
`);return}output_manager_default.debug(`handling error: ${stack}`),message!=="User force closed the prompt with 0 null"&&(status===403?output_manager_default.error(message||`Authentication error. Run ${getCommandName("login")} to log-in again.`):status===429?output_manager_default.error(message):code==="size_limit_exceeded"?output_manager_default.error(`File size limit exceeded (${(0,import_bytes.default)(sizeLimit)})`):message?output_manager_default.prettyError(apiError):status===500?output_manager_default.error("Unexpected server error. Please retry."):code==="USER_ABORT"?output_manager_default.log("Canceled"):output_manager_default.error(`Unexpected error. Please try again later. (${message})`))}export{responseError,toEnumerableError,printError};
|
|
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{formatOption,limitOption,projectOption,yesOption}from"./chunk-
|
|
7
|
+
import{formatOption,limitOption,projectOption,yesOption}from"./chunk-5IPBCD7K.js";import{packageName}from"./chunk-FI772UVH.js";var PERMISSIONS_ACTIONS={ls:["ls","list"],add:["add"],rm:["rm","remove"],clear:["clear"]},projectScopeOption={...projectOption,shorthand:"p",description:"Project name or ID (defaults to the linked project)."},nextOption={name:"next",shorthand:null,type:String,deprecated:!1,description:"Continue from a previous response",argument:"CURSOR"},cursorOption={name:"cursor",shorthand:"c",type:String,deprecated:!0,description:"Cursor from a previous page to continue listing from",argument:"STRING"},permissionsLsSubcommand={name:"ls",aliases:["list"],description:"List teams with access to a repository",arguments:[],options:[projectScopeOption,limitOption,nextOption,cursorOption,formatOption],examples:[{name:"List teams with access to a repository",value:`${packageName} vcr permissions my-app ls`},{name:"List teams with access as JSON",value:`${packageName} vcr permissions my-app ls --format json`}]},permissionsAddSubcommand={name:"add",aliases:[],description:"Give one or more teams access to pull images from a repository",arguments:[{name:"team",required:!0,multiple:!0}],options:[projectScopeOption,formatOption],examples:[{name:"Share a repository with a team by id",value:`${packageName} vcr permissions my-app add team_1a2b3c4d`},{name:"Share a repository with a team by slug",value:`${packageName} vcr permissions my-app add my-team`},{name:"Share a repository with multiple teams",value:`${packageName} vcr permissions my-app add team_1a2b3c4d,other-team`}]},permissionsRmSubcommand={name:"rm",aliases:["remove"],description:"Remove one or more teams' access to a repository",arguments:[{name:"team",required:!0,multiple:!0}],options:[projectScopeOption,formatOption],examples:[{name:"Remove a team's access by id",value:`${packageName} vcr permissions my-app rm team_1a2b3c4d`},{name:"Remove multiple teams' access",value:`${packageName} vcr permissions my-app rm team_1a2b3c4d,other-team`}]},permissionsClearSubcommand={name:"clear",aliases:[],description:"Remove access to a repository for every team",arguments:[],options:[projectScopeOption,yesOption,formatOption],examples:[{name:"Clear all repository permissions",value:`${packageName} vcr permissions my-app clear`},{name:"Clear all repository permissions without the confirmation prompt",value:`${packageName} vcr permissions my-app clear --yes`}]},permissionsAggregateCommand={name:"permissions",aliases:["permission"],argumentsBeforeSubcommand:!0,description:"Manage which teams can pull images from a container registry repository",arguments:[{name:"repository",required:!0}],subcommands:[permissionsLsSubcommand,permissionsAddSubcommand,permissionsRmSubcommand,permissionsClearSubcommand],options:[],examples:[{name:"List teams with access to a repository",value:`${packageName} vcr permissions my-app ls`},{name:"Share a repository with a team",value:`${packageName} vcr permissions my-app add team_1a2b3c4d`},{name:"Remove a team's access to a repository",value:`${packageName} vcr permissions my-app rm team_1a2b3c4d`},{name:"Clear all repository permissions",value:`${packageName} vcr permissions my-app clear`}]};export{PERMISSIONS_ACTIONS,permissionsLsSubcommand,permissionsAddSubcommand,permissionsRmSubcommand,permissionsClearSubcommand,permissionsAggregateCommand};
|
|
@@ -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_load_json_file,require_pify}from"./chunk-RCTYVKM5.js";import{isNativeBinaryInstall}from"./chunk-7T6TL3GQ.js";import{require_graceful_fs}from"./chunk-F2ZWW2IO.js";import{output_manager_default,require_build_utils,require_signal_exit}from"./chunk-EWWFNMPZ.js";import{__commonJS,__require,__toESM}from"./chunk-6L236MNA.js";var require_dist=__commonJS({"../../internals/constants/dist/index.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.TITLE=exports.NAME=exports.LOGO=exports.PROJECT_ENV_TARGET=void 0;exports.PROJECT_ENV_TARGET=["production","preview","development"];exports.LOGO="\u25B2";exports.NAME="vercel";exports.TITLE="Vercel"}});var require_imurmurhash=__commonJS({"../../node_modules/.pnpm/imurmurhash@0.1.4/node_modules/imurmurhash/imurmurhash.js"(exports,module){(function(){var cache;function MurmurHash3(key,seed){var m=this instanceof MurmurHash3?this:cache;if(m.reset(seed),typeof key=="string"&&key.length>0&&m.hash(key),m!==this)return m}MurmurHash3.prototype.hash=function(key){var h1,k1,i,top,len;switch(len=key.length,this.len+=len,k1=this.k1,i=0,this.rem){case 0:k1^=len>i?key.charCodeAt(i++)&65535:0;case 1:k1^=len>i?(key.charCodeAt(i++)&65535)<<8:0;case 2:k1^=len>i?(key.charCodeAt(i++)&65535)<<16:0;case 3:k1^=len>i?(key.charCodeAt(i)&255)<<24:0,k1^=len>i?(key.charCodeAt(i++)&65280)>>8:0}if(this.rem=len+this.rem&3,len-=this.rem,len>0){for(h1=this.h1;k1=k1*11601+(k1&65535)*3432906752&4294967295,k1=k1<<15|k1>>>17,k1=k1*13715+(k1&65535)*461832192&4294967295,h1^=k1,h1=h1<<13|h1>>>19,h1=h1*5+3864292196&4294967295,!(i>=len);)k1=key.charCodeAt(i++)&65535^(key.charCodeAt(i++)&65535)<<8^(key.charCodeAt(i++)&65535)<<16,top=key.charCodeAt(i++),k1^=(top&255)<<24^(top&65280)>>8;switch(k1=0,this.rem){case 3:k1^=(key.charCodeAt(i+2)&65535)<<16;case 2:k1^=(key.charCodeAt(i+1)&65535)<<8;case 1:k1^=key.charCodeAt(i)&65535}this.h1=h1}return this.k1=k1,this},MurmurHash3.prototype.result=function(){var k1,h1;return k1=this.k1,h1=this.h1,k1>0&&(k1=k1*11601+(k1&65535)*3432906752&4294967295,k1=k1<<15|k1>>>17,k1=k1*13715+(k1&65535)*461832192&4294967295,h1^=k1),h1^=this.len,h1^=h1>>>16,h1=h1*51819+(h1&65535)*2246770688&4294967295,h1^=h1>>>13,h1=h1*44597+(h1&65535)*3266445312&4294967295,h1^=h1>>>16,h1>>>0},MurmurHash3.prototype.reset=function(seed){return this.h1=typeof seed=="number"?seed:0,this.rem=this.k1=this.len=0,this},cache=new MurmurHash3,typeof module<"u"?module.exports=MurmurHash3:this.MurmurHash3=MurmurHash3})()}});var require_write_file_atomic=__commonJS({"../../node_modules/.pnpm/write-file-atomic@2.4.3/node_modules/write-file-atomic/index.js"(exports,module){"use strict";module.exports=writeFile;module.exports.sync=writeFileSync2;module.exports._getTmpname=getTmpname;module.exports._cleanupOnExit=cleanupOnExit;var fs=require_graceful_fs(),MurmurHash3=require_imurmurhash(),onExit=require_signal_exit(),path=__require("path"),activeFiles={},threadId=function(){try{var workerThreads=__require("worker_threads");return workerThreads.threadId}catch{return 0}}(),invocations=0;function getTmpname(filename){return filename+"."+MurmurHash3(__filename).hash(String(process.pid)).hash(String(threadId)).hash(String(++invocations)).result()}function cleanupOnExit(tmpfile){return function(){try{fs.unlinkSync(typeof tmpfile=="function"?tmpfile():tmpfile)}catch{}}}function writeFile(filename,data,options,callback){options?options instanceof Function?(callback=options,options={}):typeof options=="string"&&(options={encoding:options}):options={};var Promise2=options.Promise||global.Promise,truename,fd,tmpfile,removeOnExitHandler=onExit(cleanupOnExit(()=>tmpfile)),absoluteName=path.resolve(filename);new Promise2(function(resolve){activeFiles[absoluteName]||(activeFiles[absoluteName]=[]),activeFiles[absoluteName].push(resolve),activeFiles[absoluteName].length===1&&resolve()}).then(function(){return new Promise2(function(resolve){fs.realpath(filename,function(_,realname){truename=realname||filename,tmpfile=getTmpname(truename),resolve()})})}).then(function(){return new Promise2(function(resolve){options.mode&&options.chown?resolve():fs.stat(truename,function(err,stats){err||!stats||(options=Object.assign({},options),options.mode==null&&(options.mode=stats.mode),options.chown==null&&process.getuid&&(options.chown={uid:stats.uid,gid:stats.gid})),resolve()})})}).then(function(){return new Promise2(function(resolve,reject){fs.open(tmpfile,"w",options.mode,function(err,_fd){fd=_fd,err?reject(err):resolve()})})}).then(function(){return new Promise2(function(resolve,reject){Buffer.isBuffer(data)?fs.write(fd,data,0,data.length,0,function(err){err?reject(err):resolve()}):data!=null?fs.write(fd,String(data),0,String(options.encoding||"utf8"),function(err){err?reject(err):resolve()}):resolve()})}).then(function(){return new Promise2(function(resolve,reject){options.fsync!==!1?fs.fsync(fd,function(err){err?fs.close(fd,()=>reject(err)):fs.close(fd,resolve)}):fs.close(fd,resolve)})}).then(function(){if(fd=null,options.chown)return new Promise2(function(resolve,reject){fs.chown(tmpfile,options.chown.uid,options.chown.gid,function(err){err?reject(err):resolve()})})}).then(function(){if(options.mode)return new Promise2(function(resolve,reject){fs.chmod(tmpfile,options.mode,function(err){err?reject(err):resolve()})})}).then(function(){return new Promise2(function(resolve,reject){fs.rename(tmpfile,truename,function(err){err?reject(err):resolve()})})}).then(function(){removeOnExitHandler(),callback()},function(err){return new Promise2(resolve=>fd?fs.close(fd,resolve):resolve()).then(()=>{removeOnExitHandler(),fs.unlink(tmpfile,function(){callback(err)})})}).then(function(){activeFiles[absoluteName].shift(),activeFiles[absoluteName].length>0?activeFiles[absoluteName][0]():delete activeFiles[absoluteName]})}function writeFileSync2(filename,data,options){typeof options=="string"?options={encoding:options}:options||(options={});try{filename=fs.realpathSync(filename)}catch{}var tmpfile=getTmpname(filename);if(!options.mode||!options.chown)try{var stats=fs.statSync(filename);options=Object.assign({},options),options.mode||(options.mode=stats.mode),!options.chown&&process.getuid&&(options.chown={uid:stats.uid,gid:stats.gid})}catch{}var fd,cleanup=cleanupOnExit(tmpfile),removeOnExitHandler=onExit(cleanup);try{fd=fs.openSync(tmpfile,"w",options.mode),Buffer.isBuffer(data)?fs.writeSync(fd,data,0,data.length,0):data!=null&&fs.writeSync(fd,String(data),0,String(options.encoding||"utf8")),options.fsync!==!1&&fs.fsyncSync(fd),fs.closeSync(fd),options.chown&&fs.chownSync(tmpfile,options.chown.uid,options.chown.gid),options.mode&&fs.chmodSync(tmpfile,options.mode),fs.renameSync(tmpfile,filename),removeOnExitHandler()}catch(err){if(fd)try{fs.closeSync(fd)}catch{}throw removeOnExitHandler(),cleanup(),err}}}});var require_is_plain_obj=__commonJS({"../../node_modules/.pnpm/is-plain-obj@1.1.0/node_modules/is-plain-obj/index.js"(exports,module){"use strict";var toString=Object.prototype.toString;module.exports=function(x){var prototype;return toString.call(x)==="[object Object]"&&(prototype=Object.getPrototypeOf(x),prototype===null||prototype===Object.getPrototypeOf({}))}}});var require_sort_keys=__commonJS({"../../node_modules/.pnpm/sort-keys@1.1.2/node_modules/sort-keys/index.js"(exports,module){"use strict";var isPlainObj=require_is_plain_obj();module.exports=function(obj,opts){if(!isPlainObj(obj))throw new TypeError("Expected a plain object");opts=opts||{},typeof opts=="function"&&(opts={compare:opts});var deep=opts.deep,seenInput=[],seenOutput=[],sortKeys=function(x){var seenIndex=seenInput.indexOf(x);if(seenIndex!==-1)return seenOutput[seenIndex];var ret={},keys=Object.keys(x).sort(opts.compare);seenInput.push(x),seenOutput.push(ret);for(var i=0;i<keys.length;i++){var key=keys[i],val=x[key];ret[key]=deep&&isPlainObj(val)?sortKeys(val):val}return ret};return sortKeys(obj)}}});var require_pify2=__commonJS({"../../node_modules/.pnpm/pify@3.0.0/node_modules/pify/index.js"(exports,module){"use strict";var processFn=(fn,opts)=>function(){let P=opts.promiseModule,args=new Array(arguments.length);for(let i=0;i<arguments.length;i++)args[i]=arguments[i];return new P((resolve,reject)=>{opts.errorFirst?args.push(function(err,result){if(opts.multiArgs){let results=new Array(arguments.length-1);for(let i=1;i<arguments.length;i++)results[i-1]=arguments[i];err?(results.unshift(err),reject(results)):resolve(results)}else err?reject(err):resolve(result)}):args.push(function(result){if(opts.multiArgs){let results=new Array(arguments.length-1);for(let i=0;i<arguments.length;i++)results[i]=arguments[i];resolve(results)}else resolve(result)}),fn.apply(this,args)})};module.exports=(obj,opts)=>{opts=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},opts);let filter=key=>{let match=pattern=>typeof pattern=="string"?key===pattern:pattern.test(key);return opts.include?opts.include.some(match):!opts.exclude.some(match)},ret;typeof obj=="function"?ret=function(){return opts.excludeMain?obj.apply(this,arguments):processFn(obj,opts).apply(this,arguments)}:ret=Object.create(Object.getPrototypeOf(obj));for(let key in obj){let x=obj[key];ret[key]=typeof x=="function"&&filter(key)?processFn(x,opts):x}return ret}}});var require_make_dir=__commonJS({"../../node_modules/.pnpm/make-dir@1.3.0/node_modules/make-dir/index.js"(exports,module){"use strict";var fs=__require("fs"),path=__require("path"),pify=require_pify2(),defaults={mode:511&~process.umask(),fs},checkPath=pth=>{if(process.platform==="win32"&&/[<>:"|?*]/.test(pth.replace(path.parse(pth).root,""))){let err=new Error(`Path contains invalid characters: ${pth}`);throw err.code="EINVAL",err}};module.exports=(input,opts)=>Promise.resolve().then(()=>{checkPath(input),opts=Object.assign({},defaults,opts);let mkdir=pify(opts.fs.mkdir),stat=pify(opts.fs.stat),make=pth=>mkdir(pth,opts.mode).then(()=>pth).catch(err=>{if(err.code==="ENOENT"){if(err.message.includes("null bytes")||path.dirname(pth)===pth)throw err;return make(path.dirname(pth)).then(()=>make(pth))}return stat(pth).then(stats=>stats.isDirectory()?pth:Promise.reject()).catch(()=>{throw err})});return make(path.resolve(input))});module.exports.sync=(input,opts)=>{checkPath(input),opts=Object.assign({},defaults,opts);let make=pth=>{try{opts.fs.mkdirSync(pth,opts.mode)}catch(err){if(err.code==="ENOENT"){if(err.message.includes("null bytes")||path.dirname(pth)===pth)throw err;return make(path.dirname(pth)),make(pth)}try{if(!opts.fs.statSync(pth).isDirectory())throw new Error("The path is not a directory")}catch{throw err}}return pth};return make(path.resolve(input))}}});var require_detect_indent=__commonJS({"../../node_modules/.pnpm/detect-indent@5.0.0/node_modules/detect-indent/index.js"(exports,module){"use strict";var INDENT_RE=/^(?:( )+|\t+)/;function getMostUsed(indents){let result=0,maxUsed=0,maxWeight=0;for(let entry of indents){let key=entry[0],val=entry[1],u=val[0],w=val[1];(u>maxUsed||u===maxUsed&&w>maxWeight)&&(maxUsed=u,maxWeight=w,result=Number(key))}return result}module.exports=str=>{if(typeof str!="string")throw new TypeError("Expected a string");let tabs=0,spaces=0,prev=0,indents=new Map,current,isIndent;for(let line of str.split(/\n/g)){if(!line)continue;let indent2,matches=line.match(INDENT_RE);matches?(indent2=matches[0].length,matches[1]?spaces++:tabs++):indent2=0;let diff=indent2-prev;prev=indent2,diff?(isIndent=diff>0,current=indents.get(isIndent?diff:-diff),current?current[0]++:(current=[1,0],indents.set(diff,current))):current&&(current[1]+=Number(isIndent))}let amount=getMostUsed(indents),type,indent;return amount?spaces>=tabs?(type="space",indent=" ".repeat(amount)):(type="tab",indent=" ".repeat(amount)):(type=null,indent=""),{amount,type,indent}}}});var require_write_json_file=__commonJS({"../../node_modules/.pnpm/write-json-file@2.2.0/node_modules/write-json-file/index.js"(exports,module){"use strict";var path=__require("path"),fs=require_graceful_fs(),writeFileAtomic=require_write_file_atomic(),sortKeys=require_sort_keys(),makeDir=require_make_dir(),pify=require_pify(),detectIndent=require_detect_indent(),init=(fn,fp,data,opts)=>{if(!fp)throw new TypeError("Expected a filepath");if(data===void 0)throw new TypeError("Expected data to stringify");return opts=Object.assign({indent:" ",sortKeys:!1},opts),opts.sortKeys&&(data=sortKeys(data,{deep:!0,compare:typeof opts.sortKeys=="function"&&opts.sortKeys})),fn(fp,data,opts)},readFile=fp=>pify(fs.readFile)(fp,"utf8").catch(()=>{}),main=(fp,data,opts)=>(opts.detectIndent?readFile(fp):Promise.resolve()).then(str=>{let indent=str?detectIndent(str).indent:opts.indent,json=JSON.stringify(data,opts.replacer,indent);return pify(writeFileAtomic)(fp,`${json}
|
|
7
|
+
import{require_load_json_file,require_pify}from"./chunk-RCTYVKM5.js";import{isNativeBinaryInstall}from"./chunk-7T6TL3GQ.js";import{require_graceful_fs}from"./chunk-F2ZWW2IO.js";import{output_manager_default,require_build_utils,require_signal_exit}from"./chunk-MR423MWE.js";import{__commonJS,__require,__toESM}from"./chunk-6L236MNA.js";var require_dist=__commonJS({"../../internals/constants/dist/index.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.TITLE=exports.NAME=exports.LOGO=exports.PROJECT_ENV_TARGET=void 0;exports.PROJECT_ENV_TARGET=["production","preview","development"];exports.LOGO="\u25B2";exports.NAME="vercel";exports.TITLE="Vercel"}});var require_imurmurhash=__commonJS({"../../node_modules/.pnpm/imurmurhash@0.1.4/node_modules/imurmurhash/imurmurhash.js"(exports,module){(function(){var cache;function MurmurHash3(key,seed){var m=this instanceof MurmurHash3?this:cache;if(m.reset(seed),typeof key=="string"&&key.length>0&&m.hash(key),m!==this)return m}MurmurHash3.prototype.hash=function(key){var h1,k1,i,top,len;switch(len=key.length,this.len+=len,k1=this.k1,i=0,this.rem){case 0:k1^=len>i?key.charCodeAt(i++)&65535:0;case 1:k1^=len>i?(key.charCodeAt(i++)&65535)<<8:0;case 2:k1^=len>i?(key.charCodeAt(i++)&65535)<<16:0;case 3:k1^=len>i?(key.charCodeAt(i)&255)<<24:0,k1^=len>i?(key.charCodeAt(i++)&65280)>>8:0}if(this.rem=len+this.rem&3,len-=this.rem,len>0){for(h1=this.h1;k1=k1*11601+(k1&65535)*3432906752&4294967295,k1=k1<<15|k1>>>17,k1=k1*13715+(k1&65535)*461832192&4294967295,h1^=k1,h1=h1<<13|h1>>>19,h1=h1*5+3864292196&4294967295,!(i>=len);)k1=key.charCodeAt(i++)&65535^(key.charCodeAt(i++)&65535)<<8^(key.charCodeAt(i++)&65535)<<16,top=key.charCodeAt(i++),k1^=(top&255)<<24^(top&65280)>>8;switch(k1=0,this.rem){case 3:k1^=(key.charCodeAt(i+2)&65535)<<16;case 2:k1^=(key.charCodeAt(i+1)&65535)<<8;case 1:k1^=key.charCodeAt(i)&65535}this.h1=h1}return this.k1=k1,this},MurmurHash3.prototype.result=function(){var k1,h1;return k1=this.k1,h1=this.h1,k1>0&&(k1=k1*11601+(k1&65535)*3432906752&4294967295,k1=k1<<15|k1>>>17,k1=k1*13715+(k1&65535)*461832192&4294967295,h1^=k1),h1^=this.len,h1^=h1>>>16,h1=h1*51819+(h1&65535)*2246770688&4294967295,h1^=h1>>>13,h1=h1*44597+(h1&65535)*3266445312&4294967295,h1^=h1>>>16,h1>>>0},MurmurHash3.prototype.reset=function(seed){return this.h1=typeof seed=="number"?seed:0,this.rem=this.k1=this.len=0,this},cache=new MurmurHash3,typeof module<"u"?module.exports=MurmurHash3:this.MurmurHash3=MurmurHash3})()}});var require_write_file_atomic=__commonJS({"../../node_modules/.pnpm/write-file-atomic@2.4.3/node_modules/write-file-atomic/index.js"(exports,module){"use strict";module.exports=writeFile;module.exports.sync=writeFileSync2;module.exports._getTmpname=getTmpname;module.exports._cleanupOnExit=cleanupOnExit;var fs=require_graceful_fs(),MurmurHash3=require_imurmurhash(),onExit=require_signal_exit(),path=__require("path"),activeFiles={},threadId=function(){try{var workerThreads=__require("worker_threads");return workerThreads.threadId}catch{return 0}}(),invocations=0;function getTmpname(filename){return filename+"."+MurmurHash3(__filename).hash(String(process.pid)).hash(String(threadId)).hash(String(++invocations)).result()}function cleanupOnExit(tmpfile){return function(){try{fs.unlinkSync(typeof tmpfile=="function"?tmpfile():tmpfile)}catch{}}}function writeFile(filename,data,options,callback){options?options instanceof Function?(callback=options,options={}):typeof options=="string"&&(options={encoding:options}):options={};var Promise2=options.Promise||global.Promise,truename,fd,tmpfile,removeOnExitHandler=onExit(cleanupOnExit(()=>tmpfile)),absoluteName=path.resolve(filename);new Promise2(function(resolve){activeFiles[absoluteName]||(activeFiles[absoluteName]=[]),activeFiles[absoluteName].push(resolve),activeFiles[absoluteName].length===1&&resolve()}).then(function(){return new Promise2(function(resolve){fs.realpath(filename,function(_,realname){truename=realname||filename,tmpfile=getTmpname(truename),resolve()})})}).then(function(){return new Promise2(function(resolve){options.mode&&options.chown?resolve():fs.stat(truename,function(err,stats){err||!stats||(options=Object.assign({},options),options.mode==null&&(options.mode=stats.mode),options.chown==null&&process.getuid&&(options.chown={uid:stats.uid,gid:stats.gid})),resolve()})})}).then(function(){return new Promise2(function(resolve,reject){fs.open(tmpfile,"w",options.mode,function(err,_fd){fd=_fd,err?reject(err):resolve()})})}).then(function(){return new Promise2(function(resolve,reject){Buffer.isBuffer(data)?fs.write(fd,data,0,data.length,0,function(err){err?reject(err):resolve()}):data!=null?fs.write(fd,String(data),0,String(options.encoding||"utf8"),function(err){err?reject(err):resolve()}):resolve()})}).then(function(){return new Promise2(function(resolve,reject){options.fsync!==!1?fs.fsync(fd,function(err){err?fs.close(fd,()=>reject(err)):fs.close(fd,resolve)}):fs.close(fd,resolve)})}).then(function(){if(fd=null,options.chown)return new Promise2(function(resolve,reject){fs.chown(tmpfile,options.chown.uid,options.chown.gid,function(err){err?reject(err):resolve()})})}).then(function(){if(options.mode)return new Promise2(function(resolve,reject){fs.chmod(tmpfile,options.mode,function(err){err?reject(err):resolve()})})}).then(function(){return new Promise2(function(resolve,reject){fs.rename(tmpfile,truename,function(err){err?reject(err):resolve()})})}).then(function(){removeOnExitHandler(),callback()},function(err){return new Promise2(resolve=>fd?fs.close(fd,resolve):resolve()).then(()=>{removeOnExitHandler(),fs.unlink(tmpfile,function(){callback(err)})})}).then(function(){activeFiles[absoluteName].shift(),activeFiles[absoluteName].length>0?activeFiles[absoluteName][0]():delete activeFiles[absoluteName]})}function writeFileSync2(filename,data,options){typeof options=="string"?options={encoding:options}:options||(options={});try{filename=fs.realpathSync(filename)}catch{}var tmpfile=getTmpname(filename);if(!options.mode||!options.chown)try{var stats=fs.statSync(filename);options=Object.assign({},options),options.mode||(options.mode=stats.mode),!options.chown&&process.getuid&&(options.chown={uid:stats.uid,gid:stats.gid})}catch{}var fd,cleanup=cleanupOnExit(tmpfile),removeOnExitHandler=onExit(cleanup);try{fd=fs.openSync(tmpfile,"w",options.mode),Buffer.isBuffer(data)?fs.writeSync(fd,data,0,data.length,0):data!=null&&fs.writeSync(fd,String(data),0,String(options.encoding||"utf8")),options.fsync!==!1&&fs.fsyncSync(fd),fs.closeSync(fd),options.chown&&fs.chownSync(tmpfile,options.chown.uid,options.chown.gid),options.mode&&fs.chmodSync(tmpfile,options.mode),fs.renameSync(tmpfile,filename),removeOnExitHandler()}catch(err){if(fd)try{fs.closeSync(fd)}catch{}throw removeOnExitHandler(),cleanup(),err}}}});var require_is_plain_obj=__commonJS({"../../node_modules/.pnpm/is-plain-obj@1.1.0/node_modules/is-plain-obj/index.js"(exports,module){"use strict";var toString=Object.prototype.toString;module.exports=function(x){var prototype;return toString.call(x)==="[object Object]"&&(prototype=Object.getPrototypeOf(x),prototype===null||prototype===Object.getPrototypeOf({}))}}});var require_sort_keys=__commonJS({"../../node_modules/.pnpm/sort-keys@1.1.2/node_modules/sort-keys/index.js"(exports,module){"use strict";var isPlainObj=require_is_plain_obj();module.exports=function(obj,opts){if(!isPlainObj(obj))throw new TypeError("Expected a plain object");opts=opts||{},typeof opts=="function"&&(opts={compare:opts});var deep=opts.deep,seenInput=[],seenOutput=[],sortKeys=function(x){var seenIndex=seenInput.indexOf(x);if(seenIndex!==-1)return seenOutput[seenIndex];var ret={},keys=Object.keys(x).sort(opts.compare);seenInput.push(x),seenOutput.push(ret);for(var i=0;i<keys.length;i++){var key=keys[i],val=x[key];ret[key]=deep&&isPlainObj(val)?sortKeys(val):val}return ret};return sortKeys(obj)}}});var require_pify2=__commonJS({"../../node_modules/.pnpm/pify@3.0.0/node_modules/pify/index.js"(exports,module){"use strict";var processFn=(fn,opts)=>function(){let P=opts.promiseModule,args=new Array(arguments.length);for(let i=0;i<arguments.length;i++)args[i]=arguments[i];return new P((resolve,reject)=>{opts.errorFirst?args.push(function(err,result){if(opts.multiArgs){let results=new Array(arguments.length-1);for(let i=1;i<arguments.length;i++)results[i-1]=arguments[i];err?(results.unshift(err),reject(results)):resolve(results)}else err?reject(err):resolve(result)}):args.push(function(result){if(opts.multiArgs){let results=new Array(arguments.length-1);for(let i=0;i<arguments.length;i++)results[i]=arguments[i];resolve(results)}else resolve(result)}),fn.apply(this,args)})};module.exports=(obj,opts)=>{opts=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},opts);let filter=key=>{let match=pattern=>typeof pattern=="string"?key===pattern:pattern.test(key);return opts.include?opts.include.some(match):!opts.exclude.some(match)},ret;typeof obj=="function"?ret=function(){return opts.excludeMain?obj.apply(this,arguments):processFn(obj,opts).apply(this,arguments)}:ret=Object.create(Object.getPrototypeOf(obj));for(let key in obj){let x=obj[key];ret[key]=typeof x=="function"&&filter(key)?processFn(x,opts):x}return ret}}});var require_make_dir=__commonJS({"../../node_modules/.pnpm/make-dir@1.3.0/node_modules/make-dir/index.js"(exports,module){"use strict";var fs=__require("fs"),path=__require("path"),pify=require_pify2(),defaults={mode:511&~process.umask(),fs},checkPath=pth=>{if(process.platform==="win32"&&/[<>:"|?*]/.test(pth.replace(path.parse(pth).root,""))){let err=new Error(`Path contains invalid characters: ${pth}`);throw err.code="EINVAL",err}};module.exports=(input,opts)=>Promise.resolve().then(()=>{checkPath(input),opts=Object.assign({},defaults,opts);let mkdir=pify(opts.fs.mkdir),stat=pify(opts.fs.stat),make=pth=>mkdir(pth,opts.mode).then(()=>pth).catch(err=>{if(err.code==="ENOENT"){if(err.message.includes("null bytes")||path.dirname(pth)===pth)throw err;return make(path.dirname(pth)).then(()=>make(pth))}return stat(pth).then(stats=>stats.isDirectory()?pth:Promise.reject()).catch(()=>{throw err})});return make(path.resolve(input))});module.exports.sync=(input,opts)=>{checkPath(input),opts=Object.assign({},defaults,opts);let make=pth=>{try{opts.fs.mkdirSync(pth,opts.mode)}catch(err){if(err.code==="ENOENT"){if(err.message.includes("null bytes")||path.dirname(pth)===pth)throw err;return make(path.dirname(pth)),make(pth)}try{if(!opts.fs.statSync(pth).isDirectory())throw new Error("The path is not a directory")}catch{throw err}}return pth};return make(path.resolve(input))}}});var require_detect_indent=__commonJS({"../../node_modules/.pnpm/detect-indent@5.0.0/node_modules/detect-indent/index.js"(exports,module){"use strict";var INDENT_RE=/^(?:( )+|\t+)/;function getMostUsed(indents){let result=0,maxUsed=0,maxWeight=0;for(let entry of indents){let key=entry[0],val=entry[1],u=val[0],w=val[1];(u>maxUsed||u===maxUsed&&w>maxWeight)&&(maxUsed=u,maxWeight=w,result=Number(key))}return result}module.exports=str=>{if(typeof str!="string")throw new TypeError("Expected a string");let tabs=0,spaces=0,prev=0,indents=new Map,current,isIndent;for(let line of str.split(/\n/g)){if(!line)continue;let indent2,matches=line.match(INDENT_RE);matches?(indent2=matches[0].length,matches[1]?spaces++:tabs++):indent2=0;let diff=indent2-prev;prev=indent2,diff?(isIndent=diff>0,current=indents.get(isIndent?diff:-diff),current?current[0]++:(current=[1,0],indents.set(diff,current))):current&&(current[1]+=Number(isIndent))}let amount=getMostUsed(indents),type,indent;return amount?spaces>=tabs?(type="space",indent=" ".repeat(amount)):(type="tab",indent=" ".repeat(amount)):(type=null,indent=""),{amount,type,indent}}}});var require_write_json_file=__commonJS({"../../node_modules/.pnpm/write-json-file@2.2.0/node_modules/write-json-file/index.js"(exports,module){"use strict";var path=__require("path"),fs=require_graceful_fs(),writeFileAtomic=require_write_file_atomic(),sortKeys=require_sort_keys(),makeDir=require_make_dir(),pify=require_pify(),detectIndent=require_detect_indent(),init=(fn,fp,data,opts)=>{if(!fp)throw new TypeError("Expected a filepath");if(data===void 0)throw new TypeError("Expected data to stringify");return opts=Object.assign({indent:" ",sortKeys:!1},opts),opts.sortKeys&&(data=sortKeys(data,{deep:!0,compare:typeof opts.sortKeys=="function"&&opts.sortKeys})),fn(fp,data,opts)},readFile=fp=>pify(fs.readFile)(fp,"utf8").catch(()=>{}),main=(fp,data,opts)=>(opts.detectIndent?readFile(fp):Promise.resolve()).then(str=>{let indent=str?detectIndent(str).indent:opts.indent,json=JSON.stringify(data,opts.replacer,indent);return pify(writeFileAtomic)(fp,`${json}
|
|
8
8
|
`,{mode:opts.mode})}),mainSync=(fp,data,opts)=>{let indent=opts.indent;if(opts.detectIndent)try{let file=fs.readFileSync(fp,"utf8");indent=detectIndent(file).indent}catch(err){if(err.code!=="ENOENT")throw err}let json=JSON.stringify(data,opts.replacer,indent);return writeFileAtomic.sync(fp,`${json}
|
|
9
9
|
`,{mode:opts.mode})};module.exports=(fp,data,opts)=>makeDir(path.dirname(fp),{fs}).then(()=>init(main,fp,data,opts));module.exports.sync=(fp,data,opts)=>{makeDir.sync(path.dirname(fp),{fs}),init(mainSync,fp,data,opts)}}});import{randomUUID as randomUUID2}from"node:crypto";import os from"node:os";var import_constants=__toESM(require_dist(),1),import_build_utils=__toESM(require_build_utils(),1);import{spawn}from"node:child_process";var import_load_json_file=__toESM(require_load_json_file(),1),import_write_json_file=__toESM(require_write_json_file(),1);import{randomUUID}from"node:crypto";import{mkdirSync,renameSync,rmSync,writeFileSync}from"node:fs";import{dirname}from"node:path";var DEFAULT_CLI_SESSION_INACTIVITY_TIMEOUT_MS=30*60*1e3,DEFAULT_CLI_SESSION_MAX_LIFETIME_MS=24*60*60*1e3;function isPersistedCliSession(value){if(!value||typeof value!="object")return!1;let session=value;return typeof session.id=="string"&&typeof session.createdAt=="number"&&Number.isFinite(session.createdAt)&&typeof session.lastSeenAt=="number"&&Number.isFinite(session.lastSeenAt)}function isPersistedCliDevice(value){return!value||typeof value!="object"?!1:typeof value.id=="string"}function readPersistedCliSession(filePath){try{let session=import_load_json_file.default.sync(filePath);return isPersistedCliSession(session)?session:null}catch{return null}}function writePersistedCliSession(filePath,session){let temporaryPath=`${filePath}.${process.pid}.${randomUUID()}.tmp`;try{mkdirSync(dirname(filePath),{recursive:!0}),writeFileSync(temporaryPath,`${JSON.stringify(session,null,2)}
|
|
10
10
|
`,{flag:"wx",mode:384}),renameSync(temporaryPath,filePath)}catch{}finally{try{rmSync(temporaryPath,{force:!0})}catch{}}}function readPersistedCliDevice(filePath){try{let device=import_load_json_file.default.sync(filePath);return isPersistedCliDevice(device)?device:null}catch{return null}}function writePersistedCliDevice(filePath,device){try{mkdirSync(dirname(filePath),{recursive:!0}),import_write_json_file.default.sync(filePath,device,{indent:2})}catch{}}function getOrCreatePersistedCliSession(opts){let now=opts.now?.()??Date.now(),inactivityTimeoutMs=opts.inactivityTimeoutMs??DEFAULT_CLI_SESSION_INACTIVITY_TIMEOUT_MS,maxLifetimeMs=opts.maxLifetimeMs??DEFAULT_CLI_SESSION_MAX_LIFETIME_MS,existing=readPersistedCliSession(opts.filePath),session=existing&&now-existing.lastSeenAt<=inactivityTimeoutMs&&now-existing.createdAt<=maxLifetimeMs?{...existing,lastSeenAt:now}:{id:randomUUID(),createdAt:now,lastSeenAt:now};return writePersistedCliSession(opts.filePath,session),session}function touchPersistedCliSession(opts,session){let nextSession={...session,lastSeenAt:opts.now?.()??Date.now()};return writePersistedCliSession(opts.filePath,nextSession),nextSession}function getOrCreatePersistedCliDevice(opts){let existing=readPersistedCliDevice(opts.filePath);if(existing)return existing;let device={id:randomUUID()};return writePersistedCliDevice(opts.filePath,device),device}var LogLabel="['telemetry']:",MAX_ERROR_SERVER_MESSAGE_LENGTH=500,TelemetryClient=class{constructor({opts}){this.redactedValue="[REDACTED]";this.noValueToTriggerPrompt="[TRIGGER_PROMPT]";this.redactedArgumentsLength=args=>args&&args.length===1?"ONE":args.length>1?"MANY":"NONE";this.redactedTargetName=target=>import_constants.PROJECT_ENV_TARGET.includes(target)?target:this.redactedValue;this.isDebug=opts.isDebug||!1,this.store=opts.store}track(eventData){this.isDebug&&output_manager_default.debug(`${LogLabel} ${eventData.key}:${eventData.value}`);let event={id:randomUUID2(),eventTime:Date.now(),...eventData};this.store.add(event)}trackCliCommand(eventData){this.track({key:`command:${eventData.command}`,value:eventData.value})}trackCliSubcommand(eventData){this.track({key:`subcommand:${eventData.subcommand}`,value:eventData.value})}trackCliArgument(eventData){eventData.value&&this.track({key:`argument:${eventData.arg}`,value:eventData.value})}trackCliOption(eventData){this.track({key:`option:${eventData.option}`,value:eventData.value})}trackTargetEnvironment(targetEnvironment){this.track({key:"target_environment",value:targetEnvironment})}trackCommandOutput(eventData){this.track({key:`output:${eventData.key}`,value:eventData.value})}trackCliFlag(flag){this.track({key:`flag:${flag}`,value:"TRUE"})}trackOidcTokenRefresh(count){this.track({key:"oidc-token-refresh",value:`${count}`})}trackCPUs(){this.track({key:"cpu_count",value:String(os.cpus().length)})}trackAgenticUse(agent){agent&&this.track({key:"agent",value:agent})}trackPlatform(){this.track({key:"platform",value:os.platform()})}trackArch(){this.track({key:"arch",value:os.arch()})}trackCI(ciVendorName){ciVendorName&&this.track({key:"ci",value:ciVendorName})}trackStdinIsTTY(isTTY){this.track({key:"stdin_is_tty",value:isTTY?"true":"false"})}trackVersion(version){version&&this.track({key:"version",value:version})}trackDefaultDeploy(){this.track({key:"default-deploy",value:"TRUE"})}trackProjectId(projectId){projectId&&this.track({key:"project_id",value:projectId})}trackInvocationId(invocationId){invocationId&&this.track({key:"invocation_id",value:invocationId})}trackDeviceId(deviceId){deviceId&&this.track({key:"device_id",value:deviceId})}trackVercelPluginActiveSession(){this.track({key:"vercel_plugin_active_session",value:"TRUE"})}trackVercelPluginVersion(version){version&&this.track({key:"vercel_plugin_version",value:version})}trackErrorStatus(status){typeof status<"u"&&this.track({key:"error_status",value:String(status)})}trackErrorCode(code){code&&this.track({key:"error_code",value:code})}trackErrorSlug(slug){slug&&this.track({key:"error_slug",value:slug})}trackErrorAction(action){action&&this.track({key:"error_action",value:action})}trackErrorServerMessage(serverMessage){if(serverMessage){let normalizedServerMessage=serverMessage.trim().replace(/\s+/g," ");this.track({key:"error_server_message",value:normalizedServerMessage.slice(0,MAX_ERROR_SERVER_MESSAGE_LENGTH)})}}trackExtension(){this.track({key:"extension",value:this.redactedValue})}trackLoginState(state){state==="started"&&(this.loginAttempt=randomUUID2()),this.loginAttempt&&this.track({key:`login:attempt:${this.loginAttempt}`,value:state}),state!=="started"&&(this.loginAttempt=void 0)}trackCliFlagHelp(command,subcommands){let subcommand;subcommands&&(subcommand=Array.isArray(subcommands)?subcommands[0]:subcommands),this.track({key:"flag:help",value:subcommand?`${command}:${subcommand}`:command})}trackCliOptionFormat(format){if(format){let allowedFormat=["json"].includes(format)?format:this.redactedValue;this.trackCliOption({option:"format",value:allowedFormat})}}trackCliOptionProject(value){value&&(Array.isArray(value)&&value.length===0||this.trackCliOption({option:"project",value:this.redactedValue}))}},TelemetryEventStore=class{constructor(opts){this.teamId="NO_TEAM_ID";this.userId="NO_USER_ID";this.projectId="NO_PROJECT_ID";this.isDebug=opts?.isDebug||!1,this.events=[],this.config=opts?.config,this.cliDeviceOptions=opts?.cliDevice,this.cliSessionOptions=opts?.cliSession,this.invocationId=randomUUID2(),this.deviceId=randomUUID2(),this.cliDeviceOptions&&(this.cliDevice=getOrCreatePersistedCliDevice(this.cliDeviceOptions),this.deviceId=this.cliDevice.id),this.cliSessionOptions?(this.cliSession=getOrCreatePersistedCliSession(this.cliSessionOptions),this.sessionId=this.cliSession.id):this.sessionId=randomUUID2()}add(event){event.sessionId=this.sessionId,event.invocationId=this.invocationId,event.teamId=this.teamId,event.userId=this.userId,event.projectId=this.projectId,this.events.push(event)}updateTeamId(teamId){teamId&&(this.teamId=teamId)}updateUserId(userId){userId&&(this.userId=userId)}updateProjectId(projectId){projectId&&(this.projectId=projectId)}get hasUserId(){return this.userId!=="NO_USER_ID"}get currentProjectId(){return this.projectId}get currentInvocationId(){return this.invocationId}get currentDeviceId(){return this.deviceId}get currentSessionId(){return this.sessionId}get readonlyEvents(){return Array.from(this.events)}reset(){this.events=[]}get enabled(){return process.env.VERCEL_TELEMETRY_DISABLED?!1:this.config?.enabled??!0}async save(){if(this.cliSession&&this.cliSessionOptions&&(this.cliSession=touchPersistedCliSession(this.cliSessionOptions,this.cliSession)),this.isDebug){output_manager_default.log(`${LogLabel} Flushing Events`);for(let event of this.events)event.teamId=this.teamId,event.userId=this.userId,event.projectId=this.projectId,output_manager_default.log(JSON.stringify(event));return}if(this.enabled){let sessionId=this.events[0]?.sessionId;if(!sessionId){output_manager_default.debug("Unable to send metrics: no session ID");return}let events=this.events.map(event=>{let{eventTime,invocationId,...rest}=event;return delete rest.sessionId,delete rest.teamId,delete rest.userId,delete rest.projectId,{event_time:eventTime,invocation_id:invocationId,team_id:this.teamId,user_id:this.userId,project_id:this.projectId,...rest}}),payload={invocationId:this.invocationId,headers:{"Client-id":"vercel-cli","x-vercel-cli-topic-id":"generic","x-vercel-cli-session-id":sessionId},body:events};await this.sendToSubprocess(payload,output_manager_default.debugEnabled)}}async sendToSubprocess(payload,outputDebugEnabled){let flushArgs=["telemetry","flush",JSON.stringify(payload)],nodeBinaryPath,script;if(isNativeBinaryInstall())nodeBinaryPath=process.execPath,script=flushArgs;else{let args=[process.execPath,process.argv[0],process.argv[1]];args[0]===args[1]&&args.shift(),nodeBinaryPath=args[0],script=[...args.slice(1),...flushArgs]}let env=(0,import_build_utils.cloneEnv)(process.env,{VERCEL_TELEMETRY_DISABLED:"1"});if(outputDebugEnabled)return new Promise(resolve=>{let childProcess=spawn(nodeBinaryPath,script,{env,stdio:["ignore","pipe","pipe"]});childProcess.stderr.on("data",data=>output_manager_default.debug(data.toString())),childProcess.stdout.on("data",data=>output_manager_default.debug(data.toString())),childProcess.on("error",d=>{output_manager_default.debug(d)});let timeout=setTimeout(()=>{output_manager_default.debug("Telemetry subprocess killed due to timeout"),childProcess.kill()},2e3);childProcess.on("exit",code=>{output_manager_default.debug(`Telemetry subprocess exited with code ${code}`),childProcess.unref(),timeout.unref(),resolve()})});spawn(nodeBinaryPath,script,{stdio:"ignore",env,windowsHide:!0,detached:!0}).unref()}};export{require_dist,TelemetryClient,TelemetryEventStore};
|
|
@@ -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{getUpdateCommandInfo,getUpgradePackageManager,isGlobal,trustedUpgradeDirectory,trustedUpgradeEnvironment}from"./chunk-QLJ72TJJ.js";import{require_semver}from"./chunk-KKS7XWEX.js";import{progress}from"./chunk-U56NHYAH.js";import{require_ci_info}from"./chunk-T52FMXWC.js";import{require_chownr,require_mkdirp,require_pump,require_tar_stream}from"./chunk-V6MR45PD.js";import{param}from"./chunk-SXUEGVWB.js";import{writeToConfigFile}from"./chunk-DBDWXNAR.js";import{getInstallRoot,isNativeBinaryInstall}from"./chunk-7T6TL3GQ.js";import{fetch,toNodeReadable}from"./chunk-MY4MONOH.js";import{buildCorrectedCommand,suggestCorrection}from"./chunk-PTUZ7ATN.js";import{require_lib}from"./chunk-LOD56FYJ.js";import{require_strip_ansi}from"./chunk-OSCCYU74.js";import{shouldEmitNonInteractiveCommandError,writeAgentError}from"./chunk-WVUD3JPC.js";import{getFlagsSpecification}from"./chunk-ROOWZCAB.js";import{output_manager_default}from"./chunk-EWWFNMPZ.js";import{pkg_default}from"./chunk-AVSPFBLM.js";import{require_source}from"./chunk-U7KCDTCH.js";import{__commonJS,__require,__toESM}from"./chunk-6L236MNA.js";var require_jaro_winkler=__commonJS({"../../node_modules/.pnpm/jaro-winkler@0.2.8/node_modules/jaro-winkler/index.js"(exports,module){(function(root){"use strict";function extend(a,b){for(var property in b)b.hasOwnProperty(property)&&(a[property]=b[property]);return a}function distance2(s1,s2,options){var m=0,defaults={caseSensitive:!0},settings=extend(defaults,options),i,j;if(s1.length===0||s2.length===0)return 0;if(settings.caseSensitive||(s1=s1.toUpperCase(),s2=s2.toUpperCase()),s1===s2)return 1;var range=Math.floor(Math.max(s1.length,s2.length)/2)-1,s1Matches=new Array(s1.length),s2Matches=new Array(s2.length);for(i=0;i<s1.length;i++){var low=i>=range?i-range:0,high=i+range<=s2.length-1?i+range:s2.length-1;for(j=low;j<=high;j++)if(s1Matches[i]!==!0&&s2Matches[j]!==!0&&s1[i]===s2[j]){++m,s1Matches[i]=s2Matches[j]=!0;break}}if(m===0)return 0;var k=0,numTrans=0;for(i=0;i<s1.length;i++)if(s1Matches[i]===!0){for(j=k;j<s2.length;j++)if(s2Matches[j]===!0){k=j+1;break}s1[i]!==s2[j]&&++numTrans}var weight=(m/s1.length+m/s2.length+(m-numTrans/2)/m)/3,l=0,p=.1;if(weight>.7){for(;s1[l]===s2[l]&&l<4;)++l;weight=weight+l*p*(1-weight)}return weight}typeof define=="function"&&define.amd?define([],function(){return distance2}):typeof exports=="object"?module.exports=distance2:root.distance=distance2})(exports)}});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}});var require_tar_fs=__commonJS({"../../node_modules/.pnpm/tar-fs@1.16.5/node_modules/tar-fs/index.js"(exports){var chownr=require_chownr(),tar2=require_tar_stream(),pump=require_pump(),mkdirp=require_mkdirp(),fs=__require("fs"),path=__require("path"),os=__require("os"),win32=os.platform()==="win32",noop=function(){},echo=function(name){return name},normalize=win32?function(name){return name.replace(/\\/g,"/").replace(/[:?<>|]/g,"_")}:echo,statAll=function(fs2,stat3,cwd,ignore,entries,sort){var queue=entries||["."];return function(callback){if(!queue.length)return callback();var next=queue.shift(),nextAbs=path.join(cwd,next);stat3(nextAbs,function(err,stat4){if(err)return callback(err);if(!stat4.isDirectory())return callback(null,next,stat4);fs2.readdir(nextAbs,function(err2,files){if(err2)return callback(err2);sort&&files.sort();for(var i=0;i<files.length;i++)ignore(path.join(cwd,next,files[i]))||queue.push(path.join(next,files[i]));callback(null,next,stat4)})})}},strip=function(map,level){return function(header){header.name=header.name.split("/").slice(level).join("/");var linkname=header.linkname;return linkname&&(header.type==="link"||path.isAbsolute(linkname))&&(header.linkname=linkname.split("/").slice(level).join("/")),map(header)}};exports.pack=function(cwd,opts){cwd||(cwd="."),opts||(opts={});var xfs=opts.fs||fs,ignore=opts.ignore||opts.filter||noop,map=opts.map||noop,mapStream=opts.mapStream||echo,statNext=statAll(xfs,opts.dereference?xfs.stat:xfs.lstat,cwd,ignore,opts.entries,opts.sort),strict=opts.strict!==!1,umask=typeof opts.umask=="number"?~opts.umask:~processUmask(),dmode=typeof opts.dmode=="number"?opts.dmode:0,fmode=typeof opts.fmode=="number"?opts.fmode:0,pack=opts.pack||tar2.pack(),finish=opts.finish||noop;opts.strip&&(map=strip(map,opts.strip)),opts.readable&&(dmode|=parseInt(555,8),fmode|=parseInt(444,8)),opts.writable&&(dmode|=parseInt(333,8),fmode|=parseInt(222,8));var onsymlink=function(filename,header){xfs.readlink(path.join(cwd,filename),function(err,linkname){if(err)return pack.destroy(err);header.linkname=normalize(linkname),pack.entry(header,onnextentry)})},onstat=function(err,filename,stat3){if(err)return pack.destroy(err);if(!filename)return opts.finalize!==!1&&pack.finalize(),finish(pack);if(stat3.isSocket())return onnextentry();var header={name:normalize(filename),mode:(stat3.mode|(stat3.isDirectory()?dmode:fmode))&umask,mtime:stat3.mtime,size:stat3.size,type:"file",uid:stat3.uid,gid:stat3.gid};if(stat3.isDirectory())return header.size=0,header.type="directory",header=map(header)||header,pack.entry(header,onnextentry);if(stat3.isSymbolicLink())return header.size=0,header.type="symlink",header=map(header)||header,onsymlink(filename,header);if(header=map(header)||header,!stat3.isFile())return strict?pack.destroy(new Error("unsupported type for "+filename)):onnextentry();var entry=pack.entry(header,onnextentry);if(entry){var rs=mapStream(xfs.createReadStream(path.join(cwd,filename)),header);rs.on("error",function(err2){entry.destroy(err2)}),pump(rs,entry)}},onnextentry=function(err){if(err)return pack.destroy(err);statNext(onstat)};return onnextentry(),pack};var head=function(list){return list.length?list[list.length-1]:null},processGetuid=function(){return process.getuid?process.getuid():-1},processUmask=function(){return process.umask?process.umask():0};exports.extract=function(cwd,opts){cwd||(cwd="."),opts||(opts={});var xfs=opts.fs||fs,ignore=opts.ignore||opts.filter||noop,map=opts.map||noop,mapStream=opts.mapStream||echo,own=opts.chown!==!1&&!win32&&processGetuid()===0,extract=opts.extract||tar2.extract(),stack=[],now=new Date,umask=typeof opts.umask=="number"?~opts.umask:~processUmask(),dmode=typeof opts.dmode=="number"?opts.dmode:0,fmode=typeof opts.fmode=="number"?opts.fmode:0,strict=opts.strict!==!1;opts.strip&&(map=strip(map,opts.strip)),opts.readable&&(dmode|=parseInt(555,8),fmode|=parseInt(444,8)),opts.writable&&(dmode|=parseInt(333,8),fmode|=parseInt(222,8));var utimesParent=function(name,cb){for(var top;(top=head(stack))&&name.slice(0,top[0].length)!==top[0];)stack.pop();if(!top)return cb();xfs.utimes(top[0],now,top[1],cb)},utimes=function(name,header,cb){if(opts.utimes===!1)return cb();if(header.type==="directory")return xfs.utimes(name,now,header.mtime,cb);if(header.type==="symlink")return utimesParent(name,cb);xfs.utimes(name,now,header.mtime,function(err){if(err)return cb(err);utimesParent(name,cb)})},chperm=function(name,header,cb){var link2=header.type==="symlink",chmod2=link2?xfs.lchmod:xfs.chmod,chown=link2?xfs.lchown:xfs.chown;if(!chmod2)return cb();var mode=(header.mode|(header.type==="directory"?dmode:fmode))&umask;chmod2(name,mode,function(err){if(err)return cb(err);if(!own||!chown)return cb();chown(name,header.uid,header.gid,cb)})};return extract.on("entry",function(header,stream,next){header=map(header)||header,header.name=normalize(header.name);var name=path.join(cwd,path.join("/",header.name));if(ignore(name,header))return stream.resume(),next();var stat3=function(err){if(err)return next(err);utimes(name,header,function(err2){if(err2)return next(err2);if(win32)return next();chperm(name,header,next)})},onsymlink=function(){if(win32)return next();xfs.unlink(name,function(){var dst=path.resolve(path.dirname(name),header.linkname);if(!dst.startsWith(path.resolve(cwd)))return next(new Error(name+" is not a valid symlink"));xfs.symlink(header.linkname,name,stat3)})},onlink=function(){if(win32)return next();xfs.unlink(name,function(){var srcpath=path.join(cwd,path.join("/",header.linkname));xfs.realpath(srcpath,function(err,dst){if(err||!dst.startsWith(path.resolve(cwd)))return next(new Error(name+" is not a valid hardlink"));xfs.link(dst,name,function(err2){if(err2&&err2.code==="EPERM"&&opts.hardlinkAsFilesFallback)return stream=xfs.createReadStream(srcpath),onfile();stat3(err2)})})})},onfile=function(){var ws=xfs.createWriteStream(name),rs=mapStream(stream,header);ws.on("error",function(err){rs.destroy(err)}),pump(rs,ws,function(err){if(err)return next(err);ws.on("close",stat3)})};if(header.type==="directory")return stack.push([name,header.mtime]),mkdirfix(name,{fs:xfs,own,uid:header.uid,gid:header.gid},stat3);var dir=path.dirname(name);validate(xfs,dir,path.join(cwd,"."),function(err,valid){if(err)return next(err);if(!valid)return next(new Error(dir+" is not a valid path"));mkdirfix(dir,{fs:xfs,own,uid:header.uid,gid:header.gid},function(err2){if(err2)return next(err2);switch(header.type){case"file":return onfile();case"link":return onlink();case"symlink":return onsymlink()}if(strict)return next(new Error("unsupported type for "+name+" ("+header.type+")"));stream.resume(),next()})})}),opts.finish&&extract.on("finish",opts.finish),extract};function validate(fs2,name,root,cb){if(name===root)return cb(null,!0);fs2.lstat(name,function(err,st){if(err&&err.code!=="ENOENT")return cb(err);if(err||st.isDirectory())return validate(fs2,path.join(name,".."),root,cb);cb(null,!1)})}function mkdirfix(name,opts,cb){mkdirp(name,{fs:opts.fs},function(err,made){!err&&made&&opts.own?chownr(made,opts.uid,opts.gid,cb):cb(err)})}}});var import_jaro_winkler=__toESM(require_jaro_winkler(),1),did_you_mean_default=didYouMean;function didYouMean(input,list,threshold=.5){let found=list.map(item=>[dashAwareDistance(input,item),item]).filter(item=>item[0]>threshold);if(found.length)return found.reduce((accu,curr)=>accu[0]>curr[0]?accu:curr)[1]}function dashAwareDistance(word,dashWord){let fullDistance=(0,import_jaro_winkler.default)(word,dashWord),distances=dashWord.split("-").map(w=>(0,import_jaro_winkler.default)(w,word)),meanDistance=distances.reduce((accu,curr)=>accu+curr)/distances.length;return fullDistance>meanDistance?fullDistance:meanDistance}function handleCommandTypo({command,availableCommands,threshold=.7,client}){if(!command||command.startsWith("-"))return!1;let visibleCommands=availableCommands.filter(command2=>!command2.hidden),commandNames=visibleCommands.flatMap(({name,aliases})=>[name,...aliases]),correction=suggestCorrection(command,commandNames),suggestion=correction??did_you_mean_default(command,commandNames,threshold);if(suggestion){if(client){let definition=visibleCommands.find(candidate=>candidate.name===correction||candidate.aliases.some(alias=>alias===correction)),corrected=correction?buildCorrectedCommand(client.argv,command,correction,getFlagsSpecification(definition?.options??[])):void 0,payload={status:"error",reason:"unknown_command",message:`Unknown command "${command}". Did you mean "${suggestion}"?`,hint:corrected?"Use the suggested command after replacing any placeholders with the intended values.":`Accepted commands: ${commandNames.join(", ")}.`,...corrected&&{next:[{command:corrected,when:"Run the corrected command; replace any placeholders first"}]}};return shouldEmitNonInteractiveCommandError(client)?writeAgentError(client,payload):(output_manager_default.fatal(payload.message),output_manager_default.print(` ${corrected??payload.hint}
|
|
7
|
+
import{getUpdateCommandInfo,getUpgradePackageManager,isGlobal,trustedUpgradeDirectory,trustedUpgradeEnvironment}from"./chunk-MHKDLJEI.js";import{require_semver}from"./chunk-KKS7XWEX.js";import{progress}from"./chunk-U56NHYAH.js";import{require_ci_info}from"./chunk-T52FMXWC.js";import{require_chownr,require_mkdirp,require_pump,require_tar_stream}from"./chunk-NNP5NITU.js";import{param}from"./chunk-SXUEGVWB.js";import{shouldEmitNonInteractiveCommandError,writeAgentError}from"./chunk-EJNFKH6Y.js";import{require_strip_ansi}from"./chunk-OSCCYU74.js";import{writeToConfigFile}from"./chunk-GXNSAACA.js";import{getInstallRoot,isNativeBinaryInstall}from"./chunk-7T6TL3GQ.js";import{fetch,toNodeReadable}from"./chunk-MY4MONOH.js";import{buildCorrectedCommand,suggestCorrection}from"./chunk-MQW6DKD2.js";import{getFlagsSpecification}from"./chunk-5IPBCD7K.js";import{require_lib}from"./chunk-QMTPSHRV.js";import{output_manager_default}from"./chunk-MR423MWE.js";import{pkg_default}from"./chunk-AVSPFBLM.js";import{require_source}from"./chunk-U7KCDTCH.js";import{__commonJS,__require,__toESM}from"./chunk-6L236MNA.js";var require_jaro_winkler=__commonJS({"../../node_modules/.pnpm/jaro-winkler@0.2.8/node_modules/jaro-winkler/index.js"(exports,module){(function(root){"use strict";function extend(a,b){for(var property in b)b.hasOwnProperty(property)&&(a[property]=b[property]);return a}function distance2(s1,s2,options){var m=0,defaults={caseSensitive:!0},settings=extend(defaults,options),i,j;if(s1.length===0||s2.length===0)return 0;if(settings.caseSensitive||(s1=s1.toUpperCase(),s2=s2.toUpperCase()),s1===s2)return 1;var range=Math.floor(Math.max(s1.length,s2.length)/2)-1,s1Matches=new Array(s1.length),s2Matches=new Array(s2.length);for(i=0;i<s1.length;i++){var low=i>=range?i-range:0,high=i+range<=s2.length-1?i+range:s2.length-1;for(j=low;j<=high;j++)if(s1Matches[i]!==!0&&s2Matches[j]!==!0&&s1[i]===s2[j]){++m,s1Matches[i]=s2Matches[j]=!0;break}}if(m===0)return 0;var k=0,numTrans=0;for(i=0;i<s1.length;i++)if(s1Matches[i]===!0){for(j=k;j<s2.length;j++)if(s2Matches[j]===!0){k=j+1;break}s1[i]!==s2[j]&&++numTrans}var weight=(m/s1.length+m/s2.length+(m-numTrans/2)/m)/3,l=0,p=.1;if(weight>.7){for(;s1[l]===s2[l]&&l<4;)++l;weight=weight+l*p*(1-weight)}return weight}typeof define=="function"&&define.amd?define([],function(){return distance2}):typeof exports=="object"?module.exports=distance2:root.distance=distance2})(exports)}});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}});var require_tar_fs=__commonJS({"../../node_modules/.pnpm/tar-fs@1.16.5/node_modules/tar-fs/index.js"(exports){var chownr=require_chownr(),tar2=require_tar_stream(),pump=require_pump(),mkdirp=require_mkdirp(),fs=__require("fs"),path=__require("path"),os=__require("os"),win32=os.platform()==="win32",noop=function(){},echo=function(name){return name},normalize=win32?function(name){return name.replace(/\\/g,"/").replace(/[:?<>|]/g,"_")}:echo,statAll=function(fs2,stat3,cwd,ignore,entries,sort){var queue=entries||["."];return function(callback){if(!queue.length)return callback();var next=queue.shift(),nextAbs=path.join(cwd,next);stat3(nextAbs,function(err,stat4){if(err)return callback(err);if(!stat4.isDirectory())return callback(null,next,stat4);fs2.readdir(nextAbs,function(err2,files){if(err2)return callback(err2);sort&&files.sort();for(var i=0;i<files.length;i++)ignore(path.join(cwd,next,files[i]))||queue.push(path.join(next,files[i]));callback(null,next,stat4)})})}},strip=function(map,level){return function(header){header.name=header.name.split("/").slice(level).join("/");var linkname=header.linkname;return linkname&&(header.type==="link"||path.isAbsolute(linkname))&&(header.linkname=linkname.split("/").slice(level).join("/")),map(header)}};exports.pack=function(cwd,opts){cwd||(cwd="."),opts||(opts={});var xfs=opts.fs||fs,ignore=opts.ignore||opts.filter||noop,map=opts.map||noop,mapStream=opts.mapStream||echo,statNext=statAll(xfs,opts.dereference?xfs.stat:xfs.lstat,cwd,ignore,opts.entries,opts.sort),strict=opts.strict!==!1,umask=typeof opts.umask=="number"?~opts.umask:~processUmask(),dmode=typeof opts.dmode=="number"?opts.dmode:0,fmode=typeof opts.fmode=="number"?opts.fmode:0,pack=opts.pack||tar2.pack(),finish=opts.finish||noop;opts.strip&&(map=strip(map,opts.strip)),opts.readable&&(dmode|=parseInt(555,8),fmode|=parseInt(444,8)),opts.writable&&(dmode|=parseInt(333,8),fmode|=parseInt(222,8));var onsymlink=function(filename,header){xfs.readlink(path.join(cwd,filename),function(err,linkname){if(err)return pack.destroy(err);header.linkname=normalize(linkname),pack.entry(header,onnextentry)})},onstat=function(err,filename,stat3){if(err)return pack.destroy(err);if(!filename)return opts.finalize!==!1&&pack.finalize(),finish(pack);if(stat3.isSocket())return onnextentry();var header={name:normalize(filename),mode:(stat3.mode|(stat3.isDirectory()?dmode:fmode))&umask,mtime:stat3.mtime,size:stat3.size,type:"file",uid:stat3.uid,gid:stat3.gid};if(stat3.isDirectory())return header.size=0,header.type="directory",header=map(header)||header,pack.entry(header,onnextentry);if(stat3.isSymbolicLink())return header.size=0,header.type="symlink",header=map(header)||header,onsymlink(filename,header);if(header=map(header)||header,!stat3.isFile())return strict?pack.destroy(new Error("unsupported type for "+filename)):onnextentry();var entry=pack.entry(header,onnextentry);if(entry){var rs=mapStream(xfs.createReadStream(path.join(cwd,filename)),header);rs.on("error",function(err2){entry.destroy(err2)}),pump(rs,entry)}},onnextentry=function(err){if(err)return pack.destroy(err);statNext(onstat)};return onnextentry(),pack};var head=function(list){return list.length?list[list.length-1]:null},processGetuid=function(){return process.getuid?process.getuid():-1},processUmask=function(){return process.umask?process.umask():0};exports.extract=function(cwd,opts){cwd||(cwd="."),opts||(opts={});var xfs=opts.fs||fs,ignore=opts.ignore||opts.filter||noop,map=opts.map||noop,mapStream=opts.mapStream||echo,own=opts.chown!==!1&&!win32&&processGetuid()===0,extract=opts.extract||tar2.extract(),stack=[],now=new Date,umask=typeof opts.umask=="number"?~opts.umask:~processUmask(),dmode=typeof opts.dmode=="number"?opts.dmode:0,fmode=typeof opts.fmode=="number"?opts.fmode:0,strict=opts.strict!==!1;opts.strip&&(map=strip(map,opts.strip)),opts.readable&&(dmode|=parseInt(555,8),fmode|=parseInt(444,8)),opts.writable&&(dmode|=parseInt(333,8),fmode|=parseInt(222,8));var utimesParent=function(name,cb){for(var top;(top=head(stack))&&name.slice(0,top[0].length)!==top[0];)stack.pop();if(!top)return cb();xfs.utimes(top[0],now,top[1],cb)},utimes=function(name,header,cb){if(opts.utimes===!1)return cb();if(header.type==="directory")return xfs.utimes(name,now,header.mtime,cb);if(header.type==="symlink")return utimesParent(name,cb);xfs.utimes(name,now,header.mtime,function(err){if(err)return cb(err);utimesParent(name,cb)})},chperm=function(name,header,cb){var link2=header.type==="symlink",chmod2=link2?xfs.lchmod:xfs.chmod,chown=link2?xfs.lchown:xfs.chown;if(!chmod2)return cb();var mode=(header.mode|(header.type==="directory"?dmode:fmode))&umask;chmod2(name,mode,function(err){if(err)return cb(err);if(!own||!chown)return cb();chown(name,header.uid,header.gid,cb)})};return extract.on("entry",function(header,stream,next){header=map(header)||header,header.name=normalize(header.name);var name=path.join(cwd,path.join("/",header.name));if(ignore(name,header))return stream.resume(),next();var stat3=function(err){if(err)return next(err);utimes(name,header,function(err2){if(err2)return next(err2);if(win32)return next();chperm(name,header,next)})},onsymlink=function(){if(win32)return next();xfs.unlink(name,function(){var dst=path.resolve(path.dirname(name),header.linkname);if(!dst.startsWith(path.resolve(cwd)))return next(new Error(name+" is not a valid symlink"));xfs.symlink(header.linkname,name,stat3)})},onlink=function(){if(win32)return next();xfs.unlink(name,function(){var srcpath=path.join(cwd,path.join("/",header.linkname));xfs.realpath(srcpath,function(err,dst){if(err||!dst.startsWith(path.resolve(cwd)))return next(new Error(name+" is not a valid hardlink"));xfs.link(dst,name,function(err2){if(err2&&err2.code==="EPERM"&&opts.hardlinkAsFilesFallback)return stream=xfs.createReadStream(srcpath),onfile();stat3(err2)})})})},onfile=function(){var ws=xfs.createWriteStream(name),rs=mapStream(stream,header);ws.on("error",function(err){rs.destroy(err)}),pump(rs,ws,function(err){if(err)return next(err);ws.on("close",stat3)})};if(header.type==="directory")return stack.push([name,header.mtime]),mkdirfix(name,{fs:xfs,own,uid:header.uid,gid:header.gid},stat3);var dir=path.dirname(name);validate(xfs,dir,path.join(cwd,"."),function(err,valid){if(err)return next(err);if(!valid)return next(new Error(dir+" is not a valid path"));mkdirfix(dir,{fs:xfs,own,uid:header.uid,gid:header.gid},function(err2){if(err2)return next(err2);switch(header.type){case"file":return onfile();case"link":return onlink();case"symlink":return onsymlink()}if(strict)return next(new Error("unsupported type for "+name+" ("+header.type+")"));stream.resume(),next()})})}),opts.finish&&extract.on("finish",opts.finish),extract};function validate(fs2,name,root,cb){if(name===root)return cb(null,!0);fs2.lstat(name,function(err,st){if(err&&err.code!=="ENOENT")return cb(err);if(err||st.isDirectory())return validate(fs2,path.join(name,".."),root,cb);cb(null,!1)})}function mkdirfix(name,opts,cb){mkdirp(name,{fs:opts.fs},function(err,made){!err&&made&&opts.own?chownr(made,opts.uid,opts.gid,cb):cb(err)})}}});var import_jaro_winkler=__toESM(require_jaro_winkler(),1),did_you_mean_default=didYouMean;function didYouMean(input,list,threshold=.5){let found=list.map(item=>[dashAwareDistance(input,item),item]).filter(item=>item[0]>threshold);if(found.length)return found.reduce((accu,curr)=>accu[0]>curr[0]?accu:curr)[1]}function dashAwareDistance(word,dashWord){let fullDistance=(0,import_jaro_winkler.default)(word,dashWord),distances=dashWord.split("-").map(w=>(0,import_jaro_winkler.default)(w,word)),meanDistance=distances.reduce((accu,curr)=>accu+curr)/distances.length;return fullDistance>meanDistance?fullDistance:meanDistance}function handleCommandTypo({command,availableCommands,threshold=.7,client}){if(!command||command.startsWith("-"))return!1;let visibleCommands=availableCommands.filter(command2=>!command2.hidden),commandNames=visibleCommands.flatMap(({name,aliases})=>[name,...aliases]),correction=suggestCorrection(command,commandNames),suggestion=correction??did_you_mean_default(command,commandNames,threshold);if(suggestion){if(client){let definition=visibleCommands.find(candidate=>candidate.name===correction||candidate.aliases.some(alias=>alias===correction)),corrected=correction?buildCorrectedCommand(client.argv,command,correction,getFlagsSpecification(definition?.options??[])):void 0,payload={status:"error",reason:"unknown_command",message:`Unknown command "${command}". Did you mean "${suggestion}"?`,hint:corrected?"Use the suggested command after replacing any placeholders with the intended values.":`Accepted commands: ${commandNames.join(", ")}.`,...corrected&&{next:[{command:corrected,when:"Run the corrected command; replace any placeholders first"}]}};return shouldEmitNonInteractiveCommandError(client)?writeAgentError(client,payload):(output_manager_default.fatal(payload.message),output_manager_default.print(` ${corrected??payload.hint}
|
|
8
8
|
`)),!0}return output_manager_default.error(`${param(command)} is not a valid target directory or subcommand. Did you mean ${param(suggestion)}?`),!0}return!1}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},(error,stdout)=>{if(error){reject(error);return}resolve3(stdout.toString())})})}function parseVersionOutput(stdout){for(let line of[stdout.trim(),...stdout.trim().split(`
|
|
9
9
|
`).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}
|
|
10
10
|
${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}},writeToConfigFile(client.config)}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,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}
|
|
@@ -4,7 +4,7 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{require_dist as require_dist2,validateConfig}from"./chunk-
|
|
7
|
+
import{require_dist as require_dist2,validateConfig}from"./chunk-SX64OM5A.js";import{require_dist2 as require_dist}from"./chunk-G3NHWIPJ.js";import{compileVercelConfig,findSourceVercelConfigFile}from"./chunk-D6JBONML.js";import{applyEdits,findNodeAtLocation,init_main,modify,parse,parseTree}from"./chunk-OI263FBO.js";import{printAlignedLabel}from"./chunk-QCOPZAUC.js";import{code}from"./chunk-4WS3D23J.js";import{link_default,output_manager_default,require_build_utils}from"./chunk-MR423MWE.js";import{require_source}from"./chunk-U7KCDTCH.js";import{__toESM}from"./chunk-6L236MNA.js";var import_chalk=__toESM(require_source(),1);init_main();var import_build_utils=__toESM(require_build_utils(),1),import_fs_detectors=__toESM(require_dist(),1),import_service_topology=__toESM(require_dist2(),1);import{readFile,writeFile}from"fs/promises";import{basename}from"path";import{stringify as tomlStringify}from"smol-toml";var EXPERIMENTAL_SERVICES_DOCS_URL="https://vercel.com/docs/services/experimental";async function prepareExperimentalServicesMigration(cwd,detectServicesResult){let compileResult=await compileVercelConfig(cwd);if(!compileResult.configPath)return null;let rawConfig=await readFile(compileResult.configPath,"utf8"),config=parse(rawConfig);if(!config||!(0,import_service_topology.hasLegacyServicesConfig)(config))return null;let resolvedServices=detectServicesResult?.resolved?.source==="configured"?detectServicesResult.services.filter(s=>(0,import_build_utils.isExperimentalService)(s)):void 0,plan=await(0,import_service_topology.migrateExperimentalServices)({fs:new import_fs_detectors.LocalFileSystemDetector(cwd),config,resolvedServices:resolvedServices&&resolvedServices.length>0?resolvedServices:void 0}),sourceFile=compileResult.sourceFile??basename(compileResult.configPath),preparation={plan,sourceFile,snippet:renderSnippet(sourceFile,plan)};if(plan.errors.length>0)return preparation;if(compileResult.wasCompiled)return preparation.writeBlocker=`${sourceFile} can't be updated automatically.`,preparation;let content=applyPlanToJson(rawConfig,config,plan),parseErrors=[],nextConfig=parse(content,parseErrors);if(parseErrors.length>0)return preparation.writeBlocker=`Couldn't produce a valid ${sourceFile}.`,preparation;let validationError=validateConfig(nextConfig);return validationError?(preparation.writeBlocker=validationError.message,preparation):(preparation.write={configPath:compileResult.configPath,content},preparation)}function applyPlanToJson(rawConfig,config,plan){let eol=rawConfig.includes(`\r
|
|
8
8
|
`)?`\r
|
|
9
9
|
`:`
|
|
10
10
|
`,indent2=/^([ \t]+)\S/m.exec(rawConfig)?.[1]??" ",formattingOptions={eol,insertSpaces:!indent2.startsWith(" "),tabSize:indent2.startsWith(" ")?1:indent2.length},legacyKey=config.experimentalServices?"experimentalServices":"experimentalServicesV2",key=findNodeAtLocation(parseTree(rawConfig),[legacyKey]).parent.children[0],text=applyEdits(rawConfig,[{offset:key.offset,length:key.length,content:'"services"'}]);text=applyEdits(text,modify(text,["services"],plan.patch.services,{formattingOptions}));for(let key2 of plan.removeKeys)key2!==legacyKey&&(text=applyEdits(text,modify(text,[key2],void 0,{formattingOptions})));for(let[key2,value]of Object.entries(plan.patch.build?.env??{}))text=applyEdits(text,modify(text,["build","env",key2],value,{formattingOptions}));if(plan.patch.rewrites.length>0)if(Array.isArray(config.rewrites))for(let rewrite of plan.patch.rewrites)text=applyEdits(text,modify(text,["rewrites",-1],rewrite,{formattingOptions}));else text=applyEdits(text,modify(text,["rewrites"],plan.patch.rewrites,{formattingOptions,getInsertionIndex:keys=>keys.indexOf("services")+1}));return text.endsWith(`
|
|
@@ -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{brotliDecompress}from"node:zlib";import{promisify}from"node:util";import{readFile}from"node:fs/promises";import{join}from"node:path";var decompress=promisify(brotliDecompress),embeddedGraphs,embeddedIndex,GRAPH_FILE="builder-graph.json.br",INDEX_FILE="builder-index.json";function defaultAssetPaths(file){return[join(__dirname,file),join(__dirname,"..","builders",file)]}async function readDefaultAsset(file){let lastError;for(let path of defaultAssetPaths(file))try{return await readFile(path)}catch(error){lastError=error}throw lastError}function loadEmbeddedBuilderGraphs(readGraph=()=>readDefaultAsset(GRAPH_FILE)){return embeddedGraphs??=(async()=>{try{let compressed=await readGraph(),graphs=JSON.parse((await decompress(new Uint8Array(compressed))).toString("utf8"));if(graphs.schemaVersion!==1||!graphs.builders||typeof graphs.builders!="object")throw new Error("invalid schema");return graphs}catch(error){throw embeddedGraphs=void 0,new Error("Could not load the embedded vlt Builder graphs.",{cause:error})}})(),embeddedGraphs}function createBuilderIndex(graphs){return{schemaVersion:1,builders:Object.fromEntries(Object.entries(graphs.builders??{}).map(([name,{hash,version}])=>[name,{hash,version}]))}}function loadEmbeddedBuilderIndex(readIndex=()=>readDefaultAsset(INDEX_FILE),loadGraphs=loadEmbeddedBuilderGraphs){return embeddedIndex??=(async()=>{let raw;try{raw=await readIndex()}catch(error){if(error?.code!=="ENOENT")throw embeddedIndex=void 0,new Error("Could not load the embedded vlt Builder index.",{cause:error});try{return createBuilderIndex(await loadGraphs())}catch(graphError){throw embeddedIndex=void 0,graphError}}try{let index=JSON.parse(raw.toString("utf8"));if(index.schemaVersion!==1||!index.builders||typeof index.builders!="object")throw new Error("invalid schema");return index}catch(error){throw embeddedIndex=void 0,new Error("Could not load the embedded vlt Builder index.",{cause:error})}})(),embeddedIndex}export{loadEmbeddedBuilderGraphs,createBuilderIndex,loadEmbeddedBuilderIndex};
|