@farm.js/core 0.1.65 → 0.1.67
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-BFu9xHAi.d.ts} +1 -1
- package/dist/{agent-mcp.d-CO_ABmNK.d.mts → agent-mcp.d-DWyWkTSy.d.mts} +1 -1
- package/dist/agent-runtime.cjs +6 -5
- package/dist/agent-runtime.d.mts +6 -6
- package/dist/agent-runtime.d.ts +6 -6
- package/dist/agent-runtime.mjs +5 -4
- package/dist/analyzer-KVZGVY5Q.cjs +16 -0
- package/dist/{analyzer-PE33SK5W.mjs → analyzer-TTIIXXMQ.mjs} +3 -3
- 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 +59 -0
- package/dist/api/node.d.ts +59 -0
- package/dist/api/node.mjs +223 -0
- package/dist/api/route-manager.cjs +11 -11
- package/dist/api/route-manager.d.mts +10 -9
- package/dist/api/route-manager.d.ts +10 -9
- package/dist/api/route-manager.mjs +10 -10
- package/dist/api/runtime.cjs +11 -7
- package/dist/api/runtime.d.mts +7 -7
- package/dist/api/runtime.d.ts +7 -7
- 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 +11 -10
- package/dist/api.d.ts +11 -10
- package/dist/api.mjs +16 -12
- package/dist/{app-manifest.d-BpKxiU_E.d.mts → app-manifest.d-CRmjN5j9.d.mts} +1 -1
- package/dist/{app-manifest.d-DDmNkYQQ.d.ts → app-manifest.d-CwfhGrVR.d.ts} +1 -1
- package/dist/app-markdown.cjs +5 -5
- package/dist/app-markdown.d.mts +7 -7
- package/dist/app-markdown.d.ts +7 -7
- package/dist/app-markdown.mjs +4 -4
- package/dist/{app.d-x68Cwr0_.d.ts → app.d-BX9LVTiP.d.ts} +50 -9
- package/dist/{app.d-kuoVWhWM.d.mts → app.d-uBBUxwyV.d.mts} +50 -9
- package/dist/{chunk-V56632LA.cjs → chunk-22IWL4YD.cjs} +19 -5
- package/dist/{chunk-CZF4XIRZ.cjs → chunk-23PVOIPT.cjs} +3 -3
- 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-RVGSVQWT.mjs → chunk-3T5TLFCQ.mjs} +10 -5
- package/dist/{chunk-XBSKPLHF.cjs → chunk-3T7ALZJF.cjs} +2 -2
- package/dist/{chunk-JCEFKP5M.mjs → chunk-423SSBYQ.mjs} +6 -0
- package/dist/{chunk-7QVRWGBL.cjs → chunk-4DRINDGN.cjs} +319 -138
- package/dist/{chunk-O6L3YYPM.cjs → chunk-4E57QHPW.cjs} +8 -16
- package/dist/{chunk-WKPBIT5Q.cjs → chunk-4HGLJOXZ.cjs} +6 -6
- package/dist/{chunk-JGAE5XPL.cjs → chunk-4JX3M4C6.cjs} +2 -1
- package/dist/{chunk-CJNAUEVC.mjs → chunk-4QENVMG7.mjs} +1 -1
- package/dist/{chunk-IMK32ERL.cjs → chunk-556H7JCE.cjs} +65 -48
- package/dist/{chunk-OLIGNTWU.cjs → chunk-5NFQ6AZI.cjs} +7 -7
- package/dist/{chunk-6HRAK7I5.mjs → chunk-5OFNUETM.mjs} +8 -2
- package/dist/{chunk-TZVUF5JJ.mjs → chunk-5TA63JD3.mjs} +4 -4
- package/dist/{chunk-RD623KW4.cjs → chunk-67MZTLTF.cjs} +21 -3
- package/dist/chunk-6I4BFRE7.cjs +51 -0
- package/dist/{chunk-OSFIUSYK.cjs → chunk-6R53ZWX2.cjs} +7 -7
- package/dist/{chunk-MGKW5XZE.cjs → chunk-6SQZXRJ2.cjs} +7 -7
- package/dist/{chunk-WNXVWXG3.cjs → chunk-6V5YWI4W.cjs} +2 -2
- package/dist/{chunk-BM2LH2JM.mjs → chunk-6YBYX4K4.mjs} +13 -12
- package/dist/{chunk-X3XUZWRB.mjs → chunk-724MGMIL.mjs} +17 -3
- package/dist/{chunk-K5EW7GUU.mjs → chunk-7BIW7VCW.mjs} +13 -5
- package/dist/{chunk-HPP2II4Z.mjs → chunk-7PJARAQQ.mjs} +1 -1
- package/dist/{chunk-LEJDW34D.cjs → chunk-7PPLTD3P.cjs} +3 -3
- 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-ZEXE4TGY.mjs → chunk-AQDLVHNF.mjs} +230 -110
- package/dist/{chunk-NKRZLQUK.mjs → chunk-AQIO3RNL.mjs} +1 -1
- package/dist/chunk-AQIRXBBY.cjs +26 -0
- 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-V727H3RI.cjs → chunk-CCAUIBIS.cjs} +6 -0
- package/dist/{chunk-YN6BHOYY.cjs → chunk-CL52PD6D.cjs} +10 -3
- package/dist/{chunk-ZX2JHEWW.mjs → chunk-CO3YMZFD.mjs} +20 -9
- package/dist/{chunk-XURDCXNH.cjs → chunk-CSLHNBPS.cjs} +6 -6
- package/dist/{chunk-CNNBFGL5.cjs → chunk-DB2HSHQA.cjs} +14 -14
- package/dist/{chunk-XQSYOVCW.cjs → chunk-DBYNZIIQ.cjs} +13 -5
- package/dist/{chunk-32RPJAAS.cjs → chunk-DCXSIEFE.cjs} +40 -41
- package/dist/{chunk-D4MRNBVF.cjs → chunk-DGOFR7D5.cjs} +2 -2
- package/dist/{chunk-QTD6EMN2.mjs → chunk-DQ2DI3Y7.mjs} +11 -4
- package/dist/chunk-DXZ57EPE.mjs +375 -0
- package/dist/{chunk-SA7MLSP4.mjs → chunk-E3HDJCWF.mjs} +3 -3
- package/dist/{chunk-EFZGB7JC.cjs → chunk-E5UN4OWX.cjs} +1 -0
- package/dist/{chunk-HKNYNSOK.mjs → chunk-E6CD45JK.mjs} +30 -31
- 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-E552H232.cjs → chunk-F43OG25P.cjs} +1 -1
- package/dist/{chunk-UAQD67HM.mjs → chunk-F7JKVHU2.mjs} +1 -1
- package/dist/{chunk-QISW423S.cjs → chunk-FPBOAG6N.cjs} +2 -2
- package/dist/{chunk-2C5L5RPM.cjs → chunk-FT6KJHS3.cjs} +71 -38
- package/dist/{chunk-ES2LD2YD.mjs → chunk-GCRT6GJG.mjs} +18 -0
- package/dist/{chunk-5OJVKXFV.cjs → chunk-GDM3ZD2O.cjs} +10 -8
- package/dist/{chunk-EMDGXYUD.mjs → chunk-GJ7QVFAG.mjs} +16 -7
- package/dist/{chunk-TGSEVBPO.mjs → chunk-GJEC5S4V.mjs} +11 -0
- package/dist/{chunk-ZAUOOGER.mjs → chunk-GTV2ABO7.mjs} +218 -37
- package/dist/{chunk-72JSHQQQ.mjs → chunk-H37MDCPR.mjs} +1 -1
- package/dist/{chunk-HNAISJFD.cjs → chunk-HDPT6OYE.cjs} +9 -3
- package/dist/{chunk-25T5VXOE.mjs → chunk-HFHJJXSV.mjs} +106 -19
- package/dist/{chunk-ZNH6NR3H.cjs → chunk-HJZZSBVK.cjs} +2 -2
- package/dist/{chunk-A3G5IY2W.cjs → chunk-HM7AGSKU.cjs} +1 -1
- package/dist/{chunk-GL7N5UHF.cjs → chunk-HNVAZGQD.cjs} +20 -9
- package/dist/{chunk-GRBJ7VKH.mjs → chunk-HP2DQGQH.mjs} +1 -1
- package/dist/{chunk-E2TSYUHV.mjs → chunk-HRPTMX5C.mjs} +4 -4
- package/dist/{chunk-K7OZAVOI.mjs → chunk-IFR74W6S.mjs} +46 -13
- package/dist/{chunk-5A77OEIG.cjs → chunk-IHTDLCDJ.cjs} +5 -5
- package/dist/{chunk-VQJHT2ND.mjs → chunk-IRA2CZAY.mjs} +2 -2
- package/dist/{chunk-OYZXVBZP.cjs → chunk-IUKBPBM7.cjs} +2 -1
- package/dist/chunk-J6TZRYCO.cjs +22 -0
- package/dist/{chunk-WYAXRIYP.cjs → chunk-J7JHVCWA.cjs} +8 -8
- package/dist/chunk-JSOCDYER.cjs +375 -0
- package/dist/{chunk-YUW7F6SK.mjs → chunk-JVM3DKZE.mjs} +3 -3
- package/dist/{chunk-UPYIFH2H.cjs → chunk-JWLRBDDC.cjs} +2 -2
- package/dist/{chunk-BQWBHWEW.mjs → chunk-JWSI5WO4.mjs} +1 -1
- 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-3CCAICF7.cjs → chunk-KCY52OUQ.cjs} +4 -4
- package/dist/{chunk-EZ34EHQP.mjs → chunk-KI3MU7B5.mjs} +1 -1
- package/dist/{chunk-GHNW564E.mjs → chunk-KSZK34HU.mjs} +30 -10
- package/dist/{chunk-RFKTJTWZ.mjs → chunk-KWFNUODD.mjs} +2 -1
- package/dist/{chunk-ECKQFEX2.mjs → chunk-LENKRGBV.mjs} +8 -6
- package/dist/{chunk-C7DCMGC4.cjs → chunk-LPIZMU7D.cjs} +12 -12
- package/dist/{chunk-HEPJIKKQ.cjs → chunk-MCSRMEQV.cjs} +2 -2
- package/dist/{chunk-DQF3QLOH.mjs → chunk-ME7RVELR.mjs} +3 -2
- package/dist/{chunk-3KJPIO5D.cjs → chunk-N5DQMOAG.cjs} +589 -678
- package/dist/{chunk-O4F3JUST.mjs → chunk-NDDRTFN4.mjs} +4 -0
- package/dist/{chunk-CBOEJ5Z4.cjs → chunk-OB3IFUK6.cjs} +133 -46
- package/dist/{chunk-R62SF5R4.mjs → chunk-OB45EAQL.mjs} +6 -1
- 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-IP2KHSGF.mjs → chunk-P2NBQ5JI.mjs} +57 -4
- package/dist/{chunk-ZQQK4U66.cjs → chunk-PDFFYZAT.cjs} +72 -19
- package/dist/{chunk-GSVJ3IIF.cjs → chunk-PHCJJJZV.cjs} +2 -2
- package/dist/{chunk-EVMXPJCB.mjs → chunk-PKMUQ7LM.mjs} +2 -1
- package/dist/{chunk-YD4J37RN.cjs → chunk-PL6RTBDE.cjs} +30 -19
- package/dist/{chunk-OAJOQU5J.mjs → chunk-PLJKJJ2H.mjs} +82 -63
- package/dist/{chunk-WMTBBQHY.cjs → chunk-PPX7UOFY.cjs} +271 -151
- package/dist/{chunk-6XQSPIN6.cjs → chunk-PWKAX5MS.cjs} +13 -3
- package/dist/{chunk-7XGWBPQQ.cjs → chunk-Q37INCXG.cjs} +13 -8
- package/dist/{chunk-T4M52BA5.cjs → chunk-Q5UX55YA.cjs} +1457 -612
- package/dist/{chunk-53ZCZ46B.cjs → chunk-QGQP6QKO.cjs} +4 -3
- package/dist/{chunk-TZOGZKI7.cjs → chunk-QITSS4TD.cjs} +1381 -626
- package/dist/{chunk-4ZJ5C7UJ.cjs → chunk-QIXEU2WV.cjs} +19 -10
- package/dist/{chunk-HCGWDRZO.mjs → chunk-QJVW76JG.mjs} +17 -6
- package/dist/{chunk-FJWN7RV4.cjs → chunk-QO43L7Z4.cjs} +38 -8
- package/dist/{chunk-ZIHWAN55.cjs → chunk-RE5E2G5S.cjs} +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-E4RDMG3K.mjs → chunk-TEG6HJVF.mjs} +4 -4
- package/dist/{chunk-WAY6LOQH.mjs → chunk-TEJ67GD2.mjs} +1 -1
- package/dist/{chunk-ZNXTU4YH.mjs → chunk-TM2E623I.mjs} +1 -0
- package/dist/{chunk-IFTGERT3.mjs → chunk-TTXIITYA.mjs} +49 -0
- package/dist/{chunk-ZFWYCVKS.mjs → chunk-TY5KCYDE.mjs} +22 -4
- package/dist/{chunk-W2ZXMMHA.mjs → chunk-UHE5JUKB.mjs} +1 -1
- package/dist/{chunk-6X5NKNBE.mjs → chunk-UHNSY2PQ.mjs} +1304 -459
- package/dist/{chunk-UJ3R2AH2.cjs → chunk-UPOYKX4S.cjs} +5 -5
- package/dist/{chunk-2DLGV2ZG.mjs → chunk-UTUS6JUH.mjs} +1 -21
- package/dist/{chunk-Q75QPLBA.mjs → chunk-V5MQMQ2P.mjs} +1 -1
- package/dist/{chunk-TRIDJQ6A.cjs → chunk-V5RTHYJB.cjs} +30 -10
- package/dist/{chunk-QHRCR44V.mjs → chunk-VK54PDQ6.mjs} +25 -5
- package/dist/{chunk-LQNW3ABP.cjs → chunk-VX2HZGC7.cjs} +14 -14
- package/dist/{chunk-2L54YV25.mjs → chunk-WDD5CTZW.mjs} +49 -32
- package/dist/{chunk-7GYCZRTH.mjs → chunk-WGHY3OL5.mjs} +355 -444
- package/dist/{chunk-A2MN5PQJ.mjs → chunk-WMLSZAKN.mjs} +9 -9
- 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-Z7P2BTZ3.cjs → chunk-XGTFLG73.cjs} +30 -12
- package/dist/{chunk-VHHLKIDZ.mjs → chunk-XNZWMXCF.mjs} +1090 -335
- package/dist/{chunk-FIR62CR3.mjs → chunk-XUES6OET.mjs} +1 -1
- package/dist/{chunk-XCXHQBMM.mjs → chunk-Y2LU4LE5.mjs} +1 -1
- package/dist/{chunk-5J45H65F.mjs → chunk-Y5LEPEVH.mjs} +1 -1
- 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-UYRI6U3P.mjs → chunk-YQYTQJZN.mjs} +3 -2
- package/dist/{chunk-X4K7TYN6.cjs → chunk-YVTS3S3F.cjs} +24 -23
- package/dist/{chunk-72KABRWN.mjs → chunk-ZJGFAW5U.mjs} +5 -3
- package/dist/{chunk-TNBJ4LZG.mjs → chunk-ZPKJPM7K.mjs} +4 -4
- 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-CDRvRmbU.d.mts} +2 -2
- package/dist/{client-component.d-D8VcypQA.d.ts → client-component.d-DWRKyAp5.d.ts} +2 -2
- package/dist/client-plugins.cjs +2 -2
- package/dist/{client-plugins.d-D4-6hNx7.d.mts → client-plugins.d-BNILjfX3.d.mts} +94 -140
- package/dist/{client-plugins.d-CXElzotB.d.ts → client-plugins.d-CrKZiNSN.d.ts} +94 -140
- package/dist/client-plugins.d.mts +6 -6
- package/dist/client-plugins.d.ts +6 -6
- package/dist/client-plugins.mjs +1 -1
- package/dist/client.cjs +11 -9
- package/dist/client.d.mts +13 -13
- package/dist/client.d.ts +13 -13
- 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 +6 -6
- package/dist/config.d.ts +6 -6
- 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 +2 -2
- package/dist/deployment.mjs +1 -1
- package/dist/desktop.d.mts +7 -7
- package/dist/desktop.d.ts +7 -7
- package/dist/{devtools-SGYOG36E.cjs → devtools-RZVT4JVN.cjs} +36 -32
- package/dist/{devtools-PUVZB3F2.mjs → devtools-UFQYT3VA.mjs} +31 -27
- package/dist/docs.cjs +26 -25
- package/dist/docs.d.mts +20 -8
- package/dist/docs.d.ts +20 -8
- package/dist/docs.mjs +25 -24
- package/dist/env-types.cjs +3 -3
- package/dist/env-types.mjs +2 -2
- package/dist/environment/vite.cjs +5 -5
- package/dist/environment/vite.mjs +4 -4
- 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 +143 -128
- package/dist/{index.d-SSgYDv4D.d.mts → index.d-Bdm6866n.d.mts} +1 -1
- package/dist/{index.d-A_x10zGS.d.ts → index.d-Dey5T14f.d.ts} +1 -1
- package/dist/index.d.mts +31 -82
- package/dist/index.d.ts +31 -82
- package/dist/index.mjs +214 -199
- package/dist/{integration-orm-52GPGTHO.cjs → integrations/orm.cjs} +5 -5
- package/dist/integrations/orm.d.mts +33 -0
- package/dist/integrations/orm.d.ts +33 -0
- package/dist/{integration-orm-CO23MSFE.mjs → integrations/orm.mjs} +5 -5
- package/dist/integrations.cjs +6 -5
- package/dist/integrations.d.mts +6 -6
- package/dist/integrations.d.ts +6 -6
- package/dist/integrations.mjs +5 -4
- package/dist/internal/app-markdown-runtime.cjs +4 -4
- package/dist/internal/app-markdown-runtime.d.mts +17 -8
- package/dist/internal/app-markdown-runtime.d.ts +17 -8
- package/dist/internal/app-markdown-runtime.mjs +3 -3
- package/dist/internal/build-runtime.cjs +70 -68
- package/dist/internal/build-runtime.d.mts +8 -8
- package/dist/internal/build-runtime.d.ts +8 -8
- package/dist/internal/build-runtime.mjs +69 -67
- package/dist/internal/cli-runtime.cjs +45 -44
- package/dist/internal/cli-runtime.mjs +44 -43
- package/dist/internal/client-error-overlay.cjs +6 -6
- package/dist/internal/client-error-overlay.mjs +2 -2
- package/dist/internal/client-runtime.cjs +60 -6
- package/dist/internal/client-runtime.d.mts +40 -11
- package/dist/internal/client-runtime.d.ts +40 -11
- package/dist/internal/client-runtime.mjs +58 -4
- package/dist/internal/compression-runtime.d.mts +6 -6
- package/dist/internal/compression-runtime.d.ts +6 -6
- package/dist/internal/config-runtime.cjs +25 -24
- package/dist/internal/config-runtime.d.mts +9 -9
- package/dist/internal/config-runtime.d.ts +9 -9
- package/dist/internal/config-runtime.mjs +24 -23
- 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/infra-analytics-runtime.cjs +11 -11
- package/dist/internal/infra-analytics-runtime.mjs +9 -9
- 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 +6 -6
- package/dist/internal/native-server-fns.mjs +5 -5
- package/dist/internal/product-telemetry-runtime.cjs +3 -3
- package/dist/internal/product-telemetry-runtime.mjs +2 -2
- package/dist/internal/production-runtime.cjs +54 -40
- package/dist/internal/production-runtime.d.mts +23 -15
- package/dist/internal/production-runtime.d.ts +23 -15
- package/dist/internal/production-runtime.mjs +69 -55
- package/dist/internal/react-cache.cjs +3 -3
- package/dist/internal/react-cache.mjs +1 -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 +6 -6
- package/dist/markdown.d.ts +6 -6
- package/dist/markdown.mjs +6 -2
- package/dist/middleware.cjs +10 -10
- package/dist/middleware.d.mts +8 -8
- package/dist/middleware.d.ts +8 -8
- package/dist/middleware.mjs +9 -9
- package/dist/mobile.d.mts +4 -4
- package/dist/mobile.d.ts +4 -4
- package/dist/mount.d-BP0nLYQO.d.mts +38 -0
- package/dist/mount.d-CkiPky_F.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-HE2FLS72.cjs → native-tree-W2SSJB3Y.cjs} +5 -5
- package/dist/{native-tree-YF2DSPKM.mjs → native-tree-Y5YQANW7.mjs} +4 -4
- package/dist/{navigation-delegate.d-DQVYKoaZ.d.mts → navigation-delegate.d-CdBP-hkZ.d.mts} +1 -1
- package/dist/{navigation-delegate.d-GghbHJuK.d.ts → navigation-delegate.d-DchcGzAQ.d.ts} +1 -1
- package/dist/navigation.cjs +8 -7
- package/dist/navigation.d.mts +9 -9
- package/dist/navigation.d.ts +9 -9
- package/dist/navigation.mjs +7 -6
- package/dist/{nitro-DD4QCA66.mjs → nitro-55YOZWRA.mjs} +11 -11
- package/dist/{nitro-VRDX2H4M.cjs → nitro-EEX2J3KB.cjs} +13 -13
- package/dist/{plugin-53SY5YBS.mjs → plugin-SAS22JL7.mjs} +4 -3
- package/dist/{plugin-HZIBL3DW.cjs → plugin-WIU4GDD4.cjs} +5 -4
- package/dist/plugin.cjs +61 -59
- package/dist/plugin.d.mts +8 -8
- package/dist/plugin.d.ts +8 -8
- package/dist/plugin.mjs +60 -58
- package/dist/{port-UFUZL6RI.mjs → port-CLL4BC4O.mjs} +1 -1
- package/dist/{port-VTLHPZOI.cjs → port-HASZTQGY.cjs} +9 -9
- package/dist/{production-runtime.d-Bzns3NW9.d.ts → production-runtime.d-Dou_Htas.d.ts} +1 -1
- package/dist/{production-runtime.d-DiFa5vHW.d.mts → production-runtime.d-VwsBzIee.d.mts} +1 -1
- package/dist/query/client.cjs +9 -7
- package/dist/query/client.mjs +5 -3
- package/dist/{render-plan.d-CL_Ikfg_.d.ts → render-plan.d-D8UakAIk.d.ts} +1 -1
- package/dist/{render-plan.d-CcF0MeCf.d.mts → render-plan.d-LKymStDJ.d.mts} +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 +2 -2
- package/dist/renderer/react/server.mjs +3 -3
- package/dist/renderer-client.cjs +8 -6
- package/dist/renderer-client.d.mts +9 -9
- package/dist/renderer-client.d.ts +9 -9
- package/dist/renderer-client.mjs +5 -3
- package/dist/renderer.cjs +6 -2
- package/dist/renderer.d.mts +20 -2
- package/dist/renderer.d.ts +20 -2
- package/dist/renderer.mjs +5 -1
- package/dist/request.cjs +2 -2
- package/dist/{request.d-B1RnTLri.d.ts → request.d-B928QjWy.d.ts} +1 -1
- package/dist/{request.d-DarDOCk9.d.mts → request.d-KG-4d2eG.d.mts} +1 -1
- package/dist/request.d.mts +7 -7
- package/dist/request.d.ts +7 -7
- package/dist/request.mjs +1 -1
- package/dist/{route-rendering.d-BTUYCIj4.d.ts → route-rendering.d-DoEe_w9t.d.ts} +1 -1
- package/dist/{route-rendering.d-D_2Ual0-.d.mts → route-rendering.d-NIHQeb4m.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-Cuv1jntg.d.mts → router.d-B8PkJSGp.d.mts} +1 -1
- package/dist/{router.d-CMANF6da.d.ts → router.d-DYnRHQwz.d.ts} +1 -1
- package/dist/routes.cjs +3 -3
- package/dist/{routes.d-c2HKfrfL.d.mts → routes.d-DgZ_jgGG.d.mts} +1 -1
- package/dist/{routes.d-B6yFe6jm.d.ts → routes.d-uUBZyWoK.d.ts} +1 -1
- package/dist/routes.d.mts +6 -6
- package/dist/routes.d.ts +6 -6
- package/dist/routes.mjs +2 -2
- package/dist/{rsc-pipeline-T3PWURLJ.mjs → rsc-pipeline-4OJ5ZQNZ.mjs} +26 -25
- package/dist/{rsc-pipeline-V4ANLRAA.cjs → rsc-pipeline-7K5H2RPH.cjs} +27 -26
- package/dist/{runtime-LRIQ3XH7.mjs → runtime-U7O3HZOZ.mjs} +62 -36
- package/dist/{runtime-5AROV2C3.cjs → runtime-X52Q7JFR.cjs} +72 -46
- package/dist/{runtime.d-wvh4ngU0.d.mts → runtime.d-BxQIzwfy.d.mts} +11 -3
- package/dist/{runtime.d-C3RQUj6_.d.ts → runtime.d-DP7mEkEF.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-plugins.cjs +7 -7
- package/dist/server-plugins.d.mts +16 -10
- package/dist/server-plugins.d.ts +16 -10
- 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 +160 -120
- package/dist/server.d.mts +20 -14
- package/dist/server.d.ts +20 -14
- package/dist/server.mjs +138 -98
- package/dist/{spa-router.d-WU_qS5gJ.d.mts → spa-router.d-BgHPVMhz.d.mts} +15 -5
- package/dist/{spa-router.d-m8H_Kl_B.d.ts → spa-router.d-DsFDHTsv.d.ts} +15 -5
- package/dist/testing.cjs +17 -17
- package/dist/testing.d.mts +6 -6
- package/dist/testing.d.ts +6 -6
- package/dist/testing.mjs +13 -13
- package/dist/theme/server.cjs +3 -3
- package/dist/theme/server.mjs +2 -2
- package/dist/{utils.d-W9IiEqmW.d.mts → utils.d-BKyKDBR1.d.mts} +1 -1
- package/dist/{utils.d-C9dQD5Zg.d.ts → utils.d-zxAVcf_V.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +63 -61
- package/dist/vite.d.mts +32 -12
- package/dist/vite.d.ts +32 -12
- package/dist/vite.mjs +62 -60
- package/dist/workflows.cjs +4 -4
- package/dist/workflows.mjs +3 -3
- package/package.json +31 -1
- package/dist/analyzer-GHWK46LX.cjs +0 -16
- package/dist/chunk-5YPBFMBN.cjs +0 -19
- 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/manager-2LUKNX2N.cjs +0 -14
- /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
|
@@ -6,10 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkE5UN4OWXcjs = require('./chunk-E5UN4OWX.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var _chunkMF3IA2AWcjs = require('./chunk-MF3IA2AW.cjs');
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
|
|
@@ -19,26 +18,27 @@ var _chunkMF3IA2AWcjs = require('./chunk-MF3IA2AW.cjs');
|
|
|
19
18
|
|
|
20
19
|
|
|
21
20
|
|
|
21
|
+
var _chunk4IHMHFQBcjs = require('./chunk-4IHMHFQB.cjs');
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _chunkMF3IA2AWcjs = require('./chunk-MF3IA2AW.cjs');
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
var _chunkVM57CK74cjs = require('./chunk-VM57CK74.cjs');
|
|
28
27
|
|
|
28
|
+
var _chunk23PVOIPTcjs = require('./chunk-23PVOIPT.cjs');
|
|
29
29
|
|
|
30
|
-
var _chunk4BS3HSY7cjs = require('./chunk-4BS3HSY7.cjs');
|
|
31
30
|
|
|
31
|
+
var _chunkVM57CK74cjs = require('./chunk-VM57CK74.cjs');
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
var
|
|
34
|
+
var _chunk4BS3HSY7cjs = require('./chunk-4BS3HSY7.cjs');
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
var
|
|
41
|
+
var _chunkDCXSIEFEcjs = require('./chunk-DCXSIEFE.cjs');
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
|
|
@@ -50,7 +50,7 @@ var _chunk32RPJAAScjs = require('./chunk-32RPJAAS.cjs');
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
var
|
|
53
|
+
var _chunkPPX7UOFYcjs = require('./chunk-PPX7UOFY.cjs');
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
|
|
@@ -58,7 +58,7 @@ var _chunkWMTBBQHYcjs = require('./chunk-WMTBBQHY.cjs');
|
|
|
58
58
|
var _chunkDZZHTMWMcjs = require('./chunk-DZZHTMWM.cjs');
|
|
59
59
|
|
|
60
60
|
|
|
61
|
-
var
|
|
61
|
+
var _chunk6R53ZWX2cjs = require('./chunk-6R53ZWX2.cjs');
|
|
62
62
|
|
|
63
63
|
|
|
64
64
|
var _chunkV3UOEWCBcjs = require('./chunk-V3UOEWCB.cjs');
|
|
@@ -67,7 +67,7 @@ var _chunkV3UOEWCBcjs = require('./chunk-V3UOEWCB.cjs');
|
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
|
|
70
|
-
var
|
|
70
|
+
var _chunk556H7JCEcjs = require('./chunk-556H7JCE.cjs');
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
var _chunkBRWIVOV4cjs = require('./chunk-BRWIVOV4.cjs');
|
|
@@ -99,19 +99,19 @@ var _chunkOCS3PSYRcjs = require('./chunk-OCS3PSYR.cjs');
|
|
|
99
99
|
|
|
100
100
|
|
|
101
101
|
|
|
102
|
+
var _chunkN5DQMOAGcjs = require('./chunk-N5DQMOAG.cjs');
|
|
102
103
|
|
|
103
|
-
var _chunk3KJPIO5Dcjs = require('./chunk-3KJPIO5D.cjs');
|
|
104
104
|
|
|
105
105
|
|
|
106
|
-
var
|
|
106
|
+
var _chunkJSOCDYERcjs = require('./chunk-JSOCDYER.cjs');
|
|
107
107
|
|
|
108
108
|
|
|
109
|
-
var
|
|
109
|
+
var _chunkWUTFJOV7cjs = require('./chunk-WUTFJOV7.cjs');
|
|
110
110
|
|
|
111
111
|
|
|
112
112
|
|
|
113
113
|
|
|
114
|
-
var
|
|
114
|
+
var _chunkYVTS3S3Fcjs = require('./chunk-YVTS3S3F.cjs');
|
|
115
115
|
|
|
116
116
|
|
|
117
117
|
|
|
@@ -124,7 +124,7 @@ var _chunkX4K7TYN6cjs = require('./chunk-X4K7TYN6.cjs');
|
|
|
124
124
|
|
|
125
125
|
|
|
126
126
|
|
|
127
|
-
var
|
|
127
|
+
var _chunkUPOYKX4Scjs = require('./chunk-UPOYKX4S.cjs');
|
|
128
128
|
|
|
129
129
|
|
|
130
130
|
var _chunk3HLQTOVUcjs = require('./chunk-3HLQTOVU.cjs');
|
|
@@ -138,15 +138,15 @@ var _chunk47JV57DAcjs = require('./chunk-47JV57DA.cjs');
|
|
|
138
138
|
|
|
139
139
|
|
|
140
140
|
|
|
141
|
-
var
|
|
141
|
+
var _chunkLPIZMU7Dcjs = require('./chunk-LPIZMU7D.cjs');
|
|
142
142
|
|
|
143
143
|
|
|
144
144
|
|
|
145
145
|
|
|
146
|
-
var
|
|
146
|
+
var _chunkX3MHKLCOcjs = require('./chunk-X3MHKLCO.cjs');
|
|
147
147
|
|
|
148
148
|
|
|
149
|
-
var
|
|
149
|
+
var _chunk6V5YWI4Wcjs = require('./chunk-6V5YWI4W.cjs');
|
|
150
150
|
|
|
151
151
|
|
|
152
152
|
var _chunk4EBC7EMWcjs = require('./chunk-4EBC7EMW.cjs');
|
|
@@ -163,7 +163,8 @@ var _chunk4EBC7EMWcjs = require('./chunk-4EBC7EMW.cjs');
|
|
|
163
163
|
|
|
164
164
|
|
|
165
165
|
|
|
166
|
-
|
|
166
|
+
|
|
167
|
+
var _chunk4DRINDGNcjs = require('./chunk-4DRINDGN.cjs');
|
|
167
168
|
|
|
168
169
|
|
|
169
170
|
|
|
@@ -174,14 +175,14 @@ var _chunkSM2SYWARcjs = require('./chunk-SM2SYWAR.cjs');
|
|
|
174
175
|
var _chunkERMUL73Lcjs = require('./chunk-ERMUL73L.cjs');
|
|
175
176
|
|
|
176
177
|
|
|
177
|
-
var
|
|
178
|
+
var _chunk22IWL4YDcjs = require('./chunk-22IWL4YD.cjs');
|
|
178
179
|
|
|
179
180
|
|
|
180
181
|
|
|
181
182
|
var _chunk6JHZPB52cjs = require('./chunk-6JHZPB52.cjs');
|
|
182
183
|
|
|
183
184
|
|
|
184
|
-
var
|
|
185
|
+
var _chunkRE5E2G5Scjs = require('./chunk-RE5E2G5S.cjs');
|
|
185
186
|
|
|
186
187
|
|
|
187
188
|
var _chunk5Y2P454Ocjs = require('./chunk-5Y2P454O.cjs');
|
|
@@ -193,51 +194,52 @@ var _chunk5Y2P454Ocjs = require('./chunk-5Y2P454O.cjs');
|
|
|
193
194
|
|
|
194
195
|
|
|
195
196
|
|
|
196
|
-
var _chunkRD623KW4cjs = require('./chunk-RD623KW4.cjs');
|
|
197
197
|
|
|
198
|
+
var _chunk67MZTLTFcjs = require('./chunk-67MZTLTF.cjs');
|
|
198
199
|
|
|
199
|
-
var _chunk3EIPOTZVcjs = require('./chunk-3EIPOTZV.cjs');
|
|
200
200
|
|
|
201
201
|
|
|
202
|
-
var _chunk7XGWBPQQcjs = require('./chunk-7XGWBPQQ.cjs');
|
|
203
202
|
|
|
204
203
|
|
|
204
|
+
var _chunkYAEN3L2Fcjs = require('./chunk-YAEN3L2F.cjs');
|
|
205
205
|
|
|
206
|
-
var _chunk2HW5LWAHcjs = require('./chunk-2HW5LWAH.cjs');
|
|
207
206
|
|
|
208
|
-
|
|
209
|
-
var _chunk2C5L5RPMcjs = require('./chunk-2C5L5RPM.cjs');
|
|
207
|
+
var _chunk4P5634G6cjs = require('./chunk-4P5634G6.cjs');
|
|
210
208
|
|
|
211
209
|
|
|
210
|
+
var _chunk3EIPOTZVcjs = require('./chunk-3EIPOTZV.cjs');
|
|
212
211
|
|
|
213
|
-
var _chunk3CCAICF7cjs = require('./chunk-3CCAICF7.cjs');
|
|
214
212
|
|
|
213
|
+
var _chunkQ37INCXGcjs = require('./chunk-Q37INCXG.cjs');
|
|
215
214
|
|
|
216
215
|
|
|
217
216
|
|
|
217
|
+
var _chunk2HW5LWAHcjs = require('./chunk-2HW5LWAH.cjs');
|
|
218
218
|
|
|
219
|
-
var _chunkBT4SEFLCcjs = require('./chunk-BT4SEFLC.cjs');
|
|
220
219
|
|
|
220
|
+
var _chunkFT6KJHS3cjs = require('./chunk-FT6KJHS3.cjs');
|
|
221
221
|
|
|
222
|
-
var _chunk4P5634G6cjs = require('./chunk-4P5634G6.cjs');
|
|
223
222
|
|
|
224
223
|
|
|
225
|
-
var
|
|
224
|
+
var _chunkKCY52OUQcjs = require('./chunk-KCY52OUQ.cjs');
|
|
226
225
|
|
|
227
226
|
|
|
228
227
|
|
|
229
|
-
var
|
|
228
|
+
var _chunkBDYM2TN3cjs = require('./chunk-BDYM2TN3.cjs');
|
|
230
229
|
|
|
231
230
|
|
|
232
231
|
var _chunkZOYKJBP5cjs = require('./chunk-ZOYKJBP5.cjs');
|
|
233
232
|
|
|
234
233
|
|
|
234
|
+
var _chunkJMYXO572cjs = require('./chunk-JMYXO572.cjs');
|
|
235
|
+
|
|
236
|
+
|
|
235
237
|
|
|
236
238
|
|
|
237
239
|
var _chunkMHLNWRCJcjs = require('./chunk-MHLNWRCJ.cjs');
|
|
238
240
|
|
|
239
241
|
|
|
240
|
-
var
|
|
242
|
+
var _chunkOFBLGH6Vcjs = require('./chunk-OFBLGH6V.cjs');
|
|
241
243
|
|
|
242
244
|
|
|
243
245
|
var _chunkBBPDJGCUcjs = require('./chunk-BBPDJGCU.cjs');
|
|
@@ -252,7 +254,7 @@ var _chunkKORZ6PREcjs = require('./chunk-KORZ6PRE.cjs');
|
|
|
252
254
|
|
|
253
255
|
|
|
254
256
|
|
|
255
|
-
var
|
|
257
|
+
var _chunkIUKBPBM7cjs = require('./chunk-IUKBPBM7.cjs');
|
|
256
258
|
|
|
257
259
|
|
|
258
260
|
|
|
@@ -264,13 +266,17 @@ var _chunkQMNWKQL4cjs = require('./chunk-QMNWKQL4.cjs');
|
|
|
264
266
|
var _chunk2OF5RPVUcjs = require('./chunk-2OF5RPVU.cjs');
|
|
265
267
|
|
|
266
268
|
|
|
267
|
-
var
|
|
269
|
+
var _chunkHM7AGSKUcjs = require('./chunk-HM7AGSKU.cjs');
|
|
270
|
+
|
|
268
271
|
|
|
272
|
+
var _chunkF43OG25Pcjs = require('./chunk-F43OG25P.cjs');
|
|
269
273
|
|
|
270
|
-
var _chunkE552H232cjs = require('./chunk-E552H232.cjs');
|
|
271
274
|
|
|
275
|
+
var _chunkHDPT6OYEcjs = require('./chunk-HDPT6OYE.cjs');
|
|
272
276
|
|
|
273
|
-
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
var _chunkD22BUQKWcjs = require('./chunk-D22BUQKW.cjs');
|
|
274
280
|
|
|
275
281
|
|
|
276
282
|
var _chunkYTVSWXEZcjs = require('./chunk-YTVSWXEZ.cjs');
|
|
@@ -368,13 +374,23 @@ function sanitizeCompiledValue(value, absolutePaths) {
|
|
|
368
374
|
return sanitized;
|
|
369
375
|
}
|
|
370
376
|
async function compileResponse(response, absolutePaths) {
|
|
377
|
+
const headers = Array.from(response.headers.entries()).map(([key, value]) => [
|
|
378
|
+
key,
|
|
379
|
+
sanitizeCompiledValue(value, absolutePaths)
|
|
380
|
+
]);
|
|
381
|
+
if (/^image\/(?!svg)/i.test(response.headers.get("content-type") || "")) {
|
|
382
|
+
return {
|
|
383
|
+
status: response.status,
|
|
384
|
+
statusText: response.statusText,
|
|
385
|
+
headers,
|
|
386
|
+
body: Buffer.from(await response.arrayBuffer()).toString("base64"),
|
|
387
|
+
bodyEncoding: "base64"
|
|
388
|
+
};
|
|
389
|
+
}
|
|
371
390
|
return {
|
|
372
391
|
status: response.status,
|
|
373
392
|
statusText: response.statusText,
|
|
374
|
-
headers
|
|
375
|
-
key,
|
|
376
|
-
sanitizeCompiledValue(value, absolutePaths)
|
|
377
|
-
]),
|
|
393
|
+
headers,
|
|
378
394
|
body: sanitizeCompiledValue(await response.text(), absolutePaths)
|
|
379
395
|
};
|
|
380
396
|
}
|
|
@@ -382,13 +398,13 @@ function getDocsTitle(docs) {
|
|
|
382
398
|
return typeof docs.config.nav === "object" && docs.config.nav && "title" in docs.config.nav ? String(docs.config.nav.title || "Documentation") : "Documentation";
|
|
383
399
|
}
|
|
384
400
|
function loadPages(contentDir, docs) {
|
|
385
|
-
return
|
|
401
|
+
return _chunkPPX7UOFYcjs.discoverFarmDocsPages.call(void 0, contentDir, docs).map((page) => _chunkPPX7UOFYcjs.loadFarmDocsPage.call(void 0, contentDir, docs, page.slug)).filter((page) => Boolean(page)).sort((a, b) => a.href.localeCompare(b.href));
|
|
386
402
|
}
|
|
387
|
-
function findSocialImagePath(html) {
|
|
403
|
+
function findSocialImagePath(html, basePath) {
|
|
388
404
|
const match = /<meta\s+property=["']og:image["']\s+content=["']([^"']+)["']/i.exec(html) || /<meta\s+content=["']([^"']+)["']\s+property=["']og:image["']/i.exec(html);
|
|
389
|
-
if (!_optionalChain([match, 'optionalAccess',
|
|
405
|
+
if (!_optionalChain([match, 'optionalAccess', _2 => _2[1]])) return null;
|
|
390
406
|
try {
|
|
391
|
-
return new URL(match[1], FARM_DOCS_COMPILED_ORIGIN).pathname;
|
|
407
|
+
return _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, new URL(match[1], FARM_DOCS_COMPILED_ORIGIN).pathname, basePath);
|
|
392
408
|
} catch (e4) {
|
|
393
409
|
return null;
|
|
394
410
|
}
|
|
@@ -400,42 +416,45 @@ async function addHandlerRoute(routes, pathname, handler, absolutePaths) {
|
|
|
400
416
|
return response;
|
|
401
417
|
}
|
|
402
418
|
async function compileFarmDocsManifest(docs, options) {
|
|
403
|
-
const contentDir =
|
|
419
|
+
const contentDir = _chunkPPX7UOFYcjs.resolveFarmDocsContentDir.call(void 0, docs, options);
|
|
404
420
|
const pages = loadPages(contentDir, docs);
|
|
421
|
+
const basePath = _chunkD22BUQKWcjs.normalizeFarmBasePath.call(void 0, options.basePath);
|
|
405
422
|
const absolutePaths = [
|
|
406
423
|
_path2.default.resolve(options.root),
|
|
407
424
|
_path2.default.resolve(contentDir),
|
|
408
425
|
docs.configPath || ""
|
|
409
426
|
];
|
|
410
|
-
const handler =
|
|
427
|
+
const handler = _chunkPPX7UOFYcjs.createFarmDocsHandler.call(void 0, docs, {
|
|
411
428
|
root: options.root,
|
|
412
429
|
srcDir: options.srcDir,
|
|
413
430
|
clientEntry: options.clientEntry,
|
|
414
431
|
fontAssets: options.fontAssets,
|
|
415
432
|
fontStylesheetHref: options.fontStylesheetHref,
|
|
416
433
|
globalStylesheetHref: options.globalStylesheetHref,
|
|
417
|
-
isPathGuarded: options.isPathGuarded
|
|
434
|
+
isPathGuarded: options.isPathGuarded,
|
|
435
|
+
basePath
|
|
418
436
|
});
|
|
419
|
-
const apiHandler =
|
|
437
|
+
const apiHandler = _chunkDCXSIEFEcjs.createFarmDocsAPIHandler.call(void 0, {
|
|
420
438
|
rootDir: options.root,
|
|
421
439
|
srcDir: options.srcDir,
|
|
422
440
|
docs,
|
|
423
|
-
isPathGuarded: options.isPathGuarded
|
|
441
|
+
isPathGuarded: options.isPathGuarded,
|
|
442
|
+
basePath
|
|
424
443
|
});
|
|
425
|
-
const publicPages = pages.filter((page) => !_optionalChain([options, 'access',
|
|
444
|
+
const publicPages = pages.filter((page) => !_optionalChain([options, 'access', _3 => _3.isPathGuarded, 'optionalCall', _4 => _4(page.href)]));
|
|
426
445
|
const routes = {};
|
|
427
446
|
const apiMarkdown = {};
|
|
428
447
|
for (const page of pages) {
|
|
429
448
|
const htmlResponse = await addHandlerRoute(routes, page.href, handler, absolutePaths);
|
|
430
|
-
const markdownPath =
|
|
449
|
+
const markdownPath = _chunkPPX7UOFYcjs.getFarmDocsMarkdownPath.call(void 0, page.href);
|
|
431
450
|
await addHandlerRoute(routes, markdownPath, handler, absolutePaths);
|
|
432
451
|
if (htmlResponse) {
|
|
433
|
-
const socialImagePath = findSocialImagePath(await htmlResponse.text());
|
|
452
|
+
const socialImagePath = findSocialImagePath(await htmlResponse.text(), basePath);
|
|
434
453
|
if (socialImagePath && !routes[normalizePathname(socialImagePath)]) {
|
|
435
454
|
await addHandlerRoute(routes, socialImagePath, handler, absolutePaths);
|
|
436
455
|
}
|
|
437
456
|
}
|
|
438
|
-
if (_optionalChain([options, 'access',
|
|
457
|
+
if (_optionalChain([options, 'access', _5 => _5.isPathGuarded, 'optionalCall', _6 => _6(page.href)])) continue;
|
|
439
458
|
const apiResponse = await apiHandler(
|
|
440
459
|
new Request(
|
|
441
460
|
`${FARM_DOCS_COMPILED_ORIGIN}/api/docs?format=markdown&path=${encodeURIComponent(page.slug)}`
|
|
@@ -503,6 +522,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
503
522
|
protocol: 1,
|
|
504
523
|
originPlaceholder: FARM_DOCS_COMPILED_ORIGIN,
|
|
505
524
|
entry: docs.entry,
|
|
525
|
+
...basePath ? { basePath } : {},
|
|
506
526
|
routes,
|
|
507
527
|
api: {
|
|
508
528
|
static: apiStatic,
|
|
@@ -511,7 +531,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
511
531
|
post: await compileResponse(postResponse, absolutePaths),
|
|
512
532
|
search: {
|
|
513
533
|
pages: publicPages.map((page) => ({
|
|
514
|
-
...
|
|
534
|
+
..._chunkPPX7UOFYcjs.toFarmDocsMarkdownPage.call(void 0, page, basePath),
|
|
515
535
|
sourcePath: `farm-docs:${page.slug || "index"}`
|
|
516
536
|
})),
|
|
517
537
|
search: _nullishCoalesce(searchConfig, () => ( true)),
|
|
@@ -689,7 +709,7 @@ async function createFarmRouteRuntimeManifest(options) {
|
|
|
689
709
|
const routes = [];
|
|
690
710
|
for (const [pattern, entry] of options.routeManager.getRoutes()) {
|
|
691
711
|
const routeModule = await options.routeManager.loadRouteModule(entry.modulePath);
|
|
692
|
-
const rendering = await
|
|
712
|
+
const rendering = await _chunkYVTS3S3Fcjs.resolveRouteRenderingConfigFromFile.call(void 0, routeModule, entry.modulePath);
|
|
693
713
|
const runtimeConfig = await options.routeManager.resolveRouteRuntimeConfig(pattern);
|
|
694
714
|
routes.push({
|
|
695
715
|
kind: "page",
|
|
@@ -704,9 +724,9 @@ async function createFarmRouteRuntimeManifest(options) {
|
|
|
704
724
|
pattern,
|
|
705
725
|
_chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, options.config.api)
|
|
706
726
|
);
|
|
707
|
-
const inherited =
|
|
708
|
-
const own =
|
|
709
|
-
|
|
727
|
+
const inherited = _chunkIUKBPBM7cjs.resolveFarmRouteRuleRuntimeConfig.call(void 0, publicPattern, options.config.routeRules);
|
|
728
|
+
const own = _chunkIUKBPBM7cjs.normalizeFarmRouteRuntimeConfig.call(void 0,
|
|
729
|
+
_chunkIUKBPBM7cjs.getFarmRouteRuntimeConfig.call(void 0, route),
|
|
710
730
|
`API route "${pattern}"`
|
|
711
731
|
);
|
|
712
732
|
routes.push({
|
|
@@ -714,8 +734,8 @@ async function createFarmRouteRuntimeManifest(options) {
|
|
|
714
734
|
pattern: publicPattern,
|
|
715
735
|
rendering: "dynamic",
|
|
716
736
|
source: normalizeManifestSource(root, route.filePath),
|
|
717
|
-
...
|
|
718
|
-
|
|
737
|
+
..._chunkIUKBPBM7cjs.resolveFarmRouteRuntimeConfig.call(void 0,
|
|
738
|
+
_chunkIUKBPBM7cjs.mergeFarmRouteRuntimeConfigs.call(void 0, inherited, own),
|
|
719
739
|
`API route "${pattern}"`
|
|
720
740
|
)
|
|
721
741
|
});
|
|
@@ -723,9 +743,9 @@ async function createFarmRouteRuntimeManifest(options) {
|
|
|
723
743
|
for (const entry of options.routeManager.getMetadataRoutes().values()) {
|
|
724
744
|
const routeModule = await options.routeManager.loadRouteModule(entry.modulePath);
|
|
725
745
|
const pattern = entry.pattern === "/" ? `/${entry.outputName}` : `${entry.pattern}/${entry.outputName}`;
|
|
726
|
-
const inherited =
|
|
727
|
-
const own =
|
|
728
|
-
|
|
746
|
+
const inherited = _chunkIUKBPBM7cjs.resolveFarmRouteRuleRuntimeConfig.call(void 0, pattern, options.config.routeRules);
|
|
747
|
+
const own = _chunkIUKBPBM7cjs.normalizeFarmRouteRuntimeConfig.call(void 0,
|
|
748
|
+
_chunkIUKBPBM7cjs.getFarmRouteRuntimeConfig.call(void 0, routeModule),
|
|
729
749
|
`Metadata route "${pattern}"`
|
|
730
750
|
);
|
|
731
751
|
routes.push({
|
|
@@ -733,19 +753,19 @@ async function createFarmRouteRuntimeManifest(options) {
|
|
|
733
753
|
pattern,
|
|
734
754
|
rendering: "dynamic",
|
|
735
755
|
source: normalizeManifestSource(root, entry.modulePath),
|
|
736
|
-
...
|
|
737
|
-
|
|
756
|
+
..._chunkIUKBPBM7cjs.resolveFarmRouteRuntimeConfig.call(void 0,
|
|
757
|
+
_chunkIUKBPBM7cjs.mergeFarmRouteRuntimeConfigs.call(void 0, inherited, own),
|
|
738
758
|
`Metadata route "${pattern}"`
|
|
739
759
|
)
|
|
740
760
|
});
|
|
741
761
|
}
|
|
742
762
|
for (const [pattern, rule] of Object.entries(options.config.routeRules)) {
|
|
743
|
-
if (!
|
|
763
|
+
if (!_chunkIUKBPBM7cjs.hasFarmRouteRuntimeControls.call(void 0, rule)) continue;
|
|
744
764
|
routes.push({
|
|
745
765
|
kind: "rule",
|
|
746
766
|
pattern,
|
|
747
767
|
rendering: rule.prerender || rule.render === "static" ? "static" : "dynamic",
|
|
748
|
-
...
|
|
768
|
+
..._chunkIUKBPBM7cjs.resolveFarmRouteRuntimeConfig.call(void 0, rule, `Route rule "${pattern}"`)
|
|
749
769
|
});
|
|
750
770
|
}
|
|
751
771
|
return {
|
|
@@ -762,7 +782,7 @@ async function writeFarmRouteRuntimeManifest(directory, manifest) {
|
|
|
762
782
|
return manifestPath;
|
|
763
783
|
}
|
|
764
784
|
function validateFarmRouteRuntimeDeployment(manifest, preset) {
|
|
765
|
-
const runtime =
|
|
785
|
+
const runtime = _chunkF43OG25Pcjs.getFarmPresetRuntime.call(void 0, preset);
|
|
766
786
|
const warnings = /* @__PURE__ */ new Set();
|
|
767
787
|
for (const route of manifest.routes) {
|
|
768
788
|
if (route.rendering === "static") continue;
|
|
@@ -776,7 +796,7 @@ function validateFarmRouteRuntimeDeployment(manifest, preset) {
|
|
|
776
796
|
`Route "${route.pattern}" requires the ${route.runtime} runtime, but preset "${preset}" emits ${runtime} functions. Choose a compatible preset or change the route runtime.`
|
|
777
797
|
);
|
|
778
798
|
}
|
|
779
|
-
if (_optionalChain([route, 'access',
|
|
799
|
+
if (_optionalChain([route, 'access', _7 => _7.regions, 'optionalAccess', _8 => _8.length]) && preset !== "vercel") {
|
|
780
800
|
warnings.add(
|
|
781
801
|
`Preset "${preset}" does not map per-route regions; Farm kept them in ${FARM_ROUTE_RUNTIME_MANIFEST} for deployment adapters.`
|
|
782
802
|
);
|
|
@@ -813,7 +833,7 @@ async function createFarmVercelRouteRuntimeFunctions(outputDir, manifest, fs4, b
|
|
|
813
833
|
regions: route.regions,
|
|
814
834
|
maxDuration: route.maxDuration
|
|
815
835
|
};
|
|
816
|
-
const key =
|
|
836
|
+
const key = _chunkIUKBPBM7cjs.createFarmRouteRuntimeKey.call(void 0, config);
|
|
817
837
|
const group = groups.get(key) || { config, routes: [] };
|
|
818
838
|
group.routes.push(route);
|
|
819
839
|
groups.set(key, group);
|
|
@@ -823,7 +843,7 @@ async function createFarmVercelRouteRuntimeFunctions(outputDir, manifest, fs4, b
|
|
|
823
843
|
const destinations = /* @__PURE__ */ new Map();
|
|
824
844
|
let groupIndex = 0;
|
|
825
845
|
for (const [key, group] of groups) {
|
|
826
|
-
if (!_optionalChain([group, 'access',
|
|
846
|
+
if (!_optionalChain([group, 'access', _9 => _9.config, 'access', _10 => _10.regions, 'optionalAccess', _11 => _11.length]) && !group.config.maxDuration) {
|
|
827
847
|
destinations.set(key, "/__nitro");
|
|
828
848
|
continue;
|
|
829
849
|
}
|
|
@@ -840,7 +860,7 @@ async function createFarmVercelRouteRuntimeFunctions(outputDir, manifest, fs4, b
|
|
|
840
860
|
const src = farmRoutePatternToVercelSource(route.pattern, basePath);
|
|
841
861
|
if (seenSources.has(src)) continue;
|
|
842
862
|
seenSources.add(src);
|
|
843
|
-
const key =
|
|
863
|
+
const key = _chunkIUKBPBM7cjs.createFarmRouteRuntimeKey.call(void 0, {
|
|
844
864
|
runtime: route.runtime === "auto" ? "node" : route.runtime,
|
|
845
865
|
regions: route.regions,
|
|
846
866
|
maxDuration: route.maxDuration
|
|
@@ -873,14 +893,14 @@ async function configureVercelFunction(functionDir, config, fs4) {
|
|
|
873
893
|
const current = JSON.parse(await fs4.readFile(configPath, "utf8"));
|
|
874
894
|
const next = {
|
|
875
895
|
...current,
|
|
876
|
-
..._optionalChain([config, 'access',
|
|
896
|
+
..._optionalChain([config, 'access', _12 => _12.regions, 'optionalAccess', _13 => _13.length]) ? { regions: config.regions } : {},
|
|
877
897
|
...config.maxDuration ? { maxDuration: config.maxDuration } : {}
|
|
878
898
|
};
|
|
879
899
|
await fs4.writeFile(configPath, `${JSON.stringify(next, null, 2)}
|
|
880
900
|
`);
|
|
881
901
|
}
|
|
882
902
|
function hasVercelFunctionControls(route) {
|
|
883
|
-
return Boolean(_optionalChain([route, 'access',
|
|
903
|
+
return Boolean(_optionalChain([route, 'access', _14 => _14.regions, 'optionalAccess', _15 => _15.length]) || route.maxDuration);
|
|
884
904
|
}
|
|
885
905
|
function compareRuntimeRoutes(left, right) {
|
|
886
906
|
const kindOrder = { page: 0, api: 0, metadata: 0, rule: 1 };
|
|
@@ -942,6 +962,121 @@ function buildFarmVercelRoutes(options) {
|
|
|
942
962
|
];
|
|
943
963
|
}
|
|
944
964
|
|
|
965
|
+
// src/nitro/ssr-public-assets.ts
|
|
966
|
+
|
|
967
|
+
var SERVER_FILE_URL_RE = /new\s+URL\(\s*(["'`])([^"'`\\]+)\1\s*,\s*import\.meta\.url\s*\)/g;
|
|
968
|
+
function resolveBundleFileName(chunkFileName, relativeUrl) {
|
|
969
|
+
if (relativeUrl.startsWith("/") || /^[a-z][a-z\d+.-]*:/i.test(relativeUrl)) return null;
|
|
970
|
+
let relativePath = relativeUrl.replace(/[?#].*$/, "");
|
|
971
|
+
try {
|
|
972
|
+
relativePath = decodeURI(relativePath);
|
|
973
|
+
} catch (e7) {
|
|
974
|
+
}
|
|
975
|
+
const fileName = _path2.default.posix.normalize(
|
|
976
|
+
_path2.default.posix.join(_path2.default.posix.dirname(chunkFileName), relativePath)
|
|
977
|
+
);
|
|
978
|
+
return fileName.startsWith("../") ? null : fileName;
|
|
979
|
+
}
|
|
980
|
+
function replaceServerFileReferences(bundle, chunkFileName, code, replace) {
|
|
981
|
+
return code.replace(SERVER_FILE_URL_RE, (reference, _quote, relativeUrl) => {
|
|
982
|
+
const target = resolveBundleFileName(chunkFileName, relativeUrl);
|
|
983
|
+
return target && _optionalChain([bundle, 'access', _16 => _16[target], 'optionalAccess', _17 => _17.type]) === "asset" ? replace(target) : reference;
|
|
984
|
+
});
|
|
985
|
+
}
|
|
986
|
+
function collectServerReadSSRAssets(bundle) {
|
|
987
|
+
const assets = /* @__PURE__ */ new Set();
|
|
988
|
+
for (const [fileName, output] of Object.entries(bundle)) {
|
|
989
|
+
if (output.type !== "chunk" || !output.code.includes("import.meta.url")) continue;
|
|
990
|
+
replaceServerFileReferences(bundle, fileName, output.code, (assetFileName) => {
|
|
991
|
+
assets.add(assetFileName);
|
|
992
|
+
return "";
|
|
993
|
+
});
|
|
994
|
+
}
|
|
995
|
+
return assets;
|
|
996
|
+
}
|
|
997
|
+
function collectServerOnlySSRAssets(bundle) {
|
|
998
|
+
const serverOnly = /* @__PURE__ */ new Set();
|
|
999
|
+
const publicReferenceSources = [];
|
|
1000
|
+
for (const [fileName, output] of Object.entries(bundle)) {
|
|
1001
|
+
if (output.type !== "chunk") continue;
|
|
1002
|
+
if (!output.code.includes("import.meta.url")) {
|
|
1003
|
+
publicReferenceSources.push(output.code);
|
|
1004
|
+
continue;
|
|
1005
|
+
}
|
|
1006
|
+
publicReferenceSources.push(
|
|
1007
|
+
replaceServerFileReferences(bundle, fileName, output.code, (assetFileName) => {
|
|
1008
|
+
serverOnly.add(assetFileName);
|
|
1009
|
+
return "";
|
|
1010
|
+
})
|
|
1011
|
+
);
|
|
1012
|
+
}
|
|
1013
|
+
if (serverOnly.size === 0) return serverOnly;
|
|
1014
|
+
for (const output of Object.values(bundle)) {
|
|
1015
|
+
if (output.type === "asset" && typeof output.source === "string") {
|
|
1016
|
+
publicReferenceSources.push(output.source);
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
for (const fileName of serverOnly) {
|
|
1020
|
+
const name = _path2.default.posix.basename(fileName);
|
|
1021
|
+
if (publicReferenceSources.some((source) => source.includes(name))) {
|
|
1022
|
+
serverOnly.delete(fileName);
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
return serverOnly;
|
|
1026
|
+
}
|
|
1027
|
+
function canReadServerFiles(preset) {
|
|
1028
|
+
return _chunkF43OG25Pcjs.getFarmPresetRuntime.call(void 0, preset) !== "edge" && !preset.startsWith("cloudflare");
|
|
1029
|
+
}
|
|
1030
|
+
function assertServerReadSSRAssetsSupported(bundle, preset, root) {
|
|
1031
|
+
if (canReadServerFiles(preset)) return;
|
|
1032
|
+
const assets = [...collectServerReadSSRAssets(bundle)];
|
|
1033
|
+
if (assets.length === 0) return;
|
|
1034
|
+
const sources = assets.map((fileName) => {
|
|
1035
|
+
const output = bundle[fileName];
|
|
1036
|
+
const original = _optionalChain([output, 'optionalAccess', _18 => _18.type]) === "asset" ? _optionalChain([output, 'access', _19 => _19.originalFileNames, 'optionalAccess', _20 => _20[0]]) : void 0;
|
|
1037
|
+
if (!original) return fileName;
|
|
1038
|
+
return _path2.default.relative(root, _path2.default.resolve(root, original)).split(_path2.default.sep).join("/");
|
|
1039
|
+
});
|
|
1040
|
+
throw new Error(
|
|
1041
|
+
`The "${preset}" preset cannot run server code that imports ${sources.join(", ")}. Server code reads such a file from beside the server bundle, and this edge runtime deploys no such file (Cloudflare Workers and Vercel Edge also refuse to compile WebAssembly from bytes). Load it in the browser instead, from client code with the @farm.js/wasm plugin or a "?url" import, or deploy to a Node target such as node-server, bun, vercel or netlify.`
|
|
1042
|
+
);
|
|
1043
|
+
}
|
|
1044
|
+
function createServerReadSSRAssetsPlugin(bundle, ssrOutputDir) {
|
|
1045
|
+
if (collectServerReadSSRAssets(bundle).size === 0) return null;
|
|
1046
|
+
let referenceIds = /* @__PURE__ */ new Map();
|
|
1047
|
+
return {
|
|
1048
|
+
name: "farm-server-read-ssr-assets",
|
|
1049
|
+
buildStart() {
|
|
1050
|
+
referenceIds = /* @__PURE__ */ new Map();
|
|
1051
|
+
},
|
|
1052
|
+
transform(code, id) {
|
|
1053
|
+
if (!code.includes("import.meta.url")) return null;
|
|
1054
|
+
const chunkFileName = _path2.default.relative(ssrOutputDir, id.split("?", 1)[0]).split(_path2.default.sep).join("/");
|
|
1055
|
+
if (_optionalChain([bundle, 'access', _21 => _21[chunkFileName], 'optionalAccess', _22 => _22.type]) !== "chunk") return null;
|
|
1056
|
+
let changed = false;
|
|
1057
|
+
const transformed = replaceServerFileReferences(
|
|
1058
|
+
bundle,
|
|
1059
|
+
chunkFileName,
|
|
1060
|
+
code,
|
|
1061
|
+
(assetFileName) => {
|
|
1062
|
+
let referenceId = referenceIds.get(assetFileName);
|
|
1063
|
+
if (!referenceId) {
|
|
1064
|
+
referenceId = this.emitFile({
|
|
1065
|
+
type: "asset",
|
|
1066
|
+
fileName: assetFileName,
|
|
1067
|
+
source: bundle[assetFileName].source
|
|
1068
|
+
});
|
|
1069
|
+
referenceIds.set(assetFileName, referenceId);
|
|
1070
|
+
}
|
|
1071
|
+
changed = true;
|
|
1072
|
+
return `new URL(import.meta.ROLLUP_FILE_URL_${referenceId})`;
|
|
1073
|
+
}
|
|
1074
|
+
);
|
|
1075
|
+
return changed ? { code: transformed, map: null } : null;
|
|
1076
|
+
}
|
|
1077
|
+
};
|
|
1078
|
+
}
|
|
1079
|
+
|
|
945
1080
|
// src/nitro/netlify-entry.ts
|
|
946
1081
|
|
|
947
1082
|
|
|
@@ -1004,7 +1139,7 @@ export default async function farmNetlifyHandler(request, context) {
|
|
|
1004
1139
|
var PLATFORM_CONFIG_KEYS = /* @__PURE__ */ new Set(["desktop", "mobile"]);
|
|
1005
1140
|
var CONFIG_FACTORIES = /* @__PURE__ */ new Set(["defineConfig", "defineFarmConfig"]);
|
|
1006
1141
|
function isConfigObject(node) {
|
|
1007
|
-
return _optionalChain([node, 'optionalAccess',
|
|
1142
|
+
return _optionalChain([node, 'optionalAccess', _23 => _23.type]) === "ObjectExpression";
|
|
1008
1143
|
}
|
|
1009
1144
|
function propertyName(property) {
|
|
1010
1145
|
if (property.type !== "Property" || property.computed) return void 0;
|
|
@@ -1025,7 +1160,7 @@ function collectConfigObjects(node, found) {
|
|
|
1025
1160
|
}
|
|
1026
1161
|
if (current.type === "CallExpression") {
|
|
1027
1162
|
const callee = current.callee;
|
|
1028
|
-
const name = callee.type === "Identifier" ? callee.name : _optionalChain([callee, 'access',
|
|
1163
|
+
const name = callee.type === "Identifier" ? callee.name : _optionalChain([callee, 'access', _24 => _24.property, 'optionalAccess', _25 => _25.name]);
|
|
1029
1164
|
const argument = current.arguments[0];
|
|
1030
1165
|
if (name && CONFIG_FACTORIES.has(name) && isConfigObject(argument)) found.push(argument);
|
|
1031
1166
|
}
|
|
@@ -1058,7 +1193,7 @@ function stripPlatformConfigSource(code, parse) {
|
|
|
1058
1193
|
const trailingComma = /^\s*,/.exec(code.slice(properties[last].end));
|
|
1059
1194
|
removals.push([
|
|
1060
1195
|
properties[first].start,
|
|
1061
|
-
properties[last].end + (_nullishCoalesce(_optionalChain([trailingComma, 'optionalAccess',
|
|
1196
|
+
properties[last].end + (_nullishCoalesce(_optionalChain([trailingComma, 'optionalAccess', _26 => _26[0], 'access', _27 => _27.length]), () => ( 0)))
|
|
1062
1197
|
]);
|
|
1063
1198
|
}
|
|
1064
1199
|
first = last;
|
|
@@ -1073,7 +1208,7 @@ function stripPlatformConfigSource(code, parse) {
|
|
|
1073
1208
|
function realPath(file) {
|
|
1074
1209
|
try {
|
|
1075
1210
|
return _fs.realpathSync.call(void 0, file);
|
|
1076
|
-
} catch (
|
|
1211
|
+
} catch (e8) {
|
|
1077
1212
|
return _path2.default.resolve(file);
|
|
1078
1213
|
}
|
|
1079
1214
|
}
|
|
@@ -1134,7 +1269,7 @@ function literalMatcher(node) {
|
|
|
1134
1269
|
if (node.type === "Literal" && node.regex)
|
|
1135
1270
|
return new RegExp(node.regex.pattern, node.regex.flags);
|
|
1136
1271
|
if (node.type === "TemplateLiteral" && node.expressions.length === 0) {
|
|
1137
|
-
return _nullishCoalesce(_optionalChain([node, 'access',
|
|
1272
|
+
return _nullishCoalesce(_optionalChain([node, 'access', _28 => _28.quasis, 'access', _29 => _29[0], 'optionalAccess', _30 => _30.value, 'optionalAccess', _31 => _31.cooked]), () => ( void 0));
|
|
1138
1273
|
}
|
|
1139
1274
|
return void 0;
|
|
1140
1275
|
}
|
|
@@ -1158,7 +1293,7 @@ function readStaticMiddlewareConfig(program) {
|
|
|
1158
1293
|
let found = null;
|
|
1159
1294
|
for (const statement of program.body) {
|
|
1160
1295
|
if (statement.type === "ExportNamedDeclaration" && !statement.declaration) {
|
|
1161
|
-
if (statement.specifiers.some((specifier) => _optionalChain([specifier, 'access',
|
|
1296
|
+
if (statement.specifiers.some((specifier) => _optionalChain([specifier, 'access', _32 => _32.exported, 'optionalAccess', _33 => _33.name]) === "config")) {
|
|
1162
1297
|
return "unknown";
|
|
1163
1298
|
}
|
|
1164
1299
|
continue;
|
|
@@ -1166,14 +1301,14 @@ function readStaticMiddlewareConfig(program) {
|
|
|
1166
1301
|
const declaration = statement.type === "ExportNamedDeclaration" ? statement.declaration : null;
|
|
1167
1302
|
if (!declaration || declaration.type !== "VariableDeclaration") continue;
|
|
1168
1303
|
for (const declarator of declaration.declarations) {
|
|
1169
|
-
if (_optionalChain([declarator, 'access',
|
|
1304
|
+
if (_optionalChain([declarator, 'access', _34 => _34.id, 'optionalAccess', _35 => _35.type]) !== "Identifier" || declarator.id.name !== "config") continue;
|
|
1170
1305
|
if (declaration.kind !== "const" || !declarator.init) return "unknown";
|
|
1171
1306
|
const init = unwrap(declarator.init);
|
|
1172
1307
|
if (init.type !== "ObjectExpression") return "unknown";
|
|
1173
1308
|
const config = {};
|
|
1174
1309
|
for (const property of init.properties) {
|
|
1175
1310
|
if (property.type !== "Property" || property.computed) return "unknown";
|
|
1176
|
-
const key = _nullishCoalesce(_optionalChain([property, 'access',
|
|
1311
|
+
const key = _nullishCoalesce(_optionalChain([property, 'access', _36 => _36.key, 'optionalAccess', _37 => _37.name]), () => ( _optionalChain([property, 'access', _38 => _38.key, 'optionalAccess', _39 => _39.value])));
|
|
1177
1312
|
if (key !== "matcher" && key !== "exclude") continue;
|
|
1178
1313
|
const matchers = literalMatchers(unwrap(property.value));
|
|
1179
1314
|
if (!matchers) return "unknown";
|
|
@@ -1189,9 +1324,9 @@ async function readMiddlewareFileConfig(filePath) {
|
|
|
1189
1324
|
try {
|
|
1190
1325
|
const [{ readFile }, vite] = await Promise.all([import("fs/promises"), import("vite")]);
|
|
1191
1326
|
const parsed = vite.parseSync(filePath, await readFile(filePath, "utf8"));
|
|
1192
|
-
if (_optionalChain([parsed, 'access',
|
|
1327
|
+
if (_optionalChain([parsed, 'access', _40 => _40.errors, 'optionalAccess', _41 => _41.length])) return "unknown";
|
|
1193
1328
|
return readStaticMiddlewareConfig(parsed.program);
|
|
1194
|
-
} catch (
|
|
1329
|
+
} catch (e9) {
|
|
1195
1330
|
return "unknown";
|
|
1196
1331
|
}
|
|
1197
1332
|
}
|
|
@@ -1207,7 +1342,7 @@ async function readFarmNativeStylesheets(clientOutputDir, clientCssHref) {
|
|
|
1207
1342
|
"utf8"
|
|
1208
1343
|
)
|
|
1209
1344
|
};
|
|
1210
|
-
} catch (
|
|
1345
|
+
} catch (e10) {
|
|
1211
1346
|
return {};
|
|
1212
1347
|
}
|
|
1213
1348
|
}
|
|
@@ -1226,7 +1361,7 @@ function findFarmCoreRoot(from) {
|
|
|
1226
1361
|
if (_fs.existsSync.call(void 0, manifest)) {
|
|
1227
1362
|
try {
|
|
1228
1363
|
if (JSON.parse(_fs.readFileSync.call(void 0, manifest, "utf8")).name === "@farm.js/core") return dir;
|
|
1229
|
-
} catch (
|
|
1364
|
+
} catch (e11) {
|
|
1230
1365
|
}
|
|
1231
1366
|
}
|
|
1232
1367
|
dir = _path2.default.dirname(dir);
|
|
@@ -1244,7 +1379,7 @@ function findInstalledPackageDir(name, from) {
|
|
|
1244
1379
|
if (_fs.existsSync.call(void 0, _path2.default.join(candidate, "package.json"))) {
|
|
1245
1380
|
try {
|
|
1246
1381
|
return _fs.realpathSync.call(void 0, candidate);
|
|
1247
|
-
} catch (
|
|
1382
|
+
} catch (e12) {
|
|
1248
1383
|
return null;
|
|
1249
1384
|
}
|
|
1250
1385
|
}
|
|
@@ -1260,7 +1395,7 @@ function collectFarmDependencyDirs(root) {
|
|
|
1260
1395
|
let manifest;
|
|
1261
1396
|
try {
|
|
1262
1397
|
manifest = JSON.parse(_fs.readFileSync.call(void 0, _path2.default.join(dir, "package.json"), "utf8"));
|
|
1263
|
-
} catch (
|
|
1398
|
+
} catch (e13) {
|
|
1264
1399
|
return;
|
|
1265
1400
|
}
|
|
1266
1401
|
for (const field of ["dependencies", "optionalDependencies", "peerDependencies"]) {
|
|
@@ -1276,7 +1411,7 @@ function collectFarmDependencyDirs(root) {
|
|
|
1276
1411
|
if (name.startsWith("@farm.js/")) queue.push({ name, from: root });
|
|
1277
1412
|
}
|
|
1278
1413
|
}
|
|
1279
|
-
} catch (
|
|
1414
|
+
} catch (e14) {
|
|
1280
1415
|
}
|
|
1281
1416
|
for (let next = queue.pop(); next; next = queue.pop()) {
|
|
1282
1417
|
const dir = findInstalledPackageDir(next.name, next.from);
|
|
@@ -1366,14 +1501,14 @@ function createPrerenderRuntimeResolverPlugin(root, resolveNitroEntry = resolveN
|
|
|
1366
1501
|
return {
|
|
1367
1502
|
name: "farm-prerender-runtime-resolver",
|
|
1368
1503
|
async resolveId(id, _importer, options) {
|
|
1369
|
-
if (_optionalChain([options, 'access',
|
|
1504
|
+
if (_optionalChain([options, 'access', _42 => _42.custom, 'optionalAccess', _43 => _43.farmPrerenderRuntimeResolve])) return null;
|
|
1370
1505
|
if (id.startsWith("\0") || id.startsWith(".") || id.startsWith("#") || id.startsWith("virtual:") || _path2.default.isAbsolute(id) || NODE_BUILTIN_MODULES.has(id)) {
|
|
1371
1506
|
return null;
|
|
1372
1507
|
}
|
|
1373
1508
|
if (nitroEntry === void 0) {
|
|
1374
1509
|
try {
|
|
1375
1510
|
nitroEntry = resolveNitroEntry(root);
|
|
1376
|
-
} catch (
|
|
1511
|
+
} catch (e15) {
|
|
1377
1512
|
nitroEntry = null;
|
|
1378
1513
|
}
|
|
1379
1514
|
}
|
|
@@ -1394,7 +1529,7 @@ function createFarmStorageModuleRegistration(config) {
|
|
|
1394
1529
|
let runtimeRequire = projectRequire;
|
|
1395
1530
|
try {
|
|
1396
1531
|
runtimeRequire = _module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core"));
|
|
1397
|
-
} catch (
|
|
1532
|
+
} catch (e16) {
|
|
1398
1533
|
}
|
|
1399
1534
|
const loaders = [];
|
|
1400
1535
|
for (const specifier of modules) {
|
|
@@ -1403,7 +1538,7 @@ function createFarmStorageModuleRegistration(config) {
|
|
|
1403
1538
|
try {
|
|
1404
1539
|
resolved = require2.resolve(specifier);
|
|
1405
1540
|
break;
|
|
1406
|
-
} catch (
|
|
1541
|
+
} catch (e17) {
|
|
1407
1542
|
}
|
|
1408
1543
|
}
|
|
1409
1544
|
if (resolved) {
|
|
@@ -1421,7 +1556,7 @@ function resolveNitroPackageEntry(root) {
|
|
|
1421
1556
|
let runtimeRequire = projectRequire;
|
|
1422
1557
|
try {
|
|
1423
1558
|
runtimeRequire = _module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core"));
|
|
1424
|
-
} catch (
|
|
1559
|
+
} catch (e18) {
|
|
1425
1560
|
}
|
|
1426
1561
|
return runtimeRequire.resolve("nitro");
|
|
1427
1562
|
}
|
|
@@ -1475,7 +1610,7 @@ async function canUseRolldownBuilder() {
|
|
|
1475
1610
|
try {
|
|
1476
1611
|
await import("rolldown");
|
|
1477
1612
|
return true;
|
|
1478
|
-
} catch (
|
|
1613
|
+
} catch (e19) {
|
|
1479
1614
|
return false;
|
|
1480
1615
|
}
|
|
1481
1616
|
}
|
|
@@ -1489,18 +1624,27 @@ function hasReactDomEdgeServerBuild(root) {
|
|
|
1489
1624
|
try {
|
|
1490
1625
|
_module.createRequire.call(void 0, _path2.default.join(root, "package.json")).resolve("react-dom/server.edge");
|
|
1491
1626
|
return true;
|
|
1492
|
-
} catch (
|
|
1627
|
+
} catch (e20) {
|
|
1493
1628
|
return false;
|
|
1494
1629
|
}
|
|
1495
1630
|
}
|
|
1496
1631
|
function shouldAliasReactServerToWebBuild(renderer, preset) {
|
|
1497
|
-
return
|
|
1632
|
+
return _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) && _chunkF43OG25Pcjs.getFarmPresetRuntime.call(void 0, preset) === "edge";
|
|
1498
1633
|
}
|
|
1499
1634
|
function isCloudflareImagePreset(preset) {
|
|
1500
1635
|
return preset === "cloudflare" || preset === "cloudflare-pages" || preset === "cloudflare-module";
|
|
1501
1636
|
}
|
|
1637
|
+
function getEdgeMetadataImageRuntime(preset) {
|
|
1638
|
+
if (isCloudflareImagePreset(preset)) {
|
|
1639
|
+
return { condition: "workerd", wasm: "module", runtime: "Cloudflare Workers" };
|
|
1640
|
+
}
|
|
1641
|
+
if (preset === "netlify-edge") {
|
|
1642
|
+
return { condition: "edge", wasm: "bytes", runtime: "Netlify Edge Functions" };
|
|
1643
|
+
}
|
|
1644
|
+
return null;
|
|
1645
|
+
}
|
|
1502
1646
|
function shouldUseExternalMetadataImageRuntime(preset, usesImageRuntime) {
|
|
1503
|
-
return usesImageRuntime &&
|
|
1647
|
+
return usesImageRuntime && !getEdgeMetadataImageRuntime(preset);
|
|
1504
1648
|
}
|
|
1505
1649
|
function isNitroRollupExternal(id) {
|
|
1506
1650
|
const normalizedId = id.replace(/\\/g, "/");
|
|
@@ -1527,7 +1671,7 @@ function isFarmCoreModule(file) {
|
|
|
1527
1671
|
if (_fs.existsSync.call(void 0, manifest)) {
|
|
1528
1672
|
try {
|
|
1529
1673
|
return JSON.parse(_fs.readFileSync.call(void 0, manifest, "utf8")).name === "@farm.js/core";
|
|
1530
|
-
} catch (
|
|
1674
|
+
} catch (e21) {
|
|
1531
1675
|
return false;
|
|
1532
1676
|
}
|
|
1533
1677
|
}
|
|
@@ -1556,11 +1700,71 @@ export class ImageResponse {
|
|
|
1556
1700
|
}
|
|
1557
1701
|
};
|
|
1558
1702
|
}
|
|
1703
|
+
function readVercelOgManifest(file) {
|
|
1704
|
+
let dir = _path2.default.dirname(file.split("?", 1)[0]);
|
|
1705
|
+
while (dir !== _path2.default.dirname(dir)) {
|
|
1706
|
+
const manifestPath = _path2.default.join(dir, "package.json");
|
|
1707
|
+
if (_fs.existsSync.call(void 0, manifestPath)) {
|
|
1708
|
+
const manifest = JSON.parse(_fs.readFileSync.call(void 0, manifestPath, "utf8"));
|
|
1709
|
+
return manifest.name === "@vercel/og" ? { dir, manifest } : null;
|
|
1710
|
+
}
|
|
1711
|
+
dir = _path2.default.dirname(dir);
|
|
1712
|
+
}
|
|
1713
|
+
return null;
|
|
1714
|
+
}
|
|
1715
|
+
function resolveVercelOgConditionEntry(resolvedId, condition) {
|
|
1716
|
+
const vercelOg = readVercelOgManifest(resolvedId);
|
|
1717
|
+
const entry = _optionalChain([vercelOg, 'optionalAccess', _44 => _44.manifest, 'access', _45 => _45.exports, 'optionalAccess', _46 => _46["."], 'optionalAccess', _47 => _47[condition]]);
|
|
1718
|
+
const file = typeof entry === "string" ? entry : _optionalChain([entry, 'optionalAccess', _48 => _48.default]);
|
|
1719
|
+
return vercelOg && typeof file === "string" ? _path2.default.join(vercelOg.dir, file) : null;
|
|
1720
|
+
}
|
|
1721
|
+
function createEdgeMetadataImageRuntimePlugin({
|
|
1722
|
+
condition,
|
|
1723
|
+
wasm
|
|
1724
|
+
}) {
|
|
1725
|
+
return {
|
|
1726
|
+
name: "farm-edge-metadata-image-runtime",
|
|
1727
|
+
async resolveId(source, importer, options) {
|
|
1728
|
+
if (source === "@vercel/og") {
|
|
1729
|
+
const resolved = await this.resolve(source, importer, { ...options, skipSelf: true });
|
|
1730
|
+
if (!resolved || resolved.external) return resolved;
|
|
1731
|
+
const edgeEntry = resolveVercelOgConditionEntry(resolved.id, condition);
|
|
1732
|
+
return edgeEntry ? { ...resolved, id: edgeEntry } : resolved;
|
|
1733
|
+
}
|
|
1734
|
+
if (wasm !== "module" || !source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess', _49 => _49.replace, 'call', _50 => _50(/\\/g, "/"), 'access', _51 => _51.includes, 'call', _52 => _52("/@vercel/og/")])) {
|
|
1735
|
+
return null;
|
|
1736
|
+
}
|
|
1737
|
+
const resolvedPath = _path2.default.resolve(_path2.default.dirname(importer.split("?", 1)[0]), source);
|
|
1738
|
+
return { id: _chunkQMNWKQL4cjs.toPosixPath.call(void 0, resolvedPath), external: "absolute" };
|
|
1739
|
+
}
|
|
1740
|
+
};
|
|
1741
|
+
}
|
|
1742
|
+
var VERCEL_OG_FONT_FETCH = /fetch\(\s*new URL\(\s*(["'`])(\.\/[^"'`]+\.ttf)\1\s*,\s*import\.meta\.url\s*\)\s*\)/g;
|
|
1743
|
+
function createVercelOgFontInlinePlugin(runtime = "Cloudflare Workers") {
|
|
1744
|
+
return {
|
|
1745
|
+
name: "farm-vercel-og-font-inline",
|
|
1746
|
+
transform(code, id) {
|
|
1747
|
+
const file = id.split("?", 1)[0];
|
|
1748
|
+
if (!/\.[cm]?js$/.test(file) || !file.replace(/\\/g, "/").includes("/@vercel/og/")) {
|
|
1749
|
+
return null;
|
|
1750
|
+
}
|
|
1751
|
+
const inlined = code.replace(VERCEL_OG_FONT_FETCH, (_match, _quote, request) => {
|
|
1752
|
+
const encoded = _fs.readFileSync.call(void 0, _path2.default.resolve(_path2.default.dirname(file), request)).toString("base64");
|
|
1753
|
+
return `Promise.resolve({ arrayBuffer: () => Uint8Array.from(atob(${JSON.stringify(encoded)}), (character) => character.charCodeAt(0)).buffer })`;
|
|
1754
|
+
});
|
|
1755
|
+
if (inlined !== code) return { code: inlined, map: null };
|
|
1756
|
+
const version = _nullishCoalesce(_optionalChain([readVercelOgManifest, 'call', _53 => _53(file), 'optionalAccess', _54 => _54.manifest, 'access', _55 => _55.version]), () => ( "(unknown version)"));
|
|
1757
|
+
this.error(
|
|
1758
|
+
`@vercel/og ${version} cannot be bundled for ${runtime}: ${file} does not load its default font with fetch(new URL("./<font>.ttf", import.meta.url)), the pattern Farm inlines because an edge function cannot fetch it. Install a @vercel/og version whose edge build does, such as 1.0.1.`
|
|
1759
|
+
);
|
|
1760
|
+
}
|
|
1761
|
+
};
|
|
1762
|
+
}
|
|
1559
1763
|
function createMetadataImageWasmPlugin() {
|
|
1560
1764
|
return {
|
|
1561
1765
|
name: "farm-metadata-image-wasm",
|
|
1562
1766
|
resolveId(source, importer) {
|
|
1563
|
-
if (!source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess',
|
|
1767
|
+
if (!source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess', _56 => _56.replace, 'call', _57 => _57(/\\/g, "/"), 'access', _58 => _58.includes, 'call', _59 => _59("/@vercel/og/")])) {
|
|
1564
1768
|
return null;
|
|
1565
1769
|
}
|
|
1566
1770
|
const requestPath = source.slice(0, -"?module".length);
|
|
@@ -1636,9 +1840,9 @@ function hasFarmRuntimeConfigModule(config, configModulePath) {
|
|
|
1636
1840
|
return Boolean(configModulePath || (config.layers || []).some((layer) => layer.configFile));
|
|
1637
1841
|
}
|
|
1638
1842
|
function nameCodeSplittingGroups(bundlerConfig) {
|
|
1639
|
-
const outputs = _optionalChain([bundlerConfig, 'optionalAccess',
|
|
1843
|
+
const outputs = _optionalChain([bundlerConfig, 'optionalAccess', _60 => _60.output]);
|
|
1640
1844
|
for (const output of Array.isArray(outputs) ? outputs : [outputs]) {
|
|
1641
|
-
const groups = _optionalChain([output, 'optionalAccess',
|
|
1845
|
+
const groups = _optionalChain([output, 'optionalAccess', _61 => _61.codeSplitting, 'optionalAccess', _62 => _62.groups]);
|
|
1642
1846
|
if (!Array.isArray(groups)) continue;
|
|
1643
1847
|
groups.forEach((group, index) => {
|
|
1644
1848
|
if (group && typeof group.name === "function" && !group.debugName) {
|
|
@@ -1694,9 +1898,9 @@ function restoreLiteralModuleSpecifiers(code, fileName, { parseSync, Visitor })
|
|
|
1694
1898
|
if (needsAst) {
|
|
1695
1899
|
replacements.length = 0;
|
|
1696
1900
|
const restore = (node) => {
|
|
1697
|
-
if (_optionalChain([node, 'optionalAccess',
|
|
1901
|
+
if (_optionalChain([node, 'optionalAccess', _63 => _63.type]) !== "TemplateLiteral") return;
|
|
1698
1902
|
const template = node;
|
|
1699
|
-
const value = _optionalChain([template, 'access',
|
|
1903
|
+
const value = _optionalChain([template, 'access', _64 => _64.quasis, 'access', _65 => _65[0], 'optionalAccess', _66 => _66.value, 'access', _67 => _67.cooked]);
|
|
1700
1904
|
if (template.expressions.length > 0 || typeof value !== "string") return;
|
|
1701
1905
|
replacements.push({
|
|
1702
1906
|
start: template.start,
|
|
@@ -1774,7 +1978,7 @@ function hasProjectPostcssConfig(root) {
|
|
|
1774
1978
|
try {
|
|
1775
1979
|
projectRequire.resolve(`./${file}`);
|
|
1776
1980
|
return true;
|
|
1777
|
-
} catch (
|
|
1981
|
+
} catch (e22) {
|
|
1778
1982
|
return false;
|
|
1779
1983
|
}
|
|
1780
1984
|
});
|
|
@@ -1796,14 +2000,14 @@ async function findFarmConfigPath(root) {
|
|
|
1796
2000
|
try {
|
|
1797
2001
|
await fs4.access(resolvedPath);
|
|
1798
2002
|
return resolvedPath;
|
|
1799
|
-
} catch (
|
|
2003
|
+
} catch (e23) {
|
|
1800
2004
|
}
|
|
1801
2005
|
}
|
|
1802
2006
|
return null;
|
|
1803
2007
|
}
|
|
1804
2008
|
function hasFarmServerRuntimePlugins(config) {
|
|
1805
2009
|
return (config.plugins || []).some((plugin) => {
|
|
1806
|
-
if (
|
|
2010
|
+
if (_chunkBDYM2TN3cjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) === false) return false;
|
|
1807
2011
|
return Boolean(
|
|
1808
2012
|
plugin.setup || plugin.init || plugin.ready || plugin.shutdown || plugin.runtime || plugin.router || plugin.render || plugin.beforeRouteMatch || plugin.afterRouteMatch || plugin.beforeRender || plugin.afterRender || plugin.onError || plugin.transformHTML
|
|
1809
2013
|
);
|
|
@@ -1814,7 +2018,7 @@ function hasFarmPluginRoutes(config) {
|
|
|
1814
2018
|
}
|
|
1815
2019
|
function farmServerRuntimePluginsMayHandlePath(config, pathname) {
|
|
1816
2020
|
return (config.plugins || []).some(
|
|
1817
|
-
(plugin) =>
|
|
2021
|
+
(plugin) => _chunkBDYM2TN3cjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) !== false && // Mobile session tokens change only bearer requests and cookie-clearing responses, which a
|
|
1818
2022
|
// prerendered file never answers or sends; its endpoints live under /__farm/.
|
|
1819
2023
|
plugin.name !== _chunk4BS3HSY7cjs.FARM_MOBILE_SESSION_PLUGIN && _chunk47JV57DAcjs.farmPluginMayAffectRuntimePath.call(void 0, plugin, pathname)
|
|
1820
2024
|
);
|
|
@@ -1827,7 +2031,7 @@ async function discoverMiddlewareRoutes(appDir) {
|
|
|
1827
2031
|
let entries;
|
|
1828
2032
|
try {
|
|
1829
2033
|
entries = await fs4.readdir(dir, { withFileTypes: true });
|
|
1830
|
-
} catch (
|
|
2034
|
+
} catch (e24) {
|
|
1831
2035
|
return;
|
|
1832
2036
|
}
|
|
1833
2037
|
const middlewareFile = entries.find(
|
|
@@ -1862,7 +2066,7 @@ async function discoverMiddlewareRoutes(appDir) {
|
|
|
1862
2066
|
return Array.from(routes.values()).sort(_chunkMHLNWRCJcjs.compareMiddlewareRouteLocations).map(({ path: routePath, filePath }) => ({ path: routePath, filePath }));
|
|
1863
2067
|
}
|
|
1864
2068
|
function assertFarmDocsRuntimeSupported(config, preset) {
|
|
1865
|
-
if (!_optionalChain([config, 'access',
|
|
2069
|
+
if (!_optionalChain([config, 'access', _68 => _68.docs, 'optionalAccess', _69 => _69.enabled]) || !_optionalChain([config, 'access', _70 => _70.docs, 'access', _71 => _71.adapter, 'optionalAccess', _72 => _72.server]) || _chunkF43OG25Pcjs.getFarmPresetRuntime.call(void 0, preset) !== "edge" || Boolean(config.docs.adapter.edgeCompiler)) {
|
|
1866
2070
|
return;
|
|
1867
2071
|
}
|
|
1868
2072
|
throw new Error(
|
|
@@ -1875,7 +2079,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1875
2079
|
assertFarmDocsRuntimeSupported(config, preset);
|
|
1876
2080
|
const srcDir = config.srcDir || "src";
|
|
1877
2081
|
const distDir = config.distDir || ".farm";
|
|
1878
|
-
const deployOutputDir =
|
|
2082
|
+
const deployOutputDir = _chunk556H7JCEcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
1879
2083
|
const lifecyclePluginManager = options.pluginManager;
|
|
1880
2084
|
const productionViteResultPromise = Promise.allSettled([
|
|
1881
2085
|
Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkMF3IA2AWcjs.loadFarmProductionVite.call(void 0, ))))
|
|
@@ -1894,7 +2098,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1894
2098
|
const routeRuntimeManifestResultPromise = Promise.allSettled([routeRuntimeManifestPromise]);
|
|
1895
2099
|
const pageRoutes = [];
|
|
1896
2100
|
for (const [pattern, entry] of routeManager.getRoutes()) {
|
|
1897
|
-
const markdownSourcePath = entry.markdownSourcePath || (
|
|
2101
|
+
const markdownSourcePath = entry.markdownSourcePath || (_chunkQ37INCXGcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? entry.modulePath : void 0);
|
|
1898
2102
|
pageRoutes.push({
|
|
1899
2103
|
pattern,
|
|
1900
2104
|
...entry.directory ? { directory: entry.directory } : {},
|
|
@@ -1936,7 +2140,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1936
2140
|
await findLayoutsForClient(_path2.default.join(dir, entry.name), childPrefix);
|
|
1937
2141
|
}
|
|
1938
2142
|
}
|
|
1939
|
-
} catch (
|
|
2143
|
+
} catch (e25) {
|
|
1940
2144
|
}
|
|
1941
2145
|
}
|
|
1942
2146
|
await findLayoutsForClient(appDir);
|
|
@@ -1966,21 +2170,29 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
1966
2170
|
const productionVite = productionViteResult.value;
|
|
1967
2171
|
_chunkQMNWKQL4cjs.logger.info("\u26A1 Building application bundles with Vite Rolldown");
|
|
1968
2172
|
const mobileClient = shouldBuildFarmMobileClient(config);
|
|
1969
|
-
const
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
2173
|
+
const rendererDisabled = _chunk67MZTLTFcjs.isFarmRendererDisabled.call(void 0, config.renderer);
|
|
2174
|
+
const buildClientBundle = async () => {
|
|
2175
|
+
if (rendererDisabled) {
|
|
2176
|
+
await fs4.rm(clientOutputDir, { recursive: true, force: true });
|
|
2177
|
+
await fs4.mkdir(clientOutputDir, { recursive: true });
|
|
2178
|
+
return;
|
|
2179
|
+
}
|
|
2180
|
+
return buildClient(
|
|
2181
|
+
productionVite,
|
|
2182
|
+
config,
|
|
2183
|
+
root,
|
|
2184
|
+
srcDir,
|
|
2185
|
+
clientOutputDir,
|
|
2186
|
+
pageRoutes,
|
|
2187
|
+
layoutRoutes,
|
|
2188
|
+
routeSlots,
|
|
2189
|
+
isolatedClientBoundaryModules,
|
|
2190
|
+
hydrationPlanCache,
|
|
2191
|
+
rendererBuildLifetime,
|
|
2192
|
+
routeManager.getProgrammaticClientRoutes(),
|
|
2193
|
+
mobileClient
|
|
2194
|
+
);
|
|
2195
|
+
};
|
|
1984
2196
|
const buildSSRBundle = () => buildSSRInMemory(
|
|
1985
2197
|
productionVite,
|
|
1986
2198
|
config,
|
|
@@ -1998,12 +2210,14 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
1998
2210
|
);
|
|
1999
2211
|
let clientBuildResult;
|
|
2000
2212
|
let ssrBuildResult;
|
|
2001
|
-
if (config.renderer.buildConcurrency === "serial") {
|
|
2213
|
+
if (!rendererDisabled && config.renderer.buildConcurrency === "serial") {
|
|
2002
2214
|
_chunkQMNWKQL4cjs.logger.info(`\u{1F4E6} Building client and SSR bundles serially for ${config.renderer.name}...`);
|
|
2003
2215
|
[clientBuildResult] = await Promise.allSettled([buildClientBundle()]);
|
|
2004
2216
|
[ssrBuildResult] = await Promise.allSettled([buildSSRBundle()]);
|
|
2005
2217
|
} else {
|
|
2006
|
-
_chunkQMNWKQL4cjs.logger.info(
|
|
2218
|
+
_chunkQMNWKQL4cjs.logger.info(
|
|
2219
|
+
rendererDisabled ? "\u{1F4E6} Building the server bundle (renderer: false, no client bundle)..." : "\u{1F4E6} Building client and SSR bundles in parallel..."
|
|
2220
|
+
);
|
|
2007
2221
|
[clientBuildResult, ssrBuildResult] = await Promise.allSettled([
|
|
2008
2222
|
buildClientBundle(),
|
|
2009
2223
|
buildSSRBundle()
|
|
@@ -2049,6 +2263,7 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
2049
2263
|
_chunkQMNWKQL4cjs.logger.warn(warning);
|
|
2050
2264
|
}
|
|
2051
2265
|
const { bundle: ssrBundle, entryFile: ssrEntryFile, configuredHeaderRoutes } = ssrResult;
|
|
2266
|
+
assertServerReadSSRAssetsSupported(ssrBundle, preset, root);
|
|
2052
2267
|
await writeSSRAssetsToClient(ssrBundle, clientOutputDir);
|
|
2053
2268
|
if (config.docs.enabled) {
|
|
2054
2269
|
await copyFarmDocsFontAssetsToClient(root, clientOutputDir);
|
|
@@ -2089,7 +2304,7 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
2089
2304
|
_chunkQMNWKQL4cjs.logger.error(`\u274C Build failed: ${error}`);
|
|
2090
2305
|
throw error;
|
|
2091
2306
|
} finally {
|
|
2092
|
-
_optionalChain([rendererBuild, 'optionalAccess',
|
|
2307
|
+
_optionalChain([rendererBuild, 'optionalAccess', _73 => _73.abort, 'call', _74 => _74()]);
|
|
2093
2308
|
}
|
|
2094
2309
|
}
|
|
2095
2310
|
function shouldBuildFarmMobileClient(config) {
|
|
@@ -2098,7 +2313,7 @@ function shouldBuildFarmMobileClient(config) {
|
|
|
2098
2313
|
function varyFarmNitroCacheRulesByShell(rules) {
|
|
2099
2314
|
return Object.fromEntries(
|
|
2100
2315
|
Object.entries(rules).map(([source, rule]) => {
|
|
2101
|
-
const cached = _optionalChain([rule, 'optionalAccess',
|
|
2316
|
+
const cached = _optionalChain([rule, 'optionalAccess', _75 => _75.swr]) !== void 0 && rule.swr !== false || _optionalChain([rule, 'optionalAccess', _76 => _76.cache]) !== void 0 && rule.cache !== false;
|
|
2102
2317
|
if (!cached || rule.cache === false) return [source, rule];
|
|
2103
2318
|
const cache = rule.cache && typeof rule.cache === "object" ? rule.cache : {};
|
|
2104
2319
|
const varies = [...Array.isArray(cache.varies) ? cache.varies : [], "x-farm-shell"];
|
|
@@ -2108,8 +2323,9 @@ function varyFarmNitroCacheRulesByShell(rules) {
|
|
|
2108
2323
|
}
|
|
2109
2324
|
async function writeSSRAssetsToClient(bundle, outputDir) {
|
|
2110
2325
|
const fs4 = await import("fs/promises");
|
|
2326
|
+
const serverOnlyAssets = collectServerOnlySSRAssets(bundle);
|
|
2111
2327
|
for (const [fileName, output] of Object.entries(bundle)) {
|
|
2112
|
-
if (output.type !== "asset") continue;
|
|
2328
|
+
if (output.type !== "asset" || serverOnlyAssets.has(fileName)) continue;
|
|
2113
2329
|
if (fileName === "farm-fonts.css") {
|
|
2114
2330
|
await mergeBuiltFontCss(outputDir, output.source);
|
|
2115
2331
|
continue;
|
|
@@ -2136,7 +2352,7 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
|
|
|
2136
2352
|
if (fontCss === void 0) {
|
|
2137
2353
|
try {
|
|
2138
2354
|
fontCss = await fs4.readFile(fontCssPath);
|
|
2139
|
-
} catch (
|
|
2355
|
+
} catch (e26) {
|
|
2140
2356
|
return;
|
|
2141
2357
|
}
|
|
2142
2358
|
}
|
|
@@ -2144,11 +2360,11 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
|
|
|
2144
2360
|
let clientCss = "";
|
|
2145
2361
|
try {
|
|
2146
2362
|
clientCss = await fs4.readFile(clientCssPath, "utf8");
|
|
2147
|
-
} catch (
|
|
2363
|
+
} catch (e27) {
|
|
2148
2364
|
}
|
|
2149
2365
|
const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
|
|
2150
2366
|
await fs4.writeFile(fontCssPath, normalizedFontCss);
|
|
2151
|
-
await fs4.writeFile(clientCssPath,
|
|
2367
|
+
await fs4.writeFile(clientCssPath, _chunkN5DQMOAGcjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
|
|
2152
2368
|
}
|
|
2153
2369
|
var IncompleteClientBuildOutputError = class extends Error {
|
|
2154
2370
|
constructor(detail) {
|
|
@@ -2164,7 +2380,7 @@ async function validateClientBuildOutput(root, srcDir, outputDir) {
|
|
|
2164
2380
|
try {
|
|
2165
2381
|
const clientEntry = await fs4.stat(clientEntryPath);
|
|
2166
2382
|
if (clientEntry.isFile()) clientEntrySize = clientEntry.size;
|
|
2167
|
-
} catch (
|
|
2383
|
+
} catch (e28) {
|
|
2168
2384
|
}
|
|
2169
2385
|
if (clientEntrySize === 0) {
|
|
2170
2386
|
throw new IncompleteClientBuildOutputError("farm-client.js is missing or empty");
|
|
@@ -2175,7 +2391,7 @@ async function validateClientBuildOutput(root, srcDir, outputDir) {
|
|
|
2175
2391
|
try {
|
|
2176
2392
|
const globalsCss = await fs4.readFile(globalsCssPath, "utf8");
|
|
2177
2393
|
expectsCss = globalsCss.replace(/\/\*[\s\S]*?\*\//g, "").trim().length > 0;
|
|
2178
|
-
} catch (
|
|
2394
|
+
} catch (e29) {
|
|
2179
2395
|
}
|
|
2180
2396
|
try {
|
|
2181
2397
|
const clientCss = await fs4.stat(clientCssPath);
|
|
@@ -2194,16 +2410,16 @@ function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, optio
|
|
|
2194
2410
|
const key = `${_path2.default.resolve(root)}\0${mode}\0${options.asyncOwnerIslands === true}\0${options.serverOwners === true}\0${options.serverTreeLayouts === true}\0${_path2.default.resolve(modulePath)}`;
|
|
2195
2411
|
let plan = cache.get(key);
|
|
2196
2412
|
if (!plan) {
|
|
2197
|
-
plan =
|
|
2413
|
+
plan = _chunk4DRINDGNcjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
|
|
2198
2414
|
cache.set(key, plan);
|
|
2199
2415
|
}
|
|
2200
2416
|
return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
|
|
2201
2417
|
}
|
|
2202
2418
|
async function buildClient(productionVite, config, root, srcDir, outputDir, pageRoutes, layoutRoutes = [], routeSlots = [], isolatedClientBoundaryModules = /* @__PURE__ */ new Set(), hydrationPlanCache = /* @__PURE__ */ new Map(), rendererBuildLifetime, programmaticClientRoutes, mobile = false) {
|
|
2203
|
-
if (!mobile) await
|
|
2419
|
+
if (!mobile) await _chunkE5UN4OWXcjs.removeFarmMobileClientManifest.call(void 0, _path2.default.dirname(outputDir));
|
|
2204
2420
|
const viteBuild = productionVite.build;
|
|
2205
2421
|
const { farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.cjs");
|
|
2206
|
-
const { PluginManager: PluginManager2 } = await import("./plugin-
|
|
2422
|
+
const { PluginManager: PluginManager2 } = await import("./plugin-WIU4GDD4.cjs");
|
|
2207
2423
|
const fs4 = await import("fs/promises");
|
|
2208
2424
|
const pluginManager = new PluginManager2({
|
|
2209
2425
|
config,
|
|
@@ -2212,31 +2428,31 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2212
2428
|
});
|
|
2213
2429
|
pluginManager.addPlugins(config.plugins || []);
|
|
2214
2430
|
const clientPages = [];
|
|
2215
|
-
const integrationProviders =
|
|
2431
|
+
const integrationProviders = _chunkBDYM2TN3cjs.getIntegrationProviders.call(void 0, config.integrations).filter(
|
|
2216
2432
|
(provider) => provider.component || provider.type === "clerk"
|
|
2217
2433
|
);
|
|
2218
2434
|
const unsupportedIntegrationProvider = integrationProviders.find(
|
|
2219
2435
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
2220
2436
|
);
|
|
2221
|
-
if (_optionalChain([config, 'access',
|
|
2437
|
+
if (_optionalChain([config, 'access', _77 => _77.experimental, 'optionalAccess', _78 => _78.isolatedClientHydration]) === "enabled" && _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _79 => _79.experimental, 'optionalAccess', _80 => _80.serverComponents])) !== "rsc" && unsupportedIntegrationProvider) {
|
|
2222
2438
|
_chunkQMNWKQL4cjs.logger.warn(
|
|
2223
2439
|
`[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
|
|
2224
2440
|
);
|
|
2225
2441
|
}
|
|
2226
|
-
const isolatedMode =
|
|
2227
|
-
_optionalChain([config, 'access',
|
|
2442
|
+
const isolatedMode = _chunk4DRINDGNcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
2443
|
+
_optionalChain([config, 'access', _81 => _81.experimental, 'optionalAccess', _82 => _82.isolatedClientHydration]),
|
|
2228
2444
|
{
|
|
2229
|
-
serverComponents:
|
|
2445
|
+
serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _83 => _83.experimental, 'optionalAccess', _84 => _84.serverComponents])) === "rsc",
|
|
2230
2446
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
2231
2447
|
}
|
|
2232
2448
|
);
|
|
2233
|
-
const planOptions =
|
|
2449
|
+
const planOptions = _chunk4DRINDGNcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
2234
2450
|
config.renderer,
|
|
2235
2451
|
Boolean(unsupportedIntegrationProvider)
|
|
2236
2452
|
);
|
|
2237
2453
|
const pagePlanOptions = {
|
|
2238
2454
|
...planOptions,
|
|
2239
|
-
serverOwners:
|
|
2455
|
+
serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _85 => _85.experimental, 'optionalAccess', _86 => _86.serverComponents])) === "islands"
|
|
2240
2456
|
};
|
|
2241
2457
|
const layoutPlanOptions = {
|
|
2242
2458
|
...planOptions,
|
|
@@ -2287,22 +2503,22 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2287
2503
|
};
|
|
2288
2504
|
}
|
|
2289
2505
|
});
|
|
2290
|
-
const layoutAppliesToRoute =
|
|
2506
|
+
const layoutAppliesToRoute = _chunkUPOYKX4Scjs.routeBoundaryCoversDirectory;
|
|
2291
2507
|
const routeDirectory = (route) => _nullishCoalesce(route.directory, () => ( route.pattern));
|
|
2292
|
-
const islandsMode =
|
|
2508
|
+
const islandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _87 => _87.experimental, 'optionalAccess', _88 => _88.serverComponents])) === "islands";
|
|
2293
2509
|
const adapterOwnsDocsRuntime = Boolean(
|
|
2294
|
-
|
|
2510
|
+
_chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _89 => _89.docs, 'optionalAccess', _90 => _90.enabled]) && _optionalChain([config, 'access', _91 => _91.docs, 'access', _92 => _92.adapter, 'optionalAccess', _93 => _93.server]) && config.docs.adapter.react
|
|
2295
2511
|
);
|
|
2296
|
-
const docsEntries = _optionalChain([config, 'access',
|
|
2512
|
+
const docsEntries = _optionalChain([config, 'access', _94 => _94.docs, 'optionalAccess', _95 => _95.enabled]) ? _chunkPPX7UOFYcjs.getFarmDocsRoots.call(void 0, config.docs).map(
|
|
2297
2513
|
(docsRoot) => `/${docsRoot.entry || "docs"}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/"
|
|
2298
2514
|
) : [];
|
|
2299
2515
|
const adapterDocsEntry = _nullishCoalesce(docsEntries[0], () => ( null));
|
|
2300
2516
|
const isAdapterDocsRoute = (routePattern) => adapterOwnsDocsRuntime && docsEntries.some(
|
|
2301
2517
|
(docsEntry) => docsEntry === "/" || routePattern === docsEntry || routePattern.startsWith(`${docsEntry}/`)
|
|
2302
2518
|
);
|
|
2303
|
-
const syntheticDocsEntry = _optionalChain([config, 'access',
|
|
2519
|
+
const syntheticDocsEntry = _optionalChain([config, 'access', _96 => _96.docs, 'optionalAccess', _97 => _97.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
|
|
2304
2520
|
const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
|
|
2305
|
-
const markdownPagePlan =
|
|
2521
|
+
const markdownPagePlan = _chunk4DRINDGNcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
2306
2522
|
_chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), root),
|
|
2307
2523
|
root,
|
|
2308
2524
|
isolatedMode,
|
|
@@ -2310,7 +2526,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2310
2526
|
);
|
|
2311
2527
|
const routePlans = pageRoutes.map((route) => ({
|
|
2312
2528
|
route,
|
|
2313
|
-
metadata:
|
|
2529
|
+
metadata: _chunkQ37INCXGcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
|
|
2314
2530
|
route.modulePath,
|
|
2315
2531
|
root,
|
|
2316
2532
|
isolatedMode,
|
|
@@ -2318,7 +2534,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2318
2534
|
pagePlanOptions
|
|
2319
2535
|
)
|
|
2320
2536
|
}));
|
|
2321
|
-
|
|
2537
|
+
_chunk4DRINDGNcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
2322
2538
|
clientLayouts.map((layout) => ({
|
|
2323
2539
|
pattern: layout.pattern,
|
|
2324
2540
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -2327,7 +2543,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2327
2543
|
[
|
|
2328
2544
|
...routePlans.map(({ route, metadata }) => ({
|
|
2329
2545
|
pattern: routeDirectory(route),
|
|
2330
|
-
depth:
|
|
2546
|
+
depth: _chunkUPOYKX4Scjs.getRouteDirectoryDepth.call(void 0, routeDirectory(route)),
|
|
2331
2547
|
metadata
|
|
2332
2548
|
})),
|
|
2333
2549
|
...syntheticDocsPatterns.map((pattern) => ({
|
|
@@ -2351,7 +2567,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2351
2567
|
for (const layout of clientLayouts) {
|
|
2352
2568
|
const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, routeDirectory(route))) || docsEntries.some((docsEntry) => layoutAppliesToRoute(layout.pattern, docsEntry));
|
|
2353
2569
|
if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
|
|
2354
|
-
_chunkQMNWKQL4cjs.logger.warn(`\u26A0\uFE0F ${
|
|
2570
|
+
_chunkQMNWKQL4cjs.logger.warn(`\u26A0\uFE0F ${_chunk4DRINDGNcjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
|
|
2355
2571
|
}
|
|
2356
2572
|
}
|
|
2357
2573
|
if (isolatedMode === "analyze") {
|
|
@@ -2367,6 +2583,16 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2367
2583
|
);
|
|
2368
2584
|
}
|
|
2369
2585
|
}
|
|
2586
|
+
const serverSlotPlans = islandsMode ? routeSlots.flatMap((slot) => {
|
|
2587
|
+
const plan = getCachedClientModuleHydrationPlan(
|
|
2588
|
+
slot.modulePath,
|
|
2589
|
+
root,
|
|
2590
|
+
isolatedMode,
|
|
2591
|
+
hydrationPlanCache,
|
|
2592
|
+
{ ...pagePlanOptions, serverOwners: true }
|
|
2593
|
+
);
|
|
2594
|
+
return plan.isClientComponent ? [] : [{ slot, plan }];
|
|
2595
|
+
}) : [];
|
|
2370
2596
|
for (const { route, metadata } of routePlans) {
|
|
2371
2597
|
if (isAdapterDocsRoute(route.pattern)) continue;
|
|
2372
2598
|
try {
|
|
@@ -2375,12 +2601,15 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2375
2601
|
);
|
|
2376
2602
|
if (metadata.suppressedAsyncHydration) {
|
|
2377
2603
|
_chunkQMNWKQL4cjs.logger.warn(
|
|
2378
|
-
`\u26A0\uFE0F ${
|
|
2604
|
+
`\u26A0\uFE0F ${_chunk4DRINDGNcjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
|
|
2379
2605
|
);
|
|
2380
2606
|
}
|
|
2381
|
-
|
|
2607
|
+
const slotBoundaries = serverSlotPlans.filter(
|
|
2608
|
+
({ slot }) => layoutAppliesToRoute(_nullishCoalesce(slot.ownerDirectory, () => ( slot.ownerPattern)), routeDirectory(route))
|
|
2609
|
+
).flatMap(({ plan }) => plan.isolatedBoundaries);
|
|
2610
|
+
if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0 || slotBoundaries.length > 0) {
|
|
2382
2611
|
const relativePath = route.modulePath.replace(root, "").replace(/^\//, "");
|
|
2383
|
-
const islandStrategy =
|
|
2612
|
+
const islandStrategy = _chunkN5DQMOAGcjs.resolveFarmRouteRootStrategy.call(void 0,
|
|
2384
2613
|
route,
|
|
2385
2614
|
metadata,
|
|
2386
2615
|
clientLayouts,
|
|
@@ -2392,13 +2621,14 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2392
2621
|
relativePath,
|
|
2393
2622
|
pageShouldHydrate: metadata.shouldHydrate,
|
|
2394
2623
|
islandStrategy,
|
|
2395
|
-
hasIsolatedClientBoundaries: metadata.hasIsolatedClientBoundaries || applicableClientLayouts.some((layout) => layout.hasIsolatedClientBoundaries),
|
|
2624
|
+
hasIsolatedClientBoundaries: metadata.hasIsolatedClientBoundaries || applicableClientLayouts.some((layout) => layout.hasIsolatedClientBoundaries) || slotBoundaries.length > 0,
|
|
2396
2625
|
isolatedBoundaries: [
|
|
2397
2626
|
...metadata.hasIsolatedClientBoundaries ? metadata.isolatedBoundaries : [],
|
|
2627
|
+
...slotBoundaries,
|
|
2398
2628
|
...applicableClientLayouts.filter((layout) => layout.hasIsolatedClientBoundaries || layout.serverTreeLayout).flatMap((layout) => layout.isolatedBoundaries)
|
|
2399
2629
|
],
|
|
2400
2630
|
// The server renders a server tree only below a hydrating layout.
|
|
2401
|
-
...
|
|
2631
|
+
..._chunk4DRINDGNcjs.usesFarmServerTree.call(void 0, metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
|
|
2402
2632
|
});
|
|
2403
2633
|
_chunkQMNWKQL4cjs.logger.info(`\u{1F4F1} Found hydratable route: ${route.pattern} -> ${route.modulePath}`);
|
|
2404
2634
|
}
|
|
@@ -2434,7 +2664,8 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2434
2664
|
}
|
|
2435
2665
|
const clientRouteSlots = routeSlots.filter((slot) => {
|
|
2436
2666
|
try {
|
|
2437
|
-
|
|
2667
|
+
const metadata = _chunk4DRINDGNcjs.getClientModuleMetadata.call(void 0, slot.modulePath, root);
|
|
2668
|
+
return metadata.shouldHydrate && (!islandsMode || metadata.isClientComponent);
|
|
2438
2669
|
} catch (error) {
|
|
2439
2670
|
_chunkQMNWKQL4cjs.logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
|
|
2440
2671
|
return false;
|
|
@@ -2456,20 +2687,20 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2456
2687
|
srcDir,
|
|
2457
2688
|
adapterOwnsDocsRuntime ? false : _chunkDZZHTMWMcjs.isFarmDocsSearchEnabled.call(void 0, config.docs),
|
|
2458
2689
|
adapterOwnsDocsRuntime ? void 0 : _chunkDZZHTMWMcjs.resolveFarmDocsSearchClientModule.call(void 0, root),
|
|
2459
|
-
_optionalChain([config, 'access',
|
|
2460
|
-
adapterOwnsDocsRuntime ? _optionalChain([config, 'access',
|
|
2690
|
+
_optionalChain([config, 'access', _98 => _98.docs, 'optionalAccess', _99 => _99.enabled]) ? _chunkPPX7UOFYcjs.getFarmDocsRoots.call(void 0, config.docs).map((docsRoot) => docsRoot.entry) : void 0,
|
|
2691
|
+
adapterOwnsDocsRuntime ? _optionalChain([config, 'access', _100 => _100.docs, 'access', _101 => _101.adapter, 'optionalAccess', _102 => _102.react]) : void 0,
|
|
2461
2692
|
config.i18n,
|
|
2462
2693
|
config.plugins,
|
|
2463
2694
|
config.renderer,
|
|
2464
2695
|
config.publicRuntimeConfig,
|
|
2465
2696
|
config.trailingSlash,
|
|
2466
|
-
|
|
2697
|
+
_chunkBDYM2TN3cjs.getIntegrationProviders.call(void 0, config.integrations),
|
|
2467
2698
|
config.basePath,
|
|
2468
|
-
|
|
2699
|
+
_chunkN5DQMOAGcjs.generateClientCachePersistenceCode.call(void 0, _chunkN5DQMOAGcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
|
|
2469
2700
|
adapterOwnsDocsRuntime ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0,
|
|
2470
|
-
|
|
2701
|
+
_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _103 => _103.experimental, 'optionalAccess', _104 => _104.serverComponents])) === "islands",
|
|
2471
2702
|
platform,
|
|
2472
|
-
islandsMode ?
|
|
2703
|
+
islandsMode ? _chunk4DRINDGNcjs.collectFarmServerStylesheets.call(void 0,
|
|
2473
2704
|
[
|
|
2474
2705
|
...layoutRoutes.map((layout) => layout.modulePath),
|
|
2475
2706
|
...pageRoutes.filter((route) => !isAdapterDocsRoute(route.pattern)).map((route) => route.modulePath)
|
|
@@ -2477,10 +2708,14 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2477
2708
|
root
|
|
2478
2709
|
) : []
|
|
2479
2710
|
);
|
|
2480
|
-
const entryName = platform === "mobile" ?
|
|
2481
|
-
|
|
2711
|
+
const entryName = platform === "mobile" ? _chunkE5UN4OWXcjs.FARM_MOBILE_CLIENT_ENTRY_NAME : "farm-client";
|
|
2712
|
+
const clientEntry = islandsMode && platform === "web" && clientHydrationCode.includes("/*farm-router-stub*/") ? splitFarmClientRouter(clientHydrationCode) : { entry: clientHydrationCode, router: void 0 };
|
|
2713
|
+
await fs4.writeFile(clientEntryPath, clientEntry.entry);
|
|
2714
|
+
if (clientEntry.router !== void 0) {
|
|
2715
|
+
await fs4.writeFile(_path2.default.join(clientEntryDir, "farm-client-router.tsx"), clientEntry.router);
|
|
2716
|
+
}
|
|
2482
2717
|
const clientInput = { [entryName]: clientEntryPath };
|
|
2483
|
-
if (platform === "web" &&
|
|
2718
|
+
if (platform === "web" && _chunkN5DQMOAGcjs.canBootFarmIslandsClient.call(void 0, config)) {
|
|
2484
2719
|
const clientBootPath = _path2.default.join(clientEntryDir, "farm-client-boot.tsx");
|
|
2485
2720
|
await fs4.writeFile(
|
|
2486
2721
|
clientBootPath,
|
|
@@ -2491,7 +2726,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2491
2726
|
const hasScopedPostcssConfig = hasProjectPostcssConfig(root);
|
|
2492
2727
|
let postcssSearchPath;
|
|
2493
2728
|
let tailwindVitePlugin = void 0;
|
|
2494
|
-
const rendererVitePlugins = await
|
|
2729
|
+
const rendererVitePlugins = await _chunk67MZTLTFcjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, root, {
|
|
2495
2730
|
ssr: false,
|
|
2496
2731
|
buildLifetime: rendererBuildLifetime
|
|
2497
2732
|
});
|
|
@@ -2501,7 +2736,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2501
2736
|
const postcssConfigPath = _path2.default.join(clientEntryDir, "postcss.config.cjs");
|
|
2502
2737
|
await fs4.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
|
|
2503
2738
|
postcssSearchPath = clientEntryDir;
|
|
2504
|
-
tailwindVitePlugin = await
|
|
2739
|
+
tailwindVitePlugin = await _chunkJSOCDYERcjs.loadTailwindVitePlugin.call(void 0, {
|
|
2505
2740
|
builder: productionVite.builder,
|
|
2506
2741
|
announce: true
|
|
2507
2742
|
});
|
|
@@ -2523,7 +2758,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2523
2758
|
outDir: outputDir,
|
|
2524
2759
|
emptyOutDir: platform === "web",
|
|
2525
2760
|
// Never public: see resolveFarmClientSourcemap.
|
|
2526
|
-
sourcemap: resolveFarmClientSourcemap(_optionalChain([config, 'access',
|
|
2761
|
+
sourcemap: resolveFarmClientSourcemap(_optionalChain([config, 'access', _105 => _105.vite, 'optionalAccess', _106 => _106.build, 'optionalAccess', _107 => _107.sourcemap])),
|
|
2527
2762
|
assetsInlineLimit: 0,
|
|
2528
2763
|
cssCodeSplit: false,
|
|
2529
2764
|
// Bundle all CSS into one file
|
|
@@ -2535,7 +2770,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2535
2770
|
hashCharacters: "hex",
|
|
2536
2771
|
// Use predictable name for CSS so we can reference it in SSR HTML
|
|
2537
2772
|
assetFileNames: (assetInfo) => {
|
|
2538
|
-
if (_optionalChain([assetInfo, 'access',
|
|
2773
|
+
if (_optionalChain([assetInfo, 'access', _108 => _108.name, 'optionalAccess', _109 => _109.endsWith, 'call', _110 => _110(".css")])) {
|
|
2539
2774
|
return `${entryName}.css`;
|
|
2540
2775
|
}
|
|
2541
2776
|
return "assets/[name]-h[hash][extname]";
|
|
@@ -2552,7 +2787,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2552
2787
|
}
|
|
2553
2788
|
},
|
|
2554
2789
|
plugins: [
|
|
2555
|
-
|
|
2790
|
+
_chunkN5DQMOAGcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
2556
2791
|
createFarmPrivateClientSourcemapsPlugin({
|
|
2557
2792
|
outDir: _path2.default.join(
|
|
2558
2793
|
_path2.default.dirname(outputDir),
|
|
@@ -2560,7 +2795,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2560
2795
|
)
|
|
2561
2796
|
}),
|
|
2562
2797
|
// The web client's preload manifests; the mobile client records its files instead.
|
|
2563
|
-
platform === "mobile" ?
|
|
2798
|
+
platform === "mobile" ? _chunkE5UN4OWXcjs.createFarmMobileClientManifestPlugin.call(void 0, {
|
|
2564
2799
|
buildDir: _path2.default.dirname(outputDir),
|
|
2565
2800
|
entryName
|
|
2566
2801
|
}) : createFarmClientModulePreloadPlugin({
|
|
@@ -2584,7 +2819,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2584
2819
|
...rendererVitePlugins,
|
|
2585
2820
|
...config.vite.plugins || [],
|
|
2586
2821
|
farmServerOnlyEntriesPlugin({ platform }),
|
|
2587
|
-
|
|
2822
|
+
_chunkN5DQMOAGcjs.farmDocsClientConfigPlugin.call(void 0,
|
|
2588
2823
|
adapterOwnsDocsRuntime ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
|
|
2589
2824
|
),
|
|
2590
2825
|
// Plugin to redirect @farm.js/core imports to client-only exports
|
|
@@ -2638,7 +2873,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2638
2873
|
{ ...config, isolatedClientBoundaryModules, programmaticClientRoutes },
|
|
2639
2874
|
pluginManager
|
|
2640
2875
|
),
|
|
2641
|
-
|
|
2876
|
+
_chunk4DRINDGNcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
|
|
2642
2877
|
],
|
|
2643
2878
|
mode: "production",
|
|
2644
2879
|
css: postcssSearchPath ? {
|
|
@@ -2646,7 +2881,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2646
2881
|
} : void 0,
|
|
2647
2882
|
// Ensure React is bundled for client
|
|
2648
2883
|
resolve: {
|
|
2649
|
-
alias:
|
|
2884
|
+
alias: _chunkN5DQMOAGcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
2650
2885
|
dedupe: [...config.renderer.dedupe || []]
|
|
2651
2886
|
},
|
|
2652
2887
|
// Optimize dependencies - exclude server-side code from client bundle
|
|
@@ -2659,12 +2894,12 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2659
2894
|
]
|
|
2660
2895
|
}
|
|
2661
2896
|
};
|
|
2662
|
-
await viteBuild(
|
|
2897
|
+
await viteBuild(_chunkN5DQMOAGcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
|
|
2663
2898
|
if (platform === "mobile") {
|
|
2664
2899
|
await fs4.rm(_path2.default.join(outputDir, `${entryName}.css`), { force: true });
|
|
2665
|
-
if (!await
|
|
2900
|
+
if (!await _chunkE5UN4OWXcjs.hasFarmMobileClientEntry.call(void 0, _path2.default.dirname(outputDir), outputDir)) {
|
|
2666
2901
|
throw new IncompleteClientBuildOutputError(
|
|
2667
|
-
`${
|
|
2902
|
+
`${_chunkE5UN4OWXcjs.FARM_MOBILE_CLIENT_ENTRY_NAME}.js is missing or empty`
|
|
2668
2903
|
);
|
|
2669
2904
|
}
|
|
2670
2905
|
} else {
|
|
@@ -2674,7 +2909,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2674
2909
|
} finally {
|
|
2675
2910
|
try {
|
|
2676
2911
|
await fs4.rm(clientEntryDir, { recursive: true, force: true });
|
|
2677
|
-
} catch (
|
|
2912
|
+
} catch (e30) {
|
|
2678
2913
|
}
|
|
2679
2914
|
}
|
|
2680
2915
|
};
|
|
@@ -2703,6 +2938,7 @@ const IDLE_NAVIGATION_STATE = {
|
|
|
2703
2938
|
startedAt: null,
|
|
2704
2939
|
};
|
|
2705
2940
|
|
|
2941
|
+
/*farm-router-start*/
|
|
2706
2942
|
function createNavigationLocation(url) {
|
|
2707
2943
|
return {
|
|
2708
2944
|
href: url.href,
|
|
@@ -2758,7 +2994,7 @@ async function fetchFarmNavigationDocument(url, headers, recover = true, signal)
|
|
|
2758
2994
|
return response;
|
|
2759
2995
|
}
|
|
2760
2996
|
|
|
2761
|
-
${streamNavigations ?
|
|
2997
|
+
${streamNavigations ? _chunkN5DQMOAGcjs.FARM_NAVIGATION_STREAM_READER_SOURCE : ""}
|
|
2762
2998
|
|
|
2763
2999
|
function clearFarmPrefetchCacheOnDeploymentMismatch(router, error) {
|
|
2764
3000
|
if (error?.name === "FarmDeploymentMismatchError") {
|
|
@@ -2772,6 +3008,7 @@ function readHistoryIndex(state) {
|
|
|
2772
3008
|
return Number.isSafeInteger(value) ? value : null;
|
|
2773
3009
|
}
|
|
2774
3010
|
|
|
3011
|
+
/*farm-router-end*/
|
|
2775
3012
|
function hasAbsoluteNavigationHref(href) {
|
|
2776
3013
|
return /^[a-zA-Z][a-zA-Z\\d+.-]*:/.test(href) || href.startsWith("//");
|
|
2777
3014
|
}
|
|
@@ -3066,7 +3303,8 @@ ${streamNavigations ? ` // A streamed navigation swaps in the page's shell; its
|
|
|
3066
3303
|
this.activeViewportPrefetches += 1;
|
|
3067
3304
|
let prefetchResult;
|
|
3068
3305
|
try {
|
|
3069
|
-
|
|
3306
|
+
// Through the installed router, so the lazy router's stand-in sees viewport prefetches too.
|
|
3307
|
+
prefetchResult = (window.__FARM_SPA_ROUTER__ || this).prefetch(task.href);
|
|
3070
3308
|
} catch {
|
|
3071
3309
|
prefetchResult = undefined;
|
|
3072
3310
|
}
|
|
@@ -3469,6 +3707,188 @@ ${streamNavigations ? ` if (streamShell && response.body) {
|
|
|
3469
3707
|
},
|
|
3470
3708
|
`.trim();
|
|
3471
3709
|
}
|
|
3710
|
+
var FARM_LAZY_ROUTER_STUB = `let farmLoadedRouter = null;
|
|
3711
|
+
let farmRouterLoading = null;
|
|
3712
|
+
const farmRouterReady = [];
|
|
3713
|
+
const farmRouterObserved = new Set();
|
|
3714
|
+
|
|
3715
|
+
function loadFarmRouter() {
|
|
3716
|
+
return farmRouterLoading || (farmRouterLoading = import("./farm-client-router").then(function(module) {
|
|
3717
|
+
farmLoadedRouter = module.spaRouter;
|
|
3718
|
+
// The router module installs itself as the global; this object stays it, so a reference taken
|
|
3719
|
+
// before the router loaded, or a method wrapped on it, keeps working afterwards.
|
|
3720
|
+
window.__FARM_SPA_ROUTER__ = spaRouter;
|
|
3721
|
+
for (const ready of farmRouterReady.splice(0)) ready(farmLoadedRouter);
|
|
3722
|
+
if (farmRouterViewport) farmRouterViewport.disconnect();
|
|
3723
|
+
for (const element of farmRouterObserved) farmLoadedRouter.observeForPrefetch(element);
|
|
3724
|
+
farmRouterObserved.clear();
|
|
3725
|
+
return farmLoadedRouter;
|
|
3726
|
+
}, function(error) {
|
|
3727
|
+
farmRouterLoading = null;
|
|
3728
|
+
throw error;
|
|
3729
|
+
}));
|
|
3730
|
+
}
|
|
3731
|
+
|
|
3732
|
+
let farmRouterViewport = null;
|
|
3733
|
+
function farmRouterViewportObserver() {
|
|
3734
|
+
return farmRouterViewport || (farmRouterViewport = new IntersectionObserver(function(entries) {
|
|
3735
|
+
if (!entries.some(function(entry) { return entry.isIntersecting; })) return;
|
|
3736
|
+
farmRouterViewport.disconnect();
|
|
3737
|
+
void loadFarmRouter().catch(function() {});
|
|
3738
|
+
}, { rootMargin: "50px" }));
|
|
3739
|
+
}
|
|
3740
|
+
|
|
3741
|
+
function farmRouterCall(name, beforeLoad) {
|
|
3742
|
+
return function() {
|
|
3743
|
+
const args = arguments;
|
|
3744
|
+
if (farmLoadedRouter) return farmLoadedRouter[name].apply(farmLoadedRouter, args);
|
|
3745
|
+
if (beforeLoad) return beforeLoad.apply(null, args);
|
|
3746
|
+
return loadFarmRouter().then(function(router) { return router[name].apply(router, args); });
|
|
3747
|
+
};
|
|
3748
|
+
}
|
|
3749
|
+
|
|
3750
|
+
function farmRouterSubscribe(name, loadNow) {
|
|
3751
|
+
return function() {
|
|
3752
|
+
const args = arguments;
|
|
3753
|
+
if (farmLoadedRouter) return farmLoadedRouter[name].apply(farmLoadedRouter, args);
|
|
3754
|
+
let active = true;
|
|
3755
|
+
let cleanup;
|
|
3756
|
+
farmRouterReady.push(function(router) {
|
|
3757
|
+
if (active) cleanup = router[name].apply(router, args);
|
|
3758
|
+
});
|
|
3759
|
+
if (loadNow) void loadFarmRouter().catch(function() {});
|
|
3760
|
+
return function() {
|
|
3761
|
+
active = false;
|
|
3762
|
+
if (cleanup) cleanup();
|
|
3763
|
+
};
|
|
3764
|
+
};
|
|
3765
|
+
}
|
|
3766
|
+
|
|
3767
|
+
const farmRouterStandIn = {
|
|
3768
|
+
get currentPath() {
|
|
3769
|
+
return farmLoadedRouter ? farmLoadedRouter.currentPath : window.location.pathname + window.location.search;
|
|
3770
|
+
},
|
|
3771
|
+
navigate: function(href, options) {
|
|
3772
|
+
if (farmLoadedRouter) return farmLoadedRouter.navigate(href, options);
|
|
3773
|
+
return loadFarmRouter().then(function(router) {
|
|
3774
|
+
return router.navigate(href, options);
|
|
3775
|
+
}, function() {
|
|
3776
|
+
if (options && (options.replace || options.action === "replace")) window.location.replace(href);
|
|
3777
|
+
else window.location.assign(href);
|
|
3778
|
+
});
|
|
3779
|
+
},
|
|
3780
|
+
refresh: farmRouterCall("refresh"),
|
|
3781
|
+
prefetch: farmRouterCall("prefetch"),
|
|
3782
|
+
// A watched link loads the router once it nears the viewport, which then prefetches it.
|
|
3783
|
+
observeForPrefetch: farmRouterCall("observeForPrefetch", function(element) {
|
|
3784
|
+
if (!("IntersectionObserver" in window)) return;
|
|
3785
|
+
farmRouterObserved.add(element);
|
|
3786
|
+
farmRouterViewportObserver().observe(element);
|
|
3787
|
+
}),
|
|
3788
|
+
unobserveForPrefetch: farmRouterCall("unobserveForPrefetch", function(element) {
|
|
3789
|
+
farmRouterObserved.delete(element);
|
|
3790
|
+
if (farmRouterViewport) farmRouterViewport.unobserve(element);
|
|
3791
|
+
}),
|
|
3792
|
+
pushState: farmRouterCall("pushState"),
|
|
3793
|
+
replaceState: farmRouterCall("replaceState"),
|
|
3794
|
+
handlePopState: farmRouterCall("handlePopState"),
|
|
3795
|
+
getNavigationState: farmRouterCall("getNavigationState", function() { return IDLE_NAVIGATION_STATE; }),
|
|
3796
|
+
shouldBlockUnload: farmRouterCall("shouldBlockUnload", function() { return false; }),
|
|
3797
|
+
saveScrollPosition: farmRouterCall("saveScrollPosition", function() {}),
|
|
3798
|
+
subscribeNavigation: farmRouterSubscribe("subscribeNavigation", false),
|
|
3799
|
+
addBlocker: farmRouterSubscribe("addBlocker", true),
|
|
3800
|
+
registerScrollElement: farmRouterSubscribe("registerScrollElement", true),
|
|
3801
|
+
};
|
|
3802
|
+
// Members only the router has, such as its fetch helpers, read and write through to it once loaded.
|
|
3803
|
+
const spaRouter = new Proxy(farmRouterStandIn, {
|
|
3804
|
+
get: function(target, key) {
|
|
3805
|
+
if (key in target || !farmLoadedRouter) return target[key];
|
|
3806
|
+
return farmLoadedRouter[key];
|
|
3807
|
+
},
|
|
3808
|
+
set: function(target, key, value) {
|
|
3809
|
+
if (key in target || !farmLoadedRouter) target[key] = value;
|
|
3810
|
+
else farmLoadedRouter[key] = value;
|
|
3811
|
+
return true;
|
|
3812
|
+
},
|
|
3813
|
+
has: function(target, key) {
|
|
3814
|
+
return key in target || (farmLoadedRouter !== null && key in farmLoadedRouter);
|
|
3815
|
+
},
|
|
3816
|
+
});
|
|
3817
|
+
window.__FARM_SPA_ROUTER__ = spaRouter;
|
|
3818
|
+
|
|
3819
|
+
// Links in server components have no handlers of their own, so intent is read from the document.
|
|
3820
|
+
const farmRouterIntentEvents = ["mouseover", "pointerdown", "focusin"];
|
|
3821
|
+
function farmRouterIntent(event) {
|
|
3822
|
+
const anchor = event.target instanceof Element ? event.target.closest("a[href]") : null;
|
|
3823
|
+
const href = anchor && anchor.getAttribute("href");
|
|
3824
|
+
if (!href || href.startsWith("#") || hasAbsoluteNavigationHref(href)) return;
|
|
3825
|
+
for (const type of farmRouterIntentEvents) document.removeEventListener(type, farmRouterIntent, true);
|
|
3826
|
+
void loadFarmRouter().catch(function() {});
|
|
3827
|
+
}
|
|
3828
|
+
for (const type of farmRouterIntentEvents) document.addEventListener(type, farmRouterIntent, true);
|
|
3829
|
+
`;
|
|
3830
|
+
function bindingPattern(name) {
|
|
3831
|
+
return new RegExp(`(?<![\\w$])(?<![^.]\\.)${name.replace(/\$/g, "\\$")}(?![\\w$])`);
|
|
3832
|
+
}
|
|
3833
|
+
function readFarmEntryDeclarations(source) {
|
|
3834
|
+
const names = /* @__PURE__ */ new Set();
|
|
3835
|
+
const pattern = /^(?:async\s+)?function\*?\s+([\w$]+)|^(?:const|let|var|class)\s+([\w$]+)/gm;
|
|
3836
|
+
for (const match of source.matchAll(pattern)) names.add(_nullishCoalesce(match[1], () => ( match[2])));
|
|
3837
|
+
return names;
|
|
3838
|
+
}
|
|
3839
|
+
function readFarmEntryImports(source) {
|
|
3840
|
+
const bindings = [];
|
|
3841
|
+
for (const match of source.matchAll(/^import\s+([^"';]+?)\s+from\s+(["'][^"']+["'])/gm)) {
|
|
3842
|
+
const from = match[2];
|
|
3843
|
+
const named = /\{([^}]*)\}/.exec(match[1]);
|
|
3844
|
+
for (const specifier of _nullishCoalesce(_optionalChain([named, 'optionalAccess', _111 => _111[1], 'optionalAccess', _112 => _112.split, 'call', _113 => _113(",")]), () => ( []))) {
|
|
3845
|
+
const [imported, local] = specifier.trim().split(/\s+as\s+/);
|
|
3846
|
+
if (imported)
|
|
3847
|
+
bindings.push({ local: _nullishCoalesce(local, () => ( imported)), clause: `{ ${specifier.trim()} }`, from });
|
|
3848
|
+
}
|
|
3849
|
+
const outside = match[1].replace(/\{[^}]*\}/, "").replace(/,/g, " ").trim();
|
|
3850
|
+
const namespace = /\*\s+as\s+([\w$]+)/.exec(outside);
|
|
3851
|
+
if (namespace) bindings.push({ local: namespace[1], clause: `* as ${namespace[1]}`, from });
|
|
3852
|
+
else if (outside) bindings.push({ local: outside, clause: outside, from });
|
|
3853
|
+
}
|
|
3854
|
+
return bindings;
|
|
3855
|
+
}
|
|
3856
|
+
function splitFarmClientRouter(code) {
|
|
3857
|
+
const regions = [];
|
|
3858
|
+
const eager = code.replace(
|
|
3859
|
+
/\/\*farm-router-start\*\/([\s\S]*?)\/\*farm-router-end\*\/\n?/g,
|
|
3860
|
+
(_, body2) => {
|
|
3861
|
+
regions.push(body2);
|
|
3862
|
+
return "";
|
|
3863
|
+
}
|
|
3864
|
+
);
|
|
3865
|
+
const body = regions.join("\n");
|
|
3866
|
+
const moved = readFarmEntryDeclarations(body);
|
|
3867
|
+
const usedByRouter = (name) => !moved.has(name) && bindingPattern(name).test(body);
|
|
3868
|
+
const eagerCode = eager.replace(/^import\s[^;]*;/gm, "");
|
|
3869
|
+
const usedByEntry = (name) => bindingPattern(name).test(eagerCode);
|
|
3870
|
+
const bindings = readFarmEntryImports(eager).filter((binding) => usedByRouter(binding.local));
|
|
3871
|
+
const imports = bindings.filter((binding) => !usedByEntry(binding.local));
|
|
3872
|
+
const reexported = bindings.filter((binding) => usedByEntry(binding.local)).map((binding) => binding.local);
|
|
3873
|
+
const shared = [
|
|
3874
|
+
.../* @__PURE__ */ new Set([
|
|
3875
|
+
...reexported,
|
|
3876
|
+
...[...readFarmEntryDeclarations(eager)].filter((name) => usedByRouter(name))
|
|
3877
|
+
])
|
|
3878
|
+
];
|
|
3879
|
+
return {
|
|
3880
|
+
entry: `${eager.replace("/*farm-router-stub*/", FARM_LAZY_ROUTER_STUB)}
|
|
3881
|
+
export { ${shared.join(", ")} };
|
|
3882
|
+
`,
|
|
3883
|
+
router: [
|
|
3884
|
+
...imports.map((binding) => `import ${binding.clause} from ${binding.from};`),
|
|
3885
|
+
`import { ${shared.join(", ")} } from "./farm-client-entry";`,
|
|
3886
|
+
body,
|
|
3887
|
+
"export { spaRouter };",
|
|
3888
|
+
""
|
|
3889
|
+
].join("\n")
|
|
3890
|
+
};
|
|
3891
|
+
}
|
|
3472
3892
|
var FARM_SEGMENT_NAVIGATION_SERVER_RUNTIME = `
|
|
3473
3893
|
function getFarmLayoutKey(pattern, params) {
|
|
3474
3894
|
return pattern.replace(/\\[\\[?\\.\\.\\.([^\\]]+)\\]?\\]|\\[([^\\]]+)\\]/g, function(match, rest, name) {
|
|
@@ -3514,21 +3934,21 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
3514
3934
|
secure: false
|
|
3515
3935
|
},
|
|
3516
3936
|
direction: {}
|
|
3517
|
-
}, plugins = [], renderer =
|
|
3937
|
+
}, plugins = [], renderer = _chunk67MZTLTFcjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule, islandValues = false, platform, serverStylesheets = []) {
|
|
3518
3938
|
const toImportPath = (targetPath) => targetPath.replace(/\\/g, "/");
|
|
3519
|
-
const clientPluginEntry =
|
|
3939
|
+
const clientPluginEntry = _chunkJSOCDYERcjs.generateFarmClientPluginEntryCode.call(void 0,
|
|
3520
3940
|
plugins,
|
|
3521
3941
|
root,
|
|
3522
3942
|
srcDir,
|
|
3523
3943
|
publicRuntimeConfig,
|
|
3524
3944
|
platform
|
|
3525
3945
|
);
|
|
3526
|
-
const appSetupPath =
|
|
3527
|
-
const rendererClientImports =
|
|
3946
|
+
const appSetupPath = _chunk67MZTLTFcjs.resolveFarmRendererAppSetup.call(void 0, root, renderer);
|
|
3947
|
+
const rendererClientImports = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) ? `import React from "react";
|
|
3528
3948
|
import { createRoot, hydrateRoot } from "react-dom/client";` : appSetupPath ? `import React, { createRoot, hydrateRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)};
|
|
3529
3949
|
import __farmAppSetup from ${JSON.stringify(_chunkQMNWKQL4cjs.toPosixPath.call(void 0, appSetupPath))};
|
|
3530
3950
|
__farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};`;
|
|
3531
|
-
const providerClientCode =
|
|
3951
|
+
const providerClientCode = _chunkN5DQMOAGcjs.generateFarmIntegrationProviderClientCode.call(void 0,
|
|
3532
3952
|
integrationProviders,
|
|
3533
3953
|
root,
|
|
3534
3954
|
_nullishCoalesce(renderer.componentExtensions, () => ( []))
|
|
@@ -3551,18 +3971,18 @@ __farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot
|
|
|
3551
3971
|
const layoutImportStatements = [];
|
|
3552
3972
|
const layoutRegistrations = [];
|
|
3553
3973
|
const hydratingLayoutPatterns = layoutRoutes.filter((layout) => layout.shouldHydrate).map((layout) => layout.pattern);
|
|
3554
|
-
const treeLayoutPatterns = islandValues ?
|
|
3974
|
+
const treeLayoutPatterns = islandValues ? _chunkUPOYKX4Scjs.getFarmServerTreeLayoutPatterns.call(void 0, layoutRoutes) : /* @__PURE__ */ new Set();
|
|
3555
3975
|
layoutRoutes.forEach((layout, index) => {
|
|
3556
3976
|
const relativePath = toImportPath(layout.modulePath);
|
|
3557
3977
|
const treeLayout = treeLayoutPatterns.has(layout.pattern);
|
|
3558
3978
|
const rendersOnClient = treeLayout || !layout.hasIsolatedClientBoundaries && hydratingLayoutPatterns.some(
|
|
3559
|
-
(pattern) =>
|
|
3979
|
+
(pattern) => _chunkUPOYKX4Scjs.layoutsCanCoverSamePage.call(void 0, layout.pattern, pattern)
|
|
3560
3980
|
);
|
|
3561
3981
|
if (rendersOnClient && !treeLayout) {
|
|
3562
3982
|
layoutImportStatements.push(`import Layout${index} from "${relativePath}";`);
|
|
3563
3983
|
}
|
|
3564
|
-
const groupScope =
|
|
3565
|
-
const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(
|
|
3984
|
+
const groupScope = _chunkUPOYKX4Scjs.getRouteGroupScope.call(void 0, layout.pattern);
|
|
3985
|
+
const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(_chunkUPOYKX4Scjs.stripRouteGroups.call(void 0, layout.pattern))}, groupScope: ${JSON.stringify(groupScope)}` : "";
|
|
3566
3986
|
layoutRegistrations.push(
|
|
3567
3987
|
` { pattern: ${JSON.stringify(layout.pattern)}${groupFields}, Component: ${rendersOnClient ? treeLayout ? `getFarmTreeLayoutComponent(${JSON.stringify(layout.pattern)})` : `Layout${index}` : "null"}, shouldHydrate: ${JSON.stringify(layout.shouldHydrate)}, islandStrategy: ${JSON.stringify(layout.islandStrategy)}${treeLayout ? ", serverTree: true" : ""} }`
|
|
3568
3988
|
);
|
|
@@ -3632,7 +4052,7 @@ function isFarmDocsPath() {
|
|
|
3632
4052
|
// Farm.js Client Runtime (no client components)
|
|
3633
4053
|
${cssImport}
|
|
3634
4054
|
${layoutImports}
|
|
3635
|
-
import { createClientCancellation, createClientPluginManager, getFarmIslandValueHeaders, getHashTargetElement, installChunkErrorRecovery, isFarmBlockedNavigationURL, isFarmExternalNavigationURL, reconcileFarmDocumentHead, runFarmNavigationDelegates, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
|
|
4055
|
+
import { createClientCancellation, createClientPluginManager, createPluginlessClientRuntime, getFarmIslandValueHeaders, getHashTargetElement, installChunkErrorRecovery, isFarmBlockedNavigationURL, isFarmExternalNavigationURL, reconcileFarmDocumentHead, runFarmNavigationDelegates, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
|
|
3636
4056
|
import { createFarmDeploymentMismatchError, createFarmDeploymentRequestHeaders, isFarmDeploymentMismatchResponse } from "@farm.js/core/deployment";
|
|
3637
4057
|
${clientPluginEntry.imports}
|
|
3638
4058
|
${clientCachePersistence.imports}
|
|
@@ -3863,7 +4283,7 @@ ${generateUniversalRouterStateProperties()}
|
|
|
3863
4283
|
}
|
|
3864
4284
|
};
|
|
3865
4285
|
|
|
3866
|
-
const farmClientRuntime = createClientPluginManager(
|
|
4286
|
+
const farmClientRuntime = ${clientPluginEntry.empty ? "createPluginlessClientRuntime()" : `createClientPluginManager(
|
|
3867
4287
|
${clientPluginEntry.registrations},
|
|
3868
4288
|
{
|
|
3869
4289
|
router: spaRouter,
|
|
@@ -3871,7 +4291,7 @@ const farmClientRuntime = createClientPluginManager(
|
|
|
3871
4291
|
isProd: true,
|
|
3872
4292
|
deploymentId: window.__FARM_DEPLOYMENT_ID__,
|
|
3873
4293
|
},
|
|
3874
|
-
);
|
|
4294
|
+
)`};
|
|
3875
4295
|
window.__FARM_CLIENT_RUNTIME__ = farmClientRuntime;
|
|
3876
4296
|
void farmClientRuntime.start();
|
|
3877
4297
|
|
|
@@ -4006,7 +4426,7 @@ ${layoutImports}
|
|
|
4006
4426
|
${rendererClientImports}
|
|
4007
4427
|
${isolatedHydrationImport}
|
|
4008
4428
|
${providerClientCode.imports}
|
|
4009
|
-
import { createClientCancellation, createClientPluginManager, getFarmIslandValueHeaders, getHashTargetElement, installChunkErrorRecovery, isFarmBlockedNavigationURL, isFarmExternalNavigationURL, reconcileFarmDocumentHead, runFarmNavigationDelegates, scheduleFarmIslandHydration, createFarmSearchParams, searchParamsToObject, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
|
|
4429
|
+
import { createClientCancellation, createClientPluginManager, createPluginlessClientRuntime, getFarmIslandValueHeaders, getHashTargetElement, installChunkErrorRecovery, isFarmBlockedNavigationURL, isFarmExternalNavigationURL, reconcileFarmDocumentHead, runFarmNavigationDelegates, scheduleFarmIslandHydration, createFarmSearchParams, searchParamsToObject, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
|
|
4010
4430
|
import { createFarmDeploymentMismatchError, createFarmDeploymentRequestHeaders, isFarmDeploymentMismatchResponse } from "@farm.js/core/deployment";
|
|
4011
4431
|
import { createFarmRouter, isFarmRouteActive, matchFarmRoute } from "@farm.js/core/router";
|
|
4012
4432
|
${clientPluginEntry.imports}
|
|
@@ -4085,7 +4505,7 @@ function hasHydratableLayout(pathname) {
|
|
|
4085
4505
|
});
|
|
4086
4506
|
}
|
|
4087
4507
|
|
|
4088
|
-
${
|
|
4508
|
+
${_chunkN5DQMOAGcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
|
|
4089
4509
|
// Wrap a page element with applicable layouts
|
|
4090
4510
|
function wrapWithLayouts(pageElement, pathname, params) {
|
|
4091
4511
|
const layouts = getApplicableLayouts(pathname);
|
|
@@ -4120,7 +4540,7 @@ function createLayoutPageBoundary(route, pageElement, serverHtml) {
|
|
|
4120
4540
|
return React.createElement("div", props, pageElement);
|
|
4121
4541
|
}
|
|
4122
4542
|
let farmLastRouteState = null;
|
|
4123
|
-
${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${
|
|
4543
|
+
${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${_chunkN5DQMOAGcjs.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE}
|
|
4124
4544
|
function farmTreeLayoutsOf(pathname) {
|
|
4125
4545
|
return getApplicableLayouts(pathname).filter(function(layout) {
|
|
4126
4546
|
return layout.serverTree === true;
|
|
@@ -4257,7 +4677,7 @@ function createFarmRouteState(page, pathname, params, includeLayouts) {
|
|
|
4257
4677
|
|
|
4258
4678
|
function hydrateFarmRoute(container, route) {
|
|
4259
4679
|
farmLastRouteState = route;
|
|
4260
|
-
${
|
|
4680
|
+
${_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);"}
|
|
4261
4681
|
}
|
|
4262
4682
|
|
|
4263
4683
|
function renderFarmRoute(root, route) {
|
|
@@ -4266,6 +4686,7 @@ function renderFarmRoute(root, route) {
|
|
|
4266
4686
|
else root.render(route.element);
|
|
4267
4687
|
}
|
|
4268
4688
|
|
|
4689
|
+
/*farm-router-start*/
|
|
4269
4690
|
function matchesRoutePrefix(pathname, pattern) {
|
|
4270
4691
|
return pattern === "/" ||
|
|
4271
4692
|
isFarmRouteActive(pattern, getFarmRoutePathname(pathname), { exact: false });
|
|
@@ -4280,6 +4701,7 @@ function matchInterceptedRouteSlot(pathname, from) {
|
|
|
4280
4701
|
return null;
|
|
4281
4702
|
}
|
|
4282
4703
|
|
|
4704
|
+
/*farm-router-end*/
|
|
4283
4705
|
function routeSlotKey(slot) {
|
|
4284
4706
|
return slot.ownerPattern + ":" + slot.name;
|
|
4285
4707
|
}
|
|
@@ -4299,6 +4721,7 @@ function findClientRouteSlot(slot) {
|
|
|
4299
4721
|
* client navigation does not execute. The JSON ends at the first statement
|
|
4300
4722
|
* boundary where it parses, so the separator inside a string cannot cut it.
|
|
4301
4723
|
*/
|
|
4724
|
+
/*farm-router-start*/
|
|
4302
4725
|
function readPagePropsPayload(doc) {
|
|
4303
4726
|
const prefix = "window.__FARM_PROPS__=";
|
|
4304
4727
|
const separator = ";window.__FARM_INTEGRATION_API_MANIFEST__=";
|
|
@@ -4331,7 +4754,47 @@ function readRouteSlotPayload(doc) {
|
|
|
4331
4754
|
}
|
|
4332
4755
|
}
|
|
4333
4756
|
|
|
4757
|
+
/**
|
|
4758
|
+
* The settled defer() values a fetched document writes after its body, which a client
|
|
4759
|
+
* navigation does not execute either. Undefined when the document has none.
|
|
4760
|
+
*/
|
|
4761
|
+
function readDeferredDataPayload(doc) {
|
|
4762
|
+
const prefix = "window.__FARM_DEFERRED_DATA__=";
|
|
4763
|
+
for (const script of doc.querySelectorAll("script:not([src])")) {
|
|
4764
|
+
const source = (script.textContent || "").trim();
|
|
4765
|
+
if (!source.startsWith(prefix)) continue;
|
|
4766
|
+
try {
|
|
4767
|
+
return JSON.parse(source.slice(prefix.length).replace(/;$/, ""));
|
|
4768
|
+
} catch {
|
|
4769
|
+
return undefined;
|
|
4770
|
+
}
|
|
4771
|
+
}
|
|
4772
|
+
return undefined;
|
|
4773
|
+
}
|
|
4774
|
+
|
|
4775
|
+
/*farm-router-end*/
|
|
4776
|
+
// defer() values arrive as references, settled by the snapshot the server writes once the
|
|
4777
|
+
// document has rendered, and revived as promises the way development revives them. The page
|
|
4778
|
+
// and its slots share one id space. The server writes references only with a snapshot, so a
|
|
4779
|
+
// document without one has nothing to revive and never loads the reviver.
|
|
4780
|
+
async function reviveFarmDeferredPayload(page, slots, settlements) {
|
|
4781
|
+
if (!settlements) return { page: page, slots: slots };
|
|
4782
|
+
const { reviveDeferredData } = await import("@farm.js/core/deferred");
|
|
4783
|
+
return reviveDeferredData({ page: page, slots: slots }, settlements);
|
|
4784
|
+
}
|
|
4785
|
+
|
|
4786
|
+
/*farm-router-start*/
|
|
4787
|
+
function readFarmDocumentPayload(doc) {
|
|
4788
|
+
return reviveFarmDeferredPayload(
|
|
4789
|
+
readPagePropsPayload(doc),
|
|
4790
|
+
readRouteSlotPayload(doc),
|
|
4791
|
+
readDeferredDataPayload(doc),
|
|
4792
|
+
);
|
|
4793
|
+
}
|
|
4794
|
+
|
|
4795
|
+
/*farm-router-end*/
|
|
4334
4796
|
const routeSlotRoots = new Map();
|
|
4797
|
+
/*farm-router-start*/
|
|
4335
4798
|
let activeRouteInterception = null;
|
|
4336
4799
|
|
|
4337
4800
|
function resetRouteSlotRoots() {
|
|
@@ -4342,6 +4805,7 @@ function resetRouteSlotRoots() {
|
|
|
4342
4805
|
activeRouteInterception = null;
|
|
4343
4806
|
}
|
|
4344
4807
|
|
|
4808
|
+
/*farm-router-end*/
|
|
4345
4809
|
function renderClientRouteSlot(slot, registration, mode) {
|
|
4346
4810
|
const container = document.getElementById(slot.containerId);
|
|
4347
4811
|
if (!container || !registration?.Component) return false;
|
|
@@ -4386,6 +4850,7 @@ function hydrateInitialRouteSlots() {
|
|
|
4386
4850
|
}
|
|
4387
4851
|
}
|
|
4388
4852
|
|
|
4853
|
+
/*farm-router-start*/
|
|
4389
4854
|
function renderRouteInterception(slot, registration, from, nextDocument) {
|
|
4390
4855
|
const container = document.getElementById(slot.containerId);
|
|
4391
4856
|
if (!container || !registration?.Component) return false;
|
|
@@ -4431,13 +4896,22 @@ function clearRouteInterception(destination) {
|
|
|
4431
4896
|
return destination === active.from;
|
|
4432
4897
|
}
|
|
4433
4898
|
|
|
4899
|
+
/*farm-router-end*/
|
|
4434
4900
|
// State
|
|
4435
4901
|
let reactRoot = null;
|
|
4436
4902
|
let reactRootContainer = null;
|
|
4437
|
-
let currentPathname = null;
|
|
4438
4903
|
let isHydrated = false;
|
|
4439
4904
|
let pendingPageHydrationController = null;
|
|
4440
4905
|
|
|
4906
|
+
function setFarmReactRoot(root, container) {
|
|
4907
|
+
reactRoot = root;
|
|
4908
|
+
reactRootContainer = container;
|
|
4909
|
+
}
|
|
4910
|
+
|
|
4911
|
+
function setFarmHydrated() {
|
|
4912
|
+
isHydrated = true;
|
|
4913
|
+
}
|
|
4914
|
+
|
|
4441
4915
|
${generateUniversalRouterStateRuntime(islandValues)}
|
|
4442
4916
|
|
|
4443
4917
|
function cancelPendingPageHydration() {
|
|
@@ -4454,7 +4928,14 @@ function resetReactRoot() {
|
|
|
4454
4928
|
isHydrated = false;
|
|
4455
4929
|
}
|
|
4456
4930
|
|
|
4457
|
-
${islandValues ? FARM_DOCUMENT_PARSED_RUNTIME
|
|
4931
|
+
${islandValues ? `${FARM_DOCUMENT_PARSED_RUNTIME}// A deferred reference in the payload, settled by the snapshot that follows the body.
|
|
4932
|
+
function hasFarmDeferredReference(value) {
|
|
4933
|
+
if (!value || typeof value !== "object") return false;
|
|
4934
|
+
if (typeof value.$farmDeferred === "string") return true;
|
|
4935
|
+
return Object.values(value).some(hasFarmDeferredReference);
|
|
4936
|
+
}
|
|
4937
|
+
|
|
4938
|
+
` : ""}// Hydrate client components
|
|
4458
4939
|
async function hydrate() {
|
|
4459
4940
|
await window.__FARM_PPR_REFRESH_PROMISE__;
|
|
4460
4941
|
// A PPR refresh that is still retrying must not replace DOM once hydration starts.
|
|
@@ -4467,10 +4948,19 @@ async function hydrate() {
|
|
|
4467
4948
|
!matched ||
|
|
4468
4949
|
!matched.route.hasIsolatedClientBoundaries ||
|
|
4469
4950
|
matched.route.pageShouldHydrate ||
|
|
4470
|
-
hasHydratableLayout(pathname)
|
|
4951
|
+
hasHydratableLayout(pathname) ||
|
|
4952
|
+
hasFarmDeferredReference(window.__FARM_ROUTE_SLOTS__)
|
|
4471
4953
|
) {
|
|
4472
4954
|
await farmDocumentParsed();
|
|
4473
4955
|
}` : ""}
|
|
4956
|
+
// The snapshot follows the body: this entry runs after it, or waited for it above.
|
|
4957
|
+
const initialPayload = await reviveFarmDeferredPayload(
|
|
4958
|
+
window.__FARM_PROPS__,
|
|
4959
|
+
window.__FARM_ROUTE_SLOTS__,
|
|
4960
|
+
window.__FARM_DEFERRED_DATA__,
|
|
4961
|
+
);
|
|
4962
|
+
window.__FARM_PROPS__ = initialPayload.page;
|
|
4963
|
+
window.__FARM_ROUTE_SLOTS__ = initialPayload.slots;
|
|
4474
4964
|
|
|
4475
4965
|
if (await hydrateFarmDocsAdapterRuntime()) {
|
|
4476
4966
|
return;
|
|
@@ -4489,7 +4979,13 @@ async function hydrate() {
|
|
|
4489
4979
|
) {
|
|
4490
4980
|
// Not cancelled by a navigation: an island it removes is disposed with its DOM, and one in a
|
|
4491
4981
|
// layout it keeps still waits for its trigger, with any click it already holds.
|
|
4982
|
+
const hydrationSession = await farmClientRuntime.beginHydration({
|
|
4983
|
+
container: document.getElementById("root") || document.body,
|
|
4984
|
+
mode: "hydrate",
|
|
4985
|
+
});
|
|
4986
|
+
// Each island reports and recovers its own failure, so this resolves once they are live.
|
|
4492
4987
|
await hydrateFarmIsolatedClientBoundaries(document);
|
|
4988
|
+
await farmClientRuntime.completeHydration(hydrationSession);
|
|
4493
4989
|
return;
|
|
4494
4990
|
}` : ""}
|
|
4495
4991
|
|
|
@@ -4550,7 +5046,6 @@ async function hydrate() {
|
|
|
4550
5046
|
}
|
|
4551
5047
|
renderFarmRoute(reactRoot, routeState);
|
|
4552
5048
|
}
|
|
4553
|
-
currentPathname = pathname;
|
|
4554
5049
|
await farmClientRuntime.completeHydration(hydrationSession);
|
|
4555
5050
|
} catch (error) {
|
|
4556
5051
|
await farmClientRuntime.failHydration(hydrationSession, error);
|
|
@@ -4571,6 +5066,7 @@ async function hydrate() {
|
|
|
4571
5066
|
}
|
|
4572
5067
|
}
|
|
4573
5068
|
|
|
5069
|
+
/*farm-router-start*/
|
|
4574
5070
|
// A layout boundary is the same layout when its key matches: islands mode keys it by pattern and
|
|
4575
5071
|
// params, so a layout whose params change renders again. Other modes compare patterns.
|
|
4576
5072
|
function getLayoutIdentity(boundary) {
|
|
@@ -4666,6 +5162,47 @@ async function streamFarmNavigation(stream, root, isCurrent) {
|
|
|
4666
5162
|
${isolatedHydrationEnabled ? "farmIsolatedHydrationRuntime.endStream?.(root);\n if (!queued) run();" : ""}
|
|
4667
5163
|
}` : ""}
|
|
4668
5164
|
|
|
5165
|
+
// Suspense content streams, so a fresh response holds its fallback where the live DOM holds the
|
|
5166
|
+
// result. Compare without it.
|
|
5167
|
+
function removeSuspenseContent(root) {
|
|
5168
|
+
const walker = document.createTreeWalker(root, NodeFilter.SHOW_COMMENT);
|
|
5169
|
+
const comments = [];
|
|
5170
|
+
while (walker.nextNode()) comments.push(walker.currentNode);
|
|
5171
|
+
let depth = 0;
|
|
5172
|
+
let start = null;
|
|
5173
|
+
for (const comment of comments) {
|
|
5174
|
+
if (comment.data === "$" || comment.data === "$?" || comment.data === "$!") {
|
|
5175
|
+
if (depth++ === 0) start = comment;
|
|
5176
|
+
} else if (comment.data === "/$" && depth > 0 && --depth === 0) {
|
|
5177
|
+
const range = document.createRange();
|
|
5178
|
+
range.setStartAfter(start);
|
|
5179
|
+
range.setEndBefore(comment);
|
|
5180
|
+
range.deleteContents();
|
|
5181
|
+
start.data = "$";
|
|
5182
|
+
}
|
|
5183
|
+
}
|
|
5184
|
+
}
|
|
5185
|
+
|
|
5186
|
+
// A layout's own server output, without what it wraps and without its islands, whose live DOM
|
|
5187
|
+
// always differs from fresh HTML.
|
|
5188
|
+
function getLayoutShell(root, patterns, index) {
|
|
5189
|
+
const shell = findLayoutBoundary(root, patterns[index])?.cloneNode(true);
|
|
5190
|
+
if (!shell) return null;
|
|
5191
|
+
const inner = index + 1 < patterns.length
|
|
5192
|
+
? findLayoutBoundary(shell, patterns[index + 1])
|
|
5193
|
+
: shell.querySelector("#__farm_page__");
|
|
5194
|
+
inner?.replaceChildren();
|
|
5195
|
+
removeSuspenseContent(shell);
|
|
5196
|
+
shell.querySelectorAll("script").forEach(function(script) { script.remove(); });
|
|
5197
|
+
shell.querySelectorAll("f-island").forEach(function(island) {
|
|
5198
|
+
island.replaceChildren();
|
|
5199
|
+
Array.from(island.attributes).forEach(function(attribute) {
|
|
5200
|
+
island.removeAttribute(attribute.name);
|
|
5201
|
+
});
|
|
5202
|
+
});
|
|
5203
|
+
return shell.innerHTML;
|
|
5204
|
+
}
|
|
5205
|
+
|
|
4669
5206
|
function replaceSharedLayoutBoundary(currentRoot, nextRoot, refresh = false) {
|
|
4670
5207
|
const currentPatterns = getLayoutPatterns(currentRoot);
|
|
4671
5208
|
const nextPatterns = getLayoutPatterns(nextRoot);
|
|
@@ -4673,7 +5210,11 @@ function replaceSharedLayoutBoundary(currentRoot, nextRoot, refresh = false) {
|
|
|
4673
5210
|
while (
|
|
4674
5211
|
sharedCount < currentPatterns.length &&
|
|
4675
5212
|
sharedCount < nextPatterns.length &&
|
|
4676
|
-
currentPatterns[sharedCount] === nextPatterns[sharedCount]
|
|
5213
|
+
currentPatterns[sharedCount] === nextPatterns[sharedCount] &&
|
|
5214
|
+
// A refresh renders every layout again: start at the first one whose output changed.
|
|
5215
|
+
(!refresh ||
|
|
5216
|
+
getLayoutShell(currentRoot, currentPatterns, sharedCount) ===
|
|
5217
|
+
getLayoutShell(nextRoot, nextPatterns, sharedCount))
|
|
4677
5218
|
) sharedCount++;
|
|
4678
5219
|
|
|
4679
5220
|
const nextTreeRoot = nextPatterns.length
|
|
@@ -4822,7 +5363,8 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
4822
5363
|
const html = await this.fetchPage(to, from, false, true, navigation.controller.signal);
|
|
4823
5364
|
if (!this.isCurrentNavigation(navigation, clientNavigation)) return;
|
|
4824
5365
|
const doc = new DOMParser().parseFromString(html, "text/html");
|
|
4825
|
-
const slotPayload =
|
|
5366
|
+
const slotPayload = (await readFarmDocumentPayload(doc)).slots;
|
|
5367
|
+
if (!this.isCurrentNavigation(navigation, clientNavigation)) return;
|
|
4826
5368
|
const selectedSlot = slotPayload.find(function(slot) {
|
|
4827
5369
|
return slot.interception &&
|
|
4828
5370
|
slot.name === intercepted.slot.name &&
|
|
@@ -4884,11 +5426,9 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
4884
5426
|
if (container) {
|
|
4885
5427
|
if (reactRoot && reactRootContainer !== container) resetReactRoot();
|
|
4886
5428
|
if (!reactRoot) {
|
|
4887
|
-
|
|
4888
|
-
reactRootContainer = container;
|
|
5429
|
+
setFarmReactRoot(createRoot(container), container);
|
|
4889
5430
|
}
|
|
4890
5431
|
renderFarmRoute(reactRoot, routeState);
|
|
4891
|
-
currentPathname = pathname;
|
|
4892
5432
|
}
|
|
4893
5433
|
this.currentPath = to;
|
|
4894
5434
|
});
|
|
@@ -4907,6 +5447,11 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
4907
5447
|
if (!this.isCurrentNavigation(navigation, clientNavigation)) return;
|
|
4908
5448
|
await this.runViewTransition(options.viewTransition, async () => {
|
|
4909
5449
|
if (!this.isCurrentNavigation(navigation, clientNavigation)) return;
|
|
5450
|
+
// The history entry comes first, as on the client-render path: swapContent shows the
|
|
5451
|
+
// page and its title, then waits for its islands, and a Back pressed meanwhile must
|
|
5452
|
+
// leave the page on screen, not the one before it. Its islands also hydrate at their URL.
|
|
5453
|
+
this.writeHistoryEntry(action, url.pathname + url.search, options.state, url);
|
|
5454
|
+
this.currentPath = to;
|
|
4910
5455
|
let swappedHtml = html;
|
|
4911
5456
|
let swapped = await this.swapContent(
|
|
4912
5457
|
html,
|
|
@@ -4940,9 +5485,6 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
4940
5485
|
throw new Error("Farm could not swap the target document");
|
|
4941
5486
|
}
|
|
4942
5487
|
this.takeNavigationStream(swappedHtml);
|
|
4943
|
-
this.writeHistoryEntry(action, url.pathname + url.search, options.state, url);
|
|
4944
|
-
currentPathname = pathname;
|
|
4945
|
-
this.currentPath = to;
|
|
4946
5488
|
});
|
|
4947
5489
|
}
|
|
4948
5490
|
|
|
@@ -4996,10 +5538,12 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
4996
5538
|
const doc = parser.parseFromString(html, "text/html");
|
|
4997
5539
|
if (isFarmLocaleDocumentChange(doc)) return false;
|
|
4998
5540
|
if (doc.getElementById("nd-docs-layout")) return false;
|
|
4999
|
-
const nextRouteSlots = readRouteSlotPayload(doc);
|
|
5000
|
-
const nextPageProps = readPagePropsPayload(doc);
|
|
5001
5541
|
const isNavigationCurrent = () =>
|
|
5002
5542
|
this.isCurrentNavigation(navigation, clientNavigation);
|
|
5543
|
+
const nextPayload = await readFarmDocumentPayload(doc);
|
|
5544
|
+
if (!isNavigationCurrent()) return false;
|
|
5545
|
+
const nextRouteSlots = nextPayload.slots;
|
|
5546
|
+
const nextPageProps = nextPayload.page;
|
|
5003
5547
|
|
|
5004
5548
|
reconcileFarmDocumentHead(doc);
|
|
5005
5549
|
|
|
@@ -5043,7 +5587,7 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
5043
5587
|
if (routeState) {
|
|
5044
5588
|
renderFarmRoute(reactRoot, routeState);
|
|
5045
5589
|
window.__FARM_ROUTE_SLOTS__ = nextRouteSlots;
|
|
5046
|
-
|
|
5590
|
+
setFarmHydrated();
|
|
5047
5591
|
return true;
|
|
5048
5592
|
}
|
|
5049
5593
|
}
|
|
@@ -5083,9 +5627,8 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
5083
5627
|
);
|
|
5084
5628
|
if (!isNavigationCurrent()) return false;
|
|
5085
5629
|
if (routeState) {
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
isHydrated = true;
|
|
5630
|
+
setFarmReactRoot(hydrateFarmRoute(pageContainer, routeState), pageContainer);
|
|
5631
|
+
setFarmHydrated();
|
|
5089
5632
|
}
|
|
5090
5633
|
${isolatedHydrationEnabled ? `if (matched.route.hasIsolatedClientBoundaries && !hydrateLayouts) {
|
|
5091
5634
|
await hydrateFarmIsolatedClientBoundaries(
|
|
@@ -5169,7 +5712,9 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
5169
5712
|
}
|
|
5170
5713
|
};
|
|
5171
5714
|
|
|
5172
|
-
|
|
5715
|
+
/*farm-router-end*/
|
|
5716
|
+
/*farm-router-stub*/
|
|
5717
|
+
const farmClientRuntime = ${clientPluginEntry.empty ? "createPluginlessClientRuntime()" : `createClientPluginManager(
|
|
5173
5718
|
${clientPluginEntry.registrations},
|
|
5174
5719
|
{
|
|
5175
5720
|
router: spaRouter,
|
|
@@ -5177,13 +5722,15 @@ const farmClientRuntime = createClientPluginManager(
|
|
|
5177
5722
|
isProd: true,
|
|
5178
5723
|
deploymentId: window.__FARM_DEPLOYMENT_ID__,
|
|
5179
5724
|
},
|
|
5180
|
-
);
|
|
5725
|
+
)`};
|
|
5181
5726
|
window.__FARM_CLIENT_RUNTIME__ = farmClientRuntime;
|
|
5182
5727
|
void farmClientRuntime.start();
|
|
5183
5728
|
|
|
5184
5729
|
// Expose router globally
|
|
5730
|
+
/*farm-router-start*/
|
|
5185
5731
|
spaRouter.initializeHistory();
|
|
5186
5732
|
window.__FARM_SPA_ROUTER__ = spaRouter;
|
|
5733
|
+
/*farm-router-end*/
|
|
5187
5734
|
|
|
5188
5735
|
window.addEventListener("beforeunload", function(event) {
|
|
5189
5736
|
if (spaRouter.shouldBlockUnload()) {
|
|
@@ -5229,7 +5776,7 @@ void hydrate();
|
|
|
5229
5776
|
async function buildSSRInMemory(productionVite, config, root, routeManager, apiRouteManager, serverRenderer, preset, collectedPageRoutes, collectedLayoutRoutes, collectedRouteSlots, isolatedClientBoundaryModules, hydrationPlanCache, rendererBuildLifetime) {
|
|
5230
5777
|
const viteBuild = productionVite.build;
|
|
5231
5778
|
const { farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.cjs");
|
|
5232
|
-
const { PluginManager: PluginManager2 } = await import("./plugin-
|
|
5779
|
+
const { PluginManager: PluginManager2 } = await import("./plugin-WIU4GDD4.cjs");
|
|
5233
5780
|
const fs4 = await import("fs/promises");
|
|
5234
5781
|
const pluginManager = new PluginManager2({
|
|
5235
5782
|
config,
|
|
@@ -5240,7 +5787,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5240
5787
|
const hasScopedPostcssConfig = hasProjectPostcssConfig(root);
|
|
5241
5788
|
let postcssConfigDir;
|
|
5242
5789
|
let tailwindVitePlugin = void 0;
|
|
5243
|
-
const rendererVitePlugins = await
|
|
5790
|
+
const rendererVitePlugins = await _chunk67MZTLTFcjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, root, {
|
|
5244
5791
|
ssr: true,
|
|
5245
5792
|
buildLifetime: rendererBuildLifetime
|
|
5246
5793
|
});
|
|
@@ -5250,7 +5797,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5250
5797
|
_path2.default.join(postcssConfigDir, "postcss.config.cjs"),
|
|
5251
5798
|
"module.exports = { plugins: [] };\n"
|
|
5252
5799
|
);
|
|
5253
|
-
tailwindVitePlugin = await
|
|
5800
|
+
tailwindVitePlugin = await _chunkJSOCDYERcjs.loadTailwindVitePlugin.call(void 0, {
|
|
5254
5801
|
builder: productionVite.builder,
|
|
5255
5802
|
label: "for SSR"
|
|
5256
5803
|
});
|
|
@@ -5332,10 +5879,11 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5332
5879
|
const appDirs = _chunk5Y2P454Ocjs.getFarmAppDirectories.call(void 0, config);
|
|
5333
5880
|
let openAPIReference = null;
|
|
5334
5881
|
if (config.openapi.enabled && config.openapi.route) {
|
|
5335
|
-
const { OpenAPIManager, renderOpenAPIReferenceHTML } = await import("./manager-
|
|
5882
|
+
const { OpenAPIManager, renderOpenAPIReferenceHTML } = await import("./manager-JOHU6BQI.cjs");
|
|
5336
5883
|
const openAPIManager = new OpenAPIManager(appDirs, config.openapi, {
|
|
5337
5884
|
mode: "production",
|
|
5338
|
-
apiBaseURL: config.api.baseURL
|
|
5885
|
+
apiBaseURL: config.api.baseURL,
|
|
5886
|
+
loadModule: (filePath) => apiRouteManager.loadModule(filePath)
|
|
5339
5887
|
});
|
|
5340
5888
|
const spec = await openAPIManager.generateSpec();
|
|
5341
5889
|
if (!spec) {
|
|
@@ -5350,7 +5898,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5350
5898
|
}
|
|
5351
5899
|
const middlewareRoutes = await discoverMiddlewareRoutes(appDirs);
|
|
5352
5900
|
const instrumentationPath = _chunkBRWIVOV4cjs.resolveFarmInstrumentationFile.call(void 0, root, config.srcDir || "src");
|
|
5353
|
-
const notFoundPath =
|
|
5901
|
+
const notFoundPath = _chunkN5DQMOAGcjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
|
|
5354
5902
|
if (notFoundPath) _chunkQMNWKQL4cjs.logger.info(`\u{1F4CB} Found custom 404 page: ${notFoundPath}`);
|
|
5355
5903
|
layoutRoutes.sort((a, b) => {
|
|
5356
5904
|
const depthA = a.pattern.split("/").filter(Boolean).length;
|
|
@@ -5367,13 +5915,13 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5367
5915
|
const hasServerRuntimeIntegrations = configuredIntegrationValues.some(
|
|
5368
5916
|
(integration) => typeof integration === "object" && integration !== null && (!("serverRuntime" in integration) || integration.serverRuntime !== false)
|
|
5369
5917
|
);
|
|
5370
|
-
const hasIntegrationProviders =
|
|
5918
|
+
const hasIntegrationProviders = _chunkBDYM2TN3cjs.getIntegrationProviders.call(void 0, config.integrations).some(
|
|
5371
5919
|
(provider) => provider.component || provider.type === "clerk"
|
|
5372
5920
|
);
|
|
5373
5921
|
const hasObservabilityHandler = !!config.observability && typeof config.observability === "object" && "onEvent" in config.observability;
|
|
5374
|
-
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access',
|
|
5375
|
-
const hasMiddlewareConfig =
|
|
5376
|
-
const hasRouteContextConfig =
|
|
5922
|
+
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _114 => _114.mdx, 'optionalAccess', _115 => _115.components]));
|
|
5923
|
+
const hasMiddlewareConfig = _chunkUPOYKX4Scjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
|
|
5924
|
+
const hasRouteContextConfig = _chunk556H7JCEcjs.hasCustomFarmRouteContext.call(void 0, config);
|
|
5377
5925
|
const hasServerRuntimePlugins = hasFarmServerRuntimePlugins(config);
|
|
5378
5926
|
const hasPluginRoutes = hasFarmPluginRoutes(config);
|
|
5379
5927
|
const hasServerCacheConfig = hasFarmServerCacheConfig(config.cache);
|
|
@@ -5383,18 +5931,18 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5383
5931
|
const hasConfiguredRuntimePlugins = Boolean(
|
|
5384
5932
|
hasRuntimeConfigModule && (config.plugins || []).length > 0
|
|
5385
5933
|
);
|
|
5386
|
-
if (
|
|
5934
|
+
if (_chunkDCXSIEFEcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
|
|
5387
5935
|
const adapterGuardedPaths = new Set(getFarmDocsGuardedPaths(config, middlewareRoutes));
|
|
5388
|
-
|
|
5936
|
+
_chunkDCXSIEFEcjs.assertFarmDocsAdapterServesNoGuardedPages.call(void 0,
|
|
5389
5937
|
config.docs,
|
|
5390
5938
|
{ root, srcDir: config.srcDir },
|
|
5391
5939
|
(pathname) => adapterGuardedPaths.has(pathname)
|
|
5392
5940
|
);
|
|
5393
5941
|
}
|
|
5394
5942
|
const farmDocsCspNonceMarker = _chunk6JHZPB52cjs.createFarmCspNonce.call(void 0, config.security);
|
|
5395
|
-
const farmDocsPrecompiledManifest = _optionalChain([config, 'access',
|
|
5943
|
+
const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _116 => _116.docs, 'optionalAccess', _117 => _117.enabled]) && _chunkF43OG25Pcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? await _chunkHDPT6OYEcjs._runWithFarmCspNonce.call(void 0,
|
|
5396
5944
|
farmDocsCspNonceMarker,
|
|
5397
|
-
async () => _optionalChain([config, 'access',
|
|
5945
|
+
async () => _optionalChain([config, 'access', _118 => _118.docs, 'access', _119 => _119.adapter, 'optionalAccess', _120 => _120.server]) ? await _chunkDCXSIEFEcjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
|
|
5398
5946
|
root,
|
|
5399
5947
|
srcDir: config.srcDir,
|
|
5400
5948
|
clientEntry: FARM_CLIENT_JS_SRC_PLACEHOLDER,
|
|
@@ -5409,7 +5957,8 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5409
5957
|
fontAssets: _chunkERMUL73Lcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkERMUL73Lcjs.resolveFarmDocsFontAssets.call(void 0, root)),
|
|
5410
5958
|
fontStylesheetHref: "/farm-fonts.css",
|
|
5411
5959
|
globalStylesheetHref: FARM_CLIENT_CSS_HREF_PLACEHOLDER,
|
|
5412
|
-
isPathGuarded: (pathname) => guardedPaths.has(pathname)
|
|
5960
|
+
isPathGuarded: (pathname) => guardedPaths.has(pathname),
|
|
5961
|
+
basePath: config.basePath
|
|
5413
5962
|
});
|
|
5414
5963
|
})()
|
|
5415
5964
|
) : null;
|
|
@@ -5446,11 +5995,12 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5446
5995
|
);
|
|
5447
5996
|
const virtualEntryId = "\0virtual:farm-ssr-entry";
|
|
5448
5997
|
const useExternalMetadataImageRuntime = shouldUseExternalMetadataImageRuntime(preset, true);
|
|
5998
|
+
const edgeMetadataImageRuntime = getEdgeMetadataImageRuntime(preset);
|
|
5449
5999
|
const omitCoreMetadataImageRuntime = !metadataImageRoutes.some(
|
|
5450
6000
|
(image) => image.sourceType === "module"
|
|
5451
6001
|
);
|
|
5452
6002
|
const externalMetadataImageRuntime = useExternalMetadataImageRuntime && !omitCoreMetadataImageRuntime ? ["@vercel/og"] : [];
|
|
5453
|
-
const rendererOptionalExternals =
|
|
6003
|
+
const rendererOptionalExternals = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) ? [] : [
|
|
5454
6004
|
"react",
|
|
5455
6005
|
"react/jsx-runtime",
|
|
5456
6006
|
"react/jsx-dev-runtime",
|
|
@@ -5504,7 +6054,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5504
6054
|
// Adapters can render provider scripts by serializing function source.
|
|
5505
6055
|
// keepNames injects helper calls into those functions; after Nitro
|
|
5506
6056
|
// minifies the server chunk the helper is no longer in script scope.
|
|
5507
|
-
keepNames: !(_optionalChain([config, 'access',
|
|
6057
|
+
keepNames: !(_optionalChain([config, 'access', _121 => _121.docs, 'optionalAccess', _122 => _122.enabled]) && _optionalChain([config, 'access', _123 => _123.docs, 'access', _124 => _124.adapter, 'optionalAccess', _125 => _125.server])),
|
|
5508
6058
|
jsxDev: false
|
|
5509
6059
|
},
|
|
5510
6060
|
// SSR configuration to externalize problematic modules
|
|
@@ -5554,24 +6104,33 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5554
6104
|
define: {
|
|
5555
6105
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
5556
6106
|
__FARM_ENV__: JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, config.env)),
|
|
5557
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
6107
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _126 => _126.env, 'optionalAccess', _127 => _127.public]) || {})
|
|
5558
6108
|
},
|
|
5559
6109
|
plugins: [
|
|
5560
|
-
|
|
6110
|
+
_chunkN5DQMOAGcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
5561
6111
|
...tailwindVitePlugin ? [tailwindVitePlugin] : [],
|
|
5562
6112
|
...rendererVitePlugins,
|
|
5563
6113
|
...config.vite.plugins || [],
|
|
5564
|
-
|
|
6114
|
+
// On an edge preset any server module may import @vercel/og.
|
|
6115
|
+
...(edgeMetadataImageRuntime ? edgeMetadataImageRuntime.wasm === "bytes" : !useExternalMetadataImageRuntime && metadataImageRoutes.some((image) => image.sourceType === "module")) ? [{ ...createMetadataImageWasmPlugin(), enforce: "pre" }] : [],
|
|
5565
6116
|
...omitCoreMetadataImageRuntime ? [
|
|
5566
6117
|
{
|
|
5567
6118
|
...createOmittedMetadataImageRuntimePlugin(useExternalMetadataImageRuntime),
|
|
5568
6119
|
enforce: "pre"
|
|
5569
6120
|
}
|
|
5570
6121
|
] : [],
|
|
6122
|
+
// After the stub above, which must take core's own import first.
|
|
6123
|
+
...edgeMetadataImageRuntime ? [
|
|
6124
|
+
{
|
|
6125
|
+
...createEdgeMetadataImageRuntimePlugin(edgeMetadataImageRuntime),
|
|
6126
|
+
enforce: "pre"
|
|
6127
|
+
},
|
|
6128
|
+
createVercelOgFontInlinePlugin(edgeMetadataImageRuntime.runtime)
|
|
6129
|
+
] : [],
|
|
5571
6130
|
{ ...createReactProductionModePlugin(), enforce: "pre" },
|
|
5572
6131
|
farmServerOnlyEntriesPlugin(),
|
|
5573
6132
|
farmPlugin({ ...config, isolatedClientBoundaryModules }, pluginManager),
|
|
5574
|
-
|
|
6133
|
+
_chunk4DRINDGNcjs.farmEnvironmentFunctionsPlugin.call(void 0, config),
|
|
5575
6134
|
...hasRuntimeConfigModule ? [
|
|
5576
6135
|
farmStripPlatformConfigPlugin(
|
|
5577
6136
|
[
|
|
@@ -5618,7 +6177,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5618
6177
|
resolve: {
|
|
5619
6178
|
alias: [
|
|
5620
6179
|
...shouldAliasReactServerToWebBuild(config.renderer, preset) ? [createFarmReactWebServerAlias(hasReactDomEdgeServerBuild(root))] : [],
|
|
5621
|
-
...Object.entries(
|
|
6180
|
+
...Object.entries(_chunkN5DQMOAGcjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
|
|
5622
6181
|
([find, replacement]) => ({ find, replacement })
|
|
5623
6182
|
)
|
|
5624
6183
|
],
|
|
@@ -5626,12 +6185,12 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5626
6185
|
dedupe: [...config.renderer.dedupe || []]
|
|
5627
6186
|
}
|
|
5628
6187
|
};
|
|
5629
|
-
await viteBuild(
|
|
6188
|
+
await viteBuild(_chunkN5DQMOAGcjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
|
|
5630
6189
|
} finally {
|
|
5631
6190
|
if (postcssConfigDir) {
|
|
5632
6191
|
try {
|
|
5633
6192
|
await fs4.rm(postcssConfigDir, { recursive: true, force: true });
|
|
5634
|
-
} catch (
|
|
6193
|
+
} catch (e31) {
|
|
5635
6194
|
}
|
|
5636
6195
|
}
|
|
5637
6196
|
}
|
|
@@ -5644,7 +6203,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5644
6203
|
function readFarmAppPackageIdentity(root) {
|
|
5645
6204
|
try {
|
|
5646
6205
|
return JSON.parse(_fs.readFileSync.call(void 0, _path2.default.join(root, "package.json"), "utf8"));
|
|
5647
|
-
} catch (
|
|
6206
|
+
} catch (e32) {
|
|
5648
6207
|
return {};
|
|
5649
6208
|
}
|
|
5650
6209
|
}
|
|
@@ -5656,32 +6215,32 @@ function readFarmPageLastModified(pageRoutes) {
|
|
|
5656
6215
|
lastModified[route.pattern] = _fs.statSync.call(void 0,
|
|
5657
6216
|
_nullishCoalesce(route.markdownSourcePath, () => ( route.modulePath))
|
|
5658
6217
|
).mtime.toISOString();
|
|
5659
|
-
} catch (
|
|
6218
|
+
} catch (e33) {
|
|
5660
6219
|
}
|
|
5661
6220
|
}
|
|
5662
6221
|
return lastModified;
|
|
5663
6222
|
}
|
|
5664
6223
|
function getFarmDocsGuardedPaths(config, middlewareRoutes) {
|
|
5665
|
-
if (!_optionalChain([config, 'access',
|
|
6224
|
+
if (!_optionalChain([config, 'access', _128 => _128.docs, 'optionalAccess', _129 => _129.enabled])) return [];
|
|
5666
6225
|
const options = { root: config.root, srcDir: config.srcDir };
|
|
5667
6226
|
const guards = {
|
|
5668
6227
|
config: { middleware: config.middleware, integrations: config.integrations },
|
|
5669
6228
|
middlewareRoutes
|
|
5670
6229
|
};
|
|
5671
|
-
return
|
|
5672
|
-
(docsRoot) =>
|
|
5673
|
-
).flatMap((page) => [page.href,
|
|
6230
|
+
return _chunkPPX7UOFYcjs.getFarmDocsRoots.call(void 0, config.docs).flatMap(
|
|
6231
|
+
(docsRoot) => _chunkPPX7UOFYcjs.discoverFarmDocsPages.call(void 0, _chunkPPX7UOFYcjs.resolveFarmDocsContentDir.call(void 0, docsRoot, options), docsRoot)
|
|
6232
|
+
).flatMap((page) => [page.href, _chunkPPX7UOFYcjs.getFarmDocsMarkdownPath.call(void 0, page.href)]).filter((pathname) => _chunkUPOYKX4Scjs.farmPathGuardCoversPage.call(void 0, guards, pathname));
|
|
5674
6233
|
}
|
|
5675
6234
|
function getFarmAppOwnedDocsEnginePaths(agent, applicationMetadataRoutes) {
|
|
5676
|
-
const llmsTxt = _optionalChain([agent, 'optionalAccess',
|
|
6235
|
+
const llmsTxt = _optionalChain([agent, 'optionalAccess', _130 => _130.llmsTxt]);
|
|
5677
6236
|
const ownedByFile = (kind) => applicationMetadataRoutes.some(
|
|
5678
6237
|
(metadata) => metadata.kind === kind && metadata.pattern === "/"
|
|
5679
6238
|
);
|
|
5680
6239
|
return [
|
|
5681
|
-
..._optionalChain([llmsTxt, 'optionalAccess',
|
|
5682
|
-
..._optionalChain([llmsTxt, 'optionalAccess',
|
|
5683
|
-
..._optionalChain([agent, 'optionalAccess',
|
|
5684
|
-
..._optionalChain([agent, 'optionalAccess',
|
|
6240
|
+
..._optionalChain([llmsTxt, 'optionalAccess', _131 => _131.enabled]) || ownedByFile("llms") ? ["/llms.txt"] : [],
|
|
6241
|
+
..._optionalChain([llmsTxt, 'optionalAccess', _132 => _132.enabled]) && llmsTxt.full || ownedByFile("llms-full") ? ["/llms-full.txt"] : [],
|
|
6242
|
+
..._optionalChain([agent, 'optionalAccess', _133 => _133.sitemap, 'optionalAccess', _134 => _134.enabled]) || ownedByFile("sitemap") ? ["/sitemap.xml"] : [],
|
|
6243
|
+
..._optionalChain([agent, 'optionalAccess', _135 => _135.crawlers, 'optionalAccess', _136 => _136.enabled]) || ownedByFile("robots") ? ["/robots.txt"] : []
|
|
5685
6244
|
];
|
|
5686
6245
|
}
|
|
5687
6246
|
function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
@@ -5692,7 +6251,7 @@ function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
|
5692
6251
|
docsPath: ${root}.entry,
|
|
5693
6252
|
contentDir: ${root}.contentDir || ${root}.config?.contentDir,
|
|
5694
6253
|
}`;
|
|
5695
|
-
if (_optionalChain([docs, 'optionalAccess',
|
|
6254
|
+
if (_optionalChain([docs, 'optionalAccess', _137 => _137.roots, 'optionalAccess', _138 => _138.length])) {
|
|
5696
6255
|
return {
|
|
5697
6256
|
factory: "createFarmDocsAdapterMultiRuntimeHandler",
|
|
5698
6257
|
config: `[farmDocsResolvedConfig, ...farmDocsResolvedConfig.roots].map((farmDocsRoot) => (${runtimeConfig("farmDocsRoot")}))`
|
|
@@ -5705,7 +6264,7 @@ function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
|
5705
6264
|
}
|
|
5706
6265
|
function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
|
|
5707
6266
|
if (!docs.enabled) return "null";
|
|
5708
|
-
const serializableDocs = _optionalChain([docs, 'access',
|
|
6267
|
+
const serializableDocs = _optionalChain([docs, 'access', _139 => _139.roots, 'optionalAccess', _140 => _140.length]) ? {
|
|
5709
6268
|
...docs,
|
|
5710
6269
|
// React elements and functions do not survive JSON; see runtimeConfig below.
|
|
5711
6270
|
roots: docs.roots.map((docsRoot) => ({ ...docsRoot, runtimeConfig: void 0 }))
|
|
@@ -5739,7 +6298,7 @@ function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
|
|
|
5739
6298
|
},
|
|
5740
6299
|
}
|
|
5741
6300
|
: ${JSON.stringify({ ...serializableDocs, runtimeConfig: void 0 })}`;
|
|
5742
|
-
if (!_optionalChain([docs, 'access',
|
|
6301
|
+
if (!_optionalChain([docs, 'access', _141 => _141.roots, 'optionalAccess', _142 => _142.length])) return expression;
|
|
5743
6302
|
return `((farmDocs) => ({
|
|
5744
6303
|
...farmDocs,
|
|
5745
6304
|
roots: farmDocs.roots.map((farmDocsRoot, index) => {
|
|
@@ -5756,7 +6315,7 @@ function toVirtualEntryImportSpecifier(modulePath) {
|
|
|
5756
6315
|
return JSON.stringify(modulePath.replace(/\\/g, "/"));
|
|
5757
6316
|
}
|
|
5758
6317
|
function generateNativeAuthIntegrationSource(auth) {
|
|
5759
|
-
if (_optionalChain([auth, 'optionalAccess',
|
|
6318
|
+
if (_optionalChain([auth, 'optionalAccess', _143 => _143.enabled]) !== true) {
|
|
5760
6319
|
return { importSource: "", registerSource: "" };
|
|
5761
6320
|
}
|
|
5762
6321
|
return {
|
|
@@ -5778,17 +6337,33 @@ function matchLocalIntegrationRequest(request) {
|
|
|
5778
6337
|
});` : "return null;"}
|
|
5779
6338
|
}
|
|
5780
6339
|
|
|
5781
|
-
async function handleIntegrationRequest(request, ranMiddleware, clientAddress) {
|
|
5782
|
-
${options.hasServerRuntimeIntegrations ? `
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
6340
|
+
async function handleIntegrationRequest(request, ranMiddleware, clientAddress, reportRuntimeError) {
|
|
6341
|
+
${options.hasServerRuntimeIntegrations ? `try {
|
|
6342
|
+
return await dispatchIntegrationRequests(
|
|
6343
|
+
serverRuntimeIntegrations,
|
|
6344
|
+
{
|
|
6345
|
+
config: integrationRuntimeConfig,
|
|
6346
|
+
isDev: false,
|
|
6347
|
+
isProd: true,
|
|
6348
|
+
},
|
|
6349
|
+
request,
|
|
6350
|
+
{ ranMiddleware, clientAddress },
|
|
6351
|
+
);
|
|
6352
|
+
} catch (error) {
|
|
6353
|
+
// Integration middleware on any other request keeps failing that request.
|
|
6354
|
+
if (!matchLocalIntegrationRequest(request)) throw error;
|
|
6355
|
+
// A throwing integration route answers 500, as an API route does: a plugin's
|
|
6356
|
+
// runtime.error observes the throw, and runtime.after still sees this 500.
|
|
6357
|
+
console.error("[Integration Error] " + new URL(request.url).pathname + ":", error);
|
|
6358
|
+
await reportRuntimeError?.(error);
|
|
6359
|
+
return {
|
|
6360
|
+
response: new Response(JSON.stringify({ error: "Internal Server Error" }), {
|
|
6361
|
+
status: 500,
|
|
6362
|
+
headers: { "Content-Type": "application/json" },
|
|
6363
|
+
}),
|
|
6364
|
+
setCookies: [],
|
|
6365
|
+
};
|
|
6366
|
+
}` : `return { response: null, setCookies: [] };`}
|
|
5792
6367
|
}
|
|
5793
6368
|
|
|
5794
6369
|
// Merge Set-Cookie values forwarded by a passthrough integration middleware
|
|
@@ -6039,7 +6614,7 @@ async function applyFarmPreloadBudget(response, pathname, request) {
|
|
|
6039
6614
|
`.trim();
|
|
6040
6615
|
}
|
|
6041
6616
|
function generateFarmRendererAppSetupServerCode(config) {
|
|
6042
|
-
const appSetupPath =
|
|
6617
|
+
const appSetupPath = _chunk67MZTLTFcjs.resolveFarmRendererAppSetup.call(void 0, config.root || process.cwd(), config.renderer);
|
|
6043
6618
|
if (!appSetupPath) return "";
|
|
6044
6619
|
return `
|
|
6045
6620
|
import __farmAppSetup from ${JSON.stringify(_chunkQMNWKQL4cjs.toPosixPath.call(void 0, appSetupPath))};
|
|
@@ -6049,39 +6624,40 @@ if (typeof ReactDOMServer.configureApp !== "function") {
|
|
|
6049
6624
|
ReactDOMServer.configureApp(__farmAppSetup);`;
|
|
6050
6625
|
}
|
|
6051
6626
|
function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlots, errorRoutes, metadataImageRoutes, applicationMetadataRoutes, middlewareRoutes, redirectRoutes, configuredRewriteRoutes, configuredHeaderRoutes, openAPIReference, notFoundPath, instrumentationPath, config, farmDocsPrecompiledManifest, configModulePath, hasServerRuntimeIntegrations, hasRuntimeIntegrationConfig, hasConfiguredRuntimePlugins, hasServerRuntimePlugins, preset, i18nCatalogs, isolatedClientBoundaryModules, hydrationPlanCache, mobileShellLoadingRoutes = []) {
|
|
6052
|
-
const
|
|
6053
|
-
const
|
|
6627
|
+
const farmRendererDisabled = _chunk67MZTLTFcjs.isFarmRendererDisabled.call(void 0, config.renderer);
|
|
6628
|
+
const farmIslandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _144 => _144.experimental, 'optionalAccess', _145 => _145.serverComponents])) === "islands";
|
|
6629
|
+
const farmClientBoot = _chunkN5DQMOAGcjs.canBootFarmIslandsClient.call(void 0, config);
|
|
6054
6630
|
const farmMobileClient = shouldBuildFarmMobileClient(config);
|
|
6055
6631
|
const farmMobileShells = farmMobileClient && config.mobileShells ? config.mobileShells : null;
|
|
6056
6632
|
const hasCompressionRuntime = config.compress && _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
|
|
6057
|
-
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access',
|
|
6633
|
+
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access', _146 => _146.agent, 'optionalAccess', _147 => _147.crawlers, 'optionalAccess', _148 => _148.enabled])) && !applicationMetadataRoutes.some(
|
|
6058
6634
|
(metadata) => metadata.kind === "robots" && metadata.pattern === "/"
|
|
6059
6635
|
);
|
|
6060
|
-
const servesAgentSitemap = Boolean(_optionalChain([config, 'access',
|
|
6636
|
+
const servesAgentSitemap = Boolean(_optionalChain([config, 'access', _149 => _149.agent, 'optionalAccess', _150 => _150.sitemap, 'optionalAccess', _151 => _151.enabled])) && !applicationMetadataRoutes.some(
|
|
6061
6637
|
(metadata) => metadata.kind === "sitemap" && metadata.pattern === "/"
|
|
6062
6638
|
);
|
|
6063
|
-
const servesDefaultMCP = _optionalChain([config, 'access',
|
|
6064
|
-
const servesAiCatalog = _optionalChain([config, 'access',
|
|
6639
|
+
const servesDefaultMCP = _optionalChain([config, 'access', _152 => _152.agent, 'optionalAccess', _153 => _153.mcp]) === true && !_chunkX3MHKLCOcjs.farmConfigMountsMCP.call(void 0, config) && !apiRoutes.some((route) => route.path === "/api/mcp");
|
|
6640
|
+
const servesAiCatalog = _optionalChain([config, 'access', _154 => _154.agent, 'optionalAccess', _155 => _155.aiCatalog]) !== false;
|
|
6065
6641
|
const hasPluginRuntime = hasRuntimeIntegrationConfig || hasServerRuntimePlugins;
|
|
6066
6642
|
const hasInfraAnalyticsRuntime = config.analytics !== false && _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
|
|
6067
6643
|
const hasPrecompiledDocs = Boolean(farmDocsPrecompiledManifest);
|
|
6068
6644
|
const adapterOwnsDocsRuntime = Boolean(
|
|
6069
|
-
|
|
6645
|
+
_chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _156 => _156.docs, 'optionalAccess', _157 => _157.enabled]) && _optionalChain([config, 'access', _158 => _158.docs, 'access', _159 => _159.adapter, 'optionalAccess', _160 => _160.server]) && config.docs.adapter.react
|
|
6070
6646
|
);
|
|
6071
|
-
if (_optionalChain([config, 'access',
|
|
6647
|
+
if (_optionalChain([config, 'access', _161 => _161.docs, 'optionalAccess', _162 => _162.enabled]) && _optionalChain([config, 'access', _163 => _163.docs, 'access', _164 => _164.roots, 'optionalAccess', _165 => _165.length]) && !adapterOwnsDocsRuntime) {
|
|
6072
6648
|
throw new Error(
|
|
6073
6649
|
"Several docs roots need the docs adapter, which serves the React renderer only; Farm's built-in docs renderer serves a single docs root."
|
|
6074
6650
|
);
|
|
6075
6651
|
}
|
|
6076
6652
|
const docsConfigModulePath = adapterOwnsDocsRuntime && !hasPrecompiledDocs && config.docs.configPath && !config.docs.configPath.endsWith(".json") ? config.docs.configPath : void 0;
|
|
6077
6653
|
const adapterHandler = generateFarmDocsAdapterHandlerArguments(config.docs, docsConfigModulePath);
|
|
6078
|
-
const hasIsolatedClientGraphRuntime =
|
|
6079
|
-
const rendererStreamingCapabilities =
|
|
6654
|
+
const hasIsolatedClientGraphRuntime = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) && isolatedClientBoundaryModules.size > 0;
|
|
6655
|
+
const rendererStreamingCapabilities = _chunk67MZTLTFcjs.getFarmRendererStreamingCapabilitiesForRuntime.call(void 0,
|
|
6080
6656
|
config.renderer,
|
|
6081
|
-
|
|
6657
|
+
_chunkF43OG25Pcjs.getFarmPresetRuntime.call(void 0, preset)
|
|
6082
6658
|
);
|
|
6083
|
-
const hasReactSyncRender =
|
|
6084
|
-
const rendererServerImports =
|
|
6659
|
+
const hasReactSyncRender = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer);
|
|
6660
|
+
const rendererServerImports = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) ? `import * as React from "react";
|
|
6085
6661
|
import * as ReactDOMServer from "react-dom/server";${hasIsolatedClientGraphRuntime ? farmIslandsMode ? '\nimport { isolateFarmServerPageGraph, wrapFarmIsolatedClientGraph, renderFarmServerTreePage, renderFarmServerTreeLayout, withFarmIslandsRender } from "@farm.js/core/internal/islands-runtime";' : '\nimport { isolateFarmServerPageGraph, wrapFarmIsolatedClientGraph } from "@farm.js/core/internal/isolated-boundary";\nimport { renderFarmServerTreePage } from "@farm.js/core/internal/server-tree";' : ""}` : `import React, * as ReactDOMServer from ${JSON.stringify(config.renderer.server)};${generateFarmRendererAppSetupServerCode(config)}`;
|
|
6086
6662
|
const routeClientGraphServerRuntime = hasIsolatedClientGraphRuntime ? `function wrapFarmRouteClientGraph(element) {
|
|
6087
6663
|
return wrapFarmIsolatedClientGraph(React, element);
|
|
@@ -6117,27 +6693,27 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6117
6693
|
const hasGeneratedMetadataImages = metadataImageRoutes.some(
|
|
6118
6694
|
(image) => image.sourceType === "module"
|
|
6119
6695
|
);
|
|
6120
|
-
const hasMiddlewareRuntime = middlewareRoutes.length > 0 ||
|
|
6121
|
-
const farmDocsFontAssets = _optionalChain([config, 'access',
|
|
6122
|
-
const integrationProviders =
|
|
6696
|
+
const hasMiddlewareRuntime = middlewareRoutes.length > 0 || _chunkUPOYKX4Scjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
|
|
6697
|
+
const farmDocsFontAssets = _optionalChain([config, 'access', _166 => _166.docs, 'optionalAccess', _167 => _167.enabled]) ? _chunkERMUL73Lcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkERMUL73Lcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
|
|
6698
|
+
const integrationProviders = _chunkBDYM2TN3cjs.getIntegrationProviders.call(void 0, config.integrations);
|
|
6123
6699
|
const renderedIntegrationProviders = integrationProviders.filter(
|
|
6124
6700
|
(provider) => provider.component || provider.type === "clerk"
|
|
6125
6701
|
);
|
|
6126
|
-
if (renderedIntegrationProviders.length > 0 && !
|
|
6702
|
+
if (renderedIntegrationProviders.length > 0 && !_chunk67MZTLTFcjs.getFarmRendererCapabilities.call(void 0, config.renderer).functionComponents) {
|
|
6127
6703
|
throw new Error(
|
|
6128
6704
|
`Integration provider components are not supported by the "${config.renderer.name}" renderer.`
|
|
6129
6705
|
);
|
|
6130
6706
|
}
|
|
6131
|
-
const providerServerModules =
|
|
6707
|
+
const providerServerModules = _chunkN5DQMOAGcjs.generateFarmIntegrationProviderServerModules.call(void 0,
|
|
6132
6708
|
renderedIntegrationProviders,
|
|
6133
6709
|
config.root,
|
|
6134
6710
|
_nullishCoalesce(config.renderer.componentExtensions, () => ( []))
|
|
6135
6711
|
);
|
|
6136
6712
|
const resolvedIntegrationProviderFallback = Object.fromEntries(
|
|
6137
6713
|
Object.entries(config.integrations).flatMap(([name, integration]) => {
|
|
6138
|
-
const configuredProviders = _optionalChain([integration, 'optionalAccess',
|
|
6714
|
+
const configuredProviders = _optionalChain([integration, 'optionalAccess', _168 => _168.providers]);
|
|
6139
6715
|
const providers = Array.isArray(configuredProviders) ? configuredProviders : [];
|
|
6140
|
-
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess',
|
|
6716
|
+
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess', _169 => _169.component]) === "function")) {
|
|
6141
6717
|
throw new Error(
|
|
6142
6718
|
`Integration provider components in production must use an importable component reference, for example component: { module: "@/components/provider" }.`
|
|
6143
6719
|
);
|
|
@@ -6148,20 +6724,20 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6148
6724
|
const unsupportedIntegrationProvider = renderedIntegrationProviders.find(
|
|
6149
6725
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
6150
6726
|
);
|
|
6151
|
-
const isolatedHydrationMode =
|
|
6152
|
-
_optionalChain([config, 'access',
|
|
6727
|
+
const isolatedHydrationMode = _chunk4DRINDGNcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
6728
|
+
_optionalChain([config, 'access', _170 => _170.experimental, 'optionalAccess', _171 => _171.isolatedClientHydration]),
|
|
6153
6729
|
{
|
|
6154
|
-
serverComponents:
|
|
6730
|
+
serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _172 => _172.experimental, 'optionalAccess', _173 => _173.serverComponents])) === "rsc",
|
|
6155
6731
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
6156
6732
|
}
|
|
6157
6733
|
);
|
|
6158
|
-
const hydrationPlanOptions =
|
|
6734
|
+
const hydrationPlanOptions = _chunk4DRINDGNcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
6159
6735
|
config.renderer,
|
|
6160
6736
|
Boolean(unsupportedIntegrationProvider)
|
|
6161
6737
|
);
|
|
6162
6738
|
const pageHydrationPlanOptions = {
|
|
6163
6739
|
...hydrationPlanOptions,
|
|
6164
|
-
serverOwners:
|
|
6740
|
+
serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _174 => _174.experimental, 'optionalAccess', _175 => _175.serverComponents])) === "islands"
|
|
6165
6741
|
};
|
|
6166
6742
|
const layoutHydrationPlans = layoutRoutes.map((layout) => ({
|
|
6167
6743
|
...layout,
|
|
@@ -6173,7 +6749,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6173
6749
|
{ ...hydrationPlanOptions, serverTreeLayouts: pageHydrationPlanOptions.serverOwners }
|
|
6174
6750
|
)
|
|
6175
6751
|
}));
|
|
6176
|
-
const markdownPagePlan =
|
|
6752
|
+
const markdownPagePlan = _chunk4DRINDGNcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
6177
6753
|
_chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), config.root),
|
|
6178
6754
|
config.root,
|
|
6179
6755
|
isolatedHydrationMode,
|
|
@@ -6182,7 +6758,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6182
6758
|
const pageHydrationPlans = new Map(
|
|
6183
6759
|
pageRoutes.map((route) => [
|
|
6184
6760
|
route.modulePath,
|
|
6185
|
-
|
|
6761
|
+
_chunkQ37INCXGcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
|
|
6186
6762
|
route.modulePath,
|
|
6187
6763
|
config.root,
|
|
6188
6764
|
isolatedHydrationMode,
|
|
@@ -6191,7 +6767,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6191
6767
|
)
|
|
6192
6768
|
])
|
|
6193
6769
|
);
|
|
6194
|
-
|
|
6770
|
+
_chunk4DRINDGNcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
6195
6771
|
layoutHydrationPlans.map((layout) => ({
|
|
6196
6772
|
pattern: layout.pattern,
|
|
6197
6773
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -6200,10 +6776,10 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6200
6776
|
pageRoutes.map((route) => ({
|
|
6201
6777
|
// Compared by directory so a grouped layout applies only inside its group.
|
|
6202
6778
|
pattern: _nullishCoalesce(route.directory, () => ( route.pattern)),
|
|
6203
|
-
depth:
|
|
6779
|
+
depth: _chunkUPOYKX4Scjs.getRouteDirectoryDepth.call(void 0, _nullishCoalesce(route.directory, () => ( route.pattern))),
|
|
6204
6780
|
metadata: pageHydrationPlans.get(route.modulePath)
|
|
6205
6781
|
})),
|
|
6206
|
-
|
|
6782
|
+
_chunkUPOYKX4Scjs.routeBoundaryCoversDirectory,
|
|
6207
6783
|
{ serverOwners: pageHydrationPlanOptions.serverOwners }
|
|
6208
6784
|
);
|
|
6209
6785
|
const providerServerImports = [
|
|
@@ -6221,7 +6797,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6221
6797
|
apiRegistrations.push(`
|
|
6222
6798
|
{
|
|
6223
6799
|
path: ${JSON.stringify(route.path)},
|
|
6224
|
-
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access',
|
|
6800
|
+
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access', _176 => _176.pluginMethods, 'optionalAccess', _177 => _177.includes, 'call', _178 => _178(method)])))},
|
|
6225
6801
|
endpoints: ${varName},
|
|
6226
6802
|
}`);
|
|
6227
6803
|
});
|
|
@@ -6234,7 +6810,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6234
6810
|
}).map(({ route }) => route);
|
|
6235
6811
|
orderedPageRoutes.forEach((route, index) => {
|
|
6236
6812
|
const varName = `pageRoute${index}`;
|
|
6237
|
-
if (
|
|
6813
|
+
if (_chunkQ37INCXGcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) {
|
|
6238
6814
|
pageRegistrations.push(`
|
|
6239
6815
|
{
|
|
6240
6816
|
pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
|
|
@@ -6258,7 +6834,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6258
6834
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(route.modulePath)};`
|
|
6259
6835
|
);
|
|
6260
6836
|
const clientMetadata = pageHydrationPlans.get(route.modulePath);
|
|
6261
|
-
const renderingDirective =
|
|
6837
|
+
const renderingDirective = _chunkYVTS3S3Fcjs.readRouteRenderingDirectiveFromFile.call(void 0, route.modulePath);
|
|
6262
6838
|
pageRegistrations.push(`
|
|
6263
6839
|
{
|
|
6264
6840
|
pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
|
|
@@ -6266,8 +6842,8 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6266
6842
|
module: ${varName},
|
|
6267
6843
|
shouldHydrate: ${JSON.stringify(clientMetadata.shouldHydrate)},${clientMetadata.shouldHydrate ? `
|
|
6268
6844
|
clientModule: ${JSON.stringify(_chunkQMNWKQL4cjs.toViteModuleId.call(void 0, route.modulePath, config.root))},` : ""}
|
|
6269
|
-
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${
|
|
6270
|
-
const rootStrategy =
|
|
6845
|
+
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${_chunk4DRINDGNcjs.usesFarmServerTree.call(void 0, clientMetadata) ? "\n serverTree: true," : ""}${(() => {
|
|
6846
|
+
const rootStrategy = _chunkN5DQMOAGcjs.resolveFarmRouteRootStrategy.call(void 0,
|
|
6271
6847
|
route,
|
|
6272
6848
|
clientMetadata,
|
|
6273
6849
|
layoutHydrationPlans.map((layout) => ({ ...layout, ...layout.hydration })),
|
|
@@ -6286,7 +6862,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6286
6862
|
});
|
|
6287
6863
|
const layoutImports = [];
|
|
6288
6864
|
const layoutRegistrations = [];
|
|
6289
|
-
const treeLayoutPatterns = farmIslandsMode ?
|
|
6865
|
+
const treeLayoutPatterns = farmIslandsMode ? _chunkUPOYKX4Scjs.getFarmServerTreeLayoutPatterns.call(void 0,
|
|
6290
6866
|
layoutHydrationPlans.map((layout) => ({
|
|
6291
6867
|
pattern: layout.pattern,
|
|
6292
6868
|
shouldHydrate: layout.hydration.shouldHydrate,
|
|
@@ -6330,6 +6906,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6330
6906
|
containerId: ${JSON.stringify(slot.containerId)},
|
|
6331
6907
|
interception: ${JSON.stringify(slot.interception)},
|
|
6332
6908
|
fallback: ${JSON.stringify(slot.fallback)},
|
|
6909
|
+
hydrates: ${!farmIslandsMode || _chunk4DRINDGNcjs.getClientModuleMetadata.call(void 0, slot.modulePath, config.root).isClientComponent},
|
|
6333
6910
|
module: ${varName},
|
|
6334
6911
|
}`);
|
|
6335
6912
|
});
|
|
@@ -6340,12 +6917,12 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6340
6917
|
errorImports.push(
|
|
6341
6918
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(errorRoute.modulePath)};`
|
|
6342
6919
|
);
|
|
6343
|
-
const groupScope =
|
|
6920
|
+
const groupScope = _chunkUPOYKX4Scjs.getRouteGroupScope.call(void 0, errorRoute.pattern);
|
|
6344
6921
|
errorRegistrations.push(`
|
|
6345
6922
|
{
|
|
6346
|
-
pattern: ${JSON.stringify(
|
|
6923
|
+
pattern: ${JSON.stringify(_chunkUPOYKX4Scjs.stripRouteGroups.call(void 0, errorRoute.pattern))},${groupScope ? `
|
|
6347
6924
|
groupScope: ${JSON.stringify(groupScope)},
|
|
6348
|
-
directoryDepth: ${
|
|
6925
|
+
directoryDepth: ${_chunkUPOYKX4Scjs.getRouteDirectoryDepth.call(void 0, errorRoute.pattern)},` : ""}
|
|
6349
6926
|
module: ${varName},
|
|
6350
6927
|
}`);
|
|
6351
6928
|
});
|
|
@@ -6357,12 +6934,12 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6357
6934
|
loadingImports.push(
|
|
6358
6935
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(loadingRoute.modulePath)};`
|
|
6359
6936
|
);
|
|
6360
|
-
const groupScope =
|
|
6937
|
+
const groupScope = _chunkUPOYKX4Scjs.getRouteGroupScope.call(void 0, loadingRoute.pattern);
|
|
6361
6938
|
loadingRegistrations.push(`
|
|
6362
6939
|
{
|
|
6363
|
-
pattern: ${JSON.stringify(
|
|
6940
|
+
pattern: ${JSON.stringify(_chunkUPOYKX4Scjs.stripRouteGroups.call(void 0, loadingRoute.pattern))},${groupScope ? `
|
|
6364
6941
|
groupScope: ${JSON.stringify(groupScope)},
|
|
6365
|
-
directoryDepth: ${
|
|
6942
|
+
directoryDepth: ${_chunkUPOYKX4Scjs.getRouteDirectoryDepth.call(void 0, loadingRoute.pattern)},` : ""}
|
|
6366
6943
|
module: ${varName},
|
|
6367
6944
|
}`);
|
|
6368
6945
|
});
|
|
@@ -6435,6 +7012,9 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6435
7012
|
applyFarmCspNonceToResponse,
|
|
6436
7013
|
createFarmCspNonce,
|
|
6437
7014
|
stampFarmCspNonce,
|
|
7015
|
+
isDeferred,
|
|
7016
|
+
prepareDeferredData,
|
|
7017
|
+
snapshotDeferredData,
|
|
6438
7018
|
applyFarmPreviewRobotsTag,
|
|
6439
7019
|
applyFarmThemeDocument,
|
|
6440
7020
|
appendFarmLinkHeader,
|
|
@@ -6460,9 +7040,12 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6460
7040
|
collectFarmLlmsTxtPages,
|
|
6461
7041
|
createFarmDefaultLlmsTxt,
|
|
6462
7042
|
createFarmLlmsMarkdownReader,
|
|
7043
|
+
isFarmPageNoIndex,
|
|
6463
7044
|
listFarmMCPLlmsTxtLinks,
|
|
7045
|
+
readFarmLlmsMarkdownFrom,
|
|
6464
7046
|
registerFarmMCPServer,
|
|
6465
7047
|
renderFarmLlmsFullTxt,
|
|
7048
|
+
resolveFarmAgentOrigin,
|
|
6466
7049
|
createFarmLlmsFullRenderer,
|
|
6467
7050
|
createFarmThemeDocumentParts,
|
|
6468
7051
|
createFarmLocaleCookie,
|
|
@@ -6516,7 +7099,7 @@ import { _applyFarmMobileShellClient } from "@farm.js/core/internal/production-r
|
|
|
6516
7099
|
// The mobile client documents load when a mobile shell asks for them (RFC 0004, 7.2), filled in
|
|
6517
7100
|
// once the client build has finished (see buildNitroUniversal). A shell's document stays out of
|
|
6518
7101
|
// shared caches, which the adapter learns as it does for a guarded response.
|
|
6519
|
-
const farmMobileShellClient = JSON.parse("${
|
|
7102
|
+
const farmMobileShellClient = JSON.parse("${_chunkE5UN4OWXcjs.FARM_MOBILE_SHELL_CLIENT_PLACEHOLDER}");
|
|
6520
7103
|
function applyFarmMobileShellResponse(request, response, context) {
|
|
6521
7104
|
return _applyFarmMobileShellClient(request, response, farmMobileShellClient, () =>
|
|
6522
7105
|
context?.onGuardedResponse?.()
|
|
@@ -6577,25 +7160,25 @@ ${FARM_SEGMENT_NAVIGATION_SERVER_RUNTIME}` : ""}`;
|
|
|
6577
7160
|
const infraAnalyticsImport = hasInfraAnalyticsRuntime ? `import { ${hasPluginRuntime ? "createFarmInfraAnalyticsPlugin" : "createFarmInfraAnalyticsRecorder"} } from "@farm.js/core/internal/infra-analytics-runtime";` : "";
|
|
6578
7161
|
const compressionRuntimeImport = hasCompressionRuntime ? `import { compressFarmResponse${hasPluginRuntime ? ", createCompressionPlugin" : ""} } from "@farm.js/core/internal/compression-runtime";` : "";
|
|
6579
7162
|
const i18nServerImport = config.i18n.enabled ? `import { _runWithFarmI18nRequest, _setDefaultFarmI18nRuntime, createFarmI18nRuntime, getFarmI18nClientSnapshot } from "@farm.js/core/i18n/server";` : "";
|
|
6580
|
-
const docsHandlerImport = _optionalChain([config, 'access',
|
|
7163
|
+
const docsHandlerImport = _optionalChain([config, 'access', _179 => _179.docs, 'optionalAccess', _180 => _180.enabled]) ? hasPrecompiledDocs ? `import { createFarmDocsPrecompiledRuntime } from "@farm.js/core/internal/docs-precompiled-runtime";
|
|
6581
7164
|
const isFarmDocsAPIRequest = (requestOrPathname) => {
|
|
6582
7165
|
const pathname = typeof requestOrPathname === "string"
|
|
6583
7166
|
? requestOrPathname
|
|
6584
7167
|
: new URL(requestOrPathname.url).pathname;
|
|
6585
|
-
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess',
|
|
7168
|
+
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _181 => _181.apiPath]) || "/api/docs")};
|
|
6586
7169
|
return pathname === apiPath || pathname.startsWith(apiPath + "/");
|
|
6587
7170
|
};` : adapterOwnsDocsRuntime ? `import { ${docsConfigModulePath ? "getFarmDocsConfigModuleRoot, " : ""}isFarmDocsAPIRequest } from "@farm.js/core/docs";
|
|
6588
|
-
import { ${_optionalChain([config, 'access',
|
|
7171
|
+
import { ${_optionalChain([config, 'access', _182 => _182.docs, 'access', _183 => _183.roots, 'optionalAccess', _184 => _184.length]) ? "createFarmDocsMultiRuntimeHandler as createFarmDocsAdapterMultiRuntimeHandler" : "createFarmDocsRuntimeHandler as createFarmDocsAdapterRuntimeHandler"} } from ${JSON.stringify(config.docs.adapter.server)};
|
|
6589
7172
|
import * as FarmDocsAdapterReact from ${JSON.stringify(config.docs.adapter.react)};${docsConfigModulePath ? `
|
|
6590
7173
|
import * as farmDocsConfigModule from ${toVirtualEntryImportSpecifier(docsConfigModulePath)};` : ""}` : `import { createFarmDocsAPIHandler, createFarmDocsHandler, isFarmDocsAPIRequest } from "@farm.js/core/docs";` : "";
|
|
6591
|
-
const docsFontImport = _optionalChain([config, 'access',
|
|
6592
|
-
const docsRuntimeImport = _optionalChain([config, 'access',
|
|
7174
|
+
const docsFontImport = _optionalChain([config, 'access', _185 => _185.docs, 'optionalAccess', _186 => _186.enabled]) && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
|
|
7175
|
+
const docsRuntimeImport = _optionalChain([config, 'access', _187 => _187.docs, 'optionalAccess', _188 => _188.enabled]) && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
|
|
6593
7176
|
import { dirname as farmDocsDirname, join as farmDocsJoin } from "node:path";
|
|
6594
7177
|
import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
6595
|
-
const markdownHandlerImport = _optionalChain([config, 'access',
|
|
7178
|
+
const markdownHandlerImport = _optionalChain([config, 'access', _189 => _189.md, 'optionalAccess', _190 => _190.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
|
|
6596
7179
|
const appMarkdownImport = hasMarkdownPages ? `import { FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS, createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse, isFarmMarkdownPublicSourceResponse } from "@farm.js/core/internal/app-markdown-runtime";` : "const createFarmMarkdownSourceResponse = null;\nconst isFarmMarkdownPublicSourceResponse = null;";
|
|
6597
7180
|
const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, FARM_MARKDOWN_PAGE_CHECK_HEADER, _isFarmMarkdownPageCheck, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
|
|
6598
|
-
const mdxComponentsPath = typeof _optionalChain([config, 'access',
|
|
7181
|
+
const mdxComponentsPath = typeof _optionalChain([config, 'access', _191 => _191.mdx, 'optionalAccess', _192 => _192.components]) === "string" ? _path2.default.isAbsolute(config.mdx.components) ? config.mdx.components : _path2.default.join(config.root, config.mdx.components) : null;
|
|
6599
7182
|
const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
|
|
6600
7183
|
const layerConfigPaths = (config.layers || []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile)).filter((configFile) => configFile !== configModulePath);
|
|
6601
7184
|
const layerConfigImports = layerConfigPaths.map(
|
|
@@ -6615,14 +7198,14 @@ import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
|
6615
7198
|
const nativeAuth = generateNativeAuthIntegrationSource(config.auth);
|
|
6616
7199
|
const nativeMCP = _chunkVM57CK74cjs.generateNativeMCPPluginSource.call(void 0, config.mcp);
|
|
6617
7200
|
const mobileSession = (config.plugins || []).some(
|
|
6618
|
-
(plugin) => _optionalChain([plugin, 'optionalAccess',
|
|
7201
|
+
(plugin) => _optionalChain([plugin, 'optionalAccess', _193 => _193.name]) === _chunk4BS3HSY7cjs.FARM_MOBILE_SESSION_PLUGIN
|
|
6619
7202
|
);
|
|
6620
7203
|
const nativeServerFns = (config.plugins || []).some(
|
|
6621
|
-
(plugin) => _optionalChain([plugin, 'optionalAccess',
|
|
6622
|
-
) ?
|
|
7204
|
+
(plugin) => _optionalChain([plugin, 'optionalAccess', _194 => _194.name]) === _chunk4EBC7EMWcjs.FARM_NATIVE_SERVER_FN_PLUGIN
|
|
7205
|
+
) ? _chunk23PVOIPTcjs.collectFarmNativeServerFns.call(void 0, {
|
|
6623
7206
|
root: config.root,
|
|
6624
7207
|
srcDir: config.srcDir,
|
|
6625
|
-
entries:
|
|
7208
|
+
entries: _chunk23PVOIPTcjs.findFarmNativeScreenFiles.call(void 0, _chunk5Y2P454Ocjs.getFarmAppDirectories.call(void 0, config))
|
|
6626
7209
|
}) : void 0;
|
|
6627
7210
|
const integrationImports = `
|
|
6628
7211
|
${configModulePath ? `import * as FarmUserConfigModule from ${toVirtualEntryImportSpecifier(configModulePath)};` : ""}
|
|
@@ -6637,7 +7220,7 @@ ${nativeServerFns ? `const __farmNativeServerFnRegistry = Object.assign(Object.c
|
|
|
6637
7220
|
${nativeServerFns.flatMap((module, index) => module.exports.map((entry) => ` ${JSON.stringify(entry.id)}: __farmNativeServerFns${index}[${JSON.stringify(entry.name)}],`)).join("\n")}
|
|
6638
7221
|
});` : ""}
|
|
6639
7222
|
`;
|
|
6640
|
-
const imageRuntime =
|
|
7223
|
+
const imageRuntime = _chunkN5DQMOAGcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
|
|
6641
7224
|
const imageRuntimeImport = imageRuntime === "none" ? "" : `import { _withFarmImageSourceClientAddress, createCloudflareImageTransformer, createFarmImageHandler } from "@farm.js/core/image/server";`;
|
|
6642
7225
|
const imageNodeRuntimeImport = imageRuntime === "node" ? `import { createNodeImageFetcher, createNodeImageUrlValidator, createSharpImageTransformer } from "@farm.js/core/image/sharp";` : "";
|
|
6643
7226
|
const apiHandlerCode = apiRoutes.length > 0 ? `
|
|
@@ -6647,7 +7230,7 @@ function matchLocalAPIRequest(request) {
|
|
|
6647
7230
|
return matchBuiltAPIRoute(new URL(request.url).pathname);
|
|
6648
7231
|
}
|
|
6649
7232
|
|
|
6650
|
-
async function handleAPIRequest(request) {
|
|
7233
|
+
async function handleAPIRequest(request, reportRuntimeError) {
|
|
6651
7234
|
const url = new URL(request.url);
|
|
6652
7235
|
const method = request.method.toUpperCase();
|
|
6653
7236
|
const match = matchLocalAPIRequest(request);
|
|
@@ -6714,6 +7297,8 @@ async function handleAPIRequest(request) {
|
|
|
6714
7297
|
error,
|
|
6715
7298
|
});
|
|
6716
7299
|
console.error(\`[API Error] \${url.pathname}:\`, error);
|
|
7300
|
+
// A plugin's runtime.error observes the throw; runtime.after still sees this 500.
|
|
7301
|
+
await reportRuntimeError?.(error);
|
|
6717
7302
|
return new Response(
|
|
6718
7303
|
JSON.stringify({ error: "Internal Server Error" }),
|
|
6719
7304
|
{ status: 500, headers: { "Content-Type": "application/json" } }
|
|
@@ -6772,7 +7357,7 @@ ${routeClientGraphServerRuntime}
|
|
|
6772
7357
|
const farmRendererStreamingCapabilities = ${JSON.stringify(rendererStreamingCapabilities)};
|
|
6773
7358
|
const farmRendererName = ${JSON.stringify(config.renderer.name)};
|
|
6774
7359
|
const farmReactSyncRender = ${JSON.stringify(hasReactSyncRender)};
|
|
6775
|
-
const farmRendererRuntime = ${JSON.stringify(
|
|
7360
|
+
const farmRendererRuntime = ${JSON.stringify(_chunkF43OG25Pcjs.getFarmPresetRuntime.call(void 0, preset))};
|
|
6776
7361
|
const farmRendererRuntimeStreamingCapabilities = ReactDOMServer.capabilities &&
|
|
6777
7362
|
ReactDOMServer.capabilities.streaming;
|
|
6778
7363
|
if (farmRendererRuntimeStreamingCapabilities &&
|
|
@@ -6817,7 +7402,7 @@ const farmResolvedRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs);
|
|
|
6817
7402
|
|
|
6818
7403
|
function FarmDefault404Page() {
|
|
6819
7404
|
return React.createElement(React.Fragment, null,
|
|
6820
|
-
React.createElement("style", null, ${JSON.stringify(
|
|
7405
|
+
React.createElement("style", null, ${JSON.stringify(_chunkN5DQMOAGcjs.DEFAULT_NOT_FOUND_STYLES)}),
|
|
6821
7406
|
React.createElement("main", {
|
|
6822
7407
|
className: "farm-default-not-found",
|
|
6823
7408
|
"aria-labelledby": "farm-default-not-found-title",
|
|
@@ -6955,19 +7540,19 @@ const farmImageHandler = ${imageRuntime === "none" ? "null" : imageRuntime === "
|
|
|
6955
7540
|
onError(error) { console.error("[Farm Image]", error); },
|
|
6956
7541
|
})`};
|
|
6957
7542
|
const farmMarkdownConfig = ${JSON.stringify(config.md)};
|
|
6958
|
-
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
6959
|
-
${_optionalChain([config, 'access',
|
|
7543
|
+
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _195 => _195.agent, 'optionalAccess', _196 => _196.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
|
|
7544
|
+
${_optionalChain([config, 'access', _197 => _197.agent, 'optionalAccess', _198 => _198.llmsTxt, 'optionalAccess', _199 => _199.enabled]) ? "const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });\n" : ""}${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
|
|
6960
7545
|
const farmMdxConfig = ${JSON.stringify({
|
|
6961
7546
|
...config.mdx,
|
|
6962
|
-
components: typeof _optionalChain([config, 'access',
|
|
7547
|
+
components: typeof _optionalChain([config, 'access', _200 => _200.mdx, 'optionalAccess', _201 => _201.components]) === "string" ? config.mdx.components : void 0
|
|
6963
7548
|
})};
|
|
6964
7549
|
const configuredFarmMdxComponents = farmUserConfig?.mdx?.components;
|
|
6965
|
-
${_optionalChain([config, 'access',
|
|
7550
|
+
${_optionalChain([config, 'access', _202 => _202.agent, 'optionalAccess', _203 => _203.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
|
|
6966
7551
|
// environment this was built in, since Netlify exposes its deploy context only
|
|
6967
7552
|
// to the build.
|
|
6968
7553
|
const farmNoindexPreview = resolveFarmPreviewDeployment(
|
|
6969
7554
|
globalThis.process?.env,
|
|
6970
|
-
${JSON.stringify(
|
|
7555
|
+
${JSON.stringify(_chunk6V5YWI4Wcjs.isFarmPreviewDeploymentEnvironment.call(void 0, process.env))},
|
|
6971
7556
|
);` : ""}
|
|
6972
7557
|
const farmMdxComponents = ${mdxComponentsPath ? `(FarmMdxComponentsModule.components || Reflect.get(FarmMdxComponentsModule, "default") || {})` : `(configuredFarmMdxComponents && typeof configuredFarmMdxComponents === "object" ? configuredFarmMdxComponents : {})`};
|
|
6973
7558
|
const farmObservabilityConfig = farmUserConfig?.observability ?? ${JSON.stringify(
|
|
@@ -7013,7 +7598,7 @@ export const farmProductionLifecycle = createFarmProductionLifecycle({
|
|
|
7013
7598
|
});
|
|
7014
7599
|
const farmI18nRuntime = ${config.i18n.enabled ? `createFarmI18nRuntime(farmI18nConfig, ${JSON.stringify(i18nCatalogs)})` : "null"};
|
|
7015
7600
|
${config.i18n.enabled ? "_setDefaultFarmI18nRuntime(farmI18nRuntime);" : ""}
|
|
7016
|
-
const farmDocsBundledContentDir = ${_optionalChain([config, 'access',
|
|
7601
|
+
const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _204 => _204.docs, 'optionalAccess', _205 => _205.enabled]) && !hasPrecompiledDocs ? `(() => {
|
|
7017
7602
|
try {
|
|
7018
7603
|
const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
|
|
7019
7604
|
const candidates = [
|
|
@@ -7025,7 +7610,7 @@ const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _181 => _1
|
|
|
7025
7610
|
} catch {
|
|
7026
7611
|
return null;
|
|
7027
7612
|
}
|
|
7028
|
-
})()` : "null"};${_optionalChain([config, 'access',
|
|
7613
|
+
})()` : "null"};${_optionalChain([config, 'access', _206 => _206.docs, 'optionalAccess', _207 => _207.enabled]) && !hasPrecompiledDocs && _optionalChain([config, 'access', _208 => _208.docs, 'access', _209 => _209.roots, 'optionalAccess', _210 => _210.length]) ? `
|
|
7029
7614
|
const farmDocsBundledRootsDir = (() => {
|
|
7030
7615
|
try {
|
|
7031
7616
|
const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
|
|
@@ -7053,6 +7638,7 @@ globalThis.__FARM_DOCS_RUNTIME_CONFIG__ = {
|
|
|
7053
7638
|
srcDir: ${JSON.stringify(config.srcDir)},
|
|
7054
7639
|
docs: farmDocsResolvedConfig,
|
|
7055
7640
|
guardedPaths: farmDocsGuardedPaths,
|
|
7641
|
+
basePath: ${JSON.stringify(config.basePath)},
|
|
7056
7642
|
};
|
|
7057
7643
|
const farmDocsPrecompiledRuntime = ${hasPrecompiledDocs ? `createFarmDocsPrecompiledRuntime(${JSON.stringify(farmDocsPrecompiledManifest)})` : "null"};
|
|
7058
7644
|
// Filled in from the client build once it has finished (see buildNitroUniversal).
|
|
@@ -7076,7 +7662,7 @@ const farmDocsModulePreloadPaths = farmDocsModulePreloads
|
|
|
7076
7662
|
),
|
|
7077
7663
|
}
|
|
7078
7664
|
: undefined;
|
|
7079
|
-
const farmDocsHandler = ${_optionalChain([config, 'access',
|
|
7665
|
+
const farmDocsHandler = ${_optionalChain([config, 'access', _211 => _211.docs, 'optionalAccess', _212 => _212.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `${adapterHandler.factory}(${adapterHandler.config}, {
|
|
7080
7666
|
rootDir: farmDocsRuntimeRoot,
|
|
7081
7667
|
// A production build's content cannot change, so the adapter reads its
|
|
7082
7668
|
// navigation once instead of scanning the content directory per request.
|
|
@@ -7108,12 +7694,13 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _188 => _188.docs, '
|
|
|
7108
7694
|
// The client stylesheet carries globals.css under a content-hashed name.
|
|
7109
7695
|
globalStylesheetHref: ${JSON.stringify(FARM_CLIENT_CSS_HREF_PLACEHOLDER)},
|
|
7110
7696
|
isPathGuarded: isFarmDocsPathGuarded,
|
|
7697
|
+
basePath: ${JSON.stringify(config.basePath)},
|
|
7111
7698
|
})` : "null"};
|
|
7112
|
-
const farmDocsAPIHandler = ${_optionalChain([config, 'access',
|
|
7699
|
+
const farmDocsAPIHandler = ${_optionalChain([config, 'access', _213 => _213.docs, 'optionalAccess', _214 => _214.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig, isPathGuarded: isFarmDocsPathGuarded, basePath: ${JSON.stringify(config.basePath)} })` : "null"};
|
|
7113
7700
|
|
|
7114
7701
|
// API routes bundled at build time
|
|
7115
7702
|
const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
|
|
7116
|
-
]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path:
|
|
7703
|
+
]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path: path13, methods }) => ({ path: path13, methods })))}, { bodySizeLimit: ${JSON.stringify(config.server.bodySizeLimit)}, dispatch: dispatchFarmPluginAPIRequest })` : ""};
|
|
7117
7704
|
// A plugin calling an app endpoint (an MCP tool, say) goes through the whole
|
|
7118
7705
|
// pipeline, so the endpoint's middleware and integration guards run for it.
|
|
7119
7706
|
function dispatchFarmPluginAPIRequest(request) {
|
|
@@ -7133,13 +7720,16 @@ function fetchFarmInnerRequest(request, context) {
|
|
|
7133
7720
|
return fetch(new Request(request, { headers }), context);
|
|
7134
7721
|
}
|
|
7135
7722
|
const farmLocalAPIBasePath = ${JSON.stringify(_chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, config.api))};
|
|
7723
|
+
// Reports a failure Farm answers itself (an API or integration route's 500) to the plugin
|
|
7724
|
+
// runtime request.
|
|
7725
|
+
const farmRuntimeErrorSlot = Symbol("farm.runtime.error.slot");
|
|
7136
7726
|
const farmOpenAPIReference = ${JSON.stringify(openAPIReference)};
|
|
7137
|
-
${_optionalChain([config, 'access',
|
|
7138
|
-
` : ""}${_optionalChain([config, 'access',
|
|
7139
|
-
|
|
7727
|
+
${_optionalChain([config, 'access', _215 => _215.agent, 'optionalAccess', _216 => _216.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunkLPIZMU7Dcjs.resolveFarmApiCatalogInput.call(void 0, config))};
|
|
7728
|
+
` : ""}${_optionalChain([config, 'access', _217 => _217.agent, 'optionalAccess', _218 => _218.manifest]) !== false ? `const farmAppManifestInput = ${JSON.stringify(
|
|
7729
|
+
_chunkLPIZMU7Dcjs.resolveFarmAppManifestInput.call(void 0, config, {
|
|
7140
7730
|
build: config.deploymentId,
|
|
7141
|
-
packages:
|
|
7142
|
-
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ?
|
|
7731
|
+
packages: _chunkN5DQMOAGcjs.resolveFarmAppPackages.call(void 0, config.root),
|
|
7732
|
+
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? _chunkN5DQMOAGcjs.collectFarmWebMCPTools.call(void 0, config.root, config.srcDir) : []
|
|
7143
7733
|
})
|
|
7144
7734
|
)};
|
|
7145
7735
|
${servesDefaultMCP ? "farmAppManifestInput.defaultMCP = getFarmDefaultMCPServer;\n" : ""}// A guard written for an MCP server's path keeps its tools out of the public view.
|
|
@@ -7255,6 +7845,17 @@ function renderFarmClientBootstrapScript(canonicalPath, selectedRouteSlots, page
|
|
|
7255
7845
|
'</script>' + stampFarmCspNonce('<script>' + source + '</script>');
|
|
7256
7846
|
}
|
|
7257
7847
|
|
|
7848
|
+
// The settled defer() values the bootstrap script's props refer to, as development writes them.
|
|
7849
|
+
// It runs once the document has rendered: React has awaited every value a component read.
|
|
7850
|
+
function renderFarmDeferredDataScript(records) {
|
|
7851
|
+
if (!records || records.length === 0) return "";
|
|
7852
|
+
return stampFarmCspNonce(
|
|
7853
|
+
'<script>window.__FARM_DEFERRED_DATA__=' +
|
|
7854
|
+
serializeFarmInlineValue(snapshotDeferredData(records)) +
|
|
7855
|
+
';</script>'
|
|
7856
|
+
);
|
|
7857
|
+
}
|
|
7858
|
+
|
|
7258
7859
|
function renderFarmRendererHydrationScript() {
|
|
7259
7860
|
return typeof ReactDOMServer.generateHydrationScript === "function"
|
|
7260
7861
|
? stampFarmCspNonce(ReactDOMServer.generateHydrationScript())
|
|
@@ -7316,6 +7917,27 @@ function createFarmFlushToken() {
|
|
|
7316
7917
|
return token;
|
|
7317
7918
|
}
|
|
7318
7919
|
|
|
7920
|
+
async function farmKeptLayoutsRender(ReactDOMServer, layouts, keptCount, params) {
|
|
7921
|
+
let element = null;
|
|
7922
|
+
for (let index = keptCount - 1; index >= 0; index--) {
|
|
7923
|
+
const Layout = layouts[index].module.default;
|
|
7924
|
+
if (Layout) element = React.createElement(Layout, { children: element, params });
|
|
7925
|
+
}
|
|
7926
|
+
try {
|
|
7927
|
+
const rendered = await renderFarmElement(
|
|
7928
|
+
ReactDOMServer,
|
|
7929
|
+
wrapWithFarmIntegrationProviders(element),
|
|
7930
|
+
);
|
|
7931
|
+
if (rendered.stream) {
|
|
7932
|
+
const reader = rendered.stream.getReader();
|
|
7933
|
+
while (!(await reader.read()).done);
|
|
7934
|
+
}
|
|
7935
|
+
return rendered.streamErrors.length === 0;
|
|
7936
|
+
} catch {
|
|
7937
|
+
return false;
|
|
7938
|
+
}
|
|
7939
|
+
}
|
|
7940
|
+
|
|
7319
7941
|
async function renderFarmElement(ReactDOMServer, element, routeKey, flushToken = "") {
|
|
7320
7942
|
// Written after each React flush in a streamed navigation (flushToken): the browser swaps in
|
|
7321
7943
|
// the shell, then adds each Suspense boundary as soon as the flush that completed it ends.
|
|
@@ -7765,7 +8387,7 @@ function peelFarmDocumentPrefix(markup) {
|
|
|
7765
8387
|
let inner = markup.replace(/^\\s+/, "");
|
|
7766
8388
|
let hoisted = "";
|
|
7767
8389
|
const wrapper = /^<div\\b[^>]*style=["']display\\s*:\\s*contents;?\\s*["'][^>]*>/i;
|
|
7768
|
-
const hoistable = /${
|
|
8390
|
+
const hoistable = /${_chunkUPOYKX4Scjs.HOISTED_HEAD_ELEMENT.source}/i;
|
|
7769
8391
|
let match;
|
|
7770
8392
|
while ((match = wrapper.exec(inner) || hoistable.exec(inner))) {
|
|
7771
8393
|
if (!/^<div/i.test(match[0])) hoisted += match[0];
|
|
@@ -8219,7 +8841,7 @@ async function handleMetadataImageRequest(request, routePathname) {
|
|
|
8219
8841
|
|
|
8220
8842
|
${hasGeneratedMetadataImages ? `return createFarmMetadataImageResponse(value, imageModule, {
|
|
8221
8843
|
method,
|
|
8222
|
-
ifNoneMatch: request.headers.get("if-none-match"),${
|
|
8844
|
+
ifNoneMatch: request.headers.get("if-none-match"),${_chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) ? "" : "\n renderer: ReactDOMServer,"}
|
|
8223
8845
|
});` : 'throw new Error("Generated metadata image runtime is unavailable");'}
|
|
8224
8846
|
} catch (error) {
|
|
8225
8847
|
console.error("Metadata image render failed:", error);
|
|
@@ -8294,10 +8916,11 @@ function createFarmAgentRobotsResponse(request) {
|
|
|
8294
8916
|
// Static pages a path-specific guard covers (non-root middleware.ts, a config or
|
|
8295
8917
|
// integration middleware matcher naming the path), decided at build time.
|
|
8296
8918
|
// sitemap.xml, llms.txt and the default MCP server never list them, nor a page behind
|
|
8297
|
-
// a route guard
|
|
8919
|
+
// a route guard, nor one that renders noindex through its own robots or, without one,
|
|
8920
|
+
// its nearest layout's.
|
|
8298
8921
|
const farmAgentGuardedPages = new Set(${JSON.stringify(
|
|
8299
8922
|
pageRoutes.map((route) => route.pattern).filter(
|
|
8300
|
-
(pattern) => !pattern.includes("[") &&
|
|
8923
|
+
(pattern) => !pattern.includes("[") && _chunkUPOYKX4Scjs.farmPathGuardCoversPage.call(void 0,
|
|
8301
8924
|
{
|
|
8302
8925
|
config: { middleware: config.middleware, integrations: config.integrations },
|
|
8303
8926
|
middlewareRoutes
|
|
@@ -8309,7 +8932,15 @@ const farmAgentGuardedPages = new Set(${JSON.stringify(
|
|
|
8309
8932
|
function getFarmAgentListedPageRoutes() {
|
|
8310
8933
|
return pageRoutes.filter(
|
|
8311
8934
|
(route) =>
|
|
8312
|
-
!
|
|
8935
|
+
!route.pattern.includes("[") &&
|
|
8936
|
+
!farmAgentGuardedPages.has(route.pattern) &&
|
|
8937
|
+
!(route.module && route.module.__farmRouteGuard) &&
|
|
8938
|
+
!isFarmPageNoIndex(
|
|
8939
|
+
route.module && route.module.metadata,
|
|
8940
|
+
getApplicableLayouts(route.pattern, route.directory || route.pattern).map(
|
|
8941
|
+
(layout) => layout.module && layout.module.metadata,
|
|
8942
|
+
),
|
|
8943
|
+
),
|
|
8313
8944
|
);
|
|
8314
8945
|
}
|
|
8315
8946
|
${servesAgentSitemap ? `// sitemap.xml from agent.sitemap, built the same way as in development. Each page's
|
|
@@ -8344,12 +8975,12 @@ ${servesDefaultMCP ? `// agent.mcp: the default read-only MCP server at /mcp, as
|
|
|
8344
8975
|
// aside for a page route that answers /mcp and for any MCP server published or
|
|
8345
8976
|
// registered at runtime, such as the docs engine's.
|
|
8346
8977
|
const farmDefaultMCPServer = ${JSON.stringify(
|
|
8347
|
-
|
|
8978
|
+
_chunkX3MHKLCOcjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root), _chunkHM7AGSKUcjs.FARM_VERSION)
|
|
8348
8979
|
)};
|
|
8349
8980
|
let farmDefaultMCPRouteFree;
|
|
8350
8981
|
function getFarmDefaultMCPServer() {
|
|
8351
8982
|
if (farmDefaultMCPRouteFree === undefined) {
|
|
8352
|
-
farmDefaultMCPRouteFree = !matchPageRoute(${JSON.stringify(
|
|
8983
|
+
farmDefaultMCPRouteFree = !matchPageRoute(${JSON.stringify(_chunkX3MHKLCOcjs.FARM_DEFAULT_MCP_PATH)});
|
|
8353
8984
|
}
|
|
8354
8985
|
return farmDefaultMCPRouteFree ? resolveFarmDefaultMCPServer(farmDefaultMCPServer) : undefined;
|
|
8355
8986
|
}
|
|
@@ -8376,9 +9007,21 @@ async function handleFarmDefaultMCP(request) {
|
|
|
8376
9007
|
// gets its own request context, as for a direct request.
|
|
8377
9008
|
const farmDefaultMCPReadMarkdown = createFarmLlmsMarkdownReader((page) => fetch(page));
|
|
8378
9009
|
` : ""}
|
|
9010
|
+
// The origin llms.txt and llms-full.txt link to: the root layout's metadataBase, else the
|
|
9011
|
+
// request's origin, as for the sitemap and in development.
|
|
9012
|
+
function getFarmAgentOrigin(request) {
|
|
9013
|
+
const rootLayout = layoutRoutes.find((layout) => layout.pattern === "/");
|
|
9014
|
+
return resolveFarmAgentOrigin(
|
|
9015
|
+
rootLayout && rootLayout.module && rootLayout.module.metadata
|
|
9016
|
+
? rootLayout.module.metadata.metadataBase
|
|
9017
|
+
: undefined,
|
|
9018
|
+
new URL(request.url).origin,
|
|
9019
|
+
);
|
|
9020
|
+
}
|
|
9021
|
+
|
|
8379
9022
|
// Static pages and root metadata for llms.txt, built the same way as in development.
|
|
8380
9023
|
function createFarmLlmsTxtContext(request, full) {
|
|
8381
|
-
const origin =
|
|
9024
|
+
const origin = getFarmAgentOrigin(request);
|
|
8382
9025
|
const pages = collectFarmLlmsTxtPages(
|
|
8383
9026
|
getFarmAgentListedPageRoutes().map((route) => ({ pattern: route.pattern, metadata: route.module && route.module.metadata })),
|
|
8384
9027
|
{
|
|
@@ -8409,7 +9052,11 @@ function createFarmLlmsTxtContext(request, full) {
|
|
|
8409
9052
|
? {
|
|
8410
9053
|
markdown: request.method.toUpperCase() === "HEAD"
|
|
8411
9054
|
? async () => null
|
|
8412
|
-
:
|
|
9055
|
+
: readFarmLlmsMarkdownFrom(
|
|
9056
|
+
new URL(request.url).origin,
|
|
9057
|
+
origin,
|
|
9058
|
+
createFarmLlmsMarkdownReader((page) => fetch(page)),
|
|
9059
|
+
),
|
|
8413
9060
|
}
|
|
8414
9061
|
: {}),
|
|
8415
9062
|
};
|
|
@@ -8444,7 +9091,7 @@ async function handleApplicationMetadataRouteRequest(request, routePathname) {
|
|
|
8444
9091
|
})
|
|
8445
9092
|
: routeModule.default;
|
|
8446
9093
|
const body = isLlmsFull && !(value instanceof Response)
|
|
8447
|
-
? await renderFarmLlmsFullTxt(value, { origin:
|
|
9094
|
+
? await renderFarmLlmsFullTxt(value, { origin: getFarmAgentOrigin(request), readMarkdown: llmsContext.markdown })
|
|
8448
9095
|
: value;
|
|
8449
9096
|
return createFarmMetadataRouteResponse(match.metadata.kind, body, routeModule, { method, request });
|
|
8450
9097
|
} catch (error) {
|
|
@@ -8463,10 +9110,12 @@ function matchRedirectRoute(pathname, locale, search) {
|
|
|
8463
9110
|
const params = matchRuntimePathPattern(redirect.source, pathname);
|
|
8464
9111
|
if (!params) continue;
|
|
8465
9112
|
const destination = interpolateRedirectDestination(redirect.destination, params);
|
|
9113
|
+
// Sources match the app-relative path, so an internal destination is app-relative
|
|
9114
|
+
// too: send the browser to it inside the basePath, as a localized one already is.
|
|
8466
9115
|
const localizedDestination =
|
|
8467
9116
|
locale && destination.startsWith("/") && !destination.startsWith("//")
|
|
8468
9117
|
? localizeFarmHref(destination, locale, farmI18nConfig)
|
|
8469
|
-
: destination;
|
|
9118
|
+
: applyFarmBasePath(destination);
|
|
8470
9119
|
return {
|
|
8471
9120
|
destination: appendFarmRedirectQuery(localizedDestination, search),
|
|
8472
9121
|
statusCode: redirect.statusCode ?? (redirect.permanent ? 308 : 307),
|
|
@@ -8644,12 +9293,14 @@ function hasLocalRequestRoute(request, routePathname) {
|
|
|
8644
9293
|
if (${imageRuntime === "none" ? "false" : `pathname === ${JSON.stringify(config.images.path)}`}) {
|
|
8645
9294
|
return true;
|
|
8646
9295
|
}
|
|
8647
|
-
${_optionalChain([config, 'access',
|
|
9296
|
+
${_optionalChain([config, 'access', _219 => _219.docs, 'optionalAccess', _220 => _220.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
|
|
9297
|
+
// The docs answer below the basePath; their API stays at /api/docs, as API routes do.
|
|
9298
|
+
const docsRoutePathname = stripFarmBasePath(pathname);
|
|
8648
9299
|
if (
|
|
8649
9300
|
isFarmDocsAPIRequest(pathname) ||
|
|
8650
9301
|
docsPath === "/" ||
|
|
8651
|
-
|
|
8652
|
-
|
|
9302
|
+
docsRoutePathname === docsPath ||
|
|
9303
|
+
docsRoutePathname.startsWith(docsPath + "/")
|
|
8653
9304
|
) {
|
|
8654
9305
|
return true;
|
|
8655
9306
|
}` : ""}
|
|
@@ -8670,7 +9321,7 @@ function getFarmPluginRequestOptions(request) {
|
|
|
8670
9321
|
route: { ...route, pattern: normalizeRuntimePath(farmOpenAPIReference.route) },
|
|
8671
9322
|
};
|
|
8672
9323
|
}
|
|
8673
|
-
const isDocsAPIRequest = ${_optionalChain([config, 'access',
|
|
9324
|
+
const isDocsAPIRequest = ${_optionalChain([config, 'access', _221 => _221.docs, 'optionalAccess', _222 => _222.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
|
|
8674
9325
|
const integrationMatch = ${hasServerRuntimeIntegrations ? `matchIntegrationRoute(serverRuntimeIntegrations, {
|
|
8675
9326
|
pathname,
|
|
8676
9327
|
method: request.method,
|
|
@@ -8754,7 +9405,7 @@ ${hasInfraAnalyticsRuntime ? `
|
|
|
8754
9405
|
// endpoints, Markdown mirrors, and docs pages have no app route pattern, so they are
|
|
8755
9406
|
// labeled here; route.pattern keeps meaning the matched app route for plugins.
|
|
8756
9407
|
const farmBuiltInRoutePaths = new Set(${JSON.stringify(
|
|
8757
|
-
|
|
9408
|
+
_chunkLPIZMU7Dcjs.listFarmBuiltInRoutePaths.call(void 0, {
|
|
8758
9409
|
agent: {
|
|
8759
9410
|
...config.agent,
|
|
8760
9411
|
aiCatalog: servesAiCatalog,
|
|
@@ -8765,9 +9416,9 @@ const farmBuiltInRoutePaths = new Set(${JSON.stringify(
|
|
|
8765
9416
|
openapi: openAPIReference
|
|
8766
9417
|
})
|
|
8767
9418
|
)});
|
|
8768
|
-
${_optionalChain([config, 'access',
|
|
9419
|
+
${_optionalChain([config, 'access', _223 => _223.docs, 'optionalAccess', _224 => _224.enabled]) ? `const farmDocsRouteLabelInput = {
|
|
8769
9420
|
path: normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs"),
|
|
8770
|
-
apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess',
|
|
9421
|
+
apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _225 => _225.apiPath]) || "/api/docs")},${_optionalChain([config, 'access', _226 => _226.docs, 'access', _227 => _227.roots, 'optionalAccess', _228 => _228.length]) ? "\n roots: farmDocsResolvedConfig.roots.map((farmDocsRoot) => farmDocsRoot.entry)," : ""}
|
|
8771
9422
|
};
|
|
8772
9423
|
` : ""}// The request's route payload, for a handler that learns what answered while it handles.
|
|
8773
9424
|
const farmRouteLabelSlot = Symbol("farm.route.label.slot");
|
|
@@ -8782,11 +9433,11 @@ function labelFarmRequestOptions(options) {
|
|
|
8782
9433
|
setFarmRouteLabel(options.route, mcpLabel);
|
|
8783
9434
|
return options;
|
|
8784
9435
|
}
|
|
8785
|
-
${_optionalChain([config, 'access',
|
|
9436
|
+
${_optionalChain([config, 'access', _229 => _229.docs, 'optionalAccess', _230 => _230.enabled]) ? `if (options.kind === "docs") {
|
|
8786
9437
|
setFarmRouteLabel(options.route, resolveFarmDocsRouteLabel(routePathname, farmDocsRouteLabelInput));
|
|
8787
9438
|
return options;
|
|
8788
9439
|
}` : ""}
|
|
8789
|
-
${_optionalChain([config, 'access',
|
|
9440
|
+
${_optionalChain([config, 'access', _231 => _231.md, 'optionalAccess', _232 => _232.enabled]) || hasMarkdownPages ? `const markdownLabel = resolveFarmMarkdownRouteLabel(
|
|
8790
9441
|
routePathname,
|
|
8791
9442
|
(page) => matchPageRoute(page)?.route.pattern,
|
|
8792
9443
|
);
|
|
@@ -8821,7 +9472,7 @@ function getApplicableLayouts(pathname, directory) {
|
|
|
8821
9472
|
return applicable;
|
|
8822
9473
|
}
|
|
8823
9474
|
|
|
8824
|
-
${_optionalChain([config, 'access',
|
|
9475
|
+
${_optionalChain([config, 'access', _233 => _233.docs, 'optionalAccess', _234 => _234.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
|
|
8825
9476
|
if (request.method === "HEAD") return response;
|
|
8826
9477
|
if (response.headers.get("x-farm-docs-adapter")) return response;
|
|
8827
9478
|
|
|
@@ -8929,7 +9580,7 @@ ${_optionalChain([config, 'access', _210 => _210.docs, 'optionalAccess', _211 =>
|
|
|
8929
9580
|
|
|
8930
9581
|
// Shells keep their own LRU so query-string variants never evict app cache entries.
|
|
8931
9582
|
const pprShellCache = getFarmDataCache().pprShellCache;
|
|
8932
|
-
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access',
|
|
9583
|
+
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _235 => _235.experimental, 'optionalAccess', _236 => _236.ppr]) === true)};
|
|
8933
9584
|
|
|
8934
9585
|
function resolveRouteRenderingView(route) {
|
|
8935
9586
|
// The same merge development uses: baked directive config under the
|
|
@@ -8993,8 +9644,10 @@ function getPPRHeaders(status, config) {
|
|
|
8993
9644
|
return headers;
|
|
8994
9645
|
}
|
|
8995
9646
|
|
|
9647
|
+
// defer() values reach the browser as references its snapshot settles; other promises do not.
|
|
8996
9648
|
function hasFarmUnserializableRouteData(data) {
|
|
8997
|
-
const isPromise = (value) =>
|
|
9649
|
+
const isPromise = (value) =>
|
|
9650
|
+
Boolean(value) && typeof value.then === "function" && !isDeferred(value);
|
|
8998
9651
|
if (isPromise(data)) return true;
|
|
8999
9652
|
return Boolean(data) && typeof data === "object" && Object.values(data).some(isPromise);
|
|
9000
9653
|
}
|
|
@@ -9061,12 +9714,13 @@ async function handleFarmRequest(request, adapterContext) {
|
|
|
9061
9714
|
},
|
|
9062
9715
|
{ redirect: !isFarmLocalAPIPathname(requestUrl.pathname) }
|
|
9063
9716
|
)` : "handleFarmRequestInContext(request, null, false, Date.now(), adapterContext, requestUrl)"};
|
|
9064
|
-
${_optionalChain([config, 'access',
|
|
9717
|
+
${_optionalChain([config, 'access', _237 => _237.md, 'optionalAccess', _238 => _238.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
|
|
9065
9718
|
if (matchPageRoute(pathname)) {
|
|
9066
9719
|
// The Link header advertises the public .md URL, like the head alternate.
|
|
9067
9720
|
return applyMarkdownNegotiationHeaders(response, {
|
|
9068
9721
|
config: farmMarkdownConfig,
|
|
9069
9722
|
pathname: requestUrl.pathname,
|
|
9723
|
+
routePathname: getFarmRoutePathname,
|
|
9070
9724
|
});
|
|
9071
9725
|
}` : ""}
|
|
9072
9726
|
return response;
|
|
@@ -9188,6 +9842,7 @@ async function resolveFarmRequestInContext(
|
|
|
9188
9842
|
cloneFarmRequestWithContext(request),
|
|
9189
9843
|
farmIntegrationRanMiddleware,
|
|
9190
9844
|
adapterContext?.clientAddress,
|
|
9845
|
+
adapterContext?.[farmRuntimeErrorSlot],
|
|
9191
9846
|
);
|
|
9192
9847
|
if (integrationDispatch.response) {
|
|
9193
9848
|
return integrationDispatch.response;
|
|
@@ -9201,9 +9856,27 @@ async function resolveFarmRequestInContext(
|
|
|
9201
9856
|
|
|
9202
9857
|
${hasMiddlewareRuntime ? `
|
|
9203
9858
|
const requestBeforeMiddleware = request;
|
|
9204
|
-
|
|
9205
|
-
|
|
9206
|
-
|
|
9859
|
+
let middlewareResult;
|
|
9860
|
+
try {
|
|
9861
|
+
middlewareResult = await farmMiddlewareRunner(request, {
|
|
9862
|
+
clientAddress: adapterContext?.clientAddress,
|
|
9863
|
+
});
|
|
9864
|
+
} catch (error) {
|
|
9865
|
+
// The runner emitted middleware.error. The request is answered below like any
|
|
9866
|
+
// failed request; a plugin's runtime.error observes the throw, as for an API route.
|
|
9867
|
+
console.error("Middleware error:", error);
|
|
9868
|
+
await adapterContext?.[farmRuntimeErrorSlot]?.(error);
|
|
9869
|
+
middlewareResult = {
|
|
9870
|
+
request,
|
|
9871
|
+
response: null,
|
|
9872
|
+
data: new Map(),
|
|
9873
|
+
context: new Map(),
|
|
9874
|
+
headers: new Headers(),
|
|
9875
|
+
guarded: true,
|
|
9876
|
+
failed: true,
|
|
9877
|
+
error,
|
|
9878
|
+
};
|
|
9879
|
+
}
|
|
9207
9880
|
if (middlewareResult.response) {
|
|
9208
9881
|
return middlewareResult.response;
|
|
9209
9882
|
}
|
|
@@ -9217,6 +9890,7 @@ async function resolveFarmRequestInContext(
|
|
|
9217
9890
|
cloneFarmRequestWithContext(request),
|
|
9218
9891
|
farmIntegrationRanMiddleware,
|
|
9219
9892
|
adapterContext?.clientAddress,
|
|
9893
|
+
adapterContext?.[farmRuntimeErrorSlot],
|
|
9220
9894
|
);
|
|
9221
9895
|
farmIntegrationSetCookies = [...farmIntegrationSetCookies, ...rewrittenDispatch.setCookies];
|
|
9222
9896
|
if (rewrittenDispatch.response) {
|
|
@@ -9245,6 +9919,26 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9245
9919
|
// request instead of the original outer-handler value.
|
|
9246
9920
|
const runResolvedRequest = async () => {
|
|
9247
9921
|
if (middlewareResult.notFound) return renderFarmNotFoundResponse();
|
|
9922
|
+
if (middlewareResult.failed) {${farmRendererDisabled ? `
|
|
9923
|
+
return renderFarmErrorJSONResponse();` : `
|
|
9924
|
+
if (isFarmLocalAPIPathname(pathname)) return renderFarmErrorJSONResponse();
|
|
9925
|
+
// No page was selected, so only the root error boundary and layouts apply.
|
|
9926
|
+
const errorResponse = await renderFarmErrorResponse(middlewareResult.error, "/", {}, null);${_optionalChain([config, 'access', _239 => _239.md, 'optionalAccess', _240 => _240.enabled]) ? `
|
|
9927
|
+
// An agent asking for Markdown reads the error document as Markdown, as it
|
|
9928
|
+
// does when a page throws. The helper answers null when Markdown is off.
|
|
9929
|
+
const markdownErrorResponse = await createMarkdownMirrorResponse({
|
|
9930
|
+
request,
|
|
9931
|
+
requestUrl: url,
|
|
9932
|
+
config: farmMarkdownConfig,
|
|
9933
|
+
routePathname: getFarmRoutePathname,
|
|
9934
|
+
routeExists: (targetPathname) =>
|
|
9935
|
+
Boolean(matchPageRoute(getFarmRoutePathname(targetPathname))),
|
|
9936
|
+
renderPage: async () => errorResponse,
|
|
9937
|
+
apiServerBasePath: farmLocalAPIBasePath,
|
|
9938
|
+
});
|
|
9939
|
+
if (markdownErrorResponse) return markdownErrorResponse;` : ""}
|
|
9940
|
+
return errorResponse;`}
|
|
9941
|
+
}
|
|
9248
9942
|
` : `
|
|
9249
9943
|
${hasServerRuntimeIntegrations ? `
|
|
9250
9944
|
// An integration guard (protectedRoutes) that let the request through.
|
|
@@ -9271,7 +9965,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9271
9965
|
}
|
|
9272
9966
|
` : ""}
|
|
9273
9967
|
|
|
9274
|
-
${_optionalChain([config, 'access',
|
|
9968
|
+
${_optionalChain([config, 'access', _241 => _241.docs, 'optionalAccess', _242 => _242.enabled]) ? `
|
|
9275
9969
|
// Docs responses are served after app middleware so route guards and
|
|
9276
9970
|
// middleware headers apply to the docs engine like any other page content.
|
|
9277
9971
|
// An app's own llms.txt, llms-full.txt, sitemap.xml, and robots.txt take
|
|
@@ -9320,6 +10014,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9320
10014
|
const markdownSourceResponse = await createFarmMarkdownSourceResponse?.({
|
|
9321
10015
|
request: cloneFarmRequestWithContext(request),
|
|
9322
10016
|
config: farmMdxConfig,
|
|
10017
|
+
routePathname: getFarmRoutePathname,
|
|
9323
10018
|
resolveSource: (targetPathname) => {
|
|
9324
10019
|
const match = matchPageRoute(getFarmRoutePathname(targetPathname));
|
|
9325
10020
|
return match?.route?.markdownSource || null;
|
|
@@ -9362,7 +10057,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9362
10057
|
}
|
|
9363
10058
|
` : ""}
|
|
9364
10059
|
|
|
9365
|
-
${_optionalChain([config, 'access',
|
|
10060
|
+
${_optionalChain([config, 'access', _243 => _243.md, 'optionalAccess', _244 => _244.enabled]) ? `
|
|
9366
10061
|
if (farmMarkdownConfig?.enabled) {
|
|
9367
10062
|
const markdownResponse = await createMarkdownMirrorResponse({
|
|
9368
10063
|
// The mirror helper only reads metadata and creates its own GET request.
|
|
@@ -9371,6 +10066,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9371
10066
|
// Middleware and configured rewrites have already resolved this URL.
|
|
9372
10067
|
requestUrl: url,
|
|
9373
10068
|
config: farmMarkdownConfig,
|
|
10069
|
+
routePathname: getFarmRoutePathname,
|
|
9374
10070
|
routeExists: (targetPathname) =>
|
|
9375
10071
|
Boolean(matchPageRoute(getFarmRoutePathname(targetPathname))),
|
|
9376
10072
|
renderPage: (targetRequest) => fetchFarmInnerRequest(targetRequest, adapterContext),
|
|
@@ -9386,7 +10082,10 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9386
10082
|
// Clone only for an API request: cloning a Request costs more than the match,
|
|
9387
10083
|
// and handleAPIRequest returns null without one.
|
|
9388
10084
|
if (matchLocalAPIRequest(request)) {
|
|
9389
|
-
const apiResponse = await handleAPIRequest(
|
|
10085
|
+
const apiResponse = await handleAPIRequest(
|
|
10086
|
+
cloneFarmRequestWithContext(request),
|
|
10087
|
+
adapterContext?.[farmRuntimeErrorSlot],
|
|
10088
|
+
);
|
|
9390
10089
|
if (apiResponse) {
|
|
9391
10090
|
return applyProductionMiddlewareHeaders(apiResponse, middlewareHeaders);
|
|
9392
10091
|
}
|
|
@@ -9461,11 +10160,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9461
10160
|
return applyProductionMiddlewareHeaders(applicationMetadataResponse, middlewareHeaders);
|
|
9462
10161
|
}
|
|
9463
10162
|
` : ""}
|
|
9464
|
-
${_optionalChain([config, 'access',
|
|
10163
|
+
${_optionalChain([config, 'access', _245 => _245.agent, 'optionalAccess', _246 => _246.manifest]) !== false ? `
|
|
9465
10164
|
// agent.manifest: /.well-known/farmjs.json (and 0.1.34's /.well-known/farmjs), the app's
|
|
9466
10165
|
// public manifest, the same document for every request.
|
|
9467
10166
|
if (
|
|
9468
|
-
[${JSON.stringify(
|
|
10167
|
+
[${JSON.stringify(_chunkLPIZMU7Dcjs.FARM_APP_MANIFEST_PATH)}, ${JSON.stringify(_chunkLPIZMU7Dcjs.FARM_APP_MANIFEST_LEGACY_PATH)}].includes(
|
|
9469
10168
|
normalizeRuntimePath(routePathname),
|
|
9470
10169
|
)
|
|
9471
10170
|
) {
|
|
@@ -9475,9 +10174,9 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9475
10174
|
);
|
|
9476
10175
|
}
|
|
9477
10176
|
` : ""}
|
|
9478
|
-
${_optionalChain([config, 'access',
|
|
10177
|
+
${_optionalChain([config, 'access', _247 => _247.agent, 'optionalAccess', _248 => _248.apiCatalog]) ? `
|
|
9479
10178
|
// agent.apiCatalog: list the OpenAPI and MCP surfaces at the RFC 9727 path.
|
|
9480
|
-
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(
|
|
10179
|
+
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkLPIZMU7Dcjs.FARM_API_CATALOG_PATH)}) {
|
|
9481
10180
|
return applyProductionMiddlewareHeaders(
|
|
9482
10181
|
createFarmApiCatalogResponse(request.method, farmApiCatalogInput, request),
|
|
9483
10182
|
middlewareHeaders,
|
|
@@ -9502,20 +10201,21 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9502
10201
|
);
|
|
9503
10202
|
}
|
|
9504
10203
|
` : ""}
|
|
9505
|
-
${_optionalChain([config, 'access',
|
|
10204
|
+
${_optionalChain([config, 'access', _249 => _249.agent, 'optionalAccess', _250 => _250.llmsTxt, 'optionalAccess', _251 => _251.enabled]) ? `
|
|
9506
10205
|
// agent.llmsTxt with no llms.ts or llms-full.ts: serve the generated files.
|
|
9507
10206
|
const farmGeneratedLlmsKind = normalizeRuntimePath(routePathname) === "/llms.txt"
|
|
9508
10207
|
? "llms"
|
|
9509
|
-
: ${_optionalChain([config, 'access',
|
|
10208
|
+
: ${_optionalChain([config, 'access', _252 => _252.agent, 'optionalAccess', _253 => _253.llmsTxt, 'optionalAccess', _254 => _254.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
|
|
9510
10209
|
if (farmGeneratedLlmsKind) {
|
|
9511
10210
|
const llmsContext = createFarmLlmsTxtContext(request, farmGeneratedLlmsKind === "llms-full");
|
|
10211
|
+
// Renders are shared per origin the request reached, which is where pages are read.
|
|
9512
10212
|
const llmsOrigin = new URL(request.url).origin;
|
|
9513
10213
|
// A page that times out is left out, the shared render is not reused, and
|
|
9514
10214
|
// the partial response is not cacheable.
|
|
9515
10215
|
let llmsComplete = true;
|
|
9516
10216
|
const renderLlmsFull = (shared) =>
|
|
9517
10217
|
renderFarmLlmsFullTxt(llmsContext.defaults, {
|
|
9518
|
-
origin:
|
|
10218
|
+
origin: getFarmAgentOrigin(request),
|
|
9519
10219
|
readMarkdown: llmsContext.markdown,
|
|
9520
10220
|
onIncomplete: () => {
|
|
9521
10221
|
llmsComplete = false;
|
|
@@ -9541,7 +10241,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9541
10241
|
}
|
|
9542
10242
|
` : ""}
|
|
9543
10243
|
|
|
9544
|
-
${_optionalChain([config, 'access',
|
|
10244
|
+
${_optionalChain([config, 'access', _255 => _255.docs, 'optionalAccess', _256 => _256.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
|
|
9545
10245
|
const docsAPIResponse = await farmDocsAPIHandler(cloneFarmRequestWithContext(request));
|
|
9546
10246
|
if (docsAPIResponse) {
|
|
9547
10247
|
return applyProductionMiddlewareHeaders(
|
|
@@ -9564,7 +10264,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9564
10264
|
const matchedRoute = matchPageRoute(routePathname);
|
|
9565
10265
|
${farmIslandsMode ? `// Islands mode: a form or client component posting a server action to this page.
|
|
9566
10266
|
if (matchedRoute && request.method === "POST") {
|
|
9567
|
-
const actionResponse = await
|
|
10267
|
+
const actionResponse = await _runWithMiddlewareData(middlewareData || {}, () =>
|
|
10268
|
+
_runWithMiddlewareContext(middlewareContext || {}, () =>
|
|
10269
|
+
handleFarmFormActionRequest(request, farmFormActionsConfig)
|
|
10270
|
+
)
|
|
10271
|
+
);
|
|
9568
10272
|
if (actionResponse) return applyProductionMiddlewareHeaders(actionResponse, middlewareHeaders);
|
|
9569
10273
|
}` : ""}
|
|
9570
10274
|
if (matchedRoute) {${farmMobileShells ? `
|
|
@@ -9615,7 +10319,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9615
10319
|
? 0
|
|
9616
10320
|
: countFarmKeptLayouts(request, farmSegmentLayouts, params);
|
|
9617
10321
|
// The root layout always renders, so keeping one layout keeps nothing.
|
|
9618
|
-
|
|
10322
|
+
let farmKeptLayouts = farmKeptLayoutCount > 1 ? farmKeptLayoutCount : 0;` : `let farmKeptLayouts = 0;`}
|
|
9619
10323
|
${farmMobileShells ? "const pprConfig = farmShellLoading ? { enabled: false } : resolvePPRConfig(route);" : "const pprConfig = resolvePPRConfig(route);"}
|
|
9620
10324
|
const pprBypassReason = pprConfig.enabled
|
|
9621
10325
|
? getPPRShellBypassReason(request, middlewareData, middlewareContext)
|
|
@@ -9859,8 +10563,8 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9859
10563
|
...(pageProps.__farmCanonicalPath
|
|
9860
10564
|
? { __farmCanonicalPath: pageProps.__farmCanonicalPath }
|
|
9861
10565
|
: {}),
|
|
9862
|
-
//
|
|
9863
|
-
// a page from these props
|
|
10566
|
+
// A promise that is not a defer() value does not survive JSON, so
|
|
10567
|
+
// the browser cannot render a page from these props.
|
|
9864
10568
|
...(pageProps.__farmRoutePropsResolved && !hasFarmUnserializableRouteData(pageProps.data)
|
|
9865
10569
|
? { __farmRoutePropsResolved: true }
|
|
9866
10570
|
: {}),
|
|
@@ -9885,6 +10589,17 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9885
10589
|
},
|
|
9886
10590
|
};
|
|
9887
10591
|
});
|
|
10592
|
+
// defer() values go to the browser as references (one id space for the page and its
|
|
10593
|
+
// slots), settled by renderFarmDeferredDataScript once the document has rendered.
|
|
10594
|
+
const farmDeferredData = prepareDeferredData({
|
|
10595
|
+
page: clientPageProps,
|
|
10596
|
+
slots: routeSlotPayload,
|
|
10597
|
+
});
|
|
10598
|
+
// A page without defer() values sends its props as they are: references, and escaped
|
|
10599
|
+
// look-alikes, only ever come with a snapshot, so the browser has nothing to revive.
|
|
10600
|
+
if (farmDeferredData.records.length === 0) {
|
|
10601
|
+
farmDeferredData.data = { page: clientPageProps, slots: routeSlotPayload };
|
|
10602
|
+
}
|
|
9888
10603
|
|
|
9889
10604
|
${farmIslandsMode ? `// Islands mode: a route a shared cache may store (a PPR shell, a static page) renders
|
|
9890
10605
|
// whole for every request, so a cache hit stays a hit. Other routes leave out what the
|
|
@@ -9903,12 +10618,26 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9903
10618
|
// A navigation the browser streams marks where each React flush ends, so the browser
|
|
9904
10619
|
// shows the page before its Suspense content arrives (FARM_FLUSH_MARKER). The marker
|
|
9905
10620
|
// carries a random token sent in the F-Flush header: page content cannot forge one.
|
|
9906
|
-
|
|
9907
|
-
|
|
9908
|
-
|
|
10621
|
+
// A page with defer() data arrives whole: the browser revives its props from the
|
|
10622
|
+
// snapshot after the body, which a shell swapped in first would not have yet.
|
|
10623
|
+
const farmFlushToken =
|
|
10624
|
+
request.headers.get("f-stream") === "flush" && farmDeferredData.records.length === 0
|
|
10625
|
+
? createFarmFlushToken()
|
|
10626
|
+
: "";` : `const farmLayoutKeyOf = null;
|
|
9909
10627
|
const farmPayloadOnlyNavigation = false;
|
|
9910
10628
|
const farmFlushToken = "";`}
|
|
9911
10629
|
const renderPageElement = async () => {
|
|
10630
|
+
// The browser chooses which layouts it says it keeps, so a kept layout still runs: a
|
|
10631
|
+
// guard in it decides this request. Only its markup is left out. A layout that fails
|
|
10632
|
+
// here renders whole, so notFound() and redirect() answer as on any other request.
|
|
10633
|
+
if (
|
|
10634
|
+
farmKeptLayouts > 0 &&
|
|
10635
|
+
!(await farmKeptLayoutsRender(ReactDOMServer, applicableLayouts, farmKeptLayouts, params))
|
|
10636
|
+
) {
|
|
10637
|
+
farmKeptLayouts = 0;
|
|
10638
|
+
pprCanCache = false;
|
|
10639
|
+
}
|
|
10640
|
+
|
|
9912
10641
|
// First, render the page content
|
|
9913
10642
|
let pageElement;
|
|
9914
10643
|
|
|
@@ -9989,9 +10718,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9989
10718
|
"data-farm-route-slot": slot.name,
|
|
9990
10719
|
"data-farm-slot-owner": slot.ownerPattern,
|
|
9991
10720
|
},
|
|
9992
|
-
|
|
9993
|
-
|
|
9994
|
-
|
|
10721
|
+
slot.hydrates
|
|
10722
|
+
? wrapFarmRouteClientGraph(
|
|
10723
|
+
React.createElement(slot.module.default, slot.props),
|
|
10724
|
+
)
|
|
10725
|
+
: React.createElement(slot.module.default, slot.props),
|
|
9995
10726
|
);
|
|
9996
10727
|
}
|
|
9997
10728
|
// Islands mode: a layout around a client provider, and the server layouts on its
|
|
@@ -10100,12 +10831,12 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10100
10831
|
);
|
|
10101
10832
|
}
|
|
10102
10833
|
}
|
|
10103
|
-
${_optionalChain([config, 'access',
|
|
10834
|
+
${_optionalChain([config, 'access', _257 => _257.md, 'optionalAccess', _258 => _258.enabled]) ? `
|
|
10104
10835
|
// Advertise the Markdown mirror in the head as well as the Link header,
|
|
10105
10836
|
// using the public path the .md request will be resolved against.
|
|
10106
10837
|
mergedMetadata = addMetadataMarkdownAlternate(
|
|
10107
10838
|
mergedMetadata,
|
|
10108
|
-
getFarmMarkdownAlternatePath(farmMarkdownConfig, pathname),
|
|
10839
|
+
getFarmMarkdownAlternatePath(farmMarkdownConfig, pathname, { routePathname: getFarmRoutePathname }),
|
|
10109
10840
|
);` : ""}
|
|
10110
10841
|
|
|
10111
10842
|
// headers(), cookies(), or getCurrentRequest() read during the render,
|
|
@@ -10119,7 +10850,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10119
10850
|
emitFarmEvent({ type: "cache.bypass", route: pathname, reason: "request-read" });
|
|
10120
10851
|
}
|
|
10121
10852
|
|
|
10122
|
-
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
10853
|
+
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _259 => _259.agent, 'optionalAccess', _260 => _260.jsonLd]), () => ( false)))} });
|
|
10123
10854
|
const title = renderedMetadata.title;
|
|
10124
10855
|
const metaTags = renderedMetadata.tags;
|
|
10125
10856
|
const hasFavicon = renderedMetadata.hasFavicon;
|
|
@@ -10234,11 +10965,16 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10234
10965
|
const farmClientScripts = function(early) {
|
|
10235
10966
|
return ' ' + renderFarmClientBootstrapScript(
|
|
10236
10967
|
pageProps.__farmCanonicalPath,
|
|
10237
|
-
|
|
10238
|
-
|
|
10968
|
+
farmDeferredData.data.slots,
|
|
10969
|
+
farmDeferredData.data.page
|
|
10239
10970
|
) + '\\n' +
|
|
10240
10971
|
' ' + renderFarmClientEntryScript(early) + '\\n';
|
|
10241
10972
|
};
|
|
10973
|
+
// Written as the stream ends, when the values the page read have settled.
|
|
10974
|
+
const farmDeferredDataScript = function() {
|
|
10975
|
+
const script = renderFarmDeferredDataScript(farmDeferredData.records);
|
|
10976
|
+
return script ? ' ' + script + '\\n' : '';
|
|
10977
|
+
};
|
|
10242
10978
|
const farmEarlyClientScripts = ${farmIslandsMode ? "farmClientScripts(true)" : '""'};
|
|
10243
10979
|
const streamPrefix = '<!DOCTYPE html>\\n<html lang="en">\\n<head>\\n' +
|
|
10244
10980
|
farmThemeDocument.head + '\\n' +
|
|
@@ -10250,9 +10986,10 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10250
10986
|
' <link rel="modulepreload" href="/__farm_client_js_src__">' + renderFarmClientModulePreloads(null, route.clientModule) + '\\n' +
|
|
10251
10987
|
renderFarmRendererHydrationScript() + '\\n' +
|
|
10252
10988
|
'</head>\\n<body>\\n' + farmEarlyClientScripts + ' <div id="root">';
|
|
10253
|
-
const
|
|
10254
|
-
|
|
10255
|
-
'</body>\\n</html>';
|
|
10989
|
+
const streamClientScripts = farmEarlyClientScripts ? '' : farmClientScripts();
|
|
10990
|
+
const streamSuffix = function() {
|
|
10991
|
+
return '</div>\\n' + farmDeferredDataScript() + streamClientScripts + '</body>\\n</html>';
|
|
10992
|
+
};
|
|
10256
10993
|
const themedStreamPrefix = streamPrefix.replace(
|
|
10257
10994
|
'<html lang="en">',
|
|
10258
10995
|
() => '<html lang="en"' + farmThemeDocument.attributes + '>'
|
|
@@ -10328,6 +11065,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10328
11065
|
async function(rootOpened) {
|
|
10329
11066
|
return (await lateNavigationRecovery()) +
|
|
10330
11067
|
(rootOpened ? '</div>\\n' : '') +
|
|
11068
|
+
farmDeferredDataScript() +
|
|
10331
11069
|
(farmEarlyClientScripts ? '' : farmClientScripts());
|
|
10332
11070
|
},
|
|
10333
11071
|
onStreamComplete
|
|
@@ -10336,7 +11074,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10336
11074
|
renderedPage.stream,
|
|
10337
11075
|
themedStreamPrefix,
|
|
10338
11076
|
async function() {
|
|
10339
|
-
return (await lateNavigationRecovery()) + streamSuffix;
|
|
11077
|
+
return (await lateNavigationRecovery()) + streamSuffix();
|
|
10340
11078
|
},
|
|
10341
11079
|
onStreamComplete
|
|
10342
11080
|
);
|
|
@@ -10382,9 +11120,9 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10382
11120
|
/<\\/body>/i,
|
|
10383
11121
|
() => ' ' + renderFarmClientBootstrapScript(
|
|
10384
11122
|
pageProps.__farmCanonicalPath,
|
|
10385
|
-
|
|
10386
|
-
|
|
10387
|
-
) + '\\n' +
|
|
11123
|
+
farmDeferredData.data.slots,
|
|
11124
|
+
farmDeferredData.data.page
|
|
11125
|
+
) + renderFarmDeferredDataScript(farmDeferredData.records) + '\\n' +
|
|
10388
11126
|
' ' + farmEntryScript + '\\n</body>',
|
|
10389
11127
|
);
|
|
10390
11128
|
} else {
|
|
@@ -10401,7 +11139,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10401
11139
|
</head>
|
|
10402
11140
|
<body>
|
|
10403
11141
|
<div id="root">\${html}</div>
|
|
10404
|
-
\${renderFarmClientBootstrapScript(pageProps.__farmCanonicalPath,
|
|
11142
|
+
\${renderFarmClientBootstrapScript(pageProps.__farmCanonicalPath, farmDeferredData.data.slots, farmDeferredData.data.page)}\${renderFarmDeferredDataScript(farmDeferredData.records)}
|
|
10405
11143
|
\${farmEntryScript}
|
|
10406
11144
|
</body>
|
|
10407
11145
|
</html>\`;
|
|
@@ -10507,113 +11245,14 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10507
11245
|
|
|
10508
11246
|
emitFarmEvent({ type: "render.error", route: pathname, error });
|
|
10509
11247
|
console.error("SSR Error:", error);
|
|
10510
|
-
|
|
10511
|
-
const errorStatusText = getDefaultErrorStatusText(errorStatus);
|
|
10512
|
-
|
|
10513
|
-
const errorBoundaryMatch = getMatchingErrorBoundary(routePathname);
|
|
10514
|
-
if (errorBoundaryMatch?.route.module?.default) {
|
|
10515
|
-
try {
|
|
10516
|
-
const searchParamsObj = searchParamsToObject(url.searchParams);
|
|
10517
|
-
const ErrorComponent = errorBoundaryMatch.route.module.default;
|
|
10518
|
-
let errorElement = React.createElement(ErrorComponent, {
|
|
10519
|
-
error,
|
|
10520
|
-
reset: function() {},
|
|
10521
|
-
params,
|
|
10522
|
-
search: searchParamsObj,
|
|
10523
|
-
searchParams: createFarmSearchParams(searchParamsObj),
|
|
10524
|
-
path: pathname,
|
|
10525
|
-
...(middlewareData?.size ? { middleware: { data: middlewareData } } : {}),
|
|
10526
|
-
});
|
|
10527
|
-
|
|
10528
|
-
const applicableLayouts = getApplicableLayouts(routePathname);
|
|
10529
|
-
for (let i = applicableLayouts.length - 1; i >= 0; i--) {
|
|
10530
|
-
const LayoutComponent = applicableLayouts[i].module.default;
|
|
10531
|
-
if (LayoutComponent) {
|
|
10532
|
-
errorElement = React.createElement(LayoutComponent, {
|
|
10533
|
-
children: errorElement,
|
|
10534
|
-
params,
|
|
10535
|
-
});
|
|
10536
|
-
}
|
|
10537
|
-
}
|
|
10538
|
-
|
|
10539
|
-
errorElement = wrapWithFarmIntegrationProviders(errorElement);
|
|
10540
|
-
|
|
10541
|
-
const renderErrorElement = () =>
|
|
10542
|
-
renderFarmElementToString(ReactDOMServer, errorElement);
|
|
10543
|
-
const errorHtml = ${hasMiddlewareRuntime ? `await _runWithMiddlewareData(middlewareData, () =>
|
|
10544
|
-
_runWithMiddlewareContext(middlewareContext, renderErrorElement)
|
|
10545
|
-
)` : "await renderErrorElement()"};
|
|
10546
|
-
const errorDocument = applyFarmThemeDocument(
|
|
10547
|
-
applyFarmI18nDocument(
|
|
10548
|
-
createFarmErrorDocument(errorHtml, "Application Error"),
|
|
10549
|
-
pathname,
|
|
10550
|
-
getFarmI18nSnapshot(),
|
|
10551
|
-
request
|
|
10552
|
-
),
|
|
10553
|
-
farmThemeConfig,
|
|
10554
|
-
farmResolvedRuntimeConfig.basePath,
|
|
10555
|
-
getFarmTheme(request)
|
|
10556
|
-
);
|
|
10557
|
-
emitFarmEvent({
|
|
10558
|
-
type: "render.complete",
|
|
10559
|
-
route: pathname,
|
|
10560
|
-
pathname,
|
|
10561
|
-
status: errorStatus,
|
|
10562
|
-
durationMs: Date.now() - requestStartTime,
|
|
10563
|
-
});
|
|
10564
|
-
return rememberFarmBufferedHtml(applyProductionMiddlewareHeaders(farmOwnedHtmlResponse(errorDocument, {
|
|
10565
|
-
status: errorStatus,
|
|
10566
|
-
headers: {
|
|
10567
|
-
"Content-Type": "text/html; charset=utf-8",
|
|
10568
|
-
"Cache-Control": "private, no-store",
|
|
10569
|
-
"x-farm-preload-buffered": getFarmBufferedPreloadMarker(errorDocument),
|
|
10570
|
-
},
|
|
10571
|
-
}), middlewareHeaders), errorDocument);
|
|
10572
|
-
} catch (boundaryError) {
|
|
10573
|
-
console.error("Route error boundary failed:", boundaryError);
|
|
10574
|
-
}
|
|
10575
|
-
}
|
|
10576
|
-
|
|
10577
|
-
const fallbackHtml = stampFarmCspNonce(createDefaultErrorMarkup({
|
|
10578
|
-
statusCode: errorStatus,
|
|
10579
|
-
statusText: errorStatusText,
|
|
10580
|
-
requestPath: pathname,
|
|
10581
|
-
method: request.method,
|
|
10582
|
-
development: false,
|
|
10583
|
-
mode: "production",
|
|
10584
|
-
}));
|
|
10585
|
-
const fallbackDocument = applyFarmThemeDocument(
|
|
10586
|
-
applyFarmI18nDocument(
|
|
10587
|
-
createFarmErrorDocument(
|
|
10588
|
-
fallbackHtml,
|
|
10589
|
-
errorStatus + " - " + errorStatusText
|
|
10590
|
-
),
|
|
10591
|
-
pathname,
|
|
10592
|
-
getFarmI18nSnapshot(),
|
|
10593
|
-
request
|
|
10594
|
-
),
|
|
10595
|
-
farmThemeConfig,
|
|
10596
|
-
farmResolvedRuntimeConfig.basePath,
|
|
10597
|
-
getFarmTheme(request)
|
|
10598
|
-
);
|
|
10599
|
-
return rememberFarmBufferedHtml(applyProductionMiddlewareHeaders(farmOwnedHtmlResponse(
|
|
10600
|
-
fallbackDocument,
|
|
10601
|
-
{
|
|
10602
|
-
status: errorStatus,
|
|
10603
|
-
headers: {
|
|
10604
|
-
"Content-Type": "text/html; charset=utf-8",
|
|
10605
|
-
"Cache-Control": "private, no-store",
|
|
10606
|
-
"x-farm-preload-buffered": getFarmBufferedPreloadMarker(fallbackDocument),
|
|
10607
|
-
},
|
|
10608
|
-
}
|
|
10609
|
-
), middlewareHeaders), fallbackDocument);
|
|
11248
|
+
return renderFarmErrorResponse(error, routePathname, params);
|
|
10610
11249
|
}
|
|
10611
11250
|
}
|
|
10612
11251
|
|
|
10613
11252
|
${servesDefaultMCP ? `
|
|
10614
11253
|
// agent.mcp: no app route answered /mcp, so the default read-only server may.
|
|
10615
11254
|
if (
|
|
10616
|
-
normalizeRuntimePath(routePathname) === ${JSON.stringify(
|
|
11255
|
+
normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkX3MHKLCOcjs.FARM_DEFAULT_MCP_PATH)} &&
|
|
10617
11256
|
getFarmDefaultMCPServer()
|
|
10618
11257
|
) {
|
|
10619
11258
|
return applyProductionMiddlewareHeaders(
|
|
@@ -10625,10 +11264,136 @@ ${servesDefaultMCP ? `
|
|
|
10625
11264
|
// 404 fallback - render proper HTML page
|
|
10626
11265
|
return renderFarmNotFoundResponse();
|
|
10627
11266
|
|
|
11267
|
+
// Hoisted: a page that throws and a middleware failure answer with the same error
|
|
11268
|
+
// document. The error boundary and layouts are those of errorRoutePathname.
|
|
11269
|
+
async function renderFarmErrorResponse(error, errorRoutePathname, params, errorDirectory) {
|
|
11270
|
+
const errorStatus = resolveDefaultErrorStatus(error);
|
|
11271
|
+
const errorStatusText = getDefaultErrorStatusText(errorStatus);
|
|
11272
|
+
|
|
11273
|
+
const errorBoundaryMatch = getMatchingErrorBoundary(errorRoutePathname);
|
|
11274
|
+
if (errorBoundaryMatch?.route.module?.default) {
|
|
11275
|
+
try {
|
|
11276
|
+
const searchParamsObj = searchParamsToObject(url.searchParams);
|
|
11277
|
+
const ErrorComponent = errorBoundaryMatch.route.module.default;
|
|
11278
|
+
let errorElement = React.createElement(ErrorComponent, {
|
|
11279
|
+
error,
|
|
11280
|
+
reset: function() {},
|
|
11281
|
+
params,
|
|
11282
|
+
search: searchParamsObj,
|
|
11283
|
+
searchParams: createFarmSearchParams(searchParamsObj),
|
|
11284
|
+
path: pathname,
|
|
11285
|
+
...(middlewareData?.size ? { middleware: { data: middlewareData } } : {}),
|
|
11286
|
+
});
|
|
11287
|
+
|
|
11288
|
+
const applicableLayouts = getApplicableLayouts(errorRoutePathname, errorDirectory);
|
|
11289
|
+
for (let i = applicableLayouts.length - 1; i >= 0; i--) {
|
|
11290
|
+
const LayoutComponent = applicableLayouts[i].module.default;
|
|
11291
|
+
if (LayoutComponent) {
|
|
11292
|
+
errorElement = React.createElement(LayoutComponent, {
|
|
11293
|
+
children: errorElement,
|
|
11294
|
+
params,
|
|
11295
|
+
});
|
|
11296
|
+
}
|
|
11297
|
+
}
|
|
11298
|
+
|
|
11299
|
+
errorElement = wrapWithFarmIntegrationProviders(errorElement);
|
|
11300
|
+
|
|
11301
|
+
const renderErrorElement = () =>
|
|
11302
|
+
renderFarmElementToString(ReactDOMServer, errorElement);
|
|
11303
|
+
const errorHtml = ${hasMiddlewareRuntime ? `await _runWithMiddlewareData(middlewareData, () =>
|
|
11304
|
+
_runWithMiddlewareContext(middlewareContext, renderErrorElement)
|
|
11305
|
+
)` : "await renderErrorElement()"};
|
|
11306
|
+
const errorDocument = applyFarmThemeDocument(
|
|
11307
|
+
applyFarmI18nDocument(
|
|
11308
|
+
createFarmErrorDocument(errorHtml, "Application Error"),
|
|
11309
|
+
pathname,
|
|
11310
|
+
getFarmI18nSnapshot(),
|
|
11311
|
+
request
|
|
11312
|
+
),
|
|
11313
|
+
farmThemeConfig,
|
|
11314
|
+
farmResolvedRuntimeConfig.basePath,
|
|
11315
|
+
getFarmTheme(request)
|
|
11316
|
+
);
|
|
11317
|
+
emitFarmEvent({
|
|
11318
|
+
type: "render.complete",
|
|
11319
|
+
route: pathname,
|
|
11320
|
+
pathname,
|
|
11321
|
+
status: errorStatus,
|
|
11322
|
+
durationMs: Date.now() - requestStartTime,
|
|
11323
|
+
});
|
|
11324
|
+
return rememberFarmBufferedHtml(applyProductionMiddlewareHeaders(farmOwnedHtmlResponse(errorDocument, {
|
|
11325
|
+
status: errorStatus,
|
|
11326
|
+
headers: {
|
|
11327
|
+
"Content-Type": "text/html; charset=utf-8",
|
|
11328
|
+
"Cache-Control": "private, no-store",
|
|
11329
|
+
"x-farm-preload-buffered": getFarmBufferedPreloadMarker(errorDocument),
|
|
11330
|
+
},
|
|
11331
|
+
}), middlewareHeaders), errorDocument);
|
|
11332
|
+
} catch (boundaryError) {
|
|
11333
|
+
console.error("Route error boundary failed:", boundaryError);
|
|
11334
|
+
}
|
|
11335
|
+
}
|
|
11336
|
+
|
|
11337
|
+
const fallbackHtml = stampFarmCspNonce(createDefaultErrorMarkup({
|
|
11338
|
+
statusCode: errorStatus,
|
|
11339
|
+
statusText: errorStatusText,
|
|
11340
|
+
requestPath: pathname,
|
|
11341
|
+
method: request.method,
|
|
11342
|
+
development: false,
|
|
11343
|
+
mode: "production",
|
|
11344
|
+
}));
|
|
11345
|
+
const fallbackDocument = applyFarmThemeDocument(
|
|
11346
|
+
applyFarmI18nDocument(
|
|
11347
|
+
createFarmErrorDocument(
|
|
11348
|
+
fallbackHtml,
|
|
11349
|
+
errorStatus + " - " + errorStatusText
|
|
11350
|
+
),
|
|
11351
|
+
pathname,
|
|
11352
|
+
getFarmI18nSnapshot(),
|
|
11353
|
+
request
|
|
11354
|
+
),
|
|
11355
|
+
farmThemeConfig,
|
|
11356
|
+
farmResolvedRuntimeConfig.basePath,
|
|
11357
|
+
getFarmTheme(request)
|
|
11358
|
+
);
|
|
11359
|
+
return rememberFarmBufferedHtml(applyProductionMiddlewareHeaders(farmOwnedHtmlResponse(
|
|
11360
|
+
fallbackDocument,
|
|
11361
|
+
{
|
|
11362
|
+
status: errorStatus,
|
|
11363
|
+
headers: {
|
|
11364
|
+
"Content-Type": "text/html; charset=utf-8",
|
|
11365
|
+
"Cache-Control": "private, no-store",
|
|
11366
|
+
"x-farm-preload-buffered": getFarmBufferedPreloadMarker(fallbackDocument),
|
|
11367
|
+
},
|
|
11368
|
+
}
|
|
11369
|
+
), middlewareHeaders), fallbackDocument);
|
|
11370
|
+
}
|
|
11371
|
+
${hasMiddlewareRuntime ? `
|
|
11372
|
+
// A request no page answers fails with the JSON a throwing API route answers.
|
|
11373
|
+
function renderFarmErrorJSONResponse() {
|
|
11374
|
+
return applyProductionMiddlewareHeaders(farmOwnedResponse(
|
|
11375
|
+
JSON.stringify({ error: "Internal Server Error" }),
|
|
11376
|
+
{ status: 500, headers: { "Content-Type": "application/json" } }
|
|
11377
|
+
), middlewareHeaders);
|
|
11378
|
+
}
|
|
11379
|
+
` : ""}
|
|
10628
11380
|
// Hoisted: page and middleware notFound() answer with the same page.
|
|
10629
11381
|
async function renderFarmNotFoundResponse() {
|
|
10630
11382
|
emitFarmEvent({ type: "route.notFound", pathname });
|
|
10631
|
-
|
|
11383
|
+
${farmRendererDisabled ? `
|
|
11384
|
+
// renderer: false has no pages to render, so a miss answers like an API miss.
|
|
11385
|
+
emitFarmEvent({
|
|
11386
|
+
type: "render.complete",
|
|
11387
|
+
route: pathname,
|
|
11388
|
+
pathname,
|
|
11389
|
+
status: 404,
|
|
11390
|
+
durationMs: Date.now() - requestStartTime,
|
|
11391
|
+
});
|
|
11392
|
+
return applyProductionMiddlewareHeaders(farmOwnedResponse(
|
|
11393
|
+
JSON.stringify({ error: "Not found", pathname }),
|
|
11394
|
+
{ status: 404, headers: { "Content-Type": "application/json" } }
|
|
11395
|
+
), middlewareHeaders);
|
|
11396
|
+
` : ""}
|
|
10632
11397
|
// Agents that navigate in Markdown (a \`.md\` URL or \`Accept: text/markdown\`)
|
|
10633
11398
|
// get a Markdown error body instead of the HTML not-found shell.
|
|
10634
11399
|
if (farmRequestWantsMarkdown(pathname, request.headers.get("accept"))) {
|
|
@@ -10824,16 +11589,32 @@ async function handleFarmPluginRequest(request, runtimeOptions, adapterContext)
|
|
|
10824
11589
|
}
|
|
10825
11590
|
|
|
10826
11591
|
${generatePreloadResponseRuntimeSource()}
|
|
10827
|
-
|
|
11592
|
+
${hasPluginRuntime ? `
|
|
11593
|
+
// The 500 a request answers when a plugin runtime hook throws, as in farm dev: the generic JSON
|
|
11594
|
+
// body on an API path or with renderer: false, plain text for a page.
|
|
11595
|
+
function createFarmRuntimeHookErrorResponse(request, error) {
|
|
11596
|
+
console.error("Plugin runtime error:", error);${farmRendererDisabled ? "" : `
|
|
11597
|
+
if (!isFarmLocalAPIPathname(new URL(request.url).pathname)) {
|
|
11598
|
+
return farmOwnedResponse("Internal Server Error", {
|
|
11599
|
+
status: 500,
|
|
11600
|
+
headers: { "Content-Type": "text/plain; charset=utf-8" },
|
|
11601
|
+
});
|
|
11602
|
+
}`}
|
|
11603
|
+
return farmOwnedResponse(JSON.stringify({ error: "Internal Server Error" }), {
|
|
11604
|
+
status: 500,
|
|
11605
|
+
headers: { "Content-Type": "application/json" },
|
|
11606
|
+
});
|
|
11607
|
+
}
|
|
11608
|
+
` : ""}
|
|
10828
11609
|
// Export as Web Standard fetch API
|
|
10829
11610
|
export async function fetch(request, context) {${imageRuntime === "none" ? "" : `
|
|
10830
11611
|
// The image optimizer's fetch of a local source is not a loopback visitor.
|
|
10831
11612
|
context = _withFarmImageSourceClientAddress(request, context);`}
|
|
10832
|
-
${_optionalChain([config, 'access',
|
|
11613
|
+
${_optionalChain([config, 'access', _261 => _261.agent, 'optionalAccess', _262 => _262.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
|
|
10833
11614
|
basePath: farmLocalAPIBasePath,
|
|
10834
11615
|
dispatch: async (localRequest) =>
|
|
10835
11616
|
(await handleAPIRequest(localRequest)) ?? Response.json({ error: "Not Found" }, { status: 404 }),
|
|
10836
|
-
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access',
|
|
11617
|
+
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _263 => _263.agent, 'optionalAccess', _264 => _264.noindexPreviews]) ? `
|
|
10837
11618
|
// Keep every response of a preview deployment out of search indexes.
|
|
10838
11619
|
return farmNoindexPreview ? applyFarmPreviewRobotsTag(response) : response;` : ""}
|
|
10839
11620
|
}
|
|
@@ -10899,11 +11680,14 @@ async function handleFarmFetch(request, context) {
|
|
|
10899
11680
|
const runRequest = () => farmPluginRuntime
|
|
10900
11681
|
? farmPluginRuntime.runRuntimeRequest(
|
|
10901
11682
|
request,
|
|
10902
|
-
(runtimeRequest) =>
|
|
11683
|
+
(runtimeRequest, runtimeScope) =>
|
|
10903
11684
|
_runWithCurrentRequest(runtimeRequest, () =>
|
|
10904
11685
|
prepareResponse(
|
|
10905
11686
|
runtimeRequest,
|
|
10906
|
-
handleFarmPluginRequest(runtimeRequest, runtimeOptions,
|
|
11687
|
+
handleFarmPluginRequest(runtimeRequest, runtimeOptions, {
|
|
11688
|
+
...context,
|
|
11689
|
+
[farmRuntimeErrorSlot]: runtimeScope.reportError,
|
|
11690
|
+
}),
|
|
10907
11691
|
)
|
|
10908
11692
|
),
|
|
10909
11693
|
{
|
|
@@ -10912,6 +11696,11 @@ async function handleFarmFetch(request, context) {
|
|
|
10912
11696
|
? context.waitUntil.bind(context)
|
|
10913
11697
|
: undefined,
|
|
10914
11698
|
},
|
|
11699
|
+
).catch((error) =>
|
|
11700
|
+
// A runtime hook threw, or something it wraps: runtime.error and onError observed
|
|
11701
|
+
// it, and the remaining runtime.after hooks were skipped. Answer the 500 farm dev
|
|
11702
|
+
// answers, with the headers() config, instead of Nitro's own error response.
|
|
11703
|
+
prepareResponse(request, createFarmRuntimeHookErrorResponse(request, error))
|
|
10915
11704
|
)
|
|
10916
11705
|
: ${hasInfraAnalyticsRuntime && !hasPluginRuntime ? `farmAnalyticsOptions
|
|
10917
11706
|
? farmInfraAnalytics.record(
|
|
@@ -11025,13 +11814,13 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
11025
11814
|
if (rewriteSources.some((source) => middlewarePatternMatches(source, pathname))) {
|
|
11026
11815
|
return "rewrite";
|
|
11027
11816
|
}
|
|
11028
|
-
if (
|
|
11029
|
-
if (
|
|
11030
|
-
if (
|
|
11817
|
+
if (_chunkUPOYKX4Scjs.appMiddlewareMayHandlePath.call(void 0, middlewareRoutes, pathname)) return "app middleware";
|
|
11818
|
+
if (_chunkUPOYKX4Scjs.configMiddlewareMayHandlePath.call(void 0, config.middleware, pathname)) return "configured middleware";
|
|
11819
|
+
if (_chunk556H7JCEcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
|
|
11031
11820
|
if (farmServerRuntimePluginsMayHandlePath(config, pathname)) return "server runtime plugin";
|
|
11032
11821
|
const manifestEntry = getManifestPageEntry(routeRuntimeManifest, pathname);
|
|
11033
|
-
if (_optionalChain([manifestEntry, 'optionalAccess',
|
|
11034
|
-
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access',
|
|
11822
|
+
if (_optionalChain([manifestEntry, 'optionalAccess', _265 => _265.rendering]) === "dynamic") return "dynamic runtime manifest";
|
|
11823
|
+
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _266 => _266.regions, 'optionalAccess', _267 => _267.length])) || manifestEntry.maxDuration !== void 0)) {
|
|
11035
11824
|
return "route runtime controls";
|
|
11036
11825
|
}
|
|
11037
11826
|
const routeRule = getEffectiveRouteRule(config, pathname);
|
|
@@ -11044,20 +11833,20 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
11044
11833
|
return void 0;
|
|
11045
11834
|
}
|
|
11046
11835
|
async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
11047
|
-
if (!_optionalChain([config, 'access',
|
|
11048
|
-
if (!
|
|
11836
|
+
if (!_optionalChain([config, 'access', _268 => _268.docs, 'optionalAccess', _269 => _269.enabled]) || !config.docs.prerender) return [];
|
|
11837
|
+
if (!_chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) || !_chunkDCXSIEFEcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
|
|
11049
11838
|
_chunkQMNWKQL4cjs.logger.warn(
|
|
11050
11839
|
"docs.prerender needs a docs adapter such as @farming-labs/farmjs; Farm's built-in docs renderer keeps rendering docs pages on request."
|
|
11051
11840
|
);
|
|
11052
11841
|
return [];
|
|
11053
11842
|
}
|
|
11054
|
-
if (
|
|
11843
|
+
if (_chunkF43OG25Pcjs.getFarmPresetRuntime.call(void 0, preset) === "edge") {
|
|
11055
11844
|
_chunkQMNWKQL4cjs.logger.info(
|
|
11056
11845
|
`\u21AA Keeping docs pages in the edge docs snapshot: docs.prerender writes static files on Node and serverless targets, not "${preset}".`
|
|
11057
11846
|
);
|
|
11058
11847
|
return [];
|
|
11059
11848
|
}
|
|
11060
|
-
const pages = await
|
|
11849
|
+
const pages = await _chunkDCXSIEFEcjs.listFarmDocsAdapterPages.call(void 0, config.docs, { root, srcDir: config.srcDir });
|
|
11061
11850
|
if (!pages) {
|
|
11062
11851
|
_chunkQMNWKQL4cjs.logger.warn(
|
|
11063
11852
|
`The docs adapter ${JSON.stringify(config.docs.adapter.id)} does not list its pages for prerendering; upgrade it to prerender docs pages. They render on request until then.`
|
|
@@ -11068,9 +11857,9 @@ async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
|
11068
11857
|
}
|
|
11069
11858
|
function hasFarmNitroCacheRouteRule(routeRules) {
|
|
11070
11859
|
return Object.values(routeRules || {}).some((rule) => {
|
|
11071
|
-
const swr = _optionalChain([rule, 'optionalAccess',
|
|
11072
|
-
const cache = _optionalChain([rule, 'optionalAccess',
|
|
11073
|
-
const headers = _optionalChain([rule, 'optionalAccess',
|
|
11860
|
+
const swr = _optionalChain([rule, 'optionalAccess', _270 => _270.swr]);
|
|
11861
|
+
const cache = _optionalChain([rule, 'optionalAccess', _271 => _271.cache]);
|
|
11862
|
+
const headers = _optionalChain([rule, 'optionalAccess', _272 => _272.headers]);
|
|
11074
11863
|
return swr !== void 0 && swr !== false || cache !== void 0 && cache !== false || !!headers && typeof headers === "object" && Object.keys(headers).length > 0;
|
|
11075
11864
|
});
|
|
11076
11865
|
}
|
|
@@ -11081,12 +11870,12 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
11081
11870
|
]);
|
|
11082
11871
|
if (nitroBuilderResult.status === "rejected") throw nitroBuilderResult.reason;
|
|
11083
11872
|
const nitroBuilder = nitroBuilderResult.value;
|
|
11084
|
-
const isVercel = preset === "vercel"
|
|
11873
|
+
const isVercel = preset === "vercel";
|
|
11085
11874
|
const isCloudflareWorker = preset === "cloudflare-module";
|
|
11086
|
-
const outputDir =
|
|
11875
|
+
const outputDir = _chunk556H7JCEcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
11087
11876
|
const runtimeServerOutputDir = isVercel ? _path2.default.join(outputDir, "functions", "__nitro.func") : _path2.default.join(outputDir, "server");
|
|
11088
11877
|
const ssrOutputDir = _path2.default.join(root, distDir, "ssr");
|
|
11089
|
-
const imageRuntime =
|
|
11878
|
+
const imageRuntime = _chunkN5DQMOAGcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
|
|
11090
11879
|
const hasGeneratedMetadataImages = Array.from(routeManager.getMetadataImages().values()).some(
|
|
11091
11880
|
(image) => image.sourceType === "module"
|
|
11092
11881
|
);
|
|
@@ -11108,8 +11897,8 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
11108
11897
|
const middlewareRoutesPromise = discoverMiddlewareRoutes(_chunk5Y2P454Ocjs.getFarmAppDirectories.call(void 0, config));
|
|
11109
11898
|
const configuredResponseRoutesPromise = Promise.all([config.redirects(), config.rewrites()]);
|
|
11110
11899
|
const docsPrerenderPagesPromise = getFarmDocsPrerenderPages(config, root, preset);
|
|
11111
|
-
const farmWorkflows = await
|
|
11112
|
-
const farmCron = await
|
|
11900
|
+
const farmWorkflows = await _chunkKCY52OUQcjs.prepareFarmWorkflowsForNitro.call(void 0, config);
|
|
11901
|
+
const farmCron = await _chunkYAEN3L2Fcjs.prepareFarmCronForNitro.call(void 0, config);
|
|
11113
11902
|
const [
|
|
11114
11903
|
{ ssg: ssgPages },
|
|
11115
11904
|
middlewareRoutes,
|
|
@@ -11189,8 +11978,8 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
11189
11978
|
"Cloudflare Pages does not install Cron Triggers. Use the cloudflare-module preset or an external scheduler with .farm/cron-manifest.json."
|
|
11190
11979
|
);
|
|
11191
11980
|
}
|
|
11192
|
-
const scheduledTasks =
|
|
11193
|
-
const cloudflareCronConfig = farmCron.provider === "host" ?
|
|
11981
|
+
const scheduledTasks = _chunkYAEN3L2Fcjs.mergeScheduledTasks.call(void 0, farmWorkflows.scheduledTasks, farmCron.scheduledTasks);
|
|
11982
|
+
const cloudflareCronConfig = farmCron.provider === "host" ? _chunkYAEN3L2Fcjs.createFarmCronCloudflareConfig.call(void 0, farmCron.jobs) : void 0;
|
|
11194
11983
|
const [clientCssHref, clientJsSrc, clientBootSrc, docsModulePreloads, clientModulePreloads] = await Promise.all([
|
|
11195
11984
|
resolveHashedClientCssHref(clientOutputDir),
|
|
11196
11985
|
resolveHashedClientJsSrc(clientOutputDir),
|
|
@@ -11201,19 +11990,20 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
11201
11990
|
let nativeStylesheets;
|
|
11202
11991
|
const encodedDocsModulePreloads = encodeFarmDocsModulePreloads(docsModulePreloads);
|
|
11203
11992
|
const encodedClientModulePreloads = encodeFarmClientModulePreloads(clientModulePreloads);
|
|
11204
|
-
const encodedMobileShellClient = shouldBuildFarmMobileClient(config) ?
|
|
11205
|
-
await
|
|
11993
|
+
const encodedMobileShellClient = shouldBuildFarmMobileClient(config) ? _chunkE5UN4OWXcjs.encodeFarmMobileShellClient.call(void 0,
|
|
11994
|
+
await _chunkE5UN4OWXcjs.finalizeFarmMobileClient.call(void 0, {
|
|
11206
11995
|
buildDir: _path2.default.join(root, distDir),
|
|
11207
11996
|
clientOutputDir,
|
|
11208
11997
|
webEntry: clientJsSrc,
|
|
11998
|
+
webBoot: clientBootSrc,
|
|
11209
11999
|
stylesheet: clientCssHref,
|
|
11210
|
-
webFiles: _nullishCoalesce(_optionalChain([clientModulePreloads, 'optionalAccess',
|
|
12000
|
+
webFiles: _nullishCoalesce(_optionalChain([clientModulePreloads, 'optionalAccess', _273 => _273.files]), () => ( []))
|
|
11211
12001
|
})
|
|
11212
12002
|
) : null;
|
|
11213
12003
|
for (const output of Object.values(ssrBundle)) {
|
|
11214
12004
|
if (output.type !== "chunk") continue;
|
|
11215
|
-
if (encodedMobileShellClient && output.code.includes(
|
|
11216
|
-
output.code = output.code.split(
|
|
12005
|
+
if (encodedMobileShellClient && output.code.includes(_chunkE5UN4OWXcjs.FARM_MOBILE_SHELL_CLIENT_PLACEHOLDER)) {
|
|
12006
|
+
output.code = output.code.split(_chunkE5UN4OWXcjs.FARM_MOBILE_SHELL_CLIENT_PLACEHOLDER).join(encodedMobileShellClient);
|
|
11217
12007
|
}
|
|
11218
12008
|
if (output.code.includes(FARM_DOCS_MODULE_PRELOADS_PLACEHOLDER)) {
|
|
11219
12009
|
output.code = output.code.split(FARM_DOCS_MODULE_PRELOADS_PLACEHOLDER).join(encodedDocsModulePreloads);
|
|
@@ -11497,12 +12287,23 @@ function toFarmNodeResponse(request, response) {
|
|
|
11497
12287
|
})
|
|
11498
12288
|
);
|
|
11499
12289
|
}
|
|
12290
|
+
const farmCloudflareEnvPath = preset === "cloudflare-pages" ? _path2.default.join(ssrOutputDir, "farm-cloudflare-env.mjs") : null;
|
|
12291
|
+
if (farmCloudflareEnvPath) {
|
|
12292
|
+
await fs4.writeFile(
|
|
12293
|
+
farmCloudflareEnvPath,
|
|
12294
|
+
`export default function farmCloudflareEnv(event) {
|
|
12295
|
+
const env = event.req.runtime?.cloudflare?.env
|
|
12296
|
+
if (env) globalThis.__env__ = env
|
|
12297
|
+
}
|
|
12298
|
+
`
|
|
12299
|
+
);
|
|
12300
|
+
}
|
|
11500
12301
|
const prebuiltSSRPlugin = createExternalSSRBundlePlugin(
|
|
11501
12302
|
nitroEntryPath,
|
|
11502
12303
|
ssrOutputDir,
|
|
11503
12304
|
ssrEntryFile
|
|
11504
12305
|
);
|
|
11505
|
-
const configuredNitroRouteRules = shouldBuildFarmMobileClient(config) ? varyFarmNitroCacheRulesByShell(
|
|
12306
|
+
const configuredNitroRouteRules = shouldBuildFarmMobileClient(config) ? varyFarmNitroCacheRulesByShell(_chunk22IWL4YDcjs.routeRulesToNitroRouteRules.call(void 0, config.routeRules)) : _chunk22IWL4YDcjs.routeRulesToNitroRouteRules.call(void 0, config.routeRules);
|
|
11506
12307
|
const prerenderNitroRouteRules = Object.fromEntries(
|
|
11507
12308
|
prerenderRoutes.map((route) => {
|
|
11508
12309
|
const configuredRule = configuredNitroRouteRules[route] || {};
|
|
@@ -11581,6 +12382,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
11581
12382
|
} : {},
|
|
11582
12383
|
// Use serverHandlers to define our workflow handler first, then the catch-all handler.
|
|
11583
12384
|
handlers: [
|
|
12385
|
+
...farmCloudflareEnvPath ? [{ route: "/**", middleware: true, handler: _chunkQMNWKQL4cjs.toPosixPath.call(void 0, farmCloudflareEnvPath) }] : [],
|
|
11584
12386
|
...farmWorkflows.handlerPath ? [
|
|
11585
12387
|
{
|
|
11586
12388
|
route: `${config.workflows.route}/**`,
|
|
@@ -11604,7 +12406,10 @@ function toFarmNodeResponse(request, response) {
|
|
|
11604
12406
|
rollupConfig: {
|
|
11605
12407
|
external: nitroRollupExternal,
|
|
11606
12408
|
plugins: [
|
|
11607
|
-
|
|
12409
|
+
// On Cloudflare, Nitro imports @vercel/og's `?module` wasm files as
|
|
12410
|
+
// precompiled modules, and bundles @vercel/og itself when the SSR
|
|
12411
|
+
// graph kept it external.
|
|
12412
|
+
...isCloudflareImagePreset(preset) ? [createVercelOgFontInlinePlugin()] : hasGeneratedMetadataImages && !useExternalMetadataImageRuntime ? [createMetadataImageWasmPlugin()] : [],
|
|
11608
12413
|
// Workers bundle React here rather than loading it from node_modules.
|
|
11609
12414
|
// Unenv rewrites `process` before Nitro's own replacements run, so
|
|
11610
12415
|
// React's development builds would otherwise ship next to production.
|
|
@@ -11634,25 +12439,26 @@ function toFarmNodeResponse(request, response) {
|
|
|
11634
12439
|
snapshotSSRRebundleOptions(nitroConfig)
|
|
11635
12440
|
);
|
|
11636
12441
|
const requestedBuilder = _nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER));
|
|
11637
|
-
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access',
|
|
11638
|
-
_optionalChain([nitroConfig, 'access',
|
|
11639
|
-
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess',
|
|
12442
|
+
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _274 => _274.rollupConfig, 'optionalAccess', _275 => _275.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _276 => _276.rollupConfig, 'optionalAccess', _277 => _277.plugins])) && customRollupKeys.length === 0 && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _278 => _278.output, 'optionalAccess', _279 => _279.serverDir]) || "") === _path2.default.resolve(expectedServerDir) && Boolean(
|
|
12443
|
+
_optionalChain([nitroConfig, 'access', _280 => _280.handlers, 'optionalAccess', _281 => _281.some, 'call', _282 => _282(
|
|
12444
|
+
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _283 => _283.handler]) || "") === nitroEntryPath
|
|
11640
12445
|
)])
|
|
11641
12446
|
);
|
|
11642
12447
|
const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
|
|
11643
12448
|
if (selectRolldownBuilder) nitroConfig.builder = "rolldown";
|
|
11644
12449
|
const useRolldownBuilder = canReusePrebuiltSSR && (_nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER))) === "rolldown";
|
|
11645
12450
|
const shouldMinify = nitroConfig.minify !== false;
|
|
11646
|
-
const keepServerNames = !(_optionalChain([config, 'access',
|
|
12451
|
+
const keepServerNames = !(_optionalChain([config, 'access', _284 => _284.docs, 'optionalAccess', _285 => _285.enabled]) && _optionalChain([config, 'access', _286 => _286.docs, 'access', _287 => _287.adapter, 'optionalAccess', _288 => _288.server]));
|
|
11647
12452
|
const useFarmServerMinifier = shouldMinify && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig;
|
|
11648
12453
|
const serverChunkMinifier = useFarmServerMinifier ? createServerChunkMinifyPlugin({ keepNames: keepServerNames, target: "esnext" }) : null;
|
|
11649
|
-
|
|
11650
|
-
|
|
12454
|
+
const ssrRollupPlugin = canReusePrebuiltSSR ? prebuiltSSRPlugin : createServerReadSSRAssetsPlugin(ssrBundle, ssrOutputDir);
|
|
12455
|
+
if (ssrRollupPlugin) {
|
|
12456
|
+
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _289 => _289.rollupConfig, 'optionalAccess', _290 => _290.plugins]);
|
|
11651
12457
|
nitroConfig.rollupConfig = {
|
|
11652
12458
|
...nitroConfig.rollupConfig,
|
|
11653
12459
|
plugins: [
|
|
11654
12460
|
...Array.isArray(configuredRollupPlugins) ? configuredRollupPlugins : configuredRollupPlugins ? [configuredRollupPlugins] : [],
|
|
11655
|
-
|
|
12461
|
+
ssrRollupPlugin
|
|
11656
12462
|
]
|
|
11657
12463
|
};
|
|
11658
12464
|
}
|
|
@@ -11664,7 +12470,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
11664
12470
|
Array.from(routes, (route, index) => {
|
|
11665
12471
|
try {
|
|
11666
12472
|
return [decodeURI(route), index];
|
|
11667
|
-
} catch (
|
|
12473
|
+
} catch (e34) {
|
|
11668
12474
|
return [route, index];
|
|
11669
12475
|
}
|
|
11670
12476
|
})
|
|
@@ -11674,10 +12480,12 @@ function toFarmNodeResponse(request, response) {
|
|
|
11674
12480
|
const orderOf = (route) => _nullishCoalesce(prerenderOrder.get(route), () => ( Number.MAX_SAFE_INTEGER));
|
|
11675
12481
|
prerenderedRoutes.sort((a, b) => orderOf(a.route) - orderOf(b.route));
|
|
11676
12482
|
});
|
|
11677
|
-
if (_optionalChain([config, 'access',
|
|
12483
|
+
if (_optionalChain([config, 'access', _291 => _291.md, 'optionalAccess', _292 => _292.enabled])) {
|
|
11678
12484
|
nitroInstance.hooks.hook("prerender:generate", (route) => {
|
|
11679
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
11680
|
-
const alternatePath =
|
|
12485
|
+
if (!route.contents || !_optionalChain([route, 'access', _293 => _293.contentType, 'optionalAccess', _294 => _294.toLowerCase, 'call', _295 => _295(), 'access', _296 => _296.includes, 'call', _297 => _297("html")])) return;
|
|
12486
|
+
const alternatePath = _chunkFT6KJHS3cjs.getFarmMarkdownAlternatePath.call(void 0, config.md, route.route, {
|
|
12487
|
+
routePathname: (pathname) => routeManager.toRoutePathname(pathname)
|
|
12488
|
+
});
|
|
11681
12489
|
if (!alternatePath) return;
|
|
11682
12490
|
const routeRule = nitroInstance.options.routeRules[route.route] || {};
|
|
11683
12491
|
const alternate = `<${alternatePath}>; rel="alternate"; type="text/markdown"`;
|
|
@@ -11697,7 +12505,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
11697
12505
|
}
|
|
11698
12506
|
if (config.security.csp && config.security.csp.nonce) {
|
|
11699
12507
|
nitroInstance.hooks.hook("prerender:generate", async (route) => {
|
|
11700
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
12508
|
+
if (!route.contents || !_optionalChain([route, 'access', _298 => _298.contentType, 'optionalAccess', _299 => _299.toLowerCase, 'call', _300 => _300(), 'access', _301 => _301.includes, 'call', _302 => _302("html")])) return;
|
|
11701
12509
|
const staticCsp = await _chunk6JHZPB52cjs.applyFarmCspHashesToHtml.call(void 0, route.contents, config.security);
|
|
11702
12510
|
if (!staticCsp) return;
|
|
11703
12511
|
route.contents = staticCsp.html;
|
|
@@ -11772,13 +12580,13 @@ function toFarmNodeResponse(request, response) {
|
|
|
11772
12580
|
}
|
|
11773
12581
|
if (prerenderRoutes.length > 0) {
|
|
11774
12582
|
_chunkQMNWKQL4cjs.logger.info(`\u{1F4C4} Pre-rendering ${prerenderRoutes.length} SSG page(s)`);
|
|
11775
|
-
const previousPrerender = process.env[
|
|
11776
|
-
process.env[
|
|
12583
|
+
const previousPrerender = process.env[_chunk6R53ZWX2cjs.FARM_PRERENDER_ENV];
|
|
12584
|
+
process.env[_chunk6R53ZWX2cjs.FARM_PRERENDER_ENV] = "1";
|
|
11777
12585
|
try {
|
|
11778
12586
|
await nitroBuilder.prerender(nitroInstance);
|
|
11779
12587
|
} finally {
|
|
11780
|
-
if (previousPrerender === void 0) delete process.env[
|
|
11781
|
-
else process.env[
|
|
12588
|
+
if (previousPrerender === void 0) delete process.env[_chunk6R53ZWX2cjs.FARM_PRERENDER_ENV];
|
|
12589
|
+
else process.env[_chunk6R53ZWX2cjs.FARM_PRERENDER_ENV] = previousPrerender;
|
|
11782
12590
|
}
|
|
11783
12591
|
}
|
|
11784
12592
|
const sharpRuntimeStagePromise = imageRuntime === "node" ? stageSharpRuntime(config, root, distDir, fs4, preset) : Promise.resolve(null);
|
|
@@ -11838,6 +12646,9 @@ function toFarmNodeResponse(request, response) {
|
|
|
11838
12646
|
if (preset === "node-server" && !desktopServerEntry) {
|
|
11839
12647
|
await installFarmCompileCacheLauncher(_path2.default.join(outputDir, "server"), fs4);
|
|
11840
12648
|
}
|
|
12649
|
+
if (preset.startsWith("cloudflare")) {
|
|
12650
|
+
await populateCloudflareProcessEnv(nitroInstance.options.output.serverDir, fs4);
|
|
12651
|
+
}
|
|
11841
12652
|
if (pluginManager) {
|
|
11842
12653
|
await pluginManager.runHookParallel("afterNitroBuild", {
|
|
11843
12654
|
root,
|
|
@@ -11860,7 +12671,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
11860
12671
|
_chunkQMNWKQL4cjs.logger.success(`\u2705 Nitro build completed with preset: ${preset}`);
|
|
11861
12672
|
}
|
|
11862
12673
|
function resolveFarmNitroOutputConfig(preset, outputDir) {
|
|
11863
|
-
const isVercel = preset === "vercel"
|
|
12674
|
+
const isVercel = preset === "vercel";
|
|
11864
12675
|
return {
|
|
11865
12676
|
dir: outputDir,
|
|
11866
12677
|
...preset === "node-server" ? {
|
|
@@ -11872,6 +12683,36 @@ function resolveFarmNitroOutputConfig(preset, outputDir) {
|
|
|
11872
12683
|
} : {}
|
|
11873
12684
|
};
|
|
11874
12685
|
}
|
|
12686
|
+
var CLOUDFLARE_POPULATE_PROCESS_ENV_FLAG = "nodejs_compat_populate_process_env";
|
|
12687
|
+
var CLOUDFLARE_DO_NOT_POPULATE_PROCESS_ENV_FLAG = "nodejs_compat_do_not_populate_process_env";
|
|
12688
|
+
var CLOUDFLARE_POPULATE_PROCESS_ENV_DATE = "2025-04-01";
|
|
12689
|
+
function resolveCloudflareProcessEnvFlags(wrangler) {
|
|
12690
|
+
const date = wrangler.compatibility_date;
|
|
12691
|
+
const flags = wrangler.compatibility_flags;
|
|
12692
|
+
if (typeof date !== "string" || date >= CLOUDFLARE_POPULATE_PROCESS_ENV_DATE) return void 0;
|
|
12693
|
+
if (!Array.isArray(flags) || !flags.includes("nodejs_compat")) return void 0;
|
|
12694
|
+
if (flags.includes(CLOUDFLARE_POPULATE_PROCESS_ENV_FLAG) || flags.includes(CLOUDFLARE_DO_NOT_POPULATE_PROCESS_ENV_FLAG)) {
|
|
12695
|
+
return void 0;
|
|
12696
|
+
}
|
|
12697
|
+
return [...flags, CLOUDFLARE_POPULATE_PROCESS_ENV_FLAG];
|
|
12698
|
+
}
|
|
12699
|
+
async function populateCloudflareProcessEnv(serverDir, fs4) {
|
|
12700
|
+
const wranglerPath = _path2.default.join(serverDir, "wrangler.json");
|
|
12701
|
+
let source;
|
|
12702
|
+
try {
|
|
12703
|
+
source = await fs4.readFile(wranglerPath, "utf8");
|
|
12704
|
+
} catch (error) {
|
|
12705
|
+
if (error.code === "ENOENT") return;
|
|
12706
|
+
throw error;
|
|
12707
|
+
}
|
|
12708
|
+
const wrangler = JSON.parse(source);
|
|
12709
|
+
const flags = resolveCloudflareProcessEnvFlags(wrangler);
|
|
12710
|
+
if (!flags) return;
|
|
12711
|
+
await fs4.writeFile(
|
|
12712
|
+
wranglerPath,
|
|
12713
|
+
JSON.stringify({ ...wrangler, compatibility_flags: flags }, null, 2)
|
|
12714
|
+
);
|
|
12715
|
+
}
|
|
11875
12716
|
function prepareSSRBundleFiles(ssrBundle, minifyOptions) {
|
|
11876
12717
|
return Promise.all(
|
|
11877
12718
|
Object.entries(ssrBundle).map(async ([fileName, output]) => ({
|
|
@@ -11928,7 +12769,7 @@ async function moveVercelOutputPath(src, dest, fs4) {
|
|
|
11928
12769
|
await fs4.rename(src, dest);
|
|
11929
12770
|
return;
|
|
11930
12771
|
} catch (error) {
|
|
11931
|
-
const code = _optionalChain([error, 'optionalAccess',
|
|
12772
|
+
const code = _optionalChain([error, 'optionalAccess', _303 => _303.code]);
|
|
11932
12773
|
if (code !== "EPERM" && code !== "EACCES" && code !== "EXDEV" && code !== "ENOTEMPTY") {
|
|
11933
12774
|
throw error;
|
|
11934
12775
|
}
|
|
@@ -11954,7 +12795,7 @@ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflo
|
|
|
11954
12795
|
try {
|
|
11955
12796
|
await moveVercelOutputPath(publicDir, staticDir, fs4);
|
|
11956
12797
|
} catch (error) {
|
|
11957
|
-
if (_optionalChain([error, 'optionalAccess',
|
|
12798
|
+
if (_optionalChain([error, 'optionalAccess', _304 => _304.code]) !== "ENOENT") throw error;
|
|
11958
12799
|
}
|
|
11959
12800
|
await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4);
|
|
11960
12801
|
await copyPrismaClientForVercel(root, nitroFuncDir, fs4);
|
|
@@ -11971,17 +12812,17 @@ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflo
|
|
|
11971
12812
|
presetRoutes: Array.isArray(vercelConfig.routes) ? vercelConfig.routes : [],
|
|
11972
12813
|
runtimeRoutes
|
|
11973
12814
|
});
|
|
11974
|
-
const vercelConfigWithWorkflowCrons =
|
|
12815
|
+
const vercelConfigWithWorkflowCrons = _chunkKCY52OUQcjs.applyFarmWorkflowVercelCrons.call(void 0,
|
|
11975
12816
|
vercelConfig,
|
|
11976
12817
|
farmWorkflows.workflows
|
|
11977
12818
|
);
|
|
11978
|
-
const vercelConfigWithCrons =
|
|
12819
|
+
const vercelConfigWithCrons = _chunkYAEN3L2Fcjs.applyFarmCronVercelCrons.call(void 0, vercelConfigWithWorkflowCrons, cronJobs);
|
|
11979
12820
|
await fs4.writeFile(configPath, JSON.stringify(vercelConfigWithCrons, null, 2));
|
|
11980
12821
|
_chunkQMNWKQL4cjs.logger.info("\u2705 Post-processed Vercel output for Build Output API v3");
|
|
11981
12822
|
}
|
|
11982
12823
|
async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4) {
|
|
11983
|
-
if (!_optionalChain([config, 'access',
|
|
11984
|
-
const [mainRoot, ...extraRoots] =
|
|
12824
|
+
if (!_optionalChain([config, 'access', _305 => _305.docs, 'optionalAccess', _306 => _306.enabled])) return;
|
|
12825
|
+
const [mainRoot, ...extraRoots] = _chunkPPX7UOFYcjs.getFarmDocsRoots.call(void 0, config.docs);
|
|
11985
12826
|
await copyFarmDocsRootContent(
|
|
11986
12827
|
mainRoot,
|
|
11987
12828
|
root,
|
|
@@ -12002,9 +12843,15 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4) {
|
|
|
12002
12843
|
async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs4) {
|
|
12003
12844
|
const docsContentDir = resolveBuildDocsContentDir(docs, root, srcDir);
|
|
12004
12845
|
if (!docsContentDir) return;
|
|
12005
|
-
const lastModifiedManifest =
|
|
12846
|
+
const lastModifiedManifest = _chunkPPX7UOFYcjs.createFarmDocsLastModifiedManifest.call(void 0, docsContentDir, {
|
|
12006
12847
|
fallback: "now"
|
|
12007
12848
|
});
|
|
12849
|
+
const undatedPages = _nullishCoalesce(_optionalChain([lastModifiedManifest, 'access', _307 => _307.unknown, 'optionalAccess', _308 => _308.length]), () => ( 0));
|
|
12850
|
+
if (undatedPages > 0) {
|
|
12851
|
+
_chunkQMNWKQL4cjs.logger.warn(
|
|
12852
|
+
`${undatedPages} docs page(s) were last changed before this shallow clone's Git history, so they show no "Last updated" date. Build from a full clone (git fetch --unshallow) or set lastModified in the page's frontmatter.`
|
|
12853
|
+
);
|
|
12854
|
+
}
|
|
12008
12855
|
await fs4.rm(bundledContentDir, { recursive: true, force: true });
|
|
12009
12856
|
await fs4.mkdir(_path2.default.dirname(bundledContentDir), { recursive: true });
|
|
12010
12857
|
await fs4.cp(docsContentDir, bundledContentDir, {
|
|
@@ -12012,7 +12859,7 @@ async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs
|
|
|
12012
12859
|
force: true
|
|
12013
12860
|
});
|
|
12014
12861
|
await fs4.writeFile(
|
|
12015
|
-
_path2.default.join(bundledContentDir,
|
|
12862
|
+
_path2.default.join(bundledContentDir, _chunkPPX7UOFYcjs.FARM_DOCS_LAST_MODIFIED_MANIFEST),
|
|
12016
12863
|
`${JSON.stringify(lastModifiedManifest, null, 2)}
|
|
12017
12864
|
`
|
|
12018
12865
|
);
|
|
@@ -12038,7 +12885,7 @@ async function stageSharpRuntime(config, root, distDir, fs4, preset) {
|
|
|
12038
12885
|
if (!resolvePackageJson(projectRequire, "sharp")) {
|
|
12039
12886
|
try {
|
|
12040
12887
|
sharpRequire = _module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core"));
|
|
12041
|
-
} catch (
|
|
12888
|
+
} catch (e35) {
|
|
12042
12889
|
}
|
|
12043
12890
|
}
|
|
12044
12891
|
const copiedPackages = /* @__PURE__ */ new Map();
|
|
@@ -12083,7 +12930,7 @@ async function stageSharpRuntime(config, root, distDir, fs4, preset) {
|
|
|
12083
12930
|
try {
|
|
12084
12931
|
await copyPackage("sharp", sharpRequire);
|
|
12085
12932
|
if (!copiedPackages.has("sharp")) {
|
|
12086
|
-
throw new Error(`Farm image optimization requires sharp. ${
|
|
12933
|
+
throw new Error(`Farm image optimization requires sharp. ${_chunkN5DQMOAGcjs.SHARP_INSTALL_HINT}`);
|
|
12087
12934
|
}
|
|
12088
12935
|
} catch (error) {
|
|
12089
12936
|
await fs4.rm(stageDir, { recursive: true, force: true });
|
|
@@ -12165,7 +13012,7 @@ function resolveMetadataImageRuntimePackageJson(root) {
|
|
|
12165
13012
|
if (packageJsonPath) return packageJsonPath;
|
|
12166
13013
|
try {
|
|
12167
13014
|
return resolvePackageJson(_module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core")), "@vercel/og");
|
|
12168
|
-
} catch (
|
|
13015
|
+
} catch (e36) {
|
|
12169
13016
|
return null;
|
|
12170
13017
|
}
|
|
12171
13018
|
}
|
|
@@ -12212,7 +13059,7 @@ function resolvePackageJson(parentRequire, packageName) {
|
|
|
12212
13059
|
const resolved = parentRequire.resolve(request);
|
|
12213
13060
|
if (resolved.endsWith(".json")) return resolved;
|
|
12214
13061
|
_nullishCoalesce(metadataModule, () => ( (metadataModule = resolved)));
|
|
12215
|
-
} catch (
|
|
13062
|
+
} catch (e37) {
|
|
12216
13063
|
}
|
|
12217
13064
|
}
|
|
12218
13065
|
try {
|
|
@@ -12223,13 +13070,13 @@ function resolvePackageJson(parentRequire, packageName) {
|
|
|
12223
13070
|
try {
|
|
12224
13071
|
const manifest = JSON.parse(_fs.readFileSync.call(void 0, candidate, "utf8"));
|
|
12225
13072
|
if (manifest.name === packageName) return candidate;
|
|
12226
|
-
} catch (
|
|
13073
|
+
} catch (e38) {
|
|
12227
13074
|
}
|
|
12228
13075
|
}
|
|
12229
13076
|
if (_path2.default.basename(directory) === "node_modules") break;
|
|
12230
13077
|
directory = _path2.default.dirname(directory);
|
|
12231
13078
|
}
|
|
12232
|
-
} catch (
|
|
13079
|
+
} catch (e39) {
|
|
12233
13080
|
}
|
|
12234
13081
|
return null;
|
|
12235
13082
|
}
|
|
@@ -12238,13 +13085,13 @@ async function copyPrismaClientForVercel(root, nitroFuncDir, fs4) {
|
|
|
12238
13085
|
let prismaClientDir;
|
|
12239
13086
|
try {
|
|
12240
13087
|
prismaClientDir = _path2.default.dirname(projectRequire.resolve("@prisma/client/default.js"));
|
|
12241
|
-
} catch (
|
|
13088
|
+
} catch (e40) {
|
|
12242
13089
|
return;
|
|
12243
13090
|
}
|
|
12244
13091
|
const generatedClientDir = _path2.default.join(prismaClientDir, "..", "..", ".prisma", "client");
|
|
12245
13092
|
try {
|
|
12246
13093
|
await fs4.access(generatedClientDir);
|
|
12247
|
-
} catch (
|
|
13094
|
+
} catch (e41) {
|
|
12248
13095
|
return;
|
|
12249
13096
|
}
|
|
12250
13097
|
const targetNodeModules = _path2.default.join(nitroFuncDir, "node_modules");
|
|
@@ -12304,7 +13151,7 @@ async function createFarmProjectModuleSsrEnvironment() {
|
|
|
12304
13151
|
// src/build/index.ts
|
|
12305
13152
|
async function build(config, options = {}) {
|
|
12306
13153
|
return _chunk4IHMHFQBcjs.withProductionNodeEnv.call(void 0,
|
|
12307
|
-
() =>
|
|
13154
|
+
() => _chunk4DRINDGNcjs.withPackageClientBoundaryCache.call(void 0, () => buildWithProductionNodeEnv(config, options))
|
|
12308
13155
|
);
|
|
12309
13156
|
}
|
|
12310
13157
|
function createBuildTargetBaseline(config) {
|
|
@@ -12315,7 +13162,7 @@ function createBuildTargetBaseline(config) {
|
|
|
12315
13162
|
preset,
|
|
12316
13163
|
distDir,
|
|
12317
13164
|
outputDir,
|
|
12318
|
-
outputWasDerived: outputDir ===
|
|
13165
|
+
outputWasDerived: outputDir === _chunk556H7JCEcjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
|
|
12319
13166
|
};
|
|
12320
13167
|
}
|
|
12321
13168
|
function resolveBuildTargets(config, options, baseline) {
|
|
@@ -12324,8 +13171,8 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
12324
13171
|
const distDir = config.distDir || ".farm";
|
|
12325
13172
|
const outputWasReplaced = config.deploy.outputDir !== baseline.outputDir;
|
|
12326
13173
|
const shouldRefreshDerivedOutput = baseline.outputWasDerived && !outputWasReplaced && (preset !== baseline.preset || distDir !== baseline.distDir);
|
|
12327
|
-
const deployTarget = preset === config.deploy.preset ? config.deploy.target :
|
|
12328
|
-
const outputDir = shouldRefreshDerivedOutput ?
|
|
13174
|
+
const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunk556H7JCEcjs.getDeployTargetForPreset.call(void 0, preset);
|
|
13175
|
+
const outputDir = shouldRefreshDerivedOutput ? _chunk556H7JCEcjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
|
|
12329
13176
|
return {
|
|
12330
13177
|
root,
|
|
12331
13178
|
preset,
|
|
@@ -12333,7 +13180,7 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
12333
13180
|
distDir,
|
|
12334
13181
|
deployTarget,
|
|
12335
13182
|
outputDir,
|
|
12336
|
-
deployOutputDir:
|
|
13183
|
+
deployOutputDir: _chunk556H7JCEcjs.resolveDeployOutputPath.call(void 0, root, outputDir)
|
|
12337
13184
|
};
|
|
12338
13185
|
}
|
|
12339
13186
|
async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
@@ -12341,7 +13188,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
12341
13188
|
const targetBaseline = createBuildTargetBaseline(config);
|
|
12342
13189
|
let targets;
|
|
12343
13190
|
const productionViteResultPromise = options.universal === false ? void 0 : Promise.allSettled([Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkMF3IA2AWcjs.loadFarmProductionVite.call(void 0, ))))]);
|
|
12344
|
-
const pluginManager = new (0,
|
|
13191
|
+
const pluginManager = new (0, _chunkWUTFJOV7cjs.PluginManager)({
|
|
12345
13192
|
config,
|
|
12346
13193
|
isDev: false,
|
|
12347
13194
|
isProd: true
|
|
@@ -12370,17 +13217,15 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
12370
13217
|
};
|
|
12371
13218
|
config = {
|
|
12372
13219
|
...config,
|
|
12373
|
-
images:
|
|
13220
|
+
images: _chunkN5DQMOAGcjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
|
|
12374
13221
|
root: targets.root,
|
|
12375
13222
|
preset: targets.preset
|
|
12376
13223
|
})
|
|
12377
13224
|
};
|
|
12378
|
-
if (_optionalChain([config, 'access',
|
|
13225
|
+
if (_optionalChain([config, 'access', _309 => _309.docs, 'optionalAccess', _310 => _310.enabled])) await _chunkV3UOEWCBcjs.loadFarmDocsEngine.call(void 0, );
|
|
12379
13226
|
pluginManager.updateContext({ config });
|
|
12380
13227
|
const { root, preset, srcDir, distDir, deployOutputDir } = targets;
|
|
12381
|
-
|
|
12382
|
-
_path2.default.resolve(root, distDir, "cache", "client-boundaries.json")
|
|
12383
|
-
);
|
|
13228
|
+
_chunk4DRINDGNcjs.usePackageClientBoundaryCacheFile.call(void 0, _chunk4DRINDGNcjs.resolvePackageClientBoundaryCacheFile.call(void 0, root, distDir));
|
|
12384
13229
|
_chunkQMNWKQL4cjs.logger.info(`\u{1F69C} Building Farm.js application with preset: ${preset}...`);
|
|
12385
13230
|
await pluginManager.setupPlugins();
|
|
12386
13231
|
await pluginManager.runHookParallel("beforeBundle", {
|
|
@@ -12392,8 +13237,8 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
12392
13237
|
});
|
|
12393
13238
|
_chunkQMNWKQL4cjs.logger.info("\u{1F50D} Discovering routes and API endpoints...");
|
|
12394
13239
|
const productionViteResult = productionViteResultPromise ? (await productionViteResultPromise)[0] : void 0;
|
|
12395
|
-
if (_optionalChain([productionViteResult, 'optionalAccess',
|
|
12396
|
-
const productionVite = _optionalChain([productionViteResult, 'optionalAccess',
|
|
13240
|
+
if (_optionalChain([productionViteResult, 'optionalAccess', _311 => _311.status]) === "rejected") throw productionViteResult.reason;
|
|
13241
|
+
const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _312 => _312.value]);
|
|
12397
13242
|
const createViteServer = productionVite ? productionVite.createServer : (await import("vite")).createServer;
|
|
12398
13243
|
projectModuleServer = await createProjectModuleServer(
|
|
12399
13244
|
createViteServer,
|
|
@@ -12401,18 +13246,18 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
12401
13246
|
root,
|
|
12402
13247
|
rendererBuild.signal
|
|
12403
13248
|
);
|
|
12404
|
-
const farmApp =
|
|
13249
|
+
const farmApp = _chunkN5DQMOAGcjs.createFarmApp.call(void 0, config, projectModuleServer);
|
|
12405
13250
|
await farmApp.initialize();
|
|
12406
13251
|
const routeManager = farmApp.getRouteManager();
|
|
12407
13252
|
const serverRenderer = farmApp.getServerRenderer();
|
|
12408
|
-
const typeArtifacts =
|
|
13253
|
+
const typeArtifacts = _chunkYVTS3S3Fcjs.generateFarmTypeArtifacts.call(void 0, {
|
|
12409
13254
|
root,
|
|
12410
13255
|
srcDir,
|
|
12411
13256
|
layers: config.layers,
|
|
12412
13257
|
plugins: config.plugins,
|
|
12413
13258
|
extraRoutes: [
|
|
12414
|
-
..._optionalChain([config, 'access',
|
|
12415
|
-
...
|
|
13259
|
+
..._optionalChain([config, 'access', _313 => _313.openapi, 'optionalAccess', _314 => _314.enabled]) && config.openapi.route ? [config.openapi.route] : [],
|
|
13260
|
+
..._chunkPPX7UOFYcjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
|
|
12416
13261
|
],
|
|
12417
13262
|
suppressLintOnLink: config.suppressLintOnLink,
|
|
12418
13263
|
componentExtensions: config.renderer.componentExtensions,
|
|
@@ -12421,7 +13266,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
12421
13266
|
const message = error instanceof Error ? error.message : String(error);
|
|
12422
13267
|
_chunkQMNWKQL4cjs.logger.warn(`Route type generation failed (farm.d.ts may be stale): ${message}`);
|
|
12423
13268
|
});
|
|
12424
|
-
const apiRouteManager = new (0,
|
|
13269
|
+
const apiRouteManager = new (0, _chunkOFBLGH6Vcjs.APIRouteManager)(
|
|
12425
13270
|
_chunk5Y2P454Ocjs.getFarmAppDirectories.call(void 0, config),
|
|
12426
13271
|
projectModuleServer,
|
|
12427
13272
|
{
|
|
@@ -12496,7 +13341,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
12496
13341
|
throw error;
|
|
12497
13342
|
} finally {
|
|
12498
13343
|
try {
|
|
12499
|
-
await _optionalChain([projectModuleServer, 'optionalAccess',
|
|
13344
|
+
await _optionalChain([projectModuleServer, 'optionalAccess', _315 => _315.close, 'call', _316 => _316()]);
|
|
12500
13345
|
} finally {
|
|
12501
13346
|
rendererBuild.abort();
|
|
12502
13347
|
}
|
|
@@ -12504,11 +13349,11 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
12504
13349
|
}
|
|
12505
13350
|
async function createProjectModuleServer(createViteServer, config, root, buildLifetime) {
|
|
12506
13351
|
const { farmServerOnlyEntriesPlugin } = await import("./vite.cjs");
|
|
12507
|
-
const rendererVitePlugins = await
|
|
13352
|
+
const rendererVitePlugins = await _chunk67MZTLTFcjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, root, {
|
|
12508
13353
|
ssr: true,
|
|
12509
13354
|
buildLifetime
|
|
12510
13355
|
});
|
|
12511
|
-
const viteConfig =
|
|
13356
|
+
const viteConfig = _chunkN5DQMOAGcjs.mergeFarmViteConfig.call(void 0,
|
|
12512
13357
|
{
|
|
12513
13358
|
root,
|
|
12514
13359
|
appType: "custom",
|
|
@@ -12520,12 +13365,12 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
12520
13365
|
},
|
|
12521
13366
|
plugins: [
|
|
12522
13367
|
...rendererVitePlugins,
|
|
12523
|
-
|
|
13368
|
+
_chunkN5DQMOAGcjs.farmFontImportsPlugin.call(void 0, {
|
|
12524
13369
|
root,
|
|
12525
13370
|
basePath: config.basePath,
|
|
12526
13371
|
publicDir: config.publicDir
|
|
12527
13372
|
}),
|
|
12528
|
-
|
|
13373
|
+
_chunk4DRINDGNcjs.farmEnvironmentFunctionsPlugin.call(void 0, ),
|
|
12529
13374
|
// Route modules load here at build time (rendering config, prerendering): `server-only`
|
|
12530
13375
|
// resolves as it does in the server build.
|
|
12531
13376
|
farmServerOnlyEntriesPlugin()
|
|
@@ -12535,7 +13380,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
12535
13380
|
hmr: false
|
|
12536
13381
|
},
|
|
12537
13382
|
resolve: {
|
|
12538
|
-
alias:
|
|
13383
|
+
alias: _chunkN5DQMOAGcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
12539
13384
|
dedupe: [...config.renderer.dedupe || []]
|
|
12540
13385
|
},
|
|
12541
13386
|
optimizeDeps: {
|
|
@@ -12568,10 +13413,10 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
12568
13413
|
noDiscovery: true
|
|
12569
13414
|
},
|
|
12570
13415
|
// An app or plugin that brings its own SSR environment keeps it.
|
|
12571
|
-
environments: _optionalChain([viteConfig, 'access',
|
|
13416
|
+
environments: _optionalChain([viteConfig, 'access', _317 => _317.environments, 'optionalAccess', _318 => _318.ssr, 'optionalAccess', _319 => _319.dev, 'optionalAccess', _320 => _320.createEnvironment]) ? viteConfig.environments : {
|
|
12572
13417
|
...viteConfig.environments,
|
|
12573
13418
|
ssr: {
|
|
12574
|
-
..._optionalChain([viteConfig, 'access',
|
|
13419
|
+
..._optionalChain([viteConfig, 'access', _321 => _321.environments, 'optionalAccess', _322 => _322.ssr]),
|
|
12575
13420
|
...await createFarmProjectModuleSsrEnvironment()
|
|
12576
13421
|
}
|
|
12577
13422
|
}
|
|
@@ -12579,7 +13424,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
12579
13424
|
}
|
|
12580
13425
|
async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
|
|
12581
13426
|
const { farmI18nClientBridgePlugin, farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.cjs");
|
|
12582
|
-
const { PluginManager: PluginManager2 } = await import("./plugin-
|
|
13427
|
+
const { PluginManager: PluginManager2 } = await import("./plugin-WIU4GDD4.cjs");
|
|
12583
13428
|
const pluginManager = new PluginManager2({
|
|
12584
13429
|
config,
|
|
12585
13430
|
isDev: false,
|
|
@@ -12599,14 +13444,14 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
|
|
|
12599
13444
|
farmI18nClientBridgePlugin(),
|
|
12600
13445
|
farmServerOnlyEntriesPlugin(),
|
|
12601
13446
|
farmPlugin(config, pluginManager),
|
|
12602
|
-
|
|
13447
|
+
_chunk4DRINDGNcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
|
|
12603
13448
|
],
|
|
12604
13449
|
mode: "production"
|
|
12605
13450
|
});
|
|
12606
13451
|
}
|
|
12607
13452
|
async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
|
|
12608
13453
|
const { farmI18nClientBridgePlugin, farmPlugin } = await import("./vite.cjs");
|
|
12609
|
-
const { PluginManager: PluginManager2 } = await import("./plugin-
|
|
13454
|
+
const { PluginManager: PluginManager2 } = await import("./plugin-WIU4GDD4.cjs");
|
|
12610
13455
|
const pluginManager = new PluginManager2({
|
|
12611
13456
|
config,
|
|
12612
13457
|
isDev: false,
|
|
@@ -12627,19 +13472,19 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
|
|
|
12627
13472
|
define: {
|
|
12628
13473
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
12629
13474
|
__FARM_ENV__: JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, config.env)),
|
|
12630
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
13475
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _323 => _323.env, 'optionalAccess', _324 => _324.public]) || {})
|
|
12631
13476
|
},
|
|
12632
13477
|
plugins: [
|
|
12633
13478
|
farmI18nClientBridgePlugin(),
|
|
12634
13479
|
farmPlugin(config, pluginManager),
|
|
12635
|
-
|
|
13480
|
+
_chunk4DRINDGNcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
|
|
12636
13481
|
],
|
|
12637
13482
|
mode: "production"
|
|
12638
13483
|
});
|
|
12639
13484
|
}
|
|
12640
13485
|
function resolveLegacyPageEntry(config, root, srcDir) {
|
|
12641
13486
|
const appDir = _path2.default.join(root, srcDir, "app");
|
|
12642
|
-
for (const extension of
|
|
13487
|
+
for (const extension of _chunk67MZTLTFcjs.getFarmRendererComponentExtensions.call(void 0, config.renderer)) {
|
|
12643
13488
|
const candidate = _path2.default.join(appDir, `page${extension}`);
|
|
12644
13489
|
if (_fs.existsSync.call(void 0, candidate)) return candidate;
|
|
12645
13490
|
}
|
|
@@ -12647,7 +13492,7 @@ function resolveLegacyPageEntry(config, root, srcDir) {
|
|
|
12647
13492
|
}
|
|
12648
13493
|
async function buildNitro(config, routeManager, apiRouteManager, serverRenderer, preset, root, distDir, pluginManager) {
|
|
12649
13494
|
const [{ createNitroConfig }, { createNitro, build: nitroBuild }] = await Promise.all([
|
|
12650
|
-
import("./nitro-
|
|
13495
|
+
import("./nitro-EEX2J3KB.cjs"),
|
|
12651
13496
|
import("nitro/builder")
|
|
12652
13497
|
]);
|
|
12653
13498
|
let nitroConfig = await createNitroConfig(
|
|
@@ -12660,7 +13505,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
12660
13505
|
if (pluginManager) {
|
|
12661
13506
|
nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
|
|
12662
13507
|
}
|
|
12663
|
-
const outputDir =
|
|
13508
|
+
const outputDir = _chunk556H7JCEcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
12664
13509
|
const serverOutputDir = _path2.default.join(outputDir, "server");
|
|
12665
13510
|
const publicOutputDir = _path2.default.join(outputDir, "public");
|
|
12666
13511
|
const { mkdir, cp } = await import("fs/promises");
|
|
@@ -12719,7 +13564,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
12719
13564
|
const { readFile } = await import("fs/promises");
|
|
12720
13565
|
const manifestContent = await readFile(clientManifestPath, "utf-8");
|
|
12721
13566
|
farmRegistry.clientManifest = JSON.parse(manifestContent);
|
|
12722
|
-
} catch (
|
|
13567
|
+
} catch (e42) {
|
|
12723
13568
|
farmRegistry.clientManifest = {};
|
|
12724
13569
|
}
|
|
12725
13570
|
} catch (error) {
|
|
@@ -12731,7 +13576,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
12731
13576
|
root,
|
|
12732
13577
|
preset,
|
|
12733
13578
|
distDir,
|
|
12734
|
-
outputDir:
|
|
13579
|
+
outputDir: _chunk556H7JCEcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
|
|
12735
13580
|
});
|
|
12736
13581
|
}
|
|
12737
13582
|
}
|