@docusaurus/plugin-content-docs 0.0.0-4679 → 0.0.0-4680
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/sidebars/index.js +1 -1
- package/lib/sidebars/utils.js +2 -2
- package/lib/translations.js +5 -2
- package/package.json +9 -9
- package/src/docs.ts +1 -1
- package/src/sidebars/index.ts +1 -1
- package/src/sidebars/utils.ts +4 -4
- package/src/translations.ts +6 -2
- package/src/versions.ts +2 -2
package/lib/sidebars/index.js
CHANGED
|
@@ -43,7 +43,7 @@ async function readCategoriesMetadata(contentPath) {
|
|
|
43
43
|
});
|
|
44
44
|
const categoryToFile = lodash_1.default.groupBy(categoryFiles, path_1.default.dirname);
|
|
45
45
|
return (0, combine_promises_1.default)(lodash_1.default.mapValues(categoryToFile, async (files, folder) => {
|
|
46
|
-
const
|
|
46
|
+
const filePath = files[0];
|
|
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.`;
|
|
49
49
|
}
|
package/lib/sidebars/utils.js
CHANGED
|
@@ -119,10 +119,10 @@ function createSidebarsUtils(sidebars) {
|
|
|
119
119
|
if (!sidebarName) {
|
|
120
120
|
return emptySidebarNavigation();
|
|
121
121
|
}
|
|
122
|
-
|
|
122
|
+
const navigationItems = sidebarNameToNavigationItems[sidebarName];
|
|
123
|
+
if (!navigationItems) {
|
|
123
124
|
throw new Error(`Doc with ID ${docId} wants to display sidebar ${sidebarName} but a sidebar with this name doesn't exist`);
|
|
124
125
|
}
|
|
125
|
-
const navigationItems = sidebarNameToNavigationItems[sidebarName];
|
|
126
126
|
const currentItemIndex = navigationItems.findIndex((item) => {
|
|
127
127
|
if (item.type === 'doc') {
|
|
128
128
|
return item.id === docId;
|
package/lib/translations.js
CHANGED
|
@@ -195,10 +195,13 @@ function getVersionTranslationFiles(version) {
|
|
|
195
195
|
];
|
|
196
196
|
}
|
|
197
197
|
function translateVersion(version, translationFiles) {
|
|
198
|
-
const versionTranslations = translationFiles[getVersionFileName(version.versionName)]
|
|
198
|
+
const versionTranslations = translationFiles[getVersionFileName(version.versionName)]?.content;
|
|
199
|
+
if (!versionTranslations) {
|
|
200
|
+
return version;
|
|
201
|
+
}
|
|
199
202
|
return {
|
|
200
203
|
...version,
|
|
201
|
-
versionLabel: versionTranslations['version.label']?.message,
|
|
204
|
+
versionLabel: versionTranslations['version.label']?.message ?? version.versionLabel,
|
|
202
205
|
sidebars: translateSidebars(version, versionTranslations),
|
|
203
206
|
// docs: translateDocs(version.docs, versionTranslations),
|
|
204
207
|
};
|
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-4680",
|
|
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-4680",
|
|
27
|
+
"@docusaurus/logger": "0.0.0-4680",
|
|
28
|
+
"@docusaurus/mdx-loader": "0.0.0-4680",
|
|
29
|
+
"@docusaurus/utils": "0.0.0-4680",
|
|
30
|
+
"@docusaurus/utils-validation": "0.0.0-4680",
|
|
31
31
|
"combine-promises": "^1.1.0",
|
|
32
32
|
"fs-extra": "^10.0.1",
|
|
33
33
|
"import-fresh": "^3.3.0",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
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-4680",
|
|
43
|
+
"@docusaurus/types": "0.0.0-4680",
|
|
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": "367835b86a28dea97e2addba03291438a5f813f8"
|
|
60
60
|
}
|
package/src/docs.ts
CHANGED
package/src/sidebars/index.ts
CHANGED
|
@@ -49,7 +49,7 @@ async function readCategoriesMetadata(contentPath: string) {
|
|
|
49
49
|
const categoryToFile = _.groupBy(categoryFiles, path.dirname);
|
|
50
50
|
return combinePromises(
|
|
51
51
|
_.mapValues(categoryToFile, async (files, folder) => {
|
|
52
|
-
const
|
|
52
|
+
const filePath = files[0]!;
|
|
53
53
|
if (files.length > 1) {
|
|
54
54
|
logger.warn`There are more than one category metadata files for path=${folder}: ${files.join(
|
|
55
55
|
', ',
|
package/src/sidebars/utils.ts
CHANGED
|
@@ -201,12 +201,12 @@ export function createSidebarsUtils(sidebars: Sidebars): SidebarsUtils {
|
|
|
201
201
|
if (!sidebarName) {
|
|
202
202
|
return emptySidebarNavigation();
|
|
203
203
|
}
|
|
204
|
-
|
|
204
|
+
const navigationItems = sidebarNameToNavigationItems[sidebarName];
|
|
205
|
+
if (!navigationItems) {
|
|
205
206
|
throw new Error(
|
|
206
207
|
`Doc with ID ${docId} wants to display sidebar ${sidebarName} but a sidebar with this name doesn't exist`,
|
|
207
208
|
);
|
|
208
209
|
}
|
|
209
|
-
const navigationItems = sidebarNameToNavigationItems[sidebarName];
|
|
210
210
|
const currentItemIndex = navigationItems.findIndex((item) => {
|
|
211
211
|
if (item.type === 'doc') {
|
|
212
212
|
return item.id === docId;
|
|
@@ -263,7 +263,7 @@ export function createSidebarsUtils(sidebars: Sidebars): SidebarsUtils {
|
|
|
263
263
|
if (!sidebarName) {
|
|
264
264
|
return emptySidebarNavigation();
|
|
265
265
|
}
|
|
266
|
-
const navigationItems = sidebarNameToNavigationItems[sidebarName]
|
|
266
|
+
const navigationItems = sidebarNameToNavigationItems[sidebarName]!;
|
|
267
267
|
const currentItemIndex = navigationItems.findIndex(
|
|
268
268
|
isCurrentCategoryGeneratedIndexItem,
|
|
269
269
|
);
|
|
@@ -341,7 +341,7 @@ Available document ids are:
|
|
|
341
341
|
getCategoryGeneratedIndexList,
|
|
342
342
|
getCategoryGeneratedIndexNavigation,
|
|
343
343
|
checkSidebarsDocIds,
|
|
344
|
-
getFirstLink: (id) => getFirstLink(sidebars[id]),
|
|
344
|
+
getFirstLink: (id) => getFirstLink(sidebars[id]!),
|
|
345
345
|
};
|
|
346
346
|
}
|
|
347
347
|
|
package/src/translations.ts
CHANGED
|
@@ -274,10 +274,14 @@ function translateVersion(
|
|
|
274
274
|
translationFiles: Record<string, TranslationFile>,
|
|
275
275
|
): LoadedVersion {
|
|
276
276
|
const versionTranslations =
|
|
277
|
-
translationFiles[getVersionFileName(version.versionName)]
|
|
277
|
+
translationFiles[getVersionFileName(version.versionName)]?.content;
|
|
278
|
+
if (!versionTranslations) {
|
|
279
|
+
return version;
|
|
280
|
+
}
|
|
278
281
|
return {
|
|
279
282
|
...version,
|
|
280
|
-
versionLabel:
|
|
283
|
+
versionLabel:
|
|
284
|
+
versionTranslations['version.label']?.message ?? version.versionLabel,
|
|
281
285
|
sidebars: translateSidebars(version, versionTranslations),
|
|
282
286
|
// docs: translateDocs(version.docs, versionTranslations),
|
|
283
287
|
};
|
package/src/versions.ts
CHANGED
|
@@ -464,11 +464,11 @@ Please set the docs "sidebarPath" field in your config file to:
|
|
|
464
464
|
// "last version" is not a very good concept nor api surface
|
|
465
465
|
function getDefaultLastVersionName(versionNames: string[]) {
|
|
466
466
|
if (versionNames.length === 1) {
|
|
467
|
-
return versionNames[0]
|
|
467
|
+
return versionNames[0]!;
|
|
468
468
|
}
|
|
469
469
|
return versionNames.filter(
|
|
470
470
|
(versionName) => versionName !== CURRENT_VERSION_NAME,
|
|
471
|
-
)[0]
|
|
471
|
+
)[0]!;
|
|
472
472
|
}
|
|
473
473
|
|
|
474
474
|
function checkVersionsOptions(
|