@farm.js/core 0.1.51-beta.2 → 0.1.60
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-WWCC4GLG.mjs → agent-mcp-handler-7QMX2LUY.mjs} +7 -7
- package/dist/agent-mcp-handler-OV4WRFBL.cjs +18 -0
- package/dist/{agent-mcp.d-Z5DuwrqW.d.mts → agent-mcp.d-C-2S9bnP.d.mts} +1 -1
- package/dist/{agent-mcp.d-CR5Ov83o.d.ts → agent-mcp.d-SIoCUP1I.d.ts} +1 -1
- package/dist/agent-runtime.cjs +5 -5
- package/dist/agent-runtime.d.mts +2 -2
- package/dist/agent-runtime.d.ts +2 -2
- package/dist/agent-runtime.mjs +4 -4
- package/dist/{analyzer-Z6TNEAET.mjs → analyzer-22BEYV7S.mjs} +126 -12
- package/dist/{analyzer-T76CN3S7.cjs → analyzer-LCSI3NSH.cjs} +132 -18
- package/dist/api/client.cjs +5 -4
- package/dist/api/client.d.mts +1 -1
- package/dist/api/client.d.ts +1 -1
- package/dist/api/client.mjs +3 -2
- package/dist/api/client.native.cjs +45 -0
- package/dist/api/client.native.d.mts +23 -0
- package/dist/api/client.native.d.ts +23 -0
- package/dist/api/client.native.mjs +45 -0
- package/dist/api/route-manager.cjs +7 -7
- package/dist/api/route-manager.d.mts +4 -4
- package/dist/api/route-manager.d.ts +4 -4
- package/dist/api/route-manager.mjs +6 -6
- package/dist/api/runtime.cjs +5 -5
- package/dist/api/runtime.d.mts +3 -3
- package/dist/api/runtime.d.ts +3 -3
- package/dist/api/runtime.mjs +4 -4
- package/dist/{api-client.d-CeA6tNA6.d.mts → api-client.d-BNLXNCXJ.d.mts} +1 -1
- package/dist/{api-client.d-BWcqZciH.d.ts → api-client.d-ddQBNGtu.d.ts} +1 -1
- package/dist/api.cjs +11 -11
- package/dist/api.d.mts +5 -5
- package/dist/api.d.ts +5 -5
- package/dist/api.mjs +10 -10
- package/dist/{app-manifest.d-CAHkOBFa.d.mts → app-manifest.d-DrSAHskY.d.mts} +1 -1
- package/dist/{app-manifest.d-DiWr_Jfx.d.ts → app-manifest.d-Tb3CJpL4.d.ts} +1 -1
- package/dist/app-markdown.cjs +7 -7
- package/dist/app-markdown.d.mts +3 -3
- package/dist/app-markdown.d.ts +3 -3
- package/dist/app-markdown.mjs +6 -6
- package/dist/{app.d-DmapqkbV.d.ts → app.d-CmWlYpZJ.d.ts} +9 -4
- package/dist/{app.d-BfgJCsTQ.d.mts → app.d-D6QQM_kk.d.mts} +9 -4
- package/dist/{chunk-SN5VSO3Q.mjs → chunk-25T5VXOE.mjs} +7 -9
- package/dist/{chunk-GUJTVM36.cjs → chunk-2FRLSDBT.cjs} +1 -1
- package/dist/{chunk-LM2YOGDK.mjs → chunk-2I6PUKWJ.mjs} +1 -1
- package/dist/{chunk-EIMK7D2D.mjs → chunk-2KTYMMWT.mjs} +34 -4
- package/dist/{chunk-B5BBTPJQ.cjs → chunk-2OF5RPVU.cjs} +14 -14
- package/dist/chunk-37PYUEK5.mjs +533 -0
- package/dist/chunk-3HLQTOVU.cjs +6 -0
- package/dist/{chunk-VSLM6BHX.cjs → chunk-3OJNNCDL.cjs} +9 -9
- package/dist/{chunk-X3JNB2TB.mjs → chunk-3PX4AIXO.mjs} +36 -5
- package/dist/{chunk-UQHIWZZ6.cjs → chunk-3TL3AH25.cjs} +12 -6
- package/dist/chunk-3YMLUNL2.cjs +251 -0
- package/dist/chunk-4JTQPOKO.cjs +137 -0
- package/dist/{chunk-QXPSWMUD.cjs → chunk-4P23B7DU.cjs} +5 -5
- package/dist/{chunk-YVJV7Q2X.mjs → chunk-55U5QIXQ.mjs} +1 -1
- package/dist/{chunk-5N7QAGEA.cjs → chunk-5JNUYGNF.cjs} +37 -7
- package/dist/{chunk-NJLTQR5P.cjs → chunk-6BJJYOFL.cjs} +7 -7
- package/dist/chunk-6UUH4N4J.mjs +251 -0
- package/dist/{chunk-2NHOYYUT.mjs → chunk-7H45IJWO.mjs} +2 -2
- package/dist/{chunk-NN3MOPSI.mjs → chunk-A2MN5PQJ.mjs} +7 -7
- package/dist/{chunk-KY32FWK7.mjs → chunk-BHJAYPYU.mjs} +2 -2
- package/dist/{chunk-VAHBCI6X.mjs → chunk-BQWBHWEW.mjs} +26 -1
- package/dist/{chunk-KJMWAUKE.mjs → chunk-C7GJDVN4.mjs} +1 -1
- package/dist/{chunk-OYNNA4DD.cjs → chunk-CBKRS3M4.cjs} +9 -9
- package/dist/{chunk-I2DQGS56.cjs → chunk-CBOEJ5Z4.cjs} +39 -41
- package/dist/{chunk-BOVGCUDZ.cjs → chunk-CI4UNQHO.cjs} +2 -2
- package/dist/{chunk-S5AQ7CAC.cjs → chunk-CNNBFGL5.cjs} +39 -14
- package/dist/chunk-D2X5MUF5.cjs +1457 -0
- package/dist/{chunk-LEIXUFJN.cjs → chunk-D4MRNBVF.cjs} +10 -9
- package/dist/{chunk-2KVDHNQS.mjs → chunk-D7LTCK3U.mjs} +2 -2
- package/dist/{chunk-J3LBO2O4.cjs → chunk-DPJ66FSI.cjs} +22 -22
- package/dist/{chunk-NYQSC4DX.cjs → chunk-DZPR2W6U.cjs} +5 -5
- package/dist/{chunk-GW4YUIHW.mjs → chunk-E72UD6ME.mjs} +1 -1
- package/dist/chunk-EFZGB7JC.cjs +114 -0
- package/dist/{chunk-XXXRRVY6.mjs → chunk-EGVC4LIG.mjs} +5 -5
- package/dist/{chunk-72NBDVWQ.mjs → chunk-EXUONJYV.mjs} +3 -3
- package/dist/{chunk-VS7EHLLW.mjs → chunk-EZ34EHQP.mjs} +1 -1
- package/dist/{chunk-FM2UEKS2.mjs → chunk-F6Y7ZAPQ.mjs} +2 -2
- package/dist/{chunk-LMFJCXDD.mjs → chunk-FN5UEC7I.mjs} +1 -1
- package/dist/{chunk-E6LTONL4.mjs → chunk-FORSVMEJ.mjs} +2 -2
- package/dist/{chunk-6CYQQQGR.mjs → chunk-HPWB57PZ.mjs} +1 -1
- package/dist/{chunk-Y2G5SJFB.mjs → chunk-IFHPDLIS.mjs} +1 -1
- package/dist/{chunk-GNJIYJMS.cjs → chunk-IFXSBJPN.cjs} +16 -16
- package/dist/{chunk-74Z5KX4A.mjs → chunk-ILMTRGBG.mjs} +309 -56
- package/dist/{chunk-NXBHYO7S.cjs → chunk-JBK7UJOI.cjs} +14 -11
- package/dist/chunk-JI5D7MXY.mjs +137 -0
- package/dist/{chunk-QXJADAQB.cjs → chunk-JIBEFLQ7.cjs} +6 -2
- package/dist/{chunk-LZ4SB57H.mjs → chunk-JPIUGDK4.mjs} +1 -1
- package/dist/{chunk-Y3N5BFRJ.mjs → chunk-JSDV2NUN.mjs} +1 -1
- package/dist/{chunk-IRSS4HS4.mjs → chunk-K3RU5MOR.mjs} +1 -1
- package/dist/chunk-KPOMS5RO.cjs +237 -0
- package/dist/{chunk-LAZK6UV7.mjs → chunk-KVW2M6PI.mjs} +1 -1
- package/dist/{chunk-5IONBVJY.cjs → chunk-LB3DPQP6.cjs} +22 -22
- package/dist/{chunk-CZ35L6PL.mjs → chunk-LJVNMGE3.mjs} +10 -4
- package/dist/chunk-LLZSYFOM.mjs +6 -0
- package/dist/{chunk-X2AMN2WV.cjs → chunk-LQNW3ABP.cjs} +10 -10
- package/dist/{chunk-6ONBZGVH.cjs → chunk-LRB5OVRT.cjs} +3 -3
- package/dist/{chunk-WJFFPXCV.cjs → chunk-LT4VAF5Z.cjs} +12 -10
- package/dist/{chunk-F6TLUMH7.mjs → chunk-M53MIIXY.mjs} +1 -1
- package/dist/{chunk-HIFIG6HL.cjs → chunk-MEQN6DDA.cjs} +5 -5
- package/dist/{chunk-XLRLSTJ6.cjs → chunk-MGKW5XZE.cjs} +7 -7
- package/dist/{chunk-B3GZAQSC.cjs → chunk-MHLNWRCJ.cjs} +3 -3
- package/dist/{chunk-5ENW27SL.mjs → chunk-MMK4MZUN.mjs} +1 -1
- package/dist/{chunk-DTU4PX7V.cjs → chunk-MTWXOEI4.cjs} +927 -629
- package/dist/chunk-NHD7BAKD.mjs +1457 -0
- package/dist/{chunk-NPQLMP7M.cjs → chunk-NQJDO7K7.cjs} +32 -31
- package/dist/{chunk-76GHW3WI.cjs → chunk-O27PLNQZ.cjs} +10 -10
- package/dist/{chunk-PIHKO25G.mjs → chunk-OM7WILES.mjs} +1 -1
- package/dist/{chunk-7UPCJDB5.mjs → chunk-PCXIJKPM.mjs} +8 -8
- package/dist/{chunk-IWFV5ZED.cjs → chunk-PMJSG4JS.cjs} +1 -1
- package/dist/{chunk-JATTVAHA.cjs → chunk-PRFNLQSP.cjs} +4 -4
- package/dist/{chunk-SBABQKPT.cjs → chunk-QAS7KE7J.cjs} +7 -7
- package/dist/chunk-QGOZLGVP.mjs +0 -0
- package/dist/{chunk-VQJYGZNX.cjs → chunk-QMNWKQL4.cjs} +1 -1
- package/dist/{chunk-XB24LZWI.cjs → chunk-QRX4JRBO.cjs} +3 -3
- package/dist/{chunk-LNM57D3H.cjs → chunk-R53QDV6T.cjs} +4 -4
- package/dist/{chunk-SUV6YO4Q.cjs → chunk-RAWWCDCT.cjs} +5 -5
- package/dist/{chunk-LJDIFIJ2.mjs → chunk-RPUJHJHE.mjs} +4 -4
- package/dist/{chunk-G2KTRMWA.mjs → chunk-RSEAX5MW.mjs} +4 -0
- package/dist/chunk-SJRCWF4Z.mjs +237 -0
- package/dist/{chunk-IBSAYAWB.mjs → chunk-SX7EECTS.mjs} +8 -5
- package/dist/{chunk-KBRZAYI7.mjs → chunk-T4TBK5NY.mjs} +2 -2
- package/dist/{chunk-4SSRBCBR.mjs → chunk-T7I62A4C.mjs} +619 -321
- package/dist/{chunk-E36C43IX.cjs → chunk-U4BJKNIR.cjs} +6 -6
- package/dist/{chunk-YU42A5MA.cjs → chunk-UDJY2ZGY.cjs} +533 -280
- package/dist/{chunk-SHS6KXOZ.mjs → chunk-UR25Z5Z6.mjs} +1 -1
- package/dist/{chunk-WZW6LEHM.cjs → chunk-UYSTTPYJ.cjs} +1590 -1019
- package/dist/{chunk-KRRZJ77U.mjs → chunk-UZZ6IEQP.mjs} +3 -3
- package/dist/{chunk-EKJYE4Y7.cjs → chunk-VGG74PSU.cjs} +25 -25
- package/dist/{chunk-CTM4SPB3.mjs → chunk-VPTWKOCY.mjs} +20 -19
- package/dist/{chunk-UN6N623E.mjs → chunk-VQJHT2ND.mjs} +2 -2
- package/dist/{chunk-SJ23LJ3N.cjs → chunk-VVTJTMGQ.cjs} +3 -3
- package/dist/{chunk-KHXAJ2KA.cjs → chunk-W2RZ73IU.cjs} +12 -12
- package/dist/{chunk-JWI5PUO2.mjs → chunk-W2ZXMMHA.mjs} +2 -1
- package/dist/{chunk-BLD5GVCG.mjs → chunk-W6QLRQ3V.mjs} +1 -1
- package/dist/{chunk-AV26KHTG.mjs → chunk-X2CZTWQA.mjs} +2 -2
- package/dist/chunk-XPIPMWY3.cjs +1 -0
- package/dist/chunk-XTG73QZA.cjs +533 -0
- package/dist/{chunk-XPMC4E2G.cjs → chunk-XVSBALOY.cjs} +3 -3
- package/dist/{chunk-XYL4HSVC.cjs → chunk-YI6FKTTN.cjs} +38 -7
- package/dist/{chunk-N77JBPLC.mjs → chunk-YSXTNSXS.mjs} +10 -8
- package/dist/{chunk-EHB77D5U.cjs → chunk-ZDAEHG2O.cjs} +3 -3
- package/dist/{chunk-PMKUU273.mjs → chunk-ZFUKPWFC.mjs} +1226 -655
- package/dist/{chunk-E73PGHSR.mjs → chunk-ZMHAFH4R.mjs} +8 -8
- package/dist/{chunk-ZOWNWHK6.cjs → chunk-ZNH6NR3H.cjs} +2 -2
- package/dist/chunk-ZNXTU4YH.mjs +114 -0
- package/dist/{chunk-PFV2KPDZ.cjs → chunk-ZOYKJBP5.cjs} +3 -3
- package/dist/{chunk-CECUDGXQ.cjs → chunk-ZP32GNJQ.cjs} +13 -13
- package/dist/{chunk-72D2NX77.mjs → chunk-ZZ2QKCKW.mjs} +1 -1
- package/dist/{client-plugins.d-Bx3FXpqm.d.mts → client-plugins.d-CgQQ-EAv.d.mts} +25 -4
- package/dist/{client-plugins.d-TiLbS5j4.d.ts → client-plugins.d-vXrbcfJ1.d.ts} +25 -4
- package/dist/client-plugins.d.mts +2 -2
- package/dist/client-plugins.d.ts +2 -2
- package/dist/client.cjs +9 -9
- package/dist/client.d.mts +9 -9
- package/dist/client.d.ts +9 -9
- package/dist/client.mjs +9 -9
- package/dist/{config.d-iRPI16ku.d.mts → config.d-DqZkLwef.d.mts} +146 -1
- package/dist/{config.d-iRPI16ku.d.ts → config.d-DqZkLwef.d.ts} +146 -1
- package/dist/config.d.mts +2 -2
- package/dist/config.d.ts +2 -2
- package/dist/cron.cjs +3 -3
- package/dist/cron.d.mts +10 -0
- package/dist/cron.d.ts +10 -0
- package/dist/cron.mjs +2 -2
- package/dist/desktop.d.mts +3 -3
- package/dist/desktop.d.ts +3 -3
- package/dist/{devtools-UQLDAOEI.mjs → devtools-KQZ6SRCJ.mjs} +16 -16
- package/dist/{devtools-6XWCZIGO.cjs → devtools-UF6JYHUN.cjs} +18 -18
- package/dist/docs.cjs +19 -19
- package/dist/docs.d.mts +3 -3
- package/dist/docs.d.ts +3 -3
- package/dist/docs.mjs +18 -18
- package/dist/index.cjs +99 -95
- package/dist/{index.d-yueUNipJ.d.ts → index.d-DlCELfhf.d.ts} +1 -1
- package/dist/{index.d-YxJ2AiDF.d.mts → index.d-Dmfb7Kb_.d.mts} +1 -1
- package/dist/index.d.mts +18 -18
- package/dist/index.d.ts +18 -18
- package/dist/index.mjs +139 -135
- package/dist/integrations.cjs +5 -5
- package/dist/integrations.d.mts +2 -2
- package/dist/integrations.d.ts +2 -2
- package/dist/integrations.mjs +4 -4
- package/dist/internal/app-markdown-runtime.cjs +6 -6
- package/dist/internal/app-markdown-runtime.d.mts +3 -3
- package/dist/internal/app-markdown-runtime.d.ts +3 -3
- package/dist/internal/app-markdown-runtime.mjs +5 -5
- package/dist/internal/build-runtime.cjs +52 -50
- package/dist/internal/build-runtime.d.mts +4 -4
- package/dist/internal/build-runtime.d.ts +4 -4
- package/dist/internal/build-runtime.mjs +51 -49
- package/dist/internal/cli-runtime.cjs +28 -28
- package/dist/internal/cli-runtime.mjs +28 -28
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.cjs +20 -15
- package/dist/internal/client-runtime.d.mts +5 -5
- package/dist/internal/client-runtime.d.ts +5 -5
- package/dist/internal/client-runtime.mjs +8 -3
- package/dist/internal/compression-runtime.d.mts +2 -2
- package/dist/internal/compression-runtime.d.ts +2 -2
- package/dist/internal/config-runtime.cjs +18 -18
- package/dist/internal/config-runtime.d.mts +119 -7
- package/dist/internal/config-runtime.d.ts +119 -7
- package/dist/internal/config-runtime.mjs +17 -17
- package/dist/internal/infra-analytics-runtime.cjs +11 -11
- package/dist/internal/infra-analytics-runtime.mjs +9 -9
- package/dist/internal/islands-boot.cjs +211 -0
- package/dist/internal/islands-boot.d.mts +8 -0
- package/dist/internal/islands-boot.d.ts +8 -0
- package/dist/internal/islands-boot.mjs +211 -0
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +42 -28
- package/dist/internal/production-runtime.d.mts +50 -12
- package/dist/internal/production-runtime.d.ts +50 -12
- package/dist/internal/production-runtime.mjs +52 -38
- package/dist/markdown.cjs +7 -5
- package/dist/markdown.d.mts +2 -2
- package/dist/markdown.d.ts +2 -2
- package/dist/markdown.mjs +6 -4
- package/dist/middleware.cjs +10 -10
- package/dist/middleware.d.mts +4 -4
- package/dist/middleware.d.ts +4 -4
- package/dist/middleware.mjs +9 -9
- package/dist/mobile.d.mts +43 -5
- package/dist/mobile.d.ts +43 -5
- package/dist/modules-VHD7BELU.mjs +13 -0
- package/dist/modules-WT5D3AWY.cjs +13 -0
- package/dist/native-specs-BD7HOTMJ.mjs +15 -0
- package/dist/native-specs-IQQRJOOW.cjs +15 -0
- package/dist/native-tree-6G5O53O3.cjs +27 -0
- package/dist/native-tree-VWNW2MQ2.mjs +27 -0
- package/dist/native.cjs +87 -0
- package/dist/native.d.mts +72 -0
- package/dist/native.d.ts +72 -0
- package/dist/native.mjs +87 -0
- package/dist/{navigation-delegate.d-HnDXhlyP.d.mts → navigation-delegate.d-CnOTWOyi.d.mts} +1 -1
- package/dist/{navigation-delegate.d-BY1e_Xrh.d.ts → navigation-delegate.d-JXx40JzR.d.ts} +1 -1
- package/dist/navigation.cjs +5 -5
- package/dist/navigation.d.mts +5 -5
- package/dist/navigation.d.ts +5 -5
- package/dist/navigation.mjs +4 -4
- package/dist/{nitro-R444AF3O.mjs → nitro-FLN6DRGJ.mjs} +7 -7
- package/dist/{nitro-CK7M4RMY.cjs → nitro-HXAZZQKY.cjs} +12 -12
- package/dist/plugin.cjs +43 -42
- package/dist/plugin.d.mts +5 -4
- package/dist/plugin.d.ts +5 -4
- package/dist/plugin.mjs +42 -41
- package/dist/port-C6GBH4C6.cjs +419 -0
- package/dist/port-WOOQ3V56.mjs +419 -0
- package/dist/{production-runtime.d-BpJUDzP8.d.mts → production-runtime.d-CP5s6RuY.d.mts} +1 -1
- package/dist/{production-runtime.d-lMjvE9cf.d.ts → production-runtime.d-N-cE3pmy.d.ts} +1 -1
- package/dist/{programmatic-routes-client.d-BlFp5hv4.d.ts → programmatic-routes-client.d-CLG2N1yH.d.ts} +2 -2
- package/dist/{programmatic-routes-client.d-6CGQ3TCk.d.mts → programmatic-routes-client.d-CPbNqtIi.d.mts} +2 -2
- package/dist/query/client.cjs +6 -6
- package/dist/query/client.mjs +2 -2
- package/dist/{render-plan.d-DhP0mTHF.d.ts → render-plan.d-B9lAP3uX.d.ts} +1 -1
- package/dist/{render-plan.d-BH9edqKs.d.mts → render-plan.d-DZ-qjjdG.d.mts} +1 -1
- package/dist/renderer/react/server.cjs +2 -2
- package/dist/renderer/react/server.mjs +3 -3
- package/dist/renderer-client.cjs +6 -6
- package/dist/renderer-client.d.mts +5 -5
- package/dist/renderer-client.d.ts +5 -5
- package/dist/renderer-client.mjs +2 -2
- package/dist/{request.d-BVZrsR1v.d.ts → request.d-BiicaNxb.d.ts} +1 -1
- package/dist/{request.d-DJFRdKi8.d.mts → request.d-DV0oeUit.d.mts} +1 -1
- package/dist/request.d.mts +3 -3
- package/dist/request.d.ts +3 -3
- package/dist/{route-rendering.d-Bpmw7PED.d.mts → route-rendering.d-BrIKA51A.d.mts} +1 -1
- package/dist/{route-rendering.d-B00JtK_-.d.ts → route-rendering.d-Iss0C7GR.d.ts} +1 -1
- package/dist/{router.d-Bd1x9XxQ.d.ts → router.d-DjGn_al7.d.ts} +1 -1
- package/dist/{router.d-e0jQ3jQ-.d.mts → router.d-mNTbOGV_.d.mts} +1 -1
- package/dist/{routes.d-D96Dq9lz.d.ts → routes.d-BKSjHuH9.d.ts} +27 -4
- package/dist/{routes.d-Cmv8TgVq.d.mts → routes.d-qd8Qf4LG.d.mts} +27 -4
- package/dist/routes.d.mts +2 -2
- package/dist/routes.d.ts +2 -2
- package/dist/{rsc-pipeline-DX4OC5FN.cjs → rsc-pipeline-SVLBTY7H.cjs} +21 -21
- package/dist/{rsc-pipeline-ZQ4CTVEG.mjs → rsc-pipeline-WBLBDQXA.mjs} +20 -20
- package/dist/{runtime-NQ3EDSA7.cjs → runtime-DGUOWSMF.cjs} +307 -48
- package/dist/{runtime-NPDRDV6R.mjs → runtime-HFZTVNFF.mjs} +298 -39
- package/dist/{runtime.d-CgB3IJDq.d.mts → runtime.d-BNVbojF1.d.mts} +1 -1
- package/dist/{runtime.d-D-td-RR3.d.ts → runtime.d-Bm_4hP5T.d.ts} +1 -1
- package/dist/{schema-dev-notice-F6QYSOAI.mjs → schema-dev-notice-JMXEQWIQ.mjs} +3 -3
- package/dist/{schema-dev-notice-UU7DMZEU.cjs → schema-dev-notice-PLBFDTOF.cjs} +6 -6
- package/dist/server-fn-client.d.mts +1 -1
- package/dist/server-fn-client.d.ts +1 -1
- package/dist/server-plugins.cjs +1 -1
- package/dist/server-plugins.d.mts +3 -3
- package/dist/server-plugins.d.ts +3 -3
- package/dist/server-plugins.mjs +1 -1
- package/dist/server.cjs +82 -81
- package/dist/server.d.mts +12 -11
- package/dist/server.d.ts +12 -11
- package/dist/server.mjs +65 -64
- package/dist/session-2Q72D4QV.cjs +23 -0
- package/dist/{session-IGEDQ5PY.mjs → session-QZXZOPR2.mjs} +2 -2
- package/dist/shell-render.d-CG6bPiiA.d.mts +41 -0
- package/dist/shell-render.d-CG6bPiiA.d.ts +41 -0
- package/dist/{spa-router.d-CO01mVOM.d.ts → spa-router.d-DAtnNoBe.d.ts} +11 -2
- package/dist/{spa-router.d-BWDhS0FK.d.mts → spa-router.d-DHDoXxDE.d.mts} +11 -2
- package/dist/testing.cjs +7 -7
- package/dist/testing.d.mts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/testing.mjs +6 -6
- package/dist/{utils.d-B77__yh8.d.ts → utils.d-DwZ-KLSB.d.ts} +7 -1
- package/dist/{utils.d-DRDazhCA.d.mts → utils.d-uKZcKJk4.d.mts} +7 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +43 -42
- package/dist/vite.d.mts +17 -6
- package/dist/vite.d.ts +17 -6
- package/dist/vite.mjs +42 -41
- package/dist/workflows.cjs +3 -3
- package/dist/workflows.mjs +2 -2
- package/package.json +17 -3
- package/dist/agent-mcp-handler-RT3COCEL.cjs +0 -18
- package/dist/session-AAU7RNRO.cjs +0 -23
- package/dist/{chunk-7FVVQEVL.cjs → chunk-4BS3HSY7.cjs} +2 -2
- package/dist/{chunk-N7JQXQAV.cjs → chunk-5OJVKXFV.cjs} +2 -2
- package/dist/{chunk-WSDKXV4E.mjs → chunk-72KABRWN.mjs} +4 -4
- package/dist/{chunk-C3BOESDW.mjs → chunk-B4CWYGCG.mjs} +3 -3
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkEFZGB7JCcjs = require('./chunk-EFZGB7JC.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
3
12
|
var _chunkMF3IA2AWcjs = require('./chunk-MF3IA2AW.cjs');
|
|
4
13
|
|
|
5
14
|
|
|
@@ -15,14 +24,14 @@ var _chunkVZY7MAVScjs = require('./chunk-VZY7MAVS.cjs');
|
|
|
15
24
|
var _chunkVM57CK74cjs = require('./chunk-VM57CK74.cjs');
|
|
16
25
|
|
|
17
26
|
|
|
18
|
-
var
|
|
27
|
+
var _chunk4BS3HSY7cjs = require('./chunk-4BS3HSY7.cjs');
|
|
19
28
|
|
|
20
29
|
|
|
21
30
|
|
|
22
31
|
|
|
23
32
|
|
|
24
33
|
|
|
25
|
-
var
|
|
34
|
+
var _chunkIFXSBJPNcjs = require('./chunk-IFXSBJPN.cjs');
|
|
26
35
|
|
|
27
36
|
|
|
28
37
|
|
|
@@ -34,7 +43,7 @@ var _chunkGNJIYJMScjs = require('./chunk-GNJIYJMS.cjs');
|
|
|
34
43
|
|
|
35
44
|
|
|
36
45
|
|
|
37
|
-
var
|
|
46
|
+
var _chunk5JNUYGNFcjs = require('./chunk-5JNUYGNF.cjs');
|
|
38
47
|
|
|
39
48
|
|
|
40
49
|
|
|
@@ -42,7 +51,16 @@ var _chunk5N7QAGEAcjs = require('./chunk-5N7QAGEA.cjs');
|
|
|
42
51
|
var _chunkDZZHTMWMcjs = require('./chunk-DZZHTMWM.cjs');
|
|
43
52
|
|
|
44
53
|
|
|
45
|
-
var
|
|
54
|
+
var _chunk4P23B7DUcjs = require('./chunk-4P23B7DU.cjs');
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
var _chunkV3UOEWCBcjs = require('./chunk-V3UOEWCB.cjs');
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
var _chunkNQJDO7K7cjs = require('./chunk-NQJDO7K7.cjs');
|
|
46
64
|
|
|
47
65
|
|
|
48
66
|
var _chunkBRWIVOV4cjs = require('./chunk-BRWIVOV4.cjs');
|
|
@@ -51,13 +69,11 @@ var _chunkBRWIVOV4cjs = require('./chunk-BRWIVOV4.cjs');
|
|
|
51
69
|
var _chunkOCS3PSYRcjs = require('./chunk-OCS3PSYR.cjs');
|
|
52
70
|
|
|
53
71
|
|
|
54
|
-
var _chunkV3UOEWCBcjs = require('./chunk-V3UOEWCB.cjs');
|
|
55
72
|
|
|
56
73
|
|
|
57
74
|
|
|
58
75
|
|
|
59
76
|
|
|
60
|
-
var _chunkNPQLMP7Mcjs = require('./chunk-NPQLMP7M.cjs');
|
|
61
77
|
|
|
62
78
|
|
|
63
79
|
|
|
@@ -88,11 +104,10 @@ var _chunkNPQLMP7Mcjs = require('./chunk-NPQLMP7M.cjs');
|
|
|
88
104
|
|
|
89
105
|
|
|
90
106
|
|
|
107
|
+
var _chunkUYSTTPYJcjs = require('./chunk-UYSTTPYJ.cjs');
|
|
91
108
|
|
|
92
|
-
var _chunkWZW6LEHMcjs = require('./chunk-WZW6LEHM.cjs');
|
|
93
109
|
|
|
94
|
-
|
|
95
|
-
var _chunkLNM57D3Hcjs = require('./chunk-LNM57D3H.cjs');
|
|
110
|
+
var _chunkR53QDV6Tcjs = require('./chunk-R53QDV6T.cjs');
|
|
96
111
|
|
|
97
112
|
|
|
98
113
|
var _chunk3EEET2Q5cjs = require('./chunk-3EEET2Q5.cjs');
|
|
@@ -100,7 +115,8 @@ var _chunk3EEET2Q5cjs = require('./chunk-3EEET2Q5.cjs');
|
|
|
100
115
|
|
|
101
116
|
|
|
102
117
|
|
|
103
|
-
var
|
|
118
|
+
var _chunk3TL3AH25cjs = require('./chunk-3TL3AH25.cjs');
|
|
119
|
+
|
|
104
120
|
|
|
105
121
|
|
|
106
122
|
|
|
@@ -112,8 +128,10 @@ var _chunkUQHIWZZ6cjs = require('./chunk-UQHIWZZ6.cjs');
|
|
|
112
128
|
|
|
113
129
|
|
|
114
130
|
|
|
131
|
+
var _chunkO27PLNQZcjs = require('./chunk-O27PLNQZ.cjs');
|
|
115
132
|
|
|
116
|
-
|
|
133
|
+
|
|
134
|
+
var _chunk3HLQTOVUcjs = require('./chunk-3HLQTOVU.cjs');
|
|
117
135
|
|
|
118
136
|
|
|
119
137
|
var _chunk47JV57DAcjs = require('./chunk-47JV57DA.cjs');
|
|
@@ -127,20 +145,17 @@ var _chunkSGBNF56Scjs = require('./chunk-SGBNF56S.cjs');
|
|
|
127
145
|
|
|
128
146
|
|
|
129
147
|
|
|
130
|
-
var
|
|
148
|
+
var _chunkDPJ66FSIcjs = require('./chunk-DPJ66FSI.cjs');
|
|
131
149
|
|
|
132
150
|
|
|
133
151
|
|
|
134
152
|
|
|
135
|
-
var
|
|
153
|
+
var _chunkQAS7KE7Jcjs = require('./chunk-QAS7KE7J.cjs');
|
|
136
154
|
|
|
137
155
|
|
|
138
156
|
var _chunkNK2VWS7Pcjs = require('./chunk-NK2VWS7P.cjs');
|
|
139
157
|
|
|
140
158
|
|
|
141
|
-
var _chunkJATTVAHAcjs = require('./chunk-JATTVAHA.cjs');
|
|
142
|
-
|
|
143
|
-
|
|
144
159
|
|
|
145
160
|
var _chunkSM2SYWARcjs = require('./chunk-SM2SYWAR.cjs');
|
|
146
161
|
|
|
@@ -168,48 +183,51 @@ var _chunkRD623KW4cjs = require('./chunk-RD623KW4.cjs');
|
|
|
168
183
|
var _chunk6JHZPB52cjs = require('./chunk-6JHZPB52.cjs');
|
|
169
184
|
|
|
170
185
|
|
|
186
|
+
var _chunk5Y2P454Ocjs = require('./chunk-5Y2P454O.cjs');
|
|
187
|
+
|
|
188
|
+
|
|
171
189
|
var _chunk3EIPOTZVcjs = require('./chunk-3EIPOTZV.cjs');
|
|
172
190
|
|
|
173
191
|
|
|
174
|
-
var
|
|
192
|
+
var _chunkPRFNLQSPcjs = require('./chunk-PRFNLQSP.cjs');
|
|
175
193
|
|
|
176
194
|
|
|
177
195
|
|
|
178
196
|
var _chunk2HW5LWAHcjs = require('./chunk-2HW5LWAH.cjs');
|
|
179
197
|
|
|
180
198
|
|
|
199
|
+
var _chunkLT4VAF5Zcjs = require('./chunk-LT4VAF5Z.cjs');
|
|
181
200
|
|
|
182
|
-
var _chunkXB24LZWIcjs = require('./chunk-XB24LZWI.cjs');
|
|
183
201
|
|
|
184
202
|
|
|
203
|
+
var _chunkQRX4JRBOcjs = require('./chunk-QRX4JRBO.cjs');
|
|
185
204
|
|
|
186
205
|
|
|
187
206
|
|
|
188
|
-
var _chunkXYL4HSVCcjs = require('./chunk-XYL4HSVC.cjs');
|
|
189
207
|
|
|
190
208
|
|
|
191
|
-
var
|
|
209
|
+
var _chunkYI6FKTTNcjs = require('./chunk-YI6FKTTN.cjs');
|
|
192
210
|
|
|
193
211
|
|
|
194
|
-
var
|
|
212
|
+
var _chunkFK25QSVCcjs = require('./chunk-FK25QSVC.cjs');
|
|
195
213
|
|
|
196
214
|
|
|
197
215
|
var _chunkJMYXO572cjs = require('./chunk-JMYXO572.cjs');
|
|
198
216
|
|
|
199
217
|
|
|
200
218
|
|
|
201
|
-
var
|
|
219
|
+
var _chunkZP32GNJQcjs = require('./chunk-ZP32GNJQ.cjs');
|
|
202
220
|
|
|
203
221
|
|
|
204
|
-
var
|
|
222
|
+
var _chunkZOYKJBP5cjs = require('./chunk-ZOYKJBP5.cjs');
|
|
205
223
|
|
|
206
224
|
|
|
207
225
|
|
|
208
226
|
|
|
209
|
-
var
|
|
227
|
+
var _chunkMHLNWRCJcjs = require('./chunk-MHLNWRCJ.cjs');
|
|
210
228
|
|
|
211
229
|
|
|
212
|
-
var
|
|
230
|
+
var _chunkW2RZ73IUcjs = require('./chunk-W2RZ73IU.cjs');
|
|
213
231
|
|
|
214
232
|
|
|
215
233
|
var _chunkBBPDJGCUcjs = require('./chunk-BBPDJGCU.cjs');
|
|
@@ -229,14 +247,14 @@ var _chunkOYZXVBZPcjs = require('./chunk-OYZXVBZP.cjs');
|
|
|
229
247
|
|
|
230
248
|
|
|
231
249
|
|
|
232
|
-
var
|
|
250
|
+
var _chunkQMNWKQL4cjs = require('./chunk-QMNWKQL4.cjs');
|
|
233
251
|
|
|
234
252
|
|
|
235
253
|
|
|
236
|
-
var
|
|
254
|
+
var _chunk2OF5RPVUcjs = require('./chunk-2OF5RPVU.cjs');
|
|
237
255
|
|
|
238
256
|
|
|
239
|
-
var
|
|
257
|
+
var _chunk2FRLSDBTcjs = require('./chunk-2FRLSDBT.cjs');
|
|
240
258
|
|
|
241
259
|
|
|
242
260
|
var _chunkE552H232cjs = require('./chunk-E552H232.cjs');
|
|
@@ -261,6 +279,7 @@ var _crypto = require('crypto');
|
|
|
261
279
|
|
|
262
280
|
var FARM_CLIENT_CSS_HREF_PLACEHOLDER = "/__farm_client_css_href__";
|
|
263
281
|
var FARM_CLIENT_JS_SRC_PLACEHOLDER = "/__farm_client_js_src__";
|
|
282
|
+
var FARM_CLIENT_BOOT_SRC_PLACEHOLDER = "/__farm_client_boot_src__";
|
|
264
283
|
async function hashAndCopy(sourcePath, destinationDir, hashedName) {
|
|
265
284
|
const fs4 = await import("fs/promises");
|
|
266
285
|
try {
|
|
@@ -293,6 +312,16 @@ async function findFingerprintedClientEntry(clientOutputDir) {
|
|
|
293
312
|
return null;
|
|
294
313
|
}
|
|
295
314
|
}
|
|
315
|
+
async function resolveClientBootSrc(clientOutputDir) {
|
|
316
|
+
const fs4 = await import("fs/promises");
|
|
317
|
+
try {
|
|
318
|
+
const entries = await fs4.readdir(clientOutputDir);
|
|
319
|
+
const name = entries.find((entry) => /^farm-client-boot-h[0-9a-f]+\.js$/.test(entry));
|
|
320
|
+
return name ? `/${name}` : null;
|
|
321
|
+
} catch (e3) {
|
|
322
|
+
return null;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
296
325
|
async function resolveHashedClientJsSrc(clientOutputDir) {
|
|
297
326
|
const entryName = await findFingerprintedClientEntry(clientOutputDir);
|
|
298
327
|
if (!entryName) return "/farm-client.js";
|
|
@@ -343,14 +372,14 @@ function getDocsTitle(docs) {
|
|
|
343
372
|
return typeof docs.config.nav === "object" && docs.config.nav && "title" in docs.config.nav ? String(docs.config.nav.title || "Documentation") : "Documentation";
|
|
344
373
|
}
|
|
345
374
|
function loadPages(contentDir, docs) {
|
|
346
|
-
return
|
|
375
|
+
return _chunk5JNUYGNFcjs.discoverFarmDocsPages.call(void 0, contentDir, docs).map((page) => _chunk5JNUYGNFcjs.loadFarmDocsPage.call(void 0, contentDir, docs, page.slug)).filter((page) => Boolean(page)).sort((a, b) => a.href.localeCompare(b.href));
|
|
347
376
|
}
|
|
348
377
|
function findSocialImagePath(html) {
|
|
349
378
|
const match = /<meta\s+property=["']og:image["']\s+content=["']([^"']+)["']/i.exec(html) || /<meta\s+content=["']([^"']+)["']\s+property=["']og:image["']/i.exec(html);
|
|
350
379
|
if (!_optionalChain([match, 'optionalAccess', _ => _[1]])) return null;
|
|
351
380
|
try {
|
|
352
381
|
return new URL(match[1], FARM_DOCS_COMPILED_ORIGIN).pathname;
|
|
353
|
-
} catch (
|
|
382
|
+
} catch (e4) {
|
|
354
383
|
return null;
|
|
355
384
|
}
|
|
356
385
|
}
|
|
@@ -361,14 +390,14 @@ async function addHandlerRoute(routes, pathname, handler, absolutePaths) {
|
|
|
361
390
|
return response;
|
|
362
391
|
}
|
|
363
392
|
async function compileFarmDocsManifest(docs, options) {
|
|
364
|
-
const contentDir =
|
|
393
|
+
const contentDir = _chunk5JNUYGNFcjs.resolveFarmDocsContentDir.call(void 0, docs, options);
|
|
365
394
|
const pages = loadPages(contentDir, docs);
|
|
366
395
|
const absolutePaths = [
|
|
367
396
|
_path2.default.resolve(options.root),
|
|
368
397
|
_path2.default.resolve(contentDir),
|
|
369
398
|
docs.configPath || ""
|
|
370
399
|
];
|
|
371
|
-
const handler =
|
|
400
|
+
const handler = _chunk5JNUYGNFcjs.createFarmDocsHandler.call(void 0, docs, {
|
|
372
401
|
root: options.root,
|
|
373
402
|
srcDir: options.srcDir,
|
|
374
403
|
clientEntry: options.clientEntry,
|
|
@@ -377,7 +406,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
377
406
|
globalStylesheetHref: options.globalStylesheetHref,
|
|
378
407
|
isPathGuarded: options.isPathGuarded
|
|
379
408
|
});
|
|
380
|
-
const apiHandler =
|
|
409
|
+
const apiHandler = _chunkIFXSBJPNcjs.createFarmDocsAPIHandler.call(void 0, {
|
|
381
410
|
rootDir: options.root,
|
|
382
411
|
srcDir: options.srcDir,
|
|
383
412
|
docs,
|
|
@@ -388,7 +417,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
388
417
|
const apiMarkdown = {};
|
|
389
418
|
for (const page of pages) {
|
|
390
419
|
const htmlResponse = await addHandlerRoute(routes, page.href, handler, absolutePaths);
|
|
391
|
-
const markdownPath =
|
|
420
|
+
const markdownPath = _chunk5JNUYGNFcjs.getFarmDocsMarkdownPath.call(void 0, page.href);
|
|
392
421
|
await addHandlerRoute(routes, markdownPath, handler, absolutePaths);
|
|
393
422
|
if (htmlResponse) {
|
|
394
423
|
const socialImagePath = findSocialImagePath(await htmlResponse.text());
|
|
@@ -472,7 +501,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
472
501
|
post: await compileResponse(postResponse, absolutePaths),
|
|
473
502
|
search: {
|
|
474
503
|
pages: publicPages.map((page) => ({
|
|
475
|
-
...
|
|
504
|
+
..._chunk5JNUYGNFcjs.toFarmDocsMarkdownPage.call(void 0, page),
|
|
476
505
|
sourcePath: `farm-docs:${page.slug || "index"}`
|
|
477
506
|
})),
|
|
478
507
|
search: _nullishCoalesce(searchConfig, () => ( true)),
|
|
@@ -525,7 +554,7 @@ function collectFarmClientModulePreloads(bundle, options) {
|
|
|
525
554
|
const moduleId = chunk.facadeModuleId.split("?")[0];
|
|
526
555
|
if (!_path2.default.isAbsolute(moduleId)) continue;
|
|
527
556
|
const loaded = /* @__PURE__ */ new Set([...entryLoaded, chunk.fileName]);
|
|
528
|
-
modules[
|
|
557
|
+
modules[_chunkQMNWKQL4cjs.toViteModuleId.call(void 0, moduleId, options.root)] = [
|
|
529
558
|
chunk.fileName,
|
|
530
559
|
...staticImports(chunk, loaded, [])
|
|
531
560
|
].map(index);
|
|
@@ -549,7 +578,7 @@ async function readFarmClientModulePreloads(buildDir) {
|
|
|
549
578
|
return JSON.parse(
|
|
550
579
|
await _promises2.default.readFile(_path2.default.join(buildDir, FARM_CLIENT_MODULE_PRELOADS_FILE), "utf8")
|
|
551
580
|
);
|
|
552
|
-
} catch (
|
|
581
|
+
} catch (e5) {
|
|
553
582
|
return null;
|
|
554
583
|
}
|
|
555
584
|
}
|
|
@@ -634,7 +663,7 @@ async function readFarmDocsModulePreloads(buildDir) {
|
|
|
634
663
|
return JSON.parse(
|
|
635
664
|
await _promises2.default.readFile(_path2.default.join(buildDir, FARM_DOCS_MODULE_PRELOADS_FILE), "utf8")
|
|
636
665
|
);
|
|
637
|
-
} catch (
|
|
666
|
+
} catch (e6) {
|
|
638
667
|
return null;
|
|
639
668
|
}
|
|
640
669
|
}
|
|
@@ -650,7 +679,7 @@ async function createFarmRouteRuntimeManifest(options) {
|
|
|
650
679
|
const routes = [];
|
|
651
680
|
for (const [pattern, entry] of options.routeManager.getRoutes()) {
|
|
652
681
|
const routeModule = await options.routeManager.loadRouteModule(entry.modulePath);
|
|
653
|
-
const rendering = await
|
|
682
|
+
const rendering = await _chunk3TL3AH25cjs.resolveRouteRenderingConfigFromFile.call(void 0, routeModule, entry.modulePath);
|
|
654
683
|
const runtimeConfig = await options.routeManager.resolveRouteRuntimeConfig(pattern);
|
|
655
684
|
routes.push({
|
|
656
685
|
kind: "page",
|
|
@@ -661,9 +690,9 @@ async function createFarmRouteRuntimeManifest(options) {
|
|
|
661
690
|
});
|
|
662
691
|
}
|
|
663
692
|
for (const [pattern, route] of options.apiRouteManager.getRoutes()) {
|
|
664
|
-
const publicPattern =
|
|
693
|
+
const publicPattern = _chunk2OF5RPVUcjs.resolveFarmAPIServerRoutePath.call(void 0,
|
|
665
694
|
pattern,
|
|
666
|
-
|
|
695
|
+
_chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, options.config.api)
|
|
667
696
|
);
|
|
668
697
|
const inherited = _chunkOYZXVBZPcjs.resolveFarmRouteRuleRuntimeConfig.call(void 0, publicPattern, options.config.routeRules);
|
|
669
698
|
const own = _chunkOYZXVBZPcjs.normalizeFarmRouteRuntimeConfig.call(void 0,
|
|
@@ -1034,7 +1063,7 @@ function stripPlatformConfigSource(code, parse) {
|
|
|
1034
1063
|
function realPath(file) {
|
|
1035
1064
|
try {
|
|
1036
1065
|
return _fs.realpathSync.call(void 0, file);
|
|
1037
|
-
} catch (
|
|
1066
|
+
} catch (e7) {
|
|
1038
1067
|
return _path2.default.resolve(file);
|
|
1039
1068
|
}
|
|
1040
1069
|
}
|
|
@@ -1152,12 +1181,26 @@ async function readMiddlewareFileConfig(filePath) {
|
|
|
1152
1181
|
const parsed = vite.parseSync(filePath, await readFile(filePath, "utf8"));
|
|
1153
1182
|
if (_optionalChain([parsed, 'access', _32 => _32.errors, 'optionalAccess', _33 => _33.length])) return "unknown";
|
|
1154
1183
|
return readStaticMiddlewareConfig(parsed.program);
|
|
1155
|
-
} catch (
|
|
1184
|
+
} catch (e8) {
|
|
1156
1185
|
return "unknown";
|
|
1157
1186
|
}
|
|
1158
1187
|
}
|
|
1159
1188
|
|
|
1160
1189
|
// src/nitro/universal-build.ts
|
|
1190
|
+
var FARM_NATIVE_STYLESHEETS_PLACEHOLDER = "__FARM_NATIVE_STYLESHEETS__";
|
|
1191
|
+
async function readFarmNativeStylesheets(clientOutputDir, clientCssHref) {
|
|
1192
|
+
const fs4 = await import("fs/promises");
|
|
1193
|
+
try {
|
|
1194
|
+
return {
|
|
1195
|
+
[clientCssHref]: await fs4.readFile(
|
|
1196
|
+
_path2.default.join(clientOutputDir, clientCssHref.slice(1)),
|
|
1197
|
+
"utf8"
|
|
1198
|
+
)
|
|
1199
|
+
};
|
|
1200
|
+
} catch (e9) {
|
|
1201
|
+
return {};
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1161
1204
|
function preloadFarmNitroBuilder() {
|
|
1162
1205
|
return import("nitro/builder").then(
|
|
1163
1206
|
(value) => ({ status: "fulfilled", value }),
|
|
@@ -1173,7 +1216,7 @@ function findFarmCoreRoot(from) {
|
|
|
1173
1216
|
if (_fs.existsSync.call(void 0, manifest)) {
|
|
1174
1217
|
try {
|
|
1175
1218
|
if (JSON.parse(_fs.readFileSync.call(void 0, manifest, "utf8")).name === "@farm.js/core") return dir;
|
|
1176
|
-
} catch (
|
|
1219
|
+
} catch (e10) {
|
|
1177
1220
|
}
|
|
1178
1221
|
}
|
|
1179
1222
|
dir = _path2.default.dirname(dir);
|
|
@@ -1191,7 +1234,7 @@ function findInstalledPackageDir(name, from) {
|
|
|
1191
1234
|
if (_fs.existsSync.call(void 0, _path2.default.join(candidate, "package.json"))) {
|
|
1192
1235
|
try {
|
|
1193
1236
|
return _fs.realpathSync.call(void 0, candidate);
|
|
1194
|
-
} catch (
|
|
1237
|
+
} catch (e11) {
|
|
1195
1238
|
return null;
|
|
1196
1239
|
}
|
|
1197
1240
|
}
|
|
@@ -1207,7 +1250,7 @@ function collectFarmDependencyDirs(root) {
|
|
|
1207
1250
|
let manifest;
|
|
1208
1251
|
try {
|
|
1209
1252
|
manifest = JSON.parse(_fs.readFileSync.call(void 0, _path2.default.join(dir, "package.json"), "utf8"));
|
|
1210
|
-
} catch (
|
|
1253
|
+
} catch (e12) {
|
|
1211
1254
|
return;
|
|
1212
1255
|
}
|
|
1213
1256
|
for (const field of ["dependencies", "optionalDependencies", "peerDependencies"]) {
|
|
@@ -1223,7 +1266,7 @@ function collectFarmDependencyDirs(root) {
|
|
|
1223
1266
|
if (name.startsWith("@farm.js/")) queue.push({ name, from: root });
|
|
1224
1267
|
}
|
|
1225
1268
|
}
|
|
1226
|
-
} catch (
|
|
1269
|
+
} catch (e13) {
|
|
1227
1270
|
}
|
|
1228
1271
|
for (let next = queue.pop(); next; next = queue.pop()) {
|
|
1229
1272
|
const dir = findInstalledPackageDir(next.name, next.from);
|
|
@@ -1320,7 +1363,7 @@ function createPrerenderRuntimeResolverPlugin(root, resolveNitroEntry = resolveN
|
|
|
1320
1363
|
if (nitroEntry === void 0) {
|
|
1321
1364
|
try {
|
|
1322
1365
|
nitroEntry = resolveNitroEntry(root);
|
|
1323
|
-
} catch (
|
|
1366
|
+
} catch (e14) {
|
|
1324
1367
|
nitroEntry = null;
|
|
1325
1368
|
}
|
|
1326
1369
|
}
|
|
@@ -1341,7 +1384,7 @@ function createFarmStorageModuleRegistration(config) {
|
|
|
1341
1384
|
let runtimeRequire = projectRequire;
|
|
1342
1385
|
try {
|
|
1343
1386
|
runtimeRequire = _module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core"));
|
|
1344
|
-
} catch (
|
|
1387
|
+
} catch (e15) {
|
|
1345
1388
|
}
|
|
1346
1389
|
const loaders = [];
|
|
1347
1390
|
for (const specifier of modules) {
|
|
@@ -1350,7 +1393,7 @@ function createFarmStorageModuleRegistration(config) {
|
|
|
1350
1393
|
try {
|
|
1351
1394
|
resolved = require2.resolve(specifier);
|
|
1352
1395
|
break;
|
|
1353
|
-
} catch (
|
|
1396
|
+
} catch (e16) {
|
|
1354
1397
|
}
|
|
1355
1398
|
}
|
|
1356
1399
|
if (resolved) {
|
|
@@ -1368,7 +1411,7 @@ function resolveNitroPackageEntry(root) {
|
|
|
1368
1411
|
let runtimeRequire = projectRequire;
|
|
1369
1412
|
try {
|
|
1370
1413
|
runtimeRequire = _module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core"));
|
|
1371
|
-
} catch (
|
|
1414
|
+
} catch (e17) {
|
|
1372
1415
|
}
|
|
1373
1416
|
return runtimeRequire.resolve("nitro");
|
|
1374
1417
|
}
|
|
@@ -1422,7 +1465,7 @@ async function canUseRolldownBuilder() {
|
|
|
1422
1465
|
try {
|
|
1423
1466
|
await import("rolldown");
|
|
1424
1467
|
return true;
|
|
1425
|
-
} catch (
|
|
1468
|
+
} catch (e18) {
|
|
1426
1469
|
return false;
|
|
1427
1470
|
}
|
|
1428
1471
|
}
|
|
@@ -1436,7 +1479,7 @@ function hasReactDomEdgeServerBuild(root) {
|
|
|
1436
1479
|
try {
|
|
1437
1480
|
_module.createRequire.call(void 0, _path2.default.join(root, "package.json")).resolve("react-dom/server.edge");
|
|
1438
1481
|
return true;
|
|
1439
|
-
} catch (
|
|
1482
|
+
} catch (e19) {
|
|
1440
1483
|
return false;
|
|
1441
1484
|
}
|
|
1442
1485
|
}
|
|
@@ -1474,7 +1517,7 @@ function isFarmCoreModule(file) {
|
|
|
1474
1517
|
if (_fs.existsSync.call(void 0, manifest)) {
|
|
1475
1518
|
try {
|
|
1476
1519
|
return JSON.parse(_fs.readFileSync.call(void 0, manifest, "utf8")).name === "@farm.js/core";
|
|
1477
|
-
} catch (
|
|
1520
|
+
} catch (e20) {
|
|
1478
1521
|
return false;
|
|
1479
1522
|
}
|
|
1480
1523
|
}
|
|
@@ -1618,7 +1661,7 @@ function restoreLiteralModuleSpecifiers(code, fileName, { parseSync, Visitor })
|
|
|
1618
1661
|
throw new Error(`Failed to minify ${fileName}: ${parsed.errors[0].message}`);
|
|
1619
1662
|
}
|
|
1620
1663
|
const replacements = [];
|
|
1621
|
-
let needsAst = hasRequireTemplate;
|
|
1664
|
+
let needsAst = hasRequireTemplate && /(?<![\w$])require\(`/.test(code);
|
|
1622
1665
|
if (!needsAst) {
|
|
1623
1666
|
const seenStarts = /* @__PURE__ */ new Set();
|
|
1624
1667
|
for (const { moduleRequest } of parsed.module.dynamicImports) {
|
|
@@ -1721,7 +1764,7 @@ function hasProjectPostcssConfig(root) {
|
|
|
1721
1764
|
try {
|
|
1722
1765
|
projectRequire.resolve(`./${file}`);
|
|
1723
1766
|
return true;
|
|
1724
|
-
} catch (
|
|
1767
|
+
} catch (e21) {
|
|
1725
1768
|
return false;
|
|
1726
1769
|
}
|
|
1727
1770
|
});
|
|
@@ -1743,14 +1786,14 @@ async function findFarmConfigPath(root) {
|
|
|
1743
1786
|
try {
|
|
1744
1787
|
await fs4.access(resolvedPath);
|
|
1745
1788
|
return resolvedPath;
|
|
1746
|
-
} catch (
|
|
1789
|
+
} catch (e22) {
|
|
1747
1790
|
}
|
|
1748
1791
|
}
|
|
1749
1792
|
return null;
|
|
1750
1793
|
}
|
|
1751
1794
|
function hasFarmServerRuntimePlugins(config) {
|
|
1752
1795
|
return (config.plugins || []).some((plugin) => {
|
|
1753
|
-
if (
|
|
1796
|
+
if (_chunkZP32GNJQcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) === false) return false;
|
|
1754
1797
|
return Boolean(
|
|
1755
1798
|
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
|
|
1756
1799
|
);
|
|
@@ -1761,9 +1804,9 @@ function hasFarmPluginRoutes(config) {
|
|
|
1761
1804
|
}
|
|
1762
1805
|
function farmServerRuntimePluginsMayHandlePath(config, pathname) {
|
|
1763
1806
|
return (config.plugins || []).some(
|
|
1764
|
-
(plugin) =>
|
|
1807
|
+
(plugin) => _chunkZP32GNJQcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) !== false && // Mobile session tokens change only bearer requests and cookie-clearing responses, which a
|
|
1765
1808
|
// prerendered file never answers or sends; its endpoints live under /__farm/.
|
|
1766
|
-
plugin.name !==
|
|
1809
|
+
plugin.name !== _chunk4BS3HSY7cjs.FARM_MOBILE_SESSION_PLUGIN && _chunk47JV57DAcjs.farmPluginMayAffectRuntimePath.call(void 0, plugin, pathname)
|
|
1767
1810
|
);
|
|
1768
1811
|
}
|
|
1769
1812
|
async function discoverMiddlewareRoutes(appDir) {
|
|
@@ -1774,7 +1817,7 @@ async function discoverMiddlewareRoutes(appDir) {
|
|
|
1774
1817
|
let entries;
|
|
1775
1818
|
try {
|
|
1776
1819
|
entries = await fs4.readdir(dir, { withFileTypes: true });
|
|
1777
|
-
} catch (
|
|
1820
|
+
} catch (e23) {
|
|
1778
1821
|
return;
|
|
1779
1822
|
}
|
|
1780
1823
|
const middlewareFile = entries.find(
|
|
@@ -1793,8 +1836,8 @@ async function discoverMiddlewareRoutes(appDir) {
|
|
|
1793
1836
|
}
|
|
1794
1837
|
await walk(
|
|
1795
1838
|
_path2.default.join(dir, entry.name),
|
|
1796
|
-
|
|
1797
|
-
|
|
1839
|
+
_chunkMHLNWRCJcjs.appendMiddlewareRoutePath.call(void 0, routePath, entry.name),
|
|
1840
|
+
_chunkMHLNWRCJcjs.appendMiddlewareDirectory.call(void 0, directory, entry.name),
|
|
1798
1841
|
discovered
|
|
1799
1842
|
);
|
|
1800
1843
|
}
|
|
@@ -1806,7 +1849,7 @@ async function discoverMiddlewareRoutes(appDir) {
|
|
|
1806
1849
|
routes.set(route.directory, route);
|
|
1807
1850
|
}
|
|
1808
1851
|
}
|
|
1809
|
-
return Array.from(routes.values()).sort(
|
|
1852
|
+
return Array.from(routes.values()).sort(_chunkMHLNWRCJcjs.compareMiddlewareRouteLocations).map(({ path: routePath, filePath }) => ({ path: routePath, filePath }));
|
|
1810
1853
|
}
|
|
1811
1854
|
function assertFarmDocsRuntimeSupported(config, preset) {
|
|
1812
1855
|
if (!_optionalChain([config, 'access', _48 => _48.docs, 'optionalAccess', _49 => _49.enabled]) || !_optionalChain([config, 'access', _50 => _50.docs, 'access', _51 => _51.adapter, 'optionalAccess', _52 => _52.server]) || _chunkE552H232cjs.getFarmPresetRuntime.call(void 0, preset) !== "edge" || Boolean(config.docs.adapter.edgeCompiler)) {
|
|
@@ -1822,13 +1865,13 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1822
1865
|
assertFarmDocsRuntimeSupported(config, preset);
|
|
1823
1866
|
const srcDir = config.srcDir || "src";
|
|
1824
1867
|
const distDir = config.distDir || ".farm";
|
|
1825
|
-
const deployOutputDir =
|
|
1868
|
+
const deployOutputDir = _chunkNQJDO7K7cjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
1826
1869
|
const lifecyclePluginManager = options.pluginManager;
|
|
1827
1870
|
const productionViteResultPromise = Promise.allSettled([
|
|
1828
1871
|
Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkMF3IA2AWcjs.loadFarmProductionVite.call(void 0, ))))
|
|
1829
1872
|
]);
|
|
1830
1873
|
const nitroBuilderResultPromise = preloadFarmNitroBuilder();
|
|
1831
|
-
|
|
1874
|
+
_chunkQMNWKQL4cjs.logger.info(`\u{1F69C} Building Farm.js application (universal) with preset: ${preset}...`);
|
|
1832
1875
|
const rendererBuild = options.rendererBuildLifetime ? void 0 : new AbortController();
|
|
1833
1876
|
const rendererBuildLifetime = _nullishCoalesce(options.rendererBuildLifetime, () => ( rendererBuild.signal));
|
|
1834
1877
|
try {
|
|
@@ -1841,7 +1884,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1841
1884
|
const routeRuntimeManifestResultPromise = Promise.allSettled([routeRuntimeManifestPromise]);
|
|
1842
1885
|
const pageRoutes = [];
|
|
1843
1886
|
for (const [pattern, entry] of routeManager.getRoutes()) {
|
|
1844
|
-
const markdownSourcePath = entry.markdownSourcePath || (
|
|
1887
|
+
const markdownSourcePath = entry.markdownSourcePath || (_chunkPRFNLQSPcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? entry.modulePath : void 0);
|
|
1845
1888
|
pageRoutes.push({
|
|
1846
1889
|
pattern,
|
|
1847
1890
|
...entry.directory ? { directory: entry.directory } : {},
|
|
@@ -1865,7 +1908,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1865
1908
|
fallback: entry.fallback
|
|
1866
1909
|
})
|
|
1867
1910
|
);
|
|
1868
|
-
|
|
1911
|
+
_chunkQMNWKQL4cjs.logger.info(`\u{1F4CB} Found ${pageRoutes.length} page routes`);
|
|
1869
1912
|
const fs4 = await import("fs/promises");
|
|
1870
1913
|
const layoutRoutes = [];
|
|
1871
1914
|
const appDir = _path2.default.join(root, srcDir, "app");
|
|
@@ -1883,7 +1926,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1883
1926
|
await findLayoutsForClient(_path2.default.join(dir, entry.name), childPrefix);
|
|
1884
1927
|
}
|
|
1885
1928
|
}
|
|
1886
|
-
} catch (
|
|
1929
|
+
} catch (e24) {
|
|
1887
1930
|
}
|
|
1888
1931
|
}
|
|
1889
1932
|
await findLayoutsForClient(appDir);
|
|
@@ -1893,7 +1936,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1893
1936
|
seenLayoutPatterns.add(pattern);
|
|
1894
1937
|
layoutRoutes.push({ pattern, modulePath: entry.modulePath });
|
|
1895
1938
|
}
|
|
1896
|
-
|
|
1939
|
+
_chunkQMNWKQL4cjs.logger.info(`\u{1F4CB} Found ${pageRoutes.length} page routes and ${layoutRoutes.length} layouts`);
|
|
1897
1940
|
const isolatedClientBoundaryModules = routeManager.getIsolatedClientBoundaryModules(root);
|
|
1898
1941
|
const islandsErrors = routeManager.getIslandsErrors(root);
|
|
1899
1942
|
if (islandsErrors.length > 0) {
|
|
@@ -1911,7 +1954,8 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
1911
1954
|
throw productionViteResult.reason;
|
|
1912
1955
|
}
|
|
1913
1956
|
const productionVite = productionViteResult.value;
|
|
1914
|
-
|
|
1957
|
+
_chunkQMNWKQL4cjs.logger.info("\u26A1 Building application bundles with Vite Rolldown");
|
|
1958
|
+
const mobileClient = shouldBuildFarmMobileClient(config);
|
|
1915
1959
|
const buildClientBundle = () => buildClient(
|
|
1916
1960
|
productionVite,
|
|
1917
1961
|
config,
|
|
@@ -1924,7 +1968,8 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
1924
1968
|
isolatedClientBoundaryModules,
|
|
1925
1969
|
hydrationPlanCache,
|
|
1926
1970
|
rendererBuildLifetime,
|
|
1927
|
-
routeManager.getProgrammaticClientRoutes()
|
|
1971
|
+
routeManager.getProgrammaticClientRoutes(),
|
|
1972
|
+
mobileClient
|
|
1928
1973
|
);
|
|
1929
1974
|
const buildSSRBundle = () => buildSSRInMemory(
|
|
1930
1975
|
productionVite,
|
|
@@ -1944,11 +1989,11 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
1944
1989
|
let clientBuildResult;
|
|
1945
1990
|
let ssrBuildResult;
|
|
1946
1991
|
if (config.renderer.buildConcurrency === "serial") {
|
|
1947
|
-
|
|
1992
|
+
_chunkQMNWKQL4cjs.logger.info(`\u{1F4E6} Building client and SSR bundles serially for ${config.renderer.name}...`);
|
|
1948
1993
|
[clientBuildResult] = await Promise.allSettled([buildClientBundle()]);
|
|
1949
1994
|
[ssrBuildResult] = await Promise.allSettled([buildSSRBundle()]);
|
|
1950
1995
|
} else {
|
|
1951
|
-
|
|
1996
|
+
_chunkQMNWKQL4cjs.logger.info("\u{1F4E6} Building client and SSR bundles in parallel...");
|
|
1952
1997
|
[clientBuildResult, ssrBuildResult] = await Promise.allSettled([
|
|
1953
1998
|
buildClientBundle(),
|
|
1954
1999
|
buildSSRBundle()
|
|
@@ -1963,7 +2008,7 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
1963
2008
|
if (productionVite.builder !== "rolldown" || !(clientBuildResult.reason instanceof IncompleteClientBuildOutputError)) {
|
|
1964
2009
|
throw clientBuildResult.reason;
|
|
1965
2010
|
}
|
|
1966
|
-
|
|
2011
|
+
_chunkQMNWKQL4cjs.logger.warn("Client bundle was incomplete; retrying after the SSR build...");
|
|
1967
2012
|
try {
|
|
1968
2013
|
await buildClient(
|
|
1969
2014
|
productionVite,
|
|
@@ -1977,7 +2022,8 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
1977
2022
|
isolatedClientBoundaryModules,
|
|
1978
2023
|
hydrationPlanCache,
|
|
1979
2024
|
rendererBuildLifetime,
|
|
1980
|
-
routeManager.getProgrammaticClientRoutes()
|
|
2025
|
+
routeManager.getProgrammaticClientRoutes(),
|
|
2026
|
+
mobileClient
|
|
1981
2027
|
);
|
|
1982
2028
|
} catch (retryError) {
|
|
1983
2029
|
if (!(retryError instanceof IncompleteClientBuildOutputError)) throw retryError;
|
|
@@ -1990,14 +2036,14 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
1990
2036
|
const routeRuntimeManifest = routeRuntimeManifestResult.value;
|
|
1991
2037
|
const runtimeValidation = validateFarmRouteRuntimeDeployment(routeRuntimeManifest, preset);
|
|
1992
2038
|
for (const warning of runtimeValidation.warnings) {
|
|
1993
|
-
|
|
2039
|
+
_chunkQMNWKQL4cjs.logger.warn(warning);
|
|
1994
2040
|
}
|
|
1995
2041
|
const { bundle: ssrBundle, entryFile: ssrEntryFile, configuredHeaderRoutes } = ssrResult;
|
|
1996
2042
|
await writeSSRAssetsToClient(ssrBundle, clientOutputDir);
|
|
1997
2043
|
if (config.docs.enabled) {
|
|
1998
2044
|
await copyFarmDocsFontAssetsToClient(root, clientOutputDir);
|
|
1999
2045
|
}
|
|
2000
|
-
|
|
2046
|
+
_chunkQMNWKQL4cjs.logger.info(`\u{1F680} Building server with Nitro (preset: ${preset})...`);
|
|
2001
2047
|
await buildNitroUniversal(
|
|
2002
2048
|
config,
|
|
2003
2049
|
routeManager,
|
|
@@ -2018,7 +2064,7 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
2018
2064
|
_path2.default.join(root, distDir),
|
|
2019
2065
|
routeRuntimeManifest
|
|
2020
2066
|
);
|
|
2021
|
-
|
|
2067
|
+
_chunkQMNWKQL4cjs.logger.info(`\u{1F4CB} Route runtime manifest: ${_path2.default.relative(root, runtimeManifestPath)}`);
|
|
2022
2068
|
} catch (error) {
|
|
2023
2069
|
if (lifecyclePluginManager) {
|
|
2024
2070
|
await lifecyclePluginManager.runHookParallel("onError", {
|
|
@@ -2030,12 +2076,26 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
2030
2076
|
}
|
|
2031
2077
|
});
|
|
2032
2078
|
}
|
|
2033
|
-
|
|
2079
|
+
_chunkQMNWKQL4cjs.logger.error(`\u274C Build failed: ${error}`);
|
|
2034
2080
|
throw error;
|
|
2035
2081
|
} finally {
|
|
2036
2082
|
_optionalChain([rendererBuild, 'optionalAccess', _53 => _53.abort, 'call', _54 => _54()]);
|
|
2037
2083
|
}
|
|
2038
2084
|
}
|
|
2085
|
+
function shouldBuildFarmMobileClient(config) {
|
|
2086
|
+
return Boolean(config.mobileClient) && !config.desktop;
|
|
2087
|
+
}
|
|
2088
|
+
function varyFarmNitroCacheRulesByShell(rules) {
|
|
2089
|
+
return Object.fromEntries(
|
|
2090
|
+
Object.entries(rules).map(([source, rule]) => {
|
|
2091
|
+
const cached = _optionalChain([rule, 'optionalAccess', _55 => _55.swr]) !== void 0 && rule.swr !== false || _optionalChain([rule, 'optionalAccess', _56 => _56.cache]) !== void 0 && rule.cache !== false;
|
|
2092
|
+
if (!cached || rule.cache === false) return [source, rule];
|
|
2093
|
+
const cache = rule.cache && typeof rule.cache === "object" ? rule.cache : {};
|
|
2094
|
+
const varies = [...Array.isArray(cache.varies) ? cache.varies : [], "x-farm-shell"];
|
|
2095
|
+
return [source, { ...rule, cache: { ...cache, varies } }];
|
|
2096
|
+
})
|
|
2097
|
+
);
|
|
2098
|
+
}
|
|
2039
2099
|
async function writeSSRAssetsToClient(bundle, outputDir) {
|
|
2040
2100
|
const fs4 = await import("fs/promises");
|
|
2041
2101
|
for (const [fileName, output] of Object.entries(bundle)) {
|
|
@@ -2066,7 +2126,7 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
|
|
|
2066
2126
|
if (fontCss === void 0) {
|
|
2067
2127
|
try {
|
|
2068
2128
|
fontCss = await fs4.readFile(fontCssPath);
|
|
2069
|
-
} catch (
|
|
2129
|
+
} catch (e25) {
|
|
2070
2130
|
return;
|
|
2071
2131
|
}
|
|
2072
2132
|
}
|
|
@@ -2074,11 +2134,11 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
|
|
|
2074
2134
|
let clientCss = "";
|
|
2075
2135
|
try {
|
|
2076
2136
|
clientCss = await fs4.readFile(clientCssPath, "utf8");
|
|
2077
|
-
} catch (
|
|
2137
|
+
} catch (e26) {
|
|
2078
2138
|
}
|
|
2079
2139
|
const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
|
|
2080
2140
|
await fs4.writeFile(fontCssPath, normalizedFontCss);
|
|
2081
|
-
await fs4.writeFile(clientCssPath,
|
|
2141
|
+
await fs4.writeFile(clientCssPath, _chunkUYSTTPYJcjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
|
|
2082
2142
|
}
|
|
2083
2143
|
var IncompleteClientBuildOutputError = class extends Error {
|
|
2084
2144
|
constructor(detail) {
|
|
@@ -2094,7 +2154,7 @@ async function validateClientBuildOutput(root, srcDir, outputDir) {
|
|
|
2094
2154
|
try {
|
|
2095
2155
|
const clientEntry = await fs4.stat(clientEntryPath);
|
|
2096
2156
|
if (clientEntry.isFile()) clientEntrySize = clientEntry.size;
|
|
2097
|
-
} catch (
|
|
2157
|
+
} catch (e27) {
|
|
2098
2158
|
}
|
|
2099
2159
|
if (clientEntrySize === 0) {
|
|
2100
2160
|
throw new IncompleteClientBuildOutputError("farm-client.js is missing or empty");
|
|
@@ -2105,7 +2165,7 @@ async function validateClientBuildOutput(root, srcDir, outputDir) {
|
|
|
2105
2165
|
try {
|
|
2106
2166
|
const globalsCss = await fs4.readFile(globalsCssPath, "utf8");
|
|
2107
2167
|
expectsCss = globalsCss.replace(/\/\*[\s\S]*?\*\//g, "").trim().length > 0;
|
|
2108
|
-
} catch (
|
|
2168
|
+
} catch (e28) {
|
|
2109
2169
|
}
|
|
2110
2170
|
try {
|
|
2111
2171
|
const clientCss = await fs4.stat(clientCssPath);
|
|
@@ -2124,12 +2184,13 @@ function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, optio
|
|
|
2124
2184
|
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)}`;
|
|
2125
2185
|
let plan = cache.get(key);
|
|
2126
2186
|
if (!plan) {
|
|
2127
|
-
plan =
|
|
2187
|
+
plan = _chunkUYSTTPYJcjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
|
|
2128
2188
|
cache.set(key, plan);
|
|
2129
2189
|
}
|
|
2130
2190
|
return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
|
|
2131
2191
|
}
|
|
2132
|
-
async function buildClient(productionVite, config, root, srcDir, outputDir, pageRoutes, layoutRoutes = [], routeSlots = [], isolatedClientBoundaryModules = /* @__PURE__ */ new Set(), hydrationPlanCache = /* @__PURE__ */ new Map(), rendererBuildLifetime, programmaticClientRoutes) {
|
|
2192
|
+
async function buildClient(productionVite, config, root, srcDir, outputDir, pageRoutes, layoutRoutes = [], routeSlots = [], isolatedClientBoundaryModules = /* @__PURE__ */ new Set(), hydrationPlanCache = /* @__PURE__ */ new Map(), rendererBuildLifetime, programmaticClientRoutes, mobile = false) {
|
|
2193
|
+
if (!mobile) await _chunkEFZGB7JCcjs.removeFarmMobileClientManifest.call(void 0, _path2.default.dirname(outputDir));
|
|
2133
2194
|
const viteBuild = productionVite.build;
|
|
2134
2195
|
const { farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.cjs");
|
|
2135
2196
|
const { PluginManager: PluginManager2 } = await import("./plugin-HZIBL3DW.cjs");
|
|
@@ -2141,31 +2202,31 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2141
2202
|
});
|
|
2142
2203
|
pluginManager.addPlugins(config.plugins || []);
|
|
2143
2204
|
const clientPages = [];
|
|
2144
|
-
const integrationProviders =
|
|
2205
|
+
const integrationProviders = _chunkZP32GNJQcjs.getIntegrationProviders.call(void 0, config.integrations).filter(
|
|
2145
2206
|
(provider) => provider.component || provider.type === "clerk"
|
|
2146
2207
|
);
|
|
2147
2208
|
const unsupportedIntegrationProvider = integrationProviders.find(
|
|
2148
2209
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
2149
2210
|
);
|
|
2150
|
-
if (_optionalChain([config, 'access',
|
|
2151
|
-
|
|
2211
|
+
if (_optionalChain([config, 'access', _57 => _57.experimental, 'optionalAccess', _58 => _58.isolatedClientHydration]) === "enabled" && _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _59 => _59.experimental, 'optionalAccess', _60 => _60.serverComponents])) !== "rsc" && unsupportedIntegrationProvider) {
|
|
2212
|
+
_chunkQMNWKQL4cjs.logger.warn(
|
|
2152
2213
|
`[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
|
|
2153
2214
|
);
|
|
2154
2215
|
}
|
|
2155
|
-
const isolatedMode =
|
|
2156
|
-
_optionalChain([config, 'access',
|
|
2216
|
+
const isolatedMode = _chunkUYSTTPYJcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
2217
|
+
_optionalChain([config, 'access', _61 => _61.experimental, 'optionalAccess', _62 => _62.isolatedClientHydration]),
|
|
2157
2218
|
{
|
|
2158
|
-
serverComponents: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
2219
|
+
serverComponents: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _63 => _63.experimental, 'optionalAccess', _64 => _64.serverComponents])) === "rsc",
|
|
2159
2220
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
2160
2221
|
}
|
|
2161
2222
|
);
|
|
2162
|
-
const planOptions =
|
|
2223
|
+
const planOptions = _chunkUYSTTPYJcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
2163
2224
|
config.renderer,
|
|
2164
2225
|
Boolean(unsupportedIntegrationProvider)
|
|
2165
2226
|
);
|
|
2166
2227
|
const pagePlanOptions = {
|
|
2167
2228
|
...planOptions,
|
|
2168
|
-
serverOwners: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
2229
|
+
serverOwners: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _65 => _65.experimental, 'optionalAccess', _66 => _66.serverComponents])) === "islands"
|
|
2169
2230
|
};
|
|
2170
2231
|
const layoutPlanOptions = {
|
|
2171
2232
|
...planOptions,
|
|
@@ -2197,7 +2258,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2197
2258
|
serverTreeLayout: metadata.serverTreeLayout
|
|
2198
2259
|
};
|
|
2199
2260
|
} catch (error) {
|
|
2200
|
-
|
|
2261
|
+
_chunkQMNWKQL4cjs.logger.warn(`\u26A0\uFE0F Could not inspect layout file ${layout.modulePath}: ${error}`);
|
|
2201
2262
|
return {
|
|
2202
2263
|
...layout,
|
|
2203
2264
|
shouldHydrate: false,
|
|
@@ -2216,21 +2277,22 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2216
2277
|
};
|
|
2217
2278
|
}
|
|
2218
2279
|
});
|
|
2219
|
-
const layoutAppliesToRoute =
|
|
2280
|
+
const layoutAppliesToRoute = _chunkO27PLNQZcjs.routeBoundaryCoversDirectory;
|
|
2220
2281
|
const routeDirectory = (route) => _nullishCoalesce(route.directory, () => ( route.pattern));
|
|
2282
|
+
const islandsMode = _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _67 => _67.experimental, 'optionalAccess', _68 => _68.serverComponents])) === "islands";
|
|
2221
2283
|
const adapterOwnsDocsRuntime = Boolean(
|
|
2222
|
-
_chunkRD623KW4cjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access',
|
|
2284
|
+
_chunkRD623KW4cjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _69 => _69.docs, 'optionalAccess', _70 => _70.enabled]) && _optionalChain([config, 'access', _71 => _71.docs, 'access', _72 => _72.adapter, 'optionalAccess', _73 => _73.server]) && config.docs.adapter.react
|
|
2223
2285
|
);
|
|
2224
|
-
const docsEntries = _optionalChain([config, 'access',
|
|
2286
|
+
const docsEntries = _optionalChain([config, 'access', _74 => _74.docs, 'optionalAccess', _75 => _75.enabled]) ? _chunk5JNUYGNFcjs.getFarmDocsRoots.call(void 0, config.docs).map(
|
|
2225
2287
|
(docsRoot) => `/${docsRoot.entry || "docs"}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/"
|
|
2226
2288
|
) : [];
|
|
2227
2289
|
const adapterDocsEntry = _nullishCoalesce(docsEntries[0], () => ( null));
|
|
2228
2290
|
const isAdapterDocsRoute = (routePattern) => adapterOwnsDocsRuntime && docsEntries.some(
|
|
2229
2291
|
(docsEntry) => docsEntry === "/" || routePattern === docsEntry || routePattern.startsWith(`${docsEntry}/`)
|
|
2230
2292
|
);
|
|
2231
|
-
const syntheticDocsEntry = _optionalChain([config, 'access',
|
|
2293
|
+
const syntheticDocsEntry = _optionalChain([config, 'access', _76 => _76.docs, 'optionalAccess', _77 => _77.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
|
|
2232
2294
|
const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
|
|
2233
|
-
const markdownPagePlan =
|
|
2295
|
+
const markdownPagePlan = _chunkUYSTTPYJcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
2234
2296
|
_chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), root),
|
|
2235
2297
|
root,
|
|
2236
2298
|
isolatedMode,
|
|
@@ -2238,7 +2300,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2238
2300
|
);
|
|
2239
2301
|
const routePlans = pageRoutes.map((route) => ({
|
|
2240
2302
|
route,
|
|
2241
|
-
metadata:
|
|
2303
|
+
metadata: _chunkPRFNLQSPcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
|
|
2242
2304
|
route.modulePath,
|
|
2243
2305
|
root,
|
|
2244
2306
|
isolatedMode,
|
|
@@ -2246,7 +2308,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2246
2308
|
pagePlanOptions
|
|
2247
2309
|
)
|
|
2248
2310
|
}));
|
|
2249
|
-
|
|
2311
|
+
_chunkUYSTTPYJcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
2250
2312
|
clientLayouts.map((layout) => ({
|
|
2251
2313
|
pattern: layout.pattern,
|
|
2252
2314
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -2255,7 +2317,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2255
2317
|
[
|
|
2256
2318
|
...routePlans.map(({ route, metadata }) => ({
|
|
2257
2319
|
pattern: routeDirectory(route),
|
|
2258
|
-
depth:
|
|
2320
|
+
depth: _chunkO27PLNQZcjs.getRouteDirectoryDepth.call(void 0, routeDirectory(route)),
|
|
2259
2321
|
metadata
|
|
2260
2322
|
})),
|
|
2261
2323
|
...syntheticDocsPatterns.map((pattern) => ({
|
|
@@ -2273,12 +2335,13 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2273
2335
|
}
|
|
2274
2336
|
}))
|
|
2275
2337
|
],
|
|
2276
|
-
layoutAppliesToRoute
|
|
2338
|
+
layoutAppliesToRoute,
|
|
2339
|
+
{ serverOwners: islandsMode }
|
|
2277
2340
|
);
|
|
2278
2341
|
for (const layout of clientLayouts) {
|
|
2279
2342
|
const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, routeDirectory(route))) || docsEntries.some((docsEntry) => layoutAppliesToRoute(layout.pattern, docsEntry));
|
|
2280
2343
|
if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
|
|
2281
|
-
|
|
2344
|
+
_chunkQMNWKQL4cjs.logger.warn(`\u26A0\uFE0F ${_chunkUYSTTPYJcjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
|
|
2282
2345
|
}
|
|
2283
2346
|
}
|
|
2284
2347
|
if (isolatedMode === "analyze") {
|
|
@@ -2289,7 +2352,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2289
2352
|
if (!("isolatedHydrationEligible" in metadata) || !metadata.isolatedHydrationEligible) {
|
|
2290
2353
|
continue;
|
|
2291
2354
|
}
|
|
2292
|
-
|
|
2355
|
+
_chunkQMNWKQL4cjs.logger.info(
|
|
2293
2356
|
`\u{1F4CA} Isolated hydration analysis: ${entry.modulePath} can exclude its server owner and hydrate ${metadata.isolatedBoundaries.length} client ${metadata.isolatedBoundaries.length === 1 ? "boundary" : "boundaries"}.`
|
|
2294
2357
|
);
|
|
2295
2358
|
}
|
|
@@ -2301,21 +2364,19 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2301
2364
|
(layout) => (layout.shouldHydrate || layout.hasIsolatedClientBoundaries) && layoutAppliesToRoute(layout.pattern, routeDirectory(route))
|
|
2302
2365
|
);
|
|
2303
2366
|
if (metadata.suppressedAsyncHydration) {
|
|
2304
|
-
|
|
2305
|
-
`\u26A0\uFE0F ${
|
|
2367
|
+
_chunkQMNWKQL4cjs.logger.warn(
|
|
2368
|
+
`\u26A0\uFE0F ${_chunkUYSTTPYJcjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
|
|
2306
2369
|
);
|
|
2307
2370
|
}
|
|
2308
2371
|
if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0) {
|
|
2309
2372
|
const relativePath = route.modulePath.replace(root, "").replace(/^\//, "");
|
|
2310
|
-
const
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
(strategy) => strategy === hydrationStrategies[0]
|
|
2318
|
-
) ? _nullishCoalesce(hydrationStrategies[0], () => ( "load")) : "load";
|
|
2373
|
+
const islandStrategy = _chunkUYSTTPYJcjs.resolveFarmRouteRootStrategy.call(void 0,
|
|
2374
|
+
route,
|
|
2375
|
+
metadata,
|
|
2376
|
+
clientLayouts,
|
|
2377
|
+
root,
|
|
2378
|
+
islandsMode
|
|
2379
|
+
);
|
|
2319
2380
|
clientPages.push({
|
|
2320
2381
|
...route,
|
|
2321
2382
|
relativePath,
|
|
@@ -2327,12 +2388,12 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2327
2388
|
...applicableClientLayouts.filter((layout) => layout.hasIsolatedClientBoundaries || layout.serverTreeLayout).flatMap((layout) => layout.isolatedBoundaries)
|
|
2328
2389
|
],
|
|
2329
2390
|
// The server renders a server tree only below a hydrating layout.
|
|
2330
|
-
...
|
|
2391
|
+
..._chunkUYSTTPYJcjs.usesFarmServerTree.call(void 0, metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
|
|
2331
2392
|
});
|
|
2332
|
-
|
|
2393
|
+
_chunkQMNWKQL4cjs.logger.info(`\u{1F4F1} Found hydratable route: ${route.pattern} -> ${route.modulePath}`);
|
|
2333
2394
|
}
|
|
2334
2395
|
} catch (error) {
|
|
2335
|
-
|
|
2396
|
+
_chunkQMNWKQL4cjs.logger.warn(`\u26A0\uFE0F Could not inspect route file ${route.modulePath}: ${error}`);
|
|
2336
2397
|
}
|
|
2337
2398
|
}
|
|
2338
2399
|
if (syntheticDocsEntry) {
|
|
@@ -2363,215 +2424,252 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2363
2424
|
}
|
|
2364
2425
|
const clientRouteSlots = routeSlots.filter((slot) => {
|
|
2365
2426
|
try {
|
|
2366
|
-
return
|
|
2427
|
+
return _chunkUYSTTPYJcjs.getClientModuleMetadata.call(void 0, slot.modulePath, root).shouldHydrate;
|
|
2367
2428
|
} catch (error) {
|
|
2368
|
-
|
|
2429
|
+
_chunkQMNWKQL4cjs.logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
|
|
2369
2430
|
return false;
|
|
2370
2431
|
}
|
|
2371
2432
|
});
|
|
2372
|
-
|
|
2433
|
+
_chunkQMNWKQL4cjs.logger.info(
|
|
2373
2434
|
`\u{1F4F1} Total hydratable routes detected: ${clientPages.length} pages, ${clientLayouts.filter((layout) => layout.shouldHydrate || layout.hasIsolatedClientBoundaries).length} layouts, and ${clientRouteSlots.length} slots`
|
|
2374
2435
|
);
|
|
2375
|
-
const
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
srcDir,
|
|
2385
|
-
adapterOwnsDocsRuntime ? false : _chunkDZZHTMWMcjs.isFarmDocsSearchEnabled.call(void 0, config.docs),
|
|
2386
|
-
adapterOwnsDocsRuntime ? void 0 : _chunkDZZHTMWMcjs.resolveFarmDocsSearchClientModule.call(void 0, root),
|
|
2387
|
-
_optionalChain([config, 'access', _74 => _74.docs, 'optionalAccess', _75 => _75.enabled]) ? _chunk5N7QAGEAcjs.getFarmDocsRoots.call(void 0, config.docs).map((docsRoot) => docsRoot.entry) : void 0,
|
|
2388
|
-
adapterOwnsDocsRuntime ? _optionalChain([config, 'access', _76 => _76.docs, 'access', _77 => _77.adapter, 'optionalAccess', _78 => _78.react]) : void 0,
|
|
2389
|
-
config.i18n,
|
|
2390
|
-
config.plugins,
|
|
2391
|
-
config.renderer,
|
|
2392
|
-
config.publicRuntimeConfig,
|
|
2393
|
-
config.trailingSlash,
|
|
2394
|
-
_chunkCECUDGXQcjs.getIntegrationProviders.call(void 0, config.integrations),
|
|
2395
|
-
config.basePath,
|
|
2396
|
-
_chunkWZW6LEHMcjs.generateClientCachePersistenceCode.call(void 0, _chunkWZW6LEHMcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
|
|
2397
|
-
adapterOwnsDocsRuntime ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0,
|
|
2398
|
-
_chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _79 => _79.experimental, 'optionalAccess', _80 => _80.serverComponents])) === "islands"
|
|
2399
|
-
);
|
|
2400
|
-
await fs4.writeFile(clientEntryPath, clientHydrationCode);
|
|
2401
|
-
const hasScopedPostcssConfig = hasProjectPostcssConfig(root);
|
|
2402
|
-
let postcssSearchPath;
|
|
2403
|
-
let tailwindVitePlugin = void 0;
|
|
2404
|
-
const rendererVitePlugins = await _chunkRD623KW4cjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, root, {
|
|
2405
|
-
ssr: false,
|
|
2406
|
-
buildLifetime: rendererBuildLifetime
|
|
2407
|
-
});
|
|
2408
|
-
if (hasScopedPostcssConfig) {
|
|
2409
|
-
_chunkVQJYGZNXcjs.logger.info("\u{1F4E6} Using project PostCSS/Tailwind configuration");
|
|
2410
|
-
} else {
|
|
2411
|
-
const postcssConfigPath = _path2.default.join(clientEntryDir, "postcss.config.cjs");
|
|
2412
|
-
await fs4.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
|
|
2413
|
-
postcssSearchPath = clientEntryDir;
|
|
2414
|
-
tailwindVitePlugin = await _chunkLNM57D3Hcjs.loadTailwindVitePlugin.call(void 0, {
|
|
2415
|
-
builder: productionVite.builder,
|
|
2416
|
-
announce: true
|
|
2417
|
-
});
|
|
2418
|
-
}
|
|
2419
|
-
try {
|
|
2420
|
-
const clientViteConfig = {
|
|
2436
|
+
const buildTarget = async (platform) => {
|
|
2437
|
+
const clientEntryRoot = _path2.default.join(root, ".farm", "tmp");
|
|
2438
|
+
await fs4.mkdir(clientEntryRoot, { recursive: true });
|
|
2439
|
+
const clientEntryDir = await fs4.mkdtemp(_path2.default.join(clientEntryRoot, "client-entry-"));
|
|
2440
|
+
const clientEntryPath = _path2.default.join(clientEntryDir, "farm-client-entry.tsx");
|
|
2441
|
+
const clientHydrationCode = generateClientHydrationEntry(
|
|
2442
|
+
clientPages,
|
|
2443
|
+
clientLayouts,
|
|
2444
|
+
clientRouteSlots,
|
|
2421
2445
|
root,
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2446
|
+
srcDir,
|
|
2447
|
+
adapterOwnsDocsRuntime ? false : _chunkDZZHTMWMcjs.isFarmDocsSearchEnabled.call(void 0, config.docs),
|
|
2448
|
+
adapterOwnsDocsRuntime ? void 0 : _chunkDZZHTMWMcjs.resolveFarmDocsSearchClientModule.call(void 0, root),
|
|
2449
|
+
_optionalChain([config, 'access', _78 => _78.docs, 'optionalAccess', _79 => _79.enabled]) ? _chunk5JNUYGNFcjs.getFarmDocsRoots.call(void 0, config.docs).map((docsRoot) => docsRoot.entry) : void 0,
|
|
2450
|
+
adapterOwnsDocsRuntime ? _optionalChain([config, 'access', _80 => _80.docs, 'access', _81 => _81.adapter, 'optionalAccess', _82 => _82.react]) : void 0,
|
|
2451
|
+
config.i18n,
|
|
2452
|
+
config.plugins,
|
|
2453
|
+
config.renderer,
|
|
2454
|
+
config.publicRuntimeConfig,
|
|
2455
|
+
config.trailingSlash,
|
|
2456
|
+
_chunkZP32GNJQcjs.getIntegrationProviders.call(void 0, config.integrations),
|
|
2457
|
+
config.basePath,
|
|
2458
|
+
_chunkUYSTTPYJcjs.generateClientCachePersistenceCode.call(void 0, _chunkUYSTTPYJcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
|
|
2459
|
+
adapterOwnsDocsRuntime ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0,
|
|
2460
|
+
_chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _83 => _83.experimental, 'optionalAccess', _84 => _84.serverComponents])) === "islands",
|
|
2461
|
+
platform,
|
|
2462
|
+
islandsMode ? _chunkUYSTTPYJcjs.collectFarmServerStylesheets.call(void 0,
|
|
2463
|
+
[
|
|
2464
|
+
...layoutRoutes.map((layout) => layout.modulePath),
|
|
2465
|
+
...pageRoutes.filter((route) => !isAdapterDocsRoute(route.pattern)).map((route) => route.modulePath)
|
|
2466
|
+
],
|
|
2467
|
+
root
|
|
2468
|
+
) : []
|
|
2469
|
+
);
|
|
2470
|
+
const entryName = platform === "mobile" ? _chunkEFZGB7JCcjs.FARM_MOBILE_CLIENT_ENTRY_NAME : "farm-client";
|
|
2471
|
+
await fs4.writeFile(clientEntryPath, clientHydrationCode);
|
|
2472
|
+
const clientInput = { [entryName]: clientEntryPath };
|
|
2473
|
+
if (platform === "web" && _chunkUYSTTPYJcjs.canBootFarmIslandsClient.call(void 0, config)) {
|
|
2474
|
+
const clientBootPath = _path2.default.join(clientEntryDir, "farm-client-boot.tsx");
|
|
2475
|
+
await fs4.writeFile(
|
|
2476
|
+
clientBootPath,
|
|
2477
|
+
'import { startFarmIslandsBoot } from "@farm.js/core/internal/islands-boot";\nstartFarmIslandsBoot();\n'
|
|
2478
|
+
);
|
|
2479
|
+
clientInput[`${entryName}-boot`] = clientBootPath;
|
|
2480
|
+
}
|
|
2481
|
+
const hasScopedPostcssConfig = hasProjectPostcssConfig(root);
|
|
2482
|
+
let postcssSearchPath;
|
|
2483
|
+
let tailwindVitePlugin = void 0;
|
|
2484
|
+
const rendererVitePlugins = await _chunkRD623KW4cjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, root, {
|
|
2485
|
+
ssr: false,
|
|
2486
|
+
buildLifetime: rendererBuildLifetime
|
|
2487
|
+
});
|
|
2488
|
+
if (hasScopedPostcssConfig) {
|
|
2489
|
+
_chunkQMNWKQL4cjs.logger.info("\u{1F4E6} Using project PostCSS/Tailwind configuration");
|
|
2490
|
+
} else {
|
|
2491
|
+
const postcssConfigPath = _path2.default.join(clientEntryDir, "postcss.config.cjs");
|
|
2492
|
+
await fs4.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
|
|
2493
|
+
postcssSearchPath = clientEntryDir;
|
|
2494
|
+
tailwindVitePlugin = await _chunkR53QDV6Tcjs.loadTailwindVitePlugin.call(void 0, {
|
|
2495
|
+
builder: productionVite.builder,
|
|
2496
|
+
announce: true
|
|
2497
|
+
});
|
|
2498
|
+
}
|
|
2499
|
+
try {
|
|
2500
|
+
const clientViteConfig = {
|
|
2501
|
+
root,
|
|
2502
|
+
// Vite otherwise falls back to <root>/public, silently dropping every
|
|
2503
|
+
// asset in a custom config.publicDir from the production client output.
|
|
2504
|
+
// The mobile client adds to the web client's output; public files are copied once.
|
|
2505
|
+
publicDir: platform === "mobile" ? false : config.publicDir,
|
|
2506
|
+
esbuild: {
|
|
2507
|
+
jsxDev: false
|
|
2508
|
+
},
|
|
2509
|
+
build: {
|
|
2510
|
+
// Preserve Farm's Vite 5 browser baseline when the production builder
|
|
2511
|
+
// uses Vite 8, whose default target only covers newer browsers.
|
|
2512
|
+
target: FARM_CLIENT_BUILD_TARGET,
|
|
2513
|
+
outDir: outputDir,
|
|
2514
|
+
emptyOutDir: platform === "web",
|
|
2515
|
+
// Never public: see resolveFarmClientSourcemap.
|
|
2516
|
+
sourcemap: resolveFarmClientSourcemap(_optionalChain([config, 'access', _85 => _85.vite, 'optionalAccess', _86 => _86.build, 'optionalAccess', _87 => _87.sourcemap])),
|
|
2517
|
+
assetsInlineLimit: 0,
|
|
2518
|
+
cssCodeSplit: false,
|
|
2519
|
+
// Bundle all CSS into one file
|
|
2520
|
+
rollupOptions: {
|
|
2521
|
+
input: clientInput,
|
|
2522
|
+
output: {
|
|
2523
|
+
entryFileNames: "[name]-h[hash].js",
|
|
2524
|
+
chunkFileNames: "chunks/[name]-h[hash].js",
|
|
2525
|
+
hashCharacters: "hex",
|
|
2526
|
+
// Use predictable name for CSS so we can reference it in SSR HTML
|
|
2527
|
+
assetFileNames: (assetInfo) => {
|
|
2528
|
+
if (_optionalChain([assetInfo, 'access', _88 => _88.name, 'optionalAccess', _89 => _89.endsWith, 'call', _90 => _90(".css")])) {
|
|
2529
|
+
return `${entryName}.css`;
|
|
2530
|
+
}
|
|
2531
|
+
return "assets/[name]-h[hash][extname]";
|
|
2451
2532
|
}
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
return
|
|
2533
|
+
},
|
|
2534
|
+
// A browser cannot load a Node builtin: farmServerOnlyEntriesPlugin
|
|
2535
|
+
// resolves one to Farm's browser module for it instead.
|
|
2536
|
+
external: (id) => {
|
|
2537
|
+
if (id === "fsevents" || id.includes("fsevents") || id.endsWith(".node")) {
|
|
2538
|
+
return true;
|
|
2539
|
+
}
|
|
2540
|
+
return false;
|
|
2460
2541
|
}
|
|
2461
|
-
return false;
|
|
2462
2542
|
}
|
|
2463
|
-
}
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2543
|
+
},
|
|
2544
|
+
plugins: [
|
|
2545
|
+
_chunkUYSTTPYJcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
2546
|
+
createFarmPrivateClientSourcemapsPlugin({
|
|
2547
|
+
outDir: _path2.default.join(
|
|
2548
|
+
_path2.default.dirname(outputDir),
|
|
2549
|
+
platform === "mobile" ? `${FARM_CLIENT_SOURCEMAPS_DIR}-mobile` : FARM_CLIENT_SOURCEMAPS_DIR
|
|
2550
|
+
)
|
|
2551
|
+
}),
|
|
2552
|
+
// The web client's preload manifests; the mobile client records its files instead.
|
|
2553
|
+
platform === "mobile" ? _chunkEFZGB7JCcjs.createFarmMobileClientManifestPlugin.call(void 0, {
|
|
2554
|
+
buildDir: _path2.default.dirname(outputDir),
|
|
2555
|
+
entryName
|
|
2556
|
+
}) : createFarmClientModulePreloadPlugin({
|
|
2477
2557
|
root,
|
|
2478
2558
|
buildDir: _path2.default.dirname(outputDir),
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2559
|
+
entryName: "farm-client"
|
|
2560
|
+
}),
|
|
2561
|
+
...adapterOwnsDocsRuntime && platform === "web" ? [
|
|
2562
|
+
createFarmDocsModulePreloadPlugin({
|
|
2563
|
+
root,
|
|
2564
|
+
buildDir: _path2.default.dirname(outputDir),
|
|
2565
|
+
importer: clientEntryPath,
|
|
2566
|
+
entryName: "farm-client",
|
|
2567
|
+
modules: [
|
|
2568
|
+
config.docs.adapter.react,
|
|
2569
|
+
_chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs)
|
|
2570
|
+
].filter((specifier) => Boolean(specifier))
|
|
2571
|
+
})
|
|
2572
|
+
] : [],
|
|
2573
|
+
...tailwindVitePlugin ? [tailwindVitePlugin] : [],
|
|
2574
|
+
...rendererVitePlugins,
|
|
2575
|
+
...config.vite.plugins || [],
|
|
2576
|
+
farmServerOnlyEntriesPlugin({ platform }),
|
|
2577
|
+
_chunkUYSTTPYJcjs.farmDocsClientConfigPlugin.call(void 0,
|
|
2578
|
+
adapterOwnsDocsRuntime ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
|
|
2579
|
+
),
|
|
2580
|
+
// Plugin to redirect @farm.js/core imports to client-only exports
|
|
2581
|
+
{
|
|
2582
|
+
name: "farm-client-only-imports",
|
|
2583
|
+
enforce: "pre",
|
|
2584
|
+
resolveId(id) {
|
|
2585
|
+
if (id === "@farm.js/core") {
|
|
2586
|
+
return { id: "\0farm-client-exports", external: false };
|
|
2587
|
+
}
|
|
2588
|
+
if (id === "@farm.js/core/i18n/server") {
|
|
2589
|
+
return { id: "\0farm-i18n-client-bridge", external: false };
|
|
2590
|
+
}
|
|
2591
|
+
if (id === "@farm.js/core/server" || id === "@farm.js/core/api" || id === "@farm.js/core/middleware" || id === "@farm.js/core/headers" || id === "@farm.js/core/config" || id.includes("@farm.js/core/middleware") || id.includes("@farm.js/core/query/server")) {
|
|
2592
|
+
return { id: "\0empty-module", external: false };
|
|
2593
|
+
}
|
|
2594
|
+
if (id.includes("/api/") && id.includes("/route")) {
|
|
2595
|
+
return { id: "\0empty-api-route", external: false };
|
|
2596
|
+
}
|
|
2597
|
+
if (id === "fsevents" || id.includes("fsevents") || id.endsWith(".node") || id === "nitro" || id === "vite" || id === "esbuild" || id === "rolldown" || id.startsWith("rolldown/") || id === "rollup" || id.startsWith("nitro/") || id.includes("node-pre-gyp") || id.includes("nf3")) {
|
|
2598
|
+
return { id: "\0empty-module", external: false };
|
|
2599
|
+
}
|
|
2600
|
+
return null;
|
|
2601
|
+
},
|
|
2602
|
+
load(id) {
|
|
2603
|
+
if (id === "\0empty-module") {
|
|
2604
|
+
return "const emptyMiddlewareStore = new Map(); export default {}; export const getMiddlewareContext = () => emptyMiddlewareStore; export const getMiddlewareData = () => emptyMiddlewareStore; export const getMiddlewareValue = () => undefined; export const middleware = () => ({});";
|
|
2605
|
+
}
|
|
2606
|
+
if (id === "\0empty-api-route") {
|
|
2607
|
+
return "export const GET = () => {}; export const HEAD = () => {}; export const QUERY = () => {}; export const POST = () => {}; export const PUT = () => {}; export const DELETE = () => {}; export const PATCH = () => {}; export const OPTIONS = () => {}; export default {};";
|
|
2608
|
+
}
|
|
2609
|
+
if (id === "\0farm-i18n-client-bridge") {
|
|
2610
|
+
return 'export { createTranslator, format, getLocale, getLocaleSource, t } from "@farm.js/core/i18n/client";';
|
|
2611
|
+
}
|
|
2612
|
+
if (id === "\0farm-client-exports") {
|
|
2613
|
+
return [
|
|
2614
|
+
"// Farm.js Client Exports - Safe for browser bundling",
|
|
2615
|
+
'export { Link } from "@farm.js/core/client";',
|
|
2616
|
+
'export { useRouter } from "@farm.js/core/client";',
|
|
2617
|
+
'export { usePathname, useSearchParams } from "@farm.js/core/navigation";',
|
|
2618
|
+
// A page that hydrates ships to the browser with its notFound()/redirect() calls.
|
|
2619
|
+
'export { getFarmRedirectError, isFarmNotFoundError, isFarmRedirectError, notFound, permanentRedirect, redirect } from "@farm.js/core/navigation";',
|
|
2620
|
+
'export { createAPIClient } from "@farm.js/core/client";',
|
|
2621
|
+
'export { localFont, remoteFont } from "@farm.js/core/font";'
|
|
2622
|
+
].join("\n");
|
|
2623
|
+
}
|
|
2624
|
+
return null;
|
|
2513
2625
|
}
|
|
2514
|
-
return null;
|
|
2515
2626
|
},
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
'export { useRouter } from "@farm.js/core/client";',
|
|
2531
|
-
'export { usePathname, useSearchParams } from "@farm.js/core/navigation";',
|
|
2532
|
-
// A page that hydrates ships to the browser with its notFound()/redirect() calls.
|
|
2533
|
-
'export { getFarmRedirectError, isFarmNotFoundError, isFarmRedirectError, notFound, permanentRedirect, redirect } from "@farm.js/core/navigation";',
|
|
2534
|
-
'export { createAPIClient } from "@farm.js/core/client";',
|
|
2535
|
-
'export { localFont, remoteFont } from "@farm.js/core/font";'
|
|
2536
|
-
].join("\n");
|
|
2537
|
-
}
|
|
2538
|
-
return null;
|
|
2539
|
-
}
|
|
2627
|
+
farmPlugin(
|
|
2628
|
+
{ ...config, isolatedClientBoundaryModules, programmaticClientRoutes },
|
|
2629
|
+
pluginManager
|
|
2630
|
+
),
|
|
2631
|
+
_chunkNK2VWS7Pcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
|
|
2632
|
+
],
|
|
2633
|
+
mode: "production",
|
|
2634
|
+
css: postcssSearchPath ? {
|
|
2635
|
+
postcss: postcssSearchPath
|
|
2636
|
+
} : void 0,
|
|
2637
|
+
// Ensure React is bundled for client
|
|
2638
|
+
resolve: {
|
|
2639
|
+
alias: _chunkUYSTTPYJcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
2640
|
+
dedupe: [...config.renderer.dedupe || []]
|
|
2540
2641
|
},
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
}
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2642
|
+
// Optimize dependencies - exclude server-side code from client bundle
|
|
2643
|
+
optimizeDeps: {
|
|
2644
|
+
exclude: [
|
|
2645
|
+
"@farm.js/core/server",
|
|
2646
|
+
"@farm.js/core/api",
|
|
2647
|
+
"@farm.js/core/middleware",
|
|
2648
|
+
"@farm.js/core/headers"
|
|
2649
|
+
]
|
|
2650
|
+
}
|
|
2651
|
+
};
|
|
2652
|
+
await viteBuild(_chunkUYSTTPYJcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
|
|
2653
|
+
if (platform === "mobile") {
|
|
2654
|
+
await fs4.rm(_path2.default.join(outputDir, `${entryName}.css`), { force: true });
|
|
2655
|
+
if (!await _chunkEFZGB7JCcjs.hasFarmMobileClientEntry.call(void 0, _path2.default.dirname(outputDir), outputDir)) {
|
|
2656
|
+
throw new IncompleteClientBuildOutputError(
|
|
2657
|
+
`${_chunkEFZGB7JCcjs.FARM_MOBILE_CLIENT_ENTRY_NAME}.js is missing or empty`
|
|
2658
|
+
);
|
|
2659
|
+
}
|
|
2660
|
+
} else {
|
|
2661
|
+
await mergeBuiltFontCss(outputDir);
|
|
2662
|
+
await validateClientBuildOutput(root, srcDir, outputDir);
|
|
2663
|
+
}
|
|
2664
|
+
} finally {
|
|
2665
|
+
try {
|
|
2666
|
+
await fs4.rm(clientEntryDir, { recursive: true, force: true });
|
|
2667
|
+
} catch (e29) {
|
|
2564
2668
|
}
|
|
2565
|
-
};
|
|
2566
|
-
await viteBuild(_chunkWZW6LEHMcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
|
|
2567
|
-
await mergeBuiltFontCss(outputDir);
|
|
2568
|
-
await validateClientBuildOutput(root, srcDir, outputDir);
|
|
2569
|
-
} finally {
|
|
2570
|
-
try {
|
|
2571
|
-
await fs4.rm(clientEntryDir, { recursive: true, force: true });
|
|
2572
|
-
} catch (e27) {
|
|
2573
2669
|
}
|
|
2574
|
-
}
|
|
2670
|
+
};
|
|
2671
|
+
await buildTarget("web");
|
|
2672
|
+
if (mobile) await buildTarget("mobile");
|
|
2575
2673
|
}
|
|
2576
2674
|
function toBakedMarkdownSourcePath(root, filePath) {
|
|
2577
2675
|
if (!filePath) return "";
|
|
@@ -2650,48 +2748,7 @@ async function fetchFarmNavigationDocument(url, headers, recover = true, signal)
|
|
|
2650
2748
|
return response;
|
|
2651
2749
|
}
|
|
2652
2750
|
|
|
2653
|
-
${streamNavigations ?
|
|
2654
|
-
// with each later flush as it ends, and null at the end; a document without a marker is all shell.
|
|
2655
|
-
// The marker carries the random token the server sent in the F-Flush header, so page content
|
|
2656
|
-
// cannot forge a boundary; a response without a valid token is all shell.
|
|
2657
|
-
async function readFarmNavigationStream(body, flushToken) {
|
|
2658
|
-
const reader = body.getReader();
|
|
2659
|
-
const decoder = new TextDecoder();
|
|
2660
|
-
const marker = typeof flushToken === "string" && /^[0-9a-f]{32}$/.test(flushToken)
|
|
2661
|
-
? "<!--farm-flush:" + flushToken + "-->"
|
|
2662
|
-
: "";
|
|
2663
|
-
let text = "";
|
|
2664
|
-
let done = false;
|
|
2665
|
-
const next = async function() {
|
|
2666
|
-
for (;;) {
|
|
2667
|
-
const at = marker ? text.indexOf(marker) : -1;
|
|
2668
|
-
if (at !== -1) {
|
|
2669
|
-
const flush = text.slice(0, at);
|
|
2670
|
-
text = text.slice(at + marker.length);
|
|
2671
|
-
return flush;
|
|
2672
|
-
}
|
|
2673
|
-
if (done) {
|
|
2674
|
-
const flush = text;
|
|
2675
|
-
text = "";
|
|
2676
|
-
return flush ? flush : null;
|
|
2677
|
-
}
|
|
2678
|
-
const result = await reader.read();
|
|
2679
|
-
if (result.done) {
|
|
2680
|
-
done = true;
|
|
2681
|
-
text += decoder.decode();
|
|
2682
|
-
} else {
|
|
2683
|
-
text += decoder.decode(result.value, { stream: true });
|
|
2684
|
-
}
|
|
2685
|
-
}
|
|
2686
|
-
};
|
|
2687
|
-
const shell = await next();
|
|
2688
|
-
if (done && !text) return { shell: shell || "" };
|
|
2689
|
-
return {
|
|
2690
|
-
shell: shell,
|
|
2691
|
-
next: next,
|
|
2692
|
-
cancel: function() { reader.cancel().catch(function() {}); },
|
|
2693
|
-
};
|
|
2694
|
-
}` : ""}
|
|
2751
|
+
${streamNavigations ? _chunkUYSTTPYJcjs.FARM_NAVIGATION_STREAM_READER_SOURCE : ""}
|
|
2695
2752
|
|
|
2696
2753
|
function clearFarmPrefetchCacheOnDeploymentMismatch(router, error) {
|
|
2697
2754
|
if (error?.name === "FarmDeploymentMismatchError") {
|
|
@@ -3447,41 +3504,55 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
3447
3504
|
secure: false
|
|
3448
3505
|
},
|
|
3449
3506
|
direction: {}
|
|
3450
|
-
}, plugins = [], renderer = _chunkRD623KW4cjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule, islandValues = false) {
|
|
3507
|
+
}, plugins = [], renderer = _chunkRD623KW4cjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule, islandValues = false, platform, serverStylesheets = []) {
|
|
3451
3508
|
const toImportPath = (targetPath) => targetPath.replace(/\\/g, "/");
|
|
3452
|
-
const clientPluginEntry =
|
|
3509
|
+
const clientPluginEntry = _chunkUYSTTPYJcjs.generateFarmClientPluginEntryCode.call(void 0,
|
|
3453
3510
|
plugins,
|
|
3454
3511
|
root,
|
|
3455
3512
|
srcDir,
|
|
3456
|
-
publicRuntimeConfig
|
|
3513
|
+
publicRuntimeConfig,
|
|
3514
|
+
platform
|
|
3457
3515
|
);
|
|
3458
3516
|
const appSetupPath = _chunkRD623KW4cjs.resolveFarmRendererAppSetup.call(void 0, root, renderer);
|
|
3459
3517
|
const rendererClientImports = _chunkRD623KW4cjs.isReactRenderer.call(void 0, renderer) ? `import React from "react";
|
|
3460
3518
|
import { createRoot, hydrateRoot } from "react-dom/client";` : appSetupPath ? `import React, { createRoot, hydrateRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)};
|
|
3461
|
-
import __farmAppSetup from ${JSON.stringify(
|
|
3519
|
+
import __farmAppSetup from ${JSON.stringify(_chunkQMNWKQL4cjs.toPosixPath.call(void 0, appSetupPath))};
|
|
3462
3520
|
__farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};`;
|
|
3463
|
-
const providerClientCode =
|
|
3521
|
+
const providerClientCode = _chunkUYSTTPYJcjs.generateFarmIntegrationProviderClientCode.call(void 0,
|
|
3464
3522
|
integrationProviders,
|
|
3465
3523
|
root,
|
|
3466
3524
|
_nullishCoalesce(renderer.componentExtensions, () => ( []))
|
|
3467
3525
|
);
|
|
3468
3526
|
const globalsCssPath = _path2.default.join(root, srcDir, "app", "globals.css");
|
|
3469
|
-
const
|
|
3527
|
+
const serverStyleModules = [];
|
|
3528
|
+
const cssImport = [
|
|
3529
|
+
..._fs.existsSync.call(void 0, globalsCssPath) ? [globalsCssPath] : [],
|
|
3530
|
+
...serverStylesheets.filter((stylesheet) => stylesheet !== globalsCssPath)
|
|
3531
|
+
].map((stylesheet) => {
|
|
3532
|
+
if (!/\.module\.[a-z]+$/.test(stylesheet)) {
|
|
3533
|
+
return `import ${JSON.stringify(toImportPath(stylesheet))};`;
|
|
3534
|
+
}
|
|
3535
|
+
const binding = `__farmServerStyle${serverStyleModules.length}`;
|
|
3536
|
+
serverStyleModules.push(binding);
|
|
3537
|
+
return `import * as ${binding} from ${JSON.stringify(toImportPath(stylesheet))};`;
|
|
3538
|
+
}).concat(
|
|
3539
|
+
serverStyleModules.length > 0 ? [`globalThis.__FARM_SERVER_STYLES__ = [${serverStyleModules.join(", ")}];`] : []
|
|
3540
|
+
).join("\n");
|
|
3470
3541
|
const layoutImportStatements = [];
|
|
3471
3542
|
const layoutRegistrations = [];
|
|
3472
3543
|
const hydratingLayoutPatterns = layoutRoutes.filter((layout) => layout.shouldHydrate).map((layout) => layout.pattern);
|
|
3473
|
-
const treeLayoutPatterns = islandValues ?
|
|
3544
|
+
const treeLayoutPatterns = islandValues ? _chunkO27PLNQZcjs.getFarmServerTreeLayoutPatterns.call(void 0, layoutRoutes) : /* @__PURE__ */ new Set();
|
|
3474
3545
|
layoutRoutes.forEach((layout, index) => {
|
|
3475
3546
|
const relativePath = toImportPath(layout.modulePath);
|
|
3476
3547
|
const treeLayout = treeLayoutPatterns.has(layout.pattern);
|
|
3477
3548
|
const rendersOnClient = treeLayout || !layout.hasIsolatedClientBoundaries && hydratingLayoutPatterns.some(
|
|
3478
|
-
(pattern) =>
|
|
3549
|
+
(pattern) => _chunkO27PLNQZcjs.layoutsCanCoverSamePage.call(void 0, layout.pattern, pattern)
|
|
3479
3550
|
);
|
|
3480
3551
|
if (rendersOnClient && !treeLayout) {
|
|
3481
3552
|
layoutImportStatements.push(`import Layout${index} from "${relativePath}";`);
|
|
3482
3553
|
}
|
|
3483
|
-
const groupScope =
|
|
3484
|
-
const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(
|
|
3554
|
+
const groupScope = _chunkO27PLNQZcjs.getRouteGroupScope.call(void 0, layout.pattern);
|
|
3555
|
+
const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(_chunkO27PLNQZcjs.stripRouteGroups.call(void 0, layout.pattern))}, groupScope: ${JSON.stringify(groupScope)}` : "";
|
|
3485
3556
|
layoutRegistrations.push(
|
|
3486
3557
|
` { 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" : ""} }`
|
|
3487
3558
|
);
|
|
@@ -3842,7 +3913,7 @@ document.addEventListener("click", function(e) {
|
|
|
3842
3913
|
clientPages.forEach((page) => {
|
|
3843
3914
|
for (const boundary of page.isolatedBoundaries) {
|
|
3844
3915
|
isolatedBoundaryModules.set(
|
|
3845
|
-
|
|
3916
|
+
_chunkQMNWKQL4cjs.toViteModuleId.call(void 0, boundary.modulePath, root),
|
|
3846
3917
|
toImportPath(boundary.modulePath)
|
|
3847
3918
|
);
|
|
3848
3919
|
}
|
|
@@ -4004,7 +4075,7 @@ function hasHydratableLayout(pathname) {
|
|
|
4004
4075
|
});
|
|
4005
4076
|
}
|
|
4006
4077
|
|
|
4007
|
-
${
|
|
4078
|
+
${_chunkUYSTTPYJcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
|
|
4008
4079
|
// Wrap a page element with applicable layouts
|
|
4009
4080
|
function wrapWithLayouts(pageElement, pathname, params) {
|
|
4010
4081
|
const layouts = getApplicableLayouts(pathname);
|
|
@@ -4039,7 +4110,7 @@ function createLayoutPageBoundary(route, pageElement, serverHtml) {
|
|
|
4039
4110
|
return React.createElement("div", props, pageElement);
|
|
4040
4111
|
}
|
|
4041
4112
|
let farmLastRouteState = null;
|
|
4042
|
-
${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${
|
|
4113
|
+
${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${_chunkUYSTTPYJcjs.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE}
|
|
4043
4114
|
function farmTreeLayoutsOf(pathname) {
|
|
4044
4115
|
return getApplicableLayouts(pathname).filter(function(layout) {
|
|
4045
4116
|
return layout.serverTree === true;
|
|
@@ -4406,9 +4477,9 @@ async function hydrate() {
|
|
|
4406
4477
|
!matched.route.pageShouldHydrate &&
|
|
4407
4478
|
!hasHydratableLayout(pathname)
|
|
4408
4479
|
) {
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
await hydrateFarmIsolatedClientBoundaries(document
|
|
4480
|
+
// Not cancelled by a navigation: an island it removes is disposed with its DOM, and one in a
|
|
4481
|
+
// layout it keeps still waits for its trigger, with any click it already holds.
|
|
4482
|
+
await hydrateFarmIsolatedClientBoundaries(document);
|
|
4412
4483
|
return;
|
|
4413
4484
|
}` : ""}
|
|
4414
4485
|
|
|
@@ -5169,7 +5240,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5169
5240
|
_path2.default.join(postcssConfigDir, "postcss.config.cjs"),
|
|
5170
5241
|
"module.exports = { plugins: [] };\n"
|
|
5171
5242
|
);
|
|
5172
|
-
tailwindVitePlugin = await
|
|
5243
|
+
tailwindVitePlugin = await _chunkR53QDV6Tcjs.loadTailwindVitePlugin.call(void 0, {
|
|
5173
5244
|
builder: productionVite.builder,
|
|
5174
5245
|
label: "for SSR"
|
|
5175
5246
|
});
|
|
@@ -5243,6 +5314,10 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5243
5314
|
modulePath: entry.modulePath
|
|
5244
5315
|
})
|
|
5245
5316
|
);
|
|
5317
|
+
const mobileShellLoadingRoutes = config.mobileShells ? Array.from(routeManager.getLoadings().values(), (entry) => ({
|
|
5318
|
+
pattern: entry.pattern,
|
|
5319
|
+
modulePath: entry.modulePath
|
|
5320
|
+
})) : [];
|
|
5246
5321
|
const i18nCatalogs = config.i18n.enabled ? (await _chunkBBPDJGCUcjs.readFarmI18nCatalogs.call(void 0, config.i18n)).catalogs : {};
|
|
5247
5322
|
const appDirs = _chunk5Y2P454Ocjs.getFarmAppDirectories.call(void 0, config);
|
|
5248
5323
|
let openAPIReference = null;
|
|
@@ -5265,14 +5340,14 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5265
5340
|
}
|
|
5266
5341
|
const middlewareRoutes = await discoverMiddlewareRoutes(appDirs);
|
|
5267
5342
|
const instrumentationPath = _chunkBRWIVOV4cjs.resolveFarmInstrumentationFile.call(void 0, root, config.srcDir || "src");
|
|
5268
|
-
const notFoundPath =
|
|
5269
|
-
if (notFoundPath)
|
|
5343
|
+
const notFoundPath = _chunkUYSTTPYJcjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
|
|
5344
|
+
if (notFoundPath) _chunkQMNWKQL4cjs.logger.info(`\u{1F4CB} Found custom 404 page: ${notFoundPath}`);
|
|
5270
5345
|
layoutRoutes.sort((a, b) => {
|
|
5271
5346
|
const depthA = a.pattern.split("/").filter(Boolean).length;
|
|
5272
5347
|
const depthB = b.pattern.split("/").filter(Boolean).length;
|
|
5273
5348
|
return depthA - depthB;
|
|
5274
5349
|
});
|
|
5275
|
-
|
|
5350
|
+
_chunkQMNWKQL4cjs.logger.info(
|
|
5276
5351
|
`\u{1F4CB} Found ${pageRoutes.length} page routes, ${layoutRoutes.length} layouts, ${apiRoutes.length} API routes, ${applicationMetadataRoutes.length} metadata routes, and ${middlewareRoutes.length} middleware files`
|
|
5277
5352
|
);
|
|
5278
5353
|
const configuredIntegrationValues = Object.values(config.integrations || {});
|
|
@@ -5282,13 +5357,13 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5282
5357
|
const hasServerRuntimeIntegrations = configuredIntegrationValues.some(
|
|
5283
5358
|
(integration) => typeof integration === "object" && integration !== null && (!("serverRuntime" in integration) || integration.serverRuntime !== false)
|
|
5284
5359
|
);
|
|
5285
|
-
const hasIntegrationProviders =
|
|
5360
|
+
const hasIntegrationProviders = _chunkZP32GNJQcjs.getIntegrationProviders.call(void 0, config.integrations).some(
|
|
5286
5361
|
(provider) => provider.component || provider.type === "clerk"
|
|
5287
5362
|
);
|
|
5288
5363
|
const hasObservabilityHandler = !!config.observability && typeof config.observability === "object" && "onEvent" in config.observability;
|
|
5289
|
-
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access',
|
|
5290
|
-
const hasMiddlewareConfig =
|
|
5291
|
-
const hasRouteContextConfig =
|
|
5364
|
+
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _91 => _91.mdx, 'optionalAccess', _92 => _92.components]));
|
|
5365
|
+
const hasMiddlewareConfig = _chunkO27PLNQZcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
|
|
5366
|
+
const hasRouteContextConfig = _chunkNQJDO7K7cjs.hasCustomFarmRouteContext.call(void 0, config);
|
|
5292
5367
|
const hasServerRuntimePlugins = hasFarmServerRuntimePlugins(config);
|
|
5293
5368
|
const hasPluginRoutes = hasFarmPluginRoutes(config);
|
|
5294
5369
|
const hasServerCacheConfig = hasFarmServerCacheConfig(config.cache);
|
|
@@ -5298,18 +5373,18 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5298
5373
|
const hasConfiguredRuntimePlugins = Boolean(
|
|
5299
5374
|
hasRuntimeConfigModule && (config.plugins || []).length > 0
|
|
5300
5375
|
);
|
|
5301
|
-
if (
|
|
5376
|
+
if (_chunkIFXSBJPNcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
|
|
5302
5377
|
const adapterGuardedPaths = new Set(getFarmDocsGuardedPaths(config, middlewareRoutes));
|
|
5303
|
-
|
|
5378
|
+
_chunkIFXSBJPNcjs.assertFarmDocsAdapterServesNoGuardedPages.call(void 0,
|
|
5304
5379
|
config.docs,
|
|
5305
5380
|
{ root, srcDir: config.srcDir },
|
|
5306
5381
|
(pathname) => adapterGuardedPaths.has(pathname)
|
|
5307
5382
|
);
|
|
5308
5383
|
}
|
|
5309
5384
|
const farmDocsCspNonceMarker = _chunk6JHZPB52cjs.createFarmCspNonce.call(void 0, config.security);
|
|
5310
|
-
const farmDocsPrecompiledManifest = _optionalChain([config, 'access',
|
|
5385
|
+
const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _93 => _93.docs, 'optionalAccess', _94 => _94.enabled]) && _chunkE552H232cjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? await _chunkHNAISJFDcjs._runWithFarmCspNonce.call(void 0,
|
|
5311
5386
|
farmDocsCspNonceMarker,
|
|
5312
|
-
async () => _optionalChain([config, 'access',
|
|
5387
|
+
async () => _optionalChain([config, 'access', _95 => _95.docs, 'access', _96 => _96.adapter, 'optionalAccess', _97 => _97.server]) ? await _chunkIFXSBJPNcjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
|
|
5313
5388
|
root,
|
|
5314
5389
|
srcDir: config.srcDir,
|
|
5315
5390
|
clientEntry: FARM_CLIENT_JS_SRC_PLACEHOLDER,
|
|
@@ -5356,7 +5431,8 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5356
5431
|
preset,
|
|
5357
5432
|
i18nCatalogs,
|
|
5358
5433
|
isolatedClientBoundaryModules,
|
|
5359
|
-
hydrationPlanCache
|
|
5434
|
+
hydrationPlanCache,
|
|
5435
|
+
mobileShellLoadingRoutes
|
|
5360
5436
|
);
|
|
5361
5437
|
const virtualEntryId = "\0virtual:farm-ssr-entry";
|
|
5362
5438
|
const useExternalMetadataImageRuntime = shouldUseExternalMetadataImageRuntime(preset, true);
|
|
@@ -5418,7 +5494,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5418
5494
|
// Adapters can render provider scripts by serializing function source.
|
|
5419
5495
|
// keepNames injects helper calls into those functions; after Nitro
|
|
5420
5496
|
// minifies the server chunk the helper is no longer in script scope.
|
|
5421
|
-
keepNames: !(_optionalChain([config, 'access',
|
|
5497
|
+
keepNames: !(_optionalChain([config, 'access', _98 => _98.docs, 'optionalAccess', _99 => _99.enabled]) && _optionalChain([config, 'access', _100 => _100.docs, 'access', _101 => _101.adapter, 'optionalAccess', _102 => _102.server])),
|
|
5422
5498
|
jsxDev: false
|
|
5423
5499
|
},
|
|
5424
5500
|
// SSR configuration to externalize problematic modules
|
|
@@ -5468,10 +5544,10 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5468
5544
|
define: {
|
|
5469
5545
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
5470
5546
|
__FARM_ENV__: JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, config.env)),
|
|
5471
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
5547
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _103 => _103.env, 'optionalAccess', _104 => _104.public]) || {})
|
|
5472
5548
|
},
|
|
5473
5549
|
plugins: [
|
|
5474
|
-
|
|
5550
|
+
_chunkUYSTTPYJcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
5475
5551
|
...tailwindVitePlugin ? [tailwindVitePlugin] : [],
|
|
5476
5552
|
...rendererVitePlugins,
|
|
5477
5553
|
...config.vite.plugins || [],
|
|
@@ -5532,7 +5608,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5532
5608
|
resolve: {
|
|
5533
5609
|
alias: [
|
|
5534
5610
|
...shouldAliasReactServerToWebBuild(config.renderer, preset) ? [createFarmReactWebServerAlias(hasReactDomEdgeServerBuild(root))] : [],
|
|
5535
|
-
...Object.entries(
|
|
5611
|
+
...Object.entries(_chunkUYSTTPYJcjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
|
|
5536
5612
|
([find, replacement]) => ({ find, replacement })
|
|
5537
5613
|
)
|
|
5538
5614
|
],
|
|
@@ -5540,12 +5616,12 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5540
5616
|
dedupe: [...config.renderer.dedupe || []]
|
|
5541
5617
|
}
|
|
5542
5618
|
};
|
|
5543
|
-
await viteBuild(
|
|
5619
|
+
await viteBuild(_chunkUYSTTPYJcjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
|
|
5544
5620
|
} finally {
|
|
5545
5621
|
if (postcssConfigDir) {
|
|
5546
5622
|
try {
|
|
5547
5623
|
await fs4.rm(postcssConfigDir, { recursive: true, force: true });
|
|
5548
|
-
} catch (
|
|
5624
|
+
} catch (e30) {
|
|
5549
5625
|
}
|
|
5550
5626
|
}
|
|
5551
5627
|
}
|
|
@@ -5558,7 +5634,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5558
5634
|
function readFarmAppPackageIdentity(root) {
|
|
5559
5635
|
try {
|
|
5560
5636
|
return JSON.parse(_fs.readFileSync.call(void 0, _path2.default.join(root, "package.json"), "utf8"));
|
|
5561
|
-
} catch (
|
|
5637
|
+
} catch (e31) {
|
|
5562
5638
|
return {};
|
|
5563
5639
|
}
|
|
5564
5640
|
}
|
|
@@ -5570,32 +5646,32 @@ function readFarmPageLastModified(pageRoutes) {
|
|
|
5570
5646
|
lastModified[route.pattern] = _fs.statSync.call(void 0,
|
|
5571
5647
|
_nullishCoalesce(route.markdownSourcePath, () => ( route.modulePath))
|
|
5572
5648
|
).mtime.toISOString();
|
|
5573
|
-
} catch (
|
|
5649
|
+
} catch (e32) {
|
|
5574
5650
|
}
|
|
5575
5651
|
}
|
|
5576
5652
|
return lastModified;
|
|
5577
5653
|
}
|
|
5578
5654
|
function getFarmDocsGuardedPaths(config, middlewareRoutes) {
|
|
5579
|
-
if (!_optionalChain([config, 'access',
|
|
5655
|
+
if (!_optionalChain([config, 'access', _105 => _105.docs, 'optionalAccess', _106 => _106.enabled])) return [];
|
|
5580
5656
|
const options = { root: config.root, srcDir: config.srcDir };
|
|
5581
5657
|
const guards = {
|
|
5582
5658
|
config: { middleware: config.middleware, integrations: config.integrations },
|
|
5583
5659
|
middlewareRoutes
|
|
5584
5660
|
};
|
|
5585
|
-
return
|
|
5586
|
-
(docsRoot) =>
|
|
5587
|
-
).flatMap((page) => [page.href,
|
|
5661
|
+
return _chunk5JNUYGNFcjs.getFarmDocsRoots.call(void 0, config.docs).flatMap(
|
|
5662
|
+
(docsRoot) => _chunk5JNUYGNFcjs.discoverFarmDocsPages.call(void 0, _chunk5JNUYGNFcjs.resolveFarmDocsContentDir.call(void 0, docsRoot, options), docsRoot)
|
|
5663
|
+
).flatMap((page) => [page.href, _chunk5JNUYGNFcjs.getFarmDocsMarkdownPath.call(void 0, page.href)]).filter((pathname) => _chunkO27PLNQZcjs.farmPathGuardCoversPage.call(void 0, guards, pathname));
|
|
5588
5664
|
}
|
|
5589
5665
|
function getFarmAppOwnedDocsEnginePaths(agent, applicationMetadataRoutes) {
|
|
5590
|
-
const llmsTxt = _optionalChain([agent, 'optionalAccess',
|
|
5666
|
+
const llmsTxt = _optionalChain([agent, 'optionalAccess', _107 => _107.llmsTxt]);
|
|
5591
5667
|
const ownedByFile = (kind) => applicationMetadataRoutes.some(
|
|
5592
5668
|
(metadata) => metadata.kind === kind && metadata.pattern === "/"
|
|
5593
5669
|
);
|
|
5594
5670
|
return [
|
|
5595
|
-
..._optionalChain([llmsTxt, 'optionalAccess',
|
|
5596
|
-
..._optionalChain([llmsTxt, 'optionalAccess',
|
|
5597
|
-
..._optionalChain([agent, 'optionalAccess',
|
|
5598
|
-
..._optionalChain([agent, 'optionalAccess',
|
|
5671
|
+
..._optionalChain([llmsTxt, 'optionalAccess', _108 => _108.enabled]) || ownedByFile("llms") ? ["/llms.txt"] : [],
|
|
5672
|
+
..._optionalChain([llmsTxt, 'optionalAccess', _109 => _109.enabled]) && llmsTxt.full || ownedByFile("llms-full") ? ["/llms-full.txt"] : [],
|
|
5673
|
+
..._optionalChain([agent, 'optionalAccess', _110 => _110.sitemap, 'optionalAccess', _111 => _111.enabled]) || ownedByFile("sitemap") ? ["/sitemap.xml"] : [],
|
|
5674
|
+
..._optionalChain([agent, 'optionalAccess', _112 => _112.crawlers, 'optionalAccess', _113 => _113.enabled]) || ownedByFile("robots") ? ["/robots.txt"] : []
|
|
5599
5675
|
];
|
|
5600
5676
|
}
|
|
5601
5677
|
function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
@@ -5606,7 +5682,7 @@ function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
|
5606
5682
|
docsPath: ${root}.entry,
|
|
5607
5683
|
contentDir: ${root}.contentDir || ${root}.config?.contentDir,
|
|
5608
5684
|
}`;
|
|
5609
|
-
if (_optionalChain([docs, 'optionalAccess',
|
|
5685
|
+
if (_optionalChain([docs, 'optionalAccess', _114 => _114.roots, 'optionalAccess', _115 => _115.length])) {
|
|
5610
5686
|
return {
|
|
5611
5687
|
factory: "createFarmDocsAdapterMultiRuntimeHandler",
|
|
5612
5688
|
config: `[farmDocsResolvedConfig, ...farmDocsResolvedConfig.roots].map((farmDocsRoot) => (${runtimeConfig("farmDocsRoot")}))`
|
|
@@ -5619,7 +5695,7 @@ function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
|
5619
5695
|
}
|
|
5620
5696
|
function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
|
|
5621
5697
|
if (!docs.enabled) return "null";
|
|
5622
|
-
const serializableDocs = _optionalChain([docs, 'access',
|
|
5698
|
+
const serializableDocs = _optionalChain([docs, 'access', _116 => _116.roots, 'optionalAccess', _117 => _117.length]) ? {
|
|
5623
5699
|
...docs,
|
|
5624
5700
|
// React elements and functions do not survive JSON; see runtimeConfig below.
|
|
5625
5701
|
roots: docs.roots.map((docsRoot) => ({ ...docsRoot, runtimeConfig: void 0 }))
|
|
@@ -5653,7 +5729,7 @@ function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
|
|
|
5653
5729
|
},
|
|
5654
5730
|
}
|
|
5655
5731
|
: ${JSON.stringify({ ...serializableDocs, runtimeConfig: void 0 })}`;
|
|
5656
|
-
if (!_optionalChain([docs, 'access',
|
|
5732
|
+
if (!_optionalChain([docs, 'access', _118 => _118.roots, 'optionalAccess', _119 => _119.length])) return expression;
|
|
5657
5733
|
return `((farmDocs) => ({
|
|
5658
5734
|
...farmDocs,
|
|
5659
5735
|
roots: farmDocs.roots.map((farmDocsRoot, index) => {
|
|
@@ -5670,7 +5746,7 @@ function toVirtualEntryImportSpecifier(modulePath) {
|
|
|
5670
5746
|
return JSON.stringify(modulePath.replace(/\\/g, "/"));
|
|
5671
5747
|
}
|
|
5672
5748
|
function generateNativeAuthIntegrationSource(auth) {
|
|
5673
|
-
if (_optionalChain([auth, 'optionalAccess',
|
|
5749
|
+
if (_optionalChain([auth, 'optionalAccess', _120 => _120.enabled]) !== true) {
|
|
5674
5750
|
return { importSource: "", registerSource: "" };
|
|
5675
5751
|
}
|
|
5676
5752
|
return {
|
|
@@ -5956,30 +6032,33 @@ function generateFarmRendererAppSetupServerCode(config) {
|
|
|
5956
6032
|
const appSetupPath = _chunkRD623KW4cjs.resolveFarmRendererAppSetup.call(void 0, config.root || process.cwd(), config.renderer);
|
|
5957
6033
|
if (!appSetupPath) return "";
|
|
5958
6034
|
return `
|
|
5959
|
-
import __farmAppSetup from ${JSON.stringify(
|
|
6035
|
+
import __farmAppSetup from ${JSON.stringify(_chunkQMNWKQL4cjs.toPosixPath.call(void 0, appSetupPath))};
|
|
5960
6036
|
if (typeof ReactDOMServer.configureApp !== "function") {
|
|
5961
6037
|
throw new Error(${JSON.stringify(`Renderer \`${config.renderer.name}\` does not support \`appSetup\`: its server module must export configureApp().`)});
|
|
5962
6038
|
}
|
|
5963
6039
|
ReactDOMServer.configureApp(__farmAppSetup);`;
|
|
5964
6040
|
}
|
|
5965
|
-
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) {
|
|
5966
|
-
const farmIslandsMode = _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
6041
|
+
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 = []) {
|
|
6042
|
+
const farmIslandsMode = _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _121 => _121.experimental, 'optionalAccess', _122 => _122.serverComponents])) === "islands";
|
|
6043
|
+
const farmClientBoot = _chunkUYSTTPYJcjs.canBootFarmIslandsClient.call(void 0, config);
|
|
6044
|
+
const farmMobileClient = shouldBuildFarmMobileClient(config);
|
|
6045
|
+
const farmMobileShells = farmMobileClient && config.mobileShells ? config.mobileShells : null;
|
|
5967
6046
|
const hasCompressionRuntime = config.compress && _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
|
|
5968
|
-
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access',
|
|
6047
|
+
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access', _123 => _123.agent, 'optionalAccess', _124 => _124.crawlers, 'optionalAccess', _125 => _125.enabled])) && !applicationMetadataRoutes.some(
|
|
5969
6048
|
(metadata) => metadata.kind === "robots" && metadata.pattern === "/"
|
|
5970
6049
|
);
|
|
5971
|
-
const servesAgentSitemap = Boolean(_optionalChain([config, 'access',
|
|
6050
|
+
const servesAgentSitemap = Boolean(_optionalChain([config, 'access', _126 => _126.agent, 'optionalAccess', _127 => _127.sitemap, 'optionalAccess', _128 => _128.enabled])) && !applicationMetadataRoutes.some(
|
|
5972
6051
|
(metadata) => metadata.kind === "sitemap" && metadata.pattern === "/"
|
|
5973
6052
|
);
|
|
5974
|
-
const servesDefaultMCP = _optionalChain([config, 'access',
|
|
5975
|
-
const servesAiCatalog = _optionalChain([config, 'access',
|
|
6053
|
+
const servesDefaultMCP = _optionalChain([config, 'access', _129 => _129.agent, 'optionalAccess', _130 => _130.mcp]) === true && !_chunkQAS7KE7Jcjs.farmConfigMountsMCP.call(void 0, config) && !apiRoutes.some((route) => route.path === "/api/mcp");
|
|
6054
|
+
const servesAiCatalog = _optionalChain([config, 'access', _131 => _131.agent, 'optionalAccess', _132 => _132.aiCatalog]) !== false;
|
|
5976
6055
|
const hasPluginRuntime = hasRuntimeIntegrationConfig || hasServerRuntimePlugins;
|
|
5977
6056
|
const hasInfraAnalyticsRuntime = config.analytics !== false && _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
|
|
5978
6057
|
const hasPrecompiledDocs = Boolean(farmDocsPrecompiledManifest);
|
|
5979
6058
|
const adapterOwnsDocsRuntime = Boolean(
|
|
5980
|
-
_chunkRD623KW4cjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access',
|
|
6059
|
+
_chunkRD623KW4cjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _133 => _133.docs, 'optionalAccess', _134 => _134.enabled]) && _optionalChain([config, 'access', _135 => _135.docs, 'access', _136 => _136.adapter, 'optionalAccess', _137 => _137.server]) && config.docs.adapter.react
|
|
5981
6060
|
);
|
|
5982
|
-
if (_optionalChain([config, 'access',
|
|
6061
|
+
if (_optionalChain([config, 'access', _138 => _138.docs, 'optionalAccess', _139 => _139.enabled]) && _optionalChain([config, 'access', _140 => _140.docs, 'access', _141 => _141.roots, 'optionalAccess', _142 => _142.length]) && !adapterOwnsDocsRuntime) {
|
|
5983
6062
|
throw new Error(
|
|
5984
6063
|
"Several docs roots need the docs adapter, which serves the React renderer only; Farm's built-in docs renderer serves a single docs root."
|
|
5985
6064
|
);
|
|
@@ -6028,9 +6107,9 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6028
6107
|
const hasGeneratedMetadataImages = metadataImageRoutes.some(
|
|
6029
6108
|
(image) => image.sourceType === "module"
|
|
6030
6109
|
);
|
|
6031
|
-
const hasMiddlewareRuntime = middlewareRoutes.length > 0 ||
|
|
6032
|
-
const farmDocsFontAssets = _optionalChain([config, 'access',
|
|
6033
|
-
const integrationProviders =
|
|
6110
|
+
const hasMiddlewareRuntime = middlewareRoutes.length > 0 || _chunkO27PLNQZcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
|
|
6111
|
+
const farmDocsFontAssets = _optionalChain([config, 'access', _143 => _143.docs, 'optionalAccess', _144 => _144.enabled]) ? _chunkERMUL73Lcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkERMUL73Lcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
|
|
6112
|
+
const integrationProviders = _chunkZP32GNJQcjs.getIntegrationProviders.call(void 0, config.integrations);
|
|
6034
6113
|
const renderedIntegrationProviders = integrationProviders.filter(
|
|
6035
6114
|
(provider) => provider.component || provider.type === "clerk"
|
|
6036
6115
|
);
|
|
@@ -6039,16 +6118,16 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6039
6118
|
`Integration provider components are not supported by the "${config.renderer.name}" renderer.`
|
|
6040
6119
|
);
|
|
6041
6120
|
}
|
|
6042
|
-
const providerServerModules =
|
|
6121
|
+
const providerServerModules = _chunkUYSTTPYJcjs.generateFarmIntegrationProviderServerModules.call(void 0,
|
|
6043
6122
|
renderedIntegrationProviders,
|
|
6044
6123
|
config.root,
|
|
6045
6124
|
_nullishCoalesce(config.renderer.componentExtensions, () => ( []))
|
|
6046
6125
|
);
|
|
6047
6126
|
const resolvedIntegrationProviderFallback = Object.fromEntries(
|
|
6048
6127
|
Object.entries(config.integrations).flatMap(([name, integration]) => {
|
|
6049
|
-
const configuredProviders = _optionalChain([integration, 'optionalAccess',
|
|
6128
|
+
const configuredProviders = _optionalChain([integration, 'optionalAccess', _145 => _145.providers]);
|
|
6050
6129
|
const providers = Array.isArray(configuredProviders) ? configuredProviders : [];
|
|
6051
|
-
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess',
|
|
6130
|
+
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess', _146 => _146.component]) === "function")) {
|
|
6052
6131
|
throw new Error(
|
|
6053
6132
|
`Integration provider components in production must use an importable component reference, for example component: { module: "@/components/provider" }.`
|
|
6054
6133
|
);
|
|
@@ -6059,20 +6138,20 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6059
6138
|
const unsupportedIntegrationProvider = renderedIntegrationProviders.find(
|
|
6060
6139
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
6061
6140
|
);
|
|
6062
|
-
const isolatedHydrationMode =
|
|
6063
|
-
_optionalChain([config, 'access',
|
|
6141
|
+
const isolatedHydrationMode = _chunkUYSTTPYJcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
6142
|
+
_optionalChain([config, 'access', _147 => _147.experimental, 'optionalAccess', _148 => _148.isolatedClientHydration]),
|
|
6064
6143
|
{
|
|
6065
|
-
serverComponents: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
6144
|
+
serverComponents: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _149 => _149.experimental, 'optionalAccess', _150 => _150.serverComponents])) === "rsc",
|
|
6066
6145
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
6067
6146
|
}
|
|
6068
6147
|
);
|
|
6069
|
-
const hydrationPlanOptions =
|
|
6148
|
+
const hydrationPlanOptions = _chunkUYSTTPYJcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
6070
6149
|
config.renderer,
|
|
6071
6150
|
Boolean(unsupportedIntegrationProvider)
|
|
6072
6151
|
);
|
|
6073
6152
|
const pageHydrationPlanOptions = {
|
|
6074
6153
|
...hydrationPlanOptions,
|
|
6075
|
-
serverOwners: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
6154
|
+
serverOwners: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _151 => _151.experimental, 'optionalAccess', _152 => _152.serverComponents])) === "islands"
|
|
6076
6155
|
};
|
|
6077
6156
|
const layoutHydrationPlans = layoutRoutes.map((layout) => ({
|
|
6078
6157
|
...layout,
|
|
@@ -6084,7 +6163,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6084
6163
|
{ ...hydrationPlanOptions, serverTreeLayouts: pageHydrationPlanOptions.serverOwners }
|
|
6085
6164
|
)
|
|
6086
6165
|
}));
|
|
6087
|
-
const markdownPagePlan =
|
|
6166
|
+
const markdownPagePlan = _chunkUYSTTPYJcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
6088
6167
|
_chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), config.root),
|
|
6089
6168
|
config.root,
|
|
6090
6169
|
isolatedHydrationMode,
|
|
@@ -6093,7 +6172,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6093
6172
|
const pageHydrationPlans = new Map(
|
|
6094
6173
|
pageRoutes.map((route) => [
|
|
6095
6174
|
route.modulePath,
|
|
6096
|
-
|
|
6175
|
+
_chunkPRFNLQSPcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
|
|
6097
6176
|
route.modulePath,
|
|
6098
6177
|
config.root,
|
|
6099
6178
|
isolatedHydrationMode,
|
|
@@ -6102,7 +6181,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6102
6181
|
)
|
|
6103
6182
|
])
|
|
6104
6183
|
);
|
|
6105
|
-
|
|
6184
|
+
_chunkUYSTTPYJcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
6106
6185
|
layoutHydrationPlans.map((layout) => ({
|
|
6107
6186
|
pattern: layout.pattern,
|
|
6108
6187
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -6111,10 +6190,11 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6111
6190
|
pageRoutes.map((route) => ({
|
|
6112
6191
|
// Compared by directory so a grouped layout applies only inside its group.
|
|
6113
6192
|
pattern: _nullishCoalesce(route.directory, () => ( route.pattern)),
|
|
6114
|
-
depth:
|
|
6193
|
+
depth: _chunkO27PLNQZcjs.getRouteDirectoryDepth.call(void 0, _nullishCoalesce(route.directory, () => ( route.pattern))),
|
|
6115
6194
|
metadata: pageHydrationPlans.get(route.modulePath)
|
|
6116
6195
|
})),
|
|
6117
|
-
|
|
6196
|
+
_chunkO27PLNQZcjs.routeBoundaryCoversDirectory,
|
|
6197
|
+
{ serverOwners: pageHydrationPlanOptions.serverOwners }
|
|
6118
6198
|
);
|
|
6119
6199
|
const providerServerImports = [
|
|
6120
6200
|
providerServerModules.hasClerkProvider ? `import { ClerkProvider as FarmClerkProvider } from "@clerk/react";` : "",
|
|
@@ -6131,7 +6211,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6131
6211
|
apiRegistrations.push(`
|
|
6132
6212
|
{
|
|
6133
6213
|
path: ${JSON.stringify(route.path)},
|
|
6134
|
-
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access',
|
|
6214
|
+
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access', _153 => _153.pluginMethods, 'optionalAccess', _154 => _154.includes, 'call', _155 => _155(method)])))},
|
|
6135
6215
|
endpoints: ${varName},
|
|
6136
6216
|
}`);
|
|
6137
6217
|
});
|
|
@@ -6144,7 +6224,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6144
6224
|
}).map(({ route }) => route);
|
|
6145
6225
|
orderedPageRoutes.forEach((route, index) => {
|
|
6146
6226
|
const varName = `pageRoute${index}`;
|
|
6147
|
-
if (
|
|
6227
|
+
if (_chunkPRFNLQSPcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) {
|
|
6148
6228
|
pageRegistrations.push(`
|
|
6149
6229
|
{
|
|
6150
6230
|
pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
|
|
@@ -6168,15 +6248,25 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6168
6248
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(route.modulePath)};`
|
|
6169
6249
|
);
|
|
6170
6250
|
const clientMetadata = pageHydrationPlans.get(route.modulePath);
|
|
6171
|
-
const renderingDirective =
|
|
6251
|
+
const renderingDirective = _chunk3TL3AH25cjs.readRouteRenderingDirectiveFromFile.call(void 0, route.modulePath);
|
|
6172
6252
|
pageRegistrations.push(`
|
|
6173
6253
|
{
|
|
6174
6254
|
pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
|
|
6175
6255
|
directory: ${JSON.stringify(route.directory)},` : ""}
|
|
6176
6256
|
module: ${varName},
|
|
6177
6257
|
shouldHydrate: ${JSON.stringify(clientMetadata.shouldHydrate)},${clientMetadata.shouldHydrate ? `
|
|
6178
|
-
clientModule: ${JSON.stringify(
|
|
6179
|
-
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${
|
|
6258
|
+
clientModule: ${JSON.stringify(_chunkQMNWKQL4cjs.toViteModuleId.call(void 0, route.modulePath, config.root))},` : ""}
|
|
6259
|
+
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${_chunkUYSTTPYJcjs.usesFarmServerTree.call(void 0, clientMetadata) ? "\n serverTree: true," : ""}${(() => {
|
|
6260
|
+
const rootStrategy = _chunkUYSTTPYJcjs.resolveFarmRouteRootStrategy.call(void 0,
|
|
6261
|
+
route,
|
|
6262
|
+
clientMetadata,
|
|
6263
|
+
layoutHydrationPlans.map((layout) => ({ ...layout, ...layout.hydration })),
|
|
6264
|
+
config.root,
|
|
6265
|
+
pageHydrationPlanOptions.serverOwners
|
|
6266
|
+
);
|
|
6267
|
+
return rootStrategy === "load" ? "" : `
|
|
6268
|
+
rootStrategy: ${JSON.stringify(rootStrategy)},`;
|
|
6269
|
+
})()}${renderingDirective ? `
|
|
6180
6270
|
rendering: ${JSON.stringify(renderingDirective)},` : ""}
|
|
6181
6271
|
${route.source !== void 0 ? `markdownSource: {
|
|
6182
6272
|
source: ${JSON.stringify(route.source)},
|
|
@@ -6186,7 +6276,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6186
6276
|
});
|
|
6187
6277
|
const layoutImports = [];
|
|
6188
6278
|
const layoutRegistrations = [];
|
|
6189
|
-
const treeLayoutPatterns = farmIslandsMode ?
|
|
6279
|
+
const treeLayoutPatterns = farmIslandsMode ? _chunkO27PLNQZcjs.getFarmServerTreeLayoutPatterns.call(void 0,
|
|
6190
6280
|
layoutHydrationPlans.map((layout) => ({
|
|
6191
6281
|
pattern: layout.pattern,
|
|
6192
6282
|
shouldHydrate: layout.hydration.shouldHydrate,
|
|
@@ -6240,15 +6330,33 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6240
6330
|
errorImports.push(
|
|
6241
6331
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(errorRoute.modulePath)};`
|
|
6242
6332
|
);
|
|
6243
|
-
const groupScope =
|
|
6333
|
+
const groupScope = _chunkO27PLNQZcjs.getRouteGroupScope.call(void 0, errorRoute.pattern);
|
|
6244
6334
|
errorRegistrations.push(`
|
|
6245
6335
|
{
|
|
6246
|
-
pattern: ${JSON.stringify(
|
|
6336
|
+
pattern: ${JSON.stringify(_chunkO27PLNQZcjs.stripRouteGroups.call(void 0, errorRoute.pattern))},${groupScope ? `
|
|
6247
6337
|
groupScope: ${JSON.stringify(groupScope)},
|
|
6248
|
-
directoryDepth: ${
|
|
6338
|
+
directoryDepth: ${_chunkO27PLNQZcjs.getRouteDirectoryDepth.call(void 0, errorRoute.pattern)},` : ""}
|
|
6249
6339
|
module: ${varName},
|
|
6250
6340
|
}`);
|
|
6251
6341
|
});
|
|
6342
|
+
const loadingImports = [];
|
|
6343
|
+
const loadingRegistrations = [];
|
|
6344
|
+
if (farmMobileShells) {
|
|
6345
|
+
mobileShellLoadingRoutes.forEach((loadingRoute, index) => {
|
|
6346
|
+
const varName = `loadingRoute${index}`;
|
|
6347
|
+
loadingImports.push(
|
|
6348
|
+
`import * as ${varName} from ${toVirtualEntryImportSpecifier(loadingRoute.modulePath)};`
|
|
6349
|
+
);
|
|
6350
|
+
const groupScope = _chunkO27PLNQZcjs.getRouteGroupScope.call(void 0, loadingRoute.pattern);
|
|
6351
|
+
loadingRegistrations.push(`
|
|
6352
|
+
{
|
|
6353
|
+
pattern: ${JSON.stringify(_chunkO27PLNQZcjs.stripRouteGroups.call(void 0, loadingRoute.pattern))},${groupScope ? `
|
|
6354
|
+
groupScope: ${JSON.stringify(groupScope)},
|
|
6355
|
+
directoryDepth: ${_chunkO27PLNQZcjs.getRouteDirectoryDepth.call(void 0, loadingRoute.pattern)},` : ""}
|
|
6356
|
+
module: ${varName},
|
|
6357
|
+
}`);
|
|
6358
|
+
});
|
|
6359
|
+
}
|
|
6252
6360
|
const metadataImageImports = [];
|
|
6253
6361
|
const metadataImageRegistrations = [];
|
|
6254
6362
|
metadataImageRoutes.forEach((image, index) => {
|
|
@@ -6392,8 +6500,60 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6392
6500
|
stripFarmLocaleFromPathname,
|
|
6393
6501
|
withFarmRouteContext,
|
|
6394
6502
|
createLateNotFoundRecovery,
|
|
6395
|
-
createLateRedirectRecovery,${hasInfraAnalyticsRuntime ? "\n resolveFarmDocsEngineRouteLabel,\n resolveFarmDocsRouteLabel,\n resolveFarmMarkdownRouteLabel,\n resolveFarmMCPRouteLabel,\n setFarmRouteLabel," : ""}${hasFarmServerStorageConfig(config.storage) ? "\n _registerFarmStorageModules,\n disposeFarmStorage,\n initFarmStorage," : ""}
|
|
6396
|
-
} from "@farm.js/core/internal/production-runtime";${
|
|
6503
|
+
createLateRedirectRecovery,${config.mobileClient ? "\n createFarmNativeTreeResponse," : ""}${hasInfraAnalyticsRuntime ? "\n resolveFarmDocsEngineRouteLabel,\n resolveFarmDocsRouteLabel,\n resolveFarmMarkdownRouteLabel,\n resolveFarmMCPRouteLabel,\n setFarmRouteLabel," : ""}${hasFarmServerStorageConfig(config.storage) ? "\n _registerFarmStorageModules,\n disposeFarmStorage,\n initFarmStorage," : ""}
|
|
6504
|
+
} from "@farm.js/core/internal/production-runtime";${farmMobileClient ? `
|
|
6505
|
+
import { _applyFarmMobileShellClient } from "@farm.js/core/internal/production-runtime";
|
|
6506
|
+
// The mobile client documents load when a mobile shell asks for them (RFC 0004, 7.2), filled in
|
|
6507
|
+
// once the client build has finished (see buildNitroUniversal). A shell's document stays out of
|
|
6508
|
+
// shared caches, which the adapter learns as it does for a guarded response.
|
|
6509
|
+
const farmMobileShellClient = JSON.parse("${_chunkEFZGB7JCcjs.FARM_MOBILE_SHELL_CLIENT_PLACEHOLDER}");
|
|
6510
|
+
function applyFarmMobileShellResponse(request, response, context) {
|
|
6511
|
+
return _applyFarmMobileShellClient(request, response, farmMobileShellClient, () =>
|
|
6512
|
+
context?.onGuardedResponse?.()
|
|
6513
|
+
);
|
|
6514
|
+
}` : `
|
|
6515
|
+
// No mobile block: no mobile client, and documents ignore X-Farm-Shell.
|
|
6516
|
+
function applyFarmMobileShellResponse(request, response) {
|
|
6517
|
+
return response;
|
|
6518
|
+
}`}${farmMobileShells ? `
|
|
6519
|
+
import {
|
|
6520
|
+
_checkFarmMobileShellRoute,
|
|
6521
|
+
_isFarmMobileShellRenderRequest,
|
|
6522
|
+
} from "@farm.js/core/internal/production-runtime";
|
|
6523
|
+
// farm build --mobile with mobile.shells (RFC 0004, 7.2): this server renders a page shell, the
|
|
6524
|
+
// route's layouts around its loading file, for requests that carry this build's token. A web
|
|
6525
|
+
// build has no token and none of this.
|
|
6526
|
+
const farmMobileShellToken = ${JSON.stringify(farmMobileShells.token)};
|
|
6527
|
+
const loadingRoutes = [${loadingRegistrations.join(",")}
|
|
6528
|
+
];
|
|
6529
|
+
|
|
6530
|
+
/**
|
|
6531
|
+
* A request for a page shell: the loading component it renders in place of the page, or a
|
|
6532
|
+
* Response saying why the route has none. Null for every other request.
|
|
6533
|
+
*/
|
|
6534
|
+
function resolveFarmMobileShellRender(request, route, routePathname) {
|
|
6535
|
+
if (!_isFarmMobileShellRenderRequest(request, farmMobileShellToken)) return null;
|
|
6536
|
+
const loading = getMatchingErrorBoundary(routePathname, loadingRoutes);
|
|
6537
|
+
const reason = _checkFarmMobileShellRoute({
|
|
6538
|
+
requested: request.headers.get("x-farm-shell-route"),
|
|
6539
|
+
route: route.pattern,
|
|
6540
|
+
layouts: getApplicableLayouts(routePathname, route.directory || route.pattern).map(
|
|
6541
|
+
(layout) => layout.pattern,
|
|
6542
|
+
),
|
|
6543
|
+
loading: loading && loading.route.module.default ? loading.route.pattern : null,
|
|
6544
|
+
});
|
|
6545
|
+
if (reason) {
|
|
6546
|
+
return farmOwnedResponse(reason, {
|
|
6547
|
+
status: 404,
|
|
6548
|
+
headers: {
|
|
6549
|
+
"Content-Type": "text/plain; charset=utf-8",
|
|
6550
|
+
"Cache-Control": "private, no-store",
|
|
6551
|
+
"X-Farm-Shell-Render": "none",
|
|
6552
|
+
},
|
|
6553
|
+
});
|
|
6554
|
+
}
|
|
6555
|
+
return loading.route.module.default;
|
|
6556
|
+
}` : ""}${farmIslandsMode ? `
|
|
6397
6557
|
import { getSharedLayoutPrefixLength, handleFarmFormActionRequest, ignoreFarmHeldValues, installFarmIslandValues, parseFarmLayoutChainHeader } from "@farm.js/core/internal/production-runtime";
|
|
6398
6558
|
import { installFarmIslandsServer } from "@farm.js/core/internal/islands-server";
|
|
6399
6559
|
installFarmIslandsServer();
|
|
@@ -6407,25 +6567,25 @@ ${FARM_SEGMENT_NAVIGATION_SERVER_RUNTIME}` : ""}`;
|
|
|
6407
6567
|
const infraAnalyticsImport = hasInfraAnalyticsRuntime ? `import { ${hasPluginRuntime ? "createFarmInfraAnalyticsPlugin" : "createFarmInfraAnalyticsRecorder"} } from "@farm.js/core/internal/infra-analytics-runtime";` : "";
|
|
6408
6568
|
const compressionRuntimeImport = hasCompressionRuntime ? `import { compressFarmResponse${hasPluginRuntime ? ", createCompressionPlugin" : ""} } from "@farm.js/core/internal/compression-runtime";` : "";
|
|
6409
6569
|
const i18nServerImport = config.i18n.enabled ? `import { _runWithFarmI18nRequest, _setDefaultFarmI18nRuntime, createFarmI18nRuntime, getFarmI18nClientSnapshot } from "@farm.js/core/i18n/server";` : "";
|
|
6410
|
-
const docsHandlerImport = _optionalChain([config, 'access',
|
|
6570
|
+
const docsHandlerImport = _optionalChain([config, 'access', _156 => _156.docs, 'optionalAccess', _157 => _157.enabled]) ? hasPrecompiledDocs ? `import { createFarmDocsPrecompiledRuntime } from "@farm.js/core/internal/docs-precompiled-runtime";
|
|
6411
6571
|
const isFarmDocsAPIRequest = (requestOrPathname) => {
|
|
6412
6572
|
const pathname = typeof requestOrPathname === "string"
|
|
6413
6573
|
? requestOrPathname
|
|
6414
6574
|
: new URL(requestOrPathname.url).pathname;
|
|
6415
|
-
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess',
|
|
6575
|
+
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _158 => _158.apiPath]) || "/api/docs")};
|
|
6416
6576
|
return pathname === apiPath || pathname.startsWith(apiPath + "/");
|
|
6417
6577
|
};` : adapterOwnsDocsRuntime ? `import { ${docsConfigModulePath ? "getFarmDocsConfigModuleRoot, " : ""}isFarmDocsAPIRequest } from "@farm.js/core/docs";
|
|
6418
|
-
import { ${_optionalChain([config, 'access',
|
|
6578
|
+
import { ${_optionalChain([config, 'access', _159 => _159.docs, 'access', _160 => _160.roots, 'optionalAccess', _161 => _161.length]) ? "createFarmDocsMultiRuntimeHandler as createFarmDocsAdapterMultiRuntimeHandler" : "createFarmDocsRuntimeHandler as createFarmDocsAdapterRuntimeHandler"} } from ${JSON.stringify(config.docs.adapter.server)};
|
|
6419
6579
|
import * as FarmDocsAdapterReact from ${JSON.stringify(config.docs.adapter.react)};${docsConfigModulePath ? `
|
|
6420
6580
|
import * as farmDocsConfigModule from ${toVirtualEntryImportSpecifier(docsConfigModulePath)};` : ""}` : `import { createFarmDocsAPIHandler, createFarmDocsHandler, isFarmDocsAPIRequest } from "@farm.js/core/docs";` : "";
|
|
6421
|
-
const docsFontImport = _optionalChain([config, 'access',
|
|
6422
|
-
const docsRuntimeImport = _optionalChain([config, 'access',
|
|
6581
|
+
const docsFontImport = _optionalChain([config, 'access', _162 => _162.docs, 'optionalAccess', _163 => _163.enabled]) && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
|
|
6582
|
+
const docsRuntimeImport = _optionalChain([config, 'access', _164 => _164.docs, 'optionalAccess', _165 => _165.enabled]) && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
|
|
6423
6583
|
import { dirname as farmDocsDirname, join as farmDocsJoin } from "node:path";
|
|
6424
6584
|
import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
6425
|
-
const markdownHandlerImport = _optionalChain([config, 'access',
|
|
6585
|
+
const markdownHandlerImport = _optionalChain([config, 'access', _166 => _166.md, 'optionalAccess', _167 => _167.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
|
|
6426
6586
|
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;";
|
|
6427
6587
|
const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, FARM_MARKDOWN_PAGE_CHECK_HEADER, _isFarmMarkdownPageCheck, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
|
|
6428
|
-
const mdxComponentsPath = typeof _optionalChain([config, 'access',
|
|
6588
|
+
const mdxComponentsPath = typeof _optionalChain([config, 'access', _168 => _168.mdx, 'optionalAccess', _169 => _169.components]) === "string" ? _path2.default.isAbsolute(config.mdx.components) ? config.mdx.components : _path2.default.join(config.root, config.mdx.components) : null;
|
|
6429
6589
|
const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
|
|
6430
6590
|
const layerConfigPaths = (config.layers || []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile)).filter((configFile) => configFile !== configModulePath);
|
|
6431
6591
|
const layerConfigImports = layerConfigPaths.map(
|
|
@@ -6445,7 +6605,7 @@ import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
|
6445
6605
|
const nativeAuth = generateNativeAuthIntegrationSource(config.auth);
|
|
6446
6606
|
const nativeMCP = _chunkVM57CK74cjs.generateNativeMCPPluginSource.call(void 0, config.mcp);
|
|
6447
6607
|
const mobileSession = (config.plugins || []).some(
|
|
6448
|
-
(plugin) => _optionalChain([plugin, 'optionalAccess',
|
|
6608
|
+
(plugin) => _optionalChain([plugin, 'optionalAccess', _170 => _170.name]) === _chunk4BS3HSY7cjs.FARM_MOBILE_SESSION_PLUGIN
|
|
6449
6609
|
);
|
|
6450
6610
|
const integrationImports = `
|
|
6451
6611
|
${configModulePath ? `import * as FarmUserConfigModule from ${toVirtualEntryImportSpecifier(configModulePath)};` : ""}
|
|
@@ -6455,7 +6615,7 @@ ${nativeAuth.importSource}
|
|
|
6455
6615
|
${nativeMCP.importSource}
|
|
6456
6616
|
${mobileSession ? `import { createFarmMobileSessionPlugin as __farmCreateMobileSessionPlugin } from "@farm.js/core/internal/production-runtime";` : ""}
|
|
6457
6617
|
`;
|
|
6458
|
-
const imageRuntime =
|
|
6618
|
+
const imageRuntime = _chunkUYSTTPYJcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
|
|
6459
6619
|
const imageRuntimeImport = imageRuntime === "none" ? "" : `import { _withFarmImageSourceClientAddress, createCloudflareImageTransformer, createFarmImageHandler } from "@farm.js/core/image/server";`;
|
|
6460
6620
|
const imageNodeRuntimeImport = imageRuntime === "node" ? `import { createNodeImageFetcher, createNodeImageUrlValidator, createSharpImageTransformer } from "@farm.js/core/image/sharp";` : "";
|
|
6461
6621
|
const apiHandlerCode = apiRoutes.length > 0 ? `
|
|
@@ -6555,7 +6715,8 @@ ${apiImports.join("\n")}
|
|
|
6555
6715
|
${pageImports.join("\n")}
|
|
6556
6716
|
${layoutImports.join("\n")}
|
|
6557
6717
|
${routeSlotImports.join("\n")}
|
|
6558
|
-
${errorImports.join("\n")}
|
|
6718
|
+
${errorImports.join("\n")}${loadingImports.length > 0 ? `
|
|
6719
|
+
${loadingImports.join("\n")}` : ""}
|
|
6559
6720
|
${metadataImageImports.join("\n")}
|
|
6560
6721
|
${applicationMetadataImports.join("\n")}
|
|
6561
6722
|
${middlewareImports.join("\n")}
|
|
@@ -6634,7 +6795,7 @@ const farmResolvedRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs);
|
|
|
6634
6795
|
|
|
6635
6796
|
function FarmDefault404Page() {
|
|
6636
6797
|
return React.createElement(React.Fragment, null,
|
|
6637
|
-
React.createElement("style", null, ${JSON.stringify(
|
|
6798
|
+
React.createElement("style", null, ${JSON.stringify(_chunkUYSTTPYJcjs.DEFAULT_NOT_FOUND_STYLES)}),
|
|
6638
6799
|
React.createElement("main", {
|
|
6639
6800
|
className: "farm-default-not-found",
|
|
6640
6801
|
"aria-labelledby": "farm-default-not-found-title",
|
|
@@ -6727,7 +6888,7 @@ const serverRuntimeIntegrations = Object.fromEntries(
|
|
|
6727
6888
|
);
|
|
6728
6889
|
const integrationRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs, {
|
|
6729
6890
|
integrations: configuredIntegrations,
|
|
6730
|
-
${JSON.stringify(
|
|
6891
|
+
${JSON.stringify(_chunkZOYKJBP5cjs.FARM_INTEGRATION_API_BASE_PATH_KEY)}: ${JSON.stringify(_chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, config.api))},
|
|
6731
6892
|
});
|
|
6732
6893
|
const farmInfraAnalytics = ${hasInfraAnalyticsRuntime ? hasPluginRuntime ? "createFarmInfraAnalyticsPlugin()" : "createFarmInfraAnalyticsRecorder()" : "null"};
|
|
6733
6894
|
const configuredPlugins = [
|
|
@@ -6771,14 +6932,14 @@ const farmImageHandler = ${imageRuntime === "none" ? "null" : imageRuntime === "
|
|
|
6771
6932
|
onError(error) { console.error("[Farm Image]", error); },
|
|
6772
6933
|
})`};
|
|
6773
6934
|
const farmMarkdownConfig = ${JSON.stringify(config.md)};
|
|
6774
|
-
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
6775
|
-
${_optionalChain([config, 'access',
|
|
6935
|
+
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _171 => _171.agent, 'optionalAccess', _172 => _172.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
|
|
6936
|
+
${_optionalChain([config, 'access', _173 => _173.agent, 'optionalAccess', _174 => _174.llmsTxt, 'optionalAccess', _175 => _175.enabled]) ? "const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });\n" : ""}${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
|
|
6776
6937
|
const farmMdxConfig = ${JSON.stringify({
|
|
6777
6938
|
...config.mdx,
|
|
6778
|
-
components: typeof _optionalChain([config, 'access',
|
|
6939
|
+
components: typeof _optionalChain([config, 'access', _176 => _176.mdx, 'optionalAccess', _177 => _177.components]) === "string" ? config.mdx.components : void 0
|
|
6779
6940
|
})};
|
|
6780
6941
|
const configuredFarmMdxComponents = farmUserConfig?.mdx?.components;
|
|
6781
|
-
${_optionalChain([config, 'access',
|
|
6942
|
+
${_optionalChain([config, 'access', _178 => _178.agent, 'optionalAccess', _179 => _179.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
|
|
6782
6943
|
// environment this was built in, since Netlify exposes its deploy context only
|
|
6783
6944
|
// to the build.
|
|
6784
6945
|
const farmNoindexPreview = resolveFarmPreviewDeployment(
|
|
@@ -6829,7 +6990,7 @@ export const farmProductionLifecycle = createFarmProductionLifecycle({
|
|
|
6829
6990
|
});
|
|
6830
6991
|
const farmI18nRuntime = ${config.i18n.enabled ? `createFarmI18nRuntime(farmI18nConfig, ${JSON.stringify(i18nCatalogs)})` : "null"};
|
|
6831
6992
|
${config.i18n.enabled ? "_setDefaultFarmI18nRuntime(farmI18nRuntime);" : ""}
|
|
6832
|
-
const farmDocsBundledContentDir = ${_optionalChain([config, 'access',
|
|
6993
|
+
const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _180 => _180.docs, 'optionalAccess', _181 => _181.enabled]) && !hasPrecompiledDocs ? `(() => {
|
|
6833
6994
|
try {
|
|
6834
6995
|
const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
|
|
6835
6996
|
const candidates = [
|
|
@@ -6841,7 +7002,7 @@ const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _176 => _1
|
|
|
6841
7002
|
} catch {
|
|
6842
7003
|
return null;
|
|
6843
7004
|
}
|
|
6844
|
-
})()` : "null"};${_optionalChain([config, 'access',
|
|
7005
|
+
})()` : "null"};${_optionalChain([config, 'access', _182 => _182.docs, 'optionalAccess', _183 => _183.enabled]) && !hasPrecompiledDocs && _optionalChain([config, 'access', _184 => _184.docs, 'access', _185 => _185.roots, 'optionalAccess', _186 => _186.length]) ? `
|
|
6845
7006
|
const farmDocsBundledRootsDir = (() => {
|
|
6846
7007
|
try {
|
|
6847
7008
|
const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
|
|
@@ -6892,7 +7053,7 @@ const farmDocsModulePreloadPaths = farmDocsModulePreloads
|
|
|
6892
7053
|
),
|
|
6893
7054
|
}
|
|
6894
7055
|
: undefined;
|
|
6895
|
-
const farmDocsHandler = ${_optionalChain([config, 'access',
|
|
7056
|
+
const farmDocsHandler = ${_optionalChain([config, 'access', _187 => _187.docs, 'optionalAccess', _188 => _188.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `${adapterHandler.factory}(${adapterHandler.config}, {
|
|
6896
7057
|
rootDir: farmDocsRuntimeRoot,
|
|
6897
7058
|
// A production build's content cannot change, so the adapter reads its
|
|
6898
7059
|
// navigation once instead of scanning the content directory per request.
|
|
@@ -6925,7 +7086,7 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _183 => _183.docs, '
|
|
|
6925
7086
|
globalStylesheetHref: ${JSON.stringify(FARM_CLIENT_CSS_HREF_PLACEHOLDER)},
|
|
6926
7087
|
isPathGuarded: isFarmDocsPathGuarded,
|
|
6927
7088
|
})` : "null"};
|
|
6928
|
-
const farmDocsAPIHandler = ${_optionalChain([config, 'access',
|
|
7089
|
+
const farmDocsAPIHandler = ${_optionalChain([config, 'access', _189 => _189.docs, 'optionalAccess', _190 => _190.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig, isPathGuarded: isFarmDocsPathGuarded })` : "null"};
|
|
6929
7090
|
|
|
6930
7091
|
// API routes bundled at build time
|
|
6931
7092
|
const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
|
|
@@ -6948,14 +7109,14 @@ function fetchFarmInnerRequest(request, context) {
|
|
|
6948
7109
|
headers.delete("accept-encoding");
|
|
6949
7110
|
return fetch(new Request(request, { headers }), context);
|
|
6950
7111
|
}
|
|
6951
|
-
const farmLocalAPIBasePath = ${JSON.stringify(
|
|
7112
|
+
const farmLocalAPIBasePath = ${JSON.stringify(_chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, config.api))};
|
|
6952
7113
|
const farmOpenAPIReference = ${JSON.stringify(openAPIReference)};
|
|
6953
|
-
${_optionalChain([config, 'access',
|
|
6954
|
-
` : ""}${_optionalChain([config, 'access',
|
|
6955
|
-
|
|
7114
|
+
${_optionalChain([config, 'access', _191 => _191.agent, 'optionalAccess', _192 => _192.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunkDPJ66FSIcjs.resolveFarmApiCatalogInput.call(void 0, config))};
|
|
7115
|
+
` : ""}${_optionalChain([config, 'access', _193 => _193.agent, 'optionalAccess', _194 => _194.manifest]) !== false ? `const farmAppManifestInput = ${JSON.stringify(
|
|
7116
|
+
_chunkDPJ66FSIcjs.resolveFarmAppManifestInput.call(void 0, config, {
|
|
6956
7117
|
build: config.deploymentId,
|
|
6957
|
-
packages:
|
|
6958
|
-
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ?
|
|
7118
|
+
packages: _chunkUYSTTPYJcjs.resolveFarmAppPackages.call(void 0, config.root),
|
|
7119
|
+
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? _chunkUYSTTPYJcjs.collectFarmWebMCPTools.call(void 0, config.root, config.srcDir) : []
|
|
6959
7120
|
})
|
|
6960
7121
|
)};
|
|
6961
7122
|
${servesDefaultMCP ? "farmAppManifestInput.defaultMCP = getFarmDefaultMCPServer;\n" : ""}// A guard written for an MCP server's path keeps its tools out of the public view.
|
|
@@ -7082,6 +7243,32 @@ function renderFarmClientEntryScript(early) {
|
|
|
7082
7243
|
return stampFarmCspNonce('<script type="module"' + (early ? ' async' : '') + ' src="/__farm_client_js_src__"></script>');
|
|
7083
7244
|
}
|
|
7084
7245
|
|
|
7246
|
+
// Islands mode: a whole document in which nothing hydrates at load (no island with \`load\`, and no
|
|
7247
|
+
// page, layout or route slot hydrating as a root) starts with the boot entry, which loads the
|
|
7248
|
+
// client runtime on an island's own trigger, a link or a form (RFC 0003, section 10).
|
|
7249
|
+
const FARM_CLIENT_BOOT = ${JSON.stringify(farmClientBoot)};
|
|
7250
|
+
const FARM_ISLAND_OPENING_TAG = /<f-island\\b[^>]*>/g;
|
|
7251
|
+
const FARM_DEFERRED_ISLAND_STRATEGY = /\\sstrategy="(?:interaction|visible|idle)"/;
|
|
7252
|
+
|
|
7253
|
+
function farmDocumentBootsClient(markup, hydratesAtLoad, routeSlots) {
|
|
7254
|
+
if (!FARM_CLIENT_BOOT || hydratesAtLoad || typeof markup !== "string") return false;
|
|
7255
|
+
if (routeSlots && routeSlots.length > 0) return false;
|
|
7256
|
+
// A Suspense boundary the server gave up on, which the browser renders.
|
|
7257
|
+
if (markup.includes("<!--$!-->") || markup.includes("<!--$?-->")) return false;
|
|
7258
|
+
for (const match of markup.matchAll(FARM_ISLAND_OPENING_TAG)) {
|
|
7259
|
+
if (!FARM_DEFERRED_ISLAND_STRATEGY.test(match[0])) return false;
|
|
7260
|
+
}
|
|
7261
|
+
return true;
|
|
7262
|
+
}
|
|
7263
|
+
|
|
7264
|
+
// The boot entry runs the client entry from the URL on its script. A root that waits (the element
|
|
7265
|
+
// a hydrating layout or client page hydrates) is named with its strategy, for the boot to watch.
|
|
7266
|
+
function renderFarmClientBootScript(root, rootStrategy) {
|
|
7267
|
+
return stampFarmCspNonce('<script type="module" src="${farmClientBoot ? FARM_CLIENT_BOOT_SRC_PLACEHOLDER : ""}" data-farm-runtime="/__farm_client_js_src__"' +
|
|
7268
|
+
(root ? ' data-farm-root="' + root + '" data-farm-root-strategy="' + rootStrategy + '"' : '') +
|
|
7269
|
+
'></script>');
|
|
7270
|
+
}
|
|
7271
|
+
|
|
7085
7272
|
// Renderer options for the response being rendered: its CSP nonce, which the
|
|
7086
7273
|
// renderer puts on the inline scripts it emits.
|
|
7087
7274
|
function getFarmRendererRenderOptions() {
|
|
@@ -7555,7 +7742,7 @@ function peelFarmDocumentPrefix(markup) {
|
|
|
7555
7742
|
let inner = markup.replace(/^\\s+/, "");
|
|
7556
7743
|
let hoisted = "";
|
|
7557
7744
|
const wrapper = /^<div\\b[^>]*style=["']display\\s*:\\s*contents;?\\s*["'][^>]*>/i;
|
|
7558
|
-
const hoistable = /${
|
|
7745
|
+
const hoistable = /${_chunkO27PLNQZcjs.HOISTED_HEAD_ELEMENT.source}/i;
|
|
7559
7746
|
let match;
|
|
7560
7747
|
while ((match = wrapper.exec(inner) || hoistable.exec(inner))) {
|
|
7561
7748
|
if (!/^<div/i.test(match[0])) hoisted += match[0];
|
|
@@ -7852,12 +8039,13 @@ function withFarmDocsRequestCache(response, request, farmLocaleResolution, middl
|
|
|
7852
8039
|
|
|
7853
8040
|
${generateRuntimePathMatcherSource()}
|
|
7854
8041
|
|
|
7855
|
-
|
|
8042
|
+
// The nearest boundary file for a page path. Page shells pass their loading files.
|
|
8043
|
+
function getMatchingErrorBoundary(pathname, boundaries = errorRoutes) {
|
|
7856
8044
|
const pathSegments = splitRuntimePath(pathname);
|
|
7857
8045
|
let bestMatch = null;
|
|
7858
8046
|
let directory;
|
|
7859
8047
|
|
|
7860
|
-
for (const errorRoute of
|
|
8048
|
+
for (const errorRoute of boundaries) {
|
|
7861
8049
|
const patternDepth = splitRuntimePath(errorRoute.pattern).length;
|
|
7862
8050
|
if (patternDepth > pathSegments.length) continue;
|
|
7863
8051
|
const candidatePath = patternDepth === 0
|
|
@@ -8086,7 +8274,7 @@ function createFarmAgentRobotsResponse(request) {
|
|
|
8086
8274
|
// a route guard.
|
|
8087
8275
|
const farmAgentGuardedPages = new Set(${JSON.stringify(
|
|
8088
8276
|
pageRoutes.map((route) => route.pattern).filter(
|
|
8089
|
-
(pattern) => !pattern.includes("[") &&
|
|
8277
|
+
(pattern) => !pattern.includes("[") && _chunkO27PLNQZcjs.farmPathGuardCoversPage.call(void 0,
|
|
8090
8278
|
{
|
|
8091
8279
|
config: { middleware: config.middleware, integrations: config.integrations },
|
|
8092
8280
|
middlewareRoutes
|
|
@@ -8133,12 +8321,12 @@ ${servesDefaultMCP ? `// agent.mcp: the default read-only MCP server at /mcp, as
|
|
|
8133
8321
|
// aside for a page route that answers /mcp and for any MCP server published or
|
|
8134
8322
|
// registered at runtime, such as the docs engine's.
|
|
8135
8323
|
const farmDefaultMCPServer = ${JSON.stringify(
|
|
8136
|
-
|
|
8324
|
+
_chunkQAS7KE7Jcjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root), _chunk2FRLSDBTcjs.FARM_VERSION)
|
|
8137
8325
|
)};
|
|
8138
8326
|
let farmDefaultMCPRouteFree;
|
|
8139
8327
|
function getFarmDefaultMCPServer() {
|
|
8140
8328
|
if (farmDefaultMCPRouteFree === undefined) {
|
|
8141
|
-
farmDefaultMCPRouteFree = !matchPageRoute(${JSON.stringify(
|
|
8329
|
+
farmDefaultMCPRouteFree = !matchPageRoute(${JSON.stringify(_chunkQAS7KE7Jcjs.FARM_DEFAULT_MCP_PATH)});
|
|
8142
8330
|
}
|
|
8143
8331
|
return farmDefaultMCPRouteFree ? resolveFarmDefaultMCPServer(farmDefaultMCPServer) : undefined;
|
|
8144
8332
|
}
|
|
@@ -8433,7 +8621,7 @@ function hasLocalRequestRoute(request, routePathname) {
|
|
|
8433
8621
|
if (${imageRuntime === "none" ? "false" : `pathname === ${JSON.stringify(config.images.path)}`}) {
|
|
8434
8622
|
return true;
|
|
8435
8623
|
}
|
|
8436
|
-
${_optionalChain([config, 'access',
|
|
8624
|
+
${_optionalChain([config, 'access', _195 => _195.docs, 'optionalAccess', _196 => _196.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
|
|
8437
8625
|
if (
|
|
8438
8626
|
isFarmDocsAPIRequest(pathname) ||
|
|
8439
8627
|
docsPath === "/" ||
|
|
@@ -8459,7 +8647,7 @@ function getFarmPluginRequestOptions(request) {
|
|
|
8459
8647
|
route: { ...route, pattern: normalizeRuntimePath(farmOpenAPIReference.route) },
|
|
8460
8648
|
};
|
|
8461
8649
|
}
|
|
8462
|
-
const isDocsAPIRequest = ${_optionalChain([config, 'access',
|
|
8650
|
+
const isDocsAPIRequest = ${_optionalChain([config, 'access', _197 => _197.docs, 'optionalAccess', _198 => _198.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
|
|
8463
8651
|
const integrationMatch = ${hasServerRuntimeIntegrations ? `matchIntegrationRoute(serverRuntimeIntegrations, {
|
|
8464
8652
|
pathname,
|
|
8465
8653
|
method: request.method,
|
|
@@ -8543,7 +8731,7 @@ ${hasInfraAnalyticsRuntime ? `
|
|
|
8543
8731
|
// endpoints, Markdown mirrors, and docs pages have no app route pattern, so they are
|
|
8544
8732
|
// labeled here; route.pattern keeps meaning the matched app route for plugins.
|
|
8545
8733
|
const farmBuiltInRoutePaths = new Set(${JSON.stringify(
|
|
8546
|
-
|
|
8734
|
+
_chunkDPJ66FSIcjs.listFarmBuiltInRoutePaths.call(void 0, {
|
|
8547
8735
|
agent: {
|
|
8548
8736
|
...config.agent,
|
|
8549
8737
|
aiCatalog: servesAiCatalog,
|
|
@@ -8554,9 +8742,9 @@ const farmBuiltInRoutePaths = new Set(${JSON.stringify(
|
|
|
8554
8742
|
openapi: openAPIReference
|
|
8555
8743
|
})
|
|
8556
8744
|
)});
|
|
8557
|
-
${_optionalChain([config, 'access',
|
|
8745
|
+
${_optionalChain([config, 'access', _199 => _199.docs, 'optionalAccess', _200 => _200.enabled]) ? `const farmDocsRouteLabelInput = {
|
|
8558
8746
|
path: normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs"),
|
|
8559
|
-
apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess',
|
|
8747
|
+
apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _201 => _201.apiPath]) || "/api/docs")},${_optionalChain([config, 'access', _202 => _202.docs, 'access', _203 => _203.roots, 'optionalAccess', _204 => _204.length]) ? "\n roots: farmDocsResolvedConfig.roots.map((farmDocsRoot) => farmDocsRoot.entry)," : ""}
|
|
8560
8748
|
};
|
|
8561
8749
|
` : ""}// The request's route payload, for a handler that learns what answered while it handles.
|
|
8562
8750
|
const farmRouteLabelSlot = Symbol("farm.route.label.slot");
|
|
@@ -8571,11 +8759,11 @@ function labelFarmRequestOptions(options) {
|
|
|
8571
8759
|
setFarmRouteLabel(options.route, mcpLabel);
|
|
8572
8760
|
return options;
|
|
8573
8761
|
}
|
|
8574
|
-
${_optionalChain([config, 'access',
|
|
8762
|
+
${_optionalChain([config, 'access', _205 => _205.docs, 'optionalAccess', _206 => _206.enabled]) ? `if (options.kind === "docs") {
|
|
8575
8763
|
setFarmRouteLabel(options.route, resolveFarmDocsRouteLabel(routePathname, farmDocsRouteLabelInput));
|
|
8576
8764
|
return options;
|
|
8577
8765
|
}` : ""}
|
|
8578
|
-
${_optionalChain([config, 'access',
|
|
8766
|
+
${_optionalChain([config, 'access', _207 => _207.md, 'optionalAccess', _208 => _208.enabled]) || hasMarkdownPages ? `const markdownLabel = resolveFarmMarkdownRouteLabel(
|
|
8579
8767
|
routePathname,
|
|
8580
8768
|
(page) => matchPageRoute(page)?.route.pattern,
|
|
8581
8769
|
);
|
|
@@ -8610,7 +8798,7 @@ function getApplicableLayouts(pathname, directory) {
|
|
|
8610
8798
|
return applicable;
|
|
8611
8799
|
}
|
|
8612
8800
|
|
|
8613
|
-
${_optionalChain([config, 'access',
|
|
8801
|
+
${_optionalChain([config, 'access', _209 => _209.docs, 'optionalAccess', _210 => _210.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
|
|
8614
8802
|
if (request.method === "HEAD") return response;
|
|
8615
8803
|
if (response.headers.get("x-farm-docs-adapter")) return response;
|
|
8616
8804
|
|
|
@@ -8718,7 +8906,7 @@ ${_optionalChain([config, 'access', _205 => _205.docs, 'optionalAccess', _206 =>
|
|
|
8718
8906
|
|
|
8719
8907
|
// Shells keep their own LRU so query-string variants never evict app cache entries.
|
|
8720
8908
|
const pprShellCache = getFarmDataCache().pprShellCache;
|
|
8721
|
-
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access',
|
|
8909
|
+
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _211 => _211.experimental, 'optionalAccess', _212 => _212.ppr]) === true)};
|
|
8722
8910
|
|
|
8723
8911
|
function resolveRouteRenderingView(route) {
|
|
8724
8912
|
// The same merge development uses: baked directive config under the
|
|
@@ -8850,7 +9038,7 @@ async function handleFarmRequest(request, adapterContext) {
|
|
|
8850
9038
|
},
|
|
8851
9039
|
{ redirect: !isFarmLocalAPIPathname(requestUrl.pathname) }
|
|
8852
9040
|
)` : "handleFarmRequestInContext(request, null, false, Date.now(), adapterContext, requestUrl)"};
|
|
8853
|
-
${_optionalChain([config, 'access',
|
|
9041
|
+
${_optionalChain([config, 'access', _213 => _213.md, 'optionalAccess', _214 => _214.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
|
|
8854
9042
|
if (matchPageRoute(pathname)) {
|
|
8855
9043
|
// The Link header advertises the public .md URL, like the head alternate.
|
|
8856
9044
|
return applyMarkdownNegotiationHeaders(response, {
|
|
@@ -9060,7 +9248,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9060
9248
|
}
|
|
9061
9249
|
` : ""}
|
|
9062
9250
|
|
|
9063
|
-
${_optionalChain([config, 'access',
|
|
9251
|
+
${_optionalChain([config, 'access', _215 => _215.docs, 'optionalAccess', _216 => _216.enabled]) ? `
|
|
9064
9252
|
// Docs responses are served after app middleware so route guards and
|
|
9065
9253
|
// middleware headers apply to the docs engine like any other page content.
|
|
9066
9254
|
// An app's own llms.txt, llms-full.txt, sitemap.xml, and robots.txt take
|
|
@@ -9128,7 +9316,25 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9128
9316
|
}
|
|
9129
9317
|
` : ""}
|
|
9130
9318
|
|
|
9131
|
-
${
|
|
9319
|
+
${config.mobileClient ? `
|
|
9320
|
+
// The mobile app's native-tier screens: the page, rendered as for a browser, read into a
|
|
9321
|
+
// tree of native views.
|
|
9322
|
+
const farmNativeStylesheets = JSON.parse(${JSON.stringify(FARM_NATIVE_STYLESHEETS_PLACEHOLDER)});
|
|
9323
|
+
if (
|
|
9324
|
+
(request.method === "GET" || request.method === "HEAD") &&
|
|
9325
|
+
request.headers.get("accept")?.includes(${JSON.stringify(_chunk3HLQTOVUcjs.FARM_NATIVE_TREE_CONTENT_TYPE)})
|
|
9326
|
+
) {
|
|
9327
|
+
const treeResponse = await createFarmNativeTreeResponse({
|
|
9328
|
+
request,
|
|
9329
|
+
renderPage: (targetRequest) => fetchFarmInnerRequest(targetRequest, adapterContext),
|
|
9330
|
+
// The client CSS this build emitted, embedded once it settled (FARM_NATIVE_STYLESHEETS).
|
|
9331
|
+
loadStylesheet: (href) => farmNativeStylesheets[href],
|
|
9332
|
+
});
|
|
9333
|
+
return applyProductionMiddlewareHeaders(treeResponse, middlewareHeaders);
|
|
9334
|
+
}
|
|
9335
|
+
` : ""}
|
|
9336
|
+
|
|
9337
|
+
${_optionalChain([config, 'access', _217 => _217.md, 'optionalAccess', _218 => _218.enabled]) ? `
|
|
9132
9338
|
if (farmMarkdownConfig?.enabled) {
|
|
9133
9339
|
const markdownResponse = await createMarkdownMirrorResponse({
|
|
9134
9340
|
// The mirror helper only reads metadata and creates its own GET request.
|
|
@@ -9227,11 +9433,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9227
9433
|
return applyProductionMiddlewareHeaders(applicationMetadataResponse, middlewareHeaders);
|
|
9228
9434
|
}
|
|
9229
9435
|
` : ""}
|
|
9230
|
-
${_optionalChain([config, 'access',
|
|
9436
|
+
${_optionalChain([config, 'access', _219 => _219.agent, 'optionalAccess', _220 => _220.manifest]) !== false ? `
|
|
9231
9437
|
// agent.manifest: /.well-known/farmjs.json (and 0.1.34's /.well-known/farmjs), the app's
|
|
9232
9438
|
// public manifest, the same document for every request.
|
|
9233
9439
|
if (
|
|
9234
|
-
[${JSON.stringify(
|
|
9440
|
+
[${JSON.stringify(_chunkDPJ66FSIcjs.FARM_APP_MANIFEST_PATH)}, ${JSON.stringify(_chunkDPJ66FSIcjs.FARM_APP_MANIFEST_LEGACY_PATH)}].includes(
|
|
9235
9441
|
normalizeRuntimePath(routePathname),
|
|
9236
9442
|
)
|
|
9237
9443
|
) {
|
|
@@ -9241,9 +9447,9 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9241
9447
|
);
|
|
9242
9448
|
}
|
|
9243
9449
|
` : ""}
|
|
9244
|
-
${_optionalChain([config, 'access',
|
|
9450
|
+
${_optionalChain([config, 'access', _221 => _221.agent, 'optionalAccess', _222 => _222.apiCatalog]) ? `
|
|
9245
9451
|
// agent.apiCatalog: list the OpenAPI and MCP surfaces at the RFC 9727 path.
|
|
9246
|
-
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(
|
|
9452
|
+
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkDPJ66FSIcjs.FARM_API_CATALOG_PATH)}) {
|
|
9247
9453
|
return applyProductionMiddlewareHeaders(
|
|
9248
9454
|
createFarmApiCatalogResponse(request.method, farmApiCatalogInput, request),
|
|
9249
9455
|
middlewareHeaders,
|
|
@@ -9268,11 +9474,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9268
9474
|
);
|
|
9269
9475
|
}
|
|
9270
9476
|
` : ""}
|
|
9271
|
-
${_optionalChain([config, 'access',
|
|
9477
|
+
${_optionalChain([config, 'access', _223 => _223.agent, 'optionalAccess', _224 => _224.llmsTxt, 'optionalAccess', _225 => _225.enabled]) ? `
|
|
9272
9478
|
// agent.llmsTxt with no llms.ts or llms-full.ts: serve the generated files.
|
|
9273
9479
|
const farmGeneratedLlmsKind = normalizeRuntimePath(routePathname) === "/llms.txt"
|
|
9274
9480
|
? "llms"
|
|
9275
|
-
: ${_optionalChain([config, 'access',
|
|
9481
|
+
: ${_optionalChain([config, 'access', _226 => _226.agent, 'optionalAccess', _227 => _227.llmsTxt, 'optionalAccess', _228 => _228.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
|
|
9276
9482
|
if (farmGeneratedLlmsKind) {
|
|
9277
9483
|
const llmsContext = createFarmLlmsTxtContext(request, farmGeneratedLlmsKind === "llms-full");
|
|
9278
9484
|
const llmsOrigin = new URL(request.url).origin;
|
|
@@ -9307,7 +9513,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9307
9513
|
}
|
|
9308
9514
|
` : ""}
|
|
9309
9515
|
|
|
9310
|
-
${_optionalChain([config, 'access',
|
|
9516
|
+
${_optionalChain([config, 'access', _229 => _229.docs, 'optionalAccess', _230 => _230.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
|
|
9311
9517
|
const docsAPIResponse = await farmDocsAPIHandler(cloneFarmRequestWithContext(request));
|
|
9312
9518
|
if (docsAPIResponse) {
|
|
9313
9519
|
return applyProductionMiddlewareHeaders(
|
|
@@ -9333,8 +9539,12 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9333
9539
|
const actionResponse = await handleFarmFormActionRequest(request, farmFormActionsConfig);
|
|
9334
9540
|
if (actionResponse) return applyProductionMiddlewareHeaders(actionResponse, middlewareHeaders);
|
|
9335
9541
|
}` : ""}
|
|
9336
|
-
if (matchedRoute) {
|
|
9337
|
-
|
|
9542
|
+
if (matchedRoute) {${farmMobileShells ? `
|
|
9543
|
+
// A page shell request renders the route's loading file in place of its page, with no params,
|
|
9544
|
+
// data, slots, or page metadata; a route without a shell answers why.
|
|
9545
|
+
const farmShellLoading = resolveFarmMobileShellRender(request, matchedRoute.route, routePathname);
|
|
9546
|
+
if (farmShellLoading instanceof Response) return farmShellLoading;` : ""}
|
|
9547
|
+
const trailingSlashLocation = ${farmMobileShells ? "farmShellLoading ? null : " : ""}resolveFarmTrailingSlashRedirect(
|
|
9338
9548
|
url,
|
|
9339
9549
|
${JSON.stringify(config.trailingSlash)}
|
|
9340
9550
|
);
|
|
@@ -9347,7 +9557,19 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9347
9557
|
middlewareHeaders
|
|
9348
9558
|
);
|
|
9349
9559
|
}
|
|
9350
|
-
const { route, params } =
|
|
9560
|
+
const { route, params } = ${farmMobileShells ? `farmShellLoading
|
|
9561
|
+
? {
|
|
9562
|
+
route: {
|
|
9563
|
+
...matchedRoute.route,
|
|
9564
|
+
module: { default: farmShellLoading, viewport: matchedRoute.route.module.viewport },
|
|
9565
|
+
shouldHydrate: false,
|
|
9566
|
+
serverTree: false,
|
|
9567
|
+
rendering: undefined,
|
|
9568
|
+
markdownSource: undefined,
|
|
9569
|
+
},
|
|
9570
|
+
params: {},
|
|
9571
|
+
}
|
|
9572
|
+
: matchedRoute` : "matchedRoute"};
|
|
9351
9573
|
emitFarmEvent({ type: "route.matched", pathname, route: route.pattern, params });
|
|
9352
9574
|
|
|
9353
9575
|
try {
|
|
@@ -9366,7 +9588,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9366
9588
|
: countFarmKeptLayouts(request, farmSegmentLayouts, params);
|
|
9367
9589
|
// The root layout always renders, so keeping one layout keeps nothing.
|
|
9368
9590
|
const farmKeptLayouts = farmKeptLayoutCount > 1 ? farmKeptLayoutCount : 0;` : `const farmKeptLayouts = 0;`}
|
|
9369
|
-
const pprConfig = resolvePPRConfig(route);
|
|
9591
|
+
${farmMobileShells ? "const pprConfig = farmShellLoading ? { enabled: false } : resolvePPRConfig(route);" : "const pprConfig = resolvePPRConfig(route);"}
|
|
9370
9592
|
const pprBypassReason = pprConfig.enabled
|
|
9371
9593
|
? getPPRShellBypassReason(request, middlewareData, middlewareContext)
|
|
9372
9594
|
: undefined;
|
|
@@ -9437,12 +9659,13 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9437
9659
|
layout.shouldHydrate && layout.islandStrategy ? [layout.islandStrategy] : [],
|
|
9438
9660
|
),
|
|
9439
9661
|
];
|
|
9440
|
-
|
|
9662
|
+
// A root that waits carries its resolved strategy, inferred ones included.
|
|
9663
|
+
const hydrationIslandStrategy = route.rootStrategy || (hydrationStrategies.every(
|
|
9441
9664
|
(strategy) => strategy === hydrationStrategies[0],
|
|
9442
9665
|
)
|
|
9443
9666
|
? (hydrationStrategies[0] || "load")
|
|
9444
|
-
: "load";
|
|
9445
|
-
const selectedRouteSlots = matchRouteSlots(
|
|
9667
|
+
: "load");
|
|
9668
|
+
const selectedRouteSlots = ${farmMobileShells ? "farmShellLoading ? [] : " : ""}matchRouteSlots(
|
|
9446
9669
|
routePathname,
|
|
9447
9670
|
request.headers.get("x-farm-intercept-from"),
|
|
9448
9671
|
);
|
|
@@ -9763,9 +9986,12 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9763
9986
|
{
|
|
9764
9987
|
"data-farm-layout-boundary": "true",
|
|
9765
9988
|
"data-farm-layout-pattern": layout.pattern,
|
|
9766
|
-
|
|
9767
|
-
|
|
9768
|
-
|
|
9989
|
+
// A layout chain that hydrates is drawn by React in the browser
|
|
9990
|
+
// (document-layout-client.ts), without a key; it renders whole anyway.
|
|
9991
|
+
"data-farm-layout-key":
|
|
9992
|
+
farmLayoutKeyOf && !shouldHydrateLayout
|
|
9993
|
+
? farmLayoutKeyOf(layout.pattern, params)
|
|
9994
|
+
: undefined,
|
|
9769
9995
|
style: { display: "contents" },
|
|
9770
9996
|
},
|
|
9771
9997
|
wrappedElement,
|
|
@@ -9846,7 +10072,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9846
10072
|
);
|
|
9847
10073
|
}
|
|
9848
10074
|
}
|
|
9849
|
-
${_optionalChain([config, 'access',
|
|
10075
|
+
${_optionalChain([config, 'access', _231 => _231.md, 'optionalAccess', _232 => _232.enabled]) ? `
|
|
9850
10076
|
// Advertise the Markdown mirror in the head as well as the Link header,
|
|
9851
10077
|
// using the public path the .md request will be resolved against.
|
|
9852
10078
|
mergedMetadata = addMetadataMarkdownAlternate(
|
|
@@ -9865,7 +10091,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9865
10091
|
emitFarmEvent({ type: "cache.bypass", route: pathname, reason: "request-read" });
|
|
9866
10092
|
}
|
|
9867
10093
|
|
|
9868
|
-
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
10094
|
+
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _233 => _233.agent, 'optionalAccess', _234 => _234.jsonLd]), () => ( false)))} });
|
|
9869
10095
|
const title = renderedMetadata.title;
|
|
9870
10096
|
const metaTags = renderedMetadata.tags;
|
|
9871
10097
|
const hasFavicon = renderedMetadata.hasFavicon;
|
|
@@ -9914,6 +10140,9 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9914
10140
|
// renderer-emitted one; explicit metadata titles still come first.
|
|
9915
10141
|
const suppressDefaultTitle =
|
|
9916
10142
|
!renderedMetadata.hasExplicitTitle && rendererHasTitle;
|
|
10143
|
+
// Set once the whole document is rendered: whether it starts with the boot entry, which
|
|
10144
|
+
// preloads nothing.
|
|
10145
|
+
let farmBootsClient = false;
|
|
9917
10146
|
// A layout's own <html> document with Farm's head assets merged in and the #root the client
|
|
9918
10147
|
// hydrates opening its body: the whole document, or a streamed one's opening.
|
|
9919
10148
|
const composeFarmFullDocument = function(markup) {
|
|
@@ -9923,7 +10152,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9923
10152
|
);
|
|
9924
10153
|
composed = composed
|
|
9925
10154
|
// Inject CSS link after opening head tag or first meta tag
|
|
9926
|
-
.replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n <link rel="stylesheet" href="/__farm_client_css_href__">' + renderFarmClientModulePreloads(composed, route.clientModule); })
|
|
10155
|
+
.replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n <link rel="stylesheet" href="/__farm_client_css_href__">' + (farmBootsClient ? "" : renderFarmClientModulePreloads(composed, route.clientModule)); })
|
|
9927
10156
|
.replace(/<\\/head>/i, () => renderFarmRendererHydrationScript() + '\\n</head>')
|
|
9928
10157
|
// Explicit metadata wins over renderer and layout titles. Without
|
|
9929
10158
|
// explicit metadata, a renderer title wins over the layout title.
|
|
@@ -10099,7 +10328,20 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10099
10328
|
throw renderedPage.streamErrors[0];
|
|
10100
10329
|
}
|
|
10101
10330
|
}
|
|
10102
|
-
|
|
10331
|
+
// A route that hydrates as one root starts with the boot entry only when that root waits.
|
|
10332
|
+
const farmHydratesRoot = route.shouldHydrate || shouldHydrateLayout;
|
|
10333
|
+
farmBootsClient = farmDocumentBootsClient(
|
|
10334
|
+
html,
|
|
10335
|
+
(farmHydratesRoot && !route.rootStrategy) || Boolean(pprCacheKey),
|
|
10336
|
+
routeSlotPayload
|
|
10337
|
+
);
|
|
10338
|
+
const farmEntryScript = farmBootsClient
|
|
10339
|
+
? renderFarmClientBootScript(
|
|
10340
|
+
farmHydratesRoot ? (shouldHydrateLayout ? "root" : "__farm_page__") : "",
|
|
10341
|
+
route.rootStrategy
|
|
10342
|
+
)
|
|
10343
|
+
: renderFarmClientEntryScript();
|
|
10344
|
+
|
|
10103
10345
|
let fullHtml;
|
|
10104
10346
|
if (hasFullDocument) {
|
|
10105
10347
|
// Layout provides full HTML structure - inject CSS and client script
|
|
@@ -10115,7 +10357,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10115
10357
|
routeSlotPayload,
|
|
10116
10358
|
clientPageProps
|
|
10117
10359
|
) + '\\n' +
|
|
10118
|
-
' ' +
|
|
10360
|
+
' ' + farmEntryScript + '\\n</body>',
|
|
10119
10361
|
);
|
|
10120
10362
|
} else {
|
|
10121
10363
|
// No layout with full document - wrap in HTML structure
|
|
@@ -10126,13 +10368,13 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10126
10368
|
\${viewportTags}
|
|
10127
10369
|
\${hasFavicon ? "" : '<link rel="icon" href="data:,">'}
|
|
10128
10370
|
\${suppressDefaultTitle ? "" : "<title>" + title + "</title>"}\${metaTags}\${rendererHead ? "\\n " + rendererHead : ""}
|
|
10129
|
-
<link rel="stylesheet" href="/__farm_client_css_href__">\${renderFarmClientModulePreloads(html, route.clientModule)}
|
|
10371
|
+
<link rel="stylesheet" href="/__farm_client_css_href__">\${farmBootsClient ? "" : renderFarmClientModulePreloads(html, route.clientModule)}
|
|
10130
10372
|
\${renderFarmRendererHydrationScript()}
|
|
10131
10373
|
</head>
|
|
10132
10374
|
<body>
|
|
10133
10375
|
<div id="root">\${html}</div>
|
|
10134
10376
|
\${renderFarmClientBootstrapScript(pageProps.__farmCanonicalPath, routeSlotPayload, clientPageProps)}
|
|
10135
|
-
\${
|
|
10377
|
+
\${farmEntryScript}
|
|
10136
10378
|
</body>
|
|
10137
10379
|
</html>\`;
|
|
10138
10380
|
}
|
|
@@ -10343,7 +10585,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10343
10585
|
${servesDefaultMCP ? `
|
|
10344
10586
|
// agent.mcp: no app route answered /mcp, so the default read-only server may.
|
|
10345
10587
|
if (
|
|
10346
|
-
normalizeRuntimePath(routePathname) === ${JSON.stringify(
|
|
10588
|
+
normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkQAS7KE7Jcjs.FARM_DEFAULT_MCP_PATH)} &&
|
|
10347
10589
|
getFarmDefaultMCPServer()
|
|
10348
10590
|
) {
|
|
10349
10591
|
return applyProductionMiddlewareHeaders(
|
|
@@ -10559,11 +10801,11 @@ ${generatePreloadResponseRuntimeSource()}
|
|
|
10559
10801
|
export async function fetch(request, context) {${imageRuntime === "none" ? "" : `
|
|
10560
10802
|
// The image optimizer's fetch of a local source is not a loopback visitor.
|
|
10561
10803
|
context = _withFarmImageSourceClientAddress(request, context);`}
|
|
10562
|
-
${_optionalChain([config, 'access',
|
|
10804
|
+
${_optionalChain([config, 'access', _235 => _235.agent, 'optionalAccess', _236 => _236.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
|
|
10563
10805
|
basePath: farmLocalAPIBasePath,
|
|
10564
10806
|
dispatch: async (localRequest) =>
|
|
10565
10807
|
(await handleAPIRequest(localRequest)) ?? Response.json({ error: "Not Found" }, { status: 404 }),
|
|
10566
|
-
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access',
|
|
10808
|
+
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _237 => _237.agent, 'optionalAccess', _238 => _238.noindexPreviews]) ? `
|
|
10567
10809
|
// Keep every response of a preview deployment out of search indexes.
|
|
10568
10810
|
return farmNoindexPreview ? applyFarmPreviewRobotsTag(response) : response;` : ""}
|
|
10569
10811
|
}
|
|
@@ -10614,10 +10856,11 @@ async function handleFarmFetch(request, context) {
|
|
|
10614
10856
|
? getFarmRoutePathname(new URL(runtimeRequest.url).pathname)
|
|
10615
10857
|
: undefined;
|
|
10616
10858
|
const configured = applyConfiguredResponseHeaders(response, routePathname);
|
|
10859
|
+
// Configured headers may edit the response in place, so check it either way.
|
|
10860
|
+
const guarded = farmGuardedResponse ? _withFarmGuardedResponseCache(configured) : configured;
|
|
10617
10861
|
return applyFarmPreloadBudget(
|
|
10618
10862
|
applyFarmCspNonceToResponse(
|
|
10619
|
-
|
|
10620
|
-
farmGuardedResponse ? _withFarmGuardedResponseCache(configured) : configured,
|
|
10863
|
+
applyFarmMobileShellResponse(runtimeRequest, guarded, context),
|
|
10621
10864
|
farmSecurityConfig,
|
|
10622
10865
|
cspNonce,
|
|
10623
10866
|
),
|
|
@@ -10754,13 +10997,13 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
10754
10997
|
if (rewriteSources.some((source) => middlewarePatternMatches(source, pathname))) {
|
|
10755
10998
|
return "rewrite";
|
|
10756
10999
|
}
|
|
10757
|
-
if (
|
|
10758
|
-
if (
|
|
10759
|
-
if (
|
|
11000
|
+
if (_chunkO27PLNQZcjs.appMiddlewareMayHandlePath.call(void 0, middlewareRoutes, pathname)) return "app middleware";
|
|
11001
|
+
if (_chunkO27PLNQZcjs.configMiddlewareMayHandlePath.call(void 0, config.middleware, pathname)) return "configured middleware";
|
|
11002
|
+
if (_chunkNQJDO7K7cjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
|
|
10760
11003
|
if (farmServerRuntimePluginsMayHandlePath(config, pathname)) return "server runtime plugin";
|
|
10761
11004
|
const manifestEntry = getManifestPageEntry(routeRuntimeManifest, pathname);
|
|
10762
|
-
if (_optionalChain([manifestEntry, 'optionalAccess',
|
|
10763
|
-
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access',
|
|
11005
|
+
if (_optionalChain([manifestEntry, 'optionalAccess', _239 => _239.rendering]) === "dynamic") return "dynamic runtime manifest";
|
|
11006
|
+
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _240 => _240.regions, 'optionalAccess', _241 => _241.length])) || manifestEntry.maxDuration !== void 0)) {
|
|
10764
11007
|
return "route runtime controls";
|
|
10765
11008
|
}
|
|
10766
11009
|
const routeRule = getEffectiveRouteRule(config, pathname);
|
|
@@ -10773,22 +11016,22 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
10773
11016
|
return void 0;
|
|
10774
11017
|
}
|
|
10775
11018
|
async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
10776
|
-
if (!_optionalChain([config, 'access',
|
|
10777
|
-
if (!_chunkRD623KW4cjs.isReactRenderer.call(void 0, config.renderer) || !
|
|
10778
|
-
|
|
11019
|
+
if (!_optionalChain([config, 'access', _242 => _242.docs, 'optionalAccess', _243 => _243.enabled]) || !config.docs.prerender) return [];
|
|
11020
|
+
if (!_chunkRD623KW4cjs.isReactRenderer.call(void 0, config.renderer) || !_chunkIFXSBJPNcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
|
|
11021
|
+
_chunkQMNWKQL4cjs.logger.warn(
|
|
10779
11022
|
"docs.prerender needs a docs adapter such as @farming-labs/farmjs; Farm's built-in docs renderer keeps rendering docs pages on request."
|
|
10780
11023
|
);
|
|
10781
11024
|
return [];
|
|
10782
11025
|
}
|
|
10783
11026
|
if (_chunkE552H232cjs.getFarmPresetRuntime.call(void 0, preset) === "edge") {
|
|
10784
|
-
|
|
11027
|
+
_chunkQMNWKQL4cjs.logger.info(
|
|
10785
11028
|
`\u21AA Keeping docs pages in the edge docs snapshot: docs.prerender writes static files on Node and serverless targets, not "${preset}".`
|
|
10786
11029
|
);
|
|
10787
11030
|
return [];
|
|
10788
11031
|
}
|
|
10789
|
-
const pages = await
|
|
11032
|
+
const pages = await _chunkIFXSBJPNcjs.listFarmDocsAdapterPages.call(void 0, config.docs, { root, srcDir: config.srcDir });
|
|
10790
11033
|
if (!pages) {
|
|
10791
|
-
|
|
11034
|
+
_chunkQMNWKQL4cjs.logger.warn(
|
|
10792
11035
|
`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.`
|
|
10793
11036
|
);
|
|
10794
11037
|
return [];
|
|
@@ -10797,9 +11040,9 @@ async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
|
10797
11040
|
}
|
|
10798
11041
|
function hasFarmNitroCacheRouteRule(routeRules) {
|
|
10799
11042
|
return Object.values(routeRules || {}).some((rule) => {
|
|
10800
|
-
const swr = _optionalChain([rule, 'optionalAccess',
|
|
10801
|
-
const cache = _optionalChain([rule, 'optionalAccess',
|
|
10802
|
-
const headers = _optionalChain([rule, 'optionalAccess',
|
|
11043
|
+
const swr = _optionalChain([rule, 'optionalAccess', _244 => _244.swr]);
|
|
11044
|
+
const cache = _optionalChain([rule, 'optionalAccess', _245 => _245.cache]);
|
|
11045
|
+
const headers = _optionalChain([rule, 'optionalAccess', _246 => _246.headers]);
|
|
10803
11046
|
return swr !== void 0 && swr !== false || cache !== void 0 && cache !== false || !!headers && typeof headers === "object" && Object.keys(headers).length > 0;
|
|
10804
11047
|
});
|
|
10805
11048
|
}
|
|
@@ -10812,10 +11055,10 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
10812
11055
|
const nitroBuilder = nitroBuilderResult.value;
|
|
10813
11056
|
const isVercel = preset === "vercel" || preset === "vercel-edge";
|
|
10814
11057
|
const isCloudflareWorker = preset === "cloudflare-module";
|
|
10815
|
-
const outputDir =
|
|
11058
|
+
const outputDir = _chunkNQJDO7K7cjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
10816
11059
|
const runtimeServerOutputDir = isVercel ? _path2.default.join(outputDir, "functions", "__nitro.func") : _path2.default.join(outputDir, "server");
|
|
10817
11060
|
const ssrOutputDir = _path2.default.join(root, distDir, "ssr");
|
|
10818
|
-
const imageRuntime =
|
|
11061
|
+
const imageRuntime = _chunkUYSTTPYJcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
|
|
10819
11062
|
const hasGeneratedMetadataImages = Array.from(routeManager.getMetadataImages().values()).some(
|
|
10820
11063
|
(image) => image.sourceType === "module"
|
|
10821
11064
|
);
|
|
@@ -10830,15 +11073,15 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
10830
11073
|
...useExternalMetadataImageRuntime ? ["@vercel/og"] : []
|
|
10831
11074
|
]);
|
|
10832
11075
|
const isPrebuiltSSRCandidate = preset === "node-server" && [...ssrExternalPackages].every((packageName) => copiedRuntimePackages.has(packageName));
|
|
10833
|
-
|
|
10834
|
-
|
|
10835
|
-
|
|
11076
|
+
_chunkQMNWKQL4cjs.logger.info(`\u{1F4E6} Nitro output directory: ${outputDir}`);
|
|
11077
|
+
_chunkQMNWKQL4cjs.logger.info(`\u{1F4E6} SSR entry file: ${ssrEntryFile}`);
|
|
11078
|
+
_chunkQMNWKQL4cjs.logger.info(`\u{1F4E6} Preset: ${preset}`);
|
|
10836
11079
|
const ssgCollectionPromise = routeManager.collectSSGPages();
|
|
10837
11080
|
const middlewareRoutesPromise = discoverMiddlewareRoutes(_chunk5Y2P454Ocjs.getFarmAppDirectories.call(void 0, config));
|
|
10838
11081
|
const configuredResponseRoutesPromise = Promise.all([config.redirects(), config.rewrites()]);
|
|
10839
11082
|
const docsPrerenderPagesPromise = getFarmDocsPrerenderPages(config, root, preset);
|
|
10840
|
-
const farmWorkflows = await
|
|
10841
|
-
const farmCron = await
|
|
11083
|
+
const farmWorkflows = await _chunkQRX4JRBOcjs.prepareFarmWorkflowsForNitro.call(void 0, config);
|
|
11084
|
+
const farmCron = await _chunkYI6FKTTNcjs.prepareFarmCronForNitro.call(void 0, config);
|
|
10842
11085
|
const [
|
|
10843
11086
|
{ ssg: ssgPages },
|
|
10844
11087
|
middlewareRoutes,
|
|
@@ -10901,31 +11144,45 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
10901
11144
|
prerenderRoutes.push(pathname);
|
|
10902
11145
|
}
|
|
10903
11146
|
for (const skipped of skippedPrerenderRoutes) {
|
|
10904
|
-
|
|
11147
|
+
_chunkQMNWKQL4cjs.logger.info(`\u21AA Keeping SSG route ${skipped.pathname} server-handled (${skipped.reason})`);
|
|
10905
11148
|
}
|
|
10906
11149
|
if (farmWorkflows.workflows.length > 0) {
|
|
10907
|
-
|
|
11150
|
+
_chunkQMNWKQL4cjs.logger.info(`\u23F1\uFE0F Found ${farmWorkflows.workflows.length} Farm workflow task(s)`);
|
|
10908
11151
|
}
|
|
10909
11152
|
if (farmCron.jobs.length > 0) {
|
|
10910
|
-
|
|
11153
|
+
_chunkQMNWKQL4cjs.logger.info(`\u23F1\uFE0F Configured ${farmCron.jobs.length} Farm cron route(s)`);
|
|
10911
11154
|
}
|
|
10912
11155
|
if (preset === "cloudflare-pages" && farmCron.jobs.length > 0) {
|
|
10913
|
-
|
|
11156
|
+
_chunkQMNWKQL4cjs.logger.warn(
|
|
10914
11157
|
"Cloudflare Pages does not install Cron Triggers. Use the cloudflare-module preset or an external scheduler with .farm/cron-manifest.json."
|
|
10915
11158
|
);
|
|
10916
11159
|
}
|
|
10917
|
-
const scheduledTasks =
|
|
10918
|
-
const cloudflareCronConfig =
|
|
10919
|
-
const [clientCssHref, clientJsSrc, docsModulePreloads, clientModulePreloads] = await Promise.all([
|
|
11160
|
+
const scheduledTasks = _chunkYI6FKTTNcjs.mergeScheduledTasks.call(void 0, farmWorkflows.scheduledTasks, farmCron.scheduledTasks);
|
|
11161
|
+
const cloudflareCronConfig = _chunkYI6FKTTNcjs.createFarmCronCloudflareConfig.call(void 0, farmCron.jobs);
|
|
11162
|
+
const [clientCssHref, clientJsSrc, clientBootSrc, docsModulePreloads, clientModulePreloads] = await Promise.all([
|
|
10920
11163
|
resolveHashedClientCssHref(clientOutputDir),
|
|
10921
11164
|
resolveHashedClientJsSrc(clientOutputDir),
|
|
11165
|
+
resolveClientBootSrc(clientOutputDir),
|
|
10922
11166
|
readFarmDocsModulePreloads(_path2.default.join(root, distDir)),
|
|
10923
11167
|
readFarmClientModulePreloads(_path2.default.join(root, distDir))
|
|
10924
11168
|
]);
|
|
11169
|
+
let nativeStylesheets;
|
|
10925
11170
|
const encodedDocsModulePreloads = encodeFarmDocsModulePreloads(docsModulePreloads);
|
|
10926
11171
|
const encodedClientModulePreloads = encodeFarmClientModulePreloads(clientModulePreloads);
|
|
11172
|
+
const encodedMobileShellClient = shouldBuildFarmMobileClient(config) ? _chunkEFZGB7JCcjs.encodeFarmMobileShellClient.call(void 0,
|
|
11173
|
+
await _chunkEFZGB7JCcjs.finalizeFarmMobileClient.call(void 0, {
|
|
11174
|
+
buildDir: _path2.default.join(root, distDir),
|
|
11175
|
+
clientOutputDir,
|
|
11176
|
+
webEntry: clientJsSrc,
|
|
11177
|
+
stylesheet: clientCssHref,
|
|
11178
|
+
webFiles: _nullishCoalesce(_optionalChain([clientModulePreloads, 'optionalAccess', _247 => _247.files]), () => ( []))
|
|
11179
|
+
})
|
|
11180
|
+
) : null;
|
|
10927
11181
|
for (const output of Object.values(ssrBundle)) {
|
|
10928
11182
|
if (output.type !== "chunk") continue;
|
|
11183
|
+
if (encodedMobileShellClient && output.code.includes(_chunkEFZGB7JCcjs.FARM_MOBILE_SHELL_CLIENT_PLACEHOLDER)) {
|
|
11184
|
+
output.code = output.code.split(_chunkEFZGB7JCcjs.FARM_MOBILE_SHELL_CLIENT_PLACEHOLDER).join(encodedMobileShellClient);
|
|
11185
|
+
}
|
|
10929
11186
|
if (output.code.includes(FARM_DOCS_MODULE_PRELOADS_PLACEHOLDER)) {
|
|
10930
11187
|
output.code = output.code.split(FARM_DOCS_MODULE_PRELOADS_PLACEHOLDER).join(encodedDocsModulePreloads);
|
|
10931
11188
|
}
|
|
@@ -10938,13 +11195,25 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
10938
11195
|
if (output.code.includes(FARM_CLIENT_JS_SRC_PLACEHOLDER)) {
|
|
10939
11196
|
output.code = output.code.split(FARM_CLIENT_JS_SRC_PLACEHOLDER).join(clientJsSrc);
|
|
10940
11197
|
}
|
|
11198
|
+
if (output.code.includes(FARM_CLIENT_BOOT_SRC_PLACEHOLDER)) {
|
|
11199
|
+
if (!clientBootSrc) {
|
|
11200
|
+
throw new IncompleteClientBuildOutputError("farm-client-boot is missing");
|
|
11201
|
+
}
|
|
11202
|
+
output.code = output.code.split(FARM_CLIENT_BOOT_SRC_PLACEHOLDER).join(clientBootSrc);
|
|
11203
|
+
}
|
|
11204
|
+
if (config.mobileClient && output.code.includes(JSON.stringify(FARM_NATIVE_STYLESHEETS_PLACEHOLDER))) {
|
|
11205
|
+
await _asyncNullishCoalesce(nativeStylesheets, async () => ( (nativeStylesheets = await readFarmNativeStylesheets(clientOutputDir, clientCssHref))));
|
|
11206
|
+
output.code = output.code.split(JSON.stringify(FARM_NATIVE_STYLESHEETS_PLACEHOLDER)).join(JSON.stringify(JSON.stringify(nativeStylesheets)));
|
|
11207
|
+
}
|
|
10941
11208
|
}
|
|
10942
11209
|
await fs4.mkdir(ssrOutputDir, { recursive: true });
|
|
10943
|
-
|
|
10944
|
-
|
|
10945
|
-
|
|
10946
|
-
|
|
10947
|
-
|
|
11210
|
+
await Promise.all(
|
|
11211
|
+
Object.entries(ssrBundle).map(async ([fileName, output]) => {
|
|
11212
|
+
const filePath = _path2.default.join(ssrOutputDir, fileName);
|
|
11213
|
+
await fs4.mkdir(_path2.default.dirname(filePath), { recursive: true });
|
|
11214
|
+
await fs4.writeFile(filePath, output.type === "chunk" ? output.code : output.source);
|
|
11215
|
+
})
|
|
11216
|
+
);
|
|
10948
11217
|
const nitroEntryPath = _path2.default.join(ssrOutputDir, "nitro-entry.mjs");
|
|
10949
11218
|
const nodeAdapterModule = preset === "node-server" ? resolveNitroRuntimeDependency(root, "srvx/node") : null;
|
|
10950
11219
|
const hasNitroCacheRouteRules = hasFarmNitroCacheRouteRule(config.routeRules);
|
|
@@ -11201,7 +11470,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
11201
11470
|
ssrOutputDir,
|
|
11202
11471
|
ssrEntryFile
|
|
11203
11472
|
);
|
|
11204
|
-
const configuredNitroRouteRules = _chunkV56632LAcjs.routeRulesToNitroRouteRules.call(void 0, config.routeRules);
|
|
11473
|
+
const configuredNitroRouteRules = shouldBuildFarmMobileClient(config) ? varyFarmNitroCacheRulesByShell(_chunkV56632LAcjs.routeRulesToNitroRouteRules.call(void 0, config.routeRules)) : _chunkV56632LAcjs.routeRulesToNitroRouteRules.call(void 0, config.routeRules);
|
|
11205
11474
|
const prerenderNitroRouteRules = Object.fromEntries(
|
|
11206
11475
|
prerenderRoutes.map((route) => {
|
|
11207
11476
|
const configuredRule = configuredNitroRouteRules[route] || {};
|
|
@@ -11248,10 +11517,18 @@ function toFarmNodeResponse(request, response) {
|
|
|
11248
11517
|
// fixed top quality cost a docs app ~20 s of build CPU for a small further
|
|
11249
11518
|
// saving. Serverless and edge targets sit behind a CDN that compresses.
|
|
11250
11519
|
...preset === "node-server" ? { compressPublicAssets: { gzip: true } } : {},
|
|
11520
|
+
// Nitro gzips every server output file at level 9, node_modules included, to
|
|
11521
|
+
// print sizes after the build. A self-hosted server is never shipped compressed,
|
|
11522
|
+
// so list plain sizes; zipped serverless and edge bundles keep the gzip column.
|
|
11523
|
+
...preset === "node-server" || preset === "bun" ? { logging: { compressedSizes: false } } : {},
|
|
11251
11524
|
...prerenderRoutes.length > 0 ? {
|
|
11252
11525
|
prerender: {
|
|
11253
11526
|
crawlLinks: false,
|
|
11254
11527
|
failOnError: true,
|
|
11528
|
+
// Nitro's default renders one route at a time. Each prerender request is
|
|
11529
|
+
// answered independently, as by the production server, so keeping several
|
|
11530
|
+
// in flight overlaps the worker's rendering with this thread's per-route work.
|
|
11531
|
+
concurrency: Math.min(_os2.default.availableParallelism(), 8),
|
|
11255
11532
|
routes: prerenderRoutes
|
|
11256
11533
|
}
|
|
11257
11534
|
} : {},
|
|
@@ -11280,7 +11557,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
11280
11557
|
] : [],
|
|
11281
11558
|
{
|
|
11282
11559
|
route: "/**",
|
|
11283
|
-
handler:
|
|
11560
|
+
handler: _chunkQMNWKQL4cjs.toPosixPath.call(void 0, nitroEntryPath)
|
|
11284
11561
|
}
|
|
11285
11562
|
],
|
|
11286
11563
|
routeRules: {
|
|
@@ -11325,20 +11602,20 @@ function toFarmNodeResponse(request, response) {
|
|
|
11325
11602
|
snapshotSSRRebundleOptions(nitroConfig)
|
|
11326
11603
|
);
|
|
11327
11604
|
const requestedBuilder = _nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER));
|
|
11328
|
-
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access',
|
|
11329
|
-
_optionalChain([nitroConfig, 'access',
|
|
11330
|
-
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess',
|
|
11605
|
+
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _248 => _248.rollupConfig, 'optionalAccess', _249 => _249.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _250 => _250.rollupConfig, 'optionalAccess', _251 => _251.plugins])) && customRollupKeys.length === 0 && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _252 => _252.output, 'optionalAccess', _253 => _253.serverDir]) || "") === _path2.default.resolve(expectedServerDir) && Boolean(
|
|
11606
|
+
_optionalChain([nitroConfig, 'access', _254 => _254.handlers, 'optionalAccess', _255 => _255.some, 'call', _256 => _256(
|
|
11607
|
+
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _257 => _257.handler]) || "") === nitroEntryPath
|
|
11331
11608
|
)])
|
|
11332
11609
|
);
|
|
11333
11610
|
const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
|
|
11334
11611
|
if (selectRolldownBuilder) nitroConfig.builder = "rolldown";
|
|
11335
11612
|
const useRolldownBuilder = canReusePrebuiltSSR && (_nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER))) === "rolldown";
|
|
11336
11613
|
const shouldMinify = nitroConfig.minify !== false;
|
|
11337
|
-
const keepServerNames = !(_optionalChain([config, 'access',
|
|
11614
|
+
const keepServerNames = !(_optionalChain([config, 'access', _258 => _258.docs, 'optionalAccess', _259 => _259.enabled]) && _optionalChain([config, 'access', _260 => _260.docs, 'access', _261 => _261.adapter, 'optionalAccess', _262 => _262.server]));
|
|
11338
11615
|
const useFarmServerMinifier = shouldMinify && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig;
|
|
11339
11616
|
const serverChunkMinifier = useFarmServerMinifier ? createServerChunkMinifyPlugin({ keepNames: keepServerNames, target: "esnext" }) : null;
|
|
11340
11617
|
if (canReusePrebuiltSSR) {
|
|
11341
|
-
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access',
|
|
11618
|
+
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _263 => _263.rollupConfig, 'optionalAccess', _264 => _264.plugins]);
|
|
11342
11619
|
nitroConfig.rollupConfig = {
|
|
11343
11620
|
...nitroConfig.rollupConfig,
|
|
11344
11621
|
plugins: [
|
|
@@ -11349,10 +11626,26 @@ function toFarmNodeResponse(request, response) {
|
|
|
11349
11626
|
}
|
|
11350
11627
|
nitroConfig.minify = useFarmServerMinifier ? false : shouldMinify;
|
|
11351
11628
|
const nitroInstance = await nitroBuilder.createNitro(nitroConfig);
|
|
11352
|
-
|
|
11629
|
+
let prerenderOrder = /* @__PURE__ */ new Map();
|
|
11630
|
+
nitroInstance.hooks.hook("prerender:routes", (routes) => {
|
|
11631
|
+
prerenderOrder = new Map(
|
|
11632
|
+
Array.from(routes, (route, index) => {
|
|
11633
|
+
try {
|
|
11634
|
+
return [decodeURI(route), index];
|
|
11635
|
+
} catch (e33) {
|
|
11636
|
+
return [route, index];
|
|
11637
|
+
}
|
|
11638
|
+
})
|
|
11639
|
+
);
|
|
11640
|
+
});
|
|
11641
|
+
nitroInstance.hooks.hook("prerender:done", ({ prerenderedRoutes }) => {
|
|
11642
|
+
const orderOf = (route) => _nullishCoalesce(prerenderOrder.get(route), () => ( Number.MAX_SAFE_INTEGER));
|
|
11643
|
+
prerenderedRoutes.sort((a, b) => orderOf(a.route) - orderOf(b.route));
|
|
11644
|
+
});
|
|
11645
|
+
if (_optionalChain([config, 'access', _265 => _265.md, 'optionalAccess', _266 => _266.enabled])) {
|
|
11353
11646
|
nitroInstance.hooks.hook("prerender:generate", (route) => {
|
|
11354
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
11355
|
-
const alternatePath =
|
|
11647
|
+
if (!route.contents || !_optionalChain([route, 'access', _267 => _267.contentType, 'optionalAccess', _268 => _268.toLowerCase, 'call', _269 => _269(), 'access', _270 => _270.includes, 'call', _271 => _271("html")])) return;
|
|
11648
|
+
const alternatePath = _chunkLT4VAF5Zcjs.getFarmMarkdownAlternatePath.call(void 0, config.md, route.route);
|
|
11356
11649
|
if (!alternatePath) return;
|
|
11357
11650
|
const routeRule = nitroInstance.options.routeRules[route.route] || {};
|
|
11358
11651
|
const alternate = `<${alternatePath}>; rel="alternate"; type="text/markdown"`;
|
|
@@ -11372,7 +11665,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
11372
11665
|
}
|
|
11373
11666
|
if (config.security.csp && config.security.csp.nonce) {
|
|
11374
11667
|
nitroInstance.hooks.hook("prerender:generate", async (route) => {
|
|
11375
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
11668
|
+
if (!route.contents || !_optionalChain([route, 'access', _272 => _272.contentType, 'optionalAccess', _273 => _273.toLowerCase, 'call', _274 => _274(), 'access', _275 => _275.includes, 'call', _276 => _276("html")])) return;
|
|
11376
11669
|
const staticCsp = await _chunk6JHZPB52cjs.applyFarmCspHashesToHtml.call(void 0, route.contents, config.security);
|
|
11377
11670
|
if (!staticCsp) return;
|
|
11378
11671
|
route.contents = staticCsp.html;
|
|
@@ -11446,14 +11739,14 @@ function toFarmNodeResponse(request, response) {
|
|
|
11446
11739
|
});
|
|
11447
11740
|
}
|
|
11448
11741
|
if (prerenderRoutes.length > 0) {
|
|
11449
|
-
|
|
11450
|
-
const previousPrerender = process.env[
|
|
11451
|
-
process.env[
|
|
11742
|
+
_chunkQMNWKQL4cjs.logger.info(`\u{1F4C4} Pre-rendering ${prerenderRoutes.length} SSG page(s)`);
|
|
11743
|
+
const previousPrerender = process.env[_chunk4P23B7DUcjs.FARM_PRERENDER_ENV];
|
|
11744
|
+
process.env[_chunk4P23B7DUcjs.FARM_PRERENDER_ENV] = "1";
|
|
11452
11745
|
try {
|
|
11453
11746
|
await nitroBuilder.prerender(nitroInstance);
|
|
11454
11747
|
} finally {
|
|
11455
|
-
if (previousPrerender === void 0) delete process.env[
|
|
11456
|
-
else process.env[
|
|
11748
|
+
if (previousPrerender === void 0) delete process.env[_chunk4P23B7DUcjs.FARM_PRERENDER_ENV];
|
|
11749
|
+
else process.env[_chunk4P23B7DUcjs.FARM_PRERENDER_ENV] = previousPrerender;
|
|
11457
11750
|
}
|
|
11458
11751
|
}
|
|
11459
11752
|
const sharpRuntimeStagePromise = imageRuntime === "node" ? stageSharpRuntime(config, root, distDir, fs4, preset) : Promise.resolve(null);
|
|
@@ -11505,10 +11798,10 @@ function toFarmNodeResponse(request, response) {
|
|
|
11505
11798
|
if (failedCopy) throw failedCopy.reason;
|
|
11506
11799
|
if (canReusePrebuiltSSR) {
|
|
11507
11800
|
await registerPrebuiltSSRPackageImport(_path2.default.join(outputDir, "server"), ssrEntryFile, fs4);
|
|
11508
|
-
|
|
11801
|
+
_chunkQMNWKQL4cjs.logger.info("\u26A1 Reused Farm's prebuilt SSR bundle for the Node output");
|
|
11509
11802
|
}
|
|
11510
11803
|
if (useRolldownBuilder) {
|
|
11511
|
-
|
|
11804
|
+
_chunkQMNWKQL4cjs.logger.info("\u26A1 Built the Node adapter with Rolldown");
|
|
11512
11805
|
}
|
|
11513
11806
|
if (pluginManager) {
|
|
11514
11807
|
await pluginManager.runHookParallel("afterNitroBuild", {
|
|
@@ -11521,7 +11814,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
11521
11814
|
if (isVercel) {
|
|
11522
11815
|
await postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflows, routeRuntimeManifest);
|
|
11523
11816
|
}
|
|
11524
|
-
|
|
11817
|
+
_chunkQMNWKQL4cjs.logger.success(`\u2705 Nitro build completed with preset: ${preset}`);
|
|
11525
11818
|
}
|
|
11526
11819
|
function resolveFarmNitroOutputConfig(preset, outputDir) {
|
|
11527
11820
|
const isVercel = preset === "vercel" || preset === "vercel-edge";
|
|
@@ -11578,7 +11871,7 @@ async function moveVercelOutputPath(src, dest, fs4) {
|
|
|
11578
11871
|
await fs4.rename(src, dest);
|
|
11579
11872
|
return;
|
|
11580
11873
|
} catch (error) {
|
|
11581
|
-
const code = _optionalChain([error, 'optionalAccess',
|
|
11874
|
+
const code = _optionalChain([error, 'optionalAccess', _277 => _277.code]);
|
|
11582
11875
|
if (code !== "EPERM" && code !== "EACCES" && code !== "EXDEV" && code !== "ENOTEMPTY") {
|
|
11583
11876
|
throw error;
|
|
11584
11877
|
}
|
|
@@ -11604,7 +11897,7 @@ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflo
|
|
|
11604
11897
|
try {
|
|
11605
11898
|
await moveVercelOutputPath(publicDir, staticDir, fs4);
|
|
11606
11899
|
} catch (error) {
|
|
11607
|
-
if (_optionalChain([error, 'optionalAccess',
|
|
11900
|
+
if (_optionalChain([error, 'optionalAccess', _278 => _278.code]) !== "ENOENT") throw error;
|
|
11608
11901
|
}
|
|
11609
11902
|
await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4);
|
|
11610
11903
|
await copyPrismaClientForVercel(root, nitroFuncDir, fs4);
|
|
@@ -11621,20 +11914,20 @@ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflo
|
|
|
11621
11914
|
presetRoutes: Array.isArray(vercelConfig.routes) ? vercelConfig.routes : [],
|
|
11622
11915
|
runtimeRoutes
|
|
11623
11916
|
});
|
|
11624
|
-
const vercelConfigWithWorkflowCrons =
|
|
11917
|
+
const vercelConfigWithWorkflowCrons = _chunkQRX4JRBOcjs.applyFarmWorkflowVercelCrons.call(void 0,
|
|
11625
11918
|
vercelConfig,
|
|
11626
11919
|
farmWorkflows.workflows
|
|
11627
11920
|
);
|
|
11628
|
-
const vercelConfigWithCrons =
|
|
11921
|
+
const vercelConfigWithCrons = _chunkYI6FKTTNcjs.applyFarmCronVercelCrons.call(void 0,
|
|
11629
11922
|
vercelConfigWithWorkflowCrons,
|
|
11630
11923
|
config.cron.jobs
|
|
11631
11924
|
);
|
|
11632
11925
|
await fs4.writeFile(configPath, JSON.stringify(vercelConfigWithCrons, null, 2));
|
|
11633
|
-
|
|
11926
|
+
_chunkQMNWKQL4cjs.logger.info("\u2705 Post-processed Vercel output for Build Output API v3");
|
|
11634
11927
|
}
|
|
11635
11928
|
async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4) {
|
|
11636
|
-
if (!_optionalChain([config, 'access',
|
|
11637
|
-
const [mainRoot, ...extraRoots] =
|
|
11929
|
+
if (!_optionalChain([config, 'access', _279 => _279.docs, 'optionalAccess', _280 => _280.enabled])) return;
|
|
11930
|
+
const [mainRoot, ...extraRoots] = _chunk5JNUYGNFcjs.getFarmDocsRoots.call(void 0, config.docs);
|
|
11638
11931
|
await copyFarmDocsRootContent(
|
|
11639
11932
|
mainRoot,
|
|
11640
11933
|
root,
|
|
@@ -11655,7 +11948,7 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4) {
|
|
|
11655
11948
|
async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs4) {
|
|
11656
11949
|
const docsContentDir = resolveBuildDocsContentDir(docs, root, srcDir);
|
|
11657
11950
|
if (!docsContentDir) return;
|
|
11658
|
-
const lastModifiedManifest =
|
|
11951
|
+
const lastModifiedManifest = _chunk5JNUYGNFcjs.createFarmDocsLastModifiedManifest.call(void 0, docsContentDir, {
|
|
11659
11952
|
fallback: "now"
|
|
11660
11953
|
});
|
|
11661
11954
|
await fs4.rm(bundledContentDir, { recursive: true, force: true });
|
|
@@ -11665,11 +11958,11 @@ async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs
|
|
|
11665
11958
|
force: true
|
|
11666
11959
|
});
|
|
11667
11960
|
await fs4.writeFile(
|
|
11668
|
-
_path2.default.join(bundledContentDir,
|
|
11961
|
+
_path2.default.join(bundledContentDir, _chunk5JNUYGNFcjs.FARM_DOCS_LAST_MODIFIED_MANIFEST),
|
|
11669
11962
|
`${JSON.stringify(lastModifiedManifest, null, 2)}
|
|
11670
11963
|
`
|
|
11671
11964
|
);
|
|
11672
|
-
|
|
11965
|
+
_chunkQMNWKQL4cjs.logger.info(`\u{1F4DA} Bundled docs content for Vercel: ${_path2.default.relative(root, docsContentDir)}`);
|
|
11673
11966
|
}
|
|
11674
11967
|
function resolveServerFunctionPlatform(preset) {
|
|
11675
11968
|
return preset === "vercel" || preset === "netlify" ? { os: "linux", cpu: "x64", libc: "glibc" } : null;
|
|
@@ -11691,7 +11984,7 @@ async function stageSharpRuntime(config, root, distDir, fs4, preset) {
|
|
|
11691
11984
|
if (!resolvePackageJson(projectRequire, "sharp")) {
|
|
11692
11985
|
try {
|
|
11693
11986
|
sharpRequire = _module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core"));
|
|
11694
|
-
} catch (
|
|
11987
|
+
} catch (e34) {
|
|
11695
11988
|
}
|
|
11696
11989
|
}
|
|
11697
11990
|
const copiedPackages = /* @__PURE__ */ new Map();
|
|
@@ -11736,7 +12029,7 @@ async function stageSharpRuntime(config, root, distDir, fs4, preset) {
|
|
|
11736
12029
|
try {
|
|
11737
12030
|
await copyPackage("sharp", sharpRequire);
|
|
11738
12031
|
if (!copiedPackages.has("sharp")) {
|
|
11739
|
-
throw new Error(`Farm image optimization requires sharp. ${
|
|
12032
|
+
throw new Error(`Farm image optimization requires sharp. ${_chunkUYSTTPYJcjs.SHARP_INSTALL_HINT}`);
|
|
11740
12033
|
}
|
|
11741
12034
|
} catch (error) {
|
|
11742
12035
|
await fs4.rm(stageDir, { recursive: true, force: true });
|
|
@@ -11763,7 +12056,7 @@ async function installStagedSharpRuntime(staged, nitroFuncDir, fs4) {
|
|
|
11763
12056
|
} finally {
|
|
11764
12057
|
await fs4.rm(staged.stageDir, { recursive: true, force: true });
|
|
11765
12058
|
}
|
|
11766
|
-
|
|
12059
|
+
_chunkQMNWKQL4cjs.logger.info(
|
|
11767
12060
|
`\u{1F5BC}\uFE0F Bundled Sharp image runtime (${Object.keys(staged.dependencies).length} packages)`
|
|
11768
12061
|
);
|
|
11769
12062
|
}
|
|
@@ -11807,7 +12100,7 @@ async function mergeStagedDirectory(sourceDir, targetDir, fs4) {
|
|
|
11807
12100
|
function assertMetadataImageRuntimeInstalled(root, metadataImageRoutes) {
|
|
11808
12101
|
const generated = metadataImageRoutes.find((image) => image.sourceType === "module");
|
|
11809
12102
|
if (!generated || resolveMetadataImageRuntimePackageJson(root)) return;
|
|
11810
|
-
const file = generated.modulePath ?
|
|
12103
|
+
const file = generated.modulePath ? _chunkQMNWKQL4cjs.toPosixPath.call(void 0, _path2.default.relative(root, generated.modulePath)) : "";
|
|
11811
12104
|
throw new Error(
|
|
11812
12105
|
`${file || "A generated metadata image"} renders with @vercel/og, which is not installed. ${_chunkKORZ6PREcjs.VERCEL_OG_INSTALL_HINT}`
|
|
11813
12106
|
);
|
|
@@ -11818,7 +12111,7 @@ function resolveMetadataImageRuntimePackageJson(root) {
|
|
|
11818
12111
|
if (packageJsonPath) return packageJsonPath;
|
|
11819
12112
|
try {
|
|
11820
12113
|
return resolvePackageJson(_module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core")), "@vercel/og");
|
|
11821
|
-
} catch (
|
|
12114
|
+
} catch (e35) {
|
|
11822
12115
|
return null;
|
|
11823
12116
|
}
|
|
11824
12117
|
}
|
|
@@ -11841,7 +12134,7 @@ async function copyMetadataImageRuntime(root, nitroFuncDir, fs4) {
|
|
|
11841
12134
|
"@vercel/og": String(packageJson.version || "0.11.1")
|
|
11842
12135
|
};
|
|
11843
12136
|
await writeNitroOutputPackage(nitroFuncDir, functionPackage, fs4);
|
|
11844
|
-
|
|
12137
|
+
_chunkQMNWKQL4cjs.logger.info("\u{1F5BC}\uFE0F Bundled generated metadata image runtime");
|
|
11845
12138
|
}
|
|
11846
12139
|
async function readNitroOutputPackage(outputDir, fs4) {
|
|
11847
12140
|
const packagePath = _path2.default.join(outputDir, "package.json");
|
|
@@ -11865,7 +12158,7 @@ function resolvePackageJson(parentRequire, packageName) {
|
|
|
11865
12158
|
const resolved = parentRequire.resolve(request);
|
|
11866
12159
|
if (resolved.endsWith(".json")) return resolved;
|
|
11867
12160
|
_nullishCoalesce(metadataModule, () => ( (metadataModule = resolved)));
|
|
11868
|
-
} catch (
|
|
12161
|
+
} catch (e36) {
|
|
11869
12162
|
}
|
|
11870
12163
|
}
|
|
11871
12164
|
try {
|
|
@@ -11876,13 +12169,13 @@ function resolvePackageJson(parentRequire, packageName) {
|
|
|
11876
12169
|
try {
|
|
11877
12170
|
const manifest = JSON.parse(_fs.readFileSync.call(void 0, candidate, "utf8"));
|
|
11878
12171
|
if (manifest.name === packageName) return candidate;
|
|
11879
|
-
} catch (
|
|
12172
|
+
} catch (e37) {
|
|
11880
12173
|
}
|
|
11881
12174
|
}
|
|
11882
12175
|
if (_path2.default.basename(directory) === "node_modules") break;
|
|
11883
12176
|
directory = _path2.default.dirname(directory);
|
|
11884
12177
|
}
|
|
11885
|
-
} catch (
|
|
12178
|
+
} catch (e38) {
|
|
11886
12179
|
}
|
|
11887
12180
|
return null;
|
|
11888
12181
|
}
|
|
@@ -11891,13 +12184,13 @@ async function copyPrismaClientForVercel(root, nitroFuncDir, fs4) {
|
|
|
11891
12184
|
let prismaClientDir;
|
|
11892
12185
|
try {
|
|
11893
12186
|
prismaClientDir = _path2.default.dirname(projectRequire.resolve("@prisma/client/default.js"));
|
|
11894
|
-
} catch (
|
|
12187
|
+
} catch (e39) {
|
|
11895
12188
|
return;
|
|
11896
12189
|
}
|
|
11897
12190
|
const generatedClientDir = _path2.default.join(prismaClientDir, "..", "..", ".prisma", "client");
|
|
11898
12191
|
try {
|
|
11899
12192
|
await fs4.access(generatedClientDir);
|
|
11900
|
-
} catch (
|
|
12193
|
+
} catch (e40) {
|
|
11901
12194
|
return;
|
|
11902
12195
|
}
|
|
11903
12196
|
const targetNodeModules = _path2.default.join(nitroFuncDir, "node_modules");
|
|
@@ -11956,7 +12249,9 @@ async function createFarmProjectModuleSsrEnvironment() {
|
|
|
11956
12249
|
|
|
11957
12250
|
// src/build/index.ts
|
|
11958
12251
|
async function build(config, options = {}) {
|
|
11959
|
-
return _chunkVZY7MAVScjs.withProductionNodeEnv.call(void 0,
|
|
12252
|
+
return _chunkVZY7MAVScjs.withProductionNodeEnv.call(void 0,
|
|
12253
|
+
() => _chunkUYSTTPYJcjs.withPackageClientBoundaryCache.call(void 0, () => buildWithProductionNodeEnv(config, options))
|
|
12254
|
+
);
|
|
11960
12255
|
}
|
|
11961
12256
|
function createBuildTargetBaseline(config) {
|
|
11962
12257
|
const preset = config.preset || "node-server";
|
|
@@ -11966,7 +12261,7 @@ function createBuildTargetBaseline(config) {
|
|
|
11966
12261
|
preset,
|
|
11967
12262
|
distDir,
|
|
11968
12263
|
outputDir,
|
|
11969
|
-
outputWasDerived: outputDir ===
|
|
12264
|
+
outputWasDerived: outputDir === _chunkNQJDO7K7cjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
|
|
11970
12265
|
};
|
|
11971
12266
|
}
|
|
11972
12267
|
function resolveBuildTargets(config, options, baseline) {
|
|
@@ -11975,8 +12270,8 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
11975
12270
|
const distDir = config.distDir || ".farm";
|
|
11976
12271
|
const outputWasReplaced = config.deploy.outputDir !== baseline.outputDir;
|
|
11977
12272
|
const shouldRefreshDerivedOutput = baseline.outputWasDerived && !outputWasReplaced && (preset !== baseline.preset || distDir !== baseline.distDir);
|
|
11978
|
-
const deployTarget = preset === config.deploy.preset ? config.deploy.target :
|
|
11979
|
-
const outputDir = shouldRefreshDerivedOutput ?
|
|
12273
|
+
const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunkNQJDO7K7cjs.getDeployTargetForPreset.call(void 0, preset);
|
|
12274
|
+
const outputDir = shouldRefreshDerivedOutput ? _chunkNQJDO7K7cjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
|
|
11980
12275
|
return {
|
|
11981
12276
|
root,
|
|
11982
12277
|
preset,
|
|
@@ -11984,7 +12279,7 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
11984
12279
|
distDir,
|
|
11985
12280
|
deployTarget,
|
|
11986
12281
|
outputDir,
|
|
11987
|
-
deployOutputDir:
|
|
12282
|
+
deployOutputDir: _chunkNQJDO7K7cjs.resolveDeployOutputPath.call(void 0, root, outputDir)
|
|
11988
12283
|
};
|
|
11989
12284
|
}
|
|
11990
12285
|
async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
@@ -12021,15 +12316,18 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
12021
12316
|
};
|
|
12022
12317
|
config = {
|
|
12023
12318
|
...config,
|
|
12024
|
-
images:
|
|
12319
|
+
images: _chunkUYSTTPYJcjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
|
|
12025
12320
|
root: targets.root,
|
|
12026
12321
|
preset: targets.preset
|
|
12027
12322
|
})
|
|
12028
12323
|
};
|
|
12029
|
-
if (_optionalChain([config, 'access',
|
|
12324
|
+
if (_optionalChain([config, 'access', _281 => _281.docs, 'optionalAccess', _282 => _282.enabled])) await _chunkV3UOEWCBcjs.loadFarmDocsEngine.call(void 0, );
|
|
12030
12325
|
pluginManager.updateContext({ config });
|
|
12031
12326
|
const { root, preset, srcDir, distDir, deployOutputDir } = targets;
|
|
12032
|
-
|
|
12327
|
+
_chunkUYSTTPYJcjs.usePackageClientBoundaryCacheFile.call(void 0,
|
|
12328
|
+
_path2.default.resolve(root, distDir, "cache", "client-boundaries.json")
|
|
12329
|
+
);
|
|
12330
|
+
_chunkQMNWKQL4cjs.logger.info(`\u{1F69C} Building Farm.js application with preset: ${preset}...`);
|
|
12033
12331
|
await pluginManager.setupPlugins();
|
|
12034
12332
|
await pluginManager.runHookParallel("beforeBundle", {
|
|
12035
12333
|
root,
|
|
@@ -12038,10 +12336,10 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
12038
12336
|
distDir,
|
|
12039
12337
|
outputDir: deployOutputDir
|
|
12040
12338
|
});
|
|
12041
|
-
|
|
12339
|
+
_chunkQMNWKQL4cjs.logger.info("\u{1F50D} Discovering routes and API endpoints...");
|
|
12042
12340
|
const productionViteResult = productionViteResultPromise ? (await productionViteResultPromise)[0] : void 0;
|
|
12043
|
-
if (_optionalChain([productionViteResult, 'optionalAccess',
|
|
12044
|
-
const productionVite = _optionalChain([productionViteResult, 'optionalAccess',
|
|
12341
|
+
if (_optionalChain([productionViteResult, 'optionalAccess', _283 => _283.status]) === "rejected") throw productionViteResult.reason;
|
|
12342
|
+
const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _284 => _284.value]);
|
|
12045
12343
|
const createViteServer = productionVite ? productionVite.createServer : (await import("vite")).createServer;
|
|
12046
12344
|
projectModuleServer = await createProjectModuleServer(
|
|
12047
12345
|
createViteServer,
|
|
@@ -12049,27 +12347,27 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
12049
12347
|
root,
|
|
12050
12348
|
rendererBuild.signal
|
|
12051
12349
|
);
|
|
12052
|
-
const farmApp =
|
|
12350
|
+
const farmApp = _chunkUYSTTPYJcjs.createFarmApp.call(void 0, config, projectModuleServer);
|
|
12053
12351
|
await farmApp.initialize();
|
|
12054
12352
|
const routeManager = farmApp.getRouteManager();
|
|
12055
12353
|
const serverRenderer = farmApp.getServerRenderer();
|
|
12056
|
-
const typeArtifacts =
|
|
12354
|
+
const typeArtifacts = _chunk3TL3AH25cjs.generateFarmTypeArtifacts.call(void 0, {
|
|
12057
12355
|
root,
|
|
12058
12356
|
srcDir,
|
|
12059
12357
|
layers: config.layers,
|
|
12060
12358
|
plugins: config.plugins,
|
|
12061
12359
|
extraRoutes: [
|
|
12062
|
-
..._optionalChain([config, 'access',
|
|
12063
|
-
...
|
|
12360
|
+
..._optionalChain([config, 'access', _285 => _285.openapi, 'optionalAccess', _286 => _286.enabled]) && config.openapi.route ? [config.openapi.route] : [],
|
|
12361
|
+
..._chunk5JNUYGNFcjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
|
|
12064
12362
|
],
|
|
12065
12363
|
suppressLintOnLink: config.suppressLintOnLink,
|
|
12066
12364
|
componentExtensions: config.renderer.componentExtensions,
|
|
12067
12365
|
i18nConfig: config.i18n
|
|
12068
12366
|
}).catch((error) => {
|
|
12069
12367
|
const message = error instanceof Error ? error.message : String(error);
|
|
12070
|
-
|
|
12368
|
+
_chunkQMNWKQL4cjs.logger.warn(`Route type generation failed (farm.d.ts may be stale): ${message}`);
|
|
12071
12369
|
});
|
|
12072
|
-
const apiRouteManager = new (0,
|
|
12370
|
+
const apiRouteManager = new (0, _chunkW2RZ73IUcjs.APIRouteManager)(
|
|
12073
12371
|
_chunk5Y2P454Ocjs.getFarmAppDirectories.call(void 0, config),
|
|
12074
12372
|
projectModuleServer,
|
|
12075
12373
|
{
|
|
@@ -12077,7 +12375,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
12077
12375
|
plugins: config.plugins,
|
|
12078
12376
|
i18n: farmApp.getI18nRuntime(),
|
|
12079
12377
|
bodySizeLimit: config.server.bodySizeLimit,
|
|
12080
|
-
basePath:
|
|
12378
|
+
basePath: _chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, config.api)
|
|
12081
12379
|
}
|
|
12082
12380
|
);
|
|
12083
12381
|
const [, apiDiscovery] = await Promise.allSettled([
|
|
@@ -12095,11 +12393,11 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
12095
12393
|
});
|
|
12096
12394
|
} else {
|
|
12097
12395
|
const { build: legacyViteBuild } = await import("vite");
|
|
12098
|
-
|
|
12396
|
+
_chunkQMNWKQL4cjs.logger.info("\u{1F4E6} Building client bundle...");
|
|
12099
12397
|
await buildClient2(legacyViteBuild, config, root, srcDir, _path2.default.join(root, distDir, "client"));
|
|
12100
|
-
|
|
12398
|
+
_chunkQMNWKQL4cjs.logger.info("\u{1F4E6} Building SSR bundle...");
|
|
12101
12399
|
await buildSSR(legacyViteBuild, config, root, srcDir, _path2.default.join(root, distDir, "server"));
|
|
12102
|
-
|
|
12400
|
+
_chunkQMNWKQL4cjs.logger.info(`\u{1F680} Building server with Nitro (preset: ${preset})...`);
|
|
12103
12401
|
await buildNitro(
|
|
12104
12402
|
config,
|
|
12105
12403
|
routeManager,
|
|
@@ -12120,8 +12418,8 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
12120
12418
|
outputDir: deployOutputDir,
|
|
12121
12419
|
success: true
|
|
12122
12420
|
});
|
|
12123
|
-
|
|
12124
|
-
|
|
12421
|
+
_chunkQMNWKQL4cjs.logger.success(`\u2705 Build completed successfully! (preset: ${preset})`);
|
|
12422
|
+
_chunkQMNWKQL4cjs.logger.info(`\u{1F4C1} Output directory: ${deployOutputDir}`);
|
|
12125
12423
|
} catch (error) {
|
|
12126
12424
|
const { root, preset, distDir, deployOutputDir } = _nullishCoalesce(targets, () => ( resolveBuildTargets(config, options, targetBaseline)));
|
|
12127
12425
|
await pluginManager.runHookParallel("onError", {
|
|
@@ -12140,11 +12438,11 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
12140
12438
|
outputDir: deployOutputDir,
|
|
12141
12439
|
success: false
|
|
12142
12440
|
});
|
|
12143
|
-
|
|
12441
|
+
_chunkQMNWKQL4cjs.logger.error(`\u274C Build failed: ${error}`);
|
|
12144
12442
|
throw error;
|
|
12145
12443
|
} finally {
|
|
12146
12444
|
try {
|
|
12147
|
-
await _optionalChain([projectModuleServer, 'optionalAccess',
|
|
12445
|
+
await _optionalChain([projectModuleServer, 'optionalAccess', _287 => _287.close, 'call', _288 => _288()]);
|
|
12148
12446
|
} finally {
|
|
12149
12447
|
rendererBuild.abort();
|
|
12150
12448
|
}
|
|
@@ -12155,7 +12453,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
12155
12453
|
ssr: true,
|
|
12156
12454
|
buildLifetime
|
|
12157
12455
|
});
|
|
12158
|
-
const viteConfig =
|
|
12456
|
+
const viteConfig = _chunkUYSTTPYJcjs.mergeFarmViteConfig.call(void 0,
|
|
12159
12457
|
{
|
|
12160
12458
|
root,
|
|
12161
12459
|
appType: "custom",
|
|
@@ -12167,7 +12465,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
12167
12465
|
},
|
|
12168
12466
|
plugins: [
|
|
12169
12467
|
...rendererVitePlugins,
|
|
12170
|
-
|
|
12468
|
+
_chunkUYSTTPYJcjs.farmFontImportsPlugin.call(void 0, {
|
|
12171
12469
|
root,
|
|
12172
12470
|
basePath: config.basePath,
|
|
12173
12471
|
publicDir: config.publicDir
|
|
@@ -12179,7 +12477,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
12179
12477
|
hmr: false
|
|
12180
12478
|
},
|
|
12181
12479
|
resolve: {
|
|
12182
|
-
alias:
|
|
12480
|
+
alias: _chunkUYSTTPYJcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
12183
12481
|
dedupe: [...config.renderer.dedupe || []]
|
|
12184
12482
|
},
|
|
12185
12483
|
optimizeDeps: {
|
|
@@ -12212,10 +12510,10 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
12212
12510
|
noDiscovery: true
|
|
12213
12511
|
},
|
|
12214
12512
|
// An app or plugin that brings its own SSR environment keeps it.
|
|
12215
|
-
environments: _optionalChain([viteConfig, 'access',
|
|
12513
|
+
environments: _optionalChain([viteConfig, 'access', _289 => _289.environments, 'optionalAccess', _290 => _290.ssr, 'optionalAccess', _291 => _291.dev, 'optionalAccess', _292 => _292.createEnvironment]) ? viteConfig.environments : {
|
|
12216
12514
|
...viteConfig.environments,
|
|
12217
12515
|
ssr: {
|
|
12218
|
-
..._optionalChain([viteConfig, 'access',
|
|
12516
|
+
..._optionalChain([viteConfig, 'access', _293 => _293.environments, 'optionalAccess', _294 => _294.ssr]),
|
|
12219
12517
|
...await createFarmProjectModuleSsrEnvironment()
|
|
12220
12518
|
}
|
|
12221
12519
|
}
|
|
@@ -12271,7 +12569,7 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
|
|
|
12271
12569
|
define: {
|
|
12272
12570
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
12273
12571
|
__FARM_ENV__: JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, config.env)),
|
|
12274
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
12572
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _295 => _295.env, 'optionalAccess', _296 => _296.public]) || {})
|
|
12275
12573
|
},
|
|
12276
12574
|
plugins: [
|
|
12277
12575
|
farmI18nClientBridgePlugin(),
|
|
@@ -12291,7 +12589,7 @@ function resolveLegacyPageEntry(config, root, srcDir) {
|
|
|
12291
12589
|
}
|
|
12292
12590
|
async function buildNitro(config, routeManager, apiRouteManager, serverRenderer, preset, root, distDir, pluginManager) {
|
|
12293
12591
|
const [{ createNitroConfig }, { createNitro, build: nitroBuild }] = await Promise.all([
|
|
12294
|
-
import("./nitro-
|
|
12592
|
+
import("./nitro-HXAZZQKY.cjs"),
|
|
12295
12593
|
import("nitro/builder")
|
|
12296
12594
|
]);
|
|
12297
12595
|
let nitroConfig = await createNitroConfig(
|
|
@@ -12304,7 +12602,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
12304
12602
|
if (pluginManager) {
|
|
12305
12603
|
nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
|
|
12306
12604
|
}
|
|
12307
|
-
const outputDir =
|
|
12605
|
+
const outputDir = _chunkNQJDO7K7cjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
12308
12606
|
const serverOutputDir = _path2.default.join(outputDir, "server");
|
|
12309
12607
|
const publicOutputDir = _path2.default.join(outputDir, "public");
|
|
12310
12608
|
const { mkdir, cp } = await import("fs/promises");
|
|
@@ -12314,7 +12612,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
12314
12612
|
try {
|
|
12315
12613
|
await mkdir(publicOutputDir, { recursive: true });
|
|
12316
12614
|
await cp(clientDir, publicOutputDir, { recursive: true });
|
|
12317
|
-
|
|
12615
|
+
_chunkQMNWKQL4cjs.logger.info("\u{1F4E6} Copied client assets to public directory");
|
|
12318
12616
|
const manifestPath = _path2.default.join(publicOutputDir, "farm-client-manifest.json");
|
|
12319
12617
|
const assetsDir = _path2.default.join(publicOutputDir, "assets");
|
|
12320
12618
|
const manifestExists = await import("fs/promises").then(
|
|
@@ -12324,12 +12622,12 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
12324
12622
|
(fs4) => fs4.access(assetsDir).then(() => true).catch(() => false)
|
|
12325
12623
|
);
|
|
12326
12624
|
if (manifestExists && assetsExist) {
|
|
12327
|
-
|
|
12625
|
+
_chunkQMNWKQL4cjs.logger.info("\u2705 Verified client assets are present");
|
|
12328
12626
|
} else {
|
|
12329
|
-
|
|
12627
|
+
_chunkQMNWKQL4cjs.logger.warn("\u26A0\uFE0F Some client assets may be missing");
|
|
12330
12628
|
}
|
|
12331
12629
|
} catch (error) {
|
|
12332
|
-
|
|
12630
|
+
_chunkQMNWKQL4cjs.logger.error(`\u274C Failed to copy client assets: ${error}`);
|
|
12333
12631
|
throw error;
|
|
12334
12632
|
}
|
|
12335
12633
|
const serverDir = _path2.default.join(root, distDir, "server");
|
|
@@ -12337,9 +12635,9 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
12337
12635
|
try {
|
|
12338
12636
|
await mkdir(nitroServerDir, { recursive: true });
|
|
12339
12637
|
await cp(serverDir, nitroServerDir, { recursive: true });
|
|
12340
|
-
|
|
12638
|
+
_chunkQMNWKQL4cjs.logger.info("\u{1F4E6} Copied SSR bundles to Nitro server directory");
|
|
12341
12639
|
} catch (error) {
|
|
12342
|
-
|
|
12640
|
+
_chunkQMNWKQL4cjs.logger.warn(`Could not copy SSR bundles: ${error}`);
|
|
12343
12641
|
}
|
|
12344
12642
|
const nitro = await createNitro(nitroConfig);
|
|
12345
12643
|
const registryPath = _path2.default.join(root, distDir, ".nitro", "server", "farm-registry.ts");
|
|
@@ -12363,11 +12661,11 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
12363
12661
|
const { readFile } = await import("fs/promises");
|
|
12364
12662
|
const manifestContent = await readFile(clientManifestPath, "utf-8");
|
|
12365
12663
|
farmRegistry.clientManifest = JSON.parse(manifestContent);
|
|
12366
|
-
} catch (
|
|
12664
|
+
} catch (e41) {
|
|
12367
12665
|
farmRegistry.clientManifest = {};
|
|
12368
12666
|
}
|
|
12369
12667
|
} catch (error) {
|
|
12370
|
-
|
|
12668
|
+
_chunkQMNWKQL4cjs.logger.warn(`Could not populate registry: ${error}`);
|
|
12371
12669
|
}
|
|
12372
12670
|
await nitroBuild(nitro);
|
|
12373
12671
|
if (pluginManager) {
|
|
@@ -12375,7 +12673,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
12375
12673
|
root,
|
|
12376
12674
|
preset,
|
|
12377
12675
|
distDir,
|
|
12378
|
-
outputDir:
|
|
12676
|
+
outputDir: _chunkNQJDO7K7cjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
|
|
12379
12677
|
});
|
|
12380
12678
|
}
|
|
12381
12679
|
}
|