@farm.js/core 0.1.68 → 0.1.69

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 (178) hide show
  1. package/dist/{agent-mcp.d-wkVPK1GA.d.mts → agent-mcp.d-DOfBMEzP.d.mts} +1 -1
  2. package/dist/{agent-mcp.d-Uh5xr7aX.d.ts → agent-mcp.d-DnIgriX1.d.ts} +1 -1
  3. package/dist/agent-runtime.d.mts +1 -1
  4. package/dist/agent-runtime.d.ts +1 -1
  5. package/dist/{analyzer-CQDU7E3Y.mjs → analyzer-NAL5TJUP.mjs} +2 -2
  6. package/dist/analyzer-SAJSV6SP.cjs +16 -0
  7. package/dist/api/node.d.mts +3 -3
  8. package/dist/api/node.d.ts +3 -3
  9. package/dist/api/route-manager.d.mts +3 -3
  10. package/dist/api/route-manager.d.ts +3 -3
  11. package/dist/api/runtime.d.mts +2 -2
  12. package/dist/api/runtime.d.ts +2 -2
  13. package/dist/api.cjs +2 -2
  14. package/dist/api.d.mts +4 -21
  15. package/dist/api.d.ts +4 -21
  16. package/dist/api.mjs +1 -1
  17. package/dist/{app-manifest.d-BT5i2F-o.d.ts → app-manifest.d-CaAcaukR.d.ts} +1 -1
  18. package/dist/{app-manifest.d-Dd4q5CFx.d.mts → app-manifest.d-_BVbI0xp.d.mts} +1 -1
  19. package/dist/app-markdown.d.mts +2 -2
  20. package/dist/app-markdown.d.ts +2 -2
  21. package/dist/{app.d-BVOpL_f2.d.ts → app.d-BWeDqOaF.d.ts} +4 -4
  22. package/dist/{app.d-BhiDXex_.d.mts → app.d-CaPwtytN.d.mts} +4 -4
  23. package/dist/{base-path.d-BOUV5ozD.d.mts → base-path.d-CTDVF0Fc.d.mts} +2 -1
  24. package/dist/{base-path.d-BOUV5ozD.d.ts → base-path.d-CTDVF0Fc.d.ts} +2 -1
  25. package/dist/{chunk-SQ6IWJ3H.cjs → chunk-22LGTSBA.cjs} +1 -1
  26. package/dist/{chunk-T5XFZQCL.mjs → chunk-2P7UYHZP.mjs} +1 -1
  27. package/dist/{chunk-LDEXTX4I.cjs → chunk-4JRAMCUP.cjs} +11 -4
  28. package/dist/{chunk-TNK2TVRS.cjs → chunk-4W4ZWSV2.cjs} +196 -155
  29. package/dist/{chunk-MNJDNTGO.mjs → chunk-5TOWKGV3.mjs} +1 -1
  30. package/dist/{chunk-7LK5CTUM.cjs → chunk-6GQJVY4E.cjs} +18 -13
  31. package/dist/{chunk-5JKDFRTK.cjs → chunk-ABIBASLJ.cjs} +2 -2
  32. package/dist/{chunk-F6CMGWAL.mjs → chunk-ANMIR6US.mjs} +1 -1
  33. package/dist/{chunk-Z6SOXHAD.mjs → chunk-CKCKCUYO.mjs} +72 -31
  34. package/dist/{chunk-2ZOYOYEE.mjs → chunk-D5F7RPZP.mjs} +71 -1
  35. package/dist/{chunk-F36LS2C7.cjs → chunk-DHR2WDSL.cjs} +27 -27
  36. package/dist/{chunk-URN7VFO7.cjs → chunk-F6YLXK5L.cjs} +10 -11
  37. package/dist/{chunk-YTNBCXCW.cjs → chunk-GQ6QOH7T.cjs} +9 -5
  38. package/dist/{chunk-BZWTBELF.cjs → chunk-GTQOEEE7.cjs} +77 -7
  39. package/dist/{chunk-IGDYL2IA.cjs → chunk-GUMKIQJL.cjs} +2 -2
  40. package/dist/{chunk-4UAQB5LB.mjs → chunk-IYLZZTP6.mjs} +4 -4
  41. package/dist/{chunk-WUTFJOV7.cjs → chunk-JFPKARWM.cjs} +16 -8
  42. package/dist/{chunk-225APHKC.cjs → chunk-L5OZN6YW.cjs} +3 -3
  43. package/dist/{chunk-KWCZKJYU.cjs → chunk-L6NWQ3DR.cjs} +351 -277
  44. package/dist/{chunk-6OFOIMNS.mjs → chunk-MAGFDK4Q.mjs} +1 -1
  45. package/dist/{chunk-5IQ2ERQA.cjs → chunk-O47W53D3.cjs} +1 -1
  46. package/dist/{chunk-3TXKFRSO.mjs → chunk-OEL5EPOJ.mjs} +1 -1
  47. package/dist/{chunk-A3T445WK.mjs → chunk-PDQ6EGPK.mjs} +8 -1
  48. package/dist/{chunk-VRGY3X2I.mjs → chunk-PEYDQMSA.mjs} +5 -6
  49. package/dist/{chunk-KSZK34HU.mjs → chunk-PJQ5W356.mjs} +16 -8
  50. package/dist/{chunk-JSOCDYER.cjs → chunk-Q4HH5Q6A.cjs} +15 -1
  51. package/dist/{chunk-NT4W4H52.mjs → chunk-SZORL7EW.mjs} +18 -13
  52. package/dist/{chunk-Z3PW3DIR.cjs → chunk-TKYOJ5G2.cjs} +3 -3
  53. package/dist/{chunk-DIXFKAPM.mjs → chunk-UHU4QALN.mjs} +153 -79
  54. package/dist/{chunk-WPB67LE5.mjs → chunk-ULMXZYOA.mjs} +1 -1
  55. package/dist/{chunk-MZ4CRSY7.cjs → chunk-VO65MYJD.cjs} +4 -4
  56. package/dist/{chunk-DXZ57EPE.mjs → chunk-YOHHL2UE.mjs} +14 -0
  57. package/dist/{chunk-VFNAK6A5.mjs → chunk-ZR2QB45W.mjs} +7 -3
  58. package/dist/{chunk-KDO6T6OB.mjs → chunk-ZYCEEE3V.mjs} +1 -1
  59. package/dist/{client-component.d-DNVSLEPi.d.ts → client-component.d-CfJxuXZl.d.ts} +2 -2
  60. package/dist/{client-component.d-BvQOxSqh.d.mts → client-component.d-CnEeVvGG.d.mts} +2 -2
  61. package/dist/{client-plugins.d-CNDqcAuf.d.ts → client-plugins.d-D7dHV1Nf.d.ts} +15 -3
  62. package/dist/{client-plugins.d-CE1lVK2R.d.mts → client-plugins.d-Do5ULA0x.d.mts} +15 -3
  63. package/dist/client-plugins.d.mts +1 -1
  64. package/dist/client-plugins.d.ts +1 -1
  65. package/dist/client.d.mts +6 -6
  66. package/dist/client.d.ts +6 -6
  67. package/dist/config.d.mts +1 -1
  68. package/dist/config.d.ts +1 -1
  69. package/dist/desktop.d.mts +2 -2
  70. package/dist/desktop.d.ts +2 -2
  71. package/dist/{devtools-R27T3BRY.cjs → devtools-7HNDS4SY.cjs} +2 -2
  72. package/dist/{devtools-2A2GPC7B.mjs → devtools-BP4EBTKQ.mjs} +1 -1
  73. package/dist/docs.cjs +5 -3
  74. package/dist/docs.d.mts +15 -3
  75. package/dist/docs.d.ts +15 -3
  76. package/dist/docs.mjs +5 -3
  77. package/dist/environment/vite.cjs +3 -3
  78. package/dist/environment/vite.mjs +2 -2
  79. package/dist/image/server.cjs +2 -2
  80. package/dist/image/server.mjs +1 -1
  81. package/dist/image/sharp.cjs +9 -9
  82. package/dist/image/sharp.mjs +1 -1
  83. package/dist/index.cjs +17 -16
  84. package/dist/{index.d-Bt3kl19W.d.mts → index.d-B1MpEJAo.d.mts} +1 -1
  85. package/dist/{index.d-Cx_-DaKV.d.ts → index.d-CVFk37uX.d.ts} +1 -1
  86. package/dist/index.d.mts +17 -17
  87. package/dist/index.d.ts +17 -17
  88. package/dist/index.mjs +17 -16
  89. package/dist/integrations/orm.d.mts +1 -1
  90. package/dist/integrations/orm.d.ts +1 -1
  91. package/dist/integrations.d.mts +1 -1
  92. package/dist/integrations.d.ts +1 -1
  93. package/dist/internal/app-markdown-runtime.d.mts +2 -2
  94. package/dist/internal/app-markdown-runtime.d.ts +2 -2
  95. package/dist/internal/build-runtime.cjs +15 -16
  96. package/dist/internal/build-runtime.d.mts +3 -3
  97. package/dist/internal/build-runtime.d.ts +3 -3
  98. package/dist/internal/build-runtime.mjs +14 -15
  99. package/dist/internal/cli-runtime.cjs +2 -2
  100. package/dist/internal/cli-runtime.mjs +1 -1
  101. package/dist/internal/client-error-overlay.cjs +4 -4
  102. package/dist/internal/client-error-overlay.mjs +1 -1
  103. package/dist/internal/client-runtime.d.mts +5 -5
  104. package/dist/internal/client-runtime.d.ts +5 -5
  105. package/dist/internal/compression-runtime.d.mts +1 -1
  106. package/dist/internal/compression-runtime.d.ts +1 -1
  107. package/dist/internal/config-runtime.cjs +3 -3
  108. package/dist/internal/config-runtime.d.mts +3 -3
  109. package/dist/internal/config-runtime.d.ts +3 -3
  110. package/dist/internal/config-runtime.mjs +2 -2
  111. package/dist/internal/infra-analytics-runtime.cjs +6 -6
  112. package/dist/internal/infra-analytics-runtime.mjs +4 -4
  113. package/dist/internal/native-server-fns.cjs +4 -4
  114. package/dist/internal/native-server-fns.mjs +3 -3
  115. package/dist/internal/product-telemetry-runtime.cjs +3 -3
  116. package/dist/internal/product-telemetry-runtime.mjs +2 -2
  117. package/dist/internal/production-runtime.cjs +8 -4
  118. package/dist/internal/production-runtime.d.mts +19 -12
  119. package/dist/internal/production-runtime.d.ts +19 -12
  120. package/dist/internal/production-runtime.mjs +8 -4
  121. package/dist/markdown.d.mts +1 -1
  122. package/dist/markdown.d.ts +1 -1
  123. package/dist/middleware.d.mts +1 -1
  124. package/dist/middleware.d.ts +1 -1
  125. package/dist/{mount.d-Bki4pOaJ.d.mts → mount.d-CBqr-LfI.d.mts} +1 -1
  126. package/dist/{mount.d-DjR5aerM.d.ts → mount.d-CGzN61Kq.d.ts} +1 -1
  127. package/dist/{navigation-delegate.d-VDkziXTK.d.mts → navigation-delegate.d-BwCOhpj7.d.mts} +1 -1
  128. package/dist/{navigation-delegate.d-CtghaSP3.d.ts → navigation-delegate.d-CLH2dXjy.d.ts} +1 -1
  129. package/dist/navigation.d.mts +4 -4
  130. package/dist/navigation.d.ts +4 -4
  131. package/dist/{plugin-WIU4GDD4.cjs → plugin-F2O4BFTK.cjs} +2 -2
  132. package/dist/{plugin-SAS22JL7.mjs → plugin-VEBRN7A3.mjs} +1 -1
  133. package/dist/plugin.cjs +10 -10
  134. package/dist/plugin.d.mts +3 -3
  135. package/dist/plugin.d.ts +3 -3
  136. package/dist/plugin.mjs +9 -9
  137. package/dist/{render-plan.d-BSwV8PE4.d.mts → render-plan.d-CzGDjcT0.d.mts} +1 -1
  138. package/dist/{render-plan.d-i9sI4tc9.d.ts → render-plan.d-W6LmjD6y.d.ts} +1 -1
  139. package/dist/renderer-client.d.mts +4 -4
  140. package/dist/renderer-client.d.ts +4 -4
  141. package/dist/{request.d-Dgln8tuI.d.ts → request.d-CTVRZiQv.d.ts} +1 -1
  142. package/dist/{request.d-C24FNQ_7.d.mts → request.d-CgNVderU.d.mts} +1 -1
  143. package/dist/request.d.mts +2 -2
  144. package/dist/request.d.ts +2 -2
  145. package/dist/{route-rendering.d-Ds0BfwQi.d.mts → route-rendering.d-D0bmZVJA.d.mts} +1 -1
  146. package/dist/{route-rendering.d-CUylZKJA.d.ts → route-rendering.d-FDSNtCMg.d.ts} +1 -1
  147. package/dist/{router.d-B56rMOFm.d.ts → router.d-DZ3ldniI.d.ts} +1 -1
  148. package/dist/{router.d-CFPcbqzc.d.mts → router.d-GRKm_uAV.d.mts} +1 -1
  149. package/dist/routes.d.mts +1 -1
  150. package/dist/routes.d.ts +1 -1
  151. package/dist/{rsc-pipeline-3T7V6OUT.cjs → rsc-pipeline-J4KKBSCH.cjs} +4 -5
  152. package/dist/{rsc-pipeline-GA4AQWZI.mjs → rsc-pipeline-PJZOVYSY.mjs} +3 -4
  153. package/dist/{runtime-REUTNTI5.cjs → runtime-OLEO5NXF.cjs} +4 -4
  154. package/dist/{runtime-ZYCKKY7L.mjs → runtime-QDBSE4H6.mjs} +2 -2
  155. package/dist/{runtime.d-DLRO-ExG.d.mts → runtime.d-DqXihlxm.d.mts} +1 -1
  156. package/dist/{runtime.d-H7k9hOQE.d.ts → runtime.d-pqFQBU2N.d.ts} +1 -1
  157. package/dist/server-plugins.d.mts +2 -2
  158. package/dist/server-plugins.d.ts +2 -2
  159. package/dist/server.cjs +31 -31
  160. package/dist/server.d.mts +9 -9
  161. package/dist/server.d.ts +9 -9
  162. package/dist/server.mjs +12 -12
  163. package/dist/{spa-router.d-Dr7oanhl.d.ts → spa-router.d-DhOhaQ-7.d.ts} +2 -2
  164. package/dist/{spa-router.d-g4CzhEH1.d.mts → spa-router.d-Dhvy60p4.d.mts} +2 -2
  165. package/dist/testing.d.mts +1 -1
  166. package/dist/testing.d.ts +1 -1
  167. package/dist/{utils.d-BxxyDEb8.d.ts → utils.d-BVCMRRau.d.ts} +1 -1
  168. package/dist/{utils.d-HIla3pD_.d.mts → utils.d-Q8EHCpkF.d.mts} +1 -1
  169. package/dist/version.cjs +2 -2
  170. package/dist/version.mjs +1 -1
  171. package/dist/vite.cjs +10 -10
  172. package/dist/vite.d.mts +4 -4
  173. package/dist/vite.d.ts +4 -4
  174. package/dist/vite.mjs +9 -9
  175. package/package.json +2 -2
  176. package/dist/analyzer-PPAHM4AW.cjs +0 -16
  177. package/dist/chunk-HHLEYA4B.cjs +0 -17
  178. package/dist/chunk-QYNZ3CTI.mjs +0 -17
@@ -1,7 +1,7 @@
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 _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } async function _asyncOptionalChain(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 = await fn(value); } else if (op === 'call' || op === 'optionalCall') { value = await fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
 
4
- var _chunkJSOCDYERcjs = require('./chunk-JSOCDYER.cjs');
4
+ var _chunkQ4HH5Q6Acjs = require('./chunk-Q4HH5Q6A.cjs');
5
5
 
6
6
 
7
7
  var _chunkAQLHD6HZcjs = require('./chunk-AQLHD6HZ.cjs');
@@ -42,7 +42,7 @@ var _chunkAXVRUDMBcjs = require('./chunk-AXVRUDMB.cjs');
42
42
  var _chunkUPOYKX4Scjs = require('./chunk-UPOYKX4S.cjs');
43
43
 
44
44
 
45
- var _chunkYTNBCXCWcjs = require('./chunk-YTNBCXCW.cjs');
45
+ var _chunkGQ6QOH7Tcjs = require('./chunk-GQ6QOH7T.cjs');
46
46
 
47
47
 
48
48
 
@@ -76,7 +76,7 @@ var _chunkXGJVRPYLcjs = require('./chunk-XGJVRPYL.cjs');
76
76
 
77
77
 
78
78
 
79
- var _chunkMZ4CRSY7cjs = require('./chunk-MZ4CRSY7.cjs');
79
+ var _chunkVO65MYJDcjs = require('./chunk-VO65MYJD.cjs');
80
80
 
81
81
 
82
82
  var _chunk7KJJ4SBScjs = require('./chunk-7KJJ4SBS.cjs');
@@ -278,7 +278,7 @@ var _chunkSUCDVKUBcjs = require('./chunk-SUCDVKUB.cjs');
278
278
  var _chunkEVIWKPJVcjs = require('./chunk-EVIWKPJV.cjs');
279
279
 
280
280
 
281
- var _chunkSQ6IWJ3Hcjs = require('./chunk-SQ6IWJ3H.cjs');
281
+ var _chunk22LGTSBAcjs = require('./chunk-22LGTSBA.cjs');
282
282
 
283
283
 
284
284
 
@@ -459,7 +459,7 @@ var RouteManager = class {
459
459
  this.redirects = /* @__PURE__ */ new Map();
460
460
  this.programmaticPages = /* @__PURE__ */ new Map();
461
461
  this.programmaticLayouts = /* @__PURE__ */ new Map();
462
- this.programmaticClientRoutes = _chunkMZ4CRSY7cjs.mergeProgrammaticClientRoutes.call(void 0, []);
462
+ this.programmaticClientRoutes = _chunkVO65MYJDcjs.mergeProgrammaticClientRoutes.call(void 0, []);
463
463
  this.reportedIslandsErrors = /* @__PURE__ */ new Set();
464
464
  this.config = config;
465
465
  this.viteServer = viteServer;
@@ -491,7 +491,7 @@ var RouteManager = class {
491
491
  await this.discoverFileRoutes(source);
492
492
  await this.discoverProgrammaticRoutes(source, programmaticClientRoutes);
493
493
  }
494
- this.programmaticClientRoutes = _chunkMZ4CRSY7cjs.mergeProgrammaticClientRoutes.call(void 0, programmaticClientRoutes);
494
+ this.programmaticClientRoutes = _chunkVO65MYJDcjs.mergeProgrammaticClientRoutes.call(void 0, programmaticClientRoutes);
495
495
  for (const slot of this.routeSlots.values()) {
496
496
  if (slot.interception && !this.pageRouteShapes.has(_chunkYTVSWXEZcjs.getRoutePatternShape.call(void 0, slot.pattern))) {
497
497
  throw new (0, _chunkYTVSWXEZcjs.AmbiguousRouteError)(
@@ -760,7 +760,7 @@ var RouteManager = class {
760
760
  return this.clientManifestCache.manifest;
761
761
  }
762
762
  const cacheFile = this.packageClientBoundaryCacheFile;
763
- return cacheFile ? _chunkMZ4CRSY7cjs.runWithPackageClientBoundaryCacheFile.call(void 0,
763
+ return cacheFile ? _chunkVO65MYJDcjs.runWithPackageClientBoundaryCacheFile.call(void 0,
764
764
  cacheFile,
765
765
  () => this.computeClientManifest(normalizedProjectRoot)
766
766
  ) : this.computeClientManifest(normalizedProjectRoot);
@@ -793,28 +793,28 @@ var RouteManager = class {
793
793
  `[Farm.js] isolated hydration kept route-wide because integration provider "${unsupportedIntegrationProvider.name}" does not declare supportsIsolatedHydration: true.`
794
794
  );
795
795
  }
796
- const isolatedMode = _chunkMZ4CRSY7cjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
796
+ const isolatedMode = _chunkVO65MYJDcjs.resolveFarmIsolatedClientHydrationMode.call(void 0,
797
797
  _optionalChain([this, 'access', _12 => _12.config, 'access', _13 => _13.experimental, 'optionalAccess', _14 => _14.isolatedClientHydration]),
798
798
  {
799
799
  serverComponents: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _15 => _15.config, 'access', _16 => _16.experimental, 'optionalAccess', _17 => _17.serverComponents])) === "rsc",
800
800
  hasUnsupportedIntegrationProvider: Boolean(unsupportedIntegrationProvider)
801
801
  }
802
802
  );
803
- const planOptions = _chunkMZ4CRSY7cjs.getFarmClientHydrationPlanOptions.call(void 0,
803
+ const planOptions = _chunkVO65MYJDcjs.getFarmClientHydrationPlanOptions.call(void 0,
804
804
  this.config.renderer,
805
805
  Boolean(unsupportedIntegrationProvider)
806
806
  );
807
807
  const islandsMode = _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _18 => _18.config, 'access', _19 => _19.experimental, 'optionalAccess', _20 => _20.serverComponents])) === "islands";
808
808
  const layoutEntries = Array.from(this.layouts.values()).map((entry) => ({
809
809
  entry,
810
- metadata: _chunkMZ4CRSY7cjs.getClientModuleHydrationPlan.call(void 0,
810
+ metadata: _chunkVO65MYJDcjs.getClientModuleHydrationPlan.call(void 0,
811
811
  entry.modulePath,
812
812
  normalizedProjectRoot,
813
813
  isolatedMode,
814
814
  islandsMode ? { ...planOptions, serverTreeLayouts: true } : planOptions
815
815
  )
816
816
  }));
817
- const markdownPagePlan = _chunkMZ4CRSY7cjs.createMarkdownPageHydrationPlanner.call(void 0,
817
+ const markdownPagePlan = _chunkVO65MYJDcjs.createMarkdownPageHydrationPlanner.call(void 0,
818
818
  _chunk2HW5LWAHcjs.resolveFarmMdxComponentsModulePath.call(void 0, _chunk2HW5LWAHcjs.resolveMdxConfig.call(void 0, this.config.mdx), normalizedProjectRoot),
819
819
  normalizedProjectRoot,
820
820
  isolatedMode,
@@ -822,7 +822,7 @@ var RouteManager = class {
822
822
  );
823
823
  const routeEntries = Array.from(this.routes.values()).map((entry) => ({
824
824
  entry,
825
- metadata: _chunk3EEINK7Gcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? markdownPagePlan() : _chunkMZ4CRSY7cjs.getClientModuleHydrationPlan.call(void 0, entry.modulePath, normalizedProjectRoot, isolatedMode, {
825
+ metadata: _chunk3EEINK7Gcjs.isFarmMarkdownPageFile.call(void 0, entry.modulePath) ? markdownPagePlan() : _chunkVO65MYJDcjs.getClientModuleHydrationPlan.call(void 0, entry.modulePath, normalizedProjectRoot, isolatedMode, {
826
826
  ...planOptions,
827
827
  serverOwners: _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([this, 'access', _21 => _21.config, 'access', _22 => _22.experimental, 'optionalAccess', _23 => _23.serverComponents])) === "islands"
828
828
  })
@@ -849,7 +849,7 @@ var RouteManager = class {
849
849
  `[Farm.js] ${entry.pattern} renders client components from ${metadata.staticPackageBoundaries.join(", ")} as static HTML: package client components cannot be isolated yet.`
850
850
  );
851
851
  }
852
- _chunkMZ4CRSY7cjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
852
+ _chunkVO65MYJDcjs.enforceFarmIsolatedHydrationRouteBudget.call(void 0,
853
853
  layoutEntries.map(({ entry, metadata }) => ({
854
854
  pattern: entry.pattern,
855
855
  depth: _chunkUPOYKX4Scjs.getRouteDirectoryDepth.call(void 0, entry.pattern),
@@ -896,7 +896,7 @@ var RouteManager = class {
896
896
  modulePath: toUrlPath(boundary.modulePath)
897
897
  }))
898
898
  } : {},
899
- ..._chunkMZ4CRSY7cjs.usesFarmServerTree.call(void 0, metadata) ? { serverTree: true } : {},
899
+ ..._chunkVO65MYJDcjs.usesFarmServerTree.call(void 0, metadata) ? { serverTree: true } : {},
900
900
  renderPlan: _chunkUPOYKX4Scjs.createFarmRouteRenderPlan.call(void 0, {
901
901
  pageShouldHydrate: metadata.shouldHydrate,
902
902
  layoutShouldHydrate,
@@ -938,7 +938,7 @@ var RouteManager = class {
938
938
  ...metadata.suppressedAsyncHydration && metadata.fallbackReason ? { suppressedAsyncHydrationReason: metadata.fallbackReason } : {}
939
939
  }));
940
940
  const slots = Array.from(this.routeSlots.values()).map((entry) => {
941
- const metadata = _chunkMZ4CRSY7cjs.getClientModuleMetadata.call(void 0, entry.modulePath, normalizedProjectRoot);
941
+ const metadata = _chunkVO65MYJDcjs.getClientModuleMetadata.call(void 0, entry.modulePath, normalizedProjectRoot);
942
942
  return {
943
943
  name: entry.name,
944
944
  ownerPattern: entry.ownerPattern,
@@ -954,7 +954,7 @@ var RouteManager = class {
954
954
  };
955
955
  });
956
956
  const slotPlans = islandsMode ? Array.from(this.routeSlots.values()).map((entry) => ({
957
- metadata: _chunkMZ4CRSY7cjs.getClientModuleHydrationPlan.call(void 0,
957
+ metadata: _chunkVO65MYJDcjs.getClientModuleHydrationPlan.call(void 0,
958
958
  entry.modulePath,
959
959
  normalizedProjectRoot,
960
960
  isolatedMode,
@@ -1300,11 +1300,11 @@ var RouteManager = class {
1300
1300
  srcDir: source.srcDir,
1301
1301
  loadModule: (filePath) => this.loadProgrammaticRoutesModule(filePath)
1302
1302
  });
1303
- const graph = this.viteServer ? _chunkMZ4CRSY7cjs.createEvaluatedRouteGraph.call(void 0, this.viteServer) : void 0;
1303
+ const graph = this.viteServer ? _chunkVO65MYJDcjs.createEvaluatedRouteGraph.call(void 0, this.viteServer) : void 0;
1304
1304
  for (const { filePath, manifest } of manifests) {
1305
1305
  if (graph) {
1306
1306
  clientRoutes.push(
1307
- _chunkMZ4CRSY7cjs.resolveProgrammaticClientRoutes.call(void 0, {
1307
+ _chunkVO65MYJDcjs.resolveProgrammaticClientRoutes.call(void 0, {
1308
1308
  graph,
1309
1309
  routesFile: toRealPath(filePath),
1310
1310
  routes: manifest.routes,
@@ -2857,7 +2857,7 @@ function inferFarmIslandStrategy(filePath, root) {
2857
2857
  const result = _compiler.inferStrategy.call(void 0, file, code, {
2858
2858
  parse: parseFarmIslandSource,
2859
2859
  resolve: (specifier, importer) => {
2860
- const resolved = _chunkMZ4CRSY7cjs.resolveImportedModule.call(void 0, importer, specifier, root);
2860
+ const resolved = _chunkVO65MYJDcjs.resolveImportedModule.call(void 0, importer, specifier, root);
2861
2861
  return resolved.local ? resolved.path : null;
2862
2862
  }
2863
2863
  });
@@ -2871,7 +2871,7 @@ function inferFarmRouteRootStrategy(owners, root) {
2871
2871
  const files = [];
2872
2872
  const modules = [];
2873
2873
  for (const owner of owners) {
2874
- const rendered = _chunkMZ4CRSY7cjs.collectFarmRenderedClientModules.call(void 0, owner, root);
2874
+ const rendered = _chunkVO65MYJDcjs.collectFarmRenderedClientModules.call(void 0, owner, root);
2875
2875
  if (!rendered) {
2876
2876
  return {
2877
2877
  strategy: null,
@@ -2887,7 +2887,7 @@ function inferFarmRouteRootStrategy(owners, root) {
2887
2887
  source = fs.default.readFileSync(module, "utf8");
2888
2888
  } catch (e10) {
2889
2889
  }
2890
- if (_chunkMZ4CRSY7cjs.getIslandStrategyExport.call(void 0, source) !== null) return { strategy: null, files, declared: true };
2890
+ if (_chunkVO65MYJDcjs.getIslandStrategyExport.call(void 0, source) !== null) return { strategy: null, files, declared: true };
2891
2891
  }
2892
2892
  for (const module of modules) {
2893
2893
  const result = inferFarmIslandStrategy(module, root);
@@ -3229,7 +3229,7 @@ function createDefaultErrorDiagnostics(error, root) {
3229
3229
  function canBootFarmIslandsClient(config) {
3230
3230
  const docs = config.docs;
3231
3231
  const docsEnabled = docs === true || typeof docs === "object" && docs !== null && docs.enabled !== false;
3232
- return _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _55 => _55.experimental, 'optionalAccess', _56 => _56.serverComponents])) === "islands" && !docsEnabled && _chunkJSOCDYERcjs.resolveFarmClientPlugins.call(void 0, config.plugins, config.root).length === 0 && !_chunkJSOCDYERcjs.resolveFarmAppClientEntry.call(void 0, config.root, config.srcDir || "src");
3232
+ return _chunkRE5E2G5Scjs.resolveFarmServerComponentsMode.call(void 0, _optionalChain([config, 'access', _55 => _55.experimental, 'optionalAccess', _56 => _56.serverComponents])) === "islands" && !docsEnabled && _chunkQ4HH5Q6Acjs.resolveFarmClientPlugins.call(void 0, config.plugins, config.root).length === 0 && !_chunkQ4HH5Q6Acjs.resolveFarmAppClientEntry.call(void 0, config.root, config.srcDir || "src");
3233
3233
  }
3234
3234
 
3235
3235
  // src/server/renderer.ts
@@ -3308,7 +3308,7 @@ var warnedSuppressedAsyncHydrationModules = /* @__PURE__ */ new Set();
3308
3308
  function warnSuppressedAsyncHydrationOnce(modulePath, reason) {
3309
3309
  if (warnedSuppressedAsyncHydrationModules.has(modulePath)) return;
3310
3310
  warnedSuppressedAsyncHydrationModules.add(modulePath);
3311
- _chunkQMNWKQL4cjs.logger.warn(_chunkMZ4CRSY7cjs.describeSuppressedAsyncHydration.call(void 0, modulePath, reason));
3311
+ _chunkQMNWKQL4cjs.logger.warn(_chunkVO65MYJDcjs.describeSuppressedAsyncHydration.call(void 0, modulePath, reason));
3312
3312
  }
3313
3313
  var fullDocumentRoutes = /* @__PURE__ */ new Set();
3314
3314
  var documentLayouts = /* @__PURE__ */ new WeakMap();
@@ -4370,7 +4370,7 @@ var ServerRenderer = class {
4370
4370
  const routeManifestEntry = routeManifest.routes.find(
4371
4371
  (entry) => entry.pattern === route.pattern
4372
4372
  );
4373
- const moduleMetadata = routeManifestEntry || _chunkMZ4CRSY7cjs.getClientModuleMetadata.call(void 0, route.modulePath, this.config.root);
4373
+ const moduleMetadata = routeManifestEntry || _chunkVO65MYJDcjs.getClientModuleMetadata.call(void 0, route.modulePath, this.config.root);
4374
4374
  const isClientComponent = moduleMetadata.isClientComponent;
4375
4375
  const renderedRouteSlots = await Promise.all(
4376
4376
  routeSlots.map(async (slot) => {
@@ -5173,7 +5173,7 @@ var ServerRenderer = class {
5173
5173
  if (this.routeManager.matchRoute(_chunkX3MHKLCOcjs.FARM_DEFAULT_MCP_PATH).route) return void 0;
5174
5174
  _nullishCoalesce(this.defaultMCPServer, () => ( (this.defaultMCPServer = _chunkX3MHKLCOcjs.createFarmDefaultMCPServer.call(void 0,
5175
5175
  readAppPackageIdentity(this.config.root),
5176
- _chunkSQ6IWJ3Hcjs.FARM_VERSION
5176
+ _chunk22LGTSBAcjs.FARM_VERSION
5177
5177
  ))));
5178
5178
  return _chunkX3MHKLCOcjs.resolveFarmDefaultMCPServer.call(void 0, this.defaultMCPServer);
5179
5179
  }
@@ -5258,7 +5258,7 @@ var ServerRenderer = class {
5258
5258
  pages,
5259
5259
  config,
5260
5260
  rootMetadata,
5261
- mcp: _optionalChain([this, 'access', _178 => _178.config, 'access', _179 => _179.agent, 'optionalAccess', _180 => _180.aiCatalog]) === false ? [] : _chunkYTNBCXCWcjs.listFarmMCPLlmsTxtLinks.call(void 0, origin, {
5261
+ mcp: _optionalChain([this, 'access', _178 => _178.config, 'access', _179 => _179.agent, 'optionalAccess', _180 => _180.aiCatalog]) === false ? [] : _chunkGQ6QOH7Tcjs.listFarmMCPLlmsTxtLinks.call(void 0, origin, {
5262
5262
  basePath: this.config.basePath,
5263
5263
  apiServerBasePath: _chunk2OF5RPVUcjs.resolveFarmAPIServerBasePath.call(void 0,
5264
5264
  _chunkPMJSG4JScjs.normalizeFarmAPIConfig.call(void 0,
@@ -6305,7 +6305,7 @@ window.__FARM_I18N__ = ${_chunkRVGLYMJMcjs.getFarmI18nClientSnapshot.call(void 0
6305
6305
  stack: _optionalChain([diagnostics, 'optionalAccess', _235 => _235.stack]),
6306
6306
  sourceFrame: _optionalChain([diagnostics, 'optionalAccess', _236 => _236.sourceFrame]),
6307
6307
  development: isDev,
6308
- farmVersion: _chunkSQ6IWJ3Hcjs.FARM_VERSION,
6308
+ farmVersion: _chunk22LGTSBAcjs.FARM_VERSION,
6309
6309
  nodeVersion: process.version,
6310
6310
  mode: isDev ? "development" : "production"
6311
6311
  })
@@ -1,8 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } async function _asyncOptionalChain(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 = await fn(value); } else if (op === 'call' || op === 'optionalCall') { value = await fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkHHLEYA4Bcjs = require('./chunk-HHLEYA4B.cjs');
4
-
5
-
6
3
 
7
4
 
8
5
 
@@ -13,7 +10,7 @@ var _chunkFJMC24KGcjs = require('./chunk-FJMC24KG.cjs');
13
10
  var _chunkXVSBALOYcjs = require('./chunk-XVSBALOY.cjs');
14
11
 
15
12
 
16
- var _chunk7LK5CTUMcjs = require('./chunk-7LK5CTUM.cjs');
13
+ var _chunk6GQJVY4Ecjs = require('./chunk-6GQJVY4E.cjs');
17
14
 
18
15
 
19
16
 
@@ -21,7 +18,8 @@ var _chunk65Y5SIBHcjs = require('./chunk-65Y5SIBH.cjs');
21
18
 
22
19
 
23
20
 
24
- var _chunkJSOCDYERcjs = require('./chunk-JSOCDYER.cjs');
21
+
22
+ var _chunkQ4HH5Q6Acjs = require('./chunk-Q4HH5Q6A.cjs');
25
23
 
26
24
 
27
25
  var _chunkAQLHD6HZcjs = require('./chunk-AQLHD6HZ.cjs');
@@ -39,6 +37,7 @@ var FARM_RSC_CONFIG_KEYS = [
39
37
  "srcDir",
40
38
  "extends",
41
39
  "basePath",
40
+ "trailingSlash",
42
41
  "api",
43
42
  "server",
44
43
  "middleware",
@@ -117,10 +116,10 @@ async function createFarmRscViteConfig(userConfig, options) {
117
116
  if (config[key] !== void 0) rscConfig[key] = config[key];
118
117
  }
119
118
  const createReactPlugin = hasPluginNamed(vitePlugins, "vite:react") ? void 0 : await _asyncNullishCoalesce(await _asyncOptionalChain([viteReact, 'optionalAccess', async _4 => _4.default]), async () => ( (options.command === "serve" ? (await _chunk65Y5SIBHcjs.loadFarmReactPlugin.call(void 0, )).default : void 0)));
120
- const tailwind = hasPluginNamed(vitePlugins, "@tailwindcss/vite") ? void 0 : await _chunkJSOCDYERcjs.loadTailwindVitePlugin.call(void 0, );
119
+ const tailwind = hasPluginNamed(vitePlugins, "@tailwindcss/vite") ? void 0 : await _chunkQ4HH5Q6Acjs.loadTailwindVitePlugin.call(void 0, );
121
120
  const platform = _chunkAQLHD6HZcjs.resolveFarmPlatform.call(void 0, );
122
121
  const mobileClient = config.mobile === void 0 || platform === "desktop" ? void 0 : options.command === "build" ? "entry" : platform === "mobile" ? "inline" : void 0;
123
- const clientPluginEntry = _chunkJSOCDYERcjs.generateFarmClientPluginEntryCode.call(void 0,
122
+ const clientPluginEntry = _chunkQ4HH5Q6Acjs.generateFarmClientPluginEntryCode.call(void 0,
124
123
  config.plugins,
125
124
  root,
126
125
  typeof config.srcDir === "string" ? config.srcDir : "src",
@@ -157,7 +156,7 @@ async function createFarmRscViteConfig(userConfig, options) {
157
156
  server: { environmentName: "rsc" },
158
157
  config: {
159
158
  preset: options.preset,
160
- outputDir: options.outputDir && _chunk7LK5CTUMcjs.resolveDeployOutputPath.call(void 0, root, options.outputDir)
159
+ outputDir: options.outputDir && _chunk6GQJVY4Ecjs.resolveDeployOutputPath.call(void 0, root, options.outputDir)
161
160
  }
162
161
  })
163
162
  ]
@@ -177,12 +176,12 @@ async function createFarmRscViteConfig(userConfig, options) {
177
176
  async function resolveFarmRscServerPlugins(userConfig, config, root) {
178
177
  const kept = _nullishCoalesce(config.plugins, () => ( []));
179
178
  const names = new Set(
180
- kept.filter((plugin) => _chunkHHLEYA4Bcjs.hasFarmServerRuntimePlugins.call(void 0, [plugin])).map((plugin) => plugin.name)
179
+ kept.filter((plugin) => _chunkQ4HH5Q6Acjs.hasFarmServerRuntimePlugins.call(void 0, [plugin])).map((plugin) => plugin.name)
181
180
  );
182
181
  if (names.size === 0) return void 0;
183
182
  const loads = (plugin) => {
184
183
  const candidate = plugin;
185
- return !!candidate && names.has(candidate.name) && _chunkHHLEYA4Bcjs.hasFarmServerRuntimePlugins.call(void 0, [candidate]);
184
+ return !!candidate && names.has(candidate.name) && _chunkQ4HH5Q6Acjs.hasFarmServerRuntimePlugins.call(void 0, [candidate]);
186
185
  };
187
186
  const { findFarmConfigFile, loadFarmConfigFile, resolveFarmLayers } = await import("./layers-7P4RLKVX.cjs");
188
187
  const files = [];
@@ -211,7 +210,7 @@ async function resolveFarmRscServerPlugins(userConfig, config, root) {
211
210
  }
212
211
  async function configureFarmRscPlugins(config, command) {
213
212
  if (config.plugins.length === 0) return config;
214
- const { PluginManager } = await import("./plugin-WIU4GDD4.cjs");
213
+ const { PluginManager } = await import("./plugin-F2O4BFTK.cjs");
215
214
  const manager = new PluginManager({
216
215
  config,
217
216
  isDev: command === "serve",
@@ -4,7 +4,7 @@
4
4
  var _chunkX3MHKLCOcjs = require('./chunk-X3MHKLCO.cjs');
5
5
 
6
6
 
7
- var _chunkIGDYL2IAcjs = require('./chunk-IGDYL2IA.cjs');
7
+ var _chunkGUMKIQJLcjs = require('./chunk-GUMKIQJL.cjs');
8
8
 
9
9
 
10
10
  var _chunkBTVDYS4Bcjs = require('./chunk-BTVDYS4B.cjs');
@@ -29,7 +29,7 @@ var _chunk2OF5RPVUcjs = require('./chunk-2OF5RPVU.cjs');
29
29
  var _chunkCFG4QERRcjs = require('./chunk-CFG4QERR.cjs');
30
30
 
31
31
 
32
- var _chunkSQ6IWJ3Hcjs = require('./chunk-SQ6IWJ3H.cjs');
32
+ var _chunk22LGTSBAcjs = require('./chunk-22LGTSBA.cjs');
33
33
 
34
34
 
35
35
  var _chunkD22BUQKWcjs = require('./chunk-D22BUQKW.cjs');
@@ -288,7 +288,7 @@ function createFarmAppManifest(input) {
288
288
  return {
289
289
  schemaVersion: 1,
290
290
  app: app ? {
291
- ...app.version ? { farm: _chunkSQ6IWJ3Hcjs.FARM_VERSION } : {},
291
+ ...app.version ? { farm: _chunk22LGTSBAcjs.FARM_VERSION } : {},
292
292
  ...app.renderer ? { renderer: input.renderer } : {},
293
293
  basePath: input.basePath,
294
294
  ...app.build ? { build: input.build } : {}
@@ -319,7 +319,7 @@ function resolveFarmSiteUrl() {
319
319
  asUrl(read("RAILWAY_PUBLIC_DOMAIN"))
320
320
  ];
321
321
  for (const candidate of candidates) {
322
- const origin = candidate ? _chunkIGDYL2IAcjs.normalizeFarmProductionSiteOrigin.call(void 0, candidate) : void 0;
322
+ const origin = candidate ? _chunkGUMKIQJLcjs.normalizeFarmProductionSiteOrigin.call(void 0, candidate) : void 0;
323
323
  if (origin) return origin;
324
324
  }
325
325
  return null;
@@ -462,6 +462,7 @@ function resolveFarmMCPRouteLabel(routePathname, apiServerBasePath) {
462
462
  }
463
463
  return null;
464
464
  }
465
+ var PUBLISHED_PAGE_PATH = /^\/[a-zA-Z0-9_./-]{0,250}$/;
465
466
  function resolveFarmDocsRouteLabel(routePathname, docs) {
466
467
  const pathname = normalize(routePathname);
467
468
  const apiPath = normalize(_nullishCoalesce(docs.apiPath, () => ( "/api/docs")));
@@ -475,7 +476,10 @@ function resolveFarmDocsRouteLabel(routePathname, docs) {
475
476
  if (page === entry || entry === "/" && page === "/index") {
476
477
  return markdown ? _chunkFT6KJHS3cjs.getFarmMarkdownMirrorPath.call(void 0, entry) : entry;
477
478
  }
478
- if (page.startsWith(`${base}/`)) return `${base}/[...slug]${markdown ? ".md" : ""}`;
479
+ if (page.startsWith(`${base}/`)) {
480
+ const label = _optionalChain([docs, 'access', _55 => _55.pages, 'optionalAccess', _56 => _56.has, 'call', _57 => _57(page)]) && PUBLISHED_PAGE_PATH.test(page) ? page : `${base}/[...slug]`;
481
+ return `${label}${markdown ? ".md" : ""}`;
482
+ }
479
483
  }
480
484
  return null;
481
485
  }
@@ -42,6 +42,10 @@ var _chunkJYNNIGQOcjs = require('./chunk-JYNNIGQO.cjs');
42
42
 
43
43
 
44
44
 
45
+ var _chunkLNVGXUL3cjs = require('./chunk-LNVGXUL3.cjs');
46
+
47
+
48
+
45
49
  var _chunkQMNWKQL4cjs = require('./chunk-QMNWKQL4.cjs');
46
50
 
47
51
 
@@ -50,6 +54,10 @@ var _chunkQMNWKQL4cjs = require('./chunk-QMNWKQL4.cjs');
50
54
  var _chunkCFG4QERRcjs = require('./chunk-CFG4QERR.cjs');
51
55
 
52
56
 
57
+
58
+ var _chunkVOQ7XZZTcjs = require('./chunk-VOQ7XZZT.cjs');
59
+
60
+
53
61
  var _chunkHDPT6OYEcjs = require('./chunk-HDPT6OYE.cjs');
54
62
 
55
63
 
@@ -59,6 +67,30 @@ var _chunkYTVSWXEZcjs = require('./chunk-YTVSWXEZ.cjs');
59
67
 
60
68
  // src/api/vite-plugin.ts
61
69
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
70
+ function createDevI18n(server) {
71
+ const farmConfig = server.config;
72
+ if (!farmConfig.i18n) return void 0;
73
+ return loadDevI18n(
74
+ server,
75
+ _chunkLNVGXUL3cjs.resolveFarmI18nConfig.call(void 0, farmConfig.i18n, {
76
+ root: server.config.root,
77
+ mode: "development",
78
+ basePath: _nullishCoalesce(farmConfig.basePath, () => ( "/"))
79
+ })
80
+ );
81
+ }
82
+ async function loadDevI18n(server, config) {
83
+ const { _runWithFarmI18nRequest, createFarmI18nRuntime } = await import("./i18n/server.cjs");
84
+ const runtime = createFarmI18nRuntime(config);
85
+ await runtime.initialize();
86
+ _optionalChain([server, 'access', _ => _.watcher, 'optionalAccess', _2 => _2.on, 'optionalCall', _3 => _3("change", (file) => {
87
+ if (!_chunkLNVGXUL3cjs.isFarmI18nCatalogFile.call(void 0, config, file)) return;
88
+ runtime.reload().catch((error) => {
89
+ console.error("[FARM] Could not reload the i18n catalogs:", error);
90
+ });
91
+ })]);
92
+ return { runtime, run: _runWithFarmI18nRequest };
93
+ }
62
94
  function farmApiPlugin(options = {}) {
63
95
  const srcDir = _nullishCoalesce(options.srcDir, () => ( "src"));
64
96
  const apiDirFromRoot = _nullishCoalesce(options.apiDir, () => ( _path2.default.join(srcDir, "api")));
@@ -114,7 +146,7 @@ function farmApiPlugin(options = {}) {
114
146
  registerRouteShape(routePath, filePath);
115
147
  const normalizedMethod = method.toUpperCase();
116
148
  const existing = apiRoutesCache.get(routePath);
117
- const existingFile = _optionalChain([endpointSources, 'access', _ => _.get, 'call', _2 => _2(routePath), 'optionalAccess', _3 => _3.get, 'call', _4 => _4(normalizedMethod)]);
149
+ const existingFile = _optionalChain([endpointSources, 'access', _4 => _4.get, 'call', _5 => _5(routePath), 'optionalAccess', _6 => _6.get, 'call', _7 => _7(normalizedMethod)]);
118
150
  if (existingFile) {
119
151
  throw new (0, _chunkOFBLGH6Vcjs.APIRouteConflictError)(routePath, normalizedMethod, existingFile, filePath);
120
152
  }
@@ -395,6 +427,43 @@ function farmApiPlugin(options = {}) {
395
427
  isReady: () => discoveryComplete,
396
428
  waitForDiscovery
397
429
  };
430
+ const devI18n = createDevI18n(server);
431
+ _optionalChain([devI18n, 'optionalAccess', _8 => _8.catch, 'call', _9 => _9(() => {
432
+ })]);
433
+ const runWithDevI18n = async (req, res, handle) => {
434
+ const i18n = await devI18n;
435
+ const pathname = (req.url || "/").split("?")[0];
436
+ if (!_chunkXGTFLG73cjs.isFarmAPIPathname.call(void 0, pathname, basePath) && !_chunkXGTFLG73cjs.matchAPIRouteAtBasePath.call(void 0, servedRoutes(), pathname, basePath)) {
437
+ return handle();
438
+ }
439
+ const headers = new Headers();
440
+ for (const [key, value] of Object.entries(req.headers)) {
441
+ if (value) headers.set(key, Array.isArray(value) ? value.join(", ") : value);
442
+ }
443
+ const request = new Request(_chunkHDPT6OYEcjs.resolveFarmRequestURL.call(void 0, req), { headers });
444
+ return i18n.run(
445
+ i18n.runtime,
446
+ request,
447
+ (resolution) => {
448
+ const config = i18n.runtime.config;
449
+ const vary = _chunkVOQ7XZZTcjs.getFarmLocaleVaryHeaders.call(void 0, config, resolution);
450
+ if (vary.length > 0) {
451
+ const current = String(_nullishCoalesce(res.getHeader("Vary"), () => ( "")));
452
+ res.setHeader("Vary", [current, ...vary].filter(Boolean).join(", "));
453
+ }
454
+ if (resolution.persist) {
455
+ const cookies = res.getHeader("Set-Cookie");
456
+ const cookie = _chunkVOQ7XZZTcjs.createFarmLocaleCookie.call(void 0, resolution.locale, config);
457
+ res.setHeader(
458
+ "Set-Cookie",
459
+ cookies === void 0 ? cookie : [...[cookies].flat().map(String), cookie]
460
+ );
461
+ }
462
+ return handle();
463
+ },
464
+ { redirect: false }
465
+ );
466
+ };
398
467
  return () => {
399
468
  const apiMiddleware = _chunkP2355C6Ecjs._withAfterNodeMiddleware.call(void 0, async (req, res, next) => {
400
469
  const url = req.url || "/";
@@ -407,7 +476,7 @@ function farmApiPlugin(options = {}) {
407
476
  if (!farmMiddleware || !apiRouterHandler || !_chunkXGTFLG73cjs.isFarmAPIPathname.call(void 0, pathname, basePath)) {
408
477
  return next();
409
478
  }
410
- await _optionalChain([farmMiddleware, 'access', _5 => _5.waitForDiscovery, 'optionalCall', _6 => _6()]);
479
+ await _optionalChain([farmMiddleware, 'access', _10 => _10.waitForDiscovery, 'optionalCall', _11 => _11()]);
411
480
  if (await farmMiddleware.execute(req, res, pathname, /* @__PURE__ */ new Map())) return;
412
481
  middlewareRan = true;
413
482
  const rewrittenPathname = (req.url || url).split("?")[0];
@@ -421,7 +490,7 @@ function farmApiPlugin(options = {}) {
421
490
  const startTime = Date.now();
422
491
  try {
423
492
  if (farmMiddleware && !middlewareRan) {
424
- await _optionalChain([farmMiddleware, 'access', _7 => _7.waitForDiscovery, 'optionalCall', _8 => _8()]);
493
+ await _optionalChain([farmMiddleware, 'access', _12 => _12.waitForDiscovery, 'optionalCall', _13 => _13()]);
425
494
  const middlewareData = /* @__PURE__ */ new Map();
426
495
  const handled = await farmMiddleware.execute(req, res, pathname, middlewareData);
427
496
  if (handled) {
@@ -473,13 +542,14 @@ function farmApiPlugin(options = {}) {
473
542
  }
474
543
  });
475
544
  server.middlewares.use((req, res, next) => {
476
- const result = _chunkKBGZ5FD6cjs._runWithAPIRequestRuntime.call(void 0,
545
+ const handle = () => _chunkKBGZ5FD6cjs._runWithAPIRequestRuntime.call(void 0,
477
546
  {
478
547
  basePath: _nullishCoalesce(basePath, () => ( "/api")),
479
548
  dispatch: async (request) => apiRouterHandler ? apiRouterHandler(request) : Response.json({ error: "Not Found" }, { status: 404 })
480
549
  },
481
550
  () => apiMiddleware(req, res, next)
482
551
  );
552
+ const result = devI18n ? runWithDevI18n(req, res, handle) : handle();
483
553
  return Promise.resolve(result).catch((error) => {
484
554
  console.error(
485
555
  `[FARM] Unhandled API error while handling ${req.method || "GET"} ${req.url || "/"}:`,
@@ -487,7 +557,7 @@ function farmApiPlugin(options = {}) {
487
557
  );
488
558
  if (res.writableEnded) return;
489
559
  if (res.headersSent) {
490
- _optionalChain([res, 'access', _9 => _9.destroy, 'optionalCall', _10 => _10(error instanceof Error ? error : new Error(String(error)))]);
560
+ _optionalChain([res, 'access', _14 => _14.destroy, 'optionalCall', _15 => _15(error instanceof Error ? error : new Error(String(error)))]);
491
561
  return;
492
562
  }
493
563
  res.statusCode = 500;
@@ -505,7 +575,7 @@ function farmApiPlugin(options = {}) {
505
575
  for (const mod of modules) {
506
576
  server.moduleGraph.invalidateModule(mod);
507
577
  }
508
- if (await _optionalChain([recoverFailedDiscovery, 'optionalCall', _11 => _11()])) return [];
578
+ if (await _optionalChain([recoverFailedDiscovery, 'optionalCall', _16 => _16()])) return [];
509
579
  const previousState = snapshotRouteState();
510
580
  try {
511
581
  const routesModule = await _chunkJYNNIGQOcjs.loadFarmDevModule.call(void 0, server, file);
@@ -547,7 +617,7 @@ function farmApiPlugin(options = {}) {
547
617
  for (const mod of modules) {
548
618
  server.moduleGraph.invalidateModule(mod);
549
619
  }
550
- if (await _optionalChain([recoverFailedDiscovery, 'optionalCall', _12 => _12()])) return [];
620
+ if (await _optionalChain([recoverFailedDiscovery, 'optionalCall', _17 => _17()])) return [];
551
621
  const previousState = snapshotRouteState();
552
622
  try {
553
623
  const path = await import("path");
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkSQ6IWJ3Hcjs = require('./chunk-SQ6IWJ3H.cjs');
3
+ var _chunk22LGTSBAcjs = require('./chunk-22LGTSBA.cjs');
4
4
 
5
5
  // src/deployment-environment.ts
6
6
  function isFarmProductionDeploymentEnvironment(env = process.env) {
@@ -90,7 +90,7 @@ function createFarmProductionSiteReporter(options) {
90
90
  schemaVersion: FARM_PRODUCTION_SITE_TELEMETRY_SCHEMA_VERSION,
91
91
  eventType: FARM_PRODUCTION_SITE_ATTESTATION_EVENT_TYPE,
92
92
  packageName: FARM_PRODUCTION_SITE_TELEMETRY_PACKAGE_NAME,
93
- packageVersion: sanitizeDetail(_chunkSQ6IWJ3Hcjs.FARM_VERSION, "unknown"),
93
+ packageVersion: sanitizeDetail(_chunk22LGTSBAcjs.FARM_VERSION, "unknown"),
94
94
  renderer: sanitizeDetail(options.renderer, "custom"),
95
95
  deployTarget: sanitizeDetail(options.deployTarget, "custom")
96
96
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  resolveFarmAppClientEntry,
3
3
  resolveFarmClientPlugins
4
- } from "./chunk-DXZ57EPE.mjs";
4
+ } from "./chunk-YOHHL2UE.mjs";
5
5
  import {
6
6
  resolveFarmPlatform
7
7
  } from "./chunk-SMUW7UST.mjs";
@@ -42,7 +42,7 @@ import {
42
42
  } from "./chunk-ZPKJPM7K.mjs";
43
43
  import {
44
44
  listFarmMCPLlmsTxtLinks
45
- } from "./chunk-VFNAK6A5.mjs";
45
+ } from "./chunk-ZR2QB45W.mjs";
46
46
  import {
47
47
  FARM_DEFAULT_MCP_PATH,
48
48
  collectFarmDefaultMCPPages,
@@ -76,7 +76,7 @@ import {
76
76
  resolveProgrammaticClientRoutes,
77
77
  runWithPackageClientBoundaryCacheFile,
78
78
  usesFarmServerTree
79
- } from "./chunk-WPB67LE5.mjs";
79
+ } from "./chunk-ULMXZYOA.mjs";
80
80
  import {
81
81
  FARM_ISLAND_REPLAYABLE_SELECTOR
82
82
  } from "./chunk-S32PDOLO.mjs";
@@ -278,7 +278,7 @@ import {
278
278
  } from "./chunk-2DA7CLY7.mjs";
279
279
  import {
280
280
  FARM_VERSION
281
- } from "./chunk-F6CMGWAL.mjs";
281
+ } from "./chunk-ANMIR6US.mjs";
282
282
  import {
283
283
  resolveFarmTrailingSlashRedirect,
284
284
  setFarmTrailingSlashPreference
@@ -809,6 +809,21 @@ var PluginManager = class {
809
809
  session.waitUntil
810
810
  );
811
811
  }
812
+ /**
813
+ * @internal Reports an error the handler answered to `runtime.error` and `onError`, as the
814
+ * runtime scope's `reportError` does, without failing the session: `after` still runs, and a
815
+ * later throw in it is reported too.
816
+ */
817
+ async reportRuntimeRequestError(session, error) {
818
+ await this.runRuntimeErrorHooks(
819
+ session.request,
820
+ error,
821
+ session.ctx,
822
+ Date.now() - session.startedAt,
823
+ session.options,
824
+ session.waitUntil
825
+ );
826
+ }
812
827
  async runRuntimeRequest(request, handler, options = {}) {
813
828
  return this.completeRuntimeRequest(await this.beginRuntimeRequest(request, options), handler);
814
829
  }
@@ -822,14 +837,7 @@ var PluginManager = class {
822
837
  const response = await _asyncNullishCoalesce(session.response, async () => ( await handler(session.request, {
823
838
  // Not a failed session: the handler answers, so `after` runs and a later throw in it
824
839
  // is still reported.
825
- reportError: (error) => this.runRuntimeErrorHooks(
826
- session.request,
827
- error,
828
- session.ctx,
829
- Date.now() - session.startedAt,
830
- session.options,
831
- session.waitUntil
832
- )
840
+ reportError: (error) => this.reportRuntimeRequestError(session, error)
833
841
  })));
834
842
  if (!(response instanceof Response)) {
835
843
  throw new TypeError("Farm plugin runtime handlers must return a Response");
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
3
 
4
- var _chunk5JKDFRTKcjs = require('./chunk-5JKDFRTK.cjs');
4
+ var _chunkABIBASLJcjs = require('./chunk-ABIBASLJ.cjs');
5
5
 
6
6
 
7
7
  var _chunkPIUTGRDIcjs = require('./chunk-PIUTGRDI.cjs');
@@ -64,7 +64,7 @@ function findFarmNativeScreenFiles(appDirs) {
64
64
  }
65
65
  function collectFarmNativeServerFns(options) {
66
66
  const { root, srcDir } = options;
67
- const aliases = _chunk5JKDFRTKcjs.readAliases.call(void 0, root, srcDir);
67
+ const aliases = _chunkABIBASLJcjs.readAliases.call(void 0, root, srcDir);
68
68
  const seen = /* @__PURE__ */ new Set();
69
69
  const found = /* @__PURE__ */ new Map();
70
70
  const queue = [...options.entries];
@@ -98,7 +98,7 @@ function collectFarmNativeServerFns(options) {
98
98
  }
99
99
  }
100
100
  for (const candidate of _nullishCoalesce(candidates, () => ( []))) {
101
- const resolved = _chunk5JKDFRTKcjs.resolveFile.call(void 0, candidate);
101
+ const resolved = _chunkABIBASLJcjs.resolveFile.call(void 0, candidate);
102
102
  if (resolved && SCRIPT.test(resolved) && !resolved.includes(`${_path2.default.sep}node_modules${_path2.default.sep}`)) {
103
103
  queue.push(resolved);
104
104
  break;