nuxt-ai-ready 2.4.1 → 2.5.1

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 (216) hide show
  1. package/README.md +8 -4
  2. package/dist/chunks/agent-skills.mjs +1 -1
  3. package/dist/chunks/prerender.mjs +1 -1
  4. package/dist/module.json +1 -1
  5. package/dist/module.mjs +1 -1
  6. package/dist/runtime/app/plugins/md-hints.prerender.js +4 -4
  7. package/dist/runtime/llms-txt-utils.js +2 -6
  8. package/dist/runtime/markdown-path.d.ts +7 -3
  9. package/dist/runtime/markdown-path.js +6 -6
  10. package/dist/runtime/server/db/queries.js +28 -5
  11. package/dist/runtime/server/middleware/markdown.js +1 -1
  12. package/dist/runtime/server/middleware/markdown.prerender.js +1 -0
  13. package/dist/runtime/server/utils/checkStale.js +13 -2
  14. package/dist/runtime/server/utils/cloudflare.js +3 -1
  15. package/dist/runtime/server/utils/frontmatter.d.ts +6 -0
  16. package/dist/runtime/server/utils/frontmatter.js +23 -1
  17. package/dist/runtime/server/utils/indexPage.js +4 -1
  18. package/dist/runtime/server/utils/sitemap-routes.js +2 -1
  19. package/dist/runtime/server/utils.d.ts +8 -4
  20. package/dist/runtime/server/utils.js +15 -19
  21. package/dist/runtime/types.d.ts +8 -4
  22. package/dist/shared/{nuxt-ai-ready.CxJE2WLA.mjs → nuxt-ai-ready.CLSWou20.mjs} +6 -10
  23. package/node_modules/@mdream/js/LICENSE.md +9 -0
  24. package/node_modules/@mdream/js/README.md +792 -0
  25. package/node_modules/@mdream/js/bin/mdream.mjs +2 -0
  26. package/node_modules/@mdream/js/dist/_chunks/const.mjs +134 -0
  27. package/node_modules/@mdream/js/dist/_chunks/index.d.mts +9 -0
  28. package/node_modules/@mdream/js/dist/_chunks/markdown-processor.mjs +1968 -0
  29. package/node_modules/@mdream/js/dist/_chunks/minimal.d.mts +6 -0
  30. package/node_modules/@mdream/js/dist/_chunks/parse.mjs +2756 -0
  31. package/node_modules/@mdream/js/dist/_chunks/plugins.mjs +725 -0
  32. package/node_modules/@mdream/js/dist/_chunks/resolve-plugins.mjs +44 -0
  33. package/node_modules/@mdream/js/dist/_chunks/stream.mjs +37 -0
  34. package/node_modules/@mdream/js/dist/_chunks/types.d.mts +473 -0
  35. package/node_modules/@mdream/js/dist/cli.d.mts +1 -0
  36. package/node_modules/@mdream/js/dist/cli.mjs +32 -0
  37. package/node_modules/@mdream/js/dist/core.d.mts +15 -0
  38. package/node_modules/@mdream/js/dist/core.mjs +28 -0
  39. package/node_modules/@mdream/js/dist/index.d.mts +4 -0
  40. package/node_modules/@mdream/js/dist/index.mjs +58 -0
  41. package/node_modules/@mdream/js/dist/llms-txt.d.mts +86 -0
  42. package/node_modules/@mdream/js/dist/llms-txt.mjs +308 -0
  43. package/node_modules/@mdream/js/dist/negotiate.d.mts +35 -0
  44. package/node_modules/@mdream/js/dist/negotiate.mjs +121 -0
  45. package/node_modules/@mdream/js/dist/parse.d.mts +90 -0
  46. package/node_modules/@mdream/js/dist/parse.mjs +2 -0
  47. package/node_modules/@mdream/js/dist/plugins.d.mts +85 -0
  48. package/node_modules/@mdream/js/dist/plugins.mjs +2 -0
  49. package/node_modules/@mdream/js/dist/preset/minimal.d.mts +2 -0
  50. package/node_modules/@mdream/js/dist/preset/minimal.mjs +33 -0
  51. package/node_modules/@mdream/js/dist/splitter.d.mts +18 -0
  52. package/node_modules/@mdream/js/dist/splitter.mjs +194 -0
  53. package/node_modules/@mdream/js/package.json +103 -0
  54. package/node_modules/cac/LICENSE +21 -0
  55. package/node_modules/cac/README.md +492 -0
  56. package/node_modules/cac/dist/index.d.ts +196 -0
  57. package/node_modules/cac/dist/index.js +638 -0
  58. package/node_modules/cac/package.json +72 -0
  59. package/node_modules/mdream/LICENSE.md +9 -0
  60. package/node_modules/mdream/README.md +1091 -0
  61. package/node_modules/mdream/bin/mdream.mjs +46 -0
  62. package/node_modules/mdream/dist/browser.d.mts +105 -0
  63. package/node_modules/mdream/dist/browser.mjs +262 -0
  64. package/node_modules/mdream/dist/edge.d.mts +100 -0
  65. package/node_modules/mdream/dist/edge.mjs +250 -0
  66. package/node_modules/mdream/dist/iife.js +605 -0
  67. package/node_modules/mdream/dist/index.d.mts +89 -0
  68. package/node_modules/mdream/dist/index.mjs +184 -0
  69. package/node_modules/mdream/dist/wasm.d.mts +100 -0
  70. package/node_modules/mdream/dist/wasm.mjs +140 -0
  71. package/node_modules/mdream/dist/worker.d.mts +101 -0
  72. package/node_modules/mdream/dist/worker.mjs +217 -0
  73. package/node_modules/mdream/napi/index.d.mts +127 -0
  74. package/node_modules/mdream/napi/index.d.ts +127 -0
  75. package/node_modules/mdream/napi/index.mjs +725 -0
  76. package/node_modules/mdream/napi/rust.android-arm-eabi.node +0 -0
  77. package/node_modules/mdream/napi/rust.android-arm64.node +0 -0
  78. package/node_modules/mdream/napi/rust.darwin-arm64.node +0 -0
  79. package/node_modules/mdream/napi/rust.darwin-x64.node +0 -0
  80. package/node_modules/mdream/napi/rust.freebsd-x64.node +0 -0
  81. package/node_modules/mdream/napi/rust.linux-arm-gnueabihf.node +0 -0
  82. package/node_modules/mdream/napi/rust.linux-arm64-gnu.node +0 -0
  83. package/node_modules/mdream/napi/rust.linux-arm64-musl.node +0 -0
  84. package/node_modules/mdream/napi/rust.linux-x64-gnu.node +0 -0
  85. package/node_modules/mdream/napi/rust.linux-x64-musl.node +0 -0
  86. package/node_modules/mdream/napi/rust.wasi.cjs +2144 -0
  87. package/node_modules/mdream/napi/rust.wasm32-wasi.wasm +0 -0
  88. package/node_modules/mdream/napi/rust.win32-arm64-msvc.node +0 -0
  89. package/node_modules/mdream/napi/rust.win32-x64-msvc.node +0 -0
  90. package/node_modules/mdream/node_modules/@emnapi/core/LICENSE +21 -0
  91. package/node_modules/mdream/node_modules/@emnapi/core/README.md +1 -0
  92. package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.d.ts +392 -0
  93. package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.full.d.ts +392 -0
  94. package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.full.js +8351 -0
  95. package/node_modules/mdream/node_modules/@emnapi/core/dist/emnapi-core.js +7268 -0
  96. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/async-work.d.ts +5 -0
  97. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/async-work.js +843 -0
  98. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/index.d.ts +4 -0
  99. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/index.js +3 -0
  100. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/threadsafe-function.d.ts +5 -0
  101. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/threadsafe-function.js +1010 -0
  102. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/v8.d.ts +5 -0
  103. package/node_modules/mdream/node_modules/@emnapi/core/dist/plugins/v8.js +1446 -0
  104. package/node_modules/mdream/node_modules/@emnapi/core/package.json +39 -0
  105. package/node_modules/mdream/node_modules/@emnapi/core/rollup.config.js +60 -0
  106. package/node_modules/mdream/node_modules/@emnapi/runtime/LICENSE +21 -0
  107. package/node_modules/mdream/node_modules/@emnapi/runtime/README.md +1 -0
  108. package/node_modules/mdream/node_modules/@emnapi/runtime/dist/emnapi.d.ts +833 -0
  109. package/node_modules/mdream/node_modules/@emnapi/runtime/dist/emnapi.js +2306 -0
  110. package/node_modules/mdream/node_modules/@emnapi/runtime/dist/emnapi.js.map +1 -0
  111. package/node_modules/mdream/node_modules/@emnapi/runtime/index.cjs +63 -0
  112. package/node_modules/mdream/node_modules/@emnapi/runtime/package.json +39 -0
  113. package/node_modules/mdream/node_modules/@emnapi/runtime/rollup.config.js +25 -0
  114. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/LICENSE +21 -0
  115. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/README.md +203 -0
  116. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.ts +236 -0
  117. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/dist/wasi-threads.js +1086 -0
  118. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/package.json +35 -0
  119. package/node_modules/mdream/node_modules/@emnapi/wasi-threads/rollup.config.js +6 -0
  120. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/emnapi-plugins.cjs +1472 -0
  121. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/emnapi-plugins.js +1470 -0
  122. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/fs-proxy.cjs +237 -0
  123. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/dist/fs.js +18260 -0
  124. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/fs-proxy.js +317 -0
  125. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/package.json +67 -0
  126. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/runtime.cjs +39 -0
  127. package/node_modules/mdream/node_modules/@napi-rs/wasm-runtime/runtime.js +36 -0
  128. package/node_modules/mdream/node_modules/@tybys/wasm-util/LICENSE +21 -0
  129. package/node_modules/mdream/node_modules/@tybys/wasm-util/README.md +193 -0
  130. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/tsdoc-metadata.json +11 -0
  131. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.d.ts +423 -0
  132. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.esm-bundler.js +2932 -0
  133. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.esm.js +2932 -0
  134. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.esm.min.js +1 -0
  135. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.js +2954 -0
  136. package/node_modules/mdream/node_modules/@tybys/wasm-util/dist/wasm-util.min.js +1 -0
  137. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/asyncify.js +158 -0
  138. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/index.js +13 -0
  139. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/jspi.js +46 -0
  140. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/load.js +97 -0
  141. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/memory.js +35 -0
  142. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/error.js +103 -0
  143. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/fd.js +268 -0
  144. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/fs.js +3 -0
  145. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/index.js +192 -0
  146. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/path.js +316 -0
  147. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/preview1.js +1599 -0
  148. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/rights.js +141 -0
  149. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/types.js +220 -0
  150. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/wasi/util.js +128 -0
  151. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/cjs/webassembly.js +13 -0
  152. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/asyncify.mjs +153 -0
  153. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/index.mjs +9 -0
  154. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/jspi.mjs +39 -0
  155. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/load.mjs +89 -0
  156. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/memory.mjs +28 -0
  157. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/error.mjs +97 -0
  158. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/fd.mjs +256 -0
  159. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/fs.mjs +1 -0
  160. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/index.mjs +186 -0
  161. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/path.mjs +310 -0
  162. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/preview1.mjs +1593 -0
  163. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/rights.mjs +135 -0
  164. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/types.mjs +216 -0
  165. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/wasi/util.mjs +113 -0
  166. package/node_modules/mdream/node_modules/@tybys/wasm-util/lib/mjs/webassembly.mjs +9 -0
  167. package/node_modules/mdream/node_modules/@tybys/wasm-util/package.json +58 -0
  168. package/node_modules/mdream/node_modules/tslib/CopyrightNotice.txt +15 -0
  169. package/node_modules/mdream/node_modules/tslib/LICENSE.txt +12 -0
  170. package/node_modules/mdream/node_modules/tslib/README.md +164 -0
  171. package/node_modules/mdream/node_modules/tslib/SECURITY.md +41 -0
  172. package/node_modules/mdream/node_modules/tslib/modules/index.d.ts +38 -0
  173. package/node_modules/mdream/node_modules/tslib/modules/index.js +70 -0
  174. package/node_modules/mdream/node_modules/tslib/modules/package.json +3 -0
  175. package/node_modules/mdream/node_modules/tslib/package.json +47 -0
  176. package/node_modules/mdream/node_modules/tslib/tslib.d.ts +460 -0
  177. package/node_modules/mdream/node_modules/tslib/tslib.es6.html +1 -0
  178. package/node_modules/mdream/node_modules/tslib/tslib.es6.js +402 -0
  179. package/node_modules/mdream/node_modules/tslib/tslib.es6.mjs +401 -0
  180. package/node_modules/mdream/node_modules/tslib/tslib.html +1 -0
  181. package/node_modules/mdream/node_modules/tslib/tslib.js +484 -0
  182. package/node_modules/mdream/package.json +110 -0
  183. package/node_modules/mdream/skills/mdream/SKILL.md +124 -0
  184. package/node_modules/mdream/skills/mdream/references/runtimes.md +49 -0
  185. package/node_modules/mdream/wasm/mdream_edge.d.ts +90 -0
  186. package/node_modules/mdream/wasm/mdream_edge.js +517 -0
  187. package/node_modules/mdream/wasm/mdream_edge_bg.wasm +0 -0
  188. package/node_modules/mdream/wasm/mdream_edge_bg.wasm.d.ts +20 -0
  189. package/node_modules/mdream/wasm/package.json +17 -0
  190. package/node_modules/mdream/wasm-bundler/mdream_edge.d.ts +45 -0
  191. package/node_modules/mdream/wasm-bundler/mdream_edge.js +13 -0
  192. package/node_modules/mdream/wasm-bundler/mdream_edge_bg.js +413 -0
  193. package/node_modules/mdream/wasm-bundler/mdream_edge_bg.wasm +0 -0
  194. package/node_modules/mdream/wasm-bundler/mdream_edge_bg.wasm.d.ts +20 -0
  195. package/node_modules/mdream/wasm-bundler/package.json +19 -0
  196. package/node_modules/pathe/LICENSE +70 -0
  197. package/node_modules/pathe/README.md +73 -0
  198. package/node_modules/pathe/dist/index.cjs +39 -0
  199. package/node_modules/pathe/dist/index.d.cts +47 -0
  200. package/node_modules/pathe/dist/index.d.mts +47 -0
  201. package/node_modules/pathe/dist/index.d.ts +47 -0
  202. package/node_modules/pathe/dist/index.mjs +19 -0
  203. package/node_modules/pathe/dist/shared/pathe.BSlhyZSM.cjs +266 -0
  204. package/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +249 -0
  205. package/node_modules/pathe/dist/utils.cjs +82 -0
  206. package/node_modules/pathe/dist/utils.d.cts +32 -0
  207. package/node_modules/pathe/dist/utils.d.mts +32 -0
  208. package/node_modules/pathe/dist/utils.d.ts +32 -0
  209. package/node_modules/pathe/dist/utils.mjs +77 -0
  210. package/node_modules/pathe/package.json +61 -0
  211. package/node_modules/pathe/utils.d.ts +1 -0
  212. package/package.json +11 -67
  213. package/skills/nuxt-ai-ready/SKILL.md +123 -0
  214. package/skills/nuxt-ai-ready/references/runtime-indexing.md +75 -0
  215. package/dist/runtime/server/plugins/mcp-data.d.ts +0 -10
  216. package/dist/runtime/server/plugins/mcp-data.js +0 -22
@@ -0,0 +1,82 @@
1
+ 'use strict';
2
+
3
+ const _path = require('./shared/pathe.BSlhyZSM.cjs');
4
+
5
+ const pathSeparators = /* @__PURE__ */ new Set(["/", "\\", void 0]);
6
+ const normalizedAliasSymbol = Symbol.for("pathe:normalizedAlias");
7
+ const SLASH_RE = /[/\\]/;
8
+ function normalizeAliases(_aliases) {
9
+ if (_aliases[normalizedAliasSymbol]) {
10
+ return _aliases;
11
+ }
12
+ const aliases = Object.fromEntries(
13
+ Object.entries(_aliases).sort(([a], [b]) => _compareAliases(a, b))
14
+ );
15
+ for (const key in aliases) {
16
+ for (const alias in aliases) {
17
+ if (alias === key || key.startsWith(alias)) {
18
+ continue;
19
+ }
20
+ if (aliases[key]?.startsWith(alias) && pathSeparators.has(aliases[key][alias.length])) {
21
+ aliases[key] = aliases[alias] + aliases[key].slice(alias.length);
22
+ }
23
+ }
24
+ }
25
+ Object.defineProperty(aliases, normalizedAliasSymbol, {
26
+ value: true,
27
+ enumerable: false
28
+ });
29
+ return aliases;
30
+ }
31
+ function resolveAlias(path, aliases) {
32
+ const _path$1 = _path.normalizeWindowsPath(path);
33
+ aliases = normalizeAliases(aliases);
34
+ for (const [alias, to] of Object.entries(aliases)) {
35
+ if (!_path$1.startsWith(alias)) {
36
+ continue;
37
+ }
38
+ const _alias = hasTrailingSlash(alias) ? alias.slice(0, -1) : alias;
39
+ if (hasTrailingSlash(_path$1[_alias.length])) {
40
+ return _path.join(to, _path$1.slice(alias.length));
41
+ }
42
+ }
43
+ return _path$1;
44
+ }
45
+ function reverseResolveAlias(path, aliases) {
46
+ const _path$1 = _path.normalizeWindowsPath(path);
47
+ aliases = normalizeAliases(aliases);
48
+ const matches = [];
49
+ for (const [to, alias] of Object.entries(aliases)) {
50
+ if (!_path$1.startsWith(alias)) {
51
+ continue;
52
+ }
53
+ const _alias = hasTrailingSlash(alias) ? alias.slice(0, -1) : alias;
54
+ if (hasTrailingSlash(_path$1[_alias.length])) {
55
+ matches.push(_path.join(to, _path$1.slice(alias.length)));
56
+ }
57
+ }
58
+ return matches.sort((a, b) => b.length - a.length);
59
+ }
60
+ function filename(path) {
61
+ const base = path.split(SLASH_RE).pop();
62
+ if (!base) {
63
+ return void 0;
64
+ }
65
+ const separatorIndex = base.lastIndexOf(".");
66
+ if (separatorIndex <= 0) {
67
+ return base;
68
+ }
69
+ return base.slice(0, separatorIndex);
70
+ }
71
+ function _compareAliases(a, b) {
72
+ return b.split("/").length - a.split("/").length;
73
+ }
74
+ function hasTrailingSlash(path = "/") {
75
+ const lastChar = path[path.length - 1];
76
+ return lastChar === "/" || lastChar === "\\";
77
+ }
78
+
79
+ exports.filename = filename;
80
+ exports.normalizeAliases = normalizeAliases;
81
+ exports.resolveAlias = resolveAlias;
82
+ exports.reverseResolveAlias = reverseResolveAlias;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Normalises alias mappings, ensuring that more specific aliases are resolved before less specific ones.
3
+ * This function also ensures that aliases do not resolve to themselves cyclically.
4
+ *
5
+ * @param _aliases - A set of alias mappings where each key is an alias and its value is the actual path it points to.
6
+ * @returns a set of normalised alias mappings.
7
+ */
8
+ declare function normalizeAliases(_aliases: Record<string, string>): Record<string, string>;
9
+ /**
10
+ * Resolves a path string to its alias if applicable, otherwise returns the original path.
11
+ * This function normalises the path, resolves the alias and then joins it to the alias target if necessary.
12
+ *
13
+ * @param path - The path string to resolve.
14
+ * @param aliases - A set of alias mappings to use for resolution.
15
+ * @returns the resolved path as a string.
16
+ */
17
+ declare function resolveAlias(path: string, aliases: Record<string, string>): string;
18
+ /**
19
+ * Resolves a path string to its possible alias.
20
+ *
21
+ * Returns an array of possible alias resolutions (could be empty), sorted by specificity (longest first).
22
+ */
23
+ declare function reverseResolveAlias(path: string, aliases: Record<string, string>): string[];
24
+ /**
25
+ * Extracts the filename from a given path, excluding any directory paths and the file extension.
26
+ *
27
+ * @param path - The full path of the file from which to extract the filename.
28
+ * @returns the filename without the extension, or `undefined` if the filename cannot be extracted.
29
+ */
30
+ declare function filename(path: string): string | undefined;
31
+
32
+ export { filename, normalizeAliases, resolveAlias, reverseResolveAlias };
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Normalises alias mappings, ensuring that more specific aliases are resolved before less specific ones.
3
+ * This function also ensures that aliases do not resolve to themselves cyclically.
4
+ *
5
+ * @param _aliases - A set of alias mappings where each key is an alias and its value is the actual path it points to.
6
+ * @returns a set of normalised alias mappings.
7
+ */
8
+ declare function normalizeAliases(_aliases: Record<string, string>): Record<string, string>;
9
+ /**
10
+ * Resolves a path string to its alias if applicable, otherwise returns the original path.
11
+ * This function normalises the path, resolves the alias and then joins it to the alias target if necessary.
12
+ *
13
+ * @param path - The path string to resolve.
14
+ * @param aliases - A set of alias mappings to use for resolution.
15
+ * @returns the resolved path as a string.
16
+ */
17
+ declare function resolveAlias(path: string, aliases: Record<string, string>): string;
18
+ /**
19
+ * Resolves a path string to its possible alias.
20
+ *
21
+ * Returns an array of possible alias resolutions (could be empty), sorted by specificity (longest first).
22
+ */
23
+ declare function reverseResolveAlias(path: string, aliases: Record<string, string>): string[];
24
+ /**
25
+ * Extracts the filename from a given path, excluding any directory paths and the file extension.
26
+ *
27
+ * @param path - The full path of the file from which to extract the filename.
28
+ * @returns the filename without the extension, or `undefined` if the filename cannot be extracted.
29
+ */
30
+ declare function filename(path: string): string | undefined;
31
+
32
+ export { filename, normalizeAliases, resolveAlias, reverseResolveAlias };
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Normalises alias mappings, ensuring that more specific aliases are resolved before less specific ones.
3
+ * This function also ensures that aliases do not resolve to themselves cyclically.
4
+ *
5
+ * @param _aliases - A set of alias mappings where each key is an alias and its value is the actual path it points to.
6
+ * @returns a set of normalised alias mappings.
7
+ */
8
+ declare function normalizeAliases(_aliases: Record<string, string>): Record<string, string>;
9
+ /**
10
+ * Resolves a path string to its alias if applicable, otherwise returns the original path.
11
+ * This function normalises the path, resolves the alias and then joins it to the alias target if necessary.
12
+ *
13
+ * @param path - The path string to resolve.
14
+ * @param aliases - A set of alias mappings to use for resolution.
15
+ * @returns the resolved path as a string.
16
+ */
17
+ declare function resolveAlias(path: string, aliases: Record<string, string>): string;
18
+ /**
19
+ * Resolves a path string to its possible alias.
20
+ *
21
+ * Returns an array of possible alias resolutions (could be empty), sorted by specificity (longest first).
22
+ */
23
+ declare function reverseResolveAlias(path: string, aliases: Record<string, string>): string[];
24
+ /**
25
+ * Extracts the filename from a given path, excluding any directory paths and the file extension.
26
+ *
27
+ * @param path - The full path of the file from which to extract the filename.
28
+ * @returns the filename without the extension, or `undefined` if the filename cannot be extracted.
29
+ */
30
+ declare function filename(path: string): string | undefined;
31
+
32
+ export { filename, normalizeAliases, resolveAlias, reverseResolveAlias };
@@ -0,0 +1,77 @@
1
+ import { g as normalizeWindowsPath, j as join } from './shared/pathe.M-eThtNZ.mjs';
2
+
3
+ const pathSeparators = /* @__PURE__ */ new Set(["/", "\\", void 0]);
4
+ const normalizedAliasSymbol = Symbol.for("pathe:normalizedAlias");
5
+ const SLASH_RE = /[/\\]/;
6
+ function normalizeAliases(_aliases) {
7
+ if (_aliases[normalizedAliasSymbol]) {
8
+ return _aliases;
9
+ }
10
+ const aliases = Object.fromEntries(
11
+ Object.entries(_aliases).sort(([a], [b]) => _compareAliases(a, b))
12
+ );
13
+ for (const key in aliases) {
14
+ for (const alias in aliases) {
15
+ if (alias === key || key.startsWith(alias)) {
16
+ continue;
17
+ }
18
+ if (aliases[key]?.startsWith(alias) && pathSeparators.has(aliases[key][alias.length])) {
19
+ aliases[key] = aliases[alias] + aliases[key].slice(alias.length);
20
+ }
21
+ }
22
+ }
23
+ Object.defineProperty(aliases, normalizedAliasSymbol, {
24
+ value: true,
25
+ enumerable: false
26
+ });
27
+ return aliases;
28
+ }
29
+ function resolveAlias(path, aliases) {
30
+ const _path = normalizeWindowsPath(path);
31
+ aliases = normalizeAliases(aliases);
32
+ for (const [alias, to] of Object.entries(aliases)) {
33
+ if (!_path.startsWith(alias)) {
34
+ continue;
35
+ }
36
+ const _alias = hasTrailingSlash(alias) ? alias.slice(0, -1) : alias;
37
+ if (hasTrailingSlash(_path[_alias.length])) {
38
+ return join(to, _path.slice(alias.length));
39
+ }
40
+ }
41
+ return _path;
42
+ }
43
+ function reverseResolveAlias(path, aliases) {
44
+ const _path = normalizeWindowsPath(path);
45
+ aliases = normalizeAliases(aliases);
46
+ const matches = [];
47
+ for (const [to, alias] of Object.entries(aliases)) {
48
+ if (!_path.startsWith(alias)) {
49
+ continue;
50
+ }
51
+ const _alias = hasTrailingSlash(alias) ? alias.slice(0, -1) : alias;
52
+ if (hasTrailingSlash(_path[_alias.length])) {
53
+ matches.push(join(to, _path.slice(alias.length)));
54
+ }
55
+ }
56
+ return matches.sort((a, b) => b.length - a.length);
57
+ }
58
+ function filename(path) {
59
+ const base = path.split(SLASH_RE).pop();
60
+ if (!base) {
61
+ return void 0;
62
+ }
63
+ const separatorIndex = base.lastIndexOf(".");
64
+ if (separatorIndex <= 0) {
65
+ return base;
66
+ }
67
+ return base.slice(0, separatorIndex);
68
+ }
69
+ function _compareAliases(a, b) {
70
+ return b.split("/").length - a.split("/").length;
71
+ }
72
+ function hasTrailingSlash(path = "/") {
73
+ const lastChar = path[path.length - 1];
74
+ return lastChar === "/" || lastChar === "\\";
75
+ }
76
+
77
+ export { filename, normalizeAliases, resolveAlias, reverseResolveAlias };
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "pathe",
3
+ "version": "2.0.3",
4
+ "description": "Universal filesystem path utils",
5
+ "repository": "unjs/pathe",
6
+ "license": "MIT",
7
+ "sideEffects": false,
8
+ "type": "module",
9
+ "exports": {
10
+ ".": {
11
+ "import": {
12
+ "types": "./dist/index.d.mts",
13
+ "default": "./dist/index.mjs"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.cts",
17
+ "default": "./dist/index.cjs"
18
+ }
19
+ },
20
+ "./utils": {
21
+ "import": {
22
+ "types": "./dist/utils.d.mts",
23
+ "default": "./dist/utils.mjs"
24
+ },
25
+ "require": {
26
+ "types": "./dist/utils.d.cts",
27
+ "default": "./dist/utils.cjs"
28
+ }
29
+ }
30
+ },
31
+ "main": "./dist/index.cjs",
32
+ "module": "./dist/index.mjs",
33
+ "types": "./dist/index.d.ts",
34
+ "files": [
35
+ "dist",
36
+ "utils.d.ts"
37
+ ],
38
+ "devDependencies": {
39
+ "@types/node": "^22.13.1",
40
+ "@vitest/coverage-v8": "^3.0.5",
41
+ "changelogen": "^0.5.7",
42
+ "esbuild": "^0.25.0",
43
+ "eslint": "^9.20.1",
44
+ "eslint-config-unjs": "^0.4.2",
45
+ "jiti": "^2.4.2",
46
+ "prettier": "^3.5.0",
47
+ "typescript": "^5.7.3",
48
+ "unbuild": "^3.3.1",
49
+ "vitest": "^3.0.5",
50
+ "zeptomatch": "^2.0.0"
51
+ },
52
+ "scripts": {
53
+ "build": "unbuild",
54
+ "dev": "vitest",
55
+ "lint": "eslint . && prettier -c src test",
56
+ "lint:fix": "eslint . --fix && prettier -w src test",
57
+ "release": "pnpm test && pnpm build && changelogen --release && pnpm publish && git push --follow-tags",
58
+ "test": "pnpm lint && vitest run --coverage",
59
+ "test:types": "tsc --noEmit"
60
+ }
61
+ }
@@ -0,0 +1 @@
1
+ export * from "./dist/utils";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-ai-ready",
3
3
  "type": "module",
4
- "version": "2.4.1",
4
+ "version": "2.5.1",
5
5
  "description": "Best practice AI & LLM discoverability for Nuxt sites.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",
@@ -42,12 +42,12 @@
42
42
  "files": [
43
43
  "dist",
44
44
  "mcp.d.ts",
45
+ "skills",
45
46
  "webmcp.d.ts"
46
47
  ],
47
48
  "peerDependencies": {
48
49
  "@libsql/client": "^0.18.0",
49
50
  "@neondatabase/serverless": "^1.0.0",
50
- "@nuxtjs/sitemap": ">=8.3.1",
51
51
  "better-sqlite3": "^11.0.0 || ^12.0.0 || ^13.0.0",
52
52
  "postgres": "^3.4.9"
53
53
  },
@@ -66,13 +66,15 @@
66
66
  }
67
67
  },
68
68
  "dependencies": {
69
- "@mdream/js": "^1.7.2",
69
+ "@mdream/js": "2.0.0-beta.1",
70
70
  "@nuxt/kit": "^4.5.2",
71
+ "@nuxtjs/robots": "^6.2.3",
72
+ "@nuxtjs/sitemap": "^8.5.1",
71
73
  "citty": "^0.2.2",
72
74
  "consola": "^3.4.2",
73
75
  "defu": "^6.1.7",
74
76
  "drizzle-orm": "1.0.0-rc.4",
75
- "mdream": "^1.7.2",
77
+ "mdream": "2.0.0-beta.1",
76
78
  "nuxt-site-config": "^4.2.3",
77
79
  "nuxtseo-shared": "^5.3.16",
78
80
  "pathe": "^2.0.3",
@@ -83,66 +85,8 @@
83
85
  "uncrypto": "^0.1.3",
84
86
  "yaml": "^2.9.1"
85
87
  },
86
- "devDependencies": {
87
- "@antfu/eslint-config": "^9.5.1",
88
- "@arethetypeswrong/cli": "^0.18.5",
89
- "@harlan-zw/comark-content": "^0.1.5",
90
- "@libsql/client": "^0.18.0",
91
- "@nuxt/content": "^3.16.1",
92
- "@nuxt/module-builder": "^1.0.3",
93
- "@nuxt/test-utils": "^4.3.2",
94
- "@nuxtjs/eslint-config-typescript": "^12.1.0",
95
- "@nuxtjs/mcp-toolkit": "^0.21.0",
96
- "@nuxtjs/robots": "^6.2.3",
97
- "@nuxtjs/sitemap": "^8.5.1",
98
- "@types/better-sqlite3": "^9.6.0",
99
- "@vitest/coverage-v8": "^5.0.1",
100
- "@vue/test-utils": "^2.5.1",
101
- "@vueuse/nuxt": "^15.0.0",
102
- "better-sqlite3": "^13.0.3",
103
- "bumpp": "^12.3.0",
104
- "eslint": "^10.11.0",
105
- "eslint-plugin-harlanzw": "^0.23.0",
106
- "execa": "^10.0.1",
107
- "h3": "^1.15.11",
108
- "happy-dom": "^20.14.5",
109
- "nitropack": "^2.13.4",
110
- "nuxt": "^4.5.2",
111
- "nuxt-site-config": "^4.2.3",
112
- "nuxtseo-layer-devtools": "^5.3.16",
113
- "playwright": "^1.63.0",
114
- "playwright-core": "^1.63.0",
115
- "postgres": "^3.4.9",
116
- "tinyglobby": "^0.2.17",
117
- "typescript": "6.0.3",
118
- "unbuild": "^3.6.1",
119
- "vitest": "^5.0.1",
120
- "vue": "^3.5.43",
121
- "vue-router": "^5.3.1",
122
- "vue-tsc": "^3.3.11",
123
- "wrangler": "^4.136.3",
124
- "zod": "^4.6.5"
125
- },
126
- "scripts": {
127
- "lint": "eslint .",
128
- "lint:fix": "eslint . --fix",
129
- "build": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt-module-build build && pnpm run build:devtools && pnpm run test:dist",
130
- "build:devtools": "node -e \"require('fs').cpSync('devtools','dist/devtools',{recursive:true})\"",
131
- "dev": "nuxt dev playground",
132
- "dev:minimal": "nuxt dev playground",
133
- "prepare:fixtures": "nuxt prepare playground && nuxt prepare playground && nuxt prepare test/fixtures/basic",
134
- "dev:build": "nuxt build playground",
135
- "dev:build:minimal": "nuxt build playground",
136
- "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt-module-build build && nuxt prepare playground && pnpm run build:devtools",
137
- "dev:prepare:minimal": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt-module-build build && nuxt prepare playground",
138
- "release": "pnpm build && bumpp -x \"npx changelogen --output=CHANGELOG.md\"",
139
- "test": "pnpm run prepare:fixtures && vitest",
140
- "test:run": "pnpm run prepare:fixtures && vitest run && pnpm test:nuxt5",
141
- "test:unit": "vitest run --project=unit",
142
- "test:e2e": "pnpm run prepare:fixtures && vitest run --project=e2e",
143
- "test:dist": "node scripts/check-dist-imports.mjs",
144
- "typecheck": "nuxt typecheck && tsc -p test/types/tsconfig.json",
145
- "test:attw": "attw --pack",
146
- "test:nuxt5": "pnpm pack --out test/fixtures/nuxt5/module.tgz && pnpm install --dir test/fixtures/nuxt5 --no-frozen-lockfile --force --update-checksums && pnpm --dir test/fixtures/nuxt5 test"
147
- }
148
- }
88
+ "bundledDependencies": [
89
+ "mdream",
90
+ "@mdream/js"
91
+ ]
92
+ }
@@ -0,0 +1,123 @@
1
+ ---
2
+ name: nuxt-ai-ready
3
+ description: Add, configure, or debug AI and LLM discoverability in a Nuxt site with the nuxt-ai-ready module. Use when a task mentions llms.txt, llms-full.txt, serving pages as Markdown (.md routes, Accept text/markdown), an MCP server for site content, WebMCP or useWebMcpTool, Content Signals in robots.txt, agent skills discovery, runtime page indexing, queryPages or searchPages, or the aiReady config key. Gives the automatic outputs, the build versus runtime split, and the traps that leave output empty or stale.
4
+ ---
5
+
6
+ # nuxt-ai-ready
7
+
8
+ Tested against `nuxt-ai-ready` 2.4.1 plus its unreleased fixes on `main`, on Nuxt 4.5 and Node 24 (requires Nuxt `>=4.0.0`).
9
+ The module converts rendered pages to Markdown with mdream and publishes `llms.txt`, `llms-full.txt`, and `.md` twins.
10
+ Optional parts add MCP tools, WebMCP tools, and a runtime page index. Config key: `aiReady`. Docs: https://nuxtseo.com/ai-ready
11
+
12
+ ## Setup
13
+
14
+ The package installs `@nuxtjs/robots` and `@nuxtjs/sitemap` and loads them as module dependencies. Configure them with the `robots` and `sitemap` keys.
15
+
16
+ ```bash
17
+ pnpm add nuxt-ai-ready
18
+ ```
19
+
20
+ Set `site.url`. Canonical URLs, `Link` headers, and `/.well-known/ai-catalog.json` use it.
21
+ Prerender the pages you want in `llms-full.txt` and in the page index (`nuxi generate`, or `nitro.prerender.routes`).
22
+ A page visit in dev or production does not index anything.
23
+
24
+ ## Automatic behaviour
25
+
26
+ With no `aiReady` config, the module adds:
27
+
28
+ - `/llms.txt`: site name, description, resource links, and a `## Pages` list. In dev it lists sitemap routes without titles.
29
+ - `/llms-full.txt`: the full Markdown of each prerendered page. Only prerendered pages go in the static file.
30
+ - A `.md` twin per page. `/about` becomes `/about.md`, and `/` becomes `/index.md`. Paths under `/api` and `/_` get none.
31
+ - Accept negotiation: a request that prefers `text/markdown`, or a known AI bot user agent, gets a `307` to the `.md` URL.
32
+ - `<link rel="alternate" type="text/markdown">` and `<link rel="describedby" href="/llms.txt">` in HTML, plus matching `Link` headers.
33
+ - `/sitemap.md`, and a `## Sitemap` footer on every generated `.md` page. Set `sitemapMd: false` to remove both.
34
+ - Nuxt Content v3 `page` collections: the `.md` route serves the source Markdown, not converted HTML. Set `contentSource: false` to convert HTML.
35
+ - Agent skills: every `skills/<name>/SKILL.md` in the project root or a local layer is published at `/.well-known/agent-skills/`, at `/skills/<name>/SKILL.md`, and in `llms.txt`. With one skill it is also served at `/SKILL.md`. Set `agentSkills: false` to publish nothing.
36
+
37
+ Off by default: Content Signals, MCP, WebMCP, runtime sync, cron, and the database.
38
+
39
+ ## Common tasks
40
+
41
+ Add llms.txt sections. `notes` renders before the first heading:
42
+
43
+ ```ts
44
+ export default defineNuxtConfig({
45
+ aiReady: {
46
+ llmsTxt: {
47
+ sections: [{ title: 'API Reference', links: [{ title: 'REST API', href: '/docs/api', description: 'API docs' }] }],
48
+ notes: 'Built with Nuxt AI Ready',
49
+ },
50
+ },
51
+ })
52
+ ```
53
+
54
+ Remove an element from the Markdown on every path, build and runtime. Put it in `mdreamOptions`; the defaults `minimal` and `clean` stay on:
55
+
56
+ ```ts
57
+ export default defineNuxtConfig({
58
+ aiReady: { mdreamOptions: { filter: { exclude: ['.author-bio'] } } },
59
+ })
60
+ ```
61
+
62
+ Change the Markdown text. The Nitro hook covers runtime `.md` responses, prerendered `.md` files, `llms-full.txt`, and indexed pages. `ctx.isPrerender` is `true` only during prerendering:
63
+
64
+ ```ts
65
+ // server/plugins/markdown.ts
66
+ export default defineNitroPlugin((nitroApp) => {
67
+ nitroApp.hooks.hook('ai-ready:page:markdown', (ctx) => {
68
+ ctx.markdown += '\n\nSee /support.'
69
+ })
70
+ })
71
+ ```
72
+
73
+ Allow Content Signals. An omitted permission renders as `no`:
74
+
75
+ ```ts
76
+ export default defineNuxtConfig({ aiReady: { contentSignal: { search: true } } })
77
+ // robots.txt: Content-Signal: ai-train=no, search=yes, ai-input=no
78
+ ```
79
+
80
+ MCP: install `@nuxtjs/mcp-toolkit` and add it to `modules`. The module then registers `list_pages`, `search_pages`, and `get_page_markdown` at `/mcp`. MCP needs a running server; `nuxi generate` output cannot host it.
81
+
82
+ WebMCP: set `webmcp: true`. This registers the same three tools in the browser and auto-imports `useWebMcpTool()` and `useWebMcpSupported()`. Without `webmcp`, those composables are not defined.
83
+
84
+ Runtime indexing, database drivers, Cloudflare D1, and the server query helpers: see [references/runtime-indexing.md](references/runtime-indexing.md).
85
+
86
+ ## Traps
87
+
88
+ - **The same edit in both hooks applies twice.** During prerendering the Nitro `ai-ready:page:markdown` hook runs, then the Nuxt hook of the same name. Put an edit in one of them, not both.
89
+ - **Content source pages skip conversion hooks.** A Nuxt Content page ignores `mdreamOptions` and both Nitro hooks.
90
+ - **Dev has no page data.** Query helpers, MCP tools, and search return empty results in `nuxi dev`. Test with `nuxi build` and `node .output/server/index.mjs`.
91
+ - **Response caching turns negotiation off.** An ISR, `swr`, or `cache` route rule without `varies: ['accept', 'sec-fetch-dest', 'user-agent']` serves HTML to Markdown clients. The `.md` URL still works. For a CDN that caches by URL only, set `contentNegotiation: false`.
92
+ - **Emptying `ctx.markdown` does not hide a page.** It drops the body from `llms-full.txt`. The URL stays in `llms.txt` and in the index. Use `sitemap.exclude` for discovery, and access control for private pages.
93
+ - **A project `skills/` folder is public.** Agent skills discovery publishes it with no opt in. Rename the folder with `agentSkills.dir`, or set `agentSkills: false`.
94
+ - **The same hook name exists twice.** `ai-ready:page:markdown` is a Nuxt hook (`nuxt.config` `hooks`, prerender only) and a Nitro hook (`nitroApp.hooks`, every HTML conversion). They receive different context. The Nitro `ctx.event` is undefined when indexing runs outside a request.
95
+ - **`database: false` conflicts with `runtimeSync` and `cron`.** The build fails and names the option.
96
+
97
+ ## Version limits
98
+
99
+ - v2 removed IndexNow. The `indexNow` option and `/__ai-ready/indexnow` no longer exist. Submit URLs from the `ai-ready:page:indexed` Nitro hook: https://nuxtseo.com/docs/ai-ready/advanced/indexnow
100
+ - v1 renamed these. Do not write the old form:
101
+
102
+ | Old | New |
103
+ |-----|-----|
104
+ | `mdreamOptions: { preset: 'minimal' }` | `mdreamOptions: { minimal: true }` |
105
+ | `cacheMaxAgeSeconds` | `llmsTxtCacheSeconds` |
106
+ | Nitro hook `ai-ready:markdown` | `ai-ready:page:markdown` |
107
+ | `BulkDocument` type | `PageDocument` |
108
+ | `JSON.parse(page.headings)` | `page.headings` (already an array) |
109
+ | `?secret=TOKEN` on `/__ai-ready/*` | `Authorization: Bearer TOKEN` header |
110
+
111
+ ## Config
112
+
113
+ - `llmsTxt.markdownLinks` (`false`): link page entries in `llms.txt` to their `.md` twins.
114
+ - `describedby` (`true`): the `describedby` link tag and header.
115
+ - `tools.<listPages|searchPages|getPageMarkdown>.<mcp|webmcp>.enabled`: attach a built in tool to one transport only.
116
+ - `autoI18n` (`true`): with `@nuxtjs/i18n`, adds hreflang `Link` headers and a languages section in `llms.txt`.
117
+ - Other options: https://nuxtseo.com/docs/ai-ready/api/config
118
+
119
+ ## Debug
120
+
121
+ - `curl -H 'Accept: text/markdown' -D - -o /dev/null <url>` must return `307` with `Location: <path>.md`. A `200` means a cache rule turned negotiation off.
122
+ - `/__ai-ready__/debug.json` exists in dev, or with `debug: true`.
123
+ - Nuxt DevTools has an AI Ready tab.
@@ -0,0 +1,75 @@
1
+ # Runtime indexing and the page database
2
+
3
+ Read this when pages change between deployments, or when server code queries stored pages.
4
+ If each deployment prerenders all content, you do not need runtime sync.
5
+
6
+ ## When the database is on
7
+
8
+ The database stays off until a feature needs it: `runtimeSync`, `cron`, MCP page tools, WebMCP page tools, or an explicit `database` config.
9
+ Prerendering always writes a temporary SQLite index and a dump at `/__ai-ready/pages.dump`.
10
+
11
+ Driver selection:
12
+
13
+ | Platform | Driver | Install |
14
+ |----------|--------|---------|
15
+ | Node 22.13 and later | `node:sqlite` | nothing |
16
+ | Node before 22.13 | `better-sqlite3` | `better-sqlite3`, or the build fails |
17
+ | Bun | `bun:sqlite` | nothing |
18
+ | Cloudflare preset | D1 | a binding |
19
+ | Vercel with `POSTGRES_URL` | Neon | nothing |
20
+ | `database: { type: 'postgres' }` | PostgreSQL | `postgres` |
21
+
22
+ The build machine always uses SQLite, also for a D1 deployment.
23
+ For D1, set `database: { type: 'd1', bindingName: 'AI_READY_DB' }` and create the binding yourself. The default binding name is `DB`.
24
+
25
+ ## Runtime sync
26
+
27
+ ```ts
28
+ export default defineNuxtConfig({
29
+ aiReady: {
30
+ runtimeSync: { ttl: 3600, batchSize: 50, pruneTtl: 0 },
31
+ runtimeSyncSecret: process.env.NUXT_AI_READY_RUNTIME_SYNC_SECRET,
32
+ cron: true, // every 5 minutes, also enables runtimeSync
33
+ },
34
+ })
35
+ ```
36
+
37
+ Set `runtimeSyncSecret`. Without it, each build generates a new random secret, and external schedulers lose access after the next deployment.
38
+
39
+ Every control endpoint needs `Authorization: Bearer <secret>`, including `GET /__ai-ready/status`. Only `POST /__ai-ready/prune?dry=true` works without it.
40
+
41
+ | Request | Effect |
42
+ |---------|--------|
43
+ | `POST /__ai-ready/poll` | Index at most 50 pending pages. Repeat while `remaining > 0`. |
44
+ | `POST /__ai-ready/reindex?route=/about` | Index one route now. The route does not need to be in the sitemap. |
45
+ | `POST /__ai-ready/restore` | Replace stored pages with the build dump. |
46
+ | `POST /__ai-ready/prune?ttl=604800` | Delete routes missing from the sitemap for that long. |
47
+ | `GET /__ai-ready/cron` | Production only. For hosts without native cron. |
48
+
49
+ Traps:
50
+
51
+ - **TTL expiry does not reindex a page.** Poll and cron process only pending rows. After a CMS edit, call `reindex` for that route.
52
+ - **Only prerendered pages are in the dump.** Each server process loads the dump before its first database query. A page that was not prerendered stays out of the index until poll, cron, or `reindex` adds it.
53
+ - **Cloudflare Pages has no cron triggers.** Keep `cron: true` and call `GET /__ai-ready/cron` from an external scheduler. On Workers the module adds the trigger.
54
+
55
+ ## Server query helpers
56
+
57
+ `queryPages`, `searchPages`, `countPages`, `streamPages`, `indexPage`, and `indexPageByRoute` are auto-imported in Nitro code. Other exports need `import { ... } from '#ai-ready'`.
58
+
59
+ ```ts
60
+ // server/api/search.get.ts
61
+ export default defineEventHandler(async (event) => {
62
+ const q = getQuery(event).q
63
+ if (typeof q !== 'string' || !q.trim())
64
+ return []
65
+ return searchPages(event, q, { limit: 10 })
66
+ })
67
+ ```
68
+
69
+ - `searchPages` returns `[]` in dev and during prerender. On SQLite and D1, `score` is BM25 and lower ranks first. PostgreSQL returns `score: 0`.
70
+ - `queryPages(event, { route })` returns one page or `undefined`. Without `route` it returns an array. Add `includeMarkdown: true` for the body.
71
+ - Raw SQL: `useRawDb` from `#ai-ready`. `useDatabase` does not exist.
72
+ - The event goes in a different position: `indexPage(route, html, options, event)` and `indexPageByRoute(route, event, options)`.
73
+ - `indexPage` throws on failure. `indexPageByRoute` returns `{ success: false, error }`.
74
+
75
+ React to a changed page with the `ai-ready:page:indexed` Nitro hook. Check `ctx.contentChanged`; a forced reindex of the same content still fires the hook.
@@ -1,10 +0,0 @@
1
- import type { H3Event } from '#nuxtseo/h3';
2
- interface McpDataNitroApp {
3
- hooks: {
4
- hook: (name: 'mcp:config:resolved', handler: (payload: {
5
- event: H3Event;
6
- }) => Promise<void>) => unknown;
7
- };
8
- }
9
- export default function mcpDataPlugin(nitroApp: McpDataNitroApp): void;
10
- export {};
@@ -1,22 +0,0 @@
1
- import { checkAndHandleStale } from "../utils/checkStale.js";
2
- export default function mcpDataPlugin(nitroApp) {
3
- let state = { _tag: "Idle" };
4
- const ensureData = (event) => {
5
- if (state._tag === "Ready")
6
- return Promise.resolve();
7
- if (state._tag === "Running")
8
- return state.promise;
9
- const promise = checkAndHandleStale(event).then(
10
- () => {
11
- state = { _tag: "Ready" };
12
- },
13
- (error) => {
14
- state = { _tag: "Idle" };
15
- return Promise.reject(error);
16
- }
17
- );
18
- state = { _tag: "Running", promise };
19
- return promise;
20
- };
21
- nitroApp.hooks.hook("mcp:config:resolved", ({ event }) => ensureData(event));
22
- }