vercel 64.2.0 → 64.3.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/{add-WVK3AP46.js → add-5RV75RPG.js} +1 -1
- package/dist/chunks/{add-UPXURHDI.js → add-RFCYPSPS.js} +1 -1
- package/dist/chunks/{add-IATD2WUV.js → add-UXOTAL3N.js} +1 -1
- package/dist/chunks/{build-JOGD3ZEF.js → build-SE3QLNVF.js} +1 -1
- package/dist/chunks/{chunk-4BS552UW.js → chunk-26Z4U6G4.js} +2 -2
- package/dist/chunks/{chunk-XEQT373M.js → chunk-2B3A3MOX.js} +1 -1
- package/dist/chunks/{chunk-4VEK7DEH.js → chunk-444RE4Z5.js} +1 -1
- package/dist/chunks/{chunk-TY4PMK7Y.js → chunk-6GIP2YPX.js} +1 -1
- package/dist/chunks/{chunk-KLYIX4HK.js → chunk-6HOVHRWJ.js} +3 -3
- package/dist/chunks/chunk-6ZRULOO3.js +7 -0
- package/dist/chunks/{chunk-JGPRCZC2.js → chunk-7GFRZWLE.js} +1 -1
- package/dist/chunks/{chunk-VURCIZKT.js → chunk-A63VVXW2.js} +1 -1
- package/dist/chunks/{chunk-4IIRQJUW.js → chunk-AA434KXY.js} +1 -1
- package/dist/chunks/{chunk-N5D4455C.js → chunk-AALI66ML.js} +1 -1
- package/dist/chunks/{chunk-AKM22FBX.js → chunk-AQUDXMFH.js} +1 -1
- package/dist/chunks/chunk-BAT6SDBJ.js +10 -0
- package/dist/chunks/{chunk-WE3ZJX7P.js → chunk-CMKLX4DC.js} +1 -1
- package/dist/chunks/{chunk-JSBEAHKA.js → chunk-CYV3X62I.js} +1 -1
- package/dist/chunks/{chunk-EO7GUARB.js → chunk-DNDBPLLI.js} +1 -1
- package/dist/chunks/{chunk-UJUNGWSD.js → chunk-DNTQK2SW.js} +1 -1
- package/dist/chunks/{chunk-3GSGG4YR.js → chunk-E6R2QOOR.js} +1 -1
- package/dist/chunks/{chunk-CRQDQNQZ.js → chunk-ELDHGU6N.js} +1 -1
- package/dist/chunks/{chunk-DYQXJCHO.js → chunk-EVQJ7SCV.js} +1 -1
- package/dist/chunks/{chunk-FTY4BCAF.js → chunk-EXPLBM7J.js} +1 -1
- package/dist/chunks/{chunk-YO4VLAB7.js → chunk-FLBI6DY2.js} +1 -1
- package/dist/chunks/{chunk-N6ECEBHG.js → chunk-G2IJOQR3.js} +1 -1
- package/dist/chunks/{chunk-5JEU6QSM.js → chunk-GCSAJUL6.js} +1 -1
- package/dist/chunks/{chunk-OLWE4UFC.js → chunk-GF7EG5IA.js} +1 -1
- package/dist/chunks/{chunk-NBABZO3A.js → chunk-GJP22N6R.js} +1 -1
- package/dist/chunks/{chunk-YDM2PMMP.js → chunk-GLJH35MJ.js} +1 -1
- package/dist/chunks/{chunk-TBLIJ2PS.js → chunk-GNV6PG6W.js} +1 -1
- package/dist/chunks/{chunk-FGNMYSLD.js → chunk-GWZ4VPU3.js} +1 -1
- package/dist/chunks/{chunk-4GL254L4.js → chunk-H3KYG32S.js} +2 -2
- package/dist/chunks/{chunk-EEZLBOSP.js → chunk-H7CRPXOA.js} +4 -4
- package/dist/chunks/{chunk-JEPRHNQU.js → chunk-HJRAWEA2.js} +1 -1
- package/dist/chunks/{chunk-7BOCT55A.js → chunk-HTLGLTKD.js} +2 -2
- package/dist/chunks/{chunk-E6UKNYFF.js → chunk-HVUJNVPS.js} +1 -1
- package/dist/chunks/{chunk-WZ7YJDKT.js → chunk-IIC2A4YN.js} +1 -1
- package/dist/chunks/{chunk-N7Q2IESO.js → chunk-IJCCFLCQ.js} +1 -1
- package/dist/chunks/{chunk-KUGY5FIM.js → chunk-IL7X6EKK.js} +1 -1
- package/dist/chunks/{chunk-XD2LZRBS.js → chunk-IQ7FPAI4.js} +1 -1
- package/dist/chunks/{chunk-J2LAZELI.js → chunk-IVIZLWZQ.js} +1 -1
- package/dist/chunks/{chunk-O7JMHULU.js → chunk-IYCHAIFZ.js} +1 -1
- package/dist/chunks/{chunk-TWKII7HO.js → chunk-JCTXRR4A.js} +1 -1
- package/dist/chunks/{chunk-GSVOI5LW.js → chunk-JV6IPUGX.js} +1 -1
- package/dist/chunks/{chunk-IRJ5XFT2.js → chunk-KGXW36FQ.js} +2 -2
- package/dist/chunks/{chunk-GSOPJJO5.js → chunk-KKCBFBJK.js} +1 -1
- package/dist/chunks/{chunk-WVJYKHGZ.js → chunk-KKQL4AKH.js} +1 -1
- package/dist/chunks/{chunk-JNJOUMGF.js → chunk-KUGXOLL7.js} +1 -1
- package/dist/chunks/{chunk-75IAMKGV.js → chunk-M774HRX5.js} +2 -2
- package/dist/chunks/{chunk-J3CDVZE7.js → chunk-MMPQC2N6.js} +1 -1
- package/dist/chunks/{chunk-PAN6TUTQ.js → chunk-MV4WHUIC.js} +1 -1
- package/dist/chunks/{chunk-SYEKOJHT.js → chunk-MZ3QGJH3.js} +1 -1
- package/dist/chunks/{chunk-QDOYNWNQ.js → chunk-MZLQY2EQ.js} +1 -1
- package/dist/chunks/{chunk-SQB4T5FL.js → chunk-OCOVCC5Q.js} +1 -1
- package/dist/chunks/{chunk-ZUCSA4IW.js → chunk-OJKZ7EV3.js} +1 -1
- package/dist/chunks/{chunk-7C6BXZCV.js → chunk-OUTCLR64.js} +1 -1
- package/dist/chunks/{chunk-3EU7MN5M.js → chunk-QAETJRKX.js} +1 -1
- package/dist/chunks/{chunk-WW4VUFHJ.js → chunk-QC3HEGFD.js} +1 -1
- package/dist/chunks/{chunk-YBOS65VB.js → chunk-QC5AMRWR.js} +1 -1
- package/dist/chunks/{chunk-LLPIBKFX.js → chunk-QCWV7FML.js} +1 -1
- package/dist/chunks/{chunk-XSVF2CZM.js → chunk-TCYAAWLB.js} +1 -1
- package/dist/chunks/{chunk-THZR6O2M.js → chunk-TDDZGUU6.js} +1 -1
- package/dist/chunks/{chunk-4TTF5E5U.js → chunk-U3NQZJQ4.js} +8 -8
- package/dist/chunks/{chunk-X65QKYDM.js → chunk-VRWLNWNE.js} +1 -1
- package/dist/chunks/{chunk-I62UUYTS.js → chunk-VVAZC5IO.js} +1 -1
- package/dist/chunks/{chunk-QL3IYPBV.js → chunk-WGOQGKS5.js} +1 -1
- package/dist/chunks/{chunk-3EYOQC4R.js → chunk-WYI4VNXT.js} +1 -1
- package/dist/chunks/{chunk-SRAC7DI4.js → chunk-XJXX4QXA.js} +1 -1
- package/dist/chunks/{chunk-YIIPBH2D.js → chunk-XSDAUM4F.js} +1 -1
- package/dist/chunks/{chunk-GUJVJKO7.js → chunk-XW4ZWX3I.js} +1 -1
- package/dist/chunks/{chunk-A5R2HHNK.js → chunk-YROIQRYI.js} +1 -1
- package/dist/chunks/{chunk-YP46QVEI.js → chunk-YS542RHZ.js} +1 -1
- package/dist/chunks/{chunk-WIAAACUI.js → chunk-YUYCSDCO.js} +1 -1
- package/dist/chunks/{chunk-HAVEFTOO.js → chunk-ZE53XHAY.js} +1 -1
- package/dist/chunks/{chunk-SGXN7SMU.js → chunk-ZLWTPS5T.js} +1 -1
- package/dist/chunks/{chunk-5UEBA6N6.js → chunk-ZQKDO5PL.js} +1 -1
- package/dist/chunks/{chunk-WPQN5UKR.js → chunk-ZQME5XUJ.js} +1 -1
- package/dist/chunks/{chunk-EF3YL2R7.js → chunk-ZVLDGT4O.js} +1 -1
- package/dist/chunks/{chunk-N7L3XLWC.js → chunk-ZZ3LJ22B.js} +1 -1
- package/dist/chunks/{clear-FNH7KUCF.js → clear-2VHJFFMM.js} +1 -1
- package/dist/chunks/{compile-vercel-config-4LNHE3YV.js → compile-vercel-config-ADKZDUAU.js} +1 -1
- package/dist/chunks/{config-JEHKUQMZ.js → config-6YWGF4CO.js} +1 -1
- package/dist/chunks/{config-W3TVZPSK.js → config-VAOXMKVX.js} +1 -1
- package/dist/chunks/{connect-git-provider-VJYXBRYG.js → connect-git-provider-2JIBL3ST.js} +1 -1
- package/dist/chunks/{delete-HCZA6EVL.js → delete-FEUSV3JO.js} +1 -1
- package/dist/chunks/{delete-LV744KVD.js → delete-YW2NH7VG.js} +1 -1
- package/dist/chunks/{detect-services-TVZ4HYVB.js → detect-services-A2B6KJO5.js} +1 -1
- package/dist/chunks/{disable-N7WZSMD4.js → disable-KA6PS2CZ.js} +1 -1
- package/dist/chunks/{discard-2DN52DNW.js → discard-ZNUPAJTQ.js} +1 -1
- package/dist/chunks/{edit-MGJWXNFV.js → edit-D7VE55ZF.js} +1 -1
- package/dist/chunks/{edit-CALU7PMG.js → edit-YTYYBVZN.js} +1 -1
- package/dist/chunks/{enable-7GKPLJNR.js → enable-Q4OCTJIJ.js} +1 -1
- package/dist/chunks/{exec-QZXH5RXR.js → exec-NMRO6DIZ.js} +2 -2
- package/dist/chunks/{export-BSOJAVDV.js → export-UX6JVWOD.js} +1 -1
- package/dist/chunks/{future-OV5I5HWT.js → future-6UTK4EFE.js} +1 -1
- package/dist/chunks/{generate-cert-for-deploy-GKQRQ3ZQ.js → generate-cert-for-deploy-WDKFR34X.js} +1 -1
- package/dist/chunks/{image-NMQWZBTW.js → image-IL7IN7MD.js} +1 -1
- package/dist/chunks/{import-builders-WLKZNPTB.js → import-builders-FX2XXVRT.js} +1 -1
- package/dist/chunks/{inspect-LZJ5X3PH.js → inspect-E2HPGMNI.js} +1 -1
- package/dist/chunks/{inspect-V7M3GSZ7.js → inspect-F6NLCWHN.js} +1 -1
- package/dist/chunks/{inspect-LF3DIZZ2.js → inspect-UNZR445S.js} +1 -1
- package/dist/chunks/{inspect-PV6VVAN6.js → inspect-UPXTGUJQ.js} +1 -1
- package/dist/chunks/{inspect-UEDFNY5H.js → inspect-YAMAGNIW.js} +1 -1
- package/dist/chunks/{list-AFVTD43R.js → list-FDYB6GHF.js} +1 -1
- package/dist/chunks/{list-64R2DNZA.js → list-G4E6RG3V.js} +1 -1
- package/dist/chunks/{list-QTTCSTZA.js → list-GDI5O246.js} +1 -1
- package/dist/chunks/{login-OS6DZT32.js → login-HU5OFS7T.js} +1 -1
- package/dist/chunks/{login-SKIDVUB7.js → login-XYYNIAMM.js} +1 -1
- package/dist/chunks/{logs-6AXWBF4D.js → logs-EWXTZN4W.js} +1 -1
- package/dist/chunks/{ls-WSPWJDWP.js → ls-3GNX6IPE.js} +1 -1
- package/dist/chunks/{ls-5TZIOB3Q.js → ls-A3HIPTF5.js} +1 -1
- package/dist/chunks/{ls-EADWIBEQ.js → ls-A4NEYMKP.js} +1 -1
- package/dist/chunks/{ls-UP6KDPCD.js → ls-CGZ3NL5R.js} +1 -1
- package/dist/chunks/{ls-723HTK5U.js → ls-MO3R46TQ.js} +1 -1
- package/dist/chunks/{ls-YPQ3CTTN.js → ls-SZKDUJHV.js} +1 -1
- package/dist/chunks/{ls-A5A3APRI.js → ls-TCB7UUPP.js} +1 -1
- package/dist/chunks/{mutate-WHVA5NTT.js → mutate-BQAP2S7A.js} +1 -1
- package/dist/chunks/{notifications-I4PKIOYY.js → notifications-TDSFYYNB.js} +1 -1
- package/dist/chunks/{open-SV3USET3.js → open-YPOEUM3S.js} +1 -1
- package/dist/chunks/{openapi-NZJ6Q5Y2.js → openapi-BQSQNXQE.js} +1 -1
- package/dist/chunks/{permissions-3ZMQVJAQ.js → permissions-6LOJKL5W.js} +1 -1
- package/dist/chunks/{prompt-missing-credentials-44DQQXOI.js → prompt-missing-credentials-IGTCFUA6.js} +1 -1
- package/dist/chunks/{publish-EDLEZCAF.js → publish-CATCXJZG.js} +1 -1
- package/dist/chunks/pull-CXUNHWAO.js +7 -0
- package/dist/chunks/{purchase-domain-if-available-R3YQ2TFP.js → purchase-domain-if-available-4YKWAHH5.js} +1 -1
- package/dist/chunks/{push-6O3JAFDA.js → push-KZZE3AQ3.js} +1 -1
- package/dist/chunks/{query-MYKQOBG3.js → query-GHFOZV7K.js} +1 -1
- package/dist/chunks/{reauthenticate-3UH4WWKC.js → reauthenticate-W7QIXLZ3.js} +1 -1
- package/dist/chunks/{reorder-IU6GZK4H.js → reorder-XU55LOZ5.js} +1 -1
- package/dist/chunks/{reply-FG74YRJ3.js → reply-B2XOCSZD.js} +1 -1
- package/dist/chunks/{resolve-MD3PGOME.js → resolve-H4BZ2QI3.js} +1 -1
- package/dist/chunks/{resolve-agent-team-X6GPGGDR.js → resolve-agent-team-43HZCPF3.js} +1 -1
- package/dist/chunks/{restore-7KOACNT7.js → restore-AJLS2N6C.js} +1 -1
- package/dist/chunks/{rm-JRAF4TPV.js → rm-2TR2KBDP.js} +1 -1
- package/dist/chunks/{rm-SKKBN7LZ.js → rm-IGY6LD6H.js} +1 -1
- package/dist/chunks/{rm-HOE3GJAB.js → rm-N6ZUA66Z.js} +1 -1
- package/dist/chunks/{rm-CSIBWFYG.js → rm-OI5VS7GG.js} +1 -1
- package/dist/chunks/{rm-ZF2F2ZE3.js → rm-ZQUVOC3V.js} +1 -1
- package/dist/chunks/{routes-3RJGIZYJ.js → routes-TCMUHSJF.js} +1 -1
- package/dist/chunks/{rule-inspect-NICYVQPY.js → rule-inspect-NLEABBTP.js} +1 -1
- package/dist/chunks/{rules-NHACEVVC.js → rules-SVLVB6YB.js} +1 -1
- package/dist/chunks/{schema-3XLZGVH5.js → schema-HWS2SOZS.js} +1 -1
- package/dist/chunks/{schema-ZJASGDRI.js → schema-KG4RWQBC.js} +1 -1
- package/dist/chunks/{select-org-XVAGUP4V.js → select-org-AAB5RBSB.js} +1 -1
- package/dist/chunks/{set-JOSIBICX.js → set-AJEMEBZU.js} +1 -1
- package/dist/chunks/setup-and-link-6AIRWXXX.js +7 -0
- package/dist/chunks/{tags-LVP4LVHL.js → tags-O6R6VWPP.js} +1 -1
- package/dist/chunks/{types-YEYQERHE.js → types-Y3NJROKH.js} +1 -1
- package/dist/chunks/{update-HPEVXFST.js → update-C7XR7CHI.js} +1 -1
- package/dist/commands/build/index.js +1 -1
- package/dist/commands/deploy/index.js +4 -4
- package/dist/commands/dev/index.js +2 -2
- package/dist/commands/env/index.js +1 -1
- package/dist/commands/link/index.js +1 -1
- package/dist/commands/list/index.js +1 -1
- package/dist/commands-bulk.js +756 -705
- package/dist/index.js +2 -2
- package/dist/internal-build.js +1 -1
- package/dist/root-help-commands.mjs +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +57 -56
- package/dist/chunks/chunk-EKUHN42H.js +0 -7
- package/dist/chunks/chunk-RIDPB64C.js +0 -10
- package/dist/chunks/pull-5DQNSJCA.js +0 -7
- package/dist/chunks/setup-and-link-7GIAMCTM.js +0 -7
|
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{getGlobalPathConfig}from"./chunk-
|
|
7
|
+
import{getGlobalPathConfig}from"./chunk-MV4WHUIC.js";import{output_manager_default}from"./chunk-M774HRX5.js";var OPENAPI_URL="https://openapi.vercel.sh/",SSO_API_URL="https://vercel.com/sso-api",CACHE_FILE="openapi-spec.json",CACHE_TTL_MS=864e5,FETCH_TIMEOUT_MS=1e4,MAX_OPENAPI_SPEC_BYTES=52428800,VERCEL_CLI_ROOT_DISPLAY_KEY="__root__";async function readSpecResponse(response,url,maxBytes=52428800){let contentLength=response.headers.get("content-length");if(contentLength){let bytes=Number(contentLength);if(Number.isFinite(bytes)&&bytes>maxBytes)throw new Error(`OpenAPI spec from ${url} exceeds the ${maxBytes} byte limit.`)}if(!response.body)throw new Error(`OpenAPI spec from ${url} returned an empty response.`);let reader=response.body.getReader(),chunks=[],totalBytes=0;for(;;){let{done,value}=await reader.read();if(done)break;if(value){if(totalBytes+=value.byteLength,totalBytes>maxBytes)throw await reader.cancel(),new Error(`OpenAPI spec from ${url} exceeds the ${maxBytes} byte limit.`);chunks.push(value)}}let buffer=new Uint8Array(totalBytes),offset=0;for(let chunk of chunks)buffer.set(chunk,offset),offset+=chunk.byteLength;return JSON.parse(new TextDecoder().decode(buffer))}var ALLOWED_SPEC_HOSTS=["vercel.sh","vercel.tools"];function assertAllowedSpecUrl(specUrl){let parsedUrl=new URL(specUrl);if(parsedUrl.protocol!=="https:")throw new Error("OpenAPI spec URL must use https");if(!ALLOWED_SPEC_HOSTS.some(host=>isHostOrSubdomain(parsedUrl,host)))throw new Error("OpenAPI spec URL must be on an allowed origin.");return parsedUrl}function isHostOrSubdomain(url,host){return url.hostname===host||url.hostname.endsWith(`.${host}`)}import{join}from"path";import{readFile,writeFile,mkdir}from"fs/promises";var OpenApiCache=class{constructor(options){this.spec=null;this.error=null;this.cachePath=join(getGlobalPathConfig(),CACHE_FILE),this.specUrl=options?.specUrl,this.fetchSpecUrl=options?.fetchSpecUrl}get isLoaded(){return this.spec!==null}get loadError(){return this.error}async load(forceRefresh=!1){return this.loadSpec(forceRefresh)}async loadSpec(forceRefresh=!1){if(this.error=null,this.specUrl)return this.loadCustomSpec(this.specUrl);if(!forceRefresh){let cached=await this.readCache(this.cachePath);if(cached&&!this.isExpired(cached.fetchedAt))return output_manager_default.debug("Using cached OpenAPI spec"),this.spec=cached.spec,!0}try{return output_manager_default.debug("Fetching OpenAPI spec from "+OPENAPI_URL),this.spec=await this.fetchSpec(OPENAPI_URL),await this.saveCache(this.cachePath,this.spec),!0}catch(err){output_manager_default.debug(`Failed to fetch OpenAPI spec: ${err}`);let stale=await this.readCache(this.cachePath);return stale?(output_manager_default.debug("Using stale cached OpenAPI spec"),this.spec=stale.spec,!0):!1}}async loadCustomSpec(specUrl){try{assertAllowedSpecUrl(specUrl),output_manager_default.debug("Fetching OpenAPI spec from "+specUrl);let spec=this.fetchSpecUrl?await this.fetchSpecUrl(specUrl):await this.fetchSpec(specUrl);return spec?(this.validateSpec(spec,specUrl),this.spec=spec,!!this.spec):(this.error=`Could not load OpenAPI spec from ${specUrl}.`,!1)}catch(err){let message=err instanceof Error?err.message:String(err);return this.error=message,output_manager_default.debug(`Failed to fetch OpenAPI spec from ${specUrl}: ${message}`),!1}}async loadWithSpinner(forceRefresh=!1){output_manager_default.spinner(forceRefresh?"Refreshing API endpoints...":"Loading API endpoints...");let success=await this.load(forceRefresh);return output_manager_default.stopSpinner(),success}getEndpoints(){this.ensureLoaded();let endpoints=this.extractEndpoints();return this.sortEndpoints(endpoints)}getBodyFields(endpoint){if(this.ensureLoaded(),!endpoint.requestBody?.content)return[];let jsonContent=endpoint.requestBody.content["application/json"];if(!jsonContent?.schema)return[];let schema=this.resolveSchemaRef(jsonContent.schema);if(!schema?.properties)return[];let requiredFields=new Set(schema.required||[]),fields=[];for(let[name,propSchema]of Object.entries(schema.properties)){let resolvedProp=this.resolveSchemaRef(propSchema),enumValues=resolvedProp?.enum||propSchema.enum;if(!enumValues&&(resolvedProp?.type==="array"||propSchema.type==="array")){let items=resolvedProp?.items||propSchema.items;items&&(enumValues=this.resolveSchemaRef(items)?.enum||items.enum)}fields.push({name,required:requiredFields.has(name),description:resolvedProp?.description||propSchema.description,type:resolvedProp?.type||propSchema.type,enumValues})}return fields.sort((a,b)=>a.required!==b.required?a.required?-1:1:a.name.localeCompare(b.name)),fields}getDisplayColumns(endpoint){this.ensureLoaded();let pathItem=this.spec.paths[endpoint.path];if(!pathItem)return null;let operation=pathItem[endpoint.method.toLowerCase()];if(!operation?.responses)return null;let ok=operation.responses[200]||operation.responses[201];if(!ok)return null;let jsonContent=ok.content?.["application/json"];return jsonContent?.schema?this.findDisplayColumns(jsonContent.schema):null}findDisplayColumns(schema){let xCli=schema["x-vercel-cli"];if(xCli?.displayColumns)return xCli.displayColumns;for(let key of["oneOf","allOf","anyOf"]){let variants=schema[key];if(variants)for(let sub of variants){let found=this.findDisplayColumns(sub);if(found)return found}}return null}ensureLoaded(){if(!this.spec)throw new Error("OpenAPI spec not loaded. Call load() or loadWithSpinner() first.")}async readCache(cachePath){try{let content=await readFile(cachePath,"utf-8");return JSON.parse(content)}catch{return null}}async saveCache(cachePath,spec){let cached={fetchedAt:Date.now(),spec},dir=join(cachePath,"..");await mkdir(dir,{recursive:!0}),await writeFile(cachePath,JSON.stringify(cached)),output_manager_default.debug("Saved OpenAPI spec to cache")}async fetchSpec(url){let controller=new AbortController,timeoutId=setTimeout(()=>controller.abort(),1e4);try{let response=await fetch(url,{signal:controller.signal});if(!response.ok)throw new Error(`Failed to fetch OpenAPI spec: ${response.status}`);let spec=await readSpecResponse(response,url);return this.validateSpec(spec,url),spec}finally{clearTimeout(timeoutId)}}validateSpec(spec,url){if(!spec||typeof spec!="object")throw new Error(`Invalid OpenAPI spec from ${url}: expected a JSON object.`);if(typeof spec.openapi!="string"||!spec.openapi.startsWith("3."))throw new Error(`Invalid OpenAPI spec from ${url}: expected an OpenAPI 3.x document with an "openapi" field.`);if(!spec.paths||typeof spec.paths!="object")throw new Error(`Invalid OpenAPI spec from ${url}: expected a "paths" object.`);for(let path of Object.keys(spec.paths))if(!path.startsWith("/")||path.startsWith("//"))throw new Error(`Invalid OpenAPI spec from ${url}: path "${path}" must be a relative API path.`)}isExpired(fetchedAt){return Date.now()-fetchedAt>864e5}sortEndpoints(endpoints){return endpoints.sort((a,b)=>{let pathCompare=a.path.localeCompare(b.path);return pathCompare!==0?pathCompare:a.method.localeCompare(b.method)})}extractEndpoints(){let endpoints=[];for(let[path,pathItem]of Object.entries(this.spec.paths)){let methods=["get","post","put","patch","delete"];for(let method of methods){let operation=pathItem[method];if(operation){let pathParams=pathItem.parameters||[],opParams=operation.parameters||[],allParams=[...pathParams,...opParams];endpoints.push({path,method:method.toUpperCase(),summary:operation.summary||pathItem.summary||"",description:operation.description||pathItem.description||"",operationId:operation.operationId||"",tags:operation.tags||[],parameters:allParams,requestBody:operation.requestBody})}}}return endpoints}resolveSchemaRef(schema,spec=this.spec){if(schema){if(schema.$ref){let match=schema.$ref.match(/^#\/components\/schemas\/(.+)$/);if(match&&spec.components?.schemas){let resolved=spec.components.schemas[match[1]];return this.resolveSchemaRef(resolved,spec)}return}if(schema.allOf&&schema.allOf.length>0){let merged={type:"object",properties:{},required:[]};for(let subSchema of schema.allOf){let resolved=this.resolveSchemaRef(subSchema,spec);resolved&&(resolved.properties&&(merged.properties={...merged.properties,...resolved.properties}),resolved.required&&(merged.required=[...merged.required||[],...resolved.required]))}return merged}return schema}}};async function matchesCliApiTag(tagHint){if(!tagHint||tagHint.startsWith("-")||tagHint.includes("/"))return!1;let cache=new OpenApiCache;if(!await cache.load())return!1;let endpoints=cache.getEndpoints(),lower=tagHint.toLowerCase();return endpoints.some(ep=>ep.tags.some(t=>t.toLowerCase()===lower))}async function resolveOpenApiTagForProjectsCli(){return await matchesCliApiTag("projects")?"projects":await matchesCliApiTag("project")?"project":null}async function resolveOpenApiTagForTeamsCli(){return await matchesCliApiTag("teams")?"teams":await matchesCliApiTag("team")?"team":null}export{OPENAPI_URL,SSO_API_URL,CACHE_FILE,CACHE_TTL_MS,FETCH_TIMEOUT_MS,MAX_OPENAPI_SPEC_BYTES,VERCEL_CLI_ROOT_DISPLAY_KEY,readSpecResponse,assertAllowedSpecUrl,OpenApiCache,matchesCliApiTag,resolveOpenApiTagForProjectsCli,resolveOpenApiTagForTeamsCli};
|
|
@@ -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{ellipsis}from"./chunk-F4KY2TOK.js";import{require_ms}from"./chunk-MXTC4ZAQ.js";import{ALIGNED_LABEL_WIDTH}from"./chunk-
|
|
7
|
+
import{ellipsis}from"./chunk-F4KY2TOK.js";import{require_ms}from"./chunk-MXTC4ZAQ.js";import{ALIGNED_LABEL_WIDTH}from"./chunk-IJCCFLCQ.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1),import_ms=__toESM(require_ms(),1);function alignedRow(label,value){return` ${import_chalk.default.bold(label.padEnd(ALIGNED_LABEL_WIDTH))}${value}`}function actorLabel(actor){if(!actor)return"-";let base=actor.name||actor.username||actor.id;return actor.type==="app"?`${base} (app)`:base}function relativeAge(timestamp){if(!timestamp||!Number.isFinite(timestamp))return"-";let delta=Date.now()-timestamp;return delta<1e3?"now":(0,import_ms.default)(delta)}function displayPath(thread){let href=thread.context?.href;if(href)try{return new URL(href).pathname}catch{}return thread.context?.path||"/"}function truncate(text,max){return ellipsis(text.replace(/\s+/g," ").trim(),max)}function firstMessageText(thread){return thread.messages[0]?.text??""}function threadAge(thread){return relativeAge(thread.messages[0]?.timestamp)}function renderThreadSummary(thread,complete){let replies=thread.messageCount-1,rootAuthorId=complete?thread.messages[0]?.author.id:void 0,names=[],seen=new Set;for(let message of thread.messages){let{author}=message;author.id===rootAuthorId||seen.has(author.id)||(seen.add(author.id),names.push(actorLabel(author)))}let shown=names.slice(0,3),overflow=names.length-shown.length,participants=shown.length>0?`${shown.join(", ")}${overflow>0?` +${overflow} more`:""}`:void 0,lastTimestamp=thread.messages[thread.messages.length-1]?.timestamp,parts=[`\u2192 ${replies} ${replies===1?"reply":"replies"}`];return participants&&parts.push(participants),parts.push(`last ${relativeAge(lastTimestamp)} ago`),parts.join(" \xB7 ")}function renderThreadRow(thread,opts){let complete=thread.messageCount<=thread.messages.length,dot=thread.resolved?import_chalk.default.dim("\u25CB"):"\u25CF",author=complete?actorLabel(thread.messages[0]?.author):"\u2026",columns=[dot,thread.id,import_chalk.default.dim(threadAge(thread)),author,displayPath(thread)];opts.showBranch&&thread.branch&&columns.push(import_chalk.default.dim(thread.branch)),thread.isLocalhost&&columns.push(import_chalk.default.dim("localhost"));let lines=[` ${columns.join(" ")}`];if(complete){let excerpt=truncate(firstMessageText(thread),80);excerpt&&lines.push(` \u201C${excerpt}\u201D`)}else lines.push(import_chalk.default.dim(" (long thread \u2014 inspect for the full conversation)"));let selection=thread.context?.selection;selection&&lines.push(import_chalk.default.dim(` \u2192 selected: \u201C${truncate(selection,60)}\u201D`)),thread.messageCount>1&&lines.push(import_chalk.default.dim(` ${renderThreadSummary(thread,complete)}`));let meta=[],reactionCount=thread.messages.reduce((acc,message)=>acc+(message.reactions?.length??0),0);reactionCount>0&&meta.push(`${reactionCount} ${reactionCount===1?"reaction":"reactions"}`);let attachmentCount=thread.messages.reduce((acc,message)=>acc+(message.attachments?.length??0),0);return attachmentCount>0&&meta.push(`${attachmentCount} ${attachmentCount===1?"attachment":"attachments"}`),thread.resolved&&meta.push(`resolved by ${actorLabel(thread.resolvedBy)}`),meta.length>0&&lines.push(import_chalk.default.dim(` ${meta.join(" \xB7 ")}`)),lines.join(`
|
|
8
8
|
`)}function renderReactions(message){if(!(!message.reactions||message.reactions.length===0))return message.reactions.map(r=>`${r.emoji} ${r.name} \xB7 ${r.users.length}`).join(" ")}function renderMessage(message){let lines=[`${import_chalk.default.bold(actorLabel(message.author))} \xB7 ${relativeAge(message.timestamp)} ago \xB7 ${import_chalk.default.dim(message.id)}`];for(let textLine of message.text.split(`
|
|
9
9
|
`))lines.push(` ${textLine}`);for(let attachment of message.attachments??[]){let dimensions=attachment.width&&attachment.height?` (${attachment.width}\xD7${attachment.height})`:"";lines.push(`${import_chalk.default.dim(` \u2192 attachment ${attachment.filename}${dimensions}`)} ${import_chalk.default.cyan(attachment.url)}`)}let reactions=renderReactions(message);return reactions&&lines.push(` ${reactions}`),lines.join(`
|
|
10
10
|
`)}function renderThreadDetail(thread,messages,opts){let sections=[],status=thread.resolved?import_chalk.default.dim(`resolved by ${actorLabel(thread.resolvedBy)}`):"unresolved",headline=[import_chalk.default.bold(thread.id),status];thread.branch&&headline.push(import_chalk.default.dim(thread.branch)),thread.isLocalhost&&headline.push(import_chalk.default.dim("localhost")),sections.push(headline.join(" \xB7 "));let headerLines=[],path=displayPath(thread),pageTitle=thread.context?.pageTitle;headerLines.push(pageTitle?`${path} \u2014 \u201C${pageTitle}\u201D`:path),thread.context?.href&&headerLines.push(import_chalk.default.cyan(thread.context.href)),sections.push(headerLines.join(`
|
|
@@ -9,7 +9,7 @@ import{require_minimatch2 as require_minimatch}from"./chunk-BLAIBYEU.js";import{
|
|
|
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 readFile(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,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_lib=__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_lib2=__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},__toESM=(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_extra=__toESM(require_lib()),import_async_sema=require_lib2(),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_extra.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_extra.default.lstat(name),mode=stat.mode,data,size,isDirectory=stat.isDirectory(),h;if(!isDirectory)if(stat.isSymbolicLink()){let link=await import_fs_extra.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_extra.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_errors=__commonJS({"../client/dist/errors.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),errors_exports={};__export(errors_exports,{DeploymentError:()=>DeploymentError});module.exports=__toCommonJS(errors_exports);var DeploymentError=class extends Error{constructor(err){super(err.message),this.code=err.code,this.errorName=err.name,this.name="DeploymentError"}}}});var require_network_error=__commonJS({"../client/dist/utils/network-error.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),network_error_exports={};__export(network_error_exports,{formatNetworkError:()=>formatNetworkError,isRetryableNetworkError:()=>isRetryableNetworkError});module.exports=__toCommonJS(network_error_exports);var retryableCodes=new Set(["ETIMEDOUT","ECONNREFUSED","ENOTFOUND","ECONNRESET","EAI_FAIL","EAI_AGAIN","EPIPE","ENETUNREACH","EHOSTUNREACH","UND_ERR_CONNECT_TIMEOUT","UND_ERR_HEADERS_TIMEOUT","UND_ERR_BODY_TIMEOUT","UND_ERR_SOCKET"]);function isRetryableNetworkError(error,depth=0){if(!(error instanceof Error)||depth>5||error.name==="AbortError")return!1;let err=error;return err.code?retryableCodes.has(err.code):Array.isArray(err.errors)&&err.errors.length>0?err.errors.every(child=>isRetryableNetworkError(child,depth+1)):err.cause?isRetryableNetworkError(err.cause,depth+1):/ETIMEDOUT|ECONNREFUSED|ENOTFOUND|ECONNRESET|EAI_FAIL|socket hang up|network socket disconnected/.test(err.message)}function formatNetworkError(error,depth=0){if(!(error instanceof Error))return"Unknown error";if(depth>5)return"[truncated]";let err=error,fields=[];for(let value of[err.name,err.code])typeof value=="string"&&/^[a-zA-Z_][a-zA-Z0-9_]{0,63}$/.test(value)&&fields.push(value);return Array.isArray(err.errors)&&fields.push(`[${err.errors.slice(0,5).map(child=>formatNetworkError(child,depth+1)).join(", ")}]`),err.cause&&fields.push(`cause=(${formatNetworkError(err.cause,depth+1)})`),fields.join(" ")||"Error"}}});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.8.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},__toESM=(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=__toESM(__require("fs")),import_path=__toESM(__require("path")),import_minimatch=__toESM(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_path.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},__toESM=(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_network_error=require_network_error(),import_path=__require("path"),import_stream=__require("stream"),import_url=__require("url"),import_ignore=__toESM(require_ignore()),import_pkg=require_pkg(),import_build_utils=__require("@vercel/build-utils"),import_async_sema=require_lib2(),import_fs_extra=require_lib(),import_readdir_recursive=__toESM(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_extra.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_extra.readFile)(path,"utf8")}catch{return default_}};async function getUserIgnore(cwd){let[vercelignore,nowignore]=await Promise.all([maybeRead((0,import_path.join)(cwd,".vercelignore"),""),maybeRead((0,import_path.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)),ignoreFile,ignoreFileName:vercelignore?".vercelignore":".nowignore"}:null}var VCS_DEFAULTS=[".hg",".git",".gitmodules",".svn","CVS"],filePathMapVcsDefaults=(0,import_ignore.default)().add(VCS_DEFAULTS),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,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_lib=__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_lib2=__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},__toESM=(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_extra=__toESM(require_lib()),import_async_sema=require_lib2(),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_extra.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_extra.default.lstat(name),mode=stat.mode,data,size,isDirectory=stat.isDirectory(),h;if(!isDirectory)if(stat.isSymbolicLink()){let link=await import_fs_extra.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_extra.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_errors=__commonJS({"../client/dist/errors.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),errors_exports={};__export(errors_exports,{DeploymentError:()=>DeploymentError});module.exports=__toCommonJS(errors_exports);var DeploymentError=class extends Error{constructor(err){super(err.message),this.code=err.code,this.errorName=err.name,this.name="DeploymentError"}}}});var require_network_error=__commonJS({"../client/dist/utils/network-error.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),network_error_exports={};__export(network_error_exports,{formatNetworkError:()=>formatNetworkError,isRetryableNetworkError:()=>isRetryableNetworkError});module.exports=__toCommonJS(network_error_exports);var retryableCodes=new Set(["ETIMEDOUT","ECONNREFUSED","ENOTFOUND","ECONNRESET","EAI_FAIL","EAI_AGAIN","EPIPE","ENETUNREACH","EHOSTUNREACH","UND_ERR_CONNECT_TIMEOUT","UND_ERR_HEADERS_TIMEOUT","UND_ERR_BODY_TIMEOUT","UND_ERR_SOCKET"]);function isRetryableNetworkError(error,depth=0){if(!(error instanceof Error)||depth>5||error.name==="AbortError")return!1;let err=error;return err.code?retryableCodes.has(err.code):Array.isArray(err.errors)&&err.errors.length>0?err.errors.every(child=>isRetryableNetworkError(child,depth+1)):err.cause?isRetryableNetworkError(err.cause,depth+1):/ETIMEDOUT|ECONNREFUSED|ENOTFOUND|ECONNRESET|EAI_FAIL|socket hang up|network socket disconnected/.test(err.message)}function formatNetworkError(error,depth=0){if(!(error instanceof Error))return"Unknown error";if(depth>5)return"[truncated]";let err=error,fields=[];for(let value of[err.name,err.code])typeof value=="string"&&/^[a-zA-Z_][a-zA-Z0-9_]{0,63}$/.test(value)&&fields.push(value);return Array.isArray(err.errors)&&fields.push(`[${err.errors.slice(0,5).map(child=>formatNetworkError(child,depth+1)).join(", ")}]`),err.cause&&fields.push(`cause=(${formatNetworkError(err.cause,depth+1)})`),fields.join(" ")||"Error"}}});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.8.6",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},__toESM=(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=__toESM(__require("fs")),import_path=__toESM(__require("path")),import_minimatch=__toESM(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_path.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},__toESM=(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_network_error=require_network_error(),import_path=__require("path"),import_stream=__require("stream"),import_url=__require("url"),import_ignore=__toESM(require_ignore()),import_pkg=require_pkg(),import_build_utils=__require("@vercel/build-utils"),import_async_sema=require_lib2(),import_fs_extra=require_lib(),import_readdir_recursive=__toESM(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_extra.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_extra.readFile)(path,"utf8")}catch{return default_}};async function getUserIgnore(cwd){let[vercelignore,nowignore]=await Promise.all([maybeRead((0,import_path.join)(cwd,".vercelignore"),""),maybeRead((0,import_path.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)),ignoreFile,ignoreFileName:vercelignore?".vercelignore":".nowignore"}:null}var VCS_DEFAULTS=[".hg",".git",".gitmodules",".svn","CVS"],filePathMapVcsDefaults=(0,import_ignore.default)().add(VCS_DEFAULTS),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_WARNING_LIST_LIMIT=100;function findMatchingIgnoreRule(ignoreFile,posixRel){let matcher=(0,import_ignore.default)(),wasIgnored=!1,match={};for(let[index,rule]of ignoreFile.split(/\r?\n/).entries()){matcher.add(clearRelative(rule));let isIgnored=matcher.ignores(posixRel);!wasIgnored&&isIgnored?match={rule,line:index+1}:wasIgnored&&!isIgnored&&(match={}),wasIgnored=isIgnored}return match}function formatFilePathMapIgnoreWarning(entries,ignoreFileName,truncated=!1){let shown=entries.slice(0,FILEPATHMAP_IGNORE_WARNING_LIST_LIMIT),lines=shown.map(({path,rule,line})=>rule&&line?` ${path} (matched \`${ignoreFileName}:${line}\`: \`${rule}\`)`:` ${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. Uploading without them may fail with ENOENT.`,"",...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_path.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_path.basename)(file)===".vc-config.json"),userIg=await getUserIgnore(path),ignoredFilePathMap=new Map,ignoredFilePathMapTruncated=!1,vcConfigs=await Promise.all(vcConfigFilePaths.map(async p=>{let configJson=await(0,import_fs_extra.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_path.join)(path,v),rel=(0,import_path.relative)(path,absPath),posixRel=rel.split(import_path.sep).join("/");if(rel.startsWith("..")||(0,import_path.isAbsolute)(rel)){debug(`Ignoring "filePathMap" entry "${v}": resolves outside the deployment root`);continue}if(filePathMapVcsDefaults.ignores(posixRel))throw new import_build_utils.NowBuildError({code:"PREBUILT_FILEPATHMAP_VCS",message:"Prebuilt functions reference version-control files that cannot be uploaded. Exclude version-control files from tracing and rebuild the prebuilt output."});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_WARNING_LIST_LIMIT){ignoredFilePathMapTruncated=!0;continue}else{ignoredFilePathMap.set(posixRel,findMatchingIgnoreRule(userIg.ignoreFile,posixRel));continue}}refs.add(absPath)}if(ignoredFilePathMap.size>0){let violations=[...ignoredFilePathMap.entries()].sort(([a],[b])=>a.localeCompare(b)).map(([ignoredPath,match])=>({path:ignoredPath,...match}));warning=formatFilePathMapIgnoreWarning(violations,userIg?.ignoreFileName||".vercelignore",ignoredFilePathMapTruncated)}try{let{findConfig:findMicrofrontendsConfig,inferMicrofrontendsLocation}=await import("./utils-IQZEE4DT.js"),customConfigFilename=void 0,microfrontendConfigPath=findMicrofrontendsConfig({dir:(0,import_path.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_path.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_path.join)(projectRoot,rootDirectory||"",bulkRedirectsPath);if((0,import_path.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_extra.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_path.relative)(cwd,vercelOutputDir);ignores=["*"];let parts=relOutputDir.split(import_path.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=[...VCS_DEFAULTS,".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"];let cwds=Array.isArray(cwd)?cwd:[cwd],files=await Promise.all(cwds.map(async cwd2=>{let[vercelignore,nowignore]=await Promise.all([maybeRead((0,import_path.join)(cwd2,".vercelignore"),""),maybeRead((0,import_path.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_extra.pathExists)((0,import_path.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{noBorderChars,require_cli_table3}from"./chunk-773GOZIR.js";import{require_dist}from"./chunk-
|
|
8
|
-
`,tableOptions={chars:noBorderChars,style:{"padding-left":0,"padding-right":0}};function wordWrap(text,maxWidth){let _tableOptions=Object.assign({},tableOptions,{colWidths:[maxWidth],style:{"padding-left":INDENT.length}}),table=new import_cli_table3.default(_tableOptions);return table.push([{content:text,wordWrap:!0}]),table.toString()}function lineToString(line){let string="";for(let i=0;i<line.length;i++)if(i===line.length-1)string+=line[i];else{let curr=line[i],next=line[i+1];string+=curr,curr.trim()!==""&&next.trim()!==""&&(string+=" ")}return string}function outputArrayToString(outputArray){return outputArray.filter(line=>line!==null).join(NEWLINE)}var commandPaths=new WeakMap;function registerCommandPaths(roots){let visit=(command,parentPath)=>{let path=[...parentPath,command.name];commandPaths.has(command)||commandPaths.set(command,path);for(let subcommand of command.subcommands??[])visit(subcommand,path)};for(let root of roots)visit(root,[])}function getCommandPath(command,parent){let registered=commandPaths.get(command);return registered||(parent?[parent.name,command.name]:[command.name])}function buildCommandSynopsisLine(command,parent){let line=[INDENT,import_constants.LOGO,import_chalk.default.bold(import_constants.NAME)];for(let name of getCommandPath(command,parent))line.push(import_chalk.default.bold(name));let args=command.arguments.slice(0);if(args.length===0&&command.subcommands&&command.subcommands.length>0&&args.push({name:"command",required:!command.subcommands.some(subcommand=>subcommand.default)}),args.length>0)for(let argument of args){let{name}=argument;argument.multiple&&(name+=" ..."),line.push(argument.required?name:`[${name}]`)}return command.options.length>0&&line.push("[options]"),line.push(NEWLINE),lineToString(line)}function buildCommandOptionLines(commandOptions,options,sectionTitle){let filteredCommandOptions=commandOptions.filter(option=>!option.deprecated&&option.description!==void 0);if(filteredCommandOptions.length===0)return null;filteredCommandOptions.sort((a,b)=>a.name<b.name?-1:a.name>b.name?1:0);let maxWidthOfUnwrappedColumns=0,rows=[];for(let option of filteredCommandOptions){let shorthandCell=option.shorthand?`${INDENT}-${option.shorthand},`:"",longhandCell=`${INDENT}--${option.name}`;option.argument&&(longhandCell+=` <${option.argument}>`),longhandCell+=INDENT;let widthOfUnwrappedColumns=shorthandCell.length+longhandCell.length;maxWidthOfUnwrappedColumns=Math.max(widthOfUnwrappedColumns,maxWidthOfUnwrappedColumns),rows.push([shorthandCell,longhandCell,{content:option.description,wordWrap:!0}])}let finalColumnWidth=options.columns-maxWidthOfUnwrappedColumns,table=new import_cli_table3.default(Object.assign({},tableOptions,{colWidths:[null,null,finalColumnWidth]}));return table.push(...rows),[`${INDENT}${import_chalk.default.dim(sectionTitle)}:`,NEWLINE,NEWLINE,table.toString(),NEWLINE,NEWLINE].join("")}function buildSubcommandLines(subcommands,options,title="Commands"){if(!subcommands)return null;let maxWidthOfUnwrappedColumns=0,rows=[];for(let command of subcommands){if(command.hidden)continue;let nameCell=`${INDENT}${command.name}`,argsCell=INDENT;argsCell+=command.arguments.map(arg=>arg.required?arg.name:`[${arg.name}]`).join(" "),argsCell+=INDENT;let widthOfUnwrappedColumns=nameCell.length+argsCell.length;maxWidthOfUnwrappedColumns=Math.max(widthOfUnwrappedColumns,maxWidthOfUnwrappedColumns),rows.push([nameCell,argsCell,{content:command.default?`${command.summary??command.description} ${import_chalk.default.bold("(default)")}`:command.summary??command.description,wordWrap:!0}])}let rightMargin=INDENT.repeat(4).length,finalColumnWidth=options.columns-maxWidthOfUnwrappedColumns-rightMargin,table=new import_cli_table3.default(Object.assign({},tableOptions,{colWidths:[null,null,finalColumnWidth]}));return rows.length===0?null:(table.push(...rows),[`${INDENT}${import_chalk.default.dim(title)}:`,NEWLINE,NEWLINE,table.toString(),NEWLINE,NEWLINE].join(""))}function buildCommandExampleLines(command){if(!command.examples?.length)return null;let outputArray=[`${INDENT}${import_chalk.default.dim("Examples:")}`,""];for(let example of command.examples){let nameLine=[INDENT];nameLine.push(import_chalk.default.gray("-")),nameLine.push(example.name),outputArray.push(lineToString(nameLine)),outputArray.push("");let buildValueLine=value=>lineToString([INDENT,INDENT,import_chalk.default.cyan(`$ ${value}`)]);if(Array.isArray(example.value))for(let line of example.value)outputArray.push(buildValueLine(line));else outputArray.push(buildValueLine(example.value));outputArray.push("")}return outputArrayToString(outputArray)}function buildCommandDocumentationLines(command,options){if(options.omitDocumentation)return null;let documentation=command.documentation??options.parent?.documentation;return documentation?outputArrayToString([`${INDENT}${import_chalk.default.dim(`${documentation.label}:`)}`,"",lineToString([INDENT,INDENT,import_chalk.default.cyan(documentation.url)]),""]):null}function buildDescriptionLine(command,options){return`${wordWrap(command.description,options.columns)}${NEWLINE}`}function buildHelpOutput(command,options){let filteredGlobalOptions=command.disabledGlobalOptions?globalCommandOptions.filter(opt=>!command.disabledGlobalOptions?.includes(opt.name)):globalCommandOptions,sections=command.helpSections??[],buildSection=section=>outputArrayToString([`${INDENT}${import_chalk.default.dim(`${section.title}:`)}`,"",...section.body.map(line=>line===""?"":wordWrap(line,options.columns)),""]),outputArray=["",buildCommandSynopsisLine(command,options.parent),buildDescriptionLine(command,options),buildSubcommandLines(command.subcommands,options,command.subcommandsTitle),buildCommandOptionLines(command.options,options,"Options"),...sections.filter(section=>section.placement==="afterOptions").map(buildSection),buildCommandOptionLines(filteredGlobalOptions,options,"Global Options"),buildCommandExampleLines(command),...sections.filter(section=>section.placement!=="afterOptions").map(buildSection),buildCommandDocumentationLines(command,options),""];return outputArrayToString(outputArray)}function help(command,options){return buildHelpOutput(command,{...options,columns:options.columns??80})}function findOption(token,options){let isLong=token.startsWith("--"),name=isLong?token.slice(2):token.slice(1);return options.find(candidate=>isLong?candidate.name===name:candidate.shorthand===name)}function subtreeOptions(command){return[...command.options,...(command.subcommands??[]).flatMap(subtreeOptions)]}function isSubcommandOf(command,token){return token!==void 0&&(command.subcommands??[]).some(subcommand=>subcommand.name===token||subcommand.aliases.includes(token))}function optionTakesValue(token,walkedOptions,command,nextToken){let walked=findOption(token,walkedOptions);if(walked)return walked.type!==Boolean;let below=findOption(token,subtreeOptions(command));
|
|
7
|
+
import{noBorderChars,require_cli_table3}from"./chunk-773GOZIR.js";import{require_dist}from"./chunk-KUGXOLL7.js";import{globalCommandOptions}from"./chunk-MI7W4QMV.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1),import_constants=__toESM(require_dist(),1),import_cli_table3=__toESM(require_cli_table3(),1);var INDENT=" ".repeat(2),NEWLINE=`
|
|
8
|
+
`,tableOptions={chars:noBorderChars,style:{"padding-left":0,"padding-right":0}};function wordWrap(text,maxWidth){let _tableOptions=Object.assign({},tableOptions,{colWidths:[maxWidth],style:{"padding-left":INDENT.length}}),table=new import_cli_table3.default(_tableOptions);return table.push([{content:text,wordWrap:!0}]),table.toString()}function lineToString(line){let string="";for(let i=0;i<line.length;i++)if(i===line.length-1)string+=line[i];else{let curr=line[i],next=line[i+1];string+=curr,curr.trim()!==""&&next.trim()!==""&&(string+=" ")}return string}function outputArrayToString(outputArray){return outputArray.filter(line=>line!==null).join(NEWLINE)}var commandPaths=new WeakMap;function registerCommandPaths(roots){let visit=(command,parentPath)=>{let path=[...parentPath,command.name];commandPaths.has(command)||commandPaths.set(command,path);for(let subcommand of command.subcommands??[])visit(subcommand,path)};for(let root of roots)visit(root,[])}function getCommandPath(command,parent){let registered=commandPaths.get(command);return registered||(parent?[parent.name,command.name]:[command.name])}function buildCommandSynopsisLine(command,parent){let line=[INDENT,import_constants.LOGO,import_chalk.default.bold(import_constants.NAME)];for(let name of getCommandPath(command,parent))line.push(import_chalk.default.bold(name));let args=command.arguments.slice(0);if(args.length===0&&command.subcommands&&command.subcommands.length>0&&args.push({name:"command",required:!command.subcommands.some(subcommand=>subcommand.default)}),args.length>0)for(let argument of args){let{name}=argument;argument.multiple&&(name+=" ..."),line.push(argument.required?name:`[${name}]`)}return command.options.length>0&&line.push("[options]"),line.push(NEWLINE),lineToString(line)}function buildCommandOptionLines(commandOptions,options,sectionTitle){let filteredCommandOptions=commandOptions.filter(option=>!option.deprecated&&option.description!==void 0);if(filteredCommandOptions.length===0)return null;filteredCommandOptions.sort((a,b)=>a.name<b.name?-1:a.name>b.name?1:0);let maxWidthOfUnwrappedColumns=0,rows=[];for(let option of filteredCommandOptions){let shorthandCell=option.shorthand?`${INDENT}-${option.shorthand},`:"",longhandCell=`${INDENT}--${option.name}`;option.argument&&(longhandCell+=` <${option.argument}>`),longhandCell+=INDENT;let widthOfUnwrappedColumns=shorthandCell.length+longhandCell.length;maxWidthOfUnwrappedColumns=Math.max(widthOfUnwrappedColumns,maxWidthOfUnwrappedColumns),rows.push([shorthandCell,longhandCell,{content:option.description,wordWrap:!0}])}let finalColumnWidth=options.columns-maxWidthOfUnwrappedColumns,table=new import_cli_table3.default(Object.assign({},tableOptions,{colWidths:[null,null,finalColumnWidth]}));return table.push(...rows),[`${INDENT}${import_chalk.default.dim(sectionTitle)}:`,NEWLINE,NEWLINE,table.toString(),NEWLINE,NEWLINE].join("")}function buildSubcommandLines(subcommands,options,title="Commands"){if(!subcommands)return null;let maxWidthOfUnwrappedColumns=0,rows=[];for(let command of subcommands){if(command.hidden)continue;let nameCell=`${INDENT}${command.name}`,argsCell=INDENT;argsCell+=command.arguments.map(arg=>arg.required?arg.name:`[${arg.name}]`).join(" "),argsCell+=INDENT;let widthOfUnwrappedColumns=nameCell.length+argsCell.length;maxWidthOfUnwrappedColumns=Math.max(widthOfUnwrappedColumns,maxWidthOfUnwrappedColumns),rows.push([nameCell,argsCell,{content:command.default?`${command.summary??command.description} ${import_chalk.default.bold("(default)")}`:command.summary??command.description,wordWrap:!0}])}let rightMargin=INDENT.repeat(4).length,finalColumnWidth=options.columns-maxWidthOfUnwrappedColumns-rightMargin,table=new import_cli_table3.default(Object.assign({},tableOptions,{colWidths:[null,null,finalColumnWidth]}));return rows.length===0?null:(table.push(...rows),[`${INDENT}${import_chalk.default.dim(title)}:`,NEWLINE,NEWLINE,table.toString(),NEWLINE,NEWLINE].join(""))}function buildCommandExampleLines(command){if(!command.examples?.length)return null;let outputArray=[`${INDENT}${import_chalk.default.dim("Examples:")}`,""];for(let example of command.examples){let nameLine=[INDENT];nameLine.push(import_chalk.default.gray("-")),nameLine.push(example.name),outputArray.push(lineToString(nameLine)),outputArray.push("");let buildValueLine=value=>lineToString([INDENT,INDENT,import_chalk.default.cyan(`$ ${value}`)]);if(Array.isArray(example.value))for(let line of example.value)outputArray.push(buildValueLine(line));else outputArray.push(buildValueLine(example.value));outputArray.push("")}return outputArrayToString(outputArray)}function buildCommandDocumentationLines(command,options){if(options.omitDocumentation)return null;let documentation=command.documentation??options.parent?.documentation;return documentation?outputArrayToString([`${INDENT}${import_chalk.default.dim(`${documentation.label}:`)}`,"",lineToString([INDENT,INDENT,import_chalk.default.cyan(documentation.url)]),""]):null}function buildDescriptionLine(command,options){return`${wordWrap(command.description,options.columns)}${NEWLINE}`}function buildHelpOutput(command,options){let filteredGlobalOptions=command.disabledGlobalOptions?globalCommandOptions.filter(opt=>!command.disabledGlobalOptions?.includes(opt.name)):globalCommandOptions,sections=command.helpSections??[],buildSection=section=>outputArrayToString([`${INDENT}${import_chalk.default.dim(`${section.title}:`)}`,"",...section.body.map(line=>line===""?"":wordWrap(line,options.columns)),""]),outputArray=["",buildCommandSynopsisLine(command,options.parent),buildDescriptionLine(command,options),buildSubcommandLines(command.subcommands,options,command.subcommandsTitle),buildCommandOptionLines(command.options,options,"Options"),...sections.filter(section=>section.placement==="afterOptions").map(buildSection),buildCommandOptionLines(filteredGlobalOptions,options,"Global Options"),buildCommandExampleLines(command),...sections.filter(section=>section.placement!=="afterOptions").map(buildSection),buildCommandDocumentationLines(command,options),""];return outputArrayToString(outputArray)}function help(command,options){return buildHelpOutput(command,{...options,columns:options.columns??80})}function findOption(token,options){let isLong=token.startsWith("--"),name=isLong?token.slice(2):token.slice(1);return options.find(candidate=>isLong?candidate.name===name:candidate.shorthand===name)}function subtreeOptions(command){return[...command.options,...(command.subcommands??[]).flatMap(subtreeOptions)]}function isSubcommandOf(command,token){return token!==void 0&&(command.subcommands??[]).some(subcommand=>subcommand.name===token||subcommand.aliases.includes(token))}function optionTakesValue(token,walkedOptions,command,nextToken){let walked=findOption(token,walkedOptions);if(walked)return walked.type!==Boolean;let below=findOption(token,subtreeOptions(command)),global=findOption(token,globalCommandOptions);return below&&below.type!==Boolean&&(!global||global.type!==Boolean||!isSubcommandOf(command,nextToken))?!0:global!==void 0&&global.type!==Boolean}function resolveHelpTarget(root,tokens){let command=root,ancestors=[],typedPath=[],options=[...root.options],groupArguments=0,unknownSegment;for(let i=0;i<tokens.length;i++){let token=tokens[i];if(token==="--")break;if(token.startsWith("-")){!token.includes("=")&&optionTakesValue(token,options,command,tokens[i+1])&&i++;continue}let subcommand=command.subcommands?.find(candidate=>candidate.name===token||candidate.aliases.includes(token));if(!subcommand){if(command.argumentsBeforeSubcommand&&groupArguments<command.arguments.length){groupArguments++;continue}command.subcommands?.length&&command.arguments.length===0&&!command.runsWithoutSubcommand&&!command.subcommands.some(candidate=>candidate.default)&&(unknownSegment=token);break}ancestors.push(command),typedPath.push(token),options.push(...subcommand.options),command=subcommand,groupArguments=0}let parent=ancestors[ancestors.length-1];for(let i=ancestors.length-1;i>=0;i--)if(ancestors[i].documentation){parent=ancestors[i];break}return{command,parent,typedPath,unknownSegment}}export{registerCommandPaths,buildCommandDocumentationLines,help,resolveHelpTarget};
|