@docusaurus/plugin-client-redirects 3.3.1 → 3.4.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.
- package/lib/index.js +8 -1
- package/package.json +8 -8
- package/src/index.ts +12 -1
package/lib/index.js
CHANGED
|
@@ -9,12 +9,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.validateOptions = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const utils_common_1 = require("@docusaurus/utils-common");
|
|
12
|
+
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
12
13
|
const collectRedirects_1 = tslib_1.__importDefault(require("./collectRedirects"));
|
|
13
14
|
const writeRedirectFiles_1 = tslib_1.__importStar(require("./writeRedirectFiles"));
|
|
15
|
+
const PluginName = 'docusaurus-plugin-client-redirects';
|
|
14
16
|
function pluginClientRedirectsPages(context, options) {
|
|
15
17
|
const { trailingSlash } = context.siteConfig;
|
|
18
|
+
const router = context.siteConfig.future.experimental_router;
|
|
19
|
+
if (router === 'hash') {
|
|
20
|
+
logger_1.default.warn(`${PluginName} does not support the Hash Router and will be disabled.`);
|
|
21
|
+
return { name: PluginName };
|
|
22
|
+
}
|
|
16
23
|
return {
|
|
17
|
-
name:
|
|
24
|
+
name: PluginName,
|
|
18
25
|
async postBuild(props) {
|
|
19
26
|
const pluginContext = {
|
|
20
27
|
relativeRoutesPaths: props.routesPaths.map((path) => `${(0, utils_common_1.addLeadingSlash)((0, utils_common_1.removePrefix)(path, props.baseUrl))}`),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-client-redirects",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
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.
|
|
22
|
-
"@docusaurus/logger": "3.
|
|
23
|
-
"@docusaurus/utils": "3.
|
|
24
|
-
"@docusaurus/utils-common": "3.
|
|
25
|
-
"@docusaurus/utils-validation": "3.
|
|
21
|
+
"@docusaurus/core": "3.4.0",
|
|
22
|
+
"@docusaurus/logger": "3.4.0",
|
|
23
|
+
"@docusaurus/utils": "3.4.0",
|
|
24
|
+
"@docusaurus/utils-common": "3.4.0",
|
|
25
|
+
"@docusaurus/utils-validation": "3.4.0",
|
|
26
26
|
"eta": "^2.2.0",
|
|
27
27
|
"fs-extra": "^11.1.1",
|
|
28
28
|
"lodash": "^4.17.21",
|
|
29
29
|
"tslib": "^2.6.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@docusaurus/types": "3.
|
|
32
|
+
"@docusaurus/types": "3.4.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"react": "^18.0.0",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"engines": {
|
|
39
39
|
"node": ">=18.0"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "49e9a2143274a8dd795659b417b470bc42abbd6e"
|
|
42
42
|
}
|
package/src/index.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import {addLeadingSlash, removePrefix} from '@docusaurus/utils-common';
|
|
9
|
+
import logger from '@docusaurus/logger';
|
|
9
10
|
import collectRedirects from './collectRedirects';
|
|
10
11
|
import writeRedirectFiles, {
|
|
11
12
|
toRedirectFiles,
|
|
@@ -15,14 +16,24 @@ import type {LoadContext, Plugin} from '@docusaurus/types';
|
|
|
15
16
|
import type {PluginContext, RedirectItem} from './types';
|
|
16
17
|
import type {PluginOptions, Options} from './options';
|
|
17
18
|
|
|
19
|
+
const PluginName = 'docusaurus-plugin-client-redirects';
|
|
20
|
+
|
|
18
21
|
export default function pluginClientRedirectsPages(
|
|
19
22
|
context: LoadContext,
|
|
20
23
|
options: PluginOptions,
|
|
21
24
|
): Plugin<void> {
|
|
22
25
|
const {trailingSlash} = context.siteConfig;
|
|
26
|
+
const router = context.siteConfig.future.experimental_router;
|
|
27
|
+
|
|
28
|
+
if (router === 'hash') {
|
|
29
|
+
logger.warn(
|
|
30
|
+
`${PluginName} does not support the Hash Router and will be disabled.`,
|
|
31
|
+
);
|
|
32
|
+
return {name: PluginName};
|
|
33
|
+
}
|
|
23
34
|
|
|
24
35
|
return {
|
|
25
|
-
name:
|
|
36
|
+
name: PluginName,
|
|
26
37
|
async postBuild(props) {
|
|
27
38
|
const pluginContext: PluginContext = {
|
|
28
39
|
relativeRoutesPaths: props.routesPaths.map(
|