nuxt-ai-ready 2.4.0 → 2.4.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.
- package/dist/chunks/agent-skills.mjs +2 -1
- package/dist/chunks/prerender.mjs +2 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -1
- package/dist/runtime/cache-control.d.ts +8 -0
- package/dist/runtime/cache-control.js +3 -0
- package/dist/runtime/server/routes/agent-skills-artifact.js +2 -1
- package/dist/runtime/server/routes/agent-skills-index.js +2 -1
- package/dist/runtime/server/routes/llms-full.txt.get.js +2 -1
- package/dist/runtime/server/routes/llms.txt.get.js +2 -1
- package/dist/runtime/server/routes/sitemap.md.get.js +2 -1
- package/dist/shared/{nuxt-ai-ready.B5l-paa5.mjs → nuxt-ai-ready.CxJE2WLA.mjs} +2 -1
- package/package.json +1 -1
|
@@ -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.CxJE2WLA.mjs';
|
|
6
6
|
import 'node:module';
|
|
7
7
|
import '@nuxt/kit';
|
|
8
8
|
import 'defu';
|
|
@@ -12,6 +12,7 @@ import 'pkg-types';
|
|
|
12
12
|
import 'node:url';
|
|
13
13
|
import '../../dist/runtime/markdown-path.js';
|
|
14
14
|
import '../../dist/runtime/server/utils/sitemap-md.js';
|
|
15
|
+
import '../../dist/runtime/cache-control.js';
|
|
15
16
|
import '../../dist/runtime/server/utils/discovery-response.js';
|
|
16
17
|
import 'pathe';
|
|
17
18
|
import 'nuxtseo-shared/i18n';
|
|
@@ -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.CxJE2WLA.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';
|
|
@@ -19,6 +19,7 @@ import 'nuxt-site-config/kit';
|
|
|
19
19
|
import 'nuxtseo-shared/kit';
|
|
20
20
|
import 'pkg-types';
|
|
21
21
|
import 'node:url';
|
|
22
|
+
import '../../dist/runtime/cache-control.js';
|
|
22
23
|
import '../../dist/runtime/server/utils/discovery-response.js';
|
|
23
24
|
import 'pathe';
|
|
24
25
|
import 'nuxtseo-shared/i18n';
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -7,11 +7,12 @@ 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.CxJE2WLA.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';
|
|
14
14
|
import 'node:url';
|
|
15
|
+
import '../dist/runtime/cache-control.js';
|
|
15
16
|
import 'pathe';
|
|
16
17
|
import 'nuxtseo-shared/i18n';
|
|
17
18
|
import '../dist/runtime/route-path.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared `Cache-Control` for public AI-ready endpoints.
|
|
3
|
+
*
|
|
4
|
+
* Freshness goes in `max-age` only. Cloudflare disables stale serving when
|
|
5
|
+
* `s-maxage` is present, so `stale-while-revalidate` would never apply at
|
|
6
|
+
* the edge.
|
|
7
|
+
*/
|
|
8
|
+
export declare function publicCacheControl(maxAgeSeconds: number, staleSeconds: number): string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { localAgentSkillArtifacts } from "#ai-ready-virtual/agent-skills.mjs";
|
|
2
2
|
import { assertMethod, createError, eventHandler, getRequestURL, setHeader } from "#nuxtseo/h3";
|
|
3
3
|
import { useRuntimeConfig } from "#nuxtseo/nitro";
|
|
4
|
+
import { publicCacheControl } from "../../cache-control.js";
|
|
4
5
|
import { toLogicalRoute } from "../../route-path.js";
|
|
5
6
|
export default eventHandler((event) => {
|
|
6
7
|
assertMethod(event, ["GET", "HEAD"]);
|
|
@@ -13,7 +14,7 @@ export default eventHandler((event) => {
|
|
|
13
14
|
});
|
|
14
15
|
}
|
|
15
16
|
setHeader(event, "Content-Type", "text/markdown; charset=utf-8");
|
|
16
|
-
setHeader(event, "Cache-Control",
|
|
17
|
+
setHeader(event, "Cache-Control", publicCacheControl(3600, 86400));
|
|
17
18
|
setHeader(event, "Access-Control-Allow-Origin", "*");
|
|
18
19
|
return content;
|
|
19
20
|
});
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { agentSkillsIndex } from "#ai-ready-virtual/agent-skills.mjs";
|
|
2
2
|
import { assertMethod, eventHandler, setHeader } from "#nuxtseo/h3";
|
|
3
|
+
import { publicCacheControl } from "../../cache-control.js";
|
|
3
4
|
export default eventHandler((event) => {
|
|
4
5
|
assertMethod(event, ["GET", "HEAD"]);
|
|
5
6
|
setHeader(event, "Content-Type", "application/json; charset=utf-8");
|
|
6
|
-
setHeader(event, "Cache-Control",
|
|
7
|
+
setHeader(event, "Cache-Control", publicCacheControl(3600, 86400));
|
|
7
8
|
setHeader(event, "Access-Control-Allow-Origin", "*");
|
|
8
9
|
return agentSkillsIndex;
|
|
9
10
|
});
|
|
@@ -2,6 +2,7 @@ import { eventHandler, sendIterable, setHeader, setResponseHeader } from "#nuxts
|
|
|
2
2
|
import { useRuntimeConfig } from "#nuxtseo/nitro";
|
|
3
3
|
import { getSiteConfig } from "#site-config/server/composables";
|
|
4
4
|
import { withSiteUrl } from "#site-config/server/composables/utils";
|
|
5
|
+
import { publicCacheControl } from "../../cache-control.js";
|
|
5
6
|
import { toDeployedRoute } from "../../route-path.js";
|
|
6
7
|
import { countPages, streamPages } from "../db/queries.js";
|
|
7
8
|
import { buildLlmsFullTxtHeader, formatPageForLlmsFullTxt } from "../utils/llms-full.js";
|
|
@@ -37,7 +38,7 @@ Runtime indexing may not be configured correctly for this environment.`;
|
|
|
37
38
|
return `${header}No pages indexed. Run \`nuxi generate\` or enable runtime indexing.`;
|
|
38
39
|
}
|
|
39
40
|
setHeader(event, "Content-Type", "text/plain; charset=utf-8");
|
|
40
|
-
setResponseHeader(event, "Cache-Control",
|
|
41
|
+
setResponseHeader(event, "Cache-Control", publicCacheControl(3600, 86400));
|
|
41
42
|
const siteUrl = siteConfig.url;
|
|
42
43
|
async function* generateContent() {
|
|
43
44
|
yield header;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { eventHandler, setHeader } from "#nuxtseo/h3";
|
|
2
2
|
import { defineCachedFunction, useRuntimeConfig } from "#nuxtseo/nitro";
|
|
3
|
+
import { publicCacheControl } from "../../cache-control.js";
|
|
3
4
|
import { buildLlmsTxt } from "../../llms-txt-utils.js";
|
|
4
5
|
const cachedBuilders = /* @__PURE__ */ new Map();
|
|
5
6
|
function getBuildLlmsTxtCached(maxAge) {
|
|
@@ -22,7 +23,7 @@ export default eventHandler(async (event) => {
|
|
|
22
23
|
const content = cacheEnabled ? await getBuildLlmsTxtCached(cacheSeconds)(event) : await buildLlmsTxt(event);
|
|
23
24
|
setHeader(event, "Content-Type", "text/plain; charset=utf-8");
|
|
24
25
|
if (cacheEnabled) {
|
|
25
|
-
setHeader(event, "Cache-Control",
|
|
26
|
+
setHeader(event, "Cache-Control", publicCacheControl(cacheSeconds, 3600));
|
|
26
27
|
}
|
|
27
28
|
return content;
|
|
28
29
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { eventHandler, setHeader } from "#nuxtseo/h3";
|
|
2
2
|
import { defineCachedFunction, useRuntimeConfig } from "#nuxtseo/nitro";
|
|
3
3
|
import { getSiteConfig } from "#site-config/server/composables";
|
|
4
|
+
import { publicCacheControl } from "../../cache-control.js";
|
|
4
5
|
import { toMarkdownPath } from "../../markdown-path.js";
|
|
5
6
|
import { toDeployedRoute } from "../../route-path.js";
|
|
6
7
|
import { queryPages } from "../db/queries.js";
|
|
@@ -45,7 +46,7 @@ export default eventHandler(async (event) => {
|
|
|
45
46
|
const cacheEnabled = !import.meta.dev && cacheSeconds > 0;
|
|
46
47
|
setHeader(event, "Content-Type", "text/markdown; charset=utf-8");
|
|
47
48
|
if (cacheEnabled) {
|
|
48
|
-
setHeader(event, "Cache-Control",
|
|
49
|
+
setHeader(event, "Cache-Control", publicCacheControl(cacheSeconds, 3600));
|
|
49
50
|
}
|
|
50
51
|
return cacheEnabled ? await getBuildSitemapMdCached(cacheSeconds)(event) : await buildSitemapMarkdown(event);
|
|
51
52
|
});
|
|
@@ -10,6 +10,7 @@ import { readPackageJSON, resolvePackageJSON } from 'pkg-types';
|
|
|
10
10
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
11
11
|
import { isReservedPath, normalizePagePath, toMarkdownPath } from '../../dist/runtime/markdown-path.js';
|
|
12
12
|
import { SITEMAP_MD_ROUTE } from '../../dist/runtime/server/utils/sitemap-md.js';
|
|
13
|
+
import { publicCacheControl } from '../../dist/runtime/cache-control.js';
|
|
13
14
|
import { MCP_SERVER_CARD_MEDIA_TYPE, AI_CATALOG_MEDIA_TYPE } from '../../dist/runtime/server/utils/discovery-response.js';
|
|
14
15
|
import { isAbsolute, join as join$1 } from 'pathe';
|
|
15
16
|
import { resolveI18nConfig, toRuntimeI18nConfig as toRuntimeI18nConfig$1 } from 'nuxtseo-shared/i18n';
|
|
@@ -278,7 +279,7 @@ declare module '#ai-ready-virtual/agent-skills.mjs' {
|
|
|
278
279
|
|
|
279
280
|
const AGENT_SKILLS_SCHEMA = "https://schemas.agentskills.io/discovery/0.2.0/schema.json";
|
|
280
281
|
const AGENT_SKILLS_INDEX_ROUTE = "/.well-known/agent-skills/index.json";
|
|
281
|
-
const AGENT_SKILLS_CACHE_CONTROL =
|
|
282
|
+
const AGENT_SKILLS_CACHE_CONTROL = publicCacheControl(3600, 86400);
|
|
282
283
|
function resolveExternalSkillUrl(href, indexUrl) {
|
|
283
284
|
const normalized = href.replaceAll(/[\t\n\r]/g, "");
|
|
284
285
|
if (URL.canParse(normalized))
|