@farm.js/core 0.1.80 → 0.1.81
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-Cxi3214_.d.ts} +1 -1
- package/dist/{agent-mcp.d-DOP95Jxm.d.mts → agent-mcp.d-DMqOqnOA.d.mts} +1 -1
- package/dist/agent-runtime.d.mts +2 -1
- package/dist/agent-runtime.d.ts +2 -1
- package/dist/analyzer-435DCIQ6.cjs +17 -0
- package/dist/{analyzer-F7CWE5VA.mjs → analyzer-IC66UJCU.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 +1 -1
- package/dist/api/node.d.mts +4 -3
- package/dist/api/node.d.ts +4 -3
- package/dist/api/node.mjs +1 -1
- package/dist/api/route-manager.cjs +4 -4
- package/dist/api/route-manager.d.mts +4 -3
- package/dist/api/route-manager.d.ts +4 -3
- package/dist/api/route-manager.mjs +3 -3
- package/dist/api/runtime.cjs +1 -1
- package/dist/api/runtime.d.mts +3 -2
- package/dist/api/runtime.d.ts +3 -2
- package/dist/api/runtime.mjs +1 -1
- package/dist/api.cjs +5 -5
- package/dist/api.d.mts +5 -4
- package/dist/api.d.ts +5 -4
- package/dist/api.mjs +4 -4
- package/dist/{app-manifest.d-9UD6BznX.d.mts → app-manifest.d-Bbxp5kes.d.mts} +1 -1
- package/dist/{app-manifest.d-CO6Iu0Hx.d.ts → app-manifest.d-C8Cswd31.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-BJuSurgy.d.mts} +13 -4
- package/dist/{app.d-DwX1ePhs.d.ts → app.d-DGIoFt5D.d.ts} +13 -4
- package/dist/{chunk-Q4TRGTO7.cjs → chunk-26WP75W5.cjs} +32 -16
- package/dist/{chunk-GCRT6GJG.mjs → chunk-2HMSSPCZ.mjs} +26 -0
- package/dist/{chunk-7KDCVSTR.mjs → chunk-2PFGA6PB.mjs} +2 -2
- package/dist/chunk-2UYYXSUS.mjs +401 -0
- package/dist/{chunk-G4SZC2WH.cjs → chunk-2Y2HRZQY.cjs} +431 -332
- package/dist/{chunk-PL7MCYYD.mjs → chunk-3AV4DCXY.mjs} +58 -358
- package/dist/{chunk-3GNHJ3RN.cjs → chunk-3BTN3NP7.cjs} +2 -2
- package/dist/{chunk-ZVSQN7NC.cjs → chunk-46UV2E7I.cjs} +40 -43
- package/dist/{chunk-QMR2TUVZ.cjs → chunk-52Q4OB4A.cjs} +4 -4
- package/dist/chunk-5MMKNW7Q.cjs +54 -0
- package/dist/{chunk-XZBBKZGW.mjs → chunk-5N526T7Q.mjs} +64 -33
- package/dist/{chunk-XY5OZQF6.cjs → chunk-ADQ2LATR.cjs} +2 -2
- package/dist/{chunk-7DD5TNPS.cjs → chunk-AHVF5GI2.cjs} +2 -2
- package/dist/{chunk-MGKWYPE3.mjs → chunk-AYDVUCXD.mjs} +1 -0
- 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-44G4XHEL.mjs → chunk-BJWJP5A4.mjs} +9 -9
- package/dist/{chunk-GBESKA76.cjs → chunk-BSX5OGSD.cjs} +1 -1
- package/dist/{chunk-CNDBLUKI.mjs → chunk-BVJUFVCU.mjs} +1 -1
- package/dist/chunk-C5QHZ626.cjs +85 -0
- package/dist/{chunk-X4TSMQWF.cjs → chunk-CL7BUGVB.cjs} +465 -360
- package/dist/{chunk-RLCOWWE5.cjs → chunk-CN2JOTRO.cjs} +7 -7
- package/dist/{chunk-AXA2BSX3.cjs → chunk-CPZZBCPO.cjs} +22 -21
- package/dist/chunk-D2VAANBS.mjs +48 -0
- package/dist/{chunk-JGEN2FIT.mjs → chunk-D77OGI6X.mjs} +1 -1
- package/dist/{chunk-4H4ZXUNB.cjs → chunk-DJ3PVHTW.cjs} +3 -3
- package/dist/{chunk-ZPEZXQTM.cjs → chunk-E3HBD2K3.cjs} +2 -2
- package/dist/{chunk-Q4YEAWUK.mjs → chunk-ECVSRE4Y.mjs} +3 -2
- 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-5OAN7BG5.cjs → chunk-FYZD7DUS.cjs} +4 -4
- package/dist/{chunk-RQBGHHOQ.mjs → chunk-GY63XD6K.mjs} +1 -1
- package/dist/{chunk-HNUBRUFQ.cjs → chunk-HQEYZSF3.cjs} +4 -3
- package/dist/{chunk-MDEFTF63.mjs → chunk-HTNJ7A4D.mjs} +25 -28
- package/dist/chunk-I4WZRG73.mjs +54 -0
- package/dist/{chunk-MUZHULW2.mjs → chunk-ICOJ2BC6.mjs} +23 -7
- package/dist/{chunk-V73Y4UBL.mjs → chunk-IM3UINTZ.mjs} +1 -1
- package/dist/{chunk-MNIR7I7B.mjs → chunk-INKVDO42.mjs} +1 -1
- package/dist/{chunk-ZDYYZX73.mjs → chunk-IPG6B25T.mjs} +194 -89
- package/dist/{chunk-HEDGTXXB.cjs → chunk-JB4BHRFK.cjs} +17 -17
- package/dist/{chunk-XKUKWMGX.cjs → chunk-JCYDWJVO.cjs} +3 -3
- package/dist/{chunk-SVCUSOEF.mjs → chunk-KR5DF7WK.mjs} +1 -1
- package/dist/{chunk-COTFX4GT.mjs → chunk-LTOT5KVJ.mjs} +1 -1
- package/dist/{chunk-67MZTLTF.cjs → chunk-M6DAIE4T.cjs} +27 -1
- package/dist/{chunk-LVGB5PYK.cjs → chunk-MOGRRZMW.cjs} +17 -17
- package/dist/{chunk-MZ5QGWRW.mjs → chunk-N3VMHPIY.mjs} +2 -2
- package/dist/{chunk-GBW5DU7V.mjs → chunk-NOYKBGUK.mjs} +376 -277
- package/dist/{chunk-CCMP4JD2.cjs → chunk-NSLRK5DK.cjs} +1 -1
- package/dist/{chunk-WJ2O2MPP.cjs → chunk-OIWDEDUO.cjs} +394 -363
- package/dist/{chunk-K3XKEZR6.mjs → chunk-ONSZP5JK.mjs} +1 -1
- package/dist/{chunk-SDICLSQU.cjs → chunk-OUDNUFVR.cjs} +10 -10
- package/dist/{chunk-3XTRT3MB.mjs → chunk-PO5MZIWK.mjs} +1 -1
- package/dist/{chunk-EG5YBYHO.mjs → chunk-POL5RCVU.mjs} +1 -1
- package/dist/{chunk-ASYOWPSR.cjs → chunk-PWDBWXQI.cjs} +2 -1
- package/dist/{chunk-7YLDUB4R.cjs → chunk-QCKSYYXK.cjs} +7 -7
- package/dist/{chunk-57QAQU4F.mjs → chunk-QRNYSISP.mjs} +1 -1
- package/dist/{chunk-PRL7FXG4.cjs → chunk-RDNKQ5MK.cjs} +12 -13
- package/dist/{chunk-3JQBQG7K.mjs → chunk-RZ6XUEQS.mjs} +2 -2
- package/dist/{chunk-QHAISITM.mjs → chunk-S3IWDDQ3.mjs} +1 -1
- package/dist/{chunk-EGHPFXPZ.cjs → chunk-SAPG45RA.cjs} +23 -23
- package/dist/{chunk-YN3YMSKD.mjs → chunk-TLSGRK7E.mjs} +3 -3
- package/dist/chunk-UDMBUTJD.mjs +85 -0
- package/dist/{chunk-NJ4OASLP.mjs → chunk-UF4BNKKJ.mjs} +1 -1
- package/dist/{chunk-WHEQJN4G.cjs → chunk-UGD53SNO.cjs} +2 -2
- package/dist/{chunk-WBPVLCNE.mjs → chunk-VPGEYX5Y.mjs} +4 -4
- package/dist/chunk-VS7HLH4S.cjs +385 -0
- package/dist/{chunk-ANZLZNNX.cjs → chunk-W6C3LEXX.cjs} +3 -3
- 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-TS3ZHJN5.cjs → chunk-XOGCNKB7.cjs} +3 -3
- package/dist/{chunk-KEU55O2D.mjs → chunk-XOXCQGAF.mjs} +7 -6
- package/dist/{chunk-4MIDUSIX.mjs → chunk-YH7ENV3K.mjs} +14 -14
- 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-DVHFIETW.cjs → chunk-ZIYJWJV2.cjs} +13 -13
- package/dist/{chunk-Z4SMFUZ7.cjs → chunk-ZKNXCRUQ.cjs} +7 -7
- package/dist/{cli-runtime.d-DPNTN-JV.d.mts → cli-runtime.d-D8O1v2_X.d.mts} +5 -5
- package/dist/{cli-runtime.d-8BhZy_wr.d.ts → cli-runtime.d-hf4L1MNP.d.ts} +5 -5
- package/dist/{client-component.d-CkDcob6D.d.ts → client-component.d-CX8UCQh-.d.ts} +1 -1
- package/dist/{client-component.d-CMCdyAr8.d.mts → client-component.d-DFwUHlOz.d.mts} +1 -1
- package/dist/{client-plugins.d-WcMwOZGZ.d.mts → client-plugins.d-BflSNO-b.d.mts} +2 -13
- package/dist/{client-plugins.d-BYIovYqX.d.ts → client-plugins.d-qWp8hNwd.d.ts} +2 -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/desktop.d.mts +3 -2
- package/dist/desktop.d.ts +3 -2
- package/dist/{devtools-JJOYTIMS.cjs → devtools-EI5N366Z.cjs} +9 -9
- package/dist/{devtools-F3FDFV26.mjs → devtools-XJHODO5H.mjs} +7 -7
- package/dist/docs.cjs +9 -9
- package/dist/docs.d.mts +4 -3
- package/dist/docs.d.ts +4 -3
- package/dist/docs.mjs +8 -8
- package/dist/environment/vite.cjs +7 -6
- package/dist/environment/vite.mjs +6 -5
- package/dist/{handler.d-BwdOyc9x.d.ts → handler.d-C2oRihfa.d.ts} +1 -1
- package/dist/{handler.d-s3IM6pbJ.d.mts → handler.d-DoH5Krkq.d.mts} +1 -1
- package/dist/{headers.d-BR-OXrqQ.d.mts → headers.d-BrX53wFQ.d.mts} +1 -1
- package/dist/{headers.d-CAW4wPey.d.ts → headers.d-Dj0mfYpb.d.ts} +1 -1
- package/dist/index.cjs +58 -56
- package/dist/{index.d-ah2c89Wu.d.ts → index.d-Dhc2scRl.d.ts} +1 -1
- package/dist/{index.d-BEVK61zS.d.mts → index.d-DzDHOttz.d.mts} +1 -1
- package/dist/index.d.mts +25 -23
- package/dist/index.d.ts +25 -23
- package/dist/index.mjs +62 -60
- 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.d.mts +2 -1
- package/dist/integrations.d.ts +2 -1
- 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 +41 -40
- package/dist/internal/build-runtime.d.mts +5 -4
- package/dist/internal/build-runtime.d.ts +5 -4
- package/dist/internal/build-runtime.mjs +40 -39
- package/dist/internal/cli-runtime.cjs +19 -19
- package/dist/internal/cli-runtime.d.mts +8 -7
- package/dist/internal/cli-runtime.d.ts +8 -7
- package/dist/internal/cli-runtime.mjs +20 -20
- 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 +9 -9
- package/dist/internal/config-runtime.d.mts +4 -3
- package/dist/internal/config-runtime.d.ts +4 -3
- package/dist/internal/config-runtime.mjs +8 -8
- 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 +7 -7
- package/dist/internal/infra-analytics-runtime.mjs +5 -5
- 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 +9 -3
- package/dist/internal/islands-boot.mjs +9 -3
- 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 +24 -24
- package/dist/internal/production-runtime.d.mts +11 -10
- package/dist/internal/production-runtime.d.ts +11 -10
- package/dist/internal/production-runtime.mjs +29 -29
- 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-Ylo-CmzK.d.mts → mount.d-DOaeUoWq.d.mts} +1 -1
- package/dist/{mount.d-DcoPFqv5.d.ts → mount.d-DwXjaOHY.d.ts} +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-BA5h0fbE.d.mts → navigation-delegate.d-BElGUMgt.d.mts} +1 -1
- package/dist/{navigation-delegate.d-2MK4YSlL.d.ts → navigation-delegate.d-o3pPd9VI.d.ts} +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-6UOJXJZ6.cjs → nitro-XGIO6EQN.cjs} +2 -2
- package/dist/{nitro-C3MYDX7V.mjs → nitro-YLTGVGK4.mjs} +1 -1
- 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.cjs +32 -30
- package/dist/plugin.d.mts +6 -5
- package/dist/plugin.d.ts +6 -5
- package/dist/plugin.mjs +31 -29
- 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-BD06tqFA.d.ts} +1 -1
- package/dist/{render-plan.d-ChYBMhLu.d.mts → render-plan.d-xWCRAJeR.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 +34 -15
- package/dist/renderer-client.d.mts +13 -97
- package/dist/renderer-client.d.ts +13 -97
- package/dist/renderer-client.mjs +23 -4
- package/dist/renderer.cjs +4 -2
- package/dist/renderer.d.mts +33 -5
- package/dist/renderer.d.ts +33 -5
- package/dist/renderer.mjs +3 -1
- package/dist/{request.d-CE0FIkiM.d.ts → request.d-DUMuWxSN.d.ts} +1 -1
- package/dist/{request.d-RCnCBuWq.d.mts → request.d-Dx82V8bz.d.mts} +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-BwBVpLtD.d.ts} +1 -1
- package/dist/{route-rendering.d-BZJnfKsp.d.mts → route-rendering.d-DJh6GauM.d.mts} +1 -1
- package/dist/{router.d-D8Vvwl4i.d.mts → router.d-BtkKDxUB.d.mts} +1 -1
- package/dist/{router.d-BU_WE6Ol.d.ts → router.d-CJBSG5jr.d.ts} +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-JZWVSHOR.mjs → rsc-pipeline-GD6KLOIG.mjs} +13 -13
- package/dist/{rsc-pipeline-A3R4U26C.cjs → rsc-pipeline-H5AXQA7A.cjs} +14 -14
- package/dist/{runtime-SQFRHRGJ.mjs → runtime-OJ7FXFUI.mjs} +13 -13
- package/dist/{runtime-WZ3CHHGJ.cjs → runtime-YWQVBC3V.cjs} +15 -15
- package/dist/{runtime.d-DJ6IIKcF.d.ts → runtime.d-BQnD0cfC.d.ts} +1 -1
- package/dist/{runtime.d-BnmuOXVD.d.mts → runtime.d-C4SuZXf6.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-BzOg9M8g.d.mts → server-components-status.d-9rH7ZoEq.d.mts} +1 -1
- package/dist/{server-components-status.d-BeqSXcjM.d.ts → server-components-status.d-rfKOcE0N.d.ts} +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 +64 -59
- package/dist/server.d.mts +12 -11
- package/dist/server.d.ts +12 -11
- package/dist/server.mjs +45 -40
- package/dist/{spa-router.d-BOwuVkMl.d.ts → spa-router.d-DMKiBsHH.d.ts} +3 -3
- package/dist/{spa-router.d-CDpftSsk.d.mts → spa-router.d-V6XLSTCy.d.mts} +3 -3
- package/dist/{ssg.d-Bx_WFuwg.d.mts → ssg.d-BnCKPQL0.d.mts} +2 -2
- package/dist/{ssg.d-BTVqyq8T.d.ts → ssg.d-MNedvvMB.d.ts} +2 -2
- package/dist/store-core.d-Ad5biajo.d.ts +301 -0
- package/dist/store-core.d-BqJI1-ix.d.mts +301 -0
- package/dist/testing.cjs +3 -3
- package/dist/testing.d.mts +2 -1
- package/dist/testing.d.ts +2 -1
- package/dist/testing.mjs +3 -3
- package/dist/{utils.d-JkrpS-NJ.d.mts → utils.d-BEKLWa0Z.d.mts} +1 -1
- package/dist/{utils.d-_dvevm5s.d.ts → utils.d-BdjHKDuT.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +34 -30
- package/dist/vite.d.mts +18 -7
- package/dist/vite.d.ts +18 -7
- package/dist/vite.mjs +33 -29
- 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-KKVRWNDH.mjs → chunk-6WVRVGKC.mjs} +3 -3
- package/dist/{chunk-UJPE75GF.mjs → chunk-J2VUPCCR.mjs} +3 -3
- package/dist/{chunk-MQOHYV6L.cjs → chunk-LKIG5SM6.cjs} +2 -2
- package/dist/{chunk-UWOCYINY.cjs → chunk-OFVCWV2D.cjs} +2 -2
- package/dist/{chunk-3K2E55BJ.mjs → chunk-OO4GVGM3.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-S3IWDDQ3.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-POL5RCVU.mjs";
|
|
45
45
|
import {
|
|
46
46
|
FARM_DOCS_LAST_MODIFIED_MANIFEST,
|
|
47
47
|
createFarmDocsHandler,
|
|
@@ -65,7 +65,7 @@ import {
|
|
|
65
65
|
} from "./chunk-UBLKPREL.mjs";
|
|
66
66
|
import {
|
|
67
67
|
FARM_PRERENDER_ENV
|
|
68
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-IM3UINTZ.mjs";
|
|
69
69
|
import {
|
|
70
70
|
loadFarmDocsEngine
|
|
71
71
|
} from "./chunk-LRPPXKCX.mjs";
|
|
@@ -74,10 +74,10 @@ import {
|
|
|
74
74
|
getDeployTargetForPreset,
|
|
75
75
|
hasCustomFarmRouteContext,
|
|
76
76
|
resolveDeployOutputPath
|
|
77
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-YH7ENV3K.mjs";
|
|
78
78
|
import {
|
|
79
79
|
resolveFarmInstrumentationFile
|
|
80
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-QRNYSISP.mjs";
|
|
81
81
|
import {
|
|
82
82
|
resolveFarmInstrumentationRuntime
|
|
83
83
|
} from "./chunk-WNDAISB7.mjs";
|
|
@@ -107,6 +107,7 @@ import {
|
|
|
107
107
|
generateClientCachePersistenceCode,
|
|
108
108
|
generateFarmIntegrationProviderClientCode,
|
|
109
109
|
generateFarmIntegrationProviderServerModules,
|
|
110
|
+
isRendererCompiledComponent,
|
|
110
111
|
mergeFarmFontCss,
|
|
111
112
|
mergeFarmProductionViteConfig,
|
|
112
113
|
mergeFarmViteConfig,
|
|
@@ -114,10 +115,11 @@ import {
|
|
|
114
115
|
resolveFarmClientCacheAdapterEntry,
|
|
115
116
|
resolveFarmImageProviderForRuntime,
|
|
116
117
|
resolveFarmImageServerRuntime,
|
|
118
|
+
resolveFarmIslxActionsMode,
|
|
117
119
|
resolveFarmNotFoundComponentPath,
|
|
118
120
|
resolveFarmRouteRootStrategy,
|
|
119
121
|
toBakedMarkdownSourcePath
|
|
120
|
-
} from "./chunk-
|
|
122
|
+
} from "./chunk-IPG6B25T.mjs";
|
|
121
123
|
import {
|
|
122
124
|
TAILWIND_CSS_BROWSER_TARGET,
|
|
123
125
|
generateFarmClientPluginEntryCode,
|
|
@@ -133,7 +135,7 @@ import {
|
|
|
133
135
|
readRouteRenderingDirectiveFromFile,
|
|
134
136
|
resolveRouteRenderingConfig,
|
|
135
137
|
resolveRouteRenderingConfigFromFile
|
|
136
|
-
} from "./chunk-
|
|
138
|
+
} from "./chunk-TLSGRK7E.mjs";
|
|
137
139
|
import {
|
|
138
140
|
HOISTED_HEAD_ELEMENT,
|
|
139
141
|
appMiddlewareMayHandlePath,
|
|
@@ -146,7 +148,7 @@ import {
|
|
|
146
148
|
layoutsCanCoverSamePage,
|
|
147
149
|
routeBoundaryCoversDirectory,
|
|
148
150
|
stripRouteGroups
|
|
149
|
-
} from "./chunk-
|
|
151
|
+
} from "./chunk-OO4GVGM3.mjs";
|
|
150
152
|
import {
|
|
151
153
|
FARM_NATIVE_TREE_CONTENT_TYPE
|
|
152
154
|
} from "./chunk-LLZSYFOM.mjs";
|
|
@@ -160,7 +162,7 @@ import {
|
|
|
160
162
|
listFarmBuiltInRoutePaths,
|
|
161
163
|
resolveFarmApiCatalogInput,
|
|
162
164
|
resolveFarmAppManifestInput
|
|
163
|
-
} from "./chunk-
|
|
165
|
+
} from "./chunk-RZ6XUEQS.mjs";
|
|
164
166
|
import {
|
|
165
167
|
FARM_DEFAULT_MCP_PATH,
|
|
166
168
|
createFarmDefaultMCPServer,
|
|
@@ -168,7 +170,7 @@ import {
|
|
|
168
170
|
} from "./chunk-HR4N2K4V.mjs";
|
|
169
171
|
import {
|
|
170
172
|
isFarmPreviewDeploymentEnvironment
|
|
171
|
-
} from "./chunk-
|
|
173
|
+
} from "./chunk-GY63XD6K.mjs";
|
|
172
174
|
import {
|
|
173
175
|
FARM_NATIVE_SERVER_FN_PLUGIN
|
|
174
176
|
} from "./chunk-L4RTTTVE.mjs";
|
|
@@ -189,7 +191,7 @@ import {
|
|
|
189
191
|
withFarmSourceSnapshot,
|
|
190
192
|
withFarmSourceSnapshotOf,
|
|
191
193
|
withPackageClientBoundaryCache
|
|
192
|
-
} from "./chunk-
|
|
194
|
+
} from "./chunk-HTNJ7A4D.mjs";
|
|
193
195
|
import {
|
|
194
196
|
generateFarmDocsAdapterClientRuntime,
|
|
195
197
|
getFarmDocsAdapterConfigModule
|
|
@@ -209,6 +211,9 @@ import {
|
|
|
209
211
|
import {
|
|
210
212
|
resolveFarmServerComponentsMode
|
|
211
213
|
} from "./chunk-4QENVMG7.mjs";
|
|
214
|
+
import {
|
|
215
|
+
getFarmAppDirectories
|
|
216
|
+
} from "./chunk-Z3RM3VA2.mjs";
|
|
212
217
|
import {
|
|
213
218
|
REACT_RENDERER,
|
|
214
219
|
getFarmRendererCapabilities,
|
|
@@ -218,10 +223,7 @@ import {
|
|
|
218
223
|
isReactRenderer,
|
|
219
224
|
loadFarmRendererVitePlugins,
|
|
220
225
|
resolveFarmRendererAppSetup
|
|
221
|
-
} from "./chunk-
|
|
222
|
-
import {
|
|
223
|
-
getFarmAppDirectories
|
|
224
|
-
} from "./chunk-4STJ6LGR.mjs";
|
|
226
|
+
} from "./chunk-2HMSSPCZ.mjs";
|
|
225
227
|
import {
|
|
226
228
|
applyFarmCronVercelCrons,
|
|
227
229
|
createFarmCronCloudflareConfig,
|
|
@@ -240,7 +242,7 @@ import {
|
|
|
240
242
|
isFarmMarkdownPageFile,
|
|
241
243
|
parseMarkdownFrontmatter,
|
|
242
244
|
readFarmMarkdownRouteConfig
|
|
243
|
-
} from "./chunk-
|
|
245
|
+
} from "./chunk-ICOJ2BC6.mjs";
|
|
244
246
|
import {
|
|
245
247
|
resolveFarmMdxComponentsModulePath,
|
|
246
248
|
resolveMdxConfig
|
|
@@ -250,11 +252,11 @@ import {
|
|
|
250
252
|
} from "./chunk-YU2MNIIY.mjs";
|
|
251
253
|
import {
|
|
252
254
|
withPlainDiagnostics
|
|
253
|
-
} from "./chunk-
|
|
255
|
+
} from "./chunk-AYDVUCXD.mjs";
|
|
254
256
|
import {
|
|
255
257
|
applyFarmWorkflowVercelCrons,
|
|
256
258
|
prepareFarmWorkflowsForNitro
|
|
257
|
-
} from "./chunk-
|
|
259
|
+
} from "./chunk-LTOT5KVJ.mjs";
|
|
258
260
|
import {
|
|
259
261
|
getFarmIntegrationPluginServerRuntime,
|
|
260
262
|
getIntegrationProviders
|
|
@@ -272,7 +274,7 @@ import {
|
|
|
272
274
|
} from "./chunk-QD34VE4N.mjs";
|
|
273
275
|
import {
|
|
274
276
|
APIRouteManager
|
|
275
|
-
} from "./chunk-
|
|
277
|
+
} from "./chunk-6WVRVGKC.mjs";
|
|
276
278
|
import {
|
|
277
279
|
readFarmI18nCatalogs
|
|
278
280
|
} from "./chunk-VO55MMBX.mjs";
|
|
@@ -300,7 +302,7 @@ import {
|
|
|
300
302
|
} from "./chunk-2I6PUKWJ.mjs";
|
|
301
303
|
import {
|
|
302
304
|
FARM_VERSION
|
|
303
|
-
} from "./chunk-
|
|
305
|
+
} from "./chunk-D77OGI6X.mjs";
|
|
304
306
|
import {
|
|
305
307
|
FARM_VIDEO_PLAYER_PATH
|
|
306
308
|
} from "./chunk-AG27TI6Q.mjs";
|
|
@@ -327,7 +329,7 @@ import {
|
|
|
327
329
|
} from "./chunk-5KAEGBIL.mjs";
|
|
328
330
|
|
|
329
331
|
// src/build/index.ts
|
|
330
|
-
import
|
|
332
|
+
import path18 from "path";
|
|
331
333
|
import { existsSync as existsSync4 } from "fs";
|
|
332
334
|
|
|
333
335
|
// src/nitro/universal-build.ts
|
|
@@ -555,7 +557,7 @@ async function resolveHashedClientJsSrc(clientOutputDir) {
|
|
|
555
557
|
|
|
556
558
|
// src/nitro/universal-build.ts
|
|
557
559
|
import os from "os";
|
|
558
|
-
import
|
|
560
|
+
import path17 from "path";
|
|
559
561
|
import { constants as fsConstants, existsSync as existsSync3, readFileSync as readFileSync2, realpathSync as realpathSync3, statSync } from "fs";
|
|
560
562
|
import { initSync as initModuleLexer, parse as lexModule } from "es-module-lexer";
|
|
561
563
|
import { fileURLToPath } from "url";
|
|
@@ -1731,6 +1733,42 @@ function createFarmPrivateClientSourcemapsPlugin(options) {
|
|
|
1731
1733
|
};
|
|
1732
1734
|
}
|
|
1733
1735
|
|
|
1736
|
+
// src/nitro/client-brotli-assets.ts
|
|
1737
|
+
import { readdir, readFile, writeFile } from "fs/promises";
|
|
1738
|
+
import { availableParallelism } from "os";
|
|
1739
|
+
import path15 from "path";
|
|
1740
|
+
import { promisify } from "util";
|
|
1741
|
+
import { brotliCompress, constants } from "zlib";
|
|
1742
|
+
var compress = promisify(brotliCompress);
|
|
1743
|
+
var SCRIPT_OR_STYLESHEET = /\.(?:m?js|css)$/;
|
|
1744
|
+
var MIN_COMPRESSED_BYTES = 1024;
|
|
1745
|
+
async function writeFarmClientBrotliAssets(clientOutputDir) {
|
|
1746
|
+
const entries = await readdir(clientOutputDir, { recursive: true, withFileTypes: true });
|
|
1747
|
+
const files = new Set(
|
|
1748
|
+
entries.filter((entry) => entry.isFile()).map((entry) => path15.join(entry.parentPath, entry.name))
|
|
1749
|
+
);
|
|
1750
|
+
const pending = [...files].filter(
|
|
1751
|
+
(file) => SCRIPT_OR_STYLESHEET.test(file) && !files.has(`${file}.br`)
|
|
1752
|
+
);
|
|
1753
|
+
const next = async () => {
|
|
1754
|
+
const file = pending.pop();
|
|
1755
|
+
if (file === void 0) return;
|
|
1756
|
+
const source = await readFile(file);
|
|
1757
|
+
if (source.length >= MIN_COMPRESSED_BYTES) {
|
|
1758
|
+
const compressed = await compress(source, {
|
|
1759
|
+
params: {
|
|
1760
|
+
[constants.BROTLI_PARAM_MODE]: constants.BROTLI_MODE_TEXT,
|
|
1761
|
+
[constants.BROTLI_PARAM_QUALITY]: constants.BROTLI_MAX_QUALITY,
|
|
1762
|
+
[constants.BROTLI_PARAM_SIZE_HINT]: source.length
|
|
1763
|
+
}
|
|
1764
|
+
});
|
|
1765
|
+
await writeFile(`${file}.br`, compressed);
|
|
1766
|
+
}
|
|
1767
|
+
return next();
|
|
1768
|
+
};
|
|
1769
|
+
await Promise.all(Array.from({ length: availableParallelism() }, next));
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1734
1772
|
// src/middleware/static-config.ts
|
|
1735
1773
|
function literalMatcher(node) {
|
|
1736
1774
|
if (!node) return void 0;
|
|
@@ -1796,8 +1834,8 @@ function readStaticMiddlewareConfig(program) {
|
|
|
1796
1834
|
}
|
|
1797
1835
|
async function readMiddlewareFileConfig(filePath) {
|
|
1798
1836
|
try {
|
|
1799
|
-
const [{ readFile }, vite] = await Promise.all([import("fs/promises"), import("vite")]);
|
|
1800
|
-
const parsed = vite.parseSync(filePath, await
|
|
1837
|
+
const [{ readFile: readFile2 }, vite] = await Promise.all([import("fs/promises"), import("vite")]);
|
|
1838
|
+
const parsed = vite.parseSync(filePath, await readFile2(filePath, "utf8"));
|
|
1801
1839
|
if (parsed.errors?.length) return "unknown";
|
|
1802
1840
|
return readStaticMiddlewareConfig(parsed.program);
|
|
1803
1841
|
} catch {
|
|
@@ -1807,7 +1845,7 @@ async function readMiddlewareFileConfig(filePath) {
|
|
|
1807
1845
|
|
|
1808
1846
|
// src/nitro/vercel-edge-middleware.ts
|
|
1809
1847
|
import { createRequire, isBuiltin } from "module";
|
|
1810
|
-
import
|
|
1848
|
+
import path16 from "path";
|
|
1811
1849
|
import { gzipSync } from "zlib";
|
|
1812
1850
|
var FARM_VERCEL_EDGE_MIDDLEWARE_FUNCTION = "_farm_middleware";
|
|
1813
1851
|
var FARM_VERCEL_EDGE_NOT_FOUND_PATH = "/__farm/not-found";
|
|
@@ -1862,21 +1900,21 @@ ${modules.join("\n")}
|
|
|
1862
1900
|
`;
|
|
1863
1901
|
}
|
|
1864
1902
|
async function resolveFarmCoreDir(root, fs5) {
|
|
1865
|
-
const runtimeEntry = createRequire(
|
|
1903
|
+
const runtimeEntry = createRequire(path16.join(root, "package.json")).resolve(
|
|
1866
1904
|
"@farm.js/core/internal/vercel-edge-middleware"
|
|
1867
1905
|
);
|
|
1868
|
-
return fs5.realpath(
|
|
1906
|
+
return fs5.realpath(path16.resolve(path16.dirname(runtimeEntry), "..", ".."));
|
|
1869
1907
|
}
|
|
1870
1908
|
function edgeNodeModulesPlugin(coreDir, unsupported) {
|
|
1871
1909
|
const streamStub = "\0farm-edge-node-stream";
|
|
1872
|
-
const corePrefix = coreDir +
|
|
1910
|
+
const corePrefix = coreDir + path16.sep;
|
|
1873
1911
|
return {
|
|
1874
1912
|
name: "farm-vercel-edge-node-modules",
|
|
1875
1913
|
resolveId(source, importer) {
|
|
1876
1914
|
if (!isBuiltin(source)) return null;
|
|
1877
1915
|
const name = source.replace(/^node:/, "").split("/")[0];
|
|
1878
1916
|
if (EDGE_NODE_MODULES.has(name)) return { id: `node:${name}`, external: true };
|
|
1879
|
-
if (name === "stream" && importer &&
|
|
1917
|
+
if (name === "stream" && importer && path16.resolve(importer).startsWith(corePrefix)) {
|
|
1880
1918
|
return streamStub;
|
|
1881
1919
|
}
|
|
1882
1920
|
unsupported.add(`${source} (imported by ${importer ?? "the entry"})`);
|
|
@@ -1890,13 +1928,13 @@ function edgeNodeModulesPlugin(coreDir, unsupported) {
|
|
|
1890
1928
|
}
|
|
1891
1929
|
async function writeFarmVercelEdgeMiddlewareFunction(options) {
|
|
1892
1930
|
const { root, outputDir, buildDir, config, routes, guardedPages, fs: fs5 } = options;
|
|
1893
|
-
const functionDir =
|
|
1931
|
+
const functionDir = path16.join(
|
|
1894
1932
|
outputDir,
|
|
1895
1933
|
"functions",
|
|
1896
1934
|
`${FARM_VERCEL_EDGE_MIDDLEWARE_FUNCTION}.func`
|
|
1897
1935
|
);
|
|
1898
|
-
const entryPath =
|
|
1899
|
-
await fs5.mkdir(
|
|
1936
|
+
const entryPath = path16.join(buildDir, "vercel-edge-middleware-entry.mjs");
|
|
1937
|
+
await fs5.mkdir(path16.dirname(entryPath), { recursive: true });
|
|
1900
1938
|
await fs5.writeFile(
|
|
1901
1939
|
entryPath,
|
|
1902
1940
|
generateFarmVercelEdgeMiddlewareEntry(routes, config, guardedPages)
|
|
@@ -1945,9 +1983,9 @@ Remove them from the middleware (Edge provides ${[...EDGE_NODE_MODULES].join(",
|
|
|
1945
1983
|
}
|
|
1946
1984
|
await fs5.rm(functionDir, { recursive: true, force: true });
|
|
1947
1985
|
await fs5.mkdir(functionDir, { recursive: true });
|
|
1948
|
-
await fs5.writeFile(
|
|
1986
|
+
await fs5.writeFile(path16.join(functionDir, "index.js"), code);
|
|
1949
1987
|
await fs5.writeFile(
|
|
1950
|
-
|
|
1988
|
+
path16.join(functionDir, ".vc-config.json"),
|
|
1951
1989
|
`${JSON.stringify({ runtime: "edge", entrypoint: "index.js" }, null, 2)}
|
|
1952
1990
|
`
|
|
1953
1991
|
);
|
|
@@ -1969,7 +2007,7 @@ async function readFarmNativeStylesheets(clientOutputDir, clientCssHref) {
|
|
|
1969
2007
|
try {
|
|
1970
2008
|
return {
|
|
1971
2009
|
[clientCssHref]: await fs5.readFile(
|
|
1972
|
-
|
|
2010
|
+
path17.join(clientOutputDir, clientCssHref.slice(1)),
|
|
1973
2011
|
"utf8"
|
|
1974
2012
|
)
|
|
1975
2013
|
};
|
|
@@ -1984,18 +2022,18 @@ function preloadFarmNitroBuilder() {
|
|
|
1984
2022
|
);
|
|
1985
2023
|
}
|
|
1986
2024
|
var _filename = typeof import.meta.url !== "undefined" ? fileURLToPath(import.meta.url) : "";
|
|
1987
|
-
var _dirname =
|
|
2025
|
+
var _dirname = path17.dirname(_filename);
|
|
1988
2026
|
function findFarmCoreRoot(from) {
|
|
1989
|
-
let dir =
|
|
1990
|
-
while (dir !==
|
|
1991
|
-
const manifest =
|
|
2027
|
+
let dir = path17.dirname(from);
|
|
2028
|
+
while (dir !== path17.dirname(dir)) {
|
|
2029
|
+
const manifest = path17.join(dir, "package.json");
|
|
1992
2030
|
if (existsSync3(manifest)) {
|
|
1993
2031
|
try {
|
|
1994
2032
|
if (JSON.parse(readFileSync2(manifest, "utf8")).name === "@farm.js/core") return dir;
|
|
1995
2033
|
} catch {
|
|
1996
2034
|
}
|
|
1997
2035
|
}
|
|
1998
|
-
dir =
|
|
2036
|
+
dir = path17.dirname(dir);
|
|
1999
2037
|
}
|
|
2000
2038
|
return null;
|
|
2001
2039
|
}
|
|
@@ -2005,16 +2043,16 @@ function toModulePath(file) {
|
|
|
2005
2043
|
return process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
2006
2044
|
}
|
|
2007
2045
|
function findInstalledPackageDir(name, from) {
|
|
2008
|
-
for (let dir = from; ; dir =
|
|
2009
|
-
const candidate =
|
|
2010
|
-
if (existsSync3(
|
|
2046
|
+
for (let dir = from; ; dir = path17.dirname(dir)) {
|
|
2047
|
+
const candidate = path17.join(dir, "node_modules", name);
|
|
2048
|
+
if (existsSync3(path17.join(candidate, "package.json"))) {
|
|
2011
2049
|
try {
|
|
2012
2050
|
return realpathSync3(candidate);
|
|
2013
2051
|
} catch {
|
|
2014
2052
|
return null;
|
|
2015
2053
|
}
|
|
2016
2054
|
}
|
|
2017
|
-
if (dir ===
|
|
2055
|
+
if (dir === path17.dirname(dir)) return null;
|
|
2018
2056
|
}
|
|
2019
2057
|
}
|
|
2020
2058
|
function collectFarmDependencyDirs(root) {
|
|
@@ -2025,7 +2063,7 @@ function collectFarmDependencyDirs(root) {
|
|
|
2025
2063
|
seen.add(dir);
|
|
2026
2064
|
let manifest;
|
|
2027
2065
|
try {
|
|
2028
|
-
manifest = JSON.parse(readFileSync2(
|
|
2066
|
+
manifest = JSON.parse(readFileSync2(path17.join(dir, "package.json"), "utf8"));
|
|
2029
2067
|
} catch {
|
|
2030
2068
|
return;
|
|
2031
2069
|
}
|
|
@@ -2036,7 +2074,7 @@ function collectFarmDependencyDirs(root) {
|
|
|
2036
2074
|
if (farmCoreRoot) visit(realpathSync3(farmCoreRoot));
|
|
2037
2075
|
queue.push({ name: "@farm.js/core", from: root });
|
|
2038
2076
|
try {
|
|
2039
|
-
const manifest = JSON.parse(readFileSync2(
|
|
2077
|
+
const manifest = JSON.parse(readFileSync2(path17.join(root, "package.json"), "utf8"));
|
|
2040
2078
|
for (const field of ["dependencies", "devDependencies"]) {
|
|
2041
2079
|
for (const name of Object.keys(manifest[field] ?? {})) {
|
|
2042
2080
|
if (name.startsWith("@farm.js/")) queue.push({ name, from: root });
|
|
@@ -2103,17 +2141,17 @@ var FARM_SSR_PACKAGE_IMPORT = "#farm-ssr-entry";
|
|
|
2103
2141
|
var FARM_SSR_OUTPUT_DIR = "farm-ssr";
|
|
2104
2142
|
var FARM_CLIENT_BUILD_TARGET = ["es2020", "edge88", "firefox78", "chrome87", "safari14"];
|
|
2105
2143
|
function resolveNitroRuntimeDependency(root, specifier) {
|
|
2106
|
-
return createRequire2(resolveNitroPackageEntry(root)).resolve(specifier).split(
|
|
2144
|
+
return createRequire2(resolveNitroPackageEntry(root)).resolve(specifier).split(path17.sep).join("/");
|
|
2107
2145
|
}
|
|
2108
2146
|
function resolveNitroInternalRuntimeAliases(root) {
|
|
2109
2147
|
const nitroEntry = resolveNitroPackageEntry(root);
|
|
2110
|
-
const runtimeDir =
|
|
2148
|
+
const runtimeDir = path17.dirname(nitroEntry);
|
|
2111
2149
|
const nitroRequire = createRequire2(nitroEntry);
|
|
2112
2150
|
return {
|
|
2113
2151
|
...Object.fromEntries(
|
|
2114
2152
|
["app", "error/hooks", "runtime-config", "shutdown", "task"].map((moduleName) => [
|
|
2115
2153
|
`#nitro/runtime/${moduleName}`,
|
|
2116
|
-
|
|
2154
|
+
path17.join(runtimeDir, "internal", `${moduleName}.mjs`).split(path17.sep).join("/")
|
|
2117
2155
|
])
|
|
2118
2156
|
),
|
|
2119
2157
|
// Farm's generated workflow and cron wrappers live under `.farm/` and
|
|
@@ -2122,7 +2160,7 @@ function resolveNitroInternalRuntimeAliases(root) {
|
|
|
2122
2160
|
...Object.fromEntries(
|
|
2123
2161
|
["nitro/app", "nitro/h3", "nitro/task"].map((specifier) => [
|
|
2124
2162
|
specifier,
|
|
2125
|
-
nitroRequire.resolve(specifier).split(
|
|
2163
|
+
nitroRequire.resolve(specifier).split(path17.sep).join("/")
|
|
2126
2164
|
])
|
|
2127
2165
|
)
|
|
2128
2166
|
};
|
|
@@ -2146,7 +2184,7 @@ function createPrerenderRuntimeResolverPlugin(root, resolveNitroEntry = resolveN
|
|
|
2146
2184
|
name: "farm-prerender-runtime-resolver",
|
|
2147
2185
|
async resolveId(id, _importer, options) {
|
|
2148
2186
|
if (options.custom?.farmPrerenderRuntimeResolve) return null;
|
|
2149
|
-
if (id.startsWith("\0") || id.startsWith(".") || id.startsWith("#") || id.startsWith("virtual:") ||
|
|
2187
|
+
if (id.startsWith("\0") || id.startsWith(".") || id.startsWith("#") || id.startsWith("virtual:") || path17.isAbsolute(id) || NODE_BUILTIN_MODULES.has(id)) {
|
|
2150
2188
|
return null;
|
|
2151
2189
|
}
|
|
2152
2190
|
if (nitroEntry === void 0) {
|
|
@@ -2169,7 +2207,7 @@ function createFarmStorageModuleRegistration(config) {
|
|
|
2169
2207
|
const modules = _collectFarmStorageModules(config.storage);
|
|
2170
2208
|
if (modules.length === 0) return "";
|
|
2171
2209
|
const root = config.root || process.cwd();
|
|
2172
|
-
const projectRequire = createRequire2(
|
|
2210
|
+
const projectRequire = createRequire2(path17.join(root, "package.json"));
|
|
2173
2211
|
let runtimeRequire = projectRequire;
|
|
2174
2212
|
try {
|
|
2175
2213
|
runtimeRequire = createRequire2(projectRequire.resolve("@farm.js/core"));
|
|
@@ -2196,7 +2234,7 @@ ${loaders.join("\n")}
|
|
|
2196
2234
|
});` : "";
|
|
2197
2235
|
}
|
|
2198
2236
|
function resolveNitroPackageEntry(root) {
|
|
2199
|
-
const projectRequire = createRequire2(
|
|
2237
|
+
const projectRequire = createRequire2(path17.join(root, "package.json"));
|
|
2200
2238
|
let runtimeRequire = projectRequire;
|
|
2201
2239
|
try {
|
|
2202
2240
|
runtimeRequire = createRequire2(projectRequire.resolve("@farm.js/core"));
|
|
@@ -2266,7 +2304,7 @@ function createFarmReactWebServerAlias(hasEdgeBuild) {
|
|
|
2266
2304
|
}
|
|
2267
2305
|
function hasReactDomEdgeServerBuild(root) {
|
|
2268
2306
|
try {
|
|
2269
|
-
createRequire2(
|
|
2307
|
+
createRequire2(path17.join(root, "package.json")).resolve("react-dom/server.edge");
|
|
2270
2308
|
return true;
|
|
2271
2309
|
} catch {
|
|
2272
2310
|
return false;
|
|
@@ -2297,9 +2335,9 @@ function isNitroRollupExternal(id) {
|
|
|
2297
2335
|
var FARM_METADATA_IMAGE_WASM_PREFIX = "\0farm-metadata-image-wasm:";
|
|
2298
2336
|
var FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID = "\0farm-omitted-metadata-image-runtime";
|
|
2299
2337
|
function isFarmCoreModule(file) {
|
|
2300
|
-
let dir =
|
|
2301
|
-
while (dir !==
|
|
2302
|
-
const manifest =
|
|
2338
|
+
let dir = path17.dirname(file.split("?", 1)[0]);
|
|
2339
|
+
while (dir !== path17.dirname(dir)) {
|
|
2340
|
+
const manifest = path17.join(dir, "package.json");
|
|
2303
2341
|
if (existsSync3(manifest)) {
|
|
2304
2342
|
try {
|
|
2305
2343
|
return JSON.parse(readFileSync2(manifest, "utf8")).name === "@farm.js/core";
|
|
@@ -2307,7 +2345,7 @@ function isFarmCoreModule(file) {
|
|
|
2307
2345
|
return false;
|
|
2308
2346
|
}
|
|
2309
2347
|
}
|
|
2310
|
-
dir =
|
|
2348
|
+
dir = path17.dirname(dir);
|
|
2311
2349
|
}
|
|
2312
2350
|
return false;
|
|
2313
2351
|
}
|
|
@@ -2318,7 +2356,7 @@ function createOmittedMetadataImageRuntimePlugin(externalizeOtherImports) {
|
|
|
2318
2356
|
filter: { id: exactIdPattern(["@vercel/og"]) },
|
|
2319
2357
|
handler(source, importer) {
|
|
2320
2358
|
if (source !== "@vercel/og") return null;
|
|
2321
|
-
const fromCoreRuntime = importer !== void 0 && isFarmCoreModule(importer) && !/^og\.[cm]?[jt]sx?$/.test(
|
|
2359
|
+
const fromCoreRuntime = importer !== void 0 && isFarmCoreModule(importer) && !/^og\.[cm]?[jt]sx?$/.test(path17.basename(importer.split("?", 1)[0]));
|
|
2322
2360
|
if (fromCoreRuntime) return FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID;
|
|
2323
2361
|
return externalizeOtherImports ? { id: source, external: true } : null;
|
|
2324
2362
|
}
|
|
@@ -2339,14 +2377,14 @@ export class ImageResponse {
|
|
|
2339
2377
|
};
|
|
2340
2378
|
}
|
|
2341
2379
|
function readVercelOgManifest(file) {
|
|
2342
|
-
let dir =
|
|
2343
|
-
while (dir !==
|
|
2344
|
-
const manifestPath =
|
|
2380
|
+
let dir = path17.dirname(file.split("?", 1)[0]);
|
|
2381
|
+
while (dir !== path17.dirname(dir)) {
|
|
2382
|
+
const manifestPath = path17.join(dir, "package.json");
|
|
2345
2383
|
if (existsSync3(manifestPath)) {
|
|
2346
2384
|
const manifest = JSON.parse(readFileSync2(manifestPath, "utf8"));
|
|
2347
2385
|
return manifest.name === "@vercel/og" ? { dir, manifest } : null;
|
|
2348
2386
|
}
|
|
2349
|
-
dir =
|
|
2387
|
+
dir = path17.dirname(dir);
|
|
2350
2388
|
}
|
|
2351
2389
|
return null;
|
|
2352
2390
|
}
|
|
@@ -2354,7 +2392,7 @@ function resolveVercelOgConditionEntry(resolvedId, condition) {
|
|
|
2354
2392
|
const vercelOg = readVercelOgManifest(resolvedId);
|
|
2355
2393
|
const entry = vercelOg?.manifest.exports?.["."]?.[condition];
|
|
2356
2394
|
const file = typeof entry === "string" ? entry : entry?.default;
|
|
2357
|
-
return vercelOg && typeof file === "string" ?
|
|
2395
|
+
return vercelOg && typeof file === "string" ? path17.join(vercelOg.dir, file) : null;
|
|
2358
2396
|
}
|
|
2359
2397
|
function createEdgeMetadataImageRuntimePlugin({
|
|
2360
2398
|
condition,
|
|
@@ -2372,7 +2410,7 @@ function createEdgeMetadataImageRuntimePlugin({
|
|
|
2372
2410
|
if (wasm !== "module" || !source.endsWith(".wasm?module") || !importer?.replace(/\\/g, "/").includes("/@vercel/og/")) {
|
|
2373
2411
|
return null;
|
|
2374
2412
|
}
|
|
2375
|
-
const resolvedPath =
|
|
2413
|
+
const resolvedPath = path17.resolve(path17.dirname(importer.split("?", 1)[0]), source);
|
|
2376
2414
|
return { id: toPosixPath(resolvedPath), external: "absolute" };
|
|
2377
2415
|
}
|
|
2378
2416
|
};
|
|
@@ -2387,7 +2425,7 @@ function createVercelOgFontInlinePlugin(runtime = "Cloudflare Workers") {
|
|
|
2387
2425
|
return null;
|
|
2388
2426
|
}
|
|
2389
2427
|
const inlined = code.replace(VERCEL_OG_FONT_FETCH, (_match, _quote, request) => {
|
|
2390
|
-
const encoded = readFileSync2(
|
|
2428
|
+
const encoded = readFileSync2(path17.resolve(path17.dirname(file), request)).toString("base64");
|
|
2391
2429
|
return `Promise.resolve({ arrayBuffer: () => Uint8Array.from(atob(${JSON.stringify(encoded)}), (character) => character.charCodeAt(0)).buffer })`;
|
|
2392
2430
|
});
|
|
2393
2431
|
if (inlined !== code) return { code: inlined, map: null };
|
|
@@ -2406,7 +2444,7 @@ function createMetadataImageWasmPlugin() {
|
|
|
2406
2444
|
return null;
|
|
2407
2445
|
}
|
|
2408
2446
|
const requestPath = source.slice(0, -"?module".length);
|
|
2409
|
-
const resolvedPath =
|
|
2447
|
+
const resolvedPath = path17.isAbsolute(requestPath) ? requestPath : path17.resolve(path17.dirname(importer.split("?", 1)[0]), requestPath);
|
|
2410
2448
|
return `${FARM_METADATA_IMAGE_WASM_PREFIX}${resolvedPath}`;
|
|
2411
2449
|
},
|
|
2412
2450
|
load(id) {
|
|
@@ -2431,11 +2469,11 @@ function collectSSRExternalPackages(ssrBundle) {
|
|
|
2431
2469
|
for (const importId of [...output.imports, ...output.dynamicImports]) {
|
|
2432
2470
|
const normalizedImportId = importId.replace(/\\/g, "/");
|
|
2433
2471
|
const normalizedId = normalizedImportId.replace(/^\.\//, "");
|
|
2434
|
-
const resolvedRelativeId = normalizedImportId.startsWith("./") || normalizedImportId.startsWith("../") ?
|
|
2472
|
+
const resolvedRelativeId = normalizedImportId.startsWith("./") || normalizedImportId.startsWith("../") ? path17.posix.normalize(path17.posix.join(path17.posix.dirname(fileName), normalizedImportId)) : null;
|
|
2435
2473
|
if (emittedFiles.has(normalizedId) || resolvedRelativeId !== null && emittedFiles.has(resolvedRelativeId) || NODE_BUILTIN_MODULES.has(importId) || importId.startsWith("node:")) {
|
|
2436
2474
|
continue;
|
|
2437
2475
|
}
|
|
2438
|
-
if (
|
|
2476
|
+
if (path17.isAbsolute(importId) || /^[A-Za-z]:[\\/]/.test(importId) || importId.startsWith("#") || importId.startsWith("\0")) {
|
|
2439
2477
|
externalPackages.add(importId);
|
|
2440
2478
|
continue;
|
|
2441
2479
|
}
|
|
@@ -2447,15 +2485,15 @@ function collectSSRExternalPackages(ssrBundle) {
|
|
|
2447
2485
|
return externalPackages;
|
|
2448
2486
|
}
|
|
2449
2487
|
function createExternalSSRBundlePlugin(nitroEntryPath, ssrOutputDir, ssrEntryFile) {
|
|
2450
|
-
const resolvedNitroEntry =
|
|
2451
|
-
const resolvedSSREntry =
|
|
2488
|
+
const resolvedNitroEntry = path17.resolve(nitroEntryPath);
|
|
2489
|
+
const resolvedSSREntry = path17.resolve(ssrOutputDir, ssrEntryFile);
|
|
2452
2490
|
return {
|
|
2453
2491
|
name: "farm-externalize-prebuilt-ssr",
|
|
2454
2492
|
resolveId(source, importer) {
|
|
2455
|
-
if (!importer ||
|
|
2493
|
+
if (!importer || path17.resolve(importer) !== resolvedNitroEntry) {
|
|
2456
2494
|
return null;
|
|
2457
2495
|
}
|
|
2458
|
-
const resolvedImport =
|
|
2496
|
+
const resolvedImport = path17.resolve(path17.dirname(importer), source);
|
|
2459
2497
|
if (resolvedImport !== resolvedSSREntry) return null;
|
|
2460
2498
|
return { id: FARM_SSR_PACKAGE_IMPORT, external: true };
|
|
2461
2499
|
}
|
|
@@ -2593,13 +2631,13 @@ function trimSlashes(value) {
|
|
|
2593
2631
|
function resolveBuildDocsContentDir(docs, root, srcDir) {
|
|
2594
2632
|
const configuredContentDir = docs.contentDir || docs.config.contentDir;
|
|
2595
2633
|
if (typeof configuredContentDir === "string" && configuredContentDir.trim()) {
|
|
2596
|
-
const contentDir =
|
|
2634
|
+
const contentDir = path17.isAbsolute(configuredContentDir) ? configuredContentDir : path17.join(root, configuredContentDir);
|
|
2597
2635
|
return existsSync3(contentDir) ? contentDir : null;
|
|
2598
2636
|
}
|
|
2599
2637
|
const entryDir = docs.config.entry || trimSlashes(docs.entry) || "docs";
|
|
2600
|
-
const appDocsDir =
|
|
2638
|
+
const appDocsDir = path17.join(root, srcDir || "src", "app", entryDir);
|
|
2601
2639
|
if (existsSync3(appDocsDir)) return appDocsDir;
|
|
2602
|
-
const rootDocsDir =
|
|
2640
|
+
const rootDocsDir = path17.join(root, entryDir);
|
|
2603
2641
|
return existsSync3(rootDocsDir) ? rootDocsDir : null;
|
|
2604
2642
|
}
|
|
2605
2643
|
function hasProjectPostcssConfig(root) {
|
|
@@ -2616,7 +2654,7 @@ function hasProjectPostcssConfig(root) {
|
|
|
2616
2654
|
".postcssrc.mjs",
|
|
2617
2655
|
".postcssrc.ts"
|
|
2618
2656
|
];
|
|
2619
|
-
const projectRequire = createRequire2(
|
|
2657
|
+
const projectRequire = createRequire2(path17.join(root, "package.json"));
|
|
2620
2658
|
return candidates.some((file) => {
|
|
2621
2659
|
try {
|
|
2622
2660
|
projectRequire.resolve(`./${file}`);
|
|
@@ -2639,7 +2677,7 @@ async function findFarmConfigPath(root) {
|
|
|
2639
2677
|
"config.mjs"
|
|
2640
2678
|
];
|
|
2641
2679
|
for (const candidate of candidates) {
|
|
2642
|
-
const resolvedPath =
|
|
2680
|
+
const resolvedPath = path17.join(root, candidate);
|
|
2643
2681
|
try {
|
|
2644
2682
|
await fs5.access(resolvedPath);
|
|
2645
2683
|
return resolvedPath;
|
|
@@ -2676,7 +2714,7 @@ async function discoverMiddlewareRoutes(appDir) {
|
|
|
2676
2714
|
discovered.push({
|
|
2677
2715
|
path: routePath,
|
|
2678
2716
|
directory,
|
|
2679
|
-
filePath:
|
|
2717
|
+
filePath: path17.join(dir, middlewareFile.name)
|
|
2680
2718
|
});
|
|
2681
2719
|
}
|
|
2682
2720
|
for (const entry of entries) {
|
|
@@ -2684,7 +2722,7 @@ async function discoverMiddlewareRoutes(appDir) {
|
|
|
2684
2722
|
continue;
|
|
2685
2723
|
}
|
|
2686
2724
|
await walk(
|
|
2687
|
-
|
|
2725
|
+
path17.join(dir, entry.name),
|
|
2688
2726
|
appendMiddlewareRoutePath(routePath, entry.name),
|
|
2689
2727
|
appendMiddlewareDirectory(directory, entry.name),
|
|
2690
2728
|
discovered
|
|
@@ -2784,7 +2822,7 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
2784
2822
|
}
|
|
2785
2823
|
const hydrationPlanCache = routeManager.getRouteModuleHydrationPlans();
|
|
2786
2824
|
const sourceSnapshot = routeManager.takeBuildSourceSnapshot();
|
|
2787
|
-
const clientOutputDir =
|
|
2825
|
+
const clientOutputDir = path17.join(root, distDir, "client");
|
|
2788
2826
|
const [productionViteResult] = await productionViteResultPromise;
|
|
2789
2827
|
if (productionViteResult.status === "rejected") {
|
|
2790
2828
|
await routeRuntimeManifestResultPromise;
|
|
@@ -2917,10 +2955,10 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
2917
2955
|
markdownPrecompile?.pages
|
|
2918
2956
|
);
|
|
2919
2957
|
const runtimeManifestPath = await writeFarmRouteRuntimeManifest(
|
|
2920
|
-
|
|
2958
|
+
path17.join(root, distDir),
|
|
2921
2959
|
routeRuntimeManifest
|
|
2922
2960
|
);
|
|
2923
|
-
logger.info(`\u{1F4CB} Route runtime manifest: ${
|
|
2961
|
+
logger.info(`\u{1F4CB} Route runtime manifest: ${path17.relative(root, runtimeManifestPath)}`);
|
|
2924
2962
|
} catch (error) {
|
|
2925
2963
|
if (lifecyclePluginManager) {
|
|
2926
2964
|
await lifecyclePluginManager.runHookParallel("onError", {
|
|
@@ -2978,15 +3016,15 @@ async function writeSSRAssetsToClient(bundle, outputDir) {
|
|
|
2978
3016
|
await mergeBuiltFontCss(outputDir, output.source);
|
|
2979
3017
|
continue;
|
|
2980
3018
|
}
|
|
2981
|
-
const filePath =
|
|
2982
|
-
await fs5.mkdir(
|
|
3019
|
+
const filePath = path17.join(outputDir, fileName);
|
|
3020
|
+
await fs5.mkdir(path17.dirname(filePath), { recursive: true });
|
|
2983
3021
|
await fs5.writeFile(filePath, output.source);
|
|
2984
3022
|
}
|
|
2985
3023
|
}
|
|
2986
3024
|
async function writeFarmVideoPlayerToClient(outputDir) {
|
|
2987
3025
|
const fs5 = await import("fs/promises");
|
|
2988
|
-
const filePath =
|
|
2989
|
-
await fs5.mkdir(
|
|
3026
|
+
const filePath = path17.join(outputDir, FARM_VIDEO_PLAYER_PATH.slice(1));
|
|
3027
|
+
await fs5.mkdir(path17.dirname(filePath), { recursive: true });
|
|
2990
3028
|
try {
|
|
2991
3029
|
await fs5.writeFile(filePath, FARM_VIDEO_PLAYER_HTML, { flag: "wx" });
|
|
2992
3030
|
} catch (error) {
|
|
@@ -2997,15 +3035,15 @@ async function copyFarmDocsFontAssetsToClient(root, outputDir) {
|
|
|
2997
3035
|
const fs5 = await import("fs/promises");
|
|
2998
3036
|
await Promise.all(
|
|
2999
3037
|
resolveFarmDocsFontAssets(root).map(async ({ sourcePath, url }) => {
|
|
3000
|
-
const targetPath =
|
|
3001
|
-
await fs5.mkdir(
|
|
3038
|
+
const targetPath = path17.join(outputDir, url.replace(/^\/+/, ""));
|
|
3039
|
+
await fs5.mkdir(path17.dirname(targetPath), { recursive: true });
|
|
3002
3040
|
await fs5.copyFile(sourcePath, targetPath);
|
|
3003
3041
|
})
|
|
3004
3042
|
);
|
|
3005
3043
|
}
|
|
3006
3044
|
async function mergeBuiltFontCss(outputDir, fontCssSource) {
|
|
3007
3045
|
const fs5 = await import("fs/promises");
|
|
3008
|
-
const fontCssPath =
|
|
3046
|
+
const fontCssPath = path17.join(outputDir, "farm-fonts.css");
|
|
3009
3047
|
let fontCss = fontCssSource;
|
|
3010
3048
|
if (fontCss === void 0) {
|
|
3011
3049
|
try {
|
|
@@ -3014,7 +3052,7 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
|
|
|
3014
3052
|
return;
|
|
3015
3053
|
}
|
|
3016
3054
|
}
|
|
3017
|
-
const clientCssPath =
|
|
3055
|
+
const clientCssPath = path17.join(outputDir, "farm-client.css");
|
|
3018
3056
|
let clientCss = "";
|
|
3019
3057
|
try {
|
|
3020
3058
|
clientCss = await fs5.readFile(clientCssPath, "utf8");
|
|
@@ -3040,7 +3078,7 @@ var IncompleteClientBuildOutputError = class extends Error {
|
|
|
3040
3078
|
async function validateClientBuildOutput(root, srcDir, outputDir) {
|
|
3041
3079
|
const fs5 = await import("fs/promises");
|
|
3042
3080
|
const fingerprinted = await findFingerprintedClientEntry(outputDir);
|
|
3043
|
-
const clientEntryPath =
|
|
3081
|
+
const clientEntryPath = path17.join(outputDir, fingerprinted ?? "farm-client.js");
|
|
3044
3082
|
let clientEntrySize = 0;
|
|
3045
3083
|
try {
|
|
3046
3084
|
const clientEntry = await fs5.stat(clientEntryPath);
|
|
@@ -3050,8 +3088,8 @@ async function validateClientBuildOutput(root, srcDir, outputDir) {
|
|
|
3050
3088
|
if (clientEntrySize === 0) {
|
|
3051
3089
|
throw new IncompleteClientBuildOutputError("farm-client.js is missing or empty");
|
|
3052
3090
|
}
|
|
3053
|
-
const clientCssPath =
|
|
3054
|
-
const globalsCssPath =
|
|
3091
|
+
const clientCssPath = path17.join(outputDir, "farm-client.css");
|
|
3092
|
+
const globalsCssPath = path17.join(root, srcDir, "app", "globals.css");
|
|
3055
3093
|
let expectsCss = false;
|
|
3056
3094
|
try {
|
|
3057
3095
|
const globalsCss = await fs5.readFile(globalsCssPath, "utf8");
|
|
@@ -3081,9 +3119,14 @@ function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, optio
|
|
|
3081
3119
|
return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
|
|
3082
3120
|
}
|
|
3083
3121
|
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(
|
|
3122
|
+
if (!mobile) await removeFarmMobileClientManifest(path17.dirname(outputDir));
|
|
3085
3123
|
const viteBuild = productionVite.build;
|
|
3086
|
-
const {
|
|
3124
|
+
const {
|
|
3125
|
+
farmIslandContainersPlugin,
|
|
3126
|
+
farmNavigationPlugin,
|
|
3127
|
+
farmPlugin,
|
|
3128
|
+
farmServerOnlyEntriesPlugin
|
|
3129
|
+
} = await import("./vite.mjs");
|
|
3087
3130
|
const { PluginManager: PluginManager2 } = await import("./plugin-33I3V42N.mjs");
|
|
3088
3131
|
const fs5 = await import("fs/promises");
|
|
3089
3132
|
const pluginManager = new PluginManager2({
|
|
@@ -3364,12 +3407,12 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3364
3407
|
);
|
|
3365
3408
|
const clientRouteTable = createFarmClientRouteTable(clientPages);
|
|
3366
3409
|
createFarmRouter(clientRouteTable.map((route) => ({ path: route.pattern, meta: route })));
|
|
3367
|
-
await writeFarmClientRouteTable(
|
|
3410
|
+
await writeFarmClientRouteTable(path17.dirname(outputDir), clientRouteTable);
|
|
3368
3411
|
const buildTarget = async (platform) => {
|
|
3369
|
-
const clientEntryRoot =
|
|
3412
|
+
const clientEntryRoot = path17.join(root, ".farm", "tmp");
|
|
3370
3413
|
await fs5.mkdir(clientEntryRoot, { recursive: true });
|
|
3371
|
-
const clientEntryDir = await fs5.mkdtemp(
|
|
3372
|
-
const clientEntryPath =
|
|
3414
|
+
const clientEntryDir = await fs5.mkdtemp(path17.join(clientEntryRoot, "client-entry-"));
|
|
3415
|
+
const clientEntryPath = path17.join(clientEntryDir, "farm-client-entry.tsx");
|
|
3373
3416
|
const clientHydrationCode = generateClientHydrationEntry(
|
|
3374
3417
|
clientPages,
|
|
3375
3418
|
clientLayouts,
|
|
@@ -3403,15 +3446,15 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3403
3446
|
const clientEntry = islandsMode && platform === "web" && clientHydrationCode.includes("/*farm-router-stub*/") ? splitFarmClientRouter(clientHydrationCode) : { entry: clientHydrationCode, router: void 0 };
|
|
3404
3447
|
await fs5.writeFile(clientEntryPath, clientEntry.entry);
|
|
3405
3448
|
await fs5.writeFile(
|
|
3406
|
-
|
|
3449
|
+
path17.join(clientEntryDir, `${FARM_CLIENT_ROUTE_TABLE_MODULE}.tsx`),
|
|
3407
3450
|
generateFarmClientRouteTableModule(clientRouteTable)
|
|
3408
3451
|
);
|
|
3409
3452
|
if (clientEntry.router !== void 0) {
|
|
3410
|
-
await fs5.writeFile(
|
|
3453
|
+
await fs5.writeFile(path17.join(clientEntryDir, "farm-client-router.tsx"), clientEntry.router);
|
|
3411
3454
|
}
|
|
3412
3455
|
const clientInput = { [entryName]: clientEntryPath };
|
|
3413
3456
|
if (platform === "web" && canBootFarmIslandsClient(config)) {
|
|
3414
|
-
const clientBootPath =
|
|
3457
|
+
const clientBootPath = path17.join(clientEntryDir, "farm-client-boot.tsx");
|
|
3415
3458
|
await fs5.writeFile(
|
|
3416
3459
|
clientBootPath,
|
|
3417
3460
|
'import { startFarmIslandsBoot } from "@farm.js/core/internal/islands-boot";\nstartFarmIslandsBoot();\n'
|
|
@@ -3428,7 +3471,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3428
3471
|
if (hasScopedPostcssConfig) {
|
|
3429
3472
|
logger.info("\u{1F4E6} Using project PostCSS/Tailwind configuration");
|
|
3430
3473
|
} else {
|
|
3431
|
-
const postcssConfigPath =
|
|
3474
|
+
const postcssConfigPath = path17.join(clientEntryDir, "postcss.config.cjs");
|
|
3432
3475
|
await fs5.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
|
|
3433
3476
|
postcssSearchPath = clientEntryDir;
|
|
3434
3477
|
tailwindVitePlugin = await loadTailwindVitePlugin({
|
|
@@ -3487,26 +3530,27 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3487
3530
|
plugins: [
|
|
3488
3531
|
createFarmThemeCssPlugin(config.theme, config.basePath),
|
|
3489
3532
|
createFarmPrivateClientSourcemapsPlugin({
|
|
3490
|
-
outDir:
|
|
3491
|
-
|
|
3533
|
+
outDir: path17.join(
|
|
3534
|
+
path17.dirname(outputDir),
|
|
3492
3535
|
platform === "mobile" ? `${FARM_CLIENT_SOURCEMAPS_DIR}-mobile` : FARM_CLIENT_SOURCEMAPS_DIR
|
|
3493
3536
|
)
|
|
3494
3537
|
}),
|
|
3495
3538
|
// The web client's preload manifests; the mobile client records its files instead.
|
|
3496
3539
|
platform === "mobile" ? createFarmMobileClientManifestPlugin({
|
|
3497
|
-
buildDir:
|
|
3540
|
+
buildDir: path17.dirname(outputDir),
|
|
3498
3541
|
entryName
|
|
3499
3542
|
}) : createFarmClientModulePreloadPlugin({
|
|
3500
3543
|
root,
|
|
3501
|
-
buildDir:
|
|
3544
|
+
buildDir: path17.dirname(outputDir),
|
|
3502
3545
|
entryName: "farm-client",
|
|
3503
3546
|
routerModules: [
|
|
3504
|
-
|
|
3505
|
-
|
|
3547
|
+
path17.join(clientEntryDir, "farm-client-router.tsx"),
|
|
3548
|
+
path17.join(clientEntryDir, `${FARM_CLIENT_ROUTE_TABLE_MODULE}.tsx`)
|
|
3506
3549
|
],
|
|
3507
3550
|
// What the islands entry loads with its first render or hydration (RFC 0010).
|
|
3508
3551
|
...islandsMode && isReactRenderer(config.renderer) ? {
|
|
3509
3552
|
rendererImports: [
|
|
3553
|
+
"react",
|
|
3510
3554
|
"react-dom/client",
|
|
3511
3555
|
"@farm.js/core/internal/islands-runtime"
|
|
3512
3556
|
],
|
|
@@ -3516,7 +3560,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3516
3560
|
...adapterOwnsDocsRuntime && platform === "web" ? [
|
|
3517
3561
|
createFarmDocsModulePreloadPlugin({
|
|
3518
3562
|
root,
|
|
3519
|
-
buildDir:
|
|
3563
|
+
buildDir: path17.dirname(outputDir),
|
|
3520
3564
|
importer: clientEntryPath,
|
|
3521
3565
|
entryName: "farm-client",
|
|
3522
3566
|
modules: [
|
|
@@ -3529,6 +3573,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3529
3573
|
...rendererVitePlugins,
|
|
3530
3574
|
...config.vite.plugins || [],
|
|
3531
3575
|
farmServerOnlyEntriesPlugin({ platform, distDir: config.distDir || ".farm" }),
|
|
3576
|
+
farmNavigationPlugin(config.renderer),
|
|
3532
3577
|
farmDocsClientConfigPlugin(
|
|
3533
3578
|
adapterOwnsDocsRuntime ? getFarmDocsAdapterConfigModule(config.docs) : void 0
|
|
3534
3579
|
),
|
|
@@ -3625,8 +3670,8 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3625
3670
|
mergeFarmProductionViteConfig(clientViteConfig, config.vite, { clientOutput: true })
|
|
3626
3671
|
);
|
|
3627
3672
|
if (platform === "mobile") {
|
|
3628
|
-
await fs5.rm(
|
|
3629
|
-
if (!await hasFarmMobileClientEntry(
|
|
3673
|
+
await fs5.rm(path17.join(outputDir, `${entryName}.css`), { force: true });
|
|
3674
|
+
if (!await hasFarmMobileClientEntry(path17.dirname(outputDir), outputDir)) {
|
|
3630
3675
|
throw new IncompleteClientBuildOutputError(
|
|
3631
3676
|
`${FARM_MOBILE_CLIENT_ENTRY_NAME}.js is missing or empty`
|
|
3632
3677
|
);
|
|
@@ -4447,9 +4492,9 @@ ${streamNavigations ? ` // A streamed navigation swaps in the page's shell; its
|
|
|
4447
4492
|
const response = await fetchFarmNavigationDocument(url, {
|
|
4448
4493
|
"Accept": "text/html",
|
|
4449
4494
|
...(interceptFrom ? { "X-Farm-Intercept-From": interceptFrom } : {}),
|
|
4450
|
-
// Islands mode: the server leaves out island values this browser holds
|
|
4451
|
-
// layouts it shows.
|
|
4452
|
-
...getFarmIslandValueHeaders(),
|
|
4495
|
+
// Islands mode: the server leaves out island values this browser holds (the swap keeps
|
|
4496
|
+
// the ones only the page holds, keepFarmIslandValues), and the layouts it shows.
|
|
4497
|
+
...getFarmIslandValueHeaders(${streamNavigations ? 'document.getElementById("root") || document.body' : ""}),
|
|
4453
4498
|
...partialHeaders,
|
|
4454
4499
|
...(streamShell ? { "F-Stream": "flush" } : {}),
|
|
4455
4500
|
}, recover, signal);
|
|
@@ -4880,8 +4925,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
4880
4925
|
);
|
|
4881
4926
|
const appSetupPath = resolveFarmRendererAppSetup(root, renderer);
|
|
4882
4927
|
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";
|
|
4928
|
+
const rendererClientImports = lazyRenderer ? `import { holdFarmIslandInteractions, restorePagePosition, watchFarmIslandTriggers } from "@farm.js/core/internal/client-runtime";` : isReactRenderer(renderer) ? `import React from "react";
|
|
4885
4929
|
import { createRoot, hydrateRoot } from "react-dom/client";
|
|
4886
4930
|
import { restorePagePosition } from "@farm.js/core/internal/client-runtime";` : (
|
|
4887
4931
|
// Named exports only, as the server entry and the development client read them. A copy
|
|
@@ -4899,7 +4943,7 @@ const React = { ...__farmRendererClient };`
|
|
|
4899
4943
|
root,
|
|
4900
4944
|
renderer.componentExtensions ?? []
|
|
4901
4945
|
);
|
|
4902
|
-
const globalsCssPath =
|
|
4946
|
+
const globalsCssPath = path17.join(root, srcDir, "app", "globals.css");
|
|
4903
4947
|
const serverStyleModules = [];
|
|
4904
4948
|
const cssImport = [
|
|
4905
4949
|
...existsSync3(globalsCssPath) ? [globalsCssPath] : [],
|
|
@@ -5324,7 +5368,8 @@ installFarmLinkPrefetch();
|
|
|
5324
5368
|
...serverTreeEnabled ? ["createFarmServerTreeElement"] : [],
|
|
5325
5369
|
...hasServerTreeLayouts ? ["createFarmServerTreeLayout"] : []
|
|
5326
5370
|
].join(", ");
|
|
5327
|
-
const lazyRendererRuntime = lazyRenderer ? `// React DOM${isolatedHydrationEnabled ? " and islx" : ""} load with the first render or hydration (RFC 0010).
|
|
5371
|
+
const lazyRendererRuntime = lazyRenderer ? `// React, React DOM${isolatedHydrationEnabled ? " and islx" : ""} load with the first render or hydration (RFC 0010).
|
|
5372
|
+
let React;
|
|
5328
5373
|
let createRoot;
|
|
5329
5374
|
let hydrateRoot;
|
|
5330
5375
|
let farmRendererLoading = null;
|
|
@@ -5334,14 +5379,16 @@ let farmRendererLoaded = false;${isolatedHydrationEnabled ? `
|
|
|
5334
5379
|
const releaseFarmIslandInteractions = holdFarmIslandInteractions("f-island");` : ""}
|
|
5335
5380
|
function loadFarmRenderer() {
|
|
5336
5381
|
return farmRendererLoading || (farmRendererLoading = Promise.all([
|
|
5382
|
+
import("react"),
|
|
5337
5383
|
import("react-dom/client"),${isolatedHydrationEnabled ? `
|
|
5338
5384
|
// Named here, so the build keeps only these of islx's exports.
|
|
5339
5385
|
import("@farm.js/core/internal/islands-runtime").then(function({ ${islandsRuntimeExports} }) {
|
|
5340
5386
|
return { ${islandsRuntimeExports} };
|
|
5341
5387
|
}),` : ""}
|
|
5342
5388
|
]).then(function(modules) {
|
|
5343
|
-
|
|
5344
|
-
|
|
5389
|
+
React = modules[0].default;
|
|
5390
|
+
createRoot = modules[1].createRoot;
|
|
5391
|
+
hydrateRoot = modules[1].hydrateRoot;${isolatedHydrationEnabled ? "\n startFarmIslandsRuntime(modules[2]);\n releaseFarmIslandInteractions();\n runFarmIslandsWaiting();" : ""}
|
|
5345
5392
|
farmRendererLoaded = true;
|
|
5346
5393
|
}, function(error) {${isolatedHydrationEnabled ? `
|
|
5347
5394
|
// Without islx a held click would never replay: the page acts natively again.
|
|
@@ -5378,26 +5425,55 @@ function startFarmIslandsRuntime(islands) {
|
|
|
5378
5425
|
// A hydrating layout keeps a non-hydrating page as server HTML; this wrapper runs its islands.
|
|
5379
5426
|
FarmServerPage = islands.createFarmServerPageBoundary(React, farmIslandsRuntime);
|
|
5380
5427
|
}
|
|
5381
|
-
//
|
|
5382
|
-
//
|
|
5383
|
-
|
|
5428
|
+
// islx loads with the first island that is due, as the boot decides on a first load: at once for
|
|
5429
|
+
// one that hydrates at load, else on its trigger. A page or navigation of islands that wait loads
|
|
5430
|
+
// none of it. Until it loads, calls wait here in the order they were made and run with it.
|
|
5431
|
+
const farmIslandsWaiting = [];
|
|
5432
|
+
function runFarmIslandsWaiting() {
|
|
5433
|
+
for (const entry of farmIslandsWaiting.splice(0)) {
|
|
5434
|
+
if (entry.stop) entry.stop();
|
|
5435
|
+
entry.run(farmIslandsRuntime);
|
|
5436
|
+
}
|
|
5437
|
+
}
|
|
5438
|
+
// Behind a load under way, calls wait for it; one that fails reports itself to whoever awaited it.
|
|
5439
|
+
function whenFarmIslandsRuntime(scope, call) {
|
|
5384
5440
|
if (farmIslandsRuntime) call(farmIslandsRuntime);
|
|
5385
5441
|
else if (farmRendererLoading) farmRendererLoading.then(function() { call(farmIslandsRuntime); }, function() {});
|
|
5442
|
+
else farmIslandsWaiting.push({ scope: scope, run: call });
|
|
5386
5443
|
}
|
|
5387
5444
|
const farmIsolatedHydrationRuntime = {
|
|
5388
5445
|
hydrate: function(scope, signal) {
|
|
5389
5446
|
if (farmIslandsRuntime) return farmIslandsRuntime.hydrate(scope, signal);
|
|
5390
|
-
|
|
5447
|
+
const stop = farmRendererLoading
|
|
5448
|
+
? null
|
|
5449
|
+
: watchFarmIslandTriggers(scope, "f-island", function() { void loadFarmRenderer(); });
|
|
5450
|
+
if (!stop) return loadFarmRenderer().then(function() { return farmIslandsRuntime.hydrate(scope, signal); });
|
|
5451
|
+
farmIslandsWaiting.push({
|
|
5452
|
+
scope: scope,
|
|
5453
|
+
stop: stop,
|
|
5454
|
+
run: function(runtime) {
|
|
5455
|
+
if (!signal || !signal.aborted) void runtime.hydrate(scope, signal);
|
|
5456
|
+
},
|
|
5457
|
+
});
|
|
5458
|
+
return Promise.resolve();
|
|
5391
5459
|
},
|
|
5392
5460
|
dispose: function(scope) {
|
|
5393
|
-
|
|
5461
|
+
if (farmIslandsRuntime) return farmIslandsRuntime.dispose(scope);
|
|
5462
|
+
// Nothing has hydrated yet: what removed DOM waits for goes with it.
|
|
5463
|
+
for (let index = farmIslandsWaiting.length - 1; index >= 0; index--) {
|
|
5464
|
+
const entry = farmIslandsWaiting[index];
|
|
5465
|
+
if (!scope.contains(entry.scope)) continue;
|
|
5466
|
+
farmIslandsWaiting.splice(index, 1);
|
|
5467
|
+
if (entry.stop) entry.stop();
|
|
5468
|
+
}
|
|
5469
|
+
if (farmRendererLoading) farmRendererLoading.then(function() { farmIslandsRuntime.dispose(scope); }, function() {});
|
|
5394
5470
|
},
|
|
5395
5471
|
// Only a hydrated island has state to carry over.
|
|
5396
5472
|
carryOver: function(from, to) {
|
|
5397
5473
|
if (farmIslandsRuntime) farmIslandsRuntime.carryOver(from, to);
|
|
5398
5474
|
},
|
|
5399
5475
|
endStream: function(root) {
|
|
5400
|
-
whenFarmIslandsRuntime(function(runtime) { runtime.endStream(root); });
|
|
5476
|
+
whenFarmIslandsRuntime(root, function(runtime) { runtime.endStream(root); });
|
|
5401
5477
|
},
|
|
5402
5478
|
};` : `const farmIsolatedHydrationRuntime = createFarmIsolatedHydrationRuntime({
|
|
5403
5479
|
ReactRuntime: React,
|
|
@@ -5455,7 +5531,7 @@ ${layoutImports}
|
|
|
5455
5531
|
${rendererClientImports}
|
|
5456
5532
|
${isolatedHydrationImport}
|
|
5457
5533
|
${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";
|
|
5534
|
+
import { createClientCancellation, createClientPluginManager, createPluginlessClientRuntime, getFarmIslandValueHeaders, getHashTargetElement, keepFarmIslandValues, installChunkErrorRecovery, installFarmLinkPrefetch, isFarmBlockedNavigationURL, isFarmExternalNavigationURL, readFarmLinkNavigateOptions, rememberFarmLinkLocale, reconcileFarmDocumentHead, runFarmNavigationDelegates, scheduleFarmIslandHydration, createFarmSearchParams, searchParamsToObject, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
|
|
5459
5535
|
import { createFarmDeploymentMismatchError, createFarmDeploymentRequestHeaders, isFarmDeploymentMismatchResponse } from "@farm.js/core/deployment";
|
|
5460
5536
|
import { createFarmRouter, isFarmRouteActive, matchFarmRoute } from "@farm.js/core/router";
|
|
5461
5537
|
${clientPluginEntry.imports}
|
|
@@ -6692,6 +6768,7 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
6692
6768
|
|
|
6693
6769
|
${islandValues ? `// A payload-only page renders only in a React root that rebuilds it.
|
|
6694
6770
|
if (nextPage?.querySelector('script[type="f/tree"][partial]')) return "segment-mismatch";` : ""}
|
|
6771
|
+
${islandValues ? "const keepValues = keepFarmIslandValues(currentRoot);" : ""}
|
|
6695
6772
|
const rootWasReactOwned = reactRootContainer === currentRoot;
|
|
6696
6773
|
resetReactRoot();
|
|
6697
6774
|
resetRouteSlotRoots();
|
|
@@ -6708,6 +6785,7 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
6708
6785
|
activateNavigationScripts(currentRoot);
|
|
6709
6786
|
isolatedHydrationScope = currentRoot;
|
|
6710
6787
|
}
|
|
6788
|
+
${islandValues ? "keepValues();" : ""}
|
|
6711
6789
|
window.__FARM_ROUTE_SLOTS__ = nextRouteSlots;
|
|
6712
6790
|
hydrateInitialRouteSlots();
|
|
6713
6791
|
|
|
@@ -6909,7 +6987,12 @@ void hydrate();
|
|
|
6909
6987
|
}
|
|
6910
6988
|
async function buildSSRInMemory(productionVite, config, root, routeManager, apiRouteManager, serverRenderer, preset, collectedPageRoutes, collectedLayoutRoutes, collectedRouteSlots, isolatedClientBoundaryModules, hydrationPlanCache, rendererBuildLifetime, sourceSnapshot) {
|
|
6911
6989
|
const viteBuild = productionVite.build;
|
|
6912
|
-
const {
|
|
6990
|
+
const {
|
|
6991
|
+
farmIslandContainersPlugin,
|
|
6992
|
+
farmNavigationPlugin,
|
|
6993
|
+
farmPlugin,
|
|
6994
|
+
farmServerOnlyEntriesPlugin
|
|
6995
|
+
} = await import("./vite.mjs");
|
|
6913
6996
|
const { PluginManager: PluginManager2 } = await import("./plugin-33I3V42N.mjs");
|
|
6914
6997
|
const fs5 = await import("fs/promises");
|
|
6915
6998
|
const pluginManager = new PluginManager2({
|
|
@@ -6926,9 +7009,9 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6926
7009
|
buildLifetime: rendererBuildLifetime
|
|
6927
7010
|
});
|
|
6928
7011
|
if (!hasScopedPostcssConfig) {
|
|
6929
|
-
postcssConfigDir = await fs5.mkdtemp(
|
|
7012
|
+
postcssConfigDir = await fs5.mkdtemp(path17.join(os.tmpdir(), "farm-postcss-"));
|
|
6930
7013
|
await fs5.writeFile(
|
|
6931
|
-
|
|
7014
|
+
path17.join(postcssConfigDir, "postcss.config.cjs"),
|
|
6932
7015
|
"module.exports = { plugins: [] };\n"
|
|
6933
7016
|
);
|
|
6934
7017
|
tailwindVitePlugin = await loadTailwindVitePlugin({
|
|
@@ -7272,6 +7355,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7272
7355
|
] : [],
|
|
7273
7356
|
{ ...createReactProductionModePlugin(), enforce: "pre" },
|
|
7274
7357
|
farmServerOnlyEntriesPlugin({ distDir: config.distDir || ".farm" }),
|
|
7358
|
+
farmNavigationPlugin(config.renderer),
|
|
7275
7359
|
farmIslandContainersPlugin(config),
|
|
7276
7360
|
farmPlugin(
|
|
7277
7361
|
{
|
|
@@ -7359,7 +7443,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7359
7443
|
}
|
|
7360
7444
|
function readFarmAppPackageIdentity(root) {
|
|
7361
7445
|
try {
|
|
7362
|
-
return JSON.parse(readFileSync2(
|
|
7446
|
+
return JSON.parse(readFileSync2(path17.join(root, "package.json"), "utf8"));
|
|
7363
7447
|
} catch {
|
|
7364
7448
|
return {};
|
|
7365
7449
|
}
|
|
@@ -7792,6 +7876,7 @@ function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlot
|
|
|
7792
7876
|
);
|
|
7793
7877
|
const searchPreserveRoutesSource = searchPreserveRoutes.length > 0 ? JSON.stringify(searchPreserveRoutes) : "";
|
|
7794
7878
|
const farmIslandsMode = resolveFarmServerComponentsMode(config.experimental?.serverComponents) === "islands";
|
|
7879
|
+
const farmRendererActions = resolveFarmIslxActionsMode(config) === "renderer";
|
|
7795
7880
|
const farmClientBoot = canBootFarmIslandsClient(config);
|
|
7796
7881
|
const farmMobileClient = shouldBuildFarmMobileClient(config);
|
|
7797
7882
|
const farmMobileShells = farmMobileClient && config.mobileShells ? config.mobileShells : null;
|
|
@@ -8001,7 +8086,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8001
8086
|
source: ${JSON.stringify(route.source ?? "")},
|
|
8002
8087
|
filePath: ${JSON.stringify(toBakedMarkdownSourcePath(config.root, route.modulePath))},
|
|
8003
8088
|
components: farmMdxComponents,
|
|
8004
|
-
config: farmMdxConfig,
|
|
8089
|
+
config: farmMdxConfig,${isReactRenderer(config.renderer) ? "" : "\n renderer: React,"}
|
|
8005
8090
|
}),
|
|
8006
8091
|
markdownSource: {
|
|
8007
8092
|
source: ${JSON.stringify(route.source ?? "")},
|
|
@@ -8136,12 +8221,13 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8136
8221
|
metadataImageImports.push(
|
|
8137
8222
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(image.modulePath)};`
|
|
8138
8223
|
);
|
|
8224
|
+
const component = !isReactRenderer(config.renderer) && isRendererCompiledComponent(image.modulePath, config.renderer?.componentExtensions ?? []);
|
|
8139
8225
|
metadataImageRegistrations.push(`
|
|
8140
8226
|
{
|
|
8141
8227
|
pattern: ${JSON.stringify(image.pattern)},
|
|
8142
8228
|
kind: ${JSON.stringify(image.kind)},
|
|
8143
8229
|
fileName: ${JSON.stringify(image.fileName)},
|
|
8144
|
-
sourceType: "module",
|
|
8230
|
+
sourceType: "module",${component ? "\n component: true," : ""}
|
|
8145
8231
|
module: ${varName},
|
|
8146
8232
|
}`);
|
|
8147
8233
|
return;
|
|
@@ -8352,12 +8438,15 @@ import { installFarmIslandsServer } from "@farm.js/core/internal/islands-server"
|
|
|
8352
8438
|
installFarmIslandsServer();
|
|
8353
8439
|
const farmFormActionsConfig = ${JSON.stringify(resolveServerActionsConfig(config.serverActions))};
|
|
8354
8440
|
installFarmIslandValues();
|
|
8355
|
-
${islandsActionKeyCode()}
|
|
8356
|
-
${FARM_SEGMENT_NAVIGATION_SERVER_RUNTIME}` : `
|
|
8441
|
+
${islandsActionKeyCode("@farm.js/core/internal/islx-server")}
|
|
8442
|
+
${FARM_SEGMENT_NAVIGATION_SERVER_RUNTIME}` : `${farmRendererActions ? `
|
|
8443
|
+
import { handleFarmFormActionRequest } from "@farm.js/core/internal/production-runtime";
|
|
8444
|
+
const farmFormActionsConfig = ${JSON.stringify(resolveServerActionsConfig(config.serverActions))};
|
|
8445
|
+
${islandsActionKeyCode("@farm.js/core/internal/islx-actions-server")}` : ""}
|
|
8357
8446
|
function farmFormState() { return undefined; }
|
|
8358
8447
|
function farmFormStateScript() { return ""; }`}`;
|
|
8359
8448
|
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";` : "";
|
|
8449
|
+
const metadataImageRuntimeImport = hasGeneratedMetadataImages ? `import { createFarmMetadataImageResponse, resolveFarmMetadataImageValue } from "@farm.js/core/internal/metadata-image-runtime";` : "";
|
|
8361
8450
|
const pluginRuntimeImport = hasPluginRuntime ? `import { PluginManager } from "@farm.js/core/plugin";` : "";
|
|
8362
8451
|
const infraAnalyticsImport = hasInfraAnalyticsRuntime ? `import { ${hasPluginRuntime ? "createFarmInfraAnalyticsPlugin" : "createFarmInfraAnalyticsRecorder"} } from "@farm.js/core/internal/infra-analytics-runtime";` : "";
|
|
8363
8452
|
const compressionRuntimeImport = hasCompressionRuntime ? `import { compressFarmResponse${hasPluginRuntime ? ", createCompressionPlugin" : ""} } from "@farm.js/core/internal/compression-runtime";` : "";
|
|
@@ -8380,7 +8469,7 @@ import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
|
8380
8469
|
const markdownHandlerImport = config.md?.enabled ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
|
|
8381
8470
|
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
8471
|
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" ?
|
|
8472
|
+
const mdxComponentsPath = typeof config.mdx?.components === "string" ? path17.isAbsolute(config.mdx.components) ? config.mdx.components : path17.join(config.root, config.mdx.components) : null;
|
|
8384
8473
|
const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
|
|
8385
8474
|
const layerConfigPaths = (config.layers || []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile)).filter((configFile) => configFile !== configModulePath);
|
|
8386
8475
|
const layerConfigImports = layerConfigPaths.map(
|
|
@@ -8925,7 +9014,7 @@ const farmDocsAPIHandler = ${config.docs?.enabled ? hasPrecompiledDocs ? "farmDo
|
|
|
8925
9014
|
|
|
8926
9015
|
// API routes bundled at build time
|
|
8927
9016
|
const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
|
|
8928
|
-
]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path:
|
|
9017
|
+
]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path: path19, methods }) => ({ path: path19, methods })))}, { bodySizeLimit: ${JSON.stringify(config.server.bodySizeLimit)}, dispatch: dispatchFarmPluginAPIRequest })` : ""};
|
|
8929
9018
|
// A plugin calling an app endpoint (an MCP tool, say) goes through the whole
|
|
8930
9019
|
// pipeline, so the endpoint's middleware and integration guards run for it.
|
|
8931
9020
|
function dispatchFarmPluginAPIRequest(request) {
|
|
@@ -9068,7 +9157,10 @@ function serializeFarmInlineValue(value) {
|
|
|
9068
9157
|
.replace(/\\u2029/g, "\\\\u2029");
|
|
9069
9158
|
}
|
|
9070
9159
|
|
|
9071
|
-
|
|
9160
|
+
// \`statusDocument\`: the not-found or error page, which renders without the route's layout
|
|
9161
|
+
// boundaries and page segment. It names no route for its URL, so the client hydrates none over it
|
|
9162
|
+
// (development writes no hydration flags for it either); its links still navigate.
|
|
9163
|
+
function renderFarmClientBootstrapScript(canonicalPath, selectedRouteSlots, pageProps, routePathname, statusDocument) {
|
|
9072
9164
|
const integrationManifest = ${hasRuntimeIntegrationConfig ? "getRegisteredIntegrationAPIManifest()" : "{}"};
|
|
9073
9165
|
const serializedRouteSlots = serializeFarmInlineValue(selectedRouteSlots || []);
|
|
9074
9166
|
const serializedPageProps = serializeFarmInlineValue(pageProps || {});
|
|
@@ -9079,11 +9171,13 @@ function renderFarmClientBootstrapScript(canonicalPath, selectedRouteSlots, page
|
|
|
9079
9171
|
';window.__FARM_DEPLOYMENT_ID__=' + serializeFarmInlineValue(farmDeploymentId) + ';'${searchPreserveRoutesSource ? ` +
|
|
9080
9172
|
'window[Symbol.for("farm.searchPreserveRoutes")]=' + serializeFarmInlineValue(farmSearchPreserveRoutes) + ';'` : ""};
|
|
9081
9173
|
// The client boots at the canonical path when the script below moves it there.
|
|
9082
|
-
const bootRoutes =
|
|
9083
|
-
typeof
|
|
9084
|
-
|
|
9085
|
-
|
|
9086
|
-
|
|
9174
|
+
const bootRoutes = statusDocument
|
|
9175
|
+
? typeof routePathname === "string" ? { path: routePathname, routes: [] } : undefined
|
|
9176
|
+
: getFarmClientBootRoutes(
|
|
9177
|
+
typeof canonicalPath === "string" && canonicalPath.startsWith("/")
|
|
9178
|
+
? getFarmRoutePathname(canonicalPath.split(/[?#]/)[0])
|
|
9179
|
+
: routePathname
|
|
9180
|
+
);
|
|
9087
9181
|
if (bootRoutes) source += 'window.__FARM_CLIENT_ROUTES__=' + serializeFarmInlineValue(bootRoutes) + ';';
|
|
9088
9182
|
if (typeof canonicalPath === "string" && canonicalPath.startsWith("/")) {
|
|
9089
9183
|
const serializedPath = serializeFarmInlineValue(canonicalPath);
|
|
@@ -9871,7 +9965,7 @@ function addFarmFallbackIcon(markup, hasFavicon) {
|
|
|
9871
9965
|
return markup.replace(/<\\/head>/i, function() { return ' <link rel="icon" href="data:,">\\n</head>'; });
|
|
9872
9966
|
}
|
|
9873
9967
|
|
|
9874
|
-
function createFarmErrorDocument(html, title) {
|
|
9968
|
+
function createFarmErrorDocument(html, title, routePathname) {
|
|
9875
9969
|
const escapedTitle = escapeFarmHtmlAttribute(title || "Application Error");
|
|
9876
9970
|
const fullDocument = extractFarmFullDocument(html);
|
|
9877
9971
|
const hasFullDocument = fullDocument !== null;
|
|
@@ -9886,7 +9980,7 @@ function createFarmErrorDocument(html, title) {
|
|
|
9886
9980
|
renderFarmRendererHydrationScript() + '\\n' +
|
|
9887
9981
|
'</head>\\n<body>\\n' +
|
|
9888
9982
|
' <div id="root">' + html + '</div>\\n' +
|
|
9889
|
-
' ' + renderFarmClientBootstrapScript() + '\\n' +
|
|
9983
|
+
' ' + renderFarmClientBootstrapScript(undefined, undefined, undefined, routePathname, true) + '\\n' +
|
|
9890
9984
|
' ' + renderFarmClientEntryScript() + '\\n' +
|
|
9891
9985
|
'</body>\\n</html>';
|
|
9892
9986
|
}
|
|
@@ -9905,7 +9999,7 @@ function createFarmErrorDocument(html, title) {
|
|
|
9905
9999
|
.replace(
|
|
9906
10000
|
/<\\/body>/i,
|
|
9907
10001
|
function() {
|
|
9908
|
-
return ' ' + renderFarmClientBootstrapScript() + '\\n' +
|
|
10002
|
+
return ' ' + renderFarmClientBootstrapScript(undefined, undefined, undefined, routePathname, true) + '\\n' +
|
|
9909
10003
|
' ' + renderFarmClientEntryScript() + '\\n</body>';
|
|
9910
10004
|
},
|
|
9911
10005
|
);
|
|
@@ -10258,11 +10352,9 @@ async function handleMetadataImageRequest(request, routePathname) {
|
|
|
10258
10352
|
searchParams: createFarmSearchParams(searchParams),
|
|
10259
10353
|
path: match.pagePath,
|
|
10260
10354
|
};
|
|
10261
|
-
const value = typeof imageModule.default === "function"
|
|
10262
|
-
? await imageModule.default(props)
|
|
10263
|
-
: imageModule.default;
|
|
10264
10355
|
|
|
10265
|
-
${hasGeneratedMetadataImages ? `
|
|
10356
|
+
${hasGeneratedMetadataImages ? `const value = await resolveFarmMetadataImageValue(imageModule, props${isReactRenderer(config.renderer) ? "" : ", {\n renderer: ReactDOMServer,\n component: image.component === true,\n }"});
|
|
10357
|
+
return createFarmMetadataImageResponse(value, imageModule, {
|
|
10266
10358
|
method,
|
|
10267
10359
|
ifNoneMatch: request.headers.get("if-none-match"),${isReactRenderer(config.renderer) ? "" : "\n renderer: ReactDOMServer,"}
|
|
10268
10360
|
});` : 'throw new Error("Generated metadata image runtime is unavailable");'}
|
|
@@ -11731,7 +11823,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11731
11823
|
if (farmDeploymentMismatch) return createFarmDeploymentMismatchResponse(farmDeploymentMismatch);
|
|
11732
11824
|
farmCacheGuard.deploymentPage = true;
|
|
11733
11825
|
}
|
|
11734
|
-
${farmIslandsMode ? `//
|
|
11826
|
+
${farmIslandsMode || farmRendererActions ? `// A form or client component posting a server action to this page.
|
|
11735
11827
|
if (matchedRoute && request.method === "POST") {
|
|
11736
11828
|
const actionResponse = await _runWithMiddlewareData(middlewareData || {}, () =>
|
|
11737
11829
|
_runWithMiddlewareContext(middlewareContext || {}, () =>
|
|
@@ -12161,11 +12253,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12161
12253
|
// outer request handler exactly like sync render errors.
|
|
12162
12254
|
if (typeof PageComponent === "function" && PageComponent.constructor.name === "AsyncFunction") {
|
|
12163
12255
|
const result = await PageComponent(pageProps);
|
|
12164
|
-
|
|
12165
|
-
|
|
12166
|
-
|
|
12167
|
-
|
|
12168
|
-
|
|
12256
|
+
// Anything else (text, a number, null) renders as the renderer renders a child,
|
|
12257
|
+
// as in development.
|
|
12258
|
+
pageElement = React.isValidElement(result)
|
|
12259
|
+
? result
|
|
12260
|
+
: React.createElement(React.Fragment, null, result);
|
|
12169
12261
|
} else {
|
|
12170
12262
|
// Sync component - create element directly
|
|
12171
12263
|
pageElement = React.createElement(PageComponent, pageProps);
|
|
@@ -12890,7 +12982,7 @@ ${servesDefaultMCP ? `
|
|
|
12890
12982
|
)` : "await renderErrorElement()"};
|
|
12891
12983
|
const errorDocument = applyFarmThemeDocument(
|
|
12892
12984
|
applyFarmI18nDocument(
|
|
12893
|
-
createFarmErrorDocument(errorHtml, "Application Error"),
|
|
12985
|
+
createFarmErrorDocument(errorHtml, "Application Error", routePathname),
|
|
12894
12986
|
pathname,
|
|
12895
12987
|
getFarmI18nSnapshot(),
|
|
12896
12988
|
request
|
|
@@ -12931,7 +13023,8 @@ ${servesDefaultMCP ? `
|
|
|
12931
13023
|
applyFarmI18nDocument(
|
|
12932
13024
|
createFarmErrorDocument(
|
|
12933
13025
|
fallbackHtml,
|
|
12934
|
-
errorStatus + " - " + errorStatusText
|
|
13026
|
+
errorStatus + " - " + errorStatusText,
|
|
13027
|
+
routePathname
|
|
12935
13028
|
),
|
|
12936
13029
|
pathname,
|
|
12937
13030
|
getFarmI18nSnapshot(),
|
|
@@ -13054,7 +13147,7 @@ ${farmRendererDisabled ? `
|
|
|
13054
13147
|
.replace(/<\\/head>/i, () => renderFarmRendererHydrationScript() + '\\n</head>')
|
|
13055
13148
|
.replace(
|
|
13056
13149
|
/<\\/body>/i,
|
|
13057
|
-
() => ' ' + renderFarmClientBootstrapScript(undefined, undefined, undefined, routePathname) + '\\n' +
|
|
13150
|
+
() => ' ' + renderFarmClientBootstrapScript(undefined, undefined, undefined, routePathname, true) + '\\n' +
|
|
13058
13151
|
' ' + renderFarmClientEntryScript() + '\\n</body>',
|
|
13059
13152
|
);
|
|
13060
13153
|
fullHtml = ensureFarmDocumentMeta(fullHtml, notFoundMetadata.viewport);
|
|
@@ -13074,7 +13167,7 @@ ${farmRendererDisabled ? `
|
|
|
13074
13167
|
</head>
|
|
13075
13168
|
<body>
|
|
13076
13169
|
<div id="root">\${html}</div>
|
|
13077
|
-
\${renderFarmClientBootstrapScript(undefined, undefined, undefined, routePathname)}
|
|
13170
|
+
\${renderFarmClientBootstrapScript(undefined, undefined, undefined, routePathname, true)}
|
|
13078
13171
|
\${renderFarmClientEntryScript()}
|
|
13079
13172
|
</body>
|
|
13080
13173
|
</html>\`;
|
|
@@ -13541,8 +13634,8 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
13541
13634
|
const isVercel = preset === "vercel";
|
|
13542
13635
|
const isCloudflareWorker = preset === "cloudflare-module";
|
|
13543
13636
|
const outputDir = resolveDeployOutputPath(root, config.deploy.outputDir);
|
|
13544
|
-
const runtimeServerOutputDir = isVercel ?
|
|
13545
|
-
const ssrOutputDir =
|
|
13637
|
+
const runtimeServerOutputDir = isVercel ? path17.join(outputDir, "functions", "__nitro.func") : path17.join(outputDir, "server");
|
|
13638
|
+
const ssrOutputDir = path17.join(root, distDir, "ssr");
|
|
13546
13639
|
const imageRuntime = resolveFarmImageServerRuntime(config.images, preset);
|
|
13547
13640
|
const hasGeneratedMetadataImages = Array.from(routeManager.getMetadataImages().values()).some(
|
|
13548
13641
|
(image) => image.sourceType === "module"
|
|
@@ -13675,9 +13768,9 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
13675
13768
|
resolveHashedClientCssHref(clientOutputDir),
|
|
13676
13769
|
resolveHashedClientJsSrc(clientOutputDir),
|
|
13677
13770
|
resolveClientBootSrc(clientOutputDir),
|
|
13678
|
-
readFarmDocsModulePreloads(
|
|
13679
|
-
readFarmClientModulePreloads(
|
|
13680
|
-
readFarmClientRouteTable(
|
|
13771
|
+
readFarmDocsModulePreloads(path17.join(root, distDir)),
|
|
13772
|
+
readFarmClientModulePreloads(path17.join(root, distDir)),
|
|
13773
|
+
readFarmClientRouteTable(path17.join(root, distDir))
|
|
13681
13774
|
]);
|
|
13682
13775
|
let nativeStylesheets;
|
|
13683
13776
|
const encodedDocsModulePreloads = encodeFarmDocsModulePreloads(docsModulePreloads);
|
|
@@ -13685,7 +13778,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
13685
13778
|
const encodedClientRouteTable = encodeFarmBuildJSONPlaceholder(clientRouteTable);
|
|
13686
13779
|
const encodedMobileShellClient = shouldBuildFarmMobileClient(config) ? encodeFarmMobileShellClient(
|
|
13687
13780
|
await finalizeFarmMobileClient({
|
|
13688
|
-
buildDir:
|
|
13781
|
+
buildDir: path17.join(root, distDir),
|
|
13689
13782
|
clientOutputDir,
|
|
13690
13783
|
webEntry: clientJsSrc,
|
|
13691
13784
|
webBoot: clientBootSrc,
|
|
@@ -13727,12 +13820,12 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
13727
13820
|
await fs5.mkdir(ssrOutputDir, { recursive: true });
|
|
13728
13821
|
await Promise.all(
|
|
13729
13822
|
Object.entries(ssrBundle).map(async ([fileName, output]) => {
|
|
13730
|
-
const filePath =
|
|
13731
|
-
await fs5.mkdir(
|
|
13823
|
+
const filePath = path17.join(ssrOutputDir, fileName);
|
|
13824
|
+
await fs5.mkdir(path17.dirname(filePath), { recursive: true });
|
|
13732
13825
|
await fs5.writeFile(filePath, output.type === "chunk" ? output.code : output.source);
|
|
13733
13826
|
})
|
|
13734
13827
|
);
|
|
13735
|
-
const nitroEntryPath =
|
|
13828
|
+
const nitroEntryPath = path17.join(ssrOutputDir, "nitro-entry.mjs");
|
|
13736
13829
|
const nodeAdapterModule = preset === "node-server" ? resolveNitroRuntimeDependency(root, "srvx/node") : null;
|
|
13737
13830
|
const hasNitroCacheRouteRules = hasFarmNitroCacheRouteRule(config.routeRules);
|
|
13738
13831
|
const nitroEntryCode = `
|
|
@@ -13950,20 +14043,20 @@ function toFarmNodeResponse(request, response) {
|
|
|
13950
14043
|
);
|
|
13951
14044
|
}
|
|
13952
14045
|
await fs5.writeFile(
|
|
13953
|
-
|
|
14046
|
+
path17.join(ssrOutputDir, FARM_DESKTOP_ENV_MODULE_FILE),
|
|
13954
14047
|
FARM_DESKTOP_ENV_MODULE_SOURCE
|
|
13955
14048
|
);
|
|
13956
14049
|
}
|
|
13957
|
-
const farmNodeServerEntryPath = preset === "node-server" ?
|
|
14050
|
+
const farmNodeServerEntryPath = preset === "node-server" ? path17.join(ssrOutputDir, "farm-node-server-entry.mjs") : null;
|
|
13958
14051
|
if (farmNodeServerEntryPath && nodeAdapterModule) {
|
|
13959
14052
|
await fs5.writeFile(
|
|
13960
|
-
|
|
14053
|
+
path17.join(ssrOutputDir, FARM_NODE_ENV_MODULE_FILE),
|
|
13961
14054
|
FARM_NODE_ENV_MODULE_SOURCE
|
|
13962
14055
|
);
|
|
13963
14056
|
await fs5.writeFile(
|
|
13964
14057
|
farmNodeServerEntryPath,
|
|
13965
14058
|
createFarmNodeServerEntry({
|
|
13966
|
-
nitroEntryFile:
|
|
14059
|
+
nitroEntryFile: path17.basename(nitroEntryPath),
|
|
13967
14060
|
nodeAdapterModule,
|
|
13968
14061
|
server: config.server,
|
|
13969
14062
|
websocketAdapterModule: resolveNitroRuntimeDependency(root, "crossws/adapters/node"),
|
|
@@ -13971,12 +14064,12 @@ function toFarmNodeResponse(request, response) {
|
|
|
13971
14064
|
})
|
|
13972
14065
|
);
|
|
13973
14066
|
}
|
|
13974
|
-
const farmBunServerEntryPath = preset === "bun" ?
|
|
14067
|
+
const farmBunServerEntryPath = preset === "bun" ? path17.join(ssrOutputDir, "farm-bun-server-entry.mjs") : null;
|
|
13975
14068
|
if (farmBunServerEntryPath) {
|
|
13976
14069
|
await fs5.writeFile(
|
|
13977
14070
|
farmBunServerEntryPath,
|
|
13978
14071
|
createFarmBunServerEntry({
|
|
13979
|
-
nitroEntryFile:
|
|
14072
|
+
nitroEntryFile: path17.basename(nitroEntryPath),
|
|
13980
14073
|
bunAdapterModule: resolveNitroRuntimeDependency(root, "srvx/bun"),
|
|
13981
14074
|
server: config.server,
|
|
13982
14075
|
websocketAdapterModule: resolveNitroRuntimeDependency(root, "crossws/adapters/bun"),
|
|
@@ -13984,7 +14077,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
13984
14077
|
})
|
|
13985
14078
|
);
|
|
13986
14079
|
}
|
|
13987
|
-
const farmNetlifyEntryPath = preset === "netlify" ?
|
|
14080
|
+
const farmNetlifyEntryPath = preset === "netlify" ? path17.join(ssrOutputDir, "farm-netlify-entry.mjs") : null;
|
|
13988
14081
|
if (farmNetlifyEntryPath) {
|
|
13989
14082
|
await fs5.writeFile(
|
|
13990
14083
|
farmNetlifyEntryPath,
|
|
@@ -13993,7 +14086,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
13993
14086
|
})
|
|
13994
14087
|
);
|
|
13995
14088
|
}
|
|
13996
|
-
const farmCloudflareEnvPath = preset === "cloudflare-pages" ?
|
|
14089
|
+
const farmCloudflareEnvPath = preset === "cloudflare-pages" ? path17.join(ssrOutputDir, "farm-cloudflare-env.mjs") : null;
|
|
13997
14090
|
if (farmCloudflareEnvPath) {
|
|
13998
14091
|
await fs5.writeFile(
|
|
13999
14092
|
farmCloudflareEnvPath,
|
|
@@ -14041,6 +14134,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14041
14134
|
];
|
|
14042
14135
|
})
|
|
14043
14136
|
);
|
|
14137
|
+
if (preset === "node-server") await writeFarmClientBrotliAssets(clientOutputDir);
|
|
14044
14138
|
const immutableAssets = isVercel ? { publicAssets: [], routeRules: {} } : planFarmImmutableAssets({
|
|
14045
14139
|
clientOutputDir,
|
|
14046
14140
|
files: await listFarmClientOutputFiles(clientOutputDir),
|
|
@@ -14067,18 +14161,20 @@ function toFarmNodeResponse(request, response) {
|
|
|
14067
14161
|
// `src` directory), as Nitro handlers outside Farm's aliases.
|
|
14068
14162
|
serverDir: false,
|
|
14069
14163
|
serverEntry: false,
|
|
14070
|
-
buildDir:
|
|
14164
|
+
buildDir: path17.join(root, distDir, ".nitro"),
|
|
14071
14165
|
alias: resolveNitroInternalRuntimeAliases(root),
|
|
14072
14166
|
compatibilityDate: "2024-12-01",
|
|
14073
14167
|
output: resolveFarmNitroOutputConfig(preset, outputDir),
|
|
14074
14168
|
// Nitro gives the root directory no Cache-Control on any preset (it falls through to the
|
|
14075
14169
|
// app), so public files keep revalidating; the hashed directories carry their own maxAge.
|
|
14076
14170
|
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
|
-
|
|
14171
|
+
// A self-hosted Node or Bun server sends static files itself, so precompress
|
|
14172
|
+
// them with gzip and let Nitro serve that by Accept-Encoding. Brotli at Nitro's
|
|
14173
|
+
// fixed top quality on every file cost a docs app ~20 s of build CPU, so only
|
|
14174
|
+
// client scripts and stylesheets get a brotli copy, on node-server
|
|
14175
|
+
// (writeFarmClientBrotliAssets). Serverless and edge targets sit behind a CDN
|
|
14176
|
+
// that compresses.
|
|
14177
|
+
...preset === "node-server" || preset === "bun" ? { compressPublicAssets: { gzip: true } } : {},
|
|
14082
14178
|
// Nitro gzips every server output file at level 9, node_modules included, to
|
|
14083
14179
|
// print sizes after the build. A self-hosted server is never shipped compressed,
|
|
14084
14180
|
// so list plain sizes; zipped serverless and edge bundles keep the gzip column.
|
|
@@ -14161,7 +14257,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14161
14257
|
if (pluginManager) {
|
|
14162
14258
|
nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
|
|
14163
14259
|
}
|
|
14164
|
-
const expectedServerDir =
|
|
14260
|
+
const expectedServerDir = path17.join(outputDir, "server");
|
|
14165
14261
|
const customRollupKeys = Object.keys(nitroConfig.rollupConfig || {}).filter(
|
|
14166
14262
|
(key) => key !== "external" && key !== "plugins"
|
|
14167
14263
|
);
|
|
@@ -14176,10 +14272,10 @@ function toFarmNodeResponse(request, response) {
|
|
|
14176
14272
|
const requestedBuilder = nitroConfig.builder ?? process.env.NITRO_BUILDER;
|
|
14177
14273
|
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
14274
|
nitroConfig.handlers?.some(
|
|
14179
|
-
(handler) =>
|
|
14275
|
+
(handler) => path17.resolve(handler?.handler || "") === nitroEntryPath
|
|
14180
14276
|
)
|
|
14181
14277
|
);
|
|
14182
|
-
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && nitroBuildIsFarms &&
|
|
14278
|
+
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && nitroBuildIsFarms && path17.resolve(nitroConfig.output?.serverDir || "") === path17.resolve(expectedServerDir);
|
|
14183
14279
|
const prerenderReusesPrebuiltSSR = prerenderRoutes.length > 0 && ssrExternalsArePackaged && nitroBuildIsFarms;
|
|
14184
14280
|
const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
|
|
14185
14281
|
if (selectRolldownBuilder) nitroConfig.builder = "rolldown";
|
|
@@ -14308,8 +14404,8 @@ function toFarmNodeResponse(request, response) {
|
|
|
14308
14404
|
};
|
|
14309
14405
|
prerendererConfig.output = {
|
|
14310
14406
|
...prerendererConfig.output,
|
|
14311
|
-
serverDir:
|
|
14312
|
-
prerendererConfig.buildDir ??
|
|
14407
|
+
serverDir: path17.join(
|
|
14408
|
+
prerendererConfig.buildDir ?? path17.join(root, distDir, ".nitro"),
|
|
14313
14409
|
"prerender"
|
|
14314
14410
|
)
|
|
14315
14411
|
};
|
|
@@ -14328,7 +14424,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14328
14424
|
const prerenderServerDir = prerenderer.options.output.serverDir;
|
|
14329
14425
|
await copyPrebuiltSSRBundle(
|
|
14330
14426
|
ssrBundle,
|
|
14331
|
-
|
|
14427
|
+
path17.join(prerenderServerDir, FARM_SSR_OUTPUT_DIR),
|
|
14332
14428
|
null,
|
|
14333
14429
|
fs5
|
|
14334
14430
|
);
|
|
@@ -14404,7 +14500,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14404
14500
|
const copyResults = await Promise.allSettled([
|
|
14405
14501
|
prebuiltSSRFilesResult.value ? writeSSRBundleFiles(
|
|
14406
14502
|
prebuiltSSRFilesResult.value,
|
|
14407
|
-
|
|
14503
|
+
path17.join(outputDir, "server", FARM_SSR_OUTPUT_DIR),
|
|
14408
14504
|
fs5
|
|
14409
14505
|
) : Promise.resolve(),
|
|
14410
14506
|
runtimeCopyPromise
|
|
@@ -14414,14 +14510,14 @@ function toFarmNodeResponse(request, response) {
|
|
|
14414
14510
|
);
|
|
14415
14511
|
if (failedCopy) throw failedCopy.reason;
|
|
14416
14512
|
if (canReusePrebuiltSSR) {
|
|
14417
|
-
await registerPrebuiltSSRPackageImport(
|
|
14513
|
+
await registerPrebuiltSSRPackageImport(path17.join(outputDir, "server"), ssrEntryFile, fs5);
|
|
14418
14514
|
logger.info("\u26A1 Reused Farm's prebuilt SSR bundle for the Node output");
|
|
14419
14515
|
}
|
|
14420
14516
|
if (useRolldownBuilder) {
|
|
14421
14517
|
logger.info("\u26A1 Built the Node adapter with Rolldown");
|
|
14422
14518
|
}
|
|
14423
14519
|
if (preset === "node-server" && !desktopServerEntry) {
|
|
14424
|
-
await installFarmCompileCacheLauncher(
|
|
14520
|
+
await installFarmCompileCacheLauncher(path17.join(outputDir, "server"), fs5);
|
|
14425
14521
|
}
|
|
14426
14522
|
if (preset.startsWith("cloudflare")) {
|
|
14427
14523
|
await populateCloudflareProcessEnv(nitroInstance.options.output.serverDir, fs5);
|
|
@@ -14444,7 +14540,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14444
14540
|
routeRuntimeManifest,
|
|
14445
14541
|
farmCron.provider === "host" ? farmCron.jobs : [],
|
|
14446
14542
|
{
|
|
14447
|
-
buildDir:
|
|
14543
|
+
buildDir: path17.join(root, distDir),
|
|
14448
14544
|
middlewareRoutes: edgeMiddlewareRoutes,
|
|
14449
14545
|
guardedPages: edgeGuardedPrerenderRoutes
|
|
14450
14546
|
},
|
|
@@ -14458,16 +14554,16 @@ function resolveFarmNitroOutputConfig(preset, outputDir) {
|
|
|
14458
14554
|
return {
|
|
14459
14555
|
dir: outputDir,
|
|
14460
14556
|
...preset === "node-server" ? {
|
|
14461
|
-
serverDir:
|
|
14462
|
-
publicDir:
|
|
14557
|
+
serverDir: path17.join(outputDir, "server"),
|
|
14558
|
+
publicDir: path17.join(outputDir, "public")
|
|
14463
14559
|
} : isVercel ? {
|
|
14464
|
-
serverDir:
|
|
14465
|
-
publicDir:
|
|
14560
|
+
serverDir: path17.join(outputDir, "functions", "__nitro.func"),
|
|
14561
|
+
publicDir: path17.join(outputDir, "static")
|
|
14466
14562
|
} : {}
|
|
14467
14563
|
};
|
|
14468
14564
|
}
|
|
14469
14565
|
async function populateCloudflareProcessEnv(serverDir, fs5) {
|
|
14470
|
-
const wranglerPath =
|
|
14566
|
+
const wranglerPath = path17.join(serverDir, "wrangler.json");
|
|
14471
14567
|
let source;
|
|
14472
14568
|
try {
|
|
14473
14569
|
source = await fs5.readFile(wranglerPath, "utf8");
|
|
@@ -14495,8 +14591,8 @@ async function writeSSRBundleFiles(files, targetDir, fs5) {
|
|
|
14495
14591
|
await fs5.rm(targetDir, { recursive: true, force: true });
|
|
14496
14592
|
await Promise.all(
|
|
14497
14593
|
files.map(async ({ fileName, contents }) => {
|
|
14498
|
-
const targetPath =
|
|
14499
|
-
await fs5.mkdir(
|
|
14594
|
+
const targetPath = path17.join(targetDir, fileName);
|
|
14595
|
+
await fs5.mkdir(path17.dirname(targetPath), { recursive: true });
|
|
14500
14596
|
await fs5.writeFile(targetPath, contents);
|
|
14501
14597
|
})
|
|
14502
14598
|
);
|
|
@@ -14505,8 +14601,8 @@ async function copyPrebuiltSSRBundle(ssrBundle, targetDir, minifyOptions, fs5) {
|
|
|
14505
14601
|
await writeSSRBundleFiles(await prepareSSRBundleFiles(ssrBundle, minifyOptions), targetDir, fs5);
|
|
14506
14602
|
}
|
|
14507
14603
|
async function installFarmCompileCacheLauncher(serverDir, fs5) {
|
|
14508
|
-
const entryPath =
|
|
14509
|
-
const serverPath =
|
|
14604
|
+
const entryPath = path17.join(serverDir, "index.mjs");
|
|
14605
|
+
const serverPath = path17.join(serverDir, FARM_SERVER_MODULE_FILE);
|
|
14510
14606
|
const entry = await fs5.readFile(entryPath, "utf8").catch((error) => {
|
|
14511
14607
|
if (error.code === "ENOENT") return null;
|
|
14512
14608
|
throw error;
|
|
@@ -14515,11 +14611,11 @@ async function installFarmCompileCacheLauncher(serverDir, fs5) {
|
|
|
14515
14611
|
if (entry.includes(`./${FARM_SERVER_MODULE_FILE}`)) return false;
|
|
14516
14612
|
await fs5.rename(entryPath, serverPath);
|
|
14517
14613
|
await fs5.writeFile(entryPath, createFarmCompileCacheLauncher(FARM_SERVER_MODULE_FILE));
|
|
14518
|
-
await fs5.rm(
|
|
14614
|
+
await fs5.rm(path17.join(serverDir, FARM_COMPILE_CACHE_DIR), { recursive: true, force: true });
|
|
14519
14615
|
return true;
|
|
14520
14616
|
}
|
|
14521
14617
|
async function registerPrebuiltSSRPackageImport(serverDir, ssrEntryFile, fs5) {
|
|
14522
|
-
const packagePath =
|
|
14618
|
+
const packagePath = path17.join(serverDir, "package.json");
|
|
14523
14619
|
const packageJSON = await fs5.readFile(packagePath, "utf8").then((contents) => JSON.parse(contents)).catch((error) => {
|
|
14524
14620
|
if (error.code === "ENOENT") return { type: "module" };
|
|
14525
14621
|
throw error;
|
|
@@ -14549,18 +14645,18 @@ async function moveVercelOutputPath(src, dest, fs5) {
|
|
|
14549
14645
|
await fs5.rm(src, { recursive: true, force: true });
|
|
14550
14646
|
}
|
|
14551
14647
|
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 =
|
|
14648
|
+
const serverDir = path17.join(outputDir, "server");
|
|
14649
|
+
const functionsDir = path17.join(outputDir, "functions");
|
|
14650
|
+
const nitroFuncDir = path17.join(functionsDir, "__nitro.func");
|
|
14651
|
+
const staticDir = path17.join(outputDir, "static");
|
|
14652
|
+
const publicDir = path17.join(outputDir, "public");
|
|
14557
14653
|
await fs5.mkdir(nitroFuncDir, { recursive: true });
|
|
14558
14654
|
const serverContents = await fs5.readdir(serverDir).catch((error) => {
|
|
14559
14655
|
if (error.code === "ENOENT") return [];
|
|
14560
14656
|
throw error;
|
|
14561
14657
|
});
|
|
14562
14658
|
for (const file of serverContents) {
|
|
14563
|
-
await moveVercelOutputPath(
|
|
14659
|
+
await moveVercelOutputPath(path17.join(serverDir, file), path17.join(nitroFuncDir, file), fs5);
|
|
14564
14660
|
}
|
|
14565
14661
|
if (serverContents.length > 0) await fs5.rm(serverDir, { recursive: true, force: true });
|
|
14566
14662
|
try {
|
|
@@ -14570,7 +14666,7 @@ async function postProcessVercelOutput(root, outputDir, fs5, config, farmWorkflo
|
|
|
14570
14666
|
}
|
|
14571
14667
|
await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs5);
|
|
14572
14668
|
await copyPrismaClientForVercel(root, nitroFuncDir, fs5);
|
|
14573
|
-
const configPath =
|
|
14669
|
+
const configPath = path17.join(outputDir, "config.json");
|
|
14574
14670
|
const configContent = await fs5.readFile(configPath, "utf-8");
|
|
14575
14671
|
const vercelConfig = JSON.parse(configContent);
|
|
14576
14672
|
const runtimeRoutes = await createFarmVercelRouteRuntimeFunctions(
|
|
@@ -14614,7 +14710,7 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs5) {
|
|
|
14614
14710
|
mainRoot,
|
|
14615
14711
|
root,
|
|
14616
14712
|
config.srcDir,
|
|
14617
|
-
|
|
14713
|
+
path17.join(nitroFuncDir, "farm-docs-content"),
|
|
14618
14714
|
fs5
|
|
14619
14715
|
);
|
|
14620
14716
|
for (const [index, docsRoot] of extraRoots.entries()) {
|
|
@@ -14622,7 +14718,7 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs5) {
|
|
|
14622
14718
|
docsRoot,
|
|
14623
14719
|
root,
|
|
14624
14720
|
config.srcDir,
|
|
14625
|
-
|
|
14721
|
+
path17.join(nitroFuncDir, "farm-docs-roots", String(index)),
|
|
14626
14722
|
fs5
|
|
14627
14723
|
);
|
|
14628
14724
|
}
|
|
@@ -14640,18 +14736,18 @@ async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs
|
|
|
14640
14736
|
);
|
|
14641
14737
|
}
|
|
14642
14738
|
await fs5.rm(bundledContentDir, { recursive: true, force: true });
|
|
14643
|
-
await fs5.mkdir(
|
|
14739
|
+
await fs5.mkdir(path17.dirname(bundledContentDir), { recursive: true });
|
|
14644
14740
|
await fs5.cp(docsContentDir, bundledContentDir, {
|
|
14645
14741
|
recursive: true,
|
|
14646
14742
|
force: true,
|
|
14647
14743
|
dereference: true
|
|
14648
14744
|
});
|
|
14649
14745
|
await fs5.writeFile(
|
|
14650
|
-
|
|
14746
|
+
path17.join(bundledContentDir, FARM_DOCS_LAST_MODIFIED_MANIFEST),
|
|
14651
14747
|
`${JSON.stringify(lastModifiedManifest, null, 2)}
|
|
14652
14748
|
`
|
|
14653
14749
|
);
|
|
14654
|
-
logger.info(`\u{1F4DA} Bundled docs content for Vercel: ${
|
|
14750
|
+
logger.info(`\u{1F4DA} Bundled docs content for Vercel: ${path17.relative(root, docsContentDir)}`);
|
|
14655
14751
|
}
|
|
14656
14752
|
function resolveServerFunctionPlatform(preset) {
|
|
14657
14753
|
return preset === "vercel" || preset === "netlify" ? { os: "linux", cpu: "x64", libc: "glibc" } : null;
|
|
@@ -14668,7 +14764,7 @@ function platformFieldAllows(field, value) {
|
|
|
14668
14764
|
}
|
|
14669
14765
|
async function stageSharpRuntime(config, root, distDir, fs5, preset) {
|
|
14670
14766
|
const functionPlatform = resolveServerFunctionPlatform(preset);
|
|
14671
|
-
const projectRequire = createRequire2(
|
|
14767
|
+
const projectRequire = createRequire2(path17.join(root, "package.json"));
|
|
14672
14768
|
let sharpRequire = projectRequire;
|
|
14673
14769
|
if (!resolvePackageJson(projectRequire, "sharp")) {
|
|
14674
14770
|
try {
|
|
@@ -14678,10 +14774,10 @@ async function stageSharpRuntime(config, root, distDir, fs5, preset) {
|
|
|
14678
14774
|
}
|
|
14679
14775
|
const copiedPackages = /* @__PURE__ */ new Map();
|
|
14680
14776
|
const packageCopies = /* @__PURE__ */ new Map();
|
|
14681
|
-
const stageRoot =
|
|
14777
|
+
const stageRoot = path17.join(root, distDir, "tmp");
|
|
14682
14778
|
await fs5.mkdir(stageRoot, { recursive: true });
|
|
14683
|
-
const stageDir = await fs5.mkdtemp(
|
|
14684
|
-
const targetNodeModules =
|
|
14779
|
+
const stageDir = await fs5.mkdtemp(path17.join(stageRoot, "sharp-runtime-"));
|
|
14780
|
+
const targetNodeModules = path17.join(stageDir, "node_modules");
|
|
14685
14781
|
function copyPackage(packageName, parentRequire) {
|
|
14686
14782
|
const activeCopy = packageCopies.get(packageName);
|
|
14687
14783
|
if (activeCopy) return activeCopy;
|
|
@@ -14694,10 +14790,10 @@ async function stageSharpRuntime(config, root, distDir, fs5, preset) {
|
|
|
14694
14790
|
if (!packageJsonPath) return;
|
|
14695
14791
|
const packageJson = JSON.parse(await fs5.readFile(packageJsonPath, "utf8"));
|
|
14696
14792
|
if (functionPlatform && !packageSupportsPlatform(packageJson, functionPlatform)) return;
|
|
14697
|
-
const packageDir =
|
|
14698
|
-
const targetDir =
|
|
14793
|
+
const packageDir = path17.dirname(packageJsonPath);
|
|
14794
|
+
const targetDir = path17.join(targetNodeModules, ...packageName.split("/"));
|
|
14699
14795
|
copiedPackages.set(packageName, String(packageJson.version || "*"));
|
|
14700
|
-
await fs5.mkdir(
|
|
14796
|
+
await fs5.mkdir(path17.dirname(targetDir), { recursive: true });
|
|
14701
14797
|
const packageRequire = createRequire2(packageJsonPath);
|
|
14702
14798
|
const dependencies = {
|
|
14703
14799
|
...packageJson.dependencies,
|
|
@@ -14732,8 +14828,8 @@ async function stageSharpRuntime(config, root, distDir, fs5, preset) {
|
|
|
14732
14828
|
};
|
|
14733
14829
|
}
|
|
14734
14830
|
async function installStagedSharpRuntime(staged, nitroFuncDir, fs5) {
|
|
14735
|
-
const stagedNodeModules =
|
|
14736
|
-
const targetNodeModules =
|
|
14831
|
+
const stagedNodeModules = path17.join(staged.stageDir, "node_modules");
|
|
14832
|
+
const targetNodeModules = path17.join(nitroFuncDir, "node_modules");
|
|
14737
14833
|
try {
|
|
14738
14834
|
await mergeStagedDirectory(stagedNodeModules, targetNodeModules, fs5);
|
|
14739
14835
|
const functionPackage = await readNitroOutputPackage(nitroFuncDir, fs5);
|
|
@@ -14761,8 +14857,8 @@ async function mergeStagedDirectory(sourceDir, targetDir, fs5) {
|
|
|
14761
14857
|
const entries = await fs5.readdir(sourceDir, { withFileTypes: true });
|
|
14762
14858
|
await settleAllOrThrow(
|
|
14763
14859
|
entries.map(async (entry) => {
|
|
14764
|
-
const sourcePath =
|
|
14765
|
-
const targetPath =
|
|
14860
|
+
const sourcePath = path17.join(sourceDir, entry.name);
|
|
14861
|
+
const targetPath = path17.join(targetDir, entry.name);
|
|
14766
14862
|
try {
|
|
14767
14863
|
await fs5.rename(sourcePath, targetPath);
|
|
14768
14864
|
return;
|
|
@@ -14789,13 +14885,13 @@ async function mergeStagedDirectory(sourceDir, targetDir, fs5) {
|
|
|
14789
14885
|
function assertMetadataImageRuntimeInstalled(root, metadataImageRoutes) {
|
|
14790
14886
|
const generated = metadataImageRoutes.find((image) => image.sourceType === "module");
|
|
14791
14887
|
if (!generated || resolveMetadataImageRuntimePackageJson(root)) return;
|
|
14792
|
-
const file = generated.modulePath ? toPosixPath(
|
|
14888
|
+
const file = generated.modulePath ? toPosixPath(path17.relative(root, generated.modulePath)) : "";
|
|
14793
14889
|
throw new Error(
|
|
14794
14890
|
`${file || "A generated metadata image"} renders with @vercel/og, which is not installed. ${VERCEL_OG_INSTALL_HINT}`
|
|
14795
14891
|
);
|
|
14796
14892
|
}
|
|
14797
14893
|
function resolveMetadataImageRuntimePackageJson(root) {
|
|
14798
|
-
const projectRequire = createRequire2(
|
|
14894
|
+
const projectRequire = createRequire2(path17.join(root, "package.json"));
|
|
14799
14895
|
const packageJsonPath = resolvePackageJson(projectRequire, "@vercel/og");
|
|
14800
14896
|
if (packageJsonPath) return packageJsonPath;
|
|
14801
14897
|
try {
|
|
@@ -14808,9 +14904,9 @@ async function copyMetadataImageRuntime(root, nitroFuncDir, fs5) {
|
|
|
14808
14904
|
const packageJsonPath = resolveMetadataImageRuntimePackageJson(root);
|
|
14809
14905
|
if (!packageJsonPath) return;
|
|
14810
14906
|
const packageJson = JSON.parse(await fs5.readFile(packageJsonPath, "utf8"));
|
|
14811
|
-
const packageDir =
|
|
14812
|
-
const targetDir =
|
|
14813
|
-
await fs5.mkdir(
|
|
14907
|
+
const packageDir = path17.dirname(packageJsonPath);
|
|
14908
|
+
const targetDir = path17.join(nitroFuncDir, "node_modules", "@vercel", "og");
|
|
14909
|
+
await fs5.mkdir(path17.dirname(targetDir), { recursive: true });
|
|
14814
14910
|
await fs5.cp(packageDir, targetDir, {
|
|
14815
14911
|
recursive: true,
|
|
14816
14912
|
force: true,
|
|
@@ -14826,7 +14922,7 @@ async function copyMetadataImageRuntime(root, nitroFuncDir, fs5) {
|
|
|
14826
14922
|
logger.info("\u{1F5BC}\uFE0F Bundled generated metadata image runtime");
|
|
14827
14923
|
}
|
|
14828
14924
|
async function readNitroOutputPackage(outputDir, fs5) {
|
|
14829
|
-
const packagePath =
|
|
14925
|
+
const packagePath = path17.join(outputDir, "package.json");
|
|
14830
14926
|
return fs5.readFile(packagePath, "utf8").then((contents) => JSON.parse(contents)).catch((error) => {
|
|
14831
14927
|
if (error.code === "ENOENT") return {};
|
|
14832
14928
|
throw error;
|
|
@@ -14835,7 +14931,7 @@ async function readNitroOutputPackage(outputDir, fs5) {
|
|
|
14835
14931
|
async function writeNitroOutputPackage(outputDir, packageJson, fs5) {
|
|
14836
14932
|
await fs5.mkdir(outputDir, { recursive: true });
|
|
14837
14933
|
await fs5.writeFile(
|
|
14838
|
-
|
|
14934
|
+
path17.join(outputDir, "package.json"),
|
|
14839
14935
|
`${JSON.stringify(packageJson, null, 2)}
|
|
14840
14936
|
`
|
|
14841
14937
|
);
|
|
@@ -14851,9 +14947,9 @@ function resolvePackageJson(parentRequire, packageName) {
|
|
|
14851
14947
|
}
|
|
14852
14948
|
}
|
|
14853
14949
|
try {
|
|
14854
|
-
let directory =
|
|
14855
|
-
while (directory !==
|
|
14856
|
-
const candidate =
|
|
14950
|
+
let directory = path17.dirname(metadataModule ?? parentRequire.resolve(packageName));
|
|
14951
|
+
while (directory !== path17.dirname(directory)) {
|
|
14952
|
+
const candidate = path17.join(directory, "package.json");
|
|
14857
14953
|
if (existsSync3(candidate)) {
|
|
14858
14954
|
try {
|
|
14859
14955
|
const manifest = JSON.parse(readFileSync2(candidate, "utf8"));
|
|
@@ -14861,23 +14957,23 @@ function resolvePackageJson(parentRequire, packageName) {
|
|
|
14861
14957
|
} catch {
|
|
14862
14958
|
}
|
|
14863
14959
|
}
|
|
14864
|
-
if (
|
|
14865
|
-
directory =
|
|
14960
|
+
if (path17.basename(directory) === "node_modules") break;
|
|
14961
|
+
directory = path17.dirname(directory);
|
|
14866
14962
|
}
|
|
14867
14963
|
} catch {
|
|
14868
14964
|
}
|
|
14869
14965
|
return null;
|
|
14870
14966
|
}
|
|
14871
14967
|
async function resolveProjectInstalledPackageDir(root, packageName, fs5) {
|
|
14872
|
-
let directory =
|
|
14968
|
+
let directory = path17.resolve(root);
|
|
14873
14969
|
while (true) {
|
|
14874
|
-
const candidate =
|
|
14970
|
+
const candidate = path17.join(directory, "node_modules", ...packageName.split("/"));
|
|
14875
14971
|
try {
|
|
14876
14972
|
const packageDir = await fs5.realpath(candidate);
|
|
14877
|
-
if ((await fs5.stat(
|
|
14973
|
+
if ((await fs5.stat(path17.join(packageDir, "package.json"))).isFile()) return packageDir;
|
|
14878
14974
|
} catch {
|
|
14879
14975
|
}
|
|
14880
|
-
const parent =
|
|
14976
|
+
const parent = path17.dirname(directory);
|
|
14881
14977
|
if (parent === directory) return null;
|
|
14882
14978
|
directory = parent;
|
|
14883
14979
|
}
|
|
@@ -14886,28 +14982,28 @@ var PRISMA_RUNTIME_GENERATE_ONLY_FILE = /^query_(?:engine|compiler)_bg\.|\.map$|
|
|
|
14886
14982
|
async function copyPrismaClientForVercel(root, nitroFuncDir, fs5) {
|
|
14887
14983
|
const prismaClientDir = await resolveProjectInstalledPackageDir(root, "@prisma/client", fs5);
|
|
14888
14984
|
if (!prismaClientDir) return;
|
|
14889
|
-
const generatedClientDir =
|
|
14985
|
+
const generatedClientDir = path17.join(prismaClientDir, "..", "..", ".prisma", "client");
|
|
14890
14986
|
try {
|
|
14891
14987
|
await fs5.access(generatedClientDir);
|
|
14892
14988
|
} catch {
|
|
14893
14989
|
return;
|
|
14894
14990
|
}
|
|
14895
|
-
const targetNodeModules =
|
|
14896
|
-
const targetPrismaScopeDir =
|
|
14897
|
-
const targetGeneratedDir =
|
|
14898
|
-
const targetClientDir =
|
|
14899
|
-
const runtimeDir =
|
|
14991
|
+
const targetNodeModules = path17.join(nitroFuncDir, "node_modules");
|
|
14992
|
+
const targetPrismaScopeDir = path17.join(targetNodeModules, "@prisma");
|
|
14993
|
+
const targetGeneratedDir = path17.join(targetNodeModules, ".prisma", "client");
|
|
14994
|
+
const targetClientDir = path17.join(targetPrismaScopeDir, "client");
|
|
14995
|
+
const runtimeDir = path17.join(prismaClientDir, "runtime");
|
|
14900
14996
|
await fs5.mkdir(targetPrismaScopeDir, { recursive: true });
|
|
14901
14997
|
await fs5.cp(prismaClientDir, targetClientDir, {
|
|
14902
14998
|
recursive: true,
|
|
14903
14999
|
force: true,
|
|
14904
|
-
filter: (source) =>
|
|
15000
|
+
filter: (source) => path17.dirname(source) !== runtimeDir || !PRISMA_RUNTIME_GENERATE_ONLY_FILE.test(path17.basename(source))
|
|
14905
15001
|
});
|
|
14906
15002
|
await fs5.cp(generatedClientDir, targetGeneratedDir, {
|
|
14907
15003
|
recursive: true,
|
|
14908
15004
|
force: true
|
|
14909
15005
|
});
|
|
14910
|
-
const clientPackagePath =
|
|
15006
|
+
const clientPackagePath = path17.join(prismaClientDir, "package.json");
|
|
14911
15007
|
const [functionPackage, clientPackageContent] = await Promise.all([
|
|
14912
15008
|
readNitroOutputPackage(nitroFuncDir, fs5),
|
|
14913
15009
|
fs5.readFile(clientPackagePath, "utf-8")
|
|
@@ -14919,9 +15015,9 @@ async function copyPrismaClientForVercel(root, nitroFuncDir, fs5) {
|
|
|
14919
15015
|
};
|
|
14920
15016
|
await writeNitroOutputPackage(nitroFuncDir, functionPackage, fs5);
|
|
14921
15017
|
}
|
|
14922
|
-
function islandsActionKeyCode() {
|
|
15018
|
+
function islandsActionKeyCode(runtimeModule) {
|
|
14923
15019
|
const key = randomBytes(32).toString("base64url");
|
|
14924
|
-
return `import { setBuildDefaults as __farmIslxBuildDefaults } from
|
|
15020
|
+
return `import { setBuildDefaults as __farmIslxBuildDefaults } from ${JSON.stringify(runtimeModule)};
|
|
14925
15021
|
__farmIslxBuildDefaults({ key: ${JSON.stringify(key)} });`;
|
|
14926
15022
|
}
|
|
14927
15023
|
|
|
@@ -15095,9 +15191,9 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
15095
15191
|
} else {
|
|
15096
15192
|
const { build: legacyViteBuild } = await import("vite");
|
|
15097
15193
|
logger.info("\u{1F4E6} Building client bundle...");
|
|
15098
|
-
await buildClient2(legacyViteBuild, config, root, srcDir,
|
|
15194
|
+
await buildClient2(legacyViteBuild, config, root, srcDir, path18.join(root, distDir, "client"));
|
|
15099
15195
|
logger.info("\u{1F4E6} Building SSR bundle...");
|
|
15100
|
-
await buildSSR(legacyViteBuild, config, root, srcDir,
|
|
15196
|
+
await buildSSR(legacyViteBuild, config, root, srcDir, path18.join(root, distDir, "server"));
|
|
15101
15197
|
logger.info(`\u{1F680} Building server with Nitro (preset: ${preset})...`);
|
|
15102
15198
|
await buildNitro(
|
|
15103
15199
|
config,
|
|
@@ -15150,7 +15246,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
15150
15246
|
}
|
|
15151
15247
|
}
|
|
15152
15248
|
async function createProjectModuleServer(createViteServer, config, root, buildLifetime) {
|
|
15153
|
-
const { farmServerOnlyEntriesPlugin } = await import("./vite.mjs");
|
|
15249
|
+
const { farmNavigationPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.mjs");
|
|
15154
15250
|
const rendererVitePlugins = await loadFarmRendererVitePlugins(config.renderer, root, {
|
|
15155
15251
|
ssr: true,
|
|
15156
15252
|
buildLifetime
|
|
@@ -15180,7 +15276,8 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
15180
15276
|
farmServerOnlyEntriesPlugin({
|
|
15181
15277
|
prebundleServerPackages: true,
|
|
15182
15278
|
distDir: config.distDir || ".farm"
|
|
15183
|
-
})
|
|
15279
|
+
}),
|
|
15280
|
+
farmNavigationPlugin(config.renderer)
|
|
15184
15281
|
],
|
|
15185
15282
|
server: {
|
|
15186
15283
|
middlewareMode: true,
|
|
@@ -15202,8 +15299,8 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
15202
15299
|
root,
|
|
15203
15300
|
// Vite keys its pre-bundled dependencies on the config, mode included, so this server and
|
|
15204
15301
|
// `farm dev` sharing one cache would each rebuild it after the other ran.
|
|
15205
|
-
cacheDir:
|
|
15206
|
-
|
|
15302
|
+
cacheDir: path18.join(
|
|
15303
|
+
path18.resolve(root, viteConfig.cacheDir ?? path18.join("node_modules", ".vite")),
|
|
15207
15304
|
"farm-build"
|
|
15208
15305
|
),
|
|
15209
15306
|
configFile: false,
|
|
@@ -15239,6 +15336,7 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
|
|
|
15239
15336
|
const {
|
|
15240
15337
|
farmI18nClientBridgePlugin,
|
|
15241
15338
|
farmIslandContainersPlugin,
|
|
15339
|
+
farmNavigationPlugin,
|
|
15242
15340
|
farmPlugin,
|
|
15243
15341
|
farmServerOnlyEntriesPlugin
|
|
15244
15342
|
} = await import("./vite.mjs");
|
|
@@ -15261,6 +15359,7 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
|
|
|
15261
15359
|
plugins: [
|
|
15262
15360
|
farmI18nClientBridgePlugin(),
|
|
15263
15361
|
farmServerOnlyEntriesPlugin({ distDir: config.distDir || ".farm" }),
|
|
15362
|
+
farmNavigationPlugin(config.renderer),
|
|
15264
15363
|
farmIslandContainersPlugin(config),
|
|
15265
15364
|
farmPlugin(config, pluginManager),
|
|
15266
15365
|
farmEnvironmentFunctionsPlugin(config)
|
|
@@ -15303,16 +15402,16 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
|
|
|
15303
15402
|
});
|
|
15304
15403
|
}
|
|
15305
15404
|
function resolveLegacyPageEntry(config, root, srcDir) {
|
|
15306
|
-
const appDir =
|
|
15405
|
+
const appDir = path18.join(root, srcDir, "app");
|
|
15307
15406
|
for (const extension of getFarmRendererComponentExtensions(config.renderer)) {
|
|
15308
|
-
const candidate =
|
|
15407
|
+
const candidate = path18.join(appDir, `page${extension}`);
|
|
15309
15408
|
if (existsSync4(candidate)) return candidate;
|
|
15310
15409
|
}
|
|
15311
|
-
return
|
|
15410
|
+
return path18.join(appDir, "page.tsx");
|
|
15312
15411
|
}
|
|
15313
15412
|
async function buildNitro(config, routeManager, apiRouteManager, serverRenderer, preset, root, distDir, pluginManager) {
|
|
15314
15413
|
const [{ createNitroConfig }, { createNitro, build: nitroBuild }] = await Promise.all([
|
|
15315
|
-
import("./nitro-
|
|
15414
|
+
import("./nitro-YLTGVGK4.mjs"),
|
|
15316
15415
|
import("nitro/builder")
|
|
15317
15416
|
]);
|
|
15318
15417
|
let nitroConfig = await createNitroConfig(
|
|
@@ -15326,18 +15425,18 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
15326
15425
|
nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
|
|
15327
15426
|
}
|
|
15328
15427
|
const outputDir = resolveDeployOutputPath(root, config.deploy.outputDir);
|
|
15329
|
-
const serverOutputDir =
|
|
15330
|
-
const publicOutputDir =
|
|
15428
|
+
const serverOutputDir = path18.join(outputDir, "server");
|
|
15429
|
+
const publicOutputDir = path18.join(outputDir, "public");
|
|
15331
15430
|
const { mkdir, cp } = await import("fs/promises");
|
|
15332
15431
|
await mkdir(serverOutputDir, { recursive: true });
|
|
15333
15432
|
await mkdir(publicOutputDir, { recursive: true });
|
|
15334
|
-
const clientDir =
|
|
15433
|
+
const clientDir = path18.join(root, distDir, "client");
|
|
15335
15434
|
try {
|
|
15336
15435
|
await mkdir(publicOutputDir, { recursive: true });
|
|
15337
15436
|
await cp(clientDir, publicOutputDir, { recursive: true });
|
|
15338
15437
|
logger.info("\u{1F4E6} Copied client assets to public directory");
|
|
15339
|
-
const manifestPath =
|
|
15340
|
-
const assetsDir =
|
|
15438
|
+
const manifestPath = path18.join(publicOutputDir, "farm-client-manifest.json");
|
|
15439
|
+
const assetsDir = path18.join(publicOutputDir, "assets");
|
|
15341
15440
|
const manifestExists = await import("fs/promises").then(
|
|
15342
15441
|
(fs5) => fs5.access(manifestPath).then(() => true).catch(() => false)
|
|
15343
15442
|
);
|
|
@@ -15353,8 +15452,8 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
15353
15452
|
logger.error(`\u274C Failed to copy client assets: ${error}`);
|
|
15354
15453
|
throw error;
|
|
15355
15454
|
}
|
|
15356
|
-
const serverDir =
|
|
15357
|
-
const nitroServerDir =
|
|
15455
|
+
const serverDir = path18.join(root, distDir, "server");
|
|
15456
|
+
const nitroServerDir = path18.join(root, distDir, ".nitro", "server", "farm");
|
|
15358
15457
|
try {
|
|
15359
15458
|
await mkdir(nitroServerDir, { recursive: true });
|
|
15360
15459
|
await cp(serverDir, nitroServerDir, { recursive: true });
|
|
@@ -15363,7 +15462,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
15363
15462
|
logger.warn(`Could not copy SSR bundles: ${error}`);
|
|
15364
15463
|
}
|
|
15365
15464
|
const nitro = await createNitro(nitroConfig);
|
|
15366
|
-
const registryPath =
|
|
15465
|
+
const registryPath = path18.join(root, distDir, ".nitro", "server", "farm-registry.ts");
|
|
15367
15466
|
try {
|
|
15368
15467
|
const { farmRegistry } = await import(
|
|
15369
15468
|
/* @vite-ignore */
|
|
@@ -15380,9 +15479,9 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
15380
15479
|
}
|
|
15381
15480
|
farmRegistry.routePaths = routePaths;
|
|
15382
15481
|
try {
|
|
15383
|
-
const clientManifestPath =
|
|
15384
|
-
const { readFile } = await import("fs/promises");
|
|
15385
|
-
const manifestContent = await
|
|
15482
|
+
const clientManifestPath = path18.join(root, distDir, "client", "farm-client-manifest.json");
|
|
15483
|
+
const { readFile: readFile2 } = await import("fs/promises");
|
|
15484
|
+
const manifestContent = await readFile2(clientManifestPath, "utf-8");
|
|
15386
15485
|
farmRegistry.clientManifest = JSON.parse(manifestContent);
|
|
15387
15486
|
} catch {
|
|
15388
15487
|
farmRegistry.clientManifest = {};
|