@farm.js/core 0.1.72 → 0.1.73

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 (200) hide show
  1. package/dist/{agent-mcp-handler-VIT4GOSR.mjs → agent-mcp-handler-RK7LDYEL.mjs} +4 -4
  2. package/dist/{agent-mcp-handler-KE4J3W7S.cjs → agent-mcp-handler-VBCA3WZ6.cjs} +5 -5
  3. package/dist/{agent-mcp.d-BO3rZXEM.d.ts → agent-mcp.d-D_gHjCAE.d.ts} +1 -1
  4. package/dist/{agent-mcp.d-Cwff7lcA.d.mts → agent-mcp.d-PvEf-1mi.d.mts} +1 -1
  5. package/dist/agent-runtime.d.mts +2 -2
  6. package/dist/agent-runtime.d.ts +2 -2
  7. package/dist/{analyzer-5Q75LTIL.mjs → analyzer-MFYCJT75.mjs} +2 -2
  8. package/dist/analyzer-V5ZMRIIY.cjs +16 -0
  9. package/dist/api/node.d.mts +4 -4
  10. package/dist/api/node.d.ts +4 -4
  11. package/dist/api/route-manager.d.mts +4 -4
  12. package/dist/api/route-manager.d.ts +4 -4
  13. package/dist/api/runtime.d.mts +3 -3
  14. package/dist/api/runtime.d.ts +3 -3
  15. package/dist/api.d.mts +5 -5
  16. package/dist/api.d.ts +5 -5
  17. package/dist/{app-manifest.d-DwjGkYlP.d.ts → app-manifest.d-BpVTg43i.d.ts} +1 -1
  18. package/dist/{app-manifest.d-USD_IbFd.d.mts → app-manifest.d-CN7cEWHX.d.mts} +1 -1
  19. package/dist/app-markdown.cjs +4 -4
  20. package/dist/app-markdown.d.mts +3 -3
  21. package/dist/app-markdown.d.ts +3 -3
  22. package/dist/app-markdown.mjs +3 -3
  23. package/dist/{app.d-fW06_h8h.d.mts → app.d-BFWzAdTe.d.mts} +10 -4
  24. package/dist/{app.d-DAmF2MAk.d.ts → app.d-DO4PTCWm.d.ts} +10 -4
  25. package/dist/{chunk-OSMUE5ST.mjs → chunk-462MUII7.mjs} +3 -3
  26. package/dist/{chunk-MWUDEYBI.mjs → chunk-4CTCSKAF.mjs} +1 -1
  27. package/dist/{chunk-FSSONJRV.cjs → chunk-4YHGQDTT.cjs} +12 -12
  28. package/dist/{chunk-YCNHUIPR.cjs → chunk-4Z3YLMSW.cjs} +10 -10
  29. package/dist/{chunk-O32QPFVV.cjs → chunk-5PDMBWAF.cjs} +5 -5
  30. package/dist/{chunk-E2V7RRFL.mjs → chunk-6O6PAZZR.mjs} +1 -1
  31. package/dist/{chunk-LXEJNWF5.mjs → chunk-73K53YPP.mjs} +2 -2
  32. package/dist/{chunk-WIJF3PBM.mjs → chunk-7GMBETHM.mjs} +1 -1
  33. package/dist/{chunk-DGNMXL2O.mjs → chunk-B67CW2LM.mjs} +1 -1
  34. package/dist/{chunk-E3LE6EZH.cjs → chunk-CLEWORVY.cjs} +2 -2
  35. package/dist/{chunk-KPJYBSHL.mjs → chunk-CPMME66W.mjs} +149 -22
  36. package/dist/{chunk-VAWDGGW3.mjs → chunk-CYRIIVD4.mjs} +26 -15
  37. package/dist/{chunk-RFWWXEIF.mjs → chunk-FRO4BB2T.mjs} +1 -1
  38. package/dist/{chunk-N3XO5AL5.cjs → chunk-GPO3LJDJ.cjs} +2 -2
  39. package/dist/{chunk-645ENY7W.mjs → chunk-GZOKWJIW.mjs} +4 -4
  40. package/dist/{chunk-NAXKOTPP.cjs → chunk-HFUOLILA.cjs} +21 -21
  41. package/dist/{chunk-C2JOS77Z.cjs → chunk-HGB4PM2C.cjs} +178 -51
  42. package/dist/{chunk-BE7AQXJB.cjs → chunk-HTXKSREF.cjs} +255 -89
  43. package/dist/{chunk-Z3GPAFIA.mjs → chunk-HY6IVQ54.mjs} +1 -1
  44. package/dist/{chunk-3JN5M3T5.mjs → chunk-IBVN7SW5.mjs} +247 -81
  45. package/dist/{chunk-OSEQL34Q.cjs → chunk-ILQ5DKYF.cjs} +2 -2
  46. package/dist/{chunk-AUAMXI6N.mjs → chunk-IXZSBO76.mjs} +1 -1
  47. package/dist/{chunk-77VNYVVX.mjs → chunk-JMOCMXTQ.mjs} +1 -1
  48. package/dist/{chunk-5R4Q5FN7.cjs → chunk-KDOZORJD.cjs} +52 -41
  49. package/dist/{chunk-7QCJDYZQ.cjs → chunk-KTDG4THT.cjs} +2 -2
  50. package/dist/{chunk-L6E4SHUB.cjs → chunk-LGR7565L.cjs} +6 -6
  51. package/dist/chunk-LRPPXKCX.mjs +58 -0
  52. package/dist/{chunk-5XFKWHZD.mjs → chunk-MJEKMT6B.mjs} +95 -106
  53. package/dist/chunk-NDOE76QC.cjs +58 -0
  54. package/dist/{chunk-REP6HWJN.mjs → chunk-OBYM5S5G.mjs} +2 -2
  55. package/dist/{chunk-ZUVAGMQ5.cjs → chunk-ODBM54RT.cjs} +7 -7
  56. package/dist/{chunk-J5ASGNKF.mjs → chunk-OIP62QEL.mjs} +1 -1
  57. package/dist/{chunk-3WG7GJQL.cjs → chunk-OXNZUCHN.cjs} +9 -9
  58. package/dist/{chunk-C5AM2XDN.cjs → chunk-PXAHSCR6.cjs} +4 -4
  59. package/dist/{chunk-BSXKZPFE.mjs → chunk-QGCSUC5O.mjs} +112 -70
  60. package/dist/{chunk-EXN4DTVF.cjs → chunk-QKEZLYON.cjs} +2 -2
  61. package/dist/{chunk-QUYAGU65.mjs → chunk-REK6HZSU.mjs} +267 -231
  62. package/dist/{chunk-5X6OHJEE.cjs → chunk-ROCF6UQD.cjs} +5 -8
  63. package/dist/{chunk-KQAB5LML.mjs → chunk-SUQACHER.mjs} +2 -2
  64. package/dist/{chunk-NV26EGMC.mjs → chunk-SVQX5HYW.mjs} +2 -2
  65. package/dist/{chunk-CBLRSZQL.cjs → chunk-TAU3OF5B.cjs} +223 -234
  66. package/dist/{chunk-IWCYRDRQ.cjs → chunk-TDCP3Z4T.cjs} +3 -3
  67. package/dist/{chunk-TP4RAV7Y.cjs → chunk-TU6VAH4V.cjs} +8 -8
  68. package/dist/{chunk-ZDZUFD67.cjs → chunk-UVQRMUAR.cjs} +1 -1
  69. package/dist/{chunk-JMFTKNBA.mjs → chunk-UVZMSRHF.mjs} +2 -2
  70. package/dist/{chunk-GF22VGMS.cjs → chunk-VPETSSWN.cjs} +2 -2
  71. package/dist/{chunk-AYVGD3PK.mjs → chunk-XI3OXOMK.mjs} +1 -1
  72. package/dist/{chunk-HLMUWKAP.cjs → chunk-XUSJVHHD.cjs} +408 -366
  73. package/dist/{chunk-ET6WW3FY.cjs → chunk-YZK64PZT.cjs} +433 -397
  74. package/dist/{chunk-DS7JGFW5.mjs → chunk-Z3IN6GEX.mjs} +4 -7
  75. package/dist/{client-component.d-ciHeCxr-.d.mts → client-component.d-C71rMuHF.d.mts} +2 -2
  76. package/dist/{client-component.d-9J7CkTWW.d.ts → client-component.d-sF-Znk0j.d.ts} +2 -2
  77. package/dist/{client-plugins.d-JnRz5a1o.d.mts → client-plugins.d-B-Gd9mWR.d.mts} +1 -1
  78. package/dist/{client-plugins.d-CUOhfapO.d.ts → client-plugins.d-MFibjgBg.d.ts} +1 -1
  79. package/dist/client-plugins.d.mts +2 -2
  80. package/dist/client-plugins.d.ts +2 -2
  81. package/dist/client.d.mts +7 -7
  82. package/dist/client.d.ts +7 -7
  83. package/dist/config.d.mts +2 -2
  84. package/dist/config.d.ts +2 -2
  85. package/dist/desktop.d.mts +3 -3
  86. package/dist/desktop.d.ts +3 -3
  87. package/dist/{devtools-IZFUYWPG.cjs → devtools-6K4QXFRL.cjs} +5 -5
  88. package/dist/{devtools-7JPQMSTQ.mjs → devtools-TDIJ6HVC.mjs} +4 -4
  89. package/dist/docs.cjs +8 -8
  90. package/dist/docs.d.mts +3 -3
  91. package/dist/docs.d.ts +3 -3
  92. package/dist/docs.mjs +7 -7
  93. package/dist/environment/vite.cjs +3 -3
  94. package/dist/environment/vite.mjs +2 -2
  95. package/dist/{headers.d-rbbTKGaN.d.mts → headers.d-BUxGJTsj.d.mts} +1 -1
  96. package/dist/{headers.d-CqpTL_fZ.d.ts → headers.d-uQ6BR59u.d.ts} +1 -1
  97. package/dist/index.cjs +24 -22
  98. package/dist/{index.d-CMKvzHLW.d.ts → index.d-BCGfxCXY.d.ts} +1 -1
  99. package/dist/{index.d-D_B2D9Il.d.mts → index.d-CuWOJ-un.d.mts} +1 -1
  100. package/dist/index.d.mts +18 -18
  101. package/dist/index.d.ts +18 -18
  102. package/dist/index.mjs +23 -21
  103. package/dist/integrations/orm.d.mts +2 -2
  104. package/dist/integrations/orm.d.ts +2 -2
  105. package/dist/integrations.d.mts +2 -2
  106. package/dist/integrations.d.ts +2 -2
  107. package/dist/internal/app-markdown-runtime.cjs +3 -3
  108. package/dist/internal/app-markdown-runtime.d.mts +3 -3
  109. package/dist/internal/app-markdown-runtime.d.ts +3 -3
  110. package/dist/internal/app-markdown-runtime.mjs +2 -2
  111. package/dist/internal/build-runtime.cjs +23 -23
  112. package/dist/internal/build-runtime.d.mts +4 -4
  113. package/dist/internal/build-runtime.d.ts +4 -4
  114. package/dist/internal/build-runtime.mjs +22 -22
  115. package/dist/internal/cli-runtime.cjs +9 -9
  116. package/dist/internal/cli-runtime.mjs +8 -8
  117. package/dist/internal/client-error-overlay.cjs +4 -4
  118. package/dist/internal/client-error-overlay.mjs +1 -1
  119. package/dist/internal/client-runtime.d.mts +5 -5
  120. package/dist/internal/client-runtime.d.ts +5 -5
  121. package/dist/internal/compression-runtime.d.mts +2 -2
  122. package/dist/internal/compression-runtime.d.ts +2 -2
  123. package/dist/internal/config-runtime.cjs +6 -6
  124. package/dist/internal/config-runtime.d.mts +4 -4
  125. package/dist/internal/config-runtime.d.ts +4 -4
  126. package/dist/internal/config-runtime.mjs +5 -5
  127. package/dist/internal/infra-analytics-runtime.cjs +9 -9
  128. package/dist/internal/infra-analytics-runtime.mjs +7 -7
  129. package/dist/internal/native-server-fns.cjs +4 -4
  130. package/dist/internal/native-server-fns.mjs +3 -3
  131. package/dist/internal/product-telemetry-runtime.cjs +3 -3
  132. package/dist/internal/product-telemetry-runtime.mjs +2 -2
  133. package/dist/internal/production-runtime.cjs +11 -11
  134. package/dist/internal/production-runtime.d.mts +10 -10
  135. package/dist/internal/production-runtime.d.ts +10 -10
  136. package/dist/internal/production-runtime.mjs +10 -10
  137. package/dist/markdown.cjs +2 -2
  138. package/dist/markdown.d.mts +2 -2
  139. package/dist/markdown.d.ts +2 -2
  140. package/dist/markdown.mjs +1 -1
  141. package/dist/middleware.d.mts +2 -2
  142. package/dist/middleware.d.ts +2 -2
  143. package/dist/{mount.d-ImEO7q8a.d.mts → mount.d-BIYmcGGg.d.mts} +1 -1
  144. package/dist/{mount.d-B0XMxDRh.d.ts → mount.d-q8k0cJV0.d.ts} +1 -1
  145. package/dist/{native-tree-L2IIEBXH.mjs → native-tree-OYGKP2NZ.mjs} +2 -2
  146. package/dist/{native-tree-GF4BH33L.cjs → native-tree-R6CQMDTI.cjs} +3 -3
  147. package/dist/{navigation-delegate.d-RRx1CSlb.d.ts → navigation-delegate.d-Btfs6Uoa.d.ts} +1 -1
  148. package/dist/{navigation-delegate.d-83Q7ksf7.d.mts → navigation-delegate.d-CYBUupsv.d.mts} +1 -1
  149. package/dist/navigation.d.mts +5 -5
  150. package/dist/navigation.d.ts +5 -5
  151. package/dist/{observability.d-B2363jB6.d.mts → observability.d-DdJRiaIX.d.mts} +27 -3
  152. package/dist/{observability.d-B2363jB6.d.ts → observability.d-DdJRiaIX.d.ts} +27 -3
  153. package/dist/observability.d.mts +1 -1
  154. package/dist/observability.d.ts +1 -1
  155. package/dist/plugin.cjs +15 -15
  156. package/dist/plugin.d.mts +5 -5
  157. package/dist/plugin.d.ts +5 -5
  158. package/dist/plugin.mjs +14 -14
  159. package/dist/{render-plan.d-Ds2sXJ5m.d.ts → render-plan.d-0FHusf1D.d.ts} +1 -1
  160. package/dist/{render-plan.d-wP8nTeRV.d.mts → render-plan.d-BlyxqKMu.d.mts} +1 -1
  161. package/dist/renderer-client.d.mts +5 -5
  162. package/dist/renderer-client.d.ts +5 -5
  163. package/dist/{request.d-zpSn6pu_.d.ts → request.d-CPdVjssg.d.ts} +1 -1
  164. package/dist/{request.d-F3h7K37m.d.mts → request.d-CX-gks1l.d.mts} +1 -1
  165. package/dist/request.d.mts +3 -3
  166. package/dist/request.d.ts +3 -3
  167. package/dist/{route-rendering.d-Mw0ZKG2e.d.mts → route-rendering.d-CcvZ_4N2.d.mts} +1 -1
  168. package/dist/{route-rendering.d-BL0_AdKj.d.ts → route-rendering.d-DcOoSNoG.d.ts} +1 -1
  169. package/dist/{router.d-NGVsU11T.d.mts → router.d-C8RHma4A.d.mts} +1 -1
  170. package/dist/{router.d-BwXigemZ.d.ts → router.d-D2QnK8cM.d.ts} +1 -1
  171. package/dist/routes.d.mts +2 -2
  172. package/dist/routes.d.ts +2 -2
  173. package/dist/{rsc-pipeline-DHYZLWSF.mjs → rsc-pipeline-LC2FBZAR.mjs} +5 -5
  174. package/dist/{rsc-pipeline-BNXYMG4G.cjs → rsc-pipeline-NTAM65NT.cjs} +6 -6
  175. package/dist/{runtime-XPYKUNL3.mjs → runtime-MWAC7NWR.mjs} +5 -5
  176. package/dist/{runtime-IWOT6ZVC.cjs → runtime-U4PAMTVH.cjs} +7 -7
  177. package/dist/{runtime.d-OBIZWpx1.d.ts → runtime.d-1l_1bLrL.d.ts} +1 -1
  178. package/dist/{runtime.d-BA3MzhXz.d.mts → runtime.d-BQUHHq8M.d.mts} +1 -1
  179. package/dist/server-plugins.d.mts +4 -4
  180. package/dist/server-plugins.d.ts +4 -4
  181. package/dist/server.cjs +37 -35
  182. package/dist/server.d.mts +11 -11
  183. package/dist/server.d.ts +11 -11
  184. package/dist/server.mjs +20 -18
  185. package/dist/{spa-router.d-DrYT944-.d.ts → spa-router.d-BJtXNeqo.d.ts} +2 -2
  186. package/dist/{spa-router.d-BG2XzE5p.d.mts → spa-router.d-BzPdi48R.d.mts} +2 -2
  187. package/dist/testing.d.mts +2 -2
  188. package/dist/testing.d.ts +2 -2
  189. package/dist/{utils.d-C1k9BJeD.d.mts → utils.d-B4ZW-6z6.d.mts} +1 -1
  190. package/dist/{utils.d-DcF4wxey.d.ts → utils.d-DquC6qxy.d.ts} +1 -1
  191. package/dist/version.cjs +2 -2
  192. package/dist/version.mjs +1 -1
  193. package/dist/vite.cjs +17 -15
  194. package/dist/vite.d.mts +16 -7
  195. package/dist/vite.d.ts +16 -7
  196. package/dist/vite.mjs +16 -14
  197. package/package.json +1 -1
  198. package/dist/analyzer-UJG4MIZW.cjs +0 -16
  199. package/dist/chunk-V3UOEWCB.cjs +0 -46
  200. package/dist/chunk-VE3FWJBO.mjs +0 -46
@@ -26,7 +26,7 @@ import {
26
26
  import {
27
27
  collectFarmNativeServerFns,
28
28
  findFarmNativeScreenFiles
29
- } from "./chunk-WIJF3PBM.mjs";
29
+ } from "./chunk-7GMBETHM.mjs";
30
30
  import {
31
31
  generateNativeMCPPluginSource
32
32
  } from "./chunk-KQH2COEJ.mjs";
@@ -41,7 +41,7 @@ import {
41
41
  hasFarmDocsRuntimeAdapter,
42
42
  listFarmDocsAdapterPages,
43
43
  listFarmDocsPagePaths
44
- } from "./chunk-VAWDGGW3.mjs";
44
+ } from "./chunk-CYRIIVD4.mjs";
45
45
  import {
46
46
  FARM_DOCS_LAST_MODIFIED_MANIFEST,
47
47
  createFarmDocsHandler,
@@ -54,7 +54,7 @@ import {
54
54
  loadFarmDocsPage,
55
55
  resolveFarmDocsContentDir,
56
56
  toFarmDocsMarkdownPage
57
- } from "./chunk-LXEJNWF5.mjs";
57
+ } from "./chunk-73K53YPP.mjs";
58
58
  import {
59
59
  generateFarmDocsSearchClientRuntime,
60
60
  isFarmDocsSearchEnabled,
@@ -65,16 +65,16 @@ import {
65
65
  } from "./chunk-OAEDVXVE.mjs";
66
66
  import {
67
67
  FARM_PRERENDER_ENV
68
- } from "./chunk-DS7JGFW5.mjs";
68
+ } from "./chunk-Z3IN6GEX.mjs";
69
69
  import {
70
70
  loadFarmDocsEngine
71
- } from "./chunk-VE3FWJBO.mjs";
71
+ } from "./chunk-LRPPXKCX.mjs";
72
72
  import {
73
73
  getDefaultDeployOutputDir,
74
74
  getDeployTargetForPreset,
75
75
  hasCustomFarmRouteContext,
76
76
  resolveDeployOutputPath
77
- } from "./chunk-OSMUE5ST.mjs";
77
+ } from "./chunk-462MUII7.mjs";
78
78
  import {
79
79
  resolveFarmInstrumentationFile
80
80
  } from "./chunk-57QAQU4F.mjs";
@@ -110,7 +110,7 @@ import {
110
110
  resolveFarmImageServerRuntime,
111
111
  resolveFarmNotFoundComponentPath,
112
112
  resolveFarmRouteRootStrategy
113
- } from "./chunk-5XFKWHZD.mjs";
113
+ } from "./chunk-MJEKMT6B.mjs";
114
114
  import {
115
115
  generateFarmClientPluginEntryCode,
116
116
  hasFarmServerRuntimePlugins,
@@ -123,7 +123,7 @@ import {
123
123
  generateFarmTypeArtifacts,
124
124
  readRouteRenderingDirectiveFromFile,
125
125
  resolveRouteRenderingConfigFromFile
126
- } from "./chunk-DGNMXL2O.mjs";
126
+ } from "./chunk-B67CW2LM.mjs";
127
127
  import {
128
128
  HOISTED_HEAD_ELEMENT,
129
129
  appMiddlewareMayHandlePath,
@@ -136,7 +136,7 @@ import {
136
136
  layoutsCanCoverSamePage,
137
137
  routeBoundaryCoversDirectory,
138
138
  stripRouteGroups
139
- } from "./chunk-NV26EGMC.mjs";
139
+ } from "./chunk-SVQX5HYW.mjs";
140
140
  import {
141
141
  FARM_NATIVE_TREE_CONTENT_TYPE
142
142
  } from "./chunk-LLZSYFOM.mjs";
@@ -150,15 +150,15 @@ import {
150
150
  listFarmBuiltInRoutePaths,
151
151
  resolveFarmApiCatalogInput,
152
152
  resolveFarmAppManifestInput
153
- } from "./chunk-645ENY7W.mjs";
153
+ } from "./chunk-GZOKWJIW.mjs";
154
154
  import {
155
155
  FARM_DEFAULT_MCP_PATH,
156
156
  createFarmDefaultMCPServer,
157
157
  farmConfigMountsMCP
158
- } from "./chunk-JMFTKNBA.mjs";
158
+ } from "./chunk-UVZMSRHF.mjs";
159
159
  import {
160
160
  isFarmPreviewDeploymentEnvironment
161
- } from "./chunk-AUAMXI6N.mjs";
161
+ } from "./chunk-IXZSBO76.mjs";
162
162
  import {
163
163
  FARM_NATIVE_SERVER_FN_PLUGIN
164
164
  } from "./chunk-L4RTTTVE.mjs";
@@ -175,8 +175,9 @@ import {
175
175
  resolvePackageClientBoundaryCacheFile,
176
176
  usePackageClientBoundaryCacheFile,
177
177
  usesFarmServerTree,
178
+ withFarmSourceSnapshot,
178
179
  withPackageClientBoundaryCache
179
- } from "./chunk-3JN5M3T5.mjs";
180
+ } from "./chunk-IBVN7SW5.mjs";
180
181
  import {
181
182
  generateFarmDocsAdapterClientRuntime,
182
183
  getFarmDocsAdapterConfigModule
@@ -223,14 +224,14 @@ import {
223
224
  } from "./chunk-N33DLJBC.mjs";
224
225
  import {
225
226
  isFarmMarkdownPageFile
226
- } from "./chunk-J5ASGNKF.mjs";
227
+ } from "./chunk-OIP62QEL.mjs";
227
228
  import {
228
229
  resolveFarmMdxComponentsModulePath,
229
230
  resolveMdxConfig
230
231
  } from "./chunk-UIJOLBUL.mjs";
231
232
  import {
232
233
  getFarmMarkdownAlternatePath
233
- } from "./chunk-KPJYBSHL.mjs";
234
+ } from "./chunk-CPMME66W.mjs";
234
235
  import {
235
236
  withPlainDiagnostics
236
237
  } from "./chunk-MGKWYPE3.mjs";
@@ -283,7 +284,7 @@ import {
283
284
  } from "./chunk-2I6PUKWJ.mjs";
284
285
  import {
285
286
  FARM_VERSION
286
- } from "./chunk-77VNYVVX.mjs";
287
+ } from "./chunk-JMOCMXTQ.mjs";
287
288
  import {
288
289
  getFarmPresetRuntime,
289
290
  resolveCloudflareProcessEnvFlags
@@ -300,7 +301,9 @@ import {
300
301
  stripFarmBasePath
301
302
  } from "./chunk-SF3JB56B.mjs";
302
303
  import {
303
- compareRoutePatternSpecificity
304
+ compareRoutePatternSpecificity,
305
+ compareRouteSpecificity,
306
+ getRoutePatternSpecificity
304
307
  } from "./chunk-AYP2YFVN.mjs";
305
308
 
306
309
  // src/build/index.ts
@@ -2702,7 +2705,7 @@ function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, optio
2702
2705
  async function buildClient(productionVite, config, root, srcDir, outputDir, pageRoutes, layoutRoutes = [], routeSlots = [], isolatedClientBoundaryModules = /* @__PURE__ */ new Set(), hydrationPlanCache = /* @__PURE__ */ new Map(), rendererBuildLifetime, programmaticClientRoutes, mobile = false) {
2703
2706
  if (!mobile) await removeFarmMobileClientManifest(path13.dirname(outputDir));
2704
2707
  const viteBuild = productionVite.build;
2705
- const { farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.mjs");
2708
+ const { farmIslandContainersPlugin, farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.mjs");
2706
2709
  const { PluginManager: PluginManager2 } = await import("./plugin-QZT747YW.mjs");
2707
2710
  const fs4 = await import("fs/promises");
2708
2711
  const pluginManager = new PluginManager2({
@@ -2742,51 +2745,6 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2742
2745
  ...planOptions,
2743
2746
  serverTreeLayouts: pagePlanOptions.serverOwners
2744
2747
  };
2745
- const clientLayouts = layoutRoutes.map((layout) => {
2746
- try {
2747
- const metadata = getCachedClientModuleHydrationPlan(
2748
- layout.modulePath,
2749
- root,
2750
- isolatedMode,
2751
- hydrationPlanCache,
2752
- layoutPlanOptions
2753
- );
2754
- return {
2755
- ...layout,
2756
- shouldHydrate: metadata.shouldHydrate,
2757
- islandStrategy: metadata.islandStrategy,
2758
- legacyShouldHydrate: metadata.legacyShouldHydrate,
2759
- legacyIslandStrategy: metadata.legacyIslandStrategy,
2760
- mode: metadata.mode,
2761
- estimatedIsolatedRootCount: metadata.estimatedIsolatedRootCount,
2762
- hasIsolatedClientBoundaries: metadata.hasIsolatedClientBoundaries,
2763
- isolatedHydrationEligible: metadata.isolatedHydrationEligible,
2764
- isolatedBoundaries: metadata.isolatedBoundaries,
2765
- asyncOwnerIslands: metadata.asyncOwnerIslands,
2766
- suppressedAsyncHydration: metadata.suppressedAsyncHydration,
2767
- fallbackReason: metadata.fallbackReason,
2768
- serverTreeLayout: metadata.serverTreeLayout
2769
- };
2770
- } catch (error) {
2771
- logger.warn(`\u26A0\uFE0F Could not inspect layout file ${layout.modulePath}: ${error}`);
2772
- return {
2773
- ...layout,
2774
- shouldHydrate: false,
2775
- islandStrategy: null,
2776
- legacyShouldHydrate: false,
2777
- legacyIslandStrategy: null,
2778
- mode: isolatedMode,
2779
- estimatedIsolatedRootCount: 0,
2780
- hasIsolatedClientBoundaries: false,
2781
- isolatedHydrationEligible: false,
2782
- isolatedBoundaries: [],
2783
- asyncOwnerIslands: void 0,
2784
- suppressedAsyncHydration: void 0,
2785
- fallbackReason: void 0,
2786
- serverTreeLayout: void 0
2787
- };
2788
- }
2789
- });
2790
2748
  const layoutAppliesToRoute = routeBoundaryCoversDirectory;
2791
2749
  const routeDirectory = (route) => route.directory ?? route.pattern;
2792
2750
  const islandsMode = resolveFarmServerComponentsMode(config.experimental?.serverComponents) === "islands";
@@ -2802,159 +2760,209 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2802
2760
  );
2803
2761
  const syntheticDocsEntry = config.docs?.enabled && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
2804
2762
  const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
2805
- const markdownPagePlan = createMarkdownPageHydrationPlanner(
2806
- resolveFarmMdxComponentsModulePath(resolveMdxConfig(config.mdx), root),
2807
- root,
2808
- isolatedMode,
2809
- { ...planOptions, packageReferences: pagePlanOptions.serverOwners }
2810
- );
2811
- const routePlans = pageRoutes.map((route) => ({
2812
- route,
2813
- metadata: isFarmMarkdownPageFile(route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
2814
- route.modulePath,
2815
- root,
2816
- isolatedMode,
2817
- hydrationPlanCache,
2818
- pagePlanOptions
2819
- )
2820
- }));
2821
- enforceFarmIsolatedHydrationRouteBudget(
2822
- clientLayouts.map((layout) => ({
2823
- pattern: layout.pattern,
2824
- depth: layout.pattern.split("/").filter(Boolean).length,
2825
- metadata: layout
2826
- })),
2827
- [
2828
- ...routePlans.map(({ route, metadata }) => ({
2829
- pattern: routeDirectory(route),
2830
- depth: getRouteDirectoryDepth(routeDirectory(route)),
2831
- metadata
2832
- })),
2833
- ...syntheticDocsPatterns.map((pattern) => ({
2834
- pattern,
2835
- depth: pattern.split("/").filter(Boolean).length,
2836
- metadata: {
2837
- mode: isolatedMode,
2763
+ const { clientLayouts, clientRouteSlots } = withFarmSourceSnapshot(() => {
2764
+ const clientLayouts2 = layoutRoutes.map((layout) => {
2765
+ try {
2766
+ const metadata = getCachedClientModuleHydrationPlan(
2767
+ layout.modulePath,
2768
+ root,
2769
+ isolatedMode,
2770
+ hydrationPlanCache,
2771
+ layoutPlanOptions
2772
+ );
2773
+ return {
2774
+ ...layout,
2775
+ shouldHydrate: metadata.shouldHydrate,
2776
+ islandStrategy: metadata.islandStrategy,
2777
+ legacyShouldHydrate: metadata.legacyShouldHydrate,
2778
+ legacyIslandStrategy: metadata.legacyIslandStrategy,
2779
+ mode: metadata.mode,
2780
+ estimatedIsolatedRootCount: metadata.estimatedIsolatedRootCount,
2781
+ hasIsolatedClientBoundaries: metadata.hasIsolatedClientBoundaries,
2782
+ isolatedHydrationEligible: metadata.isolatedHydrationEligible,
2783
+ isolatedBoundaries: metadata.isolatedBoundaries,
2784
+ asyncOwnerIslands: metadata.asyncOwnerIslands,
2785
+ suppressedAsyncHydration: metadata.suppressedAsyncHydration,
2786
+ fallbackReason: metadata.fallbackReason,
2787
+ serverTreeLayout: metadata.serverTreeLayout
2788
+ };
2789
+ } catch (error) {
2790
+ logger.warn(`\u26A0\uFE0F Could not inspect layout file ${layout.modulePath}: ${error}`);
2791
+ return {
2792
+ ...layout,
2838
2793
  shouldHydrate: false,
2839
2794
  islandStrategy: null,
2840
2795
  legacyShouldHydrate: false,
2841
2796
  legacyIslandStrategy: null,
2797
+ mode: isolatedMode,
2842
2798
  estimatedIsolatedRootCount: 0,
2843
2799
  hasIsolatedClientBoundaries: false,
2844
- isolatedBoundaries: []
2845
- }
2846
- }))
2847
- ],
2848
- layoutAppliesToRoute,
2849
- { serverOwners: islandsMode }
2850
- );
2851
- for (const layout of clientLayouts) {
2852
- const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, routeDirectory(route))) || docsEntries.some((docsEntry) => layoutAppliesToRoute(layout.pattern, docsEntry));
2853
- if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
2854
- logger.warn(`\u26A0\uFE0F ${describeSuppressedAsyncHydration(layout.pattern, layout.fallbackReason)}`);
2855
- }
2856
- }
2857
- if (isolatedMode === "analyze") {
2858
- for (const { entry, metadata } of [
2859
- ...clientLayouts.map((layout) => ({ entry: layout, metadata: layout })),
2860
- ...routePlans.map(({ route, metadata: metadata2 }) => ({ entry: route, metadata: metadata2 }))
2861
- ]) {
2862
- if (!("isolatedHydrationEligible" in metadata) || !metadata.isolatedHydrationEligible) {
2863
- continue;
2800
+ isolatedHydrationEligible: false,
2801
+ isolatedBoundaries: [],
2802
+ asyncOwnerIslands: void 0,
2803
+ suppressedAsyncHydration: void 0,
2804
+ fallbackReason: void 0,
2805
+ serverTreeLayout: void 0
2806
+ };
2864
2807
  }
2865
- logger.info(
2866
- `\u{1F4CA} Isolated hydration analysis: ${entry.modulePath} can exclude its server owner and hydrate ${metadata.isolatedBoundaries.length} client ${metadata.isolatedBoundaries.length === 1 ? "boundary" : "boundaries"}.`
2867
- );
2868
- }
2869
- }
2870
- const serverSlotPlans = islandsMode ? routeSlots.flatMap((slot) => {
2871
- const plan = getCachedClientModuleHydrationPlan(
2872
- slot.modulePath,
2808
+ });
2809
+ const markdownPagePlan = createMarkdownPageHydrationPlanner(
2810
+ resolveFarmMdxComponentsModulePath(resolveMdxConfig(config.mdx), root),
2873
2811
  root,
2874
2812
  isolatedMode,
2875
- hydrationPlanCache,
2876
- { ...pagePlanOptions, serverOwners: true }
2813
+ { ...planOptions, packageReferences: pagePlanOptions.serverOwners }
2877
2814
  );
2878
- return plan.isClientComponent ? [] : [{ slot, plan }];
2879
- }) : [];
2880
- for (const { route, metadata } of routePlans) {
2881
- if (isAdapterDocsRoute(route.pattern)) continue;
2882
- try {
2883
- const applicableClientLayouts = clientLayouts.filter(
2884
- (layout) => (layout.shouldHydrate || layout.hasIsolatedClientBoundaries) && layoutAppliesToRoute(layout.pattern, routeDirectory(route))
2885
- );
2886
- if (metadata.suppressedAsyncHydration) {
2815
+ const routePlans = pageRoutes.map((route) => ({
2816
+ route,
2817
+ metadata: isFarmMarkdownPageFile(route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
2818
+ route.modulePath,
2819
+ root,
2820
+ isolatedMode,
2821
+ hydrationPlanCache,
2822
+ pagePlanOptions
2823
+ )
2824
+ }));
2825
+ enforceFarmIsolatedHydrationRouteBudget(
2826
+ clientLayouts2.map((layout) => ({
2827
+ pattern: layout.pattern,
2828
+ depth: layout.pattern.split("/").filter(Boolean).length,
2829
+ metadata: layout
2830
+ })),
2831
+ [
2832
+ ...routePlans.map(({ route, metadata }) => ({
2833
+ pattern: routeDirectory(route),
2834
+ depth: getRouteDirectoryDepth(routeDirectory(route)),
2835
+ metadata
2836
+ })),
2837
+ ...syntheticDocsPatterns.map((pattern) => ({
2838
+ pattern,
2839
+ depth: pattern.split("/").filter(Boolean).length,
2840
+ metadata: {
2841
+ mode: isolatedMode,
2842
+ shouldHydrate: false,
2843
+ islandStrategy: null,
2844
+ legacyShouldHydrate: false,
2845
+ legacyIslandStrategy: null,
2846
+ estimatedIsolatedRootCount: 0,
2847
+ hasIsolatedClientBoundaries: false,
2848
+ isolatedBoundaries: []
2849
+ }
2850
+ }))
2851
+ ],
2852
+ layoutAppliesToRoute,
2853
+ { serverOwners: islandsMode }
2854
+ );
2855
+ for (const layout of clientLayouts2) {
2856
+ const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, routeDirectory(route))) || docsEntries.some((docsEntry) => layoutAppliesToRoute(layout.pattern, docsEntry));
2857
+ if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
2887
2858
  logger.warn(
2888
- `\u26A0\uFE0F ${describeSuppressedAsyncHydration(route.pattern, metadata.fallbackReason)}`
2859
+ `\u26A0\uFE0F ${describeSuppressedAsyncHydration(layout.pattern, layout.fallbackReason)}`
2889
2860
  );
2890
2861
  }
2891
- const slotBoundaries = serverSlotPlans.filter(
2892
- ({ slot }) => layoutAppliesToRoute(slot.ownerDirectory ?? slot.ownerPattern, routeDirectory(route))
2893
- ).flatMap(({ plan }) => plan.isolatedBoundaries);
2894
- if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0 || slotBoundaries.length > 0) {
2895
- const relativePath = route.modulePath.replace(root, "").replace(/^\//, "");
2896
- const islandStrategy = resolveFarmRouteRootStrategy(
2897
- route,
2898
- metadata,
2899
- clientLayouts,
2900
- root,
2901
- islandsMode
2862
+ }
2863
+ if (isolatedMode === "analyze") {
2864
+ for (const { entry, metadata } of [
2865
+ ...clientLayouts2.map((layout) => ({ entry: layout, metadata: layout })),
2866
+ ...routePlans.map(({ route, metadata: metadata2 }) => ({ entry: route, metadata: metadata2 }))
2867
+ ]) {
2868
+ if (!("isolatedHydrationEligible" in metadata) || !metadata.isolatedHydrationEligible) {
2869
+ continue;
2870
+ }
2871
+ logger.info(
2872
+ `\u{1F4CA} Isolated hydration analysis: ${entry.modulePath} can exclude its server owner and hydrate ${metadata.isolatedBoundaries.length} client ${metadata.isolatedBoundaries.length === 1 ? "boundary" : "boundaries"}.`
2902
2873
  );
2903
- clientPages.push({
2904
- ...route,
2905
- relativePath,
2906
- pageShouldHydrate: metadata.shouldHydrate,
2907
- islandStrategy,
2908
- hasIsolatedClientBoundaries: metadata.hasIsolatedClientBoundaries || applicableClientLayouts.some((layout) => layout.hasIsolatedClientBoundaries) || slotBoundaries.length > 0,
2909
- isolatedBoundaries: [
2910
- ...metadata.hasIsolatedClientBoundaries ? metadata.isolatedBoundaries : [],
2911
- ...slotBoundaries,
2912
- ...applicableClientLayouts.filter((layout) => layout.hasIsolatedClientBoundaries || layout.serverTreeLayout).flatMap((layout) => layout.isolatedBoundaries)
2913
- ],
2914
- // The server renders a server tree only below a hydrating layout.
2915
- ...usesFarmServerTree(metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
2916
- });
2917
- logger.info(`\u{1F4F1} Found hydratable route: ${route.pattern} -> ${route.modulePath}`);
2918
2874
  }
2919
- } catch (error) {
2920
- logger.warn(`\u26A0\uFE0F Could not inspect route file ${route.modulePath}: ${error}`);
2921
2875
  }
2922
- }
2923
- if (syntheticDocsEntry) {
2924
- const docsEntry = syntheticDocsEntry;
2925
- const applicableClientLayouts = clientLayouts.filter(
2926
- (layout) => (layout.shouldHydrate || layout.hasIsolatedClientBoundaries) && layoutAppliesToRoute(layout.pattern, docsEntry)
2927
- );
2928
- if (applicableClientLayouts.length > 0) {
2929
- const hydrationStrategies = applicableClientLayouts.flatMap(
2930
- (layout) => layout.islandStrategy ? [layout.islandStrategy] : []
2876
+ const serverSlotPlans = islandsMode ? routeSlots.flatMap((slot) => {
2877
+ const plan = getCachedClientModuleHydrationPlan(
2878
+ slot.modulePath,
2879
+ root,
2880
+ isolatedMode,
2881
+ hydrationPlanCache,
2882
+ { ...pagePlanOptions, serverOwners: true }
2931
2883
  );
2932
- const islandStrategy = hydrationStrategies.every(
2933
- (strategy) => strategy === hydrationStrategies[0]
2934
- ) ? hydrationStrategies[0] ?? "load" : "load";
2935
- const docsClientRoutes = syntheticDocsPatterns.map((pattern) => ({
2936
- pattern,
2937
- docs: true,
2938
- modulePath: "",
2939
- relativePath: "",
2940
- pageShouldHydrate: false,
2941
- islandStrategy,
2942
- hasIsolatedClientBoundaries: applicableClientLayouts.some(
2943
- (layout) => layout.hasIsolatedClientBoundaries
2944
- ),
2945
- isolatedBoundaries: applicableClientLayouts.filter((layout) => layout.hasIsolatedClientBoundaries || layout.serverTreeLayout).flatMap((layout) => layout.isolatedBoundaries)
2946
- }));
2947
- clientPages.unshift(...docsClientRoutes);
2884
+ return plan.isClientComponent ? [] : [{ slot, plan }];
2885
+ }) : [];
2886
+ for (const { route, metadata } of routePlans) {
2887
+ if (isAdapterDocsRoute(route.pattern)) continue;
2888
+ try {
2889
+ const applicableClientLayouts = clientLayouts2.filter(
2890
+ (layout) => (layout.shouldHydrate || layout.hasIsolatedClientBoundaries) && layoutAppliesToRoute(layout.pattern, routeDirectory(route))
2891
+ );
2892
+ if (metadata.suppressedAsyncHydration) {
2893
+ logger.warn(
2894
+ `\u26A0\uFE0F ${describeSuppressedAsyncHydration(route.pattern, metadata.fallbackReason)}`
2895
+ );
2896
+ }
2897
+ const slotBoundaries = serverSlotPlans.filter(
2898
+ ({ slot }) => layoutAppliesToRoute(slot.ownerDirectory ?? slot.ownerPattern, routeDirectory(route))
2899
+ ).flatMap(({ plan }) => plan.isolatedBoundaries);
2900
+ if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0 || slotBoundaries.length > 0) {
2901
+ const relativePath = route.modulePath.replace(root, "").replace(/^\//, "");
2902
+ const islandStrategy = resolveFarmRouteRootStrategy(
2903
+ route,
2904
+ metadata,
2905
+ clientLayouts2,
2906
+ root,
2907
+ islandsMode
2908
+ );
2909
+ clientPages.push({
2910
+ ...route,
2911
+ relativePath,
2912
+ pageShouldHydrate: metadata.shouldHydrate,
2913
+ islandStrategy,
2914
+ hasIsolatedClientBoundaries: metadata.hasIsolatedClientBoundaries || applicableClientLayouts.some((layout) => layout.hasIsolatedClientBoundaries) || slotBoundaries.length > 0,
2915
+ isolatedBoundaries: [
2916
+ ...metadata.hasIsolatedClientBoundaries ? metadata.isolatedBoundaries : [],
2917
+ ...slotBoundaries,
2918
+ ...applicableClientLayouts.filter((layout) => layout.hasIsolatedClientBoundaries || layout.serverTreeLayout).flatMap((layout) => layout.isolatedBoundaries)
2919
+ ],
2920
+ // The server renders a server tree only below a hydrating layout.
2921
+ ...usesFarmServerTree(metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
2922
+ });
2923
+ logger.info(`\u{1F4F1} Found hydratable route: ${route.pattern} -> ${route.modulePath}`);
2924
+ }
2925
+ } catch (error) {
2926
+ logger.warn(`\u26A0\uFE0F Could not inspect route file ${route.modulePath}: ${error}`);
2927
+ }
2948
2928
  }
2949
- }
2950
- const clientRouteSlots = routeSlots.filter((slot) => {
2951
- try {
2952
- const metadata = getClientModuleMetadata(slot.modulePath, root);
2953
- return metadata.shouldHydrate && (!islandsMode || metadata.isClientComponent);
2954
- } catch (error) {
2955
- logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
2956
- return false;
2929
+ if (syntheticDocsEntry) {
2930
+ const docsEntry = syntheticDocsEntry;
2931
+ const applicableClientLayouts = clientLayouts2.filter(
2932
+ (layout) => (layout.shouldHydrate || layout.hasIsolatedClientBoundaries) && layoutAppliesToRoute(layout.pattern, docsEntry)
2933
+ );
2934
+ if (applicableClientLayouts.length > 0) {
2935
+ const hydrationStrategies = applicableClientLayouts.flatMap(
2936
+ (layout) => layout.islandStrategy ? [layout.islandStrategy] : []
2937
+ );
2938
+ const islandStrategy = hydrationStrategies.every(
2939
+ (strategy) => strategy === hydrationStrategies[0]
2940
+ ) ? hydrationStrategies[0] ?? "load" : "load";
2941
+ const docsClientRoutes = syntheticDocsPatterns.map((pattern) => ({
2942
+ pattern,
2943
+ docs: true,
2944
+ modulePath: "",
2945
+ relativePath: "",
2946
+ pageShouldHydrate: false,
2947
+ islandStrategy,
2948
+ hasIsolatedClientBoundaries: applicableClientLayouts.some(
2949
+ (layout) => layout.hasIsolatedClientBoundaries
2950
+ ),
2951
+ isolatedBoundaries: applicableClientLayouts.filter((layout) => layout.hasIsolatedClientBoundaries || layout.serverTreeLayout).flatMap((layout) => layout.isolatedBoundaries)
2952
+ }));
2953
+ clientPages.unshift(...docsClientRoutes);
2954
+ }
2957
2955
  }
2956
+ const clientRouteSlots2 = routeSlots.filter((slot) => {
2957
+ try {
2958
+ const metadata = getClientModuleMetadata(slot.modulePath, root);
2959
+ return metadata.shouldHydrate && (!islandsMode || metadata.isClientComponent);
2960
+ } catch (error) {
2961
+ logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
2962
+ return false;
2963
+ }
2964
+ });
2965
+ return { clientLayouts: clientLayouts2, clientRouteSlots: clientRouteSlots2 };
2958
2966
  });
2959
2967
  logger.info(
2960
2968
  `\u{1F4F1} Total hydratable routes detected: ${clientPages.length} pages, ${clientLayouts.filter((layout) => layout.shouldHydrate || layout.hasIsolatedClientBoundaries).length} layouts, and ${clientRouteSlots.length} slots`
@@ -3170,6 +3178,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
3170
3178
  }
3171
3179
  }
3172
3180
  },
3181
+ farmIslandContainersPlugin(config),
3173
3182
  farmPlugin(
3174
3183
  { ...config, isolatedClientBoundaryModules, programmaticClientRoutes },
3175
3184
  pluginManager
@@ -6109,7 +6118,7 @@ void hydrate();
6109
6118
  }
6110
6119
  async function buildSSRInMemory(productionVite, config, root, routeManager, apiRouteManager, serverRenderer, preset, collectedPageRoutes, collectedLayoutRoutes, collectedRouteSlots, isolatedClientBoundaryModules, hydrationPlanCache, rendererBuildLifetime) {
6111
6120
  const viteBuild = productionVite.build;
6112
- const { farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.mjs");
6121
+ const { farmIslandContainersPlugin, farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.mjs");
6113
6122
  const { PluginManager: PluginManager2 } = await import("./plugin-QZT747YW.mjs");
6114
6123
  const fs4 = await import("fs/promises");
6115
6124
  const pluginManager = new PluginManager2({
@@ -6471,6 +6480,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
6471
6480
  ] : [],
6472
6481
  { ...createReactProductionModePlugin(), enforce: "pre" },
6473
6482
  farmServerOnlyEntriesPlugin(),
6483
+ farmIslandContainersPlugin(config),
6474
6484
  farmPlugin({ ...config, isolatedClientBoundaryModules }, pluginManager),
6475
6485
  farmEnvironmentFunctionsPlugin(config),
6476
6486
  ...hasRuntimeConfigModule ? [
@@ -7088,34 +7098,37 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
7088
7098
  ...hydrationPlanOptions,
7089
7099
  serverOwners: resolveFarmServerComponentsMode(config.experimental?.serverComponents) === "islands"
7090
7100
  };
7091
- const layoutHydrationPlans = layoutRoutes.map((layout) => ({
7092
- ...layout,
7093
- hydration: getCachedClientModuleHydrationPlan(
7094
- layout.modulePath,
7095
- config.root,
7096
- isolatedHydrationMode,
7097
- hydrationPlanCache,
7098
- { ...hydrationPlanOptions, serverTreeLayouts: pageHydrationPlanOptions.serverOwners }
7099
- )
7100
- }));
7101
- const markdownPagePlan = createMarkdownPageHydrationPlanner(
7102
- resolveFarmMdxComponentsModulePath(resolveMdxConfig(config.mdx), config.root),
7103
- config.root,
7104
- isolatedHydrationMode,
7105
- { ...hydrationPlanOptions, packageReferences: pageHydrationPlanOptions.serverOwners }
7106
- );
7107
- const pageHydrationPlans = new Map(
7108
- pageRoutes.map((route) => [
7109
- route.modulePath,
7110
- isFarmMarkdownPageFile(route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
7111
- route.modulePath,
7101
+ const { layoutHydrationPlans, pageHydrationPlans } = withFarmSourceSnapshot(() => {
7102
+ const layoutHydrationPlans2 = layoutRoutes.map((layout) => ({
7103
+ ...layout,
7104
+ hydration: getCachedClientModuleHydrationPlan(
7105
+ layout.modulePath,
7112
7106
  config.root,
7113
7107
  isolatedHydrationMode,
7114
7108
  hydrationPlanCache,
7115
- pageHydrationPlanOptions
7109
+ { ...hydrationPlanOptions, serverTreeLayouts: pageHydrationPlanOptions.serverOwners }
7116
7110
  )
7117
- ])
7118
- );
7111
+ }));
7112
+ const markdownPagePlan = createMarkdownPageHydrationPlanner(
7113
+ resolveFarmMdxComponentsModulePath(resolveMdxConfig(config.mdx), config.root),
7114
+ config.root,
7115
+ isolatedHydrationMode,
7116
+ { ...hydrationPlanOptions, packageReferences: pageHydrationPlanOptions.serverOwners }
7117
+ );
7118
+ const pageHydrationPlans2 = new Map(
7119
+ pageRoutes.map((route) => [
7120
+ route.modulePath,
7121
+ isFarmMarkdownPageFile(route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
7122
+ route.modulePath,
7123
+ config.root,
7124
+ isolatedHydrationMode,
7125
+ hydrationPlanCache,
7126
+ pageHydrationPlanOptions
7127
+ )
7128
+ ])
7129
+ );
7130
+ return { layoutHydrationPlans: layoutHydrationPlans2, pageHydrationPlans: pageHydrationPlans2 };
7131
+ });
7119
7132
  enforceFarmIsolatedHydrationRouteBudget(
7120
7133
  layoutHydrationPlans.map((layout) => ({
7121
7134
  pattern: layout.pattern,
@@ -12354,17 +12367,22 @@ function escapeRoutePattern(value) {
12354
12367
  return value.replace(/[|\\{}()[\]^$+?.*]/g, "\\$&");
12355
12368
  }
12356
12369
  function middlewarePatternMatches(pattern, pathname) {
12370
+ return createMiddlewarePatternMatcher(pattern)(pathname);
12371
+ }
12372
+ function createMiddlewarePatternMatcher(pattern) {
12357
12373
  if (pattern instanceof RegExp) {
12358
- pattern.lastIndex = 0;
12359
- return pattern.test(pathname);
12374
+ return (pathname) => {
12375
+ pattern.lastIndex = 0;
12376
+ return pattern.test(pathname);
12377
+ };
12360
12378
  }
12361
- if (pattern === "*" || pattern === "/(.*)") return true;
12379
+ if (pattern === "*" || pattern === "/(.*)") return () => true;
12362
12380
  if (pattern.endsWith("(.*)")) {
12363
12381
  const prefix = pattern.slice(0, -4);
12364
- return pathname === prefix || pathname.startsWith(`${prefix}/`);
12382
+ return (pathname) => pathname === prefix || pathname.startsWith(`${prefix}/`);
12365
12383
  }
12366
12384
  const segments = pattern.split("/").filter(Boolean);
12367
- if (segments.length === 0) return pathname === "/";
12385
+ if (segments.length === 0) return (pathname) => pathname === "/";
12368
12386
  const expression = segments.map((segment) => {
12369
12387
  if (segment === "**") return "(?:/.*)?";
12370
12388
  if (segment === "*") return "/[^/]+";
@@ -12376,7 +12394,8 @@ function middlewarePatternMatches(pattern, pathname) {
12376
12394
  if (segment.startsWith(":") || /^\[.+\]$/.test(segment)) return "/[^/]+";
12377
12395
  return `/${escapeRoutePattern(segment).replace(/\\\*/g, "[^/]*")}`;
12378
12396
  }).join("");
12379
- return new RegExp(`^${expression}/?$`).test(pathname);
12397
+ const regex = new RegExp(`^${expression}/?$`);
12398
+ return (pathname) => regex.test(pathname);
12380
12399
  }
12381
12400
  function routePatternSpecificity(pattern) {
12382
12401
  return pattern.split("/").filter(Boolean).reduce((score, segment) => {
@@ -12391,8 +12410,18 @@ function routePatternSpecificity(pattern) {
12391
12410
  function getEffectiveRouteRule(config, pathname) {
12392
12411
  return Object.entries(config.routeRules).filter(([pattern]) => middlewarePatternMatches(pattern, pathname)).sort(([left], [right]) => routePatternSpecificity(left) - routePatternSpecificity(right)).reduce((resolved, [, rule]) => Object.assign(resolved, rule), {});
12393
12412
  }
12413
+ var manifestPageMatchers = /* @__PURE__ */ new WeakMap();
12394
12414
  function getManifestPageEntry(manifest, pathname) {
12395
- return manifest.routes.filter((entry) => entry.kind === "page" && middlewarePatternMatches(entry.pattern, pathname)).sort((left, right) => compareRoutePatternSpecificity(left.pattern, right.pattern))[0];
12415
+ let pages = manifestPageMatchers.get(manifest.routes);
12416
+ if (!pages) {
12417
+ pages = manifest.routes.filter((entry) => entry.kind === "page").map((entry) => ({
12418
+ entry,
12419
+ matches: createMiddlewarePatternMatcher(entry.pattern),
12420
+ specificity: getRoutePatternSpecificity(entry.pattern)
12421
+ })).sort((left, right) => compareRouteSpecificity(left.specificity, right.specificity)).map(({ entry, matches }) => ({ entry, matches }));
12422
+ manifestPageMatchers.set(manifest.routes, pages);
12423
+ }
12424
+ return pages.find((page) => page.matches(pathname))?.entry;
12396
12425
  }
12397
12426
  function withFarmEdgeGuardedPrerenderHeaders(headers, edgeGuarded) {
12398
12427
  if (!edgeGuarded) return headers;
@@ -14159,7 +14188,12 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
14159
14188
  });
14160
14189
  }
14161
14190
  async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
14162
- const { farmI18nClientBridgePlugin, farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.mjs");
14191
+ const {
14192
+ farmI18nClientBridgePlugin,
14193
+ farmIslandContainersPlugin,
14194
+ farmPlugin,
14195
+ farmServerOnlyEntriesPlugin
14196
+ } = await import("./vite.mjs");
14163
14197
  const { PluginManager: PluginManager2 } = await import("./plugin-QZT747YW.mjs");
14164
14198
  const pluginManager = new PluginManager2({
14165
14199
  config,
@@ -14179,6 +14213,7 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
14179
14213
  plugins: [
14180
14214
  farmI18nClientBridgePlugin(),
14181
14215
  farmServerOnlyEntriesPlugin(),
14216
+ farmIslandContainersPlugin(config),
14182
14217
  farmPlugin(config, pluginManager),
14183
14218
  farmEnvironmentFunctionsPlugin(config)
14184
14219
  ],
@@ -14186,7 +14221,7 @@ async function buildClient2(viteBuild, config, root, srcDir, outputDir) {
14186
14221
  });
14187
14222
  }
14188
14223
  async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
14189
- const { farmI18nClientBridgePlugin, farmPlugin } = await import("./vite.mjs");
14224
+ const { farmI18nClientBridgePlugin, farmIslandContainersPlugin, farmPlugin } = await import("./vite.mjs");
14190
14225
  const { PluginManager: PluginManager2 } = await import("./plugin-QZT747YW.mjs");
14191
14226
  const pluginManager = new PluginManager2({
14192
14227
  config,
@@ -14212,6 +14247,7 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
14212
14247
  },
14213
14248
  plugins: [
14214
14249
  farmI18nClientBridgePlugin(),
14250
+ farmIslandContainersPlugin(config),
14215
14251
  farmPlugin(config, pluginManager),
14216
14252
  farmEnvironmentFunctionsPlugin(config)
14217
14253
  ],