nuxt-ai-ready 3.0.2 → 3.0.4

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 { join, resolve, isAbsolute, relative, sep } from 'node:path';
4
4
  import { parseDocument } from 'yaml';
5
- import { A as AGENT_SKILLS_SCHEMA } from '../shared/nuxt-ai-ready.Deh7Mj_G.mjs';
5
+ import { A as AGENT_SKILLS_SCHEMA } from '../shared/nuxt-ai-ready.iq1L3kll.mjs';
6
6
  import 'node:module';
7
7
  import 'node:url';
8
8
  import '@nuxt/kit';
@@ -11,12 +11,12 @@ import 'nuxt-site-config/kit';
11
11
  import 'nuxtseo-shared/kit';
12
12
  import '../shared/nuxt-ai-ready.B3hAuOLQ.mjs';
13
13
  import 'node:fs';
14
- import '../../dist/runtime/markdown-path.js';
15
14
  import '../../dist/runtime/route-path.js';
16
15
  import '../../dist/runtime/server/utils/sitemap-md.js';
17
16
  import '../../dist/runtime/cache-control.js';
18
17
  import '../../dist/runtime/server/utils/discovery-response.js';
19
18
  import 'confbox';
19
+ import '../../dist/runtime/markdown-path.js';
20
20
  import 'nuxtseo-shared/server';
21
21
  import '../../dist/runtime/server/utils/content-negotiation.js';
22
22
  import 'pathe';
@@ -6,7 +6,7 @@ import { resolveLocaleFromRoute } from 'nuxtseo-shared/i18n-runtime';
6
6
  import { createPrerenderFetch } from 'nuxtseo-shared/prerender';
7
7
  import { collectSitemap } from 'sitemapd/parse';
8
8
  import { withLeadingSlash, joinURL, withBase } from 'ufo';
9
- import { l as logger, M as MARKDOWN_LINK_AVAILABILITY_FILE } from '../shared/nuxt-ai-ready.Deh7Mj_G.mjs';
9
+ import { l as logger, M as MARKDOWN_LINK_AVAILABILITY_FILE } from '../shared/nuxt-ai-ready.iq1L3kll.mjs';
10
10
  import { normalizePagePath, toMarkdownPath } from '../../dist/runtime/markdown-path.js';
11
11
  import { toDeployedRoute, toLogicalRoute } from '../../dist/runtime/route-path.js';
12
12
  import { initSchema, computeContentHash, insertPage, queryAllPages, exportDbDump } from '../../dist/runtime/server/db/shared.js';
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "nuxt": "^4.6.0 || ^5.0.0-0"
5
5
  },
6
6
  "configKey": "aiReady",
7
- "version": "3.0.2",
7
+ "version": "3.0.4",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.3",
10
10
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -7,14 +7,14 @@ import '@nuxt/kit';
7
7
  import 'defu';
8
8
  import 'nuxt-site-config/kit';
9
9
  import 'nuxtseo-shared/kit';
10
- export { m as default } from './shared/nuxt-ai-ready.Deh7Mj_G.mjs';
10
+ export { m as default } from './shared/nuxt-ai-ready.iq1L3kll.mjs';
11
11
  import './shared/nuxt-ai-ready.B3hAuOLQ.mjs';
12
- import '../dist/runtime/markdown-path.js';
13
12
  import '../dist/runtime/route-path.js';
14
13
  import '../dist/runtime/server/utils/sitemap-md.js';
15
14
  import '../dist/runtime/server/utils/discovery-response.js';
16
15
  import '../dist/runtime/cache-control.js';
17
16
  import 'confbox';
17
+ import '../dist/runtime/markdown-path.js';
18
18
  import 'nuxtseo-shared/server';
19
19
  import '../dist/runtime/server/utils/content-negotiation.js';
20
20
  import 'pathe';
@@ -87,6 +87,12 @@ ${contentPage.markdown}`;
87
87
  message: `Failed to fetch HTML for ${path}`
88
88
  });
89
89
  }
90
+ if (!response.headers.get("content-type")?.includes("text/html")) {
91
+ return createError({
92
+ statusCode: 404,
93
+ message: `Not an HTML page: ${path}`
94
+ });
95
+ }
90
96
  html = await response.text();
91
97
  logger.debug(`[markdown.prerender] Fetched HTML for ${path} (${html.length} bytes)`);
92
98
  consumePrerenderedHtml(path);
@@ -8,12 +8,12 @@ import defu$1, { defu } from 'defu';
8
8
  import { useSiteConfig, withSiteUrl } from 'nuxt-site-config/kit';
9
9
  import { resolveNuxtContentVersion, renderNitroTypeAugmentations, setupRuntimeAliases, setupNitroRuntimeCompatibility } from 'nuxtseo-shared/kit';
10
10
  import { r as readPackageMetadata, a as resolvePackageMetadataPath } from './nuxt-ai-ready.B3hAuOLQ.mjs';
11
- import { hasMarkdownTwin, normalizePagePath, toMarkdownPath } from '../../dist/runtime/markdown-path.js';
12
11
  import { toDeployedRoute } from '../../dist/runtime/route-path.js';
13
12
  import { SITEMAP_MD_ROUTE } from '../../dist/runtime/server/utils/sitemap-md.js';
14
13
  import { publicCacheControl, mergeVaryHeader } from '../../dist/runtime/cache-control.js';
15
14
  import { MCP_SERVER_CARD_MEDIA_TYPE, AI_CATALOG_MEDIA_TYPE } from '../../dist/runtime/server/utils/discovery-response.js';
16
15
  import { parseTOML, parseJSONC } from 'confbox';
16
+ import { toMarkdownPath, hasMarkdownTwin, normalizePagePath } from '../../dist/runtime/markdown-path.js';
17
17
  import { createNitroRouteRuleMatcher } from 'nuxtseo-shared/server';
18
18
  import { getContentNegotiationVary, resolveContentNegotiation } from '../../dist/runtime/server/utils/content-negotiation.js';
19
19
  import { isAbsolute, join as join$1 } from 'pathe';
@@ -1516,6 +1516,8 @@ function resolveWebMcpConfig(input, toolsConfig) {
1516
1516
  };
1517
1517
  }
1518
1518
 
1519
+ const MODULE_PACKAGE_NAME = "nuxt-ai-ready";
1520
+ const RE_SITEMAPD_PACKAGE = /[/\\]node_modules[/\\]sitemapd[/\\]/;
1519
1521
  const module$1 = defineNuxtModule({
1520
1522
  meta: {
1521
1523
  name: "nuxt-ai-ready",
@@ -2031,8 +2033,12 @@ ${details}`);
2031
2033
  nuxt.hooks.hook("nitro:config", (nitroConfig) => {
2032
2034
  if (getNitroVersion(nuxt) === 3) {
2033
2035
  const nativeConfig = nitroConfig;
2034
- if (nativeConfig.noExternals !== true)
2035
- nativeConfig.noExternals = [...nativeConfig.noExternals || [], "nuxt-ai-ready"];
2036
+ if (nativeConfig.noExternals !== true) {
2037
+ nativeConfig.noExternals = [
2038
+ ...(nativeConfig.noExternals || []).filter((entry) => entry !== MODULE_PACKAGE_NAME),
2039
+ resolve$1("./runtime")
2040
+ ];
2041
+ }
2036
2042
  } else {
2037
2043
  const externals = nitroConfig.externals ||= {};
2038
2044
  externals.inline ||= [];
@@ -2047,7 +2053,7 @@ ${details}`);
2047
2053
  if (nitroCompatibility._tag === "nitro-v3") {
2048
2054
  const nitro3Config = nitroConfig;
2049
2055
  if (nitro3Config.noExternals !== true)
2050
- nitro3Config.noExternals = [...nitro3Config.noExternals || [], "sitemapd"];
2056
+ nitro3Config.noExternals = [...nitro3Config.noExternals || [], RE_SITEMAPD_PACKAGE];
2051
2057
  if (!isEdgePreset) {
2052
2058
  nitro3Config.traceDeps ||= [];
2053
2059
  nitro3Config.traceDeps.push("mdream*");
@@ -2379,17 +2385,13 @@ export function trackDrizzleWork(event, work) { return work }
2379
2385
  nitro.hooks.hook("rollup:reload", () => warnConfiguration(nitro));
2380
2386
  });
2381
2387
  nuxt.hook("nitro:build:before", warnConfiguration);
2382
- for (const route of nuxt.options.nitro.prerender?.routes || []) {
2383
- if (!isStaticMarkdownSourceRoute(route))
2384
- continue;
2385
- extendRouteRules(toMarkdownPath(route), {
2386
- headers: {
2387
- "Content-Type": "text/markdown; charset=utf-8",
2388
- "Link": buildStaticMarkdownLinkHeader(route, staticBaseURL, config.describedby !== false),
2389
- "Vary": "Accept"
2390
- }
2391
- });
2392
- }
2388
+ let sharedMarkdownRuleNoted = false;
2389
+ const noteSharedMarkdownRule = (total, dropped) => {
2390
+ if (sharedMarkdownRuleNoted)
2391
+ return;
2392
+ sharedMarkdownRuleNoted = true;
2393
+ logger.info(`Cloudflare allows ${CLOUDFLARE_STATIC_HEADER_RULE_LIMIT} _headers rules. One rule per Markdown page would make ${total}. The ${dropped} Markdown pages share the /*.md rule, which sends no per-page canonical Link header.`);
2394
+ };
2393
2395
  nuxt.hooks.hook("nitro:build:before", (nitro) => {
2394
2396
  const isCloudflarePreset = String(nitro.options.preset || "").startsWith("cloudflare");
2395
2397
  nitro.hooks.hook("prerender:done", async () => {
@@ -2421,7 +2423,7 @@ export function trackDrizzleWork(event, work) { return work }
2421
2423
  );
2422
2424
  if (plan._tag === "skip") {
2423
2425
  applyStaticMarkdownHeaderPlan(nitro.options.routeRules, plan);
2424
- logger.warn(`_headers would hold ${plan.total} rules and Cloudflare allows ${CLOUDFLARE_STATIC_HEADER_RULE_LIMIT}. Skipped the ${plan.dropped} per-page .md rules; the /*.md glob still sets the charset and describedby entries, but static markdown does not send a per-page canonical Link.`);
2426
+ noteSharedMarkdownRule(plan.total, plan.dropped);
2425
2427
  return;
2426
2428
  }
2427
2429
  applyStaticMarkdownHeaderPlan(nitro.options.routeRules, plan);
@@ -2490,7 +2492,7 @@ export function trackDrizzleWork(event, work) { return work }
2490
2492
  const budget = enforceStaticHeaderBudget(mergedHeaders, CLOUDFLARE_STATIC_HEADER_RULE_LIMIT);
2491
2493
  if (budget.dropped > 0) {
2492
2494
  mergedHeaders = budget.contents;
2493
- logger.warn(`_headers had ${budget.total + budget.dropped} rules and Cloudflare allows ${CLOUDFLARE_STATIC_HEADER_RULE_LIMIT}. Dropped the ${budget.dropped} per-page .md rules; the /*.md glob still sets the charset and describedby entries, but static markdown no longer sends a per-page canonical Link.`);
2495
+ noteSharedMarkdownRule(budget.total + budget.dropped, budget.dropped);
2494
2496
  }
2495
2497
  if (budget.total > CLOUDFLARE_STATIC_HEADER_RULE_LIMIT)
2496
2498
  logger.warn(`_headers still has ${budget.total} rules after dropping the .md rules. Cloudflare will reject the deploy until the other rules fit under ${CLOUDFLARE_STATIC_HEADER_RULE_LIMIT}.`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-ai-ready",
3
3
  "type": "module",
4
- "version": "3.0.2",
4
+ "version": "3.0.4",
5
5
  "description": "Best practice AI & LLM discoverability for Nuxt sites.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",