@nuxtjs/sitemap 7.4.9 → 7.4.10

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 (30) hide show
  1. package/dist/client/200.html +1 -1
  2. package/dist/client/404.html +1 -1
  3. package/dist/client/_nuxt/{SKYDSeR3.js → CjT5ejtq.js} +1 -1
  4. package/dist/client/_nuxt/{QpeyiL4d.js → DBmpb9dG.js} +1 -1
  5. package/dist/client/_nuxt/{Cu_iTDKX.js → FE81ed4p.js} +14 -16
  6. package/dist/client/_nuxt/builds/latest.json +1 -1
  7. package/dist/client/_nuxt/builds/meta/698c1660-7b4c-4db3-a9a5-6c0e6240b3a7.json +1 -0
  8. package/dist/client/_nuxt/error-404.DC9fsYfS.css +1 -0
  9. package/dist/client/_nuxt/error-500.DPVweS-0.css +1 -0
  10. package/dist/client/index.html +1 -1
  11. package/dist/client/sitemap.xml +1 -1
  12. package/dist/module.json +1 -1
  13. package/dist/module.mjs +25 -19
  14. package/dist/runtime/server/plugins/nuxt-content-v2.js +6 -7
  15. package/dist/runtime/server/routes/__sitemap__/debug.js +3 -2
  16. package/dist/runtime/server/routes/__sitemap__/nuxt-content-urls-v2.d.ts +1 -1
  17. package/dist/runtime/server/routes/__sitemap__/nuxt-content-urls-v3.d.ts +3 -1
  18. package/dist/runtime/server/routes/__sitemap__/nuxt-content-urls-v3.js +7 -6
  19. package/dist/runtime/server/routes/sitemap/[sitemap].xml.js +1 -1
  20. package/dist/runtime/server/sitemap/builder/sitemap.js +63 -73
  21. package/dist/runtime/server/sitemap/builder/xml.js +81 -169
  22. package/dist/runtime/server/sitemap/nitro.js +4 -3
  23. package/dist/runtime/server/sitemap/urlset/normalise.js +29 -26
  24. package/dist/runtime/types.d.ts +7 -1
  25. package/dist/runtime/utils-pure.js +1 -1
  26. package/dist/utils.mjs +1 -2
  27. package/package.json +14 -14
  28. package/dist/client/_nuxt/builds/meta/bafd23ec-aaa0-4756-a4c4-11462568906c.json +0 -1
  29. package/dist/client/_nuxt/error-404.CqOOUcXJ.css +0 -1
  30. package/dist/client/_nuxt/error-500.jRvomCfk.css +0 -1
@@ -1 +1 @@
1
- {"id":"bafd23ec-aaa0-4756-a4c4-11462568906c","timestamp":1765075641425}
1
+ {"id":"698c1660-7b4c-4db3-a9a5-6c0e6240b3a7","timestamp":1765851593006}
@@ -0,0 +1 @@
1
+ {"id":"698c1660-7b4c-4db3-a9a5-6c0e6240b3a7","timestamp":1765851593006,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
@@ -0,0 +1 @@
1
+ .grid[data-v-a1a1b88d]{display:grid}.mb-2[data-v-a1a1b88d]{margin-bottom:.5rem}.mb-4[data-v-a1a1b88d]{margin-bottom:1rem}.max-w-520px[data-v-a1a1b88d]{max-width:520px}.min-h-screen[data-v-a1a1b88d]{min-height:100vh}.w-full[data-v-a1a1b88d]{width:100%}.flex[data-v-a1a1b88d]{display:flex}.place-content-center[data-v-a1a1b88d]{place-content:center}.items-center[data-v-a1a1b88d]{align-items:center}.justify-center[data-v-a1a1b88d]{justify-content:center}.overflow-hidden[data-v-a1a1b88d]{overflow:hidden}.bg-white[data-v-a1a1b88d]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-2[data-v-a1a1b88d]{padding-left:.5rem;padding-right:.5rem}.text-center[data-v-a1a1b88d]{text-align:center}.text-\[80px\][data-v-a1a1b88d]{font-size:80px}.text-2xl[data-v-a1a1b88d]{font-size:1.5rem;line-height:2rem}.text-sm[data-v-a1a1b88d]{font-size:.875rem;line-height:1.25rem}.text-\[\#020420\][data-v-a1a1b88d]{--un-text-opacity:1;color:rgb(2 4 32/var(--un-text-opacity))}.text-\[\#64748B\][data-v-a1a1b88d]{--un-text-opacity:1;color:rgb(100 116 139/var(--un-text-opacity))}.hover\:text-\[\#00DC82\][data-v-a1a1b88d]:hover{--un-text-opacity:1;color:rgb(0 220 130/var(--un-text-opacity))}.font-medium[data-v-a1a1b88d]{font-weight:500}.font-semibold[data-v-a1a1b88d]{font-weight:600}.leading-none[data-v-a1a1b88d]{line-height:1}.tracking-wide[data-v-a1a1b88d]{letter-spacing:.025em}.font-sans[data-v-a1a1b88d]{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.tabular-nums[data-v-a1a1b88d]{--un-numeric-spacing:tabular-nums;font-variant-numeric:var(--un-ordinal) var(--un-slashed-zero) var(--un-numeric-figure) var(--un-numeric-spacing) var(--un-numeric-fraction)}.underline[data-v-a1a1b88d]{text-decoration-line:underline}.underline-offset-3[data-v-a1a1b88d]{text-underline-offset:3px}.antialiased[data-v-a1a1b88d]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media(prefers-color-scheme:dark){.dark\:bg-\[\#020420\][data-v-a1a1b88d]{--un-bg-opacity:1;background-color:rgb(2 4 32/var(--un-bg-opacity))}.dark\:text-white[data-v-a1a1b88d]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media(min-width:640px){.sm\:text-\[110px\][data-v-a1a1b88d]{font-size:110px}.sm\:text-3xl[data-v-a1a1b88d]{font-size:1.875rem;line-height:2.25rem}}
@@ -0,0 +1 @@
1
+ .grid[data-v-7d8562ed]{display:grid}.mb-2[data-v-7d8562ed]{margin-bottom:.5rem}.mb-4[data-v-7d8562ed]{margin-bottom:1rem}.max-w-520px[data-v-7d8562ed]{max-width:520px}.min-h-screen[data-v-7d8562ed]{min-height:100vh}.place-content-center[data-v-7d8562ed]{place-content:center}.overflow-hidden[data-v-7d8562ed]{overflow:hidden}.bg-white[data-v-7d8562ed]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-2[data-v-7d8562ed]{padding-left:.5rem;padding-right:.5rem}.text-center[data-v-7d8562ed]{text-align:center}.text-\[80px\][data-v-7d8562ed]{font-size:80px}.text-2xl[data-v-7d8562ed]{font-size:1.5rem;line-height:2rem}.text-\[\#020420\][data-v-7d8562ed]{--un-text-opacity:1;color:rgb(2 4 32/var(--un-text-opacity))}.text-\[\#64748B\][data-v-7d8562ed]{--un-text-opacity:1;color:rgb(100 116 139/var(--un-text-opacity))}.font-semibold[data-v-7d8562ed]{font-weight:600}.leading-none[data-v-7d8562ed]{line-height:1}.tracking-wide[data-v-7d8562ed]{letter-spacing:.025em}.font-sans[data-v-7d8562ed]{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.tabular-nums[data-v-7d8562ed]{--un-numeric-spacing:tabular-nums;font-variant-numeric:var(--un-ordinal) var(--un-slashed-zero) var(--un-numeric-figure) var(--un-numeric-spacing) var(--un-numeric-fraction)}.antialiased[data-v-7d8562ed]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media(prefers-color-scheme:dark){.dark\:bg-\[\#020420\][data-v-7d8562ed]{--un-bg-opacity:1;background-color:rgb(2 4 32/var(--un-bg-opacity))}.dark\:text-white[data-v-7d8562ed]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media(min-width:640px){.sm\:text-\[110px\][data-v-7d8562ed]{font-size:110px}.sm\:text-3xl[data-v-7d8562ed]{font-size:1.875rem;line-height:2.25rem}}
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__sitemap__/devtools/_nuxt/entry.Ci1pP-eR.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/Cu_iTDKX.js"><script type="module" src="/__sitemap__/devtools/_nuxt/Cu_iTDKX.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script>window.__NUXT_SITE_CONFIG__={_priority:{name:-10,env:-15},env:"production",name:"@nuxtjs\u002Fsitemap-client"}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1765075647627,false]</script><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__sitemap__/devtools",buildId:"bafd23ec-aaa0-4756-a4c4-11462568906c",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__sitemap__/devtools/_nuxt/entry.Ci1pP-eR.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__sitemap__/devtools/_nuxt/FE81ed4p.js"><script type="module" src="/__sitemap__/devtools/_nuxt/FE81ed4p.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script>window.__NUXT_SITE_CONFIG__={_priority:{name:-10,env:-15},env:"production",name:"@nuxtjs\u002Fsitemap-client"}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1765851599135,false]</script><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__sitemap__/devtools",buildId:"698c1660-7b4c-4db3-a9a5-6c0e6240b3a7",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
@@ -4,4 +4,4 @@
4
4
  <loc>/__sitemap__/devtools</loc>
5
5
  </url>
6
6
  </urlset>
7
- <!-- XML Sitemap generated by @nuxtjs/sitemap v7.4.9 at 2025-12-07T02:47:28.151Z -->
7
+ <!-- XML Sitemap generated by @nuxtjs/sitemap v7.4.10 at 2025-12-16T02:19:59.659Z -->
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "nuxt": ">=3.9.0"
5
5
  },
6
6
  "configKey": "sitemap",
7
- "version": "7.4.9",
7
+ "version": "7.4.10",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -175,11 +175,11 @@ function convertNuxtPagesToSitemapEntries(pages, config) {
175
175
  }).filter(Boolean).flat();
176
176
  }
177
177
  function generateExtraRoutesFromNuxtConfig(nuxt = useNuxt()) {
178
- const filterForValidPage = (p) => p && !extname(p) && !p.startsWith("/api/") && !p.startsWith("/_");
178
+ const filterForValidPage = (p) => typeof p === "string" && !!p && !extname(p) && !p.startsWith("/api/") && !p.startsWith("/_");
179
179
  const routeRules = Object.entries(nuxt.options.routeRules || {}).filter(([k, v]) => {
180
180
  if (k.includes("*") || k.includes(".") || k.includes(":"))
181
181
  return false;
182
- if (typeof v.robots === "boolean" && !v.robots)
182
+ if ("robots" in v && typeof v.robots === "boolean" && !v.robots)
183
183
  return false;
184
184
  return !v.redirect;
185
185
  }).map(([k]) => k).filter(filterForValidPage);
@@ -404,14 +404,20 @@ function setupDevToolsUI(options, resolve, nuxt = useNuxt()) {
404
404
  });
405
405
  } else {
406
406
  nuxt.hook("vite:extendConfig", (config) => {
407
- config.server = config.server || {};
408
- config.server.proxy = config.server.proxy || {};
409
- config.server.proxy[DEVTOOLS_UI_ROUTE] = {
410
- target: `http://localhost:${DEVTOOLS_UI_LOCAL_PORT}${DEVTOOLS_UI_ROUTE}`,
411
- changeOrigin: true,
412
- followRedirects: true,
413
- rewrite: (path) => path.replace(DEVTOOLS_UI_ROUTE, "")
414
- };
407
+ Object.assign(config, {
408
+ server: {
409
+ ...config.server,
410
+ proxy: {
411
+ ...config.server?.proxy,
412
+ [DEVTOOLS_UI_ROUTE]: {
413
+ target: `http://localhost:${DEVTOOLS_UI_LOCAL_PORT}${DEVTOOLS_UI_ROUTE}`,
414
+ changeOrigin: true,
415
+ followRedirects: true,
416
+ rewrite: (path) => path.replace(DEVTOOLS_UI_ROUTE, "")
417
+ }
418
+ }
419
+ }
420
+ });
415
421
  });
416
422
  }
417
423
  nuxt.hook("devtools:customTabs", (tabs) => {
@@ -460,20 +466,20 @@ function generatePathForI18nPages(ctx) {
460
466
  return locale?.domain ? withHttps(withBase(path, locale.domain)) : path;
461
467
  }
462
468
  function normalizeLocales(nuxtI18nConfig) {
463
- let locales = nuxtI18nConfig.locales || [];
469
+ const rawLocales = nuxtI18nConfig.locales || [];
464
470
  let onlyLocales = nuxtI18nConfig?.bundle?.onlyLocales || [];
465
471
  onlyLocales = typeof onlyLocales === "string" ? [onlyLocales] : onlyLocales;
466
- locales = mergeOnKey(locales.map((locale) => typeof locale === "string" ? { code: locale } : locale), "code");
472
+ let locales = mergeOnKey(rawLocales.map((locale) => typeof locale === "string" ? { code: locale } : locale), "code");
467
473
  if (onlyLocales.length) {
468
474
  locales = locales.filter((locale) => onlyLocales.includes(locale.code));
469
475
  }
470
476
  return locales.map((locale) => {
471
- if (locale.iso && !locale.language) {
477
+ if (typeof locale.iso === "string" && !locale.language) {
472
478
  locale.language = locale.iso;
473
479
  }
474
- locale._hreflang = locale.language || locale.code;
475
- locale._sitemap = locale.language || locale.code;
476
- return locale;
480
+ const _hreflang = locale.language || locale.code;
481
+ const _sitemap = locale.language || locale.code;
482
+ return { ...locale, _hreflang, _sitemap };
477
483
  });
478
484
  }
479
485
 
@@ -496,7 +502,7 @@ function normalizeFilters(filters) {
496
502
  }).filter(Boolean);
497
503
  }
498
504
 
499
- const module = defineNuxtModule({
505
+ const module$1 = defineNuxtModule({
500
506
  meta: {
501
507
  name: "@nuxtjs/sitemap",
502
508
  compatibility: {
@@ -842,7 +848,7 @@ export {}
842
848
  const images = [];
843
849
  if (config.discoverImages) {
844
850
  images.push(
845
- ...content.body.value?.filter(
851
+ ...content.body?.value?.filter(
846
852
  (c) => ["image", "img", "nuxtimg", "nuxt-img"].includes(c[0])
847
853
  ).filter((c) => c[1]?.src).map((c) => ({ loc: c[1].src })) || []
848
854
  );
@@ -1271,4 +1277,4 @@ export async function readSourcesFromFilesystem() {
1271
1277
  }
1272
1278
  });
1273
1279
 
1274
- export { module as default };
1280
+ export { module$1 as default };
@@ -9,24 +9,23 @@ export default defineNitroPlugin((nitroApp) => {
9
9
  return;
10
10
  let images = [];
11
11
  if (discoverImages) {
12
- images = content.body?.children?.filter(
13
- (c) => c.tag && c.props?.src && ["image", "img", "nuxtimg", "nuxt-img"].includes(c.tag.toLowerCase())
14
- ).map((i) => ({ loc: i.props.src })) || [];
12
+ const children = content.body?.children || [];
13
+ images = children.filter((c) => c.tag && c.props?.src && ["image", "img", "nuxtimg", "nuxt-img"].includes(c.tag.toLowerCase())).map((i) => ({ loc: i.props.src }));
15
14
  }
16
15
  const sitemapConfig = typeof content.sitemap === "object" ? content.sitemap : {};
17
16
  const lastmod = content.modifiedAt || content.updatedAt;
18
17
  const defaults = {};
19
- if (isNuxtContentDocumentDriven)
18
+ if (isNuxtContentDocumentDriven && typeof content._path === "string")
20
19
  defaults.loc = content._path;
21
- if (content.path)
20
+ if (typeof content.path === "string")
22
21
  defaults.loc = content.path;
23
22
  if (images?.length)
24
23
  defaults.images = images;
25
- if (lastmod)
24
+ if (typeof lastmod === "string" || lastmod instanceof Date)
26
25
  defaults.lastmod = lastmod;
27
26
  const definition = defu(sitemapConfig, defaults);
28
27
  if (!definition.loc) {
29
- if (content.path && content.path && content.path.startsWith("/"))
28
+ if (typeof content.path === "string" && content.path.startsWith("/"))
30
29
  definition.loc = content.path;
31
30
  if (Object.keys(sitemapConfig).length > 0 && import.meta.dev)
32
31
  console.warn(`[@nuxtjs/content] The @nuxt/content file \`${content._path}\` is missing a sitemap \`loc\`.`);
@@ -16,9 +16,10 @@ export default defineEventHandler(async (e) => {
16
16
  const nitroOrigin = getNitroOrigin(e);
17
17
  const sitemaps = {};
18
18
  for (const s of Object.keys(_sitemaps)) {
19
+ const sitemap = _sitemaps[s];
19
20
  sitemaps[s] = {
20
- ..._sitemaps[s],
21
- sources: await resolveSitemapSources(await childSitemapSources(_sitemaps[s]), e)
21
+ ...sitemap,
22
+ sources: await resolveSitemapSources(await childSitemapSources(sitemap), e)
22
23
  };
23
24
  }
24
25
  return {
@@ -1,2 +1,2 @@
1
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any[]>>;
1
+ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<unknown[]>>;
2
2
  export default _default;
@@ -1,2 +1,4 @@
1
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any[]>>;
1
+ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<{
2
+ loc: string | undefined;
3
+ }[]>>;
2
4
  export default _default;
@@ -11,14 +11,15 @@ export default defineEventHandler(async (e) => {
11
11
  const contentList = [];
12
12
  for (const collection of collections) {
13
13
  contentList.push(
14
+ // @ts-expect-error dynamic collection name
14
15
  queryCollection(e, collection).select("path", "sitemap").where("path", "IS NOT NULL").where("sitemap", "IS NOT NULL").all()
15
16
  );
16
17
  }
17
18
  const results = await Promise.all(contentList);
18
- return results.flatMap((c) => {
19
- return c.filter((c2) => c2.sitemap !== false && c2.path).flatMap((c2) => ({
20
- loc: c2.path,
21
- ...c2.sitemap || {}
22
- }));
23
- }).filter(Boolean);
19
+ return results.flatMap(
20
+ (entries) => entries.filter((c) => c.sitemap !== false && c.path).map((c) => ({
21
+ loc: c.path,
22
+ ...typeof c.sitemap === "object" ? c.sitemap : {}
23
+ }))
24
+ ).filter(Boolean);
24
25
  });
@@ -45,6 +45,6 @@ export default defineEventHandler(async (e) => {
45
45
  });
46
46
  }
47
47
  }
48
- const sitemapConfig = getSitemapConfig(sitemapName, sitemaps, runtimeConfig.defaultSitemapsChunkSize);
48
+ const sitemapConfig = getSitemapConfig(sitemapName, sitemaps, runtimeConfig.defaultSitemapsChunkSize || void 0);
49
49
  return createSitemap(e, sitemapConfig, runtimeConfig);
50
50
  });
@@ -3,8 +3,12 @@ import { joinURL, withHttps } from "ufo";
3
3
  import { preNormalizeEntry } from "../urlset/normalise.js";
4
4
  import { childSitemapSources, globalSitemapSources, resolveSitemapSources } from "../urlset/sources.js";
5
5
  import { sortInPlace } from "../urlset/sort.js";
6
- import { createPathFilter, logger, splitForLocales } from "../../../utils-pure.js";
6
+ import { createPathFilter, splitForLocales } from "../../../utils-pure.js";
7
7
  import { parseChunkInfo, sliceUrlsForChunk } from "../utils/chunk.js";
8
+ function getPageKey(pathWithoutPrefix) {
9
+ const stripped = pathWithoutPrefix[0] === "/" ? pathWithoutPrefix.slice(1) : pathWithoutPrefix;
10
+ return stripped.endsWith("/index") ? stripped.slice(0, -6) || "index" : stripped || "index";
11
+ }
8
12
  export function resolveSitemapEntries(sitemap, urls, runtimeConfig, resolvers) {
9
13
  const {
10
14
  autoI18n,
@@ -21,10 +25,16 @@ export function resolveSitemapEntries(sitemap, urls, runtimeConfig, resolvers) {
21
25
  return e;
22
26
  }).filter(Boolean);
23
27
  let validI18nUrlsForTransform = [];
24
- let warnIncorrectI18nTransformUsage = false;
25
28
  const withoutPrefixPaths = {};
26
29
  if (autoI18n && autoI18n.strategy !== "no_prefix") {
27
30
  const localeCodes = autoI18n.locales.map((l) => l.code);
31
+ const localeByCode = new Map(autoI18n.locales.map((l) => [l.code, l]));
32
+ const isPrefixStrategy = autoI18n.strategy === "prefix";
33
+ const isPrefixExceptOrAndDefault = autoI18n.strategy === "prefix_and_default" || autoI18n.strategy === "prefix_except_default";
34
+ const xDefaultAndLocales = [{ code: "x-default", _hreflang: "x-default" }, ...autoI18n.locales];
35
+ const defaultLocale = autoI18n.defaultLocale;
36
+ const hasPages = !!autoI18n.pages;
37
+ const hasDifferentDomains = !!autoI18n.differentDomains;
28
38
  validI18nUrlsForTransform = _urls.map((_e, i) => {
29
39
  if (_e._abs)
30
40
  return false;
@@ -32,15 +42,15 @@ export function resolveSitemapEntries(sitemap, urls, runtimeConfig, resolvers) {
32
42
  let localeCode = split[0];
33
43
  const pathWithoutPrefix = split[1];
34
44
  if (!localeCode)
35
- localeCode = autoI18n.defaultLocale;
45
+ localeCode = defaultLocale;
36
46
  const e = _e;
37
47
  e._pathWithoutPrefix = pathWithoutPrefix;
38
- const locale = autoI18n.locales.find((l) => l.code === localeCode);
48
+ const locale = localeByCode.get(localeCode);
39
49
  if (!locale)
40
50
  return false;
41
51
  e._locale = locale;
42
52
  e._index = i;
43
- e._key = `${e._sitemap || ""}${e._path?.pathname || "/"}${e._path.search}`;
53
+ e._key = `${e._sitemap || ""}${e._path?.pathname || "/"}${e._path?.search || ""}`;
44
54
  withoutPrefixPaths[pathWithoutPrefix] = withoutPrefixPaths[pathWithoutPrefix] || [];
45
55
  if (!withoutPrefixPaths[pathWithoutPrefix].some((e2) => e2._locale.code === locale.code))
46
56
  withoutPrefixPaths[pathWithoutPrefix].push(e);
@@ -48,9 +58,9 @@ export function resolveSitemapEntries(sitemap, urls, runtimeConfig, resolvers) {
48
58
  }).filter(Boolean);
49
59
  for (const e of validI18nUrlsForTransform) {
50
60
  if (!e._i18nTransform && !e.alternatives?.length) {
51
- const alternatives = withoutPrefixPaths[e._pathWithoutPrefix].map((u) => {
61
+ const alternatives = (withoutPrefixPaths[e._pathWithoutPrefix] || []).map((u) => {
52
62
  const entries = [];
53
- if (u._locale.code === autoI18n.defaultLocale) {
63
+ if (u._locale.code === defaultLocale) {
54
64
  entries.push({
55
65
  href: u.loc,
56
66
  hreflang: "x-default"
@@ -58,7 +68,7 @@ export function resolveSitemapEntries(sitemap, urls, runtimeConfig, resolvers) {
58
68
  }
59
69
  entries.push({
60
70
  href: u.loc,
61
- hreflang: u._locale._hreflang || autoI18n.defaultLocale
71
+ hreflang: u._locale._hreflang || defaultLocale
62
72
  });
63
73
  return entries;
64
74
  }).flat().filter(Boolean);
@@ -66,14 +76,11 @@ export function resolveSitemapEntries(sitemap, urls, runtimeConfig, resolvers) {
66
76
  e.alternatives = alternatives;
67
77
  } else if (e._i18nTransform) {
68
78
  delete e._i18nTransform;
69
- if (autoI18n.strategy === "no_prefix") {
70
- warnIncorrectI18nTransformUsage = true;
71
- }
72
- if (autoI18n.differentDomains) {
79
+ if (hasDifferentDomains) {
80
+ const defLocale = localeByCode.get(defaultLocale);
73
81
  e.alternatives = [
74
82
  {
75
- // apply default locale domain
76
- ...autoI18n.locales.find((l) => [l.code, l.language].includes(autoI18n.defaultLocale)),
83
+ ...defLocale,
77
84
  code: "x-default"
78
85
  },
79
86
  ...autoI18n.locales.filter((l) => !!l.domain)
@@ -84,68 +91,53 @@ export function resolveSitemapEntries(sitemap, urls, runtimeConfig, resolvers) {
84
91
  };
85
92
  });
86
93
  } else {
94
+ const pageKey = hasPages ? getPageKey(e._pathWithoutPrefix) : "";
95
+ const pageMappings = hasPages ? autoI18n.pages[pageKey] : void 0;
96
+ const pathSearch = e._path?.search || "";
97
+ const pathWithoutPrefix = e._pathWithoutPrefix;
87
98
  for (const l of autoI18n.locales) {
88
- let loc = e._pathWithoutPrefix;
89
- if (autoI18n.pages) {
90
- const pageKey = e._pathWithoutPrefix.replace(/^\//, "").replace(/\/index$/, "") || "index";
91
- const pageMappings = autoI18n.pages[pageKey];
92
- if (pageMappings && pageMappings[l.code] !== void 0) {
93
- const customPath = pageMappings[l.code];
99
+ let loc = pathWithoutPrefix;
100
+ if (hasPages && pageMappings && pageMappings[l.code] !== void 0) {
101
+ const customPath = pageMappings[l.code];
102
+ if (customPath === false)
103
+ continue;
104
+ if (typeof customPath === "string")
105
+ loc = customPath[0] === "/" ? customPath : `/${customPath}`;
106
+ } else if (!hasDifferentDomains && !(isPrefixExceptOrAndDefault && l.code === defaultLocale)) {
107
+ loc = joinURL(`/${l.code}`, pathWithoutPrefix);
108
+ }
109
+ const _sitemap = isI18nMapped ? l._sitemap : void 0;
110
+ const alternatives = [];
111
+ for (const locale of xDefaultAndLocales) {
112
+ const code = locale.code === "x-default" ? defaultLocale : locale.code;
113
+ const isDefault = locale.code === "x-default" || locale.code === defaultLocale;
114
+ let href = pathWithoutPrefix;
115
+ if (hasPages && pageMappings && pageMappings[code] !== void 0) {
116
+ const customPath = pageMappings[code];
94
117
  if (customPath === false)
95
118
  continue;
96
119
  if (typeof customPath === "string")
97
- loc = customPath.startsWith("/") ? customPath : `/${customPath}`;
98
- } else if (!autoI18n.differentDomains && !(["prefix_and_default", "prefix_except_default"].includes(autoI18n.strategy) && l.code === autoI18n.defaultLocale)) {
99
- loc = joinURL(`/${l.code}`, e._pathWithoutPrefix);
120
+ href = customPath[0] === "/" ? customPath : `/${customPath}`;
121
+ } else if (isPrefixStrategy) {
122
+ href = joinURL("/", code, pathWithoutPrefix);
123
+ } else if (isPrefixExceptOrAndDefault && !isDefault) {
124
+ href = joinURL("/", code, pathWithoutPrefix);
100
125
  }
101
- } else {
102
- if (!autoI18n.differentDomains && !(["prefix_and_default", "prefix_except_default"].includes(autoI18n.strategy) && l.code === autoI18n.defaultLocale))
103
- loc = joinURL(`/${l.code}`, e._pathWithoutPrefix);
126
+ if (!filterPath(href))
127
+ continue;
128
+ alternatives.push({
129
+ hreflang: locale._hreflang,
130
+ href
131
+ });
104
132
  }
105
- const _sitemap = isI18nMapped ? l._sitemap : void 0;
133
+ const { _index: _, ...rest } = e;
106
134
  const newEntry = preNormalizeEntry({
107
135
  _sitemap,
108
- ...e,
109
- _index: void 0,
110
- _key: `${_sitemap || ""}${loc || "/"}${e._path.search}`,
136
+ ...rest,
137
+ _key: `${_sitemap || ""}${loc || "/"}${pathSearch}`,
111
138
  _locale: l,
112
139
  loc,
113
- alternatives: [{ code: "x-default", _hreflang: "x-default" }, ...autoI18n.locales].map((locale) => {
114
- const code = locale.code === "x-default" ? autoI18n.defaultLocale : locale.code;
115
- const isDefault = locale.code === "x-default" || locale.code === autoI18n.defaultLocale;
116
- let href = e._pathWithoutPrefix;
117
- if (autoI18n.pages) {
118
- const pageKey = e._pathWithoutPrefix.replace(/^\//, "").replace(/\/index$/, "") || "index";
119
- const pageMappings = autoI18n.pages[pageKey];
120
- if (pageMappings && pageMappings[code] !== void 0) {
121
- const customPath = pageMappings[code];
122
- if (customPath === false)
123
- return false;
124
- if (typeof customPath === "string")
125
- href = customPath.startsWith("/") ? customPath : `/${customPath}`;
126
- } else if (autoI18n.strategy === "prefix") {
127
- href = joinURL("/", code, e._pathWithoutPrefix);
128
- } else if (["prefix_and_default", "prefix_except_default"].includes(autoI18n.strategy)) {
129
- if (!isDefault) {
130
- href = joinURL("/", code, e._pathWithoutPrefix);
131
- }
132
- }
133
- } else {
134
- if (autoI18n.strategy === "prefix") {
135
- href = joinURL("/", code, e._pathWithoutPrefix);
136
- } else if (["prefix_and_default", "prefix_except_default"].includes(autoI18n.strategy)) {
137
- if (!isDefault) {
138
- href = joinURL("/", code, e._pathWithoutPrefix);
139
- }
140
- }
141
- }
142
- if (!filterPath(href))
143
- return false;
144
- return {
145
- hreflang: locale._hreflang,
146
- href
147
- };
148
- }).filter(Boolean)
140
+ alternatives
149
141
  }, resolvers);
150
142
  if (e._locale.code === newEntry._locale.code) {
151
143
  _urls[e._index] = newEntry;
@@ -158,15 +150,12 @@ export function resolveSitemapEntries(sitemap, urls, runtimeConfig, resolvers) {
158
150
  }
159
151
  if (isI18nMapped) {
160
152
  e._sitemap = e._sitemap || e._locale._sitemap;
161
- e._key = `${e._sitemap || ""}${e.loc || "/"}${e._path.search}`;
153
+ e._key = `${e._sitemap || ""}${e.loc || "/"}${e._path?.search || ""}`;
162
154
  }
163
155
  if (e._index)
164
156
  _urls[e._index] = e;
165
157
  }
166
158
  }
167
- if (import.meta.dev && warnIncorrectI18nTransformUsage) {
168
- logger.warn("You're using _i18nTransform with the `no_prefix` strategy. This will cause issues with the sitemap. Please remove the _i18nTransform flag or change i18n strategy.");
169
- }
170
159
  return _urls;
171
160
  }
172
161
  export async function buildSitemapUrls(sitemap, resolvers, runtimeConfig, nitro) {
@@ -181,15 +170,16 @@ export async function buildSitemapUrls(sitemap, resolvers, runtimeConfig, nitro)
181
170
  // chunking
182
171
  defaultSitemapsChunkSize
183
172
  } = runtimeConfig;
184
- const chunkInfo = parseChunkInfo(sitemap.sitemapName, sitemaps, defaultSitemapsChunkSize);
173
+ const chunkSize = defaultSitemapsChunkSize || void 0;
174
+ const chunkInfo = parseChunkInfo(sitemap.sitemapName, sitemaps, chunkSize);
185
175
  function maybeSort(urls2) {
186
176
  return sortEntries ? sortInPlace(urls2) : urls2;
187
177
  }
188
178
  function maybeSlice(urls2) {
189
- return sliceUrlsForChunk(urls2, sitemap.sitemapName, sitemaps, defaultSitemapsChunkSize);
179
+ return sliceUrlsForChunk(urls2, sitemap.sitemapName, sitemaps, chunkSize);
190
180
  }
191
181
  if (autoI18n?.differentDomains) {
192
- const domain = autoI18n.locales.find((e) => [e.language, e.code].includes(sitemap.sitemapName))?.domain;
182
+ const domain = autoI18n.locales.find((e) => e.language === sitemap.sitemapName || e.code === sitemap.sitemapName)?.domain;
193
183
  if (domain) {
194
184
  const _tester = resolvers.canonicalUrlResolver;
195
185
  resolvers.canonicalUrlResolver = (path) => resolveSitePath(path, {