@docusaurus/plugin-sitemap 3.8.0 → 3.8.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.
@@ -10,12 +10,18 @@ exports.createSitemapItem = createSitemapItem;
10
10
  const utils_common_1 = require("@docusaurus/utils-common");
11
11
  const utils_1 = require("@docusaurus/utils");
12
12
  async function getRouteLastUpdatedAt(route) {
13
+ // Important to bail-out early here
14
+ // This can lead to duplicated getLastUpdate() calls and performance problems
15
+ // See https://github.com/facebook/docusaurus/pull/11211
16
+ if (route.metadata?.lastUpdatedAt === null) {
17
+ return null;
18
+ }
13
19
  if (route.metadata?.lastUpdatedAt) {
14
20
  return route.metadata?.lastUpdatedAt;
15
21
  }
16
22
  if (route.metadata?.sourceFilePath) {
17
23
  const lastUpdate = await (0, utils_1.getLastUpdate)(route.metadata?.sourceFilePath);
18
- return lastUpdate?.lastUpdatedAt;
24
+ return lastUpdate?.lastUpdatedAt ?? null;
19
25
  }
20
26
  return undefined;
21
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-sitemap",
3
- "version": "3.8.0",
3
+ "version": "3.8.1",
4
4
  "description": "Simple sitemap generation plugin for Docusaurus.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -18,12 +18,12 @@
18
18
  },
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "@docusaurus/core": "3.8.0",
22
- "@docusaurus/logger": "3.8.0",
23
- "@docusaurus/types": "3.8.0",
24
- "@docusaurus/utils": "3.8.0",
25
- "@docusaurus/utils-common": "3.8.0",
26
- "@docusaurus/utils-validation": "3.8.0",
21
+ "@docusaurus/core": "3.8.1",
22
+ "@docusaurus/logger": "3.8.1",
23
+ "@docusaurus/types": "3.8.1",
24
+ "@docusaurus/utils": "3.8.1",
25
+ "@docusaurus/utils-common": "3.8.1",
26
+ "@docusaurus/utils-validation": "3.8.1",
27
27
  "fs-extra": "^11.1.1",
28
28
  "sitemap": "^7.1.1",
29
29
  "tslib": "^2.6.0"
@@ -38,5 +38,5 @@
38
38
  "engines": {
39
39
  "node": ">=18.0"
40
40
  },
41
- "gitHead": "948d63c42fad0ba24b7b531a9deb6167e64dc845"
41
+ "gitHead": "fa8ae13e668fcbc0481ce10c0a734e2a5b397293"
42
42
  }
@@ -13,13 +13,19 @@ import type {PluginOptions} from './options';
13
13
 
14
14
  async function getRouteLastUpdatedAt(
15
15
  route: RouteConfig,
16
- ): Promise<number | undefined> {
16
+ ): Promise<number | null | undefined> {
17
+ // Important to bail-out early here
18
+ // This can lead to duplicated getLastUpdate() calls and performance problems
19
+ // See https://github.com/facebook/docusaurus/pull/11211
20
+ if (route.metadata?.lastUpdatedAt === null) {
21
+ return null;
22
+ }
17
23
  if (route.metadata?.lastUpdatedAt) {
18
24
  return route.metadata?.lastUpdatedAt;
19
25
  }
20
26
  if (route.metadata?.sourceFilePath) {
21
27
  const lastUpdate = await getLastUpdate(route.metadata?.sourceFilePath);
22
- return lastUpdate?.lastUpdatedAt;
28
+ return lastUpdate?.lastUpdatedAt ?? null;
23
29
  }
24
30
 
25
31
  return undefined;