@docusaurus/plugin-content-docs 0.0.0-4421 → 0.0.0-4426
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/globalData.d.ts +2 -1
- package/lib/globalData.js +12 -2
- package/lib/routes.d.ts +2 -1
- package/lib/routes.js +3 -2
- package/package.json +9 -9
- package/src/globalData.ts +18 -2
- package/src/routes.ts +4 -1
package/lib/globalData.d.ts
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import type { Sidebars } from './sidebars/types';
|
|
8
|
-
import type { DocMetadata, LoadedVersion } from './types';
|
|
8
|
+
import type { CategoryGeneratedIndexMetadata, DocMetadata, LoadedVersion } from './types';
|
|
9
9
|
import type { GlobalVersion, GlobalSidebar, GlobalDoc } from '@docusaurus/plugin-content-docs/client';
|
|
10
10
|
export declare function toGlobalDataDoc(doc: DocMetadata): GlobalDoc;
|
|
11
|
+
export declare function toGlobalDataGeneratedIndex(doc: CategoryGeneratedIndexMetadata): GlobalDoc;
|
|
11
12
|
export declare function toGlobalSidebars(sidebars: Sidebars, version: LoadedVersion): Record<string, GlobalSidebar>;
|
|
12
13
|
export declare function toGlobalDataVersion(version: LoadedVersion): GlobalVersion;
|
package/lib/globalData.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.toGlobalDataVersion = exports.toGlobalSidebars = exports.toGlobalDataDoc = void 0;
|
|
9
|
+
exports.toGlobalDataVersion = exports.toGlobalSidebars = exports.toGlobalDataGeneratedIndex = exports.toGlobalDataDoc = void 0;
|
|
10
10
|
const lodash_1 = require("lodash");
|
|
11
11
|
const utils_1 = require("@docusaurus/utils");
|
|
12
12
|
const utils_2 = require("./sidebars/utils");
|
|
@@ -18,6 +18,14 @@ function toGlobalDataDoc(doc) {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
exports.toGlobalDataDoc = toGlobalDataDoc;
|
|
21
|
+
function toGlobalDataGeneratedIndex(doc) {
|
|
22
|
+
return {
|
|
23
|
+
id: doc.slug,
|
|
24
|
+
path: doc.permalink,
|
|
25
|
+
sidebar: doc.sidebar,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
exports.toGlobalDataGeneratedIndex = toGlobalDataGeneratedIndex;
|
|
21
29
|
function toGlobalSidebars(sidebars, version) {
|
|
22
30
|
const { getFirstLink } = (0, utils_2.createSidebarsUtils)(sidebars);
|
|
23
31
|
return (0, lodash_1.mapValues)(sidebars, (sidebar, sidebarId) => {
|
|
@@ -43,7 +51,9 @@ function toGlobalDataVersion(version) {
|
|
|
43
51
|
isLast: version.isLast,
|
|
44
52
|
path: version.versionPath,
|
|
45
53
|
mainDocId: version.mainDocId,
|
|
46
|
-
docs: version.docs
|
|
54
|
+
docs: version.docs
|
|
55
|
+
.map(toGlobalDataDoc)
|
|
56
|
+
.concat(version.categoryGeneratedIndices.map(toGlobalDataGeneratedIndex)),
|
|
47
57
|
sidebars: toGlobalSidebars(version.sidebars, version),
|
|
48
58
|
};
|
|
49
59
|
}
|
package/lib/routes.d.ts
CHANGED
|
@@ -6,10 +6,11 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { PluginContentLoadedActions, RouteConfig } from '@docusaurus/types';
|
|
8
8
|
import type { DocMetadata, LoadedVersion } from './types';
|
|
9
|
-
export declare function createCategoryGeneratedIndexRoutes({ version, actions, docCategoryGeneratedIndexComponent, }: {
|
|
9
|
+
export declare function createCategoryGeneratedIndexRoutes({ version, actions, docCategoryGeneratedIndexComponent, aliasedSource, }: {
|
|
10
10
|
version: LoadedVersion;
|
|
11
11
|
actions: PluginContentLoadedActions;
|
|
12
12
|
docCategoryGeneratedIndexComponent: string;
|
|
13
|
+
aliasedSource: (str: string) => string;
|
|
13
14
|
}): Promise<RouteConfig[]>;
|
|
14
15
|
export declare function createDocRoutes({ docs, actions, docItemComponent, }: {
|
|
15
16
|
docs: DocMetadata[];
|
package/lib/routes.js
CHANGED
|
@@ -11,7 +11,7 @@ const tslib_1 = require("tslib");
|
|
|
11
11
|
const utils_1 = require("@docusaurus/utils");
|
|
12
12
|
const props_1 = require("./props");
|
|
13
13
|
const logger_1 = (0, tslib_1.__importDefault)(require("@docusaurus/logger"));
|
|
14
|
-
async function createCategoryGeneratedIndexRoutes({ version, actions, docCategoryGeneratedIndexComponent, }) {
|
|
14
|
+
async function createCategoryGeneratedIndexRoutes({ version, actions, docCategoryGeneratedIndexComponent, aliasedSource, }) {
|
|
15
15
|
const slugs = (0, utils_1.createSlugger)();
|
|
16
16
|
async function createCategoryGeneratedIndexRoute(categoryGeneratedIndex) {
|
|
17
17
|
const { sidebar, title, description, slug, permalink, previous, next, image, keywords, } = categoryGeneratedIndex;
|
|
@@ -34,7 +34,7 @@ async function createCategoryGeneratedIndexRoutes({ version, actions, docCategor
|
|
|
34
34
|
component: docCategoryGeneratedIndexComponent,
|
|
35
35
|
exact: true,
|
|
36
36
|
modules: {
|
|
37
|
-
categoryGeneratedIndex: propData,
|
|
37
|
+
categoryGeneratedIndex: aliasedSource(propData),
|
|
38
38
|
},
|
|
39
39
|
// Same as doc, this sidebar route attribute permits to associate this subpage to the given sidebar
|
|
40
40
|
...(sidebar && { sidebar }),
|
|
@@ -77,6 +77,7 @@ async function createVersionRoutes({ loadedVersion, actions, docItemComponent, d
|
|
|
77
77
|
version,
|
|
78
78
|
actions,
|
|
79
79
|
docCategoryGeneratedIndexComponent,
|
|
80
|
+
aliasedSource,
|
|
80
81
|
}),
|
|
81
82
|
]);
|
|
82
83
|
const routes = [...docRoutes, ...sidebarsRoutes];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-content-docs",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-4426",
|
|
4
4
|
"description": "Docs plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
},
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@docusaurus/core": "0.0.0-
|
|
26
|
-
"@docusaurus/logger": "0.0.0-
|
|
27
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
28
|
-
"@docusaurus/utils": "0.0.0-
|
|
29
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
25
|
+
"@docusaurus/core": "0.0.0-4426",
|
|
26
|
+
"@docusaurus/logger": "0.0.0-4426",
|
|
27
|
+
"@docusaurus/mdx-loader": "0.0.0-4426",
|
|
28
|
+
"@docusaurus/utils": "0.0.0-4426",
|
|
29
|
+
"@docusaurus/utils-validation": "0.0.0-4426",
|
|
30
30
|
"combine-promises": "^1.1.0",
|
|
31
31
|
"escape-string-regexp": "^4.0.0",
|
|
32
32
|
"fs-extra": "^10.0.0",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"webpack": "^5.61.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
46
|
-
"@docusaurus/types": "0.0.0-
|
|
45
|
+
"@docusaurus/module-type-aliases": "0.0.0-4426",
|
|
46
|
+
"@docusaurus/types": "0.0.0-4426",
|
|
47
47
|
"@types/js-yaml": "^4.0.0",
|
|
48
48
|
"@types/picomatch": "^2.2.1",
|
|
49
49
|
"commander": "^5.1.0",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"engines": {
|
|
58
58
|
"node": ">=14"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "fe6eb624cb88769d26246ed4c58542a90d6325e4"
|
|
61
61
|
}
|
package/src/globalData.ts
CHANGED
|
@@ -9,7 +9,11 @@ import {mapValues} from 'lodash';
|
|
|
9
9
|
import {normalizeUrl} from '@docusaurus/utils';
|
|
10
10
|
import type {Sidebars} from './sidebars/types';
|
|
11
11
|
import {createSidebarsUtils} from './sidebars/utils';
|
|
12
|
-
import type {
|
|
12
|
+
import type {
|
|
13
|
+
CategoryGeneratedIndexMetadata,
|
|
14
|
+
DocMetadata,
|
|
15
|
+
LoadedVersion,
|
|
16
|
+
} from './types';
|
|
13
17
|
import type {
|
|
14
18
|
GlobalVersion,
|
|
15
19
|
GlobalSidebar,
|
|
@@ -24,6 +28,16 @@ export function toGlobalDataDoc(doc: DocMetadata): GlobalDoc {
|
|
|
24
28
|
};
|
|
25
29
|
}
|
|
26
30
|
|
|
31
|
+
export function toGlobalDataGeneratedIndex(
|
|
32
|
+
doc: CategoryGeneratedIndexMetadata,
|
|
33
|
+
): GlobalDoc {
|
|
34
|
+
return {
|
|
35
|
+
id: doc.slug,
|
|
36
|
+
path: doc.permalink,
|
|
37
|
+
sidebar: doc.sidebar,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
27
41
|
export function toGlobalSidebars(
|
|
28
42
|
sidebars: Sidebars,
|
|
29
43
|
version: LoadedVersion,
|
|
@@ -56,7 +70,9 @@ export function toGlobalDataVersion(version: LoadedVersion): GlobalVersion {
|
|
|
56
70
|
isLast: version.isLast,
|
|
57
71
|
path: version.versionPath,
|
|
58
72
|
mainDocId: version.mainDocId,
|
|
59
|
-
docs: version.docs
|
|
73
|
+
docs: version.docs
|
|
74
|
+
.map(toGlobalDataDoc)
|
|
75
|
+
.concat(version.categoryGeneratedIndices.map(toGlobalDataGeneratedIndex)),
|
|
60
76
|
sidebars: toGlobalSidebars(version.sidebars, version),
|
|
61
77
|
};
|
|
62
78
|
}
|
package/src/routes.ts
CHANGED
|
@@ -20,10 +20,12 @@ export async function createCategoryGeneratedIndexRoutes({
|
|
|
20
20
|
version,
|
|
21
21
|
actions,
|
|
22
22
|
docCategoryGeneratedIndexComponent,
|
|
23
|
+
aliasedSource,
|
|
23
24
|
}: {
|
|
24
25
|
version: LoadedVersion;
|
|
25
26
|
actions: PluginContentLoadedActions;
|
|
26
27
|
docCategoryGeneratedIndexComponent: string;
|
|
28
|
+
aliasedSource: (str: string) => string;
|
|
27
29
|
}): Promise<RouteConfig[]> {
|
|
28
30
|
const slugs = createSlugger();
|
|
29
31
|
|
|
@@ -69,7 +71,7 @@ export async function createCategoryGeneratedIndexRoutes({
|
|
|
69
71
|
component: docCategoryGeneratedIndexComponent,
|
|
70
72
|
exact: true,
|
|
71
73
|
modules: {
|
|
72
|
-
categoryGeneratedIndex: propData,
|
|
74
|
+
categoryGeneratedIndex: aliasedSource(propData),
|
|
73
75
|
},
|
|
74
76
|
// Same as doc, this sidebar route attribute permits to associate this subpage to the given sidebar
|
|
75
77
|
...(sidebar && {sidebar}),
|
|
@@ -149,6 +151,7 @@ export async function createVersionRoutes({
|
|
|
149
151
|
version,
|
|
150
152
|
actions,
|
|
151
153
|
docCategoryGeneratedIndexComponent,
|
|
154
|
+
aliasedSource,
|
|
152
155
|
}),
|
|
153
156
|
]);
|
|
154
157
|
|