@docusaurus/plugin-client-redirects 3.10.1-canary-6603 → 3.10.1-canary-6608

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.
@@ -14,6 +14,14 @@ const utils_common_1 = require("@docusaurus/utils-common");
14
14
  const extensionRedirects_1 = require("./extensionRedirects");
15
15
  const redirectValidation_1 = require("./redirectValidation");
16
16
  function collectRedirects(pluginContext, trailingSlash) {
17
+ function normalizeRedirectTo(to) {
18
+ return to.startsWith('/')
19
+ ? (0, utils_common_1.applyTrailingSlash)(to, {
20
+ trailingSlash,
21
+ baseUrl: pluginContext.baseUrl,
22
+ })
23
+ : to;
24
+ }
17
25
  // For each plugin config option, create the appropriate redirects
18
26
  const redirects = [
19
27
  ...(0, extensionRedirects_1.createFromExtensionsRedirects)(pluginContext.relativeRoutesPaths, pluginContext.options.fromExtensions),
@@ -31,10 +39,7 @@ function collectRedirects(pluginContext, trailingSlash) {
31
39
  //
32
40
  // It should be easy to toggle `trailingSlash` option without having to
33
41
  // change other configs
34
- to: (0, utils_common_1.applyTrailingSlash)(redirect.to, {
35
- trailingSlash,
36
- baseUrl: pluginContext.baseUrl,
37
- }),
42
+ to: normalizeRedirectTo(redirect.to),
38
43
  }));
39
44
  validateCollectedRedirects(redirects, pluginContext);
40
45
  return filterUnwantedRedirects(redirects, pluginContext);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-client-redirects",
3
- "version": "3.10.1-canary-6603",
3
+ "version": "3.10.1-canary-6608",
4
4
  "description": "Client redirects plugin for Docusaurus.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -18,18 +18,18 @@
18
18
  },
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "@docusaurus/core": "3.10.1-canary-6603",
22
- "@docusaurus/logger": "3.10.1-canary-6603",
23
- "@docusaurus/utils": "3.10.1-canary-6603",
24
- "@docusaurus/utils-common": "3.10.1-canary-6603",
25
- "@docusaurus/utils-validation": "3.10.1-canary-6603",
21
+ "@docusaurus/core": "3.10.1-canary-6608",
22
+ "@docusaurus/logger": "3.10.1-canary-6608",
23
+ "@docusaurus/utils": "3.10.1-canary-6608",
24
+ "@docusaurus/utils-common": "3.10.1-canary-6608",
25
+ "@docusaurus/utils-validation": "3.10.1-canary-6608",
26
26
  "eta": "^2.2.0",
27
27
  "fs-extra": "^11.2.0",
28
28
  "lodash": "^4.17.21",
29
29
  "tslib": "^2.6.0"
30
30
  },
31
31
  "devDependencies": {
32
- "@docusaurus/types": "3.10.1-canary-6603"
32
+ "@docusaurus/types": "3.10.1-canary-6608"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "react": "^19.2.5",
@@ -38,5 +38,5 @@
38
38
  "engines": {
39
39
  "node": ">=24.14"
40
40
  },
41
- "gitHead": "26f7222711c2f6360e2f6c532448f5bbd24d5c20"
41
+ "gitHead": "8d2d0675c0ff9f65e9acb70b6a128967ff3e92ab"
42
42
  }
@@ -24,6 +24,15 @@ export default function collectRedirects(
24
24
  pluginContext: PluginContext,
25
25
  trailingSlash: boolean | undefined,
26
26
  ): RedirectItem[] {
27
+ function normalizeRedirectTo(to: string) {
28
+ return to.startsWith('/')
29
+ ? applyTrailingSlash(to, {
30
+ trailingSlash,
31
+ baseUrl: pluginContext.baseUrl,
32
+ })
33
+ : to;
34
+ }
35
+
27
36
  // For each plugin config option, create the appropriate redirects
28
37
  const redirects = [
29
38
  ...createFromExtensionsRedirects(
@@ -50,10 +59,7 @@ export default function collectRedirects(
50
59
  //
51
60
  // It should be easy to toggle `trailingSlash` option without having to
52
61
  // change other configs
53
- to: applyTrailingSlash(redirect.to, {
54
- trailingSlash,
55
- baseUrl: pluginContext.baseUrl,
56
- }),
62
+ to: normalizeRedirectTo(redirect.to),
57
63
  }));
58
64
 
59
65
  validateCollectedRedirects(redirects, pluginContext);