@farm.js/core 0.1.66 → 0.1.68
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/{agent-mcp-handler-QLFDDTYN.mjs → agent-mcp-handler-AZ7QW4UP.mjs} +5 -5
- package/dist/{agent-mcp-handler-OXT73ZBY.cjs → agent-mcp-handler-FER4MQDF.cjs} +6 -6
- package/dist/{agent-mcp.d-QD2WZ9BS.d.ts → agent-mcp.d-Uh5xr7aX.d.ts} +1 -1
- package/dist/{agent-mcp.d-CO_ABmNK.d.mts → agent-mcp.d-wkVPK1GA.d.mts} +1 -1
- package/dist/agent-runtime.cjs +6 -5
- package/dist/agent-runtime.d.mts +10 -8
- package/dist/agent-runtime.d.ts +10 -8
- package/dist/agent-runtime.mjs +5 -4
- package/dist/{analyzer-4UFP4HVP.mjs → analyzer-CQDU7E3Y.mjs} +2 -2
- package/dist/analyzer-PPAHM4AW.cjs +16 -0
- package/dist/api/client.cjs +12 -2
- package/dist/api/client.d.mts +4 -4
- package/dist/api/client.d.ts +4 -4
- package/dist/api/client.mjs +12 -2
- package/dist/api/client.native.cjs +12 -2
- package/dist/api/client.native.d.mts +5 -5
- package/dist/api/client.native.d.ts +5 -5
- package/dist/api/client.native.mjs +12 -2
- package/dist/api/node.cjs +223 -0
- package/dist/api/node.d.mts +61 -0
- package/dist/api/node.d.ts +61 -0
- package/dist/api/node.mjs +223 -0
- package/dist/api/route-manager.cjs +11 -11
- package/dist/api/route-manager.d.mts +14 -11
- package/dist/api/route-manager.d.ts +14 -11
- package/dist/api/route-manager.mjs +10 -10
- package/dist/api/runtime.cjs +11 -7
- package/dist/api/runtime.d.mts +11 -9
- package/dist/api/runtime.d.ts +11 -9
- package/dist/api/runtime.mjs +10 -6
- package/dist/{api-client.d-BNLXNCXJ.d.mts → api-client.d-Bp35zMqR.d.mts} +1 -1
- package/dist/{api-client.d-ddQBNGtu.d.ts → api-client.d-CFI_xL0V.d.ts} +1 -1
- package/dist/api.cjs +17 -13
- package/dist/api.d.mts +15 -12
- package/dist/api.d.ts +15 -12
- package/dist/api.mjs +16 -12
- package/dist/{app-manifest.d-DDmNkYQQ.d.ts → app-manifest.d-BT5i2F-o.d.ts} +1 -1
- package/dist/{app-manifest.d-BpKxiU_E.d.mts → app-manifest.d-Dd4q5CFx.d.mts} +1 -1
- package/dist/app-markdown.cjs +5 -5
- package/dist/app-markdown.d.mts +15 -15
- package/dist/app-markdown.d.ts +15 -15
- package/dist/app-markdown.mjs +4 -4
- package/dist/{app.d-x68Cwr0_.d.ts → app.d-BVOpL_f2.d.ts} +52 -11
- package/dist/{app.d-kuoVWhWM.d.mts → app.d-BhiDXex_.d.mts} +52 -11
- package/dist/{chunk-RY4ABNPE.cjs → chunk-225APHKC.cjs} +3 -3
- package/dist/{chunk-JGAE5XPL.cjs → chunk-23VJEGKC.cjs} +4 -2
- package/dist/{chunk-5C7XMKQ4.cjs → chunk-2AFW7673.cjs} +6 -1
- package/dist/{chunk-SYW346ZN.cjs → chunk-2LHZD3OP.cjs} +1 -21
- package/dist/{chunk-ZZI56IUY.mjs → chunk-2ZOYOYEE.mjs} +13 -13
- package/dist/{chunk-7XGWBPQQ.cjs → chunk-3EEINK7G.cjs} +24 -10
- package/dist/{chunk-BRWIVOV4.cjs → chunk-3GNHJ3RN.cjs} +10 -8
- package/dist/{chunk-HCGWDRZO.mjs → chunk-3Y52TWYU.mjs} +18 -7
- package/dist/{chunk-CBOEJ5Z4.cjs → chunk-437QZIC2.cjs} +133 -46
- package/dist/{chunk-O6L3YYPM.cjs → chunk-4E57QHPW.cjs} +8 -16
- package/dist/{chunk-WKPBIT5Q.cjs → chunk-4HGLJOXZ.cjs} +6 -6
- package/dist/{chunk-CJNAUEVC.mjs → chunk-4QENVMG7.mjs} +1 -1
- package/dist/{chunk-EMNKZGF4.mjs → chunk-4UAQB5LB.mjs} +556 -462
- package/dist/{chunk-BQWBHWEW.mjs → chunk-4ZXKYCYK.mjs} +1 -1
- package/dist/{chunk-N35YPV4N.mjs → chunk-57QAQU4F.mjs} +9 -7
- package/dist/{chunk-ZEXE4TGY.mjs → chunk-5FBZJJGA.mjs} +247 -110
- package/dist/{chunk-4OSOLDPL.cjs → chunk-5JKDFRTK.cjs} +2 -2
- package/dist/{chunk-OLIGNTWU.cjs → chunk-5NFQ6AZI.cjs} +7 -7
- package/dist/{chunk-6HRAK7I5.mjs → chunk-5OFNUETM.mjs} +8 -2
- package/dist/{chunk-RD623KW4.cjs → chunk-67MZTLTF.cjs} +21 -3
- package/dist/chunk-6I4BFRE7.cjs +51 -0
- package/dist/{chunk-UBMHQVWN.mjs → chunk-6OFOIMNS.mjs} +1 -1
- package/dist/{chunk-K5EW7GUU.mjs → chunk-7BIW7VCW.mjs} +13 -5
- package/dist/{chunk-CHYTADNK.cjs → chunk-7LK5CTUM.cjs} +70 -53
- package/dist/{chunk-HPP2II4Z.mjs → chunk-7PJARAQQ.mjs} +1 -1
- package/dist/{chunk-LEJDW34D.cjs → chunk-7PPLTD3P.cjs} +3 -3
- package/dist/{chunk-BYRZ5VTH.mjs → chunk-A3T445WK.mjs} +47 -34
- package/dist/{chunk-TGULJSHD.mjs → chunk-AJNBTOVQ.mjs} +20 -9
- package/dist/{chunk-FBEBSAVI.cjs → chunk-AKIQ54FK.cjs} +82 -63
- package/dist/{chunk-2NGZFOKG.mjs → chunk-AOIUYHPH.mjs} +2 -2
- package/dist/{chunk-NKRZLQUK.mjs → chunk-AQIO3RNL.mjs} +1 -1
- package/dist/chunk-AQIRXBBY.cjs +26 -0
- package/dist/{chunk-DQJ2CIH7.cjs → chunk-ASYOWPSR.cjs} +2 -1
- package/dist/chunk-AZ6IW6SF.mjs +28 -0
- package/dist/{chunk-QMDU6QHN.mjs → chunk-B6RBJJ5G.mjs} +1 -1
- package/dist/{chunk-I32V5CZL.cjs → chunk-BDYM2TN3.cjs} +28 -17
- package/dist/{chunk-JLDNXURZ.cjs → chunk-BZWTBELF.cjs} +32 -32
- package/dist/{chunk-ITV4QQL2.cjs → chunk-C6CUUBY5.cjs} +14 -3
- package/dist/{chunk-QGJ4FI2G.mjs → chunk-C6HGUTXB.mjs} +113 -29
- package/dist/{chunk-YN6BHOYY.cjs → chunk-CL52PD6D.cjs} +10 -3
- package/dist/{chunk-VQJHT2ND.mjs → chunk-CRVSYDHV.mjs} +2 -2
- package/dist/{chunk-XURDCXNH.cjs → chunk-CSLHNBPS.cjs} +6 -6
- package/dist/{chunk-XQSYOVCW.cjs → chunk-DBYNZIIQ.cjs} +13 -5
- package/dist/{chunk-AZUUKA66.mjs → chunk-DIXFKAPM.mjs} +1251 -389
- package/dist/{chunk-QTD6EMN2.mjs → chunk-DQ2DI3Y7.mjs} +11 -4
- package/dist/{chunk-NHQM2Q4I.cjs → chunk-DWLNLU55.cjs} +2 -2
- package/dist/chunk-DXZ57EPE.mjs +375 -0
- package/dist/{chunk-SA7MLSP4.mjs → chunk-E3HDJCWF.mjs} +3 -3
- package/dist/{chunk-52Y3C3HG.mjs → chunk-E7VF3LQ5.mjs} +3 -2
- package/dist/{chunk-752XUZIM.cjs → chunk-EGIY4A7V.cjs} +6 -6
- package/dist/chunk-EIVGPQN5.mjs +51 -0
- package/dist/{chunk-KPAJWD3N.mjs → chunk-EYPSKXO4.mjs} +1 -1
- package/dist/{chunk-E4UDLFWR.cjs → chunk-F36LS2C7.cjs} +796 -702
- package/dist/{chunk-MPIGW42F.mjs → chunk-F6CMGWAL.mjs} +1 -1
- package/dist/{chunk-GL7N5UHF.cjs → chunk-FJMC24KG.cjs} +21 -10
- package/dist/{chunk-QISW423S.cjs → chunk-FPBOAG6N.cjs} +2 -2
- package/dist/{chunk-3CCAICF7.cjs → chunk-FSODPZRT.cjs} +5 -5
- package/dist/{chunk-2C5L5RPM.cjs → chunk-FT6KJHS3.cjs} +71 -38
- package/dist/{chunk-WMTBBQHY.cjs → chunk-FVYBEMOD.cjs} +288 -151
- package/dist/{chunk-BM2LH2JM.mjs → chunk-G7NBPP7H.mjs} +14 -13
- package/dist/{chunk-ES2LD2YD.mjs → chunk-GCRT6GJG.mjs} +18 -0
- package/dist/{chunk-5OJVKXFV.cjs → chunk-GDM3ZD2O.cjs} +10 -8
- package/dist/{chunk-25T5VXOE.mjs → chunk-GFPS7MNE.mjs} +106 -19
- package/dist/{chunk-EMDGXYUD.mjs → chunk-GJ7QVFAG.mjs} +16 -7
- package/dist/{chunk-TGSEVBPO.mjs → chunk-GJEC5S4V.mjs} +11 -0
- package/dist/{chunk-HNAISJFD.cjs → chunk-HDPT6OYE.cjs} +9 -3
- package/dist/{chunk-RVGSVQWT.mjs → chunk-HEJM46HQ.mjs} +21 -7
- package/dist/chunk-HHLEYA4B.cjs +17 -0
- package/dist/{chunk-ZNH6NR3H.cjs → chunk-HJZZSBVK.cjs} +2 -2
- package/dist/{chunk-E552H232.cjs → chunk-I7J5RLGO.cjs} +16 -2
- package/dist/chunk-ICFPTHXM.mjs +97 -0
- package/dist/{chunk-K7OZAVOI.mjs → chunk-IFR74W6S.mjs} +46 -13
- package/dist/{chunk-MPJEIHW2.cjs → chunk-IGDYL2IA.cjs} +2 -2
- package/dist/{chunk-5A77OEIG.cjs → chunk-IHTDLCDJ.cjs} +5 -5
- package/dist/{chunk-OYZXVBZP.cjs → chunk-IUKBPBM7.cjs} +2 -1
- package/dist/chunk-J6TZRYCO.cjs +22 -0
- package/dist/{chunk-E4RDMG3K.mjs → chunk-JL2YW5KX.mjs} +5 -4
- package/dist/chunk-JSOCDYER.cjs +375 -0
- package/dist/{chunk-UPYIFH2H.cjs → chunk-JWLRBDDC.cjs} +2 -2
- package/dist/{chunk-OLGQZRW6.mjs → chunk-JZBU7V4D.mjs} +37 -17
- package/dist/{chunk-ONG4RDW3.mjs → chunk-JZGL2PIH.mjs} +13 -3
- package/dist/chunk-K63OWRY2.mjs +22 -0
- package/dist/{chunk-TUPKMMXT.mjs → chunk-K6HIIWUB.mjs} +1 -1
- package/dist/{chunk-MESQF2JC.mjs → chunk-K6SXMVXO.mjs} +2 -2
- package/dist/{chunk-L2JG337G.cjs → chunk-K6VFYFOY.cjs} +33 -31
- package/dist/{chunk-TKK5QHKZ.mjs → chunk-KDO6T6OB.mjs} +3 -3
- package/dist/{chunk-EZ34EHQP.mjs → chunk-KI3MU7B5.mjs} +1 -1
- package/dist/{chunk-GHNW564E.mjs → chunk-KSZK34HU.mjs} +30 -10
- package/dist/{chunk-IT6WRNGB.cjs → chunk-KWCZKJYU.cjs} +1541 -679
- package/dist/{chunk-DVKH2RVN.cjs → chunk-LDEXTX4I.cjs} +70 -57
- package/dist/{chunk-ECKQFEX2.mjs → chunk-LENKRGBV.mjs} +8 -6
- package/dist/{chunk-XBSKPLHF.cjs → chunk-LR4KP3I7.cjs} +2 -2
- package/dist/{chunk-HEPJIKKQ.cjs → chunk-MCSRMEQV.cjs} +2 -2
- package/dist/{chunk-DQF3QLOH.mjs → chunk-ME7RVELR.mjs} +3 -2
- package/dist/{chunk-VFXE6NWR.mjs → chunk-MGKWYPE3.mjs} +2 -1
- package/dist/{chunk-TZVUF5JJ.mjs → chunk-MGZVDX4R.mjs} +5 -5
- package/dist/{chunk-MGKW5XZE.cjs → chunk-MMDKYJ5V.cjs} +7 -7
- package/dist/{chunk-SK7QSNWE.mjs → chunk-MNJDNTGO.mjs} +1 -1
- package/dist/{chunk-5Y2P454O.cjs → chunk-MTBDJ326.cjs} +6 -5
- package/dist/{chunk-FIR62CR3.mjs → chunk-MV7NWU23.mjs} +1 -1
- package/dist/{chunk-7ONGIFYX.cjs → chunk-MZ4CRSY7.cjs} +481 -171
- package/dist/{chunk-O4F3JUST.mjs → chunk-NDDRTFN4.mjs} +4 -0
- package/dist/{chunk-4IHMHFQB.cjs → chunk-NG2EZ6QS.cjs} +28 -1
- package/dist/{chunk-XBSLKXBL.mjs → chunk-NT4W4H52.mjs} +52 -35
- package/dist/{chunk-UAQD67HM.mjs → chunk-NVOMQLI2.mjs} +16 -2
- package/dist/{chunk-R62SF5R4.mjs → chunk-OB45EAQL.mjs} +6 -1
- package/dist/{chunk-V56632LA.cjs → chunk-OCNV4CI2.cjs} +39 -6
- package/dist/{chunk-SYXPWJ7N.cjs → chunk-OFBLGH6V.cjs} +17 -18
- package/dist/{chunk-VQ4NWOWO.mjs → chunk-OGVTUGMU.mjs} +5 -13
- package/dist/{chunk-3UZVPO72.mjs → chunk-OIOPQ25L.mjs} +6 -7
- package/dist/{chunk-2XGBJSDV.cjs → chunk-OO7DYIJD.cjs} +73 -24
- package/dist/{chunk-27FPUFWR.mjs → chunk-P2NBQ5JI.mjs} +1 -1
- package/dist/{chunk-HZPKJRYA.cjs → chunk-PDFFYZAT.cjs} +2 -2
- package/dist/{chunk-GSVJ3IIF.cjs → chunk-PHCJJJZV.cjs} +2 -2
- package/dist/{chunk-EVMXPJCB.mjs → chunk-PKMUQ7LM.mjs} +2 -1
- package/dist/{chunk-OAJOQU5J.mjs → chunk-PLJKJJ2H.mjs} +82 -63
- package/dist/{chunk-72KCTHLV.cjs → chunk-PRL7FXG4.cjs} +113 -29
- package/dist/{chunk-6XQSPIN6.cjs → chunk-PWKAX5MS.cjs} +13 -3
- package/dist/{chunk-4ZJ5C7UJ.cjs → chunk-QIXEU2WV.cjs} +19 -10
- package/dist/{chunk-FJWN7RV4.cjs → chunk-QO43L7Z4.cjs} +38 -8
- package/dist/{chunk-X4K7TYN6.cjs → chunk-QOGIZKSO.cjs} +26 -25
- package/dist/{chunk-CNNBFGL5.cjs → chunk-QSUYB3RH.cjs} +14 -14
- package/dist/chunk-QYNZ3CTI.mjs +17 -0
- package/dist/{chunk-X3XUZWRB.mjs → chunk-R2ZHU37O.mjs} +36 -3
- package/dist/{chunk-ZIHWAN55.cjs → chunk-RE5E2G5S.cjs} +1 -1
- package/dist/{chunk-O75GQVUK.mjs → chunk-RLH5AH2M.mjs} +1 -1
- package/dist/chunk-RWR7SMD7.cjs +50 -0
- package/dist/{chunk-7PTISZSQ.cjs → chunk-S7MWSFFP.cjs} +4 -0
- package/dist/chunk-SD6JGJOM.mjs +50 -0
- package/dist/{chunk-7H4SVNC4.cjs → chunk-SPP3EZTJ.cjs} +46 -26
- package/dist/{chunk-BIF5MLTH.cjs → chunk-SQ6IWJ3H.cjs} +1 -1
- package/dist/{chunk-WVYRLP5E.mjs → chunk-T5XFZQCL.mjs} +1 -1
- package/dist/{chunk-WAY6LOQH.mjs → chunk-TEJ67GD2.mjs} +1 -1
- package/dist/{chunk-OP7LHY4Y.cjs → chunk-TNK2TVRS.cjs} +2005 -800
- package/dist/{chunk-IFTGERT3.mjs → chunk-TTXIITYA.mjs} +49 -0
- package/dist/{chunk-ZFWYCVKS.mjs → chunk-TY5KCYDE.mjs} +22 -4
- package/dist/{chunk-WYAXRIYP.cjs → chunk-UKZ6AWKZ.cjs} +10 -9
- package/dist/{chunk-UJ3R2AH2.cjs → chunk-UPOYKX4S.cjs} +5 -5
- package/dist/{chunk-VBCQ5WOI.cjs → chunk-URN7VFO7.cjs} +105 -16
- package/dist/{chunk-2DLGV2ZG.mjs → chunk-UTUS6JUH.mjs} +1 -21
- package/dist/{chunk-435QJNC2.mjs → chunk-VFNAK6A5.mjs} +4 -4
- package/dist/{chunk-WFWFECDW.mjs → chunk-VRGY3X2I.mjs} +100 -11
- package/dist/{chunk-LQNW3ABP.cjs → chunk-VX2HZGC7.cjs} +14 -14
- package/dist/chunk-W44X6IC2.cjs +97 -0
- package/dist/{chunk-A2MN5PQJ.mjs → chunk-WMLSZAKN.mjs} +9 -9
- package/dist/{chunk-672ISQIG.mjs → chunk-WPB67LE5.mjs} +379 -69
- package/dist/{chunk-3EEET2Q5.cjs → chunk-WUTFJOV7.cjs} +32 -12
- package/dist/chunk-WVQNXXNE.cjs +28 -0
- package/dist/{chunk-Y5TOT5F6.cjs → chunk-X3MHKLCO.cjs} +5 -5
- package/dist/{chunk-W2ZXMMHA.mjs → chunk-XCAQTCGK.mjs} +1 -1
- package/dist/{chunk-Z7P2BTZ3.cjs → chunk-XGTFLG73.cjs} +30 -12
- package/dist/{chunk-XCXHQBMM.mjs → chunk-Y2LU4LE5.mjs} +1 -1
- package/dist/{chunk-5J45H65F.mjs → chunk-Y5LEPEVH.mjs} +1 -1
- package/dist/{chunk-D4MRNBVF.cjs → chunk-Y6KHPJDB.cjs} +2 -2
- package/dist/{chunk-BT4SEFLC.cjs → chunk-YAEN3L2F.cjs} +3 -2
- package/dist/chunk-YFTGIHNC.mjs +26 -0
- package/dist/{chunk-KL7SHLQB.mjs → chunk-YGJ5P3TJ.mjs} +31 -1
- package/dist/{chunk-752IHQTD.cjs → chunk-YTNBCXCW.cjs} +12 -12
- package/dist/{chunk-RFKTJTWZ.mjs → chunk-YVPX5PI5.mjs} +3 -1
- package/dist/{chunk-4TVPYN32.cjs → chunk-Z3PW3DIR.cjs} +7 -7
- package/dist/{chunk-OB7VKCUZ.mjs → chunk-Z6SOXHAD.mjs} +1851 -646
- package/dist/{chunk-72KABRWN.mjs → chunk-ZJGFAW5U.mjs} +5 -3
- package/dist/{chunk-TNBJ4LZG.mjs → chunk-ZPKJPM7K.mjs} +4 -4
- package/dist/{chunk-5FE5YT2N.mjs → chunk-ZZGQD3LL.mjs} +28 -1
- package/dist/client/lifecycle.cjs +2 -2
- package/dist/client/lifecycle.d.mts +1 -1
- package/dist/client/lifecycle.d.ts +1 -1
- package/dist/client/lifecycle.mjs +1 -1
- package/dist/{client-component.d-D74pqdea.d.mts → client-component.d-BvQOxSqh.d.mts} +2 -2
- package/dist/{client-component.d-D8VcypQA.d.ts → client-component.d-DNVSLEPi.d.ts} +2 -2
- package/dist/client-plugins.cjs +2 -2
- package/dist/{client-plugins.d-D4-6hNx7.d.mts → client-plugins.d-CE1lVK2R.d.mts} +116 -373
- package/dist/{client-plugins.d-CXElzotB.d.ts → client-plugins.d-CNDqcAuf.d.ts} +116 -373
- package/dist/client-plugins.d.mts +10 -8
- package/dist/client-plugins.d.ts +10 -8
- package/dist/client-plugins.mjs +1 -1
- package/dist/client.cjs +11 -9
- package/dist/client.d.mts +17 -15
- package/dist/client.d.ts +17 -15
- package/dist/client.mjs +10 -8
- package/dist/{config.d-qt-mE8O5.d.mts → config.d-BKIhJtmr.d.mts} +7 -2
- package/dist/{config.d-qt-mE8O5.d.ts → config.d-BKIhJtmr.d.ts} +7 -2
- package/dist/config.d.mts +10 -8
- package/dist/config.d.ts +10 -8
- package/dist/cron.cjs +2 -2
- package/dist/cron.mjs +1 -1
- package/dist/deferred.cjs +2 -2
- package/dist/deferred.mjs +1 -1
- package/dist/deployment.cjs +4 -2
- package/dist/deployment.d.mts +15 -1
- package/dist/deployment.d.ts +15 -1
- package/dist/deployment.mjs +3 -1
- package/dist/desktop.d.mts +11 -9
- package/dist/desktop.d.ts +11 -9
- package/dist/{devtools-NZUVNUP3.mjs → devtools-2A2GPC7B.mjs} +33 -29
- package/dist/{devtools-N2JQCMXB.cjs → devtools-R27T3BRY.cjs} +38 -34
- package/dist/docs.cjs +28 -27
- package/dist/docs.d.mts +24 -10
- package/dist/docs.d.ts +24 -10
- package/dist/docs.mjs +27 -26
- package/dist/env-types.cjs +3 -3
- package/dist/env-types.mjs +2 -2
- package/dist/environment/vite.cjs +7 -7
- package/dist/environment/vite.d.mts +1 -1
- package/dist/environment/vite.d.ts +1 -1
- package/dist/environment/vite.mjs +6 -6
- package/dist/{generate-route-types.d-BL2pq6xC.d.ts → generate-route-types.d-B76M5R11.d.ts} +1 -1
- package/dist/{generate-route-types.d-BoVDU8qX.d.mts → generate-route-types.d-CaGMIaNI.d.mts} +1 -1
- package/dist/headers.cjs +3 -3
- package/dist/headers.mjs +2 -2
- package/dist/image/server.d.mts +1 -1
- package/dist/image/server.d.ts +1 -1
- package/dist/image/sharp.d.mts +1 -1
- package/dist/image/sharp.d.ts +1 -1
- package/dist/{image-config.d-CeDgNyX4.d.mts → image-config.d-ByhQ0TT7.d.mts} +3 -1
- package/dist/{image-config.d-CeDgNyX4.d.ts → image-config.d-ByhQ0TT7.d.ts} +3 -1
- package/dist/image.cjs +6 -6
- package/dist/image.d.mts +1 -1
- package/dist/image.d.ts +1 -1
- package/dist/image.mjs +1 -1
- package/dist/index.cjs +148 -128
- package/dist/{index.d-SSgYDv4D.d.mts → index.d-Bt3kl19W.d.mts} +1 -1
- package/dist/{index.d-A_x10zGS.d.ts → index.d-Cx_-DaKV.d.ts} +1 -1
- package/dist/index.d.mts +39 -87
- package/dist/index.d.ts +39 -87
- package/dist/index.mjs +224 -204
- package/dist/instrumentation.cjs +3 -3
- package/dist/instrumentation.mjs +2 -2
- package/dist/{integration-orm-52GPGTHO.cjs → integrations/orm.cjs} +5 -5
- package/dist/integrations/orm.d.mts +35 -0
- package/dist/integrations/orm.d.ts +35 -0
- package/dist/{integration-orm-CO23MSFE.mjs → integrations/orm.mjs} +5 -5
- package/dist/integrations.cjs +6 -5
- package/dist/integrations.d.mts +10 -8
- package/dist/integrations.d.ts +10 -8
- package/dist/integrations.mjs +5 -4
- package/dist/internal/app-markdown-runtime.cjs +4 -4
- package/dist/internal/app-markdown-runtime.d.mts +27 -11
- package/dist/internal/app-markdown-runtime.d.ts +27 -11
- package/dist/internal/app-markdown-runtime.mjs +3 -3
- package/dist/internal/build-runtime.cjs +76 -71
- package/dist/internal/build-runtime.d.mts +12 -10
- package/dist/internal/build-runtime.d.ts +12 -10
- package/dist/internal/build-runtime.mjs +75 -70
- package/dist/internal/cli-runtime.cjs +47 -46
- package/dist/internal/cli-runtime.mjs +46 -45
- package/dist/internal/client-error-overlay.cjs +6 -6
- package/dist/internal/client-error-overlay.mjs +2 -2
- package/dist/internal/client-runtime.cjs +85 -36
- package/dist/internal/client-runtime.d.mts +44 -13
- package/dist/internal/client-runtime.d.ts +44 -13
- package/dist/internal/client-runtime.mjs +79 -30
- package/dist/internal/compression-runtime.d.mts +10 -8
- package/dist/internal/compression-runtime.d.ts +10 -8
- package/dist/internal/config-runtime.cjs +27 -26
- package/dist/internal/config-runtime.d.mts +14 -12
- package/dist/internal/config-runtime.d.ts +14 -12
- package/dist/internal/config-runtime.mjs +26 -25
- package/dist/internal/docs-precompiled-runtime.cjs +16 -5
- package/dist/internal/docs-precompiled-runtime.d.mts +7 -0
- package/dist/internal/docs-precompiled-runtime.d.ts +7 -0
- package/dist/internal/docs-precompiled-runtime.mjs +15 -4
- package/dist/internal/form-actions.cjs +7 -2
- package/dist/internal/form-actions.d.mts +10 -3
- package/dist/internal/form-actions.d.ts +10 -3
- package/dist/internal/form-actions.mjs +8 -3
- package/dist/internal/infra-analytics-runtime.cjs +11 -11
- package/dist/internal/infra-analytics-runtime.mjs +9 -9
- package/dist/internal/islands-boot.cjs +6 -1
- package/dist/internal/islands-boot.mjs +6 -1
- package/dist/internal/islands-runtime.cjs +33 -4
- package/dist/internal/islands-runtime.d.mts +1 -1
- package/dist/internal/islands-runtime.d.ts +1 -1
- package/dist/internal/islands-runtime.mjs +31 -2
- package/dist/internal/native-server-fns.cjs +5 -5
- package/dist/internal/native-server-fns.mjs +4 -4
- package/dist/internal/product-telemetry-runtime.cjs +3 -3
- package/dist/internal/product-telemetry-runtime.mjs +2 -2
- package/dist/internal/production-node-env.cjs +4 -2
- package/dist/internal/production-node-env.d.mts +22 -1
- package/dist/internal/production-node-env.d.ts +22 -1
- package/dist/internal/production-node-env.mjs +3 -1
- package/dist/internal/production-runtime.cjs +57 -39
- package/dist/internal/production-runtime.d.mts +27 -21
- package/dist/internal/production-runtime.d.ts +27 -21
- package/dist/internal/production-runtime.mjs +72 -54
- package/dist/internal/react-cache.cjs +3 -3
- package/dist/internal/react-cache.mjs +1 -1
- package/dist/internal/server-tree.cjs +2 -2
- package/dist/internal/server-tree.d.mts +0 -5
- package/dist/internal/server-tree.d.ts +0 -5
- package/dist/internal/server-tree.mjs +1 -1
- package/dist/internal/vercel-edge-middleware.cjs +87 -0
- package/dist/internal/vercel-edge-middleware.d.mts +39 -0
- package/dist/internal/vercel-edge-middleware.d.ts +39 -0
- package/dist/internal/vercel-edge-middleware.mjs +87 -0
- package/dist/layers-7P4RLKVX.cjs +20 -0
- package/dist/{layers-T55SA47E.mjs → layers-XQ7VFMWO.mjs} +4 -2
- package/dist/{layers.d-CcS42OGR.d.mts → layers.d-CH0bC4QL.d.mts} +2 -1
- package/dist/{layers.d-CcS42OGR.d.ts → layers.d-CH0bC4QL.d.ts} +2 -1
- package/dist/{lifecycle.d-C2aLBOwu.d.ts → lifecycle.d-keQs5Swc.d.mts} +7 -1
- package/dist/{lifecycle.d-C2aLBOwu.d.mts → lifecycle.d-keQs5Swc.d.ts} +7 -1
- package/dist/{manager-H5ZM3HAM.mjs → manager-JIA66YJ2.mjs} +4 -3
- package/dist/manager-JOHU6BQI.cjs +15 -0
- package/dist/markdown.cjs +7 -3
- package/dist/markdown.d.mts +10 -8
- package/dist/markdown.d.ts +10 -8
- package/dist/markdown.mjs +6 -2
- package/dist/middleware.cjs +11 -11
- package/dist/middleware.d.mts +13 -10
- package/dist/middleware.d.ts +13 -10
- package/dist/middleware.mjs +13 -13
- package/dist/mobile.d.mts +6 -6
- package/dist/mobile.d.ts +6 -6
- package/dist/mount.d-Bki4pOaJ.d.mts +38 -0
- package/dist/mount.d-DjR5aerM.d.ts +38 -0
- package/dist/{native-server-fn-handler-GLRHAYWV.mjs → native-server-fn-handler-EP5AFJYE.mjs} +5 -5
- package/dist/{native-server-fn-handler-J5MYRXN6.cjs → native-server-fn-handler-QRTXGZA4.cjs} +6 -6
- package/dist/{native-tree-7LPH57Z4.cjs → native-tree-W2SSJB3Y.cjs} +4 -4
- package/dist/{native-tree-VV6WN3GX.mjs → native-tree-Y5YQANW7.mjs} +3 -3
- package/dist/{navigation-delegate.d-GghbHJuK.d.ts → navigation-delegate.d-CtghaSP3.d.ts} +1 -1
- package/dist/{navigation-delegate.d-DQVYKoaZ.d.mts → navigation-delegate.d-VDkziXTK.d.mts} +1 -1
- package/dist/navigation.cjs +8 -7
- package/dist/navigation.d.mts +13 -11
- package/dist/navigation.d.ts +13 -11
- package/dist/navigation.mjs +7 -6
- package/dist/{nitro-DD4QCA66.mjs → nitro-NSTXT7LB.mjs} +11 -11
- package/dist/{nitro-VRDX2H4M.cjs → nitro-Y3LGITW3.cjs} +13 -13
- package/dist/node-module-bundle-LIZ2KMVW.cjs +13 -0
- package/dist/node-module-bundle-VR6NV6AI.mjs +13 -0
- package/dist/{plugin-53SY5YBS.mjs → plugin-SAS22JL7.mjs} +4 -3
- package/dist/{plugin-HZIBL3DW.cjs → plugin-WIU4GDD4.cjs} +5 -4
- package/dist/plugin.cjs +65 -63
- package/dist/plugin.d.mts +12 -10
- package/dist/plugin.d.ts +12 -10
- package/dist/plugin.mjs +64 -62
- package/dist/{production-runtime.d-Bzns3NW9.d.ts → production-runtime.d-BMyyLGBB.d.ts} +3 -57
- package/dist/{production-runtime.d-DiFa5vHW.d.mts → production-runtime.d-DMZY3OgV.d.mts} +3 -57
- package/dist/query/client.cjs +9 -7
- package/dist/query/client.mjs +5 -3
- package/dist/{render-plan.d-CcF0MeCf.d.mts → render-plan.d-BSwV8PE4.d.mts} +1 -1
- package/dist/{render-plan.d-CL_Ikfg_.d.ts → render-plan.d-i9sI4tc9.d.ts} +1 -1
- package/dist/renderer/none/server.cjs +35 -0
- package/dist/renderer/none/server.d.mts +21 -0
- package/dist/renderer/none/server.d.ts +21 -0
- package/dist/renderer/none/server.mjs +35 -0
- package/dist/renderer/react/server.cjs +3 -3
- package/dist/renderer/react/server.mjs +3 -3
- package/dist/renderer-client.cjs +8 -6
- package/dist/renderer-client.d.mts +13 -11
- package/dist/renderer-client.d.ts +13 -11
- package/dist/renderer-client.mjs +5 -3
- package/dist/renderer.cjs +6 -2
- package/dist/renderer.d.mts +25 -2
- package/dist/renderer.d.ts +25 -2
- package/dist/renderer.mjs +5 -1
- package/dist/request.cjs +2 -2
- package/dist/{request.d-DarDOCk9.d.mts → request.d-C24FNQ_7.d.mts} +1 -1
- package/dist/{request.d-B1RnTLri.d.ts → request.d-Dgln8tuI.d.ts} +1 -1
- package/dist/request.d.mts +11 -9
- package/dist/request.d.ts +11 -9
- package/dist/request.mjs +1 -1
- package/dist/{route-rendering.d-BTUYCIj4.d.ts → route-rendering.d-CUylZKJA.d.ts} +1 -1
- package/dist/{route-rendering.d-D_2Ual0-.d.mts → route-rendering.d-Ds0BfwQi.d.mts} +1 -1
- package/dist/{route.d-BaVH3V0w.d.mts → route.d-DrXkpvcg.d.mts} +1 -1
- package/dist/{route.d-DBTEqifW.d.ts → route.d-hs-_cyHn.d.ts} +1 -1
- package/dist/{router.d-CMANF6da.d.ts → router.d-B56rMOFm.d.ts} +1 -1
- package/dist/{router.d-Cuv1jntg.d.mts → router.d-CFPcbqzc.d.mts} +1 -1
- package/dist/routes.cjs +3 -3
- package/dist/{routes.d-B6yFe6jm.d.ts → routes.d-9GFFNioh.d.ts} +2 -2
- package/dist/{routes.d-c2HKfrfL.d.mts → routes.d-CrEy0lJS.d.mts} +2 -2
- package/dist/routes.d.mts +10 -8
- package/dist/routes.d.ts +10 -8
- package/dist/routes.mjs +2 -2
- package/dist/{rsc-pipeline-Z7QBZOIJ.cjs → rsc-pipeline-3T7V6OUT.cjs} +30 -28
- package/dist/{rsc-pipeline-7PNVJSTR.mjs → rsc-pipeline-GA4AQWZI.mjs} +29 -27
- package/dist/{runtime-FKFCUHSK.cjs → runtime-REUTNTI5.cjs} +72 -46
- package/dist/{runtime-QQHX4BP3.mjs → runtime-ZYCKKY7L.mjs} +60 -34
- package/dist/{runtime.d-wvh4ngU0.d.mts → runtime.d-DLRO-ExG.d.mts} +11 -3
- package/dist/{runtime.d-C3RQUj6_.d.ts → runtime.d-H7k9hOQE.d.ts} +11 -3
- package/dist/{schema-dev-notice-JMXEQWIQ.mjs → schema-dev-notice-C2JINRZI.mjs} +3 -2
- package/dist/{schema-dev-notice-PLBFDTOF.cjs → schema-dev-notice-X7GG7QVB.cjs} +5 -4
- package/dist/schema.cjs +6 -2
- package/dist/schema.d-Dny9pnrm.d.mts +298 -0
- package/dist/schema.d-Dny9pnrm.d.ts +298 -0
- package/dist/schema.d.mts +1 -115
- package/dist/schema.d.ts +1 -115
- package/dist/schema.mjs +5 -1
- package/dist/server-fn-client.d.mts +2 -2
- package/dist/server-fn-client.d.ts +2 -2
- package/dist/server-fn.cjs +5 -5
- package/dist/server-fn.mjs +4 -4
- package/dist/server-http.d-rAe7lAQc.d.mts +70 -0
- package/dist/server-http.d-rAe7lAQc.d.ts +70 -0
- package/dist/server-plugins.cjs +7 -7
- package/dist/server-plugins.d.mts +20 -12
- package/dist/server-plugins.d.ts +20 -12
- package/dist/server-plugins.mjs +8 -8
- package/dist/server-query.cjs +6 -6
- package/dist/server-query.mjs +5 -5
- package/dist/server.cjs +168 -126
- package/dist/server.d-C5FFrZAo.d.ts +57 -0
- package/dist/server.d-DgC8xew5.d.mts +57 -0
- package/dist/server.d.mts +24 -16
- package/dist/server.d.ts +24 -16
- package/dist/server.mjs +144 -102
- package/dist/{spa-router.d-m8H_Kl_B.d.ts → spa-router.d-Dr7oanhl.d.ts} +15 -5
- package/dist/{spa-router.d-WU_qS5gJ.d.mts → spa-router.d-g4CzhEH1.d.mts} +15 -5
- package/dist/testing.cjs +17 -17
- package/dist/testing.d.mts +10 -8
- package/dist/testing.d.ts +10 -8
- package/dist/testing.mjs +13 -13
- package/dist/theme/server.cjs +3 -3
- package/dist/theme/server.mjs +2 -2
- package/dist/types.d-xCIhyjOq.d.mts +233 -0
- package/dist/types.d-xCIhyjOq.d.ts +233 -0
- package/dist/{utils.d-C9dQD5Zg.d.ts → utils.d-BxxyDEb8.d.ts} +1 -1
- package/dist/{utils.d-W9IiEqmW.d.mts → utils.d-HIla3pD_.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +65 -63
- package/dist/vite.d.mts +36 -14
- package/dist/vite.d.ts +36 -14
- package/dist/vite.mjs +64 -62
- package/dist/workflows.cjs +4 -4
- package/dist/workflows.d.mts +121 -1
- package/dist/workflows.d.ts +121 -1
- package/dist/workflows.mjs +3 -3
- package/package.json +37 -2
- package/dist/analyzer-H7SIX6BJ.cjs +0 -16
- package/dist/chunk-5YPBFMBN.cjs +0 -19
- package/dist/chunk-CLFEQGET.cjs +0 -60
- package/dist/chunk-MK5E44WP.mjs +0 -60
- package/dist/chunk-OM7WILES.mjs +0 -100
- package/dist/chunk-Q5B4LNON.mjs +0 -19
- package/dist/chunk-QPJ4MZTO.mjs +0 -60
- package/dist/chunk-R53QDV6T.cjs +0 -100
- package/dist/chunk-UYTAP4FQ.cjs +0 -60
- package/dist/layers-DMRXRL7F.cjs +0 -18
- package/dist/manager-2LUKNX2N.cjs +0 -14
- package/dist/node-module-bundle-7JHPPF6B.mjs +0 -11
- package/dist/node-module-bundle-YJGYBOGK.cjs +0 -11
- package/dist/workflows.d-CRMzQZ3k.d.mts +0 -188
- package/dist/workflows.d-CRMzQZ3k.d.ts +0 -188
- /package/dist/{chunk-QGOZLGVP.mjs → chunk-I6FIAWNT.mjs} +0 -0
- /package/dist/{chunk-XPIPMWY3.cjs → chunk-K5NI5YQR.cjs} +0 -0
- /package/dist/{chunk-NWUHS6GV.cjs → chunk-QEJWNXRI.cjs} +0 -0
- /package/dist/{chunk-FSXSQQTV.mjs → chunk-TXE4SAMV.mjs} +0 -0
- /package/dist/{chunk-ZXK2EYQW.cjs → chunk-UUQNJDGH.cjs} +0 -0
- /package/dist/{chunk-46P5KNTE.mjs → chunk-VZBAW44S.mjs} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
@@ -28,38 +28,42 @@ var _chunk5IQ2ERQAcjs = require('./chunk-5IQ2ERQA.cjs');
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
var _chunkE4UDLFWRcjs = require('./chunk-E4UDLFWR.cjs');
|
|
32
31
|
|
|
33
32
|
|
|
34
|
-
var
|
|
33
|
+
var _chunkF36LS2C7cjs = require('./chunk-F36LS2C7.cjs');
|
|
35
34
|
|
|
36
35
|
|
|
37
|
-
|
|
36
|
+
|
|
37
|
+
var _chunkJSOCDYERcjs = require('./chunk-JSOCDYER.cjs');
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
var _chunkWUTFJOV7cjs = require('./chunk-WUTFJOV7.cjs');
|
|
38
41
|
|
|
39
42
|
|
|
40
43
|
var _chunkAQLHD6HZcjs = require('./chunk-AQLHD6HZ.cjs');
|
|
41
44
|
|
|
42
45
|
|
|
43
46
|
|
|
44
|
-
var
|
|
47
|
+
var _chunkQOGIZKSOcjs = require('./chunk-QOGIZKSO.cjs');
|
|
45
48
|
|
|
46
49
|
|
|
47
50
|
|
|
48
51
|
|
|
52
|
+
var _chunkPIUTGRDIcjs = require('./chunk-PIUTGRDI.cjs');
|
|
49
53
|
|
|
50
54
|
|
|
51
55
|
|
|
52
56
|
|
|
53
57
|
|
|
54
58
|
|
|
55
|
-
var _chunkUJ3R2AH2cjs = require('./chunk-UJ3R2AH2.cjs');
|
|
56
59
|
|
|
57
60
|
|
|
58
|
-
var _chunk3HLQTOVUcjs = require('./chunk-3HLQTOVU.cjs');
|
|
59
61
|
|
|
60
62
|
|
|
63
|
+
var _chunkUPOYKX4Scjs = require('./chunk-UPOYKX4S.cjs');
|
|
61
64
|
|
|
62
65
|
|
|
66
|
+
var _chunk3HLQTOVUcjs = require('./chunk-3HLQTOVU.cjs');
|
|
63
67
|
|
|
64
68
|
|
|
65
69
|
|
|
@@ -70,18 +74,17 @@ var _chunk3HLQTOVUcjs = require('./chunk-3HLQTOVU.cjs');
|
|
|
70
74
|
|
|
71
75
|
|
|
72
76
|
|
|
73
|
-
var _chunk752IHQTDcjs = require('./chunk-752IHQTD.cjs');
|
|
74
77
|
|
|
75
78
|
|
|
76
|
-
var _chunkY5TOT5F6cjs = require('./chunk-Y5TOT5F6.cjs');
|
|
77
79
|
|
|
78
80
|
|
|
79
|
-
var
|
|
81
|
+
var _chunkYTNBCXCWcjs = require('./chunk-YTNBCXCW.cjs');
|
|
80
82
|
|
|
81
83
|
|
|
84
|
+
var _chunkX3MHKLCOcjs = require('./chunk-X3MHKLCO.cjs');
|
|
82
85
|
|
|
83
86
|
|
|
84
|
-
var
|
|
87
|
+
var _chunkIGDYL2IAcjs = require('./chunk-IGDYL2IA.cjs');
|
|
85
88
|
|
|
86
89
|
|
|
87
90
|
var _chunk7EPYN7GWcjs = require('./chunk-7EPYN7GW.cjs');
|
|
@@ -110,7 +113,13 @@ var _chunk7EPYN7GWcjs = require('./chunk-7EPYN7GW.cjs');
|
|
|
110
113
|
|
|
111
114
|
|
|
112
115
|
|
|
113
|
-
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
var _chunkMZ4CRSY7cjs = require('./chunk-MZ4CRSY7.cjs');
|
|
114
123
|
|
|
115
124
|
|
|
116
125
|
|
|
@@ -124,6 +133,9 @@ var _chunkERMUL73Lcjs = require('./chunk-ERMUL73L.cjs');
|
|
|
124
133
|
var _chunkUVV3I5QAcjs = require('./chunk-UVV3I5QA.cjs');
|
|
125
134
|
|
|
126
135
|
|
|
136
|
+
var _chunkOCNV4CI2cjs = require('./chunk-OCNV4CI2.cjs');
|
|
137
|
+
|
|
138
|
+
|
|
127
139
|
|
|
128
140
|
|
|
129
141
|
var _chunkSTF6VDYQcjs = require('./chunk-STF6VDYQ.cjs');
|
|
@@ -131,18 +143,18 @@ var _chunkSTF6VDYQcjs = require('./chunk-STF6VDYQ.cjs');
|
|
|
131
143
|
|
|
132
144
|
|
|
133
145
|
|
|
134
|
-
var
|
|
146
|
+
var _chunk4E57QHPWcjs = require('./chunk-4E57QHPW.cjs');
|
|
135
147
|
|
|
136
148
|
|
|
137
|
-
var
|
|
149
|
+
var _chunkQO43L7Z4cjs = require('./chunk-QO43L7Z4.cjs');
|
|
138
150
|
|
|
139
151
|
|
|
140
|
-
var
|
|
152
|
+
var _chunkRE5E2G5Scjs = require('./chunk-RE5E2G5S.cjs');
|
|
141
153
|
|
|
142
154
|
|
|
143
155
|
|
|
144
156
|
|
|
145
|
-
var
|
|
157
|
+
var _chunkMTBDJ326cjs = require('./chunk-MTBDJ326.cjs');
|
|
146
158
|
|
|
147
159
|
|
|
148
160
|
|
|
@@ -151,20 +163,20 @@ var _chunk5Y2P454Ocjs = require('./chunk-5Y2P454O.cjs');
|
|
|
151
163
|
|
|
152
164
|
|
|
153
165
|
|
|
154
|
-
var _chunkRD623KW4cjs = require('./chunk-RD623KW4.cjs');
|
|
155
166
|
|
|
167
|
+
var _chunk67MZTLTFcjs = require('./chunk-67MZTLTF.cjs');
|
|
156
168
|
|
|
157
169
|
|
|
158
|
-
var _chunkHEPJIKKQcjs = require('./chunk-HEPJIKKQ.cjs');
|
|
159
170
|
|
|
171
|
+
var _chunkMCSRMEQVcjs = require('./chunk-MCSRMEQV.cjs');
|
|
160
172
|
|
|
161
|
-
var _chunk3EIPOTZVcjs = require('./chunk-3EIPOTZV.cjs');
|
|
162
173
|
|
|
174
|
+
var _chunk3EIPOTZVcjs = require('./chunk-3EIPOTZV.cjs');
|
|
163
175
|
|
|
164
176
|
|
|
165
177
|
|
|
166
|
-
var _chunk7XGWBPQQcjs = require('./chunk-7XGWBPQQ.cjs');
|
|
167
178
|
|
|
179
|
+
var _chunk3EEINK7Gcjs = require('./chunk-3EEINK7G.cjs');
|
|
168
180
|
|
|
169
181
|
|
|
170
182
|
|
|
@@ -172,21 +184,21 @@ var _chunk7XGWBPQQcjs = require('./chunk-7XGWBPQQ.cjs');
|
|
|
172
184
|
|
|
173
185
|
|
|
174
186
|
|
|
175
|
-
var
|
|
187
|
+
var _chunkFT6KJHS3cjs = require('./chunk-FT6KJHS3.cjs');
|
|
176
188
|
|
|
177
189
|
|
|
178
190
|
|
|
179
|
-
var _chunkX333W5KVcjs = require('./chunk-X333W5KV.cjs');
|
|
180
191
|
|
|
181
192
|
|
|
182
193
|
|
|
194
|
+
var _chunkBDYM2TN3cjs = require('./chunk-BDYM2TN3.cjs');
|
|
183
195
|
|
|
184
196
|
|
|
185
197
|
|
|
186
|
-
var
|
|
198
|
+
var _chunkX333W5KVcjs = require('./chunk-X333W5KV.cjs');
|
|
187
199
|
|
|
188
200
|
|
|
189
|
-
var
|
|
201
|
+
var _chunkVX2HZGC7cjs = require('./chunk-VX2HZGC7.cjs');
|
|
190
202
|
|
|
191
203
|
|
|
192
204
|
|
|
@@ -202,7 +214,7 @@ var _chunkKBGZ5FD6cjs = require('./chunk-KBGZ5FD6.cjs');
|
|
|
202
214
|
var _chunkP2355C6Ecjs = require('./chunk-P2355C6E.cjs');
|
|
203
215
|
|
|
204
216
|
|
|
205
|
-
var
|
|
217
|
+
var _chunkOFBLGH6Vcjs = require('./chunk-OFBLGH6V.cjs');
|
|
206
218
|
|
|
207
219
|
|
|
208
220
|
var _chunkRVGLYMJMcjs = require('./chunk-RVGLYMJM.cjs');
|
|
@@ -212,7 +224,9 @@ var _chunkRVGLYMJMcjs = require('./chunk-RVGLYMJM.cjs');
|
|
|
212
224
|
var _chunkKORZ6PREcjs = require('./chunk-KORZ6PRE.cjs');
|
|
213
225
|
|
|
214
226
|
|
|
215
|
-
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
var _chunkXGTFLG73cjs = require('./chunk-XGTFLG73.cjs');
|
|
216
230
|
|
|
217
231
|
|
|
218
232
|
var _chunkLRB5OVRTcjs = require('./chunk-LRB5OVRT.cjs');
|
|
@@ -228,6 +242,11 @@ var _chunkY3WG64CPcjs = require('./chunk-Y3WG64CP.cjs');
|
|
|
228
242
|
|
|
229
243
|
|
|
230
244
|
|
|
245
|
+
var _chunkYIHRZBD7cjs = require('./chunk-YIHRZBD7.cjs');
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
231
250
|
var _chunkJYNNIGQOcjs = require('./chunk-JYNNIGQO.cjs');
|
|
232
251
|
|
|
233
252
|
|
|
@@ -240,33 +259,32 @@ var _chunkLNVGXUL3cjs = require('./chunk-LNVGXUL3.cjs');
|
|
|
240
259
|
var _chunkQMNWKQL4cjs = require('./chunk-QMNWKQL4.cjs');
|
|
241
260
|
|
|
242
261
|
|
|
243
|
-
|
|
244
|
-
var _chunkSUCDVKUBcjs = require('./chunk-SUCDVKUB.cjs');
|
|
262
|
+
var _chunk2OF5RPVUcjs = require('./chunk-2OF5RPVU.cjs');
|
|
245
263
|
|
|
246
264
|
|
|
247
265
|
|
|
248
|
-
var _chunkEVIWKPJVcjs = require('./chunk-EVIWKPJV.cjs');
|
|
249
266
|
|
|
250
267
|
|
|
251
268
|
|
|
269
|
+
var _chunkCFG4QERRcjs = require('./chunk-CFG4QERR.cjs');
|
|
252
270
|
|
|
253
|
-
var _chunkYIHRZBD7cjs = require('./chunk-YIHRZBD7.cjs');
|
|
254
271
|
|
|
255
272
|
|
|
256
|
-
var
|
|
273
|
+
var _chunkSUCDVKUBcjs = require('./chunk-SUCDVKUB.cjs');
|
|
257
274
|
|
|
258
275
|
|
|
259
276
|
|
|
277
|
+
var _chunkEVIWKPJVcjs = require('./chunk-EVIWKPJV.cjs');
|
|
260
278
|
|
|
261
279
|
|
|
280
|
+
var _chunkSQ6IWJ3Hcjs = require('./chunk-SQ6IWJ3H.cjs');
|
|
262
281
|
|
|
263
|
-
var _chunkCFG4QERRcjs = require('./chunk-CFG4QERR.cjs');
|
|
264
282
|
|
|
283
|
+
var _chunkPMJSG4JScjs = require('./chunk-PMJSG4JS.cjs');
|
|
265
284
|
|
|
266
|
-
var _chunkBIF5MLTHcjs = require('./chunk-BIF5MLTH.cjs');
|
|
267
285
|
|
|
268
286
|
|
|
269
|
-
var
|
|
287
|
+
var _chunkRWR7SMD7cjs = require('./chunk-RWR7SMD7.cjs');
|
|
270
288
|
|
|
271
289
|
|
|
272
290
|
|
|
@@ -276,19 +294,24 @@ var _chunk6IOZPJ3Icjs = require('./chunk-6IOZPJ3I.cjs');
|
|
|
276
294
|
|
|
277
295
|
|
|
278
296
|
|
|
279
|
-
var _chunkE552H232cjs = require('./chunk-E552H232.cjs');
|
|
280
297
|
|
|
298
|
+
var _chunkI7J5RLGOcjs = require('./chunk-I7J5RLGO.cjs');
|
|
281
299
|
|
|
282
|
-
|
|
300
|
+
|
|
301
|
+
var _chunkDBYNZIIQcjs = require('./chunk-DBYNZIIQ.cjs');
|
|
283
302
|
|
|
284
303
|
|
|
285
|
-
var _chunkUYTAP4FQcjs = require('./chunk-UYTAP4FQ.cjs');
|
|
286
304
|
|
|
287
305
|
|
|
288
|
-
var _chunk7JUIK547cjs = require('./chunk-7JUIK547.cjs');
|
|
289
306
|
|
|
307
|
+
var _chunkAKIQ54FKcjs = require('./chunk-AKIQ54FK.cjs');
|
|
290
308
|
|
|
291
|
-
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
var _chunkHDPT6OYEcjs = require('./chunk-HDPT6OYE.cjs');
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
var _chunk7JUIK547cjs = require('./chunk-7JUIK547.cjs');
|
|
292
315
|
|
|
293
316
|
|
|
294
317
|
|
|
@@ -300,7 +323,7 @@ var _chunkBTZ5O6VMcjs = require('./chunk-BTZ5O6VM.cjs');
|
|
|
300
323
|
// src/form-actions-transform.ts
|
|
301
324
|
var _crypto = require('crypto');
|
|
302
325
|
var _compiler = require('@farm.js/islx/compiler');
|
|
303
|
-
var
|
|
326
|
+
var _path2 = require('path'); var path2 = _interopRequireWildcard(_path2); var path6 = _interopRequireWildcard(_path2); var path3 = _interopRequireWildcard(_path2);
|
|
304
327
|
function transformFarmFormActionModule(options) {
|
|
305
328
|
const result = _compiler.transformActions.call(void 0, {
|
|
306
329
|
code: options.code,
|
|
@@ -318,6 +341,8 @@ function transformFarmFormActionModule(options) {
|
|
|
318
341
|
|
|
319
342
|
// src/vite.ts
|
|
320
343
|
var _vite = require('vite');
|
|
344
|
+
var _esmodulelexer = require('es-module-lexer');
|
|
345
|
+
var _async_hooks = require('async_hooks');
|
|
321
346
|
var _module = require('module');
|
|
322
347
|
|
|
323
348
|
// src/dev-preview-guard.ts
|
|
@@ -393,8 +418,7 @@ async function isAllowedPreviewRequest(server, options, req) {
|
|
|
393
418
|
if (server.config.publicDir && isInside(await realpathOr(server.config.publicDir), file)) {
|
|
394
419
|
return true;
|
|
395
420
|
}
|
|
396
|
-
|
|
397
|
-
if (!isModuleOrAsset) return false;
|
|
421
|
+
if (!MODULE_EXTENSION.test(file) && !ASSET_EXTENSION.test(file)) return false;
|
|
398
422
|
for (const source of options.getSourceRoots()) {
|
|
399
423
|
const sourceRoot = await realpathOr(source.root);
|
|
400
424
|
const sourceDir = await realpathOr(path2.resolve(source.root, source.srcDir));
|
|
@@ -436,8 +460,40 @@ async function realpathOr(directory) {
|
|
|
436
460
|
}
|
|
437
461
|
}
|
|
438
462
|
function isInside(directory, file) {
|
|
439
|
-
const
|
|
440
|
-
return
|
|
463
|
+
const relative4 = path2.relative(directory, file);
|
|
464
|
+
return relative4 !== "" && relative4 !== ".." && !relative4.startsWith(`..${path2.sep}`) && !path2.isAbsolute(relative4);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// src/server/dev-cors.ts
|
|
468
|
+
var VITE_DEFAULT_CORS_ORIGIN = /^https?:\/\/(?:(?:[^:]+\.)?localhost|127\.0\.0\.1|\[::1\])(?::\d+)?$/;
|
|
469
|
+
var VITE_DEFAULT_CORS_METHODS = "GET,HEAD,PUT,PATCH,POST,DELETE";
|
|
470
|
+
function appendVary(res, value) {
|
|
471
|
+
const current = res.getHeader("Vary");
|
|
472
|
+
const values = String(_nullishCoalesce(current, () => ( ""))).split(",").map((entry) => entry.trim()).filter(Boolean);
|
|
473
|
+
if (values.includes("*") || values.some((entry) => entry.toLowerCase() === value.toLowerCase())) {
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
res.setHeader("Vary", [...values, value].join(", "));
|
|
477
|
+
}
|
|
478
|
+
function createFarmDevViteCorsMiddleware() {
|
|
479
|
+
return function farmDevViteCors(req, res, next) {
|
|
480
|
+
const origin = req.headers.origin;
|
|
481
|
+
if (typeof origin === "string" && VITE_DEFAULT_CORS_ORIGIN.test(origin) && !res.hasHeader("Access-Control-Allow-Origin")) {
|
|
482
|
+
res.setHeader("Access-Control-Allow-Origin", origin);
|
|
483
|
+
}
|
|
484
|
+
appendVary(res, "Origin");
|
|
485
|
+
if (_optionalChain([req, 'access', _16 => _16.method, 'optionalAccess', _17 => _17.toUpperCase, 'call', _18 => _18()]) !== "OPTIONS") {
|
|
486
|
+
next();
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
res.setHeader("Access-Control-Allow-Methods", VITE_DEFAULT_CORS_METHODS);
|
|
490
|
+
appendVary(res, "Access-Control-Request-Headers");
|
|
491
|
+
const requestHeaders = req.headers["access-control-request-headers"];
|
|
492
|
+
if (requestHeaders) res.setHeader("Access-Control-Allow-Headers", requestHeaders);
|
|
493
|
+
res.statusCode = 204;
|
|
494
|
+
res.setHeader("Content-Length", "0");
|
|
495
|
+
res.end();
|
|
496
|
+
};
|
|
441
497
|
}
|
|
442
498
|
|
|
443
499
|
// src/vite.ts
|
|
@@ -448,13 +504,87 @@ var _url = require('url');
|
|
|
448
504
|
// src/dev-static.ts
|
|
449
505
|
|
|
450
506
|
|
|
451
|
-
function shouldBypassFarmRouterForDottedPath(pathname, routeManager, baseDirs, generatedPaths = []) {
|
|
507
|
+
function shouldBypassFarmRouterForDottedPath(pathname, routeManager, baseDirs, generatedPaths = [], method = "GET") {
|
|
452
508
|
if (!pathname.includes(".") || pathname.endsWith(".html")) return false;
|
|
453
509
|
const matchesAppRoute = Boolean(
|
|
454
|
-
_optionalChain([routeManager, 'optionalAccess',
|
|
510
|
+
_optionalChain([routeManager, 'optionalAccess', _19 => _19.matchRoute, 'call', _20 => _20(pathname), 'optionalAccess', _21 => _21.route]) || _optionalChain([routeManager, 'optionalAccess', _22 => _22.matchMetadataRoute, 'call', _23 => _23(pathname)]) || _optionalChain([routeManager, 'optionalAccess', _24 => _24.matchMetadataImage, 'call', _25 => _25(pathname)]) || generatedPaths.includes(pathname)
|
|
455
511
|
);
|
|
512
|
+
if (method !== "GET" && method !== "HEAD") {
|
|
513
|
+
return !matchesAppRoute && !devServableFileExists(pathname, baseDirs);
|
|
514
|
+
}
|
|
456
515
|
return !matchesAppRoute || devServableFileExists(pathname, baseDirs);
|
|
457
516
|
}
|
|
517
|
+
function isMalformedFarmRequestPathname(pathname) {
|
|
518
|
+
if (!pathname.includes("%")) return false;
|
|
519
|
+
try {
|
|
520
|
+
decodeURI(pathname);
|
|
521
|
+
return false;
|
|
522
|
+
} catch (e5) {
|
|
523
|
+
return true;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
var FARM_MALFORMED_REQUEST_BODY = JSON.stringify(
|
|
527
|
+
{ error: true, status: 400, message: "Bad Request" },
|
|
528
|
+
null,
|
|
529
|
+
2
|
|
530
|
+
);
|
|
531
|
+
function resolveFarmPublicFilePath(pathname, publicFiles) {
|
|
532
|
+
if (publicFiles.size === 0) return null;
|
|
533
|
+
let id = pathname.length > 1 && pathname.endsWith("/") ? pathname.slice(0, -1) : pathname;
|
|
534
|
+
if (id.includes("%")) {
|
|
535
|
+
const escaped = id.replace(/%2f/gi, "%252F");
|
|
536
|
+
try {
|
|
537
|
+
id = decodeURIComponent(escaped);
|
|
538
|
+
} catch (e6) {
|
|
539
|
+
id = escaped;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
if (publicFiles.has(id)) return id;
|
|
543
|
+
const index = `${id === "/" ? "" : id}/index.html`;
|
|
544
|
+
return publicFiles.has(index) ? index : null;
|
|
545
|
+
}
|
|
546
|
+
function createFarmPublicFileIndex(getPublicDir) {
|
|
547
|
+
const none = /* @__PURE__ */ new Set();
|
|
548
|
+
let listing;
|
|
549
|
+
return {
|
|
550
|
+
get() {
|
|
551
|
+
const configured = getPublicDir();
|
|
552
|
+
if (typeof configured !== "string" || configured.length === 0) return none;
|
|
553
|
+
if (_optionalChain([listing, 'optionalAccess', _26 => _26.configured]) === configured) return listing.files;
|
|
554
|
+
const dir = path3.resolve(configured);
|
|
555
|
+
listing = { configured, dir, files: listFarmPublicFiles(dir) };
|
|
556
|
+
return listing.files;
|
|
557
|
+
},
|
|
558
|
+
invalidate(file) {
|
|
559
|
+
if (!listing) return;
|
|
560
|
+
const resolved = path3.resolve(file);
|
|
561
|
+
if (resolved === listing.dir || resolved.startsWith(listing.dir + path3.sep)) {
|
|
562
|
+
listing = void 0;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
function listFarmPublicFiles(dir) {
|
|
568
|
+
const files = /* @__PURE__ */ new Set();
|
|
569
|
+
let entries;
|
|
570
|
+
try {
|
|
571
|
+
entries = fs.readdirSync(dir, { recursive: true, withFileTypes: true });
|
|
572
|
+
} catch (e7) {
|
|
573
|
+
return files;
|
|
574
|
+
}
|
|
575
|
+
for (const entry of entries) {
|
|
576
|
+
const filePath = path3.join(entry.parentPath, entry.name);
|
|
577
|
+
let isFile = entry.isFile();
|
|
578
|
+
if (!isFile && entry.isSymbolicLink()) {
|
|
579
|
+
try {
|
|
580
|
+
isFile = fs.statSync(filePath).isFile();
|
|
581
|
+
} catch (e8) {
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
if (isFile) files.add(`/${path3.relative(dir, filePath).split(path3.sep).join("/")}`);
|
|
585
|
+
}
|
|
586
|
+
return files;
|
|
587
|
+
}
|
|
458
588
|
var VITE_MODULE_QUERY_FLAGS = [
|
|
459
589
|
"import",
|
|
460
590
|
"raw",
|
|
@@ -470,21 +600,36 @@ function isViteModuleRequest(url, headers) {
|
|
|
470
600
|
const value = Array.isArray(destination) ? destination[0] : destination;
|
|
471
601
|
return value !== void 0 && SCRIPT_FETCH_DESTINATIONS.has(value.toLowerCase());
|
|
472
602
|
}
|
|
603
|
+
var VITE_CLIENT_QUERY_FLAGS = ["t", "v", "direct", "html-proxy", "worker_file"];
|
|
604
|
+
var NAVIGATION_FETCH_DESTINATIONS = /* @__PURE__ */ new Set(["document", "iframe", "frame", "embed", "object"]);
|
|
605
|
+
function isViteDevClientRequest(url, headers) {
|
|
606
|
+
if (isViteModuleRequest(url, headers)) return true;
|
|
607
|
+
if (VITE_CLIENT_QUERY_FLAGS.some((flag) => url.searchParams.has(flag))) return true;
|
|
608
|
+
const destination = firstHeaderValue(headers["sec-fetch-dest"]);
|
|
609
|
+
if (destination !== void 0) {
|
|
610
|
+
return !NAVIGATION_FETCH_DESTINATIONS.has(destination.toLowerCase());
|
|
611
|
+
}
|
|
612
|
+
return firstHeaderValue(headers.referer) !== void 0 && !(_nullishCoalesce(firstHeaderValue(headers.accept), () => ( ""))).includes("text/html");
|
|
613
|
+
}
|
|
614
|
+
function firstHeaderValue(value) {
|
|
615
|
+
return Array.isArray(value) ? value[0] : value;
|
|
616
|
+
}
|
|
473
617
|
var DOCS_ENGINE_APP_OWNABLE_PATHS = /* @__PURE__ */ new Set([
|
|
474
618
|
"/llms.txt",
|
|
475
619
|
"/llms-full.txt",
|
|
476
620
|
"/sitemap.xml",
|
|
477
621
|
"/robots.txt"
|
|
478
622
|
]);
|
|
479
|
-
function farmAppOwnsDocsEnginePath(
|
|
623
|
+
function farmAppOwnsDocsEnginePath(routePathname, options) {
|
|
624
|
+
const pathname = routePathname.length > 1 ? routePathname.replace(/\/+$/, "") : routePathname;
|
|
480
625
|
if (!DOCS_ENGINE_APP_OWNABLE_PATHS.has(pathname)) return false;
|
|
481
|
-
return options.generatedPaths.includes(pathname) || Boolean(_optionalChain([options, 'access',
|
|
626
|
+
return options.generatedPaths.includes(pathname) || Boolean(_optionalChain([options, 'access', _27 => _27.routeManager, 'optionalAccess', _28 => _28.matchMetadataRoute, 'call', _29 => _29(pathname)])) || devServableFileExists(pathname, [options.publicDir]);
|
|
482
627
|
}
|
|
483
628
|
function devServableFileExists(pathname, baseDirs) {
|
|
484
629
|
let decodedPathname;
|
|
485
630
|
try {
|
|
486
631
|
decodedPathname = decodeURIComponent(pathname);
|
|
487
|
-
} catch (
|
|
632
|
+
} catch (e9) {
|
|
488
633
|
return false;
|
|
489
634
|
}
|
|
490
635
|
const relativePathname = decodedPathname.replace(/^\/+/, "");
|
|
@@ -498,7 +643,7 @@ function devServableFileExists(pathname, baseDirs) {
|
|
|
498
643
|
if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) {
|
|
499
644
|
return true;
|
|
500
645
|
}
|
|
501
|
-
} catch (
|
|
646
|
+
} catch (e10) {
|
|
502
647
|
}
|
|
503
648
|
}
|
|
504
649
|
return false;
|
|
@@ -579,14 +724,14 @@ function analyzeClientBoundary(program, publicKeys) {
|
|
|
579
724
|
}
|
|
580
725
|
function readNodeBuiltinSource(node) {
|
|
581
726
|
if (node.type === "ImportDeclaration" || node.type === "ExportNamedDeclaration" || node.type === "ExportAllDeclaration" || node.type === "ImportExpression") {
|
|
582
|
-
const value = _optionalChain([node, 'access',
|
|
727
|
+
const value = _optionalChain([node, 'access', _30 => _30.source, 'optionalAccess', _31 => _31.value]);
|
|
583
728
|
return typeof value === "string" && value.startsWith("node:") ? value : void 0;
|
|
584
729
|
}
|
|
585
730
|
if (node.type === "CallExpression") {
|
|
586
731
|
const callee = node.callee;
|
|
587
|
-
if (_optionalChain([callee, 'optionalAccess',
|
|
588
|
-
const arg = _optionalChain([node, 'access',
|
|
589
|
-
const value = _optionalChain([arg, 'optionalAccess',
|
|
732
|
+
if (_optionalChain([callee, 'optionalAccess', _32 => _32.type]) === "Identifier" && callee.name === "require") {
|
|
733
|
+
const arg = _optionalChain([node, 'access', _33 => _33.arguments, 'optionalAccess', _34 => _34[0]]);
|
|
734
|
+
const value = _optionalChain([arg, 'optionalAccess', _35 => _35.type]) === "Literal" ? arg.value : void 0;
|
|
590
735
|
return typeof value === "string" && value.startsWith("node:") ? value : void 0;
|
|
591
736
|
}
|
|
592
737
|
}
|
|
@@ -595,7 +740,7 @@ function readNodeBuiltinSource(node) {
|
|
|
595
740
|
function readProcessEnvKey(node) {
|
|
596
741
|
if (node.type !== "MemberExpression") return void 0;
|
|
597
742
|
const object = node.object;
|
|
598
|
-
if (!object || object.type !== "MemberExpression" || _optionalChain([object, 'access',
|
|
743
|
+
if (!object || object.type !== "MemberExpression" || _optionalChain([object, 'access', _36 => _36.object, 'optionalAccess', _37 => _37.type]) !== "Identifier" || object.object.name !== "process" || _optionalChain([object, 'access', _38 => _38.property, 'optionalAccess', _39 => _39.name]) !== "env") {
|
|
599
744
|
return void 0;
|
|
600
745
|
}
|
|
601
746
|
const property = node.property;
|
|
@@ -658,7 +803,7 @@ function farmImageImportsPlugin() {
|
|
|
658
803
|
async transform(code, id) {
|
|
659
804
|
const filePath = id.split("?", 1)[0];
|
|
660
805
|
if (id.includes("?") || !STATIC_IMAGE_RE.test(filePath)) return null;
|
|
661
|
-
const defaultExport = _optionalChain([code, 'access',
|
|
806
|
+
const defaultExport = _optionalChain([code, 'access', _40 => _40.match, 'call', _41 => _41(/^\s*export\s+default\s+(.+?);?\s*$/s), 'optionalAccess', _42 => _42[1]]);
|
|
662
807
|
if (!defaultExport) return null;
|
|
663
808
|
return createStaticImageModule(filePath, `const src = ${defaultExport};`);
|
|
664
809
|
}
|
|
@@ -691,11 +836,47 @@ async function createBlurDataURL(bytes) {
|
|
|
691
836
|
const { default: sharp } = await import("sharp");
|
|
692
837
|
const placeholder = await sharp(bytes).rotate().resize({ width: 8, height: 8, fit: "inside", withoutEnlargement: true }).webp({ quality: 35 }).toBuffer();
|
|
693
838
|
return `data:image/webp;base64,${placeholder.toString("base64")}`;
|
|
694
|
-
} catch (
|
|
839
|
+
} catch (e11) {
|
|
695
840
|
return void 0;
|
|
696
841
|
}
|
|
697
842
|
}
|
|
698
843
|
|
|
844
|
+
// src/dev/deferred-setup.ts
|
|
845
|
+
function createFarmDeferredMiddleware(ready) {
|
|
846
|
+
const stack = [];
|
|
847
|
+
const run = (req, res, next) => {
|
|
848
|
+
let index = 0;
|
|
849
|
+
const step = (error) => {
|
|
850
|
+
if (error !== void 0 && error !== null) return next(error);
|
|
851
|
+
const layer = stack[index++];
|
|
852
|
+
if (!layer) return next();
|
|
853
|
+
try {
|
|
854
|
+
layer.handle(req, res, step);
|
|
855
|
+
} catch (thrown) {
|
|
856
|
+
next(_nullishCoalesce(thrown, () => ( new Error("Middleware threw a nullish value"))));
|
|
857
|
+
}
|
|
858
|
+
};
|
|
859
|
+
step();
|
|
860
|
+
};
|
|
861
|
+
return {
|
|
862
|
+
handle(req, res, next) {
|
|
863
|
+
const pending = ready();
|
|
864
|
+
if (!pending) return run(req, res, next);
|
|
865
|
+
pending.then(
|
|
866
|
+
() => run(req, res, next),
|
|
867
|
+
(error) => next(_nullishCoalesce(error, () => ( new Error("Farm dev server setup failed"))))
|
|
868
|
+
);
|
|
869
|
+
},
|
|
870
|
+
target: {
|
|
871
|
+
stack,
|
|
872
|
+
use(handle) {
|
|
873
|
+
stack.push({ route: "", handle });
|
|
874
|
+
return this;
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
|
|
699
880
|
// src/vite.ts
|
|
700
881
|
|
|
701
882
|
|
|
@@ -715,12 +896,12 @@ function rewriteFarmReactCacheImport(code, file) {
|
|
|
715
896
|
let program;
|
|
716
897
|
try {
|
|
717
898
|
program = _parseAst.parseAst.call(void 0, code, { lang });
|
|
718
|
-
} catch (
|
|
899
|
+
} catch (e12) {
|
|
719
900
|
return null;
|
|
720
901
|
}
|
|
721
902
|
const edits = [];
|
|
722
903
|
const declarations = (_nullishCoalesce(program.body, () => ( []))).filter(
|
|
723
|
-
(node) => node.type === "ImportDeclaration" && _optionalChain([node, 'access',
|
|
904
|
+
(node) => node.type === "ImportDeclaration" && _optionalChain([node, 'access', _43 => _43.source, 'optionalAccess', _44 => _44.value]) === "react" && node.importKind !== "type"
|
|
724
905
|
);
|
|
725
906
|
const namespaces = /* @__PURE__ */ new Set();
|
|
726
907
|
let memberImportAt = null;
|
|
@@ -735,7 +916,7 @@ function rewriteFarmReactCacheImport(code, file) {
|
|
|
735
916
|
const caches = specifiers.filter(
|
|
736
917
|
(specifier) => specifier.type === "ImportSpecifier" && specifier.importKind !== "type" && Object.prototype.hasOwnProperty.call(
|
|
737
918
|
REACT_CACHE_APIS,
|
|
738
|
-
_nullishCoalesce(_nullishCoalesce(_optionalChain([specifier, 'access',
|
|
919
|
+
_nullishCoalesce(_nullishCoalesce(_optionalChain([specifier, 'access', _45 => _45.imported, 'optionalAccess', _46 => _46.name]), () => ( _optionalChain([specifier, 'access', _47 => _47.imported, 'optionalAccess', _48 => _48.value]))), () => ( ""))
|
|
739
920
|
)
|
|
740
921
|
);
|
|
741
922
|
if (caches.length === 0) continue;
|
|
@@ -749,7 +930,7 @@ function rewriteFarmReactCacheImport(code, file) {
|
|
|
749
930
|
].join(", ");
|
|
750
931
|
const lines = [
|
|
751
932
|
...clause ? [`import ${clause} from "react";`] : [],
|
|
752
|
-
`import { ${caches.map((specifier) => `${_nullishCoalesce(_optionalChain([specifier, 'access',
|
|
933
|
+
`import { ${caches.map((specifier) => `${_nullishCoalesce(_optionalChain([specifier, 'access', _49 => _49.imported, 'optionalAccess', _50 => _50.name]), () => ( _optionalChain([specifier, 'access', _51 => _51.imported, 'optionalAccess', _52 => _52.value])))} as ${specifier.local.name}`).join(", ")} } from ${JSON.stringify(FARM_REACT_CACHE_MODULE)};`
|
|
753
934
|
];
|
|
754
935
|
edits.push({ start: node.start, end: node.end, text: lines.join("\n") });
|
|
755
936
|
}
|
|
@@ -764,7 +945,7 @@ function rewriteFarmReactCacheImport(code, file) {
|
|
|
764
945
|
const current = node;
|
|
765
946
|
if (typeof current.type !== "string") return;
|
|
766
947
|
if (current.type === "ImportDeclaration") return;
|
|
767
|
-
if (current.type === "MemberExpression" && !current.computed && _optionalChain([current, 'access',
|
|
948
|
+
if (current.type === "MemberExpression" && !current.computed && _optionalChain([current, 'access', _53 => _53.object, 'optionalAccess', _54 => _54.type]) === "Identifier" && namespaces.has(current.object.name) && Object.prototype.hasOwnProperty.call(REACT_CACHE_APIS, _nullishCoalesce(_optionalChain([current, 'access', _55 => _55.property, 'optionalAccess', _56 => _56.name]), () => ( "")))) {
|
|
768
949
|
const name = current.property.name;
|
|
769
950
|
edits.push({ start: current.start, end: current.end, text: REACT_CACHE_APIS[name] });
|
|
770
951
|
used.add(name);
|
|
@@ -835,13 +1016,13 @@ function reportOpenAPIDevGenerationResult(spec, output = _chunkQMNWKQL4cjs.logge
|
|
|
835
1016
|
// src/vite.ts
|
|
836
1017
|
var SERVER_FN_TRANSFORM_PLUGIN = "@farm.js/plugin/rsc:server-fn-actions";
|
|
837
1018
|
function farmLlmsTxtGeneratedPaths(config) {
|
|
838
|
-
const llms =
|
|
1019
|
+
const llms = _chunkQO43L7Z4cjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([config, 'access', _57 => _57.agent, 'optionalAccess', _58 => _58.llmsTxt]));
|
|
839
1020
|
if (!llms.enabled) return [];
|
|
840
1021
|
return llms.full ? ["/llms.txt", "/llms-full.txt"] : ["/llms.txt"];
|
|
841
1022
|
}
|
|
842
1023
|
function farmAgentGeneratedPaths(config) {
|
|
843
|
-
const crawlers =
|
|
844
|
-
const sitemap =
|
|
1024
|
+
const crawlers = _chunk4E57QHPWcjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([config, 'access', _59 => _59.agent, 'optionalAccess', _60 => _60.crawlers]));
|
|
1025
|
+
const sitemap = _chunk4E57QHPWcjs.resolveFarmAgentSitemap.call(void 0, _optionalChain([config, 'access', _61 => _61.agent, 'optionalAccess', _62 => _62.sitemap]));
|
|
845
1026
|
return [
|
|
846
1027
|
...farmLlmsTxtGeneratedPaths(config),
|
|
847
1028
|
...sitemap.enabled ? ["/sitemap.xml"] : [],
|
|
@@ -880,13 +1061,13 @@ function loadFarmDocsSearchDevRuntime() {
|
|
|
880
1061
|
return import("./search-client-ZZLKVO5R.cjs");
|
|
881
1062
|
}
|
|
882
1063
|
function loadFarmOpenAPIDevRuntime() {
|
|
883
|
-
return import("./manager-
|
|
1064
|
+
return import("./manager-JOHU6BQI.cjs");
|
|
884
1065
|
}
|
|
885
1066
|
function loadFarmWorkflowsDevRuntime() {
|
|
886
1067
|
return import("./workflows.cjs");
|
|
887
1068
|
}
|
|
888
1069
|
function loadFarmDevtoolsSnapshotRuntime() {
|
|
889
|
-
return import("./devtools-
|
|
1070
|
+
return import("./devtools-R27T3BRY.cjs");
|
|
890
1071
|
}
|
|
891
1072
|
function loadFarmDevtoolsUIRuntime() {
|
|
892
1073
|
return import("./devtools-ui-SYRUXUA7.cjs");
|
|
@@ -899,7 +1080,7 @@ function farmI18nClientBridgePlugin() {
|
|
|
899
1080
|
name: "farm:i18n-client-bridge",
|
|
900
1081
|
enforce: "pre",
|
|
901
1082
|
resolveId(id, _importer, options) {
|
|
902
|
-
if (id === "@farm.js/core/i18n/server" && !_optionalChain([options, 'optionalAccess',
|
|
1083
|
+
if (id === "@farm.js/core/i18n/server" && !_optionalChain([options, 'optionalAccess', _63 => _63.ssr])) {
|
|
903
1084
|
return FARM_I18N_CLIENT_BRIDGE_ID;
|
|
904
1085
|
}
|
|
905
1086
|
return null;
|
|
@@ -916,6 +1097,18 @@ var farmReactServerFiles = /* @__PURE__ */ new Set();
|
|
|
916
1097
|
var FARM_SERVER_ONLY_PACKAGE_ID = "\0farm:server-only";
|
|
917
1098
|
var FARM_PLATFORM_ENTRY = "@farm.js/core/platform";
|
|
918
1099
|
var FARM_PLATFORM_CLIENT_ID = "\0farm:platform-client";
|
|
1100
|
+
var FARM_SERVER_ONLY_ENTRIES_RESOLVE_FILTER = [
|
|
1101
|
+
_chunkF36LS2C7cjs.exactIdPattern.call(void 0, [FARM_PLATFORM_ENTRY, SERVER_ONLY_PACKAGE, ...FARM_SERVER_ONLY_ENTRIES]),
|
|
1102
|
+
new RegExp(`^${_chunkMZ4CRSY7cjs.FARM_RESOLVE_FROM_PREFIX}`),
|
|
1103
|
+
// What isBuiltin() accepts: `node:` ids and the builtin names, subpaths such as fs/promises
|
|
1104
|
+
// included.
|
|
1105
|
+
/^node:/,
|
|
1106
|
+
_chunkF36LS2C7cjs.exactIdPattern.call(void 0, _module.builtinModules)
|
|
1107
|
+
];
|
|
1108
|
+
var FARM_SERVER_ONLY_ENTRIES_LOAD_FILTER = [
|
|
1109
|
+
_chunkF36LS2C7cjs.exactIdPattern.call(void 0, [FARM_SERVER_ONLY_PACKAGE_ID, FARM_PLATFORM_CLIENT_ID]),
|
|
1110
|
+
new RegExp(`^${_chunkMZ4CRSY7cjs.FARM_BROWSER_BUILTIN_PREFIX}`)
|
|
1111
|
+
];
|
|
919
1112
|
function createFarmPlatformClientModule(platform) {
|
|
920
1113
|
return `export function platform() { return ${JSON.stringify(platform)}; }
|
|
921
1114
|
export function appDataDir() {
|
|
@@ -923,6 +1116,18 @@ export function appDataDir() {
|
|
|
923
1116
|
}
|
|
924
1117
|
`;
|
|
925
1118
|
}
|
|
1119
|
+
function createFarmServerPrebundleConfig(bundledPackages) {
|
|
1120
|
+
const include = bundledPackages.filter(({ prebundle }) => prebundle).map(({ name }) => name);
|
|
1121
|
+
if (include.length === 0) return {};
|
|
1122
|
+
const isBare = (id) => /^(?![a-zA-Z]:)[\w@]/.test(id) && !id.includes(":");
|
|
1123
|
+
const isIncluded = (id) => include.some((name) => id === name || id.startsWith(`${name}/`));
|
|
1124
|
+
return {
|
|
1125
|
+
optimizeDeps: {
|
|
1126
|
+
include,
|
|
1127
|
+
rolldownOptions: { external: (id) => isBare(id) && !isIncluded(id) }
|
|
1128
|
+
}
|
|
1129
|
+
};
|
|
1130
|
+
}
|
|
926
1131
|
function farmServerOnlyEntriesPlugin(options = {}) {
|
|
927
1132
|
let root = process.cwd();
|
|
928
1133
|
let vercelOgInstalled = false;
|
|
@@ -930,55 +1135,78 @@ function farmServerOnlyEntriesPlugin(options = {}) {
|
|
|
930
1135
|
name: "farm:server-only-entries",
|
|
931
1136
|
enforce: "pre",
|
|
932
1137
|
config(config) {
|
|
1138
|
+
const bundledPackages = _chunkMZ4CRSY7cjs.collectFarmServerBundledPackageInfo.call(void 0,
|
|
1139
|
+
path6.resolve(_nullishCoalesce(config.root, () => ( process.cwd())))
|
|
1140
|
+
);
|
|
933
1141
|
return {
|
|
934
|
-
optimizeDeps: { rolldownOptions: { plugins: [
|
|
1142
|
+
optimizeDeps: { rolldownOptions: { plugins: [_chunkMZ4CRSY7cjs.farmBrowserBuiltinsOptimizerPlugin.call(void 0, )] } },
|
|
935
1143
|
ssr: {
|
|
936
1144
|
noExternal: [
|
|
937
1145
|
// Resolve `server-only` here rather than in Node, which would load its throwing build.
|
|
938
1146
|
SERVER_ONLY_PACKAGE,
|
|
939
1147
|
// Packages Node cannot load as a bundler does (stylesheet imports, `module`-only ESM).
|
|
940
|
-
...
|
|
941
|
-
]
|
|
1148
|
+
...bundledPackages.map(({ name }) => name)
|
|
1149
|
+
],
|
|
1150
|
+
...options.prebundleServerPackages ? createFarmServerPrebundleConfig(bundledPackages) : {}
|
|
942
1151
|
}
|
|
943
1152
|
};
|
|
944
1153
|
},
|
|
945
1154
|
configResolved(config) {
|
|
946
1155
|
root = config.root;
|
|
947
1156
|
},
|
|
948
|
-
resolveId
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
if (
|
|
952
|
-
|
|
1157
|
+
resolveId: {
|
|
1158
|
+
filter: { id: FARM_SERVER_ONLY_ENTRIES_RESOLVE_FILTER },
|
|
1159
|
+
handler(id, importer, options2) {
|
|
1160
|
+
if (id === FARM_PLATFORM_ENTRY) return _optionalChain([options2, 'optionalAccess', _64 => _64.ssr]) ? null : FARM_PLATFORM_CLIENT_ID;
|
|
1161
|
+
if (id === SERVER_ONLY_PACKAGE) {
|
|
1162
|
+
if (_optionalChain([options2, 'optionalAccess', _65 => _65.ssr]) || _optionalChain([options2, 'optionalAccess', _66 => _66.scan])) {
|
|
1163
|
+
return FARM_SERVER_ONLY_PACKAGE_ID;
|
|
1164
|
+
}
|
|
1165
|
+
this.error(
|
|
1166
|
+
`${_nullishCoalesce(importer, () => ( "A module"))} imports "server-only", so it must not reach the browser, but client code imports it. Move what the client needs out of that module, or call it from a server component, server function or API route.`
|
|
1167
|
+
);
|
|
953
1168
|
}
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
)
|
|
1169
|
+
if (!_optionalChain([options2, 'optionalAccess', _67 => _67.ssr]) && _module.isBuiltin.call(void 0, id)) {
|
|
1170
|
+
return _chunkMZ4CRSY7cjs.resolveFarmBrowserBuiltin.call(void 0, this, id, importer, options2);
|
|
1171
|
+
}
|
|
1172
|
+
const resolveFrom = importer ? _chunkMZ4CRSY7cjs.parseFarmResolveFrom.call(void 0, id, importer.split("?", 1)[0]) : null;
|
|
1173
|
+
if (resolveFrom) {
|
|
1174
|
+
const directory = path6.dirname(resolveFrom.importer);
|
|
1175
|
+
return this.resolve(resolveFrom.specifier, resolveFrom.importer, {
|
|
1176
|
+
...options2,
|
|
1177
|
+
skipSelf: true
|
|
1178
|
+
}).then((resolved) => {
|
|
1179
|
+
if (resolved) return resolved;
|
|
1180
|
+
return this.error(
|
|
1181
|
+
`Could not resolve "${resolveFrom.specifier}" from ${directory}, the package whose server component renders it. Install it in that package, or run your package manager's install again.`
|
|
1182
|
+
);
|
|
1183
|
+
});
|
|
1184
|
+
}
|
|
1185
|
+
if (!FARM_SERVER_ONLY_ENTRIES.has(id)) return null;
|
|
1186
|
+
const importedBy = importer ? ` (imported by ${importer})` : "";
|
|
1187
|
+
if (!_optionalChain([options2, 'optionalAccess', _68 => _68.ssr])) {
|
|
1188
|
+
this.error(
|
|
1189
|
+
`${id} is server-only and cannot be imported into client code${importedBy}. Use it from an API route or another server module.`
|
|
1190
|
+
);
|
|
1191
|
+
}
|
|
1192
|
+
vercelOgInstalled || (vercelOgInstalled = _chunkKORZ6PREcjs.isOptionalPeerInstalled.call(void 0, root, "@vercel/og"));
|
|
1193
|
+
if (!vercelOgInstalled) {
|
|
1194
|
+
this.error(
|
|
1195
|
+
`${id} needs @vercel/og, which is not installed${importedBy}. ${_chunkKORZ6PREcjs.VERCEL_OG_INSTALL_HINT}`
|
|
1196
|
+
);
|
|
1197
|
+
}
|
|
1198
|
+
return null;
|
|
973
1199
|
}
|
|
974
|
-
return null;
|
|
975
1200
|
},
|
|
976
|
-
load
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
1201
|
+
load: {
|
|
1202
|
+
filter: { id: FARM_SERVER_ONLY_ENTRIES_LOAD_FILTER },
|
|
1203
|
+
handler(id) {
|
|
1204
|
+
if (id === FARM_SERVER_ONLY_PACKAGE_ID) return "export {};";
|
|
1205
|
+
if (id === FARM_PLATFORM_CLIENT_ID) {
|
|
1206
|
+
return createFarmPlatformClientModule(_nullishCoalesce(options.platform, () => ( _chunkAQLHD6HZcjs.resolveFarmPlatform.call(void 0, ))));
|
|
1207
|
+
}
|
|
1208
|
+
return _nullishCoalesce(_chunkMZ4CRSY7cjs.loadFarmBrowserBuiltin.call(void 0, id), () => ( null));
|
|
980
1209
|
}
|
|
981
|
-
return _nullishCoalesce(_chunk7ONGIFYXcjs.loadFarmBrowserBuiltin.call(void 0, id), () => ( null));
|
|
982
1210
|
}
|
|
983
1211
|
};
|
|
984
1212
|
}
|
|
@@ -1010,10 +1238,10 @@ function renderFarmI18nStaticHead(requestPath, snapshot) {
|
|
|
1010
1238
|
if (!snapshot) return "";
|
|
1011
1239
|
const runtime = `<script>window.__FARM_I18N__ = ${serializeFarmInlineValue(snapshot)};</script>`;
|
|
1012
1240
|
if (snapshot.routing === "none") return runtime;
|
|
1013
|
-
return `${
|
|
1241
|
+
return `${_chunkUPOYKX4Scjs.renderFarmLocaleAlternateLinks.call(void 0, requestPath, snapshot)}${runtime}`;
|
|
1014
1242
|
}
|
|
1015
1243
|
function getPublicEnvDefine(config) {
|
|
1016
|
-
const publicEnv = _optionalChain([config, 'access',
|
|
1244
|
+
const publicEnv = _optionalChain([config, 'access', _69 => _69.env, 'optionalAccess', _70 => _70.public]);
|
|
1017
1245
|
if (!isResolvedEnvScope(publicEnv)) {
|
|
1018
1246
|
return {};
|
|
1019
1247
|
}
|
|
@@ -1034,7 +1262,7 @@ function createRequestFromNodeRequest(req, url, signal) {
|
|
|
1034
1262
|
signal
|
|
1035
1263
|
});
|
|
1036
1264
|
}
|
|
1037
|
-
function withFarmRequestTracing(handler, apiRuntime, resolveTraceUrl = (request) =>
|
|
1265
|
+
function withFarmRequestTracing(handler, apiRuntime, resolveTraceUrl = (request) => _chunkHDPT6OYEcjs.resolveFarmRequestURL.call(void 0, request)) {
|
|
1038
1266
|
const middleware = _chunkP2355C6Ecjs._withAfterNodeMiddleware.call(void 0, handler);
|
|
1039
1267
|
return (req, res, next) => {
|
|
1040
1268
|
const traceUrl = resolveTraceUrl(req);
|
|
@@ -1052,15 +1280,41 @@ function withFarmRequestTracing(handler, apiRuntime, resolveTraceUrl = (request)
|
|
|
1052
1280
|
return;
|
|
1053
1281
|
}
|
|
1054
1282
|
if (res.headersSent) {
|
|
1055
|
-
_optionalChain([res, 'access',
|
|
1283
|
+
_optionalChain([res, 'access', _71 => _71.destroy, 'optionalCall', _72 => _72(error instanceof Error ? error : new Error(String(error)))]);
|
|
1056
1284
|
return;
|
|
1057
1285
|
}
|
|
1058
1286
|
res.statusCode = 500;
|
|
1059
1287
|
res.setHeader("Content-Type", "application/json");
|
|
1060
|
-
res.end(
|
|
1288
|
+
res.end(_chunkXGTFLG73cjs.FARM_INTERNAL_SERVER_ERROR_BODY);
|
|
1061
1289
|
});
|
|
1062
1290
|
};
|
|
1063
1291
|
}
|
|
1292
|
+
function sendFarmDevErrorJSON(res) {
|
|
1293
|
+
res.statusCode = 500;
|
|
1294
|
+
res.setHeader("Content-Type", "application/json");
|
|
1295
|
+
res.setHeader("Cache-Control", "private, no-store");
|
|
1296
|
+
res.end(_chunkXGTFLG73cjs.FARM_INTERNAL_SERVER_ERROR_BODY);
|
|
1297
|
+
}
|
|
1298
|
+
function createFarmDevMiddlewareErrorResponse() {
|
|
1299
|
+
return new Response(_chunkXGTFLG73cjs.FARM_INTERNAL_SERVER_ERROR_BODY, {
|
|
1300
|
+
status: 500,
|
|
1301
|
+
headers: { "Content-Type": "application/json", "Cache-Control": "private, no-store" }
|
|
1302
|
+
});
|
|
1303
|
+
}
|
|
1304
|
+
function sendFarmDevRuntimeHookError(res, json) {
|
|
1305
|
+
res.statusCode = 500;
|
|
1306
|
+
res.setHeader("Content-Type", json ? "application/json" : "text/plain; charset=utf-8");
|
|
1307
|
+
res.end(json ? _chunkXGTFLG73cjs.FARM_INTERNAL_SERVER_ERROR_BODY : "Internal Server Error");
|
|
1308
|
+
}
|
|
1309
|
+
var FARM_CONFIG_ROUTE_PLUGIN_NAMES = /* @__PURE__ */ new Set([
|
|
1310
|
+
_chunkAKIQ54FKcjs.FARM_CONFIG_HEADERS_PLUGIN_NAME,
|
|
1311
|
+
_chunkAKIQ54FKcjs.FARM_CONFIG_REDIRECTS_PLUGIN_NAME,
|
|
1312
|
+
_chunkAKIQ54FKcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME
|
|
1313
|
+
]);
|
|
1314
|
+
function isFarmConfigRoutePlugin(plugin) {
|
|
1315
|
+
return FARM_CONFIG_ROUTE_PLUGIN_NAMES.has(plugin.name);
|
|
1316
|
+
}
|
|
1317
|
+
var FARM_DEV_CONFIG_REWRITE_SOURCE = /* @__PURE__ */ Symbol.for("farm.devConfigRewriteSource");
|
|
1064
1318
|
async function proxyFarmExternalRewrite(req, res, bodySizeLimit) {
|
|
1065
1319
|
const destination = req.url;
|
|
1066
1320
|
if (!destination || !/^https?:\/\//i.test(destination)) return false;
|
|
@@ -1155,9 +1409,35 @@ function interceptFarmDevPageResponse(options) {
|
|
|
1155
1409
|
const originalWrite = res.write.bind(res);
|
|
1156
1410
|
const originalEnd = res.end.bind(res);
|
|
1157
1411
|
const originalWriteHead = res.writeHead.bind(res);
|
|
1158
|
-
const originalFlushHeaders = _optionalChain([res, 'access',
|
|
1412
|
+
const originalFlushHeaders = _optionalChain([res, 'access', _73 => _73.flushHeaders, 'optionalAccess', _74 => _74.bind, 'call', _75 => _75(res)]);
|
|
1159
1413
|
let afterResponseCalled = false;
|
|
1160
1414
|
let interceptedEnd = false;
|
|
1415
|
+
const restore = () => {
|
|
1416
|
+
res.write = originalWrite;
|
|
1417
|
+
res.end = originalEnd;
|
|
1418
|
+
res.writeHead = originalWriteHead;
|
|
1419
|
+
if (originalFlushHeaders) res.flushHeaders = originalFlushHeaders;
|
|
1420
|
+
delete res[_chunkWUTFJOV7cjs.FARM_NODE_RESPONSE_END_PENDING];
|
|
1421
|
+
};
|
|
1422
|
+
let runtimeHookFailed = false;
|
|
1423
|
+
const endRuntimeRequest = (response) => pm.endRuntimeRequest(runtimeSession, response).catch((error) => {
|
|
1424
|
+
runtimeHookFailed = true;
|
|
1425
|
+
throw error;
|
|
1426
|
+
});
|
|
1427
|
+
const reportFailure = (error) => {
|
|
1428
|
+
if (!runtimeHookFailed) void options.emitError(error);
|
|
1429
|
+
console.error("Error in afterResponse hook:", error);
|
|
1430
|
+
};
|
|
1431
|
+
const writeRuntimeHookFailure = () => {
|
|
1432
|
+
res.statusCode = 500;
|
|
1433
|
+
res.removeHeader("Content-Length");
|
|
1434
|
+
res.setHeader(
|
|
1435
|
+
"Content-Type",
|
|
1436
|
+
options.jsonError ? "application/json" : "text/plain; charset=utf-8"
|
|
1437
|
+
);
|
|
1438
|
+
originalWriteHead(500);
|
|
1439
|
+
originalWrite(options.jsonError ? _chunkXGTFLG73cjs.FARM_INTERNAL_SERVER_ERROR_BODY : "Internal Server Error");
|
|
1440
|
+
};
|
|
1161
1441
|
const htmlChunks = [];
|
|
1162
1442
|
const responseChunks = [];
|
|
1163
1443
|
let didStreamHtml = false;
|
|
@@ -1188,8 +1468,7 @@ function interceptFarmDevPageResponse(options) {
|
|
|
1188
1468
|
const status = res.statusCode || 200;
|
|
1189
1469
|
const canHaveBody = method !== "HEAD" && status !== 204 && status !== 205 && status !== 304;
|
|
1190
1470
|
pm.copyRequestContext(req, runtimeSession.request);
|
|
1191
|
-
const done =
|
|
1192
|
-
runtimeSession,
|
|
1471
|
+
const done = endRuntimeRequest(
|
|
1193
1472
|
new Response(canHaveBody ? body : null, {
|
|
1194
1473
|
status,
|
|
1195
1474
|
headers: createHeadersFromNodeResponse(res)
|
|
@@ -1197,7 +1476,7 @@ function interceptFarmDevPageResponse(options) {
|
|
|
1197
1476
|
).then(async (runtimeResponse) => {
|
|
1198
1477
|
applyWebResponseToNodeResponse(runtimeResponse, res);
|
|
1199
1478
|
if (!res.headersSent) originalWriteHead(res.statusCode);
|
|
1200
|
-
_optionalChain([originalFlushHeaders, 'optionalCall',
|
|
1479
|
+
_optionalChain([originalFlushHeaders, 'optionalCall', _76 => _76()]);
|
|
1201
1480
|
if (!runtimeResponse.body) return;
|
|
1202
1481
|
const reader = runtimeResponse.body.getReader();
|
|
1203
1482
|
for (; ; ) {
|
|
@@ -1217,7 +1496,7 @@ function interceptFarmDevPageResponse(options) {
|
|
|
1217
1496
|
if (!chunk || chunk.byteLength === 0) return;
|
|
1218
1497
|
try {
|
|
1219
1498
|
stream.controller.enqueue(new Uint8Array(chunk));
|
|
1220
|
-
} catch (
|
|
1499
|
+
} catch (e13) {
|
|
1221
1500
|
}
|
|
1222
1501
|
};
|
|
1223
1502
|
res.writeHead = ((statusCode, ...args) => {
|
|
@@ -1246,7 +1525,7 @@ function interceptFarmDevPageResponse(options) {
|
|
|
1246
1525
|
if (streamsThroughRuntime()) {
|
|
1247
1526
|
streamRuntimeChunk(bufferChunk);
|
|
1248
1527
|
const callback = args.find((arg) => typeof arg === "function");
|
|
1249
|
-
_optionalChain([callback, 'optionalCall',
|
|
1528
|
+
_optionalChain([callback, 'optionalCall', _77 => _77()]);
|
|
1250
1529
|
return true;
|
|
1251
1530
|
}
|
|
1252
1531
|
if (isHtmlResponse && bufferChunk) {
|
|
@@ -1258,7 +1537,7 @@ function interceptFarmDevPageResponse(options) {
|
|
|
1258
1537
|
const shouldBufferResponse = isHtmlResponse ? bufferPluginResponse : Boolean(runtimeSession && hasRuntimeAfterHook);
|
|
1259
1538
|
if (shouldBufferResponse) {
|
|
1260
1539
|
const callback = args.find((arg) => typeof arg === "function");
|
|
1261
|
-
_optionalChain([callback, 'optionalCall',
|
|
1540
|
+
_optionalChain([callback, 'optionalCall', _78 => _78()]);
|
|
1262
1541
|
return true;
|
|
1263
1542
|
}
|
|
1264
1543
|
const writeResult = originalWrite(chunk, ...args);
|
|
@@ -1267,38 +1546,24 @@ function interceptFarmDevPageResponse(options) {
|
|
|
1267
1546
|
});
|
|
1268
1547
|
res.end = ((...args) => {
|
|
1269
1548
|
interceptedEnd = true;
|
|
1270
|
-
res[
|
|
1549
|
+
res[_chunkWUTFJOV7cjs.FARM_NODE_RESPONSE_END_PENDING] = true;
|
|
1271
1550
|
if (afterResponseCalled) return res;
|
|
1272
1551
|
afterResponseCalled = true;
|
|
1273
1552
|
options.logResponse(method, urlPath, res.statusCode || 200, Date.now() - startTime, "PAGE");
|
|
1274
1553
|
const originalEndArgs = [...args];
|
|
1275
1554
|
const callback = typeof originalEndArgs[originalEndArgs.length - 1] === "function" ? originalEndArgs[originalEndArgs.length - 1] : void 0;
|
|
1276
|
-
const restore = () => {
|
|
1277
|
-
res.write = originalWrite;
|
|
1278
|
-
res.end = originalEnd;
|
|
1279
|
-
res.writeHead = originalWriteHead;
|
|
1280
|
-
if (originalFlushHeaders) res.flushHeaders = originalFlushHeaders;
|
|
1281
|
-
delete res[_chunk3EEET2Q5cjs.FARM_NODE_RESPONSE_END_PENDING];
|
|
1282
|
-
};
|
|
1283
1555
|
if (streamsThroughRuntime()) {
|
|
1284
1556
|
const stream = startRuntimeStream();
|
|
1285
1557
|
streamRuntimeChunk(toNodeResponseBuffer(args[0], args[1]));
|
|
1286
1558
|
try {
|
|
1287
1559
|
stream.controller.close();
|
|
1288
|
-
} catch (
|
|
1560
|
+
} catch (e14) {
|
|
1289
1561
|
}
|
|
1290
1562
|
stream.done.then(
|
|
1291
1563
|
() => hasAfterResponseHook ? pm.runHookParallel("afterResponse", req, res) : void 0
|
|
1292
1564
|
).catch((error) => {
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
if (!res.headersSent) {
|
|
1296
|
-
res.statusCode = 500;
|
|
1297
|
-
res.removeHeader("Content-Length");
|
|
1298
|
-
res.setHeader("Content-Type", "text/plain; charset=utf-8");
|
|
1299
|
-
originalWriteHead(500);
|
|
1300
|
-
originalWrite("Internal Server Error");
|
|
1301
|
-
}
|
|
1565
|
+
reportFailure(error);
|
|
1566
|
+
if (!res.headersSent) writeRuntimeHookFailure();
|
|
1302
1567
|
}).finally(() => {
|
|
1303
1568
|
restore();
|
|
1304
1569
|
if (callback) originalEnd(callback);
|
|
@@ -1317,15 +1582,23 @@ function interceptFarmDevPageResponse(options) {
|
|
|
1317
1582
|
Promise.resolve().then(async () => {
|
|
1318
1583
|
if (isHtmlResponse) {
|
|
1319
1584
|
const fullHtml = Buffer.concat(htmlChunks).toString("utf8");
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1585
|
+
try {
|
|
1586
|
+
if (!didStreamHtml || bufferPluginResponse) {
|
|
1587
|
+
let html = await pm.runHookSerial("transformHTML", fullHtml);
|
|
1588
|
+
html = await pm.runHookSerial("afterRender", html, renderPayload);
|
|
1589
|
+
originalEndArgs.length = 0;
|
|
1590
|
+
originalEndArgs.push(html);
|
|
1591
|
+
if (callback) originalEndArgs.push(callback);
|
|
1592
|
+
} else {
|
|
1593
|
+
await pm.runHookSerial("transformHTML", fullHtml);
|
|
1594
|
+
await pm.runHookSerial("afterRender", fullHtml, renderPayload);
|
|
1595
|
+
}
|
|
1596
|
+
} catch (error) {
|
|
1597
|
+
if (runtimeSession) {
|
|
1598
|
+
runtimeHookFailed = true;
|
|
1599
|
+
await pm.failRuntimeRequest(runtimeSession, error);
|
|
1600
|
+
}
|
|
1601
|
+
throw error;
|
|
1329
1602
|
}
|
|
1330
1603
|
}
|
|
1331
1604
|
if (runtimeSession) {
|
|
@@ -1334,8 +1607,7 @@ function interceptFarmDevPageResponse(options) {
|
|
|
1334
1607
|
const canHaveBody = method !== "HEAD" && status !== 204 && status !== 205 && status !== 304;
|
|
1335
1608
|
const firstArg = originalEndArgs[0];
|
|
1336
1609
|
const responseBody = canHaveBody ? isHtmlResponse ? didStreamHtml && !bufferPluginResponse ? Buffer.concat(htmlChunks) : toNodeResponseBuffer(firstArg, originalEndArgs[1]) : hasRuntimeAfterHook ? Buffer.concat(responseChunks) : toNodeResponseBuffer(firstArg, originalEndArgs[1]) : null;
|
|
1337
|
-
const runtimeResponse = await
|
|
1338
|
-
runtimeSession,
|
|
1610
|
+
const runtimeResponse = await endRuntimeRequest(
|
|
1339
1611
|
new Response(responseBody ? toRequestBody(responseBody) : responseBody, {
|
|
1340
1612
|
status,
|
|
1341
1613
|
headers: createHeadersFromNodeResponse(res)
|
|
@@ -1357,11 +1629,16 @@ function interceptFarmDevPageResponse(options) {
|
|
|
1357
1629
|
res.end = originalEnd;
|
|
1358
1630
|
res.writeHead = originalWriteHead;
|
|
1359
1631
|
if (originalFlushHeaders) res.flushHeaders = originalFlushHeaders;
|
|
1360
|
-
delete res[
|
|
1632
|
+
delete res[_chunkWUTFJOV7cjs.FARM_NODE_RESPONSE_END_PENDING];
|
|
1361
1633
|
originalEnd(...originalEndArgs);
|
|
1362
1634
|
}).catch((error) => {
|
|
1363
|
-
|
|
1364
|
-
|
|
1635
|
+
reportFailure(error);
|
|
1636
|
+
if (runtimeHookFailed && !res.headersSent) {
|
|
1637
|
+
restore();
|
|
1638
|
+
writeRuntimeHookFailure();
|
|
1639
|
+
originalEnd(callback);
|
|
1640
|
+
return;
|
|
1641
|
+
}
|
|
1365
1642
|
const shouldBufferResponse = isHtmlResponse ? bufferPluginResponse : Boolean(runtimeSession && hasRuntimeAfterHook);
|
|
1366
1643
|
if (shouldBufferResponse) {
|
|
1367
1644
|
const body = Buffer.concat(isHtmlResponse ? htmlChunks : responseChunks);
|
|
@@ -1369,21 +1646,24 @@ function interceptFarmDevPageResponse(options) {
|
|
|
1369
1646
|
res.end = originalEnd;
|
|
1370
1647
|
res.writeHead = originalWriteHead;
|
|
1371
1648
|
if (originalFlushHeaders) res.flushHeaders = originalFlushHeaders;
|
|
1372
|
-
delete res[
|
|
1649
|
+
delete res[_chunkWUTFJOV7cjs.FARM_NODE_RESPONSE_END_PENDING];
|
|
1373
1650
|
originalEnd(body, callback);
|
|
1374
1651
|
} else {
|
|
1375
1652
|
res.write = originalWrite;
|
|
1376
1653
|
res.end = originalEnd;
|
|
1377
1654
|
res.writeHead = originalWriteHead;
|
|
1378
1655
|
if (originalFlushHeaders) res.flushHeaders = originalFlushHeaders;
|
|
1379
|
-
delete res[
|
|
1656
|
+
delete res[_chunkWUTFJOV7cjs.FARM_NODE_RESPONSE_END_PENDING];
|
|
1380
1657
|
originalEnd(...originalEndArgs);
|
|
1381
1658
|
}
|
|
1382
1659
|
});
|
|
1383
1660
|
return res;
|
|
1384
1661
|
});
|
|
1385
1662
|
return {
|
|
1386
|
-
isEnded: () => interceptedEnd || res.writableEnded
|
|
1663
|
+
isEnded: () => interceptedEnd || res.writableEnded,
|
|
1664
|
+
release() {
|
|
1665
|
+
if (!interceptedEnd) restore();
|
|
1666
|
+
}
|
|
1387
1667
|
};
|
|
1388
1668
|
}
|
|
1389
1669
|
function getFullEnvDefine(config) {
|
|
@@ -1401,16 +1681,21 @@ function getEnvDefines(config, configEnv) {
|
|
|
1401
1681
|
__FARM_API_BASE_URL__: JSON.stringify(getFarmAPIBaseURLDefine(config)),
|
|
1402
1682
|
__FARM_PUBLIC_ENV__: JSON.stringify(getPublicEnvDefine(config)),
|
|
1403
1683
|
__FARM_IMAGE_CONFIG__: JSON.stringify(
|
|
1404
|
-
|
|
1684
|
+
_chunkMCSRMEQVcjs.getPublicFarmImageConfig.call(void 0,
|
|
1685
|
+
_chunkMCSRMEQVcjs.resolveFarmImageConfig.call(void 0,
|
|
1686
|
+
config.images,
|
|
1687
|
+
_chunk67MZTLTFcjs.isFarmRendererDisabled.call(void 0, config.renderer) ? "none" : void 0
|
|
1688
|
+
)
|
|
1689
|
+
)
|
|
1405
1690
|
)
|
|
1406
1691
|
};
|
|
1407
|
-
if (_optionalChain([configEnv, 'optionalAccess',
|
|
1692
|
+
if (_optionalChain([configEnv, 'optionalAccess', _79 => _79.isSsrBuild])) {
|
|
1408
1693
|
defines.__FARM_ENV__ = JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, getFullEnvDefine(config)));
|
|
1409
1694
|
}
|
|
1410
1695
|
return defines;
|
|
1411
1696
|
}
|
|
1412
1697
|
function getFarmAPIBaseURLDefine(config) {
|
|
1413
|
-
const baseURL = _optionalChain([config, 'access',
|
|
1698
|
+
const baseURL = _optionalChain([config, 'access', _80 => _80.api, 'optionalAccess', _81 => _81.baseURL]);
|
|
1414
1699
|
return typeof baseURL === "string" && baseURL ? baseURL : _chunkPMJSG4JScjs.DEFAULT_FARM_API_BASE_PATH;
|
|
1415
1700
|
}
|
|
1416
1701
|
function isResolvedEnvScope(value) {
|
|
@@ -1430,29 +1715,61 @@ function fileContainsProgrammaticPageRoute(file) {
|
|
|
1430
1715
|
}
|
|
1431
1716
|
try {
|
|
1432
1717
|
return _chunkE7QOEV5Zcjs.scanProgrammaticPagePaths.call(void 0, fs2.readFileSync(file, "utf8")).length > 0;
|
|
1433
|
-
} catch (
|
|
1718
|
+
} catch (e15) {
|
|
1434
1719
|
return false;
|
|
1435
1720
|
}
|
|
1436
1721
|
}
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
if (!
|
|
1722
|
+
var moduleLexerReady = false;
|
|
1723
|
+
function lexModuleSpecifiers(code) {
|
|
1724
|
+
if (!moduleLexerReady) {
|
|
1725
|
+
_esmodulelexer.initSync.call(void 0, );
|
|
1726
|
+
moduleLexerReady = true;
|
|
1727
|
+
}
|
|
1728
|
+
let imports;
|
|
1729
|
+
try {
|
|
1730
|
+
[imports] = _esmodulelexer.parse.call(void 0, code);
|
|
1731
|
+
} catch (e16) {
|
|
1440
1732
|
return null;
|
|
1441
1733
|
}
|
|
1442
|
-
const
|
|
1734
|
+
const specifiers = [];
|
|
1735
|
+
for (const entry of imports) {
|
|
1736
|
+
if (entry.n === void 0 || entry.d === -2) continue;
|
|
1737
|
+
const start = entry.d === -1 ? entry.s - 1 : entry.s;
|
|
1738
|
+
const end = entry.d === -1 ? entry.e + 1 : entry.e;
|
|
1739
|
+
const quote = code[start];
|
|
1740
|
+
if (quote !== '"' && quote !== "'" || code[end - 1] !== quote) continue;
|
|
1741
|
+
specifiers.push({ value: entry.n, start, end });
|
|
1742
|
+
}
|
|
1743
|
+
return specifiers;
|
|
1744
|
+
}
|
|
1745
|
+
function parseModuleSpecifiers(options) {
|
|
1443
1746
|
let ast;
|
|
1444
1747
|
try {
|
|
1445
1748
|
ast = options.parse(options.code);
|
|
1446
|
-
} catch (
|
|
1749
|
+
} catch (e17) {
|
|
1447
1750
|
return null;
|
|
1448
1751
|
}
|
|
1752
|
+
const specifiers = [];
|
|
1449
1753
|
walkModuleAst(ast, (node) => {
|
|
1450
1754
|
if (node.type !== "ImportDeclaration" && node.type !== "ExportNamedDeclaration" && node.type !== "ExportAllDeclaration" && node.type !== "ImportExpression") {
|
|
1451
1755
|
return;
|
|
1452
1756
|
}
|
|
1453
1757
|
const source = node.source;
|
|
1454
1758
|
if (!isFarmModuleAstNode(source) || typeof source.value !== "string") return;
|
|
1455
|
-
|
|
1759
|
+
specifiers.push({ value: source.value, start: source.start, end: source.end });
|
|
1760
|
+
});
|
|
1761
|
+
return specifiers;
|
|
1762
|
+
}
|
|
1763
|
+
function rewriteEarlySsrRelativeImports(options) {
|
|
1764
|
+
const cleanId = options.id.split("?", 1)[0];
|
|
1765
|
+
if (!path6.isAbsolute(cleanId) || cleanId.replace(/\\/g, "/").includes("/node_modules/")) {
|
|
1766
|
+
return null;
|
|
1767
|
+
}
|
|
1768
|
+
const sources = _nullishCoalesce(lexModuleSpecifiers(options.code), () => ( parseModuleSpecifiers(options)));
|
|
1769
|
+
if (!sources) return null;
|
|
1770
|
+
const replacements = [];
|
|
1771
|
+
for (const source of sources) {
|
|
1772
|
+
if (!source.value.startsWith(".")) continue;
|
|
1456
1773
|
const suffixIndex = source.value.search(/[?#]/);
|
|
1457
1774
|
const sourcePath = suffixIndex === -1 ? source.value : source.value.slice(0, suffixIndex);
|
|
1458
1775
|
const suffix = suffixIndex === -1 ? "" : source.value.slice(suffixIndex);
|
|
@@ -1464,13 +1781,15 @@ function rewriteEarlySsrRelativeImports(options) {
|
|
|
1464
1781
|
end: source.end,
|
|
1465
1782
|
code: JSON.stringify(`${specifier}${suffix}`)
|
|
1466
1783
|
});
|
|
1467
|
-
}
|
|
1784
|
+
}
|
|
1468
1785
|
if (replacements.length === 0) return null;
|
|
1469
|
-
let output =
|
|
1470
|
-
|
|
1471
|
-
|
|
1786
|
+
let output = "";
|
|
1787
|
+
let copied = 0;
|
|
1788
|
+
for (const replacement of replacements.sort((left, right) => left.start - right.start)) {
|
|
1789
|
+
output += options.code.slice(copied, replacement.start) + replacement.code;
|
|
1790
|
+
copied = replacement.end;
|
|
1472
1791
|
}
|
|
1473
|
-
return output;
|
|
1792
|
+
return output + options.code.slice(copied);
|
|
1474
1793
|
}
|
|
1475
1794
|
function transformIsolatedClientBoundaryModule(options) {
|
|
1476
1795
|
if (options.slots) {
|
|
@@ -1482,18 +1801,18 @@ function transformIsolatedClientBoundaryModule(options) {
|
|
|
1482
1801
|
from: "@farm.js/core/internal/islx-react"
|
|
1483
1802
|
});
|
|
1484
1803
|
if (rewritten) options = { ...options, code: rewritten.code };
|
|
1485
|
-
} catch (
|
|
1804
|
+
} catch (e18) {
|
|
1486
1805
|
return null;
|
|
1487
1806
|
}
|
|
1488
1807
|
}
|
|
1489
1808
|
let ast;
|
|
1490
1809
|
try {
|
|
1491
1810
|
ast = options.parse(options.code);
|
|
1492
|
-
} catch (
|
|
1811
|
+
} catch (e19) {
|
|
1493
1812
|
return null;
|
|
1494
1813
|
}
|
|
1495
1814
|
const body = Array.isArray(ast.body) ? ast.body : [];
|
|
1496
|
-
const everyExportIsComponent = options.code.includes(
|
|
1815
|
+
const everyExportIsComponent = options.code.includes(_chunkMZ4CRSY7cjs.FARM_CLIENT_REFERENCE_PRAGMA) || options.moduleReference.includes(_chunkMZ4CRSY7cjs.FARM_CLIENT_REFERENCE_DIRECTORY);
|
|
1497
1816
|
const replacements = [];
|
|
1498
1817
|
const wrapperStatements = [];
|
|
1499
1818
|
const originalEntries = [];
|
|
@@ -1512,9 +1831,9 @@ function transformIsolatedClientBoundaryModule(options) {
|
|
|
1512
1831
|
transformedExports++;
|
|
1513
1832
|
};
|
|
1514
1833
|
for (const node of body) {
|
|
1515
|
-
if (_optionalChain([node, 'optionalAccess',
|
|
1834
|
+
if (_optionalChain([node, 'optionalAccess', _82 => _82.type]) === "ExportDefaultDeclaration" && node.declaration) {
|
|
1516
1835
|
const declaration2 = node.declaration;
|
|
1517
|
-
if ((declaration2.type === "FunctionDeclaration" || declaration2.type === "ClassDeclaration") && _optionalChain([declaration2, 'access',
|
|
1836
|
+
if ((declaration2.type === "FunctionDeclaration" || declaration2.type === "ClassDeclaration") && _optionalChain([declaration2, 'access', _83 => _83.id, 'optionalAccess', _84 => _84.name])) {
|
|
1518
1837
|
replacements.push({
|
|
1519
1838
|
start: node.start,
|
|
1520
1839
|
end: node.end,
|
|
@@ -1532,11 +1851,11 @@ function transformIsolatedClientBoundaryModule(options) {
|
|
|
1532
1851
|
}
|
|
1533
1852
|
continue;
|
|
1534
1853
|
}
|
|
1535
|
-
if (_optionalChain([node, 'optionalAccess',
|
|
1854
|
+
if (_optionalChain([node, 'optionalAccess', _85 => _85.type]) === "ExportNamedDeclaration" && !node.declaration && node.exportKind !== "type") {
|
|
1536
1855
|
const specifiers = (node.specifiers || []).filter(
|
|
1537
1856
|
(specifier) => specifier.type === "ExportSpecifier" && specifier.exportKind !== "type"
|
|
1538
1857
|
);
|
|
1539
|
-
const specifierName = (name) => _nullishCoalesce(_optionalChain([name, 'optionalAccess',
|
|
1858
|
+
const specifierName = (name) => _nullishCoalesce(_optionalChain([name, 'optionalAccess', _86 => _86.name]), () => ( String(_nullishCoalesce(_optionalChain([name, 'optionalAccess', _87 => _87.value]), () => ( "")))));
|
|
1540
1859
|
const isComponentExport = (specifier) => {
|
|
1541
1860
|
const exported = specifierName(specifier.exported);
|
|
1542
1861
|
return everyExportIsComponent || exported === "default" || /^[A-Z]/.test(exported);
|
|
@@ -1563,14 +1882,14 @@ function transformIsolatedClientBoundaryModule(options) {
|
|
|
1563
1882
|
if (kept.length > 0) wrapperStatements.push(`export { ${kept.join(", ")} };`);
|
|
1564
1883
|
continue;
|
|
1565
1884
|
}
|
|
1566
|
-
if (_optionalChain([node, 'optionalAccess',
|
|
1885
|
+
if (_optionalChain([node, 'optionalAccess', _88 => _88.type]) !== "ExportNamedDeclaration" || !node.declaration) continue;
|
|
1567
1886
|
const declaration = node.declaration;
|
|
1568
1887
|
const declaredNames = [];
|
|
1569
|
-
if ((declaration.type === "FunctionDeclaration" || declaration.type === "ClassDeclaration") && _optionalChain([declaration, 'access',
|
|
1888
|
+
if ((declaration.type === "FunctionDeclaration" || declaration.type === "ClassDeclaration") && _optionalChain([declaration, 'access', _89 => _89.id, 'optionalAccess', _90 => _90.name])) {
|
|
1570
1889
|
declaredNames.push(declaration.id.name);
|
|
1571
1890
|
} else if (declaration.type === "VariableDeclaration") {
|
|
1572
1891
|
for (const declarator of declaration.declarations || []) {
|
|
1573
|
-
if (_optionalChain([declarator, 'access',
|
|
1892
|
+
if (_optionalChain([declarator, 'access', _91 => _91.id, 'optionalAccess', _92 => _92.type]) === "Identifier") declaredNames.push(declarator.id.name);
|
|
1574
1893
|
}
|
|
1575
1894
|
}
|
|
1576
1895
|
const componentNames = declaredNames.filter((name) => /^[A-Z]/.test(name));
|
|
@@ -1590,8 +1909,13 @@ function transformIsolatedClientBoundaryModule(options) {
|
|
|
1590
1909
|
for (const replacement of replacements.sort((left, right) => right.start - left.start)) {
|
|
1591
1910
|
output = output.slice(0, replacement.start) + replacement.code + output.slice(replacement.end);
|
|
1592
1911
|
}
|
|
1593
|
-
const
|
|
1594
|
-
import {
|
|
1912
|
+
const isComponent = `(value) => typeof value === "function" || (typeof value === "object" && value !== null && [Symbol.for("react.memo"), Symbol.for("react.forward_ref"), Symbol.for("react.lazy")].includes(value.$$typeof))`;
|
|
1913
|
+
const runtimeImport = options.slots ? options.browser ? "const __farm_islx_island__ = (component) => component;" : `import { createIsland as __farm_islx_create_island__ } from "@farm.js/core/internal/islx-react";
|
|
1914
|
+
const __farm_is_component__ = ${isComponent};
|
|
1915
|
+
const __farm_islx_island__ = (component, ...rest) => __farm_is_component__(component) ? __farm_islx_create_island__(component, ...rest) : component;` : `import * as __farm_isolated_react__ from "react";
|
|
1916
|
+
import { createFarmIsolatedClientBoundary as __farm_create_boundary__ } from "@farm.js/core/internal/isolated-boundary";
|
|
1917
|
+
const __farm_is_component__ = ${isComponent};
|
|
1918
|
+
const __farm_create_isolated_boundary__ = (react, component, ...rest) => __farm_is_component__(component) ? __farm_create_boundary__(react, component, ...rest) : component;`;
|
|
1595
1919
|
return `${runtimeImport}
|
|
1596
1920
|
${output}
|
|
1597
1921
|
${wrapperStatements.join("\n")}
|
|
@@ -1622,8 +1946,8 @@ function isFarmModuleAstNode(value) {
|
|
|
1622
1946
|
function isFarmConfigFile(file, root) {
|
|
1623
1947
|
const normalized = file.replace(/\\/g, "/");
|
|
1624
1948
|
const rootSlug = root.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
1625
|
-
const
|
|
1626
|
-
return FARM_CONFIG_FILENAMES.has(
|
|
1949
|
+
const relative4 = normalized.startsWith(`${rootSlug}/`) ? normalized.slice(rootSlug.length + 1) : normalized;
|
|
1950
|
+
return FARM_CONFIG_FILENAMES.has(relative4);
|
|
1627
1951
|
}
|
|
1628
1952
|
var warnedClientBoundaryIds = /* @__PURE__ */ new Set();
|
|
1629
1953
|
function warnClientBoundaryOnce(context, id, code, config) {
|
|
@@ -1631,10 +1955,10 @@ function warnClientBoundaryOnce(context, id, code, config) {
|
|
|
1631
1955
|
let program;
|
|
1632
1956
|
try {
|
|
1633
1957
|
program = context.parse(code);
|
|
1634
|
-
} catch (
|
|
1958
|
+
} catch (e20) {
|
|
1635
1959
|
return;
|
|
1636
1960
|
}
|
|
1637
|
-
const publicKeys = new Set(Object.keys(_nullishCoalesce(_optionalChain([config, 'access',
|
|
1961
|
+
const publicKeys = new Set(Object.keys(_nullishCoalesce(_optionalChain([config, 'access', _93 => _93.env, 'optionalAccess', _94 => _94.public]), () => ( {}))));
|
|
1638
1962
|
const findings = analyzeClientBoundary(program, publicKeys);
|
|
1639
1963
|
if (findings.envKeys.length === 0 && findings.publicEnvKeys.length === 0 && findings.builtinImports.length === 0) {
|
|
1640
1964
|
return;
|
|
@@ -1643,7 +1967,7 @@ function warnClientBoundaryOnce(context, id, code, config) {
|
|
|
1643
1967
|
_chunkQMNWKQL4cjs.logger.warn(formatClientBoundaryWarning(id, findings));
|
|
1644
1968
|
}
|
|
1645
1969
|
function shouldEmitFarmClientRootHmr(renderer) {
|
|
1646
|
-
return
|
|
1970
|
+
return _chunk67MZTLTFcjs.getFarmRendererCapabilities.call(void 0, _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, renderer)).reconcilesRerenders;
|
|
1647
1971
|
}
|
|
1648
1972
|
function hasViteAlias(alias, find) {
|
|
1649
1973
|
if (!alias) return false;
|
|
@@ -1652,9 +1976,10 @@ function hasViteAlias(alias, find) {
|
|
|
1652
1976
|
(entry) => typeof entry.find === "string" ? entry.find === find : entry.find.test(`${find}/`)
|
|
1653
1977
|
);
|
|
1654
1978
|
}
|
|
1655
|
-
function farmPlugin(options = {}, initialPluginManager) {
|
|
1979
|
+
function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
|
|
1980
|
+
const rendererDisabled = _chunk67MZTLTFcjs.isFarmRendererDisabled.call(void 0, options.renderer);
|
|
1656
1981
|
const imageImports = farmImageImportsPlugin();
|
|
1657
|
-
const fontImports =
|
|
1982
|
+
const fontImports = _chunkF36LS2C7cjs.farmFontImportsPlugin.call(void 0, {
|
|
1658
1983
|
root: options.root,
|
|
1659
1984
|
basePath: options.basePath,
|
|
1660
1985
|
publicDir: options.publicDir
|
|
@@ -1662,17 +1987,21 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
1662
1987
|
let farmApp;
|
|
1663
1988
|
let serverFnTransformActive = false;
|
|
1664
1989
|
const islandsServerFns = () => {
|
|
1665
|
-
const config = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess',
|
|
1666
|
-
return _optionalChain([config, 'access',
|
|
1990
|
+
const config = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _95 => _95.getConfig, 'call', _96 => _96()]), () => ( options));
|
|
1991
|
+
return _optionalChain([config, 'access', _97 => _97.experimental, 'optionalAccess', _98 => _98.serverActions]) === true && _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _99 => _99.experimental, 'optionalAccess', _100 => _100.serverComponents])) === "islands";
|
|
1667
1992
|
};
|
|
1668
1993
|
let reactRefreshActive = false;
|
|
1669
1994
|
let server;
|
|
1995
|
+
let deferredGates;
|
|
1996
|
+
let pendingClientSetup = null;
|
|
1997
|
+
const farmSetupContext = new (0, _async_hooks.AsyncLocalStorage)();
|
|
1670
1998
|
let apiRouteManager;
|
|
1671
1999
|
let openAPIManager = null;
|
|
1672
2000
|
let middlewareManager;
|
|
1673
2001
|
let refreshRouteDiscovery = null;
|
|
1674
2002
|
let workflowHandler = null;
|
|
1675
2003
|
let isBuild = false;
|
|
2004
|
+
let farmOwnsDevCors = false;
|
|
1676
2005
|
const docsMCPServerDisposers = /* @__PURE__ */ new Set();
|
|
1677
2006
|
const releaseDocsMCPServers = () => {
|
|
1678
2007
|
for (const dispose of docsMCPServerDisposers) dispose();
|
|
@@ -1688,15 +2017,16 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
1688
2017
|
].join(" ");
|
|
1689
2018
|
console.log(log);
|
|
1690
2019
|
};
|
|
1691
|
-
const getProgrammaticClientRoutes = () => _nullishCoalesce(options.programmaticClientRoutes, () => ( _optionalChain([farmApp, 'optionalAccess',
|
|
1692
|
-
|
|
2020
|
+
const getProgrammaticClientRoutes = () => _nullishCoalesce(options.programmaticClientRoutes, () => ( _optionalChain([farmApp, 'optionalAccess', _101 => _101.getRouteManager, 'call', _102 => _102(), 'access', _103 => _103.getProgrammaticClientRoutes, 'call', _104 => _104()])));
|
|
2021
|
+
const plugin = {
|
|
1693
2022
|
name: "farm",
|
|
1694
2023
|
api: { getProgrammaticClientRoutes },
|
|
1695
2024
|
config(userConfig, configEnv) {
|
|
1696
2025
|
isBuild = configEnv.command === "build";
|
|
1697
|
-
const layerAliases =
|
|
1698
|
-
const sourceAlias = hasViteAlias(_optionalChain([userConfig, 'access',
|
|
2026
|
+
const layerAliases = _chunkMTBDJ326cjs.getFarmLayerAliases.call(void 0, options.layers);
|
|
2027
|
+
const sourceAlias = hasViteAlias(_optionalChain([userConfig, 'access', _105 => _105.resolve, 'optionalAccess', _106 => _106.alias]), "@") ? {} : _chunkF36LS2C7cjs.createFarmSourceAlias.call(void 0, options.root || process.cwd(), options.srcDir);
|
|
1699
2028
|
const layerRoots = (_nullishCoalesce(options.layers, () => ( []))).map((layer) => layer.root);
|
|
2029
|
+
farmOwnsDevCors = !isBuild && _optionalChain([userConfig, 'access', _107 => _107.server, 'optionalAccess', _108 => _108.cors]) === void 0;
|
|
1700
2030
|
return {
|
|
1701
2031
|
// Honor Farm's publicDir so the dev server serves the same static
|
|
1702
2032
|
// directory the production client build emits.
|
|
@@ -1709,9 +2039,10 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
1709
2039
|
alias: { ...layerAliases, ...sourceAlias }
|
|
1710
2040
|
},
|
|
1711
2041
|
server: {
|
|
2042
|
+
...farmOwnsDevCors ? { cors: false } : {},
|
|
1712
2043
|
fs: {
|
|
1713
2044
|
...layerRoots.length ? { allow: [path6.resolve(options.root || process.cwd()), ...layerRoots] } : {},
|
|
1714
|
-
deny: getFarmDevFsDeny(_optionalChain([userConfig, 'access',
|
|
2045
|
+
deny: getFarmDevFsDeny(_optionalChain([userConfig, 'access', _109 => _109.server, 'optionalAccess', _110 => _110.fs, 'optionalAccess', _111 => _111.deny]), options)
|
|
1715
2046
|
}
|
|
1716
2047
|
}
|
|
1717
2048
|
};
|
|
@@ -1721,10 +2052,10 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
1721
2052
|
await fontImports.configResolved.call(this, config);
|
|
1722
2053
|
}
|
|
1723
2054
|
serverFnTransformActive = config.plugins.some(
|
|
1724
|
-
(
|
|
2055
|
+
(plugin2) => plugin2.name === SERVER_FN_TRANSFORM_PLUGIN
|
|
1725
2056
|
);
|
|
1726
2057
|
reactRefreshActive = _chunk65Y5SIBHcjs.isFarmReactRefreshActive.call(void 0, config);
|
|
1727
|
-
if (_optionalChain([options, 'access',
|
|
2058
|
+
if (_optionalChain([options, 'access', _112 => _112.experimental, 'optionalAccess', _113 => _113.serverActions]) === true && !serverFnTransformActive && !islandsServerFns()) {
|
|
1728
2059
|
_chunkQMNWKQL4cjs.logger.warn(
|
|
1729
2060
|
"experimental.serverActions has no effect without @farm.js/plugin/rsc in the Vite plugins. Server functions stay server-only, and importing one from client code is a build error."
|
|
1730
2061
|
);
|
|
@@ -1733,42 +2064,57 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
1733
2064
|
async configureServer(viteServer) {
|
|
1734
2065
|
viteServer.middlewares.use(
|
|
1735
2066
|
createFarmDevPreviewGuard(viteServer, {
|
|
1736
|
-
getSourceRoots: () =>
|
|
2067
|
+
getSourceRoots: () => _chunkMTBDJ326cjs.getFarmSourceRoots.call(void 0, _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _114 => _114.getConfig, 'call', _115 => _115()]), () => ( options)))
|
|
1737
2068
|
})
|
|
1738
2069
|
);
|
|
1739
2070
|
if (typeof fontImports.configureServer === "function") {
|
|
1740
2071
|
await fontImports.configureServer.call(this, viteServer);
|
|
1741
2072
|
}
|
|
1742
2073
|
server = viteServer;
|
|
2074
|
+
const farmMiddlewares = _nullishCoalesce(_optionalChain([deferredGates, 'optionalAccess', _116 => _116.pre, 'access', _117 => _117.target]), () => ( viteServer.middlewares));
|
|
2075
|
+
const farmPostMiddlewares = _nullishCoalesce(_optionalChain([deferredGates, 'optionalAccess', _118 => _118.post, 'access', _119 => _119.target]), () => ( viteServer.middlewares));
|
|
1743
2076
|
const pm = initialPluginManager;
|
|
2077
|
+
const configRoutePlugins = new Set(
|
|
2078
|
+
_optionalChain([pm, 'optionalAccess', _120 => _120.getPlugins, 'call', _121 => _121(), 'access', _122 => _122.filter, 'call', _123 => _123(isFarmConfigRoutePlugin), 'access', _124 => _124.map, 'call', _125 => _125((plugin2) => plugin2.name)])
|
|
2079
|
+
);
|
|
2080
|
+
const configRedirectMatchers = (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _126 => _126.getPlugins, 'call', _127 => _127()]), () => ( []))).flatMap((plugin2) => {
|
|
2081
|
+
const matcher = _chunkAKIQ54FKcjs.getConfigRedirectMatcher.call(void 0, plugin2);
|
|
2082
|
+
return matcher ? [matcher] : [];
|
|
2083
|
+
});
|
|
1744
2084
|
const emitPluginError = async (phase, error, meta) => {
|
|
1745
2085
|
if (!pm) return;
|
|
1746
2086
|
try {
|
|
1747
2087
|
await pm.runHookParallel("onError", { phase, error, meta });
|
|
1748
|
-
} catch (
|
|
2088
|
+
} catch (e21) {
|
|
1749
2089
|
}
|
|
1750
2090
|
};
|
|
1751
|
-
farmApp = new (0,
|
|
2091
|
+
farmApp = new (0, _chunkF36LS2C7cjs.FarmApp)(
|
|
1752
2092
|
{
|
|
1753
2093
|
...options,
|
|
1754
2094
|
root: resolveDevelopmentRoot(options.root, server.config.root)
|
|
1755
2095
|
},
|
|
1756
2096
|
server
|
|
1757
2097
|
);
|
|
2098
|
+
farmApp.getRouteManager().usePackageClientBoundaryCacheFile(
|
|
2099
|
+
_chunkMZ4CRSY7cjs.resolvePackageClientBoundaryCacheFile.call(void 0,
|
|
2100
|
+
farmApp.getConfig().root,
|
|
2101
|
+
options.distDir || ".farm"
|
|
2102
|
+
)
|
|
2103
|
+
);
|
|
1758
2104
|
await farmApp.initialize();
|
|
1759
2105
|
const farmConfig = farmApp.getConfig();
|
|
1760
2106
|
let farmAppPackages;
|
|
1761
|
-
if (_optionalChain([farmConfig, 'access',
|
|
1762
|
-
|
|
1763
|
-
if (
|
|
1764
|
-
res.setHeader("X-Robots-Tag",
|
|
2107
|
+
if (_optionalChain([farmConfig, 'access', _128 => _128.agent, 'optionalAccess', _129 => _129.noindexPreviews])) {
|
|
2108
|
+
farmMiddlewares.use((_req, res, next) => {
|
|
2109
|
+
if (_chunkIGDYL2IAcjs.isFarmPreviewDeploymentEnvironment.call(void 0, process.env)) {
|
|
2110
|
+
res.setHeader("X-Robots-Tag", _chunk4E57QHPWcjs.FARM_PREVIEW_ROBOTS_TAG);
|
|
1765
2111
|
}
|
|
1766
2112
|
next();
|
|
1767
2113
|
});
|
|
1768
2114
|
}
|
|
1769
2115
|
const apiServerBasePath = _chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, farmConfig.api);
|
|
1770
2116
|
const devBuiltInRoutePaths = new Set(
|
|
1771
|
-
|
|
2117
|
+
_chunkYTNBCXCWcjs.listFarmBuiltInRoutePaths.call(void 0, {
|
|
1772
2118
|
agent: {
|
|
1773
2119
|
apiCatalog: true,
|
|
1774
2120
|
mcp: true,
|
|
@@ -1780,7 +2126,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
1780
2126
|
})
|
|
1781
2127
|
);
|
|
1782
2128
|
const serverConfig = _chunkCFG4QERRcjs.resolveFarmServerConfig.call(void 0, farmConfig.server);
|
|
1783
|
-
globalThis.__FARM_IMAGE_CONFIG__ =
|
|
2129
|
+
globalThis.__FARM_IMAGE_CONFIG__ = _chunkMCSRMEQVcjs.getPublicFarmImageConfig.call(void 0, farmConfig.images);
|
|
1784
2130
|
let imageHandler = null;
|
|
1785
2131
|
if (farmConfig.images.provider !== "none") {
|
|
1786
2132
|
const { createNodeImageFetcher, createNodeImageUrlValidator, createSharpImageTransformer } = await import("./image/sharp.cjs");
|
|
@@ -1790,7 +2136,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
1790
2136
|
validateRemoteUrl: createNodeImageUrlValidator(farmConfig.images),
|
|
1791
2137
|
// Vite owns this address. Unlike request.url, it cannot be replaced by
|
|
1792
2138
|
// a caller-controlled Host header.
|
|
1793
|
-
trustedLocalOrigin: () => _optionalChain([server, 'access',
|
|
2139
|
+
trustedLocalOrigin: () => _optionalChain([server, 'access', _130 => _130.resolvedUrls, 'optionalAccess', _131 => _131.local, 'access', _132 => _132[0]]),
|
|
1794
2140
|
onError(error) {
|
|
1795
2141
|
_chunkQMNWKQL4cjs.logger.error(
|
|
1796
2142
|
`Image optimization failed: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -1798,7 +2144,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
1798
2144
|
}
|
|
1799
2145
|
});
|
|
1800
2146
|
}
|
|
1801
|
-
const sourceRoots =
|
|
2147
|
+
const sourceRoots = _chunkMTBDJ326cjs.getFarmSourceRoots.call(void 0, farmConfig);
|
|
1802
2148
|
server.watcher.add(sourceRoots.map((source) => path6.join(source.root, source.srcDir)));
|
|
1803
2149
|
if (farmConfig.i18n.enabled) {
|
|
1804
2150
|
server.watcher.add(
|
|
@@ -1810,15 +2156,15 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
1810
2156
|
const workflowConfig = farmConfig.workflows;
|
|
1811
2157
|
const farmDocsDevRuntime = farmConfig.docs.enabled ? await loadFarmDocsDevRuntime() : null;
|
|
1812
2158
|
const getExtraRouteTypes = () => [
|
|
1813
|
-
..._optionalChain([options, 'access',
|
|
1814
|
-
..._nullishCoalesce(_optionalChain([farmDocsDevRuntime, 'optionalAccess',
|
|
2159
|
+
..._optionalChain([options, 'access', _133 => _133.openapi, 'optionalAccess', _134 => _134.enabled]) && options.openapi.route ? [options.openapi.route] : [],
|
|
2160
|
+
..._nullishCoalesce(_optionalChain([farmDocsDevRuntime, 'optionalAccess', _135 => _135.getFarmDocsRouteTypeEntries, 'call', _136 => _136(farmConfig.docs)]), () => ( []))
|
|
1815
2161
|
];
|
|
1816
2162
|
const appDirSlugs = sourceRoots.map(
|
|
1817
2163
|
(source) => path6.join(source.root, source.srcDir, "app").replace(/\\/g, "/")
|
|
1818
2164
|
);
|
|
1819
2165
|
const generateTypeArtifacts = async (reason, selection = ALL_TYPE_ARTIFACTS, log = false) => {
|
|
1820
2166
|
try {
|
|
1821
|
-
const result = await
|
|
2167
|
+
const result = await _chunkQOGIZKSOcjs.generateFarmTypeArtifacts.call(void 0, {
|
|
1822
2168
|
root: farmConfig.root,
|
|
1823
2169
|
srcDir: farmConfig.srcDir,
|
|
1824
2170
|
layers: farmConfig.layers,
|
|
@@ -1858,10 +2204,10 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
1858
2204
|
(source) => path6.join(source.root, source.srcDir).replace(/\\/g, "/")
|
|
1859
2205
|
);
|
|
1860
2206
|
const layerConfigFiles = new Set(
|
|
1861
|
-
farmConfig.layers.map((layer) => _optionalChain([layer, 'access',
|
|
2207
|
+
farmConfig.layers.map((layer) => _optionalChain([layer, 'access', _137 => _137.configFile, 'optionalAccess', _138 => _138.replace, 'call', _139 => _139(/\\/g, "/")])).filter((file) => Boolean(file))
|
|
1862
2208
|
);
|
|
1863
2209
|
const routeModuleExtensions = /* @__PURE__ */ new Set([
|
|
1864
|
-
...
|
|
2210
|
+
..._chunk67MZTLTFcjs.resolveFarmComponentExtensions.call(void 0, farmConfig.renderer.componentExtensions),
|
|
1865
2211
|
".md",
|
|
1866
2212
|
".mdx"
|
|
1867
2213
|
]);
|
|
@@ -1937,7 +2283,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
1937
2283
|
scheduleTypeArtifactGen(file, ev, typeArtifacts);
|
|
1938
2284
|
}
|
|
1939
2285
|
if (isI18nCatalogFile(file)) {
|
|
1940
|
-
_optionalChain([farmApp, 'optionalAccess',
|
|
2286
|
+
_optionalChain([farmApp, 'optionalAccess', _140 => _140.getI18nRuntime, 'call', _141 => _141(), 'access', _142 => _142.reload, 'call', _143 => _143(), 'access', _144 => _144.then, 'call', _145 => _145(() => server.ws.send({ type: "full-reload", path: "*" })), 'access', _146 => _146.catch, 'call', _147 => _147((error) => _chunkQMNWKQL4cjs.logger.warn(`i18n catalog reload failed: ${error.message}`))]);
|
|
1941
2287
|
}
|
|
1942
2288
|
const isRouteRefreshEvent = (ev !== "change" || isStaticMetadataImageFile(file)) && (isAppRuntimeFile(file) || isProgrammaticRouteFile(file) || isProgrammaticRouteSourceFile(file) && (ev === "unlink" || fileContainsProgrammaticPageRoute(file)));
|
|
1943
2289
|
if (isRouteRefreshEvent) {
|
|
@@ -1950,15 +2296,15 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
1950
2296
|
const reloadsMiddleware = pendingRouteRefreshIncludesMiddleware;
|
|
1951
2297
|
pendingRouteRefreshIncludesMiddleware = false;
|
|
1952
2298
|
Promise.all([
|
|
1953
|
-
_optionalChain([refreshRouteDiscovery, 'optionalCall',
|
|
1954
|
-
reloadsMiddleware ? _optionalChain([middlewareManager, 'optionalAccess',
|
|
2299
|
+
_optionalChain([refreshRouteDiscovery, 'optionalCall', _148 => _148(`${ev} ${file}`)]),
|
|
2300
|
+
reloadsMiddleware ? _optionalChain([middlewareManager, 'optionalAccess', _149 => _149.reload, 'call', _150 => _150()]) : void 0
|
|
1955
2301
|
]).then(() => server.ws.send({ type: "full-reload", path: "*" })).catch((error) => _chunkQMNWKQL4cjs.logger.warn(`Route refresh failed: ${error.message}`));
|
|
1956
2302
|
}, 50);
|
|
1957
2303
|
}
|
|
1958
2304
|
}
|
|
1959
2305
|
});
|
|
1960
2306
|
});
|
|
1961
|
-
const appDirs =
|
|
2307
|
+
const appDirs = _chunkMTBDJ326cjs.getFarmAppDirectories.call(void 0, farmConfig);
|
|
1962
2308
|
const routeManager = farmApp.getRouteManager();
|
|
1963
2309
|
const discoveredRoutes = [];
|
|
1964
2310
|
for (const [pattern, entry] of routeManager.getRoutes()) {
|
|
@@ -1990,14 +2336,14 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
1990
2336
|
const { FARM_DEV_SERVER_MODULE_LOADER } = await import("./internal/native-server-fns.cjs");
|
|
1991
2337
|
const load = (file) => _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, server, file);
|
|
1992
2338
|
globalThis[FARM_DEV_SERVER_MODULE_LOADER] = load;
|
|
1993
|
-
_optionalChain([server, 'access',
|
|
2339
|
+
_optionalChain([server, 'access', _151 => _151.httpServer, 'optionalAccess', _152 => _152.once, 'call', _153 => _153("close", () => {
|
|
1994
2340
|
const globals = globalThis;
|
|
1995
2341
|
if (globals[FARM_DEV_SERVER_MODULE_LOADER] === load) {
|
|
1996
2342
|
delete globals[FARM_DEV_SERVER_MODULE_LOADER];
|
|
1997
2343
|
}
|
|
1998
2344
|
})]);
|
|
1999
2345
|
}
|
|
2000
|
-
apiRouteManager = new (0,
|
|
2346
|
+
apiRouteManager = new (0, _chunkOFBLGH6Vcjs.APIRouteManager)(appDirs, server, {
|
|
2001
2347
|
plugins: farmConfig.plugins,
|
|
2002
2348
|
i18n: farmApp.getI18nRuntime(),
|
|
2003
2349
|
bodySizeLimit: serverConfig.bodySizeLimit,
|
|
@@ -2043,7 +2389,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
2043
2389
|
});
|
|
2044
2390
|
}
|
|
2045
2391
|
}
|
|
2046
|
-
middlewareManager = new (0,
|
|
2392
|
+
middlewareManager = new (0, _chunkVX2HZGC7cjs.MiddlewareManager)(
|
|
2047
2393
|
appDirs,
|
|
2048
2394
|
server,
|
|
2049
2395
|
farmConfig.middleware,
|
|
@@ -2064,11 +2410,12 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
2064
2410
|
});
|
|
2065
2411
|
}
|
|
2066
2412
|
}
|
|
2067
|
-
if (_optionalChain([options, 'access',
|
|
2413
|
+
if (_optionalChain([options, 'access', _154 => _154.openapi, 'optionalAccess', _155 => _155.enabled])) {
|
|
2068
2414
|
const { OpenAPIManager } = await loadFarmOpenAPIDevRuntime();
|
|
2069
2415
|
openAPIManager = new OpenAPIManager(appDirs, options.openapi, {
|
|
2070
2416
|
mode: "development",
|
|
2071
|
-
apiBaseURL: typeof _optionalChain([options, 'access',
|
|
2417
|
+
apiBaseURL: typeof _optionalChain([options, 'access', _156 => _156.api, 'optionalAccess', _157 => _157.baseURL]) === "string" ? options.api.baseURL : void 0,
|
|
2418
|
+
loadModule: (filePath) => apiRouteManager.loadModule(filePath)
|
|
2072
2419
|
});
|
|
2073
2420
|
const spec = await openAPIManager.generateSpec();
|
|
2074
2421
|
reportOpenAPIDevGenerationResult(spec);
|
|
@@ -2097,7 +2444,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
2097
2444
|
return _chunk7EPYN7GWcjs.resolveFarmLayoutFonts.call(void 0, layoutModules);
|
|
2098
2445
|
};
|
|
2099
2446
|
releaseDocsMCPServers();
|
|
2100
|
-
const isFarmDocsPathGuarded = (href) =>
|
|
2447
|
+
const isFarmDocsPathGuarded = (href) => _chunkUPOYKX4Scjs.farmPathGuardCoversPage.call(void 0,
|
|
2101
2448
|
{
|
|
2102
2449
|
config: farmConfig,
|
|
2103
2450
|
middlewareRoutes: middlewareManager.getMiddlewares().filter((entry) => entry.source !== "config")
|
|
@@ -2110,19 +2457,20 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
2110
2457
|
clientEntry: "/@farm/client.js",
|
|
2111
2458
|
resolveLayoutFonts: resolveDocsLayoutFonts,
|
|
2112
2459
|
fontStylesheetHref: "/@farm/fonts.css",
|
|
2113
|
-
globalStylesheetHref:
|
|
2460
|
+
globalStylesheetHref: _chunkF36LS2C7cjs.resolveDevGlobalStylesheetHref.call(void 0,
|
|
2114
2461
|
farmConfig.root,
|
|
2115
2462
|
farmConfig.srcDir
|
|
2116
2463
|
),
|
|
2117
2464
|
loadModule: async (specifier) => {
|
|
2118
2465
|
const resolved = await server.environments.ssr.pluginContainer.resolveId(specifier);
|
|
2119
|
-
if (specifier === _optionalChain([farmConfig, 'access',
|
|
2466
|
+
if (specifier === _optionalChain([farmConfig, 'access', _158 => _158.docs, 'access', _159 => _159.adapter, 'optionalAccess', _160 => _160.server]) && _optionalChain([resolved, 'optionalAccess', _161 => _161.id])) {
|
|
2467
|
+
const file = resolved.id.split("?", 1)[0];
|
|
2120
2468
|
return import(
|
|
2121
2469
|
/* @vite-ignore */
|
|
2122
|
-
_url.pathToFileURL.call(void 0,
|
|
2470
|
+
_url.pathToFileURL.call(void 0, file).href
|
|
2123
2471
|
);
|
|
2124
2472
|
}
|
|
2125
|
-
return _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, server, _nullishCoalesce(_optionalChain([resolved, 'optionalAccess',
|
|
2473
|
+
return _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, server, _nullishCoalesce(_optionalChain([resolved, 'optionalAccess', _162 => _162.id]), () => ( specifier)));
|
|
2126
2474
|
},
|
|
2127
2475
|
registerMCPServer: (mcpServer) => {
|
|
2128
2476
|
const dispose = _chunkLRB5OVRTcjs.registerFarmMCPServer.call(void 0, mcpServer);
|
|
@@ -2140,21 +2488,22 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
2140
2488
|
fontAssets: _chunkERMUL73Lcjs.toFarmDocsPublicFontAssets.call(void 0, farmDocsFontAssetList),
|
|
2141
2489
|
resolveLayoutFonts: resolveDocsLayoutFonts,
|
|
2142
2490
|
fontStylesheetHref: "/@farm/fonts.css",
|
|
2143
|
-
globalStylesheetHref:
|
|
2491
|
+
globalStylesheetHref: _chunkF36LS2C7cjs.resolveDevGlobalStylesheetHref.call(void 0,
|
|
2144
2492
|
farmConfig.root,
|
|
2145
2493
|
farmConfig.srcDir
|
|
2146
2494
|
),
|
|
2147
|
-
isPathGuarded: isFarmDocsPathGuarded
|
|
2495
|
+
isPathGuarded: isFarmDocsPathGuarded,
|
|
2496
|
+
basePath: farmConfig.basePath
|
|
2148
2497
|
}) : null;
|
|
2149
2498
|
const wrapFarmDocsResponseWithLayouts = async (request, response) => {
|
|
2150
|
-
if (request.method === "HEAD" || response.headers.has("x-farm-docs-adapter") || !_optionalChain([response, 'access',
|
|
2499
|
+
if (request.method === "HEAD" || response.headers.has("x-farm-docs-adapter") || !_optionalChain([response, 'access', _163 => _163.headers, 'access', _164 => _164.get, 'call', _165 => _165("content-type"), 'optionalAccess', _166 => _166.toLowerCase, 'call', _167 => _167(), 'access', _168 => _168.includes, 'call', _169 => _169("text/html")])) {
|
|
2151
2500
|
return response;
|
|
2152
2501
|
}
|
|
2153
2502
|
const pathname = new URL(request.url).pathname;
|
|
2154
2503
|
const matchedRoute = routeManager.matchRoute(pathname);
|
|
2155
2504
|
const layoutEntries = matchedRoute.layouts.map((layout) => ({
|
|
2156
2505
|
...layout,
|
|
2157
|
-
metadata:
|
|
2506
|
+
metadata: _chunkMZ4CRSY7cjs.getClientModuleMetadata.call(void 0, layout.modulePath, farmConfig.root)
|
|
2158
2507
|
}));
|
|
2159
2508
|
if (!layoutEntries.some((layout) => layout.metadata.shouldHydrate)) {
|
|
2160
2509
|
return response;
|
|
@@ -2168,9 +2517,9 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
2168
2517
|
headers: response.headers
|
|
2169
2518
|
});
|
|
2170
2519
|
}
|
|
2171
|
-
const docsRenderer =
|
|
2520
|
+
const docsRenderer = _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, (_nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _170 => _170.getConfig, 'call', _171 => _171()]), () => ( options))).renderer);
|
|
2172
2521
|
const [rendererRuntime, layoutModules] = await Promise.all([
|
|
2173
|
-
|
|
2522
|
+
_chunk67MZTLTFcjs.isReactRenderer.call(void 0, docsRenderer) ? import("./renderer/react/server.cjs") : _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, server, docsRenderer.server),
|
|
2174
2523
|
Promise.all(
|
|
2175
2524
|
layoutEntries.map((layout) => routeManager.loadLayoutModule(layout.modulePath))
|
|
2176
2525
|
)
|
|
@@ -2197,7 +2546,7 @@ function farmPlugin(options = {}, initialPluginManager) {
|
|
|
2197
2546
|
])
|
|
2198
2547
|
);
|
|
2199
2548
|
const inlineValue = (value) => JSON.stringify(value).replace(/</g, "\\u003c").replace(/>/g, "\\u003e");
|
|
2200
|
-
const pageModulePath = _optionalChain([matchedRoute, 'access',
|
|
2549
|
+
const pageModulePath = _optionalChain([matchedRoute, 'access', _172 => _172.route, 'optionalAccess', _173 => _173.modulePath]) ? toUrlPath(matchedRoute.route.modulePath) : "";
|
|
2201
2550
|
const bootstrapScript = `<script>
|
|
2202
2551
|
window.__FARM_PROPS__ = ${inlineValue({ params })};
|
|
2203
2552
|
window.__FARM_ROUTE_SLOTS__ = [];
|
|
@@ -2253,7 +2602,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2253
2602
|
srcDir: farmConfig.srcDir,
|
|
2254
2603
|
docs: farmConfig.docs,
|
|
2255
2604
|
diagnostics: true,
|
|
2256
|
-
isPathGuarded: isFarmDocsPathGuarded
|
|
2605
|
+
isPathGuarded: isFarmDocsPathGuarded,
|
|
2606
|
+
basePath: farmConfig.basePath
|
|
2257
2607
|
}) : null;
|
|
2258
2608
|
const farmDocsFontAssets = new Map(
|
|
2259
2609
|
farmDocsFontAssetList.map(({ url, sourcePath }) => [url, sourcePath])
|
|
@@ -2293,24 +2643,55 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2293
2643
|
}
|
|
2294
2644
|
},
|
|
2295
2645
|
(request) => {
|
|
2296
|
-
const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess',
|
|
2646
|
+
const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _174 => _174.getConfig, 'call', _175 => _175()]), () => ( options));
|
|
2297
2647
|
const currentServerConfig = _chunkCFG4QERRcjs.resolveFarmServerConfig.call(void 0, currentConfig.server);
|
|
2298
|
-
return
|
|
2648
|
+
return _chunkHDPT6OYEcjs.resolveFarmRequestURL.call(void 0, request, {
|
|
2299
2649
|
trustProxy: currentServerConfig.trustProxy
|
|
2300
2650
|
});
|
|
2301
2651
|
}
|
|
2302
2652
|
);
|
|
2303
|
-
server.
|
|
2304
|
-
|
|
2653
|
+
const publicFileIndex = createFarmPublicFileIndex(() => server.config.publicDir);
|
|
2654
|
+
for (const event of ["add", "unlink", "addDir", "unlinkDir"]) {
|
|
2655
|
+
server.watcher.on(event, (file) => publicFileIndex.invalidate(file));
|
|
2656
|
+
}
|
|
2657
|
+
const deferredDottedRequests = /* @__PURE__ */ new WeakMap();
|
|
2658
|
+
farmMiddlewares.use(
|
|
2659
|
+
withAPIRequestTracing(async function handleFarmDevRequest(req, res, next) {
|
|
2305
2660
|
const requestUrl = req.url || "/";
|
|
2306
2661
|
const requestMethod = req.method || "GET";
|
|
2307
|
-
const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess',
|
|
2662
|
+
const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _176 => _176.getConfig, 'call', _177 => _177()]), () => ( options));
|
|
2308
2663
|
const currentServerConfig = _chunkCFG4QERRcjs.resolveFarmServerConfig.call(void 0, currentConfig.server);
|
|
2309
|
-
const parsedRequestUrl =
|
|
2664
|
+
const parsedRequestUrl = _chunkHDPT6OYEcjs.resolveFarmRequestURL.call(void 0, req, {
|
|
2310
2665
|
trustProxy: currentServerConfig.trustProxy
|
|
2311
2666
|
});
|
|
2312
2667
|
const fullUrl = parsedRequestUrl.toString();
|
|
2313
2668
|
const requestPathname = parsedRequestUrl.pathname;
|
|
2669
|
+
if (isMalformedFarmRequestPathname(requestPathname)) {
|
|
2670
|
+
res.statusCode = 400;
|
|
2671
|
+
res.setHeader("Content-Type", "application/json; charset=utf-8");
|
|
2672
|
+
res.end(requestMethod === "HEAD" ? void 0 : FARM_MALFORMED_REQUEST_BODY);
|
|
2673
|
+
return;
|
|
2674
|
+
}
|
|
2675
|
+
if ((requestMethod === "GET" || requestMethod === "HEAD") && req[FARM_DEV_CONFIG_REWRITE_SOURCE] === void 0 && !isViteModuleRequest(parsedRequestUrl, req.headers)) {
|
|
2676
|
+
const publicFile = resolveFarmPublicFilePath(requestPathname, publicFileIndex.get());
|
|
2677
|
+
if (publicFile) {
|
|
2678
|
+
if (publicFile !== requestPathname) {
|
|
2679
|
+
req.url = `${encodeURI(publicFile)}${parsedRequestUrl.search}`;
|
|
2680
|
+
}
|
|
2681
|
+
return next();
|
|
2682
|
+
}
|
|
2683
|
+
}
|
|
2684
|
+
if (requestMethod === "OPTIONS" && req.headers.origin && req.headers["access-control-request-method"]) {
|
|
2685
|
+
const preflightHeaders = _chunkOCNV4CI2cjs.resolveRouteRuleCorsPreflightHeaders.call(void 0,
|
|
2686
|
+
currentConfig.routeRules,
|
|
2687
|
+
requestPathname
|
|
2688
|
+
);
|
|
2689
|
+
if (preflightHeaders) {
|
|
2690
|
+
res.writeHead(204, preflightHeaders);
|
|
2691
|
+
res.end();
|
|
2692
|
+
return;
|
|
2693
|
+
}
|
|
2694
|
+
}
|
|
2314
2695
|
if (imageHandler && requestPathname === farmConfig.images.path) {
|
|
2315
2696
|
const imageResponse = await imageHandler(
|
|
2316
2697
|
createRequestFromNodeRequest(req, new URL(fullUrl))
|
|
@@ -2337,7 +2718,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2337
2718
|
res.end("Farm DevTools are disabled.");
|
|
2338
2719
|
return;
|
|
2339
2720
|
}
|
|
2340
|
-
if (requestPathname === _chunkSTF6VDYQcjs.FARM_DEVTOOLS_PATH && parsedRequestUrl.searchParams.get("embedded") !== "1") {
|
|
2721
|
+
if (requestPathname === _chunkSTF6VDYQcjs.FARM_DEVTOOLS_PATH && parsedRequestUrl.searchParams.get("embedded") !== "1" && !rendererDisabled) {
|
|
2341
2722
|
let launchUrl = new URL(farmConfig.basePath || "/", parsedRequestUrl.origin);
|
|
2342
2723
|
const referrer = req.headers.referer;
|
|
2343
2724
|
if (referrer) {
|
|
@@ -2346,7 +2727,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2346
2727
|
if (referrerUrl.origin === parsedRequestUrl.origin && !referrerUrl.pathname.startsWith(_chunkSTF6VDYQcjs.FARM_DEVTOOLS_PATH)) {
|
|
2347
2728
|
launchUrl = referrerUrl;
|
|
2348
2729
|
}
|
|
2349
|
-
} catch (
|
|
2730
|
+
} catch (e22) {
|
|
2350
2731
|
}
|
|
2351
2732
|
}
|
|
2352
2733
|
launchUrl.searchParams.set(_chunkSTF6VDYQcjs.FARM_DEVTOOLS_LAUNCH_PARAM, "1");
|
|
@@ -2372,7 +2753,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2372
2753
|
openapi: options.openapi
|
|
2373
2754
|
},
|
|
2374
2755
|
workflows: discoveredWorkflows,
|
|
2375
|
-
plugins: _optionalChain([pm, 'optionalAccess',
|
|
2756
|
+
plugins: _optionalChain([pm, 'optionalAccess', _178 => _178.getSortedPlugins, 'call', _179 => _179()])
|
|
2376
2757
|
});
|
|
2377
2758
|
res.statusCode = 200;
|
|
2378
2759
|
res.setHeader(
|
|
@@ -2394,8 +2775,59 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2394
2775
|
}
|
|
2395
2776
|
return;
|
|
2396
2777
|
}
|
|
2778
|
+
const isViteOwnedRequest = () => requestUrl.startsWith("/@") || requestUrl.startsWith("/node_modules/") || requestUrl.startsWith("/__farm/") || isViteModuleRequest(parsedRequestUrl, req.headers) || (requestMethod === "GET" || requestMethod === "HEAD") && requestPathname.includes(".") && (devServableFileExists(requestPathname, [server.config.publicDir]) || isViteDevClientRequest(parsedRequestUrl, req.headers) && devServableFileExists(requestPathname, [server.config.root]));
|
|
2779
|
+
const configRewriteSource = req[FARM_DEV_CONFIG_REWRITE_SOURCE];
|
|
2780
|
+
const runtimeHookErrorAnswersJSON = rendererDisabled || _chunkXGTFLG73cjs.isFarmAPIPathname.call(void 0, requestPathname, apiServerBasePath);
|
|
2781
|
+
if (pm && configRewriteSource === void 0 && !deferredDottedRequests.has(req) && (configRoutePlugins.has(_chunkAKIQ54FKcjs.FARM_CONFIG_HEADERS_PLUGIN_NAME) || configRedirectMatchers.length > 0) && !isViteOwnedRequest()) {
|
|
2782
|
+
let redirect = null;
|
|
2783
|
+
try {
|
|
2784
|
+
await pm.runHookParallelFiltered(
|
|
2785
|
+
"beforeRequest",
|
|
2786
|
+
(plugin2) => plugin2.name === _chunkAKIQ54FKcjs.FARM_CONFIG_HEADERS_PLUGIN_NAME,
|
|
2787
|
+
req,
|
|
2788
|
+
res
|
|
2789
|
+
);
|
|
2790
|
+
for (const matchRedirect of configRedirectMatchers) {
|
|
2791
|
+
_nullishCoalesce(redirect, () => ( (redirect = matchRedirect(parsedRequestUrl))));
|
|
2792
|
+
}
|
|
2793
|
+
} catch (error) {
|
|
2794
|
+
await emitPluginError("before-request", error, { urlPath: requestUrl });
|
|
2795
|
+
if (!res.headersSent) {
|
|
2796
|
+
res.statusCode = 500;
|
|
2797
|
+
res.setHeader("Content-Type", "text/plain; charset=utf-8");
|
|
2798
|
+
}
|
|
2799
|
+
res.end("Internal Server Error");
|
|
2800
|
+
return;
|
|
2801
|
+
}
|
|
2802
|
+
if (redirect) {
|
|
2803
|
+
let response = new Response(`Redirecting to ${redirect.destination}`, {
|
|
2804
|
+
status: redirect.statusCode,
|
|
2805
|
+
headers: { Location: redirect.destination }
|
|
2806
|
+
});
|
|
2807
|
+
if (pm.hasRuntimeRequestHooks()) {
|
|
2808
|
+
const redirectResponse = response;
|
|
2809
|
+
try {
|
|
2810
|
+
response = await pm.runRuntimeRequest(
|
|
2811
|
+
createRequestFromNodeRequest(req, parsedRequestUrl),
|
|
2812
|
+
() => redirectResponse,
|
|
2813
|
+
{
|
|
2814
|
+
kind: _chunkXGTFLG73cjs.isFarmAPIPathname.call(void 0, requestPathname, apiServerBasePath) ? "api" : requestMethod === "GET" || requestMethod === "HEAD" ? "page" : "request",
|
|
2815
|
+
route: { pathname: requestPathname }
|
|
2816
|
+
}
|
|
2817
|
+
);
|
|
2818
|
+
} catch (e23) {
|
|
2819
|
+
sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
|
|
2820
|
+
logResponse(requestMethod, requestUrl, 500, 0, "PAGE");
|
|
2821
|
+
return;
|
|
2822
|
+
}
|
|
2823
|
+
}
|
|
2824
|
+
await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, response);
|
|
2825
|
+
logResponse(requestMethod, requestUrl, res.statusCode, 0, "PAGE");
|
|
2826
|
+
return;
|
|
2827
|
+
}
|
|
2828
|
+
}
|
|
2397
2829
|
const runAppMiddlewareForContentRoute = async () => {
|
|
2398
|
-
if (!_optionalChain([middlewareManager, 'optionalAccess',
|
|
2830
|
+
if (!_optionalChain([middlewareManager, 'optionalAccess', _180 => _180.hasMiddleware, 'call', _181 => _181()])) return false;
|
|
2399
2831
|
const middlewareRequest = createRequestFromNodeRequest(req, new URL(fullUrl));
|
|
2400
2832
|
return runFarmMiddlewareWithNavigation(
|
|
2401
2833
|
farmApp.getServerRenderer(),
|
|
@@ -2405,67 +2837,108 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2405
2837
|
() => middlewareManager.execute(req, res)
|
|
2406
2838
|
);
|
|
2407
2839
|
};
|
|
2840
|
+
const runAppMiddlewareInRuntimeSession = async (runtimeSession2, logResponse2) => {
|
|
2841
|
+
const interceptor = runtimeSession2 && _optionalChain([pm, 'optionalAccess', _182 => _182.hasRuntimeHook, 'call', _183 => _183("after")]) && _optionalChain([middlewareManager, 'optionalAccess', _184 => _184.hasMiddleware, 'call', _185 => _185()]) ? interceptFarmDevPageResponse({
|
|
2842
|
+
req,
|
|
2843
|
+
res,
|
|
2844
|
+
pm,
|
|
2845
|
+
runtimeSession: runtimeSession2,
|
|
2846
|
+
hasRuntimeAfterHook: true,
|
|
2847
|
+
hasAfterResponseHook: false,
|
|
2848
|
+
hasHTMLTransformHook: false,
|
|
2849
|
+
renderPayload: {},
|
|
2850
|
+
method: requestMethod,
|
|
2851
|
+
urlPath: requestUrl,
|
|
2852
|
+
pathname: requestPathname,
|
|
2853
|
+
startTime: Date.now(),
|
|
2854
|
+
logResponse: (_method, _path, status) => _optionalChain([logResponse2, 'optionalCall', _186 => _186(status)]),
|
|
2855
|
+
// The runtime reports a runtime.after failure itself.
|
|
2856
|
+
emitError: async () => {
|
|
2857
|
+
},
|
|
2858
|
+
jsonError: runtimeHookErrorAnswersJSON
|
|
2859
|
+
}) : void 0;
|
|
2860
|
+
let handled;
|
|
2861
|
+
try {
|
|
2862
|
+
handled = await runAppMiddlewareForContentRoute();
|
|
2863
|
+
} catch (error) {
|
|
2864
|
+
_optionalChain([interceptor, 'optionalAccess', _187 => _187.release, 'call', _188 => _188()]);
|
|
2865
|
+
throw error;
|
|
2866
|
+
}
|
|
2867
|
+
if (!handled) {
|
|
2868
|
+
_optionalChain([interceptor, 'optionalAccess', _189 => _189.release, 'call', _190 => _190()]);
|
|
2869
|
+
return false;
|
|
2870
|
+
}
|
|
2871
|
+
if (!_optionalChain([interceptor, 'optionalAccess', _191 => _191.isEnded, 'call', _192 => _192()])) _optionalChain([logResponse2, 'optionalCall', _193 => _193(res.statusCode || 200)]);
|
|
2872
|
+
return true;
|
|
2873
|
+
};
|
|
2408
2874
|
const serveBuiltInRoute = async (respond, {
|
|
2409
2875
|
kind = requestMethod === "GET" || requestMethod === "HEAD" ? "page" : "request",
|
|
2410
2876
|
computed,
|
|
2411
2877
|
label
|
|
2412
2878
|
} = {}) => {
|
|
2413
2879
|
const discard = async () => {
|
|
2414
|
-
await _optionalChain([computed, 'optionalAccess',
|
|
2880
|
+
await _optionalChain([computed, 'optionalAccess', _194 => _194.body, 'optionalAccess', _195 => _195.cancel, 'call', _196 => _196(), 'access', _197 => _197.catch, 'call', _198 => _198(() => {
|
|
2415
2881
|
})]);
|
|
2416
2882
|
};
|
|
2883
|
+
const sendRuntimeResponse = async (runtimeSession3, response2) => {
|
|
2884
|
+
let runtimeResponse;
|
|
2885
|
+
try {
|
|
2886
|
+
runtimeResponse = await pm.endRuntimeRequest(runtimeSession3, response2);
|
|
2887
|
+
} catch (e24) {
|
|
2888
|
+
sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
|
|
2889
|
+
return;
|
|
2890
|
+
}
|
|
2891
|
+
await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, runtimeResponse);
|
|
2892
|
+
};
|
|
2417
2893
|
let runtimeSession2;
|
|
2418
|
-
if (_optionalChain([pm, 'optionalAccess',
|
|
2894
|
+
if (_optionalChain([pm, 'optionalAccess', _199 => _199.hasRuntimeRequestHooks, 'call', _200 => _200()])) {
|
|
2419
2895
|
try {
|
|
2420
2896
|
const routePathname = _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath);
|
|
2421
|
-
const route =
|
|
2897
|
+
const route = _chunkYTNBCXCWcjs.setFarmRouteLabel.call(void 0,
|
|
2422
2898
|
{ pathname: requestPathname },
|
|
2423
|
-
label !== void 0 ? label : devBuiltInRoutePaths.has(routePathname) ? routePathname :
|
|
2899
|
+
label !== void 0 ? label : devBuiltInRoutePaths.has(routePathname) ? routePathname : _chunkYTNBCXCWcjs.resolveFarmMCPRouteLabel.call(void 0, routePathname, apiServerBasePath)
|
|
2424
2900
|
);
|
|
2425
2901
|
runtimeSession2 = await pm.beginRuntimeRequest(
|
|
2426
2902
|
createRequestFromNodeRequest(req, new URL(fullUrl)),
|
|
2427
2903
|
{ kind, route }
|
|
2428
2904
|
);
|
|
2429
|
-
} catch (
|
|
2905
|
+
} catch (e25) {
|
|
2430
2906
|
await discard();
|
|
2431
|
-
|
|
2432
|
-
res.statusCode = 500;
|
|
2433
|
-
res.setHeader("Content-Type", "text/plain; charset=utf-8");
|
|
2434
|
-
res.end("Internal Server Error");
|
|
2907
|
+
sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
|
|
2435
2908
|
return;
|
|
2436
2909
|
}
|
|
2437
2910
|
if (runtimeSession2.response) {
|
|
2438
2911
|
await discard();
|
|
2439
|
-
await
|
|
2440
|
-
res,
|
|
2441
|
-
await pm.endRuntimeRequest(runtimeSession2, runtimeSession2.response)
|
|
2442
|
-
);
|
|
2912
|
+
await sendRuntimeResponse(runtimeSession2, runtimeSession2.response);
|
|
2443
2913
|
return;
|
|
2444
2914
|
}
|
|
2445
2915
|
pm.copyRequestContext(runtimeSession2.request, req);
|
|
2446
2916
|
applyWebRequestToNodeRequest(runtimeSession2.request, req);
|
|
2447
2917
|
}
|
|
2448
|
-
if (await runAppMiddlewareForContentRoute()) {
|
|
2449
|
-
await discard();
|
|
2450
|
-
return;
|
|
2451
|
-
}
|
|
2452
2918
|
let response;
|
|
2919
|
+
let responding = false;
|
|
2453
2920
|
try {
|
|
2921
|
+
if (await runAppMiddlewareInRuntimeSession(runtimeSession2)) {
|
|
2922
|
+
await discard();
|
|
2923
|
+
return;
|
|
2924
|
+
}
|
|
2925
|
+
responding = true;
|
|
2454
2926
|
response = await respond(
|
|
2455
|
-
_nullishCoalesce(_optionalChain([runtimeSession2, 'optionalAccess',
|
|
2927
|
+
_nullishCoalesce(_optionalChain([runtimeSession2, 'optionalAccess', _201 => _201.request]), () => ( createRequestFromNodeRequest(req, new URL(fullUrl))))
|
|
2456
2928
|
);
|
|
2457
2929
|
} catch (error) {
|
|
2458
2930
|
if (runtimeSession2) await pm.failRuntimeRequest(runtimeSession2, error);
|
|
2459
|
-
throw error;
|
|
2931
|
+
if (!runtimeSession2 || !responding || res.headersSent) throw error;
|
|
2932
|
+
console.error("[FARM] Built-in route error:", error);
|
|
2933
|
+
sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
|
|
2934
|
+
return;
|
|
2460
2935
|
}
|
|
2461
2936
|
if (!response) return;
|
|
2462
|
-
await
|
|
2463
|
-
|
|
2464
|
-
runtimeSession2 ? await pm.endRuntimeRequest(runtimeSession2, response) : response
|
|
2465
|
-
);
|
|
2937
|
+
if (runtimeSession2) await sendRuntimeResponse(runtimeSession2, response);
|
|
2938
|
+
else await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, response);
|
|
2466
2939
|
};
|
|
2467
2940
|
const openAPIRequestPathname = openAPIManager ? _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath) : requestPathname;
|
|
2468
|
-
if (openAPIManager && _optionalChain([options, 'access',
|
|
2941
|
+
if (openAPIManager && _optionalChain([options, 'access', _202 => _202.openapi, 'optionalAccess', _203 => _203.specRoute]) && openAPIRequestPathname === options.openapi.specRoute) {
|
|
2469
2942
|
const specManager = openAPIManager;
|
|
2470
2943
|
await serveBuiltInRoute(async () => {
|
|
2471
2944
|
if (requestMethod !== "GET" && requestMethod !== "HEAD") {
|
|
@@ -2485,7 +2958,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2485
2958
|
});
|
|
2486
2959
|
return;
|
|
2487
2960
|
}
|
|
2488
|
-
if (openAPIManager && openAPIRequestPathname === _optionalChain([options, 'access',
|
|
2961
|
+
if (openAPIManager && openAPIRequestPathname === _optionalChain([options, 'access', _204 => _204.openapi, 'optionalAccess', _205 => _205.route])) {
|
|
2489
2962
|
const docsManager = openAPIManager;
|
|
2490
2963
|
await serveBuiltInRoute(
|
|
2491
2964
|
async () => {
|
|
@@ -2496,24 +2969,24 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2496
2969
|
);
|
|
2497
2970
|
return;
|
|
2498
2971
|
}
|
|
2499
|
-
if (_optionalChain([options, 'access',
|
|
2972
|
+
if (_optionalChain([options, 'access', _206 => _206.agent, 'optionalAccess', _207 => _207.manifest]) !== false && _chunkYTNBCXCWcjs.isFarmAppManifestPath.call(void 0, _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath))) {
|
|
2500
2973
|
await serveBuiltInRoute(async () => {
|
|
2501
|
-
_nullishCoalesce(farmAppPackages, () => ( (farmAppPackages =
|
|
2502
|
-
const manifest = await
|
|
2974
|
+
_nullishCoalesce(farmAppPackages, () => ( (farmAppPackages = _chunkF36LS2C7cjs.resolveFarmAppPackages.call(void 0, _nullishCoalesce(farmConfig.root, () => ( process.cwd()))))));
|
|
2975
|
+
const manifest = await _chunkYTNBCXCWcjs.createFarmAppManifestResponse.call(void 0,
|
|
2503
2976
|
new Request(parsedRequestUrl, {
|
|
2504
2977
|
method: requestMethod,
|
|
2505
2978
|
headers: { "if-none-match": String(_nullishCoalesce(req.headers["if-none-match"], () => ( ""))) }
|
|
2506
2979
|
}),
|
|
2507
2980
|
{
|
|
2508
|
-
...
|
|
2981
|
+
..._chunkYTNBCXCWcjs.resolveFarmAppManifestInput.call(void 0, farmConfig, {
|
|
2509
2982
|
build: "development",
|
|
2510
2983
|
packages: farmAppPackages,
|
|
2511
2984
|
// Read again on each request; unchanged files come from a cache.
|
|
2512
|
-
webmcpTools: _optionalChain([farmConfig, 'access',
|
|
2985
|
+
webmcpTools: _optionalChain([farmConfig, 'access', _208 => _208.plugins, 'optionalAccess', _209 => _209.some, 'call', _210 => _210(({ name }) => name === "farm:webmcp")]) ? _chunkF36LS2C7cjs.collectFarmWebMCPTools.call(void 0, _nullishCoalesce(farmConfig.root, () => ( process.cwd())), farmConfig.srcDir) : []
|
|
2513
2986
|
}),
|
|
2514
2987
|
defaultMCP: () => farmApp.getServerRenderer().getDefaultMCPServer(),
|
|
2515
2988
|
// A guard written for an MCP server's path keeps its tools out of the public view.
|
|
2516
|
-
guardCoversPath: (path7) =>
|
|
2989
|
+
guardCoversPath: (path7) => _chunkUPOYKX4Scjs.farmPathGuardCoversEndpoint.call(void 0,
|
|
2517
2990
|
{
|
|
2518
2991
|
config: farmConfig,
|
|
2519
2992
|
middlewareRoutes: middlewareManager.getMiddlewares().filter((entry) => entry.source !== "config")
|
|
@@ -2527,11 +3000,11 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2527
3000
|
});
|
|
2528
3001
|
return;
|
|
2529
3002
|
}
|
|
2530
|
-
if (_optionalChain([options, 'access',
|
|
3003
|
+
if (_optionalChain([options, 'access', _211 => _211.agent, 'optionalAccess', _212 => _212.apiCatalog]) && _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath) === _chunkYTNBCXCWcjs.FARM_API_CATALOG_PATH) {
|
|
2531
3004
|
await serveBuiltInRoute(
|
|
2532
|
-
() =>
|
|
3005
|
+
() => _chunkYTNBCXCWcjs.createFarmApiCatalogResponse.call(void 0,
|
|
2533
3006
|
requestMethod,
|
|
2534
|
-
|
|
3007
|
+
_chunkYTNBCXCWcjs.resolveFarmApiCatalogInput.call(void 0, { ...options, api: farmConfig.api }),
|
|
2535
3008
|
new Request(parsedRequestUrl, {
|
|
2536
3009
|
headers: { "user-agent": String(_nullishCoalesce(req.headers["user-agent"], () => ( ""))) }
|
|
2537
3010
|
})
|
|
@@ -2539,8 +3012,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2539
3012
|
);
|
|
2540
3013
|
return;
|
|
2541
3014
|
}
|
|
2542
|
-
if (_optionalChain([options, 'access',
|
|
2543
|
-
const aiCatalog =
|
|
3015
|
+
if (_optionalChain([options, 'access', _213 => _213.agent, 'optionalAccess', _214 => _214.aiCatalog]) !== false) {
|
|
3016
|
+
const aiCatalog = _chunkYTNBCXCWcjs.createFarmAiCatalogResponse.call(void 0,
|
|
2544
3017
|
new Request(parsedRequestUrl, {
|
|
2545
3018
|
method: requestMethod,
|
|
2546
3019
|
headers: {
|
|
@@ -2549,7 +3022,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2549
3022
|
}
|
|
2550
3023
|
}),
|
|
2551
3024
|
{
|
|
2552
|
-
basePath:
|
|
3025
|
+
basePath: farmApp.getConfig().basePath,
|
|
2553
3026
|
apiServerBasePath,
|
|
2554
3027
|
defaultMCP: () => farmApp.getServerRenderer().getDefaultMCPServer()
|
|
2555
3028
|
}
|
|
@@ -2566,11 +3039,15 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2566
3039
|
}
|
|
2567
3040
|
}
|
|
2568
3041
|
const viteModuleRequest = isViteModuleRequest(parsedRequestUrl, req.headers);
|
|
2569
|
-
const
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
3042
|
+
const toRoutePathname = (pathname2) => farmApp.getRouteManager().toRoutePathname(pathname2);
|
|
3043
|
+
const appOwnsDocsEnginePath = farmAppOwnsDocsEnginePath(
|
|
3044
|
+
toRoutePathname(requestPathname),
|
|
3045
|
+
{
|
|
3046
|
+
generatedPaths: farmAgentGeneratedPaths(farmConfig),
|
|
3047
|
+
routeManager: farmApp.getRouteManager(),
|
|
3048
|
+
publicDir: server.config.publicDir
|
|
3049
|
+
}
|
|
3050
|
+
);
|
|
2574
3051
|
if (farmDocsHandler && !appOwnsDocsEnginePath && !viteModuleRequest) {
|
|
2575
3052
|
const docsRequest = new Request(fullUrl, {
|
|
2576
3053
|
method: requestMethod,
|
|
@@ -2584,11 +3061,11 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2584
3061
|
{
|
|
2585
3062
|
kind: "docs",
|
|
2586
3063
|
computed: docsResponse,
|
|
2587
|
-
label:
|
|
3064
|
+
label: _chunkYTNBCXCWcjs.resolveFarmDocsEngineRouteLabel.call(void 0,
|
|
2588
3065
|
_chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath),
|
|
2589
3066
|
{
|
|
2590
|
-
path: _optionalChain([farmConfig, 'access',
|
|
2591
|
-
roots: _optionalChain([farmConfig, 'access',
|
|
3067
|
+
path: _optionalChain([farmConfig, 'access', _215 => _215.docs, 'optionalAccess', _216 => _216.entry]) || "/docs",
|
|
3068
|
+
roots: _optionalChain([farmConfig, 'access', _217 => _217.docs, 'optionalAccess', _218 => _218.roots, 'optionalAccess', _219 => _219.map, 'call', _220 => _220((root) => root.entry)])
|
|
2592
3069
|
}
|
|
2593
3070
|
)
|
|
2594
3071
|
}
|
|
@@ -2596,8 +3073,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2596
3073
|
return;
|
|
2597
3074
|
}
|
|
2598
3075
|
}
|
|
2599
|
-
if (options.mobileClient && !viteModuleRequest && (requestMethod === "GET" || requestMethod === "HEAD" || requestMethod === "POST") && _optionalChain([req, 'access',
|
|
2600
|
-
const { createFarmNativeTreeResponse } = await import("./native-tree-
|
|
3076
|
+
if (options.mobileClient && !viteModuleRequest && (requestMethod === "GET" || requestMethod === "HEAD" || requestMethod === "POST") && _optionalChain([req, 'access', _221 => _221.headers, 'access', _222 => _222.accept, 'optionalAccess', _223 => _223.includes, 'call', _224 => _224(_chunk3HLQTOVUcjs.FARM_NATIVE_TREE_CONTENT_TYPE)])) {
|
|
3077
|
+
const { createFarmNativeTreeResponse } = await import("./native-tree-W2SSJB3Y.cjs");
|
|
2601
3078
|
const treeBodyInit = requestMethod === "POST" ? { body: _chunkCFG4QERRcjs.createFarmNodeRequestBodyStream.call(void 0, req), duplex: "half" } : {};
|
|
2602
3079
|
const treeResponse = await createFarmNativeTreeResponse({
|
|
2603
3080
|
request: new Request(fullUrl, {
|
|
@@ -2614,23 +3091,27 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2614
3091
|
});
|
|
2615
3092
|
await serveBuiltInRoute(() => treeResponse, {
|
|
2616
3093
|
computed: treeResponse,
|
|
2617
|
-
label: _nullishCoalesce(_optionalChain([farmApp, 'access',
|
|
3094
|
+
label: _nullishCoalesce(_optionalChain([farmApp, 'access', _225 => _225.getRouteManager, 'call', _226 => _226(), 'access', _227 => _227.matchRoute, 'call', _228 => _228(_chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath)), 'access', _229 => _229.route, 'optionalAccess', _230 => _230.pattern]), () => ( null))
|
|
2618
3095
|
});
|
|
2619
3096
|
return;
|
|
2620
3097
|
}
|
|
2621
|
-
const markdownRouteLabel = () =>
|
|
2622
|
-
|
|
2623
|
-
|
|
3098
|
+
const markdownRouteLabel = () => (
|
|
3099
|
+
// On the route path, as production labels it: /fr/index.md is /index.md.
|
|
3100
|
+
_chunkYTNBCXCWcjs.resolveFarmMarkdownRouteLabel.call(void 0,
|
|
3101
|
+
toRoutePathname(requestPathname),
|
|
3102
|
+
(page) => _optionalChain([farmApp, 'access', _231 => _231.getRouteManager, 'call', _232 => _232(), 'access', _233 => _233.matchRoute, 'call', _234 => _234(page), 'access', _235 => _235.route, 'optionalAccess', _236 => _236.pattern])
|
|
3103
|
+
)
|
|
2624
3104
|
);
|
|
2625
|
-
const markdownSourceResponse = viteModuleRequest ? null : await
|
|
3105
|
+
const markdownSourceResponse = viteModuleRequest ? null : await _chunk3EEINK7Gcjs.createFarmMarkdownSourceResponse.call(void 0, {
|
|
2626
3106
|
request: new Request(fullUrl, {
|
|
2627
3107
|
method: requestMethod,
|
|
2628
3108
|
headers: docsHeaders
|
|
2629
3109
|
}),
|
|
2630
3110
|
config: farmApp.getConfig().mdx,
|
|
3111
|
+
routePathname: toRoutePathname,
|
|
2631
3112
|
resolveSource: async (pathname2) => {
|
|
2632
3113
|
const match = farmApp.getRouteManager().matchRoute(pathname2);
|
|
2633
|
-
const sourcePath = _optionalChain([match, 'access',
|
|
3114
|
+
const sourcePath = _optionalChain([match, 'access', _237 => _237.route, 'optionalAccess', _238 => _238.markdownSourcePath]) || (match.route && _chunk3EEINK7Gcjs.isFarmMarkdownPageFile.call(void 0, match.route.modulePath) ? match.route.modulePath : null);
|
|
2634
3115
|
if (!sourcePath) {
|
|
2635
3116
|
return null;
|
|
2636
3117
|
}
|
|
@@ -2655,12 +3136,13 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2655
3136
|
});
|
|
2656
3137
|
return;
|
|
2657
3138
|
}
|
|
2658
|
-
const markdownResponse = viteModuleRequest ? null : await
|
|
3139
|
+
const markdownResponse = viteModuleRequest ? null : await _chunkFT6KJHS3cjs.createMarkdownMirrorResponse.call(void 0, {
|
|
2659
3140
|
request: new Request(fullUrl, {
|
|
2660
3141
|
method: requestMethod,
|
|
2661
3142
|
headers: docsHeaders
|
|
2662
3143
|
}),
|
|
2663
3144
|
config: farmApp.getConfig().md,
|
|
3145
|
+
routePathname: toRoutePathname,
|
|
2664
3146
|
routeExists: (pathname2) => Boolean(farmApp.getRouteManager().matchRoute(pathname2).route),
|
|
2665
3147
|
// The page is rendered by this server's own listener, never the host the
|
|
2666
3148
|
// caller's Host names. Redirects are not followed, so the mirror answers with
|
|
@@ -2686,16 +3168,16 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2686
3168
|
});
|
|
2687
3169
|
return;
|
|
2688
3170
|
}
|
|
2689
|
-
if (!viteModuleRequest &&
|
|
2690
|
-
const markdownRoute = farmApp.getRouteManager().matchRoute(
|
|
3171
|
+
if (!viteModuleRequest && _chunkFT6KJHS3cjs.farmRequestWantsMarkdown.call(void 0, requestPathname, req.headers.accept)) {
|
|
3172
|
+
const markdownRoute = farmApp.getRouteManager().matchRoute(_chunk3EEINK7Gcjs.normalizeFarmMarkdownRoutePath.call(void 0, requestPathname, toRoutePathname));
|
|
2691
3173
|
if (!markdownRoute.route) {
|
|
2692
3174
|
await serveBuiltInRoute(
|
|
2693
3175
|
() => new Response(
|
|
2694
|
-
|
|
3176
|
+
_chunkFT6KJHS3cjs.createFarmMarkdownErrorBody.call(void 0, 404, requestPathname, farmConfig.basePath || "/"),
|
|
2695
3177
|
{
|
|
2696
3178
|
status: 404,
|
|
2697
3179
|
headers: {
|
|
2698
|
-
"Content-Type":
|
|
3180
|
+
"Content-Type": _chunkFT6KJHS3cjs.FARM_MARKDOWN_CONTENT_TYPE,
|
|
2699
3181
|
"X-Farm-Markdown-Error": "404",
|
|
2700
3182
|
"Cache-Control": "no-store"
|
|
2701
3183
|
}
|
|
@@ -2705,11 +3187,12 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2705
3187
|
return;
|
|
2706
3188
|
}
|
|
2707
3189
|
}
|
|
2708
|
-
const markdownPageTarget =
|
|
3190
|
+
const markdownPageTarget = _chunkFT6KJHS3cjs.resolveMarkdownMirrorTarget.call(void 0,
|
|
2709
3191
|
farmApp.getConfig().md,
|
|
2710
3192
|
requestPathname,
|
|
2711
3193
|
{
|
|
2712
|
-
accept: "text/markdown"
|
|
3194
|
+
accept: "text/markdown",
|
|
3195
|
+
routePathname: toRoutePathname
|
|
2713
3196
|
}
|
|
2714
3197
|
);
|
|
2715
3198
|
if (markdownPageTarget && farmApp.getRouteManager().matchRoute(markdownPageTarget.pathname).route) {
|
|
@@ -2718,8 +3201,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2718
3201
|
if (!varyValues.some((value) => value.toLowerCase() === "accept")) {
|
|
2719
3202
|
res.setHeader("Vary", [...varyValues, "Accept"].join(", "));
|
|
2720
3203
|
}
|
|
2721
|
-
const
|
|
2722
|
-
const alternateLink = `<${alternatePath}>; rel="alternate"; type="text/markdown"`;
|
|
3204
|
+
const alternateLink = `<${markdownPageTarget.markdownPath}>; rel="alternate"; type="text/markdown"`;
|
|
2723
3205
|
const currentLink = res.getHeader("Link");
|
|
2724
3206
|
res.setHeader(
|
|
2725
3207
|
"Link",
|
|
@@ -2756,7 +3238,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2756
3238
|
}
|
|
2757
3239
|
const configuredIntegrations = currentConfig.integrations;
|
|
2758
3240
|
const tryConfiguredIntegrationRoute = async () => {
|
|
2759
|
-
const matchedRoute =
|
|
3241
|
+
const matchedRoute = _chunkBDYM2TN3cjs.matchIntegrationRoute.call(void 0, configuredIntegrations, {
|
|
2760
3242
|
pathname: requestPathname,
|
|
2761
3243
|
method: requestMethod
|
|
2762
3244
|
});
|
|
@@ -2764,13 +3246,14 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2764
3246
|
return false;
|
|
2765
3247
|
}
|
|
2766
3248
|
const startTime2 = Date.now();
|
|
3249
|
+
let runtimeReportsErrors = false;
|
|
2767
3250
|
try {
|
|
2768
3251
|
if (pm) {
|
|
2769
3252
|
await pm.runHookParallelFiltered(
|
|
2770
3253
|
"beforeRequest",
|
|
2771
|
-
(
|
|
2772
|
-
const owner =
|
|
2773
|
-
return
|
|
3254
|
+
(plugin2) => {
|
|
3255
|
+
const owner = _chunkBDYM2TN3cjs.getFarmIntegrationPluginOwner.call(void 0, plugin2);
|
|
3256
|
+
return !isFarmConfigRoutePlugin(plugin2) && (_optionalChain([owner, 'optionalAccess', _239 => _239.source]) !== "lifecycle" || owner.key !== matchedRoute.key);
|
|
2774
3257
|
},
|
|
2775
3258
|
req,
|
|
2776
3259
|
res
|
|
@@ -2797,22 +3280,29 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2797
3280
|
body: toRequestBody(body),
|
|
2798
3281
|
signal: _chunkCFG4QERRcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
|
|
2799
3282
|
});
|
|
2800
|
-
const dispatchIntegration = async (request) => {
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
3283
|
+
const dispatchIntegration = async (request, runtime) => {
|
|
3284
|
+
try {
|
|
3285
|
+
const result = await _chunkBDYM2TN3cjs.dispatchIntegrationRequest.call(void 0,
|
|
3286
|
+
{
|
|
3287
|
+
integration: matchedRoute.integration,
|
|
3288
|
+
config: currentConfig,
|
|
3289
|
+
isDev: true,
|
|
3290
|
+
isProd: false
|
|
3291
|
+
},
|
|
3292
|
+
request,
|
|
3293
|
+
{ clientAddress: _optionalChain([req, 'access', _240 => _240.socket, 'optionalAccess', _241 => _241.remoteAddress]) }
|
|
3294
|
+
);
|
|
3295
|
+
if (!result) {
|
|
3296
|
+
throw new Error(`Matched integration route did not return a response`);
|
|
3297
|
+
}
|
|
3298
|
+
return result;
|
|
3299
|
+
} catch (error) {
|
|
3300
|
+
_chunkQMNWKQL4cjs.logger.error(`Integration route error: ${error}`);
|
|
3301
|
+
await _optionalChain([runtime, 'optionalAccess', _242 => _242.reportError, 'call', _243 => _243(error)]);
|
|
3302
|
+
return _chunkXGTFLG73cjs.createFarmInternalServerErrorResponse.call(void 0, );
|
|
2813
3303
|
}
|
|
2814
|
-
return result;
|
|
2815
3304
|
};
|
|
3305
|
+
runtimeReportsErrors = Boolean(pm);
|
|
2816
3306
|
const response = pm ? await pm.runRuntimeRequest(integrationRequest, dispatchIntegration, {
|
|
2817
3307
|
kind: "integration",
|
|
2818
3308
|
route: {
|
|
@@ -2835,21 +3325,59 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2835
3325
|
}
|
|
2836
3326
|
const duration = Date.now() - startTime2;
|
|
2837
3327
|
logResponse(requestMethod, requestUrl, 500, duration, "API");
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
3328
|
+
if (!runtimeReportsErrors) {
|
|
3329
|
+
await emitPluginError("integration-handler", error, {
|
|
3330
|
+
pathname: requestPathname,
|
|
3331
|
+
routePath: requestUrl,
|
|
3332
|
+
method: requestMethod,
|
|
3333
|
+
integration: matchedRoute.key
|
|
3334
|
+
});
|
|
3335
|
+
}
|
|
2844
3336
|
_chunkQMNWKQL4cjs.logger.error(`Integration route error: ${error}`);
|
|
2845
3337
|
if (!res.writableEnded) {
|
|
2846
3338
|
res.statusCode = 500;
|
|
2847
3339
|
res.setHeader("Content-Type", "application/json");
|
|
2848
|
-
res.end(
|
|
3340
|
+
res.end(_chunkXGTFLG73cjs.FARM_INTERNAL_SERVER_ERROR_BODY);
|
|
2849
3341
|
}
|
|
2850
3342
|
return true;
|
|
2851
3343
|
}
|
|
2852
3344
|
};
|
|
3345
|
+
if (pm && configRewriteSource === void 0 && configRoutePlugins.has(_chunkAKIQ54FKcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME)) {
|
|
3346
|
+
const hasLocalDevRoute = () => {
|
|
3347
|
+
const routeManager3 = farmApp.getRouteManager();
|
|
3348
|
+
return Boolean(
|
|
3349
|
+
_chunkBDYM2TN3cjs.matchIntegrationRoute.call(void 0, configuredIntegrations, {
|
|
3350
|
+
pathname: requestPathname,
|
|
3351
|
+
method: requestMethod
|
|
3352
|
+
}) || routeManager3.matchRedirect(requestPathname) || apiRouteManager.matchRoute(requestPathname) || farmDocsAPIHandler && _optionalChain([farmDocsDevRuntime, 'optionalAccess', _244 => _244.isFarmDocsAPIRequest, 'call', _245 => _245(requestPathname)]) || routeManager3.matchRoute(requestPathname).route || routeManager3.matchMetadataRoute(requestPathname) || routeManager3.matchMetadataImage(requestPathname)
|
|
3353
|
+
);
|
|
3354
|
+
};
|
|
3355
|
+
try {
|
|
3356
|
+
await pm.runHookParallelFiltered(
|
|
3357
|
+
"beforeRequest",
|
|
3358
|
+
(plugin2) => plugin2.name === _chunkAKIQ54FKcjs.FARM_CONFIG_REWRITES_PLUGIN_NAME,
|
|
3359
|
+
req,
|
|
3360
|
+
res
|
|
3361
|
+
);
|
|
3362
|
+
} catch (error) {
|
|
3363
|
+
await emitPluginError("before-request", error, { urlPath: requestUrl });
|
|
3364
|
+
res.statusCode = 500;
|
|
3365
|
+
res.setHeader("Content-Type", "text/plain; charset=utf-8");
|
|
3366
|
+
res.end("Internal Server Error");
|
|
3367
|
+
return;
|
|
3368
|
+
}
|
|
3369
|
+
if (req.url !== requestUrl) {
|
|
3370
|
+
if (isViteOwnedRequest() || hasLocalDevRoute()) {
|
|
3371
|
+
req.url = requestUrl;
|
|
3372
|
+
} else {
|
|
3373
|
+
if (await proxyFarmExternalRewrite(req, res, currentServerConfig.bodySizeLimit)) {
|
|
3374
|
+
return;
|
|
3375
|
+
}
|
|
3376
|
+
req[FARM_DEV_CONFIG_REWRITE_SOURCE] = fullUrl;
|
|
3377
|
+
return handleFarmDevRequest(req, res, next);
|
|
3378
|
+
}
|
|
3379
|
+
}
|
|
3380
|
+
}
|
|
2853
3381
|
if (await tryConfiguredIntegrationRoute()) {
|
|
2854
3382
|
return;
|
|
2855
3383
|
}
|
|
@@ -2862,32 +3390,25 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2862
3390
|
}
|
|
2863
3391
|
const matchedApiRoute = apiRouteManager.matchRoute(requestPathname);
|
|
2864
3392
|
const hasMatchedApiRoute = Boolean(matchedApiRoute);
|
|
2865
|
-
if (hasMatchedApiRoute ||
|
|
3393
|
+
if (hasMatchedApiRoute || _chunkXGTFLG73cjs.isFarmAPIPathname.call(void 0, requestPathname, apiServerBasePath)) {
|
|
2866
3394
|
const startTime2 = Date.now();
|
|
2867
3395
|
const method2 = req.method || "GET";
|
|
2868
3396
|
const urlPath2 = req.url || "/";
|
|
2869
|
-
const pathname2 =
|
|
3397
|
+
const pathname2 = _chunkHDPT6OYEcjs.resolveFarmRequestURL.call(void 0, req, {
|
|
2870
3398
|
trustProxy: currentServerConfig.trustProxy
|
|
2871
3399
|
}).pathname;
|
|
2872
|
-
const servesLocalApiRoute = hasMatchedApiRoute || Boolean(
|
|
2873
|
-
farmDocsAPIHandler && _optionalChain([farmDocsDevRuntime, 'optionalAccess', _212 => _212.isFarmDocsAPIRequest, 'call', _213 => _213(requestPathname)])
|
|
2874
|
-
);
|
|
2875
3400
|
try {
|
|
2876
3401
|
if (pm) {
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
);
|
|
2884
|
-
} else {
|
|
2885
|
-
await pm.runHookParallel("beforeRequest", req, res);
|
|
2886
|
-
}
|
|
3402
|
+
await pm.runHookParallelFiltered(
|
|
3403
|
+
"beforeRequest",
|
|
3404
|
+
(plugin2) => !isFarmConfigRoutePlugin(plugin2),
|
|
3405
|
+
req,
|
|
3406
|
+
res
|
|
3407
|
+
);
|
|
2887
3408
|
}
|
|
2888
|
-
if (res.writableEnded
|
|
2889
|
-
const
|
|
2890
|
-
logResponse(method2, urlPath2, res.statusCode || 200,
|
|
3409
|
+
if (res.writableEnded) {
|
|
3410
|
+
const duration = Date.now() - startTime2;
|
|
3411
|
+
logResponse(method2, urlPath2, res.statusCode || 200, duration, "API");
|
|
2891
3412
|
return;
|
|
2892
3413
|
}
|
|
2893
3414
|
} catch (error) {
|
|
@@ -2898,23 +3419,138 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2898
3419
|
_chunkQMNWKQL4cjs.logger.error(`Request hook error: ${error}`);
|
|
2899
3420
|
res.statusCode = 500;
|
|
2900
3421
|
res.setHeader("Content-Type", "application/json");
|
|
2901
|
-
res.end(
|
|
3422
|
+
res.end(_chunkXGTFLG73cjs.FARM_INTERNAL_SERVER_ERROR_BODY);
|
|
2902
3423
|
return;
|
|
2903
3424
|
}
|
|
2904
|
-
|
|
2905
|
-
const
|
|
2906
|
-
|
|
3425
|
+
const createAPIRequest = async () => {
|
|
3426
|
+
const headers = new Headers();
|
|
3427
|
+
for (const [key, value] of Object.entries(req.headers)) {
|
|
3428
|
+
if (value) {
|
|
3429
|
+
headers.set(key, Array.isArray(value) ? value.join(", ") : value);
|
|
3430
|
+
}
|
|
3431
|
+
}
|
|
3432
|
+
let body;
|
|
3433
|
+
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
3434
|
+
body = await _chunkCFG4QERRcjs.readNodeRequestBody.call(void 0, req, currentServerConfig.bodySizeLimit);
|
|
3435
|
+
}
|
|
3436
|
+
return new Request(`http://${req.headers.host || "localhost:3000"}${req.url}`, {
|
|
3437
|
+
method: req.method,
|
|
3438
|
+
headers,
|
|
3439
|
+
body: toRequestBody(body),
|
|
3440
|
+
signal: _chunkCFG4QERRcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
|
|
3441
|
+
});
|
|
3442
|
+
};
|
|
3443
|
+
const isDocsAPIRequest = Boolean(
|
|
3444
|
+
farmDocsAPIHandler && _optionalChain([farmDocsDevRuntime, 'optionalAccess', _246 => _246.isFarmDocsAPIRequest, 'call', _247 => _247(pathname2)])
|
|
3445
|
+
);
|
|
3446
|
+
const docsRuntimeOptions = () => ({
|
|
3447
|
+
kind: "docs",
|
|
3448
|
+
route: _chunkYTNBCXCWcjs.setFarmRouteLabel.call(void 0,
|
|
3449
|
+
{ pathname: pathname2, pattern: urlPath2 },
|
|
3450
|
+
_chunkYTNBCXCWcjs.resolveFarmDocsRouteLabel.call(void 0, pathname2, {
|
|
3451
|
+
path: _optionalChain([farmConfig, 'access', _248 => _248.docs, 'optionalAccess', _249 => _249.entry]) || "/docs",
|
|
3452
|
+
roots: _optionalChain([farmConfig, 'access', _250 => _250.docs, 'optionalAccess', _251 => _251.roots, 'optionalAccess', _252 => _252.map, 'call', _253 => _253((root) => root.entry)])
|
|
3453
|
+
})
|
|
3454
|
+
)
|
|
3455
|
+
});
|
|
3456
|
+
let runtimeSession2;
|
|
3457
|
+
let sessionRequestUrl;
|
|
3458
|
+
if (_optionalChain([pm, 'optionalAccess', _254 => _254.hasRuntimeRequestHooks, 'call', _255 => _255()])) {
|
|
3459
|
+
try {
|
|
3460
|
+
runtimeSession2 = await pm.beginRuntimeRequest(
|
|
3461
|
+
await createAPIRequest(),
|
|
3462
|
+
!hasMatchedApiRoute && isDocsAPIRequest ? docsRuntimeOptions() : {
|
|
3463
|
+
kind: "api",
|
|
3464
|
+
route: matchedApiRoute ? { pathname: pathname2, pattern: matchedApiRoute.route.path } : { pathname: pathname2 }
|
|
3465
|
+
}
|
|
3466
|
+
);
|
|
3467
|
+
if (runtimeSession2.response) {
|
|
3468
|
+
const response = await pm.endRuntimeRequest(
|
|
3469
|
+
runtimeSession2,
|
|
3470
|
+
runtimeSession2.response
|
|
3471
|
+
);
|
|
3472
|
+
logResponse(method2, urlPath2, response.status, Date.now() - startTime2, "API");
|
|
3473
|
+
await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, response);
|
|
3474
|
+
return;
|
|
3475
|
+
}
|
|
3476
|
+
} catch (error) {
|
|
3477
|
+
const bodyErrorResponse = _chunkCFG4QERRcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
|
|
3478
|
+
if (bodyErrorResponse) {
|
|
3479
|
+
logResponse(
|
|
3480
|
+
method2,
|
|
3481
|
+
urlPath2,
|
|
3482
|
+
bodyErrorResponse.status,
|
|
3483
|
+
Date.now() - startTime2,
|
|
3484
|
+
"API"
|
|
3485
|
+
);
|
|
3486
|
+
await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
|
|
3487
|
+
return;
|
|
3488
|
+
}
|
|
3489
|
+
_chunkQMNWKQL4cjs.logger.error(`API route error: ${error}`);
|
|
3490
|
+
res.statusCode = 500;
|
|
3491
|
+
res.setHeader("Content-Type", "application/json");
|
|
3492
|
+
res.end(_chunkXGTFLG73cjs.FARM_INTERNAL_SERVER_ERROR_BODY);
|
|
3493
|
+
return;
|
|
3494
|
+
}
|
|
3495
|
+
pm.copyRequestContext(runtimeSession2.request, req);
|
|
3496
|
+
applyWebRequestToNodeRequest(runtimeSession2.request, req);
|
|
3497
|
+
sessionRequestUrl = req.url;
|
|
3498
|
+
}
|
|
3499
|
+
try {
|
|
3500
|
+
if (await runAppMiddlewareInRuntimeSession(
|
|
3501
|
+
runtimeSession2,
|
|
3502
|
+
(status) => logResponse(method2, urlPath2, status, Date.now() - startTime2, "API")
|
|
3503
|
+
)) {
|
|
3504
|
+
return;
|
|
3505
|
+
}
|
|
3506
|
+
} catch (error) {
|
|
3507
|
+
if (res.headersSent) {
|
|
3508
|
+
if (runtimeSession2) await pm.failRuntimeRequest(runtimeSession2, error);
|
|
3509
|
+
throw error;
|
|
3510
|
+
}
|
|
3511
|
+
_chunkQMNWKQL4cjs.logger.error(`Middleware error: ${error}`);
|
|
3512
|
+
let response = createFarmDevMiddlewareErrorResponse();
|
|
3513
|
+
if (runtimeSession2) {
|
|
3514
|
+
const errorResponse = response;
|
|
3515
|
+
try {
|
|
3516
|
+
response = await pm.completeRuntimeRequest(
|
|
3517
|
+
runtimeSession2,
|
|
3518
|
+
async (_request, runtime) => {
|
|
3519
|
+
await runtime.reportError(error);
|
|
3520
|
+
return errorResponse;
|
|
3521
|
+
}
|
|
3522
|
+
);
|
|
3523
|
+
} catch (e26) {
|
|
3524
|
+
logResponse(method2, urlPath2, 500, Date.now() - startTime2, "API");
|
|
3525
|
+
sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
|
|
3526
|
+
return;
|
|
3527
|
+
}
|
|
3528
|
+
}
|
|
3529
|
+
logResponse(method2, urlPath2, response.status, Date.now() - startTime2, "API");
|
|
3530
|
+
await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, response);
|
|
2907
3531
|
return;
|
|
2908
3532
|
}
|
|
3533
|
+
const createHandlerRequest = async () => {
|
|
3534
|
+
if (runtimeSession2 && req.url === sessionRequestUrl && !runtimeSession2.request.bodyUsed) {
|
|
3535
|
+
return runtimeSession2.request;
|
|
3536
|
+
}
|
|
3537
|
+
const request = await createAPIRequest();
|
|
3538
|
+
if (runtimeSession2) pm.copyRequestContext(runtimeSession2.request, request);
|
|
3539
|
+
return request;
|
|
3540
|
+
};
|
|
3541
|
+
const runInRuntime = (request, handler, options2) => runtimeSession2 ? pm.completeRuntimeRequest(
|
|
3542
|
+
runtimeSession2,
|
|
3543
|
+
(_request, runtime) => handler(request, runtime)
|
|
3544
|
+
) : pm ? pm.runRuntimeRequest(request, handler, options2) : handler(request);
|
|
2909
3545
|
const apiHandler = apiRouteManager.getHandler({ throwOnError: true });
|
|
2910
|
-
const routedPathname =
|
|
3546
|
+
const routedPathname = _chunkHDPT6OYEcjs.resolveFarmRequestURL.call(void 0, req, {
|
|
2911
3547
|
trustProxy: currentServerConfig.trustProxy
|
|
2912
3548
|
}).pathname;
|
|
2913
3549
|
const rewritten = routedPathname !== pathname2;
|
|
2914
3550
|
const routedApiRoute = rewritten ? apiRouteManager.matchRoute(routedPathname) : matchedApiRoute || apiRouteManager.matchRoute(pathname2);
|
|
2915
3551
|
const hasExplicitAPIRoute = Boolean(routedApiRoute);
|
|
2916
3552
|
if (apiHandler && hasExplicitAPIRoute) {
|
|
2917
|
-
const apiRoutePattern = _optionalChain([routedApiRoute, 'optionalAccess',
|
|
3553
|
+
const apiRoutePattern = _optionalChain([routedApiRoute, 'optionalAccess', _256 => _256.route, 'access', _257 => _257.path]) || urlPath2;
|
|
2918
3554
|
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
|
|
2919
3555
|
type: "route.matched",
|
|
2920
3556
|
pathname: pathname2,
|
|
@@ -2928,101 +3564,85 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
2928
3564
|
});
|
|
2929
3565
|
try {
|
|
2930
3566
|
const url = `http://${req.headers.host || "localhost:3000"}${req.url}`;
|
|
2931
|
-
const
|
|
2932
|
-
for (const [key, value] of Object.entries(req.headers)) {
|
|
2933
|
-
if (value) {
|
|
2934
|
-
headers.set(key, Array.isArray(value) ? value.join(", ") : value);
|
|
2935
|
-
}
|
|
2936
|
-
}
|
|
2937
|
-
let body;
|
|
2938
|
-
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
2939
|
-
body = await _chunkCFG4QERRcjs.readNodeRequestBody.call(void 0, req, currentServerConfig.bodySizeLimit);
|
|
2940
|
-
}
|
|
2941
|
-
const request = new Request(url, {
|
|
2942
|
-
method: req.method,
|
|
2943
|
-
headers,
|
|
2944
|
-
body: toRequestBody(body),
|
|
2945
|
-
signal: _chunkCFG4QERRcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
|
|
2946
|
-
});
|
|
3567
|
+
const request = await createHandlerRequest();
|
|
2947
3568
|
const apiLifecyclePayload = {
|
|
2948
3569
|
pathname: new URL(url).pathname,
|
|
2949
3570
|
method: method2,
|
|
2950
3571
|
routePath: apiRoutePattern
|
|
2951
3572
|
};
|
|
2952
|
-
|
|
3573
|
+
let apiHandlerFailed = false;
|
|
3574
|
+
const invokeAPIHandler = async (runtimeRequest, runtime) => {
|
|
2953
3575
|
const handledRequest = pm ? await pm.runHookSerial(
|
|
2954
3576
|
"beforeApiHandler",
|
|
2955
3577
|
runtimeRequest,
|
|
2956
3578
|
apiLifecyclePayload
|
|
2957
3579
|
) : runtimeRequest;
|
|
2958
|
-
|
|
3580
|
+
let response;
|
|
3581
|
+
try {
|
|
3582
|
+
response = await apiHandler(handledRequest);
|
|
3583
|
+
} catch (error) {
|
|
3584
|
+
apiHandlerFailed = true;
|
|
3585
|
+
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
|
|
3586
|
+
type: "api.error",
|
|
3587
|
+
pathname: pathname2,
|
|
3588
|
+
route: apiRoutePattern,
|
|
3589
|
+
method: method2,
|
|
3590
|
+
durationMs: Date.now() - startTime2,
|
|
3591
|
+
error
|
|
3592
|
+
});
|
|
3593
|
+
_chunkQMNWKQL4cjs.logger.error(`API route error: ${error}`);
|
|
3594
|
+
await _optionalChain([runtime, 'optionalAccess', _258 => _258.reportError, 'call', _259 => _259(error)]);
|
|
3595
|
+
response = _chunkXGTFLG73cjs.createFarmInternalServerErrorResponse.call(void 0, );
|
|
3596
|
+
}
|
|
2959
3597
|
return pm ? await pm.runHookSerial("afterApiHandler", response, apiLifecyclePayload) : response;
|
|
2960
3598
|
};
|
|
2961
|
-
const handledResponse =
|
|
3599
|
+
const handledResponse = await runInRuntime(request, invokeAPIHandler, {
|
|
2962
3600
|
kind: "api",
|
|
2963
3601
|
route: {
|
|
2964
3602
|
pathname: apiLifecyclePayload.pathname,
|
|
2965
3603
|
pattern: apiLifecyclePayload.routePath
|
|
2966
3604
|
}
|
|
2967
|
-
}) : await invokeAPIHandler(request);
|
|
2968
|
-
const duration2 = Date.now() - startTime2;
|
|
2969
|
-
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
|
|
2970
|
-
type: "api.request.complete",
|
|
2971
|
-
pathname: pathname2,
|
|
2972
|
-
route: apiRoutePattern,
|
|
2973
|
-
method: method2,
|
|
2974
|
-
status: handledResponse.status,
|
|
2975
|
-
durationMs: duration2
|
|
2976
3605
|
});
|
|
2977
|
-
|
|
3606
|
+
const duration = Date.now() - startTime2;
|
|
3607
|
+
if (!apiHandlerFailed) {
|
|
3608
|
+
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
|
|
3609
|
+
type: "api.request.complete",
|
|
3610
|
+
pathname: pathname2,
|
|
3611
|
+
route: apiRoutePattern,
|
|
3612
|
+
method: method2,
|
|
3613
|
+
status: handledResponse.status,
|
|
3614
|
+
durationMs: duration
|
|
3615
|
+
});
|
|
3616
|
+
}
|
|
3617
|
+
logResponse(method2, urlPath2, handledResponse.status, duration, "API");
|
|
2978
3618
|
await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, handledResponse);
|
|
2979
3619
|
return;
|
|
2980
3620
|
} catch (error) {
|
|
2981
|
-
const
|
|
3621
|
+
const duration = Date.now() - startTime2;
|
|
2982
3622
|
_chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
|
|
2983
3623
|
type: "api.error",
|
|
2984
3624
|
pathname: pathname2,
|
|
2985
3625
|
route: apiRoutePattern,
|
|
2986
3626
|
method: method2,
|
|
2987
|
-
durationMs:
|
|
3627
|
+
durationMs: duration,
|
|
2988
3628
|
error
|
|
2989
3629
|
});
|
|
2990
3630
|
const bodyErrorResponse = _chunkCFG4QERRcjs.createFarmRequestBodyErrorResponse.call(void 0, error);
|
|
2991
3631
|
if (bodyErrorResponse) {
|
|
2992
|
-
logResponse(method2, urlPath2, bodyErrorResponse.status,
|
|
3632
|
+
logResponse(method2, urlPath2, bodyErrorResponse.status, duration, "API");
|
|
2993
3633
|
await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
|
|
2994
3634
|
return;
|
|
2995
3635
|
}
|
|
2996
|
-
await emitPluginError("api-handler", error, {
|
|
2997
|
-
urlPath: urlPath2,
|
|
2998
|
-
method: method2
|
|
2999
|
-
});
|
|
3000
3636
|
_chunkQMNWKQL4cjs.logger.error(`API route error: ${error}`);
|
|
3001
3637
|
res.statusCode = 500;
|
|
3002
3638
|
res.setHeader("Content-Type", "application/json");
|
|
3003
|
-
res.end(
|
|
3639
|
+
res.end(_chunkXGTFLG73cjs.FARM_INTERNAL_SERVER_ERROR_BODY);
|
|
3004
3640
|
return;
|
|
3005
3641
|
}
|
|
3006
3642
|
}
|
|
3007
|
-
if (farmDocsAPIHandler &&
|
|
3643
|
+
if (farmDocsAPIHandler && isDocsAPIRequest) {
|
|
3008
3644
|
try {
|
|
3009
|
-
const
|
|
3010
|
-
const headers = new Headers();
|
|
3011
|
-
for (const [key, value] of Object.entries(req.headers)) {
|
|
3012
|
-
if (value) {
|
|
3013
|
-
headers.set(key, Array.isArray(value) ? value.join(", ") : value);
|
|
3014
|
-
}
|
|
3015
|
-
}
|
|
3016
|
-
let body;
|
|
3017
|
-
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
3018
|
-
body = await _chunkCFG4QERRcjs.readNodeRequestBody.call(void 0, req, currentServerConfig.bodySizeLimit);
|
|
3019
|
-
}
|
|
3020
|
-
const request = new Request(url, {
|
|
3021
|
-
method: req.method,
|
|
3022
|
-
headers,
|
|
3023
|
-
body: toRequestBody(body),
|
|
3024
|
-
signal: _chunkCFG4QERRcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
|
|
3025
|
-
});
|
|
3645
|
+
const request = await createHandlerRequest();
|
|
3026
3646
|
const apiLifecyclePayload = {
|
|
3027
3647
|
pathname: pathname2,
|
|
3028
3648
|
method: method2,
|
|
@@ -3040,19 +3660,14 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
3040
3660
|
}
|
|
3041
3661
|
return pm ? await pm.runHookSerial("afterApiHandler", response, apiLifecyclePayload) : response;
|
|
3042
3662
|
};
|
|
3043
|
-
const docsResponse =
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
path: _optionalChain([farmConfig, 'access', _218 => _218.docs, 'optionalAccess', _219 => _219.entry]) || "/docs",
|
|
3049
|
-
roots: _optionalChain([farmConfig, 'access', _220 => _220.docs, 'optionalAccess', _221 => _221.roots, 'optionalAccess', _222 => _222.map, 'call', _223 => _223((root) => root.entry)])
|
|
3050
|
-
})
|
|
3051
|
-
)
|
|
3052
|
-
}) : await invokeDocsAPIHandler(request);
|
|
3663
|
+
const docsResponse = await runInRuntime(
|
|
3664
|
+
request,
|
|
3665
|
+
invokeDocsAPIHandler,
|
|
3666
|
+
docsRuntimeOptions()
|
|
3667
|
+
);
|
|
3053
3668
|
if (docsResponse) {
|
|
3054
|
-
const
|
|
3055
|
-
logResponse(method2, urlPath2, docsResponse.status,
|
|
3669
|
+
const duration = Date.now() - startTime2;
|
|
3670
|
+
logResponse(method2, urlPath2, docsResponse.status, duration, "API");
|
|
3056
3671
|
await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, docsResponse);
|
|
3057
3672
|
return;
|
|
3058
3673
|
}
|
|
@@ -3062,52 +3677,70 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
3062
3677
|
await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, bodyErrorResponse);
|
|
3063
3678
|
return;
|
|
3064
3679
|
}
|
|
3065
|
-
await emitPluginError("docs-api-handler", error, {
|
|
3066
|
-
urlPath: urlPath2,
|
|
3067
|
-
method: method2
|
|
3068
|
-
});
|
|
3069
3680
|
_chunkQMNWKQL4cjs.logger.error(`Docs API route error: ${error}`);
|
|
3070
3681
|
res.statusCode = 500;
|
|
3071
3682
|
res.setHeader("Content-Type", "application/json");
|
|
3072
|
-
res.end(
|
|
3683
|
+
res.end(_chunkXGTFLG73cjs.FARM_INTERNAL_SERVER_ERROR_BODY);
|
|
3073
3684
|
return;
|
|
3074
3685
|
}
|
|
3075
3686
|
}
|
|
3076
|
-
const
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3687
|
+
const notFoundBody = JSON.stringify({ error: "API route not found", pathname: pathname2 });
|
|
3688
|
+
if (!runtimeSession2) {
|
|
3689
|
+
logResponse(method2, urlPath2, 404, Date.now() - startTime2, "API");
|
|
3690
|
+
res.statusCode = 404;
|
|
3691
|
+
res.setHeader("Content-Type", "application/json");
|
|
3692
|
+
res.end(notFoundBody);
|
|
3693
|
+
return;
|
|
3694
|
+
}
|
|
3695
|
+
try {
|
|
3696
|
+
const response = await pm.completeRuntimeRequest(
|
|
3697
|
+
runtimeSession2,
|
|
3698
|
+
() => new Response(notFoundBody, {
|
|
3699
|
+
status: 404,
|
|
3700
|
+
headers: { "Content-Type": "application/json" }
|
|
3701
|
+
})
|
|
3702
|
+
);
|
|
3703
|
+
logResponse(method2, urlPath2, response.status, Date.now() - startTime2, "API");
|
|
3704
|
+
await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, response);
|
|
3705
|
+
} catch (error) {
|
|
3706
|
+
_chunkQMNWKQL4cjs.logger.error(`API route error: ${error}`);
|
|
3707
|
+
res.statusCode = 500;
|
|
3708
|
+
res.setHeader("Content-Type", "application/json");
|
|
3709
|
+
res.end(_chunkXGTFLG73cjs.FARM_INTERNAL_SERVER_ERROR_BODY);
|
|
3710
|
+
}
|
|
3081
3711
|
return;
|
|
3082
3712
|
}
|
|
3083
|
-
if (_optionalChain([req, 'access',
|
|
3713
|
+
if (_optionalChain([req, 'access', _260 => _260.url, 'optionalAccess', _261 => _261.startsWith, 'call', _262 => _262("/@")]) || _optionalChain([req, 'access', _263 => _263.url, 'optionalAccess', _264 => _264.startsWith, 'call', _265 => _265("/node_modules")])) {
|
|
3084
3714
|
return next();
|
|
3085
3715
|
}
|
|
3086
|
-
if (shouldBypassFarmRouterForDottedPath(
|
|
3716
|
+
if (!deferredDottedRequests.has(req) && shouldBypassFarmRouterForDottedPath(
|
|
3087
3717
|
requestPathname,
|
|
3088
|
-
_optionalChain([farmApp, 'optionalAccess',
|
|
3718
|
+
_optionalChain([farmApp, 'optionalAccess', _266 => _266.getRouteManager, 'call', _267 => _267()]),
|
|
3089
3719
|
[server.config.publicDir, server.config.root],
|
|
3090
|
-
farmAgentGeneratedPaths(farmConfig)
|
|
3720
|
+
farmAgentGeneratedPaths(farmConfig),
|
|
3721
|
+
requestMethod
|
|
3091
3722
|
)) {
|
|
3723
|
+
if (!viteModuleRequest) deferredDottedRequests.set(req, requestUrl);
|
|
3092
3724
|
return next();
|
|
3093
3725
|
}
|
|
3094
|
-
if (_optionalChain([req, 'access',
|
|
3726
|
+
if (_optionalChain([req, 'access', _268 => _268.url, 'optionalAccess', _269 => _269.startsWith, 'call', _270 => _270("/__farm/page-data")])) {
|
|
3095
3727
|
const urlObj = parsedRequestUrl;
|
|
3096
3728
|
const targetPath = urlObj.searchParams.get("path") || "/";
|
|
3729
|
+
let renderedRequest;
|
|
3097
3730
|
try {
|
|
3098
3731
|
const request = createRequestFromNodeRequest(
|
|
3099
3732
|
req,
|
|
3100
3733
|
urlObj,
|
|
3101
3734
|
_chunkCFG4QERRcjs.createFarmNodeRequestAbortSignal.call(void 0, req, res)
|
|
3102
3735
|
);
|
|
3103
|
-
const deploymentMismatch =
|
|
3736
|
+
const deploymentMismatch = _chunkI7J5RLGOcjs.getFarmDeploymentMismatch.call(void 0,
|
|
3104
3737
|
request,
|
|
3105
3738
|
farmConfig.deploymentId
|
|
3106
3739
|
);
|
|
3107
3740
|
if (deploymentMismatch) {
|
|
3108
3741
|
await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0,
|
|
3109
3742
|
res,
|
|
3110
|
-
|
|
3743
|
+
_chunkI7J5RLGOcjs.createFarmDeploymentMismatchResponse.call(void 0, deploymentMismatch)
|
|
3111
3744
|
);
|
|
3112
3745
|
return;
|
|
3113
3746
|
}
|
|
@@ -3117,17 +3750,24 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
3117
3750
|
headers: request.headers,
|
|
3118
3751
|
signal: request.signal
|
|
3119
3752
|
});
|
|
3753
|
+
renderedRequest = targetRequest;
|
|
3120
3754
|
let middlewareMap = /* @__PURE__ */ new Map();
|
|
3121
3755
|
let middlewareContext = /* @__PURE__ */ new Map();
|
|
3122
|
-
if (_optionalChain([middlewareManager, 'optionalAccess',
|
|
3756
|
+
if (_optionalChain([middlewareManager, 'optionalAccess', _271 => _271.hasMiddleware, 'call', _272 => _272()])) {
|
|
3123
3757
|
const targetNodeRequest = createPageDataMiddlewareRequest(req, targetRequestUrl);
|
|
3758
|
+
const targetNodeResponse = createPageDataMiddlewareResponse(res);
|
|
3124
3759
|
const handled = await runFarmMiddlewareWithNavigation(
|
|
3125
3760
|
farmApp.getServerRenderer(),
|
|
3126
3761
|
targetRequest,
|
|
3127
3762
|
targetNodeRequest,
|
|
3128
|
-
|
|
3129
|
-
() => middlewareManager.execute(targetNodeRequest,
|
|
3763
|
+
targetNodeResponse.response,
|
|
3764
|
+
() => middlewareManager.execute(targetNodeRequest, targetNodeResponse.response)
|
|
3130
3765
|
);
|
|
3766
|
+
const middlewareRedirect = targetNodeResponse.redirect();
|
|
3767
|
+
if (middlewareRedirect) {
|
|
3768
|
+
await sendFarmPageDataRedirect(res, middlewareRedirect, farmConfig.deploymentId);
|
|
3769
|
+
return;
|
|
3770
|
+
}
|
|
3131
3771
|
if (handled) return;
|
|
3132
3772
|
middlewareMap = _nullishCoalesce(targetNodeRequest.__FARM_MIDDLEWARE_DATA__, () => ( middlewareMap));
|
|
3133
3773
|
middlewareContext = _nullishCoalesce(targetNodeRequest.__FARM_MIDDLEWARE_CONTEXT__, () => ( middlewareContext));
|
|
@@ -3147,10 +3787,10 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
3147
3787
|
if (pm) {
|
|
3148
3788
|
await pm.runHookParallel("afterRouteMatch", {
|
|
3149
3789
|
pathname: targetPath,
|
|
3150
|
-
matched: !!_optionalChain([match, 'optionalAccess',
|
|
3151
|
-
routePattern: _optionalChain([match, 'optionalAccess',
|
|
3152
|
-
params: _optionalChain([match, 'optionalAccess',
|
|
3153
|
-
layoutPatterns: (_optionalChain([match, 'optionalAccess',
|
|
3790
|
+
matched: !!_optionalChain([match, 'optionalAccess', _273 => _273.route]),
|
|
3791
|
+
routePattern: _optionalChain([match, 'optionalAccess', _274 => _274.route, 'optionalAccess', _275 => _275.pattern]) || null,
|
|
3792
|
+
params: _optionalChain([match, 'optionalAccess', _276 => _276.params]) || {},
|
|
3793
|
+
layoutPatterns: (_optionalChain([match, 'optionalAccess', _277 => _277.layouts]) || []).map((l) => l.pattern)
|
|
3154
3794
|
});
|
|
3155
3795
|
}
|
|
3156
3796
|
if (!match) {
|
|
@@ -3173,7 +3813,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
3173
3813
|
);
|
|
3174
3814
|
const loadingModule = loadingBoundary ? await routeManager3.loadRouteModule(loadingBoundary.modulePath) : null;
|
|
3175
3815
|
const navigationManifest = routeManager3.generateClientManifest(server.config.root);
|
|
3176
|
-
const moduleMetadata = _nullishCoalesce(navigationManifest.routes.find((entry) => entry.pattern === route.pattern), () => (
|
|
3816
|
+
const moduleMetadata = _nullishCoalesce(navigationManifest.routes.find((entry) => entry.pattern === route.pattern), () => ( _chunkMZ4CRSY7cjs.getClientModuleMetadata.call(void 0, route.modulePath, server.config.root)));
|
|
3177
3817
|
const isClientComponent = moduleMetadata.isClientComponent;
|
|
3178
3818
|
const shouldHydrate = moduleMetadata.shouldHydrate;
|
|
3179
3819
|
let mergedMetadata = {};
|
|
@@ -3181,7 +3821,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
3181
3821
|
layouts.map((layout) => routeManager3.loadLayoutModule(layout.modulePath))
|
|
3182
3822
|
);
|
|
3183
3823
|
const layoutHydrationMetadata = layouts.map(
|
|
3184
|
-
(layout) => _nullishCoalesce(navigationManifest.layouts.find((entry) => entry.pattern === layout.pattern), () => (
|
|
3824
|
+
(layout) => _nullishCoalesce(navigationManifest.layouts.find((entry) => entry.pattern === layout.pattern), () => ( _chunkMZ4CRSY7cjs.getClientModuleMetadata.call(void 0, layout.modulePath, server.config.root)))
|
|
3185
3825
|
);
|
|
3186
3826
|
const shouldHydrateLayout = layoutHydrationMetadata.some(
|
|
3187
3827
|
(metadata) => metadata.shouldHydrate
|
|
@@ -3192,18 +3832,18 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
3192
3832
|
(metadata) => metadata.shouldHydrate && metadata.islandStrategy ? [metadata.islandStrategy] : []
|
|
3193
3833
|
)
|
|
3194
3834
|
];
|
|
3195
|
-
const hydrationIslandStrategy =
|
|
3196
|
-
_optionalChain([(_nullishCoalesce(_optionalChain([farmApp, 'optionalAccess',
|
|
3197
|
-
) === "islands" ?
|
|
3835
|
+
const hydrationIslandStrategy = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0,
|
|
3836
|
+
_optionalChain([(_nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _278 => _278.getConfig, 'call', _279 => _279()]), () => ( options))), 'access', _280 => _280.experimental, 'optionalAccess', _281 => _281.serverComponents])
|
|
3837
|
+
) === "islands" ? _chunkF36LS2C7cjs.resolveFarmRouteRootStrategy.call(void 0,
|
|
3198
3838
|
route,
|
|
3199
3839
|
{ shouldHydrate, islandStrategy: _nullishCoalesce(moduleMetadata.islandStrategy, () => ( null)) },
|
|
3200
3840
|
layouts.map((layout, index) => ({
|
|
3201
3841
|
pattern: layout.pattern,
|
|
3202
3842
|
modulePath: layout.modulePath,
|
|
3203
|
-
shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access',
|
|
3843
|
+
shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access', _282 => _282[index], 'optionalAccess', _283 => _283.shouldHydrate]) === true,
|
|
3204
3844
|
// Manifest entries carry it; metadata read from source does not.
|
|
3205
|
-
hasIsolatedClientBoundaries: _optionalChain([layoutHydrationMetadata, 'access',
|
|
3206
|
-
islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access',
|
|
3845
|
+
hasIsolatedClientBoundaries: _optionalChain([layoutHydrationMetadata, 'access', _284 => _284[index], 'optionalAccess', _285 => _285.hasIsolatedClientBoundaries]) === true,
|
|
3846
|
+
islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access', _286 => _286[index], 'optionalAccess', _287 => _287.islandStrategy]), () => ( null))
|
|
3207
3847
|
})),
|
|
3208
3848
|
server.config.root,
|
|
3209
3849
|
true
|
|
@@ -3251,14 +3891,16 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
3251
3891
|
mergedMetadata = await _chunk6IOZPJ3Icjs.mergeModuleViewport.call(void 0, mergedMetadata, routeModule, routeProps);
|
|
3252
3892
|
mergedMetadata = _chunk6IOZPJ3Icjs.addMetadataMarkdownAlternate.call(void 0,
|
|
3253
3893
|
mergedMetadata,
|
|
3254
|
-
|
|
3894
|
+
_chunkFT6KJHS3cjs.getFarmMarkdownAlternatePath.call(void 0, farmApp.getConfig().md, targetRequestUrl.pathname, {
|
|
3895
|
+
routePathname: (pathname2) => routeManager3.toRoutePathname(pathname2)
|
|
3896
|
+
})
|
|
3255
3897
|
);
|
|
3256
3898
|
const routeSlots = await Promise.all(
|
|
3257
3899
|
slots.map(async (slot) => {
|
|
3258
3900
|
const slotModule = await routeManager3.loadRouteModule(slot.route.modulePath);
|
|
3259
3901
|
const slotMetadata = _nullishCoalesce(navigationManifest.slots.find(
|
|
3260
3902
|
(entry) => entry.name === slot.name && entry.ownerPattern === slot.ownerPattern && entry.pattern === slot.route.pattern
|
|
3261
|
-
), () => (
|
|
3903
|
+
), () => ( _chunkMZ4CRSY7cjs.getClientModuleMetadata.call(void 0, slot.route.modulePath, server.config.root)));
|
|
3262
3904
|
const slotContext = await _chunkX333W5KVcjs.resolveFarmRouteContext.call(void 0, farmApp.getConfig(), {
|
|
3263
3905
|
request: targetRequest,
|
|
3264
3906
|
params: slot.params,
|
|
@@ -3304,15 +3946,15 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
3304
3946
|
);
|
|
3305
3947
|
const projectRoot = server.config.root;
|
|
3306
3948
|
const toUrlPath = (absolutePath) => _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, absolutePath, projectRoot);
|
|
3307
|
-
const renderPlan =
|
|
3949
|
+
const renderPlan = _chunkUPOYKX4Scjs.createFarmRouteRenderPlan.call(void 0, {
|
|
3308
3950
|
pageShouldHydrate: shouldHydrate,
|
|
3309
3951
|
layoutShouldHydrate: shouldHydrateLayout,
|
|
3310
3952
|
islandStrategy: hydrationIslandStrategy,
|
|
3311
|
-
rendering:
|
|
3953
|
+
rendering: _chunkQOGIZKSOcjs.resolveRouteRenderingConfig.call(void 0, routeModule)
|
|
3312
3954
|
});
|
|
3313
3955
|
const destinationLayoutPatterns = layouts.map((layout) => layout.pattern);
|
|
3314
|
-
const layoutStartIndex =
|
|
3315
|
-
|
|
3956
|
+
const layoutStartIndex = _chunkUPOYKX4Scjs.getSharedLayoutPrefixLength.call(void 0,
|
|
3957
|
+
_chunkUPOYKX4Scjs.parseFarmLayoutChainHeader.call(void 0, request.headers.get("x-farm-layout-chain")),
|
|
3316
3958
|
destinationLayoutPatterns
|
|
3317
3959
|
);
|
|
3318
3960
|
const renderer = farmApp.getServerRenderer();
|
|
@@ -3322,7 +3964,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
3322
3964
|
middlewareContext,
|
|
3323
3965
|
() => renderer.renderNavigationFragment({
|
|
3324
3966
|
PageComponent: routeModule.default,
|
|
3325
|
-
LoadingComponent: _optionalChain([loadingModule, 'optionalAccess',
|
|
3967
|
+
LoadingComponent: _optionalChain([loadingModule, 'optionalAccess', _288 => _288.default]),
|
|
3326
3968
|
pageProps: routeProps,
|
|
3327
3969
|
params,
|
|
3328
3970
|
layouts: layouts.map((layout, index) => ({
|
|
@@ -3388,15 +4030,15 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
3388
4030
|
};
|
|
3389
4031
|
await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0,
|
|
3390
4032
|
res,
|
|
3391
|
-
|
|
4033
|
+
_chunkDBYNZIIQcjs.createDeferredDataResponse.call(void 0,
|
|
3392
4034
|
pageData,
|
|
3393
4035
|
{
|
|
3394
4036
|
status: 200,
|
|
3395
4037
|
headers: {
|
|
3396
|
-
"Cache-Control":
|
|
4038
|
+
"Cache-Control": _chunkUPOYKX4Scjs.getFarmFragmentCacheControl.call(void 0, renderPlan),
|
|
3397
4039
|
"X-Farm-Navigation": "html-fragment",
|
|
3398
4040
|
Vary: "X-Farm-Layout-Chain",
|
|
3399
|
-
[
|
|
4041
|
+
[_chunkI7J5RLGOcjs.FARM_DEPLOYMENT_ID_HEADER]: farmConfig.deploymentId
|
|
3400
4042
|
}
|
|
3401
4043
|
},
|
|
3402
4044
|
{
|
|
@@ -3410,6 +4052,11 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
3410
4052
|
});
|
|
3411
4053
|
return;
|
|
3412
4054
|
} catch (error) {
|
|
4055
|
+
const redirect = renderedRequest ? await farmApp.getServerRenderer().resolvePageDataRedirect(renderedRequest, error) : null;
|
|
4056
|
+
if (redirect && !res.headersSent) {
|
|
4057
|
+
await sendFarmPageDataRedirect(res, redirect, farmConfig.deploymentId);
|
|
4058
|
+
return;
|
|
4059
|
+
}
|
|
3413
4060
|
const failure = resolveFarmPageDataFailure(error);
|
|
3414
4061
|
if (failure.status >= 500) {
|
|
3415
4062
|
await emitPluginError("page-data", error, {
|
|
@@ -3426,62 +4073,64 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
3426
4073
|
const startTime = Date.now();
|
|
3427
4074
|
const method = req.method || "GET";
|
|
3428
4075
|
const urlPath = req.url || "/";
|
|
3429
|
-
const requestedPathname =
|
|
4076
|
+
const requestedPathname = _chunkHDPT6OYEcjs.resolveFarmRequestURL.call(void 0, req, {
|
|
3430
4077
|
trustProxy: currentServerConfig.trustProxy
|
|
3431
4078
|
}).pathname;
|
|
3432
4079
|
const routeManager2 = farmApp.getRouteManager();
|
|
3433
|
-
const hasBeforeRouteMatchHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess',
|
|
3434
|
-
const hasAfterRouteMatchHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess',
|
|
3435
|
-
const hasBeforeRequestHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess',
|
|
3436
|
-
const hasBeforeRenderHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess',
|
|
3437
|
-
const hasAfterResponseHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess',
|
|
3438
|
-
const hasHTMLTransformHook = (_nullishCoalesce(_optionalChain([pm, 'optionalAccess',
|
|
3439
|
-
const hasRuntimeRequestHooks = _nullishCoalesce(_optionalChain([pm, 'optionalAccess',
|
|
3440
|
-
const hasRuntimeAfterHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess',
|
|
4080
|
+
const hasBeforeRouteMatchHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _289 => _289.hasHook, 'call', _290 => _290("beforeRouteMatch")]), () => ( false));
|
|
4081
|
+
const hasAfterRouteMatchHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _291 => _291.hasHook, 'call', _292 => _292("afterRouteMatch")]), () => ( false));
|
|
4082
|
+
const hasBeforeRequestHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _293 => _293.hasHook, 'call', _294 => _294("beforeRequest")]), () => ( false));
|
|
4083
|
+
const hasBeforeRenderHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _295 => _295.hasHook, 'call', _296 => _296("beforeRender")]), () => ( false));
|
|
4084
|
+
const hasAfterResponseHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _297 => _297.hasHook, 'call', _298 => _298("afterResponse")]), () => ( false));
|
|
4085
|
+
const hasHTMLTransformHook = (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _299 => _299.hasHook, 'call', _300 => _300("transformHTML")]), () => ( false))) || (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _301 => _301.hasHook, 'call', _302 => _302("afterRender")]), () => ( false)));
|
|
4086
|
+
const hasRuntimeRequestHooks = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _303 => _303.hasRuntimeRequestHooks, 'call', _304 => _304()]), () => ( false));
|
|
4087
|
+
const hasRuntimeAfterHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _305 => _305.hasRuntimeHook, 'call', _306 => _306("after")]), () => ( false));
|
|
3441
4088
|
const requestedMatch = routeManager2.matchRoute(requestedPathname);
|
|
3442
4089
|
const pageBuiltInRouteLabel = (pathname2) => {
|
|
3443
4090
|
const routePathname = _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, pathname2, farmConfig.basePath);
|
|
3444
|
-
const mcpLabel =
|
|
4091
|
+
const mcpLabel = _chunkYTNBCXCWcjs.resolveFarmMCPRouteLabel.call(void 0, routePathname, apiServerBasePath);
|
|
3445
4092
|
if (mcpLabel) return mcpLabel;
|
|
3446
4093
|
if (farmAgentGeneratedPaths(farmConfig).includes(routePathname)) return routePathname;
|
|
3447
|
-
return routePathname ===
|
|
4094
|
+
return routePathname === _chunkX3MHKLCOcjs.FARM_DEFAULT_MCP_PATH && farmApp.getServerRenderer().getDefaultMCPServer() ? _chunkX3MHKLCOcjs.FARM_DEFAULT_MCP_PATH : null;
|
|
3448
4095
|
};
|
|
3449
4096
|
let runtimeSession;
|
|
4097
|
+
let pathname = requestedPathname;
|
|
3450
4098
|
if (pm && hasRuntimeRequestHooks) {
|
|
3451
4099
|
try {
|
|
4100
|
+
const sessionOptions = {
|
|
4101
|
+
kind: "page",
|
|
4102
|
+
route: _chunkYTNBCXCWcjs.setFarmRouteLabel.call(void 0,
|
|
4103
|
+
{
|
|
4104
|
+
pathname: requestedPathname,
|
|
4105
|
+
pattern: _optionalChain([requestedMatch, 'optionalAccess', _307 => _307.route, 'optionalAccess', _308 => _308.pattern]) || null,
|
|
4106
|
+
params: _optionalChain([requestedMatch, 'optionalAccess', _309 => _309.params]) || {}
|
|
4107
|
+
},
|
|
4108
|
+
_optionalChain([requestedMatch, 'optionalAccess', _310 => _310.route]) ? null : pageBuiltInRouteLabel(requestedPathname)
|
|
4109
|
+
)
|
|
4110
|
+
};
|
|
3452
4111
|
runtimeSession = await pm.beginRuntimeRequest(
|
|
3453
|
-
createRequestFromNodeRequest(req, new URL(fullUrl)),
|
|
3454
|
-
|
|
3455
|
-
kind: "page",
|
|
3456
|
-
route: _chunk752IHQTDcjs.setFarmRouteLabel.call(void 0,
|
|
3457
|
-
{
|
|
3458
|
-
pathname: requestedPathname,
|
|
3459
|
-
pattern: _optionalChain([requestedMatch, 'optionalAccess', _271 => _271.route, 'optionalAccess', _272 => _272.pattern]) || null,
|
|
3460
|
-
params: _optionalChain([requestedMatch, 'optionalAccess', _273 => _273.params]) || {}
|
|
3461
|
-
},
|
|
3462
|
-
_optionalChain([requestedMatch, 'optionalAccess', _274 => _274.route]) ? null : pageBuiltInRouteLabel(requestedPathname)
|
|
3463
|
-
)
|
|
3464
|
-
}
|
|
4112
|
+
createRequestFromNodeRequest(req, new URL(_nullishCoalesce(configRewriteSource, () => ( fullUrl)))),
|
|
4113
|
+
sessionOptions
|
|
3465
4114
|
);
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
);
|
|
4115
|
+
const routedRequest = await _asyncNullishCoalesce(runtimeSession.response, async () => ( (configRewriteSource === void 0 ? runtimeSession.request : await pm.runRuntimeBeforeForRewrite(
|
|
4116
|
+
runtimeSession.request,
|
|
4117
|
+
createRequestFromNodeRequest(req, new URL(fullUrl)),
|
|
4118
|
+
sessionOptions
|
|
4119
|
+
))));
|
|
4120
|
+
if (routedRequest instanceof Response) {
|
|
4121
|
+
const response = await pm.endRuntimeRequest(runtimeSession, routedRequest);
|
|
3473
4122
|
await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, response);
|
|
3474
4123
|
return;
|
|
3475
4124
|
}
|
|
4125
|
+
pm.copyRequestContext(routedRequest, req);
|
|
4126
|
+
applyWebRequestToNodeRequest(routedRequest, req);
|
|
4127
|
+
pathname = new URL(routedRequest.url).pathname;
|
|
3476
4128
|
} catch (error) {
|
|
3477
|
-
await
|
|
3478
|
-
res
|
|
3479
|
-
res.setHeader("Content-Type", "text/plain; charset=utf-8");
|
|
3480
|
-
res.end("Internal Server Error");
|
|
4129
|
+
if (runtimeSession) await pm.failRuntimeRequest(runtimeSession, error);
|
|
4130
|
+
sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
|
|
3481
4131
|
return;
|
|
3482
4132
|
}
|
|
3483
4133
|
}
|
|
3484
|
-
const pathname = runtimeSession ? new URL(runtimeSession.request.url).pathname : requestedPathname;
|
|
3485
4134
|
const routeMatch = pathname === requestedPathname ? requestedMatch : routeManager2.matchRoute(pathname);
|
|
3486
4135
|
if (pm && hasBeforeRouteMatchHook) {
|
|
3487
4136
|
await pm.runHookParallel("beforeRouteMatch", {
|
|
@@ -3492,17 +4141,17 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
3492
4141
|
if (pm && hasAfterRouteMatchHook) {
|
|
3493
4142
|
await pm.runHookParallel("afterRouteMatch", {
|
|
3494
4143
|
pathname,
|
|
3495
|
-
matched: !!_optionalChain([routeMatch, 'optionalAccess',
|
|
3496
|
-
routePattern: _optionalChain([routeMatch, 'optionalAccess',
|
|
3497
|
-
params: _optionalChain([routeMatch, 'optionalAccess',
|
|
3498
|
-
layoutPatterns: (_optionalChain([routeMatch, 'optionalAccess',
|
|
4144
|
+
matched: !!_optionalChain([routeMatch, 'optionalAccess', _311 => _311.route]),
|
|
4145
|
+
routePattern: _optionalChain([routeMatch, 'optionalAccess', _312 => _312.route, 'optionalAccess', _313 => _313.pattern]) || null,
|
|
4146
|
+
params: _optionalChain([routeMatch, 'optionalAccess', _314 => _314.params]) || {},
|
|
4147
|
+
layoutPatterns: (_optionalChain([routeMatch, 'optionalAccess', _315 => _315.layouts]) || []).map((l) => l.pattern)
|
|
3499
4148
|
});
|
|
3500
4149
|
}
|
|
3501
4150
|
const renderPayload = {
|
|
3502
4151
|
pathname,
|
|
3503
4152
|
method,
|
|
3504
|
-
routePattern: _optionalChain([routeMatch, 'optionalAccess',
|
|
3505
|
-
params: _optionalChain([routeMatch, 'optionalAccess',
|
|
4153
|
+
routePattern: _optionalChain([routeMatch, 'optionalAccess', _316 => _316.route, 'optionalAccess', _317 => _317.pattern]) || null,
|
|
4154
|
+
params: _optionalChain([routeMatch, 'optionalAccess', _318 => _318.params]) || {}
|
|
3506
4155
|
};
|
|
3507
4156
|
const shouldInterceptResponse = Boolean(
|
|
3508
4157
|
pm && (hasAfterResponseHook || hasHTMLTransformHook || runtimeSession && hasRuntimeAfterHook)
|
|
@@ -3521,10 +4170,12 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
3521
4170
|
pathname,
|
|
3522
4171
|
startTime,
|
|
3523
4172
|
logResponse,
|
|
3524
|
-
emitError: (error) => emitPluginError("response-end", error, { pathname })
|
|
4173
|
+
emitError: (error) => emitPluginError("response-end", error, { pathname }),
|
|
4174
|
+
jsonError: runtimeHookErrorAnswersJSON
|
|
3525
4175
|
}) : void 0;
|
|
4176
|
+
let middlewareFailed = false;
|
|
3526
4177
|
try {
|
|
3527
|
-
if (_optionalChain([middlewareManager, 'optionalAccess',
|
|
4178
|
+
if (_optionalChain([middlewareManager, 'optionalAccess', _319 => _319.hasMiddleware, 'call', _320 => _320()])) {
|
|
3528
4179
|
const middlewareRequest = createRequestFromNodeRequest(req, new URL(fullUrl));
|
|
3529
4180
|
const handled = await runFarmMiddlewareWithNavigation(
|
|
3530
4181
|
farmApp.getServerRenderer(),
|
|
@@ -3532,9 +4183,12 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
3532
4183
|
req,
|
|
3533
4184
|
res,
|
|
3534
4185
|
() => middlewareManager.execute(req, res)
|
|
3535
|
-
)
|
|
4186
|
+
).catch((error) => {
|
|
4187
|
+
middlewareFailed = true;
|
|
4188
|
+
throw error;
|
|
4189
|
+
});
|
|
3536
4190
|
if (handled) {
|
|
3537
|
-
if (!_optionalChain([responseInterceptor, 'optionalAccess',
|
|
4191
|
+
if (!_optionalChain([responseInterceptor, 'optionalAccess', _321 => _321.isEnded, 'call', _322 => _322()])) {
|
|
3538
4192
|
const duration = Date.now() - startTime;
|
|
3539
4193
|
logResponse(method, urlPath, res.statusCode || 200, duration, "PAGE");
|
|
3540
4194
|
}
|
|
@@ -3542,43 +4196,15 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
3542
4196
|
}
|
|
3543
4197
|
}
|
|
3544
4198
|
if (pm && hasBeforeRequestHook) {
|
|
3545
|
-
const urlBeforeRequestHooks = req.url;
|
|
3546
|
-
const currentPathname = new URL(
|
|
3547
|
-
req.url || "/",
|
|
3548
|
-
`http://${req.headers.host || "localhost:3000"}`
|
|
3549
|
-
).pathname;
|
|
3550
|
-
const hasLocalPageRoute = Boolean(_optionalChain([routeManager2, 'access', _287 => _287.matchRoute, 'call', _288 => _288(currentPathname), 'optionalAccess', _289 => _289.route]));
|
|
3551
4199
|
await pm.runHookParallelFiltered(
|
|
3552
4200
|
"beforeRequest",
|
|
3553
|
-
(
|
|
4201
|
+
(plugin2) => !isFarmConfigRoutePlugin(plugin2),
|
|
3554
4202
|
req,
|
|
3555
4203
|
res
|
|
3556
4204
|
);
|
|
3557
|
-
if (runtimeSession && req.url !== urlBeforeRequestHooks && _optionalChain([req, 'access', _290 => _290.url, 'optionalAccess', _291 => _291.startsWith, 'call', _292 => _292("/")]) && !res.writableEnded) {
|
|
3558
|
-
const destinationUrl = new URL(req.url, fullUrl);
|
|
3559
|
-
const destinationMatch = routeManager2.matchRoute(destinationUrl.pathname);
|
|
3560
|
-
const guarded = await pm.runRuntimeBeforeForRewrite(
|
|
3561
|
-
runtimeSession.request,
|
|
3562
|
-
createRequestFromNodeRequest(req, destinationUrl),
|
|
3563
|
-
{
|
|
3564
|
-
kind: "page",
|
|
3565
|
-
route: {
|
|
3566
|
-
pathname: destinationUrl.pathname,
|
|
3567
|
-
pattern: _optionalChain([destinationMatch, 'optionalAccess', _293 => _293.route, 'optionalAccess', _294 => _294.pattern]) || null,
|
|
3568
|
-
params: _optionalChain([destinationMatch, 'optionalAccess', _295 => _295.params]) || {}
|
|
3569
|
-
}
|
|
3570
|
-
}
|
|
3571
|
-
);
|
|
3572
|
-
if (guarded instanceof Response) {
|
|
3573
|
-
await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0, res, guarded);
|
|
3574
|
-
} else {
|
|
3575
|
-
pm.copyRequestContext(guarded, req);
|
|
3576
|
-
applyWebRequestToNodeRequest(guarded, req);
|
|
3577
|
-
}
|
|
3578
|
-
}
|
|
3579
4205
|
}
|
|
3580
|
-
if (res.writableEnded || _optionalChain([responseInterceptor, 'optionalAccess',
|
|
3581
|
-
if (!_optionalChain([responseInterceptor, 'optionalAccess',
|
|
4206
|
+
if (res.writableEnded || _optionalChain([responseInterceptor, 'optionalAccess', _323 => _323.isEnded, 'call', _324 => _324()])) {
|
|
4207
|
+
if (!_optionalChain([responseInterceptor, 'optionalAccess', _325 => _325.isEnded, 'call', _326 => _326()])) {
|
|
3582
4208
|
const duration = Date.now() - startTime;
|
|
3583
4209
|
logResponse(method, urlPath, res.statusCode || 200, duration, "PAGE");
|
|
3584
4210
|
}
|
|
@@ -3598,13 +4224,53 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
3598
4224
|
if (pm && runtimeSession) {
|
|
3599
4225
|
await pm.failRuntimeRequest(runtimeSession, error);
|
|
3600
4226
|
}
|
|
3601
|
-
|
|
4227
|
+
if (!(middlewareFailed && runtimeSession)) {
|
|
4228
|
+
await emitPluginError("render-page", error, { pathname });
|
|
4229
|
+
}
|
|
4230
|
+
if (rendererDisabled && !res.headersSent) {
|
|
4231
|
+
sendFarmDevErrorJSON(res);
|
|
4232
|
+
return;
|
|
4233
|
+
}
|
|
4234
|
+
if (!res.headersSent) {
|
|
4235
|
+
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
4236
|
+
res.setHeader("Cache-Control", "private, no-store");
|
|
4237
|
+
}
|
|
3602
4238
|
next(error);
|
|
3603
4239
|
}
|
|
3604
4240
|
})
|
|
3605
4241
|
);
|
|
4242
|
+
const farmRequestMiddleware = _optionalChain([farmMiddlewares, 'access', _327 => _327.stack, 'access', _328 => _328.at, 'call', _329 => _329(-1), 'optionalAccess', _330 => _330.handle]);
|
|
4243
|
+
if (farmOwnsDevCors && viteServer.config.server.cors === false) {
|
|
4244
|
+
farmMiddlewares.use(createFarmDevViteCorsMiddleware());
|
|
4245
|
+
}
|
|
4246
|
+
return () => {
|
|
4247
|
+
farmPostMiddlewares.use((req, res, next) => {
|
|
4248
|
+
if (res.headersSent || res.writableEnded) return next();
|
|
4249
|
+
const deferredUrl = deferredDottedRequests.get(req);
|
|
4250
|
+
if (deferredUrl !== void 0) {
|
|
4251
|
+
req.url = deferredUrl;
|
|
4252
|
+
return farmRequestMiddleware(req, res, next);
|
|
4253
|
+
}
|
|
4254
|
+
if (!rendererDisabled) return next();
|
|
4255
|
+
const requested = _nullishCoalesce(_nullishCoalesce(req.originalUrl, () => ( req.url)), () => ( "/"));
|
|
4256
|
+
const pathname = _chunkHDPT6OYEcjs.parseFarmRequestTarget.call(void 0, requested, "http://localhost").pathname;
|
|
4257
|
+
res.statusCode = 404;
|
|
4258
|
+
res.setHeader("Content-Type", "application/json");
|
|
4259
|
+
res.end(JSON.stringify({ error: "Not found", pathname }));
|
|
4260
|
+
});
|
|
4261
|
+
};
|
|
3606
4262
|
},
|
|
3607
4263
|
async resolveId(id, importer, resolveOptions) {
|
|
4264
|
+
if (id.startsWith("@farm.js/core/internal/") && importer) {
|
|
4265
|
+
const root = _optionalChain([farmApp, 'optionalAccess', _331 => _331.getConfig, 'call', _332 => _332(), 'access', _333 => _333.root]) || _optionalChain([server, 'optionalAccess', _334 => _334.config, 'access', _335 => _335.root]) || options.root;
|
|
4266
|
+
const relative4 = root ? path6.relative(root, importer.split("?", 1)[0]) : "";
|
|
4267
|
+
if (root && (relative4.startsWith("..") || path6.isAbsolute(relative4))) {
|
|
4268
|
+
return this.resolve(id, path6.join(root, "package.json"), {
|
|
4269
|
+
...resolveOptions,
|
|
4270
|
+
skipSelf: true
|
|
4271
|
+
});
|
|
4272
|
+
}
|
|
4273
|
+
}
|
|
3608
4274
|
if (typeof fontImports.resolveId === "function") {
|
|
3609
4275
|
const fontId = await fontImports.resolveId.call(this, id, importer, resolveOptions);
|
|
3610
4276
|
if (fontId) return fontId;
|
|
@@ -3627,6 +4293,9 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
3627
4293
|
}
|
|
3628
4294
|
},
|
|
3629
4295
|
async load(id, loadOptions) {
|
|
4296
|
+
if (pendingClientSetup && !_optionalChain([loadOptions, 'optionalAccess', _336 => _336.ssr]) && !farmSetupContext.getStore()) {
|
|
4297
|
+
await pendingClientSetup;
|
|
4298
|
+
}
|
|
3630
4299
|
if (_chunkPIUTGRDIcjs.isFarmServerFnBoundaryId.call(void 0, id) && islandsServerFns()) {
|
|
3631
4300
|
const file = id.split("?", 1)[0];
|
|
3632
4301
|
this.addWatchFile(file);
|
|
@@ -3642,8 +4311,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
3642
4311
|
if (imageModule) return imageModule;
|
|
3643
4312
|
}
|
|
3644
4313
|
if (_chunkE7QOEV5Zcjs.parseProgrammaticRouteModuleId.call(void 0, id)) {
|
|
3645
|
-
const renderer = _optionalChain([farmApp, 'optionalAccess',
|
|
3646
|
-
const root = _optionalChain([server, 'optionalAccess',
|
|
4314
|
+
const renderer = _optionalChain([farmApp, 'optionalAccess', _337 => _337.getConfig, 'call', _338 => _338(), 'access', _339 => _339.renderer]) || _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, options.renderer);
|
|
4315
|
+
const root = _optionalChain([server, 'optionalAccess', _340 => _340.config, 'access', _341 => _341.root]) || options.root;
|
|
3647
4316
|
if (isClientEnvironment(this, loadOptions)) {
|
|
3648
4317
|
return generateProgrammaticClientRouteModuleForId(
|
|
3649
4318
|
id,
|
|
@@ -3659,65 +4328,65 @@ window.__FARM_MANIFEST__ = ${inlineValue({
|
|
|
3659
4328
|
return FARM_DEV_CLIENT_BOOT_MODULE;
|
|
3660
4329
|
}
|
|
3661
4330
|
if (isFarmClientVirtualId(id)) {
|
|
3662
|
-
const resolvedConfig = _optionalChain([farmApp, 'optionalAccess',
|
|
3663
|
-
const renderer = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
3664
|
-
const integrations = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
3665
|
-
const root = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
3666
|
-
const docs = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
4331
|
+
const resolvedConfig = _optionalChain([farmApp, 'optionalAccess', _342 => _342.getConfig, 'call', _343 => _343()]);
|
|
4332
|
+
const renderer = _optionalChain([resolvedConfig, 'optionalAccess', _344 => _344.renderer]) || _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, options.renderer);
|
|
4333
|
+
const integrations = _optionalChain([resolvedConfig, 'optionalAccess', _345 => _345.integrations]) || options.integrations;
|
|
4334
|
+
const root = _optionalChain([resolvedConfig, 'optionalAccess', _346 => _346.root]) || _optionalChain([server, 'optionalAccess', _347 => _347.config, 'access', _348 => _348.root]) || process.cwd();
|
|
4335
|
+
const docs = _optionalChain([resolvedConfig, 'optionalAccess', _349 => _349.docs]);
|
|
3667
4336
|
const adapterOwnsDocsRuntime = Boolean(
|
|
3668
|
-
|
|
4337
|
+
_chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([docs, 'optionalAccess', _350 => _350.adapter, 'optionalAccess', _351 => _351.server]) && docs.adapter.react
|
|
3669
4338
|
);
|
|
3670
|
-
const devtools = _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess',
|
|
4339
|
+
const devtools = _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _352 => _352.devtools]), () => ( _chunkSTF6VDYQcjs.resolveFarmDevtoolsConfig.call(void 0, false, "production")));
|
|
3671
4340
|
const [docsRuntime, docsSearchRuntime, devtoolsClientRuntime] = await Promise.all([
|
|
3672
|
-
_optionalChain([docs, 'optionalAccess',
|
|
3673
|
-
_optionalChain([docs, 'optionalAccess',
|
|
4341
|
+
_optionalChain([docs, 'optionalAccess', _353 => _353.enabled]) ? loadFarmDocsDevRuntime() : null,
|
|
4342
|
+
_optionalChain([docs, 'optionalAccess', _354 => _354.enabled]) && !adapterOwnsDocsRuntime ? loadFarmDocsSearchDevRuntime() : null,
|
|
3674
4343
|
devtools.enabled ? loadFarmDevtoolsClientRuntime() : null
|
|
3675
4344
|
]);
|
|
3676
|
-
const docsSearchEnabled = _nullishCoalesce(_optionalChain([docsSearchRuntime, 'optionalAccess',
|
|
4345
|
+
const docsSearchEnabled = _nullishCoalesce(_optionalChain([docsSearchRuntime, 'optionalAccess', _355 => _355.isFarmDocsSearchEnabled, 'call', _356 => _356(docs)]), () => ( false));
|
|
3677
4346
|
const generatedDocsSearchRuntime = docsSearchRuntime ? docsSearchRuntime.generateFarmDocsSearchClientRuntime(
|
|
3678
4347
|
docsSearchEnabled,
|
|
3679
4348
|
docsSearchEnabled ? docsSearchRuntime.resolveFarmDocsSearchClientModule(root) : void 0
|
|
3680
4349
|
) : EMPTY_FARM_DOCS_SEARCH_CLIENT_RUNTIME;
|
|
3681
4350
|
const generatedDevtoolsClientRuntime = devtoolsClientRuntime ? devtoolsClientRuntime.generateFarmDevtoolsClientRuntime(devtools) : "";
|
|
3682
4351
|
const generatedDevIndicatorsClientRuntime = farmApp ? _chunkUVV3I5QAcjs.generateFarmDevIndicatorsClientRuntime.call(void 0, farmApp.getConfig().devIndicators) : "";
|
|
3683
|
-
const integrationProviders =
|
|
3684
|
-
const isolatedHydrationMode =
|
|
3685
|
-
_optionalChain([resolvedConfig, 'optionalAccess',
|
|
4352
|
+
const integrationProviders = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) ? _chunkBDYM2TN3cjs.getIntegrationProviders.call(void 0, integrations) : [];
|
|
4353
|
+
const isolatedHydrationMode = _chunkMZ4CRSY7cjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
4354
|
+
_optionalChain([resolvedConfig, 'optionalAccess', _357 => _357.experimental, 'optionalAccess', _358 => _358.isolatedClientHydration]),
|
|
3686
4355
|
{
|
|
3687
|
-
serverComponents:
|
|
4356
|
+
serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([resolvedConfig, 'optionalAccess', _359 => _359.experimental, 'optionalAccess', _360 => _360.serverComponents])) === "rsc",
|
|
3688
4357
|
hasUnsupportedIntegrationProvider: integrationProviders.filter((provider) => provider.component || provider.type === "clerk").some((provider) => provider.supportsIsolatedHydration !== true)
|
|
3689
4358
|
}
|
|
3690
4359
|
);
|
|
3691
4360
|
return generateClientCode(
|
|
3692
4361
|
integrationProviders,
|
|
3693
4362
|
[
|
|
3694
|
-
...
|
|
3695
|
-
..._nullishCoalesce(_optionalChain([docsRuntime, 'optionalAccess',
|
|
4363
|
+
..._chunkBDYM2TN3cjs.getIntegrationDocumentNavigationMatchers.call(void 0, integrations),
|
|
4364
|
+
..._nullishCoalesce(_optionalChain([docsRuntime, 'optionalAccess', _361 => _361.getFarmDocsDocumentNavigationMatchers, 'call', _362 => _362(docs)]), () => ( []))
|
|
3696
4365
|
],
|
|
3697
4366
|
generatedDocsSearchRuntime,
|
|
3698
4367
|
`${generatedDevtoolsClientRuntime}
|
|
3699
4368
|
${generatedDevIndicatorsClientRuntime}`,
|
|
3700
|
-
_optionalChain([resolvedConfig, 'optionalAccess',
|
|
4369
|
+
_optionalChain([resolvedConfig, 'optionalAccess', _363 => _363.plugins]) || [],
|
|
3701
4370
|
root,
|
|
3702
|
-
_optionalChain([resolvedConfig, 'optionalAccess',
|
|
3703
|
-
_optionalChain([resolvedConfig, 'optionalAccess',
|
|
3704
|
-
|
|
4371
|
+
_optionalChain([resolvedConfig, 'optionalAccess', _364 => _364.srcDir]) || options.srcDir || "src",
|
|
4372
|
+
_optionalChain([resolvedConfig, 'optionalAccess', _365 => _365.publicRuntimeConfig]) || options.publicRuntimeConfig,
|
|
4373
|
+
_chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) ? _optionalChain([docs, 'optionalAccess', _366 => _366.adapter, 'optionalAccess', _367 => _367.react]) : void 0,
|
|
3705
4374
|
renderer,
|
|
3706
|
-
isolatedHydrationMode === "enabled" ||
|
|
3707
|
-
_nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess',
|
|
3708
|
-
_nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess',
|
|
3709
|
-
|
|
3710
|
-
|
|
4375
|
+
isolatedHydrationMode === "enabled" || _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([(_nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess', _368 => _368.getRouteManager, 'call', _369 => _369(), 'access', _370 => _370.getIsolatedClientBoundaryModules, 'call', _371 => _371(root)])))), 'optionalAccess', _372 => _372.size]) > 0,
|
|
4376
|
+
_nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _373 => _373.trailingSlash]), () => ( false)),
|
|
4377
|
+
_nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _374 => _374.basePath]), () => ( "/")),
|
|
4378
|
+
_chunkF36LS2C7cjs.generateClientCachePersistenceCode.call(void 0,
|
|
4379
|
+
_chunkF36LS2C7cjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, _optionalChain([resolvedConfig, 'optionalAccess', _375 => _375.cache]))
|
|
3711
4380
|
),
|
|
3712
|
-
|
|
3713
|
-
|
|
4381
|
+
_chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, docs) : void 0,
|
|
4382
|
+
_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([resolvedConfig, 'optionalAccess', _376 => _376.experimental, 'optionalAccess', _377 => _377.serverComponents])) === "islands"
|
|
3714
4383
|
);
|
|
3715
4384
|
}
|
|
3716
4385
|
if (id === "/@farm/server") {
|
|
3717
4386
|
return generateServerCode();
|
|
3718
4387
|
}
|
|
3719
4388
|
if (id === "/@farm/manifest") {
|
|
3720
|
-
const routeManager = _optionalChain([farmApp, 'optionalAccess',
|
|
4389
|
+
const routeManager = _optionalChain([farmApp, 'optionalAccess', _378 => _378.getRouteManager, 'call', _379 => _379()]);
|
|
3721
4390
|
if (!routeManager) {
|
|
3722
4391
|
return `
|
|
3723
4392
|
export const getManifest = () => ({
|
|
@@ -3730,9 +4399,9 @@ export const getManifest = () => ({
|
|
|
3730
4399
|
`;
|
|
3731
4400
|
}
|
|
3732
4401
|
const manifest = routeManager.generateClientManifest(server.config.root);
|
|
3733
|
-
const globalStylesheetHref =
|
|
4402
|
+
const globalStylesheetHref = _chunkF36LS2C7cjs.resolveDevGlobalStylesheetHref.call(void 0,
|
|
3734
4403
|
server.config.root,
|
|
3735
|
-
_optionalChain([farmApp, 'optionalAccess',
|
|
4404
|
+
_optionalChain([farmApp, 'optionalAccess', _380 => _380.getConfig, 'call', _381 => _381(), 'access', _382 => _382.srcDir])
|
|
3736
4405
|
);
|
|
3737
4406
|
const fullManifest = {
|
|
3738
4407
|
clientEntry: "/@farm/client.js",
|
|
@@ -3758,11 +4427,11 @@ export const getManifest = () => ({
|
|
|
3758
4427
|
};
|
|
3759
4428
|
}
|
|
3760
4429
|
for (const layout of manifest.layouts) {
|
|
3761
|
-
const groupScope =
|
|
4430
|
+
const groupScope = _chunkUPOYKX4Scjs.getRouteGroupScope.call(void 0, layout.pattern);
|
|
3762
4431
|
fullManifest.layouts[layout.pattern] = {
|
|
3763
4432
|
modulePath: layout.modulePath,
|
|
3764
4433
|
pattern: layout.pattern,
|
|
3765
|
-
...groupScope ? { urlPattern:
|
|
4434
|
+
...groupScope ? { urlPattern: _chunkUPOYKX4Scjs.stripRouteGroups.call(void 0, layout.pattern), groupScope } : {},
|
|
3766
4435
|
shouldHydrate: layout.shouldHydrate,
|
|
3767
4436
|
islandStrategy: layout.islandStrategy,
|
|
3768
4437
|
// Islands mode: rebuilt from its server tree, so its module is never preloaded.
|
|
@@ -3788,42 +4457,54 @@ export const manifest = getManifest();
|
|
|
3788
4457
|
}
|
|
3789
4458
|
},
|
|
3790
4459
|
async transform(code, id, transformOptions) {
|
|
3791
|
-
|
|
4460
|
+
if (pendingClientSetup && !_optionalChain([transformOptions, 'optionalAccess', _383 => _383.ssr]) && !farmSetupContext.getStore()) {
|
|
4461
|
+
await pendingClientSetup;
|
|
4462
|
+
}
|
|
4463
|
+
const actionConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _384 => _384.getConfig, 'call', _385 => _385()]), () => ( options));
|
|
3792
4464
|
let rewrotePackageImports = false;
|
|
3793
|
-
if (
|
|
4465
|
+
if (_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([actionConfig, 'access', _386 => _386.experimental, 'optionalAccess', _387 => _387.serverComponents])) === "islands" && (!id.includes("/node_modules/") || _optionalChain([transformOptions, 'optionalAccess', _388 => _388.ssr]) === true && farmReactServerFiles.has(id.split("?", 1)[0])) && !id.startsWith("\0") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id) && !_chunkMZ4CRSY7cjs.hasUseClientDirective.call(void 0, code)) {
|
|
3794
4466
|
const file = id.split("?", 1)[0];
|
|
3795
|
-
const projectRoot = actionConfig.root || _optionalChain([server, 'optionalAccess',
|
|
3796
|
-
if (_optionalChain([transformOptions, 'optionalAccess',
|
|
4467
|
+
const projectRoot = actionConfig.root || _optionalChain([server, 'optionalAccess', _389 => _389.config, 'access', _390 => _390.root]) || process.cwd();
|
|
4468
|
+
if (_optionalChain([transformOptions, 'optionalAccess', _391 => _391.ssr]) === true) {
|
|
3797
4469
|
if (farmReactServerFiles.has(file)) {
|
|
3798
|
-
for (const child of
|
|
4470
|
+
for (const child of _chunkMZ4CRSY7cjs.farmRelativeImportFiles.call(void 0, code, file))
|
|
3799
4471
|
farmReactServerFiles.add(child);
|
|
3800
4472
|
}
|
|
3801
|
-
const serverModule = farmReactServerFiles.has(file) || !
|
|
4473
|
+
const serverModule = farmReactServerFiles.has(file) || !_chunkMZ4CRSY7cjs.getFarmClientReachableModules.call(void 0,
|
|
3802
4474
|
path6.resolve(projectRoot, actionConfig.srcDir || "src"),
|
|
3803
4475
|
projectRoot
|
|
3804
4476
|
).has(path6.resolve(file));
|
|
3805
|
-
const reactServer = !serverModule ? null :
|
|
4477
|
+
const reactServer = !serverModule ? null : _chunkMZ4CRSY7cjs.rewriteFarmReactServerImports.call(void 0, {
|
|
3806
4478
|
code,
|
|
3807
4479
|
file,
|
|
3808
|
-
reference: (specifier, exportName) =>
|
|
4480
|
+
reference: (specifier, exportName) => _chunkMZ4CRSY7cjs.ensureFarmPackageClientReference.call(void 0, projectRoot, specifier, exportName, file),
|
|
3809
4481
|
onServerFile: (serverFile) => farmReactServerFiles.add(serverFile)
|
|
3810
4482
|
});
|
|
3811
4483
|
if (reactServer !== null) {
|
|
3812
4484
|
code = reactServer;
|
|
3813
4485
|
rewrotePackageImports = true;
|
|
3814
4486
|
}
|
|
4487
|
+
const internal = farmReactServerFiles.has(file) ? _chunkMZ4CRSY7cjs.rewriteFarmReactServerClientModuleImports.call(void 0, {
|
|
4488
|
+
code,
|
|
4489
|
+
file,
|
|
4490
|
+
reference: (clientFile) => _chunkMZ4CRSY7cjs.ensureFarmInternalClientReference.call(void 0, projectRoot, clientFile)
|
|
4491
|
+
}) : null;
|
|
4492
|
+
if (internal !== null) {
|
|
4493
|
+
code = internal;
|
|
4494
|
+
rewrotePackageImports = true;
|
|
4495
|
+
}
|
|
3815
4496
|
}
|
|
3816
|
-
const referenced =
|
|
4497
|
+
const referenced = _chunkMZ4CRSY7cjs.rewriteFarmPackageClientImports.call(void 0, {
|
|
3817
4498
|
code,
|
|
3818
4499
|
file,
|
|
3819
4500
|
root: projectRoot,
|
|
3820
|
-
isClientPackage: (specifier) =>
|
|
4501
|
+
isClientPackage: (specifier) => _chunkMZ4CRSY7cjs.isFarmPackageClientBoundary.call(void 0, file, specifier, projectRoot)
|
|
3821
4502
|
});
|
|
3822
4503
|
if (referenced !== null) {
|
|
3823
4504
|
code = referenced;
|
|
3824
4505
|
rewrotePackageImports = true;
|
|
3825
4506
|
}
|
|
3826
|
-
if (_optionalChain([transformOptions, 'optionalAccess',
|
|
4507
|
+
if (_optionalChain([transformOptions, 'optionalAccess', _392 => _392.ssr]) === true) {
|
|
3827
4508
|
const cached = rewriteFarmReactCacheImport(code, file);
|
|
3828
4509
|
if (cached !== null) {
|
|
3829
4510
|
code = cached;
|
|
@@ -3833,43 +4514,43 @@ export const manifest = getManifest();
|
|
|
3833
4514
|
}
|
|
3834
4515
|
if (islandsServerFns() && !_chunkPIUTGRDIcjs.isFarmServerFnBoundaryId.call(void 0, id) && !id.includes("/node_modules/") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id)) {
|
|
3835
4516
|
const serverFns = _chunkPIUTGRDIcjs.transformFarmServerFns.call(void 0, code, id, {
|
|
3836
|
-
environment: _optionalChain([transformOptions, 'optionalAccess',
|
|
4517
|
+
environment: _optionalChain([transformOptions, 'optionalAccess', _393 => _393.ssr]) === true ? "rsc" : "client"
|
|
3837
4518
|
});
|
|
3838
4519
|
if (serverFns) {
|
|
3839
4520
|
if (!serverFns.code.includes("use server")) return { code: serverFns.code, map: null };
|
|
3840
4521
|
code = serverFns.code;
|
|
3841
4522
|
}
|
|
3842
4523
|
}
|
|
3843
|
-
if (
|
|
4524
|
+
if (_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([actionConfig, 'access', _394 => _394.experimental, 'optionalAccess', _395 => _395.serverComponents])) === "islands" && code.includes("use server") && !id.includes("/node_modules/") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id)) {
|
|
3844
4525
|
const file = id.split("?", 1)[0];
|
|
3845
4526
|
const actionModule = transformFarmFormActionModule({
|
|
3846
4527
|
code,
|
|
3847
4528
|
id,
|
|
3848
|
-
root: actionConfig.root || _optionalChain([server, 'optionalAccess',
|
|
3849
|
-
ssr: _optionalChain([transformOptions, 'optionalAccess',
|
|
4529
|
+
root: actionConfig.root || _optionalChain([server, 'optionalAccess', _396 => _396.config, 'access', _397 => _397.root]) || process.cwd(),
|
|
4530
|
+
ssr: _optionalChain([transformOptions, 'optionalAccess', _398 => _398.ssr]) === true,
|
|
3850
4531
|
// Parsed by file type: page components are TSX.
|
|
3851
4532
|
parse: (source) => _vite.parseSync.call(void 0, file, source).program
|
|
3852
4533
|
});
|
|
3853
4534
|
if (actionModule) return { code: actionModule, map: null };
|
|
3854
4535
|
}
|
|
3855
|
-
if (!_optionalChain([transformOptions, 'optionalAccess',
|
|
3856
|
-
const docsConfigModule = _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, _optionalChain([farmApp, 'optionalAccess',
|
|
3857
|
-
if (
|
|
3858
|
-
const redacted =
|
|
4536
|
+
if (!_optionalChain([transformOptions, 'optionalAccess', _399 => _399.ssr])) {
|
|
4537
|
+
const docsConfigModule = _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, _optionalChain([farmApp, 'optionalAccess', _400 => _400.getConfig, 'call', _401 => _401(), 'optionalAccess', _402 => _402.docs]));
|
|
4538
|
+
if (_chunkF36LS2C7cjs.isFarmDocsClientConfigModule.call(void 0, id, docsConfigModule)) {
|
|
4539
|
+
const redacted = _chunkF36LS2C7cjs.redactFarmDocsClientConfig.call(void 0, code, id.split("?")[0]);
|
|
3859
4540
|
if (redacted !== null) return { code: redacted, map: null };
|
|
3860
4541
|
}
|
|
3861
4542
|
}
|
|
3862
|
-
if (!_optionalChain([transformOptions, 'optionalAccess',
|
|
3863
|
-
const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess',
|
|
3864
|
-
if ((_optionalChain([currentConfig, 'access',
|
|
4543
|
+
if (!_optionalChain([transformOptions, 'optionalAccess', _403 => _403.ssr])) {
|
|
4544
|
+
const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _404 => _404.getConfig, 'call', _405 => _405()]), () => ( options));
|
|
4545
|
+
if ((_optionalChain([currentConfig, 'access', _406 => _406.experimental, 'optionalAccess', _407 => _407.serverActions]) !== true || !serverFnTransformActive) && !islandsServerFns()) {
|
|
3865
4546
|
const violation = findClientServerFnViolation(code, id);
|
|
3866
4547
|
if (violation) {
|
|
3867
4548
|
this.error(formatServerFnBoundaryError(violation, id));
|
|
3868
4549
|
}
|
|
3869
4550
|
}
|
|
3870
4551
|
}
|
|
3871
|
-
if (!_optionalChain([transformOptions, 'optionalAccess',
|
|
3872
|
-
warnClientBoundaryOnce(this, id, code, _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess',
|
|
4552
|
+
if (!_optionalChain([transformOptions, 'optionalAccess', _408 => _408.ssr]) && shouldInspectClientBoundary(id, code)) {
|
|
4553
|
+
warnClientBoundaryOnce(this, id, code, _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _409 => _409.getConfig, 'call', _410 => _410()]), () => ( options)));
|
|
3873
4554
|
}
|
|
3874
4555
|
if (typeof imageImports.transform === "function") {
|
|
3875
4556
|
const imageModule = await imageImports.transform.call(this, code, id, transformOptions);
|
|
@@ -3884,13 +4565,13 @@ export const manifest = getManifest();
|
|
|
3884
4565
|
id,
|
|
3885
4566
|
transformOptions
|
|
3886
4567
|
);
|
|
3887
|
-
const fontCode = typeof fontResult === "string" ? fontResult : _optionalChain([fontResult, 'optionalAccess',
|
|
4568
|
+
const fontCode = typeof fontResult === "string" ? fontResult : _optionalChain([fontResult, 'optionalAccess', _411 => _411.code, 'optionalAccess', _412 => _412.toString, 'call', _413 => _413()]);
|
|
3888
4569
|
if (fontCode) {
|
|
3889
4570
|
transformedCode = fontCode;
|
|
3890
4571
|
transformed = true;
|
|
3891
4572
|
}
|
|
3892
4573
|
}
|
|
3893
|
-
if (_optionalChain([transformOptions, 'optionalAccess',
|
|
4574
|
+
if (_optionalChain([transformOptions, 'optionalAccess', _414 => _414.ssr]) && server) {
|
|
3894
4575
|
const rewrittenImports = rewriteEarlySsrRelativeImports({
|
|
3895
4576
|
code: transformedCode,
|
|
3896
4577
|
id,
|
|
@@ -3902,26 +4583,26 @@ export const manifest = getManifest();
|
|
|
3902
4583
|
transformed = true;
|
|
3903
4584
|
}
|
|
3904
4585
|
}
|
|
3905
|
-
if (
|
|
4586
|
+
if (_chunkMZ4CRSY7cjs.hasUseClientDirective.call(void 0, transformedCode)) {
|
|
3906
4587
|
const clientBoundarySource = transformedCode;
|
|
3907
4588
|
const moduleInfo = this.getModuleInfo(id);
|
|
3908
4589
|
if (moduleInfo) {
|
|
3909
4590
|
moduleInfo.isClientComponent = true;
|
|
3910
4591
|
}
|
|
3911
|
-
transformedCode =
|
|
4592
|
+
transformedCode = _chunkMZ4CRSY7cjs.stripUseClientDirective.call(void 0, transformedCode);
|
|
3912
4593
|
transformed = true;
|
|
3913
|
-
const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess',
|
|
4594
|
+
const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _415 => _415.getConfig, 'call', _416 => _416()]), () => ( options));
|
|
3914
4595
|
let isolatedModuleReference = null;
|
|
3915
|
-
const root = currentConfig.root || _optionalChain([server, 'optionalAccess',
|
|
4596
|
+
const root = currentConfig.root || _optionalChain([server, 'optionalAccess', _417 => _417.config, 'access', _418 => _418.root]) || process.cwd();
|
|
3916
4597
|
const cleanId = id.split("?", 1)[0];
|
|
3917
|
-
const selectedIsolatedModules = _nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess',
|
|
3918
|
-
const selectedForIsolatedHydration = _optionalChain([selectedIsolatedModules, 'optionalAccess',
|
|
3919
|
-
if (
|
|
3920
|
-
cleanId.replace(/\\/g, "/").includes(
|
|
4598
|
+
const selectedIsolatedModules = _nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess', _419 => _419.getRouteManager, 'call', _420 => _420(), 'access', _421 => _421.getIsolatedClientBoundaryModules, 'call', _422 => _422(root)])));
|
|
4599
|
+
const selectedForIsolatedHydration = _optionalChain([selectedIsolatedModules, 'optionalAccess', _423 => _423.has, 'call', _424 => _424(path6.resolve(cleanId))]) === true;
|
|
4600
|
+
if (_chunk67MZTLTFcjs.isReactRenderer.call(void 0, _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, currentConfig.renderer)) && selectedForIsolatedHydration && (_chunkMZ4CRSY7cjs.isIsolatableClientBoundarySource.call(void 0, clientBoundarySource) || // A generated client reference, whose marker comment compiled TSX no longer has.
|
|
4601
|
+
cleanId.replace(/\\/g, "/").includes(_chunkMZ4CRSY7cjs.FARM_CLIENT_REFERENCE_DIRECTORY))) {
|
|
3921
4602
|
isolatedModuleReference = _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, cleanId, root);
|
|
3922
|
-
const islandsMode =
|
|
3923
|
-
const explicitStrategy =
|
|
3924
|
-
const inference = islandsMode && explicitStrategy === null ?
|
|
4603
|
+
const islandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([currentConfig, 'access', _425 => _425.experimental, 'optionalAccess', _426 => _426.serverComponents])) === "islands";
|
|
4604
|
+
const explicitStrategy = _chunkMZ4CRSY7cjs.getIslandStrategyExport.call(void 0, clientBoundarySource);
|
|
4605
|
+
const inference = islandsMode && explicitStrategy === null ? _chunkF36LS2C7cjs.inferFarmIslandStrategy.call(void 0, cleanId, root) : null;
|
|
3925
4606
|
if (inference) {
|
|
3926
4607
|
for (const file of inference.files) {
|
|
3927
4608
|
if (file !== path6.resolve(cleanId)) this.addWatchFile(file);
|
|
@@ -3934,7 +4615,8 @@ export const manifest = getManifest();
|
|
|
3934
4615
|
islandStrategy: _nullishCoalesce(explicitStrategy, () => ( "load")),
|
|
3935
4616
|
parse: (source) => this.parse(source),
|
|
3936
4617
|
slots: islandsMode,
|
|
3937
|
-
|
|
4618
|
+
browser: _optionalChain([transformOptions, 'optionalAccess', _427 => _427.ssr]) !== true,
|
|
4619
|
+
inferredInteraction: _optionalChain([inference, 'optionalAccess', _428 => _428.strategy]) === "interaction"
|
|
3938
4620
|
});
|
|
3939
4621
|
if (!transformedBoundary) {
|
|
3940
4622
|
this.error(
|
|
@@ -3964,7 +4646,7 @@ export const manifest = getManifest();
|
|
|
3964
4646
|
);
|
|
3965
4647
|
return;
|
|
3966
4648
|
}` : "";
|
|
3967
|
-
const hmrCode = _optionalChain([transformOptions, 'optionalAccess',
|
|
4649
|
+
const hmrCode = _optionalChain([transformOptions, 'optionalAccess', _429 => _429.ssr]) || reactRefreshActive || !shouldEmitFarmClientRootHmr(currentConfig.renderer) ? "" : `
|
|
3968
4650
|
if (import.meta.hot) {
|
|
3969
4651
|
import.meta.hot.accept((newModule) => {
|
|
3970
4652
|
${isolatedHmrUpdate}
|
|
@@ -3999,6 +4681,7 @@ if (import.meta.hot) {
|
|
|
3999
4681
|
if (typeof fontImports.generateBundle === "function") {
|
|
4000
4682
|
await fontImports.generateBundle.call(this, options2, bundle, false);
|
|
4001
4683
|
}
|
|
4684
|
+
if (rendererDisabled) return;
|
|
4002
4685
|
const clientManifest = generateClientManifest(bundle);
|
|
4003
4686
|
this.emitFile({
|
|
4004
4687
|
type: "asset",
|
|
@@ -4019,14 +4702,14 @@ if (import.meta.hot) {
|
|
|
4019
4702
|
}
|
|
4020
4703
|
_chunkQMNWKQL4cjs.logger.info(`Found ${ssgPages.length} SSG pages, ${ssrRoutes.length} SSR routes`);
|
|
4021
4704
|
_chunkQMNWKQL4cjs.logger.info("Pre-rendering SSG pages...");
|
|
4022
|
-
const outDir = path6.join(_optionalChain([server, 'optionalAccess',
|
|
4705
|
+
const outDir = path6.join(_optionalChain([server, 'optionalAccess', _430 => _430.config, 'access', _431 => _431.root]) || process.cwd(), options.outDir || "dist");
|
|
4023
4706
|
const clientDir = path6.join(outDir, "client");
|
|
4024
4707
|
for (const page of ssgPages) {
|
|
4025
4708
|
try {
|
|
4026
4709
|
const staticRequest = new Request(new URL(page.urlPath, "http://farm.static"));
|
|
4027
4710
|
await farmApp.getServerRenderer().runWithRequestContext(staticRequest, async () => {
|
|
4028
4711
|
const mod = await routeManager.loadRouteModule(page.filePath);
|
|
4029
|
-
if (!_optionalChain([mod, 'optionalAccess',
|
|
4712
|
+
if (!_optionalChain([mod, 'optionalAccess', _432 => _432.default])) return;
|
|
4030
4713
|
const { layouts } = routeManager.matchRoute(page.urlPath);
|
|
4031
4714
|
const layoutModules = await Promise.all(
|
|
4032
4715
|
layouts.map((l) => routeManager.loadLayoutModule(l.modulePath))
|
|
@@ -4058,7 +4741,7 @@ if (import.meta.hot) {
|
|
|
4058
4741
|
const i18nSnapshot = _chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0, );
|
|
4059
4742
|
const i18nHead = renderFarmI18nStaticHead(page.urlPath, i18nSnapshot);
|
|
4060
4743
|
const fullHtml = `<!DOCTYPE html>
|
|
4061
|
-
<html lang="${escapeFarmHtmlAttribute(_optionalChain([i18nSnapshot, 'optionalAccess',
|
|
4744
|
+
<html lang="${escapeFarmHtmlAttribute(_optionalChain([i18nSnapshot, 'optionalAccess', _433 => _433.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}>
|
|
4062
4745
|
<head>
|
|
4063
4746
|
<meta charset="utf-8">
|
|
4064
4747
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
@@ -4101,10 +4784,11 @@ if (import.meta.hot) {
|
|
|
4101
4784
|
}
|
|
4102
4785
|
},
|
|
4103
4786
|
watchChange() {
|
|
4104
|
-
|
|
4105
|
-
|
|
4787
|
+
_chunkMZ4CRSY7cjs.invalidateFarmClientReachableModules.call(void 0, );
|
|
4788
|
+
_chunkMZ4CRSY7cjs.invalidateFarmClientOnlyScan.call(void 0, );
|
|
4106
4789
|
},
|
|
4107
4790
|
async handleHotUpdate(ctx) {
|
|
4791
|
+
if (pendingClientSetup && !farmSetupContext.getStore()) await pendingClientSetup;
|
|
4108
4792
|
const { file, server: server2, modules } = ctx;
|
|
4109
4793
|
if (initialPluginManager) {
|
|
4110
4794
|
try {
|
|
@@ -4126,23 +4810,23 @@ if (import.meta.hot) {
|
|
|
4126
4810
|
server2.moduleGraph.invalidateModule(mod);
|
|
4127
4811
|
}
|
|
4128
4812
|
}
|
|
4129
|
-
const currentFarmConfig = _optionalChain([farmApp, 'optionalAccess',
|
|
4813
|
+
const currentFarmConfig = _optionalChain([farmApp, 'optionalAccess', _434 => _434.getConfig, 'call', _435 => _435()]);
|
|
4130
4814
|
const normalizedFile = file.replace(/\\/g, "/");
|
|
4131
|
-
if (currentFarmConfig && /\/route\.(?:ts|tsx|js|jsx)$/.test(normalizedFile) &&
|
|
4815
|
+
if (currentFarmConfig && /\/route\.(?:ts|tsx|js|jsx)$/.test(normalizedFile) && _chunkMTBDJ326cjs.getFarmAppDirectories.call(void 0, currentFarmConfig).some(
|
|
4132
4816
|
(appDir) => normalizedFile.startsWith(`${_chunkQMNWKQL4cjs.toPosixPath.call(void 0, appDir)}/api/`)
|
|
4133
4817
|
)) {
|
|
4134
4818
|
for (const mod of modules) server2.moduleGraph.invalidateModule(mod);
|
|
4135
|
-
await _optionalChain([refreshRouteDiscovery, 'optionalCall',
|
|
4819
|
+
await _optionalChain([refreshRouteDiscovery, 'optionalCall', _436 => _436(`updated ${file}`)]);
|
|
4136
4820
|
server2.ws.send({ type: "full-reload", path: "*" });
|
|
4137
4821
|
return [];
|
|
4138
4822
|
}
|
|
4139
|
-
const currentSrcRoot = currentFarmConfig ?
|
|
4823
|
+
const currentSrcRoot = currentFarmConfig ? _chunkMTBDJ326cjs.getFarmSourceRoots.call(void 0, currentFarmConfig).map((source) => path6.join(source.root, source.srcDir).replace(/\\/g, "/")).find((sourceRoot) => normalizedFile.startsWith(`${sourceRoot}/`)) || null : null;
|
|
4140
4824
|
if (currentSrcRoot && normalizedFile.startsWith(`${currentSrcRoot}/`) && _chunkE7QOEV5Zcjs.isProgrammaticRoutesFileName.call(void 0, normalizedFile)) {
|
|
4141
4825
|
logUpdate("PAGE", `updated ${path6.basename(file)}`);
|
|
4142
4826
|
for (const mod of modules) {
|
|
4143
4827
|
server2.moduleGraph.invalidateModule(mod);
|
|
4144
4828
|
}
|
|
4145
|
-
await _optionalChain([refreshRouteDiscovery, 'optionalCall',
|
|
4829
|
+
await _optionalChain([refreshRouteDiscovery, 'optionalCall', _437 => _437(`updated ${file}`)]);
|
|
4146
4830
|
server2.ws.send({
|
|
4147
4831
|
type: "full-reload",
|
|
4148
4832
|
path: "*"
|
|
@@ -4155,7 +4839,7 @@ if (import.meta.hot) {
|
|
|
4155
4839
|
for (const mod of modules) {
|
|
4156
4840
|
server2.moduleGraph.invalidateModule(mod);
|
|
4157
4841
|
}
|
|
4158
|
-
await _optionalChain([refreshRouteDiscovery, 'optionalCall',
|
|
4842
|
+
await _optionalChain([refreshRouteDiscovery, 'optionalCall', _438 => _438(`updated ${file}`)]);
|
|
4159
4843
|
server2.ws.send({
|
|
4160
4844
|
type: "full-reload",
|
|
4161
4845
|
path: "*"
|
|
@@ -4163,12 +4847,13 @@ if (import.meta.hot) {
|
|
|
4163
4847
|
return [];
|
|
4164
4848
|
}
|
|
4165
4849
|
if (apiRouteManager && _chunkJYNNIGQOcjs.invalidateFarmDevDependents.call(void 0, server2, file, apiRouteManager.getSourceFiles()).length > 0) {
|
|
4166
|
-
await _optionalChain([refreshRouteDiscovery, 'optionalCall',
|
|
4850
|
+
await _optionalChain([refreshRouteDiscovery, 'optionalCall', _439 => _439(`updated ${file}`)]);
|
|
4167
4851
|
}
|
|
4168
|
-
const isolatedHydrationMode = _optionalChain([currentFarmConfig, 'optionalAccess',
|
|
4169
|
-
const planRouteManager = _optionalChain([farmApp, 'optionalAccess',
|
|
4852
|
+
const isolatedHydrationMode = _optionalChain([currentFarmConfig, 'optionalAccess', _440 => _440.experimental, 'optionalAccess', _441 => _441.isolatedClientHydration]);
|
|
4853
|
+
const planRouteManager = _optionalChain([farmApp, 'optionalAccess', _442 => _442.getRouteManager, 'call', _443 => _443()]);
|
|
4170
4854
|
const isHydrationPlanSource = currentSrcRoot !== null && normalizedFile.startsWith(`${currentSrcRoot}/`) && /\.[cm]?[jt]sx?$/.test(normalizedFile);
|
|
4171
|
-
const tracksAsyncOwnerIslands =
|
|
4855
|
+
const tracksAsyncOwnerIslands = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, _optionalChain([currentFarmConfig, 'optionalAccess', _444 => _444.renderer])) && planRouteManager !== void 0;
|
|
4856
|
+
let clientPlanCurrent = false;
|
|
4172
4857
|
if (isHydrationPlanSource && (isolatedHydrationMode === "enabled" || isolatedHydrationMode === "analyze" || tracksAsyncOwnerIslands)) {
|
|
4173
4858
|
const routeManager = planRouteManager;
|
|
4174
4859
|
if (routeManager) {
|
|
@@ -4203,6 +4888,7 @@ if (import.meta.hot) {
|
|
|
4203
4888
|
server2.ws.send({ type: "full-reload", path: "*" });
|
|
4204
4889
|
return [];
|
|
4205
4890
|
}
|
|
4891
|
+
clientPlanCurrent = true;
|
|
4206
4892
|
} catch (error) {
|
|
4207
4893
|
_chunkQMNWKQL4cjs.logger.warn(
|
|
4208
4894
|
`[Farm.js] Could not refresh the client hydration plan after ${file}: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -4228,7 +4914,7 @@ if (import.meta.hot) {
|
|
|
4228
4914
|
}
|
|
4229
4915
|
return [];
|
|
4230
4916
|
}
|
|
4231
|
-
_optionalChain([farmApp, 'optionalAccess',
|
|
4917
|
+
if (!clientPlanCurrent) _optionalChain([farmApp, 'optionalAccess', _445 => _445.getRouteManager, 'call', _446 => _446(), 'access', _447 => _447.invalidateClientManifest, 'call', _448 => _448()]);
|
|
4232
4918
|
const manifestModule = server2.moduleGraph.getModuleById("/@farm/manifest");
|
|
4233
4919
|
if (manifestModule) {
|
|
4234
4920
|
server2.moduleGraph.invalidateModule(manifestModule);
|
|
@@ -4249,6 +4935,40 @@ if (import.meta.hot) {
|
|
|
4249
4935
|
return modules;
|
|
4250
4936
|
}
|
|
4251
4937
|
};
|
|
4938
|
+
if (!deferredSetup) return plugin;
|
|
4939
|
+
const setUpDevServer = plugin.configureServer;
|
|
4940
|
+
let deferred = false;
|
|
4941
|
+
plugin.configureServer = function(viteServer) {
|
|
4942
|
+
if (deferred) {
|
|
4943
|
+
deferredGates = void 0;
|
|
4944
|
+
return setUpDevServer.call(this, viteServer);
|
|
4945
|
+
}
|
|
4946
|
+
deferred = true;
|
|
4947
|
+
const ready = () => deferredSetup.ready;
|
|
4948
|
+
deferredGates = {
|
|
4949
|
+
pre: createFarmDeferredMiddleware(ready),
|
|
4950
|
+
post: createFarmDeferredMiddleware(ready)
|
|
4951
|
+
};
|
|
4952
|
+
const setup = farmSetupContext.run(true, () => setUpDevServer.call(this, viteServer)).then((registerPostMiddleware) => {
|
|
4953
|
+
registerPostMiddleware();
|
|
4954
|
+
});
|
|
4955
|
+
viteServer.middlewares.use(deferredGates.pre.handle);
|
|
4956
|
+
deferredSetup.setup = setup;
|
|
4957
|
+
deferredSetup.ready = setup;
|
|
4958
|
+
pendingClientSetup = setup.then(
|
|
4959
|
+
() => {
|
|
4960
|
+
pendingClientSetup = null;
|
|
4961
|
+
},
|
|
4962
|
+
() => {
|
|
4963
|
+
pendingClientSetup = null;
|
|
4964
|
+
}
|
|
4965
|
+
);
|
|
4966
|
+
const post = deferredGates.post.handle;
|
|
4967
|
+
return () => {
|
|
4968
|
+
viteServer.middlewares.use(post);
|
|
4969
|
+
};
|
|
4970
|
+
};
|
|
4971
|
+
return plugin;
|
|
4252
4972
|
}
|
|
4253
4973
|
function runFarmMiddlewareWithNavigation(renderer, middlewareRequest, req, res, execute) {
|
|
4254
4974
|
return renderer.runWithRequestContext(middlewareRequest, async () => {
|
|
@@ -4267,6 +4987,75 @@ function createPageDataMiddlewareRequest(req, target) {
|
|
|
4267
4987
|
targetNodeRequest.method = "GET";
|
|
4268
4988
|
return targetNodeRequest;
|
|
4269
4989
|
}
|
|
4990
|
+
function createPageDataMiddlewareResponse(res) {
|
|
4991
|
+
let redirect = null;
|
|
4992
|
+
let passthrough = false;
|
|
4993
|
+
const captures = (status, location) => {
|
|
4994
|
+
if (redirect) return true;
|
|
4995
|
+
if (passthrough) return false;
|
|
4996
|
+
redirect = _chunkRWR7SMD7cjs.getFarmPageDataRedirectFromResponse.call(void 0,
|
|
4997
|
+
status,
|
|
4998
|
+
Array.isArray(location) ? location[0] : typeof location === "string" ? location : null
|
|
4999
|
+
);
|
|
5000
|
+
passthrough = !redirect;
|
|
5001
|
+
return !passthrough;
|
|
5002
|
+
};
|
|
5003
|
+
const response = new Proxy(res, {
|
|
5004
|
+
get(target, property) {
|
|
5005
|
+
if (property === "writeHead") {
|
|
5006
|
+
return (status, ...args) => {
|
|
5007
|
+
const headers = args.find((arg) => arg && typeof arg === "object");
|
|
5008
|
+
if (captures(status, _nullishCoalesce(readWriteHeadLocation(headers), () => ( target.getHeader("location"))))) {
|
|
5009
|
+
return response;
|
|
5010
|
+
}
|
|
5011
|
+
return target.writeHead(
|
|
5012
|
+
status,
|
|
5013
|
+
...args
|
|
5014
|
+
);
|
|
5015
|
+
};
|
|
5016
|
+
}
|
|
5017
|
+
if (property === "write" || property === "end") {
|
|
5018
|
+
return (...args) => {
|
|
5019
|
+
if (captures(target.statusCode, target.getHeader("location"))) {
|
|
5020
|
+
const callback = args.find((arg) => typeof arg === "function");
|
|
5021
|
+
_optionalChain([callback, 'optionalCall', _449 => _449()]);
|
|
5022
|
+
return property === "write" ? true : response;
|
|
5023
|
+
}
|
|
5024
|
+
return target[property](...args);
|
|
5025
|
+
};
|
|
5026
|
+
}
|
|
5027
|
+
if (redirect && (property === "headersSent" || property === "writableEnded" || property === "finished")) {
|
|
5028
|
+
return true;
|
|
5029
|
+
}
|
|
5030
|
+
const value = Reflect.get(target, property, target);
|
|
5031
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
5032
|
+
},
|
|
5033
|
+
set(target, property, value) {
|
|
5034
|
+
return Reflect.set(target, property, value, target);
|
|
5035
|
+
}
|
|
5036
|
+
});
|
|
5037
|
+
return { response, redirect: () => redirect };
|
|
5038
|
+
}
|
|
5039
|
+
function readWriteHeadLocation(headers) {
|
|
5040
|
+
if (Array.isArray(headers)) {
|
|
5041
|
+
for (let index = 0; index + 1 < headers.length; index += 2) {
|
|
5042
|
+
if (String(headers[index]).toLowerCase() === "location") return headers[index + 1];
|
|
5043
|
+
}
|
|
5044
|
+
return void 0;
|
|
5045
|
+
}
|
|
5046
|
+
if (!headers || typeof headers !== "object") return void 0;
|
|
5047
|
+
for (const [name, value] of Object.entries(headers)) {
|
|
5048
|
+
if (name.toLowerCase() === "location") return value;
|
|
5049
|
+
}
|
|
5050
|
+
return void 0;
|
|
5051
|
+
}
|
|
5052
|
+
async function sendFarmPageDataRedirect(res, redirect, deploymentId) {
|
|
5053
|
+
for (const name of ["location", "content-length", "content-type"]) res.removeHeader(name);
|
|
5054
|
+
await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0,
|
|
5055
|
+
res,
|
|
5056
|
+
_chunkI7J5RLGOcjs.withFarmDeploymentResponse.call(void 0, _chunkRWR7SMD7cjs.createFarmPageDataRedirectResponse.call(void 0, redirect), deploymentId)
|
|
5057
|
+
);
|
|
5058
|
+
}
|
|
4270
5059
|
function resolveDevelopmentRoot(farmRoot, viteRoot) {
|
|
4271
5060
|
if (!farmRoot) return viteRoot;
|
|
4272
5061
|
if (path6.resolve(farmRoot) === path6.resolve(viteRoot)) return farmRoot;
|
|
@@ -4274,7 +5063,7 @@ function resolveDevelopmentRoot(farmRoot, viteRoot) {
|
|
|
4274
5063
|
if (fs2.realpathSync(farmRoot) === fs2.realpathSync(viteRoot)) {
|
|
4275
5064
|
return path6.resolve(viteRoot);
|
|
4276
5065
|
}
|
|
4277
|
-
} catch (
|
|
5066
|
+
} catch (e27) {
|
|
4278
5067
|
}
|
|
4279
5068
|
return farmRoot;
|
|
4280
5069
|
}
|
|
@@ -4293,12 +5082,12 @@ function isFarmClientVirtualId(id) {
|
|
|
4293
5082
|
}
|
|
4294
5083
|
function isClientEnvironment(context, loadOptions) {
|
|
4295
5084
|
const environment = context.environment;
|
|
4296
|
-
if (_optionalChain([environment, 'optionalAccess',
|
|
4297
|
-
if (_optionalChain([environment, 'optionalAccess',
|
|
4298
|
-
return _optionalChain([loadOptions, 'optionalAccess',
|
|
5085
|
+
if (_optionalChain([environment, 'optionalAccess', _450 => _450.config, 'optionalAccess', _451 => _451.consumer])) return environment.config.consumer === "client";
|
|
5086
|
+
if (_optionalChain([environment, 'optionalAccess', _452 => _452.name])) return environment.name === "client";
|
|
5087
|
+
return _optionalChain([loadOptions, 'optionalAccess', _453 => _453.ssr]) !== true;
|
|
4299
5088
|
}
|
|
4300
5089
|
function invalidateProgrammaticClientRouteModules(server) {
|
|
4301
|
-
const graph = _optionalChain([server, 'access',
|
|
5090
|
+
const graph = _optionalChain([server, 'access', _454 => _454.environments, 'optionalAccess', _455 => _455.client, 'optionalAccess', _456 => _456.moduleGraph]);
|
|
4302
5091
|
if (!graph) return;
|
|
4303
5092
|
for (const [id, module] of graph.idToModuleMap) {
|
|
4304
5093
|
if (_chunkE7QOEV5Zcjs.parseProgrammaticRouteModuleId.call(void 0, id)) graph.invalidateModule(module);
|
|
@@ -4308,26 +5097,26 @@ function generateProgrammaticClientRouteModuleForId(moduleId, root, renderer, cl
|
|
|
4308
5097
|
const parsed = _chunkE7QOEV5Zcjs.parseProgrammaticRouteModuleId.call(void 0, moduleId);
|
|
4309
5098
|
const routesFile = resolveRealModuleFile(parsed.filePath, root);
|
|
4310
5099
|
watchFile(routesFile);
|
|
4311
|
-
return
|
|
5100
|
+
return _chunkMZ4CRSY7cjs.generateProgrammaticClientRouteModule.call(void 0, {
|
|
4312
5101
|
kind: parsed.kind,
|
|
4313
5102
|
routePath: parsed.routePath,
|
|
4314
5103
|
routesFile,
|
|
4315
|
-
route: parsed.kind === "api" ? void 0 : _optionalChain([clientRoutes, 'optionalAccess',
|
|
4316
|
-
|
|
5104
|
+
route: parsed.kind === "api" ? void 0 : _optionalChain([clientRoutes, 'optionalAccess', _457 => _457.routes, 'access', _458 => _458.get, 'call', _459 => _459(
|
|
5105
|
+
_chunkMZ4CRSY7cjs.programmaticClientRouteKey.call(void 0, routesFile, parsed.kind, parsed.routePath)
|
|
4317
5106
|
)]),
|
|
4318
5107
|
rendererServer: renderer.server,
|
|
4319
5108
|
toImportSpecifier: (file) => toProgrammaticRouteImportSpecifier(file, root)
|
|
4320
5109
|
});
|
|
4321
5110
|
}
|
|
4322
5111
|
function resolveRealModuleFile(filePath, root) {
|
|
4323
|
-
const resolved = _nullishCoalesce(
|
|
5112
|
+
const resolved = _nullishCoalesce(_chunkMZ4CRSY7cjs.resolveModuleSourcePath.call(void 0, filePath, root), () => ( filePath));
|
|
4324
5113
|
try {
|
|
4325
5114
|
return _chunkQMNWKQL4cjs.toPosixPath.call(void 0, fs2.realpathSync(resolved));
|
|
4326
|
-
} catch (
|
|
5115
|
+
} catch (e28) {
|
|
4327
5116
|
return _chunkQMNWKQL4cjs.toPosixPath.call(void 0, resolved);
|
|
4328
5117
|
}
|
|
4329
5118
|
}
|
|
4330
|
-
function generateProgrammaticRouteModule(moduleId, root, renderer =
|
|
5119
|
+
function generateProgrammaticRouteModule(moduleId, root, renderer = _chunk67MZTLTFcjs.REACT_RENDERER) {
|
|
4331
5120
|
const parsed = _chunkE7QOEV5Zcjs.parseProgrammaticRouteModuleId.call(void 0, moduleId);
|
|
4332
5121
|
if (!parsed) {
|
|
4333
5122
|
return "";
|
|
@@ -4634,12 +5423,12 @@ async function parseRouteModuleProps(routeModule, input) {
|
|
|
4634
5423
|
}
|
|
4635
5424
|
const schemas = routeModule.__farmRouteSchemas;
|
|
4636
5425
|
const params = parseRouteModuleSchema(
|
|
4637
|
-
_optionalChain([schemas, 'optionalAccess',
|
|
5426
|
+
_optionalChain([schemas, 'optionalAccess', _460 => _460.params]),
|
|
4638
5427
|
input.props.params,
|
|
4639
5428
|
"params",
|
|
4640
5429
|
input.routePath
|
|
4641
5430
|
);
|
|
4642
|
-
const search = parseRouteModuleSchema(_optionalChain([schemas, 'optionalAccess',
|
|
5431
|
+
const search = parseRouteModuleSchema(_optionalChain([schemas, 'optionalAccess', _461 => _461.search]), input.search, "search", input.routePath);
|
|
4643
5432
|
return {
|
|
4644
5433
|
...input.props,
|
|
4645
5434
|
params,
|
|
@@ -4658,20 +5447,20 @@ function parseRouteModuleSchema(schema, value, label, routePath) {
|
|
|
4658
5447
|
throw new Error(`Invalid ${label} for route "${routePath}": ${message}`);
|
|
4659
5448
|
}
|
|
4660
5449
|
}
|
|
4661
|
-
function generateClientCode(integrationProviders = [], documentNavigationMatchers = [], docsSearchClientRuntime = EMPTY_FARM_DOCS_SEARCH_CLIENT_RUNTIME, devtoolsClientRuntime = "", plugins = [], root = process.cwd(), srcDir = "src", publicRuntimeConfig = void 0, docsAdapterReact, renderer =
|
|
4662
|
-
const providerClientCode =
|
|
5450
|
+
function generateClientCode(integrationProviders = [], documentNavigationMatchers = [], docsSearchClientRuntime = EMPTY_FARM_DOCS_SEARCH_CLIENT_RUNTIME, devtoolsClientRuntime = "", plugins = [], root = process.cwd(), srcDir = "src", publicRuntimeConfig = void 0, docsAdapterReact, renderer = _chunk67MZTLTFcjs.REACT_RENDERER, isolatedHydrationEnabled = false, trailingSlash = false, basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule, islandValues = false) {
|
|
5451
|
+
const providerClientCode = _chunkF36LS2C7cjs.generateFarmIntegrationProviderClientCode.call(void 0,
|
|
4663
5452
|
integrationProviders,
|
|
4664
5453
|
root,
|
|
4665
5454
|
_nullishCoalesce(renderer.componentExtensions, () => ( []))
|
|
4666
5455
|
);
|
|
4667
|
-
const clientPluginEntry =
|
|
5456
|
+
const clientPluginEntry = _chunkJSOCDYERcjs.generateFarmClientPluginEntryCode.call(void 0,
|
|
4668
5457
|
plugins,
|
|
4669
5458
|
root,
|
|
4670
5459
|
srcDir,
|
|
4671
5460
|
publicRuntimeConfig
|
|
4672
5461
|
);
|
|
4673
|
-
const appSetupPath =
|
|
4674
|
-
const rendererClientImports =
|
|
5462
|
+
const appSetupPath = _chunk67MZTLTFcjs.resolveFarmRendererAppSetup.call(void 0, root, renderer);
|
|
5463
|
+
const rendererClientImports = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) ? `import React from 'react'
|
|
4675
5464
|
import { hydrateRoot, createRoot } from 'react-dom/client'` : appSetupPath ? `import React, { hydrateRoot, createRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)}
|
|
4676
5465
|
import __farmAppSetup from ${JSON.stringify(_chunkQMNWKQL4cjs.toViteModuleId.call(void 0, appSetupPath, root))}
|
|
4677
5466
|
__farmConfigureApp(__farmAppSetup)` : `import React, { hydrateRoot, createRoot } from ${JSON.stringify(renderer.client)}`;
|
|
@@ -4712,7 +5501,7 @@ async function createFarmServerTreePageElement(source, pathname) {
|
|
|
4712
5501
|
return null;
|
|
4713
5502
|
}
|
|
4714
5503
|
}
|
|
4715
|
-
${islandValues ? `${
|
|
5504
|
+
${islandValues ? `${_chunkF36LS2C7cjs.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE}
|
|
4716
5505
|
let farmLastRouteState = null;
|
|
4717
5506
|
|
|
4718
5507
|
// A hot update to a layout tree's client module renders the route again.
|
|
@@ -5523,7 +6312,7 @@ async function loadLayoutComponents(layouts = [], params = {}, source) {
|
|
|
5523
6312
|
return loadedLayouts;
|
|
5524
6313
|
}
|
|
5525
6314
|
|
|
5526
|
-
${
|
|
6315
|
+
${_chunkF36LS2C7cjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
|
|
5527
6316
|
function wrapWithLoadedLayouts(element, loadedLayouts, params) {
|
|
5528
6317
|
let wrapped = element;
|
|
5529
6318
|
for (let index = loadedLayouts.length - 1; index >= 0; index--) {
|
|
@@ -5602,7 +6391,7 @@ async function buildWrappedHydrationElement(PageComponent, pageProps, layouts =
|
|
|
5602
6391
|
|
|
5603
6392
|
function hydrateFarmRoute(container, route) {
|
|
5604
6393
|
farmLastRouteState = route;
|
|
5605
|
-
${
|
|
6394
|
+
${_chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) ? "return hydrateRoot(container, route.element);" : "return route.layouts.length > 0 ? hydrateRoot(container, route.element, route) : hydrateRoot(container, route.element);"}
|
|
5606
6395
|
}
|
|
5607
6396
|
|
|
5608
6397
|
function renderFarmRoute(root, route) {
|
|
@@ -5808,14 +6597,11 @@ function readActiveLayoutPatterns() {
|
|
|
5808
6597
|
.filter(Boolean);
|
|
5809
6598
|
}
|
|
5810
6599
|
|
|
6600
|
+
${_chunkF36LS2C7cjs.FARM_NAVIGATION_SCRIPT_SOURCE}
|
|
6601
|
+
|
|
5811
6602
|
function activateFragmentScripts(root) {
|
|
5812
6603
|
for (const script of Array.from(root.querySelectorAll?.('script') || [])) {
|
|
5813
|
-
|
|
5814
|
-
for (const attribute of Array.from(script.attributes)) {
|
|
5815
|
-
freshScript.setAttribute(attribute.name, attribute.value);
|
|
5816
|
-
}
|
|
5817
|
-
freshScript.textContent = script.textContent || '';
|
|
5818
|
-
script.replaceWith(freshScript);
|
|
6604
|
+
script.replaceWith(createFarmNavigationScript(script));
|
|
5819
6605
|
}
|
|
5820
6606
|
}
|
|
5821
6607
|
|
|
@@ -5825,7 +6611,52 @@ function parseNavigationFragment(html) {
|
|
|
5825
6611
|
return template.content;
|
|
5826
6612
|
}
|
|
5827
6613
|
|
|
5828
|
-
|
|
6614
|
+
// Suspense content streams, so a fresh response holds its fallback where the live DOM holds the
|
|
6615
|
+
// result. Compare without it.
|
|
6616
|
+
function removeSuspenseContent(root) {
|
|
6617
|
+
const walker = document.createTreeWalker(root, NodeFilter.SHOW_COMMENT);
|
|
6618
|
+
const comments = [];
|
|
6619
|
+
while (walker.nextNode()) comments.push(walker.currentNode);
|
|
6620
|
+
let depth = 0;
|
|
6621
|
+
let start = null;
|
|
6622
|
+
for (const comment of comments) {
|
|
6623
|
+
if (comment.data === "$" || comment.data === "$?" || comment.data === "$!") {
|
|
6624
|
+
if (depth++ === 0) start = comment;
|
|
6625
|
+
} else if (comment.data === "/$" && depth > 0 && --depth === 0) {
|
|
6626
|
+
const range = document.createRange();
|
|
6627
|
+
range.setStartAfter(start);
|
|
6628
|
+
range.setEndBefore(comment);
|
|
6629
|
+
range.deleteContents();
|
|
6630
|
+
start.data = "$";
|
|
6631
|
+
}
|
|
6632
|
+
}
|
|
6633
|
+
}
|
|
6634
|
+
|
|
6635
|
+
// A layout's own server output, without what it wraps and without its islands, whose live DOM
|
|
6636
|
+
// always differs from fresh HTML.
|
|
6637
|
+
function getLayoutShell(root, patterns, index, find) {
|
|
6638
|
+
const shell = find(root, patterns[index])?.cloneNode(true);
|
|
6639
|
+
if (!shell) return null;
|
|
6640
|
+
const inner = index + 1 < patterns.length
|
|
6641
|
+
? find(shell, patterns[index + 1])
|
|
6642
|
+
: shell.querySelector('#__farm_page__');
|
|
6643
|
+
inner?.replaceChildren();
|
|
6644
|
+
removeSuspenseContent(shell);
|
|
6645
|
+
// Each island's props stay, without its id, so new props count as a change.
|
|
6646
|
+
shell.querySelectorAll('script').forEach((script) => {
|
|
6647
|
+
if (script.type !== 'f/props') return script.remove();
|
|
6648
|
+
Array.from(script.attributes).forEach((attribute) => {
|
|
6649
|
+
if (attribute.name !== 'type') script.removeAttribute(attribute.name);
|
|
6650
|
+
});
|
|
6651
|
+
});
|
|
6652
|
+
shell.querySelectorAll('f-island').forEach((island) => {
|
|
6653
|
+
island.replaceChildren();
|
|
6654
|
+
Array.from(island.attributes).forEach((attribute) => island.removeAttribute(attribute.name));
|
|
6655
|
+
});
|
|
6656
|
+
return shell.innerHTML;
|
|
6657
|
+
}
|
|
6658
|
+
|
|
6659
|
+
${islandValues ? _chunkF36LS2C7cjs.FARM_REFRESH_FIELDS_SOURCE : ""}function replaceNavigationBoundary(
|
|
5829
6660
|
container,
|
|
5830
6661
|
fragment,
|
|
5831
6662
|
currentPatterns,
|
|
@@ -5833,11 +6664,17 @@ function replaceNavigationBoundary(
|
|
|
5833
6664
|
refresh = false,
|
|
5834
6665
|
find = findLayoutBoundary,
|
|
5835
6666
|
) {
|
|
6667
|
+
// A refresh keeps the islands still on the page: the ones in streamed Suspense content too.
|
|
6668
|
+
if (refresh) revealFarmStreamedContent(fragment);
|
|
5836
6669
|
let sharedCount = 0;
|
|
5837
6670
|
while (
|
|
5838
6671
|
sharedCount < currentPatterns.length &&
|
|
5839
6672
|
sharedCount < nextPatterns.length &&
|
|
5840
|
-
currentPatterns[sharedCount] === nextPatterns[sharedCount]
|
|
6673
|
+
currentPatterns[sharedCount] === nextPatterns[sharedCount] &&
|
|
6674
|
+
// A refresh renders every layout again: start at the first one whose output changed.
|
|
6675
|
+
(!refresh ||
|
|
6676
|
+
getLayoutShell(container, currentPatterns, sharedCount, find) ===
|
|
6677
|
+
getLayoutShell(fragment, nextPatterns, sharedCount, find))
|
|
5841
6678
|
) {
|
|
5842
6679
|
sharedCount++;
|
|
5843
6680
|
}
|
|
@@ -5858,11 +6695,13 @@ function replaceNavigationBoundary(
|
|
|
5858
6695
|
activateFragmentScripts(container);
|
|
5859
6696
|
return container;
|
|
5860
6697
|
}
|
|
5861
|
-
|
|
6698
|
+
${islandValues ? `
|
|
6699
|
+
// A refresh renders the same layouts again: their fields keep what was typed, and the focus.
|
|
6700
|
+
const fields = refresh ? captureFarmServerFields(currentTarget) : null;` : ""}
|
|
5862
6701
|
${isolatedHydrationEnabled ? `${islandValues ? `// A refresh keeps the islands still on the page, with their state and new props.
|
|
5863
6702
|
if (refresh) farmIsolatedHydrationRuntime.carryOver(currentTarget, nextTarget);
|
|
5864
6703
|
` : ""}disposeFarmIsolatedClientBoundaries(currentTarget);` : ""}
|
|
5865
|
-
currentTarget.replaceWith(nextTarget);
|
|
6704
|
+
currentTarget.replaceWith(nextTarget);${islandValues ? "\n if (fields) restoreFarmServerFields(fields, nextTarget);" : ""}
|
|
5866
6705
|
activateFragmentScripts(nextTarget);
|
|
5867
6706
|
if (fragmentTreeRoot && fragmentTreeRoot !== nextTarget) fragmentTreeRoot.remove();
|
|
5868
6707
|
|
|
@@ -5872,7 +6711,17 @@ function replaceNavigationBoundary(
|
|
|
5872
6711
|
const support = document.createElement('div');
|
|
5873
6712
|
support.hidden = true;
|
|
5874
6713
|
support.dataset.farmFragmentSupport = 'true';
|
|
5875
|
-
|
|
6714
|
+
while (fragment.firstChild) {
|
|
6715
|
+
const node = fragment.firstChild;
|
|
6716
|
+
// React's staged Suspense content stays in the root, where a later flush of a streamed
|
|
6717
|
+
// navigation reveals it; React removes it then.
|
|
6718
|
+
if (node.nodeType === 1 && node.matches('div[hidden][id^="S:"]')) {
|
|
6719
|
+
container.appendChild(node);
|
|
6720
|
+
activateFragmentScripts(node);
|
|
6721
|
+
} else {
|
|
6722
|
+
support.appendChild(node);
|
|
6723
|
+
}
|
|
6724
|
+
}
|
|
5876
6725
|
document.body.appendChild(support);
|
|
5877
6726
|
activateFragmentScripts(support);
|
|
5878
6727
|
setTimeout(() => support.remove(), 0);
|
|
@@ -5880,7 +6729,7 @@ function replaceNavigationBoundary(
|
|
|
5880
6729
|
return nextTarget;
|
|
5881
6730
|
}
|
|
5882
6731
|
|
|
5883
|
-
${islandValues ? `${
|
|
6732
|
+
${islandValues ? `${_chunkF36LS2C7cjs.FARM_NAVIGATION_STREAM_READER_SOURCE}
|
|
5884
6733
|
|
|
5885
6734
|
// Islands mode navigates as the production client does: it fetches the page itself, names the
|
|
5886
6735
|
// layouts it shows by key (F-Layouts), and asks for flush markers (F-Stream), so the shell arrives
|
|
@@ -5938,7 +6787,8 @@ function farmDocumentNavigationRoute(pathname) {
|
|
|
5938
6787
|
}
|
|
5939
6788
|
|
|
5940
6789
|
async function fetchFarmNavigationDocument(path, context) {
|
|
5941
|
-
|
|
6790
|
+
// A prefetch reads the page whole for the router's cache, and leaves a page that streams alone.
|
|
6791
|
+
if (!context.prefetch) farmNavigationStreamGeneration++;
|
|
5942
6792
|
const url = new URL(path, window.location.href);
|
|
5943
6793
|
const match = farmDocumentNavigationRoute(url.pathname);
|
|
5944
6794
|
const container = document.getElementById('root');
|
|
@@ -5956,9 +6806,12 @@ async function fetchFarmNavigationDocument(path, context) {
|
|
|
5956
6806
|
redirect: 'manual',
|
|
5957
6807
|
headers: createFarmDeploymentRequestHeaders(deploymentId, {
|
|
5958
6808
|
Accept: 'text/html',
|
|
5959
|
-
|
|
6809
|
+
// A refresh arrives whole, like a transition: the islands it keeps are all in it.
|
|
6810
|
+
...(context.prefetch || context.refresh ? {} : { 'F-Stream': 'flush' }),
|
|
5960
6811
|
...getFarmIslandValueHeaders(),
|
|
5961
|
-
|
|
6812
|
+
// A prefetch names its layouts even when it keeps none: that marks it as a navigation,
|
|
6813
|
+
// which the server answers without loading.tsx.
|
|
6814
|
+
...(identities.length || context.prefetch ? { 'F-Layouts': JSON.stringify(identities) } : {}),
|
|
5962
6815
|
}),
|
|
5963
6816
|
});
|
|
5964
6817
|
if (isFarmDeploymentMismatchResponse(response, deploymentId)) {
|
|
@@ -5966,7 +6819,9 @@ async function fetchFarmNavigationDocument(path, context) {
|
|
|
5966
6819
|
window.dispatchEvent(new CustomEvent('farm:deployment-mismatch', { detail: error }));
|
|
5967
6820
|
throw error;
|
|
5968
6821
|
}
|
|
5969
|
-
// A redirect
|
|
6822
|
+
// A manual redirect hides its target, so page data answers this navigation and follows it.
|
|
6823
|
+
if (response.type === 'opaqueredirect') return null;
|
|
6824
|
+
// An error or anything but HTML: the router loads the document instead.
|
|
5970
6825
|
if (
|
|
5971
6826
|
!response.ok ||
|
|
5972
6827
|
!response.body ||
|
|
@@ -5979,10 +6834,11 @@ async function fetchFarmNavigationDocument(path, context) {
|
|
|
5979
6834
|
return { stream, doc, nextRoot: doc.getElementById('root') };
|
|
5980
6835
|
};
|
|
5981
6836
|
let result = await request(true);
|
|
5982
|
-
if (result.nextRoot && !fitsFarmSegment(container, result.nextRoot)) {
|
|
6837
|
+
if (result && result.nextRoot && !fitsFarmSegment(container, result.nextRoot)) {
|
|
5983
6838
|
result.stream.cancel?.();
|
|
5984
6839
|
result = await request(false);
|
|
5985
6840
|
}
|
|
6841
|
+
if (!result) return null;
|
|
5986
6842
|
if (!result.nextRoot) {
|
|
5987
6843
|
result.stream.cancel?.();
|
|
5988
6844
|
throw new Error('The page has no #root');
|
|
@@ -6342,7 +7198,13 @@ function farmIslandsOnlyDocument() {
|
|
|
6342
7198
|
// Islands mode hydrates the document, as production does, so islx also watches the islands
|
|
6343
7199
|
// that stream in after this runs. Not cancelled by a navigation: an island it removes is
|
|
6344
7200
|
// disposed with its DOM, and one in a layout it keeps still waits for its trigger.
|
|
7201
|
+
const hydrationSession = await farmClientRuntime.beginHydration({
|
|
7202
|
+
container: rootContainer || document.body,
|
|
7203
|
+
mode: 'hydrate',
|
|
7204
|
+
});
|
|
7205
|
+
// Each island reports and recovers its own failure, so this resolves once they are live.
|
|
6345
7206
|
await hydrateFarmIsolatedClientBoundaries(${islandValues ? "document" : "rootContainer"});
|
|
7207
|
+
await farmClientRuntime.completeHydration(hydrationSession);
|
|
6346
7208
|
// The rest of the document is static server HTML with nothing to hydrate, so
|
|
6347
7209
|
// stop holding its clicks and submits once the load-strategy islands are live.
|
|
6348
7210
|
// Deferred islands capture their own interactions, and held targets outside an
|
|
@@ -6562,10 +7424,10 @@ function generateClientManifest(bundle) {
|
|
|
6562
7424
|
return manifest;
|
|
6563
7425
|
}
|
|
6564
7426
|
async function defineConfig(config = {}) {
|
|
6565
|
-
const tailwindVitePlugin = await
|
|
7427
|
+
const tailwindVitePlugin = await _chunkJSOCDYERcjs.loadTailwindVitePlugin.call(void 0, );
|
|
6566
7428
|
const appRoot = path6.resolve(config.root || process.cwd());
|
|
6567
|
-
if (_optionalChain([config, 'access',
|
|
6568
|
-
const { config: layeredConfig } = await import("./layers-
|
|
7429
|
+
if (_optionalChain([config, 'access', _462 => _462.extends, 'optionalAccess', _463 => _463.length])) {
|
|
7430
|
+
const { config: layeredConfig } = await import("./layers-7P4RLKVX.cjs").then(
|
|
6569
7431
|
({ resolveFarmLayers }) => resolveFarmLayers(config, {
|
|
6570
7432
|
root: appRoot,
|
|
6571
7433
|
mode: process.env.NODE_ENV === "production" ? "production" : "development"
|
|
@@ -6573,12 +7435,12 @@ async function defineConfig(config = {}) {
|
|
|
6573
7435
|
);
|
|
6574
7436
|
config = layeredConfig;
|
|
6575
7437
|
}
|
|
6576
|
-
config.renderer =
|
|
6577
|
-
config.images =
|
|
6578
|
-
const rendererVitePlugins = await
|
|
7438
|
+
config.renderer = _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, config.renderer);
|
|
7439
|
+
config.images = _chunkF36LS2C7cjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, { root: appRoot, dev: true });
|
|
7440
|
+
const rendererVitePlugins = await _chunk67MZTLTFcjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, appRoot, {
|
|
6579
7441
|
ssr: true
|
|
6580
7442
|
});
|
|
6581
|
-
const reactRefreshPlugins =
|
|
7443
|
+
const reactRefreshPlugins = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) ? await _chunk65Y5SIBHcjs.createFarmReactRefreshPlugins.call(void 0, ) : [];
|
|
6582
7444
|
const nodeBuiltinStubs = {
|
|
6583
7445
|
"node:string_decoder": "data:text/javascript,export class StringDecoder { write(buf) { return ''; } end() { return ''; } }; export default StringDecoder;",
|
|
6584
7446
|
"node:buffer": "data:text/javascript,export const Buffer = { from: () => ({}), alloc: () => ({}), isBuffer: () => false }; export default { Buffer };",
|
|
@@ -6666,13 +7528,13 @@ async function defineConfig(config = {}) {
|
|
|
6666
7528
|
if (!serverStarted) {
|
|
6667
7529
|
serverStarted = true;
|
|
6668
7530
|
const elapsed = Date.now() - startTime;
|
|
6669
|
-
const address = _optionalChain([server, 'access',
|
|
7531
|
+
const address = _optionalChain([server, 'access', _464 => _464.httpServer, 'optionalAccess', _465 => _465.address, 'call', _466 => _466()]);
|
|
6670
7532
|
const resolvedPort = typeof address === "object" && address ? address.port : server.config.server.port || port || 3e3;
|
|
6671
7533
|
const hostConfig = server.config.server.host;
|
|
6672
7534
|
const isExposed = hostConfig === true || hostConfig === "0.0.0.0";
|
|
6673
7535
|
console.log("");
|
|
6674
7536
|
console.log(
|
|
6675
|
-
` ${pc.bold(pc.green("Farm.js"))} ${pc.dim(`v${
|
|
7537
|
+
` ${pc.bold(pc.green("Farm.js"))} ${pc.dim(`v${_chunkSQ6IWJ3Hcjs.FARM_VERSION}`)} ${pc.dim(`ready in ${elapsed}ms`)}`
|
|
6676
7538
|
);
|
|
6677
7539
|
console.log("");
|
|
6678
7540
|
console.log(
|
|
@@ -6706,7 +7568,7 @@ async function defineConfig(config = {}) {
|
|
|
6706
7568
|
plugins: [
|
|
6707
7569
|
// `farm dev --desktop`: only the desktop window gets an answer, as in the packaged app.
|
|
6708
7570
|
_chunk65Y5SIBHcjs.farmDesktopDevGuardPlugin.call(void 0, config.basePath),
|
|
6709
|
-
|
|
7571
|
+
_chunkF36LS2C7cjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
6710
7572
|
tailwindVitePlugin,
|
|
6711
7573
|
...rendererVitePlugins,
|
|
6712
7574
|
...reactRefreshPlugins,
|
|
@@ -6714,16 +7576,16 @@ async function defineConfig(config = {}) {
|
|
|
6714
7576
|
farmI18nClientBridgePlugin(),
|
|
6715
7577
|
farmServerOnlyEntriesPlugin(),
|
|
6716
7578
|
farmPlugin(config),
|
|
6717
|
-
|
|
7579
|
+
_chunkMZ4CRSY7cjs.farmEnvironmentFunctionsPlugin.call(void 0, config),
|
|
6718
7580
|
farmBrandingPlugin
|
|
6719
7581
|
],
|
|
6720
7582
|
customLogger: farmLogger,
|
|
6721
7583
|
clearScreen: false,
|
|
6722
7584
|
optimizeDeps: {
|
|
6723
|
-
...
|
|
6724
|
-
|
|
7585
|
+
..._chunkF36LS2C7cjs.createFarmClientOptimizeDepsConfig.call(void 0,
|
|
7586
|
+
_chunkF36LS2C7cjs.createFarmClientOptimizeDepsEntries.call(void 0,
|
|
6725
7587
|
appRoot,
|
|
6726
|
-
|
|
7588
|
+
_chunkMTBDJ326cjs.getFarmAppDirectories.call(void 0, { ...config, root: appRoot })
|
|
6727
7589
|
),
|
|
6728
7590
|
config.renderer
|
|
6729
7591
|
),
|
|
@@ -6763,8 +7625,8 @@ async function defineConfig(config = {}) {
|
|
|
6763
7625
|
dedupe: [...config.renderer.dedupe || []],
|
|
6764
7626
|
// Stub out problematic server-only modules during dev mode
|
|
6765
7627
|
alias: {
|
|
6766
|
-
...
|
|
6767
|
-
...
|
|
7628
|
+
..._chunkMTBDJ326cjs.getFarmLayerAliases.call(void 0, config.layers),
|
|
7629
|
+
..._chunkF36LS2C7cjs.createFarmSourceAlias.call(void 0, appRoot, config.srcDir),
|
|
6768
7630
|
// Nitro internals that should not be resolved in browser
|
|
6769
7631
|
"supports-color": "data:text/javascript,export default false; export const supportsColor = false; export const stdout = false; export const stderr = false;",
|
|
6770
7632
|
"@poppinss/dumper": "data:text/javascript,export default {};",
|