@farm.js/core 0.1.25 → 0.1.27

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 (181) hide show
  1. package/dist/agent-runtime.d.mts +8 -10
  2. package/dist/agent-runtime.d.ts +8 -10
  3. package/dist/api/client.cjs +3 -3
  4. package/dist/api/client.d.mts +4 -5
  5. package/dist/api/client.d.ts +4 -5
  6. package/dist/api/client.mjs +2 -2
  7. package/dist/api/route-manager.cjs +6 -5
  8. package/dist/api/route-manager.d.mts +7 -9
  9. package/dist/api/route-manager.d.ts +7 -9
  10. package/dist/api/route-manager.mjs +5 -4
  11. package/dist/api/runtime.cjs +10 -4
  12. package/dist/api/runtime.d.mts +35 -3
  13. package/dist/api/runtime.d.ts +35 -3
  14. package/dist/api/runtime.mjs +9 -3
  15. package/dist/{api-client-Cx54IR5g.d.mts → api-client-BjMmY8OD.d.mts} +2 -3
  16. package/dist/{api-client-DykpaKcY.d.ts → api-client-CyFtZFJ4.d.ts} +2 -3
  17. package/dist/api.cjs +9 -8
  18. package/dist/api.d.mts +9 -11
  19. package/dist/api.d.ts +9 -11
  20. package/dist/api.mjs +9 -8
  21. package/dist/{app-ZuWrAMc_.d.mts → app-BfzZdjgX.d.mts} +3 -4
  22. package/dist/{app-BF-ctoxh.d.ts → app-CXK7Prrt.d.ts} +3 -4
  23. package/dist/app-markdown.cjs +12 -4
  24. package/dist/app-markdown.d.mts +9 -11
  25. package/dist/app-markdown.d.ts +9 -11
  26. package/dist/app-markdown.mjs +11 -3
  27. package/dist/{chunk-2BIJGZR3.mjs → chunk-3PTVHMLD.mjs} +1 -1
  28. package/dist/{chunk-XME4TCLB.mjs → chunk-4FHDV7VM.mjs} +2 -2
  29. package/dist/{chunk-KLSSO6YD.mjs → chunk-4UNKCNSL.mjs} +1 -1
  30. package/dist/chunk-5MKEDGLD.cjs +53 -0
  31. package/dist/{chunk-E3RDL2DA.cjs → chunk-DQMTHWPI.cjs} +61 -31
  32. package/dist/{chunk-TTVHACQV.cjs → chunk-FOT7LZEO.cjs} +1 -1
  33. package/dist/{chunk-2KI3CL3N.mjs → chunk-FPW4W3VW.mjs} +1 -1
  34. package/dist/{chunk-6K4SPQWL.cjs → chunk-HF5SIACK.cjs} +3 -3
  35. package/dist/{chunk-T2OPSH6S.mjs → chunk-HG237IEY.mjs} +12 -5
  36. package/dist/chunk-J63ZH5OQ.cjs +62 -0
  37. package/dist/{chunk-BD2U4ZL6.cjs → chunk-JQGDQO2I.cjs} +8 -8
  38. package/dist/{chunk-RR6UGYUT.mjs → chunk-JT25KHDI.mjs} +39 -9
  39. package/dist/{chunk-O5DVPF3R.cjs → chunk-KAERLFD3.cjs} +16 -11
  40. package/dist/{chunk-H7CJRJ4L.cjs → chunk-LAHZ7LZA.cjs} +16 -16
  41. package/dist/{chunk-XM4ZDVD7.mjs → chunk-MBFURXAC.mjs} +1 -1
  42. package/dist/{chunk-6VEHUKZ2.mjs → chunk-MM5D6VLP.mjs} +4 -20
  43. package/dist/chunk-MVL2RAJW.mjs +62 -0
  44. package/dist/{chunk-YA6LLTIJ.cjs → chunk-ND224OE2.cjs} +4 -20
  45. package/dist/{chunk-RYDW7GPR.cjs → chunk-NPFGGBM5.cjs} +13 -13
  46. package/dist/{chunk-VZWO3XVL.mjs → chunk-O2LV5XDG.mjs} +2 -2
  47. package/dist/chunk-O6XNAMBV.mjs +53 -0
  48. package/dist/{chunk-N2Z4ZFDE.mjs → chunk-OGHTEYXS.mjs} +22 -14
  49. package/dist/{chunk-U4MP7XTD.mjs → chunk-POXI72VV.mjs} +180 -16
  50. package/dist/{chunk-QGG336NI.mjs → chunk-Q4BHBO6V.mjs} +1 -1
  51. package/dist/{chunk-AXYTGLF3.cjs → chunk-QI7WQSMI.cjs} +4 -4
  52. package/dist/{chunk-WOI2HOGA.mjs → chunk-QQQNJS2E.mjs} +1 -1
  53. package/dist/{chunk-CFNOGDUS.cjs → chunk-TDWFCC2T.cjs} +2 -2
  54. package/dist/{chunk-R7LCG3BT.cjs → chunk-UNSKL6BI.cjs} +89 -81
  55. package/dist/{chunk-WJYCI56T.mjs → chunk-UWTQTZFN.mjs} +52 -33
  56. package/dist/{chunk-5YYJ6Q2L.mjs → chunk-WIVTGKLY.mjs} +7 -2
  57. package/dist/{chunk-65P6OGYN.cjs → chunk-WJKVTJJR.cjs} +12 -5
  58. package/dist/{chunk-OAVTUMJP.cjs → chunk-YXM74XOW.cjs} +9 -9
  59. package/dist/{chunk-QYMRIVG6.cjs → chunk-YZBV7733.cjs} +120 -101
  60. package/dist/{chunk-2ITKVAIF.cjs → chunk-ZSO5GWGD.cjs} +203 -39
  61. package/dist/{client-plugins-DPG0NeZN.d.mts → client-plugins-1GS4zubE.d.mts} +1940 -1677
  62. package/dist/{client-plugins-Fgni-_25.d.ts → client-plugins-B1Za6F5x.d.ts} +1940 -1677
  63. package/dist/client-plugins.d.mts +8 -10
  64. package/dist/client-plugins.d.ts +8 -10
  65. package/dist/client.cjs +4 -4
  66. package/dist/client.d.mts +10 -12
  67. package/dist/client.d.ts +10 -12
  68. package/dist/client.mjs +3 -3
  69. package/dist/config.d.mts +8 -10
  70. package/dist/config.d.ts +8 -10
  71. package/dist/{devtools-I7TBFOKD.mjs → devtools-6RN6KHTW.mjs} +8 -3
  72. package/dist/{devtools-6OA7FEF6.cjs → devtools-CQJ3H6MX.cjs} +9 -4
  73. package/dist/docs.cjs +11 -6
  74. package/dist/docs.mjs +10 -5
  75. package/dist/{endpoint-1zA994xL.d.ts → endpoint-CA-TNX60.d.ts} +1 -1
  76. package/dist/{endpoint-DAc96i93.d.mts → endpoint-CCHFqyTE.d.mts} +1 -1
  77. package/dist/index.cjs +26 -21
  78. package/dist/index.d.mts +16 -18
  79. package/dist/index.d.ts +16 -18
  80. package/dist/index.mjs +26 -21
  81. package/dist/{integration-api-BbaiokCC.d.ts → integration-api-0y4FXJpC.d.mts} +128 -1
  82. package/dist/{integration-api-BbaiokCC.d.mts → integration-api-BPJo5oXb.d.ts} +128 -1
  83. package/dist/integrations.d.mts +8 -10
  84. package/dist/integrations.d.ts +8 -10
  85. package/dist/internal/app-markdown-runtime.cjs +11 -3
  86. package/dist/internal/app-markdown-runtime.d.mts +9 -10
  87. package/dist/internal/app-markdown-runtime.d.ts +9 -10
  88. package/dist/internal/app-markdown-runtime.mjs +10 -2
  89. package/dist/internal/build-runtime.cjs +19 -17
  90. package/dist/internal/build-runtime.d.mts +10 -12
  91. package/dist/internal/build-runtime.d.ts +10 -12
  92. package/dist/internal/build-runtime.mjs +18 -16
  93. package/dist/internal/cli-runtime.cjs +9 -5
  94. package/dist/internal/cli-runtime.mjs +8 -4
  95. package/dist/internal/client-error-overlay.cjs +4 -4
  96. package/dist/internal/client-error-overlay.mjs +1 -1
  97. package/dist/internal/compression-runtime.d.mts +8 -10
  98. package/dist/internal/compression-runtime.d.ts +8 -10
  99. package/dist/internal/config-runtime.cjs +9 -4
  100. package/dist/internal/config-runtime.d.mts +9 -11
  101. package/dist/internal/config-runtime.d.ts +9 -11
  102. package/dist/internal/config-runtime.mjs +8 -3
  103. package/dist/internal/infra-analytics-runtime.cjs +4 -3
  104. package/dist/internal/infra-analytics-runtime.mjs +2 -1
  105. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  106. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  107. package/dist/internal/production-runtime.cjs +8 -5
  108. package/dist/internal/production-runtime.d.mts +16 -16
  109. package/dist/internal/production-runtime.d.ts +16 -16
  110. package/dist/internal/production-runtime.mjs +7 -4
  111. package/dist/markdown.cjs +10 -2
  112. package/dist/markdown.d.mts +35 -153
  113. package/dist/markdown.d.ts +35 -153
  114. package/dist/markdown.mjs +9 -1
  115. package/dist/{metadata-CDnRHKVq.d.ts → metadata-7LKgQEWF.d.ts} +1 -1
  116. package/dist/{metadata-D0EF7esB.d.mts → metadata-B9mCxKgp.d.mts} +1 -1
  117. package/dist/middleware.d.mts +9 -11
  118. package/dist/middleware.d.ts +9 -11
  119. package/dist/navigation.d.mts +10 -12
  120. package/dist/navigation.d.ts +10 -12
  121. package/dist/{nitro-ZKLGOTVY.mjs → nitro-NAKCRVHX.mjs} +4 -3
  122. package/dist/{nitro-KQDU7CFE.cjs → nitro-VYDZGYFY.cjs} +4 -3
  123. package/dist/observability-BupkiN0m.d.mts +447 -0
  124. package/dist/observability-BupkiN0m.d.ts +447 -0
  125. package/dist/observability.d.mts +2 -417
  126. package/dist/observability.d.ts +2 -417
  127. package/dist/plugin.cjs +14 -12
  128. package/dist/plugin.d.mts +9 -11
  129. package/dist/plugin.d.ts +9 -11
  130. package/dist/plugin.mjs +13 -11
  131. package/dist/{production-runtime-DpCt0opU.d.ts → production-runtime-B3xnY6fI.d.ts} +1 -1
  132. package/dist/{production-runtime-x3W4wVqx.d.mts → production-runtime-DramhI0c.d.mts} +1 -1
  133. package/dist/{render-plan-D5oFRVBV.d.ts → render-plan-CpW32tOL.d.ts} +1 -1
  134. package/dist/{render-plan-tazUJalK.d.mts → render-plan-CtQB-zHS.d.mts} +1 -1
  135. package/dist/renderer-client.d.mts +6 -8
  136. package/dist/renderer-client.d.ts +6 -8
  137. package/dist/{request-CzZX0Aew.d.ts → request-BVGGeQv4.d.ts} +1 -1
  138. package/dist/{request-CXmQy5ks.d.mts → request-DlLVBKe3.d.mts} +1 -1
  139. package/dist/request.d.mts +9 -11
  140. package/dist/request.d.ts +9 -11
  141. package/dist/{route-rendering-Dw3C362T.d.ts → route-rendering-BdEldajn.d.ts} +1 -1
  142. package/dist/{route-rendering-B-qpe32B.d.mts → route-rendering-DChYLNdh.d.mts} +1 -1
  143. package/dist/{router-CLl3xHwl.d.ts → router-D0Az-1Nu.d.ts} +1 -1
  144. package/dist/{router-CafM2jlw.d.mts → router-D5htHn_M.d.mts} +1 -1
  145. package/dist/routes.d.mts +6 -8
  146. package/dist/routes.d.ts +6 -8
  147. package/dist/server-fn-client.d.mts +3 -4
  148. package/dist/server-fn-client.d.ts +3 -4
  149. package/dist/server-fn.d.mts +1 -1
  150. package/dist/server-fn.d.ts +1 -1
  151. package/dist/server-plugins.d.mts +8 -10
  152. package/dist/server-plugins.d.ts +8 -10
  153. package/dist/server-query-client.d.mts +1 -1
  154. package/dist/server-query-client.d.ts +1 -1
  155. package/dist/server-query.d.mts +1 -1
  156. package/dist/server-query.d.ts +1 -1
  157. package/dist/server.cjs +292 -141
  158. package/dist/server.d.mts +13 -15
  159. package/dist/server.d.ts +13 -15
  160. package/dist/server.mjs +278 -127
  161. package/dist/{spa-router-6sJfsMlQ.d.mts → spa-router-DVfSJZ5o.d.mts} +2 -2
  162. package/dist/{spa-router-DePr2aZ6.d.ts → spa-router-DmwP_7QL.d.ts} +2 -2
  163. package/dist/testing.cjs +6 -5
  164. package/dist/testing.d.mts +7 -9
  165. package/dist/testing.d.ts +7 -9
  166. package/dist/testing.mjs +5 -4
  167. package/dist/{utils-BPHr-1mP.d.mts → utils-B_Rmr0-n.d.mts} +1 -1
  168. package/dist/{utils-BBKC3cf3.d.ts → utils-Dv0OuLtF.d.ts} +1 -1
  169. package/dist/version.cjs +2 -2
  170. package/dist/version.mjs +1 -1
  171. package/dist/vite.cjs +14 -12
  172. package/dist/vite.d.mts +8 -10
  173. package/dist/vite.d.ts +8 -10
  174. package/dist/vite.mjs +13 -11
  175. package/package.json +1 -1
  176. package/dist/route-B0XrsrFk.d.mts +0 -128
  177. package/dist/route-DOEpbyWZ.d.ts +0 -128
  178. package/dist/{chunk-GDUYXFIS.mjs → chunk-6EG7U4NF.mjs} +3 -3
  179. package/dist/{chunk-YAOX43YI.cjs → chunk-C7OUJ6JI.cjs} +2 -2
  180. package/dist/{chunk-IXTFU4PL.cjs → chunk-NL3ZSMZB.cjs} +2 -2
  181. package/dist/{chunk-L6V3P73N.mjs → chunk-UOXGA6TO.mjs} +4 -4
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  compileFarmDocsAdapterEdgeManifest,
9
9
  createFarmDocsAPIHandler
10
- } from "./chunk-XME4TCLB.mjs";
10
+ } from "./chunk-4FHDV7VM.mjs";
11
11
  import {
12
12
  FARM_DOCS_LAST_MODIFIED_MANIFEST,
13
13
  createFarmDocsHandler,
@@ -17,7 +17,7 @@ import {
17
17
  loadFarmDocsPage,
18
18
  resolveFarmDocsContentDir,
19
19
  toFarmDocsMarkdownPage
20
- } from "./chunk-2KI3CL3N.mjs";
20
+ } from "./chunk-FPW4W3VW.mjs";
21
21
  import {
22
22
  generateFarmDocsSearchClientRuntime,
23
23
  isFarmDocsSearchEnabled,
@@ -25,7 +25,7 @@ import {
25
25
  } from "./chunk-UP4CW6WP.mjs";
26
26
  import {
27
27
  FARM_PRERENDER_ENV
28
- } from "./chunk-6VEHUKZ2.mjs";
28
+ } from "./chunk-MM5D6VLP.mjs";
29
29
  import {
30
30
  loadFarmDocsEngine
31
31
  } from "./chunk-2VQKKQ6D.mjs";
@@ -34,7 +34,7 @@ import {
34
34
  getDeployTargetForPreset,
35
35
  hasCustomFarmRouteContext,
36
36
  resolveDeployOutputPath
37
- } from "./chunk-5YYJ6Q2L.mjs";
37
+ } from "./chunk-WIVTGKLY.mjs";
38
38
  import {
39
39
  resolveFarmInstrumentationFile
40
40
  } from "./chunk-ZZSRYEYU.mjs";
@@ -44,6 +44,7 @@ import {
44
44
  import {
45
45
  DEFAULT_NOT_FOUND_STYLES,
46
46
  FARM_LAYOUT_ELEMENT_CLIENT_SOURCE,
47
+ HOISTED_HEAD_ELEMENT,
47
48
  PluginManager,
48
49
  SHARP_INSTALL_HINT,
49
50
  createFarmApp,
@@ -69,7 +70,7 @@ import {
69
70
  resolveFarmImageProviderForRuntime,
70
71
  resolveFarmIsolatedClientHydrationMode,
71
72
  resolveFarmNotFoundComponentPath
72
- } from "./chunk-N2Z4ZFDE.mjs";
73
+ } from "./chunk-OGHTEYXS.mjs";
73
74
  import {
74
75
  findRequestBoundSourceBlockers,
75
76
  generateFarmTypeArtifacts,
@@ -79,7 +80,7 @@ import {
79
80
  import {
80
81
  FARM_API_CATALOG_PATH,
81
82
  resolveFarmApiCatalogInput
82
- } from "./chunk-T2OPSH6S.mjs";
83
+ } from "./chunk-HG237IEY.mjs";
83
84
  import {
84
85
  isFarmPreviewDeploymentEnvironment
85
86
  } from "./chunk-BOYNDCZL.mjs";
@@ -111,7 +112,7 @@ import {
111
112
  } from "./chunk-DAATZTKJ.mjs";
112
113
  import {
113
114
  applyFarmCspHashesToHtml
114
- } from "./chunk-RR6UGYUT.mjs";
115
+ } from "./chunk-JT25KHDI.mjs";
115
116
  import {
116
117
  applyFarmCronVercelCrons,
117
118
  createFarmCronCloudflareConfig,
@@ -123,14 +124,14 @@ import {
123
124
  } from "./chunk-4OOBRCJX.mjs";
124
125
  import {
125
126
  isFarmMarkdownPageFile
126
- } from "./chunk-XM4ZDVD7.mjs";
127
+ } from "./chunk-MBFURXAC.mjs";
127
128
  import {
128
129
  resolveFarmMdxComponentsModulePath,
129
130
  resolveMdxConfig
130
131
  } from "./chunk-FA2W42OV.mjs";
131
132
  import {
132
133
  getFarmMarkdownAlternatePath
133
- } from "./chunk-U4MP7XTD.mjs";
134
+ } from "./chunk-POXI72VV.mjs";
134
135
  import {
135
136
  applyFarmWorkflowVercelCrons,
136
137
  prepareFarmWorkflowsForNitro
@@ -144,7 +145,7 @@ import {
144
145
  } from "./chunk-TIKNUAU7.mjs";
145
146
  import {
146
147
  APIRouteManager
147
- } from "./chunk-QGG336NI.mjs";
148
+ } from "./chunk-Q4BHBO6V.mjs";
148
149
  import {
149
150
  readFarmI18nCatalogs
150
151
  } from "./chunk-FV45CKBC.mjs";
@@ -6325,12 +6326,13 @@ function stripFarmDocumentWrappers(markup) {
6325
6326
  }
6326
6327
 
6327
6328
  // Farm's display:contents wrappers, and the head elements React 19 hoists in front of them
6328
- // (charset, viewport, preloads, titles) when the layout's <html> is not the render root.
6329
+ // (charset, viewport, preloads, titles, async scripts, precedence styles) when the layout's
6330
+ // <html> is not the render root. The hoistable pattern is shared with the dev renderer.
6329
6331
  function peelFarmDocumentPrefix(markup) {
6330
6332
  let inner = markup.replace(/^\\s+/, "");
6331
6333
  let hoisted = "";
6332
6334
  const wrapper = /^<div\\b[^>]*style=["']display\\s*:\\s*contents["'][^>]*>/i;
6333
- const hoistable = /^(?:<(?:meta|link|base)\\b[^>]*>|<title\\b[^>]*>[\\s\\S]*?<\\/title>)/i;
6335
+ const hoistable = /${HOISTED_HEAD_ELEMENT.source}/i;
6334
6336
  let match;
6335
6337
  while ((match = wrapper.exec(inner) || hoistable.exec(inner))) {
6336
6338
  if (!/^<div/i.test(match[0])) hoisted += match[0];
@@ -6842,7 +6844,7 @@ async function handleApplicationMetadataRouteRequest(request, routePathname) {
6842
6844
  const body = isLlmsFull && !(value instanceof Response)
6843
6845
  ? await renderFarmLlmsFullTxt(value, { origin: url.origin, readMarkdown: llmsContext.markdown })
6844
6846
  : value;
6845
- return createFarmMetadataRouteResponse(match.metadata.kind, body, routeModule, { method });
6847
+ return createFarmMetadataRouteResponse(match.metadata.kind, body, routeModule, { method, request });
6846
6848
  } catch (error) {
6847
6849
  console.error("Metadata route render failed:", error);
6848
6850
  return new Response("Internal Server Error", {
@@ -7561,6 +7563,7 @@ async function handleFarmRequestInContext(
7561
7563
  routeExists: (targetPathname) =>
7562
7564
  Boolean(matchPageRoute(getFarmRoutePathname(targetPathname))),
7563
7565
  renderPage: (targetRequest) => handleFarmRequest(targetRequest, adapterContext),
7566
+ apiServerBasePath: farmLocalAPIBasePath,
7564
7567
  });
7565
7568
  if (markdownResponse) {
7566
7569
  return applyProductionMiddlewareHeaders(markdownResponse, middlewareHeaders);
@@ -7647,7 +7650,7 @@ async function handleFarmRequestInContext(
7647
7650
  // agent.apiCatalog: list the OpenAPI and MCP surfaces at the RFC 9727 path.
7648
7651
  if (normalizeRuntimePath(routePathname) === ${JSON.stringify(FARM_API_CATALOG_PATH)}) {
7649
7652
  return applyProductionMiddlewareHeaders(
7650
- createFarmApiCatalogResponse(request.method, farmApiCatalogInput),
7653
+ createFarmApiCatalogResponse(request.method, farmApiCatalogInput, request),
7651
7654
  middlewareHeaders,
7652
7655
  );
7653
7656
  }
@@ -7669,26 +7672,34 @@ async function handleFarmRequestInContext(
7669
7672
  if (farmGeneratedLlmsKind) {
7670
7673
  const llmsContext = createFarmLlmsTxtContext(request, farmGeneratedLlmsKind === "llms-full");
7671
7674
  const llmsOrigin = new URL(request.url).origin;
7672
- const renderLlmsFull = () =>
7675
+ // A page that times out is left out, the shared render is not reused, and
7676
+ // the partial response is not cacheable.
7677
+ let llmsComplete = true;
7678
+ const renderLlmsFull = (shared) =>
7673
7679
  renderFarmLlmsFullTxt(llmsContext.defaults, {
7674
7680
  origin: llmsOrigin,
7675
7681
  readMarkdown: llmsContext.markdown,
7682
+ onIncomplete: () => {
7683
+ llmsComplete = false;
7684
+ if (shared) shared.incomplete();
7685
+ },
7676
7686
  });
7677
7687
  // HEAD reads no pages, so it neither waits for nor fills the shared render.
7678
7688
  const llmsBody = farmGeneratedLlmsKind !== "llms-full"
7679
7689
  ? llmsContext.defaults
7680
7690
  : request.method.toUpperCase() === "HEAD"
7681
7691
  ? await renderLlmsFull()
7682
- : await farmLlmsFullRenderer(llmsOrigin, renderLlmsFull);
7683
- return applyProductionMiddlewareHeaders(
7684
- createFarmMetadataRouteResponse(
7685
- farmGeneratedLlmsKind,
7686
- llmsBody,
7687
- { revalidate: farmLlmsTxtConfig.revalidate },
7688
- { method: request.method },
7689
- ),
7690
- middlewareHeaders,
7692
+ : await farmLlmsFullRenderer(llmsOrigin, renderLlmsFull, (complete) => {
7693
+ llmsComplete = complete;
7694
+ });
7695
+ const llmsResponse = createFarmMetadataRouteResponse(
7696
+ farmGeneratedLlmsKind,
7697
+ llmsBody,
7698
+ { revalidate: llmsComplete ? farmLlmsTxtConfig.revalidate : 0 },
7699
+ { method: request.method, request },
7691
7700
  );
7701
+ if (!llmsComplete) llmsResponse.headers.set("cache-control", "no-store");
7702
+ return applyProductionMiddlewareHeaders(llmsResponse, middlewareHeaders);
7692
7703
  }
7693
7704
  ` : ""}
7694
7705
 
@@ -9231,7 +9242,12 @@ export default async function farmNitroEventHandler(event) {
9231
9242
  preset,
9232
9243
  ...farmNodeServerEntryPath ? { entry: farmNodeServerEntryPath } : {},
9233
9244
  rootDir: root,
9234
- serverDir: root,
9245
+ // Farm registers every handler, task, and plugin explicitly. Scanning the
9246
+ // project root would bundle an app's own `middleware/`, `api/`, `routes/`,
9247
+ // `plugins/`, or `tasks/` folder, or a root `server.ts` (common without a
9248
+ // `src` directory), as Nitro handlers outside Farm's aliases.
9249
+ serverDir: false,
9250
+ serverEntry: false,
9235
9251
  buildDir: path5.join(root, distDir, ".nitro"),
9236
9252
  alias: resolveNitroInternalRuntimeAliases(root),
9237
9253
  compatibilityDate: "2024-12-01",
@@ -9340,13 +9356,16 @@ export default async function farmNitroEventHandler(event) {
9340
9356
  const alternatePath = getFarmMarkdownAlternatePath(config.md, route.route);
9341
9357
  if (!alternatePath) return;
9342
9358
  const routeRule = nitroInstance.options.routeRules[route.route] || {};
9343
- nitroInstance.options.routeRules[route.route] = {
9344
- ...routeRule,
9345
- headers: {
9346
- ...routeRule.headers,
9347
- Link: `<${alternatePath}>; rel="alternate"; type="text/markdown"`
9348
- }
9349
- };
9359
+ const alternate = `<${alternatePath}>; rel="alternate"; type="text/markdown"`;
9360
+ const headers = { ...routeRule.headers };
9361
+ let link;
9362
+ for (const key of Object.keys(headers)) {
9363
+ if (key.toLowerCase() !== "link") continue;
9364
+ link = link ? `${link}, ${headers[key]}` : headers[key];
9365
+ delete headers[key];
9366
+ }
9367
+ headers.Link = !link ? alternate : link.includes(alternate) ? link : `${link}, ${alternate}`;
9368
+ nitroInstance.options.routeRules[route.route] = { ...routeRule, headers };
9350
9369
  });
9351
9370
  nitroInstance.hooks.hook("prerender:done", () => {
9352
9371
  nitroInstance.routing.sync();
@@ -10247,7 +10266,7 @@ function resolveLegacyPageEntry(config, root, srcDir) {
10247
10266
  __name(resolveLegacyPageEntry, "resolveLegacyPageEntry");
10248
10267
  async function buildNitro(config, routeManager, apiRouteManager, serverRenderer, preset, root, distDir, pluginManager) {
10249
10268
  const [{ createNitroConfig }, { createNitro, build: nitroBuild }] = await Promise.all([
10250
- import("./nitro-ZKLGOTVY.mjs"),
10269
+ import("./nitro-NAKCRVHX.mjs"),
10251
10270
  import("nitro/builder")
10252
10271
  ]);
10253
10272
  let nitroConfig = await createNitroConfig(
@@ -28,7 +28,7 @@ import {
28
28
  resolveFarmNoindexPreviews,
29
29
  resolveFarmPerformanceConfig,
30
30
  resolveFarmSecurityConfig
31
- } from "./chunk-RR6UGYUT.mjs";
31
+ } from "./chunk-JT25KHDI.mjs";
32
32
  import {
33
33
  resolveFarmImageConfig
34
34
  } from "./chunk-G2KY33I6.mjs";
@@ -47,7 +47,7 @@ import {
47
47
  } from "./chunk-FA2W42OV.mjs";
48
48
  import {
49
49
  resolveMarkdownConfig
50
- } from "./chunk-U4MP7XTD.mjs";
50
+ } from "./chunk-POXI72VV.mjs";
51
51
  import {
52
52
  bundleNodeModule
53
53
  } from "./chunk-SFGWNC43.mjs";
@@ -288,6 +288,10 @@ function hasCustomFarmRouteContext(config) {
288
288
  return config[FARM_RESOLVED_CUSTOM_CONTEXT] === true;
289
289
  }
290
290
  __name(hasCustomFarmRouteContext, "hasCustomFarmRouteContext");
291
+ function isResolvedFarmConfig(config) {
292
+ return Object.prototype.hasOwnProperty.call(config, FARM_RESOLVED_CUSTOM_CONTEXT);
293
+ }
294
+ __name(isResolvedFarmConfig, "isResolvedFarmConfig");
291
295
  function normalizeDeployTarget(target) {
292
296
  if (!target) return void 0;
293
297
  if (target === "cloudflare-pages" || target === "cloudflare_pages") return "cloudflare";
@@ -876,6 +880,7 @@ __name(loadConfig, "loadConfig");
876
880
 
877
881
  export {
878
882
  hasCustomFarmRouteContext,
883
+ isResolvedFarmConfig,
879
884
  normalizeDeployTarget,
880
885
  getPresetForDeployTarget,
881
886
  getDeployTargetForPreset,
@@ -3,17 +3,20 @@
3
3
  var _chunkOWOUTKIJcjs = require('./chunk-OWOUTKIJ.cjs');
4
4
 
5
5
 
6
- var _chunkE3RDL2DAcjs = require('./chunk-E3RDL2DA.cjs');
6
+ var _chunkDQMTHWPIcjs = require('./chunk-DQMTHWPI.cjs');
7
+
8
+
9
+ var _chunkJ63ZH5OQcjs = require('./chunk-J63ZH5OQ.cjs');
7
10
 
8
11
 
9
12
  var _chunkOI6CMLWXcjs = require('./chunk-OI6CMLWX.cjs');
10
13
 
11
14
 
15
+ var _chunkTKJZFIMLcjs = require('./chunk-TKJZFIML.cjs');
12
16
 
13
- var _chunkWPYFSQKKcjs = require('./chunk-WPYFSQKK.cjs');
14
17
 
15
18
 
16
- var _chunkTKJZFIMLcjs = require('./chunk-TKJZFIML.cjs');
19
+ var _chunkWPYFSQKKcjs = require('./chunk-WPYFSQKK.cjs');
17
20
 
18
21
 
19
22
  var _chunkBIDYX3SLcjs = require('./chunk-BIDYX3SL.cjs');
@@ -201,10 +204,13 @@ function createFarmMetadataRouteResponse(kind, value, routeModule = {}, options
201
204
  if (method !== "GET" && method !== "HEAD") {
202
205
  return new Response(null, { status: 405, headers: { Allow: "GET, HEAD" } });
203
206
  }
207
+ if ((kind === "llms" || kind === "llms-full") && options.request) {
208
+ _chunkJ63ZH5OQcjs.emitFarmAgentRead.call(void 0, options.request, kind, isResponse(value) ? value.status : 200);
209
+ }
204
210
  if (isResponse(value)) {
205
211
  return method === "HEAD" ? _chunkTKJZFIMLcjs.omitFarmResponseBody.call(void 0, value) : value;
206
212
  }
207
- const body = kind === "sitemap" ? serializeSitemap(value) : kind === "robots" ? serializeRobots(value) : kind === "llms" || kind === "llms-full" ? _chunkE3RDL2DAcjs.serializeFarmLlmsTxt.call(void 0, value) : serializeManifest(value);
213
+ const body = kind === "sitemap" ? serializeSitemap(value) : kind === "robots" ? serializeRobots(value) : kind === "llms" || kind === "llms-full" ? _chunkDQMTHWPIcjs.serializeFarmLlmsTxt.call(void 0, value) : serializeManifest(value);
208
214
  const contentType = kind === "sitemap" ? "application/xml; charset=utf-8" : kind === "robots" || kind === "llms" || kind === "llms-full" ? "text/plain; charset=utf-8" : "application/manifest+json; charset=utf-8";
209
215
  return new Response(method === "HEAD" ? null : body, {
210
216
  headers: {
@@ -486,7 +492,7 @@ function createFarmApiCatalog(input) {
486
492
  };
487
493
  }
488
494
  _chunkS3JO3N4Hcjs.__name.call(void 0, createFarmApiCatalog, "createFarmApiCatalog");
489
- function createFarmApiCatalogResponse(method, input) {
495
+ function createFarmApiCatalogResponse(method, input, request) {
490
496
  const upperMethod = method.toUpperCase();
491
497
  if (upperMethod !== "GET" && upperMethod !== "HEAD") {
492
498
  return new Response("Method Not Allowed", {
@@ -494,6 +500,7 @@ function createFarmApiCatalogResponse(method, input) {
494
500
  headers: { Allow: "GET, HEAD", "Content-Type": "text/plain; charset=utf-8" }
495
501
  });
496
502
  }
503
+ if (request) _chunkJ63ZH5OQcjs.emitFarmAgentRead.call(void 0, request, "api-catalog", 200);
497
504
  const catalog = createFarmApiCatalog(input);
498
505
  return new Response(upperMethod === "HEAD" ? null : JSON.stringify(catalog), {
499
506
  status: 200,
@@ -7,7 +7,7 @@ var _chunkD7JTOLFKcjs = require('./chunk-D7JTOLFK.cjs');
7
7
 
8
8
 
9
9
 
10
- var _chunkIXTFU4PLcjs = require('./chunk-IXTFU4PL.cjs');
10
+ var _chunkNL3ZSMZBcjs = require('./chunk-NL3ZSMZB.cjs');
11
11
 
12
12
 
13
13
  var _chunkLTNGXMQ6cjs = require('./chunk-LTNGXMQ6.cjs');
@@ -147,9 +147,9 @@ function useMutationLifecycle(target, options = {}) {
147
147
  };
148
148
  });
149
149
  const mutationTarget = targetRef.current;
150
- const isAPITarget = _chunkIXTFU4PLcjs.isAPIRouteRef.call(void 0, mutationTarget);
150
+ const isAPITarget = _chunkNL3ZSMZBcjs.isAPIRouteRef.call(void 0, mutationTarget);
151
151
  const sharedOptimistic = !preparationFailed && !isAPITarget ? _optionalChain([currentOptions, 'access', _3 => _3.request, 'optionalAccess', _4 => _4.optimistic]) : void 0;
152
- const sharedSnapshots = _optionalChain([sharedOptimistic, 'optionalAccess', _5 => _5.update, 'optionalAccess', _6 => _6.length]) ? _chunkIXTFU4PLcjs.applyServerFnOptimisticUpdates.call(void 0, sharedOptimistic.update) : [];
152
+ const sharedSnapshots = _optionalChain([sharedOptimistic, 'optionalAccess', _5 => _5.update, 'optionalAccess', _6 => _6.length]) ? _chunkNL3ZSMZBcjs.applyServerFnOptimisticUpdates.call(void 0, sharedOptimistic.update) : [];
153
153
  try {
154
154
  if (preparationFailed) throw preparationError;
155
155
  let data;
@@ -176,9 +176,9 @@ function useMutationLifecycle(target, options = {}) {
176
176
  throw cause;
177
177
  }
178
178
  }
179
- _chunkIXTFU4PLcjs.settleServerFnOptimisticUpdates.call(void 0, sharedSnapshots, "commit");
179
+ _chunkNL3ZSMZBcjs.settleServerFnOptimisticUpdates.call(void 0, sharedSnapshots, "commit");
180
180
  if (!isAPITarget && _optionalChain([currentOptions, 'access', _9 => _9.request, 'optionalAccess', _10 => _10.invalidate])) {
181
- for (const key of _chunkIXTFU4PLcjs.resolveServerFnInvalidateTargets.call(void 0, currentOptions.request.invalidate)) {
181
+ for (const key of _chunkNL3ZSMZBcjs.resolveServerFnInvalidateTargets.call(void 0, currentOptions.request.invalidate)) {
182
182
  _chunkZEG3OPIBcjs.notifyFarmCacheInvalidation.call(void 0, key);
183
183
  }
184
184
  }
@@ -213,7 +213,7 @@ function useMutationLifecycle(target, options = {}) {
213
213
  }
214
214
  return data;
215
215
  } catch (cause) {
216
- _chunkIXTFU4PLcjs.settleServerFnOptimisticUpdates.call(void 0,
216
+ _chunkNL3ZSMZBcjs.settleServerFnOptimisticUpdates.call(void 0,
217
217
  sharedSnapshots,
218
218
  _optionalChain([sharedOptimistic, 'optionalAccess', _11 => _11.rollbackOnError]) ? "rollback" : "invalidate"
219
219
  );
@@ -389,7 +389,7 @@ function useFetcher(target, options = {}) {
389
389
  const Form = _react.useMemo.call(void 0, () => {
390
390
  const FetcherForm = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, ({ action, method, encType, onSubmit, ...props }) => {
391
391
  const targetValue = targetRef.current;
392
- const metadata = _chunkIXTFU4PLcjs.getAPIRouteRefMetadata.call(void 0, targetValue);
392
+ const metadata = _chunkNL3ZSMZBcjs.getAPIRouteRefMetadata.call(void 0, targetValue);
393
393
  const nativeAction = _nullishCoalesce(action, () => ( resolveFetcherFormAction(targetValue, metadata)));
394
394
  const nativeMethod = _nullishCoalesce(method, () => ( (metadata && (metadata.method === "GET" || metadata.method === "POST") ? metadata.method.toLowerCase() : metadata ? "post" : void 0)));
395
395
  const functionAction = typeof nativeAction === "function";
@@ -458,10 +458,10 @@ function mapFetcherFormData(target, formData, options) {
458
458
  if (options.mapFormData) {
459
459
  return options.mapFormData(formData, context);
460
460
  }
461
- if (!_chunkIXTFU4PLcjs.isAPIRouteRef.call(void 0, target)) {
461
+ if (!_chunkNL3ZSMZBcjs.isAPIRouteRef.call(void 0, target)) {
462
462
  return formData;
463
463
  }
464
- const method = _optionalChain([_chunkIXTFU4PLcjs.getAPIRouteRefMetadata.call(void 0, target), 'optionalAccess', _14 => _14.method]);
464
+ const method = _optionalChain([_chunkNL3ZSMZBcjs.getAPIRouteRefMetadata.call(void 0, target), 'optionalAccess', _14 => _14.method]);
465
465
  const query = method === "GET" || method === "HEAD";
466
466
  const encoding = _nullishCoalesce(_optionalChain([context, 'access', _15 => _15.submitter, 'optionalAccess', _16 => _16.getAttribute, 'call', _17 => _17("formenctype")]), () => ( _optionalChain([context, 'access', _18 => _18.form, 'optionalAccess', _19 => _19.enctype])));
467
467
  if (!query && (_optionalChain([encoding, 'optionalAccess', _20 => _20.toLowerCase, 'call', _21 => _21()]) === "multipart/form-data" || Array.from(formData.values()).some((value) => typeof value !== "string"))) {