@power-seo/sitemap 1.0.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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/generator.ts","../src/types.ts","../src/sitemap-index.ts","../src/stream.ts","../src/validate.ts"],"names":["normalizeUrl","escapeXml","indexEntries","isAbsoluteUrl","MAX_URL_LENGTH"],"mappings":";;;;;AAQA,SAAS,UAAU,GAAA,EAAqB;AACtC,EAAA,OAAO,IACJ,OAAA,CAAQ,IAAA,EAAM,OAAO,CAAA,CACrB,OAAA,CAAQ,MAAM,MAAM,CAAA,CACpB,QAAQ,IAAA,EAAM,MAAM,EACpB,OAAA,CAAQ,IAAA,EAAM,QAAQ,CAAA,CACtB,OAAA,CAAQ,MAAM,QAAQ,CAAA;AAC3B;AAGA,SAAS,iBAAiB,IAAA,EAAuE;AAC/F,EAAA,IAAI,KAAA,GAAQ,KAAA;AACZ,EAAA,IAAI,KAAA,GAAQ,KAAA;AACZ,EAAA,IAAI,IAAA,GAAO,KAAA;AACX,EAAA,KAAA,MAAW,OAAO,IAAA,EAAM;AACtB,IAAA,IAAI,IAAI,MAAA,IAAU,GAAA,CAAI,MAAA,CAAO,MAAA,GAAS,GAAG,KAAA,GAAQ,IAAA;AACjD,IAAA,IAAI,IAAI,MAAA,IAAU,GAAA,CAAI,MAAA,CAAO,MAAA,GAAS,GAAG,KAAA,GAAQ,IAAA;AACjD,IAAA,IAAI,GAAA,CAAI,MAAM,IAAA,GAAO,IAAA;AACrB,IAAA,IAAI,KAAA,IAAS,SAAS,IAAA,EAAM;AAAA,EAC9B;AACA,EAAA,OAAO,EAAE,KAAA,EAAO,KAAA,EAAO,IAAA,EAAK;AAC9B;AAEA,SAAS,cAAc,MAAA,EAAgC;AACrD,EAAA,OAAO,MAAA,CACJ,GAAA,CAAI,CAAC,GAAA,KAAQ;AACZ,IAAA,IAAI,GAAA,GAAM,qBAAA;AACV,IAAA,GAAA,IA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AAI,CAAC,GAAA,CAAI,IAAA,CAAK,aAAa,QAAA,EAAU,MAAA,CAAO,KAAK,2CAA2C,CAAA;AAC5F,IAAA,IAAI,CAAC,GAAA,CAAI,IAAA,CAAK,eAAA,EAAiB,MAAA,CAAO,KAAK,sCAAsC,CAAA;AACjF,IAAA,IAAI,CAAC,GAAA,CAAI,IAAA,CAAK,KAAA,EAAO,MAAA,CAAO,KAAK,4BAA4B,CAAA;AAAA,EAC/D;AAEA,EAAA,OAAO;AAAA,IACL,KAAA,EAAO,OAAO,MAAA,KAAW,CAAA;AAAA,IACzB,MAAA;AAAA,IACA;AAAA,GACF;AACF","file":"index.cjs","sourcesContent":["// ============================================================================\r\n// @power-seo/sitemap — XML Sitemap Generator\r\n// ============================================================================\r\n\r\nimport type { SitemapConfig, SitemapURL, SitemapImage, SitemapVideo, SitemapNews } from '@power-seo/core';\r\nimport { normalizeUrl } from '@power-seo/core';\r\n\r\n/** Escape special XML characters. */\r\nfunction escapeXml(str: string): string {\r\n return str\r\n .replace(/&/g, '&amp;')\r\n .replace(/</g, '&lt;')\r\n .replace(/>/g, '&gt;')\r\n .replace(/\"/g, '&quot;')\r\n .replace(/'/g, '&apos;');\r\n}\r\n\r\n/** Determine which namespace extensions are needed. */\r\nfunction detectNamespaces(urls: SitemapURL[]): { image: boolean; video: boolean; news: boolean } {\r\n let image = false;\r\n let video = false;\r\n let news = false;\r\n for (const url of urls) {\r\n if (url.images && url.images.length > 0) image = true;\r\n if (url.videos && url.videos.length > 0) video = true;\r\n if (url.news) news = true;\r\n if (image && video && news) break;\r\n }\r\n return { image, video, news };\r\n}\r\n\r\nfunction buildImageXml(images: SitemapImage[]): string {\r\n return images\r\n .map((img) => {\r\n let xml = ' <image:image>\\n';\r\n xml += ` <image:loc>${escapeXml(img.loc)}</image:loc>\\n`;\r\n if (img.caption) xml += ` <image:caption>${escapeXml(img.caption)}</image:caption>\\n`;\r\n if (img.geoLocation) xml += ` <image:geo_location>${escapeXml(img.geoLocation)}</image:geo_location>\\n`;\r\n if (img.title) xml += ` <image:title>${escapeXml(img.title)}</image:title>\\n`;\r\n if (img.license) xml += ` <image:license>${escapeXml(img.license)}</image:license>\\n`;\r\n xml += ' </image:image>\\n';\r\n return xml;\r\n })\r\n .join('');\r\n}\r\n\r\nfunction buildVideoXml(videos: SitemapVideo[]): string {\r\n return videos\r\n .map((vid) => {\r\n let xml = ' <video:video>\\n';\r\n xml += ` <video:thumbnail_loc>${escapeXml(vid.thumbnailLoc)}</video:thumbnail_loc>\\n`;\r\n xml += ` <video:title>${escapeXml(vid.title)}</video:title>\\n`;\r\n xml += ` <video:description>${escapeXml(vid.description)}</video:description>\\n`;\r\n if (vid.contentLoc) xml += ` <video:content_loc>${escapeXml(vid.contentLoc)}</video:content_loc>\\n`;\r\n if (vid.playerLoc) xml += ` <video:player_loc>${escapeXml(vid.playerLoc)}</video:player_loc>\\n`;\r\n if (vid.duration !== undefined) xml += ` <video:duration>${vid.duration}</video:duration>\\n`;\r\n if (vid.expirationDate) xml += ` <video:expiration_date>${escapeXml(vid.expirationDate)}</video:expiration_date>\\n`;\r\n if (vid.rating !== undefined) xml += ` <video:rating>${vid.rating}</video:rating>\\n`;\r\n if (vid.viewCount !== undefined) xml += ` <video:view_count>${vid.viewCount}</video:view_count>\\n`;\r\n if (vid.publicationDate) xml += ` <video:publication_date>${escapeXml(vid.publicationDate)}</video:publication_date>\\n`;\r\n if (vid.familyFriendly !== undefined) xml += ` <video:family_friendly>${vid.familyFriendly ? 'yes' : 'no'}</video:family_friendly>\\n`;\r\n if (vid.live !== undefined) xml += ` <video:live>${vid.live ? 'yes' : 'no'}</video:live>\\n`;\r\n xml += ' </video:video>\\n';\r\n return xml;\r\n })\r\n .join('');\r\n}\r\n\r\nfunction buildNewsXml(news: SitemapNews): string {\r\n let xml = ' <news:news>\\n';\r\n xml += ' <news:publication>\\n';\r\n xml += ` <news:name>${escapeXml(news.publication.name)}</news:name>\\n`;\r\n xml += ` <news:language>${escapeXml(news.publication.language)}</news:language>\\n`;\r\n xml += ' </news:publication>\\n';\r\n xml += ` <news:publication_date>${escapeXml(news.publicationDate)}</news:publication_date>\\n`;\r\n xml += ` <news:title>${escapeXml(news.title)}</news:title>\\n`;\r\n xml += ' </news:news>\\n';\r\n return xml;\r\n}\r\n\r\nfunction buildUrlXml(url: SitemapURL, hostname: string): string {\r\n const loc = url.loc.startsWith('http') ? url.loc : normalizeUrl(`${hostname}${url.loc.startsWith('/') ? '' : '/'}${url.loc}`);\r\n\r\n let xml = ' <url>\\n';\r\n xml += ` <loc>${escapeXml(loc)}</loc>\\n`;\r\n if (url.lastmod) xml += ` <lastmod>${escapeXml(url.lastmod)}</lastmod>\\n`;\r\n if (url.changefreq) xml += ` <changefreq>${url.changefreq}</changefreq>\\n`;\r\n if (url.priority !== undefined) xml += ` <priority>${url.priority.toFixed(1)}</priority>\\n`;\r\n if (url.images && url.images.length > 0) xml += buildImageXml(url.images);\r\n if (url.videos && url.videos.length > 0) xml += buildVideoXml(url.videos);\r\n if (url.news) xml += buildNewsXml(url.news);\r\n xml += ' </url>\\n';\r\n return xml;\r\n}\r\n\r\n/**\r\n * Generate an XML sitemap string from a sitemap configuration.\r\n *\r\n * @example\r\n * ```ts\r\n * const xml = generateSitemap({\r\n * hostname: 'https://example.com',\r\n * urls: [\r\n * { loc: '/', changefreq: 'daily', priority: 1.0 },\r\n * { loc: '/about', changefreq: 'monthly', priority: 0.8 },\r\n * ],\r\n * });\r\n * ```\r\n */\r\nexport function generateSitemap(config: SitemapConfig): string {\r\n const { hostname, urls } = config;\r\n const ns = detectNamespaces(urls);\r\n\r\n let xml = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n';\r\n xml += '<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"';\r\n if (ns.image) xml += '\\n xmlns:image=\"http://www.google.com/schemas/sitemap-image/1.1\"';\r\n if (ns.video) xml += '\\n xmlns:video=\"http://www.google.com/schemas/sitemap-video/1.1\"';\r\n if (ns.news) xml += '\\n xmlns:news=\"http://www.google.com/schemas/sitemap-news/0.9\"';\r\n xml += '>\\n';\r\n\r\n for (const url of urls) {\r\n xml += buildUrlXml(url, hostname);\r\n }\r\n\r\n xml += '</urlset>\\n';\r\n return xml;\r\n}\r\n","// ============================================================================\r\n// @power-seo/sitemap — Types\r\n// ============================================================================\r\n\r\nexport type {\r\n SitemapURL,\r\n SitemapImage,\r\n SitemapVideo,\r\n SitemapNews,\r\n SitemapConfig,\r\n} from '@power-seo/core';\r\n\r\n/** A sitemap entry in a sitemap index. */\r\nexport interface SitemapIndexEntry {\r\n loc: string;\r\n lastmod?: string;\r\n}\r\n\r\n/** Configuration for the sitemap index generator. */\r\nexport interface SitemapIndexConfig {\r\n sitemaps: SitemapIndexEntry[];\r\n}\r\n\r\n/** Result of URL validation. */\r\nexport interface SitemapValidationResult {\r\n valid: boolean;\r\n errors: string[];\r\n warnings: string[];\r\n}\r\n\r\n/** Maximum URLs allowed per sitemap file. */\r\nexport const MAX_URLS_PER_SITEMAP = 50_000;\r\n\r\n/** Maximum sitemap file size in bytes (50MB). */\r\nexport const MAX_SITEMAP_SIZE_BYTES = 50 * 1024 * 1024;\r\n","// ============================================================================\r\n// @power-seo/sitemap — Sitemap Index Generator\r\n// ============================================================================\r\n\r\nimport type { SitemapConfig } from '@power-seo/core';\r\nimport type { SitemapIndexConfig, SitemapIndexEntry } from './types.js';\r\nimport { MAX_URLS_PER_SITEMAP } from './types.js';\r\nimport { generateSitemap } from './generator.js';\r\n\r\n/** Escape special XML characters. */\r\nfunction escapeXml(str: string): string {\r\n return str\r\n .replace(/&/g, '&amp;')\r\n .replace(/</g, '&lt;')\r\n .replace(/>/g, '&gt;')\r\n .replace(/\"/g, '&quot;')\r\n .replace(/'/g, '&apos;');\r\n}\r\n\r\n/**\r\n * Generate a sitemap index XML string.\r\n *\r\n * @example\r\n * ```ts\r\n * const indexXml = generateSitemapIndex({\r\n * sitemaps: [\r\n * { loc: 'https://example.com/sitemap-0.xml', lastmod: '2024-01-01' },\r\n * { loc: 'https://example.com/sitemap-1.xml', lastmod: '2024-01-01' },\r\n * ],\r\n * });\r\n * ```\r\n */\r\nexport function generateSitemapIndex(config: SitemapIndexConfig): string {\r\n let xml = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n';\r\n xml += '<sitemapindex xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\\n';\r\n\r\n for (const sitemap of config.sitemaps) {\r\n xml += ' <sitemap>\\n';\r\n xml += ` <loc>${escapeXml(sitemap.loc)}</loc>\\n`;\r\n if (sitemap.lastmod) {\r\n xml += ` <lastmod>${escapeXml(sitemap.lastmod)}</lastmod>\\n`;\r\n }\r\n xml += ' </sitemap>\\n';\r\n }\r\n\r\n xml += '</sitemapindex>\\n';\r\n return xml;\r\n}\r\n\r\n/**\r\n * Split a large sitemap config into multiple sitemaps + an index.\r\n *\r\n * When a site has more than 50,000 URLs, this function splits them into\r\n * multiple sitemap files and returns both the individual sitemaps and\r\n * the index that references them.\r\n *\r\n * @example\r\n * ```ts\r\n * const { index, sitemaps } = splitSitemap({\r\n * hostname: 'https://example.com',\r\n * urls: largeUrlArray,\r\n * });\r\n * // sitemaps[0].xml, sitemaps[1].xml, etc.\r\n * // index = sitemap index XML\r\n * ```\r\n */\r\nexport function splitSitemap(\r\n config: SitemapConfig,\r\n sitemapUrlPattern = '/sitemap-{index}.xml',\r\n): { index: string; sitemaps: Array<{ filename: string; xml: string }> } {\r\n const maxPerSitemap = config.maxUrlsPerSitemap ?? MAX_URLS_PER_SITEMAP;\r\n const { hostname, urls } = config;\r\n\r\n if (urls.length <= maxPerSitemap) {\r\n const xml = generateSitemap(config);\r\n const filename = sitemapUrlPattern.replace('{index}', '0');\r\n const indexEntries: SitemapIndexEntry[] = [{ loc: `${hostname}${filename}` }];\r\n return {\r\n index: generateSitemapIndex({ sitemaps: indexEntries }),\r\n sitemaps: [{ filename, xml }],\r\n };\r\n }\r\n\r\n const sitemaps: Array<{ filename: string; xml: string }> = [];\r\n const indexEntries: SitemapIndexEntry[] = [];\r\n\r\n for (let i = 0; i < urls.length; i += maxPerSitemap) {\r\n const chunk = urls.slice(i, i + maxPerSitemap);\r\n const chunkIndex = Math.floor(i / maxPerSitemap);\r\n const filename = sitemapUrlPattern.replace('{index}', String(chunkIndex));\r\n const xml = generateSitemap({ hostname, urls: chunk });\r\n\r\n sitemaps.push({ filename, xml });\r\n indexEntries.push({ loc: `${hostname}${filename}` });\r\n }\r\n\r\n return {\r\n index: generateSitemapIndex({ sitemaps: indexEntries }),\r\n sitemaps,\r\n };\r\n}\r\n","// ============================================================================\r\n// @power-seo/sitemap — Streaming Sitemap Generator\r\n// ============================================================================\r\n\r\nimport type { SitemapURL } from '@power-seo/core';\r\nimport { normalizeUrl } from '@power-seo/core';\r\n\r\n/** Escape special XML characters. */\r\nfunction escapeXml(str: string): string {\r\n return str\r\n .replace(/&/g, '&amp;')\r\n .replace(/</g, '&lt;')\r\n .replace(/>/g, '&gt;')\r\n .replace(/\"/g, '&quot;')\r\n .replace(/'/g, '&apos;');\r\n}\r\n\r\n/**\r\n * A streaming sitemap generator that yields XML chunks.\r\n *\r\n * Useful for server responses where you want to stream the sitemap\r\n * instead of building the entire XML string in memory.\r\n *\r\n * @example\r\n * ```ts\r\n * const stream = streamSitemap('https://example.com', urls);\r\n * for (const chunk of stream) {\r\n * response.write(chunk);\r\n * }\r\n * ```\r\n */\r\nexport function* streamSitemap(\r\n hostname: string,\r\n urls: Iterable<SitemapURL>,\r\n): Generator<string, void, undefined> {\r\n yield '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n';\r\n yield '<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\\n';\r\n yield ' xmlns:image=\"http://www.google.com/schemas/sitemap-image/1.1\"\\n';\r\n yield ' xmlns:video=\"http://www.google.com/schemas/sitemap-video/1.1\"\\n';\r\n yield ' xmlns:news=\"http://www.google.com/schemas/sitemap-news/0.9\">\\n';\r\n\r\n for (const url of urls) {\r\n const loc = url.loc.startsWith('http')\r\n ? url.loc\r\n : normalizeUrl(`${hostname}${url.loc.startsWith('/') ? '' : '/'}${url.loc}`);\r\n\r\n yield ' <url>\\n';\r\n yield ` <loc>${escapeXml(loc)}</loc>\\n`;\r\n\r\n if (url.lastmod) yield ` <lastmod>${escapeXml(url.lastmod)}</lastmod>\\n`;\r\n if (url.changefreq) yield ` <changefreq>${url.changefreq}</changefreq>\\n`;\r\n if (url.priority !== undefined) yield ` <priority>${url.priority.toFixed(1)}</priority>\\n`;\r\n\r\n // Images\r\n if (url.images) {\r\n for (const img of url.images) {\r\n yield ' <image:image>\\n';\r\n yield ` <image:loc>${escapeXml(img.loc)}</image:loc>\\n`;\r\n if (img.caption) yield ` <image:caption>${escapeXml(img.caption)}</image:caption>\\n`;\r\n if (img.title) yield ` <image:title>${escapeXml(img.title)}</image:title>\\n`;\r\n yield ' </image:image>\\n';\r\n }\r\n }\r\n\r\n // Videos\r\n if (url.videos) {\r\n for (const vid of url.videos) {\r\n yield ' <video:video>\\n';\r\n yield ` <video:thumbnail_loc>${escapeXml(vid.thumbnailLoc)}</video:thumbnail_loc>\\n`;\r\n yield ` <video:title>${escapeXml(vid.title)}</video:title>\\n`;\r\n yield ` <video:description>${escapeXml(vid.description)}</video:description>\\n`;\r\n if (vid.contentLoc) yield ` <video:content_loc>${escapeXml(vid.contentLoc)}</video:content_loc>\\n`;\r\n if (vid.playerLoc) yield ` <video:player_loc>${escapeXml(vid.playerLoc)}</video:player_loc>\\n`;\r\n yield ' </video:video>\\n';\r\n }\r\n }\r\n\r\n // News\r\n if (url.news) {\r\n yield ' <news:news>\\n';\r\n yield ' <news:publication>\\n';\r\n yield ` <news:name>${escapeXml(url.news.publication.name)}</news:name>\\n`;\r\n yield ` <news:language>${escapeXml(url.news.publication.language)}</news:language>\\n`;\r\n yield ' </news:publication>\\n';\r\n yield ` <news:publication_date>${escapeXml(url.news.publicationDate)}</news:publication_date>\\n`;\r\n yield ` <news:title>${escapeXml(url.news.title)}</news:title>\\n`;\r\n yield ' </news:news>\\n';\r\n }\r\n\r\n yield ' </url>\\n';\r\n }\r\n\r\n yield '</urlset>\\n';\r\n}\r\n","// ============================================================================\r\n// @power-seo/sitemap — URL Validation\r\n// ============================================================================\r\n\r\nimport type { SitemapURL } from '@power-seo/core';\r\nimport { isAbsoluteUrl, MAX_URL_LENGTH } from '@power-seo/core';\r\nimport type { SitemapValidationResult } from './types.js';\r\n\r\nconst VALID_CHANGEFREQ = ['always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never'];\r\n\r\n/**\r\n * Validate a sitemap URL entry against the sitemap protocol spec.\r\n */\r\nexport function validateSitemapUrl(url: SitemapURL): SitemapValidationResult {\r\n const errors: string[] = [];\r\n const warnings: string[] = [];\r\n\r\n // loc is required\r\n if (!url.loc || url.loc.trim().length === 0) {\r\n errors.push('URL \"loc\" is required and cannot be empty.');\r\n } else {\r\n if (!isAbsoluteUrl(url.loc)) {\r\n errors.push(`URL \"${url.loc}\" must be an absolute URL (starting with http:// or https://).`);\r\n }\r\n\r\n if (url.loc.length > 2048) {\r\n errors.push(`URL \"${url.loc}\" exceeds the maximum length of 2048 characters.`);\r\n }\r\n\r\n if (url.loc.length > MAX_URL_LENGTH) {\r\n warnings.push(\r\n `URL \"${url.loc}\" is ${url.loc.length} characters. URLs under ${MAX_URL_LENGTH} characters are recommended for SEO.`,\r\n );\r\n }\r\n }\r\n\r\n // lastmod validation\r\n if (url.lastmod) {\r\n const dateRegex = /^\\d{4}-\\d{2}-\\d{2}(T\\d{2}:\\d{2}(:\\d{2})?([+-]\\d{2}:\\d{2}|Z)?)?$/;\r\n if (!dateRegex.test(url.lastmod)) {\r\n errors.push(\r\n `\"lastmod\" value \"${url.lastmod}\" is not a valid W3C datetime format (YYYY-MM-DD or ISO 8601).`,\r\n );\r\n }\r\n }\r\n\r\n // changefreq validation\r\n if (url.changefreq && !VALID_CHANGEFREQ.includes(url.changefreq)) {\r\n errors.push(\r\n `\"changefreq\" value \"${url.changefreq}\" is invalid. Must be one of: ${VALID_CHANGEFREQ.join(', ')}.`,\r\n );\r\n }\r\n\r\n // priority validation\r\n if (url.priority !== undefined) {\r\n if (url.priority < 0 || url.priority > 1) {\r\n errors.push(`\"priority\" value ${url.priority} is out of range. Must be between 0.0 and 1.0.`);\r\n }\r\n }\r\n\r\n // Image validation\r\n if (url.images) {\r\n for (let i = 0; i < url.images.length; i++) {\r\n const img = url.images[i]!;\r\n if (!img.loc || img.loc.trim().length === 0) {\r\n errors.push(`Image ${i + 1}: \"loc\" is required.`);\r\n } else if (!isAbsoluteUrl(img.loc)) {\r\n errors.push(`Image ${i + 1}: \"${img.loc}\" must be an absolute URL.`);\r\n }\r\n }\r\n if (url.images.length > 1000) {\r\n warnings.push(`URL has ${url.images.length} images. Google supports up to 1,000 images per page.`);\r\n }\r\n }\r\n\r\n // Video validation\r\n if (url.videos) {\r\n for (let i = 0; i < url.videos.length; i++) {\r\n const vid = url.videos[i]!;\r\n if (!vid.title) errors.push(`Video ${i + 1}: \"title\" is required.`);\r\n if (!vid.description) errors.push(`Video ${i + 1}: \"description\" is required.`);\r\n if (!vid.thumbnailLoc) errors.push(`Video ${i + 1}: \"thumbnailLoc\" is required.`);\r\n if (!vid.contentLoc && !vid.playerLoc) {\r\n errors.push(`Video ${i + 1}: either \"contentLoc\" or \"playerLoc\" must be provided.`);\r\n }\r\n if (vid.rating !== undefined && (vid.rating < 0 || vid.rating > 5)) {\r\n errors.push(`Video ${i + 1}: \"rating\" must be between 0.0 and 5.0.`);\r\n }\r\n }\r\n }\r\n\r\n // News validation\r\n if (url.news) {\r\n if (!url.news.publication?.name) errors.push('News: \"publication.name\" is required.');\r\n if (!url.news.publication?.language) errors.push('News: \"publication.language\" is required.');\r\n if (!url.news.publicationDate) errors.push('News: \"publicationDate\" is required.');\r\n if (!url.news.title) errors.push('News: \"title\" is required.');\r\n }\r\n\r\n return {\r\n valid: errors.length === 0,\r\n errors,\r\n warnings,\r\n };\r\n}\r\n"]}
@@ -0,0 +1,100 @@
1
+ import { SitemapConfig, SitemapURL } from '@power-seo/core';
2
+ export { SitemapConfig, SitemapImage, SitemapNews, SitemapURL, SitemapVideo } from '@power-seo/core';
3
+
4
+ /**
5
+ * Generate an XML sitemap string from a sitemap configuration.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * const xml = generateSitemap({
10
+ * hostname: 'https://example.com',
11
+ * urls: [
12
+ * { loc: '/', changefreq: 'daily', priority: 1.0 },
13
+ * { loc: '/about', changefreq: 'monthly', priority: 0.8 },
14
+ * ],
15
+ * });
16
+ * ```
17
+ */
18
+ declare function generateSitemap(config: SitemapConfig): string;
19
+
20
+ /** A sitemap entry in a sitemap index. */
21
+ interface SitemapIndexEntry {
22
+ loc: string;
23
+ lastmod?: string;
24
+ }
25
+ /** Configuration for the sitemap index generator. */
26
+ interface SitemapIndexConfig {
27
+ sitemaps: SitemapIndexEntry[];
28
+ }
29
+ /** Result of URL validation. */
30
+ interface SitemapValidationResult {
31
+ valid: boolean;
32
+ errors: string[];
33
+ warnings: string[];
34
+ }
35
+ /** Maximum URLs allowed per sitemap file. */
36
+ declare const MAX_URLS_PER_SITEMAP = 50000;
37
+ /** Maximum sitemap file size in bytes (50MB). */
38
+ declare const MAX_SITEMAP_SIZE_BYTES: number;
39
+
40
+ /**
41
+ * Generate a sitemap index XML string.
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * const indexXml = generateSitemapIndex({
46
+ * sitemaps: [
47
+ * { loc: 'https://example.com/sitemap-0.xml', lastmod: '2024-01-01' },
48
+ * { loc: 'https://example.com/sitemap-1.xml', lastmod: '2024-01-01' },
49
+ * ],
50
+ * });
51
+ * ```
52
+ */
53
+ declare function generateSitemapIndex(config: SitemapIndexConfig): string;
54
+ /**
55
+ * Split a large sitemap config into multiple sitemaps + an index.
56
+ *
57
+ * When a site has more than 50,000 URLs, this function splits them into
58
+ * multiple sitemap files and returns both the individual sitemaps and
59
+ * the index that references them.
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * const { index, sitemaps } = splitSitemap({
64
+ * hostname: 'https://example.com',
65
+ * urls: largeUrlArray,
66
+ * });
67
+ * // sitemaps[0].xml, sitemaps[1].xml, etc.
68
+ * // index = sitemap index XML
69
+ * ```
70
+ */
71
+ declare function splitSitemap(config: SitemapConfig, sitemapUrlPattern?: string): {
72
+ index: string;
73
+ sitemaps: Array<{
74
+ filename: string;
75
+ xml: string;
76
+ }>;
77
+ };
78
+
79
+ /**
80
+ * A streaming sitemap generator that yields XML chunks.
81
+ *
82
+ * Useful for server responses where you want to stream the sitemap
83
+ * instead of building the entire XML string in memory.
84
+ *
85
+ * @example
86
+ * ```ts
87
+ * const stream = streamSitemap('https://example.com', urls);
88
+ * for (const chunk of stream) {
89
+ * response.write(chunk);
90
+ * }
91
+ * ```
92
+ */
93
+ declare function streamSitemap(hostname: string, urls: Iterable<SitemapURL>): Generator<string, void, undefined>;
94
+
95
+ /**
96
+ * Validate a sitemap URL entry against the sitemap protocol spec.
97
+ */
98
+ declare function validateSitemapUrl(url: SitemapURL): SitemapValidationResult;
99
+
100
+ export { MAX_SITEMAP_SIZE_BYTES, MAX_URLS_PER_SITEMAP, type SitemapIndexConfig, type SitemapIndexEntry, type SitemapValidationResult, generateSitemap, generateSitemapIndex, splitSitemap, streamSitemap, validateSitemapUrl };
@@ -0,0 +1,100 @@
1
+ import { SitemapConfig, SitemapURL } from '@power-seo/core';
2
+ export { SitemapConfig, SitemapImage, SitemapNews, SitemapURL, SitemapVideo } from '@power-seo/core';
3
+
4
+ /**
5
+ * Generate an XML sitemap string from a sitemap configuration.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * const xml = generateSitemap({
10
+ * hostname: 'https://example.com',
11
+ * urls: [
12
+ * { loc: '/', changefreq: 'daily', priority: 1.0 },
13
+ * { loc: '/about', changefreq: 'monthly', priority: 0.8 },
14
+ * ],
15
+ * });
16
+ * ```
17
+ */
18
+ declare function generateSitemap(config: SitemapConfig): string;
19
+
20
+ /** A sitemap entry in a sitemap index. */
21
+ interface SitemapIndexEntry {
22
+ loc: string;
23
+ lastmod?: string;
24
+ }
25
+ /** Configuration for the sitemap index generator. */
26
+ interface SitemapIndexConfig {
27
+ sitemaps: SitemapIndexEntry[];
28
+ }
29
+ /** Result of URL validation. */
30
+ interface SitemapValidationResult {
31
+ valid: boolean;
32
+ errors: string[];
33
+ warnings: string[];
34
+ }
35
+ /** Maximum URLs allowed per sitemap file. */
36
+ declare const MAX_URLS_PER_SITEMAP = 50000;
37
+ /** Maximum sitemap file size in bytes (50MB). */
38
+ declare const MAX_SITEMAP_SIZE_BYTES: number;
39
+
40
+ /**
41
+ * Generate a sitemap index XML string.
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * const indexXml = generateSitemapIndex({
46
+ * sitemaps: [
47
+ * { loc: 'https://example.com/sitemap-0.xml', lastmod: '2024-01-01' },
48
+ * { loc: 'https://example.com/sitemap-1.xml', lastmod: '2024-01-01' },
49
+ * ],
50
+ * });
51
+ * ```
52
+ */
53
+ declare function generateSitemapIndex(config: SitemapIndexConfig): string;
54
+ /**
55
+ * Split a large sitemap config into multiple sitemaps + an index.
56
+ *
57
+ * When a site has more than 50,000 URLs, this function splits them into
58
+ * multiple sitemap files and returns both the individual sitemaps and
59
+ * the index that references them.
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * const { index, sitemaps } = splitSitemap({
64
+ * hostname: 'https://example.com',
65
+ * urls: largeUrlArray,
66
+ * });
67
+ * // sitemaps[0].xml, sitemaps[1].xml, etc.
68
+ * // index = sitemap index XML
69
+ * ```
70
+ */
71
+ declare function splitSitemap(config: SitemapConfig, sitemapUrlPattern?: string): {
72
+ index: string;
73
+ sitemaps: Array<{
74
+ filename: string;
75
+ xml: string;
76
+ }>;
77
+ };
78
+
79
+ /**
80
+ * A streaming sitemap generator that yields XML chunks.
81
+ *
82
+ * Useful for server responses where you want to stream the sitemap
83
+ * instead of building the entire XML string in memory.
84
+ *
85
+ * @example
86
+ * ```ts
87
+ * const stream = streamSitemap('https://example.com', urls);
88
+ * for (const chunk of stream) {
89
+ * response.write(chunk);
90
+ * }
91
+ * ```
92
+ */
93
+ declare function streamSitemap(hostname: string, urls: Iterable<SitemapURL>): Generator<string, void, undefined>;
94
+
95
+ /**
96
+ * Validate a sitemap URL entry against the sitemap protocol spec.
97
+ */
98
+ declare function validateSitemapUrl(url: SitemapURL): SitemapValidationResult;
99
+
100
+ export { MAX_SITEMAP_SIZE_BYTES, MAX_URLS_PER_SITEMAP, type SitemapIndexConfig, type SitemapIndexEntry, type SitemapValidationResult, generateSitemap, generateSitemapIndex, splitSitemap, streamSitemap, validateSitemapUrl };
package/dist/index.js ADDED
@@ -0,0 +1,311 @@
1
+ import { normalizeUrl, isAbsoluteUrl, MAX_URL_LENGTH } from '@power-seo/core';
2
+
3
+ // src/generator.ts
4
+ function escapeXml(str) {
5
+ return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
6
+ }
7
+ function detectNamespaces(urls) {
8
+ let image = false;
9
+ let video = false;
10
+ let news = false;
11
+ for (const url of urls) {
12
+ if (url.images && url.images.length > 0) image = true;
13
+ if (url.videos && url.videos.length > 0) video = true;
14
+ if (url.news) news = true;
15
+ if (image && video && news) break;
16
+ }
17
+ return { image, video, news };
18
+ }
19
+ function buildImageXml(images) {
20
+ return images.map((img) => {
21
+ let xml = " <image:image>\n";
22
+ xml += ` <image:loc>${escapeXml(img.loc)}</image:loc>
23
+ `;
24
+ if (img.caption) xml += ` <image:caption>${escapeXml(img.caption)}</image:caption>
25
+ `;
26
+ if (img.geoLocation) xml += ` <image:geo_location>${escapeXml(img.geoLocation)}</image:geo_location>
27
+ `;
28
+ if (img.title) xml += ` <image:title>${escapeXml(img.title)}</image:title>
29
+ `;
30
+ if (img.license) xml += ` <image:license>${escapeXml(img.license)}</image:license>
31
+ `;
32
+ xml += " </image:image>\n";
33
+ return xml;
34
+ }).join("");
35
+ }
36
+ function buildVideoXml(videos) {
37
+ return videos.map((vid) => {
38
+ let xml = " <video:video>\n";
39
+ xml += ` <video:thumbnail_loc>${escapeXml(vid.thumbnailLoc)}</video:thumbnail_loc>
40
+ `;
41
+ xml += ` <video:title>${escapeXml(vid.title)}</video:title>
42
+ `;
43
+ xml += ` <video:description>${escapeXml(vid.description)}</video:description>
44
+ `;
45
+ if (vid.contentLoc) xml += ` <video:content_loc>${escapeXml(vid.contentLoc)}</video:content_loc>
46
+ `;
47
+ if (vid.playerLoc) xml += ` <video:player_loc>${escapeXml(vid.playerLoc)}</video:player_loc>
48
+ `;
49
+ if (vid.duration !== void 0) xml += ` <video:duration>${vid.duration}</video:duration>
50
+ `;
51
+ if (vid.expirationDate) xml += ` <video:expiration_date>${escapeXml(vid.expirationDate)}</video:expiration_date>
52
+ `;
53
+ if (vid.rating !== void 0) xml += ` <video:rating>${vid.rating}</video:rating>
54
+ `;
55
+ if (vid.viewCount !== void 0) xml += ` <video:view_count>${vid.viewCount}</video:view_count>
56
+ `;
57
+ if (vid.publicationDate) xml += ` <video:publication_date>${escapeXml(vid.publicationDate)}</video:publication_date>
58
+ `;
59
+ if (vid.familyFriendly !== void 0) xml += ` <video:family_friendly>${vid.familyFriendly ? "yes" : "no"}</video:family_friendly>
60
+ `;
61
+ if (vid.live !== void 0) xml += ` <video:live>${vid.live ? "yes" : "no"}</video:live>
62
+ `;
63
+ xml += " </video:video>\n";
64
+ return xml;
65
+ }).join("");
66
+ }
67
+ function buildNewsXml(news) {
68
+ let xml = " <news:news>\n";
69
+ xml += " <news:publication>\n";
70
+ xml += ` <news:name>${escapeXml(news.publication.name)}</news:name>
71
+ `;
72
+ xml += ` <news:language>${escapeXml(news.publication.language)}</news:language>
73
+ `;
74
+ xml += " </news:publication>\n";
75
+ xml += ` <news:publication_date>${escapeXml(news.publicationDate)}</news:publication_date>
76
+ `;
77
+ xml += ` <news:title>${escapeXml(news.title)}</news:title>
78
+ `;
79
+ xml += " </news:news>\n";
80
+ return xml;
81
+ }
82
+ function buildUrlXml(url, hostname) {
83
+ const loc = url.loc.startsWith("http") ? url.loc : normalizeUrl(`${hostname}${url.loc.startsWith("/") ? "" : "/"}${url.loc}`);
84
+ let xml = " <url>\n";
85
+ xml += ` <loc>${escapeXml(loc)}</loc>
86
+ `;
87
+ if (url.lastmod) xml += ` <lastmod>${escapeXml(url.lastmod)}</lastmod>
88
+ `;
89
+ if (url.changefreq) xml += ` <changefreq>${url.changefreq}</changefreq>
90
+ `;
91
+ if (url.priority !== void 0) xml += ` <priority>${url.priority.toFixed(1)}</priority>
92
+ `;
93
+ if (url.images && url.images.length > 0) xml += buildImageXml(url.images);
94
+ if (url.videos && url.videos.length > 0) xml += buildVideoXml(url.videos);
95
+ if (url.news) xml += buildNewsXml(url.news);
96
+ xml += " </url>\n";
97
+ return xml;
98
+ }
99
+ function generateSitemap(config) {
100
+ const { hostname, urls } = config;
101
+ const ns = detectNamespaces(urls);
102
+ let xml = '<?xml version="1.0" encoding="UTF-8"?>\n';
103
+ xml += '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"';
104
+ if (ns.image) xml += '\n xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"';
105
+ if (ns.video) xml += '\n xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"';
106
+ if (ns.news) xml += '\n xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"';
107
+ xml += ">\n";
108
+ for (const url of urls) {
109
+ xml += buildUrlXml(url, hostname);
110
+ }
111
+ xml += "</urlset>\n";
112
+ return xml;
113
+ }
114
+
115
+ // src/types.ts
116
+ var MAX_URLS_PER_SITEMAP = 5e4;
117
+ var MAX_SITEMAP_SIZE_BYTES = 50 * 1024 * 1024;
118
+
119
+ // src/sitemap-index.ts
120
+ function escapeXml2(str) {
121
+ return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
122
+ }
123
+ function generateSitemapIndex(config) {
124
+ let xml = '<?xml version="1.0" encoding="UTF-8"?>\n';
125
+ xml += '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n';
126
+ for (const sitemap of config.sitemaps) {
127
+ xml += " <sitemap>\n";
128
+ xml += ` <loc>${escapeXml2(sitemap.loc)}</loc>
129
+ `;
130
+ if (sitemap.lastmod) {
131
+ xml += ` <lastmod>${escapeXml2(sitemap.lastmod)}</lastmod>
132
+ `;
133
+ }
134
+ xml += " </sitemap>\n";
135
+ }
136
+ xml += "</sitemapindex>\n";
137
+ return xml;
138
+ }
139
+ function splitSitemap(config, sitemapUrlPattern = "/sitemap-{index}.xml") {
140
+ const maxPerSitemap = config.maxUrlsPerSitemap ?? MAX_URLS_PER_SITEMAP;
141
+ const { hostname, urls } = config;
142
+ if (urls.length <= maxPerSitemap) {
143
+ const xml = generateSitemap(config);
144
+ const filename = sitemapUrlPattern.replace("{index}", "0");
145
+ const indexEntries2 = [{ loc: `${hostname}${filename}` }];
146
+ return {
147
+ index: generateSitemapIndex({ sitemaps: indexEntries2 }),
148
+ sitemaps: [{ filename, xml }]
149
+ };
150
+ }
151
+ const sitemaps = [];
152
+ const indexEntries = [];
153
+ for (let i = 0; i < urls.length; i += maxPerSitemap) {
154
+ const chunk = urls.slice(i, i + maxPerSitemap);
155
+ const chunkIndex = Math.floor(i / maxPerSitemap);
156
+ const filename = sitemapUrlPattern.replace("{index}", String(chunkIndex));
157
+ const xml = generateSitemap({ hostname, urls: chunk });
158
+ sitemaps.push({ filename, xml });
159
+ indexEntries.push({ loc: `${hostname}${filename}` });
160
+ }
161
+ return {
162
+ index: generateSitemapIndex({ sitemaps: indexEntries }),
163
+ sitemaps
164
+ };
165
+ }
166
+ function escapeXml3(str) {
167
+ return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
168
+ }
169
+ function* streamSitemap(hostname, urls) {
170
+ yield '<?xml version="1.0" encoding="UTF-8"?>\n';
171
+ yield '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"\n';
172
+ yield ' xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"\n';
173
+ yield ' xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"\n';
174
+ yield ' xmlns:news="http://www.google.com/schemas/sitemap-news/0.9">\n';
175
+ for (const url of urls) {
176
+ const loc = url.loc.startsWith("http") ? url.loc : normalizeUrl(`${hostname}${url.loc.startsWith("/") ? "" : "/"}${url.loc}`);
177
+ yield " <url>\n";
178
+ yield ` <loc>${escapeXml3(loc)}</loc>
179
+ `;
180
+ if (url.lastmod) yield ` <lastmod>${escapeXml3(url.lastmod)}</lastmod>
181
+ `;
182
+ if (url.changefreq) yield ` <changefreq>${url.changefreq}</changefreq>
183
+ `;
184
+ if (url.priority !== void 0) yield ` <priority>${url.priority.toFixed(1)}</priority>
185
+ `;
186
+ if (url.images) {
187
+ for (const img of url.images) {
188
+ yield " <image:image>\n";
189
+ yield ` <image:loc>${escapeXml3(img.loc)}</image:loc>
190
+ `;
191
+ if (img.caption) yield ` <image:caption>${escapeXml3(img.caption)}</image:caption>
192
+ `;
193
+ if (img.title) yield ` <image:title>${escapeXml3(img.title)}</image:title>
194
+ `;
195
+ yield " </image:image>\n";
196
+ }
197
+ }
198
+ if (url.videos) {
199
+ for (const vid of url.videos) {
200
+ yield " <video:video>\n";
201
+ yield ` <video:thumbnail_loc>${escapeXml3(vid.thumbnailLoc)}</video:thumbnail_loc>
202
+ `;
203
+ yield ` <video:title>${escapeXml3(vid.title)}</video:title>
204
+ `;
205
+ yield ` <video:description>${escapeXml3(vid.description)}</video:description>
206
+ `;
207
+ if (vid.contentLoc) yield ` <video:content_loc>${escapeXml3(vid.contentLoc)}</video:content_loc>
208
+ `;
209
+ if (vid.playerLoc) yield ` <video:player_loc>${escapeXml3(vid.playerLoc)}</video:player_loc>
210
+ `;
211
+ yield " </video:video>\n";
212
+ }
213
+ }
214
+ if (url.news) {
215
+ yield " <news:news>\n";
216
+ yield " <news:publication>\n";
217
+ yield ` <news:name>${escapeXml3(url.news.publication.name)}</news:name>
218
+ `;
219
+ yield ` <news:language>${escapeXml3(url.news.publication.language)}</news:language>
220
+ `;
221
+ yield " </news:publication>\n";
222
+ yield ` <news:publication_date>${escapeXml3(url.news.publicationDate)}</news:publication_date>
223
+ `;
224
+ yield ` <news:title>${escapeXml3(url.news.title)}</news:title>
225
+ `;
226
+ yield " </news:news>\n";
227
+ }
228
+ yield " </url>\n";
229
+ }
230
+ yield "</urlset>\n";
231
+ }
232
+ var VALID_CHANGEFREQ = ["always", "hourly", "daily", "weekly", "monthly", "yearly", "never"];
233
+ function validateSitemapUrl(url) {
234
+ const errors = [];
235
+ const warnings = [];
236
+ if (!url.loc || url.loc.trim().length === 0) {
237
+ errors.push('URL "loc" is required and cannot be empty.');
238
+ } else {
239
+ if (!isAbsoluteUrl(url.loc)) {
240
+ errors.push(`URL "${url.loc}" must be an absolute URL (starting with http:// or https://).`);
241
+ }
242
+ if (url.loc.length > 2048) {
243
+ errors.push(`URL "${url.loc}" exceeds the maximum length of 2048 characters.`);
244
+ }
245
+ if (url.loc.length > MAX_URL_LENGTH) {
246
+ warnings.push(
247
+ `URL "${url.loc}" is ${url.loc.length} characters. URLs under ${MAX_URL_LENGTH} characters are recommended for SEO.`
248
+ );
249
+ }
250
+ }
251
+ if (url.lastmod) {
252
+ const dateRegex = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(:\d{2})?([+-]\d{2}:\d{2}|Z)?)?$/;
253
+ if (!dateRegex.test(url.lastmod)) {
254
+ errors.push(
255
+ `"lastmod" value "${url.lastmod}" is not a valid W3C datetime format (YYYY-MM-DD or ISO 8601).`
256
+ );
257
+ }
258
+ }
259
+ if (url.changefreq && !VALID_CHANGEFREQ.includes(url.changefreq)) {
260
+ errors.push(
261
+ `"changefreq" value "${url.changefreq}" is invalid. Must be one of: ${VALID_CHANGEFREQ.join(", ")}.`
262
+ );
263
+ }
264
+ if (url.priority !== void 0) {
265
+ if (url.priority < 0 || url.priority > 1) {
266
+ errors.push(`"priority" value ${url.priority} is out of range. Must be between 0.0 and 1.0.`);
267
+ }
268
+ }
269
+ if (url.images) {
270
+ for (let i = 0; i < url.images.length; i++) {
271
+ const img = url.images[i];
272
+ if (!img.loc || img.loc.trim().length === 0) {
273
+ errors.push(`Image ${i + 1}: "loc" is required.`);
274
+ } else if (!isAbsoluteUrl(img.loc)) {
275
+ errors.push(`Image ${i + 1}: "${img.loc}" must be an absolute URL.`);
276
+ }
277
+ }
278
+ if (url.images.length > 1e3) {
279
+ warnings.push(`URL has ${url.images.length} images. Google supports up to 1,000 images per page.`);
280
+ }
281
+ }
282
+ if (url.videos) {
283
+ for (let i = 0; i < url.videos.length; i++) {
284
+ const vid = url.videos[i];
285
+ if (!vid.title) errors.push(`Video ${i + 1}: "title" is required.`);
286
+ if (!vid.description) errors.push(`Video ${i + 1}: "description" is required.`);
287
+ if (!vid.thumbnailLoc) errors.push(`Video ${i + 1}: "thumbnailLoc" is required.`);
288
+ if (!vid.contentLoc && !vid.playerLoc) {
289
+ errors.push(`Video ${i + 1}: either "contentLoc" or "playerLoc" must be provided.`);
290
+ }
291
+ if (vid.rating !== void 0 && (vid.rating < 0 || vid.rating > 5)) {
292
+ errors.push(`Video ${i + 1}: "rating" must be between 0.0 and 5.0.`);
293
+ }
294
+ }
295
+ }
296
+ if (url.news) {
297
+ if (!url.news.publication?.name) errors.push('News: "publication.name" is required.');
298
+ if (!url.news.publication?.language) errors.push('News: "publication.language" is required.');
299
+ if (!url.news.publicationDate) errors.push('News: "publicationDate" is required.');
300
+ if (!url.news.title) errors.push('News: "title" is required.');
301
+ }
302
+ return {
303
+ valid: errors.length === 0,
304
+ errors,
305
+ warnings
306
+ };
307
+ }
308
+
309
+ export { MAX_SITEMAP_SIZE_BYTES, MAX_URLS_PER_SITEMAP, generateSitemap, generateSitemapIndex, splitSitemap, streamSitemap, validateSitemapUrl };
310
+ //# sourceMappingURL=index.js.map
311
+ //# sourceMappingURL=index.js.map