nuxt-ai-ready 2.3.0 → 2.3.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.
|
@@ -2,7 +2,7 @@ import { createHash } from 'node:crypto';
|
|
|
2
2
|
import { realpath, readFile, readdir } from 'node:fs/promises';
|
|
3
3
|
import { resolve, isAbsolute, join, relative, sep } from 'node:path';
|
|
4
4
|
import { parseDocument } from 'yaml';
|
|
5
|
-
import { A as AGENT_SKILLS_SCHEMA } from '../shared/nuxt-ai-ready.
|
|
5
|
+
import { A as AGENT_SKILLS_SCHEMA } from '../shared/nuxt-ai-ready.wTtq73UR.mjs';
|
|
6
6
|
import 'node:module';
|
|
7
7
|
import '@nuxt/kit';
|
|
8
8
|
import 'defu';
|
|
@@ -257,9 +257,9 @@ async function resolveAgentSkillsConfig(config, rootDir, options = {}) {
|
|
|
257
257
|
for (const route of result.routes)
|
|
258
258
|
localArtifacts[route] = result.content;
|
|
259
259
|
const [alias] = result.routes.slice(1).sort((a, b) => a.length - b.length);
|
|
260
|
-
links.push({ name: result.entry.name, description: result.entry.description, href: alias ?? result.routes[0] });
|
|
260
|
+
links.push({ source: "local", name: result.entry.name, description: result.entry.description, href: alias ?? result.routes[0] });
|
|
261
261
|
} else {
|
|
262
|
-
links.push({ name: result.entry.name, description: result.entry.description, href: result.entry.url });
|
|
262
|
+
links.push({ source: "external", name: result.entry.name, description: result.entry.description, href: result.entry.url });
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
265
|
return {
|
|
@@ -5,7 +5,7 @@ import { colorize } from 'consola/utils';
|
|
|
5
5
|
import { resolveLocaleFromRoute } from 'nuxtseo-shared/i18n-runtime';
|
|
6
6
|
import { collectSitemap } from 'sitemapd/parse';
|
|
7
7
|
import { withLeadingSlash, joinURL, withBase } from 'ufo';
|
|
8
|
-
import { l as logger, s as supportsNativeNodeSqlite, M as MARKDOWN_LINK_AVAILABILITY_FILE } from '../shared/nuxt-ai-ready.
|
|
8
|
+
import { l as logger, s as supportsNativeNodeSqlite, M as MARKDOWN_LINK_AVAILABILITY_FILE } from '../shared/nuxt-ai-ready.wTtq73UR.mjs';
|
|
9
9
|
import { normalizePagePath, toMarkdownPath } from '../../dist/runtime/markdown-path.js';
|
|
10
10
|
import { toDeployedRoute, toLogicalRoute } from '../../dist/runtime/route-path.js';
|
|
11
11
|
import { initSchema, computeContentHash, insertPage, queryAllPages, exportDbDump } from '../../dist/runtime/server/db/shared.js';
|
|
@@ -313,6 +313,7 @@ function setupPrerenderHandler(options, dbPath, siteInfo, llmsTxtConfig, extras
|
|
|
313
313
|
extras.i18n
|
|
314
314
|
);
|
|
315
315
|
let initPromise = null;
|
|
316
|
+
const artifactRoutes = new Set(extras.artifactRoutes ?? []);
|
|
316
317
|
nitro.hooks.hook("prerender:generate", async (route) => {
|
|
317
318
|
if (route.error) {
|
|
318
319
|
const routePath = route.fileName || route.route;
|
|
@@ -323,6 +324,10 @@ function setupPrerenderHandler(options, dbPath, siteInfo, llmsTxtConfig, extras
|
|
|
323
324
|
}
|
|
324
325
|
if (route.fileName === SITEMAP_MD_ROUTE)
|
|
325
326
|
return;
|
|
327
|
+
if (artifactRoutes.has(route.route) || route.fileName && artifactRoutes.has(withLeadingSlash(route.fileName))) {
|
|
328
|
+
route.contentType = "text/markdown; charset=utf-8";
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
326
331
|
if (!route.fileName?.endsWith(".md"))
|
|
327
332
|
return;
|
|
328
333
|
let pageRoute = route.route.replace(RE_MD_EXT, "");
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import 'defu';
|
|
|
7
7
|
import 'nuxt-site-config/kit';
|
|
8
8
|
import 'nuxtseo-shared/kit';
|
|
9
9
|
import 'pkg-types';
|
|
10
|
-
export { m as default } from './shared/nuxt-ai-ready.
|
|
10
|
+
export { m as default } from './shared/nuxt-ai-ready.wTtq73UR.mjs';
|
|
11
11
|
import '../dist/runtime/markdown-path.js';
|
|
12
12
|
import '../dist/runtime/server/utils/sitemap-md.js';
|
|
13
13
|
import '../dist/runtime/server/utils/discovery-response.js';
|
|
@@ -278,6 +278,20 @@ declare module '#ai-ready-virtual/agent-skills.mjs' {
|
|
|
278
278
|
const AGENT_SKILLS_SCHEMA = "https://schemas.agentskills.io/discovery/0.2.0/schema.json";
|
|
279
279
|
const AGENT_SKILLS_INDEX_ROUTE = "/.well-known/agent-skills/index.json";
|
|
280
280
|
const AGENT_SKILLS_CACHE_CONTROL = "public, max-age=3600, s-maxage=3600, stale-while-revalidate=86400";
|
|
281
|
+
function resolveExternalSkillUrl(href, indexUrl) {
|
|
282
|
+
const normalized = href.replaceAll(/[\t\n\r]/g, "");
|
|
283
|
+
if (URL.canParse(normalized))
|
|
284
|
+
return new URL(normalized).href;
|
|
285
|
+
if (normalized.startsWith("//")) {
|
|
286
|
+
const resolved2 = new URL(normalized, "https://nuxt-ai-ready.invalid");
|
|
287
|
+
const auth = resolved2.username || resolved2.password ? `${resolved2.username}${resolved2.password ? `:${resolved2.password}` : ""}@` : "";
|
|
288
|
+
return `//${auth}${resolved2.host}${resolved2.pathname}${resolved2.search}${resolved2.hash}`;
|
|
289
|
+
}
|
|
290
|
+
if (URL.canParse(indexUrl))
|
|
291
|
+
return new URL(normalized, indexUrl).href;
|
|
292
|
+
const resolved = new URL(normalized, new URL(indexUrl, "https://nuxt-ai-ready.invalid"));
|
|
293
|
+
return `${resolved.pathname}${resolved.search}${resolved.hash}`;
|
|
294
|
+
}
|
|
281
295
|
|
|
282
296
|
const AI_CATALOG_PATH = "/.well-known/ai-catalog.json";
|
|
283
297
|
function resolveAiCatalog(input) {
|
|
@@ -1354,7 +1368,7 @@ ${details}`);
|
|
|
1354
1368
|
description: `Skills an agent can install from this site. The index at ${indexUrl} carries a sha256 digest for each one.`,
|
|
1355
1369
|
links: agentSkillsResult.links.map((link) => ({
|
|
1356
1370
|
title: link.name,
|
|
1357
|
-
href: link.
|
|
1371
|
+
href: link.source === "local" ? withSiteUrl(link.href.slice(1), { withBase: true }) : resolveExternalSkillUrl(link.href, indexUrl),
|
|
1358
1372
|
description: link.description
|
|
1359
1373
|
}))
|
|
1360
1374
|
});
|
|
@@ -1851,7 +1865,11 @@ export const logger = createModuleLogger('nuxt-ai-ready', ${!!config.debug})
|
|
|
1851
1865
|
name: siteConfig.name,
|
|
1852
1866
|
url: siteConfig.url ? withSiteUrl("/", { withBase: true }) : void 0,
|
|
1853
1867
|
description: siteConfig.description
|
|
1854
|
-
}, mergedLlmsTxt, {
|
|
1868
|
+
}, mergedLlmsTxt, {
|
|
1869
|
+
ftsTokenizer,
|
|
1870
|
+
i18n: i18nConfig,
|
|
1871
|
+
artifactRoutes: agentSkillsResult._tag === "Enabled" ? Object.keys(agentSkillsResult.localArtifacts) : []
|
|
1872
|
+
});
|
|
1855
1873
|
}
|
|
1856
1874
|
if (databaseEnabled)
|
|
1857
1875
|
addServerPlugin(resolve("./runtime/server/plugins/db-lifecycle"));
|