@farm.js/core 0.1.19 → 0.1.21

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 (165) hide show
  1. package/dist/agent-runtime.d.mts +2 -3
  2. package/dist/agent-runtime.d.ts +2 -3
  3. package/dist/api/route-manager.cjs +5 -5
  4. package/dist/api/route-manager.d.mts +2 -3
  5. package/dist/api/route-manager.d.ts +2 -3
  6. package/dist/api/route-manager.mjs +4 -4
  7. package/dist/api.cjs +6 -6
  8. package/dist/api.d.mts +3 -4
  9. package/dist/api.d.ts +3 -4
  10. package/dist/api.mjs +5 -5
  11. package/dist/{app-BHY_10Lm.d.ts → app-DAyPE-gr.d.ts} +11 -4
  12. package/dist/{app-BMk0do23.d.mts → app-D_6nTit-.d.mts} +11 -4
  13. package/dist/app-markdown.d.mts +3 -4
  14. package/dist/app-markdown.d.ts +3 -4
  15. package/dist/{chunk-FS7FLPOG.mjs → chunk-2J7W2WND.mjs} +3 -2
  16. package/dist/{chunk-YS3TRKCG.mjs → chunk-2M435BUE.mjs} +6 -1
  17. package/dist/{chunk-WJ3HK3LJ.cjs → chunk-2QLBIPFT.cjs} +4 -4
  18. package/dist/{chunk-FJSWYIR7.cjs → chunk-3IL5UC5I.cjs} +2 -2
  19. package/dist/chunk-43FMW62B.mjs +67 -0
  20. package/dist/{chunk-WZXN4R5Y.mjs → chunk-53G3OLTA.mjs} +106 -75
  21. package/dist/{chunk-FVZGEVTO.mjs → chunk-5L6NBNHI.mjs} +123 -41
  22. package/dist/{chunk-A7T6345N.mjs → chunk-5UX4C5QI.mjs} +10 -7
  23. package/dist/chunk-75WGQVQA.cjs +46 -0
  24. package/dist/{chunk-AFOD3LYZ.cjs → chunk-B3WK4DTX.cjs} +10 -9
  25. package/dist/{chunk-AORPIPNB.cjs → chunk-BHJUZ64B.cjs} +18 -14
  26. package/dist/chunk-BMWDEBXO.cjs +67 -0
  27. package/dist/{chunk-ATERBVHQ.mjs → chunk-CQHFU55R.mjs} +5 -4
  28. package/dist/{chunk-XSKZORAS.cjs → chunk-DX4VKYAJ.cjs} +5 -5
  29. package/dist/{chunk-7WPA7GBZ.mjs → chunk-GHFS7RUB.mjs} +1 -1
  30. package/dist/{chunk-NZ2JVBT2.mjs → chunk-GZ3ZPTQV.mjs} +2 -2
  31. package/dist/{chunk-RKQVJN2O.mjs → chunk-JIKGGIOL.mjs} +1 -1
  32. package/dist/{chunk-OXSIH4D6.cjs → chunk-KNPRCKXK.cjs} +6 -1
  33. package/dist/{chunk-XDGMADQM.cjs → chunk-L7ARWZYT.cjs} +384 -353
  34. package/dist/{chunk-2ANEVVF7.mjs → chunk-NRS46D4L.mjs} +1 -1
  35. package/dist/{chunk-A72YEUZ3.mjs → chunk-OCE65DDM.mjs} +1 -1
  36. package/dist/{chunk-2GNATDDE.mjs → chunk-PKO4FCTL.mjs} +1 -1
  37. package/dist/{chunk-UDBJCUPA.mjs → chunk-PUCUVI7K.mjs} +11 -7
  38. package/dist/{chunk-RFYO7QUD.cjs → chunk-Q2TUENW2.cjs} +1 -1
  39. package/dist/{chunk-GDSHDTJ4.cjs → chunk-Q5B3KJBP.cjs} +2 -2
  40. package/dist/{chunk-TSWW5BVH.mjs → chunk-QMV4QELL.mjs} +1 -1
  41. package/dist/{chunk-V4AICMQA.mjs → chunk-RMIJFZU3.mjs} +26 -2
  42. package/dist/{chunk-NSFC3LHB.cjs → chunk-RWXZKZXB.cjs} +255 -173
  43. package/dist/{chunk-MKB2EGIR.cjs → chunk-SOR334EB.cjs} +3 -2
  44. package/dist/{chunk-57J3Y7Y3.mjs → chunk-TIKNUAU7.mjs} +3 -2
  45. package/dist/chunk-VVBO3QH7.mjs +46 -0
  46. package/dist/{chunk-QBPKKQTD.mjs → chunk-W7MZXRXM.mjs} +19 -4
  47. package/dist/{chunk-Y53ZSFN6.cjs → chunk-WM6HL7E7.cjs} +4 -3
  48. package/dist/{chunk-GPVTX3HT.cjs → chunk-XFFQSD2F.cjs} +2 -2
  49. package/dist/{chunk-62YJ2IEB.cjs → chunk-XI3GWPUS.cjs} +23 -20
  50. package/dist/{chunk-KVFPGF2M.cjs → chunk-YJJLXIIS.cjs} +7 -7
  51. package/dist/{chunk-U5BMPGS3.cjs → chunk-YP5JZ4LF.cjs} +32 -8
  52. package/dist/{chunk-S27FMYAM.cjs → chunk-ZE6ONQ5R.cjs} +28 -13
  53. package/dist/{client-plugins-JXXmZliS.d.mts → client-plugins-CWrhb1ir.d.mts} +26 -3
  54. package/dist/{client-plugins-C089bQhN.d.ts → client-plugins-DPf0qZey.d.ts} +26 -3
  55. package/dist/client-plugins.d.mts +2 -3
  56. package/dist/client-plugins.d.ts +2 -3
  57. package/dist/client.cjs +4 -4
  58. package/dist/client.d.mts +9 -38
  59. package/dist/client.d.ts +9 -38
  60. package/dist/client.mjs +3 -3
  61. package/dist/config.d.mts +2 -3
  62. package/dist/config.d.ts +2 -3
  63. package/dist/{devtools-FY5R7TQ4.mjs → devtools-MTB5SA2B.mjs} +3 -3
  64. package/dist/{devtools-5KGPDVKL.cjs → devtools-R6MDDAZK.cjs} +7 -7
  65. package/dist/docs.cjs +6 -5
  66. package/dist/docs.d.mts +2 -2
  67. package/dist/docs.d.ts +2 -2
  68. package/dist/docs.mjs +5 -4
  69. package/dist/index.cjs +21 -20
  70. package/dist/index.d.mts +14 -14
  71. package/dist/index.d.ts +14 -14
  72. package/dist/index.mjs +20 -19
  73. package/dist/integrations.d.mts +2 -3
  74. package/dist/integrations.d.ts +2 -3
  75. package/dist/internal/app-markdown-runtime.d.mts +2 -3
  76. package/dist/internal/app-markdown-runtime.d.ts +2 -3
  77. package/dist/internal/build-runtime.cjs +15 -14
  78. package/dist/internal/build-runtime.d.mts +4 -5
  79. package/dist/internal/build-runtime.d.ts +4 -5
  80. package/dist/internal/build-runtime.mjs +14 -13
  81. package/dist/internal/cli-runtime.cjs +7 -7
  82. package/dist/internal/cli-runtime.mjs +6 -6
  83. package/dist/internal/client-error-overlay.cjs +4 -4
  84. package/dist/internal/client-error-overlay.mjs +1 -1
  85. package/dist/internal/compression-runtime.d.mts +2 -3
  86. package/dist/internal/compression-runtime.d.ts +2 -3
  87. package/dist/internal/config-runtime.cjs +4 -4
  88. package/dist/internal/config-runtime.d.mts +3 -4
  89. package/dist/internal/config-runtime.d.ts +3 -4
  90. package/dist/internal/config-runtime.mjs +3 -3
  91. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  92. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  93. package/dist/internal/production-runtime.cjs +2 -2
  94. package/dist/internal/production-runtime.d.mts +8 -9
  95. package/dist/internal/production-runtime.d.ts +8 -9
  96. package/dist/internal/production-runtime.mjs +1 -1
  97. package/dist/{metadata-C1Z9vLbb.d.mts → metadata-CO9fRyyJ.d.mts} +1 -1
  98. package/dist/{metadata-BcNJP4fq.d.ts → metadata-zY9wltwH.d.ts} +1 -1
  99. package/dist/middleware.cjs +4 -4
  100. package/dist/middleware.d.mts +4 -11
  101. package/dist/middleware.d.ts +4 -11
  102. package/dist/middleware.mjs +3 -3
  103. package/dist/navigation.cjs +5 -5
  104. package/dist/navigation.d.mts +42 -3
  105. package/dist/navigation.d.ts +42 -3
  106. package/dist/navigation.mjs +4 -4
  107. package/dist/{nitro-CVZ36JM5.mjs → nitro-4LFVTT24.mjs} +2 -2
  108. package/dist/{nitro-4I2MYLY2.cjs → nitro-TSGDUJMN.cjs} +3 -3
  109. package/dist/plugin.cjs +17 -11
  110. package/dist/plugin.d.mts +3 -4
  111. package/dist/plugin.d.ts +3 -4
  112. package/dist/plugin.mjs +17 -11
  113. package/dist/{production-runtime-jcrTlRTb.d.mts → production-runtime-CywsHwnG.d.mts} +1 -1
  114. package/dist/{production-runtime-oKmC0WU-.d.ts → production-runtime-lkfwujwK.d.ts} +1 -1
  115. package/dist/query/client.cjs +6 -6
  116. package/dist/query/client.mjs +2 -2
  117. package/dist/{render-plan-DOB9cV-h.d.ts → render-plan-DHF0GeWo.d.ts} +1 -1
  118. package/dist/{render-plan-BLIfc4jt.d.mts → render-plan-LVy6sGQe.d.mts} +1 -1
  119. package/dist/renderer-client.cjs +5 -5
  120. package/dist/renderer-client.d.mts +4 -5
  121. package/dist/renderer-client.d.ts +4 -5
  122. package/dist/renderer-client.mjs +2 -2
  123. package/dist/renderer.d.mts +3 -0
  124. package/dist/renderer.d.ts +3 -0
  125. package/dist/{request-Cr53NRHr.d.mts → request-6AkmhEYE.d.mts} +1 -1
  126. package/dist/{request-Dt2gNuQD.d.ts → request-BYxlRqA9.d.ts} +1 -1
  127. package/dist/request.d.mts +3 -4
  128. package/dist/request.d.ts +3 -4
  129. package/dist/{route-rendering-CWYd8Mv1.d.ts → route-rendering-CWaKiUbS.d.ts} +1 -1
  130. package/dist/{route-rendering-CeFBEAoZ.d.mts → route-rendering-Dd8Jmml7.d.mts} +1 -1
  131. package/dist/router-B2m4fvve.d.ts +50 -0
  132. package/dist/router-xwEE112q.d.mts +50 -0
  133. package/dist/routes.cjs +3 -3
  134. package/dist/routes.d.mts +2 -3
  135. package/dist/routes.d.ts +2 -3
  136. package/dist/routes.mjs +2 -2
  137. package/dist/server-plugins.d.mts +3 -4
  138. package/dist/server-plugins.d.ts +3 -4
  139. package/dist/server.cjs +25 -24
  140. package/dist/server.d.mts +8 -9
  141. package/dist/server.d.ts +8 -9
  142. package/dist/server.mjs +12 -11
  143. package/dist/{spa-router-CQWiYGxS.d.mts → spa-router-DVEHQnWo.d.mts} +3 -3
  144. package/dist/{spa-router-Wjiw-8hB.d.ts → spa-router-Y8rrXTVK.d.ts} +3 -3
  145. package/dist/testing.cjs +6 -6
  146. package/dist/testing.d.mts +2 -3
  147. package/dist/testing.d.ts +2 -3
  148. package/dist/testing.mjs +5 -5
  149. package/dist/{types-D-1WTE72.d.mts → types-DFbjpjXX.d.mts} +8 -0
  150. package/dist/{types-D-1WTE72.d.ts → types-DFbjpjXX.d.ts} +8 -0
  151. package/dist/{utils-uUxF0K0P.d.mts → utils-DSPx34-A.d.mts} +1 -1
  152. package/dist/{utils-B0XJmG_b.d.ts → utils-Dvuny_08.d.ts} +1 -1
  153. package/dist/version.cjs +2 -2
  154. package/dist/version.mjs +1 -1
  155. package/dist/vite.cjs +12 -11
  156. package/dist/vite.d.mts +2 -3
  157. package/dist/vite.d.ts +2 -3
  158. package/dist/vite.mjs +11 -10
  159. package/package.json +3 -3
  160. package/dist/chunk-7GNWGLWB.mjs +0 -14
  161. package/dist/chunk-VQDBNVOO.cjs +0 -14
  162. package/dist/navigation-errors-Dvwpzaer.d.mts +0 -13
  163. package/dist/navigation-errors-Dvwpzaer.d.ts +0 -13
  164. /package/dist/{chunk-IAMRBF3Z.cjs → chunk-N4RLRSWW.cjs} +0 -0
  165. /package/dist/{chunk-BNGS6KJ6.mjs → chunk-YOYF2E4U.mjs} +0 -0
@@ -7,7 +7,7 @@ var _chunkMT763TDWcjs = require('./chunk-MT763TDW.cjs');
7
7
 
8
8
 
9
9
 
10
- var _chunkS27FMYAMcjs = require('./chunk-S27FMYAM.cjs');
10
+ var _chunkZE6ONQ5Rcjs = require('./chunk-ZE6ONQ5R.cjs');
11
11
 
12
12
 
13
13
 
@@ -31,7 +31,7 @@ var _chunkYA6LLTIJcjs = require('./chunk-YA6LLTIJ.cjs');
31
31
 
32
32
 
33
33
 
34
- var _chunkU5BMPGS3cjs = require('./chunk-U5BMPGS3.cjs');
34
+ var _chunkYP5JZ4LFcjs = require('./chunk-YP5JZ4LF.cjs');
35
35
 
36
36
 
37
37
  var _chunkRTHIVJ2Gcjs = require('./chunk-RTHIVJ2G.cjs');
@@ -63,14 +63,13 @@ var _chunk2SJ4RQ6Pcjs = require('./chunk-2SJ4RQ6P.cjs');
63
63
 
64
64
 
65
65
 
66
+ var _chunkL7ARWZYTcjs = require('./chunk-L7ARWZYT.cjs');
66
67
 
67
- var _chunkXDGMADQMcjs = require('./chunk-XDGMADQM.cjs');
68
68
 
69
69
 
70
70
 
71
71
 
72
-
73
- var _chunkGPVTX3HTcjs = require('./chunk-GPVTX3HT.cjs');
72
+ var _chunkXFFQSD2Fcjs = require('./chunk-XFFQSD2F.cjs');
74
73
 
75
74
 
76
75
  var _chunkCXP5U3RWcjs = require('./chunk-CXP5U3RW.cjs');
@@ -80,10 +79,14 @@ var _chunk22GUSVNJcjs = require('./chunk-22GUSVNJ.cjs');
80
79
 
81
80
 
82
81
 
82
+ var _chunk75WGQVQAcjs = require('./chunk-75WGQVQA.cjs');
83
+
84
+
85
+
83
86
  var _chunkHREOKQWTcjs = require('./chunk-HREOKQWT.cjs');
84
87
 
85
88
 
86
- var _chunkGDSHDTJ4cjs = require('./chunk-GDSHDTJ4.cjs');
89
+ var _chunkQ5B3KJBPcjs = require('./chunk-Q5B3KJBP.cjs');
87
90
 
88
91
 
89
92
  var _chunkY4YMF2NQcjs = require('./chunk-Y4YMF2NQ.cjs');
@@ -124,10 +127,10 @@ var _chunkK6FNHVDRcjs = require('./chunk-K6FNHVDR.cjs');
124
127
  var _chunkZ5HIWVDPcjs = require('./chunk-Z5HIWVDP.cjs');
125
128
 
126
129
 
127
- var _chunkY53ZSFN6cjs = require('./chunk-Y53ZSFN6.cjs');
130
+ var _chunkWM6HL7E7cjs = require('./chunk-WM6HL7E7.cjs');
128
131
 
129
132
 
130
- var _chunkAFOD3LYZcjs = require('./chunk-AFOD3LYZ.cjs');
133
+ var _chunkB3WK4DTXcjs = require('./chunk-B3WK4DTX.cjs');
131
134
 
132
135
 
133
136
  var _chunkIQXFRNY2cjs = require('./chunk-IQXFRNY2.cjs');
@@ -143,7 +146,7 @@ var _chunkWPYFSQKKcjs = require('./chunk-WPYFSQKK.cjs');
143
146
 
144
147
 
145
148
 
146
- var _chunkMKB2EGIRcjs = require('./chunk-MKB2EGIR.cjs');
149
+ var _chunkSOR334EBcjs = require('./chunk-SOR334EB.cjs');
147
150
 
148
151
 
149
152
 
@@ -294,7 +297,7 @@ async function compileFarmDocsManifest(docs, options) {
294
297
  fontStylesheetHref: options.fontStylesheetHref,
295
298
  globalStylesheetHref: options.globalStylesheetHref
296
299
  });
297
- const apiHandler = _chunkS27FMYAMcjs.createFarmDocsAPIHandler.call(void 0, {
300
+ const apiHandler = _chunkZE6ONQ5Rcjs.createFarmDocsAPIHandler.call(void 0, {
298
301
  rootDir: options.root,
299
302
  srcDir: options.srcDir,
300
303
  docs
@@ -406,7 +409,7 @@ async function createFarmRouteRuntimeManifest(options) {
406
409
  const routes = [];
407
410
  for (const [pattern, entry] of options.routeManager.getRoutes()) {
408
411
  const routeModule = await options.routeManager.loadRouteModule(entry.modulePath);
409
- const rendering = await _chunkGPVTX3HTcjs.resolveRouteRenderingConfigFromFile.call(void 0, routeModule, entry.modulePath);
412
+ const rendering = await _chunkXFFQSD2Fcjs.resolveRouteRenderingConfigFromFile.call(void 0, routeModule, entry.modulePath);
410
413
  const runtimeConfig = await options.routeManager.resolveRouteRuntimeConfig(pattern);
411
414
  routes.push({
412
415
  kind: "page",
@@ -421,9 +424,9 @@ async function createFarmRouteRuntimeManifest(options) {
421
424
  pattern,
422
425
  _chunkWPYFSQKKcjs.resolveFarmAPIServerBasePath.call(void 0, options.config.api)
423
426
  );
424
- const inherited = _chunkMKB2EGIRcjs.resolveFarmRouteRuleRuntimeConfig.call(void 0, publicPattern, options.config.routeRules);
425
- const own = _chunkMKB2EGIRcjs.normalizeFarmRouteRuntimeConfig.call(void 0,
426
- _chunkMKB2EGIRcjs.getFarmRouteRuntimeConfig.call(void 0, route),
427
+ const inherited = _chunkSOR334EBcjs.resolveFarmRouteRuleRuntimeConfig.call(void 0, publicPattern, options.config.routeRules);
428
+ const own = _chunkSOR334EBcjs.normalizeFarmRouteRuntimeConfig.call(void 0,
429
+ _chunkSOR334EBcjs.getFarmRouteRuntimeConfig.call(void 0, route),
427
430
  `API route "${pattern}"`
428
431
  );
429
432
  routes.push({
@@ -431,8 +434,8 @@ async function createFarmRouteRuntimeManifest(options) {
431
434
  pattern: publicPattern,
432
435
  rendering: "dynamic",
433
436
  source: normalizeManifestSource(root, route.filePath),
434
- ..._chunkMKB2EGIRcjs.resolveFarmRouteRuntimeConfig.call(void 0,
435
- _chunkMKB2EGIRcjs.mergeFarmRouteRuntimeConfigs.call(void 0, inherited, own),
437
+ ..._chunkSOR334EBcjs.resolveFarmRouteRuntimeConfig.call(void 0,
438
+ _chunkSOR334EBcjs.mergeFarmRouteRuntimeConfigs.call(void 0, inherited, own),
436
439
  `API route "${pattern}"`
437
440
  )
438
441
  });
@@ -440,9 +443,9 @@ async function createFarmRouteRuntimeManifest(options) {
440
443
  for (const entry of options.routeManager.getMetadataRoutes().values()) {
441
444
  const routeModule = await options.routeManager.loadRouteModule(entry.modulePath);
442
445
  const pattern = entry.pattern === "/" ? `/${entry.outputName}` : `${entry.pattern}/${entry.outputName}`;
443
- const inherited = _chunkMKB2EGIRcjs.resolveFarmRouteRuleRuntimeConfig.call(void 0, pattern, options.config.routeRules);
444
- const own = _chunkMKB2EGIRcjs.normalizeFarmRouteRuntimeConfig.call(void 0,
445
- _chunkMKB2EGIRcjs.getFarmRouteRuntimeConfig.call(void 0, routeModule),
446
+ const inherited = _chunkSOR334EBcjs.resolveFarmRouteRuleRuntimeConfig.call(void 0, pattern, options.config.routeRules);
447
+ const own = _chunkSOR334EBcjs.normalizeFarmRouteRuntimeConfig.call(void 0,
448
+ _chunkSOR334EBcjs.getFarmRouteRuntimeConfig.call(void 0, routeModule),
446
449
  `Metadata route "${pattern}"`
447
450
  );
448
451
  routes.push({
@@ -450,19 +453,19 @@ async function createFarmRouteRuntimeManifest(options) {
450
453
  pattern,
451
454
  rendering: "dynamic",
452
455
  source: normalizeManifestSource(root, entry.modulePath),
453
- ..._chunkMKB2EGIRcjs.resolveFarmRouteRuntimeConfig.call(void 0,
454
- _chunkMKB2EGIRcjs.mergeFarmRouteRuntimeConfigs.call(void 0, inherited, own),
456
+ ..._chunkSOR334EBcjs.resolveFarmRouteRuntimeConfig.call(void 0,
457
+ _chunkSOR334EBcjs.mergeFarmRouteRuntimeConfigs.call(void 0, inherited, own),
455
458
  `Metadata route "${pattern}"`
456
459
  )
457
460
  });
458
461
  }
459
462
  for (const [pattern, rule] of Object.entries(options.config.routeRules)) {
460
- if (!_chunkMKB2EGIRcjs.hasFarmRouteRuntimeControls.call(void 0, rule)) continue;
463
+ if (!_chunkSOR334EBcjs.hasFarmRouteRuntimeControls.call(void 0, rule)) continue;
461
464
  routes.push({
462
465
  kind: "rule",
463
466
  pattern,
464
467
  rendering: rule.prerender || rule.render === "static" ? "static" : "dynamic",
465
- ..._chunkMKB2EGIRcjs.resolveFarmRouteRuntimeConfig.call(void 0, rule, `Route rule "${pattern}"`)
468
+ ..._chunkSOR334EBcjs.resolveFarmRouteRuntimeConfig.call(void 0, rule, `Route rule "${pattern}"`)
466
469
  });
467
470
  }
468
471
  return {
@@ -534,7 +537,7 @@ async function createFarmVercelRouteRuntimeFunctions(outputDir, manifest, fs, ba
534
537
  regions: route.regions,
535
538
  maxDuration: route.maxDuration
536
539
  };
537
- const key = _chunkMKB2EGIRcjs.createFarmRouteRuntimeKey.call(void 0, config);
540
+ const key = _chunkSOR334EBcjs.createFarmRouteRuntimeKey.call(void 0, config);
538
541
  const group = groups.get(key) || { config, routes: [] };
539
542
  group.routes.push(route);
540
543
  groups.set(key, group);
@@ -561,7 +564,7 @@ async function createFarmVercelRouteRuntimeFunctions(outputDir, manifest, fs, ba
561
564
  const src = farmRoutePatternToVercelSource(route.pattern, basePath);
562
565
  if (seenSources.has(src)) continue;
563
566
  seenSources.add(src);
564
- const key = _chunkMKB2EGIRcjs.createFarmRouteRuntimeKey.call(void 0, {
567
+ const key = _chunkSOR334EBcjs.createFarmRouteRuntimeKey.call(void 0, {
565
568
  runtime: route.runtime === "auto" ? "node" : route.runtime,
566
569
  regions: route.regions,
567
570
  maxDuration: route.maxDuration
@@ -1508,7 +1511,7 @@ function hasFarmPluginRoutes(config) {
1508
1511
  _chunkS3JO3N4Hcjs.__name.call(void 0, hasFarmPluginRoutes, "hasFarmPluginRoutes");
1509
1512
  function farmServerRuntimePluginsMayHandlePath(config, pathname) {
1510
1513
  return (config.plugins || []).some(
1511
- (plugin) => _chunkZ5HIWVDPcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) !== false && _chunkXDGMADQMcjs.farmPluginMayAffectRuntimePath.call(void 0, plugin, pathname)
1514
+ (plugin) => _chunkZ5HIWVDPcjs.getFarmIntegrationPluginServerRuntime.call(void 0, plugin) !== false && _chunkL7ARWZYTcjs.farmPluginMayAffectRuntimePath.call(void 0, plugin, pathname)
1512
1515
  );
1513
1516
  }
1514
1517
  _chunkS3JO3N4Hcjs.__name.call(void 0, farmServerRuntimePluginsMayHandlePath, "farmServerRuntimePluginsMayHandlePath");
@@ -1536,7 +1539,7 @@ async function discoverMiddlewareRoutes(appDir) {
1536
1539
  if (!entry.isDirectory() || entry.name.startsWith(".") || entry.name.startsWith("_")) {
1537
1540
  continue;
1538
1541
  }
1539
- const childRoutePath = _chunkY53ZSFN6cjs.appendMiddlewareRoutePath.call(void 0, routePath, entry.name);
1542
+ const childRoutePath = _chunkWM6HL7E7cjs.appendMiddlewareRoutePath.call(void 0, routePath, entry.name);
1540
1543
  await walk(_path2.default.join(dir, entry.name), childRoutePath, discovered);
1541
1544
  }
1542
1545
  }
@@ -1570,13 +1573,15 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
1570
1573
  assertFarmDocsRuntimeSupported(config, preset);
1571
1574
  const srcDir = config.srcDir || "src";
1572
1575
  const distDir = config.distDir || ".farm";
1573
- const deployOutputDir = _chunkU5BMPGS3cjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
1576
+ const deployOutputDir = _chunkYP5JZ4LFcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
1574
1577
  const lifecyclePluginManager = options.pluginManager;
1575
1578
  const productionViteResultPromise = Promise.allSettled([
1576
1579
  Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkA6WIQH5Zcjs.loadFarmProductionVite.call(void 0, ))))
1577
1580
  ]);
1578
1581
  const nitroBuilderResultPromise = preloadFarmNitroBuilder();
1579
1582
  _chunk5QIKR7RRcjs.logger.info(`\u{1F69C} Building Farm.js application (universal) with preset: ${preset}...`);
1583
+ const rendererBuild = options.rendererBuildLifetime ? void 0 : new AbortController();
1584
+ const rendererBuildLifetime = _nullishCoalesce(options.rendererBuildLifetime, () => ( rendererBuild.signal));
1580
1585
  try {
1581
1586
  const routeRuntimeManifestPromise = options.routeRuntimeManifest ? Promise.resolve(options.routeRuntimeManifest) : createFarmRouteRuntimeManifest({
1582
1587
  config,
@@ -1659,7 +1664,8 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
1659
1664
  layoutRoutes,
1660
1665
  routeSlots,
1661
1666
  isolatedClientBoundaryModules,
1662
- hydrationPlanCache
1667
+ hydrationPlanCache,
1668
+ rendererBuildLifetime
1663
1669
  ), "buildClientBundle");
1664
1670
  const buildSSRBundle = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => buildSSRInMemory(
1665
1671
  productionVite,
@@ -1673,7 +1679,8 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
1673
1679
  layoutRoutes,
1674
1680
  routeSlots,
1675
1681
  isolatedClientBoundaryModules,
1676
- hydrationPlanCache
1682
+ hydrationPlanCache,
1683
+ rendererBuildLifetime
1677
1684
  ), "buildSSRBundle");
1678
1685
  let clientBuildResult;
1679
1686
  let ssrBuildResult;
@@ -1709,7 +1716,8 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
1709
1716
  layoutRoutes,
1710
1717
  routeSlots,
1711
1718
  isolatedClientBoundaryModules,
1712
- hydrationPlanCache
1719
+ hydrationPlanCache,
1720
+ rendererBuildLifetime
1713
1721
  );
1714
1722
  } catch (retryError) {
1715
1723
  if (!(retryError instanceof IncompleteClientBuildOutputError)) throw retryError;
@@ -1764,6 +1772,8 @@ async function buildUniversal(config, routeManager, apiRouteManager, serverRende
1764
1772
  }
1765
1773
  _chunk5QIKR7RRcjs.logger.error(`\u274C Build failed: ${error}`);
1766
1774
  throw error;
1775
+ } finally {
1776
+ _optionalChain([rendererBuild, 'optionalAccess', _27 => _27.abort, 'call', _28 => _28()]);
1767
1777
  }
1768
1778
  }
1769
1779
  _chunkS3JO3N4Hcjs.__name.call(void 0, buildUniversal, "buildUniversal");
@@ -1811,7 +1821,7 @@ async function mergeBuiltFontCss(outputDir, fontCssSource) {
1811
1821
  }
1812
1822
  const normalizedFontCss = typeof fontCss === "string" ? fontCss : Buffer.from(fontCss).toString("utf8");
1813
1823
  await fs.writeFile(fontCssPath, normalizedFontCss);
1814
- await fs.writeFile(clientCssPath, _chunkXDGMADQMcjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
1824
+ await fs.writeFile(clientCssPath, _chunkL7ARWZYTcjs.mergeFarmFontCss.call(void 0, clientCss, normalizedFontCss));
1815
1825
  }
1816
1826
  _chunkS3JO3N4Hcjs.__name.call(void 0, mergeBuiltFontCss, "mergeBuiltFontCss");
1817
1827
  var _IncompleteClientBuildOutputError = class _IncompleteClientBuildOutputError extends Error {
@@ -1861,13 +1871,13 @@ function getCachedClientModuleHydrationPlan(modulePath, root, mode, cache, optio
1861
1871
  const key = `${_path2.default.resolve(root)}\0${mode}\0${options.asyncOwnerIslands === true}\0${_path2.default.resolve(modulePath)}`;
1862
1872
  let plan = cache.get(key);
1863
1873
  if (!plan) {
1864
- plan = _chunkXDGMADQMcjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
1874
+ plan = _chunkL7ARWZYTcjs.getClientModuleHydrationPlan.call(void 0, modulePath, root, mode, options);
1865
1875
  cache.set(key, plan);
1866
1876
  }
1867
1877
  return { ...plan, isolatedBoundaries: [...plan.isolatedBoundaries] };
1868
1878
  }
1869
1879
  _chunkS3JO3N4Hcjs.__name.call(void 0, getCachedClientModuleHydrationPlan, "getCachedClientModuleHydrationPlan");
1870
- async function buildClient(productionVite, config, root, srcDir, outputDir, pageRoutes, layoutRoutes = [], routeSlots = [], isolatedClientBoundaryModules = /* @__PURE__ */ new Set(), hydrationPlanCache = /* @__PURE__ */ new Map()) {
1880
+ async function buildClient(productionVite, config, root, srcDir, outputDir, pageRoutes, layoutRoutes = [], routeSlots = [], isolatedClientBoundaryModules = /* @__PURE__ */ new Set(), hydrationPlanCache = /* @__PURE__ */ new Map(), rendererBuildLifetime) {
1871
1881
  const viteBuild = productionVite.build;
1872
1882
  const { farmPlugin, farmServerOnlyEntriesPlugin } = await import("./vite.cjs");
1873
1883
  const { PluginManager: PluginManager2 } = await import("./plugin.cjs");
@@ -1885,19 +1895,19 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
1885
1895
  const unsupportedIntegrationProvider = integrationProviders.find(
1886
1896
  (provider) => provider.supportsIsolatedHydration !== true
1887
1897
  );
1888
- if (_optionalChain([config, 'access', _27 => _27.experimental, 'optionalAccess', _28 => _28.isolatedClientHydration]) === "enabled" && _optionalChain([config, 'access', _29 => _29.experimental, 'optionalAccess', _30 => _30.serverComponents]) !== true && unsupportedIntegrationProvider) {
1898
+ if (_optionalChain([config, 'access', _29 => _29.experimental, 'optionalAccess', _30 => _30.isolatedClientHydration]) === "enabled" && _optionalChain([config, 'access', _31 => _31.experimental, 'optionalAccess', _32 => _32.serverComponents]) !== true && unsupportedIntegrationProvider) {
1889
1899
  _chunk5QIKR7RRcjs.logger.warn(
1890
1900
  `[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
1891
1901
  );
1892
1902
  }
1893
- const isolatedMode = _chunkXDGMADQMcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
1894
- _optionalChain([config, 'access', _31 => _31.experimental, 'optionalAccess', _32 => _32.isolatedClientHydration]),
1903
+ const isolatedMode = _chunkL7ARWZYTcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
1904
+ _optionalChain([config, 'access', _33 => _33.experimental, 'optionalAccess', _34 => _34.isolatedClientHydration]),
1895
1905
  {
1896
- serverComponents: _optionalChain([config, 'access', _33 => _33.experimental, 'optionalAccess', _34 => _34.serverComponents]) === true,
1906
+ serverComponents: _optionalChain([config, 'access', _35 => _35.experimental, 'optionalAccess', _36 => _36.serverComponents]) === true,
1897
1907
  hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
1898
1908
  }
1899
1909
  );
1900
- const planOptions = _chunkXDGMADQMcjs.getFarmClientHydrationPlanOptions.call(void 0,
1910
+ const planOptions = _chunkL7ARWZYTcjs.getFarmClientHydrationPlanOptions.call(void 0,
1901
1911
  config.renderer,
1902
1912
  Boolean(unsupportedIntegrationProvider)
1903
1913
  );
@@ -1946,15 +1956,15 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
1946
1956
  });
1947
1957
  const layoutAppliesToRoute = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (layoutPattern, routePattern) => layoutPattern === "/" || routePattern === layoutPattern || routePattern.startsWith(`${layoutPattern}/`), "layoutAppliesToRoute");
1948
1958
  const adapterOwnsDocsRuntime = Boolean(
1949
- _chunkTFAXUHWXcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _35 => _35.docs, 'optionalAccess', _36 => _36.enabled]) && _optionalChain([config, 'access', _37 => _37.docs, 'access', _38 => _38.adapter, 'optionalAccess', _39 => _39.server]) && config.docs.adapter.react
1959
+ _chunkTFAXUHWXcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _37 => _37.docs, 'optionalAccess', _38 => _38.enabled]) && _optionalChain([config, 'access', _39 => _39.docs, 'access', _40 => _40.adapter, 'optionalAccess', _41 => _41.server]) && config.docs.adapter.react
1950
1960
  );
1951
- const adapterDocsEntry = _optionalChain([config, 'access', _40 => _40.docs, 'optionalAccess', _41 => _41.enabled]) ? `/${config.docs.entry || "docs"}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/" : null;
1961
+ const adapterDocsEntry = _optionalChain([config, 'access', _42 => _42.docs, 'optionalAccess', _43 => _43.enabled]) ? `/${config.docs.entry || "docs"}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/" : null;
1952
1962
  const isAdapterDocsRoute = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (routePattern) => Boolean(
1953
1963
  adapterOwnsDocsRuntime && adapterDocsEntry && (adapterDocsEntry === "/" || routePattern === adapterDocsEntry || routePattern.startsWith(`${adapterDocsEntry}/`))
1954
1964
  ), "isAdapterDocsRoute");
1955
- const syntheticDocsEntry = _optionalChain([config, 'access', _42 => _42.docs, 'optionalAccess', _43 => _43.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
1965
+ const syntheticDocsEntry = _optionalChain([config, 'access', _44 => _44.docs, 'optionalAccess', _45 => _45.enabled]) && !adapterOwnsDocsRuntime ? adapterDocsEntry : null;
1956
1966
  const syntheticDocsPatterns = syntheticDocsEntry ? syntheticDocsEntry === "/" ? ["/", "/[...slug]"] : [syntheticDocsEntry, `${syntheticDocsEntry}/[...slug]`] : [];
1957
- const markdownPagePlan = _chunkXDGMADQMcjs.createMarkdownPageHydrationPlanner.call(void 0,
1967
+ const markdownPagePlan = _chunkL7ARWZYTcjs.createMarkdownPageHydrationPlanner.call(void 0,
1958
1968
  _chunkOHY2ZWUGcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunkOHY2ZWUGcjs.resolveMdxConfig.call(void 0, config.mdx), root),
1959
1969
  root,
1960
1970
  isolatedMode,
@@ -1970,7 +1980,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
1970
1980
  planOptions
1971
1981
  )
1972
1982
  }));
1973
- _chunkXDGMADQMcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
1983
+ _chunkL7ARWZYTcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
1974
1984
  clientLayouts.map((layout) => ({
1975
1985
  pattern: layout.pattern,
1976
1986
  depth: layout.pattern.split("/").filter(Boolean).length,
@@ -2002,7 +2012,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2002
2012
  for (const layout of clientLayouts) {
2003
2013
  const matchesBuiltRoute = pageRoutes.some((route) => layoutAppliesToRoute(layout.pattern, route.pattern)) || Boolean(adapterDocsEntry && layoutAppliesToRoute(layout.pattern, adapterDocsEntry));
2004
2014
  if (matchesBuiltRoute && layout.suppressedAsyncHydration) {
2005
- _chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F ${_chunkXDGMADQMcjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
2015
+ _chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F ${_chunkL7ARWZYTcjs.describeSuppressedAsyncHydration.call(void 0, layout.pattern, layout.fallbackReason)}`);
2006
2016
  }
2007
2017
  }
2008
2018
  if (isolatedMode === "analyze") {
@@ -2026,7 +2036,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2026
2036
  );
2027
2037
  if (metadata.suppressedAsyncHydration) {
2028
2038
  _chunk5QIKR7RRcjs.logger.warn(
2029
- `\u26A0\uFE0F ${_chunkXDGMADQMcjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
2039
+ `\u26A0\uFE0F ${_chunkL7ARWZYTcjs.describeSuppressedAsyncHydration.call(void 0, route.pattern, metadata.fallbackReason)}`
2030
2040
  );
2031
2041
  }
2032
2042
  if (metadata.shouldHydrate || metadata.hasIsolatedClientBoundaries || applicableClientLayouts.length > 0) {
@@ -2085,7 +2095,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2085
2095
  }
2086
2096
  const clientRouteSlots = routeSlots.filter((slot) => {
2087
2097
  try {
2088
- return _chunkXDGMADQMcjs.getClientModuleMetadata.call(void 0, slot.modulePath, root).shouldHydrate;
2098
+ return _chunkL7ARWZYTcjs.getClientModuleMetadata.call(void 0, slot.modulePath, root).shouldHydrate;
2089
2099
  } catch (error) {
2090
2100
  _chunk5QIKR7RRcjs.logger.warn(`\u26A0\uFE0F Could not inspect route slot ${slot.modulePath}: ${error}`);
2091
2101
  return false;
@@ -2106,8 +2116,8 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2106
2116
  srcDir,
2107
2117
  adapterOwnsDocsRuntime ? false : _chunkMWWVKDW3cjs.isFarmDocsSearchEnabled.call(void 0, config.docs),
2108
2118
  adapterOwnsDocsRuntime ? void 0 : _chunkMWWVKDW3cjs.resolveFarmDocsSearchClientModule.call(void 0, root),
2109
- _optionalChain([config, 'access', _44 => _44.docs, 'optionalAccess', _45 => _45.enabled]) ? config.docs.entry : void 0,
2110
- adapterOwnsDocsRuntime ? _optionalChain([config, 'access', _46 => _46.docs, 'access', _47 => _47.adapter, 'optionalAccess', _48 => _48.react]) : void 0,
2119
+ _optionalChain([config, 'access', _46 => _46.docs, 'optionalAccess', _47 => _47.enabled]) ? config.docs.entry : void 0,
2120
+ adapterOwnsDocsRuntime ? _optionalChain([config, 'access', _48 => _48.docs, 'access', _49 => _49.adapter, 'optionalAccess', _50 => _50.react]) : void 0,
2111
2121
  config.i18n,
2112
2122
  config.plugins,
2113
2123
  config.renderer,
@@ -2115,14 +2125,16 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2115
2125
  config.trailingSlash,
2116
2126
  _chunkZ5HIWVDPcjs.getIntegrationProviders.call(void 0, config.integrations),
2117
2127
  config.basePath,
2118
- _chunkXDGMADQMcjs.generateClientCachePersistenceCode.call(void 0, _chunkXDGMADQMcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache))
2128
+ _chunkL7ARWZYTcjs.generateClientCachePersistenceCode.call(void 0, _chunkL7ARWZYTcjs.resolveFarmClientCacheAdapterEntry.call(void 0, root, config.cache)),
2129
+ adapterOwnsDocsRuntime ? _chunk75WGQVQAcjs.getFarmDocsAdapterConfigModule.call(void 0, config.docs) : void 0
2119
2130
  );
2120
2131
  await fs.writeFile(clientEntryPath, clientHydrationCode);
2121
2132
  const hasScopedPostcssConfig = hasProjectPostcssConfig(root);
2122
2133
  let postcssSearchPath;
2123
2134
  let tailwindVitePlugin = void 0;
2124
2135
  const rendererVitePlugins = await _chunkTFAXUHWXcjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, root, {
2125
- ssr: false
2136
+ ssr: false,
2137
+ buildLifetime: rendererBuildLifetime
2126
2138
  });
2127
2139
  if (hasScopedPostcssConfig) {
2128
2140
  _chunk5QIKR7RRcjs.logger.info("\u{1F4E6} Using project PostCSS/Tailwind configuration");
@@ -2168,7 +2180,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2168
2180
  hashCharacters: "hex",
2169
2181
  // Use predictable name for CSS so we can reference it in SSR HTML
2170
2182
  assetFileNames: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (assetInfo) => {
2171
- if (_optionalChain([assetInfo, 'access', _49 => _49.name, 'optionalAccess', _50 => _50.endsWith, 'call', _51 => _51(".css")])) {
2183
+ if (_optionalChain([assetInfo, 'access', _51 => _51.name, 'optionalAccess', _52 => _52.endsWith, 'call', _53 => _53(".css")])) {
2172
2184
  return "farm-client.css";
2173
2185
  }
2174
2186
  return "assets/[name]-h[hash][extname]";
@@ -2204,7 +2216,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2204
2216
  }
2205
2217
  },
2206
2218
  plugins: [
2207
- _chunkXDGMADQMcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
2219
+ _chunkL7ARWZYTcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
2208
2220
  ...tailwindVitePlugin ? [tailwindVitePlugin] : [],
2209
2221
  ...rendererVitePlugins,
2210
2222
  ...config.vite.plugins || [],
@@ -2265,7 +2277,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2265
2277
  } : void 0,
2266
2278
  // Ensure React is bundled for client
2267
2279
  resolve: {
2268
- alias: _chunkXDGMADQMcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
2280
+ alias: _chunkL7ARWZYTcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
2269
2281
  dedupe: [...config.renderer.dedupe || []]
2270
2282
  },
2271
2283
  // Optimize dependencies - exclude server-side code from client bundle
@@ -2278,7 +2290,7 @@ async function buildClient(productionVite, config, root, srcDir, outputDir, page
2278
2290
  ]
2279
2291
  }
2280
2292
  };
2281
- await viteBuild(_chunkXDGMADQMcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
2293
+ await viteBuild(_chunkL7ARWZYTcjs.mergeFarmProductionViteConfig.call(void 0, clientViteConfig, config.vite));
2282
2294
  await mergeBuiltFontCss(outputDir);
2283
2295
  await validateClientBuildOutput(root, srcDir, outputDir);
2284
2296
  } finally {
@@ -3035,9 +3047,9 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
3035
3047
  secure: false
3036
3048
  },
3037
3049
  direction: {}
3038
- }, plugins = [], renderer = _chunkTFAXUHWXcjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }) {
3050
+ }, plugins = [], renderer = _chunkTFAXUHWXcjs.REACT_RENDERER, publicRuntimeConfig = void 0, trailingSlash = false, integrationProviders = [], basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule) {
3039
3051
  const toImportPath = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (targetPath) => targetPath.replace(/\\/g, "/"), "toImportPath");
3040
- const clientPluginEntry = _chunkXDGMADQMcjs.generateFarmClientPluginEntryCode.call(void 0,
3052
+ const clientPluginEntry = _chunkL7ARWZYTcjs.generateFarmClientPluginEntryCode.call(void 0,
3041
3053
  plugins,
3042
3054
  root,
3043
3055
  srcDir,
@@ -3045,7 +3057,7 @@ function generateClientHydrationEntry(clientPages, layoutRoutes, clientRouteSlot
3045
3057
  );
3046
3058
  const rendererClientImports = _chunkTFAXUHWXcjs.isReactRenderer.call(void 0, renderer) ? `import React from "react";
3047
3059
  import { createRoot, hydrateRoot } from "react-dom/client";` : `import React, { createRoot, hydrateRoot } from ${JSON.stringify(renderer.client)};`;
3048
- const providerClientCode = _chunkXDGMADQMcjs.generateFarmIntegrationProviderClientCode.call(void 0,
3060
+ const providerClientCode = _chunkL7ARWZYTcjs.generateFarmIntegrationProviderClientCode.call(void 0,
3049
3061
  integrationProviders,
3050
3062
  root,
3051
3063
  _nullishCoalesce(renderer.componentExtensions, () => ( []))
@@ -3108,7 +3120,10 @@ function isFarmDocsPath() {
3108
3120
  return false;
3109
3121
  }
3110
3122
  `;
3111
- const docsAdapterRuntime = _chunkXDGMADQMcjs.generateFarmDocsAdapterClientRuntime.call(void 0, docsAdapterReact);
3123
+ const docsAdapterRuntime = _chunk75WGQVQAcjs.generateFarmDocsAdapterClientRuntime.call(void 0,
3124
+ docsAdapterReact,
3125
+ docsConfigModule
3126
+ );
3112
3127
  if (clientPages.length === 0 && clientRouteSlots.length === 0 && !providerClientCode.hasProviders) {
3113
3128
  return `
3114
3129
  // Farm.js Client Runtime (no client components)
@@ -3527,7 +3542,7 @@ function hasHydratableLayout(pathname) {
3527
3542
  });
3528
3543
  }
3529
3544
 
3530
- ${_chunkXDGMADQMcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
3545
+ ${_chunkL7ARWZYTcjs.FARM_LAYOUT_ELEMENT_CLIENT_SOURCE}
3531
3546
  // Wrap a page element with applicable layouts
3532
3547
  function wrapWithLayouts(pageElement, pathname, params) {
3533
3548
  const layouts = getApplicableLayouts(pathname);
@@ -4418,7 +4433,7 @@ void hydrate();
4418
4433
  `.trim();
4419
4434
  }
4420
4435
  _chunkS3JO3N4Hcjs.__name.call(void 0, generateClientHydrationEntry, "generateClientHydrationEntry");
4421
- async function buildSSRInMemory(productionVite, config, root, routeManager, apiRouteManager, serverRenderer, preset, collectedPageRoutes, collectedLayoutRoutes, collectedRouteSlots, isolatedClientBoundaryModules, hydrationPlanCache) {
4436
+ async function buildSSRInMemory(productionVite, config, root, routeManager, apiRouteManager, serverRenderer, preset, collectedPageRoutes, collectedLayoutRoutes, collectedRouteSlots, isolatedClientBoundaryModules, hydrationPlanCache, rendererBuildLifetime) {
4422
4437
  const viteBuild = productionVite.build;
4423
4438
  const { farmPlugin } = await import("./vite.cjs");
4424
4439
  const { PluginManager: PluginManager2 } = await import("./plugin.cjs");
@@ -4433,7 +4448,8 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4433
4448
  let postcssConfigDir;
4434
4449
  let tailwindVitePlugin = void 0;
4435
4450
  const rendererVitePlugins = await _chunkTFAXUHWXcjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, root, {
4436
- ssr: true
4451
+ ssr: true,
4452
+ buildLifetime: rendererBuildLifetime
4437
4453
  });
4438
4454
  if (!hasScopedPostcssConfig) {
4439
4455
  postcssConfigDir = await fs.mkdtemp(_path2.default.join(_os2.default.tmpdir(), "farm-postcss-"));
@@ -4540,7 +4556,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4540
4556
  }
4541
4557
  const middlewareRoutes = await discoverMiddlewareRoutes(appDirs);
4542
4558
  const instrumentationPath = _chunkRTHIVJ2Gcjs.resolveFarmInstrumentationFile.call(void 0, root, config.srcDir || "src");
4543
- const notFoundPath = _chunkXDGMADQMcjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
4559
+ const notFoundPath = _chunkL7ARWZYTcjs.resolveFarmNotFoundComponentPath.call(void 0, config, appDirs);
4544
4560
  if (notFoundPath) _chunk5QIKR7RRcjs.logger.info(`\u{1F4CB} Found custom 404 page: ${notFoundPath}`);
4545
4561
  layoutRoutes.sort((a, b) => {
4546
4562
  const depthA = a.pattern.split("/").filter(Boolean).length;
@@ -4561,9 +4577,9 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4561
4577
  (provider) => provider.component || provider.type === "clerk"
4562
4578
  );
4563
4579
  const hasObservabilityHandler = !!config.observability && typeof config.observability === "object" && "onEvent" in config.observability;
4564
- const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _52 => _52.mdx, 'optionalAccess', _53 => _53.components]));
4580
+ const hasMdxComponentConfig = Boolean(_optionalChain([config, 'access', _54 => _54.mdx, 'optionalAccess', _55 => _55.components]));
4565
4581
  const hasMiddlewareConfig = hasFarmMiddlewareConfig(config.middleware);
4566
- const hasRouteContextConfig = _chunkU5BMPGS3cjs.hasCustomFarmRouteContext.call(void 0, config);
4582
+ const hasRouteContextConfig = _chunkYP5JZ4LFcjs.hasCustomFarmRouteContext.call(void 0, config);
4567
4583
  const hasServerRuntimePlugins = hasFarmServerRuntimePlugins(config);
4568
4584
  const hasPluginRoutes = hasFarmPluginRoutes(config);
4569
4585
  const configModulePath = hasServerRuntimeIntegrations || hasObservabilityHandler || hasMdxComponentConfig || hasMiddlewareConfig || hasRouteContextConfig || hasServerRuntimePlugins || hasPluginRoutes || hasIntegrationProviders ? await findFarmConfigPath(root) : null;
@@ -4572,7 +4588,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4572
4588
  const hasConfiguredRuntimePlugins = Boolean(
4573
4589
  hasRuntimeConfigModule && (config.plugins || []).length > 0
4574
4590
  );
4575
- const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _54 => _54.docs, 'optionalAccess', _55 => _55.enabled]) && _chunkC5GUTBZKcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? _optionalChain([config, 'access', _56 => _56.docs, 'access', _57 => _57.adapter, 'optionalAccess', _58 => _58.server]) ? await _chunkS27FMYAMcjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
4591
+ const farmDocsPrecompiledManifest = _optionalChain([config, 'access', _56 => _56.docs, 'optionalAccess', _57 => _57.enabled]) && _chunkC5GUTBZKcjs.getFarmPresetRuntime.call(void 0, preset) === "edge" ? _optionalChain([config, 'access', _58 => _58.docs, 'access', _59 => _59.adapter, 'optionalAccess', _60 => _60.server]) ? await _chunkZE6ONQ5Rcjs.compileFarmDocsAdapterEdgeManifest.call(void 0, config.docs, {
4576
4592
  root,
4577
4593
  srcDir: config.srcDir,
4578
4594
  clientEntry: FARM_CLIENT_JS_SRC_PLACEHOLDER,
@@ -4669,7 +4685,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4669
4685
  // Adapters can render provider scripts by serializing function source.
4670
4686
  // keepNames injects helper calls into those functions; after Nitro
4671
4687
  // minifies the server chunk the helper is no longer in script scope.
4672
- keepNames: !(_optionalChain([config, 'access', _59 => _59.docs, 'optionalAccess', _60 => _60.enabled]) && _optionalChain([config, 'access', _61 => _61.docs, 'access', _62 => _62.adapter, 'optionalAccess', _63 => _63.server])),
4688
+ keepNames: !(_optionalChain([config, 'access', _61 => _61.docs, 'optionalAccess', _62 => _62.enabled]) && _optionalChain([config, 'access', _63 => _63.docs, 'access', _64 => _64.adapter, 'optionalAccess', _65 => _65.server])),
4673
4689
  jsxDev: false
4674
4690
  },
4675
4691
  // SSR configuration to externalize problematic modules
@@ -4716,10 +4732,10 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4716
4732
  define: {
4717
4733
  __FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
4718
4734
  __FARM_ENV__: JSON.stringify(_chunkVEKFLAQMcjs.createBundledEnv.call(void 0, config.env)),
4719
- __FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _64 => _64.env, 'optionalAccess', _65 => _65.public]) || {})
4735
+ __FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _66 => _66.env, 'optionalAccess', _67 => _67.public]) || {})
4720
4736
  },
4721
4737
  plugins: [
4722
- _chunkXDGMADQMcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
4738
+ _chunkL7ARWZYTcjs.createFarmThemeCssPlugin.call(void 0, config.theme, config.basePath),
4723
4739
  ...tailwindVitePlugin ? [tailwindVitePlugin] : [],
4724
4740
  ...rendererVitePlugins,
4725
4741
  ...config.vite.plugins || [],
@@ -4778,7 +4794,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4778
4794
  resolve: {
4779
4795
  alias: [
4780
4796
  ...shouldAliasReactServerToWebBuild(config.renderer, preset) ? [createFarmReactWebServerAlias(hasReactDomEdgeServerBuild(root))] : [],
4781
- ...Object.entries(_chunkXDGMADQMcjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
4797
+ ...Object.entries(_chunkL7ARWZYTcjs.createFarmSourceAlias.call(void 0, root, config.srcDir)).map(
4782
4798
  ([find, replacement]) => ({ find, replacement })
4783
4799
  )
4784
4800
  ],
@@ -4786,7 +4802,7 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4786
4802
  dedupe: [...config.renderer.dedupe || []]
4787
4803
  }
4788
4804
  };
4789
- await viteBuild(_chunkXDGMADQMcjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
4805
+ await viteBuild(_chunkL7ARWZYTcjs.mergeFarmProductionViteConfig.call(void 0, serverViteConfig, config.vite));
4790
4806
  } finally {
4791
4807
  if (postcssConfigDir) {
4792
4808
  try {
@@ -4803,15 +4819,15 @@ async function buildSSRInMemory(productionVite, config, root, routeManager, apiR
4803
4819
  }
4804
4820
  _chunkS3JO3N4Hcjs.__name.call(void 0, buildSSRInMemory, "buildSSRInMemory");
4805
4821
  function getFarmAppOwnedDocsEnginePaths(agent, applicationMetadataRoutes) {
4806
- const llmsTxt = _optionalChain([agent, 'optionalAccess', _66 => _66.llmsTxt]);
4822
+ const llmsTxt = _optionalChain([agent, 'optionalAccess', _68 => _68.llmsTxt]);
4807
4823
  const ownedByFile = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (kind) => applicationMetadataRoutes.some(
4808
4824
  (metadata) => metadata.kind === kind && metadata.pattern === "/"
4809
4825
  ), "ownedByFile");
4810
4826
  return [
4811
- ..._optionalChain([llmsTxt, 'optionalAccess', _67 => _67.enabled]) || ownedByFile("llms") ? ["/llms.txt"] : [],
4812
- ..._optionalChain([llmsTxt, 'optionalAccess', _68 => _68.enabled]) && llmsTxt.full || ownedByFile("llms-full") ? ["/llms-full.txt"] : [],
4827
+ ..._optionalChain([llmsTxt, 'optionalAccess', _69 => _69.enabled]) || ownedByFile("llms") ? ["/llms.txt"] : [],
4828
+ ..._optionalChain([llmsTxt, 'optionalAccess', _70 => _70.enabled]) && llmsTxt.full || ownedByFile("llms-full") ? ["/llms-full.txt"] : [],
4813
4829
  ...ownedByFile("sitemap") ? ["/sitemap.xml"] : [],
4814
- ..._optionalChain([agent, 'optionalAccess', _69 => _69.crawlers, 'optionalAccess', _70 => _70.enabled]) || ownedByFile("robots") ? ["/robots.txt"] : []
4830
+ ..._optionalChain([agent, 'optionalAccess', _71 => _71.crawlers, 'optionalAccess', _72 => _72.enabled]) || ownedByFile("robots") ? ["/robots.txt"] : []
4815
4831
  ];
4816
4832
  }
4817
4833
  _chunkS3JO3N4Hcjs.__name.call(void 0, getFarmAppOwnedDocsEnginePaths, "getFarmAppOwnedDocsEnginePaths");
@@ -4821,7 +4837,10 @@ function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
4821
4837
  ...docs,
4822
4838
  contentDir: void 0,
4823
4839
  ...precompiled ? { configPath: void 0 } : {},
4824
- config: void 0
4840
+ config: void 0,
4841
+ // React elements and functions do not survive JSON. The server bundle imports the
4842
+ // config module for those instead (see farmDocsConfigModule).
4843
+ runtimeConfig: void 0
4825
4844
  };
4826
4845
  const nestedConfig = {
4827
4846
  ...docs.config,
@@ -4842,7 +4861,7 @@ function generateFarmDocsRuntimeConfigExpression(docs, precompiled = false) {
4842
4861
  contentDir: farmDocsBundledContentDir,
4843
4862
  },
4844
4863
  }
4845
- : ${JSON.stringify(docs)}`;
4864
+ : ${JSON.stringify({ ...docs, runtimeConfig: void 0 })}`;
4846
4865
  }
4847
4866
  _chunkS3JO3N4Hcjs.__name.call(void 0, generateFarmDocsRuntimeConfigExpression, "generateFarmDocsRuntimeConfigExpression");
4848
4867
  function toVirtualEntryImportSpecifier(modulePath) {
@@ -4850,7 +4869,7 @@ function toVirtualEntryImportSpecifier(modulePath) {
4850
4869
  }
4851
4870
  _chunkS3JO3N4Hcjs.__name.call(void 0, toVirtualEntryImportSpecifier, "toVirtualEntryImportSpecifier");
4852
4871
  function generateNativeAuthIntegrationSource(auth) {
4853
- if (_optionalChain([auth, 'optionalAccess', _71 => _71.enabled]) !== true) {
4872
+ if (_optionalChain([auth, 'optionalAccess', _73 => _73.enabled]) !== true) {
4854
4873
  return { importSource: "", registerSource: "" };
4855
4874
  }
4856
4875
  return {
@@ -4865,7 +4884,7 @@ function generateNativeAuthIntegrationSource(auth) {
4865
4884
  }
4866
4885
  _chunkS3JO3N4Hcjs.__name.call(void 0, generateNativeAuthIntegrationSource, "generateNativeAuthIntegrationSource");
4867
4886
  function generateNativeMCPPluginSource(mcp) {
4868
- if (_optionalChain([mcp, 'optionalAccess', _72 => _72.enabled]) !== true) {
4887
+ if (_optionalChain([mcp, 'optionalAccess', _74 => _74.enabled]) !== true) {
4869
4888
  return { importSource: "", registerSource: "", pluginSource: "" };
4870
4889
  }
4871
4890
  return {
@@ -4994,8 +5013,8 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, generateConfiguredResponseHeadersRuntimeSo
4994
5013
  function parseRouteRenderingDirectiveFromDisk(modulePath) {
4995
5014
  try {
4996
5015
  const source = _fs.readFileSync.call(void 0, modulePath, "utf8");
4997
- const directive = _chunkGPVTX3HTcjs.parseRouteRenderingDirective.call(void 0, source);
4998
- if (_chunkGPVTX3HTcjs.findRequestBoundSourceBlockers.call(void 0, source).length === 0) return directive;
5016
+ const directive = _chunkXFFQSD2Fcjs.parseRouteRenderingDirective.call(void 0, source);
5017
+ if (_chunkXFFQSD2Fcjs.findRequestBoundSourceBlockers.call(void 0, source).length === 0) return directive;
4999
5018
  return { ..._nullishCoalesce(directive, () => ( { ssg: false, ppr: false, directive: "" })), requestBound: true };
5000
5019
  } catch (e22) {
5001
5020
  return void 0;
@@ -5107,15 +5126,16 @@ async function applyFarmPreloadBudget(response, pathname, request) {
5107
5126
  _chunkS3JO3N4Hcjs.__name.call(void 0, generatePreloadResponseRuntimeSource, "generatePreloadResponseRuntimeSource");
5108
5127
  function generateVirtualEntryCode(apiRoutes, pageRoutes, layoutRoutes, routeSlots, errorRoutes, metadataImageRoutes, applicationMetadataRoutes, middlewareRoutes, redirectRoutes, configuredRewriteRoutes, configuredHeaderRoutes, openAPIReference, notFoundPath, instrumentationPath, config, farmDocsPrecompiledManifest, configModulePath, hasServerRuntimeIntegrations, hasRuntimeIntegrationConfig, hasConfiguredRuntimePlugins, hasServerRuntimePlugins, preset, i18nCatalogs, isolatedClientBoundaryModules, hydrationPlanCache) {
5109
5128
  const hasCompressionRuntime = config.compress && _chunk2SJ4RQ6Pcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
5110
- const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access', _73 => _73.agent, 'optionalAccess', _74 => _74.crawlers, 'optionalAccess', _75 => _75.enabled])) && !applicationMetadataRoutes.some(
5129
+ const servesAgentRobotsTxt = Boolean(_optionalChain([config, 'access', _75 => _75.agent, 'optionalAccess', _76 => _76.crawlers, 'optionalAccess', _77 => _77.enabled])) && !applicationMetadataRoutes.some(
5111
5130
  (metadata) => metadata.kind === "robots" && metadata.pattern === "/"
5112
5131
  );
5113
5132
  const hasPluginRuntime = hasRuntimeIntegrationConfig || hasServerRuntimePlugins;
5114
5133
  const hasInfraAnalyticsRuntime = config.analytics !== false && _chunk2SJ4RQ6Pcjs.resolveFarmInstrumentationRuntime.call(void 0, preset) === "nodejs";
5115
5134
  const hasPrecompiledDocs = Boolean(farmDocsPrecompiledManifest);
5116
5135
  const adapterOwnsDocsRuntime = Boolean(
5117
- _chunkTFAXUHWXcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _76 => _76.docs, 'optionalAccess', _77 => _77.enabled]) && _optionalChain([config, 'access', _78 => _78.docs, 'access', _79 => _79.adapter, 'optionalAccess', _80 => _80.server]) && config.docs.adapter.react
5136
+ _chunkTFAXUHWXcjs.isReactRenderer.call(void 0, config.renderer) && _optionalChain([config, 'access', _78 => _78.docs, 'optionalAccess', _79 => _79.enabled]) && _optionalChain([config, 'access', _80 => _80.docs, 'access', _81 => _81.adapter, 'optionalAccess', _82 => _82.server]) && config.docs.adapter.react
5118
5137
  );
5138
+ const docsConfigModulePath = adapterOwnsDocsRuntime && !hasPrecompiledDocs && config.docs.configPath && !config.docs.configPath.endsWith(".json") ? config.docs.configPath : void 0;
5119
5139
  const hasIsolatedClientGraphRuntime = _chunkTFAXUHWXcjs.isReactRenderer.call(void 0, config.renderer) && isolatedClientBoundaryModules.size > 0;
5120
5140
  const rendererStreamingCapabilities = _chunkTFAXUHWXcjs.getFarmRendererStreamingCapabilitiesForRuntime.call(void 0,
5121
5141
  config.renderer,
@@ -5138,7 +5158,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5138
5158
  (image) => image.sourceType === "module"
5139
5159
  );
5140
5160
  const hasMiddlewareRuntime = middlewareRoutes.length > 0 || hasFarmMiddlewareConfig(config.middleware);
5141
- const farmDocsFontAssets = _optionalChain([config, 'access', _81 => _81.docs, 'optionalAccess', _82 => _82.enabled]) ? _chunkHREOKQWTcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkHREOKQWTcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
5161
+ const farmDocsFontAssets = _optionalChain([config, 'access', _83 => _83.docs, 'optionalAccess', _84 => _84.enabled]) ? _chunkHREOKQWTcjs.toFarmDocsPublicFontAssets.call(void 0, _chunkHREOKQWTcjs.resolveFarmDocsFontAssets.call(void 0, config.root)) : [];
5142
5162
  const integrationProviders = _chunkZ5HIWVDPcjs.getIntegrationProviders.call(void 0, config.integrations);
5143
5163
  const renderedIntegrationProviders = integrationProviders.filter(
5144
5164
  (provider) => provider.component || provider.type === "clerk"
@@ -5148,16 +5168,16 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5148
5168
  `Integration provider components are not supported by the "${config.renderer.name}" renderer.`
5149
5169
  );
5150
5170
  }
5151
- const providerServerModules = _chunkXDGMADQMcjs.generateFarmIntegrationProviderServerModules.call(void 0,
5171
+ const providerServerModules = _chunkL7ARWZYTcjs.generateFarmIntegrationProviderServerModules.call(void 0,
5152
5172
  renderedIntegrationProviders,
5153
5173
  config.root,
5154
5174
  _nullishCoalesce(config.renderer.componentExtensions, () => ( []))
5155
5175
  );
5156
5176
  const resolvedIntegrationProviderFallback = Object.fromEntries(
5157
5177
  Object.entries(config.integrations).flatMap(([name, integration]) => {
5158
- const configuredProviders = _optionalChain([integration, 'optionalAccess', _83 => _83.providers]);
5178
+ const configuredProviders = _optionalChain([integration, 'optionalAccess', _85 => _85.providers]);
5159
5179
  const providers = Array.isArray(configuredProviders) ? configuredProviders : [];
5160
- if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess', _84 => _84.component]) === "function")) {
5180
+ if (providers.some((provider) => typeof _optionalChain([provider, 'optionalAccess', _86 => _86.component]) === "function")) {
5161
5181
  throw new Error(
5162
5182
  `Integration provider components in production must use an importable component reference, for example component: { module: "@/components/provider" }.`
5163
5183
  );
@@ -5168,14 +5188,14 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5168
5188
  const unsupportedIntegrationProvider = renderedIntegrationProviders.find(
5169
5189
  (provider) => provider.supportsIsolatedHydration !== true
5170
5190
  );
5171
- const isolatedHydrationMode = _chunkXDGMADQMcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
5172
- _optionalChain([config, 'access', _85 => _85.experimental, 'optionalAccess', _86 => _86.isolatedClientHydration]),
5191
+ const isolatedHydrationMode = _chunkL7ARWZYTcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
5192
+ _optionalChain([config, 'access', _87 => _87.experimental, 'optionalAccess', _88 => _88.isolatedClientHydration]),
5173
5193
  {
5174
- serverComponents: _optionalChain([config, 'access', _87 => _87.experimental, 'optionalAccess', _88 => _88.serverComponents]) === true,
5194
+ serverComponents: _optionalChain([config, 'access', _89 => _89.experimental, 'optionalAccess', _90 => _90.serverComponents]) === true,
5175
5195
  hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
5176
5196
  }
5177
5197
  );
5178
- const hydrationPlanOptions = _chunkXDGMADQMcjs.getFarmClientHydrationPlanOptions.call(void 0,
5198
+ const hydrationPlanOptions = _chunkL7ARWZYTcjs.getFarmClientHydrationPlanOptions.call(void 0,
5179
5199
  config.renderer,
5180
5200
  Boolean(unsupportedIntegrationProvider)
5181
5201
  );
@@ -5190,7 +5210,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5190
5210
  hydrationPlanOptions
5191
5211
  )
5192
5212
  }));
5193
- const markdownPagePlan = _chunkXDGMADQMcjs.createMarkdownPageHydrationPlanner.call(void 0,
5213
+ const markdownPagePlan = _chunkL7ARWZYTcjs.createMarkdownPageHydrationPlanner.call(void 0,
5194
5214
  _chunkOHY2ZWUGcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunkOHY2ZWUGcjs.resolveMdxConfig.call(void 0, config.mdx), config.root),
5195
5215
  config.root,
5196
5216
  isolatedHydrationMode,
@@ -5208,7 +5228,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5208
5228
  )
5209
5229
  ])
5210
5230
  );
5211
- _chunkXDGMADQMcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
5231
+ _chunkL7ARWZYTcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
5212
5232
  layoutHydrationPlans.map((layout) => ({
5213
5233
  pattern: layout.pattern,
5214
5234
  depth: layout.pattern.split("/").filter(Boolean).length,
@@ -5236,7 +5256,7 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5236
5256
  apiRegistrations.push(`
5237
5257
  {
5238
5258
  path: ${JSON.stringify(route.path)},
5239
- methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access', _89 => _89.pluginMethods, 'optionalAccess', _90 => _90.includes, 'call', _91 => _91(method)])))},
5259
+ methods: ${JSON.stringify(route.methods.filter((method) => !_optionalChain([route, 'access', _91 => _91.pluginMethods, 'optionalAccess', _92 => _92.includes, 'call', _93 => _93(method)])))},
5240
5260
  endpoints: ${varName},
5241
5261
  }`);
5242
5262
  });
@@ -5467,24 +5487,25 @@ function isolateFarmRouteServerPage(element) { return element; }`;
5467
5487
  const infraAnalyticsImport = hasInfraAnalyticsRuntime ? `import { ${hasPluginRuntime ? "createFarmInfraAnalyticsPlugin" : "createFarmInfraAnalyticsRecorder"} } from "@farm.js/core/internal/infra-analytics-runtime";` : "";
5468
5488
  const compressionRuntimeImport = hasCompressionRuntime ? `import { compressFarmResponse${hasPluginRuntime ? ", createCompressionPlugin" : ""} } from "@farm.js/core/internal/compression-runtime";` : "";
5469
5489
  const i18nServerImport = config.i18n.enabled ? `import { _runWithFarmI18nRequest, _setDefaultFarmI18nRuntime, createFarmI18nRuntime, getFarmI18nClientSnapshot } from "@farm.js/core/i18n/server";` : "";
5470
- const docsHandlerImport = _optionalChain([config, 'access', _92 => _92.docs, 'optionalAccess', _93 => _93.enabled]) ? hasPrecompiledDocs ? `import { createFarmDocsPrecompiledRuntime } from "@farm.js/core/internal/docs-precompiled-runtime";
5490
+ const docsHandlerImport = _optionalChain([config, 'access', _94 => _94.docs, 'optionalAccess', _95 => _95.enabled]) ? hasPrecompiledDocs ? `import { createFarmDocsPrecompiledRuntime } from "@farm.js/core/internal/docs-precompiled-runtime";
5471
5491
  const isFarmDocsAPIRequest = (requestOrPathname) => {
5472
5492
  const pathname = typeof requestOrPathname === "string"
5473
5493
  ? requestOrPathname
5474
5494
  : new URL(requestOrPathname.url).pathname;
5475
- const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _94 => _94.apiPath]) || "/api/docs")};
5495
+ const apiPath = ${JSON.stringify(_optionalChain([farmDocsPrecompiledManifest, 'optionalAccess', _96 => _96.apiPath]) || "/api/docs")};
5476
5496
  return pathname === apiPath || pathname.startsWith(apiPath + "/");
5477
5497
  };` : adapterOwnsDocsRuntime ? `import { isFarmDocsAPIRequest } from "@farm.js/core/docs";
5478
5498
  import { createFarmDocsRuntimeHandler as createFarmDocsAdapterRuntimeHandler } from ${JSON.stringify(config.docs.adapter.server)};
5479
- import * as FarmDocsAdapterReact from ${JSON.stringify(config.docs.adapter.react)};` : `import { createFarmDocsAPIHandler, createFarmDocsHandler, isFarmDocsAPIRequest } from "@farm.js/core/docs";` : "";
5480
- const docsFontImport = _optionalChain([config, 'access', _95 => _95.docs, 'optionalAccess', _96 => _96.enabled]) && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
5481
- const docsRuntimeImport = _optionalChain([config, 'access', _97 => _97.docs, 'optionalAccess', _98 => _98.enabled]) && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
5499
+ import * as FarmDocsAdapterReact from ${JSON.stringify(config.docs.adapter.react)};${docsConfigModulePath ? `
5500
+ import * as farmDocsConfigModule from ${toVirtualEntryImportSpecifier(docsConfigModulePath)};` : ""}` : `import { createFarmDocsAPIHandler, createFarmDocsHandler, isFarmDocsAPIRequest } from "@farm.js/core/docs";` : "";
5501
+ const docsFontImport = _optionalChain([config, 'access', _97 => _97.docs, 'optionalAccess', _98 => _98.enabled]) && !hasPrecompiledDocs ? `import { resolveFarmLayoutFonts } from "@farm.js/core/font";` : "";
5502
+ const docsRuntimeImport = _optionalChain([config, 'access', _99 => _99.docs, 'optionalAccess', _100 => _100.enabled]) && !hasPrecompiledDocs ? `import { existsSync as farmDocsExistsSync } from "node:fs";
5482
5503
  import { dirname as farmDocsDirname, join as farmDocsJoin } from "node:path";
5483
5504
  import { fileURLToPath as farmDocsFileURLToPath } from "node:url";` : "";
5484
- const markdownHandlerImport = _optionalChain([config, 'access', _99 => _99.md, 'optionalAccess', _100 => _100.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
5505
+ const markdownHandlerImport = _optionalChain([config, 'access', _101 => _101.md, 'optionalAccess', _102 => _102.enabled]) ? `import { applyMarkdownNegotiationHeaders, createMarkdownMirrorResponse, getFarmMarkdownAlternatePath } from "@farm.js/core/markdown";` : "";
5485
5506
  const appMarkdownImport = hasMarkdownPages ? `import { createFarmMarkdownRouteModule, createFarmMarkdownSourceResponse } from "@farm.js/core/internal/app-markdown-runtime";` : "const createFarmMarkdownSourceResponse = null;";
5486
5507
  const markdownErrorImport = `import { FARM_MARKDOWN_CONTENT_TYPE, createFarmMarkdownErrorBody, farmRequestWantsMarkdown } from "@farm.js/core/markdown";`;
5487
- const mdxComponentsPath = typeof _optionalChain([config, 'access', _101 => _101.mdx, 'optionalAccess', _102 => _102.components]) === "string" ? _path2.default.isAbsolute(config.mdx.components) ? config.mdx.components : _path2.default.join(config.root, config.mdx.components) : null;
5508
+ const mdxComponentsPath = typeof _optionalChain([config, 'access', _103 => _103.mdx, 'optionalAccess', _104 => _104.components]) === "string" ? _path2.default.isAbsolute(config.mdx.components) ? config.mdx.components : _path2.default.join(config.root, config.mdx.components) : null;
5488
5509
  const mdxComponentsImport = mdxComponentsPath ? `import * as FarmMdxComponentsModule from ${toVirtualEntryImportSpecifier(mdxComponentsPath)};` : "";
5489
5510
  const layerConfigPaths = (config.layers || []).map((layer) => layer.configFile).filter((configFile) => Boolean(configFile)).filter((configFile) => configFile !== configModulePath);
5490
5511
  const layerConfigImports = layerConfigPaths.map(
@@ -5688,7 +5709,7 @@ const farmResolvedRuntimeConfig = Object.assign({}, ...farmRuntimeConfigs);
5688
5709
 
5689
5710
  function FarmDefault404Page() {
5690
5711
  return React.createElement(React.Fragment, null,
5691
- React.createElement("style", null, ${JSON.stringify(_chunkXDGMADQMcjs.DEFAULT_NOT_FOUND_STYLES)}),
5712
+ React.createElement("style", null, ${JSON.stringify(_chunkL7ARWZYTcjs.DEFAULT_NOT_FOUND_STYLES)}),
5692
5713
  React.createElement("main", {
5693
5714
  className: "farm-default-not-found",
5694
5715
  "aria-labelledby": "farm-default-not-found-title",
@@ -5816,14 +5837,14 @@ const farmImageHandler = ${imageRuntime === "none" ? "null" : imageRuntime === "
5816
5837
  onError(error) { console.error("[Farm Image]", error); },
5817
5838
  })`};
5818
5839
  const farmMarkdownConfig = ${JSON.stringify(config.md)};
5819
- const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _103 => _103.agent, 'optionalAccess', _104 => _104.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
5840
+ const farmLlmsTxtConfig = ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _105 => _105.agent, 'optionalAccess', _106 => _106.llmsTxt]), () => ( { enabled: false, include: [], exclude: [] })))};
5820
5841
  ${servesAgentRobotsTxt ? `const farmAgentCrawlers = ${JSON.stringify(config.agent.crawlers)};` : ""}
5821
5842
  const farmMdxConfig = ${JSON.stringify({
5822
5843
  ...config.mdx,
5823
- components: typeof _optionalChain([config, 'access', _105 => _105.mdx, 'optionalAccess', _106 => _106.components]) === "string" ? config.mdx.components : void 0
5844
+ components: typeof _optionalChain([config, 'access', _107 => _107.mdx, 'optionalAccess', _108 => _108.components]) === "string" ? config.mdx.components : void 0
5824
5845
  })};
5825
5846
  const configuredFarmMdxComponents = farmUserConfig?.mdx?.components;
5826
- ${_optionalChain([config, 'access', _107 => _107.agent, 'optionalAccess', _108 => _108.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
5847
+ ${_optionalChain([config, 'access', _109 => _109.agent, 'optionalAccess', _110 => _110.noindexPreviews]) ? `// agent.noindexPreviews: the runtime environment decides, falling back to the
5827
5848
  // environment this was built in, since Netlify exposes its deploy context only
5828
5849
  // to the build.
5829
5850
  const farmNoindexPreview = resolveFarmPreviewDeployment(
@@ -5871,7 +5892,7 @@ export const farmProductionLifecycle = createFarmProductionLifecycle({
5871
5892
  });
5872
5893
  const farmI18nRuntime = ${config.i18n.enabled ? `createFarmI18nRuntime(farmI18nConfig, ${JSON.stringify(i18nCatalogs)})` : "null"};
5873
5894
  ${config.i18n.enabled ? "_setDefaultFarmI18nRuntime(farmI18nRuntime);" : ""}
5874
- const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _109 => _109.docs, 'optionalAccess', _110 => _110.enabled]) && !hasPrecompiledDocs ? `(() => {
5895
+ const farmDocsBundledContentDir = ${_optionalChain([config, 'access', _111 => _111.docs, 'optionalAccess', _112 => _112.enabled]) && !hasPrecompiledDocs ? `(() => {
5875
5896
  try {
5876
5897
  const currentDir = farmDocsDirname(farmDocsFileURLToPath(import.meta.url));
5877
5898
  const candidates = [
@@ -5892,8 +5913,8 @@ globalThis.__FARM_DOCS_RUNTIME_CONFIG__ = {
5892
5913
  docs: farmDocsResolvedConfig,
5893
5914
  };
5894
5915
  const farmDocsPrecompiledRuntime = ${hasPrecompiledDocs ? `createFarmDocsPrecompiledRuntime(${JSON.stringify(farmDocsPrecompiledManifest)})` : "null"};
5895
- const farmDocsHandler = ${_optionalChain([config, 'access', _111 => _111.docs, 'optionalAccess', _112 => _112.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `createFarmDocsAdapterRuntimeHandler({
5896
- ...farmDocsResolvedConfig.config,
5916
+ const farmDocsHandler = ${_optionalChain([config, 'access', _113 => _113.docs, 'optionalAccess', _114 => _114.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleDocsRequest" : adapterOwnsDocsRuntime ? `createFarmDocsAdapterRuntimeHandler({
5917
+ ${docsConfigModulePath ? "...(farmDocsConfigModule.default || farmDocsConfigModule),\n ...farmDocsResolvedConfig.configOverrides," : "...farmDocsResolvedConfig.config,"}
5897
5918
  entry: farmDocsResolvedConfig.config?.entry || String(farmDocsResolvedConfig.entry || "/docs").replace(/^\\/+|\\/+$/g, "") || "docs",
5898
5919
  docsPath: farmDocsResolvedConfig.entry,
5899
5920
  contentDir: farmDocsResolvedConfig.contentDir || farmDocsResolvedConfig.config?.contentDir,
@@ -5920,7 +5941,7 @@ const farmDocsHandler = ${_optionalChain([config, 'access', _111 => _111.docs, '
5920
5941
  fontStylesheetHref: "/farm-fonts.css",
5921
5942
  globalStylesheetHref: "/assets/globals.css",
5922
5943
  })` : "null"};
5923
- const farmDocsAPIHandler = ${_optionalChain([config, 'access', _113 => _113.docs, 'optionalAccess', _114 => _114.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig })` : "null"};
5944
+ const farmDocsAPIHandler = ${_optionalChain([config, 'access', _115 => _115.docs, 'optionalAccess', _116 => _116.enabled]) ? hasPrecompiledDocs ? "farmDocsPrecompiledRuntime.handleAPIRequest" : adapterOwnsDocsRuntime ? "null" : `createFarmDocsAPIHandler({ rootDir: farmDocsRuntimeRoot, srcDir: ${JSON.stringify(config.srcDir)}, docs: farmDocsResolvedConfig })` : "null"};
5924
5945
 
5925
5946
  // API routes bundled at build time
5926
5947
  const apiRoutes = ${apiRoutes.length > 0 ? "mergePluginAPIRoutes(" : ""}[${apiRegistrations.join(",")}
@@ -6313,13 +6334,32 @@ function createFarmDocumentStream(contentStream, prefix, suffix, onComplete) {
6313
6334
  }
6314
6335
 
6315
6336
  function stripFarmDocumentWrappers(markup) {
6316
- let output = markup.replace(/^\\s+/, "");
6337
+ return peelFarmDocumentPrefix(markup).inner;
6338
+ }
6339
+
6340
+ // Farm's display:contents wrappers, and the head elements React 19 hoists in front of them
6341
+ // (charset, viewport, preloads, titles) when the layout's <html> is not the render root.
6342
+ function peelFarmDocumentPrefix(markup) {
6343
+ let inner = markup.replace(/^\\s+/, "");
6344
+ let hoisted = "";
6317
6345
  const wrapper = /^<div\\b[^>]*style=["']display\\s*:\\s*contents["'][^>]*>/i;
6346
+ const hoistable = /^(?:<(?:meta|link|base)\\b[^>]*>|<title\\b[^>]*>[\\s\\S]*?<\\/title>)/i;
6318
6347
  let match;
6319
- while ((match = wrapper.exec(output))) {
6320
- output = output.slice(match[0].length).replace(/^\\s+/, "");
6348
+ while ((match = wrapper.exec(inner) || hoistable.exec(inner))) {
6349
+ if (!/^<div/i.test(match[0])) hoisted += match[0];
6350
+ inner = inner.slice(match[0].length).replace(/^\\s+/, "");
6321
6351
  }
6322
- return output;
6352
+ return { inner: inner, hoisted: hoisted };
6353
+ }
6354
+
6355
+ function restoreFarmHoistedHead(document, hoisted) {
6356
+ if (!hoisted) return document;
6357
+ if (/<head[\\s>]/i.test(document)) {
6358
+ return document.replace(/<head\\b[^>]*>/i, function(open) { return open + hoisted; });
6359
+ }
6360
+ return document.replace(/<html\\b[^>]*>/i, function(open) {
6361
+ return open + "<head>" + hoisted + "</head>";
6362
+ });
6323
6363
  }
6324
6364
 
6325
6365
  function opensFarmFullDocument(markup) {
@@ -6329,6 +6369,7 @@ function opensFarmFullDocument(markup) {
6329
6369
 
6330
6370
  function extractFarmFullDocument(markup) {
6331
6371
  if (!opensFarmFullDocument(markup)) return null;
6372
+ const hoisted = peelFarmDocumentPrefix(markup).hoisted;
6332
6373
  const start = markup.search(/<!doctype|<html[\\s>]/i);
6333
6374
  const lower = markup.toLowerCase();
6334
6375
  let closeIndex = lower.lastIndexOf("</html>");
@@ -6356,7 +6397,7 @@ function extractFarmFullDocument(markup) {
6356
6397
  return streamedTail + "</body>";
6357
6398
  });
6358
6399
  }
6359
- return document;
6400
+ return restoreFarmHoistedHead(document, hoisted);
6360
6401
  }
6361
6402
 
6362
6403
  function ensureFarmDocumentHead(markup) {
@@ -7011,7 +7052,7 @@ function hasLocalRequestRoute(request, routePathname) {
7011
7052
  if (${imageRuntime === "none" ? "false" : `pathname === ${JSON.stringify(config.images.path)}`}) {
7012
7053
  return true;
7013
7054
  }
7014
- ${_optionalChain([config, 'access', _115 => _115.docs, 'optionalAccess', _116 => _116.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
7055
+ ${_optionalChain([config, 'access', _117 => _117.docs, 'optionalAccess', _118 => _118.enabled]) ? `const docsPath = normalizeRuntimePath(farmDocsResolvedConfig?.entry || "/docs");
7015
7056
  if (
7016
7057
  isFarmDocsAPIRequest(pathname) ||
7017
7058
  docsPath === "/" ||
@@ -7037,7 +7078,7 @@ function getFarmPluginRequestOptions(request) {
7037
7078
  route: { ...route, pattern: normalizeRuntimePath(farmOpenAPIReference.route) },
7038
7079
  };
7039
7080
  }
7040
- const isDocsAPIRequest = ${_optionalChain([config, 'access', _117 => _117.docs, 'optionalAccess', _118 => _118.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
7081
+ const isDocsAPIRequest = ${_optionalChain([config, 'access', _119 => _119.docs, 'optionalAccess', _120 => _120.enabled]) ? "isFarmDocsAPIRequest(pathname)" : "false"};
7041
7082
  const integrationMatch = ${hasServerRuntimeIntegrations ? `matchIntegrationRoute(serverRuntimeIntegrations, {
7042
7083
  pathname,
7043
7084
  method: request.method,
@@ -7127,7 +7168,7 @@ function getApplicableLayouts(pathname) {
7127
7168
  return applicable;
7128
7169
  }
7129
7170
 
7130
- ${_optionalChain([config, 'access', _119 => _119.docs, 'optionalAccess', _120 => _120.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
7171
+ ${_optionalChain([config, 'access', _121 => _121.docs, 'optionalAccess', _122 => _122.enabled]) ? `async function wrapFarmDocsResponseWithLayouts(request, response) {
7131
7172
  if (request.method === "HEAD") return response;
7132
7173
  if (response.headers.get("x-farm-docs-adapter")) return response;
7133
7174
 
@@ -7234,7 +7275,7 @@ ${_optionalChain([config, 'access', _119 => _119.docs, 'optionalAccess', _120 =>
7234
7275
  }` : ""}
7235
7276
 
7236
7277
  const pprShellCache = getFarmDataCache();
7237
- const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _121 => _121.experimental, 'optionalAccess', _122 => _122.ppr]) === true)};
7278
+ const experimentalPPREnabled = ${JSON.stringify(_optionalChain([config, 'access', _123 => _123.experimental, 'optionalAccess', _124 => _124.ppr]) === true)};
7238
7279
 
7239
7280
  function resolveRouteRenderingView(route) {
7240
7281
  // The same merge development uses: baked directive config under the
@@ -7357,7 +7398,7 @@ async function handleFarmRequest(request, adapterContext) {
7357
7398
  },
7358
7399
  { redirect: !isFarmLocalAPIPathname(requestUrl.pathname) }
7359
7400
  )` : "handleFarmRequestInContext(request, null, false, Date.now(), adapterContext, requestUrl)"};
7360
- ${_optionalChain([config, 'access', _123 => _123.md, 'optionalAccess', _124 => _124.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
7401
+ ${_optionalChain([config, 'access', _125 => _125.md, 'optionalAccess', _126 => _126.enabled]) ? `const pathname = getFarmRoutePathname(requestUrl.pathname);
7361
7402
  if (matchPageRoute(pathname)) {
7362
7403
  // The Link header advertises the public .md URL, like the head alternate.
7363
7404
  return applyMarkdownNegotiationHeaders(response, {
@@ -7476,7 +7517,7 @@ async function handleFarmRequestInContext(
7476
7517
  const middlewareHeaders = ${hasServerRuntimeIntegrations ? "withFarmIntegrationSetCookies(undefined, farmIntegrationSetCookies)" : "undefined"};
7477
7518
  `}
7478
7519
 
7479
- ${_optionalChain([config, 'access', _125 => _125.docs, 'optionalAccess', _126 => _126.enabled]) ? `
7520
+ ${_optionalChain([config, 'access', _127 => _127.docs, 'optionalAccess', _128 => _128.enabled]) ? `
7480
7521
  // Docs responses are served after app middleware so route guards and
7481
7522
  // middleware headers apply to the docs engine like any other page content.
7482
7523
  // An app's own llms.txt, llms-full.txt, sitemap.xml, and robots.txt take
@@ -7521,7 +7562,7 @@ async function handleFarmRequestInContext(
7521
7562
  }
7522
7563
  ` : ""}
7523
7564
 
7524
- ${_optionalChain([config, 'access', _127 => _127.md, 'optionalAccess', _128 => _128.enabled]) ? `
7565
+ ${_optionalChain([config, 'access', _129 => _129.md, 'optionalAccess', _130 => _130.enabled]) ? `
7525
7566
  if (farmMarkdownConfig?.enabled) {
7526
7567
  const markdownResponse = await createMarkdownMirrorResponse({
7527
7568
  // The mirror helper only reads metadata and creates its own GET request.
@@ -7624,11 +7665,11 @@ async function handleFarmRequestInContext(
7624
7665
  );
7625
7666
  }
7626
7667
  ` : ""}
7627
- ${_optionalChain([config, 'access', _129 => _129.agent, 'optionalAccess', _130 => _130.llmsTxt, 'optionalAccess', _131 => _131.enabled]) ? `
7668
+ ${_optionalChain([config, 'access', _131 => _131.agent, 'optionalAccess', _132 => _132.llmsTxt, 'optionalAccess', _133 => _133.enabled]) ? `
7628
7669
  // agent.llmsTxt with no llms.ts or llms-full.ts: serve the generated files.
7629
7670
  const farmGeneratedLlmsKind = normalizeRuntimePath(routePathname) === "/llms.txt"
7630
7671
  ? "llms"
7631
- : ${_optionalChain([config, 'access', _132 => _132.agent, 'optionalAccess', _133 => _133.llmsTxt, 'optionalAccess', _134 => _134.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
7672
+ : ${_optionalChain([config, 'access', _134 => _134.agent, 'optionalAccess', _135 => _135.llmsTxt, 'optionalAccess', _136 => _136.full]) ? `normalizeRuntimePath(routePathname) === "/llms-full.txt" ? "llms-full" : ` : ""}null;
7632
7673
  if (farmGeneratedLlmsKind) {
7633
7674
  const llmsContext = createFarmLlmsTxtContext(request, farmGeneratedLlmsKind === "llms-full");
7634
7675
  const llmsBody = farmGeneratedLlmsKind === "llms-full"
@@ -7649,7 +7690,7 @@ async function handleFarmRequestInContext(
7649
7690
  }
7650
7691
  ` : ""}
7651
7692
 
7652
- ${_optionalChain([config, 'access', _135 => _135.docs, 'optionalAccess', _136 => _136.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
7693
+ ${_optionalChain([config, 'access', _137 => _137.docs, 'optionalAccess', _138 => _138.enabled]) ? `if (farmDocsAPIHandler && isFarmDocsAPIRequest(pathname)) {
7653
7694
  const docsAPIResponse = await farmDocsAPIHandler(cloneFarmRequestWithContext(request));
7654
7695
  if (docsAPIResponse) {
7655
7696
  return applyProductionMiddlewareHeaders(docsAPIResponse, middlewareHeaders);
@@ -8084,7 +8125,7 @@ async function handleFarmRequestInContext(
8084
8125
  );
8085
8126
  }
8086
8127
  }
8087
- ${_optionalChain([config, 'access', _137 => _137.md, 'optionalAccess', _138 => _138.enabled]) ? `
8128
+ ${_optionalChain([config, 'access', _139 => _139.md, 'optionalAccess', _140 => _140.enabled]) ? `
8088
8129
  // Advertise the Markdown mirror in the head as well as the Link header,
8089
8130
  // using the public path the .md request will be resolved against.
8090
8131
  mergedMetadata = addMetadataMarkdownAlternate(
@@ -8092,7 +8133,7 @@ async function handleFarmRequestInContext(
8092
8133
  getFarmMarkdownAlternatePath(farmMarkdownConfig, pathname),
8093
8134
  );` : ""}
8094
8135
 
8095
- const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _139 => _139.agent, 'optionalAccess', _140 => _140.jsonLd]), () => ( false)))} });
8136
+ const renderedMetadata = renderMetadataHead(mergedMetadata, { pathname, jsonLd: ${JSON.stringify(_nullishCoalesce(_optionalChain([config, 'access', _141 => _141.agent, 'optionalAccess', _142 => _142.jsonLd]), () => ( false)))} });
8096
8137
  const title = renderedMetadata.title;
8097
8138
  const metaTags = renderedMetadata.tags;
8098
8139
  const hasFavicon = renderedMetadata.hasFavicon;
@@ -8707,11 +8748,11 @@ ${generatePreloadResponseRuntimeSource()}
8707
8748
 
8708
8749
  // Export as Web Standard fetch API
8709
8750
  export async function fetch(request, context) {
8710
- ${_optionalChain([config, 'access', _141 => _141.agent, 'optionalAccess', _142 => _142.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
8751
+ ${_optionalChain([config, 'access', _143 => _143.agent, 'optionalAccess', _144 => _144.noindexPreviews]) ? "const response = await" : "return"} _runWithAPIRequestRuntime({
8711
8752
  basePath: farmLocalAPIBasePath,
8712
8753
  dispatch: async (localRequest) =>
8713
8754
  (await handleAPIRequest(localRequest)) ?? Response.json({ error: "Not Found" }, { status: 404 }),
8714
- }, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _143 => _143.agent, 'optionalAccess', _144 => _144.noindexPreviews]) ? `
8755
+ }, () => handleFarmFetch(request, context));${_optionalChain([config, 'access', _145 => _145.agent, 'optionalAccess', _146 => _146.noindexPreviews]) ? `
8715
8756
  // Keep every response of a preview deployment out of search indexes.
8716
8757
  return farmNoindexPreview ? applyFarmPreviewRobotsTag(response) : response;` : ""}
8717
8758
  }
@@ -8854,7 +8895,7 @@ function configMiddlewareMayHandlePath(config, pathname) {
8854
8895
  if (!hasFarmMiddlewareConfig(config)) return false;
8855
8896
  const entries = Array.isArray(config) ? config : [config];
8856
8897
  return entries.some((entry) => {
8857
- if (_optionalChain([entry, 'access', _145 => _145.exclude, 'optionalAccess', _146 => _146.some, 'call', _147 => _147((pattern) => middlewarePatternMatches(pattern, pathname))])) {
8898
+ if (_optionalChain([entry, 'access', _147 => _147.exclude, 'optionalAccess', _148 => _148.some, 'call', _149 => _149((pattern) => middlewarePatternMatches(pattern, pathname))])) {
8858
8899
  return false;
8859
8900
  }
8860
8901
  if (!entry.matcher) return true;
@@ -8910,11 +8951,11 @@ function getPhysicalPrerenderBypassReason(options) {
8910
8951
  }
8911
8952
  if (appMiddlewareMayHandlePath(middlewareRoutes, pathname)) return "app middleware";
8912
8953
  if (configMiddlewareMayHandlePath(config.middleware, pathname)) return "configured middleware";
8913
- if (_chunkU5BMPGS3cjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
8954
+ if (_chunkYP5JZ4LFcjs.hasCustomFarmRouteContext.call(void 0, config)) return "request context";
8914
8955
  if (farmServerRuntimePluginsMayHandlePath(config, pathname)) return "server runtime plugin";
8915
8956
  const manifestEntry = getManifestPageEntry(routeRuntimeManifest, pathname);
8916
- if (_optionalChain([manifestEntry, 'optionalAccess', _148 => _148.rendering]) === "dynamic") return "dynamic runtime manifest";
8917
- if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _149 => _149.regions, 'optionalAccess', _150 => _150.length])) || manifestEntry.maxDuration !== void 0)) {
8957
+ if (_optionalChain([manifestEntry, 'optionalAccess', _150 => _150.rendering]) === "dynamic") return "dynamic runtime manifest";
8958
+ if (manifestEntry && (manifestEntry.runtime !== "auto" || Boolean(_optionalChain([manifestEntry, 'access', _151 => _151.regions, 'optionalAccess', _152 => _152.length])) || manifestEntry.maxDuration !== void 0)) {
8918
8959
  return "route runtime controls";
8919
8960
  }
8920
8961
  const routeRule = getEffectiveRouteRule(config, pathname);
@@ -8936,7 +8977,7 @@ async function buildNitroUniversal(config, routeManager, apiRouteManager, server
8936
8977
  const nitroBuilder = nitroBuilderResult.value;
8937
8978
  const isVercel = preset === "vercel" || preset === "vercel-edge";
8938
8979
  const isCloudflareWorker = preset === "cloudflare-module";
8939
- const outputDir = _chunkU5BMPGS3cjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
8980
+ const outputDir = _chunkYP5JZ4LFcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
8940
8981
  const runtimeServerOutputDir = isVercel ? _path2.default.join(outputDir, "functions", "__nitro.func") : _path2.default.join(outputDir, "server");
8941
8982
  const ssrOutputDir = _path2.default.join(root, distDir, "ssr");
8942
8983
  const imageRuntime = resolveImageRuntime(config, preset);
@@ -9167,7 +9208,7 @@ export default async function farmNitroEventHandler(event) {
9167
9208
  ssrOutputDir,
9168
9209
  ssrEntryFile
9169
9210
  );
9170
- const configuredNitroRouteRules = _chunkGDSHDTJ4cjs.routeRulesToNitroRouteRules.call(void 0, config.routeRules);
9211
+ const configuredNitroRouteRules = _chunkQ5B3KJBPcjs.routeRulesToNitroRouteRules.call(void 0, config.routeRules);
9171
9212
  const prerenderNitroRouteRules = Object.fromEntries(
9172
9213
  prerenderRoutes.map((route) => {
9173
9214
  const configuredRule = configuredNitroRouteRules[route] || {};
@@ -9267,9 +9308,9 @@ export default async function farmNitroEventHandler(event) {
9267
9308
  snapshotSSRRebundleOptions(nitroConfig)
9268
9309
  );
9269
9310
  const requestedBuilder = _nullishCoalesce(nitroConfig.builder, () => ( process.env.NITRO_BUILDER));
9270
- const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _151 => _151.rollupConfig, 'optionalAccess', _152 => _152.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _153 => _153.rollupConfig, 'optionalAccess', _154 => _154.plugins])) && customRollupKeys.length === 0 && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _155 => _155.output, 'optionalAccess', _156 => _156.serverDir]) || "") === _path2.default.resolve(expectedServerDir) && Boolean(
9271
- _optionalChain([nitroConfig, 'access', _157 => _157.handlers, 'optionalAccess', _158 => _158.some, 'call', _159 => _159(
9272
- (handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _160 => _160.handler]) || "") === nitroEntryPath
9311
+ const canReusePrebuiltSSR = isPrebuiltSSRCandidate && nitroConfig.preset === "node-server" && (requestedBuilder === void 0 || requestedBuilder === "rollup" || requestedBuilder === "rolldown") && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig && !hasUnsupportedSSRRebundleOverrides && _optionalChain([nitroConfig, 'access', _153 => _153.rollupConfig, 'optionalAccess', _154 => _154.external]) === nitroRollupExternal && !hasRollupPlugins(_optionalChain([nitroConfig, 'access', _155 => _155.rollupConfig, 'optionalAccess', _156 => _156.plugins])) && customRollupKeys.length === 0 && _path2.default.resolve(_optionalChain([nitroConfig, 'access', _157 => _157.output, 'optionalAccess', _158 => _158.serverDir]) || "") === _path2.default.resolve(expectedServerDir) && Boolean(
9312
+ _optionalChain([nitroConfig, 'access', _159 => _159.handlers, 'optionalAccess', _160 => _160.some, 'call', _161 => _161(
9313
+ (handler) => _path2.default.resolve(_optionalChain([handler, 'optionalAccess', _162 => _162.handler]) || "") === nitroEntryPath
9273
9314
  )])
9274
9315
  );
9275
9316
  const selectRolldownBuilder = canReusePrebuiltSSR && requestedBuilder === void 0 && await canUseRolldownBuilder();
@@ -9280,14 +9321,14 @@ export default async function farmNitroEventHandler(event) {
9280
9321
  const resolvedEsbuildOptions = {
9281
9322
  // Function-name helpers are unsafe for provider scripts that serialize a
9282
9323
  // function with toString(); the helper is outside the emitted script scope.
9283
- keepNames: !(_optionalChain([config, 'access', _161 => _161.docs, 'optionalAccess', _162 => _162.enabled]) && _optionalChain([config, 'access', _163 => _163.docs, 'access', _164 => _164.adapter, 'optionalAccess', _165 => _165.server])),
9324
+ keepNames: !(_optionalChain([config, 'access', _163 => _163.docs, 'optionalAccess', _164 => _164.enabled]) && _optionalChain([config, 'access', _165 => _165.docs, 'access', _166 => _166.adapter, 'optionalAccess', _167 => _167.server])),
9284
9325
  legalComments: "none"
9285
9326
  };
9286
- const prebuiltSSREsbuildOptions = _optionalChain([config, 'access', _166 => _166.docs, 'optionalAccess', _167 => _167.enabled]) && _optionalChain([config, 'access', _168 => _168.docs, 'access', _169 => _169.adapter, 'optionalAccess', _170 => _170.server]) ? resolvedEsbuildOptions : configuredEsbuildOptions;
9327
+ const prebuiltSSREsbuildOptions = _optionalChain([config, 'access', _168 => _168.docs, 'optionalAccess', _169 => _169.enabled]) && _optionalChain([config, 'access', _170 => _170.docs, 'access', _171 => _171.adapter, 'optionalAccess', _172 => _172.server]) ? resolvedEsbuildOptions : configuredEsbuildOptions;
9287
9328
  const useFarmEsbuildMinifier = shouldMinify && nitroConfig.sourcemap === false && !hasCustomOxcOptions && !hasLateBuildMutationConfig;
9288
9329
  const esbuildChunkMinifier = useFarmEsbuildMinifier ? createEsbuildChunkMinifyPlugin(resolvedEsbuildOptions) : null;
9289
9330
  if (canReusePrebuiltSSR) {
9290
- const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _171 => _171.rollupConfig, 'optionalAccess', _172 => _172.plugins]);
9331
+ const configuredRollupPlugins = _optionalChain([nitroConfig, 'access', _173 => _173.rollupConfig, 'optionalAccess', _174 => _174.plugins]);
9291
9332
  nitroConfig.rollupConfig = {
9292
9333
  ...nitroConfig.rollupConfig,
9293
9334
  plugins: [
@@ -9300,7 +9341,7 @@ export default async function farmNitroEventHandler(event) {
9300
9341
  const nitroInstance = await nitroBuilder.createNitro(nitroConfig);
9301
9342
  if (config.security.csp && config.security.csp.nonce) {
9302
9343
  nitroInstance.hooks.hook("prerender:generate", async (route) => {
9303
- if (!route.contents || !_optionalChain([route, 'access', _173 => _173.contentType, 'optionalAccess', _174 => _174.toLowerCase, 'call', _175 => _175(), 'access', _176 => _176.includes, 'call', _177 => _177("html")])) return;
9344
+ if (!route.contents || !_optionalChain([route, 'access', _175 => _175.contentType, 'optionalAccess', _176 => _176.toLowerCase, 'call', _177 => _177(), 'access', _178 => _178.includes, 'call', _179 => _179("html")])) return;
9304
9345
  const staticCsp = await _chunkISTFC3MZcjs.applyFarmCspHashesToHtml.call(void 0, route.contents, config.security);
9305
9346
  if (!staticCsp) return;
9306
9347
  route.contents = staticCsp.html;
@@ -9381,7 +9422,7 @@ export default async function farmNitroEventHandler(event) {
9381
9422
  else process.env[_chunkYA6LLTIJcjs.FARM_PRERENDER_ENV] = previousPrerender;
9382
9423
  }
9383
9424
  }
9384
- const sharpRuntimeStagePromise = imageRuntime === "node" ? stageSharpRuntime(config, root, distDir, fs) : Promise.resolve(null);
9425
+ const sharpRuntimeStagePromise = imageRuntime === "node" ? stageSharpRuntime(config, root, distDir, fs, preset) : Promise.resolve(null);
9385
9426
  const [nitroBuildResult, sharpRuntimeStageResult] = await Promise.allSettled([
9386
9427
  nitroBuilder.build(nitroInstance),
9387
9428
  sharpRuntimeStagePromise
@@ -9399,7 +9440,7 @@ export default async function farmNitroEventHandler(event) {
9399
9440
  if (sharpRuntimeStageResult.status === "rejected") {
9400
9441
  throw sharpRuntimeStageResult.reason;
9401
9442
  }
9402
- const stagedSharpRuntime = await _asyncNullishCoalesce(sharpRuntimeStageResult.value, async () => ( (imageRuntime === "node" ? await stageSharpRuntime(config, root, distDir, fs) : null)));
9443
+ const stagedSharpRuntime = await _asyncNullishCoalesce(sharpRuntimeStageResult.value, async () => ( (imageRuntime === "node" ? await stageSharpRuntime(config, root, distDir, fs, preset) : null)));
9403
9444
  const runtimeCopyPromise = (async () => {
9404
9445
  if (stagedSharpRuntime) {
9405
9446
  await installStagedSharpRuntime(stagedSharpRuntime, runtimeServerOutputDir, fs);
@@ -9518,7 +9559,7 @@ async function moveVercelOutputPath(src, dest, fs) {
9518
9559
  await fs.rename(src, dest);
9519
9560
  return;
9520
9561
  } catch (error) {
9521
- const code = _optionalChain([error, 'optionalAccess', _178 => _178.code]);
9562
+ const code = _optionalChain([error, 'optionalAccess', _180 => _180.code]);
9522
9563
  if (code !== "EPERM" && code !== "EACCES" && code !== "EXDEV" && code !== "ENOTEMPTY") {
9523
9564
  throw error;
9524
9565
  }
@@ -9545,7 +9586,7 @@ async function postProcessVercelOutput(root, outputDir, fs, config, farmWorkflow
9545
9586
  try {
9546
9587
  await moveVercelOutputPath(publicDir, staticDir, fs);
9547
9588
  } catch (error) {
9548
- if (_optionalChain([error, 'optionalAccess', _179 => _179.code]) !== "ENOENT") throw error;
9589
+ if (_optionalChain([error, 'optionalAccess', _181 => _181.code]) !== "ENOENT") throw error;
9549
9590
  }
9550
9591
  await copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs);
9551
9592
  await copyPrismaClientForVercel(root, nitroFuncDir, fs);
@@ -9595,7 +9636,24 @@ async function copyFarmDocsContentForVercel(config, root, nitroFuncDir, fs) {
9595
9636
  _chunk5QIKR7RRcjs.logger.info(`\u{1F4DA} Bundled docs content for Vercel: ${_path2.default.relative(root, docsContentDir)}`);
9596
9637
  }
9597
9638
  _chunkS3JO3N4Hcjs.__name.call(void 0, copyFarmDocsContentForVercel, "copyFarmDocsContentForVercel");
9598
- async function stageSharpRuntime(config, root, distDir, fs) {
9639
+ function resolveServerFunctionPlatform(preset) {
9640
+ return preset === "vercel" || preset === "netlify" ? { os: "linux", cpu: "x64", libc: "glibc" } : null;
9641
+ }
9642
+ _chunkS3JO3N4Hcjs.__name.call(void 0, resolveServerFunctionPlatform, "resolveServerFunctionPlatform");
9643
+ function packageSupportsPlatform(packageJson, platform) {
9644
+ return platformFieldAllows(packageJson.os, platform.os) && platformFieldAllows(packageJson.cpu, platform.cpu) && platformFieldAllows(packageJson.libc, platform.libc);
9645
+ }
9646
+ _chunkS3JO3N4Hcjs.__name.call(void 0, packageSupportsPlatform, "packageSupportsPlatform");
9647
+ function platformFieldAllows(field, value) {
9648
+ if (!Array.isArray(field)) return true;
9649
+ const entries = field.filter((entry) => typeof entry === "string");
9650
+ if (entries.includes(`!${value}`)) return false;
9651
+ const allowed = entries.filter((entry) => !entry.startsWith("!"));
9652
+ return allowed.length === 0 || allowed.includes(value);
9653
+ }
9654
+ _chunkS3JO3N4Hcjs.__name.call(void 0, platformFieldAllows, "platformFieldAllows");
9655
+ async function stageSharpRuntime(config, root, distDir, fs, preset) {
9656
+ const functionPlatform = resolveServerFunctionPlatform(preset);
9599
9657
  const projectRequire = _module.createRequire.call(void 0, _path2.default.join(root, "package.json"));
9600
9658
  let sharpRequire = projectRequire;
9601
9659
  if (!resolvePackageJson(projectRequire, "sharp")) {
@@ -9622,6 +9680,7 @@ async function stageSharpRuntime(config, root, distDir, fs) {
9622
9680
  const packageJsonPath = resolvePackageJson(parentRequire, packageName);
9623
9681
  if (!packageJsonPath) return;
9624
9682
  const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf8"));
9683
+ if (functionPlatform && !packageSupportsPlatform(packageJson, functionPlatform)) return;
9625
9684
  const packageDir = _path2.default.dirname(packageJsonPath);
9626
9685
  const targetDir = _path2.default.join(targetNodeModules, ...packageName.split("/"));
9627
9686
  copiedPackages.set(packageName, String(packageJson.version || "*"));
@@ -9631,7 +9690,7 @@ async function stageSharpRuntime(config, root, distDir, fs) {
9631
9690
  ...packageJson.dependencies,
9632
9691
  ...packageJson.optionalDependencies
9633
9692
  };
9634
- await Promise.all([
9693
+ await settleAllOrThrow([
9635
9694
  fs.cp(packageDir, targetDir, {
9636
9695
  recursive: true,
9637
9696
  force: true,
@@ -9682,10 +9741,18 @@ async function installStagedSharpRuntime(staged, nitroFuncDir, fs) {
9682
9741
  );
9683
9742
  }
9684
9743
  _chunkS3JO3N4Hcjs.__name.call(void 0, installStagedSharpRuntime, "installStagedSharpRuntime");
9744
+ async function settleAllOrThrow(operations) {
9745
+ const results = await Promise.allSettled(operations);
9746
+ const failure = results.find(
9747
+ (result) => result.status === "rejected"
9748
+ );
9749
+ if (failure) throw failure.reason;
9750
+ }
9751
+ _chunkS3JO3N4Hcjs.__name.call(void 0, settleAllOrThrow, "settleAllOrThrow");
9685
9752
  async function mergeStagedDirectory(sourceDir, targetDir, fs) {
9686
9753
  await fs.mkdir(targetDir, { recursive: true });
9687
9754
  const entries = await fs.readdir(sourceDir, { withFileTypes: true });
9688
- await Promise.all(
9755
+ await settleAllOrThrow(
9689
9756
  entries.map(async (entry) => {
9690
9757
  const sourcePath = _path2.default.join(sourceDir, entry.name);
9691
9758
  const targetPath = _path2.default.join(targetDir, entry.name);
@@ -9766,14 +9833,17 @@ async function writeNitroOutputPackage(outputDir, packageJson, fs) {
9766
9833
  }
9767
9834
  _chunkS3JO3N4Hcjs.__name.call(void 0, writeNitroOutputPackage, "writeNitroOutputPackage");
9768
9835
  function resolvePackageJson(parentRequire, packageName) {
9836
+ let metadataModule;
9769
9837
  for (const request of [`${packageName}/package.json`, `${packageName}/package`]) {
9770
9838
  try {
9771
- return parentRequire.resolve(request);
9839
+ const resolved = parentRequire.resolve(request);
9840
+ if (resolved.endsWith(".json")) return resolved;
9841
+ _nullishCoalesce(metadataModule, () => ( (metadataModule = resolved)));
9772
9842
  } catch (e25) {
9773
9843
  }
9774
9844
  }
9775
9845
  try {
9776
- let directory = _path2.default.dirname(parentRequire.resolve(packageName));
9846
+ let directory = _path2.default.dirname(_nullishCoalesce(metadataModule, () => ( parentRequire.resolve(packageName))));
9777
9847
  while (directory !== _path2.default.dirname(directory)) {
9778
9848
  const candidate = _path2.default.join(directory, "package.json");
9779
9849
  if (_fs.existsSync.call(void 0, candidate)) {
@@ -9845,7 +9915,7 @@ function createBuildTargetBaseline(config) {
9845
9915
  preset,
9846
9916
  distDir,
9847
9917
  outputDir,
9848
- outputWasDerived: outputDir === _chunkU5BMPGS3cjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
9918
+ outputWasDerived: outputDir === _chunkYP5JZ4LFcjs.getDefaultDeployOutputDir.call(void 0, config.deploy.target, preset, distDir)
9849
9919
  };
9850
9920
  }
9851
9921
  _chunkS3JO3N4Hcjs.__name.call(void 0, createBuildTargetBaseline, "createBuildTargetBaseline");
@@ -9855,8 +9925,8 @@ function resolveBuildTargets(config, options, baseline) {
9855
9925
  const distDir = config.distDir || ".farm";
9856
9926
  const outputWasReplaced = config.deploy.outputDir !== baseline.outputDir;
9857
9927
  const shouldRefreshDerivedOutput = baseline.outputWasDerived && !outputWasReplaced && (preset !== baseline.preset || distDir !== baseline.distDir);
9858
- const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunkU5BMPGS3cjs.getDeployTargetForPreset.call(void 0, preset);
9859
- const outputDir = shouldRefreshDerivedOutput ? _chunkU5BMPGS3cjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
9928
+ const deployTarget = preset === config.deploy.preset ? config.deploy.target : _chunkYP5JZ4LFcjs.getDeployTargetForPreset.call(void 0, preset);
9929
+ const outputDir = shouldRefreshDerivedOutput ? _chunkYP5JZ4LFcjs.getDefaultDeployOutputDir.call(void 0, deployTarget, preset, distDir) : config.deploy.outputDir;
9860
9930
  return {
9861
9931
  root,
9862
9932
  preset,
@@ -9864,7 +9934,7 @@ function resolveBuildTargets(config, options, baseline) {
9864
9934
  distDir,
9865
9935
  deployTarget,
9866
9936
  outputDir,
9867
- deployOutputDir: _chunkU5BMPGS3cjs.resolveDeployOutputPath.call(void 0, root, outputDir)
9937
+ deployOutputDir: _chunkYP5JZ4LFcjs.resolveDeployOutputPath.call(void 0, root, outputDir)
9868
9938
  };
9869
9939
  }
9870
9940
  _chunkS3JO3N4Hcjs.__name.call(void 0, resolveBuildTargets, "resolveBuildTargets");
@@ -9873,13 +9943,14 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
9873
9943
  const targetBaseline = createBuildTargetBaseline(config);
9874
9944
  let targets;
9875
9945
  const productionViteResultPromise = options.universal === false ? void 0 : Promise.allSettled([Promise.resolve(_nullishCoalesce(options.productionVite, () => ( _chunkA6WIQH5Zcjs.loadFarmProductionVite.call(void 0, ))))]);
9876
- const pluginManager = new (0, _chunkXDGMADQMcjs.PluginManager)({
9946
+ const pluginManager = new (0, _chunkL7ARWZYTcjs.PluginManager)({
9877
9947
  config,
9878
9948
  isDev: false,
9879
9949
  isProd: true
9880
9950
  });
9881
9951
  pluginManager.addPlugins(config.plugins || []);
9882
9952
  let projectModuleServer;
9953
+ const rendererBuild = new AbortController();
9883
9954
  try {
9884
9955
  await pluginManager.runHookParallel("init");
9885
9956
  config = await pluginManager.runHookSerial("config", config);
@@ -9912,21 +9983,26 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
9912
9983
  });
9913
9984
  _chunk5QIKR7RRcjs.logger.info("\u{1F50D} Discovering routes and API endpoints...");
9914
9985
  const productionViteResult = productionViteResultPromise ? (await productionViteResultPromise)[0] : void 0;
9915
- if (_optionalChain([productionViteResult, 'optionalAccess', _180 => _180.status]) === "rejected") throw productionViteResult.reason;
9916
- const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _181 => _181.value]);
9986
+ if (_optionalChain([productionViteResult, 'optionalAccess', _182 => _182.status]) === "rejected") throw productionViteResult.reason;
9987
+ const productionVite = _optionalChain([productionViteResult, 'optionalAccess', _183 => _183.value]);
9917
9988
  const createViteServer = productionVite ? productionVite.createServer : (await import("vite")).createServer;
9918
- projectModuleServer = await createProjectModuleServer(createViteServer, config, root);
9919
- const farmApp = _chunkXDGMADQMcjs.createFarmApp.call(void 0, config, projectModuleServer);
9989
+ projectModuleServer = await createProjectModuleServer(
9990
+ createViteServer,
9991
+ config,
9992
+ root,
9993
+ rendererBuild.signal
9994
+ );
9995
+ const farmApp = _chunkL7ARWZYTcjs.createFarmApp.call(void 0, config, projectModuleServer);
9920
9996
  await farmApp.initialize();
9921
9997
  const routeManager = farmApp.getRouteManager();
9922
9998
  const serverRenderer = farmApp.getServerRenderer();
9923
- const typeArtifacts = _chunkGPVTX3HTcjs.generateFarmTypeArtifacts.call(void 0, {
9999
+ const typeArtifacts = _chunkXFFQSD2Fcjs.generateFarmTypeArtifacts.call(void 0, {
9924
10000
  root,
9925
10001
  srcDir,
9926
10002
  layers: config.layers,
9927
10003
  plugins: config.plugins,
9928
10004
  extraRoutes: [
9929
- ..._optionalChain([config, 'access', _182 => _182.openapi, 'optionalAccess', _183 => _183.enabled]) && config.openapi.route ? [config.openapi.route] : [],
10005
+ ..._optionalChain([config, 'access', _184 => _184.openapi, 'optionalAccess', _185 => _185.enabled]) && config.openapi.route ? [config.openapi.route] : [],
9930
10006
  ..._chunkNBAHDVOJcjs.getFarmDocsRouteTypeEntries.call(void 0, config.docs)
9931
10007
  ],
9932
10008
  suppressLintOnLink: config.suppressLintOnLink,
@@ -9936,7 +10012,7 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
9936
10012
  const message = error instanceof Error ? error.message : String(error);
9937
10013
  _chunk5QIKR7RRcjs.logger.warn(`Route type generation failed (farm.d.ts may be stale): ${message}`);
9938
10014
  });
9939
- const apiRouteManager = new (0, _chunkAFOD3LYZcjs.APIRouteManager)(
10015
+ const apiRouteManager = new (0, _chunkB3WK4DTXcjs.APIRouteManager)(
9940
10016
  _chunkY4YMF2NQcjs.getFarmAppDirectories.call(void 0, config),
9941
10017
  projectModuleServer,
9942
10018
  {
@@ -9957,7 +10033,8 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
9957
10033
  preset,
9958
10034
  root,
9959
10035
  pluginManager,
9960
- productionVite
10036
+ productionVite,
10037
+ rendererBuildLifetime: rendererBuild.signal
9961
10038
  });
9962
10039
  } else {
9963
10040
  const { build: legacyViteBuild } = await import("vite");
@@ -10009,15 +10086,20 @@ async function buildWithProductionNodeEnv(inputConfig, options) {
10009
10086
  _chunk5QIKR7RRcjs.logger.error(`\u274C Build failed: ${error}`);
10010
10087
  throw error;
10011
10088
  } finally {
10012
- await _optionalChain([projectModuleServer, 'optionalAccess', _184 => _184.close, 'call', _185 => _185()]);
10089
+ try {
10090
+ await _optionalChain([projectModuleServer, 'optionalAccess', _186 => _186.close, 'call', _187 => _187()]);
10091
+ } finally {
10092
+ rendererBuild.abort();
10093
+ }
10013
10094
  }
10014
10095
  }
10015
10096
  _chunkS3JO3N4Hcjs.__name.call(void 0, buildWithProductionNodeEnv, "buildWithProductionNodeEnv");
10016
- async function createProjectModuleServer(createViteServer, config, root) {
10097
+ async function createProjectModuleServer(createViteServer, config, root, buildLifetime) {
10017
10098
  const rendererVitePlugins = await _chunkTFAXUHWXcjs.loadFarmRendererVitePlugins.call(void 0, config.renderer, root, {
10018
- ssr: true
10099
+ ssr: true,
10100
+ buildLifetime
10019
10101
  });
10020
- const viteConfig = _chunkXDGMADQMcjs.mergeFarmViteConfig.call(void 0,
10102
+ const viteConfig = _chunkL7ARWZYTcjs.mergeFarmViteConfig.call(void 0,
10021
10103
  {
10022
10104
  root,
10023
10105
  appType: "custom",
@@ -10029,7 +10111,7 @@ async function createProjectModuleServer(createViteServer, config, root) {
10029
10111
  },
10030
10112
  plugins: [
10031
10113
  ...rendererVitePlugins,
10032
- _chunkXDGMADQMcjs.farmFontImportsPlugin.call(void 0, {
10114
+ _chunkL7ARWZYTcjs.farmFontImportsPlugin.call(void 0, {
10033
10115
  root,
10034
10116
  basePath: config.basePath,
10035
10117
  publicDir: config.publicDir
@@ -10041,7 +10123,7 @@ async function createProjectModuleServer(createViteServer, config, root) {
10041
10123
  hmr: false
10042
10124
  },
10043
10125
  resolve: {
10044
- alias: _chunkXDGMADQMcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
10126
+ alias: _chunkL7ARWZYTcjs.createFarmSourceAlias.call(void 0, root, config.srcDir),
10045
10127
  dedupe: [...config.renderer.dedupe || []]
10046
10128
  },
10047
10129
  optimizeDeps: {
@@ -10127,7 +10209,7 @@ async function buildSSR(viteBuild, config, root, srcDir, outputDir) {
10127
10209
  define: {
10128
10210
  __FARM_API_BASE_URL__: JSON.stringify(config.api.baseURL),
10129
10211
  __FARM_ENV__: JSON.stringify(_chunkVEKFLAQMcjs.createBundledEnv.call(void 0, config.env)),
10130
- __FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _186 => _186.env, 'optionalAccess', _187 => _187.public]) || {})
10212
+ __FARM_PUBLIC_ENV__: JSON.stringify(_optionalChain([config, 'access', _188 => _188.env, 'optionalAccess', _189 => _189.public]) || {})
10131
10213
  },
10132
10214
  plugins: [
10133
10215
  farmI18nClientBridgePlugin(),
@@ -10149,7 +10231,7 @@ function resolveLegacyPageEntry(config, root, srcDir) {
10149
10231
  _chunkS3JO3N4Hcjs.__name.call(void 0, resolveLegacyPageEntry, "resolveLegacyPageEntry");
10150
10232
  async function buildNitro(config, routeManager, apiRouteManager, serverRenderer, preset, root, distDir, pluginManager) {
10151
10233
  const [{ createNitroConfig }, { createNitro, build: nitroBuild }] = await Promise.all([
10152
- import("./nitro-4I2MYLY2.cjs"),
10234
+ import("./nitro-TSGDUJMN.cjs"),
10153
10235
  import("nitro/builder")
10154
10236
  ]);
10155
10237
  let nitroConfig = await createNitroConfig(
@@ -10162,7 +10244,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
10162
10244
  if (pluginManager) {
10163
10245
  nitroConfig = await pluginManager.runHookSerial("beforeNitroBuild", nitroConfig);
10164
10246
  }
10165
- const outputDir = _chunkU5BMPGS3cjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
10247
+ const outputDir = _chunkYP5JZ4LFcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir);
10166
10248
  const serverOutputDir = _path2.default.join(outputDir, "server");
10167
10249
  const publicOutputDir = _path2.default.join(outputDir, "public");
10168
10250
  const { mkdir, cp } = await import("fs/promises");
@@ -10233,7 +10315,7 @@ async function buildNitro(config, routeManager, apiRouteManager, serverRenderer,
10233
10315
  root,
10234
10316
  preset,
10235
10317
  distDir,
10236
- outputDir: _chunkU5BMPGS3cjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
10318
+ outputDir: _chunkYP5JZ4LFcjs.resolveDeployOutputPath.call(void 0, root, config.deploy.outputDir)
10237
10319
  });
10238
10320
  }
10239
10321
  }