vercel 60.0.1 → 60.1.1
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/chunk-2TBUMUHF.js +7 -0
- package/dist/chunks/{chunk-S74YKDNZ.js → chunk-3CQQXHDI.js} +1 -1
- package/dist/chunks/{chunk-V6IKQCOT.js → chunk-5U25FWD5.js} +1 -1
- package/dist/chunks/{chunk-42IHNZIE.js → chunk-7HT5KIFA.js} +1 -1
- package/dist/chunks/chunk-DKV4IVH5.js +7 -0
- package/dist/chunks/{chunk-LLXCLOZO.js → chunk-DPH3CQXE.js} +1 -1
- package/dist/chunks/chunk-H4IUDU5W.js +9 -0
- package/dist/chunks/{chunk-FXZ6TVIP.js → chunk-KOOED3TJ.js} +2 -2
- package/dist/chunks/{chunk-EOIRBY3F.js → chunk-MSLHCYBD.js} +1 -1
- package/dist/chunks/{chunk-25MLFUQD.js → chunk-TTMLSKF7.js} +1 -1
- package/dist/chunks/{chunk-2HZGNTI4.js → chunk-WH6M54KF.js} +1 -1
- package/dist/chunks/{chunk-TKBORMUF.js → chunk-WKZ6JSGZ.js} +1 -1
- package/dist/chunks/{config-2327CWL2.js → config-4FCRR7C5.js} +1 -1
- package/dist/chunks/{constants-NCE2LWSS.js → constants-G4UYVLOF.js} +1 -1
- package/dist/chunks/{login-VJZGWSOW.js → login-X3KPMMEP.js} +1 -1
- package/dist/chunks/ls-GD6LB7IE.js +8 -0
- package/dist/chunks/{openapi-G3HACVTQ.js → openapi-7JUPKBWV.js} +1 -1
- package/dist/chunks/{prompt-missing-credentials-KCPCA6L7.js → prompt-missing-credentials-PPUSNDNC.js} +1 -1
- package/dist/chunks/rm-OYSWVVSJ.js +8 -0
- package/dist/chunks/set-GESKJPQA.js +7 -0
- package/dist/commands/build/index.js +1 -1
- package/dist/commands/deploy/index.js +2 -2
- package/dist/commands/dev/index.js +7 -7
- package/dist/commands/env/index.js +1 -1
- package/dist/commands/link/index.js +1 -1
- package/dist/commands/list/index.js +1 -1
- package/dist/commands-bulk.js +81 -71
- package/dist/index.js +2 -2
- package/dist/version.mjs +1 -1
- package/package.json +55 -55
- package/dist/chunks/chunk-IRM6H42E.js +0 -7
- package/dist/chunks/chunk-M5AV545M.js +0 -7
- package/dist/chunks/chunk-UQW7M4LS.js +0 -9
- package/dist/chunks/ls-BVBCVIRX.js +0 -8
- package/dist/chunks/rm-5W45I3TO.js +0 -8
- package/dist/chunks/set-XWOUJJ7R.js +0 -7
|
@@ -9,7 +9,7 @@ import{require_chownr,require_mkdirp,require_pump,require_tar_stream}from"./chun
|
|
|
9
9
|
see https://github.com/jprichardson/node-fs-extra/issues/269`);let{srcStat,destStat}=stat.checkPathsSync(src,dest,"copy");return stat.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 fs.existsSync(destParent)||mkdirpSync(destParent),startCopy(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?fs.statSync:fs.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)}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 fs.unlinkSync(dest),copyFile(srcStat,src,dest,opts);if(opts.errorOnExist)throw new Error(`'${dest}' already exists`)}function copyFile(srcStat,src,dest,opts){return typeof fs.copyFileSync=="function"?(fs.copyFileSync(src,dest),fs.chmodSync(dest,srcStat.mode),opts.preserveTimestamps?utimesSync(dest,srcStat.atime,srcStat.mtime):void 0):copyFileFallback(srcStat,src,dest,opts)}function copyFileFallback(srcStat,src,dest,opts){let _buff=require_buffer()(65536),fdr=fs.openSync(src,"r"),fdw=fs.openSync(dest,"w",srcStat.mode),pos=0;for(;pos<srcStat.size;){let bytesRead=fs.readSync(fdr,_buff,0,65536,pos);fs.writeSync(fdw,_buff,0,bytesRead),pos+=bytesRead}opts.preserveTimestamps&&fs.futimesSync(fdw,srcStat.atime,srcStat.mtime),fs.closeSync(fdr),fs.closeSync(fdw)}function onDir(srcStat,destStat,src,dest,opts){if(!destStat)return mkDirAndCopy(srcStat,src,dest,opts);if(destStat&&!destStat.isDirectory())throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);return copyDir(src,dest,opts)}function mkDirAndCopy(srcStat,src,dest,opts){return fs.mkdirSync(dest),copyDir(src,dest,opts),fs.chmodSync(dest,srcStat.mode)}function copyDir(src,dest,opts){fs.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}=stat.checkPathsSync(srcItem,destItem,"copy");return startCopy(destStat,srcItem,destItem,opts)}function onLink(destStat,src,dest,opts){let resolvedSrc=fs.readlinkSync(src);if(opts.dereference&&(resolvedSrc=path.resolve(process.cwd(),resolvedSrc)),destStat){let resolvedDest;try{resolvedDest=fs.readlinkSync(dest)}catch(err){if(err.code==="EINVAL"||err.code==="UNKNOWN")return fs.symlinkSync(resolvedSrc,dest);throw err}if(opts.dereference&&(resolvedDest=path.resolve(process.cwd(),resolvedDest)),stat.isSrcSubdir(resolvedSrc,resolvedDest))throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);if(fs.statSync(dest).isDirectory()&&stat.isSrcSubdir(resolvedDest,resolvedSrc))throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);return copyLink(resolvedSrc,dest)}else return fs.symlinkSync(resolvedSrc,dest)}function copyLink(resolvedSrc,dest){return fs.unlinkSync(dest),fs.symlinkSync(resolvedSrc,dest)}module.exports=copySync}});var require_copy_sync2=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/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@8.0.1/node_modules/fs-extra/lib/path-exists/index.js"(exports,module){"use strict";var u=require_universalify().fromPromise,fs=require_fs();function pathExists(path){return fs.access(path).then(()=>!0).catch(()=>!1)}module.exports={pathExists:u(pathExists),pathExistsSync:fs.existsSync}}});var require_copy=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/copy/copy.js"(exports,module){"use strict";var fs=__require("fs"),path=__require("path"),mkdirp=require_mkdirs2().mkdirs,pathExists=require_path_exists().pathExists,utimes=require_utimes().utimesMillis,stat=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
|
|
|
11
11
|
see https://github.com/jprichardson/node-fs-extra/issues/269`),stat.checkPaths(src,dest,"copy",(err,stats)=>{if(err)return cb(err);let{srcStat,destStat}=stats;stat.checkParentPaths(src,srcStat,dest,"copy",err2=>err2?cb(err2):opts.filter?handleFilter(checkParentDir,destStat,src,dest,opts,cb):checkParentDir(destStat,src,dest,opts,cb))})}function checkParentDir(destStat,src,dest,opts,cb){let destParent=path.dirname(dest);pathExists(destParent,(err,dirExists)=>{if(err)return cb(err);if(dirExists)return startCopy(destStat,src,dest,opts,cb);mkdirp(destParent,err2=>err2?cb(err2):startCopy(destStat,src,dest,opts,cb))})}function handleFilter(onInclude,destStat,src,dest,opts,cb){Promise.resolve(opts.filter(src,dest)).then(include=>include?onInclude(destStat,src,dest,opts,cb):cb(),error=>cb(error))}function startCopy(destStat,src,dest,opts,cb){return opts.filter?handleFilter(getStats,destStat,src,dest,opts,cb):getStats(destStat,src,dest,opts,cb)}function getStats(destStat,src,dest,opts,cb){(opts.dereference?fs.stat:fs.lstat)(src,(err,srcStat)=>{if(err)return cb(err);if(srcStat.isDirectory())return onDir(srcStat,destStat,src,dest,opts,cb);if(srcStat.isFile()||srcStat.isCharacterDevice()||srcStat.isBlockDevice())return onFile(srcStat,destStat,src,dest,opts,cb);if(srcStat.isSymbolicLink())return onLink(destStat,src,dest,opts,cb)})}function onFile(srcStat,destStat,src,dest,opts,cb){return destStat?mayCopyFile(srcStat,src,dest,opts,cb):copyFile(srcStat,src,dest,opts,cb)}function mayCopyFile(srcStat,src,dest,opts,cb){if(opts.overwrite)fs.unlink(dest,err=>err?cb(err):copyFile(srcStat,src,dest,opts,cb));else return opts.errorOnExist?cb(new Error(`'${dest}' already exists`)):cb()}function copyFile(srcStat,src,dest,opts,cb){return typeof fs.copyFile=="function"?fs.copyFile(src,dest,err=>err?cb(err):setDestModeAndTimestamps(srcStat,dest,opts,cb)):copyFileFallback(srcStat,src,dest,opts,cb)}function copyFileFallback(srcStat,src,dest,opts,cb){let rs=fs.createReadStream(src);rs.on("error",err=>cb(err)).once("open",()=>{let ws=fs.createWriteStream(dest,{mode:srcStat.mode});ws.on("error",err=>cb(err)).on("open",()=>rs.pipe(ws)).once("close",()=>setDestModeAndTimestamps(srcStat,dest,opts,cb))})}function setDestModeAndTimestamps(srcStat,dest,opts,cb){fs.chmod(dest,srcStat.mode,err=>err?cb(err):opts.preserveTimestamps?utimes(dest,srcStat.atime,srcStat.mtime,cb):cb())}function onDir(srcStat,destStat,src,dest,opts,cb){return destStat?destStat&&!destStat.isDirectory()?cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)):copyDir(src,dest,opts,cb):mkDirAndCopy(srcStat,src,dest,opts,cb)}function mkDirAndCopy(srcStat,src,dest,opts,cb){fs.mkdir(dest,err=>{if(err)return cb(err);copyDir(src,dest,opts,err2=>err2?cb(err2):fs.chmod(dest,srcStat.mode,cb))})}function copyDir(src,dest,opts,cb){fs.readdir(src,(err,items)=>err?cb(err):copyDirItems(items,src,dest,opts,cb))}function copyDirItems(items,src,dest,opts,cb){let item=items.pop();return item?copyDirItem(items,item,src,dest,opts,cb):cb()}function copyDirItem(items,item,src,dest,opts,cb){let srcItem=path.join(src,item),destItem=path.join(dest,item);stat.checkPaths(srcItem,destItem,"copy",(err,stats)=>{if(err)return cb(err);let{destStat}=stats;startCopy(destStat,srcItem,destItem,opts,err2=>err2?cb(err2):copyDirItems(items,src,dest,opts,cb))})}function onLink(destStat,src,dest,opts,cb){fs.readlink(src,(err,resolvedSrc)=>{if(err)return cb(err);if(opts.dereference&&(resolvedSrc=path.resolve(process.cwd(),resolvedSrc)),destStat)fs.readlink(dest,(err2,resolvedDest)=>err2?err2.code==="EINVAL"||err2.code==="UNKNOWN"?fs.symlink(resolvedSrc,dest,cb):cb(err2):(opts.dereference&&(resolvedDest=path.resolve(process.cwd(),resolvedDest)),stat.isSrcSubdir(resolvedSrc,resolvedDest)?cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)):destStat.isDirectory()&&stat.isSrcSubdir(resolvedDest,resolvedSrc)?cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)):copyLink(resolvedSrc,dest,cb)));else return fs.symlink(resolvedSrc,dest,cb)})}function copyLink(resolvedSrc,dest,cb){fs.unlink(dest,err=>err?cb(err):fs.symlink(resolvedSrc,dest,cb))}module.exports=copy}});var require_copy2=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/copy/index.js"(exports,module){"use strict";var u=require_universalify().fromCallback;module.exports={copy:u(require_copy())}}});var require_rimraf=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/remove/rimraf.js"(exports,module){"use strict";var fs=require_graceful_fs(),path=__require("path"),assert=__require("assert"),isWindows=process.platform==="win32";function defaults(options){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach(m=>{options[m]=options[m]||fs[m],m=m+"Sync",options[m]=options[m]||fs[m]}),options.maxBusyTries=options.maxBusyTries||3}function rimraf(p,options,cb){let busyTries=0;typeof options=="function"&&(cb=options,options={}),assert(p,"rimraf: missing path"),assert.strictEqual(typeof p,"string","rimraf: path should be a string"),assert.strictEqual(typeof cb,"function","rimraf: callback function required"),assert(options,"rimraf: invalid options argument provided"),assert.strictEqual(typeof options,"object","rimraf: options should be object"),defaults(options),rimraf_(p,options,function CB(er){if(er){if((er.code==="EBUSY"||er.code==="ENOTEMPTY"||er.code==="EPERM")&&busyTries<options.maxBusyTries){busyTries++;let time=busyTries*100;return setTimeout(()=>rimraf_(p,options,CB),time)}er.code==="ENOENT"&&(er=null)}cb(er)})}function rimraf_(p,options,cb){assert(p),assert(options),assert(typeof cb=="function"),options.lstat(p,(er,st)=>{if(er&&er.code==="ENOENT")return cb(null);if(er&&er.code==="EPERM"&&isWindows)return fixWinEPERM(p,options,er,cb);if(st&&st.isDirectory())return rmdir(p,options,er,cb);options.unlink(p,er2=>{if(er2){if(er2.code==="ENOENT")return cb(null);if(er2.code==="EPERM")return isWindows?fixWinEPERM(p,options,er2,cb):rmdir(p,options,er2,cb);if(er2.code==="EISDIR")return rmdir(p,options,er2,cb)}return cb(er2)})})}function fixWinEPERM(p,options,er,cb){assert(p),assert(options),assert(typeof cb=="function"),er&&assert(er instanceof Error),options.chmod(p,438,er2=>{er2?cb(er2.code==="ENOENT"?null:er):options.stat(p,(er3,stats)=>{er3?cb(er3.code==="ENOENT"?null:er):stats.isDirectory()?rmdir(p,options,er,cb):options.unlink(p,cb)})})}function fixWinEPERMSync(p,options,er){let stats;assert(p),assert(options),er&&assert(er instanceof Error);try{options.chmodSync(p,438)}catch(er2){if(er2.code==="ENOENT")return;throw er}try{stats=options.statSync(p)}catch(er3){if(er3.code==="ENOENT")return;throw er}stats.isDirectory()?rmdirSync(p,options,er):options.unlinkSync(p)}function rmdir(p,options,originalEr,cb){assert(p),assert(options),originalEr&&assert(originalEr instanceof Error),assert(typeof cb=="function"),options.rmdir(p,er=>{er&&(er.code==="ENOTEMPTY"||er.code==="EEXIST"||er.code==="EPERM")?rmkids(p,options,cb):er&&er.code==="ENOTDIR"?cb(originalEr):cb(er)})}function rmkids(p,options,cb){assert(p),assert(options),assert(typeof cb=="function"),options.readdir(p,(er,files)=>{if(er)return cb(er);let n=files.length,errState;if(n===0)return options.rmdir(p,cb);files.forEach(f=>{rimraf(path.join(p,f),options,er2=>{if(!errState){if(er2)return cb(errState=er2);--n===0&&options.rmdir(p,cb)}})})})}function rimrafSync(p,options){let st;options=options||{},defaults(options),assert(p,"rimraf: missing path"),assert.strictEqual(typeof p,"string","rimraf: path should be a string"),assert(options,"rimraf: missing options"),assert.strictEqual(typeof options,"object","rimraf: options should be object");try{st=options.lstatSync(p)}catch(er){if(er.code==="ENOENT")return;er.code==="EPERM"&&isWindows&&fixWinEPERMSync(p,options,er)}try{st&&st.isDirectory()?rmdirSync(p,options,null):options.unlinkSync(p)}catch(er){if(er.code==="ENOENT")return;if(er.code==="EPERM")return isWindows?fixWinEPERMSync(p,options,er):rmdirSync(p,options,er);if(er.code!=="EISDIR")throw er;rmdirSync(p,options,er)}}function rmdirSync(p,options,originalEr){assert(p),assert(options),originalEr&&assert(originalEr instanceof Error);try{options.rmdirSync(p)}catch(er){if(er.code==="ENOTDIR")throw originalEr;if(er.code==="ENOTEMPTY"||er.code==="EEXIST"||er.code==="EPERM")rmkidsSync(p,options);else if(er.code!=="ENOENT")throw er}}function rmkidsSync(p,options){if(assert(p),assert(options),options.readdirSync(p).forEach(f=>rimrafSync(path.join(p,f),options)),isWindows){let startTime=Date.now();do try{return options.rmdirSync(p,options)}catch{}while(Date.now()-startTime<500)}else return options.rmdirSync(p,options)}module.exports=rimraf;rimraf.sync=rimrafSync}});var require_remove=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/remove/index.js"(exports,module){"use strict";var u=require_universalify().fromCallback,rimraf=require_rimraf();module.exports={remove:u(rimraf),removeSync:rimraf.sync}}});var require_empty=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/empty/index.js"(exports,module){"use strict";var u=require_universalify().fromCallback,fs=__require("fs"),path=__require("path"),mkdir=require_mkdirs2(),remove=require_remove(),emptyDir=u(function(dir,callback){callback=callback||function(){},fs.readdir(dir,(err,items)=>{if(err)return mkdir.mkdirs(dir,callback);items=items.map(item=>path.join(dir,item)),deleteItem();function deleteItem(){let item=items.pop();if(!item)return callback();remove.remove(item,err2=>{if(err2)return callback(err2);deleteItem()})}})});function emptyDirSync(dir){let items;try{items=fs.readdirSync(dir)}catch{return mkdir.mkdirsSync(dir)}items.forEach(item=>{item=path.join(dir,item),remove.removeSync(item)})}module.exports={emptyDirSync,emptydirSync:emptyDirSync,emptyDir,emptydir:emptyDir}}});var require_file=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/ensure/file.js"(exports,module){"use strict";var u=require_universalify().fromCallback,path=__require("path"),fs=require_graceful_fs(),mkdir=require_mkdirs2(),pathExists=require_path_exists().pathExists;function createFile(file,callback){function makeFile(){fs.writeFile(file,"",err=>{if(err)return callback(err);callback()})}fs.stat(file,(err,stats)=>{if(!err&&stats.isFile())return callback();let dir=path.dirname(file);pathExists(dir,(err2,dirExists)=>{if(err2)return callback(err2);if(dirExists)return makeFile();mkdir.mkdirs(dir,err3=>{if(err3)return callback(err3);makeFile()})})})}function createFileSync(file){let stats;try{stats=fs.statSync(file)}catch{}if(stats&&stats.isFile())return;let dir=path.dirname(file);fs.existsSync(dir)||mkdir.mkdirsSync(dir),fs.writeFileSync(file,"")}module.exports={createFile:u(createFile),createFileSync}}});var require_link=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/ensure/link.js"(exports,module){"use strict";var u=require_universalify().fromCallback,path=__require("path"),fs=require_graceful_fs(),mkdir=require_mkdirs2(),pathExists=require_path_exists().pathExists;function createLink(srcpath,dstpath,callback){function makeLink(srcpath2,dstpath2){fs.link(srcpath2,dstpath2,err=>{if(err)return callback(err);callback(null)})}pathExists(dstpath,(err,destinationExists)=>{if(err)return callback(err);if(destinationExists)return callback(null);fs.lstat(srcpath,err2=>{if(err2)return err2.message=err2.message.replace("lstat","ensureLink"),callback(err2);let dir=path.dirname(dstpath);pathExists(dir,(err3,dirExists)=>{if(err3)return callback(err3);if(dirExists)return makeLink(srcpath,dstpath);mkdir.mkdirs(dir,err4=>{if(err4)return callback(err4);makeLink(srcpath,dstpath)})})})})}function createLinkSync(srcpath,dstpath){if(fs.existsSync(dstpath))return;try{fs.lstatSync(srcpath)}catch(err){throw err.message=err.message.replace("lstat","ensureLink"),err}let dir=path.dirname(dstpath);return fs.existsSync(dir)||mkdir.mkdirsSync(dir),fs.linkSync(srcpath,dstpath)}module.exports={createLink:u(createLink),createLinkSync}}});var require_symlink_paths=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports,module){"use strict";var path=__require("path"),fs=require_graceful_fs(),pathExists=require_path_exists().pathExists;function symlinkPaths(srcpath,dstpath,callback){if(path.isAbsolute(srcpath))return fs.lstat(srcpath,err=>err?(err.message=err.message.replace("lstat","ensureSymlink"),callback(err)):callback(null,{toCwd:srcpath,toDst:srcpath}));{let dstdir=path.dirname(dstpath),relativeToDst=path.join(dstdir,srcpath);return pathExists(relativeToDst,(err,exists)=>err?callback(err):exists?callback(null,{toCwd:relativeToDst,toDst:srcpath}):fs.lstat(srcpath,err2=>err2?(err2.message=err2.message.replace("lstat","ensureSymlink"),callback(err2)):callback(null,{toCwd:srcpath,toDst:path.relative(dstdir,srcpath)})))}}function symlinkPathsSync(srcpath,dstpath){let exists;if(path.isAbsolute(srcpath)){if(exists=fs.existsSync(srcpath),!exists)throw new Error("absolute srcpath does not exist");return{toCwd:srcpath,toDst:srcpath}}else{let dstdir=path.dirname(dstpath),relativeToDst=path.join(dstdir,srcpath);if(exists=fs.existsSync(relativeToDst),exists)return{toCwd:relativeToDst,toDst:srcpath};if(exists=fs.existsSync(srcpath),!exists)throw new Error("relative srcpath does not exist");return{toCwd:srcpath,toDst:path.relative(dstdir,srcpath)}}}module.exports={symlinkPaths,symlinkPathsSync}}});var require_symlink_type=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/ensure/symlink-type.js"(exports,module){"use strict";var fs=require_graceful_fs();function symlinkType(srcpath,type,callback){if(callback=typeof type=="function"?type:callback,type=typeof type=="function"?!1:type,type)return callback(null,type);fs.lstat(srcpath,(err,stats)=>{if(err)return callback(null,"file");type=stats&&stats.isDirectory()?"dir":"file",callback(null,type)})}function symlinkTypeSync(srcpath,type){let stats;if(type)return type;try{stats=fs.lstatSync(srcpath)}catch{return"file"}return stats&&stats.isDirectory()?"dir":"file"}module.exports={symlinkType,symlinkTypeSync}}});var require_symlink=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/ensure/symlink.js"(exports,module){"use strict";var u=require_universalify().fromCallback,path=__require("path"),fs=require_graceful_fs(),_mkdirs=require_mkdirs2(),mkdirs=_mkdirs.mkdirs,mkdirsSync=_mkdirs.mkdirsSync,_symlinkPaths=require_symlink_paths(),symlinkPaths=_symlinkPaths.symlinkPaths,symlinkPathsSync=_symlinkPaths.symlinkPathsSync,_symlinkType=require_symlink_type(),symlinkType=_symlinkType.symlinkType,symlinkTypeSync=_symlinkType.symlinkTypeSync,pathExists=require_path_exists().pathExists;function createSymlink(srcpath,dstpath,type,callback){callback=typeof type=="function"?type:callback,type=typeof type=="function"?!1:type,pathExists(dstpath,(err,destinationExists)=>{if(err)return callback(err);if(destinationExists)return callback(null);symlinkPaths(srcpath,dstpath,(err2,relative)=>{if(err2)return callback(err2);srcpath=relative.toDst,symlinkType(relative.toCwd,type,(err3,type2)=>{if(err3)return callback(err3);let dir=path.dirname(dstpath);pathExists(dir,(err4,dirExists)=>{if(err4)return callback(err4);if(dirExists)return fs.symlink(srcpath,dstpath,type2,callback);mkdirs(dir,err5=>{if(err5)return callback(err5);fs.symlink(srcpath,dstpath,type2,callback)})})})})})}function createSymlinkSync(srcpath,dstpath,type){if(fs.existsSync(dstpath))return;let relative=symlinkPathsSync(srcpath,dstpath);srcpath=relative.toDst,type=symlinkTypeSync(relative.toCwd,type);let dir=path.dirname(dstpath);return fs.existsSync(dir)||mkdirsSync(dir),fs.symlinkSync(srcpath,dstpath,type)}module.exports={createSymlink:u(createSymlink),createSymlinkSync}}});var require_ensure=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/ensure/index.js"(exports,module){"use strict";var file=require_file(),link=require_link(),symlink=require_symlink();module.exports={createFile:file.createFile,createFileSync:file.createFileSync,ensureFile:file.createFile,ensureFileSync:file.createFileSync,createLink:link.createLink,createLinkSync:link.createLinkSync,ensureLink:link.createLink,ensureLinkSync:link.createLinkSync,createSymlink:symlink.createSymlink,createSymlinkSync:symlink.createSymlinkSync,ensureSymlink:symlink.createSymlink,ensureSymlinkSync:symlink.createSymlinkSync}}});var require_jsonfile=__commonJS({"../../node_modules/.pnpm/jsonfile@4.0.0/node_modules/jsonfile/index.js"(exports,module){var _fs;try{_fs=require_graceful_fs()}catch{_fs=__require("fs")}function readFile2(file,options,callback){callback==null&&(callback=options,options={}),typeof options=="string"&&(options={encoding:options}),options=options||{};var fs=options.fs||_fs,shouldThrow=!0;"throws"in options&&(shouldThrow=options.throws),fs.readFile(file,options,function(err,data){if(err)return callback(err);data=stripBom(data);var obj;try{obj=JSON.parse(data,options?options.reviver:null)}catch(err2){return shouldThrow?(err2.message=file+": "+err2.message,callback(err2)):callback(null,null)}callback(null,obj)})}function readFileSync(file,options){options=options||{},typeof options=="string"&&(options={encoding:options});var fs=options.fs||_fs,shouldThrow=!0;"throws"in options&&(shouldThrow=options.throws);try{var content=fs.readFileSync(file,options);return content=stripBom(content),JSON.parse(content,options.reviver)}catch(err){if(shouldThrow)throw err.message=file+": "+err.message,err;return null}}function stringify(obj,options){var spaces,EOL=`
|
|
12
|
-
`;typeof options=="object"&&options!==null&&(options.spaces&&(spaces=options.spaces),options.EOL&&(EOL=options.EOL));var str=JSON.stringify(obj,options?options.replacer:null,spaces);return str.replace(/\n/g,EOL)+EOL}function writeFile(file,obj,options,callback){callback==null&&(callback=options,options={}),options=options||{};var fs=options.fs||_fs,str="";try{str=stringify(obj,options)}catch(err){callback&&callback(err,null);return}fs.writeFile(file,str,options,callback)}function writeFileSync(file,obj,options){options=options||{};var fs=options.fs||_fs,str=stringify(obj,options);return fs.writeFileSync(file,str,options)}function stripBom(content){return Buffer.isBuffer(content)&&(content=content.toString("utf8")),content=content.replace(/^\uFEFF/,""),content}var jsonfile={readFile:readFile2,readFileSync,writeFile,writeFileSync};module.exports=jsonfile}});var require_jsonfile2=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/json/jsonfile.js"(exports,module){"use strict";var u=require_universalify().fromCallback,jsonFile=require_jsonfile();module.exports={readJson:u(jsonFile.readFile),readJsonSync:jsonFile.readFileSync,writeJson:u(jsonFile.writeFile),writeJsonSync:jsonFile.writeFileSync}}});var require_output_json=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/json/output-json.js"(exports,module){"use strict";var path=__require("path"),mkdir=require_mkdirs2(),pathExists=require_path_exists().pathExists,jsonFile=require_jsonfile2();function outputJson(file,data,options,callback){typeof options=="function"&&(callback=options,options={});let dir=path.dirname(file);pathExists(dir,(err,itDoes)=>{if(err)return callback(err);if(itDoes)return jsonFile.writeJson(file,data,options,callback);mkdir.mkdirs(dir,err2=>{if(err2)return callback(err2);jsonFile.writeJson(file,data,options,callback)})})}module.exports=outputJson}});var require_output_json_sync=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/json/output-json-sync.js"(exports,module){"use strict";var fs=require_graceful_fs(),path=__require("path"),mkdir=require_mkdirs2(),jsonFile=require_jsonfile2();function outputJsonSync(file,data,options){let dir=path.dirname(file);fs.existsSync(dir)||mkdir.mkdirsSync(dir),jsonFile.writeJsonSync(file,data,options)}module.exports=outputJsonSync}});var require_json=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/json/index.js"(exports,module){"use strict";var u=require_universalify().fromCallback,jsonFile=require_jsonfile2();jsonFile.outputJson=u(require_output_json());jsonFile.outputJsonSync=require_output_json_sync();jsonFile.outputJSON=jsonFile.outputJson;jsonFile.outputJSONSync=jsonFile.outputJsonSync;jsonFile.writeJSON=jsonFile.writeJson;jsonFile.writeJSONSync=jsonFile.writeJsonSync;jsonFile.readJSON=jsonFile.readJson;jsonFile.readJSONSync=jsonFile.readJsonSync;module.exports=jsonFile}});var require_move_sync=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/move-sync/move-sync.js"(exports,module){"use strict";var fs=__require("fs"),path=__require("path"),copySync=require_copy_sync2().copySync,removeSync=require_remove().removeSync,mkdirpSync=require_mkdirs2().mkdirpSync,stat=require_stat();function moveSync(src,dest,opts){opts=opts||{};let overwrite=opts.overwrite||opts.clobber||!1,{srcStat}=stat.checkPathsSync(src,dest,"move");return stat.checkParentPathsSync(src,srcStat,dest,"move"),mkdirpSync(path.dirname(dest)),doRename(src,dest,overwrite)}function doRename(src,dest,overwrite){if(overwrite)return removeSync(dest),rename(src,dest,overwrite);if(fs.existsSync(dest))throw new Error("dest already exists.");return rename(src,dest,overwrite)}function rename(src,dest,overwrite){try{fs.renameSync(src,dest)}catch(err){if(err.code!=="EXDEV")throw err;return moveAcrossDevice(src,dest,overwrite)}}function moveAcrossDevice(src,dest,overwrite){return copySync(src,dest,{overwrite,errorOnExist:!0}),removeSync(src)}module.exports=moveSync}});var require_move_sync2=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/move-sync/index.js"(exports,module){"use strict";module.exports={moveSync:require_move_sync()}}});var require_move=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/move/move.js"(exports,module){"use strict";var fs=__require("fs"),path=__require("path"),copy=require_copy2().copy,remove=require_remove().remove,mkdirp=require_mkdirs2().mkdirp,pathExists=require_path_exists().pathExists,stat=require_stat();function move(src,dest,opts,cb){typeof opts=="function"&&(cb=opts,opts={});let overwrite=opts.overwrite||opts.clobber||!1;stat.checkPaths(src,dest,"move",(err,stats)=>{if(err)return cb(err);let{srcStat}=stats;stat.checkParentPaths(src,srcStat,dest,"move",err2=>{if(err2)return cb(err2);mkdirp(path.dirname(dest),err3=>err3?cb(err3):doRename(src,dest,overwrite,cb))})})}function doRename(src,dest,overwrite,cb){if(overwrite)return remove(dest,err=>err?cb(err):rename(src,dest,overwrite,cb));pathExists(dest,(err,destExists)=>err?cb(err):destExists?cb(new Error("dest already exists.")):rename(src,dest,overwrite,cb))}function rename(src,dest,overwrite,cb){fs.rename(src,dest,err=>err?err.code!=="EXDEV"?cb(err):moveAcrossDevice(src,dest,overwrite,cb):cb())}function moveAcrossDevice(src,dest,overwrite,cb){copy(src,dest,{overwrite,errorOnExist:!0},err=>err?cb(err):remove(src,cb))}module.exports=move}});var require_move2=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/move/index.js"(exports,module){"use strict";var u=require_universalify().fromCallback;module.exports={move:u(require_move())}}});var require_output=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/output/index.js"(exports,module){"use strict";var u=require_universalify().fromCallback,fs=require_graceful_fs(),path=__require("path"),mkdir=require_mkdirs2(),pathExists=require_path_exists().pathExists;function outputFile(file,data,encoding,callback){typeof encoding=="function"&&(callback=encoding,encoding="utf8");let dir=path.dirname(file);pathExists(dir,(err,itDoes)=>{if(err)return callback(err);if(itDoes)return fs.writeFile(file,data,encoding,callback);mkdir.mkdirs(dir,err2=>{if(err2)return callback(err2);fs.writeFile(file,data,encoding,callback)})})}function outputFileSync(file,...args){let dir=path.dirname(file);if(fs.existsSync(dir))return fs.writeFileSync(file,...args);mkdir.mkdirsSync(dir),fs.writeFileSync(file,...args)}module.exports={outputFile:u(outputFile),outputFileSync}}});var require_lib2=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/index.js"(exports,module){"use strict";module.exports=Object.assign({},require_fs(),require_copy_sync2(),require_copy2(),require_empty(),require_ensure(),require_json(),require_mkdirs2(),require_move_sync2(),require_move2(),require_output(),require_path_exists(),require_remove());var fs=__require("fs");Object.getOwnPropertyDescriptor(fs,"promises")&&Object.defineProperty(module.exports,"promises",{get(){return fs.promises}})}});var require_lib3=__commonJS({"../../node_modules/.pnpm/async-sema@3.0.0/node_modules/async-sema/lib/index.js"(exports){"use strict";var __importDefault=exports&&exports.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:!0});var events_1=__importDefault(__require("events"));function arrayMove(src,srcIndex,dst,dstIndex,len){for(let j=0;j<len;++j)dst[j+dstIndex]=src[j+srcIndex],src[j+srcIndex]=void 0}function pow2AtLeast(n){return n=n>>>0,n=n-1,n=n|n>>1,n=n|n>>2,n=n|n>>4,n=n|n>>8,n=n|n>>16,n+1}function getCapacity(capacity){return pow2AtLeast(Math.min(Math.max(16,capacity),1073741824))}var Deque=class{constructor(capacity){this._capacity=getCapacity(capacity),this._length=0,this._front=0,this.arr=[]}push(item){let length=this._length;this.checkCapacity(length+1);let i=this._front+length&this._capacity-1;return this.arr[i]=item,this._length=length+1,length+1}pop(){let length=this._length;if(length===0)return;let i=this._front+length-1&this._capacity-1,ret=this.arr[i];return this.arr[i]=void 0,this._length=length-1,ret}shift(){let length=this._length;if(length===0)return;let front=this._front,ret=this.arr[front];return this.arr[front]=void 0,this._front=front+1&this._capacity-1,this._length=length-1,ret}get length(){return this._length}checkCapacity(size){this._capacity<size&&this.resizeTo(getCapacity(this._capacity*1.5+16))}resizeTo(capacity){let oldCapacity=this._capacity;this._capacity=capacity;let front=this._front,length=this._length;if(front+length>oldCapacity){let moveItemsCount=front+length&oldCapacity-1;arrayMove(this.arr,0,this.arr,oldCapacity,moveItemsCount)}}},ReleaseEmitter=class extends events_1.default{};function isFn(x){return typeof x=="function"}function defaultInit(){return"1"}var Sema=class{constructor(nr,{initFn=defaultInit,pauseFn,resumeFn,capacity=10}={}){if(isFn(pauseFn)!==isFn(resumeFn))throw new Error("pauseFn and resumeFn must be both set for pausing");this.nrTokens=nr,this.free=new Deque(nr),this.waiting=new Deque(capacity),this.releaseEmitter=new ReleaseEmitter,this.noTokens=initFn===defaultInit,this.pauseFn=pauseFn,this.resumeFn=resumeFn,this.paused=!1,this.releaseEmitter.on("release",token=>{let p=this.waiting.shift();p?p.resolve(token):(this.resumeFn&&this.paused&&(this.paused=!1,this.resumeFn()),this.free.push(token))});for(let i=0;i<nr;i++)this.free.push(initFn())}async acquire(){let token=this.free.pop();return token!==void 0?token:new Promise((resolve,reject)=>{this.pauseFn&&!this.paused&&(this.paused=!0,this.pauseFn()),this.waiting.push({resolve,reject})})}release(token){this.releaseEmitter.emit("release",this.noTokens?"1":token)}drain(){let a=new Array(this.nrTokens);for(let i=0;i<this.nrTokens;i++)a[i]=this.acquire();return Promise.all(a)}nrWaiting(){return this.waiting.length}};exports.Sema=Sema;function RateLimit(rps,{timeUnit=1e3,uniformDistribution=!1}={}){let sema=new Sema(uniformDistribution?1:rps),delay=uniformDistribution?timeUnit/rps:timeUnit;return async function(){await sema.acquire(),setTimeout(()=>sema.release(),delay)}}exports.RateLimit=RateLimit}});var require_hashes=__commonJS({"../client/dist/utils/hashes.js"(exports,module){"use strict";var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toESM2=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),hashes_exports={};__export(hashes_exports,{hash:()=>hash,hashes:()=>hashes,mapToObject:()=>mapToObject});module.exports=__toCommonJS(hashes_exports);var import_crypto=__require("crypto"),import_fs_extra2=__toESM2(require_lib2()),import_async_sema=require_lib3(),MAX_BUFFER_FILE_SIZE=2**31-1;function hash(buf){return(0,import_crypto.createHash)("sha1").update(Uint8Array.from(buf)).digest("hex")}async function hashFile(path){let digest=(0,import_crypto.createHash)("sha1");for await(let chunk of import_fs_extra2.default.createReadStream(path))digest.update(Uint8Array.from(chunk));return digest.digest("hex")}var mapToObject=map=>{let obj={};for(let[key,value]of map)typeof key>"u"||(obj[key]=value);return obj};async function hashes(files,map=new Map){let semaphore=new import_async_sema.Sema(100);return await Promise.all(files.map(async name=>{await semaphore.acquire();let stat=await import_fs_extra2.default.lstat(name),mode=stat.mode,data,size,isDirectory=stat.isDirectory(),h;if(!isDirectory)if(stat.isSymbolicLink()){let link=await import_fs_extra2.default.readlink(name);data=Buffer.from(link,"utf8"),size=data.length,h=hash(data)}else stat.size>MAX_BUFFER_FILE_SIZE?(size=stat.size,h=await hashFile(name)):(data=await import_fs_extra2.default.readFile(name),size=data.length,h=hash(data));let entry=map.get(h);if(entry){let names=new Set(entry.names);names.add(name),entry.names=[...names]}else map.set(h,{names:[name],data,mode,size});semaphore.release()})),map}}});var require_query_string=__commonJS({"../client/dist/utils/query-string.js"(exports,module){"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),query_string_exports={};__export(query_string_exports,{generateQueryString:()=>generateQueryString});module.exports=__toCommonJS(query_string_exports);var import_url=__require("url");function generateQueryString(clientOptions){let options=new import_url.URLSearchParams;return clientOptions.teamId&&options.set("teamId",clientOptions.teamId),clientOptions.force&&options.set("forceNew","1"),clientOptions.withCache&&options.set("withCache","1"),clientOptions.skipAutoDetectionConfirmation&&options.set("skipAutoDetectionConfirmation","1"),clientOptions.prebuilt&&options.set("prebuilt","1"),Array.from(options.entries()).length?`?${options.toString()}`:""}}});var require_ready_state=__commonJS({"../client/dist/utils/ready-state.js"(exports,module){"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),ready_state_exports={};__export(ready_state_exports,{isAliasAssigned:()=>isAliasAssigned,isAliasError:()=>isAliasError,isDone:()=>isDone,isFailed:()=>isFailed,isReady:()=>isReady});module.exports=__toCommonJS(ready_state_exports);var isReady=({readyState,state})=>readyState==="READY"||state==="READY",isFailed=({readyState,state})=>readyState?readyState.endsWith("_ERROR")||readyState==="ERROR":state?state.endsWith("_ERROR")||state==="ERROR":!1,isDone=buildOrDeployment=>isReady(buildOrDeployment)||isFailed(buildOrDeployment),isAliasAssigned=deployment=>!!deployment.aliasAssigned,isAliasError=deployment=>!!deployment.aliasError}});var require_cjs=__commonJS({"../../node_modules/.pnpm/sleep-promise@8.0.1/node_modules/sleep-promise/build/cjs.js"(exports,module){"use strict";var cachedSetTimeout=setTimeout;function createSleepPromise(a,b){var c=b.useCachedSetTimeout,d=c?cachedSetTimeout:setTimeout;return new Promise(function(b2){d(b2,a)})}function sleep(a){function b(a2){return e.then(function(){return a2})}var c=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},d=c.useCachedSetTimeout,e=createSleepPromise(a,{useCachedSetTimeout:d});return b.then=function(){return e.then.apply(e,arguments)},b.catch=Promise.resolve().catch,b}module.exports=sleep}});var require_ignore=__commonJS({"../../node_modules/.pnpm/ignore@4.0.6/node_modules/ignore/index.js"(exports,module){function make_array(subject){return Array.isArray(subject)?subject:[subject]}var REGEX_BLANK_LINE=/^\s+$/,REGEX_LEADING_EXCAPED_EXCLAMATION=/^\\!/,REGEX_LEADING_EXCAPED_HASH=/^\\#/,SLASH="/",KEY_IGNORE=typeof Symbol<"u"?Symbol.for("node-ignore"):"node-ignore",define=(object,key,value)=>Object.defineProperty(object,key,{value}),REGEX_REGEXP_RANGE=/([0-z])-([0-z])/g,sanitizeRange=range=>range.replace(REGEX_REGEXP_RANGE,(match,from,to)=>from.charCodeAt(0)<=to.charCodeAt(0)?match:""),DEFAULT_REPLACER_PREFIX=[[/\\?\s+$/,match=>match.indexOf("\\")===0?" ":""],[/\\\s/g,()=>" "],[/[\\^$.|*+(){]/g,match=>`\\${match}`],[/\[([^\]/]*)($|\])/g,(match,p1,p2)=>p2==="]"?`[${sanitizeRange(p1)}]`:`\\${match}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"]],DEFAULT_REPLACER_SUFFIX=[[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(match,index,str)=>index+6<str.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)\\\*(?=.+)/g,(match,p1)=>`${p1}[^\\/]*`],[/(\^|\\\/)?\\\*$/,(match,p1)=>`${p1?`${p1}[^/]+`:"[^/]*"}(?=$|\\/$)`],[/\\\\\\/g,()=>"\\"]],POSITIVE_REPLACERS=[...DEFAULT_REPLACER_PREFIX,[/(?:[^*/])$/,match=>`${match}(?=$|\\/)`],...DEFAULT_REPLACER_SUFFIX],NEGATIVE_REPLACERS=[...DEFAULT_REPLACER_PREFIX,[/(?:[^*])$/,match=>`${match}(?=$|\\/$)`],...DEFAULT_REPLACER_SUFFIX],cache=Object.create(null),make_regex=(pattern,negative,ignorecase)=>{let r=cache[pattern];if(r)return r;let source=(negative?NEGATIVE_REPLACERS:POSITIVE_REPLACERS).reduce((prev,current)=>prev.replace(current[0],current[1].bind(pattern)),pattern);return cache[pattern]=ignorecase?new RegExp(source,"i"):new RegExp(source)},checkPattern=pattern=>pattern&&typeof pattern=="string"&&!REGEX_BLANK_LINE.test(pattern)&&pattern.indexOf("#")!==0,createRule=(pattern,ignorecase)=>{let origin=pattern,negative=!1;pattern.indexOf("!")===0&&(negative=!0,pattern=pattern.substr(1)),pattern=pattern.replace(REGEX_LEADING_EXCAPED_EXCLAMATION,"!").replace(REGEX_LEADING_EXCAPED_HASH,"#");let regex=make_regex(pattern,negative,ignorecase);return{origin,pattern,negative,regex}},IgnoreBase=class{constructor({ignorecase=!0}={}){this._rules=[],this._ignorecase=ignorecase,define(this,KEY_IGNORE,!0),this._initCache()}_initCache(){this._cache=Object.create(null)}add(pattern){return this._added=!1,typeof pattern=="string"&&(pattern=pattern.split(/\r?\n/g)),make_array(pattern).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(pattern){return this.add(pattern)}_addPattern(pattern){if(pattern&&pattern[KEY_IGNORE]){this._rules=this._rules.concat(pattern._rules),this._added=!0;return}if(checkPattern(pattern)){let rule=createRule(pattern,this._ignorecase);this._added=!0,this._rules.push(rule)}}filter(paths){return make_array(paths).filter(path=>this._filter(path))}createFilter(){return path=>this._filter(path)}ignores(path){return!this._filter(path)}_filter(path,slices){return path?path in this._cache?this._cache[path]:(slices||(slices=path.split(SLASH)),slices.pop(),this._cache[path]=slices.length?this._filter(slices.join(SLASH)+SLASH,slices)&&this._test(path):this._test(path)):!1}_test(path){let matched=0;return this._rules.forEach(rule=>{matched^rule.negative||(matched=rule.negative^rule.regex.test(path))}),!matched}};if(typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let filter=IgnoreBase.prototype._filter,make_posix=str=>/^\\\\\?\\/.test(str)||/[^\x00-\x80]+/.test(str)?str:str.replace(/\\/g,"/");IgnoreBase.prototype._filter=function(path,slices){return path=make_posix(path),filter.call(this,path,slices)}}module.exports=options=>new IgnoreBase(options)}});var require_package=__commonJS({"../client/package.json"(exports,module){module.exports={name:"@vercel/client",version:"18.4.4",main:"dist/index.js",typings:"dist/index.d.ts",homepage:"https://vercel.com",license:"Apache-2.0",files:["dist"],repository:{type:"git",url:"https://github.com/vercel/vercel.git",directory:"packages/client"},scripts:{build:"node ../../utils/build.mjs",test:"vitest run --config ./vitest.config.mts","test-e2e":"vitest run --config ./vitest.config.mts tests/integration-","type-check":"tsc --noEmit","test-unit":"vitest run --config ./vitest.config.mts tests/unit."},engines:{node:">= 20"},devDependencies:{"@types/async-retry":"1.4.5","@types/fs-extra":"7.0.0","@types/minimatch":"3.0.5","@types/ms":"0.7.30","@types/node":"20.11.0","@types/recursive-readdir":"2.2.0","@types/tar-fs":"1.16.1",vitest:"4.1.10"},dependencies:{"@vercel/build-utils":"workspace:*","@vercel/error-utils":"workspace:*","@vercel/microfrontends":"2.4.0","@vercel/routing-utils":"workspace:*","async-retry":"1.2.3","async-sema":"3.0.0","fs-extra":"8.0.1",ignore:"4.0.6",minimatch:"5.0.1",ms:"2.1.2",querystring:"^0.2.0","sleep-promise":"8.0.1","tar-fs":"1.16.3"}}}});var require_pkg=__commonJS({"../client/dist/pkg.js"(exports,module){"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),pkg_exports={};__export(pkg_exports,{pkgVersion:()=>pkgVersion});module.exports=__toCommonJS(pkg_exports);var pkg=require_package(),pkgVersion=pkg.version}});var require_readdir_recursive=__commonJS({"../client/dist/utils/readdir-recursive.js"(exports,module){"use strict";var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toESM2=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),readdir_recursive_exports={};__export(readdir_recursive_exports,{default:()=>readdir});module.exports=__toCommonJS(readdir_recursive_exports);var import_fs=__toESM2(__require("fs")),import_path2=__toESM2(__require("path")),import_minimatch=__toESM2(require_minimatch());function patternMatcher(pattern){return function(path,stats){let minimatcher=new import_minimatch.default.Minimatch(pattern,{matchBase:!0});return(!minimatcher.negate||stats.isFile())&&minimatcher.match(path)}}function toMatcherFunction(ignoreEntry){return typeof ignoreEntry=="function"?ignoreEntry:patternMatcher(ignoreEntry)}function readdir(path,ignores){ignores=ignores.map(toMatcherFunction);let list=[];return new Promise(function(resolve,reject){import_fs.default.readdir(path,function(err,files){if(err)return reject(err);let pending=files.length;if(!pending)return resolve(list);files.forEach(function(file){let filePath=import_path2.default.join(path,file);import_fs.default.lstat(filePath,function(_err,stats){if(_err)return reject(_err);if(ignores.some(matcher=>matcher(filePath,stats)))return pending-=1,pending?null:resolve(list);if(stats.isDirectory())readdir(filePath,ignores).then(function(res){if(res.length===0&&list.push(filePath),list=list.concat(res),pending-=1,!pending)return resolve(list)}).catch(reject);else if(list.push(filePath),pending-=1,!pending)return resolve(list)})})})})}}});var require_utils=__commonJS({"../client/dist/utils/index.js"(exports,module){"use strict";var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toESM2=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),utils_exports={};__export(utils_exports,{API_FILES:()=>API_FILES,EVENTS:()=>EVENTS,buildFileTree:()=>buildFileTree2,createDebug:()=>createDebug,fetchApi:()=>fetchApi,getApiDeploymentsUrl:()=>getApiDeploymentsUrl,getVercelIgnore:()=>getVercelIgnore2,parseVercelConfig:()=>parseVercelConfig,prepareFiles:()=>prepareFiles,shouldInlineStaticFiles:()=>shouldInlineStaticFiles});module.exports=__toCommonJS(utils_exports);var import_path2=__require("path"),import_stream=__require("stream"),import_url=__require("url"),import_ignore=__toESM2(require_ignore()),import_pkg=require_pkg(),import_build_utils=__require("@vercel/build-utils"),import_async_sema=require_lib3(),import_fs_extra2=require_lib2(),import_readdir_recursive=__toESM2(require_readdir_recursive()),semaphore=new import_async_sema.Sema(10),API_FILES="/v2/files",EVENTS_ARRAY=["hashes-calculated","file-count","file-uploaded","all-files-uploaded","created","building","ready","alias-assigned","warning","error","notice","tip","canceled","checks-registered","checks-completed","checks-running","checks-conclusion-succeeded","checks-conclusion-failed","checks-conclusion-skipped","checks-conclusion-canceled","checks-v2-failed"],EVENTS=new Set(EVENTS_ARRAY);function getApiDeploymentsUrl(){return"/v13/deployments"}async function parseVercelConfig(filePath){if(!filePath)return{};try{let jsonString=await(0,import_fs_extra2.readFile)(filePath,"utf8");return JSON.parse(jsonString)}catch(e){return console.error(e),{}}}var maybeRead=async function(path,default_){try{return await(0,import_fs_extra2.readFile)(path,"utf8")}catch{return default_}};async function getUserIgnore(cwd){let[vercelignore,nowignore]=await Promise.all([maybeRead((0,import_path2.join)(cwd,".vercelignore"),""),maybeRead((0,import_path2.join)(cwd,".nowignore"),"")]);if(vercelignore&&nowignore)throw new import_build_utils.NowBuildError({code:"CONFLICTING_IGNORE_FILES",message:"Cannot use both a `.vercelignore` and `.nowignore` file. Please delete the `.nowignore` file.",link:"https://vercel.link/combining-old-and-new-config"});let ignoreFile=vercelignore||nowignore;return ignoreFile?{ig:(0,import_ignore.default)().add(clearRelative(ignoreFile)),ignoreFileName:vercelignore?".vercelignore":".nowignore"}:null}var FILEPATHMAP_VERCELIGNORE_EXCEPTIONS=["node_modules",".next",".yarn/cache",".pnp*",".venv","venv","__pycache__","/target"],filePathMapVercelignoreExceptions=(0,import_ignore.default)().add(FILEPATHMAP_VERCELIGNORE_EXCEPTIONS.join(`
|
|
12
|
+
`;typeof options=="object"&&options!==null&&(options.spaces&&(spaces=options.spaces),options.EOL&&(EOL=options.EOL));var str=JSON.stringify(obj,options?options.replacer:null,spaces);return str.replace(/\n/g,EOL)+EOL}function writeFile(file,obj,options,callback){callback==null&&(callback=options,options={}),options=options||{};var fs=options.fs||_fs,str="";try{str=stringify(obj,options)}catch(err){callback&&callback(err,null);return}fs.writeFile(file,str,options,callback)}function writeFileSync(file,obj,options){options=options||{};var fs=options.fs||_fs,str=stringify(obj,options);return fs.writeFileSync(file,str,options)}function stripBom(content){return Buffer.isBuffer(content)&&(content=content.toString("utf8")),content=content.replace(/^\uFEFF/,""),content}var jsonfile={readFile:readFile2,readFileSync,writeFile,writeFileSync};module.exports=jsonfile}});var require_jsonfile2=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/json/jsonfile.js"(exports,module){"use strict";var u=require_universalify().fromCallback,jsonFile=require_jsonfile();module.exports={readJson:u(jsonFile.readFile),readJsonSync:jsonFile.readFileSync,writeJson:u(jsonFile.writeFile),writeJsonSync:jsonFile.writeFileSync}}});var require_output_json=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/json/output-json.js"(exports,module){"use strict";var path=__require("path"),mkdir=require_mkdirs2(),pathExists=require_path_exists().pathExists,jsonFile=require_jsonfile2();function outputJson(file,data,options,callback){typeof options=="function"&&(callback=options,options={});let dir=path.dirname(file);pathExists(dir,(err,itDoes)=>{if(err)return callback(err);if(itDoes)return jsonFile.writeJson(file,data,options,callback);mkdir.mkdirs(dir,err2=>{if(err2)return callback(err2);jsonFile.writeJson(file,data,options,callback)})})}module.exports=outputJson}});var require_output_json_sync=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/json/output-json-sync.js"(exports,module){"use strict";var fs=require_graceful_fs(),path=__require("path"),mkdir=require_mkdirs2(),jsonFile=require_jsonfile2();function outputJsonSync(file,data,options){let dir=path.dirname(file);fs.existsSync(dir)||mkdir.mkdirsSync(dir),jsonFile.writeJsonSync(file,data,options)}module.exports=outputJsonSync}});var require_json=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/json/index.js"(exports,module){"use strict";var u=require_universalify().fromCallback,jsonFile=require_jsonfile2();jsonFile.outputJson=u(require_output_json());jsonFile.outputJsonSync=require_output_json_sync();jsonFile.outputJSON=jsonFile.outputJson;jsonFile.outputJSONSync=jsonFile.outputJsonSync;jsonFile.writeJSON=jsonFile.writeJson;jsonFile.writeJSONSync=jsonFile.writeJsonSync;jsonFile.readJSON=jsonFile.readJson;jsonFile.readJSONSync=jsonFile.readJsonSync;module.exports=jsonFile}});var require_move_sync=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/move-sync/move-sync.js"(exports,module){"use strict";var fs=__require("fs"),path=__require("path"),copySync=require_copy_sync2().copySync,removeSync=require_remove().removeSync,mkdirpSync=require_mkdirs2().mkdirpSync,stat=require_stat();function moveSync(src,dest,opts){opts=opts||{};let overwrite=opts.overwrite||opts.clobber||!1,{srcStat}=stat.checkPathsSync(src,dest,"move");return stat.checkParentPathsSync(src,srcStat,dest,"move"),mkdirpSync(path.dirname(dest)),doRename(src,dest,overwrite)}function doRename(src,dest,overwrite){if(overwrite)return removeSync(dest),rename(src,dest,overwrite);if(fs.existsSync(dest))throw new Error("dest already exists.");return rename(src,dest,overwrite)}function rename(src,dest,overwrite){try{fs.renameSync(src,dest)}catch(err){if(err.code!=="EXDEV")throw err;return moveAcrossDevice(src,dest,overwrite)}}function moveAcrossDevice(src,dest,overwrite){return copySync(src,dest,{overwrite,errorOnExist:!0}),removeSync(src)}module.exports=moveSync}});var require_move_sync2=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/move-sync/index.js"(exports,module){"use strict";module.exports={moveSync:require_move_sync()}}});var require_move=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/move/move.js"(exports,module){"use strict";var fs=__require("fs"),path=__require("path"),copy=require_copy2().copy,remove=require_remove().remove,mkdirp=require_mkdirs2().mkdirp,pathExists=require_path_exists().pathExists,stat=require_stat();function move(src,dest,opts,cb){typeof opts=="function"&&(cb=opts,opts={});let overwrite=opts.overwrite||opts.clobber||!1;stat.checkPaths(src,dest,"move",(err,stats)=>{if(err)return cb(err);let{srcStat}=stats;stat.checkParentPaths(src,srcStat,dest,"move",err2=>{if(err2)return cb(err2);mkdirp(path.dirname(dest),err3=>err3?cb(err3):doRename(src,dest,overwrite,cb))})})}function doRename(src,dest,overwrite,cb){if(overwrite)return remove(dest,err=>err?cb(err):rename(src,dest,overwrite,cb));pathExists(dest,(err,destExists)=>err?cb(err):destExists?cb(new Error("dest already exists.")):rename(src,dest,overwrite,cb))}function rename(src,dest,overwrite,cb){fs.rename(src,dest,err=>err?err.code!=="EXDEV"?cb(err):moveAcrossDevice(src,dest,overwrite,cb):cb())}function moveAcrossDevice(src,dest,overwrite,cb){copy(src,dest,{overwrite,errorOnExist:!0},err=>err?cb(err):remove(src,cb))}module.exports=move}});var require_move2=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/move/index.js"(exports,module){"use strict";var u=require_universalify().fromCallback;module.exports={move:u(require_move())}}});var require_output=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/output/index.js"(exports,module){"use strict";var u=require_universalify().fromCallback,fs=require_graceful_fs(),path=__require("path"),mkdir=require_mkdirs2(),pathExists=require_path_exists().pathExists;function outputFile(file,data,encoding,callback){typeof encoding=="function"&&(callback=encoding,encoding="utf8");let dir=path.dirname(file);pathExists(dir,(err,itDoes)=>{if(err)return callback(err);if(itDoes)return fs.writeFile(file,data,encoding,callback);mkdir.mkdirs(dir,err2=>{if(err2)return callback(err2);fs.writeFile(file,data,encoding,callback)})})}function outputFileSync(file,...args){let dir=path.dirname(file);if(fs.existsSync(dir))return fs.writeFileSync(file,...args);mkdir.mkdirsSync(dir),fs.writeFileSync(file,...args)}module.exports={outputFile:u(outputFile),outputFileSync}}});var require_lib2=__commonJS({"../../node_modules/.pnpm/fs-extra@8.0.1/node_modules/fs-extra/lib/index.js"(exports,module){"use strict";module.exports=Object.assign({},require_fs(),require_copy_sync2(),require_copy2(),require_empty(),require_ensure(),require_json(),require_mkdirs2(),require_move_sync2(),require_move2(),require_output(),require_path_exists(),require_remove());var fs=__require("fs");Object.getOwnPropertyDescriptor(fs,"promises")&&Object.defineProperty(module.exports,"promises",{get(){return fs.promises}})}});var require_lib3=__commonJS({"../../node_modules/.pnpm/async-sema@3.0.0/node_modules/async-sema/lib/index.js"(exports){"use strict";var __importDefault=exports&&exports.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:!0});var events_1=__importDefault(__require("events"));function arrayMove(src,srcIndex,dst,dstIndex,len){for(let j=0;j<len;++j)dst[j+dstIndex]=src[j+srcIndex],src[j+srcIndex]=void 0}function pow2AtLeast(n){return n=n>>>0,n=n-1,n=n|n>>1,n=n|n>>2,n=n|n>>4,n=n|n>>8,n=n|n>>16,n+1}function getCapacity(capacity){return pow2AtLeast(Math.min(Math.max(16,capacity),1073741824))}var Deque=class{constructor(capacity){this._capacity=getCapacity(capacity),this._length=0,this._front=0,this.arr=[]}push(item){let length=this._length;this.checkCapacity(length+1);let i=this._front+length&this._capacity-1;return this.arr[i]=item,this._length=length+1,length+1}pop(){let length=this._length;if(length===0)return;let i=this._front+length-1&this._capacity-1,ret=this.arr[i];return this.arr[i]=void 0,this._length=length-1,ret}shift(){let length=this._length;if(length===0)return;let front=this._front,ret=this.arr[front];return this.arr[front]=void 0,this._front=front+1&this._capacity-1,this._length=length-1,ret}get length(){return this._length}checkCapacity(size){this._capacity<size&&this.resizeTo(getCapacity(this._capacity*1.5+16))}resizeTo(capacity){let oldCapacity=this._capacity;this._capacity=capacity;let front=this._front,length=this._length;if(front+length>oldCapacity){let moveItemsCount=front+length&oldCapacity-1;arrayMove(this.arr,0,this.arr,oldCapacity,moveItemsCount)}}},ReleaseEmitter=class extends events_1.default{};function isFn(x){return typeof x=="function"}function defaultInit(){return"1"}var Sema=class{constructor(nr,{initFn=defaultInit,pauseFn,resumeFn,capacity=10}={}){if(isFn(pauseFn)!==isFn(resumeFn))throw new Error("pauseFn and resumeFn must be both set for pausing");this.nrTokens=nr,this.free=new Deque(nr),this.waiting=new Deque(capacity),this.releaseEmitter=new ReleaseEmitter,this.noTokens=initFn===defaultInit,this.pauseFn=pauseFn,this.resumeFn=resumeFn,this.paused=!1,this.releaseEmitter.on("release",token=>{let p=this.waiting.shift();p?p.resolve(token):(this.resumeFn&&this.paused&&(this.paused=!1,this.resumeFn()),this.free.push(token))});for(let i=0;i<nr;i++)this.free.push(initFn())}async acquire(){let token=this.free.pop();return token!==void 0?token:new Promise((resolve,reject)=>{this.pauseFn&&!this.paused&&(this.paused=!0,this.pauseFn()),this.waiting.push({resolve,reject})})}release(token){this.releaseEmitter.emit("release",this.noTokens?"1":token)}drain(){let a=new Array(this.nrTokens);for(let i=0;i<this.nrTokens;i++)a[i]=this.acquire();return Promise.all(a)}nrWaiting(){return this.waiting.length}};exports.Sema=Sema;function RateLimit(rps,{timeUnit=1e3,uniformDistribution=!1}={}){let sema=new Sema(uniformDistribution?1:rps),delay=uniformDistribution?timeUnit/rps:timeUnit;return async function(){await sema.acquire(),setTimeout(()=>sema.release(),delay)}}exports.RateLimit=RateLimit}});var require_hashes=__commonJS({"../client/dist/utils/hashes.js"(exports,module){"use strict";var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toESM2=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),hashes_exports={};__export(hashes_exports,{hash:()=>hash,hashes:()=>hashes,mapToObject:()=>mapToObject});module.exports=__toCommonJS(hashes_exports);var import_crypto=__require("crypto"),import_fs_extra2=__toESM2(require_lib2()),import_async_sema=require_lib3(),MAX_BUFFER_FILE_SIZE=2**31-1;function hash(buf){return(0,import_crypto.createHash)("sha1").update(Uint8Array.from(buf)).digest("hex")}async function hashFile(path){let digest=(0,import_crypto.createHash)("sha1");for await(let chunk of import_fs_extra2.default.createReadStream(path))digest.update(Uint8Array.from(chunk));return digest.digest("hex")}var mapToObject=map=>{let obj={};for(let[key,value]of map)typeof key>"u"||(obj[key]=value);return obj};async function hashes(files,map=new Map){let semaphore=new import_async_sema.Sema(100);return await Promise.all(files.map(async name=>{await semaphore.acquire();let stat=await import_fs_extra2.default.lstat(name),mode=stat.mode,data,size,isDirectory=stat.isDirectory(),h;if(!isDirectory)if(stat.isSymbolicLink()){let link=await import_fs_extra2.default.readlink(name);data=Buffer.from(link,"utf8"),size=data.length,h=hash(data)}else stat.size>MAX_BUFFER_FILE_SIZE?(size=stat.size,h=await hashFile(name)):(data=await import_fs_extra2.default.readFile(name),size=data.length,h=hash(data));let entry=map.get(h);if(entry){let names=new Set(entry.names);names.add(name),entry.names=[...names]}else map.set(h,{names:[name],data,mode,size});semaphore.release()})),map}}});var require_query_string=__commonJS({"../client/dist/utils/query-string.js"(exports,module){"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),query_string_exports={};__export(query_string_exports,{generateQueryString:()=>generateQueryString});module.exports=__toCommonJS(query_string_exports);var import_url=__require("url");function generateQueryString(clientOptions){let options=new import_url.URLSearchParams;return clientOptions.teamId&&options.set("teamId",clientOptions.teamId),clientOptions.force&&options.set("forceNew","1"),clientOptions.withCache&&options.set("withCache","1"),clientOptions.skipAutoDetectionConfirmation&&options.set("skipAutoDetectionConfirmation","1"),clientOptions.prebuilt&&options.set("prebuilt","1"),Array.from(options.entries()).length?`?${options.toString()}`:""}}});var require_ready_state=__commonJS({"../client/dist/utils/ready-state.js"(exports,module){"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),ready_state_exports={};__export(ready_state_exports,{isAliasAssigned:()=>isAliasAssigned,isAliasError:()=>isAliasError,isDone:()=>isDone,isFailed:()=>isFailed,isReady:()=>isReady});module.exports=__toCommonJS(ready_state_exports);var isReady=({readyState,state})=>readyState==="READY"||state==="READY",isFailed=({readyState,state})=>readyState?readyState.endsWith("_ERROR")||readyState==="ERROR":state?state.endsWith("_ERROR")||state==="ERROR":!1,isDone=buildOrDeployment=>isReady(buildOrDeployment)||isFailed(buildOrDeployment),isAliasAssigned=deployment=>!!deployment.aliasAssigned,isAliasError=deployment=>!!deployment.aliasError}});var require_cjs=__commonJS({"../../node_modules/.pnpm/sleep-promise@8.0.1/node_modules/sleep-promise/build/cjs.js"(exports,module){"use strict";var cachedSetTimeout=setTimeout;function createSleepPromise(a,b){var c=b.useCachedSetTimeout,d=c?cachedSetTimeout:setTimeout;return new Promise(function(b2){d(b2,a)})}function sleep(a){function b(a2){return e.then(function(){return a2})}var c=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},d=c.useCachedSetTimeout,e=createSleepPromise(a,{useCachedSetTimeout:d});return b.then=function(){return e.then.apply(e,arguments)},b.catch=Promise.resolve().catch,b}module.exports=sleep}});var require_ignore=__commonJS({"../../node_modules/.pnpm/ignore@4.0.6/node_modules/ignore/index.js"(exports,module){function make_array(subject){return Array.isArray(subject)?subject:[subject]}var REGEX_BLANK_LINE=/^\s+$/,REGEX_LEADING_EXCAPED_EXCLAMATION=/^\\!/,REGEX_LEADING_EXCAPED_HASH=/^\\#/,SLASH="/",KEY_IGNORE=typeof Symbol<"u"?Symbol.for("node-ignore"):"node-ignore",define=(object,key,value)=>Object.defineProperty(object,key,{value}),REGEX_REGEXP_RANGE=/([0-z])-([0-z])/g,sanitizeRange=range=>range.replace(REGEX_REGEXP_RANGE,(match,from,to)=>from.charCodeAt(0)<=to.charCodeAt(0)?match:""),DEFAULT_REPLACER_PREFIX=[[/\\?\s+$/,match=>match.indexOf("\\")===0?" ":""],[/\\\s/g,()=>" "],[/[\\^$.|*+(){]/g,match=>`\\${match}`],[/\[([^\]/]*)($|\])/g,(match,p1,p2)=>p2==="]"?`[${sanitizeRange(p1)}]`:`\\${match}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"]],DEFAULT_REPLACER_SUFFIX=[[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(match,index,str)=>index+6<str.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)\\\*(?=.+)/g,(match,p1)=>`${p1}[^\\/]*`],[/(\^|\\\/)?\\\*$/,(match,p1)=>`${p1?`${p1}[^/]+`:"[^/]*"}(?=$|\\/$)`],[/\\\\\\/g,()=>"\\"]],POSITIVE_REPLACERS=[...DEFAULT_REPLACER_PREFIX,[/(?:[^*/])$/,match=>`${match}(?=$|\\/)`],...DEFAULT_REPLACER_SUFFIX],NEGATIVE_REPLACERS=[...DEFAULT_REPLACER_PREFIX,[/(?:[^*])$/,match=>`${match}(?=$|\\/$)`],...DEFAULT_REPLACER_SUFFIX],cache=Object.create(null),make_regex=(pattern,negative,ignorecase)=>{let r=cache[pattern];if(r)return r;let source=(negative?NEGATIVE_REPLACERS:POSITIVE_REPLACERS).reduce((prev,current)=>prev.replace(current[0],current[1].bind(pattern)),pattern);return cache[pattern]=ignorecase?new RegExp(source,"i"):new RegExp(source)},checkPattern=pattern=>pattern&&typeof pattern=="string"&&!REGEX_BLANK_LINE.test(pattern)&&pattern.indexOf("#")!==0,createRule=(pattern,ignorecase)=>{let origin=pattern,negative=!1;pattern.indexOf("!")===0&&(negative=!0,pattern=pattern.substr(1)),pattern=pattern.replace(REGEX_LEADING_EXCAPED_EXCLAMATION,"!").replace(REGEX_LEADING_EXCAPED_HASH,"#");let regex=make_regex(pattern,negative,ignorecase);return{origin,pattern,negative,regex}},IgnoreBase=class{constructor({ignorecase=!0}={}){this._rules=[],this._ignorecase=ignorecase,define(this,KEY_IGNORE,!0),this._initCache()}_initCache(){this._cache=Object.create(null)}add(pattern){return this._added=!1,typeof pattern=="string"&&(pattern=pattern.split(/\r?\n/g)),make_array(pattern).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(pattern){return this.add(pattern)}_addPattern(pattern){if(pattern&&pattern[KEY_IGNORE]){this._rules=this._rules.concat(pattern._rules),this._added=!0;return}if(checkPattern(pattern)){let rule=createRule(pattern,this._ignorecase);this._added=!0,this._rules.push(rule)}}filter(paths){return make_array(paths).filter(path=>this._filter(path))}createFilter(){return path=>this._filter(path)}ignores(path){return!this._filter(path)}_filter(path,slices){return path?path in this._cache?this._cache[path]:(slices||(slices=path.split(SLASH)),slices.pop(),this._cache[path]=slices.length?this._filter(slices.join(SLASH)+SLASH,slices)&&this._test(path):this._test(path)):!1}_test(path){let matched=0;return this._rules.forEach(rule=>{matched^rule.negative||(matched=rule.negative^rule.regex.test(path))}),!matched}};if(typeof process<"u"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let filter=IgnoreBase.prototype._filter,make_posix=str=>/^\\\\\?\\/.test(str)||/[^\x00-\x80]+/.test(str)?str:str.replace(/\\/g,"/");IgnoreBase.prototype._filter=function(path,slices){return path=make_posix(path),filter.call(this,path,slices)}}module.exports=options=>new IgnoreBase(options)}});var require_package=__commonJS({"../client/package.json"(exports,module){module.exports={name:"@vercel/client",version:"18.4.5",main:"dist/index.js",typings:"dist/index.d.ts",homepage:"https://vercel.com",license:"Apache-2.0",files:["dist"],repository:{type:"git",url:"https://github.com/vercel/vercel.git",directory:"packages/client"},scripts:{build:"node ../../utils/build.mjs",test:"vitest run --config ./vitest.config.mts","test-e2e":"vitest run --config ./vitest.config.mts tests/integration-","type-check":"tsc --noEmit","test-unit":"vitest run --config ./vitest.config.mts tests/unit."},engines:{node:">= 20"},devDependencies:{"@types/async-retry":"1.4.5","@types/fs-extra":"7.0.0","@types/minimatch":"3.0.5","@types/ms":"0.7.30","@types/node":"20.11.0","@types/recursive-readdir":"2.2.0","@types/tar-fs":"1.16.1",vitest:"4.1.10"},dependencies:{"@vercel/build-utils":"workspace:*","@vercel/error-utils":"workspace:*","@vercel/microfrontends":"2.4.0","@vercel/routing-utils":"workspace:*","async-retry":"1.2.3","async-sema":"3.0.0","fs-extra":"8.0.1",ignore:"4.0.6",minimatch:"5.0.1",ms:"2.1.2",querystring:"^0.2.0","sleep-promise":"8.0.1","tar-fs":"1.16.3"}}}});var require_pkg=__commonJS({"../client/dist/pkg.js"(exports,module){"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),pkg_exports={};__export(pkg_exports,{pkgVersion:()=>pkgVersion});module.exports=__toCommonJS(pkg_exports);var pkg=require_package(),pkgVersion=pkg.version}});var require_readdir_recursive=__commonJS({"../client/dist/utils/readdir-recursive.js"(exports,module){"use strict";var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toESM2=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),readdir_recursive_exports={};__export(readdir_recursive_exports,{default:()=>readdir});module.exports=__toCommonJS(readdir_recursive_exports);var import_fs=__toESM2(__require("fs")),import_path2=__toESM2(__require("path")),import_minimatch=__toESM2(require_minimatch());function patternMatcher(pattern){return function(path,stats){let minimatcher=new import_minimatch.default.Minimatch(pattern,{matchBase:!0});return(!minimatcher.negate||stats.isFile())&&minimatcher.match(path)}}function toMatcherFunction(ignoreEntry){return typeof ignoreEntry=="function"?ignoreEntry:patternMatcher(ignoreEntry)}function readdir(path,ignores){ignores=ignores.map(toMatcherFunction);let list=[];return new Promise(function(resolve,reject){import_fs.default.readdir(path,function(err,files){if(err)return reject(err);let pending=files.length;if(!pending)return resolve(list);files.forEach(function(file){let filePath=import_path2.default.join(path,file);import_fs.default.lstat(filePath,function(_err,stats){if(_err)return reject(_err);if(ignores.some(matcher=>matcher(filePath,stats)))return pending-=1,pending?null:resolve(list);if(stats.isDirectory())readdir(filePath,ignores).then(function(res){if(res.length===0&&list.push(filePath),list=list.concat(res),pending-=1,!pending)return resolve(list)}).catch(reject);else if(list.push(filePath),pending-=1,!pending)return resolve(list)})})})})}}});var require_utils=__commonJS({"../client/dist/utils/index.js"(exports,module){"use strict";var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toESM2=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),utils_exports={};__export(utils_exports,{API_FILES:()=>API_FILES,EVENTS:()=>EVENTS,buildFileTree:()=>buildFileTree2,createDebug:()=>createDebug,fetchApi:()=>fetchApi,getApiDeploymentsUrl:()=>getApiDeploymentsUrl,getVercelIgnore:()=>getVercelIgnore2,parseVercelConfig:()=>parseVercelConfig,prepareFiles:()=>prepareFiles,shouldInlineStaticFiles:()=>shouldInlineStaticFiles});module.exports=__toCommonJS(utils_exports);var import_path2=__require("path"),import_stream=__require("stream"),import_url=__require("url"),import_ignore=__toESM2(require_ignore()),import_pkg=require_pkg(),import_build_utils=__require("@vercel/build-utils"),import_async_sema=require_lib3(),import_fs_extra2=require_lib2(),import_readdir_recursive=__toESM2(require_readdir_recursive()),semaphore=new import_async_sema.Sema(10),API_FILES="/v2/files",EVENTS_ARRAY=["hashes-calculated","file-count","file-uploaded","all-files-uploaded","created","building","ready","alias-assigned","warning","error","notice","tip","canceled","checks-registered","checks-completed","checks-running","checks-conclusion-succeeded","checks-conclusion-failed","checks-conclusion-skipped","checks-conclusion-canceled","checks-v2-failed"],EVENTS=new Set(EVENTS_ARRAY);function getApiDeploymentsUrl(){return"/v13/deployments"}async function parseVercelConfig(filePath){if(!filePath)return{};try{let jsonString=await(0,import_fs_extra2.readFile)(filePath,"utf8");return JSON.parse(jsonString)}catch(e){return console.error(e),{}}}var maybeRead=async function(path,default_){try{return await(0,import_fs_extra2.readFile)(path,"utf8")}catch{return default_}};async function getUserIgnore(cwd){let[vercelignore,nowignore]=await Promise.all([maybeRead((0,import_path2.join)(cwd,".vercelignore"),""),maybeRead((0,import_path2.join)(cwd,".nowignore"),"")]);if(vercelignore&&nowignore)throw new import_build_utils.NowBuildError({code:"CONFLICTING_IGNORE_FILES",message:"Cannot use both a `.vercelignore` and `.nowignore` file. Please delete the `.nowignore` file.",link:"https://vercel.link/combining-old-and-new-config"});let ignoreFile=vercelignore||nowignore;return ignoreFile?{ig:(0,import_ignore.default)().add(clearRelative(ignoreFile)),ignoreFileName:vercelignore?".vercelignore":".nowignore"}:null}var FILEPATHMAP_VERCELIGNORE_EXCEPTIONS=["node_modules",".next",".yarn/cache",".pnp*",".venv","venv","__pycache__","/target"],filePathMapVercelignoreExceptions=(0,import_ignore.default)().add(FILEPATHMAP_VERCELIGNORE_EXCEPTIONS.join(`
|
|
13
13
|
`));function isFilePathMapIgnoreException(posixRel){return filePathMapVercelignoreExceptions.ignores(posixRel)}var FILEPATHMAP_IGNORE_ERROR_LIST_LIMIT=20;function formatFilePathMapIgnoreWarning(entries,ignoreFileName,truncated=!1){let shown=entries.slice(0,FILEPATHMAP_IGNORE_ERROR_LIST_LIMIT),lines=shown.map(path=>` ${path}`);truncated&&lines.push(" \u2026and more");let count=truncated?`at least ${shown.length}`:String(entries.length),fileWord=!truncated&&entries.length===1?"file":"files";return[`${ignoreFileName===".nowignore"?`\`${ignoreFileName}\` (deprecated)`:`\`${ignoreFileName}\``} excludes ${count} ${fileWord} the prebuilt functions need. An upcoming CLI release will fail this deploy instead of uploading without them.`,"",...lines,"",`Remove the colliding rules from \`${ignoreFileName}\`, or exclude those paths from tracing with \`outputFileTracingExcludes\`.`].join(`
|
|
14
14
|
`)}async function buildFileTree2(path,{isDirectory,prebuilt,vercelOutputDir,rootDirectory,projectName,bulkRedirectsPath},debug){let ignoreList=[],fileList,warning,{ig,ignores}=await getVercelIgnore2(path,prebuilt,vercelOutputDir);if(debug(`Found ${ignores.length} rules in .vercelignore`),debug("Building file tree..."),isDirectory&&!Array.isArray(path)){let ignores2=absPath=>{let rel=(0,import_path2.relative)(path,absPath),ignored=ig.ignores(rel);return ignored&&ignoreList.push(rel),ignored};fileList=await(0,import_readdir_recursive.default)(path,[ignores2]);let refs=new Set;if(prebuilt){let vcConfigFilePaths=fileList.filter(file=>(0,import_path2.basename)(file)===".vc-config.json"),userIg=await getUserIgnore(path),ignoredFilePathMap=new Set,ignoredFilePathMapTruncated=!1,vcConfigs=await Promise.all(vcConfigFilePaths.map(async p=>{let configJson=await(0,import_fs_extra2.readFile)(p,"utf8");return JSON.parse(configJson)}));for(let config of vcConfigs)if(config.filePathMap)for(let v of Object.values(config.filePathMap)){let absPath=(0,import_path2.join)(path,v),rel=(0,import_path2.relative)(path,absPath),posixRel=rel.split(import_path2.sep).join("/");if(rel.startsWith("..")||(0,import_path2.isAbsolute)(rel)){debug(`Ignoring "filePathMap" entry "${v}": resolves outside the deployment root`);continue}if(userIg&&userIg.ig.ignores(posixRel))if(isFilePathMapIgnoreException(posixRel))debug(`Keeping "filePathMap" entry "${v}": matches a default-ignored dependency/output path`);else{if(ignoredFilePathMap.has(posixRel))continue;if(fileList.includes(absPath)){debug(`Skipping "filePathMap" entry "${v}": already in the upload set`);continue}else if(ignoredFilePathMap.size>=FILEPATHMAP_IGNORE_ERROR_LIST_LIMIT){ignoredFilePathMapTruncated=!0;continue}else{ignoredFilePathMap.add(posixRel);continue}}refs.add(absPath)}ignoredFilePathMap.size>0&&(warning=formatFilePathMapIgnoreWarning([...ignoredFilePathMap].sort((a,b)=>a.localeCompare(b)),userIg?.ignoreFileName||".vercelignore",ignoredFilePathMapTruncated));try{let{findConfig:findMicrofrontendsConfig,inferMicrofrontendsLocation}=await import("./utils-5BFO5HC4.js"),customConfigFilename=void 0,microfrontendConfigPath=findMicrofrontendsConfig({dir:(0,import_path2.join)(path,rootDirectory||""),customConfigFilename});!microfrontendConfigPath&&!rootDirectory&&projectName&&(microfrontendConfigPath=findMicrofrontendsConfig({dir:inferMicrofrontendsLocation({repositoryRoot:path,applicationContext:{name:projectName},customConfigFilename}),customConfigFilename})),microfrontendConfigPath&&refs.add(microfrontendConfigPath)}catch(e){debug(`Error detecting microfrontend config: ${e}`)}}try{let routesJsonPath=(0,import_path2.join)(path,".vercel","routes.json");await maybeRead(routesJsonPath,null)!==null&&(refs.add(routesJsonPath),debug("Including .vercel/routes.json in deployment"))}catch(e){debug(`Error checking for .vercel/routes.json: ${e}`)}if(prebuilt&&bulkRedirectsPath)try{let projectRoot=path,bulkRedirectsFullPath=(0,import_path2.join)(projectRoot,rootDirectory||"",bulkRedirectsPath);if((0,import_path2.relative)(projectRoot,bulkRedirectsFullPath).startsWith(".."))debug(`Skipping bulk redirects path "${bulkRedirectsPath}" - path traversal detected (resolves outside project root)`);else try{let stats=await(0,import_fs_extra2.stat)(bulkRedirectsFullPath);if(stats.isDirectory()){let dirFiles=await(0,import_readdir_recursive.default)(bulkRedirectsFullPath,[]);for(let file of dirFiles)refs.add(file);debug(`Including ${dirFiles.length} files from bulk redirects directory "${bulkRedirectsPath}" in deployment`)}else stats.isFile()&&(refs.add(bulkRedirectsFullPath),debug(`Including bulk redirects file "${bulkRedirectsPath}" in deployment`))}catch{debug(`Bulk redirects path "${bulkRedirectsPath}" not found`)}}catch(e){debug(`Error checking for bulk redirects path: ${e}`)}refs.size>0&&(fileList=fileList.concat(Array.from(refs))),debug(`Found ${fileList.length} files in the specified directory`)}else Array.isArray(path)?(fileList=path,debug(`Assigned ${fileList.length} files provided explicitly`)):(fileList=[path],debug("Deploying the provided path as single file"));return{fileList,ignoreList,warning}}async function getVercelIgnore2(cwd,prebuilt,vercelOutputDir){let ig=(0,import_ignore.default)(),ignores;if(prebuilt){if(typeof vercelOutputDir!="string")throw new Error('Missing required `vercelOutputDir` parameter when "prebuilt" is true');if(typeof cwd!="string")throw new Error('`cwd` must be a "string"');let relOutputDir=(0,import_path2.relative)(cwd,vercelOutputDir);ignores=["*"];let parts=relOutputDir.split(import_path2.sep);parts.forEach((_,i)=>{let level=parts.slice(0,i+1).join("/");ignores.push(`!/${level}`)}),ignores.push(`!/${parts.join("/")}/**`),ig.add(ignores.join(`
|
|
15
15
|
`))}else{ignores=[".hg",".git",".gitmodules",".svn",".cache",".next",".now",".vercel",".npmignore",".dockerignore",".gitignore",".*.swp",".DS_Store",".wafpicke-*",".lock-wscript",".env.local",".env.*.local",".venv",".yarn/cache",".pnp*","npm-debug.log","config.gypi","node_modules","__pycache__","venv","CVS"];let cwds=Array.isArray(cwd)?cwd:[cwd],files=await Promise.all(cwds.map(async cwd2=>{let[vercelignore,nowignore]=await Promise.all([maybeRead((0,import_path2.join)(cwd2,".vercelignore"),""),maybeRead((0,import_path2.join)(cwd2,".nowignore"),"")]);if(vercelignore&&nowignore)throw new import_build_utils.NowBuildError({code:"CONFLICTING_IGNORE_FILES",message:"Cannot use both a `.vercelignore` and `.nowignore` file. Please delete the `.nowignore` file.",link:"https://vercel.link/combining-old-and-new-config"});return vercelignore||nowignore}));(await Promise.all(cwds.map(cwd2=>(0,import_fs_extra2.pathExists)((0,import_path2.join)(cwd2,"Cargo.toml"))))).some(Boolean)&&ignores.push("/target");let ignoreFile=files.join(`
|
|
@@ -4,5 +4,5 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{login}from"./chunk-H4FTGLWV.js";import{loginCommand}from"./chunk-JKTQV2QJ.js";import{help}from"./chunk-
|
|
7
|
+
import{login}from"./chunk-H4FTGLWV.js";import{loginCommand}from"./chunk-JKTQV2QJ.js";import{help}from"./chunk-5U25FWD5.js";import{TelemetryClient}from"./chunk-A5VLP25I.js";import{printError}from"./chunk-N5AIKGEO.js";import{parseArguments}from"./chunk-WWB66KP5.js";import{getFlagsSpecification}from"./chunk-JAJW3P42.js";import{output_manager_default}from"./chunk-EWWFNMPZ.js";import{require_source}from"./chunk-U7KCDTCH.js";import{__toESM}from"./chunk-6L236MNA.js";var import_chalk=__toESM(require_source(),1);var LoginTelemetryClient=class extends TelemetryClient{trackState(...args){this.trackLoginState(...args)}};async function login2(client,options){let parsedArgs=null,flagsSpecification=getFlagsSpecification(loginCommand.options),telemetry=new LoginTelemetryClient({opts:{store:client.telemetryEventStore}});try{options.shouldParseArgs&&(parsedArgs=parseArguments(client.argv.slice(2),flagsSpecification))}catch(error){return printError(error),1}if(parsedArgs?.flags["--help"])return telemetry.trackCliFlagHelp("login"),output_manager_default.print(help(loginCommand,{columns:client.stderr.columns})),0;if(parsedArgs?.flags["--token"])return output_manager_default.error('`--token` may not be used with the "login" command'),2;if(options.shouldParseArgs&&parsedArgs){let obsoleteFlags=Object.keys(parsedArgs.flags).filter(flag=>{let flagKey=flag.replace("--",""),option=loginCommand.options.find(o=>o.name===flagKey);if(!(!option||typeof option=="number"))return"deprecated"in option&&option.deprecated});if(obsoleteFlags.length){let flags=obsoleteFlags.map(f=>import_chalk.default.bold(f)).join(", ");output_manager_default.warn(`The following flags are deprecated: ${flags}`)}let obsoleteArguments=parsedArgs.args.slice(1);if(obsoleteArguments.length){let args=obsoleteArguments.map(a=>import_chalk.default.bold(a)).join(", ");output_manager_default.warn(`The following arguments are deprecated: ${args}`)}(obsoleteArguments.length||obsoleteFlags.length)&&output_manager_default.print(`Read more in our ${output_manager_default.link("changelog","https://vercel.com/changelog/new-vercel-cli-login-flow")}.
|
|
8
8
|
`)}return telemetry.trackState("started"),await login(client,telemetry,options.shouldParseArgs)}export{login2 as login};
|
|
@@ -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{humanReadableColumnLabel}from"./chunk-GHAY4PSD.js";import{FETCH_TIMEOUT_MS,OpenApiCache,SSO_API_URL,assertAllowedSpecUrl,readSpecResponse}from"./chunk-AP36GAOG.js";import{require_ms}from"./chunk-QTKJC2O5.js";import{validateJsonOutput}from"./chunk-D4MW3RDW.js";import{apiCommand,listSubcommand}from"./chunk-CVKB54WW.js";import{help}from"./chunk-V6IKQCOT.js";import{table}from"./chunk-6TAQ6OWD.js";import{TelemetryClient}from"./chunk-A5VLP25I.js";import{printError}from"./chunk-N5AIKGEO.js";import{parseArguments}from"./chunk-WWB66KP5.js";import{getFlagsSpecification}from"./chunk-JAJW3P42.js";import{packageName}from"./chunk-FI772UVH.js";import{output_manager_default}from"./chunk-EWWFNMPZ.js";import{require_source}from"./chunk-U7KCDTCH.js";import{__toESM}from"./chunk-6L236MNA.js";import{createHash}from"crypto";var MAX_REDIRECTS=3;async function fetchSpecUrl(client,specUrl){let specOrigin=assertAllowedSpecUrl(specUrl).origin,probe=await fetchWithTimeout(specUrl,{readSpec:!0});if(probe.response.ok)return probe.spec??null;let nonce=getSetCookieValue(probe.response,"_vercel_sso_nonce");if(!nonce)throw output_manager_default.debug(`OpenAPI spec URL returned ${probe.response.status} without a Vercel SSO nonce`),new Error(formatHttpError(specUrl,probe.response));let token=client.authConfig.token;if(!token)return output_manager_default.debug("OpenAPI spec URL requires Vercel authentication"),null;let hashedNonce=createHash("sha256").update(nonce).digest("hex"),ssoUrl=`${SSO_API_URL}?url=${encodeURIComponent(specUrl)}&nonce=${hashedNonce}`,sso=await fetchWithTimeout(ssoUrl,{cookie:`authorization=${encodeURIComponent(`Bearer ${token}`)}; isLoggedIn=1`}),location=sso.response.headers.get("location");if(!location||!location.includes("_vercel_jwt="))throw output_manager_default.debug("OpenAPI spec URL: user has no access"),new Error(formatHttpError(specUrl,sso.response));let cookies=new Map([["_vercel_sso_nonce",nonce]]),url=location;for(let i=0;i<=MAX_REDIRECTS;i++){if(!isSameOriginUrl(url,specOrigin))return output_manager_default.debug("OpenAPI spec URL: cross-origin redirect rejected"),null;let{response,spec}=await fetchWithTimeout(url,{cookie:Array.from(cookies,([name,value])=>`${name}=${value}`).join("; "),readSpec:!0});if(response.ok)return spec??null;let next=response.headers.get("location");if(response.status>=300&&response.status<400&&next){let setJwt=getSetCookieValue(response,"_vercel_jwt");setJwt&&cookies.set("_vercel_jwt",setJwt);let nextUrl=new URL(next,url).href;if(!isSameOriginUrl(nextUrl,specOrigin))return output_manager_default.debug("OpenAPI spec URL: cross-origin redirect rejected"),null;url=nextUrl;continue}throw output_manager_default.debug(`OpenAPI spec URL: unexpected response ${response.status}`),new Error(formatHttpError(url,response))}return output_manager_default.debug("OpenAPI spec URL: too many redirects"),null}function createOpenApiCache(client,specUrl){return new OpenApiCache(specUrl?{specUrl,fetchSpecUrl:url=>fetchSpecUrl(client,url)}:void 0)}async function fetchWithTimeout(url,options){let controller=new AbortController,timeoutId=setTimeout(()=>controller.abort(),1e4);try{let response=await fetch(url,{redirect:"manual",signal:controller.signal,headers:options?.cookie?{cookie:options.cookie}:void 0}),spec=options?.readSpec&&response.ok?await readSpecResponse(response,formatDiagnosticUrl(url)):void 0;return{response,spec}}finally{clearTimeout(timeoutId)}}function isSameOriginUrl(url,origin){try{return new URL(url).origin===origin}catch{return!1}}function formatHttpError(url,response){let statusText=response.statusText?` ${response.statusText}`:"";return`Could not load OpenAPI spec from ${formatDiagnosticUrl(url)}: HTTP ${response.status}${statusText}.`}function formatDiagnosticUrl(url){try{let parsed=new URL(url);parsed.hash="";for(let key of parsed.searchParams.keys())parsed.searchParams.set(key,"[redacted]");return parsed.href}catch{return url}}function getSetCookieValue(response,name){let header=response.headers.get("set-cookie");if(!header)return null;let match=header.match(new RegExp(`${name}=([^;,\\s]+)`));return match?match[1]:null}function foldNamingStyle(input){return input.trim().replace(/([a-z\d])([A-Z])/g,"$1 $2").replace(/([A-Z])([A-Z][a-z])/g,"$1 $2").replace(/[-_\s]+/g," ").trim().toLowerCase().replace(/\s+/g,"")}function operationIdToKebabCase(operationId){let s=operationId.trim();return s?s.replace(/([a-z\d])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").replace(/[-_\s]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase():"unnamed"}function inferCliSubcommandAliases(ep){let upper=ep.method.toUpperCase(),hasPathParams=ep.parameters.some(p=>p.in==="path");switch(upper){case"GET":return hasPathParams?["inspect","get"]:["ls","list"];case"POST":return["add","create"];case"DELETE":return["rm","remove"];case"PUT":case"PATCH":return["update"];default:return[]}}var import_ms=__toESM(require_ms(),1),import_chalk=__toESM(require_source(),1);function getByPath(obj,path){let parts=path.split(".").filter(Boolean),cur=obj;for(let p of parts){if(cur===null||typeof cur!="object")return;cur=cur[p]}return cur}var TIMESTAMP_FIELD_PATTERN=/(?:^|\.)(created|updated|deleted|expired|blocked|completed|started|finished|modified|verified|published|cancelled|revoked|invited|accepted|accessed|deployed)(?:At|_at|On|_on)?$/i,MIN_TIMESTAMP_MS=1e12,MAX_TIMESTAMP_MS=41024448e5;function isTimestampValue(value,columnPath){return typeof value!="number"||!Number.isFinite(value)||value<MIN_TIMESTAMP_MS||value>MAX_TIMESTAMP_MS?!1:TIMESTAMP_FIELD_PATTERN.test(columnPath)}function formatRelativeTime(timestamp){let diff=Date.now()-timestamp;return diff<0?"just now":import_chalk.default.gray((0,import_ms.default)(diff))}function stringifyCell(value,columnPath){return value==null?import_chalk.default.gray("--"):columnPath&&isTimestampValue(value,columnPath)?formatRelativeTime(value):typeof value=="object"?JSON.stringify(value):String(value)}function styleColumnKey(plainLabel){return import_chalk.default.gray(plainLabel)}function columnsForRow(r,display){return r.limited===!0&&display.columnsWhenLimited?.length?display.columnsWhenLimited:display.columnsDefault}function formatAsCard(r,display){let columns=columnsForRow(r,display);if(!columns.length)return null;let rows=columns.map(colPath=>[styleColumnKey(humanReadableColumnLabel(colPath)),stringifyCell(getByPath(r,colPath),colPath)]);return table(rows,{align:["l","l"],hsep:2})}function formatAsDataTable(items,display){if(items.length===0)return"(empty)";let first=items[0];if(first===null||typeof first!="object"||Array.isArray(first)){let headers2=[styleColumnKey(humanReadableColumnLabel("#")),styleColumnKey(humanReadableColumnLabel("value"))],rows=items.map((v,i)=>[String(i),stringifyCell(v,"value")]);return table([headers2,...rows])}let columns=columnsForRow(first,display);if(!columns.length)return null;let headers=columns.map(p=>styleColumnKey(humanReadableColumnLabel(p))),dataRows=items.map(item=>{let row=item!==null&&typeof item=="object"&&!Array.isArray(item)?item:{};return columns.map(colPath=>stringifyCell(getByPath(row,colPath),colPath))});return table([headers,...dataRows])}function resolveEndpointByTagAndOperationId(endpoints,tag,operationHint){let tagLower=tag.toLowerCase(),tagMatches=endpoints.filter(ep=>ep.tags.some(t=>t.toLowerCase()===tagLower));if(tagMatches.length===0)return{ok:!1,reason:"no_tag",tag,tagMatches:[],operationHint};let withOpId=tagMatches.filter(ep=>ep.operationId.length>0);if(withOpId.length===0)return{ok:!1,reason:"no_operation",tag,tagMatches,operationHint};let hint=operationHint.trim(),hintLower=hint.toLowerCase(),exact=withOpId.filter(ep=>ep.operationId===hint);if(exact.length===1)return{ok:!0,endpoint:exact[0]};if(exact.length>1)return{ok:!1,reason:"ambiguous_operation",tag,tagMatches:exact,operationHint:hint};let exactCi=withOpId.filter(ep=>ep.operationId.toLowerCase()===hintLower);return exactCi.length===1?{ok:!0,endpoint:exactCi[0]}:exactCi.length>1?{ok:!1,reason:"ambiguous_operation",tag,tagMatches:exactCi,operationHint:hint}:{ok:!1,reason:"no_operation",tag,tagMatches,operationHint:hint}}var import_chalk4=__toESM(require_source(),1);var ApiTelemetryClient=class extends TelemetryClient{trackCliArgumentEndpoint(endpoint){if(endpoint){let normalized=this.normalizeEndpoint(endpoint);this.trackCliArgument({arg:"endpoint",value:normalized})}}trackCliArgumentOperationId(operationId){operationId&&this.trackCliArgument({arg:"operationId",value:operationId})}trackCliOptionMethod(method){if(method){let validMethods=["GET","POST","PUT","DELETE","PATCH","HEAD"],upperMethod=method.toUpperCase(),value=validMethods.includes(upperMethod)?upperMethod:this.redactedValue;this.trackCliOption({option:"method",value})}}trackCliOptionField(fields){fields&&fields.length>0&&this.trackCliOption({option:"field",value:this.redactedArgumentsLength(fields)})}trackCliOptionRawField(fields){fields&&fields.length>0&&this.trackCliOption({option:"raw-field",value:this.redactedArgumentsLength(fields)})}trackCliOptionHeader(headers){headers&&headers.length>0&&this.trackCliOption({option:"header",value:this.redactedArgumentsLength(headers)})}trackCliOptionInput(input){if(input){let value=input==="-"?"stdin":"file";this.trackCliOption({option:"input",value})}}trackCliOptionSpecUrl(specUrl){specUrl&&this.trackCliOption({option:"spec-url",value:this.redactedValue})}trackCliFlagPaginate(value){value&&this.trackCliFlag("paginate")}trackCliFlagInclude(value){value&&this.trackCliFlag("include")}trackCliFlagSilent(value){value&&this.trackCliFlag("silent")}trackCliFlagVerbose(value){value&&this.trackCliFlag("verbose")}trackCliFlagRaw(value){value&&this.trackCliFlag("raw")}trackCliFlagRefresh(value){value&&this.trackCliFlag("refresh")}trackCliOptionGenerate(format){if(format){let value=["curl"].includes(format)?format:this.redactedValue;this.trackCliOption({option:"generate",value})}}trackCliFlagDangerouslySkipPermissions(value){value&&this.trackCliFlag("dangerously-skip-permissions")}trackCliSubcommandList(){this.trackCliSubcommand({subcommand:"list",value:"list"})}trackCliOptionFormat(format){if(format){let value=["table","json"].includes(format)?format:this.redactedValue;this.trackCliOption({option:"format",value})}}trackCliFlagJson(json){json&&this.trackCliFlag("json")}normalizeEndpoint(endpoint){return endpoint.replace(/\/dpl_[a-zA-Z0-9]+/g,"/:deploymentId").replace(/\/prj_[a-zA-Z0-9]+/g,"/:projectId").replace(/\/team_[a-zA-Z0-9]+/g,"/:teamId").replace(/\/[a-f0-9]{24}/g,"/:id").replace(/\/[a-f0-9-]{36}/g,"/:uuid")}};import{readFile}from"fs/promises";import{resolve}from"path";async function buildRequest(endpoint,flags){let headers={},body,customHeaders=flags["--header"]||[];for(let header of customHeaders){let colonIndex=header.indexOf(":");if(colonIndex>0){let key=header.substring(0,colonIndex).trim(),value=header.substring(colonIndex+1).trim();headers[key]=value}}let fields=flags["--field"]||[],rawFields=flags["--raw-field"]||[];if(fields.length>0||rawFields.length>0){body={};for(let field of fields){let{key,value}=await parseField(field,!0);body[key]=value}for(let field of rawFields){let{key,value}=await parseField(field,!1);body[key]=value}}if(flags["--input"]){let inputPath=flags["--input"];if(inputPath==="-"?body=await readStdin():body=await readFile(resolve(inputPath),"utf-8"),typeof body=="string")try{body=JSON.parse(body)}catch{}}let method=flags["--method"]?.toUpperCase()||"GET";return!flags["--method"]&&body&&(method="POST"),{url:endpoint,method,headers,body}}async function parseCliKeyValueField(field,typed){return parseField(field,typed)}async function parseField(field,typed){let eqIndex=field.indexOf("=");if(eqIndex===-1)throw new Error(`Invalid field format: ${field}. Expected key=value`);let key=field.substring(0,eqIndex),value=field.substring(eqIndex+1);if(typed&&typeof value=="string"){if(value.startsWith("@")){let filePath=value.substring(1);if(filePath==="-"?value=await readStdin():value=await readFile(resolve(filePath),"utf-8"),typeof value=="string")try{value=JSON.parse(value)}catch{}}else if(value==="true")value=!0;else if(value==="false")value=!1;else if(value==="null")value=null;else if(/^-?\d+$/.test(value))value=parseInt(value,10);else if(/^-?\d*\.\d+$/.test(value))value=parseFloat(value);else if(value.startsWith("[")||value.startsWith("{"))try{value=JSON.parse(value)}catch{}}return{key,value}}async function readStdin(){let chunks=[];for await(let chunk of process.stdin)chunks.push(Buffer.from(chunk));return Buffer.concat(chunks).toString("utf-8")}function formatOutput(data,options){return options.raw?typeof data=="string"?data:JSON.stringify(data):JSON.stringify(data,null,2)}function generateCurlCommand(config,baseUrl){let parts=["curl"];config.method!=="GET"&&parts.push(`-X ${config.method}`),parts.push("-H 'Authorization: Bearer <TOKEN>'");for(let[key,value]of Object.entries(config.headers))parts.push(`-H '${key}: ${escapeShellArg(value)}'`);if(config.method!=="GET"&&config.body){let bodyStr=typeof config.body=="string"?config.body:JSON.stringify(config.body);parts.push("-H 'Content-Type: application/json'"),parts.push(`-d '${escapeShellArg(bodyStr)}'`)}let fullUrl=`${baseUrl}${config.url}`;return parts.push(`'${fullUrl}'`),parts.join(` \\
|
|
7
|
+
import{humanReadableColumnLabel}from"./chunk-GHAY4PSD.js";import{FETCH_TIMEOUT_MS,OpenApiCache,SSO_API_URL,assertAllowedSpecUrl,readSpecResponse}from"./chunk-AP36GAOG.js";import{require_ms}from"./chunk-QTKJC2O5.js";import{validateJsonOutput}from"./chunk-D4MW3RDW.js";import{apiCommand,listSubcommand}from"./chunk-CVKB54WW.js";import{help}from"./chunk-5U25FWD5.js";import{table}from"./chunk-6TAQ6OWD.js";import{TelemetryClient}from"./chunk-A5VLP25I.js";import{printError}from"./chunk-N5AIKGEO.js";import{parseArguments}from"./chunk-WWB66KP5.js";import{getFlagsSpecification}from"./chunk-JAJW3P42.js";import{packageName}from"./chunk-FI772UVH.js";import{output_manager_default}from"./chunk-EWWFNMPZ.js";import{require_source}from"./chunk-U7KCDTCH.js";import{__toESM}from"./chunk-6L236MNA.js";import{createHash}from"crypto";var MAX_REDIRECTS=3;async function fetchSpecUrl(client,specUrl){let specOrigin=assertAllowedSpecUrl(specUrl).origin,probe=await fetchWithTimeout(specUrl,{readSpec:!0});if(probe.response.ok)return probe.spec??null;let nonce=getSetCookieValue(probe.response,"_vercel_sso_nonce");if(!nonce)throw output_manager_default.debug(`OpenAPI spec URL returned ${probe.response.status} without a Vercel SSO nonce`),new Error(formatHttpError(specUrl,probe.response));let token=client.authConfig.token;if(!token)return output_manager_default.debug("OpenAPI spec URL requires Vercel authentication"),null;let hashedNonce=createHash("sha256").update(nonce).digest("hex"),ssoUrl=`${SSO_API_URL}?url=${encodeURIComponent(specUrl)}&nonce=${hashedNonce}`,sso=await fetchWithTimeout(ssoUrl,{cookie:`authorization=${encodeURIComponent(`Bearer ${token}`)}; isLoggedIn=1`}),location=sso.response.headers.get("location");if(!location||!location.includes("_vercel_jwt="))throw output_manager_default.debug("OpenAPI spec URL: user has no access"),new Error(formatHttpError(specUrl,sso.response));let cookies=new Map([["_vercel_sso_nonce",nonce]]),url=location;for(let i=0;i<=MAX_REDIRECTS;i++){if(!isSameOriginUrl(url,specOrigin))return output_manager_default.debug("OpenAPI spec URL: cross-origin redirect rejected"),null;let{response,spec}=await fetchWithTimeout(url,{cookie:Array.from(cookies,([name,value])=>`${name}=${value}`).join("; "),readSpec:!0});if(response.ok)return spec??null;let next=response.headers.get("location");if(response.status>=300&&response.status<400&&next){let setJwt=getSetCookieValue(response,"_vercel_jwt");setJwt&&cookies.set("_vercel_jwt",setJwt);let nextUrl=new URL(next,url).href;if(!isSameOriginUrl(nextUrl,specOrigin))return output_manager_default.debug("OpenAPI spec URL: cross-origin redirect rejected"),null;url=nextUrl;continue}throw output_manager_default.debug(`OpenAPI spec URL: unexpected response ${response.status}`),new Error(formatHttpError(url,response))}return output_manager_default.debug("OpenAPI spec URL: too many redirects"),null}function createOpenApiCache(client,specUrl){return new OpenApiCache(specUrl?{specUrl,fetchSpecUrl:url=>fetchSpecUrl(client,url)}:void 0)}async function fetchWithTimeout(url,options){let controller=new AbortController,timeoutId=setTimeout(()=>controller.abort(),1e4);try{let response=await fetch(url,{redirect:"manual",signal:controller.signal,headers:options?.cookie?{cookie:options.cookie}:void 0}),spec=options?.readSpec&&response.ok?await readSpecResponse(response,formatDiagnosticUrl(url)):void 0;return{response,spec}}finally{clearTimeout(timeoutId)}}function isSameOriginUrl(url,origin){try{return new URL(url).origin===origin}catch{return!1}}function formatHttpError(url,response){let statusText=response.statusText?` ${response.statusText}`:"";return`Could not load OpenAPI spec from ${formatDiagnosticUrl(url)}: HTTP ${response.status}${statusText}.`}function formatDiagnosticUrl(url){try{let parsed=new URL(url);parsed.hash="";for(let key of parsed.searchParams.keys())parsed.searchParams.set(key,"[redacted]");return parsed.href}catch{return url}}function getSetCookieValue(response,name){let header=response.headers.get("set-cookie");if(!header)return null;let match=header.match(new RegExp(`${name}=([^;,\\s]+)`));return match?match[1]:null}function foldNamingStyle(input){return input.trim().replace(/([a-z\d])([A-Z])/g,"$1 $2").replace(/([A-Z])([A-Z][a-z])/g,"$1 $2").replace(/[-_\s]+/g," ").trim().toLowerCase().replace(/\s+/g,"")}function operationIdToKebabCase(operationId){let s=operationId.trim();return s?s.replace(/([a-z\d])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").replace(/[-_\s]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase():"unnamed"}function inferCliSubcommandAliases(ep){let upper=ep.method.toUpperCase(),hasPathParams=ep.parameters.some(p=>p.in==="path");switch(upper){case"GET":return hasPathParams?["inspect","get"]:["ls","list"];case"POST":return["add","create"];case"DELETE":return["rm","remove"];case"PUT":case"PATCH":return["update"];default:return[]}}var import_ms=__toESM(require_ms(),1),import_chalk=__toESM(require_source(),1);function getByPath(obj,path){let parts=path.split(".").filter(Boolean),cur=obj;for(let p of parts){if(cur===null||typeof cur!="object")return;cur=cur[p]}return cur}var TIMESTAMP_FIELD_PATTERN=/(?:^|\.)(created|updated|deleted|expired|blocked|completed|started|finished|modified|verified|published|cancelled|revoked|invited|accepted|accessed|deployed)(?:At|_at|On|_on)?$/i,MIN_TIMESTAMP_MS=1e12,MAX_TIMESTAMP_MS=41024448e5;function isTimestampValue(value,columnPath){return typeof value!="number"||!Number.isFinite(value)||value<MIN_TIMESTAMP_MS||value>MAX_TIMESTAMP_MS?!1:TIMESTAMP_FIELD_PATTERN.test(columnPath)}function formatRelativeTime(timestamp){let diff=Date.now()-timestamp;return diff<0?"just now":import_chalk.default.gray((0,import_ms.default)(diff))}function stringifyCell(value,columnPath){return value==null?import_chalk.default.gray("--"):columnPath&&isTimestampValue(value,columnPath)?formatRelativeTime(value):typeof value=="object"?JSON.stringify(value):String(value)}function styleColumnKey(plainLabel){return import_chalk.default.gray(plainLabel)}function columnsForRow(r,display){return r.limited===!0&&display.columnsWhenLimited?.length?display.columnsWhenLimited:display.columnsDefault}function formatAsCard(r,display){let columns=columnsForRow(r,display);if(!columns.length)return null;let rows=columns.map(colPath=>[styleColumnKey(humanReadableColumnLabel(colPath)),stringifyCell(getByPath(r,colPath),colPath)]);return table(rows,{align:["l","l"],hsep:2})}function formatAsDataTable(items,display){if(items.length===0)return"(empty)";let first=items[0];if(first===null||typeof first!="object"||Array.isArray(first)){let headers2=[styleColumnKey(humanReadableColumnLabel("#")),styleColumnKey(humanReadableColumnLabel("value"))],rows=items.map((v,i)=>[String(i),stringifyCell(v,"value")]);return table([headers2,...rows])}let columns=columnsForRow(first,display);if(!columns.length)return null;let headers=columns.map(p=>styleColumnKey(humanReadableColumnLabel(p))),dataRows=items.map(item=>{let row=item!==null&&typeof item=="object"&&!Array.isArray(item)?item:{};return columns.map(colPath=>stringifyCell(getByPath(row,colPath),colPath))});return table([headers,...dataRows])}function resolveEndpointByTagAndOperationId(endpoints,tag,operationHint){let tagLower=tag.toLowerCase(),tagMatches=endpoints.filter(ep=>ep.tags.some(t=>t.toLowerCase()===tagLower));if(tagMatches.length===0)return{ok:!1,reason:"no_tag",tag,tagMatches:[],operationHint};let withOpId=tagMatches.filter(ep=>ep.operationId.length>0);if(withOpId.length===0)return{ok:!1,reason:"no_operation",tag,tagMatches,operationHint};let hint=operationHint.trim(),hintLower=hint.toLowerCase(),exact=withOpId.filter(ep=>ep.operationId===hint);if(exact.length===1)return{ok:!0,endpoint:exact[0]};if(exact.length>1)return{ok:!1,reason:"ambiguous_operation",tag,tagMatches:exact,operationHint:hint};let exactCi=withOpId.filter(ep=>ep.operationId.toLowerCase()===hintLower);return exactCi.length===1?{ok:!0,endpoint:exactCi[0]}:exactCi.length>1?{ok:!1,reason:"ambiguous_operation",tag,tagMatches:exactCi,operationHint:hint}:{ok:!1,reason:"no_operation",tag,tagMatches,operationHint:hint}}var import_chalk4=__toESM(require_source(),1);var ApiTelemetryClient=class extends TelemetryClient{trackCliArgumentEndpoint(endpoint){if(endpoint){let normalized=this.normalizeEndpoint(endpoint);this.trackCliArgument({arg:"endpoint",value:normalized})}}trackCliArgumentOperationId(operationId){operationId&&this.trackCliArgument({arg:"operationId",value:operationId})}trackCliOptionMethod(method){if(method){let validMethods=["GET","POST","PUT","DELETE","PATCH","HEAD"],upperMethod=method.toUpperCase(),value=validMethods.includes(upperMethod)?upperMethod:this.redactedValue;this.trackCliOption({option:"method",value})}}trackCliOptionField(fields){fields&&fields.length>0&&this.trackCliOption({option:"field",value:this.redactedArgumentsLength(fields)})}trackCliOptionRawField(fields){fields&&fields.length>0&&this.trackCliOption({option:"raw-field",value:this.redactedArgumentsLength(fields)})}trackCliOptionHeader(headers){headers&&headers.length>0&&this.trackCliOption({option:"header",value:this.redactedArgumentsLength(headers)})}trackCliOptionInput(input){if(input){let value=input==="-"?"stdin":"file";this.trackCliOption({option:"input",value})}}trackCliOptionSpecUrl(specUrl){specUrl&&this.trackCliOption({option:"spec-url",value:this.redactedValue})}trackCliFlagPaginate(value){value&&this.trackCliFlag("paginate")}trackCliFlagInclude(value){value&&this.trackCliFlag("include")}trackCliFlagSilent(value){value&&this.trackCliFlag("silent")}trackCliFlagVerbose(value){value&&this.trackCliFlag("verbose")}trackCliFlagRaw(value){value&&this.trackCliFlag("raw")}trackCliFlagRefresh(value){value&&this.trackCliFlag("refresh")}trackCliOptionGenerate(format){if(format){let value=["curl"].includes(format)?format:this.redactedValue;this.trackCliOption({option:"generate",value})}}trackCliFlagDangerouslySkipPermissions(value){value&&this.trackCliFlag("dangerously-skip-permissions")}trackCliSubcommandList(){this.trackCliSubcommand({subcommand:"list",value:"list"})}trackCliOptionFormat(format){if(format){let value=["table","json"].includes(format)?format:this.redactedValue;this.trackCliOption({option:"format",value})}}trackCliFlagJson(json){json&&this.trackCliFlag("json")}normalizeEndpoint(endpoint){return endpoint.replace(/\/dpl_[a-zA-Z0-9]+/g,"/:deploymentId").replace(/\/prj_[a-zA-Z0-9]+/g,"/:projectId").replace(/\/team_[a-zA-Z0-9]+/g,"/:teamId").replace(/\/[a-f0-9]{24}/g,"/:id").replace(/\/[a-f0-9-]{36}/g,"/:uuid")}};import{readFile}from"fs/promises";import{resolve}from"path";async function buildRequest(endpoint,flags){let headers={},body,customHeaders=flags["--header"]||[];for(let header of customHeaders){let colonIndex=header.indexOf(":");if(colonIndex>0){let key=header.substring(0,colonIndex).trim(),value=header.substring(colonIndex+1).trim();headers[key]=value}}let fields=flags["--field"]||[],rawFields=flags["--raw-field"]||[];if(fields.length>0||rawFields.length>0){body={};for(let field of fields){let{key,value}=await parseField(field,!0);body[key]=value}for(let field of rawFields){let{key,value}=await parseField(field,!1);body[key]=value}}if(flags["--input"]){let inputPath=flags["--input"];if(inputPath==="-"?body=await readStdin():body=await readFile(resolve(inputPath),"utf-8"),typeof body=="string")try{body=JSON.parse(body)}catch{}}let method=flags["--method"]?.toUpperCase()||"GET";return!flags["--method"]&&body&&(method="POST"),{url:endpoint,method,headers,body}}async function parseCliKeyValueField(field,typed){return parseField(field,typed)}async function parseField(field,typed){let eqIndex=field.indexOf("=");if(eqIndex===-1)throw new Error(`Invalid field format: ${field}. Expected key=value`);let key=field.substring(0,eqIndex),value=field.substring(eqIndex+1);if(typed&&typeof value=="string"){if(value.startsWith("@")){let filePath=value.substring(1);if(filePath==="-"?value=await readStdin():value=await readFile(resolve(filePath),"utf-8"),typeof value=="string")try{value=JSON.parse(value)}catch{}}else if(value==="true")value=!0;else if(value==="false")value=!1;else if(value==="null")value=null;else if(/^-?\d+$/.test(value))value=parseInt(value,10);else if(/^-?\d*\.\d+$/.test(value))value=parseFloat(value);else if(value.startsWith("[")||value.startsWith("{"))try{value=JSON.parse(value)}catch{}}return{key,value}}async function readStdin(){let chunks=[];for await(let chunk of process.stdin)chunks.push(Buffer.from(chunk));return Buffer.concat(chunks).toString("utf-8")}function formatOutput(data,options){return options.raw?typeof data=="string"?data:JSON.stringify(data):JSON.stringify(data,null,2)}function generateCurlCommand(config,baseUrl){let parts=["curl"];config.method!=="GET"&&parts.push(`-X ${config.method}`),parts.push("-H 'Authorization: Bearer <TOKEN>'");for(let[key,value]of Object.entries(config.headers))parts.push(`-H '${key}: ${escapeShellArg(value)}'`);if(config.method!=="GET"&&config.body){let bodyStr=typeof config.body=="string"?config.body:JSON.stringify(config.body);parts.push("-H 'Content-Type: application/json'"),parts.push(`-d '${escapeShellArg(bodyStr)}'`)}let fullUrl=`${baseUrl}${config.url}`;return parts.push(`'${fullUrl}'`),parts.join(` \\
|
|
8
8
|
`)}function escapeShellArg(str){return str.replace(/'/g,"'\\''")}import{readFile as readFile2}from"fs/promises";import{resolve as resolve2}from"path";var GLOBAL_CLI_QUERY_PARAMS=new Set(["teamId","slug"]);async function parseOperationKeyValuePairs(endpoint,bodyFields,flags,positionalKeyValues){let pathParamNames=new Set(endpoint.parameters.filter(p=>p.in==="path").map(p=>p.name)),queryParamNames=new Set(endpoint.parameters.filter(p=>p.in==="query").map(p=>p.name)),headerParamNames=new Set(endpoint.parameters.filter(p=>p.in==="header").map(p=>p.name)),bodyFieldNames=new Set(bodyFields.map(f=>f.name)),pathValues={},queryValues={},headerValues={},body={};async function dispatchPair(field,typed){let eqIndex=field.indexOf("=");if(eqIndex===-1)throw new Error(`Invalid option "${field}". Expected key=value (or use flags -F / -f).`);let key=field.slice(0,eqIndex),param=endpoint.parameters.find(p=>p.name===key);if(param?.in==="path"){let{value}=await parseCliKeyValueField(field,!1);pathValues[key]=String(value);return}if(param?.in==="query"){let{value}=await parseCliKeyValueField(field,typed);queryValues[key]=typeof value=="object"&&value!==null?JSON.stringify(value):String(value);return}if(param?.in==="header"){let{value}=await parseCliKeyValueField(field,!1);headerValues[key]=String(value);return}if(param?.in==="cookie")throw new Error(`Option "${key}" is cookie-based; set it via headers instead.`);if(bodyFieldNames.has(key)){let{value}=await parseCliKeyValueField(field,typed);body[key]=value;return}if(!param&&pathParamNames.has(key)){let{value}=await parseCliKeyValueField(field,!1);pathValues[key]=String(value);return}if(!param&&queryParamNames.has(key)){let{value}=await parseCliKeyValueField(field,typed);queryValues[key]=typeof value=="object"&&value!==null?JSON.stringify(value):String(value);return}if(!param&&headerParamNames.has(key)){let{value}=await parseCliKeyValueField(field,!1);headerValues[key]=String(value);return}throw new Error(`Unknown option "${key}" for operation ${endpoint.operationId}. Check the API docs or run \`vercel api ls --json\`.`)}for(let field of flags["--field"]||[])await dispatchPair(field,!0);for(let field of flags["--raw-field"]||[])await dispatchPair(field,!1);for(let field of positionalKeyValues)await dispatchPair(field,!0);return{pathValues,queryValues,headerValues,body}}function getMissingRequiredOperationParams(endpoint,bodyFields,parsed,flags){let missingPath=endpoint.parameters.filter(p=>p.in==="path").filter(p=>parsed.pathValues[p.name]===void 0),missingQuery=endpoint.parameters.filter(p=>p.in==="query"&&p.required&&!GLOBAL_CLI_QUERY_PARAMS.has(p.name)).filter(p=>parsed.queryValues[p.name]===void 0),missingHeader=endpoint.parameters.filter(p=>p.in==="header"&&p.required).filter(p=>parsed.headerValues[p.name]===void 0),missingBody=bodyFields.filter(f=>f.required&&parsed.body[f.name]===void 0&&!flags["--input"]);return{path:missingPath,query:missingQuery,header:missingHeader,body:missingBody}}function getUnsetOptionalOperationParams(endpoint,bodyFields,parsed,flags){let unsetQuery=endpoint.parameters.filter(p=>p.in==="query"&&parsed.queryValues[p.name]===void 0&&(!p.required||GLOBAL_CLI_QUERY_PARAMS.has(p.name))),unsetHeader=endpoint.parameters.filter(p=>p.in==="header"&&!p.required&&parsed.headerValues[p.name]===void 0),unsetBody=bodyFields.filter(f=>!f.required&&parsed.body[f.name]===void 0&&!flags["--input"]);return{query:unsetQuery,header:unsetHeader,body:unsetBody}}async function buildRequestForResolvedOperation(endpoint,bodyFields,flags,positionalKeyValues){let headers={},customHeaders=flags["--header"]||[];for(let header of customHeaders){let colonIndex=header.indexOf(":");if(colonIndex>0){let key=header.substring(0,colonIndex).trim(),value=header.substring(colonIndex+1).trim();headers[key]=value}}let method=(flags["--method"]?.toUpperCase()||endpoint.method).toUpperCase(),pathParamNames=new Set(endpoint.parameters.filter(p=>p.in==="path").map(p=>p.name)),parsed=await parseOperationKeyValuePairs(endpoint,bodyFields,flags,positionalKeyValues),{pathValues,queryValues,headerValues,body}=parsed;for(let[k,v]of Object.entries(headerValues))headers[k]=v;let urlPath=endpoint.path;for(let name of pathParamNames){let value=pathValues[name];if(value===void 0)throw new Error(`Missing required path option {${name}} for ${endpoint.operationId}.`);urlPath=urlPath.replace(`{${name}}`,encodeURIComponent(value))}if(/\{[^}]+\}/.test(urlPath))throw new Error(`Unresolved path placeholders in ${urlPath}. Provide values for all path options.`);let requiredQuery=endpoint.parameters.filter(p=>p.in==="query"&&p.required&&!GLOBAL_CLI_QUERY_PARAMS.has(p.name));for(let p of requiredQuery)if(queryValues[p.name]===void 0)throw new Error(`Missing required query option "${p.name}" for ${endpoint.operationId}.`);let requiredHeader=endpoint.parameters.filter(h=>h.in==="header"&&h.required);for(let h of requiredHeader)if(headerValues[h.name]===void 0)throw new Error(`Missing required header option "${h.name}" for ${endpoint.operationId}.`);let requiredBody=bodyFields.filter(f=>f.required);for(let f of requiredBody)if(body[f.name]===void 0&&!flags["--input"])throw new Error(`Missing required body option "${f.name}" for ${endpoint.operationId}.`);let queryString=new URLSearchParams(queryValues).toString();queryString&&(urlPath+=(urlPath.includes("?")?"&":"?")+queryString);let finalBody=Object.keys(body).length>0?body:void 0;if(flags["--input"]){let inputPath=flags["--input"],inputBody;if(inputPath==="-"?inputBody=await readStdin():inputBody=await readFile2(resolve2(inputPath),"utf-8"),typeof inputBody=="string")try{finalBody=JSON.parse(inputBody)}catch{finalBody=inputBody}else finalBody=inputBody}return(method==="GET"||method==="HEAD")&&(finalBody=void 0),{url:urlPath,method,headers,body:finalBody}}var API_BASE_URL="https://api.vercel.com";var import_chalk2=__toESM(require_source(),1);function colorizeMethod(method){switch(method){case"GET":return import_chalk2.default.cyan(method);case"POST":return import_chalk2.default.green(method);case"PUT":return import_chalk2.default.yellow(method);case"PATCH":return import_chalk2.default.blue(method);case"DELETE":return import_chalk2.default.red(method);default:return method}}function colorizeMethodPadded(method,width=7){let colored=colorizeMethod(method),padding=" ".repeat(Math.max(0,width-method.length));return colored+padding}function formatPathParam(paramName){return import_chalk2.default.cyan(`{${paramName}}`)}function formatTypeHint(type){return import_chalk2.default.dim(`[${type}]`)}function formatDescription(description){return description?import_chalk2.default.gray(` (${description})`):""}var import_chalk3=__toESM(require_source(),1);function getByPath2(obj,path){let current=obj;for(let segment of path.split(".")){if(current==null||typeof current!="object")return;current=current[segment]}return current}function parseArrayColumns(data,columns){let entries=Object.entries(columns),first=entries[0];if(!first)return null;let bracketIdx=first[1].indexOf("[].");if(bracketIdx===-1)return null;let arrayKey=first[1].slice(0,bracketIdx),rowColumns={};for(let[label,path]of entries){let prefix=path.slice(0,bracketIdx);if(prefix!==arrayKey||!path.startsWith(prefix+"[]."))return null;rowColumns[label]=path.slice(bracketIdx+3)}let arr=getByPath2(data,arrayKey);return Array.isArray(arr)?{rows:arr,rowColumns}:null}function formatValue(value){return value==null?import_chalk3.default.dim("\u2013"):typeof value=="number"?value>1e12&&value<2e12?new Date(value).toISOString():String(value):typeof value=="boolean"?String(value):typeof value=="string"?value:JSON.stringify(value)}function renderCard(data,columns){let entries=Object.entries(columns),maxLabel=Math.max(...entries.map(([label])=>label.length));return entries.map(([label,path])=>{let value=getByPath2(data,path);return` ${import_chalk3.default.gray(label.padEnd(maxLabel))} ${formatValue(value)}`}).join(`
|
|
9
9
|
`)}function renderTable(rows,columns){let entries=Object.entries(columns),headerRow=entries.map(([label])=>label),dataRows=rows.map(row=>entries.map(([,path])=>formatValue(getByPath2(row,path)))),widths=entries.map(([label],colIdx)=>{let dataMax=dataRows.reduce((max,row)=>Math.max(max,stripAnsi(row[colIdx]).length),0);return Math.max(label.length,dataMax)}),header=headerRow.map((h,i)=>import_chalk3.default.bold(h.padEnd(widths[i]))).join(" "),body=dataRows.map(row=>row.map((cell,i)=>{let pad=widths[i]-stripAnsi(cell).length;return cell+" ".repeat(Math.max(0,pad))}).join(" "));return[header,...body].join(`
|
|
10
10
|
`)}function stripAnsi(str){return str.replace(/\x1b\[[0-9;]*m/g,"")}async function api(client){let telemetryClient=new ApiTelemetryClient({opts:{store:client.telemetryEventStore}}),parsedArgs,flagsSpec=getFlagsSpecification(apiCommand.options);try{parsedArgs=parseArguments(client.argv.slice(2),flagsSpec,{permissive:!0})}catch(err){return printError(err),1}let{args,flags}=parsedArgs,needHelp=flags["--help"],firstArg=args[1];if(firstArg==="ls"||firstArg==="list"){let lsFlagsSpec=getFlagsSpecification(listSubcommand.options),lsParsedArgs;try{lsParsedArgs=parseArguments(client.argv.slice(2),lsFlagsSpec)}catch(err){return printError(err),1}let lsFlags=lsParsedArgs.flags;if(lsFlags["--help"])return telemetryClient.trackCliFlagHelp("api",firstArg),output_manager_default.print(help(listSubcommand,{parent:apiCommand,columns:client.stderr.columns})),2;let formatResult=validateJsonOutput(lsFlags);return formatResult.valid?(telemetryClient.trackCliSubcommandList(),lsFlags["--refresh"]&&telemetryClient.trackCliFlagRefresh(!0),lsFlags["--format"]&&telemetryClient.trackCliOptionFormat(lsFlags["--format"]),telemetryClient.trackCliFlagJson(lsFlags["--json"]),lsFlags["--spec-url"]&&telemetryClient.trackCliOptionSpecUrl(lsFlags["--spec-url"]),listEndpoints(client,lsFlags["--refresh"]??!1,lsFlags["--spec-url"],formatResult.jsonOutput?"json":"table")):(output_manager_default.error(formatResult.error),1)}if(needHelp)return telemetryClient.trackCliFlagHelp("api"),output_manager_default.print(help(apiCommand,{columns:client.stderr.columns})),2;flags["--dangerously-skip-permissions"]&&(client.dangerouslySkipPermissions=!0);let endpoint,selectedMethod,selectedBodyFields=[];if(firstArg)endpoint=firstArg;else if(client.stdin.isTTY){let selected=await promptEndpointSelection(client,flags["--refresh"]??!1,flags["--spec-url"]);if(!selected)return 1;endpoint=selected.finalUrl,selectedMethod=selected.method,selectedBodyFields=selected.bodyFields}else return output_manager_default.error("Endpoint is required. Usage: vercel api <endpoint>"),1;if(endpoint&&!endpoint.startsWith("/"))return output_manager_default.error(`Invalid arguments. Use an API path starting with /, or run \`${packageName} api\` interactively.`),1;try{if(new URL(endpoint,API_BASE_URL).origin!==API_BASE_URL)return output_manager_default.error("Invalid endpoint: must be a Vercel API path, not an external URL"),1}catch{return output_manager_default.error("Invalid endpoint URL format"),1}let finalFlags={...flags};if(selectedMethod&&!flags["--method"]&&(finalFlags["--method"]=selectedMethod),selectedBodyFields.length>0){let existingFields=finalFlags["--field"]||[];finalFlags["--field"]=[...existingFields,...selectedBodyFields]}let requestConfig;try{requestConfig=await buildRequest(endpoint,finalFlags)}catch(err){return printError(err),1}if(telemetryClient.trackCliArgumentEndpoint(requestConfig.url),telemetryClient.trackCliArgumentOperationId(void 0),telemetryClient.trackCliOptionMethod(flags["--method"]),telemetryClient.trackCliOptionHeader(flags["--header"]),telemetryClient.trackCliOptionInput(flags["--input"]),flags["--paginate"]&&telemetryClient.trackCliFlagPaginate(!0),flags["--include"]&&telemetryClient.trackCliFlagInclude(!0),flags["--silent"]&&telemetryClient.trackCliFlagSilent(!0),flags["--verbose"]&&telemetryClient.trackCliFlagVerbose(!0),flags["--raw"]&&telemetryClient.trackCliFlagRaw(!0),flags["--refresh"]&&telemetryClient.trackCliFlagRefresh(!0),flags["--spec-url"]&&telemetryClient.trackCliOptionSpecUrl(flags["--spec-url"]),flags["--generate"]&&telemetryClient.trackCliOptionGenerate(flags["--generate"]),flags["--dangerously-skip-permissions"]&&telemetryClient.trackCliFlagDangerouslySkipPermissions(!0),flags["--generate"]==="curl"){let curlCmd=generateCurlCommand(requestConfig,"https://api.vercel.com");return output_manager_default.log(""),output_manager_default.log("Replace <TOKEN> with your auth token:"),output_manager_default.log(""),client.stdout.write(curlCmd+`
|
|
@@ -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
|
-
var SENTRY_DSN=
|
|
7
|
+
var SENTRY_DSN="https://26a24e59ba954011919a524b341b6ab5@o205439.ingest.us.sentry.io/1323225",BUILD_LABEL=void 0;export{SENTRY_DSN,BUILD_LABEL};
|
|
@@ -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{getSubcommand}from"./chunk-ETV3C2CV.js";import{getCommandAliases}from"./chunk-
|
|
7
|
+
import{getSubcommand}from"./chunk-ETV3C2CV.js";import{getCommandAliases}from"./chunk-KOOED3TJ.js";import{tracesCommand}from"./chunk-DKV4IVH5.js";import{lsSubcommand,rmSubcommand,setSubcommand,tracesConfigCommand}from"./chunk-IVWPQYIH.js";import"./chunk-65JYSI26.js";import"./chunk-YMVDWVMO.js";import"./chunk-O7G3CZ42.js";import"./chunk-N3N5UHIL.js";import"./chunk-WUZD4KBL.js";import"./chunk-QFPCR4NL.js";import"./chunk-5ENY7DSN.js";import"./chunk-UTVDFSQS.js";import"./chunk-SW7MNF4H.js";import"./chunk-MEAY2K5Z.js";import"./chunk-EQ52F4LH.js";import"./chunk-CVKB54WW.js";import"./chunk-JKTQV2QJ.js";import"./chunk-Y7PHTVZ6.js";import"./chunk-WSZHNPA6.js";import"./chunk-FAW6NBLQ.js";import"./chunk-5UOVEMYX.js";import{help}from"./chunk-5U25FWD5.js";import"./chunk-6TAQ6OWD.js";import"./chunk-WPS6JZF6.js";import"./chunk-ZKYS7EAB.js";import{TelemetryClient}from"./chunk-A5VLP25I.js";import"./chunk-RCTYVKM5.js";import"./chunk-7T6TL3GQ.js";import"./chunk-F2ZWW2IO.js";import"./chunk-BRK4OB4B.js";import"./chunk-OSCCYU74.js";import"./chunk-JAJW3P42.js";import"./chunk-FI772UVH.js";import{output_manager_default}from"./chunk-EWWFNMPZ.js";import"./chunk-QGIQK47P.js";import"./chunk-AVSPFBLM.js";import"./chunk-XCJDGQO7.js";import"./chunk-YPTLSODC.js";import"./chunk-7HL2RPUO.js";import"./chunk-U7KCDTCH.js";import"./chunk-N3ZZ7FHQ.js";import"./chunk-GU6VIFR5.js";import"./chunk-6L236MNA.js";var TracesConfigTelemetryClient=class extends TelemetryClient{trackCliSubcommandLs(actual){this.trackCliSubcommand({subcommand:"ls",value:actual})}trackCliSubcommandSet(actual){this.trackCliSubcommand({subcommand:"set",value:actual})}trackCliSubcommandRm(actual){this.trackCliSubcommand({subcommand:"rm",value:actual})}};var COMMAND_CONFIG={ls:getCommandAliases(lsSubcommand),set:getCommandAliases(setSubcommand),rm:getCommandAliases(rmSubcommand)},SUBCOMMAND_METADATA={ls:lsSubcommand,set:setSubcommand,rm:rmSubcommand};async function config(client,{args,needHelp,subcommandOriginal,telemetry}){let{subcommand:action,subcommandOriginal:actionOriginal}=getSubcommand(args,COMMAND_CONFIG),actionMetadata=typeof action=="string"?SUBCOMMAND_METADATA[action]:void 0;function printHelp(command,nested){return output_manager_default.print(help(command,{parent:nested?{...tracesCommand,name:"traces config"}:tracesCommand,columns:client.stderr.columns})),needHelp?0:2}if(needHelp)return telemetry.trackCliFlagHelp("traces",subcommandOriginal),actionMetadata?printHelp(actionMetadata,!0):printHelp(tracesConfigCommand,!1);telemetry.trackCliSubcommandConfig(subcommandOriginal);let configTelemetry=new TracesConfigTelemetryClient({opts:{store:client.telemetryEventStore}});switch(action){case"ls":return configTelemetry.trackCliSubcommandLs(actionOriginal),(await import("./ls-GD6LB7IE.js")).default(client);case"set":return configTelemetry.trackCliSubcommandSet(actionOriginal),(await import("./set-GESKJPQA.js")).default(client);case"rm":return configTelemetry.trackCliSubcommandRm(actionOriginal),(await import("./rm-OYSWVVSJ.js")).default(client);default:return printHelp(tracesConfigCommand,!1)}}export{config as default};
|
|
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{BUILD_LABEL,SENTRY_DSN}from"./chunk-
|
|
7
|
+
import{BUILD_LABEL,SENTRY_DSN}from"./chunk-WKZ6JSGZ.js";import"./chunk-6L236MNA.js";export{BUILD_LABEL,SENTRY_DSN};
|
|
@@ -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{login}from"./chunk-
|
|
7
|
+
import{login}from"./chunk-TTMLSKF7.js";import"./chunk-H4FTGLWV.js";import"./chunk-ULLWCOYC.js";import"./chunk-I46LFJJG.js";import"./chunk-JKTQV2QJ.js";import"./chunk-5U25FWD5.js";import"./chunk-6TAQ6OWD.js";import"./chunk-WPS6JZF6.js";import"./chunk-A5VLP25I.js";import"./chunk-RCTYVKM5.js";import"./chunk-7T6TL3GQ.js";import"./chunk-5XJNPXQK.js";import"./chunk-N5AIKGEO.js";import"./chunk-WWB66KP5.js";import"./chunk-MY4MONOH.js";import"./chunk-F2ZWW2IO.js";import"./chunk-PPCFQQSU.js";import"./chunk-BRK4OB4B.js";import"./chunk-OSCCYU74.js";import"./chunk-KCARCOP5.js";import"./chunk-BKV35LVB.js";import"./chunk-JAJW3P42.js";import"./chunk-SM5JI6QM.js";import"./chunk-VOZEB6PD.js";import"./chunk-RINZXCDJ.js";import"./chunk-FI772UVH.js";import"./chunk-EWWFNMPZ.js";import"./chunk-QGIQK47P.js";import"./chunk-AVSPFBLM.js";import"./chunk-XCJDGQO7.js";import"./chunk-YPTLSODC.js";import"./chunk-7HL2RPUO.js";import"./chunk-U7KCDTCH.js";import"./chunk-N3ZZ7FHQ.js";import"./chunk-GU6VIFR5.js";import"./chunk-6L236MNA.js";export{login as default};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{RULE_LIMIT,formatPath,formatRate,readProjectTracing,subcommandArguments,writeConfigJson}from"./chunk-H4IUDU5W.js";import{handleTracingApiError,resolveConfigScope}from"./chunk-2TBUMUHF.js";import{formatTable}from"./chunk-UED2PPFP.js";import{validateLsArgs}from"./chunk-Z4VR6CQ2.js";import{validateJsonOutput}from"./chunk-D4MW3RDW.js";import"./chunk-ZWYU5SBC.js";import"./chunk-GK5C5TE5.js";import"./chunk-WUH5HYCX.js";import{lsSubcommand}from"./chunk-IVWPQYIH.js";import"./chunk-6TAQ6OWD.js";import"./chunk-WPS6JZF6.js";import"./chunk-4OKKSZVX.js";import"./chunk-JSKGZLE4.js";import{TelemetryClient}from"./chunk-A5VLP25I.js";import"./chunk-RCTYVKM5.js";import"./chunk-7T6TL3GQ.js";import"./chunk-GHM7V3GG.js";import"./chunk-5XJNPXQK.js";import{printError}from"./chunk-N5AIKGEO.js";import{parseArguments}from"./chunk-WWB66KP5.js";import"./chunk-MY4MONOH.js";import"./chunk-RLCFE3MK.js";import"./chunk-F2ZWW2IO.js";import"./chunk-B4ATVYZW.js";import"./chunk-PPCFQQSU.js";import"./chunk-BRK4OB4B.js";import"./chunk-OSCCYU74.js";import"./chunk-KCARCOP5.js";import"./chunk-BKV35LVB.js";import{getFlagsSpecification}from"./chunk-JAJW3P42.js";import"./chunk-YMM3VY3J.js";import"./chunk-SM5JI6QM.js";import"./chunk-VOZEB6PD.js";import"./chunk-RINZXCDJ.js";import{getCommandName,getCommandNamePlain}from"./chunk-FI772UVH.js";import{output_manager_default}from"./chunk-EWWFNMPZ.js";import"./chunk-QGIQK47P.js";import"./chunk-AVSPFBLM.js";import"./chunk-XCJDGQO7.js";import"./chunk-YPTLSODC.js";import"./chunk-7HL2RPUO.js";import{require_source}from"./chunk-U7KCDTCH.js";import"./chunk-N3ZZ7FHQ.js";import"./chunk-GU6VIFR5.js";import{__toESM}from"./chunk-6L236MNA.js";var import_chalk=__toESM(require_source(),1);var TracesConfigLsTelemetryClient=class extends TelemetryClient{trackCliFlagJson(json){json&&this.trackCliFlag("json")}};var SET_HINT="traces config set <environment> <rate> [requestPath]";function ruleCountLabel(count){return`${count} of ${RULE_LIMIT} rules`}function printTable(projectName,rows){output_manager_default.log(`Trace sampling rules for ${import_chalk.default.bold(projectName)} (${ruleCountLabel(rows.length)})`),output_manager_default.print(`${formatTable(["environment","path","rate"],["l","l","l"],[{rows:rows.map(row=>[row.environment,formatPath(row.requestPath),formatRate(row.sampleRate)])}])}
|
|
8
|
+
`)}async function ls(client){let telemetry=new TracesConfigLsTelemetryClient({opts:{store:client.telemetryEventStore}}),parsedArgs,flagsSpecification=getFlagsSpecification(lsSubcommand.options);try{parsedArgs=parseArguments(client.argv.slice(2),flagsSpecification)}catch(err){return printError(err),1}let{flags}=parsedArgs;telemetry.trackCliOptionFormat(flags["--format"]),telemetry.trackCliFlagJson(flags["--json"]),telemetry.trackCliOptionProject(flags["--project"]);let argsResult=validateLsArgs({commandName:"traces config ls",args:subcommandArguments(parsedArgs.args),maxArgs:0,exitCode:2});if(argsResult!==0)return argsResult;let formatResult=validateJsonOutput(flags);if(!formatResult.valid)return output_manager_default.error(formatResult.error),1;let asJson=formatResult.jsonOutput||client.nonInteractive,scope=await resolveConfigScope(client,{project:flags["--project"]});if("exitCode"in scope)return scope.exitCode;asJson||output_manager_default.spinner("Fetching trace sampling rules\u2026");let project,entries;try{({project,entries}=await readProjectTracing({client,...scope}))}catch(err){return output_manager_default.stopSpinner(),handleTracingApiError(client,err)}output_manager_default.stopSpinner();let rows=entries.filter(entry=>entry.rule.destination==="internal").map(entry=>entry.row),message=rows.length===0?`No trace sampling rules for ${project.name}.`:`Listed ${ruleCountLabel(rows.length)}.`;return asJson?(writeConfigJson(client,{project,bare:rows,envelope:{rules:rows},message,next:[{command:getCommandNamePlain(SET_HINT),when:"Add or replace a sampling rule"}]}),0):rows.length===0?(output_manager_default.log(`No trace sampling rules for ${import_chalk.default.bold(project.name)}.`),output_manager_default.dim(`Add one with ${getCommandName(SET_HINT)}`),0):(printTable(project.name,rows),0)}export{ls as default};
|
|
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{createOpenApiCache,fetchSpecUrl,foldNamingStyle,formatAsCard,formatAsDataTable,inferCliSubcommandAliases,operationIdToKebabCase,resolveEndpointByTagAndOperationId,tryOpenApiFallback}from"./chunk-
|
|
7
|
+
import{createOpenApiCache,fetchSpecUrl,foldNamingStyle,formatAsCard,formatAsDataTable,inferCliSubcommandAliases,operationIdToKebabCase,resolveEndpointByTagAndOperationId,tryOpenApiFallback}from"./chunk-WH6M54KF.js";import{humanReadableColumnLabel,humanizeIdentifier}from"./chunk-GHAY4PSD.js";import{CACHE_FILE,CACHE_TTL_MS,FETCH_TIMEOUT_MS,MAX_OPENAPI_SPEC_BYTES,OPENAPI_URL,OpenApiCache,SSO_API_URL,VERCEL_CLI_ROOT_DISPLAY_KEY,assertAllowedSpecUrl,matchesCliApiTag,readSpecResponse,resolveOpenApiTagForProjectsCli}from"./chunk-AP36GAOG.js";import"./chunk-QTKJC2O5.js";import"./chunk-D4MW3RDW.js";import"./chunk-CVKB54WW.js";import"./chunk-5U25FWD5.js";import"./chunk-6TAQ6OWD.js";import"./chunk-WPS6JZF6.js";import"./chunk-JSKGZLE4.js";import"./chunk-A5VLP25I.js";import"./chunk-RCTYVKM5.js";import"./chunk-7T6TL3GQ.js";import"./chunk-N5AIKGEO.js";import"./chunk-WWB66KP5.js";import"./chunk-F2ZWW2IO.js";import"./chunk-BRK4OB4B.js";import"./chunk-OSCCYU74.js";import"./chunk-KCARCOP5.js";import"./chunk-BKV35LVB.js";import"./chunk-JAJW3P42.js";import"./chunk-VOZEB6PD.js";import"./chunk-RINZXCDJ.js";import"./chunk-FI772UVH.js";import"./chunk-EWWFNMPZ.js";import"./chunk-QGIQK47P.js";import"./chunk-AVSPFBLM.js";import"./chunk-XCJDGQO7.js";import"./chunk-YPTLSODC.js";import"./chunk-7HL2RPUO.js";import"./chunk-U7KCDTCH.js";import"./chunk-N3ZZ7FHQ.js";import"./chunk-GU6VIFR5.js";import"./chunk-6L236MNA.js";export{CACHE_FILE,CACHE_TTL_MS,FETCH_TIMEOUT_MS,MAX_OPENAPI_SPEC_BYTES,OPENAPI_URL,OpenApiCache,SSO_API_URL,VERCEL_CLI_ROOT_DISPLAY_KEY,assertAllowedSpecUrl,createOpenApiCache,fetchSpecUrl,foldNamingStyle,formatAsCard,formatAsDataTable,humanReadableColumnLabel,humanizeIdentifier,inferCliSubcommandAliases,matchesCliApiTag,operationIdToKebabCase,readSpecResponse,resolveEndpointByTagAndOperationId,resolveOpenApiTagForProjectsCli,tryOpenApiFallback};
|
|
@@ -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{login}from"./chunk-
|
|
7
|
+
import{login}from"./chunk-TTMLSKF7.js";import{require_ci_info}from"./chunk-T52FMXWC.js";import"./chunk-H4FTGLWV.js";import"./chunk-ULLWCOYC.js";import"./chunk-I46LFJJG.js";import"./chunk-JKTQV2QJ.js";import{param}from"./chunk-SXUEGVWB.js";import"./chunk-5U25FWD5.js";import"./chunk-6TAQ6OWD.js";import"./chunk-WPS6JZF6.js";import{getGlobalPathConfig}from"./chunk-JSKGZLE4.js";import"./chunk-A5VLP25I.js";import"./chunk-RCTYVKM5.js";import"./chunk-7T6TL3GQ.js";import"./chunk-5XJNPXQK.js";import{printError}from"./chunk-N5AIKGEO.js";import"./chunk-WWB66KP5.js";import"./chunk-MY4MONOH.js";import"./chunk-F2ZWW2IO.js";import{humanizePath}from"./chunk-PPCFQQSU.js";import"./chunk-BRK4OB4B.js";import"./chunk-OSCCYU74.js";import"./chunk-KCARCOP5.js";import"./chunk-BKV35LVB.js";import"./chunk-JAJW3P42.js";import"./chunk-SM5JI6QM.js";import"./chunk-VOZEB6PD.js";import"./chunk-RINZXCDJ.js";import{getCommandName}from"./chunk-FI772UVH.js";import{output_manager_default}from"./chunk-EWWFNMPZ.js";import"./chunk-QGIQK47P.js";import"./chunk-AVSPFBLM.js";import"./chunk-XCJDGQO7.js";import"./chunk-YPTLSODC.js";import"./chunk-7HL2RPUO.js";import"./chunk-U7KCDTCH.js";import"./chunk-N3ZZ7FHQ.js";import"./chunk-GU6VIFR5.js";import{__toESM}from"./chunk-6L236MNA.js";var import_ci_info=__toESM(require_ci_info(),1);async function promptMissingCredentials(client,onLoginError){let isTTY=process.stdout.isTTY;if(!import_ci_info.default.isCI&&(isTTY||client.isAgent)){output_manager_default.log(isTTY?"No existing credentials found. Please log in:":"No existing credentials found. Starting login flow...");try{let result=await login(client,{shouldParseArgs:!1});if(result!==0)return result}catch(error){return printError(error),onLoginError?.(error),1}return output_manager_default.debug(`Saved credentials in "${humanizePath(getGlobalPathConfig())}"`),0}return output_manager_default.prettyError({message:`No existing credentials found. Please run ${getCommandName("login")} or pass ${param("--token")}`,link:"https://err.sh/vercel/no-credentials-found"}),1}export{promptMissingCredentials as default};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{EMPTY_PATH_ERROR,ENVIRONMENT_ERROR,RULE_LIMIT,formatRuleLine,formatRuleTarget,isRuleEnvironment,readProjectTracing,subcommandArguments,writeConfigJson,writeSamplingRules}from"./chunk-H4IUDU5W.js";import{confirmationRequired,handleTracingApiError,invalidArguments,resolveConfigScope,ruleNotFound}from"./chunk-2TBUMUHF.js";import{validateJsonOutput}from"./chunk-D4MW3RDW.js";import"./chunk-ZWYU5SBC.js";import"./chunk-GK5C5TE5.js";import"./chunk-WUH5HYCX.js";import{tracesCommand}from"./chunk-DKV4IVH5.js";import{rmSubcommand}from"./chunk-IVWPQYIH.js";import{help}from"./chunk-5U25FWD5.js";import"./chunk-6TAQ6OWD.js";import"./chunk-WPS6JZF6.js";import"./chunk-4OKKSZVX.js";import"./chunk-JSKGZLE4.js";import{TelemetryClient}from"./chunk-A5VLP25I.js";import"./chunk-RCTYVKM5.js";import"./chunk-7T6TL3GQ.js";import"./chunk-GHM7V3GG.js";import"./chunk-5XJNPXQK.js";import{printError}from"./chunk-N5AIKGEO.js";import{parseArguments}from"./chunk-WWB66KP5.js";import"./chunk-MY4MONOH.js";import"./chunk-RLCFE3MK.js";import"./chunk-F2ZWW2IO.js";import"./chunk-B4ATVYZW.js";import"./chunk-PPCFQQSU.js";import"./chunk-BRK4OB4B.js";import"./chunk-OSCCYU74.js";import{buildCommandWithGlobalFlags}from"./chunk-KCARCOP5.js";import{quoteArg}from"./chunk-BKV35LVB.js";import{getFlagsSpecification}from"./chunk-JAJW3P42.js";import"./chunk-YMM3VY3J.js";import"./chunk-SM5JI6QM.js";import"./chunk-VOZEB6PD.js";import"./chunk-RINZXCDJ.js";import{getCommandName,getCommandNamePlain}from"./chunk-FI772UVH.js";import{output_manager_default}from"./chunk-EWWFNMPZ.js";import"./chunk-QGIQK47P.js";import"./chunk-AVSPFBLM.js";import"./chunk-XCJDGQO7.js";import"./chunk-YPTLSODC.js";import"./chunk-7HL2RPUO.js";import{require_source}from"./chunk-U7KCDTCH.js";import"./chunk-N3ZZ7FHQ.js";import"./chunk-GU6VIFR5.js";import{__toESM}from"./chunk-6L236MNA.js";var import_chalk=__toESM(require_source(),1);var TracesConfigRmTelemetryClient=class extends TelemetryClient{trackCliArgumentEnvironment(environment){environment&&this.trackCliArgument({arg:"environment",value:isRuleEnvironment(environment)?environment:this.redactedValue})}trackCliArgumentRequestPath(requestPath){requestPath&&this.trackCliArgument({arg:"requestPath",value:this.redactedValue})}trackCliFlagDefault(defaultOnly){defaultOnly&&this.trackCliFlag("default")}trackCliFlagJson(json){json&&this.trackCliFlag("json")}};var USAGE="traces config rm <environment> [requestPath]";function matches(row,environment,selector){if(row.environment!==environment)return!1;switch(selector.kind){case"exact":return row.requestPath===selector.requestPath;case"default":return row.requestPath===null;case"every":return!0}}function describeSelection(environment,selector){switch(selector.kind){case"exact":return formatRuleTarget(environment,selector.requestPath);case"default":return formatRuleTarget(environment,null);case"every":return environment}}function ruleWord(count){return count===1?"rule":"rules"}function canConfirm(client){return!client.nonInteractive&&!client.isAgent&&client.stdin.isTTY===!0}function commandToRunByHand(client,environment,pathArg,defaultFlag){let template=["traces config rm",environment,...pathArg!==void 0?[quoteArg(pathArg)]:[],...defaultFlag?["--default"]:[]].join(" ");return buildCommandWithGlobalFlags(client.argv,template,void 0,{excludeFlags:["--non-interactive"],preserveProject:!0})}async function rm(client){let telemetry=new TracesConfigRmTelemetryClient({opts:{store:client.telemetryEventStore}}),parsedArgs,flagsSpecification=getFlagsSpecification(rmSubcommand.options);try{parsedArgs=parseArguments(client.argv.slice(2),flagsSpecification)}catch(err){return printError(err),1}let{flags}=parsedArgs,[environmentArg,...pathArgs]=subcommandArguments(parsedArgs.args),pathArg=pathArgs[0],defaultFlag=!!flags["--default"];if(telemetry.trackCliArgumentEnvironment(environmentArg),telemetry.trackCliArgumentRequestPath(pathArg),telemetry.trackCliFlagDefault(flags["--default"]),telemetry.trackCliOptionFormat(flags["--format"]),telemetry.trackCliFlagJson(flags["--json"]),telemetry.trackCliOptionProject(flags["--project"]),environmentArg===void 0)return output_manager_default.print(help(rmSubcommand,{parent:{...tracesCommand,name:"traces config"},columns:client.stderr.columns})),2;if(pathArgs.length>1)return output_manager_default.error(`Too many arguments. Usage: ${getCommandName(USAGE)}`),2;if(!isRuleEnvironment(environmentArg))return invalidArguments(client,`${ENVIRONMENT_ERROR} Received: ${environmentArg}`);if(pathArg!==void 0&&defaultFlag)return invalidArguments(client,"`--default` selects the rule that has no path prefix, so it cannot be combined with a path prefix.");if(pathArg!==void 0&&pathArg.trim()==="")return invalidArguments(client,EMPTY_PATH_ERROR);let selector=pathArg!==void 0?{kind:"exact",requestPath:pathArg}:defaultFlag?{kind:"default"}:{kind:"every"},formatResult=validateJsonOutput(flags);if(!formatResult.valid)return output_manager_default.error(formatResult.error),1;let asJson=formatResult.jsonOutput||client.nonInteractive,scope=await resolveConfigScope(client,{project:flags["--project"]});if("exitCode"in scope)return scope.exitCode;asJson||output_manager_default.spinner("Fetching trace sampling rules\u2026");let project,tracing,entries;try{({project,tracing,entries}=await readProjectTracing({client,...scope}))}catch(err){return output_manager_default.stopSpinner(),handleTracingApiError(client,err)}output_manager_default.stopSpinner();let removed=entries.filter(entry=>matches(entry.row,environmentArg,selector)).map(entry=>entry.row),kept=entries.filter(entry=>!matches(entry.row,environmentArg,selector));if(removed.length===0)return ruleNotFound(client,`No trace sampling rule matches ${describeSelection(environmentArg,selector)} on ${project.name}.`);let removedLines=removed.map(formatRuleLine);output_manager_default.log(`The following ${removed.length} ${ruleWord(removed.length)} will be removed from ${import_chalk.default.bold(project.name)}:`);for(let line of removedLines)output_manager_default.print(` ${line}
|
|
8
|
+
`);if(!canConfirm(client))return confirmationRequired(client,`Removing ${removed.length} trace sampling ${ruleWord(removed.length)} from ${project.name} needs a confirmation, and this session cannot prompt for one. Rules at risk: ${removedLines.join(", ")}.`,[{command:commandToRunByHand(client,environmentArg,pathArg,defaultFlag),when:"Run this in a terminal and answer the prompt"}]);if(!await client.input.confirm(`Remove ${removed.length} trace sampling ${ruleWord(removed.length)}?`,!1))return output_manager_default.log("Canceled."),0;asJson||output_manager_default.spinner("Updating trace sampling rules\u2026");try{await writeSamplingRules({client,...scope,tracing,rules:kept.map(entry=>entry.rule)})}catch(err){return output_manager_default.stopSpinner(),handleTracingApiError(client,err)}output_manager_default.stopSpinner();let message=`Removed ${removed.length} trace sampling ${ruleWord(removed.length)} from ${project.name}. ${kept.length} of ${RULE_LIMIT} rules.`;return asJson?(writeConfigJson(client,{project,bare:removed,envelope:{removed,ruleCount:kept.length,ruleLimit:RULE_LIMIT},message,next:[{command:getCommandNamePlain("traces config ls"),when:"Read back every remaining sampling rule"}]}),0):(output_manager_default.success(`Removed ${removed.length} trace sampling ${ruleWord(removed.length)} from ${import_chalk.default.bold(project.name)}. ${kept.length} of ${RULE_LIMIT} rules.`),0)}export{rm as default};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{EMPTY_PATH_ERROR,ENVIRONMENT_ERROR,RATE_ERROR,RULE_LIMIT,formatRate,formatRuleTarget,hasSameKey,isRuleEnvironment,parseSampleRate,readProjectTracing,subcommandArguments,toApiRate,toRule,writeConfigJson,writeSamplingRules}from"./chunk-H4IUDU5W.js";import{handleTracingApiError,invalidArguments,resolveConfigScope}from"./chunk-2TBUMUHF.js";import{validateJsonOutput}from"./chunk-D4MW3RDW.js";import"./chunk-ZWYU5SBC.js";import"./chunk-GK5C5TE5.js";import"./chunk-WUH5HYCX.js";import{tracesCommand}from"./chunk-DKV4IVH5.js";import{setSubcommand}from"./chunk-IVWPQYIH.js";import{help}from"./chunk-5U25FWD5.js";import"./chunk-6TAQ6OWD.js";import"./chunk-WPS6JZF6.js";import"./chunk-4OKKSZVX.js";import"./chunk-JSKGZLE4.js";import{TelemetryClient}from"./chunk-A5VLP25I.js";import"./chunk-RCTYVKM5.js";import"./chunk-7T6TL3GQ.js";import"./chunk-GHM7V3GG.js";import"./chunk-5XJNPXQK.js";import{printError}from"./chunk-N5AIKGEO.js";import{parseArguments}from"./chunk-WWB66KP5.js";import"./chunk-MY4MONOH.js";import"./chunk-RLCFE3MK.js";import"./chunk-F2ZWW2IO.js";import"./chunk-B4ATVYZW.js";import"./chunk-PPCFQQSU.js";import"./chunk-BRK4OB4B.js";import"./chunk-OSCCYU74.js";import"./chunk-KCARCOP5.js";import"./chunk-BKV35LVB.js";import{getFlagsSpecification}from"./chunk-JAJW3P42.js";import"./chunk-YMM3VY3J.js";import"./chunk-SM5JI6QM.js";import"./chunk-VOZEB6PD.js";import"./chunk-RINZXCDJ.js";import{getCommandName,getCommandNamePlain}from"./chunk-FI772UVH.js";import{output_manager_default}from"./chunk-EWWFNMPZ.js";import"./chunk-QGIQK47P.js";import"./chunk-AVSPFBLM.js";import"./chunk-XCJDGQO7.js";import"./chunk-YPTLSODC.js";import"./chunk-7HL2RPUO.js";import{require_source}from"./chunk-U7KCDTCH.js";import"./chunk-N3ZZ7FHQ.js";import"./chunk-GU6VIFR5.js";import{__toESM}from"./chunk-6L236MNA.js";var import_chalk=__toESM(require_source(),1);var TracesConfigSetTelemetryClient=class extends TelemetryClient{trackCliArgumentEnvironment(environment){environment&&this.trackCliArgument({arg:"environment",value:isRuleEnvironment(environment)?environment:this.redactedValue})}trackCliArgumentRate(rate){rate&&this.trackCliArgument({arg:"rate",value:this.redactedValue})}trackCliArgumentRequestPath(requestPath){requestPath&&this.trackCliArgument({arg:"requestPath",value:this.redactedValue})}trackCliFlagJson(json){json&&this.trackCliFlag("json")}};var USAGE="traces config set <environment> <rate> [requestPath]";async function set(client){let telemetry=new TracesConfigSetTelemetryClient({opts:{store:client.telemetryEventStore}}),parsedArgs,flagsSpecification=getFlagsSpecification(setSubcommand.options);try{parsedArgs=parseArguments(client.argv.slice(2),flagsSpecification)}catch(err){return printError(err),1}let{flags}=parsedArgs,[environmentArg,rateArg,...pathArgs]=subcommandArguments(parsedArgs.args),pathArg=pathArgs[0];if(telemetry.trackCliArgumentEnvironment(environmentArg),telemetry.trackCliArgumentRate(rateArg),telemetry.trackCliArgumentRequestPath(pathArg),telemetry.trackCliOptionFormat(flags["--format"]),telemetry.trackCliFlagJson(flags["--json"]),telemetry.trackCliOptionProject(flags["--project"]),environmentArg===void 0||rateArg===void 0)return output_manager_default.print(help(setSubcommand,{parent:{...tracesCommand,name:"traces config"},columns:client.stderr.columns})),2;if(pathArgs.length>1)return output_manager_default.error(`Too many arguments. Usage: ${getCommandName(USAGE)}`),2;if(!isRuleEnvironment(environmentArg))return invalidArguments(client,`${ENVIRONMENT_ERROR} Received: ${environmentArg}`);let sampleRate=parseSampleRate(rateArg);if(sampleRate===void 0)return invalidArguments(client,`${RATE_ERROR} Received: ${rateArg}`);if(pathArg!==void 0&&pathArg.trim()==="")return invalidArguments(client,EMPTY_PATH_ERROR);let formatResult=validateJsonOutput(flags);if(!formatResult.valid)return output_manager_default.error(formatResult.error),1;let asJson=formatResult.jsonOutput||client.nonInteractive,scope=await resolveConfigScope(client,{project:flags["--project"]});if("exitCode"in scope)return scope.exitCode;let rule={environment:environmentArg,requestPath:pathArg??null,sampleRate};asJson||output_manager_default.spinner("Updating trace sampling rules\u2026");let project,tracing,entries;try{({project,tracing,entries}=await readProjectTracing({client,...scope}))}catch(err){return output_manager_default.stopSpinner(),handleTracingApiError(client,err)}let existingIndex=entries.findIndex(entry=>hasSameKey(entry.row,rule)),previous=existingIndex===-1?void 0:entries[existingIndex].row,nextRules=existingIndex===-1?[...entries.map(entry=>entry.rule),toRule(rule)]:entries.map((entry,index)=>index===existingIndex?{...entry.rule,rate:toApiRate(rule.sampleRate)}:entry.rule);if(nextRules.length>RULE_LIMIT)return output_manager_default.stopSpinner(),invalidArguments(client,`A project can have at most ${RULE_LIMIT} trace sampling rules, and ${project.name} already has ${entries.length}. Remove one with ${getCommandName("traces config rm <environment> [requestPath]")} first.`);try{await writeSamplingRules({client,...scope,tracing,rules:nextRules})}catch(err){return output_manager_default.stopSpinner(),handleTracingApiError(client,err)}output_manager_default.stopSpinner();let target=formatRuleTarget(rule.environment,rule.requestPath),wasClause=previous?` (was ${formatRate(previous.sampleRate)})`:"",successLine=subject=>`Set ${subject} to ${formatRate(rule.sampleRate)}${wasClause}. ${nextRules.length} of ${RULE_LIMIT} rules.`;return asJson?(writeConfigJson(client,{project,bare:rule,envelope:{rule,previousSampleRate:previous?.sampleRate??null,ruleCount:nextRules.length,ruleLimit:RULE_LIMIT},message:successLine(target),next:[{command:getCommandNamePlain("traces config ls"),when:"Read back every sampling rule"}]}),0):(output_manager_default.success(successLine(import_chalk.default.bold(target))),0)}export{set as default};
|