@docusaurus/plugin-content-docs 2.0.0-beta.12faed89d → 2.0.0-beta.13
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/.tsbuildinfo +1 -1
- package/lib/categoryGeneratedIndex.d.ts +12 -0
- package/lib/categoryGeneratedIndex.js +37 -0
- package/lib/cli.d.ts +2 -2
- package/lib/cli.js +12 -34
- package/lib/client/docsClientUtils.d.ts +0 -3
- package/lib/client/docsClientUtils.js +19 -22
- package/lib/docFrontMatter.d.ts +1 -1
- package/lib/docFrontMatter.js +7 -3
- package/lib/docs.d.ts +25 -3
- package/lib/docs.js +125 -41
- package/lib/globalData.d.ts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +100 -131
- package/lib/lastUpdate.js +8 -9
- package/lib/markdown/index.d.ts +3 -6
- package/lib/markdown/index.js +3 -3
- package/lib/markdown/linkify.js +2 -2
- package/lib/numberPrefix.d.ts +1 -1
- package/lib/options.d.ts +3 -3
- package/lib/options.js +48 -11
- package/lib/props.d.ts +7 -2
- package/lib/props.js +60 -8
- package/lib/routes.d.ts +27 -0
- package/lib/routes.js +105 -0
- package/lib/{sidebarItemsGenerator.d.ts → sidebars/generator.d.ts} +5 -2
- package/lib/sidebars/generator.js +216 -0
- package/lib/sidebars/index.d.ts +15 -0
- package/lib/sidebars/index.js +73 -0
- package/lib/sidebars/normalization.d.ts +14 -0
- package/lib/sidebars/normalization.js +77 -0
- package/lib/sidebars/processor.d.ts +18 -0
- package/lib/sidebars/processor.js +85 -0
- package/lib/sidebars/types.d.ts +127 -0
- package/lib/sidebars/types.js +8 -0
- package/lib/sidebars/utils.d.ts +35 -0
- package/lib/sidebars/utils.js +228 -0
- package/lib/sidebars/validation.d.ts +10 -0
- package/lib/sidebars/validation.js +138 -0
- package/lib/slug.d.ts +4 -3
- package/lib/slug.js +27 -15
- package/lib/tags.d.ts +8 -0
- package/lib/tags.js +20 -0
- package/lib/theme/hooks/useDocs.js +21 -21
- package/lib/translations.d.ts +2 -2
- package/lib/translations.js +71 -29
- package/lib/types.d.ts +52 -63
- package/lib/versions.d.ts +3 -3
- package/lib/versions.js +41 -22
- package/package.json +20 -20
- package/src/__tests__/__fixtures__/simple-site/docs/_partials/somePartial.md +3 -0
- package/src/__tests__/__fixtures__/simple-site/docs/_partials/subfolder/somePartial.md +3 -0
- package/src/__tests__/__fixtures__/simple-site/docs/_somePartial.md +3 -0
- package/src/__tests__/__fixtures__/simple-site/docs/foo/baz.md +5 -0
- package/src/__tests__/__fixtures__/simple-site/docs/hello.md +2 -0
- package/src/__tests__/__fixtures__/simple-site/docs/rootAbsoluteSlug.md +2 -0
- package/src/__tests__/__fixtures__/simple-site/docs/rootRelativeSlug.md +2 -0
- package/src/__tests__/__fixtures__/simple-site/docs/rootResolvedSlug.md +2 -0
- package/src/__tests__/__fixtures__/simple-site/docs/rootTryToEscapeSlug.md +2 -0
- package/src/__tests__/__fixtures__/simple-site/sidebars.json +15 -1
- package/src/__tests__/__fixtures__/site-with-doc-label/docs/hello-1.md +1 -0
- package/src/__tests__/__fixtures__/versioned-site/docs/foo/bar.md +6 -0
- package/src/__tests__/__fixtures__/versioned-site/docs/hello.md +3 -0
- package/src/__tests__/__fixtures__/versioned-site/i18n/en/docusaurus-plugin-content-docs/version-1.0.0/hello.md +3 -0
- package/src/__tests__/__fixtures__/versioned-site/i18n/fr/docusaurus-plugin-content-docs/version-1.0.0/hello.md +3 -0
- package/src/__tests__/__fixtures__/versioned-site/versioned_docs/version-1.0.0/hello.md +3 -0
- package/src/__tests__/__fixtures__/versioned-site/versioned_docs/version-1.0.1/_partials/somePartial.md +3 -0
- package/src/__tests__/__fixtures__/versioned-site/versioned_docs/version-1.0.1/_partials/subfolder/somePartial.md +3 -0
- package/src/__tests__/__fixtures__/versioned-site/versioned_docs/version-1.0.1/_somePartial.md +3 -0
- package/src/__tests__/__fixtures__/versioned-site/versioned_docs/version-1.0.1/hello.md +3 -0
- package/src/__tests__/__fixtures__/versioned-site/versioned_sidebars/version-1.0.1-sidebars.json +2 -2
- package/src/__tests__/__snapshots__/cli.test.ts.snap +48 -73
- package/src/__tests__/__snapshots__/docs.test.ts.snap +140 -0
- package/src/__tests__/__snapshots__/index.test.ts.snap +745 -97
- package/src/__tests__/__snapshots__/translations.test.ts.snap +45 -15
- package/src/__tests__/cli.test.ts +15 -11
- package/src/__tests__/docFrontMatter.test.ts +160 -45
- package/src/__tests__/docs.test.ts +311 -150
- package/src/__tests__/index.test.ts +108 -66
- package/src/__tests__/lastUpdate.test.ts +1 -1
- package/src/__tests__/options.test.ts +48 -3
- package/src/__tests__/props.test.ts +62 -0
- package/src/__tests__/slug.test.ts +127 -20
- package/src/__tests__/translations.test.ts +7 -1
- package/src/__tests__/versions.test.ts +73 -70
- package/src/categoryGeneratedIndex.ts +57 -0
- package/src/cli.ts +8 -41
- package/src/client/docsClientUtils.ts +14 -26
- package/{types.d.ts → src/deps.d.ts} +0 -0
- package/src/docFrontMatter.ts +9 -4
- package/src/docs.ts +158 -32
- package/src/globalData.ts +6 -1
- package/src/index.ts +125 -169
- package/src/lastUpdate.ts +10 -13
- package/src/markdown/index.ts +8 -12
- package/src/numberPrefix.ts +5 -3
- package/src/options.ts +59 -14
- package/src/plugin-content-docs.d.ts +173 -40
- package/src/props.ts +90 -15
- package/src/routes.ts +173 -0
- package/src/{__tests__ → sidebars/__tests__}/__fixtures__/sidebars/sidebars-category-shorthand.js +0 -0
- package/src/{__tests__ → sidebars/__tests__}/__fixtures__/sidebars/sidebars-category-wrong-items.json +0 -0
- package/src/{__tests__ → sidebars/__tests__}/__fixtures__/sidebars/sidebars-category-wrong-label.json +0 -0
- package/src/{__tests__ → sidebars/__tests__}/__fixtures__/sidebars/sidebars-category.js +0 -0
- package/src/{__tests__ → sidebars/__tests__}/__fixtures__/sidebars/sidebars-collapsed-first-level.json +0 -0
- package/src/{__tests__ → sidebars/__tests__}/__fixtures__/sidebars/sidebars-collapsed.json +0 -0
- package/src/{__tests__ → sidebars/__tests__}/__fixtures__/sidebars/sidebars-doc-id-not-string.json +0 -0
- package/src/{__tests__ → sidebars/__tests__}/__fixtures__/sidebars/sidebars-first-level-not-category.js +0 -0
- package/src/{__tests__ → sidebars/__tests__}/__fixtures__/sidebars/sidebars-link-wrong-href.json +0 -0
- package/src/{__tests__ → sidebars/__tests__}/__fixtures__/sidebars/sidebars-link-wrong-label.json +0 -0
- package/src/{__tests__ → sidebars/__tests__}/__fixtures__/sidebars/sidebars-link.json +0 -0
- package/src/{__tests__ → sidebars/__tests__}/__fixtures__/sidebars/sidebars-unknown-type.json +0 -0
- package/src/{__tests__ → sidebars/__tests__}/__fixtures__/sidebars/sidebars-wrong-field.json +0 -0
- package/src/{__tests__ → sidebars/__tests__}/__fixtures__/sidebars/sidebars.json +0 -0
- package/src/{__tests__/__snapshots__/sidebars.test.ts.snap → sidebars/__tests__/__snapshots__/index.test.ts.snap} +36 -6
- package/src/{__tests__/sidebarItemsGenerator.test.ts → sidebars/__tests__/generator.test.ts} +143 -18
- package/src/sidebars/__tests__/index.test.ts +204 -0
- package/src/sidebars/__tests__/processor.test.ts +237 -0
- package/src/sidebars/__tests__/utils.test.ts +695 -0
- package/src/sidebars/__tests__/validation.test.ts +105 -0
- package/src/sidebars/generator.ts +310 -0
- package/src/sidebars/index.ts +94 -0
- package/src/sidebars/normalization.ts +112 -0
- package/src/sidebars/processor.ts +154 -0
- package/src/sidebars/types.ts +211 -0
- package/src/sidebars/utils.ts +329 -0
- package/src/sidebars/validation.ts +168 -0
- package/src/slug.ts +32 -17
- package/src/tags.ts +19 -0
- package/src/translations.ts +103 -47
- package/src/types.ts +64 -107
- package/src/versions.ts +59 -25
- package/lib/sidebarItemsGenerator.js +0 -211
- package/lib/sidebars.d.ts +0 -43
- package/lib/sidebars.js +0 -320
- package/src/__tests__/sidebars.test.ts +0 -639
- package/src/sidebarItemsGenerator.ts +0 -307
- package/src/sidebars.ts +0 -522
package/lib/index.js
CHANGED
|
@@ -8,28 +8,31 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.validateOptions = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
12
|
-
const constants_1 = require("@docusaurus/core/lib/constants");
|
|
11
|
+
const path_1 = (0, tslib_1.__importDefault)(require("path"));
|
|
13
12
|
const utils_1 = require("@docusaurus/utils");
|
|
14
13
|
const sidebars_1 = require("./sidebars");
|
|
14
|
+
const generator_1 = require("./sidebars/generator");
|
|
15
15
|
const docs_1 = require("./docs");
|
|
16
16
|
const versions_1 = require("./versions");
|
|
17
17
|
const cli_1 = require("./cli");
|
|
18
|
-
const
|
|
18
|
+
const constants_1 = require("./constants");
|
|
19
19
|
const lodash_1 = require("lodash");
|
|
20
20
|
const globalData_1 = require("./globalData");
|
|
21
21
|
const props_1 = require("./props");
|
|
22
22
|
const translations_1 = require("./translations");
|
|
23
|
-
const
|
|
24
|
-
const
|
|
23
|
+
const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
|
|
24
|
+
const tags_1 = require("./tags");
|
|
25
|
+
const routes_1 = require("./routes");
|
|
26
|
+
const utils_2 = require("./sidebars/utils");
|
|
27
|
+
const categoryGeneratedIndex_1 = require("./categoryGeneratedIndex");
|
|
25
28
|
function pluginContentDocs(context, options) {
|
|
26
29
|
var _a;
|
|
27
30
|
const { siteDir, generatedFilesDir, baseUrl, siteConfig } = context;
|
|
28
|
-
const versionsMetadata = versions_1.readVersionsMetadata({ context, options });
|
|
29
|
-
const pluginId = (_a = options.id) !== null && _a !== void 0 ? _a :
|
|
31
|
+
const versionsMetadata = (0, versions_1.readVersionsMetadata)({ context, options });
|
|
32
|
+
const pluginId = (_a = options.id) !== null && _a !== void 0 ? _a : utils_1.DEFAULT_PLUGIN_ID;
|
|
30
33
|
const pluginDataDirRoot = path_1.default.join(generatedFilesDir, 'docusaurus-plugin-content-docs');
|
|
31
34
|
const dataDir = path_1.default.join(pluginDataDirRoot, pluginId);
|
|
32
|
-
const aliasedSource = (source) => `~docs/${utils_1.posixPath(path_1.default.relative(pluginDataDirRoot, source))}`;
|
|
35
|
+
const aliasedSource = (source) => `~docs/${(0, utils_1.posixPath)(path_1.default.relative(pluginDataDirRoot, source))}`;
|
|
33
36
|
return {
|
|
34
37
|
name: 'docusaurus-plugin-content-docs',
|
|
35
38
|
getThemePath() {
|
|
@@ -39,7 +42,7 @@ function pluginContentDocs(context, options) {
|
|
|
39
42
|
return path_1.default.resolve(__dirname, '..', 'src', 'theme');
|
|
40
43
|
},
|
|
41
44
|
extendCli(cli) {
|
|
42
|
-
const isDefaultPluginId = pluginId ===
|
|
45
|
+
const isDefaultPluginId = pluginId === utils_1.DEFAULT_PLUGIN_ID;
|
|
43
46
|
// Need to create one distinct command per plugin instance
|
|
44
47
|
// otherwise 2 instances would try to execute the command!
|
|
45
48
|
const command = isDefaultPluginId
|
|
@@ -53,43 +56,38 @@ function pluginContentDocs(context, options) {
|
|
|
53
56
|
.arguments('<version>')
|
|
54
57
|
.description(commandDescription)
|
|
55
58
|
.action((version) => {
|
|
56
|
-
cli_1.cliDocsVersionCommand(version, siteDir, pluginId, {
|
|
59
|
+
(0, cli_1.cliDocsVersionCommand)(version, siteDir, pluginId, {
|
|
57
60
|
path: options.path,
|
|
58
61
|
sidebarPath: options.sidebarPath,
|
|
62
|
+
sidebarCollapsed: options.sidebarCollapsed,
|
|
63
|
+
sidebarCollapsible: options.sidebarCollapsible,
|
|
59
64
|
});
|
|
60
65
|
});
|
|
61
66
|
},
|
|
62
67
|
async getTranslationFiles({ content }) {
|
|
63
|
-
return translations_1.getLoadedContentTranslationFiles(content);
|
|
64
|
-
},
|
|
65
|
-
getClientModules() {
|
|
66
|
-
const modules = [];
|
|
67
|
-
if (options.admonitions) {
|
|
68
|
-
modules.push(require.resolve('remark-admonitions/styles/infima.css'));
|
|
69
|
-
}
|
|
70
|
-
return modules;
|
|
68
|
+
return (0, translations_1.getLoadedContentTranslationFiles)(content);
|
|
71
69
|
},
|
|
72
70
|
getPathsToWatch() {
|
|
73
71
|
function getVersionPathsToWatch(version) {
|
|
74
72
|
const result = [
|
|
75
|
-
...
|
|
76
|
-
`${version.contentPath}/**/${
|
|
73
|
+
...options.include.flatMap((pattern) => (0, versions_1.getDocsDirPaths)(version).map((docsDirPath) => `${docsDirPath}/${pattern}`)),
|
|
74
|
+
`${version.contentPath}/**/${generator_1.CategoryMetadataFilenamePattern}`,
|
|
77
75
|
];
|
|
78
76
|
if (typeof version.sidebarFilePath === 'string') {
|
|
79
77
|
result.unshift(version.sidebarFilePath);
|
|
80
78
|
}
|
|
81
79
|
return result;
|
|
82
80
|
}
|
|
83
|
-
return
|
|
81
|
+
return versionsMetadata.flatMap(getVersionPathsToWatch);
|
|
84
82
|
},
|
|
85
83
|
async loadContent() {
|
|
86
84
|
async function loadVersionDocsBase(versionMetadata) {
|
|
87
|
-
const docFiles = await docs_1.readVersionDocs(versionMetadata, options);
|
|
85
|
+
const docFiles = await (0, docs_1.readVersionDocs)(versionMetadata, options);
|
|
88
86
|
if (docFiles.length === 0) {
|
|
89
87
|
throw new Error(`Docs version "${versionMetadata.versionName}" has no docs! At least one doc should exist at "${path_1.default.relative(siteDir, versionMetadata.contentPath)}".`);
|
|
90
88
|
}
|
|
91
89
|
async function processVersionDoc(docFile) {
|
|
92
|
-
return docs_1.processDocMetadata({
|
|
90
|
+
return (0, docs_1.processDocMetadata)({
|
|
93
91
|
docFile,
|
|
94
92
|
versionMetadata,
|
|
95
93
|
context,
|
|
@@ -99,63 +97,28 @@ function pluginContentDocs(context, options) {
|
|
|
99
97
|
return Promise.all(docFiles.map(processVersionDoc));
|
|
100
98
|
}
|
|
101
99
|
async function doLoadVersion(versionMetadata) {
|
|
102
|
-
const
|
|
103
|
-
const
|
|
104
|
-
const docsBaseById = lodash_1.keyBy(docsBase, (doc) => doc.id);
|
|
105
|
-
const sidebars = await sidebars_1.processSidebars({
|
|
100
|
+
const docs = await loadVersionDocsBase(versionMetadata);
|
|
101
|
+
const sidebars = await (0, sidebars_1.loadSidebars)(versionMetadata.sidebarFilePath, {
|
|
106
102
|
sidebarItemsGenerator: options.sidebarItemsGenerator,
|
|
107
103
|
numberPrefixParser: options.numberPrefixParser,
|
|
108
|
-
|
|
109
|
-
docs: docsBase,
|
|
104
|
+
docs,
|
|
110
105
|
version: versionMetadata,
|
|
106
|
+
sidebarOptions: {
|
|
107
|
+
sidebarCollapsed: options.sidebarCollapsed,
|
|
108
|
+
sidebarCollapsible: options.sidebarCollapsible,
|
|
109
|
+
},
|
|
110
|
+
categoryLabelSlugger: (0, utils_1.createSlugger)(),
|
|
111
111
|
});
|
|
112
|
-
const sidebarsUtils =
|
|
113
|
-
const validDocIds = Object.keys(docsBaseById);
|
|
114
|
-
sidebarsUtils.checkSidebarsDocIds(validDocIds, versionMetadata.sidebarFilePath);
|
|
115
|
-
// Add sidebar/next/previous to the docs
|
|
116
|
-
function addNavData(doc) {
|
|
117
|
-
const { sidebarName, previousId, nextId, } = sidebarsUtils.getDocNavigation(doc.id);
|
|
118
|
-
const toDocNavLink = (navDocId) => {
|
|
119
|
-
var _a, _b;
|
|
120
|
-
const { title, permalink, frontMatter } = docsBaseById[navDocId];
|
|
121
|
-
return {
|
|
122
|
-
title: (_b = (_a = frontMatter.pagination_label) !== null && _a !== void 0 ? _a : frontMatter.sidebar_label) !== null && _b !== void 0 ? _b : title,
|
|
123
|
-
permalink,
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
return {
|
|
127
|
-
...doc,
|
|
128
|
-
sidebar: sidebarName,
|
|
129
|
-
previous: previousId ? toDocNavLink(previousId) : undefined,
|
|
130
|
-
next: nextId ? toDocNavLink(nextId) : undefined,
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
const docs = docsBase.map(addNavData);
|
|
134
|
-
// sort to ensure consistent output for tests
|
|
135
|
-
docs.sort((a, b) => a.id.localeCompare(b.id));
|
|
136
|
-
// The "main doc" is the "version entry point"
|
|
137
|
-
// We browse this doc by clicking on a version:
|
|
138
|
-
// - the "home" doc (at '/docs/')
|
|
139
|
-
// - the first doc of the first sidebar
|
|
140
|
-
// - a random doc (if no docs are in any sidebar... edge case)
|
|
141
|
-
function getMainDoc() {
|
|
142
|
-
const versionHomeDoc = docs.find((doc) => doc.unversionedId === options.homePageId || doc.slug === '/');
|
|
143
|
-
const firstDocIdOfFirstSidebar = sidebarsUtils.getFirstDocIdOfFirstSidebar();
|
|
144
|
-
if (versionHomeDoc) {
|
|
145
|
-
return versionHomeDoc;
|
|
146
|
-
}
|
|
147
|
-
else if (firstDocIdOfFirstSidebar) {
|
|
148
|
-
return docs.find((doc) => doc.id === firstDocIdOfFirstSidebar);
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
return docs[0];
|
|
152
|
-
}
|
|
153
|
-
}
|
|
112
|
+
const sidebarsUtils = (0, utils_2.createSidebarsUtils)(sidebars);
|
|
154
113
|
return {
|
|
155
114
|
...versionMetadata,
|
|
156
|
-
|
|
115
|
+
docs: (0, docs_1.addDocNavigation)(docs, sidebarsUtils, versionMetadata.sidebarFilePath),
|
|
157
116
|
sidebars,
|
|
158
|
-
|
|
117
|
+
mainDocId: (0, docs_1.getMainDocId)({ docs, sidebarsUtils }),
|
|
118
|
+
categoryGeneratedIndices: (0, categoryGeneratedIndex_1.getCategoryGeneratedIndexMetadataList)({
|
|
119
|
+
docs,
|
|
120
|
+
sidebarsUtils,
|
|
121
|
+
}),
|
|
159
122
|
};
|
|
160
123
|
}
|
|
161
124
|
async function loadVersion(versionMetadata) {
|
|
@@ -172,64 +135,67 @@ function pluginContentDocs(context, options) {
|
|
|
172
135
|
};
|
|
173
136
|
},
|
|
174
137
|
translateContent({ content, translationFiles }) {
|
|
175
|
-
return translations_1.translateLoadedContent(content, translationFiles);
|
|
138
|
+
return (0, translations_1.translateLoadedContent)(content, translationFiles);
|
|
176
139
|
},
|
|
177
140
|
async contentLoaded({ content, actions }) {
|
|
178
141
|
const { loadedVersions } = content;
|
|
179
|
-
const { docLayoutComponent, docItemComponent } = options;
|
|
142
|
+
const { docLayoutComponent, docItemComponent, docCategoryGeneratedIndexComponent, } = options;
|
|
180
143
|
const { addRoute, createData, setGlobalData } = actions;
|
|
181
|
-
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
144
|
+
async function createVersionTagsRoutes(version) {
|
|
145
|
+
const versionTags = (0, tags_1.getVersionTags)(version.docs);
|
|
146
|
+
// TODO tags should be a sub route of the version route
|
|
147
|
+
async function createTagsListPage() {
|
|
148
|
+
const tagsProp = Object.values(versionTags).map((tagValue) => ({
|
|
149
|
+
name: tagValue.name,
|
|
150
|
+
permalink: tagValue.permalink,
|
|
151
|
+
count: tagValue.docIds.length,
|
|
152
|
+
}));
|
|
153
|
+
// Only create /tags page if there are tags.
|
|
154
|
+
if (Object.keys(tagsProp).length > 0) {
|
|
155
|
+
const tagsPropPath = await createData(`${(0, utils_1.docuHash)(`tags-list-${version.versionName}-prop`)}.json`, JSON.stringify(tagsProp, null, 2));
|
|
156
|
+
addRoute({
|
|
157
|
+
path: version.tagsPath,
|
|
158
|
+
exact: true,
|
|
159
|
+
component: options.docTagsListComponent,
|
|
160
|
+
modules: {
|
|
161
|
+
tags: aliasedSource(tagsPropPath),
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
// TODO tags should be a sub route of the version route
|
|
167
|
+
async function createTagDocListPage(tag) {
|
|
168
|
+
const tagProps = (0, props_1.toTagDocListProp)({
|
|
169
|
+
allTagsPath: version.tagsPath,
|
|
170
|
+
tag,
|
|
171
|
+
docs: version.docs,
|
|
172
|
+
});
|
|
173
|
+
const tagPropPath = await createData(`${(0, utils_1.docuHash)(`tag-${tag.permalink}`)}.json`, JSON.stringify(tagProps, null, 2));
|
|
174
|
+
addRoute({
|
|
175
|
+
path: tag.permalink,
|
|
176
|
+
component: options.docTagDocListComponent,
|
|
190
177
|
exact: true,
|
|
191
178
|
modules: {
|
|
192
|
-
|
|
179
|
+
tag: aliasedSource(tagPropPath),
|
|
193
180
|
},
|
|
194
|
-
|
|
195
|
-
// This permits to render the sidebar once without unmount/remount when navigating (and preserve sidebar state)
|
|
196
|
-
...(metadataItem.sidebar && {
|
|
197
|
-
sidebar: metadataItem.sidebar,
|
|
198
|
-
}),
|
|
199
|
-
};
|
|
200
|
-
return docRoute;
|
|
201
|
-
}));
|
|
202
|
-
return routes.sort((a, b) => a.path.localeCompare(b.path));
|
|
203
|
-
};
|
|
204
|
-
async function doCreateVersionRoutes(loadedVersion) {
|
|
205
|
-
const versionMetadata = props_1.toVersionMetadataProp(pluginId, loadedVersion);
|
|
206
|
-
const versionMetadataPropPath = await createData(`${utils_1.docuHash(`version-${loadedVersion.versionName}-metadata-prop`)}.json`, JSON.stringify(versionMetadata, null, 2));
|
|
207
|
-
addRoute({
|
|
208
|
-
path: loadedVersion.versionPath,
|
|
209
|
-
// allow matching /docs/* as well
|
|
210
|
-
exact: false,
|
|
211
|
-
// main docs component (DocPage)
|
|
212
|
-
component: docLayoutComponent,
|
|
213
|
-
// sub-routes for each doc
|
|
214
|
-
routes: await createDocRoutes(loadedVersion.docs),
|
|
215
|
-
modules: {
|
|
216
|
-
versionMetadata: aliasedSource(versionMetadataPropPath),
|
|
217
|
-
},
|
|
218
|
-
priority: loadedVersion.routePriority,
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
async function createVersionRoutes(loadedVersion) {
|
|
222
|
-
try {
|
|
223
|
-
return await doCreateVersionRoutes(loadedVersion);
|
|
224
|
-
}
|
|
225
|
-
catch (e) {
|
|
226
|
-
console.error(chalk_1.default.red(`Can't create version routes for version "${loadedVersion.versionName}"`));
|
|
227
|
-
throw e;
|
|
181
|
+
});
|
|
228
182
|
}
|
|
183
|
+
await createTagsListPage();
|
|
184
|
+
await Promise.all(Object.values(versionTags).map(createTagDocListPage));
|
|
229
185
|
}
|
|
230
|
-
await Promise.all(loadedVersions.map(createVersionRoutes)
|
|
186
|
+
await Promise.all(loadedVersions.map((loadedVersion) => (0, routes_1.createVersionRoutes)({
|
|
187
|
+
loadedVersion,
|
|
188
|
+
docItemComponent,
|
|
189
|
+
docLayoutComponent,
|
|
190
|
+
docCategoryGeneratedIndexComponent,
|
|
191
|
+
pluginId,
|
|
192
|
+
aliasedSource,
|
|
193
|
+
actions,
|
|
194
|
+
})));
|
|
195
|
+
// TODO tags should be a sub route of the version route
|
|
196
|
+
await Promise.all(loadedVersions.map(createVersionTagsRoutes));
|
|
231
197
|
setGlobalData({
|
|
232
|
-
path: utils_1.normalizeUrl([baseUrl, options.routeBasePath]),
|
|
198
|
+
path: (0, utils_1.normalizeUrl)([baseUrl, options.routeBasePath]),
|
|
233
199
|
versions: loadedVersions.map(globalData_1.toGlobalDataVersion),
|
|
234
200
|
});
|
|
235
201
|
},
|
|
@@ -237,8 +203,8 @@ function pluginContentDocs(context, options) {
|
|
|
237
203
|
const { getJSLoader } = utils;
|
|
238
204
|
const { rehypePlugins, remarkPlugins, beforeDefaultRehypePlugins, beforeDefaultRemarkPlugins, } = options;
|
|
239
205
|
function getSourceToPermalink() {
|
|
240
|
-
const allDocs =
|
|
241
|
-
return lodash_1.mapValues(lodash_1.keyBy(allDocs, (d) => d.source), (d) => d.permalink);
|
|
206
|
+
const allDocs = content.loadedVersions.flatMap((v) => v.docs);
|
|
207
|
+
return (0, lodash_1.mapValues)((0, lodash_1.keyBy)(allDocs, (d) => d.source), (d) => d.permalink);
|
|
242
208
|
}
|
|
243
209
|
const docsMarkdownOptions = {
|
|
244
210
|
siteDir,
|
|
@@ -248,16 +214,17 @@ function pluginContentDocs(context, options) {
|
|
|
248
214
|
if (siteConfig.onBrokenMarkdownLinks === 'ignore') {
|
|
249
215
|
return;
|
|
250
216
|
}
|
|
251
|
-
utils_1.reportMessage(`Docs markdown link couldn't be resolved: (${brokenMarkdownLink.link}) in ${brokenMarkdownLink.filePath} for version ${brokenMarkdownLink.contentPaths.versionName}`, siteConfig.onBrokenMarkdownLinks);
|
|
217
|
+
(0, utils_1.reportMessage)(`Docs markdown link couldn't be resolved: (${brokenMarkdownLink.link}) in ${brokenMarkdownLink.filePath} for version ${brokenMarkdownLink.contentPaths.versionName}`, siteConfig.onBrokenMarkdownLinks);
|
|
252
218
|
},
|
|
253
219
|
};
|
|
254
220
|
function createMDXLoaderRule() {
|
|
221
|
+
const contentDirs = versionsMetadata.flatMap(versions_1.getDocsDirPaths);
|
|
255
222
|
return {
|
|
256
223
|
test: /(\.mdx?)$/,
|
|
257
|
-
include:
|
|
224
|
+
include: contentDirs
|
|
258
225
|
// Trailing slash is important, see https://github.com/facebook/docusaurus/pull/3970
|
|
259
226
|
.map(utils_1.addTrailingPathSeparator),
|
|
260
|
-
use:
|
|
227
|
+
use: [
|
|
261
228
|
getJSLoader({ isServer }),
|
|
262
229
|
{
|
|
263
230
|
loader: require.resolve('@docusaurus/mdx-loader'),
|
|
@@ -266,12 +233,14 @@ function pluginContentDocs(context, options) {
|
|
|
266
233
|
rehypePlugins,
|
|
267
234
|
beforeDefaultRehypePlugins,
|
|
268
235
|
beforeDefaultRemarkPlugins,
|
|
269
|
-
|
|
236
|
+
staticDirs: siteConfig.staticDirectories.map((dir) => path_1.default.resolve(siteDir, dir)),
|
|
237
|
+
siteDir,
|
|
238
|
+
isMDXPartial: (0, utils_1.createAbsoluteFilePathMatcher)(options.exclude, contentDirs),
|
|
270
239
|
metadataPath: (mdxPath) => {
|
|
271
240
|
// Note that metadataPath must be the same/in-sync as
|
|
272
241
|
// the path from createData for each MDX.
|
|
273
|
-
const aliasedPath = utils_1.aliasedSitePath(mdxPath, siteDir);
|
|
274
|
-
return path_1.default.join(dataDir, `${utils_1.docuHash(aliasedPath)}.json`);
|
|
242
|
+
const aliasedPath = (0, utils_1.aliasedSitePath)(mdxPath, siteDir);
|
|
243
|
+
return path_1.default.join(dataDir, `${(0, utils_1.docuHash)(aliasedPath)}.json`);
|
|
275
244
|
},
|
|
276
245
|
},
|
|
277
246
|
},
|
|
@@ -279,14 +248,14 @@ function pluginContentDocs(context, options) {
|
|
|
279
248
|
loader: path_1.default.resolve(__dirname, './markdown/index.js'),
|
|
280
249
|
options: docsMarkdownOptions,
|
|
281
250
|
},
|
|
282
|
-
]),
|
|
251
|
+
].filter(Boolean),
|
|
283
252
|
};
|
|
284
253
|
}
|
|
285
254
|
return {
|
|
286
255
|
ignoreWarnings: [
|
|
287
256
|
// Suppress warnings about non-existing of versions file.
|
|
288
257
|
(e) => e.message.includes("Can't resolve") &&
|
|
289
|
-
e.message.includes(
|
|
258
|
+
e.message.includes(constants_1.VERSIONS_JSON_FILE),
|
|
290
259
|
],
|
|
291
260
|
resolve: {
|
|
292
261
|
alias: {
|
package/lib/lastUpdate.js
CHANGED
|
@@ -8,10 +8,8 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.getFileLastUpdate = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
|
-
const shelljs_1 = tslib_1.__importDefault(require("shelljs"));
|
|
12
|
-
const
|
|
13
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
14
|
-
const GIT_COMMIT_TIMESTAMP_AUTHOR_REGEX = /^(\d+), (.+)$/;
|
|
11
|
+
const shelljs_1 = (0, tslib_1.__importDefault)(require("shelljs"));
|
|
12
|
+
const GIT_COMMIT_TIMESTAMP_AUTHOR_REGEX = /^(\d+),(.+)$/;
|
|
15
13
|
let showedGitRequirementError = false;
|
|
16
14
|
async function getFileLastUpdate(filePath) {
|
|
17
15
|
if (!filePath) {
|
|
@@ -36,12 +34,13 @@ async function getFileLastUpdate(filePath) {
|
|
|
36
34
|
}
|
|
37
35
|
return null;
|
|
38
36
|
}
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
const { stdout } = await execa_1.default('git', ['log', '-1', '--format=%ct, %an', fileBasename], {
|
|
42
|
-
cwd: fileDirname,
|
|
37
|
+
const result = shelljs_1.default.exec(`git log -1 --format=%ct,%an ${filePath}`, {
|
|
38
|
+
silent: true,
|
|
43
39
|
});
|
|
44
|
-
|
|
40
|
+
if (result.code !== 0) {
|
|
41
|
+
throw new Error(`Retrieval of git history failed at ${filePath} with exit code ${result.code}: ${result.stderr}`);
|
|
42
|
+
}
|
|
43
|
+
return getTimestampAndAuthor(result.stdout.trim());
|
|
45
44
|
}
|
|
46
45
|
catch (error) {
|
|
47
46
|
console.error(error);
|
package/lib/markdown/index.d.ts
CHANGED
|
@@ -4,9 +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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
declare const markdownLoader: Loader;
|
|
12
|
-
export default markdownLoader;
|
|
7
|
+
import { DocsMarkdownOption } from '../types';
|
|
8
|
+
import type { LoaderContext } from 'webpack';
|
|
9
|
+
export default function markdownLoader(this: LoaderContext<DocsMarkdownOption>, source: string): void;
|
package/lib/markdown/index.js
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
const linkify_1 = require("./linkify");
|
|
10
|
-
|
|
10
|
+
function markdownLoader(source) {
|
|
11
11
|
const fileString = source;
|
|
12
12
|
const callback = this.async();
|
|
13
13
|
const options = this.getOptions();
|
|
14
|
-
return (callback && callback(null, linkify_1.linkify(fileString, this.resourcePath, options)));
|
|
15
|
-
}
|
|
14
|
+
return (callback && callback(null, (0, linkify_1.linkify)(fileString, this.resourcePath, options)));
|
|
15
|
+
}
|
|
16
16
|
exports.default = markdownLoader;
|
package/lib/markdown/linkify.js
CHANGED
|
@@ -10,7 +10,7 @@ exports.linkify = void 0;
|
|
|
10
10
|
const versions_1 = require("../versions");
|
|
11
11
|
const utils_1 = require("@docusaurus/utils");
|
|
12
12
|
function getVersion(filePath, options) {
|
|
13
|
-
const versionFound = options.versionsMetadata.find((version) => versions_1.getDocsDirPaths(version).some((docsDirPath) => filePath.startsWith(docsDirPath)));
|
|
13
|
+
const versionFound = options.versionsMetadata.find((version) => (0, versions_1.getDocsDirPaths)(version).some((docsDirPath) => filePath.startsWith(docsDirPath)));
|
|
14
14
|
if (!versionFound) {
|
|
15
15
|
throw new Error(`Unexpected error: Markdown file at "${filePath}" does not belong to any docs version!`);
|
|
16
16
|
}
|
|
@@ -18,7 +18,7 @@ function getVersion(filePath, options) {
|
|
|
18
18
|
}
|
|
19
19
|
function linkify(fileString, filePath, options) {
|
|
20
20
|
const { siteDir, sourceToPermalink, onBrokenMarkdownLink } = options;
|
|
21
|
-
const { newContent, brokenMarkdownLinks } = utils_1.replaceMarkdownLinks({
|
|
21
|
+
const { newContent, brokenMarkdownLinks } = (0, utils_1.replaceMarkdownLinks)({
|
|
22
22
|
siteDir,
|
|
23
23
|
fileString,
|
|
24
24
|
filePath,
|
package/lib/numberPrefix.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
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 { NumberPrefixParser } from './types';
|
|
7
|
+
import type { NumberPrefixParser } from './types';
|
|
8
8
|
export declare const DefaultNumberPrefixParser: NumberPrefixParser;
|
|
9
9
|
export declare const DisabledNumberPrefixParser: NumberPrefixParser;
|
|
10
10
|
export declare function stripNumberPrefix(str: string, parser: NumberPrefixParser): string;
|
package/lib/options.d.ts
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
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 { PluginOptions } from './types';
|
|
7
|
+
import type { PluginOptions } from './types';
|
|
8
8
|
import { Joi } from '@docusaurus/utils-validation';
|
|
9
|
-
import { OptionValidationContext, ValidationResult } from '@docusaurus/types';
|
|
9
|
+
import type { OptionValidationContext, ValidationResult } from '@docusaurus/types';
|
|
10
10
|
export declare const DEFAULT_OPTIONS: Omit<PluginOptions, 'id' | 'sidebarPath'>;
|
|
11
11
|
export declare const OptionsSchema: Joi.ObjectSchema<any>;
|
|
12
|
-
export declare function validateOptions({ validate, options, }: OptionValidationContext<PluginOptions>): ValidationResult<PluginOptions>;
|
|
12
|
+
export declare function validateOptions({ validate, options: userOptions, }: OptionValidationContext<PluginOptions>): ValidationResult<PluginOptions>;
|
package/lib/options.js
CHANGED
|
@@ -1,21 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.validateOptions = exports.OptionsSchema = exports.DEFAULT_OPTIONS = void 0;
|
|
4
10
|
const tslib_1 = require("tslib");
|
|
5
11
|
const utils_validation_1 = require("@docusaurus/utils-validation");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
12
|
+
const utils_1 = require("@docusaurus/utils");
|
|
13
|
+
const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
|
|
14
|
+
const remark_admonitions_1 = (0, tslib_1.__importDefault)(require("remark-admonitions"));
|
|
15
|
+
const generator_1 = require("./sidebars/generator");
|
|
9
16
|
const numberPrefix_1 = require("./numberPrefix");
|
|
10
17
|
exports.DEFAULT_OPTIONS = {
|
|
11
18
|
path: 'docs',
|
|
12
19
|
routeBasePath: 'docs',
|
|
13
|
-
|
|
20
|
+
tagsBasePath: 'tags',
|
|
14
21
|
include: ['**/*.{md,mdx}'],
|
|
15
|
-
|
|
22
|
+
exclude: utils_1.GlobExcludeDefault,
|
|
23
|
+
sidebarItemsGenerator: generator_1.DefaultSidebarItemsGenerator,
|
|
16
24
|
numberPrefixParser: numberPrefix_1.DefaultNumberPrefixParser,
|
|
17
25
|
docLayoutComponent: '@theme/DocPage',
|
|
18
26
|
docItemComponent: '@theme/DocItem',
|
|
27
|
+
docTagDocListComponent: '@theme/DocTagDocListPage',
|
|
28
|
+
docTagsListComponent: '@theme/DocTagsListPage',
|
|
29
|
+
docCategoryGeneratedIndexComponent: '@theme/DocCategoryGeneratedIndexPage',
|
|
19
30
|
remarkPlugins: [],
|
|
20
31
|
rehypePlugins: [],
|
|
21
32
|
beforeDefaultRemarkPlugins: [],
|
|
@@ -29,11 +40,15 @@ exports.DEFAULT_OPTIONS = {
|
|
|
29
40
|
versions: {},
|
|
30
41
|
editCurrentVersion: false,
|
|
31
42
|
editLocalizedFiles: false,
|
|
43
|
+
sidebarCollapsible: true,
|
|
44
|
+
sidebarCollapsed: true,
|
|
32
45
|
};
|
|
33
46
|
const VersionOptionsSchema = utils_validation_1.Joi.object({
|
|
34
47
|
path: utils_validation_1.Joi.string().allow('').optional(),
|
|
35
48
|
label: utils_validation_1.Joi.string().optional(),
|
|
36
49
|
banner: utils_validation_1.Joi.string().equal('none', 'unreleased', 'unmaintained').optional(),
|
|
50
|
+
badge: utils_validation_1.Joi.boolean().optional(),
|
|
51
|
+
className: utils_validation_1.Joi.string().optional(),
|
|
37
52
|
});
|
|
38
53
|
const VersionsOptionsSchema = utils_validation_1.Joi.object()
|
|
39
54
|
.pattern(utils_validation_1.Joi.string().required(), VersionOptionsSchema)
|
|
@@ -47,10 +62,16 @@ exports.OptionsSchema = utils_validation_1.Joi.object({
|
|
|
47
62
|
// '' not allowed, see https://github.com/facebook/docusaurus/issues/3374
|
|
48
63
|
// .allow('') ""
|
|
49
64
|
.default(exports.DEFAULT_OPTIONS.routeBasePath),
|
|
50
|
-
|
|
65
|
+
tagsBasePath: utils_validation_1.Joi.string().default(exports.DEFAULT_OPTIONS.tagsBasePath),
|
|
66
|
+
homePageId: utils_validation_1.Joi.any().forbidden().messages({
|
|
67
|
+
'any.unknown': 'The docs plugin option homePageId is not supported anymore. To make a doc the "home", please add "slug: /" in its front matter. See: https://docusaurus.io/docs/next/docs-introduction#home-page-docs',
|
|
68
|
+
}),
|
|
51
69
|
include: utils_validation_1.Joi.array().items(utils_validation_1.Joi.string()).default(exports.DEFAULT_OPTIONS.include),
|
|
70
|
+
exclude: utils_validation_1.Joi.array().items(utils_validation_1.Joi.string()).default(exports.DEFAULT_OPTIONS.exclude),
|
|
52
71
|
sidebarPath: utils_validation_1.Joi.alternatives().try(utils_validation_1.Joi.boolean().invalid(true), utils_validation_1.Joi.string()),
|
|
53
72
|
sidebarItemsGenerator: utils_validation_1.Joi.function().default(() => exports.DEFAULT_OPTIONS.sidebarItemsGenerator),
|
|
73
|
+
sidebarCollapsible: utils_validation_1.Joi.boolean().default(exports.DEFAULT_OPTIONS.sidebarCollapsible),
|
|
74
|
+
sidebarCollapsed: utils_validation_1.Joi.boolean().default(exports.DEFAULT_OPTIONS.sidebarCollapsed),
|
|
54
75
|
numberPrefixParser: utils_validation_1.Joi.alternatives()
|
|
55
76
|
.try(utils_validation_1.Joi.function(),
|
|
56
77
|
// Convert boolean values to functions
|
|
@@ -60,6 +81,9 @@ exports.OptionsSchema = utils_validation_1.Joi.object({
|
|
|
60
81
|
.default(() => exports.DEFAULT_OPTIONS.numberPrefixParser),
|
|
61
82
|
docLayoutComponent: utils_validation_1.Joi.string().default(exports.DEFAULT_OPTIONS.docLayoutComponent),
|
|
62
83
|
docItemComponent: utils_validation_1.Joi.string().default(exports.DEFAULT_OPTIONS.docItemComponent),
|
|
84
|
+
docTagsListComponent: utils_validation_1.Joi.string().default(exports.DEFAULT_OPTIONS.docTagsListComponent),
|
|
85
|
+
docTagDocListComponent: utils_validation_1.Joi.string().default(exports.DEFAULT_OPTIONS.docTagDocListComponent),
|
|
86
|
+
docCategoryGeneratedIndexComponent: utils_validation_1.Joi.string().default(exports.DEFAULT_OPTIONS.docCategoryGeneratedIndexComponent),
|
|
63
87
|
remarkPlugins: utils_validation_1.RemarkPluginsSchema.default(exports.DEFAULT_OPTIONS.remarkPlugins),
|
|
64
88
|
rehypePlugins: utils_validation_1.RehypePluginsSchema.default(exports.DEFAULT_OPTIONS.rehypePlugins),
|
|
65
89
|
beforeDefaultRemarkPlugins: utils_validation_1.RemarkPluginsSchema.default(exports.DEFAULT_OPTIONS.beforeDefaultRemarkPlugins),
|
|
@@ -75,11 +99,24 @@ exports.OptionsSchema = utils_validation_1.Joi.object({
|
|
|
75
99
|
lastVersion: utils_validation_1.Joi.string().optional(),
|
|
76
100
|
versions: VersionsOptionsSchema,
|
|
77
101
|
});
|
|
78
|
-
function validateOptions({ validate, options, }) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
102
|
+
function validateOptions({ validate, options: userOptions, }) {
|
|
103
|
+
let options = userOptions;
|
|
104
|
+
if (options.sidebarCollapsible === false) {
|
|
105
|
+
// When sidebarCollapsible=false and sidebarCollapsed=undefined, we don't want to have the inconsistency warning
|
|
106
|
+
// We let options.sidebarCollapsible become the default value for options.sidebarCollapsed
|
|
107
|
+
if (typeof options.sidebarCollapsed === 'undefined') {
|
|
108
|
+
options = {
|
|
109
|
+
...options,
|
|
110
|
+
sidebarCollapsed: false,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
if (options.sidebarCollapsed) {
|
|
114
|
+
console.warn(chalk_1.default.yellow('The docs plugin config is inconsistent. It does not make sense to use sidebarCollapsible=false and sidebarCollapsed=true at the same time. sidebarCollapsed=false will be ignored.'));
|
|
115
|
+
options = {
|
|
116
|
+
...options,
|
|
117
|
+
sidebarCollapsed: false,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
83
120
|
}
|
|
84
121
|
const normalizedOptions = validate(exports.OptionsSchema, options);
|
|
85
122
|
if (normalizedOptions.admonitions) {
|
package/lib/props.d.ts
CHANGED
|
@@ -4,7 +4,12 @@
|
|
|
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 { LoadedVersion } from './types';
|
|
8
|
-
import { PropSidebars, PropVersionMetadata } from '@docusaurus/plugin-content-docs
|
|
7
|
+
import type { LoadedVersion, VersionTag, DocMetadata } from './types';
|
|
8
|
+
import type { PropSidebars, PropVersionMetadata, PropTagDocList } from '@docusaurus/plugin-content-docs';
|
|
9
9
|
export declare function toSidebarsProp(loadedVersion: LoadedVersion): PropSidebars;
|
|
10
10
|
export declare function toVersionMetadataProp(pluginId: string, loadedVersion: LoadedVersion): PropVersionMetadata;
|
|
11
|
+
export declare function toTagDocListProp({ allTagsPath, tag, docs, }: {
|
|
12
|
+
allTagsPath: string;
|
|
13
|
+
tag: VersionTag;
|
|
14
|
+
docs: Pick<DocMetadata, 'id' | 'title' | 'description' | 'permalink'>[];
|
|
15
|
+
}): PropTagDocList;
|