@farm.js/core 0.1.82 → 0.1.84
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-C2Su3x4D.d.ts → agent-mcp.d-7uKdOttc.d.ts} +1 -1
- package/dist/{agent-mcp.d-Yak-LqRd.d.mts → agent-mcp.d-LChlR2au.d.mts} +1 -1
- package/dist/agent-runtime.d.mts +2 -1
- package/dist/agent-runtime.d.ts +2 -1
- package/dist/{analyzer-RPU2KG4J.mjs → analyzer-7RNO3XKC.mjs} +2 -2
- package/dist/analyzer-PFKA5NI6.cjs +17 -0
- package/dist/api/node.d.mts +4 -3
- package/dist/api/node.d.ts +4 -3
- package/dist/api/route-manager.d.mts +4 -3
- package/dist/api/route-manager.d.ts +4 -3
- package/dist/api/runtime.d.mts +3 -2
- package/dist/api/runtime.d.ts +3 -2
- package/dist/api.d.mts +5 -4
- package/dist/api.d.ts +5 -4
- package/dist/{app-manifest.d-DZyXaICz.d.ts → app-manifest.d-CRp21oAz.d.ts} +1 -1
- package/dist/{app-manifest.d-BcyOFMrg.d.mts → app-manifest.d-QMdmqqCr.d.mts} +1 -1
- package/dist/app-markdown.d.mts +3 -2
- package/dist/app-markdown.d.ts +3 -2
- package/dist/{app.d-CIoXsAbN.d.ts → app.d-CVPu_hoD.d.ts} +34 -4
- package/dist/{app.d-C0ePpuaG.d.mts → app.d-eSm7jgoc.d.mts} +34 -4
- package/dist/{chunk-B2PGVHBG.cjs → chunk-22BTYPIX.cjs} +4 -4
- package/dist/{chunk-BCTHOQPP.cjs → chunk-3OKSEJ33.cjs} +98 -10
- package/dist/{chunk-QSMUMK7Y.mjs → chunk-3WM7VBGW.mjs} +2 -2
- package/dist/{chunk-XMHERKSE.mjs → chunk-42IBGQTN.mjs} +5 -12
- package/dist/{chunk-RMPUEH5T.cjs → chunk-57EEWWUS.cjs} +2 -2
- package/dist/{chunk-Q2VOT3K2.cjs → chunk-5I4ZGKP2.cjs} +395 -333
- package/dist/{chunk-TPA2PV5J.mjs → chunk-5V6HSJFG.mjs} +24 -1
- package/dist/{chunk-RMLR5RMH.mjs → chunk-BCCCPFHQ.mjs} +92 -4
- package/dist/{chunk-LM2ZDNDD.cjs → chunk-BOEDYXAX.cjs} +30 -25
- package/dist/{chunk-NRCKBDYP.mjs → chunk-BRDGINBB.mjs} +153 -47
- package/dist/chunk-BUQR7KKO.mjs +17 -0
- package/dist/{chunk-63ZE6B6M.mjs → chunk-BZY3SRRD.mjs} +1 -1
- package/dist/{chunk-724WT3NI.mjs → chunk-CRE642TW.mjs} +1 -1
- package/dist/{chunk-JK26IMT7.cjs → chunk-CVZY4TLW.cjs} +1 -1
- package/dist/{chunk-ZIZRIZLP.mjs → chunk-CWUQBECF.mjs} +3 -1
- package/dist/{chunk-DAXU2NBE.mjs → chunk-DFDQGHPU.mjs} +104 -42
- package/dist/{chunk-AIPZDBP6.cjs → chunk-DSWSDDP2.cjs} +844 -553
- package/dist/{chunk-DRO3NXA3.cjs → chunk-EBSL5TW7.cjs} +203 -93
- package/dist/{chunk-CJDBTTLB.mjs → chunk-EDBIBO67.mjs} +18 -13
- package/dist/{chunk-BBVLOEND.cjs → chunk-F7JVO3OZ.cjs} +4 -4
- package/dist/chunk-FZ7OUN5M.cjs +30 -0
- package/dist/chunk-GLNVLCUH.cjs +426 -0
- package/dist/{chunk-5MMKNW7Q.cjs → chunk-H7REG7OX.cjs} +15 -8
- package/dist/{chunk-N2EFMN2K.cjs → chunk-HOQ2MYBJ.cjs} +10 -10
- package/dist/{chunk-OP5VI4TP.mjs → chunk-I5CVJ24H.mjs} +1 -1
- package/dist/{chunk-I4DR3HCH.mjs → chunk-INU4K4U4.mjs} +5 -5
- package/dist/{chunk-4X7LSGM6.mjs → chunk-IRJSZAJB.mjs} +1 -1
- package/dist/{chunk-EX6ZSN5P.cjs → chunk-IZYFP7IN.cjs} +17 -24
- package/dist/chunk-J6RFB324.cjs +17 -0
- package/dist/{chunk-47I2MYIR.mjs → chunk-KXVMWLTC.mjs} +484 -193
- package/dist/{chunk-UVV3I5QA.cjs → chunk-L2GUEYHR.cjs} +29 -6
- package/dist/{chunk-VMBIKDKW.cjs → chunk-L3BSHASB.cjs} +6 -4
- package/dist/chunk-L5HDCDFT.mjs +426 -0
- package/dist/{chunk-GXLNARPO.mjs → chunk-M5XU22PQ.mjs} +1 -1
- package/dist/chunk-M6AJZ4XR.mjs +30 -0
- package/dist/chunk-MAPHNGTF.cjs +98 -0
- package/dist/{chunk-RE5E2G5S.cjs → chunk-MNUYXZV7.cjs} +2 -18
- package/dist/{chunk-C3VCYOU4.mjs → chunk-MUUDHWQZ.mjs} +1 -1
- package/dist/{chunk-YSU3WCW6.mjs → chunk-MYSH5Y4E.mjs} +1 -1
- package/dist/{chunk-OMB7UGVW.mjs → chunk-NLHSKKTT.mjs} +14 -9
- package/dist/{chunk-ARORZ3MH.cjs → chunk-OFVBMS6I.cjs} +439 -333
- package/dist/{chunk-5MUFW5UU.cjs → chunk-OP7BIEUW.cjs} +2 -2
- package/dist/{chunk-I4WZRG73.mjs → chunk-RB5IGN3N.mjs} +13 -6
- package/dist/chunk-RJBUI5AN.mjs +18 -0
- package/dist/chunk-RQ6XX5IN.mjs +98 -0
- package/dist/{chunk-EJCVG25Z.mjs → chunk-S3R4JDRO.mjs} +17 -9
- package/dist/{chunk-WFVSAT7Y.cjs → chunk-T7HGXF7D.cjs} +3 -3
- package/dist/{chunk-HHQEKLZL.cjs → chunk-USMRAC72.cjs} +36 -31
- package/dist/{chunk-SM2SYWAR.cjs → chunk-XJDB564A.cjs} +18 -10
- package/dist/{chunk-EL2Z6YFZ.mjs → chunk-XLULEFRW.mjs} +180 -70
- package/dist/{chunk-6BPFIYGY.cjs → chunk-YU6VL7H5.cjs} +3 -3
- package/dist/{chunk-CD5Z7RR5.cjs → chunk-Z37PDUJR.cjs} +4 -4
- package/dist/{cli-runtime.d-Hnvvadz7.d.mts → cli-runtime.d-C7aMfoTq.d.mts} +8 -6
- package/dist/{cli-runtime.d-I0MphTbc.d.ts → cli-runtime.d-DaElKjaL.d.ts} +8 -6
- package/dist/{client-component.d-DapRqtSC.d.mts → client-component.d-DLMCzmUx.d.mts} +1 -1
- package/dist/{client-component.d-5QEvtJsg.d.ts → client-component.d-DLknFP8l.d.ts} +1 -1
- package/dist/{client-plugins.d-DcmDzcSC.d.ts → client-plugins.d-BVXjyIkY.d.ts} +14 -0
- package/dist/{client-plugins.d-C1WM3ieD.d.mts → client-plugins.d-BwKwuO_0.d.mts} +14 -0
- package/dist/client-plugins.d.mts +2 -1
- package/dist/client-plugins.d.ts +2 -1
- package/dist/client.cjs +4 -3
- package/dist/client.d.mts +10 -9
- package/dist/client.d.ts +10 -9
- package/dist/client.mjs +3 -2
- package/dist/config.d.mts +2 -1
- package/dist/config.d.ts +2 -1
- package/dist/desktop.d.mts +3 -2
- package/dist/desktop.d.ts +3 -2
- package/dist/{devtools-5B7NZE6F.cjs → devtools-4SVIRV4P.cjs} +7 -7
- package/dist/{devtools-C5GXZZ7E.mjs → devtools-MWQA5LVN.mjs} +5 -5
- package/dist/docs.cjs +10 -9
- package/dist/docs.d.mts +15 -6
- package/dist/docs.d.ts +15 -6
- package/dist/docs.mjs +9 -8
- package/dist/environment/vite.cjs +5 -5
- package/dist/environment/vite.d.mts +1 -0
- package/dist/environment/vite.d.ts +1 -0
- package/dist/environment/vite.mjs +4 -4
- package/dist/{generate-route-types.d-CaGMIaNI.d.mts → generate-route-types.d-BFOMM8Ef.d.mts} +3 -0
- package/dist/{generate-route-types.d-B76M5R11.d.ts → generate-route-types.d-C2m8myHb.d.ts} +3 -0
- package/dist/{handler.d-B8bPCBzl.d.mts → handler.d-BKTWzzNA.d.mts} +1 -1
- package/dist/{handler.d-Cliwo6Nu.d.ts → handler.d-Dzpyg3-N.d.ts} +1 -1
- package/dist/{headers.d-CVwSpSGX.d.mts → headers.d-5opjyhXw.d.mts} +1 -1
- package/dist/{headers.d-C_btqjV6.d.ts → headers.d-PZyXcDAH.d.ts} +1 -1
- package/dist/index.cjs +32 -29
- package/dist/{index.d-DFuMZk9-.d.mts → index.d-C0Mie66f.d.mts} +1 -1
- package/dist/{index.d-hOEbMcLk.d.ts → index.d-DV2q-0mE.d.ts} +1 -1
- package/dist/index.d.mts +26 -25
- package/dist/index.d.ts +26 -25
- package/dist/index.mjs +32 -29
- package/dist/integrations/orm.d.mts +2 -1
- package/dist/integrations/orm.d.ts +2 -1
- package/dist/integrations.d.mts +2 -1
- package/dist/integrations.d.ts +2 -1
- package/dist/internal/app-markdown-runtime.d.mts +3 -2
- package/dist/internal/app-markdown-runtime.d.ts +3 -2
- package/dist/internal/build-runtime.cjs +28 -27
- package/dist/internal/build-runtime.d.mts +5 -4
- package/dist/internal/build-runtime.d.ts +5 -4
- package/dist/internal/build-runtime.mjs +27 -26
- package/dist/internal/cli-runtime.cjs +9 -9
- package/dist/internal/cli-runtime.d.mts +8 -7
- package/dist/internal/cli-runtime.d.ts +8 -7
- package/dist/internal/cli-runtime.mjs +8 -8
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/client-runtime.d.mts +8 -42
- package/dist/internal/client-runtime.d.ts +8 -42
- package/dist/internal/compression-runtime.d.mts +2 -1
- package/dist/internal/compression-runtime.d.ts +2 -1
- package/dist/internal/config-runtime.cjs +7 -7
- package/dist/internal/config-runtime.d.mts +6 -5
- package/dist/internal/config-runtime.d.ts +6 -5
- package/dist/internal/config-runtime.mjs +6 -6
- package/dist/internal/infra-analytics-runtime.cjs +6 -6
- package/dist/internal/infra-analytics-runtime.mjs +4 -4
- package/dist/internal/islands-action-client.cjs +18 -0
- package/dist/internal/islands-action-client.d.mts +18 -0
- package/dist/internal/islands-action-client.d.ts +18 -0
- package/dist/internal/islands-action-client.mjs +18 -0
- package/dist/internal/islands-runtime.cjs +3 -8
- package/dist/internal/islands-runtime.mjs +4 -9
- package/dist/internal/islx-actions-client.cjs +4 -3
- package/dist/internal/islx-actions-client.mjs +3 -2
- package/dist/internal/islx-actions-server.d.mts +0 -2
- package/dist/internal/islx-actions-server.d.ts +0 -2
- package/dist/internal/islx-client.cjs +13 -1
- package/dist/internal/islx-client.d.mts +11 -0
- package/dist/internal/islx-client.d.ts +11 -0
- package/dist/internal/islx-client.mjs +14 -0
- package/dist/internal/metadata-image-runtime.d.mts +1 -0
- package/dist/internal/metadata-image-runtime.d.ts +1 -0
- package/dist/internal/native-server-fns.cjs +4 -4
- package/dist/internal/native-server-fns.mjs +3 -3
- package/dist/internal/product-telemetry-runtime.cjs +3 -3
- package/dist/internal/product-telemetry-runtime.mjs +2 -2
- package/dist/internal/production-runtime.cjs +13 -13
- package/dist/internal/production-runtime.d.mts +11 -11
- package/dist/internal/production-runtime.d.ts +11 -11
- package/dist/internal/production-runtime.mjs +19 -19
- package/dist/internal/renderer-islands.cjs +47 -0
- package/dist/internal/renderer-islands.d.mts +32 -0
- package/dist/internal/renderer-islands.d.ts +32 -0
- package/dist/internal/renderer-islands.mjs +47 -0
- package/dist/internal/spa-router.d.mts +3 -3
- package/dist/internal/spa-router.d.ts +3 -3
- package/dist/internal/start-manifest.d.mts +2 -1
- package/dist/internal/start-manifest.d.ts +2 -1
- package/dist/island-runtime.d-BA7EPo1v.d.ts +38 -0
- package/dist/island-runtime.d-BBS_YUSX.d.mts +38 -0
- package/dist/markdown.d.mts +2 -1
- package/dist/markdown.d.ts +2 -1
- package/dist/middleware.d.mts +2 -1
- package/dist/middleware.d.ts +2 -1
- package/dist/mobile.d.mts +6 -3
- package/dist/mobile.d.ts +6 -3
- package/dist/{mount.d-DLeYxeRR.d.mts → mount.d-CZ_qL1iS.d.mts} +1 -1
- package/dist/{mount.d-CAovYKfs.d.ts → mount.d-gWul1GA1.d.ts} +1 -1
- package/dist/{navigation-delegate.d-Chv93QS6.d.mts → navigation-delegate.d-BBTzhJLj.d.mts} +1 -1
- package/dist/{navigation-delegate.d-BLM-8Q3Z.d.ts → navigation-delegate.d-BZsYEAet.d.ts} +1 -1
- package/dist/navigation.d.mts +5 -5
- package/dist/navigation.d.ts +5 -5
- package/dist/plugin.cjs +23 -22
- package/dist/plugin.d.mts +6 -6
- package/dist/plugin.d.ts +6 -6
- package/dist/plugin.mjs +22 -21
- package/dist/{render-plan.d-BSTjTH8h.d.ts → render-plan.d-AaJsYPX-.d.ts} +1 -1
- package/dist/{render-plan.d-CK5Lggyb.d.mts → render-plan.d-bnWxS12w.d.mts} +1 -1
- package/dist/renderer-client.cjs +6 -5
- package/dist/renderer-client.d.mts +8 -7
- package/dist/renderer-client.d.ts +8 -7
- package/dist/renderer-client.mjs +2 -1
- package/dist/renderer.cjs +12 -2
- package/dist/renderer.d.mts +167 -4
- package/dist/renderer.d.ts +167 -4
- package/dist/renderer.mjs +11 -1
- package/dist/{request.d-BhggxQf3.d.mts → request.d-C2HOn3Hi.d.mts} +1 -1
- package/dist/{request.d-CyJS9bjm.d.ts → request.d-CAeitOG1.d.ts} +1 -1
- package/dist/request.d.mts +3 -2
- package/dist/request.d.ts +3 -2
- package/dist/{route-rendering.d-BLPPmI5I.d.ts → route-rendering.d-A1dIkUK5.d.ts} +1 -1
- package/dist/{route-rendering.d-CUpG2mZJ.d.mts → route-rendering.d-CYA-ulnX.d.mts} +1 -1
- package/dist/{router.d-2NQM1Kgw.d.mts → router.d-8lxnzlkr.d.mts} +1 -1
- package/dist/{router.d-0X2Ki6rf.d.ts → router.d-A_Yt6jYz.d.ts} +1 -1
- package/dist/{routes.d-CCccJRrp.d.mts → routes.d-BWvpUoYu.d.mts} +1 -1
- package/dist/{routes.d-b7khoRoU.d.ts → routes.d-D7RWvfqL.d.ts} +1 -1
- package/dist/routes.d.mts +2 -1
- package/dist/routes.d.ts +2 -1
- package/dist/{rsc-pipeline-5AOF64FL.cjs → rsc-pipeline-OWBEZ7HB.cjs} +10 -10
- package/dist/{rsc-pipeline-DNRLYOJ7.mjs → rsc-pipeline-UT3Z2GDO.mjs} +9 -9
- package/dist/{runtime-EHG2FRXZ.mjs → runtime-F5I3WY3B.mjs} +12 -12
- package/dist/{runtime-ZVHG5SRB.cjs → runtime-SRMQ46SK.cjs} +15 -15
- package/dist/{runtime.d-CXuwkUgr.d.ts → runtime.d-BPyvWrgQ.d.ts} +1 -1
- package/dist/{runtime.d-CaFXcu_Q.d.mts → runtime.d-C_rZ9_DD.d.mts} +1 -1
- package/dist/{server-components-status.d-Cp7zvBm5.d.mts → server-components-status.d-BpxiEMQE.d.mts} +1 -1
- package/dist/{server-components-status.d-BdeFD8ZH.d.ts → server-components-status.d-C2UEKJn7.d.ts} +1 -1
- package/dist/server-plugins.d.mts +4 -3
- package/dist/server-plugins.d.ts +4 -3
- package/dist/server-query-call.d-rVM_lsYk.d.mts +15 -0
- package/dist/server-query-call.d-rVM_lsYk.d.ts +15 -0
- package/dist/server-query-client.cjs +5 -3
- package/dist/server-query-client.d.mts +3 -2
- package/dist/server-query-client.d.ts +3 -2
- package/dist/server-query-client.mjs +5 -3
- package/dist/{server-query-runtime.d-DXRNhX_3.d.ts → server-query-runtime.d-BlHd90D0.d.ts} +2 -8
- package/dist/{server-query-runtime.d-aP52iuL5.d.mts → server-query-runtime.d-CCLGkQtE.d.mts} +2 -8
- package/dist/server.cjs +52 -52
- package/dist/server.d.mts +12 -12
- package/dist/server.d.ts +12 -12
- package/dist/server.mjs +30 -30
- package/dist/{spa-router.d-l3G38xHa.d.mts → spa-router.d-BD-6WX1R.d.mts} +2 -2
- package/dist/{spa-router.d-Bjgl-Osi.d.ts → spa-router.d-Cw5i_15e.d.ts} +2 -2
- package/dist/{ssg.d-DDca17Lc.d.ts → ssg.d-Bifiq0EL.d.ts} +2 -2
- package/dist/{ssg.d-RnlHOqUL.d.mts → ssg.d-CCE9aob5.d.mts} +2 -2
- package/dist/{store-core.d-BaOUOPf7.d.ts → store-core.d-5tVn5vi1.d.ts} +3 -3
- package/dist/{store-core.d-BZjuC6Zc.d.mts → store-core.d-BN2MxSG9.d.mts} +3 -3
- package/dist/testing.d.mts +2 -1
- package/dist/testing.d.ts +2 -1
- package/dist/{utils.d-D8TWmpWo.d.ts → utils.d-BUjpSNIO.d.ts} +1 -1
- package/dist/{utils.d-tdzw0_zQ.d.mts → utils.d-wGPLeVbq.d.mts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +23 -22
- package/dist/vite.d.mts +12 -6
- package/dist/vite.d.ts +12 -6
- package/dist/vite.mjs +22 -21
- package/package.json +13 -3
- package/dist/analyzer-LV23T6QN.cjs +0 -17
- package/dist/chunk-4QENVMG7.mjs +0 -34
- package/dist/chunk-AUFEM3FB.mjs +0 -229
- package/dist/chunk-S7WZUK3B.cjs +0 -229
- package/dist/{chunk-NEKO3HM2.cjs → chunk-4B6YJ5DS.cjs} +2 -2
- package/dist/{chunk-CA2HBLXP.mjs → chunk-4EEAPBNV.mjs} +3 -3
|
@@ -32,7 +32,7 @@ var _chunkMHKPXX3Jcjs = require('./chunk-MHKPXX3J.cjs');
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
var
|
|
35
|
+
var _chunkYU6VL7H5cjs = require('./chunk-YU6VL7H5.cjs');
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
@@ -40,8 +40,7 @@ var _chunk6BPFIYGYcjs = require('./chunk-6BPFIYGY.cjs');
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
var _chunkHHQEKLZLcjs = require('./chunk-HHQEKLZL.cjs');
|
|
43
|
+
var _chunkUSMRAC72cjs = require('./chunk-USMRAC72.cjs');
|
|
45
44
|
|
|
46
45
|
|
|
47
46
|
|
|
@@ -71,7 +70,7 @@ var _chunkNDOE76QCcjs = require('./chunk-NDOE76QC.cjs');
|
|
|
71
70
|
|
|
72
71
|
|
|
73
72
|
|
|
74
|
-
var
|
|
73
|
+
var _chunkBOEDYXAXcjs = require('./chunk-BOEDYXAX.cjs');
|
|
75
74
|
|
|
76
75
|
|
|
77
76
|
var _chunk3BTN3NP7cjs = require('./chunk-3BTN3NP7.cjs');
|
|
@@ -116,7 +115,7 @@ var _chunkO4JYMU5Ncjs = require('./chunk-O4JYMU5N.cjs');
|
|
|
116
115
|
|
|
117
116
|
|
|
118
117
|
|
|
119
|
-
var
|
|
118
|
+
var _chunkOFVBMS6Icjs = require('./chunk-OFVBMS6I.cjs');
|
|
120
119
|
|
|
121
120
|
|
|
122
121
|
|
|
@@ -132,12 +131,14 @@ var _chunkVACYUMXWcjs = require('./chunk-VACYUMXW.cjs');
|
|
|
132
131
|
|
|
133
132
|
|
|
134
133
|
|
|
135
|
-
var
|
|
134
|
+
var _chunkL3BSHASBcjs = require('./chunk-L3BSHASB.cjs');
|
|
136
135
|
|
|
137
136
|
|
|
137
|
+
var _chunkMAPHNGTFcjs = require('./chunk-MAPHNGTF.cjs');
|
|
138
138
|
|
|
139
139
|
|
|
140
140
|
|
|
141
|
+
var _chunkZ37PDUJRcjs = require('./chunk-Z37PDUJR.cjs');
|
|
141
142
|
|
|
142
143
|
|
|
143
144
|
|
|
@@ -145,17 +146,18 @@ var _chunkVMBIKDKWcjs = require('./chunk-VMBIKDKW.cjs');
|
|
|
145
146
|
|
|
146
147
|
|
|
147
148
|
|
|
148
|
-
var _chunkNEKO3HM2cjs = require('./chunk-NEKO3HM2.cjs');
|
|
149
149
|
|
|
150
150
|
|
|
151
|
-
var _chunk3HLQTOVUcjs = require('./chunk-3HLQTOVU.cjs');
|
|
152
151
|
|
|
153
152
|
|
|
154
|
-
var _chunk47JV57DAcjs = require('./chunk-47JV57DA.cjs');
|
|
155
153
|
|
|
154
|
+
var _chunk4B6YJ5DScjs = require('./chunk-4B6YJ5DS.cjs');
|
|
156
155
|
|
|
157
156
|
|
|
158
|
-
var
|
|
157
|
+
var _chunk3HLQTOVUcjs = require('./chunk-3HLQTOVU.cjs');
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
var _chunk47JV57DAcjs = require('./chunk-47JV57DA.cjs');
|
|
159
161
|
|
|
160
162
|
|
|
161
163
|
|
|
@@ -163,7 +165,7 @@ var _chunkCD5Z7RR5cjs = require('./chunk-CD5Z7RR5.cjs');
|
|
|
163
165
|
|
|
164
166
|
|
|
165
167
|
|
|
166
|
-
var
|
|
168
|
+
var _chunk22BTYPIXcjs = require('./chunk-22BTYPIX.cjs');
|
|
167
169
|
|
|
168
170
|
|
|
169
171
|
|
|
@@ -171,7 +173,7 @@ var _chunkB2PGVHBGcjs = require('./chunk-B2PGVHBG.cjs');
|
|
|
171
173
|
var _chunkW53Z4WDIcjs = require('./chunk-W53Z4WDI.cjs');
|
|
172
174
|
|
|
173
175
|
|
|
174
|
-
var
|
|
176
|
+
var _chunk57EEWWUScjs = require('./chunk-57EEWWUS.cjs');
|
|
175
177
|
|
|
176
178
|
|
|
177
179
|
var _chunk4EBC7EMWcjs = require('./chunk-4EBC7EMW.cjs');
|
|
@@ -192,11 +194,11 @@ var _chunk4EBC7EMWcjs = require('./chunk-4EBC7EMW.cjs');
|
|
|
192
194
|
|
|
193
195
|
|
|
194
196
|
|
|
195
|
-
var
|
|
197
|
+
var _chunkEBSL5TW7cjs = require('./chunk-EBSL5TW7.cjs');
|
|
196
198
|
|
|
197
199
|
|
|
198
200
|
|
|
199
|
-
var
|
|
201
|
+
var _chunkXJDB564Acjs = require('./chunk-XJDB564A.cjs');
|
|
200
202
|
|
|
201
203
|
|
|
202
204
|
|
|
@@ -204,14 +206,16 @@ var _chunkERMUL73Lcjs = require('./chunk-ERMUL73L.cjs');
|
|
|
204
206
|
|
|
205
207
|
|
|
206
208
|
|
|
207
|
-
var _chunkIIHZ2BEEcjs = require('./chunk-IIHZ2BEE.cjs');
|
|
208
209
|
|
|
210
|
+
var _chunkL2GUEYHRcjs = require('./chunk-L2GUEYHR.cjs');
|
|
209
211
|
|
|
210
212
|
|
|
211
|
-
var _chunk6JHZPB52cjs = require('./chunk-6JHZPB52.cjs');
|
|
212
213
|
|
|
214
|
+
var _chunkIIHZ2BEEcjs = require('./chunk-IIHZ2BEE.cjs');
|
|
213
215
|
|
|
214
|
-
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
var _chunk6JHZPB52cjs = require('./chunk-6JHZPB52.cjs');
|
|
215
219
|
|
|
216
220
|
|
|
217
221
|
var _chunk52Q4OB4Acjs = require('./chunk-52Q4OB4A.cjs');
|
|
@@ -224,7 +228,8 @@ var _chunk52Q4OB4Acjs = require('./chunk-52Q4OB4A.cjs');
|
|
|
224
228
|
|
|
225
229
|
|
|
226
230
|
|
|
227
|
-
|
|
231
|
+
|
|
232
|
+
var _chunk3OKSEJ33cjs = require('./chunk-3OKSEJ33.cjs');
|
|
228
233
|
|
|
229
234
|
|
|
230
235
|
|
|
@@ -303,7 +308,7 @@ var _chunk7U4XF76Rcjs = require('./chunk-7U4XF76R.cjs');
|
|
|
303
308
|
var _chunk2OF5RPVUcjs = require('./chunk-2OF5RPVU.cjs');
|
|
304
309
|
|
|
305
310
|
|
|
306
|
-
var
|
|
311
|
+
var _chunkCVZY4TLWcjs = require('./chunk-CVZY4TLW.cjs');
|
|
307
312
|
|
|
308
313
|
|
|
309
314
|
var _chunkY3DO7BIJcjs = require('./chunk-Y3DO7BIJ.cjs');
|
|
@@ -507,6 +512,7 @@ function toPosix(file) {
|
|
|
507
512
|
var FARM_CLIENT_CSS_HREF_PLACEHOLDER = "/__farm_client_css_href__";
|
|
508
513
|
var FARM_CLIENT_JS_SRC_PLACEHOLDER = "/__farm_client_js_src__";
|
|
509
514
|
var FARM_CLIENT_BOOT_SRC_PLACEHOLDER = "/__farm_client_boot_src__";
|
|
515
|
+
var FARM_CLIENT_STYLESHEET_PLACEHOLDER = "__farm_client_stylesheet__";
|
|
510
516
|
async function hashAndCopy(sourcePath, destinationDir, hashedName) {
|
|
511
517
|
const fs5 = await import("fs/promises");
|
|
512
518
|
try {
|
|
@@ -530,12 +536,21 @@ async function resolveHashedClientCssHref(clientOutputDir) {
|
|
|
530
536
|
);
|
|
531
537
|
return name ? `/assets/${name}` : "/farm-client.css";
|
|
532
538
|
}
|
|
539
|
+
async function resolveClientStylesheetLinkHref(clientOutputDir, clientCssHref) {
|
|
540
|
+
const fs5 = await import("fs/promises");
|
|
541
|
+
try {
|
|
542
|
+
const stylesheet = await fs5.stat(_path2.default.join(clientOutputDir, "farm-client.css"));
|
|
543
|
+
return stylesheet.size > 0 ? clientCssHref : null;
|
|
544
|
+
} catch (e4) {
|
|
545
|
+
return null;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
533
548
|
async function findFingerprintedClientEntry(clientOutputDir) {
|
|
534
549
|
const fs5 = await import("fs/promises");
|
|
535
550
|
try {
|
|
536
551
|
const entries = await fs5.readdir(clientOutputDir);
|
|
537
552
|
return _nullishCoalesce(entries.find((name) => /^farm-client-h[0-9a-f]+\.js$/.test(name)), () => ( null));
|
|
538
|
-
} catch (
|
|
553
|
+
} catch (e5) {
|
|
539
554
|
return null;
|
|
540
555
|
}
|
|
541
556
|
}
|
|
@@ -545,7 +560,7 @@ async function resolveClientBootSrc(clientOutputDir) {
|
|
|
545
560
|
const entries = await fs5.readdir(clientOutputDir);
|
|
546
561
|
const name = entries.find((entry) => /^farm-client-boot-h[0-9a-f]+\.js$/.test(entry));
|
|
547
562
|
return name ? `/${name}` : null;
|
|
548
|
-
} catch (
|
|
563
|
+
} catch (e6) {
|
|
549
564
|
return null;
|
|
550
565
|
}
|
|
551
566
|
}
|
|
@@ -617,7 +632,7 @@ function findSocialImagePath(html, basePath) {
|
|
|
617
632
|
if (!_optionalChain([match, 'optionalAccess', _2 => _2[1]])) return null;
|
|
618
633
|
try {
|
|
619
634
|
return _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, new URL(match[1], FARM_DOCS_COMPILED_ORIGIN).pathname, basePath);
|
|
620
|
-
} catch (
|
|
635
|
+
} catch (e7) {
|
|
621
636
|
return null;
|
|
622
637
|
}
|
|
623
638
|
}
|
|
@@ -646,7 +661,7 @@ async function compileFarmDocsManifest(docs, options) {
|
|
|
646
661
|
isPathGuarded: options.isPathGuarded,
|
|
647
662
|
basePath
|
|
648
663
|
});
|
|
649
|
-
const apiHandler =
|
|
664
|
+
const apiHandler = _chunkUSMRAC72cjs.createFarmDocsAPIHandler.call(void 0, {
|
|
650
665
|
rootDir: options.root,
|
|
651
666
|
srcDir: options.srcDir,
|
|
652
667
|
docs,
|
|
@@ -801,13 +816,15 @@ function collectFarmClientModulePreloads(bundle, options) {
|
|
|
801
816
|
...staticImports(chunk, loaded, [])
|
|
802
817
|
].map(index);
|
|
803
818
|
}
|
|
804
|
-
const dynamicFiles = (moduleIds) => {
|
|
819
|
+
const dynamicFiles = (moduleIds, before = []) => {
|
|
805
820
|
const into = [];
|
|
806
|
-
const loaded = new Set(entryLoaded);
|
|
821
|
+
const loaded = /* @__PURE__ */ new Set([...entryLoaded, ...before]);
|
|
807
822
|
for (const moduleId of _nullishCoalesce(moduleIds, () => ( []))) {
|
|
808
|
-
const
|
|
809
|
-
|
|
810
|
-
|
|
823
|
+
const is = (id) => _path2.default.resolve(id.split("?")[0]) === _path2.default.resolve(moduleId);
|
|
824
|
+
const chunk = _nullishCoalesce(chunks.find(
|
|
825
|
+
(candidate) => candidate.isDynamicEntry && candidate.facadeModuleId && is(candidate.facadeModuleId)
|
|
826
|
+
), () => ( // A module another dynamic import shares can land in a common chunk without a facade.
|
|
827
|
+
chunks.find((candidate) => !candidate.isEntry && _optionalChain([candidate, 'access', _7 => _7.moduleIds, 'optionalAccess', _8 => _8.some, 'call', _9 => _9(is)]))));
|
|
811
828
|
if (!chunk || loaded.has(chunk.fileName)) continue;
|
|
812
829
|
loaded.add(chunk.fileName);
|
|
813
830
|
into.push(chunk.fileName);
|
|
@@ -816,11 +833,15 @@ function collectFarmClientModulePreloads(bundle, options) {
|
|
|
816
833
|
return into;
|
|
817
834
|
};
|
|
818
835
|
const rendererFiles = dynamicFiles(options.rendererModules);
|
|
836
|
+
const rootFiles = dynamicFiles(options.rootModules);
|
|
837
|
+
const actionFiles = dynamicFiles(options.actionModules, rendererFiles);
|
|
819
838
|
return {
|
|
820
839
|
files,
|
|
821
840
|
entry: entryFiles.map(index),
|
|
822
841
|
router: dynamicFiles(options.routerModules).map(index),
|
|
823
842
|
...rendererFiles.length > 0 ? { renderer: rendererFiles.map(index) } : {},
|
|
843
|
+
...rootFiles.length > 0 ? { root: rootFiles.map(index) } : {},
|
|
844
|
+
...actionFiles.length > 0 ? { actions: actionFiles.map(index) } : {},
|
|
824
845
|
modules
|
|
825
846
|
};
|
|
826
847
|
}
|
|
@@ -829,15 +850,22 @@ function createFarmClientModulePreloadPlugin(options) {
|
|
|
829
850
|
name: "farm-client-module-preloads",
|
|
830
851
|
enforce: "post",
|
|
831
852
|
async generateBundle(_output, bundle) {
|
|
832
|
-
const
|
|
833
|
-
|
|
834
|
-
const
|
|
835
|
-
|
|
836
|
-
|
|
853
|
+
const resolve = async (specifiers) => {
|
|
854
|
+
const ids = [];
|
|
855
|
+
for (const specifier of _nullishCoalesce(specifiers, () => ( []))) {
|
|
856
|
+
const resolved = await this.resolve(specifier, options.rendererImporter);
|
|
857
|
+
if (resolved) ids.push(resolved.id);
|
|
858
|
+
}
|
|
859
|
+
return ids;
|
|
860
|
+
};
|
|
861
|
+
const rendererModules = await resolve(options.rendererImports);
|
|
862
|
+
const actionModules = await resolve(options.actionImports);
|
|
837
863
|
await _promises2.default.mkdir(options.buildDir, { recursive: true });
|
|
838
864
|
await _promises2.default.writeFile(
|
|
839
865
|
_path2.default.join(options.buildDir, FARM_CLIENT_MODULE_PRELOADS_FILE),
|
|
840
|
-
JSON.stringify(
|
|
866
|
+
JSON.stringify(
|
|
867
|
+
collectFarmClientModulePreloads(bundle, { ...options, rendererModules, actionModules })
|
|
868
|
+
)
|
|
841
869
|
);
|
|
842
870
|
}
|
|
843
871
|
};
|
|
@@ -847,7 +875,7 @@ async function readFarmClientModulePreloads(buildDir) {
|
|
|
847
875
|
return JSON.parse(
|
|
848
876
|
await _promises2.default.readFile(_path2.default.join(buildDir, FARM_CLIENT_MODULE_PRELOADS_FILE), "utf8")
|
|
849
877
|
);
|
|
850
|
-
} catch (
|
|
878
|
+
} catch (e8) {
|
|
851
879
|
return null;
|
|
852
880
|
}
|
|
853
881
|
}
|
|
@@ -910,8 +938,10 @@ function resolveFarmDocsClientRoutes(pages, docsPagePaths) {
|
|
|
910
938
|
function isStatic(segment) {
|
|
911
939
|
return segment === "static";
|
|
912
940
|
}
|
|
913
|
-
function generateFarmClientRouteTableModule(table) {
|
|
914
|
-
|
|
941
|
+
function generateFarmClientRouteTableModule(table, options = {}) {
|
|
942
|
+
const matcher = options.matcher ? `export { createFarmRouter, isFarmRouteActive, matchFarmRoute } from "@farm.js/core/router";
|
|
943
|
+
` : "";
|
|
944
|
+
return `${matcher}export default JSON.parse(${JSON.stringify(JSON.stringify(table))});
|
|
915
945
|
`;
|
|
916
946
|
}
|
|
917
947
|
async function writeFarmClientRouteTable(buildDir, table) {
|
|
@@ -923,7 +953,7 @@ async function readFarmClientRouteTable(buildDir) {
|
|
|
923
953
|
return JSON.parse(
|
|
924
954
|
await _promises2.default.readFile(_path2.default.join(buildDir, FARM_CLIENT_ROUTE_TABLE_FILE), "utf8")
|
|
925
955
|
);
|
|
926
|
-
} catch (
|
|
956
|
+
} catch (e9) {
|
|
927
957
|
return null;
|
|
928
958
|
}
|
|
929
959
|
}
|
|
@@ -1007,7 +1037,7 @@ async function readFarmDocsModulePreloads(buildDir) {
|
|
|
1007
1037
|
return JSON.parse(
|
|
1008
1038
|
await _promises2.default.readFile(_path2.default.join(buildDir, FARM_DOCS_MODULE_PRELOADS_FILE), "utf8")
|
|
1009
1039
|
);
|
|
1010
|
-
} catch (
|
|
1040
|
+
} catch (e10) {
|
|
1011
1041
|
return null;
|
|
1012
1042
|
}
|
|
1013
1043
|
}
|
|
@@ -1023,7 +1053,7 @@ async function createFarmRouteRuntimeManifest(options) {
|
|
|
1023
1053
|
const routes = [];
|
|
1024
1054
|
for (const [pattern, entry] of options.routeManager.getRoutes()) {
|
|
1025
1055
|
const routeModule = await options.routeManager.loadRouteModule(entry.modulePath);
|
|
1026
|
-
const rendering = await
|
|
1056
|
+
const rendering = await _chunkL3BSHASBcjs.resolveRouteRenderingConfigFromFile.call(void 0, routeModule, entry.modulePath);
|
|
1027
1057
|
const runtimeConfig = await options.routeManager.resolveRouteRuntimeConfig(pattern);
|
|
1028
1058
|
routes.push({
|
|
1029
1059
|
kind: "page",
|
|
@@ -1110,7 +1140,7 @@ function validateFarmRouteRuntimeDeployment(manifest, preset) {
|
|
|
1110
1140
|
`Route "${route.pattern}" requires the ${route.runtime} runtime, but preset "${preset}" emits ${runtime} functions. Choose a compatible preset or change the route runtime.`
|
|
1111
1141
|
);
|
|
1112
1142
|
}
|
|
1113
|
-
if (_optionalChain([route, 'access',
|
|
1143
|
+
if (_optionalChain([route, 'access', _10 => _10.regions, 'optionalAccess', _11 => _11.length]) && preset !== "vercel") {
|
|
1114
1144
|
warnings.add(
|
|
1115
1145
|
`Preset "${preset}" does not map per-route regions; Farm kept them in ${FARM_ROUTE_RUNTIME_MANIFEST} for deployment adapters.`
|
|
1116
1146
|
);
|
|
@@ -1157,7 +1187,7 @@ async function createFarmVercelRouteRuntimeFunctions(outputDir, manifest, fs5, b
|
|
|
1157
1187
|
const destinations = /* @__PURE__ */ new Map();
|
|
1158
1188
|
let groupIndex = 0;
|
|
1159
1189
|
for (const [key, group] of groups) {
|
|
1160
|
-
if (!_optionalChain([group, 'access',
|
|
1190
|
+
if (!_optionalChain([group, 'access', _12 => _12.config, 'access', _13 => _13.regions, 'optionalAccess', _14 => _14.length]) && !group.config.maxDuration) {
|
|
1161
1191
|
destinations.set(key, "/__nitro");
|
|
1162
1192
|
continue;
|
|
1163
1193
|
}
|
|
@@ -1207,14 +1237,14 @@ async function configureVercelFunction(functionDir, config, fs5) {
|
|
|
1207
1237
|
const current = JSON.parse(await fs5.readFile(configPath, "utf8"));
|
|
1208
1238
|
const next = {
|
|
1209
1239
|
...current,
|
|
1210
|
-
..._optionalChain([config, 'access',
|
|
1240
|
+
..._optionalChain([config, 'access', _15 => _15.regions, 'optionalAccess', _16 => _16.length]) ? { regions: config.regions } : {},
|
|
1211
1241
|
...config.maxDuration ? { maxDuration: config.maxDuration } : {}
|
|
1212
1242
|
};
|
|
1213
1243
|
await fs5.writeFile(configPath, `${JSON.stringify(next, null, 2)}
|
|
1214
1244
|
`);
|
|
1215
1245
|
}
|
|
1216
1246
|
function hasVercelFunctionControls(route) {
|
|
1217
|
-
return Boolean(_optionalChain([route, 'access',
|
|
1247
|
+
return Boolean(_optionalChain([route, 'access', _17 => _17.regions, 'optionalAccess', _18 => _18.length]) || route.maxDuration);
|
|
1218
1248
|
}
|
|
1219
1249
|
function compareRuntimeRoutes(left, right) {
|
|
1220
1250
|
const kindOrder = { page: 0, api: 0, metadata: 0, rule: 1 };
|
|
@@ -1259,7 +1289,7 @@ var FARM_HASHED_ASSET_DIRS = ["assets", "chunks"];
|
|
|
1259
1289
|
var LITERAL_ROUTE_PATH = /^\/[\w.~@/-]+$/;
|
|
1260
1290
|
function planFarmImmutableAssets(options) {
|
|
1261
1291
|
const cacheRulePatterns = Object.entries(_nullishCoalesce(options.routeRules, () => ( {}))).filter(
|
|
1262
|
-
([, rule]) => Object.keys(_nullishCoalesce(_optionalChain([rule, 'optionalAccess',
|
|
1292
|
+
([, rule]) => Object.keys(_nullishCoalesce(_optionalChain([rule, 'optionalAccess', _19 => _19.headers]), () => ( {}))).some((name) => name.toLowerCase() === "cache-control")
|
|
1263
1293
|
).map(([pattern]) => pattern);
|
|
1264
1294
|
const isImmutable = (file) => isFarmImmutableAssetPath(file) && !cacheRulePatterns.some((pattern) => _chunkIUKBPBM7cjs.farmRouteRuleMatches.call(void 0, pattern, file));
|
|
1265
1295
|
const routeDirs = new Set(
|
|
@@ -1377,7 +1407,7 @@ function resolveBundleFileName(chunkFileName, relativeUrl) {
|
|
|
1377
1407
|
let relativePath = relativeUrl.replace(/[?#].*$/, "");
|
|
1378
1408
|
try {
|
|
1379
1409
|
relativePath = decodeURI(relativePath);
|
|
1380
|
-
} catch (
|
|
1410
|
+
} catch (e11) {
|
|
1381
1411
|
}
|
|
1382
1412
|
const fileName = _path2.default.posix.normalize(
|
|
1383
1413
|
_path2.default.posix.join(_path2.default.posix.dirname(chunkFileName), relativePath)
|
|
@@ -1387,7 +1417,7 @@ function resolveBundleFileName(chunkFileName, relativeUrl) {
|
|
|
1387
1417
|
function replaceServerFileReferences(bundle, chunkFileName, code, replace) {
|
|
1388
1418
|
return code.replace(SERVER_FILE_URL_RE, (reference, _quote, relativeUrl) => {
|
|
1389
1419
|
const target = resolveBundleFileName(chunkFileName, relativeUrl);
|
|
1390
|
-
return target && _optionalChain([bundle, 'access',
|
|
1420
|
+
return target && _optionalChain([bundle, 'access', _20 => _20[target], 'optionalAccess', _21 => _21.type]) === "asset" ? replace(target) : reference;
|
|
1391
1421
|
});
|
|
1392
1422
|
}
|
|
1393
1423
|
function collectServerReadSSRAssets(bundle) {
|
|
@@ -1440,7 +1470,7 @@ function assertServerReadSSRAssetsSupported(bundle, preset, root) {
|
|
|
1440
1470
|
if (assets.length === 0) return;
|
|
1441
1471
|
const sources = assets.map((fileName) => {
|
|
1442
1472
|
const output = bundle[fileName];
|
|
1443
|
-
const original = _optionalChain([output, 'optionalAccess',
|
|
1473
|
+
const original = _optionalChain([output, 'optionalAccess', _22 => _22.type]) === "asset" ? _optionalChain([output, 'access', _23 => _23.originalFileNames, 'optionalAccess', _24 => _24[0]]) : void 0;
|
|
1444
1474
|
if (!original) return fileName;
|
|
1445
1475
|
return _path2.default.relative(root, _path2.default.resolve(root, original)).split(_path2.default.sep).join("/");
|
|
1446
1476
|
});
|
|
@@ -1459,7 +1489,7 @@ function createServerReadSSRAssetsPlugin(bundle, ssrOutputDir) {
|
|
|
1459
1489
|
transform(code, id) {
|
|
1460
1490
|
if (!code.includes("import.meta.url")) return null;
|
|
1461
1491
|
const chunkFileName = _path2.default.relative(ssrOutputDir, id.split("?", 1)[0]).split(_path2.default.sep).join("/");
|
|
1462
|
-
if (_optionalChain([bundle, 'access',
|
|
1492
|
+
if (_optionalChain([bundle, 'access', _25 => _25[chunkFileName], 'optionalAccess', _26 => _26.type]) !== "chunk") return null;
|
|
1463
1493
|
let changed = false;
|
|
1464
1494
|
const transformed = replaceServerFileReferences(
|
|
1465
1495
|
bundle,
|
|
@@ -1555,7 +1585,7 @@ export default async function farmNetlifyHandler(request, context) {
|
|
|
1555
1585
|
var PLATFORM_CONFIG_KEYS = /* @__PURE__ */ new Set(["desktop", "mobile"]);
|
|
1556
1586
|
var CONFIG_FACTORIES = /* @__PURE__ */ new Set(["defineConfig", "defineFarmConfig"]);
|
|
1557
1587
|
function isConfigObject(node) {
|
|
1558
|
-
return _optionalChain([node, 'optionalAccess',
|
|
1588
|
+
return _optionalChain([node, 'optionalAccess', _27 => _27.type]) === "ObjectExpression";
|
|
1559
1589
|
}
|
|
1560
1590
|
function propertyName(property) {
|
|
1561
1591
|
if (property.type !== "Property" || property.computed) return void 0;
|
|
@@ -1576,7 +1606,7 @@ function collectConfigObjects(node, found) {
|
|
|
1576
1606
|
}
|
|
1577
1607
|
if (current.type === "CallExpression") {
|
|
1578
1608
|
const callee = current.callee;
|
|
1579
|
-
const name = callee.type === "Identifier" ? callee.name : _optionalChain([callee, 'access',
|
|
1609
|
+
const name = callee.type === "Identifier" ? callee.name : _optionalChain([callee, 'access', _28 => _28.property, 'optionalAccess', _29 => _29.name]);
|
|
1580
1610
|
const argument = current.arguments[0];
|
|
1581
1611
|
if (name && CONFIG_FACTORIES.has(name) && isConfigObject(argument)) found.push(argument);
|
|
1582
1612
|
}
|
|
@@ -1609,7 +1639,7 @@ function stripPlatformConfigSource(code, parse) {
|
|
|
1609
1639
|
const trailingComma = /^\s*,/.exec(code.slice(properties[last].end));
|
|
1610
1640
|
removals.push([
|
|
1611
1641
|
properties[first].start,
|
|
1612
|
-
properties[last].end + (_nullishCoalesce(_optionalChain([trailingComma, 'optionalAccess',
|
|
1642
|
+
properties[last].end + (_nullishCoalesce(_optionalChain([trailingComma, 'optionalAccess', _30 => _30[0], 'access', _31 => _31.length]), () => ( 0)))
|
|
1613
1643
|
]);
|
|
1614
1644
|
}
|
|
1615
1645
|
first = last;
|
|
@@ -1624,7 +1654,7 @@ function stripPlatformConfigSource(code, parse) {
|
|
|
1624
1654
|
function realPath(file) {
|
|
1625
1655
|
try {
|
|
1626
1656
|
return _fs.realpathSync.call(void 0, file);
|
|
1627
|
-
} catch (
|
|
1657
|
+
} catch (e12) {
|
|
1628
1658
|
return _path2.default.resolve(file);
|
|
1629
1659
|
}
|
|
1630
1660
|
}
|
|
@@ -1636,7 +1666,7 @@ function farmStripPlatformConfigPlugin(configFiles) {
|
|
|
1636
1666
|
// removed block used (`readFileSync` for a version, say).
|
|
1637
1667
|
enforce: "pre",
|
|
1638
1668
|
transform: {
|
|
1639
|
-
filter: { id:
|
|
1669
|
+
filter: { id: _chunkOFVBMS6Icjs.fileNamePattern.call(void 0, configFiles) },
|
|
1640
1670
|
async handler(code, id) {
|
|
1641
1671
|
const file = id.split("?", 1)[0];
|
|
1642
1672
|
if (!files.has(_path2.default.resolve(file)) && !files.has(realPath(file))) return null;
|
|
@@ -1684,12 +1714,12 @@ function precompileFarmMarkdownPages(bodies, coreRoot) {
|
|
|
1684
1714
|
eval: true,
|
|
1685
1715
|
workerData: { runtime: _url.pathToFileURL.call(void 0, runtime).href, bodies: [...new Set(bodies)] }
|
|
1686
1716
|
});
|
|
1687
|
-
} catch (
|
|
1717
|
+
} catch (e13) {
|
|
1688
1718
|
done();
|
|
1689
1719
|
return;
|
|
1690
1720
|
}
|
|
1691
1721
|
worker.once("message", (entries) => {
|
|
1692
|
-
void _optionalChain([worker, 'optionalAccess',
|
|
1722
|
+
void _optionalChain([worker, 'optionalAccess', _32 => _32.terminate, 'call', _33 => _33()]);
|
|
1693
1723
|
done(entries);
|
|
1694
1724
|
});
|
|
1695
1725
|
worker.once("error", () => done());
|
|
@@ -1698,7 +1728,7 @@ function precompileFarmMarkdownPages(bodies, coreRoot) {
|
|
|
1698
1728
|
return {
|
|
1699
1729
|
pages,
|
|
1700
1730
|
dispose() {
|
|
1701
|
-
void _optionalChain([worker, 'optionalAccess',
|
|
1731
|
+
void _optionalChain([worker, 'optionalAccess', _34 => _34.terminate, 'call', _35 => _35()]);
|
|
1702
1732
|
}
|
|
1703
1733
|
};
|
|
1704
1734
|
}
|
|
@@ -1780,7 +1810,7 @@ function literalMatcher(node) {
|
|
|
1780
1810
|
if (node.type === "Literal" && node.regex)
|
|
1781
1811
|
return new RegExp(node.regex.pattern, node.regex.flags);
|
|
1782
1812
|
if (node.type === "TemplateLiteral" && node.expressions.length === 0) {
|
|
1783
|
-
return _nullishCoalesce(_optionalChain([node, 'access',
|
|
1813
|
+
return _nullishCoalesce(_optionalChain([node, 'access', _36 => _36.quasis, 'access', _37 => _37[0], 'optionalAccess', _38 => _38.value, 'optionalAccess', _39 => _39.cooked]), () => ( void 0));
|
|
1784
1814
|
}
|
|
1785
1815
|
return void 0;
|
|
1786
1816
|
}
|
|
@@ -1804,7 +1834,7 @@ function readStaticMiddlewareConfig(program) {
|
|
|
1804
1834
|
let found = null;
|
|
1805
1835
|
for (const statement of program.body) {
|
|
1806
1836
|
if (statement.type === "ExportNamedDeclaration" && !statement.declaration) {
|
|
1807
|
-
if (statement.specifiers.some((specifier) => _optionalChain([specifier, 'access',
|
|
1837
|
+
if (statement.specifiers.some((specifier) => _optionalChain([specifier, 'access', _40 => _40.exported, 'optionalAccess', _41 => _41.name]) === "config")) {
|
|
1808
1838
|
return "unknown";
|
|
1809
1839
|
}
|
|
1810
1840
|
continue;
|
|
@@ -1812,14 +1842,14 @@ function readStaticMiddlewareConfig(program) {
|
|
|
1812
1842
|
const declaration = statement.type === "ExportNamedDeclaration" ? statement.declaration : null;
|
|
1813
1843
|
if (!declaration || declaration.type !== "VariableDeclaration") continue;
|
|
1814
1844
|
for (const declarator of declaration.declarations) {
|
|
1815
|
-
if (_optionalChain([declarator, 'access',
|
|
1845
|
+
if (_optionalChain([declarator, 'access', _42 => _42.id, 'optionalAccess', _43 => _43.type]) !== "Identifier" || declarator.id.name !== "config") continue;
|
|
1816
1846
|
if (declaration.kind !== "const" || !declarator.init) return "unknown";
|
|
1817
1847
|
const init = unwrap(declarator.init);
|
|
1818
1848
|
if (init.type !== "ObjectExpression") return "unknown";
|
|
1819
1849
|
const config = {};
|
|
1820
1850
|
for (const property of init.properties) {
|
|
1821
1851
|
if (property.type !== "Property" || property.computed) return "unknown";
|
|
1822
|
-
const key = _nullishCoalesce(_optionalChain([property, 'access',
|
|
1852
|
+
const key = _nullishCoalesce(_optionalChain([property, 'access', _44 => _44.key, 'optionalAccess', _45 => _45.name]), () => ( _optionalChain([property, 'access', _46 => _46.key, 'optionalAccess', _47 => _47.value])));
|
|
1823
1853
|
if (key === "runtime") {
|
|
1824
1854
|
const runtime = literalMatcher(unwrap(property.value));
|
|
1825
1855
|
if (runtime === "edge" || runtime === "nodejs") config.runtime = runtime;
|
|
@@ -1840,9 +1870,9 @@ async function readMiddlewareFileConfig(filePath) {
|
|
|
1840
1870
|
try {
|
|
1841
1871
|
const [{ readFile: readFile2 }, vite] = await Promise.all([import("fs/promises"), import("vite")]);
|
|
1842
1872
|
const parsed = vite.parseSync(filePath, await readFile2(filePath, "utf8"));
|
|
1843
|
-
if (_optionalChain([parsed, 'access',
|
|
1873
|
+
if (_optionalChain([parsed, 'access', _48 => _48.errors, 'optionalAccess', _49 => _49.length])) return "unknown";
|
|
1844
1874
|
return readStaticMiddlewareConfig(parsed.program);
|
|
1845
|
-
} catch (
|
|
1875
|
+
} catch (e14) {
|
|
1846
1876
|
return "unknown";
|
|
1847
1877
|
}
|
|
1848
1878
|
}
|
|
@@ -1859,7 +1889,7 @@ function farmTargetRunsEdgeMiddleware(preset) {
|
|
|
1859
1889
|
return preset === "vercel";
|
|
1860
1890
|
}
|
|
1861
1891
|
function isFarmEdgeMiddlewareRoute(route) {
|
|
1862
|
-
return typeof route.config === "object" && _optionalChain([route, 'access',
|
|
1892
|
+
return typeof route.config === "object" && _optionalChain([route, 'access', _50 => _50.config, 'optionalAccess', _51 => _51.runtime]) === "edge";
|
|
1863
1893
|
}
|
|
1864
1894
|
function escapeRegExp3(value) {
|
|
1865
1895
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -1896,7 +1926,7 @@ export default createFarmVercelEdgeMiddleware({
|
|
|
1896
1926
|
${modules.join("\n")}
|
|
1897
1927
|
],
|
|
1898
1928
|
i18n: ${JSON.stringify(config.i18n)},
|
|
1899
|
-
server: ${JSON.stringify({ trustProxy: _optionalChain([config, 'access',
|
|
1929
|
+
server: ${JSON.stringify({ trustProxy: _optionalChain([config, 'access', _52 => _52.server, 'optionalAccess', _53 => _53.trustProxy]) === true })},
|
|
1900
1930
|
apiBasePath: ${JSON.stringify(_chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, config.api))},
|
|
1901
1931
|
notFoundPath: ${JSON.stringify(_chunkD22BUQKWcjs.applyFarmBasePath.call(void 0, FARM_VERCEL_EDGE_NOT_FOUND_PATH, config.basePath))},
|
|
1902
1932
|
pages: ${JSON.stringify(toFarmVercelEdgeGuardedUrls(guardedPages, config.basePath))},
|
|
@@ -1955,7 +1985,7 @@ async function writeFarmVercelEdgeMiddlewareFunction(options) {
|
|
|
1955
1985
|
logLevel: "silent",
|
|
1956
1986
|
plugins: [edgeNodeModulesPlugin(coreDir, unsupported)],
|
|
1957
1987
|
resolve: {
|
|
1958
|
-
alias:
|
|
1988
|
+
alias: _chunkOFVBMS6Icjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
1959
1989
|
conditionNames: ["edge-light", "worker", "browser", "import", "module", "default"]
|
|
1960
1990
|
},
|
|
1961
1991
|
transform: {
|
|
@@ -2015,7 +2045,7 @@ async function readFarmNativeStylesheets(clientOutputDir, clientCssHref) {
|
|
|
2015
2045
|
"utf8"
|
|
2016
2046
|
)
|
|
2017
2047
|
};
|
|
2018
|
-
} catch (
|
|
2048
|
+
} catch (e15) {
|
|
2019
2049
|
return {};
|
|
2020
2050
|
}
|
|
2021
2051
|
}
|
|
@@ -2034,7 +2064,7 @@ function findFarmCoreRoot(from) {
|
|
|
2034
2064
|
if (_fs.existsSync.call(void 0, manifest)) {
|
|
2035
2065
|
try {
|
|
2036
2066
|
if (JSON.parse(_fs.readFileSync.call(void 0, manifest, "utf8")).name === "@farm.js/core") return dir;
|
|
2037
|
-
} catch (
|
|
2067
|
+
} catch (e16) {
|
|
2038
2068
|
}
|
|
2039
2069
|
}
|
|
2040
2070
|
dir = _path2.default.dirname(dir);
|
|
@@ -2052,7 +2082,7 @@ function findInstalledPackageDir(name, from) {
|
|
|
2052
2082
|
if (_fs.existsSync.call(void 0, _path2.default.join(candidate, "package.json"))) {
|
|
2053
2083
|
try {
|
|
2054
2084
|
return _fs.realpathSync.call(void 0, candidate);
|
|
2055
|
-
} catch (
|
|
2085
|
+
} catch (e17) {
|
|
2056
2086
|
return null;
|
|
2057
2087
|
}
|
|
2058
2088
|
}
|
|
@@ -2068,7 +2098,7 @@ function collectFarmDependencyDirs(root) {
|
|
|
2068
2098
|
let manifest;
|
|
2069
2099
|
try {
|
|
2070
2100
|
manifest = JSON.parse(_fs.readFileSync.call(void 0, _path2.default.join(dir, "package.json"), "utf8"));
|
|
2071
|
-
} catch (
|
|
2101
|
+
} catch (e18) {
|
|
2072
2102
|
return;
|
|
2073
2103
|
}
|
|
2074
2104
|
for (const field of ["dependencies", "optionalDependencies", "peerDependencies"]) {
|
|
@@ -2084,7 +2114,7 @@ function collectFarmDependencyDirs(root) {
|
|
|
2084
2114
|
if (name.startsWith("@farm.js/")) queue.push({ name, from: root });
|
|
2085
2115
|
}
|
|
2086
2116
|
}
|
|
2087
|
-
} catch (
|
|
2117
|
+
} catch (e19) {
|
|
2088
2118
|
}
|
|
2089
2119
|
for (let next = queue.pop(); next; next = queue.pop()) {
|
|
2090
2120
|
const dir = findInstalledPackageDir(next.name, next.from);
|
|
@@ -2187,14 +2217,14 @@ function createPrerenderRuntimeResolverPlugin(root, resolveNitroEntry = resolveN
|
|
|
2187
2217
|
return {
|
|
2188
2218
|
name: "farm-prerender-runtime-resolver",
|
|
2189
2219
|
async resolveId(id, _importer, options) {
|
|
2190
|
-
if (_optionalChain([options, 'access',
|
|
2220
|
+
if (_optionalChain([options, 'access', _54 => _54.custom, 'optionalAccess', _55 => _55.farmPrerenderRuntimeResolve])) return null;
|
|
2191
2221
|
if (id.startsWith("\0") || id.startsWith(".") || id.startsWith("#") || id.startsWith("virtual:") || _path2.default.isAbsolute(id) || NODE_BUILTIN_MODULES.has(id)) {
|
|
2192
2222
|
return null;
|
|
2193
2223
|
}
|
|
2194
2224
|
if (nitroEntry === void 0) {
|
|
2195
2225
|
try {
|
|
2196
2226
|
nitroEntry = resolveNitroEntry(root);
|
|
2197
|
-
} catch (
|
|
2227
|
+
} catch (e20) {
|
|
2198
2228
|
nitroEntry = null;
|
|
2199
2229
|
}
|
|
2200
2230
|
}
|
|
@@ -2215,7 +2245,7 @@ function createFarmStorageModuleRegistration(config) {
|
|
|
2215
2245
|
let runtimeRequire = projectRequire;
|
|
2216
2246
|
try {
|
|
2217
2247
|
runtimeRequire = _module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core"));
|
|
2218
|
-
} catch (
|
|
2248
|
+
} catch (e21) {
|
|
2219
2249
|
}
|
|
2220
2250
|
const loaders = [];
|
|
2221
2251
|
for (const specifier of modules) {
|
|
@@ -2224,7 +2254,7 @@ function createFarmStorageModuleRegistration(config) {
|
|
|
2224
2254
|
try {
|
|
2225
2255
|
resolved = require2.resolve(specifier);
|
|
2226
2256
|
break;
|
|
2227
|
-
} catch (
|
|
2257
|
+
} catch (e22) {
|
|
2228
2258
|
}
|
|
2229
2259
|
}
|
|
2230
2260
|
if (resolved) {
|
|
@@ -2242,7 +2272,7 @@ function resolveNitroPackageEntry(root) {
|
|
|
2242
2272
|
let runtimeRequire = projectRequire;
|
|
2243
2273
|
try {
|
|
2244
2274
|
runtimeRequire = _module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core"));
|
|
2245
|
-
} catch (
|
|
2275
|
+
} catch (e23) {
|
|
2246
2276
|
}
|
|
2247
2277
|
return runtimeRequire.resolve("nitro");
|
|
2248
2278
|
}
|
|
@@ -2296,7 +2326,7 @@ async function canUseRolldownBuilder() {
|
|
|
2296
2326
|
try {
|
|
2297
2327
|
await import("rolldown");
|
|
2298
2328
|
return true;
|
|
2299
|
-
} catch (
|
|
2329
|
+
} catch (e24) {
|
|
2300
2330
|
return false;
|
|
2301
2331
|
}
|
|
2302
2332
|
}
|
|
@@ -2310,12 +2340,12 @@ function hasReactDomEdgeServerBuild(root) {
|
|
|
2310
2340
|
try {
|
|
2311
2341
|
_module.createRequire.call(void 0, _path2.default.join(root, "package.json")).resolve("react-dom/server.edge");
|
|
2312
2342
|
return true;
|
|
2313
|
-
} catch (
|
|
2343
|
+
} catch (e25) {
|
|
2314
2344
|
return false;
|
|
2315
2345
|
}
|
|
2316
2346
|
}
|
|
2317
2347
|
function shouldAliasReactServerToWebBuild(renderer, preset) {
|
|
2318
|
-
return
|
|
2348
|
+
return _chunk3OKSEJ33cjs.isReactRenderer.call(void 0, renderer) && _chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge";
|
|
2319
2349
|
}
|
|
2320
2350
|
function isCloudflareImagePreset(preset) {
|
|
2321
2351
|
return preset === "cloudflare" || preset === "cloudflare-pages" || preset === "cloudflare-module";
|
|
@@ -2345,7 +2375,7 @@ function isFarmCoreModule(file) {
|
|
|
2345
2375
|
if (_fs.existsSync.call(void 0, manifest)) {
|
|
2346
2376
|
try {
|
|
2347
2377
|
return JSON.parse(_fs.readFileSync.call(void 0, manifest, "utf8")).name === "@farm.js/core";
|
|
2348
|
-
} catch (
|
|
2378
|
+
} catch (e26) {
|
|
2349
2379
|
return false;
|
|
2350
2380
|
}
|
|
2351
2381
|
}
|
|
@@ -2357,7 +2387,7 @@ function createOmittedMetadataImageRuntimePlugin(externalizeOtherImports) {
|
|
|
2357
2387
|
return {
|
|
2358
2388
|
name: "farm-omitted-metadata-image-runtime",
|
|
2359
2389
|
resolveId: {
|
|
2360
|
-
filter: { id:
|
|
2390
|
+
filter: { id: _chunkOFVBMS6Icjs.exactIdPattern.call(void 0, ["@vercel/og"]) },
|
|
2361
2391
|
handler(source, importer) {
|
|
2362
2392
|
if (source !== "@vercel/og") return null;
|
|
2363
2393
|
const fromCoreRuntime = importer !== void 0 && isFarmCoreModule(importer) && !/^og\.[cm]?[jt]sx?$/.test(_path2.default.basename(importer.split("?", 1)[0]));
|
|
@@ -2366,7 +2396,7 @@ function createOmittedMetadataImageRuntimePlugin(externalizeOtherImports) {
|
|
|
2366
2396
|
}
|
|
2367
2397
|
},
|
|
2368
2398
|
load: {
|
|
2369
|
-
filter: { id:
|
|
2399
|
+
filter: { id: _chunkOFVBMS6Icjs.exactIdPattern.call(void 0, [FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID]) },
|
|
2370
2400
|
handler(id) {
|
|
2371
2401
|
if (id !== FARM_OMITTED_METADATA_IMAGE_RUNTIME_ID) return null;
|
|
2372
2402
|
return `
|
|
@@ -2394,8 +2424,8 @@ function readVercelOgManifest(file) {
|
|
|
2394
2424
|
}
|
|
2395
2425
|
function resolveVercelOgConditionEntry(resolvedId, condition) {
|
|
2396
2426
|
const vercelOg = readVercelOgManifest(resolvedId);
|
|
2397
|
-
const entry = _optionalChain([vercelOg, 'optionalAccess',
|
|
2398
|
-
const file = typeof entry === "string" ? entry : _optionalChain([entry, 'optionalAccess',
|
|
2427
|
+
const entry = _optionalChain([vercelOg, 'optionalAccess', _56 => _56.manifest, 'access', _57 => _57.exports, 'optionalAccess', _58 => _58["."], 'optionalAccess', _59 => _59[condition]]);
|
|
2428
|
+
const file = typeof entry === "string" ? entry : _optionalChain([entry, 'optionalAccess', _60 => _60.default]);
|
|
2399
2429
|
return vercelOg && typeof file === "string" ? _path2.default.join(vercelOg.dir, file) : null;
|
|
2400
2430
|
}
|
|
2401
2431
|
function createEdgeMetadataImageRuntimePlugin({
|
|
@@ -2411,7 +2441,7 @@ function createEdgeMetadataImageRuntimePlugin({
|
|
|
2411
2441
|
const edgeEntry = resolveVercelOgConditionEntry(resolved.id, condition);
|
|
2412
2442
|
return edgeEntry ? { ...resolved, id: edgeEntry } : resolved;
|
|
2413
2443
|
}
|
|
2414
|
-
if (wasm !== "module" || !source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess',
|
|
2444
|
+
if (wasm !== "module" || !source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess', _61 => _61.replace, 'call', _62 => _62(/\\/g, "/"), 'access', _63 => _63.includes, 'call', _64 => _64("/@vercel/og/")])) {
|
|
2415
2445
|
return null;
|
|
2416
2446
|
}
|
|
2417
2447
|
const resolvedPath = _path2.default.resolve(_path2.default.dirname(importer.split("?", 1)[0]), source);
|
|
@@ -2433,7 +2463,7 @@ function createVercelOgFontInlinePlugin(runtime = "Cloudflare Workers") {
|
|
|
2433
2463
|
return `Promise.resolve({ arrayBuffer: () => Uint8Array.from(atob(${JSON.stringify(encoded)}), (character) => character.charCodeAt(0)).buffer })`;
|
|
2434
2464
|
});
|
|
2435
2465
|
if (inlined !== code) return { code: inlined, map: null };
|
|
2436
|
-
const version = _nullishCoalesce(_optionalChain([readVercelOgManifest, 'call',
|
|
2466
|
+
const version = _nullishCoalesce(_optionalChain([readVercelOgManifest, 'call', _65 => _65(file), 'optionalAccess', _66 => _66.manifest, 'access', _67 => _67.version]), () => ( "(unknown version)"));
|
|
2437
2467
|
this.error(
|
|
2438
2468
|
`@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.`
|
|
2439
2469
|
);
|
|
@@ -2444,7 +2474,7 @@ function createMetadataImageWasmPlugin() {
|
|
|
2444
2474
|
return {
|
|
2445
2475
|
name: "farm-metadata-image-wasm",
|
|
2446
2476
|
resolveId(source, importer) {
|
|
2447
|
-
if (!source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess',
|
|
2477
|
+
if (!source.endsWith(".wasm?module") || !_optionalChain([importer, 'optionalAccess', _68 => _68.replace, 'call', _69 => _69(/\\/g, "/"), 'access', _70 => _70.includes, 'call', _71 => _71("/@vercel/og/")])) {
|
|
2448
2478
|
return null;
|
|
2449
2479
|
}
|
|
2450
2480
|
const requestPath = source.slice(0, -"?module".length);
|
|
@@ -2520,9 +2550,9 @@ function hasFarmRuntimeConfigModule(config, configModulePath) {
|
|
|
2520
2550
|
return Boolean(configModulePath || (config.layers || []).some((layer) => layer.configFile));
|
|
2521
2551
|
}
|
|
2522
2552
|
function nameCodeSplittingGroups(bundlerConfig) {
|
|
2523
|
-
const outputs = _optionalChain([bundlerConfig, 'optionalAccess',
|
|
2553
|
+
const outputs = _optionalChain([bundlerConfig, 'optionalAccess', _72 => _72.output]);
|
|
2524
2554
|
for (const output of Array.isArray(outputs) ? outputs : [outputs]) {
|
|
2525
|
-
const groups = _optionalChain([output, 'optionalAccess',
|
|
2555
|
+
const groups = _optionalChain([output, 'optionalAccess', _73 => _73.codeSplitting, 'optionalAccess', _74 => _74.groups]);
|
|
2526
2556
|
if (!Array.isArray(groups)) continue;
|
|
2527
2557
|
groups.forEach((group, index) => {
|
|
2528
2558
|
if (group && typeof group.name === "function" && !group.debugName) {
|
|
@@ -2554,7 +2584,7 @@ function lexDynamicImportArguments(code) {
|
|
|
2554
2584
|
}
|
|
2555
2585
|
try {
|
|
2556
2586
|
return _esmodulelexer.parse.call(void 0, code)[0].filter((entry) => entry.d > -1).map((entry) => ({ start: entry.s, end: entry.e }));
|
|
2557
|
-
} catch (
|
|
2587
|
+
} catch (e27) {
|
|
2558
2588
|
return null;
|
|
2559
2589
|
}
|
|
2560
2590
|
}
|
|
@@ -2583,9 +2613,9 @@ function restoreLiteralModuleSpecifiers(code, fileName, { parseSync, Visitor })
|
|
|
2583
2613
|
throw new Error(`Failed to minify ${fileName}: ${parsed.errors[0].message}`);
|
|
2584
2614
|
}
|
|
2585
2615
|
const restore = (node) => {
|
|
2586
|
-
if (_optionalChain([node, 'optionalAccess',
|
|
2616
|
+
if (_optionalChain([node, 'optionalAccess', _75 => _75.type]) !== "TemplateLiteral") return;
|
|
2587
2617
|
const template = node;
|
|
2588
|
-
const value = _optionalChain([template, 'access',
|
|
2618
|
+
const value = _optionalChain([template, 'access', _76 => _76.quasis, 'access', _77 => _77[0], 'optionalAccess', _78 => _78.value, 'access', _79 => _79.cooked]);
|
|
2589
2619
|
if (template.expressions.length > 0 || typeof value !== "string") return;
|
|
2590
2620
|
replacements.push({
|
|
2591
2621
|
start: template.start,
|
|
@@ -2663,7 +2693,7 @@ function hasProjectPostcssConfig(root) {
|
|
|
2663
2693
|
try {
|
|
2664
2694
|
projectRequire.resolve(`./${file}`);
|
|
2665
2695
|
return true;
|
|
2666
|
-
} catch (
|
|
2696
|
+
} catch (e28) {
|
|
2667
2697
|
return false;
|
|
2668
2698
|
}
|
|
2669
2699
|
});
|
|
@@ -2685,7 +2715,7 @@ async function findFarmConfigPath(root) {
|
|
|
2685
2715
|
try {
|
|
2686
2716
|
await fs5.access(resolvedPath);
|
|
2687
2717
|
return resolvedPath;
|
|
2688
|
-
} catch (
|
|
2718
|
+
} catch (e29) {
|
|
2689
2719
|
}
|
|
2690
2720
|
}
|
|
2691
2721
|
return null;
|
|
@@ -2708,7 +2738,7 @@ async function discoverMiddlewareRoutes(appDir) {
|
|
|
2708
2738
|
let entries;
|
|
2709
2739
|
try {
|
|
2710
2740
|
entries = await fs5.readdir(dir, { withFileTypes: true });
|
|
2711
|
-
} catch (
|
|
2741
|
+
} catch (e30) {
|
|
2712
2742
|
return;
|
|
2713
2743
|
}
|
|
2714
2744
|
const middlewareFile = entries.find(
|
|
@@ -2743,7 +2773,7 @@ async function discoverMiddlewareRoutes(appDir) {
|
|
|
2743
2773
|
return Array.from(routes.values()).sort(_chunkSHDCKRP4cjs.compareMiddlewareRouteLocations).map(({ path: routePath, filePath }) => ({ path: routePath, filePath }));
|
|
2744
2774
|
}
|
|
2745
2775
|
function assertFarmDocsRuntimeSupported(config, preset) {
|
|
2746
|
-
if (!_optionalChain([config, 'access',
|
|
2776
|
+
if (!_optionalChain([config, 'access', _80 => _80.docs, 'optionalAccess', _81 => _81.enabled]) || !_optionalChain([config, 'access', _82 => _82.docs, 'access', _83 => _83.adapter, 'optionalAccess', _84 => _84.server]) || _chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) !== "edge" || Boolean(config.docs.adapter.edgeCompiler)) {
|
|
2747
2777
|
return;
|
|
2748
2778
|
}
|
|
2749
2779
|
throw new Error(
|
|
@@ -2835,7 +2865,7 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
2835
2865
|
const productionVite = productionViteResult.value;
|
|
2836
2866
|
_chunk7U4XF76Rcjs.logger.info("\u26A1 Building application bundles with Vite Rolldown");
|
|
2837
2867
|
const mobileClient = shouldBuildFarmMobileClient(config);
|
|
2838
|
-
const rendererDisabled =
|
|
2868
|
+
const rendererDisabled = _chunk3OKSEJ33cjs.isFarmRendererDisabled.call(void 0, config.renderer);
|
|
2839
2869
|
const buildClientBundle = async () => {
|
|
2840
2870
|
if (rendererDisabled) {
|
|
2841
2871
|
await fs5.rm(clientOutputDir, { recursive: true, force: true });
|
|
@@ -2924,7 +2954,7 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
2924
2954
|
);
|
|
2925
2955
|
}
|
|
2926
2956
|
}
|
|
2927
|
-
_optionalChain([sourceSnapshot, 'optionalAccess',
|
|
2957
|
+
_optionalChain([sourceSnapshot, 'optionalAccess', _85 => _85.clear, 'call', _86 => _86()]);
|
|
2928
2958
|
const ssrResult = ssrBuildResult.value;
|
|
2929
2959
|
const routeRuntimeManifest = routeRuntimeManifestResult.value;
|
|
2930
2960
|
const runtimeValidation = validateFarmRouteRuntimeDeployment(routeRuntimeManifest, preset);
|
|
@@ -2956,7 +2986,7 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
2956
2986
|
configuredHeaderRoutes,
|
|
2957
2987
|
nitroBuilderResultPromise,
|
|
2958
2988
|
lifecyclePluginManager,
|
|
2959
|
-
_optionalChain([markdownPrecompile, 'optionalAccess',
|
|
2989
|
+
_optionalChain([markdownPrecompile, 'optionalAccess', _87 => _87.pages])
|
|
2960
2990
|
);
|
|
2961
2991
|
const runtimeManifestPath = await writeFarmRouteRuntimeManifest(
|
|
2962
2992
|
_path2.default.join(root, distDir),
|
|
@@ -2977,8 +3007,8 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
|
|
|
2977
3007
|
_chunk7U4XF76Rcjs.logger.error(`\u274C Build failed: ${error}`);
|
|
2978
3008
|
throw error;
|
|
2979
3009
|
} finally {
|
|
2980
|
-
_optionalChain([rendererBuild, 'optionalAccess',
|
|
2981
|
-
_optionalChain([markdownPrecompile, 'optionalAccess',
|
|
3010
|
+
_optionalChain([rendererBuild, 'optionalAccess', _88 => _88.abort, 'call', _89 => _89()]);
|
|
3011
|
+
_optionalChain([markdownPrecompile, 'optionalAccess', _90 => _90.dispose, 'call', _91 => _91()]);
|
|
2982
3012
|
}
|
|
2983
3013
|
}
|
|
2984
3014
|
function collectFarmPrerenderedMarkdownBodies(pageRoutes) {
|
|
@@ -2986,7 +3016,7 @@ function collectFarmPrerenderedMarkdownBodies(pageRoutes) {
|
|
|
2986
3016
|
for (const route of pageRoutes) {
|
|
2987
3017
|
if (route.source === void 0 || !_chunk26WP75W5cjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) continue;
|
|
2988
3018
|
const { body } = _chunk26WP75W5cjs.parseMarkdownFrontmatter.call(void 0, route.source);
|
|
2989
|
-
const rendering =
|
|
3019
|
+
const rendering = _chunkL3BSHASBcjs.resolveRouteRenderingConfig.call(void 0,
|
|
2990
3020
|
_chunk26WP75W5cjs.readFarmMarkdownRouteConfig.call(void 0, body),
|
|
2991
3021
|
route.source
|
|
2992
3022
|
);
|
|
@@ -3001,7 +3031,7 @@ function varyFarmNitroCacheRules(rules, headerNames) {
|
|
|
3001
3031
|
if (headerNames.length === 0) return rules;
|
|
3002
3032
|
return Object.fromEntries(
|
|
3003
3033
|
Object.entries(rules).map(([source, rule]) => {
|
|
3004
|
-
const cached = _optionalChain([rule, 'optionalAccess',
|
|
3034
|
+
const cached = _optionalChain([rule, 'optionalAccess', _92 => _92.swr]) !== void 0 && rule.swr !== false || _optionalChain([rule, 'optionalAccess', _93 => _93.cache]) !== void 0 && rule.cache !== false;
|
|
3005
3035
|
if (!cached || rule.cache === false) return [source, rule];
|
|
3006
3036
|
const cache = rule.cache && typeof rule.cache === "object" ? rule.cache : {};
|
|
3007
3037
|
const varies = [
|
|
@@ -3030,7 +3060,7 @@ async function writeFarmVideoPlayerToClient(outputDir) {
|
|
|
3030
3060
|
const filePath = _path2.default.join(outputDir, _chunkY3DO7BIJcjs.FARM_VIDEO_PLAYER_PATH.slice(1));
|
|
3031
3061
|
await fs5.mkdir(_path2.default.dirname(filePath), { recursive: true });
|
|
3032
3062
|
try {
|
|
3033
|
-
await fs5.writeFile(filePath,
|
|
3063
|
+
await fs5.writeFile(filePath, _chunkOFVBMS6Icjs.FARM_VIDEO_PLAYER_HTML, { flag: "wx" });
|
|
3034
3064
|
} catch (error) {
|
|
3035
3065
|
if (error.code !== "EEXIST") throw error;
|
|
3036
3066
|
}
|
|
@@ -3052,7 +3082,7 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
|
|
|
3052
3082
|
if (fontCss === void 0) {
|
|
3053
3083
|
try {
|
|
3054
3084
|
fontCss = await fs5.readFile(fontCssPath);
|
|
3055
|
-
} catch (
|
|
3085
|
+
} catch (e31) {
|
|
3056
3086
|
return;
|
|
3057
3087
|
}
|
|
3058
3088
|
}
|
|
@@ -3060,11 +3090,11 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
|
|
|
3060
3090
|
let clientCss = "";
|
|
3061
3091
|
try {
|
|
3062
3092
|
clientCss = await fs5.readFile(clientCssPath, "utf8");
|
|
3063
|
-
} catch (
|
|
3093
|
+
} catch (e32) {
|
|
3064
3094
|
}
|
|
3065
3095
|
const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
|
|
3066
3096
|
await fs5.writeFile(fontCssPath, normalizedFontCss);
|
|
3067
|
-
await fs5.writeFile(clientCssPath,
|
|
3097
|
+
await fs5.writeFile(clientCssPath, _chunkOFVBMS6Icjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
|
|
3068
3098
|
}
|
|
3069
3099
|
function importsFarmClientBlockedPackage(id, packageName) {
|
|
3070
3100
|
return id === packageName || id.startsWith(`${packageName}/`);
|
|
@@ -3087,7 +3117,7 @@ async function validateClientBuildOutput(root, srcDir, outputDir) {
|
|
|
3087
3117
|
try {
|
|
3088
3118
|
const clientEntry = await fs5.stat(clientEntryPath);
|
|
3089
3119
|
if (clientEntry.isFile()) clientEntrySize = clientEntry.size;
|
|
3090
|
-
} catch (
|
|
3120
|
+
} catch (e33) {
|
|
3091
3121
|
}
|
|
3092
3122
|
if (clientEntrySize === 0) {
|
|
3093
3123
|
throw new IncompleteClientBuildOutputError("farm-client.js is missing or empty");
|
|
@@ -3098,7 +3128,7 @@ async function validateClientBuildOutput(root, srcDir, outputDir) {
|
|
|
3098
3128
|
try {
|
|
3099
3129
|
const globalsCss = await fs5.readFile(globalsCssPath, "utf8");
|
|
3100
3130
|
expectsCss = globalsCss.replace(/\/\*[\s\S]*?\*\//g, "").trim().length > 0;
|
|
3101
|
-
} catch (
|
|
3131
|
+
} catch (e34) {
|
|
3102
3132
|
}
|
|
3103
3133
|
try {
|
|
3104
3134
|
const clientCss = await fs5.stat(clientCssPath);
|
|
@@ -3114,10 +3144,10 @@ async function validateClientBuildOutput(root, srcDir, outputDir) {
|
|
|
3114
3144
|
}
|
|
3115
3145
|
}
|
|
3116
3146
|
function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, options = {}) {
|
|
3117
|
-
const key =
|
|
3147
|
+
const key = _chunkEBSL5TW7cjs.getClientModuleHydrationPlanKey.call(void 0, modulePath, root, mode, options);
|
|
3118
3148
|
let plan = cache.get(key);
|
|
3119
3149
|
if (!plan) {
|
|
3120
|
-
plan =
|
|
3150
|
+
plan = _chunkEBSL5TW7cjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
|
|
3121
3151
|
cache.set(key, plan);
|
|
3122
3152
|
}
|
|
3123
3153
|
return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
|
|
@@ -3146,46 +3176,44 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3146
3176
|
const unsupportedIntegrationProvider = integrationProviders.find(
|
|
3147
3177
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
3148
3178
|
);
|
|
3149
|
-
if (_optionalChain([config, 'access',
|
|
3179
|
+
if (_optionalChain([config, 'access', _94 => _94.experimental, 'optionalAccess', _95 => _95.isolatedClientHydration]) === "enabled" && _chunk3OKSEJ33cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _96 => _96.experimental, 'optionalAccess', _97 => _97.serverComponents])) !== "rsc" && unsupportedIntegrationProvider) {
|
|
3150
3180
|
_chunk7U4XF76Rcjs.logger.warn(
|
|
3151
3181
|
`[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
|
|
3152
3182
|
);
|
|
3153
3183
|
}
|
|
3154
|
-
const isolatedMode =
|
|
3155
|
-
_optionalChain([config, 'access',
|
|
3184
|
+
const isolatedMode = _chunkEBSL5TW7cjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
3185
|
+
_optionalChain([config, 'access', _98 => _98.experimental, 'optionalAccess', _99 => _99.isolatedClientHydration]),
|
|
3156
3186
|
{
|
|
3157
|
-
serverComponents:
|
|
3187
|
+
serverComponents: _chunk3OKSEJ33cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _100 => _100.experimental, 'optionalAccess', _101 => _101.serverComponents])) === "rsc",
|
|
3158
3188
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
3159
3189
|
}
|
|
3160
3190
|
);
|
|
3161
|
-
const planOptions =
|
|
3191
|
+
const planOptions = _chunkEBSL5TW7cjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
3162
3192
|
config.renderer,
|
|
3163
3193
|
Boolean(unsupportedIntegrationProvider)
|
|
3164
3194
|
);
|
|
3165
3195
|
const pagePlanOptions = {
|
|
3166
3196
|
...planOptions,
|
|
3167
|
-
serverOwners:
|
|
3197
|
+
serverOwners: _chunk3OKSEJ33cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _102 => _102.experimental, 'optionalAccess', _103 => _103.serverComponents])) === "islands"
|
|
3168
3198
|
};
|
|
3169
3199
|
const layoutPlanOptions = {
|
|
3170
3200
|
...planOptions,
|
|
3171
3201
|
serverTreeLayouts: pagePlanOptions.serverOwners
|
|
3172
3202
|
};
|
|
3173
|
-
const layoutAppliesToRoute =
|
|
3203
|
+
const layoutAppliesToRoute = _chunk4B6YJ5DScjs.routeBoundaryCoversDirectory;
|
|
3174
3204
|
const routeDirectory = (route) => _nullishCoalesce(route.directory, () => ( route.pattern));
|
|
3175
|
-
const islandsMode =
|
|
3176
|
-
const adapterOwnsDocsRuntime =
|
|
3177
|
-
|
|
3178
|
-
);
|
|
3179
|
-
const docsEntries = _optionalChain([config, 'access', _108 => _108.docs, 'optionalAccess', _109 => _109.enabled]) ? _chunkHR5GU4UUcjs.getFarmDocsRoots.call(void 0, config.docs).map(
|
|
3205
|
+
const islandsMode = _chunk3OKSEJ33cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _104 => _104.experimental, 'optionalAccess', _105 => _105.serverComponents])) === "islands";
|
|
3206
|
+
const adapterOwnsDocsRuntime = _chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs);
|
|
3207
|
+
const docsEntries = _optionalChain([config, 'access', _106 => _106.docs, 'optionalAccess', _107 => _107.enabled]) ? _chunkHR5GU4UUcjs.getFarmDocsRoots.call(void 0, config.docs).map(
|
|
3180
3208
|
(docsRoot) => `/${docsRoot.entry || "docs"}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/"
|
|
3181
3209
|
) : [];
|
|
3182
3210
|
const adapterDocsEntry = _nullishCoalesce(docsEntries[0], () => ( null));
|
|
3183
3211
|
const isAdapterDocsRoute = (routePattern) => adapterOwnsDocsRuntime && docsEntries.some(
|
|
3184
3212
|
(docsEntry) => docsEntry === "/" || routePattern === docsEntry || routePattern.startsWith(`${docsEntry}/`)
|
|
3185
3213
|
);
|
|
3186
|
-
const syntheticDocsEntry = _optionalChain([config, 'access',
|
|
3214
|
+
const syntheticDocsEntry = _optionalChain([config, 'access', _108 => _108.docs, 'optionalAccess', _109 => _109.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
|
|
3187
3215
|
const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
|
|
3188
|
-
const plan = (operation) => sourceSnapshot ?
|
|
3216
|
+
const plan = (operation) => sourceSnapshot ? _chunkEBSL5TW7cjs.withFarmSourceSnapshotOf.call(void 0, sourceSnapshot, operation) : _chunkEBSL5TW7cjs.withFarmSourceSnapshot.call(void 0, operation);
|
|
3189
3217
|
const { clientLayouts, clientRouteSlots } = plan(() => {
|
|
3190
3218
|
const clientLayouts2 = layoutRoutes.map((layout) => {
|
|
3191
3219
|
try {
|
|
@@ -3232,7 +3260,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3232
3260
|
};
|
|
3233
3261
|
}
|
|
3234
3262
|
});
|
|
3235
|
-
const markdownPagePlan =
|
|
3263
|
+
const markdownPagePlan = _chunkEBSL5TW7cjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
3236
3264
|
_chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), root),
|
|
3237
3265
|
root,
|
|
3238
3266
|
isolatedMode,
|
|
@@ -3248,7 +3276,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3248
3276
|
pagePlanOptions
|
|
3249
3277
|
)
|
|
3250
3278
|
}));
|
|
3251
|
-
|
|
3279
|
+
_chunkEBSL5TW7cjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
3252
3280
|
clientLayouts2.map((layout) => ({
|
|
3253
3281
|
pattern: layout.pattern,
|
|
3254
3282
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -3257,7 +3285,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3257
3285
|
[
|
|
3258
3286
|
...routePlans.map(({ route, metadata }) => ({
|
|
3259
3287
|
pattern: routeDirectory(route),
|
|
3260
|
-
depth:
|
|
3288
|
+
depth: _chunk4B6YJ5DScjs.getRouteDirectoryDepth.call(void 0, routeDirectory(route)),
|
|
3261
3289
|
metadata
|
|
3262
3290
|
})),
|
|
3263
3291
|
...syntheticDocsPatterns.map((pattern) => ({
|
|
@@ -3282,7 +3310,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3282
3310
|
const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, routeDirectory(route))) || docsEntries.some((docsEntry) => layoutAppliesToRoute(layout.pattern, docsEntry));
|
|
3283
3311
|
if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
|
|
3284
3312
|
_chunk7U4XF76Rcjs.logger.warn(
|
|
3285
|
-
`\u26A0\uFE0F ${
|
|
3313
|
+
`\u26A0\uFE0F ${_chunkEBSL5TW7cjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`
|
|
3286
3314
|
);
|
|
3287
3315
|
}
|
|
3288
3316
|
}
|
|
@@ -3317,7 +3345,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3317
3345
|
);
|
|
3318
3346
|
if (metadata.suppressedAsyncHydration) {
|
|
3319
3347
|
_chunk7U4XF76Rcjs.logger.warn(
|
|
3320
|
-
`\u26A0\uFE0F ${
|
|
3348
|
+
`\u26A0\uFE0F ${_chunkEBSL5TW7cjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
|
|
3321
3349
|
);
|
|
3322
3350
|
}
|
|
3323
3351
|
const slotBoundaries = serverSlotPlans.filter(
|
|
@@ -3325,7 +3353,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3325
3353
|
).flatMap(({ plan: plan2 }) => plan2.isolatedBoundaries);
|
|
3326
3354
|
if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0 || slotBoundaries.length > 0) {
|
|
3327
3355
|
const relativePath = route.modulePath.replace(root, "").replace(/^\//, "");
|
|
3328
|
-
const islandStrategy =
|
|
3356
|
+
const islandStrategy = _chunkOFVBMS6Icjs.resolveFarmRouteRootStrategy.call(void 0,
|
|
3329
3357
|
route,
|
|
3330
3358
|
metadata,
|
|
3331
3359
|
clientLayouts2,
|
|
@@ -3344,7 +3372,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3344
3372
|
...applicableClientLayouts.filter((layout) => layout.hasIsolatedClientBoundaries || layout.serverTreeLayout).flatMap((layout) => layout.isolatedBoundaries)
|
|
3345
3373
|
],
|
|
3346
3374
|
// The server renders a server tree only below a hydrating layout.
|
|
3347
|
-
...
|
|
3375
|
+
..._chunkEBSL5TW7cjs.usesFarmServerTree.call(void 0, metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
|
|
3348
3376
|
});
|
|
3349
3377
|
_chunk7U4XF76Rcjs.logger.info(`\u{1F4F1} Found hydratable route: ${route.pattern} -> ${route.modulePath}`);
|
|
3350
3378
|
}
|
|
@@ -3381,7 +3409,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3381
3409
|
}
|
|
3382
3410
|
const clientRouteSlots2 = routeSlots.filter((slot) => {
|
|
3383
3411
|
try {
|
|
3384
|
-
const metadata =
|
|
3412
|
+
const metadata = _chunkEBSL5TW7cjs.getClientModuleMetadata.call(void 0, slot.modulePath, root);
|
|
3385
3413
|
return metadata.shouldHydrate && (!islandsMode || metadata.isClientComponent);
|
|
3386
3414
|
} catch (error) {
|
|
3387
3415
|
_chunk7U4XF76Rcjs.logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
|
|
@@ -3425,8 +3453,8 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3425
3453
|
srcDir,
|
|
3426
3454
|
adapterOwnsDocsRuntime ? false : _chunkN3H7UPBMcjs.isFarmDocsSearchEnabled.call(void 0, config.docs),
|
|
3427
3455
|
adapterOwnsDocsRuntime ? void 0 : _chunkN3H7UPBMcjs.resolveFarmDocsSearchClientModule.call(void 0, root),
|
|
3428
|
-
_optionalChain([config, 'access',
|
|
3429
|
-
adapterOwnsDocsRuntime ?
|
|
3456
|
+
_optionalChain([config, 'access', _110 => _110.docs, 'optionalAccess', _111 => _111.enabled]) ? _chunkHR5GU4UUcjs.getFarmDocsRoots.call(void 0, config.docs).map((docsRoot) => docsRoot.entry) : void 0,
|
|
3457
|
+
adapterOwnsDocsRuntime ? _chunkL2GUEYHRcjs.getFarmDocsAdapterUIModule.call(void 0, config.docs.adapter) : void 0,
|
|
3430
3458
|
config.i18n,
|
|
3431
3459
|
config.plugins,
|
|
3432
3460
|
config.renderer,
|
|
@@ -3434,11 +3462,11 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3434
3462
|
config.trailingSlash,
|
|
3435
3463
|
_chunkB3HQTGXScjs.getIntegrationProviders.call(void 0, config.integrations),
|
|
3436
3464
|
config.basePath,
|
|
3437
|
-
|
|
3438
|
-
adapterOwnsDocsRuntime ?
|
|
3439
|
-
|
|
3465
|
+
_chunkOFVBMS6Icjs.generateClientCachePersistenceCode.call(void 0, _chunkOFVBMS6Icjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
|
|
3466
|
+
adapterOwnsDocsRuntime ? _chunkXJDB564Acjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0,
|
|
3467
|
+
_chunk3OKSEJ33cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _112 => _112.experimental, 'optionalAccess', _113 => _113.serverComponents])) === "islands",
|
|
3440
3468
|
platform,
|
|
3441
|
-
islandsMode ?
|
|
3469
|
+
islandsMode ? _chunkEBSL5TW7cjs.collectFarmServerStylesheets.call(void 0,
|
|
3442
3470
|
[
|
|
3443
3471
|
...layoutRoutes.map((layout) => layout.modulePath),
|
|
3444
3472
|
...pageRoutes.filter((route) => !isAdapterDocsRoute(route.pattern)).map((route) => route.modulePath)
|
|
@@ -3447,17 +3475,22 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3447
3475
|
) : []
|
|
3448
3476
|
);
|
|
3449
3477
|
const entryName = platform === "mobile" ? _chunkE5UN4OWXcjs.FARM_MOBILE_CLIENT_ENTRY_NAME : "farm-client";
|
|
3450
|
-
const clientEntry = islandsMode && platform === "web" && clientHydrationCode.includes("/*farm-router-stub*/") ?
|
|
3478
|
+
const clientEntry = islandsMode && platform === "web" && clientHydrationCode.includes("/*farm-router-stub*/") ? splitFarmClientEntry(clientHydrationCode) : { entry: clientHydrationCode, router: void 0, root: void 0 };
|
|
3451
3479
|
await fs5.writeFile(clientEntryPath, clientEntry.entry);
|
|
3452
3480
|
await fs5.writeFile(
|
|
3453
3481
|
_path2.default.join(clientEntryDir, `${FARM_CLIENT_ROUTE_TABLE_MODULE}.tsx`),
|
|
3454
|
-
generateFarmClientRouteTableModule(clientRouteTable
|
|
3482
|
+
generateFarmClientRouteTableModule(clientRouteTable, {
|
|
3483
|
+
matcher: islandsMode && platform !== "mobile"
|
|
3484
|
+
})
|
|
3455
3485
|
);
|
|
3456
3486
|
if (clientEntry.router !== void 0) {
|
|
3457
3487
|
await fs5.writeFile(_path2.default.join(clientEntryDir, "farm-client-router.tsx"), clientEntry.router);
|
|
3458
3488
|
}
|
|
3489
|
+
if (clientEntry.root !== void 0) {
|
|
3490
|
+
await fs5.writeFile(_path2.default.join(clientEntryDir, "farm-client-root.tsx"), clientEntry.root);
|
|
3491
|
+
}
|
|
3459
3492
|
const clientInput = { [entryName]: clientEntryPath };
|
|
3460
|
-
if (platform === "web" &&
|
|
3493
|
+
if (platform === "web" && _chunkOFVBMS6Icjs.canBootFarmIslandsClient.call(void 0, config)) {
|
|
3461
3494
|
const clientBootPath = _path2.default.join(clientEntryDir, "farm-client-boot.tsx");
|
|
3462
3495
|
await fs5.writeFile(
|
|
3463
3496
|
clientBootPath,
|
|
@@ -3468,7 +3501,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3468
3501
|
const hasScopedPostcssConfig = hasProjectPostcssConfig(root);
|
|
3469
3502
|
let postcssSearchPath;
|
|
3470
3503
|
let tailwindVitePlugin = void 0;
|
|
3471
|
-
const rendererVitePlugins = await
|
|
3504
|
+
const rendererVitePlugins = await _chunk3OKSEJ33cjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, root, {
|
|
3472
3505
|
ssr: false,
|
|
3473
3506
|
buildLifetime: rendererBuildLifetime
|
|
3474
3507
|
});
|
|
@@ -3499,11 +3532,11 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3499
3532
|
target: FARM_CLIENT_BUILD_TARGET,
|
|
3500
3533
|
// Tailwind CSS 4 already requires newer browsers than that baseline. An app's own
|
|
3501
3534
|
// `build.target` or `build.cssTarget` still decides, as Vite derives one from the other.
|
|
3502
|
-
..._optionalChain([config, 'access',
|
|
3535
|
+
..._optionalChain([config, 'access', _114 => _114.vite, 'optionalAccess', _115 => _115.build, 'optionalAccess', _116 => _116.target]) === void 0 && _optionalChain([config, 'access', _117 => _117.vite, 'optionalAccess', _118 => _118.build, 'optionalAccess', _119 => _119.cssTarget]) === void 0 && (_chunkDMSXZNQRcjs.includesTailwindVitePlugin.call(void 0, tailwindVitePlugin) || _chunkDMSXZNQRcjs.includesTailwindVitePlugin.call(void 0, _optionalChain([config, 'access', _120 => _120.vite, 'optionalAccess', _121 => _121.plugins]))) ? { cssTarget: _chunkDMSXZNQRcjs.TAILWIND_CSS_BROWSER_TARGET } : {},
|
|
3503
3536
|
outDir: outputDir,
|
|
3504
3537
|
emptyOutDir: platform === "web",
|
|
3505
3538
|
// Never public: see resolveFarmClientSourcemap.
|
|
3506
|
-
sourcemap: resolveFarmClientSourcemap(_optionalChain([config, 'access',
|
|
3539
|
+
sourcemap: resolveFarmClientSourcemap(_optionalChain([config, 'access', _122 => _122.vite, 'optionalAccess', _123 => _123.build, 'optionalAccess', _124 => _124.sourcemap])),
|
|
3507
3540
|
assetsInlineLimit: 0,
|
|
3508
3541
|
cssCodeSplit: false,
|
|
3509
3542
|
// Bundle all CSS into one file
|
|
@@ -3515,7 +3548,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3515
3548
|
hashCharacters: "hex",
|
|
3516
3549
|
// Use predictable name for CSS so we can reference it in SSR HTML
|
|
3517
3550
|
assetFileNames: (assetInfo) => {
|
|
3518
|
-
if (_optionalChain([assetInfo, 'access',
|
|
3551
|
+
if (_optionalChain([assetInfo, 'access', _125 => _125.name, 'optionalAccess', _126 => _126.endsWith, 'call', _127 => _127(".css")])) {
|
|
3519
3552
|
return `${entryName}.css`;
|
|
3520
3553
|
}
|
|
3521
3554
|
return "assets/[name]-h[hash][extname]";
|
|
@@ -3532,7 +3565,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3532
3565
|
}
|
|
3533
3566
|
},
|
|
3534
3567
|
plugins: [
|
|
3535
|
-
|
|
3568
|
+
_chunkOFVBMS6Icjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
3536
3569
|
createFarmPrivateClientSourcemapsPlugin({
|
|
3537
3570
|
outDir: _path2.default.join(
|
|
3538
3571
|
_path2.default.dirname(outputDir),
|
|
@@ -3551,13 +3584,16 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3551
3584
|
_path2.default.join(clientEntryDir, "farm-client-router.tsx"),
|
|
3552
3585
|
_path2.default.join(clientEntryDir, `${FARM_CLIENT_ROUTE_TABLE_MODULE}.tsx`)
|
|
3553
3586
|
],
|
|
3587
|
+
rootModules: [_path2.default.join(clientEntryDir, "farm-client-root.tsx")],
|
|
3554
3588
|
// What the islands entry loads with its first render or hydration (RFC 0010).
|
|
3555
|
-
...islandsMode &&
|
|
3589
|
+
...islandsMode && _chunk3OKSEJ33cjs.isReactRenderer.call(void 0, config.renderer) ? {
|
|
3556
3590
|
rendererImports: [
|
|
3557
3591
|
"react",
|
|
3558
3592
|
"react-dom/client",
|
|
3559
3593
|
"@farm.js/core/internal/islands-runtime"
|
|
3560
3594
|
],
|
|
3595
|
+
// What a call's result is handled with, imported on the first (RFC 0013).
|
|
3596
|
+
actionImports: ["@farm.js/core/internal/islands-action-client"],
|
|
3561
3597
|
rendererImporter: clientEntryPath
|
|
3562
3598
|
} : {}
|
|
3563
3599
|
}),
|
|
@@ -3568,8 +3604,8 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3568
3604
|
importer: clientEntryPath,
|
|
3569
3605
|
entryName: "farm-client",
|
|
3570
3606
|
modules: [
|
|
3571
|
-
config.docs.adapter
|
|
3572
|
-
|
|
3607
|
+
_chunkL2GUEYHRcjs.getFarmDocsAdapterUIModule.call(void 0, config.docs.adapter),
|
|
3608
|
+
_chunkXJDB564Acjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs)
|
|
3573
3609
|
].filter((specifier) => Boolean(specifier))
|
|
3574
3610
|
})
|
|
3575
3611
|
] : [],
|
|
@@ -3578,8 +3614,8 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3578
3614
|
...config.vite.plugins || [],
|
|
3579
3615
|
farmServerOnlyEntriesPlugin({ platform, distDir: config.distDir || ".farm" }),
|
|
3580
3616
|
farmNavigationPlugin(config.renderer),
|
|
3581
|
-
|
|
3582
|
-
adapterOwnsDocsRuntime ?
|
|
3617
|
+
_chunkOFVBMS6Icjs.farmDocsClientConfigPlugin.call(void 0,
|
|
3618
|
+
adapterOwnsDocsRuntime ? _chunkXJDB564Acjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
|
|
3583
3619
|
),
|
|
3584
3620
|
// Plugin to redirect @farm.js/core imports to client-only exports
|
|
3585
3621
|
{
|
|
@@ -3611,7 +3647,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3611
3647
|
},
|
|
3612
3648
|
load: {
|
|
3613
3649
|
filter: {
|
|
3614
|
-
id:
|
|
3650
|
+
id: _chunkOFVBMS6Icjs.exactIdPattern.call(void 0, [
|
|
3615
3651
|
"\0empty-module",
|
|
3616
3652
|
"\0empty-api-route",
|
|
3617
3653
|
"\0farm-i18n-client-bridge",
|
|
@@ -3649,7 +3685,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3649
3685
|
{ ...config, isolatedClientBoundaryModules, programmaticClientRoutes, sourceSnapshot },
|
|
3650
3686
|
pluginManager
|
|
3651
3687
|
),
|
|
3652
|
-
|
|
3688
|
+
_chunkEBSL5TW7cjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
|
|
3653
3689
|
],
|
|
3654
3690
|
mode: "production",
|
|
3655
3691
|
css: postcssSearchPath ? {
|
|
@@ -3657,7 +3693,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3657
3693
|
} : void 0,
|
|
3658
3694
|
// Ensure React is bundled for client
|
|
3659
3695
|
resolve: {
|
|
3660
|
-
alias:
|
|
3696
|
+
alias: _chunkOFVBMS6Icjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
3661
3697
|
dedupe: [...config.renderer.dedupe || []]
|
|
3662
3698
|
},
|
|
3663
3699
|
// Optimize dependencies - exclude server-side code from client bundle
|
|
@@ -3671,7 +3707,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3671
3707
|
}
|
|
3672
3708
|
};
|
|
3673
3709
|
await viteBuild(
|
|
3674
|
-
|
|
3710
|
+
_chunkOFVBMS6Icjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite, { clientOutput: true })
|
|
3675
3711
|
);
|
|
3676
3712
|
if (platform === "mobile") {
|
|
3677
3713
|
await fs5.rm(_path2.default.join(outputDir, `${entryName}.css`), { force: true });
|
|
@@ -3687,7 +3723,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
|
|
|
3687
3723
|
} finally {
|
|
3688
3724
|
try {
|
|
3689
3725
|
await fs5.rm(clientEntryDir, { recursive: true, force: true });
|
|
3690
|
-
} catch (
|
|
3726
|
+
} catch (e35) {
|
|
3691
3727
|
}
|
|
3692
3728
|
}
|
|
3693
3729
|
};
|
|
@@ -3765,9 +3801,9 @@ async function fetchFarmNavigationDocument(url, headers, recover = true, signal)
|
|
|
3765
3801
|
return response;
|
|
3766
3802
|
}
|
|
3767
3803
|
|
|
3768
|
-
${streamNavigations ? `${
|
|
3804
|
+
${streamNavigations ? `${_chunkOFVBMS6Icjs.FARM_NAVIGATION_STREAM_READER_SOURCE}
|
|
3769
3805
|
|
|
3770
|
-
${
|
|
3806
|
+
${_chunkOFVBMS6Icjs.FARM_EARLY_NAVIGATION_SOURCE}` : ""}
|
|
3771
3807
|
|
|
3772
3808
|
function clearFarmPrefetchCacheOnDeploymentMismatch(router, error) {
|
|
3773
3809
|
if (error?.name === "FarmDeploymentMismatchError") {
|
|
@@ -3844,18 +3880,27 @@ function loadFarmClientRouteTable() { return null; }
|
|
|
3844
3880
|
function prefetchFarmClientRouteTable() {}
|
|
3845
3881
|
const farmClientRoutesBoot = null;`;
|
|
3846
3882
|
}
|
|
3883
|
+
const lazy = options.lazyMatcher === true;
|
|
3884
|
+
const toClientRoute = `function(route) {
|
|
3885
|
+
const load = typeof route.loader === "number" ? farmClientRouteLoaders[route.loader] : undefined;
|
|
3886
|
+
return { ...route, navigation: "html-fragment", load: load || null };
|
|
3887
|
+
}`;
|
|
3847
3888
|
return `${prefetch}
|
|
3848
3889
|
let clientRoutes = [];
|
|
3849
|
-
|
|
3850
|
-
|
|
3890
|
+
${lazy ? `// The matcher, which loads with the table. Until then the entry matches only the document's own
|
|
3891
|
+
// path (readFarmClientBootRoute).
|
|
3892
|
+
let createFarmRouter = null;
|
|
3893
|
+
let isFarmRouteActive = null;
|
|
3894
|
+
let matchFarmRoute = null;
|
|
3895
|
+
let clientRouteMatcher = null;
|
|
3896
|
+
let clientPageRouteMatcher = null;
|
|
3897
|
+
let farmClientBootRoute = null;` : `let clientRouteMatcher = createFarmRouter([]);
|
|
3898
|
+
let clientPageRouteMatcher = clientRouteMatcher;`}
|
|
3851
3899
|
let farmClientRouteTableLoad = null;
|
|
3852
3900
|
let farmClientRouteTableLoaded = false;
|
|
3853
3901
|
|
|
3854
3902
|
function setFarmClientRoutes(routes) {
|
|
3855
|
-
clientRoutes = routes.map(
|
|
3856
|
-
const load = typeof route.loader === "number" ? farmClientRouteLoaders[route.loader] : undefined;
|
|
3857
|
-
return { ...route, navigation: "html-fragment", load: load || null };
|
|
3858
|
-
});
|
|
3903
|
+
clientRoutes = routes.map(${lazy ? "toFarmClientRoute" : toClientRoute});
|
|
3859
3904
|
clientRouteMatcher = createFarmRouter(clientRoutes.map(function(route) {
|
|
3860
3905
|
return { path: route.pattern, meta: route };
|
|
3861
3906
|
}));
|
|
@@ -3865,12 +3910,27 @@ function setFarmClientRoutes(routes) {
|
|
|
3865
3910
|
return { path: route.pattern, meta: route };
|
|
3866
3911
|
}))` : "clientRouteMatcher"};
|
|
3867
3912
|
}
|
|
3913
|
+
${lazy ? `
|
|
3914
|
+
function toFarmClientRoute(route) {
|
|
3915
|
+
const load = typeof route.loader === "number" ? farmClientRouteLoaders[route.loader] : undefined;
|
|
3916
|
+
return { ...route, navigation: "html-fragment", load: load || null };
|
|
3917
|
+
}
|
|
3868
3918
|
|
|
3919
|
+
// The document's own route, which it names with its params and layouts, until the table loads. A
|
|
3920
|
+
// match for another path waits for the table: the router loads it before it matches.
|
|
3921
|
+
function readFarmClientBootRoute(path) {
|
|
3922
|
+
if (farmClientBootRoute && farmClientBootRoute.path === path) return farmClientBootRoute;
|
|
3923
|
+
throw new Error("[Farm.js] " + path + " cannot be matched before the client route table loads.");
|
|
3924
|
+
}
|
|
3925
|
+
` : ""}
|
|
3869
3926
|
// Null once the whole table is in place, else a promise that settles when it is.
|
|
3870
3927
|
function loadFarmClientRouteTable() {
|
|
3871
3928
|
if (farmClientRouteTableLoaded) return null;
|
|
3872
3929
|
return farmClientRouteTableLoad || (farmClientRouteTableLoad = import("./${FARM_CLIENT_ROUTE_TABLE_MODULE}").then(function(module) {
|
|
3873
|
-
|
|
3930
|
+
${lazy ? ` createFarmRouter = module.createFarmRouter;
|
|
3931
|
+
isFarmRouteActive = module.isFarmRouteActive;
|
|
3932
|
+
matchFarmRoute = module.matchFarmRoute;
|
|
3933
|
+
` : ""} setFarmClientRoutes(module.default);
|
|
3874
3934
|
farmClientRouteTableLoaded = true;
|
|
3875
3935
|
}, function(error) {
|
|
3876
3936
|
farmClientRouteTableLoad = null;
|
|
@@ -3886,8 +3946,9 @@ function prefetchFarmClientRouteTable() {
|
|
|
3886
3946
|
|
|
3887
3947
|
const farmClientRoutesBoot = (function() {
|
|
3888
3948
|
const boot = window.__FARM_CLIENT_ROUTES__;
|
|
3889
|
-
if (boot && Array.isArray(boot.routes) && boot.path === getFarmRoutePathname(window.location.pathname)) {
|
|
3890
|
-
|
|
3949
|
+
if (boot && Array.isArray(boot.routes) && boot.path === getFarmRoutePathname(window.location.pathname)${lazy ? " &&\n boot.params && Array.isArray(boot.layouts)" : ""}) {
|
|
3950
|
+
${lazy ? ` clientRoutes = boot.routes.map(toFarmClientRoute);
|
|
3951
|
+
farmClientBootRoute = boot;` : " setFarmClientRoutes(boot.routes);"}
|
|
3891
3952
|
return null;
|
|
3892
3953
|
}
|
|
3893
3954
|
return loadFarmClientRouteTable().catch(function(error) {
|
|
@@ -3910,7 +3971,75 @@ for (const type of FARM_ROUTE_TABLE_INTENT_EVENTS) {
|
|
|
3910
3971
|
document.addEventListener(type, warmFarmClientRouteTable, { capture: true, passive: true });
|
|
3911
3972
|
}`;
|
|
3912
3973
|
}
|
|
3913
|
-
function
|
|
3974
|
+
function getFarmClientLayoutMatch(pattern) {
|
|
3975
|
+
const groupScope = _chunk4B6YJ5DScjs.getRouteGroupScope.call(void 0, pattern);
|
|
3976
|
+
return groupScope ? { pattern, urlPattern: _chunk4B6YJ5DScjs.stripRouteGroups.call(void 0, pattern), groupScope } : { pattern };
|
|
3977
|
+
}
|
|
3978
|
+
function generateFarmClientLayoutSelectionSource() {
|
|
3979
|
+
return `function selectFarmClientLayouts(layouts, routePathname, readDirectory) {
|
|
3980
|
+
const normalizedPath = routePathname.replace(/\\/$/, '') || '/';
|
|
3981
|
+
let directory;
|
|
3982
|
+
return layouts.filter(function(layout) {
|
|
3983
|
+
// Route groups add no URL segment: match the layout's URL, then keep a
|
|
3984
|
+
// grouped layout to the pages inside its group directory.
|
|
3985
|
+
const urlPattern = layout.urlPattern || layout.pattern;
|
|
3986
|
+
if (urlPattern !== '/' && !isFarmRouteActive(urlPattern, normalizedPath, { exact: false })) return false;
|
|
3987
|
+
if (!layout.groupScope) return true;
|
|
3988
|
+
if (directory === undefined) directory = readDirectory();
|
|
3989
|
+
return typeof directory === 'string' &&
|
|
3990
|
+
(directory === layout.groupScope || directory.startsWith(layout.groupScope + '/'));
|
|
3991
|
+
});
|
|
3992
|
+
}`;
|
|
3993
|
+
}
|
|
3994
|
+
function generateFarmClientRouteMatchSource(options = {}) {
|
|
3995
|
+
const select = "selectFarmClientLayouts(layoutRoutes, path, function() { return getFarmPageDirectory(pathname); })";
|
|
3996
|
+
return `${generateFarmClientLayoutSelectionSource()}
|
|
3997
|
+
${options.lazyMatcher ? `
|
|
3998
|
+
// The document's own layouts, which it names, until the table loads (readFarmClientBootRoute).
|
|
3999
|
+
function readFarmClientBootLayouts(path) {
|
|
4000
|
+
const names = readFarmClientBootRoute(path).layouts;
|
|
4001
|
+
return layoutRoutes.filter(function(layout) { return names.includes(layout.pattern); });
|
|
4002
|
+
}
|
|
4003
|
+
` : ""}
|
|
4004
|
+
// Get applicable layouts for a pathname (sorted by depth, root first)
|
|
4005
|
+
function getApplicableLayouts(pathname) {
|
|
4006
|
+
const path = getFarmRoutePathname(pathname);
|
|
4007
|
+
const applicable = ${options.lazyMatcher ? `clientRouteMatcher
|
|
4008
|
+
? ${select}
|
|
4009
|
+
: readFarmClientBootLayouts(path)` : select};
|
|
4010
|
+
|
|
4011
|
+
// Sort by depth (root first)
|
|
4012
|
+
applicable.sort(function(a, b) {
|
|
4013
|
+
const depthA = a.pattern.split('/').filter(Boolean).length;
|
|
4014
|
+
const depthB = b.pattern.split('/').filter(Boolean).length;
|
|
4015
|
+
return depthA - depthB;
|
|
4016
|
+
});
|
|
4017
|
+
|
|
4018
|
+
return applicable;
|
|
4019
|
+
}
|
|
4020
|
+
|
|
4021
|
+
function hasHydratableLayout(pathname) {
|
|
4022
|
+
return getApplicableLayouts(pathname).some(function(layout) {
|
|
4023
|
+
return layout.shouldHydrate === true;
|
|
4024
|
+
});
|
|
4025
|
+
}
|
|
4026
|
+
|
|
4027
|
+
// Match pathname to client route
|
|
4028
|
+
function matchRoute(pathname) {
|
|
4029
|
+
const path = getFarmRoutePathname(pathname);
|
|
4030
|
+
${options.lazyMatcher ? ` if (!clientRouteMatcher) {
|
|
4031
|
+
// Without the document's route either (the table did not load), nothing matches, as with no table.
|
|
4032
|
+
if (!farmClientBootRoute) return null;
|
|
4033
|
+
const boot = readFarmClientBootRoute(path);
|
|
4034
|
+
return clientRoutes.length > 0 ? { route: clientRoutes[0], params: boot.params } : null;
|
|
4035
|
+
}
|
|
4036
|
+
` : ""} const matched = clientRouteMatcher.match(path);
|
|
4037
|
+
return matched
|
|
4038
|
+
? { route: matched.route.meta, params: matched.params }
|
|
4039
|
+
: null;
|
|
4040
|
+
}`;
|
|
4041
|
+
}
|
|
4042
|
+
function generateFarmClientBootRoutesServerSource(tableSource, layouts) {
|
|
3914
4043
|
return `// The client route table (client-route-table.ts), filled in from the client build. The client
|
|
3915
4044
|
// loads it on its first navigation; a document names the entries its page boots with, found
|
|
3916
4045
|
// with the client's own matcher, so its page hydrates without the table.
|
|
@@ -3930,18 +4059,40 @@ const farmClientRouteTable = (() => {
|
|
|
3930
4059
|
return null;
|
|
3931
4060
|
}
|
|
3932
4061
|
})();
|
|
3933
|
-
|
|
4062
|
+
${layouts ? `
|
|
4063
|
+
// The client's layouts (layoutRoutes in the client entry), of which a document names those that
|
|
4064
|
+
// apply at its path.
|
|
4065
|
+
const farmClientLayoutTable = ${JSON.stringify(layouts)};
|
|
4066
|
+
${generateFarmClientLayoutSelectionSource()}
|
|
4067
|
+
|
|
4068
|
+
// The layouts that apply at a route path, with the page directory the client's
|
|
4069
|
+
// getFarmPageDirectory reads from the route matched there.
|
|
4070
|
+
function getFarmClientBootLayouts(routePathname, matched, page) {
|
|
4071
|
+
const directory = !matched
|
|
4072
|
+
? null
|
|
4073
|
+
: matched.route.meta.docs && !matched.route.meta.directory
|
|
4074
|
+
? page ? page.route.meta.directory || page.route.meta.pattern : null
|
|
4075
|
+
: matched.route.meta.directory || matched.route.meta.pattern;
|
|
4076
|
+
return selectFarmClientLayouts(farmClientLayoutTable, routePathname, function() { return directory; })
|
|
4077
|
+
.map(function(layout) { return layout.pattern; });
|
|
4078
|
+
}
|
|
4079
|
+
` : ""}
|
|
3934
4080
|
// The entries the client's matchRoute and getFarmPageDirectory read for this route path.
|
|
3935
4081
|
function getFarmClientBootRoutes(routePathname) {
|
|
3936
4082
|
if (!farmClientRouteTable || typeof routePathname !== "string") return undefined;
|
|
3937
4083
|
const routes = [];
|
|
3938
4084
|
const matched = farmClientRouteTable.routes.match(routePathname);
|
|
4085
|
+
const page = matched && matched.route.meta.docs ? farmClientRouteTable.pages.match(routePathname) : null;
|
|
3939
4086
|
if (matched) {
|
|
3940
4087
|
routes.push(matched.route.meta);
|
|
3941
|
-
const page = matched.route.meta.docs ? farmClientRouteTable.pages.match(routePathname) : null;
|
|
3942
4088
|
if (page) routes.push(page.route.meta);
|
|
3943
4089
|
}
|
|
3944
|
-
return { path: routePathname, routes: routes };
|
|
4090
|
+
return { path: routePathname, routes: routes${layouts ? ", params: matched ? matched.params : {}, layouts: getFarmClientBootLayouts(routePathname, matched, page)" : ""} };
|
|
4091
|
+
}
|
|
4092
|
+
|
|
4093
|
+
// A status document's: no route matches at its path.
|
|
4094
|
+
function getFarmClientStatusBootRoutes(routePathname) {
|
|
4095
|
+
return { path: routePathname, routes: []${layouts ? ", params: {}, layouts: getFarmClientBootLayouts(routePathname, null, null)" : ""} };
|
|
3945
4096
|
}`;
|
|
3946
4097
|
}
|
|
3947
4098
|
function generateClientPageDirectorySource() {
|
|
@@ -4825,7 +4976,7 @@ function readFarmEntryImports(source) {
|
|
|
4825
4976
|
for (const match of source.matchAll(/^import\s+([^"';]+?)\s+from\s+(["'][^"']+["'])/gm)) {
|
|
4826
4977
|
const from = match[2];
|
|
4827
4978
|
const named = /\{([^}]*)\}/.exec(match[1]);
|
|
4828
|
-
for (const specifier of _nullishCoalesce(_optionalChain([named, 'optionalAccess',
|
|
4979
|
+
for (const specifier of _nullishCoalesce(_optionalChain([named, 'optionalAccess', _128 => _128[1], 'optionalAccess', _129 => _129.split, 'call', _130 => _130(",")]), () => ( []))) {
|
|
4829
4980
|
const [imported, local] = specifier.trim().split(/\s+as\s+/);
|
|
4830
4981
|
if (imported)
|
|
4831
4982
|
bindings.push({ local: _nullishCoalesce(local, () => ( imported)), clause: `{ ${specifier.trim()} }`, from });
|
|
@@ -4837,40 +4988,82 @@ function readFarmEntryImports(source) {
|
|
|
4837
4988
|
}
|
|
4838
4989
|
return bindings;
|
|
4839
4990
|
}
|
|
4840
|
-
|
|
4991
|
+
var FARM_LAZY_ROOT_STUB = `let farmRootLoading = null;
|
|
4992
|
+
function loadFarmRoot() {
|
|
4993
|
+
return farmRootLoading || (farmRootLoading = import("./farm-client-root").catch(function(error) {
|
|
4994
|
+
farmRootLoading = null;
|
|
4995
|
+
throw error;
|
|
4996
|
+
}));
|
|
4997
|
+
}
|
|
4998
|
+
`;
|
|
4999
|
+
var FARM_ROOT_MODULE_EXPORTS = [
|
|
5000
|
+
"createMatchedHydrationRoute",
|
|
5001
|
+
"hydrateFarmRoute",
|
|
5002
|
+
"renderFarmRoute",
|
|
5003
|
+
"farmTreeLayoutsReady",
|
|
5004
|
+
"loadRouteComponent",
|
|
5005
|
+
"createLayoutPageBoundary",
|
|
5006
|
+
"createFarmRouteState"
|
|
5007
|
+
];
|
|
5008
|
+
function takeFarmEntryRegions(code, kind) {
|
|
4841
5009
|
const regions = [];
|
|
4842
|
-
const
|
|
4843
|
-
|
|
4844
|
-
(_,
|
|
4845
|
-
regions.push(
|
|
5010
|
+
const rest = code.replace(
|
|
5011
|
+
new RegExp(`/\\*farm-${kind}-start\\*/([\\s\\S]*?)/\\*farm-${kind}-end\\*/\\n?`, "g"),
|
|
5012
|
+
(_, body) => {
|
|
5013
|
+
regions.push(body);
|
|
4846
5014
|
return "";
|
|
4847
5015
|
}
|
|
4848
5016
|
);
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
5017
|
+
return { rest, body: regions.join("\n") };
|
|
5018
|
+
}
|
|
5019
|
+
function splitFarmClientEntry(code) {
|
|
5020
|
+
const router = takeFarmEntryRegions(code, "router");
|
|
5021
|
+
const root = takeFarmEntryRegions(router.rest, "root");
|
|
5022
|
+
const splitsRoot = root.body !== "";
|
|
5023
|
+
const eager = splitsRoot ? root.rest.replace(
|
|
5024
|
+
/\/\*farm-root-stub-start\*\/[\s\S]*?\/\*farm-root-stub-end\*\/\n?/,
|
|
5025
|
+
() => FARM_LAZY_ROOT_STUB
|
|
5026
|
+
) : root.rest;
|
|
5027
|
+
const declared = {
|
|
5028
|
+
router: readFarmEntryDeclarations(router.body),
|
|
5029
|
+
root: readFarmEntryDeclarations(root.body),
|
|
5030
|
+
entry: readFarmEntryDeclarations(eager)
|
|
5031
|
+
};
|
|
4852
5032
|
const eagerCode = eager.replace(/^import\s[^;]*;/gm, "");
|
|
4853
5033
|
const usedByEntry = (name) => bindingPattern(name).test(eagerCode);
|
|
4854
|
-
const
|
|
4855
|
-
const
|
|
4856
|
-
const
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
5034
|
+
const eagerImports = readFarmEntryImports(eager);
|
|
5035
|
+
const fromEntry = /* @__PURE__ */ new Set();
|
|
5036
|
+
const link = (body, own) => {
|
|
5037
|
+
const uses = (name) => !own.has(name) && bindingPattern(name).test(body);
|
|
5038
|
+
const lines = [];
|
|
5039
|
+
const shared = [];
|
|
5040
|
+
for (const binding of eagerImports.filter((candidate) => uses(candidate.local))) {
|
|
5041
|
+
if (usedByEntry(binding.local)) shared.push(binding.local);
|
|
5042
|
+
else lines.push(`import ${binding.clause} from ${binding.from};`);
|
|
5043
|
+
}
|
|
5044
|
+
for (const name of declared.entry) if (uses(name)) shared.push(name);
|
|
5045
|
+
const names = [...new Set(shared)];
|
|
5046
|
+
for (const name of names) fromEntry.add(name);
|
|
5047
|
+
if (names.length > 0) lines.push(`import { ${names.join(", ")} } from "./farm-client-entry";`);
|
|
5048
|
+
return lines;
|
|
5049
|
+
};
|
|
5050
|
+
const routerImports = link(router.body, declared.router);
|
|
5051
|
+
const rootImports = splitsRoot ? link(root.body, declared.root) : [];
|
|
5052
|
+
const crossing = (body, names) => [...names].filter((name) => !declared.entry.has(name) && bindingPattern(name).test(body));
|
|
5053
|
+
const crossed = splitsRoot ? [...crossing(root.body, declared.router), ...crossing(router.body, declared.root)] : [];
|
|
5054
|
+
if (crossed.length > 0) {
|
|
5055
|
+
throw new Error(
|
|
5056
|
+
`The client entry's router and root code use ${crossed.join(", ")} from each other. Keep what both use outside the \`farm-router\` and \`farm-root\` regions.`
|
|
5057
|
+
);
|
|
5058
|
+
}
|
|
4863
5059
|
return {
|
|
4864
5060
|
entry: `${eager.replace("/*farm-router-stub*/", FARM_LAZY_ROUTER_STUB)}
|
|
4865
|
-
export { ${
|
|
5061
|
+
export { ${[...fromEntry].join(", ")} };
|
|
4866
5062
|
`,
|
|
4867
|
-
router: [
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
"export { spaRouter };",
|
|
4872
|
-
""
|
|
4873
|
-
].join("\n")
|
|
5063
|
+
router: [...routerImports, router.body, "export { spaRouter };", ""].join("\n"),
|
|
5064
|
+
root: splitsRoot ? [...rootImports, root.body, `export { ${FARM_ROOT_MODULE_EXPORTS.join(", ")} };`, ""].join(
|
|
5065
|
+
"\n"
|
|
5066
|
+
) : void 0
|
|
4874
5067
|
};
|
|
4875
5068
|
}
|
|
4876
5069
|
var FARM_SEGMENT_NAVIGATION_SERVER_RUNTIME = `
|
|
@@ -4900,7 +5093,7 @@ var FARM_DOCUMENT_PARSED_RUNTIME = `function farmDocumentParsed() {
|
|
|
4900
5093
|
}
|
|
4901
5094
|
|
|
4902
5095
|
`;
|
|
4903
|
-
function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlots, root, srcDir, docsSearchEnabled, docsSearchModuleId, docsEntryPath,
|
|
5096
|
+
function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlots, root, srcDir, docsSearchEnabled, docsSearchModuleId, docsEntryPath, docsAdapterUI, i18nConfig = {
|
|
4904
5097
|
enabled: false,
|
|
4905
5098
|
basePath: "/",
|
|
4906
5099
|
locales: ["en"],
|
|
@@ -4918,7 +5111,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
4918
5111
|
secure: false
|
|
4919
5112
|
},
|
|
4920
5113
|
direction: {}
|
|
4921
|
-
}, plugins = [], renderer =
|
|
5114
|
+
}, plugins = [], renderer = _chunk3OKSEJ33cjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule, islandValues = false, platform, serverStylesheets = []) {
|
|
4922
5115
|
const toImportPath = (targetPath) => targetPath.replace(/\\/g, "/");
|
|
4923
5116
|
const clientPluginEntry = _chunkDMSXZNQRcjs.generateFarmClientPluginEntryCode.call(void 0,
|
|
4924
5117
|
plugins,
|
|
@@ -4927,9 +5120,11 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
|
|
|
4927
5120
|
publicRuntimeConfig,
|
|
4928
5121
|
platform
|
|
4929
5122
|
);
|
|
4930
|
-
const appSetupPath =
|
|
4931
|
-
const lazyRenderer = islandValues && platform !== "mobile" &&
|
|
4932
|
-
const
|
|
5123
|
+
const appSetupPath = _chunk3OKSEJ33cjs.resolveFarmRendererAppSetup.call(void 0, root, renderer);
|
|
5124
|
+
const lazyRenderer = islandValues && platform !== "mobile" && _chunk3OKSEJ33cjs.isReactRenderer.call(void 0, renderer) && clientRouteSlots.length === 0;
|
|
5125
|
+
const lazyRoot = islandValues && platform !== "mobile";
|
|
5126
|
+
const lazyMatcher = lazyRoot && clientPages.length > 0;
|
|
5127
|
+
const rendererClientImports = lazyRenderer ? `import { holdFarmIslandInteractions, restorePagePosition, watchFarmIslandTriggers } from "@farm.js/core/internal/client-runtime";` : _chunk3OKSEJ33cjs.isReactRenderer.call(void 0, renderer) ? `import React from "react";
|
|
4933
5128
|
import { createRoot, hydrateRoot } from "react-dom/client";
|
|
4934
5129
|
import { restorePagePosition } from "@farm.js/core/internal/client-runtime";` : (
|
|
4935
5130
|
// Named exports only, as the server entry and the development client read them. A copy
|
|
@@ -4942,8 +5137,8 @@ __farmConfigureApp(__farmAppSetup);` : `import * as __farmRendererClient from ${
|
|
|
4942
5137
|
import { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};
|
|
4943
5138
|
const React = { ...__farmRendererClient };`
|
|
4944
5139
|
);
|
|
4945
|
-
const hydrateFarmRouteCall =
|
|
4946
|
-
const providerClientCode =
|
|
5140
|
+
const hydrateFarmRouteCall = _chunk3OKSEJ33cjs.isReactRenderer.call(void 0, renderer) ? "return hydrateRoot(container, route.element);" : "return route.layouts.length > 0 ? hydrateRoot(container, route.element, route) : hydrateRoot(container, route.element);";
|
|
5141
|
+
const providerClientCode = _chunkOFVBMS6Icjs.generateFarmIntegrationProviderClientCode.call(void 0,
|
|
4947
5142
|
integrationProviders,
|
|
4948
5143
|
root,
|
|
4949
5144
|
_nullishCoalesce(renderer.componentExtensions, () => ( []))
|
|
@@ -4965,24 +5160,35 @@ const React = { ...__farmRendererClient };`
|
|
|
4965
5160
|
).join("\n");
|
|
4966
5161
|
const layoutImportStatements = [];
|
|
4967
5162
|
const layoutRegistrations = [];
|
|
5163
|
+
const layoutComponents = [];
|
|
4968
5164
|
const hydratingLayoutPatterns = layoutRoutes.filter((layout) => layout.shouldHydrate).map((layout) => layout.pattern);
|
|
4969
|
-
const treeLayoutPatterns = islandValues ?
|
|
5165
|
+
const treeLayoutPatterns = islandValues ? _chunk4B6YJ5DScjs.getFarmServerTreeLayoutPatterns.call(void 0, layoutRoutes) : /* @__PURE__ */ new Set();
|
|
4970
5166
|
layoutRoutes.forEach((layout, index) => {
|
|
4971
5167
|
const relativePath = toImportPath(layout.modulePath);
|
|
4972
5168
|
const treeLayout = treeLayoutPatterns.has(layout.pattern);
|
|
4973
5169
|
const rendersOnClient = treeLayout || !layout.hasIsolatedClientBoundaries && hydratingLayoutPatterns.some(
|
|
4974
|
-
(pattern) =>
|
|
5170
|
+
(pattern) => _chunk4B6YJ5DScjs.layoutsCanCoverSamePage.call(void 0, layout.pattern, pattern)
|
|
4975
5171
|
);
|
|
4976
5172
|
if (rendersOnClient && !treeLayout) {
|
|
4977
5173
|
layoutImportStatements.push(`import Layout${index} from "${relativePath}";`);
|
|
4978
5174
|
}
|
|
4979
|
-
const groupScope =
|
|
4980
|
-
const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(
|
|
5175
|
+
const { urlPattern, groupScope } = getFarmClientLayoutMatch(layout.pattern);
|
|
5176
|
+
const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(urlPattern)}, groupScope: ${JSON.stringify(groupScope)}` : "";
|
|
5177
|
+
const component = rendersOnClient ? treeLayout ? `getFarmTreeLayoutComponent(${JSON.stringify(layout.pattern)})` : `Layout${index}` : "null";
|
|
5178
|
+
layoutComponents.push(component);
|
|
4981
5179
|
layoutRegistrations.push(
|
|
4982
|
-
` { pattern: ${JSON.stringify(layout.pattern)}${groupFields}, Component: ${
|
|
5180
|
+
` { pattern: ${JSON.stringify(layout.pattern)}${groupFields}, Component: ${lazyRoot ? "null" : component}, shouldHydrate: ${JSON.stringify(layout.shouldHydrate)}, islandStrategy: ${JSON.stringify(layout.islandStrategy)}${treeLayout ? ", serverTree: true" : ""} }`
|
|
4983
5181
|
);
|
|
4984
5182
|
});
|
|
4985
5183
|
const layoutImports = layoutImportStatements.join("\n");
|
|
5184
|
+
const layoutComponentsRuntime = lazyRoot && layoutComponents.some((component) => component !== "null") ? `/*farm-root-start*/
|
|
5185
|
+
${layoutImports}
|
|
5186
|
+
// The layouts' components, which only a page or layout root renders.
|
|
5187
|
+
[${layoutComponents.join(", ")}].forEach(function(Component, index) {
|
|
5188
|
+
layoutRoutes[index].Component = Component;
|
|
5189
|
+
});
|
|
5190
|
+
/*farm-root-end*/
|
|
5191
|
+
` : "";
|
|
4986
5192
|
const hasServerTreeLayouts = treeLayoutPatterns.size > 0;
|
|
4987
5193
|
const i18nRoutingConfig = {
|
|
4988
5194
|
locales: i18nConfig.locales,
|
|
@@ -5038,9 +5244,11 @@ function isFarmDocsPath() {
|
|
|
5038
5244
|
return false;
|
|
5039
5245
|
}
|
|
5040
5246
|
`;
|
|
5041
|
-
const docsAdapterRuntime =
|
|
5042
|
-
|
|
5043
|
-
docsConfigModule
|
|
5247
|
+
const docsAdapterRuntime = _chunkXJDB564Acjs.generateFarmDocsAdapterClientRuntime.call(void 0,
|
|
5248
|
+
docsAdapterUI,
|
|
5249
|
+
docsConfigModule,
|
|
5250
|
+
// Config resolution keeps an adapter to its UI's renderer, so this is the UI's renderer too.
|
|
5251
|
+
_chunk3OKSEJ33cjs.isReactRenderer.call(void 0, renderer) ? void 0 : renderer.client
|
|
5044
5252
|
);
|
|
5045
5253
|
if (clientPages.length === 0 && clientRouteSlots.length === 0 && !providerClientCode.hasProviders) {
|
|
5046
5254
|
return `
|
|
@@ -5064,7 +5272,7 @@ mountFarmDocsSearch();
|
|
|
5064
5272
|
|
|
5065
5273
|
${generateUniversalRouterStateRuntime()}
|
|
5066
5274
|
|
|
5067
|
-
${
|
|
5275
|
+
${_chunkOFVBMS6Icjs.FARM_NAVIGATION_SCRIPT_SOURCE}
|
|
5068
5276
|
|
|
5069
5277
|
// SPA Router for server-rendered pages (HTML swap)
|
|
5070
5278
|
const spaRouter = {
|
|
@@ -5367,6 +5575,7 @@ installFarmLinkPrefetch();
|
|
|
5367
5575
|
}
|
|
5368
5576
|
});
|
|
5369
5577
|
const isolatedHydrationEnabled = isolatedBoundaryModules.size > 0;
|
|
5578
|
+
const rendererIslands = isolatedHydrationEnabled && !islandValues && !_chunk3OKSEJ33cjs.isReactRenderer.call(void 0, renderer) && _chunk3OKSEJ33cjs.getFarmRendererCapabilities.call(void 0, renderer).islands;
|
|
5370
5579
|
const serverTreeEnabled = isolatedHydrationEnabled && clientPages.some((page) => page.serverTree);
|
|
5371
5580
|
const islandsRuntimeExports = [
|
|
5372
5581
|
"createFarmIsolatedHydrationRuntime",
|
|
@@ -5406,7 +5615,7 @@ function loadFarmRenderer() {
|
|
|
5406
5615
|
}));
|
|
5407
5616
|
}
|
|
5408
5617
|
` : "";
|
|
5409
|
-
const isolatedHydrationImport = lazyRenderer ? "" : isolatedHydrationEnabled ? `${islandValues ? `import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph, createFarmServerTreeElement${hasServerTreeLayouts ? ", createFarmServerTreeLayout" : ""} } from "@farm.js/core/internal/islands-runtime";` : 'import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph } from "@farm.js/core/internal/isolated-boundary";'}${serverTreeEnabled && !islandValues ? '\nimport { createFarmServerTreeElement } from "@farm.js/core/internal/server-tree";' : ""}` : "";
|
|
5618
|
+
const isolatedHydrationImport = lazyRenderer ? "" : rendererIslands ? 'import { createFarmRendererIslandRuntime } from "@farm.js/core/internal/renderer-islands";' : isolatedHydrationEnabled ? `${islandValues ? `import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph, createFarmServerTreeElement${hasServerTreeLayouts ? ", createFarmServerTreeLayout" : ""} } from "@farm.js/core/internal/islands-runtime";` : 'import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph } from "@farm.js/core/internal/isolated-boundary";'}${serverTreeEnabled && !islandValues ? '\nimport { createFarmServerTreeElement } from "@farm.js/core/internal/server-tree";' : ""}` : "";
|
|
5410
5619
|
const isolatedHydrationRuntime = isolatedHydrationEnabled ? `const farmIsolatedBoundaryLoaders = {
|
|
5411
5620
|
${Array.from(isolatedBoundaryModules.entries()).map(
|
|
5412
5621
|
([reference, modulePath]) => ` ${JSON.stringify(reference)}: () => import(${JSON.stringify(modulePath)}),`
|
|
@@ -5482,7 +5691,15 @@ const farmIsolatedHydrationRuntime = {
|
|
|
5482
5691
|
endStream: function(root) {
|
|
5483
5692
|
whenFarmIslandsRuntime(root, function(runtime) { runtime.endStream(root); });
|
|
5484
5693
|
},
|
|
5485
|
-
};` : `const farmIsolatedHydrationRuntime =
|
|
5694
|
+
};` : rendererIslands ? `const farmIsolatedHydrationRuntime = createFarmRendererIslandRuntime({
|
|
5695
|
+
renderer: React,
|
|
5696
|
+
load: loadFarmIsolatedBoundary,
|
|
5697
|
+
schedule: scheduleFarmIslandHydration,
|
|
5698
|
+
});
|
|
5699
|
+
|
|
5700
|
+
// A hydrating layout keeps a page that doesn't hydrate as server HTML in a plain element. The
|
|
5701
|
+
// renderer's root never renders the page's islands, so the runtime starts them after each render.
|
|
5702
|
+
const FarmServerPage = "div";` : `const farmIsolatedHydrationRuntime = createFarmIsolatedHydrationRuntime({
|
|
5486
5703
|
ReactRuntime: React,
|
|
5487
5704
|
hydrateRoot,
|
|
5488
5705
|
load: loadFarmIsolatedBoundary,
|
|
@@ -5500,7 +5717,15 @@ function disposeFarmIsolatedClientBoundaries(scope) {
|
|
|
5500
5717
|
async function hydrateFarmIsolatedClientBoundaries(scope = document, signal) {
|
|
5501
5718
|
await farmIsolatedHydrationRuntime.hydrate(scope, signal);
|
|
5502
5719
|
}
|
|
5503
|
-
${
|
|
5720
|
+
${rendererIslands ? `
|
|
5721
|
+
// After a hydrating layout renders another page: release the islands whose markup it replaced,
|
|
5722
|
+
// and start the new page's.
|
|
5723
|
+
async function hydrateFarmLayoutPageIslands(container) {
|
|
5724
|
+
farmIsolatedHydrationRuntime.prune();
|
|
5725
|
+
await hydrateFarmIsolatedClientBoundaries(container);
|
|
5726
|
+
}
|
|
5727
|
+
` : ""}${serverTreeEnabled ? `
|
|
5728
|
+
/*farm-root-start*/
|
|
5504
5729
|
// A server-tree page (an async page below a hydrating layout) rebuilds in the layout's root.
|
|
5505
5730
|
async function createFarmServerTreePageElement(source, pathname) {
|
|
5506
5731
|
try {
|
|
@@ -5514,8 +5739,11 @@ async function createFarmServerTreePageElement(source, pathname) {
|
|
|
5514
5739
|
console.warn("[Farm.js] Could not rebuild the server tree of " + pathname + "; its server HTML was kept.", error);
|
|
5515
5740
|
return null;
|
|
5516
5741
|
}
|
|
5517
|
-
}
|
|
5518
|
-
|
|
5742
|
+
}
|
|
5743
|
+
/*farm-root-end*/` : "\n/*farm-root-start*/\nasync function createFarmServerTreePageElement() { return null; }\n/*farm-root-end*/"}` : `/*farm-root-start*/
|
|
5744
|
+
async function createFarmServerTreePageElement() { return null; }
|
|
5745
|
+
/*farm-root-end*/`;
|
|
5746
|
+
const routeClientGraphRuntime = isolatedHydrationEnabled && !rendererIslands ? `function wrapFarmRouteClientGraph(element) {
|
|
5519
5747
|
return wrapFarmIsolatedClientGraph(React, element);
|
|
5520
5748
|
}` : `function wrapFarmRouteClientGraph(element) { return element; }`;
|
|
5521
5749
|
clientRouteSlots.forEach((slot, index) => {
|
|
@@ -5534,13 +5762,13 @@ async function createFarmServerTreePageElement(source, pathname) {
|
|
|
5534
5762
|
return `
|
|
5535
5763
|
// Farm.js Client Runtime - SPA with Hydration
|
|
5536
5764
|
${cssImport}
|
|
5537
|
-
${layoutImports}
|
|
5765
|
+
${lazyRoot ? "" : layoutImports}
|
|
5538
5766
|
${rendererClientImports}
|
|
5539
5767
|
${isolatedHydrationImport}
|
|
5540
5768
|
${providerClientCode.imports}
|
|
5541
5769
|
import { createClientCancellation, createClientPluginManager, createPluginlessClientRuntime, getFarmIslandValueHeaders, getHashTargetElement, keepFarmIslandValues, installChunkErrorRecovery, installFarmLinkPrefetch, isFarmBlockedNavigationURL, isFarmExternalNavigationURL, readFarmLinkNavigateOptions, rememberFarmLinkLocale, reconcileFarmDocumentHead, replayFarmQueuedInteraction, runFarmNavigationDelegates, scheduleFarmIslandHydration, createFarmSearchParams, searchParamsToObject, setFarmBasePath, setFarmTrailingSlashPreference, stripFarmBasePath } from "@farm.js/core/internal/client-runtime";
|
|
5542
5770
|
import { createFarmDeploymentMismatchError, createFarmDeploymentRequestHeaders, isFarmDeploymentMismatchResponse } from "@farm.js/core/deployment";
|
|
5543
|
-
import { createFarmRouter, isFarmRouteActive, matchFarmRoute } from "@farm.js/core/router";
|
|
5771
|
+
${lazyMatcher ? "" : 'import { createFarmRouter, isFarmRouteActive, matchFarmRoute } from "@farm.js/core/router";'}
|
|
5544
5772
|
${clientPluginEntry.imports}
|
|
5545
5773
|
${clientCachePersistence.imports}
|
|
5546
5774
|
${i18nClientRuntime}
|
|
@@ -5564,7 +5792,8 @@ ${routeLoaders.join("\n")}
|
|
|
5564
5792
|
${generateFarmClientRouteTableRuntime({
|
|
5565
5793
|
table: clientPages.length > 0,
|
|
5566
5794
|
docs: clientPages.some((page) => page.docs),
|
|
5567
|
-
streamNavigations: islandValues
|
|
5795
|
+
streamNavigations: islandValues,
|
|
5796
|
+
lazyMatcher
|
|
5568
5797
|
})}
|
|
5569
5798
|
${generateClientPageDirectorySource()}
|
|
5570
5799
|
|
|
@@ -5580,44 +5809,10 @@ const layoutRoutes = [
|
|
|
5580
5809
|
${layoutRegistrations.join(",\n")}
|
|
5581
5810
|
];
|
|
5582
5811
|
|
|
5583
|
-
|
|
5584
|
-
function getApplicableLayouts(pathname) {
|
|
5585
|
-
const applicable = [];
|
|
5586
|
-
const normalizedPath = getFarmRoutePathname(pathname).replace(/\\/$/, '') || '/';
|
|
5587
|
-
let directory;
|
|
5588
|
-
|
|
5589
|
-
for (const layout of layoutRoutes) {
|
|
5590
|
-
// Route groups add no URL segment: match the layout's URL, then keep a
|
|
5591
|
-
// grouped layout to the pages inside its group directory.
|
|
5592
|
-
const urlPattern = layout.urlPattern || layout.pattern;
|
|
5593
|
-
if (urlPattern !== '/' && !isFarmRouteActive(urlPattern, normalizedPath, { exact: false })) continue;
|
|
5594
|
-
if (layout.groupScope) {
|
|
5595
|
-
if (directory === undefined) directory = getFarmPageDirectory(pathname);
|
|
5596
|
-
if (
|
|
5597
|
-
typeof directory !== 'string' ||
|
|
5598
|
-
(directory !== layout.groupScope && !directory.startsWith(layout.groupScope + '/'))
|
|
5599
|
-
) continue;
|
|
5600
|
-
}
|
|
5601
|
-
applicable.push(layout);
|
|
5602
|
-
}
|
|
5603
|
-
|
|
5604
|
-
// Sort by depth (root first)
|
|
5605
|
-
applicable.sort(function(a, b) {
|
|
5606
|
-
const depthA = a.pattern.split('/').filter(Boolean).length;
|
|
5607
|
-
const depthB = b.pattern.split('/').filter(Boolean).length;
|
|
5608
|
-
return depthA - depthB;
|
|
5609
|
-
});
|
|
5610
|
-
|
|
5611
|
-
return applicable;
|
|
5612
|
-
}
|
|
5812
|
+
${generateFarmClientRouteMatchSource({ lazyMatcher })}
|
|
5613
5813
|
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
return layout.shouldHydrate === true;
|
|
5617
|
-
});
|
|
5618
|
-
}
|
|
5619
|
-
|
|
5620
|
-
${_chunkARORZ3MHcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
|
|
5814
|
+
${layoutComponentsRuntime}/*farm-root-start*/
|
|
5815
|
+
${_chunkOFVBMS6Icjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
|
|
5621
5816
|
// Wrap a page element with applicable layouts
|
|
5622
5817
|
function wrapWithLayouts(pageElement, pathname, params) {
|
|
5623
5818
|
const layouts = getApplicableLayouts(pathname);
|
|
@@ -5652,7 +5847,7 @@ function createLayoutPageBoundary(route, pageElement, serverHtml) {
|
|
|
5652
5847
|
return React.createElement("div", props, pageElement);
|
|
5653
5848
|
}
|
|
5654
5849
|
let farmLastRouteState = null;
|
|
5655
|
-
${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${
|
|
5850
|
+
${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${_chunkOFVBMS6Icjs.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE}
|
|
5656
5851
|
function farmTreeLayoutsOf(pathname) {
|
|
5657
5852
|
return getApplicableLayouts(pathname).filter(function(layout) {
|
|
5658
5853
|
return layout.serverTree === true;
|
|
@@ -5682,15 +5877,9 @@ function prepareFarmTreeLayouts(pathname, params, source) {
|
|
|
5682
5877
|
);
|
|
5683
5878
|
}` : `function farmTreeLayoutsReady() { return true; }
|
|
5684
5879
|
async function prepareFarmTreeLayouts() { return true; }`}
|
|
5880
|
+
/*farm-root-end*/
|
|
5685
5881
|
|
|
5686
|
-
|
|
5687
|
-
function matchRoute(pathname) {
|
|
5688
|
-
const matched = clientRouteMatcher.match(getFarmRoutePathname(pathname));
|
|
5689
|
-
return matched
|
|
5690
|
-
? { route: matched.route.meta, params: matched.params }
|
|
5691
|
-
: null;
|
|
5692
|
-
}
|
|
5693
|
-
|
|
5882
|
+
/*farm-root-start*/
|
|
5694
5883
|
async function loadRouteComponent(route) {
|
|
5695
5884
|
if (!route.load) return null;${lazyRenderer ? `
|
|
5696
5885
|
// A page component renders with React DOM, which loads beside it (RFC 0010).
|
|
@@ -5773,7 +5962,7 @@ async function createMatchedHydrationRoute(matched, pathname, searchParams, navi
|
|
|
5773
5962
|
|
|
5774
5963
|
if (!pageElement) return null;
|
|
5775
5964
|
if (!hydrateLayouts) {
|
|
5776
|
-
${
|
|
5965
|
+
${_chunk3OKSEJ33cjs.isReactRenderer.call(void 0, renderer) ? "if (hydrationContainer) pageElement = restorePagePosition(React, hydrationContainer, pageElement);" : ""}
|
|
5777
5966
|
return createFarmRouteState(pageElement, pathname, params, false);
|
|
5778
5967
|
}
|
|
5779
5968
|
if (matched.route.pageShouldHydrate) {
|
|
@@ -5802,7 +5991,7 @@ function createFarmRouteState(page, pathname, params, includeLayouts) {
|
|
|
5802
5991
|
|
|
5803
5992
|
function hydrateFarmRoute(container, route) {
|
|
5804
5993
|
farmLastRouteState = route;
|
|
5805
|
-
${
|
|
5994
|
+
${_chunk3OKSEJ33cjs.getFarmRendererCapabilities.call(void 0, renderer).hydrationFallback ? `try {
|
|
5806
5995
|
${hydrateFarmRouteCall}
|
|
5807
5996
|
} catch (error) {
|
|
5808
5997
|
// The renderer opted in with capabilities.hydrationFallback, as development always does. The
|
|
@@ -5819,6 +6008,7 @@ function renderFarmRoute(root, route) {
|
|
|
5819
6008
|
if (route.layouts.length > 0 && typeof root.renderRoute === "function") root.renderRoute(route);
|
|
5820
6009
|
else root.render(route.element);
|
|
5821
6010
|
}
|
|
6011
|
+
/*farm-root-end*/
|
|
5822
6012
|
|
|
5823
6013
|
/*farm-router-start*/
|
|
5824
6014
|
function matchesRoutePrefix(pathname, pattern) {
|
|
@@ -6171,8 +6361,7 @@ ${lazyRenderer ? ` // React DOM and islx load with what first renders or hydrat
|
|
|
6171
6361
|
${isolatedHydrationEnabled ? `// Not cancelled with the page: a navigation disposes the islands it removes, and one in a
|
|
6172
6362
|
// layout it keeps still waits for its trigger, as on a page of islands only.
|
|
6173
6363
|
const isolatedHydration =
|
|
6174
|
-
!hasHydratableLayout(pathname)
|
|
6175
|
-
document.querySelector('f-island[src]')
|
|
6364
|
+
${rendererIslands ? "" : "!hasHydratableLayout(pathname) &&\n "}document.querySelector('f-island[src]')
|
|
6176
6365
|
? hydrateFarmIsolatedClientBoundaries(document)
|
|
6177
6366
|
: Promise.resolve();
|
|
6178
6367
|
await Promise.all([pageHydration, isolatedHydration]);` : "await pageHydration;"}
|
|
@@ -6202,7 +6391,10 @@ function scheduleFarmRouteHydration(matched, pathname, container, serverProps) {
|
|
|
6202
6391
|
}
|
|
6203
6392
|
const searchParams = searchParamsToObject(new URLSearchParams(window.location.search));
|
|
6204
6393
|
const shouldHydrate = !isHydrated && Boolean(container.innerHTML.trim());
|
|
6205
|
-
|
|
6394
|
+
// The code that renders the root loads when its strategy is due (RFC 0013).
|
|
6395
|
+
const farmRoot = await loadFarmRoot();
|
|
6396
|
+
if (hydrationController.signal.aborted || !container.isConnected) return;
|
|
6397
|
+
const routeState = await farmRoot.createMatchedHydrationRoute(
|
|
6206
6398
|
matched,
|
|
6207
6399
|
pathname,
|
|
6208
6400
|
searchParams,
|
|
@@ -6222,7 +6414,7 @@ function scheduleFarmRouteHydration(matched, pathname, container, serverProps) {
|
|
|
6222
6414
|
// navigation, that is not a failure, so error hooks never see it.
|
|
6223
6415
|
if (hydrationController.signal.aborted || !container.isConnected) return;
|
|
6224
6416
|
if (shouldHydrate) {
|
|
6225
|
-
reactRoot = hydrateFarmRoute(container, routeState);
|
|
6417
|
+
reactRoot = farmRoot.hydrateFarmRoute(container, routeState);
|
|
6226
6418
|
reactRootContainer = container;
|
|
6227
6419
|
isHydrated = true;
|
|
6228
6420
|
} else {
|
|
@@ -6230,7 +6422,7 @@ function scheduleFarmRouteHydration(matched, pathname, container, serverProps) {
|
|
|
6230
6422
|
reactRoot = createRoot(container);
|
|
6231
6423
|
reactRootContainer = container;
|
|
6232
6424
|
}
|
|
6233
|
-
renderFarmRoute(reactRoot, routeState);
|
|
6425
|
+
farmRoot.renderFarmRoute(reactRoot, routeState);
|
|
6234
6426
|
}
|
|
6235
6427
|
await farmClientRuntime.completeHydration(hydrationSession);
|
|
6236
6428
|
} catch (error) {
|
|
@@ -6245,6 +6437,14 @@ function scheduleFarmRouteHydration(matched, pathname, container, serverProps) {
|
|
|
6245
6437
|
});
|
|
6246
6438
|
}
|
|
6247
6439
|
|
|
6440
|
+
// The code that renders a page or layout root, which islands mode's web build loads on demand
|
|
6441
|
+
// (RFC 0013) and every other client has here.
|
|
6442
|
+
/*farm-root-stub-start*/
|
|
6443
|
+
function loadFarmRoot() {
|
|
6444
|
+
return Promise.resolve({ ${FARM_ROOT_MODULE_EXPORTS.join(", ")} });
|
|
6445
|
+
}
|
|
6446
|
+
/*farm-root-stub-end*/
|
|
6447
|
+
|
|
6248
6448
|
/*farm-router-start*/
|
|
6249
6449
|
// A layout boundary is the same layout when its key matches: islands mode keys it by pattern and
|
|
6250
6450
|
// params, so a layout whose params change renders again. Other modes compare patterns.
|
|
@@ -6281,7 +6481,7 @@ function fitsSegmentResponse(currentRoot, nextRoot) {
|
|
|
6281
6481
|
return true;
|
|
6282
6482
|
}` : ""}
|
|
6283
6483
|
|
|
6284
|
-
${
|
|
6484
|
+
${_chunkOFVBMS6Icjs.FARM_NAVIGATION_SCRIPT_SOURCE}
|
|
6285
6485
|
|
|
6286
6486
|
function activateNavigationScripts(root) {
|
|
6287
6487
|
for (const script of Array.from(root?.querySelectorAll?.("script") || [])) {
|
|
@@ -6387,7 +6587,7 @@ function getLayoutShell(root, patterns, index) {
|
|
|
6387
6587
|
return shell.innerHTML;
|
|
6388
6588
|
}
|
|
6389
6589
|
|
|
6390
|
-
${islandValues ?
|
|
6590
|
+
${islandValues ? _chunkOFVBMS6Icjs.FARM_REFRESH_FIELDS_SOURCE : ""}function replaceSharedLayoutBoundary(currentRoot, nextRoot, refresh = false) {
|
|
6391
6591
|
// A refresh keeps the islands still on the page: the ones in streamed Suspense content too.
|
|
6392
6592
|
if (refresh) revealFarmStreamedContent(nextRoot);
|
|
6393
6593
|
const currentPatterns = getLayoutPatterns(currentRoot);
|
|
@@ -6520,6 +6720,14 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
6520
6720
|
}
|
|
6521
6721
|
const pathname = url.pathname;
|
|
6522
6722
|
const matched = matchRoute(pathname);
|
|
6723
|
+
// A root that hydrates on load renders with code that loads beside its page (RFC 0013).
|
|
6724
|
+
if (
|
|
6725
|
+
matched &&
|
|
6726
|
+
(matched.route.pageShouldHydrate || hasHydratableLayout(pathname)) &&
|
|
6727
|
+
(matched.route.islandStrategy || "load") === "load"
|
|
6728
|
+
) {
|
|
6729
|
+
void loadFarmRoot().catch(function() {});
|
|
6730
|
+
}
|
|
6523
6731
|
const from = this.currentPath;
|
|
6524
6732
|
if (await this.shouldBlockNavigation({ from, to, action })) {
|
|
6525
6733
|
if (action === "pop") this.revertBlockedPopState(from);
|
|
@@ -6609,23 +6817,22 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
6609
6817
|
}
|
|
6610
6818
|
}
|
|
6611
6819
|
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
matched?.route.navigation === "client-render"
|
|
6615
|
-
|
|
6616
|
-
) {
|
|
6820
|
+
// The code that renders a page loads with the navigation to one (RFC 0013).
|
|
6821
|
+
const farmRoot =
|
|
6822
|
+
!options.refresh && matched?.route.navigation === "client-render" ? await loadFarmRoot() : null;
|
|
6823
|
+
if (farmRoot && farmRoot.farmTreeLayoutsReady(pathname, matched.params)) {
|
|
6617
6824
|
// Navigation itself signals intent, so destination routes load eagerly even
|
|
6618
6825
|
// when their initial document hydration strategy is deferred.
|
|
6619
|
-
const Component = await loadRouteComponent(matched.route);
|
|
6826
|
+
const Component = await farmRoot.loadRouteComponent(matched.route);
|
|
6620
6827
|
if (!this.isCurrentNavigation(navigation, clientNavigation)) return;
|
|
6621
6828
|
const params = matched.params;
|
|
6622
6829
|
const searchParams = searchParamsToObject(url.searchParams);
|
|
6623
6830
|
const props = { params: params, searchParams: createFarmSearchParams(searchParams) };
|
|
6624
6831
|
let pageElement = React.createElement(Component, props);
|
|
6625
6832
|
if (hasHydratableLayout(pathname)) {
|
|
6626
|
-
pageElement = createLayoutPageBoundary(matched.route, pageElement);
|
|
6833
|
+
pageElement = farmRoot.createLayoutPageBoundary(matched.route, pageElement);
|
|
6627
6834
|
}
|
|
6628
|
-
const routeState = createFarmRouteState(
|
|
6835
|
+
const routeState = farmRoot.createFarmRouteState(
|
|
6629
6836
|
pageElement,
|
|
6630
6837
|
pathname,
|
|
6631
6838
|
params,
|
|
@@ -6648,7 +6855,7 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
6648
6855
|
if (!reactRoot) {
|
|
6649
6856
|
setFarmReactRoot(createRoot(container), container);
|
|
6650
6857
|
}
|
|
6651
|
-
renderFarmRoute(reactRoot, routeState);
|
|
6858
|
+
farmRoot.renderFarmRoute(reactRoot, routeState);
|
|
6652
6859
|
}
|
|
6653
6860
|
this.currentPath = to;
|
|
6654
6861
|
});
|
|
@@ -6796,12 +7003,22 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
6796
7003
|
const matched = matchRoute(newPathname);
|
|
6797
7004
|
const hydrateLayouts = hasHydratableLayout(newPathname);
|
|
6798
7005
|
const nextPage = newRoot.querySelector("#__farm_page__");
|
|
7006
|
+
// A root that hydrates on load, or one React already renders, renders with code that loads
|
|
7007
|
+
// with the navigation to it (RFC 0013). One that waits for its trigger loads it then.
|
|
7008
|
+
const farmRoot =
|
|
7009
|
+
matched &&
|
|
7010
|
+
(hydrateLayouts || matched.route.pageShouldHydrate) &&
|
|
7011
|
+
((matched.route.islandStrategy || "load") === "load" ||
|
|
7012
|
+
(hydrateLayouts && reactRoot && reactRootContainer === currentRoot))
|
|
7013
|
+
? await loadFarmRoot()
|
|
7014
|
+
: null;
|
|
7015
|
+
if (!isNavigationCurrent()) return false;
|
|
6799
7016
|
|
|
6800
7017
|
// If React already owns the shared layout, update that root. React keeps
|
|
6801
7018
|
// matching layout component instances and their state mounted.
|
|
6802
|
-
if (matched && hydrateLayouts && reactRoot && reactRootContainer === currentRoot) {
|
|
7019
|
+
if (matched && hydrateLayouts && reactRoot && reactRootContainer === currentRoot && farmRoot) {
|
|
6803
7020
|
const searchParams = searchParamsToObject(targetUrl.searchParams);
|
|
6804
|
-
const routeState = await createMatchedHydrationRoute(
|
|
7021
|
+
const routeState = await farmRoot.createMatchedHydrationRoute(
|
|
6805
7022
|
matched,
|
|
6806
7023
|
newPathname,
|
|
6807
7024
|
searchParams,
|
|
@@ -6811,9 +7028,9 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
6811
7028
|
);
|
|
6812
7029
|
if (!isNavigationCurrent()) return false;
|
|
6813
7030
|
if (routeState) {
|
|
6814
|
-
renderFarmRoute(reactRoot, routeState);
|
|
7031
|
+
farmRoot.renderFarmRoute(reactRoot, routeState);
|
|
6815
7032
|
window.__FARM_ROUTE_SLOTS__ = nextRouteSlots;
|
|
6816
|
-
setFarmHydrated();
|
|
7033
|
+
setFarmHydrated();${rendererIslands ? "\n await hydrateFarmLayoutPageIslands(currentRoot);" : ""}
|
|
6817
7034
|
return true;
|
|
6818
7035
|
}
|
|
6819
7036
|
}
|
|
@@ -6860,7 +7077,8 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
6860
7077
|
);
|
|
6861
7078
|
} else {
|
|
6862
7079
|
const searchParams = searchParamsToObject(targetUrl.searchParams);
|
|
6863
|
-
|
|
7080
|
+
// Without a page or layout root to hydrate, there is no route state.
|
|
7081
|
+
const routeState = farmRoot && await farmRoot.createMatchedHydrationRoute(
|
|
6864
7082
|
matched,
|
|
6865
7083
|
newPathname,
|
|
6866
7084
|
searchParams,
|
|
@@ -6871,7 +7089,7 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
6871
7089
|
);
|
|
6872
7090
|
if (!isNavigationCurrent()) return false;
|
|
6873
7091
|
if (routeState) {
|
|
6874
|
-
setFarmReactRoot(hydrateFarmRoute(pageContainer, routeState), pageContainer);
|
|
7092
|
+
setFarmReactRoot(farmRoot.hydrateFarmRoute(pageContainer, routeState), pageContainer);
|
|
6875
7093
|
setFarmHydrated();
|
|
6876
7094
|
}
|
|
6877
7095
|
}
|
|
@@ -6889,7 +7107,7 @@ ${islandValues ? ` // Islands mode: navigations name the layouts on screen, and
|
|
|
6889
7107
|
console.error("[Farm.js] Hydrating the page's islands failed:", error);
|
|
6890
7108
|
});
|
|
6891
7109
|
}
|
|
6892
|
-
}` : `if (matched.route.hasIsolatedClientBoundaries && !hydrateLayouts) {
|
|
7110
|
+
}` : `if (matched.route.hasIsolatedClientBoundaries${rendererIslands ? "" : " && !hydrateLayouts"}) {
|
|
6893
7111
|
await hydrateFarmIsolatedClientBoundaries(
|
|
6894
7112
|
isolatedHydrationScope,
|
|
6895
7113
|
navigation.controller.signal,
|
|
@@ -7059,7 +7277,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7059
7277
|
const hasScopedPostcssConfig = hasProjectPostcssConfig(root);
|
|
7060
7278
|
let postcssConfigDir;
|
|
7061
7279
|
let tailwindVitePlugin = void 0;
|
|
7062
|
-
const rendererVitePlugins = await
|
|
7280
|
+
const rendererVitePlugins = await _chunk3OKSEJ33cjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, root, {
|
|
7063
7281
|
ssr: true,
|
|
7064
7282
|
buildLifetime: rendererBuildLifetime
|
|
7065
7283
|
});
|
|
@@ -7176,7 +7394,11 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7176
7394
|
}))
|
|
7177
7395
|
);
|
|
7178
7396
|
const instrumentationPath = _chunk3BTN3NP7cjs.resolveFarmInstrumentationFile.call(void 0, root, config.srcDir || "src");
|
|
7179
|
-
const notFoundPath =
|
|
7397
|
+
const notFoundPath = _chunkOFVBMS6Icjs.resolveFarmNotFoundComponentPath.call(void 0,
|
|
7398
|
+
config,
|
|
7399
|
+
appDirs,
|
|
7400
|
+
routeManager.getRendererNotFoundPath()
|
|
7401
|
+
);
|
|
7180
7402
|
if (notFoundPath) _chunk7U4XF76Rcjs.logger.info(`\u{1F4CB} Found custom 404 page: ${notFoundPath}`);
|
|
7181
7403
|
layoutRoutes.sort((a, b) => {
|
|
7182
7404
|
const depthA = a.pattern.split("/").filter(Boolean).length;
|
|
@@ -7197,9 +7419,9 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7197
7419
|
(provider) => provider.component || provider.type === "clerk"
|
|
7198
7420
|
);
|
|
7199
7421
|
const hasObservabilityHandler = !!config.observability && typeof config.observability === "object" && "onEvent" in config.observability;
|
|
7200
|
-
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access',
|
|
7201
|
-
const hasMiddlewareConfig =
|
|
7202
|
-
const hasRouteContextConfig =
|
|
7422
|
+
const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _131 => _131.mdx, 'optionalAccess', _132 => _132.components]));
|
|
7423
|
+
const hasMiddlewareConfig = _chunk4B6YJ5DScjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
|
|
7424
|
+
const hasRouteContextConfig = _chunkBOEDYXAXcjs.hasCustomFarmRouteContext.call(void 0, config);
|
|
7203
7425
|
const hasServerRuntimePlugins = _chunkDMSXZNQRcjs.hasFarmServerRuntimePlugins.call(void 0, config.plugins);
|
|
7204
7426
|
const hasPluginRoutes = hasFarmPluginRoutes(config);
|
|
7205
7427
|
const hasServerCacheConfig = hasFarmServerCacheConfig(config.cache);
|
|
@@ -7209,9 +7431,9 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7209
7431
|
const hasConfiguredRuntimePlugins = Boolean(
|
|
7210
7432
|
hasRuntimeConfigModule && (config.plugins || []).length > 0
|
|
7211
7433
|
);
|
|
7212
|
-
if (
|
|
7434
|
+
if (_chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
|
|
7213
7435
|
const adapterGuardedPaths = new Set(getFarmDocsGuardedPaths(config, middlewareRoutes));
|
|
7214
|
-
|
|
7436
|
+
_chunkUSMRAC72cjs.assertFarmDocsAdapterServesNoGuardedPages.call(void 0,
|
|
7215
7437
|
config.docs,
|
|
7216
7438
|
{ root, srcDir: config.srcDir },
|
|
7217
7439
|
(pathname) => adapterGuardedPaths.has(pathname),
|
|
@@ -7219,9 +7441,9 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7219
7441
|
);
|
|
7220
7442
|
}
|
|
7221
7443
|
const farmDocsCspNonceMarker = _chunk6JHZPB52cjs.createFarmCspNonce.call(void 0, config.security);
|
|
7222
|
-
const farmDocsPrecompiledManifest = _optionalChain([config, 'access',
|
|
7444
|
+
const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _133 => _133.docs, 'optionalAccess', _134 => _134.enabled]) && _chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? await _chunk2RSVYJT6cjs._runWithFarmCspNonce.call(void 0,
|
|
7223
7445
|
farmDocsCspNonceMarker,
|
|
7224
|
-
async () => _optionalChain([config, 'access',
|
|
7446
|
+
async () => _optionalChain([config, 'access', _135 => _135.docs, 'access', _136 => _136.adapter, 'optionalAccess', _137 => _137.server]) ? await _chunkUSMRAC72cjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
|
|
7225
7447
|
root,
|
|
7226
7448
|
srcDir: config.srcDir,
|
|
7227
7449
|
clientEntry: FARM_CLIENT_JS_SRC_PLACEHOLDER,
|
|
@@ -7281,7 +7503,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7281
7503
|
(image) => image.sourceType === "module"
|
|
7282
7504
|
);
|
|
7283
7505
|
const externalMetadataImageRuntime = useExternalMetadataImageRuntime && !omitCoreMetadataImageRuntime ? ["@vercel/og"] : [];
|
|
7284
|
-
const rendererOptionalExternals =
|
|
7506
|
+
const rendererOptionalExternals = _chunk3OKSEJ33cjs.isReactRenderer.call(void 0, config.renderer) ? [] : [
|
|
7285
7507
|
"react",
|
|
7286
7508
|
"react/jsx-runtime",
|
|
7287
7509
|
"react/jsx-dev-runtime",
|
|
@@ -7335,7 +7557,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7335
7557
|
// Adapters can render provider scripts by serializing function source.
|
|
7336
7558
|
// keepNames injects helper calls into those functions; after Nitro
|
|
7337
7559
|
// minifies the server chunk the helper is no longer in script scope.
|
|
7338
|
-
keepNames: !(_optionalChain([config, 'access',
|
|
7560
|
+
keepNames: !(_optionalChain([config, 'access', _138 => _138.docs, 'optionalAccess', _139 => _139.enabled]) && _optionalChain([config, 'access', _140 => _140.docs, 'access', _141 => _141.adapter, 'optionalAccess', _142 => _142.server])),
|
|
7339
7561
|
jsxDev: false
|
|
7340
7562
|
},
|
|
7341
7563
|
// SSR configuration to externalize problematic modules
|
|
@@ -7385,10 +7607,10 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7385
7607
|
define: {
|
|
7386
7608
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
7387
7609
|
__FARM_ENV__: JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, config.env)),
|
|
7388
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
7610
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _143 => _143.env, 'optionalAccess', _144 => _144.public]) || {})
|
|
7389
7611
|
},
|
|
7390
7612
|
plugins: [
|
|
7391
|
-
|
|
7613
|
+
_chunkOFVBMS6Icjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
|
|
7392
7614
|
...tailwindVitePlugin ? [tailwindVitePlugin] : [],
|
|
7393
7615
|
...rendererVitePlugins,
|
|
7394
7616
|
...config.vite.plugins || [],
|
|
@@ -7420,7 +7642,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7420
7642
|
},
|
|
7421
7643
|
pluginManager
|
|
7422
7644
|
),
|
|
7423
|
-
|
|
7645
|
+
_chunkEBSL5TW7cjs.farmEnvironmentFunctionsPlugin.call(void 0, config),
|
|
7424
7646
|
...hasRuntimeConfigModule ? [
|
|
7425
7647
|
farmStripPlatformConfigPlugin(
|
|
7426
7648
|
[
|
|
@@ -7432,7 +7654,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7432
7654
|
{
|
|
7433
7655
|
name: "farm-virtual-ssr-entry",
|
|
7434
7656
|
resolveId: {
|
|
7435
|
-
filter: { id:
|
|
7657
|
+
filter: { id: _chunkOFVBMS6Icjs.exactIdPattern.call(void 0, [virtualEntryId, "\0virtual:farm-ssr-entry"]) },
|
|
7436
7658
|
handler(id) {
|
|
7437
7659
|
if (id === virtualEntryId || id === "\0virtual:farm-ssr-entry") {
|
|
7438
7660
|
return virtualEntryId;
|
|
@@ -7441,7 +7663,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7441
7663
|
}
|
|
7442
7664
|
},
|
|
7443
7665
|
load: {
|
|
7444
|
-
filter: { id:
|
|
7666
|
+
filter: { id: _chunkOFVBMS6Icjs.exactIdPattern.call(void 0, [virtualEntryId]) },
|
|
7445
7667
|
handler(id) {
|
|
7446
7668
|
if (id === virtualEntryId) {
|
|
7447
7669
|
return virtualEntryCode;
|
|
@@ -7473,7 +7695,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7473
7695
|
resolve: {
|
|
7474
7696
|
alias: [
|
|
7475
7697
|
...shouldAliasReactServerToWebBuild(config.renderer, preset) ? [createFarmReactWebServerAlias(hasReactDomEdgeServerBuild(root))] : [],
|
|
7476
|
-
...Object.entries(
|
|
7698
|
+
...Object.entries(_chunkOFVBMS6Icjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
|
|
7477
7699
|
([find, replacement]) => ({ find, replacement })
|
|
7478
7700
|
)
|
|
7479
7701
|
],
|
|
@@ -7481,12 +7703,12 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7481
7703
|
dedupe: [...config.renderer.dedupe || []]
|
|
7482
7704
|
}
|
|
7483
7705
|
};
|
|
7484
|
-
await viteBuild(
|
|
7706
|
+
await viteBuild(_chunkOFVBMS6Icjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
|
|
7485
7707
|
} finally {
|
|
7486
7708
|
if (postcssConfigDir) {
|
|
7487
7709
|
try {
|
|
7488
7710
|
await fs5.rm(postcssConfigDir, { recursive: true, force: true });
|
|
7489
|
-
} catch (
|
|
7711
|
+
} catch (e36) {
|
|
7490
7712
|
}
|
|
7491
7713
|
}
|
|
7492
7714
|
}
|
|
@@ -7499,7 +7721,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
|
|
|
7499
7721
|
function readFarmAppPackageIdentity(root) {
|
|
7500
7722
|
try {
|
|
7501
7723
|
return JSON.parse(_fs.readFileSync.call(void 0, _path2.default.join(root, "package.json"), "utf8"));
|
|
7502
|
-
} catch (
|
|
7724
|
+
} catch (e37) {
|
|
7503
7725
|
return {};
|
|
7504
7726
|
}
|
|
7505
7727
|
}
|
|
@@ -7511,13 +7733,13 @@ function readFarmPageLastModified(pageRoutes) {
|
|
|
7511
7733
|
lastModified[route.pattern] = _fs.statSync.call(void 0,
|
|
7512
7734
|
_nullishCoalesce(route.markdownSourcePath, () => ( route.modulePath))
|
|
7513
7735
|
).mtime.toISOString();
|
|
7514
|
-
} catch (
|
|
7736
|
+
} catch (e38) {
|
|
7515
7737
|
}
|
|
7516
7738
|
}
|
|
7517
7739
|
return lastModified;
|
|
7518
7740
|
}
|
|
7519
7741
|
function getFarmDocsGuardedPaths(config, middlewareRoutes) {
|
|
7520
|
-
if (!_optionalChain([config, 'access',
|
|
7742
|
+
if (!_optionalChain([config, 'access', _145 => _145.docs, 'optionalAccess', _146 => _146.enabled])) return [];
|
|
7521
7743
|
const options = { root: config.root, srcDir: config.srcDir };
|
|
7522
7744
|
const guards = {
|
|
7523
7745
|
config: { middleware: config.middleware, integrations: config.integrations },
|
|
@@ -7525,18 +7747,18 @@ function getFarmDocsGuardedPaths(config, middlewareRoutes) {
|
|
|
7525
7747
|
};
|
|
7526
7748
|
return _chunkHR5GU4UUcjs.getFarmDocsRoots.call(void 0, config.docs).flatMap(
|
|
7527
7749
|
(docsRoot) => _chunkHR5GU4UUcjs.discoverFarmDocsPages.call(void 0, _chunkHR5GU4UUcjs.resolveFarmDocsContentDir.call(void 0, docsRoot, options), docsRoot)
|
|
7528
|
-
).flatMap((page) => [page.href, _chunkHR5GU4UUcjs.getFarmDocsMarkdownPath.call(void 0, page.href)]).filter((pathname) =>
|
|
7750
|
+
).flatMap((page) => [page.href, _chunkHR5GU4UUcjs.getFarmDocsMarkdownPath.call(void 0, page.href)]).filter((pathname) => _chunk4B6YJ5DScjs.farmPathGuardCoversPage.call(void 0, guards, pathname));
|
|
7529
7751
|
}
|
|
7530
7752
|
function getFarmAppOwnedDocsEnginePaths(agent, applicationMetadataRoutes) {
|
|
7531
|
-
const llmsTxt = _optionalChain([agent, 'optionalAccess',
|
|
7753
|
+
const llmsTxt = _optionalChain([agent, 'optionalAccess', _147 => _147.llmsTxt]);
|
|
7532
7754
|
const ownedByFile = (kind) => applicationMetadataRoutes.some(
|
|
7533
7755
|
(metadata) => metadata.kind === kind && metadata.pattern === "/"
|
|
7534
7756
|
);
|
|
7535
7757
|
return [
|
|
7536
|
-
..._optionalChain([llmsTxt, 'optionalAccess',
|
|
7537
|
-
..._optionalChain([llmsTxt, 'optionalAccess',
|
|
7538
|
-
..._optionalChain([agent, 'optionalAccess',
|
|
7539
|
-
..._optionalChain([agent, 'optionalAccess',
|
|
7758
|
+
..._optionalChain([llmsTxt, 'optionalAccess', _148 => _148.enabled]) || ownedByFile("llms") ? ["/llms.txt"] : [],
|
|
7759
|
+
..._optionalChain([llmsTxt, 'optionalAccess', _149 => _149.enabled]) && llmsTxt.full || ownedByFile("llms-full") ? ["/llms-full.txt"] : [],
|
|
7760
|
+
..._optionalChain([agent, 'optionalAccess', _150 => _150.sitemap, 'optionalAccess', _151 => _151.enabled]) || ownedByFile("sitemap") ? ["/sitemap.xml"] : [],
|
|
7761
|
+
..._optionalChain([agent, 'optionalAccess', _152 => _152.crawlers, 'optionalAccess', _153 => _153.enabled]) || ownedByFile("robots") ? ["/robots.txt"] : []
|
|
7540
7762
|
];
|
|
7541
7763
|
}
|
|
7542
7764
|
function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
@@ -7547,7 +7769,7 @@ function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
|
7547
7769
|
docsPath: ${root}.entry,
|
|
7548
7770
|
contentDir: ${root}.contentDir || ${root}.config?.contentDir,
|
|
7549
7771
|
}`;
|
|
7550
|
-
if (_optionalChain([docs, 'optionalAccess',
|
|
7772
|
+
if (_optionalChain([docs, 'optionalAccess', _154 => _154.roots, 'optionalAccess', _155 => _155.length])) {
|
|
7551
7773
|
return {
|
|
7552
7774
|
factory: "createFarmDocsAdapterMultiRuntimeHandler",
|
|
7553
7775
|
config: `[farmDocsResolvedConfig, ...farmDocsResolvedConfig.roots].map((farmDocsRoot) => (${runtimeConfig("farmDocsRoot")}))`
|
|
@@ -7560,7 +7782,7 @@ function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
|
|
|
7560
7782
|
}
|
|
7561
7783
|
function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
|
|
7562
7784
|
if (!docs.enabled) return "null";
|
|
7563
|
-
const serializableDocs = _optionalChain([docs, 'access',
|
|
7785
|
+
const serializableDocs = _optionalChain([docs, 'access', _156 => _156.roots, 'optionalAccess', _157 => _157.length]) ? {
|
|
7564
7786
|
...docs,
|
|
7565
7787
|
// React elements and functions do not survive JSON; see runtimeConfig below.
|
|
7566
7788
|
roots: docs.roots.map((docsRoot) => ({ ...docsRoot, runtimeConfig: void 0 }))
|
|
@@ -7594,7 +7816,7 @@ function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
|
|
|
7594
7816
|
},
|
|
7595
7817
|
}
|
|
7596
7818
|
: ${JSON.stringify({ ...serializableDocs, runtimeConfig: void 0 })}`;
|
|
7597
|
-
if (!_optionalChain([docs, 'access',
|
|
7819
|
+
if (!_optionalChain([docs, 'access', _158 => _158.roots, 'optionalAccess', _159 => _159.length])) return expression;
|
|
7598
7820
|
return `((farmDocs) => ({
|
|
7599
7821
|
...farmDocs,
|
|
7600
7822
|
roots: farmDocs.roots.map((farmDocsRoot, index) => {
|
|
@@ -7611,7 +7833,7 @@ function toVirtualEntryImportSpecifier(modulePath) {
|
|
|
7611
7833
|
return JSON.stringify(modulePath.replace(/\\/g, "/"));
|
|
7612
7834
|
}
|
|
7613
7835
|
function generateNativeAuthIntegrationSource(auth) {
|
|
7614
|
-
if (_optionalChain([auth, 'optionalAccess',
|
|
7836
|
+
if (_optionalChain([auth, 'optionalAccess', _160 => _160.enabled]) !== true) {
|
|
7615
7837
|
return { importSource: "", registerSource: "" };
|
|
7616
7838
|
}
|
|
7617
7839
|
return {
|
|
@@ -7915,7 +8137,7 @@ async function applyFarmPreloadBudget(response, pathname, request) {
|
|
|
7915
8137
|
`.trim();
|
|
7916
8138
|
}
|
|
7917
8139
|
function generateFarmRendererAppSetupServerCode(config) {
|
|
7918
|
-
const appSetupPath =
|
|
8140
|
+
const appSetupPath = _chunk3OKSEJ33cjs.resolveFarmRendererAppSetup.call(void 0, config.root || process.cwd(), config.renderer);
|
|
7919
8141
|
if (!appSetupPath) return "";
|
|
7920
8142
|
return `
|
|
7921
8143
|
import __farmAppSetup from ${JSON.stringify(_chunk7U4XF76Rcjs.toPosixPath.call(void 0, appSetupPath))};
|
|
@@ -7925,46 +8147,45 @@ if (typeof ReactDOMServer.configureApp !== "function") {
|
|
|
7925
8147
|
ReactDOMServer.configureApp(__farmAppSetup);`;
|
|
7926
8148
|
}
|
|
7927
8149
|
function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlots, errorRoutes, metadataImageRoutes, applicationMetadataRoutes, middlewareRoutes, redirectRoutes, configuredRewriteRoutes, configuredHeaderRoutes, openAPIReference, notFoundPath, instrumentationPath, config, farmDocsPrecompiledManifest, configModulePath, hasServerRuntimeIntegrations, hasRuntimeIntegrationConfig, hasConfiguredRuntimePlugins, hasServerRuntimePlugins, preset, i18nCatalogs, isolatedClientBoundaryModules, hydrationPlanCache, mobileShellLoadingRoutes = [], farmDocsAnalyticsPages = []) {
|
|
7928
|
-
const farmRendererDisabled =
|
|
8150
|
+
const farmRendererDisabled = _chunk3OKSEJ33cjs.isFarmRendererDisabled.call(void 0, config.renderer);
|
|
7929
8151
|
const searchPreserveRoutes = pageRoutes.flatMap(
|
|
7930
8152
|
(route) => route.searchPreserve ? [route.searchPreserve] : []
|
|
7931
8153
|
);
|
|
7932
8154
|
const searchPreserveRoutesSource = searchPreserveRoutes.length > 0 ? JSON.stringify(searchPreserveRoutes) : "";
|
|
7933
|
-
const farmIslandsMode =
|
|
7934
|
-
const farmRendererActions =
|
|
7935
|
-
const farmClientBoot =
|
|
8155
|
+
const farmIslandsMode = _chunk3OKSEJ33cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _161 => _161.experimental, 'optionalAccess', _162 => _162.serverComponents])) === "islands";
|
|
8156
|
+
const farmRendererActions = _chunkOFVBMS6Icjs.resolveFarmIslxActionsMode.call(void 0, config) === "renderer";
|
|
8157
|
+
const farmClientBoot = _chunkOFVBMS6Icjs.canBootFarmIslandsClient.call(void 0, config);
|
|
7936
8158
|
const farmMobileClient = shouldBuildFarmMobileClient(config);
|
|
7937
8159
|
const farmMobileShells = farmMobileClient && config.mobileShells ? config.mobileShells : null;
|
|
7938
8160
|
const hasCompressionRuntime = config.compress && _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) !== "edge";
|
|
7939
|
-
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access',
|
|
8161
|
+
const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access', _163 => _163.agent, 'optionalAccess', _164 => _164.crawlers, 'optionalAccess', _165 => _165.enabled])) && !applicationMetadataRoutes.some(
|
|
7940
8162
|
(metadata) => metadata.kind === "robots" && metadata.pattern === "/"
|
|
7941
8163
|
);
|
|
7942
|
-
const servesAgentSitemap = Boolean(_optionalChain([config, 'access',
|
|
8164
|
+
const servesAgentSitemap = Boolean(_optionalChain([config, 'access', _166 => _166.agent, 'optionalAccess', _167 => _167.sitemap, 'optionalAccess', _168 => _168.enabled])) && !applicationMetadataRoutes.some(
|
|
7943
8165
|
(metadata) => metadata.kind === "sitemap" && metadata.pattern === "/"
|
|
7944
8166
|
);
|
|
7945
|
-
const servesDefaultMCP = _optionalChain([config, 'access',
|
|
7946
|
-
const servesAiCatalog = _optionalChain([config, 'access',
|
|
8167
|
+
const servesDefaultMCP = _optionalChain([config, 'access', _169 => _169.agent, 'optionalAccess', _170 => _170.mcp]) === true && !_chunkW53Z4WDIcjs.farmConfigMountsMCP.call(void 0, config) && !apiRoutes.some((route) => route.path === "/api/mcp");
|
|
8168
|
+
const servesAiCatalog = _optionalChain([config, 'access', _171 => _171.agent, 'optionalAccess', _172 => _172.aiCatalog]) !== false;
|
|
7947
8169
|
const hasPluginRuntime = hasRuntimeIntegrationConfig || hasServerRuntimePlugins;
|
|
7948
8170
|
const hasInfraAnalyticsRuntime = config.analytics !== false && _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
|
|
7949
|
-
const reportsWebMCPCalls = hasInfraAnalyticsRuntime &&
|
|
8171
|
+
const reportsWebMCPCalls = hasInfraAnalyticsRuntime && _chunkZ37PDUJRcjs._farmWebMCPReportsEnabled.call(void 0, config.plugins);
|
|
7950
8172
|
const hasPrecompiledDocs = Boolean(farmDocsPrecompiledManifest);
|
|
7951
|
-
const adapterOwnsDocsRuntime =
|
|
7952
|
-
|
|
7953
|
-
);
|
|
7954
|
-
if (_optionalChain([config, 'access', _183 => _183.docs, 'optionalAccess', _184 => _184.enabled]) && _optionalChain([config, 'access', _185 => _185.docs, 'access', _186 => _186.roots, 'optionalAccess', _187 => _187.length]) && !adapterOwnsDocsRuntime) {
|
|
8173
|
+
const adapterOwnsDocsRuntime = _chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs);
|
|
8174
|
+
if (_optionalChain([config, 'access', _173 => _173.docs, 'optionalAccess', _174 => _174.enabled]) && _optionalChain([config, 'access', _175 => _175.docs, 'access', _176 => _176.roots, 'optionalAccess', _177 => _177.length]) && !adapterOwnsDocsRuntime) {
|
|
7955
8175
|
throw new Error(
|
|
7956
|
-
"Several docs roots need
|
|
8176
|
+
"Several docs roots need a docs adapter; Farm's built-in docs renderer serves a single docs root."
|
|
7957
8177
|
);
|
|
7958
8178
|
}
|
|
7959
8179
|
const docsConfigModulePath = adapterOwnsDocsRuntime && !hasPrecompiledDocs && config.docs.configPath && !config.docs.configPath.endsWith(".json") ? config.docs.configPath : void 0;
|
|
7960
8180
|
const adapterHandler = generateFarmDocsAdapterHandlerArguments(config.docs, docsConfigModulePath);
|
|
7961
|
-
const hasIsolatedClientGraphRuntime =
|
|
7962
|
-
const
|
|
8181
|
+
const hasIsolatedClientGraphRuntime = _chunk3OKSEJ33cjs.isReactRenderer.call(void 0, config.renderer) && isolatedClientBoundaryModules.size > 0;
|
|
8182
|
+
const hasRendererIslandsGraph = isolatedClientBoundaryModules.size > 0 && _chunkMAPHNGTFcjs.usesFarmRendererIslands.call(void 0, config);
|
|
8183
|
+
const rendererStreamingCapabilities = _chunk3OKSEJ33cjs.getFarmRendererStreamingCapabilitiesForRuntime.call(void 0,
|
|
7963
8184
|
config.renderer,
|
|
7964
8185
|
_chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset)
|
|
7965
8186
|
);
|
|
7966
|
-
const hasReactSyncRender =
|
|
7967
|
-
const rendererServerImports =
|
|
8187
|
+
const hasReactSyncRender = _chunk3OKSEJ33cjs.isReactRenderer.call(void 0, config.renderer);
|
|
8188
|
+
const rendererServerImports = _chunk3OKSEJ33cjs.isReactRenderer.call(void 0, config.renderer) ? `import * as React from "react";
|
|
7968
8189
|
import * as ReactDOMServer from "react-dom/server";
|
|
7969
8190
|
import { markPagePosition, markLayoutPosition } from "@farm.js/core/internal/production-runtime";${hasIsolatedClientGraphRuntime ? farmIslandsMode ? '\nimport { isolateFarmServerPageGraph, wrapFarmIsolatedClientGraph, renderFarmServerTreePage, renderFarmServerTreeLayout, withFarmIslandsRender } from "@farm.js/core/internal/islands-runtime";' : '\nimport { isolateFarmServerPageGraph, wrapFarmIsolatedClientGraph } from "@farm.js/core/internal/isolated-boundary";\nimport { renderFarmServerTreePage } from "@farm.js/core/internal/server-tree";' : ""}` : (
|
|
7970
8191
|
// The renderer contract is the server module's named exports, which the development
|
|
@@ -7997,6 +8218,18 @@ function renderFarmRouteServerTree(element, extra) {
|
|
|
7997
8218
|
isolate: isolateFarmRouteServerPage,${farmIslandsMode ? "\n values: true," : ""}
|
|
7998
8219
|
...extra,
|
|
7999
8220
|
});
|
|
8221
|
+
}` : hasRendererIslandsGraph ? `function wrapFarmRouteClientGraph(element) {
|
|
8222
|
+
return typeof ReactDOMServer.wrapClientGraph === "function" ? ReactDOMServer.wrapClientGraph(element) : element;
|
|
8223
|
+
}
|
|
8224
|
+
|
|
8225
|
+
function isolateFarmRouteServerPage(element) {
|
|
8226
|
+
return typeof ReactDOMServer.isolateServerPageGraph === "function" ? ReactDOMServer.isolateServerPageGraph(element) : element;
|
|
8227
|
+
}
|
|
8228
|
+
|
|
8229
|
+
function renderFarmRouteServerTree(element, extra) { return element; }
|
|
8230
|
+
|
|
8231
|
+
function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
8232
|
+
return React.createElement(Layout, { ...props, ...outlets });
|
|
8000
8233
|
}` : `function wrapFarmRouteClientGraph(element) { return element; }
|
|
8001
8234
|
|
|
8002
8235
|
function isolateFarmRouteServerPage(element) { return element; }
|
|
@@ -8010,27 +8243,27 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8010
8243
|
(image) => image.sourceType === "module"
|
|
8011
8244
|
);
|
|
8012
8245
|
const edgeMiddlewareFilePaths = farmTargetRunsEdgeMiddleware(preset) ? middlewareRoutes.filter(isFarmEdgeMiddlewareRoute).map((route) => route.filePath) : [];
|
|
8013
|
-
const hasMiddlewareRuntime = middlewareRoutes.length > 0 ||
|
|
8014
|
-
const farmDocsFontAssets = _optionalChain([config, 'access',
|
|
8246
|
+
const hasMiddlewareRuntime = middlewareRoutes.length > 0 || _chunk4B6YJ5DScjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
|
|
8247
|
+
const farmDocsFontAssets = _optionalChain([config, 'access', _178 => _178.docs, 'optionalAccess', _179 => _179.enabled]) ? _chunkERMUL73Lcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkERMUL73Lcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
|
|
8015
8248
|
const integrationProviders = _chunkB3HQTGXScjs.getIntegrationProviders.call(void 0, config.integrations);
|
|
8016
8249
|
const renderedIntegrationProviders = integrationProviders.filter(
|
|
8017
8250
|
(provider) => provider.component || provider.type === "clerk"
|
|
8018
8251
|
);
|
|
8019
|
-
if (renderedIntegrationProviders.length > 0 && !
|
|
8252
|
+
if (renderedIntegrationProviders.length > 0 && !_chunk3OKSEJ33cjs.getFarmRendererCapabilities.call(void 0, config.renderer).functionComponents) {
|
|
8020
8253
|
throw new Error(
|
|
8021
8254
|
`Integration provider components are not supported by the "${config.renderer.name}" renderer.`
|
|
8022
8255
|
);
|
|
8023
8256
|
}
|
|
8024
|
-
const providerServerModules =
|
|
8257
|
+
const providerServerModules = _chunkOFVBMS6Icjs.generateFarmIntegrationProviderServerModules.call(void 0,
|
|
8025
8258
|
renderedIntegrationProviders,
|
|
8026
8259
|
config.root,
|
|
8027
8260
|
_nullishCoalesce(config.renderer.componentExtensions, () => ( []))
|
|
8028
8261
|
);
|
|
8029
8262
|
const resolvedIntegrationProviderFallback = Object.fromEntries(
|
|
8030
8263
|
Object.entries(config.integrations).flatMap(([name, integration]) => {
|
|
8031
|
-
const configuredProviders = _optionalChain([integration, 'optionalAccess',
|
|
8264
|
+
const configuredProviders = _optionalChain([integration, 'optionalAccess', _180 => _180.providers]);
|
|
8032
8265
|
const providers = Array.isArray(configuredProviders) ? configuredProviders : [];
|
|
8033
|
-
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess',
|
|
8266
|
+
if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess', _181 => _181.component]) === "function")) {
|
|
8034
8267
|
throw new Error(
|
|
8035
8268
|
`Integration provider components in production must use an importable component reference, for example component: { module: "@/components/provider" }.`
|
|
8036
8269
|
);
|
|
@@ -8041,22 +8274,22 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8041
8274
|
const unsupportedIntegrationProvider = renderedIntegrationProviders.find(
|
|
8042
8275
|
(provider) => provider.supportsIsolatedHydration !== true
|
|
8043
8276
|
);
|
|
8044
|
-
const isolatedHydrationMode =
|
|
8045
|
-
_optionalChain([config, 'access',
|
|
8277
|
+
const isolatedHydrationMode = _chunkEBSL5TW7cjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
|
|
8278
|
+
_optionalChain([config, 'access', _182 => _182.experimental, 'optionalAccess', _183 => _183.isolatedClientHydration]),
|
|
8046
8279
|
{
|
|
8047
|
-
serverComponents:
|
|
8280
|
+
serverComponents: _chunk3OKSEJ33cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _184 => _184.experimental, 'optionalAccess', _185 => _185.serverComponents])) === "rsc",
|
|
8048
8281
|
hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
|
|
8049
8282
|
}
|
|
8050
8283
|
);
|
|
8051
|
-
const hydrationPlanOptions =
|
|
8284
|
+
const hydrationPlanOptions = _chunkEBSL5TW7cjs.getFarmClientHydrationPlanOptions.call(void 0,
|
|
8052
8285
|
config.renderer,
|
|
8053
8286
|
Boolean(unsupportedIntegrationProvider)
|
|
8054
8287
|
);
|
|
8055
8288
|
const pageHydrationPlanOptions = {
|
|
8056
8289
|
...hydrationPlanOptions,
|
|
8057
|
-
serverOwners:
|
|
8290
|
+
serverOwners: _chunk3OKSEJ33cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _186 => _186.experimental, 'optionalAccess', _187 => _187.serverComponents])) === "islands"
|
|
8058
8291
|
};
|
|
8059
|
-
const { layoutHydrationPlans, pageHydrationPlans } =
|
|
8292
|
+
const { layoutHydrationPlans, pageHydrationPlans } = _chunkEBSL5TW7cjs.withFarmSourceSnapshot.call(void 0, () => {
|
|
8060
8293
|
const layoutHydrationPlans2 = layoutRoutes.map((layout) => ({
|
|
8061
8294
|
...layout,
|
|
8062
8295
|
hydration: getCachedClientModuleHydrationPlan(
|
|
@@ -8067,7 +8300,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8067
8300
|
{ ...hydrationPlanOptions, serverTreeLayouts: pageHydrationPlanOptions.serverOwners }
|
|
8068
8301
|
)
|
|
8069
8302
|
}));
|
|
8070
|
-
const markdownPagePlan =
|
|
8303
|
+
const markdownPagePlan = _chunkEBSL5TW7cjs.createMarkdownPageHydrationPlanner.call(void 0,
|
|
8071
8304
|
_chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), config.root),
|
|
8072
8305
|
config.root,
|
|
8073
8306
|
isolatedHydrationMode,
|
|
@@ -8087,7 +8320,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8087
8320
|
);
|
|
8088
8321
|
return { layoutHydrationPlans: layoutHydrationPlans2, pageHydrationPlans: pageHydrationPlans2 };
|
|
8089
8322
|
});
|
|
8090
|
-
|
|
8323
|
+
_chunkEBSL5TW7cjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
|
|
8091
8324
|
layoutHydrationPlans.map((layout) => ({
|
|
8092
8325
|
pattern: layout.pattern,
|
|
8093
8326
|
depth: layout.pattern.split("/").filter(Boolean).length,
|
|
@@ -8096,10 +8329,10 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8096
8329
|
pageRoutes.map((route) => ({
|
|
8097
8330
|
// Compared by directory so a grouped layout applies only inside its group.
|
|
8098
8331
|
pattern: _nullishCoalesce(route.directory, () => ( route.pattern)),
|
|
8099
|
-
depth:
|
|
8332
|
+
depth: _chunk4B6YJ5DScjs.getRouteDirectoryDepth.call(void 0, _nullishCoalesce(route.directory, () => ( route.pattern))),
|
|
8100
8333
|
metadata: pageHydrationPlans.get(route.modulePath)
|
|
8101
8334
|
})),
|
|
8102
|
-
|
|
8335
|
+
_chunk4B6YJ5DScjs.routeBoundaryCoversDirectory,
|
|
8103
8336
|
{ serverOwners: pageHydrationPlanOptions.serverOwners }
|
|
8104
8337
|
);
|
|
8105
8338
|
const providerServerImports = [
|
|
@@ -8117,7 +8350,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8117
8350
|
apiRegistrations.push(`
|
|
8118
8351
|
{
|
|
8119
8352
|
path: ${JSON.stringify(route.path)},
|
|
8120
|
-
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access',
|
|
8353
|
+
methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access', _188 => _188.pluginMethods, 'optionalAccess', _189 => _189.includes, 'call', _190 => _190(method)])))},
|
|
8121
8354
|
endpoints: ${varName},
|
|
8122
8355
|
}`);
|
|
8123
8356
|
});
|
|
@@ -8131,8 +8364,8 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8131
8364
|
orderedPageRoutes.forEach((route, index) => {
|
|
8132
8365
|
const varName = `pageRoute${index}`;
|
|
8133
8366
|
if (_chunk26WP75W5cjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) {
|
|
8134
|
-
const renderingDirective2 =
|
|
8135
|
-
const markdownServerTree = pageHydrationPlanOptions.serverOwners &&
|
|
8367
|
+
const renderingDirective2 = _chunkL3BSHASBcjs.readRouteRenderingDirectiveFromFile.call(void 0, route.modulePath);
|
|
8368
|
+
const markdownServerTree = pageHydrationPlanOptions.serverOwners && _chunkEBSL5TW7cjs.usesFarmServerTree.call(void 0, pageHydrationPlans.get(route.modulePath));
|
|
8136
8369
|
pageRegistrations.push(`
|
|
8137
8370
|
{
|
|
8138
8371
|
pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
|
|
@@ -8140,14 +8373,14 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8140
8373
|
rendering: ${JSON.stringify(renderingDirective2)},` : ""}${markdownServerTree ? "\n serverTree: true," : ""}
|
|
8141
8374
|
module: createFarmMarkdownRouteModule({
|
|
8142
8375
|
source: ${JSON.stringify(_nullishCoalesce(route.source, () => ( "")))},
|
|
8143
|
-
filePath: ${JSON.stringify(
|
|
8376
|
+
filePath: ${JSON.stringify(_chunkOFVBMS6Icjs.toBakedMarkdownSourcePath.call(void 0, config.root, route.modulePath))},
|
|
8144
8377
|
components: farmMdxComponents,
|
|
8145
|
-
config: farmMdxConfig,${
|
|
8378
|
+
config: farmMdxConfig,${_chunk3OKSEJ33cjs.isReactRenderer.call(void 0, config.renderer) ? "" : "\n renderer: React,"}
|
|
8146
8379
|
}),
|
|
8147
8380
|
markdownSource: {
|
|
8148
8381
|
source: ${JSON.stringify(_nullishCoalesce(route.source, () => ( "")))},
|
|
8149
8382
|
filePath: ${JSON.stringify(
|
|
8150
|
-
|
|
8383
|
+
_chunkOFVBMS6Icjs.toBakedMarkdownSourcePath.call(void 0, config.root, _nullishCoalesce(route.markdownSourcePath, () => ( route.modulePath)))
|
|
8151
8384
|
)},
|
|
8152
8385
|
},
|
|
8153
8386
|
}`);
|
|
@@ -8157,7 +8390,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8157
8390
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(route.modulePath)};`
|
|
8158
8391
|
);
|
|
8159
8392
|
const clientMetadata = pageHydrationPlans.get(route.modulePath);
|
|
8160
|
-
const renderingDirective =
|
|
8393
|
+
const renderingDirective = _chunkL3BSHASBcjs.readRouteRenderingDirectiveFromFile.call(void 0, route.modulePath);
|
|
8161
8394
|
pageRegistrations.push(`
|
|
8162
8395
|
{
|
|
8163
8396
|
pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
|
|
@@ -8165,8 +8398,8 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8165
8398
|
module: ${varName},
|
|
8166
8399
|
shouldHydrate: ${JSON.stringify(clientMetadata.shouldHydrate)},${clientMetadata.shouldHydrate ? `
|
|
8167
8400
|
clientModule: ${JSON.stringify(_chunk7U4XF76Rcjs.toViteModuleId.call(void 0, route.modulePath, config.root))},` : ""}
|
|
8168
|
-
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${
|
|
8169
|
-
const rootStrategy =
|
|
8401
|
+
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${_chunkEBSL5TW7cjs.usesFarmServerTree.call(void 0, clientMetadata) ? "\n serverTree: true," : ""}${(() => {
|
|
8402
|
+
const rootStrategy = _chunkOFVBMS6Icjs.resolveFarmRouteRootStrategy.call(void 0,
|
|
8170
8403
|
route,
|
|
8171
8404
|
clientMetadata,
|
|
8172
8405
|
layoutHydrationPlans.map((layout) => ({ ...layout, ...layout.hydration })),
|
|
@@ -8179,13 +8412,13 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8179
8412
|
rendering: ${JSON.stringify(renderingDirective)},` : ""}
|
|
8180
8413
|
${route.source !== void 0 ? `markdownSource: {
|
|
8181
8414
|
source: ${JSON.stringify(route.source)},
|
|
8182
|
-
filePath: ${JSON.stringify(
|
|
8415
|
+
filePath: ${JSON.stringify(_chunkOFVBMS6Icjs.toBakedMarkdownSourcePath.call(void 0, config.root, route.markdownSourcePath))},
|
|
8183
8416
|
},` : ""}
|
|
8184
8417
|
}`);
|
|
8185
8418
|
});
|
|
8186
8419
|
const layoutImports = [];
|
|
8187
8420
|
const layoutRegistrations = [];
|
|
8188
|
-
const treeLayoutPatterns = farmIslandsMode ?
|
|
8421
|
+
const treeLayoutPatterns = farmIslandsMode ? _chunk4B6YJ5DScjs.getFarmServerTreeLayoutPatterns.call(void 0,
|
|
8189
8422
|
layoutHydrationPlans.map((layout) => ({
|
|
8190
8423
|
pattern: layout.pattern,
|
|
8191
8424
|
shouldHydrate: layout.hydration.shouldHydrate,
|
|
@@ -8203,7 +8436,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8203
8436
|
pattern: ${JSON.stringify(layout.pattern)},
|
|
8204
8437
|
module: ${varName},
|
|
8205
8438
|
shouldHydrate: ${JSON.stringify(clientMetadata.shouldHydrate)},
|
|
8206
|
-
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${treeLayoutPatterns.has(layout.pattern) ? "\n serverTree: true," : ""}${farmIslandsMode &&
|
|
8439
|
+
islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${treeLayoutPatterns.has(layout.pattern) ? "\n serverTree: true," : ""}${farmIslandsMode && _chunkOFVBMS6Icjs.canFarmSkipKeptLayoutRender.call(void 0, layout.modulePath, config.root) ? "\n skipKeptRender: true," : ""}${// A layout whose client components hydrate as islands of their own (islands mode,
|
|
8207
8440
|
// isolatedClientHydration, or an async layout): it wraps a docs page as an app page.
|
|
8208
8441
|
clientMetadata.hasIsolatedClientBoundaries ? "\n islands: true," : ""}
|
|
8209
8442
|
}`);
|
|
@@ -8231,7 +8464,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8231
8464
|
containerId: ${JSON.stringify(slot.containerId)},
|
|
8232
8465
|
interception: ${JSON.stringify(slot.interception)},
|
|
8233
8466
|
fallback: ${JSON.stringify(slot.fallback)},
|
|
8234
|
-
hydrates: ${!farmIslandsMode ||
|
|
8467
|
+
hydrates: ${!farmIslandsMode || _chunkEBSL5TW7cjs.getClientModuleMetadata.call(void 0, slot.modulePath, config.root).isClientComponent},
|
|
8235
8468
|
module: ${varName},
|
|
8236
8469
|
}`);
|
|
8237
8470
|
});
|
|
@@ -8242,12 +8475,12 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8242
8475
|
errorImports.push(
|
|
8243
8476
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(errorRoute.modulePath)};`
|
|
8244
8477
|
);
|
|
8245
|
-
const groupScope =
|
|
8478
|
+
const groupScope = _chunk4B6YJ5DScjs.getRouteGroupScope.call(void 0, errorRoute.pattern);
|
|
8246
8479
|
errorRegistrations.push(`
|
|
8247
8480
|
{
|
|
8248
|
-
pattern: ${JSON.stringify(
|
|
8481
|
+
pattern: ${JSON.stringify(_chunk4B6YJ5DScjs.stripRouteGroups.call(void 0, errorRoute.pattern))},${groupScope ? `
|
|
8249
8482
|
groupScope: ${JSON.stringify(groupScope)},
|
|
8250
|
-
directoryDepth: ${
|
|
8483
|
+
directoryDepth: ${_chunk4B6YJ5DScjs.getRouteDirectoryDepth.call(void 0, errorRoute.pattern)},` : ""}
|
|
8251
8484
|
module: ${varName},
|
|
8252
8485
|
}`);
|
|
8253
8486
|
});
|
|
@@ -8259,12 +8492,12 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8259
8492
|
loadingImports.push(
|
|
8260
8493
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(loadingRoute.modulePath)};`
|
|
8261
8494
|
);
|
|
8262
|
-
const groupScope =
|
|
8495
|
+
const groupScope = _chunk4B6YJ5DScjs.getRouteGroupScope.call(void 0, loadingRoute.pattern);
|
|
8263
8496
|
loadingRegistrations.push(`
|
|
8264
8497
|
{
|
|
8265
|
-
pattern: ${JSON.stringify(
|
|
8498
|
+
pattern: ${JSON.stringify(_chunk4B6YJ5DScjs.stripRouteGroups.call(void 0, loadingRoute.pattern))},${groupScope ? `
|
|
8266
8499
|
groupScope: ${JSON.stringify(groupScope)},
|
|
8267
|
-
directoryDepth: ${
|
|
8500
|
+
directoryDepth: ${_chunk4B6YJ5DScjs.getRouteDirectoryDepth.call(void 0, loadingRoute.pattern)},` : ""}
|
|
8268
8501
|
module: ${varName},
|
|
8269
8502
|
}`);
|
|
8270
8503
|
});
|
|
@@ -8277,7 +8510,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8277
8510
|
metadataImageImports.push(
|
|
8278
8511
|
`import * as ${varName} from ${toVirtualEntryImportSpecifier(image.modulePath)};`
|
|
8279
8512
|
);
|
|
8280
|
-
const component = !
|
|
8513
|
+
const component = !_chunk3OKSEJ33cjs.isReactRenderer.call(void 0, config.renderer) && _chunkOFVBMS6Icjs.isRendererCompiledComponent.call(void 0, image.modulePath, _nullishCoalesce(_optionalChain([config, 'access', _191 => _191.renderer, 'optionalAccess', _192 => _192.componentExtensions]), () => ( [])));
|
|
8281
8514
|
metadataImageRegistrations.push(`
|
|
8282
8515
|
{
|
|
8283
8516
|
pattern: ${JSON.stringify(image.pattern)},
|
|
@@ -8353,7 +8586,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8353
8586
|
createDefaultErrorMarkup,
|
|
8354
8587
|
createFarmInstrumentationLifecycle,
|
|
8355
8588
|
createFarmLayoutSelector,
|
|
8356
|
-
createFarmLayoutBoundary,${_optionalChain([config, 'access',
|
|
8589
|
+
createFarmLayoutBoundary,${_optionalChain([config, 'access', _193 => _193.docs, 'optionalAccess', _194 => _194.enabled]) ? "\n createFarmDocsLayoutTree,\n farmDocsLayoutsWrapPage,\n placeFarmDocsLayoutRoot," : ""}
|
|
8357
8590
|
isInFarmRouteGroupScope,
|
|
8358
8591
|
routeBoundaryCoversDirectory,
|
|
8359
8592
|
createFarmCacheKey,
|
|
@@ -8437,7 +8670,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
|
|
|
8437
8670
|
createFarmDeploymentMismatchResponse,
|
|
8438
8671
|
FARM_DEPLOYMENT_ID_HEADER,
|
|
8439
8672
|
getFarmDeploymentMismatch,
|
|
8440
|
-
withoutFarmDeploymentCookie,${config.mobileClient ? "\n createFarmNativeTreeResponse," : ""}${config.trailingSlash && (_optionalChain([config, 'access',
|
|
8673
|
+
withoutFarmDeploymentCookie,${config.mobileClient ? "\n createFarmNativeTreeResponse," : ""}${config.trailingSlash && (_optionalChain([config, 'access', _195 => _195.md, 'optionalAccess', _196 => _196.enabled]) || hasMarkdownPages) ? "\n toFarmTrailingSlashPageRequest," : ""}${hasInfraAnalyticsRuntime ? "\n resolveFarmDocsEngineRouteLabel,\n resolveFarmDocsRouteLabel,\n resolveFarmMarkdownRouteLabel,\n resolveFarmMCPRouteLabel,\n setFarmRouteLabel," : ""}${hasFarmServerStorageConfig(config.storage) ? "\n _registerFarmStorageModules,\n disposeFarmStorage,\n initFarmStorage," : ""}${searchPreserveRoutesSource ? "\n _setFarmSearchPreserveRoutes," : ""}
|
|
8441
8674
|
} from "@farm.js/core/internal/production-runtime";${farmMobileClient ? `
|
|
8442
8675
|
import { _applyFarmMobileShellClient } from "@farm.js/core/internal/production-runtime";
|
|
8443
8676
|
// The mobile client documents load when a mobile shell asks for them (RFC 0004, 7.2), filled in
|
|
@@ -8509,25 +8742,25 @@ function farmFormStateScript() { return ""; }`}`;
|
|
|
8509
8742
|
const infraAnalyticsImport = hasInfraAnalyticsRuntime ? `import { ${hasPluginRuntime ? "createFarmInfraAnalyticsPlugin" : "createFarmInfraAnalyticsRecorder"} } from "@farm.js/core/internal/infra-analytics-runtime";` : "";
|
|
8510
8743
|
const compressionRuntimeImport = hasCompressionRuntime ? `import { compressFarmResponse${hasPluginRuntime ? ", createCompressionPlugin" : ""} } from "@farm.js/core/internal/compression-runtime";` : "";
|
|
8511
8744
|
const i18nServerImport = config.i18n.enabled ? `import { _runWithFarmI18nRequest, _setDefaultFarmI18nRuntime, createFarmI18nRuntime, getFarmI18nClientSnapshot } from "@farm.js/core/i18n/server";` : "";
|
|
8512
|
-
const docsHandlerImport = _optionalChain([config, 'access',
|
|
8745
|
+
const docsHandlerImport = _optionalChain([config, 'access', _197 => _197.docs, 'optionalAccess', _198 => _198.enabled]) ? hasPrecompiledDocs ? `import { createFarmDocsPrecompiledRuntime } from "@farm.js/core/internal/docs-precompiled-runtime";
|
|
8513
8746
|
const isFarmDocsAPIRequest = (requestOrPathname) => {
|
|
8514
8747
|
const pathname = typeof requestOrPathname === "string"
|
|
8515
8748
|
? requestOrPathname
|
|
8516
8749
|
: new URL(requestOrPathname.url).pathname;
|
|
8517
|
-
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess',
|
|
8750
|
+
const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _199 => _199.apiPath]) || "/api/docs")};
|
|
8518
8751
|
return pathname === apiPath || pathname.startsWith(apiPath + "/");
|
|
8519
8752
|
};` : adapterOwnsDocsRuntime ? `import { ${docsConfigModulePath ? "getFarmDocsConfigModuleRoot, " : ""}isFarmDocsAPIRequest } from "@farm.js/core/docs";
|
|
8520
|
-
import { ${_optionalChain([config, 'access',
|
|
8521
|
-
import * as
|
|
8753
|
+
import { ${_optionalChain([config, 'access', _200 => _200.docs, 'access', _201 => _201.roots, 'optionalAccess', _202 => _202.length]) ? "createFarmDocsMultiRuntimeHandler as createFarmDocsAdapterMultiRuntimeHandler" : "createFarmDocsRuntimeHandler as createFarmDocsAdapterRuntimeHandler"} } from ${JSON.stringify(config.docs.adapter.server)};
|
|
8754
|
+
import * as FarmDocsAdapterUI from ${JSON.stringify(_chunkL2GUEYHRcjs.getFarmDocsAdapterUIModule.call(void 0, config.docs.adapter))};${docsConfigModulePath ? `
|
|
8522
8755
|
import * as farmDocsConfigModule from ${toVirtualEntryImportSpecifier(docsConfigModulePath)};` : ""}` : `import { createFarmDocsAPIHandler, createFarmDocsHandler, isFarmDocsAPIRequest } from "@farm.js/core/docs";` : "";
|
|
8523
|
-
const docsFontImport = _optionalChain([config, 'access',
|
|
8524
|
-
const docsRuntimeImport = _optionalChain([config, 'access',
|
|
8756
|
+
const docsFontImport = _optionalChain([config, 'access', _203 => _203.docs, 'optionalAccess', _204 => _204.enabled]) && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
|
|
8757
|
+
const docsRuntimeImport = _optionalChain([config, 'access', _205 => _205.docs, 'optionalAccess', _206 => _206.enabled]) && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
|
|
8525
8758
|
import { dirname as farmDocsDirname, join as farmDocsJoin } from "node:path";
|
|
8526
8759
|
import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
8527
|
-
const markdownHandlerImport = _optionalChain([config, 'access',
|
|
8760
|
+
const markdownHandlerImport = _optionalChain([config, 'access', _207 => _207.md, 'optionalAccess', _208 => _208.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
|
|
8528
8761
|
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;";
|
|
8529
8762
|
const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, FARM_MARKDOWN_PAGE_CHECK_HEADER, _isFarmMarkdownPageCheck, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
|
|
8530
|
-
const mdxComponentsPath = typeof _optionalChain([config, 'access',
|
|
8763
|
+
const mdxComponentsPath = typeof _optionalChain([config, 'access', _209 => _209.mdx, 'optionalAccess', _210 => _210.components]) === "string" ? _path2.default.isAbsolute(config.mdx.components) ? config.mdx.components : _path2.default.join(config.root, config.mdx.components) : null;
|
|
8531
8764
|
const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
|
|
8532
8765
|
const layerConfigPaths = (config.layers || []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile)).filter((configFile) => configFile !== configModulePath);
|
|
8533
8766
|
const layerConfigImports = layerConfigPaths.map(
|
|
@@ -8547,14 +8780,14 @@ import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
|
|
|
8547
8780
|
const nativeAuth = generateNativeAuthIntegrationSource(config.auth);
|
|
8548
8781
|
const nativeMCP = _chunkVM57CK74cjs.generateNativeMCPPluginSource.call(void 0, config.mcp);
|
|
8549
8782
|
const mobileSession = (config.plugins || []).some(
|
|
8550
|
-
(plugin) => _optionalChain([plugin, 'optionalAccess',
|
|
8783
|
+
(plugin) => _optionalChain([plugin, 'optionalAccess', _211 => _211.name]) === _chunkMHKPXX3Jcjs.FARM_MOBILE_SESSION_PLUGIN
|
|
8551
8784
|
);
|
|
8552
8785
|
const nativeServerFns = (config.plugins || []).some(
|
|
8553
|
-
(plugin) => _optionalChain([plugin, 'optionalAccess',
|
|
8554
|
-
) ?
|
|
8786
|
+
(plugin) => _optionalChain([plugin, 'optionalAccess', _212 => _212.name]) === _chunk4EBC7EMWcjs.FARM_NATIVE_SERVER_FN_PLUGIN
|
|
8787
|
+
) ? _chunkYU6VL7H5cjs.collectFarmNativeServerFns.call(void 0, {
|
|
8555
8788
|
root: config.root,
|
|
8556
8789
|
srcDir: config.srcDir,
|
|
8557
|
-
entries:
|
|
8790
|
+
entries: _chunkYU6VL7H5cjs.findFarmNativeScreenFiles.call(void 0, _chunk52Q4OB4Acjs.getFarmAppDirectories.call(void 0, config))
|
|
8558
8791
|
}) : void 0;
|
|
8559
8792
|
const integrationImports = `
|
|
8560
8793
|
${configModulePath ? `import * as FarmUserConfigModule from ${toVirtualEntryImportSpecifier(configModulePath)};` : ""}
|
|
@@ -8569,7 +8802,7 @@ ${nativeServerFns ? `const __farmNativeServerFnRegistry = Object.assign(Object.c
|
|
|
8569
8802
|
${nativeServerFns.flatMap((module, index) => module.exports.map((entry) => ` ${JSON.stringify(entry.id)}: __farmNativeServerFns${index}[${JSON.stringify(entry.name)}],`)).join("\n")}
|
|
8570
8803
|
});` : ""}
|
|
8571
8804
|
`;
|
|
8572
|
-
const imageRuntime =
|
|
8805
|
+
const imageRuntime = _chunkOFVBMS6Icjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
|
|
8573
8806
|
const imageRuntimeImport = imageRuntime === "none" ? "" : `import { _withFarmImageSourceClientAddress, createCloudflareImageTransformer, createFarmImageHandler } from "@farm.js/core/image/server";`;
|
|
8574
8807
|
const imageNodeRuntimeImport = imageRuntime === "node" ? `import { createNodeImageFetcher, createNodeImageUrlValidator, createSharpImageTransformer } from "@farm.js/core/image/sharp";` : "";
|
|
8575
8808
|
const apiHandlerCode = apiRoutes.length > 0 ? `
|
|
@@ -8751,7 +8984,7 @@ const farmResolvedRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs);
|
|
|
8751
8984
|
|
|
8752
8985
|
function renderFarmDefault404Page() {
|
|
8753
8986
|
return React.createElement(React.Fragment, null,
|
|
8754
|
-
React.createElement("style", null, ${JSON.stringify(
|
|
8987
|
+
React.createElement("style", null, ${JSON.stringify(_chunkOFVBMS6Icjs.DEFAULT_NOT_FOUND_STYLES)}),
|
|
8755
8988
|
React.createElement("main", {
|
|
8756
8989
|
className: "farm-default-not-found",
|
|
8757
8990
|
"aria-labelledby": "farm-default-not-found-title",
|
|
@@ -8847,7 +9080,7 @@ function wrapWithFarmIntegrationProviders(element) {
|
|
|
8847
9080
|
// providers, so the server renders them inside it too. React lines an island up with its tree
|
|
8848
9081
|
// position instead, and its providers render no markup.
|
|
8849
9082
|
function wrapFarmIslandIntegrationProviders(element) {
|
|
8850
|
-
return ${
|
|
9083
|
+
return ${_chunk3OKSEJ33cjs.isReactRenderer.call(void 0, config.renderer) ? "element" : "wrapWithFarmIntegrationProviders(element)"};
|
|
8851
9084
|
}
|
|
8852
9085
|
const serverRuntimeIntegrations = Object.fromEntries(
|
|
8853
9086
|
Object.entries(configuredIntegrations).filter(([, integration]) =>
|
|
@@ -8907,24 +9140,24 @@ const farmImageHandler = ${imageRuntime === "none" ? "null" : imageRuntime === "
|
|
|
8907
9140
|
validateRemoteUrl: createNodeImageUrlValidator(${JSON.stringify(config.images)}),
|
|
8908
9141
|
onError(error) { console.error("[Farm Image]", error); },
|
|
8909
9142
|
})`};
|
|
8910
|
-
const farmMarkdownConfig = ${JSON.stringify(config.md)};${_optionalChain([config, 'access',
|
|
9143
|
+
const farmMarkdownConfig = ${JSON.stringify(config.md)};${_optionalChain([config, 'access', _213 => _213.md, 'optionalAccess', _214 => _214.enabled]) || hasMarkdownPages ? config.trailingSlash ? `
|
|
8911
9144
|
// A Markdown mirror, and a page.md source's page check, read the page at the URL it answers at
|
|
8912
9145
|
// ('/about/'), so the trailing-slash 308 never answers in its place.
|
|
8913
9146
|
const toFarmMarkdownPageRequest = (request) => toFarmTrailingSlashPageRequest(request, true);` : `
|
|
8914
9147
|
const toFarmMarkdownPageRequest = (request) => request;` : ""}
|
|
8915
|
-
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
8916
|
-
${_optionalChain([config, 'access',
|
|
9148
|
+
const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _215 => _215.agent, 'optionalAccess', _216 => _216.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
|
|
9149
|
+
${_optionalChain([config, 'access', _217 => _217.agent, 'optionalAccess', _218 => _218.llmsTxt, 'optionalAccess', _219 => _219.enabled]) ? "const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });\n" : ""}${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
|
|
8917
9150
|
const farmMdxConfig = ${JSON.stringify({
|
|
8918
9151
|
...config.mdx,
|
|
8919
|
-
components: typeof _optionalChain([config, 'access',
|
|
9152
|
+
components: typeof _optionalChain([config, 'access', _220 => _220.mdx, 'optionalAccess', _221 => _221.components]) === "string" ? config.mdx.components : void 0
|
|
8920
9153
|
})};
|
|
8921
9154
|
const configuredFarmMdxComponents = farmUserConfig?.mdx?.components;
|
|
8922
|
-
${_optionalChain([config, 'access',
|
|
9155
|
+
${_optionalChain([config, 'access', _222 => _222.agent, 'optionalAccess', _223 => _223.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
|
|
8923
9156
|
// environment this was built in, since Netlify exposes its deploy context only
|
|
8924
9157
|
// to the build.
|
|
8925
9158
|
const farmNoindexPreview = resolveFarmPreviewDeployment(
|
|
8926
9159
|
globalThis.process?.env,
|
|
8927
|
-
${JSON.stringify(
|
|
9160
|
+
${JSON.stringify(_chunk57EEWWUScjs.isFarmPreviewDeploymentEnvironment.call(void 0, process.env))},
|
|
8928
9161
|
);` : ""}
|
|
8929
9162
|
const farmMdxComponents = ${mdxComponentsPath ? `(FarmMdxComponentsModule.components || Reflect.get(FarmMdxComponentsModule, "default") || {})` : `(configuredFarmMdxComponents && typeof configuredFarmMdxComponents === "object" ? configuredFarmMdxComponents : {})`};
|
|
8930
9163
|
const farmObservabilityConfig = farmUserConfig?.observability ?? ${JSON.stringify(
|
|
@@ -8970,7 +9203,7 @@ export const farmProductionLifecycle = createFarmProductionLifecycle({
|
|
|
8970
9203
|
});
|
|
8971
9204
|
const farmI18nRuntime = ${config.i18n.enabled ? `createFarmI18nRuntime(farmI18nConfig, ${JSON.stringify(i18nCatalogs)})` : "null"};
|
|
8972
9205
|
${config.i18n.enabled ? "_setDefaultFarmI18nRuntime(farmI18nRuntime);" : ""}
|
|
8973
|
-
const farmDocsBundledContentDir = ${_optionalChain([config, 'access',
|
|
9206
|
+
const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _224 => _224.docs, 'optionalAccess', _225 => _225.enabled]) && !hasPrecompiledDocs ? `(() => {
|
|
8974
9207
|
try {
|
|
8975
9208
|
const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
|
|
8976
9209
|
const candidates = [
|
|
@@ -8982,7 +9215,7 @@ const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _234 => _2
|
|
|
8982
9215
|
} catch {
|
|
8983
9216
|
return null;
|
|
8984
9217
|
}
|
|
8985
|
-
})()` : "null"};${_optionalChain([config, 'access',
|
|
9218
|
+
})()` : "null"};${_optionalChain([config, 'access', _226 => _226.docs, 'optionalAccess', _227 => _227.enabled]) && !hasPrecompiledDocs && _optionalChain([config, 'access', _228 => _228.docs, 'access', _229 => _229.roots, 'optionalAccess', _230 => _230.length]) ? `
|
|
8986
9219
|
const farmDocsBundledRootsDir = (() => {
|
|
8987
9220
|
try {
|
|
8988
9221
|
const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
|
|
@@ -9034,7 +9267,9 @@ const farmDocsModulePreloadPaths = farmDocsModulePreloads
|
|
|
9034
9267
|
),
|
|
9035
9268
|
}
|
|
9036
9269
|
: undefined;
|
|
9037
|
-
|
|
9270
|
+
${adapterOwnsDocsRuntime && !hasPrecompiledDocs ? `// The renderer contract's server exports, for a docs UI that builds its pages with them.
|
|
9271
|
+
const farmDocsAppRenderer = ${_chunk3OKSEJ33cjs.isReactRenderer.call(void 0, config.renderer) ? '{ name: "react", createElement: React.createElement, Fragment: React.Fragment, renderToString: ReactDOMServer.renderToString }' : "__farmRendererServer"};
|
|
9272
|
+
` : ""}const farmDocsHandler = ${_optionalChain([config, 'access', _231 => _231.docs, 'optionalAccess', _232 => _232.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `${adapterHandler.factory}(${adapterHandler.config}, {
|
|
9038
9273
|
rootDir: farmDocsRuntimeRoot,
|
|
9039
9274
|
// A production build's content cannot change, so the adapter reads its
|
|
9040
9275
|
// navigation once instead of scanning the content directory per request.
|
|
@@ -9050,12 +9285,15 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _241 => _241.docs, '
|
|
|
9050
9285
|
resolveFarmLayoutFonts(
|
|
9051
9286
|
getApplicableLayouts(getFarmRoutePathname(pathname)).map((layout) => layout.module),
|
|
9052
9287
|
),
|
|
9053
|
-
|
|
9288
|
+
loadUIModule: async () => FarmDocsAdapterUI,
|
|
9289
|
+
// The app's renderer, for a UI that builds its pages with it.
|
|
9290
|
+
loadRenderer: async () => farmDocsAppRenderer,${_chunkL2GUEYHRcjs.getFarmDocsAdapterRenderer.call(void 0, config.docs.adapter) === "react" ? `
|
|
9291
|
+
loadReactModule: async () => FarmDocsAdapterUI,` : ""}
|
|
9054
9292
|
// Lists the docs MCP endpoint in /.well-known/ai-catalog.json for the server's lifetime.
|
|
9055
9293
|
registerMCPServer: registerFarmMCPServer,
|
|
9056
9294
|
// A page built with this keeps its HTML string, so the preload budget and the response
|
|
9057
9295
|
// writer use it instead of reading and re-encoding the body. Older adapters ignore it.
|
|
9058
|
-
createHtmlResponse: farmOwnedHtmlResponse,${
|
|
9296
|
+
createHtmlResponse: farmOwnedHtmlResponse,${_chunkUSMRAC72cjs.farmDocsAdapterServesGuardedPages.call(void 0, config.docs) ? `
|
|
9059
9297
|
// The adapter keeps pages a path guard covers off search, llms.txt, the sitemap and MCP. It
|
|
9060
9298
|
// asks about any path its own content lists, so the guards decide here, not a page list.
|
|
9061
9299
|
isPathGuarded: (pathname) =>
|
|
@@ -9081,7 +9319,7 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _241 => _241.docs, '
|
|
|
9081
9319
|
isPathGuarded: isFarmDocsPathGuarded,
|
|
9082
9320
|
basePath: ${JSON.stringify(config.basePath)},
|
|
9083
9321
|
})` : "null"};
|
|
9084
|
-
const farmDocsAPIHandler = ${_optionalChain([config, 'access',
|
|
9322
|
+
const farmDocsAPIHandler = ${_optionalChain([config, 'access', _233 => _233.docs, 'optionalAccess', _234 => _234.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig, isPathGuarded: isFarmDocsPathGuarded, basePath: ${JSON.stringify(config.basePath)} })` : "null"};
|
|
9085
9323
|
|
|
9086
9324
|
// API routes bundled at build time
|
|
9087
9325
|
const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
|
|
@@ -9116,12 +9354,12 @@ const farmDeploymentCookiePath = ${JSON.stringify(config.basePath || "/")};
|
|
|
9116
9354
|
// runtime request.
|
|
9117
9355
|
const farmRuntimeErrorSlot = Symbol("farm.runtime.error.slot");
|
|
9118
9356
|
const farmOpenAPIReference = ${JSON.stringify(openAPIReference)};
|
|
9119
|
-
${_optionalChain([config, 'access',
|
|
9120
|
-
` : ""}${_optionalChain([config, 'access',
|
|
9121
|
-
|
|
9357
|
+
${_optionalChain([config, 'access', _235 => _235.agent, 'optionalAccess', _236 => _236.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunk22BTYPIXcjs.resolveFarmApiCatalogInput.call(void 0, config))};
|
|
9358
|
+
` : ""}${_optionalChain([config, 'access', _237 => _237.agent, 'optionalAccess', _238 => _238.manifest]) !== false ? `const farmAppManifestInput = ${JSON.stringify(
|
|
9359
|
+
_chunk22BTYPIXcjs.resolveFarmAppManifestInput.call(void 0, config, {
|
|
9122
9360
|
build: config.deploymentId,
|
|
9123
|
-
packages:
|
|
9124
|
-
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ?
|
|
9361
|
+
packages: _chunkOFVBMS6Icjs.resolveFarmAppPackages.call(void 0, config.root),
|
|
9362
|
+
webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? _chunkOFVBMS6Icjs.collectFarmWebMCPTools.call(void 0, config.root, config.srcDir) : []
|
|
9125
9363
|
})
|
|
9126
9364
|
)};
|
|
9127
9365
|
${servesDefaultMCP ? "farmAppManifestInput.defaultMCP = getFarmDefaultMCPServer;\n" : ""}// A guard written for an MCP server's path keeps its tools out of the public view.
|
|
@@ -9134,7 +9372,7 @@ farmAppManifestInput.guardCoversPath = (path) =>
|
|
|
9134
9372
|
path,
|
|
9135
9373
|
farmLocalAPIBasePath,
|
|
9136
9374
|
);
|
|
9137
|
-
${_optionalChain([config, 'access',
|
|
9375
|
+
${_optionalChain([config, 'access', _239 => _239.docs, 'optionalAccess', _240 => _240.enabled]) ? `// A docs runtime's MCP server lists its tools when asked over MCP, in process. A build
|
|
9138
9376
|
// can't change them, so they are read once.
|
|
9139
9377
|
if (farmDocsHandler) {
|
|
9140
9378
|
farmAppManifestInput.registeredMCP = (request) =>
|
|
@@ -9243,7 +9481,7 @@ function renderFarmClientBootstrapScript(canonicalPath, selectedRouteSlots, page
|
|
|
9243
9481
|
'window[Symbol.for("farm.searchPreserveRoutes")]=' + serializeFarmInlineValue(farmSearchPreserveRoutes) + ';'` : ""};
|
|
9244
9482
|
// The client boots at the canonical path when the script below moves it there.
|
|
9245
9483
|
const bootRoutes = statusDocument
|
|
9246
|
-
? typeof routePathname === "string" ?
|
|
9484
|
+
? typeof routePathname === "string" ? getFarmClientStatusBootRoutes(routePathname) : undefined
|
|
9247
9485
|
: getFarmClientBootRoutes(
|
|
9248
9486
|
typeof canonicalPath === "string" && canonicalPath.startsWith("/")
|
|
9249
9487
|
? getFarmRoutePathname(canonicalPath.split(/[?#]/)[0])
|
|
@@ -9909,7 +10147,7 @@ function peelFarmDocumentPrefix(markup) {
|
|
|
9909
10147
|
let inner = markup.replace(/^\\s+/, "");
|
|
9910
10148
|
let hoisted = "";
|
|
9911
10149
|
const wrapper = /^<div\\b[^>]*style=["']display\\s*:\\s*contents;?\\s*["'][^>]*>/i;
|
|
9912
|
-
const hoistable = /${
|
|
10150
|
+
const hoistable = /${_chunk4B6YJ5DScjs.HOISTED_HEAD_ELEMENT.source}/i;
|
|
9913
10151
|
let match;
|
|
9914
10152
|
while ((match = wrapper.exec(inner) || hoistable.exec(inner))) {
|
|
9915
10153
|
if (!/^<div/i.test(match[0])) hoisted += match[0];
|
|
@@ -9938,7 +10176,7 @@ function opensFarmFullDocument(markup) {
|
|
|
9938
10176
|
// them: its own head takes them. Matches the dev renderer's takeFarmHoistedHead.
|
|
9939
10177
|
function takeFarmHoistedHead(markup) {
|
|
9940
10178
|
if (opensFarmFullDocument(markup)) return { head: "", body: markup };
|
|
9941
|
-
const hoistable = /${
|
|
10179
|
+
const hoistable = /${_chunk4B6YJ5DScjs.HOISTED_HEAD_ELEMENT.source}/i;
|
|
9942
10180
|
let head = "";
|
|
9943
10181
|
let body = markup;
|
|
9944
10182
|
let match;
|
|
@@ -10047,7 +10285,7 @@ function createFarmErrorDocument(html, title, routePathname) {
|
|
|
10047
10285
|
' <meta name="viewport" content="width=device-width, initial-scale=1">\\n' +
|
|
10048
10286
|
' <link rel="icon" href="data:,">\\n' +
|
|
10049
10287
|
' <title>' + escapedTitle + '</title>\\n' +
|
|
10050
|
-
'
|
|
10288
|
+
' ' + renderFarmClientStylesheet() + renderFarmClientModulePreloads(html) + '\\n' +
|
|
10051
10289
|
renderFarmRendererHydrationScript() + '\\n' +
|
|
10052
10290
|
'</head>\\n<body>\\n' +
|
|
10053
10291
|
' <div id="root">' + html + '</div>\\n' +
|
|
@@ -10058,7 +10296,7 @@ function createFarmErrorDocument(html, title, routePathname) {
|
|
|
10058
10296
|
|
|
10059
10297
|
let fullHtml = ensureFarmDocumentRoot(ensureFarmDocumentHead(fullDocument));
|
|
10060
10298
|
fullHtml = fullHtml
|
|
10061
|
-
.replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n
|
|
10299
|
+
.replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n ' + renderFarmClientStylesheet() + renderFarmClientModulePreloads(fullDocument); })
|
|
10062
10300
|
// Function replacements: dynamic markup may contain $-sequences ($&, $', $$)
|
|
10063
10301
|
// that a string replacement would expand, corrupting the document.
|
|
10064
10302
|
.replace(/<\\/head>/i, function() { return renderFarmRendererHydrationScript() + '\\n</head>'; })
|
|
@@ -10082,6 +10320,23 @@ function createFarmErrorDocument(html, title, routePathname) {
|
|
|
10082
10320
|
: "<!DOCTYPE html>\\n" + fullHtml;
|
|
10083
10321
|
}
|
|
10084
10322
|
|
|
10323
|
+
// The client stylesheet a document links, filled in from the client build once it has finished
|
|
10324
|
+
// (see buildNitroUniversal): null for an app without CSS, whose empty stylesheet would still hold
|
|
10325
|
+
// the first paint for a round trip. Parsed at runtime, so the bundler cannot fold the stand-in.
|
|
10326
|
+
const farmClientStylesheetHref = (() => {
|
|
10327
|
+
try {
|
|
10328
|
+
return JSON.parse("${FARM_CLIENT_STYLESHEET_PLACEHOLDER}");
|
|
10329
|
+
} catch {
|
|
10330
|
+
return "${FARM_CLIENT_CSS_HREF_PLACEHOLDER}";
|
|
10331
|
+
}
|
|
10332
|
+
})();
|
|
10333
|
+
|
|
10334
|
+
function renderFarmClientStylesheet() {
|
|
10335
|
+
return farmClientStylesheetHref
|
|
10336
|
+
? '<link rel="stylesheet" href="' + farmClientStylesheetHref + '">'
|
|
10337
|
+
: "";
|
|
10338
|
+
}
|
|
10339
|
+
|
|
10085
10340
|
// The client modules a page needs before it hydrates, filled in from the client
|
|
10086
10341
|
// build once it has finished (see buildNitroUniversal).
|
|
10087
10342
|
const farmClientModulePreloads = (() => {
|
|
@@ -10091,7 +10346,10 @@ const farmClientModulePreloads = (() => {
|
|
|
10091
10346
|
return null;
|
|
10092
10347
|
}
|
|
10093
10348
|
})();
|
|
10094
|
-
${generateFarmClientBootRoutesServerSource(
|
|
10349
|
+
${generateFarmClientBootRoutesServerSource(
|
|
10350
|
+
`"${FARM_CLIENT_ROUTE_TABLE_PLACEHOLDER}"`,
|
|
10351
|
+
farmIslandsMode ? layoutRoutes.map((layout) => getFarmClientLayoutMatch(layout.pattern)) : void 0
|
|
10352
|
+
)}
|
|
10095
10353
|
|
|
10096
10354
|
const farmClientEntryPreloadTags = farmClientModulePreloads
|
|
10097
10355
|
? farmClientModulePreloads.entry.map(renderFarmClientModulePreload).join("")
|
|
@@ -10101,10 +10359,18 @@ const farmClientEntryPreloadTags = farmClientModulePreloads
|
|
|
10101
10359
|
const farmClientRendererPreloadTags = farmClientModulePreloads
|
|
10102
10360
|
? (farmClientModulePreloads.renderer || []).map(renderFarmClientModulePreload).join("")
|
|
10103
10361
|
: "";
|
|
10362
|
+
// Islands mode's entry imports the code that renders a page or layout root when one hydrates (RFC
|
|
10363
|
+
// 0013), so a document that has one lists that code.
|
|
10364
|
+
const farmClientRootPreloadTags = farmClientModulePreloads
|
|
10365
|
+
? (farmClientModulePreloads.root || []).map(renderFarmClientModulePreload).join("")
|
|
10366
|
+
: "";
|
|
10104
10367
|
// The client modules a document's markup loads: its islands' boundaries and the
|
|
10105
10368
|
// client references of its server tree. An island with a deferred strategy loads its
|
|
10106
10369
|
// module on its own trigger, so it is not preloaded.
|
|
10107
10370
|
const FARM_CLIENT_MODULE_REFERENCE_PATTERN = /<f-island src="([^"]+)"([^>]*)>|"r":"(\\/[^"]+)"/g;
|
|
10371
|
+
// A server action reference in a document's markup: an action in an island's or a client
|
|
10372
|
+
// component's props (islx's \`{"$":"a",...}\`), or a server form posting one (its \`$F_REF_\` field).
|
|
10373
|
+
const FARM_ACTION_REFERENCE_PATTERN = /"\\$":"a"|name="\\$F_REF_/;
|
|
10108
10374
|
|
|
10109
10375
|
function renderFarmClientModulePreload(index) {
|
|
10110
10376
|
return '\\n <link rel="modulepreload" href="/' +
|
|
@@ -10135,15 +10401,28 @@ function collectFarmClientDocumentModules(markup, pageModule, listed) {
|
|
|
10135
10401
|
return indexes;
|
|
10136
10402
|
}
|
|
10137
10403
|
|
|
10404
|
+
// The manifest indexes of islands mode's action client, which handles a call's result (RFC 0013),
|
|
10405
|
+
// for a document whose markup holds an action reference, leaving out those already listed. Its
|
|
10406
|
+
// islands import it on their first call otherwise.
|
|
10407
|
+
function collectFarmClientActionModules(markup, listed) {
|
|
10408
|
+
const actions = farmClientModulePreloads.actions;
|
|
10409
|
+
if (!actions || typeof markup !== "string" || !FARM_ACTION_REFERENCE_PATTERN.test(markup)) return [];
|
|
10410
|
+
return actions.filter((index) => !listed.has(index) && listed.add(index));
|
|
10411
|
+
}
|
|
10412
|
+
|
|
10138
10413
|
// The modulepreload links for a document: the entry's static imports and, unless it answers a
|
|
10139
|
-
// client navigation, the renderer,
|
|
10140
|
-
|
|
10414
|
+
// client navigation, the renderer and, when a page or layout root hydrates in it (\`hydratesRoot\`),
|
|
10415
|
+
// the code that renders it; then the modules its hydrating page and its markup load.
|
|
10416
|
+
function renderFarmClientModulePreloads(markup, pageModule, navigation, hydratesRoot) {
|
|
10141
10417
|
// A nonce policy blocks parser-inserted links without the nonce, and the
|
|
10142
10418
|
// response filter manages nonces on script elements only, so CSP nonce mode
|
|
10143
10419
|
// keeps the documents it had.
|
|
10144
10420
|
if (!farmClientModulePreloads || (farmSecurityConfig.csp && farmSecurityConfig.csp.nonce)) return "";
|
|
10421
|
+
const listed = new Set();
|
|
10145
10422
|
return farmClientEntryPreloadTags + (navigation ? "" : farmClientRendererPreloadTags) +
|
|
10146
|
-
|
|
10423
|
+
(hydratesRoot && !navigation ? farmClientRootPreloadTags : "") +
|
|
10424
|
+
collectFarmClientDocumentModules(markup, pageModule, listed)
|
|
10425
|
+
.concat(collectFarmClientActionModules(markup, listed))
|
|
10147
10426
|
.map(renderFarmClientModulePreload)
|
|
10148
10427
|
.join("");
|
|
10149
10428
|
}
|
|
@@ -10165,13 +10444,26 @@ function renderFarmClientBootPreloads(markup, pageModule, root, rootStrategy, na
|
|
|
10165
10444
|
) + '"';
|
|
10166
10445
|
};
|
|
10167
10446
|
const entry = farmClientModulePreloads.entry;
|
|
10447
|
+
// The root hydrates with the code that hydrates roots (RFC 0013) and its page's modules.
|
|
10168
10448
|
const rootModules = root
|
|
10169
|
-
?
|
|
10449
|
+
? (farmClientModulePreloads.root || []).concat(
|
|
10450
|
+
collectFarmClientDocumentModules(
|
|
10451
|
+
markup,
|
|
10452
|
+
pageModule,
|
|
10453
|
+
new Set(entry.concat(farmClientModulePreloads.root || [])),
|
|
10454
|
+
),
|
|
10455
|
+
)
|
|
10170
10456
|
: [];
|
|
10171
10457
|
const waitsForClick = rootStrategy === "interaction";
|
|
10458
|
+
// A call needs a hydrated island, so the action client comes with the renderer.
|
|
10459
|
+
const renderer = navigation
|
|
10460
|
+
? []
|
|
10461
|
+
: (farmClientModulePreloads.renderer || []).concat(
|
|
10462
|
+
collectFarmClientActionModules(markup, new Set(entry.concat(rootModules))),
|
|
10463
|
+
);
|
|
10172
10464
|
return attribute("data-farm-preload", waitsForClick ? entry : entry.concat(rootModules)) +
|
|
10173
10465
|
attribute("data-farm-preload-router", farmClientModulePreloads.router || []) +
|
|
10174
|
-
attribute("data-farm-preload-renderer",
|
|
10466
|
+
attribute("data-farm-preload-renderer", renderer) +
|
|
10175
10467
|
(waitsForClick ? attribute("data-farm-preload-root", rootModules) : "");
|
|
10176
10468
|
}
|
|
10177
10469
|
|
|
@@ -10424,10 +10716,10 @@ async function handleMetadataImageRequest(request, routePathname) {
|
|
|
10424
10716
|
path: match.pagePath,
|
|
10425
10717
|
};
|
|
10426
10718
|
|
|
10427
|
-
${hasGeneratedMetadataImages ? `const value = await resolveFarmMetadataImageValue(imageModule, props${
|
|
10719
|
+
${hasGeneratedMetadataImages ? `const value = await resolveFarmMetadataImageValue(imageModule, props${_chunk3OKSEJ33cjs.isReactRenderer.call(void 0, config.renderer) ? "" : ", {\n renderer: ReactDOMServer,\n component: image.component === true,\n }"});
|
|
10428
10720
|
return createFarmMetadataImageResponse(value, imageModule, {
|
|
10429
10721
|
method,
|
|
10430
|
-
ifNoneMatch: request.headers.get("if-none-match"),${
|
|
10722
|
+
ifNoneMatch: request.headers.get("if-none-match"),${_chunk3OKSEJ33cjs.isReactRenderer.call(void 0, config.renderer) ? "" : "\n renderer: ReactDOMServer,"}
|
|
10431
10723
|
});` : 'throw new Error("Generated metadata image runtime is unavailable");'}
|
|
10432
10724
|
} catch (error) {
|
|
10433
10725
|
console.error("Metadata image render failed:", error);
|
|
@@ -10506,7 +10798,7 @@ function createFarmAgentRobotsResponse(request) {
|
|
|
10506
10798
|
// its nearest layout's.
|
|
10507
10799
|
const farmAgentGuardedPages = new Set(${JSON.stringify(
|
|
10508
10800
|
pageRoutes.map((route) => route.pattern).filter(
|
|
10509
|
-
(pattern) => !pattern.includes("[") &&
|
|
10801
|
+
(pattern) => !pattern.includes("[") && _chunk4B6YJ5DScjs.farmPathGuardCoversPage.call(void 0,
|
|
10510
10802
|
{
|
|
10511
10803
|
config: { middleware: config.middleware, integrations: config.integrations },
|
|
10512
10804
|
middlewareRoutes
|
|
@@ -10561,7 +10853,7 @@ ${servesDefaultMCP ? `// agent.mcp: the default read-only MCP server at /mcp, as
|
|
|
10561
10853
|
// aside for a page route that answers /mcp and for any MCP server published or
|
|
10562
10854
|
// registered at runtime, such as the docs engine's.
|
|
10563
10855
|
const farmDefaultMCPServer = ${JSON.stringify(
|
|
10564
|
-
_chunkW53Z4WDIcjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root),
|
|
10856
|
+
_chunkW53Z4WDIcjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root), _chunkCVZY4TLWcjs.FARM_VERSION)
|
|
10565
10857
|
)};
|
|
10566
10858
|
let farmDefaultMCPRouteFree;
|
|
10567
10859
|
function getFarmDefaultMCPServer() {
|
|
@@ -10755,7 +11047,7 @@ ${edgeMiddlewareFilePaths.length > 0 ? `
|
|
|
10755
11047
|
// middleware guards is never prerendered. Read once: Nitro's prerender worker sets the variable.
|
|
10756
11048
|
const farmEdgeMiddlewareFiles = new Set(${JSON.stringify(edgeMiddlewareFilePaths)});
|
|
10757
11049
|
const farmPrerendering =
|
|
10758
|
-
typeof process !== "undefined" && process.env?.${
|
|
11050
|
+
typeof process !== "undefined" && process.env?.${_chunkZ37PDUJRcjs.FARM_PRERENDER_ENV} === "1";
|
|
10759
11051
|
` : ""}
|
|
10760
11052
|
const farmMiddlewareRunner = ${hasMiddlewareRuntime ? `createProductionMiddlewareRunner({
|
|
10761
11053
|
config: farmMiddlewareConfig,
|
|
@@ -10899,7 +11191,7 @@ function hasLocalRequestRoute(request, routePathname) {
|
|
|
10899
11191
|
if (${imageRuntime === "none" ? "false" : `pathname === ${JSON.stringify(config.images.path)}`}) {
|
|
10900
11192
|
return true;
|
|
10901
11193
|
}
|
|
10902
|
-
${_optionalChain([config, 'access',
|
|
11194
|
+
${_optionalChain([config, 'access', _241 => _241.docs, 'optionalAccess', _242 => _242.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
|
|
10903
11195
|
// The docs answer below the basePath; their API stays at /api/docs, as API routes do.
|
|
10904
11196
|
const docsRoutePathname = stripFarmBasePath(pathname);
|
|
10905
11197
|
if (
|
|
@@ -10927,7 +11219,7 @@ function getFarmPluginRequestOptions(request) {
|
|
|
10927
11219
|
route: { ...route, pattern: normalizeRuntimePath(farmOpenAPIReference.route) },
|
|
10928
11220
|
};
|
|
10929
11221
|
}
|
|
10930
|
-
const isDocsAPIRequest = ${_optionalChain([config, 'access',
|
|
11222
|
+
const isDocsAPIRequest = ${_optionalChain([config, 'access', _243 => _243.docs, 'optionalAccess', _244 => _244.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
|
|
10931
11223
|
const integrationMatch = ${hasServerRuntimeIntegrations ? `matchIntegrationRoute(serverRuntimeIntegrations, {
|
|
10932
11224
|
pathname,
|
|
10933
11225
|
method: request.method,
|
|
@@ -11011,7 +11303,7 @@ ${hasInfraAnalyticsRuntime ? `
|
|
|
11011
11303
|
// endpoints, Markdown mirrors, and docs pages have no app route pattern, so they are
|
|
11012
11304
|
// labeled here; route.pattern keeps meaning the matched app route for plugins.
|
|
11013
11305
|
const farmBuiltInRoutePaths = new Set(${JSON.stringify(
|
|
11014
|
-
|
|
11306
|
+
_chunk22BTYPIXcjs.listFarmBuiltInRoutePaths.call(void 0, {
|
|
11015
11307
|
agent: {
|
|
11016
11308
|
...config.agent,
|
|
11017
11309
|
aiCatalog: servesAiCatalog,
|
|
@@ -11022,9 +11314,9 @@ const farmBuiltInRoutePaths = new Set(${JSON.stringify(
|
|
|
11022
11314
|
openapi: openAPIReference
|
|
11023
11315
|
})
|
|
11024
11316
|
)});
|
|
11025
|
-
${_optionalChain([config, 'access',
|
|
11317
|
+
${_optionalChain([config, 'access', _245 => _245.docs, 'optionalAccess', _246 => _246.enabled]) ? `const farmDocsRouteLabelInput = {
|
|
11026
11318
|
path: normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs"),
|
|
11027
|
-
apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess',
|
|
11319
|
+
apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _247 => _247.apiPath]) || "/api/docs")},${_optionalChain([config, 'access', _248 => _248.docs, 'access', _249 => _249.roots, 'optionalAccess', _250 => _250.length]) ? "\n roots: farmDocsResolvedConfig.roots.map((farmDocsRoot) => farmDocsRoot.entry)," : ""}${farmDocsAnalyticsPages.length ? `
|
|
11028
11320
|
pages: new Set(${JSON.stringify(farmDocsAnalyticsPages)}),` : ""}
|
|
11029
11321
|
};
|
|
11030
11322
|
` : ""}// The request's route payload, for a handler that learns what answered while it handles.
|
|
@@ -11040,11 +11332,11 @@ function labelFarmRequestOptions(options) {
|
|
|
11040
11332
|
setFarmRouteLabel(options.route, mcpLabel);
|
|
11041
11333
|
return options;
|
|
11042
11334
|
}
|
|
11043
|
-
${_optionalChain([config, 'access',
|
|
11335
|
+
${_optionalChain([config, 'access', _251 => _251.docs, 'optionalAccess', _252 => _252.enabled]) ? `if (options.kind === "docs") {
|
|
11044
11336
|
setFarmRouteLabel(options.route, resolveFarmDocsRouteLabel(routePathname, farmDocsRouteLabelInput));
|
|
11045
11337
|
return options;
|
|
11046
11338
|
}` : ""}
|
|
11047
|
-
${_optionalChain([config, 'access',
|
|
11339
|
+
${_optionalChain([config, 'access', _253 => _253.md, 'optionalAccess', _254 => _254.enabled]) || hasMarkdownPages ? `const markdownLabel = resolveFarmMarkdownRouteLabel(
|
|
11048
11340
|
routePathname,
|
|
11049
11341
|
(page) => matchPageRoute(page)?.route.pattern,
|
|
11050
11342
|
);
|
|
@@ -11079,7 +11371,7 @@ function getApplicableLayouts(pathname, directory) {
|
|
|
11079
11371
|
return applicable;
|
|
11080
11372
|
}
|
|
11081
11373
|
|
|
11082
|
-
${_optionalChain([config, 'access',
|
|
11374
|
+
${_optionalChain([config, 'access', _255 => _255.docs, 'optionalAccess', _256 => _256.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
|
|
11083
11375
|
if (request.method === "HEAD") return response;
|
|
11084
11376
|
if (response.headers.get("x-farm-docs-adapter")) return response;
|
|
11085
11377
|
|
|
@@ -11153,8 +11445,8 @@ ${_optionalChain([config, 'access', _265 => _265.docs, 'optionalAccess', _266 =>
|
|
|
11153
11445
|
}
|
|
11154
11446
|
html = html.replace(/<[/]head>/i, function() { return renderedRoot.head + "\\n</head>"; });
|
|
11155
11447
|
}
|
|
11156
|
-
if (!html.includes('href="
|
|
11157
|
-
const clientStylesheet = '
|
|
11448
|
+
if (farmClientStylesheetHref && !html.includes('href="' + farmClientStylesheetHref + '"')) {
|
|
11449
|
+
const clientStylesheet = ' ' + renderFarmClientStylesheet() + '\\n';
|
|
11158
11450
|
const firstStyleIndex = html.search(/<style(?:\\s|>)/i);
|
|
11159
11451
|
html =
|
|
11160
11452
|
firstStyleIndex >= 0
|
|
@@ -11185,7 +11477,7 @@ ${_optionalChain([config, 'access', _265 => _265.docs, 'optionalAccess', _266 =>
|
|
|
11185
11477
|
|
|
11186
11478
|
// Shells keep their own LRU so query-string variants never evict app cache entries.
|
|
11187
11479
|
const pprShellCache = getFarmDataCache().pprShellCache;
|
|
11188
|
-
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access',
|
|
11480
|
+
const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _257 => _257.experimental, 'optionalAccess', _258 => _258.ppr]) === true)};
|
|
11189
11481
|
|
|
11190
11482
|
function resolveRouteRenderingView(route) {
|
|
11191
11483
|
// The same merge development uses: baked directive config under the
|
|
@@ -11305,7 +11597,7 @@ async function handleFarmRequest(request, adapterContext) {
|
|
|
11305
11597
|
},
|
|
11306
11598
|
{ redirect: !isFarmLocalAPIPathname(requestUrl.pathname) }
|
|
11307
11599
|
)` : "handleFarmRequestInContext(request, null, false, Date.now(), adapterContext, requestUrl)"};
|
|
11308
|
-
${_optionalChain([config, 'access',
|
|
11600
|
+
${_optionalChain([config, 'access', _259 => _259.md, 'optionalAccess', _260 => _260.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
|
|
11309
11601
|
if (matchPageRoute(pathname)) {
|
|
11310
11602
|
// The Link header advertises the public .md URL, like the head alternate.
|
|
11311
11603
|
return applyMarkdownNegotiationHeaders(response, {
|
|
@@ -11522,7 +11814,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11522
11814
|
return renderFarmErrorJSONResponse();` : `
|
|
11523
11815
|
if (isFarmLocalAPIPathname(pathname)) return renderFarmErrorJSONResponse();
|
|
11524
11816
|
// No page was selected, so only the root error boundary and layouts apply.
|
|
11525
|
-
const errorResponse = await renderFarmErrorResponse(middlewareResult.error, "/", {}, null);${_optionalChain([config, 'access',
|
|
11817
|
+
const errorResponse = await renderFarmErrorResponse(middlewareResult.error, "/", {}, null);${_optionalChain([config, 'access', _261 => _261.md, 'optionalAccess', _262 => _262.enabled]) ? `
|
|
11526
11818
|
// An agent asking for Markdown reads the error document as Markdown, as it
|
|
11527
11819
|
// does when a page throws. The helper answers null when Markdown is off.
|
|
11528
11820
|
const markdownErrorResponse = await createMarkdownMirrorResponse({
|
|
@@ -11564,7 +11856,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11564
11856
|
}
|
|
11565
11857
|
` : ""}
|
|
11566
11858
|
|
|
11567
|
-
${_optionalChain([config, 'access',
|
|
11859
|
+
${_optionalChain([config, 'access', _263 => _263.docs, 'optionalAccess', _264 => _264.enabled]) ? `
|
|
11568
11860
|
// Docs responses are served after app middleware so route guards and
|
|
11569
11861
|
// middleware headers apply to the docs engine like any other page content.
|
|
11570
11862
|
// An app's own llms.txt, llms-full.txt, sitemap.xml, and robots.txt take
|
|
@@ -11680,7 +11972,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11680
11972
|
}
|
|
11681
11973
|
` : ""}
|
|
11682
11974
|
|
|
11683
|
-
${_optionalChain([config, 'access',
|
|
11975
|
+
${_optionalChain([config, 'access', _265 => _265.md, 'optionalAccess', _266 => _266.enabled]) ? `
|
|
11684
11976
|
if (farmMarkdownConfig?.enabled) {
|
|
11685
11977
|
const markdownResponse = await createMarkdownMirrorResponse({
|
|
11686
11978
|
// The mirror helper only reads metadata and creates its own GET request.
|
|
@@ -11784,11 +12076,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11784
12076
|
return applyProductionMiddlewareHeaders(applicationMetadataResponse, middlewareHeaders);
|
|
11785
12077
|
}
|
|
11786
12078
|
` : ""}
|
|
11787
|
-
${_optionalChain([config, 'access',
|
|
12079
|
+
${_optionalChain([config, 'access', _267 => _267.agent, 'optionalAccess', _268 => _268.manifest]) !== false ? `
|
|
11788
12080
|
// agent.manifest: /.well-known/farmjs.json (and 0.1.34's /.well-known/farmjs), the app's
|
|
11789
12081
|
// public manifest, the same document for every request.
|
|
11790
12082
|
if (
|
|
11791
|
-
[${JSON.stringify(
|
|
12083
|
+
[${JSON.stringify(_chunk22BTYPIXcjs.FARM_APP_MANIFEST_PATH)}, ${JSON.stringify(_chunk22BTYPIXcjs.FARM_APP_MANIFEST_LEGACY_PATH)}].includes(
|
|
11792
12084
|
normalizeRuntimePath(routePathname),
|
|
11793
12085
|
)
|
|
11794
12086
|
) {
|
|
@@ -11798,9 +12090,9 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11798
12090
|
);
|
|
11799
12091
|
}
|
|
11800
12092
|
` : ""}
|
|
11801
|
-
${_optionalChain([config, 'access',
|
|
12093
|
+
${_optionalChain([config, 'access', _269 => _269.agent, 'optionalAccess', _270 => _270.apiCatalog]) ? `
|
|
11802
12094
|
// agent.apiCatalog: list the OpenAPI and MCP surfaces at the RFC 9727 path.
|
|
11803
|
-
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(
|
|
12095
|
+
if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunk22BTYPIXcjs.FARM_API_CATALOG_PATH)}) {
|
|
11804
12096
|
return applyProductionMiddlewareHeaders(
|
|
11805
12097
|
createFarmApiCatalogResponse(request.method, farmApiCatalogInput, request),
|
|
11806
12098
|
middlewareHeaders,
|
|
@@ -11825,11 +12117,11 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11825
12117
|
);
|
|
11826
12118
|
}
|
|
11827
12119
|
` : ""}
|
|
11828
|
-
${_optionalChain([config, 'access',
|
|
12120
|
+
${_optionalChain([config, 'access', _271 => _271.agent, 'optionalAccess', _272 => _272.llmsTxt, 'optionalAccess', _273 => _273.enabled]) ? `
|
|
11829
12121
|
// agent.llmsTxt with no llms.ts or llms-full.ts: serve the generated files.
|
|
11830
12122
|
const farmGeneratedLlmsKind = normalizeRuntimePath(routePathname) === "/llms.txt"
|
|
11831
12123
|
? "llms"
|
|
11832
|
-
: ${_optionalChain([config, 'access',
|
|
12124
|
+
: ${_optionalChain([config, 'access', _274 => _274.agent, 'optionalAccess', _275 => _275.llmsTxt, 'optionalAccess', _276 => _276.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
|
|
11833
12125
|
if (farmGeneratedLlmsKind) {
|
|
11834
12126
|
const llmsContext = createFarmLlmsTxtContext(request, farmGeneratedLlmsKind === "llms-full");
|
|
11835
12127
|
// Renders are shared per origin the request reached, which is where pages are read.
|
|
@@ -11865,7 +12157,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
11865
12157
|
}
|
|
11866
12158
|
` : ""}
|
|
11867
12159
|
|
|
11868
|
-
${_optionalChain([config, 'access',
|
|
12160
|
+
${_optionalChain([config, 'access', _277 => _277.docs, 'optionalAccess', _278 => _278.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
|
|
11869
12161
|
const docsAPIResponse = await farmDocsAPIHandler(cloneFarmRequestWithContext(request));
|
|
11870
12162
|
if (docsAPIResponse) {
|
|
11871
12163
|
return applyProductionMiddlewareHeaders(
|
|
@@ -12360,7 +12652,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12360
12652
|
pageElement,
|
|
12361
12653
|
);
|
|
12362
12654
|
|
|
12363
|
-
${
|
|
12655
|
+
${_chunk3OKSEJ33cjs.isReactRenderer.call(void 0, config.renderer) ? "if (route.shouldHydrate && !shouldHydrateLayout) pageElement = markPagePosition(React, pageElement);" : ""}
|
|
12364
12656
|
// Wrap with layouts (from innermost to outermost)
|
|
12365
12657
|
// Layouts are sorted by depth (root first), so we process in reverse
|
|
12366
12658
|
let wrappedElement = pageElement;
|
|
@@ -12434,7 +12726,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12434
12726
|
wrappedElement = wrapFarmRouteClientGraph(wrappedElement);
|
|
12435
12727
|
}
|
|
12436
12728
|
|
|
12437
|
-
${
|
|
12729
|
+
${_chunk3OKSEJ33cjs.isReactRenderer.call(void 0, config.renderer) ? "if (route.shouldHydrate && !shouldHydrateLayout) wrappedElement = markLayoutPosition(React, wrappedElement);" : ""}
|
|
12438
12730
|
wrappedElement = wrapWithFarmIntegrationProviders(wrappedElement);
|
|
12439
12731
|
return renderFarmElement(ReactDOMServer, wrappedElement, route.pattern, farmFlushToken);
|
|
12440
12732
|
};
|
|
@@ -12505,7 +12797,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12505
12797
|
);
|
|
12506
12798
|
}
|
|
12507
12799
|
}
|
|
12508
|
-
${_optionalChain([config, 'access',
|
|
12800
|
+
${_optionalChain([config, 'access', _279 => _279.md, 'optionalAccess', _280 => _280.enabled]) ? `
|
|
12509
12801
|
// Advertise the Markdown mirror in the head as well as the Link header,
|
|
12510
12802
|
// using the public path the .md request will be resolved against.
|
|
12511
12803
|
mergedMetadata = addMetadataMarkdownAlternate(
|
|
@@ -12534,7 +12826,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12534
12826
|
emitFarmEvent({ type: "cache.bypass", route: pathname, reason: "cookie" });
|
|
12535
12827
|
}
|
|
12536
12828
|
|
|
12537
|
-
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access',
|
|
12829
|
+
const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _281 => _281.agent, 'optionalAccess', _282 => _282.jsonLd]), () => ( false)))} });
|
|
12538
12830
|
const title = renderedMetadata.title;
|
|
12539
12831
|
const metaTags = renderedMetadata.tags;
|
|
12540
12832
|
const hasFavicon = renderedMetadata.hasFavicon;
|
|
@@ -12615,10 +12907,9 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12615
12907
|
// A document something hydrates over holds the clicks and submits made before it hydrates,
|
|
12616
12908
|
// for the client entry to replay, as development does. One that starts with the boot entry
|
|
12617
12909
|
// holds its own.
|
|
12910
|
+
const farmHydratesRoot = route.shouldHydrate || shouldHydrateLayout;
|
|
12618
12911
|
const farmHoldsInteractions =
|
|
12619
|
-
|
|
12620
|
-
shouldHydrateLayout ||
|
|
12621
|
-
renderedRouteSlots.some(function(slot) { return slot.hydrates; });
|
|
12912
|
+
farmHydratesRoot || renderedRouteSlots.some(function(slot) { return slot.hydrates; });
|
|
12622
12913
|
const renderFarmPreHydrationHoldScript = function() {
|
|
12623
12914
|
return farmHoldsInteractions && !farmBootsClient
|
|
12624
12915
|
? stampFarmCspNonce(createPreHydrationClickQueueScript()) + '\\n'
|
|
@@ -12637,7 +12928,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12637
12928
|
);
|
|
12638
12929
|
composed = composed
|
|
12639
12930
|
// Inject CSS link after opening head tag or first meta tag
|
|
12640
|
-
.replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n
|
|
12931
|
+
.replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n ' + renderFarmClientStylesheet() + (farmBootsClient ? "" : renderFarmClientModulePreloads(composed, route.clientModule, farmNavigationRequest, farmHydratesRoot)); })
|
|
12641
12932
|
.replace(/<\\/head>/i, () => renderFarmRendererHydrationScript() + '\\n' + renderFarmPreHydrationHoldScript() + '</head>')
|
|
12642
12933
|
// Explicit metadata wins over renderer and layout titles. Without
|
|
12643
12934
|
// explicit metadata, a renderer title wins over the layout title.
|
|
@@ -12710,8 +13001,8 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12710
13001
|
(hasFavicon ? '' : ' <link rel="icon" href="data:,">\\n') +
|
|
12711
13002
|
(suppressDefaultTitle ? '' : ' <title>' + title + '</title>') + metaTags +
|
|
12712
13003
|
(rendererHead ? '\\n ' + rendererHead : '') + '\\n' +
|
|
12713
|
-
'
|
|
12714
|
-
' <link rel="modulepreload" href="/__farm_client_js_src__">' + renderFarmClientModulePreloads(null, route.clientModule) + '\\n' +
|
|
13004
|
+
' ' + renderFarmClientStylesheet() + '\\n' +
|
|
13005
|
+
' <link rel="modulepreload" href="/__farm_client_js_src__">' + renderFarmClientModulePreloads(null, route.clientModule, false, farmHydratesRoot) + '\\n' +
|
|
12715
13006
|
renderFarmRendererHydrationScript() + '\\n' +
|
|
12716
13007
|
renderFarmPreHydrationHoldScript() +
|
|
12717
13008
|
'</head>\\n<body>\\n' + farmEarlyClientScripts + ' <div id="root">';
|
|
@@ -12825,7 +13116,6 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12825
13116
|
}
|
|
12826
13117
|
}
|
|
12827
13118
|
// A route that hydrates as one root starts with the boot entry only when that root waits.
|
|
12828
|
-
const farmHydratesRoot = route.shouldHydrate || shouldHydrateLayout;
|
|
12829
13119
|
farmBootsClient = farmDocumentBootsClient(
|
|
12830
13120
|
html,
|
|
12831
13121
|
(farmHydratesRoot && !route.rootStrategy) || Boolean(pprCacheKey),
|
|
@@ -12868,7 +13158,7 @@ ${hasServerRuntimeIntegrations ? `
|
|
|
12868
13158
|
\${viewportTags}
|
|
12869
13159
|
\${hasFavicon ? "" : '<link rel="icon" href="data:,">'}
|
|
12870
13160
|
\${suppressDefaultTitle ? "" : "<title>" + title + "</title>"}\${metaTags}\${rendererHead ? "\\n " + rendererHead : ""}
|
|
12871
|
-
|
|
13161
|
+
\${renderFarmClientStylesheet()}\${farmBootsClient ? "" : renderFarmClientModulePreloads(html, route.clientModule, farmNavigationRequest, farmHydratesRoot)}
|
|
12872
13162
|
\${renderFarmRendererHydrationScript()}
|
|
12873
13163
|
\${renderFarmPreHydrationHoldScript()}</head>
|
|
12874
13164
|
<body>
|
|
@@ -13229,7 +13519,7 @@ ${farmRendererDisabled ? `
|
|
|
13229
13519
|
"<head" + attrs + ">" +
|
|
13230
13520
|
headContent.replace(/<title\\b[^>]*>[\\s\\S]*?<\\/title>\\s*/gi, "") +
|
|
13231
13521
|
"\\n <title>" + notFoundMetadata.title + "</title>" + notFoundMetadata.tags + "\\n</head>")
|
|
13232
|
-
.replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n
|
|
13522
|
+
.replace(/<head([^>]*)>/i, function(match, attrs) { return '<head' + attrs + '>\\n ' + renderFarmClientStylesheet() + renderFarmClientModulePreloads(fullDocument); })
|
|
13233
13523
|
.replace(/<\\/head>/i, () => renderFarmRendererHydrationScript() + '\\n</head>')
|
|
13234
13524
|
.replace(
|
|
13235
13525
|
/<\\/body>/i,
|
|
@@ -13247,7 +13537,7 @@ ${farmRendererDisabled ? `
|
|
|
13247
13537
|
<meta charset="UTF-8">
|
|
13248
13538
|
\${notFoundMetadata.viewport}
|
|
13249
13539
|
\${notFoundMetadata.hasFavicon ? "" : '<link rel="icon" href="data:,">'}
|
|
13250
|
-
|
|
13540
|
+
\${renderFarmClientStylesheet()}\${renderFarmClientModulePreloads(html)}
|
|
13251
13541
|
<title>\${notFoundMetadata.title}</title>\${notFoundMetadata.tags}
|
|
13252
13542
|
\${renderFarmRendererHydrationScript()}
|
|
13253
13543
|
</head>
|
|
@@ -13381,11 +13671,11 @@ function createFarmRuntimeHookErrorResponse(request, error) {
|
|
|
13381
13671
|
export async function fetch(request, context) {${imageRuntime === "none" ? "" : `
|
|
13382
13672
|
// The image optimizer's fetch of a local source is not a loopback visitor.
|
|
13383
13673
|
context = _withFarmImageSourceClientAddress(request, context);`}
|
|
13384
|
-
${_optionalChain([config, 'access',
|
|
13674
|
+
${_optionalChain([config, 'access', _283 => _283.agent, 'optionalAccess', _284 => _284.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
|
|
13385
13675
|
basePath: farmLocalAPIBasePath,
|
|
13386
13676
|
dispatch: async (localRequest) =>
|
|
13387
13677
|
(await handleAPIRequest(localRequest)) ?? Response.json({ error: "Not Found" }, { status: 404 }),
|
|
13388
|
-
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access',
|
|
13678
|
+
}, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _285 => _285.agent, 'optionalAccess', _286 => _286.noindexPreviews]) ? `
|
|
13389
13679
|
// Keep every response of a preview deployment out of search indexes.
|
|
13390
13680
|
return farmNoindexPreview ? applyFarmPreviewRobotsTag(response) : response;` : ""}
|
|
13391
13681
|
}
|
|
@@ -13595,7 +13885,7 @@ function getManifestPageEntry(manifest, pathname) {
|
|
|
13595
13885
|
})).sort((left, right) => _chunkML4TOUZPcjs.compareRouteSpecificity.call(void 0, left.specificity, right.specificity)).map(({ entry, matches }) => ({ entry, matches }));
|
|
13596
13886
|
manifestPageMatchers.set(manifest.routes, pages);
|
|
13597
13887
|
}
|
|
13598
|
-
return _optionalChain([pages, 'access',
|
|
13888
|
+
return _optionalChain([pages, 'access', _287 => _287.find, 'call', _288 => _288((page) => page.matches(pathname)), 'optionalAccess', _289 => _289.entry]);
|
|
13599
13889
|
}
|
|
13600
13890
|
function withFarmEdgeGuardedPrerenderHeaders(headers, edgeGuarded) {
|
|
13601
13891
|
if (!edgeGuarded) return headers;
|
|
@@ -13611,7 +13901,7 @@ function prerenderWouldChangePageUrl(pathname) {
|
|
|
13611
13901
|
if (/%(?:23|25|2F|3F)/i.test(pathname)) return true;
|
|
13612
13902
|
try {
|
|
13613
13903
|
return decodeURI(pathname) !== pathname;
|
|
13614
|
-
} catch (
|
|
13904
|
+
} catch (e39) {
|
|
13615
13905
|
return true;
|
|
13616
13906
|
}
|
|
13617
13907
|
}
|
|
@@ -13632,13 +13922,13 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
13632
13922
|
if (rewriteSources.some((source) => middlewarePatternMatches(source, pathname))) {
|
|
13633
13923
|
return "rewrite";
|
|
13634
13924
|
}
|
|
13635
|
-
if (
|
|
13636
|
-
if (
|
|
13637
|
-
if (
|
|
13925
|
+
if (_chunk4B6YJ5DScjs.appMiddlewareMayHandlePath.call(void 0, middlewareRoutes, pathname)) return "app middleware";
|
|
13926
|
+
if (_chunk4B6YJ5DScjs.configMiddlewareMayHandlePath.call(void 0, config.middleware, pathname)) return "configured middleware";
|
|
13927
|
+
if (_chunkBOEDYXAXcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
|
|
13638
13928
|
if (farmServerRuntimePluginsMayHandlePath(config, pathname)) return "server runtime plugin";
|
|
13639
13929
|
const manifestEntry = getManifestPageEntry(routeRuntimeManifest, pathname);
|
|
13640
|
-
if (_optionalChain([manifestEntry, 'optionalAccess',
|
|
13641
|
-
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access',
|
|
13930
|
+
if (_optionalChain([manifestEntry, 'optionalAccess', _290 => _290.rendering]) === "dynamic") return "dynamic runtime manifest";
|
|
13931
|
+
if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _291 => _291.regions, 'optionalAccess', _292 => _292.length])) || manifestEntry.maxDuration !== void 0)) {
|
|
13642
13932
|
return "route runtime controls";
|
|
13643
13933
|
}
|
|
13644
13934
|
const routeRule = getEffectiveRouteRule(config, pathname);
|
|
@@ -13651,14 +13941,14 @@ function getPhysicalPrerenderBypassReason(options) {
|
|
|
13651
13941
|
return void 0;
|
|
13652
13942
|
}
|
|
13653
13943
|
async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
13654
|
-
if (!_optionalChain([config, 'access',
|
|
13944
|
+
if (!_optionalChain([config, 'access', _293 => _293.docs, 'optionalAccess', _294 => _294.enabled]) || !config.docs.prerender) return [];
|
|
13655
13945
|
if (_chunkNLBHLPEOcjs.getFarmPresetRuntime.call(void 0, preset) === "edge") {
|
|
13656
13946
|
_chunk7U4XF76Rcjs.logger.info(
|
|
13657
13947
|
`\u21AA Keeping docs pages in the edge docs snapshot: docs.prerender writes static files on Node and serverless targets, not "${preset}".`
|
|
13658
13948
|
);
|
|
13659
13949
|
return [];
|
|
13660
13950
|
}
|
|
13661
|
-
if (!
|
|
13951
|
+
if (!_chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
|
|
13662
13952
|
const { pages: pages2, originDependent } = _chunkHR5GU4UUcjs.listFarmDocsBuiltInPrerenderPages.call(void 0, config.docs, {
|
|
13663
13953
|
root,
|
|
13664
13954
|
srcDir: config.srcDir
|
|
@@ -13670,13 +13960,7 @@ async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
|
13670
13960
|
}
|
|
13671
13961
|
return pages2;
|
|
13672
13962
|
}
|
|
13673
|
-
|
|
13674
|
-
_chunk7U4XF76Rcjs.logger.warn(
|
|
13675
|
-
`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.`
|
|
13676
|
-
);
|
|
13677
|
-
return [];
|
|
13678
|
-
}
|
|
13679
|
-
const pages = await _chunkHHQEKLZLcjs.listFarmDocsAdapterPages.call(void 0, config.docs, { root, srcDir: config.srcDir });
|
|
13963
|
+
const pages = await _chunkUSMRAC72cjs.listFarmDocsAdapterPages.call(void 0, config.docs, { root, srcDir: config.srcDir });
|
|
13680
13964
|
if (!pages) {
|
|
13681
13965
|
_chunk7U4XF76Rcjs.logger.warn(
|
|
13682
13966
|
`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.`
|
|
@@ -13686,14 +13970,14 @@ async function getFarmDocsPrerenderPages(config, root, preset) {
|
|
|
13686
13970
|
return pages;
|
|
13687
13971
|
}
|
|
13688
13972
|
async function listFarmDocsAnalyticsPages(config, root, preset) {
|
|
13689
|
-
if (!_optionalChain([config, 'access',
|
|
13973
|
+
if (!_optionalChain([config, 'access', _295 => _295.docs, 'optionalAccess', _296 => _296.enabled]) || config.analytics === false || _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) !== "nodejs") {
|
|
13690
13974
|
return [];
|
|
13691
13975
|
}
|
|
13692
13976
|
try {
|
|
13693
|
-
return await
|
|
13977
|
+
return await _chunkUSMRAC72cjs.listFarmDocsPagePaths.call(void 0, config.docs, {
|
|
13694
13978
|
root,
|
|
13695
13979
|
srcDir: config.srcDir,
|
|
13696
|
-
adapter:
|
|
13980
|
+
adapter: _chunkL2GUEYHRcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)
|
|
13697
13981
|
});
|
|
13698
13982
|
} catch (error) {
|
|
13699
13983
|
_chunk7U4XF76Rcjs.logger.warn(
|
|
@@ -13704,9 +13988,9 @@ async function listFarmDocsAnalyticsPages(config, root, preset) {
|
|
|
13704
13988
|
}
|
|
13705
13989
|
function hasFarmNitroCacheRouteRule(routeRules) {
|
|
13706
13990
|
return Object.values(routeRules || {}).some((rule) => {
|
|
13707
|
-
const swr = _optionalChain([rule, 'optionalAccess',
|
|
13708
|
-
const cache = _optionalChain([rule, 'optionalAccess',
|
|
13709
|
-
const headers = _optionalChain([rule, 'optionalAccess',
|
|
13991
|
+
const swr = _optionalChain([rule, 'optionalAccess', _297 => _297.swr]);
|
|
13992
|
+
const cache = _optionalChain([rule, 'optionalAccess', _298 => _298.cache]);
|
|
13993
|
+
const headers = _optionalChain([rule, 'optionalAccess', _299 => _299.headers]);
|
|
13710
13994
|
return swr !== void 0 && swr !== false || cache !== void 0 && cache !== false || !!headers && typeof headers === "object" && Object.keys(headers).length > 0;
|
|
13711
13995
|
});
|
|
13712
13996
|
}
|
|
@@ -13719,10 +14003,10 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
13719
14003
|
const nitroBuilder = nitroBuilderResult.value;
|
|
13720
14004
|
const isVercel = preset === "vercel";
|
|
13721
14005
|
const isCloudflareWorker = preset === "cloudflare-module";
|
|
13722
|
-
const outputDir =
|
|
14006
|
+
const outputDir = _chunkBOEDYXAXcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
13723
14007
|
const runtimeServerOutputDir = isVercel ? _path2.default.join(outputDir, "functions", "__nitro.func") : _path2.default.join(outputDir, "server");
|
|
13724
14008
|
const ssrOutputDir = _path2.default.join(root, distDir, "ssr");
|
|
13725
|
-
const imageRuntime =
|
|
14009
|
+
const imageRuntime = _chunkOFVBMS6Icjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
|
|
13726
14010
|
const hasGeneratedMetadataImages = Array.from(routeManager.getMetadataImages().values()).some(
|
|
13727
14011
|
(image) => image.sourceType === "module"
|
|
13728
14012
|
);
|
|
@@ -13778,7 +14062,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
13778
14062
|
const edgeGuardedPrerenderRoutes = [];
|
|
13779
14063
|
const addPrerenderRoute = (pathname) => {
|
|
13780
14064
|
prerenderRoutes.push(pathname);
|
|
13781
|
-
if (
|
|
14065
|
+
if (_chunk4B6YJ5DScjs.appMiddlewareMayHandlePath.call(void 0, edgeMiddlewareRoutes, pathname)) {
|
|
13782
14066
|
edgeGuardedPrerenderRoutes.push(pathname);
|
|
13783
14067
|
}
|
|
13784
14068
|
};
|
|
@@ -13862,6 +14146,9 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
13862
14146
|
const encodedDocsModulePreloads = encodeFarmDocsModulePreloads(docsModulePreloads);
|
|
13863
14147
|
const encodedClientModulePreloads = encodeFarmClientModulePreloads(clientModulePreloads);
|
|
13864
14148
|
const encodedClientRouteTable = encodeFarmBuildJSONPlaceholder(clientRouteTable);
|
|
14149
|
+
const encodedClientStylesheet = encodeFarmBuildJSONPlaceholder(
|
|
14150
|
+
await resolveClientStylesheetLinkHref(clientOutputDir, clientCssHref)
|
|
14151
|
+
);
|
|
13865
14152
|
const encodedMobileShellClient = shouldBuildFarmMobileClient(config) ? _chunkE5UN4OWXcjs.encodeFarmMobileShellClient.call(void 0,
|
|
13866
14153
|
await _chunkE5UN4OWXcjs.finalizeFarmMobileClient.call(void 0, {
|
|
13867
14154
|
buildDir: _path2.default.join(root, distDir),
|
|
@@ -13869,7 +14156,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
13869
14156
|
webEntry: clientJsSrc,
|
|
13870
14157
|
webBoot: clientBootSrc,
|
|
13871
14158
|
stylesheet: clientCssHref,
|
|
13872
|
-
webFiles: _nullishCoalesce(_optionalChain([clientModulePreloads, 'optionalAccess',
|
|
14159
|
+
webFiles: _nullishCoalesce(_optionalChain([clientModulePreloads, 'optionalAccess', _300 => _300.files]), () => ( []))
|
|
13873
14160
|
})
|
|
13874
14161
|
) : null;
|
|
13875
14162
|
for (const output of Object.values(ssrBundle)) {
|
|
@@ -13886,6 +14173,9 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
|
|
|
13886
14173
|
if (output.code.includes(FARM_CLIENT_ROUTE_TABLE_PLACEHOLDER)) {
|
|
13887
14174
|
output.code = output.code.split(FARM_CLIENT_ROUTE_TABLE_PLACEHOLDER).join(encodedClientRouteTable);
|
|
13888
14175
|
}
|
|
14176
|
+
if (output.code.includes(FARM_CLIENT_STYLESHEET_PLACEHOLDER)) {
|
|
14177
|
+
output.code = output.code.split(FARM_CLIENT_STYLESHEET_PLACEHOLDER).join(encodedClientStylesheet);
|
|
14178
|
+
}
|
|
13889
14179
|
if (output.code.includes(FARM_CLIENT_CSS_HREF_PLACEHOLDER)) {
|
|
13890
14180
|
output.code = output.code.split(FARM_CLIENT_CSS_HREF_PLACEHOLDER).join(clientCssHref);
|
|
13891
14181
|
}
|
|
@@ -14192,7 +14482,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14192
14482
|
varyFarmNitroCacheRules(_chunkIIHZ2BEEcjs.routeRulesToNitroRouteRules.call(void 0, config.routeRules), [
|
|
14193
14483
|
...config.md.enabled ? ["accept"] : [],
|
|
14194
14484
|
...shouldBuildFarmMobileClient(config) ? ["x-farm-shell"] : [],
|
|
14195
|
-
...
|
|
14485
|
+
..._chunk3OKSEJ33cjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _301 => _301.experimental, 'optionalAccess', _302 => _302.serverComponents])) === "islands" ? ["f-layouts"] : []
|
|
14196
14486
|
]),
|
|
14197
14487
|
config.basePath,
|
|
14198
14488
|
_chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, config.api)
|
|
@@ -14357,22 +14647,22 @@ function toFarmNodeResponse(request, response) {
|
|
|
14357
14647
|
snapshotSSRRebundleOptions(nitroConfig)
|
|
14358
14648
|
);
|
|
14359
14649
|
const requestedBuilder = _nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER));
|
|
14360
|
-
const nitroBuildIsFarms = (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access',
|
|
14361
|
-
_optionalChain([nitroConfig, 'access',
|
|
14362
|
-
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess',
|
|
14650
|
+
const nitroBuildIsFarms = (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _303 => _303.rollupConfig, 'optionalAccess', _304 => _304.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _305 => _305.rollupConfig, 'optionalAccess', _306 => _306.plugins])) && customRollupKeys.length === 0 && Boolean(
|
|
14651
|
+
_optionalChain([nitroConfig, 'access', _307 => _307.handlers, 'optionalAccess', _308 => _308.some, 'call', _309 => _309(
|
|
14652
|
+
(handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _310 => _310.handler]) || "") === nitroEntryPath
|
|
14363
14653
|
)])
|
|
14364
14654
|
);
|
|
14365
|
-
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && nitroBuildIsFarms && _path2.default.resolve(_optionalChain([nitroConfig, 'access',
|
|
14655
|
+
const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && nitroBuildIsFarms && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _311 => _311.output, 'optionalAccess', _312 => _312.serverDir]) || "") === _path2.default.resolve(expectedServerDir);
|
|
14366
14656
|
const prerenderReusesPrebuiltSSR = prerenderRoutes.length > 0 && ssrExternalsArePackaged && nitroBuildIsFarms;
|
|
14367
14657
|
const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
|
|
14368
14658
|
if (selectRolldownBuilder) nitroConfig.builder = "rolldown";
|
|
14369
14659
|
const useRolldownBuilder = canReusePrebuiltSSR && (_nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER))) === "rolldown";
|
|
14370
14660
|
const shouldMinify = nitroConfig.minify !== false;
|
|
14371
|
-
const keepServerNames = !(_optionalChain([config, 'access',
|
|
14661
|
+
const keepServerNames = !(_optionalChain([config, 'access', _313 => _313.docs, 'optionalAccess', _314 => _314.enabled]) && _optionalChain([config, 'access', _315 => _315.docs, 'access', _316 => _316.adapter, 'optionalAccess', _317 => _317.server]));
|
|
14372
14662
|
const useFarmServerMinifier = shouldMinify && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig;
|
|
14373
14663
|
const serverChunkMinifier = useFarmServerMinifier ? createServerChunkMinifyPlugin({ keepNames: keepServerNames, target: "esnext" }) : null;
|
|
14374
14664
|
const ssrRollupPlugin = canReusePrebuiltSSR ? prebuiltSSRPlugin : createServerReadSSRAssetsPlugin(ssrBundle, ssrOutputDir);
|
|
14375
|
-
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access',
|
|
14665
|
+
const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _318 => _318.rollupConfig, 'optionalAccess', _319 => _319.plugins]);
|
|
14376
14666
|
nitroConfig.rollupConfig = {
|
|
14377
14667
|
...nitroConfig.rollupConfig,
|
|
14378
14668
|
plugins: [
|
|
@@ -14397,7 +14687,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14397
14687
|
Array.from(routes, (route, index) => {
|
|
14398
14688
|
try {
|
|
14399
14689
|
return [decodeURI(route), index];
|
|
14400
|
-
} catch (
|
|
14690
|
+
} catch (e40) {
|
|
14401
14691
|
return [route, index];
|
|
14402
14692
|
}
|
|
14403
14693
|
})
|
|
@@ -14411,7 +14701,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14411
14701
|
let skippedNonHtmlPrerenderRoute = false;
|
|
14412
14702
|
nitroInstance.hooks.hook("prerender:generate", (route) => {
|
|
14413
14703
|
if (route.error || !prerenderPagePaths.has(route.route)) return;
|
|
14414
|
-
if (_optionalChain([route, 'access',
|
|
14704
|
+
if (_optionalChain([route, 'access', _320 => _320.contentType, 'optionalAccess', _321 => _321.toLowerCase, 'call', _322 => _322(), 'access', _323 => _323.includes, 'call', _324 => _324("html")])) return;
|
|
14415
14705
|
route.skip = true;
|
|
14416
14706
|
skippedNonHtmlPrerenderRoute = true;
|
|
14417
14707
|
const configuredRule = configuredNitroRouteRules[route.route];
|
|
@@ -14422,9 +14712,9 @@ function toFarmNodeResponse(request, response) {
|
|
|
14422
14712
|
nitroInstance.hooks.hook("prerender:done", () => {
|
|
14423
14713
|
if (skippedNonHtmlPrerenderRoute) nitroInstance.routing.sync();
|
|
14424
14714
|
});
|
|
14425
|
-
if (_optionalChain([config, 'access',
|
|
14715
|
+
if (_optionalChain([config, 'access', _325 => _325.md, 'optionalAccess', _326 => _326.enabled])) {
|
|
14426
14716
|
nitroInstance.hooks.hook("prerender:generate", (route) => {
|
|
14427
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
14717
|
+
if (!route.contents || !_optionalChain([route, 'access', _327 => _327.contentType, 'optionalAccess', _328 => _328.toLowerCase, 'call', _329 => _329(), 'access', _330 => _330.includes, 'call', _331 => _331("html")])) return;
|
|
14428
14718
|
const alternatePath = _chunk2NOHVIJ3cjs.getFarmMarkdownAlternatePath.call(void 0, config.md, route.route, {
|
|
14429
14719
|
routePathname: (pathname) => routeManager.toRoutePathname(pathname)
|
|
14430
14720
|
});
|
|
@@ -14447,7 +14737,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14447
14737
|
}
|
|
14448
14738
|
if (config.security.csp && config.security.csp.nonce) {
|
|
14449
14739
|
nitroInstance.hooks.hook("prerender:generate", async (route) => {
|
|
14450
|
-
if (!route.contents || !_optionalChain([route, 'access',
|
|
14740
|
+
if (!route.contents || !_optionalChain([route, 'access', _332 => _332.contentType, 'optionalAccess', _333 => _333.toLowerCase, 'call', _334 => _334(), 'access', _335 => _335.includes, 'call', _336 => _336("html")])) return;
|
|
14451
14741
|
const staticCsp = await _chunk6JHZPB52cjs.applyFarmCspHashesToHtml.call(void 0, route.contents, config.security);
|
|
14452
14742
|
if (!staticCsp) return;
|
|
14453
14743
|
route.contents = staticCsp.html;
|
|
@@ -14483,7 +14773,7 @@ function toFarmNodeResponse(request, response) {
|
|
|
14483
14773
|
await nitroBuilder.copyPublicAssets(nitroInstance);
|
|
14484
14774
|
if (prerenderReusesPrebuiltSSR && !canReusePrebuiltSSR) {
|
|
14485
14775
|
nitroInstance.hooks.hook("prerender:config", (prerendererConfig) => {
|
|
14486
|
-
const configuredPlugins = _optionalChain([prerendererConfig, 'access',
|
|
14776
|
+
const configuredPlugins = _optionalChain([prerendererConfig, 'access', _337 => _337.rollupConfig, 'optionalAccess', _338 => _338.plugins]);
|
|
14487
14777
|
const plugins = Array.isArray(configuredPlugins) ? configuredPlugins : configuredPlugins ? [configuredPlugins] : [];
|
|
14488
14778
|
prerendererConfig.rollupConfig = {
|
|
14489
14779
|
...prerendererConfig.rollupConfig,
|
|
@@ -14540,13 +14830,13 @@ function toFarmNodeResponse(request, response) {
|
|
|
14540
14830
|
}
|
|
14541
14831
|
if (prerenderRoutes.length > 0) {
|
|
14542
14832
|
_chunk7U4XF76Rcjs.logger.info(`\u{1F4C4} Pre-rendering ${prerenderRoutes.length} SSG page(s)`);
|
|
14543
|
-
const previousPrerender = process.env[
|
|
14544
|
-
process.env[
|
|
14833
|
+
const previousPrerender = process.env[_chunkZ37PDUJRcjs.FARM_PRERENDER_ENV];
|
|
14834
|
+
process.env[_chunkZ37PDUJRcjs.FARM_PRERENDER_ENV] = "1";
|
|
14545
14835
|
try {
|
|
14546
14836
|
await nitroBuilder.prerender(nitroInstance);
|
|
14547
14837
|
} finally {
|
|
14548
|
-
if (previousPrerender === void 0) delete process.env[
|
|
14549
|
-
else process.env[
|
|
14838
|
+
if (previousPrerender === void 0) delete process.env[_chunkZ37PDUJRcjs.FARM_PRERENDER_ENV];
|
|
14839
|
+
else process.env[_chunkZ37PDUJRcjs.FARM_PRERENDER_ENV] = previousPrerender;
|
|
14550
14840
|
}
|
|
14551
14841
|
}
|
|
14552
14842
|
const sharpRuntimeStagePromise = imageRuntime === "node" ? stageSharpRuntime(config, root, distDir, fs5, preset) : Promise.resolve(null);
|
|
@@ -14723,7 +15013,7 @@ async function moveVercelOutputPath(src, dest, fs5) {
|
|
|
14723
15013
|
await fs5.rename(src, dest);
|
|
14724
15014
|
return;
|
|
14725
15015
|
} catch (error) {
|
|
14726
|
-
const code = _optionalChain([error, 'optionalAccess',
|
|
15016
|
+
const code = _optionalChain([error, 'optionalAccess', _339 => _339.code]);
|
|
14727
15017
|
if (code !== "EPERM" && code !== "EACCES" && code !== "EXDEV" && code !== "ENOTEMPTY") {
|
|
14728
15018
|
throw error;
|
|
14729
15019
|
}
|
|
@@ -14749,7 +15039,7 @@ async function postProcessVercelOutput(root, outputDir, fs5, config, farmWorkflo
|
|
|
14749
15039
|
try {
|
|
14750
15040
|
await moveVercelOutputPath(publicDir, staticDir, fs5);
|
|
14751
15041
|
} catch (error) {
|
|
14752
|
-
if (_optionalChain([error, 'optionalAccess',
|
|
15042
|
+
if (_optionalChain([error, 'optionalAccess', _340 => _340.code]) !== "ENOENT") throw error;
|
|
14753
15043
|
}
|
|
14754
15044
|
await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs5);
|
|
14755
15045
|
await copyPrismaClientForVercel(root, nitroFuncDir, fs5);
|
|
@@ -14763,7 +15053,7 @@ async function postProcessVercelOutput(root, outputDir, fs5, config, farmWorkflo
|
|
|
14763
15053
|
config.basePath
|
|
14764
15054
|
);
|
|
14765
15055
|
const edgeMiddlewareRoutes = edgeMiddleware.middlewareRoutes.filter(
|
|
14766
|
-
(route) => edgeMiddleware.guardedPages.some((pathname) =>
|
|
15056
|
+
(route) => edgeMiddleware.guardedPages.some((pathname) => _chunk4B6YJ5DScjs.appMiddlewareMayHandlePath.call(void 0, [route], pathname))
|
|
14767
15057
|
);
|
|
14768
15058
|
if (edgeMiddlewareRoutes.length > 0) {
|
|
14769
15059
|
await writeFarmVercelEdgeMiddlewareFunction({
|
|
@@ -14791,7 +15081,7 @@ async function postProcessVercelOutput(root, outputDir, fs5, config, farmWorkflo
|
|
|
14791
15081
|
_chunk7U4XF76Rcjs.logger.info("\u2705 Post-processed Vercel output for Build Output API v3");
|
|
14792
15082
|
}
|
|
14793
15083
|
async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs5) {
|
|
14794
|
-
if (!_optionalChain([config, 'access',
|
|
15084
|
+
if (!_optionalChain([config, 'access', _341 => _341.docs, 'optionalAccess', _342 => _342.enabled])) return;
|
|
14795
15085
|
const [mainRoot, ...extraRoots] = _chunkHR5GU4UUcjs.getFarmDocsRoots.call(void 0, config.docs);
|
|
14796
15086
|
await copyFarmDocsRootContent(
|
|
14797
15087
|
mainRoot,
|
|
@@ -14816,7 +15106,7 @@ async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs
|
|
|
14816
15106
|
const lastModifiedManifest = _chunkHR5GU4UUcjs.createFarmDocsLastModifiedManifest.call(void 0, docsContentDir, {
|
|
14817
15107
|
fallback: "now"
|
|
14818
15108
|
});
|
|
14819
|
-
const undatedPages = _nullishCoalesce(_optionalChain([lastModifiedManifest, 'access',
|
|
15109
|
+
const undatedPages = _nullishCoalesce(_optionalChain([lastModifiedManifest, 'access', _343 => _343.unknown, 'optionalAccess', _344 => _344.length]), () => ( 0));
|
|
14820
15110
|
if (undatedPages > 0) {
|
|
14821
15111
|
_chunk7U4XF76Rcjs.logger.warn(
|
|
14822
15112
|
`${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.`
|
|
@@ -14856,7 +15146,7 @@ async function stageSharpRuntime(config, root, distDir, fs5, preset) {
|
|
|
14856
15146
|
if (!resolvePackageJson(projectRequire, "sharp")) {
|
|
14857
15147
|
try {
|
|
14858
15148
|
sharpRequire = _module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core"));
|
|
14859
|
-
} catch (
|
|
15149
|
+
} catch (e41) {
|
|
14860
15150
|
}
|
|
14861
15151
|
}
|
|
14862
15152
|
const copiedPackages = /* @__PURE__ */ new Map();
|
|
@@ -14901,7 +15191,7 @@ async function stageSharpRuntime(config, root, distDir, fs5, preset) {
|
|
|
14901
15191
|
try {
|
|
14902
15192
|
await copyPackage("sharp", sharpRequire);
|
|
14903
15193
|
if (!copiedPackages.has("sharp")) {
|
|
14904
|
-
throw new Error(`Farm image optimization requires sharp. ${
|
|
15194
|
+
throw new Error(`Farm image optimization requires sharp. ${_chunkOFVBMS6Icjs.SHARP_INSTALL_HINT}`);
|
|
14905
15195
|
}
|
|
14906
15196
|
} catch (error) {
|
|
14907
15197
|
await fs5.rm(stageDir, { recursive: true, force: true });
|
|
@@ -14983,7 +15273,7 @@ function resolveMetadataImageRuntimePackageJson(root) {
|
|
|
14983
15273
|
if (packageJsonPath) return packageJsonPath;
|
|
14984
15274
|
try {
|
|
14985
15275
|
return resolvePackageJson(_module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core")), "@vercel/og");
|
|
14986
|
-
} catch (
|
|
15276
|
+
} catch (e42) {
|
|
14987
15277
|
return null;
|
|
14988
15278
|
}
|
|
14989
15279
|
}
|
|
@@ -15030,7 +15320,7 @@ function resolvePackageJson(parentRequire, packageName) {
|
|
|
15030
15320
|
const resolved = parentRequire.resolve(request);
|
|
15031
15321
|
if (resolved.endsWith(".json")) return resolved;
|
|
15032
15322
|
_nullishCoalesce(metadataModule, () => ( (metadataModule = resolved)));
|
|
15033
|
-
} catch (
|
|
15323
|
+
} catch (e43) {
|
|
15034
15324
|
}
|
|
15035
15325
|
}
|
|
15036
15326
|
try {
|
|
@@ -15041,13 +15331,13 @@ function resolvePackageJson(parentRequire, packageName) {
|
|
|
15041
15331
|
try {
|
|
15042
15332
|
const manifest = JSON.parse(_fs.readFileSync.call(void 0, candidate, "utf8"));
|
|
15043
15333
|
if (manifest.name === packageName) return candidate;
|
|
15044
|
-
} catch (
|
|
15334
|
+
} catch (e44) {
|
|
15045
15335
|
}
|
|
15046
15336
|
}
|
|
15047
15337
|
if (_path2.default.basename(directory) === "node_modules") break;
|
|
15048
15338
|
directory = _path2.default.dirname(directory);
|
|
15049
15339
|
}
|
|
15050
|
-
} catch (
|
|
15340
|
+
} catch (e45) {
|
|
15051
15341
|
}
|
|
15052
15342
|
return null;
|
|
15053
15343
|
}
|
|
@@ -15058,7 +15348,7 @@ async function resolveProjectInstalledPackageDir(root, packageName, fs5) {
|
|
|
15058
15348
|
try {
|
|
15059
15349
|
const packageDir = await fs5.realpath(candidate);
|
|
15060
15350
|
if ((await fs5.stat(_path2.default.join(packageDir, "package.json"))).isFile()) return packageDir;
|
|
15061
|
-
} catch (
|
|
15351
|
+
} catch (e46) {
|
|
15062
15352
|
}
|
|
15063
15353
|
const parent = _path2.default.dirname(directory);
|
|
15064
15354
|
if (parent === directory) return null;
|
|
@@ -15072,7 +15362,7 @@ async function copyPrismaClientForVercel(root, nitroFuncDir, fs5) {
|
|
|
15072
15362
|
const generatedClientDir = _path2.default.join(prismaClientDir, "..", "..", ".prisma", "client");
|
|
15073
15363
|
try {
|
|
15074
15364
|
await fs5.access(generatedClientDir);
|
|
15075
|
-
} catch (
|
|
15365
|
+
} catch (e47) {
|
|
15076
15366
|
return;
|
|
15077
15367
|
}
|
|
15078
15368
|
const targetNodeModules = _path2.default.join(nitroFuncDir, "node_modules");
|
|
@@ -15134,7 +15424,7 @@ async function createFarmProjectModuleSsrEnvironment() {
|
|
|
15134
15424
|
// src/build/index.ts
|
|
15135
15425
|
async function build(config, options = {}) {
|
|
15136
15426
|
return _chunkNG2EZ6QScjs.withProductionNodeEnv.call(void 0,
|
|
15137
|
-
() =>
|
|
15427
|
+
() => _chunkEBSL5TW7cjs.withPackageClientBoundaryCache.call(void 0, () => buildWithProductionNodeEnv(config, options))
|
|
15138
15428
|
);
|
|
15139
15429
|
}
|
|
15140
15430
|
function createBuildTargetBaseline(config) {
|
|
@@ -15145,7 +15435,7 @@ function createBuildTargetBaseline(config) {
|
|
|
15145
15435
|
preset,
|
|
15146
15436
|
distDir,
|
|
15147
15437
|
outputDir,
|
|
15148
|
-
outputWasDerived: outputDir ===
|
|
15438
|
+
outputWasDerived: outputDir === _chunkBOEDYXAXcjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
|
|
15149
15439
|
};
|
|
15150
15440
|
}
|
|
15151
15441
|
function resolveBuildTargets(config, options, baseline) {
|
|
@@ -15154,8 +15444,8 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
15154
15444
|
const distDir = config.distDir || ".farm";
|
|
15155
15445
|
const outputWasReplaced = config.deploy.outputDir !== baseline.outputDir;
|
|
15156
15446
|
const shouldRefreshDerivedOutput = baseline.outputWasDerived && !outputWasReplaced && (preset !== baseline.preset || distDir !== baseline.distDir);
|
|
15157
|
-
const deployTarget = preset === config.deploy.preset ? config.deploy.target :
|
|
15158
|
-
const outputDir = shouldRefreshDerivedOutput ?
|
|
15447
|
+
const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunkBOEDYXAXcjs.getDeployTargetForPreset.call(void 0, preset);
|
|
15448
|
+
const outputDir = shouldRefreshDerivedOutput ? _chunkBOEDYXAXcjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
|
|
15159
15449
|
return {
|
|
15160
15450
|
root,
|
|
15161
15451
|
preset,
|
|
@@ -15163,7 +15453,7 @@ function resolveBuildTargets(config, options, baseline) {
|
|
|
15163
15453
|
distDir,
|
|
15164
15454
|
deployTarget,
|
|
15165
15455
|
outputDir,
|
|
15166
|
-
deployOutputDir:
|
|
15456
|
+
deployOutputDir: _chunkBOEDYXAXcjs.resolveDeployOutputPath.call(void 0, root, outputDir)
|
|
15167
15457
|
};
|
|
15168
15458
|
}
|
|
15169
15459
|
async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
@@ -15200,15 +15490,15 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
15200
15490
|
};
|
|
15201
15491
|
config = {
|
|
15202
15492
|
...config,
|
|
15203
|
-
images:
|
|
15493
|
+
images: _chunkOFVBMS6Icjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
|
|
15204
15494
|
root: targets.root,
|
|
15205
15495
|
preset: targets.preset
|
|
15206
15496
|
})
|
|
15207
15497
|
};
|
|
15208
|
-
if (_optionalChain([config, 'access',
|
|
15498
|
+
if (_optionalChain([config, 'access', _345 => _345.docs, 'optionalAccess', _346 => _346.enabled])) await _chunkNDOE76QCcjs.loadFarmDocsEngine.call(void 0, );
|
|
15209
15499
|
pluginManager.updateContext({ config });
|
|
15210
15500
|
const { root, preset, srcDir, distDir, deployOutputDir } = targets;
|
|
15211
|
-
|
|
15501
|
+
_chunkEBSL5TW7cjs.usePackageClientBoundaryCacheFile.call(void 0, _chunkEBSL5TW7cjs.resolvePackageClientBoundaryCacheFile.call(void 0, root, distDir));
|
|
15212
15502
|
_chunk7U4XF76Rcjs.logger.info(`\u{1F69C} Building Farm.js application with preset: ${preset}...`);
|
|
15213
15503
|
await pluginManager.setupPlugins();
|
|
15214
15504
|
await pluginManager.runHookParallel("beforeBundle", {
|
|
@@ -15220,8 +15510,8 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
15220
15510
|
});
|
|
15221
15511
|
_chunk7U4XF76Rcjs.logger.info("\u{1F50D} Discovering routes and API endpoints...");
|
|
15222
15512
|
const productionViteResult = productionViteResultPromise ? (await productionViteResultPromise)[0] : void 0;
|
|
15223
|
-
if (_optionalChain([productionViteResult, 'optionalAccess',
|
|
15224
|
-
const productionVite = _optionalChain([productionViteResult, 'optionalAccess',
|
|
15513
|
+
if (_optionalChain([productionViteResult, 'optionalAccess', _347 => _347.status]) === "rejected") throw productionViteResult.reason;
|
|
15514
|
+
const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _348 => _348.value]);
|
|
15225
15515
|
const createViteServer = productionVite ? productionVite.createServer : (await import("vite")).createServer;
|
|
15226
15516
|
projectModuleServer = await createProjectModuleServer(
|
|
15227
15517
|
createViteServer,
|
|
@@ -15229,23 +15519,24 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
15229
15519
|
root,
|
|
15230
15520
|
rendererBuild.signal
|
|
15231
15521
|
);
|
|
15232
|
-
const farmApp =
|
|
15522
|
+
const farmApp = _chunkOFVBMS6Icjs.createFarmApp.call(void 0, config, projectModuleServer);
|
|
15233
15523
|
if (options.universal !== false) farmApp.getRouteManager().keepBuildSourceSnapshot();
|
|
15234
15524
|
await farmApp.initialize();
|
|
15235
15525
|
const routeManager = farmApp.getRouteManager();
|
|
15236
15526
|
const serverRenderer = farmApp.getServerRenderer();
|
|
15237
|
-
const typeArtifacts =
|
|
15527
|
+
const typeArtifacts = _chunkL3BSHASBcjs.generateFarmTypeArtifacts.call(void 0, {
|
|
15238
15528
|
root,
|
|
15239
15529
|
srcDir,
|
|
15240
15530
|
layers: config.layers,
|
|
15241
15531
|
storage: config.storage,
|
|
15242
15532
|
plugins: config.plugins,
|
|
15243
15533
|
extraRoutes: [
|
|
15244
|
-
..._optionalChain([config, 'access',
|
|
15534
|
+
..._optionalChain([config, 'access', _349 => _349.openapi, 'optionalAccess', _350 => _350.enabled]) && config.openapi.route ? [config.openapi.route] : [],
|
|
15245
15535
|
..._chunkHR5GU4UUcjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
|
|
15246
15536
|
],
|
|
15247
15537
|
suppressLintOnLink: config.suppressLintOnLink,
|
|
15248
15538
|
componentExtensions: config.renderer.componentExtensions,
|
|
15539
|
+
renderer: config.renderer,
|
|
15249
15540
|
i18nConfig: config.i18n
|
|
15250
15541
|
}).catch((error) => {
|
|
15251
15542
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -15326,7 +15617,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
15326
15617
|
throw error;
|
|
15327
15618
|
} finally {
|
|
15328
15619
|
try {
|
|
15329
|
-
await _optionalChain([projectModuleServer, 'optionalAccess',
|
|
15620
|
+
await _optionalChain([projectModuleServer, 'optionalAccess', _351 => _351.close, 'call', _352 => _352()]);
|
|
15330
15621
|
} finally {
|
|
15331
15622
|
rendererBuild.abort();
|
|
15332
15623
|
}
|
|
@@ -15334,11 +15625,11 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
|
|
|
15334
15625
|
}
|
|
15335
15626
|
async function createProjectModuleServer(createViteServer, config, root, buildLifetime) {
|
|
15336
15627
|
const { farmNavigationPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.cjs");
|
|
15337
|
-
const rendererVitePlugins = await
|
|
15628
|
+
const rendererVitePlugins = await _chunk3OKSEJ33cjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, root, {
|
|
15338
15629
|
ssr: true,
|
|
15339
15630
|
buildLifetime
|
|
15340
15631
|
});
|
|
15341
|
-
const viteConfig =
|
|
15632
|
+
const viteConfig = _chunkOFVBMS6Icjs.mergeFarmViteConfig.call(void 0,
|
|
15342
15633
|
{
|
|
15343
15634
|
root,
|
|
15344
15635
|
appType: "custom",
|
|
@@ -15350,12 +15641,12 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
15350
15641
|
},
|
|
15351
15642
|
plugins: [
|
|
15352
15643
|
...rendererVitePlugins,
|
|
15353
|
-
|
|
15644
|
+
_chunkOFVBMS6Icjs.farmFontImportsPlugin.call(void 0, {
|
|
15354
15645
|
root,
|
|
15355
15646
|
basePath: config.basePath,
|
|
15356
15647
|
publicDir: config.publicDir
|
|
15357
15648
|
}),
|
|
15358
|
-
|
|
15649
|
+
_chunkEBSL5TW7cjs.farmEnvironmentFunctionsPlugin.call(void 0, { renderer: config.renderer }),
|
|
15359
15650
|
// Route modules load here at build time (rendering config, prerendering): `server-only`
|
|
15360
15651
|
// resolves as it does in the server build. Module-entry packages load pre-bundled, as in
|
|
15361
15652
|
// `farm dev`: unbundled, lucide-react alone is ~1,750 modules through the module runner,
|
|
@@ -15371,7 +15662,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
15371
15662
|
hmr: false
|
|
15372
15663
|
},
|
|
15373
15664
|
resolve: {
|
|
15374
|
-
alias:
|
|
15665
|
+
alias: _chunkOFVBMS6Icjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
|
|
15375
15666
|
dedupe: [...config.renderer.dedupe || []]
|
|
15376
15667
|
},
|
|
15377
15668
|
optimizeDeps: {
|
|
@@ -15410,10 +15701,10 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
|
|
|
15410
15701
|
noDiscovery: true
|
|
15411
15702
|
},
|
|
15412
15703
|
// An app or plugin that brings its own SSR environment keeps it.
|
|
15413
|
-
environments: _optionalChain([viteConfig, 'access',
|
|
15704
|
+
environments: _optionalChain([viteConfig, 'access', _353 => _353.environments, 'optionalAccess', _354 => _354.ssr, 'optionalAccess', _355 => _355.dev, 'optionalAccess', _356 => _356.createEnvironment]) ? viteConfig.environments : {
|
|
15414
15705
|
...viteConfig.environments,
|
|
15415
15706
|
ssr: {
|
|
15416
|
-
..._optionalChain([viteConfig, 'access',
|
|
15707
|
+
..._optionalChain([viteConfig, 'access', _357 => _357.environments, 'optionalAccess', _358 => _358.ssr]),
|
|
15417
15708
|
...await createFarmProjectModuleSsrEnvironment()
|
|
15418
15709
|
}
|
|
15419
15710
|
}
|
|
@@ -15449,7 +15740,7 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
|
|
|
15449
15740
|
farmNavigationPlugin(config.renderer),
|
|
15450
15741
|
farmIslandContainersPlugin(config),
|
|
15451
15742
|
farmPlugin(config, pluginManager),
|
|
15452
|
-
|
|
15743
|
+
_chunkEBSL5TW7cjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
|
|
15453
15744
|
],
|
|
15454
15745
|
mode: "production"
|
|
15455
15746
|
});
|
|
@@ -15477,20 +15768,20 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
|
|
|
15477
15768
|
define: {
|
|
15478
15769
|
__FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
|
|
15479
15770
|
__FARM_ENV__: JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, config.env)),
|
|
15480
|
-
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access',
|
|
15771
|
+
__FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _359 => _359.env, 'optionalAccess', _360 => _360.public]) || {})
|
|
15481
15772
|
},
|
|
15482
15773
|
plugins: [
|
|
15483
15774
|
farmI18nClientBridgePlugin(),
|
|
15484
15775
|
farmIslandContainersPlugin(config),
|
|
15485
15776
|
farmPlugin(config, pluginManager),
|
|
15486
|
-
|
|
15777
|
+
_chunkEBSL5TW7cjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
|
|
15487
15778
|
],
|
|
15488
15779
|
mode: "production"
|
|
15489
15780
|
});
|
|
15490
15781
|
}
|
|
15491
15782
|
function resolveLegacyPageEntry(config, root, srcDir) {
|
|
15492
15783
|
const appDir = _path2.default.join(root, srcDir, "app");
|
|
15493
|
-
for (const extension of
|
|
15784
|
+
for (const extension of _chunk3OKSEJ33cjs.getFarmRendererComponentExtensions.call(void 0, config.renderer)) {
|
|
15494
15785
|
const candidate = _path2.default.join(appDir, `page${extension}`);
|
|
15495
15786
|
if (_fs.existsSync.call(void 0, candidate)) return candidate;
|
|
15496
15787
|
}
|
|
@@ -15511,7 +15802,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
15511
15802
|
if (pluginManager) {
|
|
15512
15803
|
nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
|
|
15513
15804
|
}
|
|
15514
|
-
const outputDir =
|
|
15805
|
+
const outputDir = _chunkBOEDYXAXcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
|
|
15515
15806
|
const serverOutputDir = _path2.default.join(outputDir, "server");
|
|
15516
15807
|
const publicOutputDir = _path2.default.join(outputDir, "public");
|
|
15517
15808
|
const { mkdir, cp } = await import("fs/promises");
|
|
@@ -15570,7 +15861,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
15570
15861
|
const { readFile: readFile2 } = await import("fs/promises");
|
|
15571
15862
|
const manifestContent = await readFile2(clientManifestPath, "utf-8");
|
|
15572
15863
|
farmRegistry.clientManifest = JSON.parse(manifestContent);
|
|
15573
|
-
} catch (
|
|
15864
|
+
} catch (e48) {
|
|
15574
15865
|
farmRegistry.clientManifest = {};
|
|
15575
15866
|
}
|
|
15576
15867
|
} catch (error) {
|
|
@@ -15582,7 +15873,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
|
|
|
15582
15873
|
root,
|
|
15583
15874
|
preset,
|
|
15584
15875
|
distDir,
|
|
15585
|
-
outputDir:
|
|
15876
|
+
outputDir: _chunkBOEDYXAXcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
|
|
15586
15877
|
});
|
|
15587
15878
|
}
|
|
15588
15879
|
}
|