vercel 59.20.0 → 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-CC6U36WJ.js → add-4XDHZES6.js} +1 -1
- package/dist/chunks/{add-PSEVULRF.js → add-DTHT6FBK.js} +1 -1
- package/dist/chunks/{add-UO2IFTKH.js → add-ZQXW2ONT.js} +1 -1
- package/dist/chunks/{build-G54Y245T.js → build-JORIG5OD.js} +1 -1
- package/dist/chunks/chunk-2EY7NJ5E.js +9 -0
- package/dist/chunks/{chunk-IESZKIFF.js → chunk-2U7K4KDF.js} +1 -1
- package/dist/chunks/{chunk-GWPIATTW.js → chunk-3GUBYJN6.js} +1 -1
- package/dist/chunks/{chunk-YHN4IZVJ.js → chunk-3RLCABDN.js} +1 -1
- package/dist/chunks/{chunk-CTO5XEIQ.js → chunk-3VRLKRIC.js} +1 -1
- package/dist/chunks/{chunk-IERVS47L.js → chunk-4WSAOLBH.js} +1 -1
- package/dist/chunks/{chunk-EHEMFUGQ.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-6V3JGAVJ.js → chunk-77GUJ4JC.js} +1 -1
- package/dist/chunks/{chunk-PNRWNSM2.js → chunk-7B5NNJ2P.js} +1 -1
- package/dist/chunks/{chunk-QPCDEH6H.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-GUSSSCV7.js → chunk-B7FOQCPU.js} +1 -1
- package/dist/chunks/{chunk-Q3LIZ6SZ.js → chunk-BSOZ3UP2.js} +1 -1
- package/dist/chunks/{chunk-WR5OOWD6.js → chunk-BX5KDMLT.js} +1 -1
- package/dist/chunks/{chunk-HOD3FQAX.js → chunk-CGXXEPYI.js} +1 -0
- package/dist/chunks/{chunk-YWFECCBH.js → chunk-CKX6OH4B.js} +1 -1
- package/dist/chunks/{chunk-4Q2FGJAG.js → chunk-CLKTBUI7.js} +1 -1
- package/dist/chunks/{chunk-EGG7SPNM.js → chunk-DQ2KI6FO.js} +1 -1
- 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-3XIEKCNF.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-X446JLEO.js → chunk-GPX6W4GB.js} +1 -1
- package/dist/chunks/{chunk-NPMNS7IG.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-LKVMIJCF.js → chunk-I5CXJNW4.js} +1 -1
- package/dist/chunks/{chunk-5ZIZD5ZG.js → chunk-J5X5YRBH.js} +1 -1
- package/dist/chunks/{chunk-NYEPIN3U.js → chunk-JOH6CUOG.js} +1 -1
- package/dist/chunks/{chunk-CFY5RS7I.js → chunk-JOV4G2LZ.js} +1 -1
- package/dist/chunks/{chunk-J2ONOQCQ.js → chunk-JWC64GEW.js} +1 -1
- package/dist/chunks/{chunk-DBBMJTPG.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-NUVOJI4D.js → chunk-NZGOQUNN.js} +1 -1
- package/dist/chunks/{chunk-BQU3N4EK.js → chunk-PQ7YG2JU.js} +1 -1
- package/dist/chunks/{chunk-QFFD4LBE.js → chunk-PQTP73R4.js} +1 -1
- package/dist/chunks/{chunk-DWSG55I2.js → chunk-Q3OG3SC4.js} +1 -1
- package/dist/chunks/{chunk-7NYQ7CTP.js → chunk-R3B67TKQ.js} +1 -1
- package/dist/chunks/{chunk-ONOSMF2T.js → chunk-RJOVMJZI.js} +1 -1
- package/dist/chunks/{chunk-PIKD5KTH.js → chunk-SOQ5DE44.js} +1 -1
- package/dist/chunks/{chunk-WDO3QBQI.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-XNQR2W4A.js → chunk-TX4PCSTY.js} +1 -1
- package/dist/chunks/{chunk-2Q47GHFX.js → chunk-U6N2RNDI.js} +1 -1
- package/dist/chunks/{chunk-6ARDCI6T.js → chunk-UB37A37M.js} +4 -4
- package/dist/chunks/{chunk-74CMQMYR.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-MNACJRE7.js → chunk-VG2V4NHC.js} +1 -1
- package/dist/chunks/{chunk-BW24TEUN.js → chunk-VIR3KDCQ.js} +1 -1
- package/dist/chunks/{chunk-QQNFAXDX.js → chunk-W27LUVFI.js} +1 -1
- package/dist/chunks/{chunk-KEFIUUAJ.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-TKBORMUF.js → chunk-WKZ6JSGZ.js} +1 -1
- package/dist/chunks/{chunk-TM3W2CAF.js → chunk-WXT35K53.js} +1 -1
- package/dist/chunks/{chunk-JDR2WXM4.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-TJQM33RO.js → clear-74Z2GBIF.js} +1 -1
- package/dist/chunks/{compile-vercel-config-UQGJ4WJF.js → compile-vercel-config-MRWI6INC.js} +1 -1
- package/dist/chunks/config-7SVPPW7T.js +7 -0
- package/dist/chunks/{config-SRY5IPK6.js → config-UYP3XEDY.js} +1 -1
- package/dist/chunks/{connect-git-provider-LSTDI4TC.js → connect-git-provider-P3SGOW6X.js} +1 -1
- package/dist/chunks/{constants-NCE2LWSS.js → constants-G4UYVLOF.js} +1 -1
- package/dist/chunks/{delete-V45ALBXM.js → delete-E355MKDF.js} +1 -1
- package/dist/chunks/{delete-TSYNQ23W.js → delete-QFKW4O7R.js} +1 -1
- package/dist/chunks/{detect-projects-64MZJZ6M.js → detect-projects-J3VAJIQD.js} +1 -1
- package/dist/chunks/{detect-services-3DFPW53F.js → detect-services-JTGZ7NCQ.js} +1 -1
- package/dist/chunks/{disable-WD4S6HSS.js → disable-K4MMQGSO.js} +1 -1
- package/dist/chunks/{discard-KFBXLAVB.js → discard-ITZDMBFI.js} +1 -1
- package/dist/chunks/{edit-AWY54Q7X.js → edit-3V4C747E.js} +1 -1
- package/dist/chunks/{edit-TJ4JLJRE.js → edit-7IGZ4EH7.js} +1 -1
- package/dist/chunks/{enable-ANIHAF35.js → enable-4TJRZIE7.js} +1 -1
- package/dist/chunks/{exec-ZLT5KH2Z.js → exec-YH5WUJ4C.js} +1 -1
- package/dist/chunks/{export-RPFCJCOY.js → export-XJIKF2WX.js} +1 -1
- package/dist/chunks/{future-LU77KNDL.js → future-BB7OE645.js} +1 -1
- package/dist/chunks/{generate-cert-for-deploy-NVQ43MLT.js → generate-cert-for-deploy-A4TZHE2Y.js} +1 -1
- package/dist/chunks/{image-WWX3Q3GG.js → image-4UZ34VE5.js} +1 -1
- package/dist/chunks/{import-builders-FUR24WH3.js → import-builders-7BRUAJT2.js} +1 -1
- package/dist/chunks/{inspect-QVPDZHUE.js → inspect-2U47TXE3.js} +1 -1
- package/dist/chunks/{inspect-WIXPYMMS.js → inspect-FUJCRJTQ.js} +1 -1
- package/dist/chunks/{inspect-7LLKIX3Q.js → inspect-H3D3M4TY.js} +1 -1
- package/dist/chunks/{inspect-67J25RHR.js → inspect-QLPYWU6F.js} +1 -1
- package/dist/chunks/{inspect-YG2GUQH2.js → inspect-YZP2TUXW.js} +1 -1
- package/dist/chunks/{list-HKOHGU6B.js → list-AEKIXAC2.js} +1 -1
- package/dist/chunks/{list-UGNPHXFH.js → list-AO2NTDVE.js} +1 -1
- package/dist/chunks/{list-LY73G263.js → list-UGFJDLK3.js} +1 -1
- package/dist/chunks/{login-IMHVC657.js → login-GXL33UOO.js} +1 -1
- package/dist/chunks/{login-YQ7QPK4A.js → login-RMAISH4F.js} +1 -1
- package/dist/chunks/{logs-4GPA2QJ2.js → logs-HXT43YFY.js} +1 -1
- package/dist/chunks/{ls-MO2Y6TNW.js → ls-2GUHQ2QY.js} +1 -1
- package/dist/chunks/{ls-PSZDUCI4.js → ls-DLX6OKJD.js} +1 -1
- package/dist/chunks/{ls-XZYIM72L.js → ls-IFYHOVHI.js} +1 -1
- package/dist/chunks/{ls-IDH4SZXE.js → ls-LDTXN5NC.js} +1 -1
- package/dist/chunks/{ls-XZ25NS63.js → ls-MR4IEJXI.js} +1 -1
- package/dist/chunks/{ls-GXGGGB3C.js → ls-RYBY45PV.js} +1 -1
- package/dist/chunks/{ls-JAD3EACY.js → ls-T6LDBBIZ.js} +1 -1
- package/dist/chunks/{mutate-FKH7JHLN.js → mutate-NMAFXSIS.js} +1 -1
- package/dist/chunks/{notifications-JI6HIQYR.js → notifications-VDMQJUX4.js} +1 -1
- package/dist/chunks/{open-WVYJ6DJS.js → open-OYT4SXL7.js} +1 -1
- package/dist/chunks/{openapi-YEDROCHV.js → openapi-DKMCRF2V.js} +1 -1
- package/dist/chunks/{permissions-TALTFA2U.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-ZE5GEK7Q.js → publish-I7FUMJAU.js} +1 -1
- package/dist/chunks/pull-XCHJWKNY.js +7 -0
- package/dist/chunks/{purchase-domain-if-available-6HLN6HG2.js → purchase-domain-if-available-5HP57BPC.js} +1 -1
- package/dist/chunks/{push-ETAA3BQY.js → push-7H2NJAPB.js} +1 -1
- package/dist/chunks/{query-2FV3SCH5.js → query-TJ7WEORG.js} +1 -1
- package/dist/chunks/{reauthenticate-APC7ZYFC.js → reauthenticate-O6C2AW3J.js} +1 -1
- package/dist/chunks/{reorder-GHLKIK3C.js → reorder-JCS5LKA6.js} +1 -1
- package/dist/chunks/{reply-2PEJJCP7.js → reply-SFRIWOPK.js} +1 -1
- package/dist/chunks/{resolve-APTMIYGJ.js → resolve-WTQUYVKI.js} +1 -1
- package/dist/chunks/{restore-N6O2H27S.js → restore-K442WYIM.js} +1 -1
- package/dist/chunks/{rm-QJDB2QO6.js → rm-377WPSMT.js} +1 -1
- package/dist/chunks/{rm-CWEDAZXF.js → rm-576VOXTN.js} +1 -1
- package/dist/chunks/{rm-ZUOJPP33.js → rm-K2SG5TT7.js} +1 -1
- package/dist/chunks/{rm-Y3PIBNO3.js → rm-OUXMNCHX.js} +1 -1
- package/dist/chunks/{rm-ZWCGOTK3.js → rm-XFZMZILG.js} +1 -1
- package/dist/chunks/{routes-ZD7XUKLY.js → routes-IPGKJ2E4.js} +1 -1
- package/dist/chunks/{rule-inspect-AHQRHKO3.js → rule-inspect-MK7A5LPA.js} +1 -1
- package/dist/chunks/{rules-LFVEAZJ7.js → rules-4T3OHT34.js} +1 -1
- package/dist/chunks/{schema-ET4DYRVX.js → schema-PUOL7JUI.js} +1 -1
- package/dist/chunks/{schema-OKQUOZEH.js → schema-RIUBZXVC.js} +1 -1
- package/dist/chunks/{select-org-5OUQKTNI.js → select-org-F2A5JJFH.js} +1 -1
- package/dist/chunks/{set-OQCFBVJB.js → set-HNSMZTBW.js} +1 -1
- package/dist/chunks/setup-and-link-X44IODXA.js +7 -0
- package/dist/chunks/{tags-23ZFVGUC.js → tags-7CY2YR27.js} +1 -1
- package/dist/chunks/{types-BTHJ46LC.js → types-H3B56MH6.js} +1 -1
- package/dist/chunks/{update-GUA544N4.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 +1 -1
- package/dist/commands/link/index.js +1 -1
- package/dist/commands/list/index.js +1 -1
- package/dist/commands-bulk.js +191 -200
- package/dist/help.js +1 -1
- package/dist/index.js +2 -2
- package/dist/version.mjs +1 -1
- package/package.json +24 -23
- package/dist/chunks/chunk-DB2P55YY.js +0 -9
- package/dist/chunks/chunk-JEIMW3CO.js +0 -7
- package/dist/chunks/chunk-XQWBEAKZ.js +0 -9
- package/dist/chunks/config-XEI4UIQD.js +0 -7
- package/dist/chunks/pull-33THLIV4.js +0 -7
- package/dist/chunks/setup-and-link-YCM7WRCA.js +0 -7
|
@@ -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};
|
|
@@ -4,7 +4,7 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{require_graceful_fs}from"./chunk-F2ZWW2IO.js";import{require_lib}from"./chunk-B4ATVYZW.js";import{humanizePath}from"./chunk-PPCFQQSU.js";import{printAlignedLabel}from"./chunk-
|
|
7
|
+
import{require_graceful_fs}from"./chunk-F2ZWW2IO.js";import{require_lib}from"./chunk-B4ATVYZW.js";import{humanizePath}from"./chunk-PPCFQQSU.js";import{printAlignedLabel}from"./chunk-YMM3VY3J.js";import{getUser}from"./chunk-V5DCSHYJ.js";import{getTeamByIdOrSlug}from"./chunk-VOZEB6PD.js";import{InvalidToken,ProjectNotFound,code,isAPIError}from"./chunk-LKI6FRNM.js";import{emoji,link_default,output_manager_default,prependEmoji,require_build_utils}from"./chunk-EWWFNMPZ.js";import{require_dist}from"./chunk-QGIQK47P.js";import{require_source}from"./chunk-U7KCDTCH.js";import{__commonJS,__require,__toESM}from"./chunk-6L236MNA.js";var require_universalify=__commonJS({"../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js"(exports){"use strict";exports.fromCallback=function(fn){return Object.defineProperty(function(...args){if(typeof args[args.length-1]=="function")fn.apply(this,args);else return new Promise((resolve4,reject)=>{args.push((err,res)=>err!=null?reject(err):resolve4(res)),fn.apply(this,args)})},"name",{value:fn.name})};exports.fromPromise=function(fn){return Object.defineProperty(function(...args){let cb=args[args.length-1];if(typeof cb!="function")return fn.apply(this,args);args.pop(),fn.apply(this,args).then(r=>cb(null,r),cb)},"name",{value:fn.name})}}});var require_fs=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/fs/index.js"(exports){"use strict";var u=require_universalify().fromCallback,fs4=require_graceful_fs(),api=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(key=>typeof fs4[key]=="function");Object.assign(exports,fs4);api.forEach(method=>{exports[method]=u(fs4[method])});exports.realpath.native=u(fs4.realpath.native);exports.exists=function(filename,callback){return typeof callback=="function"?fs4.exists(filename,callback):new Promise(resolve4=>fs4.exists(filename,resolve4))};exports.read=function(fd,buffer,offset,length,position,callback){return typeof callback=="function"?fs4.read(fd,buffer,offset,length,position,callback):new Promise((resolve4,reject)=>{fs4.read(fd,buffer,offset,length,position,(err,bytesRead,buffer2)=>{if(err)return reject(err);resolve4({bytesRead,buffer:buffer2})})})};exports.write=function(fd,buffer,...args){return typeof args[args.length-1]=="function"?fs4.write(fd,buffer,...args):new Promise((resolve4,reject)=>{fs4.write(fd,buffer,...args,(err,bytesWritten,buffer2)=>{if(err)return reject(err);resolve4({bytesWritten,buffer:buffer2})})})};typeof fs4.writev=="function"&&(exports.writev=function(fd,buffers,...args){return typeof args[args.length-1]=="function"?fs4.writev(fd,buffers,...args):new Promise((resolve4,reject)=>{fs4.writev(fd,buffers,...args,(err,bytesWritten,buffers2)=>{if(err)return reject(err);resolve4({bytesWritten,buffers:buffers2})})})})}});var require_utils=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/mkdirs/utils.js"(exports,module){"use strict";var path=__require("path");module.exports.checkPath=function(pth){if(process.platform==="win32"&&/[<>:"|?*]/.test(pth.replace(path.parse(pth).root,""))){let error=new Error(`Path contains invalid characters: ${pth}`);throw error.code="EINVAL",error}}}});var require_make_dir=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/mkdirs/make-dir.js"(exports,module){"use strict";var fs4=require_fs(),{checkPath}=require_utils(),getMode=options=>{let defaults={mode:511};return typeof options=="number"?options:{...defaults,...options}.mode};module.exports.makeDir=async(dir,options)=>(checkPath(dir),fs4.mkdir(dir,{mode:getMode(options),recursive:!0}));module.exports.makeDirSync=(dir,options)=>(checkPath(dir),fs4.mkdirSync(dir,{mode:getMode(options),recursive:!0}))}});var require_mkdirs=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/mkdirs/index.js"(exports,module){"use strict";var u=require_universalify().fromPromise,{makeDir:_makeDir,makeDirSync}=require_make_dir(),makeDir=u(_makeDir);module.exports={mkdirs:makeDir,mkdirsSync:makeDirSync,mkdirp:makeDir,mkdirpSync:makeDirSync,ensureDir:makeDir,ensureDirSync:makeDirSync}}});var require_utimes=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/util/utimes.js"(exports,module){"use strict";var fs4=require_graceful_fs();function utimesMillis(path,atime,mtime,callback){fs4.open(path,"r+",(err,fd)=>{if(err)return callback(err);fs4.futimes(fd,atime,mtime,futimesErr=>{fs4.close(fd,closeErr=>{callback&&callback(futimesErr||closeErr)})})})}function utimesMillisSync(path,atime,mtime){let fd=fs4.openSync(path,"r+");return fs4.futimesSync(fd,atime,mtime),fs4.closeSync(fd)}module.exports={utimesMillis,utimesMillisSync}}});var require_stat=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/util/stat.js"(exports,module){"use strict";var fs4=require_fs(),path=__require("path"),util=__require("util");function getStats(src,dest,opts){let statFunc=opts.dereference?file=>fs4.stat(file,{bigint:!0}):file=>fs4.lstat(file,{bigint:!0});return Promise.all([statFunc(src),statFunc(dest).catch(err=>{if(err.code==="ENOENT")return null;throw err})]).then(([srcStat,destStat])=>({srcStat,destStat}))}function getStatsSync(src,dest,opts){let destStat,statFunc=opts.dereference?file=>fs4.statSync(file,{bigint:!0}):file=>fs4.lstatSync(file,{bigint:!0}),srcStat=statFunc(src);try{destStat=statFunc(dest)}catch(err){if(err.code==="ENOENT")return{srcStat,destStat:null};throw err}return{srcStat,destStat}}function checkPaths(src,dest,funcName,opts,cb){util.callbackify(getStats)(src,dest,opts,(err,stats)=>{if(err)return cb(err);let{srcStat,destStat}=stats;if(destStat){if(areIdentical(srcStat,destStat)){let srcBaseName=path.basename(src),destBaseName=path.basename(dest);return funcName==="move"&&srcBaseName!==destBaseName&&srcBaseName.toLowerCase()===destBaseName.toLowerCase()?cb(null,{srcStat,destStat,isChangingCase:!0}):cb(new Error("Source and destination must not be the same."))}if(srcStat.isDirectory()&&!destStat.isDirectory())return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`));if(!srcStat.isDirectory()&&destStat.isDirectory())return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`))}return srcStat.isDirectory()&&isSrcSubdir(src,dest)?cb(new Error(errMsg(src,dest,funcName))):cb(null,{srcStat,destStat})})}function checkPathsSync(src,dest,funcName,opts){let{srcStat,destStat}=getStatsSync(src,dest,opts);if(destStat){if(areIdentical(srcStat,destStat)){let srcBaseName=path.basename(src),destBaseName=path.basename(dest);if(funcName==="move"&&srcBaseName!==destBaseName&&srcBaseName.toLowerCase()===destBaseName.toLowerCase())return{srcStat,destStat,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(srcStat.isDirectory()&&!destStat.isDirectory())throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);if(!srcStat.isDirectory()&&destStat.isDirectory())throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)}if(srcStat.isDirectory()&&isSrcSubdir(src,dest))throw new Error(errMsg(src,dest,funcName));return{srcStat,destStat}}function checkParentPaths(src,srcStat,dest,funcName,cb){let srcParent=path.resolve(path.dirname(src)),destParent=path.resolve(path.dirname(dest));if(destParent===srcParent||destParent===path.parse(destParent).root)return cb();fs4.stat(destParent,{bigint:!0},(err,destStat)=>err?err.code==="ENOENT"?cb():cb(err):areIdentical(srcStat,destStat)?cb(new Error(errMsg(src,dest,funcName))):checkParentPaths(src,srcStat,destParent,funcName,cb))}function checkParentPathsSync(src,srcStat,dest,funcName){let srcParent=path.resolve(path.dirname(src)),destParent=path.resolve(path.dirname(dest));if(destParent===srcParent||destParent===path.parse(destParent).root)return;let destStat;try{destStat=fs4.statSync(destParent,{bigint:!0})}catch(err){if(err.code==="ENOENT")return;throw err}if(areIdentical(srcStat,destStat))throw new Error(errMsg(src,dest,funcName));return checkParentPathsSync(src,srcStat,destParent,funcName)}function areIdentical(srcStat,destStat){return destStat.ino&&destStat.dev&&destStat.ino===srcStat.ino&&destStat.dev===srcStat.dev}function isSrcSubdir(src,dest){let srcArr=path.resolve(src).split(path.sep).filter(i=>i),destArr=path.resolve(dest).split(path.sep).filter(i=>i);return srcArr.reduce((acc,cur,i)=>acc&&destArr[i]===cur,!0)}function errMsg(src,dest,funcName){return`Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`}module.exports={checkPaths,checkPathsSync,checkParentPaths,checkParentPathsSync,isSrcSubdir,areIdentical}}});var require_copy_sync=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/copy-sync/copy-sync.js"(exports,module){"use strict";var fs4=require_graceful_fs(),path=__require("path"),mkdirsSync=require_mkdirs().mkdirsSync,utimesMillisSync=require_utimes().utimesMillisSync,stat2=require_stat();function copySync(src,dest,opts){typeof opts=="function"&&(opts={filter:opts}),opts=opts||{},opts.clobber="clobber"in opts?!!opts.clobber:!0,opts.overwrite="overwrite"in opts?!!opts.overwrite:opts.clobber,opts.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
8
8
|
|
|
9
9
|
see https://github.com/jprichardson/node-fs-extra/issues/269`);let{srcStat,destStat}=stat2.checkPathsSync(src,dest,"copy",opts);return stat2.checkParentPathsSync(src,srcStat,dest,"copy"),handleFilterAndCopy(destStat,src,dest,opts)}function handleFilterAndCopy(destStat,src,dest,opts){if(opts.filter&&!opts.filter(src,dest))return;let destParent=path.dirname(dest);return fs4.existsSync(destParent)||mkdirsSync(destParent),getStats(destStat,src,dest,opts)}function startCopy(destStat,src,dest,opts){if(!(opts.filter&&!opts.filter(src,dest)))return getStats(destStat,src,dest,opts)}function getStats(destStat,src,dest,opts){let srcStat=(opts.dereference?fs4.statSync:fs4.lstatSync)(src);if(srcStat.isDirectory())return onDir(srcStat,destStat,src,dest,opts);if(srcStat.isFile()||srcStat.isCharacterDevice()||srcStat.isBlockDevice())return onFile(srcStat,destStat,src,dest,opts);if(srcStat.isSymbolicLink())return onLink(destStat,src,dest,opts);throw srcStat.isSocket()?new Error(`Cannot copy a socket file: ${src}`):srcStat.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${src}`):new Error(`Unknown file: ${src}`)}function onFile(srcStat,destStat,src,dest,opts){return destStat?mayCopyFile(srcStat,src,dest,opts):copyFile(srcStat,src,dest,opts)}function mayCopyFile(srcStat,src,dest,opts){if(opts.overwrite)return fs4.unlinkSync(dest),copyFile(srcStat,src,dest,opts);if(opts.errorOnExist)throw new Error(`'${dest}' already exists`)}function copyFile(srcStat,src,dest,opts){return fs4.copyFileSync(src,dest),opts.preserveTimestamps&&handleTimestamps(srcStat.mode,src,dest),setDestMode(dest,srcStat.mode)}function handleTimestamps(srcMode,src,dest){return fileIsNotWritable(srcMode)&&makeFileWritable(dest,srcMode),setDestTimestamps(src,dest)}function fileIsNotWritable(srcMode){return(srcMode&128)===0}function makeFileWritable(dest,srcMode){return setDestMode(dest,srcMode|128)}function setDestMode(dest,srcMode){return fs4.chmodSync(dest,srcMode)}function setDestTimestamps(src,dest){let updatedSrcStat=fs4.statSync(src);return utimesMillisSync(dest,updatedSrcStat.atime,updatedSrcStat.mtime)}function onDir(srcStat,destStat,src,dest,opts){return destStat?copyDir(src,dest,opts):mkDirAndCopy(srcStat.mode,src,dest,opts)}function mkDirAndCopy(srcMode,src,dest,opts){return fs4.mkdirSync(dest),copyDir(src,dest,opts),setDestMode(dest,srcMode)}function copyDir(src,dest,opts){fs4.readdirSync(src).forEach(item=>copyDirItem(item,src,dest,opts))}function copyDirItem(item,src,dest,opts){let srcItem=path.join(src,item),destItem=path.join(dest,item),{destStat}=stat2.checkPathsSync(srcItem,destItem,"copy",opts);return startCopy(destStat,srcItem,destItem,opts)}function onLink(destStat,src,dest,opts){let resolvedSrc=fs4.readlinkSync(src);if(opts.dereference&&(resolvedSrc=path.resolve(process.cwd(),resolvedSrc)),destStat){let resolvedDest;try{resolvedDest=fs4.readlinkSync(dest)}catch(err){if(err.code==="EINVAL"||err.code==="UNKNOWN")return fs4.symlinkSync(resolvedSrc,dest);throw err}if(opts.dereference&&(resolvedDest=path.resolve(process.cwd(),resolvedDest)),stat2.isSrcSubdir(resolvedSrc,resolvedDest))throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);if(fs4.statSync(dest).isDirectory()&&stat2.isSrcSubdir(resolvedDest,resolvedSrc))throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);return copyLink(resolvedSrc,dest)}else return fs4.symlinkSync(resolvedSrc,dest)}function copyLink(resolvedSrc,dest){return fs4.unlinkSync(dest),fs4.symlinkSync(resolvedSrc,dest)}module.exports=copySync}});var require_copy_sync2=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/copy-sync/index.js"(exports,module){"use strict";module.exports={copySync:require_copy_sync()}}});var require_path_exists=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/path-exists/index.js"(exports,module){"use strict";var u=require_universalify().fromPromise,fs4=require_fs();function pathExists2(path){return fs4.access(path).then(()=>!0).catch(()=>!1)}module.exports={pathExists:u(pathExists2),pathExistsSync:fs4.existsSync}}});var require_copy=__commonJS({"../../node_modules/.pnpm/fs-extra@10.0.0/node_modules/fs-extra/lib/copy/copy.js"(exports,module){"use strict";var fs4=require_graceful_fs(),path=__require("path"),mkdirs=require_mkdirs().mkdirs,pathExists2=require_path_exists().pathExists,utimesMillis=require_utimes().utimesMillis,stat2=require_stat();function copy(src,dest,opts,cb){typeof opts=="function"&&!cb?(cb=opts,opts={}):typeof opts=="function"&&(opts={filter:opts}),cb=cb||function(){},opts=opts||{},opts.clobber="clobber"in opts?!!opts.clobber:!0,opts.overwrite="overwrite"in opts?!!opts.overwrite:opts.clobber,opts.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
10
10
|
|
|
@@ -16,14 +16,14 @@ import{require_graceful_fs}from"./chunk-F2ZWW2IO.js";import{require_lib}from"./c
|
|
|
16
16
|
${(0,import_error_utils.errorToString)(error)}`);return}let gitConfigPath=join2(gitRoot||directory,".git/config"),remoteUrl;if(project?.link){let{repo}=project.link,remoteUrls=await getRemoteUrls(gitConfigPath);if(remoteUrls)for(let urlValue of Object.values(remoteUrls))urlValue.includes(repo)&&(remoteUrl=urlValue)}remoteUrl||(remoteUrl=await getOriginUrl(gitConfigPath));let[commitResult,dirtyResult]=await metadata;if(commitResult.status==="rejected"){output_manager_default.debug(`Failed to get last commit. The directory is likely not a Git repo, there are no latest commits, or it is corrupted.
|
|
17
17
|
${commitResult.reason}`);return}if(dirtyResult.status==="rejected"){output_manager_default.debug(`Failed to determine if Git repo has been modified:
|
|
18
18
|
${dirtyResult.reason}`);return}let dirty=dirtyResult.value,commit=commitResult.value;return{remoteUrl:remoteUrl||void 0,commitAuthorName:commit.author.name,commitAuthorEmail:commit.author.email,commitMessage:commit.subject,commitRef:branch,commitSha:commit.hash,dirty,rootDirectory:getRootDirectory(directory,gitRoot)}}function getRootDirectory(directory,gitRoot=getGitRootDirectory({cwd:directory})){if(!gitRoot)return;let rootDirectory=relative(gitRoot,resolve3(directory)).replace(/\\/g,"/");if(!(rootDirectory===".."||rootDirectory.startsWith("../")))return rootDirectory==="."?"":rootDirectory}async function getLastCommit(directory,git){let commit=await execFileAsync(git,["log","-1","--format=%H%x00%s%x00%an%x00%ae"],{cwd:directory});if(commit.stderr)throw new Error(commit.stderr);let[hash,subject,name,email]=commit.stdout.replace(/\r?\n$/,"").split("\0");return{hash,subject,author:{name,email}}}async function isDirty(directory){let git=await getGitExecutable(directory);return new Promise((resolve4,reject)=>{execFile2(git,["--no-optional-locks","status","-s"],{cwd:directory},function(err,stdout,stderr){if(err)return reject(err);if(stderr!==void 0&&stderr.trim().length>0)return reject(new Error(stderr));resolve4(stdout.trim().length>0)})})}async function parseGitConfig(configPath){try{return import_ini.default.parse(await import_fs_extra.default.readFile(configPath,"utf-8"))}catch(err){output_manager_default.debug(`Error while parsing repo data: ${(0,import_error_utils.errorToString)(err)}`)}}function pluckRemoteUrls(gitConfig){let remoteUrls={};for(let key of Object.keys(gitConfig))if(key.includes("remote")){let remoteName=key.match(/(?<=").*(?=")/g)?.[0],remoteUrl=gitConfig[key]?.url;remoteName&&remoteUrl&&(remoteUrls[remoteName]=remoteUrl)}if(Object.keys(remoteUrls).length!==0)return remoteUrls}async function getRemoteUrls(configPath){let config=await parseGitConfig(configPath);return config?pluckRemoteUrls(config):void 0}function pluckOriginUrl(gitConfig){return gitConfig['remote "origin"']?.url}async function getOriginUrl(configPath){let gitConfig=await parseGitConfig(configPath);if(!gitConfig)return null;let originUrl=pluckOriginUrl(gitConfig);return originUrl||null}var import_fs_extra5=__toESM(require_lib2(),1);import os from"os";import{join as join6}from"path";var import_fs_extra4=__toESM(require_lib2(),1);import fs3 from"fs";import{join as join5,relative as relative2}from"path";import{promisify}from"util";async function getOrgById(client,orgId){if(orgId.startsWith("team_"))try{let team=await getTeamByIdOrSlug(client,orgId);return team?{type:"team",id:team.id,slug:team.slug}:null}catch(err){if(isAPIError(err)&&(err.status===404||err.code==="not_found"||err.code==="mock_unimplemented"))return null;throw err}let user=await getUser(client);return user.id!==orgId?null:{type:"user",id:orgId,slug:user.username}}var import_build_utils2=__toESM(require_build_utils(),1);var import_error_utils2=__toESM(require_dist(),1);var import_chalk=__toESM(require_source(),1),import_pluralize=__toESM(require_pluralize(),1),import_build_utils=__toESM(require_build_utils(),1),import_fs_extra2=__toESM(require_lib2(),1);import{homedir}from"os";import{basename,join as join3}from"path";var home=homedir();async function getRepoLink(client,cwd){let rootPath=await findRepoRoot(cwd);if(!rootPath)return;let repoConfigPath=join3(rootPath,VERCEL_DIR,VERCEL_DIR_REPO),repoConfig=await(0,import_fs_extra2.readJSON)(repoConfigPath).catch(err=>{if(err.code!=="ENOENT")throw err});return{rootPath,repoConfig,repoConfigPath}}async function resolveGitRemote(client,rootPath,{yes,existingRemoteName}){let gitConfigPath=getGitConfigPath({cwd:rootPath})??join3(rootPath,".git/config"),remoteUrls=await getRemoteUrls(gitConfigPath);if(!remoteUrls)return;let remoteName;if(existingRemoteName){if(remoteName=existingRemoteName,!remoteUrls[remoteName])throw new Error(`Git remote "${remoteName}" from repo.json no longer exists`)}else{let remoteNames=Object.keys(remoteUrls).sort();if(remoteNames.length===1)remoteName=remoteNames[0];else{let defaultRemote=remoteNames.includes("origin")?"origin":remoteNames[0];yes?remoteName=defaultRemote:remoteName=await client.input.select({message:"Which Git remote should be used?",choices:remoteNames.map(name=>({name,value:name})),default:defaultRemote})}}return{rootPath,remoteName,repoUrl:remoteUrls[remoteName]}}async function fetchProjectsForRepoUrl(client,repoUrl,orgId){let query=new URLSearchParams({repoUrl}),projectsIterator=client.fetchPaginated(`/v9/projects?${query}`,{accountId:orgId}),projects=[];for await(let chunk of projectsIterator)projects=projects.concat(chunk.projects);return projects}async function linkRepoProject(client,cwd,{project,orgId,orgSlug,remoteName,successEmoji="link"}){let repoLink=await getRepoLink(client,cwd);if(!repoLink)throw new Error("Could not determine Git repository root directory");let directory=(0,import_build_utils.normalizePath)(project.rootDirectory||"."),projectConfig={id:project.id,name:project.name,directory,orgId},filteredProjects=(repoLink.repoConfig?.projects??[]).filter(p=>p.id!==project.id&&(0,import_build_utils.normalizePath)(p.directory)!==directory),repoConfig={remoteName,projects:[...filteredProjects,projectConfig]};return await(0,import_fs_extra2.outputJSON)(repoLink.repoConfigPath,repoConfig,{spaces:2}),await writeReadme(repoLink.rootPath),await addToGitIgnore(repoLink.rootPath),output_manager_default.print(`
|
|
19
|
-
`),printAlignedLabel("Linked",`${orgSlug}/${project.name}`,{gutter:"\u2713"}),{repoConfig,repoConfigPath:repoLink.repoConfigPath,rootPath:repoLink.rootPath}}async function discoverRepoProjects(client,rootPath,{yes,existingProjectIds,existingDirectories,existingRemoteName}){let{Separator}=await import("./esm-CXICLFA3.js"),{default:slugify}=await import("./slugify-O5DBATYT.js"),{default:selectOrg}=await import("./select-org-
|
|
19
|
+
`),printAlignedLabel("Linked",`${orgSlug}/${project.name}`,{gutter:"\u2713"}),{repoConfig,repoConfigPath:repoLink.repoConfigPath,rootPath:repoLink.rootPath}}async function discoverRepoProjects(client,rootPath,{yes,existingProjectIds,existingDirectories,existingRemoteName}){let{Separator}=await import("./esm-CXICLFA3.js"),{default:slugify}=await import("./slugify-O5DBATYT.js"),{default:selectOrg}=await import("./select-org-F2A5JJFH.js"),{default:createProject}=await import("./create-project-SRQGD4JY.js"),{repoInfoToUrl}=await import("./repo-info-to-url-SK3VX6UL.js"),{connectGitProvider,parseRepoUrl}=await import("./connect-git-provider-P3SGOW6X.js"),detectedProjectsPromise=import("./detect-projects-J3VAJIQD.js").then(({detectProjects})=>detectProjects(rootPath)).catch(err=>(output_manager_default.debug(`Failed to detect local projects: ${err}`),new Map)),confirmMessage=(existingRemoteName?"add":"link")==="add"?`Add Project(s) for Git repository at ${import_chalk.default.dim(`"${humanizePath(rootPath)}"`)}?`:`Link Git repository at ${import_chalk.default.dim(`"${humanizePath(rootPath)}"`)} to your Project(s)?`;if(!(yes||await client.input.confirm(confirmMessage,!0))){output_manager_default.print(` Canceled. Repository not linked.
|
|
20
20
|
`);return}let org=await selectOrg(client,"Which team?",yes);client.config.currentTeam=org.type==="team"?org.id:void 0;let remote=await resolveGitRemote(client,rootPath,{yes,existingRemoteName});if(!remote)throw new Error("Could not determine Git remote URLs");let{remoteName,repoUrl}=remote,parsedRepoUrl=parseRepoUrl(repoUrl);if(!parsedRepoUrl)throw new Error(`Failed to parse Git URL: ${repoUrl}`);let repoUrlLink=output_manager_default.link(repoUrl,repoInfoToUrl(parsedRepoUrl),{fallback:()=>link_default(repoUrl)});output_manager_default.spinner(`Fetching Projects for ${repoUrlLink} under ${import_chalk.default.bold(org.slug)}\u2026`);let detectedProjects=await detectedProjectsPromise,projects=await fetchProjectsForRepoUrl(client,repoUrl,org.id);(existingProjectIds||existingDirectories)&&(projects=projects.filter(p=>!(existingProjectIds?.has(p.id)||existingDirectories?.has((0,import_build_utils.normalizePath)(p.rootDirectory||"."))))),projects.length===0?output_manager_default.print(` No Projects are linked to ${repoUrlLink} under ${import_chalk.default.bold(org.slug)}.
|
|
21
21
|
`):output_manager_default.print(` Found ${(0,import_pluralize.default)("Project",projects.length,!0)} linked to ${repoUrlLink} under ${import_chalk.default.bold(org.slug)}
|
|
22
22
|
`);for(let project of projects)detectedProjects.delete(project.rootDirectory??"");if(existingDirectories)for(let dir of existingDirectories)detectedProjects.delete(dir==="."?"":dir);let detectedProjectsCount=Array.from(detectedProjects.values()).reduce((o,f)=>o+f.length,0);detectedProjectsCount>0&&output_manager_default.print(` Detected ${(0,import_pluralize.default)("new Project",detectedProjectsCount,!0)} that may be created.
|
|
23
23
|
`);let selected;if(yes)selected=projects;else{let addSeparators=projects.length>0&&detectedProjectsCount>0;selected=await client.input.checkbox({message:`Which Projects should be ${projects.length?"linked to":"created"}?`,choices:[...addSeparators?[new Separator("----- Existing Projects -----")]:[],...projects.map(project=>{let dir=project.rootDirectory||".";return{name:`${org.slug}/${project.name} ${import_chalk.default.gray(`(${dir})`)}`,value:project,checked:!0}}),...addSeparators?[new Separator("----- New Projects to be created -----")]:[],...Array.from(detectedProjects.entries()).flatMap(([rootDirectory,frameworks])=>frameworks.map((framework,i)=>{let name=slugify([basename(rootDirectory)||basename(rootPath),i>0?framework.slug:""].filter(Boolean).join("-"));return{name:`${org.slug}/${name} ${import_chalk.default.gray(`(${rootDirectory||"."} \xB7 ${framework.name})`)}`,value:{newProject:!0,rootDirectory,name,framework},checked:projects.length===0}}))]})}if(selected.length===0){output_manager_default.print(` No Projects were selected. Repository not linked.
|
|
24
24
|
`);return}for(let i=0;i<selected.length;i++){let selection=selected[i];if(!("newProject"in selection&&selection.newProject))continue;let orgAndName=`${org.slug}/${selection.name}`;output_manager_default.spinner(`Creating new Project: ${orgAndName}`),delete selection.newProject,selection.rootDirectory||delete selection.rootDirectory;let project=selected[i]=await createProject(client,{...selection,framework:selection.framework.slug});await connectGitProvider(client,project.id,parsedRepoUrl.provider,`${parsedRepoUrl.org}/${parsedRepoUrl.repo}`),output_manager_default.print(` Created new Project: ${output_manager_default.link(orgAndName,`https://vercel.com/${orgAndName}`,{fallback:!1})}
|
|
25
25
|
`)}let repoProjects=selected.map(project=>{if(!("id"in project))throw new TypeError(`Not a Project: ${JSON.stringify(project)}`);return{id:project.id,name:project.name,directory:(0,import_build_utils.normalizePath)(project.rootDirectory||"."),orgId:org.id}});return{remoteName,projects:repoProjects,orgSlug:org.slug}}async function ensureRepoLink(client,cwd,{yes,overwrite}){let repoLink=await getRepoLink(client,cwd);if(repoLink)output_manager_default.debug(`Found Git repository root directory: ${repoLink.rootPath}`);else throw new Error("Could not determine Git repository root directory");let{rootPath,repoConfig,repoConfigPath}=repoLink;if(overwrite||!repoConfig){let result=await discoverRepoProjects(client,rootPath,{yes});if(!result)return;repoConfig={remoteName:result.remoteName,projects:result.projects},await(0,import_fs_extra2.outputJSON)(repoConfigPath,repoConfig,{spaces:2}),await writeReadme(rootPath),await addToGitIgnore(rootPath),printAlignedLabel("Linked",`${(0,import_pluralize.default)("Project",result.projects.length,!0)} under ${result.orgSlug}`,{gutter:"\u2713"})}return{repoConfig,repoConfigPath,rootPath}}async function addRepoLink(client,cwd,{yes}){let repoLink=await getRepoLink(client,cwd);if(!repoLink)throw new Error("Could not determine Git repository root directory");let{rootPath,repoConfig,repoConfigPath}=repoLink;if(!repoConfig)throw new Error("No existing repository link found. Run `vc link --repo` first to link the repository.");output_manager_default.debug(`Found Git repository root directory: ${rootPath}`);let existingProjectIds=new Set(repoConfig.projects.map(p=>p.id)),existingDirectories=new Set(repoConfig.projects.map(p=>p.directory)),result=await discoverRepoProjects(client,rootPath,{yes,existingProjectIds,existingDirectories,existingRemoteName:repoConfig.remoteName});if(!result)return;if(result.projects.length===0)return output_manager_default.print(` No new Projects were added.
|
|
26
|
-
`),{repoConfig,repoConfigPath,rootPath};let mergedProjects=[...repoConfig.projects];for(let project of result.projects)existingProjectIds.has(project.id)||mergedProjects.push(project);let updatedConfig={...repoConfig,projects:mergedProjects};return await(0,import_fs_extra2.outputJSON)(repoConfigPath,updatedConfig,{spaces:2}),printAlignedLabel("Added",`${(0,import_pluralize.default)("Project",result.projects.length,!0)} under ${result.orgSlug}`,{gutter:"\u2713"}),{repoConfig:updatedConfig,repoConfigPath,rootPath}}async function findRepoRoot(start){let{debug}=output_manager_default,REPO_JSON_PATH=join3(VERCEL_DIR,VERCEL_DIR_REPO);for(let current of(0,import_build_utils.traverseUpDirectories)({start})){if(current===home){debug("Arrived at home directory");break}let repoConfigPath=join3(current,REPO_JSON_PATH);if(await(0,import_fs_extra2.lstat)(repoConfigPath).catch(err=>{if(err.code!=="ENOENT")throw err}))return debug(`Found "${REPO_JSON_PATH}" - detected "${current}" as repo root`),current}let gitRoot=getGitRootDirectory({cwd:start});if(gitRoot)return debug(`Found git root via "git rev-parse --show-toplevel" - detected "${gitRoot}" as repo root`),gitRoot;for(let current of(0,import_build_utils.traverseUpDirectories)({start})){if(current===home){debug("Arrived at home directory");break}let gitPath=join3(current,".git");if(await(0,import_fs_extra2.lstat)(gitPath).catch(err=>{if(err.code!=="ENOENT")throw err}))return debug(`Found ".git" - detected "${current}" as repo root`),current}debug("Aborting search for repo root")}function sortByDirectory(a,b){let aParts=a.directory.split("/");return b.directory.split("/").length-aParts.length}function findProjectsFromPath(projects,path){let normalizedPath=(0,import_build_utils.normalizePath)(path),matches=projects.slice().sort(sortByDirectory).filter(project=>project.directory==="."?!0:normalizedPath===project.directory||normalizedPath.startsWith(`${project.directory}/`)),firstMatch=matches[0];return firstMatch?matches.filter(match=>match.directory===firstMatch.directory):[]}var import_chalk2=__toESM(require_source(),1),import_fs_extra3=__toESM(require_lib2(),1);import{stat}from"fs/promises";import{join as join4,dirname}from"path";async function findProjectRoot(startDir){let cwdDev;try{cwdDev=(await stat(startDir)).dev}catch{return null}let dir=dirname(startDir);for(;dirname(dir)!==dir;){try{if((await stat(dir)).dev!==cwdDev)return null}catch{return null}let hasVercelDir=await(0,import_fs_extra3.pathExists)(join4(dir,".vercel")),hasVercelJson=await(0,import_fs_extra3.pathExists)(join4(dir,"vercel.json")),hasVercelToml=await(0,import_fs_extra3.pathExists)(join4(dir,"vercel.toml")),hasGit=await(0,import_fs_extra3.pathExists)(join4(dir,".git"));if(hasVercelDir||hasVercelJson||hasVercelToml||hasGit)return dir;dir=dirname(dir)}return null}async function resolveProjectCwd(cwd){let projectRoot=await findProjectRoot(cwd);if(!projectRoot||projectRoot===cwd)return cwd;let{isExperimentalServicesEnabled,tryDetectServices}=await import("./detect-services-
|
|
26
|
+
`),{repoConfig,repoConfigPath,rootPath};let mergedProjects=[...repoConfig.projects];for(let project of result.projects)existingProjectIds.has(project.id)||mergedProjects.push(project);let updatedConfig={...repoConfig,projects:mergedProjects};return await(0,import_fs_extra2.outputJSON)(repoConfigPath,updatedConfig,{spaces:2}),printAlignedLabel("Added",`${(0,import_pluralize.default)("Project",result.projects.length,!0)} under ${result.orgSlug}`,{gutter:"\u2713"}),{repoConfig:updatedConfig,repoConfigPath,rootPath}}async function findRepoRoot(start){let{debug}=output_manager_default,REPO_JSON_PATH=join3(VERCEL_DIR,VERCEL_DIR_REPO);for(let current of(0,import_build_utils.traverseUpDirectories)({start})){if(current===home){debug("Arrived at home directory");break}let repoConfigPath=join3(current,REPO_JSON_PATH);if(await(0,import_fs_extra2.lstat)(repoConfigPath).catch(err=>{if(err.code!=="ENOENT")throw err}))return debug(`Found "${REPO_JSON_PATH}" - detected "${current}" as repo root`),current}let gitRoot=getGitRootDirectory({cwd:start});if(gitRoot)return debug(`Found git root via "git rev-parse --show-toplevel" - detected "${gitRoot}" as repo root`),gitRoot;for(let current of(0,import_build_utils.traverseUpDirectories)({start})){if(current===home){debug("Arrived at home directory");break}let gitPath=join3(current,".git");if(await(0,import_fs_extra2.lstat)(gitPath).catch(err=>{if(err.code!=="ENOENT")throw err}))return debug(`Found ".git" - detected "${current}" as repo root`),current}debug("Aborting search for repo root")}function sortByDirectory(a,b){let aParts=a.directory.split("/");return b.directory.split("/").length-aParts.length}function findProjectsFromPath(projects,path){let normalizedPath=(0,import_build_utils.normalizePath)(path),matches=projects.slice().sort(sortByDirectory).filter(project=>project.directory==="."?!0:normalizedPath===project.directory||normalizedPath.startsWith(`${project.directory}/`)),firstMatch=matches[0];return firstMatch?matches.filter(match=>match.directory===firstMatch.directory):[]}var import_chalk2=__toESM(require_source(),1),import_fs_extra3=__toESM(require_lib2(),1);import{stat}from"fs/promises";import{join as join4,dirname}from"path";async function findProjectRoot(startDir){let cwdDev;try{cwdDev=(await stat(startDir)).dev}catch{return null}let dir=dirname(startDir);for(;dirname(dir)!==dir;){try{if((await stat(dir)).dev!==cwdDev)return null}catch{return null}let hasVercelDir=await(0,import_fs_extra3.pathExists)(join4(dir,".vercel")),hasVercelJson=await(0,import_fs_extra3.pathExists)(join4(dir,"vercel.json")),hasVercelToml=await(0,import_fs_extra3.pathExists)(join4(dir,"vercel.toml")),hasGit=await(0,import_fs_extra3.pathExists)(join4(dir,".git"));if(hasVercelDir||hasVercelJson||hasVercelToml||hasGit)return dir;dir=dirname(dir)}return null}async function resolveProjectCwd(cwd){let projectRoot=await findProjectRoot(cwd);if(!projectRoot||projectRoot===cwd)return cwd;let{isExperimentalServicesEnabled,tryDetectServices}=await import("./detect-services-JTGZ7NCQ.js");if(!await isExperimentalServicesEnabled(projectRoot))return cwd;let result=await tryDetectServices(projectRoot);return result&&(result.services?.length??0)>0?(output_manager_default.debug(`Running from project root: ${import_chalk2.default.cyan(projectRoot)}`),projectRoot):cwd}var readFile=promisify(fs3.readFile),writeFile=promisify(fs3.writeFile),VERCEL_DIR=".vercel",VERCEL_DIR_FALLBACK=".now",VERCEL_DIR_README="README.txt",VERCEL_DIR_PROJECT="project.json",VERCEL_DIR_REPO="repo.json";function isOwnerLookupUnavailableLink(link){return"ownerLookupUnavailable"in link&&link.ownerLookupUnavailable===!0}function isRemoteLookupSkippedLink(link){return"remoteLookupSkipped"in link&&link.remoteLookupSkipped===!0}function isOwnerLookupUnavailableError(error){return isAPIError(error)&&error.status===403&&error.code==="team_unauthorized"}function isValidProjectLink(value){if(!value||typeof value!="object"||Array.isArray(value))return!1;let link=value;return typeof link.projectId=="string"&&link.projectId.length>0&&typeof link.orgId=="string"&&link.orgId.length>0&&(link.projectName===void 0||typeof link.projectName=="string"&&link.projectName.length>0)}function getVercelDirectory(cwd){let possibleDirs=[join5(cwd,VERCEL_DIR),join5(cwd,VERCEL_DIR_FALLBACK)],existingDirs=possibleDirs.filter(d=>isDirectory(d));if(existingDirs.length>1)throw new import_build_utils2.NowBuildError({code:"CONFLICTING_CONFIG_DIRECTORIES",message:"Both `.vercel` and `.now` directories exist. Please remove the `.now` directory.",link:"https://vercel.link/combining-old-and-new-config"});return existingDirs[0]||possibleDirs[0]}async function getProjectLink(client,path,projectName,projectNameIsExplicit){let dirLink=await getLinkFromDir(getVercelDirectory(path));return dirLink&&(!projectNameIsExplicit||!projectName||dirLink.projectId===projectName||dirLink.projectName===projectName)?dirLink:await getProjectLinkFromRepoLink(client,path,projectName,projectNameIsExplicit)}async function getProjectLinkFromRepoLink(client,path,projectName,projectNameIsExplicit){let repoLink=await getRepoLink(client,path);if(!repoLink?.repoConfig)return null;let projects=findProjectsFromPath(repoLink.repoConfig.projects,relative2(repoLink.rootPath,path)),project;if(projectName&&projectNameIsExplicit)project=repoLink.repoConfig.projects.find(p=>p.id===projectName||p.name===projectName);else if(projects.length===1)project=projects[0];else{let selectableProjects=projects.length>0?projects:repoLink.repoConfig.projects;if(projectName&&(project=selectableProjects.find(p=>p.id===projectName||p.name===projectName)),!project)if(client.nonInteractive)if(selectableProjects.length===1)project=selectableProjects[0];else return null;else project=await client.input.select({message:"Please select a Project:",choices:selectableProjects.map(p=>({value:p,name:p.name}))})}if(project){let orgId=project.orgId??repoLink.repoConfig.orgId;if(!orgId){let projectInfo=[project.name?`name: "${project.name}"`:"",project.directory?`directory: "${project.directory}"`:""].filter(Boolean).join(", "),details=projectInfo?` Project: { ${projectInfo} }.`:"";throw new Error(`Could not determine org ID from repo.json config at "${repoLink.repoConfigPath}".${details} Please re-link the repository.`)}return{repoRoot:repoLink.rootPath,orgId,projectId:project.id,projectName:project.name,projectRootDirectory:project.directory}}return null}async function getLinkFromDir(dir){try{let json=await readFile(join5(dir,VERCEL_DIR_PROJECT),"utf8"),link=JSON.parse(json);if(!isValidProjectLink(link)){let raw=link,projectId=raw.projectId,orgId=raw.orgId;if(!(typeof projectId=="string"&&projectId.length>0&&typeof orgId=="string"&&orgId.length>0))return null;throw new Error(`Project Settings are invalid. To link your project again, remove the ${dir} directory.`)}return link}catch(err){if((0,import_error_utils2.isErrnoException)(err)&&err.code&&["ENOENT","ENOTDIR"].includes(err.code))return null;throw(0,import_error_utils2.isError)(err)&&err.name==="SyntaxError"?new Error(`Project Settings could not be retrieved. To link your project again, remove the ${dir} directory.`):err}}async function hasLocalProjectLink(client,cwd){try{if(await getLinkFromDir(getVercelDirectory(cwd)))return!0}catch{}try{let repoLink=await getRepoLink(client,cwd);return repoLink?.repoConfig?findProjectsFromPath(repoLink.repoConfig.projects,relative2(repoLink.rootPath,cwd)).length>0:!1}catch{return!1}}async function hasProjectLink(client,projectLink,path){let VERCEL_ORG_ID=(0,import_build_utils2.getPlatformEnv)("ORG_ID"),VERCEL_PROJECT_ID=(0,import_build_utils2.getPlatformEnv)("PROJECT_ID");if(VERCEL_ORG_ID===projectLink.orgId&&VERCEL_PROJECT_ID===projectLink.projectId)return!0;let repoLink=await getRepoLink(client,path);if(repoLink?.repoConfig){let matchingProject=repoLink.repoConfig.projects.find(p=>p.id===projectLink.projectId);if(matchingProject){let orgId=matchingProject.orgId??repoLink.repoConfig.orgId;if(!orgId)throw new Error(`Invalid "repo.json": missing "orgId" for project "${matchingProject.id}" and no top-level "orgId" is defined.`);if(orgId===projectLink.orgId)return!0}}let link=await getLinkFromDir(getVercelDirectory(path));return!!(link&&link.orgId===projectLink.orgId&&link.projectId===projectLink.projectId)}async function getLinkedProject(client,options={}){let path=options.cwd??client.cwd;path=await resolveProjectCwd(path);let VERCEL_ORG_ID=(0,import_build_utils2.getPlatformEnv)("ORG_ID"),VERCEL_PROJECT_ID=(0,import_build_utils2.getPlatformEnv)("PROJECT_ID"),shouldUseEnv=!!(VERCEL_ORG_ID&&VERCEL_PROJECT_ID),projectName=options.projectName,projectNameIsExplicit=options.projectNameIsExplicit===!0,explicitProjectName=projectNameIsExplicit?projectName:void 0,hasExplicitProject=!!explicitProjectName,shouldUseEnvContext=shouldUseEnv&&!hasExplicitProject;if(!hasExplicitProject&&(VERCEL_ORG_ID||VERCEL_PROJECT_ID)&&!shouldUseEnv)return output_manager_default.error(`You specified ${VERCEL_ORG_ID?"`VERCEL_ORG_ID`":"`VERCEL_PROJECT_ID`"} but you forgot to specify ${VERCEL_ORG_ID?"`VERCEL_PROJECT_ID`":"`VERCEL_ORG_ID`"}. You need to specify both to deploy to a custom project.
|
|
27
27
|
`),{status:"error",exitCode:1};let link,explicitlyResolvedProject=null,orgId;if(explicitProjectName){let hasExplicitScope=options.scopeIsExplicit===!0,matchingLocalLink=hasExplicitScope||shouldUseEnv?null:await getProjectLink(client,path,explicitProjectName,!0),fallbackOrgId=shouldUseEnv?VERCEL_ORG_ID:matchingLocalLink?.orgId??client.config.currentTeam,lookupOrgId=hasExplicitScope?client.config.currentTeam:fallbackOrgId;orgId=lookupOrgId;let apiProject=await getProjectByNameOrId(client,explicitProjectName,lookupOrgId);if(explicitlyResolvedProject=apiProject instanceof ProjectNotFound?null:apiProject,explicitlyResolvedProject===null)link=null;else{let resolvedOrgId=explicitlyResolvedProject.accountId??lookupOrgId??matchingLocalLink?.orgId,localLink=matchingLocalLink?.projectId===explicitlyResolvedProject.id?matchingLocalLink:null;if(!localLink)try{localLink=await getProjectLink(client,path,explicitlyResolvedProject.id,!0)}catch(err){output_manager_default.debug(`Ignoring local project metadata after explicit project resolution: ${err}`)}link=resolvedOrgId?{...localLink?.projectId===explicitlyResolvedProject.id&&localLink.orgId===resolvedOrgId?localLink:{},projectId:explicitlyResolvedProject.id,orgId:resolvedOrgId}:null}}else link=shouldUseEnvContext?{orgId:VERCEL_ORG_ID,projectId:VERCEL_PROJECT_ID}:await getProjectLink(client,path,projectName,projectNameIsExplicit),link&&(orgId=link.orgId);if(!link)return{status:"not_linked",org:null,project:null,orgId};if(options.skipRemoteLookup&&link.projectName){let settings=link.settings,localRootDirectory=link.projectRootDirectory??settings?.rootDirectory??null,rootDirectory=localRootDirectory==="."?null:localRootDirectory,project2={...settings,id:link.projectId,accountId:link.orgId,name:link.projectName,createdAt:settings?.createdAt??0,updatedAt:settings?.updatedAt??settings?.createdAt??0,rootDirectory};return{...{status:"linked",org:{type:link.orgId.startsWith("team_")?"team":"user",id:link.orgId,slug:""},project:project2,repoRoot:link.repoRoot,remoteLookupSkipped:!0},projectRootDirectory:link.projectRootDirectory,orgId:link.orgId}}output_manager_default.spinner("Retrieving project\u2026",1e3);let org=null,project=null,ownerLookupUnavailable=!1;try{let[orgResult,projectResult]=await Promise.allSettled([getOrgById(client,link.orgId),explicitlyResolvedProject?Promise.resolve(explicitlyResolvedProject):getProjectByNameOrId(client,link.projectId,link.orgId)]);if(orgResult.status==="fulfilled")org=orgResult.value;else if(isAPIError(orgResult.reason)&&(orgResult.reason.status===404||orgResult.reason.code==="not_found"||orgResult.reason.code==="mock_unimplemented"))org=null;else if(options.allowOwnerLookupFallback&&isOwnerLookupUnavailableError(orgResult.reason))ownerLookupUnavailable=!0;else throw orgResult.reason;if(projectResult.status==="fulfilled")project=projectResult.value;else if(isAPIError(projectResult.reason)&&(projectResult.reason.status===404||projectResult.reason.code==="not_found"||projectResult.reason.code==="mock_unimplemented"))project=new ProjectNotFound(link.projectId);else throw projectResult.reason}catch(err){if(isAPIError(err)&&err.status===403){if(output_manager_default.stopSpinner(),err.missingToken||err.invalidToken)throw new InvalidToken(client.authConfig.tokenSource);if(err.code==="forbidden"||err.code==="team_unauthorized")throw new import_build_utils2.NowBuildError({message:`Could not retrieve Project Settings. To link your Project, remove the ${code(VERCEL_DIR)} directory and deploy again.`,code:"PROJECT_UNAUTHORIZED",link:"https://vercel.link/cannot-load-project-settings"})}throw err}finally{output_manager_default.stopSpinner()}if(ownerLookupUnavailable&&project&&!(project instanceof ProjectNotFound)){let ownerId=project.accountId||link.orgId;return{status:"linked",org:{type:ownerId.startsWith("team_")?"team":"user",id:ownerId,slug:ownerId},project,repoRoot:link.repoRoot,projectRootDirectory:link.projectRootDirectory,orgId:link.orgId,ownerLookupUnavailable:!0}}return!org||!project||project instanceof ProjectNotFound?shouldUseEnvContext?(output_manager_default.error(`Project not found (${JSON.stringify({VERCEL_PROJECT_ID,VERCEL_ORG_ID})})
|
|
28
28
|
`),{status:"error",exitCode:1,orgId}):(output_manager_default.print(prependEmoji(`Your Project was either deleted, transferred to a new Team, or you don\u2019t have access to it anymore.
|
|
29
29
|
`,emoji("warning"))),{status:"not_linked",org:null,project:null,orgId:link.orgId}):{status:"linked",org,project,repoRoot:link.repoRoot,projectRootDirectory:link.projectRootDirectory,orgId:link.orgId}}var VERCEL_DIR_README_CONTENT=`> Why do I have a folder named ".vercel" in my project?
|
|
@@ -39,6 +39,6 @@ No, you should not share the ".vercel" folder with anyone.
|
|
|
39
39
|
Upon creation, it will be automatically added to your ".gitignore" file.
|
|
40
40
|
`;async function writeReadme(path){await writeFile(join5(path,VERCEL_DIR,VERCEL_DIR_README),VERCEL_DIR_README_CONTENT)}async function linkFolderToProject(client,path,projectLink,projectName,orgSlug,successEmoji="link",autoConfirm=!1,pullEnv=!0,resultLabel="Linked"){if(await hasProjectLink(client,projectLink,path))return;try{await(0,import_fs_extra4.ensureDir)(join5(path,VERCEL_DIR))}catch(err){if((0,import_error_utils2.isErrnoException)(err)&&err.code==="ENOTDIR")return;throw err}if(await writeFile(join5(path,VERCEL_DIR,VERCEL_DIR_PROJECT),JSON.stringify({...projectLink,projectName})),await writeReadme(path),await addToGitIgnore(path),output_manager_default.print(`
|
|
41
41
|
`),printAlignedLabel(resultLabel,`${orgSlug}/${projectName}`,{gutter:"\u2713"}),!pullEnv||!client.stdin.isTTY||client.nonInteractive)return;if(output_manager_default.print(`
|
|
42
|
-
`),autoConfirm||await client.input.confirm("Pull development environment variables into .env.local?",!0)){let originalCwd=client.cwd;try{client.cwd=path;let args=autoConfirm?["--yes"]:[],{default:pull}=await import("./pull-
|
|
42
|
+
`),autoConfirm||await client.input.confirm("Pull development environment variables into .env.local?",!0)){let originalCwd=client.cwd;try{client.cwd=path;let args=autoConfirm?["--yes"]:[],{default:pull}=await import("./pull-XCHJWKNY.js");await pull(client,args,"vercel-cli:link")!==0&&output_manager_default.error("Failed to pull environment variables. You can run `vc env pull` manually.")}catch{output_manager_default.error("Failed to pull environment variables. You can run `vc env pull` manually.")}finally{client.cwd=originalCwd}}}async function addToGitIgnore(path,ignore=VERCEL_DIR){let isGitIgnoreUpdated=!1;try{let gitIgnorePath=join6(path,".gitignore"),gitIgnore=await(0,import_fs_extra5.readFile)(gitIgnorePath,"utf8").catch(()=>null)??"",EOL=gitIgnore.includes(`\r
|
|
43
43
|
`)?`\r
|
|
44
44
|
`:os.EOL,contentModified=!1;gitIgnore.split(EOL).includes(ignore)||(gitIgnore+=`${gitIgnore.endsWith(EOL)||gitIgnore.length===0?"":EOL}${ignore}${EOL}`,contentModified=!0),contentModified&&(await(0,import_fs_extra5.writeFile)(gitIgnorePath,gitIgnore),isGitIgnoreUpdated=!0)}catch{}return isGitIgnoreUpdated}export{require_lib2 as require_lib,getProjectByNameOrId,getOrgById,isDirectory,require_pluralize,getGitExecutable,getGitConfigPath,createGitMeta,parseGitConfig,pluckRemoteUrls,getRemoteUrls,addToGitIgnore,getRepoLink,resolveGitRemote,fetchProjectsForRepoUrl,linkRepoProject,ensureRepoLink,addRepoLink,findRepoRoot,findProjectsFromPath,resolveProjectCwd,VERCEL_DIR,VERCEL_DIR_README,VERCEL_DIR_PROJECT,isOwnerLookupUnavailableLink,isRemoteLookupSkippedLink,getVercelDirectory,getProjectLink,getLinkFromDir,hasLocalProjectLink,getLinkedProject,linkFolderToProject};
|
|
@@ -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{printProjectNotFoundError}from"./chunk-
|
|
7
|
+
import{printProjectNotFoundError}from"./chunk-CKX6OH4B.js";import{param}from"./chunk-SXUEGVWB.js";import{detectExplicitScope}from"./chunk-77GUJ4JC.js";import{getLinkedProject,resolveProjectCwd}from"./chunk-UB37A37M.js";import{buildCommandWithYes,outputActionRequired}from"./chunk-BX5KDMLT.js";import{getCommandName,getCommandNamePlain}from"./chunk-FI772UVH.js";import{output_manager_default}from"./chunk-EWWFNMPZ.js";var parseEnv=env=>{if(!env)return{};if(typeof env=="string"&&(env=[env]),Array.isArray(env)){let startingDict={};return env.reduce((o,e)=>{let key,value,equalsSign=e.indexOf("=");return equalsSign===-1?key=e:(key=e.slice(0,equalsSign),value=e.slice(equalsSign+1)),o[key]=value,o},startingDict)}return env};async function ensureLink(commandName,client,cwd,opts={}){cwd=await resolveProjectCwd(cwd);let link=opts.link,nonInteractive=opts.nonInteractive??client.nonInteractive??!1;if(opts.nonInteractive=nonInteractive,link||(opts.forceDelete?link={status:"not_linked",org:null,project:null}:link=await getLinkedProject(client,{cwd,projectName:opts.projectName,projectNameIsExplicit:!!(opts.projectName&&opts.failIfNotFound),scopeIsExplicit:detectExplicitScope(client),allowOwnerLookupFallback:opts.allowOwnerLookupFallback,skipRemoteLookup:opts.skipRemoteLookup}),opts.link=link),link.status==="linked"&&opts.forceDelete||link.status==="not_linked"){if(link.status==="not_linked"&&opts.failIfNotFound&&opts.projectName)return await printProjectNotFoundError(client,opts.projectName,commandName,link.orgId),1;if(link.status==="not_linked"&&opts.requireExistingLink)return output_manager_default.error(`Project is not linked. Run ${getCommandName("link")} first.`),1;let{default:setupAndLink}=await import("./setup-and-link-X44IODXA.js");if(link=await setupAndLink(client,cwd,opts),link.status==="not_linked")return 0}return link.status==="error"?(link.reason==="HEADLESS"&&(nonInteractive?outputActionRequired(client,{status:"action_required",reason:"confirmation_required",message:`Command ${getCommandNamePlain(commandName)} requires confirmation. Use option --yes to confirm.`,next:[{command:buildCommandWithYes(client.argv),when:"Confirm and run"}]},link.exitCode):output_manager_default.error(`Command ${getCommandName(commandName)} requires confirmation. Use option ${param("--yes")} to confirm.`)),nonInteractive&&process.exit(link.exitCode),link.exitCode):link}export{parseEnv,ensureLink};
|
|
@@ -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{CertConfigurationError,CertError,DomainNotFound,TooManyRequests}from"./chunk-
|
|
7
|
+
import{CertConfigurationError,CertError,DomainNotFound,TooManyRequests}from"./chunk-LKI6FRNM.js";function mapCertError(error,cns){let errorCode=error.code;if(errorCode==="too_many_requests"){let retryAfter=typeof error.retryAfterMs=="number"?error.retryAfterMs:0;return new TooManyRequests("certificates",retryAfter)}return errorCode==="not_found"?new DomainNotFound(error.domain):errorCode==="configuration_error"?new CertConfigurationError({cns:cns||error.cns||[],message:error.message,external:error.external,helpUrl:error.helpUrl,type:error.statusCode===449?"http-01":"dns-01"}):errorCode==="bad_domains"||errorCode==="challenge_still_pending"||errorCode==="common_name_domain_name_mismatch"||errorCode==="conflicting_caa_record"||errorCode==="domain_not_verified"||errorCode==="invalid_cn"||errorCode==="invalid_domain"||errorCode==="rate_limited"||errorCode==="should_share_root_domain"||errorCode==="unauthorized_request_error"||errorCode==="unsupported_challenge_priority"||errorCode==="wildcard_not_allowed"||errorCode==="validation_running"||errorCode==="dns_error"||errorCode==="challenge_error"||errorCode==="txt_record_not_found"?new CertError({cns:cns||error.cns||[],code:errorCode,message:error.message,helpUrl:error.helpUrl}):null}export{mapCertError};
|
|
@@ -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{APIError,InvalidToken,MissingUser}from"./chunk-
|
|
7
|
+
import{APIError,InvalidToken,MissingUser}from"./chunk-LKI6FRNM.js";import{output_manager_default}from"./chunk-EWWFNMPZ.js";async function getUser(client){return client.user?client.user:(client.userPromise||(client.userPromise=fetchUser(client).finally(()=>{client.userPromise=void 0})),client.userPromise)}async function fetchUser(client){try{let res=await client.fetch("/v2/user",{useCurrentTeam:!1});if(!res.user)throw new MissingUser;if(client.authConfig.userId!==res.user.id){client.updateAuthConfig({userId:res.user.id});try{client.persistAuthConfig()}catch{output_manager_default.debug("Failed to persist cached userId to auth config.")}}return client.telemetryEventStore.updateUserId(res.user.id),client.user=res.user,res.user}catch(error){if(error instanceof APIError&&(error.status===401||error.status===403)){if(client.user=void 0,client.userPromise=void 0,client.authConfig.userId){client.updateAuthConfig({userId:void 0});try{client.persistAuthConfig()}catch{output_manager_default.debug("Failed to persist cached userId to auth config.")}}if(error.status===403)throw new InvalidToken(client.authConfig.tokenSource)}throw error}}export{getUser};
|
|
@@ -4,5 +4,5 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{noBorderChars,require_cli_table3}from"./chunk-6TAQ6OWD.js";import{require_dist}from"./chunk-
|
|
7
|
+
import{noBorderChars,require_cli_table3}from"./chunk-6TAQ6OWD.js";import{require_dist}from"./chunk-A5VLP25I.js";import{globalCommandOptions}from"./chunk-JAJW3P42.js";import{require_source}from"./chunk-U7KCDTCH.js";import{__toESM}from"./chunk-6L236MNA.js";var import_chalk=__toESM(require_source(),1),import_constants=__toESM(require_dist(),1),import_cli_table3=__toESM(require_cli_table3(),1);var INDENT=" ".repeat(2),NEWLINE=`
|
|
8
8
|
`,tableOptions={chars:noBorderChars,style:{"padding-left":0,"padding-right":0}};function wordWrap(text,maxWidth){let _tableOptions=Object.assign({},tableOptions,{colWidths:[maxWidth],style:{"padding-left":INDENT.length}}),table=new import_cli_table3.default(_tableOptions);return table.push([{content:text,wordWrap:!0}]),table.toString()}function lineToString(line){let string="";for(let i=0;i<line.length;i++)if(i===line.length-1)string+=line[i];else{let curr=line[i],next=line[i+1];string+=curr,curr.trim()!==""&&next.trim()!==""&&(string+=" ")}return string}function outputArrayToString(outputArray){return outputArray.filter(line=>line!==null).join(NEWLINE)}function buildCommandSynopsisLine(command,parent){let line=[INDENT,import_constants.LOGO,import_chalk.default.bold(import_constants.NAME)];parent&&line.push(import_chalk.default.bold(parent.name)),line.push(import_chalk.default.bold(command.name));let args=command.arguments.slice(0);if(args.length===0&&command.subcommands&&command.subcommands.length>0&&args.push({name:"command",required:!command.subcommands.some(subcommand=>subcommand.default)}),args.length>0)for(let argument of args){let{name}=argument;argument.multiple&&(name+=" ..."),line.push(argument.required?name:`[${name}]`)}return command.options.length>0&&line.push("[options]"),line.push(NEWLINE),lineToString(line)}function buildCommandOptionLines(commandOptions,options,sectionTitle){let filteredCommandOptions=commandOptions.filter(option=>!option.deprecated&&option.description!==void 0);if(filteredCommandOptions.length===0)return null;filteredCommandOptions.sort((a,b)=>a.name<b.name?-1:a.name>b.name?1:0);let maxWidthOfUnwrappedColumns=0,rows=[];for(let option of filteredCommandOptions){let shorthandCell=option.shorthand?`${INDENT}-${option.shorthand},`:"",longhandCell=`${INDENT}--${option.name}`;option.argument&&(longhandCell+=` <${option.argument}>`),longhandCell+=INDENT;let widthOfUnwrappedColumns=shorthandCell.length+longhandCell.length;maxWidthOfUnwrappedColumns=Math.max(widthOfUnwrappedColumns,maxWidthOfUnwrappedColumns),rows.push([shorthandCell,longhandCell,{content:option.description,wordWrap:!0}])}let finalColumnWidth=options.columns-maxWidthOfUnwrappedColumns,table=new import_cli_table3.default(Object.assign({},tableOptions,{colWidths:[null,null,finalColumnWidth]}));return table.push(...rows),[`${INDENT}${import_chalk.default.dim(sectionTitle)}:`,NEWLINE,NEWLINE,table.toString(),NEWLINE,NEWLINE].join("")}function buildSubcommandLines(subcommands,options){if(!subcommands)return null;let maxWidthOfUnwrappedColumns=0,rows=[];for(let command of subcommands){if(command.hidden)continue;let nameCell=`${INDENT}${command.name}`,argsCell=INDENT;argsCell+=command.arguments.map(arg=>arg.required?arg.name:`[${arg.name}]`).join(" "),argsCell+=INDENT;let widthOfUnwrappedColumns=nameCell.length+argsCell.length;maxWidthOfUnwrappedColumns=Math.max(widthOfUnwrappedColumns,maxWidthOfUnwrappedColumns),rows.push([nameCell,argsCell,{content:command.default?`${command.description} ${import_chalk.default.bold("(default)")}`:command.description,wordWrap:!0}])}let rightMargin=INDENT.repeat(4).length,finalColumnWidth=options.columns-maxWidthOfUnwrappedColumns-rightMargin,table=new import_cli_table3.default(Object.assign({},tableOptions,{colWidths:[null,null,finalColumnWidth]}));return rows.length===0?null:(table.push(...rows),[`${INDENT}${import_chalk.default.dim("Commands")}:`,NEWLINE,NEWLINE,table.toString(),NEWLINE,NEWLINE].join(""))}function buildCommandExampleLines(command){if(!command.examples?.length)return null;let outputArray=[`${INDENT}${import_chalk.default.dim("Examples:")}`,""];for(let example of command.examples){let nameLine=[INDENT];nameLine.push(import_chalk.default.gray("-")),nameLine.push(example.name),outputArray.push(lineToString(nameLine)),outputArray.push("");let buildValueLine=value=>lineToString([INDENT,INDENT,import_chalk.default.cyan(`$ ${value}`)]);if(Array.isArray(example.value))for(let line of example.value)outputArray.push(buildValueLine(line));else outputArray.push(buildValueLine(example.value));outputArray.push("")}return outputArrayToString(outputArray)}function buildCommandDocumentationLines(command,options){if(options.omitDocumentation)return null;let documentation=command.documentation??options.parent?.documentation;return documentation?outputArrayToString([`${INDENT}${import_chalk.default.dim(`${documentation.label}:`)}`,"",lineToString([INDENT,INDENT,import_chalk.default.cyan(documentation.url)]),""]):null}function buildDescriptionLine(command,options){return`${wordWrap(command.description,options.columns)}${NEWLINE}`}function buildHelpOutput(command,options){let filteredGlobalOptions=command.disabledGlobalOptions?globalCommandOptions.filter(opt=>!command.disabledGlobalOptions?.includes(opt.name)):globalCommandOptions,outputArray=["",buildCommandSynopsisLine(command,options.parent),buildDescriptionLine(command,options),buildSubcommandLines(command.subcommands,options),buildCommandOptionLines(command.options,options,"Options"),buildCommandOptionLines(filteredGlobalOptions,options,"Global Options"),buildCommandExampleLines(command),buildCommandDocumentationLines(command,options),""];return outputArrayToString(outputArray)}function help(command,options){return buildHelpOutput(command,{...options,columns:options.columns??80})}export{buildCommandDocumentationLines,help};
|