vercel 59.19.1 → 59.22.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-SKKI525V.js → add-4XDHZES6.js} +1 -1
- package/dist/chunks/{add-EM223ILV.js → add-DTHT6FBK.js} +1 -1
- package/dist/chunks/{add-G5SYPCB4.js → add-ZQXW2ONT.js} +1 -1
- package/dist/chunks/{build-JEZ2ELHZ.js → build-JORIG5OD.js} +1 -1
- package/dist/chunks/chunk-2EY7NJ5E.js +9 -0
- package/dist/chunks/{chunk-KU32YRCG.js → chunk-2U7K4KDF.js} +1 -1
- package/dist/chunks/{chunk-GWPIATTW.js → chunk-3GUBYJN6.js} +1 -1
- package/dist/chunks/{chunk-VRBSHDYH.js → chunk-3RLCABDN.js} +1 -1
- package/dist/chunks/{chunk-XPTHZQSQ.js → chunk-3VRLKRIC.js} +1 -1
- package/dist/chunks/{chunk-IERVS47L.js → chunk-4WSAOLBH.js} +1 -1
- package/dist/chunks/{chunk-MIGWUMB3.js → chunk-5LCQGGTH.js} +1 -1
- package/dist/chunks/{chunk-DLKR2CG6.js → chunk-6BZCSVH6.js} +1 -1
- package/dist/chunks/{chunk-U6TAKLJ6.js → chunk-6LE3FU2P.js} +1 -1
- package/dist/chunks/{chunk-IH2HZFLM.js → chunk-6LE44WCK.js} +1 -1
- package/dist/chunks/{chunk-RVJ2E3BM.js → chunk-6OI6SRHZ.js} +1 -1
- package/dist/chunks/{chunk-MBHVWCFE.js → chunk-77GUJ4JC.js} +1 -1
- package/dist/chunks/{chunk-PNRWNSM2.js → chunk-7B5NNJ2P.js} +1 -1
- package/dist/chunks/{chunk-NLQNFWX2.js → chunk-7JMXZGXY.js} +1 -1
- package/dist/chunks/{chunk-QYPQGOSO.js → chunk-7XSHE5SA.js} +1 -1
- package/dist/chunks/{chunk-W2XUH2WW.js → chunk-A5VLP25I.js} +1 -1
- package/dist/chunks/chunk-AZ6NRDHG.js +7 -0
- package/dist/chunks/{chunk-GCHDJ44X.js → chunk-B7FOQCPU.js} +1 -1
- package/dist/chunks/{chunk-33FG2PIV.js → chunk-BSOZ3UP2.js} +1 -1
- package/dist/chunks/{chunk-WR5OOWD6.js → chunk-BX5KDMLT.js} +1 -1
- package/dist/chunks/{chunk-3FMJYJUR.js → chunk-CGXXEPYI.js} +2 -0
- package/dist/chunks/{chunk-OROPHBHW.js → chunk-CKX6OH4B.js} +1 -1
- package/dist/chunks/{chunk-FUK2JEKI.js → chunk-CLKTBUI7.js} +1 -1
- package/dist/chunks/{chunk-EGG7SPNM.js → chunk-DQ2KI6FO.js} +1 -1
- package/dist/chunks/chunk-EQP3SW72.js +7 -0
- package/dist/chunks/{chunk-RTRCTYW6.js → chunk-EWWFNMPZ.js} +4 -3
- package/dist/chunks/{chunk-XZYKYDQO.js → chunk-EYXFDREA.js} +1 -1
- package/dist/chunks/{chunk-ZVFZIWBV.js → chunk-FA6O7FPC.js} +1 -1
- package/dist/chunks/{chunk-F5HAX74T.js → chunk-FYSA677K.js} +4 -4
- package/dist/chunks/{chunk-E4CRGS56.js → chunk-GHULCYAR.js} +1 -1
- package/dist/chunks/{chunk-LASMHNUP.js → chunk-GJTA7DJO.js} +1 -1
- package/dist/chunks/{chunk-B7XCF45C.js → chunk-GPX6W4GB.js} +1 -1
- package/dist/chunks/{chunk-ZOI3EEL3.js → chunk-GQQKAFGS.js} +1 -1
- package/dist/chunks/{chunk-HBF4YJR2.js → chunk-GRDPI246.js} +1 -1
- package/dist/chunks/{chunk-Q2Z6EXCT.js → chunk-GTJ2OLYI.js} +1 -1
- package/dist/chunks/{chunk-7O3KGTQ3.js → chunk-HWWHR7H3.js} +1 -1
- package/dist/chunks/{chunk-FBVWXFCP.js → chunk-I5CXJNW4.js} +1 -1
- package/dist/chunks/{chunk-5ZIZD5ZG.js → chunk-J5X5YRBH.js} +1 -1
- package/dist/chunks/{chunk-VDYU5GXV.js → chunk-JOH6CUOG.js} +1 -1
- package/dist/chunks/{chunk-556CXJRE.js → chunk-JOV4G2LZ.js} +1 -1
- package/dist/chunks/{chunk-Z2LUKMI6.js → chunk-JWC64GEW.js} +1 -1
- package/dist/chunks/{chunk-IX4MMEGJ.js → chunk-JXHVB5A7.js} +3 -3
- package/dist/chunks/{chunk-OXH3RM6U.js → chunk-KBKN7EI7.js} +1 -1
- package/dist/chunks/{chunk-JDQP267R.js → chunk-KUVMCIR4.js} +1 -1
- package/dist/chunks/{chunk-GI6G3FJJ.js → chunk-LKI6FRNM.js} +1 -1
- package/dist/chunks/{chunk-GGZODU6S.js → chunk-LQBC5QPO.js} +1 -1
- package/dist/chunks/{chunk-CQPIWP7K.js → chunk-NZGOQUNN.js} +1 -1
- package/dist/chunks/{chunk-327GP3PO.js → chunk-PQ7YG2JU.js} +1 -1
- package/dist/chunks/{chunk-AJAO4Q3T.js → chunk-PQTP73R4.js} +1 -1
- package/dist/chunks/{chunk-6RHRDUSK.js → chunk-Q3OG3SC4.js} +1 -1
- package/dist/chunks/{chunk-7NYQ7CTP.js → chunk-R3B67TKQ.js} +1 -1
- package/dist/chunks/{chunk-RIQFJ2MY.js → chunk-RJOVMJZI.js} +4 -4
- package/dist/chunks/{chunk-PIKD5KTH.js → chunk-SOQ5DE44.js} +1 -1
- package/dist/chunks/{chunk-XM3JW6AL.js → chunk-T2ECF6MX.js} +1 -1
- package/dist/chunks/{chunk-ZRS5X7M2.js → chunk-T4AZ3U7O.js} +1 -1
- package/dist/chunks/{chunk-4P66SQRS.js → chunk-TBBU37TD.js} +1 -1
- package/dist/chunks/{chunk-5XK67SSI.js → chunk-TX4PCSTY.js} +1 -1
- package/dist/chunks/{chunk-2Q47GHFX.js → chunk-U6N2RNDI.js} +1 -1
- package/dist/chunks/{chunk-AGDWVTJV.js → chunk-UB37A37M.js} +4 -4
- package/dist/chunks/{chunk-FNYAHJIZ.js → chunk-UDOFIJ7K.js} +1 -1
- package/dist/chunks/{chunk-LZTGSYL3.js → chunk-UXCTETFN.js} +1 -1
- package/dist/chunks/{chunk-GTK7TBLW.js → chunk-V5DCSHYJ.js} +1 -1
- package/dist/chunks/{chunk-XV6SDZIO.js → chunk-V6IKQCOT.js} +1 -1
- package/dist/chunks/{chunk-HKKKVW7W.js → chunk-VG2V4NHC.js} +1 -1
- package/dist/chunks/{chunk-BW24TEUN.js → chunk-VIR3KDCQ.js} +1 -1
- package/dist/chunks/{chunk-JB45UWGT.js → chunk-W27LUVFI.js} +1 -1
- package/dist/chunks/{chunk-FCC3LYIB.js → chunk-W65SRO53.js} +1 -1
- package/dist/chunks/chunk-WBE23KLI.js +31 -0
- package/dist/chunks/{chunk-CWTXZPUV.js → chunk-WHYH7DVI.js} +2 -1
- package/dist/chunks/{chunk-SPPD6HZ7.js → chunk-WXT35K53.js} +1 -1
- package/dist/chunks/{chunk-TEFZFCIF.js → chunk-XRHDE2NT.js} +1 -1
- package/dist/chunks/{chunk-4VGOAPFY.js → chunk-YMM3VY3J.js} +1 -1
- package/dist/chunks/{chunk-TCS3FDID.js → chunk-Z4VR6CQ2.js} +1 -1
- package/dist/chunks/{chunk-OWEH7BYO.js → chunk-ZDORSGCG.js} +1 -1
- package/dist/chunks/{chunk-XKNCIFFB.js → chunk-ZKWM4JBE.js} +1 -1
- package/dist/chunks/{clear-D6L6DOJX.js → clear-74Z2GBIF.js} +1 -1
- package/dist/chunks/{compile-vercel-config-HTWCKOXQ.js → compile-vercel-config-MRWI6INC.js} +1 -1
- package/dist/chunks/config-7SVPPW7T.js +7 -0
- package/dist/chunks/{config-UC3QD67B.js → config-UYP3XEDY.js} +1 -1
- package/dist/chunks/{connect-git-provider-LSTDI4TC.js → connect-git-provider-P3SGOW6X.js} +1 -1
- package/dist/chunks/{delete-KIBUBKS5.js → delete-E355MKDF.js} +1 -1
- package/dist/chunks/{delete-6QE6SZFG.js → delete-QFKW4O7R.js} +1 -1
- package/dist/chunks/{detect-projects-64MZJZ6M.js → detect-projects-J3VAJIQD.js} +1 -1
- package/dist/chunks/{detect-services-HCM5D7CD.js → detect-services-JTGZ7NCQ.js} +1 -1
- package/dist/chunks/{disable-2SIGN57F.js → disable-K4MMQGSO.js} +1 -1
- package/dist/chunks/{discard-SU4KZRF4.js → discard-ITZDMBFI.js} +1 -1
- package/dist/chunks/{edit-XSC7KTWU.js → edit-3V4C747E.js} +1 -1
- package/dist/chunks/{edit-UPPFWMDP.js → edit-7IGZ4EH7.js} +1 -1
- package/dist/chunks/{enable-ON2Z35WD.js → enable-4TJRZIE7.js} +1 -1
- package/dist/chunks/{exec-ZLT5KH2Z.js → exec-YH5WUJ4C.js} +1 -1
- package/dist/chunks/{export-4WCA27XL.js → export-XJIKF2WX.js} +1 -1
- package/dist/chunks/{future-LU77KNDL.js → future-BB7OE645.js} +1 -1
- package/dist/chunks/{generate-cert-for-deploy-UFWA55HF.js → generate-cert-for-deploy-A4TZHE2Y.js} +1 -1
- package/dist/chunks/{image-OUAKVKKW.js → image-4UZ34VE5.js} +1 -1
- package/dist/chunks/{import-builders-GAOM5PLP.js → import-builders-7BRUAJT2.js} +1 -1
- package/dist/chunks/{inspect-2U2ZS6BV.js → inspect-2U47TXE3.js} +1 -1
- package/dist/chunks/{inspect-CPKV2YRR.js → inspect-FUJCRJTQ.js} +1 -1
- package/dist/chunks/{inspect-N3RXYOHT.js → inspect-H3D3M4TY.js} +1 -1
- package/dist/chunks/{inspect-HSMBKUSW.js → inspect-QLPYWU6F.js} +1 -1
- package/dist/chunks/{inspect-VVRA6JZQ.js → inspect-YZP2TUXW.js} +1 -1
- package/dist/chunks/{list-A7WJ266A.js → list-AEKIXAC2.js} +1 -1
- package/dist/chunks/{list-XGP6PIS5.js → list-AO2NTDVE.js} +1 -1
- package/dist/chunks/{list-EPOTOCMN.js → list-UGFJDLK3.js} +1 -1
- package/dist/chunks/{login-7ALV7XD4.js → login-GXL33UOO.js} +1 -1
- package/dist/chunks/{login-YQ7QPK4A.js → login-RMAISH4F.js} +1 -1
- package/dist/chunks/{logs-4WPTTXCS.js → logs-HXT43YFY.js} +1 -1
- package/dist/chunks/{ls-62NGKVG2.js → ls-2GUHQ2QY.js} +1 -1
- package/dist/chunks/{ls-WLDQKOJX.js → ls-DLX6OKJD.js} +1 -1
- package/dist/chunks/{ls-UDE66BQH.js → ls-IFYHOVHI.js} +1 -1
- package/dist/chunks/{ls-FOS2BGO3.js → ls-LDTXN5NC.js} +1 -1
- package/dist/chunks/{ls-L5IRHEBU.js → ls-MR4IEJXI.js} +1 -1
- package/dist/chunks/{ls-OGLSDDB5.js → ls-RYBY45PV.js} +1 -1
- package/dist/chunks/{ls-FUXVU2FM.js → ls-T6LDBBIZ.js} +1 -1
- package/dist/chunks/{mutate-TA3QMCKY.js → mutate-NMAFXSIS.js} +1 -1
- package/dist/chunks/{notifications-4XNZKXKP.js → notifications-VDMQJUX4.js} +1 -1
- package/dist/chunks/{open-G2NKF4KL.js → open-OYT4SXL7.js} +1 -1
- package/dist/chunks/{openapi-YEDROCHV.js → openapi-DKMCRF2V.js} +1 -1
- package/dist/chunks/{permissions-35SS45VZ.js → permissions-RVEIYB2B.js} +1 -1
- package/dist/chunks/{prompt-missing-credentials-YVS4S7X2.js → prompt-missing-credentials-QY4MZDT6.js} +1 -1
- package/dist/chunks/{publish-LSRQFUBZ.js → publish-I7FUMJAU.js} +1 -1
- package/dist/chunks/pull-XCHJWKNY.js +7 -0
- package/dist/chunks/{purchase-domain-if-available-KEMVAHHF.js → purchase-domain-if-available-5HP57BPC.js} +1 -1
- package/dist/chunks/{push-FLK45IKR.js → push-7H2NJAPB.js} +1 -1
- package/dist/chunks/{query-XP27OAHW.js → query-TJ7WEORG.js} +1 -1
- package/dist/chunks/{reauthenticate-APC7ZYFC.js → reauthenticate-O6C2AW3J.js} +1 -1
- package/dist/chunks/{reorder-F22Q63TM.js → reorder-JCS5LKA6.js} +1 -1
- package/dist/chunks/{reply-CPWRB47S.js → reply-SFRIWOPK.js} +1 -1
- package/dist/chunks/{resolve-L7Y4FLIS.js → resolve-WTQUYVKI.js} +1 -1
- package/dist/chunks/{restore-FOQ5TF47.js → restore-K442WYIM.js} +1 -1
- package/dist/chunks/{rm-7CH7JXQR.js → rm-377WPSMT.js} +1 -1
- package/dist/chunks/{rm-PWMT2FES.js → rm-576VOXTN.js} +1 -1
- package/dist/chunks/{rm-QTAD3MMN.js → rm-K2SG5TT7.js} +1 -1
- package/dist/chunks/{rm-IBIBN3TV.js → rm-OUXMNCHX.js} +1 -1
- package/dist/chunks/{rm-OQL6ZGQM.js → rm-XFZMZILG.js} +1 -1
- package/dist/chunks/{routes-ZD7XUKLY.js → routes-IPGKJ2E4.js} +1 -1
- package/dist/chunks/{rule-inspect-SGVM6FEZ.js → rule-inspect-MK7A5LPA.js} +1 -1
- package/dist/chunks/{rules-MMAVDLJB.js → rules-4T3OHT34.js} +1 -1
- package/dist/chunks/{schema-JYYQBTCL.js → schema-PUOL7JUI.js} +1 -1
- package/dist/chunks/{schema-B74HJNER.js → schema-RIUBZXVC.js} +1 -1
- package/dist/chunks/{select-org-5OUQKTNI.js → select-org-F2A5JJFH.js} +1 -1
- package/dist/chunks/{set-6MRJYM56.js → set-HNSMZTBW.js} +1 -1
- package/dist/chunks/setup-and-link-X44IODXA.js +7 -0
- package/dist/chunks/{tags-SWK66ZCK.js → tags-7CY2YR27.js} +1 -1
- package/dist/chunks/{types-BTHJ46LC.js → types-H3B56MH6.js} +1 -1
- package/dist/chunks/{update-UVXYG3Q7.js → update-QAGFDMEF.js} +1 -1
- package/dist/commands/build/index.js +1 -1
- package/dist/commands/deploy/index.js +5 -5
- package/dist/commands/dev/index.js +20 -19
- package/dist/commands/env/index.js +2 -2
- package/dist/commands/link/index.js +1 -1
- package/dist/commands/list/index.js +1 -1
- package/dist/commands-bulk.js +745 -724
- package/dist/help.js +1 -1
- package/dist/index.js +3 -3
- package/dist/version.mjs +1 -1
- package/package.json +22 -21
- package/dist/chunks/chunk-ENBTTYJR.js +0 -7
- package/dist/chunks/chunk-JEIMW3CO.js +0 -7
- package/dist/chunks/chunk-XPV22OOJ.js +0 -9
- package/dist/chunks/chunk-XQWBEAKZ.js +0 -9
- package/dist/chunks/config-3PKXC765.js +0 -7
- package/dist/chunks/pull-BOJ3ZTIE.js +0 -7
- package/dist/chunks/setup-and-link-M6GYPEQY.js +0 -7
|
@@ -4,7 +4,7 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{getUpdateCommandInfo,getUpgradePackageManager,isGlobal,trustedUpgradeDirectory,trustedUpgradeEnvironment}from"./chunk-XM3JW6AL.js";import{progress}from"./chunk-U56NHYAH.js";import{writeToConfigFile}from"./chunk-IX4MMEGJ.js";import{require_ci_info}from"./chunk-T52FMXWC.js";import{require_semver}from"./chunk-KKS7XWEX.js";import{require_chownr,require_mkdirp,require_pump,require_tar_stream}from"./chunk-NNP5NITU.js";import{param}from"./chunk-SXUEGVWB.js";import{buildCorrectedCommand,suggestCorrection}from"./chunk-ZRS5X7M2.js";import{fetch,toNodeReadable}from"./chunk-MY4MONOH.js";import{getInstallRoot,isNativeBinaryInstall}from"./chunk-7T6TL3GQ.js";import{require_lib}from"./chunk-AGDWVTJV.js";import{require_strip_ansi}from"./chunk-OSCCYU74.js";import{shouldEmitNonInteractiveCommandError,writeAgentError}from"./chunk-WR5OOWD6.js";import{getFlagsSpecification}from"./chunk-JAJW3P42.js";import{output_manager_default}from"./chunk-RTRCTYW6.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-T2ECF6MX.js";import{progress}from"./chunk-U56NHYAH.js";import{writeToConfigFile}from"./chunk-JXHVB5A7.js";import{require_ci_info}from"./chunk-T52FMXWC.js";import{require_semver}from"./chunk-KKS7XWEX.js";import{require_chownr,require_mkdirp,require_pump,require_tar_stream}from"./chunk-NNP5NITU.js";import{param}from"./chunk-SXUEGVWB.js";import{buildCorrectedCommand,suggestCorrection}from"./chunk-T4AZ3U7O.js";import{fetch,toNodeReadable}from"./chunk-MY4MONOH.js";import{getInstallRoot,isNativeBinaryInstall}from"./chunk-7T6TL3GQ.js";import{require_lib}from"./chunk-UB37A37M.js";import{require_strip_ansi}from"./chunk-OSCCYU74.js";import{shouldEmitNonInteractiveCommandError,writeAgentError}from"./chunk-BX5KDMLT.js";import{getFlagsSpecification}from"./chunk-JAJW3P42.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}
|
|
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}
|
|
@@ -15,10 +15,10 @@ To bypass the minimum release age for this and future foreground upgrades:
|
|
|
15
15
|
`);let action=await client.input.select({message:"Which upgrade option?",choices:[{name:"Install the newest release allowed by my settings",value:"allowed"},{name:"Bypass the minimum release age for this and future foreground upgrades",value:"bypass"},{name:"Cancel",value:"cancel"}],default:"allowed"});if(action==="allowed")resolvedTargetVersion=void 0,installArgs=args,usedAllowedRelease=!0;else if(action==="bypass")setMinReleaseAgeBypass(client,!0),output_manager_default.log("To restore release-age checks, run `vc upgrade --disable-min-release-age-bypass`."),installArgs=[...installArgs,...bypassArgs];else return output_manager_default.log("Upgrade canceled."),0;renderUpgradeProgress(targetVersion?1:2,totalSteps,"Installing\u2026"),result=await runInstall(installArgs)}return result.spawnError?(output_manager_default.stopSpinner(),output_manager_default.error(`Failed to execute upgrade command: ${result.spawnError.message}`),output_manager_default.log(`You can try running the command manually: ${[command,...installArgs].join(" ")}`),1):result.code!==0?(output_manager_default.stopSpinner(),result.stdout&&output_manager_default.print(result.stdout),result.stderr&&output_manager_default.print(result.stderr),output_manager_default.error(`Upgrade failed with exit code ${result.code}`),output_manager_default.log(`You can try running the command manually: ${[command,...installArgs].join(" ")}`),result.code):usedAllowedRelease&&(resolvedTargetVersion=await getInstalledPackageVersion(packageManager,args,cwd,global),resolvedTargetVersion===versionBefore)?(output_manager_default.stopSpinner(),output_manager_default.log(`Vercel CLI remains at v${versionBefore} under your package manager settings.`),0):(renderUpgradeProgress(totalSteps,totalSteps),output_manager_default.stopSpinner(),output_manager_default.success(resolvedTargetVersion?`Upgraded Vercel CLI to v${resolvedTargetVersion}.`:"Upgraded Vercel CLI."),0)}var import_semver3=__toESM(require_semver(),1),import_ci_info=__toESM(require_ci_info(),1),import_xdg_app_paths=__toESM(require_xdg_app_paths(),1),import_fs_extra=__toESM(require_lib(),1);import{randomUUID as randomUUID3}from"node:crypto";import{mkdir as mkdir4,rename as rename4,rm as rm4,writeFile as writeFile4}from"node:fs/promises";import{dirname as dirname2,isAbsolute,relative as relative2,resolve as resolve2}from"node:path";import{createHash,randomUUID}from"node:crypto";import{dirname}from"node:path";import{link,mkdir,readFile,rename,rm,writeFile}from"node:fs/promises";var DEFAULT_WAIT_MS=3e4,DEFAULT_RETRY_MS=50;async function readOwner(lockPath){try{let value=JSON.parse(await readFile(lockPath,"utf8"));return typeof value.token!="string"||value.token.length===0||!Number.isSafeInteger(value.pid)||(value.pid??0)<=0||typeof value.createdAt!="number"||!Number.isFinite(value.createdAt)||value.createdAt<=0?void 0:value}catch{return}}function processExists(pid){try{return process.kill(pid,0),!0}catch(error){return error.code==="EPERM"}}async function moveAbandonedDirectoryLock(lockPath,abandonedAfterMs){let owner=await readOwner(`${lockPath}/owner.json`);if(!owner||Date.now()-owner.createdAt<abandonedAfterMs||processExists(owner.pid))return!1;let generation=createHash("sha256").update(owner.token).digest("hex"),tombstone=`${lockPath}.abandoned-${generation}`;try{return await rename(lockPath,tombstone),!0}catch(error){if(isContentionError(error,["ENOENT","EEXIST","ENOTEMPTY"]))return!1;throw error}}function isContentionError(error,expectedCodes){let code=error.code;return!!(code&&expectedCodes.includes(code)||process.platform==="win32"&&code==="EPERM")}async function waitForRetry(startedAt,lockPath,{waitMs,retryMs,busyMessage}){if(waitMs===0||Date.now()-startedAt>=waitMs)throw new Error(busyMessage(lockPath,waitMs!==0));await new Promise(resolveTimeout=>setTimeout(resolveTimeout,Math.min(retryMs,waitMs)))}async function withFileLock(lockPath,action,{waitMs=DEFAULT_WAIT_MS,retryMs=DEFAULT_RETRY_MS,busyMessage}){await mkdir(dirname(lockPath),{recursive:!0});let owner={token:randomUUID(),pid:process.pid,createdAt:Date.now()},claim=`${lockPath}.claim-${owner.token}`,released=`${lockPath}.released-${owner.token}`,startedAt=Date.now(),acquired=!1;await writeFile(claim,`${JSON.stringify(owner)}
|
|
16
16
|
`,{flag:"wx"});try{for(;;)try{await link(claim,lockPath),acquired=!0;break}catch(error){if(!isContentionError(error,["EEXIST"]))throw error;await waitForRetry(startedAt,lockPath,{waitMs,retryMs,busyMessage})}return await rm(claim,{force:!0}).catch(()=>{}),await action()}finally{acquired&&(await readOwner(lockPath))?.token===owner.token&&await rename(lockPath,released).then(()=>!0).catch(()=>!1)&&await rm(released,{force:!0}),await rm(claim,{force:!0})}}async function withDirectoryLock(lockPath,action,{waitMs=DEFAULT_WAIT_MS,retryMs=DEFAULT_RETRY_MS,busyMessage,abandonedAfterMs}){await mkdir(dirname(lockPath),{recursive:!0});let owner={token:randomUUID(),pid:process.pid,createdAt:Date.now()},claim=`${lockPath}.claim-${owner.token}`,ownerPath=`${claim}/owner.json`,startedAt=Date.now(),acquired=!1;await mkdir(claim),await writeFile(ownerPath,`${JSON.stringify(owner)}
|
|
17
17
|
`);try{for(;;)try{await rename(claim,lockPath),acquired=!0;break}catch(error){if(!isContentionError(error,["EEXIST","ENOTEMPTY"]))throw error;if(abandonedAfterMs!==void 0&&await moveAbandonedDirectoryLock(lockPath,abandonedAfterMs))continue;await waitForRetry(startedAt,lockPath,{waitMs,retryMs,busyMessage})}return await action()}finally{if(acquired&&(await readOwner(`${lockPath}/owner.json`))?.token===owner.token){let released=`${lockPath}.released-${owner.token}`;await rename(lockPath,released).then(()=>!0).catch(()=>!1)?await rm(released,{recursive:!0,force:!0}):await rm(lockPath,{recursive:!0,force:!0})}await rm(claim,{recursive:!0,force:!0})}}var import_tar_fs=__toESM(require_tar_fs(),1),import_semver2=__toESM(require_semver(),1);import{createGunzip}from"node:zlib";import{createHash as createHash2}from"node:crypto";import{createWriteStream}from"node:fs";import{tmpdir}from"node:os";import{join as join2,sep as sep2}from"node:path";import{pipeline}from"node:stream/promises";import{chmod,copyFile,mkdir as mkdir3,mkdtemp,realpath,rename as rename3,rm as rm3,stat as stat2,writeFile as writeFile3}from"node:fs/promises";import{randomUUID as randomUUID2}from"node:crypto";import{join,relative,resolve,sep}from"node:path";import{mkdir as mkdir2,readFile as readFile2,readlink,rename as rename2,rm as rm2,stat,symlink,writeFile as writeFile2}from"node:fs/promises";var SLOTS=["a","b"],LOCK_RETRY_MS=50;function tracksDir(root){return join(root,"versions","tracks")}function slotDir(root,track,slot){return join(tracksDir(root),track,slot)}function isTrack(value){return value==="production"||value==="pr"}function isSlot(value){return value==="a"||value==="b"}async function atomicSymlink(target,path){let temporary=`${path}.tmp-${randomUUID2()}`;await symlink(target,temporary);try{await rename2(temporary,path)}catch(error){throw await rm2(temporary,{force:!0}),error}}async function atomicWrite(path,contents){let temporary=`${path}.tmp-${randomUUID2()}`;await writeFile2(temporary,contents);try{await rename2(temporary,path)}catch(error){throw await rm2(temporary,{force:!0}),error}}async function readSlotMetadata(root,track,slot){try{let value=JSON.parse(await readFile2(join(slotDir(root,track,slot),"metadata.json"),"utf8"));return value.track!==track||value.slot!==slot||typeof value.version!="string"?void 0:value}catch{return}}async function readPointer(root,path){try{let target=resolve(root,await readlink(path)),rel=relative(tracksDir(root),target).split(sep);return rel.length!==2||!isTrack(rel[0])||!isSlot(rel[1])?void 0:{track:rel[0],slot:rel[1]}}catch{return}}async function readActivePointer(root){return readPointer(root,join(root,"active"))}async function readTrackPointer(root,track){try{let slot=(await readlink(join(tracksDir(root),track,"active"))).split(sep).pop();return slot&&isSlot(slot)?slot:void 0}catch{return}}async function readNativeInstallState(root){let pointer=await readActivePointer(root);if(!pointer)return;let active=await readSlotMetadata(root,pointer.track,pointer.slot);if(!active)return;let pendingProduction;try{let pending=JSON.parse(await readFile2(join(root,"pending-production.json"),"utf8"));pending.slot&&isSlot(pending.slot)&&pending.version&&(await readSlotMetadata(root,"production",pending.slot))?.version===pending.version&&!(pointer.track==="production"&&pointer.slot===pending.slot)&&(pendingProduction={slot:pending.slot,version:pending.version})}catch{}return{...active,pendingProduction}}async function ensureNativeBinLinks(root){let bin=join(root,"bin");await mkdir2(bin,{recursive:!0});for(let name of["vercel","vc"]){let path=join(bin,name),expected=join("..","active","vercel");await readlink(path).catch(()=>{})!==expected&&await atomicSymlink(expected,path)}}async function markPendingProduction(root,slot,version){await atomicWrite(join(root,"pending-production.json"),`${JSON.stringify({slot,version})}
|
|
18
|
-
`)}async function activateSlot(root,track,slot){let metadata=await readSlotMetadata(root,track,slot),binary=await stat(join(slotDir(root,track,slot),"vercel")).catch(()=>{});if(!metadata||!binary?.isFile())throw new Error(`Cannot activate incomplete ${track}/${slot} slot`);let trackDir=join(tracksDir(root),track);await mkdir2(trackDir,{recursive:!0}),await atomicSymlink(slot,join(trackDir,"active")),await atomicSymlink(relative(root,slotDir(root,track,slot)),join(root,"active")),track==="production"&&await rm2(join(root,"pending-production.json"),{force:!0}),await ensureNativeBinLinks(root)}async function getInactiveSlot(root,track){let active=await readActivePointer(root);return(active?.track===track?active.slot:await readTrackPointer(root,track))==="a"?"b":"a"}async function writeTrackSlot(root,metadata,prepare){let slot=await getInactiveSlot(root,metadata.track),trackDir=join(tracksDir(root),metadata.track),destination=slotDir(root,metadata.track,slot),temporary=join(trackDir,`.slot-${slot}-${randomUUID2()}`),backup=join(trackDir,`.old-${slot}-${randomUUID2()}`);await mkdir2(temporary,{recursive:!0});try{if(await prepare(temporary),!(await stat(join(temporary,"vercel")).catch(()=>{}))?.isFile())throw new Error("Prepared slot does not contain a Vercel CLI binary");await atomicWrite(join(temporary,"metadata.json"),`${JSON.stringify({...metadata,slot})}
|
|
19
|
-
`);let hadDestination=!1;try{await rename2(destination,backup),hadDestination=!0}catch(error){if(error.code!=="ENOENT")throw error}try{await rename2(temporary,destination)}catch(error){throw hadDestination&&await rename2(backup,destination).catch(()=>{}),error}return hadDestination&&await rm2(backup,{recursive:!0,force:!0}),slot}finally{await rm2(temporary,{recursive:!0,force:!0})}}async function withNativeInstallLock(root,action,{wait=!0,waitMs=3e4}={}){let lock=join(root,"update.lock");return withFileLock(lock,action,{waitMs:wait?waitMs:0,retryMs:LOCK_RETRY_MS,busyMessage:(path,timedOut)=>timedOut?`Timed out waiting for another Vercel CLI update. If no update is running, remove the lock at ${path} and retry.`:"Native update already in progress"})}async function listNativeTrackSlots(root){let installed=[];for(let track of["production","pr"])for(let slot of SLOTS){let metadata=await readSlotMetadata(root,track,slot),binary=await stat(join(slotDir(root,track,slot),"vercel")).catch(()=>{});metadata&&binary?.isFile()&&installed.push(metadata)}return installed}var REGISTRY="https://registry.npmjs.org";async function moveFile(source,destination){try{await rename3(source,destination)}catch(err){if(err.code!=="EXDEV")throw err;await copyFile(source,destination),await rm3(source,{force:!0})}}var CURL_INSTALL_COMMAND="curl -fsSL https://api-frameworks.vercel.sh/install | sh",SUPPORTED_PLATFORMS=new Set(["darwin-arm64","darwin-x64","linux-arm64","linux-x64"]);function platformTarget(){return`${process.platform}-${process.arch}`}function isSupportedPlatform(){return SUPPORTED_PLATFORMS.has(platformTarget())}function unsupportedPlatformMessage(){let supported=Array.from(SUPPORTED_PLATFORMS).join(", ");return`The native Vercel CLI binary is not available for your platform (${platformTarget()}). Supported platforms: ${supported}. You can install the CLI with a package manager instead: npm i -g vercel@latest`}function nativePackageSuffix(){return`vc-native-${platformTarget()}`}function getNativePackageName(){return`@vercel/${nativePackageSuffix()}`}async function isCurlInstall(){if(!isNativeBinaryInstall())return!1;let root=getInstallRoot(),managedPrefixes=[join2(root,"versions")+sep2];if(managedPrefixes.some(prefix=>process.execPath.startsWith(prefix)))return!0;try{let real=await realpath(process.execPath);return managedPrefixes.some(prefix=>real.startsWith(prefix))}catch{return!1}}async function resolveLatestVersion(pkgName){let res=await fetch(`${REGISTRY}/${pkgName}/latest
|
|
18
|
+
`)}async function activateSlot(root,track,slot){let metadata=await readSlotMetadata(root,track,slot),binary=await stat(join(slotDir(root,track,slot),"vercel")).catch(()=>{});if(!metadata||!binary?.isFile())throw new Error(`Cannot activate incomplete ${track}/${slot} slot`);let trackDir=join(tracksDir(root),track);await mkdir2(trackDir,{recursive:!0}),await atomicSymlink(slot,join(trackDir,"active")),await atomicSymlink(relative(root,slotDir(root,track,slot)),join(root,"active")),track==="production"&&await rm2(join(root,"pending-production.json"),{force:!0}),await ensureNativeBinLinks(root)}async function getInactiveSlot(root,track){let active=await readActivePointer(root);return(active?.track===track?active.slot:await readTrackPointer(root,track))==="a"?"b":"a"}async function writeTrackSlot(root,metadata,prepare,{signal}={}){signal?.throwIfAborted();let slot=await getInactiveSlot(root,metadata.track),trackDir=join(tracksDir(root),metadata.track),destination=slotDir(root,metadata.track,slot),temporary=join(trackDir,`.slot-${slot}-${randomUUID2()}`),backup=join(trackDir,`.old-${slot}-${randomUUID2()}`);signal?.throwIfAborted(),await mkdir2(temporary,{recursive:!0});try{if(signal?.throwIfAborted(),await prepare(temporary),signal?.throwIfAborted(),!(await stat(join(temporary,"vercel")).catch(()=>{}))?.isFile())throw new Error("Prepared slot does not contain a Vercel CLI binary");signal?.throwIfAborted(),await atomicWrite(join(temporary,"metadata.json"),`${JSON.stringify({...metadata,slot})}
|
|
19
|
+
`),signal?.throwIfAborted();let hadDestination=!1;try{await rename2(destination,backup),hadDestination=!0}catch(error){if(error.code!=="ENOENT")throw error}try{signal?.throwIfAborted(),await rename2(temporary,destination)}catch(error){throw hadDestination&&await rename2(backup,destination).catch(()=>{}),error}return hadDestination&&await rm2(backup,{recursive:!0,force:!0}),slot}finally{await rm2(temporary,{recursive:!0,force:!0})}}async function withNativeInstallLock(root,action,{wait=!0,waitMs=3e4}={}){let lock=join(root,"update.lock");return withFileLock(lock,action,{waitMs:wait?waitMs:0,retryMs:LOCK_RETRY_MS,busyMessage:(path,timedOut)=>timedOut?`Timed out waiting for another Vercel CLI update. If no update is running, remove the lock at ${path} and retry.`:"Native update already in progress"})}async function listNativeTrackSlots(root){let installed=[];for(let track of["production","pr"])for(let slot of SLOTS){let metadata=await readSlotMetadata(root,track,slot),binary=await stat(join(slotDir(root,track,slot),"vercel")).catch(()=>{});metadata&&binary?.isFile()&&installed.push(metadata)}return installed}var REGISTRY="https://registry.npmjs.org";function discardResponseBody(response){response.body?.cancel().catch(()=>{})}async function moveFile(source,destination){try{await rename3(source,destination)}catch(err){if(err.code!=="EXDEV")throw err;await copyFile(source,destination),await rm3(source,{force:!0})}}var CURL_INSTALL_COMMAND="curl -fsSL https://api-frameworks.vercel.sh/install | sh",SUPPORTED_PLATFORMS=new Set(["darwin-arm64","darwin-x64","linux-arm64","linux-x64"]);function platformTarget(){return`${process.platform}-${process.arch}`}function isSupportedPlatform(){return SUPPORTED_PLATFORMS.has(platformTarget())}function unsupportedPlatformMessage(){let supported=Array.from(SUPPORTED_PLATFORMS).join(", ");return`The native Vercel CLI binary is not available for your platform (${platformTarget()}). Supported platforms: ${supported}. You can install the CLI with a package manager instead: npm i -g vercel@latest`}function nativePackageSuffix(){return`vc-native-${platformTarget()}`}function getNativePackageName(){return`@vercel/${nativePackageSuffix()}`}async function isCurlInstall(){if(!isNativeBinaryInstall())return!1;let root=getInstallRoot(),managedPrefixes=[join2(root,"versions")+sep2];if(managedPrefixes.some(prefix=>process.execPath.startsWith(prefix)))return!0;try{let real=await realpath(process.execPath);return managedPrefixes.some(prefix=>real.startsWith(prefix))}catch{return!1}}async function resolveLatestVersion(pkgName,{signal}={}){let res=await fetch(`${REGISTRY}/${pkgName}/latest`,{signal});if(!res.ok)throw discardResponseBody(res),new Error(`Failed to fetch package metadata from the npm registry (HTTP ${res.status})`);let manifest=await res.json();if(!manifest.version||!import_semver2.default.valid(manifest.version))throw new Error("Could not resolve the latest native binary version");return manifest.version}async function resolveLatestNativeVersion(options){return resolveLatestVersion(getNativePackageName(),options)}async function listAvailableVersions(pkgName){let res=await fetch(`${REGISTRY}/${pkgName}`,{headers:{accept:"application/vnd.npm.install-v1+json"}});if(!res.ok)throw new Error(`Failed to fetch package metadata from the npm registry (HTTP ${res.status})`);let manifest=await res.json();return Object.keys(manifest.versions??{}).filter(v=>import_semver2.default.valid(v)).sort(import_semver2.default.rcompare)}async function downloadAndExtractBinary(version,destination,{signal}={}){if(!isSupportedPlatform())throw new Error(unsupportedPlatformMessage());let suffix=nativePackageSuffix(),tarballUrl=`${REGISTRY}/@vercel/${suffix}/-/${suffix}-${version}.tgz`,res=await fetch(tarballUrl,{signal});if(res.status===404)throw discardResponseBody(res),new Error(`No native binary is available for Vercel CLI v${version} on ${platformTarget()}. Older versions may predate native binary builds. You can install that version with a package manager instead: npm i -g vercel@${version}`);if(!res.ok)throw discardResponseBody(res),new Error(`Failed to download ${tarballUrl} (HTTP ${res.status})`);let tmpDir=await mkdtemp(join2(tmpdir(),"vercel-upgrade-"));try{await pipeline(toNodeReadable(res.body),createGunzip(),import_tar_fs.default.extract(tmpDir,{ignore:(_name,header)=>header?.type!=="file"&&header?.type!=="directory"}),{signal}),signal?.throwIfAborted();let binary=join2(tmpDir,"package","bin","vercel");if(!(await stat2(binary).catch(()=>null))?.isFile())throw new Error("Downloaded tarball did not contain the expected binary (package/bin/vercel)");signal?.throwIfAborted(),await mkdir3(destination,{recursive:!0}),await chmod(binary,493),await moveFile(binary,join2(destination,"vercel"))}finally{await rm3(tmpDir,{recursive:!0,force:!0})}}var PR_BINARIES_URL=process.env.VERCEL_PR_BINARIES_URL||"https://api-frameworks.vercel.sh/pr-binaries";function parsePrTarget(target){let match=/^pr[/-](\d+)$/i.exec(target.trim());if(!match)return;let pr=Number(match[1]);return Number.isSafeInteger(pr)&&pr>0?pr:void 0}async function fetchPrBuildSha(pr){let url=`${PR_BINARIES_URL}/${pr}/current-sha`,res=await fetch(url);if(res.status===404)throw new Error(`Couldn't find a binary for PR #${pr}. The current-sha pointer is not published yet.`);if(!res.ok)throw new Error(`Failed to fetch the current build for PR #${pr} (HTTP ${res.status}).`);let sha=(await res.text()).trim().toLowerCase();if(!/^[0-9a-f]{40}$/.test(sha))throw new Error(`Unexpected build SHA format for PR #${pr}.`);return sha}function missingPrPlatformMessage(pr,buildSha){let platform=platformTarget(),shortSha=buildSha.slice(0,12);return`Couldn't find a ${platform} binary for PR #${pr} (${shortSha}). This SHA exists, but this platform isn't ready yet.`}function getPrBinaryBaseUrl(pr,buildSha){return`${PR_BINARIES_URL}/${pr}/shas/${buildSha}`}async function fetchPrChecksum(pr,buildSha){let url=`${getPrBinaryBaseUrl(pr,buildSha)}/vercel-${platformTarget()}.sha256`,res=await fetch(url);if(res.status===404)throw new Error(missingPrPlatformMessage(pr,buildSha));if(!res.ok)throw new Error(`Failed to fetch the checksum for PR #${pr} (HTTP ${res.status}).`);let sha=(await res.text()).trim().split(/\s+/)[0]?.toLowerCase();if(!/^[0-9a-f]{64}$/.test(sha??""))throw new Error(`Unexpected checksum format for PR #${pr}.`);return sha}async function downloadPrBinary(pr,buildSha,expectedSha,destination){if(!isSupportedPlatform())throw new Error(unsupportedPlatformMessage());let url=`${getPrBinaryBaseUrl(pr,buildSha)}/vercel-${platformTarget()}`,res=await fetch(url);if(res.status===404)throw new Error(missingPrPlatformMessage(pr,buildSha));if(!res.ok)throw new Error(`Failed to download ${url} (HTTP ${res.status})`);let tmpDir=await mkdtemp(join2(tmpdir(),"vercel-pr-"));try{let tmpBinary=join2(tmpDir,"vercel"),hash=createHash2("sha256"),body=toNodeReadable(res.body);body.on("data",chunk=>hash.update(chunk)),await pipeline(body,createWriteStream(tmpBinary));let actualSha=hash.digest("hex");if(actualSha!==expectedSha)throw new Error(`Checksum mismatch for PR #${pr} binary. The build may have been updated mid-download; try again.`);await mkdir3(destination,{recursive:!0}),await chmod(tmpBinary,493),await moveFile(tmpBinary,join2(destination,"vercel")),await writeFile3(join2(destination,"vercel.sha256"),`${actualSha}
|
|
20
20
|
`)}finally{await rm3(tmpDir,{recursive:!0,force:!0})}}async function findTrackSlot(track,matches){let root=getInstallRoot();for(let slot of["a","b"]){let metadata=await readSlotMetadata(root,track,slot),binary=await stat2(join2(root,"versions","tracks",track,slot,"vercel")).catch(()=>{});if(metadata&&binary?.isFile()&&matches(metadata))return slot}}async function findNewestProductionSlotAtLeast(version){let root=getInstallRoot(),newest;for(let slot of["a","b"]){let metadata=await readSlotMetadata(root,"production",slot),binary=await stat2(join2(root,"versions","tracks","production",slot,"vercel")).catch(()=>{});metadata&&binary?.isFile()&&import_semver2.default.valid(metadata.version)&&import_semver2.default.gte(metadata.version,version)&&(!newest||import_semver2.default.gt(metadata.version,newest.version))&&(newest={slot,version:metadata.version})}return newest}async function installAndActivateProductionVersion(version){let root=getInstallRoot();return withNativeInstallLock(root,async()=>{let existing=await findTrackSlot("production",metadata=>metadata.version===version);if(existing)return await activateSlot(root,"production",existing),{slot:existing,downloaded:!1};output_manager_default.spinner(`Downloading Vercel CLI v${version}\u2026`,0);let slot=await writeTrackSlot(root,{track:"production",version},directory=>downloadAndExtractBinary(version,directory));return await activateSlot(root,"production",slot),{slot,downloaded:!0}})}async function installAndActivatePrBinary(pr){let root=getInstallRoot();return withNativeInstallLock(root,async()=>{output_manager_default.spinner(`Checking latest build for PR #${pr}\u2026`,0);let buildSha=await fetchPrBuildSha(pr),remoteSha=await fetchPrChecksum(pr,buildSha),existing=await findTrackSlot("pr",metadata=>metadata.pr===pr&&metadata.buildSha===buildSha);if(existing)return await activateSlot(root,"pr",existing),{updated:!1,buildSha,slot:existing};output_manager_default.spinner(`Downloading Vercel CLI build for PR #${pr}\u2026`,0);let slot=await writeTrackSlot(root,{track:"pr",version:`pr/${pr}`,pr,buildSha},async directory=>{await downloadPrBinary(pr,buildSha,remoteSha,directory),await writeFile3(join2(directory,"build-sha"),`${buildSha}
|
|
21
|
-
`)});return await activateSlot(root,"pr",slot),{updated:!0,buildSha,slot}})}async function stageProductionUpdate(version,selectProduction=!1){let root=getInstallRoot();return withNativeInstallLock(root,async()=>{let active=await readActivePointer(root)
|
|
21
|
+
`)});return await activateSlot(root,"pr",slot),{updated:!0,buildSha,slot}})}async function stageProductionUpdate(version,selectProduction=!1,options={}){let root=getInstallRoot();return withNativeInstallLock(root,async()=>{options.signal?.throwIfAborted();let active=await readActivePointer(root);options.signal?.throwIfAborted();let activated=selectProduction||active?.track!=="pr",installed=await findNewestProductionSlotAtLeast(version);if(options.signal?.throwIfAborted(),installed)return await markPendingProduction(root,installed.slot,installed.version),activated&&(options.signal?.throwIfAborted(),await activateSlot(root,"production",installed.slot)),{slot:installed.slot,downloaded:!1,activated};let slot=await writeTrackSlot(root,{track:"production",version},directory=>downloadAndExtractBinary(version,directory,options),options);return options.signal?.throwIfAborted(),await markPendingProduction(root,slot,version),activated&&(options.signal?.throwIfAborted(),await activateSlot(root,"production",slot)),{slot,downloaded:!0,activated}},{wait:!1})}async function executeNativeSelfUpdate(targetVersion){try{output_manager_default.spinner("Checking for updates\u2026",0);let version=targetVersion??await resolveLatestNativeVersion();return await installAndActivateProductionVersion(version),output_manager_default.stopSpinner(),output_manager_default.success(`Vercel CLI v${version} is active`),0}catch(error){return output_manager_default.stopSpinner(),output_manager_default.fatal(`Upgrade failed: ${error instanceof Error?error.message:String(error)}`),output_manager_default.log(`You can try reinstalling manually: ${CURL_INSTALL_COMMAND}`),1}}import{spawn as spawn2}from"node:child_process";var NATIVE_UPDATE_CHILD_ENV="VERCEL_NATIVE_UPDATE_CHILD",NATIVE_UPDATE_VERSION_ENV="VERCEL_NATIVE_UPDATE_VERSION",NATIVE_UPDATE_SELECT_PRODUCTION_ENV="VERCEL_NATIVE_UPDATE_SELECT_PRODUCTION";function isNativeUpdateChild(){return process.env[NATIVE_UPDATE_CHILD_ENV]==="1"}function spawnDetachedUpdate(env){let child=spawn2(process.execPath,["version","check"],{detached:!0,stdio:"ignore",windowsHide:!0,env});child.on("error",()=>{}),child.unref()}function spawnNativeUpdateCheck(){let env={...process.env,[NATIVE_UPDATE_CHILD_ENV]:"1",[NATIVE_UPDATE_SELECT_PRODUCTION_ENV]:"0"};delete env[NATIVE_UPDATE_VERSION_ENV],spawnDetachedUpdate(env)}function spawnNativeUpdateChild(version,selectProduction){spawnDetachedUpdate({...process.env,[NATIVE_UPDATE_CHILD_ENV]:"1",[NATIVE_UPDATE_VERSION_ENV]:version,[NATIVE_UPDATE_SELECT_PRODUCTION_ENV]:selectProduction?"1":"0"})}var NATIVE_UPDATE_CHECK_INTERVAL=1e3*60*60*24,NATIVE_UPDATE_DISCOVERY_LEASE=1e3*60;function isNativeAutoUpdateEnabled(config){return config.updates?.auto!==!1}var CACHE_LOCK_RETRY_MS=10,CACHE_LOCK_ABANDONED_MS=1e4;function getNativeUpdateCacheFile(cacheDir=(0,import_xdg_app_paths.default)("com.vercel.cli").cache()){let packageName=getNativePackageName().replaceAll("/","-");return resolve2(cacheDir,"package-updates",`${packageName}-latest.json`)}function readNativeUpdateCache(cacheDir){try{let cache=(0,import_fs_extra.readJSONSync)(getNativeUpdateCacheFile(cacheDir));if(typeof cache?.expireAt=="number"&&(cache.version===void 0||typeof cache.version=="string"&&import_semver3.default.valid(cache.version)))return cache}catch{}}async function atomicWriteCache(cacheDir,cache){let cacheFile=getNativeUpdateCacheFile(cacheDir);await mkdir4(dirname2(cacheFile),{recursive:!0});let temporary=`${cacheFile}.tmp-${randomUUID3()}`;await writeFile4(temporary,`${JSON.stringify(cache)}
|
|
22
22
|
`);try{await rename4(temporary,cacheFile)}catch(error){throw await rm4(temporary,{force:!0}),error}}async function withNativeUpdateCacheLock(cacheDir,action,{waitMs=5e3}={}){let lock=`${getNativeUpdateCacheFile(cacheDir)}.lock`;await withDirectoryLock(lock,action,{waitMs,retryMs:CACHE_LOCK_RETRY_MS,abandonedAfterMs:CACHE_LOCK_ABANDONED_MS,busyMessage:path=>`Timed out waiting for the native update cache. If no Vercel update is running, remove the lock at ${path} and retry.`})}async function cacheNativeUpdateVersion(version,{cacheDir=(0,import_xdg_app_paths.default)("com.vercel.cli").cache(),now=Date.now(),selectProduction=!1}={}){await withNativeUpdateCacheLock(cacheDir,async()=>{let existing=readNativeUpdateCache(cacheDir),keepNewerExisting=!!(existing?.version&&import_semver3.default.gt(existing.version,version)),nextVersion=keepNewerExisting?existing?.version:version,shouldSelectProduction=selectProduction||existing?.selectProduction===!0,staged=shouldSelectProduction?!1:keepNewerExisting||existing?.version===version?existing?.staged===!0:!1;await atomicWriteCache(cacheDir,{expireAt:now+NATIVE_UPDATE_CHECK_INTERVAL,selectProduction:shouldSelectProduction,staged,version:nextVersion})})}async function cacheNativeUpdateDiscoveryAttempt({cacheDir=(0,import_xdg_app_paths.default)("com.vercel.cli").cache(),now=Date.now()}={}){await withNativeUpdateCacheLock(cacheDir,async()=>{let existing=readNativeUpdateCache(cacheDir);await atomicWriteCache(cacheDir,{...existing,discoveryStartedAt:now,expireAt:now+NATIVE_UPDATE_CHECK_INTERVAL,staged:existing?.selectProduction===!0?existing.staged===!0:!0})})}async function restoreNativeUpdateAfterDiscoveryFailure({cacheDir=(0,import_xdg_app_paths.default)("com.vercel.cli").cache()}={}){await withNativeUpdateCacheLock(cacheDir,async()=>{let cache=readNativeUpdateCache(cacheDir);cache?.version&&await atomicWriteCache(cacheDir,{...cache,discoveryStartedAt:void 0,staged:!1})})}async function markNativeUpdateStaged(version,{cacheDir=(0,import_xdg_app_paths.default)("com.vercel.cli").cache(),selectedProduction=!1}={}){await withNativeUpdateCacheLock(cacheDir,async()=>{let cache=readNativeUpdateCache(cacheDir);cache?.version===version&&(cache.selectProduction!==!0||selectedProduction)&&await atomicWriteCache(cacheDir,{...cache,discoveryStartedAt:void 0,selectProduction:!1,staged:!0})})}function isWithinInstallRoot(executablePath,installRoot){let pathFromRoot=relative2(resolve2(installRoot),resolve2(executablePath));return pathFromRoot!==""&&pathFromRoot!==".."&&!pathFromRoot.startsWith(`..${process.platform==="win32"?"\\":"/"}`)&&!isAbsolute(pathFromRoot)}function scheduleNativeAutoUpdate(client,exitCode,{cacheDir=(0,import_xdg_app_paths.default)("com.vercel.cli").cache(),executablePath=process.execPath,installRoot=getInstallRoot(),now=Date.now()}={}){if(exitCode!==0||import_ci_info.default.isCI||client.isAgent||client.nonInteractive||isNativeUpdateChild()||!isNativeBinaryInstall()||!isWithinInstallRoot(executablePath,installRoot))return;let cache=readNativeUpdateCache(cacheDir);if(!isNativeAutoUpdateEnabled(client.config)&&cache?.selectProduction!==!0)return;if(!cache?.expireAt||cache.expireAt<=now){spawnNativeUpdateCheck();return}let abandonedDiscovery=!!(cache.version&&cache.staged===!0&&cache.discoveryStartedAt&&cache.discoveryStartedAt+NATIVE_UPDATE_DISCOVERY_LEASE<=now);cache.version&&(cache.staged!==!0||abandonedDiscovery)&&spawnNativeUpdateChild(cache.version,cache.selectProduction===!0)}var import_ci_info2=__toESM(require_ci_info(),1);function isAutoUpdateEnabled(config){return config.updates?.auto===!0}function hasAutoUpdatePreference(config){return typeof config.updates?.auto=="boolean"}function setAutoUpdate(client,enabled){client.config={...client.config,updates:{...client.config.updates,auto:enabled}},writeToConfigFile(client.config)}async function canAutoUpdate(client,exitCode,command){return isNativeBinaryInstall()||!isAutoUpdateEnabled(client.config)||exitCode!==0||import_ci_info2.default.isCI||client.nonInteractive||client.isAgent||command==="upgrade"?!1:isGlobal()}var import_chalk=__toESM(require_source(),1),import_strip_ansi=__toESM(require_strip_ansi(),1),border=["\u2500","\u256D","\u256E","\u2502","\u2502","\u2570","\u256F"],nothing=["\u2500","","","","","",""];function box(message,{borderColor,padding=1,textAlignment="center",terminalColumns:cols=process.stdout.columns||process.env.COLUMNS&&parseInt(process.env.COLUMNS,10)||80}={}){let lines=message.split(/\r?\n/).map(line=>[line,(0,import_strip_ansi.default)(line).length]),maxLine=lines.reduce((p,[,len])=>Math.max(p,len),0),borderColorFn=borderColor&&import_chalk.default[borderColor]||import_chalk.default.yellow,clampedSidePadding=Math.max(1,padding*3),narrowMode=maxLine+2+clampedSidePadding*2>cols,sidePadding=narrowMode?0:clampedSidePadding,innerWidth=Math.min(maxLine+sidePadding*2,cols),[hr,topLeft,topRight,left,right,bottomLeft,bottomRight]=narrowMode?nothing:border,spacerRow=narrowMode?`
|
|
23
23
|
`.repeat(padding):`${borderColorFn(`${left}${" ".repeat(innerWidth)}${right}`)}
|
|
24
24
|
`.repeat(padding),renderLine=([line,len])=>{let leftPadding=0,rightPadding=0;return narrowMode||(leftPadding=sidePadding,rightPadding=sidePadding,textAlignment==="center"?(leftPadding+=Math.floor((maxLine-len)/2),rightPadding+=maxLine-len-leftPadding+sidePadding):textAlignment==="right"?leftPadding+=maxLine-len:textAlignment==="left"&&(rightPadding+=maxLine-len)),borderColorFn(left)+" ".repeat(leftPadding)+line+" ".repeat(rightPadding)+borderColorFn(right)};return borderColorFn(`${topLeft}${hr.repeat(innerWidth)}${topRight}`)+`
|
|
@@ -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{humanizeReference,renderAlertTable}from"./chunk-7PNYOSDU.js";import{formatDate}from"./chunk-6PFC3KWQ.js";import{truncateEnd,truncateMiddle}from"./chunk-MBL6TXEJ.js";import{buildCommandWithGlobalFlags,quoteArg}from"./chunk-
|
|
7
|
+
import{humanizeReference,renderAlertTable}from"./chunk-7PNYOSDU.js";import{formatDate}from"./chunk-6PFC3KWQ.js";import{truncateEnd,truncateMiddle}from"./chunk-MBL6TXEJ.js";import{buildCommandWithGlobalFlags,quoteArg}from"./chunk-BX5KDMLT.js";import{printAlignedLabel}from"./chunk-YMM3VY3J.js";import{output_manager_default}from"./chunk-EWWFNMPZ.js";import{require_source}from"./chunk-U7KCDTCH.js";import{__toESM}from"./chunk-6L236MNA.js";var import_chalk=__toESM(require_source(),1);function formatBoolean(value){return value?"yes":"no"}function formatOperator(operator){return{gt:">",gte:">=",lt:"<",lte:"<="}[operator]??operator}function formatPublicRuleScope(rule){let scope=rule.ruleScope;return scope.type==="all"?"all projects":scope.type==="project"?`project: ${scope.projectId}`:`${scope.type}: ${scope.projectIds.join(", ")}`}function formatMetricSelection(metric){let modifiers=[metric.per?`per ${metric.per}`:void 0,metric.normalize?`normalize ${metric.normalize}`:void 0,metric.dimensions?.length?`dimensions ${metric.dimensions.join(", ")}`:void 0].filter(Boolean);return`${metric.aggregation} ${metric.metric}${modifiers.length?` (${modifiers.join("; ")})`:""}`}function formatCustomTrigger(trigger){let minimum=trigger.minimum?`; minimum ${trigger.minimum.output} >= ${trigger.minimum.threshold}`:"";return trigger.type==="anomaly"?`${trigger.output} anomaly at ${trigger.standardDeviations} standard deviations${minimum}`:`${trigger.output} ${formatOperator(trigger.operator)} ${trigger.threshold}${minimum}`}function formatCustomCondition(rule){if(!rule.querySupported)return"Query unavailable via API";let query=rule.evaluation.query,output=query.outputs[0];return`${query.formulas?.[output]?`${output} = ${query.formulas[output]}`:query.metrics[output]?formatMetricSelection(query.metrics[output]):output}; ${formatCustomTrigger(rule.trigger)}; ${rule.evaluation.window}`}function formatBuiltInCondition(rule){return`${rule.triggers.mode==="all"?"all triggers":rule.triggers.items.map(trigger=>humanizeReference(trigger.type)).join(", ")}; minimum ${rule.matchMinimumSeverityLevel}`}function formatRuleCondition(rule){return rule.type==="built-in"?formatBuiltInCondition(rule):formatCustomCondition(rule)}function printRules(rules){let rows=[["Name","Rule ID","Type","Scope","Condition"].map(header=>import_chalk.default.cyan(header)),...rules.map(rule=>[import_chalk.default.bold(truncateEnd(rule.name,36)),import_chalk.default.dim(rule.id),rule.isDefault?`${rule.type} (default)`:rule.type,truncateMiddle(formatPublicRuleScope(rule),38),truncateEnd(formatRuleCondition(rule),72)])];output_manager_default.print(`
|
|
8
8
|
${renderAlertTable(rows,2)}
|
|
9
9
|
`)}function commonRows(rule){return[["Name",rule.name],["Rule ID",rule.id],["Type",rule.type],["Scope",formatPublicRuleScope(rule)],["Default",formatBoolean(rule.isDefault)],...rule.createdAt?[["Created",formatDate(rule.createdAt)]]:[],...rule.updatedAt?[["Updated",formatDate(rule.updatedAt)]]:[]]}function notificationRows(rule){return[["Team owner notifications",formatBoolean(rule.notificationSettings.enableTeamOwnerNotifications)],...rule.notificationSettings.incidentIoRoutingKey?[["Incident.io routing key",rule.notificationSettings.incidentIoRoutingKey]]:[]]}function printBuiltInRule(rule){output_manager_default.print(`${import_chalk.default.cyan("Built-in conditions")}
|
|
10
10
|
|
|
@@ -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{isNativeBinaryInstall}from"./chunk-7T6TL3GQ.js";import{require_lib}from"./chunk-
|
|
7
|
+
import{isNativeBinaryInstall}from"./chunk-7T6TL3GQ.js";import{require_lib}from"./chunk-UB37A37M.js";import{packageName}from"./chunk-FI772UVH.js";import{__toESM}from"./chunk-6L236MNA.js";var import_fs_extra=__toESM(require_lib(),1);import{join as join2,sep}from"path";import{execFile}from"child_process";import{promisify}from"util";import{tmpdir}from"node:os";import{resolve}from"node:path";var trustedUpgradeEnvironment=Object.freeze({...process.env}),trustedUpgradeDirectory=resolve(tmpdir());import{join}from"path";var packageManagers={npm:{metadataArgs:specifier=>["view",specifier,"version","--json","--global"],installArgs:specifier=>["i","-g",specifier],releaseAgeBypassArgs:["--min-release-age=0"],globalDetection:{args:["root","-g"],packageDir:(root,pkg)=>join(root,pkg)}},pnpm:{metadataArgs:specifier=>["view",specifier,"version","--json"],installArgs:specifier=>["i","-g",specifier],releaseAgeBypassArgs:["--config.minimumReleaseAge=0"],globalDetection:{args:pkg=>["list","-g",pkg,"--depth=0","--json"],packageDir:(output,pkg)=>{try{let projects=JSON.parse(output),path=(Array.isArray(projects)?projects[0]:projects)?.dependencies?.[pkg]?.path;return typeof path=="string"?path:void 0}catch{return}}}},yarn:{metadataArgs:specifier=>["info",specifier.endsWith("@latest")?specifier.slice(0,-7):specifier,"version","--json"],installArgs:specifier=>["global","add",specifier],releaseAgeBypassArgs:[],globalDetection:{args:["--silent","global","dir"],packageDir:(root,pkg)=>join(root,"node_modules",pkg)}},bun:{metadataArgs:specifier=>["info",specifier,"version","--json","--global"],installArgs:specifier=>["add","-g",specifier],releaseAgeBypassArgs:[],globalDetection:{args:["pm","bin","-g"],binaryNames:["vercel","vc"]}}};function getUpgradePackageManager(name){return packageManagers[name]}var nativePackageName="@vercel/vc-native",execFileAsync=promisify(execFile),UnsupportedUpgradeInstallError=class extends Error{},globalCliTypes=["npm","pnpm","yarn","bun"];async function getPackageManagerGlobalRoot(cliType,pkg,env=trustedUpgradeEnvironment){try{let detectionArgs=getUpgradePackageManager(cliType).globalDetection.args,{stdout}=await execFileAsync(cliType,typeof detectionArgs=="function"?detectionArgs(pkg):detectionArgs,{encoding:"utf8",windowsHide:!0,cwd:trustedUpgradeDirectory,timeout:15e3,env});return stdout.trim()||null}catch{return null}}async function detectGlobalPackageManager(installPath,pkg,cliTypes=globalCliTypes,env=trustedUpgradeEnvironment){for(let cliType of cliTypes){let root=await getPackageManagerGlobalRoot(cliType,pkg,env);if(!root)continue;let detection=getUpgradePackageManager(cliType).globalDetection;if(detection.packageDir)try{let packageDir=detection.packageDir(root,pkg);if(!packageDir)continue;let resolvedPackageDir=await(0,import_fs_extra.realpath)(packageDir);if(installPath===resolvedPackageDir||installPath.startsWith(resolvedPackageDir+sep))return cliType}catch{}for(let binary of detection.binaryNames||[])try{let target=await(0,import_fs_extra.realpath)(join2(root,binary));if(target===installPath||target.startsWith(installPath+sep)||installPath.startsWith(target+sep))return cliType;let entrypoint=await(0,import_fs_extra.realpath)(process.argv[1]);if(!isNativeBinaryInstall()&&target===entrypoint)return cliType}catch{}}return null}async function resolveInstall(env=trustedUpgradeEnvironment){let nativeInstall=isNativeBinaryInstall(),pkg=nativeInstall?nativePackageName:packageName,installPath=nativeInstall?process.execPath:process.argv[1];try{installPath=await(0,import_fs_extra.realpath)(installPath)}catch{throw new UnsupportedUpgradeInstallError("Could not resolve this Vercel CLI installation. Update it with the package manager that installed it.")}let packageManager=await detectGlobalPackageManager(installPath,pkg,globalCliTypes,env);if(!packageManager)throw new UnsupportedUpgradeInstallError("Could not detect a supported global npm, pnpm, Yarn, or Bun installation of Vercel CLI. Update it with the package manager that installed it.");return{packageManager,global:!0,assumed:!1}}async function isGlobal(){try{return await resolveInstall(),!0}catch{return!1}}async function getUpdateCommandInfo(env=trustedUpgradeEnvironment){let nativeInstall=isNativeBinaryInstall(),pkg=nativeInstall?nativePackageName:packageName,{packageManager}=await resolveInstall(env),args=getUpgradePackageManager(packageManager).installArgs(`${pkg}@latest`),force=nativeInstall&&packageManager==="npm"?" --force":"",allowBuild=pnpmAllowBuildFlag(packageManager,nativeInstall?nativePackageName:"esbuild");return{command:`${packageManager} ${args.join(" ")}${force}${allowBuild}`,global:!0,packageManager,assumed:!1}}function pnpmAllowBuildFlag(cliType,pkg){return cliType==="pnpm"?` --allow-build=${pkg}`:""}async function getUpdateCommand(){return(await getUpdateCommandInfo()).command}export{trustedUpgradeEnvironment,trustedUpgradeDirectory,getUpgradePackageManager,isGlobal,getUpdateCommandInfo,getUpdateCommand};
|
|
@@ -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{quoteArg}from"./chunk-
|
|
7
|
+
import{quoteArg}from"./chunk-BX5KDMLT.js";import{arg_common_default,stripSensitiveAuthArgs}from"./chunk-JAJW3P42.js";import{packageName}from"./chunk-FI772UVH.js";import{__commonJS,__toESM}from"./chunk-6L236MNA.js";var require_arg=__commonJS({"../../node_modules/.pnpm/arg@5.0.0/node_modules/arg/index.js"(exports,module){var flagSymbol=Symbol("arg flag"),ArgError=class _ArgError extends Error{constructor(msg,code){super(msg),this.name="ArgError",this.code=code,Object.setPrototypeOf(this,_ArgError.prototype)}};function arg2(opts,{argv=process.argv.slice(2),permissive=!1,stopAtPositional=!1}={}){if(!opts)throw new ArgError("argument specification object is required","ARG_CONFIG_NO_SPEC");let result={_:[]},aliases={},handlers={};for(let key of Object.keys(opts)){if(!key)throw new ArgError("argument key cannot be an empty string","ARG_CONFIG_EMPTY_KEY");if(key[0]!=="-")throw new ArgError(`argument key must start with '-' but found: '${key}'`,"ARG_CONFIG_NONOPT_KEY");if(key.length===1)throw new ArgError(`argument key must have a name; singular '-' keys are not allowed: ${key}`,"ARG_CONFIG_NONAME_KEY");if(typeof opts[key]=="string"){aliases[key]=opts[key];continue}let type=opts[key],isFlag=!1;if(Array.isArray(type)&&type.length===1&&typeof type[0]=="function"){let[fn]=type;type=(value,name,prev=[])=>(prev.push(fn(value,name,prev[prev.length-1])),prev),isFlag=fn===Boolean||fn[flagSymbol]===!0}else if(typeof type=="function")isFlag=type===Boolean||type[flagSymbol]===!0;else throw new ArgError(`type missing or not a function or valid array type: ${key}`,"ARG_CONFIG_VAD_TYPE");if(key[1]!=="-"&&key.length>2)throw new ArgError(`short argument keys (with a single hyphen) must have only one character: ${key}`,"ARG_CONFIG_SHORTOPT_TOOLONG");handlers[key]=[type,isFlag]}for(let i=0,len=argv.length;i<len;i++){let wholeArg=argv[i];if(stopAtPositional&&result._.length>0){result._=result._.concat(argv.slice(i));break}if(wholeArg==="--"){result._=result._.concat(argv.slice(i+1));break}if(wholeArg.length>1&&wholeArg[0]==="-"){let separatedArguments=wholeArg[1]==="-"||wholeArg.length===2?[wholeArg]:wholeArg.slice(1).split("").map(a=>`-${a}`);for(let j=0;j<separatedArguments.length;j++){let arg3=separatedArguments[j],[originalArgName,argStr]=arg3[1]==="-"?arg3.split(/=(.*)/,2):[arg3,void 0],argName=originalArgName;for(;argName in aliases;)argName=aliases[argName];if(!(argName in handlers))if(permissive){result._.push(arg3);continue}else throw new ArgError(`unknown or unexpected option: ${originalArgName}`,"ARG_UNKNOWN_OPTION");let[type,isFlag]=handlers[argName];if(!isFlag&&j+1<separatedArguments.length)throw new ArgError(`option requires argument (but was followed by another short argument): ${originalArgName}`,"ARG_MISSING_REQUIRED_SHORTARG");if(isFlag)result[argName]=type(!0,argName,result[argName]);else if(argStr===void 0){if(argv.length<i+2||argv[i+1].length>1&&argv[i+1][0]==="-"&&!(argv[i+1].match(/^-?\d*(\.(?=\d))?\d*$/)&&(type===Number||typeof BigInt<"u"&&type===BigInt))){let extended=originalArgName===argName?"":` (alias for ${argName})`;throw new ArgError(`option requires argument: ${originalArgName}${extended}`,"ARG_MISSING_REQUIRED_LONGARG")}result[argName]=type(argv[i+1],argName,result[argName]),++i}else result[argName]=type(argStr,argName,result[argName])}}else result._.push(wholeArg)}return result}arg2.flag=fn=>(fn[flagSymbol]=!0,fn);arg2.COUNT=arg2.flag((v,name,existingCount)=>(existingCount||0)+1);arg2.ArgError=ArgError;module.exports=arg2}});var import_arg=__toESM(require_arg(),1);function suggestCorrection(input,choices){if(input.replace(/^-+/,"").length<3||choices.includes(input))return;let matches=[...new Set(choices)].filter(choice=>{if(Math.abs(input.length-choice.length)>1)return!1;let i=0;for(;i<input.length&&input[i]===choice[i];)i++;return input.length===choice.length?input.slice(i+1)===choice.slice(i+1)||input[i]===choice[i+1]&&input[i+1]===choice[i]&&input.slice(i+2)===choice.slice(i+2):input.length>choice.length?input.slice(i+1)===choice.slice(i):input.slice(i)===choice.slice(i+1)});return matches.length===1?matches[0]:void 0}var SAFE_VALUE_FLAGS=new Set(["--cwd","--scope","--team","-S","-T","--project","-p","--format","--environment","--since","--until","--limit"]),READ_COMMANDS=new Set(["inspect","list","ls","schema","whoami"]);function buildCorrectedCommand(argv,from,to,flagsSpecification={}){let corrected=argv.slice(2),spec={...arg_common_default(),...flagsSpecification},valuelessFlags=new Set,takesValue=new Set;for(let[name,value]of Object.entries(spec))((typeof value=="string"?spec[value]:value)===Boolean?valuelessFlags:takesValue).add(name);for(let i=0;i<corrected.length;i++){let value=corrected[i];if(value==="--")break;if(value===from||value.startsWith(`${from}=`)){corrected[i]=to+value.slice(from.length);break}takesValue.has(value)&&i++}let args=stripSensitiveAuthArgs(corrected).filter(arg2=>!/^-t[^-=]/.test(arg2)),out=[],positionals=0,readCommand=!1;for(let i=0;i<args.length;i++){let value=args[i];if(value==="--"){out.push("--","<argument>");break}if(value.startsWith("-")){if(/^-[A-Za-z][^=].+/.test(value)&&!value.startsWith("--")){let name2=value.slice(0,2);out.push(name2,SAFE_VALUE_FLAGS.has(name2)?value.slice(2):"<value>");continue}let equals=value.indexOf("="),name=equals<0?value:value.slice(0,equals);equals>=0?out.push(`${name}=${SAFE_VALUE_FLAGS.has(name)||valuelessFlags.has(name)&&/^(true|false)$/.test(value.slice(equals+1))?value.slice(equals+1):"<value>"}`):(out.push(name),!valuelessFlags.has(name)&&i+1<args.length&&(takesValue.has(name)||!args[i+1].startsWith("-"))&&(i++,out.push(SAFE_VALUE_FLAGS.has(name)?args[i]:"<value>")))}else positionals++,positionals<=2&&(readCommand||=READ_COMMANDS.has(value)),out.push(positionals<=2||readCommand?value:"<argument>")}return[packageName,...out].map(quoteArg).join(" ")}var argumentErrors=new WeakSet;function isArgumentError(error){return error instanceof Error&&argumentErrors.has(error)}function parseWithSuggestions(args,spec,options){try{return(0,import_arg.default)(spec,{...options,argv:args})}catch(error){if(error instanceof Error&&"code"in error&&error.code==="ARG_UNKNOWN_OPTION"){let err=error,option=/unknown or unexpected option: (--?[A-Za-z0-9-]+)$/.exec(err.message)?.[1];option&&(argumentErrors.add(err),err.invalidOption=option,err.allowedOptions=Object.keys(spec).filter(name=>name.startsWith("--")).sort(),err.suggestedOption=suggestCorrection(option,err.allowedOptions),err.flagsSpecification=spec)}throw error}}function getArgs(argv,argsOptions,argOptions={}){return parseWithSuggestions(argv,Object.assign({},arg_common_default(),argsOptions),argOptions)}function parseArguments(args,flagsSpecification,parserOptions={}){let{_:positional,...rest}=parseWithSuggestions(args,Object.assign({},arg_common_default(),flagsSpecification),parserOptions);return{args:positional,flags:rest}}export{suggestCorrection,buildCorrectedCommand,isArgumentError,getArgs,parseArguments};
|
|
@@ -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{buildCorrectedCommand,isArgumentError}from"./chunk-
|
|
7
|
+
import{buildCorrectedCommand,isArgumentError}from"./chunk-T4AZ3U7O.js";import{getErrorRecovery,shouldEmitNonInteractiveCommandError,trackAgentError,writeAgentError}from"./chunk-BX5KDMLT.js";import{InvalidToken,parseRetryAfterHeaderAsMillis,require_bytes}from"./chunk-LKI6FRNM.js";import{getCommandName}from"./chunk-FI772UVH.js";import{output_manager_default}from"./chunk-EWWFNMPZ.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}function toEnumerableError(err){let enumerable={};enumerable.name=err.name;for(let key of Object.getOwnPropertyNames(err))enumerable[key]=err[key];return enumerable}function printError(error2,client,options={}){typeof error2=="string"&&(error2=new Error(error2));let apiError=error2,{message,stack,status,code,sizeLimit}=apiError,authenticationError=error2 instanceof InvalidToken||status===401,displayMessage=authenticationError?new InvalidToken(client?.authConfig.tokenSource??(error2 instanceof InvalidToken?error2.tokenSource:void 0)).message:apiError.serverMessage||message,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=authenticationError?"not_authorized":status===403?"forbidden":status===402?"payment_required":status===401?"not_authorized":status===429?"rate_limited":code==="ARG_UNKNOWN_OPTION"?"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||authenticationError||options.json||argumentError?.allowedOptions)){let payload={...recovery,status:"error",reason,message:displayMessage,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(options.json||shouldEmitNonInteractiveCommandError(client)){output_manager_default.stopSpinner(),writeAgentError(client,payload);return}trackAgentError(client,payload)}if(authenticationError){output_manager_default.stopSpinner(),output_manager_default.fatal(displayMessage);return}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,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{MISSING_BOTH_MESSAGE}from"./chunk-
|
|
7
|
+
import{MISSING_BOTH_MESSAGE}from"./chunk-Q3OG3SC4.js";import{RULE_ENVIRONMENTS}from"./chunk-IVWPQYIH.js";import{resolveProjectContext}from"./chunk-GPX6W4GB.js";import{AGENT_REASON,AGENT_STATUS}from"./chunk-EQP3SW72.js";import{detectExplicitScope}from"./chunk-77GUJ4JC.js";import{printError}from"./chunk-TBBU37TD.js";import{outputAgentError}from"./chunk-BX5KDMLT.js";import{isAPIError}from"./chunk-LKI6FRNM.js";import{output_manager_default}from"./chunk-EWWFNMPZ.js";function messageFor(err){return isAPIError(err)?err.serverMessage||err.message:err instanceof Error?err.message:String(err)}function handleTracingApiError(client,err){if(client.nonInteractive){let status=isAPIError(err)?err.status:void 0;outputAgentError(client,{status:AGENT_STATUS.ERROR,reason:status===403?AGENT_REASON.PERMISSION_DENIED:status===404?AGENT_REASON.NOT_FOUND:AGENT_REASON.API_ERROR,message:messageFor(err)})}return isAPIError(err)&&err.status===403?(output_manager_default.error(messageFor(err)),1):(printError(err),1)}function configError(client,reason,message){return client.nonInteractive&&outputAgentError(client,{status:AGENT_STATUS.ERROR,reason,message}),output_manager_default.error(message),1}function invalidArguments(client,message){return configError(client,AGENT_REASON.INVALID_ARGUMENTS,message)}function ruleNotFound(client,message){return configError(client,AGENT_REASON.NOT_FOUND,message)}function confirmationRequired(client,message,next){return outputAgentError(client,{status:AGENT_STATUS.ERROR,reason:AGENT_REASON.CONFIRMATION_REQUIRED,message,userActionRequired:!0,next}),output_manager_default.error(message),1}function writeConfigJson(client,{project,bare,envelope,message,next}){if(!client.nonInteractive){client.stdout.write(`${JSON.stringify(bare,null,2)}
|
|
8
8
|
`);return}client.stdout.write(`${JSON.stringify({status:AGENT_STATUS.OK,projectId:project.id,projectName:project.name,...envelope,message,next},null,2)}
|
|
9
9
|
`)}var RULE_LIMIT=10,MIN_SAMPLE_RATE=1,MAX_SAMPLE_RATE=100;function isRuleEnvironment(value){return RULE_ENVIRONMENTS.includes(value)}var ENVIRONMENT_ERROR=`\`environment\` must be one of: ${RULE_ENVIRONMENTS.join(", ")}.`,RATE_ERROR=`\`rate\` must be a whole number from ${MIN_SAMPLE_RATE} to ${MAX_SAMPLE_RATE}.`,EMPTY_PATH_ERROR="`requestPath` cannot be empty.";function parseSampleRate(value){if(!/^\d+$/.test(value.trim()))return;let rate=Number(value);return rate>=MIN_SAMPLE_RATE&&rate<=MAX_SAMPLE_RATE?rate:void 0}function toRow(rule){return{environment:rule.env??"any",requestPath:rule.requestPath??null,sampleRate:Math.round(rule.rate*100)}}function toApiRate(sampleRate){return sampleRate/100}function toRule(row){return{rate:toApiRate(row.sampleRate),...row.environment==="any"?{}:{env:row.environment},...row.requestPath===null?{}:{requestPath:row.requestPath}}}var ALL_PATHS_LABEL="(all paths)";function formatPath(requestPath){return requestPath??ALL_PATHS_LABEL}function formatRate(sampleRate){return`${sampleRate}%`}function formatRuleTarget(environment,requestPath){return`${environment} ${formatPath(requestPath)}`}function formatRuleLine(row){return`${formatRuleTarget(row.environment,row.requestPath)} ${formatRate(row.sampleRate)}`}var COMMAND_WORD_COUNT=3;function subcommandArguments(positional){return positional.slice(COMMAND_WORD_COUNT)}function hasSameKey(a,b){return a.environment===b.environment&&a.requestPath===b.requestPath}async function readProjectTracing({client,teamId,projectId}){let project=await client.fetch(`/v9/projects/${encodeURIComponent(projectId)}`,{accountId:teamId}),tracing=project.tracing??null;return{project,tracing,entries:(tracing?.samplingRules??[]).map(rule=>({rule,row:toRow(rule)}))}}async function writeSamplingRules({client,teamId,projectId,tracing,rules}){let body={tracing:{...tracing??{},samplingRules:rules}};await client.fetch(`/v9/projects/${encodeURIComponent(projectId)}`,{accountId:teamId,method:"PATCH",body})}async function resolveConfigScope(client,flags){let link=await resolveProjectContext({client,projectNameOrId:flags.project});return link.status==="error"?{exitCode:link.exitCode}:link.status==="not_linked"?(output_manager_default.error(MISSING_BOTH_MESSAGE),{exitCode:1}):flags.project===void 0&&detectExplicitScope(client)&&link.org.id!==client.config.currentTeam?(output_manager_default.error(`The linked project ${link.project.name} belongs to ${link.org.slug||link.org.id}, which is not the scope that was passed. Pass --project <name> to act on a project in that scope.`),{exitCode:1}):{teamId:link.org.id,projectId:link.project.id}}export{handleTracingApiError,invalidArguments,ruleNotFound,confirmationRequired,writeConfigJson,RULE_LIMIT,isRuleEnvironment,ENVIRONMENT_ERROR,RATE_ERROR,EMPTY_PATH_ERROR,parseSampleRate,toApiRate,toRule,formatPath,formatRate,formatRuleTarget,formatRuleLine,subcommandArguments,hasSameKey,readProjectTracing,writeSamplingRules,resolveConfigScope};
|
|
@@ -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{canPrompt}from"./chunk-XD2LZRBS.js";import{outputError}from"./chunk-
|
|
7
|
+
import{canPrompt}from"./chunk-XD2LZRBS.js";import{outputError}from"./chunk-FA6O7FPC.js";import{readFileSync}from"node:fs";function readAllStandardInput(stdin){return stdin.isTTY?Promise.resolve(""):new Promise(resolve=>{let chunks=[],timer=setTimeout(()=>{chunks.length===0&&(cleanup(),resolve(""))},500),onData=chunk=>{chunks.push(String(chunk))},onEnd=()=>{cleanup(),resolve(chunks.join(""))};function cleanup(){clearTimeout(timer),stdin.off("data",onData),stdin.off("end",onEnd)}stdin.setEncoding("utf8"),stdin.on("data",onData),stdin.on("end",onEnd)})}async function resolveMessageContent(client,flags,jsonOutput){if(flags.message!==void 0&&flags.file!==void 0)return outputError(client,jsonOutput,"CONFLICTING_CONTENT","Use either --message or --file, not both.");if(flags.message!==void 0)return flags.message;if(flags.file!==void 0){if(flags.file==="-"){let piped2=await readAllStandardInput(client.stdin);return piped2||outputError(client,jsonOutput,"MISSING_CONTENT","No content received on stdin for `--file -`.")}try{return readFileSync(flags.file,"utf8")}catch(err){return outputError(client,jsonOutput,"FILE_READ_ERROR",`Could not read ${flags.file}: ${err instanceof Error?err.message:String(err)}`)}}let piped=await readAllStandardInput(client.stdin);if(piped)return piped;if(!flags.hasAttachments){if(canPrompt(client)&&!jsonOutput){let text=await client.input.text({message:"Comment message:"});if(text)return text}return outputError(client,jsonOutput,"MISSING_CONTENT",'No content provided. Pass -m <text>, --file <path>, or pipe stdin (e.g. `echo "LGTM" | vercel comments reply <thread>`).')}}export{resolveMessageContent};
|