nuxt-ai-ready 2.5.3 → 3.0.0

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 (286) hide show
  1. package/README.md +13 -12
  2. package/dist/chunks/agent-skills.mjs +35 -12
  3. package/dist/chunks/prerender.mjs +35 -24
  4. package/dist/cli.mjs +5 -2
  5. package/dist/module.d.mts +4 -0
  6. package/dist/module.json +2 -2
  7. package/dist/module.mjs +8 -4
  8. package/dist/runtime/app/index.d.ts +3 -0
  9. package/dist/runtime/app/index.js +2 -0
  10. package/dist/runtime/cache-control.d.ts +2 -0
  11. package/dist/runtime/cache-control.js +11 -0
  12. package/dist/runtime/llms-txt-utils.js +1 -1
  13. package/dist/runtime/server/db/context.d.ts +13 -0
  14. package/dist/runtime/server/db/drizzle/client.d.ts +6 -7
  15. package/dist/runtime/server/db/drizzle/client.js +13 -2
  16. package/dist/runtime/server/db/drizzle/providers/bun.d.ts +2 -2
  17. package/dist/runtime/server/db/drizzle/providers/bun.js +2 -2
  18. package/dist/runtime/server/db/drizzle/providers/d1.d.ts +2 -2
  19. package/dist/runtime/server/db/drizzle/providers/d1.js +3 -2
  20. package/dist/runtime/server/db/drizzle/providers/libsql.d.ts +2 -2
  21. package/dist/runtime/server/db/drizzle/providers/libsql.js +2 -2
  22. package/dist/runtime/server/db/drizzle/providers/neon.d.ts +2 -2
  23. package/dist/runtime/server/db/drizzle/providers/neon.js +2 -2
  24. package/dist/runtime/server/db/drizzle/providers/node-sqlite.d.ts +2 -2
  25. package/dist/runtime/server/db/drizzle/providers/node-sqlite.js +2 -2
  26. package/dist/runtime/server/db/drizzle/providers/postgres.d.ts +2 -2
  27. package/dist/runtime/server/db/drizzle/providers/postgres.js +2 -2
  28. package/dist/runtime/server/db/drizzle/queries.d.ts +27 -27
  29. package/dist/runtime/server/db/drizzle/queries.js +6 -5
  30. package/dist/runtime/server/db/drizzle/raw.d.ts +2 -6
  31. package/dist/runtime/server/db/index.d.ts +1 -1
  32. package/dist/runtime/server/db/index.js +1 -1
  33. package/dist/runtime/server/db/queries.d.ts +36 -36
  34. package/dist/runtime/server/db/queries.js +8 -9
  35. package/dist/runtime/server/db/seed.d.ts +2 -2
  36. package/dist/runtime/server/db/seed.js +4 -3
  37. package/dist/runtime/server/db/shared.d.ts +8 -0
  38. package/dist/runtime/server/db/shared.js +8 -2
  39. package/dist/runtime/server/index.d.ts +2 -0
  40. package/dist/runtime/server/index.js +17 -0
  41. package/dist/runtime/server/mcp/tools/get-page-markdown.js +1 -1
  42. package/dist/runtime/server/mcp/tools/list-pages.js +1 -1
  43. package/dist/runtime/server/mcp/tools/search-pages.js +1 -1
  44. package/dist/runtime/server/middleware/markdown.prerender.js +1 -1
  45. package/dist/runtime/server/plugins/db-lifecycle-nitro3.d.ts +2 -0
  46. package/dist/runtime/server/plugins/db-lifecycle-nitro3.js +16 -0
  47. package/dist/runtime/server/plugins/html-capture.prerender.js +6 -4
  48. package/dist/runtime/server/plugins/link-header-nitro3.d.ts +2 -0
  49. package/dist/runtime/server/plugins/link-header-nitro3.js +20 -0
  50. package/dist/runtime/server/plugins/link-header.d.ts +6 -0
  51. package/dist/runtime/server/plugins/link-header.js +7 -11
  52. package/dist/runtime/server/plugins/markdown-negotiation.js +8 -1
  53. package/dist/runtime/server/plugins/sitemap-seeder.js +3 -3
  54. package/dist/runtime/server/routes/agent-skills-artifact.d.ts +1 -1
  55. package/dist/runtime/server/routes/agent-skills-artifact.js +10 -10
  56. package/dist/runtime/server/routes/agent-skills-index.d.ts +1 -1
  57. package/dist/runtime/server/routes/agent-skills-index.js +7 -6
  58. package/dist/runtime/server/routes/ai-catalog.d.ts +2 -1
  59. package/dist/runtime/server/routes/ai-catalog.js +7 -8
  60. package/dist/runtime/server/routes/api-catalog.d.ts +3 -1
  61. package/dist/runtime/server/routes/api-catalog.js +12 -12
  62. package/dist/runtime/server/routes/llms-full.txt.get.js +1 -1
  63. package/dist/runtime/server/routes/mcp-server-card.d.ts +1 -1
  64. package/dist/runtime/server/routes/mcp-server-card.js +7 -8
  65. package/dist/runtime/server/utils/checkStale.d.ts +2 -2
  66. package/dist/runtime/server/utils/cloudflare-prerendered.d.ts +3 -0
  67. package/dist/runtime/server/utils/cloudflare-prerendered.js +23 -0
  68. package/dist/runtime/server/utils/cloudflare.d.ts +5 -5
  69. package/dist/runtime/server/utils/cloudflare.js +31 -7
  70. package/dist/runtime/server/utils/content-negotiation.d.ts +5 -3
  71. package/dist/runtime/server/utils/content-negotiation.js +8 -7
  72. package/dist/runtime/server/utils/context.d.ts +3 -3
  73. package/dist/runtime/server/utils/context.js +1 -1
  74. package/dist/runtime/server/utils/discovery-response.d.ts +2 -0
  75. package/dist/runtime/server/utils/link-header.d.ts +5 -3
  76. package/dist/runtime/server/utils/link-header.js +26 -2
  77. package/dist/runtime/server/utils/markdown-request.d.ts +4 -3
  78. package/dist/runtime/server/utils/markdown-request.js +15 -13
  79. package/dist/runtime/server/utils/negotiation-decision.d.ts +4 -0
  80. package/dist/runtime/server/utils/negotiation-decision.js +6 -5
  81. package/dist/runtime/server/utils/negotiation-response.js +47 -22
  82. package/dist/runtime/server/utils/prerender-html.d.ts +2 -1
  83. package/dist/runtime/server/utils/prerender-html.js +3 -1
  84. package/dist/runtime/types.d.ts +15 -7
  85. package/dist/shared/nuxt-ai-ready.B3hAuOLQ.mjs +29 -0
  86. package/dist/shared/{nuxt-ai-ready.CLSWou20.mjs → nuxt-ai-ready.C34F0LJo.mjs} +560 -219
  87. package/package.json +85 -20
  88. package/skills/nuxt-ai-ready/SKILL.md +26 -12
  89. package/skills/nuxt-ai-ready/references/runtime-indexing.md +7 -6
  90. package/dist/runtime/server/db/drizzle/providers/sqlite.d.ts +0 -8
  91. package/dist/runtime/server/db/drizzle/providers/sqlite.js +0 -15
  92. package/node_modules/@mdream/js/LICENSE.md +0 -9
  93. package/node_modules/@mdream/js/README.md +0 -792
  94. package/node_modules/@mdream/js/bin/mdream.mjs +0 -2
  95. package/node_modules/@mdream/js/dist/_chunks/const.mjs +0 -134
  96. package/node_modules/@mdream/js/dist/_chunks/index.d.mts +0 -9
  97. package/node_modules/@mdream/js/dist/_chunks/markdown-processor.mjs +0 -1968
  98. package/node_modules/@mdream/js/dist/_chunks/minimal.d.mts +0 -6
  99. package/node_modules/@mdream/js/dist/_chunks/parse.mjs +0 -2756
  100. package/node_modules/@mdream/js/dist/_chunks/plugins.mjs +0 -725
  101. package/node_modules/@mdream/js/dist/_chunks/resolve-plugins.mjs +0 -44
  102. package/node_modules/@mdream/js/dist/_chunks/stream.mjs +0 -37
  103. package/node_modules/@mdream/js/dist/_chunks/types.d.mts +0 -473
  104. package/node_modules/@mdream/js/dist/cli.d.mts +0 -1
  105. package/node_modules/@mdream/js/dist/cli.mjs +0 -32
  106. package/node_modules/@mdream/js/dist/core.d.mts +0 -15
  107. package/node_modules/@mdream/js/dist/core.mjs +0 -28
  108. package/node_modules/@mdream/js/dist/index.d.mts +0 -4
  109. package/node_modules/@mdream/js/dist/index.mjs +0 -58
  110. package/node_modules/@mdream/js/dist/llms-txt.d.mts +0 -86
  111. package/node_modules/@mdream/js/dist/llms-txt.mjs +0 -308
  112. package/node_modules/@mdream/js/dist/negotiate.d.mts +0 -35
  113. package/node_modules/@mdream/js/dist/negotiate.mjs +0 -121
  114. package/node_modules/@mdream/js/dist/parse.d.mts +0 -90
  115. package/node_modules/@mdream/js/dist/parse.mjs +0 -2
  116. package/node_modules/@mdream/js/dist/plugins.d.mts +0 -85
  117. package/node_modules/@mdream/js/dist/plugins.mjs +0 -2
  118. package/node_modules/@mdream/js/dist/preset/minimal.d.mts +0 -2
  119. package/node_modules/@mdream/js/dist/preset/minimal.mjs +0 -33
  120. package/node_modules/@mdream/js/dist/splitter.d.mts +0 -18
  121. package/node_modules/@mdream/js/dist/splitter.mjs +0 -194
  122. package/node_modules/@mdream/js/package.json +0 -103
  123. package/node_modules/cac/LICENSE +0 -21
  124. package/node_modules/cac/README.md +0 -492
  125. package/node_modules/cac/dist/index.d.ts +0 -196
  126. package/node_modules/cac/dist/index.js +0 -638
  127. package/node_modules/cac/package.json +0 -72
  128. package/node_modules/mdream/LICENSE.md +0 -9
  129. package/node_modules/mdream/README.md +0 -1091
  130. package/node_modules/mdream/bin/mdream.mjs +0 -46
  131. package/node_modules/mdream/dist/browser.d.mts +0 -105
  132. package/node_modules/mdream/dist/browser.mjs +0 -262
  133. package/node_modules/mdream/dist/edge.d.mts +0 -100
  134. package/node_modules/mdream/dist/edge.mjs +0 -250
  135. package/node_modules/mdream/dist/iife.js +0 -605
  136. package/node_modules/mdream/dist/index.d.mts +0 -89
  137. package/node_modules/mdream/dist/index.mjs +0 -184
  138. package/node_modules/mdream/dist/wasm.d.mts +0 -100
  139. package/node_modules/mdream/dist/wasm.mjs +0 -140
  140. package/node_modules/mdream/dist/worker.d.mts +0 -101
  141. package/node_modules/mdream/dist/worker.mjs +0 -217
  142. package/node_modules/mdream/napi/index.d.mts +0 -127
  143. package/node_modules/mdream/napi/index.d.ts +0 -127
  144. package/node_modules/mdream/napi/index.mjs +0 -725
  145. package/node_modules/mdream/napi/rust.android-arm-eabi.node +0 -0
  146. package/node_modules/mdream/napi/rust.android-arm64.node +0 -0
  147. package/node_modules/mdream/napi/rust.darwin-arm64.node +0 -0
  148. package/node_modules/mdream/napi/rust.darwin-x64.node +0 -0
  149. package/node_modules/mdream/napi/rust.freebsd-x64.node +0 -0
  150. package/node_modules/mdream/napi/rust.linux-arm-gnueabihf.node +0 -0
  151. package/node_modules/mdream/napi/rust.linux-arm64-gnu.node +0 -0
  152. package/node_modules/mdream/napi/rust.linux-arm64-musl.node +0 -0
  153. package/node_modules/mdream/napi/rust.linux-x64-gnu.node +0 -0
  154. package/node_modules/mdream/napi/rust.linux-x64-musl.node +0 -0
  155. package/node_modules/mdream/napi/rust.wasi.cjs +0 -2144
  156. package/node_modules/mdream/napi/rust.wasm32-wasi.wasm +0 -0
  157. package/node_modules/mdream/napi/rust.win32-arm64-msvc.node +0 -0
  158. package/node_modules/mdream/napi/rust.win32-x64-msvc.node +0 -0
  159. package/node_modules/mdream/node_modules/@emnapi/core/LICENSE +0 -21
  160. package/node_modules/mdream/node_modules/@emnapi/core/README.md +0 -1
  161. package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.d.ts +0 -392
  162. package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.full.d.ts +0 -392
  163. package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.full.js +0 -8351
  164. package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.js +0 -7268
  165. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/async-work.d.ts +0 -5
  166. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/async-work.js +0 -843
  167. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/index.d.ts +0 -4
  168. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/index.js +0 -3
  169. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/threadsafe-function.d.ts +0 -5
  170. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/threadsafe-function.js +0 -1010
  171. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/v8.d.ts +0 -5
  172. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/v8.js +0 -1446
  173. package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/LICENSE +0 -21
  174. package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/README.md +0 -203
  175. package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.ts +0 -236
  176. package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/dist/wasi-threads.js +0 -1086
  177. package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/package.json +0 -35
  178. package/node_modules/mdream/node_modules/@emnapi/core/node_modules/@emnapi/wasi-threads/rollup.config.js +0 -6
  179. package/node_modules/mdream/node_modules/@emnapi/core/package.json +0 -39
  180. package/node_modules/mdream/node_modules/@emnapi/core/rollup.config.js +0 -60
  181. package/node_modules/mdream/node_modules/@emnapi/runtime/LICENSE +0 -21
  182. package/node_modules/mdream/node_modules/@emnapi/runtime/README.md +0 -1
  183. package/node_modules/mdream/node_modules/@emnapi/runtime/dist/emnapi.d.ts +0 -833
  184. package/node_modules/mdream/node_modules/@emnapi/runtime/dist/emnapi.js +0 -2306
  185. package/node_modules/mdream/node_modules/@emnapi/runtime/dist/emnapi.js.map +0 -1
  186. package/node_modules/mdream/node_modules/@emnapi/runtime/index.cjs +0 -63
  187. package/node_modules/mdream/node_modules/@emnapi/runtime/package.json +0 -39
  188. package/node_modules/mdream/node_modules/@emnapi/runtime/rollup.config.js +0 -25
  189. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/LICENSE +0 -21
  190. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/README.md +0 -203
  191. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.ts +0 -240
  192. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/dist/wasi-threads.js +0 -1118
  193. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/package.json +0 -35
  194. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/rollup.config.js +0 -6
  195. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/emnapi-plugins.cjs +0 -1472
  196. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/emnapi-plugins.js +0 -1470
  197. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/fs-proxy.cjs +0 -237
  198. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/fs.js +0 -17578
  199. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/fs-proxy.js +0 -317
  200. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/package.json +0 -67
  201. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/runtime.cjs +0 -39
  202. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/runtime.js +0 -36
  203. package/node_modules/mdream/node_modules/@tybys/wasm-util/LICENSE +0 -21
  204. package/node_modules/mdream/node_modules/@tybys/wasm-util/README.md +0 -193
  205. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/tsdoc-metadata.json +0 -11
  206. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.d.ts +0 -423
  207. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.esm-bundler.js +0 -2932
  208. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.esm.js +0 -2932
  209. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.esm.min.js +0 -1
  210. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.js +0 -2954
  211. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.min.js +0 -1
  212. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/asyncify.js +0 -158
  213. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/index.js +0 -13
  214. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/jspi.js +0 -46
  215. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/load.js +0 -97
  216. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/memory.js +0 -35
  217. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/error.js +0 -103
  218. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/fd.js +0 -268
  219. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/fs.js +0 -3
  220. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/index.js +0 -192
  221. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/path.js +0 -316
  222. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/preview1.js +0 -1599
  223. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/rights.js +0 -141
  224. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/types.js +0 -220
  225. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/util.js +0 -128
  226. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/webassembly.js +0 -13
  227. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/asyncify.mjs +0 -153
  228. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/index.mjs +0 -9
  229. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/jspi.mjs +0 -39
  230. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/load.mjs +0 -89
  231. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/memory.mjs +0 -28
  232. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/error.mjs +0 -97
  233. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/fd.mjs +0 -256
  234. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/fs.mjs +0 -1
  235. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/index.mjs +0 -186
  236. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/path.mjs +0 -310
  237. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/preview1.mjs +0 -1593
  238. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/rights.mjs +0 -135
  239. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/types.mjs +0 -216
  240. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/util.mjs +0 -113
  241. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/webassembly.mjs +0 -9
  242. package/node_modules/mdream/node_modules/@tybys/wasm-util/package.json +0 -58
  243. package/node_modules/mdream/node_modules/tslib/CopyrightNotice.txt +0 -15
  244. package/node_modules/mdream/node_modules/tslib/LICENSE.txt +0 -12
  245. package/node_modules/mdream/node_modules/tslib/README.md +0 -164
  246. package/node_modules/mdream/node_modules/tslib/SECURITY.md +0 -41
  247. package/node_modules/mdream/node_modules/tslib/modules/index.d.ts +0 -38
  248. package/node_modules/mdream/node_modules/tslib/modules/index.js +0 -70
  249. package/node_modules/mdream/node_modules/tslib/modules/package.json +0 -3
  250. package/node_modules/mdream/node_modules/tslib/package.json +0 -47
  251. package/node_modules/mdream/node_modules/tslib/tslib.d.ts +0 -460
  252. package/node_modules/mdream/node_modules/tslib/tslib.es6.html +0 -1
  253. package/node_modules/mdream/node_modules/tslib/tslib.es6.js +0 -402
  254. package/node_modules/mdream/node_modules/tslib/tslib.es6.mjs +0 -401
  255. package/node_modules/mdream/node_modules/tslib/tslib.html +0 -1
  256. package/node_modules/mdream/node_modules/tslib/tslib.js +0 -484
  257. package/node_modules/mdream/package.json +0 -110
  258. package/node_modules/mdream/skills/mdream/SKILL.md +0 -124
  259. package/node_modules/mdream/skills/mdream/references/runtimes.md +0 -49
  260. package/node_modules/mdream/wasm/mdream_edge.d.ts +0 -90
  261. package/node_modules/mdream/wasm/mdream_edge.js +0 -517
  262. package/node_modules/mdream/wasm/mdream_edge_bg.wasm +0 -0
  263. package/node_modules/mdream/wasm/mdream_edge_bg.wasm.d.ts +0 -20
  264. package/node_modules/mdream/wasm/package.json +0 -17
  265. package/node_modules/mdream/wasm-bundler/mdream_edge.d.ts +0 -45
  266. package/node_modules/mdream/wasm-bundler/mdream_edge.js +0 -13
  267. package/node_modules/mdream/wasm-bundler/mdream_edge_bg.js +0 -413
  268. package/node_modules/mdream/wasm-bundler/mdream_edge_bg.wasm +0 -0
  269. package/node_modules/mdream/wasm-bundler/mdream_edge_bg.wasm.d.ts +0 -20
  270. package/node_modules/mdream/wasm-bundler/package.json +0 -19
  271. package/node_modules/pathe/LICENSE +0 -70
  272. package/node_modules/pathe/README.md +0 -73
  273. package/node_modules/pathe/dist/index.cjs +0 -39
  274. package/node_modules/pathe/dist/index.d.cts +0 -47
  275. package/node_modules/pathe/dist/index.d.mts +0 -47
  276. package/node_modules/pathe/dist/index.d.ts +0 -47
  277. package/node_modules/pathe/dist/index.mjs +0 -19
  278. package/node_modules/pathe/dist/shared/pathe.BSlhyZSM.cjs +0 -266
  279. package/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +0 -249
  280. package/node_modules/pathe/dist/utils.cjs +0 -82
  281. package/node_modules/pathe/dist/utils.d.cts +0 -32
  282. package/node_modules/pathe/dist/utils.d.mts +0 -32
  283. package/node_modules/pathe/dist/utils.d.ts +0 -32
  284. package/node_modules/pathe/dist/utils.mjs +0 -77
  285. package/node_modules/pathe/package.json +0 -61
  286. package/node_modules/pathe/utils.d.ts +0 -1
@@ -1,4 +1,3 @@
1
- import { subtle } from "uncrypto";
2
1
  import { isMap, isScalar, parseDocument } from "yaml";
3
2
  import { buildSchemaSql, DROP_TABLES_SQL, resolveFtsTokenizer, SCHEMA_VERSION } from "./schema-sql.js";
4
3
  const LEADING_BLOCK_RE = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/;
@@ -16,7 +15,7 @@ function stripPageFrontmatter(markdown) {
16
15
  export async function computeContentHash(markdown) {
17
16
  const encoder = new TextEncoder();
18
17
  const data = encoder.encode(stripPageFrontmatter(markdown).trim());
19
- const hashBuffer = await subtle.digest("SHA-256", data);
18
+ const hashBuffer = await crypto.subtle.digest("SHA-256", data);
20
19
  const hashArray = [...new Uint8Array(hashBuffer)];
21
20
  return hashArray.map((b) => b.toString(16).padStart(2, "0")).join("").slice(0, 16);
22
21
  }
@@ -78,6 +77,13 @@ export function likeSubstring(term) {
78
77
  return `%${escapeLikeTerm(term)}%`;
79
78
  }
80
79
  export const LIKE_ESCAPE = "\\";
80
+ const RE_FTS_TERM_SPLIT = /\s+/;
81
+ const RE_FTS_TOKEN_CHAR = /[\p{L}\p{N}]/u;
82
+ const RE_DOUBLE_QUOTE = /"/g;
83
+ export function toFtsMatchQuery(query) {
84
+ const terms = query.split(RE_FTS_TERM_SPLIT).filter((term) => RE_FTS_TOKEN_CHAR.test(term)).map((term) => `"${term.replace(RE_DOUBLE_QUOTE, '""')}"*`);
85
+ return terms.length ? terms.join(" ") : null;
86
+ }
81
87
  const MAX_BIND_PARAMS_PER_STATEMENT = 100;
82
88
  export function maxRowsPerInsert(paramsPerRow) {
83
89
  return Math.max(1, Math.floor(MAX_BIND_PARAMS_PER_STATEMENT / paramsPerRow));
@@ -0,0 +1,2 @@
1
+ export { closeDrizzle, countPages, getPageLastmods, getStaleRoutes, indexPage, indexPageByRoute, isPageFresh, pruneStaleRoutes, queryPages, searchPages, seedRoutes, streamPages, upsertPage, useDrizzle, useRawDb, } from '../index.js';
2
+ export type { CountPagesOptions, DatabaseDialect, DrizzleDatabase, IndexPageOptions, IndexPageResult, MarkdownContext, PageData, PageEntry, PageIndexedContext, PageRow, QueryPagesOptions, RawExecutor, SearchPagesOptions, SearchResult, StreamPagesOptions, UpsertPageInput, } from '../index.js';
@@ -0,0 +1,17 @@
1
+ export {
2
+ closeDrizzle,
3
+ countPages,
4
+ getPageLastmods,
5
+ getStaleRoutes,
6
+ indexPage,
7
+ indexPageByRoute,
8
+ isPageFresh,
9
+ pruneStaleRoutes,
10
+ queryPages,
11
+ searchPages,
12
+ seedRoutes,
13
+ streamPages,
14
+ upsertPage,
15
+ useDrizzle,
16
+ useRawDb
17
+ } from "../index.js";
@@ -11,7 +11,7 @@ const tool = {
11
11
  title: SITE_TOOL_CATALOG.get_page_markdown.title,
12
12
  description: SITE_TOOL_CATALOG.get_page_markdown.description,
13
13
  inputSchema,
14
- annotations: { readOnlyHint: true, openWorldHint: false },
14
+ annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
15
15
  enabled: () => siteTools.getPageMarkdown.mcp.enabled,
16
16
  cache: "5m",
17
17
  async handler({ route }) {
@@ -14,7 +14,7 @@ const tool = {
14
14
  title: SITE_TOOL_CATALOG.list_pages.title,
15
15
  description: SITE_TOOL_CATALOG.list_pages.description,
16
16
  inputSchema,
17
- annotations: { readOnlyHint: true, openWorldHint: false },
17
+ annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
18
18
  enabled: () => siteTools.listPages.mcp.enabled,
19
19
  cache: "1h",
20
20
  async handler({ limit, offset }) {
@@ -14,7 +14,7 @@ const tool = {
14
14
  title: SITE_TOOL_CATALOG.search_pages.title,
15
15
  description: SITE_TOOL_CATALOG.search_pages.description,
16
16
  inputSchema,
17
- annotations: { readOnlyHint: true, openWorldHint: false },
17
+ annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
18
18
  enabled: () => siteTools.searchPages.mcp.enabled,
19
19
  cache: "5m",
20
20
  async handler({ query, limit }) {
@@ -38,7 +38,7 @@ export default defineEventHandler(async (event) => {
38
38
  const { path } = renderInfo;
39
39
  const runtimeConfig = fullRuntimeConfig["nuxt-ai-ready"];
40
40
  const deployedPath = toDeployedRoute(path, fullRuntimeConfig.app.baseURL);
41
- const canonicalUrl = withSiteUrl(event, deployedPath);
41
+ const canonicalUrl = withSiteUrl(event, deployedPath, { withBase: true });
42
42
  const contentPage = await tryGetContentMarkdown(event, path).catch((error) => {
43
43
  logger.debug(`[markdown.prerender] Content lookup failed for ${path}`, error);
44
44
  return null;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,16 @@
1
+ import { defineNitroPlugin } from "#nuxtseo/nitro";
2
+ import { DB_CONTEXT_KEY, DB_PROMISE_CONTEXT_KEY, DB_WORK_CONTEXT_KEY } from "../db/context.js";
3
+ export default defineNitroPlugin((nitroApp) => {
4
+ const hooks = nitroApp.hooks;
5
+ hooks.hook("response", async (_response, event) => {
6
+ if (!event.context?.[DB_CONTEXT_KEY] && !event.context?.[DB_PROMISE_CONTEXT_KEY] && !event.context?.[DB_WORK_CONTEXT_KEY]) {
7
+ return;
8
+ }
9
+ const { finishDrizzleResponse } = await import("../db/index.js");
10
+ await finishDrizzleResponse(event);
11
+ });
12
+ hooks.hook("close", async () => {
13
+ const { closeDrizzle } = await import("../db/index.js");
14
+ await closeDrizzle();
15
+ });
16
+ });
@@ -1,10 +1,12 @@
1
+ import { getRequestURL } from "#nuxtseo/h3";
2
+ import { useRuntimeConfig } from "#nuxtseo/nitro";
3
+ import { toLogicalRoute } from "../../route-path.js";
1
4
  import { storePrerenderedHtml } from "../utils/prerender-html.js";
2
5
  export default function htmlCapturePlugin(nitroApp) {
3
6
  if (!import.meta.prerender)
4
7
  return;
5
- nitroApp.hooks.hook("render:response", (response, { event }) => {
6
- if (typeof response.body !== "string" || !String(response.headers?.["content-type"] || "").includes("text/html"))
7
- return;
8
- storePrerenderedHtml(event.path, response.body);
8
+ nitroApp.hooks.hook("render:html", (html, { event }) => {
9
+ const baseURL = useRuntimeConfig(event).app.baseURL;
10
+ storePrerenderedHtml(toLogicalRoute(getRequestURL(event).pathname, baseURL), html);
9
11
  });
10
12
  }
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,20 @@
1
+ import { defineNitroPlugin } from "#nuxtseo/nitro";
2
+ import { ERROR_LINK_HEADER, STATUS_AWARE_LINK_HEADER } from "./link-header.js";
3
+ function readHeader(event) {
4
+ return event.context[STATUS_AWARE_LINK_HEADER];
5
+ }
6
+ export default defineNitroPlugin((nitro) => {
7
+ const hooks = nitro.hooks;
8
+ hooks.hook("error", (_error, { event }) => {
9
+ if (!event)
10
+ return;
11
+ const header = readHeader(event);
12
+ if (header)
13
+ event.req.headers.set(ERROR_LINK_HEADER, header.error);
14
+ });
15
+ hooks.hook("response", (response, event) => {
16
+ const header = readHeader(event);
17
+ if (header)
18
+ response.headers.set("link", response.status >= 400 ? header.error : header.success);
19
+ });
20
+ });
@@ -1,4 +1,10 @@
1
1
  import type { H3Event } from '#nuxtseo/h3';
2
+ export declare const STATUS_AWARE_LINK_HEADER = "nuxt-ai-ready:status-aware-link-header";
3
+ export declare const ERROR_LINK_HEADER = "x-nuxt-ai-ready-error-link";
4
+ export interface StatusAwareLinkHeader {
5
+ error: string;
6
+ success: string;
7
+ }
2
8
  export declare function setStatusAwareLinkHeader(event: H3Event, safeHeader: string, successHeader?: string): void;
3
9
  declare const _default: any;
4
10
  export default _default;
@@ -1,7 +1,7 @@
1
1
  import { getHeader, getResponseStatus, setHeader } from "#nuxtseo/h3";
2
2
  import { defineNitroPlugin } from "#nuxtseo/nitro";
3
- const STATUS_AWARE_LINK_HEADER = "nuxt-ai-ready:status-aware-link-header";
4
- const ERROR_LINK_HEADER = "x-nuxt-ai-ready-error-link";
3
+ export const STATUS_AWARE_LINK_HEADER = "nuxt-ai-ready:status-aware-link-header";
4
+ export const ERROR_LINK_HEADER = "x-nuxt-ai-ready-error-link";
5
5
  export function setStatusAwareLinkHeader(event, safeHeader, successHeader) {
6
6
  event.context[STATUS_AWARE_LINK_HEADER] = {
7
7
  error: safeHeader,
@@ -23,18 +23,14 @@ export default defineNitroPlugin((nitro) => {
23
23
  return;
24
24
  setHeader(event, "link", getResponseStatus(event) >= 400 ? header.error : header.success);
25
25
  });
26
- nitro.hooks.hook("render:response", (response, { event }) => {
26
+ nitro.hooks.hook("render:html", (_html, { event }) => {
27
27
  const header = event.context[STATUS_AWARE_LINK_HEADER];
28
- const errorHeader = event.path.startsWith("/__nuxt_error") && getHeader(event, "x-nuxt-error") === "true" ? getHeader(event, ERROR_LINK_HEADER) : void 0;
28
+ const errorHeader = event.path.startsWith("/__nuxt_error") ? getHeader(event, ERROR_LINK_HEADER) : void 0;
29
29
  if (errorHeader) {
30
- response.headers ||= {};
31
- response.headers.link = errorHeader;
30
+ setHeader(event, "link", errorHeader);
32
31
  return;
33
32
  }
34
- if (!header)
35
- return;
36
- response.headers ||= {};
37
- const statusCode = response.statusCode ?? getResponseStatus(event);
38
- response.headers.link = statusCode >= 400 ? header.error : header.success;
33
+ if (header)
34
+ setHeader(event, "link", getResponseStatus(event) >= 400 ? header.error : header.success);
39
35
  });
40
36
  });
@@ -1,6 +1,7 @@
1
1
  import { defineEventHandler } from "#nuxtseo/h3";
2
2
  import { defineNitroPlugin, useRuntimeConfig } from "#nuxtseo/nitro";
3
3
  import { logger } from "../logger.js";
4
+ import { serveCloudflarePrerenderedPage } from "../utils/cloudflare-prerendered.js";
4
5
  import { applyNegotiation, decideNegotiation } from "../utils/negotiation-response.js";
5
6
  function isH3App(candidate) {
6
7
  if (!candidate || typeof candidate !== "object")
@@ -21,7 +22,13 @@ function resolveH3Runtime(candidate) {
21
22
  return { _tag: "h3-v2", app: nitro.h3 };
22
23
  return { _tag: "unsupported" };
23
24
  }
24
- const negotiationHandler = defineEventHandler((event) => applyNegotiation(event, decideNegotiation(event, "early")));
25
+ const negotiationHandler = defineEventHandler(async (event) => {
26
+ const decision = decideNegotiation(event, "early");
27
+ const response = await applyNegotiation(event, decision);
28
+ if (response !== void 0 || decision._tag !== "html")
29
+ return response;
30
+ return serveCloudflarePrerenderedPage(event);
31
+ });
25
32
  export default defineNitroPlugin((nitro) => {
26
33
  const runtime = resolveH3Runtime(nitro);
27
34
  if (runtime._tag === "unsupported") {
@@ -4,8 +4,8 @@ import { getPageLastmods, getSitemapLastCrawledAt, markSitemapSeeded, resolveSee
4
4
  import { logger } from "../logger.js";
5
5
  import { mapSitemapRoutes } from "../utils/sitemap-routes.js";
6
6
  const DIAGNOSTICS_KEY = "_aiReadySitemapDiagnostics";
7
- function isDebug(event) {
8
- return !!useRuntimeConfig(event)["nuxt-ai-ready"]?.debug;
7
+ function isDebug(_event) {
8
+ return !!useRuntimeConfig()["nuxt-ai-ready"]?.debug;
9
9
  }
10
10
  function recordDiagnostic(event, message) {
11
11
  const ctx = event.context;
@@ -96,7 +96,7 @@ export default function sitemapSeederPlugin(nitroApp) {
96
96
  const urlCount = urls.length;
97
97
  const seed = async () => {
98
98
  const seedStart = Date.now();
99
- const pruneTtl = useRuntimeConfig(event)["nuxt-ai-ready"]?.runtimeSync?.pruneTtl ?? 0;
99
+ const pruneTtl = useRuntimeConfig()["nuxt-ai-ready"]?.runtimeSync?.pruneTtl ?? 0;
100
100
  const seeded = await seedRoutes(event, routes, { refreshWindowMs: resolveSeedRefreshWindowMs(pruneTtl) }).catch((e) => {
101
101
  logger.warn(`[sitemap-seeder] Failed to seed routes: ${e.message}`);
102
102
  return 0;
@@ -1,2 +1,2 @@
1
- declare const _default: any;
1
+ declare const _default: import("nuxt/server").EventHandler<any>;
2
2
  export default _default;
@@ -1,20 +1,20 @@
1
+ import { createError, defineEventHandler, getRequestURL, useRuntimeConfig } from "nuxt/server";
1
2
  import { localAgentSkillArtifacts } from "#ai-ready-virtual/agent-skills.mjs";
2
- import { assertMethod, createError, eventHandler, getRequestURL, setHeader } from "#nuxtseo/h3";
3
- import { useRuntimeConfig } from "#nuxtseo/nitro";
4
3
  import { publicCacheControl } from "../../cache-control.js";
5
4
  import { toLogicalRoute } from "../../route-path.js";
6
- export default eventHandler((event) => {
7
- assertMethod(event, ["GET", "HEAD"]);
8
- const path = toLogicalRoute(getRequestURL(event).pathname, useRuntimeConfig(event).app.baseURL);
5
+ export default defineEventHandler((event) => {
6
+ if (!["GET", "HEAD"].includes(event.req.method))
7
+ throw createError({ status: 405, statusText: "Method Not Allowed" });
8
+ const path = toLogicalRoute(getRequestURL(event).pathname, useRuntimeConfig().app.baseURL);
9
9
  const content = localAgentSkillArtifacts[path];
10
10
  if (content === void 0) {
11
11
  throw createError({
12
- statusCode: 404,
13
- statusMessage: "Agent skill artifact not found"
12
+ status: 404,
13
+ statusText: "Agent skill artifact not found"
14
14
  });
15
15
  }
16
- setHeader(event, "Content-Type", "text/markdown; charset=utf-8");
17
- setHeader(event, "Cache-Control", publicCacheControl(3600, 86400));
18
- setHeader(event, "Access-Control-Allow-Origin", "*");
16
+ event.res.headers.set("Content-Type", "text/markdown; charset=utf-8");
17
+ event.res.headers.set("Cache-Control", publicCacheControl(3600, 86400));
18
+ event.res.headers.set("Access-Control-Allow-Origin", "*");
19
19
  return content;
20
20
  });
@@ -1,2 +1,2 @@
1
- declare const _default: any;
1
+ declare const _default: import("nuxt/server").EventHandler<any>;
2
2
  export default _default;
@@ -1,10 +1,11 @@
1
+ import { createError, defineEventHandler } from "nuxt/server";
1
2
  import { agentSkillsIndex } from "#ai-ready-virtual/agent-skills.mjs";
2
- import { assertMethod, eventHandler, setHeader } from "#nuxtseo/h3";
3
3
  import { publicCacheControl } from "../../cache-control.js";
4
- export default eventHandler((event) => {
5
- assertMethod(event, ["GET", "HEAD"]);
6
- setHeader(event, "Content-Type", "application/json; charset=utf-8");
7
- setHeader(event, "Cache-Control", publicCacheControl(3600, 86400));
8
- setHeader(event, "Access-Control-Allow-Origin", "*");
4
+ export default defineEventHandler((event) => {
5
+ if (!["GET", "HEAD"].includes(event.req.method))
6
+ throw createError({ status: 405, statusText: "Method Not Allowed" });
7
+ event.res.headers.set("Content-Type", "application/json; charset=utf-8");
8
+ event.res.headers.set("Cache-Control", publicCacheControl(3600, 86400));
9
+ event.res.headers.set("Access-Control-Allow-Origin", "*");
9
10
  return agentSkillsIndex;
10
11
  });
@@ -1,2 +1,3 @@
1
- declare const _default: any;
1
+ import type { AiCatalog } from '../utils/discovery-response.js';
2
+ declare const _default: import("nuxt/server").EventHandler<AiCatalog | null>;
2
3
  export default _default;
@@ -1,9 +1,8 @@
1
- import { eventHandler, getHeader, setHeaders, setResponseStatus } from "#nuxtseo/h3";
2
- import { useRuntimeConfig } from "#nuxtseo/nitro";
1
+ import { defineEventHandler, getRequestHeader, setResponseStatus, useRuntimeConfig } from "nuxt/server";
3
2
  import { AI_CATALOG_MEDIA_TYPE, matchesDiscoveryEtag } from "../utils/discovery-response.js";
4
- export default eventHandler((event) => {
5
- const config = useRuntimeConfig(event)["nuxt-ai-ready"];
6
- setHeaders(event, {
3
+ export default defineEventHandler((event) => {
4
+ const config = useRuntimeConfig()["nuxt-ai-ready"];
5
+ Object.entries({
7
6
  "Access-Control-Allow-Headers": "Content-Type, If-None-Match",
8
7
  "Access-Control-Allow-Methods": "GET, HEAD",
9
8
  "Access-Control-Allow-Origin": "*",
@@ -11,12 +10,12 @@ export default eventHandler((event) => {
11
10
  "Cache-Control": `public, max-age=${config.aiCatalog.cacheMaxAge}`,
12
11
  "Content-Type": AI_CATALOG_MEDIA_TYPE,
13
12
  "ETag": config.aiCatalog.etag
14
- });
15
- if (event.method === "OPTIONS") {
13
+ }).forEach(([name, value]) => event.res.headers.set(name, value));
14
+ if (event.req.method === "OPTIONS") {
16
15
  setResponseStatus(event, 204);
17
16
  return null;
18
17
  }
19
- if (matchesDiscoveryEtag(getHeader(event, "if-none-match"), config.aiCatalog.etag)) {
18
+ if (matchesDiscoveryEtag(getRequestHeader(event, "if-none-match"), config.aiCatalog.etag)) {
20
19
  setResponseStatus(event, 304);
21
20
  return null;
22
21
  }
@@ -1,2 +1,4 @@
1
- declare const _default: any;
1
+ declare const _default: import("nuxt/server").EventHandler<{
2
+ linkset: Array<Record<string, unknown>>;
3
+ } | null | undefined>;
2
4
  export default _default;
@@ -1,22 +1,22 @@
1
- import { assertMethod, createError, defineEventHandler, setHeader, setHeaders, setResponseStatus } from "#nuxtseo/h3";
2
- import { useRuntimeConfig } from "#nuxtseo/nitro";
1
+ import { createError, defineEventHandler, setResponseStatus, useRuntimeConfig } from "nuxt/server";
3
2
  export default defineEventHandler((event) => {
4
- setHeader(event, "Access-Control-Allow-Origin", "*");
5
- if (event.method === "OPTIONS") {
6
- setHeaders(event, {
3
+ event.res.headers.set("Access-Control-Allow-Origin", "*");
4
+ if (event.req.method === "OPTIONS") {
5
+ Object.entries({
7
6
  "Access-Control-Allow-Headers": "Content-Type, If-None-Match",
8
7
  "Access-Control-Allow-Methods": "GET, HEAD"
9
- });
8
+ }).forEach(([name, value]) => event.res.headers.set(name, value));
10
9
  setResponseStatus(event, 204);
11
10
  return null;
12
11
  }
13
- assertMethod(event, ["GET", "HEAD"]);
14
- const config = useRuntimeConfig(event)["nuxt-ai-ready"].apiCatalog;
12
+ if (!["GET", "HEAD"].includes(event.req.method))
13
+ throw createError({ status: 405, statusText: "Method Not Allowed" });
14
+ const config = useRuntimeConfig()["nuxt-ai-ready"].apiCatalog;
15
15
  if (!config)
16
- throw createError({ statusCode: 404, message: "API catalog is not configured" });
17
- setHeader(event, "content-type", config.mediaType);
18
- setHeader(event, "link", `<${config.href}>; rel="api-catalog"`);
19
- if (event.method === "HEAD")
16
+ throw createError({ status: 404, message: "API catalog is not configured" });
17
+ event.res.headers.set("content-type", config.mediaType);
18
+ event.res.headers.set("link", `<${config.href}>; rel="api-catalog"`);
19
+ if (event.req.method === "HEAD")
20
20
  return;
21
21
  return config.document;
22
22
  });
@@ -15,7 +15,7 @@ export default eventHandler(async (event) => {
15
15
  const config = runtimeConfig["nuxt-ai-ready"];
16
16
  const siteConfig = getSiteConfig(event);
17
17
  const baseURL = runtimeConfig.app.baseURL;
18
- const canonicalSiteUrl = siteConfig.url ? withSiteUrl(event, toDeployedRoute("/", baseURL)) : void 0;
18
+ const canonicalSiteUrl = siteConfig.url ? withSiteUrl(event, toDeployedRoute("/", baseURL), { withBase: true }) : void 0;
19
19
  const header = buildLlmsFullTxtHeader(
20
20
  {
21
21
  name: siteConfig.name,
@@ -1,2 +1,2 @@
1
- declare const _default: any;
1
+ declare const _default: import("nuxt/server").EventHandler<Record<string, unknown> | null>;
2
2
  export default _default;
@@ -1,9 +1,8 @@
1
- import { eventHandler, getHeader, setHeaders, setResponseStatus } from "#nuxtseo/h3";
2
- import { useRuntimeConfig } from "#nuxtseo/nitro";
1
+ import { defineEventHandler, getRequestHeader, setResponseStatus, useRuntimeConfig } from "nuxt/server";
3
2
  import { matchesDiscoveryEtag, MCP_SERVER_CARD_MEDIA_TYPE } from "../utils/discovery-response.js";
4
- export default eventHandler((event) => {
5
- const config = useRuntimeConfig(event)["nuxt-ai-ready"];
6
- setHeaders(event, {
3
+ export default defineEventHandler((event) => {
4
+ const config = useRuntimeConfig()["nuxt-ai-ready"];
5
+ Object.entries({
7
6
  "Access-Control-Allow-Headers": "Content-Type, If-None-Match",
8
7
  "Access-Control-Allow-Methods": "GET, HEAD",
9
8
  "Access-Control-Allow-Origin": "*",
@@ -11,12 +10,12 @@ export default eventHandler((event) => {
11
10
  "Cache-Control": `public, max-age=${config.mcpServerCard.cacheMaxAge}`,
12
11
  "Content-Type": MCP_SERVER_CARD_MEDIA_TYPE,
13
12
  "ETag": config.mcpServerCard.etag
14
- });
15
- if (event.method === "OPTIONS") {
13
+ }).forEach(([name, value]) => event.res.headers.set(name, value));
14
+ if (event.req.method === "OPTIONS") {
16
15
  setResponseStatus(event, 204);
17
16
  return null;
18
17
  }
19
- if (matchesDiscoveryEtag(getHeader(event, "if-none-match"), config.mcpServerCard.etag)) {
18
+ if (matchesDiscoveryEtag(getRequestHeader(event, "if-none-match"), config.mcpServerCard.etag)) {
20
19
  setResponseStatus(event, 304);
21
20
  return null;
22
21
  }
@@ -1,4 +1,4 @@
1
- import type { H3Event } from '#nuxtseo/h3';
1
+ import type { AiReadyDatabaseEvent } from '../db/context.js';
2
2
  export interface BuildMeta {
3
3
  buildId: string;
4
4
  pageCount: number;
@@ -25,4 +25,4 @@ export declare const STALE_CHECK_INTERVAL_MS: number;
25
25
  * 2. Build ID changed → compare hashes, only mark changed pages pending, add new pages from dump
26
26
  * Skips HTTP fetch if checked within 5 minutes and DB is populated
27
27
  */
28
- export declare function checkAndHandleStale(event?: H3Event): Promise<StaleCheckResult>;
28
+ export declare function checkAndHandleStale(event?: AiReadyDatabaseEvent): Promise<StaleCheckResult>;
@@ -0,0 +1,3 @@
1
+ import type { H3Event } from '#nuxtseo/h3';
2
+ /** Serve the original static HTML after negotiation, without rendering it again. */
3
+ export declare function serveCloudflarePrerenderedPage(event: H3Event): Promise<Response | undefined>;
@@ -0,0 +1,23 @@
1
+ import { getRequestHeaders, getRequestURL, getResponseHeaders } from "#nuxtseo/h3";
2
+ import { useRuntimeConfig } from "#nuxtseo/nitro";
3
+ import { mergeVaryHeader } from "../../cache-control.js";
4
+ export async function serveCloudflarePrerenderedPage(event) {
5
+ if (event.method !== "GET" && event.method !== "HEAD")
6
+ return;
7
+ const config = useRuntimeConfig(event)["nuxt-ai-ready"];
8
+ const url = getRequestURL(event);
9
+ if (!config.cloudflarePrerenderedPages?.includes(url.pathname))
10
+ return;
11
+ const assets = event.context.cloudflare?.env?.ASSETS;
12
+ if (!assets)
13
+ return;
14
+ const response = await assets.fetch(new Request(url, { method: event.method, headers: getRequestHeaders(event) }));
15
+ const headers = new Headers(response.headers);
16
+ for (const [name, value] of Object.entries(getResponseHeaders(event))) {
17
+ if (value === void 0)
18
+ continue;
19
+ const header = Array.isArray(value) ? value.join(", ") : String(value);
20
+ headers.set(name, name.toLowerCase() === "vary" ? mergeVaryHeader(headers.get(name) ?? void 0, header) : header);
21
+ }
22
+ return new Response(response.body, { status: response.status, statusText: response.statusText, headers });
23
+ }
@@ -1,4 +1,4 @@
1
- import type { H3Event } from '#nuxtseo/h3';
1
+ import type { AiReadyDatabaseEvent } from '../db/context.js';
2
2
  export interface CloudflareEnv {
3
3
  ASSETS?: {
4
4
  fetch: (req: Request | string) => Promise<Response>;
@@ -7,15 +7,15 @@ export interface CloudflareEnv {
7
7
  /**
8
8
  * Get Cloudflare environment from event context or globalThis.__env__ (for scheduled tasks)
9
9
  */
10
- export declare function getCfEnv(event?: H3Event): CloudflareEnv | undefined;
10
+ export declare function getCfEnv(event?: AiReadyDatabaseEvent): CloudflareEnv | undefined;
11
11
  /**
12
12
  * Check if Cloudflare ASSETS binding is available
13
13
  */
14
- export declare function hasAssets(event?: H3Event): boolean;
14
+ export declare function hasAssets(event?: AiReadyDatabaseEvent): boolean;
15
15
  /**
16
16
  * Fetch a public asset, preferring Cloudflare ASSETS binding when available.
17
- * Falls back to $fetch with timeout to avoid self-fetch hangs on CF Workers.
17
+ * Falls back to Nitro localFetch with a timeout for unavailable assets.
18
18
  */
19
- export declare function fetchPublicAsset<T = unknown>(event: H3Event | undefined, path: string, options?: {
19
+ export declare function fetchPublicAsset<T = unknown>(event: AiReadyDatabaseEvent | undefined, path: string, options?: {
20
20
  responseType?: 'json' | 'text' | 'arrayBuffer' | 'stream';
21
21
  }): Promise<T | null>;
@@ -1,11 +1,14 @@
1
1
  import { withBase } from "ufo";
2
- import { useRuntimeConfig } from "#nuxtseo/nitro";
2
+ import { localFetch, useRuntimeConfig } from "#nuxtseo/nitro";
3
+ import { DB_CONTEXT_KEY, DB_PROMISE_CONTEXT_KEY, DB_WORK_CONTEXT_KEY } from "../db/context.js";
3
4
  const FETCH_TIMEOUT = 5e3;
5
+ const RETRY_STATUSES = /* @__PURE__ */ new Set([408, 409, 425, 429, 500, 502, 503, 504]);
4
6
  function unavailablePublicAsset(_error) {
5
7
  return null;
6
8
  }
7
9
  export function getCfEnv(event) {
8
- return event?.context?.cloudflare?.env ?? globalThis.__env__;
10
+ const cloudflare = event?.context.cloudflare;
11
+ return cloudflare?.env ?? globalThis.__env__;
9
12
  }
10
13
  export function hasAssets(event) {
11
14
  return !!getCfEnv(event)?.ASSETS?.fetch;
@@ -31,9 +34,30 @@ export async function fetchPublicAsset(event, path, options) {
31
34
  }
32
35
  const controller = new AbortController();
33
36
  const timeout = setTimeout(() => controller.abort(), FETCH_TIMEOUT);
34
- return globalThis.$fetch(withBase(path, useRuntimeConfig(event).app.baseURL), {
35
- baseURL: "/",
36
- signal: controller.signal,
37
- responseType
38
- }).catch(unavailablePublicAsset).finally(() => clearTimeout(timeout));
37
+ const assetContext = event && Object.fromEntries(
38
+ Object.entries(event.context).filter(([key]) => ![DB_CONTEXT_KEY, DB_PROMISE_CONTEXT_KEY, DB_WORK_CONTEXT_KEY].includes(key))
39
+ );
40
+ return (async () => {
41
+ for (let attempt = 0; attempt < 2; attempt++) {
42
+ const response = await localFetch(withBase(path, useRuntimeConfig().app.baseURL), {
43
+ signal: controller.signal
44
+ }, assetContext).catch(unavailablePublicAsset);
45
+ if (attempt === 0 && !controller.signal.aborted && (!response || RETRY_STATUSES.has(response.status))) {
46
+ await response?.body?.cancel().catch(unavailablePublicAsset);
47
+ continue;
48
+ }
49
+ if (!response?.ok) {
50
+ await response?.body?.cancel().catch(unavailablePublicAsset);
51
+ return null;
52
+ }
53
+ if (responseType === "stream")
54
+ return response.body;
55
+ if (responseType === "text")
56
+ return response.text().catch(unavailablePublicAsset);
57
+ if (responseType === "arrayBuffer")
58
+ return response.arrayBuffer().catch(unavailablePublicAsset);
59
+ return response.json().catch(unavailablePublicAsset);
60
+ }
61
+ return null;
62
+ })().finally(() => clearTimeout(timeout));
39
63
  }
@@ -1,22 +1,24 @@
1
1
  import type { ContentNegotiationPolicy } from '../../types.js';
2
- export declare const CONTENT_NEGOTIATION_VARY = "Accept, Sec-Fetch-Dest, User-Agent";
2
+ export declare function getContentNegotiationVary(botNegotiation?: boolean): "Accept" | "Accept, Sec-Fetch-Dest, User-Agent";
3
3
  export interface NegotiationRouteRule {
4
4
  cache?: boolean | Record<string, unknown> & {
5
5
  headersOnly?: boolean;
6
- varies?: string[];
6
+ varies?: readonly string[];
7
7
  };
8
8
  isr?: boolean | number | {
9
- expiration: number;
9
+ expiration?: number | false;
10
10
  };
11
11
  }
12
12
  export type ContentNegotiationResolution = {
13
13
  _tag: 'enabled';
14
14
  source: 'default' | 'explicit';
15
+ vary: ReturnType<typeof getContentNegotiationVary>;
15
16
  } | {
16
17
  _tag: 'disabled';
17
18
  source: 'explicit' | 'isr' | 'route-cache';
18
19
  };
19
20
  export declare function resolveContentNegotiation(input: {
20
21
  policy: ContentNegotiationPolicy;
22
+ botNegotiation?: boolean;
21
23
  routeRule: NegotiationRouteRule;
22
24
  }): ContentNegotiationResolution;
@@ -1,6 +1,7 @@
1
- export const CONTENT_NEGOTIATION_VARY = "Accept, Sec-Fetch-Dest, User-Agent";
2
- const NEGOTIATION_CACHE_HEADERS = CONTENT_NEGOTIATION_VARY.split(",").map((header) => header.trim().toLowerCase());
3
- function cachesWithoutNegotiationVariation(cache) {
1
+ export function getContentNegotiationVary(botNegotiation = false) {
2
+ return botNegotiation ? "Accept, Sec-Fetch-Dest, User-Agent" : "Accept";
3
+ }
4
+ function cachesWithoutNegotiationVariation(cache, botNegotiation) {
4
5
  if (!cache)
5
6
  return false;
6
7
  if (typeof cache !== "object")
@@ -8,16 +9,16 @@ function cachesWithoutNegotiationVariation(cache) {
8
9
  if (cache.headersOnly)
9
10
  return false;
10
11
  const varies = new Set(cache.varies?.map((header) => header.toLowerCase()));
11
- return NEGOTIATION_CACHE_HEADERS.some((header) => !varies.has(header));
12
+ return getContentNegotiationVary(botNegotiation).split(",").some((header) => !varies.has(header.trim().toLowerCase()));
12
13
  }
13
14
  export function resolveContentNegotiation(input) {
14
15
  if (input.policy === "enabled")
15
- return { _tag: "enabled", source: "explicit" };
16
+ return { _tag: "enabled", source: "explicit", vary: getContentNegotiationVary(input.botNegotiation) };
16
17
  if (input.policy === "disabled")
17
18
  return { _tag: "disabled", source: "explicit" };
18
19
  if (input.routeRule.isr)
19
20
  return { _tag: "disabled", source: "isr" };
20
- if (cachesWithoutNegotiationVariation(input.routeRule.cache))
21
+ if (cachesWithoutNegotiationVariation(input.routeRule.cache, input.botNegotiation === true))
21
22
  return { _tag: "disabled", source: "route-cache" };
22
- return { _tag: "enabled", source: "default" };
23
+ return { _tag: "enabled", source: "default", vary: getContentNegotiationVary(input.botNegotiation) };
23
24
  }