@docusaurus/plugin-content-docs 0.0.0-4680 → 0.0.0-4684
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.
|
@@ -11,9 +11,6 @@ const utils_1 = require("./sidebars/utils");
|
|
|
11
11
|
const docs_1 = require("./docs");
|
|
12
12
|
function getCategoryGeneratedIndexMetadata({ category, sidebarsUtils, docsById, }) {
|
|
13
13
|
const { sidebarName, previous, next } = sidebarsUtils.getCategoryGeneratedIndexNavigation(category.link.permalink);
|
|
14
|
-
if (!sidebarName) {
|
|
15
|
-
throw new Error('unexpected');
|
|
16
|
-
}
|
|
17
14
|
return {
|
|
18
15
|
title: category.link.title ?? category.label,
|
|
19
16
|
description: category.link.description,
|
|
@@ -27,7 +27,9 @@ const DefaultSidebarItemsGenerator = async ({ numberPrefixParser, isCategoryInde
|
|
|
27
27
|
const getDoc = (docId) => {
|
|
28
28
|
const doc = findDoc(docId);
|
|
29
29
|
if (!doc) {
|
|
30
|
-
throw new Error(`Can't find any doc with
|
|
30
|
+
throw new Error(`Can't find any doc with ID ${docId}.
|
|
31
|
+
Available doc IDs:
|
|
32
|
+
- ${Object.keys(docsById).join('\n- ')}`);
|
|
31
33
|
}
|
|
32
34
|
return doc;
|
|
33
35
|
};
|
package/lib/sidebars/utils.js
CHANGED
|
@@ -158,10 +158,7 @@ function createSidebarsUtils(sidebars) {
|
|
|
158
158
|
item.link?.type === 'generated-index' &&
|
|
159
159
|
item.link.permalink === categoryGeneratedIndexPermalink);
|
|
160
160
|
}
|
|
161
|
-
const sidebarName = Object.entries(sidebarNameToNavigationItems).find(([, navigationItems]) => navigationItems.find(isCurrentCategoryGeneratedIndexItem))
|
|
162
|
-
if (!sidebarName) {
|
|
163
|
-
return emptySidebarNavigation();
|
|
164
|
-
}
|
|
161
|
+
const sidebarName = Object.entries(sidebarNameToNavigationItems).find(([, navigationItems]) => navigationItems.find(isCurrentCategoryGeneratedIndexItem))[0];
|
|
165
162
|
const navigationItems = sidebarNameToNavigationItems[sidebarName];
|
|
166
163
|
const currentItemIndex = navigationItems.findIndex(isCurrentCategoryGeneratedIndexItem);
|
|
167
164
|
const { previous, next } = (0, utils_1.getElementsAround)(navigationItems, currentItemIndex);
|
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-4684",
|
|
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-4684",
|
|
27
|
+
"@docusaurus/logger": "0.0.0-4684",
|
|
28
|
+
"@docusaurus/mdx-loader": "0.0.0-4684",
|
|
29
|
+
"@docusaurus/utils": "0.0.0-4684",
|
|
30
|
+
"@docusaurus/utils-validation": "0.0.0-4684",
|
|
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-4684",
|
|
43
|
+
"@docusaurus/types": "0.0.0-4684",
|
|
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": "9230ee0c61b8d04d2fcf195e72e1f992d7b39a86"
|
|
60
60
|
}
|
|
@@ -21,10 +21,6 @@ function getCategoryGeneratedIndexMetadata({
|
|
|
21
21
|
}): CategoryGeneratedIndexMetadata {
|
|
22
22
|
const {sidebarName, previous, next} =
|
|
23
23
|
sidebarsUtils.getCategoryGeneratedIndexNavigation(category.link.permalink);
|
|
24
|
-
if (!sidebarName) {
|
|
25
|
-
throw new Error('unexpected');
|
|
26
|
-
}
|
|
27
|
-
|
|
28
24
|
return {
|
|
29
25
|
title: category.link.title ?? category.label,
|
|
30
26
|
description: category.link.description,
|
|
@@ -32,7 +28,7 @@ function getCategoryGeneratedIndexMetadata({
|
|
|
32
28
|
keywords: category.link.keywords,
|
|
33
29
|
slug: category.link.slug,
|
|
34
30
|
permalink: category.link.permalink,
|
|
35
|
-
sidebar: sidebarName
|
|
31
|
+
sidebar: sidebarName!,
|
|
36
32
|
previous: toNavigationLink(previous, docsById),
|
|
37
33
|
next: toNavigationLink(next, docsById),
|
|
38
34
|
};
|
|
@@ -60,9 +60,9 @@ export const DefaultSidebarItemsGenerator: SidebarItemsGenerator = async ({
|
|
|
60
60
|
const doc = findDoc(docId);
|
|
61
61
|
if (!doc) {
|
|
62
62
|
throw new Error(
|
|
63
|
-
`Can't find any doc with
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
`Can't find any doc with ID ${docId}.
|
|
64
|
+
Available doc IDs:
|
|
65
|
+
- ${Object.keys(docsById).join('\n- ')}`,
|
|
66
66
|
);
|
|
67
67
|
}
|
|
68
68
|
return doc;
|
package/src/sidebars/utils.ts
CHANGED
|
@@ -258,11 +258,7 @@ export function createSidebarsUtils(sidebars: Sidebars): SidebarsUtils {
|
|
|
258
258
|
const sidebarName = Object.entries(sidebarNameToNavigationItems).find(
|
|
259
259
|
([, navigationItems]) =>
|
|
260
260
|
navigationItems.find(isCurrentCategoryGeneratedIndexItem),
|
|
261
|
-
)
|
|
262
|
-
|
|
263
|
-
if (!sidebarName) {
|
|
264
|
-
return emptySidebarNavigation();
|
|
265
|
-
}
|
|
261
|
+
)![0];
|
|
266
262
|
const navigationItems = sidebarNameToNavigationItems[sidebarName]!;
|
|
267
263
|
const currentItemIndex = navigationItems.findIndex(
|
|
268
264
|
isCurrentCategoryGeneratedIndexItem,
|