vercel 62.1.0 → 62.4.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-HANL3P77.js → add-E6SM6YUU.js} +1 -1
- package/dist/chunks/add-K6P7R3M4.js +8 -0
- package/dist/chunks/add-XZMJUVCZ.js +8 -0
- package/dist/chunks/build-ORM2P3M7.js +7 -0
- package/dist/chunks/{chunk-K6GIN2TC.js → chunk-2KCAQTPM.js} +1 -1
- package/dist/chunks/{chunk-NT67T6DL.js → chunk-3HO365U7.js} +1 -1
- package/dist/chunks/{chunk-OGVFR4VL.js → chunk-3P7HVGKM.js} +1 -1
- package/dist/chunks/{chunk-N7XPPYQQ.js → chunk-3YAQUAOG.js} +1 -1
- package/dist/chunks/{chunk-2RQFMCPJ.js → chunk-54SEEVOA.js} +1 -1
- package/dist/chunks/{chunk-ZOIPWLUF.js → chunk-57NFMJ6O.js} +1 -1
- package/dist/chunks/chunk-5G3VXZB4.js +10 -0
- package/dist/chunks/{chunk-B7YJLE3P.js → chunk-6RNZA3VS.js} +1 -1
- package/dist/chunks/chunk-72DVIZTW.js +8 -0
- package/dist/chunks/{chunk-C3XFIO5L.js → chunk-7NEJJJH6.js} +1 -1
- package/dist/chunks/{chunk-TBLJVTTQ.js → chunk-7OBZ2AM6.js} +1 -1
- package/dist/chunks/{chunk-BKNROJQU.js → chunk-7W3B5AJR.js} +2 -2
- package/dist/chunks/{chunk-DECRXYX6.js → chunk-7X34JCBW.js} +1 -1
- package/dist/chunks/{chunk-3R66O72V.js → chunk-AUIBCIET.js} +1 -1
- package/dist/chunks/{chunk-X47XV2WG.js → chunk-B4VX6C2E.js} +1 -1
- package/dist/chunks/{chunk-ACCZWEKL.js → chunk-BIFJ5QEB.js} +1 -1
- package/dist/chunks/{chunk-ZNFC3CZF.js → chunk-DBDWXNAR.js} +1 -1
- package/dist/chunks/{chunk-A752WDCH.js → chunk-DJC2LX46.js} +1 -1
- package/dist/chunks/{chunk-M7ZGWERO.js → chunk-E4M34FSN.js} +1 -1
- package/dist/chunks/chunk-ETYHCI6U.js +7 -0
- package/dist/chunks/{chunk-X5OINFLV.js → chunk-EWW4GCZY.js} +1 -1
- package/dist/chunks/chunk-EZU5U2PZ.js +7 -0
- package/dist/chunks/{chunk-I327YWUE.js → chunk-FSHYI4ZE.js} +1 -1
- package/dist/chunks/{chunk-DT3EUC6S.js → chunk-G3NHWIPJ.js} +3 -2
- package/dist/chunks/{chunk-7JFK53D4.js → chunk-G7AD7DRG.js} +1 -1
- package/dist/chunks/{chunk-U6N2RNDI.js → chunk-GNJPIPBF.js} +1 -1
- package/dist/chunks/{chunk-CQ3RAERR.js → chunk-GTZDB7IL.js} +1 -1
- package/dist/chunks/{chunk-ZUYWATU5.js → chunk-GV6XYKYC.js} +1 -1
- package/dist/chunks/{chunk-4NICAS7W.js → chunk-HNF6WZ5S.js} +2 -2
- package/dist/chunks/{chunk-NYUESPV2.js → chunk-HTZPGIVL.js} +1 -1
- package/dist/chunks/{chunk-AIMMAROX.js → chunk-IHXHZBHR.js} +1 -1
- package/dist/chunks/chunk-IIKYA7SM.js +9 -0
- package/dist/chunks/{chunk-FA6O7FPC.js → chunk-J4YZKLVO.js} +1 -1
- package/dist/chunks/{chunk-7T4CJ6MJ.js → chunk-J7JW6BBJ.js} +1 -1
- package/dist/chunks/chunk-JEYKXG6O.js +7 -0
- package/dist/chunks/{chunk-7VSX264O.js → chunk-JI2BTGLU.js} +2 -2
- package/dist/chunks/{chunk-VDOJERIW.js → chunk-KQM2AGUS.js} +1 -1
- package/dist/chunks/chunk-L37LRUIN.js +7 -0
- package/dist/chunks/{chunk-S5CEIACD.js → chunk-LG4JQAY7.js} +1 -1
- package/dist/chunks/{chunk-RFWCEREA.js → chunk-LKYVY3SY.js} +1 -1
- package/dist/chunks/{chunk-Z5PMK6F2.js → chunk-LOD56FYJ.js} +4 -4
- package/dist/chunks/chunk-LSF7FY6X.js +7 -0
- package/dist/chunks/{chunk-KOSM3DYE.js → chunk-LW3HJWXW.js} +1 -1
- package/dist/chunks/chunk-MB4RN7BI.js +9 -0
- package/dist/chunks/{chunk-A5VLP25I.js → chunk-MCCL762Q.js} +1 -1
- package/dist/chunks/{chunk-RBYCFVJN.js → chunk-MJRZSYU2.js} +3 -3
- package/dist/chunks/chunk-OL3BQESW.js +21 -0
- package/dist/chunks/{chunk-GR76JFDX.js → chunk-OY2H4NBN.js} +1 -1
- package/dist/chunks/{chunk-6JU3QZ3O.js → chunk-PP36OP55.js} +1 -1
- package/dist/chunks/{chunk-LCWCTL6L.js → chunk-PTUZ7ATN.js} +1 -1
- package/dist/chunks/{chunk-NXJLJLEM.js → chunk-QFVAARN7.js} +1 -1
- package/dist/chunks/{chunk-V6BHS2M2.js → chunk-QLJ72TJJ.js} +1 -1
- package/dist/chunks/{chunk-XF5HR3BJ.js → chunk-QYGA4IKR.js} +1 -1
- package/dist/chunks/{chunk-64JYKBGN.js → chunk-RDC4BJSR.js} +5 -5
- package/dist/chunks/{chunk-PV5YI2ZZ.js → chunk-ROOWZCAB.js} +1 -1
- package/dist/chunks/{chunk-FWN57YF7.js → chunk-SANUW37I.js} +8 -4
- package/dist/chunks/{chunk-6OI6SRHZ.js → chunk-SDGWKUST.js} +1 -1
- package/dist/chunks/{chunk-T4QWSTWE.js → chunk-SL5SJUAH.js} +1 -1
- package/dist/chunks/{chunk-JRU6AGXG.js → chunk-TATIUO4V.js} +1 -1
- package/dist/chunks/{chunk-7NSHIG54.js → chunk-TNERVI3E.js} +1 -1
- package/dist/chunks/{chunk-6MR2VYMC.js → chunk-TNJVIC27.js} +1 -1
- package/dist/chunks/{chunk-QMBXEDTG.js → chunk-TQ5ETS24.js} +1 -1
- package/dist/chunks/{chunk-BN3XAVPG.js → chunk-U4C2LU7H.js} +1 -1
- package/dist/chunks/{chunk-JK5Z72G5.js → chunk-UDVWL4I4.js} +1 -1
- package/dist/chunks/chunk-UV4HOEHC.js +24 -0
- package/dist/chunks/chunk-UZ2DSUM6.js +7 -0
- package/dist/chunks/chunk-VGXFOQ4P.js +8 -0
- package/dist/chunks/chunk-VUCFX2G4.js +7 -0
- package/dist/chunks/chunk-VX7JFH7Q.js +7 -0
- package/dist/chunks/{chunk-ULYAF4N3.js → chunk-WGPFU3NA.js} +1 -1
- package/dist/chunks/chunk-WQLEYC3T.js +9 -0
- package/dist/chunks/{chunk-NESZV33T.js → chunk-WT73KR4Y.js} +1 -1
- package/dist/chunks/chunk-WVUD3JPC.js +10 -0
- package/dist/chunks/{chunk-W7PVS44H.js → chunk-XP4C5FLG.js} +1 -1
- package/dist/chunks/{chunk-S2LBGLRE.js → chunk-XQVD5V3T.js} +1 -1
- package/dist/chunks/{chunk-35QWU4NB.js → chunk-YAJFAGUO.js} +3 -3
- package/dist/chunks/{chunk-7I23VXBQ.js → chunk-ZXEYTD3W.js} +1 -1
- package/dist/chunks/clear-IWIBH2TY.js +8 -0
- package/dist/chunks/{compile-vercel-config-SRYQK624.js → compile-vercel-config-B2ZES5JB.js} +1 -1
- package/dist/chunks/{config-6AXT6WNO.js → config-5GNX5VM2.js} +1 -1
- package/dist/chunks/config-BLTCR2NA.js +8 -0
- package/dist/chunks/config-validator.mjs +1 -1
- package/dist/chunks/delete-DSDSQVG7.js +9 -0
- package/dist/chunks/delete-TN2UUEOF.js +10 -0
- package/dist/chunks/{detect-projects-325QE23N.js → detect-projects-AWDCPVLE.js} +1 -1
- package/dist/chunks/detect-services-VQWDU5RR.js +7 -0
- package/dist/chunks/disable-76QRXL7J.js +7 -0
- package/dist/chunks/discard-CWXRCRFL.js +14 -0
- package/dist/chunks/edit-KC6AK6DA.js +9 -0
- package/dist/chunks/edit-LYZPKUZY.js +8 -0
- package/dist/chunks/enable-ZVEULDXQ.js +7 -0
- package/dist/chunks/{export-QOTSGWFE.js → export-SYT5NHSM.js} +2 -2
- package/dist/chunks/{future-GS7ZLJ3N.js → future-YNSZJIAG.js} +1 -1
- package/dist/chunks/{generate-cert-for-deploy-L5NMXX37.js → generate-cert-for-deploy-G26VGC4I.js} +1 -1
- package/dist/chunks/image-XAJFJ6UD.js +7 -0
- package/dist/chunks/{import-builders-WWYNSGXV.js → import-builders-JXIILQOI.js} +1 -1
- package/dist/chunks/inspect-7CODV4HJ.js +9 -0
- package/dist/chunks/{inspect-DKJC7ORF.js → inspect-A76MME2I.js} +2 -2
- package/dist/chunks/{inspect-IIF3N5Z2.js → inspect-DF35I6AZ.js} +2 -2
- package/dist/chunks/{inspect-EHEMDPJD.js → inspect-HIRGIJON.js} +2 -2
- package/dist/chunks/inspect-JEHOMETA.js +13 -0
- package/dist/chunks/{list-MMQAS2OQ.js → list-3KNHQV4S.js} +2 -2
- package/dist/chunks/{list-4TZ6QS5J.js → list-M2YCP5HV.js} +2 -2
- package/dist/chunks/list-XNNJCS5K.js +11 -0
- package/dist/chunks/{login-5QOABZRX.js → login-2GVRFOQQ.js} +1 -1
- package/dist/chunks/login-UM35IU3S.js +9 -0
- package/dist/chunks/{logs-KWMWFGLA.js → logs-HS5YRXDR.js} +1 -1
- package/dist/chunks/ls-ISILCAV4.js +11 -0
- package/dist/chunks/{ls-43NFH2L6.js → ls-KGYG3F3A.js} +2 -2
- package/dist/chunks/ls-M2SGUIZK.js +8 -0
- package/dist/chunks/ls-WROXB2SF.js +8 -0
- package/dist/chunks/{ls-KCE6GJZL.js → ls-Y3CBOCK2.js} +2 -2
- package/dist/chunks/{ls-L454FAKC.js → ls-YJEUWZFT.js} +2 -2
- package/dist/chunks/{ls-HKXEYGZT.js → ls-Z2JKBJKR.js} +2 -2
- package/dist/chunks/mutate-ZCA7FKDL.js +9 -0
- package/dist/chunks/notifications-7QROHXJQ.js +7 -0
- package/dist/chunks/open-FU7OJPAY.js +7 -0
- package/dist/chunks/{openapi-6L7RIFOR.js → openapi-KGCZ7LB4.js} +1 -1
- package/dist/chunks/permissions-I4ZXPUVY.js +7 -0
- package/dist/chunks/{prompt-missing-credentials-N7ETDDXW.js → prompt-missing-credentials-YPLDAGZA.js} +1 -1
- package/dist/chunks/publish-6WBGPES3.js +15 -0
- package/dist/chunks/pull-BJUOPX3J.js +7 -0
- package/dist/chunks/{purchase-domain-if-available-IIEFQGPX.js → purchase-domain-if-available-7KTEXJFK.js} +1 -1
- package/dist/chunks/push-ZRDFCF3D.js +7 -0
- package/dist/chunks/{query-CBEGOTEI.js → query-RXONIAT5.js} +2 -2
- package/dist/chunks/{reauthenticate-3H5Q2ZWD.js → reauthenticate-7RZ2XFR4.js} +1 -1
- package/dist/chunks/reorder-P5LWY3FS.js +10 -0
- package/dist/chunks/reply-QNIIC2TP.js +9 -0
- package/dist/chunks/resolve-RQBKN4WL.js +12 -0
- package/dist/chunks/restore-NPY7XA3A.js +16 -0
- package/dist/chunks/{rm-XW6CPP6J.js → rm-4PBTYQBF.js} +1 -1
- package/dist/chunks/rm-5LVIH5IE.js +8 -0
- package/dist/chunks/rm-GGY4TGSX.js +8 -0
- package/dist/chunks/rm-K3V6KVHW.js +8 -0
- package/dist/chunks/rm-XOE3T2QM.js +8 -0
- package/dist/chunks/{routes-IPGKJ2E4.js → routes-FOCZWOGO.js} +1 -1
- package/dist/chunks/rule-inspect-6UI5XBGA.js +8 -0
- package/dist/chunks/rules-MJWNYYRT.js +7 -0
- package/dist/chunks/schema-ABJKQ6AB.js +14 -0
- package/dist/chunks/{schema-4R7CRVMR.js → schema-SOV2XP24.js} +2 -2
- package/dist/chunks/{select-org-37C26F7T.js → select-org-G4KFHFH3.js} +1 -1
- package/dist/chunks/set-DJO2C6XG.js +7 -0
- package/dist/chunks/setup-and-link-BZCJ74II.js +7 -0
- package/dist/chunks/tags-DY5IM5QF.js +7 -0
- package/dist/chunks/{types-UN5J66MI.js → types-RHUVE4FN.js} +2 -2
- package/dist/chunks/{update-CA3E2G46.js → update-6WSCOLSB.js} +2 -2
- package/dist/commands/build/index.js +2 -2
- package/dist/commands/deploy/index.js +13 -10
- package/dist/commands/dev/index.js +9 -9
- package/dist/commands/env/index.js +12 -12
- package/dist/commands/link/index.js +2 -2
- package/dist/commands/list/index.js +1 -1
- package/dist/commands-bulk.js +309 -308
- package/dist/index.js +6 -3
- package/dist/vc.js +2 -1
- package/dist/version.mjs +1 -1
- package/package.json +58 -57
- package/dist/chunks/add-XNYC3JIL.js +0 -8
- package/dist/chunks/add-XUAM4VOK.js +0 -8
- package/dist/chunks/build-ZBS6SOT7.js +0 -7
- package/dist/chunks/chunk-4O5TQSWD.js +0 -7
- package/dist/chunks/chunk-5VWK73R6.js +0 -10
- package/dist/chunks/chunk-7PQBWGSI.js +0 -7
- package/dist/chunks/chunk-7RT22KMX.js +0 -7
- package/dist/chunks/chunk-CS4QF4YI.js +0 -8
- package/dist/chunks/chunk-CVX5X5RI.js +0 -7
- package/dist/chunks/chunk-G43DZJ2Z.js +0 -7
- package/dist/chunks/chunk-JLOCNOBV.js +0 -7
- package/dist/chunks/chunk-JVCUTKAX.js +0 -24
- package/dist/chunks/chunk-N5Q4IX3H.js +0 -9
- package/dist/chunks/chunk-NKC536ZX.js +0 -9
- package/dist/chunks/chunk-QAPUB4EX.js +0 -9
- package/dist/chunks/chunk-Y3A7ZJNX.js +0 -10
- package/dist/chunks/chunk-Z26EOSNI.js +0 -7
- package/dist/chunks/chunk-Z6TGFLIO.js +0 -21
- package/dist/chunks/clear-UYIYBIU7.js +0 -8
- package/dist/chunks/config-EDC5XGQX.js +0 -8
- package/dist/chunks/delete-GYK2QMZA.js +0 -10
- package/dist/chunks/delete-PIASS7TQ.js +0 -9
- package/dist/chunks/detect-services-QNPD7J6F.js +0 -7
- package/dist/chunks/disable-SFNXBFOL.js +0 -7
- package/dist/chunks/discard-QX7SXCDX.js +0 -14
- package/dist/chunks/edit-4U3ZERPO.js +0 -9
- package/dist/chunks/edit-PNIFJF2H.js +0 -8
- package/dist/chunks/enable-HZFCTROZ.js +0 -7
- package/dist/chunks/image-PY2GZYQD.js +0 -7
- package/dist/chunks/inspect-NIRGPMGV.js +0 -13
- package/dist/chunks/inspect-QQJAYYMO.js +0 -9
- package/dist/chunks/list-4MCOLKTO.js +0 -11
- package/dist/chunks/login-ZAAIOSQ4.js +0 -9
- package/dist/chunks/ls-42F5OUPY.js +0 -8
- package/dist/chunks/ls-ID2DGRGG.js +0 -11
- package/dist/chunks/ls-KAIRQI27.js +0 -8
- package/dist/chunks/mutate-QK3U73PH.js +0 -9
- package/dist/chunks/notifications-2QARJQFZ.js +0 -7
- package/dist/chunks/open-PORNBO4I.js +0 -7
- package/dist/chunks/permissions-EYOTCJGO.js +0 -7
- package/dist/chunks/publish-JTCJ6Z5K.js +0 -15
- package/dist/chunks/pull-FNJGDSP2.js +0 -7
- package/dist/chunks/push-LBPCQFBD.js +0 -7
- package/dist/chunks/reorder-LLR3OV6E.js +0 -10
- package/dist/chunks/reply-3CDS6LPX.js +0 -9
- package/dist/chunks/resolve-XQ6UPCSZ.js +0 -12
- package/dist/chunks/restore-U4EWQAAZ.js +0 -16
- package/dist/chunks/rm-3FAU5JLM.js +0 -8
- package/dist/chunks/rm-7OBAUU4F.js +0 -8
- package/dist/chunks/rm-WEMHKTUL.js +0 -8
- package/dist/chunks/rm-XGXSPQIY.js +0 -8
- package/dist/chunks/rule-inspect-I6WJTC7O.js +0 -8
- package/dist/chunks/rules-TMEV52OR.js +0 -7
- package/dist/chunks/schema-W3ZXTSRT.js +0 -14
- package/dist/chunks/set-FOMKZDT2.js +0 -7
- package/dist/chunks/setup-and-link-QI6PHWVL.js +0 -7
- package/dist/chunks/tags-BTMFM3XQ.js +0 -7
|
@@ -4,7 +4,7 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{
|
|
7
|
+
import{require_lib}from"./chunk-B4ATVYZW.js";import{require_graceful_fs}from"./chunk-F2ZWW2IO.js";import{humanizePath}from"./chunk-PPCFQQSU.js";import{printAlignedLabel}from"./chunk-YMM3VY3J.js";import{getUser}from"./chunk-SM5JI6QM.js";import{getTeamByIdOrSlug}from"./chunk-VOZEB6PD.js";import{InvalidToken,ProjectNotFound,code,isAPIError}from"./chunk-RINZXCDJ.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-G4KFHFH3.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-VYU65KTS.js"),detectedProjectsPromise=import("./detect-projects-AWDCPVLE.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-VQWDU5RR.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;options.skipProjectRootResolution||(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([options.skipOwnerLookup?Promise.resolve({type:link.orgId.startsWith("team_")?"team":"user",id:link.orgId,slug:""}):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-BJUOPX3J.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}var VERCEL_CONFIG_EXTENSIONS=["ts","mts","js","mjs","cjs"],DEFAULT_VERCEL_CONFIG_FILENAME="Vercel config";export{require_lib2 as require_lib,getProjectByNameOrId,getOrgById,isDirectory,require_pluralize,execFileAsync,getGitExecutable,getGitConfigPath,createGitMeta,parseGitConfig,pluckRemoteUrls,getRemoteUrls,addToGitIgnore,getRepoLink,resolveGitRemote,fetchProjectsForRepoUrl,linkRepoProject,ensureRepoLink,addRepoLink,findRepoRoot,findProjectsFromPath,VERCEL_CONFIG_EXTENSIONS,DEFAULT_VERCEL_CONFIG_FILENAME,resolveProjectCwd,VERCEL_DIR,VERCEL_DIR_README,VERCEL_DIR_PROJECT,isOwnerLookupUnavailableLink,isRemoteLookupSkippedLink,getVercelDirectory,getProjectLink,getLinkFromDir,hasLocalProjectLink,getLinkedProject,linkFolderToProject};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
function parseTeamRefs(args){let refs=[];for(let arg of args)for(let piece of arg.split(",")){let ref=piece.trim();ref&&!refs.includes(ref)&&refs.push(ref)}return refs}function teamRefBody(ref){return ref.startsWith("team_")?{teamId:ref}:{teamSlug:ref}}export{parseTeamRefs,teamRefBody};
|
|
@@ -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{projectOption,yesOption}from"./chunk-PV5YI2ZZ.js";import{packageName}from"./chunk-FI772UVH.js";var listSubcommand={name:"list",aliases:["ls"],description:"List all routing rules for the current project. These routes apply to all deployments and environments.",arguments:[],options:[projectOption,{name:"search",description:"Search by name, description, source, or destination",shorthand:"s",type:String,argument:"QUERY",deprecated:!1},{name:"filter",description:"Filter by type: rewrite, redirect, set_status, transform",shorthand:"f",type:String,argument:"TYPE",deprecated:!1},{name:"production",description:"List routes from the live production version",shorthand:null,type:Boolean,deprecated:!1},{name:"version-id",description:"List routes from a specific version ID",shorthand:null,type:String,argument:"VERSION_ID",deprecated:!1},{name:"diff",description:"Compare staged changes against production. Use with --version-id to compare a specific version.",shorthand:null,type:Boolean,deprecated:!1},{name:"expand",description:"Show expanded details for each route",shorthand:"e",type:Boolean,deprecated:!1}],examples:[{name:"List all routes",value:`${packageName} routes list`},{name:"Search for routes",value:`${packageName} routes list --search "api"`},{name:"Filter by type",value:`${packageName} routes list --filter rewrite`},{name:"Show staged changes",value:`${packageName} routes list --diff`},{name:"Show live production routes",value:`${packageName} routes list --production`},{name:"Show expanded details",value:`${packageName} routes list --expand`}]},listVersionsSubcommand={name:"list-versions",aliases:["ls-versions"],description:"List all versions of routing rules",arguments:[],options:[projectOption,{name:"count",description:"Number of versions to fetch (default: 20, max: 100)",shorthand:null,type:Number,argument:"NUMBER",deprecated:!1}],examples:[{name:"List route versions",value:`${packageName} routes list-versions`},{name:"List more versions",value:`${packageName} routes list-versions --count 50`}]},inspectSubcommand={name:"inspect",aliases:[],description:"Show detailed information about a specific route",arguments:[{name:"name-or-id",required:!0}],options:[projectOption,{name:"diff",description:"Compare staged changes against production for this route",shorthand:null,type:Boolean,deprecated:!1}],examples:[{name:"Inspect a route by name",value:`${packageName} routes inspect "API rewrite"`},{name:"Inspect a route by ID",value:`${packageName} routes inspect abc123`},{name:"Show staged changes for a route",value:`${packageName} routes inspect "My route" --diff`}]},addSubcommand={name:"add",aliases:[],description:"Add a new routing rule to the project",arguments:[{name:"name",required:!1}],options:[projectOption,{name:"src",description:"Path pattern (required in non-interactive mode)",shorthand:null,type:String,argument:"PATTERN",deprecated:!1},{name:"src-syntax",description:"Path syntax: regex (default), path-to-regexp, equals",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"action",description:"Action type: rewrite, redirect, or set-status (required with --dest/--status)",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"dest",description:"Destination URL for rewrite or redirect",shorthand:null,type:String,argument:"URL",deprecated:!1},{name:"status",description:"Status code (301/302/307/308 for redirect, or any for set-status)",shorthand:null,type:Number,argument:"CODE",deprecated:!1},{name:"set-response-header",description:"Set response header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"append-response-header",description:"Append to response header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"delete-response-header",description:"Delete response header: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"set-request-header",description:"Set request header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"append-request-header",description:"Append to request header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"delete-request-header",description:"Delete request header: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"set-request-query",description:"Set query parameter: key=value (repeatable)",shorthand:null,type:[String],argument:"PARAM",deprecated:!1},{name:"append-request-query",description:"Append to query parameter: key=value (repeatable)",shorthand:null,type:[String],argument:"PARAM",deprecated:!1},{name:"delete-request-query",description:"Delete query parameter: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"has",description:"Condition that must match: type:key or type:key:value (repeatable)",shorthand:null,type:[String],argument:"CONDITION",deprecated:!1},{name:"missing",description:'"Does not have" condition: type:key or type:key:value (repeatable)',shorthand:null,type:[String],argument:"CONDITION",deprecated:!1},{name:"description",description:"Route description (max 1024 chars)",shorthand:null,type:String,argument:"TEXT",deprecated:!1},{name:"disabled",description:"Create route in disabled state",shorthand:null,type:Boolean,deprecated:!1},{name:"ai",description:"Generate route from a natural language description (AI-powered)",shorthand:null,type:String,argument:"PROMPT",deprecated:!1},{name:"position",description:"Position: start, end, after:<id>, before:<id>",shorthand:null,type:String,argument:"POSITION",deprecated:!1},{name:"yes",description:"Skip confirmation prompts",shorthand:"y",type:Boolean,deprecated:!1}],examples:[{name:"Interactive mode",value:`${packageName} routes add`},{name:"Create with AI",value:`${packageName} routes add --ai "Rewrite /api/* to https://backend.internal/*"`},{name:"Add a rewrite",value:`${packageName} routes add "API Proxy" --src "/api/:path*" --src-syntax path-to-regexp --action rewrite --dest "https://api.example.com/:path*" --yes`},{name:"Add a redirect",value:`${packageName} routes add "Old Blog" --src "/blog" --src-syntax equals --action redirect --dest "/articles" --status 301 --yes`},{name:"Add CORS headers",value:`${packageName} routes add "CORS" --src "^/api/.*$" --set-response-header "Access-Control-Allow-Origin=*" --yes`},{name:"Block access (set status)",value:`${packageName} routes add "Block Admin" --src "^/admin/.*$" --action set-status --status 403 --yes`},{name:"Conditional redirect",value:`${packageName} routes add "Auth Required" --src "/protected/:path*" --src-syntax path-to-regexp --action redirect --dest "/login" --status 307 --missing "cookie:session" --yes`},{name:"Rewrite with request headers",value:`${packageName} routes add "Backend Proxy" --src "/backend/:path*" --src-syntax path-to-regexp --action rewrite --dest "https://internal.example.com/:path*" --set-request-header "X-Forwarded-Host=myapp.com" --yes`},{name:"Add route at start",value:`${packageName} routes add "Priority Route" --src "/priority" --src-syntax equals --action rewrite --dest "/handler" --position start --yes`}]},publishSubcommand={name:"publish",aliases:[],description:"Publish all staged routing changes to production",arguments:[],options:[projectOption,{...yesOption,description:"Skip the confirmation prompt when publishing"}],examples:[{name:"Publish staged changes",value:`${packageName} routes publish`},{name:"Publish without confirmation",value:`${packageName} routes publish --yes`}]},restoreSubcommand={name:"restore",aliases:[],description:"Restore a previous routing version to production",arguments:[{name:"version-id",required:!0}],options:[projectOption,{...yesOption,description:"Skip the confirmation prompt when restoring"}],examples:[{name:"Restore a previous version",value:`${packageName} routes restore <version-id>`},{name:"Restore without confirmation",value:`${packageName} routes restore <version-id> --yes`}]},discardSubcommand={name:"discard-staging",aliases:[],description:"Discard staged routing changes",arguments:[],options:[projectOption,{...yesOption,description:"Skip the confirmation prompt when discarding"}],examples:[{name:"Discard staged changes",value:`${packageName} routes discard-staging`},{name:"Discard without confirmation",value:`${packageName} routes discard-staging --yes`}]},deleteSubcommand={name:"delete",aliases:["rm"],description:"Delete one or more routing rules",arguments:[{name:"name-or-id",required:!0,multiple:!0}],options:[projectOption,{...yesOption,description:"Skip the confirmation prompt when deleting"}],examples:[{name:"Delete a route by name",value:`${packageName} routes delete "Old Redirect"`},{name:"Delete a route by ID",value:`${packageName} routes delete abc123`},{name:"Delete multiple routes",value:`${packageName} routes delete "Route A" "Route B"`},{name:"Delete without confirmation",value:`${packageName} routes delete "Old Route" --yes`}]},enableSubcommand={name:"enable",aliases:[],description:"Enable a disabled routing rule",arguments:[{name:"name-or-id",required:!0}],options:[projectOption],examples:[{name:"Enable a route by name",value:`${packageName} routes enable "API Proxy"`},{name:"Enable a route by ID",value:`${packageName} routes enable abc123`}]},disableSubcommand={name:"disable",aliases:[],description:"Disable a routing rule without deleting it",arguments:[{name:"name-or-id",required:!0}],options:[projectOption],examples:[{name:"Disable a route by name",value:`${packageName} routes disable "API Proxy"`},{name:"Disable a route by ID",value:`${packageName} routes disable abc123`}]},reorderSubcommand={name:"reorder",aliases:["move"],description:"Move a routing rule to a different position",arguments:[{name:"name-or-id",required:!0}],options:[projectOption,{name:"position",description:"Target position: start, end, a number (1-based), before:<id>, after:<id>",shorthand:null,type:String,argument:"POSITION",deprecated:!1},{name:"first",description:"Move to the first position (highest priority)",shorthand:null,type:Boolean,deprecated:!1},{name:"last",description:"Move to the last position (lowest priority)",shorthand:null,type:Boolean,deprecated:!1},{...yesOption,description:"Skip the confirmation prompt when reordering"}],examples:[{name:"Move to first position",value:`${packageName} routes reorder "Catch All" --first`},{name:"Move to last position",value:`${packageName} routes reorder "Catch All" --last`},{name:"Move to a specific position",value:`${packageName} routes reorder "API Proxy" --position 3`},{name:"Move after another route",value:`${packageName} routes reorder "API Proxy" --position after:route-id-123`},{name:"Interactive reorder (prompts for position)",value:`${packageName} routes reorder "API Proxy"`}]},editSubcommand={name:"edit",aliases:[],description:"Edit an existing routing rule",arguments:[{name:"name-or-id",required:!0}],options:[projectOption,{name:"name",description:"Change route name",shorthand:null,type:String,argument:"NAME",deprecated:!1},{name:"description",description:'Change description (use "" to clear)',shorthand:null,type:String,argument:"TEXT",deprecated:!1},{name:"src",description:"Change source path pattern",shorthand:null,type:String,argument:"PATTERN",deprecated:!1},{name:"src-syntax",description:"Change path syntax: regex, path-to-regexp, equals",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"action",description:"Set action type: rewrite, redirect, or set-status (required when switching types)",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"dest",description:"Set destination URL",shorthand:null,type:String,argument:"URL",deprecated:!1},{name:"status",description:"Set status code",shorthand:null,type:Number,argument:"CODE",deprecated:!1},{name:"no-dest",description:"Remove destination",shorthand:null,type:Boolean,deprecated:!1},{name:"no-status",description:"Remove status code",shorthand:null,type:Boolean,deprecated:!1},{name:"set-response-header",description:"Set response header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"append-response-header",description:"Append to response header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"delete-response-header",description:"Delete response header: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"set-request-header",description:"Set request header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"append-request-header",description:"Append to request header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"delete-request-header",description:"Delete request header: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"set-request-query",description:"Set query parameter: key=value (repeatable)",shorthand:null,type:[String],argument:"PARAM",deprecated:!1},{name:"append-request-query",description:"Append to query parameter: key=value (repeatable)",shorthand:null,type:[String],argument:"PARAM",deprecated:!1},{name:"delete-request-query",description:"Delete query parameter: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"has",description:"Add a has condition: type:key or type:key:value (repeatable)",shorthand:null,type:[String],argument:"CONDITION",deprecated:!1},{name:"missing",description:'Add a "does not have" condition: type:key or type:key:value (repeatable)',shorthand:null,type:[String],argument:"CONDITION",deprecated:!1},{name:"clear-conditions",description:"Remove all has/does-not-have conditions",shorthand:null,type:Boolean,deprecated:!1},{name:"clear-headers",description:"Remove all response headers",shorthand:null,type:Boolean,deprecated:!1},{name:"clear-transforms",description:"Remove all transforms (request headers, request query)",shorthand:null,type:Boolean,deprecated:!1},{name:"ai",description:"Describe changes using natural language (AI-powered)",shorthand:null,type:String,argument:"PROMPT",deprecated:!1},{...yesOption,description:"Skip confirmation prompts"}],examples:[{name:"Interactive mode",value:`${packageName} routes edit "API Proxy"`},{name:"Edit with AI",value:`${packageName} routes edit "API Proxy" --ai "Add CORS headers and change status to 308"`},{name:"Change destination",value:`${packageName} routes edit "API Proxy" --dest "https://new-api.example.com/:path*"`},{name:"Switch to redirect",value:`${packageName} routes edit "Old Route" --action redirect --dest "/new" --status 301`},{name:"Add a response header",value:`${packageName} routes edit "My Route" --set-response-header "Cache-Control=public, max-age=3600"`},{name:"Clear all conditions and add new ones",value:`${packageName} routes edit "My Route" --clear-conditions --has "header:Authorization"`}]},exportSubcommand={name:"export",aliases:[],description:"Export routes to a vercel.json or vercel.ts file",arguments:[{name:"name-or-id",required:!1}],options:[projectOption,{name:"output",description:"Output file format: .json (default) or .ts",shorthand:"o",type:String,argument:"json|ts",deprecated:!1}],examples:[{name:"Export as vercel.json format",value:`${packageName} routes export`},{name:"Export as vercel.ts format",value:`${packageName} routes export --output ts`},{name:"Export a specific route",value:`${packageName} routes export "API Proxy"`},{name:"Export to a file",value:`${packageName} routes export > routes.json`}]},routesCommand={name:"routes",aliases:[],description:"Manage routing rules for a project. Routes managed at the project level apply to all deployments and environments.",arguments:[],subcommands:[listSubcommand,listVersionsSubcommand,inspectSubcommand,addSubcommand,editSubcommand,deleteSubcommand,enableSubcommand,disableSubcommand,reorderSubcommand,exportSubcommand,publishSubcommand,restoreSubcommand,discardSubcommand],options:[],examples:[]};export{listSubcommand,listVersionsSubcommand,inspectSubcommand,addSubcommand,publishSubcommand,restoreSubcommand,discardSubcommand,deleteSubcommand,enableSubcommand,disableSubcommand,reorderSubcommand,editSubcommand,exportSubcommand,routesCommand};
|
|
7
|
+
import{projectOption,yesOption}from"./chunk-ROOWZCAB.js";import{packageName}from"./chunk-FI772UVH.js";var listSubcommand={name:"list",aliases:["ls"],description:"List all routing rules for the current project. These routes apply to all deployments and environments.",arguments:[],options:[projectOption,{name:"search",description:"Search by name, description, source, or destination",shorthand:"s",type:String,argument:"QUERY",deprecated:!1},{name:"filter",description:"Filter by type: rewrite, redirect, set_status, transform",shorthand:"f",type:String,argument:"TYPE",deprecated:!1},{name:"production",description:"List routes from the live production version",shorthand:null,type:Boolean,deprecated:!1},{name:"version-id",description:"List routes from a specific version ID",shorthand:null,type:String,argument:"VERSION_ID",deprecated:!1},{name:"diff",description:"Compare staged changes against production. Use with --version-id to compare a specific version.",shorthand:null,type:Boolean,deprecated:!1},{name:"expand",description:"Show expanded details for each route",shorthand:"e",type:Boolean,deprecated:!1}],examples:[{name:"List all routes",value:`${packageName} routes list`},{name:"Search for routes",value:`${packageName} routes list --search "api"`},{name:"Filter by type",value:`${packageName} routes list --filter rewrite`},{name:"Show staged changes",value:`${packageName} routes list --diff`},{name:"Show live production routes",value:`${packageName} routes list --production`},{name:"Show expanded details",value:`${packageName} routes list --expand`}]},listVersionsSubcommand={name:"list-versions",aliases:["ls-versions"],description:"List all versions of routing rules",arguments:[],options:[projectOption,{name:"count",description:"Number of versions to fetch (default: 20, max: 100)",shorthand:null,type:Number,argument:"NUMBER",deprecated:!1}],examples:[{name:"List route versions",value:`${packageName} routes list-versions`},{name:"List more versions",value:`${packageName} routes list-versions --count 50`}]},inspectSubcommand={name:"inspect",aliases:[],description:"Show detailed information about a specific route",arguments:[{name:"name-or-id",required:!0}],options:[projectOption,{name:"diff",description:"Compare staged changes against production for this route",shorthand:null,type:Boolean,deprecated:!1}],examples:[{name:"Inspect a route by name",value:`${packageName} routes inspect "API rewrite"`},{name:"Inspect a route by ID",value:`${packageName} routes inspect abc123`},{name:"Show staged changes for a route",value:`${packageName} routes inspect "My route" --diff`}]},addSubcommand={name:"add",aliases:[],description:"Add a new routing rule to the project",arguments:[{name:"name",required:!1}],options:[projectOption,{name:"src",description:"Path pattern (required in non-interactive mode)",shorthand:null,type:String,argument:"PATTERN",deprecated:!1},{name:"src-syntax",description:"Path syntax: regex (default), path-to-regexp, equals",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"action",description:"Action type: rewrite, redirect, or set-status (required with --dest/--status)",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"dest",description:"Destination URL for rewrite or redirect",shorthand:null,type:String,argument:"URL",deprecated:!1},{name:"status",description:"Status code (301/302/307/308 for redirect, or any for set-status)",shorthand:null,type:Number,argument:"CODE",deprecated:!1},{name:"set-response-header",description:"Set response header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"append-response-header",description:"Append to response header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"delete-response-header",description:"Delete response header: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"set-request-header",description:"Set request header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"append-request-header",description:"Append to request header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"delete-request-header",description:"Delete request header: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"set-request-query",description:"Set query parameter: key=value (repeatable)",shorthand:null,type:[String],argument:"PARAM",deprecated:!1},{name:"append-request-query",description:"Append to query parameter: key=value (repeatable)",shorthand:null,type:[String],argument:"PARAM",deprecated:!1},{name:"delete-request-query",description:"Delete query parameter: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"has",description:"Condition that must match: type:key or type:key:value (repeatable)",shorthand:null,type:[String],argument:"CONDITION",deprecated:!1},{name:"missing",description:'"Does not have" condition: type:key or type:key:value (repeatable)',shorthand:null,type:[String],argument:"CONDITION",deprecated:!1},{name:"description",description:"Route description (max 1024 chars)",shorthand:null,type:String,argument:"TEXT",deprecated:!1},{name:"disabled",description:"Create route in disabled state",shorthand:null,type:Boolean,deprecated:!1},{name:"ai",description:"Generate route from a natural language description (AI-powered)",shorthand:null,type:String,argument:"PROMPT",deprecated:!1},{name:"position",description:"Position: start, end, after:<id>, before:<id>",shorthand:null,type:String,argument:"POSITION",deprecated:!1},{name:"yes",description:"Skip confirmation prompts",shorthand:"y",type:Boolean,deprecated:!1}],examples:[{name:"Interactive mode",value:`${packageName} routes add`},{name:"Create with AI",value:`${packageName} routes add --ai "Rewrite /api/* to https://backend.internal/*"`},{name:"Add a rewrite",value:`${packageName} routes add "API Proxy" --src "/api/:path*" --src-syntax path-to-regexp --action rewrite --dest "https://api.example.com/:path*" --yes`},{name:"Add a redirect",value:`${packageName} routes add "Old Blog" --src "/blog" --src-syntax equals --action redirect --dest "/articles" --status 301 --yes`},{name:"Add CORS headers",value:`${packageName} routes add "CORS" --src "^/api/.*$" --set-response-header "Access-Control-Allow-Origin=*" --yes`},{name:"Block access (set status)",value:`${packageName} routes add "Block Admin" --src "^/admin/.*$" --action set-status --status 403 --yes`},{name:"Conditional redirect",value:`${packageName} routes add "Auth Required" --src "/protected/:path*" --src-syntax path-to-regexp --action redirect --dest "/login" --status 307 --missing "cookie:session" --yes`},{name:"Rewrite with request headers",value:`${packageName} routes add "Backend Proxy" --src "/backend/:path*" --src-syntax path-to-regexp --action rewrite --dest "https://internal.example.com/:path*" --set-request-header "X-Forwarded-Host=myapp.com" --yes`},{name:"Add route at start",value:`${packageName} routes add "Priority Route" --src "/priority" --src-syntax equals --action rewrite --dest "/handler" --position start --yes`}]},publishSubcommand={name:"publish",aliases:[],description:"Publish all staged routing changes to production",arguments:[],options:[projectOption,{...yesOption,description:"Skip the confirmation prompt when publishing"}],examples:[{name:"Publish staged changes",value:`${packageName} routes publish`},{name:"Publish without confirmation",value:`${packageName} routes publish --yes`}]},restoreSubcommand={name:"restore",aliases:[],description:"Restore a previous routing version to production",arguments:[{name:"version-id",required:!0}],options:[projectOption,{...yesOption,description:"Skip the confirmation prompt when restoring"}],examples:[{name:"Restore a previous version",value:`${packageName} routes restore <version-id>`},{name:"Restore without confirmation",value:`${packageName} routes restore <version-id> --yes`}]},discardSubcommand={name:"discard-staging",aliases:[],description:"Discard staged routing changes",arguments:[],options:[projectOption,{...yesOption,description:"Skip the confirmation prompt when discarding"}],examples:[{name:"Discard staged changes",value:`${packageName} routes discard-staging`},{name:"Discard without confirmation",value:`${packageName} routes discard-staging --yes`}]},deleteSubcommand={name:"delete",aliases:["rm"],description:"Delete one or more routing rules",arguments:[{name:"name-or-id",required:!0,multiple:!0}],options:[projectOption,{...yesOption,description:"Skip the confirmation prompt when deleting"}],examples:[{name:"Delete a route by name",value:`${packageName} routes delete "Old Redirect"`},{name:"Delete a route by ID",value:`${packageName} routes delete abc123`},{name:"Delete multiple routes",value:`${packageName} routes delete "Route A" "Route B"`},{name:"Delete without confirmation",value:`${packageName} routes delete "Old Route" --yes`}]},enableSubcommand={name:"enable",aliases:[],description:"Enable a disabled routing rule",arguments:[{name:"name-or-id",required:!0}],options:[projectOption],examples:[{name:"Enable a route by name",value:`${packageName} routes enable "API Proxy"`},{name:"Enable a route by ID",value:`${packageName} routes enable abc123`}]},disableSubcommand={name:"disable",aliases:[],description:"Disable a routing rule without deleting it",arguments:[{name:"name-or-id",required:!0}],options:[projectOption],examples:[{name:"Disable a route by name",value:`${packageName} routes disable "API Proxy"`},{name:"Disable a route by ID",value:`${packageName} routes disable abc123`}]},reorderSubcommand={name:"reorder",aliases:["move"],description:"Move a routing rule to a different position",arguments:[{name:"name-or-id",required:!0}],options:[projectOption,{name:"position",description:"Target position: start, end, a number (1-based), before:<id>, after:<id>",shorthand:null,type:String,argument:"POSITION",deprecated:!1},{name:"first",description:"Move to the first position (highest priority)",shorthand:null,type:Boolean,deprecated:!1},{name:"last",description:"Move to the last position (lowest priority)",shorthand:null,type:Boolean,deprecated:!1},{...yesOption,description:"Skip the confirmation prompt when reordering"}],examples:[{name:"Move to first position",value:`${packageName} routes reorder "Catch All" --first`},{name:"Move to last position",value:`${packageName} routes reorder "Catch All" --last`},{name:"Move to a specific position",value:`${packageName} routes reorder "API Proxy" --position 3`},{name:"Move after another route",value:`${packageName} routes reorder "API Proxy" --position after:route-id-123`},{name:"Interactive reorder (prompts for position)",value:`${packageName} routes reorder "API Proxy"`}]},editSubcommand={name:"edit",aliases:[],description:"Edit an existing routing rule",arguments:[{name:"name-or-id",required:!0}],options:[projectOption,{name:"name",description:"Change route name",shorthand:null,type:String,argument:"NAME",deprecated:!1},{name:"description",description:'Change description (use "" to clear)',shorthand:null,type:String,argument:"TEXT",deprecated:!1},{name:"src",description:"Change source path pattern",shorthand:null,type:String,argument:"PATTERN",deprecated:!1},{name:"src-syntax",description:"Change path syntax: regex, path-to-regexp, equals",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"action",description:"Set action type: rewrite, redirect, or set-status (required when switching types)",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"dest",description:"Set destination URL",shorthand:null,type:String,argument:"URL",deprecated:!1},{name:"status",description:"Set status code",shorthand:null,type:Number,argument:"CODE",deprecated:!1},{name:"no-dest",description:"Remove destination",shorthand:null,type:Boolean,deprecated:!1},{name:"no-status",description:"Remove status code",shorthand:null,type:Boolean,deprecated:!1},{name:"set-response-header",description:"Set response header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"append-response-header",description:"Append to response header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"delete-response-header",description:"Delete response header: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"set-request-header",description:"Set request header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"append-request-header",description:"Append to request header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"delete-request-header",description:"Delete request header: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"set-request-query",description:"Set query parameter: key=value (repeatable)",shorthand:null,type:[String],argument:"PARAM",deprecated:!1},{name:"append-request-query",description:"Append to query parameter: key=value (repeatable)",shorthand:null,type:[String],argument:"PARAM",deprecated:!1},{name:"delete-request-query",description:"Delete query parameter: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"has",description:"Add a has condition: type:key or type:key:value (repeatable)",shorthand:null,type:[String],argument:"CONDITION",deprecated:!1},{name:"missing",description:'Add a "does not have" condition: type:key or type:key:value (repeatable)',shorthand:null,type:[String],argument:"CONDITION",deprecated:!1},{name:"clear-conditions",description:"Remove all has/does-not-have conditions",shorthand:null,type:Boolean,deprecated:!1},{name:"clear-headers",description:"Remove all response headers",shorthand:null,type:Boolean,deprecated:!1},{name:"clear-transforms",description:"Remove all transforms (request headers, request query)",shorthand:null,type:Boolean,deprecated:!1},{name:"ai",description:"Describe changes using natural language (AI-powered)",shorthand:null,type:String,argument:"PROMPT",deprecated:!1},{...yesOption,description:"Skip confirmation prompts"}],examples:[{name:"Interactive mode",value:`${packageName} routes edit "API Proxy"`},{name:"Edit with AI",value:`${packageName} routes edit "API Proxy" --ai "Add CORS headers and change status to 308"`},{name:"Change destination",value:`${packageName} routes edit "API Proxy" --dest "https://new-api.example.com/:path*"`},{name:"Switch to redirect",value:`${packageName} routes edit "Old Route" --action redirect --dest "/new" --status 301`},{name:"Add a response header",value:`${packageName} routes edit "My Route" --set-response-header "Cache-Control=public, max-age=3600"`},{name:"Clear all conditions and add new ones",value:`${packageName} routes edit "My Route" --clear-conditions --has "header:Authorization"`}]},exportSubcommand={name:"export",aliases:[],description:"Export routes to a vercel.json or vercel.ts file",arguments:[{name:"name-or-id",required:!1}],options:[projectOption,{name:"output",description:"Output file format: .json (default) or .ts",shorthand:"o",type:String,argument:"json|ts",deprecated:!1}],examples:[{name:"Export as vercel.json format",value:`${packageName} routes export`},{name:"Export as vercel.ts format",value:`${packageName} routes export --output ts`},{name:"Export a specific route",value:`${packageName} routes export "API Proxy"`},{name:"Export to a file",value:`${packageName} routes export > routes.json`}]},routesCommand={name:"routes",aliases:[],description:"Manage routing rules for a project. Routes managed at the project level apply to all deployments and environments.",arguments:[],subcommands:[listSubcommand,listVersionsSubcommand,inspectSubcommand,addSubcommand,editSubcommand,deleteSubcommand,enableSubcommand,disableSubcommand,reorderSubcommand,exportSubcommand,publishSubcommand,restoreSubcommand,discardSubcommand],options:[],examples:[]};export{listSubcommand,listVersionsSubcommand,inspectSubcommand,addSubcommand,publishSubcommand,restoreSubcommand,discardSubcommand,deleteSubcommand,enableSubcommand,disableSubcommand,reorderSubcommand,editSubcommand,exportSubcommand,routesCommand};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{formatOption,jsonOption,projectOption,yesOption}from"./chunk-ROOWZCAB.js";import{packageName}from"./chunk-FI772UVH.js";var builtInBody={type:"built-in",name:"Production server errors",triggers:{mode:"selected",items:[{type:"error_anomaly",filter:"statusGroup:5xx AND route:/api/*"}]},matchMinimumSeverityLevel:"high"},patchBody={name:"Critical production errors",matchMinimumSeverityLevel:"critical"},authoringReference={title:"Authoring reference",body:["vercel alerts rules schema --type built-in"]},rulesAddHelpSections=[{title:"Scope",body:["Provide ruleScope in the body or use a scope flag, not both.","--project maps to one included project.","--all maps to every project in the team."]},{title:"Built-in body (rule.json)",body:[...JSON.stringify(builtInBody,null,2).split(`
|
|
8
|
+
`),"","vercel alerts rules create --project my-app --body ./rule.json"]},authoringReference],rulesUpdateHelpSections=[{title:"Update body",body:["Include only the fields to change. type is optional and inferred from the stored rule.","Use --project or --all to change scope with or without --body.","Do not combine a ruleScope field in the body with --project or --all.","--all moves the rule to team-wide scope."]},{title:"Partial body (patch.json)",body:[...JSON.stringify(patchBody,null,2).split(`
|
|
9
|
+
`),"","vercel alerts rules update ar_abc123 --body ./patch.json","vercel alerts rules update ar_abc123 --project my-app"]},authoringReference];var projectScopeOption={...projectOption,shorthand:"p",description:"Use a project by name or ID"},listAllOption={name:"all",shorthand:"a",type:Boolean,deprecated:!1,description:"List all accessible rules in the selected team"},mutationAllOption={...listAllOption,description:"Apply the rule to all projects in the selected team"},deprecatedItemScopeOptions=[{...projectScopeOption,deprecated:!0},{...listAllOption,deprecated:!0}],bodyOption={name:"body",shorthand:null,type:String,argument:"PATH",deprecated:!1,description:"Read the alert rule body from a JSON file"},rulesLsSubcommand={name:"ls",aliases:["list"],default:!0,description:"List alert rules for a project or team",arguments:[],options:[projectScopeOption,listAllOption,{name:"type",shorthand:null,type:[String],argument:"TYPE",deprecated:!1,description:"Filter by rule type"},formatOption,jsonOption],examples:[{name:"List rules affecting the linked project",value:`${packageName} alerts rules ls`},{name:"List all rules in the selected team",value:`${packageName} alerts rules ls --all`},{name:"Write JSON output",value:`${packageName} alerts rules ls --all --json`}]},rulesSchemaSubcommand={name:"schema",aliases:[],description:"Show alert rule request fields and examples",arguments:[],options:[{name:"type",shorthand:null,type:String,argument:"TYPE",deprecated:!1,description:"Rule type to describe"},formatOption],examples:[{name:"List supported rule types",value:`${packageName} alerts rules schema`},{name:"Show the built-in rule schema",value:`${packageName} alerts rules schema --type built-in`}]},rulesAddSubcommand={name:"create",aliases:["add"],description:"Create an alert rule from a JSON body",helpSections:rulesAddHelpSections,arguments:[],options:[projectScopeOption,mutationAllOption,formatOption,jsonOption,bodyOption],examples:[{name:"Create a project-scoped rule",value:`${packageName} alerts rules create --project my-app --body ./rule.json`},{name:"Create a team-wide built-in rule",value:`${packageName} alerts rules create --all --body ./rule.json`}]},rulesInspectSubcommand={name:"inspect",aliases:["get"],description:"Show one alert rule by ID",arguments:[{name:"ruleId",required:!0}],options:[...deprecatedItemScopeOptions,formatOption,jsonOption],examples:[{name:"Inspect a rule",value:`${packageName} alerts rules inspect ar_abc123`},{name:"Write JSON output",value:`${packageName} alerts rules inspect ar_abc123 --json`}]},rulesRmSubcommand={name:"rm",aliases:["remove","delete"],description:"Delete an alert rule",arguments:[{name:"ruleId",required:!0}],options:[...deprecatedItemScopeOptions,formatOption,jsonOption,yesOption],examples:[{name:"Delete with confirmation",value:`${packageName} alerts rules rm ar_abc123`},{name:"Delete without a prompt",value:`${packageName} alerts rules rm ar_abc123 --yes`}]},rulesUpdateSubcommand={name:"update",aliases:["patch"],description:"Patch an alert rule or change its scope",helpSections:rulesUpdateHelpSections,arguments:[{name:"ruleId",required:!0}],options:[projectScopeOption,mutationAllOption,formatOption,jsonOption,{...bodyOption,description:"Read the partial update body from a JSON file"}],examples:[{name:"Update fields from a file",value:`${packageName} alerts rules update ar_abc123 --body ./patch.json`},{name:"Move a rule to a project",value:`${packageName} alerts rules update ar_abc123 --project my-app`}]},notificationTargetOptions=[{name:"webhook",shorthand:null,type:String,argument:"WEBHOOK_ID",deprecated:!1,description:"Select an account webhook by ID"},{name:"slack-channel",shorthand:null,type:String,argument:"CHANNEL_ID",deprecated:!1,description:"Select a Slack channel by ID"},{name:"slack-installation-id",shorthand:null,type:String,argument:"INSTALLATION_ID",deprecated:!1,description:"Slack installation ID. Optional only when the team has exactly one completed Slack installation."}],criticalOnlyOption={name:"critical-only",shorthand:null,type:Boolean,deprecated:!1,description:"Notify only when Vercel Agent escalates an alert to Critical"},noCriticalOnlyOption={name:"no-critical-only",shorthand:null,type:Boolean,deprecated:!1,description:"Deliver every alert matched by the rule"},rulesNotificationsLsSubcommand={name:"ls",aliases:["list"],default:!0,description:"List notification destinations for all readable rules or one alert rule",arguments:[{name:"ruleId",required:!1}],options:[formatOption,jsonOption],examples:[{name:"List notification destinations for all readable rules",value:`${packageName} alerts rules notifications ls`},{name:"List notification destinations for one rule",value:`${packageName} alerts rules notifications ls ar_abc123`},{name:"Write JSON output",value:`${packageName} alerts rules notifications ar_abc123 --json`}]},rulesNotificationsLinkSubcommand={name:"link",aliases:[],description:"Link a Slack channel or account webhook to an alert rule",arguments:[{name:"<ruleId>",required:!0}],options:[...notificationTargetOptions,criticalOnlyOption,formatOption,jsonOption],examples:[{name:"Link a Slack channel",value:`${packageName} alerts rules notifications link ar_abc123 --slack-channel C123`},{name:"Link a Slack channel from a specific installation",value:`${packageName} alerts rules notifications link ar_abc123 --slack-channel C123 --slack-installation-id icfg_abc123`},{name:"Link a webhook",value:`${packageName} alerts rules notifications link ar_abc123 --webhook wh_abc123`},{name:"Link a Critical-only webhook",value:`${packageName} alerts rules notifications link ar_abc123 --webhook wh_abc123 --critical-only`}]},rulesNotificationsUpdateSubcommand={name:"update",aliases:["patch"],description:"Update a notification destination's delivery setting",arguments:[{name:"<ruleId>",required:!0}],options:[...notificationTargetOptions,criticalOnlyOption,noCriticalOnlyOption,formatOption,jsonOption],examples:[{name:"Restrict a Slack channel to Critical alerts",value:`${packageName} alerts rules notifications update ar_abc123 --slack-channel C123 --critical-only`},{name:"Restore delivery for every alert matched by the rule",value:`${packageName} alerts rules notifications update ar_abc123 --webhook wh_abc123 --no-critical-only`}]},rulesNotificationsUnlinkSubcommand={name:"unlink",aliases:[],description:"Unlink a Slack channel or account webhook from an alert rule",arguments:[{name:"<ruleId>",required:!0}],options:[...notificationTargetOptions,formatOption,jsonOption],examples:[{name:"Unlink a Slack channel",value:`${packageName} alerts rules notifications unlink ar_abc123 --slack-channel C123`},{name:"Unlink a webhook",value:`${packageName} alerts rules notifications unlink ar_abc123 --webhook wh_abc123`}]},rulesNotificationsAggregateCommand={name:"notifications",aliases:[],description:"List and manage linked Slack and webhook destinations for alert rules",arguments:[],subcommands:[rulesNotificationsLsSubcommand,rulesNotificationsLinkSubcommand,rulesNotificationsUpdateSubcommand,rulesNotificationsUnlinkSubcommand],options:[formatOption,jsonOption],examples:[{name:"List destinations for all readable rules",value:`${packageName} alerts rules notifications`},{name:"List destinations for one rule",value:`${packageName} alerts rules notifications ar_abc123`},{name:"Link Slack with the team's only installation",value:`${packageName} alerts rules notifications link ar_abc123 --slack-channel C123`}]},rulesAggregateCommand={name:"rules",aliases:[],description:"Create, inspect, list, update, and delete alert rules and manage their notification destinations",arguments:[],subcommands:[rulesLsSubcommand,rulesSchemaSubcommand,rulesAddSubcommand,rulesInspectSubcommand,rulesRmSubcommand,rulesUpdateSubcommand,rulesNotificationsAggregateCommand],options:[],examples:[{name:"List rules for the linked project",value:`${packageName} alerts rules ls`},{name:"Create a rule",value:`${packageName} alerts rules create --project my-app --body ./rule.json`},{name:"Inspect a rule",value:`${packageName} alerts rules inspect ar_abc123`},{name:"Update a rule",value:`${packageName} alerts rules update ar_abc123 --body ./patch.json`},{name:"Delete a rule",value:`${packageName} alerts rules rm ar_abc123`},{name:"List notification destinations for a rule",value:`${packageName} alerts rules notifications ar_abc123`}]};export{rulesLsSubcommand,rulesSchemaSubcommand,rulesAddSubcommand,rulesInspectSubcommand,rulesRmSubcommand,rulesUpdateSubcommand,rulesNotificationsLsSubcommand,rulesNotificationsLinkSubcommand,rulesNotificationsUpdateSubcommand,rulesNotificationsUnlinkSubcommand,rulesNotificationsAggregateCommand,rulesAggregateCommand};
|
|
@@ -7,7 +7,7 @@ const __dirname = __dirname_(__filename);
|
|
|
7
7
|
import{require_load_json_file,require_pify}from"./chunk-RCTYVKM5.js";import{isNativeBinaryInstall}from"./chunk-7T6TL3GQ.js";import{require_graceful_fs}from"./chunk-F2ZWW2IO.js";import{output_manager_default,require_build_utils,require_signal_exit}from"./chunk-EWWFNMPZ.js";import{__commonJS,__require,__toESM}from"./chunk-6L236MNA.js";var require_dist=__commonJS({"../../internals/constants/dist/index.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.TITLE=exports.NAME=exports.LOGO=exports.PROJECT_ENV_TARGET=void 0;exports.PROJECT_ENV_TARGET=["production","preview","development"];exports.LOGO="\u25B2";exports.NAME="vercel";exports.TITLE="Vercel"}});var require_imurmurhash=__commonJS({"../../node_modules/.pnpm/imurmurhash@0.1.4/node_modules/imurmurhash/imurmurhash.js"(exports,module){(function(){var cache;function MurmurHash3(key,seed){var m=this instanceof MurmurHash3?this:cache;if(m.reset(seed),typeof key=="string"&&key.length>0&&m.hash(key),m!==this)return m}MurmurHash3.prototype.hash=function(key){var h1,k1,i,top,len;switch(len=key.length,this.len+=len,k1=this.k1,i=0,this.rem){case 0:k1^=len>i?key.charCodeAt(i++)&65535:0;case 1:k1^=len>i?(key.charCodeAt(i++)&65535)<<8:0;case 2:k1^=len>i?(key.charCodeAt(i++)&65535)<<16:0;case 3:k1^=len>i?(key.charCodeAt(i)&255)<<24:0,k1^=len>i?(key.charCodeAt(i++)&65280)>>8:0}if(this.rem=len+this.rem&3,len-=this.rem,len>0){for(h1=this.h1;k1=k1*11601+(k1&65535)*3432906752&4294967295,k1=k1<<15|k1>>>17,k1=k1*13715+(k1&65535)*461832192&4294967295,h1^=k1,h1=h1<<13|h1>>>19,h1=h1*5+3864292196&4294967295,!(i>=len);)k1=key.charCodeAt(i++)&65535^(key.charCodeAt(i++)&65535)<<8^(key.charCodeAt(i++)&65535)<<16,top=key.charCodeAt(i++),k1^=(top&255)<<24^(top&65280)>>8;switch(k1=0,this.rem){case 3:k1^=(key.charCodeAt(i+2)&65535)<<16;case 2:k1^=(key.charCodeAt(i+1)&65535)<<8;case 1:k1^=key.charCodeAt(i)&65535}this.h1=h1}return this.k1=k1,this},MurmurHash3.prototype.result=function(){var k1,h1;return k1=this.k1,h1=this.h1,k1>0&&(k1=k1*11601+(k1&65535)*3432906752&4294967295,k1=k1<<15|k1>>>17,k1=k1*13715+(k1&65535)*461832192&4294967295,h1^=k1),h1^=this.len,h1^=h1>>>16,h1=h1*51819+(h1&65535)*2246770688&4294967295,h1^=h1>>>13,h1=h1*44597+(h1&65535)*3266445312&4294967295,h1^=h1>>>16,h1>>>0},MurmurHash3.prototype.reset=function(seed){return this.h1=typeof seed=="number"?seed:0,this.rem=this.k1=this.len=0,this},cache=new MurmurHash3,typeof module<"u"?module.exports=MurmurHash3:this.MurmurHash3=MurmurHash3})()}});var require_write_file_atomic=__commonJS({"../../node_modules/.pnpm/write-file-atomic@2.4.3/node_modules/write-file-atomic/index.js"(exports,module){"use strict";module.exports=writeFile;module.exports.sync=writeFileSync2;module.exports._getTmpname=getTmpname;module.exports._cleanupOnExit=cleanupOnExit;var fs=require_graceful_fs(),MurmurHash3=require_imurmurhash(),onExit=require_signal_exit(),path=__require("path"),activeFiles={},threadId=function(){try{var workerThreads=__require("worker_threads");return workerThreads.threadId}catch{return 0}}(),invocations=0;function getTmpname(filename){return filename+"."+MurmurHash3(__filename).hash(String(process.pid)).hash(String(threadId)).hash(String(++invocations)).result()}function cleanupOnExit(tmpfile){return function(){try{fs.unlinkSync(typeof tmpfile=="function"?tmpfile():tmpfile)}catch{}}}function writeFile(filename,data,options,callback){options?options instanceof Function?(callback=options,options={}):typeof options=="string"&&(options={encoding:options}):options={};var Promise2=options.Promise||global.Promise,truename,fd,tmpfile,removeOnExitHandler=onExit(cleanupOnExit(()=>tmpfile)),absoluteName=path.resolve(filename);new Promise2(function(resolve){activeFiles[absoluteName]||(activeFiles[absoluteName]=[]),activeFiles[absoluteName].push(resolve),activeFiles[absoluteName].length===1&&resolve()}).then(function(){return new Promise2(function(resolve){fs.realpath(filename,function(_,realname){truename=realname||filename,tmpfile=getTmpname(truename),resolve()})})}).then(function(){return new Promise2(function(resolve){options.mode&&options.chown?resolve():fs.stat(truename,function(err,stats){err||!stats||(options=Object.assign({},options),options.mode==null&&(options.mode=stats.mode),options.chown==null&&process.getuid&&(options.chown={uid:stats.uid,gid:stats.gid})),resolve()})})}).then(function(){return new Promise2(function(resolve,reject){fs.open(tmpfile,"w",options.mode,function(err,_fd){fd=_fd,err?reject(err):resolve()})})}).then(function(){return new Promise2(function(resolve,reject){Buffer.isBuffer(data)?fs.write(fd,data,0,data.length,0,function(err){err?reject(err):resolve()}):data!=null?fs.write(fd,String(data),0,String(options.encoding||"utf8"),function(err){err?reject(err):resolve()}):resolve()})}).then(function(){return new Promise2(function(resolve,reject){options.fsync!==!1?fs.fsync(fd,function(err){err?fs.close(fd,()=>reject(err)):fs.close(fd,resolve)}):fs.close(fd,resolve)})}).then(function(){if(fd=null,options.chown)return new Promise2(function(resolve,reject){fs.chown(tmpfile,options.chown.uid,options.chown.gid,function(err){err?reject(err):resolve()})})}).then(function(){if(options.mode)return new Promise2(function(resolve,reject){fs.chmod(tmpfile,options.mode,function(err){err?reject(err):resolve()})})}).then(function(){return new Promise2(function(resolve,reject){fs.rename(tmpfile,truename,function(err){err?reject(err):resolve()})})}).then(function(){removeOnExitHandler(),callback()},function(err){return new Promise2(resolve=>fd?fs.close(fd,resolve):resolve()).then(()=>{removeOnExitHandler(),fs.unlink(tmpfile,function(){callback(err)})})}).then(function(){activeFiles[absoluteName].shift(),activeFiles[absoluteName].length>0?activeFiles[absoluteName][0]():delete activeFiles[absoluteName]})}function writeFileSync2(filename,data,options){typeof options=="string"?options={encoding:options}:options||(options={});try{filename=fs.realpathSync(filename)}catch{}var tmpfile=getTmpname(filename);if(!options.mode||!options.chown)try{var stats=fs.statSync(filename);options=Object.assign({},options),options.mode||(options.mode=stats.mode),!options.chown&&process.getuid&&(options.chown={uid:stats.uid,gid:stats.gid})}catch{}var fd,cleanup=cleanupOnExit(tmpfile),removeOnExitHandler=onExit(cleanup);try{fd=fs.openSync(tmpfile,"w",options.mode),Buffer.isBuffer(data)?fs.writeSync(fd,data,0,data.length,0):data!=null&&fs.writeSync(fd,String(data),0,String(options.encoding||"utf8")),options.fsync!==!1&&fs.fsyncSync(fd),fs.closeSync(fd),options.chown&&fs.chownSync(tmpfile,options.chown.uid,options.chown.gid),options.mode&&fs.chmodSync(tmpfile,options.mode),fs.renameSync(tmpfile,filename),removeOnExitHandler()}catch(err){if(fd)try{fs.closeSync(fd)}catch{}throw removeOnExitHandler(),cleanup(),err}}}});var require_is_plain_obj=__commonJS({"../../node_modules/.pnpm/is-plain-obj@1.1.0/node_modules/is-plain-obj/index.js"(exports,module){"use strict";var toString=Object.prototype.toString;module.exports=function(x){var prototype;return toString.call(x)==="[object Object]"&&(prototype=Object.getPrototypeOf(x),prototype===null||prototype===Object.getPrototypeOf({}))}}});var require_sort_keys=__commonJS({"../../node_modules/.pnpm/sort-keys@1.1.2/node_modules/sort-keys/index.js"(exports,module){"use strict";var isPlainObj=require_is_plain_obj();module.exports=function(obj,opts){if(!isPlainObj(obj))throw new TypeError("Expected a plain object");opts=opts||{},typeof opts=="function"&&(opts={compare:opts});var deep=opts.deep,seenInput=[],seenOutput=[],sortKeys=function(x){var seenIndex=seenInput.indexOf(x);if(seenIndex!==-1)return seenOutput[seenIndex];var ret={},keys=Object.keys(x).sort(opts.compare);seenInput.push(x),seenOutput.push(ret);for(var i=0;i<keys.length;i++){var key=keys[i],val=x[key];ret[key]=deep&&isPlainObj(val)?sortKeys(val):val}return ret};return sortKeys(obj)}}});var require_pify2=__commonJS({"../../node_modules/.pnpm/pify@3.0.0/node_modules/pify/index.js"(exports,module){"use strict";var processFn=(fn,opts)=>function(){let P=opts.promiseModule,args=new Array(arguments.length);for(let i=0;i<arguments.length;i++)args[i]=arguments[i];return new P((resolve,reject)=>{opts.errorFirst?args.push(function(err,result){if(opts.multiArgs){let results=new Array(arguments.length-1);for(let i=1;i<arguments.length;i++)results[i-1]=arguments[i];err?(results.unshift(err),reject(results)):resolve(results)}else err?reject(err):resolve(result)}):args.push(function(result){if(opts.multiArgs){let results=new Array(arguments.length-1);for(let i=0;i<arguments.length;i++)results[i]=arguments[i];resolve(results)}else resolve(result)}),fn.apply(this,args)})};module.exports=(obj,opts)=>{opts=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},opts);let filter=key=>{let match=pattern=>typeof pattern=="string"?key===pattern:pattern.test(key);return opts.include?opts.include.some(match):!opts.exclude.some(match)},ret;typeof obj=="function"?ret=function(){return opts.excludeMain?obj.apply(this,arguments):processFn(obj,opts).apply(this,arguments)}:ret=Object.create(Object.getPrototypeOf(obj));for(let key in obj){let x=obj[key];ret[key]=typeof x=="function"&&filter(key)?processFn(x,opts):x}return ret}}});var require_make_dir=__commonJS({"../../node_modules/.pnpm/make-dir@1.3.0/node_modules/make-dir/index.js"(exports,module){"use strict";var fs=__require("fs"),path=__require("path"),pify=require_pify2(),defaults={mode:511&~process.umask(),fs},checkPath=pth=>{if(process.platform==="win32"&&/[<>:"|?*]/.test(pth.replace(path.parse(pth).root,""))){let err=new Error(`Path contains invalid characters: ${pth}`);throw err.code="EINVAL",err}};module.exports=(input,opts)=>Promise.resolve().then(()=>{checkPath(input),opts=Object.assign({},defaults,opts);let mkdir=pify(opts.fs.mkdir),stat=pify(opts.fs.stat),make=pth=>mkdir(pth,opts.mode).then(()=>pth).catch(err=>{if(err.code==="ENOENT"){if(err.message.includes("null bytes")||path.dirname(pth)===pth)throw err;return make(path.dirname(pth)).then(()=>make(pth))}return stat(pth).then(stats=>stats.isDirectory()?pth:Promise.reject()).catch(()=>{throw err})});return make(path.resolve(input))});module.exports.sync=(input,opts)=>{checkPath(input),opts=Object.assign({},defaults,opts);let make=pth=>{try{opts.fs.mkdirSync(pth,opts.mode)}catch(err){if(err.code==="ENOENT"){if(err.message.includes("null bytes")||path.dirname(pth)===pth)throw err;return make(path.dirname(pth)),make(pth)}try{if(!opts.fs.statSync(pth).isDirectory())throw new Error("The path is not a directory")}catch{throw err}}return pth};return make(path.resolve(input))}}});var require_detect_indent=__commonJS({"../../node_modules/.pnpm/detect-indent@5.0.0/node_modules/detect-indent/index.js"(exports,module){"use strict";var INDENT_RE=/^(?:( )+|\t+)/;function getMostUsed(indents){let result=0,maxUsed=0,maxWeight=0;for(let entry of indents){let key=entry[0],val=entry[1],u=val[0],w=val[1];(u>maxUsed||u===maxUsed&&w>maxWeight)&&(maxUsed=u,maxWeight=w,result=Number(key))}return result}module.exports=str=>{if(typeof str!="string")throw new TypeError("Expected a string");let tabs=0,spaces=0,prev=0,indents=new Map,current,isIndent;for(let line of str.split(/\n/g)){if(!line)continue;let indent2,matches=line.match(INDENT_RE);matches?(indent2=matches[0].length,matches[1]?spaces++:tabs++):indent2=0;let diff=indent2-prev;prev=indent2,diff?(isIndent=diff>0,current=indents.get(isIndent?diff:-diff),current?current[0]++:(current=[1,0],indents.set(diff,current))):current&&(current[1]+=Number(isIndent))}let amount=getMostUsed(indents),type,indent;return amount?spaces>=tabs?(type="space",indent=" ".repeat(amount)):(type="tab",indent=" ".repeat(amount)):(type=null,indent=""),{amount,type,indent}}}});var require_write_json_file=__commonJS({"../../node_modules/.pnpm/write-json-file@2.2.0/node_modules/write-json-file/index.js"(exports,module){"use strict";var path=__require("path"),fs=require_graceful_fs(),writeFileAtomic=require_write_file_atomic(),sortKeys=require_sort_keys(),makeDir=require_make_dir(),pify=require_pify(),detectIndent=require_detect_indent(),init=(fn,fp,data,opts)=>{if(!fp)throw new TypeError("Expected a filepath");if(data===void 0)throw new TypeError("Expected data to stringify");return opts=Object.assign({indent:" ",sortKeys:!1},opts),opts.sortKeys&&(data=sortKeys(data,{deep:!0,compare:typeof opts.sortKeys=="function"&&opts.sortKeys})),fn(fp,data,opts)},readFile=fp=>pify(fs.readFile)(fp,"utf8").catch(()=>{}),main=(fp,data,opts)=>(opts.detectIndent?readFile(fp):Promise.resolve()).then(str=>{let indent=str?detectIndent(str).indent:opts.indent,json=JSON.stringify(data,opts.replacer,indent);return pify(writeFileAtomic)(fp,`${json}
|
|
8
8
|
`,{mode:opts.mode})}),mainSync=(fp,data,opts)=>{let indent=opts.indent;if(opts.detectIndent)try{let file=fs.readFileSync(fp,"utf8");indent=detectIndent(file).indent}catch(err){if(err.code!=="ENOENT")throw err}let json=JSON.stringify(data,opts.replacer,indent);return writeFileAtomic.sync(fp,`${json}
|
|
9
9
|
`,{mode:opts.mode})};module.exports=(fp,data,opts)=>makeDir(path.dirname(fp),{fs}).then(()=>init(main,fp,data,opts));module.exports.sync=(fp,data,opts)=>{makeDir.sync(path.dirname(fp),{fs}),init(mainSync,fp,data,opts)}}});import{randomUUID as randomUUID2}from"node:crypto";import os from"node:os";var import_constants=__toESM(require_dist(),1),import_build_utils=__toESM(require_build_utils(),1);import{spawn}from"node:child_process";var import_load_json_file=__toESM(require_load_json_file(),1),import_write_json_file=__toESM(require_write_json_file(),1);import{randomUUID}from"node:crypto";import{mkdirSync,renameSync,rmSync,writeFileSync}from"node:fs";import{dirname}from"node:path";var DEFAULT_CLI_SESSION_INACTIVITY_TIMEOUT_MS=30*60*1e3,DEFAULT_CLI_SESSION_MAX_LIFETIME_MS=24*60*60*1e3;function isPersistedCliSession(value){if(!value||typeof value!="object")return!1;let session=value;return typeof session.id=="string"&&typeof session.createdAt=="number"&&Number.isFinite(session.createdAt)&&typeof session.lastSeenAt=="number"&&Number.isFinite(session.lastSeenAt)}function isPersistedCliDevice(value){return!value||typeof value!="object"?!1:typeof value.id=="string"}function readPersistedCliSession(filePath){try{let session=import_load_json_file.default.sync(filePath);return isPersistedCliSession(session)?session:null}catch{return null}}function writePersistedCliSession(filePath,session){let temporaryPath=`${filePath}.${process.pid}.${randomUUID()}.tmp`;try{mkdirSync(dirname(filePath),{recursive:!0}),writeFileSync(temporaryPath,`${JSON.stringify(session,null,2)}
|
|
10
|
-
`,{flag:"wx",mode:384}),renameSync(temporaryPath,filePath)}catch{}finally{try{rmSync(temporaryPath,{force:!0})}catch{}}}function readPersistedCliDevice(filePath){try{let device=import_load_json_file.default.sync(filePath);return isPersistedCliDevice(device)?device:null}catch{return null}}function writePersistedCliDevice(filePath,device){try{mkdirSync(dirname(filePath),{recursive:!0}),import_write_json_file.default.sync(filePath,device,{indent:2})}catch{}}function getOrCreatePersistedCliSession(opts){let now=opts.now?.()??Date.now(),inactivityTimeoutMs=opts.inactivityTimeoutMs??DEFAULT_CLI_SESSION_INACTIVITY_TIMEOUT_MS,maxLifetimeMs=opts.maxLifetimeMs??DEFAULT_CLI_SESSION_MAX_LIFETIME_MS,existing=readPersistedCliSession(opts.filePath),session=existing&&now-existing.lastSeenAt<=inactivityTimeoutMs&&now-existing.createdAt<=maxLifetimeMs?{...existing,lastSeenAt:now}:{id:randomUUID(),createdAt:now,lastSeenAt:now};return writePersistedCliSession(opts.filePath,session),session}function touchPersistedCliSession(opts,session){let nextSession={...session,lastSeenAt:opts.now?.()??Date.now()};return writePersistedCliSession(opts.filePath,nextSession),nextSession}function getOrCreatePersistedCliDevice(opts){let existing=readPersistedCliDevice(opts.filePath);if(existing)return existing;let device={id:randomUUID()};return writePersistedCliDevice(opts.filePath,device),device}var LogLabel="['telemetry']:",MAX_ERROR_SERVER_MESSAGE_LENGTH=500,TelemetryClient=class{constructor({opts}){this.redactedValue="[REDACTED]";this.noValueToTriggerPrompt="[TRIGGER_PROMPT]";this.redactedArgumentsLength=args=>args&&args.length===1?"ONE":args.length>1?"MANY":"NONE";this.redactedTargetName=target=>import_constants.PROJECT_ENV_TARGET.includes(target)?target:this.redactedValue;this.isDebug=opts.isDebug||!1,this.store=opts.store}track(eventData){this.isDebug&&output_manager_default.debug(`${LogLabel} ${eventData.key}:${eventData.value}`);let event={id:randomUUID2(),eventTime:Date.now(),...eventData};this.store.add(event)}trackCliCommand(eventData){this.track({key:`command:${eventData.command}`,value:eventData.value})}trackCliSubcommand(eventData){this.track({key:`subcommand:${eventData.subcommand}`,value:eventData.value})}trackCliArgument(eventData){eventData.value&&this.track({key:`argument:${eventData.arg}`,value:eventData.value})}trackCliOption(eventData){this.track({key:`option:${eventData.option}`,value:eventData.value})}trackTargetEnvironment(targetEnvironment){this.track({key:"target_environment",value:targetEnvironment})}trackCommandOutput(eventData){this.track({key:`output:${eventData.key}`,value:eventData.value})}trackCliFlag(flag){this.track({key:`flag:${flag}`,value:"TRUE"})}trackOidcTokenRefresh(count){this.track({key:"oidc-token-refresh",value:`${count}`})}trackCPUs(){this.track({key:"cpu_count",value:String(os.cpus().length)})}trackAgenticUse(agent){agent&&this.track({key:"agent",value:agent})}trackPlatform(){this.track({key:"platform",value:os.platform()})}trackArch(){this.track({key:"arch",value:os.arch()})}trackCI(ciVendorName){ciVendorName&&this.track({key:"ci",value:ciVendorName})}trackStdinIsTTY(isTTY){this.track({key:"stdin_is_tty",value:isTTY?"true":"false"})}trackVersion(version){version&&this.track({key:"version",value:version})}trackDefaultDeploy(){this.track({key:"default-deploy",value:"TRUE"})}trackProjectId(projectId){projectId&&this.track({key:"project_id",value:projectId})}trackInvocationId(invocationId){invocationId&&this.track({key:"invocation_id",value:invocationId})}trackDeviceId(deviceId){deviceId&&this.track({key:"device_id",value:deviceId})}trackVercelPluginActiveSession(){this.track({key:"vercel_plugin_active_session",value:"TRUE"})}trackVercelPluginVersion(version){version&&this.track({key:"vercel_plugin_version",value:version})}trackErrorStatus(status){typeof status<"u"&&this.track({key:"error_status",value:String(status)})}trackErrorCode(code){code&&this.track({key:"error_code",value:code})}trackErrorSlug(slug){slug&&this.track({key:"error_slug",value:slug})}trackErrorAction(action){action&&this.track({key:"error_action",value:action})}trackErrorServerMessage(serverMessage){if(serverMessage){let normalizedServerMessage=serverMessage.trim().replace(/\s+/g," ");this.track({key:"error_server_message",value:normalizedServerMessage.slice(0,MAX_ERROR_SERVER_MESSAGE_LENGTH)})}}trackExtension(){this.track({key:"extension",value:this.redactedValue})}trackLoginState(state){state==="started"&&(this.loginAttempt=randomUUID2()),this.loginAttempt&&this.track({key:`login:attempt:${this.loginAttempt}`,value:state}),state!=="started"&&(this.loginAttempt=void 0)}trackCliFlagHelp(command,subcommands){let subcommand;subcommands&&(subcommand=Array.isArray(subcommands)?subcommands[0]:subcommands),this.track({key:"flag:help",value:subcommand?`${command}:${subcommand}`:command})}trackCliOptionFormat(format){if(format){let allowedFormat=["json"].includes(format)?format:this.redactedValue;this.trackCliOption({option:"format",value:allowedFormat})}}trackCliOptionProject(value){value&&(Array.isArray(value)&&value.length===0||this.trackCliOption({option:"project",value:this.redactedValue}))}},TelemetryEventStore=class{constructor(opts){this.teamId="NO_TEAM_ID";this.userId="NO_USER_ID";this.projectId="NO_PROJECT_ID";this.isDebug=opts?.isDebug||!1,this.events=[],this.config=opts?.config,this.cliDeviceOptions=opts?.cliDevice,this.cliSessionOptions=opts?.cliSession,this.invocationId=randomUUID2(),this.deviceId=randomUUID2(),this.cliDeviceOptions&&(this.cliDevice=getOrCreatePersistedCliDevice(this.cliDeviceOptions),this.deviceId=this.cliDevice.id),this.cliSessionOptions?(this.cliSession=getOrCreatePersistedCliSession(this.cliSessionOptions),this.sessionId=this.cliSession.id):this.sessionId=randomUUID2()}add(event){event.sessionId=this.sessionId,event.teamId=this.teamId,event.userId=this.userId,event.projectId=this.projectId,this.events.push(event)}updateTeamId(teamId){teamId&&(this.teamId=teamId)}updateUserId(userId){userId&&(this.userId=userId)}updateProjectId(projectId){projectId&&(this.projectId=projectId)}get hasUserId(){return this.userId!=="NO_USER_ID"}get currentProjectId(){return this.projectId}get currentInvocationId(){return this.invocationId}get currentDeviceId(){return this.deviceId}get currentSessionId(){return this.sessionId}get readonlyEvents(){return Array.from(this.events)}reset(){this.events=[]}get enabled(){return process.env.VERCEL_TELEMETRY_DISABLED?!1:this.config?.enabled??!0}async save(){if(this.cliSession&&this.cliSessionOptions&&(this.cliSession=touchPersistedCliSession(this.cliSessionOptions,this.cliSession)),this.isDebug){output_manager_default.log(`${LogLabel} Flushing Events`);for(let event of this.events)event.teamId=this.teamId,event.userId=this.userId,event.projectId=this.projectId,output_manager_default.log(JSON.stringify(event));return}if(this.enabled){let sessionId=this.events[0]
|
|
10
|
+
`,{flag:"wx",mode:384}),renameSync(temporaryPath,filePath)}catch{}finally{try{rmSync(temporaryPath,{force:!0})}catch{}}}function readPersistedCliDevice(filePath){try{let device=import_load_json_file.default.sync(filePath);return isPersistedCliDevice(device)?device:null}catch{return null}}function writePersistedCliDevice(filePath,device){try{mkdirSync(dirname(filePath),{recursive:!0}),import_write_json_file.default.sync(filePath,device,{indent:2})}catch{}}function getOrCreatePersistedCliSession(opts){let now=opts.now?.()??Date.now(),inactivityTimeoutMs=opts.inactivityTimeoutMs??DEFAULT_CLI_SESSION_INACTIVITY_TIMEOUT_MS,maxLifetimeMs=opts.maxLifetimeMs??DEFAULT_CLI_SESSION_MAX_LIFETIME_MS,existing=readPersistedCliSession(opts.filePath),session=existing&&now-existing.lastSeenAt<=inactivityTimeoutMs&&now-existing.createdAt<=maxLifetimeMs?{...existing,lastSeenAt:now}:{id:randomUUID(),createdAt:now,lastSeenAt:now};return writePersistedCliSession(opts.filePath,session),session}function touchPersistedCliSession(opts,session){let nextSession={...session,lastSeenAt:opts.now?.()??Date.now()};return writePersistedCliSession(opts.filePath,nextSession),nextSession}function getOrCreatePersistedCliDevice(opts){let existing=readPersistedCliDevice(opts.filePath);if(existing)return existing;let device={id:randomUUID()};return writePersistedCliDevice(opts.filePath,device),device}var LogLabel="['telemetry']:",MAX_ERROR_SERVER_MESSAGE_LENGTH=500,TelemetryClient=class{constructor({opts}){this.redactedValue="[REDACTED]";this.noValueToTriggerPrompt="[TRIGGER_PROMPT]";this.redactedArgumentsLength=args=>args&&args.length===1?"ONE":args.length>1?"MANY":"NONE";this.redactedTargetName=target=>import_constants.PROJECT_ENV_TARGET.includes(target)?target:this.redactedValue;this.isDebug=opts.isDebug||!1,this.store=opts.store}track(eventData){this.isDebug&&output_manager_default.debug(`${LogLabel} ${eventData.key}:${eventData.value}`);let event={id:randomUUID2(),eventTime:Date.now(),...eventData};this.store.add(event)}trackCliCommand(eventData){this.track({key:`command:${eventData.command}`,value:eventData.value})}trackCliSubcommand(eventData){this.track({key:`subcommand:${eventData.subcommand}`,value:eventData.value})}trackCliArgument(eventData){eventData.value&&this.track({key:`argument:${eventData.arg}`,value:eventData.value})}trackCliOption(eventData){this.track({key:`option:${eventData.option}`,value:eventData.value})}trackTargetEnvironment(targetEnvironment){this.track({key:"target_environment",value:targetEnvironment})}trackCommandOutput(eventData){this.track({key:`output:${eventData.key}`,value:eventData.value})}trackCliFlag(flag){this.track({key:`flag:${flag}`,value:"TRUE"})}trackOidcTokenRefresh(count){this.track({key:"oidc-token-refresh",value:`${count}`})}trackCPUs(){this.track({key:"cpu_count",value:String(os.cpus().length)})}trackAgenticUse(agent){agent&&this.track({key:"agent",value:agent})}trackPlatform(){this.track({key:"platform",value:os.platform()})}trackArch(){this.track({key:"arch",value:os.arch()})}trackCI(ciVendorName){ciVendorName&&this.track({key:"ci",value:ciVendorName})}trackStdinIsTTY(isTTY){this.track({key:"stdin_is_tty",value:isTTY?"true":"false"})}trackVersion(version){version&&this.track({key:"version",value:version})}trackDefaultDeploy(){this.track({key:"default-deploy",value:"TRUE"})}trackProjectId(projectId){projectId&&this.track({key:"project_id",value:projectId})}trackInvocationId(invocationId){invocationId&&this.track({key:"invocation_id",value:invocationId})}trackDeviceId(deviceId){deviceId&&this.track({key:"device_id",value:deviceId})}trackVercelPluginActiveSession(){this.track({key:"vercel_plugin_active_session",value:"TRUE"})}trackVercelPluginVersion(version){version&&this.track({key:"vercel_plugin_version",value:version})}trackErrorStatus(status){typeof status<"u"&&this.track({key:"error_status",value:String(status)})}trackErrorCode(code){code&&this.track({key:"error_code",value:code})}trackErrorSlug(slug){slug&&this.track({key:"error_slug",value:slug})}trackErrorAction(action){action&&this.track({key:"error_action",value:action})}trackErrorServerMessage(serverMessage){if(serverMessage){let normalizedServerMessage=serverMessage.trim().replace(/\s+/g," ");this.track({key:"error_server_message",value:normalizedServerMessage.slice(0,MAX_ERROR_SERVER_MESSAGE_LENGTH)})}}trackExtension(){this.track({key:"extension",value:this.redactedValue})}trackLoginState(state){state==="started"&&(this.loginAttempt=randomUUID2()),this.loginAttempt&&this.track({key:`login:attempt:${this.loginAttempt}`,value:state}),state!=="started"&&(this.loginAttempt=void 0)}trackCliFlagHelp(command,subcommands){let subcommand;subcommands&&(subcommand=Array.isArray(subcommands)?subcommands[0]:subcommands),this.track({key:"flag:help",value:subcommand?`${command}:${subcommand}`:command})}trackCliOptionFormat(format){if(format){let allowedFormat=["json"].includes(format)?format:this.redactedValue;this.trackCliOption({option:"format",value:allowedFormat})}}trackCliOptionProject(value){value&&(Array.isArray(value)&&value.length===0||this.trackCliOption({option:"project",value:this.redactedValue}))}},TelemetryEventStore=class{constructor(opts){this.teamId="NO_TEAM_ID";this.userId="NO_USER_ID";this.projectId="NO_PROJECT_ID";this.isDebug=opts?.isDebug||!1,this.events=[],this.config=opts?.config,this.cliDeviceOptions=opts?.cliDevice,this.cliSessionOptions=opts?.cliSession,this.invocationId=randomUUID2(),this.deviceId=randomUUID2(),this.cliDeviceOptions&&(this.cliDevice=getOrCreatePersistedCliDevice(this.cliDeviceOptions),this.deviceId=this.cliDevice.id),this.cliSessionOptions?(this.cliSession=getOrCreatePersistedCliSession(this.cliSessionOptions),this.sessionId=this.cliSession.id):this.sessionId=randomUUID2()}add(event){event.sessionId=this.sessionId,event.invocationId=this.invocationId,event.teamId=this.teamId,event.userId=this.userId,event.projectId=this.projectId,this.events.push(event)}updateTeamId(teamId){teamId&&(this.teamId=teamId)}updateUserId(userId){userId&&(this.userId=userId)}updateProjectId(projectId){projectId&&(this.projectId=projectId)}get hasUserId(){return this.userId!=="NO_USER_ID"}get currentProjectId(){return this.projectId}get currentInvocationId(){return this.invocationId}get currentDeviceId(){return this.deviceId}get currentSessionId(){return this.sessionId}get readonlyEvents(){return Array.from(this.events)}reset(){this.events=[]}get enabled(){return process.env.VERCEL_TELEMETRY_DISABLED?!1:this.config?.enabled??!0}async save(){if(this.cliSession&&this.cliSessionOptions&&(this.cliSession=touchPersistedCliSession(this.cliSessionOptions,this.cliSession)),this.isDebug){output_manager_default.log(`${LogLabel} Flushing Events`);for(let event of this.events)event.teamId=this.teamId,event.userId=this.userId,event.projectId=this.projectId,output_manager_default.log(JSON.stringify(event));return}if(this.enabled){let sessionId=this.events[0]?.sessionId;if(!sessionId){output_manager_default.debug("Unable to send metrics: no session ID");return}let events=this.events.map(event=>{let{eventTime,invocationId,...rest}=event;return delete rest.sessionId,delete rest.teamId,delete rest.userId,delete rest.projectId,{event_time:eventTime,invocation_id:invocationId,team_id:this.teamId,user_id:this.userId,project_id:this.projectId,...rest}}),payload={invocationId:this.invocationId,headers:{"Client-id":"vercel-cli","x-vercel-cli-topic-id":"generic","x-vercel-cli-session-id":sessionId},body:events};await this.sendToSubprocess(payload,output_manager_default.debugEnabled)}}async sendToSubprocess(payload,outputDebugEnabled){let flushArgs=["telemetry","flush",JSON.stringify(payload)],nodeBinaryPath,script;if(isNativeBinaryInstall())nodeBinaryPath=process.execPath,script=flushArgs;else{let args=[process.execPath,process.argv[0],process.argv[1]];args[0]===args[1]&&args.shift(),nodeBinaryPath=args[0],script=[...args.slice(1),...flushArgs]}let env=(0,import_build_utils.cloneEnv)(process.env,{VERCEL_TELEMETRY_DISABLED:"1"});if(outputDebugEnabled)return new Promise(resolve=>{let childProcess=spawn(nodeBinaryPath,script,{env,stdio:["ignore","pipe","pipe"]});childProcess.stderr.on("data",data=>output_manager_default.debug(data.toString())),childProcess.stdout.on("data",data=>output_manager_default.debug(data.toString())),childProcess.on("error",d=>{output_manager_default.debug(d)});let timeout=setTimeout(()=>{output_manager_default.debug("Telemetry subprocess killed due to timeout"),childProcess.kill()},2e3);childProcess.on("exit",code=>{output_manager_default.debug(`Telemetry subprocess exited with code ${code}`),childProcess.unref(),timeout.unref(),resolve()})});spawn(nodeBinaryPath,script,{stdio:"ignore",env,windowsHide:!0,detached:!0}).unref()}};export{require_dist,TelemetryClient,TelemetryEventStore};
|
|
11
11
|
/*! Bundled license information:
|
|
12
12
|
|
|
13
13
|
imurmurhash/imurmurhash.js:
|
|
@@ -4,9 +4,9 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{require_dist as require_dist2}from"./chunk-TRTEXGVN.js";import{sleep}from"./chunk-T3GQAMBJ.js";import{PromptBackError,PromptCanceledError}from"./chunk-P2O5DOYE.js";import{persistAuthConfig,writeToConfigFile}from"./chunk-
|
|
8
|
-
`,message=prependEmoji(import_chalk.default.dim(payload),emoji(type))+newline,finalLink="";link&&(finalLink=import_chalk.default.dim(`${action||"Learn More"}: ${link_default(link)}`)+newline),output_manager_default.print(message+finalLink)}}}}function sharedPromise(fn){let promise=null;return function(...args){return promise||(promise=fn.apply(this,args),promise.finally(()=>{promise=null})),promise}}var import_error_utils=__toESM(require_dist(),1);var DOMAINS_API_PATH=/^\/v\d+\/(?:domains|registrar)(?:\/|$)/,isSAMLError=v=>v&&v.saml,isJSONObject=v=>v&&typeof v=="object"&&v.constructor===Object;function isValidAccessToken(authConfig){if(!authConfig.token)return!1;if(typeof authConfig.expiresAt!="number")return!0;let nowInSeconds=Math.floor(Date.now()/1e3);return authConfig.expiresAt>=nowInSeconds}function hasRefreshToken(authConfig){return"refreshToken"in authConfig}var Client=class extends EventEmitter{constructor(opts){super();this._argv=[];this._loggedTokenSource=!1;this.escapePromptCancellationDepth=0;this.promptBackNavigationDepth=0;this.reauthenticate=sharedPromise(async function(error){let{default:reauthenticate}=await import("./reauthenticate-
|
|
9
|
-
${error.stack}`)};this.setArgv(opts.argv),this.apiUrl=opts.apiUrl,this.authConfig=opts.authConfig,this.stdin=opts.stdin,this.stdout=opts.stdout,this.stderr=opts.stderr,this.config=opts.config,this.localConfig=opts.localConfig,this.localConfigPath=opts.localConfigPath,this.requestIdCounter=1,this.telemetryEventStore=opts.telemetryEventStore,this.isAgent=opts.isAgent??!1,this.agentName=opts.agentName,this.nonInteractive=opts.nonInteractive??this.isAgent,this.dangerouslySkipPermissions=opts.dangerouslySkipPermissions??!1;let theme={prefix:(0,import_chalk2.gray)("?"),style:{answer:import_chalk2.gray}};this.input={text:async opts2=>{let{default:input}=await import("./esm-7HVUFWMN.js");return this.runPrompt(input({theme,...opts2},{input:this.stdin,output:this.stderr}))},password:async opts2=>{let{default:password}=await import("./esm-BZBEM7YA.js");return this.runPrompt(password({theme,...opts2},{input:this.stdin,output:this.stderr}))},checkbox:async opts2=>{let{default:checkbox}=await import("./esm-CXICLFA3.js");return this.runPrompt(checkbox({theme,...opts2},{input:this.stdin,output:this.stderr}))},expand:async opts2=>{let{default:expand}=await import("./esm-HDEHVK7I.js");return this.runPrompt(expand({theme,...opts2},{input:this.stdin,output:this.stderr}))},confirm:async(message,default_value)=>{let{default:confirm}=await import("./esm-SZZI53W7.js");return this.runPrompt(confirm({theme,message,default:default_value},{input:this.stdin,output:this.stderr}))},select:async opts2=>{let{default:select}=await import("./esm-WGJFGCLK.js");return this.runPrompt(select({theme,...opts2},{input:this.stdin,output:this.stderr}))},search:async opts2=>{let{default:search}=await import("./esm-NQRLKALI.js");return this.runPrompt(search({theme,...opts2},{input:this.stdin,output:this.stderr}))}}}async withEscapePromptCancellation(run){this.escapePromptCancellationDepth++;try{return await run()}finally{this.escapePromptCancellationDepth--}}async withPromptBackNavigation(run){this.promptBackNavigationDepth++;try{return await run()}finally{this.promptBackNavigationDepth--}}runPrompt(prompt){let escapeCancellationEnabled=this.escapePromptCancellationDepth>0,backNavigationEnabled=this.promptBackNavigationDepth>0;if(!escapeCancellationEnabled&&!backNavigationEnabled||!this.stdin.isTTY||!prompt.cancel)return prompt;let cancellation,onKeypress=(_input,key)=>{key?.name==="escape"&&escapeCancellationEnabled&&!cancellation?(cancellation="escape",prompt.cancel?.()):key?.name==="up"&&backNavigationEnabled&&!cancellation&&(cancellation="back",prompt.cancel?.())};return this.stdin.on("keypress",onKeypress),prompt.catch(error=>{throw cancellation==="escape"?new PromptCanceledError:cancellation==="back"?new PromptBackError:error}).finally(()=>{this.stdin.off("keypress",onKeypress)})}get argv(){return this._argv}setArgv(argvOrFirst,...rest){let argv=Array.isArray(argvOrFirst)?argvOrFirst:[argvOrFirst,...rest];this._argv=argv,this._parsedArgsCache=void 0}getParsedArgs(){return this._parsedArgsCache||(this._parsedArgsCache=parseArguments(this.argv.slice(2),{},{permissive:!0})),this._parsedArgsCache}retry(fn,{retries=3,maxTimeout=1/0}={}){return(0,import_async_retry.default)(fn,{retries,maxTimeout,onRetry:this._onRetry})}async ensureAuthorized(){let{authConfig}=this;if(isValidAccessToken(authConfig)){this._loggedTokenSource||(authConfig.tokenSource==="flag"?output_manager_default.debug("Using token from `--token` argument, skipping token refresh."):authConfig.tokenSource==="env"?output_manager_default.debug("Using token from VERCEL_TOKEN environment variable, skipping token refresh."):output_manager_default.debug("Valid access token, skipping token refresh."),this._loggedTokenSource=!0);return}if(!hasRefreshToken(authConfig)){output_manager_default.debug("No refresh token found, emptying auth config."),this.emptyAuthConfig(),this.persistAuthConfig();return}let tokenResponse=await refreshTokenRequest({refresh_token:authConfig.refreshToken}),[tokensError,tokens]=await processTokenResponse(tokenResponse);if(isOAuthError(tokensError)&&tokensError.code==="invalid_grant"&&!authConfig.tokenSource&&this.stdin.isTTY&&!this.nonInteractive){output_manager_default.debug(`Stored session refresh failed: ${tokensError.cause.message}`),output_manager_default.log("Couldn't refresh the saved login. Starting a new login.");let{performDeviceCodeFlow}=await import("./future-
|
|
7
|
+
import{require_dist as require_dist2}from"./chunk-TRTEXGVN.js";import{sleep}from"./chunk-T3GQAMBJ.js";import{PromptBackError,PromptCanceledError}from"./chunk-P2O5DOYE.js";import{persistAuthConfig,writeToConfigFile}from"./chunk-DBDWXNAR.js";import{isOAuthError,processTokenResponse,refreshTokenRequest,ua_default}from"./chunk-5XJNPXQK.js";import{fetch}from"./chunk-MY4MONOH.js";import{parseArguments}from"./chunk-PTUZ7ATN.js";import{require_cli_config}from"./chunk-BRK4OB4B.js";import{APIError}from"./chunk-RINZXCDJ.js";import{emoji,link_default,output_manager_default,prependEmoji}from"./chunk-EWWFNMPZ.js";import{require_dist}from"./chunk-QGIQK47P.js";import{pkg_default}from"./chunk-AVSPFBLM.js";import{require_source}from"./chunk-U7KCDTCH.js";import{__toESM}from"./chunk-6L236MNA.js";var import_chalk2=__toESM(require_source(),1),import_cli_config=__toESM(require_cli_config(),1),import_async_retry=__toESM(require_dist2(),1);import{join,resolve}from"node:path";import{EventEmitter}from"events";import{URL}from"url";async function responseError(res,fallbackMessage=null,parsedBody={}){let bodyError;if(!res.ok){let body;try{body=await res.json()}catch{body=parsedBody}bodyError=body.error||body.err||body}let msg=bodyError?.message||fallbackMessage||"Response Error";return new APIError(msg,res,bodyError)}var import_chalk=__toESM(require_source(),1);function printIndications(res){let indications=new Set(["warning","notice","tip"]),regex=/^x-(?:vercel|now)-(warning|notice|tip)-(.*)$/;for(let[name,payload]of res.headers){let match=name.match(regex);if(match){let[,type,identifier]=match,action=res.headers.get(`x-vercel-action-${identifier}`),link=res.headers.get(`x-vercel-link-${identifier}`);if(indications.has(type)){let newline=`
|
|
8
|
+
`,message=prependEmoji(import_chalk.default.dim(payload),emoji(type))+newline,finalLink="";link&&(finalLink=import_chalk.default.dim(`${action||"Learn More"}: ${link_default(link)}`)+newline),output_manager_default.print(message+finalLink)}}}}function sharedPromise(fn){let promise=null;return function(...args){return promise||(promise=fn.apply(this,args),promise.finally(()=>{promise=null})),promise}}var import_error_utils=__toESM(require_dist(),1);var DOMAINS_API_PATH=/^\/v\d+\/(?:domains|registrar)(?:\/|$)/,isSAMLError=v=>v&&v.saml,isJSONObject=v=>v&&typeof v=="object"&&v.constructor===Object;function isValidAccessToken(authConfig){if(!authConfig.token)return!1;if(typeof authConfig.expiresAt!="number")return!0;let nowInSeconds=Math.floor(Date.now()/1e3);return authConfig.expiresAt>=nowInSeconds}function hasRefreshToken(authConfig){return"refreshToken"in authConfig}var Client=class extends EventEmitter{constructor(opts){super();this._argv=[];this._loggedTokenSource=!1;this.escapePromptCancellationDepth=0;this.promptBackNavigationDepth=0;this.reauthenticate=sharedPromise(async function(error){let{default:reauthenticate}=await import("./reauthenticate-7RZ2XFR4.js");if(typeof await reauthenticate(this,error)=="number")throw error instanceof APIError?output_manager_default.prettyError(error):output_manager_default.error(`Failed to re-authenticate for ${(0,import_chalk2.bold)(error.scope)} scope`),error});this._onRetry=error=>{output_manager_default.debug(`Retrying: ${error}
|
|
9
|
+
${error.stack}`)};this.setArgv(opts.argv),this.apiUrl=opts.apiUrl,this.authConfig=opts.authConfig,this.stdin=opts.stdin,this.stdout=opts.stdout,this.stderr=opts.stderr,this.config=opts.config,this.localConfig=opts.localConfig,this.localConfigPath=opts.localConfigPath,this.requestIdCounter=1,this.telemetryEventStore=opts.telemetryEventStore,this.isAgent=opts.isAgent??!1,this.agentName=opts.agentName,this.nonInteractive=opts.nonInteractive??this.isAgent,this.dangerouslySkipPermissions=opts.dangerouslySkipPermissions??!1;let theme={prefix:(0,import_chalk2.gray)("?"),style:{answer:import_chalk2.gray}};this.input={text:async opts2=>{let{default:input}=await import("./esm-7HVUFWMN.js");return this.runPrompt(input({theme,...opts2},{input:this.stdin,output:this.stderr}))},password:async opts2=>{let{default:password}=await import("./esm-BZBEM7YA.js");return this.runPrompt(password({theme,...opts2},{input:this.stdin,output:this.stderr}))},checkbox:async opts2=>{let{default:checkbox}=await import("./esm-CXICLFA3.js");return this.runPrompt(checkbox({theme,...opts2},{input:this.stdin,output:this.stderr}))},expand:async opts2=>{let{default:expand}=await import("./esm-HDEHVK7I.js");return this.runPrompt(expand({theme,...opts2},{input:this.stdin,output:this.stderr}))},confirm:async(message,default_value)=>{let{default:confirm}=await import("./esm-SZZI53W7.js");return this.runPrompt(confirm({theme,message,default:default_value},{input:this.stdin,output:this.stderr}))},select:async opts2=>{let{default:select}=await import("./esm-WGJFGCLK.js");return this.runPrompt(select({theme,...opts2},{input:this.stdin,output:this.stderr}))},search:async opts2=>{let{default:search}=await import("./esm-NQRLKALI.js");return this.runPrompt(search({theme,...opts2},{input:this.stdin,output:this.stderr}))}}}async withEscapePromptCancellation(run){this.escapePromptCancellationDepth++;try{return await run()}finally{this.escapePromptCancellationDepth--}}async withPromptBackNavigation(run){this.promptBackNavigationDepth++;try{return await run()}finally{this.promptBackNavigationDepth--}}runPrompt(prompt){let escapeCancellationEnabled=this.escapePromptCancellationDepth>0,backNavigationEnabled=this.promptBackNavigationDepth>0;if(!escapeCancellationEnabled&&!backNavigationEnabled||!this.stdin.isTTY||!prompt.cancel)return prompt;let cancellation,onKeypress=(_input,key)=>{key?.name==="escape"&&escapeCancellationEnabled&&!cancellation?(cancellation="escape",prompt.cancel?.()):key?.name==="up"&&backNavigationEnabled&&!cancellation&&(cancellation="back",prompt.cancel?.())};return this.stdin.on("keypress",onKeypress),prompt.catch(error=>{throw cancellation==="escape"?new PromptCanceledError:cancellation==="back"?new PromptBackError:error}).finally(()=>{this.stdin.off("keypress",onKeypress)})}get argv(){return this._argv}setArgv(argvOrFirst,...rest){let argv=Array.isArray(argvOrFirst)?argvOrFirst:[argvOrFirst,...rest];this._argv=argv,this._parsedArgsCache=void 0}getParsedArgs(){return this._parsedArgsCache||(this._parsedArgsCache=parseArguments(this.argv.slice(2),{},{permissive:!0})),this._parsedArgsCache}retry(fn,{retries=3,maxTimeout=1/0}={}){return(0,import_async_retry.default)(fn,{retries,maxTimeout,onRetry:this._onRetry})}async ensureAuthorized(){let{authConfig}=this;if(isValidAccessToken(authConfig)){this._loggedTokenSource||(authConfig.tokenSource==="flag"?output_manager_default.debug("Using token from `--token` argument, skipping token refresh."):authConfig.tokenSource==="env"?output_manager_default.debug("Using token from VERCEL_TOKEN environment variable, skipping token refresh."):output_manager_default.debug("Valid access token, skipping token refresh."),this._loggedTokenSource=!0);return}if(!hasRefreshToken(authConfig)){output_manager_default.debug("No refresh token found, emptying auth config."),this.emptyAuthConfig(),this.persistAuthConfig();return}let tokenResponse=await refreshTokenRequest({refresh_token:authConfig.refreshToken}),[tokensError,tokens]=await processTokenResponse(tokenResponse);if(isOAuthError(tokensError)&&tokensError.code==="invalid_grant"&&!authConfig.tokenSource&&this.stdin.isTTY&&!this.nonInteractive){output_manager_default.debug(`Stored session refresh failed: ${tokensError.cause.message}`),output_manager_default.log("Couldn't refresh the saved login. Starting a new login.");let{performDeviceCodeFlow}=await import("./future-YNSZJIAG.js"),recoveredTokens=await performDeviceCodeFlow(this);if(recoveredTokens){this.updateAuthConfig({token:recoveredTokens.access_token,userId:void 0,expiresAt:Math.floor(Date.now()/1e3)+recoveredTokens.expires_in,refreshToken:recoveredTokens.refresh_token}),this.persistAuthConfig();return}}if(tokensError){output_manager_default.debug("Error refreshing token, emptying auth config."),this.emptyAuthConfig(),this.persistAuthConfig();return}this.updateAuthConfig({token:tokens.access_token,expiresAt:Math.floor(Date.now()/1e3)+tokens.expires_in}),tokens.refresh_token&&this.updateAuthConfig({refreshToken:tokens.refresh_token}),this.persistAuthConfig(),this.writeToConfigFile(),output_manager_default.debug("Tokens refreshed successfully.")}getGlobalPathConfig(){let confFlag=this.getParsedArgs().flags["--global-config"];return typeof confFlag=="string"?resolve(this.cwd,confFlag):(0,import_cli_config.getGlobalPathConfig)()}async readConfig(fileName,schema){let filePath=join(this.getGlobalPathConfig(),fileName);return(0,import_cli_config.readConfigFile)(filePath,schema)}async maybeReadConfig(fileName,schema){try{return await this.readConfig(fileName,schema)}catch{return null}}async writeConfig(fileName,schema,value){let filePath=join(this.getGlobalPathConfig(),fileName);(0,import_cli_config.writeConfigFile)(filePath,schema,value)}updateConfig(config){this.config={...this.config,...config}}writeToConfigFile(){writeToConfigFile(this.config)}updateAuthConfig(authConfig){authConfig.token&&authConfig.token!==this.authConfig.token&&(this.user=void 0,this.userPromise=void 0,this.teams=void 0,this.teamsPromise=void 0),this.authConfig={...this.authConfig,...authConfig}}emptyAuthConfig(){this.user=void 0,this.userPromise=void 0,this.teams=void 0,this.teamsPromise=void 0,this.authConfig=this.authConfig.skipWrite?{skipWrite:!0}:{}}persistAuthConfig(){persistAuthConfig(this.authConfig,this.config)}async confirmMutatingOperation(url,method){if(!((method||"GET").toUpperCase()==="DELETE"))return!0;if(this.isAgent&&this.dangerouslySkipPermissions){let agentInfo=this.agentName?` (${this.agentName})`:"";output_manager_default.print(`
|
|
10
10
|
`),output_manager_default.print((0,import_chalk2.bgRed)((0,import_chalk2.white)((0,import_chalk2.bold)(" \u26A0 WARNING ")))+(0,import_chalk2.red)((0,import_chalk2.bold)(` AGENT MODE - DELETE CONFIRMATION BYPASSED
|
|
11
11
|
`))),output_manager_default.print((0,import_chalk2.yellow)(` An AI agent${agentInfo} is executing a ${(0,import_chalk2.bold)("DELETE")} request with --dangerously-skip-permissions flag.
|
|
12
12
|
`)),output_manager_default.print((0,import_chalk2.yellow)(` This operation will delete data: ${(0,import_chalk2.bold)(url)}
|