@farm.js/core 0.1.80 → 0.1.82
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.d-BPa5n0ld.d.ts → agent-mcp.d-C2Su3x4D.d.ts} +1 -1
- package/dist/{agent-mcp.d-DOP95Jxm.d.mts → agent-mcp.d-Yak-LqRd.d.mts} +1 -1
- package/dist/agent-runtime.cjs +4 -3
- package/dist/agent-runtime.d.mts +2 -1
- package/dist/agent-runtime.d.ts +2 -1
- package/dist/agent-runtime.mjs +3 -2
- package/dist/analyzer-LV23T6QN.cjs +17 -0
- package/dist/{analyzer-F7CWE5VA.mjs → analyzer-RPU2KG4J.mjs} +3 -2
- package/dist/api/client.cjs +1 -1
- package/dist/api/client.mjs +1 -1
- package/dist/api/client.native.cjs +1 -1
- package/dist/api/client.native.mjs +1 -1
- package/dist/api/node.cjs +6 -5
- package/dist/api/node.d.mts +4 -3
- package/dist/api/node.d.ts +4 -3
- package/dist/api/node.mjs +5 -4
- package/dist/api/route-manager.cjs +7 -6
- package/dist/api/route-manager.d.mts +4 -3
- package/dist/api/route-manager.d.ts +4 -3
- package/dist/api/route-manager.mjs +6 -5
- package/dist/api/runtime.cjs +5 -4
- package/dist/api/runtime.d.mts +3 -2
- package/dist/api/runtime.d.ts +3 -2
- package/dist/api/runtime.mjs +4 -3
- package/dist/api.cjs +9 -8
- package/dist/api.d.mts +5 -4
- package/dist/api.d.ts +5 -4
- package/dist/api.mjs +8 -7
- package/dist/{app-manifest.d-9UD6BznX.d.mts → app-manifest.d-BcyOFMrg.d.mts} +1 -1
- package/dist/{app-manifest.d-CO6Iu0Hx.d.ts → app-manifest.d-DZyXaICz.d.ts} +1 -1
- package/dist/app-markdown.cjs +3 -3
- package/dist/app-markdown.d.mts +5 -4
- package/dist/app-markdown.d.ts +5 -4
- package/dist/app-markdown.mjs +2 -2
- package/dist/{app.d-DXeRWZK7.d.mts → app.d-C0ePpuaG.d.mts} +30 -4
- package/dist/{app.d-DwX1ePhs.d.ts → app.d-CIoXsAbN.d.ts} +30 -4
- package/dist/{chunk-Q4TRGTO7.cjs → chunk-26WP75W5.cjs} +32 -16
- package/dist/{chunk-7KDCVSTR.mjs → chunk-2PFGA6PB.mjs} +2 -2
- package/dist/chunk-2UYYXSUS.mjs +401 -0
- package/dist/{chunk-PL7MCYYD.mjs → chunk-3AV4DCXY.mjs} +58 -358
- package/dist/{chunk-3GNHJ3RN.cjs → chunk-3BTN3NP7.cjs} +2 -2
- package/dist/chunk-3DE6RK7K.cjs +36 -0
- package/dist/{chunk-GBW5DU7V.mjs → chunk-47I2MYIR.mjs} +487 -304
- package/dist/{chunk-RQBGHHOQ.mjs → chunk-4X7LSGM6.mjs} +1 -1
- package/dist/{chunk-QMR2TUVZ.cjs → chunk-52Q4OB4A.cjs} +4 -4
- package/dist/{chunk-BPWTSPK6.mjs → chunk-5AL2GXAU.mjs} +1 -1
- package/dist/{chunk-GAWSWJJ2.cjs → chunk-5GFTMTX3.cjs} +2 -2
- package/dist/chunk-5MMKNW7Q.cjs +54 -0
- package/dist/{chunk-AXA2BSX3.cjs → chunk-5MUFW5UU.cjs} +22 -21
- package/dist/{chunk-MQOHYV6L.cjs → chunk-5P65LXGU.cjs} +11 -11
- package/dist/{chunk-KEU55O2D.mjs → chunk-63ZE6B6M.mjs} +7 -6
- package/dist/{chunk-TS3ZHJN5.cjs → chunk-6BPFIYGY.cjs} +3 -3
- package/dist/{chunk-NJ4OASLP.mjs → chunk-6QYPP5KC.mjs} +2 -2
- package/dist/{chunk-ATISIC6G.mjs → chunk-7VJXYB6S.mjs} +7 -1
- package/dist/{chunk-G4SZC2WH.cjs → chunk-AIPZDBP6.cjs} +557 -374
- package/dist/{chunk-X4TSMQWF.cjs → chunk-ARORZ3MH.cjs} +548 -397
- package/dist/{chunk-K3XKEZR6.mjs → chunk-AUFEM3FB.mjs} +1 -1
- package/dist/{chunk-MGKWYPE3.mjs → chunk-AYDVUCXD.mjs} +1 -0
- package/dist/{chunk-5OAN7BG5.cjs → chunk-B2PGVHBG.cjs} +4 -4
- package/dist/{chunk-WGWWRV2M.cjs → chunk-B3HQTGXS.cjs} +6 -4
- package/dist/chunk-B7L24VPX.cjs +401 -0
- package/dist/{chunk-5VDJEKGK.cjs → chunk-BBVLOEND.cjs} +1 -1
- package/dist/{chunk-XF7MJSUS.mjs → chunk-BCQIXH7L.mjs} +1 -1
- package/dist/{chunk-67MZTLTF.cjs → chunk-BCTHOQPP.cjs} +37 -9
- package/dist/{chunk-GBESKA76.cjs → chunk-BSX5OGSD.cjs} +1 -1
- package/dist/{chunk-CNDBLUKI.mjs → chunk-BVJUFVCU.mjs} +1 -1
- package/dist/{chunk-QHAISITM.mjs → chunk-C3VCYOU4.mjs} +1 -1
- package/dist/chunk-C5QHZ626.cjs +85 -0
- package/dist/{chunk-3K2E55BJ.mjs → chunk-CA2HBLXP.mjs} +13 -3
- package/dist/{chunk-ANZLZNNX.cjs → chunk-CD5Z7RR5.cjs} +155 -20
- package/dist/{chunk-4MIDUSIX.mjs → chunk-CJDBTTLB.mjs} +17 -17
- package/dist/{chunk-RLCOWWE5.cjs → chunk-CN2JOTRO.cjs} +7 -7
- package/dist/chunk-D2VAANBS.mjs +48 -0
- package/dist/{chunk-XZBBKZGW.mjs → chunk-DAXU2NBE.mjs} +128 -41
- package/dist/{chunk-4H4ZXUNB.cjs → chunk-DJ3PVHTW.cjs} +3 -3
- package/dist/{chunk-Z5BANEQD.cjs → chunk-DMSXZNQR.cjs} +2 -2
- package/dist/{chunk-ZVSQN7NC.cjs → chunk-DRO3NXA3.cjs} +40 -43
- package/dist/{chunk-4OFWG4IK.cjs → chunk-EACD6ND7.cjs} +8 -2
- package/dist/{chunk-Q4YEAWUK.mjs → chunk-ECVSRE4Y.mjs} +3 -2
- package/dist/{chunk-MDEFTF63.mjs → chunk-EL2Z6YFZ.mjs} +25 -28
- package/dist/chunk-EZYKV24V.mjs +385 -0
- package/dist/{chunk-TVCFY3KK.cjs → chunk-FB4CWSC2.cjs} +12 -12
- package/dist/{chunk-IYFBLWXU.cjs → chunk-FULX5RYX.cjs} +61 -361
- package/dist/{chunk-V73Y4UBL.mjs → chunk-GXLNARPO.mjs} +151 -16
- package/dist/{chunk-ZPEZXQTM.cjs → chunk-HHQEKLZL.cjs} +2 -2
- package/dist/{chunk-HNUBRUFQ.cjs → chunk-HQEYZSF3.cjs} +4 -3
- package/dist/{chunk-5ZHC6QGD.cjs → chunk-HQKCSJEH.cjs} +8 -2
- package/dist/{chunk-RHI67C2V.cjs → chunk-HUGPJFOC.cjs} +1 -35
- package/dist/{chunk-44G4XHEL.mjs → chunk-I4DR3HCH.mjs} +11 -11
- package/dist/chunk-I4WZRG73.mjs +54 -0
- package/dist/{chunk-MUZHULW2.mjs → chunk-ICOJ2BC6.mjs} +23 -7
- package/dist/{chunk-MNIR7I7B.mjs → chunk-INKVDO42.mjs} +1 -1
- package/dist/{chunk-C2OLXVUC.mjs → chunk-IVP5Q4BX.mjs} +10 -3
- package/dist/{chunk-HEDGTXXB.cjs → chunk-JB4BHRFK.cjs} +17 -17
- package/dist/{chunk-XKUKWMGX.cjs → chunk-JCYDWJVO.cjs} +3 -3
- package/dist/{chunk-CCMP4JD2.cjs → chunk-JK26IMT7.cjs} +1 -1
- package/dist/{chunk-WIZRYFB2.cjs → chunk-JYQ6DGPW.cjs} +8 -6
- package/dist/{chunk-SVCUSOEF.mjs → chunk-KR5DF7WK.mjs} +1 -1
- package/dist/{chunk-TYHWZOA2.mjs → chunk-KWI3SQFX.mjs} +4 -2
- package/dist/{chunk-POVHO46S.mjs → chunk-L3RDECA5.mjs} +1 -1
- package/dist/{chunk-LVGB5PYK.cjs → chunk-LM2ZDNDD.cjs} +28 -28
- package/dist/{chunk-COTFX4GT.mjs → chunk-LTOT5KVJ.mjs} +1 -1
- package/dist/{chunk-RPA45OQS.mjs → chunk-MO4UTDQ6.mjs} +1 -1
- package/dist/{chunk-DVHFIETW.cjs → chunk-N2EFMN2K.cjs} +18 -18
- package/dist/{chunk-MZ5QGWRW.mjs → chunk-N3VMHPIY.mjs} +2 -2
- package/dist/{chunk-KKVRWNDH.mjs → chunk-NAHDG6UX.mjs} +4 -4
- package/dist/{chunk-UWOCYINY.cjs → chunk-NEKO3HM2.cjs} +12 -2
- package/dist/{chunk-SLEHAGGV.mjs → chunk-NQ3Y6E2T.mjs} +7 -1
- package/dist/{chunk-ZDYYZX73.mjs → chunk-NRCKBDYP.mjs} +266 -115
- package/dist/{chunk-EG5YBYHO.mjs → chunk-OMB7UGVW.mjs} +1 -1
- package/dist/{chunk-JGEN2FIT.mjs → chunk-OP5VI4TP.mjs} +1 -1
- package/dist/{chunk-7VCLTNED.mjs → chunk-PNMAD3OS.mjs} +1 -35
- package/dist/{chunk-3XTRT3MB.mjs → chunk-PO5MZIWK.mjs} +1 -1
- package/dist/{chunk-ASYOWPSR.cjs → chunk-PWDBWXQI.cjs} +2 -1
- package/dist/{chunk-WJ2O2MPP.cjs → chunk-Q2VOT3K2.cjs} +494 -407
- package/dist/{chunk-7YLDUB4R.cjs → chunk-QCKSYYXK.cjs} +7 -7
- package/dist/{chunk-57QAQU4F.mjs → chunk-QRNYSISP.mjs} +1 -1
- package/dist/{chunk-3JQBQG7K.mjs → chunk-QSMUMK7Y.mjs} +2 -2
- package/dist/{chunk-PRL7FXG4.cjs → chunk-RDNKQ5MK.cjs} +12 -13
- package/dist/{chunk-GCRT6GJG.mjs → chunk-RMLR5RMH.mjs} +30 -2
- package/dist/{chunk-XY5OZQF6.cjs → chunk-RMPUEH5T.cjs} +2 -2
- package/dist/{chunk-7DD5TNPS.cjs → chunk-S7WZUK3B.cjs} +2 -2
- package/dist/{chunk-EGHPFXPZ.cjs → chunk-SAPG45RA.cjs} +23 -23
- package/dist/{chunk-Z4SMFUZ7.cjs → chunk-U54REWMJ.cjs} +23 -23
- package/dist/chunk-U6XYBTUT.mjs +36 -0
- package/dist/chunk-UDMBUTJD.mjs +85 -0
- package/dist/{chunk-WHEQJN4G.cjs → chunk-UGD53SNO.cjs} +2 -2
- package/dist/{chunk-TCMRLW3K.cjs → chunk-VACYUMXW.cjs} +10 -3
- package/dist/{chunk-SDICLSQU.cjs → chunk-VMBIKDKW.cjs} +10 -10
- package/dist/{chunk-WBPVLCNE.mjs → chunk-VPGEYX5Y.mjs} +4 -4
- package/dist/chunk-VS7HLH4S.cjs +385 -0
- package/dist/{chunk-UGLTOLTJ.cjs → chunk-W76C7TCW.cjs} +2 -2
- package/dist/chunk-WMRGIQTA.cjs +48 -0
- package/dist/{chunk-52LTENRE.cjs → chunk-WOAXQ5MZ.cjs} +9 -9
- package/dist/{chunk-C6HGUTXB.mjs → chunk-XBSIGZ4J.mjs} +2 -3
- package/dist/{chunk-6JWXHPVR.mjs → chunk-XRSNW4IU.mjs} +4 -2
- package/dist/{chunk-2RRTOKRZ.mjs → chunk-YHM4PXJY.mjs} +1 -1
- package/dist/{chunk-A5D3UMLJ.mjs → chunk-YSU3WCW6.mjs} +1 -1
- package/dist/{chunk-4STJ6LGR.mjs → chunk-Z3RM3VA2.mjs} +1 -1
- package/dist/{chunk-YN3YMSKD.mjs → chunk-ZIZRIZLP.mjs} +3 -3
- package/dist/{cli-runtime.d-DPNTN-JV.d.mts → cli-runtime.d-Hnvvadz7.d.mts} +5 -5
- package/dist/{cli-runtime.d-8BhZy_wr.d.ts → cli-runtime.d-I0MphTbc.d.ts} +5 -5
- package/dist/{client-component.d-CkDcob6D.d.ts → client-component.d-5QEvtJsg.d.ts} +1 -1
- package/dist/{client-component.d-CMCdyAr8.d.mts → client-component.d-DapRqtSC.d.mts} +1 -1
- package/dist/{client-plugins.d-WcMwOZGZ.d.mts → client-plugins.d-C1WM3ieD.d.mts} +7 -13
- package/dist/{client-plugins.d-BYIovYqX.d.ts → client-plugins.d-DcmDzcSC.d.ts} +7 -13
- package/dist/client-plugins.d.mts +2 -1
- package/dist/client-plugins.d.ts +2 -1
- package/dist/client.cjs +9 -8
- package/dist/client.d.mts +20 -151
- package/dist/client.d.ts +20 -151
- package/dist/client.mjs +8 -7
- package/dist/config.d.mts +2 -1
- package/dist/config.d.ts +2 -1
- package/dist/cron.cjs +2 -2
- package/dist/cron.mjs +1 -1
- package/dist/desktop.d.mts +3 -2
- package/dist/desktop.d.ts +3 -2
- package/dist/{devtools-JJOYTIMS.cjs → devtools-5B7NZE6F.cjs} +15 -14
- package/dist/{devtools-F3FDFV26.mjs → devtools-C5GXZZ7E.mjs} +12 -11
- package/dist/docs.cjs +14 -13
- package/dist/docs.d.mts +4 -3
- package/dist/docs.d.ts +4 -3
- package/dist/docs.mjs +13 -12
- package/dist/environment/vite.cjs +7 -6
- package/dist/environment/vite.mjs +6 -5
- package/dist/{handler.d-s3IM6pbJ.d.mts → handler.d-B8bPCBzl.d.mts} +1 -1
- package/dist/{handler.d-BwdOyc9x.d.ts → handler.d-Cliwo6Nu.d.ts} +1 -1
- package/dist/{headers.d-BR-OXrqQ.d.mts → headers.d-CVwSpSGX.d.mts} +1 -1
- package/dist/{headers.d-CAW4wPey.d.ts → headers.d-C_btqjV6.d.ts} +1 -1
- package/dist/index.cjs +68 -65
- package/dist/{index.d-BEVK61zS.d.mts → index.d-DFuMZk9-.d.mts} +1 -1
- package/dist/{index.d-ah2c89Wu.d.ts → index.d-hOEbMcLk.d.ts} +1 -1
- package/dist/index.d.mts +25 -23
- package/dist/index.d.ts +25 -23
- package/dist/index.mjs +72 -69
- package/dist/instrumentation.cjs +3 -3
- package/dist/instrumentation.mjs +2 -2
- package/dist/integrations/orm.d.mts +2 -1
- package/dist/integrations/orm.d.ts +2 -1
- package/dist/integrations.cjs +4 -3
- package/dist/integrations.d.mts +2 -1
- package/dist/integrations.d.ts +2 -1
- package/dist/integrations.mjs +3 -2
- package/dist/internal/app-markdown-runtime.cjs +2 -2
- package/dist/internal/app-markdown-runtime.d.mts +12 -5
- package/dist/internal/app-markdown-runtime.d.ts +12 -5
- package/dist/internal/app-markdown-runtime.mjs +1 -1
- package/dist/internal/build-runtime.cjs +49 -47
- package/dist/internal/build-runtime.d.mts +5 -4
- package/dist/internal/build-runtime.d.ts +5 -4
- package/dist/internal/build-runtime.mjs +48 -46
- package/dist/internal/cli-runtime.cjs +25 -24
- package/dist/internal/cli-runtime.d.mts +8 -7
- package/dist/internal/cli-runtime.d.ts +8 -7
- package/dist/internal/cli-runtime.mjs +26 -25
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.cjs +76 -15
- package/dist/internal/client-runtime.d.mts +18 -7
- package/dist/internal/client-runtime.d.ts +18 -7
- package/dist/internal/client-runtime.mjs +67 -6
- package/dist/internal/compression-runtime.d.mts +2 -1
- package/dist/internal/compression-runtime.d.ts +2 -1
- package/dist/internal/config-runtime.cjs +14 -13
- package/dist/internal/config-runtime.d.mts +4 -3
- package/dist/internal/config-runtime.d.ts +4 -3
- package/dist/internal/config-runtime.mjs +13 -12
- package/dist/internal/docs-precompiled-runtime.cjs +1 -1
- package/dist/internal/docs-precompiled-runtime.mjs +1 -1
- package/dist/internal/form-actions.cjs +3 -3
- package/dist/internal/form-actions.mjs +2 -2
- package/dist/internal/infra-analytics-runtime.cjs +9 -7
- package/dist/internal/infra-analytics-runtime.d.mts +8 -2
- package/dist/internal/infra-analytics-runtime.d.ts +8 -2
- package/dist/internal/infra-analytics-runtime.mjs +9 -7
- package/dist/internal/island-codec.cjs +3 -3
- package/dist/internal/island-codec.mjs +2 -2
- package/dist/internal/island-value-store.d.mts +1 -1
- package/dist/internal/island-value-store.d.ts +1 -1
- package/dist/internal/islands-boot.cjs +63 -23
- package/dist/internal/islands-boot.d.mts +5 -3
- package/dist/internal/islands-boot.d.ts +5 -3
- package/dist/internal/islands-boot.mjs +58 -18
- package/dist/internal/islands-runtime.cjs +10 -56
- package/dist/internal/islands-runtime.mjs +6 -52
- package/dist/internal/islands-server.cjs +4 -4
- package/dist/internal/islands-server.mjs +3 -3
- package/dist/internal/islx-actions-client.cjs +36 -0
- package/dist/internal/islx-actions-client.d.mts +13 -0
- package/dist/internal/islx-actions-client.d.ts +13 -0
- package/dist/internal/islx-actions-client.mjs +36 -0
- package/dist/internal/islx-actions-server.cjs +8 -0
- package/dist/internal/islx-actions-server.d.mts +6 -0
- package/dist/internal/islx-actions-server.d.ts +6 -0
- package/dist/internal/islx-actions-server.mjs +8 -0
- package/dist/internal/islx-client.d.mts +0 -4
- package/dist/internal/islx-client.d.ts +0 -4
- package/dist/internal/isolated-boundary.cjs +3 -3
- package/dist/internal/isolated-boundary.d.mts +1 -1
- package/dist/internal/isolated-boundary.d.ts +1 -1
- package/dist/internal/isolated-boundary.mjs +2 -2
- package/dist/internal/metadata-image-runtime.cjs +4 -2
- package/dist/internal/metadata-image-runtime.d.mts +18 -2
- package/dist/internal/metadata-image-runtime.d.ts +18 -2
- package/dist/internal/metadata-image-runtime.mjs +5 -3
- package/dist/internal/native-server-fns.cjs +5 -4
- package/dist/internal/native-server-fns.mjs +4 -3
- package/dist/internal/navigation-neutral.cjs +36 -0
- package/dist/internal/navigation-neutral.d.mts +14 -0
- package/dist/internal/navigation-neutral.d.ts +14 -0
- package/dist/internal/navigation-neutral.mjs +36 -0
- package/dist/internal/product-telemetry-runtime.cjs +3 -3
- package/dist/internal/product-telemetry-runtime.mjs +2 -2
- package/dist/internal/production-runtime.cjs +30 -25
- package/dist/internal/production-runtime.d.mts +14 -11
- package/dist/internal/production-runtime.d.ts +14 -11
- package/dist/internal/production-runtime.mjs +35 -30
- package/dist/internal/server-tree.cjs +5 -4
- package/dist/internal/server-tree.d.mts +3 -4
- package/dist/internal/server-tree.d.ts +3 -4
- package/dist/internal/server-tree.mjs +4 -3
- package/dist/internal/spa-router.cjs +3 -3
- package/dist/internal/spa-router.d.mts +4 -3
- package/dist/internal/spa-router.d.ts +4 -3
- package/dist/internal/spa-router.mjs +2 -2
- package/dist/internal/start-manifest.d.mts +2 -1
- package/dist/internal/start-manifest.d.ts +2 -1
- package/dist/internal/vercel-edge-middleware.cjs +1 -1
- package/dist/internal/vercel-edge-middleware.mjs +1 -1
- package/dist/island-value-protocol.d-fEoc1m8e.d.mts +27 -0
- package/dist/island-value-protocol.d-fEoc1m8e.d.ts +27 -0
- package/dist/{layers-5ZD4764G.mjs → layers-744BBUY5.mjs} +2 -2
- package/dist/layers-XLOMMQP7.cjs +21 -0
- package/dist/markdown.d.mts +2 -1
- package/dist/markdown.d.ts +2 -1
- package/dist/middleware.cjs +5 -5
- package/dist/middleware.d.mts +2 -1
- package/dist/middleware.d.ts +2 -1
- package/dist/middleware.mjs +4 -4
- package/dist/{mount.d-DcoPFqv5.d.ts → mount.d-CAovYKfs.d.ts} +1 -1
- package/dist/{mount.d-Ylo-CmzK.d.mts → mount.d-DLeYxeRR.d.mts} +1 -1
- package/dist/{native-server-fn-handler-TNVFEQW3.cjs → native-server-fn-handler-57TCQPSM.cjs} +4 -4
- package/dist/{native-server-fn-handler-OXFTI6V5.mjs → native-server-fn-handler-PYK65A46.mjs} +3 -3
- package/dist/{navigation-delegate.d-2MK4YSlL.d.ts → navigation-delegate.d-BLM-8Q3Z.d.ts} +1 -1
- package/dist/{navigation-delegate.d-BA5h0fbE.d.mts → navigation-delegate.d-Chv93QS6.d.mts} +1 -1
- package/dist/navigation-errors.d-DwHtoMyR.d.mts +13 -0
- package/dist/navigation-errors.d-DwHtoMyR.d.ts +13 -0
- package/dist/navigation.cjs +6 -6
- package/dist/navigation.d.mts +7 -6
- package/dist/navigation.d.ts +7 -6
- package/dist/navigation.mjs +5 -5
- package/dist/{nitro-C3MYDX7V.mjs → nitro-FK3SZM4H.mjs} +2 -2
- package/dist/{nitro-6UOJXJZ6.cjs → nitro-YDFMH5PY.cjs} +6 -6
- package/dist/node-module-bundle-TNSY5PAC.cjs +15 -0
- package/dist/{node-module-bundle-XPLBMXRD.mjs → node-module-bundle-ZWCQJCKA.mjs} +3 -1
- package/dist/{plugin-LN3JBZRR.cjs → plugin-3PT7I26P.cjs} +2 -2
- package/dist/{plugin-33I3V42N.mjs → plugin-QOTAPTVV.mjs} +1 -1
- package/dist/plugin.cjs +41 -37
- package/dist/plugin.d.mts +6 -5
- package/dist/plugin.d.ts +6 -5
- package/dist/plugin.mjs +40 -36
- package/dist/query/client.cjs +10 -10
- package/dist/query/client.mjs +5 -5
- package/dist/{render-plan.d-2o-AG-ot.d.ts → render-plan.d-BSTjTH8h.d.ts} +1 -1
- package/dist/{render-plan.d-ChYBMhLu.d.mts → render-plan.d-CK5Lggyb.d.mts} +1 -1
- package/dist/renderer/none/server.cjs +5 -1
- package/dist/renderer/none/server.d.mts +3 -1
- package/dist/renderer/none/server.d.ts +3 -1
- package/dist/renderer/none/server.mjs +4 -0
- package/dist/renderer/react/server.cjs +6 -6
- package/dist/renderer/react/server.mjs +3 -3
- package/dist/renderer-client.cjs +79 -17
- package/dist/renderer-client.d.mts +13 -97
- package/dist/renderer-client.d.ts +13 -97
- package/dist/renderer-client.mjs +69 -7
- package/dist/renderer.cjs +4 -2
- package/dist/renderer.d.mts +43 -5
- package/dist/renderer.d.ts +43 -5
- package/dist/renderer.mjs +3 -1
- package/dist/{request.d-RCnCBuWq.d.mts → request.d-BhggxQf3.d.mts} +1 -1
- package/dist/{request.d-CE0FIkiM.d.ts → request.d-CyJS9bjm.d.ts} +1 -1
- package/dist/request.d.mts +3 -2
- package/dist/request.d.ts +3 -2
- package/dist/{route-rendering.d-BTPOM2nU.d.ts → route-rendering.d-BLPPmI5I.d.ts} +1 -1
- package/dist/{route-rendering.d-BZJnfKsp.d.mts → route-rendering.d-CUpG2mZJ.d.mts} +1 -1
- package/dist/{router.d-BU_WE6Ol.d.ts → router.d-0X2Ki6rf.d.ts} +1 -1
- package/dist/{router.d-D8Vvwl4i.d.mts → router.d-2NQM1Kgw.d.mts} +1 -1
- package/dist/routes.cjs +1 -1
- package/dist/routes.d.mts +2 -1
- package/dist/routes.d.ts +2 -1
- package/dist/routes.mjs +1 -1
- package/dist/{rsc-pipeline-A3R4U26C.cjs → rsc-pipeline-5AOF64FL.cjs} +19 -18
- package/dist/{rsc-pipeline-JZWVSHOR.mjs → rsc-pipeline-DNRLYOJ7.mjs} +18 -17
- package/dist/{runtime-SQFRHRGJ.mjs → runtime-EHG2FRXZ.mjs} +18 -17
- package/dist/{runtime-WZ3CHHGJ.cjs → runtime-ZVHG5SRB.cjs} +20 -19
- package/dist/{runtime.d-DJ6IIKcF.d.ts → runtime.d-CXuwkUgr.d.ts} +1 -1
- package/dist/{runtime.d-BnmuOXVD.d.mts → runtime.d-CaFXcu_Q.d.mts} +1 -1
- package/dist/server-action-security.cjs +1 -1
- package/dist/server-action-security.mjs +1 -1
- package/dist/{server-components-status.d-BeqSXcjM.d.ts → server-components-status.d-BdeFD8ZH.d.ts} +1 -1
- package/dist/{server-components-status.d-BzOg9M8g.d.mts → server-components-status.d-Cp7zvBm5.d.mts} +1 -1
- package/dist/server-fn.cjs +3 -3
- package/dist/server-fn.mjs +2 -2
- package/dist/server-plugins.cjs +1 -1
- package/dist/server-plugins.d.mts +4 -3
- package/dist/server-plugins.d.ts +4 -3
- package/dist/server-plugins.mjs +1 -1
- package/dist/server-query.cjs +4 -4
- package/dist/server-query.mjs +3 -3
- package/dist/server.cjs +82 -71
- package/dist/server.d.mts +12 -11
- package/dist/server.d.ts +12 -11
- package/dist/server.mjs +61 -50
- package/dist/{spa-router.d-BOwuVkMl.d.ts → spa-router.d-Bjgl-Osi.d.ts} +3 -3
- package/dist/{spa-router.d-CDpftSsk.d.mts → spa-router.d-l3G38xHa.d.mts} +3 -3
- package/dist/{ssg.d-BTVqyq8T.d.ts → ssg.d-DDca17Lc.d.ts} +2 -2
- package/dist/{ssg.d-Bx_WFuwg.d.mts → ssg.d-RnlHOqUL.d.mts} +2 -2
- package/dist/store-core.d-BZjuC6Zc.d.mts +309 -0
- package/dist/store-core.d-BaOUOPf7.d.ts +309 -0
- package/dist/testing.cjs +7 -6
- package/dist/testing.d.mts +2 -1
- package/dist/testing.d.ts +2 -1
- package/dist/testing.mjs +6 -5
- package/dist/{utils.d-_dvevm5s.d.ts → utils.d-D8TWmpWo.d.ts} +1 -1
- package/dist/{utils.d-JkrpS-NJ.d.mts → utils.d-tdzw0_zQ.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +43 -37
- package/dist/vite.d.mts +18 -7
- package/dist/vite.d.ts +18 -7
- package/dist/vite.mjs +42 -36
- package/dist/workflows.cjs +2 -2
- package/dist/workflows.mjs +1 -1
- package/package.json +17 -2
- package/dist/analyzer-I7RBBQ65.cjs +0 -16
- package/dist/chunk-CQL5ZGFU.cjs +0 -50
- package/dist/chunk-HONTCUK6.mjs +0 -203
- package/dist/chunk-K6PGK7DC.cjs +0 -203
- package/dist/chunk-NBIVGHAT.mjs +0 -50
- package/dist/island-value-protocol.d-BRayRghM.d.mts +0 -12
- package/dist/island-value-protocol.d-BRayRghM.d.ts +0 -12
- package/dist/layers-HMEGUEXM.cjs +0 -21
- package/dist/node-module-bundle-M6BISE2P.cjs +0 -13
- package/dist/{chunk-EY7ED5UW.mjs → chunk-3RVLJTFZ.mjs} +3 -3
- package/dist/{chunk-UJPE75GF.mjs → chunk-J2VUPCCR.mjs} +3 -3
- package/dist/{chunk-PBJ7MEOV.cjs → chunk-OZUINP2P.cjs} +2 -2
- package/dist/{chunk-7FQFK3OA.mjs → chunk-V7HNYR76.mjs} +3 -3
- package/dist/{chunk-2FK47RRZ.cjs → chunk-VGHDPEPQ.cjs} +2 -2
- package/dist/{chunk-CGIVCGH5.cjs → chunk-XOFJUSWC.cjs} +2 -2
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
import {
|
|
33
33
|
collectFarmNativeServerFns,
|
|
34
34
|
findFarmNativeScreenFiles
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-C3VCYOU4.mjs";
|
|
36
36
|
import {
|
|
37
37
|
assertFarmDocsAdapterServesNoGuardedPages,
|
|
38
38
|
compileFarmDocsAdapterEdgeManifest,
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
hasFarmDocsRuntimeAdapter,
|
|
42
42
|
listFarmDocsAdapterPages,
|
|
43
43
|
listFarmDocsPagePaths
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-OMB7UGVW.mjs";
|
|
45
45
|
import {
|
|
46
46
|
FARM_DOCS_LAST_MODIFIED_MANIFEST,
|
|
47
47
|
createFarmDocsHandler,
|
|
@@ -63,9 +63,6 @@ import {
|
|
|
63
63
|
import {
|
|
64
64
|
CDN_CACHE_CONTROL_HEADERS
|
|
65
65
|
} from "./chunk-UBLKPREL.mjs";
|
|
66
|
-
import {
|
|
67
|
-
FARM_PRERENDER_ENV
|
|
68
|
-
} from "./chunk-V73Y4UBL.mjs";
|
|
69
66
|
import {
|
|
70
67
|
loadFarmDocsEngine
|
|
71
68
|
} from "./chunk-LRPPXKCX.mjs";
|
|
@@ -74,10 +71,10 @@ import {
|
|
|
74
71
|
getDeployTargetForPreset,
|
|
75
72
|
hasCustomFarmRouteContext,
|
|
76
73
|
resolveDeployOutputPath
|
|
77
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-CJDBTTLB.mjs";
|
|
78
75
|
import {
|
|
79
76
|
resolveFarmInstrumentationFile
|
|
80
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-QRNYSISP.mjs";
|
|
81
78
|
import {
|
|
82
79
|
resolveFarmInstrumentationRuntime
|
|
83
80
|
} from "./chunk-WNDAISB7.mjs";
|
|
@@ -107,6 +104,7 @@ import {
|
|
|
107
104
|
generateClientCachePersistenceCode,
|
|
108
105
|
generateFarmIntegrationProviderClientCode,
|
|
109
106
|
generateFarmIntegrationProviderServerModules,
|
|
107
|
+
isRendererCompiledComponent,
|
|
110
108
|
mergeFarmFontCss,
|
|
111
109
|
mergeFarmProductionViteConfig,
|
|
112
110
|
mergeFarmViteConfig,
|
|
@@ -114,26 +112,27 @@ import {
|
|
|
114
112
|
resolveFarmClientCacheAdapterEntry,
|
|
115
113
|
resolveFarmImageProviderForRuntime,
|
|
116
114
|
resolveFarmImageServerRuntime,
|
|
115
|
+
resolveFarmIslxActionsMode,
|
|
117
116
|
resolveFarmNotFoundComponentPath,
|
|
118
117
|
resolveFarmRouteRootStrategy,
|
|
119
118
|
toBakedMarkdownSourcePath
|
|
120
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-NRCKBDYP.mjs";
|
|
121
120
|
import {
|
|
122
121
|
TAILWIND_CSS_BROWSER_TARGET,
|
|
123
122
|
generateFarmClientPluginEntryCode,
|
|
124
123
|
hasFarmServerRuntimePlugins,
|
|
125
124
|
includesTailwindVitePlugin,
|
|
126
125
|
loadTailwindVitePlugin
|
|
127
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-MO4UTDQ6.mjs";
|
|
128
127
|
import {
|
|
129
128
|
PluginManager
|
|
130
|
-
} from "./chunk-
|
|
129
|
+
} from "./chunk-IVP5Q4BX.mjs";
|
|
131
130
|
import {
|
|
132
131
|
generateFarmTypeArtifacts,
|
|
133
132
|
readRouteRenderingDirectiveFromFile,
|
|
134
133
|
resolveRouteRenderingConfig,
|
|
135
134
|
resolveRouteRenderingConfigFromFile
|
|
136
|
-
} from "./chunk-
|
|
135
|
+
} from "./chunk-ZIZRIZLP.mjs";
|
|
137
136
|
import {
|
|
138
137
|
HOISTED_HEAD_ELEMENT,
|
|
139
138
|
appMiddlewareMayHandlePath,
|
|
@@ -146,13 +145,17 @@ import {
|
|
|
146
145
|
layoutsCanCoverSamePage,
|
|
147
146
|
routeBoundaryCoversDirectory,
|
|
148
147
|
stripRouteGroups
|
|
149
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-CA2HBLXP.mjs";
|
|
150
149
|
import {
|
|
151
150
|
FARM_NATIVE_TREE_CONTENT_TYPE
|
|
152
151
|
} from "./chunk-LLZSYFOM.mjs";
|
|
153
152
|
import {
|
|
154
153
|
farmPluginMayAffectRuntimePath
|
|
155
154
|
} from "./chunk-UUMKLGUU.mjs";
|
|
155
|
+
import {
|
|
156
|
+
FARM_PRERENDER_ENV,
|
|
157
|
+
_farmWebMCPReportsEnabled
|
|
158
|
+
} from "./chunk-GXLNARPO.mjs";
|
|
156
159
|
import {
|
|
157
160
|
FARM_API_CATALOG_PATH,
|
|
158
161
|
FARM_APP_MANIFEST_LEGACY_PATH,
|
|
@@ -160,7 +163,7 @@ import {
|
|
|
160
163
|
listFarmBuiltInRoutePaths,
|
|
161
164
|
resolveFarmApiCatalogInput,
|
|
162
165
|
resolveFarmAppManifestInput
|
|
163
|
-
} from "./chunk-
|
|
166
|
+
} from "./chunk-QSMUMK7Y.mjs";
|
|
164
167
|
import {
|
|
165
168
|
FARM_DEFAULT_MCP_PATH,
|
|
166
169
|
createFarmDefaultMCPServer,
|
|
@@ -168,7 +171,7 @@ import {
|
|
|
168
171
|
} from "./chunk-HR4N2K4V.mjs";
|
|
169
172
|
import {
|
|
170
173
|
isFarmPreviewDeploymentEnvironment
|
|
171
|
-
} from "./chunk-
|
|
174
|
+
} from "./chunk-4X7LSGM6.mjs";
|
|
172
175
|
import {
|
|
173
176
|
FARM_NATIVE_SERVER_FN_PLUGIN
|
|
174
177
|
} from "./chunk-L4RTTTVE.mjs";
|
|
@@ -189,7 +192,7 @@ import {
|
|
|
189
192
|
withFarmSourceSnapshot,
|
|
190
193
|
withFarmSourceSnapshotOf,
|
|
191
194
|
withPackageClientBoundaryCache
|
|
192
|
-
} from "./chunk-
|
|
195
|
+
} from "./chunk-EL2Z6YFZ.mjs";
|
|
193
196
|
import {
|
|
194
197
|
generateFarmDocsAdapterClientRuntime,
|
|
195
198
|
getFarmDocsAdapterConfigModule
|
|
@@ -209,6 +212,9 @@ import {
|
|
|
209
212
|
import {
|
|
210
213
|
resolveFarmServerComponentsMode
|
|
211
214
|
} from "./chunk-4QENVMG7.mjs";
|
|
215
|
+
import {
|
|
216
|
+
getFarmAppDirectories
|
|
217
|
+
} from "./chunk-Z3RM3VA2.mjs";
|
|
212
218
|
import {
|
|
213
219
|
REACT_RENDERER,
|
|
214
220
|
getFarmRendererCapabilities,
|
|
@@ -218,17 +224,14 @@ import {
|
|
|
218
224
|
isReactRenderer,
|
|
219
225
|
loadFarmRendererVitePlugins,
|
|
220
226
|
resolveFarmRendererAppSetup
|
|
221
|
-
} from "./chunk-
|
|
222
|
-
import {
|
|
223
|
-
getFarmAppDirectories
|
|
224
|
-
} from "./chunk-4STJ6LGR.mjs";
|
|
227
|
+
} from "./chunk-RMLR5RMH.mjs";
|
|
225
228
|
import {
|
|
226
229
|
applyFarmCronVercelCrons,
|
|
227
230
|
createFarmCronCloudflareConfig,
|
|
228
231
|
mergeScheduledTasks,
|
|
229
232
|
prepareFarmCronForNitro,
|
|
230
233
|
toFarmCronCloudflareScheduledTasks
|
|
231
|
-
} from "./chunk-
|
|
234
|
+
} from "./chunk-7VJXYB6S.mjs";
|
|
232
235
|
import {
|
|
233
236
|
resolveServerActionsConfig
|
|
234
237
|
} from "./chunk-NLATR3T3.mjs";
|
|
@@ -240,7 +243,7 @@ import {
|
|
|
240
243
|
isFarmMarkdownPageFile,
|
|
241
244
|
parseMarkdownFrontmatter,
|
|
242
245
|
readFarmMarkdownRouteConfig
|
|
243
|
-
} from "./chunk-
|
|
246
|
+
} from "./chunk-ICOJ2BC6.mjs";
|
|
244
247
|
import {
|
|
245
248
|
resolveFarmMdxComponentsModulePath,
|
|
246
249
|
resolveMdxConfig
|
|
@@ -250,15 +253,15 @@ import {
|
|
|
250
253
|
} from "./chunk-YU2MNIIY.mjs";
|
|
251
254
|
import {
|
|
252
255
|
withPlainDiagnostics
|
|
253
|
-
} from "./chunk-
|
|
256
|
+
} from "./chunk-AYDVUCXD.mjs";
|
|
254
257
|
import {
|
|
255
258
|
applyFarmWorkflowVercelCrons,
|
|
256
259
|
prepareFarmWorkflowsForNitro
|
|
257
|
-
} from "./chunk-
|
|
260
|
+
} from "./chunk-LTOT5KVJ.mjs";
|
|
258
261
|
import {
|
|
259
262
|
getFarmIntegrationPluginServerRuntime,
|
|
260
263
|
getIntegrationProviders
|
|
261
|
-
} from "./chunk-
|
|
264
|
+
} from "./chunk-XRSNW4IU.mjs";
|
|
262
265
|
import {
|
|
263
266
|
FARM_INTEGRATION_API_BASE_PATH_KEY
|
|
264
267
|
} from "./chunk-CZOXZ6WQ.mjs";
|
|
@@ -272,7 +275,7 @@ import {
|
|
|
272
275
|
} from "./chunk-QD34VE4N.mjs";
|
|
273
276
|
import {
|
|
274
277
|
APIRouteManager
|
|
275
|
-
} from "./chunk-
|
|
278
|
+
} from "./chunk-NAHDG6UX.mjs";
|
|
276
279
|
import {
|
|
277
280
|
readFarmI18nCatalogs
|
|
278
281
|
} from "./chunk-VO55MMBX.mjs";
|
|
@@ -300,7 +303,7 @@ import {
|
|
|
300
303
|
} from "./chunk-2I6PUKWJ.mjs";
|
|
301
304
|
import {
|
|
302
305
|
FARM_VERSION
|
|
303
|
-
} from "./chunk-
|
|
306
|
+
} from "./chunk-OP5VI4TP.mjs";
|
|
304
307
|
import {
|
|
305
308
|
FARM_VIDEO_PLAYER_PATH
|
|
306
309
|
} from "./chunk-AG27TI6Q.mjs";
|
|
@@ -327,7 +330,7 @@ import {
|
|
|
327
330
|
} from "./chunk-5KAEGBIL.mjs";
|
|
328
331
|
|
|
329
332
|
// src/build/index.ts
|
|
330
|
-
import
|
|
333
|
+
import path18 from "path";
|
|
331
334
|
import { existsSync as existsSync4 } from "fs";
|
|
332
335
|
|
|
333
336
|
// src/nitro/universal-build.ts
|
|
@@ -555,7 +558,7 @@ async function resolveHashedClientJsSrc(clientOutputDir) {
|
|
|
555
558
|
|
|
556
559
|
// src/nitro/universal-build.ts
|
|
557
560
|
import os from "os";
|
|
558
|
-
import
|
|
561
|
+
import path17 from "path";
|
|
559
562
|
import { constants as fsConstants, existsSync as existsSync3, readFileSync as readFileSync2, realpathSync as realpathSync3, statSync } from "fs";
|
|
560
563
|
import { initSync as initModuleLexer, parse as lexModule } from "es-module-lexer";
|
|
561
564
|
import { fileURLToPath } from "url";
|
|
@@ -1731,6 +1734,42 @@ function createFarmPrivateClientSourcemapsPlugin(options) {
|
|
|
1731
1734
|
};
|
|
1732
1735
|
}
|
|
1733
1736
|
|
|
1737
|
+
// src/nitro/client-brotli-assets.ts
|
|
1738
|
+
import { readdir, readFile, writeFile } from "fs/promises";
|
|
1739
|
+
import { availableParallelism } from "os";
|
|
1740
|
+
import path15 from "path";
|
|
1741
|
+
import { promisify } from "util";
|
|
1742
|
+
import { brotliCompress, constants } from "zlib";
|
|
1743
|
+
var compress = promisify(brotliCompress);
|
|
1744
|
+
var SCRIPT_OR_STYLESHEET = /\.(?:m?js|css)$/;
|
|
1745
|
+
var MIN_COMPRESSED_BYTES = 1024;
|
|
1746
|
+
async function writeFarmClientBrotliAssets(clientOutputDir) {
|
|
1747
|
+
const entries = await readdir(clientOutputDir, { recursive: true, withFileTypes: true });
|
|
1748
|
+
const files = new Set(
|
|
1749
|
+
entries.filter((entry) => entry.isFile()).map((entry) => path15.join(entry.parentPath, entry.name))
|
|
1750
|
+
);
|
|
1751
|
+
const pending = [...files].filter(
|
|
1752
|
+
(file) => SCRIPT_OR_STYLESHEET.test(file) && !files.has(`${file}.br`)
|
|
1753
|
+
);
|
|
1754
|
+
const next = async () => {
|
|
1755
|
+
const file = pending.pop();
|
|
1756
|
+
if (file === void 0) return;
|
|
1757
|
+
const source = await readFile(file);
|
|
1758
|
+
if (source.length >= MIN_COMPRESSED_BYTES) {
|
|
1759
|
+
const compressed = await compress(source, {
|
|
1760
|
+
params: {
|
|
1761
|
+
[constants.BROTLI_PARAM_MODE]: constants.BROTLI_MODE_TEXT,
|
|
1762
|
+
[constants.BROTLI_PARAM_QUALITY]: constants.BROTLI_MAX_QUALITY,
|
|
1763
|
+
[constants.BROTLI_PARAM_SIZE_HINT]: source.length
|
|
1764
|
+
}
|
|
1765
|
+
});
|
|
1766
|
+
await writeFile(`${file}.br`, compressed);
|
|
1767
|
+
}
|
|
1768
|
+
return next();
|
|
1769
|
+
};
|
|
1770
|
+
await Promise.all(Array.from({ length: availableParallelism() }, next));
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1734
1773
|
// src/middleware/static-config.ts
|
|
1735
1774
|
function literalMatcher(node) {
|
|
1736
1775
|
if (!node) return void 0;
|
|
@@ -1796,8 +1835,8 @@ function readStaticMiddlewareConfig(program) {
|
|
|
1796
1835
|
}
|
|
1797
1836
|
async function readMiddlewareFileConfig(filePath) {
|
|
1798
1837
|
try {
|
|
1799
|
-
const [{ readFile }, vite] = await Promise.all([import("fs/promises"), import("vite")]);
|
|
1800
|
-
const parsed = vite.parseSync(filePath, await
|
|
1838
|
+
const [{ readFile: readFile2 }, vite] = await Promise.all([import("fs/promises"), import("vite")]);
|
|
1839
|
+
const parsed = vite.parseSync(filePath, await readFile2(filePath, "utf8"));
|
|
1801
1840
|
if (parsed.errors?.length) return "unknown";
|
|
1802
1841
|
return readStaticMiddlewareConfig(parsed.program);
|
|
1803
1842
|
} catch {
|
|
@@ -1807,7 +1846,7 @@ async function readMiddlewareFileConfig(filePath) {
|
|
|
1807
1846
|
|
|
1808
1847
|
// src/nitro/vercel-edge-middleware.ts
|
|
1809
1848
|
import { createRequire, isBuiltin } from "module";
|
|
1810
|
-
import
|
|
1849
|
+
import path16 from "path";
|
|
1811
1850
|
import { gzipSync } from "zlib";
|
|
1812
1851
|
var FARM_VERCEL_EDGE_MIDDLEWARE_FUNCTION = "_farm_middleware";
|
|
1813
1852
|
var FARM_VERCEL_EDGE_NOT_FOUND_PATH = "/__farm/not-found";
|
|
@@ -1862,21 +1901,21 @@ ${modules.join("\n")}
|
|
|
1862
1901
|
`;
|
|
1863
1902
|
}
|
|
1864
1903
|
async function resolveFarmCoreDir(root, fs5) {
|
|
1865
|
-
const runtimeEntry = createRequire(
|
|
1904
|
+
const runtimeEntry = createRequire(path16.join(root, "package.json")).resolve(
|
|
1866
1905
|
"@farm.js/core/internal/vercel-edge-middleware"
|
|
1867
1906
|
);
|
|
1868
|
-
return fs5.realpath(
|
|
1907
|
+
return fs5.realpath(path16.resolve(path16.dirname(runtimeEntry), "..", ".."));
|
|
1869
1908
|
}
|
|
1870
1909
|
function edgeNodeModulesPlugin(coreDir, unsupported) {
|
|
1871
1910
|
const streamStub = "\0farm-edge-node-stream";
|
|
1872
|
-
const corePrefix = coreDir +
|
|
1911
|
+
const corePrefix = coreDir + path16.sep;
|
|
1873
1912
|
return {
|
|
1874
1913
|
name: "farm-vercel-edge-node-modules",
|
|
1875
1914
|
resolveId(source, importer) {
|
|
1876
1915
|
if (!isBuiltin(source)) return null;
|
|
1877
1916
|
const name = source.replace(/^node:/, "").split("/")[0];
|
|
1878
1917
|
if (EDGE_NODE_MODULES.has(name)) return { id: `node:${name}`, external: true };
|
|
1879
|
-
if (name === "stream" && importer &&
|
|
1918
|
+
if (name === "stream" && importer && path16.resolve(importer).startsWith(corePrefix)) {
|
|
1880
1919
|
return streamStub;
|
|
1881
1920
|
}
|
|
1882
1921
|
unsupported.add(`${source} (imported by ${importer ?? "the entry"})`);
|
|
@@ -1890,13 +1929,13 @@ function edgeNodeModulesPlugin(coreDir, unsupported) {
|
|
|
1890
1929
|
}
|
|
1891
1930
|
async function writeFarmVercelEdgeMiddlewareFunction(options) {
|
|
1892
1931
|
const { root, outputDir, buildDir, config, routes, guardedPages, fs: fs5 } = options;
|
|
1893
|
-
const functionDir =
|
|
1932
|
+
const functionDir = path16.join(
|
|
1894
1933
|
outputDir,
|
|
1895
1934
|
"functions",
|
|
1896
1935
|
`${FARM_VERCEL_EDGE_MIDDLEWARE_FUNCTION}.func`
|
|
1897
1936
|
);
|
|
1898
|
-
const entryPath =
|
|
1899
|
-
await fs5.mkdir(
|
|
1937
|
+
const entryPath = path16.join(buildDir, "vercel-edge-middleware-entry.mjs");
|
|
1938
|
+
await fs5.mkdir(path16.dirname(entryPath), { recursive: true });
|
|
1900
1939
|
await fs5.writeFile(
|
|
1901
1940
|
entryPath,
|
|
1902
1941
|
generateFarmVercelEdgeMiddlewareEntry(routes, config, guardedPages)
|
|
@@ -1945,9 +1984,9 @@ Remove them from the middleware (Edge provides ${[...EDGE_NODE_MODULES].join(",
|
|
|
1945
1984
|
}
|
|
1946
1985
|
await fs5.rm(functionDir, { recursive: true, force: true });
|
|
1947
1986
|
await fs5.mkdir(functionDir, { recursive: true });
|
|
1948
|
-
await fs5.writeFile(
|
|
1987
|
+
await fs5.writeFile(path16.join(functionDir, "index.js"), code);
|
|
1949
1988
|
await fs5.writeFile(
|
|
1950
|
-
|
|
1989
|
+
path16.join(functionDir, ".vc-config.json"),
|
|
1951
1990
|
`${JSON.stringify({ runtime: "edge", entrypoint: "index.js" }, null, 2)}
|
|
1952
1991
|
`
|
|
1953
1992
|
);
|
|
@@ -1969,7 +2008,7 @@ async function readFarmNativeStylesheets(clientOutputDir, clientCssHref) {
|
|
|
1969
2008
|
try {
|
|
1970
2009
|
return {
|
|
1971
2010
|
[clientCssHref]: await fs5.readFile(
|
|
1972
|
-
|
|
2011
|
+
path17.join(clientOutputDir, clientCssHref.slice(1)),
|
|
1973
2012
|
"utf8"
|
|
1974
2013
|
)
|
|
1975
2014
|
};
|
|
@@ -1984,18 +2023,18 @@ function preloadFarmNitroBuilder() {
|
|
|
1984
2023
|
);
|
|
1985
2024
|
}
|
|
1986
2025
|
var _filename = typeof import.meta.url !== "undefined" ? fileURLToPath(import.meta.url) : "";
|
|
1987
|
-
var _dirname =
|
|
2026
|
+
var _dirname = path17.dirname(_filename);
|
|
1988
2027
|
function findFarmCoreRoot(from) {
|
|
1989
|
-
let dir =
|
|
1990
|
-
while (dir !==
|
|
1991
|
-
const manifest =
|
|
2028
|
+
let dir = path17.dirname(from);
|
|
2029
|
+
while (dir !== path17.dirname(dir)) {
|
|
2030
|
+
const manifest = path17.join(dir, "package.json");
|
|
1992
2031
|
if (existsSync3(manifest)) {
|
|
1993
2032
|
try {
|
|
1994
2033
|
if (JSON.parse(readFileSync2(manifest, "utf8")).name === "@farm.js/core") return dir;
|
|
1995
2034
|
} catch {
|
|
1996
2035
|
}
|
|
1997
2036
|
}
|
|
1998
|
-
dir =
|
|
2037
|
+
dir = path17.dirname(dir);
|
|
1999
2038
|
}
|
|
2000
2039
|
return null;
|
|
2001
2040
|
}
|
|
@@ -2005,16 +2044,16 @@ function toModulePath(file) {
|
|
|
2005
2044
|
return process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
2006
2045
|
}
|
|
2007
2046
|
function findInstalledPackageDir(name, from) {
|
|
2008
|
-
for (let dir = from; ; dir =
|
|
2009
|
-
const candidate =
|
|
2010
|
-
if (existsSync3(
|
|
2047
|
+
for (let dir = from; ; dir = path17.dirname(dir)) {
|
|
2048
|
+
const candidate = path17.join(dir, "node_modules", name);
|
|
2049
|
+
if (existsSync3(path17.join(candidate, "package.json"))) {
|
|
2011
2050
|
try {
|
|
2012
2051
|
return realpathSync3(candidate);
|
|
2013
2052
|
} catch {
|
|
2014
2053
|
return null;
|
|
2015
2054
|
}
|
|
2016
2055
|
}
|
|
2017
|
-
if (dir ===
|
|
2056
|
+
if (dir === path17.dirname(dir)) return null;
|
|
2018
2057
|
}
|
|
2019
2058
|
}
|
|
2020
2059
|
function collectFarmDependencyDirs(root) {
|
|
@@ -2025,7 +2064,7 @@ function collectFarmDependencyDirs(root) {
|
|
|
2025
2064
|
seen.add(dir);
|
|
2026
2065
|
let manifest;
|
|
2027
2066
|
try {
|
|
2028
|
-
manifest = JSON.parse(readFileSync2(
|
|
2067
|
+
manifest = JSON.parse(readFileSync2(path17.join(dir, "package.json"), "utf8"));
|
|
2029
2068
|
} catch {
|
|
2030
2069
|
return;
|
|
2031
2070
|
}
|
|
@@ -2036,7 +2075,7 @@ function collectFarmDependencyDirs(root) {
|
|
|
2036
2075
|
if (farmCoreRoot) visit(realpathSync3(farmCoreRoot));
|
|
2037
2076
|
queue.push({ name: "@farm.js/core", from: root });
|
|
2038
2077
|
try {
|
|
2039
|
-
const manifest = JSON.parse(readFileSync2(
|
|
2078
|
+
const manifest = JSON.parse(readFileSync2(path17.join(root, "package.json"), "utf8"));
|
|
2040
2079
|
for (const field of ["dependencies", "devDependencies"]) {
|
|
2041
2080
|
for (const name of Object.keys(manifest[field] ?? {})) {
|
|
2042
2081
|
if (name.startsWith("@farm.js/")) queue.push({ name, from: root });
|
|
@@ -2103,17 +2142,17 @@ var FARM_SSR_PACKAGE_IMPORT = "#farm-ssr-entry";
|
|
|
2103
2142
|
var FARM_SSR_OUTPUT_DIR = "farm-ssr";
|
|
2104
2143
|
var FARM_CLIENT_BUILD_TARGET = ["es2020", "edge88", "firefox78", "chrome87", "safari14"];
|
|
2105
2144
|
function resolveNitroRuntimeDependency(root, specifier) {
|
|
2106
|
-
return createRequire2(resolveNitroPackageEntry(root)).resolve(specifier).split(
|
|
2145
|
+
return createRequire2(resolveNitroPackageEntry(root)).resolve(specifier).split(path17.sep).join("/");
|
|
2107
2146
|
}
|
|
2108
2147
|
function resolveNitroInternalRuntimeAliases(root) {
|
|
2109
2148
|
const nitroEntry = resolveNitroPackageEntry(root);
|
|
2110
|
-
const runtimeDir =
|
|
2149
|
+
const runtimeDir = path17.dirname(nitroEntry);
|
|
2111
2150
|
const nitroRequire = createRequire2(nitroEntry);
|
|
2112
2151
|
return {
|
|
2113
2152
|
...Object.fromEntries(
|
|
2114
2153
|
["app", "error/hooks", "runtime-config", "shutdown", "task"].map((moduleName) => [
|
|
2115
2154
|
`#nitro/runtime/${moduleName}`,
|
|
2116
|
-
|
|
2155
|
+
path17.join(runtimeDir, "internal", `${moduleName}.mjs`).split(path17.sep).join("/")
|
|
2117
2156
|
])
|
|
2118
2157
|
),
|
|
2119
2158
|
// Farm's generated workflow and cron wrappers live under `.farm/` and
|
|
@@ -2122,7 +2161,7 @@ function resolveNitroInternalRuntimeAliases(root) {
|
|
|
2122
2161
|
...Object.fromEntries(
|
|
2123
2162
|
["nitro/app", "nitro/h3", "nitro/task"].map((specifier) => [
|
|
2124
2163
|
specifier,
|
|
2125
|
-
nitroRequire.resolve(specifier).split(
|
|
2164
|
+
nitroRequire.resolve(specifier).split(path17.sep).join("/")
|
|
2126
2165
|
])
|
|
2127
2166
|
)
|
|
2128
2167
|
};
|
|
@@ -2146,7 +2185,7 @@ function createPrerenderRuntimeResolverPlugin(root, resolveNitroEntry = resolveN
|
|
|
2146
2185
|
name: "farm-prerender-runtime-resolver",
|
|
2147
2186
|
async resolveId(id, _importer, options) {
|
|
2148
2187
|
if (options.custom?.farmPrerenderRuntimeResolve) return null;
|
|
2149
|
-
if (id.startsWith("\0") || id.startsWith(".") || id.startsWith("#") || id.startsWith("virtual:") ||
|
|
2188
|
+
if (id.startsWith("\0") || id.startsWith(".") || id.startsWith("#") || id.startsWith("virtual:") || path17.isAbsolute(id) || NODE_BUILTIN_MODULES.has(id)) {
|
|
2150
2189
|
return null;
|
|
2151
2190
|
}
|
|
2152
2191
|
if (nitroEntry === void 0) {
|
|
@@ -2169,7 +2208,7 @@ function createFarmStorageModuleRegistration(config) {
|
|
|
2169
2208
|
const modules = _collectFarmStorageModules(config.storage);
|
|
2170
2209
|
if (modules.length === 0) return "";
|
|
2171
2210
|
const root = config.root || process.cwd();
|
|
2172
|
-
const projectRequire = createRequire2(
|
|
2211
|
+
const projectRequire = createRequire2(path17.join(root, "package.json"));
|
|
2173
2212
|
let runtimeRequire = projectRequire;
|
|
2174
2213
|
try {
|
|
2175
2214
|
runtimeRequire = createRequire2(projectRequire.resolve("@farm.js/core"));
|
|
@@ -2196,7 +2235,7 @@ ${loaders.join("\n")}
|
|
|
2196
2235
|
});` : "";
|
|
2197
2236
|
}
|
|
2198
2237
|
function resolveNitroPackageEntry(root) {
|
|
2199
|
-
const projectRequire = createRequire2(
|
|
2238
|
+
const projectRequire = createRequire2(path17.join(root, "package.json"));
|
|
2200
2239
|
let runtimeRequire = projectRequire;
|
|
2201
2240
|
try {
|
|
2202
2241
|
runtimeRequire = createRequire2(projectRequire.resolve("@farm.js/core"));
|
|
@@ -2266,7 +2305,7 @@ function createFarmReactWebServerAlias(hasEdgeBuild) {
|
|
|
2266
2305
|
}
|
|
2267
2306
|
function hasReactDomEdgeServerBuild(root) {
|
|
2268
2307
|
try {
|
|
2269
|
-
createRequire2(
|
|
2308
|
+
createRequire2(path17.join(root, "package.json")).resolve("react-dom/server.edge");
|
|
2270
2309
|
return true;
|
|
2271
2310
|
} catch {
|
|
2272
2311
|
return false;
|
|
@@ -2297,9 +2336,9 @@ function isNitroRollupExternal(id) {
|
|
|
2297
2336
|
var FARM_METADATA_IMAGE_WASM_PREFIX = "\0farm-metadata-image-wasm:";
|
|
2298
2337
|
var FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID = "\0farm-omitted-metadata-image-runtime";
|
|
2299
2338
|
function isFarmCoreModule(file) {
|
|
2300
|
-
let dir =
|
|
2301
|
-
while (dir !==
|
|
2302
|
-
const manifest =
|
|
2339
|
+
let dir = path17.dirname(file.split("?", 1)[0]);
|
|
2340
|
+
while (dir !== path17.dirname(dir)) {
|
|
2341
|
+
const manifest = path17.join(dir, "package.json");
|
|
2303
2342
|
if (existsSync3(manifest)) {
|
|
2304
2343
|
try {
|
|
2305
2344
|
return JSON.parse(readFileSync2(manifest, "utf8")).name === "@farm.js/core";
|
|
@@ -2307,7 +2346,7 @@ function isFarmCoreModule(file) {
|
|
|
2307
2346
|
return false;
|
|
2308
2347
|
}
|
|
2309
2348
|
}
|
|
2310
|
-
dir =
|
|
2349
|
+
dir = path17.dirname(dir);
|
|
2311
2350
|
}
|
|
2312
2351
|
return false;
|
|
2313
2352
|
}
|
|
@@ -2318,7 +2357,7 @@ function createOmittedMetadataImageRuntimePlugin(externalizeOtherImports) {
|
|
|
2318
2357
|
filter: { id: exactIdPattern(["@vercel/og"]) },
|
|
2319
2358
|
handler(source, importer) {
|
|
2320
2359
|
if (source !== "@vercel/og") return null;
|
|
2321
|
-
const fromCoreRuntime = importer !== void 0 && isFarmCoreModule(importer) && !/^og\.[cm]?[jt]sx?$/.test(
|
|
2360
|
+
const fromCoreRuntime = importer !== void 0 && isFarmCoreModule(importer) && !/^og\.[cm]?[jt]sx?$/.test(path17.basename(importer.split("?", 1)[0]));
|
|
2322
2361
|
if (fromCoreRuntime) return FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID;
|
|
2323
2362
|
return externalizeOtherImports ? { id: source, external: true } : null;
|
|
2324
2363
|
}
|
|
@@ -2339,14 +2378,14 @@ export class ImageResponse {
|
|
|
2339
2378
|
};
|
|
2340
2379
|
}
|
|
2341
2380
|
function readVercelOgManifest(file) {
|
|
2342
|
-
let dir =
|
|
2343
|
-
while (dir !==
|
|
2344
|
-
const manifestPath =
|
|
2381
|
+
let dir = path17.dirname(file.split("?", 1)[0]);
|
|
2382
|
+
while (dir !== path17.dirname(dir)) {
|
|
2383
|
+
const manifestPath = path17.join(dir, "package.json");
|
|
2345
2384
|
if (existsSync3(manifestPath)) {
|
|
2346
2385
|
const manifest = JSON.parse(readFileSync2(manifestPath, "utf8"));
|
|
2347
2386
|
return manifest.name === "@vercel/og" ? { dir, manifest } : null;
|
|
2348
2387
|
}
|
|
2349
|
-
dir =
|
|
2388
|
+
dir = path17.dirname(dir);
|
|
2350
2389
|
}
|
|
2351
2390
|
return null;
|
|
2352
2391
|
}
|
|
@@ -2354,7 +2393,7 @@ function resolveVercelOgConditionEntry(resolvedId, condition) {
|
|
|
2354
2393
|
const vercelOg = readVercelOgManifest(resolvedId);
|
|
2355
2394
|
const entry = vercelOg?.manifest.exports?.["."]?.[condition];
|
|
2356
2395
|
const file = typeof entry === "string" ? entry : entry?.default;
|
|
2357
|
-
return vercelOg && typeof file === "string" ?
|
|
2396
|
+
return vercelOg && typeof file === "string" ? path17.join(vercelOg.dir, file) : null;
|
|
2358
2397
|
}
|
|
2359
2398
|
function createEdgeMetadataImageRuntimePlugin({
|
|
2360
2399
|
condition,
|
|
@@ -2372,7 +2411,7 @@ function createEdgeMetadataImageRuntimePlugin({
|
|
|
2372
2411
|
if (wasm !== "module" || !source.endsWith(".wasm?module") || !importer?.replace(/\\/g, "/").includes("/@vercel/og/")) {
|
|
2373
2412
|
return null;
|
|
2374
2413
|
}
|
|
2375
|
-
const resolvedPath =
|
|
2414
|
+
const resolvedPath = path17.resolve(path17.dirname(importer.split("?", 1)[0]), source);
|
|
2376
2415
|
return { id: toPosixPath(resolvedPath), external: "absolute" };
|
|
2377
2416
|
}
|
|
2378
2417
|
};
|
|
@@ -2387,7 +2426,7 @@ function createVercelOgFontInlinePlugin(runtime = "Cloudflare Workers") {
|
|
|
2387
2426
|
return null;
|
|
2388
2427
|
}
|
|
2389
2428
|
const inlined = code.replace(VERCEL_OG_FONT_FETCH, (_match, _quote, request) => {
|
|
2390
|
-
const encoded = readFileSync2(
|
|
2429
|
+
const encoded = readFileSync2(path17.resolve(path17.dirname(file), request)).toString("base64");
|
|
2391
2430
|
return `Promise.resolve({ arrayBuffer: () => Uint8Array.from(atob(${JSON.stringify(encoded)}), (character) => character.charCodeAt(0)).buffer })`;
|
|
2392
2431
|
});
|
|
2393
2432
|
if (inlined !== code) return { code: inlined, map: null };
|
|
@@ -2406,7 +2445,7 @@ function createMetadataImageWasmPlugin() {
|
|
|
2406
2445
|
return null;
|
|
2407
2446
|
}
|
|
2408
2447
|
const requestPath = source.slice(0, -"?module".length);
|
|
2409
|
-
const resolvedPath =
|
|
2448
|
+
const resolvedPath = path17.isAbsolute(requestPath) ? requestPath : path17.resolve(path17.dirname(importer.split("?", 1)[0]), requestPath);
|
|
2410
2449
|
return `${FARM_METADATA_IMAGE_WASM_PREFIX}${resolvedPath}`;
|
|
2411
2450
|
},
|
|
2412
2451
|
load(id) {
|
|
@@ -2431,11 +2470,11 @@ function collectSSRExternalPackages(ssrBundle) {
|
|
|
2431
2470
|
for (const importId of [...output.imports, ...output.dynamicImports]) {
|
|
2432
2471
|
const normalizedImportId = importId.replace(/\\/g, "/");
|
|
2433
2472
|
const normalizedId = normalizedImportId.replace(/^\.\//, "");
|
|
2434
|
-
const resolvedRelativeId = normalizedImportId.startsWith("./") || normalizedImportId.startsWith("../") ?
|
|
2473
|
+
const resolvedRelativeId = normalizedImportId.startsWith("./") || normalizedImportId.startsWith("../") ? path17.posix.normalize(path17.posix.join(path17.posix.dirname(fileName), normalizedImportId)) : null;
|
|
2435
2474
|
if (emittedFiles.has(normalizedId) || resolvedRelativeId !== null && emittedFiles.has(resolvedRelativeId) || NODE_BUILTIN_MODULES.has(importId) || importId.startsWith("node:")) {
|
|
2436
2475
|
continue;
|
|
2437
2476
|
}
|
|
2438
|
-
if (
|
|
2477
|
+
if (path17.isAbsolute(importId) || /^[A-Za-z]:[\\/]/.test(importId) || importId.startsWith("#") || importId.startsWith("\0")) {
|
|
2439
2478
|
externalPackages.add(importId);
|
|
2440
2479
|
continue;
|
|
2441
2480
|
}
|
|
@@ -2447,15 +2486,15 @@ function collectSSRExternalPackages(ssrBundle) {
|
|
|
2447
2486
|
return externalPackages;
|
|
2448
2487
|
}
|
|
2449
2488
|
function createExternalSSRBundlePlugin(nitroEntryPath, ssrOutputDir, ssrEntryFile) {
|
|
2450
|
-
const resolvedNitroEntry =
|
|
2451
|
-
const resolvedSSREntry =
|
|
2489
|
+
const resolvedNitroEntry = path17.resolve(nitroEntryPath);
|
|
2490
|
+
const resolvedSSREntry = path17.resolve(ssrOutputDir, ssrEntryFile);
|
|
2452
2491
|
return {
|
|
2453
2492
|
name: "farm-externalize-prebuilt-ssr",
|
|
2454
2493
|
resolveId(source, importer) {
|
|
2455
|
-
if (!importer ||
|
|
2494
|
+
if (!importer || path17.resolve(importer) !== resolvedNitroEntry) {
|
|
2456
2495
|
return null;
|
|
2457
2496
|
}
|
|
2458
|
-
const resolvedImport =
|
|
2497
|
+
const resolvedImport = path17.resolve(path17.dirname(importer), source);
|
|
2459
2498
|
if (resolvedImport !== resolvedSSREntry) return null;
|
|
2460
2499
|
return { id: FARM_SSR_PACKAGE_IMPORT, external: true };
|
|
2461
2500
|
}
|
|
@@ -2593,13 +2632,13 @@ function trimSlashes(value) {
|
|
|
2593
2632
|
function resolveBuildDocsContentDir(docs, root, srcDir) {
|
|
2594
2633
|
const configuredContentDir = docs.contentDir || docs.config.contentDir;
|
|
2595
2634
|
if (typeof configuredContentDir === "string" && configuredContentDir.trim()) {
|
|
2596
|
-
const contentDir =
|
|
2635
|
+
const contentDir = path17.isAbsolute(configuredContentDir) ? configuredContentDir : path17.join(root, configuredContentDir);
|
|
2597
2636
|
return existsSync3(contentDir) ? contentDir : null;
|
|
2598
2637
|
}
|
|
2599
2638
|
const entryDir = docs.config.entry || trimSlashes(docs.entry) || "docs";
|
|
2600
|
-
const appDocsDir =
|
|
2639
|
+
const appDocsDir = path17.join(root, srcDir || "src", "app", entryDir);
|
|
2601
2640
|
if (existsSync3(appDocsDir)) return appDocsDir;
|
|
2602
|
-
const rootDocsDir =
|
|
2641
|
+
const rootDocsDir = path17.join(root, entryDir);
|
|
2603
2642
|
return existsSync3(rootDocsDir) ? rootDocsDir : null;
|
|
2604
2643
|
}
|
|
2605
2644
|
function hasProjectPostcssConfig(root) {
|
|
@@ -2616,7 +2655,7 @@ function hasProjectPostcssConfig(root) {
|
|
|
2616
2655
|
".postcssrc.mjs",
|
|
2617
2656
|
".postcssrc.ts"
|
|
2618
2657
|
];
|
|
2619
|
-
const projectRequire = createRequire2(
|
|
2658
|
+
const projectRequire = createRequire2(path17.join(root, "package.json"));
|
|
2620
2659
|
return candidates.some((file) => {
|
|
2621
2660
|
try {
|
|
2622
2661
|
projectRequire.resolve(`./${file}`);
|
|
@@ -2639,7 +2678,7 @@ async function findFarmConfigPath(root) {
|
|
|
2639
2678
|
"config.mjs"
|
|
2640
2679
|
];
|
|
2641
2680
|
for (const candidate of candidates) {
|
|
2642
|
-
const resolvedPath =
|
|
2681
|
+
const resolvedPath = path17.join(root, candidate);
|
|
2643
2682
|
try {
|
|
2644
2683
|
await fs5.access(resolvedPath);
|
|
2645
2684
|
return resolvedPath;
|
|
@@ -2676,7 +2715,7 @@ async function discoverMiddlewareRoutes(appDir) {
|
|
|
2676
2715
|
discovered.push({
|
|
2677
2716
|
path: routePath,
|
|
2678
2717
|
directory,
|
|
2679
|
-
filePath:
|
|
2718
|
+
filePath: path17.join(dir, middlewareFile.name)
|
|
2680
2719
|
});
|
|
2681
2720
|
}
|
|
2682
2721
|
for (const entry of entries) {
|
|
@@ -2684,7 +2723,7 @@ async function discoverMiddlewareRoutes(appDir) {
|
|
|
2684
2723
|
continue;
|
|
2685
2724
|
}
|
|
2686
2725
|
await walk(
|
|
2687
|
-
|
|
2726
|
+
path17.join(dir, entry.name),
|
|
2688
2727
|
appendMiddlewareRoutePath(routePath, entry.name),
|
|
2689
2728
|
appendMiddlewareDirectory(directory, entry.name),
|
|
2690
2729
|
discovered
|
|
@@ -2784,7 +2823,7 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
2784
2823
|
}
|
|
2785
2824
|
const hydrationPlanCache = routeManager.getRouteModuleHydrationPlans();
|
|
2786
2825
|
const sourceSnapshot = routeManager.takeBuildSourceSnapshot();
|
|
2787
|
-
const clientOutputDir =
|
|
2826
|
+
const clientOutputDir = path17.join(root, distDir, "client");
|
|
2788
2827
|
const [productionViteResult] = await productionViteResultPromise;
|
|
2789
2828
|
if (productionViteResult.status === "rejected") {
|
|
2790
2829
|
await routeRuntimeManifestResultPromise;
|
|
@@ -2917,10 +2956,10 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
2917
2956
|
markdownPrecompile?.pages
|
|
2918
2957
|
);
|
|
2919
2958
|
const runtimeManifestPath = await writeFarmRouteRuntimeManifest(
|
|
2920
|
-
|
|
2959
|
+
path17.join(root, distDir),
|
|
2921
2960
|
routeRuntimeManifest
|
|
2922
2961
|
);
|
|
2923
|
-
logger.info(`\u{1F4CB} Route runtime manifest: ${
|
|
2962
|
+
logger.info(`\u{1F4CB} Route runtime manifest: ${path17.relative(root, runtimeManifestPath)}`);
|
|
2924
2963
|
} catch (error) {
|
|
2925
2964
|
if (lifecyclePluginManager) {
|
|
2926
2965
|
await lifecyclePluginManager.runHookParallel("onError", {
|
|
@@ -2978,15 +3017,15 @@ async function writeSSRAssetsToClient(bundle, outputDir) {
|
|
|
2978
3017
|
await mergeBuiltFontCss(outputDir, output.source);
|
|
2979
3018
|
continue;
|
|
2980
3019
|
}
|
|
2981
|
-
const filePath =
|
|
2982
|
-
await fs5.mkdir(
|
|
3020
|
+
const filePath = path17.join(outputDir, fileName);
|
|
3021
|
+
await fs5.mkdir(path17.dirname(filePath), { recursive: true });
|
|
2983
3022
|
await fs5.writeFile(filePath, output.source);
|
|
2984
3023
|
}
|
|
2985
3024
|
}
|
|
2986
3025
|
async function writeFarmVideoPlayerToClient(outputDir) {
|
|
2987
3026
|
const fs5 = await import("fs/promises");
|
|
2988
|
-
const filePath =
|
|
2989
|
-
await fs5.mkdir(
|
|
3027
|
+
const filePath = path17.join(outputDir, FARM_VIDEO_PLAYER_PATH.slice(1));
|
|
3028
|
+
await fs5.mkdir(path17.dirname(filePath), { recursive: true });
|
|
2990
3029
|
try {
|
|
2991
3030
|
await fs5.writeFile(filePath, FARM_VIDEO_PLAYER_HTML, { flag: "wx" });
|
|
2992
3031
|
} catch (error) {
|
|
@@ -2997,15 +3036,15 @@ async function copyFarmDocsFontAssetsToClient(root, outputDir) {
|
|
|
2997
3036
|
const fs5 = await import("fs/promises");
|
|
2998
3037
|
await Promise.all(
|
|
2999
3038
|
resolveFarmDocsFontAssets(root).map(async ({ sourcePath, url }) => {
|
|
3000
|
-
const targetPath =
|
|
3001
|
-
await fs5.mkdir(
|
|
3039
|
+
const targetPath = path17.join(outputDir, url.replace(/^\/+/, ""));
|
|
3040
|
+
await fs5.mkdir(path17.dirname(targetPath), { recursive: true });
|
|
3002
3041
|
await fs5.copyFile(sourcePath, targetPath);
|
|
3003
3042
|
})
|
|
3004
3043
|
);
|
|
3005
3044
|
}
|
|
3006
3045
|
async function mergeBuiltFontCss(outputDir, fontCssSource) {
|
|
3007
3046
|
const fs5 = await import("fs/promises");
|
|
3008
|
-
const fontCssPath =
|
|
3047
|
+
const fontCssPath = path17.join(outputDir, "farm-fonts.css");
|
|
3009
3048
|
let fontCss = fontCssSource;
|
|
3010
3049
|
if (fontCss === void 0) {
|
|
3011
3050
|
try {
|
|
@@ -3014,7 +3053,7 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
|
|
|
3014
3053
|
return;
|
|
3015
3054
|
}
|
|
3016
3055
|
}
|
|
3017
|
-
const clientCssPath =
|
|
3056
|
+
const clientCssPath = path17.join(outputDir, "farm-client.css");
|
|
3018
3057
|
let clientCss = "";
|
|
3019
3058
|
try {
|
|
3020
3059
|
clientCss = await fs5.readFile(clientCssPath, "utf8");
|
|
@@ -3040,7 +3079,7 @@ var IncompleteClientBuildOutputError = class extends Error {
|
|
|
3040
3079
|
async function validateClientBuildOutput(root, srcDir, outputDir) {
|
|
3041
3080
|
const fs5 = await import("fs/promises");
|
|
3042
3081
|
const fingerprinted = await findFingerprintedClientEntry(outputDir);
|
|
3043
|
-
const clientEntryPath =
|
|
3082
|
+
const clientEntryPath = path17.join(outputDir, fingerprinted ?? "farm-client.js");
|
|
3044
3083
|
let clientEntrySize = 0;
|
|
3045
3084
|
try {
|
|
3046
3085
|
const clientEntry = await fs5.stat(clientEntryPath);
|
|
@@ -3050,8 +3089,8 @@ async function validateClientBuildOutput(root, srcDir, outputDir) {
|
|
|
3050
3089
|
if (clientEntrySize === 0) {
|
|
3051
3090
|
throw new IncompleteClientBuildOutputError("farm-client.js is missing or empty");
|
|
3052
3091
|
}
|
|
3053
|
-
const clientCssPath =
|
|
3054
|
-
const globalsCssPath =
|
|
3092
|
+
const clientCssPath = path17.join(outputDir, "farm-client.css");
|
|
3093
|
+
const globalsCssPath = path17.join(root, srcDir, "app", "globals.css");
|
|
3055
3094
|
let expectsCss = false;
|
|
3056
3095
|
try {
|
|
3057
3096
|
const globalsCss = await fs5.readFile(globalsCssPath, "utf8");
|
|
@@ -3081,10 +3120,15 @@ function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, optio
|
|
|
3081
3120
|
return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
|
|
3082
3121
|
}
|
|
3083
3122
|
async function buildClient(productionVite, config, root, srcDir, outputDir, pageRoutes, layoutRoutes = [], routeSlots = [], isolatedClientBoundaryModules = /* @__PURE__ */ new Set(), hydrationPlanCache = /* @__PURE__ */ new Map(), rendererBuildLifetime, programmaticClientRoutes, mobile = false, sourceSnapshot) {
|
|
3084
|
-
if (!mobile) await removeFarmMobileClientManifest(
|
|
3123
|
+
if (!mobile) await removeFarmMobileClientManifest(path17.dirname(outputDir));
|
|
3085
3124
|
const viteBuild = productionVite.build;
|
|
3086
|
-
const {
|
|
3087
|
-
|
|
3125
|
+
const {
|
|
3126
|
+
farmIslandContainersPlugin,
|
|
3127
|
+
farmNavigationPlugin,
|
|
3128
|
+
farmPlugin,
|
|
3129
|
+
farmServerOnlyEntriesPlugin
|
|
3130
|
+
} = await import("./vite.mjs");
|
|
3131
|
+
const { PluginManager: PluginManager2 } = await import("./plugin-QOTAPTVV.mjs");
|
|
3088
3132
|
const fs5 = await import("fs/promises");
|
|
3089
3133
|
const pluginManager = new PluginManager2({
|
|
3090
3134
|
config,
|
|
@@ -3364,12 +3408,12 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3364
3408
|
);
|
|
3365
3409
|
const clientRouteTable = createFarmClientRouteTable(clientPages);
|
|
3366
3410
|
createFarmRouter(clientRouteTable.map((route) => ({ path: route.pattern, meta: route })));
|
|
3367
|
-
await writeFarmClientRouteTable(
|
|
3411
|
+
await writeFarmClientRouteTable(path17.dirname(outputDir), clientRouteTable);
|
|
3368
3412
|
const buildTarget = async (platform) => {
|
|
3369
|
-
const clientEntryRoot =
|
|
3413
|
+
const clientEntryRoot = path17.join(root, ".farm", "tmp");
|
|
3370
3414
|
await fs5.mkdir(clientEntryRoot, { recursive: true });
|
|
3371
|
-
const clientEntryDir = await fs5.mkdtemp(
|
|
3372
|
-
const clientEntryPath =
|
|
3415
|
+
const clientEntryDir = await fs5.mkdtemp(path17.join(clientEntryRoot, "client-entry-"));
|
|
3416
|
+
const clientEntryPath = path17.join(clientEntryDir, "farm-client-entry.tsx");
|
|
3373
3417
|
const clientHydrationCode = generateClientHydrationEntry(
|
|
3374
3418
|
clientPages,
|
|
3375
3419
|
clientLayouts,
|
|
@@ -3403,15 +3447,15 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3403
3447
|
const clientEntry = islandsMode && platform === "web" && clientHydrationCode.includes("/*farm-router-stub*/") ? splitFarmClientRouter(clientHydrationCode) : { entry: clientHydrationCode, router: void 0 };
|
|
3404
3448
|
await fs5.writeFile(clientEntryPath, clientEntry.entry);
|
|
3405
3449
|
await fs5.writeFile(
|
|
3406
|
-
|
|
3450
|
+
path17.join(clientEntryDir, `${FARM_CLIENT_ROUTE_TABLE_MODULE}.tsx`),
|
|
3407
3451
|
generateFarmClientRouteTableModule(clientRouteTable)
|
|
3408
3452
|
);
|
|
3409
3453
|
if (clientEntry.router !== void 0) {
|
|
3410
|
-
await fs5.writeFile(
|
|
3454
|
+
await fs5.writeFile(path17.join(clientEntryDir, "farm-client-router.tsx"), clientEntry.router);
|
|
3411
3455
|
}
|
|
3412
3456
|
const clientInput = { [entryName]: clientEntryPath };
|
|
3413
3457
|
if (platform === "web" && canBootFarmIslandsClient(config)) {
|
|
3414
|
-
const clientBootPath =
|
|
3458
|
+
const clientBootPath = path17.join(clientEntryDir, "farm-client-boot.tsx");
|
|
3415
3459
|
await fs5.writeFile(
|
|
3416
3460
|
clientBootPath,
|
|
3417
3461
|
'import { startFarmIslandsBoot } from "@farm.js/core/internal/islands-boot";\nstartFarmIslandsBoot();\n'
|
|
@@ -3428,7 +3472,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3428
3472
|
if (hasScopedPostcssConfig) {
|
|
3429
3473
|
logger.info("\u{1F4E6} Using project PostCSS/Tailwind configuration");
|
|
3430
3474
|
} else {
|
|
3431
|
-
const postcssConfigPath =
|
|
3475
|
+
const postcssConfigPath = path17.join(clientEntryDir, "postcss.config.cjs");
|
|
3432
3476
|
await fs5.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
|
|
3433
3477
|
postcssSearchPath = clientEntryDir;
|
|
3434
3478
|
tailwindVitePlugin = await loadTailwindVitePlugin({
|
|
@@ -3487,26 +3531,27 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3487
3531
|
plugins: [
|
|
3488
3532
|
createFarmThemeCssPlugin(config.theme, config.basePath),
|
|
3489
3533
|
createFarmPrivateClientSourcemapsPlugin({
|
|
3490
|
-
outDir:
|
|
3491
|
-
|
|
3534
|
+
outDir: path17.join(
|
|
3535
|
+
path17.dirname(outputDir),
|
|
3492
3536
|
platform === "mobile" ? `${FARM_CLIENT_SOURCEMAPS_DIR}-mobile` : FARM_CLIENT_SOURCEMAPS_DIR
|
|
3493
3537
|
)
|
|
3494
3538
|
}),
|
|
3495
3539
|
// The web client's preload manifests; the mobile client records its files instead.
|
|
3496
3540
|
platform === "mobile" ? createFarmMobileClientManifestPlugin({
|
|
3497
|
-
buildDir:
|
|
3541
|
+
buildDir: path17.dirname(outputDir),
|
|
3498
3542
|
entryName
|
|
3499
3543
|
}) : createFarmClientModulePreloadPlugin({
|
|
3500
3544
|
root,
|
|
3501
|
-
buildDir:
|
|
3545
|
+
buildDir: path17.dirname(outputDir),
|
|
3502
3546
|
entryName: "farm-client",
|
|
3503
3547
|
routerModules: [
|
|
3504
|
-
|
|
3505
|
-
|
|
3548
|
+
path17.join(clientEntryDir, "farm-client-router.tsx"),
|
|
3549
|
+
path17.join(clientEntryDir, `${FARM_CLIENT_ROUTE_TABLE_MODULE}.tsx`)
|
|
3506
3550
|
],
|
|
3507
3551
|
// What the islands entry loads with its first render or hydration (RFC 0010).
|
|
3508
3552
|
...islandsMode && isReactRenderer(config.renderer) ? {
|
|
3509
3553
|
rendererImports: [
|
|
3554
|
+
"react",
|
|
3510
3555
|
"react-dom/client",
|
|
3511
3556
|
"@farm.js/core/internal/islands-runtime"
|
|
3512
3557
|
],
|
|
@@ -3516,7 +3561,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3516
3561
|
...adapterOwnsDocsRuntime && platform === "web" ? [
|
|
3517
3562
|
createFarmDocsModulePreloadPlugin({
|
|
3518
3563
|
root,
|
|
3519
|
-
buildDir:
|
|
3564
|
+
buildDir: path17.dirname(outputDir),
|
|
3520
3565
|
importer: clientEntryPath,
|
|
3521
3566
|
entryName: "farm-client",
|
|
3522
3567
|
modules: [
|
|
@@ -3529,6 +3574,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3529
3574
|
...rendererVitePlugins,
|
|
3530
3575
|
...config.vite.plugins || [],
|
|
3531
3576
|
farmServerOnlyEntriesPlugin({ platform, distDir: config.distDir || ".farm" }),
|
|
3577
|
+
farmNavigationPlugin(config.renderer),
|
|
3532
3578
|
farmDocsClientConfigPlugin(
|
|
3533
3579
|
adapterOwnsDocsRuntime ? getFarmDocsAdapterConfigModule(config.docs) : void 0
|
|
3534
3580
|
),
|
|
@@ -3625,8 +3671,8 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3625
3671
|
mergeFarmProductionViteConfig(clientViteConfig, config.vite, { clientOutput: true })
|
|
3626
3672
|
);
|
|
3627
3673
|
if (platform === "mobile") {
|
|
3628
|
-
await fs5.rm(
|
|
3629
|
-
if (!await hasFarmMobileClientEntry(
|
|
3674
|
+
await fs5.rm(path17.join(outputDir, `${entryName}.css`), { force: true });
|
|
3675
|
+
if (!await hasFarmMobileClientEntry(path17.dirname(outputDir), outputDir)) {
|
|
3630
3676
|
throw new IncompleteClientBuildOutputError(
|
|
3631
3677
|
`${FARM_MOBILE_CLIENT_ENTRY_NAME}.js is missing or empty`
|
|
3632
3678
|
);
|
|
@@ -4447,9 +4493,9 @@ ${streamNavigations ? ` // A streamed navigation swaps in the page's shell; its
|
|
|
4447
4493
|
const response = await fetchFarmNavigationDocument(url, {
|
|
4448
4494
|
"Accept": "text/html",
|
|
4449
4495
|
...(interceptFrom ? { "X-Farm-Intercept-From": interceptFrom } : {}),
|
|
4450
|
-
// Islands mode: the server leaves out island values this browser holds
|
|
4451
|
-
// layouts it shows.
|
|
4452
|
-
...getFarmIslandValueHeaders(),
|
|
4496
|
+
// Islands mode: the server leaves out island values this browser holds (the swap keeps
|
|
4497
|
+
// the ones only the page holds, keepFarmIslandValues), and the layouts it shows.
|
|
4498
|
+
...getFarmIslandValueHeaders(${streamNavigations ? 'document.getElementById("root") || document.body' : ""}),
|
|
4453
4499
|
...partialHeaders,
|
|
4454
4500
|
...(streamShell ? { "F-Stream": "flush" } : {}),
|
|
4455
4501
|
}, recover, signal);
|
|
@@ -4880,8 +4926,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
4880
4926
|
);
|
|
4881
4927
|
const appSetupPath = resolveFarmRendererAppSetup(root, renderer);
|
|
4882
4928
|
const lazyRenderer = islandValues && platform !== "mobile" && isReactRenderer(renderer) && clientRouteSlots.length === 0;
|
|
4883
|
-
const rendererClientImports = lazyRenderer ? `import React from "react";
|
|
4884
|
-
import { holdFarmIslandInteractions, restorePagePosition } from "@farm.js/core/internal/client-runtime";` : isReactRenderer(renderer) ? `import React from "react";
|
|
4929
|
+
const rendererClientImports = lazyRenderer ? `import { holdFarmIslandInteractions, restorePagePosition, watchFarmIslandTriggers } from "@farm.js/core/internal/client-runtime";` : isReactRenderer(renderer) ? `import React from "react";
|
|
4885
4930
|
import { createRoot, hydrateRoot } from "react-dom/client";
|
|
4886
4931
|
import { restorePagePosition } from "@farm.js/core/internal/client-runtime";` : (
|
|
4887
4932
|
// Named exports only, as the server entry and the development client read them. A copy
|
|
@@ -4894,12 +4939,13 @@ __farmConfigureApp(__farmAppSetup);` : `import * as __farmRendererClient from ${
|
|
|
4894
4939
|
import { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};
|
|
4895
4940
|
const React = { ...__farmRendererClient };`
|
|
4896
4941
|
);
|
|
4942
|
+
const hydrateFarmRouteCall = isReactRenderer(renderer) ? "return hydrateRoot(container, route.element);" : "return route.layouts.length > 0 ? hydrateRoot(container, route.element, route) : hydrateRoot(container, route.element);";
|
|
4897
4943
|
const providerClientCode = generateFarmIntegrationProviderClientCode(
|
|
4898
4944
|
integrationProviders,
|
|
4899
4945
|
root,
|
|
4900
4946
|
renderer.componentExtensions ?? []
|
|
4901
4947
|
);
|
|
4902
|
-
const globalsCssPath =
|
|
4948
|
+
const globalsCssPath = path17.join(root, srcDir, "app", "globals.css");
|
|
4903
4949
|
const serverStyleModules = [];
|
|
4904
4950
|
const cssImport = [
|
|
4905
4951
|
...existsSync3(globalsCssPath) ? [globalsCssPath] : [],
|
|
@@ -5168,11 +5214,12 @@ ${generateUniversalRouterStateProperties()}
|
|
|
5168
5214
|
|
|
5169
5215
|
reconcileFarmDocumentHead(doc);
|
|
5170
5216
|
|
|
5171
|
-
// Swap root content
|
|
5217
|
+
// Swap root content: the parsed nodes themselves, not markup the page parses again.
|
|
5172
5218
|
const newRoot = doc.getElementById("root");
|
|
5173
5219
|
const currentRoot = document.getElementById("root");
|
|
5174
5220
|
if (!newRoot || !currentRoot) return this.swapDocument(doc);
|
|
5175
|
-
|
|
5221
|
+
adoptFarmParsedNodes(newRoot);
|
|
5222
|
+
currentRoot.replaceChildren(...newRoot.childNodes);
|
|
5176
5223
|
return true;
|
|
5177
5224
|
},
|
|
5178
5225
|
|
|
@@ -5189,7 +5236,8 @@ ${generateUniversalRouterStateProperties()}
|
|
|
5189
5236
|
});
|
|
5190
5237
|
|
|
5191
5238
|
document.head.innerHTML = doc.head ? doc.head.innerHTML : "";
|
|
5192
|
-
|
|
5239
|
+
adoptFarmParsedNodes(doc.body);
|
|
5240
|
+
document.body.replaceChildren(...doc.body.childNodes);
|
|
5193
5241
|
delete window.__farmDocsRuntime;
|
|
5194
5242
|
delete window.__farmDocsPageActionsRuntime;
|
|
5195
5243
|
|
|
@@ -5324,7 +5372,8 @@ installFarmLinkPrefetch();
|
|
|
5324
5372
|
...serverTreeEnabled ? ["createFarmServerTreeElement"] : [],
|
|
5325
5373
|
...hasServerTreeLayouts ? ["createFarmServerTreeLayout"] : []
|
|
5326
5374
|
].join(", ");
|
|
5327
|
-
const lazyRendererRuntime = lazyRenderer ? `// React DOM${isolatedHydrationEnabled ? " and islx" : ""} load with the first render or hydration (RFC 0010).
|
|
5375
|
+
const lazyRendererRuntime = lazyRenderer ? `// React, React DOM${isolatedHydrationEnabled ? " and islx" : ""} load with the first render or hydration (RFC 0010).
|
|
5376
|
+
let React;
|
|
5328
5377
|
let createRoot;
|
|
5329
5378
|
let hydrateRoot;
|
|
5330
5379
|
let farmRendererLoading = null;
|
|
@@ -5334,14 +5383,16 @@ let farmRendererLoaded = false;${isolatedHydrationEnabled ? `
|
|
|
5334
5383
|
const releaseFarmIslandInteractions = holdFarmIslandInteractions("f-island");` : ""}
|
|
5335
5384
|
function loadFarmRenderer() {
|
|
5336
5385
|
return farmRendererLoading || (farmRendererLoading = Promise.all([
|
|
5386
|
+
import("react"),
|
|
5337
5387
|
import("react-dom/client"),${isolatedHydrationEnabled ? `
|
|
5338
5388
|
// Named here, so the build keeps only these of islx's exports.
|
|
5339
5389
|
import("@farm.js/core/internal/islands-runtime").then(function({ ${islandsRuntimeExports} }) {
|
|
5340
5390
|
return { ${islandsRuntimeExports} };
|
|
5341
5391
|
}),` : ""}
|
|
5342
5392
|
]).then(function(modules) {
|
|
5343
|
-
|
|
5344
|
-
|
|
5393
|
+
React = modules[0].default;
|
|
5394
|
+
createRoot = modules[1].createRoot;
|
|
5395
|
+
hydrateRoot = modules[1].hydrateRoot;${isolatedHydrationEnabled ? "\n startFarmIslandsRuntime(modules[2]);\n releaseFarmIslandInteractions();\n runFarmIslandsWaiting();" : ""}
|
|
5345
5396
|
farmRendererLoaded = true;
|
|
5346
5397
|
}, function(error) {${isolatedHydrationEnabled ? `
|
|
5347
5398
|
// Without islx a held click would never replay: the page acts natively again.
|
|
@@ -5378,26 +5429,55 @@ function startFarmIslandsRuntime(islands) {
|
|
|
5378
5429
|
// A hydrating layout keeps a non-hydrating page as server HTML; this wrapper runs its islands.
|
|
5379
5430
|
FarmServerPage = islands.createFarmServerPageBoundary(React, farmIslandsRuntime);
|
|
5380
5431
|
}
|
|
5381
|
-
//
|
|
5382
|
-
//
|
|
5383
|
-
|
|
5432
|
+
// islx loads with the first island that is due, as the boot decides on a first load: at once for
|
|
5433
|
+
// one that hydrates at load, else on its trigger. A page or navigation of islands that wait loads
|
|
5434
|
+
// none of it. Until it loads, calls wait here in the order they were made and run with it.
|
|
5435
|
+
const farmIslandsWaiting = [];
|
|
5436
|
+
function runFarmIslandsWaiting() {
|
|
5437
|
+
for (const entry of farmIslandsWaiting.splice(0)) {
|
|
5438
|
+
if (entry.stop) entry.stop();
|
|
5439
|
+
entry.run(farmIslandsRuntime);
|
|
5440
|
+
}
|
|
5441
|
+
}
|
|
5442
|
+
// Behind a load under way, calls wait for it; one that fails reports itself to whoever awaited it.
|
|
5443
|
+
function whenFarmIslandsRuntime(scope, call) {
|
|
5384
5444
|
if (farmIslandsRuntime) call(farmIslandsRuntime);
|
|
5385
5445
|
else if (farmRendererLoading) farmRendererLoading.then(function() { call(farmIslandsRuntime); }, function() {});
|
|
5446
|
+
else farmIslandsWaiting.push({ scope: scope, run: call });
|
|
5386
5447
|
}
|
|
5387
5448
|
const farmIsolatedHydrationRuntime = {
|
|
5388
5449
|
hydrate: function(scope, signal) {
|
|
5389
5450
|
if (farmIslandsRuntime) return farmIslandsRuntime.hydrate(scope, signal);
|
|
5390
|
-
|
|
5451
|
+
const stop = farmRendererLoading
|
|
5452
|
+
? null
|
|
5453
|
+
: watchFarmIslandTriggers(scope, "f-island", function() { void loadFarmRenderer(); });
|
|
5454
|
+
if (!stop) return loadFarmRenderer().then(function() { return farmIslandsRuntime.hydrate(scope, signal); });
|
|
5455
|
+
farmIslandsWaiting.push({
|
|
5456
|
+
scope: scope,
|
|
5457
|
+
stop: stop,
|
|
5458
|
+
run: function(runtime) {
|
|
5459
|
+
if (!signal || !signal.aborted) void runtime.hydrate(scope, signal);
|
|
5460
|
+
},
|
|
5461
|
+
});
|
|
5462
|
+
return Promise.resolve();
|
|
5391
5463
|
},
|
|
5392
5464
|
dispose: function(scope) {
|
|
5393
|
-
|
|
5465
|
+
if (farmIslandsRuntime) return farmIslandsRuntime.dispose(scope);
|
|
5466
|
+
// Nothing has hydrated yet: what removed DOM waits for goes with it.
|
|
5467
|
+
for (let index = farmIslandsWaiting.length - 1; index >= 0; index--) {
|
|
5468
|
+
const entry = farmIslandsWaiting[index];
|
|
5469
|
+
if (!scope.contains(entry.scope)) continue;
|
|
5470
|
+
farmIslandsWaiting.splice(index, 1);
|
|
5471
|
+
if (entry.stop) entry.stop();
|
|
5472
|
+
}
|
|
5473
|
+
if (farmRendererLoading) farmRendererLoading.then(function() { farmIslandsRuntime.dispose(scope); }, function() {});
|
|
5394
5474
|
},
|
|
5395
5475
|
// Only a hydrated island has state to carry over.
|
|
5396
5476
|
carryOver: function(from, to) {
|
|
5397
5477
|
if (farmIslandsRuntime) farmIslandsRuntime.carryOver(from, to);
|
|
5398
5478
|
},
|
|
5399
5479
|
endStream: function(root) {
|
|
5400
|
-
whenFarmIslandsRuntime(function(runtime) { runtime.endStream(root); });
|
|
5480
|
+
whenFarmIslandsRuntime(root, function(runtime) { runtime.endStream(root); });
|
|
5401
5481
|
},
|
|
5402
5482
|
};` : `const farmIsolatedHydrationRuntime = createFarmIsolatedHydrationRuntime({
|
|
5403
5483
|
ReactRuntime: React,
|
|
@@ -5455,7 +5535,7 @@ ${layoutImports}
|
|
|
5455
5535
|
${rendererClientImports}
|
|
5456
5536
|
${isolatedHydrationImport}
|
|
5457
5537
|
${providerClientCode.imports}
|
|
5458
|
-
import { createClientCancellation, createClientPluginManager, createPluginlessClientRuntime, getFarmIslandValueHeaders, getHashTargetElement, installChunkErrorRecovery, installFarmLinkPrefetch, isFarmBlockedNavigationURL, isFarmExternalNavigationURL, readFarmLinkNavigateOptions, rememberFarmLinkLocale, reconcileFarmDocumentHead, runFarmNavigationDelegates, scheduleFarmIslandHydration, createFarmSearchParams, searchParamsToObject, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
|
|
5538
|
+
import { createClientCancellation, createClientPluginManager, createPluginlessClientRuntime, getFarmIslandValueHeaders, getHashTargetElement, keepFarmIslandValues, installChunkErrorRecovery, installFarmLinkPrefetch, isFarmBlockedNavigationURL, isFarmExternalNavigationURL, readFarmLinkNavigateOptions, rememberFarmLinkLocale, reconcileFarmDocumentHead, replayFarmQueuedInteraction, runFarmNavigationDelegates, scheduleFarmIslandHydration, createFarmSearchParams, searchParamsToObject, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
|
|
5459
5539
|
import { createFarmDeploymentMismatchError, createFarmDeploymentRequestHeaders, isFarmDeploymentMismatchResponse } from "@farm.js/core/deployment";
|
|
5460
5540
|
import { createFarmRouter, isFarmRouteActive, matchFarmRoute } from "@farm.js/core/router";
|
|
5461
5541
|
${clientPluginEntry.imports}
|
|
@@ -5719,7 +5799,16 @@ function createFarmRouteState(page, pathname, params, includeLayouts) {
|
|
|
5719
5799
|
|
|
5720
5800
|
function hydrateFarmRoute(container, route) {
|
|
5721
5801
|
farmLastRouteState = route;
|
|
5722
|
-
${
|
|
5802
|
+
${getFarmRendererCapabilities(renderer).hydrationFallback ? `try {
|
|
5803
|
+
${hydrateFarmRouteCall}
|
|
5804
|
+
} catch (error) {
|
|
5805
|
+
// The renderer opted in with capabilities.hydrationFallback, as development always does. The
|
|
5806
|
+
// page still works, but the server's DOM, focus, and typed input are gone, so say so.
|
|
5807
|
+
console.error("[Farm.js] Hydration error; rendering the page on the client instead:", error);
|
|
5808
|
+
const root = createRoot(container);
|
|
5809
|
+
renderFarmRoute(root, route);
|
|
5810
|
+
return root;
|
|
5811
|
+
}` : hydrateFarmRouteCall}
|
|
5723
5812
|
}
|
|
5724
5813
|
|
|
5725
5814
|
function renderFarmRoute(root, route) {
|
|
@@ -5877,6 +5966,26 @@ function renderClientRouteSlot(slot, registration, mode) {
|
|
|
5877
5966
|
return true;
|
|
5878
5967
|
}
|
|
5879
5968
|
|
|
5969
|
+
// The document's pre-hydration hold keeps clicks and submits until what they target hydrates, as in
|
|
5970
|
+
// development. A hydrated route slot stops holding its own and replays what it held, as the page's
|
|
5971
|
+
// scheduler does for the page.
|
|
5972
|
+
function replayPreHydrationClicks(container) {
|
|
5973
|
+
container.dataset.farmIslandHydrated = "true";
|
|
5974
|
+
const queue = Array.isArray(window.__FARM_PREHYDRATION_CLICK_QUEUE__)
|
|
5975
|
+
? window.__FARM_PREHYDRATION_CLICK_QUEUE__
|
|
5976
|
+
: [];
|
|
5977
|
+
const held = queue.filter(function(item) {
|
|
5978
|
+
return item && item.target instanceof Element && container.contains(item.target);
|
|
5979
|
+
});
|
|
5980
|
+
if (held.length === 0) return;
|
|
5981
|
+
queue.splice(0, queue.length, ...queue.filter(function(item) { return held.indexOf(item) === -1; }));
|
|
5982
|
+
for (const item of held) {
|
|
5983
|
+
setTimeout(function() {
|
|
5984
|
+
if (item.target.isConnected) replayFarmQueuedInteraction(item.target, item.kind);
|
|
5985
|
+
}, 0);
|
|
5986
|
+
}
|
|
5987
|
+
}
|
|
5988
|
+
|
|
5880
5989
|
function hydrateInitialRouteSlots() {
|
|
5881
5990
|
const slots = Array.isArray(window.__FARM_ROUTE_SLOTS__)
|
|
5882
5991
|
? window.__FARM_ROUTE_SLOTS__
|
|
@@ -5885,7 +5994,9 @@ function hydrateInitialRouteSlots() {
|
|
|
5885
5994
|
const registration = findClientRouteSlot(slot);
|
|
5886
5995
|
if (!registration) continue;
|
|
5887
5996
|
try {
|
|
5888
|
-
renderClientRouteSlot(slot, registration, "hydrate")
|
|
5997
|
+
if (renderClientRouteSlot(slot, registration, "hydrate")) {
|
|
5998
|
+
replayPreHydrationClicks(document.getElementById(slot.containerId));
|
|
5999
|
+
}
|
|
5889
6000
|
} catch (error) {
|
|
5890
6001
|
console.warn("[Farm.js] Could not hydrate route slot:", slot.name, error);
|
|
5891
6002
|
}
|
|
@@ -5954,6 +6065,15 @@ function setFarmHydrated() {
|
|
|
5954
6065
|
isHydrated = true;
|
|
5955
6066
|
}
|
|
5956
6067
|
|
|
6068
|
+
// The document's head script holds clicks and submits until the page hydrates. Once the first
|
|
6069
|
+
// hydration settles it holds nothing more, as in development: each root that hydrated replayed
|
|
6070
|
+
// what it held, and a navigation's page renders in a React root that takes its own clicks.
|
|
6071
|
+
function markFarmHydrated() {
|
|
6072
|
+
if (window.__FARM_HYDRATED__ !== false) return;
|
|
6073
|
+
window.__FARM_HYDRATED__ = true;
|
|
6074
|
+
document.documentElement.dataset.farmHydrated = "true";
|
|
6075
|
+
}
|
|
6076
|
+
|
|
5957
6077
|
${generateUniversalRouterStateRuntime(islandValues)}
|
|
5958
6078
|
|
|
5959
6079
|
function cancelPendingPageHydration() {
|
|
@@ -6195,9 +6315,12 @@ async function streamFarmNavigation(stream, root, isCurrent) {
|
|
|
6195
6315
|
for (let flush = await stream.next(); flush !== null; flush = await stream.next()) {
|
|
6196
6316
|
if (!isCurrent()) return stream.cancel();
|
|
6197
6317
|
html += flush;
|
|
6198
|
-
const parsed = new DOMParser()
|
|
6318
|
+
const parsed = new DOMParser()
|
|
6319
|
+
.parseFromString('<div id="root">' + flush, "text/html")
|
|
6320
|
+
.getElementById("root");
|
|
6321
|
+
adoptFarmParsedNodes(parsed);
|
|
6199
6322
|
const fragment = document.createDocumentFragment();
|
|
6200
|
-
for (const node of Array.from(parsed.
|
|
6323
|
+
for (const node of Array.from(parsed.childNodes)) fragment.appendChild(node);
|
|
6201
6324
|
activateNavigationScripts(fragment);
|
|
6202
6325
|
root.appendChild(fragment);
|
|
6203
6326
|
}
|
|
@@ -6293,6 +6416,8 @@ ${islandValues ? FARM_REFRESH_FIELDS_SOURCE : ""}function replaceSharedLayoutBou
|
|
|
6293
6416
|
${isolatedHydrationEnabled ? `${islandValues ? `// A refresh keeps the islands still on the page, with their state and new props.
|
|
6294
6417
|
if (refresh) farmIsolatedHydrationRuntime.carryOver(currentTarget, nextTarget);
|
|
6295
6418
|
` : ""}disposeFarmIsolatedClientBoundaries(currentTarget);` : ""}
|
|
6419
|
+
// After the comparison: a noscript turned to text serializes escaped in the parsed document.
|
|
6420
|
+
adoptFarmParsedNodes(nextRoot);
|
|
6296
6421
|
currentTarget.replaceWith(nextTarget);${islandValues ? "\n if (fields) restoreFarmServerFields(fields, nextTarget);" : ""}
|
|
6297
6422
|
activateNavigationScripts(nextTarget);
|
|
6298
6423
|
if (nextTreeRoot && nextTreeRoot !== nextTarget) nextTreeRoot.remove();
|
|
@@ -6692,6 +6817,7 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
6692
6817
|
|
|
6693
6818
|
${islandValues ? `// A payload-only page renders only in a React root that rebuilds it.
|
|
6694
6819
|
if (nextPage?.querySelector('script[type="f/tree"][partial]')) return "segment-mismatch";` : ""}
|
|
6820
|
+
${islandValues ? "const keepValues = keepFarmIslandValues(currentRoot);" : ""}
|
|
6695
6821
|
const rootWasReactOwned = reactRootContainer === currentRoot;
|
|
6696
6822
|
resetReactRoot();
|
|
6697
6823
|
resetRouteSlotRoots();
|
|
@@ -6704,10 +6830,13 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
6704
6830
|
${islandValues ? 'if (!replacedSharedBoundary && isSegment) return "segment-mismatch";' : ""}
|
|
6705
6831
|
if (!replacedSharedBoundary) {
|
|
6706
6832
|
${isolatedHydrationEnabled ? "disposeFarmIsolatedClientBoundaries(currentRoot);" : ""}
|
|
6707
|
-
|
|
6833
|
+
// The parsed nodes themselves, not markup the page parses again.
|
|
6834
|
+
adoptFarmParsedNodes(newRoot);
|
|
6835
|
+
currentRoot.replaceChildren(...newRoot.childNodes);
|
|
6708
6836
|
activateNavigationScripts(currentRoot);
|
|
6709
6837
|
isolatedHydrationScope = currentRoot;
|
|
6710
6838
|
}
|
|
6839
|
+
${islandValues ? "keepValues();" : ""}
|
|
6711
6840
|
window.__FARM_ROUTE_SLOTS__ = nextRouteSlots;
|
|
6712
6841
|
hydrateInitialRouteSlots();
|
|
6713
6842
|
|
|
@@ -6785,7 +6914,8 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
6785
6914
|
});
|
|
6786
6915
|
|
|
6787
6916
|
document.head.innerHTML = doc.head ? doc.head.innerHTML : "";
|
|
6788
|
-
|
|
6917
|
+
adoptFarmParsedNodes(doc.body);
|
|
6918
|
+
document.body.replaceChildren(...doc.body.childNodes);
|
|
6789
6919
|
delete window.__farmDocsRuntime;
|
|
6790
6920
|
delete window.__farmDocsPageActionsRuntime;
|
|
6791
6921
|
|
|
@@ -6904,13 +7034,18 @@ document.addEventListener("click", function(e) {
|
|
|
6904
7034
|
if (isFarmDocsSearchPage()) {
|
|
6905
7035
|
mountFarmDocsSearch();
|
|
6906
7036
|
}
|
|
6907
|
-
void hydrate();
|
|
7037
|
+
void hydrate().finally(markFarmHydrated);
|
|
6908
7038
|
`.trim();
|
|
6909
7039
|
}
|
|
6910
7040
|
async function buildSSRInMemory(productionVite, config, root, routeManager, apiRouteManager, serverRenderer, preset, collectedPageRoutes, collectedLayoutRoutes, collectedRouteSlots, isolatedClientBoundaryModules, hydrationPlanCache, rendererBuildLifetime, sourceSnapshot) {
|
|
6911
7041
|
const viteBuild = productionVite.build;
|
|
6912
|
-
const {
|
|
6913
|
-
|
|
7042
|
+
const {
|
|
7043
|
+
farmIslandContainersPlugin,
|
|
7044
|
+
farmNavigationPlugin,
|
|
7045
|
+
farmPlugin,
|
|
7046
|
+
farmServerOnlyEntriesPlugin
|
|
7047
|
+
} = await import("./vite.mjs");
|
|
7048
|
+
const { PluginManager: PluginManager2 } = await import("./plugin-QOTAPTVV.mjs");
|
|
6914
7049
|
const fs5 = await import("fs/promises");
|
|
6915
7050
|
const pluginManager = new PluginManager2({
|
|
6916
7051
|
config,
|
|
@@ -6926,9 +7061,9 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6926
7061
|
buildLifetime: rendererBuildLifetime
|
|
6927
7062
|
});
|
|
6928
7063
|
if (!hasScopedPostcssConfig) {
|
|
6929
|
-
postcssConfigDir = await fs5.mkdtemp(
|
|
7064
|
+
postcssConfigDir = await fs5.mkdtemp(path17.join(os.tmpdir(), "farm-postcss-"));
|
|
6930
7065
|
await fs5.writeFile(
|
|
6931
|
-
|
|
7066
|
+
path17.join(postcssConfigDir, "postcss.config.cjs"),
|
|
6932
7067
|
"module.exports = { plugins: [] };\n"
|
|
6933
7068
|
);
|
|
6934
7069
|
tailwindVitePlugin = await loadTailwindVitePlugin({
|
|
@@ -7272,6 +7407,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7272
7407
|
] : [],
|
|
7273
7408
|
{ ...createReactProductionModePlugin(), enforce: "pre" },
|
|
7274
7409
|
farmServerOnlyEntriesPlugin({ distDir: config.distDir || ".farm" }),
|
|
7410
|
+
farmNavigationPlugin(config.renderer),
|
|
7275
7411
|
farmIslandContainersPlugin(config),
|
|
7276
7412
|
farmPlugin(
|
|
7277
7413
|
{
|
|
@@ -7359,7 +7495,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7359
7495
|
}
|
|
7360
7496
|
function readFarmAppPackageIdentity(root) {
|
|
7361
7497
|
try {
|
|
7362
|
-
return JSON.parse(readFileSync2(
|
|
7498
|
+
return JSON.parse(readFileSync2(path17.join(root, "package.json"), "utf8"));
|
|
7363
7499
|
} catch {
|
|
7364
7500
|
return {};
|
|
7365
7501
|
}
|
|
@@ -7704,7 +7840,7 @@ function getFarmBufferedPreloadMarker(html) {
|
|
|
7704
7840
|
// Prove eligibility while Farm still owns the complete document string.
|
|
7705
7841
|
// Candidate-bearing or unknown bodies must retain the full parser path.
|
|
7706
7842
|
// Response.text() strips a leading UTF-8 BOM; retain that legacy behavior.
|
|
7707
|
-
return typeof html === "string" && html.charCodeAt(0) !== 0xfeff &&
|
|
7843
|
+
return typeof html === "string" && html.charCodeAt(0) !== 0xfeff && !hasFarmHtmlPreloadToken(html) ? "none" : "1";
|
|
7708
7844
|
}
|
|
7709
7845
|
|
|
7710
7846
|
async function applyFarmPreloadBudget(response, pathname, request) {
|
|
@@ -7792,10 +7928,11 @@ function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlot
|
|
|
7792
7928
|
);
|
|
7793
7929
|
const searchPreserveRoutesSource = searchPreserveRoutes.length > 0 ? JSON.stringify(searchPreserveRoutes) : "";
|
|
7794
7930
|
const farmIslandsMode = resolveFarmServerComponentsMode(config.experimental?.serverComponents) === "islands";
|
|
7931
|
+
const farmRendererActions = resolveFarmIslxActionsMode(config) === "renderer";
|
|
7795
7932
|
const farmClientBoot = canBootFarmIslandsClient(config);
|
|
7796
7933
|
const farmMobileClient = shouldBuildFarmMobileClient(config);
|
|
7797
7934
|
const farmMobileShells = farmMobileClient && config.mobileShells ? config.mobileShells : null;
|
|
7798
|
-
const hasCompressionRuntime = config.compress && resolveFarmInstrumentationRuntime(preset)
|
|
7935
|
+
const hasCompressionRuntime = config.compress && resolveFarmInstrumentationRuntime(preset) !== "edge";
|
|
7799
7936
|
const servesAgentRobotsTxt = Boolean(config.agent?.crawlers?.enabled) && !applicationMetadataRoutes.some(
|
|
7800
7937
|
(metadata) => metadata.kind === "robots" && metadata.pattern === "/"
|
|
7801
7938
|
);
|
|
@@ -7806,6 +7943,7 @@ function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlot
|
|
|
7806
7943
|
const servesAiCatalog = config.agent?.aiCatalog !== false;
|
|
7807
7944
|
const hasPluginRuntime = hasRuntimeIntegrationConfig || hasServerRuntimePlugins;
|
|
7808
7945
|
const hasInfraAnalyticsRuntime = config.analytics !== false && resolveFarmInstrumentationRuntime(preset) === "nodejs";
|
|
7946
|
+
const reportsWebMCPCalls = hasInfraAnalyticsRuntime && _farmWebMCPReportsEnabled(config.plugins);
|
|
7809
7947
|
const hasPrecompiledDocs = Boolean(farmDocsPrecompiledManifest);
|
|
7810
7948
|
const adapterOwnsDocsRuntime = Boolean(
|
|
7811
7949
|
isReactRenderer(config.renderer) && config.docs?.enabled && config.docs.adapter?.server && config.docs.adapter.react
|
|
@@ -8001,7 +8139,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8001
8139
|
source: ${JSON.stringify(route.source ?? "")},
|
|
8002
8140
|
filePath: ${JSON.stringify(toBakedMarkdownSourcePath(config.root, route.modulePath))},
|
|
8003
8141
|
components: farmMdxComponents,
|
|
8004
|
-
config: farmMdxConfig,
|
|
8142
|
+
config: farmMdxConfig,${isReactRenderer(config.renderer) ? "" : "\n renderer: React,"}
|
|
8005
8143
|
}),
|
|
8006
8144
|
markdownSource: {
|
|
8007
8145
|
source: ${JSON.stringify(route.source ?? "")},
|
|
@@ -8136,12 +8274,13 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8136
8274
|
metadataImageImports.push(
|
|
8137
8275
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(image.modulePath)};`
|
|
8138
8276
|
);
|
|
8277
|
+
const component = !isReactRenderer(config.renderer) && isRendererCompiledComponent(image.modulePath, config.renderer?.componentExtensions ?? []);
|
|
8139
8278
|
metadataImageRegistrations.push(`
|
|
8140
8279
|
{
|
|
8141
8280
|
pattern: ${JSON.stringify(image.pattern)},
|
|
8142
8281
|
kind: ${JSON.stringify(image.kind)},
|
|
8143
8282
|
fileName: ${JSON.stringify(image.fileName)},
|
|
8144
|
-
sourceType: "module",
|
|
8283
|
+
sourceType: "module",${component ? "\n component: true," : ""}
|
|
8145
8284
|
module: ${varName},
|
|
8146
8285
|
}`);
|
|
8147
8286
|
return;
|
|
@@ -8196,6 +8335,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8196
8335
|
applyFarmBasePath,
|
|
8197
8336
|
applyFarmCspNonceToResponse,
|
|
8198
8337
|
createFarmCspNonce,
|
|
8338
|
+
createPreHydrationClickQueueScript,
|
|
8199
8339
|
stampFarmCspNonce,
|
|
8200
8340
|
isDeferred,
|
|
8201
8341
|
prepareDeferredData,
|
|
@@ -8255,6 +8395,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8255
8395
|
isFarmNotFoundError,
|
|
8256
8396
|
isFarmRedirectError,
|
|
8257
8397
|
localizeFarmHref,
|
|
8398
|
+
hasFarmHtmlPreloadToken,
|
|
8258
8399
|
manageFarmDocumentPreloads,
|
|
8259
8400
|
mergeRouteRenderingDirectiveConfig,
|
|
8260
8401
|
resolveRouteSharedCacheControl,
|
|
@@ -8352,12 +8493,15 @@ import { installFarmIslandsServer } from "@farm.js/core/internal/islands-server"
|
|
|
8352
8493
|
installFarmIslandsServer();
|
|
8353
8494
|
const farmFormActionsConfig = ${JSON.stringify(resolveServerActionsConfig(config.serverActions))};
|
|
8354
8495
|
installFarmIslandValues();
|
|
8355
|
-
${islandsActionKeyCode()}
|
|
8356
|
-
${FARM_SEGMENT_NAVIGATION_SERVER_RUNTIME}` : `
|
|
8496
|
+
${islandsActionKeyCode("@farm.js/core/internal/islx-server")}
|
|
8497
|
+
${FARM_SEGMENT_NAVIGATION_SERVER_RUNTIME}` : `${farmRendererActions ? `
|
|
8498
|
+
import { handleFarmFormActionRequest } from "@farm.js/core/internal/production-runtime";
|
|
8499
|
+
const farmFormActionsConfig = ${JSON.stringify(resolveServerActionsConfig(config.serverActions))};
|
|
8500
|
+
${islandsActionKeyCode("@farm.js/core/internal/islx-actions-server")}` : ""}
|
|
8357
8501
|
function farmFormState() { return undefined; }
|
|
8358
8502
|
function farmFormStateScript() { return ""; }`}`;
|
|
8359
8503
|
const productionSiteTelemetryImport = config.telemetry ? `import { createFarmProductionSiteReporter } from "@farm.js/core/internal/product-telemetry-runtime";` : "";
|
|
8360
|
-
const metadataImageRuntimeImport = hasGeneratedMetadataImages ? `import { createFarmMetadataImageResponse } from "@farm.js/core/internal/metadata-image-runtime";` : "";
|
|
8504
|
+
const metadataImageRuntimeImport = hasGeneratedMetadataImages ? `import { createFarmMetadataImageResponse, resolveFarmMetadataImageValue } from "@farm.js/core/internal/metadata-image-runtime";` : "";
|
|
8361
8505
|
const pluginRuntimeImport = hasPluginRuntime ? `import { PluginManager } from "@farm.js/core/plugin";` : "";
|
|
8362
8506
|
const infraAnalyticsImport = hasInfraAnalyticsRuntime ? `import { ${hasPluginRuntime ? "createFarmInfraAnalyticsPlugin" : "createFarmInfraAnalyticsRecorder"} } from "@farm.js/core/internal/infra-analytics-runtime";` : "";
|
|
8363
8507
|
const compressionRuntimeImport = hasCompressionRuntime ? `import { compressFarmResponse${hasPluginRuntime ? ", createCompressionPlugin" : ""} } from "@farm.js/core/internal/compression-runtime";` : "";
|
|
@@ -8380,7 +8524,7 @@ import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
|
8380
8524
|
const markdownHandlerImport = config.md?.enabled ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
|
|
8381
8525
|
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;";
|
|
8382
8526
|
const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, FARM_MARKDOWN_PAGE_CHECK_HEADER, _isFarmMarkdownPageCheck, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
|
|
8383
|
-
const mdxComponentsPath = typeof config.mdx?.components === "string" ?
|
|
8527
|
+
const mdxComponentsPath = typeof config.mdx?.components === "string" ? path17.isAbsolute(config.mdx.components) ? config.mdx.components : path17.join(config.root, config.mdx.components) : null;
|
|
8384
8528
|
const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
|
|
8385
8529
|
const layerConfigPaths = (config.layers || []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile)).filter((configFile) => configFile !== configModulePath);
|
|
8386
8530
|
const layerConfigImports = layerConfigPaths.map(
|
|
@@ -8696,6 +8840,12 @@ function wrapWithFarmIntegrationProviders(element) {
|
|
|
8696
8840
|
}
|
|
8697
8841
|
return wrapped;
|
|
8698
8842
|
}
|
|
8843
|
+
// The browser hydrates a page island or a route slot as its own root, inside the integration
|
|
8844
|
+
// providers, so the server renders them inside it too. React lines an island up with its tree
|
|
8845
|
+
// position instead, and its providers render no markup.
|
|
8846
|
+
function wrapFarmIslandIntegrationProviders(element) {
|
|
8847
|
+
return ${isReactRenderer(config.renderer) ? "element" : "wrapWithFarmIntegrationProviders(element)"};
|
|
8848
|
+
}
|
|
8699
8849
|
const serverRuntimeIntegrations = Object.fromEntries(
|
|
8700
8850
|
Object.entries(configuredIntegrations).filter(([, integration]) =>
|
|
8701
8851
|
integration && typeof integration === "object" && integration.serverRuntime !== false
|
|
@@ -8705,7 +8855,14 @@ const integrationRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs, {
|
|
|
8705
8855
|
integrations: configuredIntegrations,
|
|
8706
8856
|
${JSON.stringify(FARM_INTEGRATION_API_BASE_PATH_KEY)}: ${JSON.stringify(resolveFarmAPIServerBasePath(config.api))},
|
|
8707
8857
|
});
|
|
8708
|
-
const farmInfraAnalytics = ${hasInfraAnalyticsRuntime ? hasPluginRuntime ? "createFarmInfraAnalyticsPlugin
|
|
8858
|
+
const farmInfraAnalytics = ${hasInfraAnalyticsRuntime ? `${hasPluginRuntime ? "createFarmInfraAnalyticsPlugin" : "createFarmInfraAnalyticsRecorder"}(${reportsWebMCPCalls ? "{ webmcp: { route: farmWebMCPCallRoute } }" : ""})` : "null"};${reportsWebMCPCalls ? `
|
|
8859
|
+
// A WebMCP tool call a page reports goes under that page's route, matched and labeled as a
|
|
8860
|
+
// request for the page is.
|
|
8861
|
+
function farmWebMCPCallRoute(pathname) {
|
|
8862
|
+
return labelFarmRequestOptions(
|
|
8863
|
+
getFarmPluginRequestOptions(new Request(new URL(pathname, "http://farm.invalid"))),
|
|
8864
|
+
).route;
|
|
8865
|
+
}` : ""}
|
|
8709
8866
|
const configuredPlugins = [
|
|
8710
8867
|
${hasCompressionRuntime && hasPluginRuntime ? "createCompressionPlugin()," : ""}
|
|
8711
8868
|
${hasRuntimeIntegrationConfig ? "...resolveIntegrationPlugins(serverRuntimeIntegrations)," : ""}
|
|
@@ -8925,7 +9082,7 @@ const farmDocsAPIHandler = ${config.docs?.enabled ? hasPrecompiledDocs ? "farmDo
|
|
|
8925
9082
|
|
|
8926
9083
|
// API routes bundled at build time
|
|
8927
9084
|
const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
|
|
8928
|
-
]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path:
|
|
9085
|
+
]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path: path19, methods }) => ({ path: path19, methods })))}, { bodySizeLimit: ${JSON.stringify(config.server.bodySizeLimit)}, dispatch: dispatchFarmPluginAPIRequest })` : ""};
|
|
8929
9086
|
// A plugin calling an app endpoint (an MCP tool, say) goes through the whole
|
|
8930
9087
|
// pipeline, so the endpoint's middleware and integration guards run for it.
|
|
8931
9088
|
function dispatchFarmPluginAPIRequest(request) {
|
|
@@ -9068,7 +9225,10 @@ function serializeFarmInlineValue(value) {
|
|
|
9068
9225
|
.replace(/\\u2029/g, "\\\\u2029");
|
|
9069
9226
|
}
|
|
9070
9227
|
|
|
9071
|
-
|
|
9228
|
+
// \`statusDocument\`: the not-found or error page, which renders without the route's layout
|
|
9229
|
+
// boundaries and page segment. It names no route for its URL, so the client hydrates none over it
|
|
9230
|
+
// (development writes no hydration flags for it either); its links still navigate.
|
|
9231
|
+
function renderFarmClientBootstrapScript(canonicalPath, selectedRouteSlots, pageProps, routePathname, statusDocument) {
|
|
9072
9232
|
const integrationManifest = ${hasRuntimeIntegrationConfig ? "getRegisteredIntegrationAPIManifest()" : "{}"};
|
|
9073
9233
|
const serializedRouteSlots = serializeFarmInlineValue(selectedRouteSlots || []);
|
|
9074
9234
|
const serializedPageProps = serializeFarmInlineValue(pageProps || {});
|
|
@@ -9079,11 +9239,13 @@ function renderFarmClientBootstrapScript(canonicalPath, selectedRouteSlots, page
|
|
|
9079
9239
|
';window.__FARM_DEPLOYMENT_ID__=' + serializeFarmInlineValue(farmDeploymentId) + ';'${searchPreserveRoutesSource ? ` +
|
|
9080
9240
|
'window[Symbol.for("farm.searchPreserveRoutes")]=' + serializeFarmInlineValue(farmSearchPreserveRoutes) + ';'` : ""};
|
|
9081
9241
|
// The client boots at the canonical path when the script below moves it there.
|
|
9082
|
-
const bootRoutes =
|
|
9083
|
-
typeof
|
|
9084
|
-
|
|
9085
|
-
|
|
9086
|
-
|
|
9242
|
+
const bootRoutes = statusDocument
|
|
9243
|
+
? typeof routePathname === "string" ? { path: routePathname, routes: [] } : undefined
|
|
9244
|
+
: getFarmClientBootRoutes(
|
|
9245
|
+
typeof canonicalPath === "string" && canonicalPath.startsWith("/")
|
|
9246
|
+
? getFarmRoutePathname(canonicalPath.split(/[?#]/)[0])
|
|
9247
|
+
: routePathname
|
|
9248
|
+
);
|
|
9087
9249
|
if (bootRoutes) source += 'window.__FARM_CLIENT_ROUTES__=' + serializeFarmInlineValue(bootRoutes) + ';';
|
|
9088
9250
|
if (typeof canonicalPath === "string" && canonicalPath.startsWith("/")) {
|
|
9089
9251
|
const serializedPath = serializeFarmInlineValue(canonicalPath);
|
|
@@ -9871,7 +10033,7 @@ function addFarmFallbackIcon(markup, hasFavicon) {
|
|
|
9871
10033
|
return markup.replace(/<\\/head>/i, function() { return ' <link rel="icon" href="data:,">\\n</head>'; });
|
|
9872
10034
|
}
|
|
9873
10035
|
|
|
9874
|
-
function createFarmErrorDocument(html, title) {
|
|
10036
|
+
function createFarmErrorDocument(html, title, routePathname) {
|
|
9875
10037
|
const escapedTitle = escapeFarmHtmlAttribute(title || "Application Error");
|
|
9876
10038
|
const fullDocument = extractFarmFullDocument(html);
|
|
9877
10039
|
const hasFullDocument = fullDocument !== null;
|
|
@@ -9886,7 +10048,7 @@ function createFarmErrorDocument(html, title) {
|
|
|
9886
10048
|
renderFarmRendererHydrationScript() + '\\n' +
|
|
9887
10049
|
'</head>\\n<body>\\n' +
|
|
9888
10050
|
' <div id="root">' + html + '</div>\\n' +
|
|
9889
|
-
' ' + renderFarmClientBootstrapScript() + '\\n' +
|
|
10051
|
+
' ' + renderFarmClientBootstrapScript(undefined, undefined, undefined, routePathname, true) + '\\n' +
|
|
9890
10052
|
' ' + renderFarmClientEntryScript() + '\\n' +
|
|
9891
10053
|
'</body>\\n</html>';
|
|
9892
10054
|
}
|
|
@@ -9905,7 +10067,7 @@ function createFarmErrorDocument(html, title) {
|
|
|
9905
10067
|
.replace(
|
|
9906
10068
|
/<\\/body>/i,
|
|
9907
10069
|
function() {
|
|
9908
|
-
return ' ' + renderFarmClientBootstrapScript() + '\\n' +
|
|
10070
|
+
return ' ' + renderFarmClientBootstrapScript(undefined, undefined, undefined, routePathname, true) + '\\n' +
|
|
9909
10071
|
' ' + renderFarmClientEntryScript() + '\\n</body>';
|
|
9910
10072
|
},
|
|
9911
10073
|
);
|
|
@@ -10258,11 +10420,9 @@ async function handleMetadataImageRequest(request, routePathname) {
|
|
|
10258
10420
|
searchParams: createFarmSearchParams(searchParams),
|
|
10259
10421
|
path: match.pagePath,
|
|
10260
10422
|
};
|
|
10261
|
-
const value = typeof imageModule.default === "function"
|
|
10262
|
-
? await imageModule.default(props)
|
|
10263
|
-
: imageModule.default;
|
|
10264
10423
|
|
|
10265
|
-
${hasGeneratedMetadataImages ? `
|
|
10424
|
+
${hasGeneratedMetadataImages ? `const value = await resolveFarmMetadataImageValue(imageModule, props${isReactRenderer(config.renderer) ? "" : ", {\n renderer: ReactDOMServer,\n component: image.component === true,\n }"});
|
|
10425
|
+
return createFarmMetadataImageResponse(value, imageModule, {
|
|
10266
10426
|
method,
|
|
10267
10427
|
ifNoneMatch: request.headers.get("if-none-match"),${isReactRenderer(config.renderer) ? "" : "\n renderer: ReactDOMServer,"}
|
|
10268
10428
|
});` : 'throw new Error("Generated metadata image runtime is unavailable");'}
|
|
@@ -11731,7 +11891,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11731
11891
|
if (farmDeploymentMismatch) return createFarmDeploymentMismatchResponse(farmDeploymentMismatch);
|
|
11732
11892
|
farmCacheGuard.deploymentPage = true;
|
|
11733
11893
|
}
|
|
11734
|
-
${farmIslandsMode ? `//
|
|
11894
|
+
${farmIslandsMode || farmRendererActions ? `// A form or client component posting a server action to this page.
|
|
11735
11895
|
if (matchedRoute && request.method === "POST") {
|
|
11736
11896
|
const actionResponse = await _runWithMiddlewareData(middlewareData || {}, () =>
|
|
11737
11897
|
_runWithMiddlewareContext(middlewareContext || {}, () =>
|
|
@@ -12161,18 +12321,18 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12161
12321
|
// outer request handler exactly like sync render errors.
|
|
12162
12322
|
if (typeof PageComponent === "function" && PageComponent.constructor.name === "AsyncFunction") {
|
|
12163
12323
|
const result = await PageComponent(pageProps);
|
|
12164
|
-
|
|
12165
|
-
|
|
12166
|
-
|
|
12167
|
-
|
|
12168
|
-
|
|
12324
|
+
// Anything else (text, a number, null) renders as the renderer renders a child,
|
|
12325
|
+
// as in development.
|
|
12326
|
+
pageElement = React.isValidElement(result)
|
|
12327
|
+
? result
|
|
12328
|
+
: React.createElement(React.Fragment, null, result);
|
|
12169
12329
|
} else {
|
|
12170
12330
|
// Sync component - create element directly
|
|
12171
12331
|
pageElement = React.createElement(PageComponent, pageProps);
|
|
12172
12332
|
}
|
|
12173
12333
|
|
|
12174
12334
|
if (route.shouldHydrate && !shouldHydrateLayout) {
|
|
12175
|
-
pageElement = wrapFarmRouteClientGraph(pageElement);
|
|
12335
|
+
pageElement = wrapFarmRouteClientGraph(wrapFarmIslandIntegrationProviders(pageElement));
|
|
12176
12336
|
} else if (shouldHydrateLayout && !route.shouldHydrate) {
|
|
12177
12337
|
pageElement = route.serverTree
|
|
12178
12338
|
? await renderFarmRouteServerTree(
|
|
@@ -12233,7 +12393,9 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12233
12393
|
},
|
|
12234
12394
|
slot.hydrates
|
|
12235
12395
|
? wrapFarmRouteClientGraph(
|
|
12236
|
-
|
|
12396
|
+
wrapFarmIslandIntegrationProviders(
|
|
12397
|
+
React.createElement(slot.module.default, slot.props),
|
|
12398
|
+
),
|
|
12237
12399
|
)
|
|
12238
12400
|
: React.createElement(slot.module.default, slot.props),
|
|
12239
12401
|
);
|
|
@@ -12447,6 +12609,18 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12447
12609
|
// Set once the whole document is rendered: whether it starts with the boot entry, which
|
|
12448
12610
|
// preloads nothing.
|
|
12449
12611
|
let farmBootsClient = false;
|
|
12612
|
+
// A document something hydrates over holds the clicks and submits made before it hydrates,
|
|
12613
|
+
// for the client entry to replay, as development does. One that starts with the boot entry
|
|
12614
|
+
// holds its own.
|
|
12615
|
+
const farmHoldsInteractions =
|
|
12616
|
+
route.shouldHydrate ||
|
|
12617
|
+
shouldHydrateLayout ||
|
|
12618
|
+
renderedRouteSlots.some(function(slot) { return slot.hydrates; });
|
|
12619
|
+
const renderFarmPreHydrationHoldScript = function() {
|
|
12620
|
+
return farmHoldsInteractions && !farmBootsClient
|
|
12621
|
+
? stampFarmCspNonce(createPreHydrationClickQueueScript()) + '\\n'
|
|
12622
|
+
: '';
|
|
12623
|
+
};
|
|
12450
12624
|
// A client navigation swaps this document in without running its scripts. A route a
|
|
12451
12625
|
// shared cache stores renders the same for every request.
|
|
12452
12626
|
const farmNavigationRequest = ${farmIslandsMode ? `!farmSharedCacheableRoute &&
|
|
@@ -12461,7 +12635,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12461
12635
|
composed = composed
|
|
12462
12636
|
// Inject CSS link after opening head tag or first meta tag
|
|
12463
12637
|
.replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n <link rel="stylesheet" href="/__farm_client_css_href__">' + (farmBootsClient ? "" : renderFarmClientModulePreloads(composed, route.clientModule, farmNavigationRequest)); })
|
|
12464
|
-
.replace(/<\\/head>/i, () => renderFarmRendererHydrationScript() + '\\n</head>')
|
|
12638
|
+
.replace(/<\\/head>/i, () => renderFarmRendererHydrationScript() + '\\n' + renderFarmPreHydrationHoldScript() + '</head>')
|
|
12465
12639
|
// Explicit metadata wins over renderer and layout titles. Without
|
|
12466
12640
|
// explicit metadata, a renderer title wins over the layout title.
|
|
12467
12641
|
.replace(/<head([^>]*)>([\\s\\S]*?)<\\/head>/i, (match, attrs, headContent) => {
|
|
@@ -12536,6 +12710,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12536
12710
|
' <link rel="stylesheet" href="/__farm_client_css_href__">\\n' +
|
|
12537
12711
|
' <link rel="modulepreload" href="/__farm_client_js_src__">' + renderFarmClientModulePreloads(null, route.clientModule) + '\\n' +
|
|
12538
12712
|
renderFarmRendererHydrationScript() + '\\n' +
|
|
12713
|
+
renderFarmPreHydrationHoldScript() +
|
|
12539
12714
|
'</head>\\n<body>\\n' + farmEarlyClientScripts + ' <div id="root">';
|
|
12540
12715
|
const streamClientScripts = farmEarlyClientScripts ? '' : farmClientScripts();
|
|
12541
12716
|
const streamSuffix = function() {
|
|
@@ -12692,7 +12867,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12692
12867
|
\${suppressDefaultTitle ? "" : "<title>" + title + "</title>"}\${metaTags}\${rendererHead ? "\\n " + rendererHead : ""}
|
|
12693
12868
|
<link rel="stylesheet" href="/__farm_client_css_href__">\${farmBootsClient ? "" : renderFarmClientModulePreloads(html, route.clientModule, farmNavigationRequest)}
|
|
12694
12869
|
\${renderFarmRendererHydrationScript()}
|
|
12695
|
-
</head>
|
|
12870
|
+
\${renderFarmPreHydrationHoldScript()}</head>
|
|
12696
12871
|
<body>
|
|
12697
12872
|
<div id="root">\${html}</div>
|
|
12698
12873
|
\${renderFarmClientBootstrapScript(pageProps.__farmCanonicalPath, farmDeferredData.data.slots, farmDeferredData.data.page, routePathname)}\${renderFarmDeferredDataScript(farmDeferredData.records)}
|
|
@@ -12890,7 +13065,7 @@ ${servesDefaultMCP ? `
|
|
|
12890
13065
|
)` : "await renderErrorElement()"};
|
|
12891
13066
|
const errorDocument = applyFarmThemeDocument(
|
|
12892
13067
|
applyFarmI18nDocument(
|
|
12893
|
-
createFarmErrorDocument(errorHtml, "Application Error"),
|
|
13068
|
+
createFarmErrorDocument(errorHtml, "Application Error", routePathname),
|
|
12894
13069
|
pathname,
|
|
12895
13070
|
getFarmI18nSnapshot(),
|
|
12896
13071
|
request
|
|
@@ -12931,7 +13106,8 @@ ${servesDefaultMCP ? `
|
|
|
12931
13106
|
applyFarmI18nDocument(
|
|
12932
13107
|
createFarmErrorDocument(
|
|
12933
13108
|
fallbackHtml,
|
|
12934
|
-
errorStatus + " - " + errorStatusText
|
|
13109
|
+
errorStatus + " - " + errorStatusText,
|
|
13110
|
+
routePathname
|
|
12935
13111
|
),
|
|
12936
13112
|
pathname,
|
|
12937
13113
|
getFarmI18nSnapshot(),
|
|
@@ -13054,7 +13230,7 @@ ${farmRendererDisabled ? `
|
|
|
13054
13230
|
.replace(/<\\/head>/i, () => renderFarmRendererHydrationScript() + '\\n</head>')
|
|
13055
13231
|
.replace(
|
|
13056
13232
|
/<\\/body>/i,
|
|
13057
|
-
() => ' ' + renderFarmClientBootstrapScript(undefined, undefined, undefined, routePathname) + '\\n' +
|
|
13233
|
+
() => ' ' + renderFarmClientBootstrapScript(undefined, undefined, undefined, routePathname, true) + '\\n' +
|
|
13058
13234
|
' ' + renderFarmClientEntryScript() + '\\n</body>',
|
|
13059
13235
|
);
|
|
13060
13236
|
fullHtml = ensureFarmDocumentMeta(fullHtml, notFoundMetadata.viewport);
|
|
@@ -13074,7 +13250,7 @@ ${farmRendererDisabled ? `
|
|
|
13074
13250
|
</head>
|
|
13075
13251
|
<body>
|
|
13076
13252
|
<div id="root">\${html}</div>
|
|
13077
|
-
\${renderFarmClientBootstrapScript(undefined, undefined, undefined, routePathname)}
|
|
13253
|
+
\${renderFarmClientBootstrapScript(undefined, undefined, undefined, routePathname, true)}
|
|
13078
13254
|
\${renderFarmClientEntryScript()}
|
|
13079
13255
|
</body>
|
|
13080
13256
|
</html>\`;
|
|
@@ -13541,8 +13717,8 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
13541
13717
|
const isVercel = preset === "vercel";
|
|
13542
13718
|
const isCloudflareWorker = preset === "cloudflare-module";
|
|
13543
13719
|
const outputDir = resolveDeployOutputPath(root, config.deploy.outputDir);
|
|
13544
|
-
const runtimeServerOutputDir = isVercel ?
|
|
13545
|
-
const ssrOutputDir =
|
|
13720
|
+
const runtimeServerOutputDir = isVercel ? path17.join(outputDir, "functions", "__nitro.func") : path17.join(outputDir, "server");
|
|
13721
|
+
const ssrOutputDir = path17.join(root, distDir, "ssr");
|
|
13546
13722
|
const imageRuntime = resolveFarmImageServerRuntime(config.images, preset);
|
|
13547
13723
|
const hasGeneratedMetadataImages = Array.from(routeManager.getMetadataImages().values()).some(
|
|
13548
13724
|
(image) => image.sourceType === "module"
|
|
@@ -13675,9 +13851,9 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
13675
13851
|
resolveHashedClientCssHref(clientOutputDir),
|
|
13676
13852
|
resolveHashedClientJsSrc(clientOutputDir),
|
|
13677
13853
|
resolveClientBootSrc(clientOutputDir),
|
|
13678
|
-
readFarmDocsModulePreloads(
|
|
13679
|
-
readFarmClientModulePreloads(
|
|
13680
|
-
readFarmClientRouteTable(
|
|
13854
|
+
readFarmDocsModulePreloads(path17.join(root, distDir)),
|
|
13855
|
+
readFarmClientModulePreloads(path17.join(root, distDir)),
|
|
13856
|
+
readFarmClientRouteTable(path17.join(root, distDir))
|
|
13681
13857
|
]);
|
|
13682
13858
|
let nativeStylesheets;
|
|
13683
13859
|
const encodedDocsModulePreloads = encodeFarmDocsModulePreloads(docsModulePreloads);
|
|
@@ -13685,7 +13861,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
13685
13861
|
const encodedClientRouteTable = encodeFarmBuildJSONPlaceholder(clientRouteTable);
|
|
13686
13862
|
const encodedMobileShellClient = shouldBuildFarmMobileClient(config) ? encodeFarmMobileShellClient(
|
|
13687
13863
|
await finalizeFarmMobileClient({
|
|
13688
|
-
buildDir:
|
|
13864
|
+
buildDir: path17.join(root, distDir),
|
|
13689
13865
|
clientOutputDir,
|
|
13690
13866
|
webEntry: clientJsSrc,
|
|
13691
13867
|
webBoot: clientBootSrc,
|
|
@@ -13727,12 +13903,12 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
13727
13903
|
await fs5.mkdir(ssrOutputDir, { recursive: true });
|
|
13728
13904
|
await Promise.all(
|
|
13729
13905
|
Object.entries(ssrBundle).map(async ([fileName, output]) => {
|
|
13730
|
-
const filePath =
|
|
13731
|
-
await fs5.mkdir(
|
|
13906
|
+
const filePath = path17.join(ssrOutputDir, fileName);
|
|
13907
|
+
await fs5.mkdir(path17.dirname(filePath), { recursive: true });
|
|
13732
13908
|
await fs5.writeFile(filePath, output.type === "chunk" ? output.code : output.source);
|
|
13733
13909
|
})
|
|
13734
13910
|
);
|
|
13735
|
-
const nitroEntryPath =
|
|
13911
|
+
const nitroEntryPath = path17.join(ssrOutputDir, "nitro-entry.mjs");
|
|
13736
13912
|
const nodeAdapterModule = preset === "node-server" ? resolveNitroRuntimeDependency(root, "srvx/node") : null;
|
|
13737
13913
|
const hasNitroCacheRouteRules = hasFarmNitroCacheRouteRule(config.routeRules);
|
|
13738
13914
|
const nitroEntryCode = `
|
|
@@ -13950,20 +14126,20 @@ function toFarmNodeResponse(request, response) {
|
|
|
13950
14126
|
);
|
|
13951
14127
|
}
|
|
13952
14128
|
await fs5.writeFile(
|
|
13953
|
-
|
|
14129
|
+
path17.join(ssrOutputDir, FARM_DESKTOP_ENV_MODULE_FILE),
|
|
13954
14130
|
FARM_DESKTOP_ENV_MODULE_SOURCE
|
|
13955
14131
|
);
|
|
13956
14132
|
}
|
|
13957
|
-
const farmNodeServerEntryPath = preset === "node-server" ?
|
|
14133
|
+
const farmNodeServerEntryPath = preset === "node-server" ? path17.join(ssrOutputDir, "farm-node-server-entry.mjs") : null;
|
|
13958
14134
|
if (farmNodeServerEntryPath && nodeAdapterModule) {
|
|
13959
14135
|
await fs5.writeFile(
|
|
13960
|
-
|
|
14136
|
+
path17.join(ssrOutputDir, FARM_NODE_ENV_MODULE_FILE),
|
|
13961
14137
|
FARM_NODE_ENV_MODULE_SOURCE
|
|
13962
14138
|
);
|
|
13963
14139
|
await fs5.writeFile(
|
|
13964
14140
|
farmNodeServerEntryPath,
|
|
13965
14141
|
createFarmNodeServerEntry({
|
|
13966
|
-
nitroEntryFile:
|
|
14142
|
+
nitroEntryFile: path17.basename(nitroEntryPath),
|
|
13967
14143
|
nodeAdapterModule,
|
|
13968
14144
|
server: config.server,
|
|
13969
14145
|
websocketAdapterModule: resolveNitroRuntimeDependency(root, "crossws/adapters/node"),
|
|
@@ -13971,12 +14147,12 @@ function toFarmNodeResponse(request, response) {
|
|
|
13971
14147
|
})
|
|
13972
14148
|
);
|
|
13973
14149
|
}
|
|
13974
|
-
const farmBunServerEntryPath = preset === "bun" ?
|
|
14150
|
+
const farmBunServerEntryPath = preset === "bun" ? path17.join(ssrOutputDir, "farm-bun-server-entry.mjs") : null;
|
|
13975
14151
|
if (farmBunServerEntryPath) {
|
|
13976
14152
|
await fs5.writeFile(
|
|
13977
14153
|
farmBunServerEntryPath,
|
|
13978
14154
|
createFarmBunServerEntry({
|
|
13979
|
-
nitroEntryFile:
|
|
14155
|
+
nitroEntryFile: path17.basename(nitroEntryPath),
|
|
13980
14156
|
bunAdapterModule: resolveNitroRuntimeDependency(root, "srvx/bun"),
|
|
13981
14157
|
server: config.server,
|
|
13982
14158
|
websocketAdapterModule: resolveNitroRuntimeDependency(root, "crossws/adapters/bun"),
|
|
@@ -13984,7 +14160,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
13984
14160
|
})
|
|
13985
14161
|
);
|
|
13986
14162
|
}
|
|
13987
|
-
const farmNetlifyEntryPath = preset === "netlify" ?
|
|
14163
|
+
const farmNetlifyEntryPath = preset === "netlify" ? path17.join(ssrOutputDir, "farm-netlify-entry.mjs") : null;
|
|
13988
14164
|
if (farmNetlifyEntryPath) {
|
|
13989
14165
|
await fs5.writeFile(
|
|
13990
14166
|
farmNetlifyEntryPath,
|
|
@@ -13993,7 +14169,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
13993
14169
|
})
|
|
13994
14170
|
);
|
|
13995
14171
|
}
|
|
13996
|
-
const farmCloudflareEnvPath = preset === "cloudflare-pages" ?
|
|
14172
|
+
const farmCloudflareEnvPath = preset === "cloudflare-pages" ? path17.join(ssrOutputDir, "farm-cloudflare-env.mjs") : null;
|
|
13997
14173
|
if (farmCloudflareEnvPath) {
|
|
13998
14174
|
await fs5.writeFile(
|
|
13999
14175
|
farmCloudflareEnvPath,
|
|
@@ -14041,6 +14217,9 @@ function toFarmNodeResponse(request, response) {
|
|
|
14041
14217
|
];
|
|
14042
14218
|
})
|
|
14043
14219
|
);
|
|
14220
|
+
if (preset === "node-server" || preset === "bun") {
|
|
14221
|
+
await writeFarmClientBrotliAssets(clientOutputDir);
|
|
14222
|
+
}
|
|
14044
14223
|
const immutableAssets = isVercel ? { publicAssets: [], routeRules: {} } : planFarmImmutableAssets({
|
|
14045
14224
|
clientOutputDir,
|
|
14046
14225
|
files: await listFarmClientOutputFiles(clientOutputDir),
|
|
@@ -14067,18 +14246,19 @@ function toFarmNodeResponse(request, response) {
|
|
|
14067
14246
|
// `src` directory), as Nitro handlers outside Farm's aliases.
|
|
14068
14247
|
serverDir: false,
|
|
14069
14248
|
serverEntry: false,
|
|
14070
|
-
buildDir:
|
|
14249
|
+
buildDir: path17.join(root, distDir, ".nitro"),
|
|
14071
14250
|
alias: resolveNitroInternalRuntimeAliases(root),
|
|
14072
14251
|
compatibilityDate: "2024-12-01",
|
|
14073
14252
|
output: resolveFarmNitroOutputConfig(preset, outputDir),
|
|
14074
14253
|
// Nitro gives the root directory no Cache-Control on any preset (it falls through to the
|
|
14075
14254
|
// app), so public files keep revalidating; the hashed directories carry their own maxAge.
|
|
14076
14255
|
publicAssets: [{ dir: clientOutputDir, baseURL: "/" }, ...immutableAssets.publicAssets],
|
|
14077
|
-
// A self-hosted Node server sends static files itself, so precompress
|
|
14078
|
-
// with gzip and let Nitro serve that by Accept-Encoding. Brotli at Nitro's
|
|
14079
|
-
// fixed top quality cost a docs app ~20 s of build CPU
|
|
14080
|
-
//
|
|
14081
|
-
|
|
14256
|
+
// A self-hosted Node or Bun server sends static files itself, so precompress
|
|
14257
|
+
// them with gzip and let Nitro serve that by Accept-Encoding. Brotli at Nitro's
|
|
14258
|
+
// fixed top quality on every file cost a docs app ~20 s of build CPU, so only
|
|
14259
|
+
// client scripts and stylesheets get a brotli copy (writeFarmClientBrotliAssets).
|
|
14260
|
+
// Serverless and edge targets sit behind a CDN that compresses.
|
|
14261
|
+
...preset === "node-server" || preset === "bun" ? { compressPublicAssets: { gzip: true } } : {},
|
|
14082
14262
|
// Nitro gzips every server output file at level 9, node_modules included, to
|
|
14083
14263
|
// print sizes after the build. A self-hosted server is never shipped compressed,
|
|
14084
14264
|
// so list plain sizes; zipped serverless and edge bundles keep the gzip column.
|
|
@@ -14161,7 +14341,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14161
14341
|
if (pluginManager) {
|
|
14162
14342
|
nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
|
|
14163
14343
|
}
|
|
14164
|
-
const expectedServerDir =
|
|
14344
|
+
const expectedServerDir = path17.join(outputDir, "server");
|
|
14165
14345
|
const customRollupKeys = Object.keys(nitroConfig.rollupConfig || {}).filter(
|
|
14166
14346
|
(key) => key !== "external" && key !== "plugins"
|
|
14167
14347
|
);
|
|
@@ -14176,10 +14356,10 @@ function toFarmNodeResponse(request, response) {
|
|
|
14176
14356
|
const requestedBuilder = nitroConfig.builder ?? process.env.NITRO_BUILDER;
|
|
14177
14357
|
const nitroBuildIsFarms = (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && nitroConfig.rollupConfig?.external === nitroRollupExternal && !hasRollupPlugins(nitroConfig.rollupConfig?.plugins) && customRollupKeys.length === 0 && Boolean(
|
|
14178
14358
|
nitroConfig.handlers?.some(
|
|
14179
|
-
(handler) =>
|
|
14359
|
+
(handler) => path17.resolve(handler?.handler || "") === nitroEntryPath
|
|
14180
14360
|
)
|
|
14181
14361
|
);
|
|
14182
|
-
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && nitroBuildIsFarms &&
|
|
14362
|
+
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && nitroBuildIsFarms && path17.resolve(nitroConfig.output?.serverDir || "") === path17.resolve(expectedServerDir);
|
|
14183
14363
|
const prerenderReusesPrebuiltSSR = prerenderRoutes.length > 0 && ssrExternalsArePackaged && nitroBuildIsFarms;
|
|
14184
14364
|
const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
|
|
14185
14365
|
if (selectRolldownBuilder) nitroConfig.builder = "rolldown";
|
|
@@ -14308,8 +14488,8 @@ function toFarmNodeResponse(request, response) {
|
|
|
14308
14488
|
};
|
|
14309
14489
|
prerendererConfig.output = {
|
|
14310
14490
|
...prerendererConfig.output,
|
|
14311
|
-
serverDir:
|
|
14312
|
-
prerendererConfig.buildDir ??
|
|
14491
|
+
serverDir: path17.join(
|
|
14492
|
+
prerendererConfig.buildDir ?? path17.join(root, distDir, ".nitro"),
|
|
14313
14493
|
"prerender"
|
|
14314
14494
|
)
|
|
14315
14495
|
};
|
|
@@ -14328,7 +14508,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14328
14508
|
const prerenderServerDir = prerenderer.options.output.serverDir;
|
|
14329
14509
|
await copyPrebuiltSSRBundle(
|
|
14330
14510
|
ssrBundle,
|
|
14331
|
-
|
|
14511
|
+
path17.join(prerenderServerDir, FARM_SSR_OUTPUT_DIR),
|
|
14332
14512
|
null,
|
|
14333
14513
|
fs5
|
|
14334
14514
|
);
|
|
@@ -14404,7 +14584,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14404
14584
|
const copyResults = await Promise.allSettled([
|
|
14405
14585
|
prebuiltSSRFilesResult.value ? writeSSRBundleFiles(
|
|
14406
14586
|
prebuiltSSRFilesResult.value,
|
|
14407
|
-
|
|
14587
|
+
path17.join(outputDir, "server", FARM_SSR_OUTPUT_DIR),
|
|
14408
14588
|
fs5
|
|
14409
14589
|
) : Promise.resolve(),
|
|
14410
14590
|
runtimeCopyPromise
|
|
@@ -14414,14 +14594,14 @@ function toFarmNodeResponse(request, response) {
|
|
|
14414
14594
|
);
|
|
14415
14595
|
if (failedCopy) throw failedCopy.reason;
|
|
14416
14596
|
if (canReusePrebuiltSSR) {
|
|
14417
|
-
await registerPrebuiltSSRPackageImport(
|
|
14597
|
+
await registerPrebuiltSSRPackageImport(path17.join(outputDir, "server"), ssrEntryFile, fs5);
|
|
14418
14598
|
logger.info("\u26A1 Reused Farm's prebuilt SSR bundle for the Node output");
|
|
14419
14599
|
}
|
|
14420
14600
|
if (useRolldownBuilder) {
|
|
14421
14601
|
logger.info("\u26A1 Built the Node adapter with Rolldown");
|
|
14422
14602
|
}
|
|
14423
14603
|
if (preset === "node-server" && !desktopServerEntry) {
|
|
14424
|
-
await installFarmCompileCacheLauncher(
|
|
14604
|
+
await installFarmCompileCacheLauncher(path17.join(outputDir, "server"), fs5);
|
|
14425
14605
|
}
|
|
14426
14606
|
if (preset.startsWith("cloudflare")) {
|
|
14427
14607
|
await populateCloudflareProcessEnv(nitroInstance.options.output.serverDir, fs5);
|
|
@@ -14444,7 +14624,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14444
14624
|
routeRuntimeManifest,
|
|
14445
14625
|
farmCron.provider === "host" ? farmCron.jobs : [],
|
|
14446
14626
|
{
|
|
14447
|
-
buildDir:
|
|
14627
|
+
buildDir: path17.join(root, distDir),
|
|
14448
14628
|
middlewareRoutes: edgeMiddlewareRoutes,
|
|
14449
14629
|
guardedPages: edgeGuardedPrerenderRoutes
|
|
14450
14630
|
},
|
|
@@ -14458,16 +14638,16 @@ function resolveFarmNitroOutputConfig(preset, outputDir) {
|
|
|
14458
14638
|
return {
|
|
14459
14639
|
dir: outputDir,
|
|
14460
14640
|
...preset === "node-server" ? {
|
|
14461
|
-
serverDir:
|
|
14462
|
-
publicDir:
|
|
14641
|
+
serverDir: path17.join(outputDir, "server"),
|
|
14642
|
+
publicDir: path17.join(outputDir, "public")
|
|
14463
14643
|
} : isVercel ? {
|
|
14464
|
-
serverDir:
|
|
14465
|
-
publicDir:
|
|
14644
|
+
serverDir: path17.join(outputDir, "functions", "__nitro.func"),
|
|
14645
|
+
publicDir: path17.join(outputDir, "static")
|
|
14466
14646
|
} : {}
|
|
14467
14647
|
};
|
|
14468
14648
|
}
|
|
14469
14649
|
async function populateCloudflareProcessEnv(serverDir, fs5) {
|
|
14470
|
-
const wranglerPath =
|
|
14650
|
+
const wranglerPath = path17.join(serverDir, "wrangler.json");
|
|
14471
14651
|
let source;
|
|
14472
14652
|
try {
|
|
14473
14653
|
source = await fs5.readFile(wranglerPath, "utf8");
|
|
@@ -14495,8 +14675,8 @@ async function writeSSRBundleFiles(files, targetDir, fs5) {
|
|
|
14495
14675
|
await fs5.rm(targetDir, { recursive: true, force: true });
|
|
14496
14676
|
await Promise.all(
|
|
14497
14677
|
files.map(async ({ fileName, contents }) => {
|
|
14498
|
-
const targetPath =
|
|
14499
|
-
await fs5.mkdir(
|
|
14678
|
+
const targetPath = path17.join(targetDir, fileName);
|
|
14679
|
+
await fs5.mkdir(path17.dirname(targetPath), { recursive: true });
|
|
14500
14680
|
await fs5.writeFile(targetPath, contents);
|
|
14501
14681
|
})
|
|
14502
14682
|
);
|
|
@@ -14505,8 +14685,8 @@ async function copyPrebuiltSSRBundle(ssrBundle, targetDir, minifyOptions, fs5) {
|
|
|
14505
14685
|
await writeSSRBundleFiles(await prepareSSRBundleFiles(ssrBundle, minifyOptions), targetDir, fs5);
|
|
14506
14686
|
}
|
|
14507
14687
|
async function installFarmCompileCacheLauncher(serverDir, fs5) {
|
|
14508
|
-
const entryPath =
|
|
14509
|
-
const serverPath =
|
|
14688
|
+
const entryPath = path17.join(serverDir, "index.mjs");
|
|
14689
|
+
const serverPath = path17.join(serverDir, FARM_SERVER_MODULE_FILE);
|
|
14510
14690
|
const entry = await fs5.readFile(entryPath, "utf8").catch((error) => {
|
|
14511
14691
|
if (error.code === "ENOENT") return null;
|
|
14512
14692
|
throw error;
|
|
@@ -14515,11 +14695,11 @@ async function installFarmCompileCacheLauncher(serverDir, fs5) {
|
|
|
14515
14695
|
if (entry.includes(`./${FARM_SERVER_MODULE_FILE}`)) return false;
|
|
14516
14696
|
await fs5.rename(entryPath, serverPath);
|
|
14517
14697
|
await fs5.writeFile(entryPath, createFarmCompileCacheLauncher(FARM_SERVER_MODULE_FILE));
|
|
14518
|
-
await fs5.rm(
|
|
14698
|
+
await fs5.rm(path17.join(serverDir, FARM_COMPILE_CACHE_DIR), { recursive: true, force: true });
|
|
14519
14699
|
return true;
|
|
14520
14700
|
}
|
|
14521
14701
|
async function registerPrebuiltSSRPackageImport(serverDir, ssrEntryFile, fs5) {
|
|
14522
|
-
const packagePath =
|
|
14702
|
+
const packagePath = path17.join(serverDir, "package.json");
|
|
14523
14703
|
const packageJSON = await fs5.readFile(packagePath, "utf8").then((contents) => JSON.parse(contents)).catch((error) => {
|
|
14524
14704
|
if (error.code === "ENOENT") return { type: "module" };
|
|
14525
14705
|
throw error;
|
|
@@ -14549,18 +14729,18 @@ async function moveVercelOutputPath(src, dest, fs5) {
|
|
|
14549
14729
|
await fs5.rm(src, { recursive: true, force: true });
|
|
14550
14730
|
}
|
|
14551
14731
|
async function postProcessVercelOutput(root, outputDir, fs5, config, farmWorkflows, routeRuntimeManifest, cronJobs, edgeMiddleware, prerenderedPages) {
|
|
14552
|
-
const serverDir =
|
|
14553
|
-
const functionsDir =
|
|
14554
|
-
const nitroFuncDir =
|
|
14555
|
-
const staticDir =
|
|
14556
|
-
const publicDir =
|
|
14732
|
+
const serverDir = path17.join(outputDir, "server");
|
|
14733
|
+
const functionsDir = path17.join(outputDir, "functions");
|
|
14734
|
+
const nitroFuncDir = path17.join(functionsDir, "__nitro.func");
|
|
14735
|
+
const staticDir = path17.join(outputDir, "static");
|
|
14736
|
+
const publicDir = path17.join(outputDir, "public");
|
|
14557
14737
|
await fs5.mkdir(nitroFuncDir, { recursive: true });
|
|
14558
14738
|
const serverContents = await fs5.readdir(serverDir).catch((error) => {
|
|
14559
14739
|
if (error.code === "ENOENT") return [];
|
|
14560
14740
|
throw error;
|
|
14561
14741
|
});
|
|
14562
14742
|
for (const file of serverContents) {
|
|
14563
|
-
await moveVercelOutputPath(
|
|
14743
|
+
await moveVercelOutputPath(path17.join(serverDir, file), path17.join(nitroFuncDir, file), fs5);
|
|
14564
14744
|
}
|
|
14565
14745
|
if (serverContents.length > 0) await fs5.rm(serverDir, { recursive: true, force: true });
|
|
14566
14746
|
try {
|
|
@@ -14570,7 +14750,7 @@ async function postProcessVercelOutput(root, outputDir, fs5, config, farmWorkflo
|
|
|
14570
14750
|
}
|
|
14571
14751
|
await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs5);
|
|
14572
14752
|
await copyPrismaClientForVercel(root, nitroFuncDir, fs5);
|
|
14573
|
-
const configPath =
|
|
14753
|
+
const configPath = path17.join(outputDir, "config.json");
|
|
14574
14754
|
const configContent = await fs5.readFile(configPath, "utf-8");
|
|
14575
14755
|
const vercelConfig = JSON.parse(configContent);
|
|
14576
14756
|
const runtimeRoutes = await createFarmVercelRouteRuntimeFunctions(
|
|
@@ -14614,7 +14794,7 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs5) {
|
|
|
14614
14794
|
mainRoot,
|
|
14615
14795
|
root,
|
|
14616
14796
|
config.srcDir,
|
|
14617
|
-
|
|
14797
|
+
path17.join(nitroFuncDir, "farm-docs-content"),
|
|
14618
14798
|
fs5
|
|
14619
14799
|
);
|
|
14620
14800
|
for (const [index, docsRoot] of extraRoots.entries()) {
|
|
@@ -14622,7 +14802,7 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs5) {
|
|
|
14622
14802
|
docsRoot,
|
|
14623
14803
|
root,
|
|
14624
14804
|
config.srcDir,
|
|
14625
|
-
|
|
14805
|
+
path17.join(nitroFuncDir, "farm-docs-roots", String(index)),
|
|
14626
14806
|
fs5
|
|
14627
14807
|
);
|
|
14628
14808
|
}
|
|
@@ -14640,18 +14820,18 @@ async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs
|
|
|
14640
14820
|
);
|
|
14641
14821
|
}
|
|
14642
14822
|
await fs5.rm(bundledContentDir, { recursive: true, force: true });
|
|
14643
|
-
await fs5.mkdir(
|
|
14823
|
+
await fs5.mkdir(path17.dirname(bundledContentDir), { recursive: true });
|
|
14644
14824
|
await fs5.cp(docsContentDir, bundledContentDir, {
|
|
14645
14825
|
recursive: true,
|
|
14646
14826
|
force: true,
|
|
14647
14827
|
dereference: true
|
|
14648
14828
|
});
|
|
14649
14829
|
await fs5.writeFile(
|
|
14650
|
-
|
|
14830
|
+
path17.join(bundledContentDir, FARM_DOCS_LAST_MODIFIED_MANIFEST),
|
|
14651
14831
|
`${JSON.stringify(lastModifiedManifest, null, 2)}
|
|
14652
14832
|
`
|
|
14653
14833
|
);
|
|
14654
|
-
logger.info(`\u{1F4DA} Bundled docs content for Vercel: ${
|
|
14834
|
+
logger.info(`\u{1F4DA} Bundled docs content for Vercel: ${path17.relative(root, docsContentDir)}`);
|
|
14655
14835
|
}
|
|
14656
14836
|
function resolveServerFunctionPlatform(preset) {
|
|
14657
14837
|
return preset === "vercel" || preset === "netlify" ? { os: "linux", cpu: "x64", libc: "glibc" } : null;
|
|
@@ -14668,7 +14848,7 @@ function platformFieldAllows(field, value) {
|
|
|
14668
14848
|
}
|
|
14669
14849
|
async function stageSharpRuntime(config, root, distDir, fs5, preset) {
|
|
14670
14850
|
const functionPlatform = resolveServerFunctionPlatform(preset);
|
|
14671
|
-
const projectRequire = createRequire2(
|
|
14851
|
+
const projectRequire = createRequire2(path17.join(root, "package.json"));
|
|
14672
14852
|
let sharpRequire = projectRequire;
|
|
14673
14853
|
if (!resolvePackageJson(projectRequire, "sharp")) {
|
|
14674
14854
|
try {
|
|
@@ -14678,10 +14858,10 @@ async function stageSharpRuntime(config, root, distDir, fs5, preset) {
|
|
|
14678
14858
|
}
|
|
14679
14859
|
const copiedPackages = /* @__PURE__ */ new Map();
|
|
14680
14860
|
const packageCopies = /* @__PURE__ */ new Map();
|
|
14681
|
-
const stageRoot =
|
|
14861
|
+
const stageRoot = path17.join(root, distDir, "tmp");
|
|
14682
14862
|
await fs5.mkdir(stageRoot, { recursive: true });
|
|
14683
|
-
const stageDir = await fs5.mkdtemp(
|
|
14684
|
-
const targetNodeModules =
|
|
14863
|
+
const stageDir = await fs5.mkdtemp(path17.join(stageRoot, "sharp-runtime-"));
|
|
14864
|
+
const targetNodeModules = path17.join(stageDir, "node_modules");
|
|
14685
14865
|
function copyPackage(packageName, parentRequire) {
|
|
14686
14866
|
const activeCopy = packageCopies.get(packageName);
|
|
14687
14867
|
if (activeCopy) return activeCopy;
|
|
@@ -14694,10 +14874,10 @@ async function stageSharpRuntime(config, root, distDir, fs5, preset) {
|
|
|
14694
14874
|
if (!packageJsonPath) return;
|
|
14695
14875
|
const packageJson = JSON.parse(await fs5.readFile(packageJsonPath, "utf8"));
|
|
14696
14876
|
if (functionPlatform && !packageSupportsPlatform(packageJson, functionPlatform)) return;
|
|
14697
|
-
const packageDir =
|
|
14698
|
-
const targetDir =
|
|
14877
|
+
const packageDir = path17.dirname(packageJsonPath);
|
|
14878
|
+
const targetDir = path17.join(targetNodeModules, ...packageName.split("/"));
|
|
14699
14879
|
copiedPackages.set(packageName, String(packageJson.version || "*"));
|
|
14700
|
-
await fs5.mkdir(
|
|
14880
|
+
await fs5.mkdir(path17.dirname(targetDir), { recursive: true });
|
|
14701
14881
|
const packageRequire = createRequire2(packageJsonPath);
|
|
14702
14882
|
const dependencies = {
|
|
14703
14883
|
...packageJson.dependencies,
|
|
@@ -14732,8 +14912,8 @@ async function stageSharpRuntime(config, root, distDir, fs5, preset) {
|
|
|
14732
14912
|
};
|
|
14733
14913
|
}
|
|
14734
14914
|
async function installStagedSharpRuntime(staged, nitroFuncDir, fs5) {
|
|
14735
|
-
const stagedNodeModules =
|
|
14736
|
-
const targetNodeModules =
|
|
14915
|
+
const stagedNodeModules = path17.join(staged.stageDir, "node_modules");
|
|
14916
|
+
const targetNodeModules = path17.join(nitroFuncDir, "node_modules");
|
|
14737
14917
|
try {
|
|
14738
14918
|
await mergeStagedDirectory(stagedNodeModules, targetNodeModules, fs5);
|
|
14739
14919
|
const functionPackage = await readNitroOutputPackage(nitroFuncDir, fs5);
|
|
@@ -14761,8 +14941,8 @@ async function mergeStagedDirectory(sourceDir, targetDir, fs5) {
|
|
|
14761
14941
|
const entries = await fs5.readdir(sourceDir, { withFileTypes: true });
|
|
14762
14942
|
await settleAllOrThrow(
|
|
14763
14943
|
entries.map(async (entry) => {
|
|
14764
|
-
const sourcePath =
|
|
14765
|
-
const targetPath =
|
|
14944
|
+
const sourcePath = path17.join(sourceDir, entry.name);
|
|
14945
|
+
const targetPath = path17.join(targetDir, entry.name);
|
|
14766
14946
|
try {
|
|
14767
14947
|
await fs5.rename(sourcePath, targetPath);
|
|
14768
14948
|
return;
|
|
@@ -14789,13 +14969,13 @@ async function mergeStagedDirectory(sourceDir, targetDir, fs5) {
|
|
|
14789
14969
|
function assertMetadataImageRuntimeInstalled(root, metadataImageRoutes) {
|
|
14790
14970
|
const generated = metadataImageRoutes.find((image) => image.sourceType === "module");
|
|
14791
14971
|
if (!generated || resolveMetadataImageRuntimePackageJson(root)) return;
|
|
14792
|
-
const file = generated.modulePath ? toPosixPath(
|
|
14972
|
+
const file = generated.modulePath ? toPosixPath(path17.relative(root, generated.modulePath)) : "";
|
|
14793
14973
|
throw new Error(
|
|
14794
14974
|
`${file || "A generated metadata image"} renders with @vercel/og, which is not installed. ${VERCEL_OG_INSTALL_HINT}`
|
|
14795
14975
|
);
|
|
14796
14976
|
}
|
|
14797
14977
|
function resolveMetadataImageRuntimePackageJson(root) {
|
|
14798
|
-
const projectRequire = createRequire2(
|
|
14978
|
+
const projectRequire = createRequire2(path17.join(root, "package.json"));
|
|
14799
14979
|
const packageJsonPath = resolvePackageJson(projectRequire, "@vercel/og");
|
|
14800
14980
|
if (packageJsonPath) return packageJsonPath;
|
|
14801
14981
|
try {
|
|
@@ -14808,9 +14988,9 @@ async function copyMetadataImageRuntime(root, nitroFuncDir, fs5) {
|
|
|
14808
14988
|
const packageJsonPath = resolveMetadataImageRuntimePackageJson(root);
|
|
14809
14989
|
if (!packageJsonPath) return;
|
|
14810
14990
|
const packageJson = JSON.parse(await fs5.readFile(packageJsonPath, "utf8"));
|
|
14811
|
-
const packageDir =
|
|
14812
|
-
const targetDir =
|
|
14813
|
-
await fs5.mkdir(
|
|
14991
|
+
const packageDir = path17.dirname(packageJsonPath);
|
|
14992
|
+
const targetDir = path17.join(nitroFuncDir, "node_modules", "@vercel", "og");
|
|
14993
|
+
await fs5.mkdir(path17.dirname(targetDir), { recursive: true });
|
|
14814
14994
|
await fs5.cp(packageDir, targetDir, {
|
|
14815
14995
|
recursive: true,
|
|
14816
14996
|
force: true,
|
|
@@ -14826,7 +15006,7 @@ async function copyMetadataImageRuntime(root, nitroFuncDir, fs5) {
|
|
|
14826
15006
|
logger.info("\u{1F5BC}\uFE0F Bundled generated metadata image runtime");
|
|
14827
15007
|
}
|
|
14828
15008
|
async function readNitroOutputPackage(outputDir, fs5) {
|
|
14829
|
-
const packagePath =
|
|
15009
|
+
const packagePath = path17.join(outputDir, "package.json");
|
|
14830
15010
|
return fs5.readFile(packagePath, "utf8").then((contents) => JSON.parse(contents)).catch((error) => {
|
|
14831
15011
|
if (error.code === "ENOENT") return {};
|
|
14832
15012
|
throw error;
|
|
@@ -14835,7 +15015,7 @@ async function readNitroOutputPackage(outputDir, fs5) {
|
|
|
14835
15015
|
async function writeNitroOutputPackage(outputDir, packageJson, fs5) {
|
|
14836
15016
|
await fs5.mkdir(outputDir, { recursive: true });
|
|
14837
15017
|
await fs5.writeFile(
|
|
14838
|
-
|
|
15018
|
+
path17.join(outputDir, "package.json"),
|
|
14839
15019
|
`${JSON.stringify(packageJson, null, 2)}
|
|
14840
15020
|
`
|
|
14841
15021
|
);
|
|
@@ -14851,9 +15031,9 @@ function resolvePackageJson(parentRequire, packageName) {
|
|
|
14851
15031
|
}
|
|
14852
15032
|
}
|
|
14853
15033
|
try {
|
|
14854
|
-
let directory =
|
|
14855
|
-
while (directory !==
|
|
14856
|
-
const candidate =
|
|
15034
|
+
let directory = path17.dirname(metadataModule ?? parentRequire.resolve(packageName));
|
|
15035
|
+
while (directory !== path17.dirname(directory)) {
|
|
15036
|
+
const candidate = path17.join(directory, "package.json");
|
|
14857
15037
|
if (existsSync3(candidate)) {
|
|
14858
15038
|
try {
|
|
14859
15039
|
const manifest = JSON.parse(readFileSync2(candidate, "utf8"));
|
|
@@ -14861,23 +15041,23 @@ function resolvePackageJson(parentRequire, packageName) {
|
|
|
14861
15041
|
} catch {
|
|
14862
15042
|
}
|
|
14863
15043
|
}
|
|
14864
|
-
if (
|
|
14865
|
-
directory =
|
|
15044
|
+
if (path17.basename(directory) === "node_modules") break;
|
|
15045
|
+
directory = path17.dirname(directory);
|
|
14866
15046
|
}
|
|
14867
15047
|
} catch {
|
|
14868
15048
|
}
|
|
14869
15049
|
return null;
|
|
14870
15050
|
}
|
|
14871
15051
|
async function resolveProjectInstalledPackageDir(root, packageName, fs5) {
|
|
14872
|
-
let directory =
|
|
15052
|
+
let directory = path17.resolve(root);
|
|
14873
15053
|
while (true) {
|
|
14874
|
-
const candidate =
|
|
15054
|
+
const candidate = path17.join(directory, "node_modules", ...packageName.split("/"));
|
|
14875
15055
|
try {
|
|
14876
15056
|
const packageDir = await fs5.realpath(candidate);
|
|
14877
|
-
if ((await fs5.stat(
|
|
15057
|
+
if ((await fs5.stat(path17.join(packageDir, "package.json"))).isFile()) return packageDir;
|
|
14878
15058
|
} catch {
|
|
14879
15059
|
}
|
|
14880
|
-
const parent =
|
|
15060
|
+
const parent = path17.dirname(directory);
|
|
14881
15061
|
if (parent === directory) return null;
|
|
14882
15062
|
directory = parent;
|
|
14883
15063
|
}
|
|
@@ -14886,28 +15066,28 @@ var PRISMA_RUNTIME_GENERATE_ONLY_FILE = /^query_(?:engine|compiler)_bg\.|\.map$|
|
|
|
14886
15066
|
async function copyPrismaClientForVercel(root, nitroFuncDir, fs5) {
|
|
14887
15067
|
const prismaClientDir = await resolveProjectInstalledPackageDir(root, "@prisma/client", fs5);
|
|
14888
15068
|
if (!prismaClientDir) return;
|
|
14889
|
-
const generatedClientDir =
|
|
15069
|
+
const generatedClientDir = path17.join(prismaClientDir, "..", "..", ".prisma", "client");
|
|
14890
15070
|
try {
|
|
14891
15071
|
await fs5.access(generatedClientDir);
|
|
14892
15072
|
} catch {
|
|
14893
15073
|
return;
|
|
14894
15074
|
}
|
|
14895
|
-
const targetNodeModules =
|
|
14896
|
-
const targetPrismaScopeDir =
|
|
14897
|
-
const targetGeneratedDir =
|
|
14898
|
-
const targetClientDir =
|
|
14899
|
-
const runtimeDir =
|
|
15075
|
+
const targetNodeModules = path17.join(nitroFuncDir, "node_modules");
|
|
15076
|
+
const targetPrismaScopeDir = path17.join(targetNodeModules, "@prisma");
|
|
15077
|
+
const targetGeneratedDir = path17.join(targetNodeModules, ".prisma", "client");
|
|
15078
|
+
const targetClientDir = path17.join(targetPrismaScopeDir, "client");
|
|
15079
|
+
const runtimeDir = path17.join(prismaClientDir, "runtime");
|
|
14900
15080
|
await fs5.mkdir(targetPrismaScopeDir, { recursive: true });
|
|
14901
15081
|
await fs5.cp(prismaClientDir, targetClientDir, {
|
|
14902
15082
|
recursive: true,
|
|
14903
15083
|
force: true,
|
|
14904
|
-
filter: (source) =>
|
|
15084
|
+
filter: (source) => path17.dirname(source) !== runtimeDir || !PRISMA_RUNTIME_GENERATE_ONLY_FILE.test(path17.basename(source))
|
|
14905
15085
|
});
|
|
14906
15086
|
await fs5.cp(generatedClientDir, targetGeneratedDir, {
|
|
14907
15087
|
recursive: true,
|
|
14908
15088
|
force: true
|
|
14909
15089
|
});
|
|
14910
|
-
const clientPackagePath =
|
|
15090
|
+
const clientPackagePath = path17.join(prismaClientDir, "package.json");
|
|
14911
15091
|
const [functionPackage, clientPackageContent] = await Promise.all([
|
|
14912
15092
|
readNitroOutputPackage(nitroFuncDir, fs5),
|
|
14913
15093
|
fs5.readFile(clientPackagePath, "utf-8")
|
|
@@ -14919,9 +15099,9 @@ async function copyPrismaClientForVercel(root, nitroFuncDir, fs5) {
|
|
|
14919
15099
|
};
|
|
14920
15100
|
await writeNitroOutputPackage(nitroFuncDir, functionPackage, fs5);
|
|
14921
15101
|
}
|
|
14922
|
-
function islandsActionKeyCode() {
|
|
15102
|
+
function islandsActionKeyCode(runtimeModule) {
|
|
14923
15103
|
const key = randomBytes(32).toString("base64url");
|
|
14924
|
-
return `import { setBuildDefaults as __farmIslxBuildDefaults } from
|
|
15104
|
+
return `import { setBuildDefaults as __farmIslxBuildDefaults } from ${JSON.stringify(runtimeModule)};
|
|
14925
15105
|
__farmIslxBuildDefaults({ key: ${JSON.stringify(key)} });`;
|
|
14926
15106
|
}
|
|
14927
15107
|
|
|
@@ -15095,9 +15275,9 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
15095
15275
|
} else {
|
|
15096
15276
|
const { build: legacyViteBuild } = await import("vite");
|
|
15097
15277
|
logger.info("\u{1F4E6} Building client bundle...");
|
|
15098
|
-
await buildClient2(legacyViteBuild, config, root, srcDir,
|
|
15278
|
+
await buildClient2(legacyViteBuild, config, root, srcDir, path18.join(root, distDir, "client"));
|
|
15099
15279
|
logger.info("\u{1F4E6} Building SSR bundle...");
|
|
15100
|
-
await buildSSR(legacyViteBuild, config, root, srcDir,
|
|
15280
|
+
await buildSSR(legacyViteBuild, config, root, srcDir, path18.join(root, distDir, "server"));
|
|
15101
15281
|
logger.info(`\u{1F680} Building server with Nitro (preset: ${preset})...`);
|
|
15102
15282
|
await buildNitro(
|
|
15103
15283
|
config,
|
|
@@ -15150,7 +15330,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
15150
15330
|
}
|
|
15151
15331
|
}
|
|
15152
15332
|
async function createProjectModuleServer(createViteServer, config, root, buildLifetime) {
|
|
15153
|
-
const { farmServerOnlyEntriesPlugin } = await import("./vite.mjs");
|
|
15333
|
+
const { farmNavigationPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.mjs");
|
|
15154
15334
|
const rendererVitePlugins = await loadFarmRendererVitePlugins(config.renderer, root, {
|
|
15155
15335
|
ssr: true,
|
|
15156
15336
|
buildLifetime
|
|
@@ -15180,7 +15360,8 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
15180
15360
|
farmServerOnlyEntriesPlugin({
|
|
15181
15361
|
prebundleServerPackages: true,
|
|
15182
15362
|
distDir: config.distDir || ".farm"
|
|
15183
|
-
})
|
|
15363
|
+
}),
|
|
15364
|
+
farmNavigationPlugin(config.renderer)
|
|
15184
15365
|
],
|
|
15185
15366
|
server: {
|
|
15186
15367
|
middlewareMode: true,
|
|
@@ -15202,8 +15383,8 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
15202
15383
|
root,
|
|
15203
15384
|
// Vite keys its pre-bundled dependencies on the config, mode included, so this server and
|
|
15204
15385
|
// `farm dev` sharing one cache would each rebuild it after the other ran.
|
|
15205
|
-
cacheDir:
|
|
15206
|
-
|
|
15386
|
+
cacheDir: path18.join(
|
|
15387
|
+
path18.resolve(root, viteConfig.cacheDir ?? path18.join("node_modules", ".vite")),
|
|
15207
15388
|
"farm-build"
|
|
15208
15389
|
),
|
|
15209
15390
|
configFile: false,
|
|
@@ -15239,10 +15420,11 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
|
|
|
15239
15420
|
const {
|
|
15240
15421
|
farmI18nClientBridgePlugin,
|
|
15241
15422
|
farmIslandContainersPlugin,
|
|
15423
|
+
farmNavigationPlugin,
|
|
15242
15424
|
farmPlugin,
|
|
15243
15425
|
farmServerOnlyEntriesPlugin
|
|
15244
15426
|
} = await import("./vite.mjs");
|
|
15245
|
-
const { PluginManager: PluginManager2 } = await import("./plugin-
|
|
15427
|
+
const { PluginManager: PluginManager2 } = await import("./plugin-QOTAPTVV.mjs");
|
|
15246
15428
|
const pluginManager = new PluginManager2({
|
|
15247
15429
|
config,
|
|
15248
15430
|
isDev: false,
|
|
@@ -15261,6 +15443,7 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
|
|
|
15261
15443
|
plugins: [
|
|
15262
15444
|
farmI18nClientBridgePlugin(),
|
|
15263
15445
|
farmServerOnlyEntriesPlugin({ distDir: config.distDir || ".farm" }),
|
|
15446
|
+
farmNavigationPlugin(config.renderer),
|
|
15264
15447
|
farmIslandContainersPlugin(config),
|
|
15265
15448
|
farmPlugin(config, pluginManager),
|
|
15266
15449
|
farmEnvironmentFunctionsPlugin(config)
|
|
@@ -15270,7 +15453,7 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
|
|
|
15270
15453
|
}
|
|
15271
15454
|
async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
|
|
15272
15455
|
const { farmI18nClientBridgePlugin, farmIslandContainersPlugin, farmPlugin } = await import("./vite.mjs");
|
|
15273
|
-
const { PluginManager: PluginManager2 } = await import("./plugin-
|
|
15456
|
+
const { PluginManager: PluginManager2 } = await import("./plugin-QOTAPTVV.mjs");
|
|
15274
15457
|
const pluginManager = new PluginManager2({
|
|
15275
15458
|
config,
|
|
15276
15459
|
isDev: false,
|
|
@@ -15303,16 +15486,16 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
|
|
|
15303
15486
|
});
|
|
15304
15487
|
}
|
|
15305
15488
|
function resolveLegacyPageEntry(config, root, srcDir) {
|
|
15306
|
-
const appDir =
|
|
15489
|
+
const appDir = path18.join(root, srcDir, "app");
|
|
15307
15490
|
for (const extension of getFarmRendererComponentExtensions(config.renderer)) {
|
|
15308
|
-
const candidate =
|
|
15491
|
+
const candidate = path18.join(appDir, `page${extension}`);
|
|
15309
15492
|
if (existsSync4(candidate)) return candidate;
|
|
15310
15493
|
}
|
|
15311
|
-
return
|
|
15494
|
+
return path18.join(appDir, "page.tsx");
|
|
15312
15495
|
}
|
|
15313
15496
|
async function buildNitro(config, routeManager, apiRouteManager, serverRenderer, preset, root, distDir, pluginManager) {
|
|
15314
15497
|
const [{ createNitroConfig }, { createNitro, build: nitroBuild }] = await Promise.all([
|
|
15315
|
-
import("./nitro-
|
|
15498
|
+
import("./nitro-FK3SZM4H.mjs"),
|
|
15316
15499
|
import("nitro/builder")
|
|
15317
15500
|
]);
|
|
15318
15501
|
let nitroConfig = await createNitroConfig(
|
|
@@ -15326,18 +15509,18 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
15326
15509
|
nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
|
|
15327
15510
|
}
|
|
15328
15511
|
const outputDir = resolveDeployOutputPath(root, config.deploy.outputDir);
|
|
15329
|
-
const serverOutputDir =
|
|
15330
|
-
const publicOutputDir =
|
|
15512
|
+
const serverOutputDir = path18.join(outputDir, "server");
|
|
15513
|
+
const publicOutputDir = path18.join(outputDir, "public");
|
|
15331
15514
|
const { mkdir, cp } = await import("fs/promises");
|
|
15332
15515
|
await mkdir(serverOutputDir, { recursive: true });
|
|
15333
15516
|
await mkdir(publicOutputDir, { recursive: true });
|
|
15334
|
-
const clientDir =
|
|
15517
|
+
const clientDir = path18.join(root, distDir, "client");
|
|
15335
15518
|
try {
|
|
15336
15519
|
await mkdir(publicOutputDir, { recursive: true });
|
|
15337
15520
|
await cp(clientDir, publicOutputDir, { recursive: true });
|
|
15338
15521
|
logger.info("\u{1F4E6} Copied client assets to public directory");
|
|
15339
|
-
const manifestPath =
|
|
15340
|
-
const assetsDir =
|
|
15522
|
+
const manifestPath = path18.join(publicOutputDir, "farm-client-manifest.json");
|
|
15523
|
+
const assetsDir = path18.join(publicOutputDir, "assets");
|
|
15341
15524
|
const manifestExists = await import("fs/promises").then(
|
|
15342
15525
|
(fs5) => fs5.access(manifestPath).then(() => true).catch(() => false)
|
|
15343
15526
|
);
|
|
@@ -15353,8 +15536,8 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
15353
15536
|
logger.error(`\u274C Failed to copy client assets: ${error}`);
|
|
15354
15537
|
throw error;
|
|
15355
15538
|
}
|
|
15356
|
-
const serverDir =
|
|
15357
|
-
const nitroServerDir =
|
|
15539
|
+
const serverDir = path18.join(root, distDir, "server");
|
|
15540
|
+
const nitroServerDir = path18.join(root, distDir, ".nitro", "server", "farm");
|
|
15358
15541
|
try {
|
|
15359
15542
|
await mkdir(nitroServerDir, { recursive: true });
|
|
15360
15543
|
await cp(serverDir, nitroServerDir, { recursive: true });
|
|
@@ -15363,7 +15546,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
15363
15546
|
logger.warn(`Could not copy SSR bundles: ${error}`);
|
|
15364
15547
|
}
|
|
15365
15548
|
const nitro = await createNitro(nitroConfig);
|
|
15366
|
-
const registryPath =
|
|
15549
|
+
const registryPath = path18.join(root, distDir, ".nitro", "server", "farm-registry.ts");
|
|
15367
15550
|
try {
|
|
15368
15551
|
const { farmRegistry } = await import(
|
|
15369
15552
|
/* @vite-ignore */
|
|
@@ -15380,9 +15563,9 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
15380
15563
|
}
|
|
15381
15564
|
farmRegistry.routePaths = routePaths;
|
|
15382
15565
|
try {
|
|
15383
|
-
const clientManifestPath =
|
|
15384
|
-
const { readFile } = await import("fs/promises");
|
|
15385
|
-
const manifestContent = await
|
|
15566
|
+
const clientManifestPath = path18.join(root, distDir, "client", "farm-client-manifest.json");
|
|
15567
|
+
const { readFile: readFile2 } = await import("fs/promises");
|
|
15568
|
+
const manifestContent = await readFile2(clientManifestPath, "utf-8");
|
|
15386
15569
|
farmRegistry.clientManifest = JSON.parse(manifestContent);
|
|
15387
15570
|
} catch {
|
|
15388
15571
|
farmRegistry.clientManifest = {};
|