@nuxtjs/sitemap 7.4.0 → 7.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/module.d.cts DELETED
@@ -1,10 +0,0 @@
1
- import * as _nuxt_schema from '@nuxt/schema';
2
- import { ModuleOptions as ModuleOptions$1 } from '../dist/runtime/types.js';
3
- export * from '../dist/runtime/types.js';
4
-
5
- interface ModuleOptions extends ModuleOptions$1 {
6
- }
7
- declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
8
-
9
- export = _default;
10
- export type { ModuleOptions };
@@ -1,2 +0,0 @@
1
- import type { SitemapUrlInput } from '../../../types.js';
2
- export declare function extractSitemapXML(xml: string): SitemapUrlInput[];
@@ -1,75 +0,0 @@
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
- }