@farm.js/core 0.1.43 → 0.1.44

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 (139) hide show
  1. package/dist/{agent-mcp-3KDz4hr9.d.mts → agent-mcp-CWI-awqd.d.mts} +1 -1
  2. package/dist/{agent-mcp-6yRebHk7.d.ts → agent-mcp-EnzWYv_X.d.ts} +1 -1
  3. package/dist/agent-runtime.cjs +3 -2
  4. package/dist/agent-runtime.d.mts +1 -1
  5. package/dist/agent-runtime.d.ts +1 -1
  6. package/dist/agent-runtime.mjs +2 -1
  7. package/dist/api/route-manager.d.mts +3 -3
  8. package/dist/api/route-manager.d.ts +3 -3
  9. package/dist/api/runtime.d.mts +2 -2
  10. package/dist/api/runtime.d.ts +2 -2
  11. package/dist/api.d.mts +3 -3
  12. package/dist/api.d.ts +3 -3
  13. package/dist/{app-8Db1zR-2.d.ts → app-CAN_2Cqo.d.ts} +4 -4
  14. package/dist/{app-DlTWv4cn.d.mts → app-DG3dE8v5.d.mts} +4 -4
  15. package/dist/{app-manifest-TRzS7ZZ9.d.mts → app-manifest-8x5VjZ0L.d.mts} +1 -1
  16. package/dist/{app-manifest-cO2jkG1F.d.ts → app-manifest-DazjgQya.d.ts} +1 -1
  17. package/dist/app-markdown.d.mts +2 -2
  18. package/dist/app-markdown.d.ts +2 -2
  19. package/dist/{chunk-OYSGGV6O.mjs → chunk-2MKTHHEU.mjs} +5 -5
  20. package/dist/{chunk-AX7S67YV.mjs → chunk-37VKVISD.mjs} +9 -173
  21. package/dist/chunk-3SAWHWDH.cjs +186 -0
  22. package/dist/{chunk-YBDSTNMH.cjs → chunk-3YJMBQ27.cjs} +1 -1
  23. package/dist/{chunk-JDJAPCR2.cjs → chunk-5GBL2LKD.cjs} +92 -90
  24. package/dist/{chunk-VIVQERJ5.cjs → chunk-AI3WVJNP.cjs} +57 -57
  25. package/dist/{chunk-RHGK2JEN.cjs → chunk-B6XAA7V6.cjs} +18 -182
  26. package/dist/{chunk-RQYTOFQM.cjs → chunk-CW6SNEN2.cjs} +2 -2
  27. package/dist/{chunk-T7J7E63D.cjs → chunk-E22SWCXB.cjs} +2 -2
  28. package/dist/{chunk-4OCEMK72.mjs → chunk-ERA5RP3L.mjs} +10 -8
  29. package/dist/{chunk-RACQTC7K.cjs → chunk-GA6JM4L6.cjs} +52 -52
  30. package/dist/chunk-GZWHCWLB.mjs +186 -0
  31. package/dist/{chunk-XARSG2TG.mjs → chunk-IOMVXBLZ.mjs} +1 -1
  32. package/dist/{chunk-VLXNGUKO.mjs → chunk-JVXW76I7.mjs} +1 -1
  33. package/dist/{chunk-LVABUXLA.cjs → chunk-LPE3ED4R.cjs} +2 -2
  34. package/dist/{chunk-NXO75WY4.mjs → chunk-OYZGFRPA.mjs} +1 -1
  35. package/dist/{chunk-7SCCY6SI.mjs → chunk-QGFKXYC7.mjs} +3 -3
  36. package/dist/{chunk-YGZH4T2X.mjs → chunk-R4J2UOV4.mjs} +1 -1
  37. package/dist/{chunk-BKPXWRTT.cjs → chunk-T44ECMEP.cjs} +6 -6
  38. package/dist/{chunk-4MRQ5OKQ.mjs → chunk-WWYXIECF.mjs} +1 -1
  39. package/dist/{chunk-GVNCWSQV.cjs → chunk-XPSGGECF.cjs} +4 -4
  40. package/dist/{chunk-ZYWJIPKQ.mjs → chunk-XUHIRBXY.mjs} +1 -1
  41. package/dist/{chunk-TESO7EFU.mjs → chunk-YFLBG2W3.mjs} +2 -2
  42. package/dist/{chunk-HUMEHX24.cjs → chunk-YN2QEMMO.cjs} +2 -2
  43. package/dist/{client-plugins-kwQuZcWq.d.ts → client-plugins-BGS0wqzc.d.ts} +16 -15
  44. package/dist/{client-plugins-Cv0OJtnM.d.mts → client-plugins-nQ0tYt4l.d.mts} +16 -15
  45. package/dist/client-plugins.d.mts +1 -1
  46. package/dist/client-plugins.d.ts +1 -1
  47. package/dist/client.d.mts +5 -5
  48. package/dist/client.d.ts +5 -5
  49. package/dist/config.d.mts +1 -1
  50. package/dist/config.d.ts +1 -1
  51. package/dist/{devtools-MLB3JJMC.cjs → devtools-5Q7VRKVH.cjs} +4 -3
  52. package/dist/{devtools-M22FEFPK.mjs → devtools-LJ4IGYGW.mjs} +3 -2
  53. package/dist/docs.cjs +5 -4
  54. package/dist/docs.d.mts +2 -2
  55. package/dist/docs.d.ts +2 -2
  56. package/dist/docs.mjs +4 -3
  57. package/dist/{index-DAl0QTZS.d.ts → index-Cy26isrh.d.ts} +1 -1
  58. package/dist/{index-CQOp8EmB.d.mts → index-y1jgR74U.d.mts} +1 -1
  59. package/dist/index.cjs +13 -11
  60. package/dist/index.d.mts +15 -15
  61. package/dist/index.d.ts +15 -15
  62. package/dist/index.mjs +14 -12
  63. package/dist/integrations.cjs +5 -3
  64. package/dist/integrations.d.mts +1 -1
  65. package/dist/integrations.d.ts +1 -1
  66. package/dist/integrations.mjs +6 -4
  67. package/dist/internal/app-markdown-runtime.d.mts +2 -2
  68. package/dist/internal/app-markdown-runtime.d.ts +2 -2
  69. package/dist/internal/build-runtime.cjs +11 -10
  70. package/dist/internal/build-runtime.d.mts +3 -3
  71. package/dist/internal/build-runtime.d.ts +3 -3
  72. package/dist/internal/build-runtime.mjs +10 -9
  73. package/dist/internal/cli-runtime.cjs +5 -4
  74. package/dist/internal/cli-runtime.mjs +4 -3
  75. package/dist/internal/client-error-overlay.cjs +4 -4
  76. package/dist/internal/client-error-overlay.mjs +1 -1
  77. package/dist/internal/compression-runtime.d.mts +1 -1
  78. package/dist/internal/compression-runtime.d.ts +1 -1
  79. package/dist/internal/config-runtime.cjs +4 -3
  80. package/dist/internal/config-runtime.d.mts +2 -2
  81. package/dist/internal/config-runtime.d.ts +2 -2
  82. package/dist/internal/config-runtime.mjs +3 -2
  83. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  84. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  85. package/dist/internal/production-runtime.cjs +5 -11
  86. package/dist/internal/production-runtime.d.mts +10 -10
  87. package/dist/internal/production-runtime.d.ts +10 -10
  88. package/dist/internal/production-runtime.mjs +4 -10
  89. package/dist/markdown.d.mts +1 -1
  90. package/dist/markdown.d.ts +1 -1
  91. package/dist/middleware.d.mts +3 -3
  92. package/dist/middleware.d.ts +3 -3
  93. package/dist/navigation.d.mts +4 -4
  94. package/dist/navigation.d.ts +4 -4
  95. package/dist/plugin.cjs +7 -6
  96. package/dist/plugin.d.mts +3 -3
  97. package/dist/plugin.d.ts +3 -3
  98. package/dist/plugin.mjs +6 -5
  99. package/dist/{production-runtime-5nArjFpn.d.ts → production-runtime-BVMDgHrA.d.ts} +1 -1
  100. package/dist/{production-runtime-BzsF2z5F.d.mts → production-runtime-ClFA_1KQ.d.mts} +1 -1
  101. package/dist/{render-plan-B9yQorV4.d.mts → render-plan-CoSovy_O.d.mts} +1 -1
  102. package/dist/{render-plan-fg6E_HvL.d.ts → render-plan-y2DefWf8.d.ts} +1 -1
  103. package/dist/renderer-client.d.mts +3 -3
  104. package/dist/renderer-client.d.ts +3 -3
  105. package/dist/{request-gz8vFK0n.d.ts → request-aG5Wovm5.d.ts} +1 -1
  106. package/dist/{request-C4j_g-BH.d.mts → request-cNM09Q7e.d.mts} +1 -1
  107. package/dist/request.d.mts +2 -2
  108. package/dist/request.d.ts +2 -2
  109. package/dist/{route-rendering-DamyKVi3.d.ts → route-rendering-B3uQmCWX.d.ts} +1 -1
  110. package/dist/{route-rendering-iTTOwz1f.d.mts → route-rendering-EyInfsjI.d.mts} +1 -1
  111. package/dist/{router-OVjDqVo8.d.ts → router-DNUf-Bg1.d.ts} +1 -1
  112. package/dist/{router-EoSzHlos.d.mts → router-Devibh4r.d.mts} +1 -1
  113. package/dist/routes.d.mts +1 -1
  114. package/dist/routes.d.ts +1 -1
  115. package/dist/{rsc-pipeline-YCDRJME4.cjs → rsc-pipeline-4ZJ6GUVQ.cjs} +5 -4
  116. package/dist/{rsc-pipeline-LK4K5JFK.mjs → rsc-pipeline-KK6GFDET.mjs} +4 -3
  117. package/dist/{runtime-DDH4tiuF.d.mts → runtime-9KZb8AI5.d.mts} +1 -1
  118. package/dist/{runtime-CwiuozLd.d.ts → runtime-CLr9P5kn.d.ts} +1 -1
  119. package/dist/server-plugins.d.mts +2 -2
  120. package/dist/server-plugins.d.ts +2 -2
  121. package/dist/server.cjs +22 -21
  122. package/dist/server.d.mts +9 -9
  123. package/dist/server.d.ts +9 -9
  124. package/dist/server.mjs +8 -7
  125. package/dist/{spa-router-Br4qFCWf.d.mts → spa-router-BIxh4IY-.d.mts} +2 -2
  126. package/dist/{spa-router-BsWUKH73.d.ts → spa-router-Ds6R_oe-.d.ts} +2 -2
  127. package/dist/{ssg-Donyfcxy.d.mts → ssg-ByrOVYdM.d.mts} +2 -2
  128. package/dist/{ssg-Csy2vwpi.d.ts → ssg-XnMHCyEc.d.ts} +2 -2
  129. package/dist/testing.d.mts +1 -1
  130. package/dist/testing.d.ts +1 -1
  131. package/dist/{utils-Luk72LXC.d.ts → utils-BN70ueSN.d.ts} +1 -1
  132. package/dist/{utils-d_k1ZZw0.d.mts → utils-BrjR5xRs.d.mts} +1 -1
  133. package/dist/version.cjs +2 -2
  134. package/dist/version.mjs +1 -1
  135. package/dist/vite.cjs +7 -6
  136. package/dist/vite.d.mts +4 -4
  137. package/dist/vite.d.ts +4 -4
  138. package/dist/vite.mjs +6 -5
  139. package/package.json +1 -1
@@ -25,7 +25,7 @@ var _chunk3XEMGDBFcjs = require('./chunk-3XEMGDBF.cjs');
25
25
 
26
26
 
27
27
 
28
- var _chunkGVNCWSQVcjs = require('./chunk-GVNCWSQV.cjs');
28
+ var _chunkXPSGGECFcjs = require('./chunk-XPSGGECF.cjs');
29
29
 
30
30
 
31
31
 
@@ -155,7 +155,7 @@ var _chunk6QQDAAAZcjs = require('./chunk-6QQDAAAZ.cjs');
155
155
 
156
156
 
157
157
 
158
- var _chunkRHGK2JENcjs = require('./chunk-RHGK2JEN.cjs');
158
+ var _chunkB6XAA7V6cjs = require('./chunk-B6XAA7V6.cjs');
159
159
 
160
160
 
161
161
 
@@ -244,7 +244,7 @@ var _chunk5NAVKJCZcjs = require('./chunk-5NAVKJCZ.cjs');
244
244
  var _chunk4TLUFAIPcjs = require('./chunk-4TLUFAIP.cjs');
245
245
 
246
246
 
247
- var _chunkYBDSTNMHcjs = require('./chunk-YBDSTNMH.cjs');
247
+ var _chunk3YJMBQ27cjs = require('./chunk-3YJMBQ27.cjs');
248
248
 
249
249
 
250
250
 
@@ -1913,8 +1913,8 @@ var _RouteManager = class _RouteManager {
1913
1913
  )
1914
1914
  );
1915
1915
  this.orderedLayouts = Array.from(this.layouts.values()).sort(
1916
- (left, right) => _chunkGVNCWSQVcjs.getRouteDirectoryDepth.call(void 0, left.pattern) - _chunkGVNCWSQVcjs.getRouteDirectoryDepth.call(void 0, right.pattern)
1917
- ).map((entry) => ({ entry, groupScope: _chunkGVNCWSQVcjs.getRouteGroupScope.call(void 0, entry.pattern) }));
1916
+ (left, right) => _chunkXPSGGECFcjs.getRouteDirectoryDepth.call(void 0, left.pattern) - _chunkXPSGGECFcjs.getRouteDirectoryDepth.call(void 0, right.pattern)
1917
+ ).map((entry) => ({ entry, groupScope: _chunkXPSGGECFcjs.getRouteGroupScope.call(void 0, entry.pattern) }));
1918
1918
  for (const slot of this.routeSlots.values()) {
1919
1919
  if (!this.routeSlotOwnerSegments.has(slot.ownerPattern)) {
1920
1920
  this.routeSlotOwnerSegments.set(
@@ -2156,7 +2156,7 @@ var _RouteManager = class _RouteManager {
2156
2156
  }
2157
2157
  return absolutePath;
2158
2158
  }, "toUrlPath");
2159
- const integrationProviders = _chunkRHGK2JENcjs.getIntegrationProviders.call(void 0, this.config.integrations).filter(
2159
+ const integrationProviders = _chunkB6XAA7V6cjs.getIntegrationProviders.call(void 0, this.config.integrations).filter(
2160
2160
  (provider) => provider.component || provider.type === "clerk"
2161
2161
  );
2162
2162
  const unsupportedIntegrationProvider = integrationProviders.find(
@@ -2225,15 +2225,15 @@ var _RouteManager = class _RouteManager {
2225
2225
  enforceFarmIsolatedHydrationRouteBudget(
2226
2226
  layoutEntries.map(({ entry, metadata }) => ({
2227
2227
  pattern: entry.pattern,
2228
- depth: _chunkGVNCWSQVcjs.getRouteDirectoryDepth.call(void 0, entry.pattern),
2228
+ depth: _chunkXPSGGECFcjs.getRouteDirectoryDepth.call(void 0, entry.pattern),
2229
2229
  metadata
2230
2230
  })),
2231
2231
  routeEntries.map(({ entry, metadata }) => ({
2232
2232
  pattern: getRouteEntryDirectory(entry),
2233
- depth: _chunkGVNCWSQVcjs.getRouteDirectoryDepth.call(void 0, getRouteEntryDirectory(entry)),
2233
+ depth: _chunkXPSGGECFcjs.getRouteDirectoryDepth.call(void 0, getRouteEntryDirectory(entry)),
2234
2234
  metadata
2235
2235
  })),
2236
- _chunkGVNCWSQVcjs.routeBoundaryCoversDirectory
2236
+ _chunkXPSGGECFcjs.routeBoundaryCoversDirectory
2237
2237
  );
2238
2238
  for (const { entry, metadata } of [...layoutEntries, ...routeEntries]) {
2239
2239
  if (!metadata.costGuardExceeded) continue;
@@ -2252,7 +2252,7 @@ var _RouteManager = class _RouteManager {
2252
2252
  const routes = routeEntries.map(({ entry, metadata }) => {
2253
2253
  const programmaticPage = this.programmaticPages.get(entry.modulePath);
2254
2254
  const layoutShouldHydrate = layoutEntries.some(
2255
- ({ entry: layout, metadata: layoutMetadata }) => layoutMetadata.shouldHydrate && _chunkGVNCWSQVcjs.routeBoundaryCoversDirectory.call(void 0, layout.pattern, getRouteEntryDirectory(entry))
2255
+ ({ entry: layout, metadata: layoutMetadata }) => layoutMetadata.shouldHydrate && _chunkXPSGGECFcjs.routeBoundaryCoversDirectory.call(void 0, layout.pattern, getRouteEntryDirectory(entry))
2256
2256
  );
2257
2257
  return {
2258
2258
  pattern: entry.pattern,
@@ -2269,7 +2269,7 @@ var _RouteManager = class _RouteManager {
2269
2269
  }))
2270
2270
  } : {},
2271
2271
  ...usesFarmServerTree(metadata) ? { serverTree: true } : {},
2272
- renderPlan: _chunkGVNCWSQVcjs.createFarmRouteRenderPlan.call(void 0, {
2272
+ renderPlan: _chunkXPSGGECFcjs.createFarmRouteRenderPlan.call(void 0, {
2273
2273
  pageShouldHydrate: metadata.shouldHydrate,
2274
2274
  layoutShouldHydrate,
2275
2275
  islandStrategy: metadata.islandStrategy
@@ -2434,7 +2434,7 @@ var _RouteManager = class _RouteManager {
2434
2434
  */
2435
2435
  createRoutePattern(route) {
2436
2436
  if (route.segments.length === 0) return "/";
2437
- return "/" + route.segments.map(_chunkGVNCWSQVcjs.formatRouteSegment).join("/");
2437
+ return "/" + route.segments.map(_chunkXPSGGECFcjs.formatRouteSegment).join("/");
2438
2438
  }
2439
2439
  registerPageRoute(entry) {
2440
2440
  _chunkNO3WWW3Ncjs.assertUniqueRouteParameters.call(void 0, entry.pattern);
@@ -2528,7 +2528,7 @@ var _RouteManager = class _RouteManager {
2528
2528
  for (const file of files) {
2529
2529
  const route = _chunk5QIKR7RRcjs.parseRoutePath.call(void 0, file);
2530
2530
  const modulePath = path4.default.join(appDir, file);
2531
- const pattern = _chunkGVNCWSQVcjs.createRouteDirectoryPattern.call(void 0, route);
2531
+ const pattern = _chunkXPSGGECFcjs.createRouteDirectoryPattern.call(void 0, route);
2532
2532
  const existing = target.get(pattern);
2533
2533
  if (_optionalChain([existing, 'optionalAccess', _131 => _131.sourceRoot]) === source.root) {
2534
2534
  throw new Error(
@@ -2550,7 +2550,7 @@ var _RouteManager = class _RouteManager {
2550
2550
  const modulePath = path4.default.join(appDir, file);
2551
2551
  const pattern = this.createRoutePattern(slot.route);
2552
2552
  const ownerPattern = this.createRoutePattern(slot.ownerRoute);
2553
- const ownerDirectory = _chunkGVNCWSQVcjs.createRouteDirectoryPattern.call(void 0, slot.ownerRoute);
2553
+ const ownerDirectory = _chunkXPSGGECFcjs.createRouteDirectoryPattern.call(void 0, slot.ownerRoute);
2554
2554
  const key = `${ownerPattern}:${slot.name}:${slot.interception ? "intercept" : "slot"}:${slot.fallback ? "default" : pattern}`;
2555
2555
  const existing = this.routeSlots.get(key);
2556
2556
  if (_optionalChain([existing, 'optionalAccess', _132 => _132.sourceRoot]) === source.root) {
@@ -2667,7 +2667,7 @@ var _RouteManager = class _RouteManager {
2667
2667
  }
2668
2668
  if (definition.kind === "layout") {
2669
2669
  const route = _chunkCGVPXIRNcjs.parseProgrammaticRoutePath.call(void 0, definition.path, "layout");
2670
- const pattern = _chunkGVNCWSQVcjs.createRouteDirectoryPattern.call(void 0, route);
2670
+ const pattern = _chunkXPSGGECFcjs.createRouteDirectoryPattern.call(void 0, route);
2671
2671
  const existing = this.layouts.get(pattern);
2672
2672
  if (_optionalChain([existing, 'optionalAccess', _136 => _136.sourceRoot]) === source.root) {
2673
2673
  throw new Error(
@@ -2714,7 +2714,7 @@ var _RouteManager = class _RouteManager {
2714
2714
  const matchingLayouts = [];
2715
2715
  for (const { entry, groupScope } of this.orderedLayouts) {
2716
2716
  if (!_chunk5QIKR7RRcjs.matchRoutePrefixParts.call(void 0, pathnameParts, entry.route.segments)) continue;
2717
- if (groupScope !== null && !_chunkGVNCWSQVcjs.isInRouteGroupScope.call(void 0, route && getRouteEntryDirectory(route), groupScope)) {
2717
+ if (groupScope !== null && !_chunkXPSGGECFcjs.isInRouteGroupScope.call(void 0, route && getRouteEntryDirectory(route), groupScope)) {
2718
2718
  continue;
2719
2719
  }
2720
2720
  matchingLayouts.push(entry);
@@ -2795,14 +2795,14 @@ var _RouteManager = class _RouteManager {
2795
2795
  let page = route;
2796
2796
  for (const boundaryEntry of boundaries.values()) {
2797
2797
  if (!_chunk5QIKR7RRcjs.matchRoutePrefix.call(void 0, normalizedPath, boundaryEntry.route.segments)) continue;
2798
- const groupScope = _chunkGVNCWSQVcjs.getRouteGroupScope.call(void 0, boundaryEntry.pattern);
2798
+ const groupScope = _chunkXPSGGECFcjs.getRouteGroupScope.call(void 0, boundaryEntry.pattern);
2799
2799
  if (groupScope !== null) {
2800
2800
  if (page === void 0) page = this.matchPageRoute(_chunk5QIKR7RRcjs.splitRoutePath.call(void 0, normalizedPath));
2801
- if (!_chunkGVNCWSQVcjs.isInRouteGroupScope.call(void 0, page && getRouteEntryDirectory(page), groupScope)) continue;
2801
+ if (!_chunkXPSGGECFcjs.isInRouteGroupScope.call(void 0, page && getRouteEntryDirectory(page), groupScope)) continue;
2802
2802
  }
2803
2803
  const depth = boundaryEntry.route.segments.length;
2804
2804
  const bestDepth = _nullishCoalesce(_optionalChain([bestMatch, 'optionalAccess', _140 => _140.route, 'access', _141 => _141.segments, 'access', _142 => _142.length]), () => ( -1));
2805
- if (!bestMatch || depth > bestDepth || depth === bestDepth && _chunkGVNCWSQVcjs.getRouteDirectoryDepth.call(void 0, boundaryEntry.pattern) > _chunkGVNCWSQVcjs.getRouteDirectoryDepth.call(void 0, bestMatch.pattern)) {
2805
+ if (!bestMatch || depth > bestDepth || depth === bestDepth && _chunkXPSGGECFcjs.getRouteDirectoryDepth.call(void 0, boundaryEntry.pattern) > _chunkXPSGGECFcjs.getRouteDirectoryDepth.call(void 0, bestMatch.pattern)) {
2806
2806
  bestMatch = boundaryEntry;
2807
2807
  }
2808
2808
  }
@@ -2918,7 +2918,7 @@ var _RouteManager = class _RouteManager {
2918
2918
  _chunkS3JO3N4Hcjs.__name.call(void 0, _RouteManager, "RouteManager");
2919
2919
  var RouteManager = _RouteManager;
2920
2920
  function getPageDirectoryField(route, pattern) {
2921
- const directory = _chunkGVNCWSQVcjs.createRouteDirectoryPattern.call(void 0, route);
2921
+ const directory = _chunkXPSGGECFcjs.createRouteDirectoryPattern.call(void 0, route);
2922
2922
  return directory === pattern ? {} : { directory };
2923
2923
  }
2924
2924
  _chunkS3JO3N4Hcjs.__name.call(void 0, getPageDirectoryField, "getPageDirectoryField");
@@ -4111,7 +4111,7 @@ function generateFarmIntegrationProviderClientCode(providers, root, rendererComp
4111
4111
  let hasClerkProvider = false;
4112
4112
  renderedProviders.forEach((provider, index) => {
4113
4113
  let componentExpression = "null";
4114
- if (_chunkRHGK2JENcjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) {
4114
+ if (_chunkB6XAA7V6cjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) {
4115
4115
  const namespace = `FarmIntegrationProviderModule${index}`;
4116
4116
  imports.push(
4117
4117
  `import * as ${namespace} from ${JSON.stringify(resolveProviderModule(provider.component.module, root))};`
@@ -4170,7 +4170,7 @@ function generateFarmIntegrationProviderServerModules(providers, root, rendererC
4170
4170
  const entries = [];
4171
4171
  let needsMarkHelper = false;
4172
4172
  providers.forEach((provider, index) => {
4173
- if (!_chunkRHGK2JENcjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) return;
4173
+ if (!_chunkB6XAA7V6cjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) return;
4174
4174
  const namespace = `FarmServerIntegrationProviderModule${index}`;
4175
4175
  imports.push(
4176
4176
  `import * as ${namespace} from ${JSON.stringify(resolveProviderModule(provider.component.module, root))};`
@@ -4588,7 +4588,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, appendResponseVary, "appendResponseVary");
4588
4588
  function renderI18nAlternateLinks(requestPath, snapshot, options) {
4589
4589
  if (snapshot.routing === "none") return "";
4590
4590
  const url = new URL(requestPath, "http://farm.local");
4591
- return _chunkGVNCWSQVcjs.renderFarmLocaleAlternateLinks.call(void 0, url.pathname, snapshot, options);
4591
+ return _chunkXPSGGECFcjs.renderFarmLocaleAlternateLinks.call(void 0, url.pathname, snapshot, options);
4592
4592
  }
4593
4593
  _chunkS3JO3N4Hcjs.__name.call(void 0, renderI18nAlternateLinks, "renderI18nAlternateLinks");
4594
4594
  var PPR_REFRESH_MAX_ATTEMPTS = 3;
@@ -5919,7 +5919,7 @@ var _ServerRenderer = class _ServerRenderer {
5919
5919
  }
5920
5920
  }
5921
5921
  _chunkGS3WR5HXcjs.emitFarmEvent.call(void 0, { type: "render.error", route: pathname, error });
5922
- const errorStatus = _chunkGVNCWSQVcjs.resolveDefaultErrorStatus.call(void 0, error);
5922
+ const errorStatus = _chunkXPSGGECFcjs.resolveDefaultErrorStatus.call(void 0, error);
5923
5923
  if (pprRefreshRoute) {
5924
5924
  _chunkGS3WR5HXcjs.emitFarmEvent.call(void 0, {
5925
5925
  type: "ppr.refresh.error",
@@ -5955,7 +5955,7 @@ var _ServerRenderer = class _ServerRenderer {
5955
5955
  }
5956
5956
  }
5957
5957
  async wrapWithIntegrationProviders(element) {
5958
- const providers = _chunkRHGK2JENcjs.getIntegrationProviders.call(void 0, this.config.integrations);
5958
+ const providers = _chunkB6XAA7V6cjs.getIntegrationProviders.call(void 0, this.config.integrations);
5959
5959
  let wrapped = element;
5960
5960
  for (let i = providers.length - 1; i >= 0; i--) {
5961
5961
  const provider = providers[i];
@@ -5973,7 +5973,7 @@ var _ServerRenderer = class _ServerRenderer {
5973
5973
  }
5974
5974
  let ProviderComponent;
5975
5975
  let providerSourceModule;
5976
- if (_chunkRHGK2JENcjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) {
5976
+ if (_chunkB6XAA7V6cjs.isFarmIntegrationProviderComponentReference.call(void 0, provider.component)) {
5977
5977
  providerSourceModule = provider.component.module;
5978
5978
  const providerModuleId = provider.component.module.startsWith(".") ? _chunk5QIKR7RRcjs.toViteModuleId.call(void 0,
5979
5979
  path9.resolve(this.config.root, provider.component.module),
@@ -6147,7 +6147,7 @@ var _ServerRenderer = class _ServerRenderer {
6147
6147
  origin: url.origin,
6148
6148
  readMarkdown: llmsContext.markdown
6149
6149
  }) : value;
6150
- const response = _chunkGVNCWSQVcjs.createFarmMetadataRouteResponse.call(void 0, match.metadata.kind, body, routeModule, {
6150
+ const response = _chunkXPSGGECFcjs.createFarmMetadataRouteResponse.call(void 0, match.metadata.kind, body, routeModule, {
6151
6151
  method,
6152
6152
  request: request2
6153
6153
  });
@@ -6183,7 +6183,7 @@ var _ServerRenderer = class _ServerRenderer {
6183
6183
  }) : context.defaults;
6184
6184
  await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0,
6185
6185
  res,
6186
- _chunkGVNCWSQVcjs.createFarmMetadataRouteResponse.call(void 0,
6186
+ _chunkXPSGGECFcjs.createFarmMetadataRouteResponse.call(void 0,
6187
6187
  kind,
6188
6188
  body,
6189
6189
  { revalidate: config.revalidate },
@@ -6218,7 +6218,7 @@ var _ServerRenderer = class _ServerRenderer {
6218
6218
  });
6219
6219
  await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0,
6220
6220
  res,
6221
- _chunkGVNCWSQVcjs.createFarmMetadataRouteResponse.call(void 0, "robots", robots, {}, { method: req.method })
6221
+ _chunkXPSGGECFcjs.createFarmMetadataRouteResponse.call(void 0, "robots", robots, {}, { method: req.method })
6222
6222
  );
6223
6223
  } catch (error) {
6224
6224
  _chunk5QIKR7RRcjs.logger.error(`Generated robots.txt failed: ${error}`);
@@ -6262,7 +6262,7 @@ var _ServerRenderer = class _ServerRenderer {
6262
6262
  });
6263
6263
  await _chunkUQZ4AYTHcjs.sendWebResponse.call(void 0,
6264
6264
  res,
6265
- _chunkGVNCWSQVcjs.createFarmMetadataRouteResponse.call(void 0, "sitemap", sitemap, {}, { method: req.method })
6265
+ _chunkXPSGGECFcjs.createFarmMetadataRouteResponse.call(void 0, "sitemap", sitemap, {}, { method: req.method })
6266
6266
  );
6267
6267
  } catch (error) {
6268
6268
  _chunk5QIKR7RRcjs.logger.error(`Generated sitemap.xml failed: ${error}`);
@@ -6291,7 +6291,7 @@ var _ServerRenderer = class _ServerRenderer {
6291
6291
  getAgentListedRoutes() {
6292
6292
  const guards = { config: this.config, middlewareRoutes: _nullishCoalesce(_optionalChain([this, 'access', _244 => _244.middlewareRoutes, 'optionalCall', _245 => _245()]), () => ( [])) };
6293
6293
  return [...this.routeManager.getRoutes()].filter(
6294
- ([pattern]) => !pattern.includes("[") && !_chunkGVNCWSQVcjs.farmPathGuardCoversPage.call(void 0, guards, pattern)
6294
+ ([pattern]) => !pattern.includes("[") && !_chunkXPSGGECFcjs.farmPathGuardCoversPage.call(void 0, guards, pattern)
6295
6295
  );
6296
6296
  }
6297
6297
  /**
@@ -6305,7 +6305,7 @@ var _ServerRenderer = class _ServerRenderer {
6305
6305
  if (this.routeManager.matchRoute(_chunkBMOBTMDRcjs.FARM_DEFAULT_MCP_PATH).route) return void 0;
6306
6306
  _nullishCoalesce(this.defaultMCPServer, () => ( (this.defaultMCPServer = _chunkBMOBTMDRcjs.createFarmDefaultMCPServer.call(void 0,
6307
6307
  readAppPackageIdentity(this.config.root),
6308
- _chunkYBDSTNMHcjs.FARM_VERSION
6308
+ _chunk3YJMBQ27cjs.FARM_VERSION
6309
6309
  ))));
6310
6310
  return _chunkBMOBTMDRcjs.resolveFarmDefaultMCPServer.call(void 0, this.defaultMCPServer);
6311
6311
  }
@@ -6387,7 +6387,7 @@ var _ServerRenderer = class _ServerRenderer {
6387
6387
  pages,
6388
6388
  config,
6389
6389
  rootMetadata,
6390
- mcp: _optionalChain([this, 'access', _257 => _257.config, 'access', _258 => _258.agent, 'optionalAccess', _259 => _259.aiCatalog]) === false ? [] : _chunkGVNCWSQVcjs.listFarmMCPLlmsTxtLinks.call(void 0, origin, {
6390
+ mcp: _optionalChain([this, 'access', _257 => _257.config, 'access', _258 => _258.agent, 'optionalAccess', _259 => _259.aiCatalog]) === false ? [] : _chunkXPSGGECFcjs.listFarmMCPLlmsTxtLinks.call(void 0, origin, {
6391
6391
  basePath: this.config.basePath,
6392
6392
  apiServerBasePath: _chunkKNBBQHO2cjs.resolveFarmAPIServerBasePath.call(void 0,
6393
6393
  _chunkS3A45T7Fcjs.normalizeFarmAPIConfig.call(void 0,
@@ -6649,7 +6649,7 @@ window.__FARM_ISLAND_STRATEGY__ = ${JSON.stringify(req.__FARM_ISLAND_STRATEGY__
6649
6649
  window.__FARM_PAGE_MODULE__ = ${JSON.stringify(relativePath)};
6650
6650
  window.__FARM_LOADING_MODULE__ = ${JSON.stringify(req.__FARM_LOADING_MODULE_PATH__ || null)};
6651
6651
  window.__FARM_MANIFEST__ = ${JSON.stringify(clientManifest)};
6652
- window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkRHGK2JENcjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
6652
+ window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkB6XAA7V6cjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
6653
6653
  window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0, ) ? serializeInlineValue(_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0, )) : "null"};
6654
6654
  </script>`);
6655
6655
  const deferredScript = farmScripts(createDeferredHydrationScript(deferredProps.records));
@@ -6686,19 +6686,19 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
6686
6686
  i18nSnapshot,
6687
6687
  this.getI18nAlternateOptions(req, req.__FARM_METADATA__)
6688
6688
  ) : "";
6689
- const themeDocument = _chunkGVNCWSQVcjs.createFarmThemeDocumentParts.call(void 0,
6689
+ const themeDocument = _chunkXPSGGECFcjs.createFarmThemeDocumentParts.call(void 0,
6690
6690
  this.config.theme,
6691
6691
  this.config.basePath,
6692
6692
  _chunk2FUIT2G2cjs.getTheme.call(void 0, )
6693
6693
  );
6694
6694
  themeDocument.head = farmScripts(themeDocument.head);
6695
- const fullDocument = _chunkGVNCWSQVcjs.extractFarmFullDocument.call(void 0, content);
6695
+ const fullDocument = _chunkXPSGGECFcjs.extractFarmFullDocument.call(void 0, content);
6696
6696
  let html;
6697
6697
  if (fullDocument) {
6698
6698
  const shouldReplaceLayoutTitle = hasExplicitTitle || rendererHasTitle;
6699
- const documentHtml = shouldReplaceLayoutTitle ? _chunkGVNCWSQVcjs.removeFarmDocumentTitles.call(void 0, fullDocument) : fullDocument;
6700
- const effectiveRendererHead = hasExplicitTitle ? _chunkGVNCWSQVcjs.removeFarmDocumentTitles.call(void 0, rendererHead) : rendererHead;
6701
- html = _chunkGVNCWSQVcjs.composeFarmFullDocument.call(void 0, documentHtml, {
6699
+ const documentHtml = shouldReplaceLayoutTitle ? _chunkXPSGGECFcjs.removeFarmDocumentTitles.call(void 0, fullDocument) : fullDocument;
6700
+ const effectiveRendererHead = hasExplicitTitle ? _chunkXPSGGECFcjs.removeFarmDocumentTitles.call(void 0, rendererHead) : rendererHead;
6701
+ html = _chunkXPSGGECFcjs.composeFarmFullDocument.call(void 0, documentHtml, {
6702
6702
  fallbackIcon: !hasFavicon,
6703
6703
  viewport: viewportTags,
6704
6704
  htmlAttributes: `${i18nSnapshot ? ` lang="${escapeHtmlAttribute2(i18nSnapshot.locale)}" dir="${escapeHtmlAttribute2(i18nSnapshot.direction)}"` : ""}${themeDocument.attributes}`,
@@ -6906,7 +6906,7 @@ window.__FARM_LOADING_MODULE__ = ${JSON.stringify(
6906
6906
  req.__FARM_LOADING_MODULE_PATH__ || null
6907
6907
  )};
6908
6908
  window.__FARM_MANIFEST__ = ${JSON.stringify(clientManifest)};
6909
- window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkRHGK2JENcjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
6909
+ window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkB6XAA7V6cjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
6910
6910
  window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0, ) ? serializeInlineValue(_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0, )) : "null"};
6911
6911
  </script>`;
6912
6912
  const hydrationClickQueueScript = isClientComponent || req.__FARM_SHOULD_HYDRATE__ === true || req.__FARM_HAS_HYDRATABLE_ROUTE_SLOTS__ === true ? createPreHydrationClickQueueScript() : "";
@@ -6926,7 +6926,7 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
6926
6926
  this.getI18nAlternateOptions(req, req.__FARM_METADATA__)
6927
6927
  ) : "";
6928
6928
  const fontHead = renderFarmFontDevHead(this.config.root || process.cwd());
6929
- const themeDocument = _chunkGVNCWSQVcjs.createFarmThemeDocumentParts.call(void 0,
6929
+ const themeDocument = _chunkXPSGGECFcjs.createFarmThemeDocumentParts.call(void 0,
6930
6930
  this.config.theme,
6931
6931
  this.config.basePath,
6932
6932
  _chunk2FUIT2G2cjs.getTheme.call(void 0, )
@@ -6989,7 +6989,7 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
6989
6989
  if (!chunkText) return;
6990
6990
  if (!checkedFullDocument) {
6991
6991
  documentPrefix += chunkText;
6992
- const prefix = _chunkGVNCWSQVcjs.classifyFarmDocumentPrefix.call(void 0, documentPrefix);
6992
+ const prefix = _chunkXPSGGECFcjs.classifyFarmDocumentPrefix.call(void 0, documentPrefix);
6993
6993
  if (prefix !== "pending") {
6994
6994
  checkedFullDocument = true;
6995
6995
  documentPrefix = "";
@@ -7186,7 +7186,7 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
7186
7186
  */
7187
7187
  async createLateNavigationRecoveryHTML(req, error) {
7188
7188
  if (_chunkOX6O6WVAcjs.isFarmRedirectError.call(void 0, error)) {
7189
- return _chunkGVNCWSQVcjs.createLateRedirectRecovery.call(void 0,
7189
+ return _chunkXPSGGECFcjs.createLateRedirectRecovery.call(void 0,
7190
7190
  this.localizeRedirectUrl(_chunkOX6O6WVAcjs.getFarmRedirectError.call(void 0, error).url),
7191
7191
  this.getCspNonce(req) || ""
7192
7192
  );
@@ -7208,7 +7208,7 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
7208
7208
  _chunk5QIKR7RRcjs.logger.warn(`not-found page could not render outside its layout, using Farm's: ${error2}`);
7209
7209
  }
7210
7210
  }
7211
- return _chunkGVNCWSQVcjs.createLateNotFoundRecovery.call(void 0, content, this.getCspNonce(req) || "");
7211
+ return _chunkXPSGGECFcjs.createLateNotFoundRecovery.call(void 0, content, this.getCspNonce(req) || "");
7212
7212
  }
7213
7213
  async render404(req, res) {
7214
7214
  res.statusCode = 404;
@@ -7286,10 +7286,10 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
7286
7286
  trustProxy: _optionalChain([this, 'access', _304 => _304.config, 'access', _305 => _305.server, 'optionalAccess', _306 => _306.trustProxy])
7287
7287
  });
7288
7288
  const diagnostics = isDev ? createDefaultErrorDiagnostics(error, this.config.root || process.cwd()) : void 0;
7289
- const statusText = _chunkGVNCWSQVcjs.getDefaultErrorStatusText.call(void 0, statusCode);
7289
+ const statusText = _chunkXPSGGECFcjs.getDefaultErrorStatusText.call(void 0, statusCode);
7290
7290
  const content = this.stampFarmScripts(
7291
7291
  req,
7292
- _chunkGVNCWSQVcjs.createDefaultErrorMarkup.call(void 0, {
7292
+ _chunkXPSGGECFcjs.createDefaultErrorMarkup.call(void 0, {
7293
7293
  statusCode,
7294
7294
  statusText,
7295
7295
  requestPath: requestUrl.pathname,
@@ -7299,7 +7299,7 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
7299
7299
  stack: _optionalChain([diagnostics, 'optionalAccess', _309 => _309.stack]),
7300
7300
  sourceFrame: _optionalChain([diagnostics, 'optionalAccess', _310 => _310.sourceFrame]),
7301
7301
  development: isDev,
7302
- farmVersion: _chunkYBDSTNMHcjs.FARM_VERSION,
7302
+ farmVersion: _chunk3YJMBQ27cjs.FARM_VERSION,
7303
7303
  nodeVersion: process.version,
7304
7304
  mode: isDev ? "development" : "production"
7305
7305
  })
@@ -7336,7 +7336,7 @@ window.__FARM_I18N__ = ${_chunkXJXBIP67cjs.getFarmI18nClientSnapshot.call(void 0
7336
7336
  const viteClientScript = farmScripts(`<script type="module" src="/@vite/client"></script>`);
7337
7337
  const integrationManifestScript = farmScripts(`<script>
7338
7338
  window.__FARM_DEPLOYMENT_ID__ = ${serializeInlineValue(this.getDeploymentId())};
7339
- window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkRHGK2JENcjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
7339
+ window.__FARM_INTEGRATION_API_MANIFEST__ = ${JSON.stringify(_chunkB6XAA7V6cjs.getRegisteredIntegrationAPIManifest.call(void 0, ))};
7340
7340
  ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};` : ""}
7341
7341
  </script>`);
7342
7342
  const alternateLinks = i18nSnapshot ? renderI18nAlternateLinks(
@@ -7345,7 +7345,7 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};`
7345
7345
  this.getI18nAlternateOptions(alternates.req, alternates.metadata)
7346
7346
  ) : "";
7347
7347
  const fontHead = renderFarmFontDevHead(this.config.root || process.cwd());
7348
- const themeDocument = _chunkGVNCWSQVcjs.createFarmThemeDocumentParts.call(void 0,
7348
+ const themeDocument = _chunkXPSGGECFcjs.createFarmThemeDocumentParts.call(void 0,
7349
7349
  this.config.theme,
7350
7350
  this.config.basePath,
7351
7351
  _chunk2FUIT2G2cjs.getTheme.call(void 0, )
@@ -7355,10 +7355,10 @@ ${i18nSnapshot ? `window.__FARM_I18N__ = ${serializeInlineValue(i18nSnapshot)};`
7355
7355
  _optionalChain([this, 'access', _315 => _315.rendererRuntime, 'access', _316 => _316.generateHydrationScript, 'optionalCall', _317 => _317()]) || ""
7356
7356
  );
7357
7357
  const viewportTags = _chunkLZESP4IRcjs.renderViewportHead.call(void 0, _optionalChain([alternates, 'access', _318 => _318.metadata, 'optionalAccess', _319 => _319.viewport]));
7358
- const fullDocument = _chunkGVNCWSQVcjs.extractFarmFullDocument.call(void 0, content);
7358
+ const fullDocument = _chunkXPSGGECFcjs.extractFarmFullDocument.call(void 0, content);
7359
7359
  if (fullDocument) {
7360
- return _chunkGVNCWSQVcjs.composeFarmFullDocument.call(void 0,
7361
- metadataHead ? _chunkGVNCWSQVcjs.removeFarmDocumentTitles.call(void 0, fullDocument) : fullDocument,
7360
+ return _chunkXPSGGECFcjs.composeFarmFullDocument.call(void 0,
7361
+ metadataHead ? _chunkXPSGGECFcjs.removeFarmDocumentTitles.call(void 0, fullDocument) : fullDocument,
7362
7362
  {
7363
7363
  fallbackIcon: !metadataHead,
7364
7364
  viewport: viewportTags,
@@ -0,0 +1,186 @@
1
+ import {
2
+ compileMiddlewareConfig,
3
+ matchesCompiledMiddlewareConfig
4
+ } from "./chunk-HKFBMHCD.mjs";
5
+ import {
6
+ createFarmAPIMiddlewarePathnames,
7
+ resolveFarmAPIServerBasePath
8
+ } from "./chunk-BTHHUD7Q.mjs";
9
+ import {
10
+ canonicalizeRequestPathSegments,
11
+ canonicalizeRequestPathname
12
+ } from "./chunk-CQ6OSQ3K.mjs";
13
+ import {
14
+ resolveFarmLocalePath
15
+ } from "./chunk-L3KT7IXV.mjs";
16
+ import {
17
+ stripFarmBasePath
18
+ } from "./chunk-4RB44K6Z.mjs";
19
+ import {
20
+ __name
21
+ } from "./chunk-LPEX4YW6.mjs";
22
+
23
+ // src/integration-middleware-matcher.ts
24
+ function isFarmIntegration(value) {
25
+ return !!value && typeof value === "object" && value.kind === "farm-integration";
26
+ }
27
+ __name(isFarmIntegration, "isFarmIntegration");
28
+ var compiledIntegrationGuards = /* @__PURE__ */ new WeakMap();
29
+ var noMiddlewareContext = {};
30
+ function resolveIntegrationMiddlewareParams(entry, pathname, config) {
31
+ const params = resolveMatcherParams(entry.matcher, pathname);
32
+ if (params || !entry.matcher) return params;
33
+ const routePathname = resolveIntegrationRoutePathname(pathname, config);
34
+ const candidates = [.../* @__PURE__ */ new Set([pathname, ...getIntegrationAPIPathnames(config)(routePathname)])];
35
+ for (const candidate of candidates) {
36
+ if (candidate === pathname) continue;
37
+ const routeParams = resolveMatcherParams(entry.matcher, candidate);
38
+ if (routeParams) return routeParams;
39
+ }
40
+ let compiled = compiledIntegrationGuards.get(entry);
41
+ if (!compiled) {
42
+ compiled = compileMiddlewareConfig({
43
+ matcher: typeof entry.matcher === "string" ? entry.matcher : [...entry.matcher]
44
+ });
45
+ compiledIntegrationGuards.set(entry, compiled);
46
+ }
47
+ for (const candidate of candidates) {
48
+ const result = matchesCompiledMiddlewareConfig(candidate, compiled, noMiddlewareContext);
49
+ if (result.matched) return result.params ?? {};
50
+ }
51
+ return null;
52
+ }
53
+ __name(resolveIntegrationMiddlewareParams, "resolveIntegrationMiddlewareParams");
54
+ function integrationMiddlewareMayHandlePath(integrations, pathname, catchAllProbe) {
55
+ if (!integrations) return false;
56
+ const covers = /* @__PURE__ */ __name((entry) => resolveIntegrationMiddlewareParams(entry, pathname, void 0) !== null, "covers");
57
+ return Object.values(integrations).some(
58
+ (integration) => isFarmIntegration(integration) && (integration.middleware || []).some((entry) => {
59
+ if (catchAllProbe === void 0) return covers(entry);
60
+ if (!entry.matcher) return false;
61
+ const specific = (Array.isArray(entry.matcher) ? entry.matcher : [entry.matcher]).filter(
62
+ (matcher) => resolveIntegrationMiddlewareParams({ matcher }, catchAllProbe, void 0) === null
63
+ );
64
+ return specific.length > 0 && covers({ matcher: specific });
65
+ })
66
+ );
67
+ }
68
+ __name(integrationMiddlewareMayHandlePath, "integrationMiddlewareMayHandlePath");
69
+ var FARM_INTEGRATION_API_BASE_PATH_KEY = "__farmAPIServerBasePath";
70
+ var integrationAPIPathnames = /* @__PURE__ */ new WeakMap();
71
+ function getIntegrationAPIPathnames(config) {
72
+ if (!config) return (pathname) => [pathname];
73
+ let toPathnames = integrationAPIPathnames.get(config);
74
+ if (!toPathnames) {
75
+ const recorded = config[FARM_INTEGRATION_API_BASE_PATH_KEY];
76
+ const api = config.api;
77
+ const serverBasePath = typeof recorded === "string" ? recorded : typeof api?.baseURL === "string" && typeof api.basePath === "string" ? resolveFarmAPIServerBasePath(api) : void 0;
78
+ toPathnames = createFarmAPIMiddlewarePathnames(serverBasePath);
79
+ integrationAPIPathnames.set(config, toPathnames);
80
+ }
81
+ return toPathnames;
82
+ }
83
+ __name(getIntegrationAPIPathnames, "getIntegrationAPIPathnames");
84
+ function resolveIntegrationRoutePathname(pathname, config) {
85
+ const basePath = typeof config?.basePath === "string" ? config.basePath : void 0;
86
+ let routePathname = basePath ? stripFarmBasePath(pathname, basePath) : pathname;
87
+ const i18n = config?.i18n;
88
+ if (i18n && Array.isArray(i18n.locales) && i18n.locales.length > 0) {
89
+ routePathname = resolveFarmLocalePath(routePathname, {
90
+ locales: i18n.locales,
91
+ defaultLocale: i18n.defaultLocale,
92
+ routing: i18n.routing || "prefix-except-default"
93
+ }).pathname;
94
+ }
95
+ return routePathname;
96
+ }
97
+ __name(resolveIntegrationRoutePathname, "resolveIntegrationRoutePathname");
98
+ function resolveMatcherParams(matcher, pathname) {
99
+ if (!matcher) {
100
+ return {};
101
+ }
102
+ const list = Array.isArray(matcher) ? matcher : [matcher];
103
+ let canonicalPathname;
104
+ let canonicalSegments;
105
+ for (const item of list) {
106
+ if (item === "/(.*)" || item === "*") {
107
+ return {};
108
+ }
109
+ if (item.endsWith("(.*)")) {
110
+ canonicalPathname ?? (canonicalPathname = canonicalizeRequestPathname(pathname));
111
+ const prefix = item.slice(0, -4);
112
+ if (canonicalPathname === prefix || canonicalPathname.startsWith(`${prefix}/`)) {
113
+ return {};
114
+ }
115
+ continue;
116
+ }
117
+ canonicalSegments ?? (canonicalSegments = canonicalizeRequestPathSegments(pathname));
118
+ const params = matchPathSegments(splitPath(item), canonicalSegments);
119
+ if (params) {
120
+ return params;
121
+ }
122
+ }
123
+ return null;
124
+ }
125
+ __name(resolveMatcherParams, "resolveMatcherParams");
126
+ function matchPathSegments(routeSegments, pathSegments) {
127
+ const params = {};
128
+ let routeIndex = 0;
129
+ let pathIndex = 0;
130
+ while (routeIndex < routeSegments.length && pathIndex < pathSegments.length) {
131
+ const routeSegment = routeSegments[routeIndex];
132
+ const pathSegment = pathSegments[pathIndex];
133
+ if (isCatchAllSegment(routeSegment)) {
134
+ params[getSegmentParamName(routeSegment)] = pathSegments.slice(pathIndex);
135
+ return params;
136
+ }
137
+ if (isDynamicSegment(routeSegment)) {
138
+ params[getSegmentParamName(routeSegment)] = pathSegment;
139
+ routeIndex += 1;
140
+ pathIndex += 1;
141
+ continue;
142
+ }
143
+ if (routeSegment !== pathSegment) {
144
+ return null;
145
+ }
146
+ routeIndex += 1;
147
+ pathIndex += 1;
148
+ }
149
+ if (routeIndex === routeSegments.length && pathIndex === pathSegments.length) {
150
+ return params;
151
+ }
152
+ if (routeIndex === routeSegments.length - 1 && isCatchAllSegment(routeSegments[routeIndex])) {
153
+ params[getSegmentParamName(routeSegments[routeIndex])] = [];
154
+ return params;
155
+ }
156
+ return null;
157
+ }
158
+ __name(matchPathSegments, "matchPathSegments");
159
+ function splitPath(value) {
160
+ return value.split("/").filter(Boolean);
161
+ }
162
+ __name(splitPath, "splitPath");
163
+ function isDynamicSegment(segment) {
164
+ return segment.startsWith("[") && segment.endsWith("]");
165
+ }
166
+ __name(isDynamicSegment, "isDynamicSegment");
167
+ function isCatchAllSegment(segment) {
168
+ return segment.startsWith("[...") && segment.endsWith("]");
169
+ }
170
+ __name(isCatchAllSegment, "isCatchAllSegment");
171
+ function getSegmentParamName(segment) {
172
+ if (isCatchAllSegment(segment)) {
173
+ return segment.slice(4, -1);
174
+ }
175
+ return segment.slice(1, -1);
176
+ }
177
+ __name(getSegmentParamName, "getSegmentParamName");
178
+
179
+ export {
180
+ isFarmIntegration,
181
+ resolveIntegrationMiddlewareParams,
182
+ integrationMiddlewareMayHandlePath,
183
+ FARM_INTEGRATION_API_BASE_PATH_KEY,
184
+ matchPathSegments,
185
+ splitPath
186
+ };
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-QGH2RQVF.mjs";
5
5
  import {
6
6
  resolveDeployOutputPath
7
- } from "./chunk-4MRQ5OKQ.mjs";
7
+ } from "./chunk-WWYXIECF.mjs";
8
8
  import {
9
9
  loadFarmReactPlugin
10
10
  } from "./chunk-5NIWBWDD.mjs";
@@ -29,7 +29,7 @@ import {
29
29
  } from "./chunk-WDMIW6Q6.mjs";
30
30
  import {
31
31
  getIntegrationSchemas
32
- } from "./chunk-AX7S67YV.mjs";
32
+ } from "./chunk-37VKVISD.mjs";
33
33
  import {
34
34
  __name
35
35
  } from "./chunk-LPEX4YW6.mjs";
@@ -69,7 +69,7 @@ var _chunkJEIG3EWEcjs = require('./chunk-JEIG3EWE.cjs');
69
69
  var _chunkOI6CMLWXcjs = require('./chunk-OI6CMLWX.cjs');
70
70
 
71
71
 
72
- var _chunkRHGK2JENcjs = require('./chunk-RHGK2JEN.cjs');
72
+ var _chunkB6XAA7V6cjs = require('./chunk-B6XAA7V6.cjs');
73
73
 
74
74
 
75
75
  var _chunkALPWLT27cjs = require('./chunk-ALPWLT27.cjs');
@@ -804,7 +804,7 @@ async function resolveConfig(userConfig, mode) {
804
804
  },
805
805
  agent: resolveFarmAgentConfig(userConfig.agent, { docs: docs.enabled }),
806
806
  plugins: [
807
- ..._chunkRHGK2JENcjs.resolveIntegrationPlugins.call(void 0, integrations),
807
+ ..._chunkB6XAA7V6cjs.resolveIntegrationPlugins.call(void 0, integrations),
808
808
  ...nativeMCPPlugin ? [nativeMCPPlugin] : [],
809
809
  ...userConfig.plugins || []
810
810
  ],
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-2VQKKQ6D.mjs";
12
12
  import {
13
13
  resolveDocsConfig
14
- } from "./chunk-4MRQ5OKQ.mjs";
14
+ } from "./chunk-WWYXIECF.mjs";
15
15
  import {
16
16
  getFarmDocsAdapterConfigModule,
17
17
  isSecretDocsConfigKey
@@ -25,7 +25,7 @@ import {
25
25
  renderFarmLocaleAlternateLinks,
26
26
  resolveDefaultErrorStatus,
27
27
  routeBoundaryCoversDirectory
28
- } from "./chunk-TESO7EFU.mjs";
28
+ } from "./chunk-YFLBG2W3.mjs";
29
29
  import {
30
30
  FARM_DEFAULT_MCP_PATH,
31
31
  collectFarmDefaultMCPPages,
@@ -155,7 +155,7 @@ import {
155
155
  getIntegrationProviders,
156
156
  getRegisteredIntegrationAPIManifest,
157
157
  isFarmIntegrationProviderComponentReference
158
- } from "./chunk-AX7S67YV.mjs";
158
+ } from "./chunk-37VKVISD.mjs";
159
159
  import {
160
160
  createRouteSlotContainerId,
161
161
  parseRouteSlotFile
@@ -244,7 +244,7 @@ import {
244
244
  } from "./chunk-P7XDC7UJ.mjs";
245
245
  import {
246
246
  FARM_VERSION
247
- } from "./chunk-YGZH4T2X.mjs";
247
+ } from "./chunk-R4J2UOV4.mjs";
248
248
  import {
249
249
  resolveFarmTrailingSlashRedirect,
250
250
  setFarmTrailingSlashPreference