@docusaurus/plugin-content-docs 0.0.0-4605 → 0.0.0-4609
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/docs.js +4 -5
- package/lib/globalData.js +3 -2
- package/lib/index.js +1 -2
- package/lib/props.js +13 -9
- package/lib/sidebars/generator.js +3 -3
- package/lib/sidebars/index.js +3 -3
- package/lib/sidebars/normalization.js +3 -2
- package/lib/sidebars/postProcessor.js +3 -2
- package/lib/sidebars/processor.js +5 -5
- package/lib/sidebars/utils.js +6 -5
- package/lib/tags.js +3 -2
- package/lib/translations.js +11 -10
- package/lib/versions.js +3 -3
- package/package.json +10 -10
- package/src/docs.ts +6 -5
- package/src/globalData.ts +2 -2
- package/src/index.ts +2 -4
- package/src/props.ts +15 -11
- package/src/sidebars/generator.ts +3 -3
- package/src/sidebars/index.ts +3 -3
- package/src/sidebars/normalization.ts +2 -2
- package/src/sidebars/postProcessor.ts +2 -2
- package/src/sidebars/processor.ts +5 -5
- package/src/sidebars/utils.ts +5 -5
- package/src/tags.ts +2 -2
- package/src/translations.ts +12 -10
- package/src/versions.ts +3 -3
package/lib/docs.js
CHANGED
|
@@ -11,7 +11,6 @@ const tslib_1 = require("tslib");
|
|
|
11
11
|
const path_1 = (0, tslib_1.__importDefault)(require("path"));
|
|
12
12
|
const fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
|
|
13
13
|
const logger_1 = (0, tslib_1.__importDefault)(require("@docusaurus/logger"));
|
|
14
|
-
const lodash_1 = require("lodash");
|
|
15
14
|
const utils_1 = require("@docusaurus/utils");
|
|
16
15
|
const lastUpdate_1 = require("./lastUpdate");
|
|
17
16
|
const slug_1 = (0, tslib_1.__importDefault)(require("./slug"));
|
|
@@ -285,9 +284,9 @@ exports.getDocIds = getDocIds;
|
|
|
285
284
|
// versioned doc ids ("id" should be removed & "versionedId" should be renamed
|
|
286
285
|
// to "id")
|
|
287
286
|
function createDocsByIdIndex(docs) {
|
|
288
|
-
return
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
287
|
+
return Object.fromEntries(docs.flatMap((doc) => [
|
|
288
|
+
[doc.unversionedId, doc],
|
|
289
|
+
[doc.id, doc],
|
|
290
|
+
]));
|
|
292
291
|
}
|
|
293
292
|
exports.createDocsByIdIndex = createDocsByIdIndex;
|
package/lib/globalData.js
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.toGlobalDataVersion = exports.toGlobalSidebars = exports.toGlobalDataGeneratedIndex = exports.toGlobalDataDoc = void 0;
|
|
10
|
-
const
|
|
10
|
+
const tslib_1 = require("tslib");
|
|
11
|
+
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
11
12
|
const utils_1 = require("@docusaurus/utils");
|
|
12
13
|
const utils_2 = require("./sidebars/utils");
|
|
13
14
|
function toGlobalDataDoc(doc) {
|
|
@@ -28,7 +29,7 @@ function toGlobalDataGeneratedIndex(doc) {
|
|
|
28
29
|
exports.toGlobalDataGeneratedIndex = toGlobalDataGeneratedIndex;
|
|
29
30
|
function toGlobalSidebars(sidebars, version) {
|
|
30
31
|
const { getFirstLink } = (0, utils_2.createSidebarsUtils)(sidebars);
|
|
31
|
-
return
|
|
32
|
+
return lodash_1.default.mapValues(sidebars, (sidebar, sidebarId) => {
|
|
32
33
|
const firstLink = getFirstLink(sidebarId);
|
|
33
34
|
if (!firstLink) {
|
|
34
35
|
return {};
|
package/lib/index.js
CHANGED
|
@@ -16,7 +16,6 @@ const docs_1 = require("./docs");
|
|
|
16
16
|
const versions_1 = require("./versions");
|
|
17
17
|
const cli_1 = require("./cli");
|
|
18
18
|
const constants_1 = require("./constants");
|
|
19
|
-
const lodash_1 = require("lodash");
|
|
20
19
|
const globalData_1 = require("./globalData");
|
|
21
20
|
const props_1 = require("./props");
|
|
22
21
|
const translations_1 = require("./translations");
|
|
@@ -199,7 +198,7 @@ async function pluginContentDocs(context, options) {
|
|
|
199
198
|
const { rehypePlugins, remarkPlugins, beforeDefaultRehypePlugins, beforeDefaultRemarkPlugins, } = options;
|
|
200
199
|
function getSourceToPermalink() {
|
|
201
200
|
const allDocs = content.loadedVersions.flatMap((v) => v.docs);
|
|
202
|
-
return (
|
|
201
|
+
return Object.fromEntries(allDocs.map(({ source, permalink }) => [source, permalink]));
|
|
203
202
|
}
|
|
204
203
|
const docsMarkdownOptions = {
|
|
205
204
|
siteDir,
|
package/lib/props.js
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.toTagDocListProp = exports.toVersionMetadataProp = exports.toSidebarsProp = void 0;
|
|
10
|
-
const
|
|
10
|
+
const tslib_1 = require("tslib");
|
|
11
|
+
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
11
12
|
const docs_1 = require("./docs");
|
|
12
13
|
function toSidebarsProp(loadedVersion) {
|
|
13
14
|
const docsById = (0, docs_1.createDocsByIdIndex)(loadedVersion.docs);
|
|
@@ -63,16 +64,19 @@ Available document ids are:
|
|
|
63
64
|
// Transform the sidebar so that all sidebar item will be in the
|
|
64
65
|
// form of 'link' or 'category' only.
|
|
65
66
|
// This is what will be passed as props to the UI component.
|
|
66
|
-
return
|
|
67
|
+
return lodash_1.default.mapValues(loadedVersion.sidebars, (items) => items.map(normalizeItem));
|
|
67
68
|
}
|
|
68
69
|
exports.toSidebarsProp = toSidebarsProp;
|
|
69
70
|
function toVersionDocsProp(loadedVersion) {
|
|
70
|
-
return
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
return Object.fromEntries(loadedVersion.docs.map((doc) => [
|
|
72
|
+
doc.unversionedId,
|
|
73
|
+
{
|
|
74
|
+
id: doc.unversionedId,
|
|
75
|
+
title: doc.title,
|
|
76
|
+
description: doc.description,
|
|
77
|
+
sidebar: doc.sidebar,
|
|
78
|
+
},
|
|
79
|
+
]));
|
|
76
80
|
}
|
|
77
81
|
function toVersionMetadataProp(pluginId, loadedVersion) {
|
|
78
82
|
return {
|
|
@@ -90,7 +94,7 @@ function toVersionMetadataProp(pluginId, loadedVersion) {
|
|
|
90
94
|
exports.toVersionMetadataProp = toVersionMetadataProp;
|
|
91
95
|
function toTagDocListProp({ allTagsPath, tag, docs, }) {
|
|
92
96
|
function toDocListProp() {
|
|
93
|
-
const list =
|
|
97
|
+
const list = lodash_1.default.compact(tag.docIds.map((id) => docs.find((doc) => doc.id === id)));
|
|
94
98
|
// Sort docs by title
|
|
95
99
|
list.sort((doc1, doc2) => doc1.title.localeCompare(doc2.title));
|
|
96
100
|
return list.map((doc) => ({
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.DefaultSidebarItemsGenerator = exports.CategoryMetadataFilenamePattern = exports.CategoryMetadataFilenameBase = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
|
-
const lodash_1 = require("lodash");
|
|
11
|
+
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
12
12
|
const utils_1 = require("@docusaurus/utils");
|
|
13
13
|
const logger_1 = (0, tslib_1.__importDefault)(require("@docusaurus/logger"));
|
|
14
14
|
const path_1 = (0, tslib_1.__importDefault)(require("path"));
|
|
@@ -18,7 +18,7 @@ const BreadcrumbSeparator = '/';
|
|
|
18
18
|
const docIdPrefix = '$doc$/';
|
|
19
19
|
// Just an alias to the make code more explicit
|
|
20
20
|
function getLocalDocId(docId) {
|
|
21
|
-
return
|
|
21
|
+
return lodash_1.default.last(docId.split('/'));
|
|
22
22
|
}
|
|
23
23
|
exports.CategoryMetadataFilenameBase = '_category_';
|
|
24
24
|
exports.CategoryMetadataFilenamePattern = '_category_.{json,yml,yaml}';
|
|
@@ -177,7 +177,7 @@ const DefaultSidebarItemsGenerator = async ({ numberPrefixParser, isCategoryInde
|
|
|
177
177
|
}
|
|
178
178
|
return item;
|
|
179
179
|
});
|
|
180
|
-
const sortedSidebarItems =
|
|
180
|
+
const sortedSidebarItems = lodash_1.default.sortBy(processedSidebarItems, (item) => item.position);
|
|
181
181
|
return sortedSidebarItems.map(({ position, ...item }) => item);
|
|
182
182
|
}
|
|
183
183
|
// TODO: the whole code is designed for pipeline operator
|
package/lib/sidebars/index.js
CHANGED
|
@@ -18,7 +18,7 @@ const path_1 = (0, tslib_1.__importDefault)(require("path"));
|
|
|
18
18
|
const utils_1 = require("@docusaurus/utils");
|
|
19
19
|
const logger_1 = (0, tslib_1.__importDefault)(require("@docusaurus/logger"));
|
|
20
20
|
const js_yaml_1 = (0, tslib_1.__importDefault)(require("js-yaml"));
|
|
21
|
-
const lodash_1 = require("lodash");
|
|
21
|
+
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
22
22
|
const combine_promises_1 = (0, tslib_1.__importDefault)(require("combine-promises"));
|
|
23
23
|
exports.DefaultSidebars = {
|
|
24
24
|
defaultSidebar: [
|
|
@@ -41,8 +41,8 @@ async function readCategoriesMetadata(contentPath) {
|
|
|
41
41
|
const categoryFiles = await (0, utils_1.Globby)('**/_category_.{json,yml,yaml}', {
|
|
42
42
|
cwd: contentPath,
|
|
43
43
|
});
|
|
44
|
-
const categoryToFile =
|
|
45
|
-
return (0, combine_promises_1.default)(
|
|
44
|
+
const categoryToFile = lodash_1.default.groupBy(categoryFiles, path_1.default.dirname);
|
|
45
|
+
return (0, combine_promises_1.default)(lodash_1.default.mapValues(categoryToFile, async (files, folder) => {
|
|
46
46
|
const [filePath] = files;
|
|
47
47
|
if (files.length > 1) {
|
|
48
48
|
logger_1.default.warn `There are more than one category metadata files for path=${folder}: ${files.join(', ')}. The behavior is undetermined.`;
|
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.normalizeSidebars = exports.normalizeItem = void 0;
|
|
10
|
+
const tslib_1 = require("tslib");
|
|
10
11
|
const utils_1 = require("./utils");
|
|
11
|
-
const lodash_1 = require("lodash");
|
|
12
|
+
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
12
13
|
function normalizeCategoriesShorthand(sidebar) {
|
|
13
14
|
return Object.entries(sidebar).map(([label, items]) => ({
|
|
14
15
|
type: 'category',
|
|
@@ -54,6 +55,6 @@ function normalizeSidebar(sidebar) {
|
|
|
54
55
|
return normalizedSidebar.flatMap((subItem) => normalizeItem(subItem));
|
|
55
56
|
}
|
|
56
57
|
function normalizeSidebars(sidebars) {
|
|
57
|
-
return
|
|
58
|
+
return lodash_1.default.mapValues(sidebars, normalizeSidebar);
|
|
58
59
|
}
|
|
59
60
|
exports.normalizeSidebars = normalizeSidebars;
|
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.postProcessSidebars = void 0;
|
|
10
|
+
const tslib_1 = require("tslib");
|
|
10
11
|
const utils_1 = require("@docusaurus/utils");
|
|
11
|
-
const lodash_1 = require("lodash");
|
|
12
|
+
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
12
13
|
function normalizeCategoryLink(category, params) {
|
|
13
14
|
var _a, _b;
|
|
14
15
|
if (((_a = category.link) === null || _a === void 0 ? void 0 : _a.type) === 'generated-index') {
|
|
@@ -66,6 +67,6 @@ function postProcessSidebarItem(item, params) {
|
|
|
66
67
|
return item;
|
|
67
68
|
}
|
|
68
69
|
function postProcessSidebars(sidebars, params) {
|
|
69
|
-
return
|
|
70
|
+
return lodash_1.default.mapValues(sidebars, (sidebar) => sidebar.map((item) => postProcessSidebarItem(item, params)));
|
|
70
71
|
}
|
|
71
72
|
exports.postProcessSidebars = postProcessSidebars;
|
|
@@ -10,11 +10,11 @@ exports.processSidebars = void 0;
|
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const generator_1 = require("./generator");
|
|
12
12
|
const validation_1 = require("./validation");
|
|
13
|
-
const lodash_1 = require("lodash");
|
|
13
|
+
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
14
14
|
const combine_promises_1 = (0, tslib_1.__importDefault)(require("combine-promises"));
|
|
15
15
|
const docs_1 = require("../docs");
|
|
16
16
|
function toSidebarItemsGeneratorDoc(doc) {
|
|
17
|
-
return
|
|
17
|
+
return lodash_1.default.pick(doc, [
|
|
18
18
|
'id',
|
|
19
19
|
'unversionedId',
|
|
20
20
|
'frontMatter',
|
|
@@ -24,14 +24,14 @@ function toSidebarItemsGeneratorDoc(doc) {
|
|
|
24
24
|
]);
|
|
25
25
|
}
|
|
26
26
|
function toSidebarItemsGeneratorVersion(version) {
|
|
27
|
-
return
|
|
27
|
+
return lodash_1.default.pick(version, ['versionName', 'contentPath']);
|
|
28
28
|
}
|
|
29
29
|
// Handle the generation of autogenerated sidebar items and other
|
|
30
30
|
// post-processing checks
|
|
31
31
|
async function processSidebar(unprocessedSidebar, categoriesMetadata, params) {
|
|
32
32
|
const { sidebarItemsGenerator, numberPrefixParser, docs, version, sidebarOptions, } = params;
|
|
33
33
|
// Just a minor lazy transformation optimization
|
|
34
|
-
const getSidebarItemsGeneratorDocsAndVersion =
|
|
34
|
+
const getSidebarItemsGeneratorDocsAndVersion = lodash_1.default.memoize(() => ({
|
|
35
35
|
docs: docs.map(toSidebarItemsGeneratorDoc),
|
|
36
36
|
version: toSidebarItemsGeneratorVersion(version),
|
|
37
37
|
}));
|
|
@@ -72,7 +72,7 @@ async function processSidebar(unprocessedSidebar, categoriesMetadata, params) {
|
|
|
72
72
|
return processedSidebar;
|
|
73
73
|
}
|
|
74
74
|
async function processSidebars(unprocessedSidebars, categoriesMetadata, params) {
|
|
75
|
-
const processedSidebars = await (0, combine_promises_1.default)(
|
|
75
|
+
const processedSidebars = await (0, combine_promises_1.default)(lodash_1.default.mapValues(unprocessedSidebars, (unprocessedSidebar) => processSidebar(unprocessedSidebar, categoriesMetadata, params)));
|
|
76
76
|
(0, validation_1.validateSidebars)(processedSidebars);
|
|
77
77
|
return processedSidebars;
|
|
78
78
|
}
|
package/lib/sidebars/utils.js
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.toNavigationLink = exports.toDocNavigationLink = exports.createSidebarsUtils = exports.collectSidebarsNavigations = exports.collectSidebarsDocIds = exports.collectSidebarNavigation = exports.collectSidebarDocIds = exports.collectSidebarLinks = exports.collectSidebarCategories = exports.collectSidebarDocItems = exports.transformSidebarItems = exports.isCategoriesShorthand = void 0;
|
|
10
|
-
const
|
|
10
|
+
const tslib_1 = require("tslib");
|
|
11
|
+
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
11
12
|
const utils_1 = require("@docusaurus/utils");
|
|
12
13
|
function isCategoriesShorthand(item) {
|
|
13
14
|
return typeof item !== 'string' && !item.type;
|
|
@@ -81,11 +82,11 @@ function collectSidebarNavigation(sidebar) {
|
|
|
81
82
|
}
|
|
82
83
|
exports.collectSidebarNavigation = collectSidebarNavigation;
|
|
83
84
|
function collectSidebarsDocIds(sidebars) {
|
|
84
|
-
return
|
|
85
|
+
return lodash_1.default.mapValues(sidebars, collectSidebarDocIds);
|
|
85
86
|
}
|
|
86
87
|
exports.collectSidebarsDocIds = collectSidebarsDocIds;
|
|
87
88
|
function collectSidebarsNavigations(sidebars) {
|
|
88
|
-
return
|
|
89
|
+
return lodash_1.default.mapValues(sidebars, collectSidebarNavigation);
|
|
89
90
|
}
|
|
90
91
|
exports.collectSidebarsNavigations = collectSidebarsNavigations;
|
|
91
92
|
function createSidebarsUtils(sidebars) {
|
|
@@ -172,14 +173,14 @@ function createSidebarsUtils(sidebars) {
|
|
|
172
173
|
}
|
|
173
174
|
function checkSidebarsDocIds(validDocIds, sidebarFilePath) {
|
|
174
175
|
const allSidebarDocIds = Object.values(sidebarNameToDocIds).flat();
|
|
175
|
-
const invalidSidebarDocIds =
|
|
176
|
+
const invalidSidebarDocIds = lodash_1.default.difference(allSidebarDocIds, validDocIds);
|
|
176
177
|
if (invalidSidebarDocIds.length > 0) {
|
|
177
178
|
throw new Error(`Invalid sidebar file at "${(0, utils_1.toMessageRelativeFilePath)(sidebarFilePath)}".
|
|
178
179
|
These sidebar document ids do not exist:
|
|
179
180
|
- ${invalidSidebarDocIds.sort().join('\n- ')}
|
|
180
181
|
|
|
181
182
|
Available document ids are:
|
|
182
|
-
- ${
|
|
183
|
+
- ${lodash_1.default.uniq(validDocIds).sort().join('\n- ')}`);
|
|
183
184
|
}
|
|
184
185
|
}
|
|
185
186
|
function getFirstLink(sidebar) {
|
package/lib/tags.js
CHANGED
|
@@ -7,11 +7,12 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.getVersionTags = void 0;
|
|
10
|
+
const tslib_1 = require("tslib");
|
|
10
11
|
const utils_1 = require("@docusaurus/utils");
|
|
11
|
-
const lodash_1 = require("lodash");
|
|
12
|
+
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
12
13
|
function getVersionTags(docs) {
|
|
13
14
|
const groups = (0, utils_1.groupTaggedItems)(docs, (doc) => doc.tags);
|
|
14
|
-
return
|
|
15
|
+
return lodash_1.default.mapValues(groups, (group) => ({
|
|
15
16
|
name: group.tag.label,
|
|
16
17
|
docIds: group.items.map((item) => item.id),
|
|
17
18
|
permalink: group.tag.permalink,
|
package/lib/translations.js
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.translateLoadedContent = exports.getLoadedContentTranslationFiles = void 0;
|
|
10
|
-
const
|
|
10
|
+
const tslib_1 = require("tslib");
|
|
11
|
+
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
11
12
|
const utils_1 = require("./sidebars/utils");
|
|
12
13
|
const utils_2 = require("@docusaurus/utils");
|
|
13
14
|
const constants_1 = require("./constants");
|
|
@@ -108,13 +109,13 @@ function getSidebarTranslationFileContent(sidebar, sidebarName) {
|
|
|
108
109
|
return entries;
|
|
109
110
|
}));
|
|
110
111
|
const links = (0, utils_1.collectSidebarLinks)(sidebar);
|
|
111
|
-
const linksContent = (
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
112
|
+
const linksContent = Object.fromEntries(links.map((link) => [
|
|
113
|
+
`sidebar.${sidebarName}.link.${link.label}`,
|
|
114
|
+
{
|
|
115
|
+
message: link.label,
|
|
116
|
+
description: `The label for link ${link.label} in sidebar ${sidebarName}, linking to ${link.href}`,
|
|
117
|
+
},
|
|
118
|
+
]));
|
|
118
119
|
return (0, utils_2.mergeTranslations)([categoryContent, linksContent]);
|
|
119
120
|
}
|
|
120
121
|
function translateSidebar({ sidebar, sidebarName, sidebarsTranslations, }) {
|
|
@@ -163,7 +164,7 @@ function getSidebarsTranslations(version) {
|
|
|
163
164
|
}));
|
|
164
165
|
}
|
|
165
166
|
function translateSidebars(version, sidebarsTranslations) {
|
|
166
|
-
return
|
|
167
|
+
return lodash_1.default.mapValues(version.sidebars, (sidebar, sidebarName) => translateSidebar({
|
|
167
168
|
sidebar,
|
|
168
169
|
sidebarName: getNormalizedSidebarName({
|
|
169
170
|
sidebarName,
|
|
@@ -214,7 +215,7 @@ function getLoadedContentTranslationFiles(loadedContent) {
|
|
|
214
215
|
}
|
|
215
216
|
exports.getLoadedContentTranslationFiles = getLoadedContentTranslationFiles;
|
|
216
217
|
function translateLoadedContent(loadedContent, translationFiles) {
|
|
217
|
-
const translationFilesMap =
|
|
218
|
+
const translationFilesMap = lodash_1.default.keyBy(translationFiles, (f) => f.path);
|
|
218
219
|
return {
|
|
219
220
|
loadedVersions: translateVersions(loadedContent.loadedVersions, translationFilesMap),
|
|
220
221
|
};
|
package/lib/versions.js
CHANGED
|
@@ -12,7 +12,7 @@ const path_1 = (0, tslib_1.__importDefault)(require("path"));
|
|
|
12
12
|
const fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
|
|
13
13
|
const constants_1 = require("./constants");
|
|
14
14
|
const utils_1 = require("@docusaurus/utils");
|
|
15
|
-
const lodash_1 = require("lodash");
|
|
15
|
+
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
|
|
16
16
|
const sidebars_1 = require("./sidebars");
|
|
17
17
|
// retro-compatibility: no prefix for the default plugin id
|
|
18
18
|
function addPluginIdPrefix(fileOrDir, pluginId) {
|
|
@@ -273,7 +273,7 @@ function checkVersionsOptions(availableVersionNames, options) {
|
|
|
273
273
|
!availableVersionNames.includes(options.lastVersion)) {
|
|
274
274
|
throw new Error(`Docs option lastVersion: ${options.lastVersion} is invalid. ${availableVersionNamesMsg}`);
|
|
275
275
|
}
|
|
276
|
-
const unknownVersionConfigNames =
|
|
276
|
+
const unknownVersionConfigNames = lodash_1.default.difference(Object.keys(options.versions), availableVersionNames);
|
|
277
277
|
if (unknownVersionConfigNames.length > 0) {
|
|
278
278
|
throw new Error(`Invalid docs option "versions": unknown versions (${unknownVersionConfigNames.join(',')}) found. ${availableVersionNamesMsg}`);
|
|
279
279
|
}
|
|
@@ -281,7 +281,7 @@ function checkVersionsOptions(availableVersionNames, options) {
|
|
|
281
281
|
if (options.onlyIncludeVersions.length === 0) {
|
|
282
282
|
throw new Error(`Invalid docs option "onlyIncludeVersions": an empty array is not allowed, at least one version is needed.`);
|
|
283
283
|
}
|
|
284
|
-
const unknownOnlyIncludeVersionNames =
|
|
284
|
+
const unknownOnlyIncludeVersionNames = lodash_1.default.difference(options.onlyIncludeVersions, availableVersionNames);
|
|
285
285
|
if (unknownOnlyIncludeVersionNames.length > 0) {
|
|
286
286
|
throw new Error(`Invalid docs option "onlyIncludeVersions": unknown versions (${unknownOnlyIncludeVersionNames.join(',')}) found. ${availableVersionNamesMsg}`);
|
|
287
287
|
}
|
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-4609",
|
|
4
4
|
"description": "Docs plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@docusaurus/core": "0.0.0-
|
|
27
|
-
"@docusaurus/logger": "0.0.0-
|
|
28
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
29
|
-
"@docusaurus/utils": "0.0.0-
|
|
30
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
26
|
+
"@docusaurus/core": "0.0.0-4609",
|
|
27
|
+
"@docusaurus/logger": "0.0.0-4609",
|
|
28
|
+
"@docusaurus/mdx-loader": "0.0.0-4609",
|
|
29
|
+
"@docusaurus/utils": "0.0.0-4609",
|
|
30
|
+
"@docusaurus/utils-validation": "0.0.0-4609",
|
|
31
31
|
"combine-promises": "^1.1.0",
|
|
32
32
|
"fs-extra": "^10.0.0",
|
|
33
33
|
"import-fresh": "^3.3.0",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"remark-admonitions": "^1.2.1",
|
|
37
37
|
"tslib": "^2.3.1",
|
|
38
38
|
"utility-types": "^3.10.0",
|
|
39
|
-
"webpack": "^5.
|
|
39
|
+
"webpack": "^5.69.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
43
|
-
"@docusaurus/types": "0.0.0-
|
|
42
|
+
"@docusaurus/module-type-aliases": "0.0.0-4609",
|
|
43
|
+
"@docusaurus/types": "0.0.0-4609",
|
|
44
44
|
"@types/js-yaml": "^4.0.5",
|
|
45
45
|
"@types/picomatch": "^2.3.0",
|
|
46
46
|
"commander": "^5.1.0",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"engines": {
|
|
57
57
|
"node": ">=14"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "398a24ae6b46221f1b07e23573affd1641861431"
|
|
60
60
|
}
|
package/src/docs.ts
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
import path from 'path';
|
|
9
9
|
import fs from 'fs-extra';
|
|
10
10
|
import logger from '@docusaurus/logger';
|
|
11
|
-
import {keyBy} from 'lodash';
|
|
12
11
|
import {
|
|
13
12
|
aliasedSitePath,
|
|
14
13
|
getEditUrl,
|
|
@@ -444,8 +443,10 @@ export function getDocIds(doc: DocMetadataBase): [string, string] {
|
|
|
444
443
|
export function createDocsByIdIndex<
|
|
445
444
|
Doc extends {id: string; unversionedId: string},
|
|
446
445
|
>(docs: Doc[]): Record<string, Doc> {
|
|
447
|
-
return
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
446
|
+
return Object.fromEntries(
|
|
447
|
+
docs.flatMap((doc) => [
|
|
448
|
+
[doc.unversionedId, doc],
|
|
449
|
+
[doc.id, doc],
|
|
450
|
+
]),
|
|
451
|
+
);
|
|
451
452
|
}
|
package/src/globalData.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import _ from 'lodash';
|
|
9
9
|
import {normalizeUrl} from '@docusaurus/utils';
|
|
10
10
|
import type {Sidebars} from './sidebars/types';
|
|
11
11
|
import {createSidebarsUtils} from './sidebars/utils';
|
|
@@ -43,7 +43,7 @@ export function toGlobalSidebars(
|
|
|
43
43
|
version: LoadedVersion,
|
|
44
44
|
): Record<string, GlobalSidebar> {
|
|
45
45
|
const {getFirstLink} = createSidebarsUtils(sidebars);
|
|
46
|
-
return mapValues(sidebars, (sidebar, sidebarId) => {
|
|
46
|
+
return _.mapValues(sidebars, (sidebar, sidebarId) => {
|
|
47
47
|
const firstLink = getFirstLink(sidebarId);
|
|
48
48
|
if (!firstLink) {
|
|
49
49
|
return {};
|
package/src/index.ts
CHANGED
|
@@ -42,7 +42,6 @@ import type {
|
|
|
42
42
|
import type {RuleSetRule} from 'webpack';
|
|
43
43
|
import {cliDocsVersionCommand} from './cli';
|
|
44
44
|
import {VERSIONS_JSON_FILE} from './constants';
|
|
45
|
-
import {keyBy, mapValues} from 'lodash';
|
|
46
45
|
import {toGlobalDataVersion} from './globalData';
|
|
47
46
|
import {toTagDocListProp} from './props';
|
|
48
47
|
import {
|
|
@@ -311,9 +310,8 @@ export default async function pluginContentDocs(
|
|
|
311
310
|
|
|
312
311
|
function getSourceToPermalink(): SourceToPermalink {
|
|
313
312
|
const allDocs = content.loadedVersions.flatMap((v) => v.docs);
|
|
314
|
-
return
|
|
315
|
-
|
|
316
|
-
(d) => d.permalink,
|
|
313
|
+
return Object.fromEntries(
|
|
314
|
+
allDocs.map(({source, permalink}) => [source, permalink]),
|
|
317
315
|
);
|
|
318
316
|
}
|
|
319
317
|
|
package/src/props.ts
CHANGED
|
@@ -22,7 +22,7 @@ import type {
|
|
|
22
22
|
PropTagDocListDoc,
|
|
23
23
|
PropSidebarItemLink,
|
|
24
24
|
} from '@docusaurus/plugin-content-docs';
|
|
25
|
-
import
|
|
25
|
+
import _ from 'lodash';
|
|
26
26
|
import {createDocsByIdIndex} from './docs';
|
|
27
27
|
|
|
28
28
|
export function toSidebarsProp(loadedVersion: LoadedVersion): PropSidebars {
|
|
@@ -93,18 +93,22 @@ Available document ids are:
|
|
|
93
93
|
// Transform the sidebar so that all sidebar item will be in the
|
|
94
94
|
// form of 'link' or 'category' only.
|
|
95
95
|
// This is what will be passed as props to the UI component.
|
|
96
|
-
return mapValues(loadedVersion.sidebars, (items) =>
|
|
96
|
+
return _.mapValues(loadedVersion.sidebars, (items) =>
|
|
97
|
+
items.map(normalizeItem),
|
|
98
|
+
);
|
|
97
99
|
}
|
|
98
100
|
|
|
99
101
|
function toVersionDocsProp(loadedVersion: LoadedVersion): PropVersionDocs {
|
|
100
|
-
return
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
102
|
+
return Object.fromEntries(
|
|
103
|
+
loadedVersion.docs.map((doc) => [
|
|
104
|
+
doc.unversionedId,
|
|
105
|
+
{
|
|
106
|
+
id: doc.unversionedId,
|
|
107
|
+
title: doc.title,
|
|
108
|
+
description: doc.description,
|
|
109
|
+
sidebar: doc.sidebar,
|
|
110
|
+
},
|
|
111
|
+
]),
|
|
108
112
|
);
|
|
109
113
|
}
|
|
110
114
|
|
|
@@ -135,7 +139,7 @@ export function toTagDocListProp({
|
|
|
135
139
|
docs: Pick<DocMetadata, 'id' | 'title' | 'description' | 'permalink'>[];
|
|
136
140
|
}): PropTagDocList {
|
|
137
141
|
function toDocListProp(): PropTagDocListDoc[] {
|
|
138
|
-
const list = compact(
|
|
142
|
+
const list = _.compact(
|
|
139
143
|
tag.docIds.map((id) => docs.find((doc) => doc.id === id)),
|
|
140
144
|
);
|
|
141
145
|
// Sort docs by title
|
|
@@ -13,7 +13,7 @@ import type {
|
|
|
13
13
|
NormalizedSidebarItem,
|
|
14
14
|
SidebarItemCategoryLinkConfig,
|
|
15
15
|
} from './types';
|
|
16
|
-
import
|
|
16
|
+
import _ from 'lodash';
|
|
17
17
|
import {addTrailingSlash, posixPath} from '@docusaurus/utils';
|
|
18
18
|
import logger from '@docusaurus/logger';
|
|
19
19
|
import path from 'path';
|
|
@@ -25,7 +25,7 @@ const docIdPrefix = '$doc$/';
|
|
|
25
25
|
|
|
26
26
|
// Just an alias to the make code more explicit
|
|
27
27
|
function getLocalDocId(docId: string): string {
|
|
28
|
-
return last(docId.split('/'))!;
|
|
28
|
+
return _.last(docId.split('/'))!;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export const CategoryMetadataFilenameBase = '_category_';
|
|
@@ -248,7 +248,7 @@ export const DefaultSidebarItemsGenerator: SidebarItemsGenerator = async ({
|
|
|
248
248
|
}
|
|
249
249
|
return item;
|
|
250
250
|
});
|
|
251
|
-
const sortedSidebarItems = sortBy(
|
|
251
|
+
const sortedSidebarItems = _.sortBy(
|
|
252
252
|
processedSidebarItems,
|
|
253
253
|
(item) => item.position,
|
|
254
254
|
);
|
package/src/sidebars/index.ts
CHANGED
|
@@ -17,7 +17,7 @@ import {Globby} from '@docusaurus/utils';
|
|
|
17
17
|
import logger from '@docusaurus/logger';
|
|
18
18
|
import type {PluginOptions} from '@docusaurus/plugin-content-docs';
|
|
19
19
|
import Yaml from 'js-yaml';
|
|
20
|
-
import
|
|
20
|
+
import _ from 'lodash';
|
|
21
21
|
import combinePromises from 'combine-promises';
|
|
22
22
|
|
|
23
23
|
export const DefaultSidebars: SidebarsConfig = {
|
|
@@ -46,9 +46,9 @@ async function readCategoriesMetadata(contentPath: string) {
|
|
|
46
46
|
const categoryFiles = await Globby('**/_category_.{json,yml,yaml}', {
|
|
47
47
|
cwd: contentPath,
|
|
48
48
|
});
|
|
49
|
-
const categoryToFile = groupBy(categoryFiles, path.dirname);
|
|
49
|
+
const categoryToFile = _.groupBy(categoryFiles, path.dirname);
|
|
50
50
|
return combinePromises(
|
|
51
|
-
mapValues(categoryToFile, async (files, folder) => {
|
|
51
|
+
_.mapValues(categoryToFile, async (files, folder) => {
|
|
52
52
|
const [filePath] = files;
|
|
53
53
|
if (files.length > 1) {
|
|
54
54
|
logger.warn`There are more than one category metadata files for path=${folder}: ${files.join(
|
|
@@ -17,7 +17,7 @@ import type {
|
|
|
17
17
|
NormalizedSidebarItemCategory,
|
|
18
18
|
} from './types';
|
|
19
19
|
import {isCategoriesShorthand} from './utils';
|
|
20
|
-
import
|
|
20
|
+
import _ from 'lodash';
|
|
21
21
|
|
|
22
22
|
function normalizeCategoriesShorthand(
|
|
23
23
|
sidebar: SidebarCategoriesShorthand,
|
|
@@ -81,5 +81,5 @@ function normalizeSidebar(sidebar: SidebarConfig): NormalizedSidebar {
|
|
|
81
81
|
export function normalizeSidebars(
|
|
82
82
|
sidebars: SidebarsConfig,
|
|
83
83
|
): NormalizedSidebars {
|
|
84
|
-
return mapValues(sidebars, normalizeSidebar);
|
|
84
|
+
return _.mapValues(sidebars, normalizeSidebar);
|
|
85
85
|
}
|
|
@@ -15,7 +15,7 @@ import type {
|
|
|
15
15
|
ProcessedSidebars,
|
|
16
16
|
SidebarItemCategoryLink,
|
|
17
17
|
} from './types';
|
|
18
|
-
import
|
|
18
|
+
import _ from 'lodash';
|
|
19
19
|
|
|
20
20
|
function normalizeCategoryLink(
|
|
21
21
|
category: ProcessedSidebarItemCategory,
|
|
@@ -88,7 +88,7 @@ export function postProcessSidebars(
|
|
|
88
88
|
sidebars: ProcessedSidebars,
|
|
89
89
|
params: SidebarProcessorParams,
|
|
90
90
|
): Sidebars {
|
|
91
|
-
return mapValues(sidebars, (sidebar) =>
|
|
91
|
+
return _.mapValues(sidebars, (sidebar) =>
|
|
92
92
|
sidebar.map((item) => postProcessSidebarItem(item, params)),
|
|
93
93
|
);
|
|
94
94
|
}
|
|
@@ -21,14 +21,14 @@ import type {
|
|
|
21
21
|
} from './types';
|
|
22
22
|
import {DefaultSidebarItemsGenerator} from './generator';
|
|
23
23
|
import {validateSidebars} from './validation';
|
|
24
|
-
import
|
|
24
|
+
import _ from 'lodash';
|
|
25
25
|
import combinePromises from 'combine-promises';
|
|
26
26
|
import {isCategoryIndex} from '../docs';
|
|
27
27
|
|
|
28
28
|
function toSidebarItemsGeneratorDoc(
|
|
29
29
|
doc: DocMetadataBase,
|
|
30
30
|
): SidebarItemsGeneratorDoc {
|
|
31
|
-
return pick(doc, [
|
|
31
|
+
return _.pick(doc, [
|
|
32
32
|
'id',
|
|
33
33
|
'unversionedId',
|
|
34
34
|
'frontMatter',
|
|
@@ -41,7 +41,7 @@ function toSidebarItemsGeneratorDoc(
|
|
|
41
41
|
function toSidebarItemsGeneratorVersion(
|
|
42
42
|
version: VersionMetadata,
|
|
43
43
|
): SidebarItemsGeneratorVersion {
|
|
44
|
-
return pick(version, ['versionName', 'contentPath']);
|
|
44
|
+
return _.pick(version, ['versionName', 'contentPath']);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
// Handle the generation of autogenerated sidebar items and other
|
|
@@ -60,7 +60,7 @@ async function processSidebar(
|
|
|
60
60
|
} = params;
|
|
61
61
|
|
|
62
62
|
// Just a minor lazy transformation optimization
|
|
63
|
-
const getSidebarItemsGeneratorDocsAndVersion = memoize(() => ({
|
|
63
|
+
const getSidebarItemsGeneratorDocsAndVersion = _.memoize(() => ({
|
|
64
64
|
docs: docs.map(toSidebarItemsGeneratorDoc),
|
|
65
65
|
version: toSidebarItemsGeneratorVersion(version),
|
|
66
66
|
}));
|
|
@@ -117,7 +117,7 @@ export async function processSidebars(
|
|
|
117
117
|
params: SidebarProcessorParams,
|
|
118
118
|
): Promise<ProcessedSidebars> {
|
|
119
119
|
const processedSidebars = await combinePromises(
|
|
120
|
-
mapValues(unprocessedSidebars, (unprocessedSidebar) =>
|
|
120
|
+
_.mapValues(unprocessedSidebars, (unprocessedSidebar) =>
|
|
121
121
|
processSidebar(unprocessedSidebar, categoriesMetadata, params),
|
|
122
122
|
),
|
|
123
123
|
);
|
package/src/sidebars/utils.ts
CHANGED
|
@@ -19,7 +19,7 @@ import type {
|
|
|
19
19
|
SidebarNavigationItem,
|
|
20
20
|
} from './types';
|
|
21
21
|
|
|
22
|
-
import
|
|
22
|
+
import _ from 'lodash';
|
|
23
23
|
import {getElementsAround, toMessageRelativeFilePath} from '@docusaurus/utils';
|
|
24
24
|
import type {DocMetadataBase, DocNavLink} from '../types';
|
|
25
25
|
|
|
@@ -110,13 +110,13 @@ export function collectSidebarNavigation(
|
|
|
110
110
|
export function collectSidebarsDocIds(
|
|
111
111
|
sidebars: Sidebars,
|
|
112
112
|
): Record<string, string[]> {
|
|
113
|
-
return mapValues(sidebars, collectSidebarDocIds);
|
|
113
|
+
return _.mapValues(sidebars, collectSidebarDocIds);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
export function collectSidebarsNavigations(
|
|
117
117
|
sidebars: Sidebars,
|
|
118
118
|
): Record<string, SidebarNavigationItem[]> {
|
|
119
|
-
return mapValues(sidebars, collectSidebarNavigation);
|
|
119
|
+
return _.mapValues(sidebars, collectSidebarNavigation);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
export type SidebarNavigation = {
|
|
@@ -276,7 +276,7 @@ export function createSidebarsUtils(sidebars: Sidebars): SidebarsUtils {
|
|
|
276
276
|
|
|
277
277
|
function checkSidebarsDocIds(validDocIds: string[], sidebarFilePath: string) {
|
|
278
278
|
const allSidebarDocIds = Object.values(sidebarNameToDocIds).flat();
|
|
279
|
-
const invalidSidebarDocIds = difference(allSidebarDocIds, validDocIds);
|
|
279
|
+
const invalidSidebarDocIds = _.difference(allSidebarDocIds, validDocIds);
|
|
280
280
|
if (invalidSidebarDocIds.length > 0) {
|
|
281
281
|
throw new Error(
|
|
282
282
|
`Invalid sidebar file at "${toMessageRelativeFilePath(
|
|
@@ -286,7 +286,7 @@ These sidebar document ids do not exist:
|
|
|
286
286
|
- ${invalidSidebarDocIds.sort().join('\n- ')}
|
|
287
287
|
|
|
288
288
|
Available document ids are:
|
|
289
|
-
- ${uniq(validDocIds).sort().join('\n- ')}`,
|
|
289
|
+
- ${_.uniq(validDocIds).sort().join('\n- ')}`,
|
|
290
290
|
);
|
|
291
291
|
}
|
|
292
292
|
}
|
package/src/tags.ts
CHANGED
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
import {groupTaggedItems} from '@docusaurus/utils';
|
|
9
9
|
import type {VersionTags, DocMetadata} from './types';
|
|
10
|
-
import
|
|
10
|
+
import _ from 'lodash';
|
|
11
11
|
|
|
12
12
|
export function getVersionTags(docs: DocMetadata[]): VersionTags {
|
|
13
13
|
const groups = groupTaggedItems(docs, (doc) => doc.tags);
|
|
14
|
-
return mapValues(groups, (group) => ({
|
|
14
|
+
return _.mapValues(groups, (group) => ({
|
|
15
15
|
name: group.tag.label,
|
|
16
16
|
docIds: group.items.map((item) => item.id),
|
|
17
17
|
permalink: group.tag.permalink,
|
package/src/translations.ts
CHANGED
|
@@ -13,7 +13,7 @@ import type {
|
|
|
13
13
|
Sidebars,
|
|
14
14
|
} from './sidebars/types';
|
|
15
15
|
|
|
16
|
-
import
|
|
16
|
+
import _ from 'lodash';
|
|
17
17
|
import {
|
|
18
18
|
collectSidebarCategories,
|
|
19
19
|
transformSidebarItems,
|
|
@@ -146,13 +146,15 @@ function getSidebarTranslationFileContent(
|
|
|
146
146
|
);
|
|
147
147
|
|
|
148
148
|
const links = collectSidebarLinks(sidebar);
|
|
149
|
-
const linksContent: TranslationFileContent =
|
|
150
|
-
.
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
149
|
+
const linksContent: TranslationFileContent = Object.fromEntries(
|
|
150
|
+
links.map((link) => [
|
|
151
|
+
`sidebar.${sidebarName}.link.${link.label}`,
|
|
152
|
+
{
|
|
153
|
+
message: link.label,
|
|
154
|
+
description: `The label for link ${link.label} in sidebar ${sidebarName}, linking to ${link.href}`,
|
|
155
|
+
},
|
|
156
|
+
]),
|
|
157
|
+
);
|
|
156
158
|
|
|
157
159
|
return mergeTranslations([categoryContent, linksContent]);
|
|
158
160
|
}
|
|
@@ -230,7 +232,7 @@ function translateSidebars(
|
|
|
230
232
|
version: LoadedVersion,
|
|
231
233
|
sidebarsTranslations: TranslationFileContent,
|
|
232
234
|
): Sidebars {
|
|
233
|
-
return mapValues(version.sidebars, (sidebar, sidebarName) =>
|
|
235
|
+
return _.mapValues(version.sidebars, (sidebar, sidebarName) =>
|
|
234
236
|
translateSidebar({
|
|
235
237
|
sidebar,
|
|
236
238
|
sidebarName: getNormalizedSidebarName({
|
|
@@ -302,7 +304,7 @@ export function translateLoadedContent(
|
|
|
302
304
|
loadedContent: LoadedContent,
|
|
303
305
|
translationFiles: TranslationFile[],
|
|
304
306
|
): LoadedContent {
|
|
305
|
-
const translationFilesMap: Record<string, TranslationFile> = keyBy(
|
|
307
|
+
const translationFilesMap: Record<string, TranslationFile> = _.keyBy(
|
|
306
308
|
translationFiles,
|
|
307
309
|
(f) => f.path,
|
|
308
310
|
);
|
package/src/versions.ts
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
posixPath,
|
|
29
29
|
DEFAULT_PLUGIN_ID,
|
|
30
30
|
} from '@docusaurus/utils';
|
|
31
|
-
import
|
|
31
|
+
import _ from 'lodash';
|
|
32
32
|
import {resolveSidebarPathOption} from './sidebars';
|
|
33
33
|
|
|
34
34
|
// retro-compatibility: no prefix for the default plugin id
|
|
@@ -486,7 +486,7 @@ function checkVersionsOptions(
|
|
|
486
486
|
`Docs option lastVersion: ${options.lastVersion} is invalid. ${availableVersionNamesMsg}`,
|
|
487
487
|
);
|
|
488
488
|
}
|
|
489
|
-
const unknownVersionConfigNames = difference(
|
|
489
|
+
const unknownVersionConfigNames = _.difference(
|
|
490
490
|
Object.keys(options.versions),
|
|
491
491
|
availableVersionNames,
|
|
492
492
|
);
|
|
@@ -504,7 +504,7 @@ function checkVersionsOptions(
|
|
|
504
504
|
`Invalid docs option "onlyIncludeVersions": an empty array is not allowed, at least one version is needed.`,
|
|
505
505
|
);
|
|
506
506
|
}
|
|
507
|
-
const unknownOnlyIncludeVersionNames = difference(
|
|
507
|
+
const unknownOnlyIncludeVersionNames = _.difference(
|
|
508
508
|
options.onlyIncludeVersions,
|
|
509
509
|
availableVersionNames,
|
|
510
510
|
);
|