@farm.js/core 0.1.70 → 0.1.72

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.
Files changed (242) hide show
  1. package/dist/{agent-mcp-handler-6T2Z7TB6.cjs → agent-mcp-handler-KE4J3W7S.cjs} +4 -4
  2. package/dist/{agent-mcp-handler-CPU354QQ.mjs → agent-mcp-handler-VIT4GOSR.mjs} +3 -3
  3. package/dist/{agent-mcp.d-DulgFLBt.d.ts → agent-mcp.d-BO3rZXEM.d.ts} +15 -5
  4. package/dist/{agent-mcp.d-TAs1ES2F.d.mts → agent-mcp.d-Cwff7lcA.d.mts} +15 -5
  5. package/dist/agent-runtime.d.mts +3 -3
  6. package/dist/agent-runtime.d.ts +3 -3
  7. package/dist/{analyzer-QGRBLETM.mjs → analyzer-5Q75LTIL.mjs} +2 -2
  8. package/dist/analyzer-UJG4MIZW.cjs +16 -0
  9. package/dist/api/node.d.mts +5 -5
  10. package/dist/api/node.d.ts +5 -5
  11. package/dist/api/route-manager.cjs +7 -6
  12. package/dist/api/route-manager.d.mts +7 -7
  13. package/dist/api/route-manager.d.ts +7 -7
  14. package/dist/api/route-manager.mjs +6 -5
  15. package/dist/api/runtime.d.mts +4 -4
  16. package/dist/api/runtime.d.ts +4 -4
  17. package/dist/api.cjs +8 -7
  18. package/dist/api.d.mts +8 -8
  19. package/dist/api.d.ts +8 -8
  20. package/dist/api.mjs +7 -6
  21. package/dist/{app-manifest.d-C-nf3Vmm.d.ts → app-manifest.d-DwjGkYlP.d.ts} +1 -1
  22. package/dist/{app-manifest.d-6zXb90o6.d.mts → app-manifest.d-USD_IbFd.d.mts} +1 -1
  23. package/dist/app-markdown.cjs +5 -3
  24. package/dist/app-markdown.d.mts +5 -5
  25. package/dist/app-markdown.d.ts +5 -5
  26. package/dist/app-markdown.mjs +4 -2
  27. package/dist/{app.d-C2xeMIYT.d.ts → app.d-DAmF2MAk.d.ts} +52 -8
  28. package/dist/{app.d-DF0aundc.d.mts → app.d-fW06_h8h.d.mts} +52 -8
  29. package/dist/{chunk-7A3URI2F.mjs → chunk-2EVESLP3.mjs} +8 -1
  30. package/dist/{chunk-JRF2SKCD.mjs → chunk-3JN5M3T5.mjs} +259 -61
  31. package/dist/{chunk-XYVPTTUT.cjs → chunk-3WG7GJQL.cjs} +11 -6
  32. package/dist/{chunk-K66JILV3.cjs → chunk-5LOARKDP.cjs} +2 -2
  33. package/dist/{chunk-I7NUT24Z.cjs → chunk-5R4Q5FN7.cjs} +2 -2
  34. package/dist/{chunk-BPUVDCGG.cjs → chunk-5X6OHJEE.cjs} +15 -3
  35. package/dist/{chunk-RMOU3PR4.mjs → chunk-5XFKWHZD.mjs} +293 -66
  36. package/dist/{chunk-A2TH5MKE.mjs → chunk-645ENY7W.mjs} +3 -3
  37. package/dist/{chunk-NYF7A4UW.mjs → chunk-77VNYVVX.mjs} +1 -1
  38. package/dist/{chunk-32SYRIQ7.cjs → chunk-7QCJDYZQ.cjs} +3 -3
  39. package/dist/{chunk-QZHTDVH4.mjs → chunk-AUAMXI6N.mjs} +1 -1
  40. package/dist/{chunk-5R3JQPWD.mjs → chunk-AYVGD3PK.mjs} +1 -1
  41. package/dist/{chunk-IEN2EFE5.cjs → chunk-BE7AQXJB.cjs} +346 -148
  42. package/dist/{chunk-CCHJWJGP.mjs → chunk-BSXKZPFE.mjs} +204 -98
  43. package/dist/{chunk-2MR4MABG.cjs → chunk-C5AM2XDN.cjs} +54 -4
  44. package/dist/{chunk-M6U6E4F7.cjs → chunk-CBLRSZQL.cjs} +557 -330
  45. package/dist/{chunk-BBPDJGCU.cjs → chunk-CYOTNHDF.cjs} +2 -2
  46. package/dist/{chunk-5IJRJWJS.mjs → chunk-DGNMXL2O.mjs} +11 -1
  47. package/dist/{chunk-3EXCZJEN.mjs → chunk-DS7JGFW5.mjs} +13 -1
  48. package/dist/{chunk-EDZU7YRK.mjs → chunk-E2V7RRFL.mjs} +2 -2
  49. package/dist/{chunk-K7JMTAFH.cjs → chunk-E3LE6EZH.cjs} +20 -10
  50. package/dist/{chunk-DIHBWZDZ.cjs → chunk-ET6WW3FY.cjs} +636 -355
  51. package/dist/{chunk-65FPDDT4.cjs → chunk-EXN4DTVF.cjs} +2 -2
  52. package/dist/{chunk-K4UGCUXX.cjs → chunk-FSSONJRV.cjs} +7 -7
  53. package/dist/{chunk-Y2SZVIVH.cjs → chunk-GPICBTDV.cjs} +8 -1
  54. package/dist/{chunk-FJ5YCERM.cjs → chunk-HLMUWKAP.cjs} +466 -359
  55. package/dist/{chunk-A7HCBHMC.cjs → chunk-IWCYRDRQ.cjs} +3 -3
  56. package/dist/{chunk-R7254L3R.mjs → chunk-J5ASGNKF.mjs} +23 -0
  57. package/dist/{chunk-75E5FDX2.mjs → chunk-JMFTKNBA.mjs} +10 -10
  58. package/dist/{chunk-TLSSIYAL.mjs → chunk-KQAB5LML.mjs} +10 -3
  59. package/dist/{chunk-NSZY3EWG.cjs → chunk-L6E4SHUB.cjs} +31 -8
  60. package/dist/{chunk-OCNV4CI2.cjs → chunk-MQ4DYVFS.cjs} +26 -0
  61. package/dist/{chunk-4AC4PXZO.cjs → chunk-N3XO5AL5.cjs} +2 -2
  62. package/dist/{chunk-2AM26UGI.cjs → chunk-NLBK37HI.cjs} +5 -4
  63. package/dist/{chunk-R2ZHU37O.mjs → chunk-NLRAQXAA.mjs} +26 -0
  64. package/dist/{chunk-NA77GEIU.mjs → chunk-NV26EGMC.mjs} +51 -1
  65. package/dist/{chunk-LECZ5DPZ.cjs → chunk-OSEQL34Q.cjs} +2 -2
  66. package/dist/{chunk-3WS5AZ3R.mjs → chunk-OSMUE5ST.mjs} +8 -3
  67. package/dist/{chunk-JFPKARWM.cjs → chunk-PMU4U2W2.cjs} +1 -0
  68. package/dist/{chunk-KPMLDT3B.mjs → chunk-QUYAGU65.mjs} +581 -300
  69. package/dist/{chunk-N62IYXYD.mjs → chunk-RFWWXEIF.mjs} +1 -1
  70. package/dist/{chunk-E77IA5IF.mjs → chunk-RLFGKJQ6.mjs} +1 -1
  71. package/dist/{chunk-3AUINHFG.mjs → chunk-TNYC3TYP.mjs} +3 -2
  72. package/dist/{chunk-VG6HYT5K.cjs → chunk-TP4RAV7Y.cjs} +9 -9
  73. package/dist/{chunk-JFVT5ZZV.mjs → chunk-VAWDGGW3.mjs} +1 -1
  74. package/dist/{chunk-MU5V7XHL.mjs → chunk-VJSXPN3W.mjs} +3 -0
  75. package/dist/{chunk-DU4VHHPJ.mjs → chunk-VO55MMBX.mjs} +1 -1
  76. package/dist/{chunk-LDVJIBGN.mjs → chunk-VT25ERQK.mjs} +1 -1
  77. package/dist/{chunk-HAXFV2CD.mjs → chunk-WIJF3PBM.mjs} +1 -1
  78. package/dist/{chunk-QEWWKYDL.cjs → chunk-YCNHUIPR.cjs} +17 -10
  79. package/dist/{chunk-FILXOEWD.cjs → chunk-YXIQYWOK.cjs} +2 -2
  80. package/dist/{chunk-THG2TVDH.mjs → chunk-YZLEOMMA.mjs} +3 -3
  81. package/dist/{chunk-PJQ5W356.mjs → chunk-Z5ZZAGIH.mjs} +1 -0
  82. package/dist/{chunk-MZLJFNMH.cjs → chunk-ZDZUFD67.cjs} +1 -1
  83. package/dist/{chunk-Q5HMVGR5.cjs → chunk-ZFEJ2SF2.cjs} +13 -13
  84. package/dist/{chunk-LNVGXUL3.cjs → chunk-ZMSVKVI3.cjs} +3 -0
  85. package/dist/{client-component.d-DNbC4oWI.d.ts → client-component.d-9J7CkTWW.d.ts} +2 -2
  86. package/dist/{client-component.d-Bk5qKJM-.d.mts → client-component.d-ciHeCxr-.d.mts} +2 -2
  87. package/dist/{client-plugins.d-DwUqh4gp.d.ts → client-plugins.d-CUOhfapO.d.ts} +12 -8
  88. package/dist/{client-plugins.d-Pi9nG0W0.d.mts → client-plugins.d-JnRz5a1o.d.mts} +12 -8
  89. package/dist/client-plugins.d.mts +3 -3
  90. package/dist/client-plugins.d.ts +3 -3
  91. package/dist/client.cjs +1 -1
  92. package/dist/client.d.mts +8 -8
  93. package/dist/client.d.ts +8 -8
  94. package/dist/client.mjs +1 -1
  95. package/dist/config.d.mts +3 -3
  96. package/dist/config.d.ts +3 -3
  97. package/dist/desktop.d.mts +4 -4
  98. package/dist/desktop.d.ts +4 -4
  99. package/dist/{devtools-CB43AHEP.mjs → devtools-7JPQMSTQ.mjs} +4 -4
  100. package/dist/{devtools-L5DUNDF3.cjs → devtools-IZFUYWPG.cjs} +5 -5
  101. package/dist/docs.cjs +6 -6
  102. package/dist/docs.d.mts +4 -4
  103. package/dist/docs.d.ts +4 -4
  104. package/dist/docs.mjs +5 -5
  105. package/dist/environment/vite.cjs +3 -3
  106. package/dist/environment/vite.mjs +2 -2
  107. package/dist/{headers.d-CE6OWB-n.d.ts → headers.d-CqpTL_fZ.d.ts} +2 -2
  108. package/dist/{headers.d-DED1hHh4.d.mts → headers.d-rbbTKGaN.d.mts} +2 -2
  109. package/dist/i18n/client.cjs +3 -2
  110. package/dist/i18n/client.d.mts +2 -2
  111. package/dist/i18n/client.d.ts +2 -2
  112. package/dist/i18n/client.mjs +2 -1
  113. package/dist/i18n/index.cjs +3 -2
  114. package/dist/i18n/index.d.mts +3 -3
  115. package/dist/i18n/index.d.ts +3 -3
  116. package/dist/i18n/index.mjs +2 -1
  117. package/dist/i18n/server.cjs +6 -5
  118. package/dist/i18n/server.d.mts +5 -5
  119. package/dist/i18n/server.d.ts +5 -5
  120. package/dist/i18n/server.mjs +5 -4
  121. package/dist/index.cjs +29 -27
  122. package/dist/{index.d-c9UwIqDy.d.ts → index.d-CMKvzHLW.d.ts} +1 -1
  123. package/dist/{index.d-CbvOjJcp.d.mts → index.d-D_B2D9Il.d.mts} +1 -1
  124. package/dist/index.d.mts +24 -24
  125. package/dist/index.d.ts +24 -24
  126. package/dist/index.mjs +28 -26
  127. package/dist/integrations/orm.d.mts +3 -3
  128. package/dist/integrations/orm.d.ts +3 -3
  129. package/dist/integrations.d.mts +3 -3
  130. package/dist/integrations.d.ts +3 -3
  131. package/dist/internal/app-markdown-runtime.cjs +4 -2
  132. package/dist/internal/app-markdown-runtime.d.mts +13 -5
  133. package/dist/internal/app-markdown-runtime.d.ts +13 -5
  134. package/dist/internal/app-markdown-runtime.mjs +3 -1
  135. package/dist/internal/build-runtime.cjs +26 -26
  136. package/dist/internal/build-runtime.d.mts +5 -5
  137. package/dist/internal/build-runtime.d.ts +5 -5
  138. package/dist/internal/build-runtime.mjs +25 -25
  139. package/dist/internal/cli-runtime.cjs +9 -7
  140. package/dist/internal/cli-runtime.mjs +8 -6
  141. package/dist/internal/client-error-overlay.cjs +4 -4
  142. package/dist/internal/client-error-overlay.mjs +1 -1
  143. package/dist/internal/client-runtime.cjs +2 -2
  144. package/dist/internal/client-runtime.d.mts +6 -6
  145. package/dist/internal/client-runtime.d.ts +6 -6
  146. package/dist/internal/client-runtime.mjs +3 -3
  147. package/dist/internal/compression-runtime.d.mts +3 -3
  148. package/dist/internal/compression-runtime.d.ts +3 -3
  149. package/dist/internal/config-runtime.cjs +6 -6
  150. package/dist/internal/config-runtime.d.mts +6 -6
  151. package/dist/internal/config-runtime.d.ts +6 -6
  152. package/dist/internal/config-runtime.mjs +5 -5
  153. package/dist/internal/infra-analytics-runtime.cjs +8 -8
  154. package/dist/internal/infra-analytics-runtime.mjs +6 -6
  155. package/dist/internal/native-server-fns.cjs +4 -4
  156. package/dist/internal/native-server-fns.mjs +3 -3
  157. package/dist/internal/product-telemetry-runtime.cjs +3 -3
  158. package/dist/internal/product-telemetry-runtime.mjs +2 -2
  159. package/dist/internal/production-runtime.cjs +15 -15
  160. package/dist/internal/production-runtime.d.mts +41 -24
  161. package/dist/internal/production-runtime.d.ts +41 -24
  162. package/dist/internal/production-runtime.mjs +14 -14
  163. package/dist/internal/vercel-edge-middleware.d.mts +2 -2
  164. package/dist/internal/vercel-edge-middleware.d.ts +2 -2
  165. package/dist/markdown.d.mts +3 -3
  166. package/dist/markdown.d.ts +3 -3
  167. package/dist/middleware.cjs +3 -3
  168. package/dist/middleware.d.mts +4 -4
  169. package/dist/middleware.d.ts +4 -4
  170. package/dist/middleware.mjs +2 -2
  171. package/dist/mobile.d.mts +3 -3
  172. package/dist/mobile.d.ts +3 -3
  173. package/dist/{mount.d-DngLY7NL.d.ts → mount.d-B0XMxDRh.d.ts} +1 -1
  174. package/dist/{mount.d-BvWxf8ZE.d.mts → mount.d-ImEO7q8a.d.mts} +1 -1
  175. package/dist/{navigation-delegate.d-CMyl1h2l.d.mts → navigation-delegate.d-83Q7ksf7.d.mts} +1 -1
  176. package/dist/{navigation-delegate.d-zZogiDfa.d.ts → navigation-delegate.d-RRx1CSlb.d.ts} +1 -1
  177. package/dist/navigation.d.mts +6 -6
  178. package/dist/navigation.d.ts +6 -6
  179. package/dist/{nitro-Y3LGITW3.cjs → nitro-2LMOMIST.cjs} +2 -2
  180. package/dist/{nitro-NSTXT7LB.mjs → nitro-72TFIGGO.mjs} +1 -1
  181. package/dist/{plugin-F2O4BFTK.cjs → plugin-5PIQQVRP.cjs} +2 -2
  182. package/dist/{plugin-VEBRN7A3.mjs → plugin-QZT747YW.mjs} +1 -1
  183. package/dist/plugin.cjs +20 -20
  184. package/dist/plugin.d.mts +6 -6
  185. package/dist/plugin.d.ts +6 -6
  186. package/dist/plugin.mjs +19 -19
  187. package/dist/{production-runtime.d-B0IeWWyO.d.mts → production-runtime.d-Bcu37SCo.d.mts} +1 -1
  188. package/dist/{production-runtime.d-q3aHIv5Y.d.ts → production-runtime.d-qPj3XRET.d.ts} +1 -1
  189. package/dist/{render-plan.d-DQj2bzd2.d.ts → render-plan.d-Ds2sXJ5m.d.ts} +1 -1
  190. package/dist/{render-plan.d-Di1znBDW.d.mts → render-plan.d-wP8nTeRV.d.mts} +1 -1
  191. package/dist/renderer-client.cjs +3 -2
  192. package/dist/renderer-client.d.mts +6 -6
  193. package/dist/renderer-client.d.ts +6 -6
  194. package/dist/renderer-client.mjs +2 -1
  195. package/dist/{request.d-CJWzfDYJ.d.mts → request.d-F3h7K37m.d.mts} +1 -1
  196. package/dist/{request.d-C5vyoYeL.d.ts → request.d-zpSn6pu_.d.ts} +1 -1
  197. package/dist/request.d.mts +4 -4
  198. package/dist/request.d.ts +4 -4
  199. package/dist/{resolver.d-9iKC79CU.d.mts → resolver.d-DJgzbdsp.d.mts} +1 -1
  200. package/dist/{resolver.d-CY6mEa_F.d.ts → resolver.d-yaHcGCCG.d.ts} +1 -1
  201. package/dist/{route-rendering.d-DhsY5M2I.d.ts → route-rendering.d-BL0_AdKj.d.ts} +1 -1
  202. package/dist/{route-rendering.d-C-et2TZ1.d.mts → route-rendering.d-Mw0ZKG2e.d.mts} +1 -1
  203. package/dist/{router.d-CJB-Ntni.d.ts → router.d-BwXigemZ.d.ts} +1 -1
  204. package/dist/{router.d-BMDS5s5X.d.mts → router.d-NGVsU11T.d.mts} +1 -1
  205. package/dist/{routes.d-D3aJw1H5.d.mts → routes.d-CCccJRrp.d.mts} +1 -1
  206. package/dist/{routes.d-K-Qg79AA.d.ts → routes.d-b7khoRoU.d.ts} +1 -1
  207. package/dist/routes.d.mts +3 -3
  208. package/dist/routes.d.ts +3 -3
  209. package/dist/{routing.d-BxOZ2YWc.d.ts → routing.d-BhPgtN_S.d.ts} +2 -1
  210. package/dist/{routing.d-DwSUVZbF.d.mts → routing.d-D67HQmnv.d.mts} +2 -1
  211. package/dist/{rsc-pipeline-NJKLZ3YE.cjs → rsc-pipeline-BNXYMG4G.cjs} +6 -6
  212. package/dist/{rsc-pipeline-AXQJCCHI.mjs → rsc-pipeline-DHYZLWSF.mjs} +5 -5
  213. package/dist/{runtime-DMW6DDOI.cjs → runtime-IWOT6ZVC.cjs} +7 -7
  214. package/dist/{runtime-JXNEKOSE.mjs → runtime-XPYKUNL3.mjs} +5 -5
  215. package/dist/{runtime.d-BonodRI9.d.mts → runtime.d-BA3MzhXz.d.mts} +1 -1
  216. package/dist/{runtime.d-nUz0HAL4.d.mts → runtime.d-CTAXWZby.d.mts} +2 -2
  217. package/dist/{runtime.d-uw4123iI.d.ts → runtime.d-OBIZWpx1.d.ts} +1 -1
  218. package/dist/{runtime.d-B_uPfMjA.d.ts → runtime.d-PUA5qBnd.d.ts} +2 -2
  219. package/dist/server-plugins.d.mts +5 -5
  220. package/dist/server-plugins.d.ts +5 -5
  221. package/dist/server.cjs +40 -40
  222. package/dist/server.d.mts +14 -14
  223. package/dist/server.d.ts +14 -14
  224. package/dist/server.mjs +22 -22
  225. package/dist/{spa-router.d-rha3M95y.d.mts → spa-router.d-BG2XzE5p.d.mts} +3 -3
  226. package/dist/{spa-router.d-l0d9pPZj.d.ts → spa-router.d-DrYT944-.d.ts} +3 -3
  227. package/dist/testing.cjs +6 -5
  228. package/dist/testing.d.mts +3 -3
  229. package/dist/testing.d.ts +3 -3
  230. package/dist/testing.mjs +6 -5
  231. package/dist/{types.d-wVRlLtBf.d.mts → types.d-euATAbE4.d.mts} +4 -0
  232. package/dist/{types.d-wVRlLtBf.d.ts → types.d-euATAbE4.d.ts} +4 -0
  233. package/dist/{utils.d-BzuTobEc.d.mts → utils.d-C1k9BJeD.d.mts} +1 -1
  234. package/dist/{utils.d-BK-PTOF8.d.ts → utils.d-DcF4wxey.d.ts} +1 -1
  235. package/dist/version.cjs +2 -2
  236. package/dist/version.mjs +1 -1
  237. package/dist/vite.cjs +20 -20
  238. package/dist/vite.d.mts +9 -7
  239. package/dist/vite.d.ts +9 -7
  240. package/dist/vite.mjs +19 -19
  241. package/package.json +2 -2
  242. package/dist/analyzer-GUIRJWZH.cjs +0 -16
@@ -30,7 +30,9 @@ var _chunkO47W53D3cjs = require('./chunk-O47W53D3.cjs');
30
30
 
31
31
 
32
32
 
33
- var _chunkM6U6E4F7cjs = require('./chunk-M6U6E4F7.cjs');
33
+
34
+
35
+ var _chunkCBLRSZQLcjs = require('./chunk-CBLRSZQL.cjs');
34
36
 
35
37
 
36
38
 
@@ -38,14 +40,14 @@ var _chunkM6U6E4F7cjs = require('./chunk-M6U6E4F7.cjs');
38
40
  var _chunkDMXMIE2Ccjs = require('./chunk-DMXMIE2C.cjs');
39
41
 
40
42
 
41
- var _chunkJFPKARWMcjs = require('./chunk-JFPKARWM.cjs');
43
+ var _chunkPMU4U2W2cjs = require('./chunk-PMU4U2W2.cjs');
42
44
 
43
45
 
44
46
  var _chunkAQLHD6HZcjs = require('./chunk-AQLHD6HZ.cjs');
45
47
 
46
48
 
47
49
 
48
- var _chunkK7JMTAFHcjs = require('./chunk-K7JMTAFH.cjs');
50
+ var _chunkE3LE6EZHcjs = require('./chunk-E3LE6EZH.cjs');
49
51
 
50
52
 
51
53
 
@@ -61,7 +63,7 @@ var _chunkPIUTGRDIcjs = require('./chunk-PIUTGRDI.cjs');
61
63
 
62
64
 
63
65
 
64
- var _chunk2MR4MABGcjs = require('./chunk-2MR4MABG.cjs');
66
+ var _chunkC5AM2XDNcjs = require('./chunk-C5AM2XDN.cjs');
65
67
 
66
68
 
67
69
  var _chunk3HLQTOVUcjs = require('./chunk-3HLQTOVU.cjs');
@@ -79,13 +81,13 @@ var _chunk3HLQTOVUcjs = require('./chunk-3HLQTOVU.cjs');
79
81
 
80
82
 
81
83
 
82
- var _chunkK4UGCUXXcjs = require('./chunk-K4UGCUXX.cjs');
84
+ var _chunkFSSONJRVcjs = require('./chunk-FSSONJRV.cjs');
83
85
 
84
86
 
85
- var _chunkVG6HYT5Kcjs = require('./chunk-VG6HYT5K.cjs');
87
+ var _chunkTP4RAV7Ycjs = require('./chunk-TP4RAV7Y.cjs');
86
88
 
87
89
 
88
- var _chunkLECZ5DPZcjs = require('./chunk-LECZ5DPZ.cjs');
90
+ var _chunkOSEQL34Qcjs = require('./chunk-OSEQL34Q.cjs');
89
91
 
90
92
 
91
93
  var _chunk7EPYN7GWcjs = require('./chunk-7EPYN7GW.cjs');
@@ -120,7 +122,8 @@ var _chunk7EPYN7GWcjs = require('./chunk-7EPYN7GW.cjs');
120
122
 
121
123
 
122
124
 
123
- var _chunkIEN2EFE5cjs = require('./chunk-IEN2EFE5.cjs');
125
+
126
+ var _chunkBE7AQXJBcjs = require('./chunk-BE7AQXJB.cjs');
124
127
 
125
128
 
126
129
 
@@ -134,7 +137,7 @@ var _chunkERMUL73Lcjs = require('./chunk-ERMUL73L.cjs');
134
137
  var _chunkUVV3I5QAcjs = require('./chunk-UVV3I5QA.cjs');
135
138
 
136
139
 
137
- var _chunkOCNV4CI2cjs = require('./chunk-OCNV4CI2.cjs');
140
+ var _chunkMQ4DYVFScjs = require('./chunk-MQ4DYVFS.cjs');
138
141
 
139
142
 
140
143
 
@@ -177,7 +180,11 @@ var _chunk3EIPOTZVcjs = require('./chunk-3EIPOTZV.cjs');
177
180
 
178
181
 
179
182
 
180
- var _chunkNSZY3EWGcjs = require('./chunk-NSZY3EWG.cjs');
183
+ var _chunkL6E4SHUBcjs = require('./chunk-L6E4SHUB.cjs');
184
+
185
+
186
+
187
+ var _chunk2HW5LWAHcjs = require('./chunk-2HW5LWAH.cjs');
181
188
 
182
189
 
183
190
 
@@ -215,10 +222,10 @@ var _chunkKBGZ5FD6cjs = require('./chunk-KBGZ5FD6.cjs');
215
222
  var _chunkP2355C6Ecjs = require('./chunk-P2355C6E.cjs');
216
223
 
217
224
 
218
- var _chunkK66JILV3cjs = require('./chunk-K66JILV3.cjs');
225
+ var _chunk5LOARKDPcjs = require('./chunk-5LOARKDP.cjs');
219
226
 
220
227
 
221
- var _chunk2AM26UGIcjs = require('./chunk-2AM26UGI.cjs');
228
+ var _chunkNLBK37HIcjs = require('./chunk-NLBK37HI.cjs');
222
229
 
223
230
 
224
231
 
@@ -252,7 +259,7 @@ var _chunkJYNNIGQOcjs = require('./chunk-JYNNIGQO.cjs');
252
259
 
253
260
 
254
261
 
255
- var _chunkLNVGXUL3cjs = require('./chunk-LNVGXUL3.cjs');
262
+ var _chunkZMSVKVI3cjs = require('./chunk-ZMSVKVI3.cjs');
256
263
 
257
264
 
258
265
 
@@ -278,10 +285,7 @@ var _chunkSUCDVKUBcjs = require('./chunk-SUCDVKUB.cjs');
278
285
  var _chunkEVIWKPJVcjs = require('./chunk-EVIWKPJV.cjs');
279
286
 
280
287
 
281
- var _chunkMZLJFNMHcjs = require('./chunk-MZLJFNMH.cjs');
282
-
283
-
284
- var _chunkDVJM55D2cjs = require('./chunk-DVJM55D2.cjs');
288
+ var _chunkZDZUFD67cjs = require('./chunk-ZDZUFD67.cjs');
285
289
 
286
290
 
287
291
  var _chunkPMJSG4JScjs = require('./chunk-PMJSG4JS.cjs');
@@ -305,6 +309,9 @@ var _chunkDBYNZIIQcjs = require('./chunk-DBYNZIIQ.cjs');
305
309
  var _chunkNLBHLPEOcjs = require('./chunk-NLBHLPEO.cjs');
306
310
 
307
311
 
312
+ var _chunkDVJM55D2cjs = require('./chunk-DVJM55D2.cjs');
313
+
314
+
308
315
 
309
316
 
310
317
 
@@ -322,6 +329,7 @@ var _chunk7JUIK547cjs = require('./chunk-7JUIK547.cjs');
322
329
  var _chunkD22BUQKWcjs = require('./chunk-D22BUQKW.cjs');
323
330
 
324
331
 
332
+
325
333
  var _chunkBTZ5O6VMcjs = require('./chunk-BTZ5O6VM.cjs');
326
334
 
327
335
  // src/form-actions-transform.ts
@@ -329,6 +337,7 @@ var _crypto = require('crypto');
329
337
  var _compiler = require('@farm.js/islx/compiler');
330
338
  var _path2 = require('path'); var path2 = _interopRequireWildcard(_path2); var path6 = _interopRequireWildcard(_path2); var path3 = _interopRequireWildcard(_path2);
331
339
  function transformFarmFormActionModule(options) {
340
+ const runtimeModule = _nullishCoalesce(options.runtimeModule, () => ( ((specifier) => specifier)));
332
341
  const result = _compiler.transformActions.call(void 0, {
333
342
  code: options.code,
334
343
  id: options.id,
@@ -336,8 +345,8 @@ function transformFarmFormActionModule(options) {
336
345
  environment: options.ssr ? "server" : "client",
337
346
  parse: options.parse,
338
347
  runtime: {
339
- server: "@farm.js/core/internal/islx-server",
340
- client: "@farm.js/core/internal/islx-client"
348
+ server: runtimeModule("@farm.js/core/internal/islx-server"),
349
+ client: runtimeModule("@farm.js/core/internal/islx-client")
341
350
  }
342
351
  });
343
352
  return result ? result.code : null;
@@ -893,7 +902,7 @@ var REACT_CACHE_APIS = {
893
902
  cache: REACT_CACHE_LOCAL,
894
903
  cacheSignal: "__farm_react_cache_signal__"
895
904
  };
896
- function rewriteFarmReactCacheImport(code, file) {
905
+ function rewriteFarmReactCacheImport(code, file, cacheModule = FARM_REACT_CACHE_MODULE) {
897
906
  if (!code.includes("cache") || !code.includes("react")) return null;
898
907
  const extension = path2.default.extname(file).slice(1);
899
908
  const lang = extension === "ts" || extension === "mts" || extension === "cts" ? "ts" : "tsx";
@@ -934,7 +943,7 @@ function rewriteFarmReactCacheImport(code, file) {
934
943
  ].join(", ");
935
944
  const lines = [
936
945
  ...clause ? [`import ${clause} from "react";`] : [],
937
- `import { ${caches.map((specifier) => `${_nullishCoalesce(_optionalChain([specifier, 'access', _49 => _49.imported, 'optionalAccess', _50 => _50.name]), () => ( _optionalChain([specifier, 'access', _51 => _51.imported, 'optionalAccess', _52 => _52.value])))} as ${specifier.local.name}`).join(", ")} } from ${JSON.stringify(FARM_REACT_CACHE_MODULE)};`
946
+ `import { ${caches.map((specifier) => `${_nullishCoalesce(_optionalChain([specifier, 'access', _49 => _49.imported, 'optionalAccess', _50 => _50.name]), () => ( _optionalChain([specifier, 'access', _51 => _51.imported, 'optionalAccess', _52 => _52.value])))} as ${specifier.local.name}`).join(", ")} } from ${JSON.stringify(cacheModule)};`
938
947
  ];
939
948
  edits.push({ start: node.start, end: node.end, text: lines.join("\n") });
940
949
  }
@@ -966,7 +975,7 @@ function rewriteFarmReactCacheImport(code, file) {
966
975
  start: memberImportAt,
967
976
  end: memberImportAt,
968
977
  text: `
969
- import { ${[...used].map((name) => `${name} as ${REACT_CACHE_APIS[name]}`).join(", ")} } from ${JSON.stringify(FARM_REACT_CACHE_MODULE)};`
978
+ import { ${[...used].map((name) => `${name} as ${REACT_CACHE_APIS[name]}`).join(", ")} } from ${JSON.stringify(cacheModule)};`
970
979
  });
971
980
  }
972
981
  }
@@ -1071,7 +1080,7 @@ function loadFarmWorkflowsDevRuntime() {
1071
1080
  return import("./workflows.cjs");
1072
1081
  }
1073
1082
  function loadFarmDevtoolsSnapshotRuntime() {
1074
- return import("./devtools-L5DUNDF3.cjs");
1083
+ return import("./devtools-IZFUYWPG.cjs");
1075
1084
  }
1076
1085
  function loadFarmDevtoolsUIRuntime() {
1077
1086
  return import("./devtools-ui-SYRUXUA7.cjs");
@@ -1102,16 +1111,16 @@ var FARM_SERVER_ONLY_PACKAGE_ID = "\0farm:server-only";
1102
1111
  var FARM_PLATFORM_ENTRY = "@farm.js/core/platform";
1103
1112
  var FARM_PLATFORM_CLIENT_ID = "\0farm:platform-client";
1104
1113
  var FARM_SERVER_ONLY_ENTRIES_RESOLVE_FILTER = [
1105
- _chunkM6U6E4F7cjs.exactIdPattern.call(void 0, [FARM_PLATFORM_ENTRY, SERVER_ONLY_PACKAGE, ...FARM_SERVER_ONLY_ENTRIES]),
1106
- new RegExp(`^${_chunkIEN2EFE5cjs.FARM_RESOLVE_FROM_PREFIX}`),
1114
+ _chunkCBLRSZQLcjs.exactIdPattern.call(void 0, [FARM_PLATFORM_ENTRY, SERVER_ONLY_PACKAGE, ...FARM_SERVER_ONLY_ENTRIES]),
1115
+ new RegExp(`^${_chunkBE7AQXJBcjs.FARM_RESOLVE_FROM_PREFIX}`),
1107
1116
  // What isBuiltin() accepts: `node:` ids and the builtin names, subpaths such as fs/promises
1108
1117
  // included.
1109
1118
  /^node:/,
1110
- _chunkM6U6E4F7cjs.exactIdPattern.call(void 0, _module.builtinModules)
1119
+ _chunkCBLRSZQLcjs.exactIdPattern.call(void 0, _module.builtinModules)
1111
1120
  ];
1112
1121
  var FARM_SERVER_ONLY_ENTRIES_LOAD_FILTER = [
1113
- _chunkM6U6E4F7cjs.exactIdPattern.call(void 0, [FARM_SERVER_ONLY_PACKAGE_ID, FARM_PLATFORM_CLIENT_ID]),
1114
- new RegExp(`^${_chunkIEN2EFE5cjs.FARM_BROWSER_BUILTIN_PREFIX}`)
1122
+ _chunkCBLRSZQLcjs.exactIdPattern.call(void 0, [FARM_SERVER_ONLY_PACKAGE_ID, FARM_PLATFORM_CLIENT_ID]),
1123
+ new RegExp(`^${_chunkBE7AQXJBcjs.FARM_BROWSER_BUILTIN_PREFIX}`)
1115
1124
  ];
1116
1125
  function createFarmPlatformClientModule(platform) {
1117
1126
  return `export function platform() { return ${JSON.stringify(platform)}; }
@@ -1139,11 +1148,11 @@ function farmServerOnlyEntriesPlugin(options = {}) {
1139
1148
  name: "farm:server-only-entries",
1140
1149
  enforce: "pre",
1141
1150
  config(config) {
1142
- const bundledPackages = _chunkIEN2EFE5cjs.collectFarmServerBundledPackageInfo.call(void 0,
1151
+ const bundledPackages = _chunkBE7AQXJBcjs.collectFarmServerBundledPackageInfo.call(void 0,
1143
1152
  path6.resolve(_nullishCoalesce(config.root, () => ( process.cwd())))
1144
1153
  );
1145
1154
  return {
1146
- optimizeDeps: { rolldownOptions: { plugins: [_chunkIEN2EFE5cjs.farmBrowserBuiltinsOptimizerPlugin.call(void 0, )] } },
1155
+ optimizeDeps: { rolldownOptions: { plugins: [_chunkBE7AQXJBcjs.farmBrowserBuiltinsOptimizerPlugin.call(void 0, )] } },
1147
1156
  ssr: {
1148
1157
  noExternal: [
1149
1158
  // Resolve `server-only` here rather than in Node, which would load its throwing build.
@@ -1171,9 +1180,9 @@ function farmServerOnlyEntriesPlugin(options = {}) {
1171
1180
  );
1172
1181
  }
1173
1182
  if (!_optionalChain([options2, 'optionalAccess', _67 => _67.ssr]) && _module.isBuiltin.call(void 0, id)) {
1174
- return _chunkIEN2EFE5cjs.resolveFarmBrowserBuiltin.call(void 0, this, id, importer, options2);
1183
+ return _chunkBE7AQXJBcjs.resolveFarmBrowserBuiltin.call(void 0, this, id, importer, options2);
1175
1184
  }
1176
- const resolveFrom = importer ? _chunkIEN2EFE5cjs.parseFarmResolveFrom.call(void 0, id, importer.split("?", 1)[0]) : null;
1185
+ const resolveFrom = importer ? _chunkBE7AQXJBcjs.parseFarmResolveFrom.call(void 0, id, importer.split("?", 1)[0]) : null;
1177
1186
  if (resolveFrom) {
1178
1187
  const directory = path6.dirname(resolveFrom.importer);
1179
1188
  return this.resolve(resolveFrom.specifier, resolveFrom.importer, {
@@ -1209,7 +1218,7 @@ function farmServerOnlyEntriesPlugin(options = {}) {
1209
1218
  if (id === FARM_PLATFORM_CLIENT_ID) {
1210
1219
  return createFarmPlatformClientModule(_nullishCoalesce(options.platform, () => ( _chunkAQLHD6HZcjs.resolveFarmPlatform.call(void 0, ))));
1211
1220
  }
1212
- return _nullishCoalesce(_chunkIEN2EFE5cjs.loadFarmBrowserBuiltin.call(void 0, id), () => ( null));
1221
+ return _nullishCoalesce(_chunkBE7AQXJBcjs.loadFarmBrowserBuiltin.call(void 0, id), () => ( null));
1213
1222
  }
1214
1223
  }
1215
1224
  };
@@ -1242,7 +1251,7 @@ function renderFarmI18nStaticHead(requestPath, snapshot) {
1242
1251
  if (!snapshot) return "";
1243
1252
  const runtime = `<script>window.__FARM_I18N__ = ${serializeFarmInlineValue(snapshot)};</script>`;
1244
1253
  if (snapshot.routing === "none") return runtime;
1245
- return `${_chunk2MR4MABGcjs.renderFarmLocaleAlternateLinks.call(void 0, requestPath, snapshot)}${runtime}`;
1254
+ return `${_chunkC5AM2XDNcjs.renderFarmLocaleAlternateLinks.call(void 0, requestPath, snapshot)}${runtime}`;
1246
1255
  }
1247
1256
  function getPublicEnvDefine(config) {
1248
1257
  const publicEnv = _optionalChain([config, 'access', _69 => _69.env, 'optionalAccess', _70 => _70.public]);
@@ -1332,7 +1341,7 @@ async function proxyFarmExternalRewrite(req, res, bodySizeLimit) {
1332
1341
  let request = createRequestFromNodeRequest(req, new URL(destination));
1333
1342
  if (request.method !== "GET" && request.method !== "HEAD") {
1334
1343
  const body = await _chunkCFG4QERRcjs.readNodeRequestBody.call(void 0, req, bodySizeLimit);
1335
- request = new Request(request, { body: toRequestBody(body) });
1344
+ request = new Request(request, { method: request.method, body: toRequestBody(body) });
1336
1345
  }
1337
1346
  await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, await _chunkJRGR5Z4Kcjs.fetchFarmExternalRewrite.call(void 0, request));
1338
1347
  return true;
@@ -1428,7 +1437,7 @@ function interceptFarmDevPageResponse(options) {
1428
1437
  res.end = originalEnd;
1429
1438
  res.writeHead = originalWriteHead;
1430
1439
  if (originalFlushHeaders) res.flushHeaders = originalFlushHeaders;
1431
- delete res[_chunkJFPKARWMcjs.FARM_NODE_RESPONSE_END_PENDING];
1440
+ delete res[_chunkPMU4U2W2cjs.FARM_NODE_RESPONSE_END_PENDING];
1432
1441
  };
1433
1442
  let runtimeHookFailed = false;
1434
1443
  const endRuntimeRequest = (response) => pm.endRuntimeRequest(runtimeSession, response).catch((error) => {
@@ -1552,7 +1561,7 @@ function interceptFarmDevPageResponse(options) {
1552
1561
  });
1553
1562
  res.end = ((...args) => {
1554
1563
  interceptedEnd = true;
1555
- res[_chunkJFPKARWMcjs.FARM_NODE_RESPONSE_END_PENDING] = true;
1564
+ res[_chunkPMU4U2W2cjs.FARM_NODE_RESPONSE_END_PENDING] = true;
1556
1565
  if (afterResponseCalled) return res;
1557
1566
  afterResponseCalled = true;
1558
1567
  options.logResponse(method, urlPath, res.statusCode || 200, Date.now() - startTime, "PAGE");
@@ -1635,7 +1644,7 @@ function interceptFarmDevPageResponse(options) {
1635
1644
  res.end = originalEnd;
1636
1645
  res.writeHead = originalWriteHead;
1637
1646
  if (originalFlushHeaders) res.flushHeaders = originalFlushHeaders;
1638
- delete res[_chunkJFPKARWMcjs.FARM_NODE_RESPONSE_END_PENDING];
1647
+ delete res[_chunkPMU4U2W2cjs.FARM_NODE_RESPONSE_END_PENDING];
1639
1648
  originalEnd(...originalEndArgs);
1640
1649
  }).catch((error) => {
1641
1650
  reportFailure(error);
@@ -1652,14 +1661,14 @@ function interceptFarmDevPageResponse(options) {
1652
1661
  res.end = originalEnd;
1653
1662
  res.writeHead = originalWriteHead;
1654
1663
  if (originalFlushHeaders) res.flushHeaders = originalFlushHeaders;
1655
- delete res[_chunkJFPKARWMcjs.FARM_NODE_RESPONSE_END_PENDING];
1664
+ delete res[_chunkPMU4U2W2cjs.FARM_NODE_RESPONSE_END_PENDING];
1656
1665
  originalEnd(body, callback);
1657
1666
  } else {
1658
1667
  res.write = originalWrite;
1659
1668
  res.end = originalEnd;
1660
1669
  res.writeHead = originalWriteHead;
1661
1670
  if (originalFlushHeaders) res.flushHeaders = originalFlushHeaders;
1662
- delete res[_chunkJFPKARWMcjs.FARM_NODE_RESPONSE_END_PENDING];
1671
+ delete res[_chunkPMU4U2W2cjs.FARM_NODE_RESPONSE_END_PENDING];
1663
1672
  originalEnd(...originalEndArgs);
1664
1673
  }
1665
1674
  });
@@ -1798,13 +1807,18 @@ function rewriteEarlySsrRelativeImports(options) {
1798
1807
  return output + options.code.slice(copied);
1799
1808
  }
1800
1809
  function transformIsolatedClientBoundaryModule(options) {
1810
+ const runtimeModule = _nullishCoalesce(options.runtimeModule, () => ( ((specifier) => specifier)));
1811
+ const islxReact = JSON.stringify(runtimeModule("@farm.js/core/internal/islx-react"));
1812
+ const isolatedBoundary = JSON.stringify(
1813
+ runtimeModule("@farm.js/core/internal/isolated-boundary")
1814
+ );
1801
1815
  if (options.slots) {
1802
1816
  try {
1803
1817
  const rewritten = _compiler.rewriteFormStatusImports.call(void 0, {
1804
1818
  code: options.code,
1805
1819
  id: options.moduleReference,
1806
1820
  parse: options.parse,
1807
- from: "@farm.js/core/internal/islx-react"
1821
+ from: runtimeModule("@farm.js/core/internal/islx-react")
1808
1822
  });
1809
1823
  if (rewritten) options = { ...options, code: rewritten.code };
1810
1824
  } catch (e18) {
@@ -1818,7 +1832,7 @@ function transformIsolatedClientBoundaryModule(options) {
1818
1832
  return null;
1819
1833
  }
1820
1834
  const body = Array.isArray(ast.body) ? ast.body : [];
1821
- const everyExportIsComponent = options.code.includes(_chunkIEN2EFE5cjs.FARM_CLIENT_REFERENCE_PRAGMA) || options.moduleReference.includes(_chunkIEN2EFE5cjs.FARM_CLIENT_REFERENCE_DIRECTORY);
1835
+ const everyExportIsComponent = options.code.includes(_chunkBE7AQXJBcjs.FARM_CLIENT_REFERENCE_PRAGMA) || options.moduleReference.includes(_chunkBE7AQXJBcjs.FARM_CLIENT_REFERENCE_DIRECTORY);
1822
1836
  const replacements = [];
1823
1837
  const wrapperStatements = [];
1824
1838
  const originalEntries = [];
@@ -1916,10 +1930,10 @@ function transformIsolatedClientBoundaryModule(options) {
1916
1930
  output = output.slice(0, replacement.start) + replacement.code + output.slice(replacement.end);
1917
1931
  }
1918
1932
  const isComponent = `(value) => typeof value === "function" || (typeof value === "object" && value !== null && [Symbol.for("react.memo"), Symbol.for("react.forward_ref"), Symbol.for("react.lazy")].includes(value.$$typeof))`;
1919
- const runtimeImport = options.slots ? options.browser ? "const __farm_islx_island__ = (component) => component;" : `import { createIsland as __farm_islx_create_island__ } from "@farm.js/core/internal/islx-react";
1933
+ const runtimeImport = options.slots ? options.browser ? "const __farm_islx_island__ = (component) => component;" : `import { createIsland as __farm_islx_create_island__ } from ${islxReact};
1920
1934
  const __farm_is_component__ = ${isComponent};
1921
1935
  const __farm_islx_island__ = (component, ...rest) => __farm_is_component__(component) ? __farm_islx_create_island__(component, ...rest) : component;` : `import * as __farm_isolated_react__ from "react";
1922
- import { createFarmIsolatedClientBoundary as __farm_create_boundary__ } from "@farm.js/core/internal/isolated-boundary";
1936
+ import { createFarmIsolatedClientBoundary as __farm_create_boundary__ } from ${isolatedBoundary};
1923
1937
  const __farm_is_component__ = ${isComponent};
1924
1938
  const __farm_create_isolated_boundary__ = (react, component, ...rest) => __farm_is_component__(component) ? __farm_create_boundary__(react, component, ...rest) : component;`;
1925
1939
  return `${runtimeImport}
@@ -1975,26 +1989,74 @@ function warnClientBoundaryOnce(context, id, code, config) {
1975
1989
  function shouldEmitFarmClientRootHmr(renderer) {
1976
1990
  return _chunk67MZTLTFcjs.getFarmRendererCapabilities.call(void 0, _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, renderer)).reconcilesRerenders;
1977
1991
  }
1978
- function hasViteAlias(alias, find) {
1992
+ var FARM_RUNTIME_MODULE_PREFIX = "/@farm/runtime/";
1993
+ function toFarmRuntimeModuleId(specifier) {
1994
+ return FARM_RUNTIME_MODULE_PREFIX + specifier;
1995
+ }
1996
+ function getFarmCoreFile() {
1997
+ return typeof __filename === "string" ? __filename : _url.fileURLToPath.call(void 0, _chunkBTZ5O6VMcjs.define_import_meta_default.url);
1998
+ }
1999
+ var FARM_SOURCE_ALIAS_PROBES = [
2000
+ "@/x",
2001
+ "@/index.ts",
2002
+ "@/components/button",
2003
+ "@/lib/utils/format.ts",
2004
+ "@/__farm__/probe"
2005
+ ];
2006
+ function matchesViteAlias(find, specifier) {
2007
+ if (typeof find === "string") return specifier === find || specifier.startsWith(`${find}/`);
2008
+ find.lastIndex = 0;
2009
+ const matched = find.test(specifier);
2010
+ find.lastIndex = 0;
2011
+ return matched;
2012
+ }
2013
+ function hasFarmSourceAliasOverride(alias) {
1979
2014
  if (!alias) return false;
1980
- if (!Array.isArray(alias)) return Object.prototype.hasOwnProperty.call(alias, find);
1981
- return alias.some(
1982
- (entry) => typeof entry.find === "string" ? entry.find === find : entry.find.test(`${find}/`)
2015
+ const finds = Array.isArray(alias) ? alias.map((entry) => entry.find) : Object.keys(alias);
2016
+ return finds.some(
2017
+ (find) => FARM_SOURCE_ALIAS_PROBES.every((probe) => matchesViteAlias(find, probe))
1983
2018
  );
1984
2019
  }
1985
2020
  function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
1986
2021
  const rendererDisabled = _chunk67MZTLTFcjs.isFarmRendererDisabled.call(void 0, options.renderer);
1987
2022
  const imageImports = farmImageImportsPlugin();
1988
- const fontImports = _chunkM6U6E4F7cjs.farmFontImportsPlugin.call(void 0, {
2023
+ const fontImports = _chunkCBLRSZQLcjs.farmFontImportsPlugin.call(void 0, {
1989
2024
  root: options.root,
1990
2025
  basePath: options.basePath,
1991
2026
  publicDir: options.publicDir
1992
2027
  });
1993
2028
  let farmApp;
2029
+ const isFarmGeneratedOutput = (file) => {
2030
+ const root = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _95 => _95.getConfig, 'call', _96 => _96(), 'access', _97 => _97.root]), () => ( options.root));
2031
+ if (!root) return file.includes("/.farm/");
2032
+ const output = _chunkQMNWKQL4cjs.toPosixPath.call(void 0, path6.resolve(root, options.distDir || ".farm"));
2033
+ return file === output || file.startsWith(`${output}/`);
2034
+ };
1994
2035
  let serverFnTransformActive = false;
2036
+ const getFarmRenderedServerModules = () => {
2037
+ const routeManager = _optionalChain([farmApp, 'optionalAccess', _98 => _98.getRouteManager, 'call', _99 => _99()]);
2038
+ if (!routeManager) return /* @__PURE__ */ new Set();
2039
+ const files = /* @__PURE__ */ new Set();
2040
+ for (const entries of [
2041
+ routeManager.getRoutes(),
2042
+ routeManager.getLayouts(),
2043
+ routeManager.getLoadings(),
2044
+ routeManager.getErrors(),
2045
+ routeManager.getRouteSlots()
2046
+ ]) {
2047
+ for (const entry of entries.values()) files.add(entry.modulePath);
2048
+ }
2049
+ const config = farmApp.getConfig();
2050
+ const mdxComponents = _chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0,
2051
+ _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx),
2052
+ config.root
2053
+ );
2054
+ if (mdxComponents) files.add(mdxComponents);
2055
+ return files;
2056
+ };
1995
2057
  const islandsServerFns = () => {
1996
- const config = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _95 => _95.getConfig, 'call', _96 => _96()]), () => ( options));
1997
- return _optionalChain([config, 'access', _97 => _97.experimental, 'optionalAccess', _98 => _98.serverActions]) === true && _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _99 => _99.experimental, 'optionalAccess', _100 => _100.serverComponents])) === "islands";
2058
+ const config = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _100 => _100.getConfig, 'call', _101 => _101()]), () => ( options));
2059
+ return _optionalChain([config, 'access', _102 => _102.experimental, 'optionalAccess', _103 => _103.serverActions]) === true && _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _104 => _104.experimental, 'optionalAccess', _105 => _105.serverComponents])) === "islands";
1998
2060
  };
1999
2061
  let reactRefreshActive = false;
2000
2062
  let server;
@@ -2023,16 +2085,28 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2023
2085
  ].join(" ");
2024
2086
  console.log(log);
2025
2087
  };
2026
- const getProgrammaticClientRoutes = () => _nullishCoalesce(options.programmaticClientRoutes, () => ( _optionalChain([farmApp, 'optionalAccess', _101 => _101.getRouteManager, 'call', _102 => _102(), 'access', _103 => _103.getProgrammaticClientRoutes, 'call', _104 => _104()])));
2088
+ const getProgrammaticClientRoutes = () => _nullishCoalesce(options.programmaticClientRoutes, () => ( _optionalChain([farmApp, 'optionalAccess', _106 => _106.getRouteManager, 'call', _107 => _107(), 'access', _108 => _108.getProgrammaticClientRoutes, 'call', _109 => _109()])));
2089
+ const isOutsideAppRoot = (file) => {
2090
+ const root = _optionalChain([farmApp, 'optionalAccess', _110 => _110.getConfig, 'call', _111 => _111(), 'access', _112 => _112.root]) || _optionalChain([server, 'optionalAccess', _113 => _113.config, 'access', _114 => _114.root]) || options.root;
2091
+ if (!root) return false;
2092
+ const relative4 = path6.relative(root, file.split("?", 1)[0]);
2093
+ return relative4.startsWith("..") || path6.isAbsolute(relative4);
2094
+ };
2027
2095
  const plugin = {
2028
2096
  name: "farm",
2029
2097
  api: { getProgrammaticClientRoutes },
2030
2098
  config(userConfig, configEnv) {
2031
2099
  isBuild = configEnv.command === "build";
2032
- const layerAliases = _chunkMTBDJ326cjs.getFarmLayerAliases.call(void 0, options.layers);
2033
- const sourceAlias = hasViteAlias(_optionalChain([userConfig, 'access', _105 => _105.resolve, 'optionalAccess', _106 => _106.alias]), "@") ? {} : _chunkM6U6E4F7cjs.createFarmSourceAlias.call(void 0, options.root || process.cwd(), options.srcDir);
2100
+ const farmAliases = {
2101
+ ..._chunkMTBDJ326cjs.getFarmLayerAliases.call(void 0, options.layers),
2102
+ ...hasFarmSourceAliasOverride(_optionalChain([userConfig, 'access', _115 => _115.resolve, 'optionalAccess', _116 => _116.alias])) ? {} : _chunkCBLRSZQLcjs.createFarmSourceAlias.call(void 0, options.root || process.cwd(), options.srcDir)
2103
+ };
2104
+ if (Object.keys(farmAliases).length > 0) {
2105
+ _nullishCoalesce(userConfig.resolve, () => ( (userConfig.resolve = {})));
2106
+ userConfig.resolve.alias = _chunkCBLRSZQLcjs.mergeFarmViteAlias.call(void 0, farmAliases, userConfig.resolve.alias);
2107
+ }
2034
2108
  const layerRoots = (_nullishCoalesce(options.layers, () => ( []))).map((layer) => layer.root);
2035
- farmOwnsDevCors = !isBuild && _optionalChain([userConfig, 'access', _107 => _107.server, 'optionalAccess', _108 => _108.cors]) === void 0;
2109
+ farmOwnsDevCors = !isBuild && _optionalChain([userConfig, 'access', _117 => _117.server, 'optionalAccess', _118 => _118.cors]) === void 0;
2036
2110
  return {
2037
2111
  // Honor Farm's publicDir so the dev server serves the same static
2038
2112
  // directory the production client build emits.
@@ -2041,14 +2115,11 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2041
2115
  // Keep development module ownership explicit; the RSC plugin adds its
2042
2116
  // environment only when enabled. Production environment setup is unchanged.
2043
2117
  ...!isBuild ? { environments: { client: {}, ssr: {} } } : {},
2044
- resolve: {
2045
- alias: { ...layerAliases, ...sourceAlias }
2046
- },
2047
2118
  server: {
2048
2119
  ...farmOwnsDevCors ? { cors: false } : {},
2049
2120
  fs: {
2050
2121
  ...layerRoots.length ? { allow: [path6.resolve(options.root || process.cwd()), ...layerRoots] } : {},
2051
- deny: getFarmDevFsDeny(_optionalChain([userConfig, 'access', _109 => _109.server, 'optionalAccess', _110 => _110.fs, 'optionalAccess', _111 => _111.deny]), options)
2122
+ deny: getFarmDevFsDeny(_optionalChain([userConfig, 'access', _119 => _119.server, 'optionalAccess', _120 => _120.fs, 'optionalAccess', _121 => _121.deny]), options)
2052
2123
  }
2053
2124
  }
2054
2125
  };
@@ -2061,7 +2132,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2061
2132
  (plugin2) => plugin2.name === SERVER_FN_TRANSFORM_PLUGIN
2062
2133
  );
2063
2134
  reactRefreshActive = _chunk3QM74STYcjs.isFarmReactRefreshActive.call(void 0, config);
2064
- if (_optionalChain([options, 'access', _112 => _112.experimental, 'optionalAccess', _113 => _113.serverActions]) === true && !serverFnTransformActive && !islandsServerFns()) {
2135
+ if (_optionalChain([options, 'access', _122 => _122.experimental, 'optionalAccess', _123 => _123.serverActions]) === true && !serverFnTransformActive && !islandsServerFns()) {
2065
2136
  _chunkQMNWKQL4cjs.logger.warn(
2066
2137
  "experimental.serverActions has no effect without @farm.js/plugin/rsc in the Vite plugins. Server functions stay server-only, and importing one from client code is a build error."
2067
2138
  );
@@ -2070,20 +2141,20 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2070
2141
  async configureServer(viteServer) {
2071
2142
  viteServer.middlewares.use(
2072
2143
  createFarmDevPreviewGuard(viteServer, {
2073
- getSourceRoots: () => _chunkMTBDJ326cjs.getFarmSourceRoots.call(void 0, _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _114 => _114.getConfig, 'call', _115 => _115()]), () => ( options)))
2144
+ getSourceRoots: () => _chunkMTBDJ326cjs.getFarmSourceRoots.call(void 0, _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _124 => _124.getConfig, 'call', _125 => _125()]), () => ( options)))
2074
2145
  })
2075
2146
  );
2076
2147
  if (typeof fontImports.configureServer === "function") {
2077
2148
  await fontImports.configureServer.call(this, viteServer);
2078
2149
  }
2079
2150
  server = viteServer;
2080
- const farmMiddlewares = _nullishCoalesce(_optionalChain([deferredGates, 'optionalAccess', _116 => _116.pre, 'access', _117 => _117.target]), () => ( viteServer.middlewares));
2081
- const farmPostMiddlewares = _nullishCoalesce(_optionalChain([deferredGates, 'optionalAccess', _118 => _118.post, 'access', _119 => _119.target]), () => ( viteServer.middlewares));
2151
+ const farmMiddlewares = _nullishCoalesce(_optionalChain([deferredGates, 'optionalAccess', _126 => _126.pre, 'access', _127 => _127.target]), () => ( viteServer.middlewares));
2152
+ const farmPostMiddlewares = _nullishCoalesce(_optionalChain([deferredGates, 'optionalAccess', _128 => _128.post, 'access', _129 => _129.target]), () => ( viteServer.middlewares));
2082
2153
  const pm = initialPluginManager;
2083
2154
  const configRoutePlugins = new Set(
2084
- _optionalChain([pm, 'optionalAccess', _120 => _120.getPlugins, 'call', _121 => _121(), 'access', _122 => _122.filter, 'call', _123 => _123(isFarmConfigRoutePlugin), 'access', _124 => _124.map, 'call', _125 => _125((plugin2) => plugin2.name)])
2155
+ _optionalChain([pm, 'optionalAccess', _130 => _130.getPlugins, 'call', _131 => _131(), 'access', _132 => _132.filter, 'call', _133 => _133(isFarmConfigRoutePlugin), 'access', _134 => _134.map, 'call', _135 => _135((plugin2) => plugin2.name)])
2085
2156
  );
2086
- const configRedirectMatchers = (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _126 => _126.getPlugins, 'call', _127 => _127()]), () => ( []))).flatMap((plugin2) => {
2157
+ const configRedirectMatchers = (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _136 => _136.getPlugins, 'call', _137 => _137()]), () => ( []))).flatMap((plugin2) => {
2087
2158
  const matcher = _chunkMBCRWU3Pcjs.getConfigRedirectMatcher.call(void 0, plugin2);
2088
2159
  return matcher ? [matcher] : [];
2089
2160
  });
@@ -2094,7 +2165,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2094
2165
  } catch (e21) {
2095
2166
  }
2096
2167
  };
2097
- farmApp = new (0, _chunkM6U6E4F7cjs.FarmApp)(
2168
+ farmApp = new (0, _chunkCBLRSZQLcjs.FarmApp)(
2098
2169
  {
2099
2170
  ...options,
2100
2171
  root: resolveDevelopmentRoot(options.root, server.config.root)
@@ -2102,17 +2173,18 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2102
2173
  server
2103
2174
  );
2104
2175
  farmApp.getRouteManager().usePackageClientBoundaryCacheFile(
2105
- _chunkIEN2EFE5cjs.resolvePackageClientBoundaryCacheFile.call(void 0,
2176
+ _chunkBE7AQXJBcjs.resolvePackageClientBoundaryCacheFile.call(void 0,
2106
2177
  farmApp.getConfig().root,
2107
2178
  options.distDir || ".farm"
2108
2179
  )
2109
2180
  );
2181
+ farmApp.getRouteManager().trackSourceChanges();
2110
2182
  await farmApp.initialize();
2111
2183
  const farmConfig = farmApp.getConfig();
2112
2184
  let farmAppPackages;
2113
- if (_optionalChain([farmConfig, 'access', _128 => _128.agent, 'optionalAccess', _129 => _129.noindexPreviews])) {
2185
+ if (_optionalChain([farmConfig, 'access', _138 => _138.agent, 'optionalAccess', _139 => _139.noindexPreviews])) {
2114
2186
  farmMiddlewares.use((_req, res, next) => {
2115
- if (_chunkLECZ5DPZcjs.isFarmPreviewDeploymentEnvironment.call(void 0, process.env)) {
2187
+ if (_chunkOSEQL34Qcjs.isFarmPreviewDeploymentEnvironment.call(void 0, process.env)) {
2116
2188
  res.setHeader("X-Robots-Tag", _chunkZUVAGMQ5cjs.FARM_PREVIEW_ROBOTS_TAG);
2117
2189
  }
2118
2190
  next();
@@ -2120,7 +2192,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2120
2192
  }
2121
2193
  const apiServerBasePath = _chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0, farmConfig.api);
2122
2194
  const devBuiltInRoutePaths = new Set(
2123
- _chunkK4UGCUXXcjs.listFarmBuiltInRoutePaths.call(void 0, {
2195
+ _chunkFSSONJRVcjs.listFarmBuiltInRoutePaths.call(void 0, {
2124
2196
  agent: {
2125
2197
  apiCatalog: true,
2126
2198
  mcp: true,
@@ -2142,7 +2214,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2142
2214
  validateRemoteUrl: createNodeImageUrlValidator(farmConfig.images),
2143
2215
  // Vite owns this address. Unlike request.url, it cannot be replaced by
2144
2216
  // a caller-controlled Host header.
2145
- trustedLocalOrigin: () => _optionalChain([server, 'access', _130 => _130.resolvedUrls, 'optionalAccess', _131 => _131.local, 'access', _132 => _132[0]]),
2217
+ trustedLocalOrigin: () => _optionalChain([server, 'access', _140 => _140.resolvedUrls, 'optionalAccess', _141 => _141.local, 'access', _142 => _142[0]]),
2146
2218
  onError(error) {
2147
2219
  _chunkQMNWKQL4cjs.logger.error(
2148
2220
  `Image optimization failed: ${error instanceof Error ? error.message : String(error)}`
@@ -2155,22 +2227,22 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2155
2227
  if (farmConfig.i18n.enabled) {
2156
2228
  server.watcher.add(
2157
2229
  farmConfig.i18n.locales.map(
2158
- (locale) => _chunkLNVGXUL3cjs.resolveFarmI18nMessagePath.call(void 0, farmConfig.i18n, locale)
2230
+ (locale) => _chunkZMSVKVI3cjs.resolveFarmI18nMessagePath.call(void 0, farmConfig.i18n, locale)
2159
2231
  )
2160
2232
  );
2161
2233
  }
2162
2234
  const workflowConfig = farmConfig.workflows;
2163
2235
  const farmDocsDevRuntime = farmConfig.docs.enabled ? await loadFarmDocsDevRuntime() : null;
2164
2236
  const getExtraRouteTypes = () => [
2165
- ..._optionalChain([options, 'access', _133 => _133.openapi, 'optionalAccess', _134 => _134.enabled]) && options.openapi.route ? [options.openapi.route] : [],
2166
- ..._nullishCoalesce(_optionalChain([farmDocsDevRuntime, 'optionalAccess', _135 => _135.getFarmDocsRouteTypeEntries, 'call', _136 => _136(farmConfig.docs)]), () => ( []))
2237
+ ..._optionalChain([options, 'access', _143 => _143.openapi, 'optionalAccess', _144 => _144.enabled]) && options.openapi.route ? [options.openapi.route] : [],
2238
+ ..._nullishCoalesce(_optionalChain([farmDocsDevRuntime, 'optionalAccess', _145 => _145.getFarmDocsRouteTypeEntries, 'call', _146 => _146(farmConfig.docs)]), () => ( []))
2167
2239
  ];
2168
2240
  const appDirSlugs = sourceRoots.map(
2169
2241
  (source) => path6.join(source.root, source.srcDir, "app").replace(/\\/g, "/")
2170
2242
  );
2171
2243
  const generateTypeArtifacts = async (reason, selection = ALL_TYPE_ARTIFACTS, log = false) => {
2172
2244
  try {
2173
- const result = await _chunkK7JMTAFHcjs.generateFarmTypeArtifacts.call(void 0, {
2245
+ const result = await _chunkE3LE6EZHcjs.generateFarmTypeArtifacts.call(void 0, {
2174
2246
  root: farmConfig.root,
2175
2247
  srcDir: farmConfig.srcDir,
2176
2248
  layers: farmConfig.layers,
@@ -2210,7 +2282,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2210
2282
  (source) => path6.join(source.root, source.srcDir).replace(/\\/g, "/")
2211
2283
  );
2212
2284
  const layerConfigFiles = new Set(
2213
- farmConfig.layers.map((layer) => _optionalChain([layer, 'access', _137 => _137.configFile, 'optionalAccess', _138 => _138.replace, 'call', _139 => _139(/\\/g, "/")])).filter((file) => Boolean(file))
2285
+ farmConfig.layers.map((layer) => _optionalChain([layer, 'access', _147 => _147.configFile, 'optionalAccess', _148 => _148.replace, 'call', _149 => _149(/\\/g, "/")])).filter((file) => Boolean(file))
2214
2286
  );
2215
2287
  const routeModuleExtensions = /* @__PURE__ */ new Set([
2216
2288
  ..._chunk67MZTLTFcjs.resolveFarmComponentExtensions.call(void 0, farmConfig.renderer.componentExtensions),
@@ -2245,7 +2317,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2245
2317
  const isStaticMetadataImageFile = (file) => /\/(?:opengraph-image|twitter-image)(?:\.(?:png|jpg|jpeg|gif|webp)|\.alt\.txt)$/.test(
2246
2318
  file.replace(/\\/g, "/")
2247
2319
  );
2248
- const isI18nCatalogFile = (file) => _chunkLNVGXUL3cjs.isFarmI18nCatalogFile.call(void 0, farmConfig.i18n, file);
2320
+ const isI18nCatalogFile = (file) => _chunkZMSVKVI3cjs.isFarmI18nCatalogFile.call(void 0, farmConfig.i18n, file);
2249
2321
  let typeArtifactGenScheduled = null;
2250
2322
  let pendingTypeArtifacts = createEmptyTypeArtifactSelection();
2251
2323
  let pendingTypeArtifactReason = "";
@@ -2289,7 +2361,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2289
2361
  scheduleTypeArtifactGen(file, ev, typeArtifacts);
2290
2362
  }
2291
2363
  if (isI18nCatalogFile(file)) {
2292
- _optionalChain([farmApp, 'optionalAccess', _140 => _140.getI18nRuntime, 'call', _141 => _141(), 'access', _142 => _142.reload, 'call', _143 => _143(), 'access', _144 => _144.then, 'call', _145 => _145(() => server.ws.send({ type: "full-reload", path: "*" })), 'access', _146 => _146.catch, 'call', _147 => _147((error) => _chunkQMNWKQL4cjs.logger.warn(`i18n catalog reload failed: ${error.message}`))]);
2364
+ _optionalChain([farmApp, 'optionalAccess', _150 => _150.getI18nRuntime, 'call', _151 => _151(), 'access', _152 => _152.reload, 'call', _153 => _153(), 'access', _154 => _154.then, 'call', _155 => _155(() => server.ws.send({ type: "full-reload", path: "*" })), 'access', _156 => _156.catch, 'call', _157 => _157((error) => _chunkQMNWKQL4cjs.logger.warn(`i18n catalog reload failed: ${error.message}`))]);
2293
2365
  }
2294
2366
  const isRouteRefreshEvent = (ev !== "change" || isStaticMetadataImageFile(file)) && (isAppRuntimeFile(file) || isProgrammaticRouteFile(file) || isProgrammaticRouteSourceFile(file) && (ev === "unlink" || fileContainsProgrammaticPageRoute(file)));
2295
2367
  if (isRouteRefreshEvent) {
@@ -2302,8 +2374,8 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2302
2374
  const reloadsMiddleware = pendingRouteRefreshIncludesMiddleware;
2303
2375
  pendingRouteRefreshIncludesMiddleware = false;
2304
2376
  Promise.all([
2305
- _optionalChain([refreshRouteDiscovery, 'optionalCall', _148 => _148(`${ev} ${file}`)]),
2306
- reloadsMiddleware ? _optionalChain([middlewareManager, 'optionalAccess', _149 => _149.reload, 'call', _150 => _150()]) : void 0
2377
+ _optionalChain([refreshRouteDiscovery, 'optionalCall', _158 => _158(`${ev} ${file}`)]),
2378
+ reloadsMiddleware ? _optionalChain([middlewareManager, 'optionalAccess', _159 => _159.reload, 'call', _160 => _160()]) : void 0
2307
2379
  ]).then(() => server.ws.send({ type: "full-reload", path: "*" })).catch((error) => _chunkQMNWKQL4cjs.logger.warn(`Route refresh failed: ${error.message}`));
2308
2380
  }, 50);
2309
2381
  }
@@ -2342,14 +2414,14 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2342
2414
  const { FARM_DEV_SERVER_MODULE_LOADER } = await import("./internal/native-server-fns.cjs");
2343
2415
  const load = (file) => _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, server, file);
2344
2416
  globalThis[FARM_DEV_SERVER_MODULE_LOADER] = load;
2345
- _optionalChain([server, 'access', _151 => _151.httpServer, 'optionalAccess', _152 => _152.once, 'call', _153 => _153("close", () => {
2417
+ _optionalChain([server, 'access', _161 => _161.httpServer, 'optionalAccess', _162 => _162.once, 'call', _163 => _163("close", () => {
2346
2418
  const globals = globalThis;
2347
2419
  if (globals[FARM_DEV_SERVER_MODULE_LOADER] === load) {
2348
2420
  delete globals[FARM_DEV_SERVER_MODULE_LOADER];
2349
2421
  }
2350
2422
  })]);
2351
2423
  }
2352
- apiRouteManager = new (0, _chunkK66JILV3cjs.APIRouteManager)(appDirs, server, {
2424
+ apiRouteManager = new (0, _chunk5LOARKDPcjs.APIRouteManager)(appDirs, server, {
2353
2425
  plugins: farmConfig.plugins,
2354
2426
  i18n: farmApp.getI18nRuntime(),
2355
2427
  bodySizeLimit: serverConfig.bodySizeLimit,
@@ -2416,11 +2488,11 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2416
2488
  });
2417
2489
  }
2418
2490
  }
2419
- if (_optionalChain([options, 'access', _154 => _154.openapi, 'optionalAccess', _155 => _155.enabled])) {
2491
+ if (_optionalChain([options, 'access', _164 => _164.openapi, 'optionalAccess', _165 => _165.enabled])) {
2420
2492
  const { OpenAPIManager } = await loadFarmOpenAPIDevRuntime();
2421
2493
  openAPIManager = new OpenAPIManager(appDirs, options.openapi, {
2422
2494
  mode: "development",
2423
- apiBaseURL: typeof _optionalChain([options, 'access', _156 => _156.api, 'optionalAccess', _157 => _157.baseURL]) === "string" ? options.api.baseURL : void 0,
2495
+ apiBaseURL: typeof _optionalChain([options, 'access', _166 => _166.api, 'optionalAccess', _167 => _167.baseURL]) === "string" ? options.api.baseURL : void 0,
2424
2496
  loadModule: (filePath) => apiRouteManager.loadModule(filePath)
2425
2497
  });
2426
2498
  const spec = await openAPIManager.generateSpec();
@@ -2450,7 +2522,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2450
2522
  return _chunk7EPYN7GWcjs.resolveFarmLayoutFonts.call(void 0, layoutModules);
2451
2523
  };
2452
2524
  releaseDocsMCPServers();
2453
- const isFarmDocsPathGuarded = (href) => _chunk2MR4MABGcjs.farmPathGuardCoversPage.call(void 0,
2525
+ const isFarmDocsPathGuarded = (href) => _chunkC5AM2XDNcjs.farmPathGuardCoversPage.call(void 0,
2454
2526
  {
2455
2527
  config: farmConfig,
2456
2528
  middlewareRoutes: middlewareManager.getMiddlewares().filter((entry) => entry.source !== "config")
@@ -2463,20 +2535,20 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2463
2535
  clientEntry: "/@farm/client.js",
2464
2536
  resolveLayoutFonts: resolveDocsLayoutFonts,
2465
2537
  fontStylesheetHref: "/@farm/fonts.css",
2466
- globalStylesheetHref: _chunkM6U6E4F7cjs.resolveDevGlobalStylesheetHref.call(void 0,
2538
+ globalStylesheetHref: _chunkCBLRSZQLcjs.resolveDevGlobalStylesheetHref.call(void 0,
2467
2539
  farmConfig.root,
2468
2540
  farmConfig.srcDir
2469
2541
  ),
2470
2542
  loadModule: async (specifier) => {
2471
2543
  const resolved = await server.environments.ssr.pluginContainer.resolveId(specifier);
2472
- if (specifier === _optionalChain([farmConfig, 'access', _158 => _158.docs, 'access', _159 => _159.adapter, 'optionalAccess', _160 => _160.server]) && _optionalChain([resolved, 'optionalAccess', _161 => _161.id])) {
2544
+ if (specifier === _optionalChain([farmConfig, 'access', _168 => _168.docs, 'access', _169 => _169.adapter, 'optionalAccess', _170 => _170.server]) && _optionalChain([resolved, 'optionalAccess', _171 => _171.id])) {
2473
2545
  const file = resolved.id.split("?", 1)[0];
2474
2546
  return import(
2475
2547
  /* @vite-ignore */
2476
2548
  _url.pathToFileURL.call(void 0, file).href
2477
2549
  );
2478
2550
  }
2479
- return _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, server, _nullishCoalesce(_optionalChain([resolved, 'optionalAccess', _162 => _162.id]), () => ( specifier)));
2551
+ return _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, server, _nullishCoalesce(_optionalChain([resolved, 'optionalAccess', _172 => _172.id]), () => ( specifier)));
2480
2552
  },
2481
2553
  registerMCPServer: (mcpServer) => {
2482
2554
  const dispose = _chunkLRB5OVRTcjs.registerFarmMCPServer.call(void 0, mcpServer);
@@ -2494,7 +2566,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2494
2566
  fontAssets: _chunkERMUL73Lcjs.toFarmDocsPublicFontAssets.call(void 0, farmDocsFontAssetList),
2495
2567
  resolveLayoutFonts: resolveDocsLayoutFonts,
2496
2568
  fontStylesheetHref: "/@farm/fonts.css",
2497
- globalStylesheetHref: _chunkM6U6E4F7cjs.resolveDevGlobalStylesheetHref.call(void 0,
2569
+ globalStylesheetHref: _chunkCBLRSZQLcjs.resolveDevGlobalStylesheetHref.call(void 0,
2498
2570
  farmConfig.root,
2499
2571
  farmConfig.srcDir
2500
2572
  ),
@@ -2502,7 +2574,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2502
2574
  basePath: farmConfig.basePath
2503
2575
  }) : null;
2504
2576
  const farmDocsListsPages = Boolean(
2505
- farmDocsDevRuntime && _optionalChain([pm, 'optionalAccess', _163 => _163.getPlugins, 'call', _164 => _164(), 'access', _165 => _165.some, 'call', _166 => _166((plugin2) => plugin2.name === "farm:infra-analytics")])
2577
+ farmDocsDevRuntime && _optionalChain([pm, 'optionalAccess', _173 => _173.getPlugins, 'call', _174 => _174(), 'access', _175 => _175.some, 'call', _176 => _176((plugin2) => plugin2.name === "farm:infra-analytics")])
2506
2578
  );
2507
2579
  let farmDocsPagePaths;
2508
2580
  const getFarmDocsPagePaths = () => {
@@ -2530,14 +2602,14 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2530
2602
  }
2531
2603
  }
2532
2604
  const wrapFarmDocsResponseWithLayouts = async (request, response) => {
2533
- if (request.method === "HEAD" || response.headers.has("x-farm-docs-adapter") || !_optionalChain([response, 'access', _167 => _167.headers, 'access', _168 => _168.get, 'call', _169 => _169("content-type"), 'optionalAccess', _170 => _170.toLowerCase, 'call', _171 => _171(), 'access', _172 => _172.includes, 'call', _173 => _173("text/html")])) {
2605
+ if (request.method === "HEAD" || response.headers.has("x-farm-docs-adapter") || !_optionalChain([response, 'access', _177 => _177.headers, 'access', _178 => _178.get, 'call', _179 => _179("content-type"), 'optionalAccess', _180 => _180.toLowerCase, 'call', _181 => _181(), 'access', _182 => _182.includes, 'call', _183 => _183("text/html")])) {
2534
2606
  return response;
2535
2607
  }
2536
2608
  const pathname = new URL(request.url).pathname;
2537
2609
  const matchedRoute = routeManager.matchRoute(pathname);
2538
2610
  const layoutEntries = matchedRoute.layouts.map((layout) => ({
2539
2611
  ...layout,
2540
- metadata: _chunkIEN2EFE5cjs.getClientModuleMetadata.call(void 0, layout.modulePath, farmConfig.root)
2612
+ metadata: _chunkBE7AQXJBcjs.getClientModuleMetadata.call(void 0, layout.modulePath, farmConfig.root)
2541
2613
  }));
2542
2614
  if (!layoutEntries.some((layout) => layout.metadata.shouldHydrate)) {
2543
2615
  return response;
@@ -2551,7 +2623,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2551
2623
  headers: response.headers
2552
2624
  });
2553
2625
  }
2554
- const docsRenderer = _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, (_nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _174 => _174.getConfig, 'call', _175 => _175()]), () => ( options))).renderer);
2626
+ const docsRenderer = _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, (_nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _184 => _184.getConfig, 'call', _185 => _185()]), () => ( options))).renderer);
2555
2627
  const [rendererRuntime, layoutModules] = await Promise.all([
2556
2628
  _chunk67MZTLTFcjs.isReactRenderer.call(void 0, docsRenderer) ? import("./renderer/react/server.cjs") : _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, server, docsRenderer.server),
2557
2629
  Promise.all(
@@ -2580,7 +2652,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2580
2652
  ])
2581
2653
  );
2582
2654
  const inlineValue = (value) => JSON.stringify(value).replace(/</g, "\\u003c").replace(/>/g, "\\u003e");
2583
- const pageModulePath = _optionalChain([matchedRoute, 'access', _176 => _176.route, 'optionalAccess', _177 => _177.modulePath]) ? toUrlPath(matchedRoute.route.modulePath) : "";
2655
+ const pageModulePath = _optionalChain([matchedRoute, 'access', _186 => _186.route, 'optionalAccess', _187 => _187.modulePath]) ? toUrlPath(matchedRoute.route.modulePath) : "";
2584
2656
  const bootstrapScript = `<script>
2585
2657
  window.__FARM_PROPS__ = ${inlineValue({ params })};
2586
2658
  window.__FARM_ROUTE_SLOTS__ = [];
@@ -2677,7 +2749,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2677
2749
  }
2678
2750
  },
2679
2751
  (request) => {
2680
- const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _178 => _178.getConfig, 'call', _179 => _179()]), () => ( options));
2752
+ const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _188 => _188.getConfig, 'call', _189 => _189()]), () => ( options));
2681
2753
  const currentServerConfig = _chunkCFG4QERRcjs.resolveFarmServerConfig.call(void 0, currentConfig.server);
2682
2754
  return _chunkHDPT6OYEcjs.resolveFarmRequestURL.call(void 0, request, {
2683
2755
  trustProxy: currentServerConfig.trustProxy
@@ -2693,7 +2765,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2693
2765
  withAPIRequestTracing(async function handleFarmDevRequest(req, res, next) {
2694
2766
  const requestUrl = req.url || "/";
2695
2767
  const requestMethod = req.method || "GET";
2696
- const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _180 => _180.getConfig, 'call', _181 => _181()]), () => ( options));
2768
+ const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _190 => _190.getConfig, 'call', _191 => _191()]), () => ( options));
2697
2769
  const currentServerConfig = _chunkCFG4QERRcjs.resolveFarmServerConfig.call(void 0, currentConfig.server);
2698
2770
  const parsedRequestUrl = _chunkHDPT6OYEcjs.resolveFarmRequestURL.call(void 0, req, {
2699
2771
  trustProxy: currentServerConfig.trustProxy
@@ -2716,7 +2788,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2716
2788
  }
2717
2789
  }
2718
2790
  if (requestMethod === "OPTIONS" && req.headers.origin && req.headers["access-control-request-method"]) {
2719
- const preflightHeaders = _chunkOCNV4CI2cjs.resolveRouteRuleCorsPreflightHeaders.call(void 0,
2791
+ const preflightHeaders = _chunkMQ4DYVFScjs.resolveRouteRuleCorsPreflightHeaders.call(void 0,
2720
2792
  currentConfig.routeRules,
2721
2793
  requestPathname
2722
2794
  );
@@ -2787,7 +2859,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2787
2859
  openapi: options.openapi
2788
2860
  },
2789
2861
  workflows: discoveredWorkflows,
2790
- plugins: _optionalChain([pm, 'optionalAccess', _182 => _182.getSortedPlugins, 'call', _183 => _183()])
2862
+ plugins: _optionalChain([pm, 'optionalAccess', _192 => _192.getSortedPlugins, 'call', _193 => _193()])
2791
2863
  });
2792
2864
  res.statusCode = 200;
2793
2865
  res.setHeader(
@@ -2814,27 +2886,34 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2814
2886
  const runtimeHookErrorAnswersJSON = rendererDisabled || _chunkXGTFLG73cjs.isFarmAPIPathname.call(void 0, requestPathname, apiServerBasePath);
2815
2887
  const requestedPagePathname = configRewriteSource === void 0 ? requestPathname : new URL(configRewriteSource).pathname;
2816
2888
  let pageHookRouteMatch;
2817
- const pageHookRoute = (pathname2) => {
2818
- if (_optionalChain([pageHookRouteMatch, 'optionalAccess', _184 => _184.render, 'access', _185 => _185.pathname]) === pathname2) return pageHookRouteMatch;
2889
+ const pageHookRoute = () => {
2890
+ if (pageHookRouteMatch) return pageHookRouteMatch;
2891
+ const pathname2 = requestedPagePathname;
2819
2892
  const match = farmApp.getRouteManager().matchRoute(pathname2);
2820
2893
  pageHookRouteMatch = {
2821
2894
  render: {
2822
2895
  pathname: pathname2,
2823
2896
  method: requestMethod,
2824
- routePattern: _optionalChain([match, 'optionalAccess', _186 => _186.route, 'optionalAccess', _187 => _187.pattern]) || null,
2825
- params: _optionalChain([match, 'optionalAccess', _188 => _188.params]) || {}
2897
+ routePattern: _optionalChain([match, 'optionalAccess', _194 => _194.route, 'optionalAccess', _195 => _195.pattern]) || null,
2898
+ params: _optionalChain([match, 'optionalAccess', _196 => _196.params]) || {}
2826
2899
  },
2827
- layoutPatterns: (_optionalChain([match, 'optionalAccess', _189 => _189.layouts]) || []).map((layout) => layout.pattern)
2900
+ layoutPatterns: (_optionalChain([match, 'optionalAccess', _197 => _197.layouts]) || []).map((layout) => layout.pattern)
2828
2901
  };
2829
2902
  return pageHookRouteMatch;
2830
2903
  };
2831
- const runFarmDevPageHooks = async (pathname2 = requestedPagePathname) => {
2904
+ const matchAppMetadataRoute = (pathname2) => {
2905
+ const routeManager3 = farmApp.getRouteManager();
2906
+ const image = routeManager3.matchMetadataImage(pathname2);
2907
+ if (image) return { pattern: image.image.pattern, params: image.params };
2908
+ const metadata = routeManager3.matchMetadataRoute(pathname2);
2909
+ return metadata ? { pattern: metadata.metadata.pattern, params: metadata.params } : null;
2910
+ };
2911
+ const runFarmDevPageHooks = async () => {
2832
2912
  if (!pm || !pm.hasHook("beforeRouteMatch") && !pm.hasHook("afterRouteMatch") && !pm.hasHook("beforeRender")) {
2833
2913
  return;
2834
2914
  }
2835
- const { render, layoutPatterns } = pageHookRoute(pathname2);
2836
- const routeManager3 = farmApp.getRouteManager();
2837
- if (routeManager3.matchMetadataRoute(render.pathname) || routeManager3.matchMetadataImage(render.pathname) || // A path no page route matches is a page only for a GET or HEAD request.
2915
+ const { render, layoutPatterns } = pageHookRoute();
2916
+ if (matchAppMetadataRoute(render.pathname) || // A path no page route matches is a page only for a GET or HEAD request.
2838
2917
  !render.routePattern && requestMethod !== "GET" && requestMethod !== "HEAD") {
2839
2918
  return;
2840
2919
  }
@@ -2851,15 +2930,19 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2851
2930
  });
2852
2931
  await pm.runHookParallel("beforeRender", render);
2853
2932
  };
2854
- if (pm && configRewriteSource === void 0 && !deferredDottedRequests.has(req) && (configRoutePlugins.has(_chunkMBCRWU3Pcjs.FARM_CONFIG_HEADERS_PLUGIN_NAME) || configRedirectMatchers.length > 0) && !isViteOwnedRequest()) {
2855
- let redirect = null;
2933
+ const meetsRequestedURLRoutes = configRewriteSource === void 0 && !deferredDottedRequests.has(req);
2934
+ const routeRedirect = meetsRequestedURLRoutes ? farmApp.getRouteManager().matchRedirect(requestPathname, parsedRequestUrl.search) : null;
2935
+ if (meetsRequestedURLRoutes && (routeRedirect || pm && (configRoutePlugins.has(_chunkMBCRWU3Pcjs.FARM_CONFIG_HEADERS_PLUGIN_NAME) || configRedirectMatchers.length > 0)) && !isViteOwnedRequest()) {
2936
+ let redirect = routeRedirect;
2856
2937
  try {
2857
- await pm.runHookParallelFiltered(
2858
- "beforeRequest",
2859
- (plugin2) => plugin2.name === _chunkMBCRWU3Pcjs.FARM_CONFIG_HEADERS_PLUGIN_NAME,
2860
- req,
2861
- res
2862
- );
2938
+ if (pm) {
2939
+ await pm.runHookParallelFiltered(
2940
+ "beforeRequest",
2941
+ (plugin2) => plugin2.name === _chunkMBCRWU3Pcjs.FARM_CONFIG_HEADERS_PLUGIN_NAME,
2942
+ req,
2943
+ res
2944
+ );
2945
+ }
2863
2946
  for (const matchRedirect of configRedirectMatchers) {
2864
2947
  _nullishCoalesce(redirect, () => ( (redirect = matchRedirect(parsedRequestUrl))));
2865
2948
  }
@@ -2877,17 +2960,18 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2877
2960
  status: redirect.statusCode,
2878
2961
  headers: { Location: redirect.destination }
2879
2962
  });
2880
- if (opensFarmDevRuntimeSession(pm)) {
2963
+ if (pm && opensFarmDevRuntimeSession(pm)) {
2881
2964
  const redirectResponse = response;
2882
2965
  try {
2883
- const kind = _chunkXGTFLG73cjs.isFarmAPIPathname.call(void 0, requestPathname, apiServerBasePath) ? "api" : requestMethod === "GET" || requestMethod === "HEAD" ? "page" : "request";
2966
+ const metadataRoute = matchAppMetadataRoute(requestPathname);
2967
+ const kind = metadataRoute ? "asset" : _chunkXGTFLG73cjs.isFarmAPIPathname.call(void 0, requestPathname, apiServerBasePath) ? "api" : requestMethod === "GET" || requestMethod === "HEAD" ? "page" : "request";
2884
2968
  response = await pm.runRuntimeRequest(
2885
2969
  createRequestFromNodeRequest(req, parsedRequestUrl),
2886
2970
  async () => {
2887
2971
  if (kind === "page") await runFarmDevPageHooks();
2888
2972
  return redirectResponse;
2889
2973
  },
2890
- { kind, route: { pathname: requestPathname } }
2974
+ { kind, route: { pathname: requestPathname, ...metadataRoute } }
2891
2975
  );
2892
2976
  } catch (e23) {
2893
2977
  sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
@@ -2901,7 +2985,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2901
2985
  }
2902
2986
  }
2903
2987
  const runAppMiddlewareForContentRoute = async () => {
2904
- if (!_optionalChain([middlewareManager, 'optionalAccess', _190 => _190.hasMiddleware, 'call', _191 => _191()])) return false;
2988
+ if (!_optionalChain([middlewareManager, 'optionalAccess', _198 => _198.hasMiddleware, 'call', _199 => _199()])) return false;
2905
2989
  const middlewareRequest = createRequestFromNodeRequest(req, new URL(fullUrl));
2906
2990
  return runFarmMiddlewareWithNavigation(
2907
2991
  farmApp.getServerRenderer(),
@@ -2939,7 +3023,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2939
3023
  return response.status;
2940
3024
  };
2941
3025
  const runAppMiddlewareInRuntimeSession = async (runtimeSession2, logResponse2) => {
2942
- const interceptor = runtimeSession2 && _optionalChain([pm, 'optionalAccess', _192 => _192.hasRuntimeHook, 'call', _193 => _193("after")]) && _optionalChain([middlewareManager, 'optionalAccess', _194 => _194.hasMiddleware, 'call', _195 => _195()]) ? interceptFarmDevPageResponse({
3026
+ const interceptor = runtimeSession2 && _optionalChain([pm, 'optionalAccess', _200 => _200.hasRuntimeHook, 'call', _201 => _201("after")]) && _optionalChain([middlewareManager, 'optionalAccess', _202 => _202.hasMiddleware, 'call', _203 => _203()]) ? interceptFarmDevPageResponse({
2943
3027
  req,
2944
3028
  res,
2945
3029
  pm,
@@ -2952,7 +3036,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2952
3036
  urlPath: requestUrl,
2953
3037
  pathname: requestPathname,
2954
3038
  startTime: Date.now(),
2955
- logResponse: (_method, _path, status) => _optionalChain([logResponse2, 'optionalCall', _196 => _196(status)]),
3039
+ logResponse: (_method, _path, status) => _optionalChain([logResponse2, 'optionalCall', _204 => _204(status)]),
2956
3040
  // The runtime reports a runtime.after failure itself.
2957
3041
  emitError: async () => {
2958
3042
  },
@@ -2963,7 +3047,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2963
3047
  handled = await runAppMiddlewareForContentRoute();
2964
3048
  } catch (error) {
2965
3049
  if (runtimeHookErrorAnswersJSON || res.headersSent) {
2966
- _optionalChain([interceptor, 'optionalAccess', _197 => _197.release, 'call', _198 => _198()]);
3050
+ _optionalChain([interceptor, 'optionalAccess', _205 => _205.release, 'call', _206 => _206()]);
2967
3051
  throw error;
2968
3052
  }
2969
3053
  if (runtimeSession2) await pm.reportRuntimeRequestError(runtimeSession2, error);
@@ -2971,10 +3055,10 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2971
3055
  return true;
2972
3056
  }
2973
3057
  if (!handled) {
2974
- _optionalChain([interceptor, 'optionalAccess', _199 => _199.release, 'call', _200 => _200()]);
3058
+ _optionalChain([interceptor, 'optionalAccess', _207 => _207.release, 'call', _208 => _208()]);
2975
3059
  return false;
2976
3060
  }
2977
- if (!_optionalChain([interceptor, 'optionalAccess', _201 => _201.isEnded, 'call', _202 => _202()])) _optionalChain([logResponse2, 'optionalCall', _203 => _203(res.statusCode || 200)]);
3061
+ if (!_optionalChain([interceptor, 'optionalAccess', _209 => _209.isEnded, 'call', _210 => _210()])) _optionalChain([logResponse2, 'optionalCall', _211 => _211(res.statusCode || 200)]);
2978
3062
  return true;
2979
3063
  };
2980
3064
  const serveBuiltInRoute = async (respond, {
@@ -2983,7 +3067,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2983
3067
  label
2984
3068
  } = {}) => {
2985
3069
  const discard = async () => {
2986
- await _optionalChain([computed, 'optionalAccess', _204 => _204.body, 'optionalAccess', _205 => _205.cancel, 'call', _206 => _206(), 'access', _207 => _207.catch, 'call', _208 => _208(() => {
3070
+ await _optionalChain([computed, 'optionalAccess', _212 => _212.body, 'optionalAccess', _213 => _213.cancel, 'call', _214 => _214(), 'access', _215 => _215.catch, 'call', _216 => _216(() => {
2987
3071
  })]);
2988
3072
  };
2989
3073
  const sendRuntimeResponse = async (runtimeSession3, response2) => {
@@ -3000,9 +3084,9 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3000
3084
  if (pm && opensFarmDevRuntimeSession(pm)) {
3001
3085
  try {
3002
3086
  const routePathname = _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath);
3003
- const route = _chunkK4UGCUXXcjs.setFarmRouteLabel.call(void 0,
3087
+ const route = _chunkFSSONJRVcjs.setFarmRouteLabel.call(void 0,
3004
3088
  { pathname: requestPathname },
3005
- label !== void 0 ? label : devBuiltInRoutePaths.has(routePathname) ? routePathname : _chunkK4UGCUXXcjs.resolveFarmMCPRouteLabel.call(void 0, routePathname, apiServerBasePath)
3089
+ label !== void 0 ? label : devBuiltInRoutePaths.has(routePathname) ? routePathname : _chunkFSSONJRVcjs.resolveFarmMCPRouteLabel.call(void 0, routePathname, apiServerBasePath)
3006
3090
  );
3007
3091
  runtimeSession2 = await pm.beginRuntimeRequest(
3008
3092
  createRequestFromNodeRequest(req, new URL(fullUrl)),
@@ -3040,7 +3124,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3040
3124
  }
3041
3125
  responding = true;
3042
3126
  response = await respond(
3043
- _nullishCoalesce(_optionalChain([runtimeSession2, 'optionalAccess', _209 => _209.request]), () => ( createRequestFromNodeRequest(req, new URL(fullUrl))))
3127
+ _nullishCoalesce(_optionalChain([runtimeSession2, 'optionalAccess', _217 => _217.request]), () => ( createRequestFromNodeRequest(req, new URL(fullUrl))))
3044
3128
  );
3045
3129
  } catch (error) {
3046
3130
  if (!responding && !res.headersSent) {
@@ -3060,7 +3144,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3060
3144
  else await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0, res, response);
3061
3145
  };
3062
3146
  const openAPIRequestPathname = openAPIManager ? _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath) : requestPathname;
3063
- if (openAPIManager && _optionalChain([options, 'access', _210 => _210.openapi, 'optionalAccess', _211 => _211.specRoute]) && openAPIRequestPathname === options.openapi.specRoute) {
3147
+ if (openAPIManager && _optionalChain([options, 'access', _218 => _218.openapi, 'optionalAccess', _219 => _219.specRoute]) && openAPIRequestPathname === options.openapi.specRoute) {
3064
3148
  const specManager = openAPIManager;
3065
3149
  await serveBuiltInRoute(async () => {
3066
3150
  if (requestMethod !== "GET" && requestMethod !== "HEAD") {
@@ -3080,7 +3164,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3080
3164
  });
3081
3165
  return;
3082
3166
  }
3083
- if (openAPIManager && openAPIRequestPathname === _optionalChain([options, 'access', _212 => _212.openapi, 'optionalAccess', _213 => _213.route])) {
3167
+ if (openAPIManager && openAPIRequestPathname === _optionalChain([options, 'access', _220 => _220.openapi, 'optionalAccess', _221 => _221.route])) {
3084
3168
  const docsManager = openAPIManager;
3085
3169
  await serveBuiltInRoute(
3086
3170
  async () => {
@@ -3091,24 +3175,24 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3091
3175
  );
3092
3176
  return;
3093
3177
  }
3094
- if (_optionalChain([options, 'access', _214 => _214.agent, 'optionalAccess', _215 => _215.manifest]) !== false && _chunkK4UGCUXXcjs.isFarmAppManifestPath.call(void 0, _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath))) {
3178
+ if (_optionalChain([options, 'access', _222 => _222.agent, 'optionalAccess', _223 => _223.manifest]) !== false && _chunkFSSONJRVcjs.isFarmAppManifestPath.call(void 0, _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath))) {
3095
3179
  await serveBuiltInRoute(async () => {
3096
- _nullishCoalesce(farmAppPackages, () => ( (farmAppPackages = _chunkM6U6E4F7cjs.resolveFarmAppPackages.call(void 0, _nullishCoalesce(farmConfig.root, () => ( process.cwd()))))));
3097
- const manifest = await _chunkK4UGCUXXcjs.createFarmAppManifestResponse.call(void 0,
3180
+ _nullishCoalesce(farmAppPackages, () => ( (farmAppPackages = _chunkCBLRSZQLcjs.resolveFarmAppPackages.call(void 0, _nullishCoalesce(farmConfig.root, () => ( process.cwd()))))));
3181
+ const manifest = await _chunkFSSONJRVcjs.createFarmAppManifestResponse.call(void 0,
3098
3182
  new Request(parsedRequestUrl, {
3099
3183
  method: requestMethod,
3100
3184
  headers: { "if-none-match": String(_nullishCoalesce(req.headers["if-none-match"], () => ( ""))) }
3101
3185
  }),
3102
3186
  {
3103
- ..._chunkK4UGCUXXcjs.resolveFarmAppManifestInput.call(void 0, farmConfig, {
3187
+ ..._chunkFSSONJRVcjs.resolveFarmAppManifestInput.call(void 0, farmConfig, {
3104
3188
  build: "development",
3105
3189
  packages: farmAppPackages,
3106
3190
  // Read again on each request; unchanged files come from a cache.
3107
- webmcpTools: _optionalChain([farmConfig, 'access', _216 => _216.plugins, 'optionalAccess', _217 => _217.some, 'call', _218 => _218(({ name }) => name === "farm:webmcp")]) ? _chunkM6U6E4F7cjs.collectFarmWebMCPTools.call(void 0, _nullishCoalesce(farmConfig.root, () => ( process.cwd())), farmConfig.srcDir) : []
3191
+ webmcpTools: _optionalChain([farmConfig, 'access', _224 => _224.plugins, 'optionalAccess', _225 => _225.some, 'call', _226 => _226(({ name }) => name === "farm:webmcp")]) ? _chunkCBLRSZQLcjs.collectFarmWebMCPTools.call(void 0, _nullishCoalesce(farmConfig.root, () => ( process.cwd())), farmConfig.srcDir) : []
3108
3192
  }),
3109
3193
  defaultMCP: () => farmApp.getServerRenderer().getDefaultMCPServer(),
3110
3194
  // A guard written for an MCP server's path keeps its tools out of the public view.
3111
- guardCoversPath: (path7) => _chunk2MR4MABGcjs.farmPathGuardCoversEndpoint.call(void 0,
3195
+ guardCoversPath: (path7) => _chunkC5AM2XDNcjs.farmPathGuardCoversEndpoint.call(void 0,
3112
3196
  {
3113
3197
  config: farmConfig,
3114
3198
  middlewareRoutes: middlewareManager.getMiddlewares().filter((entry) => entry.source !== "config")
@@ -3122,11 +3206,11 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3122
3206
  });
3123
3207
  return;
3124
3208
  }
3125
- if (_optionalChain([options, 'access', _219 => _219.agent, 'optionalAccess', _220 => _220.apiCatalog]) && _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath) === _chunkK4UGCUXXcjs.FARM_API_CATALOG_PATH) {
3209
+ if (_optionalChain([options, 'access', _227 => _227.agent, 'optionalAccess', _228 => _228.apiCatalog]) && _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath) === _chunkFSSONJRVcjs.FARM_API_CATALOG_PATH) {
3126
3210
  await serveBuiltInRoute(
3127
- () => _chunkK4UGCUXXcjs.createFarmApiCatalogResponse.call(void 0,
3211
+ () => _chunkFSSONJRVcjs.createFarmApiCatalogResponse.call(void 0,
3128
3212
  requestMethod,
3129
- _chunkK4UGCUXXcjs.resolveFarmApiCatalogInput.call(void 0, { ...options, api: farmConfig.api }),
3213
+ _chunkFSSONJRVcjs.resolveFarmApiCatalogInput.call(void 0, { ...options, api: farmConfig.api }),
3130
3214
  new Request(parsedRequestUrl, {
3131
3215
  headers: { "user-agent": String(_nullishCoalesce(req.headers["user-agent"], () => ( ""))) }
3132
3216
  })
@@ -3134,8 +3218,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3134
3218
  );
3135
3219
  return;
3136
3220
  }
3137
- if (_optionalChain([options, 'access', _221 => _221.agent, 'optionalAccess', _222 => _222.aiCatalog]) !== false) {
3138
- const aiCatalog = _chunkK4UGCUXXcjs.createFarmAiCatalogResponse.call(void 0,
3221
+ if (_optionalChain([options, 'access', _229 => _229.agent, 'optionalAccess', _230 => _230.aiCatalog]) !== false) {
3222
+ const aiCatalog = _chunkFSSONJRVcjs.createFarmAiCatalogResponse.call(void 0,
3139
3223
  new Request(parsedRequestUrl, {
3140
3224
  method: requestMethod,
3141
3225
  headers: {
@@ -3178,7 +3262,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3178
3262
  const docsBodyInit = requestMethod === "GET" || requestMethod === "HEAD" ? {} : { body: _chunkCFG4QERRcjs.createFarmNodeRequestBodyStream.call(void 0, req), duplex: "half" };
3179
3263
  const docsResponse = await farmDocsHandler(new Request(docsRequest, docsBodyInit));
3180
3264
  if (docsResponse) {
3181
- const docsPage = _optionalChain([docsResponse, 'access', _223 => _223.headers, 'access', _224 => _224.get, 'call', _225 => _225("content-type"), 'optionalAccess', _226 => _226.toLowerCase, 'call', _227 => _227(), 'access', _228 => _228.includes, 'call', _229 => _229("text/html")]);
3265
+ const docsPage = _optionalChain([docsResponse, 'access', _231 => _231.headers, 'access', _232 => _232.get, 'call', _233 => _233("content-type"), 'optionalAccess', _234 => _234.toLowerCase, 'call', _235 => _235(), 'access', _236 => _236.includes, 'call', _237 => _237("text/html")]);
3182
3266
  await serveBuiltInRoute(
3183
3267
  async (request) => {
3184
3268
  if (!docsPage) return wrapFarmDocsResponseWithLayouts(docsRequest, docsResponse);
@@ -3187,7 +3271,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3187
3271
  farmConfig.deploymentId
3188
3272
  );
3189
3273
  if (deploymentMismatch) {
3190
- await _optionalChain([docsResponse, 'access', _230 => _230.body, 'optionalAccess', _231 => _231.cancel, 'call', _232 => _232()]);
3274
+ await _optionalChain([docsResponse, 'access', _238 => _238.body, 'optionalAccess', _239 => _239.cancel, 'call', _240 => _240()]);
3191
3275
  return _chunkNLBHLPEOcjs.createFarmDeploymentMismatchResponse.call(void 0, deploymentMismatch);
3192
3276
  }
3193
3277
  return _chunkNLBHLPEOcjs.withFarmDeploymentResponse.call(void 0,
@@ -3203,11 +3287,11 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3203
3287
  {
3204
3288
  kind: "docs",
3205
3289
  computed: docsResponse,
3206
- label: _chunkK4UGCUXXcjs.resolveFarmDocsEngineRouteLabel.call(void 0,
3290
+ label: _chunkFSSONJRVcjs.resolveFarmDocsEngineRouteLabel.call(void 0,
3207
3291
  _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath),
3208
3292
  {
3209
- path: _optionalChain([farmConfig, 'access', _233 => _233.docs, 'optionalAccess', _234 => _234.entry]) || "/docs",
3210
- roots: _optionalChain([farmConfig, 'access', _235 => _235.docs, 'optionalAccess', _236 => _236.roots, 'optionalAccess', _237 => _237.map, 'call', _238 => _238((root) => root.entry)]),
3293
+ path: _optionalChain([farmConfig, 'access', _241 => _241.docs, 'optionalAccess', _242 => _242.entry]) || "/docs",
3294
+ roots: _optionalChain([farmConfig, 'access', _243 => _243.docs, 'optionalAccess', _244 => _244.roots, 'optionalAccess', _245 => _245.map, 'call', _246 => _246((root) => root.entry)]),
3211
3295
  pages: await getFarmDocsPagePaths()
3212
3296
  }
3213
3297
  )
@@ -3216,7 +3300,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3216
3300
  return;
3217
3301
  }
3218
3302
  }
3219
- if (options.mobileClient && !viteModuleRequest && (requestMethod === "GET" || requestMethod === "HEAD" || requestMethod === "POST") && _optionalChain([req, 'access', _239 => _239.headers, 'access', _240 => _240.accept, 'optionalAccess', _241 => _241.includes, 'call', _242 => _242(_chunk3HLQTOVUcjs.FARM_NATIVE_TREE_CONTENT_TYPE)])) {
3303
+ if (options.mobileClient && !viteModuleRequest && (requestMethod === "GET" || requestMethod === "HEAD" || requestMethod === "POST") && _optionalChain([req, 'access', _247 => _247.headers, 'access', _248 => _248.accept, 'optionalAccess', _249 => _249.includes, 'call', _250 => _250(_chunk3HLQTOVUcjs.FARM_NATIVE_TREE_CONTENT_TYPE)])) {
3220
3304
  const { createFarmNativeTreeResponse } = await import("./native-tree-GF4BH33L.cjs");
3221
3305
  const treeBodyInit = requestMethod === "POST" ? { body: _chunkCFG4QERRcjs.createFarmNodeRequestBodyStream.call(void 0, req), duplex: "half" } : {};
3222
3306
  const treeResponse = await createFarmNativeTreeResponse({
@@ -3234,18 +3318,18 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3234
3318
  });
3235
3319
  await serveBuiltInRoute(() => treeResponse, {
3236
3320
  computed: treeResponse,
3237
- label: _nullishCoalesce(_optionalChain([farmApp, 'access', _243 => _243.getRouteManager, 'call', _244 => _244(), 'access', _245 => _245.matchRoute, 'call', _246 => _246(_chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath)), 'access', _247 => _247.route, 'optionalAccess', _248 => _248.pattern]), () => ( null))
3321
+ label: _nullishCoalesce(_optionalChain([farmApp, 'access', _251 => _251.getRouteManager, 'call', _252 => _252(), 'access', _253 => _253.matchRoute, 'call', _254 => _254(_chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, requestPathname, farmConfig.basePath)), 'access', _255 => _255.route, 'optionalAccess', _256 => _256.pattern]), () => ( null))
3238
3322
  });
3239
3323
  return;
3240
3324
  }
3241
3325
  const markdownRouteLabel = () => (
3242
3326
  // On the route path, as production labels it: /fr/index.md is /index.md.
3243
- _chunkK4UGCUXXcjs.resolveFarmMarkdownRouteLabel.call(void 0,
3327
+ _chunkFSSONJRVcjs.resolveFarmMarkdownRouteLabel.call(void 0,
3244
3328
  toRoutePathname(requestPathname),
3245
- (page) => _optionalChain([farmApp, 'access', _249 => _249.getRouteManager, 'call', _250 => _250(), 'access', _251 => _251.matchRoute, 'call', _252 => _252(page), 'access', _253 => _253.route, 'optionalAccess', _254 => _254.pattern])
3329
+ (page) => _optionalChain([farmApp, 'access', _257 => _257.getRouteManager, 'call', _258 => _258(), 'access', _259 => _259.matchRoute, 'call', _260 => _260(page), 'access', _261 => _261.route, 'optionalAccess', _262 => _262.pattern])
3246
3330
  )
3247
3331
  );
3248
- const markdownSourceResponse = viteModuleRequest ? null : await _chunkNSZY3EWGcjs.createFarmMarkdownSourceResponse.call(void 0, {
3332
+ const markdownSourceResponse = viteModuleRequest ? null : await _chunkL6E4SHUBcjs.createFarmMarkdownSourceResponse.call(void 0, {
3249
3333
  request: new Request(fullUrl, {
3250
3334
  method: requestMethod,
3251
3335
  headers: docsHeaders
@@ -3254,7 +3338,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3254
3338
  routePathname: toRoutePathname,
3255
3339
  resolveSource: async (pathname2) => {
3256
3340
  const match = farmApp.getRouteManager().matchRoute(pathname2);
3257
- const sourcePath = _optionalChain([match, 'access', _255 => _255.route, 'optionalAccess', _256 => _256.markdownSourcePath]) || (match.route && _chunkNSZY3EWGcjs.isFarmMarkdownPageFile.call(void 0, match.route.modulePath) ? match.route.modulePath : null);
3341
+ const sourcePath = _optionalChain([match, 'access', _263 => _263.route, 'optionalAccess', _264 => _264.markdownSourcePath]) || (match.route && _chunkL6E4SHUBcjs.isFarmMarkdownPageFile.call(void 0, match.route.modulePath) ? match.route.modulePath : null);
3258
3342
  if (!sourcePath) {
3259
3343
  return null;
3260
3344
  }
@@ -3326,7 +3410,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3326
3410
  return;
3327
3411
  }
3328
3412
  if (!viteModuleRequest && _chunkC2JOS77Zcjs.farmRequestWantsMarkdown.call(void 0, requestPathname, req.headers.accept)) {
3329
- const markdownRoute = farmApp.getRouteManager().matchRoute(_chunkNSZY3EWGcjs.normalizeFarmMarkdownRoutePath.call(void 0, requestPathname, toRoutePathname));
3413
+ const markdownRoute = farmApp.getRouteManager().matchRoute(_chunkL6E4SHUBcjs.normalizeFarmMarkdownRoutePath.call(void 0, requestPathname, toRoutePathname));
3330
3414
  if (!markdownRoute.route) {
3331
3415
  await serveBuiltInRoute(
3332
3416
  () => new Response(
@@ -3410,7 +3494,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3410
3494
  "beforeRequest",
3411
3495
  (plugin2) => {
3412
3496
  const owner = _chunkJX5VOLAVcjs.getFarmIntegrationPluginOwner.call(void 0, plugin2);
3413
- return !isFarmConfigRoutePlugin(plugin2) && (_optionalChain([owner, 'optionalAccess', _257 => _257.source]) !== "lifecycle" || owner.key !== matchedRoute.key);
3497
+ return !isFarmConfigRoutePlugin(plugin2) && (_optionalChain([owner, 'optionalAccess', _265 => _265.source]) !== "lifecycle" || owner.key !== matchedRoute.key);
3414
3498
  },
3415
3499
  req,
3416
3500
  res
@@ -3447,7 +3531,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3447
3531
  isProd: false
3448
3532
  },
3449
3533
  request,
3450
- { clientAddress: _optionalChain([req, 'access', _258 => _258.socket, 'optionalAccess', _259 => _259.remoteAddress]) }
3534
+ { clientAddress: _optionalChain([req, 'access', _266 => _266.socket, 'optionalAccess', _267 => _267.remoteAddress]) }
3451
3535
  );
3452
3536
  if (!result) {
3453
3537
  throw new Error(`Matched integration route did not return a response`);
@@ -3455,7 +3539,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3455
3539
  return result;
3456
3540
  } catch (error) {
3457
3541
  _chunkQMNWKQL4cjs.logger.error(`Integration route error: ${error}`);
3458
- await _optionalChain([runtime, 'optionalAccess', _260 => _260.reportError, 'call', _261 => _261(error)]);
3542
+ await _optionalChain([runtime, 'optionalAccess', _268 => _268.reportError, 'call', _269 => _269(error)]);
3459
3543
  return _chunkXGTFLG73cjs.createFarmInternalServerErrorResponse.call(void 0, );
3460
3544
  }
3461
3545
  };
@@ -3509,7 +3593,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3509
3593
  _chunkJX5VOLAVcjs.matchIntegrationRoute.call(void 0, configuredIntegrations, {
3510
3594
  pathname: requestPathname,
3511
3595
  method: requestMethod
3512
- }) || routeManager3.matchRedirect(requestPathname) || apiRouteManager.matchRoute(requestPathname) || farmDocsAPIHandler && _optionalChain([farmDocsDevRuntime, 'optionalAccess', _262 => _262.isFarmDocsAPIRequest, 'call', _263 => _263(requestPathname)]) || routeManager3.matchRoute(requestPathname).route || routeManager3.matchMetadataRoute(requestPathname) || routeManager3.matchMetadataImage(requestPathname)
3596
+ }) || routeManager3.matchRedirect(requestPathname) || apiRouteManager.matchRoute(requestPathname) || farmDocsAPIHandler && _optionalChain([farmDocsDevRuntime, 'optionalAccess', _270 => _270.isFarmDocsAPIRequest, 'call', _271 => _271(requestPathname)]) || routeManager3.matchRoute(requestPathname).route || routeManager3.matchMetadataRoute(requestPathname) || routeManager3.matchMetadataImage(requestPathname)
3513
3597
  );
3514
3598
  };
3515
3599
  try {
@@ -3541,13 +3625,6 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3541
3625
  if (await tryConfiguredIntegrationRoute()) {
3542
3626
  return;
3543
3627
  }
3544
- const redirectMatch = farmApp.getRouteManager().matchRedirect(requestPathname, parsedRequestUrl.search);
3545
- if (redirectMatch) {
3546
- res.statusCode = redirectMatch.statusCode;
3547
- res.setHeader("Location", redirectMatch.destination);
3548
- res.end(`Redirecting to ${redirectMatch.destination}`);
3549
- return;
3550
- }
3551
3628
  const matchedApiRoute = apiRouteManager.matchRoute(requestPathname);
3552
3629
  const hasMatchedApiRoute = Boolean(matchedApiRoute);
3553
3630
  if (hasMatchedApiRoute || _chunkXGTFLG73cjs.isFarmAPIPathname.call(void 0, requestPathname, apiServerBasePath)) {
@@ -3601,15 +3678,15 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3601
3678
  });
3602
3679
  };
3603
3680
  const isDocsAPIRequest = Boolean(
3604
- farmDocsAPIHandler && _optionalChain([farmDocsDevRuntime, 'optionalAccess', _264 => _264.isFarmDocsAPIRequest, 'call', _265 => _265(pathname2)])
3681
+ farmDocsAPIHandler && _optionalChain([farmDocsDevRuntime, 'optionalAccess', _272 => _272.isFarmDocsAPIRequest, 'call', _273 => _273(pathname2)])
3605
3682
  );
3606
3683
  const docsRuntimeOptions = () => ({
3607
3684
  kind: "docs",
3608
- route: _chunkK4UGCUXXcjs.setFarmRouteLabel.call(void 0,
3685
+ route: _chunkFSSONJRVcjs.setFarmRouteLabel.call(void 0,
3609
3686
  { pathname: pathname2, pattern: urlPath2 },
3610
- _chunkK4UGCUXXcjs.resolveFarmDocsRouteLabel.call(void 0, pathname2, {
3611
- path: _optionalChain([farmConfig, 'access', _266 => _266.docs, 'optionalAccess', _267 => _267.entry]) || "/docs",
3612
- roots: _optionalChain([farmConfig, 'access', _268 => _268.docs, 'optionalAccess', _269 => _269.roots, 'optionalAccess', _270 => _270.map, 'call', _271 => _271((root) => root.entry)])
3687
+ _chunkFSSONJRVcjs.resolveFarmDocsRouteLabel.call(void 0, pathname2, {
3688
+ path: _optionalChain([farmConfig, 'access', _274 => _274.docs, 'optionalAccess', _275 => _275.entry]) || "/docs",
3689
+ roots: _optionalChain([farmConfig, 'access', _276 => _276.docs, 'optionalAccess', _277 => _277.roots, 'optionalAccess', _278 => _278.map, 'call', _279 => _279((root) => root.entry)])
3613
3690
  })
3614
3691
  )
3615
3692
  });
@@ -3691,7 +3768,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3691
3768
  const routedApiRoute = rewritten ? apiRouteManager.matchRoute(routedPathname) : matchedApiRoute || apiRouteManager.matchRoute(pathname2);
3692
3769
  const hasExplicitAPIRoute = Boolean(routedApiRoute);
3693
3770
  if (apiHandler && hasExplicitAPIRoute) {
3694
- const apiRoutePattern = _optionalChain([routedApiRoute, 'optionalAccess', _272 => _272.route, 'access', _273 => _273.path]) || urlPath2;
3771
+ const apiRoutePattern = _optionalChain([routedApiRoute, 'optionalAccess', _280 => _280.route, 'access', _281 => _281.path]) || urlPath2;
3695
3772
  _chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
3696
3773
  type: "route.matched",
3697
3774
  pathname: pathname2,
@@ -3741,7 +3818,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3741
3818
  error
3742
3819
  });
3743
3820
  _chunkQMNWKQL4cjs.logger.error(`API route error: ${error}`);
3744
- await _optionalChain([runtime, 'optionalAccess', _274 => _274.reportError, 'call', _275 => _275(error)]);
3821
+ await _optionalChain([runtime, 'optionalAccess', _282 => _282.reportError, 'call', _283 => _283(error)]);
3745
3822
  response = _chunkXGTFLG73cjs.createFarmInternalServerErrorResponse.call(void 0, );
3746
3823
  }
3747
3824
  return pm ? await pm.runHookSerial("afterApiHandler", response, apiLifecyclePayload) : response;
@@ -3846,12 +3923,12 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3846
3923
  }
3847
3924
  return;
3848
3925
  }
3849
- if (_optionalChain([req, 'access', _276 => _276.url, 'optionalAccess', _277 => _277.startsWith, 'call', _278 => _278("/@")]) || _optionalChain([req, 'access', _279 => _279.url, 'optionalAccess', _280 => _280.startsWith, 'call', _281 => _281("/node_modules")])) {
3926
+ if (_optionalChain([req, 'access', _284 => _284.url, 'optionalAccess', _285 => _285.startsWith, 'call', _286 => _286("/@")]) || _optionalChain([req, 'access', _287 => _287.url, 'optionalAccess', _288 => _288.startsWith, 'call', _289 => _289("/node_modules")])) {
3850
3927
  return next();
3851
3928
  }
3852
3929
  if (!deferredDottedRequests.has(req) && shouldBypassFarmRouterForDottedPath(
3853
3930
  requestPathname,
3854
- _optionalChain([farmApp, 'optionalAccess', _282 => _282.getRouteManager, 'call', _283 => _283()]),
3931
+ _optionalChain([farmApp, 'optionalAccess', _290 => _290.getRouteManager, 'call', _291 => _291()]),
3855
3932
  [server.config.publicDir, server.config.root],
3856
3933
  farmAgentGeneratedPaths(farmConfig),
3857
3934
  requestMethod
@@ -3859,7 +3936,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3859
3936
  if (!viteModuleRequest) deferredDottedRequests.set(req, requestUrl);
3860
3937
  return next();
3861
3938
  }
3862
- if (_optionalChain([req, 'access', _284 => _284.url, 'optionalAccess', _285 => _285.startsWith, 'call', _286 => _286("/__farm/page-data")])) {
3939
+ if (_optionalChain([req, 'access', _292 => _292.url, 'optionalAccess', _293 => _293.startsWith, 'call', _294 => _294("/__farm/page-data")])) {
3863
3940
  const urlObj = parsedRequestUrl;
3864
3941
  const targetPath = urlObj.searchParams.get("path") || "/";
3865
3942
  let renderedRequest;
@@ -3889,7 +3966,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3889
3966
  renderedRequest = targetRequest;
3890
3967
  let middlewareMap = /* @__PURE__ */ new Map();
3891
3968
  let middlewareContext = /* @__PURE__ */ new Map();
3892
- if (_optionalChain([middlewareManager, 'optionalAccess', _287 => _287.hasMiddleware, 'call', _288 => _288()])) {
3969
+ if (_optionalChain([middlewareManager, 'optionalAccess', _295 => _295.hasMiddleware, 'call', _296 => _296()])) {
3893
3970
  const targetNodeRequest = createPageDataMiddlewareRequest(req, targetRequestUrl);
3894
3971
  const targetNodeResponse = createPageDataMiddlewareResponse(res);
3895
3972
  const handled = await runFarmMiddlewareWithNavigation(
@@ -3923,10 +4000,10 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3923
4000
  if (pm) {
3924
4001
  await pm.runHookParallel("afterRouteMatch", {
3925
4002
  pathname: targetPath,
3926
- matched: !!_optionalChain([match, 'optionalAccess', _289 => _289.route]),
3927
- routePattern: _optionalChain([match, 'optionalAccess', _290 => _290.route, 'optionalAccess', _291 => _291.pattern]) || null,
3928
- params: _optionalChain([match, 'optionalAccess', _292 => _292.params]) || {},
3929
- layoutPatterns: (_optionalChain([match, 'optionalAccess', _293 => _293.layouts]) || []).map((l) => l.pattern)
4003
+ matched: !!_optionalChain([match, 'optionalAccess', _297 => _297.route]),
4004
+ routePattern: _optionalChain([match, 'optionalAccess', _298 => _298.route, 'optionalAccess', _299 => _299.pattern]) || null,
4005
+ params: _optionalChain([match, 'optionalAccess', _300 => _300.params]) || {},
4006
+ layoutPatterns: (_optionalChain([match, 'optionalAccess', _301 => _301.layouts]) || []).map((l) => l.pattern)
3930
4007
  });
3931
4008
  }
3932
4009
  if (!match) {
@@ -3949,7 +4026,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3949
4026
  );
3950
4027
  const loadingModule = loadingBoundary ? await routeManager3.loadRouteModule(loadingBoundary.modulePath) : null;
3951
4028
  const navigationManifest = routeManager3.generateClientManifest(server.config.root);
3952
- const moduleMetadata = _nullishCoalesce(navigationManifest.routes.find((entry) => entry.pattern === route.pattern), () => ( _chunkIEN2EFE5cjs.getClientModuleMetadata.call(void 0, route.modulePath, server.config.root)));
4029
+ const moduleMetadata = _nullishCoalesce(navigationManifest.routes.find((entry) => entry.pattern === route.pattern), () => ( _chunkBE7AQXJBcjs.getClientModuleMetadata.call(void 0, route.modulePath, server.config.root)));
3953
4030
  const isClientComponent = moduleMetadata.isClientComponent;
3954
4031
  const shouldHydrate = moduleMetadata.shouldHydrate;
3955
4032
  let mergedMetadata = {};
@@ -3957,7 +4034,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3957
4034
  layouts.map((layout) => routeManager3.loadLayoutModule(layout.modulePath))
3958
4035
  );
3959
4036
  const layoutHydrationMetadata = layouts.map(
3960
- (layout) => _nullishCoalesce(navigationManifest.layouts.find((entry) => entry.pattern === layout.pattern), () => ( _chunkIEN2EFE5cjs.getClientModuleMetadata.call(void 0, layout.modulePath, server.config.root)))
4037
+ (layout) => _nullishCoalesce(navigationManifest.layouts.find((entry) => entry.pattern === layout.pattern), () => ( _chunkBE7AQXJBcjs.getClientModuleMetadata.call(void 0, layout.modulePath, server.config.root)))
3961
4038
  );
3962
4039
  const shouldHydrateLayout = layoutHydrationMetadata.some(
3963
4040
  (metadata) => metadata.shouldHydrate
@@ -3969,17 +4046,17 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3969
4046
  )
3970
4047
  ];
3971
4048
  const hydrationIslandStrategy = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0,
3972
- _optionalChain([(_nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _294 => _294.getConfig, 'call', _295 => _295()]), () => ( options))), 'access', _296 => _296.experimental, 'optionalAccess', _297 => _297.serverComponents])
3973
- ) === "islands" ? _chunkM6U6E4F7cjs.resolveFarmRouteRootStrategy.call(void 0,
4049
+ _optionalChain([(_nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _302 => _302.getConfig, 'call', _303 => _303()]), () => ( options))), 'access', _304 => _304.experimental, 'optionalAccess', _305 => _305.serverComponents])
4050
+ ) === "islands" ? _chunkCBLRSZQLcjs.resolveFarmRouteRootStrategy.call(void 0,
3974
4051
  route,
3975
4052
  { shouldHydrate, islandStrategy: _nullishCoalesce(moduleMetadata.islandStrategy, () => ( null)) },
3976
4053
  layouts.map((layout, index) => ({
3977
4054
  pattern: layout.pattern,
3978
4055
  modulePath: layout.modulePath,
3979
- shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access', _298 => _298[index], 'optionalAccess', _299 => _299.shouldHydrate]) === true,
4056
+ shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access', _306 => _306[index], 'optionalAccess', _307 => _307.shouldHydrate]) === true,
3980
4057
  // Manifest entries carry it; metadata read from source does not.
3981
- hasIsolatedClientBoundaries: _optionalChain([layoutHydrationMetadata, 'access', _300 => _300[index], 'optionalAccess', _301 => _301.hasIsolatedClientBoundaries]) === true,
3982
- islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access', _302 => _302[index], 'optionalAccess', _303 => _303.islandStrategy]), () => ( null))
4058
+ hasIsolatedClientBoundaries: _optionalChain([layoutHydrationMetadata, 'access', _308 => _308[index], 'optionalAccess', _309 => _309.hasIsolatedClientBoundaries]) === true,
4059
+ islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access', _310 => _310[index], 'optionalAccess', _311 => _311.islandStrategy]), () => ( null))
3983
4060
  })),
3984
4061
  server.config.root,
3985
4062
  true
@@ -4036,7 +4113,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4036
4113
  const slotModule = await routeManager3.loadRouteModule(slot.route.modulePath);
4037
4114
  const slotMetadata = _nullishCoalesce(navigationManifest.slots.find(
4038
4115
  (entry) => entry.name === slot.name && entry.ownerPattern === slot.ownerPattern && entry.pattern === slot.route.pattern
4039
- ), () => ( _chunkIEN2EFE5cjs.getClientModuleMetadata.call(void 0, slot.route.modulePath, server.config.root)));
4116
+ ), () => ( _chunkBE7AQXJBcjs.getClientModuleMetadata.call(void 0, slot.route.modulePath, server.config.root)));
4040
4117
  const slotContext = await _chunkX333W5KVcjs.resolveFarmRouteContext.call(void 0, farmApp.getConfig(), {
4041
4118
  request: targetRequest,
4042
4119
  params: slot.params,
@@ -4082,15 +4159,15 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4082
4159
  );
4083
4160
  const projectRoot = server.config.root;
4084
4161
  const toUrlPath = (absolutePath) => _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, absolutePath, projectRoot);
4085
- const renderPlan = _chunk2MR4MABGcjs.createFarmRouteRenderPlan.call(void 0, {
4162
+ const renderPlan = _chunkC5AM2XDNcjs.createFarmRouteRenderPlan.call(void 0, {
4086
4163
  pageShouldHydrate: shouldHydrate,
4087
4164
  layoutShouldHydrate: shouldHydrateLayout,
4088
4165
  islandStrategy: hydrationIslandStrategy,
4089
- rendering: _chunkK7JMTAFHcjs.resolveRouteRenderingConfig.call(void 0, routeModule)
4166
+ rendering: _chunkE3LE6EZHcjs.resolveRouteRenderingConfig.call(void 0, routeModule)
4090
4167
  });
4091
4168
  const destinationLayoutPatterns = layouts.map((layout) => layout.pattern);
4092
- const layoutStartIndex = _chunk2MR4MABGcjs.getSharedLayoutPrefixLength.call(void 0,
4093
- _chunk2MR4MABGcjs.parseFarmLayoutChainHeader.call(void 0, request.headers.get("x-farm-layout-chain")),
4169
+ const layoutStartIndex = _chunkC5AM2XDNcjs.getSharedLayoutPrefixLength.call(void 0,
4170
+ _chunkC5AM2XDNcjs.parseFarmLayoutChainHeader.call(void 0, request.headers.get("x-farm-layout-chain")),
4094
4171
  destinationLayoutPatterns
4095
4172
  );
4096
4173
  const renderer = farmApp.getServerRenderer();
@@ -4100,7 +4177,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4100
4177
  middlewareContext,
4101
4178
  () => renderer.renderNavigationFragment({
4102
4179
  PageComponent: routeModule.default,
4103
- LoadingComponent: _optionalChain([loadingModule, 'optionalAccess', _304 => _304.default]),
4180
+ LoadingComponent: _optionalChain([loadingModule, 'optionalAccess', _312 => _312.default]),
4104
4181
  pageProps: routeProps,
4105
4182
  params,
4106
4183
  layouts: layouts.map((layout, index) => ({
@@ -4162,7 +4239,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4162
4239
  from: interceptFromHeader,
4163
4240
  slots: routeSlots.filter((slot) => slot.interception).map((slot) => slot.name)
4164
4241
  } : void 0,
4165
- i18n: _chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0, )
4242
+ i18n: _chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0, )
4166
4243
  };
4167
4244
  await _chunkJRGR5Z4Kcjs.sendWebResponse.call(void 0,
4168
4245
  res,
@@ -4171,7 +4248,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4171
4248
  {
4172
4249
  status: 200,
4173
4250
  headers: {
4174
- "Cache-Control": _chunk2MR4MABGcjs.getFarmFragmentCacheControl.call(void 0, renderPlan),
4251
+ "Cache-Control": _chunkC5AM2XDNcjs.getFarmFragmentCacheControl.call(void 0, renderPlan),
4175
4252
  "X-Farm-Navigation": "html-fragment",
4176
4253
  Vary: "X-Farm-Layout-Chain",
4177
4254
  [_chunkNLBHLPEOcjs.FARM_DEPLOYMENT_ID_HEADER]: farmConfig.deploymentId
@@ -4213,47 +4290,49 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4213
4290
  trustProxy: currentServerConfig.trustProxy
4214
4291
  }).pathname;
4215
4292
  const routeManager2 = farmApp.getRouteManager();
4216
- const hasBeforeRequestHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _305 => _305.hasHook, 'call', _306 => _306("beforeRequest")]), () => ( false));
4217
- const hasAfterResponseHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _307 => _307.hasHook, 'call', _308 => _308("afterResponse")]), () => ( false));
4218
- const hasHTMLTransformHook = (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _309 => _309.hasHook, 'call', _310 => _310("transformHTML")]), () => ( false))) || (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _311 => _311.hasHook, 'call', _312 => _312("afterRender")]), () => ( false)));
4293
+ const hasBeforeRequestHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _313 => _313.hasHook, 'call', _314 => _314("beforeRequest")]), () => ( false));
4294
+ const hasAfterResponseHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _315 => _315.hasHook, 'call', _316 => _316("afterResponse")]), () => ( false));
4295
+ const hasHTMLTransformHook = (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _317 => _317.hasHook, 'call', _318 => _318("transformHTML")]), () => ( false))) || (_nullishCoalesce(_optionalChain([pm, 'optionalAccess', _319 => _319.hasHook, 'call', _320 => _320("afterRender")]), () => ( false)));
4219
4296
  const opensRuntimeSession = pm ? opensFarmDevRuntimeSession(pm) : false;
4220
- const hasRuntimeAfterHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _313 => _313.hasRuntimeHook, 'call', _314 => _314("after")]), () => ( false));
4221
- const requestedMatch = routeManager2.matchRoute(requestedPathname);
4297
+ const hasRuntimeAfterHook = _nullishCoalesce(_optionalChain([pm, 'optionalAccess', _321 => _321.hasRuntimeHook, 'call', _322 => _322("after")]), () => ( false));
4222
4298
  const pageBuiltInRouteLabel = (pathname2) => {
4223
4299
  const routePathname = _chunkD22BUQKWcjs.stripFarmBasePath.call(void 0, pathname2, farmConfig.basePath);
4224
- const mcpLabel = _chunkK4UGCUXXcjs.resolveFarmMCPRouteLabel.call(void 0, routePathname, apiServerBasePath);
4300
+ const mcpLabel = _chunkFSSONJRVcjs.resolveFarmMCPRouteLabel.call(void 0, routePathname, apiServerBasePath);
4225
4301
  if (mcpLabel) return mcpLabel;
4226
4302
  if (farmAgentGeneratedPaths(farmConfig).includes(routePathname)) return routePathname;
4227
- return routePathname === _chunkVG6HYT5Kcjs.FARM_DEFAULT_MCP_PATH && farmApp.getServerRenderer().getDefaultMCPServer() ? _chunkVG6HYT5Kcjs.FARM_DEFAULT_MCP_PATH : null;
4303
+ return routePathname === _chunkTP4RAV7Ycjs.FARM_DEFAULT_MCP_PATH && farmApp.getServerRenderer().getDefaultMCPServer() ? _chunkTP4RAV7Ycjs.FARM_DEFAULT_MCP_PATH : null;
4304
+ };
4305
+ const pageRuntimeOptions = (pathname2) => {
4306
+ const match = routeManager2.matchRoute(pathname2);
4307
+ return {
4308
+ kind: "page",
4309
+ route: _chunkFSSONJRVcjs.setFarmRouteLabel.call(void 0,
4310
+ {
4311
+ pathname: pathname2,
4312
+ pattern: _optionalChain([match, 'optionalAccess', _323 => _323.route, 'optionalAccess', _324 => _324.pattern]) || null,
4313
+ params: _optionalChain([match, 'optionalAccess', _325 => _325.params]) || {}
4314
+ },
4315
+ _optionalChain([match, 'optionalAccess', _326 => _326.route]) ? null : pageBuiltInRouteLabel(pathname2)
4316
+ )
4317
+ };
4228
4318
  };
4229
4319
  let runtimeSession;
4230
4320
  let pathname = requestedPathname;
4231
- let pageHookPathname = requestedPagePathname;
4232
4321
  if (pm && opensRuntimeSession) {
4233
4322
  try {
4234
- const sessionOptions = {
4235
- kind: "page",
4236
- route: _chunkK4UGCUXXcjs.setFarmRouteLabel.call(void 0,
4237
- {
4238
- pathname: requestedPathname,
4239
- pattern: _optionalChain([requestedMatch, 'optionalAccess', _315 => _315.route, 'optionalAccess', _316 => _316.pattern]) || null,
4240
- params: _optionalChain([requestedMatch, 'optionalAccess', _317 => _317.params]) || {}
4241
- },
4242
- _optionalChain([requestedMatch, 'optionalAccess', _318 => _318.route]) ? null : pageBuiltInRouteLabel(requestedPathname)
4243
- )
4244
- };
4323
+ const metadataRoute = configRewriteSource === void 0 ? matchAppMetadataRoute(requestedPathname) : null;
4324
+ const sessionOptions = metadataRoute ? { kind: "asset", route: { pathname: requestedPathname, ...metadataRoute } } : pageRuntimeOptions(
4325
+ configRewriteSource === void 0 ? requestedPathname : requestedPagePathname
4326
+ );
4245
4327
  runtimeSession = await pm.beginRuntimeRequest(
4246
4328
  createRequestFromNodeRequest(req, new URL(_nullishCoalesce(configRewriteSource, () => ( fullUrl)))),
4247
4329
  sessionOptions
4248
4330
  );
4249
- if (!runtimeSession.response) {
4250
- pageHookPathname = configRewriteSource === void 0 ? new URL(runtimeSession.request.url).pathname : requestedPagePathname;
4251
- await runFarmDevPageHooks(pageHookPathname);
4252
- }
4331
+ if (!runtimeSession.response) await runFarmDevPageHooks();
4253
4332
  const routedRequest = await _asyncNullishCoalesce(runtimeSession.response, async () => ( (configRewriteSource === void 0 ? runtimeSession.request : await pm.runRuntimeBeforeForRewrite(
4254
4333
  runtimeSession.request,
4255
4334
  createRequestFromNodeRequest(req, new URL(fullUrl)),
4256
- sessionOptions
4335
+ pageRuntimeOptions(requestedPathname)
4257
4336
  ))));
4258
4337
  if (routedRequest instanceof Response) {
4259
4338
  const response = await pm.endRuntimeRequest(runtimeSession, routedRequest);
@@ -4284,7 +4363,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4284
4363
  };
4285
4364
  if (!runtimeSession) {
4286
4365
  try {
4287
- await runFarmDevPageHooks(pageHookPathname);
4366
+ await runFarmDevPageHooks();
4288
4367
  } catch (error) {
4289
4368
  await failPageHook(error);
4290
4369
  return;
@@ -4302,7 +4381,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4302
4381
  hasAfterResponseHook,
4303
4382
  hasHTMLTransformHook,
4304
4383
  // render.html gets the render info render.before got.
4305
- renderPayload: pageHookRoute(pageHookPathname).render,
4384
+ renderPayload: pageHookRoute().render,
4306
4385
  method,
4307
4386
  urlPath,
4308
4387
  pathname,
@@ -4313,7 +4392,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4313
4392
  }) : void 0;
4314
4393
  let middlewareFailed = false;
4315
4394
  try {
4316
- if (_optionalChain([middlewareManager, 'optionalAccess', _319 => _319.hasMiddleware, 'call', _320 => _320()])) {
4395
+ if (_optionalChain([middlewareManager, 'optionalAccess', _327 => _327.hasMiddleware, 'call', _328 => _328()])) {
4317
4396
  const middlewareRequest = createRequestFromNodeRequest(req, new URL(fullUrl));
4318
4397
  const handled = await runFarmMiddlewareWithNavigation(
4319
4398
  farmApp.getServerRenderer(),
@@ -4326,7 +4405,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4326
4405
  throw error;
4327
4406
  });
4328
4407
  if (handled) {
4329
- if (!_optionalChain([responseInterceptor, 'optionalAccess', _321 => _321.isEnded, 'call', _322 => _322()])) {
4408
+ if (!_optionalChain([responseInterceptor, 'optionalAccess', _329 => _329.isEnded, 'call', _330 => _330()])) {
4330
4409
  const duration = Date.now() - startTime;
4331
4410
  logResponse(method, urlPath, res.statusCode || 200, duration, "PAGE");
4332
4411
  }
@@ -4341,8 +4420,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4341
4420
  res
4342
4421
  );
4343
4422
  }
4344
- if (res.writableEnded || _optionalChain([responseInterceptor, 'optionalAccess', _323 => _323.isEnded, 'call', _324 => _324()])) {
4345
- if (!_optionalChain([responseInterceptor, 'optionalAccess', _325 => _325.isEnded, 'call', _326 => _326()])) {
4423
+ if (res.writableEnded || _optionalChain([responseInterceptor, 'optionalAccess', _331 => _331.isEnded, 'call', _332 => _332()])) {
4424
+ if (!_optionalChain([responseInterceptor, 'optionalAccess', _333 => _333.isEnded, 'call', _334 => _334()])) {
4346
4425
  const duration = Date.now() - startTime;
4347
4426
  logResponse(method, urlPath, res.statusCode || 200, duration, "PAGE");
4348
4427
  }
@@ -4361,8 +4440,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4361
4440
  await pm.reportRuntimeRequestError(runtimeSession, error);
4362
4441
  } else {
4363
4442
  await pm.failRuntimeRequest(runtimeSession, error);
4364
- if (!res.headersSent && !_optionalChain([responseInterceptor, 'optionalAccess', _327 => _327.isEnded, 'call', _328 => _328()])) {
4365
- _optionalChain([responseInterceptor, 'optionalAccess', _329 => _329.release, 'call', _330 => _330()]);
4443
+ if (!res.headersSent && !_optionalChain([responseInterceptor, 'optionalAccess', _335 => _335.isEnded, 'call', _336 => _336()])) {
4444
+ _optionalChain([responseInterceptor, 'optionalAccess', _337 => _337.release, 'call', _338 => _338()]);
4366
4445
  console.error("[FARM] Page error:", error);
4367
4446
  sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
4368
4447
  return;
@@ -4379,7 +4458,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4379
4458
  }
4380
4459
  })
4381
4460
  );
4382
- const farmRequestMiddleware = _optionalChain([farmMiddlewares, 'access', _331 => _331.stack, 'access', _332 => _332.at, 'call', _333 => _333(-1), 'optionalAccess', _334 => _334.handle]);
4461
+ const farmRequestMiddleware = _optionalChain([farmMiddlewares, 'access', _339 => _339.stack, 'access', _340 => _340.at, 'call', _341 => _341(-1), 'optionalAccess', _342 => _342.handle]);
4383
4462
  if (farmOwnsDevCors && viteServer.config.server.cors === false) {
4384
4463
  farmMiddlewares.use(createFarmDevViteCorsMiddleware());
4385
4464
  }
@@ -4401,15 +4480,18 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4401
4480
  };
4402
4481
  },
4403
4482
  async resolveId(id, importer, resolveOptions) {
4404
- if (id.startsWith("@farm.js/core/internal/") && importer) {
4405
- const root = _optionalChain([farmApp, 'optionalAccess', _335 => _335.getConfig, 'call', _336 => _336(), 'access', _337 => _337.root]) || _optionalChain([server, 'optionalAccess', _338 => _338.config, 'access', _339 => _339.root]) || options.root;
4406
- const relative4 = root ? path6.relative(root, importer.split("?", 1)[0]) : "";
4407
- if (root && (relative4.startsWith("..") || path6.isAbsolute(relative4))) {
4408
- return this.resolve(id, path6.join(root, "package.json"), {
4409
- ...resolveOptions,
4410
- skipSelf: true
4411
- });
4412
- }
4483
+ if (id.startsWith(FARM_RUNTIME_MODULE_PREFIX)) {
4484
+ return this.resolve(id.slice(FARM_RUNTIME_MODULE_PREFIX.length), getFarmCoreFile(), {
4485
+ ...resolveOptions,
4486
+ skipSelf: true
4487
+ });
4488
+ }
4489
+ if (id.startsWith("@farm.js/core/internal/") && importer && isOutsideAppRoot(importer)) {
4490
+ const root = _optionalChain([farmApp, 'optionalAccess', _343 => _343.getConfig, 'call', _344 => _344(), 'access', _345 => _345.root]) || _optionalChain([server, 'optionalAccess', _346 => _346.config, 'access', _347 => _347.root]) || options.root;
4491
+ return this.resolve(id, path6.join(root, "package.json"), {
4492
+ ...resolveOptions,
4493
+ skipSelf: true
4494
+ });
4413
4495
  }
4414
4496
  if (typeof fontImports.resolveId === "function") {
4415
4497
  const fontId = await fontImports.resolveId.call(this, id, importer, resolveOptions);
@@ -4433,7 +4515,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4433
4515
  }
4434
4516
  },
4435
4517
  async load(id, loadOptions) {
4436
- if (pendingClientSetup && !_optionalChain([loadOptions, 'optionalAccess', _340 => _340.ssr]) && !farmSetupContext.getStore()) {
4518
+ if (pendingClientSetup && !_optionalChain([loadOptions, 'optionalAccess', _348 => _348.ssr]) && !farmSetupContext.getStore()) {
4437
4519
  await pendingClientSetup;
4438
4520
  }
4439
4521
  if (_chunkPIUTGRDIcjs.isFarmServerFnBoundaryId.call(void 0, id) && islandsServerFns()) {
@@ -4451,8 +4533,8 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4451
4533
  if (imageModule) return imageModule;
4452
4534
  }
4453
4535
  if (_chunkE7QOEV5Zcjs.parseProgrammaticRouteModuleId.call(void 0, id)) {
4454
- const renderer = _optionalChain([farmApp, 'optionalAccess', _341 => _341.getConfig, 'call', _342 => _342(), 'access', _343 => _343.renderer]) || _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, options.renderer);
4455
- const root = _optionalChain([server, 'optionalAccess', _344 => _344.config, 'access', _345 => _345.root]) || options.root;
4536
+ const renderer = _optionalChain([farmApp, 'optionalAccess', _349 => _349.getConfig, 'call', _350 => _350(), 'access', _351 => _351.renderer]) || _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, options.renderer);
4537
+ const root = _optionalChain([server, 'optionalAccess', _352 => _352.config, 'access', _353 => _353.root]) || options.root;
4456
4538
  if (isClientEnvironment(this, loadOptions)) {
4457
4539
  return generateProgrammaticClientRouteModuleForId(
4458
4540
  id,
@@ -4468,21 +4550,21 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4468
4550
  return FARM_DEV_CLIENT_BOOT_MODULE;
4469
4551
  }
4470
4552
  if (isFarmClientVirtualId(id)) {
4471
- const resolvedConfig = _optionalChain([farmApp, 'optionalAccess', _346 => _346.getConfig, 'call', _347 => _347()]);
4472
- const renderer = _optionalChain([resolvedConfig, 'optionalAccess', _348 => _348.renderer]) || _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, options.renderer);
4473
- const integrations = _optionalChain([resolvedConfig, 'optionalAccess', _349 => _349.integrations]) || options.integrations;
4474
- const root = _optionalChain([resolvedConfig, 'optionalAccess', _350 => _350.root]) || _optionalChain([server, 'optionalAccess', _351 => _351.config, 'access', _352 => _352.root]) || process.cwd();
4475
- const docs = _optionalChain([resolvedConfig, 'optionalAccess', _353 => _353.docs]);
4553
+ const resolvedConfig = _optionalChain([farmApp, 'optionalAccess', _354 => _354.getConfig, 'call', _355 => _355()]);
4554
+ const renderer = _optionalChain([resolvedConfig, 'optionalAccess', _356 => _356.renderer]) || _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, options.renderer);
4555
+ const integrations = _optionalChain([resolvedConfig, 'optionalAccess', _357 => _357.integrations]) || options.integrations;
4556
+ const root = _optionalChain([resolvedConfig, 'optionalAccess', _358 => _358.root]) || _optionalChain([server, 'optionalAccess', _359 => _359.config, 'access', _360 => _360.root]) || process.cwd();
4557
+ const docs = _optionalChain([resolvedConfig, 'optionalAccess', _361 => _361.docs]);
4476
4558
  const adapterOwnsDocsRuntime = Boolean(
4477
- _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([docs, 'optionalAccess', _354 => _354.adapter, 'optionalAccess', _355 => _355.server]) && docs.adapter.react
4559
+ _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([docs, 'optionalAccess', _362 => _362.adapter, 'optionalAccess', _363 => _363.server]) && docs.adapter.react
4478
4560
  );
4479
- const devtools = _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _356 => _356.devtools]), () => ( _chunkSTF6VDYQcjs.resolveFarmDevtoolsConfig.call(void 0, false, "production")));
4561
+ const devtools = _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _364 => _364.devtools]), () => ( _chunkSTF6VDYQcjs.resolveFarmDevtoolsConfig.call(void 0, false, "production")));
4480
4562
  const [docsRuntime, docsSearchRuntime, devtoolsClientRuntime] = await Promise.all([
4481
- _optionalChain([docs, 'optionalAccess', _357 => _357.enabled]) ? loadFarmDocsDevRuntime() : null,
4482
- _optionalChain([docs, 'optionalAccess', _358 => _358.enabled]) && !adapterOwnsDocsRuntime ? loadFarmDocsSearchDevRuntime() : null,
4563
+ _optionalChain([docs, 'optionalAccess', _365 => _365.enabled]) ? loadFarmDocsDevRuntime() : null,
4564
+ _optionalChain([docs, 'optionalAccess', _366 => _366.enabled]) && !adapterOwnsDocsRuntime ? loadFarmDocsSearchDevRuntime() : null,
4483
4565
  devtools.enabled ? loadFarmDevtoolsClientRuntime() : null
4484
4566
  ]);
4485
- const docsSearchEnabled = _nullishCoalesce(_optionalChain([docsSearchRuntime, 'optionalAccess', _359 => _359.isFarmDocsSearchEnabled, 'call', _360 => _360(docs)]), () => ( false));
4567
+ const docsSearchEnabled = _nullishCoalesce(_optionalChain([docsSearchRuntime, 'optionalAccess', _367 => _367.isFarmDocsSearchEnabled, 'call', _368 => _368(docs)]), () => ( false));
4486
4568
  const generatedDocsSearchRuntime = docsSearchRuntime ? docsSearchRuntime.generateFarmDocsSearchClientRuntime(
4487
4569
  docsSearchEnabled,
4488
4570
  docsSearchEnabled ? docsSearchRuntime.resolveFarmDocsSearchClientModule(root) : void 0
@@ -4490,10 +4572,10 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4490
4572
  const generatedDevtoolsClientRuntime = devtoolsClientRuntime ? devtoolsClientRuntime.generateFarmDevtoolsClientRuntime(devtools) : "";
4491
4573
  const generatedDevIndicatorsClientRuntime = farmApp ? _chunkUVV3I5QAcjs.generateFarmDevIndicatorsClientRuntime.call(void 0, farmApp.getConfig().devIndicators) : "";
4492
4574
  const integrationProviders = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) ? _chunkJX5VOLAVcjs.getIntegrationProviders.call(void 0, integrations) : [];
4493
- const isolatedHydrationMode = _chunkIEN2EFE5cjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
4494
- _optionalChain([resolvedConfig, 'optionalAccess', _361 => _361.experimental, 'optionalAccess', _362 => _362.isolatedClientHydration]),
4575
+ const isolatedHydrationMode = _chunkBE7AQXJBcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
4576
+ _optionalChain([resolvedConfig, 'optionalAccess', _369 => _369.experimental, 'optionalAccess', _370 => _370.isolatedClientHydration]),
4495
4577
  {
4496
- serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([resolvedConfig, 'optionalAccess', _363 => _363.experimental, 'optionalAccess', _364 => _364.serverComponents])) === "rsc",
4578
+ serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([resolvedConfig, 'optionalAccess', _371 => _371.experimental, 'optionalAccess', _372 => _372.serverComponents])) === "rsc",
4497
4579
  hasUnsupportedIntegrationProvider: integrationProviders.filter((provider) => provider.component || provider.type === "clerk").some((provider) => provider.supportsIsolatedHydration !== true)
4498
4580
  }
4499
4581
  );
@@ -4501,32 +4583,32 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4501
4583
  integrationProviders,
4502
4584
  [
4503
4585
  ..._chunkJX5VOLAVcjs.getIntegrationDocumentNavigationMatchers.call(void 0, integrations),
4504
- ..._nullishCoalesce(_optionalChain([docsRuntime, 'optionalAccess', _365 => _365.getFarmDocsDocumentNavigationMatchers, 'call', _366 => _366(docs)]), () => ( []))
4586
+ ..._nullishCoalesce(_optionalChain([docsRuntime, 'optionalAccess', _373 => _373.getFarmDocsDocumentNavigationMatchers, 'call', _374 => _374(docs)]), () => ( []))
4505
4587
  ],
4506
4588
  generatedDocsSearchRuntime,
4507
4589
  `${generatedDevtoolsClientRuntime}
4508
4590
  ${generatedDevIndicatorsClientRuntime}`,
4509
- _optionalChain([resolvedConfig, 'optionalAccess', _367 => _367.plugins]) || [],
4591
+ _optionalChain([resolvedConfig, 'optionalAccess', _375 => _375.plugins]) || [],
4510
4592
  root,
4511
- _optionalChain([resolvedConfig, 'optionalAccess', _368 => _368.srcDir]) || options.srcDir || "src",
4512
- _optionalChain([resolvedConfig, 'optionalAccess', _369 => _369.publicRuntimeConfig]) || options.publicRuntimeConfig,
4513
- _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) ? _optionalChain([docs, 'optionalAccess', _370 => _370.adapter, 'optionalAccess', _371 => _371.react]) : void 0,
4593
+ _optionalChain([resolvedConfig, 'optionalAccess', _376 => _376.srcDir]) || options.srcDir || "src",
4594
+ _optionalChain([resolvedConfig, 'optionalAccess', _377 => _377.publicRuntimeConfig]) || options.publicRuntimeConfig,
4595
+ _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) ? _optionalChain([docs, 'optionalAccess', _378 => _378.adapter, 'optionalAccess', _379 => _379.react]) : void 0,
4514
4596
  renderer,
4515
- isolatedHydrationMode === "enabled" || _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([(_nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess', _372 => _372.getRouteManager, 'call', _373 => _373(), 'access', _374 => _374.getIsolatedClientBoundaryModules, 'call', _375 => _375(root)])))), 'optionalAccess', _376 => _376.size]) > 0,
4516
- _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _377 => _377.trailingSlash]), () => ( false)),
4517
- _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _378 => _378.basePath]), () => ( "/")),
4518
- _chunkM6U6E4F7cjs.generateClientCachePersistenceCode.call(void 0,
4519
- _chunkM6U6E4F7cjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, _optionalChain([resolvedConfig, 'optionalAccess', _379 => _379.cache]))
4597
+ isolatedHydrationMode === "enabled" || _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) && _optionalChain([(_nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess', _380 => _380.getRouteManager, 'call', _381 => _381(), 'access', _382 => _382.getIsolatedClientBoundaryModules, 'call', _383 => _383(root)])))), 'optionalAccess', _384 => _384.size]) > 0,
4598
+ _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _385 => _385.trailingSlash]), () => ( false)),
4599
+ _nullishCoalesce(_optionalChain([resolvedConfig, 'optionalAccess', _386 => _386.basePath]), () => ( "/")),
4600
+ _chunkCBLRSZQLcjs.generateClientCachePersistenceCode.call(void 0,
4601
+ _chunkCBLRSZQLcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, _optionalChain([resolvedConfig, 'optionalAccess', _387 => _387.cache]))
4520
4602
  ),
4521
4603
  _chunk67MZTLTFcjs.isReactRenderer.call(void 0, renderer) ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, docs) : void 0,
4522
- _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([resolvedConfig, 'optionalAccess', _380 => _380.experimental, 'optionalAccess', _381 => _381.serverComponents])) === "islands"
4604
+ _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([resolvedConfig, 'optionalAccess', _388 => _388.experimental, 'optionalAccess', _389 => _389.serverComponents])) === "islands"
4523
4605
  );
4524
4606
  }
4525
4607
  if (id === "/@farm/server") {
4526
4608
  return generateServerCode();
4527
4609
  }
4528
4610
  if (id === "/@farm/manifest") {
4529
- const routeManager = _optionalChain([farmApp, 'optionalAccess', _382 => _382.getRouteManager, 'call', _383 => _383()]);
4611
+ const routeManager = _optionalChain([farmApp, 'optionalAccess', _390 => _390.getRouteManager, 'call', _391 => _391()]);
4530
4612
  if (!routeManager) {
4531
4613
  return `
4532
4614
  export const getManifest = () => ({
@@ -4539,9 +4621,9 @@ export const getManifest = () => ({
4539
4621
  `;
4540
4622
  }
4541
4623
  const manifest = routeManager.generateClientManifest(server.config.root);
4542
- const globalStylesheetHref = _chunkM6U6E4F7cjs.resolveDevGlobalStylesheetHref.call(void 0,
4624
+ const globalStylesheetHref = _chunkCBLRSZQLcjs.resolveDevGlobalStylesheetHref.call(void 0,
4543
4625
  server.config.root,
4544
- _optionalChain([farmApp, 'optionalAccess', _384 => _384.getConfig, 'call', _385 => _385(), 'access', _386 => _386.srcDir])
4626
+ _optionalChain([farmApp, 'optionalAccess', _392 => _392.getConfig, 'call', _393 => _393(), 'access', _394 => _394.srcDir])
4545
4627
  );
4546
4628
  const fullManifest = {
4547
4629
  clientEntry: "/@farm/client.js",
@@ -4567,11 +4649,11 @@ export const getManifest = () => ({
4567
4649
  };
4568
4650
  }
4569
4651
  for (const layout of manifest.layouts) {
4570
- const groupScope = _chunk2MR4MABGcjs.getRouteGroupScope.call(void 0, layout.pattern);
4652
+ const groupScope = _chunkC5AM2XDNcjs.getRouteGroupScope.call(void 0, layout.pattern);
4571
4653
  fullManifest.layouts[layout.pattern] = {
4572
4654
  modulePath: layout.modulePath,
4573
4655
  pattern: layout.pattern,
4574
- ...groupScope ? { urlPattern: _chunk2MR4MABGcjs.stripRouteGroups.call(void 0, layout.pattern), groupScope } : {},
4656
+ ...groupScope ? { urlPattern: _chunkC5AM2XDNcjs.stripRouteGroups.call(void 0, layout.pattern), groupScope } : {},
4575
4657
  shouldHydrate: layout.shouldHydrate,
4576
4658
  islandStrategy: layout.islandStrategy,
4577
4659
  // Islands mode: rebuilt from its server tree, so its module is never preloaded.
@@ -4597,55 +4679,63 @@ export const manifest = getManifest();
4597
4679
  }
4598
4680
  },
4599
4681
  async transform(code, id, transformOptions) {
4600
- if (pendingClientSetup && !_optionalChain([transformOptions, 'optionalAccess', _387 => _387.ssr]) && !farmSetupContext.getStore()) {
4682
+ if (pendingClientSetup && !_optionalChain([transformOptions, 'optionalAccess', _395 => _395.ssr]) && !farmSetupContext.getStore()) {
4601
4683
  await pendingClientSetup;
4602
4684
  }
4603
- const actionConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _388 => _388.getConfig, 'call', _389 => _389()]), () => ( options));
4685
+ const runtimeModule = !isBuild && _optionalChain([transformOptions, 'optionalAccess', _396 => _396.ssr]) === true && isOutsideAppRoot(id) ? toFarmRuntimeModuleId : void 0;
4686
+ const actionConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _397 => _397.getConfig, 'call', _398 => _398()]), () => ( options));
4604
4687
  let rewrotePackageImports = false;
4605
- if (_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([actionConfig, 'access', _390 => _390.experimental, 'optionalAccess', _391 => _391.serverComponents])) === "islands" && (!id.includes("/node_modules/") || _optionalChain([transformOptions, 'optionalAccess', _392 => _392.ssr]) === true && farmReactServerFiles.has(id.split("?", 1)[0])) && !id.startsWith("\0") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id) && !_chunkIEN2EFE5cjs.hasUseClientDirective.call(void 0, code)) {
4688
+ if (_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([actionConfig, 'access', _399 => _399.experimental, 'optionalAccess', _400 => _400.serverComponents])) === "islands" && (!id.includes("/node_modules/") || _optionalChain([transformOptions, 'optionalAccess', _401 => _401.ssr]) === true && farmReactServerFiles.has(id.split("?", 1)[0])) && !id.startsWith("\0") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id) && !_chunkBE7AQXJBcjs.hasUseClientDirective.call(void 0, code)) {
4606
4689
  const file = id.split("?", 1)[0];
4607
- const projectRoot = actionConfig.root || _optionalChain([server, 'optionalAccess', _393 => _393.config, 'access', _394 => _394.root]) || process.cwd();
4608
- if (_optionalChain([transformOptions, 'optionalAccess', _395 => _395.ssr]) === true) {
4690
+ const projectRoot = actionConfig.root || _optionalChain([server, 'optionalAccess', _402 => _402.config, 'access', _403 => _403.root]) || process.cwd();
4691
+ if (_optionalChain([transformOptions, 'optionalAccess', _404 => _404.ssr]) === true) {
4609
4692
  if (farmReactServerFiles.has(file)) {
4610
- for (const child of _chunkIEN2EFE5cjs.farmRelativeImportFiles.call(void 0, code, file))
4693
+ for (const child of _chunkBE7AQXJBcjs.farmRelativeImportFiles.call(void 0, code, file))
4611
4694
  farmReactServerFiles.add(child);
4612
4695
  }
4613
- const serverModule = farmReactServerFiles.has(file) || !_chunkIEN2EFE5cjs.getFarmClientReachableModules.call(void 0,
4696
+ const serverModule = farmReactServerFiles.has(file) || !_chunkBE7AQXJBcjs.getFarmClientReachableModules.call(void 0,
4614
4697
  path6.resolve(projectRoot, actionConfig.srcDir || "src"),
4615
4698
  projectRoot
4616
4699
  ).has(path6.resolve(file));
4617
- const reactServer = !serverModule ? null : _chunkIEN2EFE5cjs.rewriteFarmReactServerImports.call(void 0, {
4700
+ const reactServer = !serverModule ? null : _chunkBE7AQXJBcjs.rewriteFarmReactServerImports.call(void 0, {
4618
4701
  code,
4619
4702
  file,
4620
- reference: (specifier, exportName) => _chunkIEN2EFE5cjs.ensureFarmPackageClientReference.call(void 0, projectRoot, specifier, exportName, file),
4703
+ reference: (specifier, exportName) => _chunkBE7AQXJBcjs.ensureFarmPackageClientReference.call(void 0, projectRoot, specifier, exportName, file),
4621
4704
  onServerFile: (serverFile) => farmReactServerFiles.add(serverFile)
4622
4705
  });
4623
4706
  if (reactServer !== null) {
4624
4707
  code = reactServer;
4625
4708
  rewrotePackageImports = true;
4626
4709
  }
4627
- const internal = farmReactServerFiles.has(file) ? _chunkIEN2EFE5cjs.rewriteFarmReactServerClientModuleImports.call(void 0, {
4710
+ const internal = farmReactServerFiles.has(file) ? _chunkBE7AQXJBcjs.rewriteFarmReactServerClientModuleImports.call(void 0, {
4628
4711
  code,
4629
4712
  file,
4630
- reference: (clientFile) => _chunkIEN2EFE5cjs.ensureFarmInternalClientReference.call(void 0, projectRoot, clientFile)
4713
+ reference: (clientFile) => _chunkBE7AQXJBcjs.ensureFarmInternalClientReference.call(void 0, projectRoot, clientFile)
4631
4714
  }) : null;
4632
4715
  if (internal !== null) {
4633
4716
  code = internal;
4634
4717
  rewrotePackageImports = true;
4635
4718
  }
4636
4719
  }
4637
- const referenced = _chunkIEN2EFE5cjs.rewriteFarmPackageClientImports.call(void 0, {
4638
- code,
4720
+ const rewritePackageImports = (source2) => _chunkBE7AQXJBcjs.rewriteFarmPackageClientImports.call(void 0, {
4721
+ code: source2,
4639
4722
  file,
4640
4723
  root: projectRoot,
4641
- isClientPackage: (specifier) => _chunkIEN2EFE5cjs.isFarmPackageClientBoundary.call(void 0, file, specifier, projectRoot)
4724
+ isClientPackage: (specifier) => _chunkBE7AQXJBcjs.isFarmPackageClientBoundary.call(void 0, file, specifier, projectRoot)
4642
4725
  });
4726
+ const routeManager = _optionalChain([farmApp, 'optionalAccess', _405 => _405.getRouteManager, 'call', _406 => _406()]);
4727
+ const source = code;
4728
+ const referenced = routeManager ? routeManager.inspectPackages(() => rewritePackageImports(source)) : rewritePackageImports(source);
4643
4729
  if (referenced !== null) {
4644
4730
  code = referenced;
4645
4731
  rewrotePackageImports = true;
4646
4732
  }
4647
- if (_optionalChain([transformOptions, 'optionalAccess', _396 => _396.ssr]) === true) {
4648
- const cached = rewriteFarmReactCacheImport(code, file);
4733
+ if (_optionalChain([transformOptions, 'optionalAccess', _407 => _407.ssr]) === true) {
4734
+ const cached = rewriteFarmReactCacheImport(
4735
+ code,
4736
+ file,
4737
+ _optionalChain([runtimeModule, 'optionalCall', _408 => _408(FARM_REACT_CACHE_MODULE)])
4738
+ );
4649
4739
  if (cached !== null) {
4650
4740
  code = cached;
4651
4741
  rewrotePackageImports = true;
@@ -4654,43 +4744,44 @@ export const manifest = getManifest();
4654
4744
  }
4655
4745
  if (islandsServerFns() && !_chunkPIUTGRDIcjs.isFarmServerFnBoundaryId.call(void 0, id) && !id.includes("/node_modules/") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id)) {
4656
4746
  const serverFns = _chunkPIUTGRDIcjs.transformFarmServerFns.call(void 0, code, id, {
4657
- environment: _optionalChain([transformOptions, 'optionalAccess', _397 => _397.ssr]) === true ? "rsc" : "client"
4747
+ environment: _optionalChain([transformOptions, 'optionalAccess', _409 => _409.ssr]) === true ? "rsc" : "client"
4658
4748
  });
4659
4749
  if (serverFns) {
4660
4750
  if (!serverFns.code.includes("use server")) return { code: serverFns.code, map: null };
4661
4751
  code = serverFns.code;
4662
4752
  }
4663
4753
  }
4664
- if (_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([actionConfig, 'access', _398 => _398.experimental, 'optionalAccess', _399 => _399.serverComponents])) === "islands" && code.includes("use server") && !id.includes("/node_modules/") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id)) {
4754
+ if (_chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([actionConfig, 'access', _410 => _410.experimental, 'optionalAccess', _411 => _411.serverComponents])) === "islands" && code.includes("use server") && !id.includes("/node_modules/") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id)) {
4665
4755
  const file = id.split("?", 1)[0];
4666
4756
  const actionModule = transformFarmFormActionModule({
4667
4757
  code,
4668
4758
  id,
4669
- root: actionConfig.root || _optionalChain([server, 'optionalAccess', _400 => _400.config, 'access', _401 => _401.root]) || process.cwd(),
4670
- ssr: _optionalChain([transformOptions, 'optionalAccess', _402 => _402.ssr]) === true,
4759
+ root: actionConfig.root || _optionalChain([server, 'optionalAccess', _412 => _412.config, 'access', _413 => _413.root]) || process.cwd(),
4760
+ ssr: _optionalChain([transformOptions, 'optionalAccess', _414 => _414.ssr]) === true,
4671
4761
  // Parsed by file type: page components are TSX.
4672
- parse: (source) => _vite.parseSync.call(void 0, file, source).program
4762
+ parse: (source) => _vite.parseSync.call(void 0, file, source).program,
4763
+ runtimeModule
4673
4764
  });
4674
4765
  if (actionModule) return { code: actionModule, map: null };
4675
4766
  }
4676
- if (!_optionalChain([transformOptions, 'optionalAccess', _403 => _403.ssr])) {
4677
- const docsConfigModule = _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, _optionalChain([farmApp, 'optionalAccess', _404 => _404.getConfig, 'call', _405 => _405(), 'optionalAccess', _406 => _406.docs]));
4678
- if (_chunkM6U6E4F7cjs.isFarmDocsClientConfigModule.call(void 0, id, docsConfigModule)) {
4679
- const redacted = _chunkM6U6E4F7cjs.redactFarmDocsClientConfig.call(void 0, code, id.split("?")[0]);
4767
+ if (!_optionalChain([transformOptions, 'optionalAccess', _415 => _415.ssr])) {
4768
+ const docsConfigModule = _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, _optionalChain([farmApp, 'optionalAccess', _416 => _416.getConfig, 'call', _417 => _417(), 'optionalAccess', _418 => _418.docs]));
4769
+ if (_chunkCBLRSZQLcjs.isFarmDocsClientConfigModule.call(void 0, id, docsConfigModule)) {
4770
+ const redacted = _chunkCBLRSZQLcjs.redactFarmDocsClientConfig.call(void 0, code, id.split("?")[0]);
4680
4771
  if (redacted !== null) return { code: redacted, map: null };
4681
4772
  }
4682
4773
  }
4683
- if (!_optionalChain([transformOptions, 'optionalAccess', _407 => _407.ssr])) {
4684
- const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _408 => _408.getConfig, 'call', _409 => _409()]), () => ( options));
4685
- if ((_optionalChain([currentConfig, 'access', _410 => _410.experimental, 'optionalAccess', _411 => _411.serverActions]) !== true || !serverFnTransformActive) && !islandsServerFns()) {
4774
+ if (!_optionalChain([transformOptions, 'optionalAccess', _419 => _419.ssr])) {
4775
+ const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _420 => _420.getConfig, 'call', _421 => _421()]), () => ( options));
4776
+ if ((_optionalChain([currentConfig, 'access', _422 => _422.experimental, 'optionalAccess', _423 => _423.serverActions]) !== true || !serverFnTransformActive) && !islandsServerFns()) {
4686
4777
  const violation = findClientServerFnViolation(code, id);
4687
4778
  if (violation) {
4688
4779
  this.error(formatServerFnBoundaryError(violation, id));
4689
4780
  }
4690
4781
  }
4691
4782
  }
4692
- if (!_optionalChain([transformOptions, 'optionalAccess', _412 => _412.ssr]) && shouldInspectClientBoundary(id, code)) {
4693
- warnClientBoundaryOnce(this, id, code, _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _413 => _413.getConfig, 'call', _414 => _414()]), () => ( options)));
4783
+ if (!_optionalChain([transformOptions, 'optionalAccess', _424 => _424.ssr]) && shouldInspectClientBoundary(id, code)) {
4784
+ warnClientBoundaryOnce(this, id, code, _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _425 => _425.getConfig, 'call', _426 => _426()]), () => ( options)));
4694
4785
  }
4695
4786
  if (typeof imageImports.transform === "function") {
4696
4787
  const imageModule = await imageImports.transform.call(this, code, id, transformOptions);
@@ -4705,13 +4796,13 @@ export const manifest = getManifest();
4705
4796
  id,
4706
4797
  transformOptions
4707
4798
  );
4708
- const fontCode = typeof fontResult === "string" ? fontResult : _optionalChain([fontResult, 'optionalAccess', _415 => _415.code, 'optionalAccess', _416 => _416.toString, 'call', _417 => _417()]);
4799
+ const fontCode = typeof fontResult === "string" ? fontResult : _optionalChain([fontResult, 'optionalAccess', _427 => _427.code, 'optionalAccess', _428 => _428.toString, 'call', _429 => _429()]);
4709
4800
  if (fontCode) {
4710
4801
  transformedCode = fontCode;
4711
4802
  transformed = true;
4712
4803
  }
4713
4804
  }
4714
- if (_optionalChain([transformOptions, 'optionalAccess', _418 => _418.ssr]) && server) {
4805
+ if (_optionalChain([transformOptions, 'optionalAccess', _430 => _430.ssr]) && server) {
4715
4806
  const rewrittenImports = rewriteEarlySsrRelativeImports({
4716
4807
  code: transformedCode,
4717
4808
  id,
@@ -4723,26 +4814,26 @@ export const manifest = getManifest();
4723
4814
  transformed = true;
4724
4815
  }
4725
4816
  }
4726
- if (_chunkIEN2EFE5cjs.hasUseClientDirective.call(void 0, transformedCode)) {
4817
+ if (_chunkBE7AQXJBcjs.hasUseClientDirective.call(void 0, transformedCode)) {
4727
4818
  const clientBoundarySource = transformedCode;
4728
4819
  const moduleInfo = this.getModuleInfo(id);
4729
4820
  if (moduleInfo) {
4730
4821
  moduleInfo.isClientComponent = true;
4731
4822
  }
4732
- transformedCode = _chunkIEN2EFE5cjs.stripUseClientDirective.call(void 0, transformedCode);
4823
+ transformedCode = _chunkBE7AQXJBcjs.stripUseClientDirective.call(void 0, transformedCode);
4733
4824
  transformed = true;
4734
- const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _419 => _419.getConfig, 'call', _420 => _420()]), () => ( options));
4825
+ const currentConfig = _nullishCoalesce(_optionalChain([farmApp, 'optionalAccess', _431 => _431.getConfig, 'call', _432 => _432()]), () => ( options));
4735
4826
  let isolatedModuleReference = null;
4736
- const root = currentConfig.root || _optionalChain([server, 'optionalAccess', _421 => _421.config, 'access', _422 => _422.root]) || process.cwd();
4827
+ const root = currentConfig.root || _optionalChain([server, 'optionalAccess', _433 => _433.config, 'access', _434 => _434.root]) || process.cwd();
4737
4828
  const cleanId = id.split("?", 1)[0];
4738
- const selectedIsolatedModules = _nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess', _423 => _423.getRouteManager, 'call', _424 => _424(), 'access', _425 => _425.getIsolatedClientBoundaryModules, 'call', _426 => _426(root)])));
4739
- const selectedForIsolatedHydration = _optionalChain([selectedIsolatedModules, 'optionalAccess', _427 => _427.has, 'call', _428 => _428(path6.resolve(cleanId))]) === true;
4740
- if (_chunk67MZTLTFcjs.isReactRenderer.call(void 0, _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, currentConfig.renderer)) && selectedForIsolatedHydration && (_chunkIEN2EFE5cjs.isIsolatableClientBoundarySource.call(void 0, clientBoundarySource) || // A generated client reference, whose marker comment compiled TSX no longer has.
4741
- cleanId.replace(/\\/g, "/").includes(_chunkIEN2EFE5cjs.FARM_CLIENT_REFERENCE_DIRECTORY))) {
4829
+ const selectedIsolatedModules = _nullishCoalesce(options.isolatedClientBoundaryModules, () => ( _optionalChain([farmApp, 'optionalAccess', _435 => _435.getRouteManager, 'call', _436 => _436(), 'access', _437 => _437.getIsolatedClientBoundaryModules, 'call', _438 => _438(root)])));
4830
+ const selectedForIsolatedHydration = _optionalChain([selectedIsolatedModules, 'optionalAccess', _439 => _439.has, 'call', _440 => _440(path6.resolve(cleanId))]) === true;
4831
+ if (_chunk67MZTLTFcjs.isReactRenderer.call(void 0, _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, currentConfig.renderer)) && selectedForIsolatedHydration && (_chunkBE7AQXJBcjs.isIsolatableClientBoundarySource.call(void 0, clientBoundarySource) || // A generated client reference, whose marker comment compiled TSX no longer has.
4832
+ cleanId.replace(/\\/g, "/").includes(_chunkBE7AQXJBcjs.FARM_CLIENT_REFERENCE_DIRECTORY))) {
4742
4833
  isolatedModuleReference = _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, cleanId, root);
4743
- const islandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([currentConfig, 'access', _429 => _429.experimental, 'optionalAccess', _430 => _430.serverComponents])) === "islands";
4744
- const explicitStrategy = _chunkIEN2EFE5cjs.getIslandStrategyExport.call(void 0, clientBoundarySource);
4745
- const inference = islandsMode && explicitStrategy === null ? _chunkM6U6E4F7cjs.inferFarmIslandStrategy.call(void 0, cleanId, root) : null;
4834
+ const islandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([currentConfig, 'access', _441 => _441.experimental, 'optionalAccess', _442 => _442.serverComponents])) === "islands";
4835
+ const explicitStrategy = _chunkBE7AQXJBcjs.getIslandStrategyExport.call(void 0, clientBoundarySource);
4836
+ const inference = islandsMode && explicitStrategy === null ? _chunkCBLRSZQLcjs.inferFarmIslandStrategy.call(void 0, cleanId, root) : null;
4746
4837
  if (inference) {
4747
4838
  for (const file of inference.files) {
4748
4839
  if (file !== path6.resolve(cleanId)) this.addWatchFile(file);
@@ -4755,8 +4846,9 @@ export const manifest = getManifest();
4755
4846
  islandStrategy: _nullishCoalesce(explicitStrategy, () => ( "load")),
4756
4847
  parse: (source) => this.parse(source),
4757
4848
  slots: islandsMode,
4758
- browser: _optionalChain([transformOptions, 'optionalAccess', _431 => _431.ssr]) !== true,
4759
- inferredInteraction: _optionalChain([inference, 'optionalAccess', _432 => _432.strategy]) === "interaction"
4849
+ browser: _optionalChain([transformOptions, 'optionalAccess', _443 => _443.ssr]) !== true,
4850
+ inferredInteraction: _optionalChain([inference, 'optionalAccess', _444 => _444.strategy]) === "interaction",
4851
+ runtimeModule
4760
4852
  });
4761
4853
  if (!transformedBoundary) {
4762
4854
  this.error(
@@ -4786,7 +4878,7 @@ export const manifest = getManifest();
4786
4878
  );
4787
4879
  return;
4788
4880
  }` : "";
4789
- const hmrCode = _optionalChain([transformOptions, 'optionalAccess', _433 => _433.ssr]) || reactRefreshActive || !shouldEmitFarmClientRootHmr(currentConfig.renderer) ? "" : `
4881
+ const hmrCode = _optionalChain([transformOptions, 'optionalAccess', _445 => _445.ssr]) || reactRefreshActive || !shouldEmitFarmClientRootHmr(currentConfig.renderer) ? "" : `
4790
4882
  if (import.meta.hot) {
4791
4883
  import.meta.hot.accept((newModule) => {
4792
4884
  ${isolatedHmrUpdate}
@@ -4842,14 +4934,14 @@ if (import.meta.hot) {
4842
4934
  }
4843
4935
  _chunkQMNWKQL4cjs.logger.info(`Found ${ssgPages.length} SSG pages, ${ssrRoutes.length} SSR routes`);
4844
4936
  _chunkQMNWKQL4cjs.logger.info("Pre-rendering SSG pages...");
4845
- const outDir = path6.join(_optionalChain([server, 'optionalAccess', _434 => _434.config, 'access', _435 => _435.root]) || process.cwd(), options.outDir || "dist");
4937
+ const outDir = path6.join(_optionalChain([server, 'optionalAccess', _446 => _446.config, 'access', _447 => _447.root]) || process.cwd(), options.outDir || "dist");
4846
4938
  const clientDir = path6.join(outDir, "client");
4847
4939
  for (const page of ssgPages) {
4848
4940
  try {
4849
4941
  const staticRequest = new Request(new URL(page.urlPath, "http://farm.static"));
4850
4942
  await farmApp.getServerRenderer().runWithRequestContext(staticRequest, async () => {
4851
4943
  const mod = await routeManager.loadRouteModule(page.filePath);
4852
- if (!_optionalChain([mod, 'optionalAccess', _436 => _436.default])) return;
4944
+ if (!_optionalChain([mod, 'optionalAccess', _448 => _448.default])) return;
4853
4945
  const { layouts } = routeManager.matchRoute(page.urlPath);
4854
4946
  const layoutModules = await Promise.all(
4855
4947
  layouts.map((l) => routeManager.loadLayoutModule(l.modulePath))
@@ -4878,10 +4970,10 @@ if (import.meta.hot) {
4878
4970
  );
4879
4971
  }
4880
4972
  const html = renderToString(pageElement);
4881
- const i18nSnapshot = _chunk2AM26UGIcjs.getFarmI18nClientSnapshot.call(void 0, );
4973
+ const i18nSnapshot = _chunkNLBK37HIcjs.getFarmI18nClientSnapshot.call(void 0, );
4882
4974
  const i18nHead = renderFarmI18nStaticHead(page.urlPath, i18nSnapshot);
4883
4975
  const fullHtml = `<!DOCTYPE html>
4884
- <html lang="${escapeFarmHtmlAttribute(_optionalChain([i18nSnapshot, 'optionalAccess', _437 => _437.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}>
4976
+ <html lang="${escapeFarmHtmlAttribute(_optionalChain([i18nSnapshot, 'optionalAccess', _449 => _449.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}>
4885
4977
  <head>
4886
4978
  <meta charset="utf-8">
4887
4979
  <meta name="viewport" content="width=device-width, initial-scale=1">
@@ -4923,9 +5015,15 @@ if (import.meta.hot) {
4923
5015
  _chunkQMNWKQL4cjs.logger.error(`SSG build failed: ${error}`);
4924
5016
  }
4925
5017
  },
4926
- watchChange() {
4927
- _chunkIEN2EFE5cjs.invalidateFarmClientReachableModules.call(void 0, );
4928
- _chunkIEN2EFE5cjs.invalidateFarmClientOnlyScan.call(void 0, );
5018
+ watchChange(id, change) {
5019
+ const watched = _chunkQMNWKQL4cjs.toPosixPath.call(void 0, id);
5020
+ if (!watched.includes("/node_modules/") && !isFarmGeneratedOutput(watched)) {
5021
+ _optionalChain([farmApp, 'optionalAccess', _450 => _450.getRouteManager, 'call', _451 => _451(), 'access', _452 => _452.noteSourceChange, 'call', _453 => _453(id, change.event)]);
5022
+ }
5023
+ _chunkBE7AQXJBcjs.invalidateFarmClientReachableModules.call(void 0, );
5024
+ _chunkBE7AQXJBcjs.invalidateFarmClientOnlyScan.call(void 0, );
5025
+ _chunkCBLRSZQLcjs.invalidateFarmRouteRootInferences.call(void 0, );
5026
+ _chunkBE7AQXJBcjs.dropLatestPackageClientBoundaryCache.call(void 0, );
4929
5027
  },
4930
5028
  async handleHotUpdate(ctx) {
4931
5029
  if (pendingClientSetup && !farmSetupContext.getStore()) await pendingClientSetup;
@@ -4950,13 +5048,13 @@ if (import.meta.hot) {
4950
5048
  server2.moduleGraph.invalidateModule(mod);
4951
5049
  }
4952
5050
  }
4953
- const currentFarmConfig = _optionalChain([farmApp, 'optionalAccess', _438 => _438.getConfig, 'call', _439 => _439()]);
5051
+ const currentFarmConfig = _optionalChain([farmApp, 'optionalAccess', _454 => _454.getConfig, 'call', _455 => _455()]);
4954
5052
  const normalizedFile = file.replace(/\\/g, "/");
4955
5053
  if (currentFarmConfig && /\/route\.(?:ts|tsx|js|jsx)$/.test(normalizedFile) && _chunkMTBDJ326cjs.getFarmAppDirectories.call(void 0, currentFarmConfig).some(
4956
5054
  (appDir) => normalizedFile.startsWith(`${_chunkQMNWKQL4cjs.toPosixPath.call(void 0, appDir)}/api/`)
4957
5055
  )) {
4958
5056
  for (const mod of modules) server2.moduleGraph.invalidateModule(mod);
4959
- await _optionalChain([refreshRouteDiscovery, 'optionalCall', _440 => _440(`updated ${file}`)]);
5057
+ await _optionalChain([refreshRouteDiscovery, 'optionalCall', _456 => _456(`updated ${file}`)]);
4960
5058
  server2.ws.send({ type: "full-reload", path: "*" });
4961
5059
  return [];
4962
5060
  }
@@ -4966,7 +5064,7 @@ if (import.meta.hot) {
4966
5064
  for (const mod of modules) {
4967
5065
  server2.moduleGraph.invalidateModule(mod);
4968
5066
  }
4969
- await _optionalChain([refreshRouteDiscovery, 'optionalCall', _441 => _441(`updated ${file}`)]);
5067
+ await _optionalChain([refreshRouteDiscovery, 'optionalCall', _457 => _457(`updated ${file}`)]);
4970
5068
  server2.ws.send({
4971
5069
  type: "full-reload",
4972
5070
  path: "*"
@@ -4979,7 +5077,7 @@ if (import.meta.hot) {
4979
5077
  for (const mod of modules) {
4980
5078
  server2.moduleGraph.invalidateModule(mod);
4981
5079
  }
4982
- await _optionalChain([refreshRouteDiscovery, 'optionalCall', _442 => _442(`updated ${file}`)]);
5080
+ await _optionalChain([refreshRouteDiscovery, 'optionalCall', _458 => _458(`updated ${file}`)]);
4983
5081
  server2.ws.send({
4984
5082
  type: "full-reload",
4985
5083
  path: "*"
@@ -4987,16 +5085,19 @@ if (import.meta.hot) {
4987
5085
  return [];
4988
5086
  }
4989
5087
  if (apiRouteManager && _chunkJYNNIGQOcjs.invalidateFarmDevDependents.call(void 0, server2, file, apiRouteManager.getSourceFiles()).length > 0) {
4990
- await _optionalChain([refreshRouteDiscovery, 'optionalCall', _443 => _443(`updated ${file}`)]);
5088
+ await _optionalChain([refreshRouteDiscovery, 'optionalCall', _459 => _459(`updated ${file}`)]);
4991
5089
  }
4992
- const isolatedHydrationMode = _optionalChain([currentFarmConfig, 'optionalAccess', _444 => _444.experimental, 'optionalAccess', _445 => _445.isolatedClientHydration]);
4993
- const planRouteManager = _optionalChain([farmApp, 'optionalAccess', _446 => _446.getRouteManager, 'call', _447 => _447()]);
4994
- const isHydrationPlanSource = currentSrcRoot !== null && normalizedFile.startsWith(`${currentSrcRoot}/`) && /\.[cm]?[jt]sx?$/.test(normalizedFile);
4995
- const tracksAsyncOwnerIslands = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, _optionalChain([currentFarmConfig, 'optionalAccess', _448 => _448.renderer])) && planRouteManager !== void 0;
5090
+ const isolatedHydrationMode = _optionalChain([currentFarmConfig, 'optionalAccess', _460 => _460.experimental, 'optionalAccess', _461 => _461.isolatedClientHydration]);
5091
+ const planRouteManager = _optionalChain([farmApp, 'optionalAccess', _462 => _462.getRouteManager, 'call', _463 => _463()]);
5092
+ const isHydrationPlanSource = /\.[cm]?[jt]sx?$/.test(normalizedFile) && !normalizedFile.includes("/node_modules/") && !isFarmGeneratedOutput(normalizedFile);
5093
+ const tracksAsyncOwnerIslands = _chunk67MZTLTFcjs.isReactRenderer.call(void 0, _optionalChain([currentFarmConfig, 'optionalAccess', _464 => _464.renderer])) && planRouteManager !== void 0;
4996
5094
  let clientPlanCurrent = false;
4997
5095
  if (isHydrationPlanSource && (isolatedHydrationMode === "enabled" || isolatedHydrationMode === "analyze" || tracksAsyncOwnerIslands)) {
4998
5096
  const routeManager = planRouteManager;
4999
- if (routeManager) {
5097
+ if (_optionalChain([routeManager, 'optionalAccess', _465 => _465.isEditPlanNeutral, 'call', _466 => _466(file)])) {
5098
+ clientPlanCurrent = true;
5099
+ } else if (routeManager) {
5100
+ routeManager.noteSourceChange(file, "update");
5000
5101
  try {
5001
5102
  const previousPlan = JSON.stringify(
5002
5103
  routeManager.generateClientManifest(currentFarmConfig.root)
@@ -5054,7 +5155,7 @@ if (import.meta.hot) {
5054
5155
  }
5055
5156
  return [];
5056
5157
  }
5057
- if (!clientPlanCurrent) _optionalChain([farmApp, 'optionalAccess', _449 => _449.getRouteManager, 'call', _450 => _450(), 'access', _451 => _451.invalidateClientManifest, 'call', _452 => _452()]);
5158
+ if (!clientPlanCurrent) _optionalChain([farmApp, 'optionalAccess', _467 => _467.getRouteManager, 'call', _468 => _468(), 'access', _469 => _469.invalidateClientManifest, 'call', _470 => _470()]);
5058
5159
  const manifestModule = server2.moduleGraph.getModuleById("/@farm/manifest");
5059
5160
  if (manifestModule) {
5060
5161
  server2.moduleGraph.invalidateModule(manifestModule);
@@ -5072,6 +5173,11 @@ if (import.meta.hot) {
5072
5173
  return [];
5073
5174
  }
5074
5175
  }
5176
+ if (/\.[cm]?[jt]sx?$/.test(normalizedFile) && !_optionalChain([server2, 'access', _471 => _471.environments, 'access', _472 => _472.client, 'optionalAccess', _473 => _473.moduleGraph, 'access', _474 => _474.getModulesByFile, 'call', _475 => _475(normalizedFile), 'optionalAccess', _476 => _476.size]) && _chunkJYNNIGQOcjs.invalidateFarmDevDependents.call(void 0, server2, file, getFarmRenderedServerModules()).length > 0) {
5177
+ logUpdate("PAGE", `updated ${path6.basename(file)}`);
5178
+ server2.ws.send({ type: "full-reload", path: "*" });
5179
+ return [];
5180
+ }
5075
5181
  return modules;
5076
5182
  }
5077
5183
  };
@@ -5165,7 +5271,7 @@ function createPageDataMiddlewareResponse(res) {
5165
5271
  return (...args) => {
5166
5272
  if (captures(target.statusCode, target.getHeader("location"))) {
5167
5273
  const callback = args.find((arg) => typeof arg === "function");
5168
- _optionalChain([callback, 'optionalCall', _453 => _453()]);
5274
+ _optionalChain([callback, 'optionalCall', _477 => _477()]);
5169
5275
  return property === "write" ? true : response;
5170
5276
  }
5171
5277
  return target[property](...args);
@@ -5229,12 +5335,12 @@ function isFarmClientVirtualId(id) {
5229
5335
  }
5230
5336
  function isClientEnvironment(context, loadOptions) {
5231
5337
  const environment = context.environment;
5232
- if (_optionalChain([environment, 'optionalAccess', _454 => _454.config, 'optionalAccess', _455 => _455.consumer])) return environment.config.consumer === "client";
5233
- if (_optionalChain([environment, 'optionalAccess', _456 => _456.name])) return environment.name === "client";
5234
- return _optionalChain([loadOptions, 'optionalAccess', _457 => _457.ssr]) !== true;
5338
+ if (_optionalChain([environment, 'optionalAccess', _478 => _478.config, 'optionalAccess', _479 => _479.consumer])) return environment.config.consumer === "client";
5339
+ if (_optionalChain([environment, 'optionalAccess', _480 => _480.name])) return environment.name === "client";
5340
+ return _optionalChain([loadOptions, 'optionalAccess', _481 => _481.ssr]) !== true;
5235
5341
  }
5236
5342
  function invalidateProgrammaticClientRouteModules(server) {
5237
- const graph = _optionalChain([server, 'access', _458 => _458.environments, 'optionalAccess', _459 => _459.client, 'optionalAccess', _460 => _460.moduleGraph]);
5343
+ const graph = _optionalChain([server, 'access', _482 => _482.environments, 'optionalAccess', _483 => _483.client, 'optionalAccess', _484 => _484.moduleGraph]);
5238
5344
  if (!graph) return;
5239
5345
  for (const [id, module] of graph.idToModuleMap) {
5240
5346
  if (_chunkE7QOEV5Zcjs.parseProgrammaticRouteModuleId.call(void 0, id)) graph.invalidateModule(module);
@@ -5244,19 +5350,19 @@ function generateProgrammaticClientRouteModuleForId(moduleId, root, renderer, cl
5244
5350
  const parsed = _chunkE7QOEV5Zcjs.parseProgrammaticRouteModuleId.call(void 0, moduleId);
5245
5351
  const routesFile = resolveRealModuleFile(parsed.filePath, root);
5246
5352
  watchFile(routesFile);
5247
- return _chunkIEN2EFE5cjs.generateProgrammaticClientRouteModule.call(void 0, {
5353
+ return _chunkBE7AQXJBcjs.generateProgrammaticClientRouteModule.call(void 0, {
5248
5354
  kind: parsed.kind,
5249
5355
  routePath: parsed.routePath,
5250
5356
  routesFile,
5251
- route: parsed.kind === "api" ? void 0 : _optionalChain([clientRoutes, 'optionalAccess', _461 => _461.routes, 'access', _462 => _462.get, 'call', _463 => _463(
5252
- _chunkIEN2EFE5cjs.programmaticClientRouteKey.call(void 0, routesFile, parsed.kind, parsed.routePath)
5357
+ route: parsed.kind === "api" ? void 0 : _optionalChain([clientRoutes, 'optionalAccess', _485 => _485.routes, 'access', _486 => _486.get, 'call', _487 => _487(
5358
+ _chunkBE7AQXJBcjs.programmaticClientRouteKey.call(void 0, routesFile, parsed.kind, parsed.routePath)
5253
5359
  )]),
5254
5360
  rendererServer: renderer.server,
5255
5361
  toImportSpecifier: (file) => toProgrammaticRouteImportSpecifier(file, root)
5256
5362
  });
5257
5363
  }
5258
5364
  function resolveRealModuleFile(filePath, root) {
5259
- const resolved = _nullishCoalesce(_chunkIEN2EFE5cjs.resolveModuleSourcePath.call(void 0, filePath, root), () => ( filePath));
5365
+ const resolved = _nullishCoalesce(_chunkBE7AQXJBcjs.resolveModuleSourcePath.call(void 0, filePath, root), () => ( filePath));
5260
5366
  try {
5261
5367
  return _chunkQMNWKQL4cjs.toPosixPath.call(void 0, fs2.realpathSync(resolved));
5262
5368
  } catch (e28) {
@@ -5570,12 +5676,12 @@ async function parseRouteModuleProps(routeModule, input) {
5570
5676
  }
5571
5677
  const schemas = routeModule.__farmRouteSchemas;
5572
5678
  const params = parseRouteModuleSchema(
5573
- _optionalChain([schemas, 'optionalAccess', _464 => _464.params]),
5679
+ _optionalChain([schemas, 'optionalAccess', _488 => _488.params]),
5574
5680
  input.props.params,
5575
5681
  "params",
5576
5682
  input.routePath
5577
5683
  );
5578
- const search = parseRouteModuleSchema(_optionalChain([schemas, 'optionalAccess', _465 => _465.search]), input.search, "search", input.routePath);
5684
+ const search = parseRouteModuleSchema(_optionalChain([schemas, 'optionalAccess', _489 => _489.search]), input.search, "search", input.routePath);
5579
5685
  return {
5580
5686
  ...input.props,
5581
5687
  params,
@@ -5595,7 +5701,7 @@ function parseRouteModuleSchema(schema, value, label, routePath) {
5595
5701
  }
5596
5702
  }
5597
5703
  function generateClientCode(integrationProviders = [], documentNavigationMatchers = [], docsSearchClientRuntime = EMPTY_FARM_DOCS_SEARCH_CLIENT_RUNTIME, devtoolsClientRuntime = "", plugins = [], root = process.cwd(), srcDir = "src", publicRuntimeConfig = void 0, docsAdapterReact, renderer = _chunk67MZTLTFcjs.REACT_RENDERER, isolatedHydrationEnabled = false, trailingSlash = false, basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule, islandValues = false) {
5598
- const providerClientCode = _chunkM6U6E4F7cjs.generateFarmIntegrationProviderClientCode.call(void 0,
5704
+ const providerClientCode = _chunkCBLRSZQLcjs.generateFarmIntegrationProviderClientCode.call(void 0,
5599
5705
  integrationProviders,
5600
5706
  root,
5601
5707
  _nullishCoalesce(renderer.componentExtensions, () => ( []))
@@ -5641,14 +5747,15 @@ async function createFarmServerTreePageElement(source, pathname) {
5641
5747
  return await createFarmServerTreeElement(React, source, {
5642
5748
  load: (reference) => import(/* @vite-ignore */ farmModuleUrl(reference)),
5643
5749
  ServerHtml: FarmServerPage,
5644
- key: pathname,
5750
+ // No key: the next page of the same layout updates this one in place, as React Server
5751
+ // Components do, instead of unmounting it and building every node again.
5645
5752
  });
5646
5753
  } catch (error) {
5647
5754
  console.warn('[Farm.js] Could not rebuild the server tree of ' + pathname + '; its server HTML was kept.', error);
5648
5755
  return null;
5649
5756
  }
5650
5757
  }
5651
- ${islandValues ? `${_chunkM6U6E4F7cjs.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE}
5758
+ ${islandValues ? `${_chunkCBLRSZQLcjs.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE}
5652
5759
  let farmLastRouteState = null;
5653
5760
 
5654
5761
  // A hot update to a layout tree's client module renders the route again.
@@ -6459,7 +6566,7 @@ async function loadLayoutComponents(layouts = [], params = {}, source) {
6459
6566
  return loadedLayouts;
6460
6567
  }
6461
6568
 
6462
- ${_chunkM6U6E4F7cjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
6569
+ ${_chunkCBLRSZQLcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
6463
6570
  function wrapWithLoadedLayouts(element, loadedLayouts, params) {
6464
6571
  let wrapped = element;
6465
6572
  for (let index = loadedLayouts.length - 1; index >= 0; index--) {
@@ -6744,7 +6851,7 @@ function readActiveLayoutPatterns() {
6744
6851
  .filter(Boolean);
6745
6852
  }
6746
6853
 
6747
- ${_chunkM6U6E4F7cjs.FARM_NAVIGATION_SCRIPT_SOURCE}
6854
+ ${_chunkCBLRSZQLcjs.FARM_NAVIGATION_SCRIPT_SOURCE}
6748
6855
 
6749
6856
  function activateFragmentScripts(root) {
6750
6857
  for (const script of Array.from(root.querySelectorAll?.('script') || [])) {
@@ -6803,7 +6910,7 @@ function getLayoutShell(root, patterns, index, find) {
6803
6910
  return shell.innerHTML;
6804
6911
  }
6805
6912
 
6806
- ${islandValues ? _chunkM6U6E4F7cjs.FARM_REFRESH_FIELDS_SOURCE : ""}function replaceNavigationBoundary(
6913
+ ${islandValues ? _chunkCBLRSZQLcjs.FARM_REFRESH_FIELDS_SOURCE : ""}function replaceNavigationBoundary(
6807
6914
  container,
6808
6915
  fragment,
6809
6916
  currentPatterns,
@@ -6876,7 +6983,7 @@ ${islandValues ? `
6876
6983
  return nextTarget;
6877
6984
  }
6878
6985
 
6879
- ${islandValues ? `${_chunkM6U6E4F7cjs.FARM_NAVIGATION_STREAM_READER_SOURCE}
6986
+ ${islandValues ? `${_chunkCBLRSZQLcjs.FARM_NAVIGATION_STREAM_READER_SOURCE}
6880
6987
 
6881
6988
  // Islands mode navigates as the production client does: it fetches the page itself, names the
6882
6989
  // layouts it shows by key (F-Layouts), and asks for flush markers (F-Stream), so the shell arrives
@@ -7573,7 +7680,7 @@ function generateClientManifest(bundle) {
7573
7680
  async function defineConfig(config = {}) {
7574
7681
  const tailwindVitePlugin = await _chunkDMXMIE2Ccjs.loadTailwindVitePlugin.call(void 0, );
7575
7682
  const appRoot = path6.resolve(config.root || process.cwd());
7576
- if (_optionalChain([config, 'access', _466 => _466.extends, 'optionalAccess', _467 => _467.length])) {
7683
+ if (_optionalChain([config, 'access', _490 => _490.extends, 'optionalAccess', _491 => _491.length])) {
7577
7684
  const { config: layeredConfig } = await import("./layers-7P4RLKVX.cjs").then(
7578
7685
  ({ resolveFarmLayers }) => resolveFarmLayers(config, {
7579
7686
  root: appRoot,
@@ -7583,7 +7690,7 @@ async function defineConfig(config = {}) {
7583
7690
  config = layeredConfig;
7584
7691
  }
7585
7692
  config.renderer = _chunk67MZTLTFcjs.resolveFarmRenderer.call(void 0, config.renderer);
7586
- config.images = _chunkM6U6E4F7cjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, { root: appRoot, dev: true });
7693
+ config.images = _chunkCBLRSZQLcjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, { root: appRoot, dev: true });
7587
7694
  const rendererVitePlugins = await _chunk67MZTLTFcjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, appRoot, {
7588
7695
  ssr: true
7589
7696
  });
@@ -7675,13 +7782,13 @@ async function defineConfig(config = {}) {
7675
7782
  if (!serverStarted) {
7676
7783
  serverStarted = true;
7677
7784
  const elapsed = Date.now() - startTime;
7678
- const address = _optionalChain([server, 'access', _468 => _468.httpServer, 'optionalAccess', _469 => _469.address, 'call', _470 => _470()]);
7785
+ const address = _optionalChain([server, 'access', _492 => _492.httpServer, 'optionalAccess', _493 => _493.address, 'call', _494 => _494()]);
7679
7786
  const resolvedPort = typeof address === "object" && address ? address.port : server.config.server.port || port || 3e3;
7680
7787
  const hostConfig = server.config.server.host;
7681
7788
  const isExposed = hostConfig === true || hostConfig === "0.0.0.0";
7682
7789
  console.log("");
7683
7790
  console.log(
7684
- ` ${pc.bold(pc.green("Farm.js"))} ${pc.dim(`v${_chunkMZLJFNMHcjs.FARM_VERSION}`)} ${pc.dim(`ready in ${elapsed}ms`)}`
7791
+ ` ${pc.bold(pc.green("Farm.js"))} ${pc.dim(`v${_chunkZDZUFD67cjs.FARM_VERSION}`)} ${pc.dim(`ready in ${elapsed}ms`)}`
7685
7792
  );
7686
7793
  console.log("");
7687
7794
  console.log(
@@ -7715,7 +7822,7 @@ async function defineConfig(config = {}) {
7715
7822
  plugins: [
7716
7823
  // `farm dev --desktop`: only the desktop window gets an answer, as in the packaged app.
7717
7824
  _chunk3QM74STYcjs.farmDesktopDevGuardPlugin.call(void 0, config.basePath),
7718
- _chunkM6U6E4F7cjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
7825
+ _chunkCBLRSZQLcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
7719
7826
  tailwindVitePlugin,
7720
7827
  ...rendererVitePlugins,
7721
7828
  ...reactRefreshPlugins,
@@ -7723,14 +7830,14 @@ async function defineConfig(config = {}) {
7723
7830
  farmI18nClientBridgePlugin(),
7724
7831
  farmServerOnlyEntriesPlugin(),
7725
7832
  farmPlugin(config),
7726
- _chunkIEN2EFE5cjs.farmEnvironmentFunctionsPlugin.call(void 0, config),
7833
+ _chunkBE7AQXJBcjs.farmEnvironmentFunctionsPlugin.call(void 0, config),
7727
7834
  farmBrandingPlugin
7728
7835
  ],
7729
7836
  customLogger: farmLogger,
7730
7837
  clearScreen: false,
7731
7838
  optimizeDeps: {
7732
- ..._chunkM6U6E4F7cjs.createFarmClientOptimizeDepsConfig.call(void 0,
7733
- _chunkM6U6E4F7cjs.createFarmClientOptimizeDepsEntries.call(void 0,
7839
+ ..._chunkCBLRSZQLcjs.createFarmClientOptimizeDepsConfig.call(void 0,
7840
+ _chunkCBLRSZQLcjs.createFarmClientOptimizeDepsEntries.call(void 0,
7734
7841
  appRoot,
7735
7842
  _chunkMTBDJ326cjs.getFarmAppDirectories.call(void 0, { ...config, root: appRoot })
7736
7843
  ),
@@ -7773,7 +7880,7 @@ async function defineConfig(config = {}) {
7773
7880
  // Stub out problematic server-only modules during dev mode
7774
7881
  alias: {
7775
7882
  ..._chunkMTBDJ326cjs.getFarmLayerAliases.call(void 0, config.layers),
7776
- ..._chunkM6U6E4F7cjs.createFarmSourceAlias.call(void 0, appRoot, config.srcDir),
7883
+ ..._chunkCBLRSZQLcjs.createFarmSourceAlias.call(void 0, appRoot, config.srcDir),
7777
7884
  // Nitro internals that should not be resolved in browser
7778
7885
  "supports-color": "data:text/javascript,export default false; export const supportsColor = false; export const stdout = false; export const stderr = false;",
7779
7886
  "@poppinss/dumper": "data:text/javascript,export default {};",