@farm.js/core 0.1.51-beta.2 → 0.1.51-beta.3

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 (183) hide show
  1. package/dist/{agent-mcp-handler-WWCC4GLG.mjs → agent-mcp-handler-7JSKGSOW.mjs} +4 -4
  2. package/dist/{agent-mcp-handler-RT3COCEL.cjs → agent-mcp-handler-YE4AGWHN.cjs} +5 -5
  3. package/dist/{agent-mcp.d-CR5Ov83o.d.ts → agent-mcp.d-BAR9njbJ.d.ts} +1 -1
  4. package/dist/{agent-mcp.d-Z5DuwrqW.d.mts → agent-mcp.d-BJKChOrO.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-Z6TNEAET.mjs → analyzer-OTPEWH5W.mjs} +14 -3
  8. package/dist/{analyzer-T76CN3S7.cjs → analyzer-TSQXZCZN.cjs} +14 -3
  9. package/dist/api/route-manager.d.mts +4 -4
  10. package/dist/api/route-manager.d.ts +4 -4
  11. package/dist/api/runtime.d.mts +3 -3
  12. package/dist/api/runtime.d.ts +3 -3
  13. package/dist/api.d.mts +4 -4
  14. package/dist/api.d.ts +4 -4
  15. package/dist/{app-manifest.d-DiWr_Jfx.d.ts → app-manifest.d-BLFbaqx8.d.ts} +1 -1
  16. package/dist/{app-manifest.d-CAHkOBFa.d.mts → app-manifest.d-DEQNnNhV.d.mts} +1 -1
  17. package/dist/app-markdown.cjs +4 -4
  18. package/dist/app-markdown.d.mts +3 -3
  19. package/dist/app-markdown.d.ts +3 -3
  20. package/dist/app-markdown.mjs +3 -3
  21. package/dist/{app.d-DmapqkbV.d.ts → app.d-CNPaUYaa.d.ts} +4 -4
  22. package/dist/{app.d-BfgJCsTQ.d.mts → app.d-CT7xDkj2.d.mts} +4 -4
  23. package/dist/{chunk-YVJV7Q2X.mjs → chunk-3BLEXUGE.mjs} +1 -1
  24. package/dist/chunk-3HLQTOVU.cjs +6 -0
  25. package/dist/{chunk-E6LTONL4.mjs → chunk-3SMXQNFD.mjs} +2 -2
  26. package/dist/{chunk-PMKUU273.mjs → chunk-3TLKUBXG.mjs} +411 -166
  27. package/dist/{chunk-74Z5KX4A.mjs → chunk-3WSIYBMG.mjs} +41 -19
  28. package/dist/{chunk-GNJIYJMS.cjs → chunk-3XQ57EFI.cjs} +16 -16
  29. package/dist/{chunk-GW4YUIHW.mjs → chunk-3Z63X45F.mjs} +1 -1
  30. package/dist/{chunk-IBSAYAWB.mjs → chunk-4353ZRE5.mjs} +1 -1
  31. package/dist/{chunk-SBABQKPT.cjs → chunk-46KXZBOG.cjs} +5 -5
  32. package/dist/{chunk-YU42A5MA.cjs → chunk-4CGOMZP3.cjs} +221 -199
  33. package/dist/{chunk-J3LBO2O4.cjs → chunk-4SEHMBL4.cjs} +10 -10
  34. package/dist/{chunk-E73PGHSR.mjs → chunk-4TKAIO2F.mjs} +3 -3
  35. package/dist/{chunk-NJLTQR5P.cjs → chunk-53SACYBY.cjs} +7 -7
  36. package/dist/{chunk-FM2UEKS2.mjs → chunk-5FXPJIOT.mjs} +2 -2
  37. package/dist/{chunk-QXPSWMUD.cjs → chunk-7MD37P5V.cjs} +5 -5
  38. package/dist/{chunk-JATTVAHA.cjs → chunk-B3GM5I6N.cjs} +4 -4
  39. package/dist/{chunk-WJFFPXCV.cjs → chunk-D7UQC4O6.cjs} +10 -8
  40. package/dist/{chunk-KRRZJ77U.mjs → chunk-E5DXF5GE.mjs} +2 -2
  41. package/dist/chunk-EFZGB7JC.cjs +114 -0
  42. package/dist/{chunk-NYQSC4DX.cjs → chunk-FFE2EMF7.cjs} +5 -5
  43. package/dist/{chunk-CTM4SPB3.mjs → chunk-GAO7MS5O.mjs} +4 -3
  44. package/dist/{chunk-HIFIG6HL.cjs → chunk-H33PJEXN.cjs} +5 -5
  45. package/dist/{chunk-NXBHYO7S.cjs → chunk-HLWOWZFX.cjs} +2 -2
  46. package/dist/chunk-JXEPLIXD.cjs +389 -0
  47. package/dist/{chunk-NPQLMP7M.cjs → chunk-KLNFJDFM.cjs} +10 -9
  48. package/dist/{chunk-KBRZAYI7.mjs → chunk-LDNSSHEG.mjs} +2 -2
  49. package/dist/chunk-LLZSYFOM.mjs +6 -0
  50. package/dist/{chunk-N77JBPLC.mjs → chunk-LPDKG6RA.mjs} +9 -7
  51. package/dist/chunk-MIGFX2FN.mjs +758 -0
  52. package/dist/{chunk-72D2NX77.mjs → chunk-MRNDAJEV.mjs} +1 -1
  53. package/dist/{chunk-4SSRBCBR.mjs → chunk-NOTSHVRN.mjs} +355 -218
  54. package/dist/{chunk-GUJTVM36.cjs → chunk-OAMUSC7H.cjs} +1 -1
  55. package/dist/chunk-P6MHI5O2.cjs +758 -0
  56. package/dist/{chunk-6CYQQQGR.mjs → chunk-R4PHCZ3G.mjs} +1 -1
  57. package/dist/{chunk-WZW6LEHM.cjs → chunk-TQMI6BYO.cjs} +675 -430
  58. package/dist/{chunk-76GHW3WI.cjs → chunk-TSFMFPRU.cjs} +4 -4
  59. package/dist/{chunk-5N7QAGEA.cjs → chunk-TWHXBMLJ.cjs} +37 -7
  60. package/dist/{chunk-BOVGCUDZ.cjs → chunk-UJL4JOXV.cjs} +2 -2
  61. package/dist/chunk-UQF3OJVE.mjs +389 -0
  62. package/dist/{chunk-DTU4PX7V.cjs → chunk-WGUHDWT5.cjs} +557 -420
  63. package/dist/{chunk-LAZK6UV7.mjs → chunk-YAJTD3ZG.mjs} +1 -1
  64. package/dist/{chunk-7UPCJDB5.mjs → chunk-YUEYBL35.mjs} +2 -2
  65. package/dist/{chunk-EIMK7D2D.mjs → chunk-ZD2VKAUI.mjs} +34 -4
  66. package/dist/chunk-ZNXTU4YH.mjs +114 -0
  67. package/dist/{client-plugins.d-Bx3FXpqm.d.mts → client-plugins.d-DllmH8eM.d.mts} +17 -4
  68. package/dist/{client-plugins.d-TiLbS5j4.d.ts → client-plugins.d-n3iWY1EJ.d.ts} +17 -4
  69. package/dist/client-plugins.d.mts +2 -2
  70. package/dist/client-plugins.d.ts +2 -2
  71. package/dist/client.d.mts +7 -7
  72. package/dist/client.d.ts +7 -7
  73. package/dist/{config.d-iRPI16ku.d.ts → config.d-DqKaCr1r.d.mts} +8 -1
  74. package/dist/{config.d-iRPI16ku.d.mts → config.d-DqKaCr1r.d.ts} +8 -1
  75. package/dist/config.d.mts +2 -2
  76. package/dist/config.d.ts +2 -2
  77. package/dist/desktop.d.mts +3 -3
  78. package/dist/desktop.d.ts +3 -3
  79. package/dist/{devtools-6XWCZIGO.cjs → devtools-TO6TAO32.cjs} +5 -5
  80. package/dist/{devtools-UQLDAOEI.mjs → devtools-UESYARTF.mjs} +4 -4
  81. package/dist/docs.cjs +7 -7
  82. package/dist/docs.d.mts +3 -3
  83. package/dist/docs.d.ts +3 -3
  84. package/dist/docs.mjs +6 -6
  85. package/dist/index.cjs +22 -18
  86. package/dist/{index.d-YxJ2AiDF.d.mts → index.d-BL7KKiwa.d.mts} +1 -1
  87. package/dist/{index.d-yueUNipJ.d.ts → index.d-BXsAXm1U.d.ts} +1 -1
  88. package/dist/index.d.mts +17 -17
  89. package/dist/index.d.ts +17 -17
  90. package/dist/index.mjs +22 -18
  91. package/dist/integrations.d.mts +2 -2
  92. package/dist/integrations.d.ts +2 -2
  93. package/dist/internal/app-markdown-runtime.cjs +3 -3
  94. package/dist/internal/app-markdown-runtime.d.mts +3 -3
  95. package/dist/internal/app-markdown-runtime.d.ts +3 -3
  96. package/dist/internal/app-markdown-runtime.mjs +2 -2
  97. package/dist/internal/build-runtime.cjs +20 -18
  98. package/dist/internal/build-runtime.d.mts +4 -4
  99. package/dist/internal/build-runtime.d.ts +4 -4
  100. package/dist/internal/build-runtime.mjs +19 -17
  101. package/dist/internal/cli-runtime.cjs +7 -7
  102. package/dist/internal/cli-runtime.mjs +6 -6
  103. package/dist/internal/client-error-overlay.cjs +4 -4
  104. package/dist/internal/client-error-overlay.mjs +1 -1
  105. package/dist/internal/client-runtime.d.mts +5 -5
  106. package/dist/internal/client-runtime.d.ts +5 -5
  107. package/dist/internal/compression-runtime.d.mts +2 -2
  108. package/dist/internal/compression-runtime.d.ts +2 -2
  109. package/dist/internal/config-runtime.cjs +6 -6
  110. package/dist/internal/config-runtime.d.mts +31 -7
  111. package/dist/internal/config-runtime.d.ts +31 -7
  112. package/dist/internal/config-runtime.mjs +5 -5
  113. package/dist/internal/infra-analytics-runtime.cjs +8 -8
  114. package/dist/internal/infra-analytics-runtime.mjs +6 -6
  115. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  116. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  117. package/dist/internal/production-runtime.cjs +87 -9
  118. package/dist/internal/production-runtime.d.mts +44 -12
  119. package/dist/internal/production-runtime.d.ts +44 -12
  120. package/dist/internal/production-runtime.mjs +86 -8
  121. package/dist/markdown.cjs +4 -2
  122. package/dist/markdown.d.mts +2 -2
  123. package/dist/markdown.d.ts +2 -2
  124. package/dist/markdown.mjs +3 -1
  125. package/dist/middleware.d.mts +4 -4
  126. package/dist/middleware.d.ts +4 -4
  127. package/dist/mobile.d.mts +21 -5
  128. package/dist/mobile.d.ts +21 -5
  129. package/dist/native-tree-EBPDFTRW.mjs +25 -0
  130. package/dist/native-tree-MMZS7S6W.cjs +25 -0
  131. package/dist/{navigation-delegate.d-HnDXhlyP.d.mts → navigation-delegate.d-C76gXTmO.d.mts} +1 -1
  132. package/dist/{navigation-delegate.d-BY1e_Xrh.d.ts → navigation-delegate.d-DIyDslxt.d.ts} +1 -1
  133. package/dist/navigation.d.mts +5 -5
  134. package/dist/navigation.d.ts +5 -5
  135. package/dist/plugin.cjs +14 -13
  136. package/dist/plugin.d.mts +5 -4
  137. package/dist/plugin.d.ts +5 -4
  138. package/dist/plugin.mjs +13 -12
  139. package/dist/{production-runtime.d-BpJUDzP8.d.mts → production-runtime.d-CDHztggO.d.mts} +1 -1
  140. package/dist/{production-runtime.d-lMjvE9cf.d.ts → production-runtime.d-tyaGdbk6.d.ts} +1 -1
  141. package/dist/{programmatic-routes-client.d-BlFp5hv4.d.ts → programmatic-routes-client.d-XfmIrCK1.d.ts} +2 -2
  142. package/dist/{programmatic-routes-client.d-6CGQ3TCk.d.mts → programmatic-routes-client.d-aAWiDd64.d.mts} +2 -2
  143. package/dist/{render-plan.d-BH9edqKs.d.mts → render-plan.d-Diwybxo8.d.mts} +1 -1
  144. package/dist/{render-plan.d-DhP0mTHF.d.ts → render-plan.d-Dr5WRjoV.d.ts} +1 -1
  145. package/dist/renderer-client.d.mts +5 -5
  146. package/dist/renderer-client.d.ts +5 -5
  147. package/dist/{request.d-BVZrsR1v.d.ts → request.d-D01fRn--.d.ts} +1 -1
  148. package/dist/{request.d-DJFRdKi8.d.mts → request.d-Dd3AFR79.d.mts} +1 -1
  149. package/dist/request.d.mts +3 -3
  150. package/dist/request.d.ts +3 -3
  151. package/dist/{route-rendering.d-Bpmw7PED.d.mts → route-rendering.d-BQ53lJ_D.d.mts} +1 -1
  152. package/dist/{route-rendering.d-B00JtK_-.d.ts → route-rendering.d-Bhx4QoJt.d.ts} +1 -1
  153. package/dist/{router.d-e0jQ3jQ-.d.mts → router.d-Bi23a6Xc.d.mts} +1 -1
  154. package/dist/{router.d-Bd1x9XxQ.d.ts → router.d-DQ3k7EYn.d.ts} +1 -1
  155. package/dist/{routes.d-Cmv8TgVq.d.mts → routes.d-BgTd7vI4.d.mts} +3 -3
  156. package/dist/{routes.d-D96Dq9lz.d.ts → routes.d-C7jMJFvP.d.ts} +3 -3
  157. package/dist/routes.d.mts +2 -2
  158. package/dist/routes.d.ts +2 -2
  159. package/dist/{rsc-pipeline-ZQ4CTVEG.mjs → rsc-pipeline-K3ER3Q4N.mjs} +5 -5
  160. package/dist/{rsc-pipeline-DX4OC5FN.cjs → rsc-pipeline-OCZIT5OF.cjs} +6 -6
  161. package/dist/{runtime-NQ3EDSA7.cjs → runtime-DKNSIH7V.cjs} +30 -23
  162. package/dist/{runtime-NPDRDV6R.mjs → runtime-MKYDEUZT.mjs} +20 -13
  163. package/dist/{runtime.d-CgB3IJDq.d.mts → runtime.d-B2Js6qZ2.d.mts} +1 -1
  164. package/dist/{runtime.d-D-td-RR3.d.ts → runtime.d-BL-CGwoi.d.ts} +1 -1
  165. package/dist/server-plugins.d.mts +3 -3
  166. package/dist/server-plugins.d.ts +3 -3
  167. package/dist/server.cjs +31 -30
  168. package/dist/server.d.mts +11 -10
  169. package/dist/server.d.ts +11 -10
  170. package/dist/server.mjs +16 -15
  171. package/dist/{spa-router.d-BWDhS0FK.d.mts → spa-router.d-B2rIFGs0.d.mts} +2 -2
  172. package/dist/{spa-router.d-CO01mVOM.d.ts → spa-router.d-DqZ6Lfs0.d.ts} +2 -2
  173. package/dist/testing.d.mts +2 -2
  174. package/dist/testing.d.ts +2 -2
  175. package/dist/{utils.d-B77__yh8.d.ts → utils.d-Bv2MPeLR.d.ts} +1 -1
  176. package/dist/{utils.d-DRDazhCA.d.mts → utils.d-fqXe8lNc.d.mts} +1 -1
  177. package/dist/version.cjs +2 -2
  178. package/dist/version.mjs +1 -1
  179. package/dist/vite.cjs +14 -13
  180. package/dist/vite.d.mts +12 -6
  181. package/dist/vite.d.ts +12 -6
  182. package/dist/vite.mjs +13 -12
  183. package/package.json +1 -1
@@ -1,5 +1,14 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
+
4
+
5
+
6
+
7
+
8
+
9
+ var _chunkEFZGB7JCcjs = require('./chunk-EFZGB7JC.cjs');
10
+
11
+
3
12
  var _chunkMF3IA2AWcjs = require('./chunk-MF3IA2AW.cjs');
4
13
 
5
14
 
@@ -22,7 +31,7 @@ var _chunk7FVVQEVLcjs = require('./chunk-7FVVQEVL.cjs');
22
31
 
23
32
 
24
33
 
25
- var _chunkGNJIYJMScjs = require('./chunk-GNJIYJMS.cjs');
34
+ var _chunk3XQ57EFIcjs = require('./chunk-3XQ57EFI.cjs');
26
35
 
27
36
 
28
37
 
@@ -34,7 +43,7 @@ var _chunkGNJIYJMScjs = require('./chunk-GNJIYJMS.cjs');
34
43
 
35
44
 
36
45
 
37
- var _chunk5N7QAGEAcjs = require('./chunk-5N7QAGEA.cjs');
46
+ var _chunkTWHXBMLJcjs = require('./chunk-TWHXBMLJ.cjs');
38
47
 
39
48
 
40
49
 
@@ -42,7 +51,7 @@ var _chunk5N7QAGEAcjs = require('./chunk-5N7QAGEA.cjs');
42
51
  var _chunkDZZHTMWMcjs = require('./chunk-DZZHTMWM.cjs');
43
52
 
44
53
 
45
- var _chunkQXPSWMUDcjs = require('./chunk-QXPSWMUD.cjs');
54
+ var _chunk7MD37P5Vcjs = require('./chunk-7MD37P5V.cjs');
46
55
 
47
56
 
48
57
  var _chunkBRWIVOV4cjs = require('./chunk-BRWIVOV4.cjs');
@@ -57,7 +66,9 @@ var _chunkV3UOEWCBcjs = require('./chunk-V3UOEWCB.cjs');
57
66
 
58
67
 
59
68
 
60
- var _chunkNPQLMP7Mcjs = require('./chunk-NPQLMP7M.cjs');
69
+ var _chunkKLNFJDFMcjs = require('./chunk-KLNFJDFM.cjs');
70
+
71
+
61
72
 
62
73
 
63
74
 
@@ -89,7 +100,7 @@ var _chunkNPQLMP7Mcjs = require('./chunk-NPQLMP7M.cjs');
89
100
 
90
101
 
91
102
 
92
- var _chunkWZW6LEHMcjs = require('./chunk-WZW6LEHM.cjs');
103
+ var _chunkTQMI6BYOcjs = require('./chunk-TQMI6BYO.cjs');
93
104
 
94
105
 
95
106
  var _chunkLNM57D3Hcjs = require('./chunk-LNM57D3H.cjs');
@@ -113,7 +124,10 @@ var _chunkUQHIWZZ6cjs = require('./chunk-UQHIWZZ6.cjs');
113
124
 
114
125
 
115
126
 
116
- var _chunk76GHW3WIcjs = require('./chunk-76GHW3WI.cjs');
127
+ var _chunkTSFMFPRUcjs = require('./chunk-TSFMFPRU.cjs');
128
+
129
+
130
+ var _chunk3HLQTOVUcjs = require('./chunk-3HLQTOVU.cjs');
117
131
 
118
132
 
119
133
  var _chunk47JV57DAcjs = require('./chunk-47JV57DA.cjs');
@@ -127,18 +141,18 @@ var _chunkSGBNF56Scjs = require('./chunk-SGBNF56S.cjs');
127
141
 
128
142
 
129
143
 
130
- var _chunkJ3LBO2O4cjs = require('./chunk-J3LBO2O4.cjs');
144
+ var _chunk4SEHMBL4cjs = require('./chunk-4SEHMBL4.cjs');
131
145
 
132
146
 
133
147
 
134
148
 
135
- var _chunkSBABQKPTcjs = require('./chunk-SBABQKPT.cjs');
149
+ var _chunk46KXZBOGcjs = require('./chunk-46KXZBOG.cjs');
136
150
 
137
151
 
138
152
  var _chunkNK2VWS7Pcjs = require('./chunk-NK2VWS7P.cjs');
139
153
 
140
154
 
141
- var _chunkJATTVAHAcjs = require('./chunk-JATTVAHA.cjs');
155
+ var _chunkB3GM5I6Ncjs = require('./chunk-B3GM5I6N.cjs');
142
156
 
143
157
 
144
158
 
@@ -191,7 +205,7 @@ var _chunkXYL4HSVCcjs = require('./chunk-XYL4HSVC.cjs');
191
205
  var _chunkFK25QSVCcjs = require('./chunk-FK25QSVC.cjs');
192
206
 
193
207
 
194
- var _chunkWJFFPXCVcjs = require('./chunk-WJFFPXCV.cjs');
208
+ var _chunkD7UQC4O6cjs = require('./chunk-D7UQC4O6.cjs');
195
209
 
196
210
 
197
211
  var _chunkJMYXO572cjs = require('./chunk-JMYXO572.cjs');
@@ -236,7 +250,7 @@ var _chunkVQJYGZNXcjs = require('./chunk-VQJYGZNX.cjs');
236
250
  var _chunkB5BBTPJQcjs = require('./chunk-B5BBTPJQ.cjs');
237
251
 
238
252
 
239
- var _chunkGUJTVM36cjs = require('./chunk-GUJTVM36.cjs');
253
+ var _chunkOAMUSC7Hcjs = require('./chunk-OAMUSC7H.cjs');
240
254
 
241
255
 
242
256
  var _chunkE552H232cjs = require('./chunk-E552H232.cjs');
@@ -343,7 +357,7 @@ function getDocsTitle(docs) {
343
357
  return typeof docs.config.nav === "object" && docs.config.nav && "title" in docs.config.nav ? String(docs.config.nav.title || "Documentation") : "Documentation";
344
358
  }
345
359
  function loadPages(contentDir, docs) {
346
- return _chunk5N7QAGEAcjs.discoverFarmDocsPages.call(void 0, contentDir, docs).map((page) => _chunk5N7QAGEAcjs.loadFarmDocsPage.call(void 0, contentDir, docs, page.slug)).filter((page) => Boolean(page)).sort((a, b) => a.href.localeCompare(b.href));
360
+ return _chunkTWHXBMLJcjs.discoverFarmDocsPages.call(void 0, contentDir, docs).map((page) => _chunkTWHXBMLJcjs.loadFarmDocsPage.call(void 0, contentDir, docs, page.slug)).filter((page) => Boolean(page)).sort((a, b) => a.href.localeCompare(b.href));
347
361
  }
348
362
  function findSocialImagePath(html) {
349
363
  const match = /<meta\s+property=["']og:image["']\s+content=["']([^"']+)["']/i.exec(html) || /<meta\s+content=["']([^"']+)["']\s+property=["']og:image["']/i.exec(html);
@@ -361,14 +375,14 @@ async function addHandlerRoute(routes, pathname, handler, absolutePaths) {
361
375
  return response;
362
376
  }
363
377
  async function compileFarmDocsManifest(docs, options) {
364
- const contentDir = _chunk5N7QAGEAcjs.resolveFarmDocsContentDir.call(void 0, docs, options);
378
+ const contentDir = _chunkTWHXBMLJcjs.resolveFarmDocsContentDir.call(void 0, docs, options);
365
379
  const pages = loadPages(contentDir, docs);
366
380
  const absolutePaths = [
367
381
  _path2.default.resolve(options.root),
368
382
  _path2.default.resolve(contentDir),
369
383
  docs.configPath || ""
370
384
  ];
371
- const handler = _chunk5N7QAGEAcjs.createFarmDocsHandler.call(void 0, docs, {
385
+ const handler = _chunkTWHXBMLJcjs.createFarmDocsHandler.call(void 0, docs, {
372
386
  root: options.root,
373
387
  srcDir: options.srcDir,
374
388
  clientEntry: options.clientEntry,
@@ -377,7 +391,7 @@ async function compileFarmDocsManifest(docs, options) {
377
391
  globalStylesheetHref: options.globalStylesheetHref,
378
392
  isPathGuarded: options.isPathGuarded
379
393
  });
380
- const apiHandler = _chunkGNJIYJMScjs.createFarmDocsAPIHandler.call(void 0, {
394
+ const apiHandler = _chunk3XQ57EFIcjs.createFarmDocsAPIHandler.call(void 0, {
381
395
  rootDir: options.root,
382
396
  srcDir: options.srcDir,
383
397
  docs,
@@ -388,7 +402,7 @@ async function compileFarmDocsManifest(docs, options) {
388
402
  const apiMarkdown = {};
389
403
  for (const page of pages) {
390
404
  const htmlResponse = await addHandlerRoute(routes, page.href, handler, absolutePaths);
391
- const markdownPath = _chunk5N7QAGEAcjs.getFarmDocsMarkdownPath.call(void 0, page.href);
405
+ const markdownPath = _chunkTWHXBMLJcjs.getFarmDocsMarkdownPath.call(void 0, page.href);
392
406
  await addHandlerRoute(routes, markdownPath, handler, absolutePaths);
393
407
  if (htmlResponse) {
394
408
  const socialImagePath = findSocialImagePath(await htmlResponse.text());
@@ -472,7 +486,7 @@ async function compileFarmDocsManifest(docs, options) {
472
486
  post: await compileResponse(postResponse, absolutePaths),
473
487
  search: {
474
488
  pages: publicPages.map((page) => ({
475
- ..._chunk5N7QAGEAcjs.toFarmDocsMarkdownPage.call(void 0, page),
489
+ ..._chunkTWHXBMLJcjs.toFarmDocsMarkdownPage.call(void 0, page),
476
490
  sourcePath: `farm-docs:${page.slug || "index"}`
477
491
  })),
478
492
  search: _nullishCoalesce(searchConfig, () => ( true)),
@@ -1618,7 +1632,7 @@ function restoreLiteralModuleSpecifiers(code, fileName, { parseSync, Visitor })
1618
1632
  throw new Error(`Failed to minify ${fileName}: ${parsed.errors[0].message}`);
1619
1633
  }
1620
1634
  const replacements = [];
1621
- let needsAst = hasRequireTemplate;
1635
+ let needsAst = hasRequireTemplate && /(?<![\w$])require\(`/.test(code);
1622
1636
  if (!needsAst) {
1623
1637
  const seenStarts = /* @__PURE__ */ new Set();
1624
1638
  for (const { moduleRequest } of parsed.module.dynamicImports) {
@@ -1822,7 +1836,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
1822
1836
  assertFarmDocsRuntimeSupported(config, preset);
1823
1837
  const srcDir = config.srcDir || "src";
1824
1838
  const distDir = config.distDir || ".farm";
1825
- const deployOutputDir = _chunkNPQLMP7Mcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
1839
+ const deployOutputDir = _chunkKLNFJDFMcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
1826
1840
  const lifecyclePluginManager = options.pluginManager;
1827
1841
  const productionViteResultPromise = Promise.allSettled([
1828
1842
  Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkMF3IA2AWcjs.loadFarmProductionVite.call(void 0, ))))
@@ -1841,7 +1855,7 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
1841
1855
  const routeRuntimeManifestResultPromise = Promise.allSettled([routeRuntimeManifestPromise]);
1842
1856
  const pageRoutes = [];
1843
1857
  for (const [pattern, entry] of routeManager.getRoutes()) {
1844
- const markdownSourcePath = entry.markdownSourcePath || (_chunkJATTVAHAcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? entry.modulePath : void 0);
1858
+ const markdownSourcePath = entry.markdownSourcePath || (_chunkB3GM5I6Ncjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? entry.modulePath : void 0);
1845
1859
  pageRoutes.push({
1846
1860
  pattern,
1847
1861
  ...entry.directory ? { directory: entry.directory } : {},
@@ -1912,6 +1926,7 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
1912
1926
  }
1913
1927
  const productionVite = productionViteResult.value;
1914
1928
  _chunkVQJYGZNXcjs.logger.info("\u26A1 Building application bundles with Vite Rolldown");
1929
+ const mobileClient = shouldBuildFarmMobileClient(config);
1915
1930
  const buildClientBundle = () => buildClient(
1916
1931
  productionVite,
1917
1932
  config,
@@ -1924,7 +1939,8 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
1924
1939
  isolatedClientBoundaryModules,
1925
1940
  hydrationPlanCache,
1926
1941
  rendererBuildLifetime,
1927
- routeManager.getProgrammaticClientRoutes()
1942
+ routeManager.getProgrammaticClientRoutes(),
1943
+ mobileClient
1928
1944
  );
1929
1945
  const buildSSRBundle = () => buildSSRInMemory(
1930
1946
  productionVite,
@@ -1977,7 +1993,8 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
1977
1993
  isolatedClientBoundaryModules,
1978
1994
  hydrationPlanCache,
1979
1995
  rendererBuildLifetime,
1980
- routeManager.getProgrammaticClientRoutes()
1996
+ routeManager.getProgrammaticClientRoutes(),
1997
+ mobileClient
1981
1998
  );
1982
1999
  } catch (retryError) {
1983
2000
  if (!(retryError instanceof IncompleteClientBuildOutputError)) throw retryError;
@@ -2036,6 +2053,27 @@ ${islandsErrors.map((error) => ` - ${error}`).join("\n")}`
2036
2053
  _optionalChain([rendererBuild, 'optionalAccess', _53 => _53.abort, 'call', _54 => _54()]);
2037
2054
  }
2038
2055
  }
2056
+ function shouldBuildFarmMobileClient(config, options = {}) {
2057
+ if (!config.mobileClient || config.desktop) return false;
2058
+ const mode = _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _55 => _55.experimental, 'optionalAccess', _56 => _56.serverComponents]));
2059
+ if (mode === void 0) return true;
2060
+ if (!options.quiet)
2061
+ _chunkVQJYGZNXcjs.logger.info(
2062
+ `\u{1F4F1} No mobile client for experimental.serverComponents (${mode}) yet; a mobile shell loads the web client.`
2063
+ );
2064
+ return false;
2065
+ }
2066
+ function varyFarmNitroCacheRulesByShell(rules) {
2067
+ return Object.fromEntries(
2068
+ Object.entries(rules).map(([source, rule]) => {
2069
+ const cached = _optionalChain([rule, 'optionalAccess', _57 => _57.swr]) !== void 0 && rule.swr !== false || _optionalChain([rule, 'optionalAccess', _58 => _58.cache]) !== void 0 && rule.cache !== false;
2070
+ if (!cached || rule.cache === false) return [source, rule];
2071
+ const cache = rule.cache && typeof rule.cache === "object" ? rule.cache : {};
2072
+ const varies = [...Array.isArray(cache.varies) ? cache.varies : [], "x-farm-shell"];
2073
+ return [source, { ...rule, cache: { ...cache, varies } }];
2074
+ })
2075
+ );
2076
+ }
2039
2077
  async function writeSSRAssetsToClient(bundle, outputDir) {
2040
2078
  const fs4 = await import("fs/promises");
2041
2079
  for (const [fileName, output] of Object.entries(bundle)) {
@@ -2078,7 +2116,7 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
2078
2116
  }
2079
2117
  const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
2080
2118
  await fs4.writeFile(fontCssPath, normalizedFontCss);
2081
- await fs4.writeFile(clientCssPath, _chunkWZW6LEHMcjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
2119
+ await fs4.writeFile(clientCssPath, _chunkTQMI6BYOcjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
2082
2120
  }
2083
2121
  var IncompleteClientBuildOutputError = class extends Error {
2084
2122
  constructor(detail) {
@@ -2124,12 +2162,13 @@ function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, optio
2124
2162
  const key = `${_path2.default.resolve(root)}\0${mode}\0${options.asyncOwnerIslands === true}\0${options.serverOwners === true}\0${options.serverTreeLayouts === true}\0${_path2.default.resolve(modulePath)}`;
2125
2163
  let plan = cache.get(key);
2126
2164
  if (!plan) {
2127
- plan = _chunkWZW6LEHMcjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
2165
+ plan = _chunkTQMI6BYOcjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
2128
2166
  cache.set(key, plan);
2129
2167
  }
2130
2168
  return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
2131
2169
  }
2132
- async function buildClient(productionVite, config, root, srcDir, outputDir, pageRoutes, layoutRoutes = [], routeSlots = [], isolatedClientBoundaryModules = /* @__PURE__ */ new Set(), hydrationPlanCache = /* @__PURE__ */ new Map(), rendererBuildLifetime, programmaticClientRoutes) {
2170
+ async function buildClient(productionVite, config, root, srcDir, outputDir, pageRoutes, layoutRoutes = [], routeSlots = [], isolatedClientBoundaryModules = /* @__PURE__ */ new Set(), hydrationPlanCache = /* @__PURE__ */ new Map(), rendererBuildLifetime, programmaticClientRoutes, mobile = false) {
2171
+ if (!mobile) await _chunkEFZGB7JCcjs.removeFarmMobileClientManifest.call(void 0, _path2.default.dirname(outputDir));
2133
2172
  const viteBuild = productionVite.build;
2134
2173
  const { farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.cjs");
2135
2174
  const { PluginManager: PluginManager2 } = await import("./plugin-HZIBL3DW.cjs");
@@ -2147,25 +2186,25 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2147
2186
  const unsupportedIntegrationProvider = integrationProviders.find(
2148
2187
  (provider) => provider.supportsIsolatedHydration !== true
2149
2188
  );
2150
- if (_optionalChain([config, 'access', _55 => _55.experimental, 'optionalAccess', _56 => _56.isolatedClientHydration]) === "enabled" && _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _57 => _57.experimental, 'optionalAccess', _58 => _58.serverComponents])) !== "rsc" && unsupportedIntegrationProvider) {
2189
+ if (_optionalChain([config, 'access', _59 => _59.experimental, 'optionalAccess', _60 => _60.isolatedClientHydration]) === "enabled" && _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _61 => _61.experimental, 'optionalAccess', _62 => _62.serverComponents])) !== "rsc" && unsupportedIntegrationProvider) {
2151
2190
  _chunkVQJYGZNXcjs.logger.warn(
2152
2191
  `[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
2153
2192
  );
2154
2193
  }
2155
- const isolatedMode = _chunkWZW6LEHMcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
2156
- _optionalChain([config, 'access', _59 => _59.experimental, 'optionalAccess', _60 => _60.isolatedClientHydration]),
2194
+ const isolatedMode = _chunkTQMI6BYOcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
2195
+ _optionalChain([config, 'access', _63 => _63.experimental, 'optionalAccess', _64 => _64.isolatedClientHydration]),
2157
2196
  {
2158
- serverComponents: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _61 => _61.experimental, 'optionalAccess', _62 => _62.serverComponents])) === "rsc",
2197
+ serverComponents: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _65 => _65.experimental, 'optionalAccess', _66 => _66.serverComponents])) === "rsc",
2159
2198
  hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
2160
2199
  }
2161
2200
  );
2162
- const planOptions = _chunkWZW6LEHMcjs.getFarmClientHydrationPlanOptions.call(void 0,
2201
+ const planOptions = _chunkTQMI6BYOcjs.getFarmClientHydrationPlanOptions.call(void 0,
2163
2202
  config.renderer,
2164
2203
  Boolean(unsupportedIntegrationProvider)
2165
2204
  );
2166
2205
  const pagePlanOptions = {
2167
2206
  ...planOptions,
2168
- serverOwners: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _63 => _63.experimental, 'optionalAccess', _64 => _64.serverComponents])) === "islands"
2207
+ serverOwners: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _67 => _67.experimental, 'optionalAccess', _68 => _68.serverComponents])) === "islands"
2169
2208
  };
2170
2209
  const layoutPlanOptions = {
2171
2210
  ...planOptions,
@@ -2216,21 +2255,21 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2216
2255
  };
2217
2256
  }
2218
2257
  });
2219
- const layoutAppliesToRoute = _chunk76GHW3WIcjs.routeBoundaryCoversDirectory;
2258
+ const layoutAppliesToRoute = _chunkTSFMFPRUcjs.routeBoundaryCoversDirectory;
2220
2259
  const routeDirectory = (route) => _nullishCoalesce(route.directory, () => ( route.pattern));
2221
2260
  const adapterOwnsDocsRuntime = Boolean(
2222
- _chunkRD623KW4cjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _65 => _65.docs, 'optionalAccess', _66 => _66.enabled]) && _optionalChain([config, 'access', _67 => _67.docs, 'access', _68 => _68.adapter, 'optionalAccess', _69 => _69.server]) && config.docs.adapter.react
2261
+ _chunkRD623KW4cjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _69 => _69.docs, 'optionalAccess', _70 => _70.enabled]) && _optionalChain([config, 'access', _71 => _71.docs, 'access', _72 => _72.adapter, 'optionalAccess', _73 => _73.server]) && config.docs.adapter.react
2223
2262
  );
2224
- const docsEntries = _optionalChain([config, 'access', _70 => _70.docs, 'optionalAccess', _71 => _71.enabled]) ? _chunk5N7QAGEAcjs.getFarmDocsRoots.call(void 0, config.docs).map(
2263
+ const docsEntries = _optionalChain([config, 'access', _74 => _74.docs, 'optionalAccess', _75 => _75.enabled]) ? _chunkTWHXBMLJcjs.getFarmDocsRoots.call(void 0, config.docs).map(
2225
2264
  (docsRoot) => `/${docsRoot.entry || "docs"}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/"
2226
2265
  ) : [];
2227
2266
  const adapterDocsEntry = _nullishCoalesce(docsEntries[0], () => ( null));
2228
2267
  const isAdapterDocsRoute = (routePattern) => adapterOwnsDocsRuntime && docsEntries.some(
2229
2268
  (docsEntry) => docsEntry === "/" || routePattern === docsEntry || routePattern.startsWith(`${docsEntry}/`)
2230
2269
  );
2231
- const syntheticDocsEntry = _optionalChain([config, 'access', _72 => _72.docs, 'optionalAccess', _73 => _73.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
2270
+ const syntheticDocsEntry = _optionalChain([config, 'access', _76 => _76.docs, 'optionalAccess', _77 => _77.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
2232
2271
  const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
2233
- const markdownPagePlan = _chunkWZW6LEHMcjs.createMarkdownPageHydrationPlanner.call(void 0,
2272
+ const markdownPagePlan = _chunkTQMI6BYOcjs.createMarkdownPageHydrationPlanner.call(void 0,
2234
2273
  _chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), root),
2235
2274
  root,
2236
2275
  isolatedMode,
@@ -2238,7 +2277,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2238
2277
  );
2239
2278
  const routePlans = pageRoutes.map((route) => ({
2240
2279
  route,
2241
- metadata: _chunkJATTVAHAcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
2280
+ metadata: _chunkB3GM5I6Ncjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
2242
2281
  route.modulePath,
2243
2282
  root,
2244
2283
  isolatedMode,
@@ -2246,7 +2285,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2246
2285
  pagePlanOptions
2247
2286
  )
2248
2287
  }));
2249
- _chunkWZW6LEHMcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
2288
+ _chunkTQMI6BYOcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
2250
2289
  clientLayouts.map((layout) => ({
2251
2290
  pattern: layout.pattern,
2252
2291
  depth: layout.pattern.split("/").filter(Boolean).length,
@@ -2255,7 +2294,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2255
2294
  [
2256
2295
  ...routePlans.map(({ route, metadata }) => ({
2257
2296
  pattern: routeDirectory(route),
2258
- depth: _chunk76GHW3WIcjs.getRouteDirectoryDepth.call(void 0, routeDirectory(route)),
2297
+ depth: _chunkTSFMFPRUcjs.getRouteDirectoryDepth.call(void 0, routeDirectory(route)),
2259
2298
  metadata
2260
2299
  })),
2261
2300
  ...syntheticDocsPatterns.map((pattern) => ({
@@ -2278,7 +2317,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2278
2317
  for (const layout of clientLayouts) {
2279
2318
  const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, routeDirectory(route))) || docsEntries.some((docsEntry) => layoutAppliesToRoute(layout.pattern, docsEntry));
2280
2319
  if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
2281
- _chunkVQJYGZNXcjs.logger.warn(`\u26A0\uFE0F ${_chunkWZW6LEHMcjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
2320
+ _chunkVQJYGZNXcjs.logger.warn(`\u26A0\uFE0F ${_chunkTQMI6BYOcjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
2282
2321
  }
2283
2322
  }
2284
2323
  if (isolatedMode === "analyze") {
@@ -2302,7 +2341,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2302
2341
  );
2303
2342
  if (metadata.suppressedAsyncHydration) {
2304
2343
  _chunkVQJYGZNXcjs.logger.warn(
2305
- `\u26A0\uFE0F ${_chunkWZW6LEHMcjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
2344
+ `\u26A0\uFE0F ${_chunkTQMI6BYOcjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
2306
2345
  );
2307
2346
  }
2308
2347
  if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0) {
@@ -2327,7 +2366,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2327
2366
  ...applicableClientLayouts.filter((layout) => layout.hasIsolatedClientBoundaries || layout.serverTreeLayout).flatMap((layout) => layout.isolatedBoundaries)
2328
2367
  ],
2329
2368
  // The server renders a server tree only below a hydrating layout.
2330
- ..._chunkWZW6LEHMcjs.usesFarmServerTree.call(void 0, metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
2369
+ ..._chunkTQMI6BYOcjs.usesFarmServerTree.call(void 0, metadata) && applicableClientLayouts.some((layout) => layout.shouldHydrate) ? { serverTree: true } : {}
2331
2370
  });
2332
2371
  _chunkVQJYGZNXcjs.logger.info(`\u{1F4F1} Found hydratable route: ${route.pattern} -> ${route.modulePath}`);
2333
2372
  }
@@ -2363,7 +2402,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2363
2402
  }
2364
2403
  const clientRouteSlots = routeSlots.filter((slot) => {
2365
2404
  try {
2366
- return _chunkWZW6LEHMcjs.getClientModuleMetadata.call(void 0, slot.modulePath, root).shouldHydrate;
2405
+ return _chunkTQMI6BYOcjs.getClientModuleMetadata.call(void 0, slot.modulePath, root).shouldHydrate;
2367
2406
  } catch (error) {
2368
2407
  _chunkVQJYGZNXcjs.logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
2369
2408
  return false;
@@ -2372,206 +2411,229 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2372
2411
  _chunkVQJYGZNXcjs.logger.info(
2373
2412
  `\u{1F4F1} Total hydratable routes detected: ${clientPages.length} pages, ${clientLayouts.filter((layout) => layout.shouldHydrate || layout.hasIsolatedClientBoundaries).length} layouts, and ${clientRouteSlots.length} slots`
2374
2413
  );
2375
- const clientEntryRoot = _path2.default.join(root, ".farm", "tmp");
2376
- await fs4.mkdir(clientEntryRoot, { recursive: true });
2377
- const clientEntryDir = await fs4.mkdtemp(_path2.default.join(clientEntryRoot, "client-entry-"));
2378
- const clientEntryPath = _path2.default.join(clientEntryDir, "farm-client-entry.tsx");
2379
- const clientHydrationCode = generateClientHydrationEntry(
2380
- clientPages,
2381
- clientLayouts,
2382
- clientRouteSlots,
2383
- root,
2384
- srcDir,
2385
- adapterOwnsDocsRuntime ? false : _chunkDZZHTMWMcjs.isFarmDocsSearchEnabled.call(void 0, config.docs),
2386
- adapterOwnsDocsRuntime ? void 0 : _chunkDZZHTMWMcjs.resolveFarmDocsSearchClientModule.call(void 0, root),
2387
- _optionalChain([config, 'access', _74 => _74.docs, 'optionalAccess', _75 => _75.enabled]) ? _chunk5N7QAGEAcjs.getFarmDocsRoots.call(void 0, config.docs).map((docsRoot) => docsRoot.entry) : void 0,
2388
- adapterOwnsDocsRuntime ? _optionalChain([config, 'access', _76 => _76.docs, 'access', _77 => _77.adapter, 'optionalAccess', _78 => _78.react]) : void 0,
2389
- config.i18n,
2390
- config.plugins,
2391
- config.renderer,
2392
- config.publicRuntimeConfig,
2393
- config.trailingSlash,
2394
- _chunkCECUDGXQcjs.getIntegrationProviders.call(void 0, config.integrations),
2395
- config.basePath,
2396
- _chunkWZW6LEHMcjs.generateClientCachePersistenceCode.call(void 0, _chunkWZW6LEHMcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
2397
- adapterOwnsDocsRuntime ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0,
2398
- _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _79 => _79.experimental, 'optionalAccess', _80 => _80.serverComponents])) === "islands"
2399
- );
2400
- await fs4.writeFile(clientEntryPath, clientHydrationCode);
2401
- const hasScopedPostcssConfig = hasProjectPostcssConfig(root);
2402
- let postcssSearchPath;
2403
- let tailwindVitePlugin = void 0;
2404
- const rendererVitePlugins = await _chunkRD623KW4cjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, root, {
2405
- ssr: false,
2406
- buildLifetime: rendererBuildLifetime
2407
- });
2408
- if (hasScopedPostcssConfig) {
2409
- _chunkVQJYGZNXcjs.logger.info("\u{1F4E6} Using project PostCSS/Tailwind configuration");
2410
- } else {
2411
- const postcssConfigPath = _path2.default.join(clientEntryDir, "postcss.config.cjs");
2412
- await fs4.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
2413
- postcssSearchPath = clientEntryDir;
2414
- tailwindVitePlugin = await _chunkLNM57D3Hcjs.loadTailwindVitePlugin.call(void 0, {
2415
- builder: productionVite.builder,
2416
- announce: true
2417
- });
2418
- }
2419
- try {
2420
- const clientViteConfig = {
2414
+ const buildTarget = async (platform) => {
2415
+ const clientEntryRoot = _path2.default.join(root, ".farm", "tmp");
2416
+ await fs4.mkdir(clientEntryRoot, { recursive: true });
2417
+ const clientEntryDir = await fs4.mkdtemp(_path2.default.join(clientEntryRoot, "client-entry-"));
2418
+ const clientEntryPath = _path2.default.join(clientEntryDir, "farm-client-entry.tsx");
2419
+ const clientHydrationCode = generateClientHydrationEntry(
2420
+ clientPages,
2421
+ clientLayouts,
2422
+ clientRouteSlots,
2421
2423
  root,
2422
- // Vite otherwise falls back to <root>/public, silently dropping every
2423
- // asset in a custom config.publicDir from the production client output.
2424
- publicDir: config.publicDir,
2425
- esbuild: {
2426
- jsxDev: false
2427
- },
2428
- build: {
2429
- // Preserve Farm's Vite 5 browser baseline when the production builder
2430
- // uses Vite 8, whose default target only covers newer browsers.
2431
- target: FARM_CLIENT_BUILD_TARGET,
2432
- outDir: outputDir,
2433
- emptyOutDir: true,
2434
- // Never public: see resolveFarmClientSourcemap.
2435
- sourcemap: resolveFarmClientSourcemap(_optionalChain([config, 'access', _81 => _81.vite, 'optionalAccess', _82 => _82.build, 'optionalAccess', _83 => _83.sourcemap])),
2436
- assetsInlineLimit: 0,
2437
- cssCodeSplit: false,
2438
- // Bundle all CSS into one file
2439
- rollupOptions: {
2440
- input: {
2441
- "farm-client": clientEntryPath
2442
- },
2443
- output: {
2444
- entryFileNames: "[name]-h[hash].js",
2445
- chunkFileNames: "chunks/[name]-h[hash].js",
2446
- hashCharacters: "hex",
2447
- // Use predictable name for CSS so we can reference it in SSR HTML
2448
- assetFileNames: (assetInfo) => {
2449
- if (_optionalChain([assetInfo, 'access', _84 => _84.name, 'optionalAccess', _85 => _85.endsWith, 'call', _86 => _86(".css")])) {
2450
- return "farm-client.css";
2424
+ srcDir,
2425
+ adapterOwnsDocsRuntime ? false : _chunkDZZHTMWMcjs.isFarmDocsSearchEnabled.call(void 0, config.docs),
2426
+ adapterOwnsDocsRuntime ? void 0 : _chunkDZZHTMWMcjs.resolveFarmDocsSearchClientModule.call(void 0, root),
2427
+ _optionalChain([config, 'access', _78 => _78.docs, 'optionalAccess', _79 => _79.enabled]) ? _chunkTWHXBMLJcjs.getFarmDocsRoots.call(void 0, config.docs).map((docsRoot) => docsRoot.entry) : void 0,
2428
+ adapterOwnsDocsRuntime ? _optionalChain([config, 'access', _80 => _80.docs, 'access', _81 => _81.adapter, 'optionalAccess', _82 => _82.react]) : void 0,
2429
+ config.i18n,
2430
+ config.plugins,
2431
+ config.renderer,
2432
+ config.publicRuntimeConfig,
2433
+ config.trailingSlash,
2434
+ _chunkCECUDGXQcjs.getIntegrationProviders.call(void 0, config.integrations),
2435
+ config.basePath,
2436
+ _chunkTQMI6BYOcjs.generateClientCachePersistenceCode.call(void 0, _chunkTQMI6BYOcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
2437
+ adapterOwnsDocsRuntime ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0,
2438
+ _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _83 => _83.experimental, 'optionalAccess', _84 => _84.serverComponents])) === "islands",
2439
+ platform
2440
+ );
2441
+ const entryName = platform === "mobile" ? _chunkEFZGB7JCcjs.FARM_MOBILE_CLIENT_ENTRY_NAME : "farm-client";
2442
+ await fs4.writeFile(clientEntryPath, clientHydrationCode);
2443
+ const hasScopedPostcssConfig = hasProjectPostcssConfig(root);
2444
+ let postcssSearchPath;
2445
+ let tailwindVitePlugin = void 0;
2446
+ const rendererVitePlugins = await _chunkRD623KW4cjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, root, {
2447
+ ssr: false,
2448
+ buildLifetime: rendererBuildLifetime
2449
+ });
2450
+ if (hasScopedPostcssConfig) {
2451
+ _chunkVQJYGZNXcjs.logger.info("\u{1F4E6} Using project PostCSS/Tailwind configuration");
2452
+ } else {
2453
+ const postcssConfigPath = _path2.default.join(clientEntryDir, "postcss.config.cjs");
2454
+ await fs4.writeFile(postcssConfigPath, "module.exports = { plugins: [] };\n");
2455
+ postcssSearchPath = clientEntryDir;
2456
+ tailwindVitePlugin = await _chunkLNM57D3Hcjs.loadTailwindVitePlugin.call(void 0, {
2457
+ builder: productionVite.builder,
2458
+ announce: true
2459
+ });
2460
+ }
2461
+ try {
2462
+ const clientViteConfig = {
2463
+ root,
2464
+ // Vite otherwise falls back to <root>/public, silently dropping every
2465
+ // asset in a custom config.publicDir from the production client output.
2466
+ // The mobile client adds to the web client's output; public files are copied once.
2467
+ publicDir: platform === "mobile" ? false : config.publicDir,
2468
+ esbuild: {
2469
+ jsxDev: false
2470
+ },
2471
+ build: {
2472
+ // Preserve Farm's Vite 5 browser baseline when the production builder
2473
+ // uses Vite 8, whose default target only covers newer browsers.
2474
+ target: FARM_CLIENT_BUILD_TARGET,
2475
+ outDir: outputDir,
2476
+ emptyOutDir: platform === "web",
2477
+ // Never public: see resolveFarmClientSourcemap.
2478
+ sourcemap: resolveFarmClientSourcemap(_optionalChain([config, 'access', _85 => _85.vite, 'optionalAccess', _86 => _86.build, 'optionalAccess', _87 => _87.sourcemap])),
2479
+ assetsInlineLimit: 0,
2480
+ cssCodeSplit: false,
2481
+ // Bundle all CSS into one file
2482
+ rollupOptions: {
2483
+ input: {
2484
+ [entryName]: clientEntryPath
2485
+ },
2486
+ output: {
2487
+ entryFileNames: "[name]-h[hash].js",
2488
+ chunkFileNames: "chunks/[name]-h[hash].js",
2489
+ hashCharacters: "hex",
2490
+ // Use predictable name for CSS so we can reference it in SSR HTML
2491
+ assetFileNames: (assetInfo) => {
2492
+ if (_optionalChain([assetInfo, 'access', _88 => _88.name, 'optionalAccess', _89 => _89.endsWith, 'call', _90 => _90(".css")])) {
2493
+ return `${entryName}.css`;
2494
+ }
2495
+ return "assets/[name]-h[hash][extname]";
2451
2496
  }
2452
- return "assets/[name]-h[hash][extname]";
2453
- }
2454
- },
2455
- // A browser cannot load a Node builtin: farmServerOnlyEntriesPlugin
2456
- // resolves one to Farm's browser module for it instead.
2457
- external: (id) => {
2458
- if (id === "fsevents" || id.includes("fsevents") || id.endsWith(".node")) {
2459
- return true;
2497
+ },
2498
+ // A browser cannot load a Node builtin: farmServerOnlyEntriesPlugin
2499
+ // resolves one to Farm's browser module for it instead.
2500
+ external: (id) => {
2501
+ if (id === "fsevents" || id.includes("fsevents") || id.endsWith(".node")) {
2502
+ return true;
2503
+ }
2504
+ return false;
2460
2505
  }
2461
- return false;
2462
2506
  }
2463
- }
2464
- },
2465
- plugins: [
2466
- _chunkWZW6LEHMcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
2467
- createFarmPrivateClientSourcemapsPlugin({
2468
- outDir: _path2.default.join(_path2.default.dirname(outputDir), FARM_CLIENT_SOURCEMAPS_DIR)
2469
- }),
2470
- createFarmClientModulePreloadPlugin({
2471
- root,
2472
- buildDir: _path2.default.dirname(outputDir),
2473
- entryName: "farm-client"
2474
- }),
2475
- ...adapterOwnsDocsRuntime ? [
2476
- createFarmDocsModulePreloadPlugin({
2507
+ },
2508
+ plugins: [
2509
+ _chunkTQMI6BYOcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
2510
+ createFarmPrivateClientSourcemapsPlugin({
2511
+ outDir: _path2.default.join(
2512
+ _path2.default.dirname(outputDir),
2513
+ platform === "mobile" ? `${FARM_CLIENT_SOURCEMAPS_DIR}-mobile` : FARM_CLIENT_SOURCEMAPS_DIR
2514
+ )
2515
+ }),
2516
+ // The web client's preload manifests; the mobile client records its files instead.
2517
+ platform === "mobile" ? _chunkEFZGB7JCcjs.createFarmMobileClientManifestPlugin.call(void 0, {
2518
+ buildDir: _path2.default.dirname(outputDir),
2519
+ entryName
2520
+ }) : createFarmClientModulePreloadPlugin({
2477
2521
  root,
2478
2522
  buildDir: _path2.default.dirname(outputDir),
2479
- importer: clientEntryPath,
2480
- entryName: "farm-client",
2481
- modules: [
2482
- config.docs.adapter.react,
2483
- _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs)
2484
- ].filter((specifier) => Boolean(specifier))
2485
- })
2486
- ] : [],
2487
- ...tailwindVitePlugin ? [tailwindVitePlugin] : [],
2488
- ...rendererVitePlugins,
2489
- ...config.vite.plugins || [],
2490
- farmServerOnlyEntriesPlugin(),
2491
- _chunkWZW6LEHMcjs.farmDocsClientConfigPlugin.call(void 0,
2492
- adapterOwnsDocsRuntime ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
2493
- ),
2494
- // Plugin to redirect @farm.js/core imports to client-only exports
2495
- {
2496
- name: "farm-client-only-imports",
2497
- enforce: "pre",
2498
- resolveId(id) {
2499
- if (id === "@farm.js/core") {
2500
- return { id: "\0farm-client-exports", external: false };
2501
- }
2502
- if (id === "@farm.js/core/i18n/server") {
2503
- return { id: "\0farm-i18n-client-bridge", external: false };
2504
- }
2505
- if (id === "@farm.js/core/server" || id === "@farm.js/core/api" || id === "@farm.js/core/middleware" || id === "@farm.js/core/headers" || id === "@farm.js/core/config" || id.includes("@farm.js/core/middleware") || id.includes("@farm.js/core/query/server")) {
2506
- return { id: "\0empty-module", external: false };
2507
- }
2508
- if (id.includes("/api/") && id.includes("/route")) {
2509
- return { id: "\0empty-api-route", external: false };
2510
- }
2511
- if (id === "fsevents" || id.includes("fsevents") || id.endsWith(".node") || id === "nitro" || id === "vite" || id === "esbuild" || id === "rolldown" || id.startsWith("rolldown/") || id === "rollup" || id.startsWith("nitro/") || id.includes("node-pre-gyp") || id.includes("nf3")) {
2512
- return { id: "\0empty-module", external: false };
2523
+ entryName: "farm-client"
2524
+ }),
2525
+ ...adapterOwnsDocsRuntime && platform === "web" ? [
2526
+ createFarmDocsModulePreloadPlugin({
2527
+ root,
2528
+ buildDir: _path2.default.dirname(outputDir),
2529
+ importer: clientEntryPath,
2530
+ entryName: "farm-client",
2531
+ modules: [
2532
+ config.docs.adapter.react,
2533
+ _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs)
2534
+ ].filter((specifier) => Boolean(specifier))
2535
+ })
2536
+ ] : [],
2537
+ ...tailwindVitePlugin ? [tailwindVitePlugin] : [],
2538
+ ...rendererVitePlugins,
2539
+ ...config.vite.plugins || [],
2540
+ farmServerOnlyEntriesPlugin({ platform }),
2541
+ _chunkTQMI6BYOcjs.farmDocsClientConfigPlugin.call(void 0,
2542
+ adapterOwnsDocsRuntime ? _chunkSM2SYWARcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
2543
+ ),
2544
+ // Plugin to redirect @farm.js/core imports to client-only exports
2545
+ {
2546
+ name: "farm-client-only-imports",
2547
+ enforce: "pre",
2548
+ resolveId(id) {
2549
+ if (id === "@farm.js/core") {
2550
+ return { id: "\0farm-client-exports", external: false };
2551
+ }
2552
+ if (id === "@farm.js/core/i18n/server") {
2553
+ return { id: "\0farm-i18n-client-bridge", external: false };
2554
+ }
2555
+ if (id === "@farm.js/core/server" || id === "@farm.js/core/api" || id === "@farm.js/core/middleware" || id === "@farm.js/core/headers" || id === "@farm.js/core/config" || id.includes("@farm.js/core/middleware") || id.includes("@farm.js/core/query/server")) {
2556
+ return { id: "\0empty-module", external: false };
2557
+ }
2558
+ if (id.includes("/api/") && id.includes("/route")) {
2559
+ return { id: "\0empty-api-route", external: false };
2560
+ }
2561
+ if (id === "fsevents" || id.includes("fsevents") || id.endsWith(".node") || id === "nitro" || id === "vite" || id === "esbuild" || id === "rolldown" || id.startsWith("rolldown/") || id === "rollup" || id.startsWith("nitro/") || id.includes("node-pre-gyp") || id.includes("nf3")) {
2562
+ return { id: "\0empty-module", external: false };
2563
+ }
2564
+ return null;
2565
+ },
2566
+ load(id) {
2567
+ if (id === "\0empty-module") {
2568
+ return "const emptyMiddlewareStore = new Map(); export default {}; export const getMiddlewareContext = () => emptyMiddlewareStore; export const getMiddlewareData = () => emptyMiddlewareStore; export const getMiddlewareValue = () => undefined; export const middleware = () => ({});";
2569
+ }
2570
+ if (id === "\0empty-api-route") {
2571
+ return "export const GET = () => {}; export const HEAD = () => {}; export const QUERY = () => {}; export const POST = () => {}; export const PUT = () => {}; export const DELETE = () => {}; export const PATCH = () => {}; export const OPTIONS = () => {}; export default {};";
2572
+ }
2573
+ if (id === "\0farm-i18n-client-bridge") {
2574
+ return 'export { createTranslator, format, getLocale, getLocaleSource, t } from "@farm.js/core/i18n/client";';
2575
+ }
2576
+ if (id === "\0farm-client-exports") {
2577
+ return [
2578
+ "// Farm.js Client Exports - Safe for browser bundling",
2579
+ 'export { Link } from "@farm.js/core/client";',
2580
+ 'export { useRouter } from "@farm.js/core/client";',
2581
+ 'export { usePathname, useSearchParams } from "@farm.js/core/navigation";',
2582
+ // A page that hydrates ships to the browser with its notFound()/redirect() calls.
2583
+ 'export { getFarmRedirectError, isFarmNotFoundError, isFarmRedirectError, notFound, permanentRedirect, redirect } from "@farm.js/core/navigation";',
2584
+ 'export { createAPIClient } from "@farm.js/core/client";',
2585
+ 'export { localFont, remoteFont } from "@farm.js/core/font";'
2586
+ ].join("\n");
2587
+ }
2588
+ return null;
2513
2589
  }
2514
- return null;
2515
2590
  },
2516
- load(id) {
2517
- if (id === "\0empty-module") {
2518
- return "const emptyMiddlewareStore = new Map(); export default {}; export const getMiddlewareContext = () => emptyMiddlewareStore; export const getMiddlewareData = () => emptyMiddlewareStore; export const getMiddlewareValue = () => undefined; export const middleware = () => ({});";
2519
- }
2520
- if (id === "\0empty-api-route") {
2521
- return "export const GET = () => {}; export const HEAD = () => {}; export const QUERY = () => {}; export const POST = () => {}; export const PUT = () => {}; export const DELETE = () => {}; export const PATCH = () => {}; export const OPTIONS = () => {}; export default {};";
2522
- }
2523
- if (id === "\0farm-i18n-client-bridge") {
2524
- return 'export { createTranslator, format, getLocale, getLocaleSource, t } from "@farm.js/core/i18n/client";';
2525
- }
2526
- if (id === "\0farm-client-exports") {
2527
- return [
2528
- "// Farm.js Client Exports - Safe for browser bundling",
2529
- 'export { Link } from "@farm.js/core/client";',
2530
- 'export { useRouter } from "@farm.js/core/client";',
2531
- 'export { usePathname, useSearchParams } from "@farm.js/core/navigation";',
2532
- // A page that hydrates ships to the browser with its notFound()/redirect() calls.
2533
- 'export { getFarmRedirectError, isFarmNotFoundError, isFarmRedirectError, notFound, permanentRedirect, redirect } from "@farm.js/core/navigation";',
2534
- 'export { createAPIClient } from "@farm.js/core/client";',
2535
- 'export { localFont, remoteFont } from "@farm.js/core/font";'
2536
- ].join("\n");
2537
- }
2538
- return null;
2539
- }
2591
+ farmPlugin(
2592
+ { ...config, isolatedClientBoundaryModules, programmaticClientRoutes },
2593
+ pluginManager
2594
+ ),
2595
+ _chunkNK2VWS7Pcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
2596
+ ],
2597
+ mode: "production",
2598
+ css: postcssSearchPath ? {
2599
+ postcss: postcssSearchPath
2600
+ } : void 0,
2601
+ // Ensure React is bundled for client
2602
+ resolve: {
2603
+ alias: _chunkTQMI6BYOcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
2604
+ dedupe: [...config.renderer.dedupe || []]
2540
2605
  },
2541
- farmPlugin(
2542
- { ...config, isolatedClientBoundaryModules, programmaticClientRoutes },
2543
- pluginManager
2544
- ),
2545
- _chunkNK2VWS7Pcjs.farmEnvironmentFunctionsPlugin.call(void 0, config)
2546
- ],
2547
- mode: "production",
2548
- css: postcssSearchPath ? {
2549
- postcss: postcssSearchPath
2550
- } : void 0,
2551
- // Ensure React is bundled for client
2552
- resolve: {
2553
- alias: _chunkWZW6LEHMcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
2554
- dedupe: [...config.renderer.dedupe || []]
2555
- },
2556
- // Optimize dependencies - exclude server-side code from client bundle
2557
- optimizeDeps: {
2558
- exclude: [
2559
- "@farm.js/core/server",
2560
- "@farm.js/core/api",
2561
- "@farm.js/core/middleware",
2562
- "@farm.js/core/headers"
2563
- ]
2606
+ // Optimize dependencies - exclude server-side code from client bundle
2607
+ optimizeDeps: {
2608
+ exclude: [
2609
+ "@farm.js/core/server",
2610
+ "@farm.js/core/api",
2611
+ "@farm.js/core/middleware",
2612
+ "@farm.js/core/headers"
2613
+ ]
2614
+ }
2615
+ };
2616
+ await viteBuild(_chunkTQMI6BYOcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
2617
+ if (platform === "mobile") {
2618
+ await fs4.rm(_path2.default.join(outputDir, `${entryName}.css`), { force: true });
2619
+ if (!await _chunkEFZGB7JCcjs.hasFarmMobileClientEntry.call(void 0, _path2.default.dirname(outputDir), outputDir)) {
2620
+ throw new IncompleteClientBuildOutputError(
2621
+ `${_chunkEFZGB7JCcjs.FARM_MOBILE_CLIENT_ENTRY_NAME}.js is missing or empty`
2622
+ );
2623
+ }
2624
+ } else {
2625
+ await mergeBuiltFontCss(outputDir);
2626
+ await validateClientBuildOutput(root, srcDir, outputDir);
2627
+ }
2628
+ } finally {
2629
+ try {
2630
+ await fs4.rm(clientEntryDir, { recursive: true, force: true });
2631
+ } catch (e27) {
2564
2632
  }
2565
- };
2566
- await viteBuild(_chunkWZW6LEHMcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
2567
- await mergeBuiltFontCss(outputDir);
2568
- await validateClientBuildOutput(root, srcDir, outputDir);
2569
- } finally {
2570
- try {
2571
- await fs4.rm(clientEntryDir, { recursive: true, force: true });
2572
- } catch (e27) {
2573
2633
  }
2574
- }
2634
+ };
2635
+ await buildTarget("web");
2636
+ if (mobile) await buildTarget("mobile");
2575
2637
  }
2576
2638
  function toBakedMarkdownSourcePath(root, filePath) {
2577
2639
  if (!filePath) return "";
@@ -3447,20 +3509,21 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
3447
3509
  secure: false
3448
3510
  },
3449
3511
  direction: {}
3450
- }, plugins = [], renderer = _chunkRD623KW4cjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule, islandValues = false) {
3512
+ }, plugins = [], renderer = _chunkRD623KW4cjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule, islandValues = false, platform) {
3451
3513
  const toImportPath = (targetPath) => targetPath.replace(/\\/g, "/");
3452
- const clientPluginEntry = _chunkWZW6LEHMcjs.generateFarmClientPluginEntryCode.call(void 0,
3514
+ const clientPluginEntry = _chunkTQMI6BYOcjs.generateFarmClientPluginEntryCode.call(void 0,
3453
3515
  plugins,
3454
3516
  root,
3455
3517
  srcDir,
3456
- publicRuntimeConfig
3518
+ publicRuntimeConfig,
3519
+ platform
3457
3520
  );
3458
3521
  const appSetupPath = _chunkRD623KW4cjs.resolveFarmRendererAppSetup.call(void 0, root, renderer);
3459
3522
  const rendererClientImports = _chunkRD623KW4cjs.isReactRenderer.call(void 0, renderer) ? `import React from "react";
3460
3523
  import { createRoot, hydrateRoot } from "react-dom/client";` : appSetupPath ? `import React, { createRoot, hydrateRoot, configureApp as __farmConfigureApp } from ${JSON.stringify(renderer.client)};
3461
3524
  import __farmAppSetup from ${JSON.stringify(_chunkVQJYGZNXcjs.toPosixPath.call(void 0, appSetupPath))};
3462
3525
  __farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};`;
3463
- const providerClientCode = _chunkWZW6LEHMcjs.generateFarmIntegrationProviderClientCode.call(void 0,
3526
+ const providerClientCode = _chunkTQMI6BYOcjs.generateFarmIntegrationProviderClientCode.call(void 0,
3464
3527
  integrationProviders,
3465
3528
  root,
3466
3529
  _nullishCoalesce(renderer.componentExtensions, () => ( []))
@@ -3470,18 +3533,18 @@ __farmConfigureApp(__farmAppSetup);` : `import React, { createRoot, hydrateRoot
3470
3533
  const layoutImportStatements = [];
3471
3534
  const layoutRegistrations = [];
3472
3535
  const hydratingLayoutPatterns = layoutRoutes.filter((layout) => layout.shouldHydrate).map((layout) => layout.pattern);
3473
- const treeLayoutPatterns = islandValues ? _chunk76GHW3WIcjs.getFarmServerTreeLayoutPatterns.call(void 0, layoutRoutes) : /* @__PURE__ */ new Set();
3536
+ const treeLayoutPatterns = islandValues ? _chunkTSFMFPRUcjs.getFarmServerTreeLayoutPatterns.call(void 0, layoutRoutes) : /* @__PURE__ */ new Set();
3474
3537
  layoutRoutes.forEach((layout, index) => {
3475
3538
  const relativePath = toImportPath(layout.modulePath);
3476
3539
  const treeLayout = treeLayoutPatterns.has(layout.pattern);
3477
3540
  const rendersOnClient = treeLayout || !layout.hasIsolatedClientBoundaries && hydratingLayoutPatterns.some(
3478
- (pattern) => _chunk76GHW3WIcjs.layoutsCanCoverSamePage.call(void 0, layout.pattern, pattern)
3541
+ (pattern) => _chunkTSFMFPRUcjs.layoutsCanCoverSamePage.call(void 0, layout.pattern, pattern)
3479
3542
  );
3480
3543
  if (rendersOnClient && !treeLayout) {
3481
3544
  layoutImportStatements.push(`import Layout${index} from "${relativePath}";`);
3482
3545
  }
3483
- const groupScope = _chunk76GHW3WIcjs.getRouteGroupScope.call(void 0, layout.pattern);
3484
- const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(_chunk76GHW3WIcjs.stripRouteGroups.call(void 0, layout.pattern))}, groupScope: ${JSON.stringify(groupScope)}` : "";
3546
+ const groupScope = _chunkTSFMFPRUcjs.getRouteGroupScope.call(void 0, layout.pattern);
3547
+ const groupFields = groupScope ? `, urlPattern: ${JSON.stringify(_chunkTSFMFPRUcjs.stripRouteGroups.call(void 0, layout.pattern))}, groupScope: ${JSON.stringify(groupScope)}` : "";
3485
3548
  layoutRegistrations.push(
3486
3549
  ` { pattern: ${JSON.stringify(layout.pattern)}${groupFields}, Component: ${rendersOnClient ? treeLayout ? `getFarmTreeLayoutComponent(${JSON.stringify(layout.pattern)})` : `Layout${index}` : "null"}, shouldHydrate: ${JSON.stringify(layout.shouldHydrate)}, islandStrategy: ${JSON.stringify(layout.islandStrategy)}${treeLayout ? ", serverTree: true" : ""} }`
3487
3550
  );
@@ -4004,7 +4067,7 @@ function hasHydratableLayout(pathname) {
4004
4067
  });
4005
4068
  }
4006
4069
 
4007
- ${_chunkWZW6LEHMcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
4070
+ ${_chunkTQMI6BYOcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
4008
4071
  // Wrap a page element with applicable layouts
4009
4072
  function wrapWithLayouts(pageElement, pathname, params) {
4010
4073
  const layouts = getApplicableLayouts(pathname);
@@ -4039,7 +4102,7 @@ function createLayoutPageBoundary(route, pageElement, serverHtml) {
4039
4102
  return React.createElement("div", props, pageElement);
4040
4103
  }
4041
4104
  let farmLastRouteState = null;
4042
- ${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${_chunkWZW6LEHMcjs.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE}
4105
+ ${hasServerTreeLayouts && islandValues && isolatedHydrationEnabled ? `${_chunkTQMI6BYOcjs.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE}
4043
4106
  function farmTreeLayoutsOf(pathname) {
4044
4107
  return getApplicableLayouts(pathname).filter(function(layout) {
4045
4108
  return layout.serverTree === true;
@@ -5265,7 +5328,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
5265
5328
  }
5266
5329
  const middlewareRoutes = await discoverMiddlewareRoutes(appDirs);
5267
5330
  const instrumentationPath = _chunkBRWIVOV4cjs.resolveFarmInstrumentationFile.call(void 0, root, config.srcDir || "src");
5268
- const notFoundPath = _chunkWZW6LEHMcjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
5331
+ const notFoundPath = _chunkTQMI6BYOcjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
5269
5332
  if (notFoundPath) _chunkVQJYGZNXcjs.logger.info(`\u{1F4CB} Found custom 404 page: ${notFoundPath}`);
5270
5333
  layoutRoutes.sort((a, b) => {
5271
5334
  const depthA = a.pattern.split("/").filter(Boolean).length;
@@ -5286,9 +5349,9 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
5286
5349
  (provider) => provider.component || provider.type === "clerk"
5287
5350
  );
5288
5351
  const hasObservabilityHandler = !!config.observability && typeof config.observability === "object" && "onEvent" in config.observability;
5289
- const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _87 => _87.mdx, 'optionalAccess', _88 => _88.components]));
5290
- const hasMiddlewareConfig = _chunk76GHW3WIcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
5291
- const hasRouteContextConfig = _chunkNPQLMP7Mcjs.hasCustomFarmRouteContext.call(void 0, config);
5352
+ const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _91 => _91.mdx, 'optionalAccess', _92 => _92.components]));
5353
+ const hasMiddlewareConfig = _chunkTSFMFPRUcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
5354
+ const hasRouteContextConfig = _chunkKLNFJDFMcjs.hasCustomFarmRouteContext.call(void 0, config);
5292
5355
  const hasServerRuntimePlugins = hasFarmServerRuntimePlugins(config);
5293
5356
  const hasPluginRoutes = hasFarmPluginRoutes(config);
5294
5357
  const hasServerCacheConfig = hasFarmServerCacheConfig(config.cache);
@@ -5298,18 +5361,18 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
5298
5361
  const hasConfiguredRuntimePlugins = Boolean(
5299
5362
  hasRuntimeConfigModule && (config.plugins || []).length > 0
5300
5363
  );
5301
- if (_chunkGNJIYJMScjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
5364
+ if (_chunk3XQ57EFIcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
5302
5365
  const adapterGuardedPaths = new Set(getFarmDocsGuardedPaths(config, middlewareRoutes));
5303
- _chunkGNJIYJMScjs.assertFarmDocsAdapterServesNoGuardedPages.call(void 0,
5366
+ _chunk3XQ57EFIcjs.assertFarmDocsAdapterServesNoGuardedPages.call(void 0,
5304
5367
  config.docs,
5305
5368
  { root, srcDir: config.srcDir },
5306
5369
  (pathname) => adapterGuardedPaths.has(pathname)
5307
5370
  );
5308
5371
  }
5309
5372
  const farmDocsCspNonceMarker = _chunk6JHZPB52cjs.createFarmCspNonce.call(void 0, config.security);
5310
- const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _89 => _89.docs, 'optionalAccess', _90 => _90.enabled]) && _chunkE552H232cjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? await _chunkHNAISJFDcjs._runWithFarmCspNonce.call(void 0,
5373
+ const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _93 => _93.docs, 'optionalAccess', _94 => _94.enabled]) && _chunkE552H232cjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? await _chunkHNAISJFDcjs._runWithFarmCspNonce.call(void 0,
5311
5374
  farmDocsCspNonceMarker,
5312
- async () => _optionalChain([config, 'access', _91 => _91.docs, 'access', _92 => _92.adapter, 'optionalAccess', _93 => _93.server]) ? await _chunkGNJIYJMScjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
5375
+ async () => _optionalChain([config, 'access', _95 => _95.docs, 'access', _96 => _96.adapter, 'optionalAccess', _97 => _97.server]) ? await _chunk3XQ57EFIcjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
5313
5376
  root,
5314
5377
  srcDir: config.srcDir,
5315
5378
  clientEntry: FARM_CLIENT_JS_SRC_PLACEHOLDER,
@@ -5418,7 +5481,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
5418
5481
  // Adapters can render provider scripts by serializing function source.
5419
5482
  // keepNames injects helper calls into those functions; after Nitro
5420
5483
  // minifies the server chunk the helper is no longer in script scope.
5421
- keepNames: !(_optionalChain([config, 'access', _94 => _94.docs, 'optionalAccess', _95 => _95.enabled]) && _optionalChain([config, 'access', _96 => _96.docs, 'access', _97 => _97.adapter, 'optionalAccess', _98 => _98.server])),
5484
+ keepNames: !(_optionalChain([config, 'access', _98 => _98.docs, 'optionalAccess', _99 => _99.enabled]) && _optionalChain([config, 'access', _100 => _100.docs, 'access', _101 => _101.adapter, 'optionalAccess', _102 => _102.server])),
5422
5485
  jsxDev: false
5423
5486
  },
5424
5487
  // SSR configuration to externalize problematic modules
@@ -5468,10 +5531,10 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
5468
5531
  define: {
5469
5532
  __FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
5470
5533
  __FARM_ENV__: JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, config.env)),
5471
- __FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _99 => _99.env, 'optionalAccess', _100 => _100.public]) || {})
5534
+ __FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _103 => _103.env, 'optionalAccess', _104 => _104.public]) || {})
5472
5535
  },
5473
5536
  plugins: [
5474
- _chunkWZW6LEHMcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
5537
+ _chunkTQMI6BYOcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
5475
5538
  ...tailwindVitePlugin ? [tailwindVitePlugin] : [],
5476
5539
  ...rendererVitePlugins,
5477
5540
  ...config.vite.plugins || [],
@@ -5532,7 +5595,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
5532
5595
  resolve: {
5533
5596
  alias: [
5534
5597
  ...shouldAliasReactServerToWebBuild(config.renderer, preset) ? [createFarmReactWebServerAlias(hasReactDomEdgeServerBuild(root))] : [],
5535
- ...Object.entries(_chunkWZW6LEHMcjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
5598
+ ...Object.entries(_chunkTQMI6BYOcjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
5536
5599
  ([find, replacement]) => ({ find, replacement })
5537
5600
  )
5538
5601
  ],
@@ -5540,7 +5603,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
5540
5603
  dedupe: [...config.renderer.dedupe || []]
5541
5604
  }
5542
5605
  };
5543
- await viteBuild(_chunkWZW6LEHMcjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
5606
+ await viteBuild(_chunkTQMI6BYOcjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
5544
5607
  } finally {
5545
5608
  if (postcssConfigDir) {
5546
5609
  try {
@@ -5576,26 +5639,26 @@ function readFarmPageLastModified(pageRoutes) {
5576
5639
  return lastModified;
5577
5640
  }
5578
5641
  function getFarmDocsGuardedPaths(config, middlewareRoutes) {
5579
- if (!_optionalChain([config, 'access', _101 => _101.docs, 'optionalAccess', _102 => _102.enabled])) return [];
5642
+ if (!_optionalChain([config, 'access', _105 => _105.docs, 'optionalAccess', _106 => _106.enabled])) return [];
5580
5643
  const options = { root: config.root, srcDir: config.srcDir };
5581
5644
  const guards = {
5582
5645
  config: { middleware: config.middleware, integrations: config.integrations },
5583
5646
  middlewareRoutes
5584
5647
  };
5585
- return _chunk5N7QAGEAcjs.getFarmDocsRoots.call(void 0, config.docs).flatMap(
5586
- (docsRoot) => _chunk5N7QAGEAcjs.discoverFarmDocsPages.call(void 0, _chunk5N7QAGEAcjs.resolveFarmDocsContentDir.call(void 0, docsRoot, options), docsRoot)
5587
- ).flatMap((page) => [page.href, _chunk5N7QAGEAcjs.getFarmDocsMarkdownPath.call(void 0, page.href)]).filter((pathname) => _chunk76GHW3WIcjs.farmPathGuardCoversPage.call(void 0, guards, pathname));
5648
+ return _chunkTWHXBMLJcjs.getFarmDocsRoots.call(void 0, config.docs).flatMap(
5649
+ (docsRoot) => _chunkTWHXBMLJcjs.discoverFarmDocsPages.call(void 0, _chunkTWHXBMLJcjs.resolveFarmDocsContentDir.call(void 0, docsRoot, options), docsRoot)
5650
+ ).flatMap((page) => [page.href, _chunkTWHXBMLJcjs.getFarmDocsMarkdownPath.call(void 0, page.href)]).filter((pathname) => _chunkTSFMFPRUcjs.farmPathGuardCoversPage.call(void 0, guards, pathname));
5588
5651
  }
5589
5652
  function getFarmAppOwnedDocsEnginePaths(agent, applicationMetadataRoutes) {
5590
- const llmsTxt = _optionalChain([agent, 'optionalAccess', _103 => _103.llmsTxt]);
5653
+ const llmsTxt = _optionalChain([agent, 'optionalAccess', _107 => _107.llmsTxt]);
5591
5654
  const ownedByFile = (kind) => applicationMetadataRoutes.some(
5592
5655
  (metadata) => metadata.kind === kind && metadata.pattern === "/"
5593
5656
  );
5594
5657
  return [
5595
- ..._optionalChain([llmsTxt, 'optionalAccess', _104 => _104.enabled]) || ownedByFile("llms") ? ["/llms.txt"] : [],
5596
- ..._optionalChain([llmsTxt, 'optionalAccess', _105 => _105.enabled]) && llmsTxt.full || ownedByFile("llms-full") ? ["/llms-full.txt"] : [],
5597
- ..._optionalChain([agent, 'optionalAccess', _106 => _106.sitemap, 'optionalAccess', _107 => _107.enabled]) || ownedByFile("sitemap") ? ["/sitemap.xml"] : [],
5598
- ..._optionalChain([agent, 'optionalAccess', _108 => _108.crawlers, 'optionalAccess', _109 => _109.enabled]) || ownedByFile("robots") ? ["/robots.txt"] : []
5658
+ ..._optionalChain([llmsTxt, 'optionalAccess', _108 => _108.enabled]) || ownedByFile("llms") ? ["/llms.txt"] : [],
5659
+ ..._optionalChain([llmsTxt, 'optionalAccess', _109 => _109.enabled]) && llmsTxt.full || ownedByFile("llms-full") ? ["/llms-full.txt"] : [],
5660
+ ..._optionalChain([agent, 'optionalAccess', _110 => _110.sitemap, 'optionalAccess', _111 => _111.enabled]) || ownedByFile("sitemap") ? ["/sitemap.xml"] : [],
5661
+ ..._optionalChain([agent, 'optionalAccess', _112 => _112.crawlers, 'optionalAccess', _113 => _113.enabled]) || ownedByFile("robots") ? ["/robots.txt"] : []
5599
5662
  ];
5600
5663
  }
5601
5664
  function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
@@ -5606,7 +5669,7 @@ function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
5606
5669
  docsPath: ${root}.entry,
5607
5670
  contentDir: ${root}.contentDir || ${root}.config?.contentDir,
5608
5671
  }`;
5609
- if (_optionalChain([docs, 'optionalAccess', _110 => _110.roots, 'optionalAccess', _111 => _111.length])) {
5672
+ if (_optionalChain([docs, 'optionalAccess', _114 => _114.roots, 'optionalAccess', _115 => _115.length])) {
5610
5673
  return {
5611
5674
  factory: "createFarmDocsAdapterMultiRuntimeHandler",
5612
5675
  config: `[farmDocsResolvedConfig, ...farmDocsResolvedConfig.roots].map((farmDocsRoot) => (${runtimeConfig("farmDocsRoot")}))`
@@ -5619,7 +5682,7 @@ function generateFarmDocsAdapterHandlerArguments(docs, docsConfigModulePath) {
5619
5682
  }
5620
5683
  function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
5621
5684
  if (!docs.enabled) return "null";
5622
- const serializableDocs = _optionalChain([docs, 'access', _112 => _112.roots, 'optionalAccess', _113 => _113.length]) ? {
5685
+ const serializableDocs = _optionalChain([docs, 'access', _116 => _116.roots, 'optionalAccess', _117 => _117.length]) ? {
5623
5686
  ...docs,
5624
5687
  // React elements and functions do not survive JSON; see runtimeConfig below.
5625
5688
  roots: docs.roots.map((docsRoot) => ({ ...docsRoot, runtimeConfig: void 0 }))
@@ -5653,7 +5716,7 @@ function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
5653
5716
  },
5654
5717
  }
5655
5718
  : ${JSON.stringify({ ...serializableDocs, runtimeConfig: void 0 })}`;
5656
- if (!_optionalChain([docs, 'access', _114 => _114.roots, 'optionalAccess', _115 => _115.length])) return expression;
5719
+ if (!_optionalChain([docs, 'access', _118 => _118.roots, 'optionalAccess', _119 => _119.length])) return expression;
5657
5720
  return `((farmDocs) => ({
5658
5721
  ...farmDocs,
5659
5722
  roots: farmDocs.roots.map((farmDocsRoot, index) => {
@@ -5670,7 +5733,7 @@ function toVirtualEntryImportSpecifier(modulePath) {
5670
5733
  return JSON.stringify(modulePath.replace(/\\/g, "/"));
5671
5734
  }
5672
5735
  function generateNativeAuthIntegrationSource(auth) {
5673
- if (_optionalChain([auth, 'optionalAccess', _116 => _116.enabled]) !== true) {
5736
+ if (_optionalChain([auth, 'optionalAccess', _120 => _120.enabled]) !== true) {
5674
5737
  return { importSource: "", registerSource: "" };
5675
5738
  }
5676
5739
  return {
@@ -5963,23 +6026,24 @@ if (typeof ReactDOMServer.configureApp !== "function") {
5963
6026
  ReactDOMServer.configureApp(__farmAppSetup);`;
5964
6027
  }
5965
6028
  function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlots, errorRoutes, metadataImageRoutes, applicationMetadataRoutes, middlewareRoutes, redirectRoutes, configuredRewriteRoutes, configuredHeaderRoutes, openAPIReference, notFoundPath, instrumentationPath, config, farmDocsPrecompiledManifest, configModulePath, hasServerRuntimeIntegrations, hasRuntimeIntegrationConfig, hasConfiguredRuntimePlugins, hasServerRuntimePlugins, preset, i18nCatalogs, isolatedClientBoundaryModules, hydrationPlanCache) {
5966
- const farmIslandsMode = _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _117 => _117.experimental, 'optionalAccess', _118 => _118.serverComponents])) === "islands";
6029
+ const farmIslandsMode = _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _121 => _121.experimental, 'optionalAccess', _122 => _122.serverComponents])) === "islands";
6030
+ const farmMobileClient = shouldBuildFarmMobileClient(config, { quiet: true });
5967
6031
  const hasCompressionRuntime = config.compress && _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
5968
- const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access', _119 => _119.agent, 'optionalAccess', _120 => _120.crawlers, 'optionalAccess', _121 => _121.enabled])) && !applicationMetadataRoutes.some(
6032
+ const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access', _123 => _123.agent, 'optionalAccess', _124 => _124.crawlers, 'optionalAccess', _125 => _125.enabled])) && !applicationMetadataRoutes.some(
5969
6033
  (metadata) => metadata.kind === "robots" && metadata.pattern === "/"
5970
6034
  );
5971
- const servesAgentSitemap = Boolean(_optionalChain([config, 'access', _122 => _122.agent, 'optionalAccess', _123 => _123.sitemap, 'optionalAccess', _124 => _124.enabled])) && !applicationMetadataRoutes.some(
6035
+ const servesAgentSitemap = Boolean(_optionalChain([config, 'access', _126 => _126.agent, 'optionalAccess', _127 => _127.sitemap, 'optionalAccess', _128 => _128.enabled])) && !applicationMetadataRoutes.some(
5972
6036
  (metadata) => metadata.kind === "sitemap" && metadata.pattern === "/"
5973
6037
  );
5974
- const servesDefaultMCP = _optionalChain([config, 'access', _125 => _125.agent, 'optionalAccess', _126 => _126.mcp]) === true && !_chunkSBABQKPTcjs.farmConfigMountsMCP.call(void 0, config) && !apiRoutes.some((route) => route.path === "/api/mcp");
5975
- const servesAiCatalog = _optionalChain([config, 'access', _127 => _127.agent, 'optionalAccess', _128 => _128.aiCatalog]) !== false;
6038
+ const servesDefaultMCP = _optionalChain([config, 'access', _129 => _129.agent, 'optionalAccess', _130 => _130.mcp]) === true && !_chunk46KXZBOGcjs.farmConfigMountsMCP.call(void 0, config) && !apiRoutes.some((route) => route.path === "/api/mcp");
6039
+ const servesAiCatalog = _optionalChain([config, 'access', _131 => _131.agent, 'optionalAccess', _132 => _132.aiCatalog]) !== false;
5976
6040
  const hasPluginRuntime = hasRuntimeIntegrationConfig || hasServerRuntimePlugins;
5977
6041
  const hasInfraAnalyticsRuntime = config.analytics !== false && _chunkOCS3PSYRcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
5978
6042
  const hasPrecompiledDocs = Boolean(farmDocsPrecompiledManifest);
5979
6043
  const adapterOwnsDocsRuntime = Boolean(
5980
- _chunkRD623KW4cjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _129 => _129.docs, 'optionalAccess', _130 => _130.enabled]) && _optionalChain([config, 'access', _131 => _131.docs, 'access', _132 => _132.adapter, 'optionalAccess', _133 => _133.server]) && config.docs.adapter.react
6044
+ _chunkRD623KW4cjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _133 => _133.docs, 'optionalAccess', _134 => _134.enabled]) && _optionalChain([config, 'access', _135 => _135.docs, 'access', _136 => _136.adapter, 'optionalAccess', _137 => _137.server]) && config.docs.adapter.react
5981
6045
  );
5982
- if (_optionalChain([config, 'access', _134 => _134.docs, 'optionalAccess', _135 => _135.enabled]) && _optionalChain([config, 'access', _136 => _136.docs, 'access', _137 => _137.roots, 'optionalAccess', _138 => _138.length]) && !adapterOwnsDocsRuntime) {
6046
+ if (_optionalChain([config, 'access', _138 => _138.docs, 'optionalAccess', _139 => _139.enabled]) && _optionalChain([config, 'access', _140 => _140.docs, 'access', _141 => _141.roots, 'optionalAccess', _142 => _142.length]) && !adapterOwnsDocsRuntime) {
5983
6047
  throw new Error(
5984
6048
  "Several docs roots need the docs adapter, which serves the React renderer only; Farm's built-in docs renderer serves a single docs root."
5985
6049
  );
@@ -6028,8 +6092,8 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
6028
6092
  const hasGeneratedMetadataImages = metadataImageRoutes.some(
6029
6093
  (image) => image.sourceType === "module"
6030
6094
  );
6031
- const hasMiddlewareRuntime = middlewareRoutes.length > 0 || _chunk76GHW3WIcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
6032
- const farmDocsFontAssets = _optionalChain([config, 'access', _139 => _139.docs, 'optionalAccess', _140 => _140.enabled]) ? _chunkERMUL73Lcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkERMUL73Lcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
6095
+ const hasMiddlewareRuntime = middlewareRoutes.length > 0 || _chunkTSFMFPRUcjs.hasFarmMiddlewareConfig.call(void 0, config.middleware);
6096
+ const farmDocsFontAssets = _optionalChain([config, 'access', _143 => _143.docs, 'optionalAccess', _144 => _144.enabled]) ? _chunkERMUL73Lcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkERMUL73Lcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
6033
6097
  const integrationProviders = _chunkCECUDGXQcjs.getIntegrationProviders.call(void 0, config.integrations);
6034
6098
  const renderedIntegrationProviders = integrationProviders.filter(
6035
6099
  (provider) => provider.component || provider.type === "clerk"
@@ -6039,16 +6103,16 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
6039
6103
  `Integration provider components are not supported by the "${config.renderer.name}" renderer.`
6040
6104
  );
6041
6105
  }
6042
- const providerServerModules = _chunkWZW6LEHMcjs.generateFarmIntegrationProviderServerModules.call(void 0,
6106
+ const providerServerModules = _chunkTQMI6BYOcjs.generateFarmIntegrationProviderServerModules.call(void 0,
6043
6107
  renderedIntegrationProviders,
6044
6108
  config.root,
6045
6109
  _nullishCoalesce(config.renderer.componentExtensions, () => ( []))
6046
6110
  );
6047
6111
  const resolvedIntegrationProviderFallback = Object.fromEntries(
6048
6112
  Object.entries(config.integrations).flatMap(([name, integration]) => {
6049
- const configuredProviders = _optionalChain([integration, 'optionalAccess', _141 => _141.providers]);
6113
+ const configuredProviders = _optionalChain([integration, 'optionalAccess', _145 => _145.providers]);
6050
6114
  const providers = Array.isArray(configuredProviders) ? configuredProviders : [];
6051
- if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess', _142 => _142.component]) === "function")) {
6115
+ if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess', _146 => _146.component]) === "function")) {
6052
6116
  throw new Error(
6053
6117
  `Integration provider components in production must use an importable component reference, for example component: { module: "@/components/provider" }.`
6054
6118
  );
@@ -6059,20 +6123,20 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
6059
6123
  const unsupportedIntegrationProvider = renderedIntegrationProviders.find(
6060
6124
  (provider) => provider.supportsIsolatedHydration !== true
6061
6125
  );
6062
- const isolatedHydrationMode = _chunkWZW6LEHMcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
6063
- _optionalChain([config, 'access', _143 => _143.experimental, 'optionalAccess', _144 => _144.isolatedClientHydration]),
6126
+ const isolatedHydrationMode = _chunkTQMI6BYOcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
6127
+ _optionalChain([config, 'access', _147 => _147.experimental, 'optionalAccess', _148 => _148.isolatedClientHydration]),
6064
6128
  {
6065
- serverComponents: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _145 => _145.experimental, 'optionalAccess', _146 => _146.serverComponents])) === "rsc",
6129
+ serverComponents: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _149 => _149.experimental, 'optionalAccess', _150 => _150.serverComponents])) === "rsc",
6066
6130
  hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
6067
6131
  }
6068
6132
  );
6069
- const hydrationPlanOptions = _chunkWZW6LEHMcjs.getFarmClientHydrationPlanOptions.call(void 0,
6133
+ const hydrationPlanOptions = _chunkTQMI6BYOcjs.getFarmClientHydrationPlanOptions.call(void 0,
6070
6134
  config.renderer,
6071
6135
  Boolean(unsupportedIntegrationProvider)
6072
6136
  );
6073
6137
  const pageHydrationPlanOptions = {
6074
6138
  ...hydrationPlanOptions,
6075
- serverOwners: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _147 => _147.experimental, 'optionalAccess', _148 => _148.serverComponents])) === "islands"
6139
+ serverOwners: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _151 => _151.experimental, 'optionalAccess', _152 => _152.serverComponents])) === "islands"
6076
6140
  };
6077
6141
  const layoutHydrationPlans = layoutRoutes.map((layout) => ({
6078
6142
  ...layout,
@@ -6084,7 +6148,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
6084
6148
  { ...hydrationPlanOptions, serverTreeLayouts: pageHydrationPlanOptions.serverOwners }
6085
6149
  )
6086
6150
  }));
6087
- const markdownPagePlan = _chunkWZW6LEHMcjs.createMarkdownPageHydrationPlanner.call(void 0,
6151
+ const markdownPagePlan = _chunkTQMI6BYOcjs.createMarkdownPageHydrationPlanner.call(void 0,
6088
6152
  _chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx), config.root),
6089
6153
  config.root,
6090
6154
  isolatedHydrationMode,
@@ -6093,7 +6157,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
6093
6157
  const pageHydrationPlans = new Map(
6094
6158
  pageRoutes.map((route) => [
6095
6159
  route.modulePath,
6096
- _chunkJATTVAHAcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
6160
+ _chunkB3GM5I6Ncjs.isFarmMarkdownPageFile.call(void 0, route.modulePath) ? markdownPagePlan() : getCachedClientModuleHydrationPlan(
6097
6161
  route.modulePath,
6098
6162
  config.root,
6099
6163
  isolatedHydrationMode,
@@ -6102,7 +6166,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
6102
6166
  )
6103
6167
  ])
6104
6168
  );
6105
- _chunkWZW6LEHMcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
6169
+ _chunkTQMI6BYOcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
6106
6170
  layoutHydrationPlans.map((layout) => ({
6107
6171
  pattern: layout.pattern,
6108
6172
  depth: layout.pattern.split("/").filter(Boolean).length,
@@ -6111,10 +6175,10 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
6111
6175
  pageRoutes.map((route) => ({
6112
6176
  // Compared by directory so a grouped layout applies only inside its group.
6113
6177
  pattern: _nullishCoalesce(route.directory, () => ( route.pattern)),
6114
- depth: _chunk76GHW3WIcjs.getRouteDirectoryDepth.call(void 0, _nullishCoalesce(route.directory, () => ( route.pattern))),
6178
+ depth: _chunkTSFMFPRUcjs.getRouteDirectoryDepth.call(void 0, _nullishCoalesce(route.directory, () => ( route.pattern))),
6115
6179
  metadata: pageHydrationPlans.get(route.modulePath)
6116
6180
  })),
6117
- _chunk76GHW3WIcjs.routeBoundaryCoversDirectory
6181
+ _chunkTSFMFPRUcjs.routeBoundaryCoversDirectory
6118
6182
  );
6119
6183
  const providerServerImports = [
6120
6184
  providerServerModules.hasClerkProvider ? `import { ClerkProvider as FarmClerkProvider } from "@clerk/react";` : "",
@@ -6131,7 +6195,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
6131
6195
  apiRegistrations.push(`
6132
6196
  {
6133
6197
  path: ${JSON.stringify(route.path)},
6134
- methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access', _149 => _149.pluginMethods, 'optionalAccess', _150 => _150.includes, 'call', _151 => _151(method)])))},
6198
+ methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access', _153 => _153.pluginMethods, 'optionalAccess', _154 => _154.includes, 'call', _155 => _155(method)])))},
6135
6199
  endpoints: ${varName},
6136
6200
  }`);
6137
6201
  });
@@ -6144,7 +6208,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
6144
6208
  }).map(({ route }) => route);
6145
6209
  orderedPageRoutes.forEach((route, index) => {
6146
6210
  const varName = `pageRoute${index}`;
6147
- if (_chunkJATTVAHAcjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) {
6211
+ if (_chunkB3GM5I6Ncjs.isFarmMarkdownPageFile.call(void 0, route.modulePath)) {
6148
6212
  pageRegistrations.push(`
6149
6213
  {
6150
6214
  pattern: ${JSON.stringify(route.pattern)},${route.directory ? `
@@ -6176,7 +6240,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
6176
6240
  module: ${varName},
6177
6241
  shouldHydrate: ${JSON.stringify(clientMetadata.shouldHydrate)},${clientMetadata.shouldHydrate ? `
6178
6242
  clientModule: ${JSON.stringify(_chunkVQJYGZNXcjs.toViteModuleId.call(void 0, route.modulePath, config.root))},` : ""}
6179
- islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${_chunkWZW6LEHMcjs.usesFarmServerTree.call(void 0, clientMetadata) ? "\n serverTree: true," : ""}${renderingDirective ? `
6243
+ islandStrategy: ${JSON.stringify(clientMetadata.islandStrategy)},${_chunkTQMI6BYOcjs.usesFarmServerTree.call(void 0, clientMetadata) ? "\n serverTree: true," : ""}${renderingDirective ? `
6180
6244
  rendering: ${JSON.stringify(renderingDirective)},` : ""}
6181
6245
  ${route.source !== void 0 ? `markdownSource: {
6182
6246
  source: ${JSON.stringify(route.source)},
@@ -6186,7 +6250,7 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
6186
6250
  });
6187
6251
  const layoutImports = [];
6188
6252
  const layoutRegistrations = [];
6189
- const treeLayoutPatterns = farmIslandsMode ? _chunk76GHW3WIcjs.getFarmServerTreeLayoutPatterns.call(void 0,
6253
+ const treeLayoutPatterns = farmIslandsMode ? _chunkTSFMFPRUcjs.getFarmServerTreeLayoutPatterns.call(void 0,
6190
6254
  layoutHydrationPlans.map((layout) => ({
6191
6255
  pattern: layout.pattern,
6192
6256
  shouldHydrate: layout.hydration.shouldHydrate,
@@ -6240,12 +6304,12 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
6240
6304
  errorImports.push(
6241
6305
  `import * as ${varName} from ${toVirtualEntryImportSpecifier(errorRoute.modulePath)};`
6242
6306
  );
6243
- const groupScope = _chunk76GHW3WIcjs.getRouteGroupScope.call(void 0, errorRoute.pattern);
6307
+ const groupScope = _chunkTSFMFPRUcjs.getRouteGroupScope.call(void 0, errorRoute.pattern);
6244
6308
  errorRegistrations.push(`
6245
6309
  {
6246
- pattern: ${JSON.stringify(_chunk76GHW3WIcjs.stripRouteGroups.call(void 0, errorRoute.pattern))},${groupScope ? `
6310
+ pattern: ${JSON.stringify(_chunkTSFMFPRUcjs.stripRouteGroups.call(void 0, errorRoute.pattern))},${groupScope ? `
6247
6311
  groupScope: ${JSON.stringify(groupScope)},
6248
- directoryDepth: ${_chunk76GHW3WIcjs.getRouteDirectoryDepth.call(void 0, errorRoute.pattern)},` : ""}
6312
+ directoryDepth: ${_chunkTSFMFPRUcjs.getRouteDirectoryDepth.call(void 0, errorRoute.pattern)},` : ""}
6249
6313
  module: ${varName},
6250
6314
  }`);
6251
6315
  });
@@ -6392,8 +6456,22 @@ function renderFarmServerTreeLayout(Layout, props, outlets) {
6392
6456
  stripFarmLocaleFromPathname,
6393
6457
  withFarmRouteContext,
6394
6458
  createLateNotFoundRecovery,
6395
- createLateRedirectRecovery,${hasInfraAnalyticsRuntime ? "\n resolveFarmDocsEngineRouteLabel,\n resolveFarmDocsRouteLabel,\n resolveFarmMarkdownRouteLabel,\n resolveFarmMCPRouteLabel,\n setFarmRouteLabel," : ""}${hasFarmServerStorageConfig(config.storage) ? "\n _registerFarmStorageModules,\n disposeFarmStorage,\n initFarmStorage," : ""}
6396
- } from "@farm.js/core/internal/production-runtime";${farmIslandsMode ? `
6459
+ createLateRedirectRecovery,${config.mobileClient ? "\n createFarmNativeTreeResponse," : ""}${hasInfraAnalyticsRuntime ? "\n resolveFarmDocsEngineRouteLabel,\n resolveFarmDocsRouteLabel,\n resolveFarmMarkdownRouteLabel,\n resolveFarmMCPRouteLabel,\n setFarmRouteLabel," : ""}${hasFarmServerStorageConfig(config.storage) ? "\n _registerFarmStorageModules,\n disposeFarmStorage,\n initFarmStorage," : ""}
6460
+ } from "@farm.js/core/internal/production-runtime";${farmMobileClient ? `
6461
+ import { _applyFarmMobileShellClient } from "@farm.js/core/internal/production-runtime";
6462
+ // The mobile client documents load when a mobile shell asks for them (RFC 0004, 7.2), filled in
6463
+ // once the client build has finished (see buildNitroUniversal). A shell's document stays out of
6464
+ // shared caches, which the adapter learns as it does for a guarded response.
6465
+ const farmMobileShellClient = JSON.parse("${_chunkEFZGB7JCcjs.FARM_MOBILE_SHELL_CLIENT_PLACEHOLDER}");
6466
+ function applyFarmMobileShellResponse(request, response, context) {
6467
+ return _applyFarmMobileShellClient(request, response, farmMobileShellClient, () =>
6468
+ context?.onGuardedResponse?.()
6469
+ );
6470
+ }` : `
6471
+ // No mobile block: no mobile client, and documents ignore X-Farm-Shell.
6472
+ function applyFarmMobileShellResponse(request, response) {
6473
+ return response;
6474
+ }`}${farmIslandsMode ? `
6397
6475
  import { getSharedLayoutPrefixLength, handleFarmFormActionRequest, ignoreFarmHeldValues, installFarmIslandValues, parseFarmLayoutChainHeader } from "@farm.js/core/internal/production-runtime";
6398
6476
  import { installFarmIslandsServer } from "@farm.js/core/internal/islands-server";
6399
6477
  installFarmIslandsServer();
@@ -6407,25 +6485,25 @@ ${FARM_SEGMENT_NAVIGATION_SERVER_RUNTIME}` : ""}`;
6407
6485
  const infraAnalyticsImport = hasInfraAnalyticsRuntime ? `import { ${hasPluginRuntime ? "createFarmInfraAnalyticsPlugin" : "createFarmInfraAnalyticsRecorder"} } from "@farm.js/core/internal/infra-analytics-runtime";` : "";
6408
6486
  const compressionRuntimeImport = hasCompressionRuntime ? `import { compressFarmResponse${hasPluginRuntime ? ", createCompressionPlugin" : ""} } from "@farm.js/core/internal/compression-runtime";` : "";
6409
6487
  const i18nServerImport = config.i18n.enabled ? `import { _runWithFarmI18nRequest, _setDefaultFarmI18nRuntime, createFarmI18nRuntime, getFarmI18nClientSnapshot } from "@farm.js/core/i18n/server";` : "";
6410
- const docsHandlerImport = _optionalChain([config, 'access', _152 => _152.docs, 'optionalAccess', _153 => _153.enabled]) ? hasPrecompiledDocs ? `import { createFarmDocsPrecompiledRuntime } from "@farm.js/core/internal/docs-precompiled-runtime";
6488
+ const docsHandlerImport = _optionalChain([config, 'access', _156 => _156.docs, 'optionalAccess', _157 => _157.enabled]) ? hasPrecompiledDocs ? `import { createFarmDocsPrecompiledRuntime } from "@farm.js/core/internal/docs-precompiled-runtime";
6411
6489
  const isFarmDocsAPIRequest = (requestOrPathname) => {
6412
6490
  const pathname = typeof requestOrPathname === "string"
6413
6491
  ? requestOrPathname
6414
6492
  : new URL(requestOrPathname.url).pathname;
6415
- const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _154 => _154.apiPath]) || "/api/docs")};
6493
+ const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _158 => _158.apiPath]) || "/api/docs")};
6416
6494
  return pathname === apiPath || pathname.startsWith(apiPath + "/");
6417
6495
  };` : adapterOwnsDocsRuntime ? `import { ${docsConfigModulePath ? "getFarmDocsConfigModuleRoot, " : ""}isFarmDocsAPIRequest } from "@farm.js/core/docs";
6418
- import { ${_optionalChain([config, 'access', _155 => _155.docs, 'access', _156 => _156.roots, 'optionalAccess', _157 => _157.length]) ? "createFarmDocsMultiRuntimeHandler as createFarmDocsAdapterMultiRuntimeHandler" : "createFarmDocsRuntimeHandler as createFarmDocsAdapterRuntimeHandler"} } from ${JSON.stringify(config.docs.adapter.server)};
6496
+ import { ${_optionalChain([config, 'access', _159 => _159.docs, 'access', _160 => _160.roots, 'optionalAccess', _161 => _161.length]) ? "createFarmDocsMultiRuntimeHandler as createFarmDocsAdapterMultiRuntimeHandler" : "createFarmDocsRuntimeHandler as createFarmDocsAdapterRuntimeHandler"} } from ${JSON.stringify(config.docs.adapter.server)};
6419
6497
  import * as FarmDocsAdapterReact from ${JSON.stringify(config.docs.adapter.react)};${docsConfigModulePath ? `
6420
6498
  import * as farmDocsConfigModule from ${toVirtualEntryImportSpecifier(docsConfigModulePath)};` : ""}` : `import { createFarmDocsAPIHandler, createFarmDocsHandler, isFarmDocsAPIRequest } from "@farm.js/core/docs";` : "";
6421
- const docsFontImport = _optionalChain([config, 'access', _158 => _158.docs, 'optionalAccess', _159 => _159.enabled]) && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
6422
- const docsRuntimeImport = _optionalChain([config, 'access', _160 => _160.docs, 'optionalAccess', _161 => _161.enabled]) && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
6499
+ const docsFontImport = _optionalChain([config, 'access', _162 => _162.docs, 'optionalAccess', _163 => _163.enabled]) && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
6500
+ const docsRuntimeImport = _optionalChain([config, 'access', _164 => _164.docs, 'optionalAccess', _165 => _165.enabled]) && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
6423
6501
  import { dirname as farmDocsDirname, join as farmDocsJoin } from "node:path";
6424
6502
  import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
6425
- const markdownHandlerImport = _optionalChain([config, 'access', _162 => _162.md, 'optionalAccess', _163 => _163.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
6503
+ const markdownHandlerImport = _optionalChain([config, 'access', _166 => _166.md, 'optionalAccess', _167 => _167.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
6426
6504
  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;";
6427
6505
  const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, FARM_MARKDOWN_PAGE_CHECK_HEADER, _isFarmMarkdownPageCheck, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
6428
- const mdxComponentsPath = typeof _optionalChain([config, 'access', _164 => _164.mdx, 'optionalAccess', _165 => _165.components]) === "string" ? _path2.default.isAbsolute(config.mdx.components) ? config.mdx.components : _path2.default.join(config.root, config.mdx.components) : null;
6506
+ const mdxComponentsPath = typeof _optionalChain([config, 'access', _168 => _168.mdx, 'optionalAccess', _169 => _169.components]) === "string" ? _path2.default.isAbsolute(config.mdx.components) ? config.mdx.components : _path2.default.join(config.root, config.mdx.components) : null;
6429
6507
  const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
6430
6508
  const layerConfigPaths = (config.layers || []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile)).filter((configFile) => configFile !== configModulePath);
6431
6509
  const layerConfigImports = layerConfigPaths.map(
@@ -6445,7 +6523,7 @@ import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
6445
6523
  const nativeAuth = generateNativeAuthIntegrationSource(config.auth);
6446
6524
  const nativeMCP = _chunkVM57CK74cjs.generateNativeMCPPluginSource.call(void 0, config.mcp);
6447
6525
  const mobileSession = (config.plugins || []).some(
6448
- (plugin) => _optionalChain([plugin, 'optionalAccess', _166 => _166.name]) === _chunk7FVVQEVLcjs.FARM_MOBILE_SESSION_PLUGIN
6526
+ (plugin) => _optionalChain([plugin, 'optionalAccess', _170 => _170.name]) === _chunk7FVVQEVLcjs.FARM_MOBILE_SESSION_PLUGIN
6449
6527
  );
6450
6528
  const integrationImports = `
6451
6529
  ${configModulePath ? `import * as FarmUserConfigModule from ${toVirtualEntryImportSpecifier(configModulePath)};` : ""}
@@ -6455,7 +6533,7 @@ ${nativeAuth.importSource}
6455
6533
  ${nativeMCP.importSource}
6456
6534
  ${mobileSession ? `import { createFarmMobileSessionPlugin as __farmCreateMobileSessionPlugin } from "@farm.js/core/internal/production-runtime";` : ""}
6457
6535
  `;
6458
- const imageRuntime = _chunkWZW6LEHMcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
6536
+ const imageRuntime = _chunkTQMI6BYOcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
6459
6537
  const imageRuntimeImport = imageRuntime === "none" ? "" : `import { _withFarmImageSourceClientAddress, createCloudflareImageTransformer, createFarmImageHandler } from "@farm.js/core/image/server";`;
6460
6538
  const imageNodeRuntimeImport = imageRuntime === "node" ? `import { createNodeImageFetcher, createNodeImageUrlValidator, createSharpImageTransformer } from "@farm.js/core/image/sharp";` : "";
6461
6539
  const apiHandlerCode = apiRoutes.length > 0 ? `
@@ -6634,7 +6712,7 @@ const farmResolvedRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs);
6634
6712
 
6635
6713
  function FarmDefault404Page() {
6636
6714
  return React.createElement(React.Fragment, null,
6637
- React.createElement("style", null, ${JSON.stringify(_chunkWZW6LEHMcjs.DEFAULT_NOT_FOUND_STYLES)}),
6715
+ React.createElement("style", null, ${JSON.stringify(_chunkTQMI6BYOcjs.DEFAULT_NOT_FOUND_STYLES)}),
6638
6716
  React.createElement("main", {
6639
6717
  className: "farm-default-not-found",
6640
6718
  "aria-labelledby": "farm-default-not-found-title",
@@ -6771,14 +6849,14 @@ const farmImageHandler = ${imageRuntime === "none" ? "null" : imageRuntime === "
6771
6849
  onError(error) { console.error("[Farm Image]", error); },
6772
6850
  })`};
6773
6851
  const farmMarkdownConfig = ${JSON.stringify(config.md)};
6774
- const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _167 => _167.agent, 'optionalAccess', _168 => _168.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
6775
- ${_optionalChain([config, 'access', _169 => _169.agent, 'optionalAccess', _170 => _170.llmsTxt, 'optionalAccess', _171 => _171.enabled]) ? "const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });\n" : ""}${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
6852
+ const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _171 => _171.agent, 'optionalAccess', _172 => _172.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
6853
+ ${_optionalChain([config, 'access', _173 => _173.agent, 'optionalAccess', _174 => _174.llmsTxt, 'optionalAccess', _175 => _175.enabled]) ? "const farmLlmsFullRenderer = createFarmLlmsFullRenderer({ revalidate: farmLlmsTxtConfig.revalidate });\n" : ""}${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
6776
6854
  const farmMdxConfig = ${JSON.stringify({
6777
6855
  ...config.mdx,
6778
- components: typeof _optionalChain([config, 'access', _172 => _172.mdx, 'optionalAccess', _173 => _173.components]) === "string" ? config.mdx.components : void 0
6856
+ components: typeof _optionalChain([config, 'access', _176 => _176.mdx, 'optionalAccess', _177 => _177.components]) === "string" ? config.mdx.components : void 0
6779
6857
  })};
6780
6858
  const configuredFarmMdxComponents = farmUserConfig?.mdx?.components;
6781
- ${_optionalChain([config, 'access', _174 => _174.agent, 'optionalAccess', _175 => _175.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
6859
+ ${_optionalChain([config, 'access', _178 => _178.agent, 'optionalAccess', _179 => _179.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
6782
6860
  // environment this was built in, since Netlify exposes its deploy context only
6783
6861
  // to the build.
6784
6862
  const farmNoindexPreview = resolveFarmPreviewDeployment(
@@ -6829,7 +6907,7 @@ export const farmProductionLifecycle = createFarmProductionLifecycle({
6829
6907
  });
6830
6908
  const farmI18nRuntime = ${config.i18n.enabled ? `createFarmI18nRuntime(farmI18nConfig, ${JSON.stringify(i18nCatalogs)})` : "null"};
6831
6909
  ${config.i18n.enabled ? "_setDefaultFarmI18nRuntime(farmI18nRuntime);" : ""}
6832
- const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _176 => _176.docs, 'optionalAccess', _177 => _177.enabled]) && !hasPrecompiledDocs ? `(() => {
6910
+ const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _180 => _180.docs, 'optionalAccess', _181 => _181.enabled]) && !hasPrecompiledDocs ? `(() => {
6833
6911
  try {
6834
6912
  const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
6835
6913
  const candidates = [
@@ -6841,7 +6919,7 @@ const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _176 => _1
6841
6919
  } catch {
6842
6920
  return null;
6843
6921
  }
6844
- })()` : "null"};${_optionalChain([config, 'access', _178 => _178.docs, 'optionalAccess', _179 => _179.enabled]) && !hasPrecompiledDocs && _optionalChain([config, 'access', _180 => _180.docs, 'access', _181 => _181.roots, 'optionalAccess', _182 => _182.length]) ? `
6922
+ })()` : "null"};${_optionalChain([config, 'access', _182 => _182.docs, 'optionalAccess', _183 => _183.enabled]) && !hasPrecompiledDocs && _optionalChain([config, 'access', _184 => _184.docs, 'access', _185 => _185.roots, 'optionalAccess', _186 => _186.length]) ? `
6845
6923
  const farmDocsBundledRootsDir = (() => {
6846
6924
  try {
6847
6925
  const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
@@ -6892,7 +6970,7 @@ const farmDocsModulePreloadPaths = farmDocsModulePreloads
6892
6970
  ),
6893
6971
  }
6894
6972
  : undefined;
6895
- const farmDocsHandler = ${_optionalChain([config, 'access', _183 => _183.docs, 'optionalAccess', _184 => _184.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `${adapterHandler.factory}(${adapterHandler.config}, {
6973
+ const farmDocsHandler = ${_optionalChain([config, 'access', _187 => _187.docs, 'optionalAccess', _188 => _188.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `${adapterHandler.factory}(${adapterHandler.config}, {
6896
6974
  rootDir: farmDocsRuntimeRoot,
6897
6975
  // A production build's content cannot change, so the adapter reads its
6898
6976
  // navigation once instead of scanning the content directory per request.
@@ -6925,7 +7003,7 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _183 => _183.docs, '
6925
7003
  globalStylesheetHref: ${JSON.stringify(FARM_CLIENT_CSS_HREF_PLACEHOLDER)},
6926
7004
  isPathGuarded: isFarmDocsPathGuarded,
6927
7005
  })` : "null"};
6928
- const farmDocsAPIHandler = ${_optionalChain([config, 'access', _185 => _185.docs, 'optionalAccess', _186 => _186.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig, isPathGuarded: isFarmDocsPathGuarded })` : "null"};
7006
+ const farmDocsAPIHandler = ${_optionalChain([config, 'access', _189 => _189.docs, 'optionalAccess', _190 => _190.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig, isPathGuarded: isFarmDocsPathGuarded })` : "null"};
6929
7007
 
6930
7008
  // API routes bundled at build time
6931
7009
  const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
@@ -6950,12 +7028,12 @@ function fetchFarmInnerRequest(request, context) {
6950
7028
  }
6951
7029
  const farmLocalAPIBasePath = ${JSON.stringify(_chunkB5BBTPJQcjs.resolveFarmAPIServerBasePath.call(void 0, config.api))};
6952
7030
  const farmOpenAPIReference = ${JSON.stringify(openAPIReference)};
6953
- ${_optionalChain([config, 'access', _187 => _187.agent, 'optionalAccess', _188 => _188.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunkJ3LBO2O4cjs.resolveFarmApiCatalogInput.call(void 0, config))};
6954
- ` : ""}${_optionalChain([config, 'access', _189 => _189.agent, 'optionalAccess', _190 => _190.manifest]) !== false ? `const farmAppManifestInput = ${JSON.stringify(
6955
- _chunkJ3LBO2O4cjs.resolveFarmAppManifestInput.call(void 0, config, {
7031
+ ${_optionalChain([config, 'access', _191 => _191.agent, 'optionalAccess', _192 => _192.apiCatalog]) ? `const farmApiCatalogInput = ${JSON.stringify(_chunk4SEHMBL4cjs.resolveFarmApiCatalogInput.call(void 0, config))};
7032
+ ` : ""}${_optionalChain([config, 'access', _193 => _193.agent, 'optionalAccess', _194 => _194.manifest]) !== false ? `const farmAppManifestInput = ${JSON.stringify(
7033
+ _chunk4SEHMBL4cjs.resolveFarmAppManifestInput.call(void 0, config, {
6956
7034
  build: config.deploymentId,
6957
- packages: _chunkWZW6LEHMcjs.resolveFarmAppPackages.call(void 0, config.root),
6958
- webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? _chunkWZW6LEHMcjs.collectFarmWebMCPTools.call(void 0, config.root, config.srcDir) : []
7035
+ packages: _chunkTQMI6BYOcjs.resolveFarmAppPackages.call(void 0, config.root),
7036
+ webmcpTools: config.plugins.some(({ name }) => name === "farm:webmcp") ? _chunkTQMI6BYOcjs.collectFarmWebMCPTools.call(void 0, config.root, config.srcDir) : []
6959
7037
  })
6960
7038
  )};
6961
7039
  ${servesDefaultMCP ? "farmAppManifestInput.defaultMCP = getFarmDefaultMCPServer;\n" : ""}// A guard written for an MCP server's path keeps its tools out of the public view.
@@ -7555,7 +7633,7 @@ function peelFarmDocumentPrefix(markup) {
7555
7633
  let inner = markup.replace(/^\\s+/, "");
7556
7634
  let hoisted = "";
7557
7635
  const wrapper = /^<div\\b[^>]*style=["']display\\s*:\\s*contents;?\\s*["'][^>]*>/i;
7558
- const hoistable = /${_chunk76GHW3WIcjs.HOISTED_HEAD_ELEMENT.source}/i;
7636
+ const hoistable = /${_chunkTSFMFPRUcjs.HOISTED_HEAD_ELEMENT.source}/i;
7559
7637
  let match;
7560
7638
  while ((match = wrapper.exec(inner) || hoistable.exec(inner))) {
7561
7639
  if (!/^<div/i.test(match[0])) hoisted += match[0];
@@ -8086,7 +8164,7 @@ function createFarmAgentRobotsResponse(request) {
8086
8164
  // a route guard.
8087
8165
  const farmAgentGuardedPages = new Set(${JSON.stringify(
8088
8166
  pageRoutes.map((route) => route.pattern).filter(
8089
- (pattern) => !pattern.includes("[") && _chunk76GHW3WIcjs.farmPathGuardCoversPage.call(void 0,
8167
+ (pattern) => !pattern.includes("[") && _chunkTSFMFPRUcjs.farmPathGuardCoversPage.call(void 0,
8090
8168
  {
8091
8169
  config: { middleware: config.middleware, integrations: config.integrations },
8092
8170
  middlewareRoutes
@@ -8133,12 +8211,12 @@ ${servesDefaultMCP ? `// agent.mcp: the default read-only MCP server at /mcp, as
8133
8211
  // aside for a page route that answers /mcp and for any MCP server published or
8134
8212
  // registered at runtime, such as the docs engine's.
8135
8213
  const farmDefaultMCPServer = ${JSON.stringify(
8136
- _chunkSBABQKPTcjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root), _chunkGUJTVM36cjs.FARM_VERSION)
8214
+ _chunk46KXZBOGcjs.createFarmDefaultMCPServer.call(void 0, readFarmAppPackageIdentity(config.root), _chunkOAMUSC7Hcjs.FARM_VERSION)
8137
8215
  )};
8138
8216
  let farmDefaultMCPRouteFree;
8139
8217
  function getFarmDefaultMCPServer() {
8140
8218
  if (farmDefaultMCPRouteFree === undefined) {
8141
- farmDefaultMCPRouteFree = !matchPageRoute(${JSON.stringify(_chunkSBABQKPTcjs.FARM_DEFAULT_MCP_PATH)});
8219
+ farmDefaultMCPRouteFree = !matchPageRoute(${JSON.stringify(_chunk46KXZBOGcjs.FARM_DEFAULT_MCP_PATH)});
8142
8220
  }
8143
8221
  return farmDefaultMCPRouteFree ? resolveFarmDefaultMCPServer(farmDefaultMCPServer) : undefined;
8144
8222
  }
@@ -8433,7 +8511,7 @@ function hasLocalRequestRoute(request, routePathname) {
8433
8511
  if (${imageRuntime === "none" ? "false" : `pathname === ${JSON.stringify(config.images.path)}`}) {
8434
8512
  return true;
8435
8513
  }
8436
- ${_optionalChain([config, 'access', _191 => _191.docs, 'optionalAccess', _192 => _192.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
8514
+ ${_optionalChain([config, 'access', _195 => _195.docs, 'optionalAccess', _196 => _196.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
8437
8515
  if (
8438
8516
  isFarmDocsAPIRequest(pathname) ||
8439
8517
  docsPath === "/" ||
@@ -8459,7 +8537,7 @@ function getFarmPluginRequestOptions(request) {
8459
8537
  route: { ...route, pattern: normalizeRuntimePath(farmOpenAPIReference.route) },
8460
8538
  };
8461
8539
  }
8462
- const isDocsAPIRequest = ${_optionalChain([config, 'access', _193 => _193.docs, 'optionalAccess', _194 => _194.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
8540
+ const isDocsAPIRequest = ${_optionalChain([config, 'access', _197 => _197.docs, 'optionalAccess', _198 => _198.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
8463
8541
  const integrationMatch = ${hasServerRuntimeIntegrations ? `matchIntegrationRoute(serverRuntimeIntegrations, {
8464
8542
  pathname,
8465
8543
  method: request.method,
@@ -8543,7 +8621,7 @@ ${hasInfraAnalyticsRuntime ? `
8543
8621
  // endpoints, Markdown mirrors, and docs pages have no app route pattern, so they are
8544
8622
  // labeled here; route.pattern keeps meaning the matched app route for plugins.
8545
8623
  const farmBuiltInRoutePaths = new Set(${JSON.stringify(
8546
- _chunkJ3LBO2O4cjs.listFarmBuiltInRoutePaths.call(void 0, {
8624
+ _chunk4SEHMBL4cjs.listFarmBuiltInRoutePaths.call(void 0, {
8547
8625
  agent: {
8548
8626
  ...config.agent,
8549
8627
  aiCatalog: servesAiCatalog,
@@ -8554,9 +8632,9 @@ const farmBuiltInRoutePaths = new Set(${JSON.stringify(
8554
8632
  openapi: openAPIReference
8555
8633
  })
8556
8634
  )});
8557
- ${_optionalChain([config, 'access', _195 => _195.docs, 'optionalAccess', _196 => _196.enabled]) ? `const farmDocsRouteLabelInput = {
8635
+ ${_optionalChain([config, 'access', _199 => _199.docs, 'optionalAccess', _200 => _200.enabled]) ? `const farmDocsRouteLabelInput = {
8558
8636
  path: normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs"),
8559
- apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _197 => _197.apiPath]) || "/api/docs")},${_optionalChain([config, 'access', _198 => _198.docs, 'access', _199 => _199.roots, 'optionalAccess', _200 => _200.length]) ? "\n roots: farmDocsResolvedConfig.roots.map((farmDocsRoot) => farmDocsRoot.entry)," : ""}
8637
+ apiPath: ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _201 => _201.apiPath]) || "/api/docs")},${_optionalChain([config, 'access', _202 => _202.docs, 'access', _203 => _203.roots, 'optionalAccess', _204 => _204.length]) ? "\n roots: farmDocsResolvedConfig.roots.map((farmDocsRoot) => farmDocsRoot.entry)," : ""}
8560
8638
  };
8561
8639
  ` : ""}// The request's route payload, for a handler that learns what answered while it handles.
8562
8640
  const farmRouteLabelSlot = Symbol("farm.route.label.slot");
@@ -8571,11 +8649,11 @@ function labelFarmRequestOptions(options) {
8571
8649
  setFarmRouteLabel(options.route, mcpLabel);
8572
8650
  return options;
8573
8651
  }
8574
- ${_optionalChain([config, 'access', _201 => _201.docs, 'optionalAccess', _202 => _202.enabled]) ? `if (options.kind === "docs") {
8652
+ ${_optionalChain([config, 'access', _205 => _205.docs, 'optionalAccess', _206 => _206.enabled]) ? `if (options.kind === "docs") {
8575
8653
  setFarmRouteLabel(options.route, resolveFarmDocsRouteLabel(routePathname, farmDocsRouteLabelInput));
8576
8654
  return options;
8577
8655
  }` : ""}
8578
- ${_optionalChain([config, 'access', _203 => _203.md, 'optionalAccess', _204 => _204.enabled]) || hasMarkdownPages ? `const markdownLabel = resolveFarmMarkdownRouteLabel(
8656
+ ${_optionalChain([config, 'access', _207 => _207.md, 'optionalAccess', _208 => _208.enabled]) || hasMarkdownPages ? `const markdownLabel = resolveFarmMarkdownRouteLabel(
8579
8657
  routePathname,
8580
8658
  (page) => matchPageRoute(page)?.route.pattern,
8581
8659
  );
@@ -8610,7 +8688,7 @@ function getApplicableLayouts(pathname, directory) {
8610
8688
  return applicable;
8611
8689
  }
8612
8690
 
8613
- ${_optionalChain([config, 'access', _205 => _205.docs, 'optionalAccess', _206 => _206.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
8691
+ ${_optionalChain([config, 'access', _209 => _209.docs, 'optionalAccess', _210 => _210.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
8614
8692
  if (request.method === "HEAD") return response;
8615
8693
  if (response.headers.get("x-farm-docs-adapter")) return response;
8616
8694
 
@@ -8718,7 +8796,7 @@ ${_optionalChain([config, 'access', _205 => _205.docs, 'optionalAccess', _206 =>
8718
8796
 
8719
8797
  // Shells keep their own LRU so query-string variants never evict app cache entries.
8720
8798
  const pprShellCache = getFarmDataCache().pprShellCache;
8721
- const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _207 => _207.experimental, 'optionalAccess', _208 => _208.ppr]) === true)};
8799
+ const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _211 => _211.experimental, 'optionalAccess', _212 => _212.ppr]) === true)};
8722
8800
 
8723
8801
  function resolveRouteRenderingView(route) {
8724
8802
  // The same merge development uses: baked directive config under the
@@ -8850,7 +8928,7 @@ async function handleFarmRequest(request, adapterContext) {
8850
8928
  },
8851
8929
  { redirect: !isFarmLocalAPIPathname(requestUrl.pathname) }
8852
8930
  )` : "handleFarmRequestInContext(request, null, false, Date.now(), adapterContext, requestUrl)"};
8853
- ${_optionalChain([config, 'access', _209 => _209.md, 'optionalAccess', _210 => _210.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
8931
+ ${_optionalChain([config, 'access', _213 => _213.md, 'optionalAccess', _214 => _214.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
8854
8932
  if (matchPageRoute(pathname)) {
8855
8933
  // The Link header advertises the public .md URL, like the head alternate.
8856
8934
  return applyMarkdownNegotiationHeaders(response, {
@@ -9060,7 +9138,7 @@ ${hasServerRuntimeIntegrations ? `
9060
9138
  }
9061
9139
  ` : ""}
9062
9140
 
9063
- ${_optionalChain([config, 'access', _211 => _211.docs, 'optionalAccess', _212 => _212.enabled]) ? `
9141
+ ${_optionalChain([config, 'access', _215 => _215.docs, 'optionalAccess', _216 => _216.enabled]) ? `
9064
9142
  // Docs responses are served after app middleware so route guards and
9065
9143
  // middleware headers apply to the docs engine like any other page content.
9066
9144
  // An app's own llms.txt, llms-full.txt, sitemap.xml, and robots.txt take
@@ -9128,7 +9206,22 @@ ${hasServerRuntimeIntegrations ? `
9128
9206
  }
9129
9207
  ` : ""}
9130
9208
 
9131
- ${_optionalChain([config, 'access', _213 => _213.md, 'optionalAccess', _214 => _214.enabled]) ? `
9209
+ ${config.mobileClient ? `
9210
+ // The mobile app's native-tier screens: the page, rendered as for a browser, read into a
9211
+ // tree of native views.
9212
+ if (
9213
+ (request.method === "GET" || request.method === "HEAD") &&
9214
+ request.headers.get("accept")?.includes(${JSON.stringify(_chunk3HLQTOVUcjs.FARM_NATIVE_TREE_CONTENT_TYPE)})
9215
+ ) {
9216
+ const treeResponse = await createFarmNativeTreeResponse({
9217
+ request,
9218
+ renderPage: (targetRequest) => fetchFarmInnerRequest(targetRequest, adapterContext),
9219
+ });
9220
+ return applyProductionMiddlewareHeaders(treeResponse, middlewareHeaders);
9221
+ }
9222
+ ` : ""}
9223
+
9224
+ ${_optionalChain([config, 'access', _217 => _217.md, 'optionalAccess', _218 => _218.enabled]) ? `
9132
9225
  if (farmMarkdownConfig?.enabled) {
9133
9226
  const markdownResponse = await createMarkdownMirrorResponse({
9134
9227
  // The mirror helper only reads metadata and creates its own GET request.
@@ -9227,11 +9320,11 @@ ${hasServerRuntimeIntegrations ? `
9227
9320
  return applyProductionMiddlewareHeaders(applicationMetadataResponse, middlewareHeaders);
9228
9321
  }
9229
9322
  ` : ""}
9230
- ${_optionalChain([config, 'access', _215 => _215.agent, 'optionalAccess', _216 => _216.manifest]) !== false ? `
9323
+ ${_optionalChain([config, 'access', _219 => _219.agent, 'optionalAccess', _220 => _220.manifest]) !== false ? `
9231
9324
  // agent.manifest: /.well-known/farmjs.json (and 0.1.34's /.well-known/farmjs), the app's
9232
9325
  // public manifest, the same document for every request.
9233
9326
  if (
9234
- [${JSON.stringify(_chunkJ3LBO2O4cjs.FARM_APP_MANIFEST_PATH)}, ${JSON.stringify(_chunkJ3LBO2O4cjs.FARM_APP_MANIFEST_LEGACY_PATH)}].includes(
9327
+ [${JSON.stringify(_chunk4SEHMBL4cjs.FARM_APP_MANIFEST_PATH)}, ${JSON.stringify(_chunk4SEHMBL4cjs.FARM_APP_MANIFEST_LEGACY_PATH)}].includes(
9235
9328
  normalizeRuntimePath(routePathname),
9236
9329
  )
9237
9330
  ) {
@@ -9241,9 +9334,9 @@ ${hasServerRuntimeIntegrations ? `
9241
9334
  );
9242
9335
  }
9243
9336
  ` : ""}
9244
- ${_optionalChain([config, 'access', _217 => _217.agent, 'optionalAccess', _218 => _218.apiCatalog]) ? `
9337
+ ${_optionalChain([config, 'access', _221 => _221.agent, 'optionalAccess', _222 => _222.apiCatalog]) ? `
9245
9338
  // agent.apiCatalog: list the OpenAPI and MCP surfaces at the RFC 9727 path.
9246
- if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkJ3LBO2O4cjs.FARM_API_CATALOG_PATH)}) {
9339
+ if (normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunk4SEHMBL4cjs.FARM_API_CATALOG_PATH)}) {
9247
9340
  return applyProductionMiddlewareHeaders(
9248
9341
  createFarmApiCatalogResponse(request.method, farmApiCatalogInput, request),
9249
9342
  middlewareHeaders,
@@ -9268,11 +9361,11 @@ ${hasServerRuntimeIntegrations ? `
9268
9361
  );
9269
9362
  }
9270
9363
  ` : ""}
9271
- ${_optionalChain([config, 'access', _219 => _219.agent, 'optionalAccess', _220 => _220.llmsTxt, 'optionalAccess', _221 => _221.enabled]) ? `
9364
+ ${_optionalChain([config, 'access', _223 => _223.agent, 'optionalAccess', _224 => _224.llmsTxt, 'optionalAccess', _225 => _225.enabled]) ? `
9272
9365
  // agent.llmsTxt with no llms.ts or llms-full.ts: serve the generated files.
9273
9366
  const farmGeneratedLlmsKind = normalizeRuntimePath(routePathname) === "/llms.txt"
9274
9367
  ? "llms"
9275
- : ${_optionalChain([config, 'access', _222 => _222.agent, 'optionalAccess', _223 => _223.llmsTxt, 'optionalAccess', _224 => _224.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
9368
+ : ${_optionalChain([config, 'access', _226 => _226.agent, 'optionalAccess', _227 => _227.llmsTxt, 'optionalAccess', _228 => _228.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
9276
9369
  if (farmGeneratedLlmsKind) {
9277
9370
  const llmsContext = createFarmLlmsTxtContext(request, farmGeneratedLlmsKind === "llms-full");
9278
9371
  const llmsOrigin = new URL(request.url).origin;
@@ -9307,7 +9400,7 @@ ${hasServerRuntimeIntegrations ? `
9307
9400
  }
9308
9401
  ` : ""}
9309
9402
 
9310
- ${_optionalChain([config, 'access', _225 => _225.docs, 'optionalAccess', _226 => _226.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
9403
+ ${_optionalChain([config, 'access', _229 => _229.docs, 'optionalAccess', _230 => _230.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
9311
9404
  const docsAPIResponse = await farmDocsAPIHandler(cloneFarmRequestWithContext(request));
9312
9405
  if (docsAPIResponse) {
9313
9406
  return applyProductionMiddlewareHeaders(
@@ -9846,7 +9939,7 @@ ${hasServerRuntimeIntegrations ? `
9846
9939
  );
9847
9940
  }
9848
9941
  }
9849
- ${_optionalChain([config, 'access', _227 => _227.md, 'optionalAccess', _228 => _228.enabled]) ? `
9942
+ ${_optionalChain([config, 'access', _231 => _231.md, 'optionalAccess', _232 => _232.enabled]) ? `
9850
9943
  // Advertise the Markdown mirror in the head as well as the Link header,
9851
9944
  // using the public path the .md request will be resolved against.
9852
9945
  mergedMetadata = addMetadataMarkdownAlternate(
@@ -9865,7 +9958,7 @@ ${hasServerRuntimeIntegrations ? `
9865
9958
  emitFarmEvent({ type: "cache.bypass", route: pathname, reason: "request-read" });
9866
9959
  }
9867
9960
 
9868
- const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _229 => _229.agent, 'optionalAccess', _230 => _230.jsonLd]), () => ( false)))} });
9961
+ const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _233 => _233.agent, 'optionalAccess', _234 => _234.jsonLd]), () => ( false)))} });
9869
9962
  const title = renderedMetadata.title;
9870
9963
  const metaTags = renderedMetadata.tags;
9871
9964
  const hasFavicon = renderedMetadata.hasFavicon;
@@ -10343,7 +10436,7 @@ ${hasServerRuntimeIntegrations ? `
10343
10436
  ${servesDefaultMCP ? `
10344
10437
  // agent.mcp: no app route answered /mcp, so the default read-only server may.
10345
10438
  if (
10346
- normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunkSBABQKPTcjs.FARM_DEFAULT_MCP_PATH)} &&
10439
+ normalizeRuntimePath(routePathname) === ${JSON.stringify(_chunk46KXZBOGcjs.FARM_DEFAULT_MCP_PATH)} &&
10347
10440
  getFarmDefaultMCPServer()
10348
10441
  ) {
10349
10442
  return applyProductionMiddlewareHeaders(
@@ -10559,11 +10652,11 @@ ${generatePreloadResponseRuntimeSource()}
10559
10652
  export async function fetch(request, context) {${imageRuntime === "none" ? "" : `
10560
10653
  // The image optimizer's fetch of a local source is not a loopback visitor.
10561
10654
  context = _withFarmImageSourceClientAddress(request, context);`}
10562
- ${_optionalChain([config, 'access', _231 => _231.agent, 'optionalAccess', _232 => _232.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
10655
+ ${_optionalChain([config, 'access', _235 => _235.agent, 'optionalAccess', _236 => _236.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
10563
10656
  basePath: farmLocalAPIBasePath,
10564
10657
  dispatch: async (localRequest) =>
10565
10658
  (await handleAPIRequest(localRequest)) ?? Response.json({ error: "Not Found" }, { status: 404 }),
10566
- }, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _233 => _233.agent, 'optionalAccess', _234 => _234.noindexPreviews]) ? `
10659
+ }, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _237 => _237.agent, 'optionalAccess', _238 => _238.noindexPreviews]) ? `
10567
10660
  // Keep every response of a preview deployment out of search indexes.
10568
10661
  return farmNoindexPreview ? applyFarmPreviewRobotsTag(response) : response;` : ""}
10569
10662
  }
@@ -10614,10 +10707,11 @@ async function handleFarmFetch(request, context) {
10614
10707
  ? getFarmRoutePathname(new URL(runtimeRequest.url).pathname)
10615
10708
  : undefined;
10616
10709
  const configured = applyConfiguredResponseHeaders(response, routePathname);
10710
+ // Configured headers may edit the response in place, so check it either way.
10711
+ const guarded = farmGuardedResponse ? _withFarmGuardedResponseCache(configured) : configured;
10617
10712
  return applyFarmPreloadBudget(
10618
10713
  applyFarmCspNonceToResponse(
10619
- // Configured headers may edit the response in place, so check it either way.
10620
- farmGuardedResponse ? _withFarmGuardedResponseCache(configured) : configured,
10714
+ applyFarmMobileShellResponse(runtimeRequest, guarded, context),
10621
10715
  farmSecurityConfig,
10622
10716
  cspNonce,
10623
10717
  ),
@@ -10754,13 +10848,13 @@ function getPhysicalPrerenderBypassReason(options) {
10754
10848
  if (rewriteSources.some((source) => middlewarePatternMatches(source, pathname))) {
10755
10849
  return "rewrite";
10756
10850
  }
10757
- if (_chunk76GHW3WIcjs.appMiddlewareMayHandlePath.call(void 0, middlewareRoutes, pathname)) return "app middleware";
10758
- if (_chunk76GHW3WIcjs.configMiddlewareMayHandlePath.call(void 0, config.middleware, pathname)) return "configured middleware";
10759
- if (_chunkNPQLMP7Mcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
10851
+ if (_chunkTSFMFPRUcjs.appMiddlewareMayHandlePath.call(void 0, middlewareRoutes, pathname)) return "app middleware";
10852
+ if (_chunkTSFMFPRUcjs.configMiddlewareMayHandlePath.call(void 0, config.middleware, pathname)) return "configured middleware";
10853
+ if (_chunkKLNFJDFMcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
10760
10854
  if (farmServerRuntimePluginsMayHandlePath(config, pathname)) return "server runtime plugin";
10761
10855
  const manifestEntry = getManifestPageEntry(routeRuntimeManifest, pathname);
10762
- if (_optionalChain([manifestEntry, 'optionalAccess', _235 => _235.rendering]) === "dynamic") return "dynamic runtime manifest";
10763
- if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _236 => _236.regions, 'optionalAccess', _237 => _237.length])) || manifestEntry.maxDuration !== void 0)) {
10856
+ if (_optionalChain([manifestEntry, 'optionalAccess', _239 => _239.rendering]) === "dynamic") return "dynamic runtime manifest";
10857
+ if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _240 => _240.regions, 'optionalAccess', _241 => _241.length])) || manifestEntry.maxDuration !== void 0)) {
10764
10858
  return "route runtime controls";
10765
10859
  }
10766
10860
  const routeRule = getEffectiveRouteRule(config, pathname);
@@ -10773,8 +10867,8 @@ function getPhysicalPrerenderBypassReason(options) {
10773
10867
  return void 0;
10774
10868
  }
10775
10869
  async function getFarmDocsPrerenderPages(config, root, preset) {
10776
- if (!_optionalChain([config, 'access', _238 => _238.docs, 'optionalAccess', _239 => _239.enabled]) || !config.docs.prerender) return [];
10777
- if (!_chunkRD623KW4cjs.isReactRenderer.call(void 0, config.renderer) || !_chunkGNJIYJMScjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
10870
+ if (!_optionalChain([config, 'access', _242 => _242.docs, 'optionalAccess', _243 => _243.enabled]) || !config.docs.prerender) return [];
10871
+ if (!_chunkRD623KW4cjs.isReactRenderer.call(void 0, config.renderer) || !_chunk3XQ57EFIcjs.hasFarmDocsRuntimeAdapter.call(void 0, config.docs)) {
10778
10872
  _chunkVQJYGZNXcjs.logger.warn(
10779
10873
  "docs.prerender needs a docs adapter such as @farming-labs/farmjs; Farm's built-in docs renderer keeps rendering docs pages on request."
10780
10874
  );
@@ -10786,7 +10880,7 @@ async function getFarmDocsPrerenderPages(config, root, preset) {
10786
10880
  );
10787
10881
  return [];
10788
10882
  }
10789
- const pages = await _chunkGNJIYJMScjs.listFarmDocsAdapterPages.call(void 0, config.docs, { root, srcDir: config.srcDir });
10883
+ const pages = await _chunk3XQ57EFIcjs.listFarmDocsAdapterPages.call(void 0, config.docs, { root, srcDir: config.srcDir });
10790
10884
  if (!pages) {
10791
10885
  _chunkVQJYGZNXcjs.logger.warn(
10792
10886
  `The docs adapter ${JSON.stringify(config.docs.adapter.id)} does not list its pages for prerendering; upgrade it to prerender docs pages. They render on request until then.`
@@ -10797,9 +10891,9 @@ async function getFarmDocsPrerenderPages(config, root, preset) {
10797
10891
  }
10798
10892
  function hasFarmNitroCacheRouteRule(routeRules) {
10799
10893
  return Object.values(routeRules || {}).some((rule) => {
10800
- const swr = _optionalChain([rule, 'optionalAccess', _240 => _240.swr]);
10801
- const cache = _optionalChain([rule, 'optionalAccess', _241 => _241.cache]);
10802
- const headers = _optionalChain([rule, 'optionalAccess', _242 => _242.headers]);
10894
+ const swr = _optionalChain([rule, 'optionalAccess', _244 => _244.swr]);
10895
+ const cache = _optionalChain([rule, 'optionalAccess', _245 => _245.cache]);
10896
+ const headers = _optionalChain([rule, 'optionalAccess', _246 => _246.headers]);
10803
10897
  return swr !== void 0 && swr !== false || cache !== void 0 && cache !== false || !!headers && typeof headers === "object" && Object.keys(headers).length > 0;
10804
10898
  });
10805
10899
  }
@@ -10812,10 +10906,10 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
10812
10906
  const nitroBuilder = nitroBuilderResult.value;
10813
10907
  const isVercel = preset === "vercel" || preset === "vercel-edge";
10814
10908
  const isCloudflareWorker = preset === "cloudflare-module";
10815
- const outputDir = _chunkNPQLMP7Mcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
10909
+ const outputDir = _chunkKLNFJDFMcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
10816
10910
  const runtimeServerOutputDir = isVercel ? _path2.default.join(outputDir, "functions", "__nitro.func") : _path2.default.join(outputDir, "server");
10817
10911
  const ssrOutputDir = _path2.default.join(root, distDir, "ssr");
10818
- const imageRuntime = _chunkWZW6LEHMcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
10912
+ const imageRuntime = _chunkTQMI6BYOcjs.resolveFarmImageServerRuntime.call(void 0, config.images, preset);
10819
10913
  const hasGeneratedMetadataImages = Array.from(routeManager.getMetadataImages().values()).some(
10820
10914
  (image) => image.sourceType === "module"
10821
10915
  );
@@ -10924,8 +11018,20 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
10924
11018
  ]);
10925
11019
  const encodedDocsModulePreloads = encodeFarmDocsModulePreloads(docsModulePreloads);
10926
11020
  const encodedClientModulePreloads = encodeFarmClientModulePreloads(clientModulePreloads);
11021
+ const encodedMobileShellClient = shouldBuildFarmMobileClient(config, { quiet: true }) ? _chunkEFZGB7JCcjs.encodeFarmMobileShellClient.call(void 0,
11022
+ await _chunkEFZGB7JCcjs.finalizeFarmMobileClient.call(void 0, {
11023
+ buildDir: _path2.default.join(root, distDir),
11024
+ clientOutputDir,
11025
+ webEntry: clientJsSrc,
11026
+ stylesheet: clientCssHref,
11027
+ webFiles: _nullishCoalesce(_optionalChain([clientModulePreloads, 'optionalAccess', _247 => _247.files]), () => ( []))
11028
+ })
11029
+ ) : null;
10927
11030
  for (const output of Object.values(ssrBundle)) {
10928
11031
  if (output.type !== "chunk") continue;
11032
+ if (encodedMobileShellClient && output.code.includes(_chunkEFZGB7JCcjs.FARM_MOBILE_SHELL_CLIENT_PLACEHOLDER)) {
11033
+ output.code = output.code.split(_chunkEFZGB7JCcjs.FARM_MOBILE_SHELL_CLIENT_PLACEHOLDER).join(encodedMobileShellClient);
11034
+ }
10929
11035
  if (output.code.includes(FARM_DOCS_MODULE_PRELOADS_PLACEHOLDER)) {
10930
11036
  output.code = output.code.split(FARM_DOCS_MODULE_PRELOADS_PLACEHOLDER).join(encodedDocsModulePreloads);
10931
11037
  }
@@ -10940,11 +11046,13 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
10940
11046
  }
10941
11047
  }
10942
11048
  await fs4.mkdir(ssrOutputDir, { recursive: true });
10943
- for (const [fileName, output] of Object.entries(ssrBundle)) {
10944
- const filePath = _path2.default.join(ssrOutputDir, fileName);
10945
- await fs4.mkdir(_path2.default.dirname(filePath), { recursive: true });
10946
- await fs4.writeFile(filePath, output.type === "chunk" ? output.code : output.source);
10947
- }
11049
+ await Promise.all(
11050
+ Object.entries(ssrBundle).map(async ([fileName, output]) => {
11051
+ const filePath = _path2.default.join(ssrOutputDir, fileName);
11052
+ await fs4.mkdir(_path2.default.dirname(filePath), { recursive: true });
11053
+ await fs4.writeFile(filePath, output.type === "chunk" ? output.code : output.source);
11054
+ })
11055
+ );
10948
11056
  const nitroEntryPath = _path2.default.join(ssrOutputDir, "nitro-entry.mjs");
10949
11057
  const nodeAdapterModule = preset === "node-server" ? resolveNitroRuntimeDependency(root, "srvx/node") : null;
10950
11058
  const hasNitroCacheRouteRules = hasFarmNitroCacheRouteRule(config.routeRules);
@@ -11201,7 +11309,7 @@ function toFarmNodeResponse(request, response) {
11201
11309
  ssrOutputDir,
11202
11310
  ssrEntryFile
11203
11311
  );
11204
- const configuredNitroRouteRules = _chunkV56632LAcjs.routeRulesToNitroRouteRules.call(void 0, config.routeRules);
11312
+ const configuredNitroRouteRules = shouldBuildFarmMobileClient(config, { quiet: true }) ? varyFarmNitroCacheRulesByShell(_chunkV56632LAcjs.routeRulesToNitroRouteRules.call(void 0, config.routeRules)) : _chunkV56632LAcjs.routeRulesToNitroRouteRules.call(void 0, config.routeRules);
11205
11313
  const prerenderNitroRouteRules = Object.fromEntries(
11206
11314
  prerenderRoutes.map((route) => {
11207
11315
  const configuredRule = configuredNitroRouteRules[route] || {};
@@ -11248,10 +11356,18 @@ function toFarmNodeResponse(request, response) {
11248
11356
  // fixed top quality cost a docs app ~20 s of build CPU for a small further
11249
11357
  // saving. Serverless and edge targets sit behind a CDN that compresses.
11250
11358
  ...preset === "node-server" ? { compressPublicAssets: { gzip: true } } : {},
11359
+ // Nitro gzips every server output file at level 9, node_modules included, to
11360
+ // print sizes after the build. A self-hosted server is never shipped compressed,
11361
+ // so list plain sizes; zipped serverless and edge bundles keep the gzip column.
11362
+ ...preset === "node-server" || preset === "bun" ? { logging: { compressedSizes: false } } : {},
11251
11363
  ...prerenderRoutes.length > 0 ? {
11252
11364
  prerender: {
11253
11365
  crawlLinks: false,
11254
11366
  failOnError: true,
11367
+ // Nitro's default renders one route at a time. Each prerender request is
11368
+ // answered independently, as by the production server, so keeping several
11369
+ // in flight overlaps the worker's rendering with this thread's per-route work.
11370
+ concurrency: Math.min(_os2.default.availableParallelism(), 8),
11255
11371
  routes: prerenderRoutes
11256
11372
  }
11257
11373
  } : {},
@@ -11325,20 +11441,20 @@ function toFarmNodeResponse(request, response) {
11325
11441
  snapshotSSRRebundleOptions(nitroConfig)
11326
11442
  );
11327
11443
  const requestedBuilder = _nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER));
11328
- const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _243 => _243.rollupConfig, 'optionalAccess', _244 => _244.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _245 => _245.rollupConfig, 'optionalAccess', _246 => _246.plugins])) && customRollupKeys.length === 0 && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _247 => _247.output, 'optionalAccess', _248 => _248.serverDir]) || "") === _path2.default.resolve(expectedServerDir) && Boolean(
11329
- _optionalChain([nitroConfig, 'access', _249 => _249.handlers, 'optionalAccess', _250 => _250.some, 'call', _251 => _251(
11330
- (handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _252 => _252.handler]) || "") === nitroEntryPath
11444
+ const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _248 => _248.rollupConfig, 'optionalAccess', _249 => _249.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _250 => _250.rollupConfig, 'optionalAccess', _251 => _251.plugins])) && customRollupKeys.length === 0 && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _252 => _252.output, 'optionalAccess', _253 => _253.serverDir]) || "") === _path2.default.resolve(expectedServerDir) && Boolean(
11445
+ _optionalChain([nitroConfig, 'access', _254 => _254.handlers, 'optionalAccess', _255 => _255.some, 'call', _256 => _256(
11446
+ (handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _257 => _257.handler]) || "") === nitroEntryPath
11331
11447
  )])
11332
11448
  );
11333
11449
  const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
11334
11450
  if (selectRolldownBuilder) nitroConfig.builder = "rolldown";
11335
11451
  const useRolldownBuilder = canReusePrebuiltSSR && (_nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER))) === "rolldown";
11336
11452
  const shouldMinify = nitroConfig.minify !== false;
11337
- const keepServerNames = !(_optionalChain([config, 'access', _253 => _253.docs, 'optionalAccess', _254 => _254.enabled]) && _optionalChain([config, 'access', _255 => _255.docs, 'access', _256 => _256.adapter, 'optionalAccess', _257 => _257.server]));
11453
+ const keepServerNames = !(_optionalChain([config, 'access', _258 => _258.docs, 'optionalAccess', _259 => _259.enabled]) && _optionalChain([config, 'access', _260 => _260.docs, 'access', _261 => _261.adapter, 'optionalAccess', _262 => _262.server]));
11338
11454
  const useFarmServerMinifier = shouldMinify && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig;
11339
11455
  const serverChunkMinifier = useFarmServerMinifier ? createServerChunkMinifyPlugin({ keepNames: keepServerNames, target: "esnext" }) : null;
11340
11456
  if (canReusePrebuiltSSR) {
11341
- const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _258 => _258.rollupConfig, 'optionalAccess', _259 => _259.plugins]);
11457
+ const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _263 => _263.rollupConfig, 'optionalAccess', _264 => _264.plugins]);
11342
11458
  nitroConfig.rollupConfig = {
11343
11459
  ...nitroConfig.rollupConfig,
11344
11460
  plugins: [
@@ -11349,10 +11465,26 @@ function toFarmNodeResponse(request, response) {
11349
11465
  }
11350
11466
  nitroConfig.minify = useFarmServerMinifier ? false : shouldMinify;
11351
11467
  const nitroInstance = await nitroBuilder.createNitro(nitroConfig);
11352
- if (_optionalChain([config, 'access', _260 => _260.md, 'optionalAccess', _261 => _261.enabled])) {
11468
+ let prerenderOrder = /* @__PURE__ */ new Map();
11469
+ nitroInstance.hooks.hook("prerender:routes", (routes) => {
11470
+ prerenderOrder = new Map(
11471
+ Array.from(routes, (route, index) => {
11472
+ try {
11473
+ return [decodeURI(route), index];
11474
+ } catch (e31) {
11475
+ return [route, index];
11476
+ }
11477
+ })
11478
+ );
11479
+ });
11480
+ nitroInstance.hooks.hook("prerender:done", ({ prerenderedRoutes }) => {
11481
+ const orderOf = (route) => _nullishCoalesce(prerenderOrder.get(route), () => ( Number.MAX_SAFE_INTEGER));
11482
+ prerenderedRoutes.sort((a, b) => orderOf(a.route) - orderOf(b.route));
11483
+ });
11484
+ if (_optionalChain([config, 'access', _265 => _265.md, 'optionalAccess', _266 => _266.enabled])) {
11353
11485
  nitroInstance.hooks.hook("prerender:generate", (route) => {
11354
- if (!route.contents || !_optionalChain([route, 'access', _262 => _262.contentType, 'optionalAccess', _263 => _263.toLowerCase, 'call', _264 => _264(), 'access', _265 => _265.includes, 'call', _266 => _266("html")])) return;
11355
- const alternatePath = _chunkWJFFPXCVcjs.getFarmMarkdownAlternatePath.call(void 0, config.md, route.route);
11486
+ if (!route.contents || !_optionalChain([route, 'access', _267 => _267.contentType, 'optionalAccess', _268 => _268.toLowerCase, 'call', _269 => _269(), 'access', _270 => _270.includes, 'call', _271 => _271("html")])) return;
11487
+ const alternatePath = _chunkD7UQC4O6cjs.getFarmMarkdownAlternatePath.call(void 0, config.md, route.route);
11356
11488
  if (!alternatePath) return;
11357
11489
  const routeRule = nitroInstance.options.routeRules[route.route] || {};
11358
11490
  const alternate = `<${alternatePath}>; rel="alternate"; type="text/markdown"`;
@@ -11372,7 +11504,7 @@ function toFarmNodeResponse(request, response) {
11372
11504
  }
11373
11505
  if (config.security.csp && config.security.csp.nonce) {
11374
11506
  nitroInstance.hooks.hook("prerender:generate", async (route) => {
11375
- if (!route.contents || !_optionalChain([route, 'access', _267 => _267.contentType, 'optionalAccess', _268 => _268.toLowerCase, 'call', _269 => _269(), 'access', _270 => _270.includes, 'call', _271 => _271("html")])) return;
11507
+ if (!route.contents || !_optionalChain([route, 'access', _272 => _272.contentType, 'optionalAccess', _273 => _273.toLowerCase, 'call', _274 => _274(), 'access', _275 => _275.includes, 'call', _276 => _276("html")])) return;
11376
11508
  const staticCsp = await _chunk6JHZPB52cjs.applyFarmCspHashesToHtml.call(void 0, route.contents, config.security);
11377
11509
  if (!staticCsp) return;
11378
11510
  route.contents = staticCsp.html;
@@ -11447,13 +11579,13 @@ function toFarmNodeResponse(request, response) {
11447
11579
  }
11448
11580
  if (prerenderRoutes.length > 0) {
11449
11581
  _chunkVQJYGZNXcjs.logger.info(`\u{1F4C4} Pre-rendering ${prerenderRoutes.length} SSG page(s)`);
11450
- const previousPrerender = process.env[_chunkQXPSWMUDcjs.FARM_PRERENDER_ENV];
11451
- process.env[_chunkQXPSWMUDcjs.FARM_PRERENDER_ENV] = "1";
11582
+ const previousPrerender = process.env[_chunk7MD37P5Vcjs.FARM_PRERENDER_ENV];
11583
+ process.env[_chunk7MD37P5Vcjs.FARM_PRERENDER_ENV] = "1";
11452
11584
  try {
11453
11585
  await nitroBuilder.prerender(nitroInstance);
11454
11586
  } finally {
11455
- if (previousPrerender === void 0) delete process.env[_chunkQXPSWMUDcjs.FARM_PRERENDER_ENV];
11456
- else process.env[_chunkQXPSWMUDcjs.FARM_PRERENDER_ENV] = previousPrerender;
11587
+ if (previousPrerender === void 0) delete process.env[_chunk7MD37P5Vcjs.FARM_PRERENDER_ENV];
11588
+ else process.env[_chunk7MD37P5Vcjs.FARM_PRERENDER_ENV] = previousPrerender;
11457
11589
  }
11458
11590
  }
11459
11591
  const sharpRuntimeStagePromise = imageRuntime === "node" ? stageSharpRuntime(config, root, distDir, fs4, preset) : Promise.resolve(null);
@@ -11578,7 +11710,7 @@ async function moveVercelOutputPath(src, dest, fs4) {
11578
11710
  await fs4.rename(src, dest);
11579
11711
  return;
11580
11712
  } catch (error) {
11581
- const code = _optionalChain([error, 'optionalAccess', _272 => _272.code]);
11713
+ const code = _optionalChain([error, 'optionalAccess', _277 => _277.code]);
11582
11714
  if (code !== "EPERM" && code !== "EACCES" && code !== "EXDEV" && code !== "ENOTEMPTY") {
11583
11715
  throw error;
11584
11716
  }
@@ -11604,7 +11736,7 @@ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflo
11604
11736
  try {
11605
11737
  await moveVercelOutputPath(publicDir, staticDir, fs4);
11606
11738
  } catch (error) {
11607
- if (_optionalChain([error, 'optionalAccess', _273 => _273.code]) !== "ENOENT") throw error;
11739
+ if (_optionalChain([error, 'optionalAccess', _278 => _278.code]) !== "ENOENT") throw error;
11608
11740
  }
11609
11741
  await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4);
11610
11742
  await copyPrismaClientForVercel(root, nitroFuncDir, fs4);
@@ -11633,8 +11765,8 @@ async function postProcessVercelOutput(root, outputDir, fs4, config, farmWorkflo
11633
11765
  _chunkVQJYGZNXcjs.logger.info("\u2705 Post-processed Vercel output for Build Output API v3");
11634
11766
  }
11635
11767
  async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4) {
11636
- if (!_optionalChain([config, 'access', _274 => _274.docs, 'optionalAccess', _275 => _275.enabled])) return;
11637
- const [mainRoot, ...extraRoots] = _chunk5N7QAGEAcjs.getFarmDocsRoots.call(void 0, config.docs);
11768
+ if (!_optionalChain([config, 'access', _279 => _279.docs, 'optionalAccess', _280 => _280.enabled])) return;
11769
+ const [mainRoot, ...extraRoots] = _chunkTWHXBMLJcjs.getFarmDocsRoots.call(void 0, config.docs);
11638
11770
  await copyFarmDocsRootContent(
11639
11771
  mainRoot,
11640
11772
  root,
@@ -11655,7 +11787,7 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs4) {
11655
11787
  async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs4) {
11656
11788
  const docsContentDir = resolveBuildDocsContentDir(docs, root, srcDir);
11657
11789
  if (!docsContentDir) return;
11658
- const lastModifiedManifest = _chunk5N7QAGEAcjs.createFarmDocsLastModifiedManifest.call(void 0, docsContentDir, {
11790
+ const lastModifiedManifest = _chunkTWHXBMLJcjs.createFarmDocsLastModifiedManifest.call(void 0, docsContentDir, {
11659
11791
  fallback: "now"
11660
11792
  });
11661
11793
  await fs4.rm(bundledContentDir, { recursive: true, force: true });
@@ -11665,7 +11797,7 @@ async function copyFarmDocsRootContent(docs, root, srcDir, bundledContentDir, fs
11665
11797
  force: true
11666
11798
  });
11667
11799
  await fs4.writeFile(
11668
- _path2.default.join(bundledContentDir, _chunk5N7QAGEAcjs.FARM_DOCS_LAST_MODIFIED_MANIFEST),
11800
+ _path2.default.join(bundledContentDir, _chunkTWHXBMLJcjs.FARM_DOCS_LAST_MODIFIED_MANIFEST),
11669
11801
  `${JSON.stringify(lastModifiedManifest, null, 2)}
11670
11802
  `
11671
11803
  );
@@ -11691,7 +11823,7 @@ async function stageSharpRuntime(config, root, distDir, fs4, preset) {
11691
11823
  if (!resolvePackageJson(projectRequire, "sharp")) {
11692
11824
  try {
11693
11825
  sharpRequire = _module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core"));
11694
- } catch (e31) {
11826
+ } catch (e32) {
11695
11827
  }
11696
11828
  }
11697
11829
  const copiedPackages = /* @__PURE__ */ new Map();
@@ -11736,7 +11868,7 @@ async function stageSharpRuntime(config, root, distDir, fs4, preset) {
11736
11868
  try {
11737
11869
  await copyPackage("sharp", sharpRequire);
11738
11870
  if (!copiedPackages.has("sharp")) {
11739
- throw new Error(`Farm image optimization requires sharp. ${_chunkWZW6LEHMcjs.SHARP_INSTALL_HINT}`);
11871
+ throw new Error(`Farm image optimization requires sharp. ${_chunkTQMI6BYOcjs.SHARP_INSTALL_HINT}`);
11740
11872
  }
11741
11873
  } catch (error) {
11742
11874
  await fs4.rm(stageDir, { recursive: true, force: true });
@@ -11818,7 +11950,7 @@ function resolveMetadataImageRuntimePackageJson(root) {
11818
11950
  if (packageJsonPath) return packageJsonPath;
11819
11951
  try {
11820
11952
  return resolvePackageJson(_module.createRequire.call(void 0, projectRequire.resolve("@farm.js/core")), "@vercel/og");
11821
- } catch (e32) {
11953
+ } catch (e33) {
11822
11954
  return null;
11823
11955
  }
11824
11956
  }
@@ -11865,7 +11997,7 @@ function resolvePackageJson(parentRequire, packageName) {
11865
11997
  const resolved = parentRequire.resolve(request);
11866
11998
  if (resolved.endsWith(".json")) return resolved;
11867
11999
  _nullishCoalesce(metadataModule, () => ( (metadataModule = resolved)));
11868
- } catch (e33) {
12000
+ } catch (e34) {
11869
12001
  }
11870
12002
  }
11871
12003
  try {
@@ -11876,13 +12008,13 @@ function resolvePackageJson(parentRequire, packageName) {
11876
12008
  try {
11877
12009
  const manifest = JSON.parse(_fs.readFileSync.call(void 0, candidate, "utf8"));
11878
12010
  if (manifest.name === packageName) return candidate;
11879
- } catch (e34) {
12011
+ } catch (e35) {
11880
12012
  }
11881
12013
  }
11882
12014
  if (_path2.default.basename(directory) === "node_modules") break;
11883
12015
  directory = _path2.default.dirname(directory);
11884
12016
  }
11885
- } catch (e35) {
12017
+ } catch (e36) {
11886
12018
  }
11887
12019
  return null;
11888
12020
  }
@@ -11891,13 +12023,13 @@ async function copyPrismaClientForVercel(root, nitroFuncDir, fs4) {
11891
12023
  let prismaClientDir;
11892
12024
  try {
11893
12025
  prismaClientDir = _path2.default.dirname(projectRequire.resolve("@prisma/client/default.js"));
11894
- } catch (e36) {
12026
+ } catch (e37) {
11895
12027
  return;
11896
12028
  }
11897
12029
  const generatedClientDir = _path2.default.join(prismaClientDir, "..", "..", ".prisma", "client");
11898
12030
  try {
11899
12031
  await fs4.access(generatedClientDir);
11900
- } catch (e37) {
12032
+ } catch (e38) {
11901
12033
  return;
11902
12034
  }
11903
12035
  const targetNodeModules = _path2.default.join(nitroFuncDir, "node_modules");
@@ -11956,7 +12088,9 @@ async function createFarmProjectModuleSsrEnvironment() {
11956
12088
 
11957
12089
  // src/build/index.ts
11958
12090
  async function build(config, options = {}) {
11959
- return _chunkVZY7MAVScjs.withProductionNodeEnv.call(void 0, () => buildWithProductionNodeEnv(config, options));
12091
+ return _chunkVZY7MAVScjs.withProductionNodeEnv.call(void 0,
12092
+ () => _chunkTQMI6BYOcjs.withPackageClientBoundaryCache.call(void 0, () => buildWithProductionNodeEnv(config, options))
12093
+ );
11960
12094
  }
11961
12095
  function createBuildTargetBaseline(config) {
11962
12096
  const preset = config.preset || "node-server";
@@ -11966,7 +12100,7 @@ function createBuildTargetBaseline(config) {
11966
12100
  preset,
11967
12101
  distDir,
11968
12102
  outputDir,
11969
- outputWasDerived: outputDir === _chunkNPQLMP7Mcjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
12103
+ outputWasDerived: outputDir === _chunkKLNFJDFMcjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
11970
12104
  };
11971
12105
  }
11972
12106
  function resolveBuildTargets(config, options, baseline) {
@@ -11975,8 +12109,8 @@ function resolveBuildTargets(config, options, baseline) {
11975
12109
  const distDir = config.distDir || ".farm";
11976
12110
  const outputWasReplaced = config.deploy.outputDir !== baseline.outputDir;
11977
12111
  const shouldRefreshDerivedOutput = baseline.outputWasDerived && !outputWasReplaced && (preset !== baseline.preset || distDir !== baseline.distDir);
11978
- const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunkNPQLMP7Mcjs.getDeployTargetForPreset.call(void 0, preset);
11979
- const outputDir = shouldRefreshDerivedOutput ? _chunkNPQLMP7Mcjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
12112
+ const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunkKLNFJDFMcjs.getDeployTargetForPreset.call(void 0, preset);
12113
+ const outputDir = shouldRefreshDerivedOutput ? _chunkKLNFJDFMcjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
11980
12114
  return {
11981
12115
  root,
11982
12116
  preset,
@@ -11984,7 +12118,7 @@ function resolveBuildTargets(config, options, baseline) {
11984
12118
  distDir,
11985
12119
  deployTarget,
11986
12120
  outputDir,
11987
- deployOutputDir: _chunkNPQLMP7Mcjs.resolveDeployOutputPath.call(void 0, root, outputDir)
12121
+ deployOutputDir: _chunkKLNFJDFMcjs.resolveDeployOutputPath.call(void 0, root, outputDir)
11988
12122
  };
11989
12123
  }
11990
12124
  async function buildWithProductionNodeEnv(inputConfig, options) {
@@ -12021,14 +12155,17 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
12021
12155
  };
12022
12156
  config = {
12023
12157
  ...config,
12024
- images: _chunkWZW6LEHMcjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
12158
+ images: _chunkTQMI6BYOcjs.resolveFarmImageProviderForRuntime.call(void 0, config.images, {
12025
12159
  root: targets.root,
12026
12160
  preset: targets.preset
12027
12161
  })
12028
12162
  };
12029
- if (_optionalChain([config, 'access', _276 => _276.docs, 'optionalAccess', _277 => _277.enabled])) await _chunkV3UOEWCBcjs.loadFarmDocsEngine.call(void 0, );
12163
+ if (_optionalChain([config, 'access', _281 => _281.docs, 'optionalAccess', _282 => _282.enabled])) await _chunkV3UOEWCBcjs.loadFarmDocsEngine.call(void 0, );
12030
12164
  pluginManager.updateContext({ config });
12031
12165
  const { root, preset, srcDir, distDir, deployOutputDir } = targets;
12166
+ _chunkTQMI6BYOcjs.usePackageClientBoundaryCacheFile.call(void 0,
12167
+ _path2.default.resolve(root, distDir, "cache", "client-boundaries.json")
12168
+ );
12032
12169
  _chunkVQJYGZNXcjs.logger.info(`\u{1F69C} Building Farm.js application with preset: ${preset}...`);
12033
12170
  await pluginManager.setupPlugins();
12034
12171
  await pluginManager.runHookParallel("beforeBundle", {
@@ -12040,8 +12177,8 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
12040
12177
  });
12041
12178
  _chunkVQJYGZNXcjs.logger.info("\u{1F50D} Discovering routes and API endpoints...");
12042
12179
  const productionViteResult = productionViteResultPromise ? (await productionViteResultPromise)[0] : void 0;
12043
- if (_optionalChain([productionViteResult, 'optionalAccess', _278 => _278.status]) === "rejected") throw productionViteResult.reason;
12044
- const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _279 => _279.value]);
12180
+ if (_optionalChain([productionViteResult, 'optionalAccess', _283 => _283.status]) === "rejected") throw productionViteResult.reason;
12181
+ const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _284 => _284.value]);
12045
12182
  const createViteServer = productionVite ? productionVite.createServer : (await import("vite")).createServer;
12046
12183
  projectModuleServer = await createProjectModuleServer(
12047
12184
  createViteServer,
@@ -12049,7 +12186,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
12049
12186
  root,
12050
12187
  rendererBuild.signal
12051
12188
  );
12052
- const farmApp = _chunkWZW6LEHMcjs.createFarmApp.call(void 0, config, projectModuleServer);
12189
+ const farmApp = _chunkTQMI6BYOcjs.createFarmApp.call(void 0, config, projectModuleServer);
12053
12190
  await farmApp.initialize();
12054
12191
  const routeManager = farmApp.getRouteManager();
12055
12192
  const serverRenderer = farmApp.getServerRenderer();
@@ -12059,8 +12196,8 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
12059
12196
  layers: config.layers,
12060
12197
  plugins: config.plugins,
12061
12198
  extraRoutes: [
12062
- ..._optionalChain([config, 'access', _280 => _280.openapi, 'optionalAccess', _281 => _281.enabled]) && config.openapi.route ? [config.openapi.route] : [],
12063
- ..._chunk5N7QAGEAcjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
12199
+ ..._optionalChain([config, 'access', _285 => _285.openapi, 'optionalAccess', _286 => _286.enabled]) && config.openapi.route ? [config.openapi.route] : [],
12200
+ ..._chunkTWHXBMLJcjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
12064
12201
  ],
12065
12202
  suppressLintOnLink: config.suppressLintOnLink,
12066
12203
  componentExtensions: config.renderer.componentExtensions,
@@ -12144,7 +12281,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
12144
12281
  throw error;
12145
12282
  } finally {
12146
12283
  try {
12147
- await _optionalChain([projectModuleServer, 'optionalAccess', _282 => _282.close, 'call', _283 => _283()]);
12284
+ await _optionalChain([projectModuleServer, 'optionalAccess', _287 => _287.close, 'call', _288 => _288()]);
12148
12285
  } finally {
12149
12286
  rendererBuild.abort();
12150
12287
  }
@@ -12155,7 +12292,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
12155
12292
  ssr: true,
12156
12293
  buildLifetime
12157
12294
  });
12158
- const viteConfig = _chunkWZW6LEHMcjs.mergeFarmViteConfig.call(void 0,
12295
+ const viteConfig = _chunkTQMI6BYOcjs.mergeFarmViteConfig.call(void 0,
12159
12296
  {
12160
12297
  root,
12161
12298
  appType: "custom",
@@ -12167,7 +12304,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
12167
12304
  },
12168
12305
  plugins: [
12169
12306
  ...rendererVitePlugins,
12170
- _chunkWZW6LEHMcjs.farmFontImportsPlugin.call(void 0, {
12307
+ _chunkTQMI6BYOcjs.farmFontImportsPlugin.call(void 0, {
12171
12308
  root,
12172
12309
  basePath: config.basePath,
12173
12310
  publicDir: config.publicDir
@@ -12179,7 +12316,7 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
12179
12316
  hmr: false
12180
12317
  },
12181
12318
  resolve: {
12182
- alias: _chunkWZW6LEHMcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
12319
+ alias: _chunkTQMI6BYOcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
12183
12320
  dedupe: [...config.renderer.dedupe || []]
12184
12321
  },
12185
12322
  optimizeDeps: {
@@ -12212,10 +12349,10 @@ async function createProjectModuleServer(createViteServer, config, root, buildLi
12212
12349
  noDiscovery: true
12213
12350
  },
12214
12351
  // An app or plugin that brings its own SSR environment keeps it.
12215
- environments: _optionalChain([viteConfig, 'access', _284 => _284.environments, 'optionalAccess', _285 => _285.ssr, 'optionalAccess', _286 => _286.dev, 'optionalAccess', _287 => _287.createEnvironment]) ? viteConfig.environments : {
12352
+ environments: _optionalChain([viteConfig, 'access', _289 => _289.environments, 'optionalAccess', _290 => _290.ssr, 'optionalAccess', _291 => _291.dev, 'optionalAccess', _292 => _292.createEnvironment]) ? viteConfig.environments : {
12216
12353
  ...viteConfig.environments,
12217
12354
  ssr: {
12218
- ..._optionalChain([viteConfig, 'access', _288 => _288.environments, 'optionalAccess', _289 => _289.ssr]),
12355
+ ..._optionalChain([viteConfig, 'access', _293 => _293.environments, 'optionalAccess', _294 => _294.ssr]),
12219
12356
  ...await createFarmProjectModuleSsrEnvironment()
12220
12357
  }
12221
12358
  }
@@ -12271,7 +12408,7 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
12271
12408
  define: {
12272
12409
  __FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
12273
12410
  __FARM_ENV__: JSON.stringify(_chunk3EIPOTZVcjs.createBundledEnv.call(void 0, config.env)),
12274
- __FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _290 => _290.env, 'optionalAccess', _291 => _291.public]) || {})
12411
+ __FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _295 => _295.env, 'optionalAccess', _296 => _296.public]) || {})
12275
12412
  },
12276
12413
  plugins: [
12277
12414
  farmI18nClientBridgePlugin(),
@@ -12304,7 +12441,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
12304
12441
  if (pluginManager) {
12305
12442
  nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
12306
12443
  }
12307
- const outputDir = _chunkNPQLMP7Mcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
12444
+ const outputDir = _chunkKLNFJDFMcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
12308
12445
  const serverOutputDir = _path2.default.join(outputDir, "server");
12309
12446
  const publicOutputDir = _path2.default.join(outputDir, "public");
12310
12447
  const { mkdir, cp } = await import("fs/promises");
@@ -12363,7 +12500,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
12363
12500
  const { readFile } = await import("fs/promises");
12364
12501
  const manifestContent = await readFile(clientManifestPath, "utf-8");
12365
12502
  farmRegistry.clientManifest = JSON.parse(manifestContent);
12366
- } catch (e38) {
12503
+ } catch (e39) {
12367
12504
  farmRegistry.clientManifest = {};
12368
12505
  }
12369
12506
  } catch (error) {
@@ -12375,7 +12512,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
12375
12512
  root,
12376
12513
  preset,
12377
12514
  distDir,
12378
- outputDir: _chunkNPQLMP7Mcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
12515
+ outputDir: _chunkKLNFJDFMcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
12379
12516
  });
12380
12517
  }
12381
12518
  }