@farm.js/core 0.1.24 → 0.1.26

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 (167) hide show
  1. package/dist/agent-runtime.d.mts +2 -2
  2. package/dist/agent-runtime.d.ts +2 -2
  3. package/dist/api/route-manager.cjs +4 -4
  4. package/dist/api/route-manager.d.mts +2 -2
  5. package/dist/api/route-manager.d.ts +2 -2
  6. package/dist/api/route-manager.mjs +3 -3
  7. package/dist/api/runtime.cjs +3 -3
  8. package/dist/api/runtime.mjs +2 -2
  9. package/dist/api.cjs +7 -7
  10. package/dist/api.d.mts +3 -3
  11. package/dist/api.d.ts +3 -3
  12. package/dist/api.mjs +6 -6
  13. package/dist/{app-BZDWwwFa.d.mts → app-29vG5tmY.d.mts} +3 -3
  14. package/dist/{app-BV-7wV5q.d.ts → app-Cx71s_PT.d.ts} +3 -3
  15. package/dist/app-markdown.cjs +6 -4
  16. package/dist/app-markdown.d.mts +3 -3
  17. package/dist/app-markdown.d.ts +3 -3
  18. package/dist/app-markdown.mjs +5 -3
  19. package/dist/{chunk-ISTFC3MZ.cjs → chunk-2CT6XUNO.cjs} +99 -26
  20. package/dist/{chunk-G6GNNB44.cjs → chunk-3TQG7CGC.cjs} +201 -180
  21. package/dist/{chunk-KNPRCKXK.cjs → chunk-3TQWUUNP.cjs} +9 -7
  22. package/dist/{chunk-LYM7HY34.cjs → chunk-3WSWXPYM.cjs} +4 -4
  23. package/dist/{chunk-GZ3ZPTQV.mjs → chunk-52SH7TKB.mjs} +2 -2
  24. package/dist/{chunk-JIKGGIOL.mjs → chunk-6D242YGO.mjs} +1 -1
  25. package/dist/{chunk-MVUREHPN.mjs → chunk-74RZNRY6.mjs} +1 -1
  26. package/dist/{chunk-BD7FZ63M.cjs → chunk-ALIFMS4A.cjs} +1 -1
  27. package/dist/{chunk-PGQBL5DN.mjs → chunk-ARXCHQLX.mjs} +79 -2
  28. package/dist/{chunk-2QLBIPFT.cjs → chunk-B6ZCT36X.cjs} +4 -4
  29. package/dist/{chunk-IMBMOEWT.cjs → chunk-BD2U4ZL6.cjs} +8 -8
  30. package/dist/{chunk-2M435BUE.mjs → chunk-CEYUWDWA.mjs} +7 -5
  31. package/dist/{chunk-XI3GWPUS.cjs → chunk-CRQPYWLK.cjs} +14 -14
  32. package/dist/{chunk-47H7VENP.mjs → chunk-DU2CASV6.mjs} +1 -1
  33. package/dist/{chunk-QTBEAKCJ.cjs → chunk-H7CJRJ4L.cjs} +16 -16
  34. package/dist/chunk-J63ZH5OQ.cjs +62 -0
  35. package/dist/{chunk-N255VYFP.mjs → chunk-JM5GQL4H.mjs} +8 -3
  36. package/dist/{chunk-6VEHUKZ2.mjs → chunk-MM5D6VLP.mjs} +4 -20
  37. package/dist/chunk-MVL2RAJW.mjs +62 -0
  38. package/dist/{chunk-YA6LLTIJ.cjs → chunk-ND224OE2.cjs} +4 -20
  39. package/dist/{chunk-YGMK6ESJ.mjs → chunk-OFKG57MZ.mjs} +2 -2
  40. package/dist/chunk-OOIL3BWR.mjs +1229 -0
  41. package/dist/{chunk-BNSD3VDY.mjs → chunk-PPIW3MH6.mjs} +1 -1
  42. package/dist/{chunk-WNUBR4CA.mjs → chunk-QGG336NI.mjs} +1 -1
  43. package/dist/chunk-QIH2HD6H.cjs +1229 -0
  44. package/dist/{chunk-OYDRPBBV.cjs → chunk-QJ4D3UKJ.cjs} +80 -3
  45. package/dist/{chunk-LQIRVSBY.cjs → chunk-QLXEYIAW.cjs} +13 -13
  46. package/dist/{chunk-ARHWIOUZ.mjs → chunk-QPPQHB6X.mjs} +111 -40
  47. package/dist/{chunk-7BC6GAL7.mjs → chunk-RAI7NULA.mjs} +76 -3
  48. package/dist/{chunk-AH7HOAQ3.cjs → chunk-RCYINC4A.cjs} +9 -4
  49. package/dist/{chunk-SIQMTHCZ.cjs → chunk-SZ4LYNUX.cjs} +212 -141
  50. package/dist/{chunk-5UX4C5QI.mjs → chunk-TKDY6AJP.mjs} +1 -1
  51. package/dist/{chunk-YJJLXIIS.cjs → chunk-U74A3P2P.cjs} +7 -7
  52. package/dist/{chunk-6YSEHN46.mjs → chunk-UXQXGB5A.mjs} +36 -15
  53. package/dist/{chunk-72VJRKJD.mjs → chunk-VZWO3XVL.mjs} +2 -2
  54. package/dist/{chunk-I5YBCWQ6.cjs → chunk-W2HZKYES.cjs} +2 -2
  55. package/dist/{chunk-DNLQMFER.cjs → chunk-WFPRVVF2.cjs} +26 -19
  56. package/dist/{chunk-BDJNP7AQ.mjs → chunk-YMUH2BLR.mjs} +10 -3
  57. package/dist/{client-plugins-B_XzCegf.d.mts → client-plugins-B8RPJnot.d.mts} +129 -4
  58. package/dist/{client-plugins-CKsXQfXY.d.ts → client-plugins-bPBf4haK.d.ts} +129 -4
  59. package/dist/client-plugins.d.mts +2 -2
  60. package/dist/client-plugins.d.ts +2 -2
  61. package/dist/client.cjs +4 -4
  62. package/dist/client.d.mts +6 -6
  63. package/dist/client.d.ts +6 -6
  64. package/dist/client.mjs +3 -3
  65. package/dist/config.d.mts +2 -2
  66. package/dist/config.d.ts +2 -2
  67. package/dist/{devtools-OY4SNU3P.mjs → devtools-5D4ZDRPR.mjs} +5 -3
  68. package/dist/{devtools-UHRSZ7VA.cjs → devtools-QZJEUOJW.cjs} +6 -4
  69. package/dist/docs.cjs +8 -6
  70. package/dist/docs.mjs +7 -5
  71. package/dist/index.cjs +29 -23
  72. package/dist/index.d.mts +14 -14
  73. package/dist/index.d.ts +14 -14
  74. package/dist/index.mjs +28 -22
  75. package/dist/integrations.d.mts +2 -2
  76. package/dist/integrations.d.ts +2 -2
  77. package/dist/internal/app-markdown-runtime.cjs +5 -3
  78. package/dist/internal/app-markdown-runtime.d.mts +2 -2
  79. package/dist/internal/app-markdown-runtime.d.ts +2 -2
  80. package/dist/internal/app-markdown-runtime.mjs +4 -2
  81. package/dist/internal/build-runtime.cjs +18 -17
  82. package/dist/internal/build-runtime.d.mts +4 -4
  83. package/dist/internal/build-runtime.d.ts +4 -4
  84. package/dist/internal/build-runtime.mjs +17 -16
  85. package/dist/internal/cli-runtime.cjs +6 -5
  86. package/dist/internal/cli-runtime.mjs +5 -4
  87. package/dist/internal/client-error-overlay.cjs +4 -4
  88. package/dist/internal/client-error-overlay.mjs +1 -1
  89. package/dist/internal/compression-runtime.d.mts +2 -2
  90. package/dist/internal/compression-runtime.d.ts +2 -2
  91. package/dist/internal/config-runtime.cjs +6 -4
  92. package/dist/internal/config-runtime.d.mts +3 -3
  93. package/dist/internal/config-runtime.d.ts +3 -3
  94. package/dist/internal/config-runtime.mjs +5 -3
  95. package/dist/internal/infra-analytics-runtime.cjs +4 -3
  96. package/dist/internal/infra-analytics-runtime.mjs +2 -1
  97. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  98. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  99. package/dist/internal/production-runtime.cjs +12 -5
  100. package/dist/internal/production-runtime.d.mts +33 -9
  101. package/dist/internal/production-runtime.d.ts +33 -9
  102. package/dist/internal/production-runtime.mjs +11 -4
  103. package/dist/markdown.cjs +6 -2
  104. package/dist/markdown.d.mts +63 -1
  105. package/dist/markdown.d.ts +63 -1
  106. package/dist/markdown.mjs +5 -1
  107. package/dist/{metadata-B08w4EYV.d.mts → metadata-C3na4CBj.d.mts} +1 -1
  108. package/dist/{metadata-IQEblkZp.d.ts → metadata-CzBP4Mfp.d.ts} +1 -1
  109. package/dist/middleware.d.mts +4 -4
  110. package/dist/middleware.d.ts +4 -4
  111. package/dist/navigation.cjs +5 -5
  112. package/dist/navigation.d.mts +5 -5
  113. package/dist/navigation.d.ts +5 -5
  114. package/dist/navigation.mjs +4 -4
  115. package/dist/observability-BupkiN0m.d.mts +447 -0
  116. package/dist/observability-BupkiN0m.d.ts +447 -0
  117. package/dist/observability.d.mts +2 -417
  118. package/dist/observability.d.ts +2 -417
  119. package/dist/plugin.cjs +13 -12
  120. package/dist/plugin.d.mts +2 -2
  121. package/dist/plugin.d.ts +2 -2
  122. package/dist/plugin.mjs +12 -11
  123. package/dist/{production-runtime-DRSOkc-d.d.ts → production-runtime-CYg4wM4E.d.ts} +1 -1
  124. package/dist/{production-runtime-C3bGFEaM.d.mts → production-runtime-DP94hPGe.d.mts} +1 -1
  125. package/dist/query/client.cjs +6 -6
  126. package/dist/query/client.mjs +2 -2
  127. package/dist/{render-plan-CCFuMLNS.d.ts → render-plan-Bl6Fzg5z.d.ts} +1 -1
  128. package/dist/{render-plan-B6CKNl4e.d.mts → render-plan-CKAJg0jC.d.mts} +1 -1
  129. package/dist/renderer-client.cjs +5 -5
  130. package/dist/renderer-client.d.mts +4 -4
  131. package/dist/renderer-client.d.ts +4 -4
  132. package/dist/renderer-client.mjs +2 -2
  133. package/dist/{request-Dn6VURbE.d.ts → request-CR-Bp1Px.d.ts} +1 -1
  134. package/dist/{request-DgD1XsTx.d.mts → request-CrBCcPZZ.d.mts} +1 -1
  135. package/dist/request.d.mts +3 -3
  136. package/dist/request.d.ts +3 -3
  137. package/dist/{route-rendering-76A5I_kE.d.mts → route-rendering-C1NAHo-C.d.mts} +1 -1
  138. package/dist/{route-rendering-LAmQEdyG.d.ts → route-rendering-CZH5FegB.d.ts} +1 -1
  139. package/dist/{router-CnrRSa9d.d.mts → router-B57eDJ3u.d.mts} +1 -1
  140. package/dist/{router-BSOOGya2.d.ts → router-Cg_kD3Bd.d.ts} +1 -1
  141. package/dist/routes.d.mts +2 -2
  142. package/dist/routes.d.ts +2 -2
  143. package/dist/server-plugins.d.mts +3 -3
  144. package/dist/server-plugins.d.ts +3 -3
  145. package/dist/server.cjs +163 -106
  146. package/dist/server.d.mts +8 -8
  147. package/dist/server.d.ts +8 -8
  148. package/dist/server.mjs +144 -87
  149. package/dist/{spa-router-BMrSsG5b.d.ts → spa-router-BstQUO6Q.d.ts} +2 -2
  150. package/dist/{spa-router-DnYhWCvI.d.mts → spa-router-DTdbuinx.d.mts} +2 -2
  151. package/dist/testing.cjs +4 -4
  152. package/dist/testing.d.mts +2 -2
  153. package/dist/testing.d.ts +2 -2
  154. package/dist/testing.mjs +3 -3
  155. package/dist/{utils-ABkktwku.d.mts → utils-CS3ZLnEJ.d.mts} +1 -1
  156. package/dist/{utils-C3GguS-Q.d.ts → utils-D3rdsIvM.d.ts} +1 -1
  157. package/dist/version.cjs +2 -2
  158. package/dist/version.mjs +1 -1
  159. package/dist/vite.cjs +13 -12
  160. package/dist/vite.d.mts +2 -2
  161. package/dist/vite.d.ts +2 -2
  162. package/dist/vite.mjs +12 -11
  163. package/package.json +1 -1
  164. package/dist/chunk-BBVSJVBZ.cjs +0 -600
  165. package/dist/chunk-OFEY6KHO.mjs +0 -600
  166. package/dist/{chunk-XP777LRD.mjs → chunk-GDUYXFIS.mjs} +3 -3
  167. package/dist/{chunk-4PNUXIVU.cjs → chunk-YAOX43YI.cjs} +3 -3
@@ -2,7 +2,10 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkBBVSJVBZcjs = require('./chunk-BBVSJVBZ.cjs');
5
+ var _chunkQIH2HD6Hcjs = require('./chunk-QIH2HD6H.cjs');
6
+
7
+
8
+ var _chunkJ63ZH5OQcjs = require('./chunk-J63ZH5OQ.cjs');
6
9
 
7
10
 
8
11
  var _chunkI57LW5VZcjs = require('./chunk-I57LW5VZ.cjs');
@@ -63,11 +66,12 @@ function collectFarmLlmsTxtPages(sources, options) {
63
66
  for (const source of sources) {
64
67
  const path = source.pattern;
65
68
  if (path.includes("[") || pages.has(path)) continue;
66
- if (include.length && !include.some((pattern) => _chunkBBVSJVBZcjs.matchesFarmMarkdownRoutePattern.call(void 0, pattern, path))) {
69
+ if (include.length && !include.some((pattern) => _chunkQIH2HD6Hcjs.matchesFarmMarkdownRoutePattern.call(void 0, pattern, path))) {
67
70
  continue;
68
71
  }
69
- if (exclude.some((pattern) => _chunkBBVSJVBZcjs.matchesFarmMarkdownRoutePattern.call(void 0, pattern, path))) continue;
70
- const target = _chunkBBVSJVBZcjs.isFarmMarkdownMirrorExposed.call(void 0, options.markdown, path) ? _chunkBBVSJVBZcjs.getFarmMarkdownMirrorPath.call(void 0, path) : path;
72
+ if (exclude.some((pattern) => _chunkQIH2HD6Hcjs.matchesFarmMarkdownRoutePattern.call(void 0, pattern, path))) continue;
73
+ if (isMetadataNoIndex(source.metadata)) continue;
74
+ const target = _chunkQIH2HD6Hcjs.isFarmMarkdownMirrorExposed.call(void 0, options.markdown, path) ? _chunkQIH2HD6Hcjs.getFarmMarkdownMirrorPath.call(void 0, path) : path;
71
75
  const description = readMetadataString(source.metadata, "description");
72
76
  pages.set(path, {
73
77
  path,
@@ -79,6 +83,17 @@ function collectFarmLlmsTxtPages(sources, options) {
79
83
  return [...pages.values()].sort((left, right) => left.path.localeCompare(right.path));
80
84
  }
81
85
  _chunkS3JO3N4Hcjs.__name.call(void 0, collectFarmLlmsTxtPages, "collectFarmLlmsTxtPages");
86
+ function isMetadataNoIndex(metadata) {
87
+ if (!metadata || typeof metadata !== "object") return false;
88
+ const robots = metadata.robots;
89
+ if (typeof robots === "string") {
90
+ return robots.split(",").map((directive) => directive.trim().toLowerCase()).some((directive) => directive === "noindex" || directive === "none");
91
+ }
92
+ return Boolean(
93
+ robots && typeof robots === "object" && robots.index === false
94
+ );
95
+ }
96
+ _chunkS3JO3N4Hcjs.__name.call(void 0, isMetadataNoIndex, "isMetadataNoIndex");
82
97
  function createFarmDefaultLlmsTxt(options) {
83
98
  const { config, pages } = options;
84
99
  const summary = _nullishCoalesce(config.summary, () => ( readMetadataString(options.rootMetadata, "description")));
@@ -146,7 +161,9 @@ function createFarmLlmsMarkdownReader(fetchMarkdown) {
146
161
  return async (url) => {
147
162
  try {
148
163
  const response = await fetchMarkdown(
149
- new Request(url, { headers: { accept: "text/markdown" } })
164
+ new Request(url, {
165
+ headers: { accept: "text/markdown", [_chunkJ63ZH5OQcjs.FARM_INTERNAL_READ_HEADER]: "llms-full" }
166
+ })
150
167
  );
151
168
  const type = _nullishCoalesce(response.headers.get("content-type"), () => ( ""));
152
169
  if (!response.ok || !type.toLowerCase().startsWith("text/markdown")) {
@@ -160,6 +177,8 @@ function createFarmLlmsMarkdownReader(fetchMarkdown) {
160
177
  };
161
178
  }
162
179
  _chunkS3JO3N4Hcjs.__name.call(void 0, createFarmLlmsMarkdownReader, "createFarmLlmsMarkdownReader");
180
+ var FARM_LLMS_FULL_PAGE_TIMEOUT_MS = 3e4;
181
+ var LLMS_PAGE_TIMED_OUT = /* @__PURE__ */ Symbol("farm.llms.pageTimedOut");
163
182
  async function renderFarmLlmsFullTxt(value, options) {
164
183
  const index = serializeFarmLlmsTxt(value);
165
184
  if (typeof value === "string") return index;
@@ -173,17 +192,32 @@ async function renderFarmLlmsFullTxt(value, options) {
173
192
  links.push(link);
174
193
  }
175
194
  }
195
+ const pageTimeout = _nullishCoalesce(options.pageTimeout, () => ( FARM_LLMS_FULL_PAGE_TIMEOUT_MS));
196
+ const readWithinTimeout = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async (url) => {
197
+ let timer;
198
+ const timedOut = new Promise((resolve) => {
199
+ timer = setTimeout(resolve, pageTimeout, LLMS_PAGE_TIMED_OUT);
200
+ });
201
+ try {
202
+ const content = await Promise.race([options.readMarkdown(url), timedOut]);
203
+ if (content !== LLMS_PAGE_TIMED_OUT) return content;
204
+ _optionalChain([options, 'access', _14 => _14.onIncomplete, 'optionalCall', _15 => _15()]);
205
+ return null;
206
+ } finally {
207
+ clearTimeout(timer);
208
+ }
209
+ }, "readWithinTimeout");
176
210
  const contents = await mapWithConcurrency(
177
211
  links,
178
212
  _nullishCoalesce(options.concurrency, () => ( 4)),
179
- (link) => shouldInlineLlmsLink(link.url, options.origin) ? options.readMarkdown(link.url) : null
213
+ (link) => shouldInlineLlmsLink(link.url, options.origin) ? readWithinTimeout(link.url) : null
180
214
  );
181
215
  const blocks = [`# ${toSingleLine(llms.title)}`];
182
- if (_optionalChain([llms, 'access', _14 => _14.summary, 'optionalAccess', _15 => _15.trim, 'call', _16 => _16()])) blocks.push(`> ${toSingleLine(llms.summary)}`);
183
- if (_optionalChain([llms, 'access', _17 => _17.details, 'optionalAccess', _18 => _18.trim, 'call', _19 => _19()])) blocks.push(llms.details.trim());
216
+ if (_optionalChain([llms, 'access', _16 => _16.summary, 'optionalAccess', _17 => _17.trim, 'call', _18 => _18()])) blocks.push(`> ${toSingleLine(llms.summary)}`);
217
+ if (_optionalChain([llms, 'access', _19 => _19.details, 'optionalAccess', _20 => _20.trim, 'call', _21 => _21()])) blocks.push(llms.details.trim());
184
218
  const pages = links.map((link, index2) => {
185
219
  const parts = [`## ${toSingleLine(link.title)}`, `URL: ${escapeLinkUrl(link.url)}`];
186
- if (_optionalChain([link, 'access', _20 => _20.description, 'optionalAccess', _21 => _21.trim, 'call', _22 => _22()])) parts.push(toSingleLine(link.description));
220
+ if (_optionalChain([link, 'access', _22 => _22.description, 'optionalAccess', _23 => _23.trim, 'call', _24 => _24()])) parts.push(toSingleLine(link.description));
187
221
  const content = stripFrontmatter(_nullishCoalesce(contents[index2], () => ( ""))).trim();
188
222
  if (content) parts.push(content);
189
223
  return parts.join("\n\n");
@@ -193,6 +227,44 @@ async function renderFarmLlmsFullTxt(value, options) {
193
227
  `;
194
228
  }
195
229
  _chunkS3JO3N4Hcjs.__name.call(void 0, renderFarmLlmsFullTxt, "renderFarmLlmsFullTxt");
230
+ function createFarmLlmsFullRenderer(options = {}) {
231
+ const now = _nullishCoalesce(options.now, () => ( Date.now));
232
+ const ttl = (_nullishCoalesce(options.revalidate, () => ( 0))) * 1e3;
233
+ const maxEntries = _nullishCoalesce(options.maxEntries, () => ( 16));
234
+ const entries = /* @__PURE__ */ new Map();
235
+ let queue = Promise.resolve();
236
+ const settle = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, (body, complete, onSettled) => onSettled ? body.then((value) => (onSettled(complete()), value)) : body, "settle");
237
+ return (origin, render, onSettled) => {
238
+ const entry = entries.get(origin);
239
+ if (entry && entry.expires > now()) return settle(entry.body, entry.complete, onSettled);
240
+ entries.delete(origin);
241
+ let complete = true;
242
+ const body = queue.then(
243
+ () => render({
244
+ incomplete: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => {
245
+ complete = false;
246
+ }, "incomplete")
247
+ })
248
+ );
249
+ queue = body.catch(() => {
250
+ });
251
+ const pending = { body, expires: Number.POSITIVE_INFINITY, complete: /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, () => complete, "complete") };
252
+ entries.set(origin, pending);
253
+ if (entries.size > maxEntries) entries.delete(entries.keys().next().value);
254
+ body.then(
255
+ () => {
256
+ if (entries.get(origin) !== pending) return;
257
+ if (ttl > 0 && complete) pending.expires = now() + ttl;
258
+ else entries.delete(origin);
259
+ },
260
+ () => {
261
+ if (entries.get(origin) === pending) entries.delete(origin);
262
+ }
263
+ );
264
+ return settle(body, pending.complete, onSettled);
265
+ };
266
+ }
267
+ _chunkS3JO3N4Hcjs.__name.call(void 0, createFarmLlmsFullRenderer, "createFarmLlmsFullRenderer");
196
268
  function stripFrontmatter(markdown) {
197
269
  const match = /^\uFEFF?---\r?\n[\s\S]*?\r?\n---[ \t]*(?:\r?\n|$)/.exec(markdown);
198
270
  return match ? markdown.slice(match[0].length) : markdown;
@@ -581,7 +653,7 @@ async function applyFarmCspHashesToHtml(html, security) {
581
653
  _chunkS3JO3N4Hcjs.__name.call(void 0, applyFarmCspHashesToHtml, "applyFarmCspHashesToHtml");
582
654
  function applyFarmCspNonceToResponse(response, security) {
583
655
  if (!security.csp || !security.csp.nonce) return response;
584
- if (!_optionalChain([response, 'access', _23 => _23.headers, 'access', _24 => _24.get, 'call', _25 => _25("content-type"), 'optionalAccess', _26 => _26.toLowerCase, 'call', _27 => _27(), 'access', _28 => _28.includes, 'call', _29 => _29("text/html")])) return response;
656
+ if (!_optionalChain([response, 'access', _25 => _25.headers, 'access', _26 => _26.get, 'call', _27 => _27("content-type"), 'optionalAccess', _28 => _28.toLowerCase, 'call', _29 => _29(), 'access', _30 => _30.includes, 'call', _31 => _31("text/html")])) return response;
585
657
  const nonce = createFarmCspNonce(security);
586
658
  const securityHeader = getFarmSecurityHeader(security, nonce);
587
659
  const headers = new Headers(response.headers);
@@ -802,7 +874,7 @@ var rawTextElements = /* @__PURE__ */ new Map([
802
874
  ["xmp", /<\/xmp(?=[\s/>]|$)/gi]
803
875
  ]);
804
876
  function stampScriptTag(tag, nonce) {
805
- const opening = _optionalChain([tag, 'access', _30 => _30.match, 'call', _31 => _31(/^<script\b/i), 'optionalAccess', _32 => _32[0]]);
877
+ const opening = _optionalChain([tag, 'access', _32 => _32.match, 'call', _33 => _33(/^<script\b/i), 'optionalAccess', _34 => _34[0]]);
806
878
  if (!opening) return tag;
807
879
  const attributes = stripScriptNonceAttribute(tag).slice(opening.length, -1);
808
880
  return `<script nonce="${nonce}"${attributes}>`;
@@ -858,7 +930,7 @@ function collectFarmInlineScriptContents(html) {
858
930
  }
859
931
  _chunkS3JO3N4Hcjs.__name.call(void 0, collectFarmInlineScriptContents, "collectFarmInlineScriptContents");
860
932
  function findScriptTagAttributeRange(tag, expectedName) {
861
- const opening = _optionalChain([tag, 'access', _33 => _33.match, 'call', _34 => _34(/^<script\b/i), 'optionalAccess', _35 => _35[0]]);
933
+ const opening = _optionalChain([tag, 'access', _35 => _35.match, 'call', _36 => _36(/^<script\b/i), 'optionalAccess', _37 => _37[0]]);
862
934
  if (!opening) return void 0;
863
935
  let offset = opening.length;
864
936
  while (offset < tag.length - 1) {
@@ -888,7 +960,7 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, findScriptTagAttributeRange, "findScriptTa
888
960
  function findRawTextEnd(input, tagName, offset = 0) {
889
961
  const closing = rawTextElements.get(tagName);
890
962
  closing.lastIndex = offset;
891
- return _nullishCoalesce(_optionalChain([closing, 'access', _36 => _36.exec, 'call', _37 => _37(input), 'optionalAccess', _38 => _38.index]), () => ( -1));
963
+ return _nullishCoalesce(_optionalChain([closing, 'access', _38 => _38.exec, 'call', _39 => _39(input), 'optionalAccess', _40 => _40.index]), () => ( -1));
892
964
  }
893
965
  _chunkS3JO3N4Hcjs.__name.call(void 0, findRawTextEnd, "findRawTextEnd");
894
966
  function matchingSuffixLength(input, token) {
@@ -934,9 +1006,9 @@ var MAX_REPORTED_PRELOAD_WARNINGS = 256;
934
1006
  function resolveFarmPerformanceConfig(config) {
935
1007
  return {
936
1008
  preload: {
937
- mode: _optionalChain([config, 'optionalAccess', _39 => _39.preload, 'optionalAccess', _40 => _40.mode]) === "warn" ? "warn" : "enforce",
938
- maxImages: normalizeBudget(_optionalChain([config, 'optionalAccess', _41 => _41.preload, 'optionalAccess', _42 => _42.maxImages]), DEFAULT_PRELOAD_CONFIG.maxImages),
939
- maxFonts: normalizeBudget(_optionalChain([config, 'optionalAccess', _43 => _43.preload, 'optionalAccess', _44 => _44.maxFonts]), DEFAULT_PRELOAD_CONFIG.maxFonts)
1009
+ mode: _optionalChain([config, 'optionalAccess', _41 => _41.preload, 'optionalAccess', _42 => _42.mode]) === "warn" ? "warn" : "enforce",
1010
+ maxImages: normalizeBudget(_optionalChain([config, 'optionalAccess', _43 => _43.preload, 'optionalAccess', _44 => _44.maxImages]), DEFAULT_PRELOAD_CONFIG.maxImages),
1011
+ maxFonts: normalizeBudget(_optionalChain([config, 'optionalAccess', _45 => _45.preload, 'optionalAccess', _46 => _46.maxFonts]), DEFAULT_PRELOAD_CONFIG.maxFonts)
940
1012
  }
941
1013
  };
942
1014
  }
@@ -950,7 +1022,7 @@ function manageFarmHtmlPreloads(html, config) {
950
1022
  index,
951
1023
  kind,
952
1024
  href: readHtmlAttribute(element.value, "href"),
953
- highPriority: _optionalChain([readHtmlAttribute, 'call', _45 => _45(element.value, "fetchpriority"), 'optionalAccess', _46 => _46.toLowerCase, 'call', _47 => _47()]) === "high"
1025
+ highPriority: _optionalChain([readHtmlAttribute, 'call', _47 => _47(element.value, "fetchpriority"), 'optionalAccess', _48 => _48.toLowerCase, 'call', _49 => _49()]) === "high"
954
1026
  }
955
1027
  ] : [];
956
1028
  });
@@ -974,7 +1046,7 @@ function manageFarmLinkHeaderPreloads(value, config) {
974
1046
  index,
975
1047
  kind,
976
1048
  href: getLinkHeaderTarget(link),
977
- highPriority: _optionalChain([getLinkHeaderParameter, 'call', _48 => _48(link, "fetchpriority"), 'optionalAccess', _49 => _49.toLowerCase, 'call', _50 => _50()]) === "high"
1049
+ highPriority: _optionalChain([getLinkHeaderParameter, 'call', _50 => _50(link, "fetchpriority"), 'optionalAccess', _51 => _51.toLowerCase, 'call', _52 => _52()]) === "high"
978
1050
  }
979
1051
  ] : [];
980
1052
  });
@@ -997,7 +1069,7 @@ function manageFarmDocumentPreloads(html, linkHeader, config) {
997
1069
  index,
998
1070
  kind,
999
1071
  href: readHtmlAttribute(element.value, "href"),
1000
- highPriority: _optionalChain([readHtmlAttribute, 'call', _51 => _51(element.value, "fetchpriority"), 'optionalAccess', _52 => _52.toLowerCase, 'call', _53 => _53()]) === "high"
1072
+ highPriority: _optionalChain([readHtmlAttribute, 'call', _53 => _53(element.value, "fetchpriority"), 'optionalAccess', _54 => _54.toLowerCase, 'call', _55 => _55()]) === "high"
1001
1073
  });
1002
1074
  }
1003
1075
  for (const [index, link] of links.entries()) {
@@ -1007,7 +1079,7 @@ function manageFarmDocumentPreloads(html, linkHeader, config) {
1007
1079
  index: headerOffset + index,
1008
1080
  kind,
1009
1081
  href: getLinkHeaderTarget(link),
1010
- highPriority: _optionalChain([getLinkHeaderParameter, 'call', _54 => _54(link, "fetchpriority"), 'optionalAccess', _55 => _55.toLowerCase, 'call', _56 => _56()]) === "high"
1082
+ highPriority: _optionalChain([getLinkHeaderParameter, 'call', _56 => _56(link, "fetchpriority"), 'optionalAccess', _57 => _57.toLowerCase, 'call', _58 => _58()]) === "high"
1011
1083
  });
1012
1084
  }
1013
1085
  const budget = selectPreloadsWithinBudget(candidates, config);
@@ -1088,13 +1160,13 @@ function selectPreloadsWithinBudget(candidates, config) {
1088
1160
  }
1089
1161
  _chunkS3JO3N4Hcjs.__name.call(void 0, selectPreloadsWithinBudget, "selectPreloadsWithinBudget");
1090
1162
  function getHtmlPreloadKind(link) {
1091
- const rel = _optionalChain([readHtmlAttribute, 'call', _57 => _57(link, "rel"), 'optionalAccess', _58 => _58.toLowerCase, 'call', _59 => _59(), 'access', _60 => _60.split, 'call', _61 => _61(/\s+/)]) || [];
1163
+ const rel = _optionalChain([readHtmlAttribute, 'call', _59 => _59(link, "rel"), 'optionalAccess', _60 => _60.toLowerCase, 'call', _61 => _61(), 'access', _62 => _62.split, 'call', _63 => _63(/\s+/)]) || [];
1092
1164
  if (!rel.includes("preload")) return void 0;
1093
1165
  return normalizePreloadKind(readHtmlAttribute(link, "as"));
1094
1166
  }
1095
1167
  _chunkS3JO3N4Hcjs.__name.call(void 0, getHtmlPreloadKind, "getHtmlPreloadKind");
1096
1168
  function getLinkHeaderPreloadKind(link) {
1097
- const relations = _nullishCoalesce(_optionalChain([getLinkHeaderParameter, 'call', _62 => _62(link, "rel"), 'optionalAccess', _63 => _63.toLowerCase, 'call', _64 => _64(), 'access', _65 => _65.split, 'call', _66 => _66(/\s+/)]), () => ( []));
1169
+ const relations = _nullishCoalesce(_optionalChain([getLinkHeaderParameter, 'call', _64 => _64(link, "rel"), 'optionalAccess', _65 => _65.toLowerCase, 'call', _66 => _66(), 'access', _67 => _67.split, 'call', _68 => _68(/\s+/)]), () => ( []));
1098
1170
  if (!relations.includes("preload")) return void 0;
1099
1171
  return normalizePreloadKind(getLinkHeaderParameter(link, "as"));
1100
1172
  }
@@ -1140,7 +1212,7 @@ function splitLinkParameters(value) {
1140
1212
  }
1141
1213
  _chunkS3JO3N4Hcjs.__name.call(void 0, splitLinkParameters, "splitLinkParameters");
1142
1214
  function normalizePreloadKind(value) {
1143
- const normalized = _optionalChain([value, 'optionalAccess', _67 => _67.toLowerCase, 'call', _68 => _68()]);
1215
+ const normalized = _optionalChain([value, 'optionalAccess', _69 => _69.toLowerCase, 'call', _70 => _70()]);
1144
1216
  return normalized === "image" || normalized === "font" ? normalized : void 0;
1145
1217
  }
1146
1218
  _chunkS3JO3N4Hcjs.__name.call(void 0, normalizePreloadKind, "normalizePreloadKind");
@@ -1148,7 +1220,7 @@ function readHtmlAttribute(element, name) {
1148
1220
  const match = element.match(
1149
1221
  new RegExp(`\\s${name}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s>]+))`, "i")
1150
1222
  );
1151
- return _nullishCoalesce(_nullishCoalesce(_optionalChain([match, 'optionalAccess', _69 => _69[1]]), () => ( _optionalChain([match, 'optionalAccess', _70 => _70[2]]))), () => ( _optionalChain([match, 'optionalAccess', _71 => _71[3]])));
1223
+ return _nullishCoalesce(_nullishCoalesce(_optionalChain([match, 'optionalAccess', _71 => _71[1]]), () => ( _optionalChain([match, 'optionalAccess', _72 => _72[2]]))), () => ( _optionalChain([match, 'optionalAccess', _73 => _73[3]])));
1152
1224
  }
1153
1225
  _chunkS3JO3N4Hcjs.__name.call(void 0, readHtmlAttribute, "readHtmlAttribute");
1154
1226
  function findHtmlLinkElements(html) {
@@ -1172,7 +1244,7 @@ function findHtmlLinkElements(html) {
1172
1244
  }
1173
1245
  rawTextTag.lastIndex = start;
1174
1246
  const rawText = rawTextTag.exec(lowerHtml);
1175
- if (_optionalChain([rawText, 'optionalAccess', _72 => _72[1]])) {
1247
+ if (_optionalChain([rawText, 'optionalAccess', _74 => _74[1]])) {
1176
1248
  const openingEnd = findHtmlTagEnd2(html, start);
1177
1249
  if (openingEnd === -1) break;
1178
1250
  if (rawText[1] === "svg" && html[openingEnd - 2] === "/") {
@@ -1354,4 +1426,5 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, applyFarmPreviewRobotsTag, "applyFarmPrevi
1354
1426
 
1355
1427
 
1356
1428
 
1357
- exports.resolveFarmLlmsTxtConfig = resolveFarmLlmsTxtConfig; exports.collectFarmLlmsTxtPages = collectFarmLlmsTxtPages; exports.createFarmDefaultLlmsTxt = createFarmDefaultLlmsTxt; exports.serializeFarmLlmsTxt = serializeFarmLlmsTxt; exports.createFarmLlmsMarkdownReader = createFarmLlmsMarkdownReader; exports.renderFarmLlmsFullTxt = renderFarmLlmsFullTxt; exports.resolveFarmAgentCrawlers = resolveFarmAgentCrawlers; exports.createFarmAgentRobots = createFarmAgentRobots; exports.resolveFarmSecurityConfig = resolveFarmSecurityConfig; exports.getFarmSecurityHeader = getFarmSecurityHeader; exports.createFarmCspNonce = createFarmCspNonce; exports.addFarmCspNonceToScriptTags = addFarmCspNonceToScriptTags; exports.applyFarmCspHashesToHtml = applyFarmCspHashesToHtml; exports.applyFarmCspNonceToResponse = applyFarmCspNonceToResponse; exports.farmCspBlocksFrameworkInlineScripts = farmCspBlocksFrameworkInlineScripts; exports.createFarmCspNonceRewriter = createFarmCspNonceRewriter; exports.resolveFarmPerformanceConfig = resolveFarmPerformanceConfig; exports.manageFarmHtmlPreloads = manageFarmHtmlPreloads; exports.manageFarmLinkHeaderPreloads = manageFarmLinkHeaderPreloads; exports.manageFarmDocumentPreloads = manageFarmDocumentPreloads; exports.reportFarmPreloadWarnings = reportFarmPreloadWarnings; exports.FARM_PREVIEW_ROBOTS_TAG = FARM_PREVIEW_ROBOTS_TAG; exports.resolveFarmNoindexPreviews = resolveFarmNoindexPreviews; exports.applyFarmPreviewRobotsTag = applyFarmPreviewRobotsTag;
1429
+
1430
+ exports.resolveFarmLlmsTxtConfig = resolveFarmLlmsTxtConfig; exports.collectFarmLlmsTxtPages = collectFarmLlmsTxtPages; exports.createFarmDefaultLlmsTxt = createFarmDefaultLlmsTxt; exports.serializeFarmLlmsTxt = serializeFarmLlmsTxt; exports.createFarmLlmsMarkdownReader = createFarmLlmsMarkdownReader; exports.renderFarmLlmsFullTxt = renderFarmLlmsFullTxt; exports.createFarmLlmsFullRenderer = createFarmLlmsFullRenderer; exports.resolveFarmAgentCrawlers = resolveFarmAgentCrawlers; exports.createFarmAgentRobots = createFarmAgentRobots; exports.resolveFarmSecurityConfig = resolveFarmSecurityConfig; exports.getFarmSecurityHeader = getFarmSecurityHeader; exports.createFarmCspNonce = createFarmCspNonce; exports.addFarmCspNonceToScriptTags = addFarmCspNonceToScriptTags; exports.applyFarmCspHashesToHtml = applyFarmCspHashesToHtml; exports.applyFarmCspNonceToResponse = applyFarmCspNonceToResponse; exports.farmCspBlocksFrameworkInlineScripts = farmCspBlocksFrameworkInlineScripts; exports.createFarmCspNonceRewriter = createFarmCspNonceRewriter; exports.resolveFarmPerformanceConfig = resolveFarmPerformanceConfig; exports.manageFarmHtmlPreloads = manageFarmHtmlPreloads; exports.manageFarmLinkHeaderPreloads = manageFarmLinkHeaderPreloads; exports.manageFarmDocumentPreloads = manageFarmDocumentPreloads; exports.reportFarmPreloadWarnings = reportFarmPreloadWarnings; exports.FARM_PREVIEW_ROBOTS_TAG = FARM_PREVIEW_ROBOTS_TAG; exports.resolveFarmNoindexPreviews = resolveFarmNoindexPreviews; exports.applyFarmPreviewRobotsTag = applyFarmPreviewRobotsTag;