@farm.js/core 0.1.67 → 0.1.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-mcp.d-BFu9xHAi.d.ts → agent-mcp.d-Uh5xr7aX.d.ts} +1 -1
- package/dist/{agent-mcp.d-DWyWkTSy.d.mts → agent-mcp.d-wkVPK1GA.d.mts} +1 -1
- package/dist/agent-runtime.d.mts +5 -3
- package/dist/agent-runtime.d.ts +5 -3
- package/dist/{analyzer-TTIIXXMQ.mjs → analyzer-CQDU7E3Y.mjs} +2 -2
- package/dist/analyzer-PPAHM4AW.cjs +16 -0
- package/dist/api/node.d.mts +7 -5
- package/dist/api/node.d.ts +7 -5
- package/dist/api/route-manager.d.mts +7 -5
- package/dist/api/route-manager.d.ts +7 -5
- package/dist/api/runtime.d.mts +6 -4
- package/dist/api/runtime.d.ts +6 -4
- package/dist/api.d.mts +8 -6
- package/dist/api.d.ts +8 -6
- package/dist/{app-manifest.d-CwfhGrVR.d.ts → app-manifest.d-BT5i2F-o.d.ts} +1 -1
- package/dist/{app-manifest.d-CRmjN5j9.d.mts → app-manifest.d-Dd4q5CFx.d.mts} +1 -1
- package/dist/app-markdown.cjs +3 -3
- package/dist/app-markdown.d.mts +10 -10
- package/dist/app-markdown.d.ts +10 -10
- package/dist/app-markdown.mjs +2 -2
- package/dist/{app.d-BX9LVTiP.d.ts → app.d-BVOpL_f2.d.ts} +6 -6
- package/dist/{app.d-uBBUxwyV.d.mts → app.d-BhiDXex_.d.mts} +6 -6
- package/dist/{chunk-23PVOIPT.cjs → chunk-225APHKC.cjs} +3 -3
- package/dist/{chunk-4JX3M4C6.cjs → chunk-23VJEGKC.cjs} +2 -1
- package/dist/{chunk-Q37INCXG.cjs → chunk-3EEINK7G.cjs} +11 -2
- package/dist/{chunk-BRWIVOV4.cjs → chunk-3GNHJ3RN.cjs} +10 -8
- package/dist/{chunk-QJVW76JG.mjs → chunk-3Y52TWYU.mjs} +2 -2
- package/dist/{chunk-OB3IFUK6.cjs → chunk-437QZIC2.cjs} +4 -4
- package/dist/{chunk-WGHY3OL5.mjs → chunk-4UAQB5LB.mjs} +232 -49
- package/dist/{chunk-JWSI5WO4.mjs → chunk-4ZXKYCYK.mjs} +1 -1
- package/dist/{chunk-N35YPV4N.mjs → chunk-57QAQU4F.mjs} +9 -7
- package/dist/{chunk-AQDLVHNF.mjs → chunk-5FBZJJGA.mjs} +17 -0
- package/dist/{chunk-PL6RTBDE.cjs → chunk-5JKDFRTK.cjs} +2 -2
- package/dist/{chunk-CO3YMZFD.mjs → chunk-6OFOIMNS.mjs} +1 -1
- package/dist/{chunk-556H7JCE.cjs → chunk-7LK5CTUM.cjs} +14 -14
- package/dist/{chunk-E6CD45JK.mjs → chunk-A3T445WK.mjs} +19 -5
- package/dist/{chunk-DQJ2CIH7.cjs → chunk-ASYOWPSR.cjs} +2 -1
- package/dist/{chunk-QGJ4FI2G.mjs → chunk-C6HGUTXB.mjs} +113 -29
- package/dist/{chunk-IRA2CZAY.mjs → chunk-CRVSYDHV.mjs} +2 -2
- package/dist/{chunk-XNZWMXCF.mjs → chunk-DIXFKAPM.mjs} +183 -76
- package/dist/{chunk-QGQP6QKO.cjs → chunk-DWLNLU55.cjs} +2 -2
- package/dist/{chunk-52Y3C3HG.mjs → chunk-E7VF3LQ5.mjs} +3 -2
- package/dist/{chunk-N5DQMOAG.cjs → chunk-F36LS2C7.cjs} +273 -90
- package/dist/{chunk-H37MDCPR.mjs → chunk-F6CMGWAL.mjs} +1 -1
- package/dist/{chunk-HNVAZGQD.cjs → chunk-FJMC24KG.cjs} +2 -2
- package/dist/{chunk-KCY52OUQ.cjs → chunk-FSODPZRT.cjs} +1 -1
- package/dist/{chunk-PPX7UOFY.cjs → chunk-FVYBEMOD.cjs} +55 -38
- package/dist/{chunk-6YBYX4K4.mjs → chunk-G7NBPP7H.mjs} +1 -1
- package/dist/{chunk-HFHJJXSV.mjs → chunk-GFPS7MNE.mjs} +1 -1
- package/dist/{chunk-3T5TLFCQ.mjs → chunk-HEJM46HQ.mjs} +11 -2
- package/dist/chunk-HHLEYA4B.cjs +17 -0
- package/dist/{chunk-F43OG25P.cjs → chunk-I7J5RLGO.cjs} +15 -1
- package/dist/chunk-ICFPTHXM.mjs +97 -0
- package/dist/{chunk-6V5YWI4W.cjs → chunk-IGDYL2IA.cjs} +2 -2
- package/dist/{chunk-TEG6HJVF.mjs → chunk-JL2YW5KX.mjs} +1 -0
- package/dist/{chunk-JVM3DKZE.mjs → chunk-KDO6T6OB.mjs} +1 -1
- package/dist/{chunk-QITSS4TD.cjs → chunk-KWCZKJYU.cjs} +352 -245
- package/dist/{chunk-DCXSIEFE.cjs → chunk-LDEXTX4I.cjs} +51 -37
- package/dist/{chunk-3T7ALZJF.cjs → chunk-LR4KP3I7.cjs} +2 -2
- package/dist/{chunk-VFXE6NWR.mjs → chunk-MGKWYPE3.mjs} +2 -1
- package/dist/{chunk-5TA63JD3.mjs → chunk-MGZVDX4R.mjs} +1 -1
- package/dist/{chunk-6SQZXRJ2.cjs → chunk-MMDKYJ5V.cjs} +7 -7
- package/dist/{chunk-HP2DQGQH.mjs → chunk-MNJDNTGO.mjs} +1 -1
- package/dist/{chunk-5Y2P454O.cjs → chunk-MTBDJ326.cjs} +6 -5
- package/dist/{chunk-XUES6OET.mjs → chunk-MV7NWU23.mjs} +1 -1
- package/dist/{chunk-4DRINDGN.cjs → chunk-MZ4CRSY7.cjs} +254 -125
- package/dist/{chunk-4IHMHFQB.cjs → chunk-NG2EZ6QS.cjs} +28 -1
- package/dist/{chunk-WDD5CTZW.mjs → chunk-NT4W4H52.mjs} +6 -6
- package/dist/{chunk-F7JKVHU2.mjs → chunk-NVOMQLI2.mjs} +15 -1
- package/dist/{chunk-22IWL4YD.cjs → chunk-OCNV4CI2.cjs} +21 -2
- package/dist/{chunk-72KCTHLV.cjs → chunk-PRL7FXG4.cjs} +113 -29
- package/dist/{chunk-YVTS3S3F.cjs → chunk-QOGIZKSO.cjs} +3 -3
- package/dist/{chunk-DB2HSHQA.cjs → chunk-QSUYB3RH.cjs} +14 -14
- package/dist/chunk-QYNZ3CTI.mjs +17 -0
- package/dist/{chunk-724MGMIL.mjs → chunk-R2ZHU37O.mjs} +19 -0
- package/dist/{chunk-YQYTQJZN.mjs → chunk-RLH5AH2M.mjs} +1 -1
- package/dist/{chunk-HM7AGSKU.cjs → chunk-SQ6IWJ3H.cjs} +1 -1
- package/dist/{chunk-V5MQMQ2P.mjs → chunk-T5XFZQCL.mjs} +1 -1
- package/dist/{chunk-Q5UX55YA.cjs → chunk-TNK2TVRS.cjs} +831 -470
- package/dist/{chunk-J7JHVCWA.cjs → chunk-UKZ6AWKZ.cjs} +2 -1
- package/dist/{chunk-V5RTHYJB.cjs → chunk-URN7VFO7.cjs} +91 -22
- package/dist/{chunk-HRPTMX5C.mjs → chunk-VFNAK6A5.mjs} +2 -2
- package/dist/{chunk-VK54PDQ6.mjs → chunk-VRGY3X2I.mjs} +86 -17
- package/dist/chunk-W44X6IC2.cjs +97 -0
- package/dist/{chunk-GTV2ABO7.mjs → chunk-WPB67LE5.mjs} +162 -33
- package/dist/{chunk-UHE5JUKB.mjs → chunk-XCAQTCGK.mjs} +1 -1
- package/dist/{chunk-DGOFR7D5.cjs → chunk-Y6KHPJDB.cjs} +2 -2
- package/dist/{chunk-LPIZMU7D.cjs → chunk-YTNBCXCW.cjs} +4 -4
- package/dist/{chunk-KWFNUODD.mjs → chunk-YVPX5PI5.mjs} +1 -0
- package/dist/{chunk-6R53ZWX2.cjs → chunk-Z3PW3DIR.cjs} +3 -3
- package/dist/{chunk-UHNSY2PQ.mjs → chunk-Z6SOXHAD.mjs} +772 -411
- package/dist/{chunk-5FE5YT2N.mjs → chunk-ZZGQD3LL.mjs} +28 -1
- package/dist/{client-component.d-CDRvRmbU.d.mts → client-component.d-BvQOxSqh.d.mts} +2 -2
- package/dist/{client-component.d-DWRKyAp5.d.ts → client-component.d-DNVSLEPi.d.ts} +2 -2
- package/dist/{client-plugins.d-BNILjfX3.d.mts → client-plugins.d-CE1lVK2R.d.mts} +23 -234
- package/dist/{client-plugins.d-CrKZiNSN.d.ts → client-plugins.d-CNDqcAuf.d.ts} +23 -234
- package/dist/client-plugins.d.mts +5 -3
- package/dist/client-plugins.d.ts +5 -3
- package/dist/client.cjs +6 -6
- package/dist/client.d.mts +10 -8
- package/dist/client.d.ts +10 -8
- package/dist/client.mjs +5 -5
- package/dist/config.d.mts +5 -3
- package/dist/config.d.ts +5 -3
- package/dist/deployment.cjs +4 -2
- package/dist/deployment.d.mts +15 -1
- package/dist/deployment.d.ts +15 -1
- package/dist/deployment.mjs +3 -1
- package/dist/desktop.d.mts +6 -4
- package/dist/desktop.d.ts +6 -4
- package/dist/{devtools-UFQYT3VA.mjs → devtools-2A2GPC7B.mjs} +6 -6
- package/dist/{devtools-RZVT4JVN.cjs → devtools-R27T3BRY.cjs} +7 -7
- package/dist/docs.cjs +9 -9
- package/dist/docs.d.mts +6 -4
- package/dist/docs.d.ts +6 -4
- package/dist/docs.mjs +8 -8
- package/dist/environment/vite.cjs +5 -5
- package/dist/environment/vite.d.mts +1 -1
- package/dist/environment/vite.d.ts +1 -1
- package/dist/environment/vite.mjs +4 -4
- package/dist/{generate-route-types.d-BL2pq6xC.d.ts → generate-route-types.d-B76M5R11.d.ts} +1 -1
- package/dist/{generate-route-types.d-BoVDU8qX.d.mts → generate-route-types.d-CaGMIaNI.d.mts} +1 -1
- package/dist/index.cjs +41 -36
- package/dist/{index.d-Bdm6866n.d.mts → index.d-Bt3kl19W.d.mts} +1 -1
- package/dist/{index.d-Dey5T14f.d.ts → index.d-Cx_-DaKV.d.ts} +1 -1
- package/dist/index.d.mts +25 -22
- package/dist/index.d.ts +25 -22
- package/dist/index.mjs +43 -38
- package/dist/instrumentation.cjs +3 -3
- package/dist/instrumentation.mjs +2 -2
- package/dist/integrations/orm.d.mts +5 -3
- package/dist/integrations/orm.d.ts +5 -3
- package/dist/integrations.d.mts +5 -3
- package/dist/integrations.d.ts +5 -3
- package/dist/internal/app-markdown-runtime.cjs +2 -2
- package/dist/internal/app-markdown-runtime.d.mts +12 -5
- package/dist/internal/app-markdown-runtime.d.ts +12 -5
- package/dist/internal/app-markdown-runtime.mjs +1 -1
- package/dist/internal/build-runtime.cjs +33 -30
- package/dist/internal/build-runtime.d.mts +7 -5
- package/dist/internal/build-runtime.d.ts +7 -5
- package/dist/internal/build-runtime.mjs +32 -29
- package/dist/internal/cli-runtime.cjs +10 -10
- package/dist/internal/cli-runtime.mjs +9 -9
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.cjs +31 -36
- package/dist/internal/client-runtime.d.mts +8 -6
- package/dist/internal/client-runtime.d.ts +8 -6
- package/dist/internal/client-runtime.mjs +22 -27
- package/dist/internal/compression-runtime.d.mts +5 -3
- package/dist/internal/compression-runtime.d.ts +5 -3
- package/dist/internal/config-runtime.cjs +8 -8
- package/dist/internal/config-runtime.d.mts +9 -7
- package/dist/internal/config-runtime.d.ts +9 -7
- package/dist/internal/config-runtime.mjs +7 -7
- package/dist/internal/form-actions.cjs +7 -2
- package/dist/internal/form-actions.d.mts +10 -3
- package/dist/internal/form-actions.d.ts +10 -3
- package/dist/internal/form-actions.mjs +8 -3
- package/dist/internal/infra-analytics-runtime.cjs +6 -6
- package/dist/internal/infra-analytics-runtime.mjs +4 -4
- package/dist/internal/islands-boot.cjs +6 -1
- package/dist/internal/islands-boot.mjs +6 -1
- 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-node-env.cjs +4 -2
- package/dist/internal/production-node-env.d.mts +22 -1
- package/dist/internal/production-node-env.d.ts +22 -1
- package/dist/internal/production-node-env.mjs +3 -1
- package/dist/internal/production-runtime.cjs +13 -9
- package/dist/internal/production-runtime.d.mts +21 -16
- package/dist/internal/production-runtime.d.ts +21 -16
- package/dist/internal/production-runtime.mjs +13 -9
- package/dist/internal/server-tree.cjs +2 -2
- package/dist/internal/server-tree.d.mts +0 -5
- package/dist/internal/server-tree.d.ts +0 -5
- package/dist/internal/server-tree.mjs +1 -1
- package/dist/internal/vercel-edge-middleware.cjs +87 -0
- package/dist/internal/vercel-edge-middleware.d.mts +39 -0
- package/dist/internal/vercel-edge-middleware.d.ts +39 -0
- package/dist/internal/vercel-edge-middleware.mjs +87 -0
- package/dist/layers-7P4RLKVX.cjs +20 -0
- package/dist/{layers-T55SA47E.mjs → layers-XQ7VFMWO.mjs} +4 -2
- package/dist/{layers.d-CcS42OGR.d.mts → layers.d-CH0bC4QL.d.mts} +2 -1
- package/dist/{layers.d-CcS42OGR.d.ts → layers.d-CH0bC4QL.d.ts} +2 -1
- package/dist/markdown.d.mts +5 -3
- package/dist/markdown.d.ts +5 -3
- package/dist/middleware.cjs +4 -4
- package/dist/middleware.d.mts +8 -5
- package/dist/middleware.d.ts +8 -5
- package/dist/middleware.mjs +6 -6
- package/dist/mobile.d.mts +4 -4
- package/dist/mobile.d.ts +4 -4
- package/dist/{mount.d-BP0nLYQO.d.mts → mount.d-Bki4pOaJ.d.mts} +1 -1
- package/dist/{mount.d-CkiPky_F.d.ts → mount.d-DjR5aerM.d.ts} +1 -1
- package/dist/{navigation-delegate.d-DchcGzAQ.d.ts → navigation-delegate.d-CtghaSP3.d.ts} +1 -1
- package/dist/{navigation-delegate.d-CdBP-hkZ.d.mts → navigation-delegate.d-VDkziXTK.d.mts} +1 -1
- package/dist/navigation.cjs +5 -5
- package/dist/navigation.d.mts +8 -6
- package/dist/navigation.d.ts +8 -6
- package/dist/navigation.mjs +4 -4
- package/dist/{nitro-55YOZWRA.mjs → nitro-NSTXT7LB.mjs} +2 -2
- package/dist/{nitro-EEX2J3KB.cjs → nitro-Y3LGITW3.cjs} +4 -4
- package/dist/node-module-bundle-LIZ2KMVW.cjs +13 -0
- package/dist/node-module-bundle-VR6NV6AI.mjs +13 -0
- package/dist/plugin.cjs +20 -20
- package/dist/plugin.d.mts +7 -5
- package/dist/plugin.d.ts +7 -5
- package/dist/plugin.mjs +19 -19
- package/dist/{production-runtime.d-Dou_Htas.d.ts → production-runtime.d-BMyyLGBB.d.ts} +3 -57
- package/dist/{production-runtime.d-VwsBzIee.d.mts → production-runtime.d-DMZY3OgV.d.mts} +3 -57
- package/dist/query/client.cjs +6 -6
- package/dist/query/client.mjs +2 -2
- package/dist/{render-plan.d-LKymStDJ.d.mts → render-plan.d-BSwV8PE4.d.mts} +1 -1
- package/dist/{render-plan.d-D8UakAIk.d.ts → render-plan.d-i9sI4tc9.d.ts} +1 -1
- package/dist/renderer/react/server.cjs +2 -2
- package/dist/renderer/react/server.mjs +1 -1
- package/dist/renderer-client.cjs +5 -5
- package/dist/renderer-client.d.mts +8 -6
- package/dist/renderer-client.d.ts +8 -6
- package/dist/renderer-client.mjs +2 -2
- package/dist/renderer.d.mts +5 -0
- package/dist/renderer.d.ts +5 -0
- package/dist/{request.d-KG-4d2eG.d.mts → request.d-C24FNQ_7.d.mts} +1 -1
- package/dist/{request.d-B928QjWy.d.ts → request.d-Dgln8tuI.d.ts} +1 -1
- package/dist/request.d.mts +6 -4
- package/dist/request.d.ts +6 -4
- package/dist/{route-rendering.d-DoEe_w9t.d.ts → route-rendering.d-CUylZKJA.d.ts} +1 -1
- package/dist/{route-rendering.d-NIHQeb4m.d.mts → route-rendering.d-Ds0BfwQi.d.mts} +1 -1
- package/dist/{router.d-DYnRHQwz.d.ts → router.d-B56rMOFm.d.ts} +1 -1
- package/dist/{router.d-B8PkJSGp.d.mts → router.d-CFPcbqzc.d.mts} +1 -1
- package/dist/{routes.d-uUBZyWoK.d.ts → routes.d-9GFFNioh.d.ts} +1 -1
- package/dist/{routes.d-DgZ_jgGG.d.mts → routes.d-CrEy0lJS.d.mts} +1 -1
- package/dist/routes.d.mts +5 -3
- package/dist/routes.d.ts +5 -3
- package/dist/{rsc-pipeline-7K5H2RPH.cjs → rsc-pipeline-3T7V6OUT.cjs} +10 -9
- package/dist/{rsc-pipeline-4OJ5ZQNZ.mjs → rsc-pipeline-GA4AQWZI.mjs} +9 -8
- package/dist/{runtime-X52Q7JFR.cjs → runtime-REUTNTI5.cjs} +20 -20
- package/dist/{runtime-U7O3HZOZ.mjs → runtime-ZYCKKY7L.mjs} +12 -12
- package/dist/{runtime.d-BxQIzwfy.d.mts → runtime.d-DLRO-ExG.d.mts} +1 -1
- package/dist/{runtime.d-DP7mEkEF.d.ts → runtime.d-H7k9hOQE.d.ts} +1 -1
- package/dist/server-http.d-rAe7lAQc.d.mts +70 -0
- package/dist/server-http.d-rAe7lAQc.d.ts +70 -0
- package/dist/server-plugins.d.mts +6 -4
- package/dist/server-plugins.d.ts +6 -4
- package/dist/server.cjs +46 -44
- package/dist/server.d-C5FFrZAo.d.ts +57 -0
- package/dist/server.d-DgC8xew5.d.mts +57 -0
- package/dist/server.d.mts +13 -11
- package/dist/server.d.ts +13 -11
- package/dist/server.mjs +28 -26
- package/dist/{spa-router.d-DsFDHTsv.d.ts → spa-router.d-Dr7oanhl.d.ts} +2 -2
- package/dist/{spa-router.d-BgHPVMhz.d.mts → spa-router.d-g4CzhEH1.d.mts} +2 -2
- package/dist/testing.d.mts +5 -3
- package/dist/testing.d.ts +5 -3
- package/dist/types.d-xCIhyjOq.d.mts +233 -0
- package/dist/types.d-xCIhyjOq.d.ts +233 -0
- package/dist/{utils.d-zxAVcf_V.d.ts → utils.d-BxxyDEb8.d.ts} +1 -1
- package/dist/{utils.d-BKyKDBR1.d.mts → utils.d-HIla3pD_.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +20 -20
- package/dist/vite.d.mts +10 -8
- package/dist/vite.d.ts +10 -8
- package/dist/vite.mjs +19 -19
- package/dist/workflows.cjs +2 -2
- package/dist/workflows.d.mts +121 -1
- package/dist/workflows.d.ts +121 -1
- package/dist/workflows.mjs +1 -1
- package/package.json +7 -2
- package/dist/analyzer-KVZGVY5Q.cjs +0 -16
- package/dist/chunk-CLFEQGET.cjs +0 -60
- package/dist/chunk-MK5E44WP.mjs +0 -60
- package/dist/layers-DMRXRL7F.cjs +0 -18
- package/dist/node-module-bundle-7JHPPF6B.mjs +0 -11
- package/dist/node-module-bundle-YJGYBOGK.cjs +0 -11
- package/dist/workflows.d-CRMzQZ3k.d.mts +0 -188
- package/dist/workflows.d-CRMzQZ3k.d.ts +0 -188
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
+
var _chunkHHLEYA4Bcjs = require('./chunk-HHLEYA4B.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
3
6
|
|
|
4
7
|
|
|
5
8
|
|
|
@@ -9,6 +12,7 @@
|
|
|
9
12
|
var _chunkE5UN4OWXcjs = require('./chunk-E5UN4OWX.cjs');
|
|
10
13
|
|
|
11
14
|
|
|
15
|
+
var _chunkMF3IA2AWcjs = require('./chunk-MF3IA2AW.cjs');
|
|
12
16
|
|
|
13
17
|
|
|
14
18
|
|
|
@@ -18,14 +22,14 @@ var _chunkE5UN4OWXcjs = require('./chunk-E5UN4OWX.cjs');
|
|
|
18
22
|
|
|
19
23
|
|
|
20
24
|
|
|
21
|
-
var _chunk4IHMHFQBcjs = require('./chunk-4IHMHFQB.cjs');
|
|
22
25
|
|
|
23
26
|
|
|
24
|
-
var _chunkMF3IA2AWcjs = require('./chunk-MF3IA2AW.cjs');
|
|
25
27
|
|
|
28
|
+
var _chunkNG2EZ6QScjs = require('./chunk-NG2EZ6QS.cjs');
|
|
26
29
|
|
|
27
30
|
|
|
28
|
-
|
|
31
|
+
|
|
32
|
+
var _chunk225APHKCcjs = require('./chunk-225APHKC.cjs');
|
|
29
33
|
|
|
30
34
|
|
|
31
35
|
var _chunkVM57CK74cjs = require('./chunk-VM57CK74.cjs');
|
|
@@ -38,7 +42,9 @@ var _chunk4BS3HSY7cjs = require('./chunk-4BS3HSY7.cjs');
|
|
|
38
42
|
|
|
39
43
|
|
|
40
44
|
|
|
41
|
-
|
|
45
|
+
|
|
46
|
+
var _chunkLDEXTX4Icjs = require('./chunk-LDEXTX4I.cjs');
|
|
47
|
+
|
|
42
48
|
|
|
43
49
|
|
|
44
50
|
|
|
@@ -50,7 +56,7 @@ var _chunkDCXSIEFEcjs = require('./chunk-DCXSIEFE.cjs');
|
|
|
50
56
|
|
|
51
57
|
|
|
52
58
|
|
|
53
|
-
var
|
|
59
|
+
var _chunkFVYBEMODcjs = require('./chunk-FVYBEMOD.cjs');
|
|
54
60
|
|
|
55
61
|
|
|
56
62
|
|
|
@@ -58,7 +64,10 @@ var _chunkPPX7UOFYcjs = require('./chunk-PPX7UOFY.cjs');
|
|
|
58
64
|
var _chunkDZZHTMWMcjs = require('./chunk-DZZHTMWM.cjs');
|
|
59
65
|
|
|
60
66
|
|
|
61
|
-
var
|
|
67
|
+
var _chunkUKZ6AWKZcjs = require('./chunk-UKZ6AWKZ.cjs');
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
var _chunkZ3PW3DIRcjs = require('./chunk-Z3PW3DIR.cjs');
|
|
62
71
|
|
|
63
72
|
|
|
64
73
|
var _chunkV3UOEWCBcjs = require('./chunk-V3UOEWCB.cjs');
|
|
@@ -67,10 +76,10 @@ var _chunkV3UOEWCBcjs = require('./chunk-V3UOEWCB.cjs');
|
|
|
67
76
|
|
|
68
77
|
|
|
69
78
|
|
|
70
|
-
var
|
|
79
|
+
var _chunk7LK5CTUMcjs = require('./chunk-7LK5CTUM.cjs');
|
|
71
80
|
|
|
72
81
|
|
|
73
|
-
var
|
|
82
|
+
var _chunk3GNHJ3RNcjs = require('./chunk-3GNHJ3RN.cjs');
|
|
74
83
|
|
|
75
84
|
|
|
76
85
|
var _chunkOCS3PSYRcjs = require('./chunk-OCS3PSYR.cjs');
|
|
@@ -99,7 +108,11 @@ var _chunkOCS3PSYRcjs = require('./chunk-OCS3PSYR.cjs');
|
|
|
99
108
|
|
|
100
109
|
|
|
101
110
|
|
|
102
|
-
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
var _chunkF36LS2C7cjs = require('./chunk-F36LS2C7.cjs');
|
|
103
116
|
|
|
104
117
|
|
|
105
118
|
|
|
@@ -111,7 +124,7 @@ var _chunkWUTFJOV7cjs = require('./chunk-WUTFJOV7.cjs');
|
|
|
111
124
|
|
|
112
125
|
|
|
113
126
|
|
|
114
|
-
var
|
|
127
|
+
var _chunkQOGIZKSOcjs = require('./chunk-QOGIZKSO.cjs');
|
|
115
128
|
|
|
116
129
|
|
|
117
130
|
|
|
@@ -138,7 +151,7 @@ var _chunk47JV57DAcjs = require('./chunk-47JV57DA.cjs');
|
|
|
138
151
|
|
|
139
152
|
|
|
140
153
|
|
|
141
|
-
var
|
|
154
|
+
var _chunkYTNBCXCWcjs = require('./chunk-YTNBCXCW.cjs');
|
|
142
155
|
|
|
143
156
|
|
|
144
157
|
|
|
@@ -146,7 +159,7 @@ var _chunkLPIZMU7Dcjs = require('./chunk-LPIZMU7D.cjs');
|
|
|
146
159
|
var _chunkX3MHKLCOcjs = require('./chunk-X3MHKLCO.cjs');
|
|
147
160
|
|
|
148
161
|
|
|
149
|
-
var
|
|
162
|
+
var _chunkIGDYL2IAcjs = require('./chunk-IGDYL2IA.cjs');
|
|
150
163
|
|
|
151
164
|
|
|
152
165
|
var _chunk4EBC7EMWcjs = require('./chunk-4EBC7EMW.cjs');
|
|
@@ -164,7 +177,7 @@ var _chunk4EBC7EMWcjs = require('./chunk-4EBC7EMW.cjs');
|
|
|
164
177
|
|
|
165
178
|
|
|
166
179
|
|
|
167
|
-
var
|
|
180
|
+
var _chunkMZ4CRSY7cjs = require('./chunk-MZ4CRSY7.cjs');
|
|
168
181
|
|
|
169
182
|
|
|
170
183
|
|
|
@@ -175,7 +188,8 @@ var _chunkSM2SYWARcjs = require('./chunk-SM2SYWAR.cjs');
|
|
|
175
188
|
var _chunkERMUL73Lcjs = require('./chunk-ERMUL73L.cjs');
|
|
176
189
|
|
|
177
190
|
|
|
178
|
-
|
|
191
|
+
|
|
192
|
+
var _chunkOCNV4CI2cjs = require('./chunk-OCNV4CI2.cjs');
|
|
179
193
|
|
|
180
194
|
|
|
181
195
|
|
|
@@ -185,7 +199,7 @@ var _chunk6JHZPB52cjs = require('./chunk-6JHZPB52.cjs');
|
|
|
185
199
|
var _chunkRE5E2G5Scjs = require('./chunk-RE5E2G5S.cjs');
|
|
186
200
|
|
|
187
201
|
|
|
188
|
-
var
|
|
202
|
+
var _chunkMTBDJ326cjs = require('./chunk-MTBDJ326.cjs');
|
|
189
203
|
|
|
190
204
|
|
|
191
205
|
|
|
@@ -210,7 +224,7 @@ var _chunk4P5634G6cjs = require('./chunk-4P5634G6.cjs');
|
|
|
210
224
|
var _chunk3EIPOTZVcjs = require('./chunk-3EIPOTZV.cjs');
|
|
211
225
|
|
|
212
226
|
|
|
213
|
-
var
|
|
227
|
+
var _chunk3EEINK7Gcjs = require('./chunk-3EEINK7G.cjs');
|
|
214
228
|
|
|
215
229
|
|
|
216
230
|
|
|
@@ -220,8 +234,11 @@ var _chunk2HW5LWAHcjs = require('./chunk-2HW5LWAH.cjs');
|
|
|
220
234
|
var _chunkFT6KJHS3cjs = require('./chunk-FT6KJHS3.cjs');
|
|
221
235
|
|
|
222
236
|
|
|
237
|
+
var _chunkASYOWPSRcjs = require('./chunk-ASYOWPSR.cjs');
|
|
223
238
|
|
|
224
|
-
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
var _chunkFSODPZRTcjs = require('./chunk-FSODPZRT.cjs');
|
|
225
242
|
|
|
226
243
|
|
|
227
244
|
|
|
@@ -266,16 +283,21 @@ var _chunkQMNWKQL4cjs = require('./chunk-QMNWKQL4.cjs');
|
|
|
266
283
|
var _chunk2OF5RPVUcjs = require('./chunk-2OF5RPVU.cjs');
|
|
267
284
|
|
|
268
285
|
|
|
269
|
-
var
|
|
286
|
+
var _chunkSQ6IWJ3Hcjs = require('./chunk-SQ6IWJ3H.cjs');
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
var _chunk23VJEGKCcjs = require('./chunk-23VJEGKC.cjs');
|
|
270
290
|
|
|
271
291
|
|
|
272
|
-
|
|
292
|
+
|
|
293
|
+
var _chunkI7J5RLGOcjs = require('./chunk-I7J5RLGO.cjs');
|
|
273
294
|
|
|
274
295
|
|
|
275
296
|
var _chunkHDPT6OYEcjs = require('./chunk-HDPT6OYE.cjs');
|
|
276
297
|
|
|
277
298
|
|
|
278
299
|
|
|
300
|
+
|
|
279
301
|
var _chunkD22BUQKWcjs = require('./chunk-D22BUQKW.cjs');
|
|
280
302
|
|
|
281
303
|
|
|
@@ -398,7 +420,7 @@ function getDocsTitle(docs) {
|
|
|
398
420
|
return typeof docs.config.nav === "object" && docs.config.nav && "title" in docs.config.nav ? String(docs.config.nav.title || "Documentation") : "Documentation";
|
|
399
421
|
}
|
|
400
422
|
function loadPages(contentDir, docs) {
|
|
401
|
-
return
|
|
423
|
+
return _chunkFVYBEMODcjs.discoverFarmDocsPages.call(void 0, contentDir, docs).map((page) => _chunkFVYBEMODcjs.loadFarmDocsPage.call(void 0, contentDir, docs, page.slug)).filter((page) => Boolean(page)).sort((a, b) => a.href.localeCompare(b.href));
|
|
402
424
|
}
|
|
403
425
|
function findSocialImagePath(html, basePath) {
|
|
404
426
|
const match = /<meta\s+property=["']og:image["']\s+content=["']([^"']+)["']/i.exec(html) || /<meta\s+content=["']([^"']+)["']\s+property=["']og:image["']/i.exec(html);
|
|
@@ -416,7 +438,7 @@ async function addHandlerRoute(routes, pathname, handler, absolutePaths) {
|
|
|
416
438
|
return response;
|
|
417
439
|
}
|
|
418
440
|
async function compileFarmDocsManifest(docs, options) {
|
|
419
|
-
const contentDir =
|
|
441
|
+
const contentDir = _chunkFVYBEMODcjs.resolveFarmDocsContentDir.call(void 0, docs, options);
|
|
420
442
|
const pages = loadPages(contentDir, docs);
|
|
421
443
|
const basePath = _chunkD22BUQKWcjs.normalizeFarmBasePath.call(void 0, options.basePath);
|
|
422
444
|
const absolutePaths = [
|
|
@@ -424,7 +446,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
424
446
|
_path2.default.resolve(contentDir),
|
|
425
447
|
docs.configPath || ""
|
|
426
448
|
];
|
|
427
|
-
const handler =
|
|
449
|
+
const handler = _chunkFVYBEMODcjs.createFarmDocsHandler.call(void 0, docs, {
|
|
428
450
|
root: options.root,
|
|
429
451
|
srcDir: options.srcDir,
|
|
430
452
|
clientEntry: options.clientEntry,
|
|
@@ -434,7 +456,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
434
456
|
isPathGuarded: options.isPathGuarded,
|
|
435
457
|
basePath
|
|
436
458
|
});
|
|
437
|
-
const apiHandler =
|
|
459
|
+
const apiHandler = _chunkLDEXTX4Icjs.createFarmDocsAPIHandler.call(void 0, {
|
|
438
460
|
rootDir: options.root,
|
|
439
461
|
srcDir: options.srcDir,
|
|
440
462
|
docs,
|
|
@@ -446,7 +468,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
446
468
|
const apiMarkdown = {};
|
|
447
469
|
for (const page of pages) {
|
|
448
470
|
const htmlResponse = await addHandlerRoute(routes, page.href, handler, absolutePaths);
|
|
449
|
-
const markdownPath =
|
|
471
|
+
const markdownPath = _chunkFVYBEMODcjs.getFarmDocsMarkdownPath.call(void 0, page.href);
|
|
450
472
|
await addHandlerRoute(routes, markdownPath, handler, absolutePaths);
|
|
451
473
|
if (htmlResponse) {
|
|
452
474
|
const socialImagePath = findSocialImagePath(await htmlResponse.text(), basePath);
|
|
@@ -531,7 +553,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
531
553
|
post: await compileResponse(postResponse, absolutePaths),
|
|
532
554
|
search: {
|
|
533
555
|
pages: publicPages.map((page) => ({
|
|
534
|
-
...
|
|
556
|
+
..._chunkFVYBEMODcjs.toFarmDocsMarkdownPage.call(void 0, page, basePath),
|
|
535
557
|
sourcePath: `farm-docs:${page.slug || "index"}`
|
|
536
558
|
})),
|
|
537
559
|
search: _nullishCoalesce(searchConfig, () => ( true)),
|
|
@@ -709,7 +731,7 @@ async function createFarmRouteRuntimeManifest(options) {
|
|
|
709
731
|
const routes = [];
|
|
710
732
|
for (const [pattern, entry] of options.routeManager.getRoutes()) {
|
|
711
733
|
const routeModule = await options.routeManager.loadRouteModule(entry.modulePath);
|
|
712
|
-
const rendering = await
|
|
734
|
+
const rendering = await _chunkQOGIZKSOcjs.resolveRouteRenderingConfigFromFile.call(void 0, routeModule, entry.modulePath);
|
|
713
735
|
const runtimeConfig = await options.routeManager.resolveRouteRuntimeConfig(pattern);
|
|
714
736
|
routes.push({
|
|
715
737
|
kind: "page",
|
|
@@ -782,7 +804,7 @@ async function writeFarmRouteRuntimeManifest(directory, manifest) {
|
|
|
782
804
|
return manifestPath;
|
|
783
805
|
}
|
|
784
806
|
function validateFarmRouteRuntimeDeployment(manifest, preset) {
|
|
785
|
-
const runtime =
|
|
807
|
+
const runtime = _chunkI7J5RLGOcjs.getFarmPresetRuntime.call(void 0, preset);
|
|
786
808
|
const warnings = /* @__PURE__ */ new Set();
|
|
787
809
|
for (const route of manifest.routes) {
|
|
788
810
|
if (route.rendering === "static") continue;
|
|
@@ -946,12 +968,13 @@ function createFarmVercelImmutableAssetRoute() {
|
|
|
946
968
|
};
|
|
947
969
|
}
|
|
948
970
|
function buildFarmVercelRoutes(options) {
|
|
949
|
-
const { presetRoutes, runtimeRoutes } = options;
|
|
971
|
+
const { presetRoutes, runtimeRoutes, middlewareRoutes = [] } = options;
|
|
950
972
|
const filesystemIndex = presetRoutes.findIndex((route) => route.handle === "filesystem");
|
|
951
973
|
const sourceRoutes = filesystemIndex >= 0 ? presetRoutes.slice(0, filesystemIndex) : [];
|
|
952
974
|
const preservedSourceRoutes = sourceRoutes.filter((route) => route.continue !== true);
|
|
953
975
|
return [
|
|
954
976
|
...preservedSourceRoutes,
|
|
977
|
+
...middlewareRoutes,
|
|
955
978
|
createFarmVercelImmutableAssetRoute(),
|
|
956
979
|
{ handle: "filesystem" },
|
|
957
980
|
...runtimeRoutes,
|
|
@@ -1025,7 +1048,7 @@ function collectServerOnlySSRAssets(bundle) {
|
|
|
1025
1048
|
return serverOnly;
|
|
1026
1049
|
}
|
|
1027
1050
|
function canReadServerFiles(preset) {
|
|
1028
|
-
return
|
|
1051
|
+
return _chunkI7J5RLGOcjs.getFarmPresetRuntime.call(void 0, preset) !== "edge" && !preset.startsWith("cloudflare");
|
|
1029
1052
|
}
|
|
1030
1053
|
function assertServerReadSSRAssetsSupported(bundle, preset, root) {
|
|
1031
1054
|
if (canReadServerFiles(preset)) return;
|
|
@@ -1219,14 +1242,17 @@ function farmStripPlatformConfigPlugin(configFiles) {
|
|
|
1219
1242
|
// Before the TypeScript transform, so its import elision also drops imports only the
|
|
1220
1243
|
// removed block used (`readFileSync` for a version, say).
|
|
1221
1244
|
enforce: "pre",
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1245
|
+
transform: {
|
|
1246
|
+
filter: { id: _chunkF36LS2C7cjs.fileNamePattern.call(void 0, configFiles) },
|
|
1247
|
+
async handler(code, id) {
|
|
1248
|
+
const file = id.split("?", 1)[0];
|
|
1249
|
+
if (!files.has(_path2.default.resolve(file)) && !files.has(realPath(file))) return null;
|
|
1250
|
+
const { parseAst } = await import("rolldown/parseAst");
|
|
1251
|
+
const extension = _path2.default.extname(file).slice(1);
|
|
1252
|
+
const lang = /^[cm]?tsx?$/.test(extension) ? extension.endsWith("x") ? "tsx" : "ts" : extension.endsWith("x") ? "jsx" : "js";
|
|
1253
|
+
const stripped = stripPlatformConfigSource(code, (source) => parseAst(source, { lang }));
|
|
1254
|
+
return stripped === null ? null : { code: stripped, map: null };
|
|
1255
|
+
}
|
|
1230
1256
|
}
|
|
1231
1257
|
};
|
|
1232
1258
|
}
|
|
@@ -1309,6 +1335,11 @@ function readStaticMiddlewareConfig(program) {
|
|
|
1309
1335
|
for (const property of init.properties) {
|
|
1310
1336
|
if (property.type !== "Property" || property.computed) return "unknown";
|
|
1311
1337
|
const key = _nullishCoalesce(_optionalChain([property, 'access', _36 => _36.key, 'optionalAccess', _37 => _37.name]), () => ( _optionalChain([property, 'access', _38 => _38.key, 'optionalAccess', _39 => _39.value])));
|
|
1338
|
+
if (key === "runtime") {
|
|
1339
|
+
const runtime = literalMatcher(unwrap(property.value));
|
|
1340
|
+
if (runtime === "edge" || runtime === "nodejs") config.runtime = runtime;
|
|
1341
|
+
continue;
|
|
1342
|
+
}
|
|
1312
1343
|
if (key !== "matcher" && key !== "exclude") continue;
|
|
1313
1344
|
const matchers = literalMatchers(unwrap(property.value));
|
|
1314
1345
|
if (!matchers) return "unknown";
|
|
@@ -1331,6 +1362,164 @@ async function readMiddlewareFileConfig(filePath) {
|
|
|
1331
1362
|
}
|
|
1332
1363
|
}
|
|
1333
1364
|
|
|
1365
|
+
// src/nitro/vercel-edge-middleware.ts
|
|
1366
|
+
|
|
1367
|
+
|
|
1368
|
+
var _zlib = require('zlib');
|
|
1369
|
+
var FARM_VERCEL_EDGE_MIDDLEWARE_FUNCTION = "_farm_middleware";
|
|
1370
|
+
var FARM_VERCEL_EDGE_NOT_FOUND_PATH = "/__farm/not-found";
|
|
1371
|
+
var EDGE_NODE_MODULES = /* @__PURE__ */ new Set(["async_hooks", "events", "buffer", "assert", "util"]);
|
|
1372
|
+
var EDGE_FUNCTION_SIZE_WARNING_BYTES = 1024 * 1024;
|
|
1373
|
+
function farmTargetRunsEdgeMiddleware(preset) {
|
|
1374
|
+
return preset === "vercel";
|
|
1375
|
+
}
|
|
1376
|
+
function isFarmEdgeMiddlewareRoute(route) {
|
|
1377
|
+
return typeof route.config === "object" && _optionalChain([route, 'access', _42 => _42.config, 'optionalAccess', _43 => _43.runtime]) === "edge";
|
|
1378
|
+
}
|
|
1379
|
+
function escapeRegExp2(value) {
|
|
1380
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1381
|
+
}
|
|
1382
|
+
function toFarmVercelEdgeGuardedUrls(pathnames, basePath) {
|
|
1383
|
+
return [
|
|
1384
|
+
...new Set(pathnames.flatMap((pathname) => [pathname, _chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, pathname, basePath)]))
|
|
1385
|
+
];
|
|
1386
|
+
}
|
|
1387
|
+
function createFarmVercelEdgeMiddlewareRoute(pathnames, basePath = "/") {
|
|
1388
|
+
const publicPaths = toFarmVercelEdgeGuardedUrls(pathnames, basePath);
|
|
1389
|
+
const alternatives = publicPaths.map((pathname) => {
|
|
1390
|
+
const trimmed = pathname.replace(/\/+$/, "");
|
|
1391
|
+
return trimmed ? `${escapeRegExp2(trimmed)}(?:/|/index\\.html|\\.html)?` : "/(?:index\\.html)?";
|
|
1392
|
+
});
|
|
1393
|
+
return {
|
|
1394
|
+
src: `^(?:${alternatives.join("|")})$`,
|
|
1395
|
+
middlewarePath: FARM_VERCEL_EDGE_MIDDLEWARE_FUNCTION,
|
|
1396
|
+
middlewareRawSrc: publicPaths,
|
|
1397
|
+
continue: true
|
|
1398
|
+
};
|
|
1399
|
+
}
|
|
1400
|
+
function generateFarmVercelEdgeMiddlewareEntry(routes, config, guardedPages) {
|
|
1401
|
+
const imports = routes.map(
|
|
1402
|
+
(route, index) => `import * as farmEdgeMiddleware${index} from ${JSON.stringify(route.filePath.replace(/\\/g, "/"))};`
|
|
1403
|
+
);
|
|
1404
|
+
const modules = routes.map(
|
|
1405
|
+
(route, index) => ` { path: ${JSON.stringify(route.path)}, filePath: ${JSON.stringify(route.filePath)}, module: farmEdgeMiddleware${index} },`
|
|
1406
|
+
);
|
|
1407
|
+
return `import { createFarmVercelEdgeMiddleware } from "@farm.js/core/internal/vercel-edge-middleware";
|
|
1408
|
+
${imports.join("\n")}
|
|
1409
|
+
|
|
1410
|
+
export default createFarmVercelEdgeMiddleware({
|
|
1411
|
+
modules: [
|
|
1412
|
+
${modules.join("\n")}
|
|
1413
|
+
],
|
|
1414
|
+
i18n: ${JSON.stringify(config.i18n)},
|
|
1415
|
+
server: ${JSON.stringify({ trustProxy: _optionalChain([config, 'access', _44 => _44.server, 'optionalAccess', _45 => _45.trustProxy]) === true })},
|
|
1416
|
+
apiBasePath: ${JSON.stringify(_chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, config.api))},
|
|
1417
|
+
notFoundPath: ${JSON.stringify(_chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, FARM_VERCEL_EDGE_NOT_FOUND_PATH, config.basePath))},
|
|
1418
|
+
pages: ${JSON.stringify(toFarmVercelEdgeGuardedUrls(guardedPages, config.basePath))},
|
|
1419
|
+
});
|
|
1420
|
+
`;
|
|
1421
|
+
}
|
|
1422
|
+
async function resolveFarmCoreDir(root, fs4) {
|
|
1423
|
+
const runtimeEntry = _module.createRequire.call(void 0, _path2.default.join(root, "package.json")).resolve(
|
|
1424
|
+
"@farm.js/core/internal/vercel-edge-middleware"
|
|
1425
|
+
);
|
|
1426
|
+
return fs4.realpath(_path2.default.resolve(_path2.default.dirname(runtimeEntry), "..", ".."));
|
|
1427
|
+
}
|
|
1428
|
+
function edgeNodeModulesPlugin(coreDir, unsupported) {
|
|
1429
|
+
const streamStub = "\0farm-edge-node-stream";
|
|
1430
|
+
const corePrefix = coreDir + _path2.default.sep;
|
|
1431
|
+
return {
|
|
1432
|
+
name: "farm-vercel-edge-node-modules",
|
|
1433
|
+
resolveId(source, importer) {
|
|
1434
|
+
if (!_module.isBuiltin.call(void 0, source)) return null;
|
|
1435
|
+
const name = source.replace(/^node:/, "").split("/")[0];
|
|
1436
|
+
if (EDGE_NODE_MODULES.has(name)) return { id: `node:${name}`, external: true };
|
|
1437
|
+
if (name === "stream" && importer && _path2.default.resolve(importer).startsWith(corePrefix)) {
|
|
1438
|
+
return streamStub;
|
|
1439
|
+
}
|
|
1440
|
+
unsupported.add(`${source} (imported by ${_nullishCoalesce(importer, () => ( "the entry"))})`);
|
|
1441
|
+
return { id: source, external: true };
|
|
1442
|
+
},
|
|
1443
|
+
load(id) {
|
|
1444
|
+
if (id !== streamStub) return null;
|
|
1445
|
+
return `export const Readable = { toWeb() { throw new Error("[Farm.js] Node streams are not available in Vercel edge middleware."); } };`;
|
|
1446
|
+
}
|
|
1447
|
+
};
|
|
1448
|
+
}
|
|
1449
|
+
async function writeFarmVercelEdgeMiddlewareFunction(options) {
|
|
1450
|
+
const { root, outputDir, buildDir, config, routes, guardedPages, fs: fs4 } = options;
|
|
1451
|
+
const functionDir = _path2.default.join(
|
|
1452
|
+
outputDir,
|
|
1453
|
+
"functions",
|
|
1454
|
+
`${FARM_VERCEL_EDGE_MIDDLEWARE_FUNCTION}.func`
|
|
1455
|
+
);
|
|
1456
|
+
const entryPath = _path2.default.join(buildDir, "vercel-edge-middleware-entry.mjs");
|
|
1457
|
+
await fs4.mkdir(_path2.default.dirname(entryPath), { recursive: true });
|
|
1458
|
+
await fs4.writeFile(
|
|
1459
|
+
entryPath,
|
|
1460
|
+
generateFarmVercelEdgeMiddlewareEntry(routes, config, guardedPages)
|
|
1461
|
+
);
|
|
1462
|
+
const unsupported = /* @__PURE__ */ new Set();
|
|
1463
|
+
const coreDir = await resolveFarmCoreDir(root, fs4);
|
|
1464
|
+
const { rolldown } = await import("rolldown");
|
|
1465
|
+
let code;
|
|
1466
|
+
try {
|
|
1467
|
+
const bundle = await rolldown({
|
|
1468
|
+
cwd: root,
|
|
1469
|
+
input: entryPath,
|
|
1470
|
+
platform: "browser",
|
|
1471
|
+
logLevel: "silent",
|
|
1472
|
+
plugins: [edgeNodeModulesPlugin(coreDir, unsupported)],
|
|
1473
|
+
resolve: {
|
|
1474
|
+
alias: _chunkF36LS2C7cjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
1475
|
+
conditionNames: ["edge-light", "worker", "browser", "import", "module", "default"]
|
|
1476
|
+
},
|
|
1477
|
+
transform: {
|
|
1478
|
+
target: "es2022",
|
|
1479
|
+
define: { "process.env.NODE_ENV": JSON.stringify("production") }
|
|
1480
|
+
}
|
|
1481
|
+
});
|
|
1482
|
+
try {
|
|
1483
|
+
const { output } = await bundle.generate({
|
|
1484
|
+
format: "esm",
|
|
1485
|
+
codeSplitting: false,
|
|
1486
|
+
minify: true
|
|
1487
|
+
});
|
|
1488
|
+
code = output[0].code;
|
|
1489
|
+
} finally {
|
|
1490
|
+
await bundle.close();
|
|
1491
|
+
}
|
|
1492
|
+
} catch (error) {
|
|
1493
|
+
throw _chunkASYOWPSRcjs.withPlainDiagnostics.call(void 0, error);
|
|
1494
|
+
} finally {
|
|
1495
|
+
await fs4.rm(entryPath, { force: true });
|
|
1496
|
+
}
|
|
1497
|
+
if (unsupported.size > 0) {
|
|
1498
|
+
throw new Error(
|
|
1499
|
+
`[Farm.js] runtime: "edge" middleware runs in Vercel's Edge runtime, which does not provide these Node modules:
|
|
1500
|
+
` + [...unsupported].map((entry) => ` - ${entry}`).join("\n") + `
|
|
1501
|
+
Remove them from the middleware (Edge provides ${[...EDGE_NODE_MODULES].join(", ")}), or remove runtime: "edge" so the middleware runs in the server and its pages render on request.`
|
|
1502
|
+
);
|
|
1503
|
+
}
|
|
1504
|
+
await fs4.rm(functionDir, { recursive: true, force: true });
|
|
1505
|
+
await fs4.mkdir(functionDir, { recursive: true });
|
|
1506
|
+
await fs4.writeFile(_path2.default.join(functionDir, "index.js"), code);
|
|
1507
|
+
await fs4.writeFile(
|
|
1508
|
+
_path2.default.join(functionDir, ".vc-config.json"),
|
|
1509
|
+
`${JSON.stringify({ runtime: "edge", entrypoint: "index.js" }, null, 2)}
|
|
1510
|
+
`
|
|
1511
|
+
);
|
|
1512
|
+
const gzippedBytes = _zlib.gzipSync.call(void 0, code).length;
|
|
1513
|
+
if (gzippedBytes > EDGE_FUNCTION_SIZE_WARNING_BYTES) {
|
|
1514
|
+
_chunkQMNWKQL4cjs.logger.warn(
|
|
1515
|
+
`Vercel edge middleware is ${(gzippedBytes / 1024 / 1024).toFixed(2)} MB gzipped, over the Hobby plan's 1 MB Edge function limit (Pro allows 2 MB, Enterprise 4 MB).`
|
|
1516
|
+
);
|
|
1517
|
+
}
|
|
1518
|
+
_chunkQMNWKQL4cjs.logger.info(
|
|
1519
|
+
`\u{1F6E1}\uFE0F Vercel edge middleware: ${routes.length} middleware file(s) guard their prerendered pages before the CDN serves them`
|
|
1520
|
+
);
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1334
1523
|
// src/nitro/universal-build.ts
|
|
1335
1524
|
var FARM_NATIVE_STYLESHEETS_PLACEHOLDER = "__FARM_NATIVE_STYLESHEETS__";
|
|
1336
1525
|
async function readFarmNativeStylesheets(clientOutputDir, clientCssHref) {
|
|
@@ -1501,7 +1690,7 @@ function createPrerenderRuntimeResolverPlugin(root, resolveNitroEntry = resolveN
|
|
|
1501
1690
|
return {
|
|
1502
1691
|
name: "farm-prerender-runtime-resolver",
|
|
1503
1692
|
async resolveId(id, _importer, options) {
|
|
1504
|
-
if (_optionalChain([options, 'access',
|
|
1693
|
+
if (_optionalChain([options, 'access', _46 => _46.custom, 'optionalAccess', _47 => _47.farmPrerenderRuntimeResolve])) return null;
|
|
1505
1694
|
if (id.startsWith("\0") || id.startsWith(".") || id.startsWith("#") || id.startsWith("virtual:") || _path2.default.isAbsolute(id) || NODE_BUILTIN_MODULES.has(id)) {
|
|
1506
1695
|
return null;
|
|
1507
1696
|
}
|
|
@@ -1629,7 +1818,7 @@ function hasReactDomEdgeServerBuild(root) {
|
|
|
1629
1818
|
}
|
|
1630
1819
|
}
|
|
1631
1820
|
function shouldAliasReactServerToWebBuild(renderer, preset) {
|
|
1632
|
-
return _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) &&
|
|
1821
|
+
return _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) && _chunkI7J5RLGOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge";
|
|
1633
1822
|
}
|
|
1634
1823
|
function isCloudflareImagePreset(preset) {
|
|
1635
1824
|
return preset === "cloudflare" || preset === "cloudflare-pages" || preset === "cloudflare-module";
|
|
@@ -1651,18 +1840,6 @@ function isNitroRollupExternal(id) {
|
|
|
1651
1840
|
return NODE_BUILTIN_MODULES.has(id) || NITRO_EXTERNAL_MODULES.has(id) || normalizedId.startsWith(".prisma/") || normalizedId.includes("/node_modules/@prisma/client/") || normalizedId.includes("/node_modules/.prisma/client/");
|
|
1652
1841
|
}
|
|
1653
1842
|
var FARM_METADATA_IMAGE_WASM_PREFIX = "\0farm-metadata-image-wasm:";
|
|
1654
|
-
function createReactProductionModePlugin() {
|
|
1655
|
-
const nodeEnvExpression = ["process", "env", "NODE_ENV"].join(".");
|
|
1656
|
-
return {
|
|
1657
|
-
name: "farm-react-production-mode",
|
|
1658
|
-
transform(code, id) {
|
|
1659
|
-
const normalizedId = id.replace(/\\/g, "/");
|
|
1660
|
-
const isReactRuntime = normalizedId.includes("/node_modules/react/") || normalizedId.includes("/node_modules/react-dom/");
|
|
1661
|
-
if (!isReactRuntime || !code.includes(nodeEnvExpression)) return null;
|
|
1662
|
-
return { code: code.split(nodeEnvExpression).join('"production"'), map: null };
|
|
1663
|
-
}
|
|
1664
|
-
};
|
|
1665
|
-
}
|
|
1666
1843
|
var FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID = "\0farm-omitted-metadata-image-runtime";
|
|
1667
1844
|
function isFarmCoreModule(file) {
|
|
1668
1845
|
let dir = _path2.default.dirname(file.split("?", 1)[0]);
|
|
@@ -1682,21 +1859,27 @@ function isFarmCoreModule(file) {
|
|
|
1682
1859
|
function createOmittedMetadataImageRuntimePlugin(externalizeOtherImports) {
|
|
1683
1860
|
return {
|
|
1684
1861
|
name: "farm-omitted-metadata-image-runtime",
|
|
1685
|
-
resolveId
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1862
|
+
resolveId: {
|
|
1863
|
+
filter: { id: _chunkF36LS2C7cjs.exactIdPattern.call(void 0, ["@vercel/og"]) },
|
|
1864
|
+
handler(source, importer) {
|
|
1865
|
+
if (source !== "@vercel/og") return null;
|
|
1866
|
+
const fromCoreRuntime = importer !== void 0 && isFarmCoreModule(importer) && !/^og\.[cm]?[jt]sx?$/.test(_path2.default.basename(importer.split("?", 1)[0]));
|
|
1867
|
+
if (fromCoreRuntime) return FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID;
|
|
1868
|
+
return externalizeOtherImports ? { id: source, external: true } : null;
|
|
1869
|
+
}
|
|
1690
1870
|
},
|
|
1691
|
-
load
|
|
1692
|
-
|
|
1693
|
-
|
|
1871
|
+
load: {
|
|
1872
|
+
filter: { id: _chunkF36LS2C7cjs.exactIdPattern.call(void 0, [FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID]) },
|
|
1873
|
+
handler(id) {
|
|
1874
|
+
if (id !== FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID) return null;
|
|
1875
|
+
return `
|
|
1694
1876
|
export class ImageResponse {
|
|
1695
1877
|
constructor() {
|
|
1696
1878
|
throw new Error("@vercel/og is not in this server build because the app has no generated metadata image route.");
|
|
1697
1879
|
}
|
|
1698
1880
|
}
|
|
1699
1881
|
`;
|
|
1882
|
+
}
|
|
1700
1883
|
}
|
|
1701
1884
|
};
|
|
1702
1885
|
}
|
|
@@ -1714,8 +1897,8 @@ function readVercelOgManifest(file) {
|
|
|
1714
1897
|
}
|
|
1715
1898
|
function resolveVercelOgConditionEntry(resolvedId, condition) {
|
|
1716
1899
|
const vercelOg = readVercelOgManifest(resolvedId);
|
|
1717
|
-
const entry = _optionalChain([vercelOg, 'optionalAccess',
|
|
1718
|
-
const file = typeof entry === "string" ? entry : _optionalChain([entry, 'optionalAccess',
|
|
1900
|
+
const entry = _optionalChain([vercelOg, 'optionalAccess', _48 => _48.manifest, 'access', _49 => _49.exports, 'optionalAccess', _50 => _50["."], 'optionalAccess', _51 => _51[condition]]);
|
|
1901
|
+
const file = typeof entry === "string" ? entry : _optionalChain([entry, 'optionalAccess', _52 => _52.default]);
|
|
1719
1902
|
return vercelOg && typeof file === "string" ? _path2.default.join(vercelOg.dir, file) : null;
|
|
1720
1903
|
}
|
|
1721
1904
|
function createEdgeMetadataImageRuntimePlugin({
|
|
@@ -1731,7 +1914,7 @@ function createEdgeMetadataImageRuntimePlugin({
|
|
|
1731
1914
|
const edgeEntry = resolveVercelOgConditionEntry(resolved.id, condition);
|
|
1732
1915
|
return edgeEntry ? { ...resolved, id: edgeEntry } : resolved;
|
|
1733
1916
|
}
|
|
1734
|
-
if (wasm !== "module" || !source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess',
|
|
1917
|
+
if (wasm !== "module" || !source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess', _53 => _53.replace, 'call', _54 => _54(/\\/g, "/"), 'access', _55 => _55.includes, 'call', _56 => _56("/@vercel/og/")])) {
|
|
1735
1918
|
return null;
|
|
1736
1919
|
}
|
|
1737
1920
|
const resolvedPath = _path2.default.resolve(_path2.default.dirname(importer.split("?", 1)[0]), source);
|
|
@@ -1753,7 +1936,7 @@ function createVercelOgFontInlinePlugin(runtime = "Cloudflare Workers") {
|
|
|
1753
1936
|
return `Promise.resolve({ arrayBuffer: () => Uint8Array.from(atob(${JSON.stringify(encoded)}), (character) => character.charCodeAt(0)).buffer })`;
|
|
1754
1937
|
});
|
|
1755
1938
|
if (inlined !== code) return { code: inlined, map: null };
|
|
1756
|
-
const version = _nullishCoalesce(_optionalChain([readVercelOgManifest, 'call',
|
|
1939
|
+
const version = _nullishCoalesce(_optionalChain([readVercelOgManifest, 'call', _57 => _57(file), 'optionalAccess', _58 => _58.manifest, 'access', _59 => _59.version]), () => ( "(unknown version)"));
|
|
1757
1940
|
this.error(
|
|
1758
1941
|
`@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.`
|
|
1759
1942
|
);
|
|
@@ -1764,7 +1947,7 @@ function createMetadataImageWasmPlugin() {
|
|
|
1764
1947
|
return {
|
|
1765
1948
|
name: "farm-metadata-image-wasm",
|
|
1766
1949
|
resolveId(source, importer) {
|
|
1767
|
-
if (!source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess',
|
|
1950
|
+
if (!source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess', _60 => _60.replace, 'call', _61 => _61(/\\/g, "/"), 'access', _62 => _62.includes, 'call', _63 => _63("/@vercel/og/")])) {
|
|
1768
1951
|
return null;
|
|
1769
1952
|
}
|
|
1770
1953
|
const requestPath = source.slice(0, -"?module".length);
|
|
@@ -1840,9 +2023,9 @@ function hasFarmRuntimeConfigModule(config, configModulePath) {
|
|
|
1840
2023
|
return Boolean(configModulePath || (config.layers || []).some((layer) => layer.configFile));
|
|
1841
2024
|
}
|
|
1842
2025
|
function nameCodeSplittingGroups(bundlerConfig) {
|
|
1843
|
-
const outputs = _optionalChain([bundlerConfig, 'optionalAccess',
|
|
2026
|
+
const outputs = _optionalChain([bundlerConfig, 'optionalAccess', _64 => _64.output]);
|
|
1844
2027
|
for (const output of Array.isArray(outputs) ? outputs : [outputs]) {
|
|
1845
|
-
const groups = _optionalChain([output, 'optionalAccess',
|
|
2028
|
+
const groups = _optionalChain([output, 'optionalAccess', _65 => _65.codeSplitting, 'optionalAccess', _66 => _66.groups]);
|
|
1846
2029
|
if (!Array.isArray(groups)) continue;
|
|
1847
2030
|
groups.forEach((group, index) => {
|
|
1848
2031
|
if (group && typeof group.name === "function" && !group.debugName) {
|
|
@@ -1898,9 +2081,9 @@ function restoreLiteralModuleSpecifiers(code, fileName, { parseSync, Visitor })
|
|
|
1898
2081
|
if (needsAst) {
|
|
1899
2082
|
replacements.length = 0;
|
|
1900
2083
|
const restore = (node) => {
|
|
1901
|
-
if (_optionalChain([node, 'optionalAccess',
|
|
2084
|
+
if (_optionalChain([node, 'optionalAccess', _67 => _67.type]) !== "TemplateLiteral") return;
|
|
1902
2085
|
const template = node;
|
|
1903
|
-
const value = _optionalChain([template, 'access',
|
|
2086
|
+
const value = _optionalChain([template, 'access', _68 => _68.quasis, 'access', _69 => _69[0], 'optionalAccess', _70 => _70.value, 'access', _71 => _71.cooked]);
|
|
1904
2087
|
if (template.expressions.length > 0 || typeof value !== "string") return;
|
|
1905
2088
|
replacements.push({
|
|
1906
2089
|
start: template.start,
|
|
@@ -2005,14 +2188,6 @@ async function findFarmConfigPath(root) {
|
|
|
2005
2188
|
}
|
|
2006
2189
|
return null;
|
|
2007
2190
|
}
|
|
2008
|
-
function hasFarmServerRuntimePlugins(config) {
|
|
2009
|
-
return (config.plugins || []).some((plugin) => {
|
|
2010
|
-
if (_chunkBDYM2TN3cjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) === false) return false;
|
|
2011
|
-
return Boolean(
|
|
2012
|
-
plugin.setup || plugin.init || plugin.ready || plugin.shutdown || plugin.runtime || plugin.router || plugin.render || plugin.beforeRouteMatch || plugin.afterRouteMatch || plugin.beforeRender || plugin.afterRender || plugin.onError || plugin.transformHTML
|
|
2013
|
-
);
|
|
2014
|
-
});
|
|
2015
|
-
}
|
|
2016
2191
|
function hasFarmPluginRoutes(config) {
|
|
2017
2192
|
return (config.plugins || []).some((plugin) => Boolean(plugin.routes));
|
|
2018
2193
|
}
|
|
@@ -2066,7 +2241,7 @@ async function discoverMiddlewareRoutes(appDir) {
|
|
|
2066
2241
|
return Array.from(routes.values()).sort(_chunkMHLNWRCJcjs.compareMiddlewareRouteLocations).map(({ path: routePath, filePath }) => ({ path: routePath, filePath }));
|
|
2067
2242
|
}
|
|
2068
2243
|
function assertFarmDocsRuntimeSupported(config, preset) {
|
|
2069
|
-
if (!_optionalChain([config, 'access',
|
|
2244
|
+
if (!_optionalChain([config, 'access', _72 => _72.docs, 'optionalAccess', _73 => _73.enabled]) || !_optionalChain([config, 'access', _74 => _74.docs, 'access', _75 => _75.adapter, 'optionalAccess', _76 => _76.server]) || _chunkI7J5RLGOcjs.getFarmPresetRuntime.call(void 0, preset) !== "edge" || Boolean(config.docs.adapter.edgeCompiler)) {
|
|
2070
2245
|
return;
|
|
2071
2246
|
}
|
|
2072
2247
|
throw new Error(
|
|
@@ -2079,7 +2254,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
2079
2254
|
assertFarmDocsRuntimeSupported(config, preset);
|
|
2080
2255
|
const srcDir = config.srcDir || "src";
|
|
2081
2256
|
const distDir = config.distDir || ".farm";
|
|
2082
|
-
const deployOutputDir =
|
|
2257
|
+
const deployOutputDir = _chunk7LK5CTUMcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
2083
2258
|
const lifecyclePluginManager = options.pluginManager;
|
|
2084
2259
|
const productionViteResultPromise = Promise.allSettled([
|
|
2085
2260
|
Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkMF3IA2AWcjs.loadFarmProductionVite.call(void 0, ))))
|
|
@@ -2098,7 +2273,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
|
|
|
2098
2273
|
const routeRuntimeManifestResultPromise = Promise.allSettled([routeRuntimeManifestPromise]);
|
|
2099
2274
|
const pageRoutes = [];
|
|
2100
2275
|
for (const [pattern, entry] of routeManager.getRoutes()) {
|
|
2101
|
-
const markdownSourcePath = entry.markdownSourcePath || (
|
|
2276
|
+
const markdownSourcePath = entry.markdownSourcePath || (_chunk3EEINK7Gcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? entry.modulePath : void 0);
|
|
2102
2277
|
pageRoutes.push({
|
|
2103
2278
|
pattern,
|
|
2104
2279
|
...entry.directory ? { directory: entry.directory } : {},
|
|
@@ -2304,7 +2479,7 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
2304
2479
|
_chunkQMNWKQL4cjs.logger.error(`\u274C Build failed: ${error}`);
|
|
2305
2480
|
throw error;
|
|
2306
2481
|
} finally {
|
|
2307
|
-
_optionalChain([rendererBuild, 'optionalAccess',
|
|
2482
|
+
_optionalChain([rendererBuild, 'optionalAccess', _77 => _77.abort, 'call', _78 => _78()]);
|
|
2308
2483
|
}
|
|
2309
2484
|
}
|
|
2310
2485
|
function shouldBuildFarmMobileClient(config) {
|
|
@@ -2313,7 +2488,7 @@ function shouldBuildFarmMobileClient(config) {
|
|
|
2313
2488
|
function varyFarmNitroCacheRulesByShell(rules) {
|
|
2314
2489
|
return Object.fromEntries(
|
|
2315
2490
|
Object.entries(rules).map(([source, rule]) => {
|
|
2316
|
-
const cached = _optionalChain([rule, 'optionalAccess',
|
|
2491
|
+
const cached = _optionalChain([rule, 'optionalAccess', _79 => _79.swr]) !== void 0 && rule.swr !== false || _optionalChain([rule, 'optionalAccess', _80 => _80.cache]) !== void 0 && rule.cache !== false;
|
|
2317
2492
|
if (!cached || rule.cache === false) return [source, rule];
|
|
2318
2493
|
const cache = rule.cache && typeof rule.cache === "object" ? rule.cache : {};
|
|
2319
2494
|
const varies = [...Array.isArray(cache.varies) ? cache.varies : [], "x-farm-shell"];
|
|
@@ -2364,7 +2539,14 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
|
|
|
2364
2539
|
}
|
|
2365
2540
|
const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
|
|
2366
2541
|
await fs4.writeFile(fontCssPath, normalizedFontCss);
|
|
2367
|
-
await fs4.writeFile(clientCssPath,
|
|
2542
|
+
await fs4.writeFile(clientCssPath, _chunkF36LS2C7cjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
|
|
2543
|
+
}
|
|
2544
|
+
function importsFarmClientBlockedPackage(id, packageName) {
|
|
2545
|
+
return id === packageName || id.startsWith(`${packageName}/`);
|
|
2546
|
+
}
|
|
2547
|
+
function importsFarmApiRouteModule(id) {
|
|
2548
|
+
const specifier = id.replace(/\\/g, "/").split("?", 1)[0];
|
|
2549
|
+
return /(?:^|\/)api\/(?:.*\/)?route(?:\.[cm]?[jt]sx?)?$/.test(specifier);
|
|
2368
2550
|
}
|
|
2369
2551
|
var IncompleteClientBuildOutputError = class extends Error {
|
|
2370
2552
|
constructor(detail) {
|
|
@@ -2410,7 +2592,7 @@ function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, optio
|
|
|
2410
2592
|
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)}`;
|
|
2411
2593
|
let plan = cache.get(key);
|
|
2412
2594
|
if (!plan) {
|
|
2413
|
-
plan =
|
|
2595
|
+
plan = _chunkMZ4CRSY7cjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
|
|
2414
2596
|
cache.set(key, plan);
|
|
2415
2597
|
}
|
|
2416
2598
|
return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
|
|
@@ -2434,25 +2616,25 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2434
2616
|
const unsupportedIntegrationProvider = integrationProviders.find(
|
|
2435
2617
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
2436
2618
|
);
|
|
2437
|
-
if (_optionalChain([config, 'access',
|
|
2619
|
+
if (_optionalChain([config, 'access', _81 => _81.experimental, 'optionalAccess', _82 => _82.isolatedClientHydration]) === "enabled" && _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _83 => _83.experimental, 'optionalAccess', _84 => _84.serverComponents])) !== "rsc" && unsupportedIntegrationProvider) {
|
|
2438
2620
|
_chunkQMNWKQL4cjs.logger.warn(
|
|
2439
2621
|
`[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
|
|
2440
2622
|
);
|
|
2441
2623
|
}
|
|
2442
|
-
const isolatedMode =
|
|
2443
|
-
_optionalChain([config, 'access',
|
|
2624
|
+
const isolatedMode = _chunkMZ4CRSY7cjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
2625
|
+
_optionalChain([config, 'access', _85 => _85.experimental, 'optionalAccess', _86 => _86.isolatedClientHydration]),
|
|
2444
2626
|
{
|
|
2445
|
-
serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
2627
|
+
serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _87 => _87.experimental, 'optionalAccess', _88 => _88.serverComponents])) === "rsc",
|
|
2446
2628
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
2447
2629
|
}
|
|
2448
2630
|
);
|
|
2449
|
-
const planOptions =
|
|
2631
|
+
const planOptions = _chunkMZ4CRSY7cjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
2450
2632
|
config.renderer,
|
|
2451
2633
|
Boolean(unsupportedIntegrationProvider)
|
|
2452
2634
|
);
|
|
2453
2635
|
const pagePlanOptions = {
|
|
2454
2636
|
...planOptions,
|
|
2455
|
-
serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
2637
|
+
serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _89 => _89.experimental, 'optionalAccess', _90 => _90.serverComponents])) === "islands"
|
|
2456
2638
|
};
|
|
2457
2639
|
const layoutPlanOptions = {
|
|
2458
2640
|
...planOptions,
|
|
@@ -2505,20 +2687,20 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2505
2687
|
});
|
|
2506
2688
|
const layoutAppliesToRoute = _chunkUPOYKX4Scjs.routeBoundaryCoversDirectory;
|
|
2507
2689
|
const routeDirectory = (route) => _nullishCoalesce(route.directory, () => ( route.pattern));
|
|
2508
|
-
const islandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
2690
|
+
const islandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _91 => _91.experimental, 'optionalAccess', _92 => _92.serverComponents])) === "islands";
|
|
2509
2691
|
const adapterOwnsDocsRuntime = Boolean(
|
|
2510
|
-
_chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access',
|
|
2692
|
+
_chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _93 => _93.docs, 'optionalAccess', _94 => _94.enabled]) && _optionalChain([config, 'access', _95 => _95.docs, 'access', _96 => _96.adapter, 'optionalAccess', _97 => _97.server]) && config.docs.adapter.react
|
|
2511
2693
|
);
|
|
2512
|
-
const docsEntries = _optionalChain([config, 'access',
|
|
2694
|
+
const docsEntries = _optionalChain([config, 'access', _98 => _98.docs, 'optionalAccess', _99 => _99.enabled]) ? _chunkFVYBEMODcjs.getFarmDocsRoots.call(void 0, config.docs).map(
|
|
2513
2695
|
(docsRoot) => `/${docsRoot.entry || "docs"}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/"
|
|
2514
2696
|
) : [];
|
|
2515
2697
|
const adapterDocsEntry = _nullishCoalesce(docsEntries[0], () => ( null));
|
|
2516
2698
|
const isAdapterDocsRoute = (routePattern) => adapterOwnsDocsRuntime && docsEntries.some(
|
|
2517
2699
|
(docsEntry) => docsEntry === "/" || routePattern === docsEntry || routePattern.startsWith(`${docsEntry}/`)
|
|
2518
2700
|
);
|
|
2519
|
-
const syntheticDocsEntry = _optionalChain([config, 'access',
|
|
2701
|
+
const syntheticDocsEntry = _optionalChain([config, 'access', _100 => _100.docs, 'optionalAccess', _101 => _101.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
|
|
2520
2702
|
const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
|
|
2521
|
-
const markdownPagePlan =
|
|
2703
|
+
const markdownPagePlan = _chunkMZ4CRSY7cjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
2522
2704
|
_chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), root),
|
|
2523
2705
|
root,
|
|
2524
2706
|
isolatedMode,
|
|
@@ -2526,7 +2708,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2526
2708
|
);
|
|
2527
2709
|
const routePlans = pageRoutes.map((route) => ({
|
|
2528
2710
|
route,
|
|
2529
|
-
metadata:
|
|
2711
|
+
metadata: _chunk3EEINK7Gcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
|
|
2530
2712
|
route.modulePath,
|
|
2531
2713
|
root,
|
|
2532
2714
|
isolatedMode,
|
|
@@ -2534,7 +2716,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2534
2716
|
pagePlanOptions
|
|
2535
2717
|
)
|
|
2536
2718
|
}));
|
|
2537
|
-
|
|
2719
|
+
_chunkMZ4CRSY7cjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
2538
2720
|
clientLayouts.map((layout) => ({
|
|
2539
2721
|
pattern: layout.pattern,
|
|
2540
2722
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -2567,7 +2749,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2567
2749
|
for (const layout of clientLayouts) {
|
|
2568
2750
|
const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, routeDirectory(route))) || docsEntries.some((docsEntry) => layoutAppliesToRoute(layout.pattern, docsEntry));
|
|
2569
2751
|
if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
|
|
2570
|
-
_chunkQMNWKQL4cjs.logger.warn(`\u26A0\uFE0F ${
|
|
2752
|
+
_chunkQMNWKQL4cjs.logger.warn(`\u26A0\uFE0F ${_chunkMZ4CRSY7cjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
|
|
2571
2753
|
}
|
|
2572
2754
|
}
|
|
2573
2755
|
if (isolatedMode === "analyze") {
|
|
@@ -2601,7 +2783,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2601
2783
|
);
|
|
2602
2784
|
if (metadata.suppressedAsyncHydration) {
|
|
2603
2785
|
_chunkQMNWKQL4cjs.logger.warn(
|
|
2604
|
-
`\u26A0\uFE0F ${
|
|
2786
|
+
`\u26A0\uFE0F ${_chunkMZ4CRSY7cjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
|
|
2605
2787
|
);
|
|
2606
2788
|
}
|
|
2607
2789
|
const slotBoundaries = serverSlotPlans.filter(
|
|
@@ -2609,7 +2791,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2609
2791
|
).flatMap(({ plan }) => plan.isolatedBoundaries);
|
|
2610
2792
|
if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0 || slotBoundaries.length > 0) {
|
|
2611
2793
|
const relativePath = route.modulePath.replace(root, "").replace(/^\//, "");
|
|
2612
|
-
const islandStrategy =
|
|
2794
|
+
const islandStrategy = _chunkF36LS2C7cjs.resolveFarmRouteRootStrategy.call(void 0,
|
|
2613
2795
|
route,
|
|
2614
2796
|
metadata,
|
|
2615
2797
|
clientLayouts,
|
|
@@ -2628,7 +2810,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2628
2810
|
...applicableClientLayouts.filter((layout) => layout.hasIsolatedClientBoundaries || layout.serverTreeLayout).flatMap((layout) => layout.isolatedBoundaries)
|
|
2629
2811
|
],
|
|
2630
2812
|
// The server renders a server tree only below a hydrating layout.
|
|
2631
|
-
...
|
|
2813
|
+
..._chunkMZ4CRSY7cjs.usesFarmServerTree.call(void 0, metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
|
|
2632
2814
|
});
|
|
2633
2815
|
_chunkQMNWKQL4cjs.logger.info(`\u{1F4F1} Found hydratable route: ${route.pattern} -> ${route.modulePath}`);
|
|
2634
2816
|
}
|
|
@@ -2650,6 +2832,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2650
2832
|
) ? _nullishCoalesce(hydrationStrategies[0], () => ( "load")) : "load";
|
|
2651
2833
|
const docsClientRoutes = syntheticDocsPatterns.map((pattern) => ({
|
|
2652
2834
|
pattern,
|
|
2835
|
+
docs: true,
|
|
2653
2836
|
modulePath: "",
|
|
2654
2837
|
relativePath: "",
|
|
2655
2838
|
pageShouldHydrate: false,
|
|
@@ -2664,7 +2847,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2664
2847
|
}
|
|
2665
2848
|
const clientRouteSlots = routeSlots.filter((slot) => {
|
|
2666
2849
|
try {
|
|
2667
|
-
const metadata =
|
|
2850
|
+
const metadata = _chunkMZ4CRSY7cjs.getClientModuleMetadata.call(void 0, slot.modulePath, root);
|
|
2668
2851
|
return metadata.shouldHydrate && (!islandsMode || metadata.isClientComponent);
|
|
2669
2852
|
} catch (error) {
|
|
2670
2853
|
_chunkQMNWKQL4cjs.logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
|
|
@@ -2687,8 +2870,8 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2687
2870
|
srcDir,
|
|
2688
2871
|
adapterOwnsDocsRuntime ? false : _chunkDZZHTMWMcjs.isFarmDocsSearchEnabled.call(void 0, config.docs),
|
|
2689
2872
|
adapterOwnsDocsRuntime ? void 0 : _chunkDZZHTMWMcjs.resolveFarmDocsSearchClientModule.call(void 0, root),
|
|
2690
|
-
_optionalChain([config, 'access',
|
|
2691
|
-
adapterOwnsDocsRuntime ? _optionalChain([config, 'access',
|
|
2873
|
+
_optionalChain([config, 'access', _102 => _102.docs, 'optionalAccess', _103 => _103.enabled]) ? _chunkFVYBEMODcjs.getFarmDocsRoots.call(void 0, config.docs).map((docsRoot) => docsRoot.entry) : void 0,
|
|
2874
|
+
adapterOwnsDocsRuntime ? _optionalChain([config, 'access', _104 => _104.docs, 'access', _105 => _105.adapter, 'optionalAccess', _106 => _106.react]) : void 0,
|
|
2692
2875
|
config.i18n,
|
|
2693
2876
|
config.plugins,
|
|
2694
2877
|
config.renderer,
|
|
@@ -2696,11 +2879,11 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2696
2879
|
config.trailingSlash,
|
|
2697
2880
|
_chunkBDYM2TN3cjs.getIntegrationProviders.call(void 0, config.integrations),
|
|
2698
2881
|
config.basePath,
|
|
2699
|
-
|
|
2882
|
+
_chunkF36LS2C7cjs.generateClientCachePersistenceCode.call(void 0, _chunkF36LS2C7cjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
|
|
2700
2883
|
adapterOwnsDocsRuntime ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0,
|
|
2701
|
-
_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
2884
|
+
_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _107 => _107.experimental, 'optionalAccess', _108 => _108.serverComponents])) === "islands",
|
|
2702
2885
|
platform,
|
|
2703
|
-
islandsMode ?
|
|
2886
|
+
islandsMode ? _chunkMZ4CRSY7cjs.collectFarmServerStylesheets.call(void 0,
|
|
2704
2887
|
[
|
|
2705
2888
|
...layoutRoutes.map((layout) => layout.modulePath),
|
|
2706
2889
|
...pageRoutes.filter((route) => !isAdapterDocsRoute(route.pattern)).map((route) => route.modulePath)
|
|
@@ -2715,7 +2898,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2715
2898
|
await fs4.writeFile(_path2.default.join(clientEntryDir, "farm-client-router.tsx"), clientEntry.router);
|
|
2716
2899
|
}
|
|
2717
2900
|
const clientInput = { [entryName]: clientEntryPath };
|
|
2718
|
-
if (platform === "web" &&
|
|
2901
|
+
if (platform === "web" && _chunkF36LS2C7cjs.canBootFarmIslandsClient.call(void 0, config)) {
|
|
2719
2902
|
const clientBootPath = _path2.default.join(clientEntryDir, "farm-client-boot.tsx");
|
|
2720
2903
|
await fs4.writeFile(
|
|
2721
2904
|
clientBootPath,
|
|
@@ -2758,7 +2941,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2758
2941
|
outDir: outputDir,
|
|
2759
2942
|
emptyOutDir: platform === "web",
|
|
2760
2943
|
// Never public: see resolveFarmClientSourcemap.
|
|
2761
|
-
sourcemap: resolveFarmClientSourcemap(_optionalChain([config, 'access',
|
|
2944
|
+
sourcemap: resolveFarmClientSourcemap(_optionalChain([config, 'access', _109 => _109.vite, 'optionalAccess', _110 => _110.build, 'optionalAccess', _111 => _111.sourcemap])),
|
|
2762
2945
|
assetsInlineLimit: 0,
|
|
2763
2946
|
cssCodeSplit: false,
|
|
2764
2947
|
// Bundle all CSS into one file
|
|
@@ -2770,7 +2953,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2770
2953
|
hashCharacters: "hex",
|
|
2771
2954
|
// Use predictable name for CSS so we can reference it in SSR HTML
|
|
2772
2955
|
assetFileNames: (assetInfo) => {
|
|
2773
|
-
if (_optionalChain([assetInfo, 'access',
|
|
2956
|
+
if (_optionalChain([assetInfo, 'access', _112 => _112.name, 'optionalAccess', _113 => _113.endsWith, 'call', _114 => _114(".css")])) {
|
|
2774
2957
|
return `${entryName}.css`;
|
|
2775
2958
|
}
|
|
2776
2959
|
return "assets/[name]-h[hash][extname]";
|
|
@@ -2779,7 +2962,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2779
2962
|
// A browser cannot load a Node builtin: farmServerOnlyEntriesPlugin
|
|
2780
2963
|
// resolves one to Farm's browser module for it instead.
|
|
2781
2964
|
external: (id) => {
|
|
2782
|
-
if (id
|
|
2965
|
+
if (importsFarmClientBlockedPackage(id, "fsevents") || id.endsWith(".node")) {
|
|
2783
2966
|
return true;
|
|
2784
2967
|
}
|
|
2785
2968
|
return false;
|
|
@@ -2787,7 +2970,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2787
2970
|
}
|
|
2788
2971
|
},
|
|
2789
2972
|
plugins: [
|
|
2790
|
-
|
|
2973
|
+
_chunkF36LS2C7cjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
2791
2974
|
createFarmPrivateClientSourcemapsPlugin({
|
|
2792
2975
|
outDir: _path2.default.join(
|
|
2793
2976
|
_path2.default.dirname(outputDir),
|
|
@@ -2819,61 +3002,77 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2819
3002
|
...rendererVitePlugins,
|
|
2820
3003
|
...config.vite.plugins || [],
|
|
2821
3004
|
farmServerOnlyEntriesPlugin({ platform }),
|
|
2822
|
-
|
|
3005
|
+
_chunkF36LS2C7cjs.farmDocsClientConfigPlugin.call(void 0,
|
|
2823
3006
|
adapterOwnsDocsRuntime ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
|
|
2824
3007
|
),
|
|
2825
3008
|
// Plugin to redirect @farm.js/core imports to client-only exports
|
|
2826
3009
|
{
|
|
2827
3010
|
name: "farm-client-only-imports",
|
|
2828
3011
|
enforce: "pre",
|
|
2829
|
-
resolveId
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
3012
|
+
resolveId: {
|
|
3013
|
+
// Every specifier the handler redirects, as a superset of its checks.
|
|
3014
|
+
filter: {
|
|
3015
|
+
id: /@farm\.js\/core|\/api\/|fsevents|\.node$|node-pre-gyp|nf3|^(?:nitro|vite|esbuild|rolldown|rollup)(?:\/|$)/
|
|
3016
|
+
},
|
|
3017
|
+
handler(id) {
|
|
3018
|
+
if (id === "@farm.js/core") {
|
|
3019
|
+
return { id: "\0farm-client-exports", external: false };
|
|
3020
|
+
}
|
|
3021
|
+
if (id === "@farm.js/core/i18n/server") {
|
|
3022
|
+
return { id: "\0farm-i18n-client-bridge", external: false };
|
|
3023
|
+
}
|
|
3024
|
+
if (id === "@farm.js/core/server" || id === "@farm.js/core/api" || id === "@farm.js/core/middleware" || id === "@farm.js/core/headers" || id === "@farm.js/core/config" || id.includes("@farm.js/core/middleware") || id.includes("@farm.js/core/query/server")) {
|
|
3025
|
+
return { id: "\0empty-module", external: false };
|
|
3026
|
+
}
|
|
3027
|
+
if (importsFarmApiRouteModule(id)) {
|
|
3028
|
+
return { id: "\0empty-api-route", external: false };
|
|
3029
|
+
}
|
|
3030
|
+
if (importsFarmClientBlockedPackage(id, "fsevents") || id.endsWith(".node") || id === "nitro" || id === "vite" || id === "esbuild" || id === "rolldown" || id.startsWith("rolldown/") || id === "rollup" || id.startsWith("nitro/") || importsFarmClientBlockedPackage(id, "node-pre-gyp") || importsFarmClientBlockedPackage(id, "@mapbox/node-pre-gyp") || importsFarmClientBlockedPackage(id, "nf3")) {
|
|
3031
|
+
return { id: "\0empty-module", external: false };
|
|
3032
|
+
}
|
|
3033
|
+
return null;
|
|
2844
3034
|
}
|
|
2845
|
-
return null;
|
|
2846
3035
|
},
|
|
2847
|
-
load
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
'export {
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
3036
|
+
load: {
|
|
3037
|
+
filter: {
|
|
3038
|
+
id: _chunkF36LS2C7cjs.exactIdPattern.call(void 0, [
|
|
3039
|
+
"\0empty-module",
|
|
3040
|
+
"\0empty-api-route",
|
|
3041
|
+
"\0farm-i18n-client-bridge",
|
|
3042
|
+
"\0farm-client-exports"
|
|
3043
|
+
])
|
|
3044
|
+
},
|
|
3045
|
+
handler(id) {
|
|
3046
|
+
if (id === "\0empty-module") {
|
|
3047
|
+
return "const emptyMiddlewareStore = new Map(); export default {}; export const getMiddlewareContext = () => emptyMiddlewareStore; export const getMiddlewareData = () => emptyMiddlewareStore; export const getMiddlewareValue = () => undefined; export const middleware = () => ({});";
|
|
3048
|
+
}
|
|
3049
|
+
if (id === "\0empty-api-route") {
|
|
3050
|
+
return "export const GET = () => {}; export const HEAD = () => {}; export const QUERY = () => {}; export const POST = () => {}; export const PUT = () => {}; export const DELETE = () => {}; export const PATCH = () => {}; export const OPTIONS = () => {}; export default {};";
|
|
3051
|
+
}
|
|
3052
|
+
if (id === "\0farm-i18n-client-bridge") {
|
|
3053
|
+
return 'export { createTranslator, format, getLocale, getLocaleSource, t } from "@farm.js/core/i18n/client";';
|
|
3054
|
+
}
|
|
3055
|
+
if (id === "\0farm-client-exports") {
|
|
3056
|
+
return [
|
|
3057
|
+
"// Farm.js Client Exports - Safe for browser bundling",
|
|
3058
|
+
'export { Link } from "@farm.js/core/client";',
|
|
3059
|
+
'export { useRouter } from "@farm.js/core/client";',
|
|
3060
|
+
'export { usePathname, useSearchParams } from "@farm.js/core/navigation";',
|
|
3061
|
+
// A page that hydrates ships to the browser with its notFound()/redirect() calls.
|
|
3062
|
+
'export { getFarmRedirectError, isFarmNotFoundError, isFarmRedirectError, notFound, permanentRedirect, redirect } from "@farm.js/core/navigation";',
|
|
3063
|
+
'export { createAPIClient } from "@farm.js/core/client";',
|
|
3064
|
+
'export { localFont, remoteFont } from "@farm.js/core/font";'
|
|
3065
|
+
].join("\n");
|
|
3066
|
+
}
|
|
3067
|
+
return null;
|
|
2868
3068
|
}
|
|
2869
|
-
return null;
|
|
2870
3069
|
}
|
|
2871
3070
|
},
|
|
2872
3071
|
farmPlugin(
|
|
2873
3072
|
{ ...config, isolatedClientBoundaryModules, programmaticClientRoutes },
|
|
2874
3073
|
pluginManager
|
|
2875
3074
|
),
|
|
2876
|
-
|
|
3075
|
+
_chunkMZ4CRSY7cjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
|
|
2877
3076
|
],
|
|
2878
3077
|
mode: "production",
|
|
2879
3078
|
css: postcssSearchPath ? {
|
|
@@ -2881,7 +3080,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2881
3080
|
} : void 0,
|
|
2882
3081
|
// Ensure React is bundled for client
|
|
2883
3082
|
resolve: {
|
|
2884
|
-
alias:
|
|
3083
|
+
alias: _chunkF36LS2C7cjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
2885
3084
|
dedupe: [...config.renderer.dedupe || []]
|
|
2886
3085
|
},
|
|
2887
3086
|
// Optimize dependencies - exclude server-side code from client bundle
|
|
@@ -2894,7 +3093,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
2894
3093
|
]
|
|
2895
3094
|
}
|
|
2896
3095
|
};
|
|
2897
|
-
await viteBuild(
|
|
3096
|
+
await viteBuild(_chunkF36LS2C7cjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
|
|
2898
3097
|
if (platform === "mobile") {
|
|
2899
3098
|
await fs4.rm(_path2.default.join(outputDir, `${entryName}.css`), { force: true });
|
|
2900
3099
|
if (!await _chunkE5UN4OWXcjs.hasFarmMobileClientEntry.call(void 0, _path2.default.dirname(outputDir), outputDir)) {
|
|
@@ -2994,7 +3193,7 @@ async function fetchFarmNavigationDocument(url, headers, recover = true, signal)
|
|
|
2994
3193
|
return response;
|
|
2995
3194
|
}
|
|
2996
3195
|
|
|
2997
|
-
${streamNavigations ?
|
|
3196
|
+
${streamNavigations ? _chunkF36LS2C7cjs.FARM_NAVIGATION_STREAM_READER_SOURCE : ""}
|
|
2998
3197
|
|
|
2999
3198
|
function clearFarmPrefetchCacheOnDeploymentMismatch(router, error) {
|
|
3000
3199
|
if (error?.name === "FarmDeploymentMismatchError") {
|
|
@@ -3014,6 +3213,14 @@ function hasAbsoluteNavigationHref(href) {
|
|
|
3014
3213
|
}
|
|
3015
3214
|
`.trim();
|
|
3016
3215
|
}
|
|
3216
|
+
function generateClientPageDirectorySource() {
|
|
3217
|
+
return `function getFarmPageDirectory(pathname) {
|
|
3218
|
+
const path = getFarmRoutePathname(pathname);
|
|
3219
|
+
let matched = clientRouteMatcher.match(path);
|
|
3220
|
+
if (matched && matched.route.meta.docs) matched = clientPageRouteMatcher.match(path);
|
|
3221
|
+
return matched ? matched.route.meta.directory || matched.route.meta.pattern : null;
|
|
3222
|
+
}`;
|
|
3223
|
+
}
|
|
3017
3224
|
function generateRuntimePathMatcherSource() {
|
|
3018
3225
|
return `
|
|
3019
3226
|
function normalizeRuntimePath(pathname) {
|
|
@@ -3173,30 +3380,35 @@ function encodeRuntimePathSegment(value) {
|
|
|
3173
3380
|
}
|
|
3174
3381
|
|
|
3175
3382
|
function interpolateRedirectDestination(destination, params) {
|
|
3176
|
-
let result = destination;
|
|
3177
3383
|
const catchAllParamSegments = params[farmCatchAllParamSegments] || {};
|
|
3384
|
+
const encodedParams = new Map();
|
|
3178
3385
|
const orderedCaptures = [];
|
|
3179
3386
|
for (const [key, value] of Object.entries(params)) {
|
|
3180
3387
|
const segments = catchAllParamSegments[key];
|
|
3181
3388
|
const encodedValue = Array.isArray(segments)
|
|
3182
3389
|
? segments.map(encodeRuntimePathSegment).join("/")
|
|
3183
3390
|
: encodeRuntimePathSegment(value);
|
|
3391
|
+
encodedParams.set(key, encodedValue);
|
|
3184
3392
|
orderedCaptures.push(encodedValue);
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3393
|
+
}
|
|
3394
|
+
// One pass that reads each reference whole, as the development path does: ":id" never
|
|
3395
|
+
// consumes the start of ":idx", an unknown ":name" stays as written, and an injected value is
|
|
3396
|
+
// never read again. An out-of-range "$n" resolves to "", matching the development path.
|
|
3397
|
+
return destination.replace(
|
|
3398
|
+
/\\[\\[\\.\\.\\.(\\w+)\\]\\]|\\[\\.\\.\\.(\\w+)\\]|\\[(\\w+)\\]|:([A-Za-z0-9_]+)(\\*?)|\\$(\\d+)|\\*/g,
|
|
3399
|
+
function(whole, optionalCatchAll, catchAll, bracket, name, star, group) {
|
|
3400
|
+
if (group !== undefined) {
|
|
3401
|
+
const captured = orderedCaptures[Number(group) - 1];
|
|
3402
|
+
return captured === undefined ? "" : captured;
|
|
3403
|
+
}
|
|
3404
|
+
const wildcard = encodedParams.has("wildcard") ? encodedParams.get("wildcard") : "*";
|
|
3405
|
+
const key = optionalCatchAll || catchAll || bracket || name;
|
|
3406
|
+
if (key === undefined) return wildcard;
|
|
3407
|
+
if (encodedParams.has(key)) return encodedParams.get(key);
|
|
3408
|
+
if (name === undefined) return whole;
|
|
3409
|
+
return ":" + name + (star ? wildcard : "");
|
|
3410
|
+
},
|
|
3411
|
+
);
|
|
3200
3412
|
}
|
|
3201
3413
|
`.trim();
|
|
3202
3414
|
}
|
|
@@ -3525,8 +3737,10 @@ ${streamNavigations ? ` // A streamed navigation swaps in the page's shell; its
|
|
|
3525
3737
|
const record = recover ? null : { valid: true, deploymentId, promise: null };
|
|
3526
3738
|
// A navigation (not a prefetch) streams when the router supports it: the page goes in as
|
|
3527
3739
|
// soon as its shell arrives, and its Suspense content follows (takeNavigationStream). A page
|
|
3528
|
-
// whose layouts hydrate, or one rendered in this page's React root, arrives whole.
|
|
3529
|
-
|
|
3740
|
+
// whose layouts hydrate, or one rendered in this page's React root, arrives whole. So does a
|
|
3741
|
+
// refresh, which renders every layout again (no layout chain): like a transition, it keeps
|
|
3742
|
+
// the page on screen until the new one is ready, so the islands it keeps are all in it.
|
|
3743
|
+
const streamShell = ${streamNavigations ? `recover && layoutChain && !interceptFrom && !partialHeaders["F-Render"] &&
|
|
3530
3744
|
!hasHydratableLayout(new URL(url, window.location.href).pathname)` : "false"};
|
|
3531
3745
|
const request = async () => {
|
|
3532
3746
|
const response = await fetchFarmNavigationDocument(url, {
|
|
@@ -3538,7 +3752,7 @@ ${streamNavigations ? ` // A streamed navigation swaps in the page's shell; its
|
|
|
3538
3752
|
...partialHeaders,
|
|
3539
3753
|
...(streamShell ? { "F-Stream": "flush" } : {}),
|
|
3540
3754
|
}, recover, signal);
|
|
3541
|
-
if (!response.ok) throw new Error("Failed to fetch page");
|
|
3755
|
+
if (!response.ok) throw new Error("Failed to fetch page: " + response.status);
|
|
3542
3756
|
const store = (html) => {
|
|
3543
3757
|
if (cacheResult && !signal?.aborted && generation === this.prefetchGeneration &&
|
|
3544
3758
|
deploymentId === window.__FARM_DEPLOYMENT_ID__ && (!record || record.valid)) {
|
|
@@ -3841,7 +4055,7 @@ function readFarmEntryImports(source) {
|
|
|
3841
4055
|
for (const match of source.matchAll(/^import\s+([^"';]+?)\s+from\s+(["'][^"']+["'])/gm)) {
|
|
3842
4056
|
const from = match[2];
|
|
3843
4057
|
const named = /\{([^}]*)\}/.exec(match[1]);
|
|
3844
|
-
for (const specifier of _nullishCoalesce(_optionalChain([named, 'optionalAccess',
|
|
4058
|
+
for (const specifier of _nullishCoalesce(_optionalChain([named, 'optionalAccess', _115 => _115[1], 'optionalAccess', _116 => _116.split, 'call', _117 => _117(",")]), () => ( []))) {
|
|
3845
4059
|
const [imported, local] = specifier.trim().split(/\s+as\s+/);
|
|
3846
4060
|
if (imported)
|
|
3847
4061
|
bindings.push({ local: _nullishCoalesce(local, () => ( imported)), clause: `{ ${specifier.trim()} }`, from });
|
|
@@ -3948,7 +4162,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
3948
4162
|
import { createRoot, hydrateRoot } from "react-dom/client";` : appSetupPath ? `import React, { createRoot, hydrateRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)};
|
|
3949
4163
|
import __farmAppSetup from ${JSON.stringify(_chunkQMNWKQL4cjs.toPosixPath.call(void 0, appSetupPath))};
|
|
3950
4164
|
__farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};`;
|
|
3951
|
-
const providerClientCode =
|
|
4165
|
+
const providerClientCode = _chunkF36LS2C7cjs.generateFarmIntegrationProviderClientCode.call(void 0,
|
|
3952
4166
|
integrationProviders,
|
|
3953
4167
|
root,
|
|
3954
4168
|
_nullishCoalesce(renderer.componentExtensions, () => ( []))
|
|
@@ -4069,6 +4283,8 @@ mountFarmDocsSearch();
|
|
|
4069
4283
|
|
|
4070
4284
|
${generateUniversalRouterStateRuntime()}
|
|
4071
4285
|
|
|
4286
|
+
${_chunkF36LS2C7cjs.FARM_NAVIGATION_SCRIPT_SOURCE}
|
|
4287
|
+
|
|
4072
4288
|
// SPA Router for server-rendered pages (HTML swap)
|
|
4073
4289
|
const spaRouter = {
|
|
4074
4290
|
${generateUniversalRouterStateProperties()}
|
|
@@ -4239,12 +4455,7 @@ ${generateUniversalRouterStateProperties()}
|
|
|
4239
4455
|
|
|
4240
4456
|
setTimeout(function() {
|
|
4241
4457
|
Array.from(document.querySelectorAll("script")).forEach(function(script) {
|
|
4242
|
-
|
|
4243
|
-
Array.from(script.attributes).forEach(function(attr) {
|
|
4244
|
-
freshScript.setAttribute(attr.name, attr.value);
|
|
4245
|
-
});
|
|
4246
|
-
freshScript.textContent = script.textContent || "";
|
|
4247
|
-
script.replaceWith(freshScript);
|
|
4458
|
+
script.replaceWith(createFarmNavigationScript(script));
|
|
4248
4459
|
});
|
|
4249
4460
|
}, 0);
|
|
4250
4461
|
|
|
@@ -4351,7 +4562,7 @@ document.addEventListener("click", function(e) {
|
|
|
4351
4562
|
routeEntries.push(` {
|
|
4352
4563
|
pattern: ${JSON.stringify(page.pattern)},${page.directory ? `
|
|
4353
4564
|
directory: ${JSON.stringify(page.directory)},` : ""}
|
|
4354
|
-
pageShouldHydrate: ${JSON.stringify(page.pageShouldHydrate)},
|
|
4565
|
+
pageShouldHydrate: ${JSON.stringify(page.pageShouldHydrate)},${page.docs ? "\n docs: true," : ""}
|
|
4355
4566
|
${page.hasIsolatedClientBoundaries ? "hasIsolatedClientBoundaries: true," : ""}
|
|
4356
4567
|
islandStrategy: ${JSON.stringify(page.islandStrategy)},
|
|
4357
4568
|
navigation: "html-fragment",
|
|
@@ -4452,6 +4663,12 @@ ${routeEntries.join(",\n")}
|
|
|
4452
4663
|
const clientRouteMatcher = createFarmRouter(clientRoutes.map(function(route) {
|
|
4453
4664
|
return { path: route.pattern, meta: route };
|
|
4454
4665
|
}));
|
|
4666
|
+
${clientPages.some((page) => page.docs) ? `const clientPageRouteMatcher = createFarmRouter(clientRoutes.filter(function(route) {
|
|
4667
|
+
return !route.docs;
|
|
4668
|
+
}).map(function(route) {
|
|
4669
|
+
return { path: route.pattern, meta: route };
|
|
4670
|
+
}));` : "const clientPageRouteMatcher = clientRouteMatcher;"}
|
|
4671
|
+
${generateClientPageDirectorySource()}
|
|
4455
4672
|
|
|
4456
4673
|
${isolatedHydrationRuntime}
|
|
4457
4674
|
${routeClientGraphRuntime}
|
|
@@ -4477,10 +4694,7 @@ function getApplicableLayouts(pathname) {
|
|
|
4477
4694
|
const urlPattern = layout.urlPattern || layout.pattern;
|
|
4478
4695
|
if (urlPattern !== '/' && !isFarmRouteActive(urlPattern, normalizedPath, { exact: false })) continue;
|
|
4479
4696
|
if (layout.groupScope) {
|
|
4480
|
-
if (directory === undefined)
|
|
4481
|
-
const matched = matchRoute(pathname);
|
|
4482
|
-
directory = matched ? matched.route.directory || matched.route.pattern : null;
|
|
4483
|
-
}
|
|
4697
|
+
if (directory === undefined) directory = getFarmPageDirectory(pathname);
|
|
4484
4698
|
if (
|
|
4485
4699
|
typeof directory !== 'string' ||
|
|
4486
4700
|
(directory !== layout.groupScope && !directory.startsWith(layout.groupScope + '/'))
|
|
@@ -4505,7 +4719,7 @@ function hasHydratableLayout(pathname) {
|
|
|
4505
4719
|
});
|
|
4506
4720
|
}
|
|
4507
4721
|
|
|
4508
|
-
${
|
|
4722
|
+
${_chunkF36LS2C7cjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
|
|
4509
4723
|
// Wrap a page element with applicable layouts
|
|
4510
4724
|
function wrapWithLayouts(pageElement, pathname, params) {
|
|
4511
4725
|
const layouts = getApplicableLayouts(pathname);
|
|
@@ -4540,7 +4754,7 @@ function createLayoutPageBoundary(route, pageElement, serverHtml) {
|
|
|
4540
4754
|
return React.createElement("div", props, pageElement);
|
|
4541
4755
|
}
|
|
4542
4756
|
let farmLastRouteState = null;
|
|
4543
|
-
${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${
|
|
4757
|
+
${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${_chunkF36LS2C7cjs.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE}
|
|
4544
4758
|
function farmTreeLayoutsOf(pathname) {
|
|
4545
4759
|
return getApplicableLayouts(pathname).filter(function(layout) {
|
|
4546
4760
|
return layout.serverTree === true;
|
|
@@ -5053,10 +5267,12 @@ async function hydrate() {
|
|
|
5053
5267
|
}
|
|
5054
5268
|
},
|
|
5055
5269
|
});
|
|
5056
|
-
${isolatedHydrationEnabled ?
|
|
5270
|
+
${isolatedHydrationEnabled ? `// Not cancelled with the page: a navigation disposes the islands it removes, and one in a
|
|
5271
|
+
// layout it keeps still waits for its trigger, as on a page of islands only.
|
|
5272
|
+
const isolatedHydration =
|
|
5057
5273
|
!hasHydratableLayout(pathname) &&
|
|
5058
5274
|
document.querySelector('f-island[src]')
|
|
5059
|
-
? hydrateFarmIsolatedClientBoundaries(document
|
|
5275
|
+
? hydrateFarmIsolatedClientBoundaries(document)
|
|
5060
5276
|
: Promise.resolve();
|
|
5061
5277
|
await Promise.all([pageHydration, isolatedHydration]);` : "await pageHydration;"}
|
|
5062
5278
|
} finally {
|
|
@@ -5102,14 +5318,11 @@ function fitsSegmentResponse(currentRoot, nextRoot) {
|
|
|
5102
5318
|
return true;
|
|
5103
5319
|
}` : ""}
|
|
5104
5320
|
|
|
5321
|
+
${_chunkF36LS2C7cjs.FARM_NAVIGATION_SCRIPT_SOURCE}
|
|
5322
|
+
|
|
5105
5323
|
function activateNavigationScripts(root) {
|
|
5106
5324
|
for (const script of Array.from(root?.querySelectorAll?.("script") || [])) {
|
|
5107
|
-
|
|
5108
|
-
for (const attribute of Array.from(script.attributes)) {
|
|
5109
|
-
freshScript.setAttribute(attribute.name, attribute.value);
|
|
5110
|
-
}
|
|
5111
|
-
freshScript.textContent = script.textContent || "";
|
|
5112
|
-
script.replaceWith(freshScript);
|
|
5325
|
+
script.replaceWith(createFarmNavigationScript(script));
|
|
5113
5326
|
}
|
|
5114
5327
|
}
|
|
5115
5328
|
|
|
@@ -5183,8 +5396,8 @@ function removeSuspenseContent(root) {
|
|
|
5183
5396
|
}
|
|
5184
5397
|
}
|
|
5185
5398
|
|
|
5186
|
-
// A layout's own server output, without what it wraps and without its islands,
|
|
5187
|
-
// always differs from fresh HTML.
|
|
5399
|
+
// A layout's own server output, without what it wraps and without its islands' DOM, which live
|
|
5400
|
+
// always differs from fresh HTML. It keeps each island's props, so new props count as a change.
|
|
5188
5401
|
function getLayoutShell(root, patterns, index) {
|
|
5189
5402
|
const shell = findLayoutBoundary(root, patterns[index])?.cloneNode(true);
|
|
5190
5403
|
if (!shell) return null;
|
|
@@ -5193,7 +5406,12 @@ function getLayoutShell(root, patterns, index) {
|
|
|
5193
5406
|
: shell.querySelector("#__farm_page__");
|
|
5194
5407
|
inner?.replaceChildren();
|
|
5195
5408
|
removeSuspenseContent(shell);
|
|
5196
|
-
shell.querySelectorAll("script").forEach(function(script) {
|
|
5409
|
+
shell.querySelectorAll("script").forEach(function(script) {
|
|
5410
|
+
if (script.type !== "f/props") return script.remove();
|
|
5411
|
+
Array.from(script.attributes).forEach(function(attribute) {
|
|
5412
|
+
if (attribute.name !== "type") script.removeAttribute(attribute.name);
|
|
5413
|
+
});
|
|
5414
|
+
});
|
|
5197
5415
|
shell.querySelectorAll("f-island").forEach(function(island) {
|
|
5198
5416
|
island.replaceChildren();
|
|
5199
5417
|
Array.from(island.attributes).forEach(function(attribute) {
|
|
@@ -5203,7 +5421,9 @@ function getLayoutShell(root, patterns, index) {
|
|
|
5203
5421
|
return shell.innerHTML;
|
|
5204
5422
|
}
|
|
5205
5423
|
|
|
5206
|
-
function replaceSharedLayoutBoundary(currentRoot, nextRoot, refresh = false) {
|
|
5424
|
+
${islandValues ? _chunkF36LS2C7cjs.FARM_REFRESH_FIELDS_SOURCE : ""}function replaceSharedLayoutBoundary(currentRoot, nextRoot, refresh = false) {
|
|
5425
|
+
// A refresh keeps the islands still on the page: the ones in streamed Suspense content too.
|
|
5426
|
+
if (refresh) revealFarmStreamedContent(nextRoot);
|
|
5207
5427
|
const currentPatterns = getLayoutPatterns(currentRoot);
|
|
5208
5428
|
const nextPatterns = getLayoutPatterns(nextRoot);
|
|
5209
5429
|
let sharedCount = 0;
|
|
@@ -5227,11 +5447,13 @@ function replaceSharedLayoutBoundary(currentRoot, nextRoot, refresh = false) {
|
|
|
5227
5447
|
? findLayoutBoundary(nextRoot, nextPatterns[sharedCount])
|
|
5228
5448
|
: nextRoot.querySelector("#__farm_page__");
|
|
5229
5449
|
|
|
5230
|
-
if (!currentTarget || !nextTarget) return false
|
|
5450
|
+
if (!currentTarget || !nextTarget) return false;${islandValues ? `
|
|
5451
|
+
// A refresh renders the same layouts again: their fields keep what was typed, and the focus.
|
|
5452
|
+
const fields = refresh ? captureFarmServerFields(currentTarget) : null;` : ""}
|
|
5231
5453
|
${isolatedHydrationEnabled ? `${islandValues ? `// A refresh keeps the islands still on the page, with their state and new props.
|
|
5232
5454
|
if (refresh) farmIsolatedHydrationRuntime.carryOver(currentTarget, nextTarget);
|
|
5233
5455
|
` : ""}disposeFarmIsolatedClientBoundaries(currentTarget);` : ""}
|
|
5234
|
-
currentTarget.replaceWith(nextTarget);
|
|
5456
|
+
currentTarget.replaceWith(nextTarget);${islandValues ? "\n if (fields) restoreFarmServerFields(fields, nextTarget);" : ""}
|
|
5235
5457
|
activateNavigationScripts(nextTarget);
|
|
5236
5458
|
if (nextTreeRoot && nextTreeRoot !== nextTarget) nextTreeRoot.remove();
|
|
5237
5459
|
|
|
@@ -5239,7 +5461,17 @@ function replaceSharedLayoutBoundary(currentRoot, nextRoot, refresh = false) {
|
|
|
5239
5461
|
const support = document.createElement("div");
|
|
5240
5462
|
support.hidden = true;
|
|
5241
5463
|
support.dataset.farmFragmentSupport = "true";
|
|
5242
|
-
while (nextRoot.firstChild)
|
|
5464
|
+
while (nextRoot.firstChild) {
|
|
5465
|
+
const node = nextRoot.firstChild;
|
|
5466
|
+
// React's staged Suspense content stays in the root, where a later flush of a streamed
|
|
5467
|
+
// navigation reveals it; React removes it then.
|
|
5468
|
+
if (node.nodeType === 1 && node.matches('div[hidden][id^="S:"]')) {
|
|
5469
|
+
currentRoot.appendChild(node);
|
|
5470
|
+
activateNavigationScripts(node);
|
|
5471
|
+
} else {
|
|
5472
|
+
support.appendChild(node);
|
|
5473
|
+
}
|
|
5474
|
+
}
|
|
5243
5475
|
document.body.appendChild(support);
|
|
5244
5476
|
activateNavigationScripts(support);
|
|
5245
5477
|
setTimeout(function() { support.remove(); }, 0);
|
|
@@ -5664,12 +5896,7 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
5664
5896
|
|
|
5665
5897
|
setTimeout(function() {
|
|
5666
5898
|
Array.from(document.querySelectorAll("script")).forEach(function(script) {
|
|
5667
|
-
|
|
5668
|
-
Array.from(script.attributes).forEach(function(attr) {
|
|
5669
|
-
freshScript.setAttribute(attr.name, attr.value);
|
|
5670
|
-
});
|
|
5671
|
-
freshScript.textContent = script.textContent || "";
|
|
5672
|
-
script.replaceWith(freshScript);
|
|
5899
|
+
script.replaceWith(createFarmNavigationScript(script));
|
|
5673
5900
|
});
|
|
5674
5901
|
}, 0);
|
|
5675
5902
|
|
|
@@ -5876,7 +6103,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5876
6103
|
modulePath: entry.modulePath
|
|
5877
6104
|
})) : [];
|
|
5878
6105
|
const i18nCatalogs = config.i18n.enabled ? (await _chunkBBPDJGCUcjs.readFarmI18nCatalogs.call(void 0, config.i18n)).catalogs : {};
|
|
5879
|
-
const appDirs =
|
|
6106
|
+
const appDirs = _chunkMTBDJ326cjs.getFarmAppDirectories.call(void 0, config);
|
|
5880
6107
|
let openAPIReference = null;
|
|
5881
6108
|
if (config.openapi.enabled && config.openapi.route) {
|
|
5882
6109
|
const { OpenAPIManager, renderOpenAPIReferenceHTML } = await import("./manager-JOHU6BQI.cjs");
|
|
@@ -5896,9 +6123,15 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5896
6123
|
specRoute: config.openapi.specRoute || null
|
|
5897
6124
|
};
|
|
5898
6125
|
}
|
|
5899
|
-
const
|
|
5900
|
-
const
|
|
5901
|
-
|
|
6126
|
+
const discoveredMiddlewareRoutes = await discoverMiddlewareRoutes(appDirs);
|
|
6127
|
+
const middlewareRoutes = farmTargetRunsEdgeMiddleware(preset) ? await Promise.all(
|
|
6128
|
+
discoveredMiddlewareRoutes.map(async (route) => ({
|
|
6129
|
+
...route,
|
|
6130
|
+
config: await readMiddlewareFileConfig(route.filePath)
|
|
6131
|
+
}))
|
|
6132
|
+
) : discoveredMiddlewareRoutes;
|
|
6133
|
+
const instrumentationPath = _chunk3GNHJ3RNcjs.resolveFarmInstrumentationFile.call(void 0, root, config.srcDir || "src");
|
|
6134
|
+
const notFoundPath = _chunkF36LS2C7cjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
|
|
5902
6135
|
if (notFoundPath) _chunkQMNWKQL4cjs.logger.info(`\u{1F4CB} Found custom 404 page: ${notFoundPath}`);
|
|
5903
6136
|
layoutRoutes.sort((a, b) => {
|
|
5904
6137
|
const depthA = a.pattern.split("/").filter(Boolean).length;
|
|
@@ -5919,10 +6152,10 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5919
6152
|
(provider) => provider.component || provider.type === "clerk"
|
|
5920
6153
|
);
|
|
5921
6154
|
const hasObservabilityHandler = !!config.observability && typeof config.observability === "object" && "onEvent" in config.observability;
|
|
5922
|
-
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access',
|
|
6155
|
+
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _118 => _118.mdx, 'optionalAccess', _119 => _119.components]));
|
|
5923
6156
|
const hasMiddlewareConfig = _chunkUPOYKX4Scjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
|
|
5924
|
-
const hasRouteContextConfig =
|
|
5925
|
-
const hasServerRuntimePlugins = hasFarmServerRuntimePlugins(config);
|
|
6157
|
+
const hasRouteContextConfig = _chunk7LK5CTUMcjs.hasCustomFarmRouteContext.call(void 0, config);
|
|
6158
|
+
const hasServerRuntimePlugins = _chunkHHLEYA4Bcjs.hasFarmServerRuntimePlugins.call(void 0, config.plugins);
|
|
5926
6159
|
const hasPluginRoutes = hasFarmPluginRoutes(config);
|
|
5927
6160
|
const hasServerCacheConfig = hasFarmServerCacheConfig(config.cache);
|
|
5928
6161
|
const configModulePath = hasServerRuntimeIntegrations || hasObservabilityHandler || hasMdxComponentConfig || hasMiddlewareConfig || hasRouteContextConfig || hasServerRuntimePlugins || hasPluginRoutes || hasServerCacheConfig || hasFarmServerStorageConfig(config.storage) || hasIntegrationProviders ? await findFarmConfigPath(root) : null;
|
|
@@ -5931,18 +6164,19 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
5931
6164
|
const hasConfiguredRuntimePlugins = Boolean(
|
|
5932
6165
|
hasRuntimeConfigModule && (config.plugins || []).length > 0
|
|
5933
6166
|
);
|
|
5934
|
-
if (
|
|
6167
|
+
if (_chunkLDEXTX4Icjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
|
|
5935
6168
|
const adapterGuardedPaths = new Set(getFarmDocsGuardedPaths(config, middlewareRoutes));
|
|
5936
|
-
|
|
6169
|
+
_chunkLDEXTX4Icjs.assertFarmDocsAdapterServesNoGuardedPages.call(void 0,
|
|
5937
6170
|
config.docs,
|
|
5938
6171
|
{ root, srcDir: config.srcDir },
|
|
5939
|
-
(pathname) => adapterGuardedPaths.has(pathname)
|
|
6172
|
+
(pathname) => adapterGuardedPaths.has(pathname),
|
|
6173
|
+
_chunkI7J5RLGOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? "edge" : "node"
|
|
5940
6174
|
);
|
|
5941
6175
|
}
|
|
5942
6176
|
const farmDocsCspNonceMarker = _chunk6JHZPB52cjs.createFarmCspNonce.call(void 0, config.security);
|
|
5943
|
-
const farmDocsPrecompiledManifest = _optionalChain([config, 'access',
|
|
6177
|
+
const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _120 => _120.docs, 'optionalAccess', _121 => _121.enabled]) && _chunkI7J5RLGOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? await _chunkHDPT6OYEcjs._runWithFarmCspNonce.call(void 0,
|
|
5944
6178
|
farmDocsCspNonceMarker,
|
|
5945
|
-
async () => _optionalChain([config, 'access',
|
|
6179
|
+
async () => _optionalChain([config, 'access', _122 => _122.docs, 'access', _123 => _123.adapter, 'optionalAccess', _124 => _124.server]) ? await _chunkLDEXTX4Icjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
|
|
5946
6180
|
root,
|
|
5947
6181
|
srcDir: config.srcDir,
|
|
5948
6182
|
clientEntry: FARM_CLIENT_JS_SRC_PLACEHOLDER,
|
|
@@ -6054,7 +6288,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6054
6288
|
// Adapters can render provider scripts by serializing function source.
|
|
6055
6289
|
// keepNames injects helper calls into those functions; after Nitro
|
|
6056
6290
|
// minifies the server chunk the helper is no longer in script scope.
|
|
6057
|
-
keepNames: !(_optionalChain([config, 'access',
|
|
6291
|
+
keepNames: !(_optionalChain([config, 'access', _125 => _125.docs, 'optionalAccess', _126 => _126.enabled]) && _optionalChain([config, 'access', _127 => _127.docs, 'access', _128 => _128.adapter, 'optionalAccess', _129 => _129.server])),
|
|
6058
6292
|
jsxDev: false
|
|
6059
6293
|
},
|
|
6060
6294
|
// SSR configuration to externalize problematic modules
|
|
@@ -6104,10 +6338,10 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6104
6338
|
define: {
|
|
6105
6339
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
6106
6340
|
__FARM_ENV__: JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, config.env)),
|
|
6107
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
6341
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _130 => _130.env, 'optionalAccess', _131 => _131.public]) || {})
|
|
6108
6342
|
},
|
|
6109
6343
|
plugins: [
|
|
6110
|
-
|
|
6344
|
+
_chunkF36LS2C7cjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
6111
6345
|
...tailwindVitePlugin ? [tailwindVitePlugin] : [],
|
|
6112
6346
|
...rendererVitePlugins,
|
|
6113
6347
|
...config.vite.plugins || [],
|
|
@@ -6127,10 +6361,10 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6127
6361
|
},
|
|
6128
6362
|
createVercelOgFontInlinePlugin(edgeMetadataImageRuntime.runtime)
|
|
6129
6363
|
] : [],
|
|
6130
|
-
{ ...createReactProductionModePlugin(), enforce: "pre" },
|
|
6364
|
+
{ ..._chunkNG2EZ6QScjs.createReactProductionModePlugin.call(void 0, ), enforce: "pre" },
|
|
6131
6365
|
farmServerOnlyEntriesPlugin(),
|
|
6132
6366
|
farmPlugin({ ...config, isolatedClientBoundaryModules }, pluginManager),
|
|
6133
|
-
|
|
6367
|
+
_chunkMZ4CRSY7cjs.farmEnvironmentFunctionsPlugin.call(void 0, config),
|
|
6134
6368
|
...hasRuntimeConfigModule ? [
|
|
6135
6369
|
farmStripPlatformConfigPlugin(
|
|
6136
6370
|
[
|
|
@@ -6141,17 +6375,23 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6141
6375
|
] : [],
|
|
6142
6376
|
{
|
|
6143
6377
|
name: "farm-virtual-ssr-entry",
|
|
6144
|
-
resolveId
|
|
6145
|
-
|
|
6146
|
-
|
|
6378
|
+
resolveId: {
|
|
6379
|
+
filter: { id: _chunkF36LS2C7cjs.exactIdPattern.call(void 0, [virtualEntryId, "\0virtual:farm-ssr-entry"]) },
|
|
6380
|
+
handler(id) {
|
|
6381
|
+
if (id === virtualEntryId || id === "\0virtual:farm-ssr-entry") {
|
|
6382
|
+
return virtualEntryId;
|
|
6383
|
+
}
|
|
6384
|
+
return null;
|
|
6147
6385
|
}
|
|
6148
|
-
return null;
|
|
6149
6386
|
},
|
|
6150
|
-
load
|
|
6151
|
-
|
|
6152
|
-
|
|
6387
|
+
load: {
|
|
6388
|
+
filter: { id: _chunkF36LS2C7cjs.exactIdPattern.call(void 0, [virtualEntryId]) },
|
|
6389
|
+
handler(id) {
|
|
6390
|
+
if (id === virtualEntryId) {
|
|
6391
|
+
return virtualEntryCode;
|
|
6392
|
+
}
|
|
6393
|
+
return null;
|
|
6153
6394
|
}
|
|
6154
|
-
return null;
|
|
6155
6395
|
}
|
|
6156
6396
|
},
|
|
6157
6397
|
{
|
|
@@ -6177,7 +6417,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6177
6417
|
resolve: {
|
|
6178
6418
|
alias: [
|
|
6179
6419
|
...shouldAliasReactServerToWebBuild(config.renderer, preset) ? [createFarmReactWebServerAlias(hasReactDomEdgeServerBuild(root))] : [],
|
|
6180
|
-
...Object.entries(
|
|
6420
|
+
...Object.entries(_chunkF36LS2C7cjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
|
|
6181
6421
|
([find, replacement]) => ({ find, replacement })
|
|
6182
6422
|
)
|
|
6183
6423
|
],
|
|
@@ -6185,7 +6425,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
6185
6425
|
dedupe: [...config.renderer.dedupe || []]
|
|
6186
6426
|
}
|
|
6187
6427
|
};
|
|
6188
|
-
await viteBuild(
|
|
6428
|
+
await viteBuild(_chunkF36LS2C7cjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
|
|
6189
6429
|
} finally {
|
|
6190
6430
|
if (postcssConfigDir) {
|
|
6191
6431
|
try {
|
|
@@ -6221,26 +6461,26 @@ function readFarmPageLastModified(pageRoutes) {
|
|
|
6221
6461
|
return lastModified;
|
|
6222
6462
|
}
|
|
6223
6463
|
function getFarmDocsGuardedPaths(config, middlewareRoutes) {
|
|
6224
|
-
if (!_optionalChain([config, 'access',
|
|
6464
|
+
if (!_optionalChain([config, 'access', _132 => _132.docs, 'optionalAccess', _133 => _133.enabled])) return [];
|
|
6225
6465
|
const options = { root: config.root, srcDir: config.srcDir };
|
|
6226
6466
|
const guards = {
|
|
6227
6467
|
config: { middleware: config.middleware, integrations: config.integrations },
|
|
6228
6468
|
middlewareRoutes
|
|
6229
6469
|
};
|
|
6230
|
-
return
|
|
6231
|
-
(docsRoot) =>
|
|
6232
|
-
).flatMap((page) => [page.href,
|
|
6470
|
+
return _chunkFVYBEMODcjs.getFarmDocsRoots.call(void 0, config.docs).flatMap(
|
|
6471
|
+
(docsRoot) => _chunkFVYBEMODcjs.discoverFarmDocsPages.call(void 0, _chunkFVYBEMODcjs.resolveFarmDocsContentDir.call(void 0, docsRoot, options), docsRoot)
|
|
6472
|
+
).flatMap((page) => [page.href, _chunkFVYBEMODcjs.getFarmDocsMarkdownPath.call(void 0, page.href)]).filter((pathname) => _chunkUPOYKX4Scjs.farmPathGuardCoversPage.call(void 0, guards, pathname));
|
|
6233
6473
|
}
|
|
6234
6474
|
function getFarmAppOwnedDocsEnginePaths(agent, applicationMetadataRoutes) {
|
|
6235
|
-
const llmsTxt = _optionalChain([agent, 'optionalAccess',
|
|
6475
|
+
const llmsTxt = _optionalChain([agent, 'optionalAccess', _134 => _134.llmsTxt]);
|
|
6236
6476
|
const ownedByFile = (kind) => applicationMetadataRoutes.some(
|
|
6237
6477
|
(metadata) => metadata.kind === kind && metadata.pattern === "/"
|
|
6238
6478
|
);
|
|
6239
6479
|
return [
|
|
6240
|
-
..._optionalChain([llmsTxt, 'optionalAccess',
|
|
6241
|
-
..._optionalChain([llmsTxt, 'optionalAccess',
|
|
6242
|
-
..._optionalChain([agent, 'optionalAccess',
|
|
6243
|
-
..._optionalChain([agent, 'optionalAccess',
|
|
6480
|
+
..._optionalChain([llmsTxt, 'optionalAccess', _135 => _135.enabled]) || ownedByFile("llms") ? ["/llms.txt"] : [],
|
|
6481
|
+
..._optionalChain([llmsTxt, 'optionalAccess', _136 => _136.enabled]) && llmsTxt.full || ownedByFile("llms-full") ? ["/llms-full.txt"] : [],
|
|
6482
|
+
..._optionalChain([agent, 'optionalAccess', _137 => _137.sitemap, 'optionalAccess', _138 => _138.enabled]) || ownedByFile("sitemap") ? ["/sitemap.xml"] : [],
|
|
6483
|
+
..._optionalChain([agent, 'optionalAccess', _139 => _139.crawlers, 'optionalAccess', _140 => _140.enabled]) || ownedByFile("robots") ? ["/robots.txt"] : []
|
|
6244
6484
|
];
|
|
6245
6485
|
}
|
|
6246
6486
|
function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
@@ -6251,7 +6491,7 @@ function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
|
6251
6491
|
docsPath: ${root}.entry,
|
|
6252
6492
|
contentDir: ${root}.contentDir || ${root}.config?.contentDir,
|
|
6253
6493
|
}`;
|
|
6254
|
-
if (_optionalChain([docs, 'optionalAccess',
|
|
6494
|
+
if (_optionalChain([docs, 'optionalAccess', _141 => _141.roots, 'optionalAccess', _142 => _142.length])) {
|
|
6255
6495
|
return {
|
|
6256
6496
|
factory: "createFarmDocsAdapterMultiRuntimeHandler",
|
|
6257
6497
|
config: `[farmDocsResolvedConfig, ...farmDocsResolvedConfig.roots].map((farmDocsRoot) => (${runtimeConfig("farmDocsRoot")}))`
|
|
@@ -6264,7 +6504,7 @@ function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
|
6264
6504
|
}
|
|
6265
6505
|
function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
|
|
6266
6506
|
if (!docs.enabled) return "null";
|
|
6267
|
-
const serializableDocs = _optionalChain([docs, 'access',
|
|
6507
|
+
const serializableDocs = _optionalChain([docs, 'access', _143 => _143.roots, 'optionalAccess', _144 => _144.length]) ? {
|
|
6268
6508
|
...docs,
|
|
6269
6509
|
// React elements and functions do not survive JSON; see runtimeConfig below.
|
|
6270
6510
|
roots: docs.roots.map((docsRoot) => ({ ...docsRoot, runtimeConfig: void 0 }))
|
|
@@ -6298,7 +6538,7 @@ function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
|
|
|
6298
6538
|
},
|
|
6299
6539
|
}
|
|
6300
6540
|
: ${JSON.stringify({ ...serializableDocs, runtimeConfig: void 0 })}`;
|
|
6301
|
-
if (!_optionalChain([docs, 'access',
|
|
6541
|
+
if (!_optionalChain([docs, 'access', _145 => _145.roots, 'optionalAccess', _146 => _146.length])) return expression;
|
|
6302
6542
|
return `((farmDocs) => ({
|
|
6303
6543
|
...farmDocs,
|
|
6304
6544
|
roots: farmDocs.roots.map((farmDocsRoot, index) => {
|
|
@@ -6315,7 +6555,7 @@ function toVirtualEntryImportSpecifier(modulePath) {
|
|
|
6315
6555
|
return JSON.stringify(modulePath.replace(/\\/g, "/"));
|
|
6316
6556
|
}
|
|
6317
6557
|
function generateNativeAuthIntegrationSource(auth) {
|
|
6318
|
-
if (_optionalChain([auth, 'optionalAccess',
|
|
6558
|
+
if (_optionalChain([auth, 'optionalAccess', _147 => _147.enabled]) !== true) {
|
|
6319
6559
|
return { importSource: "", registerSource: "" };
|
|
6320
6560
|
}
|
|
6321
6561
|
return {
|
|
@@ -6625,26 +6865,26 @@ ReactDOMServer.configureApp(__farmAppSetup);`;
|
|
|
6625
6865
|
}
|
|
6626
6866
|
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 = []) {
|
|
6627
6867
|
const farmRendererDisabled = _chunk67MZTLTFcjs.isFarmRendererDisabled.call(void 0, config.renderer);
|
|
6628
|
-
const farmIslandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
6629
|
-
const farmClientBoot =
|
|
6868
|
+
const farmIslandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _148 => _148.experimental, 'optionalAccess', _149 => _149.serverComponents])) === "islands";
|
|
6869
|
+
const farmClientBoot = _chunkF36LS2C7cjs.canBootFarmIslandsClient.call(void 0, config);
|
|
6630
6870
|
const farmMobileClient = shouldBuildFarmMobileClient(config);
|
|
6631
6871
|
const farmMobileShells = farmMobileClient && config.mobileShells ? config.mobileShells : null;
|
|
6632
6872
|
const hasCompressionRuntime = config.compress && _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
|
|
6633
|
-
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access',
|
|
6873
|
+
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access', _150 => _150.agent, 'optionalAccess', _151 => _151.crawlers, 'optionalAccess', _152 => _152.enabled])) && !applicationMetadataRoutes.some(
|
|
6634
6874
|
(metadata) => metadata.kind === "robots" && metadata.pattern === "/"
|
|
6635
6875
|
);
|
|
6636
|
-
const servesAgentSitemap = Boolean(_optionalChain([config, 'access',
|
|
6876
|
+
const servesAgentSitemap = Boolean(_optionalChain([config, 'access', _153 => _153.agent, 'optionalAccess', _154 => _154.sitemap, 'optionalAccess', _155 => _155.enabled])) && !applicationMetadataRoutes.some(
|
|
6637
6877
|
(metadata) => metadata.kind === "sitemap" && metadata.pattern === "/"
|
|
6638
6878
|
);
|
|
6639
|
-
const servesDefaultMCP = _optionalChain([config, 'access',
|
|
6640
|
-
const servesAiCatalog = _optionalChain([config, 'access',
|
|
6879
|
+
const servesDefaultMCP = _optionalChain([config, 'access', _156 => _156.agent, 'optionalAccess', _157 => _157.mcp]) === true && !_chunkX3MHKLCOcjs.farmConfigMountsMCP.call(void 0, config) && !apiRoutes.some((route) => route.path === "/api/mcp");
|
|
6880
|
+
const servesAiCatalog = _optionalChain([config, 'access', _158 => _158.agent, 'optionalAccess', _159 => _159.aiCatalog]) !== false;
|
|
6641
6881
|
const hasPluginRuntime = hasRuntimeIntegrationConfig || hasServerRuntimePlugins;
|
|
6642
6882
|
const hasInfraAnalyticsRuntime = config.analytics !== false && _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
|
|
6643
6883
|
const hasPrecompiledDocs = Boolean(farmDocsPrecompiledManifest);
|
|
6644
6884
|
const adapterOwnsDocsRuntime = Boolean(
|
|
6645
|
-
_chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access',
|
|
6885
|
+
_chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _160 => _160.docs, 'optionalAccess', _161 => _161.enabled]) && _optionalChain([config, 'access', _162 => _162.docs, 'access', _163 => _163.adapter, 'optionalAccess', _164 => _164.server]) && config.docs.adapter.react
|
|
6646
6886
|
);
|
|
6647
|
-
if (_optionalChain([config, 'access',
|
|
6887
|
+
if (_optionalChain([config, 'access', _165 => _165.docs, 'optionalAccess', _166 => _166.enabled]) && _optionalChain([config, 'access', _167 => _167.docs, 'access', _168 => _168.roots, 'optionalAccess', _169 => _169.length]) && !adapterOwnsDocsRuntime) {
|
|
6648
6888
|
throw new Error(
|
|
6649
6889
|
"Several docs roots need the docs adapter, which serves the React renderer only; Farm's built-in docs renderer serves a single docs root."
|
|
6650
6890
|
);
|
|
@@ -6654,7 +6894,7 @@ function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlot
|
|
|
6654
6894
|
const hasIsolatedClientGraphRuntime = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) && isolatedClientBoundaryModules.size > 0;
|
|
6655
6895
|
const rendererStreamingCapabilities = _chunk67MZTLTFcjs.getFarmRendererStreamingCapabilitiesForRuntime.call(void 0,
|
|
6656
6896
|
config.renderer,
|
|
6657
|
-
|
|
6897
|
+
_chunkI7J5RLGOcjs.getFarmPresetRuntime.call(void 0, preset)
|
|
6658
6898
|
);
|
|
6659
6899
|
const hasReactSyncRender = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer);
|
|
6660
6900
|
const rendererServerImports = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer) ? `import * as React from "react";
|
|
@@ -6693,8 +6933,9 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6693
6933
|
const hasGeneratedMetadataImages = metadataImageRoutes.some(
|
|
6694
6934
|
(image) => image.sourceType === "module"
|
|
6695
6935
|
);
|
|
6936
|
+
const edgeMiddlewareFilePaths = farmTargetRunsEdgeMiddleware(preset) ? middlewareRoutes.filter(isFarmEdgeMiddlewareRoute).map((route) => route.filePath) : [];
|
|
6696
6937
|
const hasMiddlewareRuntime = middlewareRoutes.length > 0 || _chunkUPOYKX4Scjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
|
|
6697
|
-
const farmDocsFontAssets = _optionalChain([config, 'access',
|
|
6938
|
+
const farmDocsFontAssets = _optionalChain([config, 'access', _170 => _170.docs, 'optionalAccess', _171 => _171.enabled]) ? _chunkERMUL73Lcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkERMUL73Lcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
|
|
6698
6939
|
const integrationProviders = _chunkBDYM2TN3cjs.getIntegrationProviders.call(void 0, config.integrations);
|
|
6699
6940
|
const renderedIntegrationProviders = integrationProviders.filter(
|
|
6700
6941
|
(provider) => provider.component || provider.type === "clerk"
|
|
@@ -6704,16 +6945,16 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6704
6945
|
`Integration provider components are not supported by the "${config.renderer.name}" renderer.`
|
|
6705
6946
|
);
|
|
6706
6947
|
}
|
|
6707
|
-
const providerServerModules =
|
|
6948
|
+
const providerServerModules = _chunkF36LS2C7cjs.generateFarmIntegrationProviderServerModules.call(void 0,
|
|
6708
6949
|
renderedIntegrationProviders,
|
|
6709
6950
|
config.root,
|
|
6710
6951
|
_nullishCoalesce(config.renderer.componentExtensions, () => ( []))
|
|
6711
6952
|
);
|
|
6712
6953
|
const resolvedIntegrationProviderFallback = Object.fromEntries(
|
|
6713
6954
|
Object.entries(config.integrations).flatMap(([name, integration]) => {
|
|
6714
|
-
const configuredProviders = _optionalChain([integration, 'optionalAccess',
|
|
6955
|
+
const configuredProviders = _optionalChain([integration, 'optionalAccess', _172 => _172.providers]);
|
|
6715
6956
|
const providers = Array.isArray(configuredProviders) ? configuredProviders : [];
|
|
6716
|
-
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess',
|
|
6957
|
+
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess', _173 => _173.component]) === "function")) {
|
|
6717
6958
|
throw new Error(
|
|
6718
6959
|
`Integration provider components in production must use an importable component reference, for example component: { module: "@/components/provider" }.`
|
|
6719
6960
|
);
|
|
@@ -6724,20 +6965,20 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6724
6965
|
const unsupportedIntegrationProvider = renderedIntegrationProviders.find(
|
|
6725
6966
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
6726
6967
|
);
|
|
6727
|
-
const isolatedHydrationMode =
|
|
6728
|
-
_optionalChain([config, 'access',
|
|
6968
|
+
const isolatedHydrationMode = _chunkMZ4CRSY7cjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
6969
|
+
_optionalChain([config, 'access', _174 => _174.experimental, 'optionalAccess', _175 => _175.isolatedClientHydration]),
|
|
6729
6970
|
{
|
|
6730
|
-
serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
6971
|
+
serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _176 => _176.experimental, 'optionalAccess', _177 => _177.serverComponents])) === "rsc",
|
|
6731
6972
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
6732
6973
|
}
|
|
6733
6974
|
);
|
|
6734
|
-
const hydrationPlanOptions =
|
|
6975
|
+
const hydrationPlanOptions = _chunkMZ4CRSY7cjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
6735
6976
|
config.renderer,
|
|
6736
6977
|
Boolean(unsupportedIntegrationProvider)
|
|
6737
6978
|
);
|
|
6738
6979
|
const pageHydrationPlanOptions = {
|
|
6739
6980
|
...hydrationPlanOptions,
|
|
6740
|
-
serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access',
|
|
6981
|
+
serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _178 => _178.experimental, 'optionalAccess', _179 => _179.serverComponents])) === "islands"
|
|
6741
6982
|
};
|
|
6742
6983
|
const layoutHydrationPlans = layoutRoutes.map((layout) => ({
|
|
6743
6984
|
...layout,
|
|
@@ -6749,7 +6990,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6749
6990
|
{ ...hydrationPlanOptions, serverTreeLayouts: pageHydrationPlanOptions.serverOwners }
|
|
6750
6991
|
)
|
|
6751
6992
|
}));
|
|
6752
|
-
const markdownPagePlan =
|
|
6993
|
+
const markdownPagePlan = _chunkMZ4CRSY7cjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
6753
6994
|
_chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), config.root),
|
|
6754
6995
|
config.root,
|
|
6755
6996
|
isolatedHydrationMode,
|
|
@@ -6758,7 +6999,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6758
6999
|
const pageHydrationPlans = new Map(
|
|
6759
7000
|
pageRoutes.map((route) => [
|
|
6760
7001
|
route.modulePath,
|
|
6761
|
-
|
|
7002
|
+
_chunk3EEINK7Gcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
|
|
6762
7003
|
route.modulePath,
|
|
6763
7004
|
config.root,
|
|
6764
7005
|
isolatedHydrationMode,
|
|
@@ -6767,7 +7008,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6767
7008
|
)
|
|
6768
7009
|
])
|
|
6769
7010
|
);
|
|
6770
|
-
|
|
7011
|
+
_chunkMZ4CRSY7cjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
6771
7012
|
layoutHydrationPlans.map((layout) => ({
|
|
6772
7013
|
pattern: layout.pattern,
|
|
6773
7014
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -6797,7 +7038,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6797
7038
|
apiRegistrations.push(`
|
|
6798
7039
|
{
|
|
6799
7040
|
path: ${JSON.stringify(route.path)},
|
|
6800
|
-
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access',
|
|
7041
|
+
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access', _180 => _180.pluginMethods, 'optionalAccess', _181 => _181.includes, 'call', _182 => _182(method)])))},
|
|
6801
7042
|
endpoints: ${varName},
|
|
6802
7043
|
}`);
|
|
6803
7044
|
});
|
|
@@ -6810,7 +7051,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6810
7051
|
}).map(({ route }) => route);
|
|
6811
7052
|
orderedPageRoutes.forEach((route, index) => {
|
|
6812
7053
|
const varName = `pageRoute${index}`;
|
|
6813
|
-
if (
|
|
7054
|
+
if (_chunk3EEINK7Gcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) {
|
|
6814
7055
|
pageRegistrations.push(`
|
|
6815
7056
|
{
|
|
6816
7057
|
pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
|
|
@@ -6834,7 +7075,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6834
7075
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(route.modulePath)};`
|
|
6835
7076
|
);
|
|
6836
7077
|
const clientMetadata = pageHydrationPlans.get(route.modulePath);
|
|
6837
|
-
const renderingDirective =
|
|
7078
|
+
const renderingDirective = _chunkQOGIZKSOcjs.readRouteRenderingDirectiveFromFile.call(void 0, route.modulePath);
|
|
6838
7079
|
pageRegistrations.push(`
|
|
6839
7080
|
{
|
|
6840
7081
|
pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
|
|
@@ -6842,8 +7083,8 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6842
7083
|
module: ${varName},
|
|
6843
7084
|
shouldHydrate: ${JSON.stringify(clientMetadata.shouldHydrate)},${clientMetadata.shouldHydrate ? `
|
|
6844
7085
|
clientModule: ${JSON.stringify(_chunkQMNWKQL4cjs.toViteModuleId.call(void 0, route.modulePath, config.root))},` : ""}
|
|
6845
|
-
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${
|
|
6846
|
-
const rootStrategy =
|
|
7086
|
+
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${_chunkMZ4CRSY7cjs.usesFarmServerTree.call(void 0, clientMetadata) ? "\n serverTree: true," : ""}${(() => {
|
|
7087
|
+
const rootStrategy = _chunkF36LS2C7cjs.resolveFarmRouteRootStrategy.call(void 0,
|
|
6847
7088
|
route,
|
|
6848
7089
|
clientMetadata,
|
|
6849
7090
|
layoutHydrationPlans.map((layout) => ({ ...layout, ...layout.hydration })),
|
|
@@ -6906,7 +7147,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
6906
7147
|
containerId: ${JSON.stringify(slot.containerId)},
|
|
6907
7148
|
interception: ${JSON.stringify(slot.interception)},
|
|
6908
7149
|
fallback: ${JSON.stringify(slot.fallback)},
|
|
6909
|
-
hydrates: ${!farmIslandsMode ||
|
|
7150
|
+
hydrates: ${!farmIslandsMode || _chunkMZ4CRSY7cjs.getClientModuleMetadata.call(void 0, slot.modulePath, config.root).isClientComponent},
|
|
6910
7151
|
module: ${varName},
|
|
6911
7152
|
}`);
|
|
6912
7153
|
});
|
|
@@ -7037,6 +7278,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
7037
7278
|
createFarmApiCatalogResponse,
|
|
7038
7279
|
createFarmAppManifestResponse,
|
|
7039
7280
|
farmPathGuardCoversEndpoint,
|
|
7281
|
+
farmPathGuardCoversPage,
|
|
7040
7282
|
collectFarmLlmsTxtPages,
|
|
7041
7283
|
createFarmDefaultLlmsTxt,
|
|
7042
7284
|
createFarmLlmsMarkdownReader,
|
|
@@ -7147,38 +7389,40 @@ function resolveFarmMobileShellRender(request, route, routePathname) {
|
|
|
7147
7389
|
}
|
|
7148
7390
|
return loading.route.module.default;
|
|
7149
7391
|
}` : ""}${farmIslandsMode ? `
|
|
7150
|
-
import { getSharedLayoutPrefixLength, handleFarmFormActionRequest, ignoreFarmHeldValues, installFarmIslandValues, parseFarmLayoutChainHeader } from "@farm.js/core/internal/production-runtime";
|
|
7392
|
+
import { getFarmFormState as farmFormState, getSharedLayoutPrefixLength, handleFarmFormActionRequest, ignoreFarmHeldValues, installFarmIslandValues, parseFarmLayoutChainHeader, renderFarmFormStateScript as farmFormStateScript } from "@farm.js/core/internal/production-runtime";
|
|
7151
7393
|
import { installFarmIslandsServer } from "@farm.js/core/internal/islands-server";
|
|
7152
7394
|
installFarmIslandsServer();
|
|
7153
7395
|
const farmFormActionsConfig = ${JSON.stringify(_chunk4P5634G6cjs.resolveServerActionsConfig.call(void 0, config.serverActions))};
|
|
7154
7396
|
installFarmIslandValues();
|
|
7155
7397
|
${islandsActionKeyCode()}
|
|
7156
|
-
${FARM_SEGMENT_NAVIGATION_SERVER_RUNTIME}` :
|
|
7398
|
+
${FARM_SEGMENT_NAVIGATION_SERVER_RUNTIME}` : `
|
|
7399
|
+
function farmFormState() { return undefined; }
|
|
7400
|
+
function farmFormStateScript() { return ""; }`}`;
|
|
7157
7401
|
const productionSiteTelemetryImport = config.telemetry ? `import { createFarmProductionSiteReporter } from "@farm.js/core/internal/product-telemetry-runtime";` : "";
|
|
7158
7402
|
const metadataImageRuntimeImport = hasGeneratedMetadataImages ? `import { createFarmMetadataImageResponse } from "@farm.js/core/internal/metadata-image-runtime";` : "";
|
|
7159
7403
|
const pluginRuntimeImport = hasPluginRuntime ? `import { PluginManager } from "@farm.js/core/plugin";` : "";
|
|
7160
7404
|
const infraAnalyticsImport = hasInfraAnalyticsRuntime ? `import { ${hasPluginRuntime ? "createFarmInfraAnalyticsPlugin" : "createFarmInfraAnalyticsRecorder"} } from "@farm.js/core/internal/infra-analytics-runtime";` : "";
|
|
7161
7405
|
const compressionRuntimeImport = hasCompressionRuntime ? `import { compressFarmResponse${hasPluginRuntime ? ", createCompressionPlugin" : ""} } from "@farm.js/core/internal/compression-runtime";` : "";
|
|
7162
7406
|
const i18nServerImport = config.i18n.enabled ? `import { _runWithFarmI18nRequest, _setDefaultFarmI18nRuntime, createFarmI18nRuntime, getFarmI18nClientSnapshot } from "@farm.js/core/i18n/server";` : "";
|
|
7163
|
-
const docsHandlerImport = _optionalChain([config, 'access',
|
|
7407
|
+
const docsHandlerImport = _optionalChain([config, 'access', _183 => _183.docs, 'optionalAccess', _184 => _184.enabled]) ? hasPrecompiledDocs ? `import { createFarmDocsPrecompiledRuntime } from "@farm.js/core/internal/docs-precompiled-runtime";
|
|
7164
7408
|
const isFarmDocsAPIRequest = (requestOrPathname) => {
|
|
7165
7409
|
const pathname = typeof requestOrPathname === "string"
|
|
7166
7410
|
? requestOrPathname
|
|
7167
7411
|
: new URL(requestOrPathname.url).pathname;
|
|
7168
|
-
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess',
|
|
7412
|
+
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _185 => _185.apiPath]) || "/api/docs")};
|
|
7169
7413
|
return pathname === apiPath || pathname.startsWith(apiPath + "/");
|
|
7170
7414
|
};` : adapterOwnsDocsRuntime ? `import { ${docsConfigModulePath ? "getFarmDocsConfigModuleRoot, " : ""}isFarmDocsAPIRequest } from "@farm.js/core/docs";
|
|
7171
|
-
import { ${_optionalChain([config, 'access',
|
|
7415
|
+
import { ${_optionalChain([config, 'access', _186 => _186.docs, 'access', _187 => _187.roots, 'optionalAccess', _188 => _188.length]) ? "createFarmDocsMultiRuntimeHandler as createFarmDocsAdapterMultiRuntimeHandler" : "createFarmDocsRuntimeHandler as createFarmDocsAdapterRuntimeHandler"} } from ${JSON.stringify(config.docs.adapter.server)};
|
|
7172
7416
|
import * as FarmDocsAdapterReact from ${JSON.stringify(config.docs.adapter.react)};${docsConfigModulePath ? `
|
|
7173
7417
|
import * as farmDocsConfigModule from ${toVirtualEntryImportSpecifier(docsConfigModulePath)};` : ""}` : `import { createFarmDocsAPIHandler, createFarmDocsHandler, isFarmDocsAPIRequest } from "@farm.js/core/docs";` : "";
|
|
7174
|
-
const docsFontImport = _optionalChain([config, 'access',
|
|
7175
|
-
const docsRuntimeImport = _optionalChain([config, 'access',
|
|
7418
|
+
const docsFontImport = _optionalChain([config, 'access', _189 => _189.docs, 'optionalAccess', _190 => _190.enabled]) && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
|
|
7419
|
+
const docsRuntimeImport = _optionalChain([config, 'access', _191 => _191.docs, 'optionalAccess', _192 => _192.enabled]) && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
|
|
7176
7420
|
import { dirname as farmDocsDirname, join as farmDocsJoin } from "node:path";
|
|
7177
7421
|
import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
7178
|
-
const markdownHandlerImport = _optionalChain([config, 'access',
|
|
7422
|
+
const markdownHandlerImport = _optionalChain([config, 'access', _193 => _193.md, 'optionalAccess', _194 => _194.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
|
|
7179
7423
|
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;";
|
|
7180
7424
|
const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, FARM_MARKDOWN_PAGE_CHECK_HEADER, _isFarmMarkdownPageCheck, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
|
|
7181
|
-
const mdxComponentsPath = typeof _optionalChain([config, 'access',
|
|
7425
|
+
const mdxComponentsPath = typeof _optionalChain([config, 'access', _195 => _195.mdx, 'optionalAccess', _196 => _196.components]) === "string" ? _path2.default.isAbsolute(config.mdx.components) ? config.mdx.components : _path2.default.join(config.root, config.mdx.components) : null;
|
|
7182
7426
|
const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
|
|
7183
7427
|
const layerConfigPaths = (config.layers || []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile)).filter((configFile) => configFile !== configModulePath);
|
|
7184
7428
|
const layerConfigImports = layerConfigPaths.map(
|
|
@@ -7198,14 +7442,14 @@ import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
|
7198
7442
|
const nativeAuth = generateNativeAuthIntegrationSource(config.auth);
|
|
7199
7443
|
const nativeMCP = _chunkVM57CK74cjs.generateNativeMCPPluginSource.call(void 0, config.mcp);
|
|
7200
7444
|
const mobileSession = (config.plugins || []).some(
|
|
7201
|
-
(plugin) => _optionalChain([plugin, 'optionalAccess',
|
|
7445
|
+
(plugin) => _optionalChain([plugin, 'optionalAccess', _197 => _197.name]) === _chunk4BS3HSY7cjs.FARM_MOBILE_SESSION_PLUGIN
|
|
7202
7446
|
);
|
|
7203
7447
|
const nativeServerFns = (config.plugins || []).some(
|
|
7204
|
-
(plugin) => _optionalChain([plugin, 'optionalAccess',
|
|
7205
|
-
) ?
|
|
7448
|
+
(plugin) => _optionalChain([plugin, 'optionalAccess', _198 => _198.name]) === _chunk4EBC7EMWcjs.FARM_NATIVE_SERVER_FN_PLUGIN
|
|
7449
|
+
) ? _chunk225APHKCcjs.collectFarmNativeServerFns.call(void 0, {
|
|
7206
7450
|
root: config.root,
|
|
7207
7451
|
srcDir: config.srcDir,
|
|
7208
|
-
entries:
|
|
7452
|
+
entries: _chunk225APHKCcjs.findFarmNativeScreenFiles.call(void 0, _chunkMTBDJ326cjs.getFarmAppDirectories.call(void 0, config))
|
|
7209
7453
|
}) : void 0;
|
|
7210
7454
|
const integrationImports = `
|
|
7211
7455
|
${configModulePath ? `import * as FarmUserConfigModule from ${toVirtualEntryImportSpecifier(configModulePath)};` : ""}
|
|
@@ -7220,7 +7464,7 @@ ${nativeServerFns ? `const __farmNativeServerFnRegistry = Object.assign(Object.c
|
|
|
7220
7464
|
${nativeServerFns.flatMap((module, index) => module.exports.map((entry) => ` ${JSON.stringify(entry.id)}: __farmNativeServerFns${index}[${JSON.stringify(entry.name)}],`)).join("\n")}
|
|
7221
7465
|
});` : ""}
|
|
7222
7466
|
`;
|
|
7223
|
-
const imageRuntime =
|
|
7467
|
+
const imageRuntime = _chunkF36LS2C7cjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
|
|
7224
7468
|
const imageRuntimeImport = imageRuntime === "none" ? "" : `import { _withFarmImageSourceClientAddress, createCloudflareImageTransformer, createFarmImageHandler } from "@farm.js/core/image/server";`;
|
|
7225
7469
|
const imageNodeRuntimeImport = imageRuntime === "node" ? `import { createNodeImageFetcher, createNodeImageUrlValidator, createSharpImageTransformer } from "@farm.js/core/image/sharp";` : "";
|
|
7226
7470
|
const apiHandlerCode = apiRoutes.length > 0 ? `
|
|
@@ -7357,7 +7601,7 @@ ${routeClientGraphServerRuntime}
|
|
|
7357
7601
|
const farmRendererStreamingCapabilities = ${JSON.stringify(rendererStreamingCapabilities)};
|
|
7358
7602
|
const farmRendererName = ${JSON.stringify(config.renderer.name)};
|
|
7359
7603
|
const farmReactSyncRender = ${JSON.stringify(hasReactSyncRender)};
|
|
7360
|
-
const farmRendererRuntime = ${JSON.stringify(
|
|
7604
|
+
const farmRendererRuntime = ${JSON.stringify(_chunkI7J5RLGOcjs.getFarmPresetRuntime.call(void 0, preset))};
|
|
7361
7605
|
const farmRendererRuntimeStreamingCapabilities = ReactDOMServer.capabilities &&
|
|
7362
7606
|
ReactDOMServer.capabilities.streaming;
|
|
7363
7607
|
if (farmRendererRuntimeStreamingCapabilities &&
|
|
@@ -7402,7 +7646,7 @@ const farmResolvedRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs);
|
|
|
7402
7646
|
|
|
7403
7647
|
function FarmDefault404Page() {
|
|
7404
7648
|
return React.createElement(React.Fragment, null,
|
|
7405
|
-
React.createElement("style", null, ${JSON.stringify(
|
|
7649
|
+
React.createElement("style", null, ${JSON.stringify(_chunkF36LS2C7cjs.DEFAULT_NOT_FOUND_STYLES)}),
|
|
7406
7650
|
React.createElement("main", {
|
|
7407
7651
|
className: "farm-default-not-found",
|
|
7408
7652
|
"aria-labelledby": "farm-default-not-found-title",
|
|
@@ -7540,19 +7784,19 @@ const farmImageHandler = ${imageRuntime === "none" ? "null" : imageRuntime === "
|
|
|
7540
7784
|
onError(error) { console.error("[Farm Image]", error); },
|
|
7541
7785
|
})`};
|
|
7542
7786
|
const farmMarkdownConfig = ${JSON.stringify(config.md)};
|
|
7543
|
-
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
7544
|
-
${_optionalChain([config, 'access',
|
|
7787
|
+
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _199 => _199.agent, 'optionalAccess', _200 => _200.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
|
|
7788
|
+
${_optionalChain([config, 'access', _201 => _201.agent, 'optionalAccess', _202 => _202.llmsTxt, 'optionalAccess', _203 => _203.enabled]) ? "const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });\n" : ""}${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
|
|
7545
7789
|
const farmMdxConfig = ${JSON.stringify({
|
|
7546
7790
|
...config.mdx,
|
|
7547
|
-
components: typeof _optionalChain([config, 'access',
|
|
7791
|
+
components: typeof _optionalChain([config, 'access', _204 => _204.mdx, 'optionalAccess', _205 => _205.components]) === "string" ? config.mdx.components : void 0
|
|
7548
7792
|
})};
|
|
7549
7793
|
const configuredFarmMdxComponents = farmUserConfig?.mdx?.components;
|
|
7550
|
-
${_optionalChain([config, 'access',
|
|
7794
|
+
${_optionalChain([config, 'access', _206 => _206.agent, 'optionalAccess', _207 => _207.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
|
|
7551
7795
|
// environment this was built in, since Netlify exposes its deploy context only
|
|
7552
7796
|
// to the build.
|
|
7553
7797
|
const farmNoindexPreview = resolveFarmPreviewDeployment(
|
|
7554
7798
|
globalThis.process?.env,
|
|
7555
|
-
${JSON.stringify(
|
|
7799
|
+
${JSON.stringify(_chunkIGDYL2IAcjs.isFarmPreviewDeploymentEnvironment.call(void 0, process.env))},
|
|
7556
7800
|
);` : ""}
|
|
7557
7801
|
const farmMdxComponents = ${mdxComponentsPath ? `(FarmMdxComponentsModule.components || Reflect.get(FarmMdxComponentsModule, "default") || {})` : `(configuredFarmMdxComponents && typeof configuredFarmMdxComponents === "object" ? configuredFarmMdxComponents : {})`};
|
|
7558
7802
|
const farmObservabilityConfig = farmUserConfig?.observability ?? ${JSON.stringify(
|
|
@@ -7598,7 +7842,7 @@ export const farmProductionLifecycle = createFarmProductionLifecycle({
|
|
|
7598
7842
|
});
|
|
7599
7843
|
const farmI18nRuntime = ${config.i18n.enabled ? `createFarmI18nRuntime(farmI18nConfig, ${JSON.stringify(i18nCatalogs)})` : "null"};
|
|
7600
7844
|
${config.i18n.enabled ? "_setDefaultFarmI18nRuntime(farmI18nRuntime);" : ""}
|
|
7601
|
-
const farmDocsBundledContentDir = ${_optionalChain([config, 'access',
|
|
7845
|
+
const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _208 => _208.docs, 'optionalAccess', _209 => _209.enabled]) && !hasPrecompiledDocs ? `(() => {
|
|
7602
7846
|
try {
|
|
7603
7847
|
const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
|
|
7604
7848
|
const candidates = [
|
|
@@ -7610,7 +7854,7 @@ const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _204 => _2
|
|
|
7610
7854
|
} catch {
|
|
7611
7855
|
return null;
|
|
7612
7856
|
}
|
|
7613
|
-
})()` : "null"};${_optionalChain([config, 'access',
|
|
7857
|
+
})()` : "null"};${_optionalChain([config, 'access', _210 => _210.docs, 'optionalAccess', _211 => _211.enabled]) && !hasPrecompiledDocs && _optionalChain([config, 'access', _212 => _212.docs, 'access', _213 => _213.roots, 'optionalAccess', _214 => _214.length]) ? `
|
|
7614
7858
|
const farmDocsBundledRootsDir = (() => {
|
|
7615
7859
|
try {
|
|
7616
7860
|
const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
|
|
@@ -7662,7 +7906,7 @@ const farmDocsModulePreloadPaths = farmDocsModulePreloads
|
|
|
7662
7906
|
),
|
|
7663
7907
|
}
|
|
7664
7908
|
: undefined;
|
|
7665
|
-
const farmDocsHandler = ${_optionalChain([config, 'access',
|
|
7909
|
+
const farmDocsHandler = ${_optionalChain([config, 'access', _215 => _215.docs, 'optionalAccess', _216 => _216.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `${adapterHandler.factory}(${adapterHandler.config}, {
|
|
7666
7910
|
rootDir: farmDocsRuntimeRoot,
|
|
7667
7911
|
// A production build's content cannot change, so the adapter reads its
|
|
7668
7912
|
// navigation once instead of scanning the content directory per request.
|
|
@@ -7681,6 +7925,19 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _211 => _211.docs, '
|
|
|
7681
7925
|
loadReactModule: async () => FarmDocsAdapterReact,
|
|
7682
7926
|
// Lists the docs MCP endpoint in /.well-known/ai-catalog.json for the server's lifetime.
|
|
7683
7927
|
registerMCPServer: registerFarmMCPServer,
|
|
7928
|
+
// A page built with this keeps its HTML string, so the preload budget and the response
|
|
7929
|
+
// writer use it instead of reading and re-encoding the body. Older adapters ignore it.
|
|
7930
|
+
createHtmlResponse: farmOwnedHtmlResponse,${_chunkLDEXTX4Icjs.farmDocsAdapterServesGuardedPages.call(void 0, config.docs) ? `
|
|
7931
|
+
// The adapter keeps pages a path guard covers off search, llms.txt, the sitemap and MCP. It
|
|
7932
|
+
// asks about any path its own content lists, so the guards decide here, not a page list.
|
|
7933
|
+
isPathGuarded: (pathname) =>
|
|
7934
|
+
farmPathGuardCoversPage(
|
|
7935
|
+
{
|
|
7936
|
+
config: { middleware: farmMiddlewareConfig, integrations: serverRuntimeIntegrations },
|
|
7937
|
+
middlewareRoutes: fileMiddlewareModules,
|
|
7938
|
+
},
|
|
7939
|
+
pathname,
|
|
7940
|
+
),` : ""}
|
|
7684
7941
|
})` : `createFarmDocsHandler(farmDocsResolvedConfig, {
|
|
7685
7942
|
root: farmDocsRuntimeRoot,
|
|
7686
7943
|
srcDir: ${JSON.stringify(config.srcDir)},
|
|
@@ -7696,11 +7953,11 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _211 => _211.docs, '
|
|
|
7696
7953
|
isPathGuarded: isFarmDocsPathGuarded,
|
|
7697
7954
|
basePath: ${JSON.stringify(config.basePath)},
|
|
7698
7955
|
})` : "null"};
|
|
7699
|
-
const farmDocsAPIHandler = ${_optionalChain([config, 'access',
|
|
7956
|
+
const farmDocsAPIHandler = ${_optionalChain([config, 'access', _217 => _217.docs, 'optionalAccess', _218 => _218.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig, isPathGuarded: isFarmDocsPathGuarded, basePath: ${JSON.stringify(config.basePath)} })` : "null"};
|
|
7700
7957
|
|
|
7701
7958
|
// API routes bundled at build time
|
|
7702
7959
|
const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
|
|
7703
|
-
]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path:
|
|
7960
|
+
]${apiRoutes.length > 0 ? `, configuredPlugins, ${JSON.stringify(apiRoutes.map(({ path: path14, methods }) => ({ path: path14, methods })))}, { bodySizeLimit: ${JSON.stringify(config.server.bodySizeLimit)}, dispatch: dispatchFarmPluginAPIRequest })` : ""};
|
|
7704
7961
|
// A plugin calling an app endpoint (an MCP tool, say) goes through the whole
|
|
7705
7962
|
// pipeline, so the endpoint's middleware and integration guards run for it.
|
|
7706
7963
|
function dispatchFarmPluginAPIRequest(request) {
|
|
@@ -7724,12 +7981,12 @@ const farmLocalAPIBasePath = ${JSON.stringify(_chunk2OF5RPVUcjs.resolveFarmAPISe
|
|
|
7724
7981
|
// runtime request.
|
|
7725
7982
|
const farmRuntimeErrorSlot = Symbol("farm.runtime.error.slot");
|
|
7726
7983
|
const farmOpenAPIReference = ${JSON.stringify(openAPIReference)};
|
|
7727
|
-
${_optionalChain([config, 'access',
|
|
7728
|
-
` : ""}${_optionalChain([config, 'access',
|
|
7729
|
-
|
|
7984
|
+
${_optionalChain([config, 'access', _219 => _219.agent, 'optionalAccess', _220 => _220.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunkYTNBCXCWcjs.resolveFarmApiCatalogInput.call(void 0, config))};
|
|
7985
|
+
` : ""}${_optionalChain([config, 'access', _221 => _221.agent, 'optionalAccess', _222 => _222.manifest]) !== false ? `const farmAppManifestInput = ${JSON.stringify(
|
|
7986
|
+
_chunkYTNBCXCWcjs.resolveFarmAppManifestInput.call(void 0, config, {
|
|
7730
7987
|
build: config.deploymentId,
|
|
7731
|
-
packages:
|
|
7732
|
-
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ?
|
|
7988
|
+
packages: _chunkF36LS2C7cjs.resolveFarmAppPackages.call(void 0, config.root),
|
|
7989
|
+
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? _chunkF36LS2C7cjs.collectFarmWebMCPTools.call(void 0, config.root, config.srcDir) : []
|
|
7733
7990
|
})
|
|
7734
7991
|
)};
|
|
7735
7992
|
${servesDefaultMCP ? "farmAppManifestInput.defaultMCP = getFarmDefaultMCPServer;\n" : ""}// A guard written for an MCP server's path keeps its tools out of the public view.
|
|
@@ -7842,7 +8099,7 @@ function renderFarmClientBootstrapScript(canonicalPath, selectedRouteSlots, page
|
|
|
7842
8099
|
}
|
|
7843
8100
|
return '<script id="__farm_route_slots_data__" type="application/json">' +
|
|
7844
8101
|
serializedRouteSlots +
|
|
7845
|
-
'</script>' + stampFarmCspNonce('<script>' + source + '</script>');
|
|
8102
|
+
'</script>' + stampFarmCspNonce('<script>' + source + '</script>') + farmFormStateScript();
|
|
7846
8103
|
}
|
|
7847
8104
|
|
|
7848
8105
|
// The settled defer() values the bootstrap script's props refer to, as development writes them.
|
|
@@ -7983,6 +8240,7 @@ async function renderFarmElement(ReactDOMServer, element, routeKey, flushToken =
|
|
|
7983
8240
|
typeof ReactDOMServer.renderToReadableStream === "function") {
|
|
7984
8241
|
const stream = await ReactDOMServer.renderToReadableStream(element, {
|
|
7985
8242
|
nonce: _resolveCurrentCspNonce(),
|
|
8243
|
+
formState: farmFormState(),
|
|
7986
8244
|
onError(error) {
|
|
7987
8245
|
// redirect()/notFound() are control flow, not render failures: the
|
|
7988
8246
|
// request handler must still receive them to map the response status,
|
|
@@ -8145,6 +8403,7 @@ async function renderFarmElement(ReactDOMServer, element, routeKey, flushToken =
|
|
|
8145
8403
|
};
|
|
8146
8404
|
pipeableStream = ReactDOMServer.renderToPipeableStream(element, {
|
|
8147
8405
|
nonce: _resolveCurrentCspNonce(),
|
|
8406
|
+
formState: farmFormState(),
|
|
8148
8407
|
onShellReady() {
|
|
8149
8408
|
try {
|
|
8150
8409
|
pipeableStream.pipe(destination);
|
|
@@ -8260,6 +8519,12 @@ function rememberFarmSyncRender(routeKey, streamedHtml) {
|
|
|
8260
8519
|
|
|
8261
8520
|
function renderFarmElementSync(ReactDOMServer, element, routeKey) {
|
|
8262
8521
|
if (!farmReactSyncRender) return undefined;
|
|
8522
|
+
// renderToString takes no form state: the page a useActionState form posted to streams.
|
|
8523
|
+
if (farmFormState() !== undefined) return undefined;
|
|
8524
|
+
// renderToString takes no nonce, so the scripts React adds itself (the form replay script of a
|
|
8525
|
+
// form with a function action) would go out without one, and a nonce policy blocks them. A
|
|
8526
|
+
// response with a nonce renders with the stream, which gives them the nonce.
|
|
8527
|
+
if (_resolveCurrentCspNonce()) return undefined;
|
|
8263
8528
|
const addsDoctype = routeKey === undefined ? undefined : farmSyncRenderRoutes.get(routeKey);
|
|
8264
8529
|
if (addsDoctype === undefined) return undefined;
|
|
8265
8530
|
if (typeof ReactDOMServer.renderToString !== "function") return undefined;
|
|
@@ -8673,12 +8938,8 @@ function withFarmDocsRequestCache(response, request, farmLocaleResolution, middl
|
|
|
8673
8938
|
) {
|
|
8674
8939
|
return response;
|
|
8675
8940
|
}
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
return farmOwnedResponse(response.body, {
|
|
8679
|
-
status: response.status,
|
|
8680
|
-
statusText: response.statusText,
|
|
8681
|
-
headers,
|
|
8941
|
+
return farmPreloadHeadersResponse(response, (headers) => {
|
|
8942
|
+
headers.set("Cache-Control", "private, no-store");
|
|
8682
8943
|
});
|
|
8683
8944
|
}
|
|
8684
8945
|
|
|
@@ -8975,7 +9236,7 @@ ${servesDefaultMCP ? `// agent.mcp: the default read-only MCP server at /mcp, as
|
|
|
8975
9236
|
// aside for a page route that answers /mcp and for any MCP server published or
|
|
8976
9237
|
// registered at runtime, such as the docs engine's.
|
|
8977
9238
|
const farmDefaultMCPServer = ${JSON.stringify(
|
|
8978
|
-
_chunkX3MHKLCOcjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root),
|
|
9239
|
+
_chunkX3MHKLCOcjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root), _chunkSQ6IWJ3Hcjs.FARM_VERSION)
|
|
8979
9240
|
)};
|
|
8980
9241
|
let farmDefaultMCPRouteFree;
|
|
8981
9242
|
function getFarmDefaultMCPServer() {
|
|
@@ -9136,13 +9397,18 @@ function matchRewriteRoute(pathname, locale) {
|
|
|
9136
9397
|
return null;
|
|
9137
9398
|
}
|
|
9138
9399
|
|
|
9400
|
+
// The URL the browser asked for, for a request a configured rewrite replaced.
|
|
9401
|
+
const farmRequestedUrls = new WeakMap();
|
|
9402
|
+
|
|
9139
9403
|
function createRewrittenRequest(request, destination) {
|
|
9140
9404
|
const sourceUrl = new URL(request.url);
|
|
9141
9405
|
const destinationUrl = new URL(destination, sourceUrl);
|
|
9142
9406
|
if (!destinationUrl.search && sourceUrl.search) {
|
|
9143
9407
|
destinationUrl.search = sourceUrl.search;
|
|
9144
9408
|
}
|
|
9145
|
-
|
|
9409
|
+
const rewritten = new Request(destinationUrl, request);
|
|
9410
|
+
farmRequestedUrls.set(rewritten, farmRequestedUrls.get(request) || request.url);
|
|
9411
|
+
return rewritten;
|
|
9146
9412
|
}
|
|
9147
9413
|
|
|
9148
9414
|
${generateConfiguredResponseHeadersRuntimeSource()}
|
|
@@ -9150,10 +9416,17 @@ ${generateConfiguredResponseHeadersRuntimeSource()}
|
|
|
9150
9416
|
// App middleware files bundled at build time (sorted by depth, root first)
|
|
9151
9417
|
const fileMiddlewareModules = [${middlewareRegistrations.join(",")}
|
|
9152
9418
|
];
|
|
9153
|
-
|
|
9419
|
+
${edgeMiddlewareFilePaths.length > 0 ? `
|
|
9420
|
+
// \`runtime: "edge"\` middleware runs as Vercel routing middleware in front of the pages the build
|
|
9421
|
+
// prerendered for it, so the build's own requests for those pages skip it. A page any other
|
|
9422
|
+
// middleware guards is never prerendered. Read once: Nitro's prerender worker sets the variable.
|
|
9423
|
+
const farmEdgeMiddlewareFiles = new Set(${JSON.stringify(edgeMiddlewareFilePaths)});
|
|
9424
|
+
const farmPrerendering =
|
|
9425
|
+
typeof process !== "undefined" && process.env?.${_chunkZ3PW3DIRcjs.FARM_PRERENDER_ENV} === "1";
|
|
9426
|
+
` : ""}
|
|
9154
9427
|
const farmMiddlewareRunner = ${hasMiddlewareRuntime ? `createProductionMiddlewareRunner({
|
|
9155
9428
|
config: farmMiddlewareConfig,
|
|
9156
|
-
modules: fileMiddlewareModules,
|
|
9429
|
+
modules: ${edgeMiddlewareFilePaths.length > 0 ? "farmPrerendering ? fileMiddlewareModules.filter((entry) => !farmEdgeMiddlewareFiles.has(entry.filePath)) : fileMiddlewareModules" : "fileMiddlewareModules"},
|
|
9157
9430
|
i18n: farmI18nConfig,
|
|
9158
9431
|
server: farmServerConfig,
|
|
9159
9432
|
apiBasePath: farmLocalAPIBasePath,
|
|
@@ -9293,7 +9566,7 @@ function hasLocalRequestRoute(request, routePathname) {
|
|
|
9293
9566
|
if (${imageRuntime === "none" ? "false" : `pathname === ${JSON.stringify(config.images.path)}`}) {
|
|
9294
9567
|
return true;
|
|
9295
9568
|
}
|
|
9296
|
-
${_optionalChain([config, 'access',
|
|
9569
|
+
${_optionalChain([config, 'access', _223 => _223.docs, 'optionalAccess', _224 => _224.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
|
|
9297
9570
|
// The docs answer below the basePath; their API stays at /api/docs, as API routes do.
|
|
9298
9571
|
const docsRoutePathname = stripFarmBasePath(pathname);
|
|
9299
9572
|
if (
|
|
@@ -9321,7 +9594,7 @@ function getFarmPluginRequestOptions(request) {
|
|
|
9321
9594
|
route: { ...route, pattern: normalizeRuntimePath(farmOpenAPIReference.route) },
|
|
9322
9595
|
};
|
|
9323
9596
|
}
|
|
9324
|
-
const isDocsAPIRequest = ${_optionalChain([config, 'access',
|
|
9597
|
+
const isDocsAPIRequest = ${_optionalChain([config, 'access', _225 => _225.docs, 'optionalAccess', _226 => _226.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
|
|
9325
9598
|
const integrationMatch = ${hasServerRuntimeIntegrations ? `matchIntegrationRoute(serverRuntimeIntegrations, {
|
|
9326
9599
|
pathname,
|
|
9327
9600
|
method: request.method,
|
|
@@ -9405,7 +9678,7 @@ ${hasInfraAnalyticsRuntime ? `
|
|
|
9405
9678
|
// endpoints, Markdown mirrors, and docs pages have no app route pattern, so they are
|
|
9406
9679
|
// labeled here; route.pattern keeps meaning the matched app route for plugins.
|
|
9407
9680
|
const farmBuiltInRoutePaths = new Set(${JSON.stringify(
|
|
9408
|
-
|
|
9681
|
+
_chunkYTNBCXCWcjs.listFarmBuiltInRoutePaths.call(void 0, {
|
|
9409
9682
|
agent: {
|
|
9410
9683
|
...config.agent,
|
|
9411
9684
|
aiCatalog: servesAiCatalog,
|
|
@@ -9416,9 +9689,9 @@ const farmBuiltInRoutePaths = new Set(${JSON.stringify(
|
|
|
9416
9689
|
openapi: openAPIReference
|
|
9417
9690
|
})
|
|
9418
9691
|
)});
|
|
9419
|
-
${_optionalChain([config, 'access',
|
|
9692
|
+
${_optionalChain([config, 'access', _227 => _227.docs, 'optionalAccess', _228 => _228.enabled]) ? `const farmDocsRouteLabelInput = {
|
|
9420
9693
|
path: normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs"),
|
|
9421
|
-
apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess',
|
|
9694
|
+
apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _229 => _229.apiPath]) || "/api/docs")},${_optionalChain([config, 'access', _230 => _230.docs, 'access', _231 => _231.roots, 'optionalAccess', _232 => _232.length]) ? "\n roots: farmDocsResolvedConfig.roots.map((farmDocsRoot) => farmDocsRoot.entry)," : ""}
|
|
9422
9695
|
};
|
|
9423
9696
|
` : ""}// The request's route payload, for a handler that learns what answered while it handles.
|
|
9424
9697
|
const farmRouteLabelSlot = Symbol("farm.route.label.slot");
|
|
@@ -9433,11 +9706,11 @@ function labelFarmRequestOptions(options) {
|
|
|
9433
9706
|
setFarmRouteLabel(options.route, mcpLabel);
|
|
9434
9707
|
return options;
|
|
9435
9708
|
}
|
|
9436
|
-
${_optionalChain([config, 'access',
|
|
9709
|
+
${_optionalChain([config, 'access', _233 => _233.docs, 'optionalAccess', _234 => _234.enabled]) ? `if (options.kind === "docs") {
|
|
9437
9710
|
setFarmRouteLabel(options.route, resolveFarmDocsRouteLabel(routePathname, farmDocsRouteLabelInput));
|
|
9438
9711
|
return options;
|
|
9439
9712
|
}` : ""}
|
|
9440
|
-
${_optionalChain([config, 'access',
|
|
9713
|
+
${_optionalChain([config, 'access', _235 => _235.md, 'optionalAccess', _236 => _236.enabled]) || hasMarkdownPages ? `const markdownLabel = resolveFarmMarkdownRouteLabel(
|
|
9441
9714
|
routePathname,
|
|
9442
9715
|
(page) => matchPageRoute(page)?.route.pattern,
|
|
9443
9716
|
);
|
|
@@ -9472,7 +9745,7 @@ function getApplicableLayouts(pathname, directory) {
|
|
|
9472
9745
|
return applicable;
|
|
9473
9746
|
}
|
|
9474
9747
|
|
|
9475
|
-
${_optionalChain([config, 'access',
|
|
9748
|
+
${_optionalChain([config, 'access', _237 => _237.docs, 'optionalAccess', _238 => _238.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
|
|
9476
9749
|
if (request.method === "HEAD") return response;
|
|
9477
9750
|
if (response.headers.get("x-farm-docs-adapter")) return response;
|
|
9478
9751
|
|
|
@@ -9580,7 +9853,7 @@ ${_optionalChain([config, 'access', _233 => _233.docs, 'optionalAccess', _234 =>
|
|
|
9580
9853
|
|
|
9581
9854
|
// Shells keep their own LRU so query-string variants never evict app cache entries.
|
|
9582
9855
|
const pprShellCache = getFarmDataCache().pprShellCache;
|
|
9583
|
-
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access',
|
|
9856
|
+
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _239 => _239.experimental, 'optionalAccess', _240 => _240.ppr]) === true)};
|
|
9584
9857
|
|
|
9585
9858
|
function resolveRouteRenderingView(route) {
|
|
9586
9859
|
// The same merge development uses: baked directive config under the
|
|
@@ -9714,7 +9987,7 @@ async function handleFarmRequest(request, adapterContext) {
|
|
|
9714
9987
|
},
|
|
9715
9988
|
{ redirect: !isFarmLocalAPIPathname(requestUrl.pathname) }
|
|
9716
9989
|
)` : "handleFarmRequestInContext(request, null, false, Date.now(), adapterContext, requestUrl)"};
|
|
9717
|
-
${_optionalChain([config, 'access',
|
|
9990
|
+
${_optionalChain([config, 'access', _241 => _241.md, 'optionalAccess', _242 => _242.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
|
|
9718
9991
|
if (matchPageRoute(pathname)) {
|
|
9719
9992
|
// The Link header advertises the public .md URL, like the head alternate.
|
|
9720
9993
|
return applyMarkdownNegotiationHeaders(response, {
|
|
@@ -9766,6 +10039,8 @@ async function resolveFarmRequestInContext(
|
|
|
9766
10039
|
let url = requestUrl;
|
|
9767
10040
|
let pathname = url.pathname;
|
|
9768
10041
|
let routePathname = getFarmRoutePathname(pathname);
|
|
10042
|
+
// Before middleware: a ctx.rewrite() replaces the request below.
|
|
10043
|
+
const farmRequestedUrl = farmRequestedUrls.get(request) || request.url;
|
|
9769
10044
|
|
|
9770
10045
|
// Redirects have precedence over local routes. Configured rewrites use
|
|
9771
10046
|
// after-files semantics so emitted page, API, integration, docs, image, and
|
|
@@ -9923,7 +10198,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9923
10198
|
return renderFarmErrorJSONResponse();` : `
|
|
9924
10199
|
if (isFarmLocalAPIPathname(pathname)) return renderFarmErrorJSONResponse();
|
|
9925
10200
|
// No page was selected, so only the root error boundary and layouts apply.
|
|
9926
|
-
const errorResponse = await renderFarmErrorResponse(middlewareResult.error, "/", {}, null);${_optionalChain([config, 'access',
|
|
10201
|
+
const errorResponse = await renderFarmErrorResponse(middlewareResult.error, "/", {}, null);${_optionalChain([config, 'access', _243 => _243.md, 'optionalAccess', _244 => _244.enabled]) ? `
|
|
9927
10202
|
// An agent asking for Markdown reads the error document as Markdown, as it
|
|
9928
10203
|
// does when a page throws. The helper answers null when Markdown is off.
|
|
9929
10204
|
const markdownErrorResponse = await createMarkdownMirrorResponse({
|
|
@@ -9965,7 +10240,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9965
10240
|
}
|
|
9966
10241
|
` : ""}
|
|
9967
10242
|
|
|
9968
|
-
${_optionalChain([config, 'access',
|
|
10243
|
+
${_optionalChain([config, 'access', _245 => _245.docs, 'optionalAccess', _246 => _246.enabled]) ? `
|
|
9969
10244
|
// Docs responses are served after app middleware so route guards and
|
|
9970
10245
|
// middleware headers apply to the docs engine like any other page content.
|
|
9971
10246
|
// An app's own llms.txt, llms-full.txt, sitemap.xml, and robots.txt take
|
|
@@ -9996,13 +10271,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
9996
10271
|
middlewareData,
|
|
9997
10272
|
middlewareContext,
|
|
9998
10273
|
);
|
|
9999
|
-
|
|
10000
|
-
|
|
10001
|
-
|
|
10002
|
-
|
|
10003
|
-
|
|
10004
|
-
headers: docsHeaders,
|
|
10005
|
-
}), middlewareHeaders);
|
|
10274
|
+
// In place for a page the adapter built with createHtmlResponse, so its HTML string stays.
|
|
10275
|
+
const bufferedDocsResponse = farmPreloadHeadersResponse(wrappedDocsResponse, (headers) => {
|
|
10276
|
+
headers.set("x-farm-preload-buffered", "1");
|
|
10277
|
+
});
|
|
10278
|
+
return applyProductionMiddlewareHeaders(bufferedDocsResponse, middlewareHeaders);
|
|
10006
10279
|
}
|
|
10007
10280
|
}
|
|
10008
10281
|
` : ""}
|
|
@@ -10057,7 +10330,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10057
10330
|
}
|
|
10058
10331
|
` : ""}
|
|
10059
10332
|
|
|
10060
|
-
${_optionalChain([config, 'access',
|
|
10333
|
+
${_optionalChain([config, 'access', _247 => _247.md, 'optionalAccess', _248 => _248.enabled]) ? `
|
|
10061
10334
|
if (farmMarkdownConfig?.enabled) {
|
|
10062
10335
|
const markdownResponse = await createMarkdownMirrorResponse({
|
|
10063
10336
|
// The mirror helper only reads metadata and creates its own GET request.
|
|
@@ -10160,11 +10433,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10160
10433
|
return applyProductionMiddlewareHeaders(applicationMetadataResponse, middlewareHeaders);
|
|
10161
10434
|
}
|
|
10162
10435
|
` : ""}
|
|
10163
|
-
${_optionalChain([config, 'access',
|
|
10436
|
+
${_optionalChain([config, 'access', _249 => _249.agent, 'optionalAccess', _250 => _250.manifest]) !== false ? `
|
|
10164
10437
|
// agent.manifest: /.well-known/farmjs.json (and 0.1.34's /.well-known/farmjs), the app's
|
|
10165
10438
|
// public manifest, the same document for every request.
|
|
10166
10439
|
if (
|
|
10167
|
-
[${JSON.stringify(
|
|
10440
|
+
[${JSON.stringify(_chunkYTNBCXCWcjs.FARM_APP_MANIFEST_PATH)}, ${JSON.stringify(_chunkYTNBCXCWcjs.FARM_APP_MANIFEST_LEGACY_PATH)}].includes(
|
|
10168
10441
|
normalizeRuntimePath(routePathname),
|
|
10169
10442
|
)
|
|
10170
10443
|
) {
|
|
@@ -10174,9 +10447,9 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10174
10447
|
);
|
|
10175
10448
|
}
|
|
10176
10449
|
` : ""}
|
|
10177
|
-
${_optionalChain([config, 'access',
|
|
10450
|
+
${_optionalChain([config, 'access', _251 => _251.agent, 'optionalAccess', _252 => _252.apiCatalog]) ? `
|
|
10178
10451
|
// agent.apiCatalog: list the OpenAPI and MCP surfaces at the RFC 9727 path.
|
|
10179
|
-
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(
|
|
10452
|
+
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkYTNBCXCWcjs.FARM_API_CATALOG_PATH)}) {
|
|
10180
10453
|
return applyProductionMiddlewareHeaders(
|
|
10181
10454
|
createFarmApiCatalogResponse(request.method, farmApiCatalogInput, request),
|
|
10182
10455
|
middlewareHeaders,
|
|
@@ -10201,11 +10474,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10201
10474
|
);
|
|
10202
10475
|
}
|
|
10203
10476
|
` : ""}
|
|
10204
|
-
${_optionalChain([config, 'access',
|
|
10477
|
+
${_optionalChain([config, 'access', _253 => _253.agent, 'optionalAccess', _254 => _254.llmsTxt, 'optionalAccess', _255 => _255.enabled]) ? `
|
|
10205
10478
|
// agent.llmsTxt with no llms.ts or llms-full.ts: serve the generated files.
|
|
10206
10479
|
const farmGeneratedLlmsKind = normalizeRuntimePath(routePathname) === "/llms.txt"
|
|
10207
10480
|
? "llms"
|
|
10208
|
-
: ${_optionalChain([config, 'access',
|
|
10481
|
+
: ${_optionalChain([config, 'access', _256 => _256.agent, 'optionalAccess', _257 => _257.llmsTxt, 'optionalAccess', _258 => _258.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
|
|
10209
10482
|
if (farmGeneratedLlmsKind) {
|
|
10210
10483
|
const llmsContext = createFarmLlmsTxtContext(request, farmGeneratedLlmsKind === "llms-full");
|
|
10211
10484
|
// Renders are shared per origin the request reached, which is where pages are read.
|
|
@@ -10241,7 +10514,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10241
10514
|
}
|
|
10242
10515
|
` : ""}
|
|
10243
10516
|
|
|
10244
|
-
${_optionalChain([config, 'access',
|
|
10517
|
+
${_optionalChain([config, 'access', _259 => _259.docs, 'optionalAccess', _260 => _260.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
|
|
10245
10518
|
const docsAPIResponse = await farmDocsAPIHandler(cloneFarmRequestWithContext(request));
|
|
10246
10519
|
if (docsAPIResponse) {
|
|
10247
10520
|
return applyProductionMiddlewareHeaders(
|
|
@@ -10266,7 +10539,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10266
10539
|
if (matchedRoute && request.method === "POST") {
|
|
10267
10540
|
const actionResponse = await _runWithMiddlewareData(middlewareData || {}, () =>
|
|
10268
10541
|
_runWithMiddlewareContext(middlewareContext || {}, () =>
|
|
10269
|
-
handleFarmFormActionRequest(request, farmFormActionsConfig)
|
|
10542
|
+
handleFarmFormActionRequest(request, farmFormActionsConfig, farmRequestedUrl)
|
|
10270
10543
|
)
|
|
10271
10544
|
);
|
|
10272
10545
|
if (actionResponse) return applyProductionMiddlewareHeaders(actionResponse, middlewareHeaders);
|
|
@@ -10831,7 +11104,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10831
11104
|
);
|
|
10832
11105
|
}
|
|
10833
11106
|
}
|
|
10834
|
-
${_optionalChain([config, 'access',
|
|
11107
|
+
${_optionalChain([config, 'access', _261 => _261.md, 'optionalAccess', _262 => _262.enabled]) ? `
|
|
10835
11108
|
// Advertise the Markdown mirror in the head as well as the Link header,
|
|
10836
11109
|
// using the public path the .md request will be resolved against.
|
|
10837
11110
|
mergedMetadata = addMetadataMarkdownAlternate(
|
|
@@ -10850,7 +11123,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
10850
11123
|
emitFarmEvent({ type: "cache.bypass", route: pathname, reason: "request-read" });
|
|
10851
11124
|
}
|
|
10852
11125
|
|
|
10853
|
-
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
11126
|
+
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _263 => _263.agent, 'optionalAccess', _264 => _264.jsonLd]), () => ( false)))} });
|
|
10854
11127
|
const title = renderedMetadata.title;
|
|
10855
11128
|
const metaTags = renderedMetadata.tags;
|
|
10856
11129
|
const hasFavicon = renderedMetadata.hasFavicon;
|
|
@@ -11610,11 +11883,11 @@ function createFarmRuntimeHookErrorResponse(request, error) {
|
|
|
11610
11883
|
export async function fetch(request, context) {${imageRuntime === "none" ? "" : `
|
|
11611
11884
|
// The image optimizer's fetch of a local source is not a loopback visitor.
|
|
11612
11885
|
context = _withFarmImageSourceClientAddress(request, context);`}
|
|
11613
|
-
${_optionalChain([config, 'access',
|
|
11886
|
+
${_optionalChain([config, 'access', _265 => _265.agent, 'optionalAccess', _266 => _266.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
|
|
11614
11887
|
basePath: farmLocalAPIBasePath,
|
|
11615
11888
|
dispatch: async (localRequest) =>
|
|
11616
11889
|
(await handleAPIRequest(localRequest)) ?? Response.json({ error: "Not Found" }, { status: 404 }),
|
|
11617
|
-
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access',
|
|
11890
|
+
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _267 => _267.agent, 'optionalAccess', _268 => _268.noindexPreviews]) ? `
|
|
11618
11891
|
// Keep every response of a preview deployment out of search indexes.
|
|
11619
11892
|
return farmNoindexPreview ? applyFarmPreviewRobotsTag(response) : response;` : ""}
|
|
11620
11893
|
}
|
|
@@ -11798,6 +12071,16 @@ function getEffectiveRouteRule(config, pathname) {
|
|
|
11798
12071
|
function getManifestPageEntry(manifest, pathname) {
|
|
11799
12072
|
return manifest.routes.filter((entry) => entry.kind === "page" && middlewarePatternMatches(entry.pattern, pathname)).sort((left, right) => _chunkYTVSWXEZcjs.compareRoutePatternSpecificity.call(void 0, left.pattern, right.pattern))[0];
|
|
11800
12073
|
}
|
|
12074
|
+
function withFarmEdgeGuardedPrerenderHeaders(headers, edgeGuarded) {
|
|
12075
|
+
if (!edgeGuarded) return headers;
|
|
12076
|
+
const cacheHeaders = /* @__PURE__ */ new Set(["cache-control", ..._chunkUKZ6AWKZcjs.CDN_CACHE_CONTROL_HEADERS]);
|
|
12077
|
+
return {
|
|
12078
|
+
...Object.fromEntries(
|
|
12079
|
+
Object.entries(headers).filter(([name]) => !cacheHeaders.has(name.toLowerCase()))
|
|
12080
|
+
),
|
|
12081
|
+
"cache-control": "private, no-store"
|
|
12082
|
+
};
|
|
12083
|
+
}
|
|
11801
12084
|
function getPhysicalPrerenderBypassReason(options) {
|
|
11802
12085
|
const {
|
|
11803
12086
|
config,
|
|
@@ -11816,11 +12099,11 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
11816
12099
|
}
|
|
11817
12100
|
if (_chunkUPOYKX4Scjs.appMiddlewareMayHandlePath.call(void 0, middlewareRoutes, pathname)) return "app middleware";
|
|
11818
12101
|
if (_chunkUPOYKX4Scjs.configMiddlewareMayHandlePath.call(void 0, config.middleware, pathname)) return "configured middleware";
|
|
11819
|
-
if (
|
|
12102
|
+
if (_chunk7LK5CTUMcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
|
|
11820
12103
|
if (farmServerRuntimePluginsMayHandlePath(config, pathname)) return "server runtime plugin";
|
|
11821
12104
|
const manifestEntry = getManifestPageEntry(routeRuntimeManifest, pathname);
|
|
11822
|
-
if (_optionalChain([manifestEntry, 'optionalAccess',
|
|
11823
|
-
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access',
|
|
12105
|
+
if (_optionalChain([manifestEntry, 'optionalAccess', _269 => _269.rendering]) === "dynamic") return "dynamic runtime manifest";
|
|
12106
|
+
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _270 => _270.regions, 'optionalAccess', _271 => _271.length])) || manifestEntry.maxDuration !== void 0)) {
|
|
11824
12107
|
return "route runtime controls";
|
|
11825
12108
|
}
|
|
11826
12109
|
const routeRule = getEffectiveRouteRule(config, pathname);
|
|
@@ -11833,20 +12116,32 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
11833
12116
|
return void 0;
|
|
11834
12117
|
}
|
|
11835
12118
|
async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
11836
|
-
if (!_optionalChain([config, 'access',
|
|
11837
|
-
if (
|
|
11838
|
-
_chunkQMNWKQL4cjs.logger.
|
|
11839
|
-
|
|
12119
|
+
if (!_optionalChain([config, 'access', _272 => _272.docs, 'optionalAccess', _273 => _273.enabled]) || !config.docs.prerender) return [];
|
|
12120
|
+
if (_chunkI7J5RLGOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge") {
|
|
12121
|
+
_chunkQMNWKQL4cjs.logger.info(
|
|
12122
|
+
`\u21AA Keeping docs pages in the edge docs snapshot: docs.prerender writes static files on Node and serverless targets, not "${preset}".`
|
|
11840
12123
|
);
|
|
11841
12124
|
return [];
|
|
11842
12125
|
}
|
|
11843
|
-
if (
|
|
11844
|
-
|
|
11845
|
-
|
|
12126
|
+
if (!_chunkLDEXTX4Icjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
|
|
12127
|
+
const { pages: pages2, originDependent } = _chunkFVYBEMODcjs.listFarmDocsBuiltInPrerenderPages.call(void 0, config.docs, {
|
|
12128
|
+
root,
|
|
12129
|
+
srcDir: config.srcDir
|
|
12130
|
+
});
|
|
12131
|
+
if (originDependent.length > 0) {
|
|
12132
|
+
_chunkQMNWKQL4cjs.logger.info(
|
|
12133
|
+
`\u21AA Keeping ${originDependent.length} docs page(s) rendering on request: their social image metadata is an absolute URL built from the request's origin. Set docs.socialImage.baseUrl to prerender them.`
|
|
12134
|
+
);
|
|
12135
|
+
}
|
|
12136
|
+
return pages2;
|
|
12137
|
+
}
|
|
12138
|
+
if (!_chunk67MZTLTFcjs.isReactRenderer.call(void 0, config.renderer)) {
|
|
12139
|
+
_chunkQMNWKQL4cjs.logger.warn(
|
|
12140
|
+
`The docs adapter ${JSON.stringify(config.docs.adapter.id)} renders with React; docs.prerender keeps its pages rendering on request with the "${config.renderer.name}" renderer.`
|
|
11846
12141
|
);
|
|
11847
12142
|
return [];
|
|
11848
12143
|
}
|
|
11849
|
-
const pages = await
|
|
12144
|
+
const pages = await _chunkLDEXTX4Icjs.listFarmDocsAdapterPages.call(void 0, config.docs, { root, srcDir: config.srcDir });
|
|
11850
12145
|
if (!pages) {
|
|
11851
12146
|
_chunkQMNWKQL4cjs.logger.warn(
|
|
11852
12147
|
`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.`
|
|
@@ -11857,9 +12152,9 @@ async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
|
11857
12152
|
}
|
|
11858
12153
|
function hasFarmNitroCacheRouteRule(routeRules) {
|
|
11859
12154
|
return Object.values(routeRules || {}).some((rule) => {
|
|
11860
|
-
const swr = _optionalChain([rule, 'optionalAccess',
|
|
11861
|
-
const cache = _optionalChain([rule, 'optionalAccess',
|
|
11862
|
-
const headers = _optionalChain([rule, 'optionalAccess',
|
|
12155
|
+
const swr = _optionalChain([rule, 'optionalAccess', _274 => _274.swr]);
|
|
12156
|
+
const cache = _optionalChain([rule, 'optionalAccess', _275 => _275.cache]);
|
|
12157
|
+
const headers = _optionalChain([rule, 'optionalAccess', _276 => _276.headers]);
|
|
11863
12158
|
return swr !== void 0 && swr !== false || cache !== void 0 && cache !== false || !!headers && typeof headers === "object" && Object.keys(headers).length > 0;
|
|
11864
12159
|
});
|
|
11865
12160
|
}
|
|
@@ -11872,10 +12167,10 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
11872
12167
|
const nitroBuilder = nitroBuilderResult.value;
|
|
11873
12168
|
const isVercel = preset === "vercel";
|
|
11874
12169
|
const isCloudflareWorker = preset === "cloudflare-module";
|
|
11875
|
-
const outputDir =
|
|
12170
|
+
const outputDir = _chunk7LK5CTUMcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
11876
12171
|
const runtimeServerOutputDir = isVercel ? _path2.default.join(outputDir, "functions", "__nitro.func") : _path2.default.join(outputDir, "server");
|
|
11877
12172
|
const ssrOutputDir = _path2.default.join(root, distDir, "ssr");
|
|
11878
|
-
const imageRuntime =
|
|
12173
|
+
const imageRuntime = _chunkF36LS2C7cjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
|
|
11879
12174
|
const hasGeneratedMetadataImages = Array.from(routeManager.getMetadataImages().values()).some(
|
|
11880
12175
|
(image) => image.sourceType === "module"
|
|
11881
12176
|
);
|
|
@@ -11889,15 +12184,18 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
11889
12184
|
...imageRuntime === "node" ? ["sharp"] : [],
|
|
11890
12185
|
...useExternalMetadataImageRuntime ? ["@vercel/og"] : []
|
|
11891
12186
|
]);
|
|
11892
|
-
const
|
|
12187
|
+
const ssrExternalsArePackaged = [...ssrExternalPackages].every(
|
|
12188
|
+
(packageName) => copiedRuntimePackages.has(packageName)
|
|
12189
|
+
);
|
|
12190
|
+
const isPrebuiltSSRCandidate = preset === "node-server" && ssrExternalsArePackaged;
|
|
11893
12191
|
_chunkQMNWKQL4cjs.logger.info(`\u{1F4E6} Nitro output directory: ${outputDir}`);
|
|
11894
12192
|
_chunkQMNWKQL4cjs.logger.info(`\u{1F4E6} SSR entry file: ${ssrEntryFile}`);
|
|
11895
12193
|
_chunkQMNWKQL4cjs.logger.info(`\u{1F4E6} Preset: ${preset}`);
|
|
11896
12194
|
const ssgCollectionPromise = routeManager.collectSSGPages();
|
|
11897
|
-
const middlewareRoutesPromise = discoverMiddlewareRoutes(
|
|
12195
|
+
const middlewareRoutesPromise = discoverMiddlewareRoutes(_chunkMTBDJ326cjs.getFarmAppDirectories.call(void 0, config));
|
|
11898
12196
|
const configuredResponseRoutesPromise = Promise.all([config.redirects(), config.rewrites()]);
|
|
11899
12197
|
const docsPrerenderPagesPromise = getFarmDocsPrerenderPages(config, root, preset);
|
|
11900
|
-
const farmWorkflows = await
|
|
12198
|
+
const farmWorkflows = await _chunkFSODPZRTcjs.prepareFarmWorkflowsForNitro.call(void 0, config);
|
|
11901
12199
|
const farmCron = await _chunkYAEN3L2Fcjs.prepareFarmCronForNitro.call(void 0, config);
|
|
11902
12200
|
const [
|
|
11903
12201
|
{ ssg: ssgPages },
|
|
@@ -11923,12 +12221,21 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
11923
12221
|
config: await readMiddlewareFileConfig(route.filePath)
|
|
11924
12222
|
}))
|
|
11925
12223
|
) : middlewareRoutes;
|
|
12224
|
+
const edgeMiddlewareRoutes = farmTargetRunsEdgeMiddleware(preset) ? middlewareRoutesWithConfig.filter(isFarmEdgeMiddlewareRoute) : [];
|
|
12225
|
+
const serverMiddlewareRoutes = edgeMiddlewareRoutes.length > 0 ? middlewareRoutesWithConfig.filter((route) => !isFarmEdgeMiddlewareRoute(route)) : middlewareRoutesWithConfig;
|
|
12226
|
+
const edgeGuardedPrerenderRoutes = [];
|
|
12227
|
+
const addPrerenderRoute = (pathname) => {
|
|
12228
|
+
prerenderRoutes.push(pathname);
|
|
12229
|
+
if (_chunkUPOYKX4Scjs.appMiddlewareMayHandlePath.call(void 0, edgeMiddlewareRoutes, pathname)) {
|
|
12230
|
+
edgeGuardedPrerenderRoutes.push(pathname);
|
|
12231
|
+
}
|
|
12232
|
+
};
|
|
11926
12233
|
for (const page of ssgPages) {
|
|
11927
12234
|
if (page.revalidate !== void 0) continue;
|
|
11928
12235
|
if (prerenderRoutes.includes(page.urlPath)) continue;
|
|
11929
12236
|
const reason = getPhysicalPrerenderBypassReason({
|
|
11930
12237
|
config,
|
|
11931
|
-
middlewareRoutes:
|
|
12238
|
+
middlewareRoutes: serverMiddlewareRoutes,
|
|
11932
12239
|
routeRuntimeManifest,
|
|
11933
12240
|
redirectSources,
|
|
11934
12241
|
rewriteSources,
|
|
@@ -11938,7 +12245,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
11938
12245
|
skippedPrerenderRoutes.push({ pathname: page.urlPath, reason });
|
|
11939
12246
|
continue;
|
|
11940
12247
|
}
|
|
11941
|
-
|
|
12248
|
+
addPrerenderRoute(page.urlPath);
|
|
11942
12249
|
}
|
|
11943
12250
|
const docsRouteRuntimeManifest = {
|
|
11944
12251
|
...routeRuntimeManifest,
|
|
@@ -11948,7 +12255,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
11948
12255
|
if (prerenderRoutes.includes(pathname)) continue;
|
|
11949
12256
|
const reason = getPhysicalPrerenderBypassReason({
|
|
11950
12257
|
config,
|
|
11951
|
-
middlewareRoutes:
|
|
12258
|
+
middlewareRoutes: serverMiddlewareRoutes,
|
|
11952
12259
|
routeRuntimeManifest: docsRouteRuntimeManifest,
|
|
11953
12260
|
redirectSources,
|
|
11954
12261
|
rewriteSources,
|
|
@@ -11958,7 +12265,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
11958
12265
|
skippedPrerenderRoutes.push({ pathname, reason });
|
|
11959
12266
|
continue;
|
|
11960
12267
|
}
|
|
11961
|
-
|
|
12268
|
+
addPrerenderRoute(pathname);
|
|
11962
12269
|
}
|
|
11963
12270
|
for (const skipped of skippedPrerenderRoutes) {
|
|
11964
12271
|
_chunkQMNWKQL4cjs.logger.info(`\u21AA Keeping SSG route ${skipped.pathname} server-handled (${skipped.reason})`);
|
|
@@ -11997,7 +12304,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
11997
12304
|
webEntry: clientJsSrc,
|
|
11998
12305
|
webBoot: clientBootSrc,
|
|
11999
12306
|
stylesheet: clientCssHref,
|
|
12000
|
-
webFiles: _nullishCoalesce(_optionalChain([clientModulePreloads, 'optionalAccess',
|
|
12307
|
+
webFiles: _nullishCoalesce(_optionalChain([clientModulePreloads, 'optionalAccess', _277 => _277.files]), () => ( []))
|
|
12001
12308
|
})
|
|
12002
12309
|
) : null;
|
|
12003
12310
|
for (const output of Object.values(ssrBundle)) {
|
|
@@ -12244,19 +12551,19 @@ function toFarmNodeResponse(request, response) {
|
|
|
12244
12551
|
);
|
|
12245
12552
|
}
|
|
12246
12553
|
await fs4.writeFile(
|
|
12247
|
-
_path2.default.join(ssrOutputDir,
|
|
12248
|
-
|
|
12554
|
+
_path2.default.join(ssrOutputDir, _chunkNG2EZ6QScjs.FARM_DESKTOP_ENV_MODULE_FILE),
|
|
12555
|
+
_chunkNG2EZ6QScjs.FARM_DESKTOP_ENV_MODULE_SOURCE
|
|
12249
12556
|
);
|
|
12250
12557
|
}
|
|
12251
12558
|
const farmNodeServerEntryPath = preset === "node-server" ? _path2.default.join(ssrOutputDir, "farm-node-server-entry.mjs") : null;
|
|
12252
12559
|
if (farmNodeServerEntryPath && nodeAdapterModule) {
|
|
12253
12560
|
await fs4.writeFile(
|
|
12254
|
-
_path2.default.join(ssrOutputDir,
|
|
12255
|
-
|
|
12561
|
+
_path2.default.join(ssrOutputDir, _chunkNG2EZ6QScjs.FARM_NODE_ENV_MODULE_FILE),
|
|
12562
|
+
_chunkNG2EZ6QScjs.FARM_NODE_ENV_MODULE_SOURCE
|
|
12256
12563
|
);
|
|
12257
12564
|
await fs4.writeFile(
|
|
12258
12565
|
farmNodeServerEntryPath,
|
|
12259
|
-
|
|
12566
|
+
_chunkNG2EZ6QScjs.createFarmNodeServerEntry.call(void 0, {
|
|
12260
12567
|
nitroEntryFile: _path2.default.basename(nitroEntryPath),
|
|
12261
12568
|
nodeAdapterModule,
|
|
12262
12569
|
server: config.server,
|
|
@@ -12269,7 +12576,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
12269
12576
|
if (farmBunServerEntryPath) {
|
|
12270
12577
|
await fs4.writeFile(
|
|
12271
12578
|
farmBunServerEntryPath,
|
|
12272
|
-
|
|
12579
|
+
_chunkNG2EZ6QScjs.createFarmBunServerEntry.call(void 0, {
|
|
12273
12580
|
nitroEntryFile: _path2.default.basename(nitroEntryPath),
|
|
12274
12581
|
bunAdapterModule: resolveNitroRuntimeDependency(root, "srvx/bun"),
|
|
12275
12582
|
server: config.server,
|
|
@@ -12303,19 +12610,30 @@ function toFarmNodeResponse(request, response) {
|
|
|
12303
12610
|
ssrOutputDir,
|
|
12304
12611
|
ssrEntryFile
|
|
12305
12612
|
);
|
|
12306
|
-
const configuredNitroRouteRules =
|
|
12613
|
+
const configuredNitroRouteRules = _chunkOCNV4CI2cjs.nitroRouteRulesBelowBasePath.call(void 0,
|
|
12614
|
+
shouldBuildFarmMobileClient(config) ? varyFarmNitroCacheRulesByShell(_chunkOCNV4CI2cjs.routeRulesToNitroRouteRules.call(void 0, config.routeRules)) : _chunkOCNV4CI2cjs.routeRulesToNitroRouteRules.call(void 0, config.routeRules),
|
|
12615
|
+
config.basePath,
|
|
12616
|
+
_chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, config.api)
|
|
12617
|
+
);
|
|
12618
|
+
const toPrerenderPublicPath = (route) => _chunk23VJEGKCcjs.normalizeFarmTrailingSlashPathname.call(void 0,
|
|
12619
|
+
_chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, route, config.basePath),
|
|
12620
|
+
config.trailingSlash === true
|
|
12621
|
+
);
|
|
12307
12622
|
const prerenderNitroRouteRules = Object.fromEntries(
|
|
12308
12623
|
prerenderRoutes.map((route) => {
|
|
12309
12624
|
const configuredRule = configuredNitroRouteRules[route] || {};
|
|
12310
12625
|
return [
|
|
12311
|
-
route,
|
|
12626
|
+
toPrerenderPublicPath(route),
|
|
12312
12627
|
{
|
|
12313
12628
|
...configuredRule,
|
|
12314
12629
|
prerender: true,
|
|
12315
|
-
headers:
|
|
12316
|
-
|
|
12317
|
-
|
|
12318
|
-
|
|
12630
|
+
headers: withFarmEdgeGuardedPrerenderHeaders(
|
|
12631
|
+
{
|
|
12632
|
+
...getPrerenderRouteHeaders(route, configuredHeaderRoutes),
|
|
12633
|
+
...configuredRule.headers
|
|
12634
|
+
},
|
|
12635
|
+
edgeGuardedPrerenderRoutes.includes(route)
|
|
12636
|
+
)
|
|
12319
12637
|
}
|
|
12320
12638
|
];
|
|
12321
12639
|
})
|
|
@@ -12362,7 +12680,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
12362
12680
|
// answered independently, as by the production server, so keeping several
|
|
12363
12681
|
// in flight overlaps the worker's rendering with this thread's per-route work.
|
|
12364
12682
|
concurrency: Math.min(_os2.default.availableParallelism(), 8),
|
|
12365
|
-
routes: prerenderRoutes
|
|
12683
|
+
routes: prerenderRoutes.map(toPrerenderPublicPath)
|
|
12366
12684
|
}
|
|
12367
12685
|
} : {},
|
|
12368
12686
|
experimental: {
|
|
@@ -12413,7 +12731,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
12413
12731
|
// Workers bundle React here rather than loading it from node_modules.
|
|
12414
12732
|
// Unenv rewrites `process` before Nitro's own replacements run, so
|
|
12415
12733
|
// React's development builds would otherwise ship next to production.
|
|
12416
|
-
...isCloudflareWorker ? [createReactProductionModePlugin()] : []
|
|
12734
|
+
...isCloudflareWorker ? [_chunkNG2EZ6QScjs.createReactProductionModePlugin.call(void 0, )] : []
|
|
12417
12735
|
]
|
|
12418
12736
|
},
|
|
12419
12737
|
// Keep the public Nitro boolean intact for build hooks. Farm replaces
|
|
@@ -12439,21 +12757,23 @@ function toFarmNodeResponse(request, response) {
|
|
|
12439
12757
|
snapshotSSRRebundleOptions(nitroConfig)
|
|
12440
12758
|
);
|
|
12441
12759
|
const requestedBuilder = _nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER));
|
|
12442
|
-
const
|
|
12443
|
-
_optionalChain([nitroConfig, 'access',
|
|
12444
|
-
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess',
|
|
12760
|
+
const nitroBuildIsFarms = (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _278 => _278.rollupConfig, 'optionalAccess', _279 => _279.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _280 => _280.rollupConfig, 'optionalAccess', _281 => _281.plugins])) && customRollupKeys.length === 0 && Boolean(
|
|
12761
|
+
_optionalChain([nitroConfig, 'access', _282 => _282.handlers, 'optionalAccess', _283 => _283.some, 'call', _284 => _284(
|
|
12762
|
+
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _285 => _285.handler]) || "") === nitroEntryPath
|
|
12445
12763
|
)])
|
|
12446
12764
|
);
|
|
12765
|
+
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && nitroBuildIsFarms && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _286 => _286.output, 'optionalAccess', _287 => _287.serverDir]) || "") === _path2.default.resolve(expectedServerDir);
|
|
12766
|
+
const prerenderReusesPrebuiltSSR = prerenderRoutes.length > 0 && ssrExternalsArePackaged && nitroBuildIsFarms;
|
|
12447
12767
|
const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
|
|
12448
12768
|
if (selectRolldownBuilder) nitroConfig.builder = "rolldown";
|
|
12449
12769
|
const useRolldownBuilder = canReusePrebuiltSSR && (_nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER))) === "rolldown";
|
|
12450
12770
|
const shouldMinify = nitroConfig.minify !== false;
|
|
12451
|
-
const keepServerNames = !(_optionalChain([config, 'access',
|
|
12771
|
+
const keepServerNames = !(_optionalChain([config, 'access', _288 => _288.docs, 'optionalAccess', _289 => _289.enabled]) && _optionalChain([config, 'access', _290 => _290.docs, 'access', _291 => _291.adapter, 'optionalAccess', _292 => _292.server]));
|
|
12452
12772
|
const useFarmServerMinifier = shouldMinify && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig;
|
|
12453
12773
|
const serverChunkMinifier = useFarmServerMinifier ? createServerChunkMinifyPlugin({ keepNames: keepServerNames, target: "esnext" }) : null;
|
|
12454
12774
|
const ssrRollupPlugin = canReusePrebuiltSSR ? prebuiltSSRPlugin : createServerReadSSRAssetsPlugin(ssrBundle, ssrOutputDir);
|
|
12455
12775
|
if (ssrRollupPlugin) {
|
|
12456
|
-
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access',
|
|
12776
|
+
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _293 => _293.rollupConfig, 'optionalAccess', _294 => _294.plugins]);
|
|
12457
12777
|
nitroConfig.rollupConfig = {
|
|
12458
12778
|
...nitroConfig.rollupConfig,
|
|
12459
12779
|
plugins: [
|
|
@@ -12480,9 +12800,9 @@ function toFarmNodeResponse(request, response) {
|
|
|
12480
12800
|
const orderOf = (route) => _nullishCoalesce(prerenderOrder.get(route), () => ( Number.MAX_SAFE_INTEGER));
|
|
12481
12801
|
prerenderedRoutes.sort((a, b) => orderOf(a.route) - orderOf(b.route));
|
|
12482
12802
|
});
|
|
12483
|
-
if (_optionalChain([config, 'access',
|
|
12803
|
+
if (_optionalChain([config, 'access', _295 => _295.md, 'optionalAccess', _296 => _296.enabled])) {
|
|
12484
12804
|
nitroInstance.hooks.hook("prerender:generate", (route) => {
|
|
12485
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
12805
|
+
if (!route.contents || !_optionalChain([route, 'access', _297 => _297.contentType, 'optionalAccess', _298 => _298.toLowerCase, 'call', _299 => _299(), 'access', _300 => _300.includes, 'call', _301 => _301("html")])) return;
|
|
12486
12806
|
const alternatePath = _chunkFT6KJHS3cjs.getFarmMarkdownAlternatePath.call(void 0, config.md, route.route, {
|
|
12487
12807
|
routePathname: (pathname) => routeManager.toRoutePathname(pathname)
|
|
12488
12808
|
});
|
|
@@ -12505,7 +12825,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
12505
12825
|
}
|
|
12506
12826
|
if (config.security.csp && config.security.csp.nonce) {
|
|
12507
12827
|
nitroInstance.hooks.hook("prerender:generate", async (route) => {
|
|
12508
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
12828
|
+
if (!route.contents || !_optionalChain([route, 'access', _302 => _302.contentType, 'optionalAccess', _303 => _303.toLowerCase, 'call', _304 => _304(), 'access', _305 => _305.includes, 'call', _306 => _306("html")])) return;
|
|
12509
12829
|
const staticCsp = await _chunk6JHZPB52cjs.applyFarmCspHashesToHtml.call(void 0, route.contents, config.security);
|
|
12510
12830
|
if (!staticCsp) return;
|
|
12511
12831
|
route.contents = staticCsp.html;
|
|
@@ -12538,7 +12858,24 @@ function toFarmNodeResponse(request, response) {
|
|
|
12538
12858
|
});
|
|
12539
12859
|
await nitroBuilder.prepare(nitroInstance);
|
|
12540
12860
|
await nitroBuilder.copyPublicAssets(nitroInstance);
|
|
12541
|
-
if (
|
|
12861
|
+
if (prerenderReusesPrebuiltSSR && !canReusePrebuiltSSR) {
|
|
12862
|
+
nitroInstance.hooks.hook("prerender:config", (prerendererConfig) => {
|
|
12863
|
+
const configuredPlugins = _optionalChain([prerendererConfig, 'access', _307 => _307.rollupConfig, 'optionalAccess', _308 => _308.plugins]);
|
|
12864
|
+
const plugins = Array.isArray(configuredPlugins) ? configuredPlugins : configuredPlugins ? [configuredPlugins] : [];
|
|
12865
|
+
prerendererConfig.rollupConfig = {
|
|
12866
|
+
...prerendererConfig.rollupConfig,
|
|
12867
|
+
plugins: [...plugins.filter((plugin) => plugin !== ssrRollupPlugin), prebuiltSSRPlugin]
|
|
12868
|
+
};
|
|
12869
|
+
prerendererConfig.output = {
|
|
12870
|
+
...prerendererConfig.output,
|
|
12871
|
+
serverDir: _path2.default.join(
|
|
12872
|
+
_nullishCoalesce(prerendererConfig.buildDir, () => ( _path2.default.join(root, distDir, ".nitro"))),
|
|
12873
|
+
"prerender"
|
|
12874
|
+
)
|
|
12875
|
+
};
|
|
12876
|
+
});
|
|
12877
|
+
}
|
|
12878
|
+
if (prerenderReusesPrebuiltSSR) {
|
|
12542
12879
|
nitroInstance.hooks.hook("prerender:init", (prerenderer) => {
|
|
12543
12880
|
if (useRolldownBuilder) {
|
|
12544
12881
|
prerenderer.hooks.hook("rollup:before", (_nitro, rollupConfig) => {
|
|
@@ -12548,7 +12885,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
12548
12885
|
});
|
|
12549
12886
|
}
|
|
12550
12887
|
prerenderer.hooks.hook("compiled", async () => {
|
|
12551
|
-
const prerenderServerDir =
|
|
12888
|
+
const prerenderServerDir = prerenderer.options.output.serverDir;
|
|
12552
12889
|
await copyPrebuiltSSRBundle(
|
|
12553
12890
|
ssrBundle,
|
|
12554
12891
|
_path2.default.join(prerenderServerDir, FARM_SSR_OUTPUT_DIR),
|
|
@@ -12580,13 +12917,13 @@ function toFarmNodeResponse(request, response) {
|
|
|
12580
12917
|
}
|
|
12581
12918
|
if (prerenderRoutes.length > 0) {
|
|
12582
12919
|
_chunkQMNWKQL4cjs.logger.info(`\u{1F4C4} Pre-rendering ${prerenderRoutes.length} SSG page(s)`);
|
|
12583
|
-
const previousPrerender = process.env[
|
|
12584
|
-
process.env[
|
|
12920
|
+
const previousPrerender = process.env[_chunkZ3PW3DIRcjs.FARM_PRERENDER_ENV];
|
|
12921
|
+
process.env[_chunkZ3PW3DIRcjs.FARM_PRERENDER_ENV] = "1";
|
|
12585
12922
|
try {
|
|
12586
12923
|
await nitroBuilder.prerender(nitroInstance);
|
|
12587
12924
|
} finally {
|
|
12588
|
-
if (previousPrerender === void 0) delete process.env[
|
|
12589
|
-
else process.env[
|
|
12925
|
+
if (previousPrerender === void 0) delete process.env[_chunkZ3PW3DIRcjs.FARM_PRERENDER_ENV];
|
|
12926
|
+
else process.env[_chunkZ3PW3DIRcjs.FARM_PRERENDER_ENV] = previousPrerender;
|
|
12590
12927
|
}
|
|
12591
12928
|
}
|
|
12592
12929
|
const sharpRuntimeStagePromise = imageRuntime === "node" ? stageSharpRuntime(config, root, distDir, fs4, preset) : Promise.resolve(null);
|
|
@@ -12665,7 +13002,12 @@ function toFarmNodeResponse(request, response) {
|
|
|
12665
13002
|
config,
|
|
12666
13003
|
farmWorkflows,
|
|
12667
13004
|
routeRuntimeManifest,
|
|
12668
|
-
farmCron.provider === "host" ? farmCron.jobs : []
|
|
13005
|
+
farmCron.provider === "host" ? farmCron.jobs : [],
|
|
13006
|
+
{
|
|
13007
|
+
buildDir: _path2.default.join(root, distDir),
|
|
13008
|
+
middlewareRoutes: edgeMiddlewareRoutes,
|
|
13009
|
+
guardedPages: edgeGuardedPrerenderRoutes
|
|
13010
|
+
}
|
|
12669
13011
|
);
|
|
12670
13012
|
}
|
|
12671
13013
|
_chunkQMNWKQL4cjs.logger.success(`\u2705 Nitro build completed with preset: ${preset}`);
|
|
@@ -12683,19 +13025,6 @@ function resolveFarmNitroOutputConfig(preset, outputDir) {
|
|
|
12683
13025
|
} : {}
|
|
12684
13026
|
};
|
|
12685
13027
|
}
|
|
12686
|
-
var CLOUDFLARE_POPULATE_PROCESS_ENV_FLAG = "nodejs_compat_populate_process_env";
|
|
12687
|
-
var CLOUDFLARE_DO_NOT_POPULATE_PROCESS_ENV_FLAG = "nodejs_compat_do_not_populate_process_env";
|
|
12688
|
-
var CLOUDFLARE_POPULATE_PROCESS_ENV_DATE = "2025-04-01";
|
|
12689
|
-
function resolveCloudflareProcessEnvFlags(wrangler) {
|
|
12690
|
-
const date = wrangler.compatibility_date;
|
|
12691
|
-
const flags = wrangler.compatibility_flags;
|
|
12692
|
-
if (typeof date !== "string" || date >= CLOUDFLARE_POPULATE_PROCESS_ENV_DATE) return void 0;
|
|
12693
|
-
if (!Array.isArray(flags) || !flags.includes("nodejs_compat")) return void 0;
|
|
12694
|
-
if (flags.includes(CLOUDFLARE_POPULATE_PROCESS_ENV_FLAG) || flags.includes(CLOUDFLARE_DO_NOT_POPULATE_PROCESS_ENV_FLAG)) {
|
|
12695
|
-
return void 0;
|
|
12696
|
-
}
|
|
12697
|
-
return [...flags, CLOUDFLARE_POPULATE_PROCESS_ENV_FLAG];
|
|
12698
|
-
}
|
|
12699
13028
|
async function populateCloudflareProcessEnv(serverDir, fs4) {
|
|
12700
13029
|
const wranglerPath = _path2.default.join(serverDir, "wrangler.json");
|
|
12701
13030
|
let source;
|
|
@@ -12706,7 +13035,7 @@ async function populateCloudflareProcessEnv(serverDir, fs4) {
|
|
|
12706
13035
|
throw error;
|
|
12707
13036
|
}
|
|
12708
13037
|
const wrangler = JSON.parse(source);
|
|
12709
|
-
const flags = resolveCloudflareProcessEnvFlags(wrangler);
|
|
13038
|
+
const flags = _chunkI7J5RLGOcjs.resolveCloudflareProcessEnvFlags.call(void 0, wrangler);
|
|
12710
13039
|
if (!flags) return;
|
|
12711
13040
|
await fs4.writeFile(
|
|
12712
13041
|
wranglerPath,
|
|
@@ -12736,16 +13065,16 @@ async function copyPrebuiltSSRBundle(ssrBundle, targetDir, minifyOptions, fs4) {
|
|
|
12736
13065
|
}
|
|
12737
13066
|
async function installFarmCompileCacheLauncher(serverDir, fs4) {
|
|
12738
13067
|
const entryPath = _path2.default.join(serverDir, "index.mjs");
|
|
12739
|
-
const serverPath = _path2.default.join(serverDir,
|
|
13068
|
+
const serverPath = _path2.default.join(serverDir, _chunkNG2EZ6QScjs.FARM_SERVER_MODULE_FILE);
|
|
12740
13069
|
const entry = await fs4.readFile(entryPath, "utf8").catch((error) => {
|
|
12741
13070
|
if (error.code === "ENOENT") return null;
|
|
12742
13071
|
throw error;
|
|
12743
13072
|
});
|
|
12744
13073
|
if (entry === null) return false;
|
|
12745
|
-
if (entry.includes(`./${
|
|
13074
|
+
if (entry.includes(`./${_chunkNG2EZ6QScjs.FARM_SERVER_MODULE_FILE}`)) return false;
|
|
12746
13075
|
await fs4.rename(entryPath, serverPath);
|
|
12747
|
-
await fs4.writeFile(entryPath,
|
|
12748
|
-
await fs4.rm(_path2.default.join(serverDir,
|
|
13076
|
+
await fs4.writeFile(entryPath, _chunkNG2EZ6QScjs.createFarmCompileCacheLauncher.call(void 0, _chunkNG2EZ6QScjs.FARM_SERVER_MODULE_FILE));
|
|
13077
|
+
await fs4.rm(_path2.default.join(serverDir, _chunkNG2EZ6QScjs.FARM_COMPILE_CACHE_DIR), { recursive: true, force: true });
|
|
12749
13078
|
return true;
|
|
12750
13079
|
}
|
|
12751
13080
|
async function registerPrebuiltSSRPackageImport(serverDir, ssrEntryFile, fs4) {
|
|
@@ -12769,7 +13098,7 @@ async function moveVercelOutputPath(src, dest, fs4) {
|
|
|
12769
13098
|
await fs4.rename(src, dest);
|
|
12770
13099
|
return;
|
|
12771
13100
|
} catch (error) {
|
|
12772
|
-
const code = _optionalChain([error, 'optionalAccess',
|
|
13101
|
+
const code = _optionalChain([error, 'optionalAccess', _309 => _309.code]);
|
|
12773
13102
|
if (code !== "EPERM" && code !== "EACCES" && code !== "EXDEV" && code !== "ENOTEMPTY") {
|
|
12774
13103
|
throw error;
|
|
12775
13104
|
}
|
|
@@ -12777,7 +13106,7 @@ async function moveVercelOutputPath(src, dest, fs4) {
|
|
|
12777
13106
|
await fs4.cp(src, dest, { recursive: true, force: true });
|
|
12778
13107
|
await fs4.rm(src, { recursive: true, force: true });
|
|
12779
13108
|
}
|
|
12780
|
-
async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflows, routeRuntimeManifest, cronJobs) {
|
|
13109
|
+
async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflows, routeRuntimeManifest, cronJobs, edgeMiddleware) {
|
|
12781
13110
|
const serverDir = _path2.default.join(outputDir, "server");
|
|
12782
13111
|
const functionsDir = _path2.default.join(outputDir, "functions");
|
|
12783
13112
|
const nitroFuncDir = _path2.default.join(functionsDir, "__nitro.func");
|
|
@@ -12795,7 +13124,7 @@ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflo
|
|
|
12795
13124
|
try {
|
|
12796
13125
|
await moveVercelOutputPath(publicDir, staticDir, fs4);
|
|
12797
13126
|
} catch (error) {
|
|
12798
|
-
if (_optionalChain([error, 'optionalAccess',
|
|
13127
|
+
if (_optionalChain([error, 'optionalAccess', _310 => _310.code]) !== "ENOENT") throw error;
|
|
12799
13128
|
}
|
|
12800
13129
|
await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4);
|
|
12801
13130
|
await copyPrismaClientForVercel(root, nitroFuncDir, fs4);
|
|
@@ -12808,11 +13137,26 @@ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflo
|
|
|
12808
13137
|
fs4,
|
|
12809
13138
|
config.basePath
|
|
12810
13139
|
);
|
|
13140
|
+
const edgeMiddlewareRoutes = edgeMiddleware.middlewareRoutes.filter(
|
|
13141
|
+
(route) => edgeMiddleware.guardedPages.some((pathname) => _chunkUPOYKX4Scjs.appMiddlewareMayHandlePath.call(void 0, [route], pathname))
|
|
13142
|
+
);
|
|
13143
|
+
if (edgeMiddlewareRoutes.length > 0) {
|
|
13144
|
+
await writeFarmVercelEdgeMiddlewareFunction({
|
|
13145
|
+
root,
|
|
13146
|
+
outputDir,
|
|
13147
|
+
buildDir: edgeMiddleware.buildDir,
|
|
13148
|
+
config,
|
|
13149
|
+
routes: edgeMiddlewareRoutes,
|
|
13150
|
+
guardedPages: edgeMiddleware.guardedPages,
|
|
13151
|
+
fs: fs4
|
|
13152
|
+
});
|
|
13153
|
+
}
|
|
12811
13154
|
vercelConfig.routes = buildFarmVercelRoutes({
|
|
12812
13155
|
presetRoutes: Array.isArray(vercelConfig.routes) ? vercelConfig.routes : [],
|
|
12813
|
-
runtimeRoutes
|
|
13156
|
+
runtimeRoutes,
|
|
13157
|
+
middlewareRoutes: edgeMiddlewareRoutes.length > 0 ? [createFarmVercelEdgeMiddlewareRoute(edgeMiddleware.guardedPages, config.basePath)] : []
|
|
12814
13158
|
});
|
|
12815
|
-
const vercelConfigWithWorkflowCrons =
|
|
13159
|
+
const vercelConfigWithWorkflowCrons = _chunkFSODPZRTcjs.applyFarmWorkflowVercelCrons.call(void 0,
|
|
12816
13160
|
vercelConfig,
|
|
12817
13161
|
farmWorkflows.workflows
|
|
12818
13162
|
);
|
|
@@ -12821,8 +13165,8 @@ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflo
|
|
|
12821
13165
|
_chunkQMNWKQL4cjs.logger.info("\u2705 Post-processed Vercel output for Build Output API v3");
|
|
12822
13166
|
}
|
|
12823
13167
|
async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4) {
|
|
12824
|
-
if (!_optionalChain([config, 'access',
|
|
12825
|
-
const [mainRoot, ...extraRoots] =
|
|
13168
|
+
if (!_optionalChain([config, 'access', _311 => _311.docs, 'optionalAccess', _312 => _312.enabled])) return;
|
|
13169
|
+
const [mainRoot, ...extraRoots] = _chunkFVYBEMODcjs.getFarmDocsRoots.call(void 0, config.docs);
|
|
12826
13170
|
await copyFarmDocsRootContent(
|
|
12827
13171
|
mainRoot,
|
|
12828
13172
|
root,
|
|
@@ -12843,10 +13187,10 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4) {
|
|
|
12843
13187
|
async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs4) {
|
|
12844
13188
|
const docsContentDir = resolveBuildDocsContentDir(docs, root, srcDir);
|
|
12845
13189
|
if (!docsContentDir) return;
|
|
12846
|
-
const lastModifiedManifest =
|
|
13190
|
+
const lastModifiedManifest = _chunkFVYBEMODcjs.createFarmDocsLastModifiedManifest.call(void 0, docsContentDir, {
|
|
12847
13191
|
fallback: "now"
|
|
12848
13192
|
});
|
|
12849
|
-
const undatedPages = _nullishCoalesce(_optionalChain([lastModifiedManifest, 'access',
|
|
13193
|
+
const undatedPages = _nullishCoalesce(_optionalChain([lastModifiedManifest, 'access', _313 => _313.unknown, 'optionalAccess', _314 => _314.length]), () => ( 0));
|
|
12850
13194
|
if (undatedPages > 0) {
|
|
12851
13195
|
_chunkQMNWKQL4cjs.logger.warn(
|
|
12852
13196
|
`${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.`
|
|
@@ -12859,7 +13203,7 @@ async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs
|
|
|
12859
13203
|
force: true
|
|
12860
13204
|
});
|
|
12861
13205
|
await fs4.writeFile(
|
|
12862
|
-
_path2.default.join(bundledContentDir,
|
|
13206
|
+
_path2.default.join(bundledContentDir, _chunkFVYBEMODcjs.FARM_DOCS_LAST_MODIFIED_MANIFEST),
|
|
12863
13207
|
`${JSON.stringify(lastModifiedManifest, null, 2)}
|
|
12864
13208
|
`
|
|
12865
13209
|
);
|
|
@@ -12930,7 +13274,7 @@ async function stageSharpRuntime(config, root, distDir, fs4, preset) {
|
|
|
12930
13274
|
try {
|
|
12931
13275
|
await copyPackage("sharp", sharpRequire);
|
|
12932
13276
|
if (!copiedPackages.has("sharp")) {
|
|
12933
|
-
throw new Error(`Farm image optimization requires sharp. ${
|
|
13277
|
+
throw new Error(`Farm image optimization requires sharp. ${_chunkF36LS2C7cjs.SHARP_INSTALL_HINT}`);
|
|
12934
13278
|
}
|
|
12935
13279
|
} catch (error) {
|
|
12936
13280
|
await fs4.rm(stageDir, { recursive: true, force: true });
|
|
@@ -13080,14 +13424,23 @@ function resolvePackageJson(parentRequire, packageName) {
|
|
|
13080
13424
|
}
|
|
13081
13425
|
return null;
|
|
13082
13426
|
}
|
|
13083
|
-
async function
|
|
13084
|
-
|
|
13085
|
-
|
|
13086
|
-
|
|
13087
|
-
|
|
13088
|
-
|
|
13089
|
-
|
|
13427
|
+
async function resolveProjectInstalledPackageDir(root, packageName, fs4) {
|
|
13428
|
+
let directory = _path2.default.resolve(root);
|
|
13429
|
+
while (true) {
|
|
13430
|
+
const candidate = _path2.default.join(directory, "node_modules", ...packageName.split("/"));
|
|
13431
|
+
try {
|
|
13432
|
+
const packageDir = await fs4.realpath(candidate);
|
|
13433
|
+
if ((await fs4.stat(_path2.default.join(packageDir, "package.json"))).isFile()) return packageDir;
|
|
13434
|
+
} catch (e40) {
|
|
13435
|
+
}
|
|
13436
|
+
const parent = _path2.default.dirname(directory);
|
|
13437
|
+
if (parent === directory) return null;
|
|
13438
|
+
directory = parent;
|
|
13090
13439
|
}
|
|
13440
|
+
}
|
|
13441
|
+
async function copyPrismaClientForVercel(root, nitroFuncDir, fs4) {
|
|
13442
|
+
const prismaClientDir = await resolveProjectInstalledPackageDir(root, "@prisma/client", fs4);
|
|
13443
|
+
if (!prismaClientDir) return;
|
|
13091
13444
|
const generatedClientDir = _path2.default.join(prismaClientDir, "..", "..", ".prisma", "client");
|
|
13092
13445
|
try {
|
|
13093
13446
|
await fs4.access(generatedClientDir);
|
|
@@ -13150,8 +13503,8 @@ async function createFarmProjectModuleSsrEnvironment() {
|
|
|
13150
13503
|
|
|
13151
13504
|
// src/build/index.ts
|
|
13152
13505
|
async function build(config, options = {}) {
|
|
13153
|
-
return
|
|
13154
|
-
() =>
|
|
13506
|
+
return _chunkNG2EZ6QScjs.withProductionNodeEnv.call(void 0,
|
|
13507
|
+
() => _chunkMZ4CRSY7cjs.withPackageClientBoundaryCache.call(void 0, () => buildWithProductionNodeEnv(config, options))
|
|
13155
13508
|
);
|
|
13156
13509
|
}
|
|
13157
13510
|
function createBuildTargetBaseline(config) {
|
|
@@ -13162,7 +13515,7 @@ function createBuildTargetBaseline(config) {
|
|
|
13162
13515
|
preset,
|
|
13163
13516
|
distDir,
|
|
13164
13517
|
outputDir,
|
|
13165
|
-
outputWasDerived: outputDir ===
|
|
13518
|
+
outputWasDerived: outputDir === _chunk7LK5CTUMcjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
|
|
13166
13519
|
};
|
|
13167
13520
|
}
|
|
13168
13521
|
function resolveBuildTargets(config, options, baseline) {
|
|
@@ -13171,8 +13524,8 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
13171
13524
|
const distDir = config.distDir || ".farm";
|
|
13172
13525
|
const outputWasReplaced = config.deploy.outputDir !== baseline.outputDir;
|
|
13173
13526
|
const shouldRefreshDerivedOutput = baseline.outputWasDerived && !outputWasReplaced && (preset !== baseline.preset || distDir !== baseline.distDir);
|
|
13174
|
-
const deployTarget = preset === config.deploy.preset ? config.deploy.target :
|
|
13175
|
-
const outputDir = shouldRefreshDerivedOutput ?
|
|
13527
|
+
const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunk7LK5CTUMcjs.getDeployTargetForPreset.call(void 0, preset);
|
|
13528
|
+
const outputDir = shouldRefreshDerivedOutput ? _chunk7LK5CTUMcjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
|
|
13176
13529
|
return {
|
|
13177
13530
|
root,
|
|
13178
13531
|
preset,
|
|
@@ -13180,7 +13533,7 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
13180
13533
|
distDir,
|
|
13181
13534
|
deployTarget,
|
|
13182
13535
|
outputDir,
|
|
13183
|
-
deployOutputDir:
|
|
13536
|
+
deployOutputDir: _chunk7LK5CTUMcjs.resolveDeployOutputPath.call(void 0, root, outputDir)
|
|
13184
13537
|
};
|
|
13185
13538
|
}
|
|
13186
13539
|
async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
@@ -13217,15 +13570,15 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
13217
13570
|
};
|
|
13218
13571
|
config = {
|
|
13219
13572
|
...config,
|
|
13220
|
-
images:
|
|
13573
|
+
images: _chunkF36LS2C7cjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
|
|
13221
13574
|
root: targets.root,
|
|
13222
13575
|
preset: targets.preset
|
|
13223
13576
|
})
|
|
13224
13577
|
};
|
|
13225
|
-
if (_optionalChain([config, 'access',
|
|
13578
|
+
if (_optionalChain([config, 'access', _315 => _315.docs, 'optionalAccess', _316 => _316.enabled])) await _chunkV3UOEWCBcjs.loadFarmDocsEngine.call(void 0, );
|
|
13226
13579
|
pluginManager.updateContext({ config });
|
|
13227
13580
|
const { root, preset, srcDir, distDir, deployOutputDir } = targets;
|
|
13228
|
-
|
|
13581
|
+
_chunkMZ4CRSY7cjs.usePackageClientBoundaryCacheFile.call(void 0, _chunkMZ4CRSY7cjs.resolvePackageClientBoundaryCacheFile.call(void 0, root, distDir));
|
|
13229
13582
|
_chunkQMNWKQL4cjs.logger.info(`\u{1F69C} Building Farm.js application with preset: ${preset}...`);
|
|
13230
13583
|
await pluginManager.setupPlugins();
|
|
13231
13584
|
await pluginManager.runHookParallel("beforeBundle", {
|
|
@@ -13237,8 +13590,8 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
13237
13590
|
});
|
|
13238
13591
|
_chunkQMNWKQL4cjs.logger.info("\u{1F50D} Discovering routes and API endpoints...");
|
|
13239
13592
|
const productionViteResult = productionViteResultPromise ? (await productionViteResultPromise)[0] : void 0;
|
|
13240
|
-
if (_optionalChain([productionViteResult, 'optionalAccess',
|
|
13241
|
-
const productionVite = _optionalChain([productionViteResult, 'optionalAccess',
|
|
13593
|
+
if (_optionalChain([productionViteResult, 'optionalAccess', _317 => _317.status]) === "rejected") throw productionViteResult.reason;
|
|
13594
|
+
const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _318 => _318.value]);
|
|
13242
13595
|
const createViteServer = productionVite ? productionVite.createServer : (await import("vite")).createServer;
|
|
13243
13596
|
projectModuleServer = await createProjectModuleServer(
|
|
13244
13597
|
createViteServer,
|
|
@@ -13246,18 +13599,18 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
13246
13599
|
root,
|
|
13247
13600
|
rendererBuild.signal
|
|
13248
13601
|
);
|
|
13249
|
-
const farmApp =
|
|
13602
|
+
const farmApp = _chunkF36LS2C7cjs.createFarmApp.call(void 0, config, projectModuleServer);
|
|
13250
13603
|
await farmApp.initialize();
|
|
13251
13604
|
const routeManager = farmApp.getRouteManager();
|
|
13252
13605
|
const serverRenderer = farmApp.getServerRenderer();
|
|
13253
|
-
const typeArtifacts =
|
|
13606
|
+
const typeArtifacts = _chunkQOGIZKSOcjs.generateFarmTypeArtifacts.call(void 0, {
|
|
13254
13607
|
root,
|
|
13255
13608
|
srcDir,
|
|
13256
13609
|
layers: config.layers,
|
|
13257
13610
|
plugins: config.plugins,
|
|
13258
13611
|
extraRoutes: [
|
|
13259
|
-
..._optionalChain([config, 'access',
|
|
13260
|
-
...
|
|
13612
|
+
..._optionalChain([config, 'access', _319 => _319.openapi, 'optionalAccess', _320 => _320.enabled]) && config.openapi.route ? [config.openapi.route] : [],
|
|
13613
|
+
..._chunkFVYBEMODcjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
|
|
13261
13614
|
],
|
|
13262
13615
|
suppressLintOnLink: config.suppressLintOnLink,
|
|
13263
13616
|
componentExtensions: config.renderer.componentExtensions,
|
|
@@ -13267,7 +13620,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
13267
13620
|
_chunkQMNWKQL4cjs.logger.warn(`Route type generation failed (farm.d.ts may be stale): ${message}`);
|
|
13268
13621
|
});
|
|
13269
13622
|
const apiRouteManager = new (0, _chunkOFBLGH6Vcjs.APIRouteManager)(
|
|
13270
|
-
|
|
13623
|
+
_chunkMTBDJ326cjs.getFarmAppDirectories.call(void 0, config),
|
|
13271
13624
|
projectModuleServer,
|
|
13272
13625
|
{
|
|
13273
13626
|
throwOnLoadError: true,
|
|
@@ -13341,7 +13694,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
13341
13694
|
throw error;
|
|
13342
13695
|
} finally {
|
|
13343
13696
|
try {
|
|
13344
|
-
await _optionalChain([projectModuleServer, 'optionalAccess',
|
|
13697
|
+
await _optionalChain([projectModuleServer, 'optionalAccess', _321 => _321.close, 'call', _322 => _322()]);
|
|
13345
13698
|
} finally {
|
|
13346
13699
|
rendererBuild.abort();
|
|
13347
13700
|
}
|
|
@@ -13353,7 +13706,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
13353
13706
|
ssr: true,
|
|
13354
13707
|
buildLifetime
|
|
13355
13708
|
});
|
|
13356
|
-
const viteConfig =
|
|
13709
|
+
const viteConfig = _chunkF36LS2C7cjs.mergeFarmViteConfig.call(void 0,
|
|
13357
13710
|
{
|
|
13358
13711
|
root,
|
|
13359
13712
|
appType: "custom",
|
|
@@ -13365,22 +13718,24 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
13365
13718
|
},
|
|
13366
13719
|
plugins: [
|
|
13367
13720
|
...rendererVitePlugins,
|
|
13368
|
-
|
|
13721
|
+
_chunkF36LS2C7cjs.farmFontImportsPlugin.call(void 0, {
|
|
13369
13722
|
root,
|
|
13370
13723
|
basePath: config.basePath,
|
|
13371
13724
|
publicDir: config.publicDir
|
|
13372
13725
|
}),
|
|
13373
|
-
|
|
13726
|
+
_chunkMZ4CRSY7cjs.farmEnvironmentFunctionsPlugin.call(void 0, ),
|
|
13374
13727
|
// Route modules load here at build time (rendering config, prerendering): `server-only`
|
|
13375
|
-
// resolves as it does in the server build.
|
|
13376
|
-
|
|
13728
|
+
// resolves as it does in the server build. Module-entry packages load pre-bundled, as in
|
|
13729
|
+
// `farm dev`: unbundled, lucide-react alone is ~1,750 modules through the module runner,
|
|
13730
|
+
// which a docs build waited on after its bundles.
|
|
13731
|
+
farmServerOnlyEntriesPlugin({ prebundleServerPackages: true })
|
|
13377
13732
|
],
|
|
13378
13733
|
server: {
|
|
13379
13734
|
middlewareMode: true,
|
|
13380
13735
|
hmr: false
|
|
13381
13736
|
},
|
|
13382
13737
|
resolve: {
|
|
13383
|
-
alias:
|
|
13738
|
+
alias: _chunkF36LS2C7cjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
13384
13739
|
dedupe: [...config.renderer.dedupe || []]
|
|
13385
13740
|
},
|
|
13386
13741
|
optimizeDeps: {
|
|
@@ -13393,6 +13748,12 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
13393
13748
|
return createViteServer({
|
|
13394
13749
|
...viteConfig,
|
|
13395
13750
|
root,
|
|
13751
|
+
// Vite keys its pre-bundled dependencies on the config, mode included, so this server and
|
|
13752
|
+
// `farm dev` sharing one cache would each rebuild it after the other ran.
|
|
13753
|
+
cacheDir: _path2.default.join(
|
|
13754
|
+
_path2.default.resolve(root, _nullishCoalesce(viteConfig.cacheDir, () => ( _path2.default.join("node_modules", ".vite")))),
|
|
13755
|
+
"farm-build"
|
|
13756
|
+
),
|
|
13396
13757
|
configFile: false,
|
|
13397
13758
|
appType: "custom",
|
|
13398
13759
|
mode: "production",
|
|
@@ -13413,10 +13774,10 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
13413
13774
|
noDiscovery: true
|
|
13414
13775
|
},
|
|
13415
13776
|
// An app or plugin that brings its own SSR environment keeps it.
|
|
13416
|
-
environments: _optionalChain([viteConfig, 'access',
|
|
13777
|
+
environments: _optionalChain([viteConfig, 'access', _323 => _323.environments, 'optionalAccess', _324 => _324.ssr, 'optionalAccess', _325 => _325.dev, 'optionalAccess', _326 => _326.createEnvironment]) ? viteConfig.environments : {
|
|
13417
13778
|
...viteConfig.environments,
|
|
13418
13779
|
ssr: {
|
|
13419
|
-
..._optionalChain([viteConfig, 'access',
|
|
13780
|
+
..._optionalChain([viteConfig, 'access', _327 => _327.environments, 'optionalAccess', _328 => _328.ssr]),
|
|
13420
13781
|
...await createFarmProjectModuleSsrEnvironment()
|
|
13421
13782
|
}
|
|
13422
13783
|
}
|
|
@@ -13444,7 +13805,7 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
|
|
|
13444
13805
|
farmI18nClientBridgePlugin(),
|
|
13445
13806
|
farmServerOnlyEntriesPlugin(),
|
|
13446
13807
|
farmPlugin(config, pluginManager),
|
|
13447
|
-
|
|
13808
|
+
_chunkMZ4CRSY7cjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
|
|
13448
13809
|
],
|
|
13449
13810
|
mode: "production"
|
|
13450
13811
|
});
|
|
@@ -13472,12 +13833,12 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
|
|
|
13472
13833
|
define: {
|
|
13473
13834
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
13474
13835
|
__FARM_ENV__: JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, config.env)),
|
|
13475
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
13836
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _329 => _329.env, 'optionalAccess', _330 => _330.public]) || {})
|
|
13476
13837
|
},
|
|
13477
13838
|
plugins: [
|
|
13478
13839
|
farmI18nClientBridgePlugin(),
|
|
13479
13840
|
farmPlugin(config, pluginManager),
|
|
13480
|
-
|
|
13841
|
+
_chunkMZ4CRSY7cjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
|
|
13481
13842
|
],
|
|
13482
13843
|
mode: "production"
|
|
13483
13844
|
});
|
|
@@ -13492,7 +13853,7 @@ function resolveLegacyPageEntry(config, root, srcDir) {
|
|
|
13492
13853
|
}
|
|
13493
13854
|
async function buildNitro(config, routeManager, apiRouteManager, serverRenderer, preset, root, distDir, pluginManager) {
|
|
13494
13855
|
const [{ createNitroConfig }, { createNitro, build: nitroBuild }] = await Promise.all([
|
|
13495
|
-
import("./nitro-
|
|
13856
|
+
import("./nitro-Y3LGITW3.cjs"),
|
|
13496
13857
|
import("nitro/builder")
|
|
13497
13858
|
]);
|
|
13498
13859
|
let nitroConfig = await createNitroConfig(
|
|
@@ -13505,7 +13866,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
13505
13866
|
if (pluginManager) {
|
|
13506
13867
|
nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
|
|
13507
13868
|
}
|
|
13508
|
-
const outputDir =
|
|
13869
|
+
const outputDir = _chunk7LK5CTUMcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
13509
13870
|
const serverOutputDir = _path2.default.join(outputDir, "server");
|
|
13510
13871
|
const publicOutputDir = _path2.default.join(outputDir, "public");
|
|
13511
13872
|
const { mkdir, cp } = await import("fs/promises");
|
|
@@ -13576,7 +13937,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
13576
13937
|
root,
|
|
13577
13938
|
preset,
|
|
13578
13939
|
distDir,
|
|
13579
|
-
outputDir:
|
|
13940
|
+
outputDir: _chunk7LK5CTUMcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
|
|
13580
13941
|
});
|
|
13581
13942
|
}
|
|
13582
13943
|
}
|