@farm.js/core 0.1.18 → 0.1.20

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 (189) 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.cjs +4 -4
  14. package/dist/app-markdown.d.mts +3 -4
  15. package/dist/app-markdown.d.ts +3 -4
  16. package/dist/app-markdown.mjs +3 -3
  17. package/dist/{chunk-FS7FLPOG.mjs → chunk-2J7W2WND.mjs} +3 -2
  18. package/dist/{chunk-YS3TRKCG.mjs → chunk-2M435BUE.mjs} +6 -1
  19. package/dist/{chunk-WJ3HK3LJ.cjs → chunk-2QLBIPFT.cjs} +4 -4
  20. package/dist/{chunk-FJSWYIR7.cjs → chunk-3IL5UC5I.cjs} +2 -2
  21. package/dist/chunk-43FMW62B.mjs +67 -0
  22. package/dist/{chunk-A7T6345N.mjs → chunk-5UX4C5QI.mjs} +10 -7
  23. package/dist/{chunk-KPNVGRBL.mjs → chunk-5V37LKBG.mjs} +105 -41
  24. package/dist/chunk-75WGQVQA.cjs +46 -0
  25. package/dist/{chunk-ZCNJKLA2.mjs → chunk-7BC6GAL7.mjs} +1 -1
  26. package/dist/{chunk-J2OP5GG3.cjs → chunk-A777V5WU.cjs} +28 -28
  27. package/dist/{chunk-NWOD6NIT.cjs → chunk-A7T6JZNI.cjs} +1 -1
  28. package/dist/{chunk-E2BMSZ2W.cjs → chunk-AH7HOAQ3.cjs} +2 -2
  29. package/dist/{chunk-AFOD3LYZ.cjs → chunk-B3WK4DTX.cjs} +10 -9
  30. package/dist/{chunk-TWGMSEHX.cjs → chunk-BBVSJVBZ.cjs} +88 -13
  31. package/dist/{chunk-AORPIPNB.cjs → chunk-BHJUZ64B.cjs} +18 -14
  32. package/dist/chunk-BMWDEBXO.cjs +67 -0
  33. package/dist/{chunk-ATERBVHQ.mjs → chunk-CQHFU55R.mjs} +5 -4
  34. package/dist/{chunk-XSKZORAS.cjs → chunk-DX4VKYAJ.cjs} +5 -5
  35. package/dist/{chunk-AWRISO2H.cjs → chunk-E2ROOWQC.cjs} +30 -4
  36. package/dist/{chunk-3XG26Z3J.mjs → chunk-F7E2AZKQ.mjs} +1 -1
  37. package/dist/{chunk-7WPA7GBZ.mjs → chunk-GHFS7RUB.mjs} +1 -1
  38. package/dist/{chunk-UN5GHC5V.cjs → chunk-GQFSCBKJ.cjs} +249 -185
  39. package/dist/{chunk-NZ2JVBT2.mjs → chunk-GZ3ZPTQV.mjs} +2 -2
  40. package/dist/{chunk-DHDVMXYK.mjs → chunk-HALDNTIV.mjs} +30 -4
  41. package/dist/{chunk-5QOEPUYE.mjs → chunk-HSDL2AUR.mjs} +1 -1
  42. package/dist/{chunk-BSTRERPP.cjs → chunk-I5YBCWQ6.cjs} +2 -2
  43. package/dist/{chunk-TYQUSXUG.cjs → chunk-ISTFC3MZ.cjs} +4 -4
  44. package/dist/{chunk-RKQVJN2O.mjs → chunk-JIKGGIOL.mjs} +1 -1
  45. package/dist/{chunk-GYKJCFTS.mjs → chunk-K6MG3SEG.mjs} +124 -82
  46. package/dist/{chunk-OXSIH4D6.cjs → chunk-KNPRCKXK.cjs} +6 -1
  47. package/dist/{chunk-TNBAYAWO.mjs → chunk-L4DVIHOC.mjs} +1 -1
  48. package/dist/{chunk-XWAYMDLB.mjs → chunk-MVUREHPN.mjs} +1 -1
  49. package/dist/{chunk-6VQIKZZO.mjs → chunk-N255VYFP.mjs} +1 -1
  50. package/dist/{chunk-GNEO2XOF.cjs → chunk-NBAHDVOJ.cjs} +4 -4
  51. package/dist/{chunk-EN7WTEAY.mjs → chunk-NRS46D4L.mjs} +2 -2
  52. package/dist/{chunk-A72YEUZ3.mjs → chunk-OCE65DDM.mjs} +1 -1
  53. package/dist/{chunk-SXHV42UQ.mjs → chunk-OFEY6KHO.mjs} +88 -13
  54. package/dist/{chunk-OIEOCXKG.cjs → chunk-OYDRPBBV.cjs} +2 -2
  55. package/dist/{chunk-76DG3LF3.mjs → chunk-PGQBL5DN.mjs} +1 -1
  56. package/dist/{chunk-UDBJCUPA.mjs → chunk-PUCUVI7K.mjs} +11 -7
  57. package/dist/{chunk-IKNRN4VS.cjs → chunk-PZX6I4JW.cjs} +462 -420
  58. package/dist/{chunk-GDSHDTJ4.cjs → chunk-Q5B3KJBP.cjs} +2 -2
  59. package/dist/{chunk-TSWW5BVH.mjs → chunk-QMV4QELL.mjs} +1 -1
  60. package/dist/{chunk-QGVJVSNX.mjs → chunk-RMIJFZU3.mjs} +28 -4
  61. package/dist/{chunk-MKB2EGIR.cjs → chunk-SOR334EB.cjs} +3 -2
  62. package/dist/{chunk-57J3Y7Y3.mjs → chunk-TIKNUAU7.mjs} +3 -2
  63. package/dist/chunk-VVBO3QH7.mjs +46 -0
  64. package/dist/{chunk-UTBVHYS3.mjs → chunk-W7MZXRXM.mjs} +20 -5
  65. package/dist/{chunk-Y53ZSFN6.cjs → chunk-WM6HL7E7.cjs} +4 -3
  66. package/dist/{chunk-WZMNW2IW.cjs → chunk-XFFQSD2F.cjs} +4 -4
  67. package/dist/{chunk-62YJ2IEB.cjs → chunk-XI3GWPUS.cjs} +23 -20
  68. package/dist/{chunk-KVFPGF2M.cjs → chunk-YJJLXIIS.cjs} +7 -7
  69. package/dist/{chunk-NV3A5DXM.cjs → chunk-YP5JZ4LF.cjs} +42 -18
  70. package/dist/{chunk-B4CH33IG.cjs → chunk-ZE6ONQ5R.cjs} +39 -24
  71. package/dist/{client-plugins-JXXmZliS.d.mts → client-plugins-CWrhb1ir.d.mts} +26 -3
  72. package/dist/{client-plugins-C089bQhN.d.ts → client-plugins-DPf0qZey.d.ts} +26 -3
  73. package/dist/client-plugins.d.mts +2 -3
  74. package/dist/client-plugins.d.ts +2 -3
  75. package/dist/client.cjs +4 -4
  76. package/dist/client.d.mts +9 -38
  77. package/dist/client.d.ts +9 -38
  78. package/dist/client.mjs +3 -3
  79. package/dist/config.d.mts +2 -3
  80. package/dist/config.d.ts +2 -3
  81. package/dist/{devtools-UFVTMQX5.mjs → devtools-MTB5SA2B.mjs} +5 -5
  82. package/dist/{devtools-OUIPHVV6.cjs → devtools-R6MDDAZK.cjs} +9 -9
  83. package/dist/docs.cjs +9 -8
  84. package/dist/docs.d.mts +2 -2
  85. package/dist/docs.d.ts +2 -2
  86. package/dist/docs.mjs +8 -7
  87. package/dist/index.cjs +29 -28
  88. package/dist/index.d.mts +14 -14
  89. package/dist/index.d.ts +14 -14
  90. package/dist/index.mjs +28 -27
  91. package/dist/integrations.d.mts +2 -3
  92. package/dist/integrations.d.ts +2 -3
  93. package/dist/internal/app-markdown-runtime.cjs +3 -3
  94. package/dist/internal/app-markdown-runtime.d.mts +2 -3
  95. package/dist/internal/app-markdown-runtime.d.ts +2 -3
  96. package/dist/internal/app-markdown-runtime.mjs +2 -2
  97. package/dist/internal/build-runtime.cjs +22 -21
  98. package/dist/internal/build-runtime.d.mts +4 -5
  99. package/dist/internal/build-runtime.d.ts +4 -5
  100. package/dist/internal/build-runtime.mjs +21 -20
  101. package/dist/internal/cli-runtime.cjs +12 -12
  102. package/dist/internal/cli-runtime.mjs +11 -11
  103. package/dist/internal/client-error-overlay.cjs +4 -4
  104. package/dist/internal/client-error-overlay.mjs +1 -1
  105. package/dist/internal/compression-runtime.d.mts +2 -3
  106. package/dist/internal/compression-runtime.d.ts +2 -3
  107. package/dist/internal/config-runtime.cjs +6 -6
  108. package/dist/internal/config-runtime.d.mts +3 -4
  109. package/dist/internal/config-runtime.d.ts +3 -4
  110. package/dist/internal/config-runtime.mjs +5 -5
  111. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  112. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  113. package/dist/internal/production-runtime.cjs +5 -5
  114. package/dist/internal/production-runtime.d.mts +8 -9
  115. package/dist/internal/production-runtime.d.ts +8 -9
  116. package/dist/internal/production-runtime.mjs +4 -4
  117. package/dist/markdown.cjs +2 -2
  118. package/dist/markdown.mjs +1 -1
  119. package/dist/{metadata-C1Z9vLbb.d.mts → metadata-CO9fRyyJ.d.mts} +1 -1
  120. package/dist/{metadata-BcNJP4fq.d.ts → metadata-zY9wltwH.d.ts} +1 -1
  121. package/dist/middleware.cjs +4 -4
  122. package/dist/middleware.d.mts +4 -11
  123. package/dist/middleware.d.ts +4 -11
  124. package/dist/middleware.mjs +3 -3
  125. package/dist/navigation.cjs +5 -5
  126. package/dist/navigation.d.mts +42 -3
  127. package/dist/navigation.d.ts +42 -3
  128. package/dist/navigation.mjs +4 -4
  129. package/dist/{nitro-CVZ36JM5.mjs → nitro-4LFVTT24.mjs} +2 -2
  130. package/dist/{nitro-4I2MYLY2.cjs → nitro-TSGDUJMN.cjs} +3 -3
  131. package/dist/plugin.cjs +23 -17
  132. package/dist/plugin.d.mts +3 -4
  133. package/dist/plugin.d.ts +3 -4
  134. package/dist/plugin.mjs +23 -17
  135. package/dist/{production-runtime-jcrTlRTb.d.mts → production-runtime-CywsHwnG.d.mts} +1 -1
  136. package/dist/{production-runtime-oKmC0WU-.d.ts → production-runtime-lkfwujwK.d.ts} +1 -1
  137. package/dist/query/client.cjs +6 -6
  138. package/dist/query/client.mjs +2 -2
  139. package/dist/{render-plan-DOB9cV-h.d.ts → render-plan-DHF0GeWo.d.ts} +1 -1
  140. package/dist/{render-plan-BLIfc4jt.d.mts → render-plan-LVy6sGQe.d.mts} +1 -1
  141. package/dist/renderer-client.cjs +5 -5
  142. package/dist/renderer-client.d.mts +4 -5
  143. package/dist/renderer-client.d.ts +4 -5
  144. package/dist/renderer-client.mjs +2 -2
  145. package/dist/renderer.d.mts +3 -0
  146. package/dist/renderer.d.ts +3 -0
  147. package/dist/{request-Cr53NRHr.d.mts → request-6AkmhEYE.d.mts} +1 -1
  148. package/dist/{request-Dt2gNuQD.d.ts → request-BYxlRqA9.d.ts} +1 -1
  149. package/dist/request.d.mts +3 -4
  150. package/dist/request.d.ts +3 -4
  151. package/dist/{route-rendering-CWYd8Mv1.d.ts → route-rendering-CWaKiUbS.d.ts} +1 -1
  152. package/dist/{route-rendering-CeFBEAoZ.d.mts → route-rendering-Dd8Jmml7.d.mts} +1 -1
  153. package/dist/router-B2m4fvve.d.ts +50 -0
  154. package/dist/router-xwEE112q.d.mts +50 -0
  155. package/dist/routes.cjs +3 -3
  156. package/dist/routes.d.mts +2 -3
  157. package/dist/routes.d.ts +2 -3
  158. package/dist/routes.mjs +2 -2
  159. package/dist/{schema-dev-notice-2IE2F2XI.mjs → schema-dev-notice-O67CPXJ6.mjs} +1 -1
  160. package/dist/{schema-dev-notice-MXSZMVDG.cjs → schema-dev-notice-Y7MQEFGN.cjs} +3 -3
  161. package/dist/server-plugins.d.mts +3 -4
  162. package/dist/server-plugins.d.ts +3 -4
  163. package/dist/server.cjs +33 -32
  164. package/dist/server.d.mts +8 -9
  165. package/dist/server.d.ts +8 -9
  166. package/dist/server.mjs +19 -18
  167. package/dist/{spa-router-CQWiYGxS.d.mts → spa-router-DVEHQnWo.d.mts} +3 -3
  168. package/dist/{spa-router-Wjiw-8hB.d.ts → spa-router-Y8rrXTVK.d.ts} +3 -3
  169. package/dist/testing.cjs +6 -6
  170. package/dist/testing.d.mts +2 -3
  171. package/dist/testing.d.ts +2 -3
  172. package/dist/testing.mjs +5 -5
  173. package/dist/{types-D-1WTE72.d.mts → types-DFbjpjXX.d.mts} +8 -0
  174. package/dist/{types-D-1WTE72.d.ts → types-DFbjpjXX.d.ts} +8 -0
  175. package/dist/{utils-uUxF0K0P.d.mts → utils-DSPx34-A.d.mts} +1 -1
  176. package/dist/{utils-B0XJmG_b.d.ts → utils-Dvuny_08.d.ts} +1 -1
  177. package/dist/version.cjs +2 -2
  178. package/dist/version.mjs +1 -1
  179. package/dist/vite.cjs +18 -17
  180. package/dist/vite.d.mts +2 -3
  181. package/dist/vite.d.ts +2 -3
  182. package/dist/vite.mjs +17 -16
  183. package/package.json +3 -3
  184. package/dist/chunk-7GNWGLWB.mjs +0 -14
  185. package/dist/chunk-VQDBNVOO.cjs +0 -14
  186. package/dist/navigation-errors-Dvwpzaer.d.mts +0 -13
  187. package/dist/navigation-errors-Dvwpzaer.d.ts +0 -13
  188. /package/dist/{chunk-IAMRBF3Z.cjs → chunk-N4RLRSWW.cjs} +0 -0
  189. /package/dist/{chunk-BNGS6KJ6.mjs → chunk-YOYF2E4U.mjs} +0 -0
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  useRouter
3
- } from "./chunk-A7T6345N.mjs";
3
+ } from "./chunk-5UX4C5QI.mjs";
4
4
  import {
5
5
  getRouter
6
- } from "./chunk-RKQVJN2O.mjs";
6
+ } from "./chunk-JIKGGIOL.mjs";
7
7
  import {
8
8
  applyFarmBasePath
9
9
  } from "./chunk-4RB44K6Z.mjs";
@@ -7,6 +7,28 @@ import {
7
7
  __name
8
8
  } from "./chunk-LPEX4YW6.mjs";
9
9
 
10
+ // src/schema-sql-identifiers.ts
11
+ var POSTGRES_IDENTIFIER_BYTES = 63;
12
+ function fitSqlIndexName(dialect, name) {
13
+ if (dialect !== "postgres") return name;
14
+ const encoder = new TextEncoder();
15
+ const bytes = encoder.encode(name);
16
+ if (bytes.length <= POSTGRES_IDENTIFIER_BYTES) return name;
17
+ let hash = 2166136261;
18
+ for (const byte of bytes) hash = Math.imul(hash ^ byte, 16777619);
19
+ const suffix = `_${(hash >>> 0).toString(16).padStart(8, "0")}`;
20
+ let prefix = "";
21
+ let length = 0;
22
+ for (const character of name) {
23
+ const size = encoder.encode(character).length;
24
+ if (length + size > POSTGRES_IDENTIFIER_BYTES - suffix.length) break;
25
+ prefix += character;
26
+ length += size;
27
+ }
28
+ return prefix + suffix;
29
+ }
30
+ __name(fitSqlIndexName, "fitSqlIndexName");
31
+
10
32
  // src/schema-sql.ts
11
33
  function describeSchemaReference(model, fieldKey) {
12
34
  const field = model.model.fields[fieldKey];
@@ -155,14 +177,17 @@ function collectSchemaIndexes(model, dialect) {
155
177
  continue;
156
178
  }
157
179
  definitions.push({
158
- name: `${model.modelName}_${field.name}_idx`,
180
+ name: fitSqlIndexName(dialect, `${model.modelName}_${field.name}_idx`),
159
181
  columns: [quoteSqlIdentifier(dialect, field.name)],
160
182
  unique: false
161
183
  });
162
184
  }
163
185
  for (const constraint of model.model.constraints || []) {
164
186
  definitions.push({
165
- name: constraint.name || `${model.modelName}_${constraint.fields.map((fieldKey) => model.model.fields[fieldKey]?.name || fieldKey).join("_")}_${constraint.type}`,
187
+ name: fitSqlIndexName(
188
+ dialect,
189
+ constraint.name || `${model.modelName}_${constraint.fields.map((fieldKey) => model.model.fields[fieldKey]?.name || fieldKey).join("_")}_${constraint.type}`
190
+ ),
166
191
  columns: constraint.fields.map(
167
192
  (fieldKey) => quoteSqlIdentifier(dialect, model.model.fields[fieldKey]?.name || fieldKey)
168
193
  ),
@@ -473,11 +498,12 @@ async function planSchemaMigration(models, dialect, executor) {
473
498
  continue;
474
499
  }
475
500
  const columns = index.columns.map((column) => quoteSqlIdentifier(dialect, column)).join(", ");
501
+ const name = fitSqlIndexName(dialect, index.name);
476
502
  upgrades.push({
477
503
  kind: "index",
478
504
  table: model.modelName,
479
- target: index.name,
480
- sql: `CREATE INDEX${dialect === "mysql" ? "" : " IF NOT EXISTS"} ${quoteSqlIdentifier(dialect, index.name)} ON ${quoteTableName(dialect, model.modelName)} (${columns});`
505
+ target: name,
506
+ sql: `CREATE INDEX${dialect === "mysql" ? "" : " IF NOT EXISTS"} ${quoteSqlIdentifier(dialect, name)} ON ${quoteTableName(dialect, model.modelName)} (${columns});`
481
507
  });
482
508
  }
483
509
  const entry = {
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-TVGP4BBZ.mjs";
12
12
  import {
13
13
  farmAcceptQuality
14
- } from "./chunk-SXHV42UQ.mjs";
14
+ } from "./chunk-OFEY6KHO.mjs";
15
15
  import {
16
16
  matchesFarmIfNoneMatch
17
17
  } from "./chunk-XF7Q24PF.mjs";
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkE2BMSZ2Wcjs = require('./chunk-E2BMSZ2W.cjs');
3
+ var _chunkAH7HOAQ3cjs = require('./chunk-AH7HOAQ3.cjs');
4
4
 
5
5
 
6
6
  var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
@@ -11,7 +11,7 @@ var _path = require('path'); var _path2 = _interopRequireDefault(_path);
11
11
  var _url = require('url');
12
12
  async function createFarmMarkdownRouteModuleFromFile(filePath, options = {}) {
13
13
  const source = await _promises.readFile.call(void 0, filePath, "utf8");
14
- return _chunkE2BMSZ2Wcjs.createFarmMarkdownRouteModule.call(void 0, {
14
+ return _chunkAH7HOAQ3cjs.createFarmMarkdownRouteModule.call(void 0, {
15
15
  source,
16
16
  filePath,
17
17
  components: options.components,
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkTWGMSEHXcjs = require('./chunk-TWGMSEHX.cjs');
5
+ var _chunkBBVSJVBZcjs = require('./chunk-BBVSJVBZ.cjs');
6
6
 
7
7
 
8
8
  var _chunkI57LW5VZcjs = require('./chunk-I57LW5VZ.cjs');
@@ -63,11 +63,11 @@ function collectFarmLlmsTxtPages(sources, options) {
63
63
  for (const source of sources) {
64
64
  const path = source.pattern;
65
65
  if (path.includes("[") || pages.has(path)) continue;
66
- if (include.length && !include.some((pattern) => _chunkTWGMSEHXcjs.matchesFarmMarkdownRoutePattern.call(void 0, pattern, path))) {
66
+ if (include.length && !include.some((pattern) => _chunkBBVSJVBZcjs.matchesFarmMarkdownRoutePattern.call(void 0, pattern, path))) {
67
67
  continue;
68
68
  }
69
- if (exclude.some((pattern) => _chunkTWGMSEHXcjs.matchesFarmMarkdownRoutePattern.call(void 0, pattern, path))) continue;
70
- const target = _chunkTWGMSEHXcjs.isFarmMarkdownMirrorExposed.call(void 0, options.markdown, path) ? _chunkTWGMSEHXcjs.getFarmMarkdownMirrorPath.call(void 0, path) : path;
69
+ if (exclude.some((pattern) => _chunkBBVSJVBZcjs.matchesFarmMarkdownRoutePattern.call(void 0, pattern, path))) continue;
70
+ const target = _chunkBBVSJVBZcjs.isFarmMarkdownMirrorExposed.call(void 0, options.markdown, path) ? _chunkBBVSJVBZcjs.getFarmMarkdownMirrorPath.call(void 0, path) : path;
71
71
  const description = readMetadataString(source.metadata, "description");
72
72
  pages.set(path, {
73
73
  path,
@@ -16,7 +16,7 @@ import {
16
16
  FARM_METADATA_ATTRIBUTE,
17
17
  renderMetadataHead,
18
18
  resolveMetadataTitle
19
- } from "./chunk-YS3TRKCG.mjs";
19
+ } from "./chunk-2M435BUE.mjs";
20
20
  import {
21
21
  createFarmDeploymentMismatchError,
22
22
  createFarmDeploymentRequestHeaders,
@@ -6,12 +6,12 @@ import {
6
6
  parseRouteSlotFile,
7
7
  resolveRouteRenderingConfig,
8
8
  resolveRouteRenderingConfigFromFile
9
- } from "./chunk-EN7WTEAY.mjs";
9
+ } from "./chunk-NRS46D4L.mjs";
10
10
  import {
11
11
  collectSchemaExtensions,
12
12
  declareSchemaTables,
13
13
  readSchemaTables
14
- } from "./chunk-DHDVMXYK.mjs";
14
+ } from "./chunk-HALDNTIV.mjs";
15
15
  import {
16
16
  resolveSchemaModels
17
17
  } from "./chunk-ZMSZZXOR.mjs";
@@ -24,7 +24,7 @@ import {
24
24
  getDefaultErrorStatusText,
25
25
  renderFarmLocaleAlternateLinks,
26
26
  resolveDefaultErrorStatus
27
- } from "./chunk-76DG3LF3.mjs";
27
+ } from "./chunk-PGQBL5DN.mjs";
28
28
  import {
29
29
  isFarmPreviewDeploymentEnvironment
30
30
  } from "./chunk-BOYNDCZL.mjs";
@@ -48,6 +48,10 @@ import {
48
48
  _setDefaultFarmThemeConfig,
49
49
  getTheme
50
50
  } from "./chunk-WBIH66JK.mjs";
51
+ import {
52
+ generateFarmDocsAdapterClientRuntime,
53
+ getFarmDocsAdapterConfigModule
54
+ } from "./chunk-VVBO3QH7.mjs";
51
55
  import {
52
56
  resolveFarmDocsFontAssets,
53
57
  toFarmDocsPublicFontAssets
@@ -65,7 +69,7 @@ import {
65
69
  } from "./chunk-JBSVKMC5.mjs";
66
70
  import {
67
71
  normalizeRouteRules
68
- } from "./chunk-7WPA7GBZ.mjs";
72
+ } from "./chunk-GHFS7RUB.mjs";
69
73
  import {
70
74
  getFarmAppDirectories,
71
75
  getFarmLayerAliases,
@@ -99,7 +103,7 @@ import {
99
103
  resolveFarmLlmsTxtConfig,
100
104
  resolveFarmPerformanceConfig,
101
105
  resolveFarmSecurityConfig
102
- } from "./chunk-ZCNJKLA2.mjs";
106
+ } from "./chunk-7BC6GAL7.mjs";
103
107
  import {
104
108
  getPublicFarmImageConfig,
105
109
  resolveFarmImageConfig
@@ -117,12 +121,12 @@ import {
117
121
  import {
118
122
  createFarmMarkdownRouteModuleFromFile,
119
123
  loadFarmMdxComponents
120
- } from "./chunk-XWAYMDLB.mjs";
124
+ } from "./chunk-MVUREHPN.mjs";
121
125
  import {
122
126
  createFarmMarkdownSourceResponse,
123
127
  isFarmMarkdownPageFile,
124
128
  normalizeFarmMarkdownRoutePath
125
- } from "./chunk-6VQIKZZO.mjs";
129
+ } from "./chunk-N255VYFP.mjs";
126
130
  import {
127
131
  resolveFarmMdxComponentsModulePath,
128
132
  resolveMdxConfig
@@ -136,7 +140,7 @@ import {
136
140
  getFarmMarkdownMirrorPath,
137
141
  resolveMarkdownConfig,
138
142
  resolveMarkdownMirrorTarget
139
- } from "./chunk-SXHV42UQ.mjs";
143
+ } from "./chunk-OFEY6KHO.mjs";
140
144
  import {
141
145
  resolveWorkflowsConfig
142
146
  } from "./chunk-EGJDUF4Q.mjs";
@@ -162,7 +166,7 @@ import {
162
166
  } from "./chunk-JLCQGPXE.mjs";
163
167
  import {
164
168
  MiddlewareManager
165
- } from "./chunk-57J3Y7Y3.mjs";
169
+ } from "./chunk-TIKNUAU7.mjs";
166
170
  import {
167
171
  _clearCurrentMiddlewareContext,
168
172
  _clearCurrentMiddlewareData,
@@ -177,11 +181,11 @@ import {
177
181
  } from "./chunk-IOEH4VWN.mjs";
178
182
  import {
179
183
  APIRouteManager
180
- } from "./chunk-ATERBVHQ.mjs";
184
+ } from "./chunk-CQHFU55R.mjs";
181
185
  import {
182
186
  findProgrammaticRouteFiles,
183
187
  loadProgrammaticRouteManifests
184
- } from "./chunk-BNGS6KJ6.mjs";
188
+ } from "./chunk-YOYF2E4U.mjs";
185
189
  import {
186
190
  _runWithFarmI18nRequest,
187
191
  _setDefaultFarmI18nRuntime,
@@ -208,7 +212,7 @@ import {
208
212
  normalizeFarmRouteRuntimeConfig,
209
213
  resolveFarmRouteRuleRuntimeConfig,
210
214
  resolveFarmRouteRuntimeConfig
211
- } from "./chunk-FS7FLPOG.mjs";
215
+ } from "./chunk-2J7W2WND.mjs";
212
216
  import {
213
217
  clearRequestContext,
214
218
  copyRequestContext,
@@ -227,8 +231,10 @@ import {
227
231
  createCliColors
228
232
  } from "./chunk-I2BHUNBU.mjs";
229
233
  import {
234
+ invalidateFailedFarmDevModules,
235
+ loadFarmDevModule,
230
236
  toFileModuleUrl
231
- } from "./chunk-7GNWGLWB.mjs";
237
+ } from "./chunk-43FMW62B.mjs";
232
238
  import {
233
239
  isFarmI18nCatalogFile,
234
240
  resolveFarmI18nConfig,
@@ -258,7 +264,7 @@ import {
258
264
  } from "./chunk-Z2RZJZIZ.mjs";
259
265
  import {
260
266
  FARM_VERSION
261
- } from "./chunk-3XG26Z3J.mjs";
267
+ } from "./chunk-F7E2AZKQ.mjs";
262
268
  import {
263
269
  resolveFarmTrailingSlashRedirect,
264
270
  setFarmTrailingSlashPreference
@@ -277,7 +283,7 @@ import {
277
283
  mergeMetadata,
278
284
  renderMetadataHead,
279
285
  resolveFarmNotFoundMetadata
280
- } from "./chunk-YS3TRKCG.mjs";
286
+ } from "./chunk-2M435BUE.mjs";
281
287
  import {
282
288
  FARM_DEPLOYMENT_ID_HEADER,
283
289
  createFarmDeploymentCookie,
@@ -2388,7 +2394,7 @@ var _RouteManager = class _RouteManager {
2388
2394
  const mdxConfig = resolveMdxConfig(this.config.mdx);
2389
2395
  const components = await loadFarmMdxComponents(mdxConfig, {
2390
2396
  root: this.config.root,
2391
- loadModule: this.viteServer ? (componentModulePath) => this.viteServer.ssrLoadModule(componentModulePath) : void 0
2397
+ loadModule: this.viteServer ? (componentModulePath) => loadFarmDevModule(this.viteServer, componentModulePath) : void 0
2392
2398
  });
2393
2399
  return await createFarmMarkdownRouteModuleFromFile(modulePath, {
2394
2400
  components,
@@ -2396,7 +2402,7 @@ var _RouteManager = class _RouteManager {
2396
2402
  });
2397
2403
  }
2398
2404
  if (this.viteServer) {
2399
- const module = await this.viteServer.ssrLoadModule(modulePath);
2405
+ const module = await loadFarmDevModule(this.viteServer, modulePath);
2400
2406
  return module;
2401
2407
  } else {
2402
2408
  const module = await import(
@@ -2421,7 +2427,7 @@ var _RouteManager = class _RouteManager {
2421
2427
  return createLayoutModuleFromProgrammaticLayout(programmaticLayout);
2422
2428
  }
2423
2429
  if (this.viteServer) {
2424
- const module = await this.viteServer.ssrLoadModule(modulePath);
2430
+ const module = await loadFarmDevModule(this.viteServer, modulePath);
2425
2431
  return module;
2426
2432
  } else {
2427
2433
  const module = await import(
@@ -2695,7 +2701,7 @@ var _RouteManager = class _RouteManager {
2695
2701
  async loadProgrammaticRoutesModule(filePath) {
2696
2702
  if (this.viteServer) {
2697
2703
  const viteRoot = this.viteServer.config?.root || this.config.root || process.cwd();
2698
- return await this.viteServer.ssrLoadModule(toViteModuleId(filePath, viteRoot));
2704
+ return await loadFarmDevModule(this.viteServer, toViteModuleId(filePath, viteRoot));
2699
2705
  }
2700
2706
  return await import(
2701
2707
  /* @vite-ignore */
@@ -3012,18 +3018,29 @@ function collectDevStylesheetUrls(modules, alreadyLinked = ALREADY_LINKED) {
3012
3018
  __name(collectDevStylesheetUrls, "collectDevStylesheetUrls");
3013
3019
 
3014
3020
  // src/server/full-document.ts
3015
- function stripContentsWrappers(markup) {
3016
- let out = markup.replace(/^\s+/, "");
3017
- const opener = /^<div\b[^>]*style="display\s*:\s*contents"[^>]*>/i;
3021
+ var CONTENTS_WRAPPER = /^<div\b[^>]*style="display\s*:\s*contents"[^>]*>/i;
3022
+ var HOISTED_HEAD_ELEMENT = /^(?:<(?:meta|link|base)\b[^>]*>|<title\b[^>]*>[\s\S]*?<\/title>)/i;
3023
+ function peelDocumentPrefix(markup) {
3024
+ let inner = markup.replace(/^\s+/, "");
3025
+ let hoisted = "";
3018
3026
  let match;
3019
- while (match = opener.exec(out)) {
3020
- out = out.slice(match[0].length).replace(/^\s+/, "");
3027
+ while (match = CONTENTS_WRAPPER.exec(inner) ?? HOISTED_HEAD_ELEMENT.exec(inner)) {
3028
+ if (!/^<div/i.test(match[0])) hoisted += match[0];
3029
+ inner = inner.slice(match[0].length).replace(/^\s+/, "");
3021
3030
  }
3022
- return out;
3031
+ return { inner, hoisted };
3023
3032
  }
3024
- __name(stripContentsWrappers, "stripContentsWrappers");
3033
+ __name(peelDocumentPrefix, "peelDocumentPrefix");
3034
+ function restoreHoistedHead(document, hoisted) {
3035
+ if (!hoisted) return document;
3036
+ if (/<head[\s>]/i.test(document)) {
3037
+ return document.replace(/<head\b[^>]*>/i, (open) => open + hoisted);
3038
+ }
3039
+ return document.replace(/<html\b[^>]*>/i, (open) => `${open}<head>${hoisted}</head>`);
3040
+ }
3041
+ __name(restoreHoistedHead, "restoreHoistedHead");
3025
3042
  function extractFarmFullDocument(markup) {
3026
- const inner = stripContentsWrappers(markup);
3043
+ const { inner, hoisted } = peelDocumentPrefix(markup);
3027
3044
  if (!/^<!doctype/i.test(inner) && !/^<html[\s>]/i.test(inner)) return null;
3028
3045
  const start = markup.search(/<!doctype|<html[\s>]/i);
3029
3046
  const lower = markup.toLowerCase();
@@ -3041,14 +3058,15 @@ function extractFarmFullDocument(markup) {
3041
3058
  if (streamedTail) {
3042
3059
  document = document.replace(/<\/body>/i, () => `${streamedTail}</body>`);
3043
3060
  }
3044
- return document;
3061
+ return restoreHoistedHead(document, hoisted);
3045
3062
  }
3046
3063
  __name(extractFarmFullDocument, "extractFarmFullDocument");
3047
- function opensFarmFullDocument(markup) {
3048
- const inner = stripContentsWrappers(markup);
3049
- return /^<!doctype/i.test(inner) || /^<html[\s>]/i.test(inner);
3064
+ function classifyFarmDocumentPrefix(markup) {
3065
+ const { inner } = peelDocumentPrefix(markup);
3066
+ if (/^<!doctype/i.test(inner) || /^<html[\s>]/i.test(inner)) return "document";
3067
+ return inner === "" ? "pending" : "fragment";
3050
3068
  }
3051
- __name(opensFarmFullDocument, "opensFarmFullDocument");
3069
+ __name(classifyFarmDocumentPrefix, "classifyFarmDocumentPrefix");
3052
3070
  function ensureFarmDocumentHead(markup) {
3053
3071
  if (/<head[\s>]/i.test(markup)) return markup;
3054
3072
  return markup.replace(/<html([^>]*)>/i, (_match, attributes) => {
@@ -4601,6 +4619,7 @@ function warnSuppressedAsyncHydrationOnce(modulePath, reason) {
4601
4619
  }
4602
4620
  __name(warnSuppressedAsyncHydrationOnce, "warnSuppressedAsyncHydrationOnce");
4603
4621
  var fullDocumentRoutes = /* @__PURE__ */ new Set();
4622
+ var documentLayouts = /* @__PURE__ */ new WeakMap();
4604
4623
  function hasRequestHeader(req, name) {
4605
4624
  const value = req.headers[name.toLowerCase()];
4606
4625
  return Array.isArray(value) ? value.length > 0 : Boolean(value);
@@ -4791,7 +4810,7 @@ var _ServerRenderer = class _ServerRenderer {
4791
4810
  if (this.config.notFound?.component?.trim()) {
4792
4811
  resolveFarmNotFoundComponentPath(this.config, getFarmAppDirectories(this.config));
4793
4812
  }
4794
- const loaded = isReactRenderer(this.config.renderer) ? await import("./renderer/react/server.mjs") : this.viteServer ? await this.viteServer.ssrLoadModule(this.config.renderer.server) : await import(pathToFileURL2(
4813
+ const loaded = isReactRenderer(this.config.renderer) ? await import("./renderer/react/server.mjs") : this.viteServer ? await loadFarmDevModule(this.viteServer, this.config.renderer.server) : await import(pathToFileURL2(
4795
4814
  resolveFarmRendererModule(
4796
4815
  this.config.root || process.cwd(),
4797
4816
  this.config.renderer.server
@@ -5903,7 +5922,7 @@ var _ServerRenderer = class _ServerRenderer {
5903
5922
  path9.resolve(this.config.root, provider.component.module),
5904
5923
  this.config.root
5905
5924
  ) : provider.component.module;
5906
- const providerModule = this.viteServer ? await this.viteServer.ssrLoadModule(providerModuleId) : await importRuntimeModule(
5925
+ const providerModule = this.viteServer ? await loadFarmDevModule(this.viteServer, providerModuleId) : await importRuntimeModule(
5907
5926
  provider.component.module.startsWith(".") ? pathToFileURL2(path9.resolve(this.config.root, provider.component.module)).href : provider.component.module
5908
5927
  );
5909
5928
  ProviderComponent = providerModule[provider.component.export || "default"];
@@ -6530,10 +6549,43 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
6530
6549
  clearMiddlewareData?.();
6531
6550
  }
6532
6551
  }
6552
+ /**
6553
+ * Whether the root layout returns its own `<html>` document, checked as the client's layout
6554
+ * boundary checks it: call a plain synchronous layout and look at what it returns. Knowing
6555
+ * this up front keeps a route's first request on the buffered path too; a layout this cannot
6556
+ * call (async, a class, or one using hooks) falls back to detection from the stream.
6557
+ */
6558
+ async rootLayoutRendersDocument() {
6559
+ if (typeof this.routeManager.getLayouts !== "function") return false;
6560
+ const rootLayout = this.routeManager.getLayouts().get("/");
6561
+ if (!rootLayout) return false;
6562
+ try {
6563
+ const Layout = (await this.routeManager.loadLayoutModule(rootLayout.modulePath)).default;
6564
+ if (typeof Layout !== "function" || Layout.prototype?.isReactComponent || Layout.constructor?.name === "AsyncFunction") {
6565
+ return false;
6566
+ }
6567
+ const cached = documentLayouts.get(Layout);
6568
+ if (cached !== void 0) return cached;
6569
+ let rendersDocument = false;
6570
+ try {
6571
+ const rendered = Layout({
6572
+ children: null,
6573
+ params: {}
6574
+ });
6575
+ rendersDocument = this.rendererRuntime.isValidElement(rendered) && rendered.type === "html";
6576
+ } catch {
6577
+ rendersDocument = false;
6578
+ }
6579
+ documentLayouts.set(Layout, rendersDocument);
6580
+ return rendersDocument;
6581
+ } catch {
6582
+ return false;
6583
+ }
6584
+ }
6533
6585
  async renderWithSSR(element, req, res, clearMiddlewareData, options = {}) {
6534
6586
  const renderToPipeableStream = this.rendererRuntime.renderToPipeableStream;
6535
6587
  const fullDocumentRouteKey = options.observabilityRoute || req.__FARM_ROUTE__ || req.url || "/";
6536
- if (!renderToPipeableStream || fullDocumentRoutes.has(fullDocumentRouteKey)) {
6588
+ if (!renderToPipeableStream || fullDocumentRoutes.has(fullDocumentRouteKey) || await this.rootLayoutRendersDocument()) {
6537
6589
  return this.renderBufferedSSR(element, req, res, clearMiddlewareData, options);
6538
6590
  }
6539
6591
  return new Promise((resolve5, reject) => {
@@ -6709,14 +6761,18 @@ window.__FARM_I18N__ = ${getFarmI18nClientSnapshot() ? serializeInlineValue(getF
6709
6761
  staticShellParts?.push(securedShell);
6710
6762
  let firstChunk = true;
6711
6763
  let checkedFullDocument = false;
6764
+ let documentPrefix = "";
6712
6765
  const cspNonceRewriter = cspNonce ? createFarmCspNonceRewriter(cspNonce) : void 0;
6713
6766
  const cspStreamDecoder = cspNonceRewriter ? new TextDecoder() : void 0;
6714
6767
  const recordRenderedChunk = /* @__PURE__ */ __name((chunkText) => {
6715
6768
  if (!chunkText) return;
6716
6769
  if (!checkedFullDocument) {
6717
- checkedFullDocument = true;
6718
- if (opensFarmFullDocument(chunkText)) {
6719
- fullDocumentRoutes.add(fullDocumentRouteKey);
6770
+ documentPrefix += chunkText;
6771
+ const prefix = classifyFarmDocumentPrefix(documentPrefix);
6772
+ if (prefix !== "pending") {
6773
+ checkedFullDocument = true;
6774
+ documentPrefix = "";
6775
+ if (prefix === "document") fullDocumentRoutes.add(fullDocumentRouteKey);
6720
6776
  }
6721
6777
  }
6722
6778
  htmlParts.push(chunkText);
@@ -9179,33 +9235,6 @@ function mergeFarmProductionViteConfig(farmConfig, userConfig = {}) {
9179
9235
  }
9180
9236
  __name(mergeFarmProductionViteConfig, "mergeFarmProductionViteConfig");
9181
9237
 
9182
- // src/docs/adapter-client.ts
9183
- function generateFarmDocsAdapterClientRuntime(reactModule) {
9184
- if (!reactModule) {
9185
- return `
9186
- async function hydrateFarmDocsAdapterRuntime() {
9187
- return false;
9188
- }
9189
- `;
9190
- }
9191
- return `
9192
- async function hydrateFarmDocsAdapterRuntime() {
9193
- const runtime = window.__FARM_DOCS_ADAPTER__;
9194
- if (!runtime) return false;
9195
- const FarmDocsAdapterReact = await import(${JSON.stringify(reactModule)});
9196
- if (typeof FarmDocsAdapterReact.hydrateFarmDocs !== "function") {
9197
- throw new Error("The configured Farm docs adapter does not export hydrateFarmDocs().");
9198
- }
9199
- FarmDocsAdapterReact.hydrateFarmDocs({
9200
- config: runtime.config || {},
9201
- data: runtime.data,
9202
- });
9203
- return true;
9204
- }
9205
- `;
9206
- }
9207
- __name(generateFarmDocsAdapterClientRuntime, "generateFarmDocsAdapterClientRuntime");
9208
-
9209
9238
  // src/theme/vite.ts
9210
9239
  var FARM_DARK_VARIANT = '@custom-variant dark (&:where([data-theme="dark"], [data-theme="dark"] *));';
9211
9240
  function createFarmThemeCssPlugin(input, basePath = "/") {
@@ -9324,7 +9353,7 @@ function loadFarmWorkflowsDevRuntime() {
9324
9353
  }
9325
9354
  __name(loadFarmWorkflowsDevRuntime, "loadFarmWorkflowsDevRuntime");
9326
9355
  function loadFarmDevtoolsSnapshotRuntime() {
9327
- return import("./devtools-UFVTMQX5.mjs");
9356
+ return import("./devtools-MTB5SA2B.mjs");
9328
9357
  }
9329
9358
  __name(loadFarmDevtoolsSnapshotRuntime, "loadFarmDevtoolsSnapshotRuntime");
9330
9359
  function loadFarmDevtoolsUIRuntime() {
@@ -9941,6 +9970,9 @@ function farmPlugin(options = {}, initialPluginManager) {
9941
9970
  // directory the production client build emits.
9942
9971
  ...options.publicDir ? { publicDir: options.publicDir } : {},
9943
9972
  define: getEnvDefines(options, configEnv),
9973
+ // Keep development module ownership explicit; the RSC plugin adds its
9974
+ // environment only when enabled. Production environment setup is unchanged.
9975
+ ...!isBuild ? { environments: { client: {}, ssr: {} } } : {},
9944
9976
  resolve: {
9945
9977
  alias: { ...layerAliases, ...sourceAlias }
9946
9978
  },
@@ -10069,10 +10101,16 @@ function farmPlugin(options = {}, initialPluginManager) {
10069
10101
  const layerConfigFiles = new Set(
10070
10102
  farmConfig.layers.map((layer) => layer.configFile?.replace(/\\/g, "/")).filter((file) => Boolean(file))
10071
10103
  );
10072
- const isPageFile = /* @__PURE__ */ __name((file) => {
10104
+ const routeModuleExtensions = /* @__PURE__ */ new Set([
10105
+ ...resolveFarmComponentExtensions(farmConfig.renderer.componentExtensions),
10106
+ ".md",
10107
+ ".mdx"
10108
+ ]);
10109
+ const isRouteModuleFile = /* @__PURE__ */ __name((file) => {
10073
10110
  const normalized = file.replace(/\\/g, "/");
10074
- return appDirSlugs.some((appDir) => normalized.startsWith(`${appDir}/`)) && /page\.(ts|tsx|js|jsx|md|mdx)$/.test(normalized);
10075
- }, "isPageFile");
10111
+ const match = /\/(?:page|layout|loading|error)(\.[^./]+)$/.exec(normalized);
10112
+ return appDirSlugs.some((appDir) => normalized.startsWith(`${appDir}/`)) && !!match && routeModuleExtensions.has(match[1].toLowerCase());
10113
+ }, "isRouteModuleFile");
10076
10114
  const isApiRouteFile = /* @__PURE__ */ __name((file) => {
10077
10115
  const normalized = file.replace(/\\/g, "/");
10078
10116
  return appDirSlugs.some((appDir) => normalized.startsWith(`${appDir}/api/`)) && /route\.(ts|tsx|js|jsx)$/.test(normalized);
@@ -10123,11 +10161,14 @@ function farmPlugin(options = {}, initialPluginManager) {
10123
10161
  }, "scheduleTypeArtifactGen");
10124
10162
  ["add", "change", "unlink"].forEach((ev) => {
10125
10163
  server.watcher.on(ev, (file) => {
10164
+ if (ev === "add") {
10165
+ invalidateFailedFarmDevModules(server);
10166
+ }
10126
10167
  const normalizedFile = file.replace(/\\/g, "/");
10127
10168
  const configChanged = isFarmConfigFile(file, farmConfig.root) || layerConfigFiles.has(normalizedFile);
10128
10169
  const programmaticRouteChanged = isProgrammaticRouteFile(file) || isProgrammaticRouteSourceFile(file) && (ev === "unlink" || fileContainsProgrammaticPageRoute(file));
10129
10170
  const typeArtifacts = configChanged ? ALL_TYPE_ARTIFACTS : {
10130
- routes: ev !== "change" && isPageFile(file) || programmaticRouteChanged,
10171
+ routes: ev !== "change" && isRouteModuleFile(file) || programmaticRouteChanged,
10131
10172
  api: isApiRouteFile(file) || programmaticRouteChanged,
10132
10173
  env: false,
10133
10174
  images: false,
@@ -10201,14 +10242,14 @@ function farmPlugin(options = {}, initialPluginManager) {
10201
10242
  discoveredWorkflows = await discoverFarmWorkflows(
10202
10243
  { ...farmConfig, workflows: workflowConfig },
10203
10244
  {
10204
- loadModule: /* @__PURE__ */ __name(async (filePath) => server.ssrLoadModule(filePath), "loadModule")
10245
+ loadModule: /* @__PURE__ */ __name(async (filePath) => loadFarmDevModule(server, filePath), "loadModule")
10205
10246
  }
10206
10247
  );
10207
10248
  if (discoveredWorkflows.length > 0) {
10208
10249
  workflowHandler = createFarmWorkflowRequestHandler({
10209
10250
  workflows: discoveredWorkflows,
10210
10251
  config: workflowConfig,
10211
- loadModule: /* @__PURE__ */ __name(async (workflow) => server.ssrLoadModule(workflow.filePath), "loadModule"),
10252
+ loadModule: /* @__PURE__ */ __name(async (workflow) => loadFarmDevModule(server, workflow.filePath), "loadModule"),
10212
10253
  server: farmConfig.server
10213
10254
  });
10214
10255
  logger.success(`\u2705 Discovered ${discoveredWorkflows.length} Farm workflow task(s)`);
@@ -10282,16 +10323,14 @@ function farmPlugin(options = {}, initialPluginManager) {
10282
10323
  farmConfig.srcDir
10283
10324
  ),
10284
10325
  loadModule: /* @__PURE__ */ __name(async (specifier) => {
10285
- const resolved = await server.pluginContainer.resolveId(specifier, void 0, {
10286
- ssr: true
10287
- });
10326
+ const resolved = await server.environments.ssr.pluginContainer.resolveId(specifier);
10288
10327
  if (specifier === farmConfig.docs.adapter?.server && resolved?.id) {
10289
10328
  return import(
10290
10329
  /* @vite-ignore */
10291
10330
  pathToFileURL3(resolved.id).href
10292
10331
  );
10293
10332
  }
10294
- return server.ssrLoadModule(resolved?.id ?? specifier);
10333
+ return loadFarmDevModule(server, resolved?.id ?? specifier);
10295
10334
  }, "loadModule")
10296
10335
  }) : farmDocsDevRuntime.createFarmDocsHandler(farmConfig.docs, {
10297
10336
  root: farmConfig.root,
@@ -10329,7 +10368,7 @@ function farmPlugin(options = {}, initialPluginManager) {
10329
10368
  }
10330
10369
  const docsRenderer = resolveFarmRenderer((farmApp?.getConfig() ?? options).renderer);
10331
10370
  const [rendererRuntime, layoutModules] = await Promise.all([
10332
- isReactRenderer(docsRenderer) ? import("./renderer/react/server.mjs") : server.ssrLoadModule(docsRenderer.server),
10371
+ isReactRenderer(docsRenderer) ? import("./renderer/react/server.mjs") : loadFarmDevModule(server, docsRenderer.server),
10333
10372
  Promise.all(
10334
10373
  layoutEntries.map((layout) => routeManager.loadLayoutModule(layout.modulePath))
10335
10374
  )
@@ -11573,7 +11612,8 @@ ${generatedDevIndicatorsClientRuntime}`,
11573
11612
  resolvedConfig?.basePath ?? "/",
11574
11613
  generateClientCachePersistenceCode(
11575
11614
  resolveFarmClientCacheAdapterEntry(root, resolvedConfig?.cache)
11576
- )
11615
+ ),
11616
+ isReactRenderer(renderer) ? getFarmDocsAdapterConfigModule(docs) : void 0
11577
11617
  );
11578
11618
  }
11579
11619
  if (id === "/@farm/server") {
@@ -11739,7 +11779,7 @@ export const manifest = getManifest();
11739
11779
  );
11740
11780
  return;
11741
11781
  }` : "";
11742
- const hmrCode = !shouldEmitFarmClientRootHmr(currentConfig.renderer) ? "" : `
11782
+ const hmrCode = transformOptions?.ssr || !shouldEmitFarmClientRootHmr(currentConfig.renderer) ? "" : `
11743
11783
  if (import.meta.hot) {
11744
11784
  import.meta.hot.accept((newModule) => {
11745
11785
  ${isolatedHmrUpdate}
@@ -12384,7 +12424,7 @@ function parseRouteModuleSchema2(schema, value, label, routePath) {
12384
12424
  }
12385
12425
  }
12386
12426
  __name(parseRouteModuleSchema2, "parseRouteModuleSchema");
12387
- function generateClientCode(integrationProviders = [], documentNavigationMatchers = [], docsSearchClientRuntime = EMPTY_FARM_DOCS_SEARCH_CLIENT_RUNTIME, devtoolsClientRuntime = "", plugins = [], root = process.cwd(), srcDir = "src", publicRuntimeConfig = void 0, docsAdapterReact, renderer = REACT_RENDERER, isolatedHydrationEnabled = false, trailingSlash = false, basePath = "/", clientCachePersistence = { imports: "", init: "" }) {
12427
+ function generateClientCode(integrationProviders = [], documentNavigationMatchers = [], docsSearchClientRuntime = EMPTY_FARM_DOCS_SEARCH_CLIENT_RUNTIME, devtoolsClientRuntime = "", plugins = [], root = process.cwd(), srcDir = "src", publicRuntimeConfig = void 0, docsAdapterReact, renderer = REACT_RENDERER, isolatedHydrationEnabled = false, trailingSlash = false, basePath = "/", clientCachePersistence = { imports: "", init: "" }, docsConfigModule) {
12388
12428
  const providerClientCode = generateFarmIntegrationProviderClientCode(
12389
12429
  integrationProviders,
12390
12430
  root,
@@ -12399,7 +12439,10 @@ function generateClientCode(integrationProviders = [], documentNavigationMatcher
12399
12439
  const rendererClientImports = isReactRenderer(renderer) ? `import React from 'react'
12400
12440
  import { hydrateRoot, createRoot } from 'react-dom/client'` : `import React, { hydrateRoot, createRoot } from ${JSON.stringify(renderer.client)}`;
12401
12441
  const isolatedHydrationImport = isolatedHydrationEnabled ? `import { createFarmIsolatedHydrationRuntime, createFarmServerPageBoundary, wrapFarmIsolatedClientGraph } from '@farm.js/core/internal/isolated-boundary'` : "";
12402
- const docsAdapterImportBlock = generateFarmDocsAdapterClientRuntime(docsAdapterReact);
12442
+ const docsAdapterImportBlock = generateFarmDocsAdapterClientRuntime(
12443
+ docsAdapterReact,
12444
+ docsConfigModule
12445
+ );
12403
12446
  const isolatedHydrationRuntime = isolatedHydrationEnabled ? `const farmIsolatedHydrationRuntime = createFarmIsolatedHydrationRuntime({
12404
12447
  ReactRuntime: React,
12405
12448
  hydrateRoot,
@@ -14197,7 +14240,6 @@ export {
14197
14240
  createFarmSourceAlias,
14198
14241
  mergeFarmViteConfig,
14199
14242
  mergeFarmProductionViteConfig,
14200
- generateFarmDocsAdapterClientRuntime,
14201
14243
  createFarmThemeCssPlugin,
14202
14244
  farmI18nClientBridgePlugin,
14203
14245
  farmServerOnlyEntriesPlugin,
@@ -55,6 +55,11 @@ function mergeMetadataTitle(base, next) {
55
55
  return parentTemplate ? applyTitleTemplate(parentTemplate, next) : next;
56
56
  }
57
57
  if (!isRecord(next)) return next;
58
+ const absoluteTitle = normalizeContent(next.absolute);
59
+ if (absoluteTitle) {
60
+ const { absolute: _absolute, ...rest } = next;
61
+ return { ...rest, default: absoluteTitle };
62
+ }
58
63
  const defaultTitle = _nullishCoalesce(normalizeContent(next.default), () => ( resolveMetadataTitle(base)));
59
64
  return {
60
65
  ...next,
@@ -372,7 +377,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, hasMetadataImages, "hasMetadataImages");
372
377
  function resolveMetadataTitle(title) {
373
378
  if (typeof title === "string") return title;
374
379
  if (isRecord(title)) {
375
- return normalizeContent(title.default);
380
+ return _nullishCoalesce(normalizeContent(title.absolute), () => ( normalizeContent(title.default)));
376
381
  }
377
382
  return void 0;
378
383
  }