@farm.js/core 0.1.31 → 0.1.35
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/README.md +1 -1
- package/dist/agent-runtime.cjs +70 -15
- package/dist/agent-runtime.d.mts +4 -5
- package/dist/agent-runtime.d.ts +4 -5
- package/dist/agent-runtime.mjs +59 -4
- package/dist/api/route-manager.cjs +17 -14
- package/dist/api/route-manager.d.mts +6 -7
- package/dist/api/route-manager.d.ts +6 -7
- package/dist/api/route-manager.mjs +16 -13
- package/dist/api/runtime.cjs +12 -8
- package/dist/api/runtime.d.mts +4 -5
- package/dist/api/runtime.d.ts +4 -5
- package/dist/api/runtime.mjs +12 -8
- package/dist/api.cjs +20 -17
- package/dist/api.d.mts +7 -8
- package/dist/api.d.ts +7 -8
- package/dist/api.mjs +19 -16
- package/dist/{app-sUJ3jnTZ.d.ts → app-BXB3JZYc.d.ts} +38 -12
- package/dist/{app-DAuUTIZf.d.mts → app-D_j9AAVL.d.mts} +38 -12
- package/dist/app-markdown.cjs +8 -6
- package/dist/app-markdown.d.mts +6 -7
- package/dist/app-markdown.d.ts +6 -7
- package/dist/app-markdown.mjs +7 -5
- package/dist/cache.cjs +2 -2
- package/dist/cache.d.mts +10 -1
- package/dist/cache.d.ts +10 -1
- package/dist/cache.mjs +1 -1
- package/dist/{chunk-BXFWA23T.mjs → chunk-22LTEMGQ.mjs} +3 -3
- package/dist/{chunk-YZTASLPQ.cjs → chunk-27ZWSI3W.cjs} +2 -2
- package/dist/{chunk-WBIH66JK.mjs → chunk-2ELDTQRN.mjs} +5 -2
- package/dist/{chunk-K7CELQLK.cjs → chunk-2F2ER724.cjs} +54 -29
- package/dist/{chunk-O3DTUAX2.mjs → chunk-2G2NNLE2.mjs} +6 -77
- package/dist/{chunk-NRVGEI5I.mjs → chunk-2NNMOPDN.mjs} +4 -210
- package/dist/{chunk-CTV2TTNP.cjs → chunk-3BHT4WMP.cjs} +16 -87
- package/dist/chunk-3BU22U3M.cjs +237 -0
- package/dist/{chunk-MM5D6VLP.mjs → chunk-3KZS4SUS.mjs} +33 -14
- package/dist/{chunk-VA62MHFV.mjs → chunk-3PXS2MHU.mjs} +1 -1
- package/dist/chunk-3SDFA7UF.cjs +701 -0
- package/dist/{chunk-4IEPYMHF.mjs → chunk-3UEVPCGW.mjs} +1 -1
- package/dist/{chunk-MXDTKXO6.cjs → chunk-3UH7MRCP.cjs} +73 -26
- package/dist/{chunk-7QOCTYBS.mjs → chunk-4JHOT46A.mjs} +37 -1
- package/dist/{chunk-6L6DQR5W.mjs → chunk-4KU5Q7C2.mjs} +917 -305
- package/dist/{chunk-3FCFQP5V.cjs → chunk-4MMGO7YW.cjs} +25 -25
- package/dist/{chunk-5HGR3W6O.mjs → chunk-5SJWVY6R.mjs} +8 -0
- package/dist/{chunk-KZLND3D2.cjs → chunk-62XKI4Z3.cjs} +7 -5
- package/dist/{chunk-FJZ3DQLK.mjs → chunk-6DU6UFUE.mjs} +13 -12
- package/dist/{chunk-TEN4FIZU.mjs → chunk-6ETPZTJI.mjs} +513 -3
- package/dist/{chunk-VUMAE7NC.mjs → chunk-6TJOML4E.mjs} +92 -31
- package/dist/{chunk-3ATMYLLJ.mjs → chunk-6WCPV6G2.mjs} +1 -1
- package/dist/{chunk-FYRBX5IY.cjs → chunk-73MC7ZL6.cjs} +2 -2
- package/dist/chunk-75RZHGLS.cjs +135 -0
- package/dist/{chunk-QZRVZSPN.cjs → chunk-77GNHH2Z.cjs} +3 -3
- package/dist/{chunk-FXUUWYAX.cjs → chunk-7GLPRTTF.cjs} +12 -2
- package/dist/{chunk-A777V5WU.cjs → chunk-7L5V3KQO.cjs} +2 -2
- package/dist/{chunk-4ZQQL4IU.mjs → chunk-AHGECQEW.mjs} +1 -1
- package/dist/{chunk-RG3ZOTG5.cjs → chunk-AI7QMY7O.cjs} +10 -3
- package/dist/{chunk-YMCXWPWK.mjs → chunk-BCMSYSN2.mjs} +4 -1
- package/dist/{chunk-I6XDAKWQ.mjs → chunk-BTHHUD7Q.mjs} +14 -0
- package/dist/{chunk-LI2LMOLR.mjs → chunk-C35ZBVRD.mjs} +12 -3
- package/dist/chunk-C4SPBWFM.cjs +26 -0
- package/dist/{chunk-YQVSHTMR.mjs → chunk-CP6X4AEU.mjs} +1 -1
- package/dist/{chunk-QZCT2CQ4.mjs → chunk-CXEN47J3.mjs} +64 -2
- package/dist/{chunk-WNLBF77X.cjs → chunk-D227TIEN.cjs} +28 -16
- package/dist/{chunk-ROUTX2E5.cjs → chunk-DBNKI4NF.cjs} +12 -3
- package/dist/{chunk-J3LOGE4T.cjs → chunk-DQQOKWYA.cjs} +5 -5
- package/dist/chunk-E5GNDG5F.mjs +701 -0
- package/dist/{chunk-X7KZBF63.cjs → chunk-EFCQPQMG.cjs} +40 -4
- package/dist/{chunk-K3F2E6GS.cjs → chunk-EJQT6KZN.cjs} +2 -2
- package/dist/{chunk-3LUF2PE2.cjs → chunk-EK4QAEFZ.cjs} +67 -5
- package/dist/{chunk-VVBO3QH7.mjs → chunk-ENLZ4R3Y.mjs} +10 -1
- package/dist/{chunk-KJ2TIHZZ.cjs → chunk-EUV4YR3V.cjs} +3 -2
- package/dist/{chunk-E76XC6ZG.mjs → chunk-EZDQRNQ7.mjs} +2 -2
- package/dist/{chunk-TOVMYGYW.mjs → chunk-F2SE2VDO.mjs} +1 -1
- package/dist/{chunk-MNUGPHLN.mjs → chunk-F6Z3Y5KL.mjs} +5 -3
- package/dist/{chunk-DFLLARUK.cjs → chunk-F7JZENPF.cjs} +35 -34
- package/dist/{chunk-BSPQVJ4A.mjs → chunk-FDR64H6B.mjs} +13 -0
- package/dist/{chunk-5OVTOKGH.cjs → chunk-FFFW3OQ7.cjs} +2 -2
- package/dist/{chunk-D4JE5NNV.cjs → chunk-FNO7A7CM.cjs} +5 -5
- package/dist/{chunk-Z5HIWVDP.cjs → chunk-FTFYRMQQ.cjs} +80 -91
- package/dist/chunk-FZ6YYU2W.mjs +65 -0
- package/dist/{chunk-X7WVQMIB.mjs → chunk-G5RT7EXW.mjs} +11 -5
- package/dist/{chunk-IXUY2F5U.mjs → chunk-GCXWJJKH.mjs} +4 -7
- package/dist/{chunk-ES4B2IXW.cjs → chunk-GFHLGIYC.cjs} +8 -8
- package/dist/{chunk-SORB3MAR.cjs → chunk-GQ3Z3IZI.cjs} +17 -17
- package/dist/{chunk-75WGQVQA.cjs → chunk-HITLGIAO.cjs} +10 -1
- package/dist/{chunk-HBTUGXHS.cjs → chunk-HLJ6MBUZ.cjs} +7 -4
- package/dist/{chunk-JLCQGPXE.mjs → chunk-HMIJDL7S.mjs} +51 -62
- package/dist/{chunk-F6XEGFHO.mjs → chunk-HUMR6LSU.mjs} +11 -1
- package/dist/{chunk-IMB4PIAR.cjs → chunk-ICUQICNC.cjs} +1441 -828
- package/dist/{chunk-ZCU4NZ3M.cjs → chunk-IE7XCHH3.cjs} +4 -4
- package/dist/{chunk-I26CZYPV.cjs → chunk-IHNIDL6H.cjs} +50 -7
- package/dist/{chunk-2FQHH5SC.mjs → chunk-IHNMMXHV.mjs} +49 -24
- package/dist/{chunk-YVGAEAA5.cjs → chunk-IPXLADVO.cjs} +522 -12
- package/dist/{chunk-VHJGDMCG.cjs → chunk-IWZKTWHZ.cjs} +2 -2
- package/dist/chunk-JG6DJF5A.mjs +238 -0
- package/dist/{chunk-KROWKCUH.cjs → chunk-JGLC4TO3.cjs} +8 -1
- package/dist/{chunk-5TISYEQF.mjs → chunk-JM5XPKWH.mjs} +10 -3
- package/dist/{chunk-BJJATPEC.mjs → chunk-KN7K4VQN.mjs} +1 -1
- package/dist/{chunk-WPYFSQKK.cjs → chunk-KNBBQHO2.cjs} +15 -1
- package/dist/{chunk-XWAWFQFS.cjs → chunk-KXWRO25S.cjs} +7 -4
- package/dist/chunk-LSKZMJMP.cjs +65 -0
- package/dist/{chunk-2N5PX3LS.mjs → chunk-LYV44OIR.mjs} +7 -1
- package/dist/chunk-M7MKQXAF.cjs +87 -0
- package/dist/{chunk-IV6CQY7O.mjs → chunk-MSSFIQGM.mjs} +63 -13
- package/dist/{chunk-KH7BN726.cjs → chunk-N4UOK6ZI.cjs} +8 -2
- package/dist/{chunk-JNGIWIY6.mjs → chunk-NPC7VWJE.mjs} +2 -2
- package/dist/chunk-NRDBW4MP.mjs +45 -0
- package/dist/{chunk-ILWLPEVO.mjs → chunk-NRSN7G7E.mjs} +2 -2
- package/dist/chunk-OFZUJMCU.mjs +601 -0
- package/dist/{chunk-L4DVIHOC.mjs → chunk-OKZUAXHF.mjs} +1 -1
- package/dist/{chunk-EM6SBQKM.cjs → chunk-OMVAU7NT.cjs} +27 -2
- package/dist/{chunk-AHAJGAYD.mjs → chunk-PDOCJ6RY.mjs} +2 -2
- package/dist/{chunk-IFI5FXEZ.cjs → chunk-PFQKNERH.cjs} +562 -251
- package/dist/{chunk-S5GDHOE4.mjs → chunk-PZNL3WEG.mjs} +48 -5
- package/dist/{chunk-GZYH4OER.mjs → chunk-Q3VLETLE.mjs} +2 -2
- package/dist/{chunk-WG2KHOMN.mjs → chunk-QAU5JD57.mjs} +571 -260
- package/dist/{chunk-FV45CKBC.mjs → chunk-QCFBDFRS.mjs} +1 -1
- package/dist/{chunk-75BRBIFP.cjs → chunk-QCVE2OCI.cjs} +5 -8
- package/dist/{chunk-6ZCMSZ5U.mjs → chunk-QE6VAKLT.mjs} +1 -1
- package/dist/{chunk-QG5HNS7P.mjs → chunk-QORUJDIV.mjs} +2 -2
- package/dist/chunk-RHAZ22ZN.mjs +87 -0
- package/dist/{chunk-CUMINO7Z.cjs → chunk-RU3M2FIK.cjs} +18 -14
- package/dist/{chunk-DGXN3L4D.mjs → chunk-SAZVVAJH.mjs} +5 -5
- package/dist/{chunk-MKMBQSNQ.mjs → chunk-SC2WYWPF.mjs} +3 -3
- package/dist/{chunk-QCFFHV5H.mjs → chunk-SMHH4VDG.mjs} +1 -1
- package/dist/{chunk-UAFSBWNT.mjs → chunk-SOMHP6GF.mjs} +63 -16
- package/dist/{chunk-ND224OE2.cjs → chunk-TKSCR644.cjs} +34 -15
- package/dist/{chunk-4V7GIE2U.mjs → chunk-UAORZ7QA.mjs} +3 -3
- package/dist/{chunk-IQXFRNY2.cjs → chunk-UFDAAQFX.cjs} +2 -2
- package/dist/{chunk-6VYZOPOT.mjs → chunk-UJD4PHYB.mjs} +15 -11
- package/dist/{chunk-ZHVYQL3H.cjs → chunk-ULAWS2PA.cjs} +97 -36
- package/dist/{chunk-5ZSWG4UX.cjs → chunk-UXFQ3UDA.cjs} +14 -1
- package/dist/{chunk-MPEYMSCF.cjs → chunk-VFQT3LAO.cjs} +5 -5
- package/dist/{chunk-2FXWWUE5.cjs → chunk-VZJR7UTG.cjs} +6 -6
- package/dist/{chunk-2AKFKCHA.mjs → chunk-W7LF2J2S.mjs} +1 -1
- package/dist/chunk-WWFTAUFG.cjs +45 -0
- package/dist/{chunk-JBC2FKRW.mjs → chunk-WWIKMBRN.mjs} +2 -1
- package/dist/{chunk-75DYEVXI.cjs → chunk-X6W5FFH6.cjs} +11 -11
- package/dist/{chunk-EXLKRR4U.cjs → chunk-XBML5KMG.cjs} +12 -12
- package/dist/{chunk-PZNCMPJF.cjs → chunk-XCACDAZZ.cjs} +18 -12
- package/dist/{chunk-JATSG2ZO.mjs → chunk-XCMCS4DA.mjs} +15 -3
- package/dist/{chunk-UJ2C4ICS.cjs → chunk-XJXBIP67.cjs} +4 -4
- package/dist/{chunk-XF7Q24PF.mjs → chunk-Y7RKTKYI.mjs} +25 -0
- package/dist/{chunk-VYZSOYR4.cjs → chunk-YC6V7PWE.cjs} +1 -1
- package/dist/{chunk-F6OHXPWR.mjs → chunk-YFILVET3.mjs} +8 -1
- package/dist/{chunk-JLRDISQL.cjs → chunk-YKX5BK66.cjs} +7 -7
- package/dist/{chunk-DYEJQTDN.cjs → chunk-YSCV4SJF.cjs} +4 -4
- package/dist/chunk-YSLWRWWP.cjs +601 -0
- package/dist/{chunk-5LJCOSKT.mjs → chunk-YULD7ICZ.mjs} +1 -1
- package/dist/{chunk-2SDO73HK.cjs → chunk-YWN746US.cjs} +64 -14
- package/dist/chunk-Z2HLU4IX.cjs +238 -0
- package/dist/chunk-ZLAT2CWY.mjs +135 -0
- package/dist/{chunk-T5CERMEH.cjs → chunk-ZXGAFZDO.cjs} +2 -2
- package/dist/{client-plugins-BX2ptm4H.d.mts → client-plugins-CvIslxWi.d.mts} +232 -8
- package/dist/{client-plugins-BmxM5KW_.d.ts → client-plugins-HIyulDym.d.ts} +232 -8
- package/dist/client-plugins.d.mts +4 -5
- package/dist/client-plugins.d.ts +4 -5
- package/dist/client.cjs +10 -10
- package/dist/client.d.mts +8 -9
- package/dist/client.d.ts +8 -9
- package/dist/client.mjs +9 -9
- package/dist/config.d.mts +4 -5
- package/dist/config.d.ts +4 -5
- package/dist/{devtools-EWRDHCD5.cjs → devtools-EAUY43BS.cjs} +14 -12
- package/dist/{devtools-BPBCYOU6.mjs → devtools-EE5RIBTH.mjs} +13 -11
- package/dist/docs.cjs +17 -15
- package/dist/docs.d.mts +46 -4
- package/dist/docs.d.ts +46 -4
- package/dist/docs.mjs +16 -14
- package/dist/environment/vite.cjs +2 -2
- package/dist/environment/vite.mjs +1 -1
- package/dist/headers.cjs +4 -4
- package/dist/headers.mjs +3 -3
- package/dist/i18n/client.cjs +14 -13
- package/dist/i18n/client.d.mts +2 -2
- package/dist/i18n/client.d.ts +2 -2
- package/dist/i18n/client.mjs +5 -4
- package/dist/i18n/index.cjs +3 -2
- package/dist/i18n/index.d.mts +3 -3
- package/dist/i18n/index.d.ts +3 -3
- package/dist/i18n/index.mjs +2 -1
- package/dist/i18n/server.cjs +6 -5
- package/dist/i18n/server.d.mts +5 -5
- package/dist/i18n/server.d.ts +5 -5
- package/dist/i18n/server.mjs +5 -4
- package/dist/image/server.cjs +3 -3
- package/dist/image/server.mjs +2 -2
- package/dist/image/sharp.cjs +10 -10
- package/dist/image/sharp.mjs +2 -2
- package/dist/{index-a-8Z5kZU.d.mts → index-BJJfLxJo.d.mts} +2 -2
- package/dist/{index-BWVfxIsO.d.ts → index-CwoOP-MW.d.ts} +2 -2
- package/dist/index.cjs +75 -60
- package/dist/index.d.mts +21 -22
- package/dist/index.d.ts +21 -22
- package/dist/index.mjs +79 -64
- package/dist/integrations.cjs +7 -4
- package/dist/integrations.d.mts +4 -5
- package/dist/integrations.d.ts +4 -5
- package/dist/integrations.mjs +8 -5
- package/dist/internal/app-markdown-runtime.cjs +7 -5
- package/dist/internal/app-markdown-runtime.d.mts +17 -7
- package/dist/internal/app-markdown-runtime.d.ts +17 -7
- package/dist/internal/app-markdown-runtime.mjs +6 -4
- package/dist/internal/build-runtime.cjs +44 -41
- package/dist/internal/build-runtime.d.mts +6 -7
- package/dist/internal/build-runtime.d.ts +6 -7
- package/dist/internal/build-runtime.mjs +43 -40
- package/dist/internal/cli-runtime.cjs +23 -20
- package/dist/internal/cli-runtime.mjs +22 -19
- package/dist/internal/client-error-overlay.cjs +6 -6
- package/dist/internal/client-error-overlay.mjs +2 -2
- package/dist/internal/client-runtime.cjs +5 -3
- package/dist/internal/client-runtime.d.mts +9 -1
- package/dist/internal/client-runtime.d.ts +9 -1
- package/dist/internal/client-runtime.mjs +4 -2
- package/dist/internal/compression-runtime.d.mts +4 -5
- package/dist/internal/compression-runtime.d.ts +4 -5
- package/dist/internal/config-runtime.cjs +14 -12
- package/dist/internal/config-runtime.d.mts +5 -6
- package/dist/internal/config-runtime.d.ts +5 -6
- package/dist/internal/config-runtime.mjs +13 -11
- package/dist/internal/infra-analytics-runtime.cjs +4 -4
- package/dist/internal/infra-analytics-runtime.mjs +2 -2
- package/dist/internal/isolated-boundary.cjs +3 -2
- package/dist/internal/isolated-boundary.d.mts +1 -0
- package/dist/internal/isolated-boundary.d.ts +1 -0
- package/dist/internal/isolated-boundary.mjs +2 -1
- package/dist/internal/metadata-image-runtime.cjs +3 -3
- package/dist/internal/metadata-image-runtime.mjs +2 -2
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +61 -31
- package/dist/internal/production-runtime.d.mts +165 -18
- package/dist/internal/production-runtime.d.ts +165 -18
- package/dist/internal/production-runtime.mjs +57 -27
- package/dist/internal/request-cookies.cjs +4 -2
- package/dist/internal/request-cookies.d.mts +9 -1
- package/dist/internal/request-cookies.d.ts +9 -1
- package/dist/internal/request-cookies.mjs +3 -1
- package/dist/internal/server-tree.cjs +12 -0
- package/dist/internal/server-tree.d.mts +27 -0
- package/dist/internal/server-tree.d.ts +27 -0
- package/dist/internal/server-tree.mjs +12 -0
- package/dist/markdown.cjs +4 -4
- package/dist/markdown.d.mts +4 -5
- package/dist/markdown.d.ts +4 -5
- package/dist/markdown.mjs +3 -3
- package/dist/{metadata-DsEaK7mQ.d.mts → metadata-BnLDsUOS.d.ts} +16 -2
- package/dist/{metadata-fwZ3gfG6.d.ts → metadata-WGpBYcGn.d.mts} +16 -2
- package/dist/middleware.cjs +18 -8
- package/dist/middleware.d.mts +27 -9
- package/dist/middleware.d.ts +27 -9
- package/dist/middleware.mjs +18 -8
- package/dist/navigation.cjs +7 -7
- package/dist/navigation.d.mts +7 -8
- package/dist/navigation.d.ts +7 -8
- package/dist/navigation.mjs +6 -6
- package/dist/{nitro-NAKCRVHX.mjs → nitro-MXRDCXWZ.mjs} +5 -5
- package/dist/{nitro-VYDZGYFY.cjs → nitro-OVPLKPE2.cjs} +7 -7
- package/dist/{observability-BupkiN0m.d.mts → observability-CoXunYhS.d.mts} +4 -3
- package/dist/{observability-BupkiN0m.d.ts → observability-CoXunYhS.d.ts} +4 -3
- package/dist/observability.d.mts +1 -1
- package/dist/observability.d.ts +1 -1
- package/dist/plugin.cjs +39 -36
- package/dist/plugin.d.mts +4 -5
- package/dist/plugin.d.ts +4 -5
- package/dist/plugin.mjs +38 -35
- package/dist/{production-runtime-Baqgwtvc.d.mts → production-runtime-0sRnuYc-.d.mts} +11 -4
- package/dist/{production-runtime-DNkpFnmg.d.ts → production-runtime-Crq6CJ-2.d.ts} +11 -4
- package/dist/query/client.cjs +8 -8
- package/dist/query/client.mjs +4 -4
- package/dist/{render-plan-rkIK9wd9.d.ts → render-plan-8ozZh2Qv.d.ts} +1 -1
- package/dist/{render-plan-DhwQnmmX.d.mts → render-plan-gs9GGPzw.d.mts} +1 -1
- package/dist/renderer/react/server.cjs +10 -4
- package/dist/renderer/react/server.d.mts +2 -1
- package/dist/renderer/react/server.d.ts +2 -1
- package/dist/renderer/react/server.mjs +7 -1
- package/dist/renderer-client.cjs +40 -20
- package/dist/renderer-client.d.mts +6 -7
- package/dist/renderer-client.d.ts +6 -7
- package/dist/renderer-client.mjs +29 -9
- package/dist/renderer.d.mts +2 -0
- package/dist/renderer.d.ts +2 -0
- package/dist/{request-BcY4RYPC.d.ts → request-B5G8rLBH.d.ts} +7 -2
- package/dist/{request-CFy1BltJ.d.mts → request-fkhiynXe.d.mts} +7 -2
- package/dist/request.cjs +2 -2
- package/dist/request.d.mts +5 -6
- package/dist/request.d.ts +5 -6
- package/dist/request.mjs +1 -1
- package/dist/{resolver-PPEeiJ6M.d.ts → resolver-DadfRL6F.d.ts} +1 -1
- package/dist/{resolver-DhW0CqZN.d.mts → resolver-khasx3fU.d.mts} +1 -1
- package/dist/{route-rendering-BkS0TBlB.d.mts → route-rendering-CLnS7AZj.d.mts} +1 -1
- package/dist/{route-rendering-D4XpMjam.d.ts → route-rendering-lS5nUMua.d.ts} +1 -1
- package/dist/{router-Cq7BcZxg.d.ts → router-4iuiYnOW.d.ts} +1 -1
- package/dist/{router-C4zPlC3V.d.mts → router-ifU8Dui1.d.mts} +1 -1
- package/dist/routes.cjs +3 -3
- package/dist/routes.d.mts +4 -5
- package/dist/routes.d.ts +4 -5
- package/dist/routes.mjs +2 -2
- package/dist/{runtime-BirxPwbZ.d.ts → runtime-BgDQzBiu.d.ts} +2 -2
- package/dist/{runtime-AOJge4vQ.d.mts → runtime-CV2UCV-5.d.mts} +2 -2
- package/dist/server-action-security.cjs +3 -3
- package/dist/server-action-security.mjs +2 -2
- package/dist/server-fn.cjs +5 -5
- package/dist/server-fn.mjs +4 -4
- package/dist/server-plugins.cjs +4 -4
- package/dist/server-plugins.d.mts +5 -6
- package/dist/server-plugins.d.ts +5 -6
- package/dist/server-plugins.mjs +3 -3
- package/dist/server-query-client.cjs +3 -3
- package/dist/server-query-client.mjs +2 -2
- package/dist/server-query.cjs +6 -6
- package/dist/server-query.mjs +5 -5
- package/dist/server.cjs +66 -63
- package/dist/server.d.mts +13 -14
- package/dist/server.d.ts +13 -14
- package/dist/server.mjs +43 -40
- package/dist/{spa-router-DzPZH-AO.d.mts → spa-router-Bq7VCOwx.d.mts} +3 -3
- package/dist/{spa-router-B1HI3X9k.d.ts → spa-router-DaJk5Re4.d.ts} +3 -3
- package/dist/testing.cjs +22 -20
- package/dist/testing.d.mts +4 -5
- package/dist/testing.d.ts +4 -5
- package/dist/testing.mjs +18 -16
- package/dist/theme/server.cjs +4 -3
- package/dist/theme/server.mjs +3 -2
- package/dist/{types-Z0aotQ8w.d.mts → types-CnH8DOqo.d.mts} +1 -1
- package/dist/{types-Z0aotQ8w.d.ts → types-CnH8DOqo.d.ts} +1 -1
- package/dist/{utils-DMD1Hzta.d.ts → utils-BXLmFsVR.d.ts} +1 -1
- package/dist/{utils-CEBktlBG.d.mts → utils-XJn0c9bj.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +39 -36
- package/dist/vite.d.mts +4 -5
- package/dist/vite.d.ts +4 -5
- package/dist/vite.mjs +38 -35
- package/dist/{workflows-CR9ex-gz.d.ts → workflows-jZ4BcdoZ.d.mts} +1 -1
- package/dist/{workflows-CR9ex-gz.d.mts → workflows-jZ4BcdoZ.d.ts} +1 -1
- package/dist/workflows.cjs +3 -3
- package/dist/workflows.d.mts +1 -1
- package/dist/workflows.d.ts +1 -1
- package/dist/workflows.mjs +2 -2
- package/package.json +10 -2
- package/dist/chunk-22GUSVNJ.cjs +0 -351
- package/dist/chunk-5MKEDGLD.cjs +0 -53
- package/dist/chunk-O6XNAMBV.mjs +0 -53
- package/dist/chunk-SWN467MP.cjs +0 -18
- package/dist/chunk-XGC343EY.cjs +0 -443
- package/dist/chunk-ZSH2Y4LN.mjs +0 -351
- package/dist/types-DFbjpjXX.d.mts +0 -105
- package/dist/types-DFbjpjXX.d.ts +0 -105
- /package/dist/{chunk-SUIBNSNO.cjs → chunk-SJNMVDDF.cjs} +0 -0
- /package/dist/{chunk-LNZ7JZUS.mjs → chunk-UDNPLXW7.mjs} +0 -0
|
@@ -10,7 +10,7 @@ var _chunkXD32KALFcjs = require('./chunk-XD32KALF.cjs');
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunk3UH7MRCPcjs = require('./chunk-3UH7MRCP.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
@@ -20,7 +20,7 @@ var _chunkMXDTKXO6cjs = require('./chunk-MXDTKXO6.cjs');
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var _chunkVZJR7UTGcjs = require('./chunk-VZJR7UTG.cjs');
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
@@ -28,7 +28,7 @@ var _chunk2FXWWUE5cjs = require('./chunk-2FXWWUE5.cjs');
|
|
|
28
28
|
var _chunkMWWVKDW3cjs = require('./chunk-MWWVKDW3.cjs');
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
var
|
|
31
|
+
var _chunkTKSCR644cjs = require('./chunk-TKSCR644.cjs');
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
var _chunkIK6LVLKCcjs = require('./chunk-IK6LVLKC.cjs');
|
|
@@ -37,7 +37,7 @@ var _chunkIK6LVLKCcjs = require('./chunk-IK6LVLKC.cjs');
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
var
|
|
40
|
+
var _chunkF7JZENPFcjs = require('./chunk-F7JZENPF.cjs');
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
var _chunkKCMTCM6Icjs = require('./chunk-KCMTCM6I.cjs');
|
|
@@ -73,27 +73,37 @@ var _chunk2SJ4RQ6Pcjs = require('./chunk-2SJ4RQ6P.cjs');
|
|
|
73
73
|
|
|
74
74
|
|
|
75
75
|
|
|
76
|
-
var _chunkIMB4PIARcjs = require('./chunk-IMB4PIAR.cjs');
|
|
77
76
|
|
|
78
77
|
|
|
79
78
|
|
|
79
|
+
var _chunkICUQICNCcjs = require('./chunk-ICUQICNC.cjs');
|
|
80
80
|
|
|
81
81
|
|
|
82
|
-
var _chunkCTV2TTNPcjs = require('./chunk-CTV2TTNP.cjs');
|
|
83
82
|
|
|
84
83
|
|
|
85
84
|
|
|
86
|
-
var
|
|
85
|
+
var _chunk3BHT4WMPcjs = require('./chunk-3BHT4WMP.cjs');
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
var _chunkIPXLADVOcjs = require('./chunk-IPXLADVO.cjs');
|
|
87
97
|
|
|
88
98
|
|
|
89
99
|
var _chunkCXP5U3RWcjs = require('./chunk-CXP5U3RW.cjs');
|
|
90
100
|
|
|
91
101
|
|
|
92
|
-
var
|
|
102
|
+
var _chunk3SDFA7UFcjs = require('./chunk-3SDFA7UF.cjs');
|
|
93
103
|
|
|
94
104
|
|
|
95
105
|
|
|
96
|
-
var
|
|
106
|
+
var _chunkHITLGIAOcjs = require('./chunk-HITLGIAO.cjs');
|
|
97
107
|
|
|
98
108
|
|
|
99
109
|
|
|
@@ -115,7 +125,7 @@ var _chunkVPTDD5XFcjs = require('./chunk-VPTDD5XF.cjs');
|
|
|
115
125
|
var _chunkPSV6XKPOcjs = require('./chunk-PSV6XKPO.cjs');
|
|
116
126
|
|
|
117
127
|
|
|
118
|
-
var
|
|
128
|
+
var _chunkRU3M2FIKcjs = require('./chunk-RU3M2FIK.cjs');
|
|
119
129
|
|
|
120
130
|
|
|
121
131
|
|
|
@@ -127,38 +137,41 @@ var _chunk6EXBPJ24cjs = require('./chunk-6EXBPJ24.cjs');
|
|
|
127
137
|
var _chunkVEKFLAQMcjs = require('./chunk-VEKFLAQM.cjs');
|
|
128
138
|
|
|
129
139
|
|
|
130
|
-
var
|
|
140
|
+
var _chunkEFCQPQMGcjs = require('./chunk-EFCQPQMG.cjs');
|
|
131
141
|
|
|
132
142
|
|
|
133
143
|
|
|
134
144
|
var _chunkOHY2ZWUGcjs = require('./chunk-OHY2ZWUG.cjs');
|
|
135
145
|
|
|
136
146
|
|
|
137
|
-
var
|
|
147
|
+
var _chunkEUV4YR3Vcjs = require('./chunk-EUV4YR3V.cjs');
|
|
138
148
|
|
|
139
149
|
|
|
140
150
|
|
|
141
|
-
var
|
|
151
|
+
var _chunkVFQT3LAOcjs = require('./chunk-VFQT3LAO.cjs');
|
|
142
152
|
|
|
143
153
|
|
|
144
154
|
|
|
145
|
-
var
|
|
155
|
+
var _chunkFTFYRMQQcjs = require('./chunk-FTFYRMQQ.cjs');
|
|
146
156
|
|
|
147
157
|
|
|
148
|
-
var _chunkZHVYQL3Hcjs = require('./chunk-ZHVYQL3H.cjs');
|
|
149
158
|
|
|
150
159
|
|
|
151
|
-
var
|
|
160
|
+
var _chunkULAWS2PAcjs = require('./chunk-ULAWS2PA.cjs');
|
|
152
161
|
|
|
153
162
|
|
|
154
|
-
var _chunkIQXFRNY2cjs = require('./chunk-IQXFRNY2.cjs');
|
|
155
163
|
|
|
156
164
|
|
|
157
|
-
var
|
|
165
|
+
var _chunkZ2HLU4IXcjs = require('./chunk-Z2HLU4IX.cjs');
|
|
166
|
+
|
|
158
167
|
|
|
168
|
+
var _chunkXBML5KMGcjs = require('./chunk-XBML5KMG.cjs');
|
|
159
169
|
|
|
160
170
|
|
|
161
|
-
var
|
|
171
|
+
var _chunkUFDAAQFXcjs = require('./chunk-UFDAAQFX.cjs');
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
var _chunkLYLEZIG3cjs = require('./chunk-LYLEZIG3.cjs');
|
|
162
175
|
|
|
163
176
|
|
|
164
177
|
|
|
@@ -175,6 +188,10 @@ var _chunkSOR334EBcjs = require('./chunk-SOR334EB.cjs');
|
|
|
175
188
|
var _chunk5QIKR7RRcjs = require('./chunk-5QIKR7RR.cjs');
|
|
176
189
|
|
|
177
190
|
|
|
191
|
+
|
|
192
|
+
var _chunkKNBBQHO2cjs = require('./chunk-KNBBQHO2.cjs');
|
|
193
|
+
|
|
194
|
+
|
|
178
195
|
var _chunkC5GUTBZKcjs = require('./chunk-C5GUTBZK.cjs');
|
|
179
196
|
|
|
180
197
|
|
|
@@ -282,7 +299,7 @@ function getDocsTitle(docs) {
|
|
|
282
299
|
}
|
|
283
300
|
_chunkS3JO3N4Hcjs.__name.call(void 0, getDocsTitle, "getDocsTitle");
|
|
284
301
|
function loadPages(contentDir, docs) {
|
|
285
|
-
return
|
|
302
|
+
return _chunkVZJR7UTGcjs.discoverFarmDocsPages.call(void 0, contentDir, docs).map((page) => _chunkVZJR7UTGcjs.loadFarmDocsPage.call(void 0, contentDir, docs, page.slug)).filter((page) => Boolean(page)).sort((a, b) => a.href.localeCompare(b.href));
|
|
286
303
|
}
|
|
287
304
|
_chunkS3JO3N4Hcjs.__name.call(void 0, loadPages, "loadPages");
|
|
288
305
|
function findSocialImagePath(html) {
|
|
@@ -303,14 +320,14 @@ async function addHandlerRoute(routes, pathname, handler, absolutePaths) {
|
|
|
303
320
|
}
|
|
304
321
|
_chunkS3JO3N4Hcjs.__name.call(void 0, addHandlerRoute, "addHandlerRoute");
|
|
305
322
|
async function compileFarmDocsManifest(docs, options) {
|
|
306
|
-
const contentDir =
|
|
323
|
+
const contentDir = _chunkVZJR7UTGcjs.resolveFarmDocsContentDir.call(void 0, docs, options);
|
|
307
324
|
const pages = loadPages(contentDir, docs);
|
|
308
325
|
const absolutePaths = [
|
|
309
326
|
_path2.default.resolve(options.root),
|
|
310
327
|
_path2.default.resolve(contentDir),
|
|
311
328
|
docs.configPath || ""
|
|
312
329
|
];
|
|
313
|
-
const handler =
|
|
330
|
+
const handler = _chunkVZJR7UTGcjs.createFarmDocsHandler.call(void 0, docs, {
|
|
314
331
|
root: options.root,
|
|
315
332
|
srcDir: options.srcDir,
|
|
316
333
|
clientEntry: options.clientEntry,
|
|
@@ -318,7 +335,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
318
335
|
fontStylesheetHref: options.fontStylesheetHref,
|
|
319
336
|
globalStylesheetHref: options.globalStylesheetHref
|
|
320
337
|
});
|
|
321
|
-
const apiHandler =
|
|
338
|
+
const apiHandler = _chunk3UH7MRCPcjs.createFarmDocsAPIHandler.call(void 0, {
|
|
322
339
|
rootDir: options.root,
|
|
323
340
|
srcDir: options.srcDir,
|
|
324
341
|
docs
|
|
@@ -410,7 +427,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
410
427
|
post: await compileResponse(postResponse, absolutePaths),
|
|
411
428
|
search: {
|
|
412
429
|
pages: pages.map((page) => ({
|
|
413
|
-
...
|
|
430
|
+
..._chunkVZJR7UTGcjs.toFarmDocsMarkdownPage.call(void 0, page),
|
|
414
431
|
sourcePath: `farm-docs:${page.slug || "index"}`
|
|
415
432
|
})),
|
|
416
433
|
search: _nullishCoalesce(searchConfig, () => ( true)),
|
|
@@ -430,7 +447,7 @@ async function createFarmRouteRuntimeManifest(options) {
|
|
|
430
447
|
const routes = [];
|
|
431
448
|
for (const [pattern, entry] of options.routeManager.getRoutes()) {
|
|
432
449
|
const routeModule = await options.routeManager.loadRouteModule(entry.modulePath);
|
|
433
|
-
const rendering = await
|
|
450
|
+
const rendering = await _chunk3BHT4WMPcjs.resolveRouteRenderingConfigFromFile.call(void 0, routeModule, entry.modulePath);
|
|
434
451
|
const runtimeConfig = await options.routeManager.resolveRouteRuntimeConfig(pattern);
|
|
435
452
|
routes.push({
|
|
436
453
|
kind: "page",
|
|
@@ -441,9 +458,9 @@ async function createFarmRouteRuntimeManifest(options) {
|
|
|
441
458
|
});
|
|
442
459
|
}
|
|
443
460
|
for (const [pattern, route] of options.apiRouteManager.getRoutes()) {
|
|
444
|
-
const publicPattern =
|
|
461
|
+
const publicPattern = _chunkKNBBQHO2cjs.resolveFarmAPIServerRoutePath.call(void 0,
|
|
445
462
|
pattern,
|
|
446
|
-
|
|
463
|
+
_chunkKNBBQHO2cjs.resolveFarmAPIServerBasePath.call(void 0, options.config.api)
|
|
447
464
|
);
|
|
448
465
|
const inherited = _chunkSOR334EBcjs.resolveFarmRouteRuleRuntimeConfig.call(void 0, publicPattern, options.config.routeRules);
|
|
449
466
|
const own = _chunkSOR334EBcjs.normalizeFarmRouteRuntimeConfig.call(void 0,
|
|
@@ -708,6 +725,47 @@ function buildFarmVercelRoutes(options) {
|
|
|
708
725
|
}
|
|
709
726
|
_chunkS3JO3N4Hcjs.__name.call(void 0, buildFarmVercelRoutes, "buildFarmVercelRoutes");
|
|
710
727
|
|
|
728
|
+
// src/nitro/netlify-entry.ts
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
function resolveNitroNetlifyEntry(nitroRuntimeEntry) {
|
|
732
|
+
const entry = _path2.default.join(
|
|
733
|
+
_path2.default.dirname(nitroRuntimeEntry),
|
|
734
|
+
"..",
|
|
735
|
+
"presets",
|
|
736
|
+
"netlify",
|
|
737
|
+
"runtime",
|
|
738
|
+
"netlify.mjs"
|
|
739
|
+
);
|
|
740
|
+
if (!_fs.existsSync.call(void 0, entry)) {
|
|
741
|
+
throw new Error(
|
|
742
|
+
`[Farm.js] Could not find Nitro's Netlify function entry at ${entry}. Farm wraps it so private responses are never cached by Netlify's CDN; reinstall dependencies or report the installed Nitro version.`
|
|
743
|
+
);
|
|
744
|
+
}
|
|
745
|
+
return entry.split(_path2.default.sep).join("/");
|
|
746
|
+
}
|
|
747
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveNitroNetlifyEntry, "resolveNitroNetlifyEntry");
|
|
748
|
+
function createFarmNetlifyEntry(options) {
|
|
749
|
+
return `
|
|
750
|
+
import nitroNetlifyHandler from ${JSON.stringify(options.nitroNetlifyEntry)};
|
|
751
|
+
|
|
752
|
+
const PRIVATE_CACHE_DIRECTIVE = /(?:^|,)\\s*(?:private|no-store)\\s*(?:[,=]|$)/i;
|
|
753
|
+
|
|
754
|
+
export default async function farmNetlifyHandler(request, context) {
|
|
755
|
+
const response = await nitroNetlifyHandler(request, context);
|
|
756
|
+
if (
|
|
757
|
+
response &&
|
|
758
|
+
response.headers.has("netlify-cdn-cache-control") &&
|
|
759
|
+
PRIVATE_CACHE_DIRECTIVE.test(response.headers.get("cache-control") || "")
|
|
760
|
+
) {
|
|
761
|
+
response.headers.delete("netlify-cdn-cache-control");
|
|
762
|
+
}
|
|
763
|
+
return response;
|
|
764
|
+
}
|
|
765
|
+
`.trim();
|
|
766
|
+
}
|
|
767
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, createFarmNetlifyEntry, "createFarmNetlifyEntry");
|
|
768
|
+
|
|
711
769
|
// src/nitro/node-server-entry.ts
|
|
712
770
|
function createFarmNodeServerEntry(options) {
|
|
713
771
|
const serverConfig = JSON.stringify(options.server);
|
|
@@ -1345,6 +1403,11 @@ function hasRollupPlugins(plugins) {
|
|
|
1345
1403
|
return Boolean(plugins);
|
|
1346
1404
|
}
|
|
1347
1405
|
_chunkS3JO3N4Hcjs.__name.call(void 0, hasRollupPlugins, "hasRollupPlugins");
|
|
1406
|
+
function hasFarmServerCacheConfig(cache) {
|
|
1407
|
+
if (!cache || typeof cache !== "object") return false;
|
|
1408
|
+
return cache.adapter !== void 0 || cache.namespace !== void 0 || cache.maxEntries !== void 0 || cache.lease !== void 0;
|
|
1409
|
+
}
|
|
1410
|
+
_chunkS3JO3N4Hcjs.__name.call(void 0, hasFarmServerCacheConfig, "hasFarmServerCacheConfig");
|
|
1348
1411
|
function hasFarmRuntimeConfigModule(config, configModulePath) {
|
|
1349
1412
|
return Boolean(configModulePath || (config.layers || []).some((layer) => layer.configFile));
|
|
1350
1413
|
}
|
|
@@ -1523,7 +1586,7 @@ function hasFarmMiddlewareConfig(config) {
|
|
|
1523
1586
|
_chunkS3JO3N4Hcjs.__name.call(void 0, hasFarmMiddlewareConfig, "hasFarmMiddlewareConfig");
|
|
1524
1587
|
function hasFarmServerRuntimePlugins(config) {
|
|
1525
1588
|
return (config.plugins || []).some((plugin) => {
|
|
1526
|
-
if (
|
|
1589
|
+
if (_chunkFTFYRMQQcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) === false) return false;
|
|
1527
1590
|
return Boolean(
|
|
1528
1591
|
plugin.setup || plugin.init || plugin.ready || plugin.shutdown || plugin.runtime || plugin.router || plugin.render || plugin.beforeRouteMatch || plugin.afterRouteMatch || plugin.beforeRender || plugin.afterRender || plugin.onError || plugin.transformHTML
|
|
1529
1592
|
);
|
|
@@ -1536,7 +1599,7 @@ function hasFarmPluginRoutes(config) {
|
|
|
1536
1599
|
_chunkS3JO3N4Hcjs.__name.call(void 0, hasFarmPluginRoutes, "hasFarmPluginRoutes");
|
|
1537
1600
|
function farmServerRuntimePluginsMayHandlePath(config, pathname) {
|
|
1538
1601
|
return (config.plugins || []).some(
|
|
1539
|
-
(plugin) =>
|
|
1602
|
+
(plugin) => _chunkFTFYRMQQcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) !== false && _chunkICUQICNCcjs.farmPluginMayAffectRuntimePath.call(void 0, plugin, pathname)
|
|
1540
1603
|
);
|
|
1541
1604
|
}
|
|
1542
1605
|
_chunkS3JO3N4Hcjs.__name.call(void 0, farmServerRuntimePluginsMayHandlePath, "farmServerRuntimePluginsMayHandlePath");
|
|
@@ -1544,7 +1607,7 @@ async function discoverMiddlewareRoutes(appDir) {
|
|
|
1544
1607
|
const fs = await import("fs/promises");
|
|
1545
1608
|
const appDirs = Array.isArray(appDir) ? [...appDir] : [appDir];
|
|
1546
1609
|
const routes = /* @__PURE__ */ new Map();
|
|
1547
|
-
async function walk(dir, routePath, discovered) {
|
|
1610
|
+
async function walk(dir, routePath, directory, discovered) {
|
|
1548
1611
|
let entries;
|
|
1549
1612
|
try {
|
|
1550
1613
|
entries = await fs.readdir(dir, { withFileTypes: true });
|
|
@@ -1557,30 +1620,31 @@ async function discoverMiddlewareRoutes(appDir) {
|
|
|
1557
1620
|
if (middlewareFile) {
|
|
1558
1621
|
discovered.push({
|
|
1559
1622
|
path: routePath,
|
|
1623
|
+
directory,
|
|
1560
1624
|
filePath: _path2.default.join(dir, middlewareFile.name)
|
|
1561
1625
|
});
|
|
1562
1626
|
}
|
|
1563
1627
|
for (const entry of entries) {
|
|
1564
|
-
if (!entry.isDirectory() || entry.name.startsWith(".")
|
|
1628
|
+
if (!entry.isDirectory() || entry.name.startsWith(".")) {
|
|
1565
1629
|
continue;
|
|
1566
1630
|
}
|
|
1567
|
-
|
|
1568
|
-
|
|
1631
|
+
await walk(
|
|
1632
|
+
_path2.default.join(dir, entry.name),
|
|
1633
|
+
_chunkULAWS2PAcjs.appendMiddlewareRoutePath.call(void 0, routePath, entry.name),
|
|
1634
|
+
_chunkULAWS2PAcjs.appendMiddlewareDirectory.call(void 0, directory, entry.name),
|
|
1635
|
+
discovered
|
|
1636
|
+
);
|
|
1569
1637
|
}
|
|
1570
1638
|
}
|
|
1571
1639
|
_chunkS3JO3N4Hcjs.__name.call(void 0, walk, "walk");
|
|
1572
1640
|
for (const sourceAppDir of appDirs) {
|
|
1573
1641
|
const discovered = [];
|
|
1574
|
-
await walk(sourceAppDir, "/", discovered);
|
|
1642
|
+
await walk(sourceAppDir, "/", "", discovered);
|
|
1575
1643
|
for (const route of discovered) {
|
|
1576
|
-
routes.set(route.
|
|
1644
|
+
routes.set(route.directory, route);
|
|
1577
1645
|
}
|
|
1578
1646
|
}
|
|
1579
|
-
return Array.from(routes.values()).sort((
|
|
1580
|
-
const depthA = a.path.split("/").filter(Boolean).length;
|
|
1581
|
-
const depthB = b.path.split("/").filter(Boolean).length;
|
|
1582
|
-
return depthA - depthB || a.path.localeCompare(b.path);
|
|
1583
|
-
});
|
|
1647
|
+
return Array.from(routes.values()).sort(_chunkULAWS2PAcjs.compareMiddlewareRouteLocations).map(({ path: routePath, filePath }) => ({ path: routePath, filePath }));
|
|
1584
1648
|
}
|
|
1585
1649
|
_chunkS3JO3N4Hcjs.__name.call(void 0, discoverMiddlewareRoutes, "discoverMiddlewareRoutes");
|
|
1586
1650
|
function assertFarmDocsRuntimeSupported(config, preset) {
|
|
@@ -1598,7 +1662,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1598
1662
|
assertFarmDocsRuntimeSupported(config, preset);
|
|
1599
1663
|
const srcDir = config.srcDir || "src";
|
|
1600
1664
|
const distDir = config.distDir || ".farm";
|
|
1601
|
-
const deployOutputDir =
|
|
1665
|
+
const deployOutputDir = _chunkF7JZENPFcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
1602
1666
|
const lifecyclePluginManager = options.pluginManager;
|
|
1603
1667
|
const productionViteResultPromise = Promise.allSettled([
|
|
1604
1668
|
Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkA6WIQH5Zcjs.loadFarmProductionVite.call(void 0, ))))
|
|
@@ -1617,9 +1681,10 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1617
1681
|
const routeRuntimeManifestResultPromise = Promise.allSettled([routeRuntimeManifestPromise]);
|
|
1618
1682
|
const pageRoutes = [];
|
|
1619
1683
|
for (const [pattern, entry] of routeManager.getRoutes()) {
|
|
1620
|
-
const markdownSourcePath = entry.markdownSourcePath || (
|
|
1684
|
+
const markdownSourcePath = entry.markdownSourcePath || (_chunkEFCQPQMGcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? entry.modulePath : void 0);
|
|
1621
1685
|
pageRoutes.push({
|
|
1622
1686
|
pattern,
|
|
1687
|
+
...entry.directory ? { directory: entry.directory } : {},
|
|
1623
1688
|
modulePath: entry.modulePath,
|
|
1624
1689
|
...markdownSourcePath ? {
|
|
1625
1690
|
source: _fs.readFileSync.call(void 0, markdownSourcePath, "utf8"),
|
|
@@ -1632,6 +1697,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
1632
1697
|
(entry) => ({
|
|
1633
1698
|
name: entry.name,
|
|
1634
1699
|
ownerPattern: entry.ownerPattern,
|
|
1700
|
+
...entry.ownerDirectory ? { ownerDirectory: entry.ownerDirectory } : {},
|
|
1635
1701
|
pattern: entry.pattern,
|
|
1636
1702
|
modulePath: entry.modulePath,
|
|
1637
1703
|
containerId: entry.containerId,
|
|
@@ -1846,7 +1912,7 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
|
|
|
1846
1912
|
}
|
|
1847
1913
|
const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
|
|
1848
1914
|
await fs.writeFile(fontCssPath, normalizedFontCss);
|
|
1849
|
-
await fs.writeFile(clientCssPath,
|
|
1915
|
+
await fs.writeFile(clientCssPath, _chunkICUQICNCcjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
|
|
1850
1916
|
}
|
|
1851
1917
|
_chunkS3JO3N4Hcjs.__name.call(void 0, mergeBuiltFontCss, "mergeBuiltFontCss");
|
|
1852
1918
|
var _IncompleteClientBuildOutputError = class _IncompleteClientBuildOutputError extends Error {
|
|
@@ -1896,7 +1962,7 @@ function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, optio
|
|
|
1896
1962
|
const key = `${_path2.default.resolve(root)}\0${mode}\0${options.asyncOwnerIslands === true}\0${_path2.default.resolve(modulePath)}`;
|
|
1897
1963
|
let plan = cache.get(key);
|
|
1898
1964
|
if (!plan) {
|
|
1899
|
-
plan =
|
|
1965
|
+
plan = _chunkICUQICNCcjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
|
|
1900
1966
|
cache.set(key, plan);
|
|
1901
1967
|
}
|
|
1902
1968
|
return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
|
|
@@ -1914,7 +1980,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
1914
1980
|
});
|
|
1915
1981
|
pluginManager.addPlugins(config.plugins || []);
|
|
1916
1982
|
const clientPages = [];
|
|
1917
|
-
const integrationProviders =
|
|
1983
|
+
const integrationProviders = _chunkFTFYRMQQcjs.getIntegrationProviders.call(void 0, config.integrations).filter(
|
|
1918
1984
|
(provider) => provider.component || provider.type === "clerk"
|
|
1919
1985
|
);
|
|
1920
1986
|
const unsupportedIntegrationProvider = integrationProviders.find(
|
|
@@ -1925,14 +1991,14 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
1925
1991
|
`[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
|
|
1926
1992
|
);
|
|
1927
1993
|
}
|
|
1928
|
-
const isolatedMode =
|
|
1994
|
+
const isolatedMode = _chunkICUQICNCcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
1929
1995
|
_optionalChain([config, 'access', _35 => _35.experimental, 'optionalAccess', _36 => _36.isolatedClientHydration]),
|
|
1930
1996
|
{
|
|
1931
1997
|
serverComponents: _optionalChain([config, 'access', _37 => _37.experimental, 'optionalAccess', _38 => _38.serverComponents]) === true,
|
|
1932
1998
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
1933
1999
|
}
|
|
1934
2000
|
);
|
|
1935
|
-
const planOptions =
|
|
2001
|
+
const planOptions = _chunkICUQICNCcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
1936
2002
|
config.renderer,
|
|
1937
2003
|
Boolean(unsupportedIntegrationProvider)
|
|
1938
2004
|
);
|
|
@@ -1979,7 +2045,8 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
1979
2045
|
};
|
|
1980
2046
|
}
|
|
1981
2047
|
});
|
|
1982
|
-
const layoutAppliesToRoute =
|
|
2048
|
+
const layoutAppliesToRoute = _chunkIPXLADVOcjs.routeBoundaryCoversDirectory;
|
|
2049
|
+
const routeDirectory = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (route) => _nullishCoalesce(route.directory, () => ( route.pattern)), "routeDirectory");
|
|
1983
2050
|
const adapterOwnsDocsRuntime = Boolean(
|
|
1984
2051
|
_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _39 => _39.docs, 'optionalAccess', _40 => _40.enabled]) && _optionalChain([config, 'access', _41 => _41.docs, 'access', _42 => _42.adapter, 'optionalAccess', _43 => _43.server]) && config.docs.adapter.react
|
|
1985
2052
|
);
|
|
@@ -1989,7 +2056,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
1989
2056
|
), "isAdapterDocsRoute");
|
|
1990
2057
|
const syntheticDocsEntry = _optionalChain([config, 'access', _46 => _46.docs, 'optionalAccess', _47 => _47.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
|
|
1991
2058
|
const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
|
|
1992
|
-
const markdownPagePlan =
|
|
2059
|
+
const markdownPagePlan = _chunkICUQICNCcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
1993
2060
|
_chunkOHY2ZWUGcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunkOHY2ZWUGcjs.resolveMdxConfig.call(void 0, config.mdx), root),
|
|
1994
2061
|
root,
|
|
1995
2062
|
isolatedMode,
|
|
@@ -1997,7 +2064,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
1997
2064
|
);
|
|
1998
2065
|
const routePlans = pageRoutes.map((route) => ({
|
|
1999
2066
|
route,
|
|
2000
|
-
metadata:
|
|
2067
|
+
metadata: _chunkEFCQPQMGcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
|
|
2001
2068
|
route.modulePath,
|
|
2002
2069
|
root,
|
|
2003
2070
|
isolatedMode,
|
|
@@ -2005,7 +2072,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2005
2072
|
planOptions
|
|
2006
2073
|
)
|
|
2007
2074
|
}));
|
|
2008
|
-
|
|
2075
|
+
_chunkICUQICNCcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
2009
2076
|
clientLayouts.map((layout) => ({
|
|
2010
2077
|
pattern: layout.pattern,
|
|
2011
2078
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -2013,8 +2080,8 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2013
2080
|
})),
|
|
2014
2081
|
[
|
|
2015
2082
|
...routePlans.map(({ route, metadata }) => ({
|
|
2016
|
-
pattern: route
|
|
2017
|
-
depth:
|
|
2083
|
+
pattern: routeDirectory(route),
|
|
2084
|
+
depth: _chunkIPXLADVOcjs.getRouteDirectoryDepth.call(void 0, routeDirectory(route)),
|
|
2018
2085
|
metadata
|
|
2019
2086
|
})),
|
|
2020
2087
|
...syntheticDocsPatterns.map((pattern) => ({
|
|
@@ -2035,9 +2102,9 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2035
2102
|
layoutAppliesToRoute
|
|
2036
2103
|
);
|
|
2037
2104
|
for (const layout of clientLayouts) {
|
|
2038
|
-
const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, route
|
|
2105
|
+
const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, routeDirectory(route))) || Boolean(adapterDocsEntry && layoutAppliesToRoute(layout.pattern, adapterDocsEntry));
|
|
2039
2106
|
if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
|
|
2040
|
-
_chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F ${
|
|
2107
|
+
_chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F ${_chunkICUQICNCcjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
|
|
2041
2108
|
}
|
|
2042
2109
|
}
|
|
2043
2110
|
if (isolatedMode === "analyze") {
|
|
@@ -2057,11 +2124,11 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2057
2124
|
if (isAdapterDocsRoute(route.pattern)) continue;
|
|
2058
2125
|
try {
|
|
2059
2126
|
const applicableClientLayouts = clientLayouts.filter(
|
|
2060
|
-
(layout) => (layout.shouldHydrate || layout.hasIsolatedClientBoundaries) && layoutAppliesToRoute(layout.pattern, route
|
|
2127
|
+
(layout) => (layout.shouldHydrate || layout.hasIsolatedClientBoundaries) && layoutAppliesToRoute(layout.pattern, routeDirectory(route))
|
|
2061
2128
|
);
|
|
2062
2129
|
if (metadata.suppressedAsyncHydration) {
|
|
2063
2130
|
_chunk5QIKR7RRcjs.logger.warn(
|
|
2064
|
-
`\u26A0\uFE0F ${
|
|
2131
|
+
`\u26A0\uFE0F ${_chunkICUQICNCcjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
|
|
2065
2132
|
);
|
|
2066
2133
|
}
|
|
2067
2134
|
if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0) {
|
|
@@ -2084,7 +2151,9 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2084
2151
|
isolatedBoundaries: [
|
|
2085
2152
|
...metadata.hasIsolatedClientBoundaries ? metadata.isolatedBoundaries : [],
|
|
2086
2153
|
...applicableClientLayouts.filter((layout) => layout.hasIsolatedClientBoundaries).flatMap((layout) => layout.isolatedBoundaries)
|
|
2087
|
-
]
|
|
2154
|
+
],
|
|
2155
|
+
// The server renders a server tree only below a hydrating layout.
|
|
2156
|
+
..._chunkICUQICNCcjs.usesFarmServerTree.call(void 0, metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
|
|
2088
2157
|
});
|
|
2089
2158
|
_chunk5QIKR7RRcjs.logger.info(`\u{1F4F1} Found hydratable route: ${route.pattern} -> ${route.modulePath}`);
|
|
2090
2159
|
}
|
|
@@ -2120,7 +2189,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2120
2189
|
}
|
|
2121
2190
|
const clientRouteSlots = routeSlots.filter((slot) => {
|
|
2122
2191
|
try {
|
|
2123
|
-
return
|
|
2192
|
+
return _chunkICUQICNCcjs.getClientModuleMetadata.call(void 0, slot.modulePath, root).shouldHydrate;
|
|
2124
2193
|
} catch (error) {
|
|
2125
2194
|
_chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
|
|
2126
2195
|
return false;
|
|
@@ -2148,10 +2217,10 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2148
2217
|
config.renderer,
|
|
2149
2218
|
config.publicRuntimeConfig,
|
|
2150
2219
|
config.trailingSlash,
|
|
2151
|
-
|
|
2220
|
+
_chunkFTFYRMQQcjs.getIntegrationProviders.call(void 0, config.integrations),
|
|
2152
2221
|
config.basePath,
|
|
2153
|
-
|
|
2154
|
-
adapterOwnsDocsRuntime ?
|
|
2222
|
+
_chunkICUQICNCcjs.generateClientCachePersistenceCode.call(void 0, _chunkICUQICNCcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
|
|
2223
|
+
adapterOwnsDocsRuntime ? _chunkHITLGIAOcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
|
|
2155
2224
|
);
|
|
2156
2225
|
await fs.writeFile(clientEntryPath, clientHydrationCode);
|
|
2157
2226
|
const hasScopedPostcssConfig = hasProjectPostcssConfig(root);
|
|
@@ -2167,7 +2236,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2167
2236
|
const postcssConfigPath = _path2.default.join(clientEntryDir, "postcss.config.cjs");
|
|
2168
2237
|
await fs.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
|
|
2169
2238
|
postcssSearchPath = clientEntryDir;
|
|
2170
|
-
tailwindVitePlugin = await
|
|
2239
|
+
tailwindVitePlugin = await _chunkICUQICNCcjs.loadTailwindVitePlugin.call(void 0, {
|
|
2171
2240
|
builder: productionVite.builder,
|
|
2172
2241
|
announce: true
|
|
2173
2242
|
});
|
|
@@ -2236,11 +2305,14 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2236
2305
|
}
|
|
2237
2306
|
},
|
|
2238
2307
|
plugins: [
|
|
2239
|
-
|
|
2308
|
+
_chunkICUQICNCcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
2240
2309
|
...tailwindVitePlugin ? [tailwindVitePlugin] : [],
|
|
2241
2310
|
...rendererVitePlugins,
|
|
2242
2311
|
...config.vite.plugins || [],
|
|
2243
2312
|
farmServerOnlyEntriesPlugin(),
|
|
2313
|
+
_chunkICUQICNCcjs.farmDocsClientConfigPlugin.call(void 0,
|
|
2314
|
+
adapterOwnsDocsRuntime ? _chunkHITLGIAOcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
|
|
2315
|
+
),
|
|
2244
2316
|
// Plugin to redirect @farm.js/core imports to client-only exports
|
|
2245
2317
|
{
|
|
2246
2318
|
name: "farm-client-only-imports",
|
|
@@ -2289,7 +2361,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2289
2361
|
}
|
|
2290
2362
|
},
|
|
2291
2363
|
farmPlugin({ ...config, isolatedClientBoundaryModules }, pluginManager),
|
|
2292
|
-
|
|
2364
|
+
_chunk3SDFA7UFcjs.farmEnvironmentFunctionsPlugin.call(void 0, )
|
|
2293
2365
|
],
|
|
2294
2366
|
mode: "production",
|
|
2295
2367
|
css: postcssSearchPath ? {
|
|
@@ -2297,7 +2369,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2297
2369
|
} : void 0,
|
|
2298
2370
|
// Ensure React is bundled for client
|
|
2299
2371
|
resolve: {
|
|
2300
|
-
alias:
|
|
2372
|
+
alias: _chunkICUQICNCcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
2301
2373
|
dedupe: [...config.renderer.dedupe || []]
|
|
2302
2374
|
},
|
|
2303
2375
|
// Optimize dependencies - exclude server-side code from client bundle
|
|
@@ -2310,7 +2382,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2310
2382
|
]
|
|
2311
2383
|
}
|
|
2312
2384
|
};
|
|
2313
|
-
await viteBuild(
|
|
2385
|
+
await viteBuild(_chunkICUQICNCcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
|
|
2314
2386
|
await mergeBuiltFontCss(outputDir);
|
|
2315
2387
|
await validateClientBuildOutput(root, srcDir, outputDir);
|
|
2316
2388
|
} finally {
|
|
@@ -3069,7 +3141,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
3069
3141
|
direction: {}
|
|
3070
3142
|
}, plugins = [], renderer = _chunkPSV6XKPOcjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule) {
|
|
3071
3143
|
const toImportPath = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (targetPath) => targetPath.replace(/\\/g, "/"), "toImportPath");
|
|
3072
|
-
const clientPluginEntry =
|
|
3144
|
+
const clientPluginEntry = _chunkICUQICNCcjs.generateFarmClientPluginEntryCode.call(void 0,
|
|
3073
3145
|
plugins,
|
|
3074
3146
|
root,
|
|
3075
3147
|
srcDir,
|
|
@@ -3080,7 +3152,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
3080
3152
|
import { createRoot, hydrateRoot } from "react-dom/client";` : appSetupPath ? `import React, { createRoot, hydrateRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)};
|
|
3081
3153
|
import __farmAppSetup from ${JSON.stringify(_chunk5QIKR7RRcjs.toPosixPath.call(void 0, appSetupPath))};
|
|
3082
3154
|
__farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};`;
|
|
3083
|
-
const providerClientCode =
|
|
3155
|
+
const providerClientCode = _chunkICUQICNCcjs.generateFarmIntegrationProviderClientCode.call(void 0,
|
|
3084
3156
|
integrationProviders,
|
|
3085
3157
|
root,
|
|
3086
3158
|
_nullishCoalesce(renderer.componentExtensions, () => ( []))
|
|
@@ -3094,8 +3166,10 @@ __farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot
|
|
|
3094
3166
|
if (!layout.hasIsolatedClientBoundaries) {
|
|
3095
3167
|
layoutImportStatements.push(`import Layout${index} from "${relativePath}";`);
|
|
3096
3168
|
}
|
|
3169
|
+
const groupScope = _chunkIPXLADVOcjs.getRouteGroupScope.call(void 0, layout.pattern);
|
|
3170
|
+
const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(_chunkIPXLADVOcjs.stripRouteGroups.call(void 0, layout.pattern))}, groupScope: ${JSON.stringify(groupScope)}` : "";
|
|
3097
3171
|
layoutRegistrations.push(
|
|
3098
|
-
` { pattern: ${JSON.stringify(layout.pattern)}, Component: ${layout.hasIsolatedClientBoundaries ? "null" : `Layout${index}`}, shouldHydrate: ${JSON.stringify(layout.shouldHydrate)}, islandStrategy: ${JSON.stringify(layout.islandStrategy)} }`
|
|
3172
|
+
` { pattern: ${JSON.stringify(layout.pattern)}${groupFields}, Component: ${layout.hasIsolatedClientBoundaries ? "null" : `Layout${index}`}, shouldHydrate: ${JSON.stringify(layout.shouldHydrate)}, islandStrategy: ${JSON.stringify(layout.islandStrategy)} }`
|
|
3099
3173
|
);
|
|
3100
3174
|
});
|
|
3101
3175
|
const layoutImports = layoutImportStatements.join("\n");
|
|
@@ -3143,7 +3217,7 @@ function isFarmDocsPath() {
|
|
|
3143
3217
|
return false;
|
|
3144
3218
|
}
|
|
3145
3219
|
`;
|
|
3146
|
-
const docsAdapterRuntime =
|
|
3220
|
+
const docsAdapterRuntime = _chunkHITLGIAOcjs.generateFarmDocsAdapterClientRuntime.call(void 0,
|
|
3147
3221
|
docsAdapterReact,
|
|
3148
3222
|
docsConfigModule
|
|
3149
3223
|
);
|
|
@@ -3152,7 +3226,7 @@ function isFarmDocsPath() {
|
|
|
3152
3226
|
// Farm.js Client Runtime (no client components)
|
|
3153
3227
|
${cssImport}
|
|
3154
3228
|
${layoutImports}
|
|
3155
|
-
import { createClientCancellation, createClientPluginManager, getHashTargetElement, installChunkErrorRecovery, isFarmExternalNavigationURL, reconcileFarmDocumentHead, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
|
|
3229
|
+
import { createClientCancellation, createClientPluginManager, getHashTargetElement, installChunkErrorRecovery, isFarmBlockedNavigationURL, isFarmExternalNavigationURL, reconcileFarmDocumentHead, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
|
|
3156
3230
|
import { createFarmDeploymentMismatchError, createFarmDeploymentRequestHeaders, isFarmDeploymentMismatchResponse } from "@farm.js/core/deployment";
|
|
3157
3231
|
${clientPluginEntry.imports}
|
|
3158
3232
|
${clientCachePersistence.imports}
|
|
@@ -3176,6 +3250,7 @@ ${generateUniversalRouterStateProperties()}
|
|
|
3176
3250
|
|
|
3177
3251
|
navigate: async function(href, options = {}) {
|
|
3178
3252
|
const url = new URL(href, window.location.href);
|
|
3253
|
+
if (isFarmBlockedNavigationURL(url)) return;
|
|
3179
3254
|
if (isFarmExternalNavigationURL(url, window.location.origin)) {
|
|
3180
3255
|
this.cancelActiveNavigation();
|
|
3181
3256
|
if (options.replace || options.action === "replace") window.location.replace(href);
|
|
@@ -3439,7 +3514,8 @@ document.addEventListener("click", function(e) {
|
|
|
3439
3514
|
}
|
|
3440
3515
|
const load = page.pageShouldHydrate ? `() => import(${JSON.stringify(toImportPath(page.modulePath))}).then((module) => module.default)` : "null";
|
|
3441
3516
|
routeEntries.push(` {
|
|
3442
|
-
pattern: ${JSON.stringify(page.pattern)}
|
|
3517
|
+
pattern: ${JSON.stringify(page.pattern)},${page.directory ? `
|
|
3518
|
+
directory: ${JSON.stringify(page.directory)},` : ""}
|
|
3443
3519
|
pageShouldHydrate: ${JSON.stringify(page.pageShouldHydrate)},
|
|
3444
3520
|
${page.hasIsolatedClientBoundaries ? "hasIsolatedClientBoundaries: true," : ""}
|
|
3445
3521
|
islandStrategy: ${JSON.stringify(page.islandStrategy)},
|
|
@@ -3448,20 +3524,22 @@ document.addEventListener("click", function(e) {
|
|
|
3448
3524
|
}`);
|
|
3449
3525
|
});
|
|
3450
3526
|
const isolatedHydrationEnabled = isolatedBoundaryModules.size > 0;
|
|
3451
|
-
const
|
|
3527
|
+
const serverTreeEnabled = isolatedHydrationEnabled && clientPages.some((page) => page.serverTree);
|
|
3528
|
+
const isolatedHydrationImport = isolatedHydrationEnabled ? `import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph } from "@farm.js/core/internal/isolated-boundary";${serverTreeEnabled ? '\nimport { createFarmServerTreeElement } from "@farm.js/core/internal/server-tree";' : ""}` : "";
|
|
3452
3529
|
const isolatedHydrationRuntime = isolatedHydrationEnabled ? `const farmIsolatedBoundaryLoaders = {
|
|
3453
3530
|
${Array.from(isolatedBoundaryModules.entries()).map(
|
|
3454
3531
|
([reference, modulePath]) => ` ${JSON.stringify(reference)}: () => import(${JSON.stringify(modulePath)}),`
|
|
3455
3532
|
).join("\n")}
|
|
3456
3533
|
};
|
|
3534
|
+
async function loadFarmIsolatedBoundary(reference) {
|
|
3535
|
+
const loader = farmIsolatedBoundaryLoaders[reference];
|
|
3536
|
+
if (!loader) throw new Error("isolated client boundary loader was not found: " + reference);
|
|
3537
|
+
return loader();
|
|
3538
|
+
}
|
|
3457
3539
|
const farmIsolatedHydrationRuntime = createFarmIsolatedHydrationRuntime({
|
|
3458
3540
|
ReactRuntime: React,
|
|
3459
3541
|
hydrateRoot,
|
|
3460
|
-
load:
|
|
3461
|
-
const loader = farmIsolatedBoundaryLoaders[reference];
|
|
3462
|
-
if (!loader) throw new Error("isolated client boundary loader was not found: " + reference);
|
|
3463
|
-
return loader();
|
|
3464
|
-
},
|
|
3542
|
+
load: loadFarmIsolatedBoundary,
|
|
3465
3543
|
schedule: scheduleFarmIslandHydration,
|
|
3466
3544
|
wrap: wrapWithIntegrationProviders,
|
|
3467
3545
|
});
|
|
@@ -3475,7 +3553,21 @@ function disposeFarmIsolatedClientBoundaries(scope) {
|
|
|
3475
3553
|
|
|
3476
3554
|
async function hydrateFarmIsolatedClientBoundaries(scope = document, signal) {
|
|
3477
3555
|
await farmIsolatedHydrationRuntime.hydrate(scope, signal);
|
|
3478
|
-
}
|
|
3556
|
+
}
|
|
3557
|
+
${serverTreeEnabled ? `
|
|
3558
|
+
// A server-tree page (an async page below a hydrating layout) rebuilds in the layout's root.
|
|
3559
|
+
async function createFarmServerTreePageElement(source, pathname) {
|
|
3560
|
+
try {
|
|
3561
|
+
return await createFarmServerTreeElement(React, source, {
|
|
3562
|
+
load: loadFarmIsolatedBoundary,
|
|
3563
|
+
ServerHtml: FarmServerPage,
|
|
3564
|
+
key: pathname,
|
|
3565
|
+
});
|
|
3566
|
+
} catch (error) {
|
|
3567
|
+
console.warn("[Farm.js] Could not rebuild the server tree of " + pathname + "; its server HTML was kept.", error);
|
|
3568
|
+
return null;
|
|
3569
|
+
}
|
|
3570
|
+
}` : "async function createFarmServerTreePageElement() { return null; }"}` : `async function createFarmServerTreePageElement() { return null; }`;
|
|
3479
3571
|
const routeClientGraphRuntime = isolatedHydrationEnabled ? `function wrapFarmRouteClientGraph(element) {
|
|
3480
3572
|
return wrapFarmIsolatedClientGraph(React, element);
|
|
3481
3573
|
}` : `function wrapFarmRouteClientGraph(element) { return element; }`;
|
|
@@ -3499,7 +3591,7 @@ ${layoutImports}
|
|
|
3499
3591
|
${rendererClientImports}
|
|
3500
3592
|
${isolatedHydrationImport}
|
|
3501
3593
|
${providerClientCode.imports}
|
|
3502
|
-
import { createClientCancellation, createClientPluginManager, getHashTargetElement, installChunkErrorRecovery, isFarmExternalNavigationURL, reconcileFarmDocumentHead, scheduleFarmIslandHydration, searchParamsToObject, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
|
|
3594
|
+
import { createClientCancellation, createClientPluginManager, getHashTargetElement, installChunkErrorRecovery, isFarmBlockedNavigationURL, isFarmExternalNavigationURL, reconcileFarmDocumentHead, scheduleFarmIslandHydration, searchParamsToObject, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
|
|
3503
3595
|
import { createFarmDeploymentMismatchError, createFarmDeploymentRequestHeaders, isFarmDeploymentMismatchResponse } from "@farm.js/core/deployment";
|
|
3504
3596
|
import { createFarmRouter, isFarmRouteActive, matchFarmRoute } from "@farm.js/core/router";
|
|
3505
3597
|
${clientPluginEntry.imports}
|
|
@@ -3542,11 +3634,24 @@ ${layoutRegistrations.join(",\n")}
|
|
|
3542
3634
|
function getApplicableLayouts(pathname) {
|
|
3543
3635
|
const applicable = [];
|
|
3544
3636
|
const normalizedPath = getFarmRoutePathname(pathname).replace(/\\/$/, '') || '/';
|
|
3637
|
+
let directory;
|
|
3545
3638
|
|
|
3546
3639
|
for (const layout of layoutRoutes) {
|
|
3547
|
-
|
|
3548
|
-
|
|
3640
|
+
// Route groups add no URL segment: match the layout's URL, then keep a
|
|
3641
|
+
// grouped layout to the pages inside its group directory.
|
|
3642
|
+
const urlPattern = layout.urlPattern || layout.pattern;
|
|
3643
|
+
if (urlPattern !== '/' && !isFarmRouteActive(urlPattern, normalizedPath, { exact: false })) continue;
|
|
3644
|
+
if (layout.groupScope) {
|
|
3645
|
+
if (directory === undefined) {
|
|
3646
|
+
const matched = matchRoute(pathname);
|
|
3647
|
+
directory = matched ? matched.route.directory || matched.route.pattern : null;
|
|
3648
|
+
}
|
|
3649
|
+
if (
|
|
3650
|
+
typeof directory !== 'string' ||
|
|
3651
|
+
(directory !== layout.groupScope && !directory.startsWith(layout.groupScope + '/'))
|
|
3652
|
+
) continue;
|
|
3549
3653
|
}
|
|
3654
|
+
applicable.push(layout);
|
|
3550
3655
|
}
|
|
3551
3656
|
|
|
3552
3657
|
// Sort by depth (root first)
|
|
@@ -3565,7 +3670,7 @@ function hasHydratableLayout(pathname) {
|
|
|
3565
3670
|
});
|
|
3566
3671
|
}
|
|
3567
3672
|
|
|
3568
|
-
${
|
|
3673
|
+
${_chunkICUQICNCcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
|
|
3569
3674
|
// Wrap a page element with applicable layouts
|
|
3570
3675
|
function wrapWithLayouts(pageElement, pathname, params) {
|
|
3571
3676
|
const layouts = getApplicableLayouts(pathname);
|
|
@@ -3615,7 +3720,17 @@ async function loadRouteComponent(route) {
|
|
|
3615
3720
|
return route.Component;
|
|
3616
3721
|
}
|
|
3617
3722
|
|
|
3618
|
-
|
|
3723
|
+
// The props the server rendered this document with, as the page receives them:
|
|
3724
|
+
// middleware data arrives as a plain object and is a Map again here.
|
|
3725
|
+
function reviveServerPageProps(serverProps) {
|
|
3726
|
+
if (!serverProps || typeof serverProps !== "object") return {};
|
|
3727
|
+
const middleware = serverProps.middleware;
|
|
3728
|
+
return middleware && middleware.data && !(middleware.data instanceof Map)
|
|
3729
|
+
? { ...serverProps, middleware: { ...middleware, data: new Map(Object.entries(middleware.data)) } }
|
|
3730
|
+
: serverProps;
|
|
3731
|
+
}
|
|
3732
|
+
|
|
3733
|
+
async function createMatchedHydrationRoute(matched, pathname, searchParams, serverHtml, serverProps) {
|
|
3619
3734
|
const hydrateLayouts = hasHydratableLayout(pathname);
|
|
3620
3735
|
const params = matched.params;
|
|
3621
3736
|
let pageElement = null;
|
|
@@ -3623,22 +3738,43 @@ async function createMatchedHydrationRoute(matched, pathname, searchParams, serv
|
|
|
3623
3738
|
if (matched.route.pageShouldHydrate) {
|
|
3624
3739
|
const Component = await loadRouteComponent(matched.route);
|
|
3625
3740
|
if (!Component) return null;
|
|
3626
|
-
|
|
3741
|
+
// A programmatic page whose guard and data run only on the server renders
|
|
3742
|
+
// from the props the server resolved for this document. Without them (a
|
|
3743
|
+
// rejected guard, deferred data) its server-rendered HTML is kept.
|
|
3744
|
+
if (Component.__farmServerProps === true) {
|
|
3745
|
+
if (!serverProps || serverProps.__farmRoutePropsResolved !== true) return null;
|
|
3746
|
+
const props = {
|
|
3747
|
+
...reviveServerPageProps(serverProps),
|
|
3748
|
+
searchParams: Promise.resolve(serverProps.search ?? searchParams),
|
|
3749
|
+
};
|
|
3750
|
+
pageElement = React.createElement(Component, props);
|
|
3751
|
+
} else if (typeof Component === "function" && Component.constructor && Component.constructor.name === "AsyncFunction") {
|
|
3627
3752
|
console.warn(
|
|
3628
3753
|
"[Farm.js] Skipping hydration for " + pathname +
|
|
3629
3754
|
": async server components cannot run in the browser. Server-rendered HTML is preserved."
|
|
3630
3755
|
);
|
|
3631
3756
|
return null;
|
|
3757
|
+
} else {
|
|
3758
|
+
// Keep what the server rendered with, such as middleware data, so the
|
|
3759
|
+
// first render matches the HTML. A navigation passes the fetched document's props.
|
|
3760
|
+
const props = {
|
|
3761
|
+
...reviveServerPageProps(serverProps),
|
|
3762
|
+
params: params,
|
|
3763
|
+
searchParams: Promise.resolve(searchParams),
|
|
3764
|
+
};
|
|
3765
|
+
pageElement = React.createElement(Component, props);
|
|
3632
3766
|
}
|
|
3633
|
-
const props = { params: params, searchParams: Promise.resolve(searchParams) };
|
|
3634
|
-
pageElement = React.createElement(Component, props);
|
|
3635
3767
|
} else if (hydrateLayouts) {
|
|
3636
3768
|
const serverPage = document.getElementById("__farm_page__");
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3769
|
+
const pageSource = typeof serverHtml === "string" ? serverHtml : serverPage;
|
|
3770
|
+
const serverTree = pageSource ? await createFarmServerTreePageElement(pageSource, pathname) : null;
|
|
3771
|
+
pageElement = serverTree
|
|
3772
|
+
? createLayoutPageBoundary(matched.route, serverTree)
|
|
3773
|
+
: createLayoutPageBoundary(
|
|
3774
|
+
matched.route,
|
|
3775
|
+
null,
|
|
3776
|
+
typeof serverHtml === "string" ? serverHtml : serverPage ? serverPage.innerHTML : "",
|
|
3777
|
+
);
|
|
3642
3778
|
}
|
|
3643
3779
|
|
|
3644
3780
|
if (!pageElement) return null;
|
|
@@ -3702,6 +3838,32 @@ function findClientRouteSlot(slot) {
|
|
|
3702
3838
|
});
|
|
3703
3839
|
}
|
|
3704
3840
|
|
|
3841
|
+
/**
|
|
3842
|
+
* The page props a fetched document embeds in its bootstrap script, which a
|
|
3843
|
+
* client navigation does not execute. The JSON ends at the first statement
|
|
3844
|
+
* boundary where it parses, so the separator inside a string cannot cut it.
|
|
3845
|
+
*/
|
|
3846
|
+
function readPagePropsPayload(doc) {
|
|
3847
|
+
const prefix = "window.__FARM_PROPS__=";
|
|
3848
|
+
const separator = ";window.__FARM_INTEGRATION_API_MANIFEST__=";
|
|
3849
|
+
for (const script of doc.querySelectorAll("script:not([src])")) {
|
|
3850
|
+
const source = script.textContent || "";
|
|
3851
|
+
if (!source.startsWith(prefix)) continue;
|
|
3852
|
+
for (
|
|
3853
|
+
let end = source.indexOf(separator, prefix.length);
|
|
3854
|
+
end !== -1;
|
|
3855
|
+
end = source.indexOf(separator, end + 1)
|
|
3856
|
+
) {
|
|
3857
|
+
try {
|
|
3858
|
+
return JSON.parse(source.slice(prefix.length, end));
|
|
3859
|
+
} catch {
|
|
3860
|
+
// The separator was inside a string value; try the next one.
|
|
3861
|
+
}
|
|
3862
|
+
}
|
|
3863
|
+
}
|
|
3864
|
+
return undefined;
|
|
3865
|
+
}
|
|
3866
|
+
|
|
3705
3867
|
function readRouteSlotPayload(doc) {
|
|
3706
3868
|
const script = doc.getElementById("__farm_route_slots_data__");
|
|
3707
3869
|
if (!script?.textContent) return [];
|
|
@@ -3898,6 +4060,8 @@ async function hydrate() {
|
|
|
3898
4060
|
matched,
|
|
3899
4061
|
pathname,
|
|
3900
4062
|
searchParams,
|
|
4063
|
+
undefined,
|
|
4064
|
+
window.__FARM_PROPS__,
|
|
3901
4065
|
);
|
|
3902
4066
|
if (!routeState) return;
|
|
3903
4067
|
const shouldHydrate = !isHydrated && Boolean(container.innerHTML.trim());
|
|
@@ -4012,6 +4176,7 @@ ${generateUniversalRouterStateProperties()}
|
|
|
4012
4176
|
|
|
4013
4177
|
navigate: async function(href, options = {}) {
|
|
4014
4178
|
const url = new URL(href, window.location.href);
|
|
4179
|
+
if (isFarmBlockedNavigationURL(url)) return;
|
|
4015
4180
|
if (isFarmExternalNavigationURL(url, window.location.origin)) {
|
|
4016
4181
|
this.cancelActiveNavigation();
|
|
4017
4182
|
if (options.replace || options.action === "replace") window.location.replace(href);
|
|
@@ -4244,6 +4409,7 @@ ${generateUniversalRouterStateProperties()}
|
|
|
4244
4409
|
if (isFarmLocaleDocumentChange(doc)) return false;
|
|
4245
4410
|
if (doc.getElementById("nd-docs-layout")) return false;
|
|
4246
4411
|
const nextRouteSlots = readRouteSlotPayload(doc);
|
|
4412
|
+
const nextPageProps = readPagePropsPayload(doc);
|
|
4247
4413
|
const isNavigationCurrent = () =>
|
|
4248
4414
|
this.isCurrentNavigation(navigation, clientNavigation);
|
|
4249
4415
|
|
|
@@ -4274,6 +4440,7 @@ ${generateUniversalRouterStateProperties()}
|
|
|
4274
4440
|
newPathname,
|
|
4275
4441
|
searchParams,
|
|
4276
4442
|
nextPage ? nextPage.innerHTML : "",
|
|
4443
|
+
nextPageProps,
|
|
4277
4444
|
);
|
|
4278
4445
|
if (!isNavigationCurrent()) return false;
|
|
4279
4446
|
if (routeState) {
|
|
@@ -4309,6 +4476,8 @@ ${generateUniversalRouterStateProperties()}
|
|
|
4309
4476
|
matched,
|
|
4310
4477
|
newPathname,
|
|
4311
4478
|
searchParams,
|
|
4479
|
+
undefined,
|
|
4480
|
+
nextPageProps,
|
|
4312
4481
|
);
|
|
4313
4482
|
if (!isNavigationCurrent()) return false;
|
|
4314
4483
|
if (routeState) {
|
|
@@ -4480,7 +4649,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4480
4649
|
_path2.default.join(postcssConfigDir, "postcss.config.cjs"),
|
|
4481
4650
|
"module.exports = { plugins: [] };\n"
|
|
4482
4651
|
);
|
|
4483
|
-
tailwindVitePlugin = await
|
|
4652
|
+
tailwindVitePlugin = await _chunkICUQICNCcjs.loadTailwindVitePlugin.call(void 0, {
|
|
4484
4653
|
builder: productionVite.builder,
|
|
4485
4654
|
label: "for SSR"
|
|
4486
4655
|
});
|
|
@@ -4554,7 +4723,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4554
4723
|
modulePath: entry.modulePath
|
|
4555
4724
|
})
|
|
4556
4725
|
);
|
|
4557
|
-
const i18nCatalogs = config.i18n.enabled ? (await
|
|
4726
|
+
const i18nCatalogs = config.i18n.enabled ? (await _chunkUFDAAQFXcjs.readFarmI18nCatalogs.call(void 0, config.i18n)).catalogs : {};
|
|
4558
4727
|
const appDirs = _chunkVPTDD5XFcjs.getFarmAppDirectories.call(void 0, config);
|
|
4559
4728
|
let openAPIReference = null;
|
|
4560
4729
|
if (config.openapi.enabled && config.openapi.route) {
|
|
@@ -4576,7 +4745,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4576
4745
|
}
|
|
4577
4746
|
const middlewareRoutes = await discoverMiddlewareRoutes(appDirs);
|
|
4578
4747
|
const instrumentationPath = _chunkKCMTCM6Icjs.resolveFarmInstrumentationFile.call(void 0, root, config.srcDir || "src");
|
|
4579
|
-
const notFoundPath =
|
|
4748
|
+
const notFoundPath = _chunkICUQICNCcjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
|
|
4580
4749
|
if (notFoundPath) _chunk5QIKR7RRcjs.logger.info(`\u{1F4CB} Found custom 404 page: ${notFoundPath}`);
|
|
4581
4750
|
layoutRoutes.sort((a, b) => {
|
|
4582
4751
|
const depthA = a.pattern.split("/").filter(Boolean).length;
|
|
@@ -4593,22 +4762,23 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4593
4762
|
const hasServerRuntimeIntegrations = configuredIntegrationValues.some(
|
|
4594
4763
|
(integration) => typeof integration === "object" && integration !== null && (!("serverRuntime" in integration) || integration.serverRuntime !== false)
|
|
4595
4764
|
);
|
|
4596
|
-
const hasIntegrationProviders =
|
|
4765
|
+
const hasIntegrationProviders = _chunkFTFYRMQQcjs.getIntegrationProviders.call(void 0, config.integrations).some(
|
|
4597
4766
|
(provider) => provider.component || provider.type === "clerk"
|
|
4598
4767
|
);
|
|
4599
4768
|
const hasObservabilityHandler = !!config.observability && typeof config.observability === "object" && "onEvent" in config.observability;
|
|
4600
4769
|
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _56 => _56.mdx, 'optionalAccess', _57 => _57.components]));
|
|
4601
4770
|
const hasMiddlewareConfig = hasFarmMiddlewareConfig(config.middleware);
|
|
4602
|
-
const hasRouteContextConfig =
|
|
4771
|
+
const hasRouteContextConfig = _chunkF7JZENPFcjs.hasCustomFarmRouteContext.call(void 0, config);
|
|
4603
4772
|
const hasServerRuntimePlugins = hasFarmServerRuntimePlugins(config);
|
|
4604
4773
|
const hasPluginRoutes = hasFarmPluginRoutes(config);
|
|
4605
|
-
const
|
|
4774
|
+
const hasServerCacheConfig = hasFarmServerCacheConfig(config.cache);
|
|
4775
|
+
const configModulePath = hasServerRuntimeIntegrations || hasObservabilityHandler || hasMdxComponentConfig || hasMiddlewareConfig || hasRouteContextConfig || hasServerRuntimePlugins || hasPluginRoutes || hasServerCacheConfig || hasIntegrationProviders ? await findFarmConfigPath(root) : null;
|
|
4606
4776
|
const hasRuntimeConfigModule = hasFarmRuntimeConfigModule(config, configModulePath);
|
|
4607
4777
|
const hasRuntimeIntegrationConfig = hasRuntimeConfigModule && hasAnyConfiguredIntegrations;
|
|
4608
4778
|
const hasConfiguredRuntimePlugins = Boolean(
|
|
4609
4779
|
hasRuntimeConfigModule && (config.plugins || []).length > 0
|
|
4610
4780
|
);
|
|
4611
|
-
const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _58 => _58.docs, 'optionalAccess', _59 => _59.enabled]) && _chunkC5GUTBZKcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? _optionalChain([config, 'access', _60 => _60.docs, 'access', _61 => _61.adapter, 'optionalAccess', _62 => _62.server]) ? await
|
|
4781
|
+
const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _58 => _58.docs, 'optionalAccess', _59 => _59.enabled]) && _chunkC5GUTBZKcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? _optionalChain([config, 'access', _60 => _60.docs, 'access', _61 => _61.adapter, 'optionalAccess', _62 => _62.server]) ? await _chunk3UH7MRCPcjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
|
|
4612
4782
|
root,
|
|
4613
4783
|
srcDir: config.srcDir,
|
|
4614
4784
|
clientEntry: FARM_CLIENT_JS_SRC_PLACEHOLDER,
|
|
@@ -4758,7 +4928,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4758
4928
|
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _68 => _68.env, 'optionalAccess', _69 => _69.public]) || {})
|
|
4759
4929
|
},
|
|
4760
4930
|
plugins: [
|
|
4761
|
-
|
|
4931
|
+
_chunkICUQICNCcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
4762
4932
|
...tailwindVitePlugin ? [tailwindVitePlugin] : [],
|
|
4763
4933
|
...rendererVitePlugins,
|
|
4764
4934
|
...config.vite.plugins || [],
|
|
@@ -4766,7 +4936,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4766
4936
|
{ ...createReactProductionModePlugin(), enforce: "pre" },
|
|
4767
4937
|
farmServerOnlyEntriesPlugin(),
|
|
4768
4938
|
farmPlugin({ ...config, isolatedClientBoundaryModules }, pluginManager),
|
|
4769
|
-
|
|
4939
|
+
_chunk3SDFA7UFcjs.farmEnvironmentFunctionsPlugin.call(void 0, ),
|
|
4770
4940
|
{
|
|
4771
4941
|
name: "farm-virtual-ssr-entry",
|
|
4772
4942
|
resolveId(id) {
|
|
@@ -4805,7 +4975,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4805
4975
|
resolve: {
|
|
4806
4976
|
alias: [
|
|
4807
4977
|
...shouldAliasReactServerToWebBuild(config.renderer, preset) ? [createFarmReactWebServerAlias(hasReactDomEdgeServerBuild(root))] : [],
|
|
4808
|
-
...Object.entries(
|
|
4978
|
+
...Object.entries(_chunkICUQICNCcjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
|
|
4809
4979
|
([find, replacement]) => ({ find, replacement })
|
|
4810
4980
|
)
|
|
4811
4981
|
],
|
|
@@ -4813,7 +4983,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
4813
4983
|
dedupe: [...config.renderer.dedupe || []]
|
|
4814
4984
|
}
|
|
4815
4985
|
};
|
|
4816
|
-
await viteBuild(
|
|
4986
|
+
await viteBuild(_chunkICUQICNCcjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
|
|
4817
4987
|
} finally {
|
|
4818
4988
|
if (postcssConfigDir) {
|
|
4819
4989
|
try {
|
|
@@ -4999,8 +5169,8 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, generateConfiguredResponseHeadersRuntimeSo
|
|
|
4999
5169
|
function parseRouteRenderingDirectiveFromDisk(modulePath) {
|
|
5000
5170
|
try {
|
|
5001
5171
|
const source = _fs.readFileSync.call(void 0, modulePath, "utf8");
|
|
5002
|
-
const directive =
|
|
5003
|
-
if (
|
|
5172
|
+
const directive = _chunk3BHT4WMPcjs.parseRouteRenderingDirective.call(void 0, source);
|
|
5173
|
+
if (_chunk3BHT4WMPcjs.findRequestBoundSourceBlockers.call(void 0, source).length === 0) return directive;
|
|
5004
5174
|
return { ..._nullishCoalesce(directive, () => ( { ssg: false, ppr: false, directive: "" })), requestBound: true };
|
|
5005
5175
|
} catch (e22) {
|
|
5006
5176
|
return void 0;
|
|
@@ -5192,11 +5362,12 @@ function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlot
|
|
|
5192
5362
|
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access', _76 => _76.agent, 'optionalAccess', _77 => _77.crawlers, 'optionalAccess', _78 => _78.enabled])) && !applicationMetadataRoutes.some(
|
|
5193
5363
|
(metadata) => metadata.kind === "robots" && metadata.pattern === "/"
|
|
5194
5364
|
);
|
|
5365
|
+
const servesAiCatalog = _optionalChain([config, 'access', _79 => _79.agent, 'optionalAccess', _80 => _80.aiCatalog]) !== false;
|
|
5195
5366
|
const hasPluginRuntime = hasRuntimeIntegrationConfig || hasServerRuntimePlugins;
|
|
5196
5367
|
const hasInfraAnalyticsRuntime = config.analytics !== false && _chunk2SJ4RQ6Pcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
|
|
5197
5368
|
const hasPrecompiledDocs = Boolean(farmDocsPrecompiledManifest);
|
|
5198
5369
|
const adapterOwnsDocsRuntime = Boolean(
|
|
5199
|
-
_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access',
|
|
5370
|
+
_chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _81 => _81.docs, 'optionalAccess', _82 => _82.enabled]) && _optionalChain([config, 'access', _83 => _83.docs, 'access', _84 => _84.adapter, 'optionalAccess', _85 => _85.server]) && config.docs.adapter.react
|
|
5200
5371
|
);
|
|
5201
5372
|
const docsConfigModulePath = adapterOwnsDocsRuntime && !hasPrecompiledDocs && config.docs.configPath && !config.docs.configPath.endsWith(".json") ? config.docs.configPath : void 0;
|
|
5202
5373
|
const hasIsolatedClientGraphRuntime = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) && isolatedClientBoundaryModules.size > 0;
|
|
@@ -5206,7 +5377,7 @@ function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlot
|
|
|
5206
5377
|
);
|
|
5207
5378
|
const hasReactSyncRender = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer);
|
|
5208
5379
|
const rendererServerImports = _chunkPSV6XKPOcjs.isReactRenderer.call(void 0, config.renderer) ? `import * as React from "react";
|
|
5209
|
-
import * as ReactDOMServer from "react-dom/server";${hasIsolatedClientGraphRuntime ? '\nimport { isolateFarmServerPageGraph, wrapFarmIsolatedClientGraph } from "@farm.js/core/internal/isolated-boundary";' : ""}` : `import React, * as ReactDOMServer from ${JSON.stringify(config.renderer.server)};${generateFarmRendererAppSetupServerCode(config)}`;
|
|
5380
|
+
import * as ReactDOMServer from "react-dom/server";${hasIsolatedClientGraphRuntime ? '\nimport { isolateFarmServerPageGraph, wrapFarmIsolatedClientGraph } from "@farm.js/core/internal/isolated-boundary";\nimport { renderFarmServerTreePage } from "@farm.js/core/internal/server-tree";' : ""}` : `import React, * as ReactDOMServer from ${JSON.stringify(config.renderer.server)};${generateFarmRendererAppSetupServerCode(config)}`;
|
|
5210
5381
|
const routeClientGraphServerRuntime = hasIsolatedClientGraphRuntime ? `function wrapFarmRouteClientGraph(element) {
|
|
5211
5382
|
return wrapFarmIsolatedClientGraph(React, element);
|
|
5212
5383
|
}
|
|
@@ -5215,15 +5386,23 @@ import * as ReactDOMServer from "react-dom/server";${hasIsolatedClientGraphRunti
|
|
|
5215
5386
|
// components render as their own islands instead of joining the layout's React tree.
|
|
5216
5387
|
function isolateFarmRouteServerPage(element) {
|
|
5217
5388
|
return isolateFarmServerPageGraph(React, element);
|
|
5389
|
+
}
|
|
5390
|
+
|
|
5391
|
+
// An async page below a hydrating layout renders as a serialized tree the browser rebuilds in
|
|
5392
|
+
// the layout's React root, so its client components read the layout's context.
|
|
5393
|
+
function renderFarmRouteServerTree(element) {
|
|
5394
|
+
return renderFarmServerTreePage(React, element, { isolate: isolateFarmRouteServerPage });
|
|
5218
5395
|
}` : `function wrapFarmRouteClientGraph(element) { return element; }
|
|
5219
5396
|
|
|
5220
|
-
function isolateFarmRouteServerPage(element) { return element; }
|
|
5397
|
+
function isolateFarmRouteServerPage(element) { return element; }
|
|
5398
|
+
|
|
5399
|
+
function renderFarmRouteServerTree(element) { return element; }`;
|
|
5221
5400
|
const hasGeneratedMetadataImages = metadataImageRoutes.some(
|
|
5222
5401
|
(image) => image.sourceType === "module"
|
|
5223
5402
|
);
|
|
5224
5403
|
const hasMiddlewareRuntime = middlewareRoutes.length > 0 || hasFarmMiddlewareConfig(config.middleware);
|
|
5225
|
-
const farmDocsFontAssets = _optionalChain([config, 'access',
|
|
5226
|
-
const integrationProviders =
|
|
5404
|
+
const farmDocsFontAssets = _optionalChain([config, 'access', _86 => _86.docs, 'optionalAccess', _87 => _87.enabled]) ? _chunkHREOKQWTcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkHREOKQWTcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
|
|
5405
|
+
const integrationProviders = _chunkFTFYRMQQcjs.getIntegrationProviders.call(void 0, config.integrations);
|
|
5227
5406
|
const renderedIntegrationProviders = integrationProviders.filter(
|
|
5228
5407
|
(provider) => provider.component || provider.type === "clerk"
|
|
5229
5408
|
);
|
|
@@ -5232,16 +5411,16 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5232
5411
|
`Integration provider components are not supported by the "${config.renderer.name}" renderer.`
|
|
5233
5412
|
);
|
|
5234
5413
|
}
|
|
5235
|
-
const providerServerModules =
|
|
5414
|
+
const providerServerModules = _chunkICUQICNCcjs.generateFarmIntegrationProviderServerModules.call(void 0,
|
|
5236
5415
|
renderedIntegrationProviders,
|
|
5237
5416
|
config.root,
|
|
5238
5417
|
_nullishCoalesce(config.renderer.componentExtensions, () => ( []))
|
|
5239
5418
|
);
|
|
5240
5419
|
const resolvedIntegrationProviderFallback = Object.fromEntries(
|
|
5241
5420
|
Object.entries(config.integrations).flatMap(([name, integration]) => {
|
|
5242
|
-
const configuredProviders = _optionalChain([integration, 'optionalAccess',
|
|
5421
|
+
const configuredProviders = _optionalChain([integration, 'optionalAccess', _88 => _88.providers]);
|
|
5243
5422
|
const providers = Array.isArray(configuredProviders) ? configuredProviders : [];
|
|
5244
|
-
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess',
|
|
5423
|
+
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess', _89 => _89.component]) === "function")) {
|
|
5245
5424
|
throw new Error(
|
|
5246
5425
|
`Integration provider components in production must use an importable component reference, for example component: { module: "@/components/provider" }.`
|
|
5247
5426
|
);
|
|
@@ -5252,18 +5431,17 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5252
5431
|
const unsupportedIntegrationProvider = renderedIntegrationProviders.find(
|
|
5253
5432
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
5254
5433
|
);
|
|
5255
|
-
const isolatedHydrationMode =
|
|
5256
|
-
_optionalChain([config, 'access',
|
|
5434
|
+
const isolatedHydrationMode = _chunkICUQICNCcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
5435
|
+
_optionalChain([config, 'access', _90 => _90.experimental, 'optionalAccess', _91 => _91.isolatedClientHydration]),
|
|
5257
5436
|
{
|
|
5258
|
-
serverComponents: _optionalChain([config, 'access',
|
|
5437
|
+
serverComponents: _optionalChain([config, 'access', _92 => _92.experimental, 'optionalAccess', _93 => _93.serverComponents]) === true,
|
|
5259
5438
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
5260
5439
|
}
|
|
5261
5440
|
);
|
|
5262
|
-
const hydrationPlanOptions =
|
|
5441
|
+
const hydrationPlanOptions = _chunkICUQICNCcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
5263
5442
|
config.renderer,
|
|
5264
5443
|
Boolean(unsupportedIntegrationProvider)
|
|
5265
5444
|
);
|
|
5266
|
-
const layoutAppliesToRoute = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (layoutPattern, routePattern) => layoutPattern === "/" || routePattern === layoutPattern || routePattern.startsWith(`${layoutPattern}/`), "layoutAppliesToRoute");
|
|
5267
5445
|
const layoutHydrationPlans = layoutRoutes.map((layout) => ({
|
|
5268
5446
|
...layout,
|
|
5269
5447
|
hydration: getCachedClientModuleHydrationPlan(
|
|
@@ -5274,7 +5452,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5274
5452
|
hydrationPlanOptions
|
|
5275
5453
|
)
|
|
5276
5454
|
}));
|
|
5277
|
-
const markdownPagePlan =
|
|
5455
|
+
const markdownPagePlan = _chunkICUQICNCcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
5278
5456
|
_chunkOHY2ZWUGcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunkOHY2ZWUGcjs.resolveMdxConfig.call(void 0, config.mdx), config.root),
|
|
5279
5457
|
config.root,
|
|
5280
5458
|
isolatedHydrationMode,
|
|
@@ -5283,7 +5461,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5283
5461
|
const pageHydrationPlans = new Map(
|
|
5284
5462
|
pageRoutes.map((route) => [
|
|
5285
5463
|
route.modulePath,
|
|
5286
|
-
|
|
5464
|
+
_chunkEFCQPQMGcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
|
|
5287
5465
|
route.modulePath,
|
|
5288
5466
|
config.root,
|
|
5289
5467
|
isolatedHydrationMode,
|
|
@@ -5292,18 +5470,19 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5292
5470
|
)
|
|
5293
5471
|
])
|
|
5294
5472
|
);
|
|
5295
|
-
|
|
5473
|
+
_chunkICUQICNCcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
5296
5474
|
layoutHydrationPlans.map((layout) => ({
|
|
5297
5475
|
pattern: layout.pattern,
|
|
5298
5476
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
5299
5477
|
metadata: layout.hydration
|
|
5300
5478
|
})),
|
|
5301
5479
|
pageRoutes.map((route) => ({
|
|
5302
|
-
|
|
5303
|
-
|
|
5480
|
+
// Compared by directory so a grouped layout applies only inside its group.
|
|
5481
|
+
pattern: _nullishCoalesce(route.directory, () => ( route.pattern)),
|
|
5482
|
+
depth: _chunkIPXLADVOcjs.getRouteDirectoryDepth.call(void 0, _nullishCoalesce(route.directory, () => ( route.pattern))),
|
|
5304
5483
|
metadata: pageHydrationPlans.get(route.modulePath)
|
|
5305
5484
|
})),
|
|
5306
|
-
|
|
5485
|
+
_chunkIPXLADVOcjs.routeBoundaryCoversDirectory
|
|
5307
5486
|
);
|
|
5308
5487
|
const providerServerImports = [
|
|
5309
5488
|
providerServerModules.hasClerkProvider ? `import { ClerkProvider as FarmClerkProvider } from "@clerk/react";` : "",
|
|
@@ -5320,7 +5499,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5320
5499
|
apiRegistrations.push(`
|
|
5321
5500
|
{
|
|
5322
5501
|
path: ${JSON.stringify(route.path)},
|
|
5323
|
-
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access',
|
|
5502
|
+
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access', _94 => _94.pluginMethods, 'optionalAccess', _95 => _95.includes, 'call', _96 => _96(method)])))},
|
|
5324
5503
|
endpoints: ${varName},
|
|
5325
5504
|
}`);
|
|
5326
5505
|
});
|
|
@@ -5333,10 +5512,11 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5333
5512
|
}).map(({ route }) => route);
|
|
5334
5513
|
orderedPageRoutes.forEach((route, index) => {
|
|
5335
5514
|
const varName = `pageRoute${index}`;
|
|
5336
|
-
if (
|
|
5515
|
+
if (_chunkEFCQPQMGcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) {
|
|
5337
5516
|
pageRegistrations.push(`
|
|
5338
5517
|
{
|
|
5339
|
-
pattern: ${JSON.stringify(route.pattern)}
|
|
5518
|
+
pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
|
|
5519
|
+
directory: ${JSON.stringify(route.directory)},` : ""}
|
|
5340
5520
|
module: createFarmMarkdownRouteModule({
|
|
5341
5521
|
source: ${JSON.stringify(_nullishCoalesce(route.source, () => ( "")))},
|
|
5342
5522
|
filePath: ${JSON.stringify(toBakedMarkdownSourcePath(config.root, route.modulePath))},
|
|
@@ -5359,10 +5539,11 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5359
5539
|
const renderingDirective = parseRouteRenderingDirectiveFromDisk(route.modulePath);
|
|
5360
5540
|
pageRegistrations.push(`
|
|
5361
5541
|
{
|
|
5362
|
-
pattern: ${JSON.stringify(route.pattern)}
|
|
5542
|
+
pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
|
|
5543
|
+
directory: ${JSON.stringify(route.directory)},` : ""}
|
|
5363
5544
|
module: ${varName},
|
|
5364
5545
|
shouldHydrate: ${JSON.stringify(clientMetadata.shouldHydrate)},
|
|
5365
|
-
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${renderingDirective ? `
|
|
5546
|
+
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${_chunkICUQICNCcjs.usesFarmServerTree.call(void 0, clientMetadata) ? "\n serverTree: true," : ""}${renderingDirective ? `
|
|
5366
5547
|
rendering: ${JSON.stringify(renderingDirective)},` : ""}
|
|
5367
5548
|
${route.source !== void 0 ? `markdownSource: {
|
|
5368
5549
|
source: ${JSON.stringify(route.source)},
|
|
@@ -5403,7 +5584,8 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5403
5584
|
routeSlotRegistrations.push(`
|
|
5404
5585
|
{
|
|
5405
5586
|
name: ${JSON.stringify(slot.name)},
|
|
5406
|
-
ownerPattern: ${JSON.stringify(slot.ownerPattern)}
|
|
5587
|
+
ownerPattern: ${JSON.stringify(slot.ownerPattern)},${slot.ownerDirectory ? `
|
|
5588
|
+
ownerDirectory: ${JSON.stringify(slot.ownerDirectory)},` : ""}
|
|
5407
5589
|
pattern: ${JSON.stringify(slot.pattern)},
|
|
5408
5590
|
containerId: ${JSON.stringify(slot.containerId)},
|
|
5409
5591
|
interception: ${JSON.stringify(slot.interception)},
|
|
@@ -5418,9 +5600,12 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5418
5600
|
errorImports.push(
|
|
5419
5601
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(errorRoute.modulePath)};`
|
|
5420
5602
|
);
|
|
5603
|
+
const groupScope = _chunkIPXLADVOcjs.getRouteGroupScope.call(void 0, errorRoute.pattern);
|
|
5421
5604
|
errorRegistrations.push(`
|
|
5422
5605
|
{
|
|
5423
|
-
pattern: ${JSON.stringify(errorRoute.pattern)}
|
|
5606
|
+
pattern: ${JSON.stringify(_chunkIPXLADVOcjs.stripRouteGroups.call(void 0, errorRoute.pattern))},${groupScope ? `
|
|
5607
|
+
groupScope: ${JSON.stringify(groupScope)},
|
|
5608
|
+
directoryDepth: ${_chunkIPXLADVOcjs.getRouteDirectoryDepth.call(void 0, errorRoute.pattern)},` : ""}
|
|
5424
5609
|
module: ${varName},
|
|
5425
5610
|
}`);
|
|
5426
5611
|
});
|
|
@@ -5476,6 +5661,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5476
5661
|
const notFoundImport = notFoundPath ? `import * as CustomNotFound from ${toVirtualEntryImportSpecifier(notFoundPath)};` : "";
|
|
5477
5662
|
const apiRouteHelpersImport = apiRoutes.length > 0 ? `import { mergePluginAPIRoutes, getAllowedAPIRouteMethods, invokeAPIRouteEndpoint, createStaticAPIRouteMatcherAtBasePath, resolveAPIRouteEndpoint } from "@farm.js/core/api/runtime";` : "";
|
|
5478
5663
|
const productionRuntimeImport = `import {
|
|
5664
|
+
_getRequestReadCount,
|
|
5479
5665
|
_runWithAfterRequest,
|
|
5480
5666
|
_runWithCurrentRequest,
|
|
5481
5667
|
_runWithAPIRequestRuntime,
|
|
@@ -5497,13 +5683,18 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5497
5683
|
createDefaultErrorMarkup,
|
|
5498
5684
|
createFarmInstrumentationLifecycle,
|
|
5499
5685
|
createFarmLayoutSelector,
|
|
5686
|
+
isInFarmRouteGroupScope,
|
|
5500
5687
|
createFarmCacheKey,
|
|
5501
5688
|
createFarmMetadataRouteResponse,
|
|
5502
5689
|
createFarmAgentRobots,
|
|
5690
|
+
createFarmAiCatalogResponse,
|
|
5503
5691
|
createFarmApiCatalogResponse,
|
|
5692
|
+
createFarmAppManifestResponse,
|
|
5504
5693
|
collectFarmLlmsTxtPages,
|
|
5505
5694
|
createFarmDefaultLlmsTxt,
|
|
5506
5695
|
createFarmLlmsMarkdownReader,
|
|
5696
|
+
listFarmMCPLlmsTxtLinks,
|
|
5697
|
+
registerFarmMCPServer,
|
|
5507
5698
|
renderFarmLlmsFullTxt,
|
|
5508
5699
|
createFarmLlmsFullRenderer,
|
|
5509
5700
|
createFarmThemeDocumentParts,
|
|
@@ -5524,6 +5715,9 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5524
5715
|
mergeRouteRenderingDirectiveConfig,
|
|
5525
5716
|
manageFarmLinkHeaderPreloads,
|
|
5526
5717
|
mergeMetadata,
|
|
5718
|
+
mergeModuleViewport,
|
|
5719
|
+
ensureFarmDocumentMeta,
|
|
5720
|
+
renderViewportHead,
|
|
5527
5721
|
matchesFarmIfNoneMatch,
|
|
5528
5722
|
normalizeRevalidatePath,
|
|
5529
5723
|
reportFarmPreloadWarnings,
|
|
@@ -5553,25 +5747,25 @@ function isolateFarmRouteServerPage(element) { return element; }`;
|
|
|
5553
5747
|
const infraAnalyticsImport = hasInfraAnalyticsRuntime ? `import { ${hasPluginRuntime ? "createFarmInfraAnalyticsPlugin" : "createFarmInfraAnalyticsRecorder"} } from "@farm.js/core/internal/infra-analytics-runtime";` : "";
|
|
5554
5748
|
const compressionRuntimeImport = hasCompressionRuntime ? `import { compressFarmResponse${hasPluginRuntime ? ", createCompressionPlugin" : ""} } from "@farm.js/core/internal/compression-runtime";` : "";
|
|
5555
5749
|
const i18nServerImport = config.i18n.enabled ? `import { _runWithFarmI18nRequest, _setDefaultFarmI18nRuntime, createFarmI18nRuntime, getFarmI18nClientSnapshot } from "@farm.js/core/i18n/server";` : "";
|
|
5556
|
-
const docsHandlerImport = _optionalChain([config, 'access',
|
|
5750
|
+
const docsHandlerImport = _optionalChain([config, 'access', _97 => _97.docs, 'optionalAccess', _98 => _98.enabled]) ? hasPrecompiledDocs ? `import { createFarmDocsPrecompiledRuntime } from "@farm.js/core/internal/docs-precompiled-runtime";
|
|
5557
5751
|
const isFarmDocsAPIRequest = (requestOrPathname) => {
|
|
5558
5752
|
const pathname = typeof requestOrPathname === "string"
|
|
5559
5753
|
? requestOrPathname
|
|
5560
5754
|
: new URL(requestOrPathname.url).pathname;
|
|
5561
|
-
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess',
|
|
5755
|
+
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _99 => _99.apiPath]) || "/api/docs")};
|
|
5562
5756
|
return pathname === apiPath || pathname.startsWith(apiPath + "/");
|
|
5563
5757
|
};` : adapterOwnsDocsRuntime ? `import { isFarmDocsAPIRequest } from "@farm.js/core/docs";
|
|
5564
5758
|
import { createFarmDocsRuntimeHandler as createFarmDocsAdapterRuntimeHandler } from ${JSON.stringify(config.docs.adapter.server)};
|
|
5565
5759
|
import * as FarmDocsAdapterReact from ${JSON.stringify(config.docs.adapter.react)};${docsConfigModulePath ? `
|
|
5566
5760
|
import * as farmDocsConfigModule from ${toVirtualEntryImportSpecifier(docsConfigModulePath)};` : ""}` : `import { createFarmDocsAPIHandler, createFarmDocsHandler, isFarmDocsAPIRequest } from "@farm.js/core/docs";` : "";
|
|
5567
|
-
const docsFontImport = _optionalChain([config, 'access',
|
|
5568
|
-
const docsRuntimeImport = _optionalChain([config, 'access',
|
|
5761
|
+
const docsFontImport = _optionalChain([config, 'access', _100 => _100.docs, 'optionalAccess', _101 => _101.enabled]) && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
|
|
5762
|
+
const docsRuntimeImport = _optionalChain([config, 'access', _102 => _102.docs, 'optionalAccess', _103 => _103.enabled]) && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
|
|
5569
5763
|
import { dirname as farmDocsDirname, join as farmDocsJoin } from "node:path";
|
|
5570
5764
|
import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
5571
|
-
const markdownHandlerImport = _optionalChain([config, 'access',
|
|
5572
|
-
const appMarkdownImport = hasMarkdownPages ? `import { createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse } from "@farm.js/core/internal/app-markdown-runtime";` : "const createFarmMarkdownSourceResponse = null;";
|
|
5765
|
+
const markdownHandlerImport = _optionalChain([config, 'access', _104 => _104.md, 'optionalAccess', _105 => _105.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
|
|
5766
|
+
const appMarkdownImport = hasMarkdownPages ? `import { createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse, isFarmMarkdownPublicSourceResponse } from "@farm.js/core/internal/app-markdown-runtime";` : "const createFarmMarkdownSourceResponse = null;\nconst isFarmMarkdownPublicSourceResponse = null;";
|
|
5573
5767
|
const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
|
|
5574
|
-
const mdxComponentsPath = typeof _optionalChain([config, 'access',
|
|
5768
|
+
const mdxComponentsPath = typeof _optionalChain([config, 'access', _106 => _106.mdx, 'optionalAccess', _107 => _107.components]) === "string" ? _path2.default.isAbsolute(config.mdx.components) ? config.mdx.components : _path2.default.join(config.root, config.mdx.components) : null;
|
|
5575
5769
|
const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
|
|
5576
5770
|
const layerConfigPaths = (config.layers || []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile)).filter((configFile) => configFile !== configModulePath);
|
|
5577
5771
|
const layerConfigImports = layerConfigPaths.map(
|
|
@@ -5776,7 +5970,7 @@ const farmResolvedRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs);
|
|
|
5776
5970
|
|
|
5777
5971
|
function FarmDefault404Page() {
|
|
5778
5972
|
return React.createElement(React.Fragment, null,
|
|
5779
|
-
React.createElement("style", null, ${JSON.stringify(
|
|
5973
|
+
React.createElement("style", null, ${JSON.stringify(_chunkICUQICNCcjs.DEFAULT_NOT_FOUND_STYLES)}),
|
|
5780
5974
|
React.createElement("main", {
|
|
5781
5975
|
className: "farm-default-not-found",
|
|
5782
5976
|
"aria-labelledby": "farm-default-not-found-title",
|
|
@@ -5904,14 +6098,14 @@ const farmImageHandler = ${imageRuntime === "none" ? "null" : imageRuntime === "
|
|
|
5904
6098
|
onError(error) { console.error("[Farm Image]", error); },
|
|
5905
6099
|
})`};
|
|
5906
6100
|
const farmMarkdownConfig = ${JSON.stringify(config.md)};
|
|
5907
|
-
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
5908
|
-
${_optionalChain([config, 'access',
|
|
6101
|
+
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _108 => _108.agent, 'optionalAccess', _109 => _109.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
|
|
6102
|
+
${_optionalChain([config, 'access', _110 => _110.agent, 'optionalAccess', _111 => _111.llmsTxt, 'optionalAccess', _112 => _112.enabled]) ? "const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });\n" : ""}${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
|
|
5909
6103
|
const farmMdxConfig = ${JSON.stringify({
|
|
5910
6104
|
...config.mdx,
|
|
5911
|
-
components: typeof _optionalChain([config, 'access',
|
|
6105
|
+
components: typeof _optionalChain([config, 'access', _113 => _113.mdx, 'optionalAccess', _114 => _114.components]) === "string" ? config.mdx.components : void 0
|
|
5912
6106
|
})};
|
|
5913
6107
|
const configuredFarmMdxComponents = farmUserConfig?.mdx?.components;
|
|
5914
|
-
${_optionalChain([config, 'access',
|
|
6108
|
+
${_optionalChain([config, 'access', _115 => _115.agent, 'optionalAccess', _116 => _116.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
|
|
5915
6109
|
// environment this was built in, since Netlify exposes its deploy context only
|
|
5916
6110
|
// to the build.
|
|
5917
6111
|
const farmNoindexPreview = resolveFarmPreviewDeployment(
|
|
@@ -5959,7 +6153,7 @@ export const farmProductionLifecycle = createFarmProductionLifecycle({
|
|
|
5959
6153
|
});
|
|
5960
6154
|
const farmI18nRuntime = ${config.i18n.enabled ? `createFarmI18nRuntime(farmI18nConfig, ${JSON.stringify(i18nCatalogs)})` : "null"};
|
|
5961
6155
|
${config.i18n.enabled ? "_setDefaultFarmI18nRuntime(farmI18nRuntime);" : ""}
|
|
5962
|
-
const farmDocsBundledContentDir = ${_optionalChain([config, 'access',
|
|
6156
|
+
const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _117 => _117.docs, 'optionalAccess', _118 => _118.enabled]) && !hasPrecompiledDocs ? `(() => {
|
|
5963
6157
|
try {
|
|
5964
6158
|
const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
|
|
5965
6159
|
const candidates = [
|
|
@@ -5980,7 +6174,7 @@ globalThis.__FARM_DOCS_RUNTIME_CONFIG__ = {
|
|
|
5980
6174
|
docs: farmDocsResolvedConfig,
|
|
5981
6175
|
};
|
|
5982
6176
|
const farmDocsPrecompiledRuntime = ${hasPrecompiledDocs ? `createFarmDocsPrecompiledRuntime(${JSON.stringify(farmDocsPrecompiledManifest)})` : "null"};
|
|
5983
|
-
const farmDocsHandler = ${_optionalChain([config, 'access',
|
|
6177
|
+
const farmDocsHandler = ${_optionalChain([config, 'access', _119 => _119.docs, 'optionalAccess', _120 => _120.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `createFarmDocsAdapterRuntimeHandler({
|
|
5984
6178
|
${docsConfigModulePath ? "...(farmDocsConfigModule.default || farmDocsConfigModule),\n ...farmDocsResolvedConfig.configOverrides," : "...farmDocsResolvedConfig.config,"}
|
|
5985
6179
|
entry: farmDocsResolvedConfig.config?.entry || String(farmDocsResolvedConfig.entry || "/docs").replace(/^\\/+|\\/+$/g, "") || "docs",
|
|
5986
6180
|
docsPath: farmDocsResolvedConfig.entry,
|
|
@@ -5999,6 +6193,8 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _117 => _117.docs, '
|
|
|
5999
6193
|
getApplicableLayouts(getFarmRoutePathname(pathname)).map((layout) => layout.module),
|
|
6000
6194
|
),
|
|
6001
6195
|
loadReactModule: async () => FarmDocsAdapterReact,
|
|
6196
|
+
// Lists the docs MCP endpoint in /.well-known/ai-catalog.json for the server's lifetime.
|
|
6197
|
+
registerMCPServer: registerFarmMCPServer,
|
|
6002
6198
|
})` : `createFarmDocsHandler(farmDocsResolvedConfig, {
|
|
6003
6199
|
root: farmDocsRuntimeRoot,
|
|
6004
6200
|
srcDir: ${JSON.stringify(config.srcDir)},
|
|
@@ -6011,14 +6207,21 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _117 => _117.docs, '
|
|
|
6011
6207
|
fontStylesheetHref: "/farm-fonts.css",
|
|
6012
6208
|
globalStylesheetHref: "/assets/globals.css",
|
|
6013
6209
|
})` : "null"};
|
|
6014
|
-
const farmDocsAPIHandler = ${_optionalChain([config, 'access',
|
|
6210
|
+
const farmDocsAPIHandler = ${_optionalChain([config, 'access', _121 => _121.docs, 'optionalAccess', _122 => _122.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig })` : "null"};
|
|
6015
6211
|
|
|
6016
6212
|
// API routes bundled at build time
|
|
6017
6213
|
const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
|
|
6018
|
-
]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path:
|
|
6019
|
-
const farmLocalAPIBasePath = ${JSON.stringify(
|
|
6214
|
+
]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path: path8, methods }) => ({ path: path8, methods })))}, { bodySizeLimit: ${JSON.stringify(config.server.bodySizeLimit)} })` : ""};
|
|
6215
|
+
const farmLocalAPIBasePath = ${JSON.stringify(_chunkKNBBQHO2cjs.resolveFarmAPIServerBasePath.call(void 0, config.api))};
|
|
6020
6216
|
const farmOpenAPIReference = ${JSON.stringify(openAPIReference)};
|
|
6021
|
-
${_optionalChain([config, 'access',
|
|
6217
|
+
${_optionalChain([config, 'access', _123 => _123.agent, 'optionalAccess', _124 => _124.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunkIPXLADVOcjs.resolveFarmApiCatalogInput.call(void 0, config))};
|
|
6218
|
+
` : ""}${config.analytics !== false ? `const farmAppManifestInput = ${JSON.stringify(
|
|
6219
|
+
_chunkIPXLADVOcjs.resolveFarmAppManifestInput.call(void 0, config, {
|
|
6220
|
+
build: config.deploymentId,
|
|
6221
|
+
packages: _chunkICUQICNCcjs.resolveFarmAppPackages.call(void 0, config.root),
|
|
6222
|
+
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? _chunkICUQICNCcjs.collectFarmWebMCPTools.call(void 0, config.root, config.srcDir) : []
|
|
6223
|
+
})
|
|
6224
|
+
)};
|
|
6022
6225
|
` : ""}
|
|
6023
6226
|
function isFarmLocalAPIPathname(pathname) {
|
|
6024
6227
|
return farmLocalAPIBasePath !== "/" &&
|
|
@@ -6044,7 +6247,7 @@ for (const route of pageRoutes) {
|
|
|
6044
6247
|
// Layout routes bundled at build time (sorted by depth, root first)
|
|
6045
6248
|
const layoutRoutes = [${layoutRegistrations.join(",")}
|
|
6046
6249
|
];
|
|
6047
|
-
const selectApplicableLayouts = createFarmLayoutSelector(layoutRoutes);
|
|
6250
|
+
const selectApplicableLayouts = createFarmLayoutSelector(layoutRoutes, getMatchedPageDirectory);
|
|
6048
6251
|
|
|
6049
6252
|
const routeSlots = [${routeSlotRegistrations.join(",")}
|
|
6050
6253
|
];
|
|
@@ -6087,9 +6290,12 @@ function getFarmI18nSnapshot() {
|
|
|
6087
6290
|
return ${config.i18n.enabled ? "getFarmI18nClientSnapshot()" : "undefined"};
|
|
6088
6291
|
}
|
|
6089
6292
|
|
|
6293
|
+
// The locale step strips farmI18nConfig.basePath itself. Stripping it first as
|
|
6294
|
+
// well removed it twice, so /console/console/secret served /secret while
|
|
6295
|
+
// middleware and integration guards, which strip it once, saw /console/secret.
|
|
6090
6296
|
function getFarmRoutePathname(pathname) {
|
|
6091
6297
|
return farmI18nRuntime
|
|
6092
|
-
? stripFarmLocaleFromPathname(
|
|
6298
|
+
? stripFarmLocaleFromPathname(pathname, farmI18nConfig)
|
|
6093
6299
|
: stripFarmBasePath(pathname);
|
|
6094
6300
|
}
|
|
6095
6301
|
|
|
@@ -6458,7 +6664,7 @@ function peelFarmDocumentPrefix(markup) {
|
|
|
6458
6664
|
let inner = markup.replace(/^\\s+/, "");
|
|
6459
6665
|
let hoisted = "";
|
|
6460
6666
|
const wrapper = /^<div\\b[^>]*style=["']display\\s*:\\s*contents["'][^>]*>/i;
|
|
6461
|
-
const hoistable = /${
|
|
6667
|
+
const hoistable = /${_chunkIPXLADVOcjs.HOISTED_HEAD_ELEMENT.source}/i;
|
|
6462
6668
|
let match;
|
|
6463
6669
|
while ((match = wrapper.exec(inner) || hoistable.exec(inner))) {
|
|
6464
6670
|
if (!/^<div/i.test(match[0])) hoisted += match[0];
|
|
@@ -6690,6 +6896,7 @@ ${generateRuntimePathMatcherSource()}
|
|
|
6690
6896
|
function getMatchingErrorBoundary(pathname) {
|
|
6691
6897
|
const pathSegments = splitRuntimePath(pathname);
|
|
6692
6898
|
let bestMatch = null;
|
|
6899
|
+
let directory;
|
|
6693
6900
|
|
|
6694
6901
|
for (const errorRoute of errorRoutes) {
|
|
6695
6902
|
const patternDepth = splitRuntimePath(errorRoute.pattern).length;
|
|
@@ -6699,9 +6906,18 @@ function getMatchingErrorBoundary(pathname) {
|
|
|
6699
6906
|
: "/" + pathSegments.slice(0, patternDepth).join("/");
|
|
6700
6907
|
const params = matchRuntimePathPattern(errorRoute.pattern, candidatePath);
|
|
6701
6908
|
if (params === null) continue;
|
|
6909
|
+
if (errorRoute.groupScope) {
|
|
6910
|
+
if (directory === undefined) directory = getMatchedPageDirectory(pathname);
|
|
6911
|
+
if (!isInFarmRouteGroupScope(directory, errorRoute.groupScope)) continue;
|
|
6912
|
+
}
|
|
6702
6913
|
|
|
6703
|
-
|
|
6704
|
-
|
|
6914
|
+
const directoryDepth = errorRoute.directoryDepth ?? patternDepth;
|
|
6915
|
+
if (
|
|
6916
|
+
!bestMatch ||
|
|
6917
|
+
patternDepth > bestMatch.depth ||
|
|
6918
|
+
(patternDepth === bestMatch.depth && directoryDepth > bestMatch.directoryDepth)
|
|
6919
|
+
) {
|
|
6920
|
+
bestMatch = { route: errorRoute, params, depth: patternDepth, directoryDepth };
|
|
6705
6921
|
}
|
|
6706
6922
|
}
|
|
6707
6923
|
|
|
@@ -6925,6 +7141,10 @@ function createFarmLlmsTxtContext(request, full) {
|
|
|
6925
7141
|
pages,
|
|
6926
7142
|
config: farmLlmsTxtConfig,
|
|
6927
7143
|
rootMetadata: rootLayout && rootLayout.module && rootLayout.module.metadata,
|
|
7144
|
+
${servesAiCatalog ? `mcp: listFarmMCPLlmsTxtLinks(origin, {
|
|
7145
|
+
basePath: ${JSON.stringify(config.basePath)},
|
|
7146
|
+
apiServerBasePath: farmLocalAPIBasePath,
|
|
7147
|
+
}),` : ""}
|
|
6928
7148
|
}),
|
|
6929
7149
|
// llms-full.txt reads each page's .md mirror through this same handler,
|
|
6930
7150
|
// with a fresh request so the caller's cookies never shape its content.
|
|
@@ -7031,6 +7251,7 @@ const farmMiddlewareRunner = ${hasMiddlewareRuntime ? `createProductionMiddlewar
|
|
|
7031
7251
|
modules: fileMiddlewareModules,
|
|
7032
7252
|
i18n: farmI18nConfig,
|
|
7033
7253
|
server: farmServerConfig,
|
|
7254
|
+
apiBasePath: farmLocalAPIBasePath,
|
|
7034
7255
|
})` : "null"};
|
|
7035
7256
|
|
|
7036
7257
|
${apiHandlerCode}
|
|
@@ -7167,7 +7388,7 @@ function hasLocalRequestRoute(request, routePathname) {
|
|
|
7167
7388
|
if (${imageRuntime === "none" ? "false" : `pathname === ${JSON.stringify(config.images.path)}`}) {
|
|
7168
7389
|
return true;
|
|
7169
7390
|
}
|
|
7170
|
-
${_optionalChain([config, 'access',
|
|
7391
|
+
${_optionalChain([config, 'access', _125 => _125.docs, 'optionalAccess', _126 => _126.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
|
|
7171
7392
|
if (
|
|
7172
7393
|
isFarmDocsAPIRequest(pathname) ||
|
|
7173
7394
|
docsPath === "/" ||
|
|
@@ -7193,7 +7414,7 @@ function getFarmPluginRequestOptions(request) {
|
|
|
7193
7414
|
route: { ...route, pattern: normalizeRuntimePath(farmOpenAPIReference.route) },
|
|
7194
7415
|
};
|
|
7195
7416
|
}
|
|
7196
|
-
const isDocsAPIRequest = ${_optionalChain([config, 'access',
|
|
7417
|
+
const isDocsAPIRequest = ${_optionalChain([config, 'access', _127 => _127.docs, 'optionalAccess', _128 => _128.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
|
|
7197
7418
|
const integrationMatch = ${hasServerRuntimeIntegrations ? `matchIntegrationRoute(serverRuntimeIntegrations, {
|
|
7198
7419
|
pathname,
|
|
7199
7420
|
method: request.method,
|
|
@@ -7273,17 +7494,24 @@ function getFarmPluginRequestOptions(request) {
|
|
|
7273
7494
|
return { kind: "request", route };
|
|
7274
7495
|
}
|
|
7275
7496
|
|
|
7497
|
+
/** The directory of the page a pathname selects, or null; route groups confine layouts to it. */
|
|
7498
|
+
function getMatchedPageDirectory(pathname) {
|
|
7499
|
+
const match = matchPageRoute(pathname);
|
|
7500
|
+
return match ? match.route.directory || match.route.pattern : null;
|
|
7501
|
+
}
|
|
7502
|
+
|
|
7276
7503
|
/**
|
|
7277
|
-
* Get applicable layouts for a page path (from root to most specific)
|
|
7504
|
+
* Get applicable layouts for a page path (from root to most specific). Pass the
|
|
7505
|
+
* selected page's directory when it is known, or null when no page applies.
|
|
7278
7506
|
*/
|
|
7279
|
-
function getApplicableLayouts(pathname) {
|
|
7280
|
-
const applicable = selectApplicableLayouts(pathname);
|
|
7507
|
+
function getApplicableLayouts(pathname, directory) {
|
|
7508
|
+
const applicable = selectApplicableLayouts(pathname, directory);
|
|
7281
7509
|
// buildSSRInMemory already emits these immutable descriptors in stable depth
|
|
7282
7510
|
// order. Filtering preserves that order, including equal-depth ties.
|
|
7283
7511
|
return applicable;
|
|
7284
7512
|
}
|
|
7285
7513
|
|
|
7286
|
-
${_optionalChain([config, 'access',
|
|
7514
|
+
${_optionalChain([config, 'access', _129 => _129.docs, 'optionalAccess', _130 => _130.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
|
|
7287
7515
|
if (request.method === "HEAD") return response;
|
|
7288
7516
|
if (response.headers.get("x-farm-docs-adapter")) return response;
|
|
7289
7517
|
|
|
@@ -7390,7 +7618,7 @@ ${_optionalChain([config, 'access', _127 => _127.docs, 'optionalAccess', _128 =>
|
|
|
7390
7618
|
}` : ""}
|
|
7391
7619
|
|
|
7392
7620
|
const pprShellCache = getFarmDataCache();
|
|
7393
|
-
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access',
|
|
7621
|
+
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _131 => _131.experimental, 'optionalAccess', _132 => _132.ppr]) === true)};
|
|
7394
7622
|
|
|
7395
7623
|
function resolveRouteRenderingView(route) {
|
|
7396
7624
|
// The same merge development uses: baked directive config under the
|
|
@@ -7451,6 +7679,12 @@ function getPPRHeaders(status, config) {
|
|
|
7451
7679
|
return headers;
|
|
7452
7680
|
}
|
|
7453
7681
|
|
|
7682
|
+
function hasFarmUnserializableRouteData(data) {
|
|
7683
|
+
const isPromise = (value) => Boolean(value) && typeof value.then === "function";
|
|
7684
|
+
if (isPromise(data)) return true;
|
|
7685
|
+
return Boolean(data) && typeof data === "object" && Object.values(data).some(isPromise);
|
|
7686
|
+
}
|
|
7687
|
+
|
|
7454
7688
|
function getRouteSharedCacheControl(route, pprCanCache) {
|
|
7455
7689
|
if (!route || !route.module) {
|
|
7456
7690
|
return null;
|
|
@@ -7513,7 +7747,7 @@ async function handleFarmRequest(request, adapterContext) {
|
|
|
7513
7747
|
},
|
|
7514
7748
|
{ redirect: !isFarmLocalAPIPathname(requestUrl.pathname) }
|
|
7515
7749
|
)` : "handleFarmRequestInContext(request, null, false, Date.now(), adapterContext, requestUrl)"};
|
|
7516
|
-
${_optionalChain([config, 'access',
|
|
7750
|
+
${_optionalChain([config, 'access', _133 => _133.md, 'optionalAccess', _134 => _134.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
|
|
7517
7751
|
if (matchPageRoute(pathname)) {
|
|
7518
7752
|
// The Link header advertises the public .md URL, like the head alternate.
|
|
7519
7753
|
return applyMarkdownNegotiationHeaders(response, {
|
|
@@ -7632,7 +7866,21 @@ async function handleFarmRequestInContext(
|
|
|
7632
7866
|
const middlewareHeaders = ${hasServerRuntimeIntegrations ? "withFarmIntegrationSetCookies(undefined, farmIntegrationSetCookies)" : "undefined"};
|
|
7633
7867
|
`}
|
|
7634
7868
|
|
|
7635
|
-
${
|
|
7869
|
+
${servesAiCatalog ? `
|
|
7870
|
+
// agent.aiCatalog: the AI catalog of MCP servers and each server's card. Cards
|
|
7871
|
+
// live below the MCP endpoint, so this answers before the docs runtime and the
|
|
7872
|
+
// API routes, as in dev.
|
|
7873
|
+
const farmAiCatalogResponse = createFarmAiCatalogResponse(
|
|
7874
|
+
request,
|
|
7875
|
+
{ basePath: ${JSON.stringify(config.basePath)}, apiServerBasePath: farmLocalAPIBasePath },
|
|
7876
|
+
url,
|
|
7877
|
+
);
|
|
7878
|
+
if (farmAiCatalogResponse) {
|
|
7879
|
+
return applyProductionMiddlewareHeaders(farmAiCatalogResponse, middlewareHeaders);
|
|
7880
|
+
}
|
|
7881
|
+
` : ""}
|
|
7882
|
+
|
|
7883
|
+
${_optionalChain([config, 'access', _135 => _135.docs, 'optionalAccess', _136 => _136.enabled]) ? `
|
|
7636
7884
|
// Docs responses are served after app middleware so route guards and
|
|
7637
7885
|
// middleware headers apply to the docs engine like any other page content.
|
|
7638
7886
|
// An app's own llms.txt, llms-full.txt, sitemap.xml, and robots.txt take
|
|
@@ -7663,7 +7911,8 @@ async function handleFarmRequestInContext(
|
|
|
7663
7911
|
|
|
7664
7912
|
${hasMarkdownPages ? `
|
|
7665
7913
|
// The raw markdown source of a page route is the page's content in another
|
|
7666
|
-
// representation;
|
|
7914
|
+
// representation; it is only served for a page an anonymous visitor may open,
|
|
7915
|
+
// which renderPage asks the app with the page's own path.
|
|
7667
7916
|
const markdownSourceResponse = await createFarmMarkdownSourceResponse?.({
|
|
7668
7917
|
request: cloneFarmRequestWithContext(request),
|
|
7669
7918
|
config: farmMdxConfig,
|
|
@@ -7671,13 +7920,16 @@ async function handleFarmRequestInContext(
|
|
|
7671
7920
|
const match = matchPageRoute(getFarmRoutePathname(targetPathname));
|
|
7672
7921
|
return match?.route?.markdownSource || null;
|
|
7673
7922
|
},
|
|
7923
|
+
renderPage: (targetRequest) => handleFarmRequest(targetRequest, adapterContext),
|
|
7674
7924
|
});
|
|
7675
7925
|
if (markdownSourceResponse) {
|
|
7676
|
-
return
|
|
7926
|
+
return isFarmMarkdownPublicSourceResponse(markdownSourceResponse)
|
|
7927
|
+
? markdownSourceResponse
|
|
7928
|
+
: applyProductionMiddlewareHeaders(markdownSourceResponse, middlewareHeaders);
|
|
7677
7929
|
}
|
|
7678
7930
|
` : ""}
|
|
7679
7931
|
|
|
7680
|
-
${_optionalChain([config, 'access',
|
|
7932
|
+
${_optionalChain([config, 'access', _137 => _137.md, 'optionalAccess', _138 => _138.enabled]) ? `
|
|
7681
7933
|
if (farmMarkdownConfig?.enabled) {
|
|
7682
7934
|
const markdownResponse = await createMarkdownMirrorResponse({
|
|
7683
7935
|
// The mirror helper only reads metadata and creates its own GET request.
|
|
@@ -7776,9 +8028,20 @@ async function handleFarmRequestInContext(
|
|
|
7776
8028
|
return applyProductionMiddlewareHeaders(applicationMetadataResponse, middlewareHeaders);
|
|
7777
8029
|
}
|
|
7778
8030
|
` : ""}
|
|
7779
|
-
${
|
|
8031
|
+
${config.analytics !== false ? `
|
|
8032
|
+
// /.well-known/farmjs: the app's manifest, only for a request Farm Infra signed.
|
|
8033
|
+
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkIPXLADVOcjs.FARM_APP_MANIFEST_PATH)}) {
|
|
8034
|
+
const farmAppManifest = await createFarmAppManifestResponse(request, farmAppManifestInput, {
|
|
8035
|
+
development: false,
|
|
8036
|
+
});
|
|
8037
|
+
if (farmAppManifest) {
|
|
8038
|
+
return applyProductionMiddlewareHeaders(farmAppManifest, middlewareHeaders);
|
|
8039
|
+
}
|
|
8040
|
+
}
|
|
8041
|
+
` : ""}
|
|
8042
|
+
${_optionalChain([config, 'access', _139 => _139.agent, 'optionalAccess', _140 => _140.apiCatalog]) ? `
|
|
7780
8043
|
// agent.apiCatalog: list the OpenAPI and MCP surfaces at the RFC 9727 path.
|
|
7781
|
-
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(
|
|
8044
|
+
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkIPXLADVOcjs.FARM_API_CATALOG_PATH)}) {
|
|
7782
8045
|
return applyProductionMiddlewareHeaders(
|
|
7783
8046
|
createFarmApiCatalogResponse(request.method, farmApiCatalogInput, request),
|
|
7784
8047
|
middlewareHeaders,
|
|
@@ -7794,11 +8057,11 @@ async function handleFarmRequestInContext(
|
|
|
7794
8057
|
);
|
|
7795
8058
|
}
|
|
7796
8059
|
` : ""}
|
|
7797
|
-
${_optionalChain([config, 'access',
|
|
8060
|
+
${_optionalChain([config, 'access', _141 => _141.agent, 'optionalAccess', _142 => _142.llmsTxt, 'optionalAccess', _143 => _143.enabled]) ? `
|
|
7798
8061
|
// agent.llmsTxt with no llms.ts or llms-full.ts: serve the generated files.
|
|
7799
8062
|
const farmGeneratedLlmsKind = normalizeRuntimePath(routePathname) === "/llms.txt"
|
|
7800
8063
|
? "llms"
|
|
7801
|
-
: ${_optionalChain([config, 'access',
|
|
8064
|
+
: ${_optionalChain([config, 'access', _144 => _144.agent, 'optionalAccess', _145 => _145.llmsTxt, 'optionalAccess', _146 => _146.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
|
|
7802
8065
|
if (farmGeneratedLlmsKind) {
|
|
7803
8066
|
const llmsContext = createFarmLlmsTxtContext(request, farmGeneratedLlmsKind === "llms-full");
|
|
7804
8067
|
const llmsOrigin = new URL(request.url).origin;
|
|
@@ -7833,7 +8096,7 @@ async function handleFarmRequestInContext(
|
|
|
7833
8096
|
}
|
|
7834
8097
|
` : ""}
|
|
7835
8098
|
|
|
7836
|
-
${_optionalChain([config, 'access',
|
|
8099
|
+
${_optionalChain([config, 'access', _147 => _147.docs, 'optionalAccess', _148 => _148.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
|
|
7837
8100
|
const docsAPIResponse = await farmDocsAPIHandler(cloneFarmRequestWithContext(request));
|
|
7838
8101
|
if (docsAPIResponse) {
|
|
7839
8102
|
return applyProductionMiddlewareHeaders(docsAPIResponse, middlewareHeaders);
|
|
@@ -7914,13 +8177,19 @@ async function handleFarmRequestInContext(
|
|
|
7914
8177
|
emitFarmEvent({ type: "ppr.shell.miss", route: pathname, key: pprCacheKey });
|
|
7915
8178
|
}
|
|
7916
8179
|
|
|
8180
|
+
// Reads from here on belong to the page render, not to middleware.
|
|
8181
|
+
const requestReadsBeforeRender = _getRequestReadCount();
|
|
8182
|
+
|
|
7917
8183
|
// Get the page component and metadata
|
|
7918
8184
|
let PageComponent = route.module.default;
|
|
7919
8185
|
let pageStatus = 200;
|
|
7920
8186
|
const pageMetadata = route.module.metadata || {};
|
|
7921
8187
|
|
|
7922
8188
|
// Get applicable layouts for this page
|
|
7923
|
-
const applicableLayouts = getApplicableLayouts(
|
|
8189
|
+
const applicableLayouts = getApplicableLayouts(
|
|
8190
|
+
routePathname,
|
|
8191
|
+
route.directory || route.pattern,
|
|
8192
|
+
);
|
|
7924
8193
|
const shouldHydrateLayout = applicableLayouts.some(
|
|
7925
8194
|
(layout) => layout.shouldHydrate === true,
|
|
7926
8195
|
);
|
|
@@ -7973,6 +8242,10 @@ async function handleFarmRequestInContext(
|
|
|
7973
8242
|
});
|
|
7974
8243
|
}
|
|
7975
8244
|
let pageProps;
|
|
8245
|
+
// A rejected guard or loader renders the route's notFound/error
|
|
8246
|
+
// component, and the route's generateMetadata must not run for it:
|
|
8247
|
+
// it would describe the resource the caller was refused.
|
|
8248
|
+
let routeStateRejected = false;
|
|
7976
8249
|
try {
|
|
7977
8250
|
// Resolve top-level route state before starting the HTTP stream so
|
|
7978
8251
|
// redirects, notFound(), and failures keep their real status. Route
|
|
@@ -8007,6 +8280,7 @@ async function handleFarmRequestInContext(
|
|
|
8007
8280
|
} catch (routeStateError) {
|
|
8008
8281
|
if (isFarmRedirectError(routeStateError)) throw routeStateError;
|
|
8009
8282
|
|
|
8283
|
+
routeStateRejected = true;
|
|
8010
8284
|
const routeComponents = route.module.__farmRouteComponents;
|
|
8011
8285
|
const routeStateProps = {
|
|
8012
8286
|
...rawPageProps,
|
|
@@ -8096,7 +8370,9 @@ async function handleFarmRequestInContext(
|
|
|
8096
8370
|
...(pageProps.__farmCanonicalPath
|
|
8097
8371
|
? { __farmCanonicalPath: pageProps.__farmCanonicalPath }
|
|
8098
8372
|
: {}),
|
|
8099
|
-
|
|
8373
|
+
// Deferred values do not survive JSON, so the browser cannot render
|
|
8374
|
+
// a page from these props while one is still in flight.
|
|
8375
|
+
...(pageProps.__farmRoutePropsResolved && !hasFarmUnserializableRouteData(pageProps.data)
|
|
8100
8376
|
? { __farmRoutePropsResolved: true }
|
|
8101
8377
|
: {}),
|
|
8102
8378
|
path: pathname,
|
|
@@ -8146,7 +8422,9 @@ async function handleFarmRequestInContext(
|
|
|
8146
8422
|
if (route.shouldHydrate && !shouldHydrateLayout) {
|
|
8147
8423
|
pageElement = wrapFarmRouteClientGraph(pageElement);
|
|
8148
8424
|
} else if (shouldHydrateLayout && !route.shouldHydrate) {
|
|
8149
|
-
pageElement =
|
|
8425
|
+
pageElement = route.serverTree
|
|
8426
|
+
? await renderFarmRouteServerTree(pageElement)
|
|
8427
|
+
: isolateFarmRouteServerPage(pageElement);
|
|
8150
8428
|
}
|
|
8151
8429
|
|
|
8152
8430
|
pageElement = React.createElement(
|
|
@@ -8173,7 +8451,7 @@ async function handleFarmRequestInContext(
|
|
|
8173
8451
|
if (LayoutComponent) {
|
|
8174
8452
|
const slotProps = {};
|
|
8175
8453
|
for (const slot of renderedRouteSlots) {
|
|
8176
|
-
if (slot.ownerPattern !== layout.pattern) continue;
|
|
8454
|
+
if ((slot.ownerDirectory || slot.ownerPattern) !== layout.pattern) continue;
|
|
8177
8455
|
slotProps[slot.name] = React.createElement(
|
|
8178
8456
|
"div",
|
|
8179
8457
|
{
|
|
@@ -8218,7 +8496,7 @@ async function handleFarmRequestInContext(
|
|
|
8218
8496
|
// the request's resolved Suspense content. Until the production runtime
|
|
8219
8497
|
// can persist and resume the partial shell itself, buffer streamed PPR
|
|
8220
8498
|
// responses for late status errors but do not cache their dynamic HTML.
|
|
8221
|
-
|
|
8499
|
+
let shouldCachePPRShell = Boolean(pprCacheKey && !renderedPage.stream);
|
|
8222
8500
|
if (!shouldCachePPRShell && pprCacheKey) {
|
|
8223
8501
|
pprCanCache = false;
|
|
8224
8502
|
emitFarmEvent({
|
|
@@ -8240,14 +8518,22 @@ async function handleFarmRequestInContext(
|
|
|
8240
8518
|
await layout.module.generateMetadata({ params: pageProps.params }),
|
|
8241
8519
|
);
|
|
8242
8520
|
}
|
|
8521
|
+
mergedMetadata = await mergeModuleViewport(mergedMetadata, layout.module, {
|
|
8522
|
+
params: pageProps.params,
|
|
8523
|
+
});
|
|
8243
8524
|
}
|
|
8244
8525
|
mergedMetadata = mergeMetadata(mergedMetadata, pageMetadata);
|
|
8245
|
-
if (typeof route.module.generateMetadata === "function") {
|
|
8526
|
+
if (!routeStateRejected && typeof route.module.generateMetadata === "function") {
|
|
8246
8527
|
mergedMetadata = mergeMetadata(
|
|
8247
8528
|
mergedMetadata,
|
|
8248
8529
|
await route.module.generateMetadata(pageProps),
|
|
8249
8530
|
);
|
|
8250
8531
|
}
|
|
8532
|
+
mergedMetadata = await mergeModuleViewport(
|
|
8533
|
+
mergedMetadata,
|
|
8534
|
+
routeStateRejected ? { viewport: route.module.viewport } : route.module,
|
|
8535
|
+
pageProps,
|
|
8536
|
+
);
|
|
8251
8537
|
|
|
8252
8538
|
if (!mergedMetadata.manifest) {
|
|
8253
8539
|
const manifestMatch = getMatchingApplicationMetadataRoute(routePathname, "manifest");
|
|
@@ -8268,7 +8554,7 @@ async function handleFarmRequestInContext(
|
|
|
8268
8554
|
);
|
|
8269
8555
|
}
|
|
8270
8556
|
}
|
|
8271
|
-
${_optionalChain([config, 'access',
|
|
8557
|
+
${_optionalChain([config, 'access', _149 => _149.md, 'optionalAccess', _150 => _150.enabled]) ? `
|
|
8272
8558
|
// Advertise the Markdown mirror in the head as well as the Link header,
|
|
8273
8559
|
// using the public path the .md request will be resolved against.
|
|
8274
8560
|
mergedMetadata = addMetadataMarkdownAlternate(
|
|
@@ -8276,10 +8562,22 @@ async function handleFarmRequestInContext(
|
|
|
8276
8562
|
getFarmMarkdownAlternatePath(farmMarkdownConfig, pathname),
|
|
8277
8563
|
);` : ""}
|
|
8278
8564
|
|
|
8279
|
-
|
|
8565
|
+
// headers(), cookies(), or getCurrentRequest() read during the render,
|
|
8566
|
+
// in the page, a layout, metadata, or anything they import, makes this
|
|
8567
|
+
// HTML one visitor's: never a shared PPR shell or CDN response.
|
|
8568
|
+
const renderReadRequest = _getRequestReadCount() !== requestReadsBeforeRender;
|
|
8569
|
+
if (renderReadRequest && shouldCachePPRShell) {
|
|
8570
|
+
shouldCachePPRShell = false;
|
|
8571
|
+
pprCanCache = false;
|
|
8572
|
+
emitFarmEvent({ type: "ppr.shell.bypass", route: pathname, reason: "request-read" });
|
|
8573
|
+
emitFarmEvent({ type: "cache.bypass", route: pathname, reason: "request-read" });
|
|
8574
|
+
}
|
|
8575
|
+
|
|
8576
|
+
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _151 => _151.agent, 'optionalAccess', _152 => _152.jsonLd]), () => ( false)))} });
|
|
8280
8577
|
const title = renderedMetadata.title;
|
|
8281
8578
|
const metaTags = renderedMetadata.tags;
|
|
8282
8579
|
const hasFavicon = renderedMetadata.hasFavicon;
|
|
8580
|
+
const viewportTags = renderedMetadata.viewport;
|
|
8283
8581
|
|
|
8284
8582
|
const hasPrivateRequestHeaders = hasPrivateFarmRequestHeaders(
|
|
8285
8583
|
request,
|
|
@@ -8287,6 +8585,7 @@ async function handleFarmRequestInContext(
|
|
|
8287
8585
|
);
|
|
8288
8586
|
const hasRequestScopedRender = Boolean(
|
|
8289
8587
|
pageStatus >= 400 ||
|
|
8588
|
+
renderReadRequest ||
|
|
8290
8589
|
request.headers.get("x-farm-intercept-from") ||
|
|
8291
8590
|
hasPrivateRequestHeaders ||
|
|
8292
8591
|
hasConfiguredRouteContext ||
|
|
@@ -8330,7 +8629,7 @@ async function handleFarmRequestInContext(
|
|
|
8330
8629
|
const streamPrefix = '<!DOCTYPE html>\\n<html lang="en">\\n<head>\\n' +
|
|
8331
8630
|
farmThemeDocument.head + '\\n' +
|
|
8332
8631
|
' <meta charset="utf-8">\\n' +
|
|
8333
|
-
'
|
|
8632
|
+
' ' + viewportTags + '\\n' +
|
|
8334
8633
|
(hasFavicon ? '' : ' <link rel="icon" href="data:,">\\n') +
|
|
8335
8634
|
' <title>' + title + '</title>' + metaTags + '\\n' +
|
|
8336
8635
|
' <link rel="stylesheet" href="/__farm_client_css_href__">\\n' +
|
|
@@ -8461,6 +8760,9 @@ async function handleFarmRequestInContext(
|
|
|
8461
8760
|
' <script type="module" src="/__farm_client_js_src__"></script>\\n</body>',
|
|
8462
8761
|
);
|
|
8463
8762
|
|
|
8763
|
+
// Last, so the charset (and the viewport, unless the layout wrote one) open the head.
|
|
8764
|
+
fullHtml = ensureFarmDocumentMeta(fullHtml, viewportTags);
|
|
8765
|
+
|
|
8464
8766
|
// Add DOCTYPE if not present
|
|
8465
8767
|
if (!fullHtml.trim().startsWith('<!DOCTYPE')) {
|
|
8466
8768
|
fullHtml = '<!DOCTYPE html>\\n' + fullHtml;
|
|
@@ -8471,7 +8773,7 @@ async function handleFarmRequestInContext(
|
|
|
8471
8773
|
<html lang="en">
|
|
8472
8774
|
<head>
|
|
8473
8775
|
<meta charset="utf-8">
|
|
8474
|
-
|
|
8776
|
+
\${viewportTags}
|
|
8475
8777
|
\${hasFavicon ? "" : '<link rel="icon" href="data:,">'}
|
|
8476
8778
|
\${suppressDefaultTitle ? "" : "<title>" + title + "</title>"}\${metaTags}\${rendererHead ? "\\n " + rendererHead : ""}
|
|
8477
8779
|
<link rel="stylesheet" href="/__farm_client_css_href__">
|
|
@@ -8721,7 +9023,8 @@ async function handleFarmRequestInContext(
|
|
|
8721
9023
|
try {
|
|
8722
9024
|
// Wrap 404 page with root layout if available
|
|
8723
9025
|
let notFoundElement = createFarmNotFoundElement(pathname);
|
|
8724
|
-
|
|
9026
|
+
// No page matched, so a layout inside a route group cannot apply.
|
|
9027
|
+
const applicableLayouts = getApplicableLayouts("/", null);
|
|
8725
9028
|
|
|
8726
9029
|
// Wrap with layouts (from innermost to outermost)
|
|
8727
9030
|
for (let i = applicableLayouts.length - 1; i >= 0; i--) {
|
|
@@ -8765,6 +9068,7 @@ async function handleFarmRequestInContext(
|
|
|
8765
9068
|
() => ' ' + renderFarmClientBootstrapScript() + '\\n' +
|
|
8766
9069
|
' <script type="module" src="/__farm_client_js_src__"></script>\\n</body>',
|
|
8767
9070
|
);
|
|
9071
|
+
fullHtml = ensureFarmDocumentMeta(fullHtml, notFoundMetadata.viewport);
|
|
8768
9072
|
if (!fullHtml.trim().startsWith('<!DOCTYPE')) {
|
|
8769
9073
|
fullHtml = '<!DOCTYPE html>\\n' + fullHtml;
|
|
8770
9074
|
}
|
|
@@ -8773,7 +9077,7 @@ async function handleFarmRequestInContext(
|
|
|
8773
9077
|
<html lang="en">
|
|
8774
9078
|
<head>
|
|
8775
9079
|
<meta charset="UTF-8">
|
|
8776
|
-
|
|
9080
|
+
\${notFoundMetadata.viewport}
|
|
8777
9081
|
\${notFoundMetadata.hasFavicon ? "" : '<link rel="icon" href="data:,">'}
|
|
8778
9082
|
<link rel="stylesheet" href="/__farm_client_css_href__">
|
|
8779
9083
|
<title>\${notFoundMetadata.title}</title>\${notFoundMetadata.tags}
|
|
@@ -8891,11 +9195,11 @@ ${generatePreloadResponseRuntimeSource()}
|
|
|
8891
9195
|
|
|
8892
9196
|
// Export as Web Standard fetch API
|
|
8893
9197
|
export async function fetch(request, context) {
|
|
8894
|
-
${_optionalChain([config, 'access',
|
|
9198
|
+
${_optionalChain([config, 'access', _153 => _153.agent, 'optionalAccess', _154 => _154.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
|
|
8895
9199
|
basePath: farmLocalAPIBasePath,
|
|
8896
9200
|
dispatch: async (localRequest) =>
|
|
8897
9201
|
(await handleAPIRequest(localRequest)) ?? Response.json({ error: "Not Found" }, { status: 404 }),
|
|
8898
|
-
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access',
|
|
9202
|
+
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _155 => _155.agent, 'optionalAccess', _156 => _156.noindexPreviews]) ? `
|
|
8899
9203
|
// Keep every response of a preview deployment out of search indexes.
|
|
8900
9204
|
return farmNoindexPreview ? applyFarmPreviewRobotsTag(response) : response;` : ""}
|
|
8901
9205
|
}
|
|
@@ -9038,23 +9342,20 @@ function configMiddlewareMayHandlePath(config, pathname) {
|
|
|
9038
9342
|
if (!hasFarmMiddlewareConfig(config)) return false;
|
|
9039
9343
|
const entries = Array.isArray(config) ? config : [config];
|
|
9040
9344
|
return entries.some((entry) => {
|
|
9041
|
-
if (
|
|
9042
|
-
|
|
9043
|
-
|
|
9044
|
-
|
|
9045
|
-
|
|
9046
|
-
|
|
9047
|
-
|
|
9048
|
-
|
|
9049
|
-
});
|
|
9345
|
+
if (!entry.matcher && !entry.exclude) return true;
|
|
9346
|
+
const matchers = entry.matcher ? (Array.isArray(entry.matcher) ? entry.matcher : [entry.matcher]).map(
|
|
9347
|
+
(matcher) => (
|
|
9348
|
+
// A request-aware matcher cannot be proven safe at build time.
|
|
9349
|
+
typeof matcher === "function" ? () => true : matcher
|
|
9350
|
+
)
|
|
9351
|
+
) : void 0;
|
|
9352
|
+
const compiled = _chunkZ2HLU4IXcjs.compileMiddlewareConfig.call(void 0, { matcher: matchers, exclude: entry.exclude });
|
|
9353
|
+
return _chunkZ2HLU4IXcjs.matchesCompiledMiddlewareConfig.call(void 0, pathname, compiled, {}).matched;
|
|
9050
9354
|
});
|
|
9051
9355
|
}
|
|
9052
9356
|
_chunkS3JO3N4Hcjs.__name.call(void 0, configMiddlewareMayHandlePath, "configMiddlewareMayHandlePath");
|
|
9053
9357
|
function appMiddlewareMayHandlePath(middlewareRoutes, pathname) {
|
|
9054
|
-
return middlewareRoutes.some((route) =>
|
|
9055
|
-
if (route.path === "/") return true;
|
|
9056
|
-
return middlewarePatternMatches(route.path, pathname) || middlewarePatternMatches(`${route.path}/**`, pathname);
|
|
9057
|
-
});
|
|
9358
|
+
return middlewareRoutes.some((route) => _chunkZ2HLU4IXcjs.matchesMiddlewareRoute.call(void 0, pathname, route).matched);
|
|
9058
9359
|
}
|
|
9059
9360
|
_chunkS3JO3N4Hcjs.__name.call(void 0, appMiddlewareMayHandlePath, "appMiddlewareMayHandlePath");
|
|
9060
9361
|
function routePatternSpecificity(pattern) {
|
|
@@ -9094,11 +9395,11 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
9094
9395
|
}
|
|
9095
9396
|
if (appMiddlewareMayHandlePath(middlewareRoutes, pathname)) return "app middleware";
|
|
9096
9397
|
if (configMiddlewareMayHandlePath(config.middleware, pathname)) return "configured middleware";
|
|
9097
|
-
if (
|
|
9398
|
+
if (_chunkF7JZENPFcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
|
|
9098
9399
|
if (farmServerRuntimePluginsMayHandlePath(config, pathname)) return "server runtime plugin";
|
|
9099
9400
|
const manifestEntry = getManifestPageEntry(routeRuntimeManifest, pathname);
|
|
9100
|
-
if (_optionalChain([manifestEntry, 'optionalAccess',
|
|
9101
|
-
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access',
|
|
9401
|
+
if (_optionalChain([manifestEntry, 'optionalAccess', _157 => _157.rendering]) === "dynamic") return "dynamic runtime manifest";
|
|
9402
|
+
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _158 => _158.regions, 'optionalAccess', _159 => _159.length])) || manifestEntry.maxDuration !== void 0)) {
|
|
9102
9403
|
return "route runtime controls";
|
|
9103
9404
|
}
|
|
9104
9405
|
const routeRule = getEffectiveRouteRule(config, pathname);
|
|
@@ -9120,7 +9421,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
9120
9421
|
const nitroBuilder = nitroBuilderResult.value;
|
|
9121
9422
|
const isVercel = preset === "vercel" || preset === "vercel-edge";
|
|
9122
9423
|
const isCloudflareWorker = preset === "cloudflare-module";
|
|
9123
|
-
const outputDir =
|
|
9424
|
+
const outputDir = _chunkF7JZENPFcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
9124
9425
|
const runtimeServerOutputDir = isVercel ? _path2.default.join(outputDir, "functions", "__nitro.func") : _path2.default.join(outputDir, "server");
|
|
9125
9426
|
const ssrOutputDir = _path2.default.join(root, distDir, "ssr");
|
|
9126
9427
|
const imageRuntime = resolveImageRuntime(config, preset);
|
|
@@ -9144,7 +9445,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
9144
9445
|
const ssgCollectionPromise = routeManager.collectSSGPages();
|
|
9145
9446
|
const middlewareRoutesPromise = discoverMiddlewareRoutes(_chunkVPTDD5XFcjs.getFarmAppDirectories.call(void 0, config));
|
|
9146
9447
|
const configuredResponseRoutesPromise = Promise.all([config.redirects(), config.rewrites()]);
|
|
9147
|
-
const farmWorkflows = await
|
|
9448
|
+
const farmWorkflows = await _chunkVFQT3LAOcjs.prepareFarmWorkflowsForNitro.call(void 0, config);
|
|
9148
9449
|
const farmCron = await _chunk6EXBPJ24cjs.prepareFarmCronForNitro.call(void 0, config);
|
|
9149
9450
|
const [{ ssg: ssgPages }, middlewareRoutes, [configuredRedirects, configuredRewrites]] = await Promise.all([
|
|
9150
9451
|
ssgCollectionPromise,
|
|
@@ -9375,6 +9676,15 @@ function toFarmNodeResponse(request, response) {
|
|
|
9375
9676
|
})
|
|
9376
9677
|
);
|
|
9377
9678
|
}
|
|
9679
|
+
const farmNetlifyEntryPath = preset === "netlify" ? _path2.default.join(ssrOutputDir, "farm-netlify-entry.mjs") : null;
|
|
9680
|
+
if (farmNetlifyEntryPath) {
|
|
9681
|
+
await fs.writeFile(
|
|
9682
|
+
farmNetlifyEntryPath,
|
|
9683
|
+
createFarmNetlifyEntry({
|
|
9684
|
+
nitroNetlifyEntry: resolveNitroNetlifyEntry(resolveNitroPackageEntry(root))
|
|
9685
|
+
})
|
|
9686
|
+
);
|
|
9687
|
+
}
|
|
9378
9688
|
const prebuiltSSRPlugin = createExternalSSRBundlePlugin(
|
|
9379
9689
|
nitroEntryPath,
|
|
9380
9690
|
ssrOutputDir,
|
|
@@ -9400,6 +9710,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
9400
9710
|
let nitroConfig = {
|
|
9401
9711
|
preset,
|
|
9402
9712
|
...farmNodeServerEntryPath ? { entry: farmNodeServerEntryPath } : {},
|
|
9713
|
+
...farmNetlifyEntryPath ? { entry: farmNetlifyEntryPath } : {},
|
|
9403
9714
|
rootDir: root,
|
|
9404
9715
|
// Farm registers every handler, task, and plugin explicitly. Scanning the
|
|
9405
9716
|
// project root would bundle an app's own `middleware/`, `api/`, `routes/`,
|
|
@@ -9496,20 +9807,20 @@ function toFarmNodeResponse(request, response) {
|
|
|
9496
9807
|
snapshotSSRRebundleOptions(nitroConfig)
|
|
9497
9808
|
);
|
|
9498
9809
|
const requestedBuilder = _nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER));
|
|
9499
|
-
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access',
|
|
9500
|
-
_optionalChain([nitroConfig, 'access',
|
|
9501
|
-
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess',
|
|
9810
|
+
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _160 => _160.rollupConfig, 'optionalAccess', _161 => _161.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _162 => _162.rollupConfig, 'optionalAccess', _163 => _163.plugins])) && customRollupKeys.length === 0 && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _164 => _164.output, 'optionalAccess', _165 => _165.serverDir]) || "") === _path2.default.resolve(expectedServerDir) && Boolean(
|
|
9811
|
+
_optionalChain([nitroConfig, 'access', _166 => _166.handlers, 'optionalAccess', _167 => _167.some, 'call', _168 => _168(
|
|
9812
|
+
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _169 => _169.handler]) || "") === nitroEntryPath
|
|
9502
9813
|
)])
|
|
9503
9814
|
);
|
|
9504
9815
|
const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
|
|
9505
9816
|
if (selectRolldownBuilder) nitroConfig.builder = "rolldown";
|
|
9506
9817
|
const useRolldownBuilder = canReusePrebuiltSSR && (_nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER))) === "rolldown";
|
|
9507
9818
|
const shouldMinify = nitroConfig.minify !== false;
|
|
9508
|
-
const keepServerNames = !(_optionalChain([config, 'access',
|
|
9819
|
+
const keepServerNames = !(_optionalChain([config, 'access', _170 => _170.docs, 'optionalAccess', _171 => _171.enabled]) && _optionalChain([config, 'access', _172 => _172.docs, 'access', _173 => _173.adapter, 'optionalAccess', _174 => _174.server]));
|
|
9509
9820
|
const useFarmServerMinifier = shouldMinify && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig;
|
|
9510
9821
|
const serverChunkMinifier = useFarmServerMinifier ? createServerChunkMinifyPlugin({ keepNames: keepServerNames, target: "esnext" }) : null;
|
|
9511
9822
|
if (canReusePrebuiltSSR) {
|
|
9512
|
-
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access',
|
|
9823
|
+
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _175 => _175.rollupConfig, 'optionalAccess', _176 => _176.plugins]);
|
|
9513
9824
|
nitroConfig.rollupConfig = {
|
|
9514
9825
|
...nitroConfig.rollupConfig,
|
|
9515
9826
|
plugins: [
|
|
@@ -9520,10 +9831,10 @@ function toFarmNodeResponse(request, response) {
|
|
|
9520
9831
|
}
|
|
9521
9832
|
nitroConfig.minify = useFarmServerMinifier ? false : shouldMinify;
|
|
9522
9833
|
const nitroInstance = await nitroBuilder.createNitro(nitroConfig);
|
|
9523
|
-
if (_optionalChain([config, 'access',
|
|
9834
|
+
if (_optionalChain([config, 'access', _177 => _177.md, 'optionalAccess', _178 => _178.enabled])) {
|
|
9524
9835
|
nitroInstance.hooks.hook("prerender:generate", (route) => {
|
|
9525
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
9526
|
-
const alternatePath =
|
|
9836
|
+
if (!route.contents || !_optionalChain([route, 'access', _179 => _179.contentType, 'optionalAccess', _180 => _180.toLowerCase, 'call', _181 => _181(), 'access', _182 => _182.includes, 'call', _183 => _183("html")])) return;
|
|
9837
|
+
const alternatePath = _chunkEUV4YR3Vcjs.getFarmMarkdownAlternatePath.call(void 0, config.md, route.route);
|
|
9527
9838
|
if (!alternatePath) return;
|
|
9528
9839
|
const routeRule = nitroInstance.options.routeRules[route.route] || {};
|
|
9529
9840
|
const alternate = `<${alternatePath}>; rel="alternate"; type="text/markdown"`;
|
|
@@ -9543,8 +9854,8 @@ function toFarmNodeResponse(request, response) {
|
|
|
9543
9854
|
}
|
|
9544
9855
|
if (config.security.csp && config.security.csp.nonce) {
|
|
9545
9856
|
nitroInstance.hooks.hook("prerender:generate", async (route) => {
|
|
9546
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
9547
|
-
const staticCsp = await
|
|
9857
|
+
if (!route.contents || !_optionalChain([route, 'access', _184 => _184.contentType, 'optionalAccess', _185 => _185.toLowerCase, 'call', _186 => _186(), 'access', _187 => _187.includes, 'call', _188 => _188("html")])) return;
|
|
9858
|
+
const staticCsp = await _chunkRU3M2FIKcjs.applyFarmCspHashesToHtml.call(void 0, route.contents, config.security);
|
|
9548
9859
|
if (!staticCsp) return;
|
|
9549
9860
|
route.contents = staticCsp.html;
|
|
9550
9861
|
const routeRule = nitroInstance.options.routeRules[route.route] || {};
|
|
@@ -9559,7 +9870,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
9559
9870
|
nitroInstance.routing.sync();
|
|
9560
9871
|
});
|
|
9561
9872
|
}
|
|
9562
|
-
if (farmNodeServerEntryPath) {
|
|
9873
|
+
if (farmNodeServerEntryPath || farmNetlifyEntryPath) {
|
|
9563
9874
|
nitroInstance.hooks.hook("prerender:config", (prerendererConfig) => {
|
|
9564
9875
|
delete prerendererConfig.entry;
|
|
9565
9876
|
});
|
|
@@ -9614,13 +9925,13 @@ function toFarmNodeResponse(request, response) {
|
|
|
9614
9925
|
}
|
|
9615
9926
|
if (prerenderRoutes.length > 0) {
|
|
9616
9927
|
_chunk5QIKR7RRcjs.logger.info(`\u{1F4C4} Pre-rendering ${prerenderRoutes.length} SSG page(s)`);
|
|
9617
|
-
const previousPrerender = process.env[
|
|
9618
|
-
process.env[
|
|
9928
|
+
const previousPrerender = process.env[_chunkTKSCR644cjs.FARM_PRERENDER_ENV];
|
|
9929
|
+
process.env[_chunkTKSCR644cjs.FARM_PRERENDER_ENV] = "1";
|
|
9619
9930
|
try {
|
|
9620
9931
|
await nitroBuilder.prerender(nitroInstance);
|
|
9621
9932
|
} finally {
|
|
9622
|
-
if (previousPrerender === void 0) delete process.env[
|
|
9623
|
-
else process.env[
|
|
9933
|
+
if (previousPrerender === void 0) delete process.env[_chunkTKSCR644cjs.FARM_PRERENDER_ENV];
|
|
9934
|
+
else process.env[_chunkTKSCR644cjs.FARM_PRERENDER_ENV] = previousPrerender;
|
|
9624
9935
|
}
|
|
9625
9936
|
}
|
|
9626
9937
|
const sharpRuntimeStagePromise = imageRuntime === "node" ? stageSharpRuntime(config, root, distDir, fs, preset) : Promise.resolve(null);
|
|
@@ -9751,7 +10062,7 @@ async function moveVercelOutputPath(src, dest, fs) {
|
|
|
9751
10062
|
await fs.rename(src, dest);
|
|
9752
10063
|
return;
|
|
9753
10064
|
} catch (error) {
|
|
9754
|
-
const code = _optionalChain([error, 'optionalAccess',
|
|
10065
|
+
const code = _optionalChain([error, 'optionalAccess', _189 => _189.code]);
|
|
9755
10066
|
if (code !== "EPERM" && code !== "EACCES" && code !== "EXDEV" && code !== "ENOTEMPTY") {
|
|
9756
10067
|
throw error;
|
|
9757
10068
|
}
|
|
@@ -9778,7 +10089,7 @@ async function postProcessVercelOutput(root, outputDir, fs, config, farmWorkflow
|
|
|
9778
10089
|
try {
|
|
9779
10090
|
await moveVercelOutputPath(publicDir, staticDir, fs);
|
|
9780
10091
|
} catch (error) {
|
|
9781
|
-
if (_optionalChain([error, 'optionalAccess',
|
|
10092
|
+
if (_optionalChain([error, 'optionalAccess', _190 => _190.code]) !== "ENOENT") throw error;
|
|
9782
10093
|
}
|
|
9783
10094
|
await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs);
|
|
9784
10095
|
await copyPrismaClientForVercel(root, nitroFuncDir, fs);
|
|
@@ -9795,7 +10106,7 @@ async function postProcessVercelOutput(root, outputDir, fs, config, farmWorkflow
|
|
|
9795
10106
|
presetRoutes: Array.isArray(vercelConfig.routes) ? vercelConfig.routes : [],
|
|
9796
10107
|
runtimeRoutes
|
|
9797
10108
|
});
|
|
9798
|
-
const vercelConfigWithWorkflowCrons =
|
|
10109
|
+
const vercelConfigWithWorkflowCrons = _chunkVFQT3LAOcjs.applyFarmWorkflowVercelCrons.call(void 0,
|
|
9799
10110
|
vercelConfig,
|
|
9800
10111
|
farmWorkflows.workflows
|
|
9801
10112
|
);
|
|
@@ -9811,7 +10122,7 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs) {
|
|
|
9811
10122
|
const docsContentDir = resolveBuildDocsContentDir(config, root);
|
|
9812
10123
|
if (!docsContentDir) return;
|
|
9813
10124
|
const bundledContentDir = _path2.default.join(nitroFuncDir, "farm-docs-content");
|
|
9814
|
-
const lastModifiedManifest =
|
|
10125
|
+
const lastModifiedManifest = _chunkVZJR7UTGcjs.createFarmDocsLastModifiedManifest.call(void 0, docsContentDir, {
|
|
9815
10126
|
fallback: "now"
|
|
9816
10127
|
});
|
|
9817
10128
|
await fs.rm(bundledContentDir, { recursive: true, force: true });
|
|
@@ -9821,7 +10132,7 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs) {
|
|
|
9821
10132
|
force: true
|
|
9822
10133
|
});
|
|
9823
10134
|
await fs.writeFile(
|
|
9824
|
-
_path2.default.join(bundledContentDir,
|
|
10135
|
+
_path2.default.join(bundledContentDir, _chunkVZJR7UTGcjs.FARM_DOCS_LAST_MODIFIED_MANIFEST),
|
|
9825
10136
|
`${JSON.stringify(lastModifiedManifest, null, 2)}
|
|
9826
10137
|
`
|
|
9827
10138
|
);
|
|
@@ -9898,7 +10209,7 @@ async function stageSharpRuntime(config, root, distDir, fs, preset) {
|
|
|
9898
10209
|
try {
|
|
9899
10210
|
await copyPackage("sharp", sharpRequire);
|
|
9900
10211
|
if (!copiedPackages.has("sharp")) {
|
|
9901
|
-
throw new Error(`Farm image optimization requires sharp. ${
|
|
10212
|
+
throw new Error(`Farm image optimization requires sharp. ${_chunkICUQICNCcjs.SHARP_INSTALL_HINT}`);
|
|
9902
10213
|
}
|
|
9903
10214
|
} catch (error) {
|
|
9904
10215
|
await fs.rm(stageDir, { recursive: true, force: true });
|
|
@@ -10112,7 +10423,7 @@ function createBuildTargetBaseline(config) {
|
|
|
10112
10423
|
preset,
|
|
10113
10424
|
distDir,
|
|
10114
10425
|
outputDir,
|
|
10115
|
-
outputWasDerived: outputDir ===
|
|
10426
|
+
outputWasDerived: outputDir === _chunkF7JZENPFcjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
|
|
10116
10427
|
};
|
|
10117
10428
|
}
|
|
10118
10429
|
_chunkS3JO3N4Hcjs.__name.call(void 0, createBuildTargetBaseline, "createBuildTargetBaseline");
|
|
@@ -10122,8 +10433,8 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
10122
10433
|
const distDir = config.distDir || ".farm";
|
|
10123
10434
|
const outputWasReplaced = config.deploy.outputDir !== baseline.outputDir;
|
|
10124
10435
|
const shouldRefreshDerivedOutput = baseline.outputWasDerived && !outputWasReplaced && (preset !== baseline.preset || distDir !== baseline.distDir);
|
|
10125
|
-
const deployTarget = preset === config.deploy.preset ? config.deploy.target :
|
|
10126
|
-
const outputDir = shouldRefreshDerivedOutput ?
|
|
10436
|
+
const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunkF7JZENPFcjs.getDeployTargetForPreset.call(void 0, preset);
|
|
10437
|
+
const outputDir = shouldRefreshDerivedOutput ? _chunkF7JZENPFcjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
|
|
10127
10438
|
return {
|
|
10128
10439
|
root,
|
|
10129
10440
|
preset,
|
|
@@ -10131,7 +10442,7 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
10131
10442
|
distDir,
|
|
10132
10443
|
deployTarget,
|
|
10133
10444
|
outputDir,
|
|
10134
|
-
deployOutputDir:
|
|
10445
|
+
deployOutputDir: _chunkF7JZENPFcjs.resolveDeployOutputPath.call(void 0, root, outputDir)
|
|
10135
10446
|
};
|
|
10136
10447
|
}
|
|
10137
10448
|
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveBuildTargets, "resolveBuildTargets");
|
|
@@ -10140,7 +10451,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
10140
10451
|
const targetBaseline = createBuildTargetBaseline(config);
|
|
10141
10452
|
let targets;
|
|
10142
10453
|
const productionViteResultPromise = options.universal === false ? void 0 : Promise.allSettled([Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkA6WIQH5Zcjs.loadFarmProductionVite.call(void 0, ))))]);
|
|
10143
|
-
const pluginManager = new (0,
|
|
10454
|
+
const pluginManager = new (0, _chunkICUQICNCcjs.PluginManager)({
|
|
10144
10455
|
config,
|
|
10145
10456
|
isDev: false,
|
|
10146
10457
|
isProd: true
|
|
@@ -10169,12 +10480,12 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
10169
10480
|
};
|
|
10170
10481
|
config = {
|
|
10171
10482
|
...config,
|
|
10172
|
-
images:
|
|
10483
|
+
images: _chunkICUQICNCcjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
|
|
10173
10484
|
root: targets.root,
|
|
10174
10485
|
preset: targets.preset
|
|
10175
10486
|
})
|
|
10176
10487
|
};
|
|
10177
|
-
if (_optionalChain([config, 'access',
|
|
10488
|
+
if (_optionalChain([config, 'access', _191 => _191.docs, 'optionalAccess', _192 => _192.enabled])) await _chunkIK6LVLKCcjs.loadFarmDocsEngine.call(void 0, );
|
|
10178
10489
|
pluginManager.updateContext({ config });
|
|
10179
10490
|
const { root, preset, srcDir, distDir, deployOutputDir } = targets;
|
|
10180
10491
|
_chunk5QIKR7RRcjs.logger.info(`\u{1F69C} Building Farm.js application with preset: ${preset}...`);
|
|
@@ -10188,8 +10499,8 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
10188
10499
|
});
|
|
10189
10500
|
_chunk5QIKR7RRcjs.logger.info("\u{1F50D} Discovering routes and API endpoints...");
|
|
10190
10501
|
const productionViteResult = productionViteResultPromise ? (await productionViteResultPromise)[0] : void 0;
|
|
10191
|
-
if (_optionalChain([productionViteResult, 'optionalAccess',
|
|
10192
|
-
const productionVite = _optionalChain([productionViteResult, 'optionalAccess',
|
|
10502
|
+
if (_optionalChain([productionViteResult, 'optionalAccess', _193 => _193.status]) === "rejected") throw productionViteResult.reason;
|
|
10503
|
+
const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _194 => _194.value]);
|
|
10193
10504
|
const createViteServer = productionVite ? productionVite.createServer : (await import("vite")).createServer;
|
|
10194
10505
|
projectModuleServer = await createProjectModuleServer(
|
|
10195
10506
|
createViteServer,
|
|
@@ -10197,18 +10508,18 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
10197
10508
|
root,
|
|
10198
10509
|
rendererBuild.signal
|
|
10199
10510
|
);
|
|
10200
|
-
const farmApp =
|
|
10511
|
+
const farmApp = _chunkICUQICNCcjs.createFarmApp.call(void 0, config, projectModuleServer);
|
|
10201
10512
|
await farmApp.initialize();
|
|
10202
10513
|
const routeManager = farmApp.getRouteManager();
|
|
10203
10514
|
const serverRenderer = farmApp.getServerRenderer();
|
|
10204
|
-
const typeArtifacts =
|
|
10515
|
+
const typeArtifacts = _chunk3BHT4WMPcjs.generateFarmTypeArtifacts.call(void 0, {
|
|
10205
10516
|
root,
|
|
10206
10517
|
srcDir,
|
|
10207
10518
|
layers: config.layers,
|
|
10208
10519
|
plugins: config.plugins,
|
|
10209
10520
|
extraRoutes: [
|
|
10210
|
-
..._optionalChain([config, 'access',
|
|
10211
|
-
...
|
|
10521
|
+
..._optionalChain([config, 'access', _195 => _195.openapi, 'optionalAccess', _196 => _196.enabled]) && config.openapi.route ? [config.openapi.route] : [],
|
|
10522
|
+
..._chunkVZJR7UTGcjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
|
|
10212
10523
|
],
|
|
10213
10524
|
suppressLintOnLink: config.suppressLintOnLink,
|
|
10214
10525
|
componentExtensions: config.renderer.componentExtensions,
|
|
@@ -10217,7 +10528,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
10217
10528
|
const message = error instanceof Error ? error.message : String(error);
|
|
10218
10529
|
_chunk5QIKR7RRcjs.logger.warn(`Route type generation failed (farm.d.ts may be stale): ${message}`);
|
|
10219
10530
|
});
|
|
10220
|
-
const apiRouteManager = new (0,
|
|
10531
|
+
const apiRouteManager = new (0, _chunkXBML5KMGcjs.APIRouteManager)(
|
|
10221
10532
|
_chunkVPTDD5XFcjs.getFarmAppDirectories.call(void 0, config),
|
|
10222
10533
|
projectModuleServer,
|
|
10223
10534
|
{
|
|
@@ -10225,7 +10536,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
10225
10536
|
plugins: config.plugins,
|
|
10226
10537
|
i18n: farmApp.getI18nRuntime(),
|
|
10227
10538
|
bodySizeLimit: config.server.bodySizeLimit,
|
|
10228
|
-
basePath:
|
|
10539
|
+
basePath: _chunkKNBBQHO2cjs.resolveFarmAPIServerBasePath.call(void 0, config.api)
|
|
10229
10540
|
}
|
|
10230
10541
|
);
|
|
10231
10542
|
const [, apiDiscovery] = await Promise.allSettled([
|
|
@@ -10292,7 +10603,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
10292
10603
|
throw error;
|
|
10293
10604
|
} finally {
|
|
10294
10605
|
try {
|
|
10295
|
-
await _optionalChain([projectModuleServer, 'optionalAccess',
|
|
10606
|
+
await _optionalChain([projectModuleServer, 'optionalAccess', _197 => _197.close, 'call', _198 => _198()]);
|
|
10296
10607
|
} finally {
|
|
10297
10608
|
rendererBuild.abort();
|
|
10298
10609
|
}
|
|
@@ -10304,7 +10615,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
10304
10615
|
ssr: true,
|
|
10305
10616
|
buildLifetime
|
|
10306
10617
|
});
|
|
10307
|
-
const viteConfig =
|
|
10618
|
+
const viteConfig = _chunkICUQICNCcjs.mergeFarmViteConfig.call(void 0,
|
|
10308
10619
|
{
|
|
10309
10620
|
root,
|
|
10310
10621
|
appType: "custom",
|
|
@@ -10316,19 +10627,19 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
10316
10627
|
},
|
|
10317
10628
|
plugins: [
|
|
10318
10629
|
...rendererVitePlugins,
|
|
10319
|
-
|
|
10630
|
+
_chunkICUQICNCcjs.farmFontImportsPlugin.call(void 0, {
|
|
10320
10631
|
root,
|
|
10321
10632
|
basePath: config.basePath,
|
|
10322
10633
|
publicDir: config.publicDir
|
|
10323
10634
|
}),
|
|
10324
|
-
|
|
10635
|
+
_chunk3SDFA7UFcjs.farmEnvironmentFunctionsPlugin.call(void 0, )
|
|
10325
10636
|
],
|
|
10326
10637
|
server: {
|
|
10327
10638
|
middlewareMode: true,
|
|
10328
10639
|
hmr: false
|
|
10329
10640
|
},
|
|
10330
10641
|
resolve: {
|
|
10331
|
-
alias:
|
|
10642
|
+
alias: _chunkICUQICNCcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
10332
10643
|
dedupe: [...config.renderer.dedupe || []]
|
|
10333
10644
|
},
|
|
10334
10645
|
optimizeDeps: {
|
|
@@ -10385,7 +10696,7 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
|
|
|
10385
10696
|
farmI18nClientBridgePlugin(),
|
|
10386
10697
|
farmServerOnlyEntriesPlugin(),
|
|
10387
10698
|
farmPlugin(config, pluginManager),
|
|
10388
|
-
|
|
10699
|
+
_chunk3SDFA7UFcjs.farmEnvironmentFunctionsPlugin.call(void 0, )
|
|
10389
10700
|
],
|
|
10390
10701
|
mode: "production"
|
|
10391
10702
|
});
|
|
@@ -10414,12 +10725,12 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
|
|
|
10414
10725
|
define: {
|
|
10415
10726
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
10416
10727
|
__FARM_ENV__: JSON.stringify(_chunkVEKFLAQMcjs.createBundledEnv.call(void 0, config.env)),
|
|
10417
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
10728
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _199 => _199.env, 'optionalAccess', _200 => _200.public]) || {})
|
|
10418
10729
|
},
|
|
10419
10730
|
plugins: [
|
|
10420
10731
|
farmI18nClientBridgePlugin(),
|
|
10421
10732
|
farmPlugin(config, pluginManager),
|
|
10422
|
-
|
|
10733
|
+
_chunk3SDFA7UFcjs.farmEnvironmentFunctionsPlugin.call(void 0, )
|
|
10423
10734
|
],
|
|
10424
10735
|
mode: "production"
|
|
10425
10736
|
});
|
|
@@ -10436,7 +10747,7 @@ function resolveLegacyPageEntry(config, root, srcDir) {
|
|
|
10436
10747
|
_chunkS3JO3N4Hcjs.__name.call(void 0, resolveLegacyPageEntry, "resolveLegacyPageEntry");
|
|
10437
10748
|
async function buildNitro(config, routeManager, apiRouteManager, serverRenderer, preset, root, distDir, pluginManager) {
|
|
10438
10749
|
const [{ createNitroConfig }, { createNitro, build: nitroBuild }] = await Promise.all([
|
|
10439
|
-
import("./nitro-
|
|
10750
|
+
import("./nitro-OVPLKPE2.cjs"),
|
|
10440
10751
|
import("nitro/builder")
|
|
10441
10752
|
]);
|
|
10442
10753
|
let nitroConfig = await createNitroConfig(
|
|
@@ -10449,7 +10760,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
10449
10760
|
if (pluginManager) {
|
|
10450
10761
|
nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
|
|
10451
10762
|
}
|
|
10452
|
-
const outputDir =
|
|
10763
|
+
const outputDir = _chunkF7JZENPFcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
10453
10764
|
const serverOutputDir = _path2.default.join(outputDir, "server");
|
|
10454
10765
|
const publicOutputDir = _path2.default.join(outputDir, "public");
|
|
10455
10766
|
const { mkdir, cp } = await import("fs/promises");
|
|
@@ -10520,7 +10831,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
10520
10831
|
root,
|
|
10521
10832
|
preset,
|
|
10522
10833
|
distDir,
|
|
10523
|
-
outputDir:
|
|
10834
|
+
outputDir: _chunkF7JZENPFcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
|
|
10524
10835
|
});
|
|
10525
10836
|
}
|
|
10526
10837
|
}
|