@vercel/cli-support 0.0.0 → 65.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +100 -3
- package/dist/chunks/add-7NS6HIWC.js +8 -0
- package/dist/chunks/add-NMYFDVXW.js +8 -0
- package/dist/chunks/add-PMJ5BECU.js +8 -0
- package/dist/chunks/build-BCY6HQJG.js +7 -0
- package/dist/chunks/chunk-25565AGS.js +7 -0
- package/dist/chunks/chunk-2EYYB6YN.js +7 -0
- package/dist/chunks/chunk-2GHZGOWT.js +7 -0
- package/dist/chunks/chunk-2K3ISCQ6.js +7 -0
- package/dist/chunks/chunk-2NABMKFV.js +29 -0
- package/dist/chunks/chunk-2S6PE6GB.js +7 -0
- package/dist/chunks/chunk-2TUVL6WE.js +12 -0
- package/dist/chunks/chunk-363SJ4TN.js +7 -0
- package/dist/chunks/chunk-3G3FQYMW.js +7 -0
- package/dist/chunks/chunk-3LIKVGFT.js +8 -0
- package/dist/chunks/chunk-3XW7N4W3.js +9 -0
- package/dist/chunks/chunk-462YCCJZ.js +7 -0
- package/dist/chunks/chunk-4CACOKMS.js +7 -0
- package/dist/chunks/chunk-4N6LMERQ.js +57 -0
- package/dist/chunks/chunk-4NTBYNFR.js +17 -0
- package/dist/chunks/chunk-4SAVH3H7.js +7 -0
- package/dist/chunks/chunk-4VFYJU37.js +7 -0
- package/dist/chunks/chunk-527GBU3K.js +7 -0
- package/dist/chunks/chunk-5IWFRZQT.js +10 -0
- package/dist/chunks/chunk-5KUUMQ3M.js +7 -0
- package/dist/chunks/chunk-5RMIM4S2.js +7 -0
- package/dist/chunks/chunk-5V53NA6C.js +7 -0
- package/dist/chunks/chunk-67GZ5REA.js +7 -0
- package/dist/chunks/chunk-6I6QJHCY.js +7 -0
- package/dist/chunks/chunk-6IDNVZZR.js +7 -0
- package/dist/chunks/chunk-6OVX3PWM.js +7 -0
- package/dist/chunks/chunk-6QKS6QK7.js +7 -0
- package/dist/chunks/chunk-6TXEVQA4.js +7 -0
- package/dist/chunks/chunk-6VH56CX2.js +19 -0
- package/dist/chunks/chunk-6Y2ZL5XJ.js +98 -0
- package/dist/chunks/chunk-6YXIWZ3X.js +25 -0
- package/dist/chunks/chunk-773GOZIR.js +13 -0
- package/dist/chunks/chunk-7E3WREH5.js +7 -0
- package/dist/chunks/chunk-7EJQLVWX.js +7 -0
- package/dist/chunks/chunk-7L2K4OKM.js +63 -0
- package/dist/chunks/chunk-7L5QUDUR.js +8 -0
- package/dist/chunks/chunk-7QAGSRCU.js +7 -0
- package/dist/chunks/chunk-7R6TRRG5.js +7 -0
- package/dist/chunks/chunk-7YKFF6CE.js +7 -0
- package/dist/chunks/chunk-A2RZZQEP.js +7 -0
- package/dist/chunks/chunk-ADLBLGT3.js +8 -0
- package/dist/chunks/chunk-AM46JVVN.js +7 -0
- package/dist/chunks/chunk-ANMDN3EG.js +9 -0
- package/dist/chunks/chunk-AYUUSAB7.js +7 -0
- package/dist/chunks/chunk-BLUPZPAS.js +7 -0
- package/dist/chunks/chunk-BPUANOGW.js +7 -0
- package/dist/chunks/chunk-BRQUZ5NC.js +7 -0
- package/dist/chunks/chunk-BS32OUOC.js +7 -0
- package/dist/chunks/chunk-BTI5TG6Q.js +7 -0
- package/dist/chunks/chunk-BUJITHGZ.js +8 -0
- package/dist/chunks/chunk-BVGGTBYE.js +7 -0
- package/dist/chunks/chunk-BVH2AEFE.js +7 -0
- package/dist/chunks/chunk-BZENIQ7N.js +7 -0
- package/dist/chunks/chunk-C6GY2G73.js +7 -0
- package/dist/chunks/chunk-C7FQMC6D.js +7 -0
- package/dist/chunks/chunk-CBVKB3DT.js +21 -0
- package/dist/chunks/chunk-CC6FLKIP.js +11 -0
- package/dist/chunks/chunk-COD3WAUI.js +7 -0
- package/dist/chunks/chunk-CR3NBTHV.js +7 -0
- package/dist/chunks/chunk-CWM2F235.js +7 -0
- package/dist/chunks/chunk-CZSOZKHX.js +7 -0
- package/dist/chunks/chunk-D3AHZ5LI.js +7 -0
- package/dist/chunks/chunk-D6REP5QQ.js +15 -0
- package/dist/chunks/chunk-DFVNL5ML.js +7 -0
- package/dist/chunks/chunk-DKJL2KV7.js +7 -0
- package/dist/chunks/chunk-DQ2SVW4R.js +12 -0
- package/dist/chunks/chunk-DWZBL4NK.js +7 -0
- package/dist/chunks/chunk-EAUDC24V.js +9 -0
- package/dist/chunks/chunk-EAXMWCOL.js +63 -0
- package/dist/chunks/chunk-ECEDD646.js +8 -0
- package/dist/chunks/chunk-ECQIO5K3.js +7 -0
- package/dist/chunks/chunk-EEUJLJEJ.js +7 -0
- package/dist/chunks/chunk-EGNR2DEI.js +7 -0
- package/dist/chunks/chunk-EISD3RG7.js +11 -0
- package/dist/chunks/chunk-EKZTFGDX.js +7 -0
- package/dist/chunks/chunk-ETV3C2CV.js +7 -0
- package/dist/chunks/chunk-EU2GBIPC.js +7 -0
- package/dist/chunks/chunk-F4KY2TOK.js +7 -0
- package/dist/chunks/chunk-F53OKXYI.js +7 -0
- package/dist/chunks/chunk-F6EBOT64.js +7 -0
- package/dist/chunks/chunk-F7AVGV4Y.js +7 -0
- package/dist/chunks/chunk-FBYA6LLM.js +7 -0
- package/dist/chunks/chunk-FGFLTLEA.js +7 -0
- package/dist/chunks/chunk-FHU2O7ZJ.js +8 -0
- package/dist/chunks/chunk-FLHO75XC.js +8 -0
- package/dist/chunks/chunk-FSPPKNKN.js +7 -0
- package/dist/chunks/chunk-FUX6LKNP.js +7 -0
- package/dist/chunks/chunk-GA277JFB.js +20 -0
- package/dist/chunks/chunk-GCZVIDNG.js +86 -0
- package/dist/chunks/chunk-GD7AV7BO.js +9 -0
- package/dist/chunks/chunk-GG5RME4X.js +7 -0
- package/dist/chunks/chunk-GHAY4PSD.js +7 -0
- package/dist/chunks/chunk-GYVJIIYL.js +7 -0
- package/dist/chunks/chunk-GZNDA6SV.js +8 -0
- package/dist/chunks/chunk-HCRD3JFL.js +7 -0
- package/dist/chunks/chunk-HEGJZJO7.js +7 -0
- package/dist/chunks/chunk-HRR57QNP.js +7 -0
- package/dist/chunks/chunk-HSFKISDH.js +9 -0
- package/dist/chunks/chunk-HTXDC7E2.js +10 -0
- package/dist/chunks/chunk-ID663OJ7.js +7 -0
- package/dist/chunks/chunk-IOZ3I765.js +7 -0
- package/dist/chunks/chunk-IQ7FPAI4.js +7 -0
- package/dist/chunks/chunk-IQKGQ2Y2.js +15 -0
- package/dist/chunks/chunk-ISWW3DKF.js +7 -0
- package/dist/chunks/chunk-IVSSTHB6.js +7 -0
- package/dist/chunks/chunk-J24BABG4.js +21 -0
- package/dist/chunks/chunk-JALVF3C2.js +7 -0
- package/dist/chunks/chunk-JELLVPCM.js +8 -0
- package/dist/chunks/chunk-JESNVRVR.js +7 -0
- package/dist/chunks/chunk-JLE7K4SY.js +9 -0
- package/dist/chunks/chunk-JLEJB6KM.js +7 -0
- package/dist/chunks/chunk-JP33AIDQ.js +7 -0
- package/dist/chunks/chunk-JRPNHWA3.js +7 -0
- package/dist/chunks/chunk-JUSR7V2L.js +7 -0
- package/dist/chunks/chunk-JWCEHQQF.js +29 -0
- package/dist/chunks/chunk-K5U47EVH.js +7 -0
- package/dist/chunks/chunk-KCKYPLIH.js +7 -0
- package/dist/chunks/chunk-KGBIRIFF.js +7 -0
- package/dist/chunks/chunk-KJA2GKPT.js +7 -0
- package/dist/chunks/chunk-KPQLUGFI.js +32 -0
- package/dist/chunks/chunk-KQCFC2JL.js +7 -0
- package/dist/chunks/chunk-KQCROPL3.js +8 -0
- package/dist/chunks/chunk-KRPY5FHJ.js +7 -0
- package/dist/chunks/chunk-KW6GSQXV.js +7 -0
- package/dist/chunks/chunk-KY335KWI.js +7 -0
- package/dist/chunks/chunk-L3JYCXVB.js +23 -0
- package/dist/chunks/chunk-LFOWP74R.js +7 -0
- package/dist/chunks/chunk-LOBA3E72.js +7 -0
- package/dist/chunks/chunk-LQVSU5HR.js +7 -0
- package/dist/chunks/chunk-LSF7FY6X.js +7 -0
- package/dist/chunks/chunk-LSQREJXO.js +11 -0
- package/dist/chunks/chunk-LW4N3CW6.js +9 -0
- package/dist/chunks/chunk-M2NXKZKX.js +16 -0
- package/dist/chunks/chunk-MBEKRUTQ.js +8 -0
- package/dist/chunks/chunk-MCRKBVZA.js +7 -0
- package/dist/chunks/chunk-MVGTMPMI.js +23 -0
- package/dist/chunks/chunk-MXTC4ZAQ.js +7 -0
- package/dist/chunks/chunk-N2FLYCCO.js +9 -0
- package/dist/chunks/chunk-N6JBQMOF.js +20 -0
- package/dist/chunks/chunk-NAX6IARA.js +11 -0
- package/dist/chunks/chunk-NB2WLB3J.js +12 -0
- package/dist/chunks/chunk-NGKO2OOU.js +8 -0
- package/dist/chunks/chunk-NW7WWUCQ.js +9 -0
- package/dist/chunks/chunk-NWGBDBZI.js +7 -0
- package/dist/chunks/chunk-NZ2TFADV.js +7 -0
- package/dist/chunks/chunk-O4WNSKQR.js +15 -0
- package/dist/chunks/chunk-O72YDZKD.js +10 -0
- package/dist/chunks/chunk-OAM5NJCU.js +9 -0
- package/dist/chunks/chunk-OCR5CRTH.js +10 -0
- package/dist/chunks/chunk-OFDTADPQ.js +7 -0
- package/dist/chunks/chunk-OHEOYFBU.js +9 -0
- package/dist/chunks/chunk-OO572JUC.js +7 -0
- package/dist/chunks/chunk-OPORM35X.js +7 -0
- package/dist/chunks/chunk-OZCQTXI4.js +7 -0
- package/dist/chunks/chunk-PADL3C6Z.js +7 -0
- package/dist/chunks/chunk-PFD7LETF.js +7 -0
- package/dist/chunks/chunk-PFPJLIFF.js +33 -0
- package/dist/chunks/chunk-PSOVLGHP.js +7 -0
- package/dist/chunks/chunk-PUKYAALC.js +7 -0
- package/dist/chunks/chunk-PVASGBEF.js +7 -0
- package/dist/chunks/chunk-Q4KTAQB3.js +7 -0
- package/dist/chunks/chunk-Q5ODLDCU.js +7 -0
- package/dist/chunks/chunk-Q7D7RGXM.js +7 -0
- package/dist/chunks/chunk-QB7F3UAP.js +7 -0
- package/dist/chunks/chunk-QHJLRTVY.js +7 -0
- package/dist/chunks/chunk-QIVX6SCR.js +27 -0
- package/dist/chunks/chunk-QVHXFHBV.js +14 -0
- package/dist/chunks/chunk-QVXS234E.js +7 -0
- package/dist/chunks/chunk-QVZAAMGQ.js +39 -0
- package/dist/chunks/chunk-R2BUF6Z7.js +7 -0
- package/dist/chunks/chunk-R2XHJDAP.js +7 -0
- package/dist/chunks/chunk-R6BEOVTU.js +7 -0
- package/dist/chunks/chunk-RLKS5G6C.js +12 -0
- package/dist/chunks/chunk-RM3ZDRYE.js +7 -0
- package/dist/chunks/chunk-RMZTB2IU.js +7 -0
- package/dist/chunks/chunk-RRDNKB2X.js +7 -0
- package/dist/chunks/chunk-RW3X523R.js +8 -0
- package/dist/chunks/chunk-S3L2OHPO.js +7 -0
- package/dist/chunks/chunk-SACGQMVQ.js +13 -0
- package/dist/chunks/chunk-SCV7XEEO.js +7 -0
- package/dist/chunks/chunk-SF4E3AQ3.js +7 -0
- package/dist/chunks/chunk-SLGUYM42.js +10 -0
- package/dist/chunks/chunk-SYFG2RM6.js +10 -0
- package/dist/chunks/chunk-T6243EDS.js +7 -0
- package/dist/chunks/chunk-TAAWMNNL.js +7 -0
- package/dist/chunks/chunk-TAISZMA2.js +7 -0
- package/dist/chunks/chunk-TEYREL44.js +7 -0
- package/dist/chunks/chunk-TG2RCYTH.js +7 -0
- package/dist/chunks/chunk-TIPQQ4TG.js +17 -0
- package/dist/chunks/chunk-U2OBPULW.js +7 -0
- package/dist/chunks/chunk-U4Z2MMOF.js +301 -0
- package/dist/chunks/chunk-U56NHYAH.js +7 -0
- package/dist/chunks/chunk-UGNIIDHR.js +32 -0
- package/dist/chunks/chunk-UHBMX3OK.js +7 -0
- package/dist/chunks/chunk-UVHKXCR5.js +11 -0
- package/dist/chunks/chunk-V6Y6UK6B.js +43 -0
- package/dist/chunks/chunk-VNIKIQVE.js +10 -0
- package/dist/chunks/chunk-VT6RIZJH.js +7 -0
- package/dist/chunks/chunk-WDXW6A4H.js +10 -0
- package/dist/chunks/chunk-WEH6XC4Y.js +22 -0
- package/dist/chunks/chunk-WKZ6JSGZ.js +7 -0
- package/dist/chunks/chunk-WVHCBDTB.js +7 -0
- package/dist/chunks/chunk-XC46OAAT.js +9 -0
- package/dist/chunks/chunk-XGTKHQTT.js +7 -0
- package/dist/chunks/chunk-XOETL6DB.js +96 -0
- package/dist/chunks/chunk-XP3FT56R.js +27 -0
- package/dist/chunks/chunk-XR6QY7RR.js +7 -0
- package/dist/chunks/chunk-XVDRGWXM.js +16 -0
- package/dist/chunks/chunk-Y5ZMKL7E.js +7 -0
- package/dist/chunks/chunk-YEZJNXQX.js +7 -0
- package/dist/chunks/chunk-YHPPP3SF.js +7 -0
- package/dist/chunks/chunk-YHULP2KK.js +7 -0
- package/dist/chunks/chunk-YMZ6WBKB.js +21 -0
- package/dist/chunks/chunk-ZF27J6FQ.js +7 -0
- package/dist/chunks/chunk-ZFRNVIHI.js +7 -0
- package/dist/chunks/chunk-ZN6CQWVP.js +7 -0
- package/dist/chunks/chunk-ZQBSAMFL.js +24 -0
- package/dist/chunks/cjs-2SMN43VH.js +54 -0
- package/dist/chunks/clear-FKVWDCVA.js +8 -0
- package/dist/chunks/compile-vercel-config-GWAJE44R.js +7 -0
- package/dist/chunks/config-5WVLG5SE.js +8 -0
- package/dist/chunks/config-RMOHN5YT.js +7 -0
- package/dist/chunks/config-validator.mjs +1 -0
- package/dist/chunks/connect-git-provider-FS5Q2HO4.js +7 -0
- package/dist/chunks/constants-JAB7MRSK.js +7 -0
- package/dist/chunks/create-project-IKCB6MB2.js +7 -0
- package/dist/chunks/delete-5WMB4WFR.js +9 -0
- package/dist/chunks/delete-EM4JZPFA.js +10 -0
- package/dist/chunks/detect-projects-OD4JEAW2.js +7 -0
- package/dist/chunks/detect-services-BSJGB4RM.js +7 -0
- package/dist/chunks/disable-QOM7UHQC.js +7 -0
- package/dist/chunks/discard-L5ZH7P5B.js +14 -0
- package/dist/chunks/dist-33WTJLVQ.js +7 -0
- package/dist/chunks/dist-RXYNZPEA.js +7 -0
- package/dist/chunks/edit-F3VJGCG2.js +9 -0
- package/dist/chunks/edit-TM7YCWBU.js +8 -0
- package/dist/chunks/enable-72C3QX34.js +7 -0
- package/dist/chunks/esm-33752ISR.js +7 -0
- package/dist/chunks/esm-4JKEE7PC.js +7 -0
- package/dist/chunks/esm-BYG5BWYH.js +9 -0
- package/dist/chunks/esm-DFFBNKNU.js +20 -0
- package/dist/chunks/esm-IF453UWS.js +7 -0
- package/dist/chunks/esm-LABWDJ72.js +7 -0
- package/dist/chunks/esm-TG37FXTU.js +9 -0
- package/dist/chunks/exec-OZSY46V6.js +16372 -0
- package/dist/chunks/export-EPLYZF2Q.js +19 -0
- package/dist/chunks/fetch-proxy-45DGILKR.js +67 -0
- package/dist/chunks/future-V77DRMQG.js +7 -0
- package/dist/chunks/generate-cert-for-deploy-Y3YHBMPU.js +7 -0
- package/dist/chunks/image-CVXEXU5R.js +7 -0
- package/dist/chunks/import-builders-PGRKJOOE.js +7 -0
- package/dist/chunks/inspect-BTRNXRJT.js +9 -0
- package/dist/chunks/inspect-CZ7WXYE5.js +20 -0
- package/dist/chunks/inspect-FGDVWAQP.js +13 -0
- package/dist/chunks/inspect-HFDGZNWC.js +15 -0
- package/dist/chunks/inspect-T2AIREYK.js +19 -0
- package/dist/chunks/list-CKRRHAOE.js +12 -0
- package/dist/chunks/list-FLREMGJR.js +16 -0
- package/dist/chunks/list-ON4YTQRN.js +10 -0
- package/dist/chunks/login-55LJ5ZA6.js +9 -0
- package/dist/chunks/login-DQRZSD4Z.js +7 -0
- package/dist/chunks/logs-2HQXWOHM.js +7 -0
- package/dist/chunks/ls-2HUJHVLA.js +12 -0
- package/dist/chunks/ls-3DVM5HLK.js +12 -0
- package/dist/chunks/ls-4B3QYHCI.js +8 -0
- package/dist/chunks/ls-A7K4XDQB.js +8 -0
- package/dist/chunks/ls-FK5XEJEU.js +12 -0
- package/dist/chunks/ls-QGUKJJY5.js +12 -0
- package/dist/chunks/ls-VTKHPDWS.js +11 -0
- package/dist/chunks/mutate-7ADZBCZM.js +9 -0
- package/dist/chunks/notifications-XZJXE2K4.js +7 -0
- package/dist/chunks/open-EE5IZQD7.js +7 -0
- package/dist/chunks/openapi-QBX62ZXC.js +7 -0
- package/dist/chunks/permissions-VYJ4LL5R.js +7 -0
- package/dist/chunks/pkg-EDJQLCNP.js +7 -0
- package/dist/chunks/plugin-offer-TEGYA3TA.js +9 -0
- package/dist/chunks/prompt-missing-credentials-VP6OVCFM.js +7 -0
- package/dist/chunks/publish-2HEK5UMJ.js +15 -0
- package/dist/chunks/pull-WRTTSY7J.js +7 -0
- package/dist/chunks/purchase-domain-if-available-6S3NLTUI.js +7 -0
- package/dist/chunks/push-L3QRGGLC.js +7 -0
- package/dist/chunks/query-FXXLX6UB.js +12 -0
- package/dist/chunks/reauthenticate-IXQDC4UZ.js +7 -0
- package/dist/chunks/reorder-B4OXSYCI.js +10 -0
- package/dist/chunks/reply-F637K6XH.js +9 -0
- package/dist/chunks/repo-info-to-url-XQSULSEO.js +7 -0
- package/dist/chunks/resolve-E3F6NYQZ.js +12 -0
- package/dist/chunks/resolve-agent-team-EIPCH766.js +7 -0
- package/dist/chunks/resolve-deployment-framework-preset-AXXYBFCL.js +7 -0
- package/dist/chunks/restore-Q25KRZPH.js +16 -0
- package/dist/chunks/rm-FWD2NUGX.js +8 -0
- package/dist/chunks/rm-JMQ4QKCC.js +8 -0
- package/dist/chunks/rm-PPG7P3GN.js +8 -0
- package/dist/chunks/rm-SH3DYKNS.js +8 -0
- package/dist/chunks/rm-UEBLKFVC.js +8 -0
- package/dist/chunks/routes-PKTWMDWQ.js +7 -0
- package/dist/chunks/rule-inspect-LKQA5I4V.js +8 -0
- package/dist/chunks/schema-FBV42W7N.js +14 -0
- package/dist/chunks/schema-ZWE5MNMG.js +44 -0
- package/dist/chunks/select-org-WMB752Z6.js +7 -0
- package/dist/chunks/set-UTYIPOLC.js +7 -0
- package/dist/chunks/setup-and-link-ZLY5XQW5.js +7 -0
- package/dist/chunks/skills-RKIGVVNM.js +590 -0
- package/dist/chunks/slugify-NMMUASYK.js +7 -0
- package/dist/chunks/stamp-TKONNIJ5.js +7 -0
- package/dist/chunks/tags-UCLZ5UMX.js +7 -0
- package/dist/chunks/token-W6P2KNI5.js +7 -0
- package/dist/chunks/token-util-JDQI37VN.js +7 -0
- package/dist/chunks/types-YM7TMHXW.js +14 -0
- package/dist/chunks/update-BGDQ5TXO.js +8 -0
- package/dist/chunks/update-route-version-KWK5S4UW.js +7 -0
- package/dist/chunks/utils-IQZEE4DT.js +86 -0
- package/dist/chunks/vlt-builder-graph-XL2XRO4V.js +7 -0
- package/dist/chunks/vlt-builder-importer-RBUPAB6J.js +11 -0
- package/dist/chunks/zod-2C2SXNIK.js +7 -0
- package/dist/commands/build/builder-worker.cjs +281 -0
- package/dist/commands/build/index.js +34 -0
- package/dist/commands/deploy/index.js +72 -0
- package/dist/commands/dev/builder-worker.cjs +110 -0
- package/dist/commands/dev/index.js +157 -0
- package/dist/commands/env/index.js +40 -0
- package/dist/commands/link/index.js +10 -0
- package/dist/commands/list/index.js +14 -0
- package/dist/commands/project/index.js +113 -0
- package/dist/commands-account.js +209 -0
- package/dist/commands-ai.js +200 -0
- package/dist/commands-blob.js +107 -0
- package/dist/commands-core.js +222 -0
- package/dist/commands-deployments.js +84 -0
- package/dist/commands-flags.js +377 -0
- package/dist/commands-integrations.js +143 -0
- package/dist/commands-observability.js +122 -0
- package/dist/commands-routing.js +273 -0
- package/dist/fetch-dist-tags.cjs +60 -0
- package/dist/get-latest-worker.cjs +222 -0
- package/dist/help.js +7 -0
- package/dist/index.js +27 -0
- package/dist/internal-build-worker.js +10 -0
- package/dist/internal-build.js +11 -0
- package/dist/package.json +264 -0
- package/dist/root-help-commands.mjs +1 -0
- package/dist/runtime-assets/dev-tunnel/api/tunnel.ts +443 -0
- package/dist/runtime-assets/dev-tunnel/lib/env.ts +25 -0
- package/dist/runtime-assets/dev-tunnel/lib/tunnel_pb.ts +505 -0
- package/dist/runtime-assets/node-preloads/next-dev-websocket.cjs +220 -0
- package/dist/vc.js +404 -0
- package/dist/version.mjs +2 -0
- package/package.json +224 -14
- package/index.js +0 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{require_strip_ansi}from"./chunk-BS32OUOC.js";import{agentErrorMetadata,getExitCodeForReason,trackAgentError}from"./chunk-WDXW6A4H.js";import{recordCliError}from"./chunk-XP3FT56R.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_strip_ansi=__toESM(require_strip_ansi(),1);function recordLine(type,data){return`${JSON.stringify({type,data})}
|
|
8
|
+
`}function summaryLine(progress){return`${JSON.stringify({type:"summary",...progress})}
|
|
9
|
+
`}function writeJsonError(client,payload,exitCode=getExitCodeForReason(payload.reason)){let{status,reason,message,...rest}=payload,document={status,reason,message:(0,import_strip_ansi.default)(message),...rest,...rest.hint?{hint:(0,import_strip_ansi.default)(rest.hint)}:{},...agentErrorMetadata(client)};return recordCliError({code:payload.reason,reportOnSuccess:!0}),trackAgentError(client,document),client.stderr.write(`${JSON.stringify(document)}
|
|
10
|
+
`),exitCode}export{recordLine,summaryLine,writeJsonError};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{__esm}from"./chunk-BZENIQ7N.js";import{createHash}from"crypto";import{mkdir,writeFile}from"fs/promises";import{join}from"path";function wait(ms){return new Promise(resolve=>setTimeout(resolve,ms))}function buildUserAgent(userAgentSuffix){return[`@vercel/prepare-flags-definitions/${version}`,userAgentSuffix].filter(Boolean).join(" ")}function obfuscate(sdkKey,prefixLength=18){return prefixLength>=sdkKey.length?sdkKey:sdkKey.slice(0,prefixLength)+"*".repeat(sdkKey.length-prefixLength)}function hashSdkKey(sdkKey){return createHash("sha256").update(sdkKey).digest("hex")}function getProjectIdFromOidcToken(oidcToken){let tokenParts=oidcToken.split(".");if(tokenParts.length!==3||!tokenParts[1])return;let payload=JSON.parse(Buffer.from(tokenParts[1],"base64url").toString("utf8"));if(!(typeof payload.project_id!="string"||!payload.project_id))return payload.project_id}function generateDefinitionConstants(lines,entries){let stringToConst=new Map;return entries.map(entry=>{let stringified=JSON.stringify(entry.definitions),definitionConst=stringToConst.get(stringified);return definitionConst||(definitionConst=`_d${stringToConst.size}`,stringToConst.set(stringified,definitionConst),lines.push(`const ${definitionConst} = memo(() => JSON.parse(${JSON.stringify(stringified)}));`)),{key:entry.key,value:definitionConst}})}function generateMap(lines,entries){lines.push(""),lines.push("const map = {");for(let entry of entries)lines.push(` ${JSON.stringify(entry.key)}: ${entry.value},`);lines.push("};"),lines.push(""),lines.push("export function get(key) {"),lines.push(" return map[key]?.() ?? null;"),lines.push("}")}function isRetryableStatus(status){return status===429||status>=500}async function fetchDatafile(token,env,fetchFn,userAgentSuffix,output,sourceProjectId){let headers={authorization:`Bearer ${token}`,"user-agent":buildUserAgent(userAgentSuffix)};sourceProjectId&&(headers["x-vercel-flags-project-id"]=sourceProjectId);let label=sourceProjectId?`project ${sourceProjectId}`:obfuscate(token);env.VERCEL_PROJECT_ID&&(headers["x-vercel-project-id"]=env.VERCEL_PROJECT_ID),env.VERCEL_ENV&&(headers["x-vercel-env"]=env.VERCEL_ENV),env.VERCEL_DEPLOYMENT_ID&&(headers["x-vercel-deployment-id"]=env.VERCEL_DEPLOYMENT_ID),env.VERCEL_REGION&&(headers["x-vercel-region"]=env.VERCEL_REGION);let lastError;for(let attempt=0;attempt<=FETCH_MAX_RETRIES;attempt++){if(attempt>0){let delay=FETCH_RETRY_BASE_DELAY_MS*2**(attempt-1);output?.debug(`vercel-flags: retrying datafile fetch for ${label} (attempt ${attempt}/${FETCH_MAX_RETRIES}) after ${delay}ms`),await wait(delay)}let res;try{res=await fetchFn(`${FLAGS_HOST}/v1/datafile`,{headers})}catch(error2){lastError=error2;continue}if(res.ok)return{...await res.json(),fetchedAt:Date.now()};if(res.status===404)return;let error=new Error(`Failed to fetch flag definitions for ${label}: ${res.status} ${res.statusText}`);if(!isRetryableStatus(res.status))throw error;lastError=error}throw lastError instanceof Error?lastError:new Error(`Failed to fetch flag definitions for ${label} after ${FETCH_MAX_RETRIES} retries`)}function generateDefinitionsModule(entries,output){output?.debug(`vercel-flags: writing flag definitions for "${entries.map(({key})=>obfuscate(key)).join(", ")}"`);let lines=["const memo = (fn) => { let cached; return () => (cached ??= fn()); };",""],generatedDefinitions=generateDefinitionConstants(lines,entries);return generateMap(lines,generatedDefinitions),lines.push("",`export const version = ${JSON.stringify(FLAGS_DEFINITIONS_VERSION)};`),lines.join(`
|
|
8
|
+
`)}async function fetchConnectedSourceProjectIds(oidcToken,fetchFn,userAgentSuffix,output){try{let res=await fetchFn(`${API_HOST}${CONNECTED_SOURCES_PATH}`,{headers:{authorization:`Bearer ${oidcToken}`,"user-agent":buildUserAgent(userAgentSuffix)},signal:AbortSignal.timeout(CONNECTED_SOURCES_TIMEOUT_MS)});if(!res.ok)return output?.debug(`vercel-flags: could not list connected projects (${res.status})`),[];let body=await res.json();return(Array.isArray(body.data)?body.data:[]).map(c=>c.sourceProjectId).filter(id=>typeof id=="string"&&PROJECT_ID_REGEX.test(id))}catch(error){return output?.debug(`vercel-flags: could not list connected projects (${error instanceof Error?error.message:String(error)})`),[]}}async function fetchSourceProjectDatafile(entry,env,fetchFn,userAgentSuffix,output){try{return await fetchDatafile(entry.key,env,fetchFn,userAgentSuffix,output,entry.projectId)}catch(error){output?.debug(`vercel-flags: skipping connected project ${entry.projectId} (${error instanceof Error?error.message:String(error)})`);return}}async function collectFlagEntries(env,fetchFn,userAgentSuffix,output){let entries=[],sdkKeys=new Set;for(let value of Object.values(env))if(typeof value=="string"){if(SDK_KEY_REGEX.test(value))sdkKeys.add(value);else if(value.startsWith("flags:")){let sdkKey=new URLSearchParams(value.slice(6)).get("sdkKey");sdkKey&&SDK_KEY_REGEX.test(sdkKey)&&sdkKeys.add(sdkKey)}}if(sdkKeys.size>0){output?.debug(`vercel-flags: found ${sdkKeys.size} SDK keys`);for(let key of Array.from(sdkKeys))entries.push({type:"sdkKey",key})}let oidcToken=env.VERCEL_OIDC_TOKEN;if(oidcToken&&oidcToken?.length>0){output?.debug("vercel-flags: found OIDC token"),entries.push({type:"oidcToken",key:oidcToken});let ownProjectId=getProjectIdFromOidcToken(oidcToken),sourceProjectIds=new Set(await fetchConnectedSourceProjectIds(oidcToken,fetchFn,userAgentSuffix,output));ownProjectId&&sourceProjectIds.delete(ownProjectId);for(let projectId of Array.from(sourceProjectIds))entries.push({type:"sourceProject",key:oidcToken,projectId});sourceProjectIds.size>0&&output?.debug(`vercel-flags: found ${sourceProjectIds.size} connected projects`)}return entries}async function prepareFlagsDefinitions(options){let{cwd,env,userAgentSuffix,fetch:fetchFn=globalThis.fetch,output}=options;output?.debug("vercel-flags: checking env vars for SDK Keys and OIDC Token");let entries=await collectFlagEntries(env,fetchFn,userAgentSuffix,output);if(entries.length===0)return{created:!1,reason:"no-flags-entries"};let validEntries=(await Promise.all(entries.map(async entry=>{if(entry.type==="sourceProject"){let definitions2=await fetchSourceProjectDatafile(entry,env,fetchFn,userAgentSuffix,output);return definitions2?{key:entry.projectId,definitions:definitions2}:void 0}let definitions=await fetchDatafile(entry.key,env,fetchFn,userAgentSuffix,output);if(definitions){if(entry.type==="oidcToken"){let projectId=getProjectIdFromOidcToken(entry.key);if(projectId)return{key:projectId,definitions}}if(entry.type==="sdkKey")return{key:hashSdkKey(entry.key),definitions}}}))).filter(entry=>!!entry),definitionsJs=generateDefinitionsModule(validEntries,output),storageDir=join(cwd,"node_modules","@vercel","flags-definitions"),indexPath=join(storageDir,"index.js"),dtsPath=join(storageDir,"index.d.ts"),packageJsonPath=join(storageDir,"package.json"),dts=["export function get(key: string): Record<string, unknown> | null;","export const version: string;",""].join(`
|
|
9
|
+
`),packageJson={name:"@vercel/flags-definitions",version:FLAGS_DEFINITIONS_VERSION,type:"module",main:"./index.js",types:"./index.d.ts",exports:{".":{types:"./index.d.ts",import:"./index.js"}}};return await mkdir(storageDir,{recursive:!0}),await Promise.all([writeFile(indexPath,definitionsJs),writeFile(dtsPath,dts),writeFile(packageJsonPath,JSON.stringify(packageJson,null,2))]),output?.debug("vercel-flags: created module"),output?.debug(` \u2192 ${indexPath}`),output?.debug(` \u2192 ${dtsPath}`),output?.debug(` \u2192 ${packageJsonPath}`),{created:!0,entryCount:entries.length}}var version,FLAGS_HOST,API_HOST,CONNECTED_SOURCES_PATH,FLAGS_DEFINITIONS_VERSION,FETCH_MAX_RETRIES,FETCH_RETRY_BASE_DELAY_MS,CONNECTED_SOURCES_TIMEOUT_MS,SDK_KEY_REGEX,PROJECT_ID_REGEX,init_dist=__esm({"../../node_modules/.pnpm/@vercel+prepare-flags-definitions@0.6.1/node_modules/@vercel/prepare-flags-definitions/dist/index.js"(){version="0.6.1",FLAGS_HOST="https://flags.vercel.com",API_HOST="https://api.vercel.com",CONNECTED_SOURCES_PATH="/v1/feature-flags/connections/sources",FLAGS_DEFINITIONS_VERSION="1.0.1",FETCH_MAX_RETRIES=3,FETCH_RETRY_BASE_DELAY_MS=200,CONNECTED_SOURCES_TIMEOUT_MS=5e3;SDK_KEY_REGEX=/^vf_(?:server|client)_/,PROJECT_ID_REGEX=/^[A-Za-z0-9_]{1,64}$/}});export{hashSdkKey,getProjectIdFromOidcToken,generateDefinitionsModule,prepareFlagsDefinitions,init_dist};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{__commonJS}from"./chunk-BZENIQ7N.js";var require_balanced_match=__commonJS({"../../node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js"(exports,module){"use strict";module.exports=balanced;function balanced(a,b,str){a instanceof RegExp&&(a=maybeMatch(a,str)),b instanceof RegExp&&(b=maybeMatch(b,str));var r=range(a,b,str);return r&&{start:r[0],end:r[1],pre:str.slice(0,r[0]),body:str.slice(r[0]+a.length,r[1]),post:str.slice(r[1]+b.length)}}function maybeMatch(reg,str){var m=str.match(reg);return m?m[0]:null}balanced.range=range;function range(a,b,str){var begs,beg,left,right,result,ai=str.indexOf(a),bi=str.indexOf(b,ai+1),i=ai;if(ai>=0&&bi>0){if(a===b)return[ai,bi];for(begs=[],left=str.length;i>=0&&!result;)i==ai?(begs.push(i),ai=str.indexOf(a,i+1)):begs.length==1?result=[begs.pop(),bi]:(beg=begs.pop(),beg<left&&(left=beg,right=bi),bi=str.indexOf(b,i+1)),i=ai<bi&&ai>=0?ai:bi;begs.length&&(result=[left,right])}return result}}});var require_path=__commonJS({"../../node_modules/.pnpm/minimatch@5.0.1/node_modules/minimatch/lib/path.js"(exports,module){var isWindows=typeof process=="object"&&process&&process.platform==="win32";module.exports=isWindows?{sep:"\\"}:{sep:"/"}}});var require_brace_expansion=__commonJS({"../../node_modules/.pnpm/brace-expansion@2.1.1/node_modules/brace-expansion/index.js"(exports,module){var balanced=require_balanced_match();module.exports=expandTop;var escSlash="\0SLASH"+Math.random()+"\0",escOpen="\0OPEN"+Math.random()+"\0",escClose="\0CLOSE"+Math.random()+"\0",escComma="\0COMMA"+Math.random()+"\0",escPeriod="\0PERIOD"+Math.random()+"\0";function numeric(str){return parseInt(str,10)==str?parseInt(str,10):str.charCodeAt(0)}function escapeBraces(str){return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod)}function unescapeBraces(str){return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".")}function parseCommaParts(str){if(!str)return[""];var parts=[],m=balanced("{","}",str);if(!m)return str.split(",");var pre=m.pre,body=m.body,post=m.post,p=pre.split(",");p[p.length-1]+="{"+body+"}";var postParts=parseCommaParts(post);return post.length&&(p[p.length-1]+=postParts.shift(),p.push.apply(p,postParts)),parts.push.apply(parts,p),parts}function expandTop(str,options){if(!str)return[];options=options||{};var max=options.max==null?1/0:options.max;return str.substr(0,2)==="{}"&&(str="\\{\\}"+str.substr(2)),expand(escapeBraces(str),max,!0).map(unescapeBraces)}function embrace(str){return"{"+str+"}"}function isPadded(el){return/^-?0\d/.test(el)}function lte(i,y){return i<=y}function gte(i,y){return i>=y}function expand(str,max,isTop){var expansions=[],m=balanced("{","}",str);if(!m)return[str];var pre=m.pre,post=m.post.length?expand(m.post,max,!1):[""];if(/\$$/.test(m.pre))for(var k=0;k<post.length&&k<max;k++){var expansion=pre+"{"+m.body+"}"+post[k];expansions.push(expansion)}else{var isNumericSequence=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body),isAlphaSequence=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body),isSequence=isNumericSequence||isAlphaSequence,isOptions=m.body.indexOf(",")>=0;if(!isSequence&&!isOptions)return m.post.match(/,(?!,).*\}/)?(str=m.pre+"{"+m.body+escClose+m.post,expand(str,max,!0)):[str];var n;if(isSequence)n=m.body.split(/\.\./);else if(n=parseCommaParts(m.body),n.length===1&&(n=expand(n[0],max,!1).map(embrace),n.length===1))return post.map(function(p){return m.pre+n[0]+p});var N;if(isSequence){var x=numeric(n[0]),y=numeric(n[1]),width=Math.max(n[0].length,n[1].length),incr=n.length==3?Math.max(Math.abs(numeric(n[2])),1):1,test=lte,reverse=y<x;reverse&&(incr*=-1,test=gte);var pad=n.some(isPadded);N=[];for(var i=x;test(i,y)&&N.length<max;i+=incr){var c;if(isAlphaSequence)c=String.fromCharCode(i),c==="\\"&&(c="");else if(c=String(i),pad){var need=width-c.length;if(need>0){var z=new Array(need+1).join("0");i<0?c="-"+z+c.slice(1):c=z+c}}N.push(c)}}else{N=[];for(var j=0;j<n.length;j++)N.push.apply(N,expand(n[j],max,!1))}for(var j=0;j<N.length;j++)for(var k=0;k<post.length&&expansions.length<max;k++){var expansion=pre+N[j]+post[k];(!isTop||isSequence||expansion)&&expansions.push(expansion)}}return expansions}}});var require_minimatch=__commonJS({"../../node_modules/.pnpm/minimatch@5.0.1/node_modules/minimatch/minimatch.js"(exports,module){var minimatch=module.exports=(p,pattern,options={})=>(assertValidPattern(pattern),!options.nocomment&&pattern.charAt(0)==="#"?!1:new Minimatch(pattern,options).match(p));module.exports=minimatch;var path=require_path();minimatch.sep=path.sep;var GLOBSTAR=Symbol("globstar **");minimatch.GLOBSTAR=GLOBSTAR;var expand=require_brace_expansion(),plTypes={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},qmark="[^/]",star=qmark+"*?",twoStarDot="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",twoStarNoDot="(?:(?!(?:\\/|^)\\.).)*?",charSet=s=>s.split("").reduce((set,c)=>(set[c]=!0,set),{}),reSpecials=charSet("().*{}+?[]^$\\!"),addPatternStartSet=charSet("[.("),slashSplit=/\/+/;minimatch.filter=(pattern,options={})=>(p,i,list)=>minimatch(p,pattern,options);var ext=(a,b={})=>{let t={};return Object.keys(a).forEach(k=>t[k]=a[k]),Object.keys(b).forEach(k=>t[k]=b[k]),t};minimatch.defaults=def=>{if(!def||typeof def!="object"||!Object.keys(def).length)return minimatch;let orig=minimatch,m=(p,pattern,options)=>orig(p,pattern,ext(def,options));return m.Minimatch=class extends orig.Minimatch{constructor(pattern,options){super(pattern,ext(def,options))}},m.Minimatch.defaults=options=>orig.defaults(ext(def,options)).Minimatch,m.filter=(pattern,options)=>orig.filter(pattern,ext(def,options)),m.defaults=options=>orig.defaults(ext(def,options)),m.makeRe=(pattern,options)=>orig.makeRe(pattern,ext(def,options)),m.braceExpand=(pattern,options)=>orig.braceExpand(pattern,ext(def,options)),m.match=(list,pattern,options)=>orig.match(list,pattern,ext(def,options)),m};minimatch.braceExpand=(pattern,options)=>braceExpand(pattern,options);var braceExpand=(pattern,options={})=>(assertValidPattern(pattern),options.nobrace||!/\{(?:(?!\{).)*\}/.test(pattern)?[pattern]:expand(pattern)),MAX_PATTERN_LENGTH=1024*64,assertValidPattern=pattern=>{if(typeof pattern!="string")throw new TypeError("invalid pattern");if(pattern.length>MAX_PATTERN_LENGTH)throw new TypeError("pattern is too long")},SUBPARSE=Symbol("subparse");minimatch.makeRe=(pattern,options)=>new Minimatch(pattern,options||{}).makeRe();minimatch.match=(list,pattern,options={})=>{let mm=new Minimatch(pattern,options);return list=list.filter(f=>mm.match(f)),mm.options.nonull&&!list.length&&list.push(pattern),list};var globUnescape=s=>s.replace(/\\(.)/g,"$1"),regExpEscape=s=>s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Minimatch=class{constructor(pattern,options){assertValidPattern(pattern),options||(options={}),this.options=options,this.set=[],this.pattern=pattern,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!options.partial,this.make()}debug(){}make(){let pattern=this.pattern,options=this.options;if(!options.nocomment&&pattern.charAt(0)==="#"){this.comment=!0;return}if(!pattern){this.empty=!0;return}this.parseNegate();let set=this.globSet=this.braceExpand();options.debug&&(this.debug=(...args)=>console.error(...args)),this.debug(this.pattern,set),set=this.globParts=set.map(s=>s.split(slashSplit)),this.debug(this.pattern,set),set=set.map((s,si,set2)=>s.map(this.parse,this)),this.debug(this.pattern,set),set=set.filter(s=>s.indexOf(!1)===-1),this.debug(this.pattern,set),this.set=set}parseNegate(){if(this.options.nonegate)return;let pattern=this.pattern,negate=!1,negateOffset=0;for(let i=0;i<pattern.length&&pattern.charAt(i)==="!";i++)negate=!negate,negateOffset++;negateOffset&&(this.pattern=pattern.substr(negateOffset)),this.negate=negate}matchOne(file,pattern,partial){var options=this.options;this.debug("matchOne",{this:this,file,pattern}),this.debug("matchOne",file.length,pattern.length);for(var fi=0,pi=0,fl=file.length,pl=pattern.length;fi<fl&&pi<pl;fi++,pi++){this.debug("matchOne loop");var p=pattern[pi],f=file[fi];if(this.debug(pattern,p,f),p===!1)return!1;if(p===GLOBSTAR){this.debug("GLOBSTAR",[pattern,p,f]);var fr=fi,pr=pi+1;if(pr===pl){for(this.debug("** at the end");fi<fl;fi++)if(file[fi]==="."||file[fi]===".."||!options.dot&&file[fi].charAt(0)===".")return!1;return!0}for(;fr<fl;){var swallowee=file[fr];if(this.debug(`
|
|
8
|
+
globstar while`,file,fr,pattern,pr,swallowee),this.matchOne(file.slice(fr),pattern.slice(pr),partial))return this.debug("globstar found match!",fr,fl,swallowee),!0;if(swallowee==="."||swallowee===".."||!options.dot&&swallowee.charAt(0)==="."){this.debug("dot detected!",file,fr,pattern,pr);break}this.debug("globstar swallow a segment, and continue"),fr++}return!!(partial&&(this.debug(`
|
|
9
|
+
>>> no match, partial?`,file,fr,pattern,pr),fr===fl))}var hit;if(typeof p=="string"?(hit=f===p,this.debug("string match",p,f,hit)):(hit=f.match(p),this.debug("pattern match",p,f,hit)),!hit)return!1}if(fi===fl&&pi===pl)return!0;if(fi===fl)return partial;if(pi===pl)return fi===fl-1&&file[fi]==="";throw new Error("wtf?")}braceExpand(){return braceExpand(this.pattern,this.options)}parse(pattern,isSub){assertValidPattern(pattern);let options=this.options;if(pattern==="**")if(options.noglobstar)pattern="*";else return GLOBSTAR;if(pattern==="")return"";let re="",hasMagic=!!options.nocase,escaping=!1,patternListStack=[],negativeLists=[],stateChar,inClass=!1,reClassStart=-1,classStart=-1,cs,pl,sp,patternStart=pattern.charAt(0)==="."?"":options.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",clearStateChar=()=>{if(stateChar){switch(stateChar){case"*":re+=star,hasMagic=!0;break;case"?":re+=qmark,hasMagic=!0;break;default:re+="\\"+stateChar;break}this.debug("clearStateChar %j %j",stateChar,re),stateChar=!1}};for(let i=0,c;i<pattern.length&&(c=pattern.charAt(i));i++){if(this.debug("%s %s %s %j",pattern,i,re,c),escaping){if(c==="/")return!1;reSpecials[c]&&(re+="\\"),re+=c,escaping=!1;continue}switch(c){case"/":return!1;case"\\":clearStateChar(),escaping=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s %s %s %j <-- stateChar",pattern,i,re,c),inClass){this.debug(" in class"),c==="!"&&i===classStart+1&&(c="^"),re+=c;continue}this.debug("call clearStateChar %j",stateChar),clearStateChar(),stateChar=c,options.noext&&clearStateChar();continue;case"(":if(inClass){re+="(";continue}if(!stateChar){re+="\\(";continue}patternListStack.push({type:stateChar,start:i-1,reStart:re.length,open:plTypes[stateChar].open,close:plTypes[stateChar].close}),re+=stateChar==="!"?"(?:(?!(?:":"(?:",this.debug("plType %j %j",stateChar,re),stateChar=!1;continue;case")":if(inClass||!patternListStack.length){re+="\\)";continue}clearStateChar(),hasMagic=!0,pl=patternListStack.pop(),re+=pl.close,pl.type==="!"&&negativeLists.push(pl),pl.reEnd=re.length;continue;case"|":if(inClass||!patternListStack.length){re+="\\|";continue}clearStateChar(),re+="|";continue;case"[":if(clearStateChar(),inClass){re+="\\"+c;continue}inClass=!0,classStart=i,reClassStart=re.length,re+=c;continue;case"]":if(i===classStart+1||!inClass){re+="\\"+c;continue}cs=pattern.substring(classStart+1,i);try{RegExp("["+cs+"]")}catch{sp=this.parse(cs,SUBPARSE),re=re.substr(0,reClassStart)+"\\["+sp[0]+"\\]",hasMagic=hasMagic||sp[1],inClass=!1;continue}hasMagic=!0,inClass=!1,re+=c;continue;default:clearStateChar(),reSpecials[c]&&!(c==="^"&&inClass)&&(re+="\\"),re+=c;break}}for(inClass&&(cs=pattern.substr(classStart+1),sp=this.parse(cs,SUBPARSE),re=re.substr(0,reClassStart)+"\\["+sp[0],hasMagic=hasMagic||sp[1]),pl=patternListStack.pop();pl;pl=patternListStack.pop()){let tail;tail=re.slice(pl.reStart+pl.open.length),this.debug("setting tail",re,pl),tail=tail.replace(/((?:\\{2}){0,64})(\\?)\|/g,(_,$1,$2)=>($2||($2="\\"),$1+$1+$2+"|")),this.debug(`tail=%j
|
|
10
|
+
%s`,tail,tail,pl,re);let t=pl.type==="*"?star:pl.type==="?"?qmark:"\\"+pl.type;hasMagic=!0,re=re.slice(0,pl.reStart)+t+"\\("+tail}clearStateChar(),escaping&&(re+="\\\\");let addPatternStart=addPatternStartSet[re.charAt(0)];for(let n=negativeLists.length-1;n>-1;n--){let nl=negativeLists[n],nlBefore=re.slice(0,nl.reStart),nlFirst=re.slice(nl.reStart,nl.reEnd-8),nlAfter=re.slice(nl.reEnd),nlLast=re.slice(nl.reEnd-8,nl.reEnd)+nlAfter,openParensBefore=nlBefore.split("(").length-1,cleanAfter=nlAfter;for(let i=0;i<openParensBefore;i++)cleanAfter=cleanAfter.replace(/\)[+*?]?/,"");nlAfter=cleanAfter;let dollar=nlAfter===""&&isSub!==SUBPARSE?"$":"";re=nlBefore+nlFirst+nlAfter+dollar+nlLast}if(re!==""&&hasMagic&&(re="(?=.)"+re),addPatternStart&&(re=patternStart+re),isSub===SUBPARSE)return[re,hasMagic];if(!hasMagic)return globUnescape(pattern);let flags=options.nocase?"i":"";try{return Object.assign(new RegExp("^"+re+"$",flags),{_glob:pattern,_src:re})}catch{return new RegExp("$.")}}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let set=this.set;if(!set.length)return this.regexp=!1,this.regexp;let options=this.options,twoStar=options.noglobstar?star:options.dot?twoStarDot:twoStarNoDot,flags=options.nocase?"i":"",re=set.map(pattern=>(pattern=pattern.map(p=>typeof p=="string"?regExpEscape(p):p===GLOBSTAR?GLOBSTAR:p._src).reduce((set2,p)=>(set2[set2.length-1]===GLOBSTAR&&p===GLOBSTAR||set2.push(p),set2),[]),pattern.forEach((p,i)=>{p!==GLOBSTAR||pattern[i-1]===GLOBSTAR||(i===0?pattern.length>1?pattern[i+1]="(?:\\/|"+twoStar+"\\/)?"+pattern[i+1]:pattern[i]=twoStar:i===pattern.length-1?pattern[i-1]+="(?:\\/|"+twoStar+")?":(pattern[i-1]+="(?:\\/|\\/"+twoStar+"\\/)"+pattern[i+1],pattern[i+1]=GLOBSTAR))}),pattern.filter(p=>p!==GLOBSTAR).join("/"))).join("|");re="^(?:"+re+")$",this.negate&&(re="^(?!"+re+").*$");try{this.regexp=new RegExp(re,flags)}catch{this.regexp=!1}return this.regexp}match(f,partial=this.partial){if(this.debug("match",f,this.pattern),this.comment)return!1;if(this.empty)return f==="";if(f==="/"&&partial)return!0;let options=this.options;path.sep!=="/"&&(f=f.split(path.sep).join("/")),f=f.split(slashSplit),this.debug(this.pattern,"split",f);let set=this.set;this.debug(this.pattern,"set",set);let filename;for(let i=f.length-1;i>=0&&(filename=f[i],!filename);i--);for(let i=0;i<set.length;i++){let pattern=set[i],file=f;if(options.matchBase&&pattern.length===1&&(file=[filename]),this.matchOne(file,pattern,partial))return options.flipNegate?!0:!this.negate}return options.flipNegate?!1:this.negate}static defaults(def){return minimatch.defaults(def).Minimatch}};minimatch.Minimatch=Minimatch}});export{require_balanced_match,require_minimatch};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1),CHECKBOX_INSTRUCTIONS=[" ",import_chalk.default.cyan("<space>"),import_chalk.default.dim(" select, "),import_chalk.default.cyan("<enter>"),import_chalk.default.dim(" confirm, "),import_chalk.default.cyan("<a>"),import_chalk.default.dim(" toggle all, "),import_chalk.default.cyan("<i>"),import_chalk.default.dim(" invert")].join("");export{CHECKBOX_INSTRUCTIONS};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{RULE_ENVIRONMENTS}from"./chunk-EKZTFGDX.js";import{AGENT_STATUS}from"./chunk-WDXW6A4H.js";import{warnDeprecatedInput}from"./chunk-QVXS234E.js";function writeConfigJson(client,{project,bare,envelope,message,next}){if(!client.nonInteractive){client.stdout.write(`${JSON.stringify(bare,null,2)}
|
|
8
|
+
`);return}client.stdout.write(`${JSON.stringify({status:AGENT_STATUS.OK,projectId:project.id,projectName:project.name,...envelope,message,next},null,2)}
|
|
9
|
+
`)}var RULE_LIMIT=10,MIN_SAMPLE_RATE=1,MAX_SAMPLE_RATE=100;function isRuleEnvironment(value){return RULE_ENVIRONMENTS.includes(value)}var ENVIRONMENT_ERROR=`\`environment\` must be one of: ${RULE_ENVIRONMENTS.join(", ")}.`,RATE_ERROR=`\`rate\` must be a whole number from ${MIN_SAMPLE_RATE} to ${MAX_SAMPLE_RATE}.`,EMPTY_PATH_ERROR="`requestPath` cannot be empty.";function parseSampleRate(value){if(!/^\d+$/.test(value.trim()))return;let rate=Number(value);return rate>=MIN_SAMPLE_RATE&&rate<=MAX_SAMPLE_RATE?rate:void 0}function toRow(rule){return{environment:rule.env??"any",requestPath:rule.requestPath??null,sampleRate:Math.round(rule.rate*100)}}function toApiRate(sampleRate){return sampleRate/100}function toRule(row){return{type:"head_sampling",rate:toApiRate(row.sampleRate),...row.environment==="any"?{}:{env:row.environment},...row.requestPath===null?{}:{requestPath:row.requestPath}}}var ALL_PATHS_LABEL="(all paths)";function formatPath(requestPath){return requestPath??ALL_PATHS_LABEL}function formatRate(sampleRate){return`${sampleRate}%`}function formatRuleTarget(environment,requestPath){return`${environment} ${formatPath(requestPath)}`}function formatRuleLine(row){return`${formatRuleTarget(row.environment,row.requestPath)} ${formatRate(row.sampleRate)}`}var COMMAND_WORD_COUNT=3;function subcommandArguments(positional){return positional.slice(COMMAND_WORD_COUNT)}function resolveRuleEnvironment(client,environmentFlag,args){if(environmentFlag===void 0){let[environment,...rest]=args;return environment!==void 0&&isRuleEnvironment(environment)?(warnDeprecatedInput(client,"The environment argument","--environment"),{environment,args:rest}):{environment:void 0,args}}return args[0]!==void 0&&isRuleEnvironment(args[0])?{error:"Can't use an environment argument with --environment. Use --environment."}:{environment:environmentFlag,args}}function hasSameKey(a,b){return a.environment===b.environment&&a.requestPath===b.requestPath}async function readTracingConfig({client,teamId,projectId,projectName}){let config=await client.fetch(`/v1/drains/tracing/config?${new URLSearchParams({projectId})}`,{accountId:teamId}),sampling=config.enabled&&config.sampling.length===0?[{type:"head_sampling",rate:1}]:config.sampling;return{project:{id:projectId,name:projectName},enabled:config.enabled,entries:sampling.map(rule=>({rule,row:toRow(rule)}))}}async function writeSamplingRules({client,teamId,projectId,rules}){await client.fetch(`/v1/drains/tracing/config?${new URLSearchParams({projectId})}`,{accountId:teamId,method:"PUT",body:{enabled:rules.length>0,...rules.length>0?{sampling:rules}:{}}})}export{writeConfigJson,RULE_LIMIT,isRuleEnvironment,ENVIRONMENT_ERROR,RATE_ERROR,EMPTY_PATH_ERROR,parseSampleRate,toApiRate,toRule,formatPath,formatRate,formatRuleTarget,formatRuleLine,subcommandArguments,resolveRuleEnvironment,hasSameKey,readTracingConfig,writeSamplingRules};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{__commonJS,__require,__toESM}from"./chunk-BZENIQ7N.js";var require_dist=__commonJS({"../../internals/get-package-json/dist/index.js"(exports,module){"use strict";var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toESM2=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),src_exports={};__export(src_exports,{getPackageJSON:()=>getPackageJSON2});module.exports=__toCommonJS(src_exports);var import_fs=__toESM2(__require("fs")),import_path=__toESM2(__require("path")),import_url=__require("url"),cache=new Map;function getPackageJSONPath(dir){return import_path.default.join(dir,"package.json")}function captureCallerCallSite(){let _prepareStackTrace=Error.prepareStackTrace,callSite;try{Error.prepareStackTrace=(_,stack)=>stack,callSite=new Error().stack[2]}finally{Error.prepareStackTrace=_prepareStackTrace}return callSite}function getPackageJSON2(){let callSite=captureCallerCallSite(),filePath=callSite.getFileName()||callSite.getEvalOrigin();filePath.startsWith("file://")&&(filePath=(0,import_url.fileURLToPath)(filePath));let rootDir=import_path.default.dirname(filePath),packageJSONPath=getPackageJSONPath(rootDir);for(;!import_fs.default.existsSync(packageJSONPath);)rootDir=import_path.default.join(rootDir,".."),packageJSONPath=getPackageJSONPath(rootDir);let packageJSON=cache.get(packageJSONPath);return packageJSON||(packageJSON=JSON.parse(import_fs.default.readFileSync(packageJSONPath,"utf-8")),cache.set(packageJSONPath,packageJSON)),packageJSON}}});var import_get_package_json=__toESM(require_dist(),1),pkg_default=(0,import_get_package_json.getPackageJSON)();export{pkg_default};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{__commonJS,__require}from"./chunk-BZENIQ7N.js";var require_windows=__commonJS({"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports,module){module.exports=isexe;isexe.sync=sync;var fs=__require("fs");function checkPathExt(path,options){var pathext=options.pathExt!==void 0?options.pathExt:process.env.PATHEXT;if(!pathext||(pathext=pathext.split(";"),pathext.indexOf("")!==-1))return!0;for(var i=0;i<pathext.length;i++){var p=pathext[i].toLowerCase();if(p&&path.substr(-p.length).toLowerCase()===p)return!0}return!1}function checkStat(stat,path,options){return!stat.isSymbolicLink()&&!stat.isFile()?!1:checkPathExt(path,options)}function isexe(path,options,cb){fs.stat(path,function(er,stat){cb(er,er?!1:checkStat(stat,path,options))})}function sync(path,options){return checkStat(fs.statSync(path),path,options)}}});var require_mode=__commonJS({"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports,module){module.exports=isexe;isexe.sync=sync;var fs=__require("fs");function isexe(path,options,cb){fs.stat(path,function(er,stat){cb(er,er?!1:checkStat(stat,options))})}function sync(path,options){return checkStat(fs.statSync(path),options)}function checkStat(stat,options){return stat.isFile()&&checkMode(stat,options)}function checkMode(stat,options){var mod=stat.mode,uid=stat.uid,gid=stat.gid,myUid=options.uid!==void 0?options.uid:process.getuid&&process.getuid(),myGid=options.gid!==void 0?options.gid:process.getgid&&process.getgid(),u=parseInt("100",8),g=parseInt("010",8),o=parseInt("001",8),ug=u|g,ret=mod&o||mod&g&&gid===myGid||mod&u&&uid===myUid||mod&ug&&myUid===0;return ret}}});var require_isexe=__commonJS({"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports,module){var fs=__require("fs"),core;process.platform==="win32"||global.TESTING_WINDOWS?core=require_windows():core=require_mode();module.exports=isexe;isexe.sync=sync;function isexe(path,options,cb){if(typeof options=="function"&&(cb=options,options={}),!cb){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(resolve,reject){isexe(path,options||{},function(er,is){er?reject(er):resolve(is)})})}core(path,options||{},function(er,is){er&&(er.code==="EACCES"||options&&options.ignoreErrors)&&(er=null,is=!1),cb(er,is)})}function sync(path,options){try{return core.sync(path,options||{})}catch(er){if(options&&options.ignoreErrors||er.code==="EACCES")return!1;throw er}}}});export{require_isexe};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{require_dist}from"./chunk-PUKYAALC.js";import{deploymentOption,environmentOption,forceOption,formatOption,gitBranchOption,jsonOption,projectOption,warnDeprecatedInput,yesOption}from"./chunk-QVXS234E.js";import{packageName,require_lib}from"./chunk-JESNVRVR.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_constants=__toESM(require_dist(),1),import_title=__toESM(require_lib(),1);var envTargetChoices=import_constants.PROJECT_ENV_TARGET.map(t=>({name:(0,import_title.default)(t),value:t}));function isValidEnvTarget(target){return typeof target>"u"||envTargetChoices.map(c=>c.value).includes(target)}function getEnvTargetPlaceholder(){return`<${envTargetChoices.map(c=>c.value).join(" | ")}>`}function parseEnvTargetArg(arg){return Array.from(new Set(arg.split(",").map(t=>t.trim()).filter(Boolean)))}function resolveEnvTargetInput(client,input){let environment=Array.isArray(input.environment)?input.environment.join(","):input.environment;return input.legacyEnvironment!==void 0&&environment!==void 0?{error:"Can't use an environment argument with --environment. Use --environment, and --git-branch for a Git branch."}:input.legacyGitBranch!==void 0&&input.gitBranch!==void 0?{error:"Can't use a Git branch argument with --git-branch. Use --git-branch."}:(input.legacyEnvironment!==void 0&&warnDeprecatedInput(client,"The environment argument","--environment"),input.legacyGitBranch!==void 0&&warnDeprecatedInput(client,"The Git branch argument","--git-branch"),{environment:environment??input.legacyEnvironment,gitBranch:input.gitBranch??input.legacyGitBranch})}var targetPlaceholder=getEnvTargetPlaceholder(),listSubcommand={name:"list",aliases:["ls"],description:"List all Environment Variables for a Project",arguments:[],options:[{...environmentOption,description:"List only the variables for this environment"},{...gitBranchOption,description:"List only the variables for this Git branch"},{...formatOption,description:"Specify the output format (json, including readable Environment Variable values)"},{...jsonOption,description:"Output as JSON, including readable Environment Variable values"},projectOption,{name:"guidance",description:"Receive command suggestions once command is complete",shorthand:null,type:Boolean,deprecated:!1}],examples:[]},addSubcommand={name:"add",aliases:[],description:"Add an Environment Variable",arguments:[{name:"name",required:!0}],options:[projectOption,{...environmentOption,type:[String],description:"Environments to add the variable to; repeatable or comma-separated. Prompts when omitted"},{...gitBranchOption,description:"Set the Git branch for a Preview Environment Variable"},{name:"sensitive",description:"Store the value as a Secret",shorthand:null,type:Boolean,deprecated:!1},{name:"no-sensitive",description:"Store the value as Config",shorthand:null,type:Boolean,deprecated:!1},{name:"type",description:"Set the Environment Variable type (`config` or `secret`)",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"visibility",description:"Deprecated alias for `--type`",shorthand:null,type:String,argument:"VISIBILITY",deprecated:!0},{...forceOption,description:"Overwrite an existing variable in the same environment",shorthand:null},{...yesOption,description:"Accept default choices when adding an Environment Variable"},{name:"guidance",description:"Show command suggestions after completion",shorthand:null,type:Boolean,deprecated:!1},{name:"value",description:"Set the variable value for non-interactive use; otherwise use stdin or the prompt",shorthand:null,type:String,argument:"VALUE",deprecated:!1}],examples:[{name:"Add a new variable (prompts for value and Environments)",value:[`${packageName} env add <name>`,`${packageName} env add API_TOKEN`]},{name:"Add a new Environment Variable to a specific Environment",value:[`${packageName} env add <name> --environment ${targetPlaceholder}`,`${packageName} env add DB_PASS --environment production`]},{name:"Add one variable to multiple Environments (comma-separated)",value:[`${packageName} env add <name> --environment <environment>[,<environment>]`,`${packageName} env add API_URL --environment production,preview,development`]},{name:"Override an existing Environment Variable in the same environment (production, preview, development)",value:`${packageName} env add API_TOKEN --force`},{name:"Add a Config Environment Variable that remains readable later",value:`${packageName} env add API_TOKEN --no-sensitive`},{name:"Add a new Environment Variable for a specific Environment and Git Branch",value:[`${packageName} env add <name> --environment ${targetPlaceholder} --git-branch <BRANCH>`,`${packageName} env add DB_PASS --environment preview --git-branch feat1`]},{name:"Add a new Environment Variable from stdin",value:[`cat <file> | ${packageName} env add <name> --environment ${targetPlaceholder}`,`cat ~/.npmrc | ${packageName} env add NPM_RC --environment preview`,`${packageName} env add API_URL --environment production < url.txt`]},{name:"Add with --value for non-interactive use",value:`${packageName} env add API_TOKEN --environment production --value "<value>" --yes`}]},removeSubcommand={name:"remove",aliases:["rm"],description:"Remove an Environment Variable (see examples below)",arguments:[{name:"name",required:!0}],options:[projectOption,{...environmentOption,description:"Remove the variable from this environment only. Without it, the variable is removed from all of its environments"},{...gitBranchOption,description:"Remove the variable for this Git branch only"},{...yesOption,description:"Skip the confirmation prompt when removing an Environment Variable"}],examples:[{name:"Remove a variable from multiple Environments",value:[`${packageName} env remove <name>`,`${packageName} env remove API_TOKEN`]},{name:"Remove a variable from a specific Environment",value:[`${packageName} env remove <name> --environment ${targetPlaceholder}`,`${packageName} env remove NPM_RC --environment preview`]},{name:"Remove a variable from a specific Environment and Git Branch",value:[`${packageName} env remove <name> --environment ${targetPlaceholder} --git-branch <BRANCH>`,`${packageName} env remove NPM_RC --environment preview --git-branch feat1`]}]},pullSubcommand={name:"pull",aliases:[],description:"Pull Environment Variables into a local file (default: .env.local)",arguments:[{name:"filename",required:!1}],options:[projectOption,{name:"environment",description:"Select the environment to pull (default: development)",shorthand:"e",type:String,argument:"ENVIRONMENT",deprecated:!1},{...gitBranchOption,description:"Specify the Git branch to pull specific Environment Variables for"},{...deploymentOption,description:"Pull Environment Variables for a specific deployment (e.g. dpl_xxx)"},{name:"id",shorthand:null,type:String,deprecated:!0},{...yesOption,description:"Skip the confirmation prompt when overwriting an existing file"}],examples:[{name:"Pull Development Environment Variables into a custom file (check .gitignore)",value:[`${packageName} env pull <file>`,`${packageName} env pull .env.development.local`]},{name:"Pull Environment Variables for a specific deployment",value:`${packageName} env pull --deployment dpl_xxx`}]},runSubcommand={name:"run",aliases:[],description:"Run a command with environment variables from the linked Vercel project",arguments:[{name:"command",required:!0,multiple:!0}],options:[projectOption,{name:"environment",description:"Specify the environment to pull variables from (default: development)",shorthand:"e",type:String,argument:"ENVIRONMENT",deprecated:!1},{...gitBranchOption,description:"Specify the Git branch to pull specific Environment Variables for"}],examples:[{name:"Run Next.js dev server with development environment variables",value:`${packageName} env run -- next dev`},{name:"Run tests with preview environment variables for a specific branch",value:`${packageName} env run -e preview --git-branch feature-x -- npm test`}]},updateSubcommand={name:"update",aliases:[],description:"Update the value of an existing Environment Variable (see examples below)",arguments:[{name:"name",required:!0}],options:[projectOption,{...environmentOption,description:"Pick the variable to update by an environment it covers. The new value applies to all of its environments"},{...gitBranchOption,description:"Pick the variable to update by its Git branch"},{name:"sensitive",description:"Store the updated value as a Secret",shorthand:null,type:Boolean,deprecated:!1},{name:"type",description:"Set the Environment Variable type (`config` or `secret`)",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"visibility",description:"Deprecated alias for `--type`",shorthand:null,type:String,argument:"VISIBILITY",deprecated:!0},{...yesOption,description:"Skip the confirmation prompt when updating an Environment Variable"},{name:"value",description:"New value for the variable (non-interactive). Otherwise use stdin or you will be prompted.",shorthand:null,type:String,argument:"VALUE",deprecated:!1}],examples:[{name:"Update a variable in all Environments",value:[`${packageName} env update <name>`,`${packageName} env update API_TOKEN`]},{name:"Update the variable that covers a specific Environment",value:[`${packageName} env update <name> --environment ${targetPlaceholder}`,`${packageName} env update DB_PASS --environment production`]},{name:"Update the variable for a specific Environment and Git Branch",value:[`${packageName} env update <name> --environment ${targetPlaceholder} --git-branch <BRANCH>`,`${packageName} env update NPM_RC --environment preview --git-branch feat1`]},{name:"Update a variable from stdin",value:[`cat <file> | ${packageName} env update <name> --environment ${targetPlaceholder}`,`cat ~/.npmrc | ${packageName} env update NPM_RC --environment preview`,`${packageName} env update API_URL --environment production < url.txt`]}]},envCommand={name:"env",aliases:[],description:"Interact with Environment Variables for a Project",arguments:[],subcommands:[addSubcommand,listSubcommand,pullSubcommand,removeSubcommand,runSubcommand,updateSubcommand],options:[],examples:[{name:"Run a command with Environment Variables from the linked Project",value:`${packageName} env run -- <command>`},{name:"Add one variable to multiple Environments",value:`${packageName} env add API_URL --environment production,preview,development`}]};export{envTargetChoices,isValidEnvTarget,getEnvTargetPlaceholder,parseEnvTargetArg,resolveEnvTargetInput,listSubcommand,addSubcommand,removeSubcommand,pullSubcommand,runSubcommand,updateSubcommand,envCommand};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
function isValidName(name=""){let blacklist=":/#?&@%+~".split("");return!name.split("").every(c=>blacklist.includes(c))}export{isValidName};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{__commonJS}from"./chunk-BZENIQ7N.js";var require_is_date=__commonJS({"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/is_date/index.js"(exports,module){function isDate(argument){return argument instanceof Date}module.exports=isDate}});var require_parse=__commonJS({"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/parse/index.js"(exports,module){var isDate=require_is_date(),MILLISECONDS_IN_HOUR=36e5,MILLISECONDS_IN_MINUTE=6e4,DEFAULT_ADDITIONAL_DIGITS=2,parseTokenDateTimeDelimeter=/[T ]/,parseTokenPlainTime=/:/,parseTokenYY=/^(\d{2})$/,parseTokensYYY=[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],parseTokenYYYY=/^(\d{4})/,parseTokensYYYYY=[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],parseTokenMM=/^-(\d{2})$/,parseTokenDDD=/^-?(\d{3})$/,parseTokenMMDD=/^-?(\d{2})-?(\d{2})$/,parseTokenWww=/^-?W(\d{2})$/,parseTokenWwwD=/^-?W(\d{2})-?(\d{1})$/,parseTokenHH=/^(\d{2}([.,]\d*)?)$/,parseTokenHHMM=/^(\d{2}):?(\d{2}([.,]\d*)?)$/,parseTokenHHMMSS=/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,parseTokenTimezone=/([Z+-].*)$/,parseTokenTimezoneZ=/^(Z)$/,parseTokenTimezoneHH=/^([+-])(\d{2})$/,parseTokenTimezoneHHMM=/^([+-])(\d{2}):?(\d{2})$/;function parse(argument,dirtyOptions){if(isDate(argument))return new Date(argument.getTime());if(typeof argument!="string")return new Date(argument);var options=dirtyOptions||{},additionalDigits=options.additionalDigits;additionalDigits==null?additionalDigits=DEFAULT_ADDITIONAL_DIGITS:additionalDigits=Number(additionalDigits);var dateStrings=splitDateString(argument),parseYearResult=parseYear(dateStrings.date,additionalDigits),year=parseYearResult.year,restDateString=parseYearResult.restDateString,date=parseDate(restDateString,year);if(date){var timestamp=date.getTime(),time=0,offset;return dateStrings.time&&(time=parseTime(dateStrings.time)),dateStrings.timezone?offset=parseTimezone(dateStrings.timezone):(offset=new Date(timestamp+time).getTimezoneOffset(),offset=new Date(timestamp+time+offset*MILLISECONDS_IN_MINUTE).getTimezoneOffset()),new Date(timestamp+time+offset*MILLISECONDS_IN_MINUTE)}else return new Date(argument)}function splitDateString(dateString){var dateStrings={},array=dateString.split(parseTokenDateTimeDelimeter),timeString;if(parseTokenPlainTime.test(array[0])?(dateStrings.date=null,timeString=array[0]):(dateStrings.date=array[0],timeString=array[1]),timeString){var token=parseTokenTimezone.exec(timeString);token?(dateStrings.time=timeString.replace(token[1],""),dateStrings.timezone=token[1]):dateStrings.time=timeString}return dateStrings}function parseYear(dateString,additionalDigits){var parseTokenYYY=parseTokensYYY[additionalDigits],parseTokenYYYYY=parseTokensYYYYY[additionalDigits],token;if(token=parseTokenYYYY.exec(dateString)||parseTokenYYYYY.exec(dateString),token){var yearString=token[1];return{year:parseInt(yearString,10),restDateString:dateString.slice(yearString.length)}}if(token=parseTokenYY.exec(dateString)||parseTokenYYY.exec(dateString),token){var centuryString=token[1];return{year:parseInt(centuryString,10)*100,restDateString:dateString.slice(centuryString.length)}}return{year:null}}function parseDate(dateString,year){if(year===null)return null;var token,date,month,week;if(dateString.length===0)return date=new Date(0),date.setUTCFullYear(year),date;if(token=parseTokenMM.exec(dateString),token)return date=new Date(0),month=parseInt(token[1],10)-1,date.setUTCFullYear(year,month),date;if(token=parseTokenDDD.exec(dateString),token){date=new Date(0);var dayOfYear=parseInt(token[1],10);return date.setUTCFullYear(year,0,dayOfYear),date}if(token=parseTokenMMDD.exec(dateString),token){date=new Date(0),month=parseInt(token[1],10)-1;var day=parseInt(token[2],10);return date.setUTCFullYear(year,month,day),date}if(token=parseTokenWww.exec(dateString),token)return week=parseInt(token[1],10)-1,dayOfISOYear(year,week);if(token=parseTokenWwwD.exec(dateString),token){week=parseInt(token[1],10)-1;var dayOfWeek=parseInt(token[2],10)-1;return dayOfISOYear(year,week,dayOfWeek)}return null}function parseTime(timeString){var token,hours,minutes;if(token=parseTokenHH.exec(timeString),token)return hours=parseFloat(token[1].replace(",",".")),hours%24*MILLISECONDS_IN_HOUR;if(token=parseTokenHHMM.exec(timeString),token)return hours=parseInt(token[1],10),minutes=parseFloat(token[2].replace(",",".")),hours%24*MILLISECONDS_IN_HOUR+minutes*MILLISECONDS_IN_MINUTE;if(token=parseTokenHHMMSS.exec(timeString),token){hours=parseInt(token[1],10),minutes=parseInt(token[2],10);var seconds=parseFloat(token[3].replace(",","."));return hours%24*MILLISECONDS_IN_HOUR+minutes*MILLISECONDS_IN_MINUTE+seconds*1e3}return null}function parseTimezone(timezoneString){var token,absoluteOffset;return token=parseTokenTimezoneZ.exec(timezoneString),token?0:(token=parseTokenTimezoneHH.exec(timezoneString),token?(absoluteOffset=parseInt(token[2],10)*60,token[1]==="+"?-absoluteOffset:absoluteOffset):(token=parseTokenTimezoneHHMM.exec(timezoneString),token?(absoluteOffset=parseInt(token[2],10)*60+parseInt(token[3],10),token[1]==="+"?-absoluteOffset:absoluteOffset):0))}function dayOfISOYear(isoYear,week,day){week=week||0,day=day||0;var date=new Date(0);date.setUTCFullYear(isoYear,0,4);var fourthOfJanuaryDay=date.getUTCDay()||7,diff=week*7+day+1-fourthOfJanuaryDay;return date.setUTCDate(date.getUTCDate()+diff),date}module.exports=parse}});var require_start_of_year=__commonJS({"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/start_of_year/index.js"(exports,module){var parse=require_parse();function startOfYear(dirtyDate){var cleanDate=parse(dirtyDate),date=new Date(0);return date.setFullYear(cleanDate.getFullYear(),0,1),date.setHours(0,0,0,0),date}module.exports=startOfYear}});var require_start_of_day=__commonJS({"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/start_of_day/index.js"(exports,module){var parse=require_parse();function startOfDay(dirtyDate){var date=parse(dirtyDate);return date.setHours(0,0,0,0),date}module.exports=startOfDay}});var require_difference_in_calendar_days=__commonJS({"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/difference_in_calendar_days/index.js"(exports,module){var startOfDay=require_start_of_day(),MILLISECONDS_IN_MINUTE=6e4,MILLISECONDS_IN_DAY=864e5;function differenceInCalendarDays(dirtyDateLeft,dirtyDateRight){var startOfDayLeft=startOfDay(dirtyDateLeft),startOfDayRight=startOfDay(dirtyDateRight),timestampLeft=startOfDayLeft.getTime()-startOfDayLeft.getTimezoneOffset()*MILLISECONDS_IN_MINUTE,timestampRight=startOfDayRight.getTime()-startOfDayRight.getTimezoneOffset()*MILLISECONDS_IN_MINUTE;return Math.round((timestampLeft-timestampRight)/MILLISECONDS_IN_DAY)}module.exports=differenceInCalendarDays}});var require_get_day_of_year=__commonJS({"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/get_day_of_year/index.js"(exports,module){var parse=require_parse(),startOfYear=require_start_of_year(),differenceInCalendarDays=require_difference_in_calendar_days();function getDayOfYear(dirtyDate){var date=parse(dirtyDate),diff=differenceInCalendarDays(date,startOfYear(date)),dayOfYear=diff+1;return dayOfYear}module.exports=getDayOfYear}});var require_start_of_week=__commonJS({"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/start_of_week/index.js"(exports,module){var parse=require_parse();function startOfWeek(dirtyDate,dirtyOptions){var weekStartsOn=dirtyOptions&&Number(dirtyOptions.weekStartsOn)||0,date=parse(dirtyDate),day=date.getDay(),diff=(day<weekStartsOn?7:0)+day-weekStartsOn;return date.setDate(date.getDate()-diff),date.setHours(0,0,0,0),date}module.exports=startOfWeek}});var require_start_of_iso_week=__commonJS({"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/start_of_iso_week/index.js"(exports,module){var startOfWeek=require_start_of_week();function startOfISOWeek(dirtyDate){return startOfWeek(dirtyDate,{weekStartsOn:1})}module.exports=startOfISOWeek}});var require_get_iso_year=__commonJS({"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/get_iso_year/index.js"(exports,module){var parse=require_parse(),startOfISOWeek=require_start_of_iso_week();function getISOYear(dirtyDate){var date=parse(dirtyDate),year=date.getFullYear(),fourthOfJanuaryOfNextYear=new Date(0);fourthOfJanuaryOfNextYear.setFullYear(year+1,0,4),fourthOfJanuaryOfNextYear.setHours(0,0,0,0);var startOfNextYear=startOfISOWeek(fourthOfJanuaryOfNextYear),fourthOfJanuaryOfThisYear=new Date(0);fourthOfJanuaryOfThisYear.setFullYear(year,0,4),fourthOfJanuaryOfThisYear.setHours(0,0,0,0);var startOfThisYear=startOfISOWeek(fourthOfJanuaryOfThisYear);return date.getTime()>=startOfNextYear.getTime()?year+1:date.getTime()>=startOfThisYear.getTime()?year:year-1}module.exports=getISOYear}});var require_start_of_iso_year=__commonJS({"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/start_of_iso_year/index.js"(exports,module){var getISOYear=require_get_iso_year(),startOfISOWeek=require_start_of_iso_week();function startOfISOYear(dirtyDate){var year=getISOYear(dirtyDate),fourthOfJanuary=new Date(0);fourthOfJanuary.setFullYear(year,0,4),fourthOfJanuary.setHours(0,0,0,0);var date=startOfISOWeek(fourthOfJanuary);return date}module.exports=startOfISOYear}});var require_get_iso_week=__commonJS({"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/get_iso_week/index.js"(exports,module){var parse=require_parse(),startOfISOWeek=require_start_of_iso_week(),startOfISOYear=require_start_of_iso_year(),MILLISECONDS_IN_WEEK=6048e5;function getISOWeek(dirtyDate){var date=parse(dirtyDate),diff=startOfISOWeek(date).getTime()-startOfISOYear(date).getTime();return Math.round(diff/MILLISECONDS_IN_WEEK)+1}module.exports=getISOWeek}});var require_is_valid=__commonJS({"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/is_valid/index.js"(exports,module){var isDate=require_is_date();function isValid(dirtyDate){if(isDate(dirtyDate))return!isNaN(dirtyDate);throw new TypeError(toString.call(dirtyDate)+" is not an instance of Date")}module.exports=isValid}});var require_build_distance_in_words_locale=__commonJS({"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/locale/en/build_distance_in_words_locale/index.js"(exports,module){function buildDistanceInWordsLocale(){var distanceInWordsLocale={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function localize(token,count,options){options=options||{};var result;return typeof distanceInWordsLocale[token]=="string"?result=distanceInWordsLocale[token]:count===1?result=distanceInWordsLocale[token].one:result=distanceInWordsLocale[token].other.replace("{{count}}",count),options.addSuffix?options.comparison>0?"in "+result:result+" ago":result}return{localize}}module.exports=buildDistanceInWordsLocale}});var require_build_formatting_tokens_reg_exp=__commonJS({"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/locale/_lib/build_formatting_tokens_reg_exp/index.js"(exports,module){var commonFormatterKeys=["M","MM","Q","D","DD","DDD","DDDD","d","E","W","WW","YY","YYYY","GG","GGGG","H","HH","h","hh","m","mm","s","ss","S","SS","SSS","Z","ZZ","X","x"];function buildFormattingTokensRegExp(formatters){var formatterKeys=[];for(var key in formatters)formatters.hasOwnProperty(key)&&formatterKeys.push(key);var formattingTokens=commonFormatterKeys.concat(formatterKeys).sort().reverse(),formattingTokensRegExp=new RegExp("(\\[[^\\[]*\\])|(\\\\)?("+formattingTokens.join("|")+"|.)","g");return formattingTokensRegExp}module.exports=buildFormattingTokensRegExp}});var require_build_format_locale=__commonJS({"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/locale/en/build_format_locale/index.js"(exports,module){var buildFormattingTokensRegExp=require_build_formatting_tokens_reg_exp();function buildFormatLocale(){var months3char=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],monthsFull=["January","February","March","April","May","June","July","August","September","October","November","December"],weekdays2char=["Su","Mo","Tu","We","Th","Fr","Sa"],weekdays3char=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],weekdaysFull=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],meridiemUppercase=["AM","PM"],meridiemLowercase=["am","pm"],meridiemFull=["a.m.","p.m."],formatters={MMM:function(date){return months3char[date.getMonth()]},MMMM:function(date){return monthsFull[date.getMonth()]},dd:function(date){return weekdays2char[date.getDay()]},ddd:function(date){return weekdays3char[date.getDay()]},dddd:function(date){return weekdaysFull[date.getDay()]},A:function(date){return date.getHours()/12>=1?meridiemUppercase[1]:meridiemUppercase[0]},a:function(date){return date.getHours()/12>=1?meridiemLowercase[1]:meridiemLowercase[0]},aa:function(date){return date.getHours()/12>=1?meridiemFull[1]:meridiemFull[0]}},ordinalFormatters=["M","D","DDD","d","Q","W"];return ordinalFormatters.forEach(function(formatterToken){formatters[formatterToken+"o"]=function(date,formatters2){return ordinal(formatters2[formatterToken](date))}}),{formatters,formattingTokensRegExp:buildFormattingTokensRegExp(formatters)}}function ordinal(number){var rem100=number%100;if(rem100>20||rem100<10)switch(rem100%10){case 1:return number+"st";case 2:return number+"nd";case 3:return number+"rd"}return number+"th"}module.exports=buildFormatLocale}});var require_en=__commonJS({"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/locale/en/index.js"(exports,module){var buildDistanceInWordsLocale=require_build_distance_in_words_locale(),buildFormatLocale=require_build_format_locale();module.exports={distanceInWords:buildDistanceInWordsLocale(),format:buildFormatLocale()}}});var require_format=__commonJS({"../../node_modules/.pnpm/date-fns@1.29.0/node_modules/date-fns/format/index.js"(exports,module){var getDayOfYear=require_get_day_of_year(),getISOWeek=require_get_iso_week(),getISOYear=require_get_iso_year(),parse=require_parse(),isValid=require_is_valid(),enLocale=require_en();function format(dirtyDate,dirtyFormatStr,dirtyOptions){var formatStr=dirtyFormatStr?String(dirtyFormatStr):"YYYY-MM-DDTHH:mm:ss.SSSZ",options=dirtyOptions||{},locale=options.locale,localeFormatters=enLocale.format.formatters,formattingTokensRegExp=enLocale.format.formattingTokensRegExp;locale&&locale.format&&locale.format.formatters&&(localeFormatters=locale.format.formatters,locale.format.formattingTokensRegExp&&(formattingTokensRegExp=locale.format.formattingTokensRegExp));var date=parse(dirtyDate);if(!isValid(date))return"Invalid Date";var formatFn=buildFormatFn(formatStr,localeFormatters,formattingTokensRegExp);return formatFn(date)}var formatters={M:function(date){return date.getMonth()+1},MM:function(date){return addLeadingZeros(date.getMonth()+1,2)},Q:function(date){return Math.ceil((date.getMonth()+1)/3)},D:function(date){return date.getDate()},DD:function(date){return addLeadingZeros(date.getDate(),2)},DDD:function(date){return getDayOfYear(date)},DDDD:function(date){return addLeadingZeros(getDayOfYear(date),3)},d:function(date){return date.getDay()},E:function(date){return date.getDay()||7},W:function(date){return getISOWeek(date)},WW:function(date){return addLeadingZeros(getISOWeek(date),2)},YY:function(date){return addLeadingZeros(date.getFullYear(),4).substr(2)},YYYY:function(date){return addLeadingZeros(date.getFullYear(),4)},GG:function(date){return String(getISOYear(date)).substr(2)},GGGG:function(date){return getISOYear(date)},H:function(date){return date.getHours()},HH:function(date){return addLeadingZeros(date.getHours(),2)},h:function(date){var hours=date.getHours();return hours===0?12:hours>12?hours%12:hours},hh:function(date){return addLeadingZeros(formatters.h(date),2)},m:function(date){return date.getMinutes()},mm:function(date){return addLeadingZeros(date.getMinutes(),2)},s:function(date){return date.getSeconds()},ss:function(date){return addLeadingZeros(date.getSeconds(),2)},S:function(date){return Math.floor(date.getMilliseconds()/100)},SS:function(date){return addLeadingZeros(Math.floor(date.getMilliseconds()/10),2)},SSS:function(date){return addLeadingZeros(date.getMilliseconds(),3)},Z:function(date){return formatTimezone(date.getTimezoneOffset(),":")},ZZ:function(date){return formatTimezone(date.getTimezoneOffset())},X:function(date){return Math.floor(date.getTime()/1e3)},x:function(date){return date.getTime()}};function buildFormatFn(formatStr,localeFormatters,formattingTokensRegExp){var array=formatStr.match(formattingTokensRegExp),length=array.length,i,formatter;for(i=0;i<length;i++)formatter=localeFormatters[array[i]]||formatters[array[i]],formatter?array[i]=formatter:array[i]=removeFormattingTokens(array[i]);return function(date){for(var output="",i2=0;i2<length;i2++)array[i2]instanceof Function?output+=array[i2](date,formatters):output+=array[i2];return output}}function removeFormattingTokens(input){return input.match(/\[[\s\S]/)?input.replace(/^\[|]$/g,""):input.replace(/\\/g,"")}function formatTimezone(offset,delimeter){delimeter=delimeter||"";var sign=offset>0?"-":"+",absOffset=Math.abs(offset),hours=Math.floor(absOffset/60),minutes=absOffset%60;return sign+addLeadingZeros(hours,2)+delimeter+addLeadingZeros(minutes,2)}function addLeadingZeros(number,targetLength){for(var output=Math.abs(number).toString();output.length<targetLength;)output="0"+output;return output}module.exports=format}});export{require_format};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{applyEdits,init_main,modify,parse as parse2,printParseErrorCode}from"./chunk-J24BABG4.js";import{init_dist,parse,stringify}from"./chunk-U4Z2MMOF.js";import{external_exports}from"./chunk-2NABMKFV.js";import{require_execa}from"./chunk-BUJITHGZ.js";import{printAlignedLabel}from"./chunk-ADLBLGT3.js";import{output_manager_default}from"./chunk-XP3FT56R.js";import{__toESM}from"./chunk-BZENIQ7N.js";import{join as join2}from"node:path";init_dist();init_main();import{readFile,writeFile,mkdir,copyFile,access,chmod,lstat,stat,link,unlink}from"node:fs/promises";import{isDeepStrictEqual}from"node:util";import{dirname}from"node:path";async function pathExists(path){try{return await access(path),!0}catch{return!1}}async function isFile(path){try{return(await stat(path)).isFile()}catch{return!1}}async function isSymlink(path){try{return(await lstat(path)).isSymbolicLink()}catch{return!1}}async function readFileOrNull(path){try{return await readFile(path,"utf8")}catch(err){if(err.code==="ENOENT")return null;throw err}}function isPlainObject(value){return typeof value=="object"&&value!==null&&!Array.isArray(value)&&Object.getPrototypeOf(value)===Object.prototype}function deepMerge(base,patch){let out={...base};for(let[key,patchValue]of Object.entries(patch)){let baseValue=out[key];isPlainObject(baseValue)&&isPlainObject(patchValue)?out[key]=deepMerge(baseValue,patchValue):out[key]=patchValue}return out}function detectJsonFormatting(text){let eol=text.includes(`\r
|
|
8
|
+
`)?`\r
|
|
9
|
+
`:`
|
|
10
|
+
`,indent=text.match(/^([ \t]+)\S/m)?.[1];return indent?.startsWith(" ")?{eol,insertSpaces:!1,tabSize:1}:{eol,insertSpaces:!0,tabSize:indent?.length||2}}function parseJsonObjectOrNull(current,parse4=JSON.parse){if(!current||!current.trim())return null;let raw;try{raw=parse4(current)}catch(err){throw new Error(`existing file is not valid JSON (${err.message})`)}if(!isPlainObject(raw))throw new Error("existing file is not a JSON object");return raw}function mergeJson(current,patch,parse4=JSON.parse){let raw=parseJsonObjectOrNull(current,parse4);if(!current||raw===null)return`${JSON.stringify(deepMerge({},patch),null,2)}
|
|
11
|
+
`;let merged=deepMerge(raw,patch),modifyOptions=current.trim().includes(`
|
|
12
|
+
`)?{formattingOptions:detectJsonFormatting(current)}:{};try{let text=current,splice=(existing,subPatch,path)=>{for(let[key,patchValue]of Object.entries(subPatch)){let existingValue=existing?.[key];isPlainObject(patchValue)&&isPlainObject(existingValue)?splice(existingValue,patchValue,[...path,key]):isDeepStrictEqual(existingValue,patchValue)||(text=applyEdits(text,modify(text,[...path,key],patchValue,modifyOptions)))}};if(splice(raw,patch,[]),isDeepStrictEqual(parse4(text),merged))return text}catch{}return`${JSON.stringify(merged,null,2)}
|
|
13
|
+
`}function mergeJsonc(current,patch){return mergeJson(current,patch,text=>{let errors=[],value=parse2(text,errors,{allowTrailingComma:!0}),first=errors[0];if(first)throw new Error(`${printParseErrorCode(first.error)} at offset ${first.offset}`);return value})}function patchSatisfied(existing,patch){for(let[key,patchValue]of Object.entries(patch)){let existingValue=isPlainObject(existing)?existing[key]:void 0;if(isPlainObject(patchValue)&&isPlainObject(existingValue)){if(!patchSatisfied(existingValue,patchValue))return!1}else if(!isDeepStrictEqual(existingValue,patchValue))return!1}return!0}function tomlScalar(value){switch(typeof value){case"string":return JSON.stringify(value);case"number":return Number.isFinite(value)?String(value):null;case"boolean":return String(value);default:return null}}var TOML_BARE_KEY=/^[A-Za-z0-9_-]+$/;function flattenTomlPatch(patch,prefix="",out=new Map){for(let[key,value]of Object.entries(patch)){if(!TOML_BARE_KEY.test(key))return null;if(isPlainObject(value)){if(!flattenTomlPatch(value,prefix?`${prefix}.${key}`:key,out))return null}else{let scalar=tomlScalar(value);if(scalar===null)return null;let section=out.get(prefix);section||(section=new Map,out.set(prefix,section)),section.set(key,scalar)}}return out}var TOML_HEADER=/^\s*\[\[?\s*([^\]]*?)\s*\]\]?\s*(?:#.*)?$/;function mergeToml(current,patch){let parsed={};if(current&¤t.trim())try{parsed=parse(current)}catch(err){throw new Error(`existing file is not valid TOML (${err.message})`)}let legacy=()=>`${stringify(deepMerge(parsed,patch))}
|
|
14
|
+
`;if(!current||!current.trim())return legacy();if(patchSatisfied(parsed,patch))return current;let flat=flattenTomlPatch(patch);if(!flat)return legacy();let crlf=current.includes(`\r
|
|
15
|
+
`),lines=current.split(`
|
|
16
|
+
`),content=line=>line.endsWith("\r")?line.slice(0,-1):line,finish=(line,i)=>i<lines.length&&lines[i]?.endsWith("\r")?`${line}\r`:line,headerAt=i=>{let m=content(lines[i]).match(TOML_HEADER);return m?m[1].split(".").map(s=>s.trim()).join("."):null},sectionRange=name=>{let start=name===""?0:-1;for(let i=0;i<lines.length;i++){let header=headerAt(i);if(header!==null){if(start!==-1)return[start,i];if(name==="")return[0,i];header===name&&(start=i+1)}}return start===-1?null:[start,lines.length]},appendSections=[];for(let[name,keys]of flat){let range=sectionRange(name);if(!range){appendSections.push(`[${name}]`,...[...keys].map(([k,v])=>`${k} = ${v}`));continue}let[start,end]=range,inserts=[];for(let[key,value]of keys){let assignment=new RegExp(`^(\\s*)${key}\\s*=`),replaced=!1;for(let i=start;i<end;i++){let m=content(lines[i]).match(assignment);if(m){lines[i]=finish(`${m[1]}${key} = ${value}`,i),replaced=!0;break}}replaced||inserts.push(`${key} = ${value}`)}if(inserts.length>0){let at=start;for(let i=start;i<end;i++)content(lines[i]).trim()!==""&&(at=i+1);lines.splice(at,0,...inserts.map(l=>finish(l,at)))}}if(appendSections.length>0){for(;lines.length>0&&content(lines[lines.length-1]).trim()==="";)lines.pop();let eol=crlf?"\r":"";lines.push(...["",...appendSections,""].map(l=>l===""?l:`${l}${eol}`))}let result=lines.join(`
|
|
17
|
+
`);try{if(isDeepStrictEqual(parse(result),deepMerge(parsed,patch)))return result}catch{}return legacy()}var MANAGED_BLOCK_START="# >>> vercel ai-gateway >>>",MANAGED_BLOCK_END="# <<< vercel ai-gateway <<<";function upsertManagedBlock(current,body){let block=`${MANAGED_BLOCK_START}
|
|
18
|
+
${body}
|
|
19
|
+
${MANAGED_BLOCK_END}`,existing=current??"",start=existing.indexOf(MANAGED_BLOCK_START),end=existing.indexOf(MANAGED_BLOCK_END);if(start!==-1&&end!==-1&&end>start){let before=existing.slice(0,start),after=existing.slice(end+MANAGED_BLOCK_END.length);return`${before}${block}${after}`}if(existing.length===0)return`${block}
|
|
20
|
+
`;let prefix=existing.endsWith(`
|
|
21
|
+
|
|
22
|
+
`)?"":existing.endsWith(`
|
|
23
|
+
`)?`
|
|
24
|
+
`:`
|
|
25
|
+
|
|
26
|
+
`;return`${existing}${prefix}${block}
|
|
27
|
+
`}async function publishNoClobber(temporary,destination){try{return await link(temporary,destination),!0}catch(error){if(error.code==="EEXIST")return!1;throw error}finally{await unlink(temporary).catch(()=>{})}}async function ensureMode(path,mode){try{await chmod(path,mode)}catch{}}async function backupFile(path,mode){let backupPath=`${path}.bak`;return mode===void 0?(await copyFile(path,backupPath),backupPath):(await ensureMode(backupPath,mode),await writeFile(backupPath,await readFile(path,"utf8"),{mode}),backupPath)}async function writeConfigFile(path,content,mode){await mkdir(dirname(path),{recursive:!0}),mode!==void 0&&await ensureMode(path,mode),await writeFile(path,content,mode===void 0?"utf8":{mode})}var GATEWAY_ANTHROPIC_BASE_URL="https://ai-gateway.vercel.sh",GATEWAY_CODING_AGENT_BASE_URL="https://ai-gateway.vercel.sh/coding-agent/v1",GATEWAY_CURSOR_BASE_URL="https://ai-gateway.vercel.sh/cursor/v1",GATEWAY_CODEX_BASE_URL="https://ai-gateway.vercel.sh/codex/v1",GATEWAY_CLAUDE_CODE_BASE_URL="https://ai-gateway.vercel.sh/claude-code",GATEWAY_API_KEY_ENV="AI_GATEWAY_API_KEY",GATEWAY_DEFAULT_MODEL="anthropic/claude-fable-5",KEY_PLACEHOLDER="__AI_GATEWAY_API_KEY__";function resolveGatewayBaseUrl(override,agentDefault){let trimmed=override?.trim();return trimmed||agentDefault}function maskSecret(secret){return secret&&(secret===KEY_PLACEHOLDER||secret.length<=8?"\u2022\u2022\u2022\u2022":`${secret.slice(0,4)}\u2022\u2022\u2022\u2022${secret.slice(-4)}`)}import{randomUUID}from"node:crypto";import*as fs from"node:fs/promises";import{dirname as dirname2,join}from"node:path";var MAX_RECORD_BYTES=1024*1024;function codeSpan(value){return`\`${value.replace(/[`\r\n]/g,"")}\``}var RECORD_PATTERN=/\.json$/;function claudeAppSupportRoot(home){return process.platform==="darwin"?join(home,"Library","Application Support"):process.platform==="win32"?process.env.APPDATA||join(home,"AppData","Roaming"):join(home,".config")}function toGatewayModelId(model){return model.includes("/")?model:`anthropic/${model}`}async function listSubdirectories(path){try{return(await fs.readdir(path,{withFileTypes:!0})).filter(e=>e.isDirectory()).map(e=>e.name)}catch{return[]}}async function findDestinationIdentity(root){let best=null;for(let account of await listSubdirectories(root))for(let org of await listSubdirectories(join(root,account))){let path=join(root,account,org);try{let stat4=await fs.stat(path);(!best||stat4.mtimeMs>best.mtime)&&(best={path,mtime:stat4.mtimeMs})}catch{}}return best?.path??null}async function readRecord(path){let stat4;try{stat4=await fs.stat(path)}catch{return null}if(!stat4.isFile()||stat4.size>MAX_RECORD_BYTES)return null;try{let raw=await fs.readFile(path,"utf8"),record=JSON.parse(raw);return typeof record!="object"||record===null||Array.isArray(record)?null:{record,bytes:stat4.size}}catch{return null}}async function writeRecordNoClobber(destination,contents){if(await pathExists(destination))return"skipped";await fs.mkdir(dirname2(destination),{recursive:!0});let temp=join(dirname2(destination),`.migrate-${randomUUID()}.tmp`);return await fs.writeFile(temp,contents,{mode:384}),await publishNoClobber(temp,destination)?"copied":"skipped"}async function planClaudeDesktopSessionMigration(home,appSupportRoot=claudeAppSupportRoot(home)){let subscriptionRoot=join(appSupportRoot,"Claude","claude-code-sessions"),gatewayRoot=join(appSupportRoot,"Claude-3p","claude-code-sessions"),destinationDir=await findDestinationIdentity(gatewayRoot);if(!destinationDir)return null;let copies=[],totalBytes=0;for(let account of await listSubdirectories(subscriptionRoot))for(let org of await listSubdirectories(join(subscriptionRoot,account))){let identityDir=join(subscriptionRoot,account,org),names;try{names=await fs.readdir(identityDir)}catch{continue}for(let name of names){if(!RECORD_PATTERN.test(name))continue;let source=join(identityDir,name),destination=join(destinationDir,name);if(await pathExists(destination))continue;let read=await readRecord(source);read&&(copies.push({source,destination,bytes:read.bytes}),totalBytes+=read.bytes)}}return copies.length===0?null:{label:"Claude Desktop sessions",itemCount:copies.length,totalBytes,sourceRoots:[subscriptionRoot],destinationRoots:[destinationDir],prompt:[`Copy the ${copies.length} Claude Desktop session record${copies.length===1?"":"s"} (per-session \`.json\` files) under ${codeSpan(subscriptionRoot)} into ${codeSpan(destinationDir)}, keeping each filename.`,"In each copy, rewrite the top-level `model` field to its AI Gateway id by prefixing `anthropic/` when the value has no provider prefix (e.g. `claude-opus-4-8` \u2192 `anthropic/claude-opus-4-8`); keep any suffix such as `[1m]` intact. Leave every other field unchanged.","Use atomic, no-clobber writes with mode 0600; skip records whose destination already exists. Never move, edit, delete, or overwrite an original record."],async apply(){let copied=0,skipped=0,errors=[];for(let copy of copies)try{let read=await readRecord(copy.source);if(!read){skipped+=1;continue}let record={...read.record};typeof record.model=="string"&&(record.model=toGatewayModelId(record.model)),await writeRecordNoClobber(copy.destination,`${JSON.stringify(record)}
|
|
28
|
+
`)==="copied"?copied+=1:skipped+=1}catch(error){errors.push(`${copy.source}: ${error instanceof Error?error.message:String(error)}`)}return errors.length>0?{copied,skipped,errors}:{copied,skipped}}}}function claudeDir(home){let dir=process.env.CLAUDE_CONFIG_DIR;return dir&&dir.trim()?dir:join2(home,".claude")}var claudeCode={id:"claude-code",displayName:"Claude Code",sessionMigration:{plan:({home})=>planClaudeDesktopSessionMigration(home)},async detect(home){return pathExists(claudeDir(home))},configPath(ctx){return ctx.overrides?.["claude-code"]??join2(claudeDir(ctx.home),"settings.json")},buildPlan(ctx){let path=this.configPath(ctx),env={ANTHROPIC_BASE_URL:resolveGatewayBaseUrl(ctx.baseUrlOverride,GATEWAY_CLAUDE_CODE_BASE_URL),ANTHROPIC_API_KEY:"",CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY:"1",ENABLE_TOOL_SEARCH:"true"},envExports=[];return ctx.useKeychain?envExports.push({name:"ANTHROPIC_AUTH_TOKEN",value:ctx.apiKey}):env.ANTHROPIC_AUTH_TOKEN=ctx.apiKey,{fileChanges:[{path,label:"Claude Code settings",format:"json",...ctx.useKeychain?{}:{mode:384},transform:current=>mergeJson(current,{env})}],envExports,notes:[...ctx.useKeychain?["The Anthropic auth token is read from your shell environment (Keychain-backed).","Open a new terminal so ANTHROPIC_AUTH_TOKEN is loaded, then restart Claude Code."]:["Restart Claude Code to pick up the new settings."],"The Claude Desktop app switches providers in its own settings (Developer \u2192 Configure Third-Party Inference\u2026). After its first gateway launch, re-run this command to copy your existing desktop sessions over."]}}};import{readFile as readFile3,writeFile as writeFile3}from"node:fs/promises";import{access as access2}from"node:fs/promises";import{join as join3}from"node:path";import{homedir}from"node:os";import{spawn}from"node:child_process";var PREFS_FILE="agent-preferences.json",CLAUDE_LEGACY_PLUGIN_ID="vercel-plugin@vercel",CLAUDE_OFFICIAL_MARKETPLACE="claude-plugins-official",CLAUDE_OFFICIAL_MARKETPLACE_SOURCE="anthropics/claude-plugins-official",CLAUDE_OFFICIAL_PLUGIN_ID=`vercel@${CLAUDE_OFFICIAL_MARKETPLACE}`,CLAUDE_DIRECTORY_PLUGIN_ID="vercel@anthropic-plugin-directory",VERCEL_PLUGIN_VERSION_URL="https://raw.githubusercontent.com/vercel/vercel-plugin/main/.claude-plugin/plugin.json",promptedAtSchema=external_exports.codec(external_exports.union([external_exports.iso.date(),external_exports.iso.datetime()]),external_exports.date(),{decode:value=>new Date(value),encode:value=>value.toISOString()}),agentPreferencesSchema=external_exports.object({pluginDeclined:external_exports.boolean().optional(),pluginAutoUpdate:external_exports.boolean().optional(),lastPromptedAt:promptedAtSchema.optional(),lastPluginAutoUpdateAttemptedAt:promptedAtSchema.optional(),lastPluginAutoUpdateAttemptedKey:external_exports.string().optional()});async function fileExists(filePath){try{return await access2(filePath),!0}catch{return!1}}async function readPrefs(client){return await client.maybeReadConfig(PREFS_FILE,agentPreferencesSchema)??{}}async function writePrefs(client,prefs){try{await client.writeConfig(PREFS_FILE,agentPreferencesSchema,prefs)}catch{}}async function getSavedPluginAnswer(client){let{pluginDeclined}=await readPrefs(client);return pluginDeclined===void 0?void 0:!pluginDeclined}async function savePluginAnswer(client,accepted){let prefs=await readPrefs(client);prefs.pluginDeclined=!accepted,prefs.pluginAutoUpdate=accepted,await markPromptedToday(client,prefs)}async function hasClaudeVercelPlugin(home){return(await readClaudeInstalledPluginsFromRegistry(join3(claudeDir(home),"plugins","installed_plugins.json"))).some(plugin=>plugin.id===CLAUDE_OFFICIAL_PLUGIN_ID||plugin.id===CLAUDE_DIRECTORY_PLUGIN_ID)}async function readClaudeInstalledPluginsFromRegistry(registryPath=getClaudeInstalledPluginsRegistryPath()){try{let raw=await readFile3(registryPath,"utf-8"),plugins=JSON.parse(raw)?.plugins??{},entries=[];for(let[id,installs]of Object.entries(plugins))if(Array.isArray(installs))for(let install of installs)!install||typeof install!="object"||entries.push({id,...install,enabled:!0});return entries}catch{return[]}}function getClaudeInstalledPluginsRegistryPath(){return join3(homedir(),".claude","plugins","installed_plugins.json")}async function markStaleClaudePluginInstalls(plugins){return Promise.all(plugins.map(async plugin=>plugin.installPath&&!await fileExists(plugin.installPath)?{...plugin,stale:!0}:plugin))}async function removeClaudePluginFromRegistry(pluginId){try{let registryPath=getClaudeInstalledPluginsRegistryPath(),raw=await readFile3(registryPath,"utf-8"),data=JSON.parse(raw);return!data.plugins||!(pluginId in data.plugins)?!1:(delete data.plugins[pluginId],await writeFile3(registryPath,`${JSON.stringify(data,null,2)}
|
|
29
|
+
`,"utf-8"),!0)}catch(err){return output_manager_default.debug(`Failed to remove Claude plugin registry entry: ${err}`),!1}}async function markPromptedToday(client,prefs){prefs.lastPromptedAt=new Date,await writePrefs(client,prefs)}async function runCommand(command,args){return await new Promise(resolve=>{let child=spawn(command,args,{stdio:"pipe"}),stdout="",stderr="";child.stdout.on("data",chunk=>{stdout+=chunk.toString()}),child.stderr.on("data",chunk=>{stderr+=chunk.toString()}),child.on("close",code=>{resolve({exitCode:code??1,stdout,stderr})}),child.on("error",err=>{resolve({exitCode:1,stdout,stderr:`${stderr}${String(err)}`})})})}async function getClaudeInstalledPlugins(){let result=await runCommand("claude",["plugins","list","--json"]);if(result.exitCode===0)try{let parsed=JSON.parse(result.stdout);if(Array.isArray(parsed))return markStaleClaudePluginInstalls(parsed)}catch(err){output_manager_default.debug(`Failed to parse Claude plugin list JSON: ${err}`)}else result.stderr.trim().length>0&&output_manager_default.debug(`Failed to run 'claude plugins list --json': ${result.stderr}`);return markStaleClaudePluginInstalls(await readClaudeInstalledPluginsFromRegistry())}async function fetchLatestVercelPluginVersion(){try{let response=await fetch(VERCEL_PLUGIN_VERSION_URL);if(!response.ok){output_manager_default.debug(`Failed to fetch latest Vercel plugin version: ${response.status}`);return}let manifest=await response.json();return typeof manifest.version=="string"?manifest.version:void 0}catch(err){output_manager_default.debug(`Failed to fetch latest Vercel plugin version: ${err}`);return}}function comparePluginVersions(a,b){if(!a&&!b)return 0;if(!a)return-1;if(!b)return 1;let parse4=value=>value.split(".").map(part=>Number.parseInt(part,10)||0),left=parse4(a),right=parse4(b),maxLength=Math.max(left.length,right.length);for(let i=0;i<maxLength;i++){let l=left[i]??0,r=right[i]??0;if(l>r)return 1;if(l<r)return-1}return 0}function buildClaudePluginStatus(installedPlugins,latestVersion){let legacy=installedPlugins.find(plugin=>plugin.id===CLAUDE_LEGACY_PLUGIN_ID),official=installedPlugins.find(plugin=>plugin.id===CLAUDE_OFFICIAL_PLUGIN_ID),state="none";return legacy&&official?state="both":legacy?state="legacy-only":official&&(state="official-only"),{state,legacy,official,latestVersion}}function buildClaudePluginMigrationPlan(status){let plan={installOfficial:!1,updateOfficial:!1,removeLegacy:!1,removeLegacyMarketplace:!1};switch(status.state){case"none":plan.installOfficial=!0;break;case"legacy-only":plan.installOfficial=!0,plan.removeLegacy=!0,plan.removeLegacyMarketplace=!0;break;case"both":plan.removeLegacy=!0,plan.removeLegacyMarketplace=!0;break;case"official-only":break}return status.official?.version&&status.latestVersion&&comparePluginVersions(status.official.version,status.latestVersion)<0&&(plan.updateOfficial=!0),plan}function hasClaudeMigrationActions(plan){return plan.installOfficial||plan.updateOfficial||plan.removeLegacy||plan.removeLegacyMarketplace}function buildClaudePromptCopy(status,plan){if(plan.installOfficial&&status.state==="none")return{message:"Vercel Plugin for Claude Code is not installed.",confirm:"Would you like to install it now?"};if(plan.installOfficial&&status.state==="legacy-only")return{message:"Update available for Vercel Plugin for Claude Code (legacy -> official).",confirm:"Would you like to update now?"};if(status.state==="both"&&plan.removeLegacy)return{message:"Vercel Plugin for Claude Code has a legacy install to clean up.",confirm:"Would you like to update now?"};if(plan.updateOfficial){let fromVersion=status.official?.version,toVersion=status.latestVersion;return{message:`Update available for Vercel Plugin for Claude Code${fromVersion&&toVersion?` (v${fromVersion} -> v${toVersion})`:""}.`,confirm:"Would you like to update now?"}}return{message:"The Vercel plugin needs attention in Claude Code before your agent harness is fully up to date.",confirm:"Apply the Vercel plugin changes for Claude Code?"}}async function runClaudeCommand(spinnerMessage,successMessage,failureMessage,args,options){output_manager_default.spinner(spinnerMessage);let result=await runCommand("claude",args);return output_manager_default.stopSpinner(),result.exitCode===0?(options?.quietSuccess||output_manager_default.success(successMessage),!0):(output_manager_default.warn(failureMessage),output_manager_default.debug(`Claude command failed: claude ${args.join(" ")}
|
|
30
|
+
${result.stderr||result.stdout}`),!1)}async function ensureClaudeOfficialMarketplace(){let result=await runCommand("claude",["plugins","marketplace","list","--json"]),marketplaces;try{marketplaces=JSON.parse(result.stdout)}catch{}if(result.exitCode!==0||!Array.isArray(marketplaces))return output_manager_default.debug(`Failed to list Claude plugin marketplaces: ${result.stderr||result.stdout}`),!0;if(marketplaces.some(marketplace=>marketplace?.name===CLAUDE_OFFICIAL_MARKETPLACE))return!0;let added=await runClaudeCommand("Adding the official Claude plugin marketplace...","Added the official Claude plugin marketplace","Failed to add the official Claude plugin marketplace.",["plugins","marketplace","add",CLAUDE_OFFICIAL_MARKETPLACE_SOURCE],{quietSuccess:!0});return added||output_manager_default.log(`Setup command: claude plugins marketplace add ${CLAUDE_OFFICIAL_MARKETPLACE_SOURCE}`),added}async function removeStaleLegacyClaudePlugin(removeMarketplace){output_manager_default.spinner("Removing the stale legacy Vercel Claude plugin...");let removedRegistryEntry=await removeClaudePluginFromRegistry(CLAUDE_LEGACY_PLUGIN_ID);if(output_manager_default.stopSpinner(),!removedRegistryEntry)return output_manager_default.warn("Could not remove the stale legacy Vercel Claude plugin registry entry."),{removedPlugin:!1,complete:!1};if(output_manager_default.success("Removed the stale legacy Vercel Claude plugin"),removeMarketplace){let removedMarketplace=await runClaudeCommand("Removing the legacy Vercel marketplace...","Removed the legacy Vercel marketplace","Removed the stale legacy Vercel plugin, but could not remove the legacy marketplace.",["plugins","marketplace","remove","vercel"],{quietSuccess:!0});return removedMarketplace||output_manager_default.log("Cleanup command: claude plugins marketplace remove vercel"),{removedPlugin:!0,complete:removedMarketplace}}return{removedPlugin:!0,complete:!0}}async function runClaudeMigration(plan){let removedStaleLegacy=!1,complete=!0;if(plan.removeLegacy&&(await getClaudePluginStatus()).legacy?.stale){let cleanup=await removeStaleLegacyClaudePlugin(plan.removeLegacyMarketplace);removedStaleLegacy=cleanup.removedPlugin,complete=cleanup.complete}if(plan.installOfficial){if(!await ensureClaudeOfficialMarketplace()||!await runClaudeCommand("Installing the official Vercel Claude plugin...","Updated the Vercel plugin","Failed to install the official Vercel Claude plugin.",["plugins","install",CLAUDE_OFFICIAL_PLUGIN_ID]))return!1}else if(plan.updateOfficial&&!await runClaudeCommand("Updating the official Vercel Claude plugin...","Updated the Vercel plugin","Failed to update the official Vercel Claude plugin.",["plugins","update",CLAUDE_OFFICIAL_PLUGIN_ID]))return!1;let statusAfterInstall=await getClaudePluginStatus();return statusAfterInstall.official?plan.removeLegacy&&statusAfterInstall.legacy&&!await runClaudeCommand("Removing the legacy Vercel Claude plugin...","Removed the legacy Vercel Claude plugin","Installed the official Vercel Claude plugin, but could not remove the legacy install.",["plugins","uninstall",CLAUDE_LEGACY_PLUGIN_ID],{quietSuccess:!0})?(output_manager_default.log(`Cleanup command: claude plugins uninstall ${CLAUDE_LEGACY_PLUGIN_ID}`),!1):plan.removeLegacyMarketplace&&!removedStaleLegacy&&!(await getClaudePluginStatus()).legacy&&!await runClaudeCommand("Removing the legacy Vercel marketplace...","Removed the legacy Vercel marketplace","Removed the legacy Vercel plugin, but could not remove the legacy marketplace.",["plugins","marketplace","remove","vercel"],{quietSuccess:!0})?(output_manager_default.log("Cleanup command: claude plugins marketplace remove vercel"),!1):complete:(output_manager_default.warn("Skipping Claude cleanup because the official Vercel plugin is not installed."),!1)}async function getClaudePluginStatus(){let[installedPlugins,latestVersion]=await Promise.all([getClaudeInstalledPlugins(),fetchLatestVercelPluginVersion()]);return buildClaudePluginStatus(installedPlugins,latestVersion)}function describeClaudePlan(plan){let actions=[];return plan.installOfficial&&actions.push("install the official plugin"),plan.updateOfficial&&actions.push("update the official plugin"),plan.removeLegacy&&actions.push("remove the legacy plugin"),plan.removeLegacyMarketplace&&actions.push("remove the legacy marketplace"),actions.join(", ")}async function setupVercelPlugin(client,opts){if(!await claudeCode.detect(opts.home))return{status:"not_detected",message:"Claude Code was not detected on this machine."};let status=await getClaudePluginStatus();if(status.official?.stale)return{status:"failed",message:"The installed Vercel plugin files are missing. Run `claude plugins uninstall vercel@claude-plugins-official`, then run `vercel setup plugin --agent claude-code` to reinstall it."};let plan=buildClaudePluginMigrationPlan(status);if(!hasClaudeMigrationActions(plan))return{status:"up_to_date",message:`Vercel plugin for Claude Code is installed${status.official?.version?` (v${status.official.version})`:""}.`};let copy=buildClaudePromptCopy(status,plan);if(opts.dryRun)return{status:"dry_run",message:`${copy.message} Setup would ${describeClaudePlan(plan)}.`,action:plan.installOfficial?"install":"update"};let prefs=await readPrefs(client);if(!opts.yes){if(!opts.canPrompt)return{status:"confirmation_required",message:`${copy.message} Re-run with --yes to apply it.`};output_manager_default.print(` ${copy.message}
|
|
31
|
+
`);let accepted=await client.input.confirm(copy.confirm,!0);if(await markPromptedToday(client,prefs),!accepted)return prefs.pluginDeclined=!0,prefs.pluginAutoUpdate=!1,await writePrefs(client,prefs),{status:"declined",message:"Skipped the Vercel plugin for Claude Code."}}prefs.pluginDeclined=!1,prefs.pluginAutoUpdate=!0,await writePrefs(client,prefs);let migrated=await runClaudeMigration(plan),after=await getClaudePluginStatus();if(!after.official)return{status:"failed",message:"Failed to install the Vercel plugin for Claude Code. Run `claude plugins install vercel@claude-plugins-official` to install it manually."};let remaining=buildClaudePluginMigrationPlan({...after,latestVersion:plan.updateOfficial?status.latestVersion:void 0});if(!migrated||after.official.stale||hasClaudeMigrationActions(remaining))return{status:"failed",message:"Failed to complete Vercel plugin setup for Claude Code. Re-run `vercel setup plugin --agent claude-code --yes` to retry."};let version=after.official.version?` v${after.official.version}`:"";return{status:plan.installOfficial?"installed":"updated",message:`${plan.installOfficial?"Installed":"Updated"} the Vercel plugin for Claude Code${version}.`}}var import_execa=__toESM(require_execa(),1);import{join as join5}from"node:path";import{createHash as createHash2,randomUUID as randomUUID2}from"node:crypto";var regex_default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function validate(uuid){return typeof uuid=="string"&®ex_default.test(uuid)}var validate_default=validate;function parse3(uuid){if(!validate_default(uuid))throw TypeError("Invalid UUID");let v;return Uint8Array.of((v=parseInt(uuid.slice(0,8),16))>>>24,v>>>16&255,v>>>8&255,v&255,(v=parseInt(uuid.slice(9,13),16))>>>8,v&255,(v=parseInt(uuid.slice(14,18),16))>>>8,v&255,(v=parseInt(uuid.slice(19,23),16))>>>8,v&255,(v=parseInt(uuid.slice(24,36),16))/1099511627776&255,v/4294967296&255,v>>>24&255,v>>>16&255,v>>>8&255,v&255)}var parse_default=parse3;var byteToHex=[];for(let i=0;i<256;++i)byteToHex.push((i+256).toString(16).slice(1));function unsafeStringify(arr,offset=0){return(byteToHex[arr[offset+0]]+byteToHex[arr[offset+1]]+byteToHex[arr[offset+2]]+byteToHex[arr[offset+3]]+"-"+byteToHex[arr[offset+4]]+byteToHex[arr[offset+5]]+"-"+byteToHex[arr[offset+6]]+byteToHex[arr[offset+7]]+"-"+byteToHex[arr[offset+8]]+byteToHex[arr[offset+9]]+"-"+byteToHex[arr[offset+10]]+byteToHex[arr[offset+11]]+byteToHex[arr[offset+12]]+byteToHex[arr[offset+13]]+byteToHex[arr[offset+14]]+byteToHex[arr[offset+15]]).toLowerCase()}function stringToBytes(str){str=unescape(encodeURIComponent(str));let bytes=new Uint8Array(str.length);for(let i=0;i<str.length;++i)bytes[i]=str.charCodeAt(i);return bytes}var DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function v35(version,hash,value,namespace,buf,offset){let valueBytes=typeof value=="string"?stringToBytes(value):value,namespaceBytes=typeof namespace=="string"?parse_default(namespace):namespace;if(typeof namespace=="string"&&(namespace=parse_default(namespace)),namespace?.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let bytes=new Uint8Array(16+valueBytes.length);if(bytes.set(namespaceBytes),bytes.set(valueBytes,namespaceBytes.length),bytes=hash(bytes),bytes[6]=bytes[6]&15|version,bytes[8]=bytes[8]&63|128,buf){if(offset??=0,offset<0||offset+16>buf.length)throw new RangeError(`UUID byte range ${offset}:${offset+15} is out of buffer bounds`);for(let i=0;i<16;++i)buf[offset+i]=bytes[i];return buf}return unsafeStringify(bytes)}import{createHash}from"node:crypto";function sha1(bytes){return Array.isArray(bytes)?bytes=Buffer.from(bytes):typeof bytes=="string"&&(bytes=Buffer.from(bytes,"utf8")),createHash("sha1").update(bytes).digest()}var sha1_default=sha1;function v5(value,namespace,buf,offset){return v35(80,sha1_default,value,namespace,buf,offset)}v5.DNS=DNS;v5.URL=URL;var v5_default=v5;import{createReadStream,createWriteStream}from"node:fs";import*as fs2 from"node:fs/promises";import{basename,dirname as dirname3,join as join4}from"node:path";import{pipeline}from"node:stream/promises";var ROLLOUT_PATTERN=/^rollout-.*\.jsonl(?:\.zst)?$/,MAX_METADATA_BYTES=1024*1024;function hasCode(error,code){return error.code===code}async function readMeta(path,gateway=!1){let handle=await fs2.open(path,"r"),buffer=new Uint8Array(MAX_METADATA_BYTES+1),length=0,newline=-1;try{for(;length<buffer.length&&newline<0;){let start=length,read=await handle.read(buffer,start,buffer.length-start,start);if(read.bytesRead===0)break;length+=read.bytesRead,newline=buffer.indexOf(10,start)}}finally{await handle.close()}if(newline<0&&length>MAX_METADATA_BYTES)throw new Error(`${basename(path)} metadata exceeds 1 MiB`);let lineEnd=newline<0?length:newline,carriageReturn=buffer[lineEnd-1]===13,record;try{record=JSON.parse(new TextDecoder().decode(buffer.subarray(0,carriageReturn?lineEnd-1:lineEnd)))}catch{return null}let payload=record.payload,id=typeof payload?.id=="string"?payload.id:typeof payload?.session_id=="string"?payload.session_id:"";return record.type!=="session_meta"||!payload||!validate_default(id)||typeof payload.session_id=="string"&&payload.session_id!==id||payload.originator!=="Codex Desktop"&&!(payload.originator==null&&payload.source==="vscode")||(gateway?payload.model_provider!=="vercel":payload.model_provider==="vercel")?null:{record,payload,id,delimiter:newline<0?"":carriageReturn?`\r
|
|
32
|
+
`:`
|
|
33
|
+
`,restOffset:newline<0?length:newline+1}}function codeSpan2(value){return`\`${value.replace(/[`\r\n]/g,"")}\``}async function findRollouts(root){let files=[];async function visit(directory){let entries;try{entries=await fs2.readdir(directory,{withFileTypes:!0})}catch(error){if(hasCode(error,"ENOENT"))return;throw error}for(let entry of entries){let path=join4(directory,entry.name);entry.isDirectory()?await visit(path):entry.isFile()&&ROLLOUT_PATTERN.test(entry.name)&&files.push(path)}}return await visit(root),files}async function planCopy(path,root){let metadata=await readMeta(path),filename=basename(path);if(!metadata||!filename.toLowerCase().includes(metadata.id.toLowerCase()))return null;let destinationId=v5_default(`vercel-ai-gateway/codex/${metadata.id.toLowerCase()}/vercel`,v5_default.URL),destination=join4(dirname3(path),filename.replace(new RegExp(metadata.id,"i"),destinationId)),item={source:path,destination,sourceId:metadata.id,destinationId,bytes:(await fs2.stat(path)).size,root};try{return await fs2.stat(destination),await validateDestination(item),null}catch(error){if(!hasCode(error,"ENOENT"))throw error}return item}async function bodyHash(path,start){let hash=createHash2("sha256");return await pipeline(createReadStream(path,{start}),hash),hash.digest("hex")}async function validateDestination(item){let[source,destination]=await Promise.all([readMeta(item.source),readMeta(item.destination,!0)]),bodies=await Promise.all([bodyHash(item.source,source?.restOffset??0),bodyHash(item.destination,destination?.restOffset??0)]);if(!(source&&destination?.id===item.destinationId&&bodies[0]===bodies[1]))throw new Error(`Existing destination ${basename(item.destination)} is invalid`)}async function copySession(item){let metadata=await readMeta(item.source);if(!metadata)throw new Error("Codex session metadata is no longer valid");if(metadata.id!==item.sourceId)throw new Error("Codex session metadata changed after planning");let updated={...metadata.record,payload:{...metadata.payload,id:item.destinationId,session_id:item.destinationId,model_provider:"vercel"}},temporary=`${item.destination}.tmp-${process.pid}-${randomUUID2()}`;try{return await fs2.writeFile(temporary,`${JSON.stringify(updated)}${metadata.delimiter}`,{flag:"wx",mode:384}),await pipeline(createReadStream(item.source,{start:metadata.restOffset}),createWriteStream(temporary,{flags:"a",mode:384})),await fs2.chmod(temporary,384),await publishNoClobber(temporary,item.destination)?!0:(await validateDestination(item),!1)}finally{await fs2.unlink(temporary).catch(error=>{if(!hasCode(error,"ENOENT"))throw error})}}async function planCodexSessionMigration(home){let codexHome=process.env.CODEX_HOME||join4(home,".codex"),roots=["sessions","archived_sessions"].map(root=>join4(codexHome,root)),files=[];for(let root of roots)files.push(...(await findRollouts(root)).map(path=>({path,root})));if(files.some(file=>file.path.endsWith(".jsonl.zst")))throw new Error("Found compressed Codex sessions; decompress them first, or pass --no-session-migration to leave them unchanged");let copies=[];for(let file of files){let copy=await planCopy(file.path,file.root);copy&&copies.push(copy)}if(copies.length===0)return null;let sourceRoots=[...new Set(copies.map(copy=>copy.root))];return{label:"Codex Desktop sessions",itemCount:copies.length,totalBytes:copies.reduce((total,copy)=>total+copy.bytes,0),sourceRoots,destinationRoots:sourceRoots,prompt:[`Before changing the provider, copy the ${copies.length} top-level Codex Desktop rollout${copies.length===1?"":"s"} with a non-\`vercel\` provider under ${sourceRoots.map(codeSpan2).join(", ")}. Do not copy subagent rollouts whose \`session_id\` differs from \`id\`.`,"For each copy, derive a deterministic UUID v5 using the URL namespace `6ba7b811-9dad-11d1-80b4-00c04fd430c8` and name `vercel-ai-gateway/codex/<source-id>/vercel`. Replace the filename UUID and `session_meta.payload.id`/`session_id`, set `model_provider` to `vercel`, and preserve every later JSONL byte.","Use atomic, no-clobber writes with mode 0600; skip an existing deterministic destination only after validating its metadata and body. Never move, edit, delete, or overwrite an original session file."],async apply(){let copied=0,skipped=0,errors=[];for(let item of copies)try{await copySession(item)?copied++:skipped++}catch(error){errors.push(`${basename(item.source)}: ${error instanceof Error?error.message:String(error)}`)}return{copied,skipped,errors}}}}function codexDir(home){let dir=process.env.CODEX_HOME;return dir&&dir.trim()?dir:join5(home,".codex")}var codex={id:"codex",displayName:"Codex",sessionMigration:{plan:({home})=>planCodexSessionMigration(home)},async detect(home){return pathExists(codexDir(home))},configPath(ctx){return ctx.overrides?.codex??join5(codexDir(ctx.home),"config.toml")},buildPlan(ctx){return{fileChanges:[{path:this.configPath(ctx),label:"Codex config",format:"toml",transform:current=>mergeToml(current,{model_provider:"vercel",model_providers:{vercel:{name:"Vercel AI Gateway",base_url:resolveGatewayBaseUrl(ctx.baseUrlOverride,GATEWAY_CODEX_BASE_URL),env_key:GATEWAY_API_KEY_ENV,wire_api:"responses"}}})}],envExports:[{name:GATEWAY_API_KEY_ENV,value:ctx.apiKey}],notes:["Codex now defaults to the Vercel AI Gateway; pick a model with --model or in config.",`Open a new terminal so ${GATEWAY_API_KEY_ENV} is loaded, or run: export ${GATEWAY_API_KEY_ENV}=<key>`]}}};var MARKETPLACE="openai-curated-remote",PLUGIN_ID=`vercel@${MARKETPLACE}`,INSTALL_COMMAND=`codex plugin add ${PLUGIN_ID}`,SIGN_IN_MESSAGE="Can't install the Vercel plugin for Codex without a ChatGPT sign-in. Run `codex login`, then `vercel setup plugin --agent codex`.",pluginListSchema=external_exports.object({installed:external_exports.array(external_exports.object({pluginId:external_exports.string(),enabled:external_exports.boolean(),version:external_exports.string().nullable().optional()}))});async function runCodex(args){let{stdout}=await(0,import_execa.default)("codex",args,{encoding:"utf8",stdin:"ignore",timeout:6e4,maxBuffer:1048576});return stdout}function needsChatGptSignIn(err){let{message,stderr}=err;return[message,stderr].some(text=>typeof text=="string"&&/chatgpt authentication required/i.test(text))}async function installedPlugin(){let stdout=await runCodex(["plugin","list","--marketplace",MARKETPLACE,"--json"]),{installed}=pluginListSchema.parse(JSON.parse(stdout));return installed.find(plugin=>plugin.pluginId===PLUGIN_ID)}async function setupCodexPlugin(client,opts){if(!await codex.detect(opts.home))return{status:"not_detected",message:"Codex was not detected on this machine."};let before;try{before=await installedPlugin()}catch(err){return{status:"failed",message:needsChatGptSignIn(err)?SIGN_IN_MESSAGE:"Couldn't inspect Codex plugins. Install or update the Codex CLI, sign in with `codex login`, then re-run `vercel setup plugin --agent codex`."}}if(before?.enabled)return{status:"up_to_date",message:`Vercel plugin for Codex is installed${before.version?` (v${before.version})`:""}.`};let action=before?"enable":"install";if(opts.dryRun)return{status:"dry_run",action,message:`Setup would ${action} the Vercel plugin for Codex from the OpenAI marketplace.`};if(!opts.yes){if(!opts.canPrompt)return{status:"confirmation_required",message:`Re-run with --yes to ${action} the Vercel plugin for Codex.`};if(printAlignedLabel("Plugin","Vercel for Codex (OpenAI marketplace)"),!await client.input.confirm(before?"Enable this plugin?":"Install this plugin?",!0))return{status:"declined",message:"Skipped the Vercel plugin for Codex."}}output_manager_default.spinner(`${before?"Enabling":"Installing"} the Vercel plugin for Codex\u2026`);try{let stdout=await runCodex(["plugin","add",PLUGIN_ID,"--json"]),install=external_exports.object({appsNeedingAuth:external_exports.array(external_exports.unknown()).optional()}).parse(JSON.parse(stdout)),after=await installedPlugin();if(!after?.enabled)return{status:"failed",message:"The Vercel plugin is not enabled in Codex. Open Codex's /plugins browser, enable Vercel, then re-run `vercel setup plugin --agent codex`."};let version=after.version?` v${after.version}`:"",connection=install.appsNeedingAuth?.length?" Connect Vercel in Codex's /plugins browser to use its connected tools.":" Start a new Codex session to load the plugin.";return{status:before?"enabled":"installed",message:`${before?"Enabled":"Installed"} the Vercel plugin for Codex${version}.${connection}`}}catch(err){return{status:"failed",message:needsChatGptSignIn(err)?SIGN_IN_MESSAGE:`Failed to set up the Vercel plugin for Codex. Run \`${INSTALL_COMMAND}\` to finish setup in Codex.`}}finally{output_manager_default.stopSpinner()}}export{pathExists,isFile,isSymlink,readFileOrNull,parseJsonObjectOrNull,mergeJson,mergeJsonc,mergeToml,MANAGED_BLOCK_START,MANAGED_BLOCK_END,upsertManagedBlock,ensureMode,backupFile,writeConfigFile,GATEWAY_ANTHROPIC_BASE_URL,GATEWAY_CODING_AGENT_BASE_URL,GATEWAY_CURSOR_BASE_URL,GATEWAY_API_KEY_ENV,GATEWAY_DEFAULT_MODEL,KEY_PLACEHOLDER,resolveGatewayBaseUrl,maskSecret,claudeCode,codex,getSavedPluginAnswer,savePluginAnswer,hasClaudeVercelPlugin,setupVercelPlugin,setupCodexPlugin};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{require_raw_body}from"./chunk-XOETL6DB.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_raw_body=__toESM(require_raw_body(),1);async function readStdinText(stdin,limit){return stdin.isTTY?"":(await(0,import_raw_body.default)(stdin,{limit,encoding:"utf8"})).replace(/\r?\n$/,"")}async function readStandardInput(stdin){return new Promise(resolve=>{setTimeout(()=>resolve(""),500),stdin.isTTY?resolve(""):(stdin.setEncoding("utf8"),stdin.once("data",resolve))})}export{readStdinText,readStandardInput};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{__commonJS}from"./chunk-BZENIQ7N.js";var require_dist=__commonJS({"../../internals/constants/dist/index.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.TITLE=exports.NAME=exports.LOGO=exports.PROJECT_ENV_TARGET=void 0;exports.PROJECT_ENV_TARGET=["production","preview","development"];exports.LOGO="\u25B2";exports.NAME="vercel";exports.TITLE="Vercel"}});export{require_dist};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{__commonJS,__require}from"./chunk-BZENIQ7N.js";var require_is_docker=__commonJS({"../../node_modules/.pnpm/is-docker@2.2.1/node_modules/is-docker/index.js"(exports,module){"use strict";var fs=__require("fs"),isDocker;function hasDockerEnv(){try{return fs.statSync("/.dockerenv"),!0}catch{return!1}}function hasDockerCGroup(){try{return fs.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}module.exports=()=>(isDocker===void 0&&(isDocker=hasDockerEnv()||hasDockerCGroup()),isDocker)}});var require_is_wsl=__commonJS({"../../node_modules/.pnpm/is-wsl@2.2.0/node_modules/is-wsl/index.js"(exports,module){"use strict";var os=__require("os"),fs=__require("fs"),isDocker=require_is_docker(),isWsl=()=>{if(process.platform!=="linux")return!1;if(os.release().toLowerCase().includes("microsoft"))return!isDocker();try{return fs.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!isDocker():!1}catch{return!1}};process.env.__IS_WSL_TEST__?module.exports=isWsl:module.exports=isWsl()}});var require_define_lazy_prop=__commonJS({"../../node_modules/.pnpm/define-lazy-prop@2.0.0/node_modules/define-lazy-prop/index.js"(exports,module){"use strict";module.exports=(object,propertyName,fn)=>{let define=value=>Object.defineProperty(object,propertyName,{value,enumerable:!0,writable:!0});return Object.defineProperty(object,propertyName,{configurable:!0,enumerable:!0,get(){let result=fn();return define(result),result},set(value){define(value)}}),object}}});var require_open=__commonJS({"../../node_modules/.pnpm/open@8.4.0/node_modules/open/index.js"(exports,module){var path=__require("path"),childProcess=__require("child_process"),{promises:fs,constants:fsConstants}=__require("fs"),isWsl=require_is_wsl(),isDocker=require_is_docker(),defineLazyProperty=require_define_lazy_prop(),localXdgOpenPath=path.join(__dirname,"xdg-open"),{platform,arch}=process,getWslDrivesMountPoint=(()=>{let defaultMountPoint="/mnt/",mountPoint;return async function(){if(mountPoint)return mountPoint;let configFilePath="/etc/wsl.conf",isConfigFileExists=!1;try{await fs.access(configFilePath,fsConstants.F_OK),isConfigFileExists=!0}catch{}if(!isConfigFileExists)return defaultMountPoint;let configContent=await fs.readFile(configFilePath,{encoding:"utf8"}),configMountPoint=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);return configMountPoint?(mountPoint=configMountPoint.groups.mountPoint.trim(),mountPoint=mountPoint.endsWith("/")?mountPoint:`${mountPoint}/`,mountPoint):defaultMountPoint}})(),pTryEach=async(array,mapper)=>{let latestError;for(let item of array)try{return await mapper(item)}catch(error){latestError=error}throw latestError},baseOpen=async options=>{if(options={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...options},Array.isArray(options.app))return pTryEach(options.app,singleApp=>baseOpen({...options,app:singleApp}));let{name:app,arguments:appArguments=[]}=options.app||{};if(appArguments=[...appArguments],Array.isArray(app))return pTryEach(app,appName=>baseOpen({...options,app:{name:appName,arguments:appArguments}}));let command,cliArguments=[],childProcessOptions={};if(platform==="darwin")command="open",options.wait&&cliArguments.push("--wait-apps"),options.background&&cliArguments.push("--background"),options.newInstance&&cliArguments.push("--new"),app&&cliArguments.push("-a",app);else if(platform==="win32"||isWsl&&!isDocker()){let mountPoint=await getWslDrivesMountPoint();command=isWsl?`${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`,cliArguments.push("-NoProfile","-NonInteractive","\u2013ExecutionPolicy","Bypass","-EncodedCommand"),isWsl||(childProcessOptions.windowsVerbatimArguments=!0);let encodedArguments=["Start"];options.wait&&encodedArguments.push("-Wait"),app?(encodedArguments.push(`"\`"${app}\`""`,"-ArgumentList"),options.target&&appArguments.unshift(options.target)):options.target&&encodedArguments.push(`"${options.target}"`),appArguments.length>0&&(appArguments=appArguments.map(arg=>`"\`"${arg}\`""`),encodedArguments.push(appArguments.join(","))),options.target=Buffer.from(encodedArguments.join(" "),"utf16le").toString("base64")}else{if(app)command=app;else{let isBundled=!__dirname||__dirname==="/",exeLocalXdgOpen=!1;try{await fs.access(localXdgOpenPath,fsConstants.X_OK),exeLocalXdgOpen=!0}catch{}command=process.versions.electron||platform==="android"||isBundled||!exeLocalXdgOpen?"xdg-open":localXdgOpenPath}appArguments.length>0&&cliArguments.push(...appArguments),options.wait||(childProcessOptions.stdio="ignore",childProcessOptions.detached=!0)}options.target&&cliArguments.push(options.target),platform==="darwin"&&appArguments.length>0&&cliArguments.push("--args",...appArguments);let subprocess=childProcess.spawn(command,cliArguments,childProcessOptions);return options.wait?new Promise((resolve,reject)=>{subprocess.once("error",reject),subprocess.once("close",exitCode=>{if(options.allowNonzeroExitCode&&exitCode>0){reject(new Error(`Exited with code ${exitCode}`));return}resolve(subprocess)})}):(subprocess.unref(),subprocess)},open=(target,options)=>{if(typeof target!="string")throw new TypeError("Expected a `target`");return baseOpen({...options,target})},openApp=(name,options)=>{if(typeof name!="string")throw new TypeError("Expected a `name`");let{arguments:appArguments=[]}=options||{};if(appArguments!=null&&!Array.isArray(appArguments))throw new TypeError("Expected `appArguments` as Array type");return baseOpen({...options,app:{name,arguments:appArguments}})};function detectArchBinary(binary){if(typeof binary=="string"||Array.isArray(binary))return binary;let{[arch]:archBinary}=binary;if(!archBinary)throw new Error(`${arch} is not supported`);return archBinary}function detectPlatformBinary({[platform]:platformBinary},{wsl}){if(wsl&&isWsl)return detectArchBinary(wsl);if(!platformBinary)throw new Error(`${platform} is not supported`);return detectArchBinary(platformBinary)}var apps={};defineLazyProperty(apps,"chrome",()=>detectPlatformBinary({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));defineLazyProperty(apps,"firefox",()=>detectPlatformBinary({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));defineLazyProperty(apps,"edge",()=>detectPlatformBinary({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));open.apps=apps;open.openApp=openApp;module.exports=open}});export{require_open};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{toGranularityMsFromDuration}from"./chunk-XVDRGWXM.js";var VALUE_ALIAS="value",COUNT_ALIAS="__seriesCount";function alignTimeRangeToGranularity(startTime,endTime,granularity){let bucketMs=toGranularityMsFromDuration(granularity);return{startTime:new Date(Math.floor(startTime.getTime()/bucketMs)*bucketMs),endTime:new Date(Math.ceil(endTime.getTime()/bucketMs)*bucketMs)}}function createCanonicalMetricsRequest(options){let metrics={[VALUE_ALIAS]:options.selection},rankMetric=VALUE_ALIAS;return options.groupBy.length>0&&options.orderBy==="count"&&options.selection.aggregation!=="count"&&(metrics[COUNT_ALIAS]={metric:options.metric,aggregation:"count"},rankMetric=COUNT_ALIAS),{scope:{ownerId:options.scope.ownerId,...options.scope.type==="project"?{projectIds:options.scope.projectIds}:{}},timeRange:{start:options.startTime.toISOString(),end:options.endTime.toISOString()},bucketSeconds:toGranularityMsFromDuration(options.granularity)/1e3,...options.groupBy.length>0?{groupBy:options.groupBy}:{},...options.filter?{filter:options.filter}:{},metrics,outputs:[VALUE_ALIAS],...options.groupBy.length>0?{seriesSelection:{limit:options.limit,mode:"exact",rankBy:[{metric:rankMetric,direction:options.orderDirection??"desc"}]}}:{}}}function canonicalResponseToMetricsResponse(response,rollupColumn,orderBy,orderDirection){let toRow=point=>({...point.dimensions,[rollupColumn]:point.values[VALUE_ALIAS]??null});return{...response.series?{data:response.series.map(point=>({timestamp:point.timestamp,...toRow(point)}))}:{},summary:response.summary.map(toRow),statistics:{rowsRead:response.meta.statistics.rowsRead,bytesRead:response.meta.statistics.bytesRead,dbTimeSeconds:response.meta.statistics.databaseElapsedMs/1e3,engineTimeSeconds:response.meta.statistics.elapsedMs/1e3,queryTable:[...new Set(response.meta.sources.map(source=>source.id))].sort().join(",")},...orderBy?{orderBy}:{},...orderDirection?{orderDirection}:{}}}var FILTER_DEPRECATION_WARNING="OData support in --query is deprecated and will be removed soon. KQL will be the only supported filter syntax.";function usesODataSyntax(filters){return filters?.some(filter=>{let unquoted=filter.replace(/"(?:\\.|[^"\\])*"|'(?:''|[^'])*'/g,"");return/\s(?:eq|ne|gt|ge|lt|le|in)\s/i.test(unquoted)||/\b(?:contains|startswith|endswith)\s*\(/i.test(unquoted)})??!1}export{alignTimeRangeToGranularity,createCanonicalMetricsRequest,canonicalResponseToMetricsResponse,FILTER_DEPRECATION_WARNING,usesODataSyntax};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{outputError}from"./chunk-RW3X523R.js";import{canPrompt}from"./chunk-IQ7FPAI4.js";import{readFileSync}from"node:fs";function readAllStandardInput(stdin){return stdin.isTTY?Promise.resolve(""):new Promise(resolve=>{let chunks=[],timer=setTimeout(()=>{chunks.length===0&&(cleanup(),resolve(""))},500),onData=chunk=>{chunks.push(String(chunk))},onEnd=()=>{cleanup(),resolve(chunks.join(""))};function cleanup(){clearTimeout(timer),stdin.off("data",onData),stdin.off("end",onEnd)}stdin.setEncoding("utf8"),stdin.on("data",onData),stdin.on("end",onEnd)})}async function resolveMessageContent(client,flags,jsonOutput){if(flags.message!==void 0&&flags.file!==void 0)return outputError(client,jsonOutput,"CONFLICTING_CONTENT","Use either --message or --file, not both.");if(flags.message!==void 0)return flags.message;if(flags.file!==void 0){if(flags.file==="-"){let piped2=await readAllStandardInput(client.stdin);return piped2||outputError(client,jsonOutput,"MISSING_CONTENT","No content received on stdin for `--file -`.")}try{return readFileSync(flags.file,"utf8")}catch(err){return outputError(client,jsonOutput,"FILE_READ_ERROR",`Could not read ${flags.file}: ${err instanceof Error?err.message:String(err)}`)}}let piped=await readAllStandardInput(client.stdin);if(piped)return piped;if(!flags.hasAttachments){if(canPrompt(client)&&!jsonOutput){let text=await client.input.text({message:"Comment message:"});if(text)return text}return outputError(client,jsonOutput,"MISSING_CONTENT",'No content provided. Pass --message <text>, --file <path>, or pipe stdin (e.g. `echo "LGTM" | vercel comments reply <thread>`).')}}export{resolveMessageContent};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{require_ms}from"./chunk-MXTC4ZAQ.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_ms=__toESM(require_ms(),1),import_chalk=__toESM(require_source(),1);function elapsed(time,ago=!1){return import_chalk.default.gray(`[${time<1e3?`${time}ms`:(0,import_ms.default)(time)}${ago?" ago":""}]`)}export{elapsed};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{require_dist2 as require_dist}from"./chunk-7L2K4OKM.js";import{require_frameworks}from"./chunk-6Y2ZL5XJ.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_frameworks=__toESM(require_frameworks(),1),import_fs_detectors=__toESM(require_dist(),1);import{join}from"path";async function detectProjects(cwd){let fs=new import_fs_detectors.LocalFileSystemDetector(cwd),workspaces=await(0,import_fs_detectors.getWorkspaces)({fs}),detectedProjects=new Map,packagePaths=(await Promise.all(workspaces.map(workspace=>(0,import_fs_detectors.getWorkspacePackagePaths)({fs,workspace})))).flat();return packagePaths.length===0&&packagePaths.push("/"),await Promise.all(packagePaths.map(async p=>{let frameworks=await(0,import_fs_detectors.detectFrameworks)({fs:fs.chdir(join(".",p)),frameworkList:import_frameworks.frameworkList});frameworks.length!==0&&detectedProjects.set(p.slice(1),frameworks)})),detectedProjects}export{detectProjects};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
async function createProject(client,settings){let{vercelAuth,v0,...rest}=settings;return await client.fetch("/v1/projects",{method:"POST",body:{...rest,...vercelAuth==="none"?{ssoProtection:null}:void 0,...v0?{v0:!0}:void 0}})}export{createProject};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{buildCommandWithGlobalFlags}from"./chunk-WDXW6A4H.js";import{printAlignedLabel}from"./chunk-ADLBLGT3.js";import{quoteArg}from"./chunk-F53OKXYI.js";import{output_manager_default}from"./chunk-XP3FT56R.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);var CRITICAL_DELIVERY_DESCRIPTION="Critical only (escalated by Vercel Agent)";function formatMinimumSeverity(notification){let level=notification.minimumSeverityLevel;return level==="critical"?CRITICAL_DELIVERY_DESCRIPTION:level?`${level[0].toUpperCase()}${level.slice(1)} and above`:notification.type==="webhook"&&!("url"in notification.webhook)?"Details unavailable":"Monitor setting"}function formatProjectScope(scope){return scope.type==="all"?"all projects":`${scope.projectName} (${scope.projectId})`}function formatNotificationExpanded(notification,index){if(notification.type==="slack")return[` ${index+1}. ${import_chalk.default.bold("Slack")} ${import_chalk.default.cyan(`#${notification.channelName}`)}`,` ${import_chalk.default.dim("Project scope:")} ${formatProjectScope(notification.projectScope)}`,` ${import_chalk.default.dim("Channel ID:")} ${notification.channelId}`,` ${import_chalk.default.dim("Slack installation ID:")} ${notification.configId}`,` ${import_chalk.default.dim("Minimum severity:")} ${formatMinimumSeverity(notification)}`].join(`
|
|
8
|
+
`);let{webhook}=notification;return[` ${index+1}. ${import_chalk.default.bold("Webhook")}`,` ${import_chalk.default.dim("Webhook ID:")} ${webhook.id}`,` ${import_chalk.default.dim("URL:")} ${"url"in webhook?webhook.url:"Details unavailable"}`,` ${import_chalk.default.dim("Minimum severity:")} ${formatMinimumSeverity(notification)}`].join(`
|
|
9
|
+
`)}function formatRuleExpanded(ruleId,notifications){let lines=[` ${import_chalk.default.bold(ruleId)}`];return notifications.length===0?lines.push(` ${import_chalk.default.dim("No notification destinations")}`):lines.push(notifications.map((notification,index)=>formatNotificationExpanded(notification,index)).join(`
|
|
10
|
+
|
|
11
|
+
`)),lines.join(`
|
|
12
|
+
`)}function printRuleNotifications(ruleId,notifications){if(notifications.length===0){output_manager_default.log(`No notification destinations are linked to monitor ${ruleId}.`);return}output_manager_default.print(`
|
|
13
|
+
${import_chalk.default.bold("Notification destinations")} for ${import_chalk.default.cyan(ruleId)}
|
|
14
|
+
|
|
15
|
+
${notifications.map(formatNotificationExpanded).join(`
|
|
16
|
+
|
|
17
|
+
`)}
|
|
18
|
+
`)}function printRulesNotifications(result){let ruleEntries=Object.entries(result.notifications).filter(([,notifications])=>notifications.length>0),rendered=ruleEntries.length>0?`
|
|
19
|
+
${import_chalk.default.bold("Monitor notification destinations")}
|
|
20
|
+
|
|
21
|
+
${ruleEntries.map(([ruleId,notifications])=>formatRuleExpanded(ruleId,notifications)).join(`
|
|
22
|
+
|
|
23
|
+
`)}
|
|
24
|
+
`:`
|
|
25
|
+
No linked notification destinations found.
|
|
26
|
+
`;output_manager_default.print(rendered)}function formatTarget(target){return target.type==="webhook"?`webhook ${target.webhookId}`:`Slack channel ${target.channelId}${target.configId?` (installation ${target.configId})`:""}`}function buildRuleNotificationsInspectCommand(argv,ruleId){return buildCommandWithGlobalFlags(argv,`monitors notifications ${quoteArg(ruleId)}`)}function printRuleNotificationMutationReceipt(action,ruleId,target,argv){let inspectCommand=buildRuleNotificationsInspectCommand(argv,ruleId);output_manager_default.print(`
|
|
27
|
+
`),printAlignedLabel(action,formatTarget(target),{gutter:"\u2713"}),printAlignedLabel("Monitor",import_chalk.default.cyan(ruleId)),target.minimumSeverityLevel==="critical"?printAlignedLabel("Delivery",CRITICAL_DELIVERY_DESCRIPTION):target.minimumSeverityLevel===null&&printAlignedLabel("Delivery","Every alert matched by the monitor"),printAlignedLabel("Inspect",import_chalk.default.dim(inspectCommand))}export{printRuleNotifications,printRulesNotifications,buildRuleNotificationsInspectCommand,printRuleNotificationMutationReceipt};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{VERCEL_CONFIG_EXTENSIONS,VERCEL_DIR}from"./chunk-4N6LMERQ.js";import{ConflictingConfigFiles,DeprecatedNowJson}from"./chunk-6VH56CX2.js";import{output_manager_default,require_build_utils}from"./chunk-XP3FT56R.js";import{__commonJS,__require,__toESM}from"./chunk-BZENIQ7N.js";var require_main=__commonJS({"../../node_modules/.pnpm/dotenv@4.0.0/node_modules/dotenv/lib/main.js"(exports,module){"use strict";var fs=__require("fs");function parse(src){var obj={};return src.toString().split(`
|
|
8
|
+
`).forEach(function(line){var keyValueArr=line.match(/^\s*([\w\.\-]+)\s*=\s*(.*)?\s*$/);if(keyValueArr!=null){var key=keyValueArr[1],value=keyValueArr[2]?keyValueArr[2]:"",len=value?value.length:0;len>0&&value.charAt(0)==='"'&&value.charAt(len-1)==='"'&&(value=value.replace(/\\n/gm,`
|
|
9
|
+
`)),value=value.replace(/(^['"]|['"]$)/g,"").trim(),obj[key]=value}}),obj}function config(options){var path=".env",encoding="utf8";options&&(options.path&&(path=options.path),options.encoding&&(encoding=options.encoding));try{var parsedObj=parse(fs.readFileSync(path,{encoding}));return Object.keys(parsedObj).forEach(function(key){process.env[key]=process.env[key]||parsedObj[key]}),{parsed:parsedObj}}catch(e){return{error:e}}}module.exports.config=config;module.exports.load=config;module.exports.parse=parse}});var import_dotenv=__toESM(require_main(),1);import{mkdir,readFile,writeFile,unlink,access}from"fs/promises";import{join,basename}from"path";import{fork}from"child_process";async function loadEsbuild(){let nativeLoader=Reflect.get(globalThis,Symbol.for("vercel.cli.loadEsbuild"));return typeof nativeLoader=="function"?nativeLoader():import("esbuild")}var import_build_utils=__toESM(require_build_utils(),1);function toRouteFormat(item){if("src"in item)return item;let{source,destination,headers,statusCode,permanent,...rest}=item,route={src:source,...rest};return destination&&(route.dest=destination),headers&&(route.headers=Object.fromEntries(headers.map(h=>[h.key,h.value]))),statusCode!==void 0?route.status=statusCode:permanent!==void 0&&(route.status=permanent?308:307),route}function normalizeConfig(config){let normalized={...config},{rewrites,redirects,headers}=normalized,allRoutes=normalized.routes||[],hasRoutes=allRoutes.length>0,hasRewrites=(rewrites?.length??0)>0,hasRedirects=(redirects?.length??0)>0,hasHeaders=(headers?.length??0)>0;function hasRouteFormat(items){return items?.some(item=>"src"in item)??!1}if(hasRoutes&&(hasRewrites||hasRedirects||hasHeaders))return normalized;let shouldConvertRewrites=hasRewrites&&hasRouteFormat(rewrites),shouldConvertRedirects=hasRedirects&&hasRouteFormat(redirects),shouldConvertHeaders=hasHeaders&&hasRouteFormat(headers);if((shouldConvertRewrites||shouldConvertRedirects||shouldConvertHeaders)&&(hasRewrites&&!shouldConvertRewrites||hasRedirects&&!shouldConvertRedirects||hasHeaders&&!shouldConvertHeaders))throw new import_build_utils.NowBuildError({code:"INVALID_VERCEL_CONFIG",message:"Transforms (e.g., requestHeaders) require the `routes` format, which cannot be used alongside `rewrites`, `redirects`, or `headers`. Move everything into the `routes` array instead.",link:"https://vercel.com/docs/projects/project-configuration#routes"});return rewrites&&shouldConvertRewrites&&(allRoutes=[...allRoutes,...rewrites.map(toRouteFormat)],delete normalized.rewrites),redirects&&shouldConvertRedirects&&(allRoutes=[...allRoutes,...redirects.map(toRouteFormat)],delete normalized.redirects),headers&&shouldConvertHeaders&&(allRoutes=[...allRoutes,...headers.map(toRouteFormat)],delete normalized.headers),allRoutes.length>0&&(normalized.routes=allRoutes.map(toRouteFormat)),normalized}async function fileExists(filePath){try{return await access(filePath),!0}catch{return!1}}async function findAllVercelConfigFiles(workPath){let foundFiles=[];for(let ext of VERCEL_CONFIG_EXTENSIONS){let configPath=join(workPath,`vercel.${ext}`);await fileExists(configPath)&&foundFiles.push(configPath)}return foundFiles}async function findSourceVercelConfigFile(workPath){for(let ext of VERCEL_CONFIG_EXTENSIONS){let configPath=join(workPath,`vercel.${ext}`);if(await fileExists(configPath))return basename(configPath)}let tomlPath=join(workPath,"vercel.toml");return await fileExists(tomlPath)?"vercel.toml":null}async function findVercelConfigFile(workPath){let foundFiles=await findAllVercelConfigFiles(workPath);if(foundFiles.length>1)throw new ConflictingConfigFiles(foundFiles,"Multiple vercel config files found. Please use only one configuration file.","https://vercel.com/docs/projects/project-configuration");return foundFiles[0]||null}function parseConfigLoaderError(stderr){if(!stderr.trim())return"";let moduleNotFoundMatch=stderr.match(/Error \[ERR_MODULE_NOT_FOUND\]: Cannot find package '([^']+)'/);if(moduleNotFoundMatch)return`Cannot find package '${moduleNotFoundMatch[1]}'. Make sure it's installed in your project dependencies.`;let syntaxErrorMatch=stderr.match(/SyntaxError: (.+?)(?:\n|$)/);if(syntaxErrorMatch)return`Syntax error: ${syntaxErrorMatch[1]}`;let errorMatch=stderr.match(/^(?:Error|TypeError|ReferenceError): (.+?)(?:\n|$)/m);return errorMatch?errorMatch[1]:stderr.trim()}async function compileVercelConfig(workPath){let vercelJsonPath=join(workPath,"vercel.json"),nowJsonPath=join(workPath,"now.json"),vercelTomlPath=join(workPath,"vercel.toml"),hasVercelJson=await fileExists(vercelJsonPath),hasNowJson=await fileExists(nowJsonPath),hasVercelToml=await fileExists(vercelTomlPath),vercelConfigPath=await findVercelConfigFile(workPath),vercelDir=join(workPath,VERCEL_DIR),compiledConfigPath=join(vercelDir,"vercel.json");if(hasNowJson)throw new DeprecatedNowJson(nowJsonPath);let foundConfigs=[];if(hasVercelJson&&foundConfigs.push(vercelJsonPath),hasVercelToml&&foundConfigs.push(vercelTomlPath),vercelConfigPath&&foundConfigs.push(vercelConfigPath),foundConfigs.length>1)throw new ConflictingConfigFiles(foundConfigs,`Multiple config files found: ${foundConfigs.map(f=>basename(f)).join(", ")}. Please use only one configuration method.`,"https://vercel.com/docs/projects/project-configuration");if(!vercelConfigPath&&!hasVercelToml)return hasVercelJson?{configPath:vercelJsonPath,wasCompiled:!1}:await fileExists(compiledConfigPath)?{configPath:compiledConfigPath,wasCompiled:!0,sourceFile:await findSourceVercelConfigFile(workPath)??void 0}:{configPath:null,wasCompiled:!1};if(hasVercelToml)try{let{parse:tomlParse}=await import("./dist-RXYNZPEA.js"),tomlContent=await readFile(vercelTomlPath,"utf8"),config=tomlParse(tomlContent),normalizedConfig=normalizeConfig(config);return await mkdir(vercelDir,{recursive:!0}),await writeFile(compiledConfigPath,JSON.stringify(normalizedConfig,null,2),"utf-8"),output_manager_default.debug(`Compiled ${vercelTomlPath} -> ${compiledConfigPath}`),{configPath:compiledConfigPath,wasCompiled:!0,sourceFile:"vercel.toml"}}catch(error){throw new import_build_utils.NowBuildError({code:error.code??"vercel_toml_parse_failed",message:`Failed to parse vercel.toml: ${error.message}`,link:error.link??"https://vercel.com/docs/projects/project-configuration"})}let sourceConfigPath=vercelConfigPath;(0,import_dotenv.config)({path:join(workPath,".env")}),(0,import_dotenv.config)({path:join(workPath,".env.local")});let tempOutPath=join(vercelDir,"vercel-temp.mjs"),loaderPath=join(vercelDir,"vercel-loader.mjs");try{let{build}=await loadEsbuild();await mkdir(vercelDir,{recursive:!0}),await build({entryPoints:[sourceConfigPath],bundle:!0,platform:"node",format:"esm",outfile:tempOutPath,packages:"external",target:"node20",sourcemap:"inline"}),await writeFile(loaderPath,`
|
|
10
|
+
import { pathToFileURL } from 'url';
|
|
11
|
+
const configModule = await import(pathToFileURL(process.argv[2]).href);
|
|
12
|
+
const config = ('default' in configModule) ? configModule.default : ('config' in configModule) ? configModule.config : configModule;
|
|
13
|
+
process.send(config);
|
|
14
|
+
`,"utf-8");let config=await new Promise((resolve,reject)=>{let child=fork(loaderPath,[tempOutPath],{execPath:(0,import_build_utils.getNodeExecPath)(),stdio:["pipe","pipe","pipe","ipc"]}),stderrOutput="",stdoutOutput="";child.stderr&&child.stderr.on("data",data=>{stderrOutput+=data.toString()}),child.stdout&&child.stdout.on("data",data=>{stdoutOutput+=data.toString()});let timeout=setTimeout(()=>{child.kill(),reject(new Error("Config loader timed out after 10 seconds"))},1e4);child.on("message",message=>{clearTimeout(timeout),child.kill(),resolve(message)}),child.on("error",err=>{clearTimeout(timeout),reject(err)}),child.on("exit",code=>{if(clearTimeout(timeout),code!==0){stderrOutput.trim()&&output_manager_default.log(stderrOutput),stdoutOutput.trim()&&output_manager_default.log(stdoutOutput);let parsedError=parseConfigLoaderError(stderrOutput);parsedError?reject(new Error(parsedError)):stdoutOutput.trim()?reject(new Error(stdoutOutput.trim())):reject(new Error(`Config loader exited with code ${code}`))}})}),normalizedConfig=normalizeConfig(config);return await writeFile(compiledConfigPath,JSON.stringify(normalizedConfig,null,2),"utf-8"),output_manager_default.debug(`Compiled ${sourceConfigPath} -> ${compiledConfigPath}`),{configPath:compiledConfigPath,wasCompiled:!0,sourceFile:await findSourceVercelConfigFile(workPath)??void 0}}catch(error){throw new import_build_utils.NowBuildError({code:error.code??"vercel_ts_compilation_failed",message:`Failed to compile ${basename(sourceConfigPath)}: ${error.message}`,link:error.link??"https://vercel.com/docs/projects/project-configuration"})}finally{await Promise.all([unlink(tempOutPath).catch(err=>{err.code!=="ENOENT"&&output_manager_default.debug(`Failed to cleanup temp file: ${err}`)}),unlink(loaderPath).catch(err=>{err.code!=="ENOENT"&&output_manager_default.debug(`Failed to cleanup loader file: ${err}`)})])}}async function getVercelConfigPath(workPath){let vercelJsonPath=join(workPath,"vercel.json"),vercelTomlPath=join(workPath,"vercel.toml"),compiledConfigPath=join(workPath,VERCEL_DIR,"vercel.json");return await fileExists(vercelJsonPath)?vercelJsonPath:await fileExists(vercelTomlPath)?vercelTomlPath:await fileExists(compiledConfigPath)?compiledConfigPath:vercelJsonPath}export{require_main,normalizeConfig,findSourceVercelConfigFile,compileVercelConfig,getVercelConfigPath};
|