@docusaurus/plugin-client-redirects 0.0.0-4943 → 0.0.0-4946
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.d.ts +2 -1
- package/lib/options.d.ts +22 -1
- package/lib/types.d.ts +1 -1
- package/package.json +9 -9
- package/src/collectRedirects.ts +1 -4
- package/src/index.ts +2 -1
- package/src/options.ts +26 -5
- package/src/types.ts +1 -1
- package/src/plugin-client-redirects.d.ts +0 -32
package/lib/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import type { LoadContext, Plugin } from '@docusaurus/types';
|
|
8
|
-
import type { PluginOptions } from '
|
|
8
|
+
import type { PluginOptions, Options } from './options';
|
|
9
9
|
export default function pluginClientRedirectsPages(context: LoadContext, options: PluginOptions): Plugin<unknown>;
|
|
10
10
|
export { validateOptions } from './options';
|
|
11
|
+
export type { PluginOptions, Options };
|
package/lib/options.d.ts
CHANGED
|
@@ -4,7 +4,28 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import type { PluginOptions, Options } from '@docusaurus/plugin-client-redirects';
|
|
8
7
|
import type { OptionValidationContext } from '@docusaurus/types';
|
|
8
|
+
export declare type RedirectOption = {
|
|
9
|
+
to: string;
|
|
10
|
+
from: string | string[];
|
|
11
|
+
};
|
|
12
|
+
export declare type PluginOptions = {
|
|
13
|
+
/** Plugin ID. */
|
|
14
|
+
id: string;
|
|
15
|
+
/** The extensions to be removed from the route after redirecting. */
|
|
16
|
+
fromExtensions: string[];
|
|
17
|
+
/** The extensions to be appended to the route after redirecting. */
|
|
18
|
+
toExtensions: string[];
|
|
19
|
+
/** The list of redirect rules, each one with multiple `from`s → one `to`. */
|
|
20
|
+
redirects: RedirectOption[];
|
|
21
|
+
/**
|
|
22
|
+
* A callback to create a redirect rule.
|
|
23
|
+
* @returns All the paths from which we should redirect to `path`
|
|
24
|
+
*/
|
|
25
|
+
createRedirects?: (
|
|
26
|
+
/** An existing Docusaurus route path */
|
|
27
|
+
path: string) => string[] | string | null | undefined;
|
|
28
|
+
};
|
|
29
|
+
export declare type Options = Partial<PluginOptions>;
|
|
9
30
|
export declare const DEFAULT_OPTIONS: Partial<PluginOptions>;
|
|
10
31
|
export declare function validateOptions({ validate, options: userOptions, }: OptionValidationContext<Options, PluginOptions>): PluginOptions;
|
package/lib/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import type { Props } from '@docusaurus/types';
|
|
8
|
-
import type { PluginOptions } from '
|
|
8
|
+
import type { PluginOptions } from './options';
|
|
9
9
|
/**
|
|
10
10
|
* The minimal infos the plugin needs to work
|
|
11
11
|
*/
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-client-redirects",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-4946",
|
|
4
4
|
"description": "Client redirects plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
|
-
"types": "
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tsc",
|
|
9
9
|
"watch": "tsc --watch"
|
|
@@ -18,18 +18,18 @@
|
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@docusaurus/core": "0.0.0-
|
|
22
|
-
"@docusaurus/logger": "0.0.0-
|
|
23
|
-
"@docusaurus/utils": "0.0.0-
|
|
24
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
25
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
21
|
+
"@docusaurus/core": "0.0.0-4946",
|
|
22
|
+
"@docusaurus/logger": "0.0.0-4946",
|
|
23
|
+
"@docusaurus/utils": "0.0.0-4946",
|
|
24
|
+
"@docusaurus/utils-common": "0.0.0-4946",
|
|
25
|
+
"@docusaurus/utils-validation": "0.0.0-4946",
|
|
26
26
|
"eta": "^1.12.3",
|
|
27
27
|
"fs-extra": "^10.1.0",
|
|
28
28
|
"lodash": "^4.17.21",
|
|
29
29
|
"tslib": "^2.4.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@docusaurus/types": "0.0.0-
|
|
32
|
+
"@docusaurus/types": "0.0.0-4946"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"react": "^16.8.4 || ^17.0.0",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"engines": {
|
|
39
39
|
"node": ">=14"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "01073ce535af35aa33c1b221e2adb99ac993d589"
|
|
42
42
|
}
|
package/src/collectRedirects.ts
CHANGED
|
@@ -6,10 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import _ from 'lodash';
|
|
9
|
-
import type {
|
|
10
|
-
PluginOptions,
|
|
11
|
-
RedirectOption,
|
|
12
|
-
} from '@docusaurus/plugin-client-redirects';
|
|
9
|
+
import type {PluginOptions, RedirectOption} from './options';
|
|
13
10
|
import type {PluginContext, RedirectMetadata} from './types';
|
|
14
11
|
import {
|
|
15
12
|
createFromExtensionsRedirects,
|
package/src/index.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import type {LoadContext, Plugin} from '@docusaurus/types';
|
|
9
9
|
import type {PluginContext, RedirectMetadata} from './types';
|
|
10
|
-
import type {PluginOptions} from '
|
|
10
|
+
import type {PluginOptions, Options} from './options';
|
|
11
11
|
|
|
12
12
|
import collectRedirects from './collectRedirects';
|
|
13
13
|
import writeRedirectFiles, {
|
|
@@ -52,3 +52,4 @@ export default function pluginClientRedirectsPages(
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
export {validateOptions} from './options';
|
|
55
|
+
export type {PluginOptions, Options};
|
package/src/options.ts
CHANGED
|
@@ -5,14 +5,35 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type {
|
|
9
|
-
PluginOptions,
|
|
10
|
-
Options,
|
|
11
|
-
RedirectOption,
|
|
12
|
-
} from '@docusaurus/plugin-client-redirects';
|
|
13
8
|
import type {OptionValidationContext} from '@docusaurus/types';
|
|
14
9
|
import {Joi, PathnameSchema} from '@docusaurus/utils-validation';
|
|
15
10
|
|
|
11
|
+
export type RedirectOption = {
|
|
12
|
+
to: string;
|
|
13
|
+
from: string | string[];
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type PluginOptions = {
|
|
17
|
+
/** Plugin ID. */
|
|
18
|
+
id: string;
|
|
19
|
+
/** The extensions to be removed from the route after redirecting. */
|
|
20
|
+
fromExtensions: string[];
|
|
21
|
+
/** The extensions to be appended to the route after redirecting. */
|
|
22
|
+
toExtensions: string[];
|
|
23
|
+
/** The list of redirect rules, each one with multiple `from`s → one `to`. */
|
|
24
|
+
redirects: RedirectOption[];
|
|
25
|
+
/**
|
|
26
|
+
* A callback to create a redirect rule.
|
|
27
|
+
* @returns All the paths from which we should redirect to `path`
|
|
28
|
+
*/
|
|
29
|
+
createRedirects?: (
|
|
30
|
+
/** An existing Docusaurus route path */
|
|
31
|
+
path: string,
|
|
32
|
+
) => string[] | string | null | undefined;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type Options = Partial<PluginOptions>;
|
|
36
|
+
|
|
16
37
|
export const DEFAULT_OPTIONS: Partial<PluginOptions> = {
|
|
17
38
|
fromExtensions: [],
|
|
18
39
|
toExtensions: [],
|
package/src/types.ts
CHANGED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export type RedirectOption = {
|
|
9
|
-
to: string;
|
|
10
|
-
from: string | string[];
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export type PluginOptions = {
|
|
14
|
-
/** Plugin ID. */
|
|
15
|
-
id: string;
|
|
16
|
-
/** The extensions to be removed from the route after redirecting. */
|
|
17
|
-
fromExtensions: string[];
|
|
18
|
-
/** The extensions to be appended to the route after redirecting. */
|
|
19
|
-
toExtensions: string[];
|
|
20
|
-
/** The list of redirect rules, each one with multiple `from`s → one `to`. */
|
|
21
|
-
redirects: RedirectOption[];
|
|
22
|
-
/**
|
|
23
|
-
* A callback to create a redirect rule.
|
|
24
|
-
* @returns All the paths from which we should redirect to `path`
|
|
25
|
-
*/
|
|
26
|
-
createRedirects?: (
|
|
27
|
-
/** An existing Docusaurus route path */
|
|
28
|
-
path: string,
|
|
29
|
-
) => string[] | string | null | undefined;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export type Options = Partial<PluginOptions>;
|