@docusaurus/plugin-client-redirects 0.0.0-4376 → 0.0.0-4383
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 -2
- package/lib/normalizePluginOptions.d.ts +1 -1
- package/lib/types.d.ts +1 -13
- package/package.json +8 -8
- package/src/collectRedirects.ts +2 -3
- package/src/index.ts +3 -2
- package/src/normalizePluginOptions.ts +5 -1
- package/src/plugin-client-redirects.d.ts +20 -1
- package/src/types.ts +1 -21
package/lib/index.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
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 {
|
|
9
|
-
export default function pluginClientRedirectsPages(context: LoadContext, opts:
|
|
8
|
+
import type { PluginOptions } from '@docusaurus/plugin-client-redirects';
|
|
9
|
+
export default function pluginClientRedirectsPages(context: LoadContext, opts: PluginOptions): Plugin<unknown>;
|
|
@@ -4,6 +4,6 @@
|
|
|
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, UserPluginOptions } from '
|
|
7
|
+
import type { PluginOptions, Options as UserPluginOptions } from '@docusaurus/plugin-client-redirects';
|
|
8
8
|
export declare const DefaultPluginOptions: PluginOptions;
|
|
9
9
|
export default function normalizePluginOptions(userPluginOptions?: UserPluginOptions): PluginOptions;
|
package/lib/types.d.ts
CHANGED
|
@@ -5,19 +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
|
-
|
|
9
|
-
id: string;
|
|
10
|
-
fromExtensions: string[];
|
|
11
|
-
toExtensions: string[];
|
|
12
|
-
redirects: RedirectOption[];
|
|
13
|
-
createRedirects?: CreateRedirectsFnOption;
|
|
14
|
-
};
|
|
15
|
-
export declare type CreateRedirectsFnOption = (path: string) => string[] | string | null | undefined;
|
|
16
|
-
export declare type RedirectOption = {
|
|
17
|
-
to: string;
|
|
18
|
-
from: string | string[];
|
|
19
|
-
};
|
|
20
|
-
export declare type UserPluginOptions = Partial<PluginOptions>;
|
|
8
|
+
import type { PluginOptions } from '@docusaurus/plugin-client-redirects';
|
|
21
9
|
export declare type PluginContext = Pick<Props, 'outDir' | 'baseUrl'> & {
|
|
22
10
|
options: PluginOptions;
|
|
23
11
|
relativeRoutesPaths: string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-client-redirects",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-4383",
|
|
4
4
|
"description": "Client redirects plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/plugin-client-redirects.d.ts",
|
|
@@ -18,11 +18,11 @@
|
|
|
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-4383",
|
|
22
|
+
"@docusaurus/logger": "0.0.0-4383",
|
|
23
|
+
"@docusaurus/utils": "0.0.0-4383",
|
|
24
|
+
"@docusaurus/utils-common": "0.0.0-4383",
|
|
25
|
+
"@docusaurus/utils-validation": "0.0.0-4383",
|
|
26
26
|
"chalk": "^4.1.2",
|
|
27
27
|
"eta": "^1.12.3",
|
|
28
28
|
"fs-extra": "^10.0.0",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"tslib": "^2.3.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@docusaurus/types": "0.0.0-
|
|
33
|
+
"@docusaurus/types": "0.0.0-4383"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"react": "^16.8.4 || ^17.0.0",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"engines": {
|
|
40
40
|
"node": ">=14"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "6ccc0daea1a7b1413cd32f515a9e661c4007a355"
|
|
43
43
|
}
|
package/src/collectRedirects.ts
CHANGED
|
@@ -7,11 +7,10 @@
|
|
|
7
7
|
|
|
8
8
|
import {uniqBy, difference, groupBy} from 'lodash';
|
|
9
9
|
import type {
|
|
10
|
-
PluginContext,
|
|
11
|
-
RedirectMetadata,
|
|
12
10
|
PluginOptions,
|
|
13
11
|
RedirectOption,
|
|
14
|
-
} from '
|
|
12
|
+
} from '@docusaurus/plugin-client-redirects';
|
|
13
|
+
import type {PluginContext, RedirectMetadata} from './types';
|
|
15
14
|
import {
|
|
16
15
|
createFromExtensionsRedirects,
|
|
17
16
|
createToExtensionsRedirects,
|
package/src/index.ts
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import type {LoadContext, Plugin, Props} from '@docusaurus/types';
|
|
9
|
-
import type {
|
|
9
|
+
import type {PluginContext, RedirectMetadata} from './types';
|
|
10
|
+
import type {PluginOptions} from '@docusaurus/plugin-client-redirects';
|
|
10
11
|
|
|
11
12
|
import normalizePluginOptions from './normalizePluginOptions';
|
|
12
13
|
import collectRedirects from './collectRedirects';
|
|
@@ -18,7 +19,7 @@ import {removePrefix, addLeadingSlash} from '@docusaurus/utils';
|
|
|
18
19
|
|
|
19
20
|
export default function pluginClientRedirectsPages(
|
|
20
21
|
context: LoadContext,
|
|
21
|
-
opts:
|
|
22
|
+
opts: PluginOptions,
|
|
22
23
|
): Plugin<unknown> {
|
|
23
24
|
const {trailingSlash} = context.siteConfig;
|
|
24
25
|
|
|
@@ -5,7 +5,11 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type {
|
|
8
|
+
import type {
|
|
9
|
+
PluginOptions,
|
|
10
|
+
Options as UserPluginOptions,
|
|
11
|
+
RedirectOption,
|
|
12
|
+
} from '@docusaurus/plugin-client-redirects';
|
|
9
13
|
import {Joi, PathnameSchema} from '@docusaurus/utils-validation';
|
|
10
14
|
import {DEFAULT_PLUGIN_ID} from '@docusaurus/utils';
|
|
11
15
|
|
|
@@ -5,4 +5,23 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
export type
|
|
8
|
+
export type RedirectOption = {
|
|
9
|
+
to: string;
|
|
10
|
+
from: string | string[];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// For a given existing route path,
|
|
14
|
+
// return all the paths from which we should redirect from
|
|
15
|
+
export type CreateRedirectsFnOption = (
|
|
16
|
+
path: string,
|
|
17
|
+
) => string[] | string | null | undefined;
|
|
18
|
+
|
|
19
|
+
export type PluginOptions = {
|
|
20
|
+
id: string;
|
|
21
|
+
fromExtensions: string[];
|
|
22
|
+
toExtensions: string[];
|
|
23
|
+
redirects: RedirectOption[];
|
|
24
|
+
createRedirects?: CreateRedirectsFnOption;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type Options = Partial<PluginOptions>;
|
package/src/types.ts
CHANGED
|
@@ -6,27 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import type {Props} from '@docusaurus/types';
|
|
9
|
-
|
|
10
|
-
export type PluginOptions = {
|
|
11
|
-
id: string;
|
|
12
|
-
fromExtensions: string[];
|
|
13
|
-
toExtensions: string[];
|
|
14
|
-
redirects: RedirectOption[];
|
|
15
|
-
createRedirects?: CreateRedirectsFnOption;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
// For a given existing route path,
|
|
19
|
-
// return all the paths from which we should redirect from
|
|
20
|
-
export type CreateRedirectsFnOption = (
|
|
21
|
-
path: string,
|
|
22
|
-
) => string[] | string | null | undefined;
|
|
23
|
-
|
|
24
|
-
export type RedirectOption = {
|
|
25
|
-
to: string;
|
|
26
|
-
from: string | string[];
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export type UserPluginOptions = Partial<PluginOptions>;
|
|
9
|
+
import type {PluginOptions} from '@docusaurus/plugin-client-redirects';
|
|
30
10
|
|
|
31
11
|
// The minimal infos the plugin needs to work
|
|
32
12
|
export type PluginContext = Pick<Props, 'outDir' | 'baseUrl'> & {
|