@farm.js/core 0.1.62 → 0.1.64

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 (194) hide show
  1. package/dist/{agent-mcp-handler-OV4WRFBL.cjs → agent-mcp-handler-OXT73ZBY.cjs} +5 -5
  2. package/dist/{agent-mcp-handler-7QMX2LUY.mjs → agent-mcp-handler-QLFDDTYN.mjs} +4 -4
  3. package/dist/{agent-mcp.d-BKZ3UNbt.d.mts → agent-mcp.d-CO_ABmNK.d.mts} +1 -1
  4. package/dist/{agent-mcp.d-C1zr_nGS.d.ts → agent-mcp.d-QD2WZ9BS.d.ts} +1 -1
  5. package/dist/agent-runtime.d.mts +1 -1
  6. package/dist/agent-runtime.d.ts +1 -1
  7. package/dist/analyzer-ODLF2Z6O.cjs +16 -0
  8. package/dist/{analyzer-YESYU3GK.mjs → analyzer-Q3QXC6PD.mjs} +3 -2
  9. package/dist/api/route-manager.d.mts +3 -3
  10. package/dist/api/route-manager.d.ts +3 -3
  11. package/dist/api/runtime.d.mts +2 -2
  12. package/dist/api/runtime.d.ts +2 -2
  13. package/dist/api.d.mts +3 -3
  14. package/dist/api.d.ts +3 -3
  15. package/dist/{app-manifest.d-ntch_bvA.d.ts → app-manifest.d-BpKxiU_E.d.mts} +9 -1
  16. package/dist/{app-manifest.d-BpvhfKRH.d.mts → app-manifest.d-DDmNkYQQ.d.ts} +9 -1
  17. package/dist/app-markdown.cjs +4 -4
  18. package/dist/app-markdown.d.mts +2 -2
  19. package/dist/app-markdown.d.ts +2 -2
  20. package/dist/app-markdown.mjs +3 -3
  21. package/dist/{app.d-CysWA_8v.d.mts → app.d-kuoVWhWM.d.mts} +4 -4
  22. package/dist/{app.d-AE8_v3Db.d.ts → app.d-x68Cwr0_.d.ts} +4 -4
  23. package/dist/{chunk-LT4VAF5Z.cjs → chunk-2C5L5RPM.cjs} +7 -6
  24. package/dist/{chunk-RMUD75WT.cjs → chunk-3EBHJET2.cjs} +355 -270
  25. package/dist/{chunk-RZNCMRD3.mjs → chunk-6NHSGVVA.mjs} +1 -1
  26. package/dist/{chunk-LVWGURLD.mjs → chunk-6NNYPY5W.mjs} +327 -13
  27. package/dist/{chunk-PRFNLQSP.cjs → chunk-7XGWBPQQ.cjs} +4 -4
  28. package/dist/{chunk-SG57PX7K.cjs → chunk-BTVDYS4B.cjs} +7 -2
  29. package/dist/{chunk-545WJ5UG.cjs → chunk-DUSHDZQL.cjs} +11 -11
  30. package/dist/{chunk-GVOMPU3Y.cjs → chunk-EL4364S2.cjs} +209 -32
  31. package/dist/{chunk-GGNJAGGE.cjs → chunk-FAP7CX7C.cjs} +1056 -529
  32. package/dist/{chunk-T46NNU4D.mjs → chunk-FH45OB37.mjs} +2 -2
  33. package/dist/{chunk-55U5QIXQ.mjs → chunk-FIR62CR3.mjs} +1 -1
  34. package/dist/{chunk-MEQN6DDA.cjs → chunk-FJWN7RV4.cjs} +5 -5
  35. package/dist/chunk-IOEXXZK3.mjs +88 -0
  36. package/dist/{chunk-EXXFSZOC.cjs → chunk-JCPSA4X5.cjs} +135 -134
  37. package/dist/{chunk-YSXTNSXS.mjs → chunk-K7OZAVOI.mjs} +7 -6
  38. package/dist/{chunk-KVW2M6PI.mjs → chunk-KL7SHLQB.mjs} +1 -1
  39. package/dist/{chunk-NT3QDN2E.mjs → chunk-LQDLEWPO.mjs} +1 -1
  40. package/dist/{chunk-UZZ6IEQP.mjs → chunk-MESQF2JC.mjs} +2 -2
  41. package/dist/{chunk-WKJQ2FJA.cjs → chunk-MG356ROI.cjs} +5 -5
  42. package/dist/{chunk-AJB3DHN6.cjs → chunk-N3Z3PLHC.cjs} +2 -2
  43. package/dist/{chunk-2CNKQC3G.mjs → chunk-NNLFW3P4.mjs} +2 -2
  44. package/dist/{chunk-XX32BOMM.cjs → chunk-NXFA7G3Y.cjs} +52 -26
  45. package/dist/{chunk-SM25ZC4S.cjs → chunk-O2XFIPNL.cjs} +1 -1
  46. package/dist/{chunk-VWW4Q3BJ.mjs → chunk-O4FWNLQK.mjs} +4 -4
  47. package/dist/{chunk-DZPR2W6U.cjs → chunk-O6L3YYPM.cjs} +5 -5
  48. package/dist/{chunk-UWI3SJAK.cjs → chunk-O7IEMY55.cjs} +3 -3
  49. package/dist/{chunk-6BJJYOFL.cjs → chunk-OLIGNTWU.cjs} +7 -7
  50. package/dist/{chunk-OUWRNHTV.mjs → chunk-OYF23QLG.mjs} +17 -16
  51. package/dist/{chunk-IQIKPKFP.mjs → chunk-RAH5MT53.mjs} +110 -25
  52. package/dist/{chunk-E72UD6ME.mjs → chunk-RVGSVQWT.mjs} +1 -1
  53. package/dist/{chunk-ZVIEFTUA.cjs → chunk-S25BQIFW.cjs} +16 -16
  54. package/dist/chunk-S7ZW72JH.cjs +254 -0
  55. package/dist/{chunk-VM7X5CKC.mjs → chunk-SLYDIHLW.mjs} +31 -5
  56. package/dist/chunk-SNFTMSHX.mjs +254 -0
  57. package/dist/{chunk-2WZTGPK6.mjs → chunk-SQ5O7I3L.mjs} +7 -2
  58. package/dist/{chunk-PCXIJKPM.mjs → chunk-TNBJ4LZG.mjs} +2 -2
  59. package/dist/{chunk-O27PLNQZ.cjs → chunk-UJ3R2AH2.cjs} +4 -4
  60. package/dist/{chunk-T4TBK5NY.mjs → chunk-VQ4NWOWO.mjs} +2 -2
  61. package/dist/{chunk-ZZ2QKCKW.mjs → chunk-WAY6LOQH.mjs} +1 -1
  62. package/dist/chunk-WBTHHTBO.cjs +88 -0
  63. package/dist/{chunk-ZBUAOGMY.mjs → chunk-WFNAOWH4.mjs} +1 -1
  64. package/dist/{chunk-IWRLV46X.cjs → chunk-WMTBBQHY.cjs} +4 -4
  65. package/dist/{chunk-2JYBLE63.mjs → chunk-WNYRYI4D.mjs} +770 -243
  66. package/dist/{chunk-CI4UNQHO.cjs → chunk-XBSKPLHF.cjs} +2 -2
  67. package/dist/{chunk-IOF4KXMP.mjs → chunk-XVWSDSUM.mjs} +201 -24
  68. package/dist/{chunk-JEJQGZI7.cjs → chunk-XZLZ6YPP.cjs} +346 -32
  69. package/dist/{chunk-QAS7KE7J.cjs → chunk-Y5TOT5F6.cjs} +5 -5
  70. package/dist/{chunk-DPE53XWL.mjs → chunk-ZEXE4TGY.mjs} +1 -1
  71. package/dist/{client-component.d-BoqC2MLC.d.mts → client-component.d-D74pqdea.d.mts} +14 -3
  72. package/dist/{client-component.d-Bgt3x5Fu.d.ts → client-component.d-D8VcypQA.d.ts} +14 -3
  73. package/dist/{client-plugins.d-BcqIy4au.d.ts → client-plugins.d-CXElzotB.d.ts} +18 -2
  74. package/dist/{client-plugins.d-CWyYBxXf.d.mts → client-plugins.d-D4-6hNx7.d.mts} +18 -2
  75. package/dist/client-plugins.d.mts +1 -1
  76. package/dist/client-plugins.d.ts +1 -1
  77. package/dist/client.d.mts +6 -6
  78. package/dist/client.d.ts +6 -6
  79. package/dist/config.d.mts +1 -1
  80. package/dist/config.d.ts +1 -1
  81. package/dist/desktop.d.mts +2 -2
  82. package/dist/desktop.d.ts +2 -2
  83. package/dist/{devtools-NUVXYG7I.mjs → devtools-MX3FE733.mjs} +5 -5
  84. package/dist/{devtools-SVRSGPNC.cjs → devtools-WET5NAKO.cjs} +6 -6
  85. package/dist/docs.cjs +8 -8
  86. package/dist/docs.d.mts +2 -2
  87. package/dist/docs.d.ts +2 -2
  88. package/dist/docs.mjs +7 -7
  89. package/dist/index.cjs +21 -20
  90. package/dist/{index.d-nAncqTXz.d.ts → index.d-A_x10zGS.d.ts} +1 -1
  91. package/dist/{index.d-BDaiu2i5.d.mts → index.d-SSgYDv4D.d.mts} +1 -1
  92. package/dist/index.d.mts +16 -16
  93. package/dist/index.d.ts +16 -16
  94. package/dist/index.mjs +20 -19
  95. package/dist/integrations.d.mts +1 -1
  96. package/dist/integrations.d.ts +1 -1
  97. package/dist/internal/app-markdown-runtime.cjs +3 -3
  98. package/dist/internal/app-markdown-runtime.d.mts +2 -2
  99. package/dist/internal/app-markdown-runtime.d.ts +2 -2
  100. package/dist/internal/app-markdown-runtime.mjs +2 -2
  101. package/dist/internal/build-runtime.cjs +22 -21
  102. package/dist/internal/build-runtime.d.mts +3 -3
  103. package/dist/internal/build-runtime.d.ts +3 -3
  104. package/dist/internal/build-runtime.mjs +21 -20
  105. package/dist/internal/cli-runtime.cjs +7 -7
  106. package/dist/internal/cli-runtime.mjs +6 -6
  107. package/dist/internal/client-error-overlay.cjs +4 -4
  108. package/dist/internal/client-error-overlay.mjs +1 -1
  109. package/dist/internal/client-runtime.d.mts +4 -4
  110. package/dist/internal/client-runtime.d.ts +4 -4
  111. package/dist/internal/compression-runtime.d.mts +1 -1
  112. package/dist/internal/compression-runtime.d.ts +1 -1
  113. package/dist/internal/config-runtime.cjs +7 -7
  114. package/dist/internal/config-runtime.d.mts +4 -4
  115. package/dist/internal/config-runtime.d.ts +4 -4
  116. package/dist/internal/config-runtime.mjs +6 -6
  117. package/dist/internal/infra-analytics-runtime.cjs +11 -9
  118. package/dist/internal/infra-analytics-runtime.mjs +9 -7
  119. package/dist/internal/native-server-fns.cjs +5 -4
  120. package/dist/internal/native-server-fns.mjs +4 -3
  121. package/dist/internal/product-telemetry-runtime.cjs +17 -211
  122. package/dist/internal/product-telemetry-runtime.mjs +10 -204
  123. package/dist/internal/production-runtime.cjs +13 -12
  124. package/dist/internal/production-runtime.d.mts +13 -12
  125. package/dist/internal/production-runtime.d.ts +13 -12
  126. package/dist/internal/production-runtime.mjs +14 -13
  127. package/dist/internal/react-cache.cjs +21 -1
  128. package/dist/internal/react-cache.d.mts +8 -1
  129. package/dist/internal/react-cache.d.ts +8 -1
  130. package/dist/internal/react-cache.mjs +21 -1
  131. package/dist/markdown.cjs +2 -2
  132. package/dist/markdown.d.mts +1 -1
  133. package/dist/markdown.d.ts +1 -1
  134. package/dist/markdown.mjs +1 -1
  135. package/dist/middleware.d.mts +3 -3
  136. package/dist/middleware.d.ts +3 -3
  137. package/dist/mobile.d.mts +2 -2
  138. package/dist/mobile.d.ts +2 -2
  139. package/dist/{native-tree-AS5L3ID3.mjs → native-tree-BPEE2LAL.mjs} +2 -2
  140. package/dist/{native-tree-Z2WYUJEV.cjs → native-tree-WOX3JMBG.cjs} +3 -3
  141. package/dist/{navigation-delegate.d-CSCm8ZxL.d.mts → navigation-delegate.d-DQVYKoaZ.d.mts} +1 -1
  142. package/dist/{navigation-delegate.d-BbUHRXxG.d.ts → navigation-delegate.d-GghbHJuK.d.ts} +1 -1
  143. package/dist/navigation.d.mts +4 -4
  144. package/dist/navigation.d.ts +4 -4
  145. package/dist/plugin.cjs +14 -14
  146. package/dist/plugin.d.mts +3 -3
  147. package/dist/plugin.d.ts +3 -3
  148. package/dist/plugin.mjs +13 -13
  149. package/dist/{production-runtime.d-DgT24A0f.d.ts → production-runtime.d-Bzns3NW9.d.ts} +1 -1
  150. package/dist/{production-runtime.d-CcQiDko5.d.mts → production-runtime.d-DiFa5vHW.d.mts} +1 -1
  151. package/dist/{render-plan.d-CyrX6MDs.d.ts → render-plan.d-CL_Ikfg_.d.ts} +1 -1
  152. package/dist/{render-plan.d-BH9WF-JZ.d.mts → render-plan.d-CcF0MeCf.d.mts} +1 -1
  153. package/dist/renderer-client.d.mts +4 -4
  154. package/dist/renderer-client.d.ts +4 -4
  155. package/dist/{request.d-BB8M8bcD.d.ts → request.d-B1RnTLri.d.ts} +1 -1
  156. package/dist/{request.d-CUrPnCW7.d.mts → request.d-DarDOCk9.d.mts} +1 -1
  157. package/dist/request.d.mts +2 -2
  158. package/dist/request.d.ts +2 -2
  159. package/dist/{route-rendering.d-DYqZMIf4.d.ts → route-rendering.d-BTUYCIj4.d.ts} +1 -1
  160. package/dist/{route-rendering.d-CYxlzaFm.d.mts → route-rendering.d-D_2Ual0-.d.mts} +1 -1
  161. package/dist/{router.d-DaKo507j.d.ts → router.d-CMANF6da.d.ts} +1 -1
  162. package/dist/{router.d-7o24CD8u.d.mts → router.d-Cuv1jntg.d.mts} +1 -1
  163. package/dist/{routes.d-BknKQcTu.d.ts → routes.d-B6yFe6jm.d.ts} +1 -1
  164. package/dist/{routes.d-D1IrO9KK.d.mts → routes.d-c2HKfrfL.d.mts} +1 -1
  165. package/dist/routes.d.mts +1 -1
  166. package/dist/routes.d.ts +1 -1
  167. package/dist/{rsc-pipeline-RFLHDAKD.mjs → rsc-pipeline-3LNVP2OO.mjs} +6 -6
  168. package/dist/{rsc-pipeline-OF2I7PCX.cjs → rsc-pipeline-G5WELVW3.cjs} +7 -7
  169. package/dist/{runtime-LBTK62AD.cjs → runtime-DMEULPE7.cjs} +22 -11
  170. package/dist/{runtime-M6UJCSLA.mjs → runtime-HQJ2LLQL.mjs} +20 -9
  171. package/dist/{runtime.d-CN73a-IL.d.ts → runtime.d-C3RQUj6_.d.ts} +1 -1
  172. package/dist/{runtime.d-CcNuzhX6.d.mts → runtime.d-wvh4ngU0.d.mts} +1 -1
  173. package/dist/server-plugins.d.mts +2 -2
  174. package/dist/server-plugins.d.ts +2 -2
  175. package/dist/server.cjs +31 -31
  176. package/dist/server.d.mts +9 -9
  177. package/dist/server.d.ts +9 -9
  178. package/dist/server.mjs +16 -16
  179. package/dist/{spa-router.d-CNi77LZm.d.mts → spa-router.d-WU_qS5gJ.d.mts} +2 -2
  180. package/dist/{spa-router.d-Cvgf5QP4.d.ts → spa-router.d-m8H_Kl_B.d.ts} +2 -2
  181. package/dist/testing.d.mts +1 -1
  182. package/dist/testing.d.ts +1 -1
  183. package/dist/{utils.d-C3H-14_Y.d.ts → utils.d-C9dQD5Zg.d.ts} +1 -1
  184. package/dist/{utils.d-D8VfzZYn.d.mts → utils.d-W9IiEqmW.d.mts} +1 -1
  185. package/dist/version.cjs +2 -2
  186. package/dist/version.mjs +1 -1
  187. package/dist/vite.cjs +18 -14
  188. package/dist/vite.d.mts +23 -5
  189. package/dist/vite.d.ts +23 -5
  190. package/dist/vite.mjs +17 -13
  191. package/package.json +1 -1
  192. package/dist/analyzer-2AHWJJR7.cjs +0 -15
  193. package/dist/chunk-CSLUBKGG.mjs +0 -44
  194. package/dist/chunk-SGBNF56S.cjs +0 -44
@@ -35,13 +35,13 @@ var _chunkX4K7TYN6cjs = require('./chunk-X4K7TYN6.cjs');
35
35
 
36
36
 
37
37
 
38
- var _chunkO27PLNQZcjs = require('./chunk-O27PLNQZ.cjs');
38
+ var _chunkUJ3R2AH2cjs = require('./chunk-UJ3R2AH2.cjs');
39
39
 
40
40
 
41
41
  var _chunkCLFEQGETcjs = require('./chunk-CLFEQGET.cjs');
42
42
 
43
43
 
44
- var _chunkXX32BOMMcjs = require('./chunk-XX32BOMM.cjs');
44
+ var _chunkNXFA7G3Ycjs = require('./chunk-NXFA7G3Y.cjs');
45
45
 
46
46
 
47
47
 
@@ -49,7 +49,7 @@ var _chunkXX32BOMMcjs = require('./chunk-XX32BOMM.cjs');
49
49
 
50
50
 
51
51
 
52
- var _chunkQAS7KE7Jcjs = require('./chunk-QAS7KE7J.cjs');
52
+ var _chunkY5TOT5F6cjs = require('./chunk-Y5TOT5F6.cjs');
53
53
 
54
54
 
55
55
 
@@ -96,7 +96,7 @@ var _chunkRD623KW4cjs = require('./chunk-RD623KW4.cjs');
96
96
 
97
97
 
98
98
 
99
- var _chunkDZPR2W6Ucjs = require('./chunk-DZPR2W6U.cjs');
99
+ var _chunkO6L3YYPMcjs = require('./chunk-O6L3YYPM.cjs');
100
100
 
101
101
 
102
102
 
@@ -111,7 +111,7 @@ var _chunk6JHZPB52cjs = require('./chunk-6JHZPB52.cjs');
111
111
 
112
112
 
113
113
 
114
- var _chunkMEQN6DDAcjs = require('./chunk-MEQN6DDA.cjs');
114
+ var _chunkFJWN7RV4cjs = require('./chunk-FJWN7RV4.cjs');
115
115
 
116
116
 
117
117
 
@@ -122,10 +122,10 @@ var _chunkHEPJIKKQcjs = require('./chunk-HEPJIKKQ.cjs');
122
122
 
123
123
 
124
124
 
125
- var _chunkCI4UNQHOcjs = require('./chunk-CI4UNQHO.cjs');
125
+ var _chunkXBSKPLHFcjs = require('./chunk-XBSKPLHF.cjs');
126
126
 
127
127
 
128
- var _chunkPRFNLQSPcjs = require('./chunk-PRFNLQSP.cjs');
128
+ var _chunk7XGWBPQQcjs = require('./chunk-7XGWBPQQ.cjs');
129
129
 
130
130
 
131
131
 
@@ -138,7 +138,7 @@ var _chunk2HW5LWAHcjs = require('./chunk-2HW5LWAH.cjs');
138
138
 
139
139
 
140
140
 
141
- var _chunkLT4VAF5Zcjs = require('./chunk-LT4VAF5Z.cjs');
141
+ var _chunk2C5L5RPMcjs = require('./chunk-2C5L5RPM.cjs');
142
142
 
143
143
 
144
144
  var _chunk3CCAICF7cjs = require('./chunk-3CCAICF7.cjs');
@@ -256,7 +256,7 @@ var _chunkCFG4QERRcjs = require('./chunk-CFG4QERR.cjs');
256
256
  var _chunkJYT7AN37cjs = require('./chunk-JYT7AN37.cjs');
257
257
 
258
258
 
259
- var _chunkSM25ZC4Scjs = require('./chunk-SM25ZC4S.cjs');
259
+ var _chunkO2XFIPNLcjs = require('./chunk-O2XFIPNL.cjs');
260
260
 
261
261
 
262
262
 
@@ -330,17 +330,450 @@ var _chunkYTVSWXEZcjs = require('./chunk-YTVSWXEZ.cjs');
330
330
 
331
331
  var _chunkBTZ5O6VMcjs = require('./chunk-BTZ5O6VM.cjs');
332
332
 
333
- // src/islands-package-references.ts
334
- var _fs = require('fs'); var fs4 = _interopRequireWildcard(_fs); var fs9 = _interopRequireWildcard(_fs); var fs8 = _interopRequireWildcard(_fs);
335
- var _path = require('path'); var path6 = _interopRequireWildcard(_path); var path13 = _interopRequireWildcard(_path); var path12 = _interopRequireWildcard(_path);
333
+ // src/islands-react-server-exports.ts
334
+ var _fs = require('fs'); var fs5 = _interopRequireWildcard(_fs); var fs10 = _interopRequireWildcard(_fs); var fs9 = _interopRequireWildcard(_fs);
335
+ var _path = require('path'); var path7 = _interopRequireWildcard(_path); var path14 = _interopRequireWildcard(_path); var path13 = _interopRequireWildcard(_path);
336
336
  var _parseAst = require('rolldown/parseAst');
337
+ var REACT_PACKAGES = /* @__PURE__ */ new Set([
338
+ "react",
339
+ "react-dom",
340
+ "scheduler",
341
+ "react-server-dom-webpack",
342
+ "react-server-dom-esm",
343
+ "react-server-dom-turbopack"
344
+ ]);
345
+ var SERVER_CONDITIONS = ["react-server", "node", "import", "module", "default"];
346
+ var DEFAULT_CONDITIONS = ["node", "import", "module", "default"];
347
+ var SCRIPT_EXTENSIONS = ["", ".js", ".mjs", ".cjs", ".jsx", ".ts", ".tsx", ".mts"];
348
+ var INDEX_FILES = ["index.js", "index.mjs", "index.cjs", "index.ts", "index.tsx"];
349
+ function packageNameOf(specifier) {
350
+ if (specifier.startsWith(".") || specifier.startsWith("/") || specifier.startsWith("#") || specifier.includes(":") || specifier.includes("\0")) {
351
+ return null;
352
+ }
353
+ const parts = specifier.split("/");
354
+ const name = specifier.startsWith("@") ? parts.slice(0, 2).join("/") : parts[0];
355
+ if (!name || specifier.startsWith("@") && parts.length < 2) return null;
356
+ return { name, subpath: parts.slice(name.startsWith("@") ? 2 : 1).join("/") };
357
+ }
358
+ function findPackageDirectory(importer, name) {
359
+ for (let current = path7.default.dirname(importer); ; current = path7.default.dirname(current)) {
360
+ const directory = path7.default.join(current, "node_modules", name);
361
+ if (fs5.default.existsSync(path7.default.join(directory, "package.json"))) return fs5.default.realpathSync(directory);
362
+ if (path7.default.dirname(current) === current) return null;
363
+ }
364
+ }
365
+ function pickTarget(value, conditions) {
366
+ if (typeof value === "string") return value;
367
+ if (Array.isArray(value)) {
368
+ for (const entry of value) {
369
+ const target = pickTarget(entry, conditions);
370
+ if (target) return target;
371
+ }
372
+ return null;
373
+ }
374
+ if (!value || typeof value !== "object") return null;
375
+ for (const [key, entry] of Object.entries(value)) {
376
+ if (key === "types" || !conditions.includes(key)) continue;
377
+ const target = pickTarget(entry, conditions);
378
+ if (target) return target;
379
+ }
380
+ return null;
381
+ }
382
+ function exportEntry(exportsField, subpath) {
383
+ const key = subpath ? `./${subpath}` : ".";
384
+ if (typeof exportsField === "string" || Array.isArray(exportsField)) {
385
+ return key === "." ? exportsField : void 0;
386
+ }
387
+ if (!exportsField || typeof exportsField !== "object") return void 0;
388
+ const entries = exportsField;
389
+ if (!Object.keys(entries).some((entry) => entry.startsWith("."))) {
390
+ return key === "." ? entries : void 0;
391
+ }
392
+ if (entries[key] !== void 0) return entries[key];
393
+ for (const [pattern, value] of Object.entries(entries)) {
394
+ const star = pattern.indexOf("*");
395
+ if (star === -1) continue;
396
+ const prefix = pattern.slice(0, star);
397
+ const suffix = pattern.slice(star + 1);
398
+ if (key.startsWith(prefix) && key.endsWith(suffix)) {
399
+ const match = key.slice(prefix.length, key.length - suffix.length);
400
+ const replace = (target) => typeof target === "string" ? target.replace("*", match) : target && typeof target === "object" && !Array.isArray(target) ? Object.fromEntries(
401
+ Object.entries(target).map(([k, v]) => [k, replace(v)])
402
+ ) : target;
403
+ return replace(value);
404
+ }
405
+ }
406
+ return void 0;
407
+ }
408
+ var cache = /* @__PURE__ */ new Map();
409
+ function resolveFarmReactServerExport(importer, specifier) {
410
+ const parsed = packageNameOf(specifier);
411
+ if (!parsed || REACT_PACKAGES.has(parsed.name) || parsed.name.startsWith("@farm.js/"))
412
+ return null;
413
+ const directory = findPackageDirectory(importer, parsed.name);
414
+ if (!directory) return null;
415
+ const key = `${directory}\0${parsed.subpath}`;
416
+ if (cache.has(key)) return cache.get(key);
417
+ let resolved = null;
418
+ try {
419
+ const manifest = JSON.parse(fs5.default.readFileSync(path7.default.join(directory, "package.json"), "utf8"));
420
+ const entry = exportEntry(manifest.exports, parsed.subpath);
421
+ const server = pickTarget(entry, SERVER_CONDITIONS);
422
+ const fallback = pickTarget(entry, DEFAULT_CONDITIONS);
423
+ if (server && server !== fallback && server.startsWith("./")) {
424
+ const file = path7.default.resolve(directory, server);
425
+ if (fs5.default.existsSync(file)) resolved = file;
426
+ }
427
+ } catch (e) {
428
+ resolved = null;
429
+ }
430
+ cache.set(key, resolved);
431
+ return resolved;
432
+ }
433
+ function readModule(file) {
434
+ try {
435
+ const code = fs5.default.readFileSync(file, "utf8");
436
+ const extension = path7.default.extname(file).slice(1);
437
+ const lang = extension === "ts" || extension === "mts" || extension === "cts" ? "ts" : "tsx";
438
+ return _parseAst.parseAst.call(void 0, code, { lang });
439
+ } catch (e2) {
440
+ return null;
441
+ }
442
+ }
443
+ function isClientModule(program) {
444
+ for (const node of _nullishCoalesce(program.body, () => ( []))) {
445
+ if (node.type !== "ExpressionStatement" || typeof node.directive !== "string") break;
446
+ if (node.directive === "use client") return true;
447
+ }
448
+ return false;
449
+ }
450
+ function resolveRelative(from, specifier) {
451
+ const base = path7.default.resolve(path7.default.dirname(from), specifier);
452
+ for (const extension of SCRIPT_EXTENSIONS) {
453
+ const file = `${base}${extension}`;
454
+ if (fs5.default.existsSync(file) && fs5.default.statSync(file).isFile()) return file;
455
+ }
456
+ for (const index of INDEX_FILES) {
457
+ const file = path7.default.join(base, index);
458
+ if (fs5.default.existsSync(file)) return file;
459
+ }
460
+ return null;
461
+ }
462
+ function exportedName(node) {
463
+ return _optionalChain([node, 'optionalAccess', _2 => _2.type]) === "Identifier" ? node.name : _optionalChain([node, 'optionalAccess', _3 => _3.value]);
464
+ }
465
+ function isFarmClientExport(file, name, depth = 0) {
466
+ if (depth > 6) return false;
467
+ const program = readModule(file);
468
+ if (!program) return false;
469
+ if (isClientModule(program)) return true;
470
+ const stars = [];
471
+ for (const node of _nullishCoalesce(program.body, () => ( []))) {
472
+ if (node.type === "ExportNamedDeclaration" && node.source) {
473
+ for (const specifier of _nullishCoalesce(node.specifiers, () => ( []))) {
474
+ if (exportedName(specifier.exported) !== name) continue;
475
+ const target = resolveRelative(file, node.source.value);
476
+ return target ? isFarmClientExport(target, _nullishCoalesce(exportedName(specifier.local), () => ( name)), depth + 1) : false;
477
+ }
478
+ } else if (node.type === "ExportAllDeclaration" && node.source && !node.exported) {
479
+ stars.push(node.source.value);
480
+ } else if (node.type === "ExportNamedDeclaration" && !node.source) {
481
+ const names = [
482
+ ...(_nullishCoalesce(node.specifiers, () => ( []))).map((specifier) => exportedName(specifier.exported)),
483
+ ..._optionalChain([node, 'access', _4 => _4.declaration, 'optionalAccess', _5 => _5.id]) ? [node.declaration.id.name] : [],
484
+ ...(_nullishCoalesce(_optionalChain([node, 'access', _6 => _6.declaration, 'optionalAccess', _7 => _7.declarations]), () => ( []))).map((declarator) => _optionalChain([declarator, 'access', _8 => _8.id, 'optionalAccess', _9 => _9.name]))
485
+ ];
486
+ if (names.includes(name)) return false;
487
+ } else if (node.type === "ExportDefaultDeclaration" && name === "default") {
488
+ return false;
489
+ }
490
+ }
491
+ for (const source of stars) {
492
+ const target = resolveRelative(file, source);
493
+ if (target && isFarmClientExport(target, name, depth + 1)) return true;
494
+ }
495
+ return false;
496
+ }
497
+ function parseCode(code, file) {
498
+ const extension = path7.default.extname(file).slice(1);
499
+ const lang = extension === "ts" || extension === "mts" || extension === "cts" ? "ts" : "tsx";
500
+ try {
501
+ return _parseAst.parseAst.call(void 0, code, { lang });
502
+ } catch (e3) {
503
+ return null;
504
+ }
505
+ }
506
+ function namespaceMembers(program, local) {
507
+ const members = /* @__PURE__ */ new Set();
508
+ let opaque = false;
509
+ const visit = (node, parent) => {
510
+ if (opaque || !node || typeof node !== "object") return;
511
+ if (Array.isArray(node)) {
512
+ for (const child of node) visit(child, parent);
513
+ return;
514
+ }
515
+ const current = node;
516
+ if (typeof current.type !== "string") return;
517
+ if ((current.type === "Identifier" || current.type === "JSXIdentifier") && current.name === local && _optionalChain([parent, 'optionalAccess', _10 => _10.type]) !== "ImportNamespaceSpecifier") {
518
+ const property2 = (_optionalChain([parent, 'optionalAccess', _11 => _11.type]) === "MemberExpression" || _optionalChain([parent, 'optionalAccess', _12 => _12.type]) === "JSXMemberExpression") && parent.object === current && !parent.computed ? _optionalChain([parent, 'access', _13 => _13.property, 'optionalAccess', _14 => _14.name]) : void 0;
519
+ if (property2) members.add(property2);
520
+ else opaque = true;
521
+ return;
522
+ }
523
+ for (const [key, value] of Object.entries(current)) {
524
+ if (key === "start" || key === "end" || key === "loc" || key === "range") continue;
525
+ if (value && typeof value === "object") visit(value, current);
526
+ }
527
+ };
528
+ visit(program, null);
529
+ return opaque ? null : [...members];
530
+ }
531
+ function findPackageImports(program, accept) {
532
+ const found = [];
533
+ for (const node of _nullishCoalesce(program.body, () => ( []))) {
534
+ if (node.type !== "ImportDeclaration" || node.importKind === "type") continue;
535
+ const specifier = _optionalChain([node, 'access', _15 => _15.source, 'optionalAccess', _16 => _16.value]);
536
+ if (typeof specifier !== "string" || !accept(specifier)) continue;
537
+ const specifiers = (_nullishCoalesce(node.specifiers, () => ( []))).filter(
538
+ (entry2) => entry2.importKind !== "type"
539
+ );
540
+ if ((_nullishCoalesce(node.specifiers, () => ( []))).length > 0 && specifiers.length === 0) continue;
541
+ const entry = {
542
+ start: node.start,
543
+ end: node.end,
544
+ specifier,
545
+ sideEffect: specifiers.length === 0,
546
+ named: []
547
+ };
548
+ for (const binding of specifiers) {
549
+ if (binding.type === "ImportDefaultSpecifier") entry.defaultLocal = binding.local.name;
550
+ else if (binding.type === "ImportNamespaceSpecifier") {
551
+ entry.namespace = {
552
+ local: binding.local.name,
553
+ members: namespaceMembers(program, binding.local.name)
554
+ };
555
+ } else {
556
+ const imported = exportedName(binding.imported);
557
+ if (imported) entry.named.push({ imported, local: binding.local.name });
558
+ }
559
+ }
560
+ found.push(entry);
561
+ }
562
+ return found;
563
+ }
564
+ function findFarmReactServerClientNames(code, file, specifier) {
565
+ const target = resolveFarmReactServerExport(file, specifier);
566
+ if (!target) return null;
567
+ const program = parseCode(code, file);
568
+ if (!program) return null;
569
+ const names = /* @__PURE__ */ new Set();
570
+ for (const entry of findPackageImports(program, (candidate) => candidate === specifier)) {
571
+ const wanted = [
572
+ ...entry.defaultLocal ? ["default"] : [],
573
+ ...entry.named.map((binding) => binding.imported),
574
+ ..._nullishCoalesce(_optionalChain([entry, 'access', _17 => _17.namespace, 'optionalAccess', _18 => _18.members]), () => ( []))
575
+ ];
576
+ for (const name of wanted) if (isFarmClientExport(target, name)) names.add(name);
577
+ }
578
+ return [...names];
579
+ }
580
+ function rewriteFarmReactServerImports(options) {
581
+ if (!options.code.includes("import")) return null;
582
+ const program = parseCode(options.code, options.file);
583
+ if (!program) return null;
584
+ const targets = /* @__PURE__ */ new Map();
585
+ const imports = findPackageImports(program, (specifier) => {
586
+ const target = resolveFarmReactServerExport(options.file, specifier);
587
+ if (target) targets.set(specifier, target);
588
+ return target !== null;
589
+ });
590
+ if (imports.length === 0) return null;
591
+ let output = options.code;
592
+ let next = 0;
593
+ for (const entry of [...imports].sort((left, right) => right.start - left.start)) {
594
+ const target = targets.get(entry.specifier);
595
+ _optionalChain([options, 'access', _19 => _19.onServerFile, 'optionalCall', _20 => _20(target)]);
596
+ const server = JSON.stringify(target);
597
+ const lines = [];
598
+ const bind = (name, local) => {
599
+ if (isFarmClientExport(target, name)) {
600
+ lines.push(
601
+ `import { ${name} as ${local} } from ${JSON.stringify(options.reference(entry.specifier, name))};`
602
+ );
603
+ } else lines.push(`import { ${name} as ${local} } from ${server};`);
604
+ };
605
+ if (entry.sideEffect) lines.push(`import ${server};`);
606
+ if (entry.defaultLocal) bind("default", entry.defaultLocal);
607
+ for (const binding of entry.named) bind(binding.imported, binding.local);
608
+ if (entry.namespace) {
609
+ if (entry.namespace.members === null) {
610
+ lines.push(`import * as ${entry.namespace.local} from ${server};`);
611
+ } else {
612
+ const fields = [];
613
+ for (const member of entry.namespace.members) {
614
+ const local = `__farm_react_server_${next++}__`;
615
+ bind(member, local);
616
+ fields.push(`${member}: ${local}`);
617
+ }
618
+ lines.push(`const ${entry.namespace.local} = Object.freeze({ ${fields.join(", ")} });`);
619
+ }
620
+ }
621
+ output = output.slice(0, entry.start) + lines.join("\n") + output.slice(entry.end);
622
+ }
623
+ return output;
624
+ }
625
+ function farmRelativeImportFiles(code, file) {
626
+ const program = parseCode(code, file);
627
+ if (!program) return [];
628
+ const files = [];
629
+ for (const node of _nullishCoalesce(program.body, () => ( []))) {
630
+ const source = (node.type === "ImportDeclaration" || node.type === "ExportAllDeclaration" || node.type === "ExportNamedDeclaration" && node.source) && _optionalChain([node, 'access', _21 => _21.source, 'optionalAccess', _22 => _22.value]);
631
+ if (typeof source !== "string" || !source.startsWith(".")) continue;
632
+ const resolved = resolveRelative(file, source);
633
+ if (resolved) files.push(resolved);
634
+ }
635
+ return files;
636
+ }
637
+ function farmReactServerBuildReachesClientModules(importer, specifier) {
638
+ const target = resolveFarmReactServerExport(importer, specifier);
639
+ if (!target) return false;
640
+ const seen = /* @__PURE__ */ new Set();
641
+ const reaches = (file, depth) => {
642
+ if (depth > 6 || seen.has(file)) return false;
643
+ seen.add(file);
644
+ const program = readModule(file);
645
+ if (!program) return false;
646
+ if (depth > 0 && isClientModule(program)) return true;
647
+ for (const node of _nullishCoalesce(program.body, () => ( []))) {
648
+ const source = (node.type === "ExportAllDeclaration" || node.type === "ExportNamedDeclaration" && node.source || node.type === "ImportDeclaration") && _optionalChain([node, 'access', _23 => _23.source, 'optionalAccess', _24 => _24.value]);
649
+ if (typeof source !== "string" || !source.startsWith(".")) continue;
650
+ const child = resolveRelative(file, source);
651
+ if (child && reaches(child, depth + 1)) return true;
652
+ }
653
+ return false;
654
+ };
655
+ return reaches(target, 0);
656
+ }
657
+ var IMPORT_SPECIFIER = /(?:\bfrom\s*|\bimport\s*\(?\s*)["']([^"'./][^"']*)["']/g;
658
+ var MAX_SCANNED_FILES = 2e3;
659
+ function packageImportSpecifiers(directory) {
660
+ const found = /* @__PURE__ */ new Set();
661
+ const pending = [directory];
662
+ let scanned = 0;
663
+ while (pending.length > 0 && scanned < MAX_SCANNED_FILES) {
664
+ const current = pending.pop();
665
+ let entries;
666
+ try {
667
+ entries = fs5.default.readdirSync(current, { withFileTypes: true });
668
+ } catch (e4) {
669
+ continue;
670
+ }
671
+ for (const entry of entries) {
672
+ if (entry.name === "node_modules" || entry.name.startsWith(".")) continue;
673
+ const file = path7.default.join(current, entry.name);
674
+ if (entry.isDirectory()) pending.push(file);
675
+ else if (/\.(?:m?js|jsx)$/.test(entry.name) && scanned++ < MAX_SCANNED_FILES) {
676
+ let code;
677
+ try {
678
+ code = fs5.default.readFileSync(file, "utf8");
679
+ } catch (e5) {
680
+ continue;
681
+ }
682
+ for (const match of code.matchAll(IMPORT_SPECIFIER)) found.add(match[1]);
683
+ }
684
+ }
685
+ }
686
+ return found;
687
+ }
688
+ function findFarmPackageManifest(importer, specifier) {
689
+ const parsed = packageNameOf(specifier);
690
+ if (!parsed) return null;
691
+ const directory = findPackageDirectory(importer, parsed.name);
692
+ if (!directory) return null;
693
+ let names;
694
+ try {
695
+ const manifest = JSON.parse(fs5.default.readFileSync(path7.default.join(directory, "package.json"), "utf8"));
696
+ names = new Set(Object.keys(_nullishCoalesce(manifest.dependencies, () => ( {}))));
697
+ } catch (e6) {
698
+ return null;
699
+ }
700
+ const dependencies = [...packageImportSpecifiers(directory)].filter((imported) => {
701
+ const name = _optionalChain([packageNameOf, 'call', _25 => _25(imported), 'optionalAccess', _26 => _26.name]);
702
+ return name !== void 0 && names.has(name);
703
+ });
704
+ return { name: parsed.name, dependencies: dependencies.sort() };
705
+ }
706
+ function listFarmPackageExports(importer, specifier) {
707
+ const parsed = packageNameOf(specifier);
708
+ if (!parsed) return null;
709
+ const directory = findPackageDirectory(importer, parsed.name);
710
+ if (!directory) return null;
711
+ let entry = null;
712
+ try {
713
+ const manifest = JSON.parse(fs5.default.readFileSync(path7.default.join(directory, "package.json"), "utf8"));
714
+ const target = _nullishCoalesce(pickTarget(exportEntry(manifest.exports, parsed.subpath), [
715
+ "browser",
716
+ ...DEFAULT_CONDITIONS
717
+ ]), () => ( (!parsed.subpath ? _nullishCoalesce(_nullishCoalesce(manifest.module, () => ( manifest.main)), () => ( "index.js")) : parsed.subpath)));
718
+ entry = resolveRelative(
719
+ path7.default.join(directory, "package.json"),
720
+ `./${String(target).replace(/^\.\//, "")}`
721
+ );
722
+ } catch (e7) {
723
+ return null;
724
+ }
725
+ if (!entry) return null;
726
+ const names = /* @__PURE__ */ new Set();
727
+ const seen = /* @__PURE__ */ new Set();
728
+ const collect = (file, depth) => {
729
+ if (depth > 8 || seen.has(file)) return true;
730
+ seen.add(file);
731
+ const program = readModule(file);
732
+ if (!program) return false;
733
+ let esm = false;
734
+ for (const node of _nullishCoalesce(program.body, () => ( []))) {
735
+ if (node.type === "ExportAllDeclaration" && node.source && !node.exported) {
736
+ esm = true;
737
+ const child = resolveRelative(file, node.source.value);
738
+ if (!child || !collect(child, depth + 1)) return false;
739
+ } else if (node.type === "ExportAllDeclaration" && node.exported) {
740
+ esm = true;
741
+ const name = exportedName(node.exported);
742
+ if (name) names.add(name);
743
+ } else if (node.type === "ExportNamedDeclaration") {
744
+ esm = true;
745
+ for (const specifier2 of _nullishCoalesce(node.specifiers, () => ( []))) {
746
+ const name = exportedName(specifier2.exported);
747
+ if (name) names.add(name);
748
+ }
749
+ if (_optionalChain([node, 'access', _27 => _27.declaration, 'optionalAccess', _28 => _28.id, 'optionalAccess', _29 => _29.name])) names.add(node.declaration.id.name);
750
+ for (const declarator of _nullishCoalesce(_optionalChain([node, 'access', _30 => _30.declaration, 'optionalAccess', _31 => _31.declarations]), () => ( []))) {
751
+ if (_optionalChain([declarator, 'access', _32 => _32.id, 'optionalAccess', _33 => _33.type]) === "Identifier") names.add(declarator.id.name);
752
+ }
753
+ } else if (node.type === "ExportDefaultDeclaration") {
754
+ esm = true;
755
+ names.add("default");
756
+ } else if (node.type === "ImportDeclaration") {
757
+ esm = true;
758
+ }
759
+ }
760
+ return esm || depth > 0;
761
+ };
762
+ if (!collect(entry, 0)) return null;
763
+ return [...names].filter((name) => /^[A-Za-z_$][\w$]*$/.test(name)).sort();
764
+ }
765
+
766
+ // src/islands-package-references.ts
767
+
768
+
769
+
337
770
  var IDENTIFIER = /^[A-Za-z_$][\w$]*$/;
338
771
  function parse(code, file) {
339
- const extension = path6.default.extname(file).slice(1);
772
+ const extension = path7.default.extname(file).slice(1);
340
773
  const lang = extension === "ts" || extension === "mts" || extension === "cts" ? "ts" : "tsx";
341
774
  try {
342
775
  return _parseAst.parseAst.call(void 0, code, { lang });
343
- } catch (e) {
776
+ } catch (e8) {
344
777
  return null;
345
778
  }
346
779
  }
@@ -358,15 +791,15 @@ function walk(node, visit, parent = null) {
358
791
  if (value && typeof value === "object") walk(value, visit, current);
359
792
  }
360
793
  }
361
- function namespaceMembers(program, local, declaration) {
794
+ function namespaceMembers2(program, local, declaration) {
362
795
  const members = /* @__PURE__ */ new Set();
363
796
  let opaque = false;
364
797
  walk(program, (node, parent) => {
365
798
  if (opaque || node === declaration) return;
366
799
  const name = node.type === "Identifier" || node.type === "JSXIdentifier" ? node.name : null;
367
800
  if (name !== local) return;
368
- if (_optionalChain([parent, 'optionalAccess', _2 => _2.type]) === "ImportNamespaceSpecifier") return;
369
- const member = (_optionalChain([parent, 'optionalAccess', _3 => _3.type]) === "MemberExpression" || _optionalChain([parent, 'optionalAccess', _4 => _4.type]) === "JSXMemberExpression") && parent.object === node ? parent.property : null;
801
+ if (_optionalChain([parent, 'optionalAccess', _34 => _34.type]) === "ImportNamespaceSpecifier") return;
802
+ const member = (_optionalChain([parent, 'optionalAccess', _35 => _35.type]) === "MemberExpression" || _optionalChain([parent, 'optionalAccess', _36 => _36.type]) === "JSXMemberExpression") && parent.object === node ? parent.property : null;
370
803
  const property2 = member && !parent.computed && (member.type === "Identifier" || member.type === "JSXIdentifier") ? member.name : null;
371
804
  if (property2) members.add(property2);
372
805
  else opaque = true;
@@ -380,7 +813,7 @@ function findFarmPackageClientImports(code, file, isClientPackage) {
380
813
  const found = [];
381
814
  for (const node of _nullishCoalesce(program.body, () => ( []))) {
382
815
  if (node.type !== "ImportDeclaration" || node.importKind === "type") continue;
383
- const specifier = _optionalChain([node, 'access', _5 => _5.source, 'optionalAccess', _6 => _6.value]);
816
+ const specifier = _optionalChain([node, 'access', _37 => _37.source, 'optionalAccess', _38 => _38.value]);
384
817
  if (typeof specifier !== "string" || specifier.startsWith(".") || specifier.startsWith("/"))
385
818
  continue;
386
819
  const specifiers = (_nullishCoalesce(node.specifiers, () => ( []))).filter(
@@ -397,11 +830,20 @@ function findFarmPackageClientImports(code, file, isClientPackage) {
397
830
  for (const binding of specifiers) {
398
831
  if (binding.type === "ImportDefaultSpecifier") entry.defaultLocal = binding.local.name;
399
832
  else if (binding.type === "ImportNamespaceSpecifier") {
400
- const members = namespaceMembers(program, binding.local.name, node);
833
+ const read = namespaceMembers2(program, binding.local.name, node);
834
+ const members = _nullishCoalesce(read, () => ( listFarmPackageExports(file, specifier)));
401
835
  if (!members || members.some((member) => !IDENTIFIER.test(member))) supported = false;
402
- else entry.namespace = { local: binding.local.name, members };
836
+ else if (read) entry.namespace = { local: binding.local.name, members };
837
+ else {
838
+ const component = (name) => name === "default" || /^[A-Z]/.test(name);
839
+ entry.namespace = {
840
+ local: binding.local.name,
841
+ members: members.filter(component),
842
+ values: members.filter((name) => !component(name))
843
+ };
844
+ }
403
845
  } else {
404
- const imported = _optionalChain([binding, 'access', _7 => _7.imported, 'optionalAccess', _8 => _8.type]) === "Identifier" ? binding.imported.name : _optionalChain([binding, 'access', _9 => _9.imported, 'optionalAccess', _10 => _10.value]);
846
+ const imported = _optionalChain([binding, 'access', _39 => _39.imported, 'optionalAccess', _40 => _40.type]) === "Identifier" ? binding.imported.name : _optionalChain([binding, 'access', _41 => _41.imported, 'optionalAccess', _42 => _42.value]);
405
847
  if (typeof imported !== "string" || !IDENTIFIER.test(imported)) supported = false;
406
848
  else entry.named.push({ imported, local: binding.local.name });
407
849
  }
@@ -414,12 +856,12 @@ function farmPackageClientImportExports(entry) {
414
856
  return [
415
857
  ...entry.defaultLocal ? ["default"] : [],
416
858
  ...entry.named.map((binding) => binding.imported),
417
- ..._nullishCoalesce(_optionalChain([entry, 'access', _11 => _11.namespace, 'optionalAccess', _12 => _12.members]), () => ( []))
859
+ ..._nullishCoalesce(_optionalChain([entry, 'access', _43 => _43.namespace, 'optionalAccess', _44 => _44.members]), () => ( []))
418
860
  ];
419
861
  }
420
862
  function farmPackageClientReferencePath(root, specifier, exportName) {
421
863
  const directory = specifier.replace(/^@/, "").replace(/[^A-Za-z0-9._-]/g, "+");
422
- return path6.default.join(root, ".farm", "client-references", directory, `${exportName}.tsx`);
864
+ return path7.default.join(root, ".farm", "client-references", directory, `${exportName}.tsx`);
423
865
  }
424
866
  function ensureFarmPackageClientReference(root, specifier, exportName) {
425
867
  const file = farmPackageClientReferencePath(root, specifier, exportName);
@@ -431,12 +873,12 @@ function ensureFarmPackageClientReference(root, specifier, exportName) {
431
873
  ].join("\n");
432
874
  let current = null;
433
875
  try {
434
- current = fs4.default.readFileSync(file, "utf8");
435
- } catch (e2) {
876
+ current = fs5.default.readFileSync(file, "utf8");
877
+ } catch (e9) {
436
878
  }
437
879
  if (current !== source) {
438
- fs4.default.mkdirSync(path6.default.dirname(file), { recursive: true });
439
- fs4.default.writeFileSync(file, source);
880
+ fs5.default.mkdirSync(path7.default.dirname(file), { recursive: true });
881
+ fs5.default.writeFileSync(file, source);
440
882
  }
441
883
  return file;
442
884
  }
@@ -463,6 +905,11 @@ function rewriteFarmPackageClientImports(options) {
463
905
  lines.push(`import { ${member} as ${local} } from ${reference(entry.specifier, member)};`);
464
906
  fields.push(`${member}: ${local}`);
465
907
  }
908
+ if (_optionalChain([entry, 'access', _45 => _45.namespace, 'access', _46 => _46.values, 'optionalAccess', _47 => _47.length])) {
909
+ const local = `__farm_package_values_${next++}__`;
910
+ lines.push(`import * as ${local} from ${JSON.stringify(entry.specifier)};`);
911
+ for (const value of entry.namespace.values) fields.push(`${value}: ${local}.${value}`);
912
+ }
466
913
  lines.push(`const ${entry.namespace.local} = Object.freeze({ ${fields.join(", ")} });`);
467
914
  }
468
915
  output = output.slice(0, entry.start) + lines.join("\n") + output.slice(entry.end);
@@ -480,7 +927,7 @@ var _async_hooks = require('async_hooks');
480
927
 
481
928
 
482
929
  var SCHEMA_VERSION = 1;
483
- var NODE_MODULES_SEGMENT = `${path6.default.sep}node_modules${path6.default.sep}`;
930
+ var NODE_MODULES_SEGMENT = `${path7.default.sep}node_modules${path7.default.sep}`;
484
931
  var PackageInspectionTrace = class {
485
932
  constructor() {
486
933
  this.files = /* @__PURE__ */ new Set();
@@ -490,7 +937,7 @@ var PackageInspectionTrace = class {
490
937
  }
491
938
  visit(file) {
492
939
  this.files.add(file);
493
- const directory = path6.default.dirname(file);
940
+ const directory = path7.default.dirname(file);
494
941
  if (!this.directoryStamps.has(directory)) {
495
942
  this.directoryStamps.set(directory, stampPackagePath(directory, "directory"));
496
943
  }
@@ -517,12 +964,12 @@ var PackageInspectionTrace = class {
517
964
  }
518
965
  };
519
966
  function stampPackagePath(target, kind) {
520
- if (!`${target}${path6.default.sep}`.includes(NODE_MODULES_SEGMENT)) return void 0;
967
+ if (!`${target}${path7.default.sep}`.includes(NODE_MODULES_SEGMENT)) return void 0;
521
968
  try {
522
- const stat = fs4.default.statSync(target, { throwIfNoEntry: false });
969
+ const stat = fs5.default.statSync(target, { throwIfNoEntry: false });
523
970
  if (!stat || (kind === "file" ? !stat.isFile() : !stat.isDirectory())) return void 0;
524
971
  return [target, stat.size, stat.mtimeMs, stat.ctimeMs];
525
- } catch (e3) {
972
+ } catch (e10) {
526
973
  return void 0;
527
974
  }
528
975
  }
@@ -558,7 +1005,7 @@ var PackageClientBoundaryCache = class {
558
1005
  else this.dirty = true;
559
1006
  }
560
1007
  }
561
- return _optionalChain([entries, 'optionalAccess', _13 => _13.find, 'call', _14 => _14(
1008
+ return _optionalChain([entries, 'optionalAccess', _48 => _48.find, 'call', _49 => _49(
562
1009
  (entry) => entry.stops.every((file) => visited.has(file)) && !entry.files.some((file) => visited.has(file))
563
1010
  )]);
564
1011
  }
@@ -597,17 +1044,17 @@ var PackageClientBoundaryCache = class {
597
1044
  }
598
1045
  const contents = JSON.stringify({
599
1046
  schema: SCHEMA_VERSION,
600
- farm: _chunkSM25ZC4Scjs.FARM_VERSION,
1047
+ farm: _chunkO2XFIPNLcjs.FARM_VERSION,
601
1048
  paths,
602
1049
  entries
603
1050
  });
604
1051
  const temporary = `${file}.${process.pid}.${Date.now()}.tmp`;
605
1052
  try {
606
- await fs4.default.promises.mkdir(path6.default.dirname(file), { recursive: true });
607
- await fs4.default.promises.writeFile(temporary, contents);
608
- await fs4.default.promises.rename(temporary, file);
609
- } catch (e4) {
610
- await fs4.default.promises.rm(temporary, { force: true }).catch(() => {
1053
+ await fs5.default.promises.mkdir(path7.default.dirname(file), { recursive: true });
1054
+ await fs5.default.promises.writeFile(temporary, contents);
1055
+ await fs5.default.promises.rename(temporary, file);
1056
+ } catch (e11) {
1057
+ await fs5.default.promises.rm(temporary, { force: true }).catch(() => {
611
1058
  });
612
1059
  }
613
1060
  }
@@ -641,11 +1088,11 @@ var PackageClientBoundaryCache = class {
641
1088
  function readStoredCache(file) {
642
1089
  let value;
643
1090
  try {
644
- value = JSON.parse(fs4.default.readFileSync(file, "utf8"));
645
- } catch (e5) {
1091
+ value = JSON.parse(fs5.default.readFileSync(file, "utf8"));
1092
+ } catch (e12) {
646
1093
  return null;
647
1094
  }
648
- if (!isRecord(value) || value.schema !== SCHEMA_VERSION || value.farm !== _chunkSM25ZC4Scjs.FARM_VERSION) {
1095
+ if (!isRecord(value) || value.schema !== SCHEMA_VERSION || value.farm !== _chunkO2XFIPNLcjs.FARM_VERSION) {
649
1096
  return null;
650
1097
  }
651
1098
  const { paths, entries } = value;
@@ -656,13 +1103,13 @@ function readStoredCache(file) {
656
1103
  const usable = variants.filter((entry) => isStoredEntry(entry, paths.length));
657
1104
  if (usable.length > 0) valid[key] = usable;
658
1105
  }
659
- return { schema: SCHEMA_VERSION, farm: _chunkSM25ZC4Scjs.FARM_VERSION, paths, entries: valid };
1106
+ return { schema: SCHEMA_VERSION, farm: _chunkO2XFIPNLcjs.FARM_VERSION, paths, entries: valid };
660
1107
  }
661
1108
  function isRecord(value) {
662
1109
  return typeof value === "object" && value !== null && !Array.isArray(value);
663
1110
  }
664
1111
  function isPathStamp(value) {
665
- return Array.isArray(value) && value.length === 4 && typeof value[0] === "string" && path6.default.isAbsolute(value[0]) && value.slice(1).every((part) => typeof part === "number" && Number.isFinite(part));
1112
+ return Array.isArray(value) && value.length === 4 && typeof value[0] === "string" && path7.default.isAbsolute(value[0]) && value.slice(1).every((part) => typeof part === "number" && Number.isFinite(part));
666
1113
  }
667
1114
  function isPathIndexList(value, pathCount) {
668
1115
  return Array.isArray(value) && value.length > 0 && value.every((index) => Number.isSafeInteger(index) && index >= 0 && index < pathCount);
@@ -670,7 +1117,7 @@ function isPathIndexList(value, pathCount) {
670
1117
  function isStoredEntry(value, pathCount) {
671
1118
  if (!isRecord(value) || !isRecord(value.result)) return false;
672
1119
  const { isClientComponent, shouldHydrate, islandStrategy } = value.result;
673
- return isPathIndexList(value.files, pathCount) && isPathIndexList(value.directories, pathCount) && Array.isArray(value.stops) && value.stops.every((file) => typeof file === "string" && path6.default.isAbsolute(file)) && typeof isClientComponent === "boolean" && typeof shouldHydrate === "boolean" && (islandStrategy === null || _chunk7KJJ4SBScjs.isFarmIslandStrategy.call(void 0, islandStrategy)) && Object.keys(value.result).length === 3;
1120
+ return isPathIndexList(value.files, pathCount) && isPathIndexList(value.directories, pathCount) && Array.isArray(value.stops) && value.stops.every((file) => typeof file === "string" && path7.default.isAbsolute(file)) && typeof isClientComponent === "boolean" && typeof shouldHydrate === "boolean" && (islandStrategy === null || _chunk7KJJ4SBScjs.isFarmIslandStrategy.call(void 0, islandStrategy)) && Object.keys(value.result).length === 3;
674
1121
  }
675
1122
  var STORAGE_KEY = /* @__PURE__ */ Symbol.for("@farm.js/core/package-client-boundary-cache");
676
1123
  function getStorage() {
@@ -687,25 +1134,25 @@ function getPackageClientBoundaryCache() {
687
1134
  return getStorage().getStore();
688
1135
  }
689
1136
  async function withPackageClientBoundaryCache(operation) {
690
- const cache2 = new PackageClientBoundaryCache();
1137
+ const cache3 = new PackageClientBoundaryCache();
691
1138
  try {
692
- return await getStorage().run(cache2, operation);
1139
+ return await getStorage().run(cache3, operation);
693
1140
  } finally {
694
- await cache2.persist();
1141
+ await cache3.persist();
695
1142
  }
696
1143
  }
697
1144
  function usePackageClientBoundaryCacheFile(file) {
698
- _optionalChain([getPackageClientBoundaryCache, 'call', _15 => _15(), 'optionalAccess', _16 => _16.load, 'call', _17 => _17(file)]);
1145
+ _optionalChain([getPackageClientBoundaryCache, 'call', _50 => _50(), 'optionalAccess', _51 => _51.load, 'call', _52 => _52(file)]);
699
1146
  }
700
1147
 
701
1148
  // src/utils/client-component.ts
702
1149
  function readIfExists(filePath) {
703
1150
  try {
704
- if (!filePath || !fs4.default.existsSync(filePath)) {
1151
+ if (!filePath || !fs5.default.existsSync(filePath)) {
705
1152
  return null;
706
1153
  }
707
- return fs4.default.readFileSync(filePath, "utf-8");
708
- } catch (e6) {
1154
+ return fs5.default.readFileSync(filePath, "utf-8");
1155
+ } catch (e13) {
709
1156
  return null;
710
1157
  }
711
1158
  }
@@ -718,26 +1165,26 @@ function resolveModuleSourcePath(modulePath, root) {
718
1165
  if (modulePath.startsWith("file://")) {
719
1166
  try {
720
1167
  candidates.add(_url.fileURLToPath.call(void 0, modulePath));
721
- } catch (e7) {
1168
+ } catch (e14) {
722
1169
  }
723
1170
  }
724
1171
  if (modulePath.startsWith("/@fs/")) {
725
1172
  const fsPath = withoutQuery.slice("/@fs/".length);
726
- candidates.add(path6.default.normalize(/^[A-Za-z]:/.test(fsPath) ? fsPath : `/${fsPath}`));
1173
+ candidates.add(path7.default.normalize(/^[A-Za-z]:/.test(fsPath) ? fsPath : `/${fsPath}`));
727
1174
  }
728
1175
  }
729
1176
  if (root && modulePath) {
730
1177
  const normalized = withoutQuery.replace(/^\/+/, "");
731
- candidates.add(path6.default.join(root, normalized));
732
- candidates.add(path6.default.resolve(root, normalized));
1178
+ candidates.add(path7.default.join(root, normalized));
1179
+ candidates.add(path7.default.resolve(root, normalized));
733
1180
  }
734
- if (_optionalChain([withoutQuery, 'optionalAccess', _18 => _18.startsWith, 'call', _19 => _19("/src/")])) {
1181
+ if (_optionalChain([withoutQuery, 'optionalAccess', _53 => _53.startsWith, 'call', _54 => _54("/src/")])) {
735
1182
  const normalized = withoutQuery.replace(/^\/+/, "");
736
- candidates.add(path6.default.join(process.cwd(), normalized));
737
- candidates.add(path6.default.resolve(process.cwd(), normalized));
1183
+ candidates.add(path7.default.join(process.cwd(), normalized));
1184
+ candidates.add(path7.default.resolve(process.cwd(), normalized));
738
1185
  }
739
1186
  for (const candidate of candidates) {
740
- if (fs4.default.existsSync(candidate)) {
1187
+ if (fs5.default.existsSync(candidate)) {
741
1188
  return candidate;
742
1189
  }
743
1190
  }
@@ -754,8 +1201,8 @@ var FARM_ISOLATED_HYDRATION_MAX_BOUNDARIES = 4;
754
1201
  function isolatedHydrationBoundaryLimit() {
755
1202
  const benchmarkRoot = process.env.FARM_INTERNAL_ISOLATED_HYDRATION_BENCHMARK_ROOT;
756
1203
  const benchmarkLimit = Number(process.env.FARM_INTERNAL_ISOLATED_HYDRATION_BENCHMARK_LIMIT);
757
- const resolvedBenchmarkRoot = benchmarkRoot ? path6.default.resolve(benchmarkRoot) : null;
758
- const isBenchmarkFixture = process.env.FARM_INTERNAL_BENCHMARK === "isolated-hydration" && resolvedBenchmarkRoot !== null && (process.cwd() === resolvedBenchmarkRoot || process.cwd().startsWith(`${resolvedBenchmarkRoot}${path6.default.sep}`));
1204
+ const resolvedBenchmarkRoot = benchmarkRoot ? path7.default.resolve(benchmarkRoot) : null;
1205
+ const isBenchmarkFixture = process.env.FARM_INTERNAL_BENCHMARK === "isolated-hydration" && resolvedBenchmarkRoot !== null && (process.cwd() === resolvedBenchmarkRoot || process.cwd().startsWith(`${resolvedBenchmarkRoot}${path7.default.sep}`));
759
1206
  return isBenchmarkFixture && Number.isSafeInteger(benchmarkLimit) && benchmarkLimit > FARM_ISOLATED_HYDRATION_MAX_BOUNDARIES ? benchmarkLimit : FARM_ISOLATED_HYDRATION_MAX_BOUNDARIES;
760
1207
  }
761
1208
  var RESOLVABLE_SOURCE_EXTENSIONS = [
@@ -810,8 +1257,8 @@ function hasHydrateExport(content) {
810
1257
  for (const match of content.matchAll(/\bexport\s*\{([^}]*)\}/g)) {
811
1258
  for (const specifier of match[1].split(",")) {
812
1259
  const parts = specifier.trim().split(/\s+as\s+/);
813
- const exportedName = _optionalChain([(_nullishCoalesce(parts[1], () => ( parts[0]))), 'optionalAccess', _20 => _20.trim, 'call', _21 => _21()]);
814
- if (exportedName === "hydrate") {
1260
+ const exportedName2 = _optionalChain([(_nullishCoalesce(parts[1], () => ( parts[0]))), 'optionalAccess', _55 => _55.trim, 'call', _56 => _56()]);
1261
+ if (exportedName2 === "hydrate") {
815
1262
  return true;
816
1263
  }
817
1264
  }
@@ -978,7 +1425,7 @@ function isIslandExportStart(tokens, index) {
978
1425
  const token = tokens[index];
979
1426
  const previous = tokens[index - 1];
980
1427
  const startsStatement = !previous || previous.value === ";" || previous.value === "{" || previous.value === "}" || token.line > previous.line;
981
- return startsStatement && token.value === "export" && _optionalChain([tokens, 'access', _22 => _22[index + 1], 'optionalAccess', _23 => _23.value]) === "const" && _optionalChain([tokens, 'access', _24 => _24[index + 2], 'optionalAccess', _25 => _25.value]) === "island";
1428
+ return startsStatement && token.value === "export" && _optionalChain([tokens, 'access', _57 => _57[index + 1], 'optionalAccess', _58 => _58.value]) === "const" && _optionalChain([tokens, 'access', _59 => _59[index + 2], 'optionalAccess', _60 => _60.value]) === "island";
982
1429
  }
983
1430
  function getIslandStrategyExport(content) {
984
1431
  if (!content) return null;
@@ -986,15 +1433,15 @@ function getIslandStrategyExport(content) {
986
1433
  for (let index = 0; index < tokens.length - 2; index++) {
987
1434
  if (!isIslandExportStart(tokens, index)) continue;
988
1435
  let valueIndex = index + 3;
989
- if (_optionalChain([tokens, 'access', _26 => _26[valueIndex], 'optionalAccess', _27 => _27.value]) === ":") {
1436
+ if (_optionalChain([tokens, 'access', _61 => _61[valueIndex], 'optionalAccess', _62 => _62.value]) === ":") {
990
1437
  while (valueIndex < tokens.length && tokens[valueIndex].value !== "=") valueIndex++;
991
1438
  }
992
- if (_optionalChain([tokens, 'access', _28 => _28[valueIndex], 'optionalAccess', _29 => _29.value]) !== "=") break;
1439
+ if (_optionalChain([tokens, 'access', _63 => _63[valueIndex], 'optionalAccess', _64 => _64.value]) !== "=") break;
993
1440
  valueIndex++;
994
1441
  const literal = tokens[valueIndex];
995
1442
  if (!literal || literal.kind !== "string" || !_chunk7KJJ4SBScjs.isFarmIslandStrategy.call(void 0, literal.value)) break;
996
1443
  let trailingIndex = valueIndex + 1;
997
- if (_optionalChain([tokens, 'access', _30 => _30[trailingIndex], 'optionalAccess', _31 => _31.value]) === "as" && _optionalChain([tokens, 'access', _32 => _32[trailingIndex + 1], 'optionalAccess', _33 => _33.value]) === "const") {
1444
+ if (_optionalChain([tokens, 'access', _65 => _65[trailingIndex], 'optionalAccess', _66 => _66.value]) === "as" && _optionalChain([tokens, 'access', _67 => _67[trailingIndex + 1], 'optionalAccess', _68 => _68.value]) === "const") {
998
1445
  trailingIndex += 2;
999
1446
  }
1000
1447
  const trailing = tokens[trailingIndex];
@@ -1020,13 +1467,13 @@ function hasAsyncDefaultExport(content) {
1020
1467
  for (let index = 0; index < tokens.length - 2; index++) {
1021
1468
  const token = tokens[index];
1022
1469
  if (token.kind !== "identifier" || token.value !== "export") continue;
1023
- if (_optionalChain([tokens, 'access', _34 => _34[index - 1], 'optionalAccess', _35 => _35.value]) === ".") continue;
1024
- if (_optionalChain([tokens, 'access', _36 => _36[index + 1], 'optionalAccess', _37 => _37.value]) !== "default") continue;
1470
+ if (_optionalChain([tokens, 'access', _69 => _69[index - 1], 'optionalAccess', _70 => _70.value]) === ".") continue;
1471
+ if (_optionalChain([tokens, 'access', _71 => _71[index + 1], 'optionalAccess', _72 => _72.value]) !== "default") continue;
1025
1472
  const exported = tokens[index + 2];
1026
1473
  if (exported.kind === "identifier" && exported.value === "async") {
1027
1474
  return true;
1028
1475
  }
1029
- if (exported.kind === "identifier" && !["function", "class"].includes(exported.value) && _optionalChain([tokens, 'access', _38 => _38[index + 3], 'optionalAccess', _39 => _39.value]) !== "(" && isAsyncLocalDeclaration(tokens, exported.value)) {
1476
+ if (exported.kind === "identifier" && !["function", "class"].includes(exported.value) && _optionalChain([tokens, 'access', _73 => _73[index + 3], 'optionalAccess', _74 => _74.value]) !== "(" && isAsyncLocalDeclaration(tokens, exported.value)) {
1030
1477
  return true;
1031
1478
  }
1032
1479
  }
@@ -1034,10 +1481,10 @@ function hasAsyncDefaultExport(content) {
1034
1481
  }
1035
1482
  function isAsyncLocalDeclaration(tokens, name) {
1036
1483
  for (let index = 0; index < tokens.length - 2; index++) {
1037
- if (tokens[index].value === "async" && _optionalChain([tokens, 'access', _40 => _40[index + 1], 'optionalAccess', _41 => _41.value]) === "function" && _optionalChain([tokens, 'access', _42 => _42[index + 2], 'optionalAccess', _43 => _43.value]) === name) {
1484
+ if (tokens[index].value === "async" && _optionalChain([tokens, 'access', _75 => _75[index + 1], 'optionalAccess', _76 => _76.value]) === "function" && _optionalChain([tokens, 'access', _77 => _77[index + 2], 'optionalAccess', _78 => _78.value]) === name) {
1038
1485
  return true;
1039
1486
  }
1040
- if (tokens[index].value === name && _optionalChain([tokens, 'access', _44 => _44[index + 1], 'optionalAccess', _45 => _45.value]) === "=" && _optionalChain([tokens, 'access', _46 => _46[index + 2], 'optionalAccess', _47 => _47.value]) === "async") {
1487
+ if (tokens[index].value === name && _optionalChain([tokens, 'access', _79 => _79[index + 1], 'optionalAccess', _80 => _80.value]) === "=" && _optionalChain([tokens, 'access', _81 => _81[index + 2], 'optionalAccess', _82 => _82.value]) === "async") {
1041
1488
  return true;
1042
1489
  }
1043
1490
  }
@@ -1238,7 +1685,7 @@ function planClientModuleHydration(modulePath, root, mode, options) {
1238
1685
  return plan;
1239
1686
  }
1240
1687
  function usesFarmServerTree(plan) {
1241
- return _optionalChain([plan, 'optionalAccess', _48 => _48.asyncOwnerIslands]) === true && plan.isolatedBoundaries.length > 0 && plan.isolatedBoundaries.every((boundary) => boundary.islandStrategy === "load");
1688
+ return _optionalChain([plan, 'optionalAccess', _83 => _83.asyncOwnerIslands]) === true && plan.isolatedBoundaries.length > 0 && plan.isolatedBoundaries.every((boundary) => boundary.islandStrategy === "load");
1242
1689
  }
1243
1690
  function getMarkdownPageHydrationPlan(componentsModulePath, root, mode = "off", options = {}) {
1244
1691
  const plan = {
@@ -1368,7 +1815,7 @@ function getStaticImportBindings(content) {
1368
1815
  if (!content) return bindings;
1369
1816
  const tokens = tokenizeModuleSource(content);
1370
1817
  for (let index = 0; index < tokens.length; index++) {
1371
- if (tokens[index].value !== "import" || _optionalChain([tokens, 'access', _49 => _49[index - 1], 'optionalAccess', _50 => _50.value]) === ".") continue;
1818
+ if (tokens[index].value !== "import" || _optionalChain([tokens, 'access', _84 => _84[index - 1], 'optionalAccess', _85 => _85.value]) === ".") continue;
1372
1819
  const first = tokens[index + 1];
1373
1820
  if (!first || first.value === "type" || first.value === "(" || first.kind === "string") {
1374
1821
  continue;
@@ -1376,7 +1823,7 @@ function getStaticImportBindings(content) {
1376
1823
  let fromIndex = -1;
1377
1824
  for (let cursor = index + 1; cursor < tokens.length; cursor++) {
1378
1825
  if (tokens[cursor].value === ";") break;
1379
- if (tokens[cursor].value === "from" && _optionalChain([tokens, 'access', _51 => _51[cursor + 1], 'optionalAccess', _52 => _52.kind]) === "string") {
1826
+ if (tokens[cursor].value === "from" && _optionalChain([tokens, 'access', _86 => _86[cursor + 1], 'optionalAccess', _87 => _87.kind]) === "string") {
1380
1827
  fromIndex = cursor;
1381
1828
  break;
1382
1829
  }
@@ -1385,13 +1832,13 @@ function getStaticImportBindings(content) {
1385
1832
  const specifier = tokens[fromIndex + 1].value;
1386
1833
  const clause = tokens.slice(index + 1, fromIndex);
1387
1834
  const localNames = [];
1388
- if (_optionalChain([clause, 'access', _53 => _53[0], 'optionalAccess', _54 => _54.kind]) === "identifier" && clause[0].value !== "type") {
1835
+ if (_optionalChain([clause, 'access', _88 => _88[0], 'optionalAccess', _89 => _89.kind]) === "identifier" && clause[0].value !== "type") {
1389
1836
  localNames.push(clause[0].value);
1390
1837
  }
1391
1838
  const namespaceAs = clause.findIndex(
1392
- (token, clauseIndex) => token.value === "*" && _optionalChain([clause, 'access', _55 => _55[clauseIndex + 1], 'optionalAccess', _56 => _56.value]) === "as"
1839
+ (token, clauseIndex) => token.value === "*" && _optionalChain([clause, 'access', _90 => _90[clauseIndex + 1], 'optionalAccess', _91 => _91.value]) === "as"
1393
1840
  );
1394
- if (namespaceAs !== -1 && _optionalChain([clause, 'access', _57 => _57[namespaceAs + 2], 'optionalAccess', _58 => _58.kind]) === "identifier") {
1841
+ if (namespaceAs !== -1 && _optionalChain([clause, 'access', _92 => _92[namespaceAs + 2], 'optionalAccess', _93 => _93.kind]) === "identifier") {
1395
1842
  localNames.push(clause[namespaceAs + 2].value);
1396
1843
  }
1397
1844
  const openingBrace = clause.findIndex((token) => token.value === "{");
@@ -1401,11 +1848,11 @@ function getStaticImportBindings(content) {
1401
1848
  if (openingBrace !== -1 && closingBrace !== -1) {
1402
1849
  let entryStart = openingBrace + 1;
1403
1850
  for (let cursor = entryStart; cursor <= closingBrace; cursor++) {
1404
- if (cursor !== closingBrace && _optionalChain([clause, 'access', _59 => _59[cursor], 'optionalAccess', _60 => _60.value]) !== ",") continue;
1851
+ if (cursor !== closingBrace && _optionalChain([clause, 'access', _94 => _94[cursor], 'optionalAccess', _95 => _95.value]) !== ",") continue;
1405
1852
  const entry = clause.slice(entryStart, cursor).filter((token) => token.value !== "type");
1406
1853
  const asIndex = entry.findIndex((token) => token.value === "as");
1407
1854
  const local = asIndex === -1 ? entry[0] : entry[asIndex + 1];
1408
- if (_optionalChain([local, 'optionalAccess', _61 => _61.kind]) === "identifier") localNames.push(local.value);
1855
+ if (_optionalChain([local, 'optionalAccess', _96 => _96.kind]) === "identifier") localNames.push(local.value);
1409
1856
  entryStart = cursor + 1;
1410
1857
  }
1411
1858
  }
@@ -1442,14 +1889,14 @@ function findParserSensitiveJsxContainer(content, localBindings) {
1442
1889
  const open = [];
1443
1890
  const isSelfClosing = (openingIndex) => {
1444
1891
  for (let index = openingIndex; index < tokens.length; index++) {
1445
- if (tokens[index].value === ">") return _optionalChain([tokens, 'access', _62 => _62[index - 1], 'optionalAccess', _63 => _63.value]) === "/";
1892
+ if (tokens[index].value === ">") return _optionalChain([tokens, 'access', _97 => _97[index - 1], 'optionalAccess', _98 => _98.value]) === "/";
1446
1893
  }
1447
1894
  return false;
1448
1895
  };
1449
1896
  for (let index = 0; index < tokens.length - 1; index++) {
1450
1897
  if (tokens[index].value !== "<") continue;
1451
1898
  if (tokens[index + 1].value === "/") {
1452
- const closing = _optionalChain([tokens, 'access', _64 => _64[index + 2], 'optionalAccess', _65 => _65.value]);
1899
+ const closing = _optionalChain([tokens, 'access', _99 => _99[index + 2], 'optionalAccess', _100 => _100.value]);
1453
1900
  const at = closing ? open.lastIndexOf(closing) : -1;
1454
1901
  if (at !== -1) open.length = at;
1455
1902
  continue;
@@ -1492,7 +1939,7 @@ function findMatchingToken(tokens, openingIndex, opening, closing) {
1492
1939
  }
1493
1940
  function containsClientJsx(tokens, start, end, clientBindings) {
1494
1941
  for (let index = start; index < end; index++) {
1495
- if (tokens[index].value === "<" && clientBindings.has(_optionalChain([tokens, 'access', _66 => _66[index + 1], 'optionalAccess', _67 => _67.value]))) return true;
1942
+ if (tokens[index].value === "<" && clientBindings.has(_optionalChain([tokens, 'access', _101 => _101[index + 1], 'optionalAccess', _102 => _102.value]))) return true;
1496
1943
  }
1497
1944
  return false;
1498
1945
  }
@@ -1530,7 +1977,7 @@ function getClientRenderingHelpers(tokens, clientBindings) {
1530
1977
  let helperName;
1531
1978
  let bodyStart = -1;
1532
1979
  let bodyEnd = -1;
1533
- if (tokens[index].value === "function" && _optionalChain([tokens, 'access', _68 => _68[index + 1], 'optionalAccess', _69 => _69.kind]) === "identifier") {
1980
+ if (tokens[index].value === "function" && _optionalChain([tokens, 'access', _103 => _103[index + 1], 'optionalAccess', _104 => _104.kind]) === "identifier") {
1534
1981
  helperName = tokens[index + 1].value;
1535
1982
  const parametersStart = tokens.findIndex(
1536
1983
  (token, tokenIndex) => tokenIndex > index + 1 && token.value === "("
@@ -1540,21 +1987,21 @@ function getClientRenderingHelpers(tokens, clientBindings) {
1540
1987
  (token, tokenIndex) => tokenIndex > parametersEnd && token.value === "{"
1541
1988
  );
1542
1989
  if (bodyStart !== -1) bodyEnd = findMatchingToken(tokens, bodyStart, "{", "}");
1543
- } else if ((tokens[index].value === "const" || tokens[index].value === "let" || tokens[index].value === "var") && _optionalChain([tokens, 'access', _70 => _70[index + 1], 'optionalAccess', _71 => _71.kind]) === "identifier") {
1990
+ } else if ((tokens[index].value === "const" || tokens[index].value === "let" || tokens[index].value === "var") && _optionalChain([tokens, 'access', _105 => _105[index + 1], 'optionalAccess', _106 => _106.kind]) === "identifier") {
1544
1991
  helperName = tokens[index + 1].value;
1545
1992
  let assignmentIndex = -1;
1546
1993
  let arrowIndex = -1;
1547
1994
  for (let cursor = index + 2; cursor < tokens.length; cursor++) {
1548
1995
  if (tokens[cursor].value === ";") break;
1549
1996
  if (assignmentIndex === -1 && tokens[cursor].value === "=") assignmentIndex = cursor;
1550
- if (tokens[cursor].value === "=" && _optionalChain([tokens, 'access', _72 => _72[cursor + 1], 'optionalAccess', _73 => _73.value]) === ">") {
1997
+ if (tokens[cursor].value === "=" && _optionalChain([tokens, 'access', _107 => _107[cursor + 1], 'optionalAccess', _108 => _108.value]) === ">") {
1551
1998
  arrowIndex = cursor;
1552
1999
  break;
1553
2000
  }
1554
2001
  }
1555
2002
  if (arrowIndex !== -1) {
1556
2003
  bodyStart = arrowIndex + 2;
1557
- bodyEnd = _optionalChain([tokens, 'access', _74 => _74[bodyStart], 'optionalAccess', _75 => _75.value]) === "{" ? findMatchingToken(tokens, bodyStart, "{", "}") : findStatementEnd(tokens, bodyStart);
2004
+ bodyEnd = _optionalChain([tokens, 'access', _109 => _109[bodyStart], 'optionalAccess', _110 => _110.value]) === "{" ? findMatchingToken(tokens, bodyStart, "{", "}") : findStatementEnd(tokens, bodyStart);
1558
2005
  } else if (assignmentIndex !== -1) {
1559
2006
  bodyStart = assignmentIndex + 1;
1560
2007
  bodyEnd = findStatementEnd(tokens, bodyStart);
@@ -1594,14 +2041,14 @@ function passesElementValuedProps(content, localBindings) {
1594
2041
  else if (value === "}") braceDepth--;
1595
2042
  else if (value === "<" && braceDepth > 0) return true;
1596
2043
  else if (value === ">" && braceDepth === 0) {
1597
- selfClosing = _optionalChain([tokens, 'access', _76 => _76[cursor - 1], 'optionalAccess', _77 => _77.value]) === "/";
2044
+ selfClosing = _optionalChain([tokens, 'access', _111 => _111[cursor - 1], 'optionalAccess', _112 => _112.value]) === "/";
1598
2045
  break;
1599
2046
  }
1600
2047
  }
1601
2048
  if (selfClosing || cursor >= tokens.length) continue;
1602
2049
  for (let child = cursor + 1; child < tokens.length; child++) {
1603
2050
  if (tokens[child].value !== "<") continue;
1604
- const closesBoundary = _optionalChain([tokens, 'access', _78 => _78[child + 1], 'optionalAccess', _79 => _79.value]) === "/" && _optionalChain([tokens, 'access', _80 => _80[child + 2], 'optionalAccess', _81 => _81.value]) === name;
2051
+ const closesBoundary = _optionalChain([tokens, 'access', _113 => _113[child + 1], 'optionalAccess', _114 => _114.value]) === "/" && _optionalChain([tokens, 'access', _115 => _115[child + 2], 'optionalAccess', _116 => _116.value]) === name;
1605
2052
  if (!closesBoundary) return true;
1606
2053
  break;
1607
2054
  }
@@ -1623,7 +2070,7 @@ function rendersOnlyLeafElements(content, localBindings) {
1623
2070
  else if (value === "<" && braceDepth > 0) return false;
1624
2071
  else if (value === ">" && braceDepth === 0) break;
1625
2072
  }
1626
- if (cursor >= tokens.length || _optionalChain([tokens, 'access', _82 => _82[cursor - 1], 'optionalAccess', _83 => _83.value]) !== "/") return false;
2073
+ if (cursor >= tokens.length || _optionalChain([tokens, 'access', _117 => _117[cursor - 1], 'optionalAccess', _118 => _118.value]) !== "/") return false;
1627
2074
  }
1628
2075
  return true;
1629
2076
  }
@@ -1635,9 +2082,9 @@ function hasDynamicJsxCardinality(content, localBindings) {
1635
2082
  const containsDynamicRenderer = (start, end) => containsClientJsx(tokens, start, end, clientBindings) || tokens.slice(start, end).some((token) => renderingHelpers.has(token.value));
1636
2083
  for (let index = 0; index < tokens.length; index++) {
1637
2084
  let callStart = -1;
1638
- if (tokens[index].value === "." && (_optionalChain([tokens, 'access', _84 => _84[index + 1], 'optionalAccess', _85 => _85.value]) === "map" || _optionalChain([tokens, 'access', _86 => _86[index + 1], 'optionalAccess', _87 => _87.value]) === "flatMap") && _optionalChain([tokens, 'access', _88 => _88[index + 2], 'optionalAccess', _89 => _89.value]) === "(") {
2085
+ if (tokens[index].value === "." && (_optionalChain([tokens, 'access', _119 => _119[index + 1], 'optionalAccess', _120 => _120.value]) === "map" || _optionalChain([tokens, 'access', _121 => _121[index + 1], 'optionalAccess', _122 => _122.value]) === "flatMap") && _optionalChain([tokens, 'access', _123 => _123[index + 2], 'optionalAccess', _124 => _124.value]) === "(") {
1639
2086
  callStart = index + 2;
1640
- } else if (tokens[index].value === "Array" && _optionalChain([tokens, 'access', _90 => _90[index + 1], 'optionalAccess', _91 => _91.value]) === "." && _optionalChain([tokens, 'access', _92 => _92[index + 2], 'optionalAccess', _93 => _93.value]) === "from" && _optionalChain([tokens, 'access', _94 => _94[index + 3], 'optionalAccess', _95 => _95.value]) === "(") {
2087
+ } else if (tokens[index].value === "Array" && _optionalChain([tokens, 'access', _125 => _125[index + 1], 'optionalAccess', _126 => _126.value]) === "." && _optionalChain([tokens, 'access', _127 => _127[index + 2], 'optionalAccess', _128 => _128.value]) === "from" && _optionalChain([tokens, 'access', _129 => _129[index + 3], 'optionalAccess', _130 => _130.value]) === "(") {
1641
2088
  callStart = index + 3;
1642
2089
  }
1643
2090
  if (callStart !== -1) {
@@ -1646,10 +2093,10 @@ function hasDynamicJsxCardinality(content, localBindings) {
1646
2093
  index = callEnd;
1647
2094
  continue;
1648
2095
  }
1649
- if ((tokens[index].value === "for" || tokens[index].value === "while") && _optionalChain([tokens, 'access', _96 => _96[index + 1], 'optionalAccess', _97 => _97.value]) === "(") {
2096
+ if ((tokens[index].value === "for" || tokens[index].value === "while") && _optionalChain([tokens, 'access', _131 => _131[index + 1], 'optionalAccess', _132 => _132.value]) === "(") {
1650
2097
  const conditionEnd = findMatchingToken(tokens, index + 1, "(", ")");
1651
2098
  const bodyStart = conditionEnd + 1;
1652
- const bodyEnd = _optionalChain([tokens, 'access', _98 => _98[bodyStart], 'optionalAccess', _99 => _99.value]) === "{" ? findMatchingToken(tokens, bodyStart, "{", "}") : tokens.findIndex((token, tokenIndex) => tokenIndex > bodyStart && token.value === ";");
2099
+ const bodyEnd = _optionalChain([tokens, 'access', _133 => _133[bodyStart], 'optionalAccess', _134 => _134.value]) === "{" ? findMatchingToken(tokens, bodyStart, "{", "}") : tokens.findIndex((token, tokenIndex) => tokenIndex > bodyStart && token.value === ";");
1653
2100
  if (containsDynamicRenderer(bodyStart, bodyEnd === -1 ? tokens.length : bodyEnd)) return true;
1654
2101
  }
1655
2102
  }
@@ -1663,7 +2110,7 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
1663
2110
  let fallbackReason;
1664
2111
  let fallbackHint;
1665
2112
  let costGuardExceeded = false;
1666
- const projectRoot = root ? path6.default.resolve(root) : void 0;
2113
+ const projectRoot = root ? path7.default.resolve(root) : void 0;
1667
2114
  const visit = (moduleSourcePath) => {
1668
2115
  if (fallbackReason) return 0;
1669
2116
  const cached = estimates.get(moduleSourcePath);
@@ -1673,7 +2120,7 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
1673
2120
  const content = readIfExists(moduleSourcePath);
1674
2121
  const parsed = parseClientModuleMetadata(content, false);
1675
2122
  if (parsed.isClientComponent) {
1676
- if (projectRoot && !path6.default.resolve(moduleSourcePath).startsWith(`${projectRoot}${path6.default.sep}`)) {
2123
+ if (projectRoot && !path7.default.resolve(moduleSourcePath).startsWith(`${projectRoot}${path7.default.sep}`)) {
1677
2124
  fallbackReason = `client boundary ${moduleSourcePath} is outside the application root`;
1678
2125
  fallbackHint = "Move the component into the application, or publish it as a package (package client components render as static HTML)";
1679
2126
  return 0;
@@ -1706,29 +2153,39 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
1706
2153
  if (imported.local) {
1707
2154
  importedBoundaryCount = visit(importedPath);
1708
2155
  } else {
1709
- const packageMetadata = inspectPackageClientBoundary(importedPath, root, /* @__PURE__ */ new Set());
1710
- if (!packageMetadata.shouldHydrate) continue;
1711
- const references = options.packageReferences && projectRoot ? findFarmPackageClientImports(
1712
- _nullishCoalesce(content, () => ( "")),
1713
- moduleSourcePath,
1714
- (candidate) => candidate === specifier
1715
- ) : [];
1716
- if (references.length > 0) {
2156
+ const reactServerClientNames = options.packageReferences && projectRoot ? findFarmReactServerClientNames(_nullishCoalesce(content, () => ( "")), moduleSourcePath, specifier) : null;
2157
+ if (reactServerClientNames) {
1717
2158
  importedBoundaryCount = 0;
1718
- for (const reference of references) {
1719
- for (const exportName of farmPackageClientImportExports(reference)) {
1720
- importedBoundaryCount += visit(
1721
- ensureFarmPackageClientReference(projectRoot, specifier, exportName)
1722
- );
1723
- }
2159
+ for (const exportName of reactServerClientNames) {
2160
+ importedBoundaryCount += visit(
2161
+ ensureFarmPackageClientReference(projectRoot, specifier, exportName)
2162
+ );
1724
2163
  }
1725
- } else if (options.staticPackageBoundaries || options.staticPackageLeaves && rendersOnlyLeafElements(content, _nullishCoalesce(importedBindings.get(specifier), () => ( [])))) {
1726
- staticPackages.add(specifier);
1727
- continue;
1728
2164
  } else {
1729
- fallbackReason = `package client boundary ${specifier} cannot yet be isolated`;
1730
- fallbackHint = `Render it from a local "use client" module (a providers.tsx that renders the ${specifier} component)`;
1731
- return 0;
2165
+ const packageMetadata = inspectPackageClientBoundary(importedPath, root, /* @__PURE__ */ new Set());
2166
+ if (!packageMetadata.shouldHydrate) continue;
2167
+ const references = options.packageReferences && projectRoot ? findFarmPackageClientImports(
2168
+ _nullishCoalesce(content, () => ( "")),
2169
+ moduleSourcePath,
2170
+ (candidate) => candidate === specifier
2171
+ ) : [];
2172
+ if (references.length > 0) {
2173
+ importedBoundaryCount = 0;
2174
+ for (const reference of references) {
2175
+ for (const exportName of farmPackageClientImportExports(reference)) {
2176
+ importedBoundaryCount += visit(
2177
+ ensureFarmPackageClientReference(projectRoot, specifier, exportName)
2178
+ );
2179
+ }
2180
+ }
2181
+ } else if (options.staticPackageBoundaries || options.staticPackageLeaves && rendersOnlyLeafElements(content, _nullishCoalesce(importedBindings.get(specifier), () => ( [])))) {
2182
+ staticPackages.add(specifier);
2183
+ continue;
2184
+ } else {
2185
+ fallbackReason = `package client boundary ${specifier} cannot yet be isolated`;
2186
+ fallbackHint = `Render it from a local "use client" module (a providers.tsx that renders the ${specifier} component)`;
2187
+ return 0;
2188
+ }
1732
2189
  }
1733
2190
  }
1734
2191
  if (fallbackReason || importedBoundaryCount === 0) continue;
@@ -1821,24 +2278,24 @@ function inspectClientModuleMetadata(resolvedPath, root, visited, inspectIslandE
1821
2278
  };
1822
2279
  }
1823
2280
  function inspectPackageClientBoundary(resolvedPath, root, visited) {
1824
- const cache2 = getPackageClientBoundaryCache();
1825
- if (!cache2 || !resolvedPath || visited.has(resolvedPath)) {
2281
+ const cache3 = getPackageClientBoundaryCache();
2282
+ if (!cache3 || !resolvedPath || visited.has(resolvedPath)) {
1826
2283
  return traversePackageClientBoundary(resolvedPath, root, visited);
1827
2284
  }
1828
2285
  const key = `${_nullishCoalesce(root, () => ( ""))}\0${resolvedPath}`;
1829
- const cached = cache2.find(key, visited);
2286
+ const cached = cache3.find(key, visited);
1830
2287
  if (cached) {
1831
2288
  for (const file of cached.files) visited.add(file);
1832
2289
  return { ...cached.result };
1833
2290
  }
1834
2291
  const trace = new PackageInspectionTrace();
1835
2292
  const result = traversePackageClientBoundary(resolvedPath, root, visited, trace);
1836
- cache2.add(key, trace.toEntry(result));
2293
+ cache3.add(key, trace.toEntry(result));
1837
2294
  return result;
1838
2295
  }
1839
2296
  function traversePackageClientBoundary(resolvedPath, root, visited, trace) {
1840
2297
  if (!resolvedPath || visited.has(resolvedPath)) {
1841
- if (resolvedPath) _optionalChain([trace, 'optionalAccess', _100 => _100.stop, 'call', _101 => _101(resolvedPath)]);
2298
+ if (resolvedPath) _optionalChain([trace, 'optionalAccess', _135 => _135.stop, 'call', _136 => _136(resolvedPath)]);
1842
2299
  return {
1843
2300
  isClientComponent: false,
1844
2301
  shouldHydrate: false,
@@ -1846,7 +2303,7 @@ function traversePackageClientBoundary(resolvedPath, root, visited, trace) {
1846
2303
  };
1847
2304
  }
1848
2305
  visited.add(resolvedPath);
1849
- _optionalChain([trace, 'optionalAccess', _102 => _102.visit, 'call', _103 => _103(resolvedPath)]);
2306
+ _optionalChain([trace, 'optionalAccess', _137 => _137.visit, 'call', _138 => _138(resolvedPath)]);
1850
2307
  const content = readIfExists(resolvedPath);
1851
2308
  const parsed = parseClientModuleMetadata(content, false);
1852
2309
  let importsClientBoundary = false;
@@ -1890,7 +2347,7 @@ function getImportSpecifiers(content) {
1890
2347
  continue;
1891
2348
  }
1892
2349
  const previous = tokens[index - 1];
1893
- if (_optionalChain([previous, 'optionalAccess', _104 => _104.value]) === ".") continue;
2350
+ if (_optionalChain([previous, 'optionalAccess', _139 => _139.value]) === ".") continue;
1894
2351
  const first = tokens[index + 1];
1895
2352
  if (!first || first.value === "type" || first.value === "(" || first.value === ".") {
1896
2353
  continue;
@@ -1906,7 +2363,7 @@ function getImportSpecifiers(content) {
1906
2363
  for (let cursor = index + 1; cursor < tokens.length; cursor++) {
1907
2364
  const token = tokens[cursor];
1908
2365
  if (token.value === ";") break;
1909
- if (token.value === "from" && _optionalChain([tokens, 'access', _105 => _105[cursor + 1], 'optionalAccess', _106 => _106.kind]) === "string") {
2366
+ if (token.value === "from" && _optionalChain([tokens, 'access', _140 => _140[cursor + 1], 'optionalAccess', _141 => _141.kind]) === "string") {
1910
2367
  fromIndex = cursor;
1911
2368
  break;
1912
2369
  }
@@ -1924,14 +2381,14 @@ function getImportSpecifiers(content) {
1924
2381
  return Array.from(matches);
1925
2382
  }
1926
2383
  function isTypeOnlyNamedClause(tokens, startIndex, endIndex) {
1927
- if (_optionalChain([tokens, 'access', _107 => _107[startIndex], 'optionalAccess', _108 => _108.value]) !== "{") return false;
2384
+ if (_optionalChain([tokens, 'access', _142 => _142[startIndex], 'optionalAccess', _143 => _143.value]) !== "{") return false;
1928
2385
  const closingBraceIndex = tokens.findIndex(
1929
2386
  (token, index) => index > startIndex && index < endIndex && token.value === "}"
1930
2387
  );
1931
2388
  if (closingBraceIndex === -1) return false;
1932
2389
  let entryStartsAt = startIndex + 1;
1933
2390
  for (let index = entryStartsAt; index <= closingBraceIndex; index++) {
1934
- if (index !== closingBraceIndex && _optionalChain([tokens, 'access', _109 => _109[index], 'optionalAccess', _110 => _110.value]) !== ",") continue;
2391
+ if (index !== closingBraceIndex && _optionalChain([tokens, 'access', _144 => _144[index], 'optionalAccess', _145 => _145.value]) !== ",") continue;
1935
2392
  const entry = tokens.slice(entryStartsAt, index);
1936
2393
  if (entry.length > 0 && entry[0].value !== "type") return false;
1937
2394
  entryStartsAt = index + 1;
@@ -1953,7 +2410,7 @@ var ALIAS_IMPORT = /^(?:@\/|~\/|#)/;
1953
2410
  function warnUnresolvedAliasImport(importerPath, specifier, root) {
1954
2411
  if (!ALIAS_IMPORT.test(specifier) || warnedUnresolvedAliasImports.has(specifier)) return;
1955
2412
  warnedUnresolvedAliasImports.add(specifier);
1956
- const importer = root ? path6.default.relative(root, importerPath) : importerPath;
2413
+ const importer = root ? path7.default.relative(root, importerPath) : importerPath;
1957
2414
  _chunkQMNWKQL4cjs.logger.warn(
1958
2415
  `Could not resolve "${specifier}" (imported by ${importer}) while checking which pages need client JavaScript. If it holds client components, they will not hydrate. Map the alias in tsconfig.json "paths" or package.json "imports".`
1959
2416
  );
@@ -1962,7 +2419,7 @@ var projectImportAliasCache = /* @__PURE__ */ new Map();
1962
2419
  var PROJECT_ALIAS_FILES = ["tsconfig.json", "jsconfig.json", "package.json"];
1963
2420
  function resolveProjectAliasSourcePath(specifier, root) {
1964
2421
  if (!root) return void 0;
1965
- const projectRoot = path6.default.resolve(root);
2422
+ const projectRoot = path7.default.resolve(root);
1966
2423
  let match;
1967
2424
  for (const alias of getProjectImportAliases(projectRoot)) {
1968
2425
  const captured = matchProjectImportAlias(alias, specifier);
@@ -1972,7 +2429,7 @@ function resolveProjectAliasSourcePath(specifier, root) {
1972
2429
  if (!match) return void 0;
1973
2430
  const resolved = resolveSourceCandidate(
1974
2431
  match.alias.targets.map(
1975
- (target) => path6.default.normalize(match.alias.wildcard ? target.replace("*", match.captured) : target)
2432
+ (target) => path7.default.normalize(match.alias.wildcard ? target.replace("*", match.captured) : target)
1976
2433
  )
1977
2434
  );
1978
2435
  return resolved && /\.d\.[cm]?ts$/.test(resolved) ? null : resolved;
@@ -1987,15 +2444,15 @@ function matchProjectImportAlias(alias, specifier) {
1987
2444
  function getProjectImportAliases(projectRoot) {
1988
2445
  const stamp = PROJECT_ALIAS_FILES.map((file) => {
1989
2446
  try {
1990
- return String(fs4.default.statSync(path6.default.join(projectRoot, file)).mtimeMs);
1991
- } catch (e8) {
2447
+ return String(fs5.default.statSync(path7.default.join(projectRoot, file)).mtimeMs);
2448
+ } catch (e15) {
1992
2449
  return "-";
1993
2450
  }
1994
2451
  }).join(":");
1995
2452
  const sourceDir = _chunkBPNOYILCcjs.getFarmProjectSourceDir.call(void 0, projectRoot);
1996
2453
  const cacheStamp = `${stamp}:${sourceDir}`;
1997
2454
  const cached = projectImportAliasCache.get(projectRoot);
1998
- if (_optionalChain([cached, 'optionalAccess', _111 => _111.stamp]) === cacheStamp) return cached.aliases;
2455
+ if (_optionalChain([cached, 'optionalAccess', _146 => _146.stamp]) === cacheStamp) return cached.aliases;
1999
2456
  const aliases = [
2000
2457
  ...readTsconfigPathAliases(projectRoot),
2001
2458
  ...readPackageImportAliases(projectRoot)
@@ -2005,7 +2462,7 @@ function getProjectImportAliases(projectRoot) {
2005
2462
  prefix: "@/",
2006
2463
  suffix: "",
2007
2464
  wildcard: true,
2008
- targets: [path6.default.join(projectRoot, sourceDir, "*")]
2465
+ targets: [path7.default.join(projectRoot, sourceDir, "*")]
2009
2466
  });
2010
2467
  }
2011
2468
  projectImportAliasCache.set(projectRoot, { stamp: cacheStamp, aliases });
@@ -2013,10 +2470,10 @@ function getProjectImportAliases(projectRoot) {
2013
2470
  }
2014
2471
  function readTsconfigPathAliases(projectRoot) {
2015
2472
  for (const name of ["tsconfig.json", "jsconfig.json"]) {
2016
- const configPath = path6.default.join(projectRoot, name);
2017
- if (!fs4.default.existsSync(configPath)) continue;
2473
+ const configPath = path7.default.join(projectRoot, name);
2474
+ if (!fs5.default.existsSync(configPath)) continue;
2018
2475
  const resolved = readTsconfigPaths(configPath, /* @__PURE__ */ new Set());
2019
- if (!_optionalChain([resolved, 'optionalAccess', _112 => _112.paths])) return [];
2476
+ if (!_optionalChain([resolved, 'optionalAccess', _147 => _147.paths])) return [];
2020
2477
  const base = _nullishCoalesce(resolved.baseUrl, () => ( resolved.pathsDirectory));
2021
2478
  return Object.entries(resolved.paths).flatMap(([pattern, targets]) => {
2022
2479
  if (!Array.isArray(targets)) return [];
@@ -2026,7 +2483,7 @@ function readTsconfigPathAliases(projectRoot) {
2026
2483
  prefix: wildcardIndex === -1 ? pattern : pattern.slice(0, wildcardIndex),
2027
2484
  suffix: wildcardIndex === -1 ? "" : pattern.slice(wildcardIndex + 1),
2028
2485
  wildcard: wildcardIndex !== -1,
2029
- targets: targets.filter((target) => typeof target === "string").map((target) => path6.default.resolve(base, target))
2486
+ targets: targets.filter((target) => typeof target === "string").map((target) => path7.default.resolve(base, target))
2030
2487
  }
2031
2488
  ];
2032
2489
  });
@@ -2038,38 +2495,38 @@ function readTsconfigPaths(configPath, visited) {
2038
2495
  visited.add(configPath);
2039
2496
  const config = readJsonWithComments(configPath);
2040
2497
  if (!config) return null;
2041
- const directory = path6.default.dirname(configPath);
2498
+ const directory = path7.default.dirname(configPath);
2042
2499
  const parents = (Array.isArray(config.extends) ? config.extends : [config.extends]).filter(
2043
2500
  (parent) => typeof parent === "string" && parent.startsWith(".")
2044
2501
  );
2045
2502
  let inherited = null;
2046
2503
  for (const parent of parents) {
2047
- const parentPath = path6.default.resolve(
2504
+ const parentPath = path7.default.resolve(
2048
2505
  directory,
2049
2506
  parent.endsWith(".json") ? parent : `${parent}.json`
2050
2507
  );
2051
2508
  inherited = _nullishCoalesce(readTsconfigPaths(parentPath, visited), () => ( inherited));
2052
2509
  }
2053
2510
  const options = _nullishCoalesce(config.compilerOptions, () => ( {}));
2054
- const baseUrl = typeof options.baseUrl === "string" ? path6.default.resolve(directory, options.baseUrl) : _optionalChain([inherited, 'optionalAccess', _113 => _113.baseUrl]);
2511
+ const baseUrl = typeof options.baseUrl === "string" ? path7.default.resolve(directory, options.baseUrl) : _optionalChain([inherited, 'optionalAccess', _148 => _148.baseUrl]);
2055
2512
  if (options.paths && typeof options.paths === "object") {
2056
2513
  return { paths: options.paths, pathsDirectory: directory, baseUrl };
2057
2514
  }
2058
2515
  return inherited ? { ...inherited, baseUrl } : { pathsDirectory: directory, baseUrl };
2059
2516
  }
2060
2517
  function readPackageImportAliases(projectRoot) {
2061
- const imports = _optionalChain([readPackageJson, 'call', _114 => _114(path6.default.join(projectRoot, "package.json")), 'optionalAccess', _115 => _115.imports]);
2518
+ const imports = _optionalChain([readPackageJson, 'call', _149 => _149(path7.default.join(projectRoot, "package.json")), 'optionalAccess', _150 => _150.imports]);
2062
2519
  if (!imports || typeof imports !== "object") return [];
2063
2520
  return Object.entries(imports).flatMap(([pattern, value]) => {
2064
2521
  const target = resolveConditionalExportTarget(value);
2065
- if (!pattern.startsWith("#") || !_optionalChain([target, 'optionalAccess', _116 => _116.startsWith, 'call', _117 => _117("./")])) return [];
2522
+ if (!pattern.startsWith("#") || !_optionalChain([target, 'optionalAccess', _151 => _151.startsWith, 'call', _152 => _152("./")])) return [];
2066
2523
  const wildcardIndex = pattern.indexOf("*");
2067
2524
  return [
2068
2525
  {
2069
2526
  prefix: wildcardIndex === -1 ? pattern : pattern.slice(0, wildcardIndex),
2070
2527
  suffix: wildcardIndex === -1 ? "" : pattern.slice(wildcardIndex + 1),
2071
2528
  wildcard: wildcardIndex !== -1,
2072
- targets: [path6.default.resolve(projectRoot, target)]
2529
+ targets: [path7.default.resolve(projectRoot, target)]
2073
2530
  }
2074
2531
  ];
2075
2532
  });
@@ -2077,8 +2534,8 @@ function readPackageImportAliases(projectRoot) {
2077
2534
  function readJsonWithComments(filePath) {
2078
2535
  let source;
2079
2536
  try {
2080
- source = fs4.default.readFileSync(filePath, "utf8");
2081
- } catch (e9) {
2537
+ source = fs5.default.readFileSync(filePath, "utf8");
2538
+ } catch (e16) {
2082
2539
  return null;
2083
2540
  }
2084
2541
  let output = "";
@@ -2106,7 +2563,7 @@ function readJsonWithComments(filePath) {
2106
2563
  }
2107
2564
  try {
2108
2565
  return JSON.parse(output.replace(/,(\s*[}\]])/g, "$1"));
2109
- } catch (e10) {
2566
+ } catch (e17) {
2110
2567
  return null;
2111
2568
  }
2112
2569
  }
@@ -2115,7 +2572,7 @@ function resolveImportedModuleSourcePath(importerPath, specifier, root) {
2115
2572
  return resolvePackageModuleSourcePath(importerPath, specifier, root);
2116
2573
  }
2117
2574
  const candidates = /* @__PURE__ */ new Set();
2118
- const basePath = specifier.startsWith(".") ? path6.default.resolve(path6.default.dirname(importerPath), specifier) : root ? path6.default.resolve(root, specifier.replace(/^\/+/, "")) : path6.default.resolve(specifier);
2575
+ const basePath = specifier.startsWith(".") ? path7.default.resolve(path7.default.dirname(importerPath), specifier) : root ? path7.default.resolve(root, specifier.replace(/^\/+/, "")) : path7.default.resolve(specifier);
2119
2576
  candidates.add(basePath);
2120
2577
  return resolveSourceCandidate(candidates);
2121
2578
  }
@@ -2123,47 +2580,47 @@ function resolvePackageModuleSourcePath(importerPath, specifier, root) {
2123
2580
  const packageParts = specifier.split("/");
2124
2581
  const packageName = specifier.startsWith("@") ? packageParts.slice(0, 2).join("/") : packageParts[0];
2125
2582
  const packageSubpath = packageParts.slice(packageName.startsWith("@") ? 2 : 1).join("/");
2126
- const packageDirectory = findPackageDirectory(importerPath, packageName, root);
2583
+ const packageDirectory = findPackageDirectory2(importerPath, packageName, root);
2127
2584
  if (!packageDirectory) return null;
2128
- const packageJsonPath = path6.default.join(packageDirectory, "package.json");
2585
+ const packageJsonPath = path7.default.join(packageDirectory, "package.json");
2129
2586
  const packageJson = readPackageJson(packageJsonPath);
2130
2587
  const exportKey = packageSubpath ? `./${packageSubpath}` : ".";
2131
- const exportTarget = resolvePackageExport(_optionalChain([packageJson, 'optionalAccess', _118 => _118.exports]), exportKey);
2588
+ const exportTarget = resolvePackageExport(_optionalChain([packageJson, 'optionalAccess', _153 => _153.exports]), exportKey);
2132
2589
  const candidates = /* @__PURE__ */ new Set();
2133
- if (_optionalChain([exportTarget, 'optionalAccess', _119 => _119.startsWith, 'call', _120 => _120("./")])) {
2134
- candidates.add(path6.default.resolve(packageDirectory, exportTarget));
2590
+ if (_optionalChain([exportTarget, 'optionalAccess', _154 => _154.startsWith, 'call', _155 => _155("./")])) {
2591
+ candidates.add(path7.default.resolve(packageDirectory, exportTarget));
2135
2592
  }
2136
2593
  if (packageSubpath) {
2137
- candidates.add(path6.default.join(packageDirectory, packageSubpath));
2594
+ candidates.add(path7.default.join(packageDirectory, packageSubpath));
2138
2595
  } else {
2139
- for (const entry of [_optionalChain([packageJson, 'optionalAccess', _121 => _121.browser]), _optionalChain([packageJson, 'optionalAccess', _122 => _122.module]), _optionalChain([packageJson, 'optionalAccess', _123 => _123.main])]) {
2140
- if (typeof entry === "string") candidates.add(path6.default.resolve(packageDirectory, entry));
2596
+ for (const entry of [_optionalChain([packageJson, 'optionalAccess', _156 => _156.browser]), _optionalChain([packageJson, 'optionalAccess', _157 => _157.module]), _optionalChain([packageJson, 'optionalAccess', _158 => _158.main])]) {
2597
+ if (typeof entry === "string") candidates.add(path7.default.resolve(packageDirectory, entry));
2141
2598
  }
2142
- candidates.add(path6.default.join(packageDirectory, "index"));
2599
+ candidates.add(path7.default.join(packageDirectory, "index"));
2143
2600
  }
2144
2601
  return resolveSourceCandidate(candidates);
2145
2602
  }
2146
- function findPackageDirectory(importerPath, packageName, root) {
2603
+ function findPackageDirectory2(importerPath, packageName, root) {
2147
2604
  const searchRoots = /* @__PURE__ */ new Set();
2148
- let current = path6.default.dirname(importerPath);
2605
+ let current = path7.default.dirname(importerPath);
2149
2606
  while (true) {
2150
2607
  searchRoots.add(current);
2151
- const parent = path6.default.dirname(current);
2608
+ const parent = path7.default.dirname(current);
2152
2609
  if (parent === current) break;
2153
2610
  current = parent;
2154
2611
  }
2155
2612
  if (root) {
2156
- current = path6.default.resolve(root);
2613
+ current = path7.default.resolve(root);
2157
2614
  while (true) {
2158
2615
  searchRoots.add(current);
2159
- const parent = path6.default.dirname(current);
2616
+ const parent = path7.default.dirname(current);
2160
2617
  if (parent === current) break;
2161
2618
  current = parent;
2162
2619
  }
2163
2620
  }
2164
2621
  for (const searchRoot of searchRoots) {
2165
- const packageDirectory = path6.default.join(searchRoot, "node_modules", packageName);
2166
- if (fs4.default.existsSync(path6.default.join(packageDirectory, "package.json"))) {
2622
+ const packageDirectory = path7.default.join(searchRoot, "node_modules", packageName);
2623
+ if (fs5.default.existsSync(path7.default.join(packageDirectory, "package.json"))) {
2167
2624
  return packageDirectory;
2168
2625
  }
2169
2626
  }
@@ -2171,8 +2628,8 @@ function findPackageDirectory(importerPath, packageName, root) {
2171
2628
  }
2172
2629
  function readPackageJson(packageJsonPath) {
2173
2630
  try {
2174
- return JSON.parse(fs4.default.readFileSync(packageJsonPath, "utf8"));
2175
- } catch (e11) {
2631
+ return JSON.parse(fs5.default.readFileSync(packageJsonPath, "utf8"));
2632
+ } catch (e18) {
2176
2633
  return null;
2177
2634
  }
2178
2635
  }
@@ -2201,7 +2658,7 @@ function resolvePackageExport(exportsField, exportKey) {
2201
2658
  if (!exportKey.startsWith(prefix) || !exportKey.endsWith(suffix)) continue;
2202
2659
  const wildcard = exportKey.slice(prefix.length, exportKey.length - suffix.length);
2203
2660
  const target = resolveConditionalExportTarget(value);
2204
- return _nullishCoalesce(_optionalChain([target, 'optionalAccess', _124 => _124.replace, 'call', _125 => _125("*", wildcard)]), () => ( null));
2661
+ return _nullishCoalesce(_optionalChain([target, 'optionalAccess', _159 => _159.replace, 'call', _160 => _160("*", wildcard)]), () => ( null));
2205
2662
  }
2206
2663
  return null;
2207
2664
  }
@@ -2229,12 +2686,12 @@ function resolveSourceCandidate(candidates) {
2229
2686
  for (const candidate of candidates) {
2230
2687
  const paths = [candidate];
2231
2688
  for (const extension of RESOLVABLE_SOURCE_EXTENSIONS) {
2232
- paths.push(`${candidate}${extension}`, path6.default.join(candidate, `index${extension}`));
2689
+ paths.push(`${candidate}${extension}`, path7.default.join(candidate, `index${extension}`));
2233
2690
  }
2234
2691
  for (const sourcePath of paths) {
2235
2692
  try {
2236
- if (fs4.default.statSync(sourcePath).isFile()) return sourcePath;
2237
- } catch (e12) {
2693
+ if (fs5.default.statSync(sourcePath).isFile()) return sourcePath;
2694
+ } catch (e19) {
2238
2695
  }
2239
2696
  }
2240
2697
  }
@@ -2261,13 +2718,13 @@ function collectFarmClientPackageImports(directory, root) {
2261
2718
  const walk2 = (current) => {
2262
2719
  let entries;
2263
2720
  try {
2264
- entries = fs4.default.readdirSync(current, { withFileTypes: true });
2265
- } catch (e13) {
2721
+ entries = fs5.default.readdirSync(current, { withFileTypes: true });
2722
+ } catch (e20) {
2266
2723
  return;
2267
2724
  }
2268
2725
  for (const entry of entries) {
2269
2726
  if (entry.name.startsWith(".") && entry.isDirectory()) continue;
2270
- const file = path6.default.join(current, entry.name);
2727
+ const file = path7.default.join(current, entry.name);
2271
2728
  if (entry.isDirectory()) {
2272
2729
  if (!CLIENT_PACKAGE_SCAN_SKIP.has(entry.name)) walk2(file);
2273
2730
  continue;
@@ -2287,6 +2744,69 @@ function collectFarmClientPackageImports(directory, root) {
2287
2744
  walk2(directory);
2288
2745
  return [...found].sort();
2289
2746
  }
2747
+ var clientReachableModules = /* @__PURE__ */ new Map();
2748
+ function invalidateFarmClientReachableModules() {
2749
+ clientReachableModules.clear();
2750
+ }
2751
+ function getFarmClientReachableModules(directory, root) {
2752
+ const key = `${path7.default.resolve(root)}\0${path7.default.resolve(directory)}`;
2753
+ const cached = clientReachableModules.get(key);
2754
+ if (cached) return cached;
2755
+ const reachable = /* @__PURE__ */ new Set();
2756
+ const queue = [];
2757
+ const walk2 = (current) => {
2758
+ let entries;
2759
+ try {
2760
+ entries = fs5.default.readdirSync(current, { withFileTypes: true });
2761
+ } catch (e21) {
2762
+ return;
2763
+ }
2764
+ for (const entry of entries) {
2765
+ const file = path7.default.join(current, entry.name);
2766
+ if (entry.isDirectory()) {
2767
+ if (!entry.name.startsWith(".") && !CLIENT_PACKAGE_SCAN_SKIP.has(entry.name)) walk2(file);
2768
+ } else if (CLIENT_PACKAGE_SCAN_EXTENSIONS.test(entry.name) && !entry.name.endsWith(".d.ts") && hasUseClientDirective(readIfExists(file))) {
2769
+ queue.push(file);
2770
+ }
2771
+ }
2772
+ };
2773
+ walk2(directory);
2774
+ while (queue.length > 0) {
2775
+ const file = path7.default.resolve(queue.pop());
2776
+ if (reachable.has(file)) continue;
2777
+ reachable.add(file);
2778
+ for (const specifier of getImportSpecifiers(readIfExists(file))) {
2779
+ const imported = resolveImportedModule(file, specifier, root);
2780
+ if (imported.local && imported.path && !reachable.has(path7.default.resolve(imported.path))) {
2781
+ queue.push(imported.path);
2782
+ }
2783
+ }
2784
+ }
2785
+ clientReachableModules.set(key, reachable);
2786
+ return reachable;
2787
+ }
2788
+ function resolveFarmClientOptimizeDeps(directory, root) {
2789
+ const importer = path7.default.join(path7.default.resolve(root), "package.json");
2790
+ const include = /* @__PURE__ */ new Set();
2791
+ const exclude = /* @__PURE__ */ new Set();
2792
+ for (const specifier of collectFarmClientPackageImports(directory, root)) {
2793
+ const manifest = findFarmPackageManifest(importer, specifier);
2794
+ if (manifest && farmReactServerBuildReachesClientModules(importer, manifest.name)) {
2795
+ exclude.add(manifest.name);
2796
+ for (const dependency of manifest.dependencies) {
2797
+ include.add(`${manifest.name} > ${dependency}`);
2798
+ }
2799
+ } else {
2800
+ include.add(specifier);
2801
+ }
2802
+ }
2803
+ for (const name of exclude) {
2804
+ for (const entry of include) {
2805
+ if (entry === name || entry.startsWith(`${name}/`)) include.delete(entry);
2806
+ }
2807
+ }
2808
+ return { include: [...include].sort(), exclude: [...exclude].sort() };
2809
+ }
2290
2810
 
2291
2811
  // src/routing/route-manager.ts
2292
2812
 
@@ -2336,13 +2856,13 @@ async function inspectStaticMetadataImage(filePath) {
2336
2856
  };
2337
2857
  }
2338
2858
  function getStaticMetadataImageAltPath(filePath) {
2339
- return path6.default.join(
2340
- path6.default.dirname(filePath),
2341
- `${path6.default.basename(filePath, path6.default.extname(filePath))}.alt.txt`
2859
+ return path7.default.join(
2860
+ path7.default.dirname(filePath),
2861
+ `${path7.default.basename(filePath, path7.default.extname(filePath))}.alt.txt`
2342
2862
  );
2343
2863
  }
2344
2864
  function getStaticMetadataImageExtension(filePath) {
2345
- const extension = path6.default.extname(filePath).slice(1).toLowerCase();
2865
+ const extension = path7.default.extname(filePath).slice(1).toLowerCase();
2346
2866
  return STATIC_METADATA_IMAGE_EXTENSIONS.includes(extension) ? extension : null;
2347
2867
  }
2348
2868
  async function readAltText(filePath) {
@@ -2440,8 +2960,8 @@ var RouteManager = class {
2440
2960
  )
2441
2961
  );
2442
2962
  this.orderedLayouts = Array.from(this.layouts.values()).sort(
2443
- (left, right) => _chunkO27PLNQZcjs.getRouteDirectoryDepth.call(void 0, left.pattern) - _chunkO27PLNQZcjs.getRouteDirectoryDepth.call(void 0, right.pattern)
2444
- ).map((entry) => ({ entry, groupScope: _chunkO27PLNQZcjs.getRouteGroupScope.call(void 0, entry.pattern) }));
2963
+ (left, right) => _chunkUJ3R2AH2cjs.getRouteDirectoryDepth.call(void 0, left.pattern) - _chunkUJ3R2AH2cjs.getRouteDirectoryDepth.call(void 0, right.pattern)
2964
+ ).map((entry) => ({ entry, groupScope: _chunkUJ3R2AH2cjs.getRouteGroupScope.call(void 0, entry.pattern) }));
2445
2965
  for (const slot of this.routeSlots.values()) {
2446
2966
  if (!this.routeSlotOwnerSegments.has(slot.ownerPattern)) {
2447
2967
  this.routeSlotOwnerSegments.set(
@@ -2552,7 +3072,7 @@ var RouteManager = class {
2552
3072
  matchRedirect(pathname, search = "") {
2553
3073
  const i18n = this.getI18nConfig();
2554
3074
  const localeMatch = i18n ? _chunkOWQV6MLMcjs.resolveFarmLocalePath.call(void 0, pathname, i18n) : void 0;
2555
- const routePathname = _optionalChain([localeMatch, 'optionalAccess', _126 => _126.pathname]) || pathname;
3075
+ const routePathname = _optionalChain([localeMatch, 'optionalAccess', _161 => _161.pathname]) || pathname;
2556
3076
  const normalizedPath = routePathname === "/" ? "/" : routePathname.replace(/\/$/, "");
2557
3077
  for (const redirectEntry of this.redirects.values()) {
2558
3078
  const match = _chunkQMNWKQL4cjs.matchRoute.call(void 0, normalizedPath, redirectEntry.route.segments);
@@ -2563,7 +3083,7 @@ var RouteManager = class {
2563
3083
  destination: _chunkHXNLKCWHcjs.appendFarmRedirectQuery.call(void 0,
2564
3084
  this.localizeRedirectDestination(
2565
3085
  interpolateRedirectDestination(redirectEntry.definition.destination, match.params),
2566
- _optionalChain([localeMatch, 'optionalAccess', _127 => _127.locale])
3086
+ _optionalChain([localeMatch, 'optionalAccess', _162 => _162.locale])
2567
3087
  ),
2568
3088
  search
2569
3089
  ),
@@ -2670,14 +3190,14 @@ var RouteManager = class {
2670
3190
  * Requests still fetch route data, but never inspect component source.
2671
3191
  */
2672
3192
  generateClientManifest(projectRoot = this.config.root) {
2673
- const normalizedProjectRoot = path6.default.resolve(projectRoot);
2674
- if (_optionalChain([this, 'access', _128 => _128.clientManifestCache, 'optionalAccess', _129 => _129.projectRoot]) === normalizedProjectRoot) {
3193
+ const normalizedProjectRoot = path7.default.resolve(projectRoot);
3194
+ if (_optionalChain([this, 'access', _163 => _163.clientManifestCache, 'optionalAccess', _164 => _164.projectRoot]) === normalizedProjectRoot) {
2675
3195
  return this.clientManifestCache.manifest;
2676
3196
  }
2677
3197
  const toUrlPath = (absolutePath) => {
2678
3198
  const rootRelative = _chunkQMNWKQL4cjs.toRootRelativeUrlPath.call(void 0, absolutePath, normalizedProjectRoot);
2679
3199
  if (rootRelative !== void 0) return rootRelative;
2680
- if (path6.default.isAbsolute(absolutePath)) {
3200
+ if (path7.default.isAbsolute(absolutePath)) {
2681
3201
  const normalized = absolutePath.replace(/\\/g, "/");
2682
3202
  return normalized.startsWith("/") ? `/@fs${normalized}` : `/@fs/${normalized}`;
2683
3203
  }
@@ -2689,15 +3209,15 @@ var RouteManager = class {
2689
3209
  const unsupportedIntegrationProvider = integrationProviders.find(
2690
3210
  (provider) => provider.supportsIsolatedHydration !== true
2691
3211
  );
2692
- if (_optionalChain([this, 'access', _130 => _130.config, 'access', _131 => _131.experimental, 'optionalAccess', _132 => _132.isolatedClientHydration]) === "enabled" && _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _133 => _133.config, 'access', _134 => _134.experimental, 'optionalAccess', _135 => _135.serverComponents])) !== "rsc" && unsupportedIntegrationProvider) {
3212
+ if (_optionalChain([this, 'access', _165 => _165.config, 'access', _166 => _166.experimental, 'optionalAccess', _167 => _167.isolatedClientHydration]) === "enabled" && _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _168 => _168.config, 'access', _169 => _169.experimental, 'optionalAccess', _170 => _170.serverComponents])) !== "rsc" && unsupportedIntegrationProvider) {
2693
3213
  _chunkQMNWKQL4cjs.logger.warn(
2694
3214
  `[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
2695
3215
  );
2696
3216
  }
2697
3217
  const isolatedMode = resolveFarmIsolatedClientHydrationMode(
2698
- _optionalChain([this, 'access', _136 => _136.config, 'access', _137 => _137.experimental, 'optionalAccess', _138 => _138.isolatedClientHydration]),
3218
+ _optionalChain([this, 'access', _171 => _171.config, 'access', _172 => _172.experimental, 'optionalAccess', _173 => _173.isolatedClientHydration]),
2699
3219
  {
2700
- serverComponents: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _139 => _139.config, 'access', _140 => _140.experimental, 'optionalAccess', _141 => _141.serverComponents])) === "rsc",
3220
+ serverComponents: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _174 => _174.config, 'access', _175 => _175.experimental, 'optionalAccess', _176 => _176.serverComponents])) === "rsc",
2701
3221
  hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
2702
3222
  }
2703
3223
  );
@@ -2705,7 +3225,7 @@ var RouteManager = class {
2705
3225
  this.config.renderer,
2706
3226
  Boolean(unsupportedIntegrationProvider)
2707
3227
  );
2708
- const islandsMode = _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _142 => _142.config, 'access', _143 => _143.experimental, 'optionalAccess', _144 => _144.serverComponents])) === "islands";
3228
+ const islandsMode = _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _177 => _177.config, 'access', _178 => _178.experimental, 'optionalAccess', _179 => _179.serverComponents])) === "islands";
2709
3229
  const layoutEntries = Array.from(this.layouts.values()).map((entry) => ({
2710
3230
  entry,
2711
3231
  metadata: getClientModuleHydrationPlan(
@@ -2723,29 +3243,29 @@ var RouteManager = class {
2723
3243
  );
2724
3244
  const routeEntries = Array.from(this.routes.values()).map((entry) => ({
2725
3245
  entry,
2726
- metadata: _chunkPRFNLQSPcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? markdownPagePlan() : getClientModuleHydrationPlan(entry.modulePath, normalizedProjectRoot, isolatedMode, {
3246
+ metadata: _chunk7XGWBPQQcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? markdownPagePlan() : getClientModuleHydrationPlan(entry.modulePath, normalizedProjectRoot, isolatedMode, {
2727
3247
  ...planOptions,
2728
- serverOwners: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _145 => _145.config, 'access', _146 => _146.experimental, 'optionalAccess', _147 => _147.serverComponents])) === "islands"
3248
+ serverOwners: _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _180 => _180.config, 'access', _181 => _181.experimental, 'optionalAccess', _182 => _182.serverComponents])) === "islands"
2729
3249
  })
2730
3250
  }));
2731
3251
  const markdownFallback = routeEntries.find(
2732
- ({ entry, metadata }) => _chunkPRFNLQSPcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) && metadata.fallbackReason
3252
+ ({ entry, metadata }) => _chunk7XGWBPQQcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) && metadata.fallbackReason
2733
3253
  );
2734
3254
  if (markdownFallback) {
2735
3255
  _chunkQMNWKQL4cjs.logger.warn(
2736
3256
  `[Farm.js] client components in Markdown pages stay static: ${markdownFallback.metadata.fallbackReason}.`
2737
3257
  );
2738
3258
  }
2739
- const markdownStaticPackages = _optionalChain([routeEntries, 'access', _148 => _148.find, 'call', _149 => _149(
2740
- ({ entry, metadata }) => _chunkPRFNLQSPcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) && metadata.staticPackageBoundaries
2741
- ), 'optionalAccess', _150 => _150.metadata, 'access', _151 => _151.staticPackageBoundaries]);
3259
+ const markdownStaticPackages = _optionalChain([routeEntries, 'access', _183 => _183.find, 'call', _184 => _184(
3260
+ ({ entry, metadata }) => _chunk7XGWBPQQcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) && metadata.staticPackageBoundaries
3261
+ ), 'optionalAccess', _185 => _185.metadata, 'access', _186 => _186.staticPackageBoundaries]);
2742
3262
  if (markdownStaticPackages) {
2743
3263
  _chunkQMNWKQL4cjs.logger.info(
2744
3264
  `[Farm.js] Markdown pages render client components from ${markdownStaticPackages.join(", ")} as static HTML: package client components cannot be isolated yet.`
2745
3265
  );
2746
3266
  }
2747
3267
  for (const { entry, metadata } of [...layoutEntries, ...routeEntries]) {
2748
- if (_chunkPRFNLQSPcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) || !metadata.staticPackageBoundaries) continue;
3268
+ if (_chunk7XGWBPQQcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) || !metadata.staticPackageBoundaries) continue;
2749
3269
  _chunkQMNWKQL4cjs.logger.info(
2750
3270
  `[Farm.js] ${entry.pattern} renders client components from ${metadata.staticPackageBoundaries.join(", ")} as static HTML: package client components cannot be isolated yet.`
2751
3271
  );
@@ -2753,15 +3273,15 @@ var RouteManager = class {
2753
3273
  enforceFarmIsolatedHydrationRouteBudget(
2754
3274
  layoutEntries.map(({ entry, metadata }) => ({
2755
3275
  pattern: entry.pattern,
2756
- depth: _chunkO27PLNQZcjs.getRouteDirectoryDepth.call(void 0, entry.pattern),
3276
+ depth: _chunkUJ3R2AH2cjs.getRouteDirectoryDepth.call(void 0, entry.pattern),
2757
3277
  metadata
2758
3278
  })),
2759
3279
  routeEntries.map(({ entry, metadata }) => ({
2760
3280
  pattern: getRouteEntryDirectory(entry),
2761
- depth: _chunkO27PLNQZcjs.getRouteDirectoryDepth.call(void 0, getRouteEntryDirectory(entry)),
3281
+ depth: _chunkUJ3R2AH2cjs.getRouteDirectoryDepth.call(void 0, getRouteEntryDirectory(entry)),
2762
3282
  metadata
2763
3283
  })),
2764
- _chunkO27PLNQZcjs.routeBoundaryCoversDirectory,
3284
+ _chunkUJ3R2AH2cjs.routeBoundaryCoversDirectory,
2765
3285
  { serverOwners: islandsMode }
2766
3286
  );
2767
3287
  for (const { entry, metadata } of [...layoutEntries, ...routeEntries]) {
@@ -2781,7 +3301,7 @@ var RouteManager = class {
2781
3301
  const routes = routeEntries.map(({ entry, metadata }) => {
2782
3302
  const programmaticPage = this.programmaticPages.get(entry.modulePath);
2783
3303
  const layoutShouldHydrate = layoutEntries.some(
2784
- ({ entry: layout, metadata: layoutMetadata }) => layoutMetadata.shouldHydrate && _chunkO27PLNQZcjs.routeBoundaryCoversDirectory.call(void 0, layout.pattern, getRouteEntryDirectory(entry))
3304
+ ({ entry: layout, metadata: layoutMetadata }) => layoutMetadata.shouldHydrate && _chunkUJ3R2AH2cjs.routeBoundaryCoversDirectory.call(void 0, layout.pattern, getRouteEntryDirectory(entry))
2785
3305
  );
2786
3306
  return {
2787
3307
  pattern: entry.pattern,
@@ -2798,14 +3318,14 @@ var RouteManager = class {
2798
3318
  }))
2799
3319
  } : {},
2800
3320
  ...usesFarmServerTree(metadata) ? { serverTree: true } : {},
2801
- renderPlan: _chunkO27PLNQZcjs.createFarmRouteRenderPlan.call(void 0, {
3321
+ renderPlan: _chunkUJ3R2AH2cjs.createFarmRouteRenderPlan.call(void 0, {
2802
3322
  pageShouldHydrate: metadata.shouldHydrate,
2803
3323
  layoutShouldHydrate,
2804
3324
  islandStrategy: metadata.islandStrategy
2805
3325
  }),
2806
3326
  suppressedAsyncHydration: metadata.suppressedAsyncHydration,
2807
3327
  ...metadata.suppressedAsyncHydration && metadata.fallbackReason ? { suppressedAsyncHydrationReason: metadata.fallbackReason } : {},
2808
- search: _chunkE7QOEV5Zcjs.getProgrammaticRouteSearchClientOptions.call(void 0, _optionalChain([programmaticPage, 'optionalAccess', _152 => _152.search])),
3328
+ search: _chunkE7QOEV5Zcjs.getProgrammaticRouteSearchClientOptions.call(void 0, _optionalChain([programmaticPage, 'optionalAccess', _187 => _187.search])),
2809
3329
  segments: entry.route.segments.map((seg) => ({
2810
3330
  segment: seg.segment,
2811
3331
  isDynamic: seg.isDynamic,
@@ -2814,7 +3334,7 @@ var RouteManager = class {
2814
3334
  }))
2815
3335
  };
2816
3336
  });
2817
- const treeLayoutPatterns = islandsMode ? _chunkO27PLNQZcjs.getFarmServerTreeLayoutPatterns.call(void 0,
3337
+ const treeLayoutPatterns = islandsMode ? _chunkUJ3R2AH2cjs.getFarmServerTreeLayoutPatterns.call(void 0,
2818
3338
  layoutEntries.map(({ entry, metadata }) => ({
2819
3339
  pattern: entry.pattern,
2820
3340
  shouldHydrate: metadata.shouldHydrate,
@@ -2857,7 +3377,7 @@ var RouteManager = class {
2857
3377
  for (const { metadata } of [...layoutEntries, ...routeEntries]) {
2858
3378
  if (!metadata.hasIsolatedClientBoundaries && !metadata.serverTreeLayout) continue;
2859
3379
  for (const boundary of metadata.isolatedBoundaries) {
2860
- isolatedClientBoundaryModules.add(path6.default.resolve(boundary.modulePath));
3380
+ isolatedClientBoundaryModules.add(path7.default.resolve(boundary.modulePath));
2861
3381
  }
2862
3382
  }
2863
3383
  const islandsErrors = [
@@ -2908,17 +3428,17 @@ var RouteManager = class {
2908
3428
  }
2909
3429
  /** @internal Client modules selected by the compiled hydration ownership plan. */
2910
3430
  getIsolatedClientBoundaryModules(projectRoot = this.config.root) {
2911
- const normalizedProjectRoot = path6.default.resolve(projectRoot);
3431
+ const normalizedProjectRoot = path7.default.resolve(projectRoot);
2912
3432
  this.generateClientManifest(normalizedProjectRoot);
2913
- return _nullishCoalesce(_optionalChain([this, 'access', _153 => _153.clientManifestCache, 'optionalAccess', _154 => _154.isolatedClientBoundaryModules]), () => ( /* @__PURE__ */ new Set()));
3433
+ return _nullishCoalesce(_optionalChain([this, 'access', _188 => _188.clientManifestCache, 'optionalAccess', _189 => _189.isolatedClientBoundaryModules]), () => ( /* @__PURE__ */ new Set()));
2914
3434
  }
2915
3435
  /**
2916
3436
  * @internal Islands-mode pages with a client component that cannot become an island. Hydrating
2917
3437
  * such a page whole would ship its server code to the browser, so it stays static instead.
2918
3438
  */
2919
3439
  getIslandsErrors(projectRoot = this.config.root) {
2920
- this.generateClientManifest(path6.default.resolve(projectRoot));
2921
- return _nullishCoalesce(_optionalChain([this, 'access', _155 => _155.clientManifestCache, 'optionalAccess', _156 => _156.islandsErrors]), () => ( []));
3440
+ this.generateClientManifest(path7.default.resolve(projectRoot));
3441
+ return _nullishCoalesce(_optionalChain([this, 'access', _190 => _190.clientManifestCache, 'optionalAccess', _191 => _191.islandsErrors]), () => ( []));
2922
3442
  }
2923
3443
  /**
2924
3444
  * Invalidate build-time route metadata after a page or layout changes in dev.
@@ -2937,13 +3457,13 @@ var RouteManager = class {
2937
3457
  const { createRouteModuleFromProgrammaticPage } = await import("./routes.cjs");
2938
3458
  return createRouteModuleFromProgrammaticPage(programmaticPage, this.rendererRuntime);
2939
3459
  }
2940
- if (_chunkPRFNLQSPcjs.isFarmMarkdownPageFile.call(void 0, modulePath)) {
3460
+ if (_chunk7XGWBPQQcjs.isFarmMarkdownPageFile.call(void 0, modulePath)) {
2941
3461
  const mdxConfig = _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, this.config.mdx);
2942
- const components = await _chunkCI4UNQHOcjs.loadFarmMdxComponents.call(void 0, mdxConfig, {
3462
+ const components = await _chunkXBSKPLHFcjs.loadFarmMdxComponents.call(void 0, mdxConfig, {
2943
3463
  root: this.config.root,
2944
3464
  loadModule: this.viteServer ? (componentModulePath) => _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, this.viteServer, componentModulePath) : void 0
2945
3465
  });
2946
- return await _chunkCI4UNQHOcjs.createFarmMarkdownRouteModuleFromFile.call(void 0, modulePath, {
3466
+ return await _chunkXBSKPLHFcjs.createFarmMarkdownRouteModuleFromFile.call(void 0, modulePath, {
2947
3467
  components,
2948
3468
  config: mdxConfig
2949
3469
  });
@@ -2993,7 +3513,7 @@ var RouteManager = class {
2993
3513
  */
2994
3514
  createRoutePattern(route) {
2995
3515
  if (route.segments.length === 0) return "/";
2996
- return "/" + route.segments.map(_chunkO27PLNQZcjs.formatRouteSegment).join("/");
3516
+ return "/" + route.segments.map(_chunkUJ3R2AH2cjs.formatRouteSegment).join("/");
2997
3517
  }
2998
3518
  registerPageRoute(entry) {
2999
3519
  _chunkYTVSWXEZcjs.assertUniqueRouteParameters.call(void 0, entry.pattern);
@@ -3044,25 +3564,25 @@ var RouteManager = class {
3044
3564
  }
3045
3565
  }
3046
3566
  for (const [pattern, group] of canonicalPageGroups) {
3047
- const componentFiles = group.files.filter((file) => !_chunkPRFNLQSPcjs.isFarmMarkdownPageFile.call(void 0, file));
3048
- const markdownFiles = group.files.filter(_chunkPRFNLQSPcjs.isFarmMarkdownPageFile);
3567
+ const componentFiles = group.files.filter((file) => !_chunk7XGWBPQQcjs.isFarmMarkdownPageFile.call(void 0, file));
3568
+ const markdownFiles = group.files.filter(_chunk7XGWBPQQcjs.isFarmMarkdownPageFile);
3049
3569
  if (componentFiles.length > 1) {
3050
3570
  throw new Error(
3051
- `Duplicate page route "${pattern}". Found ${componentFiles.map((file) => path6.default.join(appDir, file)).join(" and ")}.`
3571
+ `Duplicate page route "${pattern}". Found ${componentFiles.map((file) => path7.default.join(appDir, file)).join(" and ")}.`
3052
3572
  );
3053
3573
  }
3054
3574
  if (markdownFiles.length > 1) {
3055
3575
  throw new Error(
3056
- `Duplicate markdown representation for page route "${pattern}". Found ${markdownFiles.map((file) => path6.default.join(appDir, file)).join(" and ")}.`
3576
+ `Duplicate markdown representation for page route "${pattern}". Found ${markdownFiles.map((file) => path7.default.join(appDir, file)).join(" and ")}.`
3057
3577
  );
3058
3578
  }
3059
3579
  const componentFile = componentFiles[0];
3060
3580
  const markdownFile = markdownFiles[0];
3061
3581
  const primaryFile = componentFile || markdownFile;
3062
3582
  if (!primaryFile) continue;
3063
- const modulePath = path6.default.join(appDir, primaryFile);
3583
+ const modulePath = path7.default.join(appDir, primaryFile);
3064
3584
  const existing = this.routes.get(pattern);
3065
- if (_optionalChain([existing, 'optionalAccess', _157 => _157.sourceRoot]) === source.root) {
3585
+ if (_optionalChain([existing, 'optionalAccess', _192 => _192.sourceRoot]) === source.root) {
3066
3586
  throw new Error(
3067
3587
  `Duplicate page route "${pattern}". Found both ${existing.modulePath} and ${modulePath}.`
3068
3588
  );
@@ -3071,7 +3591,7 @@ var RouteManager = class {
3071
3591
  route: group.route,
3072
3592
  modulePath,
3073
3593
  ...markdownFile ? {
3074
- markdownSourcePath: path6.default.join(appDir, markdownFile)
3594
+ markdownSourcePath: path7.default.join(appDir, markdownFile)
3075
3595
  } : {},
3076
3596
  pattern,
3077
3597
  ...getPageDirectoryField(group.route, pattern),
@@ -3086,10 +3606,10 @@ var RouteManager = class {
3086
3606
  ]) {
3087
3607
  for (const file of files) {
3088
3608
  const route = _chunkQMNWKQL4cjs.parseRoutePath.call(void 0, file);
3089
- const modulePath = path6.default.join(appDir, file);
3090
- const pattern = _chunkO27PLNQZcjs.createRouteDirectoryPattern.call(void 0, route);
3609
+ const modulePath = path7.default.join(appDir, file);
3610
+ const pattern = _chunkUJ3R2AH2cjs.createRouteDirectoryPattern.call(void 0, route);
3091
3611
  const existing = target.get(pattern);
3092
- if (_optionalChain([existing, 'optionalAccess', _158 => _158.sourceRoot]) === source.root) {
3612
+ if (_optionalChain([existing, 'optionalAccess', _193 => _193.sourceRoot]) === source.root) {
3093
3613
  throw new Error(
3094
3614
  `Duplicate ${kind} route "${pattern}". Found both ${existing.modulePath} and ${modulePath}.`
3095
3615
  );
@@ -3106,13 +3626,13 @@ var RouteManager = class {
3106
3626
  for (const file of [...pageFiles, ...slotDefaultFiles]) {
3107
3627
  const slot = _chunkZDAEHG2Ocjs.parseRouteSlotFile.call(void 0, file);
3108
3628
  if (!slot) continue;
3109
- const modulePath = path6.default.join(appDir, file);
3629
+ const modulePath = path7.default.join(appDir, file);
3110
3630
  const pattern = this.createRoutePattern(slot.route);
3111
3631
  const ownerPattern = this.createRoutePattern(slot.ownerRoute);
3112
- const ownerDirectory = _chunkO27PLNQZcjs.createRouteDirectoryPattern.call(void 0, slot.ownerRoute);
3632
+ const ownerDirectory = _chunkUJ3R2AH2cjs.createRouteDirectoryPattern.call(void 0, slot.ownerRoute);
3113
3633
  const key = `${ownerPattern}:${slot.name}:${slot.interception ? "intercept" : "slot"}:${slot.fallback ? "default" : pattern}`;
3114
3634
  const existing = this.routeSlots.get(key);
3115
- if (_optionalChain([existing, 'optionalAccess', _159 => _159.sourceRoot]) === source.root) {
3635
+ if (_optionalChain([existing, 'optionalAccess', _194 => _194.sourceRoot]) === source.root) {
3116
3636
  throw new Error(
3117
3637
  `Duplicate route slot "${slot.name}" for "${pattern}". Found both ${existing.modulePath} and ${modulePath}.`
3118
3638
  );
@@ -3132,16 +3652,16 @@ var RouteManager = class {
3132
3652
  });
3133
3653
  }
3134
3654
  for (const file of metadataImageFiles) {
3135
- const fileBase = path6.default.basename(file, path6.default.extname(file));
3655
+ const fileBase = path7.default.basename(file, path7.default.extname(file));
3136
3656
  const kind = fileBase === "twitter-image" ? "twitter" : "opengraph";
3137
3657
  const fileName = kind === "twitter" ? "twitter-image" : "opengraph-image";
3138
3658
  const route = _chunkQMNWKQL4cjs.parseRoutePath.call(void 0, file);
3139
- const modulePath = path6.default.join(appDir, file);
3659
+ const modulePath = path7.default.join(appDir, file);
3140
3660
  const pattern = this.createRoutePattern(route);
3141
3661
  const key = `${kind}:${pattern}`;
3142
3662
  const existing = this.metadataImages.get(key);
3143
3663
  const sourceType = isStaticMetadataImageFile(file) ? "static" : "module";
3144
- if (_optionalChain([existing, 'optionalAccess', _160 => _160.sourceRoot]) === source.root) {
3664
+ if (_optionalChain([existing, 'optionalAccess', _195 => _195.sourceRoot]) === source.root) {
3145
3665
  throw new Error(
3146
3666
  `Duplicate ${fileName} route "${pattern}". Found both ${existing.modulePath} and ${modulePath}. Keep only one static image or module per route segment.`
3147
3667
  );
@@ -3161,15 +3681,15 @@ var RouteManager = class {
3161
3681
  }
3162
3682
  for (const file of metadataRouteFiles) {
3163
3683
  const descriptor = getApplicationMetadataRouteDescriptor(
3164
- path6.default.basename(file, path6.default.extname(file))
3684
+ path7.default.basename(file, path7.default.extname(file))
3165
3685
  );
3166
3686
  if (!descriptor) continue;
3167
3687
  const route = _chunkQMNWKQL4cjs.parseRoutePath.call(void 0, file);
3168
- const modulePath = path6.default.join(appDir, file);
3688
+ const modulePath = path7.default.join(appDir, file);
3169
3689
  const pattern = this.createRoutePattern(route);
3170
3690
  const key = `${descriptor.kind}:${pattern}`;
3171
3691
  const existing = this.metadataRoutes.get(key);
3172
- if (_optionalChain([existing, 'optionalAccess', _161 => _161.sourceRoot]) === source.root) {
3692
+ if (_optionalChain([existing, 'optionalAccess', _196 => _196.sourceRoot]) === source.root) {
3173
3693
  throw new Error(
3174
3694
  `Duplicate ${descriptor.fileName} route "${pattern}". Found both ${existing.modulePath} and ${modulePath}. Keep only one .ts or .js metadata route per segment.`
3175
3695
  );
@@ -3208,7 +3728,7 @@ var RouteManager = class {
3208
3728
  const route = _chunkE7QOEV5Zcjs.parseProgrammaticRoutePath.call(void 0, definition.path, "page");
3209
3729
  const pattern = this.createRoutePattern(route);
3210
3730
  const existing = this.routes.get(pattern);
3211
- if (_optionalChain([existing, 'optionalAccess', _162 => _162.sourceRoot]) === source.root) {
3731
+ if (_optionalChain([existing, 'optionalAccess', _197 => _197.sourceRoot]) === source.root) {
3212
3732
  throw new Error(
3213
3733
  `Duplicate page route "${pattern}". Found both ${existing.modulePath} and programmatic route in ${filePath}.`
3214
3734
  );
@@ -3226,9 +3746,9 @@ var RouteManager = class {
3226
3746
  }
3227
3747
  if (definition.kind === "layout") {
3228
3748
  const route = _chunkE7QOEV5Zcjs.parseProgrammaticRoutePath.call(void 0, definition.path, "layout");
3229
- const pattern = _chunkO27PLNQZcjs.createRouteDirectoryPattern.call(void 0, route);
3749
+ const pattern = _chunkUJ3R2AH2cjs.createRouteDirectoryPattern.call(void 0, route);
3230
3750
  const existing = this.layouts.get(pattern);
3231
- if (_optionalChain([existing, 'optionalAccess', _163 => _163.sourceRoot]) === source.root) {
3751
+ if (_optionalChain([existing, 'optionalAccess', _198 => _198.sourceRoot]) === source.root) {
3232
3752
  throw new Error(
3233
3753
  `Duplicate layout route "${pattern}". Found both ${existing.modulePath} and programmatic route in ${filePath}.`
3234
3754
  );
@@ -3257,7 +3777,7 @@ var RouteManager = class {
3257
3777
  }
3258
3778
  async loadProgrammaticRoutesModule(filePath) {
3259
3779
  if (this.viteServer) {
3260
- const viteRoot = _optionalChain([this, 'access', _164 => _164.viteServer, 'access', _165 => _165.config, 'optionalAccess', _166 => _166.root]) || this.config.root || process.cwd();
3780
+ const viteRoot = _optionalChain([this, 'access', _199 => _199.viteServer, 'access', _200 => _200.config, 'optionalAccess', _201 => _201.root]) || this.config.root || process.cwd();
3261
3781
  return await _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, this.viteServer, _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, filePath, viteRoot));
3262
3782
  }
3263
3783
  return await import(
@@ -3273,7 +3793,7 @@ var RouteManager = class {
3273
3793
  const matchingLayouts = [];
3274
3794
  for (const { entry, groupScope } of this.orderedLayouts) {
3275
3795
  if (!_chunkQMNWKQL4cjs.matchRoutePrefixParts.call(void 0, pathnameParts, entry.route.segments)) continue;
3276
- if (groupScope !== null && !_chunkO27PLNQZcjs.isInRouteGroupScope.call(void 0, route && getRouteEntryDirectory(route), groupScope)) {
3796
+ if (groupScope !== null && !_chunkUJ3R2AH2cjs.isInRouteGroupScope.call(void 0, route && getRouteEntryDirectory(route), groupScope)) {
3277
3797
  continue;
3278
3798
  }
3279
3799
  matchingLayouts.push(entry);
@@ -3354,14 +3874,14 @@ var RouteManager = class {
3354
3874
  let page = route;
3355
3875
  for (const boundaryEntry of boundaries.values()) {
3356
3876
  if (!_chunkQMNWKQL4cjs.matchRoutePrefix.call(void 0, normalizedPath, boundaryEntry.route.segments)) continue;
3357
- const groupScope = _chunkO27PLNQZcjs.getRouteGroupScope.call(void 0, boundaryEntry.pattern);
3877
+ const groupScope = _chunkUJ3R2AH2cjs.getRouteGroupScope.call(void 0, boundaryEntry.pattern);
3358
3878
  if (groupScope !== null) {
3359
3879
  if (page === void 0) page = this.matchPageRoute(_chunkQMNWKQL4cjs.splitRoutePath.call(void 0, normalizedPath));
3360
- if (!_chunkO27PLNQZcjs.isInRouteGroupScope.call(void 0, page && getRouteEntryDirectory(page), groupScope)) continue;
3880
+ if (!_chunkUJ3R2AH2cjs.isInRouteGroupScope.call(void 0, page && getRouteEntryDirectory(page), groupScope)) continue;
3361
3881
  }
3362
3882
  const depth = boundaryEntry.route.segments.length;
3363
- const bestDepth = _nullishCoalesce(_optionalChain([bestMatch, 'optionalAccess', _167 => _167.route, 'access', _168 => _168.segments, 'access', _169 => _169.length]), () => ( -1));
3364
- if (!bestMatch || depth > bestDepth || depth === bestDepth && _chunkO27PLNQZcjs.getRouteDirectoryDepth.call(void 0, boundaryEntry.pattern) > _chunkO27PLNQZcjs.getRouteDirectoryDepth.call(void 0, bestMatch.pattern)) {
3883
+ const bestDepth = _nullishCoalesce(_optionalChain([bestMatch, 'optionalAccess', _202 => _202.route, 'access', _203 => _203.segments, 'access', _204 => _204.length]), () => ( -1));
3884
+ if (!bestMatch || depth > bestDepth || depth === bestDepth && _chunkUJ3R2AH2cjs.getRouteDirectoryDepth.call(void 0, boundaryEntry.pattern) > _chunkUJ3R2AH2cjs.getRouteDirectoryDepth.call(void 0, bestMatch.pattern)) {
3365
3885
  bestMatch = boundaryEntry;
3366
3886
  }
3367
3887
  }
@@ -3459,7 +3979,7 @@ var RouteManager = class {
3459
3979
  const mod = await this.loadRouteModule(modulePath);
3460
3980
  const rendering = await _chunkX4K7TYN6cjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
3461
3981
  return rendering.ssg;
3462
- } catch (e14) {
3982
+ } catch (e22) {
3463
3983
  return false;
3464
3984
  }
3465
3985
  }
@@ -3471,7 +3991,7 @@ var RouteManager = class {
3471
3991
  const mod = await this.loadRouteModule(modulePath);
3472
3992
  const rendering = await _chunkX4K7TYN6cjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
3473
3993
  return rendering.ssg && typeof rendering.revalidate === "number" && rendering.revalidate > 0;
3474
- } catch (e15) {
3994
+ } catch (e23) {
3475
3995
  return false;
3476
3996
  }
3477
3997
  }
@@ -3483,13 +4003,13 @@ var RouteManager = class {
3483
4003
  const mod = await this.loadRouteModule(modulePath);
3484
4004
  const rendering = await _chunkX4K7TYN6cjs.resolveRouteRenderingConfigFromFile.call(void 0, mod, modulePath);
3485
4005
  return rendering.revalidate;
3486
- } catch (e16) {
4006
+ } catch (e24) {
3487
4007
  return void 0;
3488
4008
  }
3489
4009
  }
3490
4010
  };
3491
4011
  function getPageDirectoryField(route, pattern) {
3492
- const directory = _chunkO27PLNQZcjs.createRouteDirectoryPattern.call(void 0, route);
4012
+ const directory = _chunkUJ3R2AH2cjs.createRouteDirectoryPattern.call(void 0, route);
3493
4013
  return directory === pattern ? {} : { directory };
3494
4014
  }
3495
4015
  function interpolateRedirectDestination(destination, params) {
@@ -3563,14 +4083,14 @@ function replaceAll(input, search, replacement) {
3563
4083
  async function safeGlobFiles(pattern, cwd) {
3564
4084
  try {
3565
4085
  return await _chunkQMNWKQL4cjs.globFiles.call(void 0, pattern, cwd);
3566
- } catch (e17) {
4086
+ } catch (e25) {
3567
4087
  return [];
3568
4088
  }
3569
4089
  }
3570
4090
  function toRealPath(filePath) {
3571
4091
  try {
3572
4092
  return _fs.realpathSync.call(void 0, filePath);
3573
- } catch (e18) {
4093
+ } catch (e26) {
3574
4094
  return filePath;
3575
4095
  }
3576
4096
  }
@@ -3579,9 +4099,9 @@ function toRealPath(filePath) {
3579
4099
 
3580
4100
 
3581
4101
  function resolveDevGlobalStylesheetHref(root, srcDir = "src") {
3582
- const file = path6.join(root, srcDir, "app", "globals.css");
3583
- if (!fs4.existsSync(file)) return void 0;
3584
- return `/${path6.relative(root, file).split(path6.sep).join("/")}`;
4102
+ const file = path7.join(root, srcDir, "app", "globals.css");
4103
+ if (!fs5.existsSync(file)) return void 0;
4104
+ return `/${path7.relative(root, file).split(path7.sep).join("/")}`;
3585
4105
  }
3586
4106
  var STYLE_EXTENSIONS = /\.(css|scss|sass|less|styl|stylus)(?:$|\?)/;
3587
4107
  var ALREADY_LINKED = "/src/app/globals.css";
@@ -3661,7 +4181,7 @@ function farmFontImportsPlugin(options = {}) {
3661
4181
  return;
3662
4182
  }
3663
4183
  const resource = registry.getDevResource(pathname);
3664
- if (!_optionalChain([resource, 'optionalAccess', _170 => _170.bytes])) {
4184
+ if (!_optionalChain([resource, 'optionalAccess', _205 => _205.bytes])) {
3665
4185
  next();
3666
4186
  return;
3667
4187
  }
@@ -3943,7 +4463,7 @@ ${FONT_SECTION_END}
3943
4463
  let url;
3944
4464
  try {
3945
4465
  url = new URL(input.source);
3946
- } catch (e19) {
4466
+ } catch (e27) {
3947
4467
  throw fontError(input.moduleId, `remoteFont() source must be an absolute HTTPS URL`);
3948
4468
  }
3949
4469
  if (url.protocol !== "https:") {
@@ -3962,7 +4482,7 @@ ${FONT_SECTION_END}
3962
4482
  return resource;
3963
4483
  }
3964
4484
  const bytes2 = await fetchRemoteFont(url, input.integrity);
3965
- return this.createSelfHostedResource(bytes2, extension, path6.default.basename(url.pathname));
4485
+ return this.createSelfHostedResource(bytes2, extension, path7.default.basename(url.pathname));
3966
4486
  }
3967
4487
  if (input.source.startsWith("/")) {
3968
4488
  return this.createPublicResource(input.moduleId, input.source);
@@ -3985,8 +4505,8 @@ ${FONT_SECTION_END}
3985
4505
  }
3986
4506
  return this.createSelfHostedResource(
3987
4507
  bytes,
3988
- path6.default.extname(resolvedPath),
3989
- path6.default.basename(resolvedPath)
4508
+ path7.default.extname(resolvedPath),
4509
+ path7.default.basename(resolvedPath)
3990
4510
  );
3991
4511
  }
3992
4512
  async createPublicResource(moduleId, source) {
@@ -3997,7 +4517,7 @@ ${FONT_SECTION_END}
3997
4517
  );
3998
4518
  }
3999
4519
  const publicPath = normalizePublicFontPath(source, moduleId);
4000
- const resolvedPath = path6.default.resolve(this.publicDir, `.${publicPath}`);
4520
+ const resolvedPath = path7.default.resolve(this.publicDir, `.${publicPath}`);
4001
4521
  if (!isPathInside(this.publicDir, resolvedPath)) {
4002
4522
  throw fontError(moduleId, `public font path must stay inside publicDir`);
4003
4523
  }
@@ -4013,7 +4533,7 @@ ${FONT_SECTION_END}
4013
4533
  `could not read ${JSON.stringify(source)} from publicDir: ${error.message}`
4014
4534
  );
4015
4535
  }
4016
- const extension = path6.default.extname(resolvedPath).toLowerCase();
4536
+ const extension = path7.default.extname(resolvedPath).toLowerCase();
4017
4537
  const hash = _crypto.createHash.call(void 0, "sha256").update(bytes).digest("hex").slice(0, 12);
4018
4538
  const resource = {
4019
4539
  extension,
@@ -4028,7 +4548,7 @@ ${FONT_SECTION_END}
4028
4548
  createSelfHostedResource(bytes, extension, fileName) {
4029
4549
  const normalizedExtension = extension.toLowerCase();
4030
4550
  const hash = _crypto.createHash.call(void 0, "sha256").update(bytes).digest("hex").slice(0, 12);
4031
- const baseName = sanitizeFileName(path6.default.basename(fileName, extension)) || "font";
4551
+ const baseName = sanitizeFileName(path7.default.basename(fileName, extension)) || "font";
4032
4552
  const outputFileName = `assets/fonts/${baseName}-h${hash}${normalizedExtension}`;
4033
4553
  const key = `${hash}${normalizedExtension}`;
4034
4554
  const existing = this.resources.get(key);
@@ -4179,7 +4699,7 @@ function readFontOptions(code, id, call) {
4179
4699
  const declaration = call.ancestors.at(-2);
4180
4700
  const statement = call.ancestors.at(-3);
4181
4701
  const statementParent = call.ancestors.at(-4);
4182
- const isModuleScope = _optionalChain([declaration, 'optionalAccess', _171 => _171.type]) === "VariableDeclaration" && (_optionalChain([statement, 'optionalAccess', _172 => _172.type]) === "Program" || _optionalChain([statement, 'optionalAccess', _173 => _173.type]) === "ExportNamedDeclaration" && _optionalChain([statementParent, 'optionalAccess', _174 => _174.type]) === "Program");
4702
+ const isModuleScope = _optionalChain([declaration, 'optionalAccess', _206 => _206.type]) === "VariableDeclaration" && (_optionalChain([statement, 'optionalAccess', _207 => _207.type]) === "Program" || _optionalChain([statement, 'optionalAccess', _208 => _208.type]) === "ExportNamedDeclaration" && _optionalChain([statementParent, 'optionalAccess', _209 => _209.type]) === "Program");
4183
4703
  if (!isModuleScope || call.ancestors.some((ancestor) => isFunctionNode(ancestor))) {
4184
4704
  throw fontError(id, `${call.kind}() must be declared directly at module scope`);
4185
4705
  }
@@ -4381,24 +4901,24 @@ function verifyIntegrity(bytes, integrity) {
4381
4901
  if (!matches) throw new Error("downloaded font did not match its integrity value");
4382
4902
  }
4383
4903
  function resolveLocalFontPath(source, importer, root) {
4384
- if (source.startsWith(".")) return path6.default.resolve(path6.default.dirname(importer), source);
4385
- if (path6.default.isAbsolute(source)) {
4904
+ if (source.startsWith(".")) return path7.default.resolve(path7.default.dirname(importer), source);
4905
+ if (path7.default.isAbsolute(source)) {
4386
4906
  return source;
4387
4907
  }
4388
4908
  try {
4389
4909
  return _module.createRequire.call(void 0, _url.pathToFileURL.call(void 0, importer)).resolve(source);
4390
- } catch (e20) {
4910
+ } catch (e28) {
4391
4911
  const segments = source.replace(/\\/g, "/").split("/");
4392
- if (segments.includes("..")) return path6.default.resolve(root, source);
4393
- let current = path6.default.dirname(importer);
4394
- const filesystemRoot = path6.default.parse(current).root;
4912
+ if (segments.includes("..")) return path7.default.resolve(root, source);
4913
+ let current = path7.default.dirname(importer);
4914
+ const filesystemRoot = path7.default.parse(current).root;
4395
4915
  while (true) {
4396
- const candidate = path6.default.join(current, "node_modules", ...segments);
4916
+ const candidate = path7.default.join(current, "node_modules", ...segments);
4397
4917
  if (_fs.existsSync.call(void 0, candidate)) return candidate;
4398
4918
  if (current === filesystemRoot) break;
4399
- current = path6.default.dirname(current);
4919
+ current = path7.default.dirname(current);
4400
4920
  }
4401
- return path6.default.resolve(root, "node_modules", ...segments);
4921
+ return path7.default.resolve(root, "node_modules", ...segments);
4402
4922
  }
4403
4923
  }
4404
4924
  function replaceFontSection(css, section) {
@@ -4431,11 +4951,11 @@ function getGlobalMap(key) {
4431
4951
  return created;
4432
4952
  }
4433
4953
  function normalizeRoot(root) {
4434
- return path6.default.resolve(root).replace(/\\/g, "/");
4954
+ return path7.default.resolve(root).replace(/\\/g, "/");
4435
4955
  }
4436
4956
  function normalizePublicDir(root, publicDir) {
4437
4957
  if (publicDir === false || publicDir === "") return false;
4438
- return path6.default.resolve(root, publicDir || "public");
4958
+ return path7.default.resolve(root, publicDir || "public");
4439
4959
  }
4440
4960
  function normalizePublicFontPath(source, moduleId) {
4441
4961
  if (source.includes("?") || source.includes("#")) {
@@ -4444,8 +4964,8 @@ function normalizePublicFontPath(source, moduleId) {
4444
4964
  return `/${source.replace(/\\/g, "/").replace(/^\/+/, "")}`;
4445
4965
  }
4446
4966
  function isPathInside(parent, child) {
4447
- const relative3 = path6.default.relative(parent, child);
4448
- return relative3 === "" || !relative3.startsWith("..") && !path6.default.isAbsolute(relative3);
4967
+ const relative3 = path7.default.relative(parent, child);
4968
+ return relative3 === "" || !relative3.startsWith("..") && !path7.default.isAbsolute(relative3);
4449
4969
  }
4450
4970
  function normalizeBasePath(value) {
4451
4971
  if (!value || value === "/") return "/";
@@ -4455,7 +4975,7 @@ function joinBasePath(basePath, value) {
4455
4975
  return basePath === "/" ? value : `${basePath.replace(/\/$/, "")}${value}`;
4456
4976
  }
4457
4977
  function extensionFromPath(pathname) {
4458
- const extension = path6.default.extname(pathname).toLowerCase();
4978
+ const extension = path7.default.extname(pathname).toLowerCase();
4459
4979
  if (!FONT_EXTENSION_RE.test(extension)) {
4460
4980
  throw new Error(`[Farm fonts] Remote font URL must end in .woff2, .woff, .ttf, or .otf`);
4461
4981
  }
@@ -4697,7 +5217,7 @@ function generateFarmIntegrationProviderServerModules(providers, root, rendererC
4697
5217
  }
4698
5218
  function resolveProviderModule(moduleId, root) {
4699
5219
  if (!moduleId.startsWith(".")) return moduleId;
4700
- return _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, path6.default.resolve(root, moduleId), root);
5220
+ return _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, path7.default.resolve(root, moduleId), root);
4701
5221
  }
4702
5222
 
4703
5223
  // src/island-inference.ts
@@ -4713,29 +5233,29 @@ var PARSE_LANGS = /* @__PURE__ */ new Map([
4713
5233
  [".mjs", "js"]
4714
5234
  ]);
4715
5235
  function parseFarmIslandSource(file, code) {
4716
- const lang = PARSE_LANGS.get(path6.default.extname(file));
4717
- if (!lang) throw new Error(`${path6.default.basename(file)} is not a script module`);
5236
+ const lang = PARSE_LANGS.get(path7.default.extname(file));
5237
+ if (!lang) throw new Error(`${path7.default.basename(file)} is not a script module`);
4718
5238
  return _parseAst.parseAst.call(void 0, code, { lang });
4719
5239
  }
4720
5240
  function modifiedAt(file) {
4721
5241
  try {
4722
- return fs4.default.statSync(file).mtimeMs;
4723
- } catch (e21) {
5242
+ return fs5.default.statSync(file).mtimeMs;
5243
+ } catch (e29) {
4724
5244
  return -1;
4725
5245
  }
4726
5246
  }
4727
5247
  var inferences = /* @__PURE__ */ new Map();
4728
5248
  function inferFarmIslandStrategy(filePath, root) {
4729
- const file = path6.default.resolve(filePath);
5249
+ const file = path7.default.resolve(filePath);
4730
5250
  const cached = inferences.get(file);
4731
5251
  if (cached && cached.stamps.every(([read, stamp]) => modifiedAt(read) === stamp)) {
4732
5252
  return cached.result;
4733
5253
  }
4734
5254
  let code;
4735
5255
  try {
4736
- code = fs4.default.readFileSync(file, "utf8");
4737
- } catch (e22) {
4738
- return { strategy: null, files: [file], reason: `${path6.default.basename(file)} could not be read` };
5256
+ code = fs5.default.readFileSync(file, "utf8");
5257
+ } catch (e30) {
5258
+ return { strategy: null, files: [file], reason: `${path7.default.basename(file)} could not be read` };
4739
5259
  }
4740
5260
  const result = _compiler.inferStrategy.call(void 0, file, code, {
4741
5261
  parse: parseFarmIslandSource,
@@ -4759,7 +5279,7 @@ function inferFarmRouteRootStrategy(owners, root) {
4759
5279
  return {
4760
5280
  strategy: null,
4761
5281
  files,
4762
- reason: `${path6.default.basename(owner)}: its client components could not be listed`
5282
+ reason: `${path7.default.basename(owner)}: its client components could not be listed`
4763
5283
  };
4764
5284
  }
4765
5285
  modules.push(...rendered);
@@ -4767,8 +5287,8 @@ function inferFarmRouteRootStrategy(owners, root) {
4767
5287
  for (const module of modules) {
4768
5288
  let source = null;
4769
5289
  try {
4770
- source = fs4.default.readFileSync(module, "utf8");
4771
- } catch (e23) {
5290
+ source = fs5.default.readFileSync(module, "utf8");
5291
+ } catch (e31) {
4772
5292
  }
4773
5293
  if (getIslandStrategyExport(source) !== null) return { strategy: null, files, declared: true };
4774
5294
  }
@@ -4782,7 +5302,7 @@ function inferFarmRouteRootStrategy(owners, root) {
4782
5302
  function resolveFarmRouteRootStrategy(route, page, layouts, root, islandsMode) {
4783
5303
  const directory = _nullishCoalesce(route.directory, () => ( route.pattern));
4784
5304
  const onRoute = layouts.filter(
4785
- (layout) => _chunkO27PLNQZcjs.routeBoundaryCoversDirectory.call(void 0, layout.pattern, directory)
5305
+ (layout) => _chunkUJ3R2AH2cjs.routeBoundaryCoversDirectory.call(void 0, layout.pattern, directory)
4786
5306
  );
4787
5307
  const declared = [
4788
5308
  ...page.islandStrategy ? [page.islandStrategy] : [],
@@ -4824,15 +5344,15 @@ var MOBILE_SHELL_CLIENT_REGISTRATION = ` {
4824
5344
  }`;
4825
5345
  var APP_CLIENT_EXTENSIONS = ["ts", "tsx", "js", "jsx", "mts", "mjs"];
4826
5346
  function resolveFarmAppClientEntry(root = process.cwd(), srcDir = "src") {
4827
- const sourceRoot = path6.default.resolve(root, srcDir);
5347
+ const sourceRoot = path7.default.resolve(root, srcDir);
4828
5348
  for (const extension of APP_CLIENT_EXTENSIONS) {
4829
- const candidate = path6.default.join(sourceRoot, `client.${extension}`);
4830
- if (fs4.default.existsSync(candidate) && fs4.default.statSync(candidate).isFile()) return candidate;
5349
+ const candidate = path7.default.join(sourceRoot, `client.${extension}`);
5350
+ if (fs5.default.existsSync(candidate) && fs5.default.statSync(candidate).isFile()) return candidate;
4831
5351
  }
4832
5352
  return void 0;
4833
5353
  }
4834
5354
  function resolveFarmClientPlugins(plugins, _root) {
4835
- if (!_optionalChain([plugins, 'optionalAccess', _175 => _175.length])) return [];
5355
+ if (!_optionalChain([plugins, 'optionalAccess', _210 => _210.length])) return [];
4836
5356
  return plugins.flatMap((plugin) => {
4837
5357
  if (!plugin.client) return [];
4838
5358
  assertClientLifecycle(plugin.client, plugin.name);
@@ -4914,7 +5434,7 @@ function assertLifecycleObject(value, pluginName, location, allowedKeys) {
4914
5434
  throw new TypeError(`Client plugin "${pluginName}" has an unknown ${location}.${key} option`);
4915
5435
  }
4916
5436
  const descriptor = Object.getOwnPropertyDescriptor(value, key);
4917
- if (!_optionalChain([descriptor, 'optionalAccess', _176 => _176.enumerable])) {
5437
+ if (!_optionalChain([descriptor, 'optionalAccess', _211 => _211.enumerable])) {
4918
5438
  throw new TypeError(`Client plugin "${pluginName}" ${location}.${key} must be enumerable`);
4919
5439
  }
4920
5440
  if (!("value" in descriptor)) {
@@ -5032,7 +5552,7 @@ function assertPublicData(value, pluginName) {
5032
5552
  throwPublicDataError(pluginName, pathSegments, "cannot contain symbol keys");
5033
5553
  }
5034
5554
  const descriptor = Object.getOwnPropertyDescriptor(current, key);
5035
- if (!_optionalChain([descriptor, 'optionalAccess', _177 => _177.enumerable])) {
5555
+ if (!_optionalChain([descriptor, 'optionalAccess', _212 => _212.enumerable])) {
5036
5556
  throwPublicDataError(
5037
5557
  pluginName,
5038
5558
  [...pathSegments, key],
@@ -5081,15 +5601,15 @@ var _stream = require('stream');
5081
5601
 
5082
5602
  function resolveFarmNotFoundComponentPath(config, appDirs) {
5083
5603
  const extensions = _chunkRD623KW4cjs.getFarmRendererComponentExtensions.call(void 0, config.renderer);
5084
- const configuredPath = _optionalChain([config, 'access', _178 => _178.notFound, 'optionalAccess', _179 => _179.component, 'optionalAccess', _180 => _180.trim, 'call', _181 => _181()]);
5604
+ const configuredPath = _optionalChain([config, 'access', _213 => _213.notFound, 'optionalAccess', _214 => _214.component, 'optionalAccess', _215 => _215.trim, 'call', _216 => _216()]);
5085
5605
  if (configuredPath) {
5086
- const componentPath = path6.default.isAbsolute(configuredPath) ? path6.default.normalize(configuredPath) : path6.default.resolve(config.root, configuredPath);
5606
+ const componentPath = path7.default.isAbsolute(configuredPath) ? path7.default.normalize(configuredPath) : path7.default.resolve(config.root, configuredPath);
5087
5607
  if (!extensions.some((extension) => componentPath.endsWith(extension))) {
5088
5608
  throw new Error(
5089
5609
  `notFound.component must use one of the configured renderer extensions: ${extensions.join(", ")}`
5090
5610
  );
5091
5611
  }
5092
- if (!fs4.default.existsSync(componentPath) || !fs4.default.statSync(componentPath).isFile()) {
5612
+ if (!fs5.default.existsSync(componentPath) || !fs5.default.statSync(componentPath).isFile()) {
5093
5613
  throw new Error(`notFound.component was not found: ${componentPath}`);
5094
5614
  }
5095
5615
  return componentPath;
@@ -5097,8 +5617,8 @@ function resolveFarmNotFoundComponentPath(config, appDirs) {
5097
5617
  let discoveredPath = null;
5098
5618
  for (const appDir of appDirs) {
5099
5619
  for (const extension of extensions) {
5100
- const candidate = path6.default.join(appDir, `not-found${extension}`);
5101
- if (fs4.default.existsSync(candidate) && fs4.default.statSync(candidate).isFile()) {
5620
+ const candidate = path7.default.join(appDir, `not-found${extension}`);
5621
+ if (fs5.default.existsSync(candidate) && fs5.default.statSync(candidate).isFile()) {
5102
5622
  discoveredPath = candidate;
5103
5623
  break;
5104
5624
  }
@@ -5119,11 +5639,11 @@ function getFarmLayoutKey(pattern, params) {
5119
5639
  );
5120
5640
  }
5121
5641
  function countFarmKeptLayouts(layoutsHeader, layouts, params) {
5122
- const chain = _chunkO27PLNQZcjs.parseFarmLayoutChainHeader.call(void 0, _nullishCoalesce(layoutsHeader, () => ( null)));
5642
+ const chain = _chunkUJ3R2AH2cjs.parseFarmLayoutChainHeader.call(void 0, _nullishCoalesce(layoutsHeader, () => ( null)));
5123
5643
  if (chain.length === 0) return 0;
5124
5644
  const keys = layouts.map((layout) => getFarmLayoutKey(layout.pattern, params));
5125
- if (chain[0] === keys[0]) return _chunkO27PLNQZcjs.getSharedLayoutPrefixLength.call(void 0, chain, keys);
5126
- return keys.length > 1 ? 1 + _chunkO27PLNQZcjs.getSharedLayoutPrefixLength.call(void 0, chain, keys.slice(1)) : 0;
5645
+ if (chain[0] === keys[0]) return _chunkUJ3R2AH2cjs.getSharedLayoutPrefixLength.call(void 0, chain, keys);
5646
+ return keys.length > 1 ? 1 + _chunkUJ3R2AH2cjs.getSharedLayoutPrefixLength.call(void 0, chain, keys.slice(1)) : 0;
5127
5647
  }
5128
5648
  function createFarmFlushToken() {
5129
5649
  const bytes = new Uint8Array(16);
@@ -5303,14 +5823,14 @@ function redactErrorText(value) {
5303
5823
  return value.replace(BEARER_PATTERN, "$1[REDACTED]").replace(SECRET_VALUE_PATTERN, "$1=[REDACTED]");
5304
5824
  }
5305
5825
  function isPathInsideRoot(root, filePath) {
5306
- const relative3 = path12.relative(root, filePath);
5307
- return relative3 === "" || !relative3.startsWith("..") && !path12.isAbsolute(relative3);
5826
+ const relative3 = path13.relative(root, filePath);
5827
+ return relative3 === "" || !relative3.startsWith("..") && !path13.isAbsolute(relative3);
5308
5828
  }
5309
5829
  function normalizeStackPath(value) {
5310
5830
  const withoutQuery = value.replace(/[?#].*$/, "");
5311
5831
  try {
5312
5832
  return withoutQuery.startsWith("file://") ? _url.fileURLToPath.call(void 0, withoutQuery) : withoutQuery;
5313
- } catch (e24) {
5833
+ } catch (e32) {
5314
5834
  return void 0;
5315
5835
  }
5316
5836
  }
@@ -5321,13 +5841,13 @@ function findStackLocation(stack, root) {
5321
5841
  );
5322
5842
  if (!match) continue;
5323
5843
  const candidate = normalizeStackPath(match[1]);
5324
- if (!candidate || candidate.includes(`${path12.sep}node_modules${path12.sep}`)) continue;
5325
- const absolutePath = path12.resolve(candidate);
5326
- if (!isPathInsideRoot(root, absolutePath) || !fs8.existsSync(absolutePath)) continue;
5327
- const relativePath = path12.relative(root, absolutePath).split(path12.sep).join("/");
5844
+ if (!candidate || candidate.includes(`${path13.sep}node_modules${path13.sep}`)) continue;
5845
+ const absolutePath = path13.resolve(candidate);
5846
+ if (!isPathInsideRoot(root, absolutePath) || !fs9.existsSync(absolutePath)) continue;
5847
+ const relativePath = path13.relative(root, absolutePath).split(path13.sep).join("/");
5328
5848
  return {
5329
5849
  absolutePath,
5330
- displayPath: relativePath || path12.basename(absolutePath),
5850
+ displayPath: relativePath || path13.basename(absolutePath),
5331
5851
  line: Number(match[2]),
5332
5852
  column: Number(match[3])
5333
5853
  };
@@ -5336,7 +5856,7 @@ function findStackLocation(stack, root) {
5336
5856
  }
5337
5857
  function createSourceFrame(location) {
5338
5858
  try {
5339
- const sourceLines = fs8.readFileSync(location.absolutePath, "utf8").split(/\r?\n/);
5859
+ const sourceLines = fs9.readFileSync(location.absolutePath, "utf8").split(/\r?\n/);
5340
5860
  if (location.line < 1 || location.line > sourceLines.length) return void 0;
5341
5861
  const start = Math.max(1, location.line - 2);
5342
5862
  const end = Math.min(sourceLines.length, location.line + 2);
@@ -5354,18 +5874,18 @@ function createSourceFrame(location) {
5354
5874
  column: location.column,
5355
5875
  lines
5356
5876
  };
5357
- } catch (e25) {
5877
+ } catch (e33) {
5358
5878
  return void 0;
5359
5879
  }
5360
5880
  }
5361
5881
  function sanitizeStack(stack, root) {
5362
- const normalizedRoot = path12.resolve(root);
5882
+ const normalizedRoot = path13.resolve(root);
5363
5883
  return redactErrorText(stack).split(normalizedRoot).join("<project>").replace(/<project>[^\s)]*/g, (segment) => segment.split("\\").join("/")).split("\n").filter((line, index) => index === 0 || !line.includes("node:internal")).slice(0, 14).join("\n");
5364
5884
  }
5365
5885
  function createDefaultErrorDiagnostics(error, root) {
5366
5886
  const normalizedError = error instanceof Error ? error : new Error(typeof error === "string" ? error : "Unknown server rendering error");
5367
5887
  const rawStack = normalizedError.stack || `${normalizedError.name}: ${normalizedError.message}`;
5368
- const location = findStackLocation(rawStack, path12.resolve(root));
5888
+ const location = findStackLocation(rawStack, path13.resolve(root));
5369
5889
  return {
5370
5890
  name: redactErrorText(normalizedError.name || "Error"),
5371
5891
  message: redactErrorText(normalizedError.message || "Unknown server rendering error"),
@@ -5378,7 +5898,7 @@ function createDefaultErrorDiagnostics(error, root) {
5378
5898
  function canBootFarmIslandsClient(config) {
5379
5899
  const docs = config.docs;
5380
5900
  const docsEnabled = docs === true || typeof docs === "object" && docs !== null && docs.enabled !== false;
5381
- return _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _182 => _182.experimental, 'optionalAccess', _183 => _183.serverComponents])) === "islands" && !docsEnabled && resolveFarmClientPlugins(config.plugins, config.root).length === 0 && !resolveFarmAppClientEntry(config.root, config.srcDir || "src");
5901
+ return _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _217 => _217.experimental, 'optionalAccess', _218 => _218.serverComponents])) === "islands" && !docsEnabled && resolveFarmClientPlugins(config.plugins, config.root).length === 0 && !resolveFarmAppClientEntry(config.root, config.srcDir || "src");
5382
5902
  }
5383
5903
 
5384
5904
  // src/server/renderer.ts
@@ -5488,7 +6008,7 @@ function appendResponseHeader(res, name, value) {
5488
6008
  }
5489
6009
  }
5490
6010
  function requestHeader(req, name) {
5491
- const value = _optionalChain([req, 'access', _184 => _184.headers, 'optionalAccess', _185 => _185[name]]);
6011
+ const value = _optionalChain([req, 'access', _219 => _219.headers, 'optionalAccess', _220 => _220[name]]);
5492
6012
  return Array.isArray(value) ? value[0] : value;
5493
6013
  }
5494
6014
  function appendResponseVary(res, value) {
@@ -5502,7 +6022,7 @@ function appendResponseVary(res, value) {
5502
6022
  function renderI18nAlternateLinks(requestPath, snapshot, options) {
5503
6023
  if (snapshot.routing === "none") return "";
5504
6024
  const url = new URL(requestPath, "http://farm.local");
5505
- return _chunkO27PLNQZcjs.renderFarmLocaleAlternateLinks.call(void 0, url.pathname, snapshot, options);
6025
+ return _chunkUJ3R2AH2cjs.renderFarmLocaleAlternateLinks.call(void 0, url.pathname, snapshot, options);
5506
6026
  }
5507
6027
  var PPR_REFRESH_MAX_ATTEMPTS = 3;
5508
6028
  function createPPRRefreshScript() {
@@ -5597,12 +6117,12 @@ async function parseRouteModuleProps(routeModule, input) {
5597
6117
  }
5598
6118
  const schemas = routeModule.__farmRouteSchemas;
5599
6119
  const params = parseRouteModuleSchema(
5600
- _optionalChain([schemas, 'optionalAccess', _186 => _186.params]),
6120
+ _optionalChain([schemas, 'optionalAccess', _221 => _221.params]),
5601
6121
  input.props.params,
5602
6122
  "params",
5603
6123
  input.routePath
5604
6124
  );
5605
- const search = parseRouteModuleSchema(_optionalChain([schemas, 'optionalAccess', _187 => _187.search]), input.search, "search", input.routePath);
6125
+ const search = parseRouteModuleSchema(_optionalChain([schemas, 'optionalAccess', _222 => _222.search]), input.search, "search", input.routePath);
5606
6126
  return {
5607
6127
  ...input.props,
5608
6128
  params,
@@ -5634,9 +6154,9 @@ function createRouteStateProps(input) {
5634
6154
  function readAppPackageIdentity(root) {
5635
6155
  try {
5636
6156
  return JSON.parse(
5637
- fs9.readFileSync(path13.join(root || process.cwd(), "package.json"), "utf8")
6157
+ fs10.readFileSync(path14.join(root || process.cwd(), "package.json"), "utf8")
5638
6158
  );
5639
- } catch (e26) {
6159
+ } catch (e34) {
5640
6160
  return {};
5641
6161
  }
5642
6162
  }
@@ -5660,7 +6180,7 @@ var ServerRenderer = class {
5660
6180
  } else {
5661
6181
  _chunkXGJVRPYLcjs.uninstallFarmIslandValues.call(void 0, );
5662
6182
  }
5663
- if (_optionalChain([this, 'access', _188 => _188.config, 'access', _189 => _189.notFound, 'optionalAccess', _190 => _190.component, 'optionalAccess', _191 => _191.trim, 'call', _192 => _192()])) {
6183
+ if (_optionalChain([this, 'access', _223 => _223.config, 'access', _224 => _224.notFound, 'optionalAccess', _225 => _225.component, 'optionalAccess', _226 => _226.trim, 'call', _227 => _227()])) {
5664
6184
  resolveFarmNotFoundComponentPath(this.config, _chunk5Y2P454Ocjs.getFarmAppDirectories.call(void 0, this.config));
5665
6185
  }
5666
6186
  const loaded = _chunkRD623KW4cjs.isReactRenderer.call(void 0, this.config.renderer) ? await import("./renderer/react/server.cjs") : this.viteServer ? await _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, this.viteServer, this.config.renderer.server) : await import(_url.pathToFileURL.call(void 0,
@@ -5685,7 +6205,7 @@ var ServerRenderer = class {
5685
6205
  "node"
5686
6206
  );
5687
6207
  this.rendererRuntime = islands && this.islandValues() ? withFarmIslandsRenders(runtime, islands) : runtime;
5688
- _optionalChain([this, 'access', _193 => _193.routeManager, 'access', _194 => _194.setRendererRuntime, 'optionalCall', _195 => _195(this.rendererRuntime)]);
6208
+ _optionalChain([this, 'access', _228 => _228.routeManager, 'access', _229 => _229.setRendererRuntime, 'optionalCall', _230 => _230(this.rendererRuntime)]);
5689
6209
  await this.applyRendererAppSetup();
5690
6210
  }
5691
6211
  /**
@@ -5742,7 +6262,7 @@ var ServerRenderer = class {
5742
6262
  /// Stylesheets the app imported through JS (fontsource packages, component
5743
6263
  /// CSS) that the document must link alongside globals.css — see #658.
5744
6264
  collectDevStyleHrefs() {
5745
- const graph = _optionalChain([this, 'access', _196 => _196.viteServer, 'optionalAccess', _197 => _197.moduleGraph]);
6265
+ const graph = _optionalChain([this, 'access', _231 => _231.viteServer, 'optionalAccess', _232 => _232.moduleGraph]);
5746
6266
  if (!graph) return [];
5747
6267
  return collectDevStylesheetUrls(
5748
6268
  graph.idToModuleMap.values(),
@@ -5767,7 +6287,7 @@ var ServerRenderer = class {
5767
6287
  "data-farm-layout-boundary": "true",
5768
6288
  "data-farm-layout-pattern": pattern,
5769
6289
  ...segment ? { "data-farm-layout-key": segment.key } : {},
5770
- ..._optionalChain([segment, 'optionalAccess', _198 => _198.kept]) ? { "data-farm-layout-kept": "true" } : {},
6290
+ ..._optionalChain([segment, 'optionalAccess', _233 => _233.kept]) ? { "data-farm-layout-kept": "true" } : {},
5771
6291
  style: { display: "contents" }
5772
6292
  },
5773
6293
  layoutElement
@@ -5854,7 +6374,7 @@ var ServerRenderer = class {
5854
6374
  }
5855
6375
  /** Islands mode sends large prop values once, keyed by content (RFC 0003). */
5856
6376
  islandValues() {
5857
- return _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _199 => _199.config, 'access', _200 => _200.experimental, 'optionalAccess', _201 => _201.serverComponents])) === "islands";
6377
+ return _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _234 => _234.config, 'access', _235 => _235.experimental, 'optionalAccess', _236 => _236.serverComponents])) === "islands";
5858
6378
  }
5859
6379
  /**
5860
6380
  * Render the route tree used by client navigation without producing a second
@@ -5929,7 +6449,7 @@ var ServerRenderer = class {
5929
6449
  async runWithRequestContext(request2, fn) {
5930
6450
  return _chunkHNAISJFDcjs._runWithCurrentRequest.call(void 0,
5931
6451
  request2,
5932
- () => _optionalChain([this, 'access', _202 => _202.i18nRuntime, 'optionalAccess', _203 => _203.config, 'access', _204 => _204.enabled]) ? _chunkRVGLYMJMcjs._runWithFarmI18nRequest.call(void 0, this.i18nRuntime, request2, fn, {
6452
+ () => _optionalChain([this, 'access', _237 => _237.i18nRuntime, 'optionalAccess', _238 => _238.config, 'access', _239 => _239.enabled]) ? _chunkRVGLYMJMcjs._runWithFarmI18nRequest.call(void 0, this.i18nRuntime, request2, fn, {
5933
6453
  redirect: false
5934
6454
  }) : fn()
5935
6455
  );
@@ -5941,10 +6461,10 @@ var ServerRenderer = class {
5941
6461
  * Load SSG manifest from build output
5942
6462
  */
5943
6463
  loadSSGManifest() {
5944
- const manifestPath = path13.join(this.config.root, this.config.outDir, "__ssg_manifest.json");
6464
+ const manifestPath = path14.join(this.config.root, this.config.outDir, "__ssg_manifest.json");
5945
6465
  let content;
5946
6466
  try {
5947
- content = fs9.readFileSync(manifestPath, "utf-8");
6467
+ content = fs10.readFileSync(manifestPath, "utf-8");
5948
6468
  } catch (error) {
5949
6469
  if (error.code === "ENOENT") {
5950
6470
  return;
@@ -6077,7 +6597,7 @@ var ServerRenderer = class {
6077
6597
  setImmediate(async () => {
6078
6598
  try {
6079
6599
  const mod = await this.routeManager.loadRouteModule(page.filePath);
6080
- if (!_optionalChain([mod, 'optionalAccess', _205 => _205.default])) return;
6600
+ if (!_optionalChain([mod, 'optionalAccess', _240 => _240.default])) return;
6081
6601
  const { route, layouts } = this.routeManager.matchRoute(page.urlPath);
6082
6602
  const layoutModules = await Promise.all(
6083
6603
  layouts.map((l) => this.routeManager.loadLayoutModule(l.modulePath))
@@ -6091,7 +6611,7 @@ var ServerRenderer = class {
6091
6611
  };
6092
6612
  let pageElement = this.rendererRuntime.createElement(PageComponent, pageProps);
6093
6613
  const pageMetadata = _nullishCoalesce(routeManifest.routes.find(
6094
- (entry) => entry.pattern === _optionalChain([route, 'optionalAccess', _206 => _206.pattern])
6614
+ (entry) => entry.pattern === _optionalChain([route, 'optionalAccess', _241 => _241.pattern])
6095
6615
  ), () => ( {
6096
6616
  shouldHydrate: false,
6097
6617
  islandStrategy: null
@@ -6163,10 +6683,10 @@ var ServerRenderer = class {
6163
6683
  return true;
6164
6684
  }
6165
6685
  try {
6166
- const htmlPath = page.urlPath === "/" ? path13.join(this.config.root, this.config.outDir, "client", "index.html") : path13.join(this.config.root, this.config.outDir, "client", page.urlPath + ".html");
6167
- if (fs9.existsSync(htmlPath)) {
6168
- const stat = fs9.statSync(htmlPath);
6169
- const html = fs9.readFileSync(htmlPath, "utf-8");
6686
+ const htmlPath = page.urlPath === "/" ? path14.join(this.config.root, this.config.outDir, "client", "index.html") : path14.join(this.config.root, this.config.outDir, "client", page.urlPath + ".html");
6687
+ if (fs10.existsSync(htmlPath)) {
6688
+ const stat = fs10.statSync(htmlPath);
6689
+ const html = fs10.readFileSync(htmlPath, "utf-8");
6170
6690
  await this.cacheSSGPage(page, html, {
6171
6691
  document: true,
6172
6692
  createdAt: stat.mtimeMs
@@ -6201,10 +6721,10 @@ var ServerRenderer = class {
6201
6721
  res.setHeader(header.key, header.value);
6202
6722
  }
6203
6723
  const request2 = _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, {
6204
- trustProxy: _optionalChain([this, 'access', _207 => _207.config, 'access', _208 => _208.server, 'optionalAccess', _209 => _209.trustProxy])
6724
+ trustProxy: _optionalChain([this, 'access', _242 => _242.config, 'access', _243 => _243.server, 'optionalAccess', _244 => _244.trustProxy])
6205
6725
  });
6206
6726
  const runtime = this.i18nRuntime;
6207
- if (_optionalChain([runtime, 'optionalAccess', _210 => _210.config, 'access', _211 => _211.enabled])) {
6727
+ if (_optionalChain([runtime, 'optionalAccess', _245 => _245.config, 'access', _246 => _246.enabled])) {
6208
6728
  const resolution = runtime.resolveRequest(request2);
6209
6729
  const varyHeaders = _chunkVOQ7XZZTcjs.getFarmLocaleVaryHeaders.call(void 0, runtime.config, resolution);
6210
6730
  for (const header of varyHeaders) appendResponseVary(res, header);
@@ -6250,7 +6770,7 @@ var ServerRenderer = class {
6250
6770
  });
6251
6771
  };
6252
6772
  try {
6253
- const url = _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _212 => _212.config, 'access', _213 => _213.server, 'optionalAccess', _214 => _214.trustProxy]) });
6773
+ const url = _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _247 => _247.config, 'access', _248 => _248.server, 'optionalAccess', _249 => _249.trustProxy]) });
6254
6774
  pathname = url.pathname;
6255
6775
  _chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, { type: "render.start", route: pathname, pathname });
6256
6776
  searchParamsObject = _chunkSUCDVKUBcjs.searchParamsToObject.call(void 0, url.searchParams);
@@ -6313,7 +6833,7 @@ var ServerRenderer = class {
6313
6833
  layouts = match.layouts;
6314
6834
  routeSlots = _nullishCoalesce(match.slots, () => ( []));
6315
6835
  if (!route) {
6316
- if (_chunkQAS7KE7Jcjs.isFarmDefaultMCPPathname.call(void 0, pathname) && this.getDefaultMCPServer()) {
6836
+ if (_chunkY5TOT5F6cjs.isFarmDefaultMCPPathname.call(void 0, pathname) && this.getDefaultMCPServer()) {
6317
6837
  await this.renderDefaultMCP(req, res);
6318
6838
  completeRender(res.statusCode || 200, pathname);
6319
6839
  return;
@@ -6330,13 +6850,13 @@ var ServerRenderer = class {
6330
6850
  params
6331
6851
  });
6332
6852
  let actionRequest;
6333
- if (req.method === "POST" && _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _215 => _215.config, 'access', _216 => _216.experimental, 'optionalAccess', _217 => _217.serverComponents])) === "islands") {
6853
+ if (req.method === "POST" && _chunkBPNOYILCcjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _250 => _250.config, 'access', _251 => _251.experimental, 'optionalAccess', _252 => _252.serverComponents])) === "islands") {
6334
6854
  await Promise.all([
6335
6855
  this.routeManager.loadRouteModule(route.modulePath),
6336
6856
  ...layouts.map((layout) => this.routeManager.loadLayoutModule(layout.modulePath))
6337
6857
  ]);
6338
6858
  actionRequest = _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, {
6339
- trustProxy: _optionalChain([this, 'access', _218 => _218.config, 'access', _219 => _219.server, 'optionalAccess', _220 => _220.trustProxy])
6859
+ trustProxy: _optionalChain([this, 'access', _253 => _253.config, 'access', _254 => _254.server, 'optionalAccess', _255 => _255.trustProxy])
6340
6860
  });
6341
6861
  const actionResponse = await _chunkCLFEQGETcjs.handleFarmFormActionRequest.call(void 0,
6342
6862
  actionRequest,
@@ -6356,7 +6876,7 @@ var ServerRenderer = class {
6356
6876
  exposedOnly: true
6357
6877
  });
6358
6878
  const currentRequest = _nullishCoalesce(actionRequest, () => ( _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, {
6359
- trustProxy: _optionalChain([this, 'access', _221 => _221.config, 'access', _222 => _222.server, 'optionalAccess', _223 => _223.trustProxy])
6879
+ trustProxy: _optionalChain([this, 'access', _256 => _256.config, 'access', _257 => _257.server, 'optionalAccess', _258 => _258.trustProxy])
6360
6880
  })));
6361
6881
  const routeContext = await this.resolveRouteContext({
6362
6882
  request: currentRequest,
@@ -6398,11 +6918,11 @@ var ServerRenderer = class {
6398
6918
  searchParams: _chunkSUCDVKUBcjs.createFarmSearchParams.call(void 0, searchParamsObject),
6399
6919
  error
6400
6920
  };
6401
- if (_chunk7JUIK547cjs.isFarmNotFoundError.call(void 0, error) && _optionalChain([programmaticRouteComponents, 'optionalAccess', _224 => _224.notFound])) {
6921
+ if (_chunk7JUIK547cjs.isFarmNotFoundError.call(void 0, error) && _optionalChain([programmaticRouteComponents, 'optionalAccess', _259 => _259.notFound])) {
6402
6922
  res.statusCode = 404;
6403
6923
  PageComponent = programmaticRouteComponents.notFound;
6404
6924
  pageProps = routeStateProps;
6405
- } else if (_optionalChain([programmaticRouteComponents, 'optionalAccess', _225 => _225.error])) {
6925
+ } else if (_optionalChain([programmaticRouteComponents, 'optionalAccess', _260 => _260.error])) {
6406
6926
  res.statusCode = 500;
6407
6927
  PageComponent = programmaticRouteComponents.error;
6408
6928
  pageProps = routeStateProps;
@@ -6413,7 +6933,7 @@ var ServerRenderer = class {
6413
6933
  const renderingConfig = await _chunkX4K7TYN6cjs.resolveRouteRenderingConfigFromFile.call(void 0,
6414
6934
  routeModule,
6415
6935
  route.modulePath,
6416
- { experimentalPPR: _optionalChain([this, 'access', _226 => _226.config, 'access', _227 => _227.experimental, 'optionalAccess', _228 => _228.ppr]) === true }
6936
+ { experimentalPPR: _optionalChain([this, 'access', _261 => _261.config, 'access', _262 => _262.experimental, 'optionalAccess', _263 => _263.ppr]) === true }
6417
6937
  );
6418
6938
  const pprBypassReason = renderingConfig.ppr ? this.getPPRShellBypassReason(req, middlewareMap, middlewareContext, pluginExposedContext) : void 0;
6419
6939
  const islandsNavigationRequest = Boolean(
@@ -6424,7 +6944,7 @@ var ServerRenderer = class {
6424
6944
  const pprShellOptions = canCachePPRShell ? {
6425
6945
  pathname,
6426
6946
  search: url.search,
6427
- locale: _nullishCoalesce(_optionalChain([pprI18nSnapshot, 'optionalAccess', _229 => _229.locale]), () => ( "")),
6947
+ locale: _nullishCoalesce(_optionalChain([pprI18nSnapshot, 'optionalAccess', _264 => _264.locale]), () => ( "")),
6428
6948
  origin: pprI18nSnapshot && pprI18nSnapshot.routing !== "none" ? url.origin : "",
6429
6949
  revalidate: renderingConfig.revalidate
6430
6950
  } : void 0;
@@ -6547,20 +7067,20 @@ var ServerRenderer = class {
6547
7067
  if (moduleMetadata.suppressedAsyncHydration) {
6548
7068
  warnSuppressedAsyncHydrationOnce(
6549
7069
  route.modulePath,
6550
- _optionalChain([routeManifestEntry, 'optionalAccess', _230 => _230.suppressedAsyncHydrationReason])
7070
+ _optionalChain([routeManifestEntry, 'optionalAccess', _265 => _265.suppressedAsyncHydrationReason])
6551
7071
  );
6552
7072
  }
6553
7073
  const layoutHydrationMetadata = layouts.map((layout) => {
6554
7074
  const manifestEntry = routeManifest.layouts.find(
6555
7075
  (entry) => entry.pattern === layout.pattern
6556
7076
  );
6557
- if (_optionalChain([manifestEntry, 'optionalAccess', _231 => _231.suppressedAsyncHydration])) {
7077
+ if (_optionalChain([manifestEntry, 'optionalAccess', _266 => _266.suppressedAsyncHydration])) {
6558
7078
  warnSuppressedAsyncHydrationOnce(
6559
7079
  layout.modulePath,
6560
7080
  manifestEntry.suppressedAsyncHydrationReason
6561
7081
  );
6562
7082
  }
6563
- if (typeof _optionalChain([manifestEntry, 'optionalAccess', _232 => _232.shouldHydrate]) === "boolean") {
7083
+ if (typeof _optionalChain([manifestEntry, 'optionalAccess', _267 => _267.shouldHydrate]) === "boolean") {
6564
7084
  return {
6565
7085
  isClientComponent: manifestEntry.isClientComponent === true,
6566
7086
  shouldHydrate: manifestEntry.shouldHydrate,
@@ -6581,11 +7101,11 @@ var ServerRenderer = class {
6581
7101
  const clientLayouts = layouts.map((layout, index) => ({
6582
7102
  pattern: layout.pattern,
6583
7103
  modulePath: _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, layout.modulePath, this.config.root),
6584
- shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access', _233 => _233[index], 'optionalAccess', _234 => _234.shouldHydrate]) === true,
6585
- islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access', _235 => _235[index], 'optionalAccess', _236 => _236.islandStrategy]), () => ( null)),
6586
- ..._optionalChain([layoutHydrationMetadata, 'access', _237 => _237[index], 'optionalAccess', _238 => _238.hasIsolatedClientBoundaries]) === true ? { hasIsolatedClientBoundaries: true } : {},
7104
+ shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access', _268 => _268[index], 'optionalAccess', _269 => _269.shouldHydrate]) === true,
7105
+ islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access', _270 => _270[index], 'optionalAccess', _271 => _271.islandStrategy]), () => ( null)),
7106
+ ..._optionalChain([layoutHydrationMetadata, 'access', _272 => _272[index], 'optionalAccess', _273 => _273.hasIsolatedClientBoundaries]) === true ? { hasIsolatedClientBoundaries: true } : {},
6587
7107
  // Islands mode: the browser rebuilds this layout from its tree, not its module.
6588
- ...shouldHydrateLayout && _optionalChain([layoutHydrationMetadata, 'access', _239 => _239[index], 'optionalAccess', _240 => _240.serverTree]) === true ? { serverTree: true } : {}
7108
+ ...shouldHydrateLayout && _optionalChain([layoutHydrationMetadata, 'access', _274 => _274[index], 'optionalAccess', _275 => _275.serverTree]) === true ? { serverTree: true } : {}
6589
7109
  }));
6590
7110
  const hydrationStrategies = [
6591
7111
  ...shouldHydrate && moduleMetadata.islandStrategy ? [moduleMetadata.islandStrategy] : [],
@@ -6599,9 +7119,9 @@ var ServerRenderer = class {
6599
7119
  layouts.map((layout, index) => ({
6600
7120
  pattern: layout.pattern,
6601
7121
  modulePath: layout.modulePath,
6602
- shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access', _241 => _241[index], 'optionalAccess', _242 => _242.shouldHydrate]) === true,
6603
- hasIsolatedClientBoundaries: _optionalChain([layoutHydrationMetadata, 'access', _243 => _243[index], 'optionalAccess', _244 => _244.hasIsolatedClientBoundaries]) === true,
6604
- islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access', _245 => _245[index], 'optionalAccess', _246 => _246.islandStrategy]), () => ( null))
7122
+ shouldHydrate: _optionalChain([layoutHydrationMetadata, 'access', _276 => _276[index], 'optionalAccess', _277 => _277.shouldHydrate]) === true,
7123
+ hasIsolatedClientBoundaries: _optionalChain([layoutHydrationMetadata, 'access', _278 => _278[index], 'optionalAccess', _279 => _279.hasIsolatedClientBoundaries]) === true,
7124
+ islandStrategy: _nullishCoalesce(_optionalChain([layoutHydrationMetadata, 'access', _280 => _280[index], 'optionalAccess', _281 => _281.islandStrategy]), () => ( null))
6605
7125
  })),
6606
7126
  this.config.root || process.cwd(),
6607
7127
  true
@@ -6609,7 +7129,7 @@ var ServerRenderer = class {
6609
7129
  const hasHydratableRouteSlots = renderedRouteSlots.some(
6610
7130
  (slot) => slot.isClientComponent || slot.shouldHydrate
6611
7131
  );
6612
- const hasIsolatedClientBoundaries = _optionalChain([routeManifestEntry, 'optionalAccess', _247 => _247.hasIsolatedClientBoundaries]) === true || layoutHydrationMetadata.some((metadata) => metadata.hasIsolatedClientBoundaries === true);
7132
+ const hasIsolatedClientBoundaries = _optionalChain([routeManifestEntry, 'optionalAccess', _282 => _282.hasIsolatedClientBoundaries]) === true || layoutHydrationMetadata.some((metadata) => metadata.hasIsolatedClientBoundaries === true);
6613
7133
  req.__FARM_PAGE_PATH__ = route.modulePath;
6614
7134
  req.__FARM_ROUTE__ = pathname;
6615
7135
  req.__FARM_IS_CLIENT_COMPONENT__ = isClientComponent;
@@ -6622,7 +7142,7 @@ var ServerRenderer = class {
6622
7142
  req.__FARM_SHOULD_HYDRATE__ = shouldHydrate || shouldHydrateLayout || hasIsolatedClientBoundaries;
6623
7143
  req.__FARM_ISLAND_STRATEGY__ = hydrationIslandStrategy;
6624
7144
  req.__FARM_HAS_HYDRATABLE_ROUTE_SLOTS__ = hasHydratableRouteSlots;
6625
- req.__FARM_LOADING_MODULE_PATH__ = _optionalChain([loadingBoundaryEntry, 'optionalAccess', _248 => _248.modulePath]) ? _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, loadingBoundaryEntry.modulePath, this.config.root) : null;
7145
+ req.__FARM_LOADING_MODULE_PATH__ = _optionalChain([loadingBoundaryEntry, 'optionalAccess', _283 => _283.modulePath]) ? _chunkQMNWKQL4cjs.toViteModuleId.call(void 0, loadingBoundaryEntry.modulePath, this.config.root) : null;
6626
7146
  req.__FARM_ROUTE_SLOTS__ = renderedRouteSlots.map((slot) => ({
6627
7147
  name: slot.name,
6628
7148
  ownerPattern: slot.ownerPattern,
@@ -6694,7 +7214,7 @@ var ServerRenderer = class {
6694
7214
  } else if (shouldHydrateLayout && !(isClientComponent || shouldHydrate) && this.rendererRuntime.isolateServerPageGraph) {
6695
7215
  pageElement = await this.isolateServerPage(
6696
7216
  pageElement,
6697
- _optionalChain([routeManifestEntry, 'optionalAccess', _249 => _249.serverTree]) === true
7217
+ _optionalChain([routeManifestEntry, 'optionalAccess', _284 => _284.serverTree]) === true
6698
7218
  );
6699
7219
  }
6700
7220
  pageElement = this.createPageBoundary(pageElement, {
@@ -6737,7 +7257,7 @@ var ServerRenderer = class {
6737
7257
  );
6738
7258
  slotProps[slot.name] = slotElement;
6739
7259
  }
6740
- wrappedElement = shouldHydrateLayout && _optionalChain([layoutHydrationMetadata, 'access', _250 => _250[i], 'optionalAccess', _251 => _251.serverTree]) === true && islands && this.islandValues() ? await islands.renderFarmServerTreeLayout(
7260
+ wrappedElement = shouldHydrateLayout && _optionalChain([layoutHydrationMetadata, 'access', _285 => _285[i], 'optionalAccess', _286 => _286.serverTree]) === true && islands && this.islandValues() ? await islands.renderFarmServerTreeLayout(
6741
7261
  LayoutComponent,
6742
7262
  { params },
6743
7263
  { children: wrappedElement, ...slotProps },
@@ -6872,7 +7392,7 @@ var ServerRenderer = class {
6872
7392
  }
6873
7393
  }
6874
7394
  _chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, { type: "render.error", route: pathname, error });
6875
- const errorStatus = _chunkO27PLNQZcjs.resolveDefaultErrorStatus.call(void 0, error);
7395
+ const errorStatus = _chunkUJ3R2AH2cjs.resolveDefaultErrorStatus.call(void 0, error);
6876
7396
  if (pprRefreshRoute) {
6877
7397
  _chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
6878
7398
  type: "ppr.refresh.error",
@@ -6916,7 +7436,7 @@ var ServerRenderer = class {
6916
7436
  const rendererCapabilities = _chunkRD623KW4cjs.getFarmRendererCapabilities.call(void 0, this.config.renderer);
6917
7437
  if (!rendererCapabilities.functionComponents) {
6918
7438
  throw new Error(
6919
- `Integration provider \`${provider.name}\` requires a renderer that can host function components; \`${_nullishCoalesce(_optionalChain([this, 'access', _252 => _252.config, 'access', _253 => _253.renderer, 'optionalAccess', _254 => _254.name]), () => ( "the configured renderer"))}\` cannot.`
7439
+ `Integration provider \`${provider.name}\` requires a renderer that can host function components; \`${_nullishCoalesce(_optionalChain([this, 'access', _287 => _287.config, 'access', _288 => _288.renderer, 'optionalAccess', _289 => _289.name]), () => ( "the configured renderer"))}\` cannot.`
6920
7440
  );
6921
7441
  }
6922
7442
  if (provider.type === "clerk" && !_chunkRD623KW4cjs.isReactRenderer.call(void 0, this.config.renderer)) {
@@ -6929,11 +7449,11 @@ var ServerRenderer = class {
6929
7449
  if (_chunkI32V5CZLcjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) {
6930
7450
  providerSourceModule = provider.component.module;
6931
7451
  const providerModuleId = provider.component.module.startsWith(".") ? _chunkQMNWKQL4cjs.toViteModuleId.call(void 0,
6932
- path13.resolve(this.config.root, provider.component.module),
7452
+ path14.resolve(this.config.root, provider.component.module),
6933
7453
  this.config.root
6934
7454
  ) : provider.component.module;
6935
7455
  const providerModule = this.viteServer ? await _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, this.viteServer, providerModuleId) : await importRuntimeModule(
6936
- provider.component.module.startsWith(".") ? _url.pathToFileURL.call(void 0, path13.resolve(this.config.root, provider.component.module)).href : provider.component.module
7456
+ provider.component.module.startsWith(".") ? _url.pathToFileURL.call(void 0, path14.resolve(this.config.root, provider.component.module)).href : provider.component.module
6937
7457
  );
6938
7458
  ProviderComponent = providerModule[provider.component.export || "default"];
6939
7459
  } else if (typeof provider.component === "function") {
@@ -6955,7 +7475,7 @@ var ServerRenderer = class {
6955
7475
  }
6956
7476
  if (provider.type !== "clerk" && typeof this.rendererRuntime.markFunctionComponent === "function" && !isRendererCompiledComponent(
6957
7477
  _nullishCoalesce(providerSourceModule, () => ( "")),
6958
- _chunkRD623KW4cjs.resolveFarmComponentExtensions.call(void 0, _optionalChain([this, 'access', _255 => _255.config, 'access', _256 => _256.renderer, 'optionalAccess', _257 => _257.componentExtensions]))
7478
+ _chunkRD623KW4cjs.resolveFarmComponentExtensions.call(void 0, _optionalChain([this, 'access', _290 => _290.config, 'access', _291 => _291.renderer, 'optionalAccess', _292 => _292.componentExtensions]))
6959
7479
  )) {
6960
7480
  ProviderComponent = this.rendererRuntime.markFunctionComponent(ProviderComponent);
6961
7481
  }
@@ -7024,7 +7544,7 @@ var ServerRenderer = class {
7024
7544
  );
7025
7545
  metadata = _chunk6IOZPJ3Icjs.addMetadataMarkdownAlternate.call(void 0,
7026
7546
  metadata,
7027
- _chunkLT4VAF5Zcjs.getFarmMarkdownAlternatePath.call(void 0, _chunkLT4VAF5Zcjs.resolveMarkdownConfig.call(void 0, this.config.md), publicPathname)
7547
+ _chunk2C5L5RPMcjs.getFarmMarkdownAlternatePath.call(void 0, _chunk2C5L5RPMcjs.resolveMarkdownConfig.call(void 0, this.config.md), publicPathname)
7028
7548
  );
7029
7549
  return metadata;
7030
7550
  }
@@ -7082,7 +7602,7 @@ var ServerRenderer = class {
7082
7602
  );
7083
7603
  }
7084
7604
  const request2 = _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, {
7085
- trustProxy: _optionalChain([this, 'access', _258 => _258.config, 'access', _259 => _259.server, 'optionalAccess', _260 => _260.trustProxy])
7605
+ trustProxy: _optionalChain([this, 'access', _293 => _293.config, 'access', _294 => _294.server, 'optionalAccess', _295 => _295.trustProxy])
7086
7606
  });
7087
7607
  const url = new URL(request2.url);
7088
7608
  const llmsContext = match.metadata.kind === "llms" || match.metadata.kind === "llms-full" ? await this.createLlmsTxtContext(request2, {
@@ -7096,11 +7616,11 @@ var ServerRenderer = class {
7096
7616
  path: match.routePath,
7097
7617
  ...llmsContext
7098
7618
  }) : routeModule.default;
7099
- const body = match.metadata.kind === "llms-full" && !(value instanceof Response) ? await _chunkMEQN6DDAcjs.renderFarmLlmsFullTxt.call(void 0, value, {
7619
+ const body = match.metadata.kind === "llms-full" && !(value instanceof Response) ? await _chunkFJWN7RV4cjs.renderFarmLlmsFullTxt.call(void 0, value, {
7100
7620
  origin: url.origin,
7101
7621
  readMarkdown: llmsContext.markdown
7102
7622
  }) : value;
7103
- const response = _chunkO27PLNQZcjs.createFarmMetadataRouteResponse.call(void 0, match.metadata.kind, body, routeModule, {
7623
+ const response = _chunkUJ3R2AH2cjs.createFarmMetadataRouteResponse.call(void 0, match.metadata.kind, body, routeModule, {
7104
7624
  method,
7105
7625
  request: request2
7106
7626
  });
@@ -7118,7 +7638,7 @@ var ServerRenderer = class {
7118
7638
  }
7119
7639
  /** `/llms.txt` and `/llms-full.txt` from `agent.llmsTxt` when no file route owns them. */
7120
7640
  getGeneratedLlmsKind(pathname) {
7121
- const config = _chunkMEQN6DDAcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _261 => _261.config, 'access', _262 => _262.agent, 'optionalAccess', _263 => _263.llmsTxt]));
7641
+ const config = _chunkFJWN7RV4cjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _296 => _296.config, 'access', _297 => _297.agent, 'optionalAccess', _298 => _298.llmsTxt]));
7122
7642
  if (!config.enabled) return null;
7123
7643
  if (pathname === "/llms.txt") return "llms";
7124
7644
  return pathname === "/llms-full.txt" && config.full ? "llms-full" : null;
@@ -7126,17 +7646,17 @@ var ServerRenderer = class {
7126
7646
  async renderGeneratedLlmsTxt(req, res, kind) {
7127
7647
  try {
7128
7648
  const request2 = _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, {
7129
- trustProxy: _optionalChain([this, 'access', _264 => _264.config, 'access', _265 => _265.server, 'optionalAccess', _266 => _266.trustProxy])
7649
+ trustProxy: _optionalChain([this, 'access', _299 => _299.config, 'access', _300 => _300.server, 'optionalAccess', _301 => _301.trustProxy])
7130
7650
  });
7131
- const config = _chunkMEQN6DDAcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _267 => _267.config, 'access', _268 => _268.agent, 'optionalAccess', _269 => _269.llmsTxt]));
7651
+ const config = _chunkFJWN7RV4cjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _302 => _302.config, 'access', _303 => _303.agent, 'optionalAccess', _304 => _304.llmsTxt]));
7132
7652
  const context = await this.createLlmsTxtContext(request2, { full: kind === "llms-full", req });
7133
- const body = kind === "llms-full" ? await _chunkMEQN6DDAcjs.renderFarmLlmsFullTxt.call(void 0, context.defaults, {
7653
+ const body = kind === "llms-full" ? await _chunkFJWN7RV4cjs.renderFarmLlmsFullTxt.call(void 0, context.defaults, {
7134
7654
  origin: new URL(request2.url).origin,
7135
7655
  readMarkdown: context.markdown
7136
7656
  }) : context.defaults;
7137
7657
  await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0,
7138
7658
  res,
7139
- _chunkO27PLNQZcjs.createFarmMetadataRouteResponse.call(void 0,
7659
+ _chunkUJ3R2AH2cjs.createFarmMetadataRouteResponse.call(void 0,
7140
7660
  kind,
7141
7661
  body,
7142
7662
  { revalidate: config.revalidate },
@@ -7155,23 +7675,23 @@ var ServerRenderer = class {
7155
7675
  }
7156
7676
  }
7157
7677
  getAgentCrawlers() {
7158
- return _chunkDZPR2W6Ucjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([this, 'access', _270 => _270.config, 'access', _271 => _271.agent, 'optionalAccess', _272 => _272.crawlers]));
7678
+ return _chunkO6L3YYPMcjs.resolveFarmAgentCrawlers.call(void 0, _optionalChain([this, 'access', _305 => _305.config, 'access', _306 => _306.agent, 'optionalAccess', _307 => _307.crawlers]));
7159
7679
  }
7160
7680
  /** `/robots.txt` from `agent.crawlers` when no robots.ts owns it. */
7161
7681
  async renderGeneratedRobotsTxt(req, res) {
7162
7682
  try {
7163
- const sitemapPath = _optionalChain([this, 'access', _273 => _273.routeManager, 'access', _274 => _274.matchMetadataRoute, 'call', _275 => _275("/sitemap.xml"), 'optionalAccess', _276 => _276.metadata, 'access', _277 => _277.kind]) === "sitemap" || this.getAgentSitemap().enabled ? "/sitemap.xml" : void 0;
7683
+ const sitemapPath = _optionalChain([this, 'access', _308 => _308.routeManager, 'access', _309 => _309.matchMetadataRoute, 'call', _310 => _310("/sitemap.xml"), 'optionalAccess', _311 => _311.metadata, 'access', _312 => _312.kind]) === "sitemap" || this.getAgentSitemap().enabled ? "/sitemap.xml" : void 0;
7164
7684
  const rootLayout = this.routeManager.getLayouts().get("/");
7165
7685
  const rootMetadata = sitemapPath && rootLayout ? (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).metadata : void 0;
7166
- const robots = _chunkDZPR2W6Ucjs.createFarmAgentRobots.call(void 0, {
7686
+ const robots = _chunkO6L3YYPMcjs.createFarmAgentRobots.call(void 0, {
7167
7687
  crawlers: this.getAgentCrawlers(),
7168
7688
  sitemapPath,
7169
- metadataBase: _optionalChain([rootMetadata, 'optionalAccess', _278 => _278.metadataBase]),
7689
+ metadataBase: _optionalChain([rootMetadata, 'optionalAccess', _313 => _313.metadataBase]),
7170
7690
  basePath: this.config.basePath
7171
7691
  });
7172
7692
  await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0,
7173
7693
  res,
7174
- _chunkO27PLNQZcjs.createFarmMetadataRouteResponse.call(void 0, "robots", robots, {}, { method: req.method })
7694
+ _chunkUJ3R2AH2cjs.createFarmMetadataRouteResponse.call(void 0, "robots", robots, {}, { method: req.method })
7175
7695
  );
7176
7696
  } catch (error) {
7177
7697
  _chunkQMNWKQL4cjs.logger.error(`Generated robots.txt failed: ${error}`);
@@ -7185,13 +7705,13 @@ var ServerRenderer = class {
7185
7705
  }
7186
7706
  }
7187
7707
  getAgentSitemap() {
7188
- return _chunkDZPR2W6Ucjs.resolveFarmAgentSitemap.call(void 0, _optionalChain([this, 'access', _279 => _279.config, 'access', _280 => _280.agent, 'optionalAccess', _281 => _281.sitemap]));
7708
+ return _chunkO6L3YYPMcjs.resolveFarmAgentSitemap.call(void 0, _optionalChain([this, 'access', _314 => _314.config, 'access', _315 => _315.agent, 'optionalAccess', _316 => _316.sitemap]));
7189
7709
  }
7190
7710
  /** `/sitemap.xml` from `agent.sitemap` when no sitemap.ts owns it. */
7191
7711
  async renderGeneratedSitemap(req, res) {
7192
7712
  try {
7193
7713
  const request2 = _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, {
7194
- trustProxy: _optionalChain([this, 'access', _282 => _282.config, 'access', _283 => _283.server, 'optionalAccess', _284 => _284.trustProxy])
7714
+ trustProxy: _optionalChain([this, 'access', _317 => _317.config, 'access', _318 => _318.server, 'optionalAccess', _319 => _319.trustProxy])
7195
7715
  });
7196
7716
  const sources = await Promise.all(
7197
7717
  this.getAgentListedRoutes().map(async ([pattern, route]) => {
@@ -7200,22 +7720,22 @@ var ServerRenderer = class {
7200
7720
  _chunkQMNWKQL4cjs.logger.warn(`Could not read metadata for ${pattern} in sitemap.xml: ${error}`);
7201
7721
  return void 0;
7202
7722
  }),
7203
- fs9.promises.stat(route.modulePath).catch(() => void 0)
7723
+ fs10.promises.stat(route.modulePath).catch(() => void 0)
7204
7724
  ]);
7205
- return { pattern, module, lastModified: _optionalChain([stat, 'optionalAccess', _285 => _285.mtime, 'access', _286 => _286.toISOString, 'call', _287 => _287()]) };
7725
+ return { pattern, module, lastModified: _optionalChain([stat, 'optionalAccess', _320 => _320.mtime, 'access', _321 => _321.toISOString, 'call', _322 => _322()]) };
7206
7726
  })
7207
7727
  );
7208
7728
  const rootLayout = this.routeManager.getLayouts().get("/");
7209
7729
  const rootMetadata = rootLayout ? (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).metadata : void 0;
7210
- const sitemap = _chunkDZPR2W6Ucjs.createFarmDefaultSitemap.call(void 0, sources, {
7730
+ const sitemap = _chunkO6L3YYPMcjs.createFarmDefaultSitemap.call(void 0, sources, {
7211
7731
  origin: new URL(request2.url).origin,
7212
7732
  config: this.getAgentSitemap(),
7213
- metadataBase: _optionalChain([rootMetadata, 'optionalAccess', _288 => _288.metadataBase]),
7733
+ metadataBase: _optionalChain([rootMetadata, 'optionalAccess', _323 => _323.metadataBase]),
7214
7734
  basePath: this.config.basePath
7215
7735
  });
7216
7736
  await _chunkYIHRZBD7cjs.sendWebResponse.call(void 0,
7217
7737
  res,
7218
- _chunkO27PLNQZcjs.createFarmMetadataRouteResponse.call(void 0, "sitemap", sitemap, {}, { method: req.method })
7738
+ _chunkUJ3R2AH2cjs.createFarmMetadataRouteResponse.call(void 0, "sitemap", sitemap, {}, { method: req.method })
7219
7739
  );
7220
7740
  } catch (error) {
7221
7741
  _chunkQMNWKQL4cjs.logger.error(`Generated sitemap.xml failed: ${error}`);
@@ -7242,9 +7762,9 @@ var ServerRenderer = class {
7242
7762
  * matcher) covers, as the production build decides.
7243
7763
  */
7244
7764
  getAgentListedRoutes() {
7245
- const guards = { config: this.config, middlewareRoutes: _nullishCoalesce(_optionalChain([this, 'access', _289 => _289.middlewareRoutes, 'optionalCall', _290 => _290()]), () => ( [])) };
7765
+ const guards = { config: this.config, middlewareRoutes: _nullishCoalesce(_optionalChain([this, 'access', _324 => _324.middlewareRoutes, 'optionalCall', _325 => _325()]), () => ( [])) };
7246
7766
  return [...this.routeManager.getRoutes()].filter(
7247
- ([pattern]) => !pattern.includes("[") && !_chunkO27PLNQZcjs.farmPathGuardCoversPage.call(void 0, guards, pattern)
7767
+ ([pattern]) => !pattern.includes("[") && !_chunkUJ3R2AH2cjs.farmPathGuardCoversPage.call(void 0, guards, pattern)
7248
7768
  );
7249
7769
  }
7250
7770
  /**
@@ -7253,20 +7773,20 @@ var ServerRenderer = class {
7253
7773
  * or a registered server such as the docs engine's. Production applies the same rules.
7254
7774
  */
7255
7775
  getDefaultMCPServer() {
7256
- if (_optionalChain([this, 'access', _291 => _291.config, 'access', _292 => _292.agent, 'optionalAccess', _293 => _293.mcp]) !== true || _chunkQAS7KE7Jcjs.farmConfigMountsMCP.call(void 0, this.config)) return void 0;
7257
- if (_optionalChain([this, 'access', _294 => _294.apiRouteExists, 'optionalCall', _295 => _295("/api/mcp")])) return void 0;
7258
- if (this.routeManager.matchRoute(_chunkQAS7KE7Jcjs.FARM_DEFAULT_MCP_PATH).route) return void 0;
7259
- _nullishCoalesce(this.defaultMCPServer, () => ( (this.defaultMCPServer = _chunkQAS7KE7Jcjs.createFarmDefaultMCPServer.call(void 0,
7776
+ if (_optionalChain([this, 'access', _326 => _326.config, 'access', _327 => _327.agent, 'optionalAccess', _328 => _328.mcp]) !== true || _chunkY5TOT5F6cjs.farmConfigMountsMCP.call(void 0, this.config)) return void 0;
7777
+ if (_optionalChain([this, 'access', _329 => _329.apiRouteExists, 'optionalCall', _330 => _330("/api/mcp")])) return void 0;
7778
+ if (this.routeManager.matchRoute(_chunkY5TOT5F6cjs.FARM_DEFAULT_MCP_PATH).route) return void 0;
7779
+ _nullishCoalesce(this.defaultMCPServer, () => ( (this.defaultMCPServer = _chunkY5TOT5F6cjs.createFarmDefaultMCPServer.call(void 0,
7260
7780
  readAppPackageIdentity(this.config.root),
7261
- _chunkSM25ZC4Scjs.FARM_VERSION
7781
+ _chunkO2XFIPNLcjs.FARM_VERSION
7262
7782
  ))));
7263
- return _chunkQAS7KE7Jcjs.resolveFarmDefaultMCPServer.call(void 0, this.defaultMCPServer);
7783
+ return _chunkY5TOT5F6cjs.resolveFarmDefaultMCPServer.call(void 0, this.defaultMCPServer);
7264
7784
  }
7265
7785
  async renderDefaultMCP(req, res) {
7266
7786
  const server = this.getDefaultMCPServer();
7267
- const request2 = _nullishCoalesce(_chunkHNAISJFDcjs.getCurrentRequestOrNull.call(void 0, ), () => ( _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _296 => _296.config, 'access', _297 => _297.server, 'optionalAccess', _298 => _298.trustProxy]) })));
7787
+ const request2 = _nullishCoalesce(_chunkHNAISJFDcjs.getCurrentRequestOrNull.call(void 0, ), () => ( _chunkHNAISJFDcjs.createWebRequestFromFarmRequest.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _331 => _331.config, 'access', _332 => _332.server, 'optionalAccess', _333 => _333.trustProxy]) })));
7268
7788
  try {
7269
- const { handleFarmDefaultMCPRequest } = await import("./agent-mcp-handler-OV4WRFBL.cjs");
7789
+ const { handleFarmDefaultMCPRequest } = await import("./agent-mcp-handler-OXT73ZBY.cjs");
7270
7790
  const origin = new URL(request2.url).origin;
7271
7791
  const response = await handleFarmDefaultMCPRequest(request2, {
7272
7792
  server,
@@ -7280,10 +7800,10 @@ var ServerRenderer = class {
7280
7800
  module: await this.routeManager.loadRouteModule(route.modulePath).catch(() => ({ __farmRouteGuard: true }))
7281
7801
  }))
7282
7802
  );
7283
- return _chunkQAS7KE7Jcjs.collectFarmDefaultMCPPages.call(void 0, sources, {
7803
+ return _chunkY5TOT5F6cjs.collectFarmDefaultMCPPages.call(void 0, sources, {
7284
7804
  origin,
7285
7805
  basePath: this.config.basePath,
7286
- markdown: _chunkLT4VAF5Zcjs.resolveMarkdownConfig.call(void 0, this.config.md)
7806
+ markdown: _chunk2C5L5RPMcjs.resolveMarkdownConfig.call(void 0, this.config.md)
7287
7807
  });
7288
7808
  },
7289
7809
  // Pages are read through this server's own socket, with no cookies, as llms-full.txt does.
@@ -7307,7 +7827,7 @@ var ServerRenderer = class {
7307
7827
  }
7308
7828
  /** Same inputs the production server gives llms.txt: static pages and root metadata. */
7309
7829
  async createLlmsTxtContext(request2, options = {}) {
7310
- const config = _chunkMEQN6DDAcjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _299 => _299.config, 'access', _300 => _300.agent, 'optionalAccess', _301 => _301.llmsTxt]));
7830
+ const config = _chunkFJWN7RV4cjs.resolveFarmLlmsTxtConfig.call(void 0, _optionalChain([this, 'access', _334 => _334.config, 'access', _335 => _335.agent, 'optionalAccess', _336 => _336.llmsTxt]));
7311
7831
  const origin = new URL(request2.url).origin;
7312
7832
  const sources = await Promise.all(
7313
7833
  this.getAgentListedRoutes().map(async ([pattern, route]) => {
@@ -7323,24 +7843,24 @@ var ServerRenderer = class {
7323
7843
  );
7324
7844
  const rootLayout = this.routeManager.getLayouts().get("/");
7325
7845
  const rootMetadata = rootLayout ? (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).metadata : void 0;
7326
- const pages = _chunkMEQN6DDAcjs.collectFarmLlmsTxtPages.call(void 0,
7846
+ const pages = _chunkFJWN7RV4cjs.collectFarmLlmsTxtPages.call(void 0,
7327
7847
  sources.filter((source) => source !== null),
7328
7848
  {
7329
7849
  origin,
7330
7850
  basePath: this.config.basePath,
7331
- markdown: _chunkLT4VAF5Zcjs.resolveMarkdownConfig.call(void 0, this.config.md),
7851
+ markdown: _chunk2C5L5RPMcjs.resolveMarkdownConfig.call(void 0, this.config.md),
7332
7852
  include: config.include,
7333
7853
  exclude: config.exclude
7334
7854
  }
7335
7855
  );
7336
7856
  return {
7337
7857
  pages,
7338
- defaults: _chunkMEQN6DDAcjs.createFarmDefaultLlmsTxt.call(void 0, {
7858
+ defaults: _chunkFJWN7RV4cjs.createFarmDefaultLlmsTxt.call(void 0, {
7339
7859
  origin,
7340
7860
  pages,
7341
7861
  config,
7342
7862
  rootMetadata,
7343
- mcp: _optionalChain([this, 'access', _302 => _302.config, 'access', _303 => _303.agent, 'optionalAccess', _304 => _304.aiCatalog]) === false ? [] : _chunkXX32BOMMcjs.listFarmMCPLlmsTxtLinks.call(void 0, origin, {
7863
+ mcp: _optionalChain([this, 'access', _337 => _337.config, 'access', _338 => _338.agent, 'optionalAccess', _339 => _339.aiCatalog]) === false ? [] : _chunkNXFA7G3Ycjs.listFarmMCPLlmsTxtLinks.call(void 0, origin, {
7344
7864
  basePath: this.config.basePath,
7345
7865
  apiServerBasePath: _chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0,
7346
7866
  _chunkPMJSG4JScjs.normalizeFarmAPIConfig.call(void 0,
@@ -7363,17 +7883,17 @@ var ServerRenderer = class {
7363
7883
  * body is discarded.
7364
7884
  */
7365
7885
  createDevMarkdownReader(req) {
7366
- const socket = _optionalChain([req, 'optionalAccess', _305 => _305.socket]);
7367
- if (_optionalChain([req, 'optionalAccess', _306 => _306.method, 'optionalAccess', _307 => _307.toUpperCase, 'call', _308 => _308()]) === "HEAD" || !_optionalChain([socket, 'optionalAccess', _309 => _309.localAddress]) || !socket.localPort) {
7886
+ const socket = _optionalChain([req, 'optionalAccess', _340 => _340.socket]);
7887
+ if (_optionalChain([req, 'optionalAccess', _341 => _341.method, 'optionalAccess', _342 => _342.toUpperCase, 'call', _343 => _343()]) === "HEAD" || !_optionalChain([socket, 'optionalAccess', _344 => _344.localAddress]) || !socket.localPort) {
7368
7888
  return async () => null;
7369
7889
  }
7370
7890
  if (socket.encrypted) {
7371
7891
  const address = { host: socket.localAddress, port: socket.localPort };
7372
- return _chunkMEQN6DDAcjs.createFarmLlmsMarkdownReader.call(void 0, (page) => requestOwnHttpsServer(page, address));
7892
+ return _chunkFJWN7RV4cjs.createFarmLlmsMarkdownReader.call(void 0, (page) => requestOwnHttpsServer(page, address));
7373
7893
  }
7374
7894
  const host = socket.localAddress.includes(":") ? `[${socket.localAddress}]` : socket.localAddress;
7375
7895
  const localOrigin = `http://${host}:${socket.localPort}`;
7376
- const read = _chunkMEQN6DDAcjs.createFarmLlmsMarkdownReader.call(void 0, (page) => fetch(page));
7896
+ const read = _chunkFJWN7RV4cjs.createFarmLlmsMarkdownReader.call(void 0, (page) => fetch(page));
7377
7897
  return (url) => {
7378
7898
  const target = new URL(url);
7379
7899
  return read(`${localOrigin}${target.pathname}${target.search}`);
@@ -7430,7 +7950,7 @@ var ServerRenderer = class {
7430
7950
  }
7431
7951
  const etag = `"${image.staticInfo.hash}"`;
7432
7952
  const requestUrl = _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, {
7433
- trustProxy: _optionalChain([this, 'access', _310 => _310.config, 'access', _311 => _311.server, 'optionalAccess', _312 => _312.trustProxy])
7953
+ trustProxy: _optionalChain([this, 'access', _345 => _345.config, 'access', _346 => _346.server, 'optionalAccess', _347 => _347.trustProxy])
7434
7954
  });
7435
7955
  const isVersioned = requestUrl.searchParams.get("v") === image.staticInfo.hash;
7436
7956
  res.setHeader("Content-Type", image.staticInfo.contentType);
@@ -7451,7 +7971,7 @@ var ServerRenderer = class {
7451
7971
  res.end();
7452
7972
  return;
7453
7973
  }
7454
- res.write(await fs9.promises.readFile(image.modulePath));
7974
+ res.write(await fs10.promises.readFile(image.modulePath));
7455
7975
  res.end();
7456
7976
  }
7457
7977
  async renderRouteErrorBoundary(req, res, options) {
@@ -7610,7 +8130,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7610
8130
  </script>`);
7611
8131
  const deferredScript = farmScripts(createDeferredHydrationScript(deferredProps.records));
7612
8132
  const rendererHydrationScript = farmScripts(
7613
- _optionalChain([this, 'access', _313 => _313.rendererRuntime, 'access', _314 => _314.generateHydrationScript, 'optionalCall', _315 => _315()]) || ""
8133
+ _optionalChain([this, 'access', _348 => _348.rendererRuntime, 'access', _349 => _349.generateHydrationScript, 'optionalCall', _350 => _350()]) || ""
7614
8134
  );
7615
8135
  const viteClientScript = farmScripts(`<script type="module" src="/@vite/client"></script>`);
7616
8136
  const farmClientScript = farmScripts(
@@ -7619,8 +8139,8 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7619
8139
  const { html: content, head: rendererHead } = await this.renderElementToDocumentParts(
7620
8140
  element,
7621
8141
  {
7622
- rejectLateNavigation: _chunkLT4VAF5Zcjs._isFarmMarkdownPageCheck.call(void 0,
7623
- _optionalChain([req, 'access', _316 => _316.headers, 'optionalAccess', _317 => _317[_chunkLT4VAF5Zcjs.FARM_MARKDOWN_PAGE_CHECK_HEADER]])
8142
+ rejectLateNavigation: _chunk2C5L5RPMcjs._isFarmMarkdownPageCheck.call(void 0,
8143
+ _optionalChain([req, 'access', _351 => _351.headers, 'optionalAccess', _352 => _352[_chunk2C5L5RPMcjs.FARM_MARKDOWN_PAGE_CHECK_HEADER]])
7624
8144
  )
7625
8145
  }
7626
8146
  );
@@ -7632,7 +8152,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7632
8152
  viewport: viewportTags
7633
8153
  } = _chunk6IOZPJ3Icjs.renderMetadataHead.call(void 0, req.__FARM_METADATA__, {
7634
8154
  pathname: getFarmMetadataPathname(req),
7635
- jsonLd: _optionalChain([this, 'access', _318 => _318.config, 'access', _319 => _319.agent, 'optionalAccess', _320 => _320.jsonLd])
8155
+ jsonLd: _optionalChain([this, 'access', _353 => _353.config, 'access', _354 => _354.agent, 'optionalAccess', _355 => _355.jsonLd])
7636
8156
  });
7637
8157
  const documentTitleTag = !hasExplicitTitle && /<title[\s>]/i.test(rendererHead) ? "" : `<title>${title}</title>`;
7638
8158
  const rendererHasTitle = /<title[\s>]/i.test(rendererHead);
@@ -7642,19 +8162,19 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7642
8162
  i18nSnapshot,
7643
8163
  this.getI18nAlternateOptions(req, req.__FARM_METADATA__)
7644
8164
  ) : "";
7645
- const themeDocument = _chunkO27PLNQZcjs.createFarmThemeDocumentParts.call(void 0,
8165
+ const themeDocument = _chunkUJ3R2AH2cjs.createFarmThemeDocumentParts.call(void 0,
7646
8166
  this.config.theme,
7647
8167
  this.config.basePath,
7648
8168
  _chunk4ZJ5C7UJcjs.getTheme.call(void 0, )
7649
8169
  );
7650
8170
  themeDocument.head = farmScripts(themeDocument.head);
7651
- const fullDocument = _chunkO27PLNQZcjs.extractFarmFullDocument.call(void 0, content);
8171
+ const fullDocument = _chunkUJ3R2AH2cjs.extractFarmFullDocument.call(void 0, content);
7652
8172
  let html;
7653
8173
  if (fullDocument) {
7654
8174
  const shouldReplaceLayoutTitle = hasExplicitTitle || rendererHasTitle;
7655
- const documentHtml = shouldReplaceLayoutTitle ? _chunkO27PLNQZcjs.removeFarmDocumentTitles.call(void 0, fullDocument) : fullDocument;
7656
- const effectiveRendererHead = hasExplicitTitle ? _chunkO27PLNQZcjs.removeFarmDocumentTitles.call(void 0, rendererHead) : rendererHead;
7657
- html = _chunkO27PLNQZcjs.composeFarmFullDocument.call(void 0, documentHtml, {
8175
+ const documentHtml = shouldReplaceLayoutTitle ? _chunkUJ3R2AH2cjs.removeFarmDocumentTitles.call(void 0, fullDocument) : fullDocument;
8176
+ const effectiveRendererHead = hasExplicitTitle ? _chunkUJ3R2AH2cjs.removeFarmDocumentTitles.call(void 0, rendererHead) : rendererHead;
8177
+ html = _chunkUJ3R2AH2cjs.composeFarmFullDocument.call(void 0, documentHtml, {
7658
8178
  fallbackIcon: !hasFavicon,
7659
8179
  viewport: viewportTags,
7660
8180
  htmlAttributes: `${i18nSnapshot ? ` lang="${escapeHtmlAttribute2(i18nSnapshot.locale)}" dir="${escapeHtmlAttribute2(i18nSnapshot.direction)}"` : ""}${themeDocument.attributes}`,
@@ -7680,7 +8200,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7680
8200
  });
7681
8201
  } else {
7682
8202
  html = `<!DOCTYPE html>
7683
- <html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _321 => _321.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
8203
+ <html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _356 => _356.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
7684
8204
  <head>
7685
8205
  ${themeDocument.head}
7686
8206
  <meta charset="utf-8">
@@ -7711,7 +8231,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7711
8231
  const securedHtml = this.secureDocumentHTML(req, html);
7712
8232
  if ((req.method || "GET").toUpperCase() !== "HEAD") res.write(securedHtml);
7713
8233
  res.end();
7714
- if (!options.captureStaticShell) await _optionalChain([options, 'access', _322 => _322.onComplete, 'optionalCall', _323 => _323(securedHtml)]);
8234
+ if (!options.captureStaticShell) await _optionalChain([options, 'access', _357 => _357.onComplete, 'optionalCall', _358 => _358(securedHtml)]);
7715
8235
  _chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, {
7716
8236
  type: "render.stream.complete",
7717
8237
  route,
@@ -7721,7 +8241,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7721
8241
  _chunkEVIWKPJVcjs.emitFarmEvent.call(void 0, { type: "render.error", route, error });
7722
8242
  throw error;
7723
8243
  } finally {
7724
- _optionalChain([clearMiddlewareData, 'optionalCall', _324 => _324()]);
8244
+ _optionalChain([clearMiddlewareData, 'optionalCall', _359 => _359()]);
7725
8245
  }
7726
8246
  }
7727
8247
  /**
@@ -7736,7 +8256,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7736
8256
  if (!rootLayout) return false;
7737
8257
  try {
7738
8258
  const Layout = (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).default;
7739
- if (typeof Layout !== "function" || _optionalChain([Layout, 'access', _325 => _325.prototype, 'optionalAccess', _326 => _326.isReactComponent]) || _optionalChain([Layout, 'access', _327 => _327.constructor, 'optionalAccess', _328 => _328.name]) === "AsyncFunction") {
8259
+ if (typeof Layout !== "function" || _optionalChain([Layout, 'access', _360 => _360.prototype, 'optionalAccess', _361 => _361.isReactComponent]) || _optionalChain([Layout, 'access', _362 => _362.constructor, 'optionalAccess', _363 => _363.name]) === "AsyncFunction") {
7740
8260
  return false;
7741
8261
  }
7742
8262
  const cached = documentLayouts.get(Layout);
@@ -7748,12 +8268,12 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7748
8268
  params: {}
7749
8269
  });
7750
8270
  rendersDocument = this.rendererRuntime.isValidElement(rendered) && rendered.type === "html";
7751
- } catch (e27) {
8271
+ } catch (e35) {
7752
8272
  rendersDocument = false;
7753
8273
  }
7754
8274
  documentLayouts.set(Layout, rendersDocument);
7755
8275
  return rendersDocument;
7756
- } catch (e28) {
8276
+ } catch (e36) {
7757
8277
  return false;
7758
8278
  }
7759
8279
  }
@@ -7761,7 +8281,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7761
8281
  const renderToPipeableStream = this.rendererRuntime.renderToPipeableStream;
7762
8282
  const fullDocumentRouteKey = options.observabilityRoute || req.__FARM_ROUTE__ || req.url || "/";
7763
8283
  const streamDocument = fullDocumentRoutes.has(fullDocumentRouteKey) || await this.rootLayoutRendersDocument();
7764
- if (!renderToPipeableStream || _chunkLT4VAF5Zcjs._isFarmMarkdownPageCheck.call(void 0, _optionalChain([req, 'access', _329 => _329.headers, 'optionalAccess', _330 => _330[_chunkLT4VAF5Zcjs.FARM_MARKDOWN_PAGE_CHECK_HEADER]])) || streamDocument && (options.captureStaticShell || !_chunkRD623KW4cjs.isReactRenderer.call(void 0, this.config.renderer))) {
8284
+ if (!renderToPipeableStream || _chunk2C5L5RPMcjs._isFarmMarkdownPageCheck.call(void 0, _optionalChain([req, 'access', _364 => _364.headers, 'optionalAccess', _365 => _365[_chunk2C5L5RPMcjs.FARM_MARKDOWN_PAGE_CHECK_HEADER]])) || streamDocument && (options.captureStaticShell || !_chunkRD623KW4cjs.isReactRenderer.call(void 0, this.config.renderer))) {
7765
8285
  return this.renderBufferedSSR(element, req, res, clearMiddlewareData, options);
7766
8286
  }
7767
8287
  return new Promise((resolve3, reject) => {
@@ -7893,7 +8413,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7893
8413
  viewport: viewportTags
7894
8414
  } = _chunk6IOZPJ3Icjs.renderMetadataHead.call(void 0, req.__FARM_METADATA__, {
7895
8415
  pathname: getFarmMetadataPathname(req),
7896
- jsonLd: _optionalChain([this, 'access', _331 => _331.config, 'access', _332 => _332.agent, 'optionalAccess', _333 => _333.jsonLd])
8416
+ jsonLd: _optionalChain([this, 'access', _366 => _366.config, 'access', _367 => _367.agent, 'optionalAccess', _368 => _368.jsonLd])
7897
8417
  });
7898
8418
  const i18nSnapshot = _chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0, );
7899
8419
  const i18nAlternateTags = i18nSnapshot ? renderI18nAlternateLinks(
@@ -7902,7 +8422,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7902
8422
  this.getI18nAlternateOptions(req, req.__FARM_METADATA__)
7903
8423
  ) : "";
7904
8424
  const fontHead = renderFarmFontDevHead(this.config.root || process.cwd());
7905
- const themeDocument = _chunkO27PLNQZcjs.createFarmThemeDocumentParts.call(void 0,
8425
+ const themeDocument = _chunkUJ3R2AH2cjs.createFarmThemeDocumentParts.call(void 0,
7906
8426
  this.config.theme,
7907
8427
  this.config.basePath,
7908
8428
  _chunk4ZJ5C7UJcjs.getTheme.call(void 0, )
@@ -7920,7 +8440,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7920
8440
  nonce: cspNonce,
7921
8441
  onShellReady() {
7922
8442
  if (pendingNavigationError) {
7923
- _optionalChain([abort, 'optionalCall', _334 => _334(pendingNavigationError)]);
8443
+ _optionalChain([abort, 'optionalCall', _369 => _369(pendingNavigationError)]);
7924
8444
  if (clearMiddlewareData) {
7925
8445
  clearMiddlewareData();
7926
8446
  }
@@ -7938,7 +8458,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7938
8458
  console.log(`[FARM STREAM] onShellReady at ${shellReadyMs}ms`);
7939
8459
  }
7940
8460
  const shell = `<!DOCTYPE html>
7941
- <html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _335 => _335.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
8461
+ <html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _370 => _370.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
7942
8462
  <head>
7943
8463
  ${themeDocument.head}
7944
8464
  <meta charset="utf-8">
@@ -7959,7 +8479,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7959
8479
  const securedShell = streamDocument ? "" : stampDocumentHTML(shell);
7960
8480
  if (securedShell) {
7961
8481
  htmlParts.push(securedShell);
7962
- _optionalChain([staticShellParts, 'optionalAccess', _336 => _336.push, 'call', _337 => _337(securedShell)]);
8482
+ _optionalChain([staticShellParts, 'optionalAccess', _371 => _371.push, 'call', _372 => _372(securedShell)]);
7963
8483
  }
7964
8484
  const withEarlyClient = (document) => earlyClient ? {
7965
8485
  ...document,
@@ -7969,10 +8489,10 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
7969
8489
  ${stampDocumentHTML(earlyClientScript)}`
7970
8490
  )
7971
8491
  } : document;
7972
- const documentTransform = streamDocument ? _chunkO27PLNQZcjs.createFarmStreamedDocumentTransform.call(void 0,
8492
+ const documentTransform = streamDocument ? _chunkUJ3R2AH2cjs.createFarmStreamedDocumentTransform.call(void 0,
7973
8493
  (opening) => withEarlyClient(
7974
- _chunkO27PLNQZcjs.openFarmStreamedDocument.call(void 0,
7975
- hasExplicitTitle ? _chunkO27PLNQZcjs.removeFarmDocumentTitles.call(void 0, opening) : opening,
8494
+ _chunkUJ3R2AH2cjs.openFarmStreamedDocument.call(void 0,
8495
+ hasExplicitTitle ? _chunkUJ3R2AH2cjs.removeFarmDocumentTitles.call(void 0, opening) : opening,
7976
8496
  {
7977
8497
  fallbackIcon: !hasFavicon,
7978
8498
  viewport: viewportTags,
@@ -8011,7 +8531,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
8011
8531
  const recordRenderedChunk = (chunkText, renderedText = chunkText) => {
8012
8532
  if (!checkedFullDocument && renderedText) {
8013
8533
  documentPrefix += renderedText;
8014
- const prefix = _chunkO27PLNQZcjs.classifyFarmDocumentPrefix.call(void 0, documentPrefix);
8534
+ const prefix = _chunkUJ3R2AH2cjs.classifyFarmDocumentPrefix.call(void 0, documentPrefix);
8015
8535
  if (prefix !== "pending") {
8016
8536
  checkedFullDocument = true;
8017
8537
  documentPrefix = "";
@@ -8030,7 +8550,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
8030
8550
  staticShellClosed = true;
8031
8551
  if (!suspenseHoleEmitted) {
8032
8552
  suspenseHoleEmitted = true;
8033
- _optionalChain([options, 'access', _338 => _338.onSuspenseHoleDetected, 'optionalCall', _339 => _339()]);
8553
+ _optionalChain([options, 'access', _373 => _373.onSuspenseHoleDetected, 'optionalCall', _374 => _374()]);
8034
8554
  }
8035
8555
  } else {
8036
8556
  staticShellParts.push(chunkText);
@@ -8094,8 +8614,8 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
8094
8614
  recordRenderedChunk(tail, rewritten);
8095
8615
  if (tail) res.write(tail);
8096
8616
  }
8097
- const documentEnd = _optionalChain([documentTransform, 'optionalAccess', _340 => _340.end, 'call', _341 => _341()]);
8098
- if (_optionalChain([documentEnd, 'optionalAccess', _342 => _342.text])) {
8617
+ const documentEnd = _optionalChain([documentTransform, 'optionalAccess', _375 => _375.end, 'call', _376 => _376()]);
8618
+ if (_optionalChain([documentEnd, 'optionalAccess', _377 => _377.text])) {
8099
8619
  recordRenderedChunk(documentEnd.text, "");
8100
8620
  res.write(documentEnd.text);
8101
8621
  }
@@ -8106,7 +8626,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
8106
8626
  deferredHydrationScript: createDeferredHydrationScript(deferredProps.records),
8107
8627
  earlyClient,
8108
8628
  // A full document: Farm's #root closes only where Farm opened it.
8109
- ..._optionalChain([documentEnd, 'optionalAccess', _343 => _343.document]) ? { closeRoot: documentEnd.rootOpened } : {}
8629
+ ..._optionalChain([documentEnd, 'optionalAccess', _378 => _378.document]) ? { closeRoot: documentEnd.rootOpened } : {}
8110
8630
  })
8111
8631
  );
8112
8632
  htmlParts.push(footer);
@@ -8211,7 +8731,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
8211
8731
  return await this.routeManager.loadRouteModule(notFoundPath);
8212
8732
  }
8213
8733
  async loadNotFoundComponent() {
8214
- return await _asyncNullishCoalesce(await _asyncOptionalChain([(await this.loadNotFoundModule()), 'optionalAccess', async _344 => _344.default]), async () => ( null));
8734
+ return await _asyncNullishCoalesce(await _asyncOptionalChain([(await this.loadNotFoundModule()), 'optionalAccess', async _379 => _379.default]), async () => ( null));
8215
8735
  }
8216
8736
  /** The not-found document's head: layout and not-found metadata, as production renders it. */
8217
8737
  async notFoundMetadataHead(layoutModule, notFoundModule) {
@@ -8234,13 +8754,13 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
8234
8754
  */
8235
8755
  async createLateNavigationRecoveryHTML(req, error) {
8236
8756
  if (_chunk7JUIK547cjs.isFarmRedirectError.call(void 0, error)) {
8237
- return _chunkO27PLNQZcjs.createLateRedirectRecovery.call(void 0,
8757
+ return _chunkUJ3R2AH2cjs.createLateRedirectRecovery.call(void 0,
8238
8758
  this.localizeRedirectUrl(_chunk7JUIK547cjs.getFarmRedirectError.call(void 0, error).url),
8239
8759
  this.getCspNonce(req) || ""
8240
8760
  );
8241
8761
  }
8242
8762
  const pathname = _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, {
8243
- trustProxy: _optionalChain([this, 'access', _345 => _345.config, 'access', _346 => _346.server, 'optionalAccess', _347 => _347.trustProxy])
8763
+ trustProxy: _optionalChain([this, 'access', _380 => _380.config, 'access', _381 => _381.server, 'optionalAccess', _382 => _382.trustProxy])
8244
8764
  }).pathname;
8245
8765
  let content = this.defaultNotFoundContent();
8246
8766
  const NotFoundComponent = await this.loadNotFoundComponent();
@@ -8256,29 +8776,29 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
8256
8776
  _chunkQMNWKQL4cjs.logger.warn(`not-found page could not render outside its layout, using Farm's: ${error2}`);
8257
8777
  }
8258
8778
  }
8259
- return _chunkO27PLNQZcjs.createLateNotFoundRecovery.call(void 0, content, this.getCspNonce(req) || "");
8779
+ return _chunkUJ3R2AH2cjs.createLateNotFoundRecovery.call(void 0, content, this.getCspNonce(req) || "");
8260
8780
  }
8261
8781
  async render404(req, res) {
8262
8782
  res.statusCode = 404;
8263
8783
  const pathname = _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, {
8264
- trustProxy: _optionalChain([this, 'access', _348 => _348.config, 'access', _349 => _349.server, 'optionalAccess', _350 => _350.trustProxy])
8784
+ trustProxy: _optionalChain([this, 'access', _383 => _383.config, 'access', _384 => _384.server, 'optionalAccess', _385 => _385.trustProxy])
8265
8785
  }).pathname;
8266
8786
  const acceptHeader = req.headers.accept;
8267
8787
  const accept = Array.isArray(acceptHeader) ? acceptHeader.join(",") : acceptHeader;
8268
- if (_chunkLT4VAF5Zcjs.farmRequestWantsMarkdown.call(void 0, pathname, accept)) {
8269
- res.setHeader("Content-Type", _chunkLT4VAF5Zcjs.FARM_MARKDOWN_CONTENT_TYPE);
8788
+ if (_chunk2C5L5RPMcjs.farmRequestWantsMarkdown.call(void 0, pathname, accept)) {
8789
+ res.setHeader("Content-Type", _chunk2C5L5RPMcjs.FARM_MARKDOWN_CONTENT_TYPE);
8270
8790
  res.setHeader("X-Farm-Markdown-Error", "404");
8271
8791
  res.setHeader("Cache-Control", "no-store");
8272
- res.end(_chunkLT4VAF5Zcjs.createFarmMarkdownErrorBody.call(void 0, 404, pathname, this.config.basePath || "/"));
8792
+ res.end(_chunk2C5L5RPMcjs.createFarmMarkdownErrorBody.call(void 0, 404, pathname, this.config.basePath || "/"));
8273
8793
  return;
8274
8794
  }
8275
- const appDir = path13.join(this.config.root, this.config.srcDir, "app");
8795
+ const appDir = path14.join(this.config.root, this.config.srcDir, "app");
8276
8796
  const notFoundExtensions = _chunkRD623KW4cjs.getFarmRendererComponentExtensions.call(void 0, this.config.renderer);
8277
8797
  let layoutModule = null;
8278
8798
  try {
8279
8799
  for (const ext of notFoundExtensions) {
8280
- const layoutPath = path13.join(appDir, `layout${ext}`);
8281
- if (fs9.existsSync(layoutPath)) {
8800
+ const layoutPath = path14.join(appDir, `layout${ext}`);
8801
+ if (fs10.existsSync(layoutPath)) {
8282
8802
  layoutModule = await this.routeManager.loadLayoutModule(layoutPath);
8283
8803
  break;
8284
8804
  }
@@ -8289,9 +8809,9 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
8289
8809
  );
8290
8810
  if (notFoundPath) {
8291
8811
  const notFoundModule = await this.loadNotFoundModule();
8292
- const NotFoundComponent = _nullishCoalesce(_optionalChain([notFoundModule, 'optionalAccess', _351 => _351.default]), () => ( null));
8812
+ const NotFoundComponent = _nullishCoalesce(_optionalChain([notFoundModule, 'optionalAccess', _386 => _386.default]), () => ( null));
8293
8813
  if (NotFoundComponent) {
8294
- const LayoutComponent = _nullishCoalesce(_optionalChain([layoutModule, 'optionalAccess', _352 => _352.default]), () => ( null));
8814
+ const LayoutComponent = _nullishCoalesce(_optionalChain([layoutModule, 'optionalAccess', _387 => _387.default]), () => ( null));
8295
8815
  let element = this.rendererRuntime.createElement(NotFoundComponent, { pathname });
8296
8816
  if (LayoutComponent) {
8297
8817
  element = this.rendererRuntime.createElement(LayoutComponent, {
@@ -8331,23 +8851,23 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
8331
8851
  res.statusCode = statusCode;
8332
8852
  const isDev = process.env.NODE_ENV === "development";
8333
8853
  const requestUrl = _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, {
8334
- trustProxy: _optionalChain([this, 'access', _353 => _353.config, 'access', _354 => _354.server, 'optionalAccess', _355 => _355.trustProxy])
8854
+ trustProxy: _optionalChain([this, 'access', _388 => _388.config, 'access', _389 => _389.server, 'optionalAccess', _390 => _390.trustProxy])
8335
8855
  });
8336
8856
  const diagnostics = isDev ? createDefaultErrorDiagnostics(error, this.config.root || process.cwd()) : void 0;
8337
- const statusText = _chunkO27PLNQZcjs.getDefaultErrorStatusText.call(void 0, statusCode);
8857
+ const statusText = _chunkUJ3R2AH2cjs.getDefaultErrorStatusText.call(void 0, statusCode);
8338
8858
  const content = this.stampFarmScripts(
8339
8859
  req,
8340
- _chunkO27PLNQZcjs.createDefaultErrorMarkup.call(void 0, {
8860
+ _chunkUJ3R2AH2cjs.createDefaultErrorMarkup.call(void 0, {
8341
8861
  statusCode,
8342
8862
  statusText,
8343
8863
  requestPath: requestUrl.pathname,
8344
8864
  method: req.method || "GET",
8345
- message: _optionalChain([diagnostics, 'optionalAccess', _356 => _356.message]),
8346
- errorName: _optionalChain([diagnostics, 'optionalAccess', _357 => _357.name]),
8347
- stack: _optionalChain([diagnostics, 'optionalAccess', _358 => _358.stack]),
8348
- sourceFrame: _optionalChain([diagnostics, 'optionalAccess', _359 => _359.sourceFrame]),
8865
+ message: _optionalChain([diagnostics, 'optionalAccess', _391 => _391.message]),
8866
+ errorName: _optionalChain([diagnostics, 'optionalAccess', _392 => _392.name]),
8867
+ stack: _optionalChain([diagnostics, 'optionalAccess', _393 => _393.stack]),
8868
+ sourceFrame: _optionalChain([diagnostics, 'optionalAccess', _394 => _394.sourceFrame]),
8349
8869
  development: isDev,
8350
- farmVersion: _chunkSM25ZC4Scjs.FARM_VERSION,
8870
+ farmVersion: _chunkO2XFIPNLcjs.FARM_VERSION,
8351
8871
  nodeVersion: process.version,
8352
8872
  mode: isDev ? "development" : "production"
8353
8873
  })
@@ -8373,8 +8893,8 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
8373
8893
  */
8374
8894
  getI18nAlternateOptions(req, metadata) {
8375
8895
  return {
8376
- metadataBase: _optionalChain([metadata, 'optionalAccess', _360 => _360.metadataBase]),
8377
- origin: req ? _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _361 => _361.config, 'access', _362 => _362.server, 'optionalAccess', _363 => _363.trustProxy]) }).origin : void 0
8896
+ metadataBase: _optionalChain([metadata, 'optionalAccess', _395 => _395.metadataBase]),
8897
+ origin: req ? _chunkHNAISJFDcjs.resolveFarmRequestURL.call(void 0, req, { trustProxy: _optionalChain([this, 'access', _396 => _396.config, 'access', _397 => _397.server, 'optionalAccess', _398 => _398.trustProxy]) }).origin : void 0
8378
8898
  };
8379
8899
  }
8380
8900
  createFullHTML(content, isClientComponent = false, requestPath = "/", metadataHead, alternates = {}) {
@@ -8393,20 +8913,20 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};`
8393
8913
  this.getI18nAlternateOptions(alternates.req, alternates.metadata)
8394
8914
  ) : "";
8395
8915
  const fontHead = renderFarmFontDevHead(this.config.root || process.cwd());
8396
- const themeDocument = _chunkO27PLNQZcjs.createFarmThemeDocumentParts.call(void 0,
8916
+ const themeDocument = _chunkUJ3R2AH2cjs.createFarmThemeDocumentParts.call(void 0,
8397
8917
  this.config.theme,
8398
8918
  this.config.basePath,
8399
8919
  _chunk4ZJ5C7UJcjs.getTheme.call(void 0, )
8400
8920
  );
8401
8921
  themeDocument.head = farmScripts(themeDocument.head);
8402
8922
  const rendererHydrationScript = farmScripts(
8403
- _optionalChain([this, 'access', _364 => _364.rendererRuntime, 'access', _365 => _365.generateHydrationScript, 'optionalCall', _366 => _366()]) || ""
8923
+ _optionalChain([this, 'access', _399 => _399.rendererRuntime, 'access', _400 => _400.generateHydrationScript, 'optionalCall', _401 => _401()]) || ""
8404
8924
  );
8405
- const viewportTags = _chunk6IOZPJ3Icjs.renderViewportHead.call(void 0, _optionalChain([alternates, 'access', _367 => _367.metadata, 'optionalAccess', _368 => _368.viewport]));
8406
- const fullDocument = _chunkO27PLNQZcjs.extractFarmFullDocument.call(void 0, content);
8925
+ const viewportTags = _chunk6IOZPJ3Icjs.renderViewportHead.call(void 0, _optionalChain([alternates, 'access', _402 => _402.metadata, 'optionalAccess', _403 => _403.viewport]));
8926
+ const fullDocument = _chunkUJ3R2AH2cjs.extractFarmFullDocument.call(void 0, content);
8407
8927
  if (fullDocument) {
8408
- return _chunkO27PLNQZcjs.composeFarmFullDocument.call(void 0,
8409
- metadataHead ? _chunkO27PLNQZcjs.removeFarmDocumentTitles.call(void 0, fullDocument) : fullDocument,
8928
+ return _chunkUJ3R2AH2cjs.composeFarmFullDocument.call(void 0,
8929
+ metadataHead ? _chunkUJ3R2AH2cjs.removeFarmDocumentTitles.call(void 0, fullDocument) : fullDocument,
8410
8930
  {
8411
8931
  fallbackIcon: !metadataHead,
8412
8932
  viewport: viewportTags,
@@ -8432,7 +8952,7 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};`
8432
8952
  );
8433
8953
  }
8434
8954
  return `<!DOCTYPE html>
8435
- <html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _369 => _369.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
8955
+ <html lang="${escapeHtmlAttribute2(_optionalChain([i18nSnapshot, 'optionalAccess', _404 => _404.locale]) || "en")}"${i18nSnapshot ? ` dir="${i18nSnapshot.direction}"` : ""}${themeDocument.attributes}>
8436
8956
  <head>
8437
8957
  ${themeDocument.head}
8438
8958
  <meta charset="utf-8">
@@ -8474,7 +8994,7 @@ ${clientScript}
8474
8994
  res.setHeader(_chunkE552H232cjs.FARM_DEPLOYMENT_ID_HEADER, deploymentId);
8475
8995
  if ((req.method || "GET").toUpperCase() !== "GET") return;
8476
8996
  const forwardedProto = req.headers["x-forwarded-proto"];
8477
- const isSecure = _optionalChain([(Array.isArray(forwardedProto) ? forwardedProto[0] : forwardedProto), 'optionalAccess', _370 => _370.split, 'call', _371 => _371(","), 'access', _372 => _372[0], 'optionalAccess', _373 => _373.trim, 'call', _374 => _374()]) === "https" || Boolean(_optionalChain([req, 'access', _375 => _375.socket, 'optionalAccess', _376 => _376.encrypted]));
8997
+ const isSecure = _optionalChain([(Array.isArray(forwardedProto) ? forwardedProto[0] : forwardedProto), 'optionalAccess', _405 => _405.split, 'call', _406 => _406(","), 'access', _407 => _407[0], 'optionalAccess', _408 => _408.trim, 'call', _409 => _409()]) === "https" || Boolean(_optionalChain([req, 'access', _410 => _410.socket, 'optionalAccess', _411 => _411.encrypted]));
8478
8998
  const cookie = _chunkE552H232cjs.createFarmDeploymentCookie.call(void 0, deploymentId, this.config.basePath || "/", isSecure);
8479
8999
  const existing = res.getHeader("Set-Cookie");
8480
9000
  if (Array.isArray(existing)) {
@@ -8574,7 +9094,7 @@ var FarmApp = class {
8574
9094
  serverActions: _chunk4P5634G6cjs.resolveServerActionsConfig.call(void 0, config.serverActions),
8575
9095
  security: _chunk6JHZPB52cjs.resolveFarmSecurityConfig.call(void 0, config.security),
8576
9096
  images: _chunkHEPJIKKQcjs.resolveFarmImageConfig.call(void 0, config.images),
8577
- performance: _chunkDZPR2W6Ucjs.resolveFarmPerformanceConfig.call(void 0, config.performance),
9097
+ performance: _chunkO6L3YYPMcjs.resolveFarmPerformanceConfig.call(void 0, config.performance),
8578
9098
  theme: _chunkWT6RAN2Icjs.resolveFarmThemeConfig.call(void 0, config.theme, basePath),
8579
9099
  i18n: isResolvedI18nConfig(config.i18n) ? config.i18n : _chunkLNVGXUL3cjs.resolveFarmI18nConfig.call(void 0, config.i18n, {
8580
9100
  root,
@@ -8586,7 +9106,7 @@ var FarmApp = class {
8586
9106
  serverRuntimeConfig: config.serverRuntimeConfig || {},
8587
9107
  publicRuntimeConfig: config.publicRuntimeConfig || {},
8588
9108
  docs: isResolvedDocsConfig(config.docs) ? config.docs : defaultDocsConfig,
8589
- md: _chunkLT4VAF5Zcjs.resolveMarkdownConfig.call(void 0, config.md),
9109
+ md: _chunk2C5L5RPMcjs.resolveMarkdownConfig.call(void 0, config.md),
8590
9110
  mdx: _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, config.mdx),
8591
9111
  observability: _nullishCoalesce(config.observability, () => ( false)),
8592
9112
  telemetry: config.telemetry !== false,
@@ -8602,10 +9122,10 @@ var FarmApp = class {
8602
9122
  env: config.env || { server: {}, public: {} },
8603
9123
  suppressLintOnLink: _nullishCoalesce(config.suppressLintOnLink, () => ( false)),
8604
9124
  experimental: {
8605
- serverComponents: _nullishCoalesce(_optionalChain([config, 'access', _377 => _377.experimental, 'optionalAccess', _378 => _378.serverComponents]), () => ( false)),
8606
- serverActions: _nullishCoalesce(_optionalChain([config, 'access', _379 => _379.experimental, 'optionalAccess', _380 => _380.serverActions]), () => ( false)),
8607
- isolatedClientHydration: _nullishCoalesce(_optionalChain([config, 'access', _381 => _381.experimental, 'optionalAccess', _382 => _382.isolatedClientHydration]), () => ( "off")),
8608
- ppr: _nullishCoalesce(_optionalChain([config, 'access', _383 => _383.experimental, 'optionalAccess', _384 => _384.ppr]), () => ( false)),
9125
+ serverComponents: _nullishCoalesce(_optionalChain([config, 'access', _412 => _412.experimental, 'optionalAccess', _413 => _413.serverComponents]), () => ( false)),
9126
+ serverActions: _nullishCoalesce(_optionalChain([config, 'access', _414 => _414.experimental, 'optionalAccess', _415 => _415.serverActions]), () => ( false)),
9127
+ isolatedClientHydration: _nullishCoalesce(_optionalChain([config, 'access', _416 => _416.experimental, 'optionalAccess', _417 => _417.isolatedClientHydration]), () => ( "off")),
9128
+ ppr: _nullishCoalesce(_optionalChain([config, 'access', _418 => _418.experimental, 'optionalAccess', _419 => _419.ppr]), () => ( false)),
8609
9129
  ...config.experimental
8610
9130
  },
8611
9131
  agent: _nullishCoalesce(config.agent, () => ( {})),
@@ -8631,7 +9151,7 @@ var FarmApp = class {
8631
9151
  }
8632
9152
  const componentExtensions = _chunkRD623KW4cjs.getFarmRendererComponentExtensions.call(void 0, this.config.renderer);
8633
9153
  const rootLayoutPaths = appDirs.flatMap(
8634
- (appDir) => componentExtensions.map((extension) => path6.default.join(appDir, `layout${extension}`))
9154
+ (appDir) => componentExtensions.map((extension) => path7.default.join(appDir, `layout${extension}`))
8635
9155
  );
8636
9156
  const hasRootLayout = await Promise.all(rootLayoutPaths.map((p) => _chunkQMNWKQL4cjs.fileExists.call(void 0, p))).then(
8637
9157
  (results) => results.some(Boolean)
@@ -8652,7 +9172,7 @@ function isResolvedAuthConfig(value) {
8652
9172
  );
8653
9173
  }
8654
9174
  function normalizeFarmAppAPIConfig(config) {
8655
- if (typeof _optionalChain([config, 'optionalAccess', _385 => _385.baseURL]) === "function" || typeof _optionalChain([config, 'optionalAccess', _386 => _386.basePath]) === "function") {
9175
+ if (typeof _optionalChain([config, 'optionalAccess', _420 => _420.baseURL]) === "function" || typeof _optionalChain([config, 'optionalAccess', _421 => _421.basePath]) === "function") {
8656
9176
  throw new Error(
8657
9177
  "Farm API config resolver functions must be processed with resolveConfig() before creating a FarmApp."
8658
9178
  );
@@ -8667,7 +9187,7 @@ function createFarmApp(config, viteServer) {
8667
9187
  var SHARP_INSTALL_HINT = _chunkKORZ6PREcjs.formatOptionalPeerInstallHint.call(void 0, "sharp", "optimize images");
8668
9188
  var CLOUDFLARE_IMAGE_PRESETS = /* @__PURE__ */ new Set(["cloudflare", "cloudflare-pages", "cloudflare-module"]);
8669
9189
  function resolveFarmImageProviderForRuntime(images, options) {
8670
- const provider = _nullishCoalesce(_optionalChain([images, 'optionalAccess', _387 => _387.provider]), () => ( "auto"));
9190
+ const provider = _nullishCoalesce(_optionalChain([images, 'optionalAccess', _422 => _422.provider]), () => ( "auto"));
8671
9191
  if (provider === "none") return images;
8672
9192
  const usesSharp = options.dev ? true : provider === "node" || provider === "auto" && !CLOUDFLARE_IMAGE_PRESETS.has(options.preset || "");
8673
9193
  if (!usesSharp || _chunkKORZ6PREcjs.isOptionalPeerInstalled.call(void 0, options.root, "sharp")) return images;
@@ -8701,8 +9221,8 @@ var FARM_PACKAGE = /^@(?:farm\.js|farming-labs)\/[a-z0-9._-]+$/;
8701
9221
  function resolveFarmAppPackages(root) {
8702
9222
  let manifest;
8703
9223
  try {
8704
- manifest = JSON.parse(fs4.default.readFileSync(path6.default.join(root, "package.json"), "utf8"));
8705
- } catch (e29) {
9224
+ manifest = JSON.parse(fs5.default.readFileSync(path7.default.join(root, "package.json"), "utf8"));
9225
+ } catch (e37) {
8706
9226
  return {};
8707
9227
  }
8708
9228
  const names = new Set(
@@ -8716,13 +9236,13 @@ function resolveFarmAppPackages(root) {
8716
9236
  for (let dir = root; ; ) {
8717
9237
  try {
8718
9238
  const { version } = JSON.parse(
8719
- fs4.default.readFileSync(path6.default.join(dir, "node_modules", name, "package.json"), "utf8")
9239
+ fs5.default.readFileSync(path7.default.join(dir, "node_modules", name, "package.json"), "utf8")
8720
9240
  );
8721
9241
  if (typeof version === "string" && /^[0-9A-Za-z.+-]{1,64}$/.test(version))
8722
9242
  versions[name] = version;
8723
9243
  break;
8724
- } catch (e30) {
8725
- const parent = path6.default.dirname(dir);
9244
+ } catch (e38) {
9245
+ const parent = path7.default.dirname(dir);
8726
9246
  if (parent === dir) break;
8727
9247
  dir = parent;
8728
9248
  }
@@ -8752,7 +9272,7 @@ var LANGS = {
8752
9272
  cjs: "jsx",
8753
9273
  jsx: "jsx"
8754
9274
  };
8755
- var parseAst3;
9275
+ var parseAst4;
8756
9276
  function staticValue(node) {
8757
9277
  if (!node) return NOT_STATIC;
8758
9278
  switch (node.type) {
@@ -8796,9 +9316,9 @@ function staticValue(node) {
8796
9316
  }
8797
9317
  }
8798
9318
  function property(object, name) {
8799
- return _optionalChain([object, 'access', _388 => _388.properties, 'access', _389 => _389.find, 'call', _390 => _390(
9319
+ return _optionalChain([object, 'access', _423 => _423.properties, 'access', _424 => _424.find, 'call', _425 => _425(
8800
9320
  (entry) => entry.type === "Property" && !entry.computed && (entry.key.name === name || entry.key.value === name)
8801
- ), 'optionalAccess', _391 => _391.value]);
9321
+ ), 'optionalAccess', _426 => _426.value]);
8802
9322
  }
8803
9323
  function toolFromObject(object) {
8804
9324
  const name = staticValue(property(object, "name"));
@@ -8829,14 +9349,14 @@ function toolFromObject(object) {
8829
9349
  }
8830
9350
  function findFarmWebMCPTools(code, filename = "module.tsx") {
8831
9351
  if (!code.includes(WEBMCP_CLIENT)) return [];
8832
- const lang = _nullishCoalesce(LANGS[path6.default.extname(filename).slice(1)], () => ( "tsx"));
8833
- _nullishCoalesce(parseAst3, () => ( (parseAst3 = _module.createRequire.call(void 0, typeof __filename === "string" ? __filename : _chunkBTZ5O6VMcjs.define_import_meta_default.url)(
9352
+ const lang = _nullishCoalesce(LANGS[path7.default.extname(filename).slice(1)], () => ( "tsx"));
9353
+ _nullishCoalesce(parseAst4, () => ( (parseAst4 = _module.createRequire.call(void 0, typeof __filename === "string" ? __filename : _chunkBTZ5O6VMcjs.define_import_meta_default.url)(
8834
9354
  "rolldown/parseAst"
8835
9355
  ).parseAst)));
8836
9356
  let program;
8837
9357
  try {
8838
- program = parseAst3(code, { lang });
8839
- } catch (e31) {
9358
+ program = parseAst4(code, { lang });
9359
+ } catch (e39) {
8840
9360
  return [];
8841
9361
  }
8842
9362
  const locals = /* @__PURE__ */ new Map();
@@ -8844,7 +9364,7 @@ function findFarmWebMCPTools(code, filename = "module.tsx") {
8844
9364
  if (statement.type !== "ImportDeclaration" || statement.source.value !== WEBMCP_CLIENT)
8845
9365
  continue;
8846
9366
  for (const specifier of statement.specifiers) {
8847
- const imported = _nullishCoalesce(_optionalChain([specifier, 'access', _392 => _392.imported, 'optionalAccess', _393 => _393.name]), () => ( _optionalChain([specifier, 'access', _394 => _394.imported, 'optionalAccess', _395 => _395.value])));
9367
+ const imported = _nullishCoalesce(_optionalChain([specifier, 'access', _427 => _427.imported, 'optionalAccess', _428 => _428.name]), () => ( _optionalChain([specifier, 'access', _429 => _429.imported, 'optionalAccess', _430 => _430.value])));
8848
9368
  if (specifier.type === "ImportSpecifier" && DEFINERS.has(imported))
8849
9369
  locals.set(specifier.local.name, imported);
8850
9370
  }
@@ -8860,7 +9380,7 @@ function findFarmWebMCPTools(code, filename = "module.tsx") {
8860
9380
  const [argument] = current.arguments;
8861
9381
  if (definer && argument) {
8862
9382
  const objects = definer === "registerWebMCPTools" ? argument.type === "ArrayExpression" ? argument.elements.filter(
8863
- (element) => _optionalChain([element, 'optionalAccess', _396 => _396.type]) === "ObjectExpression"
9383
+ (element) => _optionalChain([element, 'optionalAccess', _431 => _431.type]) === "ObjectExpression"
8864
9384
  ) : [] : argument.type === "ObjectExpression" ? [argument] : [];
8865
9385
  for (const object of objects) {
8866
9386
  const tool = toolFromObject(object);
@@ -8874,9 +9394,9 @@ function findFarmWebMCPTools(code, filename = "module.tsx") {
8874
9394
  visit(program.body);
8875
9395
  return found.sort((a, b) => a.start - b.start).map(({ tool }) => tool);
8876
9396
  }
8877
- var cache = /* @__PURE__ */ new Map();
9397
+ var cache2 = /* @__PURE__ */ new Map();
8878
9398
  function collectFarmWebMCPTools(root, srcDir = "src") {
8879
- const base = path6.default.resolve(root, srcDir);
9399
+ const base = path7.default.resolve(root, srcDir);
8880
9400
  let files;
8881
9401
  try {
8882
9402
  files = _tinyglobby.globSync.call(void 0, "**/*.{ts,tsx,js,jsx,mts,mjs,cts,cjs}", {
@@ -8885,7 +9405,7 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
8885
9405
  expandDirectories: false,
8886
9406
  ignore: ["**/node_modules/**", "**/*.d.ts", "**/*.{test,spec}.*", "**/__tests__/**"]
8887
9407
  });
8888
- } catch (e32) {
9408
+ } catch (e40) {
8889
9409
  return [];
8890
9410
  }
8891
9411
  const seen = /* @__PURE__ */ new Set();
@@ -8893,19 +9413,19 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
8893
9413
  for (const file of files.sort()) {
8894
9414
  let mtimeMs;
8895
9415
  try {
8896
- mtimeMs = fs4.default.statSync(file).mtimeMs;
8897
- } catch (e33) {
9416
+ mtimeMs = fs5.default.statSync(file).mtimeMs;
9417
+ } catch (e41) {
8898
9418
  continue;
8899
9419
  }
8900
- let entry = cache.get(file);
9420
+ let entry = cache2.get(file);
8901
9421
  if (!entry || entry.mtimeMs !== mtimeMs) {
8902
9422
  let code = "";
8903
9423
  try {
8904
- code = fs4.default.readFileSync(file, "utf8");
8905
- } catch (e34) {
9424
+ code = fs5.default.readFileSync(file, "utf8");
9425
+ } catch (e42) {
8906
9426
  }
8907
9427
  entry = { mtimeMs, tools: findFarmWebMCPTools(code, file) };
8908
- cache.set(file, entry);
9428
+ cache2.set(file, entry);
8909
9429
  }
8910
9430
  for (const tool of entry.tools) {
8911
9431
  if (seen.has(tool.name) || tools.length >= MAX_TOOLS) continue;
@@ -8920,16 +9440,16 @@ function collectFarmWebMCPTools(root, srcDir = "src") {
8920
9440
 
8921
9441
 
8922
9442
  var ADAPTER_EXTENSIONS = ["ts", "tsx", "js", "jsx", "mts", "mjs"];
8923
- function resolveFarmClientCacheAdapterEntry(root, cache2) {
8924
- const client = _optionalChain([cache2, 'optionalAccess', _397 => _397.client]);
8925
- const adapter = _optionalChain([client, 'optionalAccess', _398 => _398.adapter]);
9443
+ function resolveFarmClientCacheAdapterEntry(root, cache3) {
9444
+ const client = _optionalChain([cache3, 'optionalAccess', _432 => _432.client]);
9445
+ const adapter = _optionalChain([client, 'optionalAccess', _433 => _433.adapter]);
8926
9446
  if (adapter === void 0) return void 0;
8927
9447
  if (typeof adapter !== "string" || adapter.trim().length === 0) {
8928
9448
  throw new Error(
8929
9449
  'cache.client.adapter must be a module path string, for example "./src/cache-adapter".'
8930
9450
  );
8931
9451
  }
8932
- const resolved = path6.default.resolve(root, adapter);
9452
+ const resolved = path7.default.resolve(root, adapter);
8933
9453
  const found = resolveAdapterFile(resolved);
8934
9454
  if (!found) {
8935
9455
  throw new Error(
@@ -8937,15 +9457,15 @@ function resolveFarmClientCacheAdapterEntry(root, cache2) {
8937
9457
  );
8938
9458
  }
8939
9459
  const options = {};
8940
- if (_optionalChain([client, 'optionalAccess', _399 => _399.version]) !== void 0) options.version = client.version;
8941
- if (_optionalChain([client, 'optionalAccess', _400 => _400.flushDelayMs]) !== void 0) options.flushDelayMs = client.flushDelayMs;
9460
+ if (_optionalChain([client, 'optionalAccess', _434 => _434.version]) !== void 0) options.version = client.version;
9461
+ if (_optionalChain([client, 'optionalAccess', _435 => _435.flushDelayMs]) !== void 0) options.flushDelayMs = client.flushDelayMs;
8942
9462
  return { importPath: found.replace(/\\/g, "/"), options };
8943
9463
  }
8944
9464
  function resolveAdapterFile(resolved) {
8945
- if (fs4.default.existsSync(resolved) && fs4.default.statSync(resolved).isFile()) return resolved;
9465
+ if (fs5.default.existsSync(resolved) && fs5.default.statSync(resolved).isFile()) return resolved;
8946
9466
  for (const extension of ADAPTER_EXTENSIONS) {
8947
9467
  const candidate = `${resolved}.${extension}`;
8948
- if (fs4.default.existsSync(candidate) && fs4.default.statSync(candidate).isFile()) return candidate;
9468
+ if (fs5.default.existsSync(candidate) && fs5.default.statSync(candidate).isFile()) return candidate;
8949
9469
  }
8950
9470
  return void 0;
8951
9471
  }
@@ -9156,7 +9676,7 @@ async function readFarmNavigationStream(body, flushToken) {
9156
9676
 
9157
9677
 
9158
9678
 
9159
- var parseAst4;
9679
+ var parseAst5;
9160
9680
  function propertyKeyName(property2) {
9161
9681
  if (property2.computed) return void 0;
9162
9682
  const key = property2.key;
@@ -9165,11 +9685,11 @@ function propertyKeyName(property2) {
9165
9685
  return void 0;
9166
9686
  }
9167
9687
  function redactFarmDocsClientConfig(code, filename) {
9168
- _nullishCoalesce(parseAst4, () => ( (parseAst4 = _module.createRequire.call(void 0, typeof __filename === "string" ? __filename : _chunkBTZ5O6VMcjs.define_import_meta_default.url)(
9688
+ _nullishCoalesce(parseAst5, () => ( (parseAst5 = _module.createRequire.call(void 0, typeof __filename === "string" ? __filename : _chunkBTZ5O6VMcjs.define_import_meta_default.url)(
9169
9689
  "rolldown/parseAst"
9170
9690
  ).parseAst)));
9171
- const extension = path6.default.extname(filename);
9172
- const program = parseAst4(code, {
9691
+ const extension = path7.default.extname(filename);
9692
+ const program = parseAst5(code, {
9173
9693
  lang: extension === ".tsx" || extension === ".jsx" ? "tsx" : "ts"
9174
9694
  });
9175
9695
  const edits = [];
@@ -9182,7 +9702,7 @@ function redactFarmDocsClientConfig(code, filename) {
9182
9702
  const current = node;
9183
9703
  if (current.type === "Property") {
9184
9704
  const name = propertyKeyName(current);
9185
- const valueType = _optionalChain([current, 'access', _401 => _401.value, 'optionalAccess', _402 => _402.type]);
9705
+ const valueType = _optionalChain([current, 'access', _436 => _436.value, 'optionalAccess', _437 => _437.type]);
9186
9706
  const credential = name !== void 0 && (name.toLowerCase() === "headers" || _chunkSM2SYWARcjs.isSecretDocsConfigKey.call(void 0, name) && valueType !== "ObjectExpression" && valueType !== "ArrayExpression");
9187
9707
  if (name && credential) {
9188
9708
  edits.push(
@@ -9213,7 +9733,7 @@ function isFarmDocsClientConfigModule(id, configModule) {
9213
9733
  if (file === configModule) return true;
9214
9734
  try {
9215
9735
  return file === _fs.realpathSync.call(void 0, configModule).replace(/\\/g, "/");
9216
- } catch (e35) {
9736
+ } catch (e43) {
9217
9737
  return false;
9218
9738
  }
9219
9739
  }
@@ -9222,7 +9742,7 @@ function farmDocsClientConfigPlugin(configModule) {
9222
9742
  name: "farm:docs-client-config",
9223
9743
  enforce: "pre",
9224
9744
  transform(code, id, options) {
9225
- if (_optionalChain([options, 'optionalAccess', _403 => _403.ssr]) || !isFarmDocsClientConfigModule(id, configModule)) return null;
9745
+ if (_optionalChain([options, 'optionalAccess', _438 => _438.ssr]) || !isFarmDocsClientConfigModule(id, configModule)) return null;
9226
9746
  const redacted = redactFarmDocsClientConfig(code, id.split("?")[0]);
9227
9747
  return redacted === null ? null : { code: redacted, map: null };
9228
9748
  }
@@ -9253,13 +9773,13 @@ var FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE = [
9253
9773
  ];
9254
9774
  function getFarmClientOptimizeDepsInclude(renderer) {
9255
9775
  return Array.from(
9256
- /* @__PURE__ */ new Set([...FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE, ..._optionalChain([renderer, 'optionalAccess', _404 => _404.optimizeDeps]) || []])
9776
+ /* @__PURE__ */ new Set([...FARM_CLIENT_OPTIMIZE_DEPS_INCLUDE, ..._optionalChain([renderer, 'optionalAccess', _439 => _439.optimizeDeps]) || []])
9257
9777
  );
9258
9778
  }
9259
9779
  function createFarmClientOptimizeDepsEntries(projectRoot, appDirectories) {
9260
- const resolvedProjectRoot = path6.default.resolve(projectRoot);
9780
+ const resolvedProjectRoot = path7.default.resolve(projectRoot);
9261
9781
  return appDirectories.map((appDirectory) => {
9262
- const relativeAppDirectory = path6.default.relative(resolvedProjectRoot, path6.default.resolve(appDirectory)).replace(/\\/g, "/");
9782
+ const relativeAppDirectory = path7.default.relative(resolvedProjectRoot, path7.default.resolve(appDirectory)).replace(/\\/g, "/");
9263
9783
  const prefix = relativeAppDirectory || ".";
9264
9784
  return `${prefix}/${FARM_CLIENT_ENTRY_PATTERN}`;
9265
9785
  });
@@ -9276,12 +9796,12 @@ function createFarmClientOptimizeDepsConfig(entries, renderer) {
9276
9796
  // Farm's HTML boots through a virtual module and imports route UI lazily.
9277
9797
  // Explicit entries let Vite finish that crawl before a navigation can
9278
9798
  // rotate the optimizer hash underneath a hydrated React runtime.
9279
- ..._optionalChain([entries, 'optionalAccess', _405 => _405.length]) ? { entries: [...entries] } : {}
9799
+ ..._optionalChain([entries, 'optionalAccess', _440 => _440.length]) ? { entries: [...entries] } : {}
9280
9800
  };
9281
9801
  }
9282
9802
  function createFarmSourceAlias(projectRoot, srcDir = "src") {
9283
9803
  return {
9284
- "@": path6.default.resolve(projectRoot, srcDir)
9804
+ "@": path7.default.resolve(projectRoot, srcDir)
9285
9805
  };
9286
9806
  }
9287
9807
  function mergeNoExternal(farmValue, userValue) {
@@ -9302,8 +9822,8 @@ function mergeAlias(farmValue, userValue) {
9302
9822
  return [...normalize(userValue), ...normalize(farmValue)];
9303
9823
  }
9304
9824
  function mergeFarmViteConfig(farmConfig, userConfig = {}) {
9305
- const noDiscovery = _nullishCoalesce(_optionalChain([userConfig, 'access', _406 => _406.optimizeDeps, 'optionalAccess', _407 => _407.noDiscovery]), () => ( _optionalChain([farmConfig, 'access', _408 => _408.optimizeDeps, 'optionalAccess', _409 => _409.noDiscovery])));
9306
- const holdUntilCrawlEnd = _nullishCoalesce(_optionalChain([userConfig, 'access', _410 => _410.optimizeDeps, 'optionalAccess', _411 => _411.holdUntilCrawlEnd]), () => ( (_optionalChain([userConfig, 'access', _412 => _412.optimizeDeps, 'optionalAccess', _413 => _413.noDiscovery]) === true ? false : _optionalChain([farmConfig, 'access', _414 => _414.optimizeDeps, 'optionalAccess', _415 => _415.holdUntilCrawlEnd]))));
9825
+ const noDiscovery = _nullishCoalesce(_optionalChain([userConfig, 'access', _441 => _441.optimizeDeps, 'optionalAccess', _442 => _442.noDiscovery]), () => ( _optionalChain([farmConfig, 'access', _443 => _443.optimizeDeps, 'optionalAccess', _444 => _444.noDiscovery])));
9826
+ const holdUntilCrawlEnd = _nullishCoalesce(_optionalChain([userConfig, 'access', _445 => _445.optimizeDeps, 'optionalAccess', _446 => _446.holdUntilCrawlEnd]), () => ( (_optionalChain([userConfig, 'access', _447 => _447.optimizeDeps, 'optionalAccess', _448 => _448.noDiscovery]) === true ? false : _optionalChain([farmConfig, 'access', _449 => _449.optimizeDeps, 'optionalAccess', _450 => _450.holdUntilCrawlEnd]))));
9307
9827
  return {
9308
9828
  ...farmConfig,
9309
9829
  ...userConfig,
@@ -9315,9 +9835,9 @@ function mergeFarmViteConfig(farmConfig, userConfig = {}) {
9315
9835
  resolve: {
9316
9836
  ...farmConfig.resolve,
9317
9837
  ...userConfig.resolve,
9318
- alias: mergeAlias(_optionalChain([farmConfig, 'access', _416 => _416.resolve, 'optionalAccess', _417 => _417.alias]), _optionalChain([userConfig, 'access', _418 => _418.resolve, 'optionalAccess', _419 => _419.alias])),
9838
+ alias: mergeAlias(_optionalChain([farmConfig, 'access', _451 => _451.resolve, 'optionalAccess', _452 => _452.alias]), _optionalChain([userConfig, 'access', _453 => _453.resolve, 'optionalAccess', _454 => _454.alias])),
9319
9839
  dedupe: Array.from(
9320
- /* @__PURE__ */ new Set([..._optionalChain([farmConfig, 'access', _420 => _420.resolve, 'optionalAccess', _421 => _421.dedupe]) || [], ..._optionalChain([userConfig, 'access', _422 => _422.resolve, 'optionalAccess', _423 => _423.dedupe]) || []])
9840
+ /* @__PURE__ */ new Set([..._optionalChain([farmConfig, 'access', _455 => _455.resolve, 'optionalAccess', _456 => _456.dedupe]) || [], ..._optionalChain([userConfig, 'access', _457 => _457.resolve, 'optionalAccess', _458 => _458.dedupe]) || []])
9321
9841
  )
9322
9842
  },
9323
9843
  optimizeDeps: {
@@ -9327,21 +9847,21 @@ function mergeFarmViteConfig(farmConfig, userConfig = {}) {
9327
9847
  holdUntilCrawlEnd,
9328
9848
  include: Array.from(
9329
9849
  /* @__PURE__ */ new Set([
9330
- ..._optionalChain([farmConfig, 'access', _424 => _424.optimizeDeps, 'optionalAccess', _425 => _425.include]) || [],
9331
- ..._optionalChain([userConfig, 'access', _426 => _426.optimizeDeps, 'optionalAccess', _427 => _427.include]) || []
9850
+ ..._optionalChain([farmConfig, 'access', _459 => _459.optimizeDeps, 'optionalAccess', _460 => _460.include]) || [],
9851
+ ..._optionalChain([userConfig, 'access', _461 => _461.optimizeDeps, 'optionalAccess', _462 => _462.include]) || []
9332
9852
  ])
9333
9853
  ),
9334
9854
  exclude: Array.from(
9335
9855
  /* @__PURE__ */ new Set([
9336
- ..._optionalChain([farmConfig, 'access', _428 => _428.optimizeDeps, 'optionalAccess', _429 => _429.exclude]) || [],
9337
- ..._optionalChain([userConfig, 'access', _430 => _430.optimizeDeps, 'optionalAccess', _431 => _431.exclude]) || []
9856
+ ..._optionalChain([farmConfig, 'access', _463 => _463.optimizeDeps, 'optionalAccess', _464 => _464.exclude]) || [],
9857
+ ..._optionalChain([userConfig, 'access', _465 => _465.optimizeDeps, 'optionalAccess', _466 => _466.exclude]) || []
9338
9858
  ])
9339
9859
  )
9340
9860
  },
9341
9861
  ssr: {
9342
9862
  ...farmConfig.ssr,
9343
9863
  ...userConfig.ssr,
9344
- noExternal: mergeNoExternal(_optionalChain([farmConfig, 'access', _432 => _432.ssr, 'optionalAccess', _433 => _433.noExternal]), _optionalChain([userConfig, 'access', _434 => _434.ssr, 'optionalAccess', _435 => _435.noExternal]))
9864
+ noExternal: mergeNoExternal(_optionalChain([farmConfig, 'access', _467 => _467.ssr, 'optionalAccess', _468 => _468.noExternal]), _optionalChain([userConfig, 'access', _469 => _469.ssr, 'optionalAccess', _470 => _470.noExternal]))
9345
9865
  }
9346
9866
  };
9347
9867
  }
@@ -9393,7 +9913,7 @@ function mergeFarmProductionViteConfig(farmConfig, userConfig = {}) {
9393
9913
  ...farmConfig.build,
9394
9914
  rollupOptions: {
9395
9915
  ...userBundlerOptions,
9396
- ..._optionalChain([farmConfig, 'access', _436 => _436.build, 'optionalAccess', _437 => _437.rollupOptions])
9916
+ ..._optionalChain([farmConfig, 'access', _471 => _471.build, 'optionalAccess', _472 => _472.rollupOptions])
9397
9917
  }
9398
9918
  },
9399
9919
  css: farmConfig.css || userCss ? { ...farmConfig.css, ...userCss } : void 0,
@@ -9401,7 +9921,7 @@ function mergeFarmProductionViteConfig(farmConfig, userConfig = {}) {
9401
9921
  esbuild: typeof userEsbuild === "object" && farmConfig.esbuild !== false ? { ...userEsbuild, ...farmConfig.esbuild } : _nullishCoalesce(farmConfig.esbuild, () => ( userEsbuild)),
9402
9922
  ssr: {
9403
9923
  ...merged.ssr,
9404
- external: mergeExternal(_optionalChain([farmConfig, 'access', _438 => _438.ssr, 'optionalAccess', _439 => _439.external]), _optionalChain([userConfig, 'access', _440 => _440.ssr, 'optionalAccess', _441 => _441.external]))
9924
+ external: mergeExternal(_optionalChain([farmConfig, 'access', _473 => _473.ssr, 'optionalAccess', _474 => _474.external]), _optionalChain([userConfig, 'access', _475 => _475.ssr, 'optionalAccess', _476 => _476.external]))
9405
9925
  }
9406
9926
  };
9407
9927
  }
@@ -9482,4 +10002,11 @@ ${FARM_DARK_VARIANT}
9482
10002
 
9483
10003
 
9484
10004
 
9485
- exports.rewriteFarmPackageClientImports = rewriteFarmPackageClientImports; exports.withPackageClientBoundaryCache = withPackageClientBoundaryCache; exports.usePackageClientBoundaryCacheFile = usePackageClientBoundaryCacheFile; exports.resolveModuleSourcePath = resolveModuleSourcePath; exports.getFarmClientHydrationPlanOptions = getFarmClientHydrationPlanOptions; exports.describeSuppressedAsyncHydration = describeSuppressedAsyncHydration; exports.resolveFarmIsolatedClientHydrationMode = resolveFarmIsolatedClientHydrationMode; exports.hasUseClientDirective = hasUseClientDirective; exports.getIslandStrategyExport = getIslandStrategyExport; exports.stripUseClientDirective = stripUseClientDirective; exports.collectFarmServerStylesheets = collectFarmServerStylesheets; exports.getClientModuleMetadata = getClientModuleMetadata; exports.getClientModuleHydrationPlan = getClientModuleHydrationPlan; exports.usesFarmServerTree = usesFarmServerTree; exports.createMarkdownPageHydrationPlanner = createMarkdownPageHydrationPlanner; exports.enforceFarmIsolatedHydrationRouteBudget = enforceFarmIsolatedHydrationRouteBudget; exports.isIsolatableClientBoundarySource = isIsolatableClientBoundarySource; exports.isFarmPackageClientBoundary = isFarmPackageClientBoundary; exports.collectFarmClientPackageImports = collectFarmClientPackageImports; exports.RouteManager = RouteManager; exports.resolveDevGlobalStylesheetHref = resolveDevGlobalStylesheetHref; exports.resolveFarmNotFoundComponentPath = resolveFarmNotFoundComponentPath; exports.farmFontImportsPlugin = farmFontImportsPlugin; exports.mergeFarmFontCss = mergeFarmFontCss; exports.DEFAULT_NOT_FOUND_STYLES = DEFAULT_NOT_FOUND_STYLES; exports.generateFarmIntegrationProviderClientCode = generateFarmIntegrationProviderClientCode; exports.generateFarmIntegrationProviderServerModules = generateFarmIntegrationProviderServerModules; exports.inferFarmIslandStrategy = inferFarmIslandStrategy; exports.resolveFarmRouteRootStrategy = resolveFarmRouteRootStrategy; exports.generateFarmClientPluginEntryCode = generateFarmClientPluginEntryCode; exports.canBootFarmIslandsClient = canBootFarmIslandsClient; exports.ServerRenderer = ServerRenderer; exports.FarmApp = FarmApp; exports.createFarmApp = createFarmApp; exports.SHARP_INSTALL_HINT = SHARP_INSTALL_HINT; exports.resolveFarmImageProviderForRuntime = resolveFarmImageProviderForRuntime; exports.resolveFarmImageServerRuntime = resolveFarmImageServerRuntime; exports.resolveFarmAppPackages = resolveFarmAppPackages; exports.collectFarmWebMCPTools = collectFarmWebMCPTools; exports.resolveFarmClientCacheAdapterEntry = resolveFarmClientCacheAdapterEntry; exports.generateClientCachePersistenceCode = generateClientCachePersistenceCode; exports.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE = FARM_LAYOUT_ELEMENT_CLIENT_SOURCE; exports.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE = FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE; exports.FARM_NAVIGATION_STREAM_READER_SOURCE = FARM_NAVIGATION_STREAM_READER_SOURCE; exports.redactFarmDocsClientConfig = redactFarmDocsClientConfig; exports.isFarmDocsClientConfigModule = isFarmDocsClientConfigModule; exports.farmDocsClientConfigPlugin = farmDocsClientConfigPlugin; exports.createFarmClientOptimizeDepsEntries = createFarmClientOptimizeDepsEntries; exports.createFarmClientOptimizeDepsConfig = createFarmClientOptimizeDepsConfig; exports.createFarmSourceAlias = createFarmSourceAlias; exports.mergeFarmViteConfig = mergeFarmViteConfig; exports.mergeFarmProductionViteConfig = mergeFarmProductionViteConfig; exports.createFarmThemeCssPlugin = createFarmThemeCssPlugin;
10005
+
10006
+
10007
+
10008
+
10009
+
10010
+
10011
+
10012
+ exports.rewriteFarmReactServerImports = rewriteFarmReactServerImports; exports.farmRelativeImportFiles = farmRelativeImportFiles; exports.ensureFarmPackageClientReference = ensureFarmPackageClientReference; exports.rewriteFarmPackageClientImports = rewriteFarmPackageClientImports; exports.withPackageClientBoundaryCache = withPackageClientBoundaryCache; exports.usePackageClientBoundaryCacheFile = usePackageClientBoundaryCacheFile; exports.resolveModuleSourcePath = resolveModuleSourcePath; exports.getFarmClientHydrationPlanOptions = getFarmClientHydrationPlanOptions; exports.describeSuppressedAsyncHydration = describeSuppressedAsyncHydration; exports.resolveFarmIsolatedClientHydrationMode = resolveFarmIsolatedClientHydrationMode; exports.hasUseClientDirective = hasUseClientDirective; exports.getIslandStrategyExport = getIslandStrategyExport; exports.stripUseClientDirective = stripUseClientDirective; exports.collectFarmServerStylesheets = collectFarmServerStylesheets; exports.getClientModuleMetadata = getClientModuleMetadata; exports.getClientModuleHydrationPlan = getClientModuleHydrationPlan; exports.usesFarmServerTree = usesFarmServerTree; exports.createMarkdownPageHydrationPlanner = createMarkdownPageHydrationPlanner; exports.enforceFarmIsolatedHydrationRouteBudget = enforceFarmIsolatedHydrationRouteBudget; exports.isIsolatableClientBoundarySource = isIsolatableClientBoundarySource; exports.isFarmPackageClientBoundary = isFarmPackageClientBoundary; exports.collectFarmClientPackageImports = collectFarmClientPackageImports; exports.invalidateFarmClientReachableModules = invalidateFarmClientReachableModules; exports.getFarmClientReachableModules = getFarmClientReachableModules; exports.resolveFarmClientOptimizeDeps = resolveFarmClientOptimizeDeps; exports.RouteManager = RouteManager; exports.resolveDevGlobalStylesheetHref = resolveDevGlobalStylesheetHref; exports.collectDevStylesheetUrls = collectDevStylesheetUrls; exports.resolveFarmNotFoundComponentPath = resolveFarmNotFoundComponentPath; exports.farmFontImportsPlugin = farmFontImportsPlugin; exports.mergeFarmFontCss = mergeFarmFontCss; exports.DEFAULT_NOT_FOUND_STYLES = DEFAULT_NOT_FOUND_STYLES; exports.generateFarmIntegrationProviderClientCode = generateFarmIntegrationProviderClientCode; exports.generateFarmIntegrationProviderServerModules = generateFarmIntegrationProviderServerModules; exports.inferFarmIslandStrategy = inferFarmIslandStrategy; exports.resolveFarmRouteRootStrategy = resolveFarmRouteRootStrategy; exports.generateFarmClientPluginEntryCode = generateFarmClientPluginEntryCode; exports.canBootFarmIslandsClient = canBootFarmIslandsClient; exports.ServerRenderer = ServerRenderer; exports.FarmApp = FarmApp; exports.createFarmApp = createFarmApp; exports.SHARP_INSTALL_HINT = SHARP_INSTALL_HINT; exports.resolveFarmImageProviderForRuntime = resolveFarmImageProviderForRuntime; exports.resolveFarmImageServerRuntime = resolveFarmImageServerRuntime; exports.resolveFarmAppPackages = resolveFarmAppPackages; exports.collectFarmWebMCPTools = collectFarmWebMCPTools; exports.resolveFarmClientCacheAdapterEntry = resolveFarmClientCacheAdapterEntry; exports.generateClientCachePersistenceCode = generateClientCachePersistenceCode; exports.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE = FARM_LAYOUT_ELEMENT_CLIENT_SOURCE; exports.FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE = FARM_SERVER_TREE_LAYOUT_CLIENT_SOURCE; exports.FARM_NAVIGATION_STREAM_READER_SOURCE = FARM_NAVIGATION_STREAM_READER_SOURCE; exports.redactFarmDocsClientConfig = redactFarmDocsClientConfig; exports.isFarmDocsClientConfigModule = isFarmDocsClientConfigModule; exports.farmDocsClientConfigPlugin = farmDocsClientConfigPlugin; exports.createFarmClientOptimizeDepsEntries = createFarmClientOptimizeDepsEntries; exports.createFarmClientOptimizeDepsConfig = createFarmClientOptimizeDepsConfig; exports.createFarmSourceAlias = createFarmSourceAlias; exports.mergeFarmViteConfig = mergeFarmViteConfig; exports.mergeFarmProductionViteConfig = mergeFarmProductionViteConfig; exports.createFarmThemeCssPlugin = createFarmThemeCssPlugin;