vercel 59.14.0 → 59.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/add-7XFD2OHW.js +8 -0
- package/dist/chunks/add-HZC7AUBY.js +8 -0
- package/dist/chunks/add-PYUNJZ6K.js +8 -0
- package/dist/chunks/build-EFKQ6BND.js +7 -0
- package/dist/chunks/chunk-2B2MN3U5.js +8 -0
- package/dist/chunks/chunk-2H77IRPI.js +9 -0
- package/dist/chunks/chunk-2I64AYHG.js +7 -0
- package/dist/chunks/chunk-2PPXY24N.js +20 -0
- package/dist/chunks/chunk-2S6PE6GB.js +7 -0
- package/dist/chunks/{chunk-PIMIVJYK.js → chunk-3FMJYJUR.js} +7 -32
- package/dist/chunks/chunk-3IAQUNQH.js +7 -0
- package/dist/chunks/chunk-3QHJYVCY.js +7 -0
- package/dist/chunks/chunk-3QT7VOE3.js +7 -0
- package/dist/chunks/chunk-3TXEXPUW.js +7 -0
- package/dist/chunks/chunk-4MZK6JT6.js +7 -0
- package/dist/chunks/chunk-4NE5IQ25.js +7 -0
- package/dist/chunks/chunk-4PNSSS3L.js +7 -0
- package/dist/chunks/chunk-4QX77CP7.js +7 -0
- package/dist/chunks/chunk-562OXD3F.js +21 -0
- package/dist/chunks/chunk-57GHYR4Y.js +25 -0
- package/dist/chunks/chunk-5QQNYN4N.js +7 -0
- package/dist/chunks/chunk-5XJNPXQK.js +7 -0
- package/dist/chunks/chunk-6L236MNA.js +7 -0
- package/dist/chunks/chunk-6PFC3KWQ.js +7 -0
- package/dist/chunks/chunk-6QKS6QK7.js +7 -0
- package/dist/chunks/chunk-6RIQPTJA.js +8 -0
- package/dist/chunks/chunk-6TAQ6OWD.js +13 -0
- package/dist/chunks/chunk-6YAADRQB.js +9 -0
- package/dist/chunks/chunk-75CPY75D.js +15 -0
- package/dist/chunks/chunk-7HL2RPUO.js +7 -0
- package/dist/chunks/chunk-7PNYOSDU.js +9 -0
- package/dist/chunks/chunk-7R5FEXZ5.js +7 -0
- package/dist/chunks/chunk-7RMCBXBB.js +62 -0
- package/dist/chunks/chunk-7RR7MIMT.js +7 -0
- package/dist/chunks/chunk-7T6TL3GQ.js +7 -0
- package/dist/chunks/chunk-ADUYPK2G.js +13 -0
- package/dist/chunks/chunk-AFPOIDM5.js +7 -0
- package/dist/chunks/chunk-AM46JVVN.js +7 -0
- package/dist/chunks/chunk-AUGK2HIT.js +18 -0
- package/dist/chunks/chunk-AVSPFBLM.js +7 -0
- package/dist/chunks/chunk-B4ATVYZW.js +7 -0
- package/dist/chunks/chunk-BATE73HA.js +9 -0
- package/dist/chunks/{chunk-64IF634X.js → chunk-BRK4OB4B.js} +1 -12
- package/dist/chunks/chunk-BVH2AEFE.js +7 -0
- package/dist/chunks/chunk-CGOVWHI3.js +45 -0
- package/dist/chunks/chunk-CN2QZO4U.js +7 -0
- package/dist/chunks/chunk-COQGD2EI.js +8 -0
- package/dist/chunks/chunk-CUAIEGNE.js +7 -0
- package/dist/chunks/chunk-CVKB54WW.js +7 -0
- package/dist/chunks/{chunk-A3NYPUKZ.js → chunk-CZSOZKHX.js} +1 -11
- package/dist/chunks/chunk-D3EHMP4U.js +24 -0
- package/dist/chunks/chunk-D4MW3RDW.js +7 -0
- package/dist/chunks/chunk-DFVNL5ML.js +7 -0
- package/dist/chunks/chunk-EE3FVJLV.js +16 -0
- package/dist/chunks/chunk-EGMJRU5P.js +28 -0
- package/dist/chunks/chunk-ENBTTYJR.js +7 -0
- package/dist/chunks/chunk-ENS6KX2F.js +7 -0
- package/dist/chunks/chunk-EOBD4ZEG.js +8 -0
- package/dist/chunks/chunk-EOCTK4EA.js +7 -0
- package/dist/chunks/chunk-EQ52F4LH.js +7 -0
- package/dist/chunks/chunk-ETV3C2CV.js +7 -0
- package/dist/chunks/chunk-EVZRQGNK.js +7 -0
- package/dist/chunks/chunk-F2ZWW2IO.js +8 -0
- package/dist/chunks/chunk-FAW6NBLQ.js +7 -0
- package/dist/chunks/chunk-FI772UVH.js +7 -0
- package/dist/chunks/chunk-FKCOBJFH.js +7 -0
- package/dist/chunks/chunk-G5FC5ZCO.js +9 -0
- package/dist/chunks/chunk-G6CTAHKY.js +39 -0
- package/dist/chunks/chunk-G7Y77DFH.js +7 -0
- package/dist/chunks/chunk-GHAY4PSD.js +7 -0
- package/dist/chunks/chunk-GHM7V3GG.js +7 -0
- package/dist/chunks/chunk-GRNTLNC7.js +7 -0
- package/dist/chunks/chunk-GTRGQIY2.js +10 -0
- package/dist/chunks/chunk-GU6VIFR5.js +7 -0
- package/dist/chunks/{constants-YMCRE6IG.js → chunk-GZNDA6SV.js} +2 -9
- package/dist/chunks/chunk-HBFPLBTX.js +10 -0
- package/dist/chunks/chunk-HEGJZJO7.js +7 -0
- package/dist/chunks/chunk-HSJ6AHWG.js +12 -0
- package/dist/chunks/chunk-HTC6KO2B.js +7 -0
- package/dist/chunks/chunk-HVUHCRZB.js +18 -0
- package/dist/chunks/chunk-HZZ5L472.js +7 -0
- package/dist/chunks/chunk-IVSSTHB6.js +7 -0
- package/dist/chunks/chunk-IVWPQYIH.js +7 -0
- package/dist/chunks/chunk-J3U3L45Y.js +7 -0
- package/dist/chunks/chunk-JAJW3P42.js +7 -0
- package/dist/chunks/chunk-JEIMW3CO.js +7 -0
- package/dist/chunks/chunk-JIYY3B4C.js +7 -0
- package/dist/chunks/chunk-JKTQV2QJ.js +7 -0
- package/dist/chunks/chunk-JTVVBRW7.js +7 -0
- package/dist/chunks/chunk-JYAUUIR4.js +7 -0
- package/dist/chunks/chunk-JZRMH5UA.js +7 -0
- package/dist/chunks/chunk-K2RAW5DI.js +10 -0
- package/dist/chunks/chunk-K3KJZLBD.js +7 -0
- package/dist/chunks/chunk-KK4AJES5.js +36 -0
- package/dist/chunks/chunk-KKS7XWEX.js +7 -0
- package/dist/chunks/chunk-KNEWCUWF.js +14 -0
- package/dist/chunks/chunk-KO733OJG.js +9 -0
- package/dist/chunks/chunk-L243RUIR.js +19 -0
- package/dist/chunks/chunk-L3JDEHCQ.js +7 -0
- package/dist/chunks/chunk-LDM3SQAU.js +13 -0
- package/dist/chunks/chunk-LNPMDXBJ.js +7 -0
- package/dist/chunks/chunk-M2W3HKV3.js +23 -0
- package/dist/chunks/chunk-M2XARQBF.js +9 -0
- package/dist/chunks/chunk-M5AV545M.js +7 -0
- package/dist/chunks/chunk-MAVRGZQP.js +7 -0
- package/dist/chunks/chunk-MBL6TXEJ.js +7 -0
- package/dist/chunks/chunk-MEAY2K5Z.js +11 -0
- package/dist/chunks/chunk-MY4MONOH.js +7 -0
- package/dist/chunks/chunk-N3N5UHIL.js +7 -0
- package/dist/chunks/chunk-N3ZZ7FHQ.js +7 -0
- package/dist/chunks/chunk-N6CNMMSZ.js +7 -0
- package/dist/chunks/chunk-NBVY237X.js +7 -0
- package/dist/chunks/chunk-NGNOUPWS.js +25 -0
- package/dist/chunks/chunk-NHTF332K.js +7 -0
- package/dist/chunks/chunk-NNP5NITU.js +15 -0
- package/dist/chunks/chunk-NS4FH2TY.js +11 -0
- package/dist/chunks/chunk-NUGLE4QY.js +11 -0
- package/dist/chunks/chunk-NWFHHUKZ.js +7 -0
- package/dist/chunks/chunk-O7G3CZ42.js +7 -0
- package/dist/chunks/chunk-OD6RZ3XZ.js +8 -0
- package/dist/chunks/chunk-OHDEHZLX.js +7 -0
- package/dist/chunks/chunk-OK3S6KFX.js +16 -0
- package/dist/chunks/chunk-OKZDOANA.js +23 -0
- package/dist/chunks/chunk-OSCCYU74.js +7 -0
- package/dist/chunks/chunk-OUHPDA7Q.js +7 -0
- package/dist/chunks/chunk-P2O5DOYE.js +7 -0
- package/dist/chunks/chunk-PHW54NU5.js +13 -0
- package/dist/chunks/chunk-PPCFQQSU.js +7 -0
- package/dist/chunks/chunk-QGIGNMII.js +8 -0
- package/dist/chunks/chunk-QGIQK47P.js +7 -0
- package/dist/chunks/chunk-QHJLRTVY.js +7 -0
- package/dist/chunks/{chunk-2473DUBR.js → chunk-QR7QPUFN.js} +1 -9
- package/dist/chunks/chunk-QTKJC2O5.js +7 -0
- package/dist/chunks/chunk-R2TGGVCT.js +19 -0
- package/dist/chunks/chunk-RAIBQIKB.js +7 -0
- package/dist/chunks/chunk-RCTYVKM5.js +16 -0
- package/dist/chunks/chunk-RKAUVPOQ.js +86 -0
- package/dist/chunks/chunk-S5CEIACD.js +7 -0
- package/dist/chunks/chunk-SGWVKRSR.js +8 -0
- package/dist/chunks/chunk-SOJCELXH.js +7 -0
- package/dist/chunks/chunk-SXUEGVWB.js +7 -0
- package/dist/chunks/{chunk-GGPE5377.js → chunk-T3GQAMBJ.js} +1 -9
- package/dist/chunks/chunk-T52FMXWC.js +7 -0
- package/dist/chunks/chunk-TG2RCYTH.js +7 -0
- package/dist/chunks/chunk-TJCIHDPZ.js +9 -0
- package/dist/chunks/chunk-TKBXN4H3.js +9 -0
- package/dist/chunks/chunk-TRTEXGVN.js +7 -0
- package/dist/chunks/chunk-U56NHYAH.js +7 -0
- package/dist/chunks/chunk-U7KCDTCH.js +12 -0
- package/dist/chunks/chunk-UETTIYUQ.js +8 -0
- package/dist/chunks/chunk-ULLWCOYC.js +7 -0
- package/dist/chunks/chunk-UXTHEQVJ.js +21 -0
- package/dist/chunks/chunk-VLZ47RWM.js +44 -0
- package/dist/chunks/chunk-WKZ6JSGZ.js +7 -0
- package/dist/chunks/chunk-WPS6JZF6.js +7 -0
- package/dist/chunks/chunk-WRILLB46.js +7 -0
- package/dist/chunks/chunk-WUZD4KBL.js +7 -0
- package/dist/chunks/chunk-XCJDGQO7.js +7 -0
- package/dist/chunks/{pkg-56KRLZ5K.js → chunk-XD2LZRBS.js} +1 -7
- package/dist/chunks/chunk-XFVGX5HG.js +7 -0
- package/dist/chunks/chunk-XHOGOH6N.js +7 -0
- package/dist/chunks/{update-route-version-E3V47KNI.js → chunk-XPXOV5UO.js} +1 -7
- package/dist/chunks/chunk-XQ73QIQ3.js +7 -0
- package/dist/chunks/chunk-XSVBYDYI.js +8 -0
- package/dist/chunks/chunk-YKZLKOOD.js +12 -0
- package/dist/chunks/chunk-YMVDWVMO.js +7 -0
- package/dist/chunks/chunk-YPTLSODC.js +7 -0
- package/dist/chunks/chunk-YV6CTDHR.js +7 -0
- package/dist/chunks/chunk-Z6Y55QJW.js +23 -0
- package/dist/chunks/chunk-ZDX75YNZ.js +7 -0
- package/dist/chunks/chunk-ZIPVX7LD.js +7 -0
- package/dist/chunks/chunk-ZKYS7EAB.js +7 -0
- package/dist/chunks/chunk-ZXE4XYIV.js +7 -0
- package/dist/chunks/chunk-ZZQRMRWD.js +20 -0
- package/dist/chunks/cjs-GOQHXIHX.js +54 -0
- package/dist/chunks/clear-5NQAVWIF.js +8 -0
- package/dist/chunks/compile-vercel-config-6J2XUFRK.js +7 -0
- package/dist/chunks/config-CKYRXZXL.js +7 -0
- package/dist/chunks/config-VNUY4RJ4.js +8 -0
- package/dist/chunks/connect-git-provider-GIU5WZ52.js +7 -0
- package/dist/chunks/constants-G4UYVLOF.js +7 -0
- package/dist/chunks/create-project-SRQGD4JY.js +7 -0
- package/dist/chunks/delete-GTXXCSKQ.js +10 -0
- package/dist/chunks/delete-HRJEO4MI.js +9 -0
- package/dist/chunks/detect-projects-2GNCZ4CS.js +7 -0
- package/dist/chunks/detect-services-GHILEGNU.js +7 -0
- package/dist/chunks/disable-RWCRVG5O.js +7 -0
- package/dist/chunks/discard-SHFIYCJU.js +14 -0
- package/dist/chunks/edit-DMO3NSO2.js +9 -0
- package/dist/chunks/edit-EVQI2RSS.js +8 -0
- package/dist/chunks/enable-AWDU6STD.js +7 -0
- package/dist/chunks/esm-7HVUFWMN.js +7 -0
- package/dist/chunks/esm-BZBEM7YA.js +7 -0
- package/dist/chunks/esm-CXICLFA3.js +9 -0
- package/dist/chunks/esm-HDEHVK7I.js +9 -0
- package/dist/chunks/esm-NQRLKALI.js +20 -0
- package/dist/chunks/esm-SZZI53W7.js +7 -0
- package/dist/chunks/esm-WGJFGCLK.js +7 -0
- package/dist/chunks/exec-4AISDHUV.js +16372 -0
- package/dist/chunks/export-IQKTA4RS.js +19 -0
- package/dist/chunks/fetch-proxy-AEAWC6MD.js +7 -0
- package/dist/chunks/future-E2FHKPJN.js +7 -0
- package/dist/chunks/generate-cert-for-deploy-VKOWC4PZ.js +7 -0
- package/dist/chunks/image-LDFYNOCA.js +7 -0
- package/dist/chunks/import-builders-P7CXSX2D.js +7 -0
- package/dist/chunks/inspect-3N47ODIH.js +15 -0
- package/dist/chunks/inspect-53SGDDAH.js +20 -0
- package/dist/chunks/inspect-5INZDUQS.js +19 -0
- package/dist/chunks/inspect-WMT2M335.js +9 -0
- package/dist/chunks/inspect-Y6BUCOUV.js +13 -0
- package/dist/chunks/list-BIAPHKFM.js +11 -0
- package/dist/chunks/list-DMOCRRSE.js +16 -0
- package/dist/chunks/list-K5J7OULR.js +10 -0
- package/dist/chunks/login-DEAEVUHM.js +7 -0
- package/dist/chunks/login-SRVNHI4Y.js +9 -0
- package/dist/chunks/logs-GK7CJBYY.js +7 -0
- package/dist/chunks/ls-7ZX6DCJW.js +12 -0
- package/dist/chunks/ls-AJWN5ZR4.js +12 -0
- package/dist/chunks/ls-BFJWCRLZ.js +12 -0
- package/dist/chunks/ls-KGIE6HCO.js +12 -0
- package/dist/chunks/ls-UVKTHBTE.js +8 -0
- package/dist/chunks/ls-WEG45IOC.js +8 -0
- package/dist/chunks/native-self-update-KOJVRMHR.js +7 -0
- package/dist/chunks/open-OEWPI5G6.js +7 -0
- package/dist/chunks/openapi-MO5HYMHR.js +7 -0
- package/dist/chunks/permissions-EPQBQFE3.js +7 -0
- package/dist/chunks/pkg-YFU67U7I.js +7 -0
- package/dist/chunks/prompt-missing-credentials-IUHLYSQU.js +7 -0
- package/dist/chunks/publish-JG7MEPWT.js +15 -0
- package/dist/chunks/pull-MRKXG6TO.js +7 -0
- package/dist/chunks/purchase-domain-if-available-O5ARXEZ5.js +7 -0
- package/dist/chunks/push-XOXJDFYO.js +7 -0
- package/dist/chunks/query-AL7C6WV2.js +12 -0
- package/dist/chunks/reauthenticate-SH4XR7NH.js +7 -0
- package/dist/chunks/reorder-5DMRFDBY.js +10 -0
- package/dist/chunks/reply-WSRNZWFD.js +9 -0
- package/dist/chunks/repo-info-to-url-SK3VX6UL.js +7 -0
- package/dist/chunks/resolve-YJUXQVOZ.js +12 -0
- package/dist/chunks/resolve-deployment-framework-preset-XF3NJIDS.js +7 -0
- package/dist/chunks/restore-QT3DBGKU.js +16 -0
- package/dist/chunks/rm-MHPIUEZ5.js +8 -0
- package/dist/chunks/rm-MVZFU6RG.js +8 -0
- package/dist/chunks/rm-PXR4J2US.js +8 -0
- package/dist/chunks/rm-WB2AIP3N.js +8 -0
- package/dist/chunks/rm-XRP6MRUT.js +8 -0
- package/dist/chunks/routes-5DERZV5M.js +7 -0
- package/dist/chunks/rule-inspect-TT3DRGCS.js +8 -0
- package/dist/chunks/rules-B5GW4KJH.js +7 -0
- package/dist/chunks/schema-JY5QTZOG.js +14 -0
- package/dist/chunks/schema-KCNKVFT3.js +44 -0
- package/dist/chunks/select-org-KSCYSESV.js +7 -0
- package/dist/chunks/set-7BANEWEL.js +7 -0
- package/dist/chunks/setup-and-link-ZAV3EFGC.js +7 -0
- package/dist/chunks/slugify-O5DBATYT.js +7 -0
- package/dist/chunks/stamp-OX4YO3KY.js +7 -0
- package/dist/chunks/tags-VZR66NUC.js +7 -0
- package/dist/chunks/types-LRXQEDYI.js +14 -0
- package/dist/chunks/update-RBFNNSWE.js +8 -0
- package/dist/chunks/update-route-version-XZAFPQJC.js +7 -0
- package/dist/chunks/utils-B5ZTMQKY.js +58 -0
- package/dist/chunks/vlt-builder-importer-YVCYYRVV.js +11 -0
- package/dist/commands/build/index.js +24 -4925
- package/dist/commands/deploy/index.js +43 -2875
- package/dist/commands/dev/index.js +56 -23857
- package/dist/commands/env/index.js +26 -3411
- package/dist/commands/link/index.js +4 -284
- package/dist/commands/list/index.js +6 -566
- package/dist/commands-bulk.js +1187 -87691
- package/dist/help.js +1 -8
- package/dist/index.js +19 -2591
- package/dist/version.mjs +1 -1
- package/package.json +50 -51
- package/dist/chunks/add-EQZRT4XL.js +0 -221
- package/dist/chunks/add-KMDROZC3.js +0 -196
- package/dist/chunks/add-QPJ3XMBV.js +0 -145
- package/dist/chunks/build-W4HPTAOB.js +0 -251
- package/dist/chunks/chunk-26CU4Q3C.js +0 -598
- package/dist/chunks/chunk-2HSQ7YUK.js +0 -93
- package/dist/chunks/chunk-2JIX6UMI.js +0 -4626
- package/dist/chunks/chunk-2LCFOK66.js +0 -1536
- package/dist/chunks/chunk-332LMJLZ.js +0 -16014
- package/dist/chunks/chunk-3HZLXCVL.js +0 -137
- package/dist/chunks/chunk-3VM7HWF6.js +0 -104
- package/dist/chunks/chunk-3ZE5CFVM.js +0 -346
- package/dist/chunks/chunk-4IALDGB7.js +0 -22
- package/dist/chunks/chunk-4KD5BYHB.js +0 -127
- package/dist/chunks/chunk-4TUMNBEE.js +0 -231
- package/dist/chunks/chunk-4WG2MYCI.js +0 -163
- package/dist/chunks/chunk-57RHXXXG.js +0 -150
- package/dist/chunks/chunk-5AJPMLDV.js +0 -28
- package/dist/chunks/chunk-5EIV6LPQ.js +0 -305
- package/dist/chunks/chunk-5NF5HOBJ.js +0 -1854
- package/dist/chunks/chunk-653QRQAD.js +0 -417
- package/dist/chunks/chunk-67CRVWDF.js +0 -81
- package/dist/chunks/chunk-6E6KPBXY.js +0 -43
- package/dist/chunks/chunk-75VENWDN.js +0 -1892
- package/dist/chunks/chunk-7MRDIPJY.js +0 -107
- package/dist/chunks/chunk-7NRNFV77.js +0 -875
- package/dist/chunks/chunk-7Q45OKWR.js +0 -149
- package/dist/chunks/chunk-AHU7WNL2.js +0 -24
- package/dist/chunks/chunk-AINIBIP4.js +0 -39
- package/dist/chunks/chunk-AJ5HUOWB.js +0 -14059
- package/dist/chunks/chunk-AKLTIZCU.js +0 -46
- package/dist/chunks/chunk-AQ6P3IGG.js +0 -49
- package/dist/chunks/chunk-B5NH7SLK.js +0 -324
- package/dist/chunks/chunk-B5XLQKHI.js +0 -849
- package/dist/chunks/chunk-BEQV3X2L.js +0 -86
- package/dist/chunks/chunk-CAHP7UGE.js +0 -79
- package/dist/chunks/chunk-CFDDM4TX.js +0 -13618
- package/dist/chunks/chunk-CJV7J7B5.js +0 -314
- package/dist/chunks/chunk-CV5YC2EN.js +0 -867
- package/dist/chunks/chunk-CXFY6A6W.js +0 -255
- package/dist/chunks/chunk-D5SMZXVO.js +0 -233
- package/dist/chunks/chunk-E336ZXPP.js +0 -43
- package/dist/chunks/chunk-EDMW7SBH.js +0 -246
- package/dist/chunks/chunk-EFYMIIER.js +0 -40
- package/dist/chunks/chunk-EKPSCRJZ.js +0 -26
- package/dist/chunks/chunk-EOZFDJSY.js +0 -18
- package/dist/chunks/chunk-EWBCSDTM.js +0 -1708
- package/dist/chunks/chunk-EZKW5YJ2.js +0 -177
- package/dist/chunks/chunk-F2QLCXCF.js +0 -2399
- package/dist/chunks/chunk-FGDKMNEN.js +0 -21
- package/dist/chunks/chunk-FRVG4OW3.js +0 -7438
- package/dist/chunks/chunk-FVF4UHDM.js +0 -1288
- package/dist/chunks/chunk-G5FBSUL4.js +0 -822
- package/dist/chunks/chunk-GDOUDU6O.js +0 -74
- package/dist/chunks/chunk-GGP5R3FU.js +0 -129
- package/dist/chunks/chunk-GVNCVKCI.js +0 -68
- package/dist/chunks/chunk-GY5I4AYD.js +0 -122
- package/dist/chunks/chunk-GZLPFESR.js +0 -48
- package/dist/chunks/chunk-HB4UKFDO.js +0 -1295
- package/dist/chunks/chunk-HD4DR3DA.js +0 -818
- package/dist/chunks/chunk-HKHXKSXQ.js +0 -152
- package/dist/chunks/chunk-HM24ZWQL.js +0 -174
- package/dist/chunks/chunk-HRXRELD3.js +0 -338
- package/dist/chunks/chunk-IB5L4LKZ.js +0 -1082
- package/dist/chunks/chunk-IIMSID24.js +0 -104
- package/dist/chunks/chunk-J7JKZM4T.js +0 -58
- package/dist/chunks/chunk-JC2O346E.js +0 -137
- package/dist/chunks/chunk-JSD4EZL3.js +0 -34
- package/dist/chunks/chunk-JZXJZX7O.js +0 -257
- package/dist/chunks/chunk-K3RED3VO.js +0 -566
- package/dist/chunks/chunk-KFWQ3EFH.js +0 -151
- package/dist/chunks/chunk-KW7BS25T.js +0 -466
- package/dist/chunks/chunk-KXDWXXJH.js +0 -70
- package/dist/chunks/chunk-LERVNZTD.js +0 -90
- package/dist/chunks/chunk-LYAAQDNS.js +0 -242
- package/dist/chunks/chunk-M5I6INNF.js +0 -61
- package/dist/chunks/chunk-N6HP5BLI.js +0 -18190
- package/dist/chunks/chunk-ND5CF2H3.js +0 -53
- package/dist/chunks/chunk-NFU4XJIR.js +0 -120
- package/dist/chunks/chunk-NW34PW6V.js +0 -1772
- package/dist/chunks/chunk-OAMU5QO6.js +0 -18
- package/dist/chunks/chunk-OCIZ6ZYA.js +0 -253
- package/dist/chunks/chunk-ORQZKIIB.js +0 -2914
- package/dist/chunks/chunk-P3SKP5WM.js +0 -27
- package/dist/chunks/chunk-P4QNYOFB.js +0 -96
- package/dist/chunks/chunk-P7VSBDR4.js +0 -827
- package/dist/chunks/chunk-PEC3CQSK.js +0 -90
- package/dist/chunks/chunk-PMSMUMUO.js +0 -30
- package/dist/chunks/chunk-PNGVSHR3.js +0 -40
- package/dist/chunks/chunk-POOO7W47.js +0 -916
- package/dist/chunks/chunk-PRWJUY5U.js +0 -848
- package/dist/chunks/chunk-Q2DGFCO7.js +0 -579
- package/dist/chunks/chunk-RBF2NPUP.js +0 -577
- package/dist/chunks/chunk-RBIFXFZX.js +0 -52
- package/dist/chunks/chunk-RDTRWLWB.js +0 -11441
- package/dist/chunks/chunk-RN6V5ODW.js +0 -114
- package/dist/chunks/chunk-RNSMTWA6.js +0 -122
- package/dist/chunks/chunk-RTJASENB.js +0 -59
- package/dist/chunks/chunk-RVBZ64EQ.js +0 -52
- package/dist/chunks/chunk-S7KYDPEM.js +0 -1564
- package/dist/chunks/chunk-SLPSPYVR.js +0 -334
- package/dist/chunks/chunk-SM3F3PYJ.js +0 -522
- package/dist/chunks/chunk-TO7QZGYK.js +0 -105
- package/dist/chunks/chunk-TSBUHSN7.js +0 -3495
- package/dist/chunks/chunk-TSFWMUCY.js +0 -506
- package/dist/chunks/chunk-TZ2YI2VH.js +0 -87
- package/dist/chunks/chunk-UG2WOB5L.js +0 -150
- package/dist/chunks/chunk-UNKHOYMF.js +0 -559
- package/dist/chunks/chunk-UOVWUSLG.js +0 -2099
- package/dist/chunks/chunk-V4RMJKQP.js +0 -36
- package/dist/chunks/chunk-VGIMO3ZK.js +0 -17
- package/dist/chunks/chunk-VGKSIKCC.js +0 -92
- package/dist/chunks/chunk-VP5Y3SZG.js +0 -106
- package/dist/chunks/chunk-VXYGCOKL.js +0 -28
- package/dist/chunks/chunk-W7FGI2GZ.js +0 -233
- package/dist/chunks/chunk-WGGABYO5.js +0 -31
- package/dist/chunks/chunk-XDGOOW3K.js +0 -60
- package/dist/chunks/chunk-XFF5TGRA.js +0 -303
- package/dist/chunks/chunk-XNIZGCN5.js +0 -58
- package/dist/chunks/chunk-XPJLPUKO.js +0 -117
- package/dist/chunks/chunk-XUAWTW4W.js +0 -467
- package/dist/chunks/chunk-YPQSDAEW.js +0 -29
- package/dist/chunks/chunk-YS76T533.js +0 -270
- package/dist/chunks/chunk-ZDU2NODC.js +0 -104
- package/dist/chunks/chunk-ZW6HETRE.js +0 -97
- package/dist/chunks/cjs-DV4RM7XU.js +0 -20743
- package/dist/chunks/clear-4IACMLFU.js +0 -141
- package/dist/chunks/compile-vercel-config-PQQ3OCLV.js +0 -33
- package/dist/chunks/config-BQQKMQBP.js +0 -168
- package/dist/chunks/config-OCPNHXQL.js +0 -127
- package/dist/chunks/delete-HRKIYPCO.js +0 -159
- package/dist/chunks/delete-P2UL3KTU.js +0 -226
- package/dist/chunks/detect-projects-ODNU4PK2.js +0 -18
- package/dist/chunks/detect-services-U7QGT7VO.js +0 -40
- package/dist/chunks/disable-3NYMICQ3.js +0 -198
- package/dist/chunks/discard-RNVEJUK3.js +0 -145
- package/dist/chunks/edit-63S2RQHR.js +0 -162
- package/dist/chunks/edit-CTENFZ7H.js +0 -647
- package/dist/chunks/enable-WILWXAHV.js +0 -204
- package/dist/chunks/exec-4IPHZ55G.js +0 -1291
- package/dist/chunks/export-YHGV3EPK.js +0 -177
- package/dist/chunks/fetch-proxy-R3JZNXBZ.js +0 -99
- package/dist/chunks/image-MWKS2YMB.js +0 -75
- package/dist/chunks/import-builders-H55X5VYD.js +0 -39
- package/dist/chunks/inspect-JTJMK6TO.js +0 -596
- package/dist/chunks/inspect-KBIPLMGR.js +0 -216
- package/dist/chunks/inspect-OP26FDBY.js +0 -171
- package/dist/chunks/inspect-SW4UMWTB.js +0 -175
- package/dist/chunks/inspect-WPLZPVBO.js +0 -145
- package/dist/chunks/list-HE7DWAWH.js +0 -387
- package/dist/chunks/list-OUG7WCT7.js +0 -404
- package/dist/chunks/list-QUSEURJZ.js +0 -426
- package/dist/chunks/login-MIIQJVF3.js +0 -233
- package/dist/chunks/ls-24N3DUK4.js +0 -183
- package/dist/chunks/ls-3Y7KEFKT.js +0 -175
- package/dist/chunks/ls-75F5HIJ5.js +0 -188
- package/dist/chunks/ls-REN6X2X5.js +0 -204
- package/dist/chunks/ls-W4STUDXK.js +0 -223
- package/dist/chunks/ls-Z4CTSD6C.js +0 -210
- package/dist/chunks/open-ARMCLPBK.js +0 -116
- package/dist/chunks/permissions-JKI67F62.js +0 -99
- package/dist/chunks/publish-SMSQ7OX2.js +0 -155
- package/dist/chunks/pull-4QZJZELD.js +0 -45
- package/dist/chunks/push-T6IYQY2J.js +0 -191
- package/dist/chunks/query-CP3JK5LW.js +0 -725
- package/dist/chunks/reorder-RAWKFGLV.js +0 -412
- package/dist/chunks/reply-235UHUD4.js +0 -176
- package/dist/chunks/resolve-5KCLN7QV.js +0 -237
- package/dist/chunks/resolve-deployment-framework-preset-NPE6RLV3.js +0 -36
- package/dist/chunks/restore-D24WAUAN.js +0 -252
- package/dist/chunks/rm-DBQDXSOC.js +0 -162
- package/dist/chunks/rm-G5INO77R.js +0 -148
- package/dist/chunks/rm-NLKSEKZ5.js +0 -195
- package/dist/chunks/rm-QV76CJA4.js +0 -322
- package/dist/chunks/rm-TZ4PDDUK.js +0 -147
- package/dist/chunks/routes-QVMBXOSX.js +0 -24
- package/dist/chunks/rule-inspect-76MC7I2D.js +0 -123
- package/dist/chunks/rules-IDUXVTPG.js +0 -89
- package/dist/chunks/schema-AV6BHGKY.js +0 -237
- package/dist/chunks/schema-QJVQTNB4.js +0 -381
- package/dist/chunks/set-L5NFQSCF.js +0 -250
- package/dist/chunks/setup-and-link-USSVDKCM.js +0 -65
- package/dist/chunks/stamp-AA7R3MZS.js +0 -16
- package/dist/chunks/tags-2NLUU4EC.js +0 -69
- package/dist/chunks/types-4GAJ7XQQ.js +0 -116
- package/dist/chunks/update-WGLBB65M.js +0 -224
- package/dist/chunks/vlt-builder-importer-USCFHWPL.js +0 -322
|
@@ -0,0 +1,86 @@
|
|
|
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{formatCondition,formatTransform,isTargetTransform}from"./chunk-EE3FVJLV.js";import{output_manager_default}from"./chunk-Z6Y55QJW.js";import{require_source}from"./chunk-U7KCDTCH.js";import{__toESM}from"./chunk-6L236MNA.js";function extractEnvVarNames(value){let names=new Set;for(let m of value.matchAll(/\$\{?([A-Z_][A-Z0-9_]*)\}?/g))names.add(m[1]);return Array.from(names)}function escapeRegex(value){return value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function referencesEnvVar(value,name){let escapedName=escapeRegex(name);return new RegExp(`\\$(?:\\{${escapedName}\\}|${escapedName}(?![A-Za-z0-9_]))`).test(value)}function referencesBracedEnvVar(value,name){return new RegExp(`\\$\\{${escapeRegex(name)}\\}`).test(value)}function collectReferencedEnvVars(values,explicitEnv=[],excludedNames=new Set){let names=new Set(explicitEnv.filter(name=>values.some(value=>referencesEnvVar(value,name))));for(let value of values)for(let name of extractEnvVarNames(value))(!excludedNames.has(name)||names.has(name)||referencesBracedEnvVar(value,name))&&names.add(name);return Array.from(names)}function collectNamedRegexCaptures(source){return new Set(Array.from(source.matchAll(/\(\?<([a-zA-Z][a-zA-Z0-9_]*)>/g),match=>match[1]))}function populateRouteEnv(route,srcSyntax="regex"){let excludedNames=srcSyntax==="regex"&&route.src?collectNamedRegexCaptures(route.src):new Set,routeValues=[...route.dest?[route.dest]:[],...Object.values(route.headers||{})],routeEnv=collectReferencedEnvVars(routeValues,route.env,excludedNames);if(route.env=routeEnv.length>0?routeEnv:void 0,route.transforms)for(let transform of route.transforms){let args=transform.args?Array.isArray(transform.args)?transform.args:[transform.args]:[],names=collectReferencedEnvVars(args,transform.env,excludedNames);transform.env=names.length>0?names:void 0}}async function generateRoute(client,projectId,input,options={}){let{teamId}=options,query=new URLSearchParams;teamId&&query.set("teamId",teamId);let queryString=query.toString(),url=`/v1/projects/${projectId}/routes/generate${queryString?`?${queryString}`:""}`;return await client.fetch(url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(input)})}function parseTransforms(values,type,op){return values.map(value=>parseTransform(value,type,op))}function parseTransform(input,type,op){if(op==="delete"){let key2=input.trim();if(!key2)throw new Error("Delete operation requires a key");return{type,op,target:{key:key2}}}let eqIndex=input.indexOf("=");if(eqIndex===-1)throw new Error(`Invalid format: "${input}". Expected format: key=value`);let key=input.slice(0,eqIndex).trim(),args=input.slice(eqIndex+1);if(!key)throw new Error("Transform key cannot be empty");return{type,op,target:{key},args}}function collectTransforms(flags){let transforms=[];return flags.setResponseHeader&&transforms.push(...parseTransforms(flags.setResponseHeader,"response.headers","set")),flags.appendResponseHeader&&transforms.push(...parseTransforms(flags.appendResponseHeader,"response.headers","append")),flags.deleteResponseHeader&&transforms.push(...parseTransforms(flags.deleteResponseHeader,"response.headers","delete")),flags.setRequestHeader&&transforms.push(...parseTransforms(flags.setRequestHeader,"request.headers","set")),flags.appendRequestHeader&&transforms.push(...parseTransforms(flags.appendRequestHeader,"request.headers","append")),flags.deleteRequestHeader&&transforms.push(...parseTransforms(flags.deleteRequestHeader,"request.headers","delete")),flags.setRequestQuery&&transforms.push(...parseTransforms(flags.setRequestQuery,"request.query","set")),flags.appendRequestQuery&&transforms.push(...parseTransforms(flags.appendRequestQuery,"request.query","append")),flags.deleteRequestQuery&&transforms.push(...parseTransforms(flags.deleteRequestQuery,"request.query","delete")),transforms}function collectResponseHeaders(setHeaders){let headers={};for(let input of setHeaders){let eqIndex=input.indexOf("=");if(eqIndex===-1)throw new Error(`Invalid header format: "${input}". Expected format: key=value`);let key=input.slice(0,eqIndex).trim(),value=input.slice(eqIndex+1);if(!key)throw new Error("Header key cannot be empty");headers[key]=value}return headers}var MAX_NAME_LENGTH=256,MAX_DESCRIPTION_LENGTH=1024,MAX_CONDITIONS=16,VALID_SYNTAXES=["regex","path-to-regexp","equals"],REDIRECT_STATUS_CODES=[301,302,303,307,308],VALID_ACTION_TYPES=["rewrite","redirect","set-status"],ALL_ACTION_CHOICES=[{name:"Rewrite",value:"rewrite",exclusive:!0},{name:"Redirect",value:"redirect",exclusive:!0},{name:"Set Status Code",value:"set-status",exclusive:!0},{name:"Response Headers",value:"response-headers"},{name:"Request Headers",value:"request-headers"},{name:"Request Query",value:"request-query"}];function stripQuotes(str){return str.startsWith('"')&&str.endsWith('"')&&str.length>=2||str.startsWith("'")&&str.endsWith("'")&&str.length>=2?str.slice(1,-1):str}function extractTransformFlags(flags){return{setResponseHeader:flags["--set-response-header"],appendResponseHeader:flags["--append-response-header"],deleteResponseHeader:flags["--delete-response-header"],setRequestHeader:flags["--set-request-header"],appendRequestHeader:flags["--append-request-header"],deleteRequestHeader:flags["--delete-request-header"],setRequestQuery:flags["--set-request-query"],appendRequestQuery:flags["--append-request-query"],deleteRequestQuery:flags["--delete-request-query"]}}function collectHeadersAndTransforms(transformFlags){let headers=transformFlags.setResponseHeader?collectResponseHeaders(transformFlags.setResponseHeader):{},transforms=collectTransforms({...transformFlags,setResponseHeader:void 0});return{headers,transforms}}function hasAnyTransformFlags(flags){let tf=extractTransformFlags(flags);return!!(tf.setResponseHeader||tf.appendResponseHeader||tf.deleteResponseHeader||tf.setRequestHeader||tf.appendRequestHeader||tf.deleteRequestHeader||tf.setRequestQuery||tf.appendRequestQuery||tf.deleteRequestQuery)}function validateActionFlags(action,dest,status){if(!action)return dest||status!==void 0?"--action is required when using --dest or --status. Use --action rewrite, --action redirect, or --action set-status.":null;if(!VALID_ACTION_TYPES.includes(action))return`Invalid action type: "${action}". Valid types: ${VALID_ACTION_TYPES.join(", ")}`;switch(action){case"rewrite":if(!dest)return"--action rewrite requires --dest.";if(status!==void 0)return"--action rewrite does not accept --status.";break;case"redirect":if(!dest)return"--action redirect requires --dest.";if(status===void 0)return`--action redirect requires --status (${REDIRECT_STATUS_CODES.join(", ")}).`;if(!REDIRECT_STATUS_CODES.includes(status))return`Invalid redirect status: ${status}. Must be one of: ${REDIRECT_STATUS_CODES.join(", ")}`;break;case"set-status":if(dest)return"--action set-status does not accept --dest.";if(status===void 0)return"--action set-status requires --status.";if(status<100||status>599)return"Status code must be between 100 and 599.";break}return null}async function collectActionDetails(client,actionType,flags){switch(actionType){case"rewrite":{let dest=await client.input.text({message:"Destination URL:",validate:val=>val?!0:"Destination is required"});Object.assign(flags,{"--dest":dest});break}case"redirect":{let dest=await client.input.text({message:"Destination URL:",validate:val=>val?!0:"Destination is required"}),status=await client.input.select({message:"Status code:",choices:[{name:"307 - Temporary Redirect",value:307},{name:"308 - Permanent Redirect",value:308},{name:"301 - Moved Permanently",value:301},{name:"302 - Found",value:302},{name:"303 - See Other",value:303}]});Object.assign(flags,{"--dest":dest,"--status":status});break}case"set-status":{let statusCode=await client.input.text({message:"HTTP status code:",validate:val=>{let num=parseInt(val,10);return isNaN(num)||num<100||num>599?"Status code must be between 100 and 599":!0}});Object.assign(flags,{"--status":parseInt(statusCode,10)});break}case"response-headers":{await collectInteractiveHeaders(client,"response",flags);break}case"request-headers":{await collectInteractiveHeaders(client,"request-header",flags);break}case"request-query":{await collectInteractiveHeaders(client,"request-query",flags);break}}}async function collectInteractiveConditions(client,flags){let addMore=!0;for(;addMore;){let currentHas=flags["--has"]||[],currentMissing=flags["--missing"]||[];if(currentHas.length>0||currentMissing.length>0){output_manager_default.log(`
|
|
8
|
+
Current conditions:`);for(let c of currentHas)output_manager_default.print(` has: ${c}
|
|
9
|
+
`);for(let c of currentMissing)output_manager_default.print(` does not have: ${c}
|
|
10
|
+
`);output_manager_default.print(`
|
|
11
|
+
`)}let conditionType=await client.input.select({message:"Condition type:",choices:[{name:"has - Request must have this",value:"has"},{name:"does not have - Request must NOT have this",value:"missing"}]}),targetType=await client.input.select({message:"What to check:",choices:[{name:"Header",value:"header"},{name:"Cookie",value:"cookie"},{name:"Query Parameter",value:"query"},{name:"Host",value:"host"}]}),conditionValue;if(targetType==="host"){let operator=await client.input.select({message:"How to match the host:",choices:[{name:"Equals",value:"eq"},{name:"Contains",value:"contains"},{name:"Matches (regex)",value:"re"}]}),hostInput=await client.input.text({message:operator==="re"?"Host pattern (regex):":"Host value:",validate:val=>{if(!val)return"Host value is required";if(operator==="re")try{return new RegExp(val),!0}catch{return"Invalid regex pattern"}return!0}});conditionValue=`host:${operator}=${hostInput}`}else{let key=await client.input.text({message:`${targetType.charAt(0).toUpperCase()+targetType.slice(1)} name:`,validate:val=>val?!0:`${targetType} name is required`}),operator=await client.input.select({message:"How to match the value:",choices:[{name:"Exists (any value)",value:"exists"},{name:"Equals",value:"eq"},{name:"Contains",value:"contains"},{name:"Matches (regex)",value:"re"}]});if(operator==="exists")conditionValue=`${targetType}:${key}:exists`;else{let valueInput=await client.input.text({message:operator==="re"?"Value pattern (regex):":"Value:",validate:val=>{if(!val)return"Value is required";if(operator==="re")try{return new RegExp(val),!0}catch{return"Invalid regex pattern"}return!0}});conditionValue=`${targetType}:${key}:${operator}=${valueInput}`}}let flagName=conditionType==="has"?"--has":"--missing",existing=flags[flagName]||[];if(flags[flagName]=[...existing,conditionValue],(flags["--has"]||[]).length+(flags["--missing"]||[]).length>=MAX_CONDITIONS){output_manager_default.warn(`Maximum ${MAX_CONDITIONS} conditions reached.`);break}addMore=await client.input.confirm("Add another condition?",!1)}}function formatCollectedItems(flags,type){let items=[],prefix=type==="response"?"response-header":type==="request-header"?"request-header":"request-query",setItems=flags[`--set-${prefix}`]||[],appendItems=flags[`--append-${prefix}`]||[],deleteItems=flags[`--delete-${prefix}`]||[];for(let item of setItems)items.push(` set: ${item}`);for(let item of appendItems)items.push(` append: ${item}`);for(let item of deleteItems)items.push(` delete: ${item}`);return items}async function collectInteractiveHeaders(client,type,flags){let flagName=type==="response"?"--set-response-header":type==="request-header"?"--set-request-header":"--set-request-query",sectionName=type==="response"?"Response Headers":type==="request-header"?"Request Headers":"Request Query Parameters",itemName=type==="response"?"response header":type==="request-header"?"request header":"query parameter";output_manager_default.log(`
|
|
12
|
+
--- ${sectionName} ---`);let addMore=!0;for(;addMore;){let collected=formatCollectedItems(flags,type);if(collected.length>0){output_manager_default.log(`
|
|
13
|
+
Current ${sectionName.toLowerCase()}:`);for(let item of collected)output_manager_default.print(`${item}
|
|
14
|
+
`);output_manager_default.print(`
|
|
15
|
+
`)}let op=await client.input.select({message:`${sectionName} operation:`,choices:[{name:"Set",value:"set"},{name:"Append",value:"append"},{name:"Delete",value:"delete"}]}),key=await client.input.text({message:`${itemName.charAt(0).toUpperCase()+itemName.slice(1)} name:`,validate:val=>val?!0:`${itemName} name is required`});if(op==="delete"){let opFlagName=flagName.replace("--set-","--delete-"),existing=flags[opFlagName]||[];flags[opFlagName]=[...existing,key]}else{let value=await client.input.text({message:`${itemName.charAt(0).toUpperCase()+itemName.slice(1)} value:`}),opFlagName=op==="append"?flagName.replace("--set-","--append-"):flagName,existing=flags[opFlagName]||[];flags[opFlagName]=[...existing,`${key}=${value}`]}addMore=await client.input.confirm(`Add another ${itemName}?`,!1)}}var import_chalk=__toESM(require_source(),1);var CONDITION_OPERATORS=["eq","contains","re","exists"];function escapeRegExp(str){return str.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function buildConditionValue(operator,value){if(operator==="exists")return;if(operator==="re")return value;let escapedValue=escapeRegExp(value);return operator==="contains"?`.*${escapedValue}.*`:`^${escapedValue}$`}function validateRegexPattern(pattern,context){try{new RegExp(pattern)}catch(e){throw new Error(`Invalid regex in ${context}: "${pattern}". ${e instanceof Error?e.message:""}`)}}function parseOperatorValue(valuePart){if(valuePart==="exists")return{operator:"exists",rawValue:""};let eqIdx=valuePart.indexOf("=");if(eqIdx===-1)return null;let maybeOp=valuePart.slice(0,eqIdx);return CONDITION_OPERATORS.includes(maybeOp)?{operator:maybeOp,rawValue:valuePart.slice(eqIdx+1)}:null}function parseConditions(conditions){return conditions.map(parseCondition)}function parseCondition(condition){let parts=condition.split(":");if(parts.length<2)throw new Error(`Invalid condition format: "${condition}". Expected format: type:key or type:key:value`);let type=parts[0].toLowerCase(),validTypes=["header","cookie","query","host"];if(!validTypes.includes(type))throw new Error(`Invalid condition type: "${type}". Valid types: ${validTypes.join(", ")}`);if(type==="host"){let rawValue=parts.slice(1).join(":");if(!rawValue)throw new Error("Host condition requires a value");let opResult2=parseOperatorValue(rawValue);if(opResult2){if(opResult2.operator==="exists")throw new Error('Host condition does not support "exists" operator (host always has a value)');if(opResult2.operator!=="re"&&!opResult2.rawValue)throw new Error(`Host condition with "${opResult2.operator}" operator requires a value`);let compiledValue=buildConditionValue(opResult2.operator,opResult2.rawValue);return compiledValue!==void 0&&validateRegexPattern(compiledValue,"host condition"),{type:"host",value:compiledValue}}return validateRegexPattern(rawValue,"host condition"),{type:"host",value:rawValue}}let key=parts[1];if(!key)throw new Error(`${type} condition requires a key`);let valuePart=parts.length>2?parts.slice(2).join(":"):void 0;if(valuePart===void 0)return{type,key};let opResult=parseOperatorValue(valuePart);if(opResult){if(opResult.operator==="exists")return{type,key};if(opResult.operator!=="re"&&!opResult.rawValue)throw new Error(`Condition "${opResult.operator}" operator requires a value after "="`);let compiledValue=buildConditionValue(opResult.operator,opResult.rawValue);return compiledValue!==void 0&&validateRegexPattern(compiledValue,`${type} condition value`),{type,key,...compiledValue!==void 0&&{value:compiledValue}}}return validateRegexPattern(valuePart,`${type} condition value`),{type,key,value:valuePart}}function formatCondition2(field){return field.type==="host"?`host:${field.value}`:field.value?`${field.type}:${field.key}:${field.value}`:`${field.type}:${field.key}`}function isTargetTransformType(transform,type){return transform.type===type&&isTargetTransform(transform)}function stringifyTransformArgs(args){return Array.isArray(args)?args.join(", "):args}function isPathTransform(transform){return transform.type==="request.path"}function generatedRouteToAddInput(generated){let hasConditions=[],missingConditions=[],headers={},transforms=[],dest,status;if(generated.conditions)for(let c of generated.conditions){let compiledValue=c.value!==void 0?buildConditionValue(c.operator,c.value):void 0,field=c.field==="host"?{type:"host",value:compiledValue??c.value??""}:{type:c.field,key:c.key??"",...compiledValue!==void 0&&{value:compiledValue}};c.missing?missingConditions.push(field):hasConditions.push(field)}for(let action of generated.actions)switch(action.type){case"rewrite":dest=action.dest;break;case"redirect":dest=action.dest,status=action.status;break;case"set-status":status=action.status;break;case"modify":{if(action.subType==="transform-request-path"){if(!action.requestPath)break;transforms.push({type:"request.path",op:action.requestPath.op,args:action.requestPath.value,...action.requestPath.env&&{env:action.requestPath.env}})}else if(action.subType==="response-headers"&&action.headers)for(let h of action.headers)h.op==="set"?headers[h.key]=h.value??"":transforms.push({type:"response.headers",op:h.op,target:{key:h.key},...h.op!=="delete"&&h.value&&{args:h.value}});else if(action.subType==="transform-request-header"&&action.headers)for(let h of action.headers)transforms.push({type:"request.headers",op:h.op,target:{key:h.key},...h.op!=="delete"&&h.value&&{args:h.value}});else if(action.subType==="transform-request-query"&&action.headers)for(let h of action.headers)transforms.push({type:"request.query",op:h.op,target:{key:h.key},...h.op!=="delete"&&h.value&&{args:h.value}});break}}return{name:generated.name,description:generated.description||void 0,srcSyntax:generated.pathCondition.syntax,route:{src:generated.pathCondition.value,...dest!==void 0&&{dest},...status!==void 0&&{status},...Object.keys(headers).length>0&&{headers},...transforms.length>0&&{transforms},...hasConditions.length>0&&{has:hasConditions},...missingConditions.length>0&&{missing:missingConditions}}}}function convertRouteToCurrentRoute(generated){return{name:generated.name,description:generated.description||void 0,pathCondition:generated.pathCondition,conditions:generated.conditions,actions:generated.actions}}function routingRuleToCurrentRoute(rule){let conditions=[],actions=[];if(rule.route.has)for(let c of rule.route.has)conditions.push({field:c.type,operator:c.value!==void 0?"re":"exists",key:c.key,value:c.value!==void 0?typeof c.value=="string"?c.value:JSON.stringify(c.value):void 0,missing:!1});if(rule.route.missing)for(let c of rule.route.missing)conditions.push({field:c.type,operator:c.value!==void 0?"re":"exists",key:c.key,value:c.value!==void 0?typeof c.value=="string"?c.value:JSON.stringify(c.value):void 0,missing:!0});rule.route.dest&&rule.route.status&&REDIRECT_STATUS_CODES.includes(rule.route.status)?actions.push({type:"redirect",dest:rule.route.dest,status:rule.route.status}):rule.route.dest?actions.push({type:"rewrite",dest:rule.route.dest}):rule.route.status&&actions.push({type:"set-status",status:rule.route.status});let responseHeaders=rule.route.headers?Object.entries(rule.route.headers).map(([key,value])=>({key,value,op:"set"})):[],allTransforms=rule.route.transforms??[],responseHeaderTransforms=allTransforms.filter(t=>isTargetTransformType(t,"response.headers")).map(t=>({key:typeof t.target.key=="string"?t.target.key:String(t.target.key),value:stringifyTransformArgs(t.args),op:t.op})),allResponseHeaders=[...responseHeaders,...responseHeaderTransforms];allResponseHeaders.length>0&&actions.push({type:"modify",subType:"response-headers",headers:allResponseHeaders});let requestHeaders=allTransforms.filter(t=>isTargetTransformType(t,"request.headers")).map(t=>({key:typeof t.target.key=="string"?t.target.key:String(t.target.key),value:stringifyTransformArgs(t.args),op:t.op}));requestHeaders.length>0&&actions.push({type:"modify",subType:"transform-request-header",headers:requestHeaders});let requestQuery=allTransforms.filter(t=>isTargetTransformType(t,"request.query")).map(t=>({key:typeof t.target.key=="string"?t.target.key:String(t.target.key),value:stringifyTransformArgs(t.args),op:t.op}));requestQuery.length>0&&actions.push({type:"modify",subType:"transform-request-query",headers:requestQuery});let requestPathTransforms=allTransforms.filter(isPathTransform);for(let requestPath of requestPathTransforms)actions.push({type:"modify",subType:"transform-request-path",requestPath:{value:requestPath.args,op:requestPath.op,...requestPath.env&&{env:requestPath.env}}});return{name:rule.name,description:rule.description,pathCondition:{value:rule.route.src,syntax:rule.srcSyntax??"regex"},...conditions.length>0&&{conditions},actions}}function printGeneratedRoutePreview(generated){if(output_manager_default.print(`
|
|
16
|
+
`),output_manager_default.print(` ${import_chalk.default.bold("Generated Route:")}
|
|
17
|
+
`),output_manager_default.print(` ${import_chalk.default.cyan("Name:")} ${generated.name}
|
|
18
|
+
`),generated.description&&output_manager_default.print(` ${import_chalk.default.cyan("Description:")} ${generated.description}
|
|
19
|
+
`),output_manager_default.print(` ${import_chalk.default.cyan("Source:")} ${generated.pathCondition.value}
|
|
20
|
+
`),generated.conditions&&generated.conditions.length>0){output_manager_default.print(` ${import_chalk.default.cyan("Conditions:")}
|
|
21
|
+
`);for(let c of generated.conditions){let prefix=c.missing?"does not have":"has",operatorLabel=c.operator==="eq"?"equal to":c.operator==="contains"?"containing":c.operator==="re"?"matching":"",key=c.key?` ${import_chalk.default.cyan(`"${c.key}"`)}`:"",value=c.operator==="exists"||!c.value?"":` ${operatorLabel} ${import_chalk.default.cyan(`"${c.value}"`)}`;output_manager_default.print(` ${import_chalk.default.gray(prefix)} ${c.field}${key}${value}
|
|
22
|
+
`)}}for(let action of generated.actions)action.type==="rewrite"&&action.dest?output_manager_default.print(` ${import_chalk.default.cyan("Action:")} Rewrite \u2192 ${action.dest}
|
|
23
|
+
`):action.type==="redirect"&&action.dest?output_manager_default.print(` ${import_chalk.default.cyan("Action:")} Redirect \u2192 ${action.dest} (${action.status})
|
|
24
|
+
`):action.type==="set-status"&&action.status&&output_manager_default.print(` ${import_chalk.default.cyan("Action:")} Set Status ${action.status}
|
|
25
|
+
`);for(let action of generated.actions)if(action.type==="modify"&&action.subType==="transform-request-path"&&action.requestPath){output_manager_default.print(` ${import_chalk.default.cyan("Request Path:")}
|
|
26
|
+
`);let env=action.requestPath.env?.length?import_chalk.default.gray(` (env: ${action.requestPath.env.join(", ")})`):"";output_manager_default.print(` ${import_chalk.default.yellow(action.requestPath.op)} ${import_chalk.default.cyan("path")} = ${action.requestPath.value}${env}
|
|
27
|
+
`)}else if(action.type==="modify"&&action.headers){let label=action.subType==="response-headers"?"Response Headers":action.subType==="transform-request-header"?"Request Headers":"Request Query";output_manager_default.print(` ${import_chalk.default.cyan(`${label}:`)}
|
|
28
|
+
`);for(let h of action.headers)h.op==="delete"?output_manager_default.print(` ${import_chalk.default.yellow(h.op)} ${import_chalk.default.cyan(h.key)}
|
|
29
|
+
`):output_manager_default.print(` ${import_chalk.default.yellow(h.op)} ${import_chalk.default.cyan(h.key)} = ${h.value}
|
|
30
|
+
`)}output_manager_default.print(`
|
|
31
|
+
`)}var import_chalk2=__toESM(require_source(),1);function getPrimaryActionType(route){let{dest,status}=route.route;return dest&&status&&REDIRECT_STATUS_CODES.includes(status)?"redirect":dest?"rewrite":status?"set-status":null}function getPrimaryActionLabel(route){switch(getPrimaryActionType(route)){case"rewrite":return`Rewrite \u2192 ${route.route.dest}`;case"redirect":return`Redirect \u2192 ${route.route.dest} (${route.route.status})`;case"set-status":return`Set Status ${route.route.status}`;default:return"(none)"}}function getResponseHeaders(route){let headers=route.route.headers??{};return Object.entries(headers).map(([key,value])=>({key,value}))}function getTransformsByType(route,type){return(route.route.transforms??[]).filter(t=>t.type===type)}function printRouteConfig(route){output_manager_default.print(`
|
|
32
|
+
`),output_manager_default.print(` ${import_chalk2.default.cyan("Name:")} ${route.name}
|
|
33
|
+
`),route.description&&output_manager_default.print(` ${import_chalk2.default.cyan("Description:")} ${route.description}
|
|
34
|
+
`),output_manager_default.print(` ${import_chalk2.default.cyan("Source:")} ${route.route.src} ${import_chalk2.default.gray(`(${route.srcSyntax??"regex"})`)}
|
|
35
|
+
`),output_manager_default.print(` ${import_chalk2.default.cyan("Status:")} ${route.enabled===!1?import_chalk2.default.red("Disabled"):import_chalk2.default.green("Enabled")}
|
|
36
|
+
`);let actionLabel=getPrimaryActionLabel(route);output_manager_default.print(` ${import_chalk2.default.cyan("Action:")} ${actionLabel}
|
|
37
|
+
`);let hasConds=route.route.has??[];if(hasConds.length>0){output_manager_default.print(`
|
|
38
|
+
${import_chalk2.default.cyan("Has conditions:")}
|
|
39
|
+
`);for(let c of hasConds)output_manager_default.print(` ${formatCondition(c)}
|
|
40
|
+
`)}let missingConds=route.route.missing??[];if(missingConds.length>0){output_manager_default.print(`
|
|
41
|
+
${import_chalk2.default.cyan("Does not have conditions:")}
|
|
42
|
+
`);for(let c of missingConds)output_manager_default.print(` ${formatCondition(c)}
|
|
43
|
+
`)}let responseHeaders=getResponseHeaders(route);if(responseHeaders.length>0){output_manager_default.print(`
|
|
44
|
+
${import_chalk2.default.cyan("Response Headers:")}
|
|
45
|
+
`);for(let h of responseHeaders)output_manager_default.print(` ${import_chalk2.default.cyan(h.key)} = ${h.value}
|
|
46
|
+
`)}let requestHeaders=getTransformsByType(route,"request.headers");if(requestHeaders.length>0){output_manager_default.print(`
|
|
47
|
+
${import_chalk2.default.cyan("Request Headers:")}
|
|
48
|
+
`);for(let t of requestHeaders)output_manager_default.print(` ${formatTransform(t)}
|
|
49
|
+
`)}let requestQuery=getTransformsByType(route,"request.query");if(requestQuery.length>0){output_manager_default.print(`
|
|
50
|
+
${import_chalk2.default.cyan("Request Query:")}
|
|
51
|
+
`);for(let t of requestQuery)output_manager_default.print(` ${formatTransform(t)}
|
|
52
|
+
`)}let requestPaths=getTransformsByType(route,"request.path");if(requestPaths.length>0){output_manager_default.print(`
|
|
53
|
+
${import_chalk2.default.cyan("Request Path:")}
|
|
54
|
+
`);for(let transform of requestPaths){let env=transform.env?.length?import_chalk2.default.gray(` (env: ${transform.env.join(", ")})`):"";output_manager_default.print(` ${formatTransform(transform)}${env}
|
|
55
|
+
`)}}output_manager_default.print(`
|
|
56
|
+
`)}function cloneRoute(route){return JSON.parse(JSON.stringify(route))}function applyFlagMutations(route,flags){if(flags["--name"]!==void 0){let name=flags["--name"];if(name.length>MAX_NAME_LENGTH)return`Name must be ${MAX_NAME_LENGTH} characters or less.`;route.name=name}if(flags["--description"]!==void 0){let desc=flags["--description"];if(desc.length>MAX_DESCRIPTION_LENGTH)return`Description must be ${MAX_DESCRIPTION_LENGTH} characters or less.`;route.description=desc||void 0}if(flags["--src"]!==void 0&&(route.route.src=stripQuotes(flags["--src"])),flags["--src-syntax"]!==void 0){let syntax=flags["--src-syntax"];if(!VALID_SYNTAXES.includes(syntax))return`Invalid syntax: "${syntax}". Valid options: ${VALID_SYNTAXES.join(", ")}`;route.srcSyntax=syntax}let actionFlag=flags["--action"],destFlag=flags["--dest"],statusFlag=flags["--status"],noDest=flags["--no-dest"],noStatus=flags["--no-status"];if(actionFlag){if(!VALID_ACTION_TYPES.includes(actionFlag))return`Invalid action type: "${actionFlag}". Valid types: ${VALID_ACTION_TYPES.join(", ")}`;switch(actionFlag){case"rewrite":{let dest=destFlag?stripQuotes(destFlag):void 0;if(!dest)return"--action rewrite requires --dest.";route.route.dest=dest,delete route.route.status;break}case"redirect":{let dest=destFlag?stripQuotes(destFlag):void 0;if(!dest)return"--action redirect requires --dest.";if(statusFlag===void 0)return`--action redirect requires --status (${REDIRECT_STATUS_CODES.join(", ")}).`;if(!REDIRECT_STATUS_CODES.includes(statusFlag))return`Invalid redirect status: ${statusFlag}. Must be one of: ${REDIRECT_STATUS_CODES.join(", ")}`;route.route.dest=dest,route.route.status=statusFlag;break}case"set-status":{if(statusFlag===void 0)return"--action set-status requires --status.";if(statusFlag<100||statusFlag>599)return"Status code must be between 100 and 599.";delete route.route.dest,route.route.status=statusFlag;break}}}else destFlag!==void 0&&(route.route.dest=stripQuotes(destFlag)),statusFlag!==void 0&&(route.route.status=statusFlag),noDest&&delete route.route.dest,noStatus&&delete route.route.status;flags["--clear-conditions"]&&(route.route.has=[],route.route.missing=[]),flags["--clear-headers"]&&(route.route.headers={}),flags["--clear-transforms"]&&(route.route.transforms=[]);let transformFlags=extractTransformFlags(flags);try{let{headers,transforms}=collectHeadersAndTransforms(transformFlags);if(Object.keys(headers).length>0&&(route.route.headers={...route.route.headers??{},...headers}),transforms.length>0){let existing=route.route.transforms??[];route.route.transforms=[...existing,...transforms]}}catch(e){return`Invalid transform format. ${e instanceof Error?e.message:""}`}let hasFlags=flags["--has"],missingFlags=flags["--missing"];try{if(hasFlags){let newHas=parseConditions(hasFlags),existingHas=route.route.has??[];route.route.has=[...existingHas,...newHas]}if(missingFlags){let newMissing=parseConditions(missingFlags),existingMissing=route.route.missing??[];route.route.missing=[...existingMissing,...newMissing]}}catch(e){return e instanceof Error?e.message:"Invalid condition format"}let totalConditions=(route.route.has??[]).length+(route.route.missing??[]).length;if(totalConditions>MAX_CONDITIONS)return`Too many conditions: ${totalConditions}. Maximum is ${MAX_CONDITIONS}.`;let hasDest=!!route.route.dest,hasStatus=!!route.route.status,hasHeaders=Object.keys(route.route.headers??{}).length>0,hasTransforms=(route.route.transforms??[]).length>0;return!hasDest&&!hasStatus&&!hasHeaders&&!hasTransforms?"This edit would leave the route with no action. Add --action, headers, or transforms.":null}async function runInteractiveEditLoop(client,route){for(;;){let hasConds=(route.route.has??[]).length,missingConds=(route.route.missing??[]).length,responseHeaders=getAllResponseHeaders(route).length,requestHeaders=getTransformsByType(route,"request.headers").length,requestQuery=getTransformsByType(route,"request.query").length,requestPaths=getTransformsByType(route,"request.path").length,syntaxLabel=route.srcSyntax==="path-to-regexp"?"Pattern":route.srcSyntax==="equals"?"Exact":"Regex",descriptionPreview=route.description?route.description.length>40?route.description.slice(0,40)+"...":route.description:"",editChoices=[{name:`Name (${route.name})`,value:"name"},{name:descriptionPreview?`Description (${descriptionPreview})`:"Description",value:"description"},{name:`Source (${syntaxLabel}: ${route.route.src})`,value:"source"},{name:`Primary action (${getPrimaryActionLabel(route)})`,value:"action"},{name:`Conditions (${hasConds} has, ${missingConds} missing)`,value:"conditions"},{name:`Response Headers (${responseHeaders})`,value:"response-headers"},{name:`Request Headers (${requestHeaders})`,value:"request-headers"},{name:`Request Query (${requestQuery})`,value:"request-query"},{name:`Request Path (${requestPaths})`,value:"request-path"},{name:"Done - save changes",value:"done"}],choice=await client.input.select({message:"What would you like to edit?",choices:editChoices,pageSize:editChoices.length,loop:!1});switch(choice){case"name":await editName(client,route);break;case"description":await editDescription(client,route);break;case"source":await editSource(client,route);break;case"action":await editPrimaryAction(client,route);break;case"conditions":await editConditions(client,route);break;case"response-headers":await editResponseHeaders(client,route);break;case"request-headers":await editTransformsByType(client,route,"request.headers","request-header");break;case"request-query":await editTransformsByType(client,route,"request.query","request-query");break;case"request-path":await editRequestPaths(client,route);break;case"done":break}if(choice==="done"){let hasDest=!!route.route.dest,hasStatus=!!route.route.status,hasHeaders=Object.keys(route.route.headers??{}).length>0,hasTransforms=(route.route.transforms??[]).length>0;if(!hasDest&&!hasStatus&&!hasHeaders&&!hasTransforms){output_manager_default.warn("Route has no action (no destination, status, or headers). Add an action before saving.");continue}break}}}async function editName(client,route){let name=await client.input.text({message:`Name (current: ${route.name}):`,validate:val=>val?val.length>MAX_NAME_LENGTH?`Name must be ${MAX_NAME_LENGTH} characters or less`:!0:"Route name is required"});route.name=name}async function editDescription(client,route){let desc=await client.input.text({message:`Description${route.description?` (current: ${route.description})`:""}:`,validate:val=>val&&val.length>MAX_DESCRIPTION_LENGTH?`Description must be ${MAX_DESCRIPTION_LENGTH} characters or less`:!0});route.description=desc||void 0}async function editSource(client,route){let syntaxChoice=await client.input.select({message:`Path syntax (current: ${route.srcSyntax??"regex"}):`,choices:[{name:"Path pattern (e.g., /api/:version/users/:id)",value:"path-to-regexp"},{name:"Exact match (e.g., /about)",value:"equals"},{name:"Regular expression (e.g., ^/api/(.*)$)",value:"regex"}]});route.srcSyntax=syntaxChoice;let src=await client.input.text({message:`Path pattern (current: ${route.route.src}):`,validate:val=>val?!0:"Path pattern is required"});route.route.src=src}async function editPrimaryAction(client,route){let currentType=getPrimaryActionType(route),choices=[];(currentType==="rewrite"||currentType==="redirect")&&choices.push({name:"Change destination",value:"change-dest"}),(currentType==="redirect"||currentType==="set-status")&&choices.push({name:"Change status code",value:"change-status"}),currentType!=="rewrite"&&choices.push({name:"Switch to Rewrite",value:"switch-rewrite"}),currentType!=="redirect"&&choices.push({name:"Switch to Redirect",value:"switch-redirect"}),currentType!=="set-status"&&choices.push({name:"Switch to Set Status Code",value:"switch-set-status"}),currentType?choices.push({name:"Remove primary action",value:"remove"}):(choices.push({name:"Add Rewrite",value:"switch-rewrite"}),choices.push({name:"Add Redirect",value:"switch-redirect"}),choices.push({name:"Add Set Status Code",value:"switch-set-status"})),choices.push({name:"Back",value:"back"});let action=await client.input.select({message:`Primary action (current: ${getPrimaryActionLabel(route)}):`,choices}),flags={};switch(action){case"change-dest":{let dest=await client.input.text({message:`Destination (current: ${route.route.dest}):`,validate:val=>val?!0:"Destination is required"});route.route.dest=dest;break}case"change-status":{if(currentType==="redirect"){let status=await client.input.select({message:`Status code (current: ${route.route.status}):`,choices:[{name:"307 - Temporary Redirect",value:307},{name:"308 - Permanent Redirect",value:308},{name:"301 - Moved Permanently",value:301},{name:"302 - Found",value:302},{name:"303 - See Other",value:303}]});route.route.status=status}else{let statusCode=await client.input.text({message:`Status code (current: ${route.route.status}):`,validate:val=>{let num=parseInt(val,10);return isNaN(num)||num<100||num>599?"Status code must be between 100 and 599":!0}});route.route.status=parseInt(statusCode,10)}break}case"switch-rewrite":{await collectActionDetails(client,"rewrite",flags),route.route.dest=flags["--dest"],delete route.route.status;break}case"switch-redirect":{await collectActionDetails(client,"redirect",flags),route.route.dest=flags["--dest"],route.route.status=flags["--status"];break}case"switch-set-status":{await collectActionDetails(client,"set-status",flags),delete route.route.dest,route.route.status=flags["--status"];break}case"remove":{delete route.route.dest,delete route.route.status;break}}}async function editConditions(client,route){for(;;){let hasConds=route.route.has??[],missingConds=route.route.missing??[];hasConds.length>0||missingConds.length>0?(output_manager_default.print(`
|
|
57
|
+
`),hasConds.length>0&&(output_manager_default.print(` ${import_chalk2.default.cyan("Has conditions:")}
|
|
58
|
+
`),hasConds.forEach((c,i)=>{output_manager_default.print(` ${import_chalk2.default.gray(`${i+1}.`)} ${formatCondition(c)}
|
|
59
|
+
`)})),missingConds.length>0&&(output_manager_default.print(` ${import_chalk2.default.cyan("Does not have conditions:")}
|
|
60
|
+
`),missingConds.forEach((c,i)=>{output_manager_default.print(` ${import_chalk2.default.gray(`${hasConds.length+i+1}.`)} ${formatCondition(c)}
|
|
61
|
+
`)})),output_manager_default.print(`
|
|
62
|
+
`)):output_manager_default.print(`
|
|
63
|
+
No conditions set.
|
|
64
|
+
|
|
65
|
+
`);let choices=[];(hasConds.length>0||missingConds.length>0)&&choices.push({name:"Remove a condition",value:"remove"}),choices.push({name:"Add a new condition",value:"add"}),choices.push({name:"Back",value:"back"});let action=await client.input.select({message:"Conditions:",choices});if(action==="back")break;if(action==="remove"){let allConds=[...hasConds.map((c,i)=>({label:`[has] ${formatCondition(c)}`,idx:i,kind:"has"})),...missingConds.map((c,i)=>({label:`[does not have] ${formatCondition(c)}`,idx:i,kind:"missing"}))],toRemove=await client.input.select({message:"Select condition to remove:",choices:[...allConds.map((c,i)=>({name:c.label,value:i})),{name:"Cancel",value:-1}]});if(toRemove!==-1){let selected=allConds[toRemove];selected.kind==="has"?(hasConds.splice(selected.idx,1),route.route.has=hasConds):(missingConds.splice(selected.idx,1),route.route.missing=missingConds)}}if(action==="add"){let existingHasStrings=hasConds.map(c=>formatCondition2(c)),existingMissingStrings=missingConds.map(c=>formatCondition2(c)),tempFlags={"--has":existingHasStrings.length>0?existingHasStrings:void 0,"--missing":existingMissingStrings.length>0?existingMissingStrings:void 0},hasBefore=existingHasStrings.length,missingBefore=existingMissingStrings.length;await collectInteractiveConditions(client,tempFlags);let allHas=tempFlags["--has"]||[],allMissing=tempFlags["--missing"]||[],newHas=allHas.slice(hasBefore),newMissing=allMissing.slice(missingBefore);if(newHas.length>0){let parsed=parseConditions(newHas),existing=route.route.has??[];route.route.has=[...existing,...parsed]}if(newMissing.length>0){let parsed=parseConditions(newMissing),existing=route.route.missing??[];route.route.missing=[...existing,...parsed]}break}}}function getAllResponseHeaders(route){let items=[];for(let[key,value]of Object.entries(route.route.headers??{}))items.push({op:"set",key,value,source:"headers"});let transforms=route.route.transforms??[];for(let t of transforms)t.type==="response.headers"&&items.push({op:t.op,key:typeof t.target.key=="string"?t.target.key:JSON.stringify(t.target.key),value:typeof t.args=="string"?t.args:void 0,source:"transform"});return items}function formatResponseHeaderItem(item){return item.op==="delete"?`${import_chalk2.default.yellow(item.op)} ${import_chalk2.default.cyan(item.key)}`:`${import_chalk2.default.yellow(item.op)} ${import_chalk2.default.cyan(item.key)} = ${item.value}`}async function editResponseHeaders(client,route){for(;;){let allHeaders=getAllResponseHeaders(route);allHeaders.length>0?(output_manager_default.print(`
|
|
66
|
+
`),output_manager_default.print(` ${import_chalk2.default.cyan("Response Headers:")}
|
|
67
|
+
`),allHeaders.forEach((h,i)=>{output_manager_default.print(` ${import_chalk2.default.gray(`${i+1}.`)} ${formatResponseHeaderItem(h)}
|
|
68
|
+
`)}),output_manager_default.print(`
|
|
69
|
+
`)):output_manager_default.print(`
|
|
70
|
+
No response headers set.
|
|
71
|
+
|
|
72
|
+
`);let choices=[];allHeaders.length>0&&choices.push({name:"Remove a response header",value:"remove"}),choices.push({name:"Add a response header",value:"add"}),choices.push({name:"Back",value:"back"});let action=await client.input.select({message:"Response Headers:",choices});if(action==="back")break;if(action==="remove"){let toRemove=await client.input.select({message:"Select response header to remove:",choices:[...allHeaders.map((h,i)=>({name:h.op==="delete"?`${h.op} ${h.key}`:`${h.op} ${h.key} = ${h.value}`,value:i})),{name:"Cancel",value:-1}]});if(toRemove!==-1){let item=allHeaders[toRemove];if(item.source==="headers"){let currentHeaders={...route.route.headers??{}};delete currentHeaders[item.key],route.route.headers=currentHeaders}else{let transforms=route.route.transforms??[],idx=transforms.findIndex(t=>t.type==="response.headers"&&t.op===item.op&&(typeof t.target.key=="string"?t.target.key:JSON.stringify(t.target.key))===item.key);idx!==-1&&(transforms.splice(idx,1),route.route.transforms=transforms)}}}if(action==="add"){let tempFlags={};await collectInteractiveHeaders(client,"response",tempFlags);let setHeaders=tempFlags["--set-response-header"]||[];for(let h of setHeaders){let eqIdx=h.indexOf("=");if(eqIdx!==-1){let key=h.slice(0,eqIdx).trim(),value=h.slice(eqIdx+1);route.route.headers={...route.route.headers??{},[key]:value}}}let appendHeaders=tempFlags["--append-response-header"]||[],deleteHeaders=tempFlags["--delete-response-header"]||[],existing=route.route.transforms??[],newTransforms=[];for(let h of appendHeaders){let eqIdx=h.indexOf("=");eqIdx!==-1&&newTransforms.push({type:"response.headers",op:"append",target:{key:h.slice(0,eqIdx).trim()},args:h.slice(eqIdx+1)})}for(let key of deleteHeaders)newTransforms.push({type:"response.headers",op:"delete",target:{key:key.trim()}});newTransforms.length>0&&(route.route.transforms=[...existing,...newTransforms]);break}}}async function editTransformsByType(client,route,transformType,headerType){let label=transformType==="request.headers"?"Request Headers":"Request Query",itemName=transformType==="request.headers"?"request header":"query parameter";for(;;){let allTransforms=route.route.transforms??[],matching=allTransforms.filter(t=>t.type===transformType);matching.length>0?(output_manager_default.print(`
|
|
73
|
+
`),output_manager_default.print(` ${import_chalk2.default.cyan(`${label}:`)}
|
|
74
|
+
`),matching.forEach((t,i)=>{output_manager_default.print(` ${import_chalk2.default.gray(`${i+1}.`)} ${formatTransform(t)}
|
|
75
|
+
`)}),output_manager_default.print(`
|
|
76
|
+
`)):output_manager_default.print(`
|
|
77
|
+
No ${label.toLowerCase()} set.
|
|
78
|
+
|
|
79
|
+
`);let choices=[];matching.length>0&&choices.push({name:`Remove a ${itemName}`,value:"remove"}),choices.push({name:`Add a ${itemName}`,value:"add"}),choices.push({name:"Back",value:"back"});let action=await client.input.select({message:`${label}:`,choices});if(action==="back")break;if(action==="remove"){let toRemove=await client.input.select({message:`Select ${itemName} to remove:`,choices:[...matching.map((t,i)=>({name:formatTransform(t),value:i})),{name:"Cancel",value:-1}]});if(toRemove!==-1){let matchIdx=0,removeIdx=allTransforms.findIndex(t=>{if(t.type===transformType){if(matchIdx===toRemove)return!0;matchIdx++}return!1});removeIdx!==-1&&(allTransforms.splice(removeIdx,1),route.route.transforms=allTransforms)}}if(action==="add"){let tempFlags={};await collectInteractiveHeaders(client,headerType,tempFlags);let tfFlags=extractTransformFlags(tempFlags),{transforms}=collectHeadersAndTransforms(tfFlags);transforms.length>0&&(route.route.transforms=[...allTransforms,...transforms]);break}}}async function editRequestPaths(client,route){for(;;){let allTransforms=route.route.transforms??[],matching=allTransforms.filter(transform=>transform.type==="request.path");matching.length>0?(output_manager_default.print(`
|
|
80
|
+
${import_chalk2.default.cyan("Request Path:")}
|
|
81
|
+
`),matching.forEach((transform,index)=>{let env=transform.env?.length?import_chalk2.default.gray(` (env: ${transform.env.join(", ")})`):"";output_manager_default.print(` ${import_chalk2.default.gray(`${index+1}.`)} ${formatTransform(transform)}${env}
|
|
82
|
+
`)}),output_manager_default.print(`
|
|
83
|
+
`)):output_manager_default.print(`
|
|
84
|
+
No request path transforms set.
|
|
85
|
+
|
|
86
|
+
`);let choices=[];matching.length>0&&choices.push({name:"Remove a request path transform",value:"remove"}),choices.push({name:"Add a request path transform",value:"add"}),choices.push({name:"Back",value:"back"});let action=await client.input.select({message:"Request Path:",choices});if(action==="back")break;if(action==="remove"){let toRemove=await client.input.select({message:"Select request path transform to remove:",choices:[...matching.map((transform,index)=>({name:formatTransform(transform),value:index})),{name:"Cancel",value:-1}]});if(toRemove!==-1){let matchIndex=0,removeIndex=allTransforms.findIndex(transform=>{if(transform.type==="request.path"){if(matchIndex===toRemove)return!0;matchIndex++}return!1});removeIndex!==-1&&(allTransforms.splice(removeIndex,1),route.route.transforms=allTransforms)}}if(action==="add"){let example=route.srcSyntax==="path-to-regexp"?"/:path*":route.srcSyntax==="regex"?"/$1":"/internal",args=await client.input.text({message:`Runtime-visible request path (e.g., ${example}):`,validate:value=>!value.startsWith("/")||value.startsWith("//")?"Request path must be an origin-form path starting with a single `/`":/[?#\s\x00-\x1f\x7f]/.test(value)?"Request path cannot contain a query, fragment, whitespace, or control characters":!0});route.route.transforms=[...allTransforms,{type:"request.path",op:"set",args}];break}}}export{parseConditions,populateRouteEnv,generateRoute,MAX_NAME_LENGTH,MAX_DESCRIPTION_LENGTH,MAX_CONDITIONS,VALID_SYNTAXES,REDIRECT_STATUS_CODES,ALL_ACTION_CHOICES,stripQuotes,extractTransformFlags,collectHeadersAndTransforms,hasAnyTransformFlags,validateActionFlags,collectActionDetails,collectInteractiveConditions,generatedRouteToAddInput,convertRouteToCurrentRoute,routingRuleToCurrentRoute,printGeneratedRoutePreview,printRouteConfig,cloneRoute,applyFlagMutations,runInteractiveEditLoop};
|
|
@@ -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-6L236MNA.js";var require_deque=__commonJS({"../../node_modules/.pnpm/double-ended-queue@2.1.0-0/node_modules/double-ended-queue/js/deque.js"(exports,module){"use strict";function Deque(capacity){if(this._capacity=getCapacity(capacity),this._length=0,this._front=0,isArray(capacity)){for(var len=capacity.length,i=0;i<len;++i)this[i]=capacity[i];this._length=len}}Deque.prototype.toArray=function(){for(var len=this._length,ret=new Array(len),front=this._front,capacity=this._capacity,j=0;j<len;++j)ret[j]=this[front+j&capacity-1];return ret};Deque.prototype.push=function(item){var argsLength=arguments.length,length=this._length;if(argsLength>1){var capacity=this._capacity;if(length+argsLength>capacity){for(var i=0;i<argsLength;++i){this._checkCapacity(length+1);var j=this._front+length&this._capacity-1;this[j]=arguments[i],length++,this._length=length}return length}else{for(var j=this._front,i=0;i<argsLength;++i)this[j+length&capacity-1]=arguments[i],j++;return this._length=length+argsLength,length+argsLength}}if(argsLength===0)return length;this._checkCapacity(length+1);var i=this._front+length&this._capacity-1;return this[i]=item,this._length=length+1,length+1};Deque.prototype.pop=function(){var length=this._length;if(length!==0){var i=this._front+length-1&this._capacity-1,ret=this[i];return this[i]=void 0,this._length=length-1,ret}};Deque.prototype.shift=function(){var length=this._length;if(length!==0){var front=this._front,ret=this[front];return this[front]=void 0,this._front=front+1&this._capacity-1,this._length=length-1,ret}};Deque.prototype.unshift=function(item){var length=this._length,argsLength=arguments.length;if(argsLength>1){var capacity=this._capacity;if(length+argsLength>capacity){for(var i=argsLength-1;i>=0;i--){this._checkCapacity(length+1);var capacity=this._capacity,j=(this._front-1&capacity-1^capacity)-capacity;this[j]=arguments[i],length++,this._length=length,this._front=j}return length}else{for(var front=this._front,i=argsLength-1;i>=0;i--){var j=(front-1&capacity-1^capacity)-capacity;this[j]=arguments[i],front=j}return this._front=front,this._length=length+argsLength,length+argsLength}}if(argsLength===0)return length;this._checkCapacity(length+1);var capacity=this._capacity,i=(this._front-1&capacity-1^capacity)-capacity;return this[i]=item,this._length=length+1,this._front=i,length+1};Deque.prototype.peekBack=function(){var length=this._length;if(length!==0){var index=this._front+length-1&this._capacity-1;return this[index]}};Deque.prototype.peekFront=function(){if(this._length!==0)return this[this._front]};Deque.prototype.get=function(index){var i=index;if(i===(i|0)){var len=this._length;if(i<0&&(i=i+len),!(i<0||i>=len))return this[this._front+i&this._capacity-1]}};Deque.prototype.isEmpty=function(){return this._length===0};Deque.prototype.clear=function(){for(var len=this._length,front=this._front,capacity=this._capacity,j=0;j<len;++j)this[front+j&capacity-1]=void 0;this._length=0,this._front=0};Deque.prototype.toString=function(){return this.toArray().toString()};Deque.prototype.valueOf=Deque.prototype.toString;Deque.prototype.removeFront=Deque.prototype.shift;Deque.prototype.removeBack=Deque.prototype.pop;Deque.prototype.insertFront=Deque.prototype.unshift;Deque.prototype.insertBack=Deque.prototype.push;Deque.prototype.enqueue=Deque.prototype.push;Deque.prototype.dequeue=Deque.prototype.shift;Deque.prototype.toJSON=Deque.prototype.toArray;Object.defineProperty(Deque.prototype,"length",{get:function(){return this._length},set:function(){throw new RangeError("")}});Deque.prototype._checkCapacity=function(size){this._capacity<size&&this._resizeTo(getCapacity(this._capacity*1.5+16))};Deque.prototype._resizeTo=function(capacity){var oldCapacity=this._capacity;this._capacity=capacity;var front=this._front,length=this._length;if(front+length>oldCapacity){var moveItemsCount=front+length&oldCapacity-1;arrayMove(this,0,this,oldCapacity,moveItemsCount)}};var isArray=Array.isArray;function arrayMove(src,srcIndex,dst,dstIndex,len){for(var j=0;j<len;++j)dst[j+dstIndex]=src[j+srcIndex],src[j+srcIndex]=void 0}function pow2AtLeast(n){return n=n>>>0,n=n-1,n=n|n>>1,n=n|n>>2,n=n|n>>4,n=n|n>>8,n=n|n>>16,n+1}function getCapacity(capacity){if(typeof capacity!="number")if(isArray(capacity))capacity=capacity.length;else return 16;return pow2AtLeast(Math.min(Math.max(16,capacity),1073741824))}module.exports=Deque}});var require_async_sema=__commonJS({"../../node_modules/.pnpm/async-sema@2.1.4/node_modules/async-sema/index.js"(exports,module){var EventEmitter=__require("events"),util=__require("util"),Deque=require_deque(),ReleaseEmitter=class extends EventEmitter{};function isFn(x){return typeof x=="function"}function defaultInit(){return"1"}var Sema=class{constructor(nr,{initFn=defaultInit,pauseFn,resumeFn,capacity=10}={}){if(isFn(pauseFn)^isFn(resumeFn))throw new Error("pauseFn and resumeFn must be both set for pausing");this.nrTokens=nr,this.free=new Deque(nr),this.waiting=new Deque(capacity),this.releaseEmitter=new ReleaseEmitter,this.noTokens=initFn===defaultInit,this.pauseFn=pauseFn,this.resumeFn=resumeFn,this.releaseEmitter.on("release",token=>{let p=this.waiting.shift();p?p.resolve(token):(this.resumeFn&&this.paused&&(this.paused=!1,this.resumeFn()),this.free.push(token))});for(let i=0;i<nr;i++)this.free.push(initFn())}async acquire(){let token=this.free.pop();return token||new Promise((resolve,reject)=>{this.pauseFn&&!this.paused&&(this.paused=!0,this.pauseFn()),this.waiting.push({resolve,reject})})}async v(){return this.acquire()}release(token){this.releaseEmitter.emit("release",this.noTokens?"1":token)}p(token){return this.release(token)}drain(){let a=new Array(this.nrTokens);for(let i=0;i<this.nrTokens;i++)a[i]=this.acquire();return Promise.all(a)}nrWaiting(){return this.waiting.length}};Sema.prototype.v=util.deprecate(Sema.prototype.v,"`v()` is deperecated; use `acquire()` instead");Sema.prototype.p=util.deprecate(Sema.prototype.p,"`p()` is deprecated; use `release()` instead");module.exports=Sema}});function parseTeamRefs(args){let refs=[];for(let arg of args)for(let piece of arg.split(",")){let ref=piece.trim();ref&&!refs.includes(ref)&&refs.push(ref)}return refs}function teamRefBody(ref){return ref.startsWith("team_")?{teamId:ref}:{teamSlug:ref}}export{require_async_sema,parseTeamRefs,teamRefBody};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{require_lib}from"./chunk-VLZ47RWM.js";import{humanizePath}from"./chunk-PPCFQQSU.js";import{output_manager_default}from"./chunk-Z6Y55QJW.js";import{require_source}from"./chunk-U7KCDTCH.js";import{__toESM}from"./chunk-6L236MNA.js";var import_fs_extra=__toESM(require_lib(),1),import_chalk=__toESM(require_source(),1);import{homedir}from"os";import{resolve,sep}from"path";async function validateRootDirectory(cwd,path,errorSuffix=""){let pathStat=await(0,import_fs_extra.lstat)(path).catch(()=>null),suffix=errorSuffix?` ${errorSuffix}`:"";if(!pathStat)return output_manager_default.error(`The provided path ${import_chalk.default.cyan(`\u201C${humanizePath(path)}\u201D`)} does not exist.${suffix}`),!1;if(!pathStat.isDirectory())return output_manager_default.error(`The provided path ${import_chalk.default.cyan(`\u201C${humanizePath(path)}\u201D`)} is a file, but expected a directory.${suffix}`),!1;let base=resolve(cwd),target=resolve(path);return target!==base&&!target.startsWith(base+sep)?(output_manager_default.error(`The provided path ${import_chalk.default.cyan(`\u201C${humanizePath(path)}\u201D`)} is outside of the project.${suffix}`),!1):!0}async function validatePaths(client,paths){if(paths.length>1)return output_manager_default.error("Can't deploy more than one path."),{valid:!1,exitCode:1};let path=paths[0],pathStat=await(0,import_fs_extra.lstat)(path).catch(()=>null);return pathStat?pathStat.isDirectory()?path===homedir()&&!await client.input.confirm("You are deploying your home directory. Do you want to continue?",!1)?(output_manager_default.print(`Canceled
|
|
8
|
+
`),{valid:!1,exitCode:0}):{valid:!0,path}:(output_manager_default.prettyError({message:"Support for single file deployments has been removed.",link:"https://vercel.link/no-single-file-deployments"}),{valid:!1,exitCode:1}):(output_manager_default.error(`Could not find ${import_chalk.default.cyan(`\u201C${humanizePath(path)}\u201D`)}`),{valid:!1,exitCode:1})}export{validateRootDirectory,validatePaths};
|
|
@@ -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-6L236MNA.js";var require_wrappy=__commonJS({"../../node_modules/.pnpm/wrappy@1.0.2/node_modules/wrappy/wrappy.js"(exports,module){module.exports=wrappy;function wrappy(fn,cb){if(fn&&cb)return wrappy(fn)(cb);if(typeof fn!="function")throw new TypeError("need wrapper function");return Object.keys(fn).forEach(function(k){wrapper[k]=fn[k]}),wrapper;function wrapper(){for(var args=new Array(arguments.length),i=0;i<args.length;i++)args[i]=arguments[i];var ret=fn.apply(this,args),cb2=args[args.length-1];return typeof ret=="function"&&ret!==cb2&&Object.keys(cb2).forEach(function(k){ret[k]=cb2[k]}),ret}}}});var require_once=__commonJS({"../../node_modules/.pnpm/once@1.4.0/node_modules/once/once.js"(exports,module){var wrappy=require_wrappy();module.exports=wrappy(once);module.exports.strict=wrappy(onceStrict);once.proto=once(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return once(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return onceStrict(this)},configurable:!0})});function once(fn){var f=function(){return f.called?f.value:(f.called=!0,f.value=fn.apply(this,arguments))};return f.called=!1,f}function onceStrict(fn){var f=function(){if(f.called)throw new Error(f.onceError);return f.called=!0,f.value=fn.apply(this,arguments)},name=fn.name||"Function wrapped with `once`";return f.onceError=name+" shouldn't be called more than once",f.called=!1,f}}});export{require_wrappy,require_once};
|
|
@@ -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-U7KCDTCH.js";import{__toESM}from"./chunk-6L236MNA.js";var import_chalk=__toESM(require_source(),1);function param(text){return`${import_chalk.default.gray('"')}${import_chalk.default.bold(text)}${import_chalk.default.gray('"')}`}export{param};
|
|
@@ -4,12 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
|
|
8
|
-
// src/util/constants.ts
|
|
9
|
-
var SENTRY_DSN = void 0;
|
|
10
|
-
var BUILD_LABEL = void 0;
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
SENTRY_DSN,
|
|
14
|
-
BUILD_LABEL
|
|
15
|
-
};
|
|
7
|
+
function sleep(ms){return new Promise(resolve=>{setTimeout(resolve,ms)})}export{sleep};
|
|
@@ -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-6L236MNA.js";var require_vendors=__commonJS({"../../node_modules/.pnpm/ci-info@4.1.0/node_modules/ci-info/vendors.json"(exports,module){module.exports=[{name:"Agola CI",constant:"AGOLA",env:"AGOLA_GIT_REF",pr:"AGOLA_PULL_REQUEST_ID"},{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE",pr:{env:"AC_GIT_PR",ne:"false"}},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN",pr:{env:"CODEBUILD_WEBHOOK_EVENT",any:["PULL_REQUEST_CREATED","PULL_REQUEST_UPDATED","PULL_REQUEST_REOPENED"]}},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"TF_BUILD",pr:{BUILD_REASON:"PullRequest"}},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Earthly",constant:"EARTHLY",env:"EARTHLY_CI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"Gitea Actions",constant:"GITEA_ACTIONS",env:"GITEA_ACTIONS"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Google Cloud Build",constant:"GOOGLE_CLOUD_BUILD",env:"BUILDER_OUTPUT"},{name:"Harness CI",constant:"HARNESS",env:"HARNESS_BUILD_ID"},{name:"Heroku",constant:"HEROKU",env:{env:"NODE",includes:"/app/.heroku/node/bin/node"}},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"Prow",constant:"PROW",env:"PROW_JOB_ID"},{name:"ReleaseHub",constant:"RELEASEHUB",env:"RELEASE_BUILD_ID"},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Sourcehut",constant:"SOURCEHUT",env:{CI_NAME:"sourcehut"}},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vela",constant:"VELA",env:"VELA",pr:{VELA_PULL_REQUEST:"1"}},{name:"Vercel",constant:"VERCEL",env:{any:["NOW_BUILDER","VERCEL"]},pr:"VERCEL_GIT_PULL_REQUEST_ID"},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"},{name:"Woodpecker",constant:"WOODPECKER",env:{CI:"woodpecker"},pr:{CI_BUILD_EVENT:"pull_request"}},{name:"Xcode Cloud",constant:"XCODE_CLOUD",env:"CI_XCODE_PROJECT",pr:"CI_PULL_REQUEST_NUMBER"},{name:"Xcode Server",constant:"XCODE_SERVER",env:"XCS"}]}});var require_ci_info=__commonJS({"../../node_modules/.pnpm/ci-info@4.1.0/node_modules/ci-info/index.js"(exports){"use strict";var vendors=require_vendors(),env=process.env;Object.defineProperty(exports,"_vendors",{value:vendors.map(function(v){return v.constant})});exports.name=null;exports.isPR=null;exports.id=null;vendors.forEach(function(vendor){let isCI=(Array.isArray(vendor.env)?vendor.env:[vendor.env]).every(function(obj){return checkEnv(obj)});exports[vendor.constant]=isCI,isCI&&(exports.name=vendor.name,exports.isPR=checkPR(vendor),exports.id=vendor.constant)});exports.isCI=!!(env.CI!=="false"&&(env.BUILD_ID||env.BUILD_NUMBER||env.CI||env.CI_APP_ID||env.CI_BUILD_ID||env.CI_BUILD_NUMBER||env.CI_NAME||env.CONTINUOUS_INTEGRATION||env.RUN_ID||exports.name));function checkEnv(obj){return typeof obj=="string"?!!env[obj]:"env"in obj?env[obj.env]&&env[obj.env].includes(obj.includes):"any"in obj?obj.any.some(function(k){return!!env[k]}):Object.keys(obj).every(function(k){return env[k]===obj[k]})}function checkPR(vendor){switch(typeof vendor.pr){case"string":return!!env[vendor.pr];case"object":return"env"in vendor.pr?"any"in vendor.pr?vendor.pr.any.some(function(key){return env[vendor.pr.env]===key}):vendor.pr.env in env&&env[vendor.pr.env]!==vendor.pr.ne:"any"in vendor.pr?vendor.pr.any.some(function(key){return!!env[key]}):checkEnv(vendor.pr);default:return null}}}});export{require_ci_info};
|
|
@@ -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 getInvalidSubcommand(config){return`Please specify a valid subcommand: ${Object.keys(config).join(" | ")}`}export{getInvalidSubcommand};
|
|
@@ -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{output_manager_default}from"./chunk-Z6Y55QJW.js";import{readFile,writeFile}from"node:fs/promises";import{access}from"node:fs/promises";import{dirname,join,resolve}from"node:path";import{homedir}from"node:os";import{spawn}from"node:child_process";import{KNOWN_AGENTS}from"@vercel/detect-agent";import{z}from"zod";var PREFS_FILE="agent-preferences.json",CLAUDE_LEGACY_PLUGIN_ID="vercel-plugin@vercel",CLAUDE_OFFICIAL_PLUGIN_ID="vercel@claude-plugins-official",VERCEL_PLUGIN_VERSION_URL="https://raw.githubusercontent.com/vercel/vercel-plugin/main/.claude-plugin/plugin.json",AGENT_TO_TARGET={[KNOWN_AGENTS.CLAUDE]:"claude-code",[KNOWN_AGENTS.COWORK]:"claude-code"};function getPluginTargetForAgent(agentName){if(agentName)return agentName===KNOWN_AGENTS.CLAUDE||agentName.startsWith("claude-code")||agentName===KNOWN_AGENTS.COWORK?"claude-code":AGENT_TO_TARGET[agentName]}var promptedAtSchema=z.codec(z.union([z.iso.date(),z.iso.datetime()]),z.date(),{decode:value=>new Date(value),encode:value=>value.toISOString()}),agentPreferencesSchema=z.object({pluginDeclined:z.boolean().optional(),pluginAutoUpdate:z.boolean().optional(),lastPromptedAt:promptedAtSchema.optional(),lastPluginAutoUpdateAttemptedAt:promptedAtSchema.optional(),lastPluginAutoUpdateAttemptedKey:z.string().optional()});async function fileExists(filePath){try{return await access(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{}}function encodeClaudeProjectDir(projectPath){return projectPath.replace(/[^A-Za-z0-9]/g,"-")}async function projectHasUsedClaudeCode(cwd){let home=homedir(),projectsDir=join(home,".claude","projects"),dir=resolve(cwd);for(;dir!==home;){if(await fileExists(join(projectsDir,encodeClaudeProjectDir(dir))))return!0;let parent=dirname(dir);if(parent===dir)break;dir=parent}return!1}async function getPluginTargets(agentName,cwd){let targetForAgent=getPluginTargetForAgent(agentName);return targetForAgent?[targetForAgent]:agentName?[]:cwd&&await projectHasUsedClaudeCode(cwd)?["claude-code"]:[]}async function readClaudeInstalledPluginsFromRegistry(){try{let raw=await readFile(getClaudeInstalledPluginsRegistryPath(),"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 join(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 readFile(registryPath,"utf-8"),data=JSON.parse(raw);return!data.plugins||!(pluginId in data.plugins)?!1:(delete data.plugins[pluginId],await writeFile(registryPath,`${JSON.stringify(data,null,2)}
|
|
8
|
+
`,"utf-8"),!0)}catch(err){return output_manager_default.debug(`Failed to remove Claude plugin registry entry: ${err}`),!1}}async function isPluginInstalledForTarget(target){return target==="claude-code"?(await getClaudePluginStatus()).state==="official-only":!1}async function confirm(client,message){return client.nonInteractive||!client.stdin.isTTY?!1:client.input.confirm(message,!0)}function isSameDay(left,right){return left.getFullYear()===right.getFullYear()&&left.getMonth()===right.getMonth()&&left.getDate()===right.getDate()}function wasPromptedToday(prefs){return prefs.lastPromptedAt?isSameDay(prefs.lastPromptedAt,new Date):!1}function wasPluginAutoUpdateAttemptedToday(prefs,attemptKey){return prefs.lastPluginAutoUpdateAttemptedKey===attemptKey&&!!prefs.lastPluginAutoUpdateAttemptedAt&&isSameDay(prefs.lastPluginAutoUpdateAttemptedAt,new Date)}async function markPromptedToday(client,prefs){prefs.lastPromptedAt=new Date,await writePrefs(client,prefs)}function markPluginAutoUpdateAttempted(prefs,attemptKey){attemptKey&&(prefs.lastPluginAutoUpdateAttemptedAt=new Date,prefs.lastPluginAutoUpdateAttemptedKey=attemptKey)}async function runCommand(command,args){return await new Promise(resolve2=>{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=>{resolve2({exitCode:code??1,stdout,stderr})}),child.on("error",err=>{resolve2({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 parse=value=>value.split(".").map(part=>Number.parseInt(part,10)||0),left=parse(a),right=parse(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 getClaudeAutoUpdateAttemptKey(status,plan){return[status.state,status.legacy?.version??"none",status.official?.version??"none",status.latestVersion??"unknown",plan.installOfficial?"install":"",plan.updateOfficial?"update":"",plan.removeLegacy?"remove-legacy":"",plan.removeLegacyMarketplace?"remove-marketplace":""].join(":")}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(" ")}
|
|
9
|
+
${result.stderr||result.stdout}`),!1)}async function removeStaleLegacyClaudePlugin(removeMarketplace){output_manager_default.spinner("Removing the stale legacy Vercel Claude plugin...");let removedRegistryEntry=await removeClaudePluginFromRegistry(CLAUDE_LEGACY_PLUGIN_ID);return output_manager_default.stopSpinner(),removedRegistryEntry?(output_manager_default.success("Removed the stale legacy Vercel Claude plugin"),removeMarketplace&&(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})||output_manager_default.log("Cleanup command: claude plugins marketplace remove vercel")),!0):(output_manager_default.warn("Could not remove the stale legacy Vercel Claude plugin registry entry."),!1)}async function runClaudeMigration(plan){let removedStaleLegacy=!1;if(plan.removeLegacy&&(await getClaudePluginStatus()).legacy?.stale&&(removedStaleLegacy=await removeStaleLegacyClaudePlugin(plan.removeLegacyMarketplace)),plan.installOfficial){if(!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}else 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]);let statusAfterInstall=await getClaudePluginStatus();if(!statusAfterInstall.official){output_manager_default.warn("Skipping Claude cleanup because the official Vercel plugin is not installed.");return}if(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}`);return}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"))}async function getClaudePluginStatus(){let[installedPlugins,latestVersion]=await Promise.all([getClaudeInstalledPlugins(),fetchLatestVercelPluginVersion()]);return buildClaudePluginStatus(installedPlugins,latestVersion)}async function applyPluginActions(targets,claudePlan){for(let target of targets)target==="claude-code"&&claudePlan?await runClaudeMigration(claudePlan):output_manager_default.debug(`Skipping unsupported plugin target: ${target}`)}async function autoInstallVercelPlugin(client,options){try{let prefs=await readPrefs(client),applyMode=options?.mode==="apply";if(!prefs.pluginDeclined||prefs.pluginAutoUpdate||applyMode){let targets=await getPluginTargets(client.agentName,client.cwd),uninstalledTargets=[],claudeStatus=targets.includes("claude-code")?await getClaudePluginStatus():void 0,claudePlan=claudeStatus?buildClaudePluginMigrationPlan(claudeStatus):void 0,claudeAutoUpdateAttemptKey=claudeStatus&&claudePlan?getClaudeAutoUpdateAttemptKey(claudeStatus,claudePlan):void 0;for(let target of targets){if(target==="claude-code"){claudePlan&&hasClaudeMigrationActions(claudePlan)&&uninstalledTargets.push(target);continue}await isPluginInstalledForTarget(target)||uninstalledTargets.push(target)}if(uninstalledTargets.length>0){if(prefs.pluginAutoUpdate){if(claudeAutoUpdateAttemptKey&&wasPluginAutoUpdateAttemptedToday(prefs,claudeAutoUpdateAttemptKey))return;prefs.pluginDeclined=!1,markPluginAutoUpdateAttempted(prefs,claudeAutoUpdateAttemptKey),await writePrefs(client,prefs),await applyPluginActions(uninstalledTargets,claudePlan);return}if(!applyMode&&wasPromptedToday(prefs))return;if(applyMode){prefs.pluginDeclined=!1,prefs.pluginAutoUpdate=!0,await writePrefs(client,prefs),await applyPluginActions(uninstalledTargets,claudePlan);return}let promptMessages=[],confirmMessage="Install the Vercel plugin?";if(uninstalledTargets.includes("claude-code")&&claudeStatus&&claudePlan){let claudePrompt=buildClaudePromptCopy(claudeStatus,claudePlan);promptMessages.push(claudePrompt.message),confirmMessage=claudePrompt.confirm}let promptMessage=promptMessages.join(" ").trim();promptMessage&&output_manager_default.log(promptMessage);let accepted=await confirm(client,confirmMessage);await markPromptedToday(client,prefs),accepted?(prefs.pluginDeclined=!1,prefs.pluginAutoUpdate=!0,await writePrefs(client,prefs),await applyPluginActions(uninstalledTargets,claudePlan)):(prefs.pluginDeclined=!0,prefs.pluginAutoUpdate=!1,await writePrefs(client,prefs))}}}catch(err){output_manager_default.debug(`Auto-install agent tooling failed: ${err}`)}}export{autoInstallVercelPlugin};
|
|
@@ -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{emitAlertsScopeError,resolveAlertsScope}from"./chunk-AFPOIDM5.js";import{handleValidationError,validateAllProjectMutualExclusivity}from"./chunk-6RIQPTJA.js";import{isJSONObject}from"./chunk-2PPXY24N.js";import{AGENT_REASON}from"./chunk-ENBTTYJR.js";import{buildCommandWithGlobalFlags,outputAgentError}from"./chunk-NS4FH2TY.js";import{getScope}from"./chunk-5QQNYN4N.js";import{getProjectByNameOrId}from"./chunk-VLZ47RWM.js";import{ProjectNotFound,isAPIError}from"./chunk-R2TGGVCT.js";import{output_manager_default}from"./chunk-Z6Y55QJW.js";async function resolveRulesTeam(client,jsonOutput){let{team}=await getScope(client,{resolveLocalScope:!0});return team?{teamId:team.id}:emitAlertsScopeError(client,jsonOutput,"NO_TEAM","No team context found. Run `vercel switch` to select a team, use `--scope <team>`, or link a team project.",{reason:AGENT_REASON.MISSING_SCOPE,hint:"Alert rules belong to a team. Select the team before retrying.",next:[{command:buildCommandWithGlobalFlags(client.argv,"teams switch"),when:"Select a team"},{command:buildCommandWithGlobalFlags(client.argv,"whoami"),when:"Inspect the current scope"}]})}async function resolveRulesProject(client,projectNameOrId,jsonOutput,command){let teamScope=await resolveRulesTeam(client,jsonOutput);if(typeof teamScope=="number")return teamScope;try{let project=await getProjectByNameOrId(client,projectNameOrId,teamScope.teamId);return project instanceof ProjectNotFound?emitAlertsScopeError(client,jsonOutput,"PROJECT_NOT_FOUND",`Project "${projectNameOrId}" was not found in the selected team.`,{reason:AGENT_REASON.NOT_FOUND,next:[{command:buildCommandWithGlobalFlags(client.argv,`${command} --project <name_or_id>`),when:"Retry with a valid project"}]}):{...teamScope,projectId:project.id,projectName:project.name}}catch(error){if(!isAPIError(error))throw error;return emitAlertsScopeError(client,jsonOutput,error.code||"API_ERROR",error.serverMessage||`API error (${error.status}).`,{reason:error.status===401?"not_authorized":error.status===403?"forbidden":AGENT_REASON.API_ERROR})}}async function parseRulesFlagsAndScope(client,flags,jsonOutput,command="alerts rules ls"){let mutual=validateAllProjectMutualExclusivity(flags["--all"],flags["--project"]);if(!mutual.valid)return outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message:mutual.message,next:[{command:buildCommandWithGlobalFlags(client.argv,"alerts rules --help"),when:"Use either `--project` or `--all`, not both"}]},1),handleValidationError(mutual,jsonOutput,client);if(flags["--all"])return resolveRulesTeam(client,jsonOutput);if(flags["--project"])return resolveRulesProject(client,flags["--project"],jsonOutput,command);let linkedScope=await resolveAlertsScope(client,{jsonOutput,command});if(typeof linkedScope=="number")return linkedScope;let teamScope=await resolveRulesTeam(client,jsonOutput);return typeof teamScope=="number"?teamScope:linkedScope.teamId===teamScope.teamId?linkedScope:teamScope}import{readFileSync}from"fs";import{resolve}from"path";function rulesCollectionPath(teamId,options={}){let query=new URLSearchParams({teamId});return options.limit!==void 0&&query.set("limit",String(options.limit)),options.cursor&&query.set("cursor",options.cursor),options.projectId&&query.set("projectId",options.projectId),options.type&&query.set("type",options.type),`/alerts/v3/alert-rules?${query.toString()}`}function rulesItemPath(teamId,ruleId){let query=new URLSearchParams({teamId});return`/alerts/v3/alert-rules/${encodeURIComponent(ruleId)}?${query.toString()}`}function rulesSchemaPath(teamId,type){let query=new URLSearchParams({teamId});return type&&query.set("type",type),`/alerts/v3/alert-rules/schema?${query.toString()}`}async function fetchRule(client,scope,ruleId){return(await client.fetch(rulesItemPath(scope.teamId,ruleId))).rule}function getIssues(error){return Array.isArray(error.issues)?error.issues.filter(issue=>isJSONObject(issue)&&typeof issue.path=="string"&&typeof issue.message=="string"):[]}function outputRulesError(client,jsonOutput,code,message,options={}){let issues=options.issues??[],issueSummary=issues.slice(0,5).map(issue=>`${issue.path||"body"}: ${issue.message}`).join("; ");return outputAgentError(client,{status:"error",reason:options.reason??AGENT_REASON.INVALID_ARGUMENTS,message,hint:options.hint??(issueSummary||void 0)},1),jsonOutput?client.stdout.write(`${JSON.stringify({error:{code,message,...issues.length?{issues}:{}}},null,2)}
|
|
8
|
+
`):output_manager_default.fatal([message,...issues.map(issue=>` ${issue.path}: ${issue.message}`)].join(`
|
|
9
|
+
`)),1}function handleRulesApiError(client,err,jsonOutput){let message=err.status===401?"You do not have access to alert rules in this team. Ensure your role can manage Alert Rules, or pass --token and --scope.":err.status===403?err.serverMessage||"You do not have permission to manage alert rules in this team.":err.status>=500?`The alert rules endpoint failed (${err.status}). Re-run with --debug and share the x-vercel-id from the failed request.`:err.serverMessage||`API error (${err.status}).`;return outputRulesError(client,jsonOutput,err.code||"API_ERROR",message,{reason:err.status===401?"not_authorized":err.status===403?"forbidden":err.status===404?AGENT_REASON.NOT_FOUND:err.status===429?"rate_limited":AGENT_REASON.API_ERROR,issues:getIssues(err),hint:err.status===401||err.status===403?"Confirm the team with `vercel whoami`; use --scope <team-slug> if the rule belongs to another team.":void 0})}var LEGACY_BODY_FIELDS=["alertTypes","customAlert","queryJsonString"];function readRuleBody(client,bodyPath,jsonOutput){let raw;try{raw=readFileSync(resolve(client.cwd,bodyPath),"utf8")}catch{return outputRulesError(client,jsonOutput,"INVALID_ARGUMENTS",`Could not read --body file: ${bodyPath}`)}let parsed;try{parsed=JSON.parse(raw)}catch{return outputRulesError(client,jsonOutput,"INVALID_ARGUMENTS","Invalid JSON in --body file.")}return isJSONObject(parsed)?LEGACY_BODY_FIELDS.some(field=>Object.hasOwn(parsed,field))?outputRulesError(client,jsonOutput,"LEGACY_ALERT_RULE_BODY","This body uses the previous alert-rules shape. Rewrite it using the built-in or custom schema.",{hint:"Run `vercel alerts rules schema --type built-in` or `vercel alerts rules schema --type custom` for examples."}):parsed:outputRulesError(client,jsonOutput,"INVALID_ARGUMENTS","The --body file must contain a JSON object.")}function getBodyType(body){return body.type==="built-in"||body.type==="custom"?body.type:void 0}function emitRulesArgParseError(client,err,recoverWithProjectFlag){let message=err instanceof Error?err.message:String(err),projectFlagMissingArg=message.includes("--project")&&message.includes("requires argument");outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message:projectFlagMissingArg?"`--project` requires a project name or id (for example `--project my-app`).":message,next:[{command:buildCommandWithGlobalFlags(client.argv,projectFlagMissingArg?recoverWithProjectFlag:"alerts rules --help"),when:projectFlagMissingArg?"Retry with a project name or id":"See valid `alerts rules` subcommands"}]},1)}export{resolveRulesTeam,resolveRulesProject,parseRulesFlagsAndScope,rulesCollectionPath,rulesItemPath,rulesSchemaPath,fetchRule,outputRulesError,handleRulesApiError,readRuleBody,getBodyType,emitRulesArgParseError};
|
|
@@ -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-6L236MNA.js";var require_retry_operation=__commonJS({"../../node_modules/.pnpm/retry@0.10.1/node_modules/retry/lib/retry_operation.js"(exports,module){function RetryOperation(timeouts,options){typeof options=="boolean"&&(options={forever:options}),this._timeouts=timeouts,this._options=options||{},this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}module.exports=RetryOperation;RetryOperation.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};RetryOperation.prototype.retry=function(err){if(this._timeout&&clearTimeout(this._timeout),!err)return!1;this._errors.push(err);var timeout=this._timeouts.shift();if(timeout===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),timeout=this._timeouts.shift();else return!1;var self=this,timer=setTimeout(function(){self._attempts++,self._operationTimeoutCb&&(self._timeout=setTimeout(function(){self._operationTimeoutCb(self._attempts)},self._operationTimeout),this._options.unref&&self._timeout.unref()),self._fn(self._attempts)},timeout);return this._options.unref&&timer.unref(),!0};RetryOperation.prototype.attempt=function(fn,timeoutOps){this._fn=fn,timeoutOps&&(timeoutOps.timeout&&(this._operationTimeout=timeoutOps.timeout),timeoutOps.cb&&(this._operationTimeoutCb=timeoutOps.cb));var self=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){self._operationTimeoutCb()},self._operationTimeout)),this._fn(this._attempts)};RetryOperation.prototype.try=function(fn){console.log("Using RetryOperation.try() is deprecated"),this.attempt(fn)};RetryOperation.prototype.start=function(fn){console.log("Using RetryOperation.start() is deprecated"),this.attempt(fn)};RetryOperation.prototype.start=RetryOperation.prototype.try;RetryOperation.prototype.errors=function(){return this._errors};RetryOperation.prototype.attempts=function(){return this._attempts};RetryOperation.prototype.mainError=function(){if(this._errors.length===0)return null;for(var counts={},mainError=null,mainErrorCount=0,i=0;i<this._errors.length;i++){var error=this._errors[i],message=error.message,count=(counts[message]||0)+1;counts[message]=count,count>=mainErrorCount&&(mainError=error,mainErrorCount=count)}return mainError}}});var require_retry=__commonJS({"../../node_modules/.pnpm/retry@0.10.1/node_modules/retry/lib/retry.js"(exports){var RetryOperation=require_retry_operation();exports.operation=function(options){var timeouts=exports.timeouts(options);return new RetryOperation(timeouts,{forever:options&&options.forever,unref:options&&options.unref})};exports.timeouts=function(options){if(options instanceof Array)return[].concat(options);var opts={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var key in options)opts[key]=options[key];if(opts.minTimeout>opts.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var timeouts=[],i=0;i<opts.retries;i++)timeouts.push(this.createTimeout(i,opts));return options&&options.forever&&!timeouts.length&&timeouts.push(this.createTimeout(i,opts)),timeouts.sort(function(a,b){return a-b}),timeouts};exports.createTimeout=function(attempt,opts){var random=opts.randomize?Math.random()+1:1,timeout=Math.round(random*opts.minTimeout*Math.pow(opts.factor,attempt));return timeout=Math.min(timeout,opts.maxTimeout),timeout};exports.wrap=function(obj,options,methods){if(options instanceof Array&&(methods=options,options=null),!methods){methods=[];for(var key in obj)typeof obj[key]=="function"&&methods.push(key)}for(var i=0;i<methods.length;i++){var method=methods[i],original=obj[method];obj[method]=function(){var op=exports.operation(options),args=Array.prototype.slice.call(arguments),callback=args.pop();args.push(function(err){op.retry(err)||(err&&(arguments[0]=op.mainError()),callback.apply(this,arguments))}),op.attempt(function(){original.apply(obj,args)})},obj[method].options=options}}}});var require_retry2=__commonJS({"../../node_modules/.pnpm/retry@0.10.1/node_modules/retry/index.js"(exports,module){module.exports=require_retry()}});var require_dist=__commonJS({"../../node_modules/.pnpm/async-retry@1.1.3/node_modules/async-retry/dist/index.js"(exports,module){"use strict";var retrier=require_retry2();module.exports=function(fn,opts){return opts=opts||{},new Promise(function(resolve,reject){var op=retrier.operation(opts),bail=function(err){return reject(err||new Error("Aborted"))},onError=function(err){if(err.bail)return bail(err);op.retry(err)?opts.onRetry&&opts.onRetry(err):reject(op.mainError())};op.attempt(function(num){var val=void 0;try{val=fn(bail,num)}catch(err){return onError(err)}Promise.resolve(val).then(resolve,onError)})})}}});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
|
+
function progress(current,total,opts={}){let{width=20,complete="=",incomplete="-"}=opts;if(total<=0||current<0||current>total)return null;let unit=total/width,pos=Math.floor(current/unit);return`${complete.repeat(pos)}${incomplete.repeat(width-pos)}`}export{progress};
|
|
@@ -0,0 +1,12 @@
|
|
|
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_supports_color}from"./chunk-N3ZZ7FHQ.js";import{require_ansi_styles}from"./chunk-GU6VIFR5.js";import{__commonJS}from"./chunk-6L236MNA.js";var require_util=__commonJS({"../../node_modules/.pnpm/chalk@4.1.0/node_modules/chalk/source/util.js"(exports,module){"use strict";var stringReplaceAll=(string,substring,replacer)=>{let index=string.indexOf(substring);if(index===-1)return string;let substringLength=substring.length,endIndex=0,returnValue="";do returnValue+=string.substr(endIndex,index-endIndex)+substring+replacer,endIndex=index+substringLength,index=string.indexOf(substring,endIndex);while(index!==-1);return returnValue+=string.substr(endIndex),returnValue},stringEncaseCRLFWithFirstIndex=(string,prefix,postfix,index)=>{let endIndex=0,returnValue="";do{let gotCR=string[index-1]==="\r";returnValue+=string.substr(endIndex,(gotCR?index-1:index)-endIndex)+prefix+(gotCR?`\r
|
|
8
|
+
`:`
|
|
9
|
+
`)+postfix,endIndex=index+1,index=string.indexOf(`
|
|
10
|
+
`,endIndex)}while(index!==-1);return returnValue+=string.substr(endIndex),returnValue};module.exports={stringReplaceAll,stringEncaseCRLFWithFirstIndex}}});var require_templates=__commonJS({"../../node_modules/.pnpm/chalk@4.1.0/node_modules/chalk/source/templates.js"(exports,module){"use strict";var TEMPLATE_REGEX=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,STYLE_REGEX=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,STRING_REGEX=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,ESCAPE_REGEX=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,ESCAPES=new Map([["n",`
|
|
11
|
+
`],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function unescape(c){let u=c[0]==="u",bracket=c[1]==="{";return u&&!bracket&&c.length===5||c[0]==="x"&&c.length===3?String.fromCharCode(parseInt(c.slice(1),16)):u&&bracket?String.fromCodePoint(parseInt(c.slice(2,-1),16)):ESCAPES.get(c)||c}function parseArguments(name,arguments_){let results=[],chunks=arguments_.trim().split(/\s*,\s*/g),matches;for(let chunk of chunks){let number=Number(chunk);if(!Number.isNaN(number))results.push(number);else if(matches=chunk.match(STRING_REGEX))results.push(matches[2].replace(ESCAPE_REGEX,(m,escape,character)=>escape?unescape(escape):character));else throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`)}return results}function parseStyle(style){STYLE_REGEX.lastIndex=0;let results=[],matches;for(;(matches=STYLE_REGEX.exec(style))!==null;){let name=matches[1];if(matches[2]){let args=parseArguments(name,matches[2]);results.push([name].concat(args))}else results.push([name])}return results}function buildStyle(chalk,styles){let enabled={};for(let layer of styles)for(let style of layer.styles)enabled[style[0]]=layer.inverse?null:style.slice(1);let current=chalk;for(let[styleName,styles2]of Object.entries(enabled))if(Array.isArray(styles2)){if(!(styleName in current))throw new Error(`Unknown Chalk style: ${styleName}`);current=styles2.length>0?current[styleName](...styles2):current[styleName]}return current}module.exports=(chalk,temporary)=>{let styles=[],chunks=[],chunk=[];if(temporary.replace(TEMPLATE_REGEX,(m,escapeCharacter,inverse,style,close,character)=>{if(escapeCharacter)chunk.push(unescape(escapeCharacter));else if(style){let string=chunk.join("");chunk=[],chunks.push(styles.length===0?string:buildStyle(chalk,styles)(string)),styles.push({inverse,styles:parseStyle(style)})}else if(close){if(styles.length===0)throw new Error("Found extraneous } in Chalk template literal");chunks.push(buildStyle(chalk,styles)(chunk.join(""))),chunk=[],styles.pop()}else chunk.push(character)}),chunks.push(chunk.join("")),styles.length>0){let errMessage=`Chalk template literal is missing ${styles.length} closing bracket${styles.length===1?"":"s"} (\`}\`)`;throw new Error(errMessage)}return chunks.join("")}}});var require_source=__commonJS({"../../node_modules/.pnpm/chalk@4.1.0/node_modules/chalk/source/index.js"(exports,module){"use strict";var ansiStyles=require_ansi_styles(),{stdout:stdoutColor,stderr:stderrColor}=require_supports_color(),{stringReplaceAll,stringEncaseCRLFWithFirstIndex}=require_util(),{isArray}=Array,levelMapping=["ansi","ansi","ansi256","ansi16m"],styles=Object.create(null),applyOptions=(object,options={})=>{if(options.level&&!(Number.isInteger(options.level)&&options.level>=0&&options.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let colorLevel=stdoutColor?stdoutColor.level:0;object.level=options.level===void 0?colorLevel:options.level},ChalkClass=class{constructor(options){return chalkFactory(options)}},chalkFactory=options=>{let chalk2={};return applyOptions(chalk2,options),chalk2.template=(...arguments_)=>chalkTag(chalk2.template,...arguments_),Object.setPrototypeOf(chalk2,Chalk.prototype),Object.setPrototypeOf(chalk2.template,chalk2),chalk2.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},chalk2.template.Instance=ChalkClass,chalk2.template};function Chalk(options){return chalkFactory(options)}for(let[styleName,style]of Object.entries(ansiStyles))styles[styleName]={get(){let builder=createBuilder(this,createStyler(style.open,style.close,this._styler),this._isEmpty);return Object.defineProperty(this,styleName,{value:builder}),builder}};styles.visible={get(){let builder=createBuilder(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:builder}),builder}};var usedModels=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let model of usedModels)styles[model]={get(){let{level}=this;return function(...arguments_){let styler=createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_),ansiStyles.color.close,this._styler);return createBuilder(this,styler,this._isEmpty)}}};for(let model of usedModels){let bgModel="bg"+model[0].toUpperCase()+model.slice(1);styles[bgModel]={get(){let{level}=this;return function(...arguments_){let styler=createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_),ansiStyles.bgColor.close,this._styler);return createBuilder(this,styler,this._isEmpty)}}}}var proto=Object.defineProperties(()=>{},{...styles,level:{enumerable:!0,get(){return this._generator.level},set(level){this._generator.level=level}}}),createStyler=(open,close,parent)=>{let openAll,closeAll;return parent===void 0?(openAll=open,closeAll=close):(openAll=parent.openAll+open,closeAll=close+parent.closeAll),{open,close,openAll,closeAll,parent}},createBuilder=(self,_styler,_isEmpty)=>{let builder=(...arguments_)=>isArray(arguments_[0])&&isArray(arguments_[0].raw)?applyStyle(builder,chalkTag(builder,...arguments_)):applyStyle(builder,arguments_.length===1?""+arguments_[0]:arguments_.join(" "));return Object.setPrototypeOf(builder,proto),builder._generator=self,builder._styler=_styler,builder._isEmpty=_isEmpty,builder},applyStyle=(self,string)=>{if(self.level<=0||!string)return self._isEmpty?"":string;let styler=self._styler;if(styler===void 0)return string;let{openAll,closeAll}=styler;if(string.indexOf("\x1B")!==-1)for(;styler!==void 0;)string=stringReplaceAll(string,styler.close,styler.open),styler=styler.parent;let lfIndex=string.indexOf(`
|
|
12
|
+
`);return lfIndex!==-1&&(string=stringEncaseCRLFWithFirstIndex(string,closeAll,openAll,lfIndex)),openAll+string+closeAll},template,chalkTag=(chalk2,...strings)=>{let[firstString]=strings;if(!isArray(firstString)||!isArray(firstString.raw))return strings.join(" ");let arguments_=strings.slice(1),parts=[firstString.raw[0]];for(let i=1;i<firstString.length;i++)parts.push(String(arguments_[i-1]).replace(/[{}\\]/g,"\\$&"),String(firstString.raw[i]));return template===void 0&&(template=require_templates()),template(chalk2,parts.join(""))};Object.defineProperties(Chalk.prototype,styles);var chalk=Chalk();chalk.supportsColor=stdoutColor;chalk.stderr=Chalk({level:stderrColor?stderrColor.level:0});chalk.stderr.supportsColor=stderrColor;module.exports=chalk}});export{require_source};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{getTeams}from"./chunk-CN2QZO4U.js";import{param}from"./chunk-SXUEGVWB.js";import{outputActionRequired}from"./chunk-NS4FH2TY.js";import{printAlignedLabel}from"./chunk-XSVBYDYI.js";import{getUser}from"./chunk-EVZRQGNK.js";import{getCommandName,packageName}from"./chunk-FI772UVH.js";import{require_build_utils}from"./chunk-XFVGX5HG.js";import{emoji,output_manager_default}from"./chunk-Z6Y55QJW.js";import{require_source}from"./chunk-U7KCDTCH.js";import{__toESM}from"./chunk-6L236MNA.js";var import_chalk=__toESM(require_source(),1);var import_build_utils=__toESM(require_build_utils(),1);function getScopeOrTeamFromArgv(argv){let args=argv.slice(2);for(let i=0;i<args.length;i++){let arg=args[i];if(arg==="--scope"||arg==="--team"||arg==="-S"||arg==="-T"){let next=args[i+1];if(typeof next=="string"&&!next.startsWith("-"))return next;continue}if(arg.startsWith("--scope="))return arg.slice(8);if(arg.startsWith("--team="))return arg.slice(7)}return null}async function selectOrg(client,question,autoConfirm,searchable=!1,meta,description){let{config:{currentTeam}}=client;output_manager_default.spinner("Loading teams\u2026",1e3);let user,teams;try{[user,teams]=await Promise.all([getUser(client),getTeams(client)])}finally{output_manager_default.stopSpinner()}let formatChoiceName=(name,slug,isCurrent,limited)=>{let title=`${name} (${slug})`;return isCurrent&&(title+=` ${import_chalk.default.bold("(current)")}`),limited&&(title+=` ${emoji("locked")}`),title},choices=[...user.version==="northstar"?[]:[{name:formatChoiceName(user.name||user.username,user.username,!currentTeam,user.limited),value:{type:"user",id:user.id,slug:user.username}}],...teams.sort(a=>a.id===user.defaultTeamId?-1:1).map(team=>({name:formatChoiceName(team.name||team.slug,team.slug,team.id===currentTeam,team.limited),value:{type:"team",id:team.id,slug:team.slug}}))],defaultChoiceIndex=Math.max(choices.findIndex(choice=>choice.value.id===currentTeam),0);meta&&(meta.choiceCount=choices.length);let localConfigScope=client.localConfig?.scope,explicitScope=getScopeOrTeamFromArgv(client.argv)??(typeof localConfigScope=="string"?localConfigScope:null)??(0,import_build_utils.getPlatformEnv)("ORG_ID")??null,matchExplicitScope=()=>{if(!explicitScope)return;let match=choices.find(c=>c.value.id===explicitScope||c.value.slug===explicitScope);if(match)return match.value;if(user.id===explicitScope||user.email===explicitScope||user.username===explicitScope)return choices.find(c=>c.value.type==="user")?.value};if(client.nonInteractive||!client.stdin.isTTY){let match=matchExplicitScope();if(match)return match;if(choices.length===1)return choices[0].value;let actionRequired={status:"action_required",reason:"missing_scope",message:choices.length>0?"Provide --team or --scope explicitly. No default is applied in non-interactive mode.":"No teams available.",choices:choices.map(c=>({id:c.value.id,name:c.value.slug})),next:choices.map(c=>({command:`${packageName} link --team ${c.value.slug}`}))};outputActionRequired(client,actionRequired),output_manager_default.error(choices.length>0?`Multiple teams found. Teams are never auto-selected when the CLI runs without an interactive terminal. Re-run this command with ${param("--team <slug>")}, or run ${getCommandName("teams ls")} to list your teams.`:"No teams available."),process.exit(1)}let explicitOrg=matchExplicitScope();if(explicitOrg)return explicitOrg;if(choices.length===1)return printAlignedLabel("Team",choices[0].value.slug),choices[0].value;let descriptionLine=description?`
|
|
8
|
+
${import_chalk.default.dim(` ${description}`)}`:"";if(!searchable)return await client.input.select({message:`${question}${descriptionLine}`,choices,default:choices[defaultChoiceIndex].value});let defaultChoice=choices[defaultChoiceIndex],initialChoices=defaultChoice?[defaultChoice,...choices.filter(choice=>choice!==defaultChoice)]:choices,pageSize=15,countHint=choices.length>pageSize?` ${import_chalk.default.dim(`(${choices.length} teams)`)}`:"";return await client.input.search({message:`${question}${countHint}${descriptionLine}`,pageSize,source:term=>{let searchTerm=term?.trim().toLowerCase();return searchTerm?choices.filter(choice=>choice.name.toLowerCase().includes(searchTerm)||choice.value.slug.toLowerCase().includes(searchTerm)):initialChoices}})}export{selectOrg};
|
|
@@ -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-6L236MNA.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,21 @@
|
|
|
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-6L236MNA.js";function createScanner(text,ignoreTrivia=!1){let len=text.length,pos=0,value="",tokenOffset=0,token=16,lineNumber=0,lineStartOffset=0,tokenLineStartOffset=0,prevTokenLineStartOffset=0,scanError=0;function scanHexDigits(count,exact){let digits=0,value2=0;for(;digits<count||!exact;){let ch=text.charCodeAt(pos);if(ch>=48&&ch<=57)value2=value2*16+ch-48;else if(ch>=65&&ch<=70)value2=value2*16+ch-65+10;else if(ch>=97&&ch<=102)value2=value2*16+ch-97+10;else break;pos++,digits++}return digits<count&&(value2=-1),value2}function setPosition(newPosition){pos=newPosition,value="",tokenOffset=0,token=16,scanError=0}function scanNumber(){let start=pos;if(text.charCodeAt(pos)===48)pos++;else for(pos++;pos<text.length&&isDigit(text.charCodeAt(pos));)pos++;if(pos<text.length&&text.charCodeAt(pos)===46)if(pos++,pos<text.length&&isDigit(text.charCodeAt(pos)))for(pos++;pos<text.length&&isDigit(text.charCodeAt(pos));)pos++;else return scanError=3,text.substring(start,pos);let end=pos;if(pos<text.length&&(text.charCodeAt(pos)===69||text.charCodeAt(pos)===101))if(pos++,(pos<text.length&&text.charCodeAt(pos)===43||text.charCodeAt(pos)===45)&&pos++,pos<text.length&&isDigit(text.charCodeAt(pos))){for(pos++;pos<text.length&&isDigit(text.charCodeAt(pos));)pos++;end=pos}else scanError=3;return text.substring(start,end)}function scanString(){let result="",start=pos;for(;;){if(pos>=len){result+=text.substring(start,pos),scanError=2;break}let ch=text.charCodeAt(pos);if(ch===34){result+=text.substring(start,pos),pos++;break}if(ch===92){if(result+=text.substring(start,pos),pos++,pos>=len){scanError=2;break}switch(text.charCodeAt(pos++)){case 34:result+='"';break;case 92:result+="\\";break;case 47:result+="/";break;case 98:result+="\b";break;case 102:result+="\f";break;case 110:result+=`
|
|
8
|
+
`;break;case 114:result+="\r";break;case 116:result+=" ";break;case 117:let ch3=scanHexDigits(4,!0);ch3>=0?result+=String.fromCharCode(ch3):scanError=4;break;default:scanError=5}start=pos;continue}if(ch>=0&&ch<=31)if(isLineBreak(ch)){result+=text.substring(start,pos),scanError=2;break}else scanError=6;pos++}return result}function scanNext(){if(value="",scanError=0,tokenOffset=pos,lineStartOffset=lineNumber,prevTokenLineStartOffset=tokenLineStartOffset,pos>=len)return tokenOffset=len,token=17;let code=text.charCodeAt(pos);if(isWhiteSpace(code)){do pos++,value+=String.fromCharCode(code),code=text.charCodeAt(pos);while(isWhiteSpace(code));return token=15}if(isLineBreak(code))return pos++,value+=String.fromCharCode(code),code===13&&text.charCodeAt(pos)===10&&(pos++,value+=`
|
|
9
|
+
`),lineNumber++,tokenLineStartOffset=pos,token=14;switch(code){case 123:return pos++,token=1;case 125:return pos++,token=2;case 91:return pos++,token=3;case 93:return pos++,token=4;case 58:return pos++,token=6;case 44:return pos++,token=5;case 34:return pos++,value=scanString(),token=10;case 47:let start=pos-1;if(text.charCodeAt(pos+1)===47){for(pos+=2;pos<len&&!isLineBreak(text.charCodeAt(pos));)pos++;return value=text.substring(start,pos),token=12}if(text.charCodeAt(pos+1)===42){pos+=2;let safeLength=len-1,commentClosed=!1;for(;pos<safeLength;){let ch=text.charCodeAt(pos);if(ch===42&&text.charCodeAt(pos+1)===47){pos+=2,commentClosed=!0;break}pos++,isLineBreak(ch)&&(ch===13&&text.charCodeAt(pos)===10&&pos++,lineNumber++,tokenLineStartOffset=pos)}return commentClosed||(pos++,scanError=1),value=text.substring(start,pos),token=13}return value+=String.fromCharCode(code),pos++,token=16;case 45:if(value+=String.fromCharCode(code),pos++,pos===len||!isDigit(text.charCodeAt(pos)))return token=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return value+=scanNumber(),token=11;default:for(;pos<len&&isUnknownContentCharacter(code);)pos++,code=text.charCodeAt(pos);if(tokenOffset!==pos){switch(value=text.substring(tokenOffset,pos),value){case"true":return token=8;case"false":return token=9;case"null":return token=7}return token=16}return value+=String.fromCharCode(code),pos++,token=16}}function isUnknownContentCharacter(code){if(isWhiteSpace(code)||isLineBreak(code))return!1;switch(code){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function scanNextNonTrivia(){let result;do result=scanNext();while(result>=12&&result<=15);return result}return{setPosition,getPosition:()=>pos,scan:ignoreTrivia?scanNextNonTrivia:scanNext,getToken:()=>token,getTokenValue:()=>value,getTokenOffset:()=>tokenOffset,getTokenLength:()=>pos-tokenOffset,getTokenStartLine:()=>lineStartOffset,getTokenStartCharacter:()=>tokenOffset-prevTokenLineStartOffset,getTokenError:()=>scanError}}function isWhiteSpace(ch){return ch===32||ch===9}function isLineBreak(ch){return ch===10||ch===13}function isDigit(ch){return ch>=48&&ch<=57}var CharacterCodes,init_scanner=__esm({"../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js"(){"use strict";(function(CharacterCodes2){CharacterCodes2[CharacterCodes2.lineFeed=10]="lineFeed",CharacterCodes2[CharacterCodes2.carriageReturn=13]="carriageReturn",CharacterCodes2[CharacterCodes2.space=32]="space",CharacterCodes2[CharacterCodes2._0=48]="_0",CharacterCodes2[CharacterCodes2._1=49]="_1",CharacterCodes2[CharacterCodes2._2=50]="_2",CharacterCodes2[CharacterCodes2._3=51]="_3",CharacterCodes2[CharacterCodes2._4=52]="_4",CharacterCodes2[CharacterCodes2._5=53]="_5",CharacterCodes2[CharacterCodes2._6=54]="_6",CharacterCodes2[CharacterCodes2._7=55]="_7",CharacterCodes2[CharacterCodes2._8=56]="_8",CharacterCodes2[CharacterCodes2._9=57]="_9",CharacterCodes2[CharacterCodes2.a=97]="a",CharacterCodes2[CharacterCodes2.b=98]="b",CharacterCodes2[CharacterCodes2.c=99]="c",CharacterCodes2[CharacterCodes2.d=100]="d",CharacterCodes2[CharacterCodes2.e=101]="e",CharacterCodes2[CharacterCodes2.f=102]="f",CharacterCodes2[CharacterCodes2.g=103]="g",CharacterCodes2[CharacterCodes2.h=104]="h",CharacterCodes2[CharacterCodes2.i=105]="i",CharacterCodes2[CharacterCodes2.j=106]="j",CharacterCodes2[CharacterCodes2.k=107]="k",CharacterCodes2[CharacterCodes2.l=108]="l",CharacterCodes2[CharacterCodes2.m=109]="m",CharacterCodes2[CharacterCodes2.n=110]="n",CharacterCodes2[CharacterCodes2.o=111]="o",CharacterCodes2[CharacterCodes2.p=112]="p",CharacterCodes2[CharacterCodes2.q=113]="q",CharacterCodes2[CharacterCodes2.r=114]="r",CharacterCodes2[CharacterCodes2.s=115]="s",CharacterCodes2[CharacterCodes2.t=116]="t",CharacterCodes2[CharacterCodes2.u=117]="u",CharacterCodes2[CharacterCodes2.v=118]="v",CharacterCodes2[CharacterCodes2.w=119]="w",CharacterCodes2[CharacterCodes2.x=120]="x",CharacterCodes2[CharacterCodes2.y=121]="y",CharacterCodes2[CharacterCodes2.z=122]="z",CharacterCodes2[CharacterCodes2.A=65]="A",CharacterCodes2[CharacterCodes2.B=66]="B",CharacterCodes2[CharacterCodes2.C=67]="C",CharacterCodes2[CharacterCodes2.D=68]="D",CharacterCodes2[CharacterCodes2.E=69]="E",CharacterCodes2[CharacterCodes2.F=70]="F",CharacterCodes2[CharacterCodes2.G=71]="G",CharacterCodes2[CharacterCodes2.H=72]="H",CharacterCodes2[CharacterCodes2.I=73]="I",CharacterCodes2[CharacterCodes2.J=74]="J",CharacterCodes2[CharacterCodes2.K=75]="K",CharacterCodes2[CharacterCodes2.L=76]="L",CharacterCodes2[CharacterCodes2.M=77]="M",CharacterCodes2[CharacterCodes2.N=78]="N",CharacterCodes2[CharacterCodes2.O=79]="O",CharacterCodes2[CharacterCodes2.P=80]="P",CharacterCodes2[CharacterCodes2.Q=81]="Q",CharacterCodes2[CharacterCodes2.R=82]="R",CharacterCodes2[CharacterCodes2.S=83]="S",CharacterCodes2[CharacterCodes2.T=84]="T",CharacterCodes2[CharacterCodes2.U=85]="U",CharacterCodes2[CharacterCodes2.V=86]="V",CharacterCodes2[CharacterCodes2.W=87]="W",CharacterCodes2[CharacterCodes2.X=88]="X",CharacterCodes2[CharacterCodes2.Y=89]="Y",CharacterCodes2[CharacterCodes2.Z=90]="Z",CharacterCodes2[CharacterCodes2.asterisk=42]="asterisk",CharacterCodes2[CharacterCodes2.backslash=92]="backslash",CharacterCodes2[CharacterCodes2.closeBrace=125]="closeBrace",CharacterCodes2[CharacterCodes2.closeBracket=93]="closeBracket",CharacterCodes2[CharacterCodes2.colon=58]="colon",CharacterCodes2[CharacterCodes2.comma=44]="comma",CharacterCodes2[CharacterCodes2.dot=46]="dot",CharacterCodes2[CharacterCodes2.doubleQuote=34]="doubleQuote",CharacterCodes2[CharacterCodes2.minus=45]="minus",CharacterCodes2[CharacterCodes2.openBrace=123]="openBrace",CharacterCodes2[CharacterCodes2.openBracket=91]="openBracket",CharacterCodes2[CharacterCodes2.plus=43]="plus",CharacterCodes2[CharacterCodes2.slash=47]="slash",CharacterCodes2[CharacterCodes2.formFeed=12]="formFeed",CharacterCodes2[CharacterCodes2.tab=9]="tab"})(CharacterCodes||(CharacterCodes={}))}});var cachedSpaces,maxCachedValues,cachedBreakLinesWithSpaces,supportedEols,init_string_intern=__esm({"../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/string-intern.js"(){cachedSpaces=new Array(20).fill(0).map((_,index)=>" ".repeat(index)),maxCachedValues=200,cachedBreakLinesWithSpaces={" ":{"\n":new Array(maxCachedValues).fill(0).map((_,index)=>`
|
|
10
|
+
`+" ".repeat(index)),"\r":new Array(maxCachedValues).fill(0).map((_,index)=>"\r"+" ".repeat(index)),"\r\n":new Array(maxCachedValues).fill(0).map((_,index)=>`\r
|
|
11
|
+
`+" ".repeat(index))}," ":{"\n":new Array(maxCachedValues).fill(0).map((_,index)=>`
|
|
12
|
+
`+" ".repeat(index)),"\r":new Array(maxCachedValues).fill(0).map((_,index)=>"\r"+" ".repeat(index)),"\r\n":new Array(maxCachedValues).fill(0).map((_,index)=>`\r
|
|
13
|
+
`+" ".repeat(index))}},supportedEols=[`
|
|
14
|
+
`,"\r",`\r
|
|
15
|
+
`]}});function format(documentText,range,options){let initialIndentLevel,formatText,formatTextStart,rangeStart,rangeEnd;if(range){for(rangeStart=range.offset,rangeEnd=rangeStart+range.length,formatTextStart=rangeStart;formatTextStart>0&&!isEOL(documentText,formatTextStart-1);)formatTextStart--;let endOffset=rangeEnd;for(;endOffset<documentText.length&&!isEOL(documentText,endOffset);)endOffset++;formatText=documentText.substring(formatTextStart,endOffset),initialIndentLevel=computeIndentLevel(formatText,options)}else formatText=documentText,initialIndentLevel=0,formatTextStart=0,rangeStart=0,rangeEnd=documentText.length;let eol=getEOL(options,documentText),eolFastPathSupported=supportedEols.includes(eol),numberLineBreaks=0,indentLevel=0,indentValue;options.insertSpaces?indentValue=cachedSpaces[options.tabSize||4]??repeat(cachedSpaces[1],options.tabSize||4):indentValue=" ";let indentType=indentValue===" "?" ":" ",scanner=createScanner(formatText,!1),hasError=!1;function newLinesAndIndent(){if(numberLineBreaks>1)return repeat(eol,numberLineBreaks)+repeat(indentValue,initialIndentLevel+indentLevel);let amountOfSpaces=indentValue.length*(initialIndentLevel+indentLevel);return!eolFastPathSupported||amountOfSpaces>cachedBreakLinesWithSpaces[indentType][eol].length?eol+repeat(indentValue,initialIndentLevel+indentLevel):amountOfSpaces<=0?eol:cachedBreakLinesWithSpaces[indentType][eol][amountOfSpaces]}function scanNext(){let token=scanner.scan();for(numberLineBreaks=0;token===15||token===14;)token===14&&options.keepLines?numberLineBreaks+=1:token===14&&(numberLineBreaks=1),token=scanner.scan();return hasError=token===16||scanner.getTokenError()!==0,token}let editOperations=[];function addEdit(text,startOffset,endOffset){!hasError&&(!range||startOffset<rangeEnd&&endOffset>rangeStart)&&documentText.substring(startOffset,endOffset)!==text&&editOperations.push({offset:startOffset,length:endOffset-startOffset,content:text})}let firstToken=scanNext();if(options.keepLines&&numberLineBreaks>0&&addEdit(repeat(eol,numberLineBreaks),0,0),firstToken!==17){let firstTokenStart=scanner.getTokenOffset()+formatTextStart,initialIndent=indentValue.length*initialIndentLevel<20&&options.insertSpaces?cachedSpaces[indentValue.length*initialIndentLevel]:repeat(indentValue,initialIndentLevel);addEdit(initialIndent,formatTextStart,firstTokenStart)}for(;firstToken!==17;){let firstTokenEnd=scanner.getTokenOffset()+scanner.getTokenLength()+formatTextStart,secondToken=scanNext(),replaceContent="",needsLineBreak=!1;for(;numberLineBreaks===0&&(secondToken===12||secondToken===13);){let commentTokenStart=scanner.getTokenOffset()+formatTextStart;addEdit(cachedSpaces[1],firstTokenEnd,commentTokenStart),firstTokenEnd=scanner.getTokenOffset()+scanner.getTokenLength()+formatTextStart,needsLineBreak=secondToken===12,replaceContent=needsLineBreak?newLinesAndIndent():"",secondToken=scanNext()}if(secondToken===2)firstToken!==1&&indentLevel--,options.keepLines&&numberLineBreaks>0||!options.keepLines&&firstToken!==1?replaceContent=newLinesAndIndent():options.keepLines&&(replaceContent=cachedSpaces[1]);else if(secondToken===4)firstToken!==3&&indentLevel--,options.keepLines&&numberLineBreaks>0||!options.keepLines&&firstToken!==3?replaceContent=newLinesAndIndent():options.keepLines&&(replaceContent=cachedSpaces[1]);else{switch(firstToken){case 3:case 1:indentLevel++,options.keepLines&&numberLineBreaks>0||!options.keepLines?replaceContent=newLinesAndIndent():replaceContent=cachedSpaces[1];break;case 5:options.keepLines&&numberLineBreaks>0||!options.keepLines?replaceContent=newLinesAndIndent():replaceContent=cachedSpaces[1];break;case 12:replaceContent=newLinesAndIndent();break;case 13:numberLineBreaks>0?replaceContent=newLinesAndIndent():needsLineBreak||(replaceContent=cachedSpaces[1]);break;case 6:options.keepLines&&numberLineBreaks>0?replaceContent=newLinesAndIndent():needsLineBreak||(replaceContent=cachedSpaces[1]);break;case 10:options.keepLines&&numberLineBreaks>0?replaceContent=newLinesAndIndent():secondToken===6&&!needsLineBreak&&(replaceContent="");break;case 7:case 8:case 9:case 11:case 2:case 4:options.keepLines&&numberLineBreaks>0?replaceContent=newLinesAndIndent():(secondToken===12||secondToken===13)&&!needsLineBreak?replaceContent=cachedSpaces[1]:secondToken!==5&&secondToken!==17&&(hasError=!0);break;case 16:hasError=!0;break}numberLineBreaks>0&&(secondToken===12||secondToken===13)&&(replaceContent=newLinesAndIndent())}secondToken===17&&(options.keepLines&&numberLineBreaks>0?replaceContent=newLinesAndIndent():replaceContent=options.insertFinalNewline?eol:"");let secondTokenStart=scanner.getTokenOffset()+formatTextStart;addEdit(replaceContent,firstTokenEnd,secondTokenStart),firstToken=secondToken}return editOperations}function repeat(s,count){let result="";for(let i=0;i<count;i++)result+=s;return result}function computeIndentLevel(content,options){let i=0,nChars=0,tabSize=options.tabSize||4;for(;i<content.length;){let ch=content.charAt(i);if(ch===cachedSpaces[1])nChars++;else if(ch===" ")nChars+=tabSize;else break;i++}return Math.floor(nChars/tabSize)}function getEOL(options,text){for(let i=0;i<text.length;i++){let ch=text.charAt(i);if(ch==="\r")return i+1<text.length&&text.charAt(i+1)===`
|
|
16
|
+
`?`\r
|
|
17
|
+
`:"\r";if(ch===`
|
|
18
|
+
`)return`
|
|
19
|
+
`}return options&&options.eol||`
|
|
20
|
+
`}function isEOL(text,offset){return`\r
|
|
21
|
+
`.indexOf(text.charAt(offset))!==-1}var init_format=__esm({"../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/format.js"(){"use strict";init_scanner();init_string_intern()}});function parse(text,errors=[],options=ParseOptions.DEFAULT){let currentProperty=null,currentParent=[],previousParents=[];function onValue(value){Array.isArray(currentParent)?currentParent.push(value):currentProperty!==null&&(currentParent[currentProperty]=value)}return visit(text,{onObjectBegin:()=>{let object={};onValue(object),previousParents.push(currentParent),currentParent=object,currentProperty=null},onObjectProperty:name=>{currentProperty=name},onObjectEnd:()=>{currentParent=previousParents.pop()},onArrayBegin:()=>{let array=[];onValue(array),previousParents.push(currentParent),currentParent=array,currentProperty=null},onArrayEnd:()=>{currentParent=previousParents.pop()},onLiteralValue:onValue,onError:(error,offset,length)=>{errors.push({error,offset,length})}},options),currentParent[0]}function parseTree(text,errors=[],options=ParseOptions.DEFAULT){let currentParent={type:"array",offset:-1,length:-1,children:[],parent:void 0};function ensurePropertyComplete(endOffset){currentParent.type==="property"&&(currentParent.length=endOffset-currentParent.offset,currentParent=currentParent.parent)}function onValue(valueNode){return currentParent.children.push(valueNode),valueNode}visit(text,{onObjectBegin:offset=>{currentParent=onValue({type:"object",offset,length:-1,parent:currentParent,children:[]})},onObjectProperty:(name,offset,length)=>{currentParent=onValue({type:"property",offset,length:-1,parent:currentParent,children:[]}),currentParent.children.push({type:"string",value:name,offset,length,parent:currentParent})},onObjectEnd:(offset,length)=>{ensurePropertyComplete(offset+length),currentParent.length=offset+length-currentParent.offset,currentParent=currentParent.parent,ensurePropertyComplete(offset+length)},onArrayBegin:(offset,length)=>{currentParent=onValue({type:"array",offset,length:-1,parent:currentParent,children:[]})},onArrayEnd:(offset,length)=>{currentParent.length=offset+length-currentParent.offset,currentParent=currentParent.parent,ensurePropertyComplete(offset+length)},onLiteralValue:(value,offset,length)=>{onValue({type:getNodeType(value),offset,length,parent:currentParent,value}),ensurePropertyComplete(offset+length)},onSeparator:(sep,offset,length)=>{currentParent.type==="property"&&(sep===":"?currentParent.colonOffset=offset:sep===","&&ensurePropertyComplete(offset))},onError:(error,offset,length)=>{errors.push({error,offset,length})}},options);let result=currentParent.children[0];return result&&delete result.parent,result}function findNodeAtLocation(root,path){if(!root)return;let node=root;for(let segment of path)if(typeof segment=="string"){if(node.type!=="object"||!Array.isArray(node.children))return;let found=!1;for(let propertyNode of node.children)if(Array.isArray(propertyNode.children)&&propertyNode.children[0].value===segment&&propertyNode.children.length===2){node=propertyNode.children[1],found=!0;break}if(!found)return}else{let index=segment;if(node.type!=="array"||index<0||!Array.isArray(node.children)||index>=node.children.length)return;node=node.children[index]}return node}function visit(text,visitor,options=ParseOptions.DEFAULT){let _scanner=createScanner(text,!1),_jsonPath=[],suppressedCallbacks=0;function toNoArgVisit(visitFunction){return visitFunction?()=>suppressedCallbacks===0&&visitFunction(_scanner.getTokenOffset(),_scanner.getTokenLength(),_scanner.getTokenStartLine(),_scanner.getTokenStartCharacter()):()=>!0}function toOneArgVisit(visitFunction){return visitFunction?arg=>suppressedCallbacks===0&&visitFunction(arg,_scanner.getTokenOffset(),_scanner.getTokenLength(),_scanner.getTokenStartLine(),_scanner.getTokenStartCharacter()):()=>!0}function toOneArgVisitWithPath(visitFunction){return visitFunction?arg=>suppressedCallbacks===0&&visitFunction(arg,_scanner.getTokenOffset(),_scanner.getTokenLength(),_scanner.getTokenStartLine(),_scanner.getTokenStartCharacter(),()=>_jsonPath.slice()):()=>!0}function toBeginVisit(visitFunction){return visitFunction?()=>{suppressedCallbacks>0?suppressedCallbacks++:visitFunction(_scanner.getTokenOffset(),_scanner.getTokenLength(),_scanner.getTokenStartLine(),_scanner.getTokenStartCharacter(),()=>_jsonPath.slice())===!1&&(suppressedCallbacks=1)}:()=>!0}function toEndVisit(visitFunction){return visitFunction?()=>{suppressedCallbacks>0&&suppressedCallbacks--,suppressedCallbacks===0&&visitFunction(_scanner.getTokenOffset(),_scanner.getTokenLength(),_scanner.getTokenStartLine(),_scanner.getTokenStartCharacter())}:()=>!0}let onObjectBegin=toBeginVisit(visitor.onObjectBegin),onObjectProperty=toOneArgVisitWithPath(visitor.onObjectProperty),onObjectEnd=toEndVisit(visitor.onObjectEnd),onArrayBegin=toBeginVisit(visitor.onArrayBegin),onArrayEnd=toEndVisit(visitor.onArrayEnd),onLiteralValue=toOneArgVisitWithPath(visitor.onLiteralValue),onSeparator=toOneArgVisit(visitor.onSeparator),onComment=toNoArgVisit(visitor.onComment),onError=toOneArgVisit(visitor.onError),disallowComments=options&&options.disallowComments,allowTrailingComma=options&&options.allowTrailingComma;function scanNext(){for(;;){let token=_scanner.scan();switch(_scanner.getTokenError()){case 4:handleError(14);break;case 5:handleError(15);break;case 3:handleError(13);break;case 1:disallowComments||handleError(11);break;case 2:handleError(12);break;case 6:handleError(16);break}switch(token){case 12:case 13:disallowComments?handleError(10):onComment();break;case 16:handleError(1);break;case 15:case 14:break;default:return token}}}function handleError(error,skipUntilAfter=[],skipUntil=[]){if(onError(error),skipUntilAfter.length+skipUntil.length>0){let token=_scanner.getToken();for(;token!==17;){if(skipUntilAfter.indexOf(token)!==-1){scanNext();break}else if(skipUntil.indexOf(token)!==-1)break;token=scanNext()}}}function parseString(isValue){let value=_scanner.getTokenValue();return isValue?onLiteralValue(value):(onObjectProperty(value),_jsonPath.push(value)),scanNext(),!0}function parseLiteral(){switch(_scanner.getToken()){case 11:let tokenValue=_scanner.getTokenValue(),value=Number(tokenValue);isNaN(value)&&(handleError(2),value=0),onLiteralValue(value);break;case 7:onLiteralValue(null);break;case 8:onLiteralValue(!0);break;case 9:onLiteralValue(!1);break;default:return!1}return scanNext(),!0}function parseProperty(){return _scanner.getToken()!==10?(handleError(3,[],[2,5]),!1):(parseString(!1),_scanner.getToken()===6?(onSeparator(":"),scanNext(),parseValue()||handleError(4,[],[2,5])):handleError(5,[],[2,5]),_jsonPath.pop(),!0)}function parseObject(){onObjectBegin(),scanNext();let needsComma=!1;for(;_scanner.getToken()!==2&&_scanner.getToken()!==17;){if(_scanner.getToken()===5){if(needsComma||handleError(4,[],[]),onSeparator(","),scanNext(),_scanner.getToken()===2&&allowTrailingComma)break}else needsComma&&handleError(6,[],[]);parseProperty()||handleError(4,[],[2,5]),needsComma=!0}return onObjectEnd(),_scanner.getToken()!==2?handleError(7,[2],[]):scanNext(),!0}function parseArray(){onArrayBegin(),scanNext();let isFirstElement=!0,needsComma=!1;for(;_scanner.getToken()!==4&&_scanner.getToken()!==17;){if(_scanner.getToken()===5){if(needsComma||handleError(4,[],[]),onSeparator(","),scanNext(),_scanner.getToken()===4&&allowTrailingComma)break}else needsComma&&handleError(6,[],[]);isFirstElement?(_jsonPath.push(0),isFirstElement=!1):_jsonPath[_jsonPath.length-1]++,parseValue()||handleError(4,[],[4,5]),needsComma=!0}return onArrayEnd(),isFirstElement||_jsonPath.pop(),_scanner.getToken()!==4?handleError(8,[4],[]):scanNext(),!0}function parseValue(){switch(_scanner.getToken()){case 3:return parseArray();case 1:return parseObject();case 10:return parseString(!0);default:return parseLiteral()}}return scanNext(),_scanner.getToken()===17?options.allowEmptyContent?!0:(handleError(4,[],[]),!1):parseValue()?(_scanner.getToken()!==17&&handleError(9,[],[]),!0):(handleError(4,[],[]),!1)}function getNodeType(value){switch(typeof value){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(value){if(Array.isArray(value))return"array"}else return"null";return"object"}default:return"null"}}var ParseOptions,init_parser=__esm({"../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/parser.js"(){"use strict";init_scanner();(function(ParseOptions2){ParseOptions2.DEFAULT={allowTrailingComma:!1}})(ParseOptions||(ParseOptions={}))}});function setProperty(text,originalPath,value,options){let path=originalPath.slice(),root=parseTree(text,[]),parent,lastSegment;for(;path.length>0&&(lastSegment=path.pop(),parent=findNodeAtLocation(root,path),parent===void 0&&value!==void 0);)typeof lastSegment=="string"?value={[lastSegment]:value}:value=[value];if(parent)if(parent.type==="object"&&typeof lastSegment=="string"&&Array.isArray(parent.children)){let existing=findNodeAtLocation(parent,[lastSegment]);if(existing!==void 0)if(value===void 0){if(!existing.parent)throw new Error("Malformed AST");let propertyIndex=parent.children.indexOf(existing.parent),removeBegin,removeEnd=existing.parent.offset+existing.parent.length;if(propertyIndex>0){let previous=parent.children[propertyIndex-1];removeBegin=previous.offset+previous.length}else removeBegin=parent.offset+1,parent.children.length>1&&(removeEnd=parent.children[1].offset);return withFormatting(text,{offset:removeBegin,length:removeEnd-removeBegin,content:""},options)}else return withFormatting(text,{offset:existing.offset,length:existing.length,content:JSON.stringify(value)},options);else{if(value===void 0)return[];let newProperty=`${JSON.stringify(lastSegment)}: ${JSON.stringify(value)}`,index=options.getInsertionIndex?options.getInsertionIndex(parent.children.map(p=>p.children[0].value)):parent.children.length,edit;if(index>0){let previous=parent.children[index-1];edit={offset:previous.offset+previous.length,length:0,content:","+newProperty}}else parent.children.length===0?edit={offset:parent.offset+1,length:0,content:newProperty}:edit={offset:parent.offset+1,length:0,content:newProperty+","};return withFormatting(text,edit,options)}}else if(parent.type==="array"&&typeof lastSegment=="number"&&Array.isArray(parent.children)){let insertIndex=lastSegment;if(insertIndex===-1){let newProperty=`${JSON.stringify(value)}`,edit;if(parent.children.length===0)edit={offset:parent.offset+1,length:0,content:newProperty};else{let previous=parent.children[parent.children.length-1];edit={offset:previous.offset+previous.length,length:0,content:","+newProperty}}return withFormatting(text,edit,options)}else if(value===void 0&&parent.children.length>=0){let removalIndex=lastSegment,toRemove=parent.children[removalIndex],edit;if(parent.children.length===1)edit={offset:parent.offset+1,length:parent.length-2,content:""};else if(parent.children.length-1===removalIndex){let previous=parent.children[removalIndex-1],offset=previous.offset+previous.length,parentEndOffset=parent.offset+parent.length;edit={offset,length:parentEndOffset-2-offset,content:""}}else edit={offset:toRemove.offset,length:parent.children[removalIndex+1].offset-toRemove.offset,content:""};return withFormatting(text,edit,options)}else if(value!==void 0){let edit,newProperty=`${JSON.stringify(value)}`;if(!options.isArrayInsertion&&parent.children.length>lastSegment){let toModify=parent.children[lastSegment];edit={offset:toModify.offset,length:toModify.length,content:newProperty}}else if(parent.children.length===0||lastSegment===0)edit={offset:parent.offset+1,length:0,content:parent.children.length===0?newProperty:newProperty+","};else{let index=lastSegment>parent.children.length?parent.children.length:lastSegment,previous=parent.children[index-1];edit={offset:previous.offset+previous.length,length:0,content:","+newProperty}}return withFormatting(text,edit,options)}else throw new Error(`Can not ${value===void 0?"remove":options.isArrayInsertion?"insert":"modify"} Array index ${insertIndex} as length is not sufficient`)}else throw new Error(`Can not add ${typeof lastSegment!="number"?"index":"property"} to parent of type ${parent.type}`);else{if(value===void 0)throw new Error("Can not delete in empty document");return withFormatting(text,{offset:root?root.offset:0,length:root?root.length:0,content:JSON.stringify(value)},options)}}function withFormatting(text,edit,options){if(!options.formattingOptions)return[edit];let newText=applyEdit(text,edit),begin=edit.offset,end=edit.offset+edit.content.length;if(edit.length===0||edit.content.length===0){for(;begin>0&&!isEOL(newText,begin-1);)begin--;for(;end<newText.length&&!isEOL(newText,end);)end++}let edits=format(newText,{offset:begin,length:end-begin},{...options.formattingOptions,keepLines:!1});for(let i=edits.length-1;i>=0;i--){let edit2=edits[i];newText=applyEdit(newText,edit2),begin=Math.min(begin,edit2.offset),end=Math.max(end,edit2.offset+edit2.length),end+=edit2.content.length-edit2.length}let editLength=text.length-(newText.length-end)-begin;return[{offset:begin,length:editLength,content:newText.substring(begin,end)}]}function applyEdit(text,edit){return text.substring(0,edit.offset)+edit.content+text.substring(edit.offset+edit.length)}var init_edit=__esm({"../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/edit.js"(){"use strict";init_format();init_parser()}});function printParseErrorCode(code){switch(code){case 1:return"InvalidSymbol";case 2:return"InvalidNumberFormat";case 3:return"PropertyNameExpected";case 4:return"ValueExpected";case 5:return"ColonExpected";case 6:return"CommaExpected";case 7:return"CloseBraceExpected";case 8:return"CloseBracketExpected";case 9:return"EndOfFileExpected";case 10:return"InvalidCommentToken";case 11:return"UnexpectedEndOfComment";case 12:return"UnexpectedEndOfString";case 13:return"UnexpectedEndOfNumber";case 14:return"InvalidUnicode";case 15:return"InvalidEscapeCharacter";case 16:return"InvalidCharacter"}return"<unknown ParseErrorCode>"}function modify(text,path,value,options){return setProperty(text,path,value,options)}function applyEdits(text,edits){let sortedEdits=edits.slice(0).sort((a,b)=>{let diff=a.offset-b.offset;return diff===0?a.length-b.length:diff}),lastModifiedOffset=text.length;for(let i=sortedEdits.length-1;i>=0;i--){let e=sortedEdits[i];if(e.offset+e.length<=lastModifiedOffset)text=applyEdit(text,e);else throw new Error("Overlapping edit");lastModifiedOffset=e.offset}return text}var ScanError,SyntaxKind,parse2,ParseErrorCode,init_main=__esm({"../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/main.js"(){"use strict";init_format();init_edit();init_scanner();init_parser();(function(ScanError2){ScanError2[ScanError2.None=0]="None",ScanError2[ScanError2.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",ScanError2[ScanError2.UnexpectedEndOfString=2]="UnexpectedEndOfString",ScanError2[ScanError2.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",ScanError2[ScanError2.InvalidUnicode=4]="InvalidUnicode",ScanError2[ScanError2.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",ScanError2[ScanError2.InvalidCharacter=6]="InvalidCharacter"})(ScanError||(ScanError={}));(function(SyntaxKind2){SyntaxKind2[SyntaxKind2.OpenBraceToken=1]="OpenBraceToken",SyntaxKind2[SyntaxKind2.CloseBraceToken=2]="CloseBraceToken",SyntaxKind2[SyntaxKind2.OpenBracketToken=3]="OpenBracketToken",SyntaxKind2[SyntaxKind2.CloseBracketToken=4]="CloseBracketToken",SyntaxKind2[SyntaxKind2.CommaToken=5]="CommaToken",SyntaxKind2[SyntaxKind2.ColonToken=6]="ColonToken",SyntaxKind2[SyntaxKind2.NullKeyword=7]="NullKeyword",SyntaxKind2[SyntaxKind2.TrueKeyword=8]="TrueKeyword",SyntaxKind2[SyntaxKind2.FalseKeyword=9]="FalseKeyword",SyntaxKind2[SyntaxKind2.StringLiteral=10]="StringLiteral",SyntaxKind2[SyntaxKind2.NumericLiteral=11]="NumericLiteral",SyntaxKind2[SyntaxKind2.LineCommentTrivia=12]="LineCommentTrivia",SyntaxKind2[SyntaxKind2.BlockCommentTrivia=13]="BlockCommentTrivia",SyntaxKind2[SyntaxKind2.LineBreakTrivia=14]="LineBreakTrivia",SyntaxKind2[SyntaxKind2.Trivia=15]="Trivia",SyntaxKind2[SyntaxKind2.Unknown=16]="Unknown",SyntaxKind2[SyntaxKind2.EOF=17]="EOF"})(SyntaxKind||(SyntaxKind={}));parse2=parse;(function(ParseErrorCode2){ParseErrorCode2[ParseErrorCode2.InvalidSymbol=1]="InvalidSymbol",ParseErrorCode2[ParseErrorCode2.InvalidNumberFormat=2]="InvalidNumberFormat",ParseErrorCode2[ParseErrorCode2.PropertyNameExpected=3]="PropertyNameExpected",ParseErrorCode2[ParseErrorCode2.ValueExpected=4]="ValueExpected",ParseErrorCode2[ParseErrorCode2.ColonExpected=5]="ColonExpected",ParseErrorCode2[ParseErrorCode2.CommaExpected=6]="CommaExpected",ParseErrorCode2[ParseErrorCode2.CloseBraceExpected=7]="CloseBraceExpected",ParseErrorCode2[ParseErrorCode2.CloseBracketExpected=8]="CloseBracketExpected",ParseErrorCode2[ParseErrorCode2.EndOfFileExpected=9]="EndOfFileExpected",ParseErrorCode2[ParseErrorCode2.InvalidCommentToken=10]="InvalidCommentToken",ParseErrorCode2[ParseErrorCode2.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",ParseErrorCode2[ParseErrorCode2.UnexpectedEndOfString=12]="UnexpectedEndOfString",ParseErrorCode2[ParseErrorCode2.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",ParseErrorCode2[ParseErrorCode2.InvalidUnicode=14]="InvalidUnicode",ParseErrorCode2[ParseErrorCode2.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",ParseErrorCode2[ParseErrorCode2.InvalidCharacter=16]="InvalidCharacter"})(ParseErrorCode||(ParseErrorCode={}))}});export{parse2 as parse,printParseErrorCode,modify,applyEdits,init_main};
|