@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
@@ -23,14 +23,16 @@ import {
23
23
  generateClientCachePersistenceCode,
24
24
  generateFarmIntegrationProviderClientCode,
25
25
  inferFarmIslandStrategy,
26
+ invalidateFarmRouteRootInferences,
26
27
  isFarmDocsClientConfigModule,
28
+ mergeFarmViteAlias,
27
29
  redactFarmDocsClientConfig,
28
30
  resolveDevGlobalStylesheetHref,
29
31
  resolveFarmAppPackages,
30
32
  resolveFarmClientCacheAdapterEntry,
31
33
  resolveFarmImageProviderForRuntime,
32
34
  resolveFarmRouteRootStrategy
33
- } from "./chunk-RMOU3PR4.mjs";
35
+ } from "./chunk-5XFKWHZD.mjs";
34
36
  import {
35
37
  generateFarmClientPluginEntryCode,
36
38
  hasFarmServerRuntimePlugins,
@@ -38,14 +40,14 @@ import {
38
40
  } from "./chunk-I4KPA2C6.mjs";
39
41
  import {
40
42
  FARM_NODE_RESPONSE_END_PENDING
41
- } from "./chunk-PJQ5W356.mjs";
43
+ } from "./chunk-Z5ZZAGIH.mjs";
42
44
  import {
43
45
  resolveFarmPlatform
44
46
  } from "./chunk-SMUW7UST.mjs";
45
47
  import {
46
48
  generateFarmTypeArtifacts,
47
49
  resolveRouteRenderingConfig
48
- } from "./chunk-5IJRJWJS.mjs";
50
+ } from "./chunk-DGNMXL2O.mjs";
49
51
  import {
50
52
  createFarmServerFnBoundaryModule,
51
53
  isFarmServerFnBoundaryId,
@@ -61,7 +63,7 @@ import {
61
63
  parseFarmLayoutChainHeader,
62
64
  renderFarmLocaleAlternateLinks,
63
65
  stripRouteGroups
64
- } from "./chunk-NA77GEIU.mjs";
66
+ } from "./chunk-NV26EGMC.mjs";
65
67
  import {
66
68
  FARM_NATIVE_TREE_CONTENT_TYPE
67
69
  } from "./chunk-LLZSYFOM.mjs";
@@ -79,13 +81,13 @@ import {
79
81
  resolveFarmMCPRouteLabel,
80
82
  resolveFarmMarkdownRouteLabel,
81
83
  setFarmRouteLabel
82
- } from "./chunk-A2TH5MKE.mjs";
84
+ } from "./chunk-645ENY7W.mjs";
83
85
  import {
84
86
  FARM_DEFAULT_MCP_PATH
85
- } from "./chunk-75E5FDX2.mjs";
87
+ } from "./chunk-JMFTKNBA.mjs";
86
88
  import {
87
89
  isFarmPreviewDeploymentEnvironment
88
- } from "./chunk-QZHTDVH4.mjs";
90
+ } from "./chunk-AUAMXI6N.mjs";
89
91
  import {
90
92
  resolveFarmLayoutFonts
91
93
  } from "./chunk-HZOMT5DY.mjs";
@@ -95,6 +97,7 @@ import {
95
97
  FARM_CLIENT_REFERENCE_PRAGMA,
96
98
  FARM_RESOLVE_FROM_PREFIX,
97
99
  collectFarmServerBundledPackageInfo,
100
+ dropLatestPackageClientBoundaryCache,
98
101
  ensureFarmInternalClientReference,
99
102
  ensureFarmPackageClientReference,
100
103
  farmBrowserBuiltinsOptimizerPlugin,
@@ -120,7 +123,7 @@ import {
120
123
  rewriteFarmReactServerClientModuleImports,
121
124
  rewriteFarmReactServerImports,
122
125
  stripUseClientDirective
123
- } from "./chunk-JRF2SKCD.mjs";
126
+ } from "./chunk-3JN5M3T5.mjs";
124
127
  import {
125
128
  generateFarmDocsAdapterClientRuntime,
126
129
  getFarmDocsAdapterConfigModule
@@ -134,7 +137,7 @@ import {
134
137
  } from "./chunk-TPA2PV5J.mjs";
135
138
  import {
136
139
  resolveRouteRuleCorsPreflightHeaders
137
- } from "./chunk-R2ZHU37O.mjs";
140
+ } from "./chunk-NLRAQXAA.mjs";
138
141
  import {
139
142
  FARM_DEVTOOLS_LAUNCH_PARAM,
140
143
  FARM_DEVTOOLS_PATH,
@@ -177,7 +180,11 @@ import {
177
180
  createFarmMarkdownSourceResponse,
178
181
  isFarmMarkdownPageFile,
179
182
  normalizeFarmMarkdownRoutePath
180
- } from "./chunk-R7254L3R.mjs";
183
+ } from "./chunk-J5ASGNKF.mjs";
184
+ import {
185
+ resolveFarmMdxComponentsModulePath,
186
+ resolveMdxConfig
187
+ } from "./chunk-UIJOLBUL.mjs";
181
188
  import {
182
189
  FARM_MARKDOWN_CONTENT_TYPE,
183
190
  createFarmMarkdownErrorBody,
@@ -215,10 +222,10 @@ import {
215
222
  } from "./chunk-IYEY3JWJ.mjs";
216
223
  import {
217
224
  APIRouteManager
218
- } from "./chunk-E77IA5IF.mjs";
225
+ } from "./chunk-RLFGKJQ6.mjs";
219
226
  import {
220
227
  getFarmI18nClientSnapshot
221
- } from "./chunk-3AUINHFG.mjs";
228
+ } from "./chunk-TNYC3TYP.mjs";
222
229
  import {
223
230
  VERCEL_OG_INSTALL_HINT,
224
231
  isOptionalPeerInstalled
@@ -252,7 +259,7 @@ import {
252
259
  import {
253
260
  isFarmI18nCatalogFile,
254
261
  resolveFarmI18nMessagePath
255
- } from "./chunk-MU5V7XHL.mjs";
262
+ } from "./chunk-VJSXPN3W.mjs";
256
263
  import {
257
264
  logger,
258
265
  toPosixPath,
@@ -278,10 +285,7 @@ import {
278
285
  } from "./chunk-2DA7CLY7.mjs";
279
286
  import {
280
287
  FARM_VERSION
281
- } from "./chunk-NYF7A4UW.mjs";
282
- import {
283
- toFarmTrailingSlashPageRequest
284
- } from "./chunk-4O26BPUY.mjs";
288
+ } from "./chunk-77VNYVVX.mjs";
285
289
  import {
286
290
  DEFAULT_FARM_API_BASE_PATH
287
291
  } from "./chunk-W6QLRQ3V.mjs";
@@ -303,6 +307,9 @@ import {
303
307
  getFarmDeploymentMismatch,
304
308
  withFarmDeploymentResponse
305
309
  } from "./chunk-IWJONXPF.mjs";
310
+ import {
311
+ toFarmTrailingSlashPageRequest
312
+ } from "./chunk-4O26BPUY.mjs";
306
313
  import {
307
314
  FARM_CONFIG_HEADERS_PLUGIN_NAME,
308
315
  FARM_CONFIG_REDIRECTS_PLUGIN_NAME,
@@ -329,6 +336,7 @@ import { createHash } from "crypto";
329
336
  import { transformActions } from "@farm.js/islx/compiler";
330
337
  import path from "path";
331
338
  function transformFarmFormActionModule(options) {
339
+ const runtimeModule = options.runtimeModule ?? ((specifier) => specifier);
332
340
  const result = transformActions({
333
341
  code: options.code,
334
342
  id: options.id,
@@ -336,8 +344,8 @@ function transformFarmFormActionModule(options) {
336
344
  environment: options.ssr ? "server" : "client",
337
345
  parse: options.parse,
338
346
  runtime: {
339
- server: "@farm.js/core/internal/islx-server",
340
- client: "@farm.js/core/internal/islx-client"
347
+ server: runtimeModule("@farm.js/core/internal/islx-server"),
348
+ client: runtimeModule("@farm.js/core/internal/islx-client")
341
349
  }
342
350
  });
343
351
  return result ? result.code : null;
@@ -503,7 +511,7 @@ function createFarmDevViteCorsMiddleware() {
503
511
  // src/vite.ts
504
512
  import * as fs2 from "fs";
505
513
  import * as path6 from "path";
506
- import { pathToFileURL } from "url";
514
+ import { fileURLToPath, pathToFileURL } from "url";
507
515
 
508
516
  // src/dev-static.ts
509
517
  import * as fs from "fs";
@@ -893,7 +901,7 @@ var REACT_CACHE_APIS = {
893
901
  cache: REACT_CACHE_LOCAL,
894
902
  cacheSignal: "__farm_react_cache_signal__"
895
903
  };
896
- function rewriteFarmReactCacheImport(code, file) {
904
+ function rewriteFarmReactCacheImport(code, file, cacheModule = FARM_REACT_CACHE_MODULE) {
897
905
  if (!code.includes("cache") || !code.includes("react")) return null;
898
906
  const extension = path5.extname(file).slice(1);
899
907
  const lang = extension === "ts" || extension === "mts" || extension === "cts" ? "ts" : "tsx";
@@ -934,7 +942,7 @@ function rewriteFarmReactCacheImport(code, file) {
934
942
  ].join(", ");
935
943
  const lines = [
936
944
  ...clause ? [`import ${clause} from "react";`] : [],
937
- `import { ${caches.map((specifier) => `${specifier.imported?.name ?? specifier.imported?.value} as ${specifier.local.name}`).join(", ")} } from ${JSON.stringify(FARM_REACT_CACHE_MODULE)};`
945
+ `import { ${caches.map((specifier) => `${specifier.imported?.name ?? specifier.imported?.value} as ${specifier.local.name}`).join(", ")} } from ${JSON.stringify(cacheModule)};`
938
946
  ];
939
947
  edits.push({ start: node.start, end: node.end, text: lines.join("\n") });
940
948
  }
@@ -966,7 +974,7 @@ function rewriteFarmReactCacheImport(code, file) {
966
974
  start: memberImportAt,
967
975
  end: memberImportAt,
968
976
  text: `
969
- import { ${[...used].map((name) => `${name} as ${REACT_CACHE_APIS[name]}`).join(", ")} } from ${JSON.stringify(FARM_REACT_CACHE_MODULE)};`
977
+ import { ${[...used].map((name) => `${name} as ${REACT_CACHE_APIS[name]}`).join(", ")} } from ${JSON.stringify(cacheModule)};`
970
978
  });
971
979
  }
972
980
  }
@@ -1071,7 +1079,7 @@ function loadFarmWorkflowsDevRuntime() {
1071
1079
  return import("./workflows.mjs");
1072
1080
  }
1073
1081
  function loadFarmDevtoolsSnapshotRuntime() {
1074
- return import("./devtools-CB43AHEP.mjs");
1082
+ return import("./devtools-7JPQMSTQ.mjs");
1075
1083
  }
1076
1084
  function loadFarmDevtoolsUIRuntime() {
1077
1085
  return import("./devtools-ui-CYBVFLPH.mjs");
@@ -1332,7 +1340,7 @@ async function proxyFarmExternalRewrite(req, res, bodySizeLimit) {
1332
1340
  let request = createRequestFromNodeRequest(req, new URL(destination));
1333
1341
  if (request.method !== "GET" && request.method !== "HEAD") {
1334
1342
  const body = await readNodeRequestBody(req, bodySizeLimit);
1335
- request = new Request(request, { body: toRequestBody(body) });
1343
+ request = new Request(request, { method: request.method, body: toRequestBody(body) });
1336
1344
  }
1337
1345
  await sendWebResponse(res, await fetchFarmExternalRewrite(request));
1338
1346
  return true;
@@ -1798,13 +1806,18 @@ function rewriteEarlySsrRelativeImports(options) {
1798
1806
  return output + options.code.slice(copied);
1799
1807
  }
1800
1808
  function transformIsolatedClientBoundaryModule(options) {
1809
+ const runtimeModule = options.runtimeModule ?? ((specifier) => specifier);
1810
+ const islxReact = JSON.stringify(runtimeModule("@farm.js/core/internal/islx-react"));
1811
+ const isolatedBoundary = JSON.stringify(
1812
+ runtimeModule("@farm.js/core/internal/isolated-boundary")
1813
+ );
1801
1814
  if (options.slots) {
1802
1815
  try {
1803
1816
  const rewritten = rewriteFormStatusImports({
1804
1817
  code: options.code,
1805
1818
  id: options.moduleReference,
1806
1819
  parse: options.parse,
1807
- from: "@farm.js/core/internal/islx-react"
1820
+ from: runtimeModule("@farm.js/core/internal/islx-react")
1808
1821
  });
1809
1822
  if (rewritten) options = { ...options, code: rewritten.code };
1810
1823
  } catch {
@@ -1916,10 +1929,10 @@ function transformIsolatedClientBoundaryModule(options) {
1916
1929
  output = output.slice(0, replacement.start) + replacement.code + output.slice(replacement.end);
1917
1930
  }
1918
1931
  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";
1932
+ const runtimeImport = options.slots ? options.browser ? "const __farm_islx_island__ = (component) => component;" : `import { createIsland as __farm_islx_create_island__ } from ${islxReact};
1920
1933
  const __farm_is_component__ = ${isComponent};
1921
1934
  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";
1935
+ import { createFarmIsolatedClientBoundary as __farm_create_boundary__ } from ${isolatedBoundary};
1923
1936
  const __farm_is_component__ = ${isComponent};
1924
1937
  const __farm_create_isolated_boundary__ = (react, component, ...rest) => __farm_is_component__(component) ? __farm_create_boundary__(react, component, ...rest) : component;`;
1925
1938
  return `${runtimeImport}
@@ -1975,11 +1988,32 @@ function warnClientBoundaryOnce(context, id, code, config) {
1975
1988
  function shouldEmitFarmClientRootHmr(renderer) {
1976
1989
  return getFarmRendererCapabilities(resolveFarmRenderer(renderer)).reconcilesRerenders;
1977
1990
  }
1978
- function hasViteAlias(alias, find) {
1991
+ var FARM_RUNTIME_MODULE_PREFIX = "/@farm/runtime/";
1992
+ function toFarmRuntimeModuleId(specifier) {
1993
+ return FARM_RUNTIME_MODULE_PREFIX + specifier;
1994
+ }
1995
+ function getFarmCoreFile() {
1996
+ return typeof __filename === "string" ? __filename : fileURLToPath(import.meta.url);
1997
+ }
1998
+ var FARM_SOURCE_ALIAS_PROBES = [
1999
+ "@/x",
2000
+ "@/index.ts",
2001
+ "@/components/button",
2002
+ "@/lib/utils/format.ts",
2003
+ "@/__farm__/probe"
2004
+ ];
2005
+ function matchesViteAlias(find, specifier) {
2006
+ if (typeof find === "string") return specifier === find || specifier.startsWith(`${find}/`);
2007
+ find.lastIndex = 0;
2008
+ const matched = find.test(specifier);
2009
+ find.lastIndex = 0;
2010
+ return matched;
2011
+ }
2012
+ function hasFarmSourceAliasOverride(alias) {
1979
2013
  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}/`)
2014
+ const finds = Array.isArray(alias) ? alias.map((entry) => entry.find) : Object.keys(alias);
2015
+ return finds.some(
2016
+ (find) => FARM_SOURCE_ALIAS_PROBES.every((probe) => matchesViteAlias(find, probe))
1983
2017
  );
1984
2018
  }
1985
2019
  function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
@@ -1991,7 +2025,34 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
1991
2025
  publicDir: options.publicDir
1992
2026
  });
1993
2027
  let farmApp;
2028
+ const isFarmGeneratedOutput = (file) => {
2029
+ const root = farmApp?.getConfig().root ?? options.root;
2030
+ if (!root) return file.includes("/.farm/");
2031
+ const output = toPosixPath(path6.resolve(root, options.distDir || ".farm"));
2032
+ return file === output || file.startsWith(`${output}/`);
2033
+ };
1994
2034
  let serverFnTransformActive = false;
2035
+ const getFarmRenderedServerModules = () => {
2036
+ const routeManager = farmApp?.getRouteManager();
2037
+ if (!routeManager) return /* @__PURE__ */ new Set();
2038
+ const files = /* @__PURE__ */ new Set();
2039
+ for (const entries of [
2040
+ routeManager.getRoutes(),
2041
+ routeManager.getLayouts(),
2042
+ routeManager.getLoadings(),
2043
+ routeManager.getErrors(),
2044
+ routeManager.getRouteSlots()
2045
+ ]) {
2046
+ for (const entry of entries.values()) files.add(entry.modulePath);
2047
+ }
2048
+ const config = farmApp.getConfig();
2049
+ const mdxComponents = resolveFarmMdxComponentsModulePath(
2050
+ resolveMdxConfig(config.mdx),
2051
+ config.root
2052
+ );
2053
+ if (mdxComponents) files.add(mdxComponents);
2054
+ return files;
2055
+ };
1995
2056
  const islandsServerFns = () => {
1996
2057
  const config = farmApp?.getConfig() ?? options;
1997
2058
  return config.experimental?.serverActions === true && resolveFarmServerComponentsMode(config.experimental?.serverComponents) === "islands";
@@ -2024,13 +2085,25 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2024
2085
  console.log(log);
2025
2086
  };
2026
2087
  const getProgrammaticClientRoutes = () => options.programmaticClientRoutes ?? farmApp?.getRouteManager().getProgrammaticClientRoutes();
2088
+ const isOutsideAppRoot = (file) => {
2089
+ const root = farmApp?.getConfig().root || server?.config.root || options.root;
2090
+ if (!root) return false;
2091
+ const relative4 = path6.relative(root, file.split("?", 1)[0]);
2092
+ return relative4.startsWith("..") || path6.isAbsolute(relative4);
2093
+ };
2027
2094
  const plugin = {
2028
2095
  name: "farm",
2029
2096
  api: { getProgrammaticClientRoutes },
2030
2097
  config(userConfig, configEnv) {
2031
2098
  isBuild = configEnv.command === "build";
2032
- const layerAliases = getFarmLayerAliases(options.layers);
2033
- const sourceAlias = hasViteAlias(userConfig.resolve?.alias, "@") ? {} : createFarmSourceAlias(options.root || process.cwd(), options.srcDir);
2099
+ const farmAliases = {
2100
+ ...getFarmLayerAliases(options.layers),
2101
+ ...hasFarmSourceAliasOverride(userConfig.resolve?.alias) ? {} : createFarmSourceAlias(options.root || process.cwd(), options.srcDir)
2102
+ };
2103
+ if (Object.keys(farmAliases).length > 0) {
2104
+ userConfig.resolve ?? (userConfig.resolve = {});
2105
+ userConfig.resolve.alias = mergeFarmViteAlias(farmAliases, userConfig.resolve.alias);
2106
+ }
2034
2107
  const layerRoots = (options.layers ?? []).map((layer) => layer.root);
2035
2108
  farmOwnsDevCors = !isBuild && userConfig.server?.cors === void 0;
2036
2109
  return {
@@ -2041,9 +2114,6 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2041
2114
  // Keep development module ownership explicit; the RSC plugin adds its
2042
2115
  // environment only when enabled. Production environment setup is unchanged.
2043
2116
  ...!isBuild ? { environments: { client: {}, ssr: {} } } : {},
2044
- resolve: {
2045
- alias: { ...layerAliases, ...sourceAlias }
2046
- },
2047
2117
  server: {
2048
2118
  ...farmOwnsDevCors ? { cors: false } : {},
2049
2119
  fs: {
@@ -2107,6 +2177,7 @@ function farmPlugin(options = {}, initialPluginManager, deferredSetup) {
2107
2177
  options.distDir || ".farm"
2108
2178
  )
2109
2179
  );
2180
+ farmApp.getRouteManager().trackSourceChanges();
2110
2181
  await farmApp.initialize();
2111
2182
  const farmConfig = farmApp.getConfig();
2112
2183
  let farmAppPackages;
@@ -2814,8 +2885,9 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2814
2885
  const runtimeHookErrorAnswersJSON = rendererDisabled || isFarmAPIPathname(requestPathname, apiServerBasePath);
2815
2886
  const requestedPagePathname = configRewriteSource === void 0 ? requestPathname : new URL(configRewriteSource).pathname;
2816
2887
  let pageHookRouteMatch;
2817
- const pageHookRoute = (pathname2) => {
2818
- if (pageHookRouteMatch?.render.pathname === pathname2) return pageHookRouteMatch;
2888
+ const pageHookRoute = () => {
2889
+ if (pageHookRouteMatch) return pageHookRouteMatch;
2890
+ const pathname2 = requestedPagePathname;
2819
2891
  const match = farmApp.getRouteManager().matchRoute(pathname2);
2820
2892
  pageHookRouteMatch = {
2821
2893
  render: {
@@ -2828,13 +2900,19 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2828
2900
  };
2829
2901
  return pageHookRouteMatch;
2830
2902
  };
2831
- const runFarmDevPageHooks = async (pathname2 = requestedPagePathname) => {
2903
+ const matchAppMetadataRoute = (pathname2) => {
2904
+ const routeManager3 = farmApp.getRouteManager();
2905
+ const image = routeManager3.matchMetadataImage(pathname2);
2906
+ if (image) return { pattern: image.image.pattern, params: image.params };
2907
+ const metadata = routeManager3.matchMetadataRoute(pathname2);
2908
+ return metadata ? { pattern: metadata.metadata.pattern, params: metadata.params } : null;
2909
+ };
2910
+ const runFarmDevPageHooks = async () => {
2832
2911
  if (!pm || !pm.hasHook("beforeRouteMatch") && !pm.hasHook("afterRouteMatch") && !pm.hasHook("beforeRender")) {
2833
2912
  return;
2834
2913
  }
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.
2914
+ const { render, layoutPatterns } = pageHookRoute();
2915
+ if (matchAppMetadataRoute(render.pathname) || // A path no page route matches is a page only for a GET or HEAD request.
2838
2916
  !render.routePattern && requestMethod !== "GET" && requestMethod !== "HEAD") {
2839
2917
  return;
2840
2918
  }
@@ -2851,15 +2929,19 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2851
2929
  });
2852
2930
  await pm.runHookParallel("beforeRender", render);
2853
2931
  };
2854
- if (pm && configRewriteSource === void 0 && !deferredDottedRequests.has(req) && (configRoutePlugins.has(FARM_CONFIG_HEADERS_PLUGIN_NAME) || configRedirectMatchers.length > 0) && !isViteOwnedRequest()) {
2855
- let redirect = null;
2932
+ const meetsRequestedURLRoutes = configRewriteSource === void 0 && !deferredDottedRequests.has(req);
2933
+ const routeRedirect = meetsRequestedURLRoutes ? farmApp.getRouteManager().matchRedirect(requestPathname, parsedRequestUrl.search) : null;
2934
+ if (meetsRequestedURLRoutes && (routeRedirect || pm && (configRoutePlugins.has(FARM_CONFIG_HEADERS_PLUGIN_NAME) || configRedirectMatchers.length > 0)) && !isViteOwnedRequest()) {
2935
+ let redirect = routeRedirect;
2856
2936
  try {
2857
- await pm.runHookParallelFiltered(
2858
- "beforeRequest",
2859
- (plugin2) => plugin2.name === FARM_CONFIG_HEADERS_PLUGIN_NAME,
2860
- req,
2861
- res
2862
- );
2937
+ if (pm) {
2938
+ await pm.runHookParallelFiltered(
2939
+ "beforeRequest",
2940
+ (plugin2) => plugin2.name === FARM_CONFIG_HEADERS_PLUGIN_NAME,
2941
+ req,
2942
+ res
2943
+ );
2944
+ }
2863
2945
  for (const matchRedirect of configRedirectMatchers) {
2864
2946
  redirect ?? (redirect = matchRedirect(parsedRequestUrl));
2865
2947
  }
@@ -2877,17 +2959,18 @@ window.__FARM_MANIFEST__ = ${inlineValue({
2877
2959
  status: redirect.statusCode,
2878
2960
  headers: { Location: redirect.destination }
2879
2961
  });
2880
- if (opensFarmDevRuntimeSession(pm)) {
2962
+ if (pm && opensFarmDevRuntimeSession(pm)) {
2881
2963
  const redirectResponse = response;
2882
2964
  try {
2883
- const kind = isFarmAPIPathname(requestPathname, apiServerBasePath) ? "api" : requestMethod === "GET" || requestMethod === "HEAD" ? "page" : "request";
2965
+ const metadataRoute = matchAppMetadataRoute(requestPathname);
2966
+ const kind = metadataRoute ? "asset" : isFarmAPIPathname(requestPathname, apiServerBasePath) ? "api" : requestMethod === "GET" || requestMethod === "HEAD" ? "page" : "request";
2884
2967
  response = await pm.runRuntimeRequest(
2885
2968
  createRequestFromNodeRequest(req, parsedRequestUrl),
2886
2969
  async () => {
2887
2970
  if (kind === "page") await runFarmDevPageHooks();
2888
2971
  return redirectResponse;
2889
2972
  },
2890
- { kind, route: { pathname: requestPathname } }
2973
+ { kind, route: { pathname: requestPathname, ...metadataRoute } }
2891
2974
  );
2892
2975
  } catch {
2893
2976
  sendFarmDevRuntimeHookError(res, runtimeHookErrorAnswersJSON);
@@ -3541,13 +3624,6 @@ window.__FARM_MANIFEST__ = ${inlineValue({
3541
3624
  if (await tryConfiguredIntegrationRoute()) {
3542
3625
  return;
3543
3626
  }
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
3627
  const matchedApiRoute = apiRouteManager.matchRoute(requestPathname);
3552
3628
  const hasMatchedApiRoute = Boolean(matchedApiRoute);
3553
3629
  if (hasMatchedApiRoute || isFarmAPIPathname(requestPathname, apiServerBasePath)) {
@@ -4218,7 +4294,6 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4218
4294
  const hasHTMLTransformHook = (pm?.hasHook("transformHTML") ?? false) || (pm?.hasHook("afterRender") ?? false);
4219
4295
  const opensRuntimeSession = pm ? opensFarmDevRuntimeSession(pm) : false;
4220
4296
  const hasRuntimeAfterHook = pm?.hasRuntimeHook("after") ?? false;
4221
- const requestedMatch = routeManager2.matchRoute(requestedPathname);
4222
4297
  const pageBuiltInRouteLabel = (pathname2) => {
4223
4298
  const routePathname = stripFarmBasePath(pathname2, farmConfig.basePath);
4224
4299
  const mcpLabel = resolveFarmMCPRouteLabel(routePathname, apiServerBasePath);
@@ -4226,34 +4301,37 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4226
4301
  if (farmAgentGeneratedPaths(farmConfig).includes(routePathname)) return routePathname;
4227
4302
  return routePathname === FARM_DEFAULT_MCP_PATH && farmApp.getServerRenderer().getDefaultMCPServer() ? FARM_DEFAULT_MCP_PATH : null;
4228
4303
  };
4304
+ const pageRuntimeOptions = (pathname2) => {
4305
+ const match = routeManager2.matchRoute(pathname2);
4306
+ return {
4307
+ kind: "page",
4308
+ route: setFarmRouteLabel(
4309
+ {
4310
+ pathname: pathname2,
4311
+ pattern: match?.route?.pattern || null,
4312
+ params: match?.params || {}
4313
+ },
4314
+ match?.route ? null : pageBuiltInRouteLabel(pathname2)
4315
+ )
4316
+ };
4317
+ };
4229
4318
  let runtimeSession;
4230
4319
  let pathname = requestedPathname;
4231
- let pageHookPathname = requestedPagePathname;
4232
4320
  if (pm && opensRuntimeSession) {
4233
4321
  try {
4234
- const sessionOptions = {
4235
- kind: "page",
4236
- route: setFarmRouteLabel(
4237
- {
4238
- pathname: requestedPathname,
4239
- pattern: requestedMatch?.route?.pattern || null,
4240
- params: requestedMatch?.params || {}
4241
- },
4242
- requestedMatch?.route ? null : pageBuiltInRouteLabel(requestedPathname)
4243
- )
4244
- };
4322
+ const metadataRoute = configRewriteSource === void 0 ? matchAppMetadataRoute(requestedPathname) : null;
4323
+ const sessionOptions = metadataRoute ? { kind: "asset", route: { pathname: requestedPathname, ...metadataRoute } } : pageRuntimeOptions(
4324
+ configRewriteSource === void 0 ? requestedPathname : requestedPagePathname
4325
+ );
4245
4326
  runtimeSession = await pm.beginRuntimeRequest(
4246
4327
  createRequestFromNodeRequest(req, new URL(configRewriteSource ?? fullUrl)),
4247
4328
  sessionOptions
4248
4329
  );
4249
- if (!runtimeSession.response) {
4250
- pageHookPathname = configRewriteSource === void 0 ? new URL(runtimeSession.request.url).pathname : requestedPagePathname;
4251
- await runFarmDevPageHooks(pageHookPathname);
4252
- }
4330
+ if (!runtimeSession.response) await runFarmDevPageHooks();
4253
4331
  const routedRequest = runtimeSession.response ?? (configRewriteSource === void 0 ? runtimeSession.request : await pm.runRuntimeBeforeForRewrite(
4254
4332
  runtimeSession.request,
4255
4333
  createRequestFromNodeRequest(req, new URL(fullUrl)),
4256
- sessionOptions
4334
+ pageRuntimeOptions(requestedPathname)
4257
4335
  ));
4258
4336
  if (routedRequest instanceof Response) {
4259
4337
  const response = await pm.endRuntimeRequest(runtimeSession, routedRequest);
@@ -4284,7 +4362,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4284
4362
  };
4285
4363
  if (!runtimeSession) {
4286
4364
  try {
4287
- await runFarmDevPageHooks(pageHookPathname);
4365
+ await runFarmDevPageHooks();
4288
4366
  } catch (error) {
4289
4367
  await failPageHook(error);
4290
4368
  return;
@@ -4302,7 +4380,7 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4302
4380
  hasAfterResponseHook,
4303
4381
  hasHTMLTransformHook,
4304
4382
  // render.html gets the render info render.before got.
4305
- renderPayload: pageHookRoute(pageHookPathname).render,
4383
+ renderPayload: pageHookRoute().render,
4306
4384
  method,
4307
4385
  urlPath,
4308
4386
  pathname,
@@ -4401,15 +4479,18 @@ window.__FARM_MANIFEST__ = ${inlineValue({
4401
4479
  };
4402
4480
  },
4403
4481
  async resolveId(id, importer, resolveOptions) {
4404
- if (id.startsWith("@farm.js/core/internal/") && importer) {
4482
+ if (id.startsWith(FARM_RUNTIME_MODULE_PREFIX)) {
4483
+ return this.resolve(id.slice(FARM_RUNTIME_MODULE_PREFIX.length), getFarmCoreFile(), {
4484
+ ...resolveOptions,
4485
+ skipSelf: true
4486
+ });
4487
+ }
4488
+ if (id.startsWith("@farm.js/core/internal/") && importer && isOutsideAppRoot(importer)) {
4405
4489
  const root = farmApp?.getConfig().root || server?.config.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
- }
4490
+ return this.resolve(id, path6.join(root, "package.json"), {
4491
+ ...resolveOptions,
4492
+ skipSelf: true
4493
+ });
4413
4494
  }
4414
4495
  if (typeof fontImports.resolveId === "function") {
4415
4496
  const fontId = await fontImports.resolveId.call(this, id, importer, resolveOptions);
@@ -4600,6 +4681,7 @@ export const manifest = getManifest();
4600
4681
  if (pendingClientSetup && !transformOptions?.ssr && !farmSetupContext.getStore()) {
4601
4682
  await pendingClientSetup;
4602
4683
  }
4684
+ const runtimeModule = !isBuild && transformOptions?.ssr === true && isOutsideAppRoot(id) ? toFarmRuntimeModuleId : void 0;
4603
4685
  const actionConfig = farmApp?.getConfig() ?? options;
4604
4686
  let rewrotePackageImports = false;
4605
4687
  if (resolveFarmServerComponentsMode(actionConfig.experimental?.serverComponents) === "islands" && (!id.includes("/node_modules/") || transformOptions?.ssr === true && farmReactServerFiles.has(id.split("?", 1)[0])) && !id.startsWith("\0") && /\.[cm]?[jt]sx?(?:$|\?)/.test(id) && !hasUseClientDirective(code)) {
@@ -4634,18 +4716,25 @@ export const manifest = getManifest();
4634
4716
  rewrotePackageImports = true;
4635
4717
  }
4636
4718
  }
4637
- const referenced = rewriteFarmPackageClientImports({
4638
- code,
4719
+ const rewritePackageImports = (source2) => rewriteFarmPackageClientImports({
4720
+ code: source2,
4639
4721
  file,
4640
4722
  root: projectRoot,
4641
4723
  isClientPackage: (specifier) => isFarmPackageClientBoundary(file, specifier, projectRoot)
4642
4724
  });
4725
+ const routeManager = farmApp?.getRouteManager();
4726
+ const source = code;
4727
+ const referenced = routeManager ? routeManager.inspectPackages(() => rewritePackageImports(source)) : rewritePackageImports(source);
4643
4728
  if (referenced !== null) {
4644
4729
  code = referenced;
4645
4730
  rewrotePackageImports = true;
4646
4731
  }
4647
4732
  if (transformOptions?.ssr === true) {
4648
- const cached = rewriteFarmReactCacheImport(code, file);
4733
+ const cached = rewriteFarmReactCacheImport(
4734
+ code,
4735
+ file,
4736
+ runtimeModule?.(FARM_REACT_CACHE_MODULE)
4737
+ );
4649
4738
  if (cached !== null) {
4650
4739
  code = cached;
4651
4740
  rewrotePackageImports = true;
@@ -4669,7 +4758,8 @@ export const manifest = getManifest();
4669
4758
  root: actionConfig.root || server?.config.root || process.cwd(),
4670
4759
  ssr: transformOptions?.ssr === true,
4671
4760
  // Parsed by file type: page components are TSX.
4672
- parse: (source) => parseSync(file, source).program
4761
+ parse: (source) => parseSync(file, source).program,
4762
+ runtimeModule
4673
4763
  });
4674
4764
  if (actionModule) return { code: actionModule, map: null };
4675
4765
  }
@@ -4756,7 +4846,8 @@ export const manifest = getManifest();
4756
4846
  parse: (source) => this.parse(source),
4757
4847
  slots: islandsMode,
4758
4848
  browser: transformOptions?.ssr !== true,
4759
- inferredInteraction: inference?.strategy === "interaction"
4849
+ inferredInteraction: inference?.strategy === "interaction",
4850
+ runtimeModule
4760
4851
  });
4761
4852
  if (!transformedBoundary) {
4762
4853
  this.error(
@@ -4923,9 +5014,15 @@ if (import.meta.hot) {
4923
5014
  logger.error(`SSG build failed: ${error}`);
4924
5015
  }
4925
5016
  },
4926
- watchChange() {
5017
+ watchChange(id, change) {
5018
+ const watched = toPosixPath(id);
5019
+ if (!watched.includes("/node_modules/") && !isFarmGeneratedOutput(watched)) {
5020
+ farmApp?.getRouteManager().noteSourceChange(id, change.event);
5021
+ }
4927
5022
  invalidateFarmClientReachableModules();
4928
5023
  invalidateFarmClientOnlyScan();
5024
+ invalidateFarmRouteRootInferences();
5025
+ dropLatestPackageClientBoundaryCache();
4929
5026
  },
4930
5027
  async handleHotUpdate(ctx) {
4931
5028
  if (pendingClientSetup && !farmSetupContext.getStore()) await pendingClientSetup;
@@ -4991,12 +5088,15 @@ if (import.meta.hot) {
4991
5088
  }
4992
5089
  const isolatedHydrationMode = currentFarmConfig?.experimental?.isolatedClientHydration;
4993
5090
  const planRouteManager = farmApp?.getRouteManager();
4994
- const isHydrationPlanSource = currentSrcRoot !== null && normalizedFile.startsWith(`${currentSrcRoot}/`) && /\.[cm]?[jt]sx?$/.test(normalizedFile);
5091
+ const isHydrationPlanSource = /\.[cm]?[jt]sx?$/.test(normalizedFile) && !normalizedFile.includes("/node_modules/") && !isFarmGeneratedOutput(normalizedFile);
4995
5092
  const tracksAsyncOwnerIslands = isReactRenderer(currentFarmConfig?.renderer) && planRouteManager !== void 0;
4996
5093
  let clientPlanCurrent = false;
4997
5094
  if (isHydrationPlanSource && (isolatedHydrationMode === "enabled" || isolatedHydrationMode === "analyze" || tracksAsyncOwnerIslands)) {
4998
5095
  const routeManager = planRouteManager;
4999
- if (routeManager) {
5096
+ if (routeManager?.isEditPlanNeutral(file)) {
5097
+ clientPlanCurrent = true;
5098
+ } else if (routeManager) {
5099
+ routeManager.noteSourceChange(file, "update");
5000
5100
  try {
5001
5101
  const previousPlan = JSON.stringify(
5002
5102
  routeManager.generateClientManifest(currentFarmConfig.root)
@@ -5072,6 +5172,11 @@ if (import.meta.hot) {
5072
5172
  return [];
5073
5173
  }
5074
5174
  }
5175
+ if (/\.[cm]?[jt]sx?$/.test(normalizedFile) && !server2.environments.client?.moduleGraph.getModulesByFile(normalizedFile)?.size && invalidateFarmDevDependents(server2, file, getFarmRenderedServerModules()).length > 0) {
5176
+ logUpdate("PAGE", `updated ${path6.basename(file)}`);
5177
+ server2.ws.send({ type: "full-reload", path: "*" });
5178
+ return [];
5179
+ }
5075
5180
  return modules;
5076
5181
  }
5077
5182
  };
@@ -5641,7 +5746,8 @@ async function createFarmServerTreePageElement(source, pathname) {
5641
5746
  return await createFarmServerTreeElement(React, source, {
5642
5747
  load: (reference) => import(/* @vite-ignore */ farmModuleUrl(reference)),
5643
5748
  ServerHtml: FarmServerPage,
5644
- key: pathname,
5749
+ // No key: the next page of the same layout updates this one in place, as React Server
5750
+ // Components do, instead of unmounting it and building every node again.
5645
5751
  });
5646
5752
  } catch (error) {
5647
5753
  console.warn('[Farm.js] Could not rebuild the server tree of ' + pathname + '; its server HTML was kept.', error);