@nuxtjs/sitemap 8.0.15 → 8.2.0

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 (39) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +17 -16
  3. package/dist/runtime/server/routes/__sitemap__/nuxt-content-urls-v3.js +3 -0
  4. package/dist/runtime/server/sitemap/builder/sitemap.js +8 -3
  5. package/dist/runtime/utils-pure.d.ts +10 -0
  6. package/dist/runtime/utils-pure.js +10 -0
  7. package/package.json +27 -27
  8. package/dist/devtools/200.html +0 -1
  9. package/dist/devtools/404.html +0 -1
  10. package/dist/devtools/_nuxt/6e7EVM9D.js +0 -1
  11. package/dist/devtools/_nuxt/B-mzd7ax.js +0 -1
  12. package/dist/devtools/_nuxt/B9WcJBuc.js +0 -1
  13. package/dist/devtools/_nuxt/BwW5PI4u.js +0 -1
  14. package/dist/devtools/_nuxt/Bx_VzvYa.js +0 -1
  15. package/dist/devtools/_nuxt/CDUvHTjX.js +0 -1
  16. package/dist/devtools/_nuxt/CU6z_fY3.js +0 -1
  17. package/dist/devtools/_nuxt/CnYZ0nz4.js +0 -181
  18. package/dist/devtools/_nuxt/D8q6Bo8T.js +0 -1
  19. package/dist/devtools/_nuxt/DevtoolsEmptyState.DlsL4HGP.css +0 -1
  20. package/dist/devtools/_nuxt/DevtoolsSnippet.Crn-Jli8.css +0 -1
  21. package/dist/devtools/_nuxt/Dfz508oS.js +0 -1
  22. package/dist/devtools/_nuxt/PnYIYlhI.js +0 -1
  23. package/dist/devtools/_nuxt/Source.BJXCd4ey.css +0 -1
  24. package/dist/devtools/_nuxt/builds/latest.json +0 -1
  25. package/dist/devtools/_nuxt/builds/meta/6a13e94e-54b2-4e42-b5dc-6941d3a319d9.json +0 -1
  26. package/dist/devtools/_nuxt/dhgsCGhG.js +0 -1
  27. package/dist/devtools/_nuxt/entry.l1zFHB5e.css +0 -2
  28. package/dist/devtools/_nuxt/fira-code.Bc8wnsZt.woff2 +0 -0
  29. package/dist/devtools/_nuxt/h6WhJoib.js +0 -1
  30. package/dist/devtools/_nuxt/h7zQ0TxP.js +0 -3
  31. package/dist/devtools/_nuxt/hubot-sans.DLGyhQVu.woff2 +0 -0
  32. package/dist/devtools/_nuxt/pages.BDuS3Qx_.css +0 -1
  33. package/dist/devtools/_nuxt/tBStlNYu.js +0 -1
  34. package/dist/devtools/_nuxt/z1-BJQbH.js +0 -1
  35. package/dist/devtools/app-sources/index.html +0 -1
  36. package/dist/devtools/debug/index.html +0 -1
  37. package/dist/devtools/docs/index.html +0 -1
  38. package/dist/devtools/index.html +0 -1
  39. package/dist/devtools/user-sources/index.html +0 -1
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "nuxt": ">=3.9.0"
5
5
  },
6
6
  "configKey": "sitemap",
7
- "version": "8.0.15",
7
+ "version": "8.2.0",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -14,7 +14,7 @@ import { splitForLocales, createPathFilter } from '../dist/runtime/utils-pure.js
14
14
  import { isNuxtGenerate, getNuxtModuleOptions, resolveNitroPreset, resolveNuxtContentVersion, createPagesPromise, createNitroPromise } from 'nuxtseo-shared/kit';
15
15
  import { p as parseHtmlExtractSitemapMeta } from './shared/sitemap.DJC-maKi.mjs';
16
16
  import { normaliseDate } from '../dist/runtime/server/sitemap/urlset/normalise.js';
17
- import { splitPathForI18nLocales as splitPathForI18nLocales$1, normalizeLocales, generatePathForI18nPages } from 'nuxtseo-shared/i18n';
17
+ import { splitPathForI18nLocales as splitPathForI18nLocales$1, expandCompactLocaleRoute, normalizeLocales, generatePathForI18nPages } from 'nuxtseo-shared/i18n';
18
18
  import 'ultrahtml';
19
19
 
20
20
  function setupDevToolsUI(_options, resolve, nuxt = useNuxt()) {
@@ -75,6 +75,7 @@ export async function readSourcesFromFilesystem(filename) {
75
75
  if (!route.fileName?.endsWith(".html") || !html || ["/200.html", "/404.html"].includes(route.route))
76
76
  return;
77
77
  if (NuxtRedirectHtmlRegex.test(html)) {
78
+ route._sitemap = { loc: route.route, _sitemap: false };
78
79
  return;
79
80
  }
80
81
  const extractedMeta = parseHtmlExtractSitemapMeta(html, {
@@ -323,19 +324,14 @@ function deepForEachPage(pages, callback, opts, fullpath = null, depth = 0) {
323
324
  currentPath = page.path === "" ? fullpath : `${fullpath.replace(/\/$/, "")}/${page.path}`;
324
325
  }
325
326
  let didCallback = false;
326
- if (opts.isI18nMicro) {
327
- const localePattern = /\/:locale\(([^)]+)\)/;
328
- const match = localePattern.exec(currentPath || "");
329
- if (match && match[1]) {
330
- const locales = match[1].split("|");
331
- locales.forEach((locale) => {
332
- const subPage = { ...page };
333
- const localizedPath = (currentPath || "").replace(localePattern, `/${locale}`);
334
- subPage.name += opts.routesNameSeparator + locale;
335
- subPage.path = localizedPath;
336
- callback(subPage, localizedPath || "", depth);
337
- didCallback = true;
338
- });
327
+ const compacted = expandCompactLocaleRoute(currentPath || "", opts.normalisedLocales.map((l) => l.code));
328
+ if (compacted) {
329
+ for (const { locale, path: localizedPath } of compacted) {
330
+ const subPage = { ...page };
331
+ subPage.name = `${page.name || ""}${opts.routesNameSeparator}${locale}`;
332
+ subPage.path = localizedPath;
333
+ callback(subPage, localizedPath, depth);
334
+ didCallback = true;
339
335
  }
340
336
  }
341
337
  if (!didCallback) {
@@ -1133,7 +1129,13 @@ ${onUrlEntries.join("\n")}`;
1133
1129
  const nitro = await nitroPromise;
1134
1130
  const prerenderedRoutes2 = nitro._prerenderedRoutes || [];
1135
1131
  const prerenderUrlsFinal = [
1136
- ...prerenderedRoutes2.filter(isValidPrerenderRoute).map((r) => r._sitemap).filter((entry) => entry && (typeof entry === "string" || entry._sitemap !== false))
1132
+ ...prerenderedRoutes2.filter(isValidPrerenderRoute).map((r) => {
1133
+ if (r._sitemap)
1134
+ return r._sitemap;
1135
+ if (r.route.startsWith("/api/") || r.route.startsWith("/_"))
1136
+ return void 0;
1137
+ return { loc: r.route };
1138
+ }).filter((entry) => entry && (typeof entry === "string" || entry._sitemap !== false))
1137
1139
  ];
1138
1140
  if (config.debug) {
1139
1141
  logger.info("Prerendered routes:", prerenderUrlsFinal);
@@ -1149,7 +1151,6 @@ ${onUrlEntries.join("\n")}`;
1149
1151
  include: normalizeFilters(config.include),
1150
1152
  exclude: normalizeFilters(config.exclude)
1151
1153
  },
1152
- isI18nMicro: i18nModule === "nuxt-i18n-micro",
1153
1154
  autoI18n: !!resolvedAutoI18n
1154
1155
  });
1155
1156
  if (!pageSource.length) {
@@ -19,6 +19,9 @@ export default defineEventHandler(async (e) => {
19
19
  query.all().then((results2) => {
20
20
  const filter = filters?.get(collection);
21
21
  return { collection, entries: filter ? results2.filter(filter) : results2 };
22
+ }).catch((err) => {
23
+ console.error(`[@nuxtjs/sitemap] Couldn't query @nuxt/content collection "${collection}" for the sitemap, so its URLs will be missing. On serverless the content DB is restored from a prerendered sql_dump.txt that isn't readable inside the function (nuxt/content#3805). Fix: prerender the sitemap so content URLs resolve at build, or configure a runtime database (D1/Turso/Postgres).`, err);
24
+ return { collection, entries: [] };
22
25
  })
23
26
  );
24
27
  }
@@ -3,7 +3,7 @@ import { defineCachedFunction, useRuntimeConfig } from "nitropack/runtime";
3
3
  import { resolveSitePath } from "nuxt-site-config/urls";
4
4
  import { joinURL, withHttps } from "ufo";
5
5
  import staticConfig from "#sitemap-virtual/static-config.mjs";
6
- import { applyDynamicParams, createPathFilter, findPageMapping, logger, splitForLocales } from "../../../utils-pure.js";
6
+ import { applyDynamicParams, createPathFilter, findPageMapping, logger, resolveI18nSitemapLocaleKey, splitForLocales } from "../../../utils-pure.js";
7
7
  import { preNormalizeEntry } from "../urlset/normalise.js";
8
8
  import { sortInPlace } from "../urlset/sort.js";
9
9
  import { childSitemapSources, globalSitemapSources, resolveSitemapSources } from "../urlset/sources.js";
@@ -189,11 +189,12 @@ export async function buildResolvedSitemapUrls(effectiveSitemap, matchName, isCh
189
189
  };
190
190
  await nitro?.hooks.callHook("sitemap:input", resolvedCtx);
191
191
  const enhancedUrls = resolveSitemapEntries(effectiveSitemap, resolvedCtx.urls, { autoI18n, isI18nMapped }, resolvers, useRuntimeConfig().app.baseURL);
192
+ const localeSitemapKeys = isI18nMapped && autoI18n ? autoI18n.locales.map((l) => l._sitemap) : [];
192
193
  if (isMultiSitemap) {
193
194
  const sitemapNames = Object.keys(sitemaps).filter((k) => k !== "index");
194
195
  const warnedSitemaps = nitro?._sitemapWarnedSitemaps || /* @__PURE__ */ new Set();
195
196
  for (const e of enhancedUrls) {
196
- const hasMatchingSitemap = typeof e._sitemap === "string" && (sitemapNames.includes(e._sitemap) || isI18nMapped && sitemapNames.some((name) => name.startsWith(`${e._sitemap}-`)));
197
+ const hasMatchingSitemap = typeof e._sitemap === "string" && (sitemapNames.includes(e._sitemap) || isI18nMapped && sitemapNames.some((name) => resolveI18nSitemapLocaleKey(name, localeSitemapKeys) === e._sitemap));
197
198
  if (typeof e._sitemap === "string" && !hasMatchingSitemap) {
198
199
  if (!warnedSitemaps.has(e._sitemap)) {
199
200
  warnedSitemaps.add(e._sitemap);
@@ -211,7 +212,11 @@ export async function buildResolvedSitemapUrls(effectiveSitemap, matchName, isCh
211
212
  if (isMultiSitemap && e._sitemap && matchName) {
212
213
  if (isChunked)
213
214
  return e._sitemap === matchName;
214
- return e._sitemap === matchName || isI18nMapped && matchName.startsWith(`${e._sitemap}-`);
215
+ if (e._sitemap === matchName)
216
+ return true;
217
+ if (isI18nMapped)
218
+ return e._sitemap === resolveI18nSitemapLocaleKey(matchName, localeSitemapKeys);
219
+ return false;
215
220
  }
216
221
  return true;
217
222
  });
@@ -3,6 +3,16 @@ export { createFilter, type CreateFilterOptions } from 'nuxtseo-shared/utils';
3
3
  export declare const logger: import("consola").ConsolaInstance;
4
4
  export declare function mergeOnKey<T, K extends keyof T>(arr: T[], key: K): T[];
5
5
  export declare function splitForLocales(path: string, locales: string[]): [string | null, string];
6
+ /**
7
+ * Resolve which locale a multi-sitemap name belongs to.
8
+ *
9
+ * i18n-mapped sitemaps are named either `<localeSitemap>` (default) or
10
+ * `<localeSitemap>-<name>` (custom sitemaps). Locale `_sitemap` keys can share a
11
+ * prefix (e.g. `zh` and `zh-Hant`), so a naive `name.startsWith(`${key}-`)` check
12
+ * collides: `zh-Hant` would match the `zh` locale. Resolve by the longest matching
13
+ * key to disambiguate.
14
+ */
15
+ export declare function resolveI18nSitemapLocaleKey(sitemapName: string, localeSitemapKeys: string[]): string | null;
6
16
  /**
7
17
  * Transform a literal notation string regex to RegExp
8
18
  */
@@ -36,6 +36,16 @@ export function splitForLocales(path, locales) {
36
36
  return [prefix, path.replace(`/${prefix}`, "")];
37
37
  return [null, path];
38
38
  }
39
+ export function resolveI18nSitemapLocaleKey(sitemapName, localeSitemapKeys) {
40
+ let best = null;
41
+ for (const key of localeSitemapKeys) {
42
+ if (sitemapName === key || sitemapName.startsWith(`${key}-`)) {
43
+ if (best === null || key.length > best.length)
44
+ best = key;
45
+ }
46
+ }
47
+ return best;
48
+ }
39
49
  const StringifiedRegExpPattern = /\/(.*?)\/([gimsuy]*)$/;
40
50
  export function normalizeRuntimeFilters(input) {
41
51
  return (input || []).map((rule) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nuxtjs/sitemap",
3
3
  "type": "module",
4
- "version": "8.0.15",
4
+ "version": "8.2.0",
5
5
  "description": "Powerfully flexible XML Sitemaps that integrate seamlessly, for Nuxt.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",
@@ -55,12 +55,12 @@
55
55
  }
56
56
  },
57
57
  "dependencies": {
58
- "@nuxt/kit": "^4.4.4",
58
+ "@nuxt/kit": "^4.4.8",
59
59
  "consola": "^3.4.2",
60
60
  "defu": "^6.1.7",
61
- "fast-xml-parser": "^5.7.2",
61
+ "fast-xml-parser": "^5.8.0",
62
62
  "nuxt-site-config": "^4.0.8",
63
- "nuxtseo-shared": "^5.1.3",
63
+ "nuxtseo-shared": "^5.2.6",
64
64
  "ofetch": "^1.5.1",
65
65
  "pathe": "^2.0.3",
66
66
  "pkg-types": "^2.3.1",
@@ -69,44 +69,44 @@
69
69
  "ultrahtml": "^1.6.0"
70
70
  },
71
71
  "devDependencies": {
72
- "@antfu/eslint-config": "^8.2.0",
73
- "@arethetypeswrong/cli": "^0.18.2",
74
- "@nuxt/content": "^3.13.0",
72
+ "@antfu/eslint-config": "^9.0.0",
73
+ "@arethetypeswrong/cli": "^0.18.3",
74
+ "@nuxt/content": "^3.14.0",
75
75
  "@nuxt/devtools-kit": "4.0.0-alpha.3",
76
76
  "@nuxt/module-builder": "^1.0.2",
77
77
  "@nuxt/test-utils": "^4.0.3",
78
- "@nuxt/ui": "^4.7.1",
79
- "@nuxtjs/i18n": "^10.3.0",
80
- "@nuxtjs/robots": "^6.0.8",
81
- "@vue/test-utils": "^2.4.10",
82
- "better-sqlite3": "^12.9.0",
83
- "bumpp": "^11.0.1",
84
- "eslint": "^10.2.1",
85
- "eslint-plugin-harlanzw": "^0.12.1",
78
+ "@nuxt/ui": "^4.8.2",
79
+ "@nuxtjs/i18n": "^10.4.0",
80
+ "@nuxtjs/robots": "^6.0.9",
81
+ "@vue/test-utils": "^2.4.11",
82
+ "better-sqlite3": "^12.10.0",
83
+ "bumpp": "^11.1.0",
84
+ "eslint": "^10.4.1",
85
+ "eslint-plugin-harlanzw": "^0.17.0",
86
86
  "execa": "^9.6.1",
87
- "happy-dom": "^20.9.0",
88
- "nuxt": "^4.4.4",
89
- "nuxt-i18n-micro": "^3.17.5",
90
- "nuxtseo-layer-devtools": "^5.1.3",
91
- "semver": "^7.7.4",
87
+ "happy-dom": "^20.10.2",
88
+ "nuxt": "^4.4.8",
89
+ "nuxt-i18n-micro": "^3.18.2",
90
+ "nuxtseo-layer-devtools": "^5.2.6",
91
+ "semver": "^7.8.4",
92
92
  "sirv": "^3.0.2",
93
93
  "std-env": "^4.1.0",
94
94
  "typescript": "^6.0.3",
95
- "vitest": "^4.1.5",
96
- "vue-tsc": "^3.2.7",
97
- "zod": "^4.4.1",
98
- "@nuxtjs/sitemap": "8.0.15"
95
+ "unbuild": "^3.6.1",
96
+ "vitest": "^4.1.8",
97
+ "vue-tsc": "^3.3.4",
98
+ "zod": "^4.4.3",
99
+ "@nuxtjs/sitemap": "8.2.0"
99
100
  },
100
101
  "scripts": {
101
102
  "lint": "eslint .",
102
103
  "lint:fix": "eslint . --fix",
103
- "client:build": "nuxt generate devtools",
104
- "devtools": "nuxt dev devtools --port 3030",
104
+ "client:build": "node -e \"require('fs').cpSync('devtools','dist/devtools',{recursive:true})\"",
105
105
  "build": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt-module-build build && npm run client:build",
106
106
  "dev": "nuxt dev playground",
107
107
  "prepare:fixtures": "nuxt prepare test/fixtures/basic && nuxt prepare test/fixtures/i18n && nuxt prepare test/fixtures/i18n-micro",
108
108
  "dev:build": "nuxt build playground",
109
- "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare playground",
109
+ "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare playground && pnpm run client:build",
110
110
  "release": "pnpm build && bumpp -x \"npx changelogen --output=CHANGELOG.md\"",
111
111
  "test": "vitest run && pnpm run test:attw",
112
112
  "test:unit": "vitest --project=unit",
@@ -1 +0,0 @@
1
- <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><script type="importmap">{"imports":{"#entry":"/__nuxt-sitemap/_nuxt/CnYZ0nz4.js"}}</script><link rel="stylesheet" href="/__nuxt-sitemap/_nuxt/entry.l1zFHB5e.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-sitemap/_nuxt/CnYZ0nz4.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-sitemap/_nuxt/tBStlNYu.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-sitemap/_nuxt/h7zQ0TxP.js"><script type="module" src="/__nuxt-sitemap/_nuxt/CnYZ0nz4.js" crossorigin></script><script>"use strict";(()=>{const t=window,e=document.documentElement,c=["dark","light"],n=getStorageValue("localStorage","nuxt-color-mode")||"system";let i=n==="system"?u():n;const r=e.getAttribute("data-color-mode-forced");r&&(i=r),l(i),t["__NUXT_COLOR_MODE__"]={preference:n,value:i,getColorScheme:u,addColorScheme:l,removeColorScheme:d};function l(o){const s=""+o+"",a="";e.classList?e.classList.add(s):e.className+=" "+s,a&&e.setAttribute("data-"+a,o)}function d(o){const s=""+o+"",a="";e.classList?e.classList.remove(s):e.className=e.className.replace(new RegExp(s,"g"),""),a&&e.removeAttribute("data-"+a)}function f(o){return t.matchMedia("(prefers-color-scheme"+o+")")}function u(){if(t.matchMedia&&f("").media!=="not all"){for(const o of c)if(f(":"+o).matches)return o}return"light"}})();function getStorageValue(t,e){switch(t){case"localStorage":return window.localStorage.getItem(e);case"sessionStorage":return window.sessionStorage.getItem(e);case"cookie":return getCookie(e);default:return null}}function getCookie(t){const c=("; "+window.document.cookie).split("; "+t+"=");if(c.length===2)return c.pop()?.split(";").shift()}</script></head><body><div id="__nuxt" class="isolate"></div><div id="teleports"></div><script>window.__NUXT_SITE_CONFIG__={_priority:{env:-15},env:"production"}</script><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-sitemap",buildId:"6a13e94e-54b2-4e42-b5dc-6941d3a319d9",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1777603829439,false]</script></body></html>
@@ -1 +0,0 @@
1
- <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><script type="importmap">{"imports":{"#entry":"/__nuxt-sitemap/_nuxt/CnYZ0nz4.js"}}</script><link rel="stylesheet" href="/__nuxt-sitemap/_nuxt/entry.l1zFHB5e.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-sitemap/_nuxt/CnYZ0nz4.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-sitemap/_nuxt/tBStlNYu.js"><link rel="modulepreload" as="script" crossorigin href="/__nuxt-sitemap/_nuxt/h7zQ0TxP.js"><script type="module" src="/__nuxt-sitemap/_nuxt/CnYZ0nz4.js" crossorigin></script><script>"use strict";(()=>{const t=window,e=document.documentElement,c=["dark","light"],n=getStorageValue("localStorage","nuxt-color-mode")||"system";let i=n==="system"?u():n;const r=e.getAttribute("data-color-mode-forced");r&&(i=r),l(i),t["__NUXT_COLOR_MODE__"]={preference:n,value:i,getColorScheme:u,addColorScheme:l,removeColorScheme:d};function l(o){const s=""+o+"",a="";e.classList?e.classList.add(s):e.className+=" "+s,a&&e.setAttribute("data-"+a,o)}function d(o){const s=""+o+"",a="";e.classList?e.classList.remove(s):e.className=e.className.replace(new RegExp(s,"g"),""),a&&e.removeAttribute("data-"+a)}function f(o){return t.matchMedia("(prefers-color-scheme"+o+")")}function u(){if(t.matchMedia&&f("").media!=="not all"){for(const o of c)if(f(":"+o).matches)return o}return"light"}})();function getStorageValue(t,e){switch(t){case"localStorage":return window.localStorage.getItem(e);case"sessionStorage":return window.sessionStorage.getItem(e);case"cookie":return getCookie(e);default:return null}}function getCookie(t){const c=("; "+window.document.cookie).split("; "+t+"=");if(c.length===2)return c.pop()?.split(";").shift()}</script></head><body><div id="__nuxt" class="isolate"></div><div id="teleports"></div><script>window.__NUXT_SITE_CONFIG__={_priority:{env:-15},env:"production"}</script><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-sitemap",buildId:"6a13e94e-54b2-4e42-b5dc-6941d3a319d9",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1777603829439,false]</script></body></html>
@@ -1 +0,0 @@
1
- import{C as e,Et as t,V as n,W as r,_ as i,b as a,g as o,h as s,kt as c,l,m as u,rt as d,v as f,x as p}from"./h7zQ0TxP.js";import{t as m}from"./tBStlNYu.js";import{c as h,i as g,n as _,s as v,v as y}from"#entry";import{t as b}from"./h6WhJoib.js";var x={class:`devtools-metric-value`},S={key:1,class:`devtools-metric-label`},C=Object.assign(m(e({__name:`DevtoolsMetric`,props:{label:{},value:{},icon:{},variant:{default:`default`}},setup(e){return(r,a)=>{let l=v;return n(),f(`div`,{class:t([`devtools-metric`,`devtools-metric-${e.variant}`])},[e.icon?(n(),o(l,{key:0,name:e.icon,class:`devtools-metric-icon`,"aria-hidden":`true`},null,8,[`name`])):i(``,!0),s(`span`,x,c(e.value),1),e.label?(n(),f(`span`,S,c(e.label),1)):i(``,!0)],2)}}}),[[`__scopeId`,`data-v-5d664574`]]),{__name:`DevtoolsMetric`}),w={class:`flex items-center gap-3`},T={key:0,class:`flex items-center gap-1.5`},E={class:`font-semibold`},D={class:`flex items-center gap-3`},O=[`href`],k={key:1,class:`text-xs text-[var(--color-text-muted)]`},A={class:`text-xs font-semibold mb-1`},j={class:`url-warnings-list`},M={class:`space-y-1`},N=[`innerHTML`],P=Object.assign(m(e({__name:`Source`,props:{source:{},showContext:{type:Boolean}},setup(e){let m=e,x=u(()=>{let e=typeof m.source.fetch==`string`?m.source.fetch:m.source.fetch[0];return e.includes(`http`)?e:y(h.value?.nitroOrigin||`localhost`,e)});function S(e){return e.replace(/`([^`]+)`/g,`<code>$1</code>`)}return(u,m)=>{let h=v,y=C,P=g,F=b,I=_;return n(),o(I,{class:t(e.source.error?`source-error`:``)},{text:d(()=>[s(`div`,w,[e.source.fetch?(n(),f(`div`,T,[p(h,{name:`carbon:api-1`,class:`text-[var(--color-text-muted)]`}),e.source.timeTakenMs?(n(),o(y,{key:0,value:e.source.timeTakenMs,label:`ms`,variant:`info`},null,8,[`value`])):i(``,!0)])):i(``,!0),s(`span`,E,c(e.source.context.name),1),p(y,{value:e.source.urls?.length||0,label:`URLs`,variant:e.source.error?`danger`:e.source.urls?.length?`success`:`warning`},null,8,[`value`,`variant`])])]),description:d(()=>[s(`div`,D,[e.source.fetch?(n(),f(`a`,{key:0,href:x.value,target:`_blank`,class:`link-external text-sm`},c(e.source.fetch),9,O)):i(``,!0),e.source.context.description?(n(),f(`span`,k,c(e.source.context.description),1)):i(``,!0)])]),default:d(()=>[e.source.error?(n(),o(P,{key:0,variant:`error`},{default:d(()=>[a(c(e.source.error),1)]),_:1})):(n(),f(l,{key:1},[e.source._urlWarnings?.length?(n(),o(P,{key:0,variant:`warning`},{default:d(()=>[s(`div`,null,[s(`div`,A,c(e.source._urlWarnings.length)+` URL warning`+c(e.source._urlWarnings.length>1?`s`:``),1),s(`ul`,j,[(n(!0),f(l,null,r(e.source._urlWarnings,(e,t)=>(n(),f(`li`,{key:t},[s(`code`,null,c(e.loc),1),a(` — `+c(e.message),1)]))),128))])])]),_:1})):i(``,!0),p(F,{code:JSON.stringify(e.source.urls,null,2),lang:`json`,label:`URLs`},null,8,[`code`])],64)),e.source.context.tips?.length?(n(),o(P,{key:2,variant:!e.source.urls?.length&&!e.source.error?`warning`:`info`},{default:d(()=>[s(`div`,null,[m[0]||=s(`h3`,{class:`text-xs font-semibold mb-1.5 text-[var(--color-text)] uppercase tracking-wide opacity-70`},` Hints `,-1),s(`ul`,M,[(n(!0),f(l,null,r(e.source.context.tips,(e,t)=>(n(),f(`li`,{key:t,class:`text-sm text-[var(--color-text-muted)] leading-relaxed`,innerHTML:S(e)},null,8,N))),128))])])]),_:1},8,[`variant`])):i(``,!0)]),_:1},8,[`class`])}}}),[[`__scopeId`,`data-v-ca804ac3`]]),{__name:`Source`});export{C as n,P as t};
@@ -1 +0,0 @@
1
- import{C as e,Ct as t,Et as n,G as r,V as i,W as a,_ as o,b as s,g as c,h as l,kt as u,l as d,m as f,rt as p,v as m,x as h}from"./h7zQ0TxP.js";import{t as g}from"./tBStlNYu.js";import{a as _,c as v,d as y,f as b,g as x,h as S,i as C,l as w,m as T,n as E,p as D,r as ee,s as O,u as k,v as A}from"#entry";import{n as j,t as M}from"./6e7EVM9D.js";import{n as N,t as P}from"./h6WhJoib.js";var F={class:`divide-y divide-[var(--color-border-subtle)]`},I={class:`devtools-kv-key`},L=[`href`],R=[`href`],te=Object.assign(g(e({__name:`DevtoolsKeyValue`,props:{items:{},striped:{type:Boolean,default:!1}},setup(e){let t=/^https?:\/\/\S+$/;function r(e){return!e.link&&!e.code&&typeof e.value==`string`&&t.test(e.value)}return(t,s)=>{let f=P,p=N;return i(),m(`div`,F,[(i(!0),m(d,null,a(e.items,t=>(i(),m(`div`,{key:t.key,class:n([`devtools-kv-row group`,{"devtools-kv-striped":e.striped,"devtools-kv-stacked":!!t.code}])},[l(`span`,I,u(t.key),1),l(`div`,{class:n([`devtools-kv-value-wrap`,{"devtools-kv-value-wrap-full":!!t.code}])},[t.link?(i(),m(`a`,{key:0,href:t.link,target:`_blank`,rel:`noopener`,class:`link-external text-sm`},u(t.value),9,L)):t.code&&t.value!==void 0&&t.value!==``?(i(),c(f,{key:1,code:String(t.value),lang:t.code,class:`devtools-kv-snippet`},null,8,[`code`,`lang`])):r(t)?(i(),m(`a`,{key:2,href:String(t.value),target:`_blank`,rel:`noopener`,class:`link-external text-sm`},u(t.value),9,R)):(i(),m(`span`,{key:3,class:n([`devtools-kv-value`,{"font-mono":t.mono!==!1,"devtools-kv-true":t.value===!0,"devtools-kv-false":t.value===!1,"devtools-kv-empty":t.value===void 0||t.value===``}])},u(t.value===void 0||t.value===``?`(empty)`:t.value),3)),!t.code&&t.copyable&&t.value!==void 0&&t.value!==``?(i(),c(p,{key:4,text:String(t.value),class:`opacity-0 group-hover:opacity-100 transition-opacity`},null,8,[`text`])):o(``,!0)],2)],2))),128))])}}}),[[`__scopeId`,`data-v-91d67b76`]]),{__name:`DevtoolsKeyValue`}),z={class:`devtools-error`},B={class:`devtools-error-icon-wrap`},V={class:`devtools-error-title`},H={key:0,class:`devtools-error-message`},U={key:1,class:`devtools-error-actions`},W=Object.assign(g(e({__name:`DevtoolsError`,props:{icon:{default:`carbon:warning`},title:{default:`Something went wrong`},error:{}},setup(e){return(t,n)=>{let a=O;return i(),m(`div`,z,[l(`div`,B,[h(a,{name:e.icon,class:`devtools-error-icon`},null,8,[`name`])]),l(`p`,V,u(e.title),1),e.error?(i(),m(`p`,H,u(typeof e.error==`string`?e.error:e.error.message),1)):o(``,!0),t.$slots.default?(i(),m(`div`,U,[r(t.$slots,`default`,{},void 0,!0)])):o(``,!0)])}}}),[[`__scopeId`,`data-v-5a6fccb8`]]),{__name:`DevtoolsError`}),G={key:0,class:`text-xs text-[var(--color-text-muted)] max-w-xs leading-relaxed`},K={class:`prod-url`},q=Object.assign(g(e({__name:`DevtoolsProductionError`,props:{error:{}},setup(e){return(n,r)=>{let a=_,d=W;return i(),c(d,{icon:`carbon:cloud-offline`,title:`Production site unreachable`,error:e.error},{default:p(()=>[e.error?o(``,!0):(i(),m(`p`,G,[r[1]||=s(` Could not connect to `,-1),l(`code`,K,u(t(x)),1),r[2]||=s(`. Check that the site is deployed and accessible. `,-1)])),h(a,{variant:`soft`,size:`xs`,icon:`carbon:laptop`,onClick:r[0]||=e=>S.value=`local`},{default:p(()=>[...r[3]||=[s(` Switch to local `,-1)]]),_:1})]),_:1},8,[`error`])}}}),[[`__scopeId`,`data-v-d8bdd617`]]),{__name:`DevtoolsProductionError`}),J={class:`space-y-5 animate-fade-up`},Y={class:`flex items-center justify-between`},X={class:`text-xs text-[var(--color-text-muted)]`},Z={class:`flex items-center gap-2`},Q={class:`font-semibold`},ne=[`href`],re={class:`space-y-5`},ie={key:0,class:`flex gap-4`},ae={class:`flex-grow space-y-2`},oe={class:`flex gap-4`},se={class:`flex-grow`},ce={class:`flex items-center gap-4`},le={class:`flex items-center gap-2`},ue={class:`font-semibold`},de=[`href`],fe={key:0,class:`space-y-3`},pe={class:`text-xs font-semibold mb-1`},me={class:`prod-warnings-list`},he={class:`flex items-center gap-2`},ge={class:`font-semibold`},_e=[`href`],ve={class:`space-y-5`},ye={key:0,class:`flex gap-4`},be={class:`flex-grow space-y-2`},$={class:`flex gap-4`},xe={class:`flex-grow flex items-center gap-3`},Se={key:0,class:`status-enabled`},Ce={key:1,class:`status-disabled`},we={class:`flex gap-4`},Te={class:`flex-grow`},Ee=g(e({__name:`index`,setup(e){let n=f(()=>v.value?.runtimeConfig?.excludeAppSources||[]);function r(){return T.value&&x.value?`${x.value.replace(/\/$/,``)}/`:v.value?.nitroOrigin||``}function g(e){let t=y.value||v.value;if(!t)return``;let n=t.runtimeConfig?.sitemapsPathPrefix||``;return e===`sitemap`||e===`sitemap.xml`?`/sitemap.xml`:e===`index`?`/sitemap_index.xml`:A(`/`,n,`${e}-sitemap.xml`)}function S(e){return`${r()}${g(e).replace(/^\//,``)}`}function N(e){let t={};return Object.entries(e).forEach(([e,n])=>{n!==void 0&&(!Array.isArray(n)||n.length>0)&&e!==`includeAppSources`&&(t[e]=n)}),t}function P(e){let t=N(e);return Object.entries(t).map(([e,t])=>{let n=typeof t==`object`;return{key:e,value:n?JSON.stringify(t,null,2):t,mono:!0,code:n?`json`:void 0}})}function F(e){try{return new URL(e).pathname}catch{return e}}let I=f(()=>!!y.value),L=f(()=>w.value?.sitemaps.reduce((e,t)=>e+t.urlCount,0)??0),R=f(()=>w.value?.sitemaps.reduce((e,t)=>e+t.warnings.length,0)??0);return(e,r)=>{let f=_,A=ee,N=O,z=C,B=te,V=E,H=q,U=j,W=D;return i(),m(`div`,J,[t(T)?(i(),m(d,{key:0},[l(`div`,Y,[l(`div`,null,[r[2]||=l(`h2`,{class:`text-lg font-semibold mb-1`},` Production Sitemaps `,-1),l(`p`,X,[s(` Fetched from `+u(t(x)),1),I.value?(i(),m(d,{key:0},[s(` with debug mode enabled `)],64)):o(``,!0),r[1]||=s(`. `,-1)])]),h(f,{icon:`carbon:reset`,size:`xs`,variant:`ghost`,loading:t(k),onClick:r[0]||=e=>t(b)()},{default:p(()=>[...r[3]||=[s(` Re-validate `,-1)]]),_:1},8,[`loading`])]),t(k)&&!t(w)&&!t(y)?(i(),c(A,{key:0})):o(``,!0),I.value?(i(!0),m(d,{key:1},a(t(y).sitemaps,(e,t)=>(i(),c(V,{key:t},{text:p(()=>[l(`div`,Z,[l(`span`,Q,u(e.sitemapName),1),l(`a`,{target:`_blank`,href:S(e.sitemapName),class:`link-external text-xs font-mono text-[var(--color-text-muted)]`},u(g(e.sitemapName)),9,ne),(e.sources||[]).some(e=>typeof e!=`string`&&`error`in e&&!!e.error)?(i(),c(N,{key:0,name:`carbon:warning`,class:`text-red-500`})):(e.sources||[]).some(e=>typeof e!=`string`&&`_urlWarnings`in e&&e._urlWarnings?.length)?(i(),c(N,{key:1,name:`carbon:warning-alt`,class:`text-amber-500`})):o(``,!0)])]),default:p(()=>[l(`div`,re,[e.sitemapName===`index`?(i(),c(z,{key:0,variant:`info`},{default:p(()=>[...r[4]||=[s(` Links to your other sitemaps. `,-1),l(`a`,{href:`https://developers.google.com/search/docs/crawling-indexing/sitemaps/large-sitemaps`,target:`_blank`,class:`link-external`},` Learn more `,-1)]]),_:1})):(i(),m(d,{key:1},[e.sources&&e.sources.length?(i(),m(`div`,ie,[r[5]||=l(`div`,{class:`w-32 flex-shrink-0`},[l(`div`,{class:`font-semibold text-sm`},` Sources `)],-1),l(`div`,ae,[(i(!0),m(d,null,a(e.sources,(e,t)=>(i(),c(M,{key:t,source:e},null,8,[`source`]))),128))])])):o(``,!0),l(`div`,oe,[r[6]||=l(`div`,{class:`w-32 flex-shrink-0`},[l(`div`,{class:`font-semibold text-sm`},` Options `)],-1),l(`div`,se,[h(B,{items:P(e),striped:``},null,8,[`items`])])])],64))])]),_:2},1024))),128)):t(w)?.error?(i(),c(H,{key:2,error:t(w).error},null,8,[`error`])):t(w)?(i(),m(d,{key:3},[l(`div`,ce,[h(U,{value:t(w).sitemaps.length,label:t(w).isIndex?`child sitemaps`:`sitemap`,variant:`info`},null,8,[`value`,`label`]),h(U,{value:L.value,label:`total URLs`,variant:`success`},null,8,[`value`]),R.value>0?(i(),c(U,{key:0,value:R.value,label:`warnings`,variant:`warning`},null,8,[`value`])):o(``,!0)]),(i(!0),m(d,null,a(t(w).sitemaps,(e,t)=>(i(),c(V,{key:t},{text:p(()=>[l(`div`,le,[l(`span`,ue,u(F(e.loc)),1),h(U,{value:e.urlCount,label:`URLs`,variant:`success`},null,8,[`value`]),e.error?(i(),c(N,{key:0,name:`carbon:warning`,class:`text-red-500`})):e.warnings.length?(i(),c(N,{key:1,name:`carbon:warning-alt`,class:`text-amber-500`})):o(``,!0)])]),description:p(()=>[l(`a`,{href:e.loc,target:`_blank`,class:`link-external text-xs font-mono text-[var(--color-text-muted)]`},u(e.loc),9,de)]),default:p(()=>[e.error||e.warnings.length?(i(),m(`div`,fe,[e.error?(i(),c(z,{key:0,variant:`warning`},{default:p(()=>[s(u(e.error),1)]),_:2},1024)):o(``,!0),e.warnings.length?(i(),c(z,{key:1,variant:`warning`},{default:p(()=>[l(`div`,null,[l(`div`,pe,u(e.warnings.length)+` validation warning`+u(e.warnings.length>1?`s`:``),1),l(`ul`,me,[(i(!0),m(d,null,a(e.warnings,(e,t)=>(i(),m(`li`,{key:t},[e.context?.url?(i(),m(d,{key:0},[l(`code`,null,u(e.context.url),1),r[7]||=s(`: `,-1)],64)):o(``,!0),s(` `+u(e.message),1)]))),128))])])]),_:2},1024)):o(``,!0)])):o(``,!0)]),_:2},1024))),128)),h(z,{variant:`info`},{default:p(()=>[...r[8]||=[s(` Want to see full source details and URL validation? Deploy with `,-1),l(`code`,null,`sitemap: { debug: true }`,-1),s(` to get the same detailed view as development mode. `,-1)]]),_:1})],64)):o(``,!0)],64)):(i(),m(d,{key:1},[r[16]||=l(`div`,null,[l(`h2`,{class:`text-lg font-semibold mb-1`},` Sitemaps `),l(`p`,{class:`text-xs text-[var(--color-text-muted)]`},` The sitemaps generated from your site. `)],-1),(i(!0),m(d,null,a(t(v)?.sitemaps,(e,t)=>(i(),c(V,{key:t},{text:p(()=>[l(`div`,he,[l(`span`,ge,u(e.sitemapName),1),l(`a`,{target:`_blank`,href:S(e.sitemapName),class:`link-external text-xs font-mono text-[var(--color-text-muted)]`},u(g(e.sitemapName)),9,_e),(e.sources||[]).some(e=>typeof e!=`string`&&`error`in e&&!!e.error)?(i(),c(N,{key:0,name:`carbon:warning`,class:`text-red-500`})):(e.sources||[]).some(e=>typeof e!=`string`&&`_urlWarnings`in e&&e._urlWarnings?.length)?(i(),c(N,{key:1,name:`carbon:warning-alt`,class:`text-amber-500`})):o(``,!0)])]),default:p(()=>[l(`div`,ve,[e.sitemapName===`index`?(i(),c(z,{key:0,variant:`info`},{default:p(()=>[...r[9]||=[s(` Links to your other sitemaps. `,-1),l(`a`,{href:`https://developers.google.com/search/docs/crawling-indexing/sitemaps/large-sitemaps`,target:`_blank`,class:`link-external`},` Learn more `,-1)]]),_:1})):(i(),m(d,{key:1},[e.sources&&e.sources.length?(i(),m(`div`,ye,[r[10]||=l(`div`,{class:`w-32 flex-shrink-0`},[l(`div`,{class:`font-semibold text-sm`},` Sources `)],-1),l(`div`,be,[(i(!0),m(d,null,a(e.sources,(e,t)=>(i(),c(M,{key:t,source:e},null,8,[`source`]))),128))])])):o(``,!0),l(`div`,$,[r[14]||=l(`div`,{class:`w-32 flex-shrink-0`},[l(`div`,{class:`font-semibold text-sm`},` App Sources `)],-1),l(`div`,xe,[e.includeAppSources&&n.value!==!0?(i(),m(`div`,Se,[h(N,{name:`carbon:checkmark`,class:`text-sm`}),r[11]||=l(`span`,null,`Enabled`,-1)])):(i(),m(`div`,Ce,[h(N,{name:`carbon:close`,class:`text-sm`}),r[12]||=l(`span`,null,`Disabled`,-1)])),h(W,{to:`/app-sources`,class:`text-xs text-[var(--seo-green)] hover:underline`},{default:p(()=>[...r[13]||=[s(` View details `,-1)]]),_:1})])]),l(`div`,we,[r[15]||=l(`div`,{class:`w-32 flex-shrink-0`},[l(`div`,{class:`font-semibold text-sm`},` Options `)],-1),l(`div`,Te,[h(B,{items:P(e),striped:``},null,8,[`items`])])])],64))])]),_:2},1024))),128))],64))])}}}),[[`__scopeId`,`data-v-894e99b6`]]);export{Ee as default};
@@ -1 +0,0 @@
1
- import{C as e,Ct as t,V as n,b as r,h as i,rt as a,v as o,x as s}from"./h7zQ0TxP.js";import{c,n as l,s as u}from"#entry";import{t as d}from"./h6WhJoib.js";var f={class:`space-y-5 animate-fade-up`},p={class:`opacity-80 text-base mb-1`},m=e({__name:`debug`,setup(e){return(e,m)=>{let h=u,g=d,_=l;return n(),o(`div`,f,[s(_,null,{text:a(()=>[i(`h3`,p,[s(h,{name:`carbon:settings`,class:`mr-1`}),m[0]||=r(` Runtime Config `,-1)])]),default:a(()=>[s(g,{code:JSON.stringify(t(c)?.runtimeConfig,null,2),lang:`json`,label:`Runtime Config`},null,8,[`code`])]),_:1})])}}});export{m as default};