nuxt-ai-ready 3.6.1 → 3.6.2
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.
- package/dist/agent-skills-config-CmZq9uWW.mjs +18 -0
- package/dist/agent-skills-zGLgFB6H.mjs +468 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +656 -570
- package/dist/devtools/pages/ai-ready/debug.vue +9 -3
- package/dist/devtools/pages/ai-ready/index.vue +3 -1
- package/dist/devtools/pages/ai-ready/llms-txt.vue +15 -4
- package/dist/devtools/pages/ai-ready.vue +28 -4
- package/dist/module.d.mts +106 -112
- package/dist/module.json +3 -3
- package/dist/module.mjs +2732 -26
- package/dist/package-metadata-B1darl8W.mjs +28 -0
- package/dist/prerender-QMv07W4h.mjs +650 -0
- package/dist/runtime/app/composables/webmcp.js +90 -97
- package/dist/runtime/app/plugins/md-alternate.server.js +29 -26
- package/dist/runtime/app/plugins/md-hints.prerender.js +13 -15
- package/dist/runtime/app/plugins/webmcp.client.js +49 -53
- package/dist/runtime/app/webmcp-config.js +2 -2
- package/dist/runtime/cache-control.js +16 -10
- package/dist/runtime/i18n-url.js +6 -6
- package/dist/runtime/index.js +4 -12
- package/dist/runtime/llms-txt-directive.js +20 -13
- package/dist/runtime/llms-txt-files.js +188 -187
- package/dist/runtime/llms-txt-format.js +54 -55
- package/dist/runtime/llms-txt-i18n.js +22 -19
- package/dist/runtime/llms-txt-utils.js +140 -95
- package/dist/runtime/markdown-links.js +45 -39
- package/dist/runtime/markdown-path.js +29 -9
- package/dist/runtime/markdown-text.js +2 -1
- package/dist/runtime/mcp.js +5 -1
- package/dist/runtime/route-path.js +14 -8
- package/dist/runtime/server/db/drizzle/client.js +71 -75
- package/dist/runtime/server/db/drizzle/index.js +16 -28
- package/dist/runtime/server/db/drizzle/providers/bun.d.ts +2 -1
- package/dist/runtime/server/db/drizzle/providers/bun.js +10 -7
- package/dist/runtime/server/db/drizzle/providers/d1.js +16 -13
- package/dist/runtime/server/db/drizzle/providers/dbPath.js +60 -37
- package/dist/runtime/server/db/drizzle/providers/libsql.js +23 -11
- package/dist/runtime/server/db/drizzle/providers/neon.js +13 -10
- package/dist/runtime/server/db/drizzle/providers/node-sqlite.js +10 -7
- package/dist/runtime/server/db/drizzle/providers/postgres.js +13 -10
- package/dist/runtime/server/db/drizzle/queries.js +633 -532
- package/dist/runtime/server/db/drizzle/raw.js +200 -176
- package/dist/runtime/server/db/index.js +3 -0
- package/dist/runtime/server/db/queries.js +816 -607
- package/dist/runtime/server/db/schema/postgres.js +56 -50
- package/dist/runtime/server/db/schema/sqlite.js +56 -50
- package/dist/runtime/server/db/schema-sql.js +35 -38
- package/dist/runtime/server/db/seed.js +60 -45
- package/dist/runtime/server/db/shared.js +300 -213
- package/dist/runtime/server/index.js +1 -17
- package/dist/runtime/server/mcp/cache-key.js +5 -1
- package/dist/runtime/server/mcp/resources/pages.js +32 -33
- package/dist/runtime/server/mcp/tools/get-page-markdown.js +41 -27
- package/dist/runtime/server/mcp/tools/list-pages.js +40 -34
- package/dist/runtime/server/mcp/tools/search-pages.js +24 -16
- package/dist/runtime/server/middleware/markdown.d.ts +1 -1
- package/dist/runtime/server/middleware/markdown.js +15 -13
- package/dist/runtime/server/middleware/markdown.prerender.d.ts +1 -1
- package/dist/runtime/server/middleware/markdown.prerender.js +135 -119
- package/dist/runtime/server/middleware/render-markdown.d.ts +1 -1
- package/dist/runtime/server/middleware/render-markdown.js +164 -144
- package/dist/runtime/server/plugins/ai-terms.d.ts +1 -1
- package/dist/runtime/server/plugins/ai-terms.js +4 -8
- package/dist/runtime/server/plugins/content-signal-capture-nitro3.prerender.d.ts +1 -1
- package/dist/runtime/server/plugins/content-signal-capture-nitro3.prerender.js +7 -8
- package/dist/runtime/server/plugins/content-signal-capture.prerender.d.ts +1 -1
- package/dist/runtime/server/plugins/content-signal-capture.prerender.js +7 -7
- package/dist/runtime/server/plugins/db-lifecycle-nitro3.d.ts +1 -1
- package/dist/runtime/server/plugins/db-lifecycle-nitro3.js +13 -14
- package/dist/runtime/server/plugins/db-lifecycle.js +13 -11
- package/dist/runtime/server/plugins/html-capture.prerender.js +6 -6
- package/dist/runtime/server/plugins/link-header-nitro3.d.ts +1 -1
- package/dist/runtime/server/plugins/link-header-nitro3.js +23 -13
- package/dist/runtime/server/plugins/link-header.d.ts +1 -1
- package/dist/runtime/server/plugins/link-header.js +30 -30
- package/dist/runtime/server/plugins/llms-txt-directive-html.d.ts +1 -1
- package/dist/runtime/server/plugins/llms-txt-directive-html.js +4 -3
- package/dist/runtime/server/plugins/markdown-negotiation.d.ts +1 -1
- package/dist/runtime/server/plugins/markdown-negotiation.js +64 -45
- package/dist/runtime/server/plugins/sitemap-seeder.js +144 -112
- package/dist/runtime/server/routes/__ai-ready/cron.get.d.ts +1 -1
- package/dist/runtime/server/routes/__ai-ready/cron.get.js +17 -11
- package/dist/runtime/server/routes/__ai-ready/devtools.get.d.ts +1 -1
- package/dist/runtime/server/routes/__ai-ready/devtools.get.js +60 -45
- package/dist/runtime/server/routes/__ai-ready/pages.get.d.ts +36 -1
- package/dist/runtime/server/routes/__ai-ready/pages.get.js +44 -40
- package/dist/runtime/server/routes/__ai-ready/poll.post.d.ts +15 -1
- package/dist/runtime/server/routes/__ai-ready/poll.post.js +30 -30
- package/dist/runtime/server/routes/__ai-ready/prune.post.d.ts +13 -1
- package/dist/runtime/server/routes/__ai-ready/prune.post.js +29 -15
- package/dist/runtime/server/routes/__ai-ready/reindex.post.d.ts +22 -1
- package/dist/runtime/server/routes/__ai-ready/reindex.post.js +31 -21
- package/dist/runtime/server/routes/__ai-ready/restore.post.d.ts +4 -1
- package/dist/runtime/server/routes/__ai-ready/restore.post.js +28 -22
- package/dist/runtime/server/routes/__ai-ready/status.get.d.ts +1 -1
- package/dist/runtime/server/routes/__ai-ready/status.get.js +52 -53
- package/dist/runtime/server/routes/__ai-ready-debug.get.d.ts +83 -1
- package/dist/runtime/server/routes/__ai-ready-debug.get.js +209 -189
- package/dist/runtime/server/routes/agent-skills-artifact.d.ts +1 -1
- package/dist/runtime/server/routes/agent-skills-artifact.js +16 -14
- package/dist/runtime/server/routes/agent-skills-index.d.ts +1 -1
- package/dist/runtime/server/routes/agent-skills-index.js +8 -6
- package/dist/runtime/server/routes/ai-catalog.js +19 -19
- package/dist/runtime/server/routes/ai-terms.js +23 -19
- package/dist/runtime/server/routes/api-catalog.js +23 -23
- package/dist/runtime/server/routes/llms-full.txt.get.d.ts +1 -1
- package/dist/runtime/server/routes/llms-full.txt.get.js +42 -41
- package/dist/runtime/server/routes/llms.txt.get.d.ts +1 -1
- package/dist/runtime/server/routes/llms.txt.get.js +38 -33
- package/dist/runtime/server/routes/mcp-server-card.js +19 -19
- package/dist/runtime/server/routes/sitemap.md.get.d.ts +1 -1
- package/dist/runtime/server/routes/sitemap.md.get.js +38 -39
- package/dist/runtime/server/tasks/ai-ready-cron.d.ts +1 -1
- package/dist/runtime/server/tasks/ai-ready-cron.js +17 -14
- package/dist/runtime/server/utils/auth.js +76 -53
- package/dist/runtime/server/utils/batchIndex.js +72 -60
- package/dist/runtime/server/utils/checkStale.js +181 -134
- package/dist/runtime/server/utils/cloudflare-prerendered.js +23 -20
- package/dist/runtime/server/utils/cloudflare.js +69 -51
- package/dist/runtime/server/utils/content-negotiation.js +30 -18
- package/dist/runtime/server/utils/content.js +4 -1
- package/dist/runtime/server/utils/context.js +30 -19
- package/dist/runtime/server/utils/cron-plan.js +6 -6
- package/dist/runtime/server/utils/discovery-response.js +5 -6
- package/dist/runtime/server/utils/fetch.js +2 -1
- package/dist/runtime/server/utils/frontmatter.js +44 -57
- package/dist/runtime/server/utils/i18n.js +3 -8
- package/dist/runtime/server/utils/indexPage.js +152 -113
- package/dist/runtime/server/utils/keywords.js +278 -277
- package/dist/runtime/server/utils/link-header.js +67 -56
- package/dist/runtime/server/utils/llms-full.js +39 -49
- package/dist/runtime/server/utils/markdown-redirect.js +26 -14
- package/dist/runtime/server/utils/markdown-request.js +62 -47
- package/dist/runtime/server/utils/negotiation-decision.d.ts +8 -0
- package/dist/runtime/server/utils/negotiation-decision.js +106 -34
- package/dist/runtime/server/utils/negotiation-response.d.ts +1 -1
- package/dist/runtime/server/utils/negotiation-response.js +195 -144
- package/dist/runtime/server/utils/page-updated-at.js +23 -15
- package/dist/runtime/server/utils/prerender-html.js +31 -17
- package/dist/runtime/server/utils/runCron.js +263 -192
- package/dist/runtime/server/utils/sitemap-crawl-state.js +57 -39
- package/dist/runtime/server/utils/sitemap-lastmod.js +16 -14
- package/dist/runtime/server/utils/sitemap-md.js +39 -50
- package/dist/runtime/server/utils/sitemap-routes.js +7 -7
- package/dist/runtime/server/utils/sitemap.js +459 -414
- package/dist/runtime/server/utils.js +141 -122
- package/dist/runtime/site-tool-catalog.js +39 -43
- package/dist/runtime/site-tool-config.js +1 -0
- package/dist/runtime/sync-secret.js +11 -11
- package/dist/runtime/types.js +1 -0
- package/dist/runtime/webmcp-site-tools.js +278 -250
- package/dist/runtime/webmcp.js +53 -42
- package/dist/static-headers-G7hFL3wE.mjs +328 -0
- package/dist/types.d.mts +1 -9
- package/package.json +18 -22
- package/skills/nuxt-ai-ready/SKILL.md +8 -2
- package/dist/chunks/agent-skills.mjs +0 -383
- package/dist/chunks/prerender.mjs +0 -683
- package/dist/shared/nuxt-ai-ready.Bzx0dNWj.mjs +0 -3034
- package/dist/shared/nuxt-ai-ready.DCd-1s1G.mjs +0 -29
package/dist/runtime/webmcp.js
CHANGED
|
@@ -1,59 +1,70 @@
|
|
|
1
1
|
export function defineWebMcpTool(tool) {
|
|
2
|
-
|
|
2
|
+
return tool;
|
|
3
3
|
}
|
|
4
|
+
/**
|
|
5
|
+
* Character budgets recommended by WebMCP to stay inside agent guardrails.
|
|
6
|
+
* @see https://developer.chrome.com/docs/ai/webmcp/secure-tools
|
|
7
|
+
*/
|
|
4
8
|
export const WEB_MCP_BUDGET = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
name: 30,
|
|
10
|
+
description: 500,
|
|
11
|
+
paramDescription: 150,
|
|
12
|
+
output: 1500
|
|
9
13
|
};
|
|
10
14
|
const RE_WEB_MCP_TOOL_NAME = /^[\w.-]{1,128}$/;
|
|
15
|
+
/** The page's model context, or undefined when the browser has no WebMCP support. */
|
|
11
16
|
export function getModelContext() {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return document.modelContext;
|
|
17
|
+
if (typeof document === "undefined") return undefined;
|
|
18
|
+
return document.modelContext;
|
|
15
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Register a tool and expose expected browser rejections as a tagged result.
|
|
22
|
+
*/
|
|
16
23
|
export async function registerTool(modelContext, tool, options = {}) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
return Promise.resolve().then(() => modelContext.registerTool(tool, options)).then(() => ({ _tag: "Registered" }), (error) => ({
|
|
25
|
+
_tag: "Error",
|
|
26
|
+
error
|
|
27
|
+
}));
|
|
21
28
|
}
|
|
29
|
+
/** Collect budget violations for a tool. Used to warn during development. */
|
|
22
30
|
export function checkToolBudget(tool) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
warnings.push(`Parameter name "${tool.name}.${param}" is ${param.length} characters, over the ${WEB_MCP_BUDGET.name} character budget.`);
|
|
35
|
-
const description = typeof schema.description === "string" ? schema.description : "";
|
|
36
|
-
if (description.length > WEB_MCP_BUDGET.paramDescription)
|
|
37
|
-
warnings.push(`Description for "${tool.name}.${param}" is ${description.length} characters, over the ${WEB_MCP_BUDGET.paramDescription} character budget.`);
|
|
38
|
-
}
|
|
39
|
-
return warnings;
|
|
31
|
+
const warnings = [];
|
|
32
|
+
if (!RE_WEB_MCP_TOOL_NAME.test(tool.name)) warnings.push(`Tool name "${tool.name}" must use 1 to 128 ASCII letters, digits, underscores, hyphens or dots.`);
|
|
33
|
+
if (tool.name.length > WEB_MCP_BUDGET.name) warnings.push(`Tool name "${tool.name}" is ${tool.name.length} characters, over the ${WEB_MCP_BUDGET.name} character budget.`);
|
|
34
|
+
if (!tool.description) warnings.push(`Description for "${tool.name}" cannot be empty.`);
|
|
35
|
+
if (tool.description.length > WEB_MCP_BUDGET.description) warnings.push(`Description for "${tool.name}" is ${tool.description.length} characters, over the ${WEB_MCP_BUDGET.description} character budget.`);
|
|
36
|
+
for (const [param, schema] of Object.entries(tool.inputSchema?.properties || {})) {
|
|
37
|
+
if (param.length > WEB_MCP_BUDGET.name) warnings.push(`Parameter name "${tool.name}.${param}" is ${param.length} characters, over the ${WEB_MCP_BUDGET.name} character budget.`);
|
|
38
|
+
const description = typeof schema.description === "string" ? schema.description : "";
|
|
39
|
+
if (description.length > WEB_MCP_BUDGET.paramDescription) warnings.push(`Description for "${tool.name}.${param}" is ${description.length} characters, over the ${WEB_MCP_BUDGET.paramDescription} character budget.`);
|
|
40
|
+
}
|
|
41
|
+
return warnings;
|
|
40
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Trim tool output to the configured budget, telling the agent where to read
|
|
45
|
+
* the rest instead of silently dropping content.
|
|
46
|
+
*/
|
|
41
47
|
export function truncateToolOutput(text, maxChars, hint) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
[Truncated at ${budget} characters.]`;
|
|
50
|
-
if (notice.length >= budget)
|
|
51
|
-
return budget === 1 ? "\u2026" : `${text.slice(0, budget - 1)}\u2026`;
|
|
52
|
-
return text.slice(0, budget - notice.length) + notice;
|
|
48
|
+
const budget = Math.trunc(maxChars);
|
|
49
|
+
if (!Number.isFinite(budget) || budget <= 0 || text.length <= budget) return text;
|
|
50
|
+
const notice = hint ? `\n\n[Truncated at ${budget} characters. ${hint}]` : `\n\n[Truncated at ${budget} characters.]`;
|
|
51
|
+
if (notice.length >= budget) {
|
|
52
|
+
return budget === 1 ? "…" : `${text.slice(0, budget - 1)}…`;
|
|
53
|
+
}
|
|
54
|
+
return text.slice(0, budget - notice.length) + notice;
|
|
53
55
|
}
|
|
54
56
|
export function toolText(text) {
|
|
55
|
-
|
|
57
|
+
return { content: [{
|
|
58
|
+
type: "text",
|
|
59
|
+
text
|
|
60
|
+
}] };
|
|
56
61
|
}
|
|
57
62
|
export function toolError(message) {
|
|
58
|
-
|
|
63
|
+
return {
|
|
64
|
+
content: [{
|
|
65
|
+
type: "text",
|
|
66
|
+
text: message
|
|
67
|
+
}],
|
|
68
|
+
isError: true
|
|
69
|
+
};
|
|
59
70
|
}
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { useLogger } from "@nuxt/kit";
|
|
2
|
+
import { toDeployedRoute } from "./runtime/route-path.js";
|
|
3
|
+
import { mergeVaryHeader } from "./runtime/cache-control.js";
|
|
4
|
+
// src/logger.ts
|
|
5
|
+
const logger = useLogger("nuxt-ai-ready");
|
|
6
|
+
// src/prerender-constants.ts
|
|
7
|
+
const MARKDOWN_LINK_AVAILABILITY_FILE = "markdown-link-availability.json";
|
|
8
|
+
// src/utils/static-headers.ts
|
|
9
|
+
function escapeRegExp(value) {
|
|
10
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Add a default header to a route block without creating a duplicate block.
|
|
14
|
+
* Existing header values (including explicit removals) take precedence.
|
|
15
|
+
* Append mode merges list tokens; explicit removals still take precedence.
|
|
16
|
+
*/
|
|
17
|
+
function ensureStaticHeader(contents, route, name, value, mode = "default") {
|
|
18
|
+
const eol = contents.includes("\r\n") ? "\r\n" : "\n";
|
|
19
|
+
const routePattern = new RegExp(`^${escapeRegExp(route)}[\\t ]*\\r?$`, "gm");
|
|
20
|
+
const routeMatch = [...contents.matchAll(routePattern)].at(-1);
|
|
21
|
+
if (!routeMatch || routeMatch.index === void 0) return `${contents}${contents.length === 0 ? "" : contents.endsWith(`${eol}${eol}`) ? "" : contents.endsWith(eol) ? eol : `${eol}${eol}`}${route}${eol} ${name}: ${value}${eol}`;
|
|
22
|
+
const routeLineEnd = routeMatch.index + routeMatch[0].length;
|
|
23
|
+
const blockStart = contents[routeLineEnd] === "\n" ? routeLineEnd + 1 : routeLineEnd;
|
|
24
|
+
const nextBlockPattern = /^(?![\t ]|\r?$).+/gm;
|
|
25
|
+
nextBlockPattern.lastIndex = blockStart;
|
|
26
|
+
const blockEnd = nextBlockPattern.exec(contents)?.index ?? contents.length;
|
|
27
|
+
const block = contents.slice(blockStart, blockEnd);
|
|
28
|
+
const escapedName = escapeRegExp(name);
|
|
29
|
+
if (new RegExp(`^[\\t ]+(?:${escapedName}[\\t ]*:|![\\t ]*${escapedName}[\\t ]*\\r?$)`, "im").test(block)) {
|
|
30
|
+
if (mode === "append") {
|
|
31
|
+
if (new RegExp(`^[\\t ]+![\\t ]*${escapedName}[\\t ]*\\r?$`, "im").test(block)) return contents;
|
|
32
|
+
const valuePattern = new RegExp(`^([\\t ]+${escapedName}[\\t ]*:[\\t ]*)([^\\r\\n]*)(\\r?$)`, "im");
|
|
33
|
+
if (block.match(valuePattern)) {
|
|
34
|
+
const merged = block.replace(valuePattern, (_line, prefix, current, suffix) => {
|
|
35
|
+
return `${prefix}${name.toLowerCase() === "link" ? current.includes(value) ? current : [current, value].filter(Boolean).join(", ") : mergeVaryHeader(current, value)}${suffix}`;
|
|
36
|
+
});
|
|
37
|
+
return `${contents.slice(0, blockStart)}${merged}${contents.slice(blockEnd)}`;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return contents;
|
|
41
|
+
}
|
|
42
|
+
const prefix = blockStart === routeLineEnd ? eol : "";
|
|
43
|
+
return `${contents.slice(0, blockStart)}${prefix} ${name}: ${value}${eol}${contents.slice(blockStart)}`;
|
|
44
|
+
}
|
|
45
|
+
/** Share discovery entries across static assets without multiplying page rules. */
|
|
46
|
+
function mergeStaticDiscoveryHeaders(contents, baseURL, entries) {
|
|
47
|
+
if (entries.length === 0) return contents;
|
|
48
|
+
const route = toDeployedRoute("/*", baseURL);
|
|
49
|
+
const blocks = splitHeaderBlocks(contents);
|
|
50
|
+
const matching = blocks.filter((block) => block.route === route);
|
|
51
|
+
let merged = matching[0]?.text || "";
|
|
52
|
+
for (const block of matching.slice(1)) for (const line of block.text.split(/(?<=\n)/).slice(1)) {
|
|
53
|
+
const header = line.match(/^[\t ]+([^:\s]+):[\t ]*([^\r\n]*)/);
|
|
54
|
+
if (header?.[1]?.toLowerCase() === "link") merged = ensureStaticHeader(merged, route, header[1], header[2], "append");
|
|
55
|
+
else if (header) {
|
|
56
|
+
const existing = new RegExp(`^[\\t ]+${escapeRegExp(header[1])}[\\t ]*:[^\\r\\n]*(?:\\r?\\n|$)`, "gim");
|
|
57
|
+
merged = ensureStaticHeader(merged.replace(existing, ""), route, header[1], header[2]);
|
|
58
|
+
} else merged += line;
|
|
59
|
+
}
|
|
60
|
+
if (matching.length > 1) {
|
|
61
|
+
let inserted = false;
|
|
62
|
+
contents = blocks.map((block) => {
|
|
63
|
+
if (block.route !== route) return block.text;
|
|
64
|
+
if (inserted) return "";
|
|
65
|
+
inserted = true;
|
|
66
|
+
return merged;
|
|
67
|
+
}).join("");
|
|
68
|
+
}
|
|
69
|
+
return entries.reduce((headers, entry) => ensureStaticHeader(headers, route, "Link", entry, "append"), contents);
|
|
70
|
+
}
|
|
71
|
+
/** Parse an indented `Name: value` line. Detach (`! Name`) lines are not headers. */
|
|
72
|
+
function parseHeaderLine(line) {
|
|
73
|
+
const colon = line.indexOf(":");
|
|
74
|
+
if (!/^[\t ]/.test(line) || colon < 0) return void 0;
|
|
75
|
+
const name = line.slice(0, colon).trim();
|
|
76
|
+
if (!name || name.startsWith("!") || /\s/.test(name)) return void 0;
|
|
77
|
+
const eol = line.endsWith("\r\n") ? "\r\n" : line.endsWith("\n") ? "\n" : "";
|
|
78
|
+
return {
|
|
79
|
+
name,
|
|
80
|
+
value: line.slice(colon + 1, line.length - eol.length).trim(),
|
|
81
|
+
withValue: (value) => `${line.slice(0, colon + 1)} ${value}${eol}`
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
const RE_DETACH_LINE = /^[\t ]+![\t ]*([^\s:]+)/;
|
|
85
|
+
function patternToRegExp(pattern) {
|
|
86
|
+
const source = pattern.split(/(\*|:\w+)/).map((part) => part === "*" ? ".*" : part.startsWith(":") ? "[^/]+" : escapeRegExp(part)).join("");
|
|
87
|
+
return new RegExp(`^${source}$`);
|
|
88
|
+
}
|
|
89
|
+
/** Content-Signal route policies that also apply to an exact generated asset. */
|
|
90
|
+
function matchingStaticContentSignals(routeRules, route) {
|
|
91
|
+
return Object.entries(routeRules).flatMap(([pattern, rule]) => {
|
|
92
|
+
if (!patternToRegExp(pattern).test(route)) return [];
|
|
93
|
+
const headers = rule?.headers;
|
|
94
|
+
return Object.entries(headers || {}).filter(([name]) => name.toLowerCase() === "content-signal").map(([, value]) => value);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
/** Normalize usage policy precedence without changing other header precedence. */
|
|
98
|
+
function normalizeStaticContentSignalHeaders(contents, generatedDiscovery = []) {
|
|
99
|
+
const parsed = splitHeaderBlocks(contents);
|
|
100
|
+
if (!parsed.some((block) => /^\s+content-signal\s*:/im.test(block.text))) return contents;
|
|
101
|
+
const policyLine = /^[\t ]+(?:content-signal\s*:.*|!\s*content-signal\s*)$/i;
|
|
102
|
+
const hasPolicy = (block) => block.text.split(/\r?\n/).slice(1).some((line) => policyLine.test(line));
|
|
103
|
+
const repeated = /* @__PURE__ */ new Map();
|
|
104
|
+
for (const block of parsed) if (block.route !== null) repeated.set(block.route, [...repeated.get(block.route) || [], block]);
|
|
105
|
+
const combined = /* @__PURE__ */ new Set();
|
|
106
|
+
const blocks = parsed.flatMap((block) => {
|
|
107
|
+
const group = block.route === null ? [] : repeated.get(block.route);
|
|
108
|
+
if (group.length < 2 || !group.some(hasPolicy)) return [block];
|
|
109
|
+
if (combined.has(block.route)) return [];
|
|
110
|
+
combined.add(block.route);
|
|
111
|
+
const lines = group.at(-1).text.split(/\r?\n/).slice(1).filter((line) => !policyLine.test(line));
|
|
112
|
+
const policy = group.filter(hasPolicy).at(-1).text.split(/\r?\n/).slice(1).filter((line) => policyLine.test(line));
|
|
113
|
+
return [{
|
|
114
|
+
route: block.route,
|
|
115
|
+
text: `${block.route}\n${[...lines, ...policy].join("\n")}\n`
|
|
116
|
+
}];
|
|
117
|
+
});
|
|
118
|
+
const discoveryLinks = new Set(generatedDiscovery);
|
|
119
|
+
const isGeneratedDiscovery = (line) => {
|
|
120
|
+
if (discoveryLinks.size === 0) return false;
|
|
121
|
+
const header = parseHeaderLine(line);
|
|
122
|
+
if (header?.name.toLowerCase() !== "link") return false;
|
|
123
|
+
const links = splitLinkEntries(header.value);
|
|
124
|
+
return links.length > 0 && links.every((link) => discoveryLinks.has(link));
|
|
125
|
+
};
|
|
126
|
+
const policyOnly = (block) => hasPolicy(block) && block.text.split(/\r?\n/).slice(1).every((line) => !line.trim() || line.trimStart().startsWith("#") || policyLine.test(line) || isGeneratedDiscovery(line));
|
|
127
|
+
const policyValue = (block) => block.text.match(/^[\t ]+content-signal[\t ]*:(.*)$/im)?.[1]?.trim() ?? null;
|
|
128
|
+
const edges = blocks.map(() => /* @__PURE__ */ new Set());
|
|
129
|
+
const incoming = blocks.map(() => 0);
|
|
130
|
+
const connect = (before, after) => {
|
|
131
|
+
if (!edges[before].has(after)) {
|
|
132
|
+
edges[before].add(after);
|
|
133
|
+
incoming[after]++;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
let previousUnrelated;
|
|
137
|
+
for (let index = 0; index < blocks.length; index++) if (!policyOnly(blocks[index])) {
|
|
138
|
+
if (previousUnrelated !== void 0) connect(previousUnrelated, index);
|
|
139
|
+
previousUnrelated = index;
|
|
140
|
+
}
|
|
141
|
+
for (let broad = 0; broad < blocks.length; broad++) {
|
|
142
|
+
const source = blocks[broad];
|
|
143
|
+
if (!hasPolicy(source) || source.route === null) continue;
|
|
144
|
+
for (let narrow = 0; narrow < blocks.length; narrow++) {
|
|
145
|
+
const target = blocks[narrow];
|
|
146
|
+
if (broad !== narrow && hasPolicy(target) && target.route !== null && policyValue(source) !== policyValue(target) && coversContentSignalPattern(source.route, target.route)) connect(broad, narrow);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
const ordered = [];
|
|
150
|
+
const emitted = /* @__PURE__ */ new Set();
|
|
151
|
+
while (ordered.length < blocks.length) {
|
|
152
|
+
const next = incoming.findIndex((count, index) => count === 0 && !emitted.has(index));
|
|
153
|
+
if (next === -1) throw new Error("Content-Signal rules conflict with other header ordering. Place broader mixed policy rules before narrower rules.");
|
|
154
|
+
emitted.add(next);
|
|
155
|
+
ordered.push(blocks[next]);
|
|
156
|
+
for (const target of edges[next]) incoming[target]--;
|
|
157
|
+
}
|
|
158
|
+
return ordered.map((block) => {
|
|
159
|
+
const text = block.text.trimEnd();
|
|
160
|
+
if (!/^\s+content-signal\s*:/im.test(text) || /^\s+!\s*content-signal\s*$/im.test(text)) return `${text}\n`;
|
|
161
|
+
return `${text.replace(/^(\s+)(content-signal\s*:)/im, "$1! Content-Signal\n$1$2")}\n`;
|
|
162
|
+
}).join("\n");
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Whether every path `narrow` matches is also matched by `broad`. Only path
|
|
166
|
+
* patterns are compared; anything this cannot prove returns false.
|
|
167
|
+
*/
|
|
168
|
+
function coversPattern(broad, narrow) {
|
|
169
|
+
if (broad === narrow || !broad.startsWith("/") || !narrow.startsWith("/")) return false;
|
|
170
|
+
if (!/[*:]/.test(narrow)) return patternToRegExp(broad).test(narrow);
|
|
171
|
+
return broad.indexOf("*") === broad.length - 1 && !broad.includes(":") && narrow.startsWith(broad.slice(0, -1));
|
|
172
|
+
}
|
|
173
|
+
function coversContentSignalPattern(broad, narrow) {
|
|
174
|
+
if (coversPattern(broad, narrow)) return true;
|
|
175
|
+
if (broad === narrow || !broad.startsWith("/") || !narrow.startsWith("/") || broad.indexOf("*") !== broad.length - 1 || !broad.includes(":")) return false;
|
|
176
|
+
const prefix = narrow.split("*")[0];
|
|
177
|
+
return !prefix.includes(":") && patternToRegExp(broad).test(prefix);
|
|
178
|
+
}
|
|
179
|
+
/** Split a Link value into entries, ignoring commas inside `<...>` and quotes. */
|
|
180
|
+
function splitLinkEntries(value) {
|
|
181
|
+
const entries = [];
|
|
182
|
+
let current = "";
|
|
183
|
+
let inUrl = false;
|
|
184
|
+
let inQuote = false;
|
|
185
|
+
for (const char of value) {
|
|
186
|
+
if (char === "<" && !inQuote) inUrl = true;
|
|
187
|
+
else if (char === ">" && !inQuote) inUrl = false;
|
|
188
|
+
else if (char === "\"" && !inUrl) inQuote = !inQuote;
|
|
189
|
+
if (char === "," && !inUrl && !inQuote) {
|
|
190
|
+
entries.push(current.trim());
|
|
191
|
+
current = "";
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
current += char;
|
|
195
|
+
}
|
|
196
|
+
entries.push(current.trim());
|
|
197
|
+
return entries.filter(Boolean);
|
|
198
|
+
}
|
|
199
|
+
function headerTokens(name, value) {
|
|
200
|
+
if (name === "link") return splitLinkEntries(value);
|
|
201
|
+
if (name === "vary") return value.split(",").map((token) => token.trim()).filter(Boolean);
|
|
202
|
+
return [value.trim()];
|
|
203
|
+
}
|
|
204
|
+
function tokenKey(name, token) {
|
|
205
|
+
return name === "vary" ? token.toLowerCase() : token;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Remove values of the named headers that a broader rule already sends.
|
|
209
|
+
*
|
|
210
|
+
* Cloudflare applies every `_headers` rule whose pattern matches a request and
|
|
211
|
+
* joins a header set by several rules with a comma. A value repeated on
|
|
212
|
+
* `/index.md`, `/*.md` and `/*` therefore reaches the client once per rule:
|
|
213
|
+
* `text/markdown; charset=utf-8, text/markdown; charset=utf-8`. The broadest
|
|
214
|
+
* rule keeps each value and narrower rules drop it, so every path gets it
|
|
215
|
+
* once. Rules with the same pattern and detached (`! Name`) headers are left
|
|
216
|
+
* alone, and a rule left without headers is removed.
|
|
217
|
+
*/
|
|
218
|
+
function dedupeStaticHeaders(contents, names) {
|
|
219
|
+
const owned = new Set(names.map((name) => name.toLowerCase()));
|
|
220
|
+
const blocks = splitHeaderBlocks(contents);
|
|
221
|
+
const detached = /* @__PURE__ */ new Set();
|
|
222
|
+
const parsed = blocks.map((block) => {
|
|
223
|
+
const headers = [];
|
|
224
|
+
for (const line of block.text.split(/(?<=\n)/).slice(block.route === null ? 0 : 1)) {
|
|
225
|
+
const detach = line.match(RE_DETACH_LINE);
|
|
226
|
+
if (detach) {
|
|
227
|
+
detached.add(detach[1].toLowerCase());
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
const header = parseHeaderLine(line);
|
|
231
|
+
if (!header) continue;
|
|
232
|
+
const name = header.name.toLowerCase();
|
|
233
|
+
if (owned.has(name)) headers.push({
|
|
234
|
+
name,
|
|
235
|
+
tokens: headerTokens(name, header.value)
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
return headers;
|
|
239
|
+
});
|
|
240
|
+
const lastRuleIndex = /* @__PURE__ */ new Map();
|
|
241
|
+
blocks.forEach((block, index) => {
|
|
242
|
+
if (block.route !== null) lastRuleIndex.set(block.route, index);
|
|
243
|
+
});
|
|
244
|
+
let changed = false;
|
|
245
|
+
const output = blocks.map((block) => {
|
|
246
|
+
const route = block.route;
|
|
247
|
+
if (route === null) return block.text;
|
|
248
|
+
const provided = /* @__PURE__ */ new Map();
|
|
249
|
+
lastRuleIndex.forEach((index, pattern) => {
|
|
250
|
+
if (!coversPattern(pattern, route)) return;
|
|
251
|
+
for (const { name, tokens } of parsed[index]) {
|
|
252
|
+
if (detached.has(name)) continue;
|
|
253
|
+
const values = provided.get(name) ?? /* @__PURE__ */ new Set();
|
|
254
|
+
tokens.forEach((token) => values.add(tokenKey(name, token)));
|
|
255
|
+
provided.set(name, values);
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
if (provided.size === 0) return block.text;
|
|
259
|
+
const [routeLine, ...lines] = block.text.split(/(?<=\n)/);
|
|
260
|
+
let headerLines = 0;
|
|
261
|
+
const kept = lines.flatMap((line) => {
|
|
262
|
+
const header = parseHeaderLine(line);
|
|
263
|
+
if (!header) {
|
|
264
|
+
if (RE_DETACH_LINE.test(line)) headerLines++;
|
|
265
|
+
return [line];
|
|
266
|
+
}
|
|
267
|
+
headerLines++;
|
|
268
|
+
const name = header.name.toLowerCase();
|
|
269
|
+
const covered = provided.get(name);
|
|
270
|
+
if (!covered) return [line];
|
|
271
|
+
const tokens = headerTokens(name, header.value);
|
|
272
|
+
const remaining = tokens.filter((token) => !covered.has(tokenKey(name, token)));
|
|
273
|
+
if (remaining.length === tokens.length) return [line];
|
|
274
|
+
changed = true;
|
|
275
|
+
if (remaining.length > 0) return [header.withValue(remaining.join(", "))];
|
|
276
|
+
headerLines--;
|
|
277
|
+
return [];
|
|
278
|
+
});
|
|
279
|
+
return headerLines === 0 ? kept.join("") : `${routeLine}${kept.join("")}`;
|
|
280
|
+
});
|
|
281
|
+
return changed ? output.join("") : contents;
|
|
282
|
+
}
|
|
283
|
+
const RE_EXACT_MARKDOWN_ROUTE = /^\/[^*\s]*\.md[\t ]*\r?$/;
|
|
284
|
+
/** Splits a `_headers` file into its rule blocks. Leading comments and blank lines form a routeless block. */
|
|
285
|
+
function splitHeaderBlocks(contents) {
|
|
286
|
+
const blocks = [];
|
|
287
|
+
let current = {
|
|
288
|
+
route: null,
|
|
289
|
+
text: ""
|
|
290
|
+
};
|
|
291
|
+
for (const line of contents.split(/(?<=\n)/)) {
|
|
292
|
+
if (/^[^\s#]/.test(line)) {
|
|
293
|
+
blocks.push(current);
|
|
294
|
+
current = {
|
|
295
|
+
route: line.trimEnd(),
|
|
296
|
+
text: ""
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
current.text += line;
|
|
300
|
+
}
|
|
301
|
+
blocks.push(current);
|
|
302
|
+
return blocks;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Keeps a `_headers` file under a host's rule limit.
|
|
306
|
+
*
|
|
307
|
+
* Exact `.md` rules are the ones this module multiplies, one per prerendered
|
|
308
|
+
* page, so a site with more pages than the limit fails its whole deploy on the
|
|
309
|
+
* upload. When the file is over budget discovery-only rules go first. The `/*.md` glob
|
|
310
|
+
* still sets the charset and describedby entries for every markdown twin;
|
|
311
|
+
* policy rules remain, while per-page canonical and alternate entries can go.
|
|
312
|
+
*/
|
|
313
|
+
function enforceStaticHeaderBudget(contents, limit) {
|
|
314
|
+
const blocks = splitHeaderBlocks(contents);
|
|
315
|
+
const ruleCount = blocks.filter((block) => block.route !== null).length;
|
|
316
|
+
if (ruleCount <= limit) return {
|
|
317
|
+
contents,
|
|
318
|
+
total: ruleCount,
|
|
319
|
+
dropped: 0
|
|
320
|
+
};
|
|
321
|
+
const kept = blocks.filter((block) => block.route === null || !RE_EXACT_MARKDOWN_ROUTE.test(block.route) || /^\s+(?:content-signal\s*:|!\s*content-signal\s*$)/im.test(block.text));
|
|
322
|
+
return {
|
|
323
|
+
contents: kept.map((block) => block.text).join(""),
|
|
324
|
+
total: kept.filter((block) => block.route !== null).length,
|
|
325
|
+
dropped: ruleCount - kept.filter((block) => block.route !== null).length
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
export { mergeStaticDiscoveryHeaders as a, logger as c, matchingStaticContentSignals as i, enforceStaticHeaderBudget as n, normalizeStaticContentSignalHeaders as o, ensureStaticHeader as r, MARKDOWN_LINK_AVAILABILITY_FILE as s, dedupeStaticHeaders as t };
|
package/dist/types.d.mts
CHANGED
|
@@ -5,12 +5,4 @@ declare module '@nuxt/schema' {
|
|
|
5
5
|
interface PublicRuntimeConfig extends ModulePublicRuntimeConfig {}
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export { type AiTermsAccess, type AiTermsConfig, type AiTermsDocument, type AiTermsFreeAllowance, type AiTermsPath, type AiTermsPayment, type AiTermsPrice, type AiTermsPurpose, type AiTermsUse } from '
|
|
9
|
-
|
|
10
|
-
export { type AgentSkillConfig, type AgentSkillsConfig, type AgentSkillsIndex, type AgentSkillsIndexEntry, type ApiCatalogConfig, type ApiCatalogEntry, type ApiCatalogLinkTarget, type ApiCatalogLinks, type ExternalAgentSkillConfig, type LocalAgentSkillConfig, type McpServerCardConfig, type ModuleOptions } from '../dist/runtime/types.js'
|
|
11
|
-
|
|
12
|
-
export { type GetPageMarkdownToolOptions, type ListPagesToolOptions, type McpSiteToolAttachmentOptions, type SearchPagesToolOptions, type SiteToolOptions, type SiteToolsConfig, type WebMcpSiteToolAttachmentOptions } from '../dist/runtime/site-tool-config.js'
|
|
13
|
-
|
|
14
|
-
export { default } from './module.mjs'
|
|
15
|
-
|
|
16
|
-
export { type ModuleAppRuntimeConfig, type ModuleHooks, type ModulePublicRuntimeConfig } from './module.mjs'
|
|
8
|
+
export { type AgentSkillConfig, type AgentSkillsConfig, type AgentSkillsIndex, type AgentSkillsIndexEntry, type AiTermsAccess, type AiTermsConfig, type AiTermsDocument, type AiTermsFreeAllowance, type AiTermsPath, type AiTermsPayment, type AiTermsPrice, type AiTermsPurpose, type AiTermsUse, type ApiCatalogConfig, type ApiCatalogEntry, type ApiCatalogLinks, type ApiCatalogLinkTarget, type ExternalAgentSkillConfig, type GetPageMarkdownToolOptions, type ListPagesToolOptions, type LocalAgentSkillConfig, type McpServerCardConfig, type McpSiteToolAttachmentOptions, type ModuleAppRuntimeConfig, type ModuleHooks, type ModuleOptions, type ModulePublicRuntimeConfig, type SearchPagesToolOptions, type SiteToolOptions, type SiteToolsConfig, type WebMcpSiteToolAttachmentOptions, default } from './module.mjs'
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-ai-ready",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.6.
|
|
4
|
+
"version": "3.6.2",
|
|
5
5
|
"description": "Best practice AI & LLM discoverability for Nuxt sites.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Harlan Wilton",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"defu": "^6.1.7",
|
|
82
82
|
"mdream": "^2.2.0",
|
|
83
83
|
"nuxt-site-config": "^5.0.4",
|
|
84
|
-
"nuxtseo-shared": "^6.0.
|
|
84
|
+
"nuxtseo-shared": "^6.0.5",
|
|
85
85
|
"ohash": "^2.0.12",
|
|
86
86
|
"pathe": "^2.0.3",
|
|
87
87
|
"site-config-stack": "^5.0.4",
|
|
@@ -90,27 +90,28 @@
|
|
|
90
90
|
"yaml": "^2.9.1"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
|
-
"@antfu/eslint-config": "^
|
|
93
|
+
"@antfu/eslint-config": "^10.0.0",
|
|
94
94
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
95
95
|
"@harlan-zw/comark-content": "^0.2.2",
|
|
96
96
|
"@libsql/client": "^0.18.0",
|
|
97
|
-
"@nuxt/content": "^3.
|
|
98
|
-
"@nuxt/module-builder": "
|
|
97
|
+
"@nuxt/content": "^3.17.0",
|
|
98
|
+
"@nuxt/module-builder": "2.0.0-alpha.1",
|
|
99
99
|
"@nuxt/test-utils": "^4.4.0",
|
|
100
100
|
"@nuxtjs/eslint-config-typescript": "^12.1.0",
|
|
101
101
|
"@nuxtjs/mcp-toolkit": "^0.24.3",
|
|
102
102
|
"@types/better-sqlite3": "^9.6.0",
|
|
103
|
-
"@vitest/coverage-v8": "^5.1.
|
|
103
|
+
"@vitest/coverage-v8": "^5.1.1",
|
|
104
104
|
"@vue/test-utils": "^2.6.0",
|
|
105
105
|
"@vueuse/nuxt": "^15.0.0",
|
|
106
106
|
"better-sqlite3": "^13.2.0",
|
|
107
107
|
"bumpp": "^12.3.0",
|
|
108
|
-
"drizzle-orm": "1.0.0-rc.
|
|
108
|
+
"drizzle-orm": "1.0.0-rc.6",
|
|
109
109
|
"eslint": "^10.15.0",
|
|
110
110
|
"eslint-plugin-harlanzw": "^0.23.0",
|
|
111
111
|
"execa": "^10.2.1",
|
|
112
112
|
"h3": "^2.0.8",
|
|
113
113
|
"happy-dom": "^21.0.4",
|
|
114
|
+
"nitro": "3.0.261103-rc",
|
|
114
115
|
"nitropack": "^2.13.6",
|
|
115
116
|
"nuxt": "4.6.4",
|
|
116
117
|
"nuxt-site-config": "^5.0.4",
|
|
@@ -118,33 +119,28 @@
|
|
|
118
119
|
"playwright": "^1.65.1",
|
|
119
120
|
"playwright-core": "^1.65.1",
|
|
120
121
|
"postgres": "^3.4.9",
|
|
122
|
+
"tsdown": "^0.23.7",
|
|
121
123
|
"typescript": "6.0.3",
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
"vue": "^3.5.45",
|
|
124
|
+
"vitest": "^5.1.1",
|
|
125
|
+
"vue": "^3.5.46",
|
|
125
126
|
"vue-router": "^5.5.1",
|
|
126
127
|
"vue-tsc": "^3.3.14",
|
|
127
128
|
"wrangler": "^4.163.0",
|
|
128
129
|
"zod": "^4.6.7"
|
|
129
130
|
},
|
|
130
|
-
"build": {
|
|
131
|
-
"externals": [
|
|
132
|
-
"node:sqlite",
|
|
133
|
-
"nuxt/server"
|
|
134
|
-
]
|
|
135
|
-
},
|
|
136
131
|
"scripts": {
|
|
137
132
|
"lint": "eslint .",
|
|
138
133
|
"lint:fix": "eslint . --fix",
|
|
139
|
-
"build": "
|
|
134
|
+
"build": "pnpm run build:module && pnpm run build:devtools && pnpm run test:dist",
|
|
135
|
+
"build:module": "nuxt-module-build prepare && tsdown",
|
|
140
136
|
"build:devtools": "node -e \"require('fs').cpSync('devtools','dist/devtools',{recursive:true})\"",
|
|
141
|
-
"dev": "nuxt dev playground",
|
|
142
|
-
"dev:minimal": "
|
|
143
|
-
"prepare:fixtures": "nuxt prepare playground && nuxt prepare
|
|
137
|
+
"dev": "pnpm run build:module && pnpm run build:devtools && nuxt dev playground",
|
|
138
|
+
"dev:minimal": "pnpm run dev",
|
|
139
|
+
"prepare:fixtures": "nuxt prepare playground && nuxt prepare test/fixtures/basic",
|
|
144
140
|
"dev:build": "nuxt build playground",
|
|
145
141
|
"dev:build:minimal": "nuxt build playground",
|
|
146
|
-
"dev:prepare": "
|
|
147
|
-
"dev:prepare:minimal": "
|
|
142
|
+
"dev:prepare": "pnpm run build:module && nuxt prepare playground && pnpm run build:devtools",
|
|
143
|
+
"dev:prepare:minimal": "pnpm run build:module && nuxt prepare playground",
|
|
148
144
|
"release": "pnpm build && bumpp -x \"npx changelogen --output=CHANGELOG.md\"",
|
|
149
145
|
"test": "vitest run && pnpm test:nuxt5",
|
|
150
146
|
"test:run": "pnpm run prepare:fixtures && vitest run && pnpm test:nuxt5",
|
|
@@ -44,7 +44,9 @@ Add llms.txt sections and notes; `notes` renders before the first heading:
|
|
|
44
44
|
export default defineNuxtConfig({
|
|
45
45
|
aiReady: {
|
|
46
46
|
llmsTxt: {
|
|
47
|
-
sections: [
|
|
47
|
+
sections: [
|
|
48
|
+
{ title: 'Skills', sitemap: 'skills', path: '/llms/skills.txt' }
|
|
49
|
+
],
|
|
48
50
|
notes: 'Built with Nuxt AI Ready',
|
|
49
51
|
},
|
|
50
52
|
},
|
|
@@ -70,7 +72,11 @@ Drop an element from every conversion with `mdreamOptions`, e.g. `aiReady: { mdr
|
|
|
70
72
|
Content Signals: a `contentSignal` object states the whole policy, so an omitted permission renders as `no`:
|
|
71
73
|
|
|
72
74
|
```ts
|
|
73
|
-
export default defineNuxtConfig({
|
|
75
|
+
export default defineNuxtConfig({
|
|
76
|
+
aiReady: {
|
|
77
|
+
contentSignal: { search: true, aiInput: true, aiTrain: false }
|
|
78
|
+
}
|
|
79
|
+
})
|
|
74
80
|
// robots.txt: Content-Signal: ai-train=no, search=yes, ai-input=yes
|
|
75
81
|
```
|
|
76
82
|
|