@docusaurus/plugin-sitemap 4.0.0-canary-6879 → 4.0.0-canary-6881

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 (3) hide show
  1. package/lib/xml.js +5 -6
  2. package/package.json +10 -10
  3. package/src/xml.ts +5 -6
package/lib/xml.js CHANGED
@@ -10,14 +10,13 @@ exports.sitemapItemsToXmlString = sitemapItemsToXmlString;
10
10
  const sitemap_1 = require("sitemap");
11
11
  async function sitemapItemsToXmlString(items, options) {
12
12
  if (items.length === 0) {
13
- // Note: technically we could, but there is a bug in the lib code
14
- // and the code below would never resolve, so it's better to fail fast
13
+ // Fail fast with a clearer error than the lib's EmptySitemap error
15
14
  throw new Error("Can't generate a sitemap with no items");
16
15
  }
17
- // TODO remove sitemap lib dependency?
18
- // https://github.com/ekalinin/sitemap.js
19
- // it looks like an outdated confusion super old lib
20
- // we might as well achieve the same result with a pure xml lib
16
+ // We could generate the XML ourselves, but we keep using the lib on purpose
17
+ // Users can return undocumented fields from createSitemapItems()
18
+ // (links, img, video, news...) that the lib serializes
19
+ // See https://github.com/ekalinin/sitemap.js
21
20
  const sitemapStream = new sitemap_1.SitemapStream({
22
21
  // WTF is this lib reformatting the string YYYY-MM-DD to datetime...
23
22
  lastmodDateOnly: options?.lastmod === 'date',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-sitemap",
3
- "version": "4.0.0-canary-6879",
3
+ "version": "4.0.0-canary-6881",
4
4
  "description": "Simple sitemap generation plugin for Docusaurus.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -18,15 +18,15 @@
18
18
  },
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "@docusaurus/core": "4.0.0-canary-6879",
22
- "@docusaurus/glob": "4.0.0-canary-6879",
23
- "@docusaurus/logger": "4.0.0-canary-6879",
24
- "@docusaurus/types": "4.0.0-canary-6879",
25
- "@docusaurus/utils": "4.0.0-canary-6879",
26
- "@docusaurus/utils-common": "4.0.0-canary-6879",
27
- "@docusaurus/utils-validation": "4.0.0-canary-6879",
21
+ "@docusaurus/core": "4.0.0-canary-6881",
22
+ "@docusaurus/glob": "4.0.0-canary-6881",
23
+ "@docusaurus/logger": "4.0.0-canary-6881",
24
+ "@docusaurus/types": "4.0.0-canary-6881",
25
+ "@docusaurus/utils": "4.0.0-canary-6881",
26
+ "@docusaurus/utils-common": "4.0.0-canary-6881",
27
+ "@docusaurus/utils-validation": "4.0.0-canary-6881",
28
28
  "fs-extra": "^11.4.0",
29
- "sitemap": "^7.1.3",
29
+ "sitemap": "^9.0.1",
30
30
  "tslib": "^2.8.1"
31
31
  },
32
32
  "devDependencies": {
@@ -39,5 +39,5 @@
39
39
  "engines": {
40
40
  "node": ">=24.21"
41
41
  },
42
- "gitHead": "d86dd389fe2697b91e54d351ecdc28498dead0f7"
42
+ "gitHead": "e430343b0caccec7c7db3553dca51f181d3d9c3b"
43
43
  }
package/src/xml.ts CHANGED
@@ -13,15 +13,14 @@ export async function sitemapItemsToXmlString(
13
13
  options: {lastmod: LastModOption | null},
14
14
  ): Promise<string> {
15
15
  if (items.length === 0) {
16
- // Note: technically we could, but there is a bug in the lib code
17
- // and the code below would never resolve, so it's better to fail fast
16
+ // Fail fast with a clearer error than the lib's EmptySitemap error
18
17
  throw new Error("Can't generate a sitemap with no items");
19
18
  }
20
19
 
21
- // TODO remove sitemap lib dependency?
22
- // https://github.com/ekalinin/sitemap.js
23
- // it looks like an outdated confusion super old lib
24
- // we might as well achieve the same result with a pure xml lib
20
+ // We could generate the XML ourselves, but we keep using the lib on purpose
21
+ // Users can return undocumented fields from createSitemapItems()
22
+ // (links, img, video, news...) that the lib serializes
23
+ // See https://github.com/ekalinin/sitemap.js
25
24
  const sitemapStream = new SitemapStream({
26
25
  // WTF is this lib reformatting the string YYYY-MM-DD to datetime...
27
26
  lastmodDateOnly: options?.lastmod === 'date',