@nuxtjs/sitemap 7.0.2 → 7.2.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.
Files changed (45) hide show
  1. package/content.d.ts +1 -0
  2. package/dist/client/200.html +9 -9
  3. package/dist/client/404.html +9 -9
  4. package/dist/client/_nuxt/{B5lI3vl2.js → B-Cf5GGq.js} +1 -1
  5. package/dist/client/_nuxt/{BLDCaNbg.js → B2vK47Ag.js} +1 -1
  6. package/dist/client/_nuxt/CBErYmNG.js +32 -0
  7. package/dist/client/_nuxt/{BCt9_I41.js → CxhUe2GG.js} +1 -1
  8. package/dist/client/_nuxt/builds/latest.json +1 -1
  9. package/dist/client/_nuxt/builds/meta/b551cdd3-b342-41ea-8265-0fb9c87a6b0b.json +1 -0
  10. package/dist/client/_nuxt/{entry.WCUheyaE.css → entry.CJ2Eg9q-.css} +1 -1
  11. package/dist/client/_nuxt/error-404.DWO74KKP.css +1 -0
  12. package/dist/client/_nuxt/error-500.DVC0lzO_.css +1 -0
  13. package/dist/client/index.html +9 -9
  14. package/dist/content.cjs +48 -0
  15. package/dist/content.d.cts +231 -0
  16. package/dist/content.d.mts +231 -0
  17. package/dist/content.d.ts +231 -0
  18. package/dist/content.mjs +45 -0
  19. package/dist/module.cjs +1270 -4
  20. package/dist/module.d.cts +8 -0
  21. package/dist/module.json +1 -1
  22. package/dist/module.mjs +169 -71
  23. package/dist/runtime/server/plugins/{nuxt-content.js → nuxt-content-v2.js} +2 -10
  24. package/dist/runtime/server/routes/__sitemap__/debug.d.ts +1 -1
  25. package/dist/runtime/server/routes/__sitemap__/nuxt-content-urls-v3.d.ts +2 -0
  26. package/dist/runtime/server/routes/__sitemap__/nuxt-content-urls-v3.js +17 -0
  27. package/dist/runtime/server/routes/sitemap/[sitemap].xml.js +1 -1
  28. package/dist/runtime/server/routes/sitemap_index.xml.js +2 -2
  29. package/dist/runtime/server/sitemap/builder/sitemap-index.d.ts +2 -1
  30. package/dist/runtime/server/sitemap/builder/sitemap-index.js +8 -3
  31. package/dist/runtime/server/sitemap/builder/sitemap.d.ts +4 -3
  32. package/dist/runtime/server/sitemap/builder/sitemap.js +12 -7
  33. package/dist/runtime/server/sitemap/nitro.js +6 -2
  34. package/dist/runtime/server/sitemap/urlset/sources.js +16 -7
  35. package/dist/runtime/server/sitemap/utils/extractSitemapXML.d.ts +2 -0
  36. package/dist/runtime/server/sitemap/utils/extractSitemapXML.js +75 -0
  37. package/dist/runtime/types.d.ts +5 -1
  38. package/package.json +27 -22
  39. package/dist/client/_nuxt/BZ4NIl-o.js +0 -32
  40. package/dist/client/_nuxt/builds/meta/286d11d8-5fae-4d47-bddf-64b0ae9fc73d.json +0 -1
  41. package/dist/client/_nuxt/error-404.vQ0SaaqA.css +0 -1
  42. package/dist/client/_nuxt/error-500.ayRVCnRF.css +0 -1
  43. /package/dist/runtime/server/plugins/{nuxt-content.d.ts → nuxt-content-v2.d.ts} +0 -0
  44. /package/dist/runtime/server/routes/__sitemap__/{nuxt-content-urls.d.ts → nuxt-content-urls-v2.d.ts} +0 -0
  45. /package/dist/runtime/server/routes/__sitemap__/{nuxt-content-urls.js → nuxt-content-urls-v2.js} +0 -0
@@ -0,0 +1,75 @@
1
+ export function extractSitemapXML(xml) {
2
+ const urls = xml.match(/<url>[\s\S]*?<\/url>/g) || [];
3
+ return urls.map((url) => {
4
+ const loc = url.match(/<loc>([^<]+)<\/loc>/)?.[1];
5
+ if (!loc) return null;
6
+ const lastmod = url.match(/<lastmod>([^<]+)<\/lastmod>/)?.[1];
7
+ const changefreq = url.match(/<changefreq>([^<]+)<\/changefreq>/)?.[1];
8
+ const priority = url.match(/<priority>([^<]+)<\/priority>/) ? Number.parseFloat(url.match(/<priority>([^<]+)<\/priority>/)[1]) : void 0;
9
+ const images = (url.match(/<image:image>[\s\S]*?<\/image:image>/g) || []).map((image) => {
10
+ const imageLoc = image.match(/<image:loc>([^<]+)<\/image:loc>/)?.[1];
11
+ return imageLoc ? { loc: imageLoc } : null;
12
+ }).filter(Boolean);
13
+ const videos = (url.match(/<video:video>[\s\S]*?<\/video:video>/g) || []).map((video) => {
14
+ const videoObj = {};
15
+ const title = video.match(/<video:title>([^<]+)<\/video:title>/)?.[1];
16
+ const thumbnail_loc = video.match(/<video:thumbnail_loc>([^<]+)<\/video:thumbnail_loc>/)?.[1];
17
+ const description = video.match(/<video:description>([^<]+)<\/video:description>/)?.[1];
18
+ const content_loc = video.match(/<video:content_loc>([^<]+)<\/video:content_loc>/)?.[1];
19
+ if (!title || !thumbnail_loc || !description || !content_loc) return null;
20
+ videoObj.title = title;
21
+ videoObj.thumbnail_loc = thumbnail_loc;
22
+ videoObj.description = description;
23
+ videoObj.content_loc = content_loc;
24
+ const player_loc = video.match(/<video:player_loc>([^<]+)<\/video:player_loc>/)?.[1];
25
+ if (player_loc) videoObj.player_loc = player_loc;
26
+ const duration = video.match(/<video:duration>([^<]+)<\/video:duration>/) ? Number.parseInt(video.match(/<video:duration>([^<]+)<\/video:duration>/)[1], 10) : void 0;
27
+ if (duration) videoObj.duration = duration;
28
+ const expiration_date = video.match(/<video:expiration_date>([^<]+)<\/video:expiration_date>/)?.[1];
29
+ if (expiration_date) videoObj.expiration_date = expiration_date;
30
+ const rating = video.match(/<video:rating>([^<]+)<\/video:rating>/) ? Number.parseFloat(video.match(/<video:rating>([^<]+)<\/video:rating>/)[1]) : void 0;
31
+ if (rating) videoObj.rating = rating;
32
+ const view_count = video.match(/<video:view_count>([^<]+)<\/video:view_count>/) ? Number.parseInt(video.match(/<video:view_count>([^<]+)<\/video:view_count>/)[1], 10) : void 0;
33
+ if (view_count) videoObj.view_count = view_count;
34
+ const publication_date = video.match(/<video:publication_date>([^<]+)<\/video:publication_date>/)?.[1];
35
+ if (publication_date) videoObj.publication_date = publication_date;
36
+ const family_friendly = video.match(/<video:family_friendly>([^<]+)<\/video:family_friendly>/)?.[1];
37
+ if (family_friendly) videoObj.family_friendly = family_friendly;
38
+ const restriction = video.match(/<video:restriction relationship="([^"]+)">([^<]+)<\/video:restriction>/);
39
+ if (restriction) videoObj.restriction = { relationship: restriction[1], restriction: restriction[2] };
40
+ const platform = video.match(/<video:platform relationship="([^"]+)">([^<]+)<\/video:platform>/);
41
+ if (platform) videoObj.platform = { relationship: platform[1], platform: platform[2] };
42
+ const price = (video.match(/<video:price [^>]+>([^<]+)<\/video:price>/g) || []).map((price2) => {
43
+ const priceValue = price2.match(/<video:price [^>]+>([^<]+)<\/video:price>/)?.[1];
44
+ const currency = price2.match(/currency="([^"]+)"/)?.[1];
45
+ const type = price2.match(/type="([^"]+)"/)?.[1];
46
+ return priceValue ? { price: priceValue, currency, type } : null;
47
+ }).filter(Boolean);
48
+ if (price.length) videoObj.price = price;
49
+ const requires_subscription = video.match(/<video:requires_subscription>([^<]+)<\/video:requires_subscription>/)?.[1];
50
+ if (requires_subscription) videoObj.requires_subscription = requires_subscription;
51
+ const uploader = video.match(/<video:uploader info="([^"]+)">([^<]+)<\/video:uploader>/);
52
+ if (uploader) videoObj.uploader = { uploader: uploader[2], info: uploader[1] };
53
+ const live = video.match(/<video:live>([^<]+)<\/video:live>/)?.[1];
54
+ if (live) videoObj.live = live;
55
+ const tag = (video.match(/<video:tag>([^<]+)<\/video:tag>/g) || []).map((tag2) => tag2.match(/<video:tag>([^<]+)<\/video:tag>/)?.[1]).filter(Boolean);
56
+ if (tag.length) videoObj.tag = tag;
57
+ return videoObj;
58
+ }).filter(Boolean);
59
+ const alternatives = (url.match(/<xhtml:link[\s\S]*?\/>/g) || []).map((link) => {
60
+ const hreflang = link.match(/hreflang="([^"]+)"/)?.[1];
61
+ const href = link.match(/href="([^"]+)"/)?.[1];
62
+ return hreflang && href ? { hreflang, href } : null;
63
+ }).filter(Boolean);
64
+ const news = url.match(/<news:news>[\s\S]*?<\/news:news>/) ? {
65
+ title: url.match(/<news:title>([^<]+)<\/news:title>/)?.[1],
66
+ publication_date: url.match(/<news:publication_date>([^<]+)<\/news:publication_date>/)?.[1],
67
+ publication: {
68
+ name: url.match(/<news:name>([^<]+)<\/news:name>/)?.[1],
69
+ language: url.match(/<news:language>([^<]+)<\/news:language>/)?.[1]
70
+ }
71
+ } : void 0;
72
+ const urlObj = { loc, lastmod, changefreq, priority, images, videos, alternatives, news };
73
+ return Object.fromEntries(Object.entries(urlObj).filter(([_, v]) => v != null && v.length !== 0));
74
+ }).filter(Boolean);
75
+ }
@@ -45,7 +45,7 @@ export interface ModuleOptions extends SitemapDefinition {
45
45
  *
46
46
  * @default /__sitemap__/
47
47
  */
48
- sitemapsPathPrefix: string;
48
+ sitemapsPathPrefix: string | false;
49
49
  /**
50
50
  * Sitemaps to append to the sitemap index.
51
51
  *
@@ -303,6 +303,10 @@ export interface SitemapRenderCtx {
303
303
  sitemapName: string;
304
304
  urls: ResolvedSitemapUrl[];
305
305
  }
306
+ export interface SitemapInputCtx {
307
+ sitemapName: string;
308
+ urls: SitemapUrlInput[];
309
+ }
306
310
  export interface SitemapOutputHookCtx {
307
311
  sitemapName: string;
308
312
  sitemap: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nuxtjs/sitemap",
3
3
  "type": "module",
4
- "version": "7.0.2",
4
+ "version": "7.2.1",
5
5
  "description": "Powerfully flexible XML Sitemaps that integrate seamlessly, for Nuxt.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",
@@ -26,58 +26,63 @@
26
26
  "types": "./dist/types.d.ts",
27
27
  "import": "./dist/module.mjs",
28
28
  "require": "./dist/module.cjs"
29
+ },
30
+ "./content": {
31
+ "types": "./dist/content.d.ts",
32
+ "import": "./dist/content.mjs",
33
+ "require": "./dist/content.cjs"
29
34
  }
30
35
  },
31
36
  "main": "./dist/module.cjs",
32
37
  "types": "./dist/types.d.ts",
33
38
  "files": [
34
39
  "dist",
35
- "virtual.d.ts"
40
+ "virtual.d.ts",
41
+ "content.d.ts"
36
42
  ],
43
+ "typesVersions": {
44
+ "*": {
45
+ "content": [
46
+ "dist/content"
47
+ ]
48
+ }
49
+ },
37
50
  "dependencies": {
38
- "@nuxt/devtools-kit": "^1.7.0",
39
- "@nuxt/kit": "^3.15.1",
51
+ "@nuxt/devtools-kit": "^2.0.0-beta.3",
52
+ "@nuxt/kit": "^3.15.2",
40
53
  "chalk": "^5.4.1",
41
54
  "defu": "^6.1.4",
42
55
  "h3-compression": "^0.3.2",
43
56
  "nuxt-site-config": "^3.0.6",
44
57
  "ofetch": "^1.4.1",
45
- "pathe": "^2.0.1",
46
- "pkg-types": "^1.3.0",
58
+ "pathe": "^2.0.2",
59
+ "pkg-types": "^1.3.1",
47
60
  "radix3": "^1.1.2",
48
61
  "semver": "^7.6.3",
49
62
  "sirv": "^3.0.0",
50
63
  "ufo": "^1.5.4"
51
64
  },
52
65
  "devDependencies": {
53
- "@nuxt/content": "^2.13.4",
66
+ "@nuxt/content": "^3.0.0",
54
67
  "@nuxt/eslint-config": "^0.7.5",
55
68
  "@nuxt/module-builder": "0.8.4",
56
69
  "@nuxt/test-utils": "^3.15.4",
57
- "@nuxt/ui": "^2.20.0",
70
+ "@nuxt/ui": "^2.21.0",
58
71
  "@nuxtjs/i18n": "9.1.1",
59
- "@nuxtjs/robots": "5.1.0",
60
- "bumpp": "^9.10.0",
61
- "eslint": "9.17.0",
72
+ "@nuxtjs/robots": "^5.2.1",
73
+ "bumpp": "^9.10.1",
74
+ "eslint": "^9.18.0",
62
75
  "eslint-plugin-n": "^17.15.1",
63
76
  "execa": "^9.5.2",
64
- "nuxt": "^3.15.1",
65
- "nuxt-i18n-micro": "^1.59.0",
77
+ "nuxt": "^3.15.2",
78
+ "nuxt-i18n-micro": "^1.64.0",
66
79
  "typescript": "5.6.3",
67
- "vitest": "^2.1.8"
80
+ "vitest": "^3.0.2"
68
81
  },
69
82
  "resolutions": {
70
83
  "postcss": "8.4.47",
71
84
  "typescript": "5.6.3"
72
85
  },
73
- "build": {
74
- "externals": [
75
- "h3",
76
- "std-env",
77
- "nitropack",
78
- "consola"
79
- ]
80
- },
81
86
  "scripts": {
82
87
  "lint": "eslint .",
83
88
  "lint:type": "tsc --noEmit",