@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
@@ -9,11 +9,12 @@ import {
9
9
  collectSSGPages,
10
10
  matchSSGPage,
11
11
  resolveRouteRenderingConfigFromFile
12
- } from "./chunk-5IJRJWJS.mjs";
12
+ } from "./chunk-DGNMXL2O.mjs";
13
13
  import {
14
14
  createFarmMetadataImageResponse
15
15
  } from "./chunk-CROAFCMW.mjs";
16
16
  import {
17
+ appendFarmHead,
17
18
  classifyFarmDocumentPrefix,
18
19
  composeFarmFullDocument,
19
20
  createDefaultErrorMarkup,
@@ -38,11 +39,12 @@ import {
38
39
  removeFarmDocumentTitles,
39
40
  renderFarmLocaleAlternateLinks,
40
41
  resolveDefaultErrorStatus,
41
- routeBoundaryCoversDirectory
42
- } from "./chunk-NA77GEIU.mjs";
42
+ routeBoundaryCoversDirectory,
43
+ takeFarmHoistedHead
44
+ } from "./chunk-NV26EGMC.mjs";
43
45
  import {
44
46
  listFarmMCPLlmsTxtLinks
45
- } from "./chunk-A2TH5MKE.mjs";
47
+ } from "./chunk-645ENY7W.mjs";
46
48
  import {
47
49
  FARM_DEFAULT_MCP_PATH,
48
50
  collectFarmDefaultMCPPages,
@@ -50,7 +52,7 @@ import {
50
52
  farmConfigMountsMCP,
51
53
  isFarmDefaultMCPPathname,
52
54
  resolveFarmDefaultMCPServer
53
- } from "./chunk-75E5FDX2.mjs";
55
+ } from "./chunk-JMFTKNBA.mjs";
54
56
  import {
55
57
  getFarmFormState,
56
58
  handleFarmFormActionRequest,
@@ -61,6 +63,7 @@ import {
61
63
  uninstallFarmIslandValues
62
64
  } from "./chunk-A4PWGL46.mjs";
63
65
  import {
66
+ FarmSourceSnapshotStore,
64
67
  collectFarmRenderedClientModules,
65
68
  createEvaluatedRouteGraph,
66
69
  createMarkdownPageHydrationPlanner,
@@ -70,13 +73,17 @@ import {
70
73
  getClientModuleMetadata,
71
74
  getFarmClientHydrationPlanOptions,
72
75
  getIslandStrategyExport,
76
+ isFarmClientModulePlanUnchanged,
73
77
  mergeProgrammaticClientRoutes,
74
78
  resolveFarmIsolatedClientHydrationMode,
75
79
  resolveImportedModule,
76
80
  resolveProgrammaticClientRoutes,
81
+ runWithLatestPackageClientBoundaryCache,
77
82
  runWithPackageClientBoundaryCacheFile,
78
- usesFarmServerTree
79
- } from "./chunk-JRF2SKCD.mjs";
83
+ traceFarmSourceReads,
84
+ usesFarmServerTree,
85
+ withFarmSourceSnapshot
86
+ } from "./chunk-3JN5M3T5.mjs";
80
87
  import {
81
88
  FARM_ISLAND_REPLAYABLE_SELECTOR
82
89
  } from "./chunk-S32PDOLO.mjs";
@@ -93,7 +100,7 @@ import {
93
100
  } from "./chunk-TPA2PV5J.mjs";
94
101
  import {
95
102
  normalizeRouteRules
96
- } from "./chunk-R2ZHU37O.mjs";
103
+ } from "./chunk-NLRAQXAA.mjs";
97
104
  import {
98
105
  resolveFarmDevtoolsConfig
99
106
  } from "./chunk-CU5SYTJG.mjs";
@@ -154,10 +161,10 @@ import {
154
161
  import {
155
162
  createFarmMarkdownRouteModuleFromFile,
156
163
  loadFarmMdxComponents
157
- } from "./chunk-5R3JQPWD.mjs";
164
+ } from "./chunk-AYVGD3PK.mjs";
158
165
  import {
159
166
  isFarmMarkdownPageFile
160
- } from "./chunk-R7254L3R.mjs";
167
+ } from "./chunk-J5ASGNKF.mjs";
161
168
  import {
162
169
  resolveFarmMdxComponentsModulePath,
163
170
  resolveMdxConfig
@@ -208,7 +215,7 @@ import {
208
215
  _setDefaultFarmI18nRuntime,
209
216
  createFarmI18nRuntime,
210
217
  getFarmI18nClientSnapshot
211
- } from "./chunk-3AUINHFG.mjs";
218
+ } from "./chunk-TNYC3TYP.mjs";
212
219
  import {
213
220
  formatOptionalPeerInstallHint,
214
221
  isOptionalPeerInstalled
@@ -243,7 +250,7 @@ import {
243
250
  } from "./chunk-TUOO6IK3.mjs";
244
251
  import {
245
252
  resolveFarmI18nConfig
246
- } from "./chunk-MU5V7XHL.mjs";
253
+ } from "./chunk-VJSXPN3W.mjs";
247
254
  import {
248
255
  fileExists,
249
256
  globFiles,
@@ -278,18 +285,14 @@ import {
278
285
  } from "./chunk-2DA7CLY7.mjs";
279
286
  import {
280
287
  FARM_VERSION
281
- } from "./chunk-NYF7A4UW.mjs";
282
- import {
283
- resolveFarmTrailingSlashRedirect,
284
- setFarmTrailingSlashPreference
285
- } from "./chunk-4O26BPUY.mjs";
288
+ } from "./chunk-77VNYVVX.mjs";
286
289
  import {
287
290
  normalizeFarmAPIConfig
288
291
  } from "./chunk-W6QLRQ3V.mjs";
289
292
  import {
290
293
  createFarmLocaleCookie,
291
294
  getFarmLocaleVaryHeaders
292
- } from "./chunk-7A3URI2F.mjs";
295
+ } from "./chunk-2EVESLP3.mjs";
293
296
  import {
294
297
  getFarmPageDataRedirect
295
298
  } from "./chunk-SD6JGJOM.mjs";
@@ -313,6 +316,10 @@ import {
313
316
  getFarmDeploymentMismatch,
314
317
  withoutFarmDeploymentCookie
315
318
  } from "./chunk-IWJONXPF.mjs";
319
+ import {
320
+ resolveFarmTrailingSlashRedirect,
321
+ setFarmTrailingSlashPreference
322
+ } from "./chunk-4O26BPUY.mjs";
316
323
  import {
317
324
  createFarmCacheKey
318
325
  } from "./chunk-GLOICKDO.mjs";
@@ -442,6 +449,8 @@ function getRouteSpecificity(entry) {
442
449
  function compareRouteEntries(left, right) {
443
450
  return compareRouteSpecificity(getRouteSpecificity(left), getRouteSpecificity(right));
444
451
  }
452
+ var PLAN_SOURCE = /\.(?:[cm]?[jt]sx?|vue|svelte)$/;
453
+ var NODE_MODULES_SEGMENT = `${path2.sep}node_modules${path2.sep}`;
445
454
  var RouteManager = class _RouteManager {
446
455
  constructor(config, viteServer) {
447
456
  this.routes = /* @__PURE__ */ new Map();
@@ -460,6 +469,14 @@ var RouteManager = class _RouteManager {
460
469
  this.programmaticClientRoutes = mergeProgrammaticClientRoutes([]);
461
470
  this.discovery = Promise.resolve();
462
471
  this.reportedIslandsErrors = /* @__PURE__ */ new Set();
472
+ // Each route module's hydration plan from the last plan, with the source files it read, so a dev
473
+ // replan recomputes only the modules that read an edited file. Every replan used to read and
474
+ // walk every route's import graph again, seconds on a large app, before an edit could update.
475
+ this.ownerPlans = /* @__PURE__ */ new Map();
476
+ this.sourceChangeTracking = false;
477
+ this.linkedSources = /* @__PURE__ */ new Map();
478
+ // Source files edited since the last plan; null when the next plan must recompute every module.
479
+ this.editedSources = null;
463
480
  this.config = config;
464
481
  this.viteServer = viteServer;
465
482
  if (viteServer) trackProgrammaticRouteSources();
@@ -775,10 +792,88 @@ var RouteManager = class _RouteManager {
775
792
  return this.clientManifestCache.manifest;
776
793
  }
777
794
  const cacheFile = this.packageClientBoundaryCacheFile;
778
- return cacheFile ? runWithPackageClientBoundaryCacheFile(
779
- cacheFile,
780
- () => this.computeClientManifest(normalizedProjectRoot)
781
- ) : this.computeClientManifest(normalizedProjectRoot);
795
+ const compute = () => withFarmSourceSnapshot(
796
+ () => this.computeClientManifest(normalizedProjectRoot),
797
+ this.sourceSnapshot
798
+ );
799
+ return cacheFile ? runWithPackageClientBoundaryCacheFile(cacheFile, compute) : compute();
800
+ }
801
+ /**
802
+ * @internal The dev server reports every watched change (`noteSourceChange`), so a replan can
803
+ * reuse the plan of each route module that read none of the edited files. Without tracking,
804
+ * every plan recomputes every module.
805
+ */
806
+ trackSourceChanges() {
807
+ this.sourceChangeTracking = true;
808
+ this.sourceSnapshot ?? (this.sourceSnapshot = new FarmSourceSnapshotStore());
809
+ }
810
+ /**
811
+ * @internal A watched file changed. An edit to a script narrows the next replan to the route
812
+ * modules that read it; a script added or removed (where an import may now resolve), or a
813
+ * changed JSON file (a package manifest or tsconfig paths), replans everything. Other files
814
+ * (stylesheets, Markdown, assets) are not read by plans.
815
+ */
816
+ noteSourceChange(file, event) {
817
+ if (file.endsWith(".d.ts")) return;
818
+ if (PLAN_SOURCE.test(file)) {
819
+ if (event === "update") {
820
+ this.editedSources?.add(path2.resolve(file));
821
+ return;
822
+ }
823
+ } else if (!/\.jsonc?$/.test(file)) {
824
+ return;
825
+ }
826
+ this.editedSources = null;
827
+ this.sourceSnapshot?.clear();
828
+ this.linkedSources.clear();
829
+ }
830
+ /**
831
+ * @internal Whether an edit to `file` leaves the current plan as it is: a client module the
832
+ * last plan read whose directive, island and hydrate exports, export shape and imports the edit
833
+ * kept. The next replan reads it again (the watcher reported it).
834
+ */
835
+ isEditPlanNeutral(file) {
836
+ if (!this.sourceChangeTracking || !this.editedSources || !this.clientManifestCache) {
837
+ return false;
838
+ }
839
+ const previous = this.sourceSnapshot?.peekSource(path2.resolve(file));
840
+ return previous !== void 0 && isFarmClientModulePlanUnchanged(file, previous);
841
+ }
842
+ /**
843
+ * A route module's plan: the last one when it read none of `edited`, recomputed otherwise.
844
+ * Callers get a copy, since the route budget rewrites a plan's fields in place.
845
+ */
846
+ planRouteModule(key, edited, compute) {
847
+ const previous = this.ownerPlans.get(key);
848
+ if (previous && edited && ![...edited].some((file) => previous.files.has(file))) {
849
+ return { ...previous.plan };
850
+ }
851
+ const { result, files } = traceFarmSourceReads(compute);
852
+ const sources = /* @__PURE__ */ new Set();
853
+ for (const file of files) {
854
+ const source = this.planSourcePath(file);
855
+ if (source) sources.add(source);
856
+ }
857
+ this.ownerPlans.set(key, { plan: result, files: sources });
858
+ return { ...result };
859
+ }
860
+ /**
861
+ * The path the watcher reports for a file a plan read: itself, or the real path of a workspace
862
+ * package's source read through its `node_modules` link. Null for an installed package's file.
863
+ */
864
+ planSourcePath(file) {
865
+ if (!file.includes(NODE_MODULES_SEGMENT)) return file;
866
+ let source = this.linkedSources.get(file);
867
+ if (source === void 0) {
868
+ try {
869
+ const real = realpathSync(file);
870
+ source = real.includes(NODE_MODULES_SEGMENT) ? null : real;
871
+ } catch {
872
+ source = null;
873
+ }
874
+ this.linkedSources.set(file, source);
875
+ }
876
+ return source;
782
877
  }
783
878
  /**
784
879
  * @internal Keep package client-boundary inspections in `file` between plans, as the dev server
@@ -787,6 +882,15 @@ var RouteManager = class _RouteManager {
787
882
  usePackageClientBoundaryCacheFile(file) {
788
883
  this.packageClientBoundaryCacheFile = file;
789
884
  }
885
+ /**
886
+ * @internal Run `operation` (synchronous) with the package inspections of the latest plan, as
887
+ * the dev server's transforms and renders inspect the packages a module imports. Without a cache
888
+ * file (outside the dev server), it runs as it is.
889
+ */
890
+ inspectPackages(operation) {
891
+ const file = this.packageClientBoundaryCacheFile;
892
+ return file ? runWithLatestPackageClientBoundaryCache(file, operation) : operation();
893
+ }
790
894
  computeClientManifest(normalizedProjectRoot) {
791
895
  const toUrlPath = (absolutePath) => {
792
896
  const rootRelative = toRootRelativeUrlPath(absolutePath, normalizedProjectRoot);
@@ -820,27 +924,50 @@ var RouteManager = class _RouteManager {
820
924
  Boolean(unsupportedIntegrationProvider)
821
925
  );
822
926
  const islandsMode = resolveFarmServerComponentsMode(this.config.experimental?.serverComponents) === "islands";
927
+ const changed = this.sourceSnapshot?.refresh(this.editedSources ?? []);
928
+ let edited = null;
929
+ if (this.sourceChangeTracking && this.editedSources && this.ownerPlans.size > 0) {
930
+ edited = /* @__PURE__ */ new Set();
931
+ for (const [file, previous] of changed ?? []) {
932
+ if (isFarmClientModulePlanUnchanged(file, previous)) continue;
933
+ const source = this.planSourcePath(file);
934
+ if (source) edited.add(source);
935
+ }
936
+ }
937
+ if (!edited) this.ownerPlans.clear();
823
938
  const layoutEntries = Array.from(this.layouts.values()).map((entry) => ({
824
939
  entry,
825
- metadata: getClientModuleHydrationPlan(
826
- entry.modulePath,
827
- normalizedProjectRoot,
828
- isolatedMode,
829
- islandsMode ? { ...planOptions, serverTreeLayouts: true } : planOptions
940
+ metadata: this.planRouteModule(
941
+ `layout:${entry.modulePath}`,
942
+ edited,
943
+ () => getClientModuleHydrationPlan(
944
+ entry.modulePath,
945
+ normalizedProjectRoot,
946
+ isolatedMode,
947
+ islandsMode ? { ...planOptions, serverTreeLayouts: true } : planOptions
948
+ )
830
949
  )
831
950
  }));
832
- const markdownPagePlan = createMarkdownPageHydrationPlanner(
951
+ const markdownComponentsPlan = createMarkdownPageHydrationPlanner(
833
952
  resolveFarmMdxComponentsModulePath(resolveMdxConfig(this.config.mdx), normalizedProjectRoot),
834
953
  normalizedProjectRoot,
835
954
  isolatedMode,
836
955
  { ...planOptions, packageReferences: islandsMode }
837
956
  );
957
+ let markdownPlan;
958
+ const markdownPagePlan = () => ({
959
+ ...markdownPlan ?? (markdownPlan = this.planRouteModule("markdown", edited, markdownComponentsPlan))
960
+ });
838
961
  const routeEntries = Array.from(this.routes.values()).map((entry) => ({
839
962
  entry,
840
- metadata: isFarmMarkdownPageFile(entry.modulePath) ? markdownPagePlan() : getClientModuleHydrationPlan(entry.modulePath, normalizedProjectRoot, isolatedMode, {
841
- ...planOptions,
842
- serverOwners: resolveFarmServerComponentsMode(this.config.experimental?.serverComponents) === "islands"
843
- })
963
+ metadata: isFarmMarkdownPageFile(entry.modulePath) ? markdownPagePlan() : this.planRouteModule(
964
+ `page:${entry.modulePath}`,
965
+ edited,
966
+ () => getClientModuleHydrationPlan(entry.modulePath, normalizedProjectRoot, isolatedMode, {
967
+ ...planOptions,
968
+ serverOwners: resolveFarmServerComponentsMode(this.config.experimental?.serverComponents) === "islands"
969
+ })
970
+ )
844
971
  }));
845
972
  const markdownFallback = routeEntries.find(
846
973
  ({ entry, metadata }) => isFarmMarkdownPageFile(entry.modulePath) && metadata.fallbackReason
@@ -997,6 +1124,7 @@ var RouteManager = class _RouteManager {
997
1124
  logger.error(`[Farm.js] islands mode cannot hydrate ${error}`);
998
1125
  }
999
1126
  const manifest = { routes, layouts, slots };
1127
+ this.editedSources = this.sourceChangeTracking ? /* @__PURE__ */ new Set() : null;
1000
1128
  this.clientManifestCache = {
1001
1129
  projectRoot: normalizedProjectRoot,
1002
1130
  manifest,
@@ -2882,7 +3010,28 @@ function inferFarmIslandStrategy(filePath, root) {
2882
3010
  });
2883
3011
  return result;
2884
3012
  }
3013
+ var routeRootInferences = /* @__PURE__ */ new Map();
3014
+ function invalidateFarmRouteRootInferences() {
3015
+ routeRootInferences.clear();
3016
+ }
2885
3017
  function inferFarmRouteRootStrategy(owners, root) {
3018
+ const key = [root ?? "", ...owners.map((owner) => path6.resolve(owner))].join("\n");
3019
+ const cached = routeRootInferences.get(key);
3020
+ if (cached && cached.stamps.every(([read2, stamp]) => modifiedAt(read2) === stamp)) {
3021
+ return cached.result;
3022
+ }
3023
+ const { result, files } = traceFarmSourceReads(() => inferRouteRoot(owners, root));
3024
+ const read = new Set([...files, ...result.files].filter((file) => !isInstalledPackageFile(file)));
3025
+ routeRootInferences.set(key, {
3026
+ stamps: [...read].map((file) => [file, modifiedAt(file)]),
3027
+ result
3028
+ });
3029
+ return result;
3030
+ }
3031
+ function isInstalledPackageFile(file) {
3032
+ return file.split(path6.sep).includes("node_modules");
3033
+ }
3034
+ function inferRouteRoot(owners, root) {
2886
3035
  const files = [];
2887
3036
  const modules = [];
2888
3037
  for (const owner of owners) {
@@ -3655,6 +3804,11 @@ var ServerRenderer = class {
3655
3804
  return this.rendererRuntime.wrapClientGraph(element);
3656
3805
  }
3657
3806
  /** The page a hydrating layout keeps as server HTML: islands again, or a server tree. */
3807
+ /** The route root's strategy, inspecting packages with the dev server's latest plan's cache. */
3808
+ resolveRouteRootStrategy(...args) {
3809
+ const resolve3 = () => resolveFarmRouteRootStrategy(...args);
3810
+ return typeof this.routeManager.inspectPackages === "function" ? this.routeManager.inspectPackages(resolve3) : resolve3();
3811
+ }
3658
3812
  async isolateServerPage(element, serverTree) {
3659
3813
  if (islands && this.islandValues()) {
3660
3814
  const runtime = islands;
@@ -3730,7 +3884,11 @@ var ServerRenderer = class {
3730
3884
  );
3731
3885
  return { html: rendered.html, head: rendered.head || "" };
3732
3886
  }
3733
- return { html: await this.renderElementToCompleteHTML(element, options), head: "" };
3887
+ const { head, body } = takeFarmHoistedHead(
3888
+ await this.renderElementToCompleteHTML(element, options),
3889
+ true
3890
+ );
3891
+ return { html: body, head };
3734
3892
  }
3735
3893
  /** Islands mode sends large prop values once, keyed by content (RFC 0003). */
3736
3894
  islandValues() {
@@ -3890,7 +4048,11 @@ var ServerRenderer = class {
3890
4048
  key,
3891
4049
  { html },
3892
4050
  {
3893
- paths: [options.pathname],
4051
+ // revalidatePath() takes the route path (`/pricing`), as the docs show, while the shell
4052
+ // answers the public one (`/console/fr/pricing`): either clears it, as in production.
4053
+ paths: [
4054
+ .../* @__PURE__ */ new Set([options.pathname, this.routeManager.toRoutePathname(options.pathname)])
4055
+ ],
3894
4056
  tags: ["ppr"],
3895
4057
  revalidate: options.revalidate ?? false
3896
4058
  }
@@ -4494,7 +4656,7 @@ var ServerRenderer = class {
4494
4656
  (metadata) => metadata.shouldHydrate && metadata.islandStrategy ? [metadata.islandStrategy] : []
4495
4657
  )
4496
4658
  ];
4497
- const hydrationIslandStrategy = this.islandValues() ? resolveFarmRouteRootStrategy(
4659
+ const hydrationIslandStrategy = this.islandValues() ? this.resolveRouteRootStrategy(
4498
4660
  route,
4499
4661
  { shouldHydrate, islandStrategy: moduleMetadata.islandStrategy ?? null },
4500
4662
  layouts.map((layout, index) => ({
@@ -5210,13 +5372,15 @@ var ServerRenderer = class {
5210
5372
  const server = this.getDefaultMCPServer();
5211
5373
  const request2 = getCurrentRequestOrNull() ?? createWebRequestFromFarmRequest(req, { trustProxy: this.config.server?.trustProxy });
5212
5374
  try {
5213
- const { handleFarmDefaultMCPRequest } = await import("./agent-mcp-handler-CPU354QQ.mjs");
5375
+ const { handleFarmDefaultMCPRequest } = await import("./agent-mcp-handler-VIT4GOSR.mjs");
5214
5376
  const origin = new URL(request2.url).origin;
5215
5377
  const i18n = this.i18nRuntime?.config;
5378
+ const metadataBase = await this.getRootMetadataBase();
5216
5379
  const response = await handleFarmDefaultMCPRequest(request2, {
5217
5380
  server,
5218
5381
  basePath: this.config.basePath,
5219
5382
  i18n,
5383
+ metadataBase,
5220
5384
  listPages: async () => {
5221
5385
  const sources = await Promise.all(
5222
5386
  this.getAgentListedRoutes().map(async ([pattern, route]) => {
@@ -5229,6 +5393,7 @@ var ServerRenderer = class {
5229
5393
  sources.filter((source) => source !== null),
5230
5394
  {
5231
5395
  origin,
5396
+ metadataBase,
5232
5397
  basePath: this.config.basePath,
5233
5398
  markdown: resolveMarkdownConfig(this.config.md),
5234
5399
  trailingSlash: this.config.trailingSlash,
@@ -5313,16 +5478,17 @@ var ServerRenderer = class {
5313
5478
  };
5314
5479
  }
5315
5480
  /**
5316
- * The origin llms.txt and llms-full.txt link to: the root layout's `metadataBase`, else the
5317
- * request's origin, as for the sitemap and the production server.
5481
+ * The origin llms.txt, llms-full.txt and list_pages link to: the root layout's
5482
+ * `metadataBase`, else the request's origin, as for the sitemap and the production server.
5318
5483
  */
5319
5484
  async getAgentOrigin(request2) {
5485
+ return resolveFarmAgentOrigin(await this.getRootMetadataBase(), new URL(request2.url).origin);
5486
+ }
5487
+ /** The root layout's `metadataBase`, which generated agent files and list_pages link to. */
5488
+ async getRootMetadataBase() {
5320
5489
  const rootLayout = this.routeManager.getLayouts().get("/");
5321
5490
  const rootMetadata = rootLayout ? (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).metadata : void 0;
5322
- return resolveFarmAgentOrigin(
5323
- rootMetadata?.metadataBase,
5324
- new URL(request2.url).origin
5325
- );
5491
+ return rootMetadata?.metadataBase;
5326
5492
  }
5327
5493
  /**
5328
5494
  * Reads page mirrors back through this dev server, the way its .md handler
@@ -5466,7 +5632,7 @@ var ServerRenderer = class {
5466
5632
  options.middlewareMap,
5467
5633
  () => _runWithMiddlewareContext(
5468
5634
  options.middlewareContext,
5469
- () => this.rendererRuntime.renderToString(wrapped, rendererRenderOptions())
5635
+ () => this.renderElementToCompleteHTML(wrapped)
5470
5636
  )
5471
5637
  );
5472
5638
  res.statusCode = options.statusCode;
@@ -5928,11 +6094,20 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
5928
6094
  <body class="">${earlyClient ? `
5929
6095
  ${earlyClientScript}` : ""}
5930
6096
  <div id="root">`;
5931
- const securedShell = streamDocument ? "" : stampDocumentHTML(shell);
5932
- if (securedShell) {
5933
- htmlParts.push(securedShell);
5934
- staticShellParts?.push(securedShell);
5935
- }
6097
+ let pendingShell = streamDocument ? "" : stampDocumentHTML(shell);
6098
+ let heldHead = "";
6099
+ const releaseShell = (complete) => {
6100
+ const split = takeFarmHoistedHead(heldHead, complete);
6101
+ if (!split) return null;
6102
+ const shellHead = !hasExplicitTitle && /<title[\s>]/i.test(split.head) ? removeFarmDocumentTitles(pendingShell) : pendingShell;
6103
+ const opened = appendFarmHead(shellHead, split.head);
6104
+ pendingShell = "";
6105
+ heldHead = "";
6106
+ htmlParts.push(opened);
6107
+ staticShellParts?.push(opened);
6108
+ res.write(opened);
6109
+ return split.body;
6110
+ };
5936
6111
  const withEarlyClient = (document) => earlyClient ? {
5937
6112
  ...document,
5938
6113
  html: document.html.replace(
@@ -6012,6 +6187,7 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
6012
6187
  const writableStream = new Writable({
6013
6188
  write(chunk, encoding, callback) {
6014
6189
  if (flushMarker && chunk === flushMarker) {
6190
+ if (pendingShell) releaseShell(true);
6015
6191
  const marker = documentTransform ? documentTransform.write(flushMarker.toString()) : flushMarker;
6016
6192
  res.write(marker, () => {
6017
6193
  if (typeof res.flush === "function") res.flush();
@@ -6024,7 +6200,18 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
6024
6200
  firstChunk = false;
6025
6201
  }
6026
6202
  const chunkText = Buffer.isBuffer(chunk) ? cspStreamDecoder ? cspStreamDecoder.decode(chunk, { stream: true }) : chunk.toString() : String(chunk);
6027
- const securedChunkText = cspNonceRewriter ? cspNonceRewriter.write(chunkText) : chunkText;
6203
+ let securedChunkText = cspNonceRewriter ? cspNonceRewriter.write(chunkText) : chunkText;
6204
+ let held = false;
6205
+ if (pendingShell) {
6206
+ heldHead += securedChunkText;
6207
+ const body = releaseShell(false);
6208
+ if (body === null) {
6209
+ callback();
6210
+ return;
6211
+ }
6212
+ securedChunkText = body;
6213
+ held = true;
6214
+ }
6028
6215
  const outputText = documentTransform ? documentTransform.write(securedChunkText) : securedChunkText;
6029
6216
  recordRenderedChunk(outputText, securedChunkText);
6030
6217
  const onWrite = () => {
@@ -6034,10 +6221,18 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
6034
6221
  if (documentTransform) {
6035
6222
  if (outputText) res.write(outputText, onWrite);
6036
6223
  else callback();
6037
- } else if (cspNonceRewriter) res.write(securedChunkText, onWrite);
6224
+ } else if (cspNonceRewriter || held) res.write(securedChunkText, onWrite);
6038
6225
  else res.write(chunk, encoding, onWrite);
6039
6226
  },
6040
6227
  final: (callback) => {
6228
+ if (pendingShell) {
6229
+ const body = releaseShell(true);
6230
+ if (body) {
6231
+ htmlParts.push(body);
6232
+ staticShellParts?.push(body);
6233
+ res.write(body);
6234
+ }
6235
+ }
6041
6236
  if (lateNavigationError) {
6042
6237
  const navigationError = lateNavigationError;
6043
6238
  lateNavigationError = null;
@@ -6110,7 +6305,6 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
6110
6305
  });
6111
6306
  resolve3();
6112
6307
  };
6113
- res.write(securedShell);
6114
6308
  if (typeof res.flush === "function") {
6115
6309
  res.flush();
6116
6310
  }
@@ -6226,11 +6420,10 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
6226
6420
  const NotFoundComponent = await this.loadNotFoundComponent();
6227
6421
  if (NotFoundComponent) {
6228
6422
  try {
6229
- content = await this.rendererRuntime.renderToString(
6423
+ content = await this.renderElementToCompleteHTML(
6230
6424
  await this.wrapWithIntegrationProviders(
6231
6425
  this.rendererRuntime.createElement(NotFoundComponent, { pathname })
6232
- ),
6233
- rendererRenderOptions()
6426
+ )
6234
6427
  );
6235
6428
  } catch (error2) {
6236
6429
  logger.warn(`not-found page could not render outside its layout, using Farm's: ${error2}`);
@@ -6292,10 +6485,7 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
6292
6485
  });
6293
6486
  }
6294
6487
  element = await this.wrapWithIntegrationProviders(element);
6295
- const content = await this.rendererRuntime.renderToString(
6296
- element,
6297
- rendererRenderOptions()
6298
- );
6488
+ const content = await this.renderElementToCompleteHTML(element);
6299
6489
  const { head: head2, metadata: metadata2 } = await this.notFoundMetadataHead(layoutModule, notFoundModule);
6300
6490
  const html2 = this.createFullHTML(content, false, pathname, head2, { req, metadata: metadata2 });
6301
6491
  res.setHeader("Content-Type", "text/html; charset=utf-8");
@@ -7476,17 +7666,23 @@ function mergeNoExternal(farmValue, userValue) {
7476
7666
  const normalize = (value) => value == null || value === true ? [] : Array.isArray(value) ? value : [value];
7477
7667
  return Array.from(/* @__PURE__ */ new Set([...normalize(farmValue), ...normalize(userValue)]));
7478
7668
  }
7479
- function mergeAlias(farmValue, userValue) {
7669
+ function mergeFarmViteAlias(farmValue, userValue) {
7480
7670
  if (!farmValue) return userValue || {};
7481
7671
  if (!userValue) return farmValue;
7482
7672
  if (!Array.isArray(farmValue) && !Array.isArray(userValue)) {
7483
7673
  return {
7484
- ...farmValue,
7485
- ...userValue
7674
+ ...userValue,
7675
+ ...Object.fromEntries(
7676
+ Object.entries(farmValue).filter(
7677
+ ([find]) => !Object.prototype.hasOwnProperty.call(userValue, find)
7678
+ )
7679
+ )
7486
7680
  };
7487
7681
  }
7488
7682
  const normalize = (value) => Array.isArray(value) ? [...value] : Object.entries(value).map(([find, replacement]) => ({ find, replacement }));
7489
- return [...normalize(userValue), ...normalize(farmValue)];
7683
+ const userEntries = normalize(userValue);
7684
+ const userNames = new Set(userEntries.map((entry) => entry.find));
7685
+ return [...userEntries, ...normalize(farmValue).filter((entry) => !userNames.has(entry.find))];
7490
7686
  }
7491
7687
  function mergeFarmViteConfig(farmConfig, userConfig = {}) {
7492
7688
  const noDiscovery = userConfig.optimizeDeps?.noDiscovery ?? farmConfig.optimizeDeps?.noDiscovery;
@@ -7502,7 +7698,7 @@ function mergeFarmViteConfig(farmConfig, userConfig = {}) {
7502
7698
  resolve: {
7503
7699
  ...farmConfig.resolve,
7504
7700
  ...userConfig.resolve,
7505
- alias: mergeAlias(farmConfig.resolve?.alias, userConfig.resolve?.alias),
7701
+ alias: mergeFarmViteAlias(farmConfig.resolve?.alias, userConfig.resolve?.alias),
7506
7702
  dedupe: Array.from(
7507
7703
  /* @__PURE__ */ new Set([...farmConfig.resolve?.dedupe || [], ...userConfig.resolve?.dedupe || []])
7508
7704
  )
@@ -7538,7 +7734,33 @@ function mergeExternal(farmValue, userValue) {
7538
7734
  if (farmValue === true || userValue === true) return true;
7539
7735
  return Array.from(/* @__PURE__ */ new Set([...farmValue, ...userValue]));
7540
7736
  }
7541
- function mergeFarmProductionViteConfig(farmConfig, userConfig = {}) {
7737
+ var FARM_CLIENT_OWNED_OUTPUT_OPTIONS = [
7738
+ "dir",
7739
+ "file",
7740
+ "format",
7741
+ "entryFileNames",
7742
+ "chunkFileNames",
7743
+ "assetFileNames",
7744
+ "hashCharacters"
7745
+ ];
7746
+ function isFarmOwnedClientOutputOption(key) {
7747
+ return FARM_CLIENT_OWNED_OUTPUT_OPTIONS.includes(key) || key.startsWith("sourcemap");
7748
+ }
7749
+ function mergeFarmClientOutputOptions(farmOutput, userOutput) {
7750
+ if (userOutput === void 0) return farmOutput;
7751
+ if (Array.isArray(userOutput) || Array.isArray(farmOutput)) {
7752
+ throw new Error(
7753
+ "Farm builds one client output: set vite.build.rolldownOptions.output (or rollupOptions.output) to an object, not an array."
7754
+ );
7755
+ }
7756
+ const app = Object.fromEntries(
7757
+ Object.entries(userOutput).filter(
7758
+ ([key, value]) => value !== void 0 && !isFarmOwnedClientOutputOption(key)
7759
+ )
7760
+ );
7761
+ return { ...app, ...farmOutput };
7762
+ }
7763
+ function mergeFarmProductionViteConfig(farmConfig, userConfig = {}, options = {}) {
7542
7764
  const {
7543
7765
  plugins: _plugins,
7544
7766
  root: _root,
@@ -7566,13 +7788,15 @@ function mergeFarmProductionViteConfig(farmConfig, userConfig = {}) {
7566
7788
  } = userBuild;
7567
7789
  const {
7568
7790
  input: _input,
7569
- output: _output,
7791
+ output: userOutput,
7570
7792
  ...userBundlerOptions
7571
7793
  } = {
7572
7794
  ...userRollupOptions,
7573
7795
  ...userRolldownOptions
7574
7796
  };
7575
7797
  const merged = mergeFarmViteConfig(farmConfig, shared);
7798
+ const farmBundlerOptions = farmConfig.build?.rollupOptions;
7799
+ const output = options.clientOutput ? mergeFarmClientOutputOptions(farmBundlerOptions?.output, userOutput) : farmBundlerOptions?.output;
7576
7800
  return {
7577
7801
  ...merged,
7578
7802
  build: {
@@ -7580,7 +7804,8 @@ function mergeFarmProductionViteConfig(farmConfig, userConfig = {}) {
7580
7804
  ...farmConfig.build,
7581
7805
  rollupOptions: {
7582
7806
  ...userBundlerOptions,
7583
- ...farmConfig.build?.rollupOptions
7807
+ ...farmBundlerOptions,
7808
+ ...output === void 0 ? {} : { output }
7584
7809
  }
7585
7810
  },
7586
7811
  css: farmConfig.css || userCss ? { ...farmConfig.css, ...userCss } : void 0,
@@ -7630,6 +7855,7 @@ export {
7630
7855
  generateFarmIntegrationProviderClientCode,
7631
7856
  generateFarmIntegrationProviderServerModules,
7632
7857
  inferFarmIslandStrategy,
7858
+ invalidateFarmRouteRootInferences,
7633
7859
  resolveFarmRouteRootStrategy,
7634
7860
  canBootFarmIslandsClient,
7635
7861
  ServerRenderer,
@@ -7655,6 +7881,7 @@ export {
7655
7881
  createFarmClientOptimizeDepsEntries,
7656
7882
  createFarmClientOptimizeDepsConfig,
7657
7883
  createFarmSourceAlias,
7884
+ mergeFarmViteAlias,
7658
7885
  mergeFarmViteConfig,
7659
7886
  mergeFarmProductionViteConfig,
7660
7887
  createFarmThemeCssPlugin