@farm.js/core 0.1.36 → 0.1.37

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 (234) hide show
  1. package/dist/{agent-mcp-BVExL8rZ.d.mts → agent-mcp-BC0bAGVF.d.mts} +1 -1
  2. package/dist/{agent-mcp-luzfXK-P.d.ts → agent-mcp-jyDHbQKe.d.ts} +1 -1
  3. package/dist/agent-runtime.cjs +3 -3
  4. package/dist/agent-runtime.d.mts +1 -1
  5. package/dist/agent-runtime.d.ts +1 -1
  6. package/dist/agent-runtime.mjs +2 -2
  7. package/dist/api/client.cjs +3 -3
  8. package/dist/api/client.mjs +2 -2
  9. package/dist/api/route-manager.cjs +6 -6
  10. package/dist/api/route-manager.d.mts +3 -3
  11. package/dist/api/route-manager.d.ts +3 -3
  12. package/dist/api/route-manager.mjs +5 -5
  13. package/dist/api/runtime.cjs +4 -4
  14. package/dist/api/runtime.d.mts +2 -2
  15. package/dist/api/runtime.d.ts +2 -2
  16. package/dist/api/runtime.mjs +3 -3
  17. package/dist/api.cjs +9 -8
  18. package/dist/api.d.mts +3 -3
  19. package/dist/api.d.ts +3 -3
  20. package/dist/api.mjs +8 -7
  21. package/dist/{app-Yfa2dsFy.d.ts → app-CKO3iN1c.d.ts} +3 -3
  22. package/dist/{app-BukwkFIu.d.mts → app-Cbkj9ufe.d.mts} +3 -3
  23. package/dist/app-markdown.cjs +5 -3
  24. package/dist/app-markdown.d.mts +3 -3
  25. package/dist/app-markdown.d.ts +3 -3
  26. package/dist/app-markdown.mjs +4 -2
  27. package/dist/{chunk-UVW64BCB.cjs → chunk-3A4KGQYI.cjs} +2 -2
  28. package/dist/{chunk-AO6RYU5N.cjs → chunk-3IP27TCG.cjs} +30 -22
  29. package/dist/{chunk-FDR64H6B.mjs → chunk-3KGDJLJK.mjs} +41 -2
  30. package/dist/{chunk-KXWRO25S.cjs → chunk-4GPOC4LN.cjs} +3 -3
  31. package/dist/{chunk-Z2HLU4IX.cjs → chunk-4GWRFP22.cjs} +23 -2
  32. package/dist/{chunk-276VJSM6.mjs → chunk-4P6ULFMD.mjs} +43 -30
  33. package/dist/{chunk-BPMATOP2.cjs → chunk-5BXGGEC7.cjs} +25 -20
  34. package/dist/{chunk-JNUWCDTF.cjs → chunk-5D2JIPLH.cjs} +2 -2
  35. package/dist/{chunk-AHGECQEW.mjs → chunk-666CKENS.mjs} +1 -1
  36. package/dist/{chunk-BO36SELV.cjs → chunk-6LGFV2CQ.cjs} +2 -2
  37. package/dist/{chunk-2YTDKNH3.cjs → chunk-6TJITR2B.cjs} +192 -120
  38. package/dist/{chunk-JZVADIOD.cjs → chunk-75X755YZ.cjs} +2 -2
  39. package/dist/{chunk-VQLJWDVW.cjs → chunk-7DWNJI73.cjs} +2 -2
  40. package/dist/{chunk-N2NAS2AM.cjs → chunk-7O5M4UKW.cjs} +2 -2
  41. package/dist/{chunk-BJPBQNIE.cjs → chunk-7SQ5SGYZ.cjs} +2 -2
  42. package/dist/{chunk-27ZWSI3W.cjs → chunk-ADOAUDQ6.cjs} +2 -2
  43. package/dist/{chunk-YKX5BK66.cjs → chunk-ATWHHSY2.cjs} +7 -7
  44. package/dist/{chunk-42NHY7HW.cjs → chunk-B5PFZLKV.cjs} +40 -9
  45. package/dist/{chunk-FNO7A7CM.cjs → chunk-BHY547NB.cjs} +34 -16
  46. package/dist/{chunk-4GLOOWKE.mjs → chunk-CQMVIOYP.mjs} +1 -1
  47. package/dist/{chunk-D2BB47NB.cjs → chunk-CVH2BXPY.cjs} +6 -6
  48. package/dist/{chunk-TKSCR644.cjs → chunk-D3C5LBQY.cjs} +2 -2
  49. package/dist/{chunk-PZNL3WEG.mjs → chunk-DMEPTZTI.mjs} +22 -11
  50. package/dist/{chunk-GQ3Z3IZI.cjs → chunk-EMMQ64QW.cjs} +18 -18
  51. package/dist/{chunk-OHLSEQ57.mjs → chunk-EXG5LD6B.mjs} +1 -1
  52. package/dist/{chunk-WZ77PUAM.mjs → chunk-FBOJ55OM.mjs} +1 -1
  53. package/dist/{chunk-OTC5BDGO.mjs → chunk-FGRYBX5X.mjs} +12 -7
  54. package/dist/{chunk-D227TIEN.cjs → chunk-FWE7LEQC.cjs} +13 -13
  55. package/dist/{chunk-3BU22U3M.cjs → chunk-G2TEB74S.cjs} +5 -2
  56. package/dist/{chunk-O6I6VWKK.mjs → chunk-HEVMCTSR.mjs} +1 -1
  57. package/dist/{chunk-W7LF2J2S.mjs → chunk-HMRSWN47.mjs} +1 -1
  58. package/dist/{chunk-JG6DJF5A.mjs → chunk-HZFM2LWQ.mjs} +22 -1
  59. package/dist/{chunk-35GKZR22.mjs → chunk-IAIYV4RZ.mjs} +1 -1
  60. package/dist/{chunk-F2SE2VDO.mjs → chunk-IHQIOZLC.mjs} +1 -1
  61. package/dist/{chunk-2NNMOPDN.mjs → chunk-J3ANCZKA.mjs} +4 -1
  62. package/dist/{chunk-C4SPBWFM.cjs → chunk-JEZO6VUR.cjs} +10 -1
  63. package/dist/{chunk-SC2WYWPF.mjs → chunk-JPNFPAZ4.mjs} +3 -3
  64. package/dist/{chunk-HOXTWRGB.mjs → chunk-K3SAEIM3.mjs} +5 -2
  65. package/dist/{chunk-35WV46VL.mjs → chunk-K4I4O5TS.mjs} +98 -26
  66. package/dist/{chunk-KN7K4VQN.mjs → chunk-KDTBF3UU.mjs} +1 -1
  67. package/dist/{chunk-QORUJDIV.mjs → chunk-KPFKMDM7.mjs} +2 -2
  68. package/dist/{chunk-YSCV4SJF.cjs → chunk-L5H2GSUC.cjs} +4 -4
  69. package/dist/{chunk-YDQZGSDS.mjs → chunk-LBDP3YT3.mjs} +1 -1
  70. package/dist/{chunk-LSZAVSGY.mjs → chunk-LBGILORX.mjs} +1 -1
  71. package/dist/{chunk-ADEA7PN3.cjs → chunk-LOFKRKO7.cjs} +2 -2
  72. package/dist/{chunk-ZWM5KGAA.cjs → chunk-LPFV45AY.cjs} +23 -20
  73. package/dist/{chunk-3KZS4SUS.mjs → chunk-MCIZVNOQ.mjs} +1 -1
  74. package/dist/{chunk-XCMCS4DA.mjs → chunk-ND2CWPOD.mjs} +2 -2
  75. package/dist/{chunk-S6VYG6XU.cjs → chunk-NDILNQ4L.cjs} +2 -2
  76. package/dist/{chunk-BPOF5U4N.mjs → chunk-NFMDCAOS.mjs} +10 -7
  77. package/dist/{chunk-UXFQ3UDA.cjs → chunk-NICDYKBS.cjs} +42 -3
  78. package/dist/{chunk-EZDQRNQ7.mjs → chunk-NNSAQX3U.mjs} +23 -5
  79. package/dist/{chunk-DZ5ZVB2K.cjs → chunk-NQ6QFZWD.cjs} +1 -1
  80. package/dist/{chunk-U4KT7QP3.cjs → chunk-OW67PDDS.cjs} +14 -1
  81. package/dist/{chunk-77GNHH2Z.cjs → chunk-PMQHMWZU.cjs} +3 -3
  82. package/dist/{chunk-NMHWYWDR.cjs → chunk-Q5FYSK45.cjs} +169 -156
  83. package/dist/{chunk-5SJWVY6R.mjs → chunk-QHSH7IH4.mjs} +9 -0
  84. package/dist/{chunk-EWET4D2Y.mjs → chunk-RRMVL6CJ.mjs} +3 -3
  85. package/dist/{chunk-IZY3V5XW.mjs → chunk-S3VWVTVA.mjs} +14 -1
  86. package/dist/{chunk-FFFW3OQ7.cjs → chunk-S6FJO323.cjs} +2 -2
  87. package/dist/chunk-SGBZPZUW.mjs +75 -0
  88. package/dist/{chunk-2ELDTQRN.mjs → chunk-TDNWPAVR.mjs} +1 -1
  89. package/dist/{chunk-IHNIDL6H.cjs → chunk-TO4GJ56K.cjs} +22 -11
  90. package/dist/{chunk-4WCZJQUO.mjs → chunk-TPLJVC7E.mjs} +37 -6
  91. package/dist/{chunk-NRSN7G7E.mjs → chunk-TW4GYDBJ.mjs} +1 -1
  92. package/dist/{chunk-FO427P6I.cjs → chunk-U6MPZ35Q.cjs} +10 -10
  93. package/dist/{chunk-CBJJH36A.cjs → chunk-UJZLSXUB.cjs} +3 -3
  94. package/dist/chunk-UXHS27O6.cjs +75 -0
  95. package/dist/{chunk-DQQOKWYA.cjs → chunk-VR4GD5I3.cjs} +3 -3
  96. package/dist/{chunk-T4OGRVNS.mjs → chunk-VXAWRDK7.mjs} +2 -2
  97. package/dist/{chunk-4NU4GGTC.cjs → chunk-W2YDNK66.cjs} +6 -3
  98. package/dist/{chunk-GQRWBCWK.mjs → chunk-WQ7T2263.mjs} +13 -5
  99. package/dist/chunk-WRPHYQVY.mjs +109 -0
  100. package/dist/chunk-WT4TGLXT.cjs +109 -0
  101. package/dist/{chunk-4E5AEDKY.mjs → chunk-XOPOIFTJ.mjs} +1 -1
  102. package/dist/{chunk-OO7GXVSR.mjs → chunk-YCKO6FRS.mjs} +1 -1
  103. package/dist/{chunk-MKYBIIAQ.mjs → chunk-Z5BEWYVO.mjs} +1 -1
  104. package/dist/{chunk-VILIPRS6.mjs → chunk-Z7LA7MHQ.mjs} +1 -1
  105. package/dist/{client-plugins-r1mOtSC1.d.ts → client-plugins-C8DjftDF.d.ts} +14 -0
  106. package/dist/{client-plugins-C3mK9Pol.d.mts → client-plugins-CV4eJ9De.d.mts} +14 -0
  107. package/dist/client-plugins.d.mts +1 -1
  108. package/dist/client-plugins.d.ts +1 -1
  109. package/dist/client.cjs +8 -8
  110. package/dist/client.d.mts +5 -5
  111. package/dist/client.d.ts +5 -5
  112. package/dist/client.mjs +7 -7
  113. package/dist/config.d.mts +1 -1
  114. package/dist/config.d.ts +1 -1
  115. package/dist/{devtools-JZJJY5CK.cjs → devtools-JXFQNWSH.cjs} +4 -4
  116. package/dist/{devtools-ERIKFEXX.mjs → devtools-KVOY2TCZ.mjs} +3 -3
  117. package/dist/docs.cjs +5 -5
  118. package/dist/docs.d.mts +2 -2
  119. package/dist/docs.d.ts +2 -2
  120. package/dist/docs.mjs +4 -4
  121. package/dist/headers.cjs +4 -4
  122. package/dist/headers.mjs +3 -3
  123. package/dist/i18n/client.cjs +11 -11
  124. package/dist/i18n/client.mjs +3 -3
  125. package/dist/index.cjs +42 -39
  126. package/dist/index.d.mts +14 -14
  127. package/dist/index.d.ts +14 -14
  128. package/dist/index.mjs +41 -38
  129. package/dist/integrations.cjs +3 -3
  130. package/dist/integrations.d.mts +1 -1
  131. package/dist/integrations.d.ts +1 -1
  132. package/dist/integrations.mjs +2 -2
  133. package/dist/internal/app-markdown-runtime.cjs +4 -2
  134. package/dist/internal/app-markdown-runtime.d.mts +19 -5
  135. package/dist/internal/app-markdown-runtime.d.ts +19 -5
  136. package/dist/internal/app-markdown-runtime.mjs +3 -1
  137. package/dist/internal/build-runtime.cjs +25 -23
  138. package/dist/internal/build-runtime.d.mts +3 -3
  139. package/dist/internal/build-runtime.d.ts +3 -3
  140. package/dist/internal/build-runtime.mjs +24 -22
  141. package/dist/internal/cli-runtime.cjs +8 -8
  142. package/dist/internal/cli-runtime.mjs +7 -7
  143. package/dist/internal/client-error-overlay.cjs +4 -4
  144. package/dist/internal/client-error-overlay.mjs +1 -1
  145. package/dist/internal/client-runtime.cjs +2 -2
  146. package/dist/internal/client-runtime.mjs +1 -1
  147. package/dist/internal/compression-runtime.d.mts +1 -1
  148. package/dist/internal/compression-runtime.d.ts +1 -1
  149. package/dist/internal/config-runtime.cjs +4 -4
  150. package/dist/internal/config-runtime.d.mts +2 -2
  151. package/dist/internal/config-runtime.d.ts +2 -2
  152. package/dist/internal/config-runtime.mjs +3 -3
  153. package/dist/internal/infra-analytics-runtime.cjs +5 -5
  154. package/dist/internal/infra-analytics-runtime.mjs +3 -3
  155. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  156. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  157. package/dist/internal/production-runtime.cjs +15 -50
  158. package/dist/internal/production-runtime.d.mts +8 -8
  159. package/dist/internal/production-runtime.d.ts +8 -8
  160. package/dist/internal/production-runtime.mjs +11 -46
  161. package/dist/markdown.d.mts +1 -1
  162. package/dist/markdown.d.ts +1 -1
  163. package/dist/middleware.cjs +8 -8
  164. package/dist/middleware.d.mts +6 -4
  165. package/dist/middleware.d.ts +6 -4
  166. package/dist/middleware.mjs +7 -7
  167. package/dist/navigation.cjs +7 -7
  168. package/dist/navigation.d.mts +4 -4
  169. package/dist/navigation.d.ts +4 -4
  170. package/dist/navigation.mjs +6 -6
  171. package/dist/plugin.cjs +19 -18
  172. package/dist/plugin.d.mts +1 -1
  173. package/dist/plugin.d.ts +1 -1
  174. package/dist/plugin.mjs +18 -17
  175. package/dist/{production-runtime-DPnsggY3.d.ts → production-runtime-C2kkrPVZ.d.ts} +1 -1
  176. package/dist/{production-runtime-CCeVZXst.d.mts → production-runtime-Du_FHb2-.d.mts} +1 -1
  177. package/dist/query/client.cjs +9 -9
  178. package/dist/query/client.mjs +4 -4
  179. package/dist/{render-plan-Cw4f5E_R.d.ts → render-plan-BnnPTpus.d.ts} +1 -1
  180. package/dist/{render-plan-BuGaPFe6.d.mts → render-plan-Cgx7v8tJ.d.mts} +1 -1
  181. package/dist/renderer-client.cjs +12 -12
  182. package/dist/renderer-client.d.mts +3 -3
  183. package/dist/renderer-client.d.ts +3 -3
  184. package/dist/renderer-client.mjs +4 -4
  185. package/dist/{request-Bkg-hERy.d.ts → request-BNWr7r5e.d.ts} +1 -1
  186. package/dist/{request-CsGARcAw.d.mts → request-sKayKcop.d.mts} +1 -1
  187. package/dist/request.cjs +3 -3
  188. package/dist/request.d.mts +2 -2
  189. package/dist/request.d.ts +2 -2
  190. package/dist/request.mjs +2 -2
  191. package/dist/{route-rendering-BUZMH_64.d.ts → route-rendering-Bx4Auw6Q.d.ts} +1 -1
  192. package/dist/{route-rendering-f11yh5dp.d.mts → route-rendering-DWFp3Yq4.d.mts} +1 -1
  193. package/dist/{router-Cp6yRE8A.d.mts → router-BK6K42Ij.d.mts} +1 -1
  194. package/dist/{router-B8CR9GbD.d.ts → router-DnW_2tQi.d.ts} +1 -1
  195. package/dist/routes.cjs +2 -2
  196. package/dist/routes.d.mts +1 -1
  197. package/dist/routes.d.ts +1 -1
  198. package/dist/routes.mjs +1 -1
  199. package/dist/{runtime-CQVsT330.d.ts → runtime-CA3Ei5k_.d.ts} +1 -1
  200. package/dist/{runtime-CAEv36S_.d.mts → runtime-DJDaCMd_.d.mts} +1 -1
  201. package/dist/server-fn.cjs +3 -3
  202. package/dist/server-fn.mjs +2 -2
  203. package/dist/server-plugins.cjs +5 -5
  204. package/dist/server-plugins.d.mts +2 -2
  205. package/dist/server-plugins.d.ts +2 -2
  206. package/dist/server-plugins.mjs +4 -4
  207. package/dist/server-query.cjs +4 -4
  208. package/dist/server-query.mjs +3 -3
  209. package/dist/server.cjs +45 -44
  210. package/dist/server.d.mts +7 -7
  211. package/dist/server.d.ts +7 -7
  212. package/dist/server.mjs +23 -22
  213. package/dist/{spa-router-DwbqGkGj.d.mts → spa-router-D6fUA4Rn.d.mts} +2 -2
  214. package/dist/{spa-router-BuciWGCZ.d.ts → spa-router-Mwbd7g2L.d.ts} +2 -2
  215. package/dist/testing.cjs +8 -8
  216. package/dist/testing.d.mts +1 -1
  217. package/dist/testing.d.ts +1 -1
  218. package/dist/testing.mjs +6 -6
  219. package/dist/theme/server.cjs +4 -4
  220. package/dist/theme/server.mjs +3 -3
  221. package/dist/{utils-CaoWKtYM.d.ts → utils-BwVcAfUR.d.ts} +1 -1
  222. package/dist/{utils-B9V0S_yL.d.mts → utils-p9Hs-jCc.d.mts} +1 -1
  223. package/dist/version.cjs +2 -2
  224. package/dist/version.mjs +1 -1
  225. package/dist/vite.cjs +19 -18
  226. package/dist/vite.d.mts +1 -1
  227. package/dist/vite.d.ts +1 -1
  228. package/dist/vite.mjs +18 -17
  229. package/package.json +1 -1
  230. package/types/middleware.d.ts +5 -1
  231. package/dist/chunk-FXEF4PPL.mjs +0 -47
  232. package/dist/chunk-XD32KALF.cjs +0 -47
  233. /package/dist/{chunk-SJNMVDDF.cjs → chunk-FUCSUGDM.cjs} +0 -0
  234. /package/dist/{chunk-UDNPLXW7.mjs → chunk-MYIZXDZA.mjs} +0 -0
@@ -5,12 +5,13 @@ import {
5
5
  withProductionNodeEnv
6
6
  } from "./chunk-655RLQQL.mjs";
7
7
  import {
8
- generateNativeMCPPluginSource
9
- } from "./chunk-FXEF4PPL.mjs";
8
+ generateNativeMCPPluginSource,
9
+ layoutsCanCoverSamePage
10
+ } from "./chunk-WRPHYQVY.mjs";
10
11
  import {
11
12
  compileFarmDocsAdapterEdgeManifest,
12
13
  createFarmDocsAPIHandler
13
- } from "./chunk-4E5AEDKY.mjs";
14
+ } from "./chunk-XOPOIFTJ.mjs";
14
15
  import {
15
16
  FARM_DOCS_LAST_MODIFIED_MANIFEST,
16
17
  createFarmDocsHandler,
@@ -28,7 +29,7 @@ import {
28
29
  } from "./chunk-UP4CW6WP.mjs";
29
30
  import {
30
31
  FARM_PRERENDER_ENV
31
- } from "./chunk-3KZS4SUS.mjs";
32
+ } from "./chunk-MCIZVNOQ.mjs";
32
33
  import {
33
34
  loadFarmDocsEngine
34
35
  } from "./chunk-2VQKKQ6D.mjs";
@@ -37,7 +38,7 @@ import {
37
38
  getDeployTargetForPreset,
38
39
  hasCustomFarmRouteContext,
39
40
  resolveDeployOutputPath
40
- } from "./chunk-OHLSEQ57.mjs";
41
+ } from "./chunk-EXG5LD6B.mjs";
41
42
  import {
42
43
  resolveFarmInstrumentationFile
43
44
  } from "./chunk-ZZSRYEYU.mjs";
@@ -76,13 +77,13 @@ import {
76
77
  resolveFarmIsolatedClientHydrationMode,
77
78
  resolveFarmNotFoundComponentPath,
78
79
  usesFarmServerTree
79
- } from "./chunk-276VJSM6.mjs";
80
+ } from "./chunk-4P6ULFMD.mjs";
80
81
  import {
81
82
  findRequestBoundSourceBlockers,
82
83
  generateFarmTypeArtifacts,
83
84
  parseRouteRenderingDirective,
84
85
  resolveRouteRenderingConfigFromFile
85
- } from "./chunk-4GLOOWKE.mjs";
86
+ } from "./chunk-CQMVIOYP.mjs";
86
87
  import {
87
88
  FARM_API_CATALOG_PATH,
88
89
  FARM_APP_MANIFEST_LEGACY_PATH,
@@ -94,7 +95,7 @@ import {
94
95
  resolveFarmAppManifestInput,
95
96
  routeBoundaryCoversDirectory,
96
97
  stripRouteGroups
97
- } from "./chunk-LSZAVSGY.mjs";
98
+ } from "./chunk-LBGILORX.mjs";
98
99
  import {
99
100
  FARM_DEFAULT_MCP_PATH,
100
101
  createFarmDefaultMCPServer,
@@ -143,7 +144,7 @@ import {
143
144
  } from "./chunk-4OOBRCJX.mjs";
144
145
  import {
145
146
  isFarmMarkdownPageFile
146
- } from "./chunk-4WCZJQUO.mjs";
147
+ } from "./chunk-TPLJVC7E.mjs";
147
148
  import {
148
149
  resolveFarmMdxComponentsModulePath,
149
150
  resolveMdxConfig
@@ -159,20 +160,20 @@ import {
159
160
  FARM_INTEGRATION_API_BASE_PATH_KEY,
160
161
  getFarmIntegrationPluginServerRuntime,
161
162
  getIntegrationProviders
162
- } from "./chunk-MKYBIIAQ.mjs";
163
+ } from "./chunk-Z5BEWYVO.mjs";
163
164
  import {
164
165
  appendMiddlewareDirectory,
165
166
  appendMiddlewareRoutePath,
166
167
  compareMiddlewareRouteLocations
167
- } from "./chunk-BPOF5U4N.mjs";
168
+ } from "./chunk-NFMDCAOS.mjs";
168
169
  import {
169
170
  compileMiddlewareConfig,
170
171
  matchesCompiledMiddlewareConfig,
171
172
  matchesMiddlewareRoute
172
- } from "./chunk-JG6DJF5A.mjs";
173
+ } from "./chunk-HZFM2LWQ.mjs";
173
174
  import {
174
175
  APIRouteManager
175
- } from "./chunk-T4OGRVNS.mjs";
176
+ } from "./chunk-VXAWRDK7.mjs";
176
177
  import {
177
178
  readFarmI18nCatalogs
178
179
  } from "./chunk-QCFBDFRS.mjs";
@@ -199,7 +200,7 @@ import {
199
200
  } from "./chunk-BTHHUD7Q.mjs";
200
201
  import {
201
202
  FARM_VERSION
202
- } from "./chunk-OO7GXVSR.mjs";
203
+ } from "./chunk-YCKO6FRS.mjs";
203
204
  import {
204
205
  getFarmPresetRuntime
205
206
  } from "./chunk-2A3EQHXX.mjs";
@@ -759,15 +760,32 @@ function createFarmNetlifyEntry(options) {
759
760
  import nitroNetlifyHandler from ${JSON.stringify(options.nitroNetlifyEntry)};
760
761
 
761
762
  const PRIVATE_CACHE_DIRECTIVE = /(?:^|,)\\s*(?:private|no-store)\\s*(?:[,=]|$)/i;
763
+ const CREDENTIAL_VARY = /(?:^|,)\\s*(?:\\*|cookie|authorization)\\s*(?:,|$)/i;
764
+ // What Nitro's entry sets when the response has no Cache-Control of its own.
765
+ const NITRO_DEFAULT_CACHE_CONTROL = "public, max-age=0, must-revalidate";
766
+
767
+ function isSharedCacheable(request, response) {
768
+ return (
769
+ response.status === 200 &&
770
+ !request.headers.has("cookie") &&
771
+ !request.headers.has("authorization") &&
772
+ !response.headers.has("set-cookie") &&
773
+ !PRIVATE_CACHE_DIRECTIVE.test(response.headers.get("cache-control") || "") &&
774
+ !CREDENTIAL_VARY.test(response.headers.get("vary") || "")
775
+ );
776
+ }
762
777
 
763
778
  export default async function farmNetlifyHandler(request, context) {
764
779
  const response = await nitroNetlifyHandler(request, context);
765
780
  if (
766
781
  response &&
767
782
  response.headers.has("netlify-cdn-cache-control") &&
768
- PRIVATE_CACHE_DIRECTIVE.test(response.headers.get("cache-control") || "")
783
+ !isSharedCacheable(request, response)
769
784
  ) {
770
785
  response.headers.delete("netlify-cdn-cache-control");
786
+ if (response.headers.get("cache-control") === NITRO_DEFAULT_CACHE_CONTROL) {
787
+ response.headers.set("cache-control", "private, no-store");
788
+ }
771
789
  }
772
790
  return response;
773
791
  }
@@ -3174,15 +3192,17 @@ __farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot
3174
3192
  const cssImport = existsSync2(globalsCssPath) ? `import ${JSON.stringify(toImportPath(globalsCssPath))};` : "";
3175
3193
  const layoutImportStatements = [];
3176
3194
  const layoutRegistrations = [];
3195
+ const hydratingLayoutPatterns = layoutRoutes.filter((layout) => layout.shouldHydrate).map((layout) => layout.pattern);
3177
3196
  layoutRoutes.forEach((layout, index) => {
3178
3197
  const relativePath = toImportPath(layout.modulePath);
3179
- if (!layout.hasIsolatedClientBoundaries) {
3198
+ const rendersOnClient = !layout.hasIsolatedClientBoundaries && hydratingLayoutPatterns.some((pattern) => layoutsCanCoverSamePage(layout.pattern, pattern));
3199
+ if (rendersOnClient) {
3180
3200
  layoutImportStatements.push(`import Layout${index} from "${relativePath}";`);
3181
3201
  }
3182
3202
  const groupScope = getRouteGroupScope(layout.pattern);
3183
3203
  const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(stripRouteGroups(layout.pattern))}, groupScope: ${JSON.stringify(groupScope)}` : "";
3184
3204
  layoutRegistrations.push(
3185
- ` { pattern: ${JSON.stringify(layout.pattern)}${groupFields}, Component: ${layout.hasIsolatedClientBoundaries ? "null" : `Layout${index}`}, shouldHydrate: ${JSON.stringify(layout.shouldHydrate)}, islandStrategy: ${JSON.stringify(layout.islandStrategy)} }`
3205
+ ` { pattern: ${JSON.stringify(layout.pattern)}${groupFields}, Component: ${rendersOnClient ? `Layout${index}` : "null"}, shouldHydrate: ${JSON.stringify(layout.shouldHydrate)}, islandStrategy: ${JSON.stringify(layout.islandStrategy)} }`
3186
3206
  );
3187
3207
  });
3188
3208
  const layoutImports = layoutImportStatements.join("\n");
@@ -5807,7 +5827,7 @@ import * as farmDocsConfigModule from ${toVirtualEntryImportSpecifier(docsConfig
5807
5827
  import { dirname as farmDocsDirname, join as farmDocsJoin } from "node:path";
5808
5828
  import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
5809
5829
  const markdownHandlerImport = config.md?.enabled ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
5810
- const appMarkdownImport = hasMarkdownPages ? `import { createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse, isFarmMarkdownPublicSourceResponse } from "@farm.js/core/internal/app-markdown-runtime";` : "const createFarmMarkdownSourceResponse = null;\nconst isFarmMarkdownPublicSourceResponse = null;";
5830
+ const appMarkdownImport = hasMarkdownPages ? `import { FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS, createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse, isFarmMarkdownPublicSourceResponse } from "@farm.js/core/internal/app-markdown-runtime";` : "const createFarmMarkdownSourceResponse = null;\nconst isFarmMarkdownPublicSourceResponse = null;";
5811
5831
  const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
5812
5832
  const mdxComponentsPath = typeof config.mdx?.components === "string" ? path6.isAbsolute(config.mdx.components) ? config.mdx.components : path6.join(config.root, config.mdx.components) : null;
5813
5833
  const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
@@ -6262,7 +6282,18 @@ const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRe
6262
6282
  function dispatchFarmPluginAPIRequest(request) {
6263
6283
  const url = new URL(request.url);
6264
6284
  url.pathname = applyFarmBasePath(url.pathname);
6265
- return handleFarmRequest(url.href === request.url ? request : new Request(url, request));
6285
+ return fetchFarmInnerRequest(url.href === request.url ? request : new Request(url, request));
6286
+ }
6287
+ // A request the app makes to itself (a Markdown page check, a plugin's endpoint call) enters
6288
+ // through this module's outer \`fetch\`, as a direct request does: plugin runtime hooks run and
6289
+ // it gets its own request context, so \`cookies()\` and \`headers()\` are its own, never the
6290
+ // caller's. It asks for an identity body: the caller reads it, and the outer response is
6291
+ // compressed once.
6292
+ function fetchFarmInnerRequest(request, context) {
6293
+ if (!request.headers.has("accept-encoding")) return fetch(request, context);
6294
+ const headers = new Headers(request.headers);
6295
+ headers.delete("accept-encoding");
6296
+ return fetch(new Request(request, { headers }), context);
6266
6297
  }
6267
6298
  const farmLocalAPIBasePath = ${JSON.stringify(resolveFarmAPIServerBasePath(config.api))};
6268
6299
  const farmOpenAPIReference = ${JSON.stringify(openAPIReference)};
@@ -7234,7 +7265,9 @@ async function handleFarmDefaultMCP(request) {
7234
7265
  },
7235
7266
  });
7236
7267
  }
7237
- const farmDefaultMCPReadMarkdown = createFarmLlmsMarkdownReader((page) => handleFarmRequest(page));
7268
+ // \`fetch\` is this module's outer request entry: plugin runtime hooks run and the page
7269
+ // gets its own request context, as for a direct request.
7270
+ const farmDefaultMCPReadMarkdown = createFarmLlmsMarkdownReader((page) => fetch(page));
7238
7271
  ` : ""}
7239
7272
  // Static pages and root metadata for llms.txt, built the same way as in development.
7240
7273
  function createFarmLlmsTxtContext(request, full) {
@@ -7261,14 +7294,15 @@ function createFarmLlmsTxtContext(request, full) {
7261
7294
  apiServerBasePath: farmLocalAPIBasePath,${servesDefaultMCP ? "\n defaultMCP: getFarmDefaultMCPServer," : ""}
7262
7295
  }),` : ""}
7263
7296
  }),
7264
- // llms-full.txt reads each page's .md mirror through this same handler,
7265
- // with a fresh request so the caller's cookies never shape its content.
7266
- // HEAD discards the body, so it reads nothing.
7297
+ // llms-full.txt reads each page's .md mirror through this module's outer
7298
+ // request entry, so plugin runtime hooks run and each read has a fresh request
7299
+ // context: the caller's cookies never shape its content. HEAD discards the
7300
+ // body, so it reads nothing.
7267
7301
  ...(full
7268
7302
  ? {
7269
7303
  markdown: request.method.toUpperCase() === "HEAD"
7270
7304
  ? async () => null
7271
- : createFarmLlmsMarkdownReader((page) => handleFarmRequest(page)),
7305
+ : createFarmLlmsMarkdownReader((page) => fetch(page)),
7272
7306
  }
7273
7307
  : {}),
7274
7308
  };
@@ -8058,7 +8092,13 @@ async function handleFarmRequestInContext(
8058
8092
  const match = matchPageRoute(getFarmRoutePathname(targetPathname));
8059
8093
  return match?.route?.markdownSource || null;
8060
8094
  },
8061
- renderPage: (targetRequest) => handleFarmRequest(targetRequest, adapterContext),
8095
+ clientAddress: adapterContext?.clientAddress,
8096
+ // An anonymous visitor's request: guards never see the caller's address.
8097
+ renderPage: (targetRequest) =>
8098
+ fetchFarmInnerRequest(targetRequest, {
8099
+ ...adapterContext,
8100
+ clientAddress: FARM_MARKDOWN_ANONYMOUS_CLIENT_ADDRESS,
8101
+ }),
8062
8102
  });
8063
8103
  if (markdownSourceResponse) {
8064
8104
  return isFarmMarkdownPublicSourceResponse(markdownSourceResponse)
@@ -8078,7 +8118,7 @@ async function handleFarmRequestInContext(
8078
8118
  config: farmMarkdownConfig,
8079
8119
  routeExists: (targetPathname) =>
8080
8120
  Boolean(matchPageRoute(getFarmRoutePathname(targetPathname))),
8081
- renderPage: (targetRequest) => handleFarmRequest(targetRequest, adapterContext),
8121
+ renderPage: (targetRequest) => fetchFarmInnerRequest(targetRequest, adapterContext),
8082
8122
  apiServerBasePath: farmLocalAPIBasePath,
8083
8123
  });
8084
8124
  if (markdownResponse) {
@@ -10576,6 +10616,30 @@ async function copyPrismaClientForVercel(root, nitroFuncDir, fs) {
10576
10616
  }
10577
10617
  __name(copyPrismaClientForVercel, "copyPrismaClientForVercel");
10578
10618
 
10619
+ // src/build/project-module-runner.ts
10620
+ async function createFarmProjectModuleSsrEnvironment() {
10621
+ const vite = await import("vite");
10622
+ const { ModuleRunner, createNodeImportMeta } = await import("vite/module-runner");
10623
+ return {
10624
+ dev: {
10625
+ createEnvironment(name, config) {
10626
+ return vite.createRunnableDevEnvironment(name, config, {
10627
+ runner: /* @__PURE__ */ __name((environment) => new ModuleRunner({
10628
+ transport: {
10629
+ ...vite.createServerModuleRunnerTransport({ channel: environment.hot }),
10630
+ timeout: 0
10631
+ },
10632
+ hmr: false,
10633
+ createImportMeta: createNodeImportMeta,
10634
+ sourcemapInterceptor: "node"
10635
+ }), "runner")
10636
+ });
10637
+ }
10638
+ }
10639
+ };
10640
+ }
10641
+ __name(createFarmProjectModuleSsrEnvironment, "createFarmProjectModuleSsrEnvironment");
10642
+
10579
10643
  // src/build/index.ts
10580
10644
  async function build(config, options = {}) {
10581
10645
  return withProductionNodeEnv(() => buildWithProductionNodeEnv(config, options));
@@ -10836,6 +10900,14 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
10836
10900
  optimizeDeps: {
10837
10901
  ...viteConfig.optimizeDeps,
10838
10902
  noDiscovery: true
10903
+ },
10904
+ // An app or plugin that brings its own SSR environment keeps it.
10905
+ environments: viteConfig.environments?.ssr?.dev?.createEnvironment ? viteConfig.environments : {
10906
+ ...viteConfig.environments,
10907
+ ssr: {
10908
+ ...viteConfig.environments?.ssr,
10909
+ ...await createFarmProjectModuleSsrEnvironment()
10910
+ }
10839
10911
  }
10840
10912
  });
10841
10913
  }
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-CBBLJMR5.mjs";
13
13
  import {
14
14
  resolveFarmRequestURL
15
- } from "./chunk-FDR64H6B.mjs";
15
+ } from "./chunk-3KGDJLJK.mjs";
16
16
  import {
17
17
  __name
18
18
  } from "./chunk-LPEX4YW6.mjs";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  useRouter
3
- } from "./chunk-SC2WYWPF.mjs";
3
+ } from "./chunk-JPNFPAZ4.mjs";
4
4
  import {
5
5
  getRouter
6
- } from "./chunk-XCMCS4DA.mjs";
6
+ } from "./chunk-ND2CWPOD.mjs";
7
7
  import {
8
8
  applyFarmBasePath
9
9
  } from "./chunk-4RB44K6Z.mjs";
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
3
 
4
- var _chunkFFFW3OQ7cjs = require('./chunk-FFFW3OQ7.cjs');
4
+ var _chunkS6FJO323cjs = require('./chunk-S6FJO323.cjs');
5
5
 
6
6
 
7
7
  var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
@@ -14,10 +14,10 @@ var translate = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (key, valu
14
14
  const message = readOwnMessage(snapshot.messages, key);
15
15
  if (message === void 0) return key;
16
16
  const cacheKey = `${snapshot.locale}\0${key}\0${message}`;
17
- let formatter = _chunkFFFW3OQ7cjs.compiledFarmI18nMessages.get(cacheKey);
17
+ let formatter = _chunkS6FJO323cjs.compiledFarmI18nMessages.get(cacheKey);
18
18
  if (!formatter) {
19
19
  formatter = new (0, _intlmessageformat2.default)(message, snapshot.locale);
20
- _chunkFFFW3OQ7cjs.compiledFarmI18nMessages.set(cacheKey, formatter);
20
+ _chunkS6FJO323cjs.compiledFarmI18nMessages.set(cacheKey, formatter);
21
21
  }
22
22
  const result = formatter.format(values);
23
23
  if (rich) return Array.isArray(result) && result.length === 1 ? result[0] : result;
@@ -35,7 +35,7 @@ function createFarmClientTranslator() {
35
35
  }
36
36
  _chunkS3JO3N4Hcjs.__name.call(void 0, createFarmClientTranslator, "createFarmClientTranslator");
37
37
  function requireSnapshot() {
38
- const snapshot = _chunkFFFW3OQ7cjs.getFarmI18nClientState.call(void 0, );
38
+ const snapshot = _chunkS6FJO323cjs.getFarmI18nClientState.call(void 0, );
39
39
  if (!snapshot) {
40
40
  throw new Error("Farm i18n is not configured or has not been hydrated.");
41
41
  }
@@ -34,7 +34,7 @@ import {
34
34
  } from "./chunk-4SIYUGRY.mjs";
35
35
  import {
36
36
  _resolveCurrentRequest
37
- } from "./chunk-IZY3V5XW.mjs";
37
+ } from "./chunk-S3VWVTVA.mjs";
38
38
  import {
39
39
  __name
40
40
  } from "./chunk-LPEX4YW6.mjs";
@@ -30,7 +30,7 @@ import {
30
30
  } from "./chunk-BTHHUD7Q.mjs";
31
31
  import {
32
32
  FARM_VERSION
33
- } from "./chunk-OO7GXVSR.mjs";
33
+ } from "./chunk-YCKO6FRS.mjs";
34
34
  import {
35
35
  localizeFarmPathname
36
36
  } from "./chunk-L3KT7IXV.mjs";
@@ -30,7 +30,7 @@ var _chunkKIIMAWOJcjs = require('./chunk-KIIMAWOJ.cjs');
30
30
  var _chunkKNBBQHO2cjs = require('./chunk-KNBBQHO2.cjs');
31
31
 
32
32
 
33
- var _chunkDZ5ZVB2Kcjs = require('./chunk-DZ5ZVB2K.cjs');
33
+ var _chunkNQ6QFZWDcjs = require('./chunk-NQ6QFZWD.cjs');
34
34
 
35
35
 
36
36
  var _chunkBIDYX3SLcjs = require('./chunk-BIDYX3SL.cjs');
@@ -912,7 +912,7 @@ function createFarmAppManifest(input, { full = false } = {}) {
912
912
  const manifest = {
913
913
  schemaVersion: 1,
914
914
  app: {
915
- farm: _chunkDZ5ZVB2Kcjs.FARM_VERSION,
915
+ farm: _chunkNQ6QFZWDcjs.FARM_VERSION,
916
916
  renderer: input.renderer,
917
917
  basePath: input.basePath,
918
918
  build: input.build
@@ -7,13 +7,14 @@ var _chunkM7MKQXAFcjs = require('./chunk-M7MKQXAF.cjs');
7
7
 
8
8
 
9
9
 
10
- var _chunk3BU22U3Mcjs = require('./chunk-3BU22U3M.cjs');
10
+ var _chunkG2TEB74Scjs = require('./chunk-G2TEB74S.cjs');
11
11
 
12
12
 
13
13
 
14
14
 
15
15
 
16
- var _chunkZ2HLU4IXcjs = require('./chunk-Z2HLU4IX.cjs');
16
+
17
+ var _chunk4GWRFP22cjs = require('./chunk-4GWRFP22.cjs');
17
18
 
18
19
 
19
20
  var _chunkM2L4MYDQcjs = require('./chunk-M2L4MYDQ.cjs');
@@ -40,7 +41,7 @@ var _chunkKNBBQHO2cjs = require('./chunk-KNBBQHO2.cjs');
40
41
  var _chunkOX6O6WVAcjs = require('./chunk-OX6O6WVA.cjs');
41
42
 
42
43
 
43
- var _chunkUXFQ3UDAcjs = require('./chunk-UXFQ3UDA.cjs');
44
+ var _chunkNICDYKBScjs = require('./chunk-NICDYKBS.cjs');
44
45
 
45
46
 
46
47
  var _chunkBIDYX3SLcjs = require('./chunk-BIDYX3SL.cjs');
@@ -56,7 +57,7 @@ var _CookieJarImpl = class _CookieJarImpl {
56
57
  constructor(req, res) {
57
58
  this.req = req;
58
59
  this.res = res;
59
- this.cookies = _chunk3BU22U3Mcjs.parseMiddlewareCookieHeader.call(void 0, req.headers.cookie);
60
+ this.cookies = _chunkG2TEB74Scjs.parseMiddlewareCookieHeader.call(void 0, req.headers.cookie);
60
61
  const existing = res.getHeader("Set-Cookie");
61
62
  this.setCookies = Array.isArray(existing) ? existing.map(String) : existing === void 0 ? [] : [String(existing)];
62
63
  }
@@ -65,13 +66,13 @@ var _CookieJarImpl = class _CookieJarImpl {
65
66
  }
66
67
  set(name, value, options = {}) {
67
68
  this.cookies[name] = value;
68
- const cookieString = _chunk3BU22U3Mcjs.serializeMiddlewareCookie.call(void 0, name, value, options);
69
+ const cookieString = _chunkG2TEB74Scjs.serializeMiddlewareCookie.call(void 0, name, value, options);
69
70
  this.setCookies.push(cookieString);
70
71
  this.res.setHeader("Set-Cookie", this.setCookies);
71
72
  }
72
73
  delete(name, options = {}) {
73
74
  delete this.cookies[name];
74
- this.setCookies.push(_chunk3BU22U3Mcjs.serializeMiddlewareCookieDeletion.call(void 0, name, options));
75
+ this.setCookies.push(_chunkG2TEB74Scjs.serializeMiddlewareCookieDeletion.call(void 0, name, options));
75
76
  this.res.setHeader("Set-Cookie", this.setCookies);
76
77
  }
77
78
  getAll() {
@@ -80,8 +81,8 @@ var _CookieJarImpl = class _CookieJarImpl {
80
81
  };
81
82
  _chunkS3JO3N4Hcjs.__name.call(void 0, _CookieJarImpl, "CookieJarImpl");
82
83
  var CookieJarImpl = _CookieJarImpl;
83
- function createContext(req, res, viteServer, parent, server) {
84
- const url = _chunkUXFQ3UDAcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([server, 'optionalAccess', _ => _.trustProxy]) });
84
+ function createContext(req, res, viteServer, parent, server, toRoutePathname) {
85
+ const url = _chunkNICDYKBScjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([server, 'optionalAccess', _ => _.trustProxy]) });
85
86
  const headers = /* @__PURE__ */ new Map();
86
87
  const data = _optionalChain([parent, 'optionalAccess', _2 => _2.data]) ? new Map(parent.data) : /* @__PURE__ */ new Map();
87
88
  const locals = _optionalChain([parent, 'optionalAccess', _3 => _3.locals]) ? new Map(parent.locals) : /* @__PURE__ */ new Map();
@@ -105,6 +106,7 @@ function createContext(req, res, viteServer, parent, server) {
105
106
  response: res,
106
107
  url,
107
108
  pathname: url.pathname,
109
+ routePathname: _chunk4GWRFP22cjs.toMiddlewareRoutePathname.call(void 0, url.pathname, toRoutePathname),
108
110
  searchParams: url.searchParams,
109
111
  method: req.method || "GET",
110
112
  params: {},
@@ -140,6 +142,7 @@ function createContext(req, res, viteServer, parent, server) {
140
142
  const newUrl = new URL(rewriteUrl, ctx.url);
141
143
  ctx.url = newUrl;
142
144
  ctx.pathname = newUrl.pathname;
145
+ ctx.routePathname = _chunk4GWRFP22cjs.toMiddlewareRoutePathname.call(void 0, newUrl.pathname, toRoutePathname);
143
146
  ctx.searchParams = newUrl.searchParams;
144
147
  ctx.route = newUrl.pathname;
145
148
  req.url = rewriteUrl;
@@ -246,7 +249,7 @@ var _MiddlewareManager = class _MiddlewareManager {
246
249
  for (const [index, entry] of entries.entries()) {
247
250
  const handlers = this.getConfigHandlers(entry);
248
251
  const middlewareConfig = this.toMiddlewareConfig(entry);
249
- _chunkZ2HLU4IXcjs.compileMiddlewareConfig.call(void 0, middlewareConfig);
252
+ _chunk4GWRFP22cjs.compileMiddlewareConfig.call(void 0, middlewareConfig);
250
253
  if (handlers.length === 0) {
251
254
  this.globalConfig = middlewareConfig;
252
255
  continue;
@@ -269,7 +272,7 @@ var _MiddlewareManager = class _MiddlewareManager {
269
272
  const discovered = [];
270
273
  await this.discoverInDirectory(appDir, "/", "", discovered);
271
274
  for (const entry of discovered) {
272
- _chunkZ2HLU4IXcjs.compileMiddlewareRoute.call(void 0, entry.middleware);
275
+ _chunk4GWRFP22cjs.compileMiddlewareRoute.call(void 0, entry.middleware);
273
276
  middlewareByDirectory.set(entry.location.directory, entry);
274
277
  }
275
278
  }
@@ -334,12 +337,12 @@ var _MiddlewareManager = class _MiddlewareManager {
334
337
  _chunkSHLXACIOcjs.toFileModuleUrl.call(void 0, filePath)
335
338
  );
336
339
  }
337
- const normalized = _chunk3BU22U3Mcjs.normalizeMiddlewareModule.call(void 0, module, routePath);
340
+ const normalized = _chunkG2TEB74Scjs.normalizeMiddlewareModule.call(void 0, module, routePath);
338
341
  if (!normalized) {
339
342
  throw new Error("must export a default handler or a named middleware handler");
340
343
  }
341
344
  if (normalized.config) {
342
- _chunkZ2HLU4IXcjs.compileMiddlewareConfig.call(void 0, normalized.config);
345
+ _chunk4GWRFP22cjs.compileMiddlewareConfig.call(void 0, normalized.config);
343
346
  }
344
347
  return {
345
348
  path: routePath,
@@ -356,7 +359,7 @@ var _MiddlewareManager = class _MiddlewareManager {
356
359
  * Execute middleware for a request
357
360
  */
358
361
  async execute(req, res) {
359
- const url = _chunkUXFQ3UDAcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _6 => _6.server, 'optionalAccess', _7 => _7.trustProxy]) });
362
+ const url = _chunkNICDYKBScjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _6 => _6.server, 'optionalAccess', _7 => _7.trustProxy]) });
360
363
  const pathname = url.pathname;
361
364
  const toRoutePathname = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (value) => _optionalChain([this, 'access', _8 => _8.i18n, 'optionalAccess', _9 => _9.enabled]) ? _chunkBIDYX3SLcjs.stripFarmLocaleFromPathname.call(void 0, value, this.i18n) : _chunkI57LW5VZcjs.stripFarmBasePath.call(void 0, value, _nullishCoalesce(_optionalChain([this, 'access', _10 => _10.i18n, 'optionalAccess', _11 => _11.basePath]), () => ( "/"))), "toRoutePathname");
362
365
  const routePathname = toRoutePathname(pathname);
@@ -364,7 +367,7 @@ var _MiddlewareManager = class _MiddlewareManager {
364
367
  const method = req.method || "GET";
365
368
  const startTime = Date.now();
366
369
  let parentData;
367
- let ctx = createContext(req, res, this.viteServer, void 0, this.server);
370
+ let ctx = createContext(req, res, this.viteServer, void 0, this.server, toRoutePathname);
368
371
  if (this.globalConfig) {
369
372
  const globalMatch = this.matchesConfig(routePathname, this.globalConfig, ctx);
370
373
  if (!globalMatch.matched) {
@@ -378,7 +381,7 @@ var _MiddlewareManager = class _MiddlewareManager {
378
381
  ...this.configMiddleware.map((mw) => ({ mw, routeMatch: { matched: true } })),
379
382
  ...this.middleware.map((mw) => ({
380
383
  mw,
381
- routeMatch: _chunkZ2HLU4IXcjs.matchesMiddlewareRouteAt.call(void 0, toMiddlewarePathnames(routePathname), mw)
384
+ routeMatch: _chunk4GWRFP22cjs.matchesMiddlewareRouteAt.call(void 0, toMiddlewarePathnames(routePathname), mw)
382
385
  })).filter((entry) => entry.routeMatch.matched)
383
386
  ];
384
387
  if (applicable.length === 0) {
@@ -404,17 +407,17 @@ var _MiddlewareManager = class _MiddlewareManager {
404
407
  for (; ; ) {
405
408
  for (const entry of pass) yield { ...entry, pathname: passPathname };
406
409
  const rewrittenPathname = toRoutePathname(
407
- _chunkUXFQ3UDAcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy }).pathname
410
+ _chunkNICDYKBScjs.resolveFarmRequestURL.call(void 0, req, { trustProxy }).pathname
408
411
  );
409
412
  if (rewrittenPathname === passPathname) return;
410
413
  passPathname = rewrittenPathname;
411
414
  const passPathnames = toMiddlewarePathnames(passPathname);
412
- if (globalConfig && !_chunkZ2HLU4IXcjs.matchesMiddlewareConfigAt.call(void 0, passPathnames, globalConfig, ctx).matched) {
415
+ if (globalConfig && !_chunk4GWRFP22cjs.matchesMiddlewareConfigAt.call(void 0, passPathnames, globalConfig, ctx).matched) {
413
416
  return;
414
417
  }
415
418
  pass = allMiddleware.filter((mw) => !ran.has(mw)).map((mw) => ({
416
419
  mw,
417
- routeMatch: mw.source === "config" ? { matched: true } : _chunkZ2HLU4IXcjs.matchesMiddlewareRouteAt.call(void 0, passPathnames, mw)
420
+ routeMatch: mw.source === "config" ? { matched: true } : _chunk4GWRFP22cjs.matchesMiddlewareRouteAt.call(void 0, passPathnames, mw)
418
421
  })).filter((entry) => entry.routeMatch.matched);
419
422
  }
420
423
  }
@@ -432,7 +435,7 @@ var _MiddlewareManager = class _MiddlewareManager {
432
435
  ctx.params = { ...ctx.params, ...configMatch.params };
433
436
  }
434
437
  if (parentData) {
435
- ctx = createContext(req, res, this.viteServer, parentData, this.server);
438
+ ctx = createContext(req, res, this.viteServer, parentData, this.server, toRoutePathname);
436
439
  if (routeMatch.params) {
437
440
  ctx.params = { ...ctx.params, ...routeMatch.params };
438
441
  }
@@ -525,7 +528,7 @@ var _MiddlewareManager = class _MiddlewareManager {
525
528
  * Check if pathname matches middleware config
526
529
  */
527
530
  matchesConfig(pathname, config, ctx) {
528
- return _chunkZ2HLU4IXcjs.matchesMiddlewareConfigAt.call(void 0, this.toMiddlewarePathnames(pathname), config, ctx);
531
+ return _chunk4GWRFP22cjs.matchesMiddlewareConfigAt.call(void 0, this.toMiddlewarePathnames(pathname), config, ctx);
529
532
  }
530
533
  /**
531
534
  * Reload middleware (for HMR)
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-FUZEBRP3.mjs";
7
7
  import {
8
8
  getCurrentRequestOrNull
9
- } from "./chunk-FDR64H6B.mjs";
9
+ } from "./chunk-3KGDJLJK.mjs";
10
10
  import {
11
11
  __name
12
12
  } from "./chunk-LPEX4YW6.mjs";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  _hydrateFarmI18n,
3
3
  isFarmLocaleChangeHref
4
- } from "./chunk-F2SE2VDO.mjs";
4
+ } from "./chunk-IHQIOZLC.mjs";
5
5
  import {
6
6
  getHashTargetElement
7
7
  } from "./chunk-2PQNJXFM.mjs";
@@ -9,7 +9,7 @@ import {
9
9
  isFarmBlockedNavigationURL,
10
10
  isFarmExternalNavigationURL,
11
11
  resolveFarmNavigationURL
12
- } from "./chunk-5SJWVY6R.mjs";
12
+ } from "./chunk-QHSH7IH4.mjs";
13
13
  import {
14
14
  createClientCancellation
15
15
  } from "./chunk-QVYLBY73.mjs";
@@ -34,7 +34,7 @@ var _chunkS3A45T7Fcjs = require('./chunk-S3A45T7F.cjs');
34
34
  var _chunkZEG3OPIBcjs = require('./chunk-ZEG3OPIB.cjs');
35
35
 
36
36
 
37
- var _chunkUXFQ3UDAcjs = require('./chunk-UXFQ3UDA.cjs');
37
+ var _chunkNICDYKBScjs = require('./chunk-NICDYKBS.cjs');
38
38
 
39
39
 
40
40
  var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
@@ -209,7 +209,7 @@ async function invokeAPIRouteEndpoint(endpoint, request, params = {}, bodySizeLi
209
209
  if (response2) return response2;
210
210
  throw error;
211
211
  }
212
- const response = await _chunkUXFQ3UDAcjs._runWithCurrentRequest.call(void 0,
212
+ const response = await _chunkNICDYKBScjs._runWithCurrentRequest.call(void 0,
213
213
  request,
214
214
  () => invokeAPIRouteEndpointInContext(endpoint, request, params)
215
215
  );
@@ -7,13 +7,14 @@ import {
7
7
  parseMiddlewareCookieHeader,
8
8
  serializeMiddlewareCookie,
9
9
  serializeMiddlewareCookieDeletion
10
- } from "./chunk-2NNMOPDN.mjs";
10
+ } from "./chunk-J3ANCZKA.mjs";
11
11
  import {
12
12
  compileMiddlewareConfig,
13
13
  compileMiddlewareRoute,
14
14
  matchesMiddlewareConfigAt,
15
- matchesMiddlewareRouteAt
16
- } from "./chunk-JG6DJF5A.mjs";
15
+ matchesMiddlewareRouteAt,
16
+ toMiddlewareRoutePathname
17
+ } from "./chunk-HZFM2LWQ.mjs";
17
18
  import {
18
19
  createCliColors
19
20
  } from "./chunk-I2BHUNBU.mjs";
@@ -40,7 +41,7 @@ import {
40
41
  } from "./chunk-CBBLJMR5.mjs";
41
42
  import {
42
43
  resolveFarmRequestURL
43
- } from "./chunk-FDR64H6B.mjs";
44
+ } from "./chunk-3KGDJLJK.mjs";
44
45
  import {
45
46
  stripFarmLocaleFromPathname
46
47
  } from "./chunk-L3KT7IXV.mjs";
@@ -80,7 +81,7 @@ var _CookieJarImpl = class _CookieJarImpl {
80
81
  };
81
82
  __name(_CookieJarImpl, "CookieJarImpl");
82
83
  var CookieJarImpl = _CookieJarImpl;
83
- function createContext(req, res, viteServer, parent, server) {
84
+ function createContext(req, res, viteServer, parent, server, toRoutePathname) {
84
85
  const url = resolveFarmRequestURL(req, { trustProxy: server?.trustProxy });
85
86
  const headers = /* @__PURE__ */ new Map();
86
87
  const data = parent?.data ? new Map(parent.data) : /* @__PURE__ */ new Map();
@@ -105,6 +106,7 @@ function createContext(req, res, viteServer, parent, server) {
105
106
  response: res,
106
107
  url,
107
108
  pathname: url.pathname,
109
+ routePathname: toMiddlewareRoutePathname(url.pathname, toRoutePathname),
108
110
  searchParams: url.searchParams,
109
111
  method: req.method || "GET",
110
112
  params: {},
@@ -140,6 +142,7 @@ function createContext(req, res, viteServer, parent, server) {
140
142
  const newUrl = new URL(rewriteUrl, ctx.url);
141
143
  ctx.url = newUrl;
142
144
  ctx.pathname = newUrl.pathname;
145
+ ctx.routePathname = toMiddlewareRoutePathname(newUrl.pathname, toRoutePathname);
143
146
  ctx.searchParams = newUrl.searchParams;
144
147
  ctx.route = newUrl.pathname;
145
148
  req.url = rewriteUrl;
@@ -364,7 +367,7 @@ var _MiddlewareManager = class _MiddlewareManager {
364
367
  const method = req.method || "GET";
365
368
  const startTime = Date.now();
366
369
  let parentData;
367
- let ctx = createContext(req, res, this.viteServer, void 0, this.server);
370
+ let ctx = createContext(req, res, this.viteServer, void 0, this.server, toRoutePathname);
368
371
  if (this.globalConfig) {
369
372
  const globalMatch = this.matchesConfig(routePathname, this.globalConfig, ctx);
370
373
  if (!globalMatch.matched) {
@@ -432,7 +435,7 @@ var _MiddlewareManager = class _MiddlewareManager {
432
435
  ctx.params = { ...ctx.params, ...configMatch.params };
433
436
  }
434
437
  if (parentData) {
435
- ctx = createContext(req, res, this.viteServer, parentData, this.server);
438
+ ctx = createContext(req, res, this.viteServer, parentData, this.server, toRoutePathname);
436
439
  if (routeMatch.params) {
437
440
  ctx.params = { ...ctx.params, ...routeMatch.params };
438
441
  }