@farm.js/core 0.1.69 → 0.1.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-mcp-handler-FER4MQDF.cjs → agent-mcp-handler-KE4J3W7S.cjs} +8 -5
- package/dist/{agent-mcp-handler-AZ7QW4UP.mjs → agent-mcp-handler-VIT4GOSR.mjs} +7 -4
- package/dist/{agent-mcp.d-DOfBMEzP.d.mts → agent-mcp.d-BzNw6JI8.d.ts} +24 -5
- package/dist/{agent-mcp.d-DnIgriX1.d.ts → agent-mcp.d-CgFen3EH.d.mts} +24 -5
- package/dist/agent-runtime.cjs +3 -3
- package/dist/agent-runtime.d.mts +3 -2
- package/dist/agent-runtime.d.ts +3 -2
- package/dist/agent-runtime.mjs +2 -2
- package/dist/analyzer-LPIVRSTJ.cjs +16 -0
- package/dist/{analyzer-NAL5TJUP.mjs → analyzer-VK3BAOFI.mjs} +2 -2
- package/dist/api/node.d.mts +5 -4
- package/dist/api/node.d.ts +5 -4
- package/dist/api/route-manager.cjs +4 -4
- package/dist/api/route-manager.d.mts +16 -7
- package/dist/api/route-manager.d.ts +16 -7
- package/dist/api/route-manager.mjs +3 -3
- package/dist/api/runtime.d.mts +4 -3
- package/dist/api/runtime.d.ts +4 -3
- package/dist/api.cjs +6 -6
- package/dist/api.d.mts +8 -7
- package/dist/api.d.ts +8 -7
- package/dist/api.mjs +5 -5
- package/dist/{app-manifest.d-CaAcaukR.d.ts → app-manifest.d-DY4JfJxi.d.ts} +1 -1
- package/dist/{app-manifest.d-_BVbI0xp.d.mts → app-manifest.d-DpDK_B1k.d.mts} +1 -1
- package/dist/app-markdown.cjs +7 -4
- package/dist/app-markdown.d.mts +5 -4
- package/dist/app-markdown.d.ts +5 -4
- package/dist/app-markdown.mjs +6 -3
- package/dist/{app.d-BWeDqOaF.d.ts → app.d-BeK6bb1c.d.ts} +22 -10
- package/dist/{app.d-CaPwtytN.d.mts → app.d-D-5UNrFd.d.mts} +22 -10
- package/dist/{base-path.d-CTDVF0Fc.d.mts → base-path.d-BJ3SYpB8.d.mts} +6 -1
- package/dist/{base-path.d-CTDVF0Fc.d.ts → base-path.d-BJ3SYpB8.d.ts} +6 -1
- package/dist/{chunk-4ZXKYCYK.mjs → chunk-255J7K4X.mjs} +1 -1
- package/dist/{chunk-RVGLYMJM.cjs → chunk-2AM26UGI.cjs} +2 -2
- package/dist/{chunk-5TOWKGV3.mjs → chunk-2CQC5CMD.mjs} +1 -1
- package/dist/{chunk-VO65MYJD.cjs → chunk-2IFT2CSA.cjs} +4 -4
- package/dist/{chunk-UPOYKX4S.cjs → chunk-2MR4MABG.cjs} +4 -4
- package/dist/chunk-2RCCFB2Y.cjs +129 -0
- package/dist/{chunk-K6VFYFOY.cjs → chunk-2W4GNXGX.cjs} +2 -2
- package/dist/{chunk-CV6MFQ4Y.mjs → chunk-3AUINHFG.mjs} +1 -1
- package/dist/{chunk-TKYOJ5G2.cjs → chunk-3BQ7QHUH.cjs} +5 -5
- package/dist/{chunk-MMDKYJ5V.cjs → chunk-3GNVIYPO.cjs} +7 -7
- package/dist/{chunk-65Y5SIBH.cjs → chunk-3QM74STY.cjs} +1 -1
- package/dist/{chunk-FJMC24KG.cjs → chunk-42KMUIWZ.cjs} +0 -3
- package/dist/{chunk-YVPX5PI5.mjs → chunk-4O26BPUY.mjs} +8 -0
- package/dist/{chunk-PDQ6EGPK.mjs → chunk-4OD2LXF2.mjs} +2 -2
- package/dist/{chunk-LENKRGBV.mjs → chunk-5CFHQ7HM.mjs} +1 -1
- package/dist/{chunk-3Y52TWYU.mjs → chunk-62ZRA7XU.mjs} +0 -3
- package/dist/{chunk-K76CBYQM.mjs → chunk-7A3URI2F.mjs} +20 -0
- package/dist/{chunk-UHU4QALN.mjs → chunk-7BUE2GM6.mjs} +294 -164
- package/dist/{chunk-L6NWQ3DR.cjs → chunk-7OHJWFLB.cjs} +600 -469
- package/dist/{chunk-VX2HZGC7.cjs → chunk-ACGBXN3U.cjs} +2 -2
- package/dist/{chunk-MV7NWU23.mjs → chunk-AYVGD3PK.mjs} +1 -1
- package/dist/{chunk-FT6KJHS3.cjs → chunk-C2JOS77Z.cjs} +4 -1
- package/dist/{chunk-CRVSYDHV.mjs → chunk-CKQAQFF6.mjs} +2 -2
- package/dist/{chunk-QOGIZKSO.cjs → chunk-CSQPMV3Q.cjs} +21 -11
- package/dist/chunk-DC2AXGNZ.mjs +129 -0
- package/dist/{chunk-Q4HH5Q6A.cjs → chunk-DMXMIE2C.cjs} +2 -2
- package/dist/{chunk-MAGFDK4Q.mjs → chunk-DPIGYXSV.mjs} +1 -1
- package/dist/{chunk-GUMKIQJL.cjs → chunk-DPYBVVL3.cjs} +2 -2
- package/dist/{chunk-23VJEGKC.cjs → chunk-DVJM55D2.cjs} +9 -1
- package/dist/{chunk-QSUYB3RH.cjs → chunk-DZHTNSQ5.cjs} +14 -14
- package/dist/{chunk-OIOPQ25L.mjs → chunk-E77IA5IF.mjs} +46 -33
- package/dist/{chunk-EZTKXD6P.cjs → chunk-FDGYDQGL.cjs} +8 -1
- package/dist/{chunk-PLJKJJ2H.mjs → chunk-FETMUBIA.mjs} +27 -82
- package/dist/{chunk-HJZZSBVK.cjs → chunk-FILXOEWD.cjs} +2 -2
- package/dist/{chunk-PDFFYZAT.cjs → chunk-GF22VGMS.cjs} +2 -2
- package/dist/{chunk-IYLZZTP6.mjs → chunk-GUU3IZSM.mjs} +167 -77
- package/dist/{chunk-OOJBBHYW.cjs → chunk-GVYZCJZH.cjs} +30 -1
- package/dist/{chunk-YOHHL2UE.mjs → chunk-I4KPA2C6.mjs} +1 -1
- package/dist/{chunk-PEYDQMSA.mjs → chunk-IGXS54GC.mjs} +6 -6
- package/dist/{chunk-NVOMQLI2.mjs → chunk-IWJONXPF.mjs} +11 -0
- package/dist/{chunk-SZORL7EW.mjs → chunk-IYDJNCR7.mjs} +6 -6
- package/dist/{chunk-HEJM46HQ.mjs → chunk-J5ASGNKF.mjs} +28 -2
- package/dist/{chunk-RLH5AH2M.mjs → chunk-JDO346NV.mjs} +1 -1
- package/dist/{chunk-K6SXMVXO.mjs → chunk-JMFTKNBA.mjs} +22 -7
- package/dist/{chunk-YIHRZBD7.cjs → chunk-JRGR5Z4K.cjs} +1 -1
- package/dist/{chunk-4W4ZWSV2.cjs → chunk-JVA4PIYN.cjs} +604 -434
- package/dist/{chunk-UKZ6AWKZ.cjs → chunk-JWY66PID.cjs} +44 -1
- package/dist/{chunk-BDYM2TN3.cjs → chunk-JX5VOLAV.cjs} +8 -8
- package/dist/{chunk-WMLSZAKN.mjs → chunk-JZQS3ZOI.mjs} +1 -1
- package/dist/{chunk-OFBLGH6V.cjs → chunk-K66JILV3.cjs} +47 -34
- package/dist/{chunk-6GQJVY4E.cjs → chunk-KEB7AGS6.cjs} +17 -17
- package/dist/{chunk-IFR74W6S.mjs → chunk-KPJYBSHL.mjs} +4 -1
- package/dist/{chunk-TEJ67GD2.mjs → chunk-KQAB5LML.mjs} +28 -6
- package/dist/{chunk-DHR2WDSL.cjs → chunk-KWST2O22.cjs} +387 -297
- package/dist/{chunk-3EEINK7G.cjs → chunk-L6E4SHUB.cjs} +41 -15
- package/dist/{chunk-KI3MU7B5.mjs → chunk-LDVJIBGN.mjs} +1 -1
- package/dist/{chunk-5FBZJJGA.mjs → chunk-LXEJNWF5.mjs} +2 -2
- package/dist/{chunk-AKIQ54FK.cjs → chunk-MBCRWU3P.cjs} +26 -81
- package/dist/{chunk-22LGTSBA.cjs → chunk-MEJCP2LX.cjs} +1 -1
- package/dist/{chunk-ZR2QB45W.mjs → chunk-MITIAOUQ.mjs} +4 -4
- package/dist/{chunk-OCNV4CI2.cjs → chunk-MQ4DYVFS.cjs} +26 -0
- package/dist/{chunk-P2NBQ5JI.mjs → chunk-MWUDEYBI.mjs} +1 -1
- package/dist/{chunk-LR4KP3I7.cjs → chunk-N3XO5AL5.cjs} +2 -2
- package/dist/{chunk-ZPKJPM7K.mjs → chunk-NA77GEIU.mjs} +2 -2
- package/dist/{chunk-FVYBEMOD.cjs → chunk-NAXKOTPP.cjs} +6 -6
- package/dist/{chunk-I7J5RLGO.cjs → chunk-NLBHLPEO.cjs} +12 -1
- package/dist/{chunk-R2ZHU37O.mjs → chunk-NLRAQXAA.mjs} +26 -0
- package/dist/{chunk-QO43L7Z4.cjs → chunk-O32QPFVV.cjs} +25 -7
- package/dist/{chunk-CO6UYM2D.mjs → chunk-O5QUJEWT.mjs} +1 -1
- package/dist/{chunk-JL2YW5KX.mjs → chunk-OAEDVXVE.mjs} +44 -1
- package/dist/{chunk-F6YLXK5L.cjs → chunk-PLXD2MJV.cjs} +19 -19
- package/dist/{chunk-JFPKARWM.cjs → chunk-PMU4U2W2.cjs} +1 -0
- package/dist/{chunk-GTQOEEE7.cjs → chunk-Q5HMVGR5.cjs} +13 -13
- package/dist/{chunk-ZYCEEE3V.mjs → chunk-QUFENL7Q.mjs} +2 -2
- package/dist/{chunk-QOSDWGKT.mjs → chunk-QVBXTSIZ.mjs} +1 -1
- package/dist/{chunk-OGVTUGMU.mjs → chunk-REP6HWJN.mjs} +13 -3
- package/dist/{chunk-ANMIR6US.mjs → chunk-RJUCNO7R.mjs} +1 -1
- package/dist/{chunk-WYL4ODZ4.mjs → chunk-SE7HPBYK.mjs} +30 -1
- package/dist/{chunk-GQ6QOH7T.cjs → chunk-SXMWVP2L.cjs} +12 -12
- package/dist/{chunk-D5F7RPZP.mjs → chunk-THG2TVDH.mjs} +3 -3
- package/dist/{chunk-X3MHKLCO.cjs → chunk-TP4RAV7Y.cjs} +25 -10
- package/dist/{chunk-DWLNLU55.cjs → chunk-TPYAYFMF.cjs} +2 -2
- package/dist/{chunk-Y6KHPJDB.cjs → chunk-U7VH3Q5E.cjs} +2 -2
- package/dist/{chunk-4JRAMCUP.cjs → chunk-UISZLYKY.cjs} +22 -22
- package/dist/{chunk-CKCKCUYO.mjs → chunk-UQUOSNRN.mjs} +511 -341
- package/dist/{chunk-2P7UYHZP.mjs → chunk-V25GSH43.mjs} +1 -1
- package/dist/{chunk-437QZIC2.cjs → chunk-VNBDN5W2.cjs} +5 -5
- package/dist/{chunk-ABIBASLJ.cjs → chunk-VXB5CMNC.cjs} +2 -2
- package/dist/{chunk-G7NBPP7H.mjs → chunk-W2T6NDNP.mjs} +11 -1
- package/dist/{chunk-AJNBTOVQ.mjs → chunk-WW3LRNQV.mjs} +1 -1
- package/dist/{chunk-GFPS7MNE.mjs → chunk-WX63N6C5.mjs} +4 -4
- package/dist/{chunk-ULMXZYOA.mjs → chunk-X7LGLF33.mjs} +1 -1
- package/dist/{chunk-VOQ7XZZT.cjs → chunk-Y2SZVIVH.cjs} +20 -0
- package/dist/{chunk-XCAQTCGK.mjs → chunk-YBY34UHB.mjs} +1 -1
- package/dist/{chunk-5NFQ6AZI.cjs → chunk-YCNHUIPR.cjs} +33 -11
- package/dist/{chunk-YGJ5P3TJ.mjs → chunk-Z3GPAFIA.mjs} +21 -3
- package/dist/{chunk-PJQ5W356.mjs → chunk-Z5ZZAGIH.mjs} +1 -0
- package/dist/{chunk-L5OZN6YW.cjs → chunk-ZPUAOKHV.cjs} +3 -3
- package/dist/{chunk-4E57QHPW.cjs → chunk-ZUVAGMQ5.cjs} +17 -7
- package/dist/{chunk-23LVFSID.mjs → chunk-ZXDX7VYZ.mjs} +7 -0
- package/dist/{client-component.d-CnEeVvGG.d.mts → client-component.d-DwpH251K.d.mts} +2 -2
- package/dist/{client-component.d-CfJxuXZl.d.ts → client-component.d-fYupugbZ.d.ts} +2 -2
- package/dist/{client-plugins.d-D7dHV1Nf.d.ts → client-plugins.d-BxqFfHpM.d.ts} +39 -3
- package/dist/{client-plugins.d-Do5ULA0x.d.mts → client-plugins.d-k3bOT5gz.d.mts} +39 -3
- package/dist/client-plugins.d.mts +3 -2
- package/dist/client-plugins.d.ts +3 -2
- package/dist/client.cjs +6 -6
- package/dist/client.d.mts +8 -7
- package/dist/client.d.ts +8 -7
- package/dist/client.mjs +5 -5
- package/dist/config.d.mts +3 -2
- package/dist/config.d.ts +3 -2
- package/dist/deployment.cjs +4 -2
- package/dist/deployment.d.mts +7 -1
- package/dist/deployment.d.ts +7 -1
- package/dist/deployment.mjs +5 -3
- package/dist/desktop.d.mts +4 -3
- package/dist/desktop.d.ts +4 -3
- package/dist/{dev-guard-ONNMVQUN.mjs → dev-guard-ZDIELV6Q.mjs} +1 -1
- package/dist/{dev-guard-2UW2KERP.cjs → dev-guard-ZLLKVO5T.cjs} +2 -2
- package/dist/{devtools-BP4EBTKQ.mjs → devtools-6MXPFPNJ.mjs} +9 -8
- package/dist/{devtools-7HNDS4SY.cjs → devtools-O5625KCK.cjs} +10 -9
- package/dist/docs.cjs +13 -12
- package/dist/docs.d.mts +4 -3
- package/dist/docs.d.ts +4 -3
- package/dist/docs.mjs +12 -11
- package/dist/environment/vite.cjs +3 -3
- package/dist/environment/vite.mjs +2 -2
- package/dist/headers.d-DalIGbVO.d.ts +18 -0
- package/dist/headers.d-sNT7ZQiU.d.mts +18 -0
- package/dist/i18n/client.cjs +2 -2
- package/dist/i18n/client.d.mts +2 -2
- package/dist/i18n/client.d.ts +2 -2
- package/dist/i18n/client.mjs +1 -1
- package/dist/i18n/index.cjs +2 -2
- package/dist/i18n/index.d.mts +3 -3
- package/dist/i18n/index.d.ts +3 -3
- package/dist/i18n/index.mjs +1 -1
- package/dist/i18n/server.cjs +3 -3
- package/dist/i18n/server.d.mts +5 -5
- package/dist/i18n/server.d.ts +5 -5
- package/dist/i18n/server.mjs +2 -2
- package/dist/index.cjs +50 -45
- package/dist/{index.d-CVFk37uX.d.ts → index.d-BcA-secm.d.ts} +1 -1
- package/dist/{index.d-B1MpEJAo.d.mts → index.d-DDHHAv7j.d.mts} +1 -1
- package/dist/index.d.mts +26 -24
- package/dist/index.d.ts +26 -24
- package/dist/index.mjs +63 -58
- package/dist/integrations/orm.d.mts +3 -2
- package/dist/integrations/orm.d.ts +3 -2
- package/dist/integrations.cjs +3 -3
- package/dist/integrations.d.mts +3 -2
- package/dist/integrations.d.ts +3 -2
- package/dist/integrations.mjs +2 -2
- package/dist/internal/app-markdown-runtime.cjs +6 -3
- package/dist/internal/app-markdown-runtime.d.mts +13 -4
- package/dist/internal/app-markdown-runtime.d.ts +13 -4
- package/dist/internal/app-markdown-runtime.mjs +5 -2
- package/dist/internal/build-runtime.cjs +37 -37
- package/dist/internal/build-runtime.d.mts +5 -4
- package/dist/internal/build-runtime.d.ts +5 -4
- package/dist/internal/build-runtime.mjs +36 -36
- package/dist/internal/cli-runtime.cjs +18 -15
- package/dist/internal/cli-runtime.mjs +17 -14
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.cjs +5 -3
- package/dist/internal/client-runtime.d.mts +17 -7
- package/dist/internal/client-runtime.d.ts +17 -7
- package/dist/internal/client-runtime.mjs +4 -2
- package/dist/internal/compression-runtime.d.mts +3 -2
- package/dist/internal/compression-runtime.d.ts +3 -2
- package/dist/internal/config-runtime.cjs +11 -10
- package/dist/internal/config-runtime.d.mts +6 -5
- package/dist/internal/config-runtime.d.ts +6 -5
- package/dist/internal/config-runtime.mjs +10 -9
- package/dist/internal/infra-analytics-runtime.cjs +12 -9
- package/dist/internal/infra-analytics-runtime.mjs +10 -7
- package/dist/internal/native-server-fns.cjs +4 -4
- package/dist/internal/native-server-fns.mjs +3 -3
- package/dist/internal/product-telemetry-runtime.cjs +3 -3
- package/dist/internal/product-telemetry-runtime.mjs +2 -2
- package/dist/internal/production-runtime.cjs +48 -17
- package/dist/internal/production-runtime.d.mts +53 -18
- package/dist/internal/production-runtime.d.ts +53 -18
- package/dist/internal/production-runtime.mjs +50 -19
- package/dist/internal/vercel-edge-middleware.cjs +3 -2
- package/dist/internal/vercel-edge-middleware.d.mts +2 -2
- package/dist/internal/vercel-edge-middleware.d.ts +2 -2
- package/dist/internal/vercel-edge-middleware.mjs +2 -1
- package/dist/markdown.cjs +3 -2
- package/dist/markdown.d.mts +3 -2
- package/dist/markdown.d.ts +3 -2
- package/dist/markdown.mjs +2 -1
- package/dist/middleware.cjs +6 -5
- package/dist/middleware.d.mts +4 -3
- package/dist/middleware.d.ts +4 -3
- package/dist/middleware.mjs +5 -4
- package/dist/mobile.d.mts +3 -3
- package/dist/mobile.d.ts +3 -3
- package/dist/{mount.d-CBqr-LfI.d.mts → mount.d-C1PONsEe.d.mts} +1 -1
- package/dist/{mount.d-CGzN61Kq.d.ts → mount.d-D3JOux2V.d.ts} +1 -1
- package/dist/{native-tree-W2SSJB3Y.cjs → native-tree-GF4BH33L.cjs} +4 -3
- package/dist/{native-tree-Y5YQANW7.mjs → native-tree-L2IIEBXH.mjs} +3 -2
- package/dist/{navigation-delegate.d-BwCOhpj7.d.mts → navigation-delegate.d-CJQQHboA.d.mts} +1 -1
- package/dist/{navigation-delegate.d-CLH2dXjy.d.ts → navigation-delegate.d-CQQPbdkE.d.ts} +1 -1
- package/dist/navigation.cjs +5 -5
- package/dist/navigation.d.mts +6 -5
- package/dist/navigation.d.ts +6 -5
- package/dist/navigation.mjs +4 -4
- package/dist/{nitro-Y3LGITW3.cjs → nitro-2LMOMIST.cjs} +2 -2
- package/dist/{nitro-NSTXT7LB.mjs → nitro-72TFIGGO.mjs} +1 -1
- package/dist/{plugin-F2O4BFTK.cjs → plugin-5PIQQVRP.cjs} +2 -2
- package/dist/{plugin-VEBRN7A3.mjs → plugin-QZT747YW.mjs} +1 -1
- package/dist/plugin.cjs +30 -29
- package/dist/plugin.d.mts +6 -4
- package/dist/plugin.d.ts +6 -4
- package/dist/plugin.mjs +29 -28
- package/dist/{production-runtime.d-DMZY3OgV.d.mts → production-runtime.d-B0IeWWyO.d.mts} +23 -2
- package/dist/{production-runtime.d-BMyyLGBB.d.ts → production-runtime.d-q3aHIv5Y.d.ts} +23 -2
- package/dist/query/client.cjs +6 -6
- package/dist/query/client.mjs +2 -2
- package/dist/{render-plan.d-CzGDjcT0.d.mts → render-plan.d-CiUj0rq5.d.mts} +1 -1
- package/dist/{render-plan.d-W6LmjD6y.d.ts → render-plan.d-DHuJMJRP.d.ts} +1 -1
- package/dist/renderer-client.cjs +7 -7
- package/dist/renderer-client.d.mts +6 -5
- package/dist/renderer-client.d.ts +6 -5
- package/dist/renderer-client.mjs +3 -3
- package/dist/{request.d-CgNVderU.d.mts → request.d-D-F7o7tb.d.mts} +1 -1
- package/dist/{request.d-CTVRZiQv.d.ts → request.d-DRUbOmYD.d.ts} +1 -1
- package/dist/request.d.mts +4 -3
- package/dist/request.d.ts +4 -3
- package/dist/{resolver.d-JnZKKsc5.d.mts → resolver.d-9iKC79CU.d.mts} +1 -1
- package/dist/{resolver.d-BHyZgpa7.d.ts → resolver.d-CY6mEa_F.d.ts} +1 -1
- package/dist/response.d-B_MtBCnF.d.mts +12 -0
- package/dist/response.d-B_MtBCnF.d.ts +12 -0
- package/dist/{route-rendering.d-D0bmZVJA.d.mts → route-rendering.d-6smgwT2t.d.mts} +9 -2
- package/dist/{route-rendering.d-FDSNtCMg.d.ts → route-rendering.d-KwqM_mlK.d.ts} +9 -2
- package/dist/{router.d-DZ3ldniI.d.ts → router.d-B6sesMRD.d.ts} +1 -1
- package/dist/{router.d-GRKm_uAV.d.mts → router.d-BYmDeDlp.d.mts} +1 -1
- package/dist/{routes.d-CrEy0lJS.d.mts → routes.d-D3aJw1H5.d.mts} +1 -1
- package/dist/{routes.d-9GFFNioh.d.ts → routes.d-K-Qg79AA.d.ts} +1 -1
- package/dist/routes.d.mts +3 -2
- package/dist/routes.d.ts +3 -2
- package/dist/{index.d-BNNDpql4.d.ts → routing.d-BxOZ2YWc.d.ts} +1 -2
- package/dist/{index.d-BqcfqJvt.d.mts → routing.d-DwSUVZbF.d.mts} +1 -2
- package/dist/{rsc-pipeline-J4KKBSCH.cjs → rsc-pipeline-P4PCWDO2.cjs} +14 -13
- package/dist/{rsc-pipeline-PJZOVYSY.mjs → rsc-pipeline-R2GOKIMU.mjs} +13 -12
- package/dist/{runtime-QDBSE4H6.mjs → runtime-DP5DYGW5.mjs} +12 -11
- package/dist/{runtime-OLEO5NXF.cjs → runtime-WA2Q4SLG.cjs} +20 -19
- package/dist/{runtime.d-DqXihlxm.d.mts → runtime.d-BFSJf-ww.d.mts} +1 -1
- package/dist/{runtime.d-BtL3PCL3.d.ts → runtime.d-B_uPfMjA.d.ts} +2 -2
- package/dist/{runtime.d-pqFQBU2N.d.ts → runtime.d-CbdMI0Oy.d.ts} +1 -1
- package/dist/{runtime.d-3iJAKptR.d.mts → runtime.d-nUz0HAL4.d.mts} +2 -2
- package/dist/server-plugins.cjs +3 -2
- package/dist/server-plugins.d.mts +6 -12
- package/dist/server-plugins.d.ts +6 -12
- package/dist/server-plugins.mjs +2 -1
- package/dist/server.cjs +64 -56
- package/dist/server.d.mts +23 -14
- package/dist/server.d.ts +23 -14
- package/dist/server.mjs +40 -32
- package/dist/{spa-router.d-Dhvy60p4.d.mts → spa-router.d-D4EDwR20.d.mts} +3 -3
- package/dist/{spa-router.d-DhOhaQ-7.d.ts → spa-router.d-mC1D5cTN.d.ts} +3 -3
- package/dist/testing.cjs +3 -3
- package/dist/testing.d.mts +3 -2
- package/dist/testing.d.ts +3 -2
- package/dist/testing.mjs +3 -3
- package/dist/{types.d-C41ePjvP.d.ts → types.d-wVRlLtBf.d.mts} +1 -1
- package/dist/{types.d-C41ePjvP.d.mts → types.d-wVRlLtBf.d.ts} +1 -1
- package/dist/{utils.d-BVCMRRau.d.ts → utils.d-A2X3a6z_.d.ts} +1 -1
- package/dist/{utils.d-Q8EHCpkF.d.mts → utils.d-DxMzteqE.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +37 -29
- package/dist/vite.d.mts +28 -6
- package/dist/vite.d.ts +28 -6
- package/dist/vite.mjs +36 -28
- package/package.json +3 -3
- package/dist/analyzer-SAJSV6SP.cjs +0 -16
- package/dist/response.d-BolW0Vx_.d.mts +0 -10
- package/dist/response.d-BolW0Vx_.d.ts +0 -10
|
@@ -26,7 +26,7 @@ var _chunkNG2EZ6QScjs = require('./chunk-NG2EZ6QS.cjs');
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
var
|
|
29
|
+
var _chunkZPUAOKHVcjs = require('./chunk-ZPUAOKHV.cjs');
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
var _chunkVM57CK74cjs = require('./chunk-VM57CK74.cjs');
|
|
@@ -41,7 +41,7 @@ var _chunk4BS3HSY7cjs = require('./chunk-4BS3HSY7.cjs');
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
var
|
|
44
|
+
var _chunkUISZLYKYcjs = require('./chunk-UISZLYKY.cjs');
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
|
|
@@ -54,7 +54,7 @@ var _chunk4JRAMCUPcjs = require('./chunk-4JRAMCUP.cjs');
|
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
var
|
|
57
|
+
var _chunkNAXKOTPPcjs = require('./chunk-NAXKOTPP.cjs');
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
|
|
@@ -62,10 +62,10 @@ var _chunkFVYBEMODcjs = require('./chunk-FVYBEMOD.cjs');
|
|
|
62
62
|
var _chunkDZZHTMWMcjs = require('./chunk-DZZHTMWM.cjs');
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
var
|
|
65
|
+
var _chunkJWY66PIDcjs = require('./chunk-JWY66PID.cjs');
|
|
66
66
|
|
|
67
67
|
|
|
68
|
-
var
|
|
68
|
+
var _chunk3BQ7QHUHcjs = require('./chunk-3BQ7QHUH.cjs');
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
var _chunkV3UOEWCBcjs = require('./chunk-V3UOEWCB.cjs');
|
|
@@ -74,7 +74,7 @@ var _chunkV3UOEWCBcjs = require('./chunk-V3UOEWCB.cjs');
|
|
|
74
74
|
|
|
75
75
|
|
|
76
76
|
|
|
77
|
-
var
|
|
77
|
+
var _chunkKEB7AGS6cjs = require('./chunk-KEB7AGS6.cjs');
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
var _chunk3GNHJ3RNcjs = require('./chunk-3GNHJ3RN.cjs');
|
|
@@ -110,20 +110,20 @@ var _chunkOCS3PSYRcjs = require('./chunk-OCS3PSYR.cjs');
|
|
|
110
110
|
|
|
111
111
|
|
|
112
112
|
|
|
113
|
-
var
|
|
113
|
+
var _chunkKWST2O22cjs = require('./chunk-KWST2O22.cjs');
|
|
114
114
|
|
|
115
115
|
|
|
116
116
|
|
|
117
117
|
|
|
118
|
-
var
|
|
118
|
+
var _chunkDMXMIE2Ccjs = require('./chunk-DMXMIE2C.cjs');
|
|
119
119
|
|
|
120
120
|
|
|
121
|
-
var
|
|
121
|
+
var _chunkPMU4U2W2cjs = require('./chunk-PMU4U2W2.cjs');
|
|
122
122
|
|
|
123
123
|
|
|
124
124
|
|
|
125
125
|
|
|
126
|
-
var
|
|
126
|
+
var _chunkCSQPMV3Qcjs = require('./chunk-CSQPMV3Q.cjs');
|
|
127
127
|
|
|
128
128
|
|
|
129
129
|
|
|
@@ -136,7 +136,7 @@ var _chunkQOGIZKSOcjs = require('./chunk-QOGIZKSO.cjs');
|
|
|
136
136
|
|
|
137
137
|
|
|
138
138
|
|
|
139
|
-
var
|
|
139
|
+
var _chunk2MR4MABGcjs = require('./chunk-2MR4MABG.cjs');
|
|
140
140
|
|
|
141
141
|
|
|
142
142
|
var _chunk3HLQTOVUcjs = require('./chunk-3HLQTOVU.cjs');
|
|
@@ -150,15 +150,15 @@ var _chunk47JV57DAcjs = require('./chunk-47JV57DA.cjs');
|
|
|
150
150
|
|
|
151
151
|
|
|
152
152
|
|
|
153
|
-
var
|
|
153
|
+
var _chunkSXMWVP2Lcjs = require('./chunk-SXMWVP2L.cjs');
|
|
154
154
|
|
|
155
155
|
|
|
156
156
|
|
|
157
157
|
|
|
158
|
-
var
|
|
158
|
+
var _chunkTP4RAV7Ycjs = require('./chunk-TP4RAV7Y.cjs');
|
|
159
159
|
|
|
160
160
|
|
|
161
|
-
var
|
|
161
|
+
var _chunkDPYBVVL3cjs = require('./chunk-DPYBVVL3.cjs');
|
|
162
162
|
|
|
163
163
|
|
|
164
164
|
var _chunk4EBC7EMWcjs = require('./chunk-4EBC7EMW.cjs');
|
|
@@ -176,7 +176,7 @@ var _chunk4EBC7EMWcjs = require('./chunk-4EBC7EMW.cjs');
|
|
|
176
176
|
|
|
177
177
|
|
|
178
178
|
|
|
179
|
-
var
|
|
179
|
+
var _chunk2IFT2CSAcjs = require('./chunk-2IFT2CSA.cjs');
|
|
180
180
|
|
|
181
181
|
|
|
182
182
|
|
|
@@ -188,7 +188,7 @@ var _chunkERMUL73Lcjs = require('./chunk-ERMUL73L.cjs');
|
|
|
188
188
|
|
|
189
189
|
|
|
190
190
|
|
|
191
|
-
var
|
|
191
|
+
var _chunkMQ4DYVFScjs = require('./chunk-MQ4DYVFS.cjs');
|
|
192
192
|
|
|
193
193
|
|
|
194
194
|
|
|
@@ -223,14 +223,14 @@ var _chunk4P5634G6cjs = require('./chunk-4P5634G6.cjs');
|
|
|
223
223
|
var _chunk3EIPOTZVcjs = require('./chunk-3EIPOTZV.cjs');
|
|
224
224
|
|
|
225
225
|
|
|
226
|
-
var
|
|
226
|
+
var _chunkL6E4SHUBcjs = require('./chunk-L6E4SHUB.cjs');
|
|
227
227
|
|
|
228
228
|
|
|
229
229
|
|
|
230
230
|
var _chunk2HW5LWAHcjs = require('./chunk-2HW5LWAH.cjs');
|
|
231
231
|
|
|
232
232
|
|
|
233
|
-
var
|
|
233
|
+
var _chunkC2JOS77Zcjs = require('./chunk-C2JOS77Z.cjs');
|
|
234
234
|
|
|
235
235
|
|
|
236
236
|
var _chunkASYOWPSRcjs = require('./chunk-ASYOWPSR.cjs');
|
|
@@ -241,7 +241,7 @@ var _chunkFSODPZRTcjs = require('./chunk-FSODPZRT.cjs');
|
|
|
241
241
|
|
|
242
242
|
|
|
243
243
|
|
|
244
|
-
var
|
|
244
|
+
var _chunkJX5VOLAVcjs = require('./chunk-JX5VOLAV.cjs');
|
|
245
245
|
|
|
246
246
|
|
|
247
247
|
var _chunkZOYKJBP5cjs = require('./chunk-ZOYKJBP5.cjs');
|
|
@@ -255,7 +255,7 @@ var _chunkJMYXO572cjs = require('./chunk-JMYXO572.cjs');
|
|
|
255
255
|
var _chunkMHLNWRCJcjs = require('./chunk-MHLNWRCJ.cjs');
|
|
256
256
|
|
|
257
257
|
|
|
258
|
-
var
|
|
258
|
+
var _chunkK66JILV3cjs = require('./chunk-K66JILV3.cjs');
|
|
259
259
|
|
|
260
260
|
|
|
261
261
|
var _chunkBBPDJGCUcjs = require('./chunk-BBPDJGCU.cjs');
|
|
@@ -270,6 +270,7 @@ var _chunkKORZ6PREcjs = require('./chunk-KORZ6PRE.cjs');
|
|
|
270
270
|
|
|
271
271
|
|
|
272
272
|
|
|
273
|
+
|
|
273
274
|
var _chunkIUKBPBM7cjs = require('./chunk-IUKBPBM7.cjs');
|
|
274
275
|
|
|
275
276
|
|
|
@@ -282,14 +283,14 @@ var _chunkQMNWKQL4cjs = require('./chunk-QMNWKQL4.cjs');
|
|
|
282
283
|
var _chunk2OF5RPVUcjs = require('./chunk-2OF5RPVU.cjs');
|
|
283
284
|
|
|
284
285
|
|
|
285
|
-
var
|
|
286
|
+
var _chunkMEJCP2LXcjs = require('./chunk-MEJCP2LX.cjs');
|
|
286
287
|
|
|
287
288
|
|
|
288
|
-
var
|
|
289
|
+
var _chunkDVJM55D2cjs = require('./chunk-DVJM55D2.cjs');
|
|
289
290
|
|
|
290
291
|
|
|
291
292
|
|
|
292
|
-
var
|
|
293
|
+
var _chunkNLBHLPEOcjs = require('./chunk-NLBHLPEO.cjs');
|
|
293
294
|
|
|
294
295
|
|
|
295
296
|
var _chunkHDPT6OYEcjs = require('./chunk-HDPT6OYE.cjs');
|
|
@@ -419,7 +420,7 @@ function getDocsTitle(docs) {
|
|
|
419
420
|
return typeof docs.config.nav === "object" && docs.config.nav && "title" in docs.config.nav ? String(docs.config.nav.title || "Documentation") : "Documentation";
|
|
420
421
|
}
|
|
421
422
|
function loadPages(contentDir, docs) {
|
|
422
|
-
return
|
|
423
|
+
return _chunkNAXKOTPPcjs.discoverFarmDocsPages.call(void 0, contentDir, docs).map((page) => _chunkNAXKOTPPcjs.loadFarmDocsPage.call(void 0, contentDir, docs, page.slug)).filter((page) => Boolean(page)).sort((a, b) => a.href.localeCompare(b.href));
|
|
423
424
|
}
|
|
424
425
|
function findSocialImagePath(html, basePath) {
|
|
425
426
|
const match = /<meta\s+property=["']og:image["']\s+content=["']([^"']+)["']/i.exec(html) || /<meta\s+content=["']([^"']+)["']\s+property=["']og:image["']/i.exec(html);
|
|
@@ -437,7 +438,7 @@ async function addHandlerRoute(routes, pathname, handler, absolutePaths) {
|
|
|
437
438
|
return response;
|
|
438
439
|
}
|
|
439
440
|
async function compileFarmDocsManifest(docs, options) {
|
|
440
|
-
const contentDir =
|
|
441
|
+
const contentDir = _chunkNAXKOTPPcjs.resolveFarmDocsContentDir.call(void 0, docs, options);
|
|
441
442
|
const pages = loadPages(contentDir, docs);
|
|
442
443
|
const basePath = _chunkD22BUQKWcjs.normalizeFarmBasePath.call(void 0, options.basePath);
|
|
443
444
|
const absolutePaths = [
|
|
@@ -445,7 +446,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
445
446
|
_path2.default.resolve(contentDir),
|
|
446
447
|
docs.configPath || ""
|
|
447
448
|
];
|
|
448
|
-
const handler =
|
|
449
|
+
const handler = _chunkNAXKOTPPcjs.createFarmDocsHandler.call(void 0, docs, {
|
|
449
450
|
root: options.root,
|
|
450
451
|
srcDir: options.srcDir,
|
|
451
452
|
clientEntry: options.clientEntry,
|
|
@@ -455,7 +456,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
455
456
|
isPathGuarded: options.isPathGuarded,
|
|
456
457
|
basePath
|
|
457
458
|
});
|
|
458
|
-
const apiHandler =
|
|
459
|
+
const apiHandler = _chunkUISZLYKYcjs.createFarmDocsAPIHandler.call(void 0, {
|
|
459
460
|
rootDir: options.root,
|
|
460
461
|
srcDir: options.srcDir,
|
|
461
462
|
docs,
|
|
@@ -467,7 +468,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
467
468
|
const apiMarkdown = {};
|
|
468
469
|
for (const page of pages) {
|
|
469
470
|
const htmlResponse = await addHandlerRoute(routes, page.href, handler, absolutePaths);
|
|
470
|
-
const markdownPath =
|
|
471
|
+
const markdownPath = _chunkNAXKOTPPcjs.getFarmDocsMarkdownPath.call(void 0, page.href);
|
|
471
472
|
await addHandlerRoute(routes, markdownPath, handler, absolutePaths);
|
|
472
473
|
if (htmlResponse) {
|
|
473
474
|
const socialImagePath = findSocialImagePath(await htmlResponse.text(), basePath);
|
|
@@ -552,7 +553,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
552
553
|
post: await compileResponse(postResponse, absolutePaths),
|
|
553
554
|
search: {
|
|
554
555
|
pages: publicPages.map((page) => ({
|
|
555
|
-
...
|
|
556
|
+
..._chunkNAXKOTPPcjs.toFarmDocsMarkdownPage.call(void 0, page, basePath),
|
|
556
557
|
sourcePath: `farm-docs:${page.slug || "index"}`
|
|
557
558
|
})),
|
|
558
559
|
search: _nullishCoalesce(searchConfig, () => ( true)),
|
|
@@ -615,6 +616,7 @@ function collectFarmClientModulePreloads(bundle, options) {
|
|
|
615
616
|
function createFarmClientModulePreloadPlugin(options) {
|
|
616
617
|
return {
|
|
617
618
|
name: "farm-client-module-preloads",
|
|
619
|
+
enforce: "post",
|
|
618
620
|
async generateBundle(_output, bundle) {
|
|
619
621
|
await _promises2.default.mkdir(options.buildDir, { recursive: true });
|
|
620
622
|
await _promises2.default.writeFile(
|
|
@@ -689,6 +691,8 @@ function createFarmDocsModulePreloadPlugin(options) {
|
|
|
689
691
|
let runtimeModuleIds = [];
|
|
690
692
|
return {
|
|
691
693
|
name: "farm-docs-module-preloads",
|
|
694
|
+
// After Vite's CSS plugin deletes stylesheet-only chunks (see client-module-preloads.ts).
|
|
695
|
+
enforce: "post",
|
|
692
696
|
async buildStart() {
|
|
693
697
|
const resolved = await Promise.all(
|
|
694
698
|
options.modules.map((specifier) => this.resolve(specifier, options.importer))
|
|
@@ -730,7 +734,7 @@ async function createFarmRouteRuntimeManifest(options) {
|
|
|
730
734
|
const routes = [];
|
|
731
735
|
for (const [pattern, entry] of options.routeManager.getRoutes()) {
|
|
732
736
|
const routeModule = await options.routeManager.loadRouteModule(entry.modulePath);
|
|
733
|
-
const rendering = await
|
|
737
|
+
const rendering = await _chunkCSQPMV3Qcjs.resolveRouteRenderingConfigFromFile.call(void 0, routeModule, entry.modulePath);
|
|
734
738
|
const runtimeConfig = await options.routeManager.resolveRouteRuntimeConfig(pattern);
|
|
735
739
|
routes.push({
|
|
736
740
|
kind: "page",
|
|
@@ -803,7 +807,7 @@ async function writeFarmRouteRuntimeManifest(directory, manifest) {
|
|
|
803
807
|
return manifestPath;
|
|
804
808
|
}
|
|
805
809
|
function validateFarmRouteRuntimeDeployment(manifest, preset) {
|
|
806
|
-
const runtime =
|
|
810
|
+
const runtime = _chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset);
|
|
807
811
|
const warnings = /* @__PURE__ */ new Set();
|
|
808
812
|
for (const route of manifest.routes) {
|
|
809
813
|
if (route.rendering === "static") continue;
|
|
@@ -953,12 +957,65 @@ function escapeRegExp(value) {
|
|
|
953
957
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
954
958
|
}
|
|
955
959
|
|
|
956
|
-
// src/nitro/
|
|
960
|
+
// src/nitro/immutable-assets.ts
|
|
961
|
+
|
|
957
962
|
var FARM_IMMUTABLE_ASSET_CACHE_CONTROL = "public, max-age=31536000, immutable";
|
|
963
|
+
var FARM_IMMUTABLE_ASSET_MAX_AGE = 31536e3;
|
|
964
|
+
var FARM_IMMUTABLE_ASSET_PATH_SOURCE = "^/(?:(?:assets|chunks)/(?:.+/)*[^/]+|farm-(?:mobile-)?client(?:-boot)?)-h(?:[a-fA-F0-9]{8}|[a-fA-F0-9]{12}|[a-fA-F0-9]{16})\\.(?!(?:[hH][tT][mM][lL]?)$)[^/]+$";
|
|
965
|
+
var FARM_IMMUTABLE_ASSET_PATH = new RegExp(FARM_IMMUTABLE_ASSET_PATH_SOURCE);
|
|
966
|
+
function isFarmImmutableAssetPath(pathname) {
|
|
967
|
+
return FARM_IMMUTABLE_ASSET_PATH.test(pathname);
|
|
968
|
+
}
|
|
969
|
+
var FARM_HASHED_ASSET_DIRS = ["assets", "chunks"];
|
|
970
|
+
var LITERAL_ROUTE_PATH = /^\/[\w.~@/-]+$/;
|
|
971
|
+
function planFarmImmutableAssets(options) {
|
|
972
|
+
const cacheRulePatterns = Object.entries(_nullishCoalesce(options.routeRules, () => ( {}))).filter(
|
|
973
|
+
([, rule]) => Object.keys(_nullishCoalesce(_optionalChain([rule, 'optionalAccess', _16 => _16.headers]), () => ( {}))).some((name) => name.toLowerCase() === "cache-control")
|
|
974
|
+
).map(([pattern]) => pattern);
|
|
975
|
+
const isImmutable = (file) => isFarmImmutableAssetPath(file) && !cacheRulePatterns.some((pattern) => _chunkIUKBPBM7cjs.farmRouteRuleMatches.call(void 0, pattern, file));
|
|
976
|
+
const routeDirs = new Set(
|
|
977
|
+
(_nullishCoalesce(options.routePaths, () => ( []))).map((routePath) => routePath.split("/").filter(Boolean)[0])
|
|
978
|
+
);
|
|
979
|
+
const plan = { publicAssets: [], routeRules: {} };
|
|
980
|
+
const addRule = (file) => {
|
|
981
|
+
if (!LITERAL_ROUTE_PATH.test(file)) return;
|
|
982
|
+
plan.routeRules[file] = { headers: { "cache-control": FARM_IMMUTABLE_ASSET_CACHE_CONTROL } };
|
|
983
|
+
};
|
|
984
|
+
const dirFiles = /* @__PURE__ */ new Map();
|
|
985
|
+
for (const file of options.files) {
|
|
986
|
+
const dir = file.split("/")[1];
|
|
987
|
+
if (file.split("/").length > 2 && FARM_HASHED_ASSET_DIRS.includes(dir)) {
|
|
988
|
+
dirFiles.set(dir, [..._nullishCoalesce(dirFiles.get(dir), () => ( [])), file]);
|
|
989
|
+
} else if (isImmutable(file)) {
|
|
990
|
+
addRule(file);
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
for (const [dir, files] of dirFiles) {
|
|
994
|
+
if (!routeDirs.has(dir) && files.every(isImmutable)) {
|
|
995
|
+
plan.publicAssets.push({
|
|
996
|
+
dir: _path2.default.join(options.clientOutputDir, dir),
|
|
997
|
+
baseURL: `/${dir}`,
|
|
998
|
+
maxAge: FARM_IMMUTABLE_ASSET_MAX_AGE
|
|
999
|
+
});
|
|
1000
|
+
} else {
|
|
1001
|
+
for (const file of files) if (isImmutable(file)) addRule(file);
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
return plan;
|
|
1005
|
+
}
|
|
1006
|
+
async function listFarmClientOutputFiles(dir) {
|
|
1007
|
+
const fs4 = await import("fs/promises");
|
|
1008
|
+
const entries = await fs4.readdir(dir, { recursive: true, withFileTypes: true }).catch(() => []);
|
|
1009
|
+
return entries.filter((entry) => entry.isFile()).map((entry) => {
|
|
1010
|
+
const relative = _path2.default.relative(dir, _path2.default.join(entry.parentPath, entry.name));
|
|
1011
|
+
return `/${relative.split(_path2.default.sep).join("/")}`;
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
// src/nitro/vercel-assets.ts
|
|
958
1016
|
function createFarmVercelImmutableAssetRoute() {
|
|
959
|
-
const fingerprint = "-h(?:[a-fA-F0-9]{8}|[a-fA-F0-9]{12}|[a-fA-F0-9]{16})";
|
|
960
1017
|
return {
|
|
961
|
-
src:
|
|
1018
|
+
src: FARM_IMMUTABLE_ASSET_PATH_SOURCE,
|
|
962
1019
|
headers: {
|
|
963
1020
|
"Cache-Control": FARM_IMMUTABLE_ASSET_CACHE_CONTROL
|
|
964
1021
|
},
|
|
@@ -1015,7 +1072,7 @@ function resolveBundleFileName(chunkFileName, relativeUrl) {
|
|
|
1015
1072
|
function replaceServerFileReferences(bundle, chunkFileName, code, replace) {
|
|
1016
1073
|
return code.replace(SERVER_FILE_URL_RE, (reference, _quote, relativeUrl) => {
|
|
1017
1074
|
const target = resolveBundleFileName(chunkFileName, relativeUrl);
|
|
1018
|
-
return target && _optionalChain([bundle, 'access',
|
|
1075
|
+
return target && _optionalChain([bundle, 'access', _17 => _17[target], 'optionalAccess', _18 => _18.type]) === "asset" ? replace(target) : reference;
|
|
1019
1076
|
});
|
|
1020
1077
|
}
|
|
1021
1078
|
function collectServerReadSSRAssets(bundle) {
|
|
@@ -1060,7 +1117,7 @@ function collectServerOnlySSRAssets(bundle) {
|
|
|
1060
1117
|
return serverOnly;
|
|
1061
1118
|
}
|
|
1062
1119
|
function canReadServerFiles(preset) {
|
|
1063
|
-
return
|
|
1120
|
+
return _chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) !== "edge" && !preset.startsWith("cloudflare");
|
|
1064
1121
|
}
|
|
1065
1122
|
function assertServerReadSSRAssetsSupported(bundle, preset, root) {
|
|
1066
1123
|
if (canReadServerFiles(preset)) return;
|
|
@@ -1068,7 +1125,7 @@ function assertServerReadSSRAssetsSupported(bundle, preset, root) {
|
|
|
1068
1125
|
if (assets.length === 0) return;
|
|
1069
1126
|
const sources = assets.map((fileName) => {
|
|
1070
1127
|
const output = bundle[fileName];
|
|
1071
|
-
const original = _optionalChain([output, 'optionalAccess',
|
|
1128
|
+
const original = _optionalChain([output, 'optionalAccess', _19 => _19.type]) === "asset" ? _optionalChain([output, 'access', _20 => _20.originalFileNames, 'optionalAccess', _21 => _21[0]]) : void 0;
|
|
1072
1129
|
if (!original) return fileName;
|
|
1073
1130
|
return _path2.default.relative(root, _path2.default.resolve(root, original)).split(_path2.default.sep).join("/");
|
|
1074
1131
|
});
|
|
@@ -1087,7 +1144,7 @@ function createServerReadSSRAssetsPlugin(bundle, ssrOutputDir) {
|
|
|
1087
1144
|
transform(code, id) {
|
|
1088
1145
|
if (!code.includes("import.meta.url")) return null;
|
|
1089
1146
|
const chunkFileName = _path2.default.relative(ssrOutputDir, id.split("?", 1)[0]).split(_path2.default.sep).join("/");
|
|
1090
|
-
if (_optionalChain([bundle, 'access',
|
|
1147
|
+
if (_optionalChain([bundle, 'access', _22 => _22[chunkFileName], 'optionalAccess', _23 => _23.type]) !== "chunk") return null;
|
|
1091
1148
|
let changed = false;
|
|
1092
1149
|
const transformed = replaceServerFileReferences(
|
|
1093
1150
|
bundle,
|
|
@@ -1140,10 +1197,19 @@ const CREDENTIAL_VARY = /(?:^|,)\\s*(?:\\*|cookie|authorization)\\s*(?:,|$)/i;
|
|
|
1140
1197
|
// What Nitro's entry sets when the response has no Cache-Control of its own.
|
|
1141
1198
|
const NITRO_DEFAULT_CACHE_CONTROL = "public, max-age=0, must-revalidate";
|
|
1142
1199
|
|
|
1200
|
+
// The deployment cookie names a release, not a visitor (see @farm.js/core/deployment).
|
|
1201
|
+
function hasVisitorCookies(cookieHeader) {
|
|
1202
|
+
if (!cookieHeader) return false;
|
|
1203
|
+
return cookieHeader.split(";").some((part) => {
|
|
1204
|
+
const name = part.split("=")[0].trim();
|
|
1205
|
+
return name !== "" && name !== "__farm_deployment";
|
|
1206
|
+
});
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1143
1209
|
function isSharedCacheable(request, response) {
|
|
1144
1210
|
return (
|
|
1145
1211
|
response.status === 200 &&
|
|
1146
|
-
!request.headers.
|
|
1212
|
+
!hasVisitorCookies(request.headers.get("cookie")) &&
|
|
1147
1213
|
!request.headers.has("authorization") &&
|
|
1148
1214
|
!response.headers.has("set-cookie") &&
|
|
1149
1215
|
!PRIVATE_CACHE_DIRECTIVE.test(response.headers.get("cache-control") || "") &&
|
|
@@ -1174,7 +1240,7 @@ export default async function farmNetlifyHandler(request, context) {
|
|
|
1174
1240
|
var PLATFORM_CONFIG_KEYS = /* @__PURE__ */ new Set(["desktop", "mobile"]);
|
|
1175
1241
|
var CONFIG_FACTORIES = /* @__PURE__ */ new Set(["defineConfig", "defineFarmConfig"]);
|
|
1176
1242
|
function isConfigObject(node) {
|
|
1177
|
-
return _optionalChain([node, 'optionalAccess',
|
|
1243
|
+
return _optionalChain([node, 'optionalAccess', _24 => _24.type]) === "ObjectExpression";
|
|
1178
1244
|
}
|
|
1179
1245
|
function propertyName(property) {
|
|
1180
1246
|
if (property.type !== "Property" || property.computed) return void 0;
|
|
@@ -1195,7 +1261,7 @@ function collectConfigObjects(node, found) {
|
|
|
1195
1261
|
}
|
|
1196
1262
|
if (current.type === "CallExpression") {
|
|
1197
1263
|
const callee = current.callee;
|
|
1198
|
-
const name = callee.type === "Identifier" ? callee.name : _optionalChain([callee, 'access',
|
|
1264
|
+
const name = callee.type === "Identifier" ? callee.name : _optionalChain([callee, 'access', _25 => _25.property, 'optionalAccess', _26 => _26.name]);
|
|
1199
1265
|
const argument = current.arguments[0];
|
|
1200
1266
|
if (name && CONFIG_FACTORIES.has(name) && isConfigObject(argument)) found.push(argument);
|
|
1201
1267
|
}
|
|
@@ -1228,7 +1294,7 @@ function stripPlatformConfigSource(code, parse) {
|
|
|
1228
1294
|
const trailingComma = /^\s*,/.exec(code.slice(properties[last].end));
|
|
1229
1295
|
removals.push([
|
|
1230
1296
|
properties[first].start,
|
|
1231
|
-
properties[last].end + (_nullishCoalesce(_optionalChain([trailingComma, 'optionalAccess',
|
|
1297
|
+
properties[last].end + (_nullishCoalesce(_optionalChain([trailingComma, 'optionalAccess', _27 => _27[0], 'access', _28 => _28.length]), () => ( 0)))
|
|
1232
1298
|
]);
|
|
1233
1299
|
}
|
|
1234
1300
|
first = last;
|
|
@@ -1255,7 +1321,7 @@ function farmStripPlatformConfigPlugin(configFiles) {
|
|
|
1255
1321
|
// removed block used (`readFileSync` for a version, say).
|
|
1256
1322
|
enforce: "pre",
|
|
1257
1323
|
transform: {
|
|
1258
|
-
filter: { id:
|
|
1324
|
+
filter: { id: _chunkKWST2O22cjs.fileNamePattern.call(void 0, configFiles) },
|
|
1259
1325
|
async handler(code, id) {
|
|
1260
1326
|
const file = id.split("?", 1)[0];
|
|
1261
1327
|
if (!files.has(_path2.default.resolve(file)) && !files.has(realPath(file))) return null;
|
|
@@ -1307,7 +1373,7 @@ function literalMatcher(node) {
|
|
|
1307
1373
|
if (node.type === "Literal" && node.regex)
|
|
1308
1374
|
return new RegExp(node.regex.pattern, node.regex.flags);
|
|
1309
1375
|
if (node.type === "TemplateLiteral" && node.expressions.length === 0) {
|
|
1310
|
-
return _nullishCoalesce(_optionalChain([node, 'access',
|
|
1376
|
+
return _nullishCoalesce(_optionalChain([node, 'access', _29 => _29.quasis, 'access', _30 => _30[0], 'optionalAccess', _31 => _31.value, 'optionalAccess', _32 => _32.cooked]), () => ( void 0));
|
|
1311
1377
|
}
|
|
1312
1378
|
return void 0;
|
|
1313
1379
|
}
|
|
@@ -1331,7 +1397,7 @@ function readStaticMiddlewareConfig(program) {
|
|
|
1331
1397
|
let found = null;
|
|
1332
1398
|
for (const statement of program.body) {
|
|
1333
1399
|
if (statement.type === "ExportNamedDeclaration" && !statement.declaration) {
|
|
1334
|
-
if (statement.specifiers.some((specifier) => _optionalChain([specifier, 'access',
|
|
1400
|
+
if (statement.specifiers.some((specifier) => _optionalChain([specifier, 'access', _33 => _33.exported, 'optionalAccess', _34 => _34.name]) === "config")) {
|
|
1335
1401
|
return "unknown";
|
|
1336
1402
|
}
|
|
1337
1403
|
continue;
|
|
@@ -1339,14 +1405,14 @@ function readStaticMiddlewareConfig(program) {
|
|
|
1339
1405
|
const declaration = statement.type === "ExportNamedDeclaration" ? statement.declaration : null;
|
|
1340
1406
|
if (!declaration || declaration.type !== "VariableDeclaration") continue;
|
|
1341
1407
|
for (const declarator of declaration.declarations) {
|
|
1342
|
-
if (_optionalChain([declarator, 'access',
|
|
1408
|
+
if (_optionalChain([declarator, 'access', _35 => _35.id, 'optionalAccess', _36 => _36.type]) !== "Identifier" || declarator.id.name !== "config") continue;
|
|
1343
1409
|
if (declaration.kind !== "const" || !declarator.init) return "unknown";
|
|
1344
1410
|
const init = unwrap(declarator.init);
|
|
1345
1411
|
if (init.type !== "ObjectExpression") return "unknown";
|
|
1346
1412
|
const config = {};
|
|
1347
1413
|
for (const property of init.properties) {
|
|
1348
1414
|
if (property.type !== "Property" || property.computed) return "unknown";
|
|
1349
|
-
const key = _nullishCoalesce(_optionalChain([property, 'access',
|
|
1415
|
+
const key = _nullishCoalesce(_optionalChain([property, 'access', _37 => _37.key, 'optionalAccess', _38 => _38.name]), () => ( _optionalChain([property, 'access', _39 => _39.key, 'optionalAccess', _40 => _40.value])));
|
|
1350
1416
|
if (key === "runtime") {
|
|
1351
1417
|
const runtime = literalMatcher(unwrap(property.value));
|
|
1352
1418
|
if (runtime === "edge" || runtime === "nodejs") config.runtime = runtime;
|
|
@@ -1367,7 +1433,7 @@ async function readMiddlewareFileConfig(filePath) {
|
|
|
1367
1433
|
try {
|
|
1368
1434
|
const [{ readFile }, vite] = await Promise.all([import("fs/promises"), import("vite")]);
|
|
1369
1435
|
const parsed = vite.parseSync(filePath, await readFile(filePath, "utf8"));
|
|
1370
|
-
if (_optionalChain([parsed, 'access',
|
|
1436
|
+
if (_optionalChain([parsed, 'access', _41 => _41.errors, 'optionalAccess', _42 => _42.length])) return "unknown";
|
|
1371
1437
|
return readStaticMiddlewareConfig(parsed.program);
|
|
1372
1438
|
} catch (e9) {
|
|
1373
1439
|
return "unknown";
|
|
@@ -1386,7 +1452,7 @@ function farmTargetRunsEdgeMiddleware(preset) {
|
|
|
1386
1452
|
return preset === "vercel";
|
|
1387
1453
|
}
|
|
1388
1454
|
function isFarmEdgeMiddlewareRoute(route) {
|
|
1389
|
-
return typeof route.config === "object" && _optionalChain([route, 'access',
|
|
1455
|
+
return typeof route.config === "object" && _optionalChain([route, 'access', _43 => _43.config, 'optionalAccess', _44 => _44.runtime]) === "edge";
|
|
1390
1456
|
}
|
|
1391
1457
|
function escapeRegExp3(value) {
|
|
1392
1458
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -1424,7 +1490,7 @@ export default createFarmVercelEdgeMiddleware({
|
|
|
1424
1490
|
${modules.join("\n")}
|
|
1425
1491
|
],
|
|
1426
1492
|
i18n: ${JSON.stringify(config.i18n)},
|
|
1427
|
-
server: ${JSON.stringify({ trustProxy: _optionalChain([config, 'access',
|
|
1493
|
+
server: ${JSON.stringify({ trustProxy: _optionalChain([config, 'access', _45 => _45.server, 'optionalAccess', _46 => _46.trustProxy]) === true })},
|
|
1428
1494
|
apiBasePath: ${JSON.stringify(_chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, config.api))},
|
|
1429
1495
|
notFoundPath: ${JSON.stringify(_chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, FARM_VERCEL_EDGE_NOT_FOUND_PATH, config.basePath))},
|
|
1430
1496
|
pages: ${JSON.stringify(toFarmVercelEdgeGuardedUrls(guardedPages, config.basePath))},
|
|
@@ -1483,7 +1549,7 @@ async function writeFarmVercelEdgeMiddlewareFunction(options) {
|
|
|
1483
1549
|
logLevel: "silent",
|
|
1484
1550
|
plugins: [edgeNodeModulesPlugin(coreDir, unsupported)],
|
|
1485
1551
|
resolve: {
|
|
1486
|
-
alias:
|
|
1552
|
+
alias: _chunkKWST2O22cjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
1487
1553
|
conditionNames: ["edge-light", "worker", "browser", "import", "module", "default"]
|
|
1488
1554
|
},
|
|
1489
1555
|
transform: {
|
|
@@ -1702,7 +1768,7 @@ function createPrerenderRuntimeResolverPlugin(root, resolveNitroEntry = resolveN
|
|
|
1702
1768
|
return {
|
|
1703
1769
|
name: "farm-prerender-runtime-resolver",
|
|
1704
1770
|
async resolveId(id, _importer, options) {
|
|
1705
|
-
if (_optionalChain([options, 'access',
|
|
1771
|
+
if (_optionalChain([options, 'access', _47 => _47.custom, 'optionalAccess', _48 => _48.farmPrerenderRuntimeResolve])) return null;
|
|
1706
1772
|
if (id.startsWith("\0") || id.startsWith(".") || id.startsWith("#") || id.startsWith("virtual:") || _path2.default.isAbsolute(id) || NODE_BUILTIN_MODULES.has(id)) {
|
|
1707
1773
|
return null;
|
|
1708
1774
|
}
|
|
@@ -1830,7 +1896,7 @@ function hasReactDomEdgeServerBuild(root) {
|
|
|
1830
1896
|
}
|
|
1831
1897
|
}
|
|
1832
1898
|
function shouldAliasReactServerToWebBuild(renderer, preset) {
|
|
1833
|
-
return _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) &&
|
|
1899
|
+
return _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) && _chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge";
|
|
1834
1900
|
}
|
|
1835
1901
|
function isCloudflareImagePreset(preset) {
|
|
1836
1902
|
return preset === "cloudflare" || preset === "cloudflare-pages" || preset === "cloudflare-module";
|
|
@@ -1872,7 +1938,7 @@ function createOmittedMetadataImageRuntimePlugin(externalizeOtherImports) {
|
|
|
1872
1938
|
return {
|
|
1873
1939
|
name: "farm-omitted-metadata-image-runtime",
|
|
1874
1940
|
resolveId: {
|
|
1875
|
-
filter: { id:
|
|
1941
|
+
filter: { id: _chunkKWST2O22cjs.exactIdPattern.call(void 0, ["@vercel/og"]) },
|
|
1876
1942
|
handler(source, importer) {
|
|
1877
1943
|
if (source !== "@vercel/og") return null;
|
|
1878
1944
|
const fromCoreRuntime = importer !== void 0 && isFarmCoreModule(importer) && !/^og\.[cm]?[jt]sx?$/.test(_path2.default.basename(importer.split("?", 1)[0]));
|
|
@@ -1881,7 +1947,7 @@ function createOmittedMetadataImageRuntimePlugin(externalizeOtherImports) {
|
|
|
1881
1947
|
}
|
|
1882
1948
|
},
|
|
1883
1949
|
load: {
|
|
1884
|
-
filter: { id:
|
|
1950
|
+
filter: { id: _chunkKWST2O22cjs.exactIdPattern.call(void 0, [FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID]) },
|
|
1885
1951
|
handler(id) {
|
|
1886
1952
|
if (id !== FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID) return null;
|
|
1887
1953
|
return `
|
|
@@ -1909,8 +1975,8 @@ function readVercelOgManifest(file) {
|
|
|
1909
1975
|
}
|
|
1910
1976
|
function resolveVercelOgConditionEntry(resolvedId, condition) {
|
|
1911
1977
|
const vercelOg = readVercelOgManifest(resolvedId);
|
|
1912
|
-
const entry = _optionalChain([vercelOg, 'optionalAccess',
|
|
1913
|
-
const file = typeof entry === "string" ? entry : _optionalChain([entry, 'optionalAccess',
|
|
1978
|
+
const entry = _optionalChain([vercelOg, 'optionalAccess', _49 => _49.manifest, 'access', _50 => _50.exports, 'optionalAccess', _51 => _51["."], 'optionalAccess', _52 => _52[condition]]);
|
|
1979
|
+
const file = typeof entry === "string" ? entry : _optionalChain([entry, 'optionalAccess', _53 => _53.default]);
|
|
1914
1980
|
return vercelOg && typeof file === "string" ? _path2.default.join(vercelOg.dir, file) : null;
|
|
1915
1981
|
}
|
|
1916
1982
|
function createEdgeMetadataImageRuntimePlugin({
|
|
@@ -1926,7 +1992,7 @@ function createEdgeMetadataImageRuntimePlugin({
|
|
|
1926
1992
|
const edgeEntry = resolveVercelOgConditionEntry(resolved.id, condition);
|
|
1927
1993
|
return edgeEntry ? { ...resolved, id: edgeEntry } : resolved;
|
|
1928
1994
|
}
|
|
1929
|
-
if (wasm !== "module" || !source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess',
|
|
1995
|
+
if (wasm !== "module" || !source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess', _54 => _54.replace, 'call', _55 => _55(/\\/g, "/"), 'access', _56 => _56.includes, 'call', _57 => _57("/@vercel/og/")])) {
|
|
1930
1996
|
return null;
|
|
1931
1997
|
}
|
|
1932
1998
|
const resolvedPath = _path2.default.resolve(_path2.default.dirname(importer.split("?", 1)[0]), source);
|
|
@@ -1948,7 +2014,7 @@ function createVercelOgFontInlinePlugin(runtime = "Cloudflare Workers") {
|
|
|
1948
2014
|
return `Promise.resolve({ arrayBuffer: () => Uint8Array.from(atob(${JSON.stringify(encoded)}), (character) => character.charCodeAt(0)).buffer })`;
|
|
1949
2015
|
});
|
|
1950
2016
|
if (inlined !== code) return { code: inlined, map: null };
|
|
1951
|
-
const version = _nullishCoalesce(_optionalChain([readVercelOgManifest, 'call',
|
|
2017
|
+
const version = _nullishCoalesce(_optionalChain([readVercelOgManifest, 'call', _58 => _58(file), 'optionalAccess', _59 => _59.manifest, 'access', _60 => _60.version]), () => ( "(unknown version)"));
|
|
1952
2018
|
this.error(
|
|
1953
2019
|
`@vercel/og ${version} cannot be bundled for ${runtime}: ${file} does not load its default font with fetch(new URL("./<font>.ttf", import.meta.url)), the pattern Farm inlines because an edge function cannot fetch it. Install a @vercel/og version whose edge build does, such as 1.0.1.`
|
|
1954
2020
|
);
|
|
@@ -1959,7 +2025,7 @@ function createMetadataImageWasmPlugin() {
|
|
|
1959
2025
|
return {
|
|
1960
2026
|
name: "farm-metadata-image-wasm",
|
|
1961
2027
|
resolveId(source, importer) {
|
|
1962
|
-
if (!source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess',
|
|
2028
|
+
if (!source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess', _61 => _61.replace, 'call', _62 => _62(/\\/g, "/"), 'access', _63 => _63.includes, 'call', _64 => _64("/@vercel/og/")])) {
|
|
1963
2029
|
return null;
|
|
1964
2030
|
}
|
|
1965
2031
|
const requestPath = source.slice(0, -"?module".length);
|
|
@@ -2035,9 +2101,9 @@ function hasFarmRuntimeConfigModule(config, configModulePath) {
|
|
|
2035
2101
|
return Boolean(configModulePath || (config.layers || []).some((layer) => layer.configFile));
|
|
2036
2102
|
}
|
|
2037
2103
|
function nameCodeSplittingGroups(bundlerConfig) {
|
|
2038
|
-
const outputs = _optionalChain([bundlerConfig, 'optionalAccess',
|
|
2104
|
+
const outputs = _optionalChain([bundlerConfig, 'optionalAccess', _65 => _65.output]);
|
|
2039
2105
|
for (const output of Array.isArray(outputs) ? outputs : [outputs]) {
|
|
2040
|
-
const groups = _optionalChain([output, 'optionalAccess',
|
|
2106
|
+
const groups = _optionalChain([output, 'optionalAccess', _66 => _66.codeSplitting, 'optionalAccess', _67 => _67.groups]);
|
|
2041
2107
|
if (!Array.isArray(groups)) continue;
|
|
2042
2108
|
groups.forEach((group, index) => {
|
|
2043
2109
|
if (group && typeof group.name === "function" && !group.debugName) {
|
|
@@ -2093,9 +2159,9 @@ function restoreLiteralModuleSpecifiers(code, fileName, { parseSync, Visitor })
|
|
|
2093
2159
|
if (needsAst) {
|
|
2094
2160
|
replacements.length = 0;
|
|
2095
2161
|
const restore = (node) => {
|
|
2096
|
-
if (_optionalChain([node, 'optionalAccess',
|
|
2162
|
+
if (_optionalChain([node, 'optionalAccess', _68 => _68.type]) !== "TemplateLiteral") return;
|
|
2097
2163
|
const template = node;
|
|
2098
|
-
const value = _optionalChain([template, 'access',
|
|
2164
|
+
const value = _optionalChain([template, 'access', _69 => _69.quasis, 'access', _70 => _70[0], 'optionalAccess', _71 => _71.value, 'access', _72 => _72.cooked]);
|
|
2099
2165
|
if (template.expressions.length > 0 || typeof value !== "string") return;
|
|
2100
2166
|
replacements.push({
|
|
2101
2167
|
start: template.start,
|
|
@@ -2205,7 +2271,7 @@ function hasFarmPluginRoutes(config) {
|
|
|
2205
2271
|
}
|
|
2206
2272
|
function farmServerRuntimePluginsMayHandlePath(config, pathname) {
|
|
2207
2273
|
return (config.plugins || []).some(
|
|
2208
|
-
(plugin) =>
|
|
2274
|
+
(plugin) => _chunkJX5VOLAVcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) !== false && // Mobile session tokens change only bearer requests and cookie-clearing responses, which a
|
|
2209
2275
|
// prerendered file never answers or sends; its endpoints live under /__farm/.
|
|
2210
2276
|
plugin.name !== _chunk4BS3HSY7cjs.FARM_MOBILE_SESSION_PLUGIN && _chunk47JV57DAcjs.farmPluginMayAffectRuntimePath.call(void 0, plugin, pathname)
|
|
2211
2277
|
);
|
|
@@ -2253,7 +2319,7 @@ async function discoverMiddlewareRoutes(appDir) {
|
|
|
2253
2319
|
return Array.from(routes.values()).sort(_chunkMHLNWRCJcjs.compareMiddlewareRouteLocations).map(({ path: routePath, filePath }) => ({ path: routePath, filePath }));
|
|
2254
2320
|
}
|
|
2255
2321
|
function assertFarmDocsRuntimeSupported(config, preset) {
|
|
2256
|
-
if (!_optionalChain([config, 'access',
|
|
2322
|
+
if (!_optionalChain([config, 'access', _73 => _73.docs, 'optionalAccess', _74 => _74.enabled]) || !_optionalChain([config, 'access', _75 => _75.docs, 'access', _76 => _76.adapter, 'optionalAccess', _77 => _77.server]) || _chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) !== "edge" || Boolean(config.docs.adapter.edgeCompiler)) {
|
|
2257
2323
|
return;
|
|
2258
2324
|
}
|
|
2259
2325
|
throw new Error(
|
|
@@ -2266,7 +2332,6 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
2266
2332
|
assertFarmDocsRuntimeSupported(config, preset);
|
|
2267
2333
|
const srcDir = config.srcDir || "src";
|
|
2268
2334
|
const distDir = config.distDir || ".farm";
|
|
2269
|
-
const deployOutputDir = _chunk6GQJVY4Ecjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
2270
2335
|
const lifecyclePluginManager = options.pluginManager;
|
|
2271
2336
|
const productionViteResultPromise = Promise.allSettled([
|
|
2272
2337
|
Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkMF3IA2AWcjs.loadFarmProductionVite.call(void 0, ))))
|
|
@@ -2285,7 +2350,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
2285
2350
|
const routeRuntimeManifestResultPromise = Promise.allSettled([routeRuntimeManifestPromise]);
|
|
2286
2351
|
const pageRoutes = [];
|
|
2287
2352
|
for (const [pattern, entry] of routeManager.getRoutes()) {
|
|
2288
|
-
const markdownSourcePath = entry.markdownSourcePath || (
|
|
2353
|
+
const markdownSourcePath = entry.markdownSourcePath || (_chunkL6E4SHUBcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? entry.modulePath : void 0);
|
|
2289
2354
|
pageRoutes.push({
|
|
2290
2355
|
pattern,
|
|
2291
2356
|
...entry.directory ? { directory: entry.directory } : {},
|
|
@@ -2491,19 +2556,22 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
2491
2556
|
_chunkQMNWKQL4cjs.logger.error(`\u274C Build failed: ${error}`);
|
|
2492
2557
|
throw error;
|
|
2493
2558
|
} finally {
|
|
2494
|
-
_optionalChain([rendererBuild, 'optionalAccess',
|
|
2559
|
+
_optionalChain([rendererBuild, 'optionalAccess', _78 => _78.abort, 'call', _79 => _79()]);
|
|
2495
2560
|
}
|
|
2496
2561
|
}
|
|
2497
2562
|
function shouldBuildFarmMobileClient(config) {
|
|
2498
2563
|
return Boolean(config.mobileClient) && !config.desktop;
|
|
2499
2564
|
}
|
|
2500
|
-
function
|
|
2565
|
+
function varyFarmNitroCacheRules(rules, headerNames) {
|
|
2566
|
+
if (headerNames.length === 0) return rules;
|
|
2501
2567
|
return Object.fromEntries(
|
|
2502
2568
|
Object.entries(rules).map(([source, rule]) => {
|
|
2503
|
-
const cached = _optionalChain([rule, 'optionalAccess',
|
|
2569
|
+
const cached = _optionalChain([rule, 'optionalAccess', _80 => _80.swr]) !== void 0 && rule.swr !== false || _optionalChain([rule, 'optionalAccess', _81 => _81.cache]) !== void 0 && rule.cache !== false;
|
|
2504
2570
|
if (!cached || rule.cache === false) return [source, rule];
|
|
2505
2571
|
const cache = rule.cache && typeof rule.cache === "object" ? rule.cache : {};
|
|
2506
|
-
const varies = [
|
|
2572
|
+
const varies = [
|
|
2573
|
+
.../* @__PURE__ */ new Set([...Array.isArray(cache.varies) ? cache.varies : [], ...headerNames])
|
|
2574
|
+
];
|
|
2507
2575
|
return [source, { ...rule, cache: { ...cache, varies } }];
|
|
2508
2576
|
})
|
|
2509
2577
|
);
|
|
@@ -2551,7 +2619,7 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
|
|
|
2551
2619
|
}
|
|
2552
2620
|
const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
|
|
2553
2621
|
await fs4.writeFile(fontCssPath, normalizedFontCss);
|
|
2554
|
-
await fs4.writeFile(clientCssPath,
|
|
2622
|
+
await fs4.writeFile(clientCssPath, _chunkKWST2O22cjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
|
|
2555
2623
|
}
|
|
2556
2624
|
function importsFarmClientBlockedPackage(id, packageName) {
|
|
2557
2625
|
return id === packageName || id.startsWith(`${packageName}/`);
|
|
@@ -2604,7 +2672,7 @@ function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, optio
|
|
|
2604
2672
|
const key = `${_path2.default.resolve(root)}\0${mode}\0${options.asyncOwnerIslands === true}\0${options.serverOwners === true}\0${options.serverTreeLayouts === true}\0${_path2.default.resolve(modulePath)}`;
|
|
2605
2673
|
let plan = cache.get(key);
|
|
2606
2674
|
if (!plan) {
|
|
2607
|
-
plan =
|
|
2675
|
+
plan = _chunk2IFT2CSAcjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
|
|
2608
2676
|
cache.set(key, plan);
|
|
2609
2677
|
}
|
|
2610
2678
|
return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
|
|
@@ -2613,7 +2681,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2613
2681
|
if (!mobile) await _chunkE5UN4OWXcjs.removeFarmMobileClientManifest.call(void 0, _path2.default.dirname(outputDir));
|
|
2614
2682
|
const viteBuild = productionVite.build;
|
|
2615
2683
|
const { farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.cjs");
|
|
2616
|
-
const { PluginManager: PluginManager2 } = await import("./plugin-
|
|
2684
|
+
const { PluginManager: PluginManager2 } = await import("./plugin-5PIQQVRP.cjs");
|
|
2617
2685
|
const fs4 = await import("fs/promises");
|
|
2618
2686
|
const pluginManager = new PluginManager2({
|
|
2619
2687
|
config,
|
|
@@ -2622,31 +2690,31 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2622
2690
|
});
|
|
2623
2691
|
pluginManager.addPlugins(config.plugins || []);
|
|
2624
2692
|
const clientPages = [];
|
|
2625
|
-
const integrationProviders =
|
|
2693
|
+
const integrationProviders = _chunkJX5VOLAVcjs.getIntegrationProviders.call(void 0, config.integrations).filter(
|
|
2626
2694
|
(provider) => provider.component || provider.type === "clerk"
|
|
2627
2695
|
);
|
|
2628
2696
|
const unsupportedIntegrationProvider = integrationProviders.find(
|
|
2629
2697
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
2630
2698
|
);
|
|
2631
|
-
if (_optionalChain([config, 'access',
|
|
2699
|
+
if (_optionalChain([config, 'access', _82 => _82.experimental, 'optionalAccess', _83 => _83.isolatedClientHydration]) === "enabled" && _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _84 => _84.experimental, 'optionalAccess', _85 => _85.serverComponents])) !== "rsc" && unsupportedIntegrationProvider) {
|
|
2632
2700
|
_chunkQMNWKQL4cjs.logger.warn(
|
|
2633
2701
|
`[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
|
|
2634
2702
|
);
|
|
2635
2703
|
}
|
|
2636
|
-
const isolatedMode =
|
|
2637
|
-
_optionalChain([config, 'access',
|
|
2704
|
+
const isolatedMode = _chunk2IFT2CSAcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
2705
|
+
_optionalChain([config, 'access', _86 => _86.experimental, 'optionalAccess', _87 => _87.isolatedClientHydration]),
|
|
2638
2706
|
{
|
|
2639
|
-
serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
2707
|
+
serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _88 => _88.experimental, 'optionalAccess', _89 => _89.serverComponents])) === "rsc",
|
|
2640
2708
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
2641
2709
|
}
|
|
2642
2710
|
);
|
|
2643
|
-
const planOptions =
|
|
2711
|
+
const planOptions = _chunk2IFT2CSAcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
2644
2712
|
config.renderer,
|
|
2645
2713
|
Boolean(unsupportedIntegrationProvider)
|
|
2646
2714
|
);
|
|
2647
2715
|
const pagePlanOptions = {
|
|
2648
2716
|
...planOptions,
|
|
2649
|
-
serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
2717
|
+
serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _90 => _90.experimental, 'optionalAccess', _91 => _91.serverComponents])) === "islands"
|
|
2650
2718
|
};
|
|
2651
2719
|
const layoutPlanOptions = {
|
|
2652
2720
|
...planOptions,
|
|
@@ -2697,22 +2765,22 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2697
2765
|
};
|
|
2698
2766
|
}
|
|
2699
2767
|
});
|
|
2700
|
-
const layoutAppliesToRoute =
|
|
2768
|
+
const layoutAppliesToRoute = _chunk2MR4MABGcjs.routeBoundaryCoversDirectory;
|
|
2701
2769
|
const routeDirectory = (route) => _nullishCoalesce(route.directory, () => ( route.pattern));
|
|
2702
|
-
const islandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
2770
|
+
const islandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _92 => _92.experimental, 'optionalAccess', _93 => _93.serverComponents])) === "islands";
|
|
2703
2771
|
const adapterOwnsDocsRuntime = Boolean(
|
|
2704
|
-
_chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access',
|
|
2772
|
+
_chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _94 => _94.docs, 'optionalAccess', _95 => _95.enabled]) && _optionalChain([config, 'access', _96 => _96.docs, 'access', _97 => _97.adapter, 'optionalAccess', _98 => _98.server]) && config.docs.adapter.react
|
|
2705
2773
|
);
|
|
2706
|
-
const docsEntries = _optionalChain([config, 'access',
|
|
2774
|
+
const docsEntries = _optionalChain([config, 'access', _99 => _99.docs, 'optionalAccess', _100 => _100.enabled]) ? _chunkNAXKOTPPcjs.getFarmDocsRoots.call(void 0, config.docs).map(
|
|
2707
2775
|
(docsRoot) => `/${docsRoot.entry || "docs"}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/"
|
|
2708
2776
|
) : [];
|
|
2709
2777
|
const adapterDocsEntry = _nullishCoalesce(docsEntries[0], () => ( null));
|
|
2710
2778
|
const isAdapterDocsRoute = (routePattern) => adapterOwnsDocsRuntime && docsEntries.some(
|
|
2711
2779
|
(docsEntry) => docsEntry === "/" || routePattern === docsEntry || routePattern.startsWith(`${docsEntry}/`)
|
|
2712
2780
|
);
|
|
2713
|
-
const syntheticDocsEntry = _optionalChain([config, 'access',
|
|
2781
|
+
const syntheticDocsEntry = _optionalChain([config, 'access', _101 => _101.docs, 'optionalAccess', _102 => _102.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
|
|
2714
2782
|
const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
|
|
2715
|
-
const markdownPagePlan =
|
|
2783
|
+
const markdownPagePlan = _chunk2IFT2CSAcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
2716
2784
|
_chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), root),
|
|
2717
2785
|
root,
|
|
2718
2786
|
isolatedMode,
|
|
@@ -2720,7 +2788,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2720
2788
|
);
|
|
2721
2789
|
const routePlans = pageRoutes.map((route) => ({
|
|
2722
2790
|
route,
|
|
2723
|
-
metadata:
|
|
2791
|
+
metadata: _chunkL6E4SHUBcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
|
|
2724
2792
|
route.modulePath,
|
|
2725
2793
|
root,
|
|
2726
2794
|
isolatedMode,
|
|
@@ -2728,7 +2796,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2728
2796
|
pagePlanOptions
|
|
2729
2797
|
)
|
|
2730
2798
|
}));
|
|
2731
|
-
|
|
2799
|
+
_chunk2IFT2CSAcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
2732
2800
|
clientLayouts.map((layout) => ({
|
|
2733
2801
|
pattern: layout.pattern,
|
|
2734
2802
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -2737,7 +2805,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2737
2805
|
[
|
|
2738
2806
|
...routePlans.map(({ route, metadata }) => ({
|
|
2739
2807
|
pattern: routeDirectory(route),
|
|
2740
|
-
depth:
|
|
2808
|
+
depth: _chunk2MR4MABGcjs.getRouteDirectoryDepth.call(void 0, routeDirectory(route)),
|
|
2741
2809
|
metadata
|
|
2742
2810
|
})),
|
|
2743
2811
|
...syntheticDocsPatterns.map((pattern) => ({
|
|
@@ -2761,7 +2829,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2761
2829
|
for (const layout of clientLayouts) {
|
|
2762
2830
|
const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, routeDirectory(route))) || docsEntries.some((docsEntry) => layoutAppliesToRoute(layout.pattern, docsEntry));
|
|
2763
2831
|
if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
|
|
2764
|
-
_chunkQMNWKQL4cjs.logger.warn(`\u26A0\uFE0F ${
|
|
2832
|
+
_chunkQMNWKQL4cjs.logger.warn(`\u26A0\uFE0F ${_chunk2IFT2CSAcjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
|
|
2765
2833
|
}
|
|
2766
2834
|
}
|
|
2767
2835
|
if (isolatedMode === "analyze") {
|
|
@@ -2795,7 +2863,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2795
2863
|
);
|
|
2796
2864
|
if (metadata.suppressedAsyncHydration) {
|
|
2797
2865
|
_chunkQMNWKQL4cjs.logger.warn(
|
|
2798
|
-
`\u26A0\uFE0F ${
|
|
2866
|
+
`\u26A0\uFE0F ${_chunk2IFT2CSAcjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
|
|
2799
2867
|
);
|
|
2800
2868
|
}
|
|
2801
2869
|
const slotBoundaries = serverSlotPlans.filter(
|
|
@@ -2803,7 +2871,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2803
2871
|
).flatMap(({ plan }) => plan.isolatedBoundaries);
|
|
2804
2872
|
if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0 || slotBoundaries.length > 0) {
|
|
2805
2873
|
const relativePath = route.modulePath.replace(root, "").replace(/^\//, "");
|
|
2806
|
-
const islandStrategy =
|
|
2874
|
+
const islandStrategy = _chunkKWST2O22cjs.resolveFarmRouteRootStrategy.call(void 0,
|
|
2807
2875
|
route,
|
|
2808
2876
|
metadata,
|
|
2809
2877
|
clientLayouts,
|
|
@@ -2822,7 +2890,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2822
2890
|
...applicableClientLayouts.filter((layout) => layout.hasIsolatedClientBoundaries || layout.serverTreeLayout).flatMap((layout) => layout.isolatedBoundaries)
|
|
2823
2891
|
],
|
|
2824
2892
|
// The server renders a server tree only below a hydrating layout.
|
|
2825
|
-
...
|
|
2893
|
+
..._chunk2IFT2CSAcjs.usesFarmServerTree.call(void 0, metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
|
|
2826
2894
|
});
|
|
2827
2895
|
_chunkQMNWKQL4cjs.logger.info(`\u{1F4F1} Found hydratable route: ${route.pattern} -> ${route.modulePath}`);
|
|
2828
2896
|
}
|
|
@@ -2859,7 +2927,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2859
2927
|
}
|
|
2860
2928
|
const clientRouteSlots = routeSlots.filter((slot) => {
|
|
2861
2929
|
try {
|
|
2862
|
-
const metadata =
|
|
2930
|
+
const metadata = _chunk2IFT2CSAcjs.getClientModuleMetadata.call(void 0, slot.modulePath, root);
|
|
2863
2931
|
return metadata.shouldHydrate && (!islandsMode || metadata.isClientComponent);
|
|
2864
2932
|
} catch (error) {
|
|
2865
2933
|
_chunkQMNWKQL4cjs.logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
|
|
@@ -2882,20 +2950,20 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2882
2950
|
srcDir,
|
|
2883
2951
|
adapterOwnsDocsRuntime ? false : _chunkDZZHTMWMcjs.isFarmDocsSearchEnabled.call(void 0, config.docs),
|
|
2884
2952
|
adapterOwnsDocsRuntime ? void 0 : _chunkDZZHTMWMcjs.resolveFarmDocsSearchClientModule.call(void 0, root),
|
|
2885
|
-
_optionalChain([config, 'access',
|
|
2886
|
-
adapterOwnsDocsRuntime ? _optionalChain([config, 'access',
|
|
2953
|
+
_optionalChain([config, 'access', _103 => _103.docs, 'optionalAccess', _104 => _104.enabled]) ? _chunkNAXKOTPPcjs.getFarmDocsRoots.call(void 0, config.docs).map((docsRoot) => docsRoot.entry) : void 0,
|
|
2954
|
+
adapterOwnsDocsRuntime ? _optionalChain([config, 'access', _105 => _105.docs, 'access', _106 => _106.adapter, 'optionalAccess', _107 => _107.react]) : void 0,
|
|
2887
2955
|
config.i18n,
|
|
2888
2956
|
config.plugins,
|
|
2889
2957
|
config.renderer,
|
|
2890
2958
|
config.publicRuntimeConfig,
|
|
2891
2959
|
config.trailingSlash,
|
|
2892
|
-
|
|
2960
|
+
_chunkJX5VOLAVcjs.getIntegrationProviders.call(void 0, config.integrations),
|
|
2893
2961
|
config.basePath,
|
|
2894
|
-
|
|
2962
|
+
_chunkKWST2O22cjs.generateClientCachePersistenceCode.call(void 0, _chunkKWST2O22cjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
|
|
2895
2963
|
adapterOwnsDocsRuntime ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0,
|
|
2896
|
-
_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
2964
|
+
_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _108 => _108.experimental, 'optionalAccess', _109 => _109.serverComponents])) === "islands",
|
|
2897
2965
|
platform,
|
|
2898
|
-
islandsMode ?
|
|
2966
|
+
islandsMode ? _chunk2IFT2CSAcjs.collectFarmServerStylesheets.call(void 0,
|
|
2899
2967
|
[
|
|
2900
2968
|
...layoutRoutes.map((layout) => layout.modulePath),
|
|
2901
2969
|
...pageRoutes.filter((route) => !isAdapterDocsRoute(route.pattern)).map((route) => route.modulePath)
|
|
@@ -2910,7 +2978,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2910
2978
|
await fs4.writeFile(_path2.default.join(clientEntryDir, "farm-client-router.tsx"), clientEntry.router);
|
|
2911
2979
|
}
|
|
2912
2980
|
const clientInput = { [entryName]: clientEntryPath };
|
|
2913
|
-
if (platform === "web" &&
|
|
2981
|
+
if (platform === "web" && _chunkKWST2O22cjs.canBootFarmIslandsClient.call(void 0, config)) {
|
|
2914
2982
|
const clientBootPath = _path2.default.join(clientEntryDir, "farm-client-boot.tsx");
|
|
2915
2983
|
await fs4.writeFile(
|
|
2916
2984
|
clientBootPath,
|
|
@@ -2931,7 +2999,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2931
2999
|
const postcssConfigPath = _path2.default.join(clientEntryDir, "postcss.config.cjs");
|
|
2932
3000
|
await fs4.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
|
|
2933
3001
|
postcssSearchPath = clientEntryDir;
|
|
2934
|
-
tailwindVitePlugin = await
|
|
3002
|
+
tailwindVitePlugin = await _chunkDMXMIE2Ccjs.loadTailwindVitePlugin.call(void 0, {
|
|
2935
3003
|
builder: productionVite.builder,
|
|
2936
3004
|
announce: true
|
|
2937
3005
|
});
|
|
@@ -2953,7 +3021,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2953
3021
|
outDir: outputDir,
|
|
2954
3022
|
emptyOutDir: platform === "web",
|
|
2955
3023
|
// Never public: see resolveFarmClientSourcemap.
|
|
2956
|
-
sourcemap: resolveFarmClientSourcemap(_optionalChain([config, 'access',
|
|
3024
|
+
sourcemap: resolveFarmClientSourcemap(_optionalChain([config, 'access', _110 => _110.vite, 'optionalAccess', _111 => _111.build, 'optionalAccess', _112 => _112.sourcemap])),
|
|
2957
3025
|
assetsInlineLimit: 0,
|
|
2958
3026
|
cssCodeSplit: false,
|
|
2959
3027
|
// Bundle all CSS into one file
|
|
@@ -2965,7 +3033,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2965
3033
|
hashCharacters: "hex",
|
|
2966
3034
|
// Use predictable name for CSS so we can reference it in SSR HTML
|
|
2967
3035
|
assetFileNames: (assetInfo) => {
|
|
2968
|
-
if (_optionalChain([assetInfo, 'access',
|
|
3036
|
+
if (_optionalChain([assetInfo, 'access', _113 => _113.name, 'optionalAccess', _114 => _114.endsWith, 'call', _115 => _115(".css")])) {
|
|
2969
3037
|
return `${entryName}.css`;
|
|
2970
3038
|
}
|
|
2971
3039
|
return "assets/[name]-h[hash][extname]";
|
|
@@ -2982,7 +3050,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2982
3050
|
}
|
|
2983
3051
|
},
|
|
2984
3052
|
plugins: [
|
|
2985
|
-
|
|
3053
|
+
_chunkKWST2O22cjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
2986
3054
|
createFarmPrivateClientSourcemapsPlugin({
|
|
2987
3055
|
outDir: _path2.default.join(
|
|
2988
3056
|
_path2.default.dirname(outputDir),
|
|
@@ -3014,7 +3082,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3014
3082
|
...rendererVitePlugins,
|
|
3015
3083
|
...config.vite.plugins || [],
|
|
3016
3084
|
farmServerOnlyEntriesPlugin({ platform }),
|
|
3017
|
-
|
|
3085
|
+
_chunkKWST2O22cjs.farmDocsClientConfigPlugin.call(void 0,
|
|
3018
3086
|
adapterOwnsDocsRuntime ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
|
|
3019
3087
|
),
|
|
3020
3088
|
// Plugin to redirect @farm.js/core imports to client-only exports
|
|
@@ -3047,7 +3115,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3047
3115
|
},
|
|
3048
3116
|
load: {
|
|
3049
3117
|
filter: {
|
|
3050
|
-
id:
|
|
3118
|
+
id: _chunkKWST2O22cjs.exactIdPattern.call(void 0, [
|
|
3051
3119
|
"\0empty-module",
|
|
3052
3120
|
"\0empty-api-route",
|
|
3053
3121
|
"\0farm-i18n-client-bridge",
|
|
@@ -3084,7 +3152,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3084
3152
|
{ ...config, isolatedClientBoundaryModules, programmaticClientRoutes },
|
|
3085
3153
|
pluginManager
|
|
3086
3154
|
),
|
|
3087
|
-
|
|
3155
|
+
_chunk2IFT2CSAcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
|
|
3088
3156
|
],
|
|
3089
3157
|
mode: "production",
|
|
3090
3158
|
css: postcssSearchPath ? {
|
|
@@ -3092,7 +3160,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3092
3160
|
} : void 0,
|
|
3093
3161
|
// Ensure React is bundled for client
|
|
3094
3162
|
resolve: {
|
|
3095
|
-
alias:
|
|
3163
|
+
alias: _chunkKWST2O22cjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
3096
3164
|
dedupe: [...config.renderer.dedupe || []]
|
|
3097
3165
|
},
|
|
3098
3166
|
// Optimize dependencies - exclude server-side code from client bundle
|
|
@@ -3105,7 +3173,9 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3105
3173
|
]
|
|
3106
3174
|
}
|
|
3107
3175
|
};
|
|
3108
|
-
await viteBuild(
|
|
3176
|
+
await viteBuild(
|
|
3177
|
+
_chunkKWST2O22cjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite, { clientOutput: true })
|
|
3178
|
+
);
|
|
3109
3179
|
if (platform === "mobile") {
|
|
3110
3180
|
await fs4.rm(_path2.default.join(outputDir, `${entryName}.css`), { force: true });
|
|
3111
3181
|
if (!await _chunkE5UN4OWXcjs.hasFarmMobileClientEntry.call(void 0, _path2.default.dirname(outputDir), outputDir)) {
|
|
@@ -3205,7 +3275,7 @@ async function fetchFarmNavigationDocument(url, headers, recover = true, signal)
|
|
|
3205
3275
|
return response;
|
|
3206
3276
|
}
|
|
3207
3277
|
|
|
3208
|
-
${streamNavigations ?
|
|
3278
|
+
${streamNavigations ? _chunkKWST2O22cjs.FARM_NAVIGATION_STREAM_READER_SOURCE : ""}
|
|
3209
3279
|
|
|
3210
3280
|
function clearFarmPrefetchCacheOnDeploymentMismatch(router, error) {
|
|
3211
3281
|
if (error?.name === "FarmDeploymentMismatchError") {
|
|
@@ -4067,7 +4137,7 @@ function readFarmEntryImports(source) {
|
|
|
4067
4137
|
for (const match of source.matchAll(/^import\s+([^"';]+?)\s+from\s+(["'][^"']+["'])/gm)) {
|
|
4068
4138
|
const from = match[2];
|
|
4069
4139
|
const named = /\{([^}]*)\}/.exec(match[1]);
|
|
4070
|
-
for (const specifier of _nullishCoalesce(_optionalChain([named, 'optionalAccess',
|
|
4140
|
+
for (const specifier of _nullishCoalesce(_optionalChain([named, 'optionalAccess', _116 => _116[1], 'optionalAccess', _117 => _117.split, 'call', _118 => _118(",")]), () => ( []))) {
|
|
4071
4141
|
const [imported, local] = specifier.trim().split(/\s+as\s+/);
|
|
4072
4142
|
if (imported)
|
|
4073
4143
|
bindings.push({ local: _nullishCoalesce(local, () => ( imported)), clause: `{ ${specifier.trim()} }`, from });
|
|
@@ -4162,7 +4232,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
4162
4232
|
direction: {}
|
|
4163
4233
|
}, plugins = [], renderer = _chunk67MZTLTFcjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule, islandValues = false, platform, serverStylesheets = []) {
|
|
4164
4234
|
const toImportPath = (targetPath) => targetPath.replace(/\\/g, "/");
|
|
4165
|
-
const clientPluginEntry =
|
|
4235
|
+
const clientPluginEntry = _chunkDMXMIE2Ccjs.generateFarmClientPluginEntryCode.call(void 0,
|
|
4166
4236
|
plugins,
|
|
4167
4237
|
root,
|
|
4168
4238
|
srcDir,
|
|
@@ -4174,7 +4244,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
4174
4244
|
import { createRoot, hydrateRoot } from "react-dom/client";` : appSetupPath ? `import React, { createRoot, hydrateRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)};
|
|
4175
4245
|
import __farmAppSetup from ${JSON.stringify(_chunkQMNWKQL4cjs.toPosixPath.call(void 0, appSetupPath))};
|
|
4176
4246
|
__farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};`;
|
|
4177
|
-
const providerClientCode =
|
|
4247
|
+
const providerClientCode = _chunkKWST2O22cjs.generateFarmIntegrationProviderClientCode.call(void 0,
|
|
4178
4248
|
integrationProviders,
|
|
4179
4249
|
root,
|
|
4180
4250
|
_nullishCoalesce(renderer.componentExtensions, () => ( []))
|
|
@@ -4197,18 +4267,18 @@ __farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot
|
|
|
4197
4267
|
const layoutImportStatements = [];
|
|
4198
4268
|
const layoutRegistrations = [];
|
|
4199
4269
|
const hydratingLayoutPatterns = layoutRoutes.filter((layout) => layout.shouldHydrate).map((layout) => layout.pattern);
|
|
4200
|
-
const treeLayoutPatterns = islandValues ?
|
|
4270
|
+
const treeLayoutPatterns = islandValues ? _chunk2MR4MABGcjs.getFarmServerTreeLayoutPatterns.call(void 0, layoutRoutes) : /* @__PURE__ */ new Set();
|
|
4201
4271
|
layoutRoutes.forEach((layout, index) => {
|
|
4202
4272
|
const relativePath = toImportPath(layout.modulePath);
|
|
4203
4273
|
const treeLayout = treeLayoutPatterns.has(layout.pattern);
|
|
4204
4274
|
const rendersOnClient = treeLayout || !layout.hasIsolatedClientBoundaries && hydratingLayoutPatterns.some(
|
|
4205
|
-
(pattern) =>
|
|
4275
|
+
(pattern) => _chunk2MR4MABGcjs.layoutsCanCoverSamePage.call(void 0, layout.pattern, pattern)
|
|
4206
4276
|
);
|
|
4207
4277
|
if (rendersOnClient && !treeLayout) {
|
|
4208
4278
|
layoutImportStatements.push(`import Layout${index} from "${relativePath}";`);
|
|
4209
4279
|
}
|
|
4210
|
-
const groupScope =
|
|
4211
|
-
const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(
|
|
4280
|
+
const groupScope = _chunk2MR4MABGcjs.getRouteGroupScope.call(void 0, layout.pattern);
|
|
4281
|
+
const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(_chunk2MR4MABGcjs.stripRouteGroups.call(void 0, layout.pattern))}, groupScope: ${JSON.stringify(groupScope)}` : "";
|
|
4212
4282
|
layoutRegistrations.push(
|
|
4213
4283
|
` { pattern: ${JSON.stringify(layout.pattern)}${groupFields}, Component: ${rendersOnClient ? treeLayout ? `getFarmTreeLayoutComponent(${JSON.stringify(layout.pattern)})` : `Layout${index}` : "null"}, shouldHydrate: ${JSON.stringify(layout.shouldHydrate)}, islandStrategy: ${JSON.stringify(layout.islandStrategy)}${treeLayout ? ", serverTree: true" : ""} }`
|
|
4214
4284
|
);
|
|
@@ -4295,7 +4365,7 @@ mountFarmDocsSearch();
|
|
|
4295
4365
|
|
|
4296
4366
|
${generateUniversalRouterStateRuntime()}
|
|
4297
4367
|
|
|
4298
|
-
${
|
|
4368
|
+
${_chunkKWST2O22cjs.FARM_NAVIGATION_SCRIPT_SOURCE}
|
|
4299
4369
|
|
|
4300
4370
|
// SPA Router for server-rendered pages (HTML swap)
|
|
4301
4371
|
const spaRouter = {
|
|
@@ -4619,7 +4689,8 @@ async function createFarmServerTreePageElement(source, pathname) {
|
|
|
4619
4689
|
return await createFarmServerTreeElement(React, source, {
|
|
4620
4690
|
load: loadFarmIsolatedBoundary,
|
|
4621
4691
|
ServerHtml: FarmServerPage,
|
|
4622
|
-
key:
|
|
4692
|
+
// No key: the next page of the same layout updates this one in place, as React Server
|
|
4693
|
+
// Components do, instead of unmounting it and building every node again.
|
|
4623
4694
|
});
|
|
4624
4695
|
} catch (error) {
|
|
4625
4696
|
console.warn("[Farm.js] Could not rebuild the server tree of " + pathname + "; its server HTML was kept.", error);
|
|
@@ -4731,7 +4802,7 @@ function hasHydratableLayout(pathname) {
|
|
|
4731
4802
|
});
|
|
4732
4803
|
}
|
|
4733
4804
|
|
|
4734
|
-
${
|
|
4805
|
+
${_chunkKWST2O22cjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
|
|
4735
4806
|
// Wrap a page element with applicable layouts
|
|
4736
4807
|
function wrapWithLayouts(pageElement, pathname, params) {
|
|
4737
4808
|
const layouts = getApplicableLayouts(pathname);
|
|
@@ -4766,7 +4837,7 @@ function createLayoutPageBoundary(route, pageElement, serverHtml) {
|
|
|
4766
4837
|
return React.createElement("div", props, pageElement);
|
|
4767
4838
|
}
|
|
4768
4839
|
let farmLastRouteState = null;
|
|
4769
|
-
${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${
|
|
4840
|
+
${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${_chunkKWST2O22cjs.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE}
|
|
4770
4841
|
function farmTreeLayoutsOf(pathname) {
|
|
4771
4842
|
return getApplicableLayouts(pathname).filter(function(layout) {
|
|
4772
4843
|
return layout.serverTree === true;
|
|
@@ -5330,7 +5401,7 @@ function fitsSegmentResponse(currentRoot, nextRoot) {
|
|
|
5330
5401
|
return true;
|
|
5331
5402
|
}` : ""}
|
|
5332
5403
|
|
|
5333
|
-
${
|
|
5404
|
+
${_chunkKWST2O22cjs.FARM_NAVIGATION_SCRIPT_SOURCE}
|
|
5334
5405
|
|
|
5335
5406
|
function activateNavigationScripts(root) {
|
|
5336
5407
|
for (const script of Array.from(root?.querySelectorAll?.("script") || [])) {
|
|
@@ -5433,7 +5504,7 @@ function getLayoutShell(root, patterns, index) {
|
|
|
5433
5504
|
return shell.innerHTML;
|
|
5434
5505
|
}
|
|
5435
5506
|
|
|
5436
|
-
${islandValues ?
|
|
5507
|
+
${islandValues ? _chunkKWST2O22cjs.FARM_REFRESH_FIELDS_SOURCE : ""}function replaceSharedLayoutBoundary(currentRoot, nextRoot, refresh = false) {
|
|
5437
5508
|
// A refresh keeps the islands still on the page: the ones in streamed Suspense content too.
|
|
5438
5509
|
if (refresh) revealFarmStreamedContent(nextRoot);
|
|
5439
5510
|
const currentPatterns = getLayoutPatterns(currentRoot);
|
|
@@ -6015,7 +6086,7 @@ void hydrate();
|
|
|
6015
6086
|
async function buildSSRInMemory(productionVite, config, root, routeManager, apiRouteManager, serverRenderer, preset, collectedPageRoutes, collectedLayoutRoutes, collectedRouteSlots, isolatedClientBoundaryModules, hydrationPlanCache, rendererBuildLifetime) {
|
|
6016
6087
|
const viteBuild = productionVite.build;
|
|
6017
6088
|
const { farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.cjs");
|
|
6018
|
-
const { PluginManager: PluginManager2 } = await import("./plugin-
|
|
6089
|
+
const { PluginManager: PluginManager2 } = await import("./plugin-5PIQQVRP.cjs");
|
|
6019
6090
|
const fs4 = await import("fs/promises");
|
|
6020
6091
|
const pluginManager = new PluginManager2({
|
|
6021
6092
|
config,
|
|
@@ -6036,7 +6107,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6036
6107
|
_path2.default.join(postcssConfigDir, "postcss.config.cjs"),
|
|
6037
6108
|
"module.exports = { plugins: [] };\n"
|
|
6038
6109
|
);
|
|
6039
|
-
tailwindVitePlugin = await
|
|
6110
|
+
tailwindVitePlugin = await _chunkDMXMIE2Ccjs.loadTailwindVitePlugin.call(void 0, {
|
|
6040
6111
|
builder: productionVite.builder,
|
|
6041
6112
|
label: "for SSR"
|
|
6042
6113
|
});
|
|
@@ -6143,7 +6214,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6143
6214
|
}))
|
|
6144
6215
|
) : discoveredMiddlewareRoutes;
|
|
6145
6216
|
const instrumentationPath = _chunk3GNHJ3RNcjs.resolveFarmInstrumentationFile.call(void 0, root, config.srcDir || "src");
|
|
6146
|
-
const notFoundPath =
|
|
6217
|
+
const notFoundPath = _chunkKWST2O22cjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
|
|
6147
6218
|
if (notFoundPath) _chunkQMNWKQL4cjs.logger.info(`\u{1F4CB} Found custom 404 page: ${notFoundPath}`);
|
|
6148
6219
|
layoutRoutes.sort((a, b) => {
|
|
6149
6220
|
const depthA = a.pattern.split("/").filter(Boolean).length;
|
|
@@ -6160,14 +6231,14 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6160
6231
|
const hasServerRuntimeIntegrations = configuredIntegrationValues.some(
|
|
6161
6232
|
(integration) => typeof integration === "object" && integration !== null && (!("serverRuntime" in integration) || integration.serverRuntime !== false)
|
|
6162
6233
|
);
|
|
6163
|
-
const hasIntegrationProviders =
|
|
6234
|
+
const hasIntegrationProviders = _chunkJX5VOLAVcjs.getIntegrationProviders.call(void 0, config.integrations).some(
|
|
6164
6235
|
(provider) => provider.component || provider.type === "clerk"
|
|
6165
6236
|
);
|
|
6166
6237
|
const hasObservabilityHandler = !!config.observability && typeof config.observability === "object" && "onEvent" in config.observability;
|
|
6167
|
-
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access',
|
|
6168
|
-
const hasMiddlewareConfig =
|
|
6169
|
-
const hasRouteContextConfig =
|
|
6170
|
-
const hasServerRuntimePlugins =
|
|
6238
|
+
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _119 => _119.mdx, 'optionalAccess', _120 => _120.components]));
|
|
6239
|
+
const hasMiddlewareConfig = _chunk2MR4MABGcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
|
|
6240
|
+
const hasRouteContextConfig = _chunkKEB7AGS6cjs.hasCustomFarmRouteContext.call(void 0, config);
|
|
6241
|
+
const hasServerRuntimePlugins = _chunkDMXMIE2Ccjs.hasFarmServerRuntimePlugins.call(void 0, config.plugins);
|
|
6171
6242
|
const hasPluginRoutes = hasFarmPluginRoutes(config);
|
|
6172
6243
|
const hasServerCacheConfig = hasFarmServerCacheConfig(config.cache);
|
|
6173
6244
|
const configModulePath = hasServerRuntimeIntegrations || hasObservabilityHandler || hasMdxComponentConfig || hasMiddlewareConfig || hasRouteContextConfig || hasServerRuntimePlugins || hasPluginRoutes || hasServerCacheConfig || hasFarmServerStorageConfig(config.storage) || hasIntegrationProviders ? await findFarmConfigPath(root) : null;
|
|
@@ -6176,19 +6247,19 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6176
6247
|
const hasConfiguredRuntimePlugins = Boolean(
|
|
6177
6248
|
hasRuntimeConfigModule && (config.plugins || []).length > 0
|
|
6178
6249
|
);
|
|
6179
|
-
if (
|
|
6250
|
+
if (_chunkUISZLYKYcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
|
|
6180
6251
|
const adapterGuardedPaths = new Set(getFarmDocsGuardedPaths(config, middlewareRoutes));
|
|
6181
|
-
|
|
6252
|
+
_chunkUISZLYKYcjs.assertFarmDocsAdapterServesNoGuardedPages.call(void 0,
|
|
6182
6253
|
config.docs,
|
|
6183
6254
|
{ root, srcDir: config.srcDir },
|
|
6184
6255
|
(pathname) => adapterGuardedPaths.has(pathname),
|
|
6185
|
-
|
|
6256
|
+
_chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? "edge" : "node"
|
|
6186
6257
|
);
|
|
6187
6258
|
}
|
|
6188
6259
|
const farmDocsCspNonceMarker = _chunk6JHZPB52cjs.createFarmCspNonce.call(void 0, config.security);
|
|
6189
|
-
const farmDocsPrecompiledManifest = _optionalChain([config, 'access',
|
|
6260
|
+
const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _121 => _121.docs, 'optionalAccess', _122 => _122.enabled]) && _chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? await _chunkHDPT6OYEcjs._runWithFarmCspNonce.call(void 0,
|
|
6190
6261
|
farmDocsCspNonceMarker,
|
|
6191
|
-
async () => _optionalChain([config, 'access',
|
|
6262
|
+
async () => _optionalChain([config, 'access', _123 => _123.docs, 'access', _124 => _124.adapter, 'optionalAccess', _125 => _125.server]) ? await _chunkUISZLYKYcjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
|
|
6192
6263
|
root,
|
|
6193
6264
|
srcDir: config.srcDir,
|
|
6194
6265
|
clientEntry: FARM_CLIENT_JS_SRC_PLACEHOLDER,
|
|
@@ -6302,7 +6373,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6302
6373
|
// Adapters can render provider scripts by serializing function source.
|
|
6303
6374
|
// keepNames injects helper calls into those functions; after Nitro
|
|
6304
6375
|
// minifies the server chunk the helper is no longer in script scope.
|
|
6305
|
-
keepNames: !(_optionalChain([config, 'access',
|
|
6376
|
+
keepNames: !(_optionalChain([config, 'access', _126 => _126.docs, 'optionalAccess', _127 => _127.enabled]) && _optionalChain([config, 'access', _128 => _128.docs, 'access', _129 => _129.adapter, 'optionalAccess', _130 => _130.server])),
|
|
6306
6377
|
jsxDev: false
|
|
6307
6378
|
},
|
|
6308
6379
|
// SSR configuration to externalize problematic modules
|
|
@@ -6352,10 +6423,10 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6352
6423
|
define: {
|
|
6353
6424
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
6354
6425
|
__FARM_ENV__: JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, config.env)),
|
|
6355
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
6426
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _131 => _131.env, 'optionalAccess', _132 => _132.public]) || {})
|
|
6356
6427
|
},
|
|
6357
6428
|
plugins: [
|
|
6358
|
-
|
|
6429
|
+
_chunkKWST2O22cjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
6359
6430
|
...tailwindVitePlugin ? [tailwindVitePlugin] : [],
|
|
6360
6431
|
...rendererVitePlugins,
|
|
6361
6432
|
...config.vite.plugins || [],
|
|
@@ -6378,7 +6449,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6378
6449
|
{ ..._chunkNG2EZ6QScjs.createReactProductionModePlugin.call(void 0, ), enforce: "pre" },
|
|
6379
6450
|
farmServerOnlyEntriesPlugin(),
|
|
6380
6451
|
farmPlugin({ ...config, isolatedClientBoundaryModules }, pluginManager),
|
|
6381
|
-
|
|
6452
|
+
_chunk2IFT2CSAcjs.farmEnvironmentFunctionsPlugin.call(void 0, config),
|
|
6382
6453
|
...hasRuntimeConfigModule ? [
|
|
6383
6454
|
farmStripPlatformConfigPlugin(
|
|
6384
6455
|
[
|
|
@@ -6390,7 +6461,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6390
6461
|
{
|
|
6391
6462
|
name: "farm-virtual-ssr-entry",
|
|
6392
6463
|
resolveId: {
|
|
6393
|
-
filter: { id:
|
|
6464
|
+
filter: { id: _chunkKWST2O22cjs.exactIdPattern.call(void 0, [virtualEntryId, "\0virtual:farm-ssr-entry"]) },
|
|
6394
6465
|
handler(id) {
|
|
6395
6466
|
if (id === virtualEntryId || id === "\0virtual:farm-ssr-entry") {
|
|
6396
6467
|
return virtualEntryId;
|
|
@@ -6399,7 +6470,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6399
6470
|
}
|
|
6400
6471
|
},
|
|
6401
6472
|
load: {
|
|
6402
|
-
filter: { id:
|
|
6473
|
+
filter: { id: _chunkKWST2O22cjs.exactIdPattern.call(void 0, [virtualEntryId]) },
|
|
6403
6474
|
handler(id) {
|
|
6404
6475
|
if (id === virtualEntryId) {
|
|
6405
6476
|
return virtualEntryCode;
|
|
@@ -6431,7 +6502,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6431
6502
|
resolve: {
|
|
6432
6503
|
alias: [
|
|
6433
6504
|
...shouldAliasReactServerToWebBuild(config.renderer, preset) ? [createFarmReactWebServerAlias(hasReactDomEdgeServerBuild(root))] : [],
|
|
6434
|
-
...Object.entries(
|
|
6505
|
+
...Object.entries(_chunkKWST2O22cjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
|
|
6435
6506
|
([find, replacement]) => ({ find, replacement })
|
|
6436
6507
|
)
|
|
6437
6508
|
],
|
|
@@ -6439,7 +6510,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6439
6510
|
dedupe: [...config.renderer.dedupe || []]
|
|
6440
6511
|
}
|
|
6441
6512
|
};
|
|
6442
|
-
await viteBuild(
|
|
6513
|
+
await viteBuild(_chunkKWST2O22cjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
|
|
6443
6514
|
} finally {
|
|
6444
6515
|
if (postcssConfigDir) {
|
|
6445
6516
|
try {
|
|
@@ -6475,26 +6546,26 @@ function readFarmPageLastModified(pageRoutes) {
|
|
|
6475
6546
|
return lastModified;
|
|
6476
6547
|
}
|
|
6477
6548
|
function getFarmDocsGuardedPaths(config, middlewareRoutes) {
|
|
6478
|
-
if (!_optionalChain([config, 'access',
|
|
6549
|
+
if (!_optionalChain([config, 'access', _133 => _133.docs, 'optionalAccess', _134 => _134.enabled])) return [];
|
|
6479
6550
|
const options = { root: config.root, srcDir: config.srcDir };
|
|
6480
6551
|
const guards = {
|
|
6481
6552
|
config: { middleware: config.middleware, integrations: config.integrations },
|
|
6482
6553
|
middlewareRoutes
|
|
6483
6554
|
};
|
|
6484
|
-
return
|
|
6485
|
-
(docsRoot) =>
|
|
6486
|
-
).flatMap((page) => [page.href,
|
|
6555
|
+
return _chunkNAXKOTPPcjs.getFarmDocsRoots.call(void 0, config.docs).flatMap(
|
|
6556
|
+
(docsRoot) => _chunkNAXKOTPPcjs.discoverFarmDocsPages.call(void 0, _chunkNAXKOTPPcjs.resolveFarmDocsContentDir.call(void 0, docsRoot, options), docsRoot)
|
|
6557
|
+
).flatMap((page) => [page.href, _chunkNAXKOTPPcjs.getFarmDocsMarkdownPath.call(void 0, page.href)]).filter((pathname) => _chunk2MR4MABGcjs.farmPathGuardCoversPage.call(void 0, guards, pathname));
|
|
6487
6558
|
}
|
|
6488
6559
|
function getFarmAppOwnedDocsEnginePaths(agent, applicationMetadataRoutes) {
|
|
6489
|
-
const llmsTxt = _optionalChain([agent, 'optionalAccess',
|
|
6560
|
+
const llmsTxt = _optionalChain([agent, 'optionalAccess', _135 => _135.llmsTxt]);
|
|
6490
6561
|
const ownedByFile = (kind) => applicationMetadataRoutes.some(
|
|
6491
6562
|
(metadata) => metadata.kind === kind && metadata.pattern === "/"
|
|
6492
6563
|
);
|
|
6493
6564
|
return [
|
|
6494
|
-
..._optionalChain([llmsTxt, 'optionalAccess',
|
|
6495
|
-
..._optionalChain([llmsTxt, 'optionalAccess',
|
|
6496
|
-
..._optionalChain([agent, 'optionalAccess',
|
|
6497
|
-
..._optionalChain([agent, 'optionalAccess',
|
|
6565
|
+
..._optionalChain([llmsTxt, 'optionalAccess', _136 => _136.enabled]) || ownedByFile("llms") ? ["/llms.txt"] : [],
|
|
6566
|
+
..._optionalChain([llmsTxt, 'optionalAccess', _137 => _137.enabled]) && llmsTxt.full || ownedByFile("llms-full") ? ["/llms-full.txt"] : [],
|
|
6567
|
+
..._optionalChain([agent, 'optionalAccess', _138 => _138.sitemap, 'optionalAccess', _139 => _139.enabled]) || ownedByFile("sitemap") ? ["/sitemap.xml"] : [],
|
|
6568
|
+
..._optionalChain([agent, 'optionalAccess', _140 => _140.crawlers, 'optionalAccess', _141 => _141.enabled]) || ownedByFile("robots") ? ["/robots.txt"] : []
|
|
6498
6569
|
];
|
|
6499
6570
|
}
|
|
6500
6571
|
function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
@@ -6505,7 +6576,7 @@ function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
|
6505
6576
|
docsPath: ${root}.entry,
|
|
6506
6577
|
contentDir: ${root}.contentDir || ${root}.config?.contentDir,
|
|
6507
6578
|
}`;
|
|
6508
|
-
if (_optionalChain([docs, 'optionalAccess',
|
|
6579
|
+
if (_optionalChain([docs, 'optionalAccess', _142 => _142.roots, 'optionalAccess', _143 => _143.length])) {
|
|
6509
6580
|
return {
|
|
6510
6581
|
factory: "createFarmDocsAdapterMultiRuntimeHandler",
|
|
6511
6582
|
config: `[farmDocsResolvedConfig, ...farmDocsResolvedConfig.roots].map((farmDocsRoot) => (${runtimeConfig("farmDocsRoot")}))`
|
|
@@ -6518,7 +6589,7 @@ function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
|
6518
6589
|
}
|
|
6519
6590
|
function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
|
|
6520
6591
|
if (!docs.enabled) return "null";
|
|
6521
|
-
const serializableDocs = _optionalChain([docs, 'access',
|
|
6592
|
+
const serializableDocs = _optionalChain([docs, 'access', _144 => _144.roots, 'optionalAccess', _145 => _145.length]) ? {
|
|
6522
6593
|
...docs,
|
|
6523
6594
|
// React elements and functions do not survive JSON; see runtimeConfig below.
|
|
6524
6595
|
roots: docs.roots.map((docsRoot) => ({ ...docsRoot, runtimeConfig: void 0 }))
|
|
@@ -6552,7 +6623,7 @@ function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
|
|
|
6552
6623
|
},
|
|
6553
6624
|
}
|
|
6554
6625
|
: ${JSON.stringify({ ...serializableDocs, runtimeConfig: void 0 })}`;
|
|
6555
|
-
if (!_optionalChain([docs, 'access',
|
|
6626
|
+
if (!_optionalChain([docs, 'access', _146 => _146.roots, 'optionalAccess', _147 => _147.length])) return expression;
|
|
6556
6627
|
return `((farmDocs) => ({
|
|
6557
6628
|
...farmDocs,
|
|
6558
6629
|
roots: farmDocs.roots.map((farmDocsRoot, index) => {
|
|
@@ -6569,7 +6640,7 @@ function toVirtualEntryImportSpecifier(modulePath) {
|
|
|
6569
6640
|
return JSON.stringify(modulePath.replace(/\\/g, "/"));
|
|
6570
6641
|
}
|
|
6571
6642
|
function generateNativeAuthIntegrationSource(auth) {
|
|
6572
|
-
if (_optionalChain([auth, 'optionalAccess',
|
|
6643
|
+
if (_optionalChain([auth, 'optionalAccess', _148 => _148.enabled]) !== true) {
|
|
6573
6644
|
return { importSource: "", registerSource: "" };
|
|
6574
6645
|
}
|
|
6575
6646
|
return {
|
|
@@ -6879,26 +6950,26 @@ ReactDOMServer.configureApp(__farmAppSetup);`;
|
|
|
6879
6950
|
}
|
|
6880
6951
|
function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlots, errorRoutes, metadataImageRoutes, applicationMetadataRoutes, middlewareRoutes, redirectRoutes, configuredRewriteRoutes, configuredHeaderRoutes, openAPIReference, notFoundPath, instrumentationPath, config, farmDocsPrecompiledManifest, configModulePath, hasServerRuntimeIntegrations, hasRuntimeIntegrationConfig, hasConfiguredRuntimePlugins, hasServerRuntimePlugins, preset, i18nCatalogs, isolatedClientBoundaryModules, hydrationPlanCache, mobileShellLoadingRoutes = [], farmDocsAnalyticsPages = []) {
|
|
6881
6952
|
const farmRendererDisabled = _chunk67MZTLTFcjs.isFarmRendererDisabled.call(void 0, config.renderer);
|
|
6882
|
-
const farmIslandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
6883
|
-
const farmClientBoot =
|
|
6953
|
+
const farmIslandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _149 => _149.experimental, 'optionalAccess', _150 => _150.serverComponents])) === "islands";
|
|
6954
|
+
const farmClientBoot = _chunkKWST2O22cjs.canBootFarmIslandsClient.call(void 0, config);
|
|
6884
6955
|
const farmMobileClient = shouldBuildFarmMobileClient(config);
|
|
6885
6956
|
const farmMobileShells = farmMobileClient && config.mobileShells ? config.mobileShells : null;
|
|
6886
6957
|
const hasCompressionRuntime = config.compress && _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
|
|
6887
|
-
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access',
|
|
6958
|
+
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access', _151 => _151.agent, 'optionalAccess', _152 => _152.crawlers, 'optionalAccess', _153 => _153.enabled])) && !applicationMetadataRoutes.some(
|
|
6888
6959
|
(metadata) => metadata.kind === "robots" && metadata.pattern === "/"
|
|
6889
6960
|
);
|
|
6890
|
-
const servesAgentSitemap = Boolean(_optionalChain([config, 'access',
|
|
6961
|
+
const servesAgentSitemap = Boolean(_optionalChain([config, 'access', _154 => _154.agent, 'optionalAccess', _155 => _155.sitemap, 'optionalAccess', _156 => _156.enabled])) && !applicationMetadataRoutes.some(
|
|
6891
6962
|
(metadata) => metadata.kind === "sitemap" && metadata.pattern === "/"
|
|
6892
6963
|
);
|
|
6893
|
-
const servesDefaultMCP = _optionalChain([config, 'access',
|
|
6894
|
-
const servesAiCatalog = _optionalChain([config, 'access',
|
|
6964
|
+
const servesDefaultMCP = _optionalChain([config, 'access', _157 => _157.agent, 'optionalAccess', _158 => _158.mcp]) === true && !_chunkTP4RAV7Ycjs.farmConfigMountsMCP.call(void 0, config) && !apiRoutes.some((route) => route.path === "/api/mcp");
|
|
6965
|
+
const servesAiCatalog = _optionalChain([config, 'access', _159 => _159.agent, 'optionalAccess', _160 => _160.aiCatalog]) !== false;
|
|
6895
6966
|
const hasPluginRuntime = hasRuntimeIntegrationConfig || hasServerRuntimePlugins;
|
|
6896
6967
|
const hasInfraAnalyticsRuntime = config.analytics !== false && _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
|
|
6897
6968
|
const hasPrecompiledDocs = Boolean(farmDocsPrecompiledManifest);
|
|
6898
6969
|
const adapterOwnsDocsRuntime = Boolean(
|
|
6899
|
-
_chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access',
|
|
6970
|
+
_chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _161 => _161.docs, 'optionalAccess', _162 => _162.enabled]) && _optionalChain([config, 'access', _163 => _163.docs, 'access', _164 => _164.adapter, 'optionalAccess', _165 => _165.server]) && config.docs.adapter.react
|
|
6900
6971
|
);
|
|
6901
|
-
if (_optionalChain([config, 'access',
|
|
6972
|
+
if (_optionalChain([config, 'access', _166 => _166.docs, 'optionalAccess', _167 => _167.enabled]) && _optionalChain([config, 'access', _168 => _168.docs, 'access', _169 => _169.roots, 'optionalAccess', _170 => _170.length]) && !adapterOwnsDocsRuntime) {
|
|
6902
6973
|
throw new Error(
|
|
6903
6974
|
"Several docs roots need the docs adapter, which serves the React renderer only; Farm's built-in docs renderer serves a single docs root."
|
|
6904
6975
|
);
|
|
@@ -6908,7 +6979,7 @@ function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlot
|
|
|
6908
6979
|
const hasIsolatedClientGraphRuntime = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) && isolatedClientBoundaryModules.size > 0;
|
|
6909
6980
|
const rendererStreamingCapabilities = _chunk67MZTLTFcjs.getFarmRendererStreamingCapabilitiesForRuntime.call(void 0,
|
|
6910
6981
|
config.renderer,
|
|
6911
|
-
|
|
6982
|
+
_chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset)
|
|
6912
6983
|
);
|
|
6913
6984
|
const hasReactSyncRender = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer);
|
|
6914
6985
|
const rendererServerImports = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) ? `import * as React from "react";
|
|
@@ -6948,9 +7019,9 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6948
7019
|
(image) => image.sourceType === "module"
|
|
6949
7020
|
);
|
|
6950
7021
|
const edgeMiddlewareFilePaths = farmTargetRunsEdgeMiddleware(preset) ? middlewareRoutes.filter(isFarmEdgeMiddlewareRoute).map((route) => route.filePath) : [];
|
|
6951
|
-
const hasMiddlewareRuntime = middlewareRoutes.length > 0 ||
|
|
6952
|
-
const farmDocsFontAssets = _optionalChain([config, 'access',
|
|
6953
|
-
const integrationProviders =
|
|
7022
|
+
const hasMiddlewareRuntime = middlewareRoutes.length > 0 || _chunk2MR4MABGcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
|
|
7023
|
+
const farmDocsFontAssets = _optionalChain([config, 'access', _171 => _171.docs, 'optionalAccess', _172 => _172.enabled]) ? _chunkERMUL73Lcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkERMUL73Lcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
|
|
7024
|
+
const integrationProviders = _chunkJX5VOLAVcjs.getIntegrationProviders.call(void 0, config.integrations);
|
|
6954
7025
|
const renderedIntegrationProviders = integrationProviders.filter(
|
|
6955
7026
|
(provider) => provider.component || provider.type === "clerk"
|
|
6956
7027
|
);
|
|
@@ -6959,16 +7030,16 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6959
7030
|
`Integration provider components are not supported by the "${config.renderer.name}" renderer.`
|
|
6960
7031
|
);
|
|
6961
7032
|
}
|
|
6962
|
-
const providerServerModules =
|
|
7033
|
+
const providerServerModules = _chunkKWST2O22cjs.generateFarmIntegrationProviderServerModules.call(void 0,
|
|
6963
7034
|
renderedIntegrationProviders,
|
|
6964
7035
|
config.root,
|
|
6965
7036
|
_nullishCoalesce(config.renderer.componentExtensions, () => ( []))
|
|
6966
7037
|
);
|
|
6967
7038
|
const resolvedIntegrationProviderFallback = Object.fromEntries(
|
|
6968
7039
|
Object.entries(config.integrations).flatMap(([name, integration]) => {
|
|
6969
|
-
const configuredProviders = _optionalChain([integration, 'optionalAccess',
|
|
7040
|
+
const configuredProviders = _optionalChain([integration, 'optionalAccess', _173 => _173.providers]);
|
|
6970
7041
|
const providers = Array.isArray(configuredProviders) ? configuredProviders : [];
|
|
6971
|
-
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess',
|
|
7042
|
+
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess', _174 => _174.component]) === "function")) {
|
|
6972
7043
|
throw new Error(
|
|
6973
7044
|
`Integration provider components in production must use an importable component reference, for example component: { module: "@/components/provider" }.`
|
|
6974
7045
|
);
|
|
@@ -6979,20 +7050,20 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6979
7050
|
const unsupportedIntegrationProvider = renderedIntegrationProviders.find(
|
|
6980
7051
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
6981
7052
|
);
|
|
6982
|
-
const isolatedHydrationMode =
|
|
6983
|
-
_optionalChain([config, 'access',
|
|
7053
|
+
const isolatedHydrationMode = _chunk2IFT2CSAcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
7054
|
+
_optionalChain([config, 'access', _175 => _175.experimental, 'optionalAccess', _176 => _176.isolatedClientHydration]),
|
|
6984
7055
|
{
|
|
6985
|
-
serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
7056
|
+
serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _177 => _177.experimental, 'optionalAccess', _178 => _178.serverComponents])) === "rsc",
|
|
6986
7057
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
6987
7058
|
}
|
|
6988
7059
|
);
|
|
6989
|
-
const hydrationPlanOptions =
|
|
7060
|
+
const hydrationPlanOptions = _chunk2IFT2CSAcjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
6990
7061
|
config.renderer,
|
|
6991
7062
|
Boolean(unsupportedIntegrationProvider)
|
|
6992
7063
|
);
|
|
6993
7064
|
const pageHydrationPlanOptions = {
|
|
6994
7065
|
...hydrationPlanOptions,
|
|
6995
|
-
serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
7066
|
+
serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _179 => _179.experimental, 'optionalAccess', _180 => _180.serverComponents])) === "islands"
|
|
6996
7067
|
};
|
|
6997
7068
|
const layoutHydrationPlans = layoutRoutes.map((layout) => ({
|
|
6998
7069
|
...layout,
|
|
@@ -7004,7 +7075,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
7004
7075
|
{ ...hydrationPlanOptions, serverTreeLayouts: pageHydrationPlanOptions.serverOwners }
|
|
7005
7076
|
)
|
|
7006
7077
|
}));
|
|
7007
|
-
const markdownPagePlan =
|
|
7078
|
+
const markdownPagePlan = _chunk2IFT2CSAcjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
7008
7079
|
_chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), config.root),
|
|
7009
7080
|
config.root,
|
|
7010
7081
|
isolatedHydrationMode,
|
|
@@ -7013,7 +7084,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
7013
7084
|
const pageHydrationPlans = new Map(
|
|
7014
7085
|
pageRoutes.map((route) => [
|
|
7015
7086
|
route.modulePath,
|
|
7016
|
-
|
|
7087
|
+
_chunkL6E4SHUBcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
|
|
7017
7088
|
route.modulePath,
|
|
7018
7089
|
config.root,
|
|
7019
7090
|
isolatedHydrationMode,
|
|
@@ -7022,7 +7093,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
7022
7093
|
)
|
|
7023
7094
|
])
|
|
7024
7095
|
);
|
|
7025
|
-
|
|
7096
|
+
_chunk2IFT2CSAcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
7026
7097
|
layoutHydrationPlans.map((layout) => ({
|
|
7027
7098
|
pattern: layout.pattern,
|
|
7028
7099
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -7031,10 +7102,10 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
7031
7102
|
pageRoutes.map((route) => ({
|
|
7032
7103
|
// Compared by directory so a grouped layout applies only inside its group.
|
|
7033
7104
|
pattern: _nullishCoalesce(route.directory, () => ( route.pattern)),
|
|
7034
|
-
depth:
|
|
7105
|
+
depth: _chunk2MR4MABGcjs.getRouteDirectoryDepth.call(void 0, _nullishCoalesce(route.directory, () => ( route.pattern))),
|
|
7035
7106
|
metadata: pageHydrationPlans.get(route.modulePath)
|
|
7036
7107
|
})),
|
|
7037
|
-
|
|
7108
|
+
_chunk2MR4MABGcjs.routeBoundaryCoversDirectory,
|
|
7038
7109
|
{ serverOwners: pageHydrationPlanOptions.serverOwners }
|
|
7039
7110
|
);
|
|
7040
7111
|
const providerServerImports = [
|
|
@@ -7052,7 +7123,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
7052
7123
|
apiRegistrations.push(`
|
|
7053
7124
|
{
|
|
7054
7125
|
path: ${JSON.stringify(route.path)},
|
|
7055
|
-
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access',
|
|
7126
|
+
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access', _181 => _181.pluginMethods, 'optionalAccess', _182 => _182.includes, 'call', _183 => _183(method)])))},
|
|
7056
7127
|
endpoints: ${varName},
|
|
7057
7128
|
}`);
|
|
7058
7129
|
});
|
|
@@ -7065,11 +7136,13 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
7065
7136
|
}).map(({ route }) => route);
|
|
7066
7137
|
orderedPageRoutes.forEach((route, index) => {
|
|
7067
7138
|
const varName = `pageRoute${index}`;
|
|
7068
|
-
if (
|
|
7139
|
+
if (_chunkL6E4SHUBcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) {
|
|
7140
|
+
const renderingDirective2 = _chunkCSQPMV3Qcjs.readRouteRenderingDirectiveFromFile.call(void 0, route.modulePath);
|
|
7069
7141
|
pageRegistrations.push(`
|
|
7070
7142
|
{
|
|
7071
7143
|
pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
|
|
7072
|
-
directory: ${JSON.stringify(route.directory)},` : ""}
|
|
7144
|
+
directory: ${JSON.stringify(route.directory)},` : ""}${renderingDirective2 ? `
|
|
7145
|
+
rendering: ${JSON.stringify(renderingDirective2)},` : ""}
|
|
7073
7146
|
module: createFarmMarkdownRouteModule({
|
|
7074
7147
|
source: ${JSON.stringify(_nullishCoalesce(route.source, () => ( "")))},
|
|
7075
7148
|
filePath: ${JSON.stringify(toBakedMarkdownSourcePath(config.root, route.modulePath))},
|
|
@@ -7089,7 +7162,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
7089
7162
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(route.modulePath)};`
|
|
7090
7163
|
);
|
|
7091
7164
|
const clientMetadata = pageHydrationPlans.get(route.modulePath);
|
|
7092
|
-
const renderingDirective =
|
|
7165
|
+
const renderingDirective = _chunkCSQPMV3Qcjs.readRouteRenderingDirectiveFromFile.call(void 0, route.modulePath);
|
|
7093
7166
|
pageRegistrations.push(`
|
|
7094
7167
|
{
|
|
7095
7168
|
pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
|
|
@@ -7097,8 +7170,8 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
7097
7170
|
module: ${varName},
|
|
7098
7171
|
shouldHydrate: ${JSON.stringify(clientMetadata.shouldHydrate)},${clientMetadata.shouldHydrate ? `
|
|
7099
7172
|
clientModule: ${JSON.stringify(_chunkQMNWKQL4cjs.toViteModuleId.call(void 0, route.modulePath, config.root))},` : ""}
|
|
7100
|
-
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${
|
|
7101
|
-
const rootStrategy =
|
|
7173
|
+
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${_chunk2IFT2CSAcjs.usesFarmServerTree.call(void 0, clientMetadata) ? "\n serverTree: true," : ""}${(() => {
|
|
7174
|
+
const rootStrategy = _chunkKWST2O22cjs.resolveFarmRouteRootStrategy.call(void 0,
|
|
7102
7175
|
route,
|
|
7103
7176
|
clientMetadata,
|
|
7104
7177
|
layoutHydrationPlans.map((layout) => ({ ...layout, ...layout.hydration })),
|
|
@@ -7117,7 +7190,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
7117
7190
|
});
|
|
7118
7191
|
const layoutImports = [];
|
|
7119
7192
|
const layoutRegistrations = [];
|
|
7120
|
-
const treeLayoutPatterns = farmIslandsMode ?
|
|
7193
|
+
const treeLayoutPatterns = farmIslandsMode ? _chunk2MR4MABGcjs.getFarmServerTreeLayoutPatterns.call(void 0,
|
|
7121
7194
|
layoutHydrationPlans.map((layout) => ({
|
|
7122
7195
|
pattern: layout.pattern,
|
|
7123
7196
|
shouldHydrate: layout.hydration.shouldHydrate,
|
|
@@ -7161,7 +7234,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
7161
7234
|
containerId: ${JSON.stringify(slot.containerId)},
|
|
7162
7235
|
interception: ${JSON.stringify(slot.interception)},
|
|
7163
7236
|
fallback: ${JSON.stringify(slot.fallback)},
|
|
7164
|
-
hydrates: ${!farmIslandsMode ||
|
|
7237
|
+
hydrates: ${!farmIslandsMode || _chunk2IFT2CSAcjs.getClientModuleMetadata.call(void 0, slot.modulePath, config.root).isClientComponent},
|
|
7165
7238
|
module: ${varName},
|
|
7166
7239
|
}`);
|
|
7167
7240
|
});
|
|
@@ -7172,12 +7245,12 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
7172
7245
|
errorImports.push(
|
|
7173
7246
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(errorRoute.modulePath)};`
|
|
7174
7247
|
);
|
|
7175
|
-
const groupScope =
|
|
7248
|
+
const groupScope = _chunk2MR4MABGcjs.getRouteGroupScope.call(void 0, errorRoute.pattern);
|
|
7176
7249
|
errorRegistrations.push(`
|
|
7177
7250
|
{
|
|
7178
|
-
pattern: ${JSON.stringify(
|
|
7251
|
+
pattern: ${JSON.stringify(_chunk2MR4MABGcjs.stripRouteGroups.call(void 0, errorRoute.pattern))},${groupScope ? `
|
|
7179
7252
|
groupScope: ${JSON.stringify(groupScope)},
|
|
7180
|
-
directoryDepth: ${
|
|
7253
|
+
directoryDepth: ${_chunk2MR4MABGcjs.getRouteDirectoryDepth.call(void 0, errorRoute.pattern)},` : ""}
|
|
7181
7254
|
module: ${varName},
|
|
7182
7255
|
}`);
|
|
7183
7256
|
});
|
|
@@ -7189,12 +7262,12 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
7189
7262
|
loadingImports.push(
|
|
7190
7263
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(loadingRoute.modulePath)};`
|
|
7191
7264
|
);
|
|
7192
|
-
const groupScope =
|
|
7265
|
+
const groupScope = _chunk2MR4MABGcjs.getRouteGroupScope.call(void 0, loadingRoute.pattern);
|
|
7193
7266
|
loadingRegistrations.push(`
|
|
7194
7267
|
{
|
|
7195
|
-
pattern: ${JSON.stringify(
|
|
7268
|
+
pattern: ${JSON.stringify(_chunk2MR4MABGcjs.stripRouteGroups.call(void 0, loadingRoute.pattern))},${groupScope ? `
|
|
7196
7269
|
groupScope: ${JSON.stringify(groupScope)},
|
|
7197
|
-
directoryDepth: ${
|
|
7270
|
+
directoryDepth: ${_chunk2MR4MABGcjs.getRouteDirectoryDepth.call(void 0, loadingRoute.pattern)},` : ""}
|
|
7198
7271
|
module: ${varName},
|
|
7199
7272
|
}`);
|
|
7200
7273
|
});
|
|
@@ -7308,6 +7381,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
7308
7381
|
createFarmProductionLifecycle,
|
|
7309
7382
|
createFarmNodeRequestAbortSignal,
|
|
7310
7383
|
createProductionMiddlewareRunner,
|
|
7384
|
+
_hasPrivateFarmRequestHeaders,
|
|
7311
7385
|
_withFarmGuardedResponseCache,
|
|
7312
7386
|
_farmPluginsKeepResponsesPrivate,
|
|
7313
7387
|
getTheme as getFarmTheme,
|
|
@@ -7321,6 +7395,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
7321
7395
|
localizeFarmHref,
|
|
7322
7396
|
manageFarmDocumentPreloads,
|
|
7323
7397
|
mergeRouteRenderingDirectiveConfig,
|
|
7398
|
+
resolveRouteSharedCacheControl,
|
|
7324
7399
|
manageFarmLinkHeaderPreloads,
|
|
7325
7400
|
mergeMetadata,
|
|
7326
7401
|
mergeModuleViewport,
|
|
@@ -7349,7 +7424,13 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
7349
7424
|
stripFarmLocaleFromPathname,
|
|
7350
7425
|
withFarmRouteContext,
|
|
7351
7426
|
createLateNotFoundRecovery,
|
|
7352
|
-
createLateRedirectRecovery
|
|
7427
|
+
createLateRedirectRecovery,
|
|
7428
|
+
_withFarmDeploymentCookie,
|
|
7429
|
+
_withFarmResponseHeaders,
|
|
7430
|
+
createFarmDeploymentMismatchResponse,
|
|
7431
|
+
FARM_DEPLOYMENT_ID_HEADER,
|
|
7432
|
+
getFarmDeploymentMismatch,
|
|
7433
|
+
withoutFarmDeploymentCookie,${config.mobileClient ? "\n createFarmNativeTreeResponse," : ""}${config.trailingSlash && (_optionalChain([config, 'access', _184 => _184.md, 'optionalAccess', _185 => _185.enabled]) || hasMarkdownPages) ? "\n toFarmTrailingSlashPageRequest," : ""}${hasInfraAnalyticsRuntime ? "\n resolveFarmDocsEngineRouteLabel,\n resolveFarmDocsRouteLabel,\n resolveFarmMarkdownRouteLabel,\n resolveFarmMCPRouteLabel,\n setFarmRouteLabel," : ""}${hasFarmServerStorageConfig(config.storage) ? "\n _registerFarmStorageModules,\n disposeFarmStorage,\n initFarmStorage," : ""}
|
|
7353
7434
|
} from "@farm.js/core/internal/production-runtime";${farmMobileClient ? `
|
|
7354
7435
|
import { _applyFarmMobileShellClient } from "@farm.js/core/internal/production-runtime";
|
|
7355
7436
|
// The mobile client documents load when a mobile shell asks for them (RFC 0004, 7.2), filled in
|
|
@@ -7418,25 +7499,25 @@ function farmFormStateScript() { return ""; }`}`;
|
|
|
7418
7499
|
const infraAnalyticsImport = hasInfraAnalyticsRuntime ? `import { ${hasPluginRuntime ? "createFarmInfraAnalyticsPlugin" : "createFarmInfraAnalyticsRecorder"} } from "@farm.js/core/internal/infra-analytics-runtime";` : "";
|
|
7419
7500
|
const compressionRuntimeImport = hasCompressionRuntime ? `import { compressFarmResponse${hasPluginRuntime ? ", createCompressionPlugin" : ""} } from "@farm.js/core/internal/compression-runtime";` : "";
|
|
7420
7501
|
const i18nServerImport = config.i18n.enabled ? `import { _runWithFarmI18nRequest, _setDefaultFarmI18nRuntime, createFarmI18nRuntime, getFarmI18nClientSnapshot } from "@farm.js/core/i18n/server";` : "";
|
|
7421
|
-
const docsHandlerImport = _optionalChain([config, 'access',
|
|
7502
|
+
const docsHandlerImport = _optionalChain([config, 'access', _186 => _186.docs, 'optionalAccess', _187 => _187.enabled]) ? hasPrecompiledDocs ? `import { createFarmDocsPrecompiledRuntime } from "@farm.js/core/internal/docs-precompiled-runtime";
|
|
7422
7503
|
const isFarmDocsAPIRequest = (requestOrPathname) => {
|
|
7423
7504
|
const pathname = typeof requestOrPathname === "string"
|
|
7424
7505
|
? requestOrPathname
|
|
7425
7506
|
: new URL(requestOrPathname.url).pathname;
|
|
7426
|
-
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess',
|
|
7507
|
+
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _188 => _188.apiPath]) || "/api/docs")};
|
|
7427
7508
|
return pathname === apiPath || pathname.startsWith(apiPath + "/");
|
|
7428
7509
|
};` : adapterOwnsDocsRuntime ? `import { ${docsConfigModulePath ? "getFarmDocsConfigModuleRoot, " : ""}isFarmDocsAPIRequest } from "@farm.js/core/docs";
|
|
7429
|
-
import { ${_optionalChain([config, 'access',
|
|
7510
|
+
import { ${_optionalChain([config, 'access', _189 => _189.docs, 'access', _190 => _190.roots, 'optionalAccess', _191 => _191.length]) ? "createFarmDocsMultiRuntimeHandler as createFarmDocsAdapterMultiRuntimeHandler" : "createFarmDocsRuntimeHandler as createFarmDocsAdapterRuntimeHandler"} } from ${JSON.stringify(config.docs.adapter.server)};
|
|
7430
7511
|
import * as FarmDocsAdapterReact from ${JSON.stringify(config.docs.adapter.react)};${docsConfigModulePath ? `
|
|
7431
7512
|
import * as farmDocsConfigModule from ${toVirtualEntryImportSpecifier(docsConfigModulePath)};` : ""}` : `import { createFarmDocsAPIHandler, createFarmDocsHandler, isFarmDocsAPIRequest } from "@farm.js/core/docs";` : "";
|
|
7432
|
-
const docsFontImport = _optionalChain([config, 'access',
|
|
7433
|
-
const docsRuntimeImport = _optionalChain([config, 'access',
|
|
7513
|
+
const docsFontImport = _optionalChain([config, 'access', _192 => _192.docs, 'optionalAccess', _193 => _193.enabled]) && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
|
|
7514
|
+
const docsRuntimeImport = _optionalChain([config, 'access', _194 => _194.docs, 'optionalAccess', _195 => _195.enabled]) && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
|
|
7434
7515
|
import { dirname as farmDocsDirname, join as farmDocsJoin } from "node:path";
|
|
7435
7516
|
import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
7436
|
-
const markdownHandlerImport = _optionalChain([config, 'access',
|
|
7517
|
+
const markdownHandlerImport = _optionalChain([config, 'access', _196 => _196.md, 'optionalAccess', _197 => _197.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
|
|
7437
7518
|
const appMarkdownImport = hasMarkdownPages ? `import { FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS, createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse, isFarmMarkdownPublicSourceResponse } from "@farm.js/core/internal/app-markdown-runtime";` : "const createFarmMarkdownSourceResponse = null;\nconst isFarmMarkdownPublicSourceResponse = null;";
|
|
7438
7519
|
const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, FARM_MARKDOWN_PAGE_CHECK_HEADER, _isFarmMarkdownPageCheck, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
|
|
7439
|
-
const mdxComponentsPath = typeof _optionalChain([config, 'access',
|
|
7520
|
+
const mdxComponentsPath = typeof _optionalChain([config, 'access', _198 => _198.mdx, 'optionalAccess', _199 => _199.components]) === "string" ? _path2.default.isAbsolute(config.mdx.components) ? config.mdx.components : _path2.default.join(config.root, config.mdx.components) : null;
|
|
7440
7521
|
const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
|
|
7441
7522
|
const layerConfigPaths = (config.layers || []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile)).filter((configFile) => configFile !== configModulePath);
|
|
7442
7523
|
const layerConfigImports = layerConfigPaths.map(
|
|
@@ -7456,14 +7537,14 @@ import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
|
7456
7537
|
const nativeAuth = generateNativeAuthIntegrationSource(config.auth);
|
|
7457
7538
|
const nativeMCP = _chunkVM57CK74cjs.generateNativeMCPPluginSource.call(void 0, config.mcp);
|
|
7458
7539
|
const mobileSession = (config.plugins || []).some(
|
|
7459
|
-
(plugin) => _optionalChain([plugin, 'optionalAccess',
|
|
7540
|
+
(plugin) => _optionalChain([plugin, 'optionalAccess', _200 => _200.name]) === _chunk4BS3HSY7cjs.FARM_MOBILE_SESSION_PLUGIN
|
|
7460
7541
|
);
|
|
7461
7542
|
const nativeServerFns = (config.plugins || []).some(
|
|
7462
|
-
(plugin) => _optionalChain([plugin, 'optionalAccess',
|
|
7463
|
-
) ?
|
|
7543
|
+
(plugin) => _optionalChain([plugin, 'optionalAccess', _201 => _201.name]) === _chunk4EBC7EMWcjs.FARM_NATIVE_SERVER_FN_PLUGIN
|
|
7544
|
+
) ? _chunkZPUAOKHVcjs.collectFarmNativeServerFns.call(void 0, {
|
|
7464
7545
|
root: config.root,
|
|
7465
7546
|
srcDir: config.srcDir,
|
|
7466
|
-
entries:
|
|
7547
|
+
entries: _chunkZPUAOKHVcjs.findFarmNativeScreenFiles.call(void 0, _chunkMTBDJ326cjs.getFarmAppDirectories.call(void 0, config))
|
|
7467
7548
|
}) : void 0;
|
|
7468
7549
|
const integrationImports = `
|
|
7469
7550
|
${configModulePath ? `import * as FarmUserConfigModule from ${toVirtualEntryImportSpecifier(configModulePath)};` : ""}
|
|
@@ -7478,7 +7559,7 @@ ${nativeServerFns ? `const __farmNativeServerFnRegistry = Object.assign(Object.c
|
|
|
7478
7559
|
${nativeServerFns.flatMap((module, index) => module.exports.map((entry) => ` ${JSON.stringify(entry.id)}: __farmNativeServerFns${index}[${JSON.stringify(entry.name)}],`)).join("\n")}
|
|
7479
7560
|
});` : ""}
|
|
7480
7561
|
`;
|
|
7481
|
-
const imageRuntime =
|
|
7562
|
+
const imageRuntime = _chunkKWST2O22cjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
|
|
7482
7563
|
const imageRuntimeImport = imageRuntime === "none" ? "" : `import { _withFarmImageSourceClientAddress, createCloudflareImageTransformer, createFarmImageHandler } from "@farm.js/core/image/server";`;
|
|
7483
7564
|
const imageNodeRuntimeImport = imageRuntime === "node" ? `import { createNodeImageFetcher, createNodeImageUrlValidator, createSharpImageTransformer } from "@farm.js/core/image/sharp";` : "";
|
|
7484
7565
|
const apiHandlerCode = apiRoutes.length > 0 ? `
|
|
@@ -7615,7 +7696,7 @@ ${routeClientGraphServerRuntime}
|
|
|
7615
7696
|
const farmRendererStreamingCapabilities = ${JSON.stringify(rendererStreamingCapabilities)};
|
|
7616
7697
|
const farmRendererName = ${JSON.stringify(config.renderer.name)};
|
|
7617
7698
|
const farmReactSyncRender = ${JSON.stringify(hasReactSyncRender)};
|
|
7618
|
-
const farmRendererRuntime = ${JSON.stringify(
|
|
7699
|
+
const farmRendererRuntime = ${JSON.stringify(_chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset))};
|
|
7619
7700
|
const farmRendererRuntimeStreamingCapabilities = ReactDOMServer.capabilities &&
|
|
7620
7701
|
ReactDOMServer.capabilities.streaming;
|
|
7621
7702
|
if (farmRendererRuntimeStreamingCapabilities &&
|
|
@@ -7660,7 +7741,7 @@ const farmResolvedRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs);
|
|
|
7660
7741
|
|
|
7661
7742
|
function FarmDefault404Page() {
|
|
7662
7743
|
return React.createElement(React.Fragment, null,
|
|
7663
|
-
React.createElement("style", null, ${JSON.stringify(
|
|
7744
|
+
React.createElement("style", null, ${JSON.stringify(_chunkKWST2O22cjs.DEFAULT_NOT_FOUND_STYLES)}),
|
|
7664
7745
|
React.createElement("main", {
|
|
7665
7746
|
className: "farm-default-not-found",
|
|
7666
7747
|
"aria-labelledby": "farm-default-not-found-title",
|
|
@@ -7797,20 +7878,24 @@ const farmImageHandler = ${imageRuntime === "none" ? "null" : imageRuntime === "
|
|
|
7797
7878
|
validateRemoteUrl: createNodeImageUrlValidator(${JSON.stringify(config.images)}),
|
|
7798
7879
|
onError(error) { console.error("[Farm Image]", error); },
|
|
7799
7880
|
})`};
|
|
7800
|
-
const farmMarkdownConfig = ${JSON.stringify(config.md)}
|
|
7801
|
-
|
|
7802
|
-
|
|
7881
|
+
const farmMarkdownConfig = ${JSON.stringify(config.md)};${_optionalChain([config, 'access', _202 => _202.md, 'optionalAccess', _203 => _203.enabled]) || hasMarkdownPages ? config.trailingSlash ? `
|
|
7882
|
+
// A Markdown mirror, and a page.md source's page check, read the page at the URL it answers at
|
|
7883
|
+
// ('/about/'), so the trailing-slash 308 never answers in its place.
|
|
7884
|
+
const toFarmMarkdownPageRequest = (request) => toFarmTrailingSlashPageRequest(request, true);` : `
|
|
7885
|
+
const toFarmMarkdownPageRequest = (request) => request;` : ""}
|
|
7886
|
+
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _204 => _204.agent, 'optionalAccess', _205 => _205.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
|
|
7887
|
+
${_optionalChain([config, 'access', _206 => _206.agent, 'optionalAccess', _207 => _207.llmsTxt, 'optionalAccess', _208 => _208.enabled]) ? "const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });\n" : ""}${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
|
|
7803
7888
|
const farmMdxConfig = ${JSON.stringify({
|
|
7804
7889
|
...config.mdx,
|
|
7805
|
-
components: typeof _optionalChain([config, 'access',
|
|
7890
|
+
components: typeof _optionalChain([config, 'access', _209 => _209.mdx, 'optionalAccess', _210 => _210.components]) === "string" ? config.mdx.components : void 0
|
|
7806
7891
|
})};
|
|
7807
7892
|
const configuredFarmMdxComponents = farmUserConfig?.mdx?.components;
|
|
7808
|
-
${_optionalChain([config, 'access',
|
|
7893
|
+
${_optionalChain([config, 'access', _211 => _211.agent, 'optionalAccess', _212 => _212.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
|
|
7809
7894
|
// environment this was built in, since Netlify exposes its deploy context only
|
|
7810
7895
|
// to the build.
|
|
7811
7896
|
const farmNoindexPreview = resolveFarmPreviewDeployment(
|
|
7812
7897
|
globalThis.process?.env,
|
|
7813
|
-
${JSON.stringify(
|
|
7898
|
+
${JSON.stringify(_chunkDPYBVVL3cjs.isFarmPreviewDeploymentEnvironment.call(void 0, process.env))},
|
|
7814
7899
|
);` : ""}
|
|
7815
7900
|
const farmMdxComponents = ${mdxComponentsPath ? `(FarmMdxComponentsModule.components || Reflect.get(FarmMdxComponentsModule, "default") || {})` : `(configuredFarmMdxComponents && typeof configuredFarmMdxComponents === "object" ? configuredFarmMdxComponents : {})`};
|
|
7816
7901
|
const farmObservabilityConfig = farmUserConfig?.observability ?? ${JSON.stringify(
|
|
@@ -7856,7 +7941,7 @@ export const farmProductionLifecycle = createFarmProductionLifecycle({
|
|
|
7856
7941
|
});
|
|
7857
7942
|
const farmI18nRuntime = ${config.i18n.enabled ? `createFarmI18nRuntime(farmI18nConfig, ${JSON.stringify(i18nCatalogs)})` : "null"};
|
|
7858
7943
|
${config.i18n.enabled ? "_setDefaultFarmI18nRuntime(farmI18nRuntime);" : ""}
|
|
7859
|
-
const farmDocsBundledContentDir = ${_optionalChain([config, 'access',
|
|
7944
|
+
const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _213 => _213.docs, 'optionalAccess', _214 => _214.enabled]) && !hasPrecompiledDocs ? `(() => {
|
|
7860
7945
|
try {
|
|
7861
7946
|
const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
|
|
7862
7947
|
const candidates = [
|
|
@@ -7868,7 +7953,7 @@ const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _208 => _2
|
|
|
7868
7953
|
} catch {
|
|
7869
7954
|
return null;
|
|
7870
7955
|
}
|
|
7871
|
-
})()` : "null"};${_optionalChain([config, 'access',
|
|
7956
|
+
})()` : "null"};${_optionalChain([config, 'access', _215 => _215.docs, 'optionalAccess', _216 => _216.enabled]) && !hasPrecompiledDocs && _optionalChain([config, 'access', _217 => _217.docs, 'access', _218 => _218.roots, 'optionalAccess', _219 => _219.length]) ? `
|
|
7872
7957
|
const farmDocsBundledRootsDir = (() => {
|
|
7873
7958
|
try {
|
|
7874
7959
|
const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
|
|
@@ -7920,7 +8005,7 @@ const farmDocsModulePreloadPaths = farmDocsModulePreloads
|
|
|
7920
8005
|
),
|
|
7921
8006
|
}
|
|
7922
8007
|
: undefined;
|
|
7923
|
-
const farmDocsHandler = ${_optionalChain([config, 'access',
|
|
8008
|
+
const farmDocsHandler = ${_optionalChain([config, 'access', _220 => _220.docs, 'optionalAccess', _221 => _221.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `${adapterHandler.factory}(${adapterHandler.config}, {
|
|
7924
8009
|
rootDir: farmDocsRuntimeRoot,
|
|
7925
8010
|
// A production build's content cannot change, so the adapter reads its
|
|
7926
8011
|
// navigation once instead of scanning the content directory per request.
|
|
@@ -7941,7 +8026,7 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _215 => _215.docs, '
|
|
|
7941
8026
|
registerMCPServer: registerFarmMCPServer,
|
|
7942
8027
|
// A page built with this keeps its HTML string, so the preload budget and the response
|
|
7943
8028
|
// writer use it instead of reading and re-encoding the body. Older adapters ignore it.
|
|
7944
|
-
createHtmlResponse: farmOwnedHtmlResponse,${
|
|
8029
|
+
createHtmlResponse: farmOwnedHtmlResponse,${_chunkUISZLYKYcjs.farmDocsAdapterServesGuardedPages.call(void 0, config.docs) ? `
|
|
7945
8030
|
// The adapter keeps pages a path guard covers off search, llms.txt, the sitemap and MCP. It
|
|
7946
8031
|
// asks about any path its own content lists, so the guards decide here, not a page list.
|
|
7947
8032
|
isPathGuarded: (pathname) =>
|
|
@@ -7967,11 +8052,11 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _215 => _215.docs, '
|
|
|
7967
8052
|
isPathGuarded: isFarmDocsPathGuarded,
|
|
7968
8053
|
basePath: ${JSON.stringify(config.basePath)},
|
|
7969
8054
|
})` : "null"};
|
|
7970
|
-
const farmDocsAPIHandler = ${_optionalChain([config, 'access',
|
|
8055
|
+
const farmDocsAPIHandler = ${_optionalChain([config, 'access', _222 => _222.docs, 'optionalAccess', _223 => _223.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig, isPathGuarded: isFarmDocsPathGuarded, basePath: ${JSON.stringify(config.basePath)} })` : "null"};
|
|
7971
8056
|
|
|
7972
8057
|
// API routes bundled at build time
|
|
7973
8058
|
const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
|
|
7974
|
-
]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path:
|
|
8059
|
+
]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path: path15, methods }) => ({ path: path15, methods })))}, { bodySizeLimit: ${JSON.stringify(config.server.bodySizeLimit)}, dispatch: dispatchFarmPluginAPIRequest })` : ""};
|
|
7975
8060
|
// A plugin calling an app endpoint (an MCP tool, say) goes through the whole
|
|
7976
8061
|
// pipeline, so the endpoint's middleware and integration guards run for it.
|
|
7977
8062
|
function dispatchFarmPluginAPIRequest(request) {
|
|
@@ -7991,16 +8076,20 @@ function fetchFarmInnerRequest(request, context) {
|
|
|
7991
8076
|
return fetch(new Request(request, { headers }), context);
|
|
7992
8077
|
}
|
|
7993
8078
|
const farmLocalAPIBasePath = ${JSON.stringify(_chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, config.api))};
|
|
8079
|
+
// Deployment skew protection (see the deployment docs): documents embed this ID, page responses
|
|
8080
|
+
// name it, and a page request from a browser holding another deployment's page is refused.
|
|
8081
|
+
const farmDeploymentId = ${JSON.stringify(config.deploymentId)};
|
|
8082
|
+
const farmDeploymentCookiePath = ${JSON.stringify(config.basePath || "/")};
|
|
7994
8083
|
// Reports a failure Farm answers itself (an API or integration route's 500) to the plugin
|
|
7995
8084
|
// runtime request.
|
|
7996
8085
|
const farmRuntimeErrorSlot = Symbol("farm.runtime.error.slot");
|
|
7997
8086
|
const farmOpenAPIReference = ${JSON.stringify(openAPIReference)};
|
|
7998
|
-
${_optionalChain([config, 'access',
|
|
7999
|
-
` : ""}${_optionalChain([config, 'access',
|
|
8000
|
-
|
|
8087
|
+
${_optionalChain([config, 'access', _224 => _224.agent, 'optionalAccess', _225 => _225.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunkSXMWVP2Lcjs.resolveFarmApiCatalogInput.call(void 0, config))};
|
|
8088
|
+
` : ""}${_optionalChain([config, 'access', _226 => _226.agent, 'optionalAccess', _227 => _227.manifest]) !== false ? `const farmAppManifestInput = ${JSON.stringify(
|
|
8089
|
+
_chunkSXMWVP2Lcjs.resolveFarmAppManifestInput.call(void 0, config, {
|
|
8001
8090
|
build: config.deploymentId,
|
|
8002
|
-
packages:
|
|
8003
|
-
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ?
|
|
8091
|
+
packages: _chunkKWST2O22cjs.resolveFarmAppPackages.call(void 0, config.root),
|
|
8092
|
+
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? _chunkKWST2O22cjs.collectFarmWebMCPTools.call(void 0, config.root, config.srcDir) : []
|
|
8004
8093
|
})
|
|
8005
8094
|
)};
|
|
8006
8095
|
${servesDefaultMCP ? "farmAppManifestInput.defaultMCP = getFarmDefaultMCPServer;\n" : ""}// A guard written for an MCP server's path keeps its tools out of the public view.
|
|
@@ -8104,7 +8193,8 @@ function renderFarmClientBootstrapScript(canonicalPath, selectedRouteSlots, page
|
|
|
8104
8193
|
let source = 'window.__FARM_PROPS__=' + serializedPageProps +
|
|
8105
8194
|
';window.__FARM_INTEGRATION_API_MANIFEST__=' +
|
|
8106
8195
|
serializeFarmInlineValue(integrationManifest) +
|
|
8107
|
-
';window.__FARM_ROUTE_SLOTS__=' + serializedRouteSlots +
|
|
8196
|
+
';window.__FARM_ROUTE_SLOTS__=' + serializedRouteSlots +
|
|
8197
|
+
';window.__FARM_DEPLOYMENT_ID__=' + serializeFarmInlineValue(farmDeploymentId) + ';';
|
|
8108
8198
|
if (typeof canonicalPath === "string" && canonicalPath.startsWith("/")) {
|
|
8109
8199
|
const serializedPath = serializeFarmInlineValue(canonicalPath);
|
|
8110
8200
|
source += 'if(location.pathname+location.search!==' + serializedPath + '){' +
|
|
@@ -8666,7 +8756,7 @@ function peelFarmDocumentPrefix(markup) {
|
|
|
8666
8756
|
let inner = markup.replace(/^\\s+/, "");
|
|
8667
8757
|
let hoisted = "";
|
|
8668
8758
|
const wrapper = /^<div\\b[^>]*style=["']display\\s*:\\s*contents;?\\s*["'][^>]*>/i;
|
|
8669
|
-
const hoistable = /${
|
|
8759
|
+
const hoistable = /${_chunk2MR4MABGcjs.HOISTED_HEAD_ELEMENT.source}/i;
|
|
8670
8760
|
let match;
|
|
8671
8761
|
while ((match = wrapper.exec(inner) || hoistable.exec(inner))) {
|
|
8672
8762
|
if (!/^<div/i.test(match[0])) hoisted += match[0];
|
|
@@ -8805,8 +8895,9 @@ const farmClientEntryPreloadTags = farmClientModulePreloads
|
|
|
8805
8895
|
? farmClientModulePreloads.entry.map(renderFarmClientModulePreload).join("")
|
|
8806
8896
|
: "";
|
|
8807
8897
|
// The client modules a document's markup loads: its islands' boundaries and the
|
|
8808
|
-
// client references of its server tree.
|
|
8809
|
-
|
|
8898
|
+
// client references of its server tree. An island with a deferred strategy loads its
|
|
8899
|
+
// module on its own trigger, so it is not preloaded.
|
|
8900
|
+
const FARM_CLIENT_MODULE_REFERENCE_PATTERN = /<f-island src="([^"]+)"([^>]*)>|"r":"(\\/[^"]+)"/g;
|
|
8810
8901
|
|
|
8811
8902
|
function renderFarmClientModulePreload(index) {
|
|
8812
8903
|
return '\\n <link rel="modulepreload" href="/' +
|
|
@@ -8834,7 +8925,10 @@ function renderFarmClientModulePreloads(markup, pageModule) {
|
|
|
8834
8925
|
};
|
|
8835
8926
|
add(pageModule);
|
|
8836
8927
|
if (typeof markup === "string") {
|
|
8837
|
-
for (const match of markup.matchAll(FARM_CLIENT_MODULE_REFERENCE_PATTERN))
|
|
8928
|
+
for (const match of markup.matchAll(FARM_CLIENT_MODULE_REFERENCE_PATTERN)) {
|
|
8929
|
+
if (match[1] && FARM_DEFERRED_ISLAND_STRATEGY.test(match[2])) continue;
|
|
8930
|
+
add(match[1] || match[3]);
|
|
8931
|
+
}
|
|
8838
8932
|
}
|
|
8839
8933
|
return tags;
|
|
8840
8934
|
}
|
|
@@ -8906,38 +9000,14 @@ function applyFarmI18nResponse(response, resolution) {
|
|
|
8906
9000
|
});
|
|
8907
9001
|
}
|
|
8908
9002
|
|
|
8909
|
-
|
|
8910
|
-
|
|
8911
|
-
const parts = cookieHeader.split(";");
|
|
8912
|
-
if (parts.length !== 1) return false;
|
|
8913
|
-
|
|
8914
|
-
const cookie = parts[0].trim();
|
|
8915
|
-
const separator = cookie.indexOf("=");
|
|
8916
|
-
if (separator <= 0) return false;
|
|
8917
|
-
|
|
8918
|
-
let name;
|
|
8919
|
-
let value;
|
|
8920
|
-
try {
|
|
8921
|
-
name = decodeURIComponent(cookie.slice(0, separator).trim());
|
|
8922
|
-
value = decodeURIComponent(cookie.slice(separator + 1).trim());
|
|
8923
|
-
} catch {
|
|
8924
|
-
return false;
|
|
8925
|
-
}
|
|
8926
|
-
|
|
8927
|
-
return (
|
|
8928
|
-
name === farmI18nConfig.cookie.name &&
|
|
8929
|
-
farmI18nConfig.locales.includes(value)
|
|
8930
|
-
);
|
|
8931
|
-
}
|
|
8932
|
-
|
|
9003
|
+
// Credentials or a visitor's cookie; the deployment cookie, and a lone valid locale cookie when
|
|
9004
|
+
// the URL names the locale, keep shared caching. The RSC server decides with the same helper.
|
|
8933
9005
|
function hasPrivateFarmRequestHeaders(request, farmLocaleResolution) {
|
|
8934
|
-
|
|
8935
|
-
|
|
8936
|
-
|
|
8937
|
-
|
|
8938
|
-
|
|
8939
|
-
farmLocaleResolution?.source === "url" &&
|
|
8940
|
-
hasOnlyValidFarmLocaleCookie(cookieHeader)
|
|
9006
|
+
return _hasPrivateFarmRequestHeaders(
|
|
9007
|
+
request,
|
|
9008
|
+
farmI18nRuntime && farmLocaleResolution?.source === "url"
|
|
9009
|
+
? { name: farmI18nConfig.cookie.name, locales: farmI18nConfig.locales }
|
|
9010
|
+
: undefined,
|
|
8941
9011
|
);
|
|
8942
9012
|
}
|
|
8943
9013
|
|
|
@@ -9195,7 +9265,7 @@ function createFarmAgentRobotsResponse(request) {
|
|
|
9195
9265
|
// its nearest layout's.
|
|
9196
9266
|
const farmAgentGuardedPages = new Set(${JSON.stringify(
|
|
9197
9267
|
pageRoutes.map((route) => route.pattern).filter(
|
|
9198
|
-
(pattern) => !pattern.includes("[") &&
|
|
9268
|
+
(pattern) => !pattern.includes("[") && _chunk2MR4MABGcjs.farmPathGuardCoversPage.call(void 0,
|
|
9199
9269
|
{
|
|
9200
9270
|
config: { middleware: config.middleware, integrations: config.integrations },
|
|
9201
9271
|
middlewareRoutes
|
|
@@ -9238,7 +9308,7 @@ function createFarmAgentSitemapResponse(request) {
|
|
|
9238
9308
|
metadataBase: rootLayout && rootLayout.module && rootLayout.module.metadata
|
|
9239
9309
|
? rootLayout.module.metadata.metadataBase
|
|
9240
9310
|
: undefined,
|
|
9241
|
-
basePath: ${JSON.stringify(config.basePath)},
|
|
9311
|
+
basePath: ${JSON.stringify(config.basePath)},${config.trailingSlash ? "\n trailingSlash: true," : ""}${config.i18n.enabled ? "\n i18n: farmI18nConfig," : ""}
|
|
9242
9312
|
},
|
|
9243
9313
|
),
|
|
9244
9314
|
{},
|
|
@@ -9250,48 +9320,56 @@ ${servesDefaultMCP ? `// agent.mcp: the default read-only MCP server at /mcp, as
|
|
|
9250
9320
|
// aside for a page route that answers /mcp and for any MCP server published or
|
|
9251
9321
|
// registered at runtime, such as the docs engine's.
|
|
9252
9322
|
const farmDefaultMCPServer = ${JSON.stringify(
|
|
9253
|
-
|
|
9323
|
+
_chunkTP4RAV7Ycjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root), _chunkMEJCP2LXcjs.FARM_VERSION)
|
|
9254
9324
|
)};
|
|
9255
9325
|
let farmDefaultMCPRouteFree;
|
|
9256
9326
|
function getFarmDefaultMCPServer() {
|
|
9257
9327
|
if (farmDefaultMCPRouteFree === undefined) {
|
|
9258
|
-
farmDefaultMCPRouteFree = !matchPageRoute(${JSON.stringify(
|
|
9328
|
+
farmDefaultMCPRouteFree = !matchPageRoute(${JSON.stringify(_chunkTP4RAV7Ycjs.FARM_DEFAULT_MCP_PATH)});
|
|
9259
9329
|
}
|
|
9260
9330
|
return farmDefaultMCPRouteFree ? resolveFarmDefaultMCPServer(farmDefaultMCPServer) : undefined;
|
|
9261
9331
|
}
|
|
9262
9332
|
async function handleFarmDefaultMCP(request) {
|
|
9263
9333
|
const origin = new URL(request.url).origin;
|
|
9334
|
+
// Pages are linked on metadataBase, as sitemap.xml and llms.txt link them.
|
|
9335
|
+
const metadataBase = getFarmRootMetadataBase();
|
|
9264
9336
|
return handleFarmDefaultMCPRequest(request, {
|
|
9265
9337
|
server: getFarmDefaultMCPServer(),
|
|
9266
9338
|
basePath: ${JSON.stringify(config.basePath)},
|
|
9339
|
+
i18n: farmI18nConfig,
|
|
9340
|
+
metadataBase,
|
|
9341
|
+
// Each page at the URL it answers at, as in development and as the sitemap lists it.
|
|
9267
9342
|
listPages: () =>
|
|
9268
9343
|
collectFarmDefaultMCPPages(
|
|
9269
9344
|
getFarmAgentListedPageRoutes().map((route) => ({ pattern: route.pattern, module: route.module })),
|
|
9270
|
-
{
|
|
9345
|
+
{
|
|
9346
|
+
origin,
|
|
9347
|
+
metadataBase,
|
|
9348
|
+
basePath: ${JSON.stringify(config.basePath)},
|
|
9349
|
+
markdown: farmMarkdownConfig,${config.trailingSlash ? "\n trailingSlash: true," : ""}
|
|
9350
|
+
i18n: farmI18nConfig,
|
|
9351
|
+
},
|
|
9271
9352
|
),
|
|
9272
|
-
// A fresh request through this handler, so the caller's cookies never shape a page.
|
|
9273
|
-
//
|
|
9274
|
-
|
|
9275
|
-
|
|
9276
|
-
page.pathname = stripFarmBasePath(page.pathname);
|
|
9277
|
-
return farmDefaultMCPReadMarkdown(page.href);
|
|
9278
|
-
},
|
|
9353
|
+
// A fresh request through this handler, so the caller's cookies never shape a page. It
|
|
9354
|
+
// reads the public URL, base path included, as llms-full.txt does: this handler sees
|
|
9355
|
+
// public paths, and with i18n a mirror path without the base path answers with a redirect.
|
|
9356
|
+
readMarkdown: farmDefaultMCPReadMarkdown,
|
|
9279
9357
|
});
|
|
9280
9358
|
}
|
|
9281
9359
|
// \`fetch\` is this module's outer request entry: plugin runtime hooks run and the page
|
|
9282
9360
|
// gets its own request context, as for a direct request.
|
|
9283
9361
|
const farmDefaultMCPReadMarkdown = createFarmLlmsMarkdownReader((page) => fetch(page));
|
|
9284
9362
|
` : ""}
|
|
9285
|
-
// The origin llms.txt
|
|
9286
|
-
// request's origin, as for the sitemap and in development.
|
|
9363
|
+
// The origin llms.txt, llms-full.txt and list_pages link to: the root layout's metadataBase,
|
|
9364
|
+
// else the request's origin, as for the sitemap and in development.
|
|
9287
9365
|
function getFarmAgentOrigin(request) {
|
|
9366
|
+
return resolveFarmAgentOrigin(getFarmRootMetadataBase(), new URL(request.url).origin);
|
|
9367
|
+
}
|
|
9368
|
+
function getFarmRootMetadataBase() {
|
|
9288
9369
|
const rootLayout = layoutRoutes.find((layout) => layout.pattern === "/");
|
|
9289
|
-
return
|
|
9290
|
-
|
|
9291
|
-
|
|
9292
|
-
: undefined,
|
|
9293
|
-
new URL(request.url).origin,
|
|
9294
|
-
);
|
|
9370
|
+
return rootLayout && rootLayout.module && rootLayout.module.metadata
|
|
9371
|
+
? rootLayout.module.metadata.metadataBase
|
|
9372
|
+
: undefined;
|
|
9295
9373
|
}
|
|
9296
9374
|
|
|
9297
9375
|
// Static pages and root metadata for llms.txt, built the same way as in development.
|
|
@@ -9303,7 +9381,7 @@ function createFarmLlmsTxtContext(request, full) {
|
|
|
9303
9381
|
origin,
|
|
9304
9382
|
markdown: farmMarkdownConfig,
|
|
9305
9383
|
include: farmLlmsTxtConfig.include,
|
|
9306
|
-
exclude: farmLlmsTxtConfig.exclude,
|
|
9384
|
+
exclude: farmLlmsTxtConfig.exclude,${config.trailingSlash ? "\n trailingSlash: true," : ""}${config.i18n.enabled ? "\n i18n: farmI18nConfig," : ""}
|
|
9307
9385
|
},
|
|
9308
9386
|
);
|
|
9309
9387
|
const rootLayout = layoutRoutes.find((layout) => layout.pattern === "/");
|
|
@@ -9436,7 +9514,7 @@ ${edgeMiddlewareFilePaths.length > 0 ? `
|
|
|
9436
9514
|
// middleware guards is never prerendered. Read once: Nitro's prerender worker sets the variable.
|
|
9437
9515
|
const farmEdgeMiddlewareFiles = new Set(${JSON.stringify(edgeMiddlewareFilePaths)});
|
|
9438
9516
|
const farmPrerendering =
|
|
9439
|
-
typeof process !== "undefined" && process.env?.${
|
|
9517
|
+
typeof process !== "undefined" && process.env?.${_chunk3BQ7QHUHcjs.FARM_PRERENDER_ENV} === "1";
|
|
9440
9518
|
` : ""}
|
|
9441
9519
|
const farmMiddlewareRunner = ${hasMiddlewareRuntime ? `createProductionMiddlewareRunner({
|
|
9442
9520
|
config: farmMiddlewareConfig,
|
|
@@ -9580,7 +9658,7 @@ function hasLocalRequestRoute(request, routePathname) {
|
|
|
9580
9658
|
if (${imageRuntime === "none" ? "false" : `pathname === ${JSON.stringify(config.images.path)}`}) {
|
|
9581
9659
|
return true;
|
|
9582
9660
|
}
|
|
9583
|
-
${_optionalChain([config, 'access',
|
|
9661
|
+
${_optionalChain([config, 'access', _228 => _228.docs, 'optionalAccess', _229 => _229.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
|
|
9584
9662
|
// The docs answer below the basePath; their API stays at /api/docs, as API routes do.
|
|
9585
9663
|
const docsRoutePathname = stripFarmBasePath(pathname);
|
|
9586
9664
|
if (
|
|
@@ -9608,7 +9686,7 @@ function getFarmPluginRequestOptions(request) {
|
|
|
9608
9686
|
route: { ...route, pattern: normalizeRuntimePath(farmOpenAPIReference.route) },
|
|
9609
9687
|
};
|
|
9610
9688
|
}
|
|
9611
|
-
const isDocsAPIRequest = ${_optionalChain([config, 'access',
|
|
9689
|
+
const isDocsAPIRequest = ${_optionalChain([config, 'access', _230 => _230.docs, 'optionalAccess', _231 => _231.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
|
|
9612
9690
|
const integrationMatch = ${hasServerRuntimeIntegrations ? `matchIntegrationRoute(serverRuntimeIntegrations, {
|
|
9613
9691
|
pathname,
|
|
9614
9692
|
method: request.method,
|
|
@@ -9692,7 +9770,7 @@ ${hasInfraAnalyticsRuntime ? `
|
|
|
9692
9770
|
// endpoints, Markdown mirrors, and docs pages have no app route pattern, so they are
|
|
9693
9771
|
// labeled here; route.pattern keeps meaning the matched app route for plugins.
|
|
9694
9772
|
const farmBuiltInRoutePaths = new Set(${JSON.stringify(
|
|
9695
|
-
|
|
9773
|
+
_chunkSXMWVP2Lcjs.listFarmBuiltInRoutePaths.call(void 0, {
|
|
9696
9774
|
agent: {
|
|
9697
9775
|
...config.agent,
|
|
9698
9776
|
aiCatalog: servesAiCatalog,
|
|
@@ -9703,9 +9781,9 @@ const farmBuiltInRoutePaths = new Set(${JSON.stringify(
|
|
|
9703
9781
|
openapi: openAPIReference
|
|
9704
9782
|
})
|
|
9705
9783
|
)});
|
|
9706
|
-
${_optionalChain([config, 'access',
|
|
9784
|
+
${_optionalChain([config, 'access', _232 => _232.docs, 'optionalAccess', _233 => _233.enabled]) ? `const farmDocsRouteLabelInput = {
|
|
9707
9785
|
path: normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs"),
|
|
9708
|
-
apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess',
|
|
9786
|
+
apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _234 => _234.apiPath]) || "/api/docs")},${_optionalChain([config, 'access', _235 => _235.docs, 'access', _236 => _236.roots, 'optionalAccess', _237 => _237.length]) ? "\n roots: farmDocsResolvedConfig.roots.map((farmDocsRoot) => farmDocsRoot.entry)," : ""}${farmDocsAnalyticsPages.length ? `
|
|
9709
9787
|
pages: new Set(${JSON.stringify(farmDocsAnalyticsPages)}),` : ""}
|
|
9710
9788
|
};
|
|
9711
9789
|
` : ""}// The request's route payload, for a handler that learns what answered while it handles.
|
|
@@ -9721,11 +9799,11 @@ function labelFarmRequestOptions(options) {
|
|
|
9721
9799
|
setFarmRouteLabel(options.route, mcpLabel);
|
|
9722
9800
|
return options;
|
|
9723
9801
|
}
|
|
9724
|
-
${_optionalChain([config, 'access',
|
|
9802
|
+
${_optionalChain([config, 'access', _238 => _238.docs, 'optionalAccess', _239 => _239.enabled]) ? `if (options.kind === "docs") {
|
|
9725
9803
|
setFarmRouteLabel(options.route, resolveFarmDocsRouteLabel(routePathname, farmDocsRouteLabelInput));
|
|
9726
9804
|
return options;
|
|
9727
9805
|
}` : ""}
|
|
9728
|
-
${_optionalChain([config, 'access',
|
|
9806
|
+
${_optionalChain([config, 'access', _240 => _240.md, 'optionalAccess', _241 => _241.enabled]) || hasMarkdownPages ? `const markdownLabel = resolveFarmMarkdownRouteLabel(
|
|
9729
9807
|
routePathname,
|
|
9730
9808
|
(page) => matchPageRoute(page)?.route.pattern,
|
|
9731
9809
|
);
|
|
@@ -9760,7 +9838,7 @@ function getApplicableLayouts(pathname, directory) {
|
|
|
9760
9838
|
return applicable;
|
|
9761
9839
|
}
|
|
9762
9840
|
|
|
9763
|
-
${_optionalChain([config, 'access',
|
|
9841
|
+
${_optionalChain([config, 'access', _242 => _242.docs, 'optionalAccess', _243 => _243.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
|
|
9764
9842
|
if (request.method === "HEAD") return response;
|
|
9765
9843
|
if (response.headers.get("x-farm-docs-adapter")) return response;
|
|
9766
9844
|
|
|
@@ -9868,7 +9946,7 @@ ${_optionalChain([config, 'access', _237 => _237.docs, 'optionalAccess', _238 =>
|
|
|
9868
9946
|
|
|
9869
9947
|
// Shells keep their own LRU so query-string variants never evict app cache entries.
|
|
9870
9948
|
const pprShellCache = getFarmDataCache().pprShellCache;
|
|
9871
|
-
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access',
|
|
9949
|
+
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _244 => _244.experimental, 'optionalAccess', _245 => _245.ppr]) === true)};
|
|
9872
9950
|
|
|
9873
9951
|
function resolveRouteRenderingView(route) {
|
|
9874
9952
|
// The same merge development uses: baked directive config under the
|
|
@@ -9893,7 +9971,7 @@ function getPPRShellBypassReason(request, middlewareData, middlewareContext) {
|
|
|
9893
9971
|
if (farmSecurityConfig.csp && farmSecurityConfig.csp.nonce) return "csp-nonce";
|
|
9894
9972
|
const method = request.method.toUpperCase();
|
|
9895
9973
|
if (method !== "GET" && method !== "HEAD") return "method";
|
|
9896
|
-
if (request.headers.get("cookie")) return "cookie";
|
|
9974
|
+
if (withoutFarmDeploymentCookie(request.headers.get("cookie"))) return "cookie";
|
|
9897
9975
|
if (request.headers.get("authorization")) return "authorization";
|
|
9898
9976
|
if (request.headers.get("x-farm-intercept-from")) return "route-interception";
|
|
9899
9977
|
if (request.headers.get("x-farm-ppr-refresh")) return "refresh";
|
|
@@ -9905,12 +9983,15 @@ function getPPRShellBypassReason(request, middlewareData, middlewareContext) {
|
|
|
9905
9983
|
|
|
9906
9984
|
// origin is set when the shell carries hreflang alternates (i18n prefix
|
|
9907
9985
|
// routing), so one host never serves a shell holding another host's URLs.
|
|
9986
|
+
// A shell embeds its deployment's ID and client assets, and a shared cache
|
|
9987
|
+
// adapter outlives a deployment, so each deployment keys its own shells.
|
|
9908
9988
|
function getPPRShellCacheKey(url, locale, origin) {
|
|
9909
9989
|
const key = [
|
|
9910
9990
|
"ppr",
|
|
9911
9991
|
locale || "",
|
|
9912
9992
|
normalizeRevalidatePath(url.pathname),
|
|
9913
9993
|
url.search,
|
|
9994
|
+
farmDeploymentId,
|
|
9914
9995
|
];
|
|
9915
9996
|
return createFarmCacheKey(origin ? key.concat(origin) : key);
|
|
9916
9997
|
}
|
|
@@ -9940,22 +10021,13 @@ function hasFarmUnserializableRouteData(data) {
|
|
|
9940
10021
|
return Boolean(data) && typeof data === "object" && Object.values(data).some(isPromise);
|
|
9941
10022
|
}
|
|
9942
10023
|
|
|
10024
|
+
// Core's policy for the route, shared with the RSC server so both send the same Cache-Control.
|
|
9943
10025
|
function getRouteSharedCacheControl(route, pprCanCache) {
|
|
9944
10026
|
if (!route || !route.module) {
|
|
9945
10027
|
return null;
|
|
9946
10028
|
}
|
|
9947
10029
|
|
|
9948
|
-
|
|
9949
|
-
if (view.dynamic === "force-dynamic") {
|
|
9950
|
-
return null;
|
|
9951
|
-
}
|
|
9952
|
-
if (!view.ssg && !pprCanCache) {
|
|
9953
|
-
return null;
|
|
9954
|
-
}
|
|
9955
|
-
|
|
9956
|
-
const revalidate =
|
|
9957
|
-
typeof view.revalidate === "number" && view.revalidate > 0 ? view.revalidate : 60;
|
|
9958
|
-
return "public, s-maxage=" + revalidate + ", stale-while-revalidate=300";
|
|
10030
|
+
return resolveRouteSharedCacheControl(resolveRouteRenderingView(route), pprCanCache);
|
|
9959
10031
|
}
|
|
9960
10032
|
|
|
9961
10033
|
async function getCachedPPRShell(cacheKey) {
|
|
@@ -10002,7 +10074,7 @@ async function handleFarmRequest(request, adapterContext) {
|
|
|
10002
10074
|
},
|
|
10003
10075
|
{ redirect: !isFarmLocalAPIPathname(requestUrl.pathname) }
|
|
10004
10076
|
)` : "handleFarmRequestInContext(request, null, false, Date.now(), adapterContext, requestUrl)"};
|
|
10005
|
-
${_optionalChain([config, 'access',
|
|
10077
|
+
${_optionalChain([config, 'access', _246 => _246.md, 'optionalAccess', _247 => _247.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
|
|
10006
10078
|
if (matchPageRoute(pathname)) {
|
|
10007
10079
|
// The Link header advertises the public .md URL, like the head alternate.
|
|
10008
10080
|
return applyMarkdownNegotiationHeaders(response, {
|
|
@@ -10026,8 +10098,9 @@ async function handleFarmRequestInContext(
|
|
|
10026
10098
|
adapterContext,
|
|
10027
10099
|
requestUrl = new URL(request.url),
|
|
10028
10100
|
) {
|
|
10029
|
-
|
|
10030
|
-
const
|
|
10101
|
+
// deploymentPage: a page route answered, so the response names this deployment.
|
|
10102
|
+
const farmCacheGuard = { guarded: farmPluginRuntimeKeepsResponsesPrivate, deploymentPage: false };
|
|
10103
|
+
let response = await resolveFarmRequestInContext(
|
|
10031
10104
|
farmCacheGuard,
|
|
10032
10105
|
request,
|
|
10033
10106
|
farmLocaleResolution,
|
|
@@ -10036,6 +10109,11 @@ async function handleFarmRequestInContext(
|
|
|
10036
10109
|
adapterContext,
|
|
10037
10110
|
requestUrl,
|
|
10038
10111
|
);
|
|
10112
|
+
if (farmCacheGuard.deploymentPage) {
|
|
10113
|
+
response = _withFarmResponseHeaders(response, (headers) =>
|
|
10114
|
+
headers.set(FARM_DEPLOYMENT_ID_HEADER, farmDeploymentId)
|
|
10115
|
+
);
|
|
10116
|
+
}
|
|
10039
10117
|
if (!farmCacheGuard.guarded) return response;
|
|
10040
10118
|
// Tells the Nitro entry, which keeps this policy over a swr rule's public one.
|
|
10041
10119
|
adapterContext?.onGuardedResponse?.();
|
|
@@ -10213,7 +10291,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10213
10291
|
return renderFarmErrorJSONResponse();` : `
|
|
10214
10292
|
if (isFarmLocalAPIPathname(pathname)) return renderFarmErrorJSONResponse();
|
|
10215
10293
|
// No page was selected, so only the root error boundary and layouts apply.
|
|
10216
|
-
const errorResponse = await renderFarmErrorResponse(middlewareResult.error, "/", {}, null);${_optionalChain([config, 'access',
|
|
10294
|
+
const errorResponse = await renderFarmErrorResponse(middlewareResult.error, "/", {}, null);${_optionalChain([config, 'access', _248 => _248.md, 'optionalAccess', _249 => _249.enabled]) ? `
|
|
10217
10295
|
// An agent asking for Markdown reads the error document as Markdown, as it
|
|
10218
10296
|
// does when a page throws. The helper answers null when Markdown is off.
|
|
10219
10297
|
const markdownErrorResponse = await createMarkdownMirrorResponse({
|
|
@@ -10255,7 +10333,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10255
10333
|
}
|
|
10256
10334
|
` : ""}
|
|
10257
10335
|
|
|
10258
|
-
${_optionalChain([config, 'access',
|
|
10336
|
+
${_optionalChain([config, 'access', _250 => _250.docs, 'optionalAccess', _251 => _251.enabled]) ? `
|
|
10259
10337
|
// Docs responses are served after app middleware so route guards and
|
|
10260
10338
|
// middleware headers apply to the docs engine like any other page content.
|
|
10261
10339
|
// An app's own llms.txt, llms-full.txt, sitemap.xml, and robots.txt take
|
|
@@ -10279,6 +10357,14 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10279
10357
|
middlewareHeaders,
|
|
10280
10358
|
);
|
|
10281
10359
|
}
|
|
10360
|
+
// A docs page is a page document: it names this deployment, and a navigation from
|
|
10361
|
+
// another deployment's page is refused, as for an app page.
|
|
10362
|
+
const farmDocsDeploymentMismatch = getFarmDeploymentMismatch(request, farmDeploymentId);
|
|
10363
|
+
if (farmDocsDeploymentMismatch) {
|
|
10364
|
+
await docsResponse.body?.cancel();
|
|
10365
|
+
return createFarmDeploymentMismatchResponse(farmDocsDeploymentMismatch);
|
|
10366
|
+
}
|
|
10367
|
+
farmCacheGuard.deploymentPage = true;
|
|
10282
10368
|
const wrappedDocsResponse = withFarmDocsRequestCache(
|
|
10283
10369
|
await wrapFarmDocsResponseWithLayouts(request, docsResponse),
|
|
10284
10370
|
request,
|
|
@@ -10310,7 +10396,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10310
10396
|
clientAddress: adapterContext?.clientAddress,
|
|
10311
10397
|
// An anonymous visitor's request: guards never see the caller's address.
|
|
10312
10398
|
renderPage: (targetRequest) =>
|
|
10313
|
-
fetchFarmInnerRequest(targetRequest, {
|
|
10399
|
+
fetchFarmInnerRequest(toFarmMarkdownPageRequest(targetRequest), {
|
|
10314
10400
|
...adapterContext,
|
|
10315
10401
|
clientAddress: FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS,
|
|
10316
10402
|
}),
|
|
@@ -10345,7 +10431,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10345
10431
|
}
|
|
10346
10432
|
` : ""}
|
|
10347
10433
|
|
|
10348
|
-
${_optionalChain([config, 'access',
|
|
10434
|
+
${_optionalChain([config, 'access', _252 => _252.md, 'optionalAccess', _253 => _253.enabled]) ? `
|
|
10349
10435
|
if (farmMarkdownConfig?.enabled) {
|
|
10350
10436
|
const markdownResponse = await createMarkdownMirrorResponse({
|
|
10351
10437
|
// The mirror helper only reads metadata and creates its own GET request.
|
|
@@ -10357,7 +10443,8 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10357
10443
|
routePathname: getFarmRoutePathname,
|
|
10358
10444
|
routeExists: (targetPathname) =>
|
|
10359
10445
|
Boolean(matchPageRoute(getFarmRoutePathname(targetPathname))),
|
|
10360
|
-
renderPage: (targetRequest) =>
|
|
10446
|
+
renderPage: (targetRequest) =>
|
|
10447
|
+
fetchFarmInnerRequest(toFarmMarkdownPageRequest(targetRequest), adapterContext),
|
|
10361
10448
|
apiServerBasePath: farmLocalAPIBasePath,
|
|
10362
10449
|
});
|
|
10363
10450
|
if (markdownResponse) {
|
|
@@ -10448,11 +10535,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10448
10535
|
return applyProductionMiddlewareHeaders(applicationMetadataResponse, middlewareHeaders);
|
|
10449
10536
|
}
|
|
10450
10537
|
` : ""}
|
|
10451
|
-
${_optionalChain([config, 'access',
|
|
10538
|
+
${_optionalChain([config, 'access', _254 => _254.agent, 'optionalAccess', _255 => _255.manifest]) !== false ? `
|
|
10452
10539
|
// agent.manifest: /.well-known/farmjs.json (and 0.1.34's /.well-known/farmjs), the app's
|
|
10453
10540
|
// public manifest, the same document for every request.
|
|
10454
10541
|
if (
|
|
10455
|
-
[${JSON.stringify(
|
|
10542
|
+
[${JSON.stringify(_chunkSXMWVP2Lcjs.FARM_APP_MANIFEST_PATH)}, ${JSON.stringify(_chunkSXMWVP2Lcjs.FARM_APP_MANIFEST_LEGACY_PATH)}].includes(
|
|
10456
10543
|
normalizeRuntimePath(routePathname),
|
|
10457
10544
|
)
|
|
10458
10545
|
) {
|
|
@@ -10462,9 +10549,9 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10462
10549
|
);
|
|
10463
10550
|
}
|
|
10464
10551
|
` : ""}
|
|
10465
|
-
${_optionalChain([config, 'access',
|
|
10552
|
+
${_optionalChain([config, 'access', _256 => _256.agent, 'optionalAccess', _257 => _257.apiCatalog]) ? `
|
|
10466
10553
|
// agent.apiCatalog: list the OpenAPI and MCP surfaces at the RFC 9727 path.
|
|
10467
|
-
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(
|
|
10554
|
+
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkSXMWVP2Lcjs.FARM_API_CATALOG_PATH)}) {
|
|
10468
10555
|
return applyProductionMiddlewareHeaders(
|
|
10469
10556
|
createFarmApiCatalogResponse(request.method, farmApiCatalogInput, request),
|
|
10470
10557
|
middlewareHeaders,
|
|
@@ -10489,11 +10576,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10489
10576
|
);
|
|
10490
10577
|
}
|
|
10491
10578
|
` : ""}
|
|
10492
|
-
${_optionalChain([config, 'access',
|
|
10579
|
+
${_optionalChain([config, 'access', _258 => _258.agent, 'optionalAccess', _259 => _259.llmsTxt, 'optionalAccess', _260 => _260.enabled]) ? `
|
|
10493
10580
|
// agent.llmsTxt with no llms.ts or llms-full.ts: serve the generated files.
|
|
10494
10581
|
const farmGeneratedLlmsKind = normalizeRuntimePath(routePathname) === "/llms.txt"
|
|
10495
10582
|
? "llms"
|
|
10496
|
-
: ${_optionalChain([config, 'access',
|
|
10583
|
+
: ${_optionalChain([config, 'access', _261 => _261.agent, 'optionalAccess', _262 => _262.llmsTxt, 'optionalAccess', _263 => _263.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
|
|
10497
10584
|
if (farmGeneratedLlmsKind) {
|
|
10498
10585
|
const llmsContext = createFarmLlmsTxtContext(request, farmGeneratedLlmsKind === "llms-full");
|
|
10499
10586
|
// Renders are shared per origin the request reached, which is where pages are read.
|
|
@@ -10529,7 +10616,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10529
10616
|
}
|
|
10530
10617
|
` : ""}
|
|
10531
10618
|
|
|
10532
|
-
${_optionalChain([config, 'access',
|
|
10619
|
+
${_optionalChain([config, 'access', _264 => _264.docs, 'optionalAccess', _265 => _265.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
|
|
10533
10620
|
const docsAPIResponse = await farmDocsAPIHandler(cloneFarmRequestWithContext(request));
|
|
10534
10621
|
if (docsAPIResponse) {
|
|
10535
10622
|
return applyProductionMiddlewareHeaders(
|
|
@@ -10550,6 +10637,14 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10550
10637
|
// Handle page routes (SSR)
|
|
10551
10638
|
emitFarmEvent({ type: "render.start", route: pathname, pathname });
|
|
10552
10639
|
const matchedRoute = matchPageRoute(routePathname);
|
|
10640
|
+
if (matchedRoute) {
|
|
10641
|
+
// A browser holding another deployment's page names it: a navigation fetch in its header, a
|
|
10642
|
+
// form or server action post in the deployment cookie. Refuse it before an action runs, and
|
|
10643
|
+
// before a document would refresh that cookie to this deployment.
|
|
10644
|
+
const farmDeploymentMismatch = getFarmDeploymentMismatch(request, farmDeploymentId);
|
|
10645
|
+
if (farmDeploymentMismatch) return createFarmDeploymentMismatchResponse(farmDeploymentMismatch);
|
|
10646
|
+
farmCacheGuard.deploymentPage = true;
|
|
10647
|
+
}
|
|
10553
10648
|
${farmIslandsMode ? `// Islands mode: a form or client component posting a server action to this page.
|
|
10554
10649
|
if (matchedRoute && request.method === "POST") {
|
|
10555
10650
|
const actionResponse = await _runWithMiddlewareData(middlewareData || {}, () =>
|
|
@@ -10659,6 +10754,12 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10659
10754
|
|
|
10660
10755
|
// Reads from here on belong to the page render, not to middleware.
|
|
10661
10756
|
const requestReadsBeforeRender = _getRequestReadCount();
|
|
10757
|
+
// A swr or cache route rule stores this page by URL for every visitor. Nitro hands Farm the
|
|
10758
|
+
// request without its cookies, Authorization, or any header the rule does not key on, so a
|
|
10759
|
+
// render that reads nothing of the request is that shared page, whatever its route config.
|
|
10760
|
+
const farmRouteRuleCached =
|
|
10761
|
+
Boolean(adapterContext?.routeRuleCache) &&
|
|
10762
|
+
(request.method === "GET" || request.method === "HEAD");
|
|
10662
10763
|
|
|
10663
10764
|
// Get the page component and metadata
|
|
10664
10765
|
let PageComponent = route.module.default;
|
|
@@ -10892,7 +10993,8 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10892
10993
|
${farmIslandsMode ? `// Islands mode: a route a shared cache may store (a PPR shell, a static page) renders
|
|
10893
10994
|
// whole for every request, so a cache hit stays a hit. Other routes leave out what the
|
|
10894
10995
|
// navigating browser keeps: the layouts it shows and the values it holds.
|
|
10895
|
-
const farmSharedCacheableRoute =
|
|
10996
|
+
const farmSharedCacheableRoute =
|
|
10997
|
+
farmRouteRuleCached || Boolean(getRouteSharedCacheControl(route, pprCanCache));
|
|
10896
10998
|
if (farmSharedCacheableRoute) ignoreFarmHeldValues();
|
|
10897
10999
|
const farmLayoutKeyOf = getFarmLayoutKey;
|
|
10898
11000
|
// A navigation the browser renders in its layout's React root rebuilds a server-tree page
|
|
@@ -11119,7 +11221,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11119
11221
|
);
|
|
11120
11222
|
}
|
|
11121
11223
|
}
|
|
11122
|
-
${_optionalChain([config, 'access',
|
|
11224
|
+
${_optionalChain([config, 'access', _266 => _266.md, 'optionalAccess', _267 => _267.enabled]) ? `
|
|
11123
11225
|
// Advertise the Markdown mirror in the head as well as the Link header,
|
|
11124
11226
|
// using the public path the .md request will be resolved against.
|
|
11125
11227
|
mergedMetadata = addMetadataMarkdownAlternate(
|
|
@@ -11138,7 +11240,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11138
11240
|
emitFarmEvent({ type: "cache.bypass", route: pathname, reason: "request-read" });
|
|
11139
11241
|
}
|
|
11140
11242
|
|
|
11141
|
-
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
11243
|
+
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _268 => _268.agent, 'optionalAccess', _269 => _269.jsonLd]), () => ( false)))} });
|
|
11142
11244
|
const title = renderedMetadata.title;
|
|
11143
11245
|
const metaTags = renderedMetadata.tags;
|
|
11144
11246
|
const hasFavicon = renderedMetadata.hasFavicon;
|
|
@@ -11157,6 +11259,24 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11157
11259
|
middlewareData?.size ||
|
|
11158
11260
|
middlewareContext?.size
|
|
11159
11261
|
);
|
|
11262
|
+
if (farmRouteRuleCached && (renderedPage.stream || hasRequestScopedRender)) {
|
|
11263
|
+
// The route rule's cache refuses a private page: say why it renders on every request.
|
|
11264
|
+
emitFarmEvent({
|
|
11265
|
+
type: "cache.bypass",
|
|
11266
|
+
route: pathname,
|
|
11267
|
+
reason: pageStatus >= 400
|
|
11268
|
+
? "error-status"
|
|
11269
|
+
: renderReadRequest
|
|
11270
|
+
? "request-read"
|
|
11271
|
+
: middlewareData?.size || middlewareContext?.size
|
|
11272
|
+
? "middleware-data"
|
|
11273
|
+
: hasConfiguredRouteContext
|
|
11274
|
+
? "route-context"
|
|
11275
|
+
: renderedPage.stream
|
|
11276
|
+
? "suspense-stream"
|
|
11277
|
+
: "request-scoped",
|
|
11278
|
+
});
|
|
11279
|
+
}
|
|
11160
11280
|
const sharedCacheControl = getRouteSharedCacheControl(route, pprCanCache);
|
|
11161
11281
|
const responseHeaders = {
|
|
11162
11282
|
"Content-Type": "text/html; charset=utf-8",
|
|
@@ -11166,8 +11286,16 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11166
11286
|
};
|
|
11167
11287
|
// An error status or a request-scoped render is never shareable, even when
|
|
11168
11288
|
// the PPR shell headers would otherwise grant a shared max-age.
|
|
11169
|
-
if (
|
|
11289
|
+
if (
|
|
11290
|
+
renderedPage.stream ||
|
|
11291
|
+
hasRequestScopedRender ||
|
|
11292
|
+
(!sharedCacheControl && !farmRouteRuleCached)
|
|
11293
|
+
) {
|
|
11170
11294
|
responseHeaders["Cache-Control"] = "private, no-store";
|
|
11295
|
+
} else if (responseHeaders["Cache-Control"] == null) {
|
|
11296
|
+
// A page with no policy of its own under a swr or cache route rule: the rule's cache
|
|
11297
|
+
// stores it and sends the rule's Cache-Control.
|
|
11298
|
+
delete responseHeaders["Cache-Control"];
|
|
11171
11299
|
}
|
|
11172
11300
|
const farmI18nSnapshot = getFarmI18nSnapshot();${farmIslandsMode ? `
|
|
11173
11301
|
// Islands mode: a navigation that names the values it holds, or the layouts it shows,
|
|
@@ -11540,7 +11668,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11540
11668
|
${servesDefaultMCP ? `
|
|
11541
11669
|
// agent.mcp: no app route answered /mcp, so the default read-only server may.
|
|
11542
11670
|
if (
|
|
11543
|
-
normalizeRuntimePath(routePathname) === ${JSON.stringify(
|
|
11671
|
+
normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkTP4RAV7Ycjs.FARM_DEFAULT_MCP_PATH)} &&
|
|
11544
11672
|
getFarmDefaultMCPServer()
|
|
11545
11673
|
) {
|
|
11546
11674
|
return applyProductionMiddlewareHeaders(
|
|
@@ -11682,6 +11810,13 @@ ${farmRendererDisabled ? `
|
|
|
11682
11810
|
{ status: 404, headers: { "Content-Type": "application/json" } }
|
|
11683
11811
|
), middlewareHeaders);
|
|
11684
11812
|
` : ""}
|
|
11813
|
+
// The not-found page is a page document: it names this deployment, and a navigation from
|
|
11814
|
+
// another deployment's page is refused, as for an app page.
|
|
11815
|
+
const farmNotFoundDeploymentMismatch = getFarmDeploymentMismatch(request, farmDeploymentId);
|
|
11816
|
+
if (farmNotFoundDeploymentMismatch) {
|
|
11817
|
+
return createFarmDeploymentMismatchResponse(farmNotFoundDeploymentMismatch);
|
|
11818
|
+
}
|
|
11819
|
+
farmCacheGuard.deploymentPage = true;
|
|
11685
11820
|
// Agents that navigate in Markdown (a \`.md\` URL or \`Accept: text/markdown\`)
|
|
11686
11821
|
// get a Markdown error body instead of the HTML not-found shell.
|
|
11687
11822
|
if (farmRequestWantsMarkdown(pathname, request.headers.get("accept"))) {
|
|
@@ -11898,11 +12033,11 @@ function createFarmRuntimeHookErrorResponse(request, error) {
|
|
|
11898
12033
|
export async function fetch(request, context) {${imageRuntime === "none" ? "" : `
|
|
11899
12034
|
// The image optimizer's fetch of a local source is not a loopback visitor.
|
|
11900
12035
|
context = _withFarmImageSourceClientAddress(request, context);`}
|
|
11901
|
-
${_optionalChain([config, 'access',
|
|
12036
|
+
${_optionalChain([config, 'access', _270 => _270.agent, 'optionalAccess', _271 => _271.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
|
|
11902
12037
|
basePath: farmLocalAPIBasePath,
|
|
11903
12038
|
dispatch: async (localRequest) =>
|
|
11904
12039
|
(await handleAPIRequest(localRequest)) ?? Response.json({ error: "Not Found" }, { status: 404 }),
|
|
11905
|
-
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access',
|
|
12040
|
+
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _272 => _272.agent, 'optionalAccess', _273 => _273.noindexPreviews]) ? `
|
|
11906
12041
|
// Keep every response of a preview deployment out of search indexes.
|
|
11907
12042
|
return farmNoindexPreview ? applyFarmPreviewRobotsTag(response) : response;` : ""}
|
|
11908
12043
|
}
|
|
@@ -11920,9 +12055,10 @@ async function handleFarmFetch(request, context) {
|
|
|
11920
12055
|
);
|
|
11921
12056
|
|
|
11922
12057
|
// headers() config applies after middleware let the request through, so it learns
|
|
11923
|
-
// whether the response was guarded and can't make that response shareable again.
|
|
12058
|
+
// whether the response was guarded and can't make that response shareable again. A plugin
|
|
12059
|
+
// runtime hook that throws answers a new 500 out here, which learns it the same way.
|
|
11924
12060
|
let farmGuardedResponse = false;
|
|
11925
|
-
if (configuredHeaderRoutes.length > 0) {
|
|
12061
|
+
if (configuredHeaderRoutes.length > 0 || farmPluginRuntime) {
|
|
11926
12062
|
const adapterContext = context;
|
|
11927
12063
|
context = {
|
|
11928
12064
|
...adapterContext,
|
|
@@ -11955,9 +12091,15 @@ async function handleFarmFetch(request, context) {
|
|
|
11955
12091
|
const configured = applyConfiguredResponseHeaders(response, routePathname);
|
|
11956
12092
|
// Configured headers may edit the response in place, so check it either way.
|
|
11957
12093
|
const guarded = farmGuardedResponse ? _withFarmGuardedResponseCache(configured) : configured;
|
|
12094
|
+
// The deployment cookie goes on once the response's cache policy is final.
|
|
11958
12095
|
return applyFarmPreloadBudget(
|
|
11959
12096
|
applyFarmCspNonceToResponse(
|
|
11960
|
-
|
|
12097
|
+
_withFarmDeploymentCookie(
|
|
12098
|
+
runtimeRequest,
|
|
12099
|
+
applyFarmMobileShellResponse(runtimeRequest, guarded, context),
|
|
12100
|
+
farmDeploymentId,
|
|
12101
|
+
farmDeploymentCookiePath,
|
|
12102
|
+
),
|
|
11961
12103
|
farmSecurityConfig,
|
|
11962
12104
|
cspNonce,
|
|
11963
12105
|
),
|
|
@@ -12002,7 +12144,9 @@ async function handleFarmFetch(request, context) {
|
|
|
12002
12144
|
const response = await _runWithCurrentRequest(request, () =>
|
|
12003
12145
|
_runWithFarmCspNonce(cspNonce, () => _runWithAfterRequest(request, runRequest, context)),
|
|
12004
12146
|
);
|
|
12005
|
-
|
|
12147
|
+
// A Nitro cache rule stores the response and strips its Content-Encoding, so a
|
|
12148
|
+
// response it caches is sent as it is, with no Vary on an encoding it never saw.
|
|
12149
|
+
return ${hasCompressionRuntime && !hasPluginRuntime ? "context?.routeRuleCache ? response : compressFarmResponse(request, response, getFarmOwnedBufferedHtml(response), farmLazyBufferedHtml.has(response))" : "response"};
|
|
12006
12150
|
}),
|
|
12007
12151
|
{
|
|
12008
12152
|
onResponseFinished: typeof context?.onResponseFinished === "function"
|
|
@@ -12088,7 +12232,7 @@ function getManifestPageEntry(manifest, pathname) {
|
|
|
12088
12232
|
}
|
|
12089
12233
|
function withFarmEdgeGuardedPrerenderHeaders(headers, edgeGuarded) {
|
|
12090
12234
|
if (!edgeGuarded) return headers;
|
|
12091
|
-
const cacheHeaders = /* @__PURE__ */ new Set(["cache-control", ...
|
|
12235
|
+
const cacheHeaders = /* @__PURE__ */ new Set(["cache-control", ..._chunkJWY66PIDcjs.CDN_CACHE_CONTROL_HEADERS]);
|
|
12092
12236
|
return {
|
|
12093
12237
|
...Object.fromEntries(
|
|
12094
12238
|
Object.entries(headers).filter(([name]) => !cacheHeaders.has(name.toLowerCase()))
|
|
@@ -12096,6 +12240,14 @@ function withFarmEdgeGuardedPrerenderHeaders(headers, edgeGuarded) {
|
|
|
12096
12240
|
"cache-control": "private, no-store"
|
|
12097
12241
|
};
|
|
12098
12242
|
}
|
|
12243
|
+
function prerenderWouldChangePageUrl(pathname) {
|
|
12244
|
+
if (/%(?:23|25|2F|3F)/i.test(pathname)) return true;
|
|
12245
|
+
try {
|
|
12246
|
+
return decodeURI(pathname) !== pathname;
|
|
12247
|
+
} catch (e34) {
|
|
12248
|
+
return true;
|
|
12249
|
+
}
|
|
12250
|
+
}
|
|
12099
12251
|
function getPhysicalPrerenderBypassReason(options) {
|
|
12100
12252
|
const {
|
|
12101
12253
|
config,
|
|
@@ -12105,6 +12257,7 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
12105
12257
|
rewriteSources,
|
|
12106
12258
|
pathname
|
|
12107
12259
|
} = options;
|
|
12260
|
+
if (prerenderWouldChangePageUrl(pathname)) return "an escaped character in its URL";
|
|
12108
12261
|
if (config.i18n.enabled) return "request-sensitive i18n";
|
|
12109
12262
|
if (redirectSources.some((source) => middlewarePatternMatches(source, pathname))) {
|
|
12110
12263
|
return "redirect";
|
|
@@ -12112,13 +12265,13 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
12112
12265
|
if (rewriteSources.some((source) => middlewarePatternMatches(source, pathname))) {
|
|
12113
12266
|
return "rewrite";
|
|
12114
12267
|
}
|
|
12115
|
-
if (
|
|
12116
|
-
if (
|
|
12117
|
-
if (
|
|
12268
|
+
if (_chunk2MR4MABGcjs.appMiddlewareMayHandlePath.call(void 0, middlewareRoutes, pathname)) return "app middleware";
|
|
12269
|
+
if (_chunk2MR4MABGcjs.configMiddlewareMayHandlePath.call(void 0, config.middleware, pathname)) return "configured middleware";
|
|
12270
|
+
if (_chunkKEB7AGS6cjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
|
|
12118
12271
|
if (farmServerRuntimePluginsMayHandlePath(config, pathname)) return "server runtime plugin";
|
|
12119
12272
|
const manifestEntry = getManifestPageEntry(routeRuntimeManifest, pathname);
|
|
12120
|
-
if (_optionalChain([manifestEntry, 'optionalAccess',
|
|
12121
|
-
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access',
|
|
12273
|
+
if (_optionalChain([manifestEntry, 'optionalAccess', _274 => _274.rendering]) === "dynamic") return "dynamic runtime manifest";
|
|
12274
|
+
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _275 => _275.regions, 'optionalAccess', _276 => _276.length])) || manifestEntry.maxDuration !== void 0)) {
|
|
12122
12275
|
return "route runtime controls";
|
|
12123
12276
|
}
|
|
12124
12277
|
const routeRule = getEffectiveRouteRule(config, pathname);
|
|
@@ -12131,15 +12284,15 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
12131
12284
|
return void 0;
|
|
12132
12285
|
}
|
|
12133
12286
|
async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
12134
|
-
if (!_optionalChain([config, 'access',
|
|
12135
|
-
if (
|
|
12287
|
+
if (!_optionalChain([config, 'access', _277 => _277.docs, 'optionalAccess', _278 => _278.enabled]) || !config.docs.prerender) return [];
|
|
12288
|
+
if (_chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge") {
|
|
12136
12289
|
_chunkQMNWKQL4cjs.logger.info(
|
|
12137
12290
|
`\u21AA Keeping docs pages in the edge docs snapshot: docs.prerender writes static files on Node and serverless targets, not "${preset}".`
|
|
12138
12291
|
);
|
|
12139
12292
|
return [];
|
|
12140
12293
|
}
|
|
12141
|
-
if (!
|
|
12142
|
-
const { pages: pages2, originDependent } =
|
|
12294
|
+
if (!_chunkUISZLYKYcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
|
|
12295
|
+
const { pages: pages2, originDependent } = _chunkNAXKOTPPcjs.listFarmDocsBuiltInPrerenderPages.call(void 0, config.docs, {
|
|
12143
12296
|
root,
|
|
12144
12297
|
srcDir: config.srcDir
|
|
12145
12298
|
});
|
|
@@ -12156,7 +12309,7 @@ async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
|
12156
12309
|
);
|
|
12157
12310
|
return [];
|
|
12158
12311
|
}
|
|
12159
|
-
const pages = await
|
|
12312
|
+
const pages = await _chunkUISZLYKYcjs.listFarmDocsAdapterPages.call(void 0, config.docs, { root, srcDir: config.srcDir });
|
|
12160
12313
|
if (!pages) {
|
|
12161
12314
|
_chunkQMNWKQL4cjs.logger.warn(
|
|
12162
12315
|
`The docs adapter ${JSON.stringify(config.docs.adapter.id)} does not list its pages for prerendering; upgrade it to prerender docs pages. They render on request until then.`
|
|
@@ -12166,14 +12319,14 @@ async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
|
12166
12319
|
return pages;
|
|
12167
12320
|
}
|
|
12168
12321
|
async function listFarmDocsAnalyticsPages(config, root, preset) {
|
|
12169
|
-
if (!_optionalChain([config, 'access',
|
|
12322
|
+
if (!_optionalChain([config, 'access', _279 => _279.docs, 'optionalAccess', _280 => _280.enabled]) || config.analytics === false || _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) !== "nodejs") {
|
|
12170
12323
|
return [];
|
|
12171
12324
|
}
|
|
12172
12325
|
try {
|
|
12173
|
-
return await
|
|
12326
|
+
return await _chunkUISZLYKYcjs.listFarmDocsPagePaths.call(void 0, config.docs, {
|
|
12174
12327
|
root,
|
|
12175
12328
|
srcDir: config.srcDir,
|
|
12176
|
-
adapter: _chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) &&
|
|
12329
|
+
adapter: _chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) && _chunkUISZLYKYcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)
|
|
12177
12330
|
});
|
|
12178
12331
|
} catch (error) {
|
|
12179
12332
|
_chunkQMNWKQL4cjs.logger.warn(
|
|
@@ -12184,9 +12337,9 @@ async function listFarmDocsAnalyticsPages(config, root, preset) {
|
|
|
12184
12337
|
}
|
|
12185
12338
|
function hasFarmNitroCacheRouteRule(routeRules) {
|
|
12186
12339
|
return Object.values(routeRules || {}).some((rule) => {
|
|
12187
|
-
const swr = _optionalChain([rule, 'optionalAccess',
|
|
12188
|
-
const cache = _optionalChain([rule, 'optionalAccess',
|
|
12189
|
-
const headers = _optionalChain([rule, 'optionalAccess',
|
|
12340
|
+
const swr = _optionalChain([rule, 'optionalAccess', _281 => _281.swr]);
|
|
12341
|
+
const cache = _optionalChain([rule, 'optionalAccess', _282 => _282.cache]);
|
|
12342
|
+
const headers = _optionalChain([rule, 'optionalAccess', _283 => _283.headers]);
|
|
12190
12343
|
return swr !== void 0 && swr !== false || cache !== void 0 && cache !== false || !!headers && typeof headers === "object" && Object.keys(headers).length > 0;
|
|
12191
12344
|
});
|
|
12192
12345
|
}
|
|
@@ -12199,10 +12352,10 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
12199
12352
|
const nitroBuilder = nitroBuilderResult.value;
|
|
12200
12353
|
const isVercel = preset === "vercel";
|
|
12201
12354
|
const isCloudflareWorker = preset === "cloudflare-module";
|
|
12202
|
-
const outputDir =
|
|
12355
|
+
const outputDir = _chunkKEB7AGS6cjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
12203
12356
|
const runtimeServerOutputDir = isVercel ? _path2.default.join(outputDir, "functions", "__nitro.func") : _path2.default.join(outputDir, "server");
|
|
12204
12357
|
const ssrOutputDir = _path2.default.join(root, distDir, "ssr");
|
|
12205
|
-
const imageRuntime =
|
|
12358
|
+
const imageRuntime = _chunkKWST2O22cjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
|
|
12206
12359
|
const hasGeneratedMetadataImages = Array.from(routeManager.getMetadataImages().values()).some(
|
|
12207
12360
|
(image) => image.sourceType === "module"
|
|
12208
12361
|
);
|
|
@@ -12258,7 +12411,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
12258
12411
|
const edgeGuardedPrerenderRoutes = [];
|
|
12259
12412
|
const addPrerenderRoute = (pathname) => {
|
|
12260
12413
|
prerenderRoutes.push(pathname);
|
|
12261
|
-
if (
|
|
12414
|
+
if (_chunk2MR4MABGcjs.appMiddlewareMayHandlePath.call(void 0, edgeMiddlewareRoutes, pathname)) {
|
|
12262
12415
|
edgeGuardedPrerenderRoutes.push(pathname);
|
|
12263
12416
|
}
|
|
12264
12417
|
};
|
|
@@ -12336,7 +12489,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
12336
12489
|
webEntry: clientJsSrc,
|
|
12337
12490
|
webBoot: clientBootSrc,
|
|
12338
12491
|
stylesheet: clientCssHref,
|
|
12339
|
-
webFiles: _nullishCoalesce(_optionalChain([clientModulePreloads, 'optionalAccess',
|
|
12492
|
+
webFiles: _nullishCoalesce(_optionalChain([clientModulePreloads, 'optionalAccess', _284 => _284.files]), () => ( []))
|
|
12340
12493
|
})
|
|
12341
12494
|
) : null;
|
|
12342
12495
|
for (const output of Object.values(ssrBundle)) {
|
|
@@ -12536,6 +12689,7 @@ ${hasNitroCacheRouteRules ? " let farmGuardedResponse = false\n" : ""} const r
|
|
|
12536
12689
|
onResponseFinished: createResponseFinishedHook(event),
|
|
12537
12690
|
trustedLocalOrigin: resolveTrustedLocalOrigin(event, request),
|
|
12538
12691
|
clientAddress: resolveFarmClientAddress(event),${hasNitroCacheRouteRules ? `
|
|
12692
|
+
routeRuleCache: Boolean(event.context?.routeRules?.cache),
|
|
12539
12693
|
onGuardedResponse: () => {
|
|
12540
12694
|
farmGuardedResponse = true
|
|
12541
12695
|
},` : ""}
|
|
@@ -12552,7 +12706,9 @@ ${hasNitroCacheRouteRules ? " let farmGuardedResponse = false\n" : ""} const r
|
|
|
12552
12706
|
}${hasNitroCacheRouteRules ? `
|
|
12553
12707
|
const farmCacheControl = response.headers.get('cache-control')
|
|
12554
12708
|
if (
|
|
12555
|
-
|
|
12709
|
+
// A guarded response, or any response Farm kept private under a swr or cache rule: the
|
|
12710
|
+
// rule's cache does not store it, and the rule's public Cache-Control must not reach a CDN.
|
|
12711
|
+
(farmGuardedResponse || event.context?.routeRules?.cache) &&
|
|
12556
12712
|
farmCacheControl &&
|
|
12557
12713
|
FARM_PRIVATE_CACHE_DIRECTIVE.test(farmCacheControl)
|
|
12558
12714
|
) {
|
|
@@ -12649,12 +12805,16 @@ function toFarmNodeResponse(request, response) {
|
|
|
12649
12805
|
ssrOutputDir,
|
|
12650
12806
|
ssrEntryFile
|
|
12651
12807
|
);
|
|
12652
|
-
const configuredNitroRouteRules =
|
|
12653
|
-
|
|
12808
|
+
const configuredNitroRouteRules = _chunkMQ4DYVFScjs.nitroRouteRulesBelowBasePath.call(void 0,
|
|
12809
|
+
varyFarmNitroCacheRules(_chunkMQ4DYVFScjs.routeRulesToNitroRouteRules.call(void 0, config.routeRules), [
|
|
12810
|
+
...config.md.enabled ? ["accept"] : [],
|
|
12811
|
+
...shouldBuildFarmMobileClient(config) ? ["x-farm-shell"] : [],
|
|
12812
|
+
..._chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _285 => _285.experimental, 'optionalAccess', _286 => _286.serverComponents])) === "islands" ? ["f-layouts"] : []
|
|
12813
|
+
]),
|
|
12654
12814
|
config.basePath,
|
|
12655
12815
|
_chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, config.api)
|
|
12656
12816
|
);
|
|
12657
|
-
const toPrerenderPublicPath = (route) =>
|
|
12817
|
+
const toPrerenderPublicPath = (route) => _chunkDVJM55D2cjs.normalizeFarmTrailingSlashPathname.call(void 0,
|
|
12658
12818
|
_chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, route, config.basePath),
|
|
12659
12819
|
config.trailingSlash === true
|
|
12660
12820
|
);
|
|
@@ -12677,6 +12837,18 @@ function toFarmNodeResponse(request, response) {
|
|
|
12677
12837
|
];
|
|
12678
12838
|
})
|
|
12679
12839
|
);
|
|
12840
|
+
const immutableAssets = isVercel ? { publicAssets: [], routeRules: {} } : planFarmImmutableAssets({
|
|
12841
|
+
clientOutputDir,
|
|
12842
|
+
files: await listFarmClientOutputFiles(clientOutputDir),
|
|
12843
|
+
routeRules: configuredNitroRouteRules,
|
|
12844
|
+
routePaths: [
|
|
12845
|
+
...[...routeManager.getRoutes().keys()].map(
|
|
12846
|
+
(pattern) => _chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, pattern, config.basePath)
|
|
12847
|
+
),
|
|
12848
|
+
...apiRouteManager.getRoutes().keys(),
|
|
12849
|
+
_chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, config.api)
|
|
12850
|
+
]
|
|
12851
|
+
});
|
|
12680
12852
|
let nitroConfig = {
|
|
12681
12853
|
preset,
|
|
12682
12854
|
...farmNodeServerEntryPath ? { entry: farmNodeServerEntryPath } : {},
|
|
@@ -12695,13 +12867,9 @@ function toFarmNodeResponse(request, response) {
|
|
|
12695
12867
|
alias: resolveNitroInternalRuntimeAliases(root),
|
|
12696
12868
|
compatibilityDate: "2024-12-01",
|
|
12697
12869
|
output: resolveFarmNitroOutputConfig(preset, outputDir),
|
|
12698
|
-
|
|
12699
|
-
|
|
12700
|
-
|
|
12701
|
-
maxAge: 31536e3,
|
|
12702
|
-
baseURL: "/"
|
|
12703
|
-
}
|
|
12704
|
-
],
|
|
12870
|
+
// Nitro gives the root directory no Cache-Control on any preset (it falls through to the
|
|
12871
|
+
// app), so public files keep revalidating; the hashed directories carry their own maxAge.
|
|
12872
|
+
publicAssets: [{ dir: clientOutputDir, baseURL: "/" }, ...immutableAssets.publicAssets],
|
|
12705
12873
|
// A self-hosted Node server sends static files itself, so precompress them
|
|
12706
12874
|
// with gzip and let Nitro serve that by Accept-Encoding. Brotli at Nitro's
|
|
12707
12875
|
// fixed top quality cost a docs app ~20 s of build CPU for a small further
|
|
@@ -12755,6 +12923,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
12755
12923
|
"/**": {
|
|
12756
12924
|
prerender: false
|
|
12757
12925
|
},
|
|
12926
|
+
...immutableAssets.routeRules,
|
|
12758
12927
|
...configuredNitroRouteRules,
|
|
12759
12928
|
// Exact user rules must retain their runtime settings without replacing
|
|
12760
12929
|
// the headers and prerender marker generated for a safe physical page.
|
|
@@ -12796,23 +12965,23 @@ function toFarmNodeResponse(request, response) {
|
|
|
12796
12965
|
snapshotSSRRebundleOptions(nitroConfig)
|
|
12797
12966
|
);
|
|
12798
12967
|
const requestedBuilder = _nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER));
|
|
12799
|
-
const nitroBuildIsFarms = (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access',
|
|
12800
|
-
_optionalChain([nitroConfig, 'access',
|
|
12801
|
-
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess',
|
|
12968
|
+
const nitroBuildIsFarms = (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _287 => _287.rollupConfig, 'optionalAccess', _288 => _288.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _289 => _289.rollupConfig, 'optionalAccess', _290 => _290.plugins])) && customRollupKeys.length === 0 && Boolean(
|
|
12969
|
+
_optionalChain([nitroConfig, 'access', _291 => _291.handlers, 'optionalAccess', _292 => _292.some, 'call', _293 => _293(
|
|
12970
|
+
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _294 => _294.handler]) || "") === nitroEntryPath
|
|
12802
12971
|
)])
|
|
12803
12972
|
);
|
|
12804
|
-
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && nitroBuildIsFarms && _path2.default.resolve(_optionalChain([nitroConfig, 'access',
|
|
12973
|
+
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && nitroBuildIsFarms && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _295 => _295.output, 'optionalAccess', _296 => _296.serverDir]) || "") === _path2.default.resolve(expectedServerDir);
|
|
12805
12974
|
const prerenderReusesPrebuiltSSR = prerenderRoutes.length > 0 && ssrExternalsArePackaged && nitroBuildIsFarms;
|
|
12806
12975
|
const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
|
|
12807
12976
|
if (selectRolldownBuilder) nitroConfig.builder = "rolldown";
|
|
12808
12977
|
const useRolldownBuilder = canReusePrebuiltSSR && (_nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER))) === "rolldown";
|
|
12809
12978
|
const shouldMinify = nitroConfig.minify !== false;
|
|
12810
|
-
const keepServerNames = !(_optionalChain([config, 'access',
|
|
12979
|
+
const keepServerNames = !(_optionalChain([config, 'access', _297 => _297.docs, 'optionalAccess', _298 => _298.enabled]) && _optionalChain([config, 'access', _299 => _299.docs, 'access', _300 => _300.adapter, 'optionalAccess', _301 => _301.server]));
|
|
12811
12980
|
const useFarmServerMinifier = shouldMinify && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig;
|
|
12812
12981
|
const serverChunkMinifier = useFarmServerMinifier ? createServerChunkMinifyPlugin({ keepNames: keepServerNames, target: "esnext" }) : null;
|
|
12813
12982
|
const ssrRollupPlugin = canReusePrebuiltSSR ? prebuiltSSRPlugin : createServerReadSSRAssetsPlugin(ssrBundle, ssrOutputDir);
|
|
12814
12983
|
if (ssrRollupPlugin) {
|
|
12815
|
-
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access',
|
|
12984
|
+
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _302 => _302.rollupConfig, 'optionalAccess', _303 => _303.plugins]);
|
|
12816
12985
|
nitroConfig.rollupConfig = {
|
|
12817
12986
|
...nitroConfig.rollupConfig,
|
|
12818
12987
|
plugins: [
|
|
@@ -12829,7 +12998,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
12829
12998
|
Array.from(routes, (route, index) => {
|
|
12830
12999
|
try {
|
|
12831
13000
|
return [decodeURI(route), index];
|
|
12832
|
-
} catch (
|
|
13001
|
+
} catch (e35) {
|
|
12833
13002
|
return [route, index];
|
|
12834
13003
|
}
|
|
12835
13004
|
})
|
|
@@ -12839,10 +13008,10 @@ function toFarmNodeResponse(request, response) {
|
|
|
12839
13008
|
const orderOf = (route) => _nullishCoalesce(prerenderOrder.get(route), () => ( Number.MAX_SAFE_INTEGER));
|
|
12840
13009
|
prerenderedRoutes.sort((a, b) => orderOf(a.route) - orderOf(b.route));
|
|
12841
13010
|
});
|
|
12842
|
-
if (_optionalChain([config, 'access',
|
|
13011
|
+
if (_optionalChain([config, 'access', _304 => _304.md, 'optionalAccess', _305 => _305.enabled])) {
|
|
12843
13012
|
nitroInstance.hooks.hook("prerender:generate", (route) => {
|
|
12844
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
12845
|
-
const alternatePath =
|
|
13013
|
+
if (!route.contents || !_optionalChain([route, 'access', _306 => _306.contentType, 'optionalAccess', _307 => _307.toLowerCase, 'call', _308 => _308(), 'access', _309 => _309.includes, 'call', _310 => _310("html")])) return;
|
|
13014
|
+
const alternatePath = _chunkC2JOS77Zcjs.getFarmMarkdownAlternatePath.call(void 0, config.md, route.route, {
|
|
12846
13015
|
routePathname: (pathname) => routeManager.toRoutePathname(pathname)
|
|
12847
13016
|
});
|
|
12848
13017
|
if (!alternatePath) return;
|
|
@@ -12864,7 +13033,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
12864
13033
|
}
|
|
12865
13034
|
if (config.security.csp && config.security.csp.nonce) {
|
|
12866
13035
|
nitroInstance.hooks.hook("prerender:generate", async (route) => {
|
|
12867
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
13036
|
+
if (!route.contents || !_optionalChain([route, 'access', _311 => _311.contentType, 'optionalAccess', _312 => _312.toLowerCase, 'call', _313 => _313(), 'access', _314 => _314.includes, 'call', _315 => _315("html")])) return;
|
|
12868
13037
|
const staticCsp = await _chunk6JHZPB52cjs.applyFarmCspHashesToHtml.call(void 0, route.contents, config.security);
|
|
12869
13038
|
if (!staticCsp) return;
|
|
12870
13039
|
route.contents = staticCsp.html;
|
|
@@ -12899,7 +13068,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
12899
13068
|
await nitroBuilder.copyPublicAssets(nitroInstance);
|
|
12900
13069
|
if (prerenderReusesPrebuiltSSR && !canReusePrebuiltSSR) {
|
|
12901
13070
|
nitroInstance.hooks.hook("prerender:config", (prerendererConfig) => {
|
|
12902
|
-
const configuredPlugins = _optionalChain([prerendererConfig, 'access',
|
|
13071
|
+
const configuredPlugins = _optionalChain([prerendererConfig, 'access', _316 => _316.rollupConfig, 'optionalAccess', _317 => _317.plugins]);
|
|
12903
13072
|
const plugins = Array.isArray(configuredPlugins) ? configuredPlugins : configuredPlugins ? [configuredPlugins] : [];
|
|
12904
13073
|
prerendererConfig.rollupConfig = {
|
|
12905
13074
|
...prerendererConfig.rollupConfig,
|
|
@@ -12956,13 +13125,13 @@ function toFarmNodeResponse(request, response) {
|
|
|
12956
13125
|
}
|
|
12957
13126
|
if (prerenderRoutes.length > 0) {
|
|
12958
13127
|
_chunkQMNWKQL4cjs.logger.info(`\u{1F4C4} Pre-rendering ${prerenderRoutes.length} SSG page(s)`);
|
|
12959
|
-
const previousPrerender = process.env[
|
|
12960
|
-
process.env[
|
|
13128
|
+
const previousPrerender = process.env[_chunk3BQ7QHUHcjs.FARM_PRERENDER_ENV];
|
|
13129
|
+
process.env[_chunk3BQ7QHUHcjs.FARM_PRERENDER_ENV] = "1";
|
|
12961
13130
|
try {
|
|
12962
13131
|
await nitroBuilder.prerender(nitroInstance);
|
|
12963
13132
|
} finally {
|
|
12964
|
-
if (previousPrerender === void 0) delete process.env[
|
|
12965
|
-
else process.env[
|
|
13133
|
+
if (previousPrerender === void 0) delete process.env[_chunk3BQ7QHUHcjs.FARM_PRERENDER_ENV];
|
|
13134
|
+
else process.env[_chunk3BQ7QHUHcjs.FARM_PRERENDER_ENV] = previousPrerender;
|
|
12966
13135
|
}
|
|
12967
13136
|
}
|
|
12968
13137
|
const sharpRuntimeStagePromise = imageRuntime === "node" ? stageSharpRuntime(config, root, distDir, fs4, preset) : Promise.resolve(null);
|
|
@@ -13075,7 +13244,7 @@ async function populateCloudflareProcessEnv(serverDir, fs4) {
|
|
|
13075
13244
|
throw error;
|
|
13076
13245
|
}
|
|
13077
13246
|
const wrangler = JSON.parse(source);
|
|
13078
|
-
const flags =
|
|
13247
|
+
const flags = _chunkNLBHLPEOcjs.resolveCloudflareProcessEnvFlags.call(void 0, wrangler);
|
|
13079
13248
|
if (!flags) return;
|
|
13080
13249
|
await fs4.writeFile(
|
|
13081
13250
|
wranglerPath,
|
|
@@ -13138,7 +13307,7 @@ async function moveVercelOutputPath(src, dest, fs4) {
|
|
|
13138
13307
|
await fs4.rename(src, dest);
|
|
13139
13308
|
return;
|
|
13140
13309
|
} catch (error) {
|
|
13141
|
-
const code = _optionalChain([error, 'optionalAccess',
|
|
13310
|
+
const code = _optionalChain([error, 'optionalAccess', _318 => _318.code]);
|
|
13142
13311
|
if (code !== "EPERM" && code !== "EACCES" && code !== "EXDEV" && code !== "ENOTEMPTY") {
|
|
13143
13312
|
throw error;
|
|
13144
13313
|
}
|
|
@@ -13164,7 +13333,7 @@ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflo
|
|
|
13164
13333
|
try {
|
|
13165
13334
|
await moveVercelOutputPath(publicDir, staticDir, fs4);
|
|
13166
13335
|
} catch (error) {
|
|
13167
|
-
if (_optionalChain([error, 'optionalAccess',
|
|
13336
|
+
if (_optionalChain([error, 'optionalAccess', _319 => _319.code]) !== "ENOENT") throw error;
|
|
13168
13337
|
}
|
|
13169
13338
|
await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4);
|
|
13170
13339
|
await copyPrismaClientForVercel(root, nitroFuncDir, fs4);
|
|
@@ -13178,7 +13347,7 @@ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflo
|
|
|
13178
13347
|
config.basePath
|
|
13179
13348
|
);
|
|
13180
13349
|
const edgeMiddlewareRoutes = edgeMiddleware.middlewareRoutes.filter(
|
|
13181
|
-
(route) => edgeMiddleware.guardedPages.some((pathname) =>
|
|
13350
|
+
(route) => edgeMiddleware.guardedPages.some((pathname) => _chunk2MR4MABGcjs.appMiddlewareMayHandlePath.call(void 0, [route], pathname))
|
|
13182
13351
|
);
|
|
13183
13352
|
if (edgeMiddlewareRoutes.length > 0) {
|
|
13184
13353
|
await writeFarmVercelEdgeMiddlewareFunction({
|
|
@@ -13206,8 +13375,8 @@ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflo
|
|
|
13206
13375
|
_chunkQMNWKQL4cjs.logger.info("\u2705 Post-processed Vercel output for Build Output API v3");
|
|
13207
13376
|
}
|
|
13208
13377
|
async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4) {
|
|
13209
|
-
if (!_optionalChain([config, 'access',
|
|
13210
|
-
const [mainRoot, ...extraRoots] =
|
|
13378
|
+
if (!_optionalChain([config, 'access', _320 => _320.docs, 'optionalAccess', _321 => _321.enabled])) return;
|
|
13379
|
+
const [mainRoot, ...extraRoots] = _chunkNAXKOTPPcjs.getFarmDocsRoots.call(void 0, config.docs);
|
|
13211
13380
|
await copyFarmDocsRootContent(
|
|
13212
13381
|
mainRoot,
|
|
13213
13382
|
root,
|
|
@@ -13228,10 +13397,10 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4) {
|
|
|
13228
13397
|
async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs4) {
|
|
13229
13398
|
const docsContentDir = resolveBuildDocsContentDir(docs, root, srcDir);
|
|
13230
13399
|
if (!docsContentDir) return;
|
|
13231
|
-
const lastModifiedManifest =
|
|
13400
|
+
const lastModifiedManifest = _chunkNAXKOTPPcjs.createFarmDocsLastModifiedManifest.call(void 0, docsContentDir, {
|
|
13232
13401
|
fallback: "now"
|
|
13233
13402
|
});
|
|
13234
|
-
const undatedPages = _nullishCoalesce(_optionalChain([lastModifiedManifest, 'access',
|
|
13403
|
+
const undatedPages = _nullishCoalesce(_optionalChain([lastModifiedManifest, 'access', _322 => _322.unknown, 'optionalAccess', _323 => _323.length]), () => ( 0));
|
|
13235
13404
|
if (undatedPages > 0) {
|
|
13236
13405
|
_chunkQMNWKQL4cjs.logger.warn(
|
|
13237
13406
|
`${undatedPages} docs page(s) were last changed before this shallow clone's Git history, so they show no "Last updated" date. Build from a full clone (git fetch --unshallow) or set lastModified in the page's frontmatter.`
|
|
@@ -13241,10 +13410,11 @@ async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs
|
|
|
13241
13410
|
await fs4.mkdir(_path2.default.dirname(bundledContentDir), { recursive: true });
|
|
13242
13411
|
await fs4.cp(docsContentDir, bundledContentDir, {
|
|
13243
13412
|
recursive: true,
|
|
13244
|
-
force: true
|
|
13413
|
+
force: true,
|
|
13414
|
+
dereference: true
|
|
13245
13415
|
});
|
|
13246
13416
|
await fs4.writeFile(
|
|
13247
|
-
_path2.default.join(bundledContentDir,
|
|
13417
|
+
_path2.default.join(bundledContentDir, _chunkNAXKOTPPcjs.FARM_DOCS_LAST_MODIFIED_MANIFEST),
|
|
13248
13418
|
`${JSON.stringify(lastModifiedManifest, null, 2)}
|
|
13249
13419
|
`
|
|
13250
13420
|
);
|
|
@@ -13270,7 +13440,7 @@ async function stageSharpRuntime(config, root, distDir, fs4, preset) {
|
|
|
13270
13440
|
if (!resolvePackageJson(projectRequire, "sharp")) {
|
|
13271
13441
|
try {
|
|
13272
13442
|
sharpRequire = _module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core"));
|
|
13273
|
-
} catch (
|
|
13443
|
+
} catch (e36) {
|
|
13274
13444
|
}
|
|
13275
13445
|
}
|
|
13276
13446
|
const copiedPackages = /* @__PURE__ */ new Map();
|
|
@@ -13315,7 +13485,7 @@ async function stageSharpRuntime(config, root, distDir, fs4, preset) {
|
|
|
13315
13485
|
try {
|
|
13316
13486
|
await copyPackage("sharp", sharpRequire);
|
|
13317
13487
|
if (!copiedPackages.has("sharp")) {
|
|
13318
|
-
throw new Error(`Farm image optimization requires sharp. ${
|
|
13488
|
+
throw new Error(`Farm image optimization requires sharp. ${_chunkKWST2O22cjs.SHARP_INSTALL_HINT}`);
|
|
13319
13489
|
}
|
|
13320
13490
|
} catch (error) {
|
|
13321
13491
|
await fs4.rm(stageDir, { recursive: true, force: true });
|
|
@@ -13397,7 +13567,7 @@ function resolveMetadataImageRuntimePackageJson(root) {
|
|
|
13397
13567
|
if (packageJsonPath) return packageJsonPath;
|
|
13398
13568
|
try {
|
|
13399
13569
|
return resolvePackageJson(_module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core")), "@vercel/og");
|
|
13400
|
-
} catch (
|
|
13570
|
+
} catch (e37) {
|
|
13401
13571
|
return null;
|
|
13402
13572
|
}
|
|
13403
13573
|
}
|
|
@@ -13444,7 +13614,7 @@ function resolvePackageJson(parentRequire, packageName) {
|
|
|
13444
13614
|
const resolved = parentRequire.resolve(request);
|
|
13445
13615
|
if (resolved.endsWith(".json")) return resolved;
|
|
13446
13616
|
_nullishCoalesce(metadataModule, () => ( (metadataModule = resolved)));
|
|
13447
|
-
} catch (
|
|
13617
|
+
} catch (e38) {
|
|
13448
13618
|
}
|
|
13449
13619
|
}
|
|
13450
13620
|
try {
|
|
@@ -13455,13 +13625,13 @@ function resolvePackageJson(parentRequire, packageName) {
|
|
|
13455
13625
|
try {
|
|
13456
13626
|
const manifest = JSON.parse(_fs.readFileSync.call(void 0, candidate, "utf8"));
|
|
13457
13627
|
if (manifest.name === packageName) return candidate;
|
|
13458
|
-
} catch (
|
|
13628
|
+
} catch (e39) {
|
|
13459
13629
|
}
|
|
13460
13630
|
}
|
|
13461
13631
|
if (_path2.default.basename(directory) === "node_modules") break;
|
|
13462
13632
|
directory = _path2.default.dirname(directory);
|
|
13463
13633
|
}
|
|
13464
|
-
} catch (
|
|
13634
|
+
} catch (e40) {
|
|
13465
13635
|
}
|
|
13466
13636
|
return null;
|
|
13467
13637
|
}
|
|
@@ -13472,7 +13642,7 @@ async function resolveProjectInstalledPackageDir(root, packageName, fs4) {
|
|
|
13472
13642
|
try {
|
|
13473
13643
|
const packageDir = await fs4.realpath(candidate);
|
|
13474
13644
|
if ((await fs4.stat(_path2.default.join(packageDir, "package.json"))).isFile()) return packageDir;
|
|
13475
|
-
} catch (
|
|
13645
|
+
} catch (e41) {
|
|
13476
13646
|
}
|
|
13477
13647
|
const parent = _path2.default.dirname(directory);
|
|
13478
13648
|
if (parent === directory) return null;
|
|
@@ -13485,7 +13655,7 @@ async function copyPrismaClientForVercel(root, nitroFuncDir, fs4) {
|
|
|
13485
13655
|
const generatedClientDir = _path2.default.join(prismaClientDir, "..", "..", ".prisma", "client");
|
|
13486
13656
|
try {
|
|
13487
13657
|
await fs4.access(generatedClientDir);
|
|
13488
|
-
} catch (
|
|
13658
|
+
} catch (e42) {
|
|
13489
13659
|
return;
|
|
13490
13660
|
}
|
|
13491
13661
|
const targetNodeModules = _path2.default.join(nitroFuncDir, "node_modules");
|
|
@@ -13545,7 +13715,7 @@ async function createFarmProjectModuleSsrEnvironment() {
|
|
|
13545
13715
|
// src/build/index.ts
|
|
13546
13716
|
async function build(config, options = {}) {
|
|
13547
13717
|
return _chunkNG2EZ6QScjs.withProductionNodeEnv.call(void 0,
|
|
13548
|
-
() =>
|
|
13718
|
+
() => _chunk2IFT2CSAcjs.withPackageClientBoundaryCache.call(void 0, () => buildWithProductionNodeEnv(config, options))
|
|
13549
13719
|
);
|
|
13550
13720
|
}
|
|
13551
13721
|
function createBuildTargetBaseline(config) {
|
|
@@ -13556,7 +13726,7 @@ function createBuildTargetBaseline(config) {
|
|
|
13556
13726
|
preset,
|
|
13557
13727
|
distDir,
|
|
13558
13728
|
outputDir,
|
|
13559
|
-
outputWasDerived: outputDir ===
|
|
13729
|
+
outputWasDerived: outputDir === _chunkKEB7AGS6cjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
|
|
13560
13730
|
};
|
|
13561
13731
|
}
|
|
13562
13732
|
function resolveBuildTargets(config, options, baseline) {
|
|
@@ -13565,8 +13735,8 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
13565
13735
|
const distDir = config.distDir || ".farm";
|
|
13566
13736
|
const outputWasReplaced = config.deploy.outputDir !== baseline.outputDir;
|
|
13567
13737
|
const shouldRefreshDerivedOutput = baseline.outputWasDerived && !outputWasReplaced && (preset !== baseline.preset || distDir !== baseline.distDir);
|
|
13568
|
-
const deployTarget = preset === config.deploy.preset ? config.deploy.target :
|
|
13569
|
-
const outputDir = shouldRefreshDerivedOutput ?
|
|
13738
|
+
const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunkKEB7AGS6cjs.getDeployTargetForPreset.call(void 0, preset);
|
|
13739
|
+
const outputDir = shouldRefreshDerivedOutput ? _chunkKEB7AGS6cjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
|
|
13570
13740
|
return {
|
|
13571
13741
|
root,
|
|
13572
13742
|
preset,
|
|
@@ -13574,7 +13744,7 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
13574
13744
|
distDir,
|
|
13575
13745
|
deployTarget,
|
|
13576
13746
|
outputDir,
|
|
13577
|
-
deployOutputDir:
|
|
13747
|
+
deployOutputDir: _chunkKEB7AGS6cjs.resolveDeployOutputPath.call(void 0, root, outputDir)
|
|
13578
13748
|
};
|
|
13579
13749
|
}
|
|
13580
13750
|
async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
@@ -13582,7 +13752,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
13582
13752
|
const targetBaseline = createBuildTargetBaseline(config);
|
|
13583
13753
|
let targets;
|
|
13584
13754
|
const productionViteResultPromise = options.universal === false ? void 0 : Promise.allSettled([Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkMF3IA2AWcjs.loadFarmProductionVite.call(void 0, ))))]);
|
|
13585
|
-
const pluginManager = new (0,
|
|
13755
|
+
const pluginManager = new (0, _chunkPMU4U2W2cjs.PluginManager)({
|
|
13586
13756
|
config,
|
|
13587
13757
|
isDev: false,
|
|
13588
13758
|
isProd: true
|
|
@@ -13611,15 +13781,15 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
13611
13781
|
};
|
|
13612
13782
|
config = {
|
|
13613
13783
|
...config,
|
|
13614
|
-
images:
|
|
13784
|
+
images: _chunkKWST2O22cjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
|
|
13615
13785
|
root: targets.root,
|
|
13616
13786
|
preset: targets.preset
|
|
13617
13787
|
})
|
|
13618
13788
|
};
|
|
13619
|
-
if (_optionalChain([config, 'access',
|
|
13789
|
+
if (_optionalChain([config, 'access', _324 => _324.docs, 'optionalAccess', _325 => _325.enabled])) await _chunkV3UOEWCBcjs.loadFarmDocsEngine.call(void 0, );
|
|
13620
13790
|
pluginManager.updateContext({ config });
|
|
13621
13791
|
const { root, preset, srcDir, distDir, deployOutputDir } = targets;
|
|
13622
|
-
|
|
13792
|
+
_chunk2IFT2CSAcjs.usePackageClientBoundaryCacheFile.call(void 0, _chunk2IFT2CSAcjs.resolvePackageClientBoundaryCacheFile.call(void 0, root, distDir));
|
|
13623
13793
|
_chunkQMNWKQL4cjs.logger.info(`\u{1F69C} Building Farm.js application with preset: ${preset}...`);
|
|
13624
13794
|
await pluginManager.setupPlugins();
|
|
13625
13795
|
await pluginManager.runHookParallel("beforeBundle", {
|
|
@@ -13631,8 +13801,8 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
13631
13801
|
});
|
|
13632
13802
|
_chunkQMNWKQL4cjs.logger.info("\u{1F50D} Discovering routes and API endpoints...");
|
|
13633
13803
|
const productionViteResult = productionViteResultPromise ? (await productionViteResultPromise)[0] : void 0;
|
|
13634
|
-
if (_optionalChain([productionViteResult, 'optionalAccess',
|
|
13635
|
-
const productionVite = _optionalChain([productionViteResult, 'optionalAccess',
|
|
13804
|
+
if (_optionalChain([productionViteResult, 'optionalAccess', _326 => _326.status]) === "rejected") throw productionViteResult.reason;
|
|
13805
|
+
const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _327 => _327.value]);
|
|
13636
13806
|
const createViteServer = productionVite ? productionVite.createServer : (await import("vite")).createServer;
|
|
13637
13807
|
projectModuleServer = await createProjectModuleServer(
|
|
13638
13808
|
createViteServer,
|
|
@@ -13640,18 +13810,18 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
13640
13810
|
root,
|
|
13641
13811
|
rendererBuild.signal
|
|
13642
13812
|
);
|
|
13643
|
-
const farmApp =
|
|
13813
|
+
const farmApp = _chunkKWST2O22cjs.createFarmApp.call(void 0, config, projectModuleServer);
|
|
13644
13814
|
await farmApp.initialize();
|
|
13645
13815
|
const routeManager = farmApp.getRouteManager();
|
|
13646
13816
|
const serverRenderer = farmApp.getServerRenderer();
|
|
13647
|
-
const typeArtifacts =
|
|
13817
|
+
const typeArtifacts = _chunkCSQPMV3Qcjs.generateFarmTypeArtifacts.call(void 0, {
|
|
13648
13818
|
root,
|
|
13649
13819
|
srcDir,
|
|
13650
13820
|
layers: config.layers,
|
|
13651
13821
|
plugins: config.plugins,
|
|
13652
13822
|
extraRoutes: [
|
|
13653
|
-
..._optionalChain([config, 'access',
|
|
13654
|
-
...
|
|
13823
|
+
..._optionalChain([config, 'access', _328 => _328.openapi, 'optionalAccess', _329 => _329.enabled]) && config.openapi.route ? [config.openapi.route] : [],
|
|
13824
|
+
..._chunkNAXKOTPPcjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
|
|
13655
13825
|
],
|
|
13656
13826
|
suppressLintOnLink: config.suppressLintOnLink,
|
|
13657
13827
|
componentExtensions: config.renderer.componentExtensions,
|
|
@@ -13660,7 +13830,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
13660
13830
|
const message = error instanceof Error ? error.message : String(error);
|
|
13661
13831
|
_chunkQMNWKQL4cjs.logger.warn(`Route type generation failed (farm.d.ts may be stale): ${message}`);
|
|
13662
13832
|
});
|
|
13663
|
-
const apiRouteManager = new (0,
|
|
13833
|
+
const apiRouteManager = new (0, _chunkK66JILV3cjs.APIRouteManager)(
|
|
13664
13834
|
_chunkMTBDJ326cjs.getFarmAppDirectories.call(void 0, config),
|
|
13665
13835
|
projectModuleServer,
|
|
13666
13836
|
{
|
|
@@ -13735,7 +13905,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
13735
13905
|
throw error;
|
|
13736
13906
|
} finally {
|
|
13737
13907
|
try {
|
|
13738
|
-
await _optionalChain([projectModuleServer, 'optionalAccess',
|
|
13908
|
+
await _optionalChain([projectModuleServer, 'optionalAccess', _330 => _330.close, 'call', _331 => _331()]);
|
|
13739
13909
|
} finally {
|
|
13740
13910
|
rendererBuild.abort();
|
|
13741
13911
|
}
|
|
@@ -13747,7 +13917,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
13747
13917
|
ssr: true,
|
|
13748
13918
|
buildLifetime
|
|
13749
13919
|
});
|
|
13750
|
-
const viteConfig =
|
|
13920
|
+
const viteConfig = _chunkKWST2O22cjs.mergeFarmViteConfig.call(void 0,
|
|
13751
13921
|
{
|
|
13752
13922
|
root,
|
|
13753
13923
|
appType: "custom",
|
|
@@ -13759,12 +13929,12 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
13759
13929
|
},
|
|
13760
13930
|
plugins: [
|
|
13761
13931
|
...rendererVitePlugins,
|
|
13762
|
-
|
|
13932
|
+
_chunkKWST2O22cjs.farmFontImportsPlugin.call(void 0, {
|
|
13763
13933
|
root,
|
|
13764
13934
|
basePath: config.basePath,
|
|
13765
13935
|
publicDir: config.publicDir
|
|
13766
13936
|
}),
|
|
13767
|
-
|
|
13937
|
+
_chunk2IFT2CSAcjs.farmEnvironmentFunctionsPlugin.call(void 0, ),
|
|
13768
13938
|
// Route modules load here at build time (rendering config, prerendering): `server-only`
|
|
13769
13939
|
// resolves as it does in the server build. Module-entry packages load pre-bundled, as in
|
|
13770
13940
|
// `farm dev`: unbundled, lucide-react alone is ~1,750 modules through the module runner,
|
|
@@ -13776,7 +13946,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
13776
13946
|
hmr: false
|
|
13777
13947
|
},
|
|
13778
13948
|
resolve: {
|
|
13779
|
-
alias:
|
|
13949
|
+
alias: _chunkKWST2O22cjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
13780
13950
|
dedupe: [...config.renderer.dedupe || []]
|
|
13781
13951
|
},
|
|
13782
13952
|
optimizeDeps: {
|
|
@@ -13815,10 +13985,10 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
13815
13985
|
noDiscovery: true
|
|
13816
13986
|
},
|
|
13817
13987
|
// An app or plugin that brings its own SSR environment keeps it.
|
|
13818
|
-
environments: _optionalChain([viteConfig, 'access',
|
|
13988
|
+
environments: _optionalChain([viteConfig, 'access', _332 => _332.environments, 'optionalAccess', _333 => _333.ssr, 'optionalAccess', _334 => _334.dev, 'optionalAccess', _335 => _335.createEnvironment]) ? viteConfig.environments : {
|
|
13819
13989
|
...viteConfig.environments,
|
|
13820
13990
|
ssr: {
|
|
13821
|
-
..._optionalChain([viteConfig, 'access',
|
|
13991
|
+
..._optionalChain([viteConfig, 'access', _336 => _336.environments, 'optionalAccess', _337 => _337.ssr]),
|
|
13822
13992
|
...await createFarmProjectModuleSsrEnvironment()
|
|
13823
13993
|
}
|
|
13824
13994
|
}
|
|
@@ -13826,7 +13996,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
13826
13996
|
}
|
|
13827
13997
|
async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
|
|
13828
13998
|
const { farmI18nClientBridgePlugin, farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.cjs");
|
|
13829
|
-
const { PluginManager: PluginManager2 } = await import("./plugin-
|
|
13999
|
+
const { PluginManager: PluginManager2 } = await import("./plugin-5PIQQVRP.cjs");
|
|
13830
14000
|
const pluginManager = new PluginManager2({
|
|
13831
14001
|
config,
|
|
13832
14002
|
isDev: false,
|
|
@@ -13846,14 +14016,14 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
|
|
|
13846
14016
|
farmI18nClientBridgePlugin(),
|
|
13847
14017
|
farmServerOnlyEntriesPlugin(),
|
|
13848
14018
|
farmPlugin(config, pluginManager),
|
|
13849
|
-
|
|
14019
|
+
_chunk2IFT2CSAcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
|
|
13850
14020
|
],
|
|
13851
14021
|
mode: "production"
|
|
13852
14022
|
});
|
|
13853
14023
|
}
|
|
13854
14024
|
async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
|
|
13855
14025
|
const { farmI18nClientBridgePlugin, farmPlugin } = await import("./vite.cjs");
|
|
13856
|
-
const { PluginManager: PluginManager2 } = await import("./plugin-
|
|
14026
|
+
const { PluginManager: PluginManager2 } = await import("./plugin-5PIQQVRP.cjs");
|
|
13857
14027
|
const pluginManager = new PluginManager2({
|
|
13858
14028
|
config,
|
|
13859
14029
|
isDev: false,
|
|
@@ -13874,12 +14044,12 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
|
|
|
13874
14044
|
define: {
|
|
13875
14045
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
13876
14046
|
__FARM_ENV__: JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, config.env)),
|
|
13877
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
14047
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _338 => _338.env, 'optionalAccess', _339 => _339.public]) || {})
|
|
13878
14048
|
},
|
|
13879
14049
|
plugins: [
|
|
13880
14050
|
farmI18nClientBridgePlugin(),
|
|
13881
14051
|
farmPlugin(config, pluginManager),
|
|
13882
|
-
|
|
14052
|
+
_chunk2IFT2CSAcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
|
|
13883
14053
|
],
|
|
13884
14054
|
mode: "production"
|
|
13885
14055
|
});
|
|
@@ -13894,7 +14064,7 @@ function resolveLegacyPageEntry(config, root, srcDir) {
|
|
|
13894
14064
|
}
|
|
13895
14065
|
async function buildNitro(config, routeManager, apiRouteManager, serverRenderer, preset, root, distDir, pluginManager) {
|
|
13896
14066
|
const [{ createNitroConfig }, { createNitro, build: nitroBuild }] = await Promise.all([
|
|
13897
|
-
import("./nitro-
|
|
14067
|
+
import("./nitro-2LMOMIST.cjs"),
|
|
13898
14068
|
import("nitro/builder")
|
|
13899
14069
|
]);
|
|
13900
14070
|
let nitroConfig = await createNitroConfig(
|
|
@@ -13907,7 +14077,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
13907
14077
|
if (pluginManager) {
|
|
13908
14078
|
nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
|
|
13909
14079
|
}
|
|
13910
|
-
const outputDir =
|
|
14080
|
+
const outputDir = _chunkKEB7AGS6cjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
13911
14081
|
const serverOutputDir = _path2.default.join(outputDir, "server");
|
|
13912
14082
|
const publicOutputDir = _path2.default.join(outputDir, "public");
|
|
13913
14083
|
const { mkdir, cp } = await import("fs/promises");
|
|
@@ -13966,7 +14136,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
13966
14136
|
const { readFile } = await import("fs/promises");
|
|
13967
14137
|
const manifestContent = await readFile(clientManifestPath, "utf-8");
|
|
13968
14138
|
farmRegistry.clientManifest = JSON.parse(manifestContent);
|
|
13969
|
-
} catch (
|
|
14139
|
+
} catch (e43) {
|
|
13970
14140
|
farmRegistry.clientManifest = {};
|
|
13971
14141
|
}
|
|
13972
14142
|
} catch (error) {
|
|
@@ -13978,7 +14148,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
13978
14148
|
root,
|
|
13979
14149
|
preset,
|
|
13980
14150
|
distDir,
|
|
13981
|
-
outputDir:
|
|
14151
|
+
outputDir: _chunkKEB7AGS6cjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
|
|
13982
14152
|
});
|
|
13983
14153
|
}
|
|
13984
14154
|
}
|