@docusaurus/plugin-content-docs 0.0.0-5979 → 0.0.0-5982
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/categoryGeneratedIndex.d.ts +0 -1
- package/lib/categoryGeneratedIndex.js +1 -2
- package/lib/cli.d.ts +0 -1
- package/lib/cli.js +1 -2
- package/lib/docs.d.ts +0 -1
- package/lib/docs.js +8 -8
- package/lib/frontMatter.d.ts +0 -1
- package/lib/frontMatter.js +2 -2
- package/lib/globalData.js +1 -2
- package/lib/index.d.ts +0 -1
- package/lib/index.js +1 -1
- package/lib/numberPrefix.d.ts +0 -1
- package/lib/numberPrefix.js +3 -3
- package/lib/options.d.ts +0 -1
- package/lib/options.js +2 -2
- package/lib/props.d.ts +0 -1
- package/lib/props.js +5 -6
- package/lib/routes.d.ts +0 -1
- package/lib/routes.js +2 -3
- package/lib/sidebars/index.d.ts +0 -1
- package/lib/sidebars/index.js +4 -4
- package/lib/sidebars/normalization.js +2 -3
- package/lib/sidebars/postProcessor.js +1 -2
- package/lib/sidebars/processor.js +1 -2
- package/lib/sidebars/types.d.ts +0 -1
- package/lib/sidebars/utils.d.ts +0 -1
- package/lib/sidebars/utils.js +13 -14
- package/lib/sidebars/validation.js +2 -3
- package/lib/slug.d.ts +0 -1
- package/lib/slug.js +1 -1
- package/lib/translations.d.ts +0 -1
- package/lib/translations.js +2 -3
- package/lib/types.d.ts +0 -1
- package/lib/versions/files.d.ts +0 -1
- package/lib/versions/files.js +7 -8
- package/lib/versions/index.d.ts +0 -1
- package/lib/versions/index.js +8 -9
- package/lib/versions/validation.d.ts +0 -1
- package/lib/versions/validation.js +3 -4
- package/package.json +10 -10
|
@@ -4,7 +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
|
-
/// <reference path="../src/plugin-content-docs.d.ts" />
|
|
8
7
|
import { type SidebarsUtils } from './sidebars/utils';
|
|
9
8
|
import type { CategoryGeneratedIndexMetadata, DocMetadataBase } from '@docusaurus/plugin-content-docs';
|
|
10
9
|
export declare function getCategoryGeneratedIndexMetadataList({ docs, sidebarsUtils, }: {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.getCategoryGeneratedIndexMetadataList =
|
|
9
|
+
exports.getCategoryGeneratedIndexMetadataList = getCategoryGeneratedIndexMetadataList;
|
|
10
10
|
const utils_1 = require("./sidebars/utils");
|
|
11
11
|
const docs_1 = require("./docs");
|
|
12
12
|
function getCategoryGeneratedIndexMetadata({ category, sidebarsUtils, docsById, }) {
|
|
@@ -34,4 +34,3 @@ function getCategoryGeneratedIndexMetadataList({ docs, sidebarsUtils, }) {
|
|
|
34
34
|
docsById,
|
|
35
35
|
}));
|
|
36
36
|
}
|
|
37
|
-
exports.getCategoryGeneratedIndexMetadataList = getCategoryGeneratedIndexMetadataList;
|
package/lib/cli.d.ts
CHANGED
|
@@ -4,7 +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
|
-
/// <reference path="../src/plugin-content-docs.d.ts" />
|
|
8
7
|
import type { PluginOptions } from '@docusaurus/plugin-content-docs';
|
|
9
8
|
import type { LoadContext } from '@docusaurus/types';
|
|
10
9
|
export declare function cliDocsVersionCommand(version: unknown, { id: pluginId, path: docsPath, sidebarPath }: PluginOptions, { siteDir, i18n }: LoadContext): Promise<void>;
|
package/lib/cli.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.cliDocsVersionCommand =
|
|
9
|
+
exports.cliDocsVersionCommand = cliDocsVersionCommand;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
12
12
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
@@ -89,4 +89,3 @@ async function cliDocsVersionCommand(version, { id: pluginId, path: docsPath, si
|
|
|
89
89
|
await fs_extra_1.default.outputFile((0, files_1.getVersionsFilePath)(siteDir, pluginId), `${JSON.stringify(versions, null, 2)}\n`);
|
|
90
90
|
logger_1.default.success `name=${pluginIdLogPrefix}: version name=${version} created!`;
|
|
91
91
|
}
|
|
92
|
-
exports.cliDocsVersionCommand = cliDocsVersionCommand;
|
package/lib/docs.d.ts
CHANGED
|
@@ -4,7 +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
|
-
/// <reference path="../src/plugin-content-docs.d.ts" />
|
|
8
7
|
import type { TagsFile } from '@docusaurus/utils';
|
|
9
8
|
import type { MetadataOptions, PluginOptions, CategoryIndexMatcher, DocMetadataBase, VersionMetadata, LoadedVersion } from '@docusaurus/plugin-content-docs';
|
|
10
9
|
import type { LoadContext } from '@docusaurus/types';
|
package/lib/docs.js
CHANGED
|
@@ -6,7 +6,14 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.isCategoryIndex = void 0;
|
|
10
|
+
exports.readDocFile = readDocFile;
|
|
11
|
+
exports.readVersionDocs = readVersionDocs;
|
|
12
|
+
exports.processDocMetadata = processDocMetadata;
|
|
13
|
+
exports.addDocNavigation = addDocNavigation;
|
|
14
|
+
exports.getMainDocId = getMainDocId;
|
|
15
|
+
exports.toCategoryIndexMatcherParam = toCategoryIndexMatcherParam;
|
|
16
|
+
exports.createDocsByIdIndex = createDocsByIdIndex;
|
|
10
17
|
const tslib_1 = require("tslib");
|
|
11
18
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
12
19
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
@@ -22,7 +29,6 @@ async function readDocFile(versionMetadata, source) {
|
|
|
22
29
|
const content = await fs_extra_1.default.readFile(filePath, 'utf-8');
|
|
23
30
|
return { source, content, contentPath, filePath };
|
|
24
31
|
}
|
|
25
|
-
exports.readDocFile = readDocFile;
|
|
26
32
|
async function readVersionDocs(versionMetadata, options) {
|
|
27
33
|
const sources = await (0, utils_1.Globby)(options.include, {
|
|
28
34
|
cwd: versionMetadata.contentPath,
|
|
@@ -30,7 +36,6 @@ async function readVersionDocs(versionMetadata, options) {
|
|
|
30
36
|
});
|
|
31
37
|
return Promise.all(sources.map((source) => readDocFile(versionMetadata, source)));
|
|
32
38
|
}
|
|
33
|
-
exports.readVersionDocs = readVersionDocs;
|
|
34
39
|
async function doProcessDocMetadata({ docFile, versionMetadata, context, options, env, tagsFile, }) {
|
|
35
40
|
const { source, content, contentPath, filePath } = docFile;
|
|
36
41
|
const { siteDir, siteConfig: { markdown: { parseFrontMatter }, }, } = context;
|
|
@@ -146,7 +151,6 @@ async function processDocMetadata(args) {
|
|
|
146
151
|
throw new Error(`Can't process doc metadata for doc at path path=${args.docFile.filePath} in version name=${args.versionMetadata.versionName}`, { cause: err });
|
|
147
152
|
}
|
|
148
153
|
}
|
|
149
|
-
exports.processDocMetadata = processDocMetadata;
|
|
150
154
|
function getUnlistedIds(docs) {
|
|
151
155
|
return new Set(docs.filter((doc) => doc.unlisted).map((doc) => doc.id));
|
|
152
156
|
}
|
|
@@ -188,7 +192,6 @@ function addDocNavigation({ docs, sidebarsUtils, }) {
|
|
|
188
192
|
docsWithNavigation.sort((a, b) => a.id.localeCompare(b.id));
|
|
189
193
|
return docsWithNavigation;
|
|
190
194
|
}
|
|
191
|
-
exports.addDocNavigation = addDocNavigation;
|
|
192
195
|
/**
|
|
193
196
|
* The "main doc" is the "version entry point"
|
|
194
197
|
* We browse this doc by clicking on a version:
|
|
@@ -210,7 +213,6 @@ function getMainDocId({ docs, sidebarsUtils, }) {
|
|
|
210
213
|
}
|
|
211
214
|
return getMainDoc().id;
|
|
212
215
|
}
|
|
213
|
-
exports.getMainDocId = getMainDocId;
|
|
214
216
|
// By convention, Docusaurus considers some docs are "indexes":
|
|
215
217
|
// - index.md
|
|
216
218
|
// - readme.md
|
|
@@ -242,9 +244,7 @@ function toCategoryIndexMatcherParam({ source, sourceDirName, }) {
|
|
|
242
244
|
directories: sourceDirName.split(path_1.default.posix.sep).reverse(),
|
|
243
245
|
};
|
|
244
246
|
}
|
|
245
|
-
exports.toCategoryIndexMatcherParam = toCategoryIndexMatcherParam;
|
|
246
247
|
// Docs are indexed by their id
|
|
247
248
|
function createDocsByIdIndex(docs) {
|
|
248
249
|
return lodash_1.default.keyBy(docs, (d) => d.id);
|
|
249
250
|
}
|
|
250
|
-
exports.createDocsByIdIndex = createDocsByIdIndex;
|
package/lib/frontMatter.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference path="../src/plugin-content-docs.d.ts" />
|
|
2
1
|
import type { DocFrontMatter } from '@docusaurus/plugin-content-docs';
|
|
3
2
|
export declare const DocFrontMatterSchema: import("joi").ObjectSchema<DocFrontMatter>;
|
|
4
3
|
export declare function validateDocFrontMatter(frontMatter: {
|
package/lib/frontMatter.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.DocFrontMatterSchema = void 0;
|
|
4
|
+
exports.validateDocFrontMatter = validateDocFrontMatter;
|
|
4
5
|
/**
|
|
5
6
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
7
|
*
|
|
@@ -42,4 +43,3 @@ exports.DocFrontMatterSchema = utils_validation_1.JoiFrontMatter.object({
|
|
|
42
43
|
function validateDocFrontMatter(frontMatter) {
|
|
43
44
|
return (0, utils_validation_1.validateFrontMatter)(frontMatter, exports.DocFrontMatterSchema);
|
|
44
45
|
}
|
|
45
|
-
exports.validateDocFrontMatter = validateDocFrontMatter;
|
package/lib/globalData.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.toGlobalDataVersion =
|
|
9
|
+
exports.toGlobalDataVersion = toGlobalDataVersion;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
12
12
|
const docs_1 = require("./docs");
|
|
@@ -57,4 +57,3 @@ function toGlobalDataVersion(version) {
|
|
|
57
57
|
sidebars: toGlobalSidebars(version.sidebars, version),
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
exports.toGlobalDataVersion = toGlobalDataVersion;
|
package/lib/index.d.ts
CHANGED
|
@@ -4,7 +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
|
-
/// <reference path="../src/plugin-content-docs.d.ts" />
|
|
8
7
|
import type { PluginOptions, LoadedContent } from '@docusaurus/plugin-content-docs';
|
|
9
8
|
import type { LoadContext, Plugin } from '@docusaurus/types';
|
|
10
9
|
export default function pluginContentDocs(context: LoadContext, options: PluginOptions): Promise<Plugin<LoadedContent>>;
|
package/lib/index.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.validateOptions = void 0;
|
|
10
|
+
exports.default = pluginContentDocs;
|
|
10
11
|
const tslib_1 = require("tslib");
|
|
11
12
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
12
13
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
@@ -260,6 +261,5 @@ async function pluginContentDocs(context, options) {
|
|
|
260
261
|
},
|
|
261
262
|
};
|
|
262
263
|
}
|
|
263
|
-
exports.default = pluginContentDocs;
|
|
264
264
|
var options_1 = require("./options");
|
|
265
265
|
Object.defineProperty(exports, "validateOptions", { enumerable: true, get: function () { return options_1.validateOptions; } });
|
package/lib/numberPrefix.d.ts
CHANGED
|
@@ -4,7 +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
|
-
/// <reference path="../src/plugin-content-docs.d.ts" />
|
|
8
7
|
import type { NumberPrefixParser } from '@docusaurus/plugin-content-docs';
|
|
9
8
|
export declare const DefaultNumberPrefixParser: NumberPrefixParser;
|
|
10
9
|
export declare const DisabledNumberPrefixParser: NumberPrefixParser;
|
package/lib/numberPrefix.js
CHANGED
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.DisabledNumberPrefixParser = exports.DefaultNumberPrefixParser = void 0;
|
|
10
|
+
exports.stripNumberPrefix = stripNumberPrefix;
|
|
11
|
+
exports.stripPathNumberPrefixes = stripPathNumberPrefixes;
|
|
10
12
|
// Best-effort to avoid parsing some patterns as number prefix
|
|
11
13
|
// ignore common date-like patterns: https://github.com/facebook/docusaurus/issues/4640
|
|
12
14
|
// ignore common versioning patterns: https://github.com/facebook/docusaurus/issues/4653
|
|
@@ -39,7 +41,6 @@ exports.DisabledNumberPrefixParser = DisabledNumberPrefixParser;
|
|
|
39
41
|
function stripNumberPrefix(str, parser) {
|
|
40
42
|
return parser(str).filename;
|
|
41
43
|
}
|
|
42
|
-
exports.stripNumberPrefix = stripNumberPrefix;
|
|
43
44
|
// 0-myFolder/0-mySubfolder/0-myDoc => myFolder/mySubfolder/myDoc
|
|
44
45
|
function stripPathNumberPrefixes(path, parser) {
|
|
45
46
|
return path
|
|
@@ -47,4 +48,3 @@ function stripPathNumberPrefixes(path, parser) {
|
|
|
47
48
|
.map((segment) => stripNumberPrefix(segment, parser))
|
|
48
49
|
.join('/');
|
|
49
50
|
}
|
|
50
|
-
exports.stripPathNumberPrefixes = stripPathNumberPrefixes;
|
package/lib/options.d.ts
CHANGED
|
@@ -4,7 +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
|
-
/// <reference path="../src/plugin-content-docs.d.ts" />
|
|
8
7
|
import type { OptionValidationContext } from '@docusaurus/types';
|
|
9
8
|
import type { PluginOptions, Options } from '@docusaurus/plugin-content-docs';
|
|
10
9
|
export declare const DEFAULT_OPTIONS: Omit<PluginOptions, 'id' | 'sidebarPath'>;
|
package/lib/options.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.DEFAULT_OPTIONS = void 0;
|
|
10
|
+
exports.validateOptions = validateOptions;
|
|
10
11
|
const tslib_1 = require("tslib");
|
|
11
12
|
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
12
13
|
const utils_validation_1 = require("@docusaurus/utils-validation");
|
|
@@ -133,4 +134,3 @@ function validateOptions({ validate, options: userOptions, }) {
|
|
|
133
134
|
const normalizedOptions = validate(OptionsSchema, options);
|
|
134
135
|
return normalizedOptions;
|
|
135
136
|
}
|
|
136
|
-
exports.validateOptions = validateOptions;
|
package/lib/props.d.ts
CHANGED
|
@@ -4,7 +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
|
-
/// <reference path="../src/plugin-content-docs.d.ts" />
|
|
8
7
|
import type { VersionTag, VersionTags } from './types';
|
|
9
8
|
import type { SidebarItemDoc } from './sidebars/types';
|
|
10
9
|
import type { PropSidebars, PropVersionMetadata, PropTagDocList, PropTagsListPage, PropSidebarItemLink, DocMetadata, LoadedVersion } from '@docusaurus/plugin-content-docs';
|
package/lib/props.js
CHANGED
|
@@ -6,7 +6,11 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.toSidebarDocItemLinkProp = toSidebarDocItemLinkProp;
|
|
10
|
+
exports.toSidebarsProp = toSidebarsProp;
|
|
11
|
+
exports.toVersionMetadataProp = toVersionMetadataProp;
|
|
12
|
+
exports.toTagDocListProp = toTagDocListProp;
|
|
13
|
+
exports.toTagsListTagsProp = toTagsListTagsProp;
|
|
10
14
|
const tslib_1 = require("tslib");
|
|
11
15
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
12
16
|
const docs_1 = require("./docs");
|
|
@@ -22,7 +26,6 @@ function toSidebarDocItemLinkProp({ item, doc, }) {
|
|
|
22
26
|
unlisted,
|
|
23
27
|
};
|
|
24
28
|
}
|
|
25
|
-
exports.toSidebarDocItemLinkProp = toSidebarDocItemLinkProp;
|
|
26
29
|
function toSidebarsProp(loadedVersion) {
|
|
27
30
|
const docsById = (0, docs_1.createDocsByIdIndex)(loadedVersion.docs);
|
|
28
31
|
function getDocById(docId) {
|
|
@@ -92,7 +95,6 @@ Available document ids are:
|
|
|
92
95
|
// This is what will be passed as props to the UI component.
|
|
93
96
|
return lodash_1.default.mapValues(loadedVersion.sidebars, (items) => items.map(normalizeItem));
|
|
94
97
|
}
|
|
95
|
-
exports.toSidebarsProp = toSidebarsProp;
|
|
96
98
|
function toVersionDocsProp(loadedVersion) {
|
|
97
99
|
return Object.fromEntries(loadedVersion.docs.map((doc) => [
|
|
98
100
|
doc.id,
|
|
@@ -118,7 +120,6 @@ function toVersionMetadataProp(pluginId, loadedVersion) {
|
|
|
118
120
|
docs: toVersionDocsProp(loadedVersion),
|
|
119
121
|
};
|
|
120
122
|
}
|
|
121
|
-
exports.toVersionMetadataProp = toVersionMetadataProp;
|
|
122
123
|
function toTagDocListProp({ allTagsPath, tag, docs, }) {
|
|
123
124
|
function toDocListProp() {
|
|
124
125
|
const list = lodash_1.default.compact(tag.docIds.map((id) => docs.find((doc) => doc.id === id)));
|
|
@@ -141,7 +142,6 @@ function toTagDocListProp({ allTagsPath, tag, docs, }) {
|
|
|
141
142
|
unlisted: tag.unlisted,
|
|
142
143
|
};
|
|
143
144
|
}
|
|
144
|
-
exports.toTagDocListProp = toTagDocListProp;
|
|
145
145
|
function toTagsListTagsProp(versionTags) {
|
|
146
146
|
return Object.values(versionTags)
|
|
147
147
|
.filter((tagValue) => !tagValue.unlisted)
|
|
@@ -152,4 +152,3 @@ function toTagsListTagsProp(versionTags) {
|
|
|
152
152
|
count: tagValue.docIds.length,
|
|
153
153
|
}));
|
|
154
154
|
}
|
|
155
|
-
exports.toTagsListTagsProp = toTagsListTagsProp;
|
package/lib/routes.d.ts
CHANGED
|
@@ -4,7 +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
|
-
/// <reference path="../src/plugin-content-docs.d.ts" />
|
|
8
7
|
import type { PluginContentLoadedActions, RouteConfig } from '@docusaurus/types';
|
|
9
8
|
import type { FullVersion } from './types';
|
|
10
9
|
import type { PluginOptions } from '@docusaurus/plugin-content-docs';
|
package/lib/routes.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.buildAllRoutes = buildAllRoutes;
|
|
10
|
+
exports.createAllRoutes = createAllRoutes;
|
|
10
11
|
const tslib_1 = require("tslib");
|
|
11
12
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
12
13
|
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
@@ -177,9 +178,7 @@ async function buildAllRoutes(param) {
|
|
|
177
178
|
},
|
|
178
179
|
];
|
|
179
180
|
}
|
|
180
|
-
exports.buildAllRoutes = buildAllRoutes;
|
|
181
181
|
async function createAllRoutes(param) {
|
|
182
182
|
const routes = await buildAllRoutes(param);
|
|
183
183
|
routes.forEach(param.actions.addRoute);
|
|
184
184
|
}
|
|
185
|
-
exports.createAllRoutes = createAllRoutes;
|
package/lib/sidebars/index.d.ts
CHANGED
|
@@ -4,7 +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
|
-
/// <reference path="../../src/plugin-content-docs.d.ts" />
|
|
8
7
|
import type { PluginOptions } from '@docusaurus/plugin-content-docs';
|
|
9
8
|
import type { SidebarsConfig, Sidebars, SidebarProcessorParams } from './types';
|
|
10
9
|
export declare const DefaultSidebars: SidebarsConfig;
|
package/lib/sidebars/index.js
CHANGED
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.DisabledSidebars = exports.DefaultSidebars = void 0;
|
|
10
|
+
exports.resolveSidebarPathOption = resolveSidebarPathOption;
|
|
11
|
+
exports.loadSidebarsFile = loadSidebarsFile;
|
|
12
|
+
exports.loadSidebars = loadSidebars;
|
|
10
13
|
const tslib_1 = require("tslib");
|
|
11
14
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
12
15
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
@@ -34,7 +37,6 @@ function resolveSidebarPathOption(siteDir, sidebarPathOption) {
|
|
|
34
37
|
? path_1.default.resolve(siteDir, sidebarPathOption)
|
|
35
38
|
: sidebarPathOption;
|
|
36
39
|
}
|
|
37
|
-
exports.resolveSidebarPathOption = resolveSidebarPathOption;
|
|
38
40
|
async function readCategoriesMetadata(contentPath) {
|
|
39
41
|
const categoryFiles = await (0, utils_1.Globby)('**/_category_.{json,yml,yaml}', {
|
|
40
42
|
cwd: contentPath,
|
|
@@ -80,7 +82,6 @@ async function loadSidebarsFile(sidebarFilePath) {
|
|
|
80
82
|
// TODO unsafe, need to refactor and improve validation
|
|
81
83
|
return sidebars;
|
|
82
84
|
}
|
|
83
|
-
exports.loadSidebarsFile = loadSidebarsFile;
|
|
84
85
|
async function loadSidebars(sidebarFilePath, options) {
|
|
85
86
|
try {
|
|
86
87
|
const sidebarsConfig = await loadSidebarsFileUnsafe(sidebarFilePath);
|
|
@@ -95,4 +96,3 @@ async function loadSidebars(sidebarFilePath, options) {
|
|
|
95
96
|
throw err;
|
|
96
97
|
}
|
|
97
98
|
}
|
|
98
|
-
exports.loadSidebars = loadSidebars;
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.normalizeItem = normalizeItem;
|
|
10
|
+
exports.normalizeSidebars = normalizeSidebars;
|
|
10
11
|
const tslib_1 = require("tslib");
|
|
11
12
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
12
13
|
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
@@ -43,7 +44,6 @@ function normalizeItem(item) {
|
|
|
43
44
|
}
|
|
44
45
|
return [item];
|
|
45
46
|
}
|
|
46
|
-
exports.normalizeItem = normalizeItem;
|
|
47
47
|
function normalizeSidebar(sidebar, place) {
|
|
48
48
|
if (!Array.isArray(sidebar) && !(0, utils_1.isCategoriesShorthand)(sidebar)) {
|
|
49
49
|
throw new Error(logger_1.default.interpolate `Invalid sidebar items collection code=${JSON.stringify(sidebar)} in ${place}: it must either be an array of sidebar items or a shorthand notation (which doesn't contain a code=${'type'} property). See url=${'https://docusaurus.io/docs/sidebar/items'} for all valid syntaxes.`);
|
|
@@ -56,4 +56,3 @@ function normalizeSidebar(sidebar, place) {
|
|
|
56
56
|
function normalizeSidebars(sidebars) {
|
|
57
57
|
return lodash_1.default.mapValues(sidebars, (sidebar, id) => normalizeSidebar(sidebar, logger_1.default.interpolate `sidebar name=${id}`));
|
|
58
58
|
}
|
|
59
|
-
exports.normalizeSidebars = normalizeSidebars;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.postProcessSidebars =
|
|
9
|
+
exports.postProcessSidebars = postProcessSidebars;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
12
12
|
const utils_1 = require("@docusaurus/utils");
|
|
@@ -77,4 +77,3 @@ function postProcessSidebars(sidebars, params) {
|
|
|
77
77
|
.map((item) => postProcessSidebarItem(item, { ...params, draftIds }))
|
|
78
78
|
.filter((v) => Boolean(v)));
|
|
79
79
|
}
|
|
80
|
-
exports.postProcessSidebars = postProcessSidebars;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.processSidebars =
|
|
9
|
+
exports.processSidebars = processSidebars;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
12
12
|
const combine_promises_1 = tslib_1.__importDefault(require("combine-promises"));
|
|
@@ -75,4 +75,3 @@ async function processSidebars(unprocessedSidebars, categoriesMetadata, params)
|
|
|
75
75
|
(0, validation_1.validateSidebars)(processedSidebars);
|
|
76
76
|
return processedSidebars;
|
|
77
77
|
}
|
|
78
|
-
exports.processSidebars = processSidebars;
|
package/lib/sidebars/types.d.ts
CHANGED
|
@@ -4,7 +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
|
-
/// <reference path="../../src/plugin-content-docs.d.ts" />
|
|
8
7
|
import type { Optional, Required } from 'utility-types';
|
|
9
8
|
import type { NumberPrefixParser, SidebarOptions, CategoryIndexMatcher, DocMetadataBase, VersionMetadata } from '@docusaurus/plugin-content-docs';
|
|
10
9
|
import type { Slugger } from '@docusaurus/utils';
|
package/lib/sidebars/utils.d.ts
CHANGED
|
@@ -4,7 +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
|
-
/// <reference path="../../src/plugin-content-docs.d.ts" />
|
|
8
7
|
import type { Sidebars, Sidebar, SidebarItem, SidebarItemCategory, SidebarItemLink, SidebarItemDoc, SidebarCategoriesShorthand, SidebarItemConfig, SidebarItemCategoryWithGeneratedIndex, SidebarNavigationItem } from './types';
|
|
9
8
|
import type { DocMetadataBase, PropNavigationLink, VersionMetadata } from '@docusaurus/plugin-content-docs';
|
|
10
9
|
export declare function isCategoriesShorthand(item: SidebarItemConfig): item is SidebarCategoriesShorthand;
|
package/lib/sidebars/utils.js
CHANGED
|
@@ -6,14 +6,25 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.isCategoriesShorthand = isCategoriesShorthand;
|
|
10
|
+
exports.transformSidebarItems = transformSidebarItems;
|
|
11
|
+
exports.collectSidebarDocItems = collectSidebarDocItems;
|
|
12
|
+
exports.collectSidebarCategories = collectSidebarCategories;
|
|
13
|
+
exports.collectSidebarLinks = collectSidebarLinks;
|
|
14
|
+
exports.collectSidebarRefs = collectSidebarRefs;
|
|
15
|
+
exports.collectSidebarDocIds = collectSidebarDocIds;
|
|
16
|
+
exports.collectSidebarNavigation = collectSidebarNavigation;
|
|
17
|
+
exports.collectSidebarsDocIds = collectSidebarsDocIds;
|
|
18
|
+
exports.collectSidebarsNavigations = collectSidebarsNavigations;
|
|
19
|
+
exports.createSidebarsUtils = createSidebarsUtils;
|
|
20
|
+
exports.toDocNavigationLink = toDocNavigationLink;
|
|
21
|
+
exports.toNavigationLink = toNavigationLink;
|
|
10
22
|
const tslib_1 = require("tslib");
|
|
11
23
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
12
24
|
const utils_1 = require("@docusaurus/utils");
|
|
13
25
|
function isCategoriesShorthand(item) {
|
|
14
26
|
return typeof item === 'object' && !item.type;
|
|
15
27
|
}
|
|
16
|
-
exports.isCategoriesShorthand = isCategoriesShorthand;
|
|
17
28
|
function transformSidebarItems(sidebar, updateFn) {
|
|
18
29
|
function transformRecursive(item) {
|
|
19
30
|
if (item.type === 'category') {
|
|
@@ -26,7 +37,6 @@ function transformSidebarItems(sidebar, updateFn) {
|
|
|
26
37
|
}
|
|
27
38
|
return sidebar.map(transformRecursive);
|
|
28
39
|
}
|
|
29
|
-
exports.transformSidebarItems = transformSidebarItems;
|
|
30
40
|
/**
|
|
31
41
|
* Flatten sidebar items into a single flat array (containing categories/docs on
|
|
32
42
|
* the same level). Order matters (useful for next/prev nav), top categories
|
|
@@ -46,19 +56,15 @@ function collectSidebarItemsOfType(type, sidebar) {
|
|
|
46
56
|
function collectSidebarDocItems(sidebar) {
|
|
47
57
|
return collectSidebarItemsOfType('doc', sidebar);
|
|
48
58
|
}
|
|
49
|
-
exports.collectSidebarDocItems = collectSidebarDocItems;
|
|
50
59
|
function collectSidebarCategories(sidebar) {
|
|
51
60
|
return collectSidebarItemsOfType('category', sidebar);
|
|
52
61
|
}
|
|
53
|
-
exports.collectSidebarCategories = collectSidebarCategories;
|
|
54
62
|
function collectSidebarLinks(sidebar) {
|
|
55
63
|
return collectSidebarItemsOfType('link', sidebar);
|
|
56
64
|
}
|
|
57
|
-
exports.collectSidebarLinks = collectSidebarLinks;
|
|
58
65
|
function collectSidebarRefs(sidebar) {
|
|
59
66
|
return collectSidebarItemsOfType('ref', sidebar);
|
|
60
67
|
}
|
|
61
|
-
exports.collectSidebarRefs = collectSidebarRefs;
|
|
62
68
|
// /!\ docId order matters for navigation!
|
|
63
69
|
function collectSidebarDocIds(sidebar) {
|
|
64
70
|
return flattenSidebarItems(sidebar).flatMap((item) => {
|
|
@@ -71,7 +77,6 @@ function collectSidebarDocIds(sidebar) {
|
|
|
71
77
|
return [];
|
|
72
78
|
});
|
|
73
79
|
}
|
|
74
|
-
exports.collectSidebarDocIds = collectSidebarDocIds;
|
|
75
80
|
function collectSidebarNavigation(sidebar) {
|
|
76
81
|
return flattenSidebarItems(sidebar).flatMap((item) => {
|
|
77
82
|
if (item.type === 'category' && item.link) {
|
|
@@ -83,15 +88,12 @@ function collectSidebarNavigation(sidebar) {
|
|
|
83
88
|
return [];
|
|
84
89
|
});
|
|
85
90
|
}
|
|
86
|
-
exports.collectSidebarNavigation = collectSidebarNavigation;
|
|
87
91
|
function collectSidebarsDocIds(sidebars) {
|
|
88
92
|
return lodash_1.default.mapValues(sidebars, collectSidebarDocIds);
|
|
89
93
|
}
|
|
90
|
-
exports.collectSidebarsDocIds = collectSidebarsDocIds;
|
|
91
94
|
function collectSidebarsNavigations(sidebars) {
|
|
92
95
|
return lodash_1.default.mapValues(sidebars, collectSidebarNavigation);
|
|
93
96
|
}
|
|
94
|
-
exports.collectSidebarsNavigations = collectSidebarsNavigations;
|
|
95
97
|
function createSidebarsUtils(sidebars) {
|
|
96
98
|
const sidebarNameToDocIds = collectSidebarsDocIds(sidebars);
|
|
97
99
|
const sidebarNameToNavigationItems = collectSidebarsNavigations(sidebars);
|
|
@@ -293,7 +295,6 @@ Available document ids are:
|
|
|
293
295
|
getFirstLink: (id) => getFirstLink(sidebars[id]),
|
|
294
296
|
};
|
|
295
297
|
}
|
|
296
|
-
exports.createSidebarsUtils = createSidebarsUtils;
|
|
297
298
|
function toDocNavigationLink(doc, options) {
|
|
298
299
|
const { title, permalink, frontMatter: { pagination_label: paginationLabel, sidebar_label: sidebarLabel, }, } = doc;
|
|
299
300
|
return {
|
|
@@ -301,7 +302,6 @@ function toDocNavigationLink(doc, options) {
|
|
|
301
302
|
permalink,
|
|
302
303
|
};
|
|
303
304
|
}
|
|
304
|
-
exports.toDocNavigationLink = toDocNavigationLink;
|
|
305
305
|
function toNavigationLink(navigationItem, docsById) {
|
|
306
306
|
function getDocById(docId) {
|
|
307
307
|
const doc = docsById[docId];
|
|
@@ -325,4 +325,3 @@ function toNavigationLink(navigationItem, docsById) {
|
|
|
325
325
|
sidebarItemLabel: navigationItem?.label,
|
|
326
326
|
});
|
|
327
327
|
}
|
|
328
|
-
exports.toNavigationLink = toNavigationLink;
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.validateSidebars = validateSidebars;
|
|
10
|
+
exports.validateCategoryMetadataFile = validateCategoryMetadataFile;
|
|
10
11
|
const utils_validation_1 = require("@docusaurus/utils-validation");
|
|
11
12
|
// NOTE: we don't add any default values during validation on purpose!
|
|
12
13
|
// Config types are exposed to users for typechecking and we use the same type
|
|
@@ -130,7 +131,6 @@ function validateSidebars(sidebars) {
|
|
|
130
131
|
sidebar.forEach(validateSidebarItem);
|
|
131
132
|
});
|
|
132
133
|
}
|
|
133
|
-
exports.validateSidebars = validateSidebars;
|
|
134
134
|
const categoryMetadataFileSchema = utils_validation_1.Joi.object({
|
|
135
135
|
label: utils_validation_1.Joi.string(),
|
|
136
136
|
position: utils_validation_1.Joi.number(),
|
|
@@ -147,4 +147,3 @@ function validateCategoryMetadataFile(unsafeContent) {
|
|
|
147
147
|
}
|
|
148
148
|
return value;
|
|
149
149
|
}
|
|
150
|
-
exports.validateCategoryMetadataFile = validateCategoryMetadataFile;
|
package/lib/slug.d.ts
CHANGED
|
@@ -4,7 +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
|
-
/// <reference path="../src/plugin-content-docs.d.ts" />
|
|
8
7
|
import type { NumberPrefixParser, DocMetadataBase } from '@docusaurus/plugin-content-docs';
|
|
9
8
|
export default function getSlug({ baseID, frontMatterSlug, source, sourceDirName, stripDirNumberPrefixes, numberPrefixParser, }: {
|
|
10
9
|
baseID: string;
|
package/lib/slug.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.default = getSlug;
|
|
9
10
|
const utils_1 = require("@docusaurus/utils");
|
|
10
11
|
const utils_common_1 = require("@docusaurus/utils-common");
|
|
11
12
|
const numberPrefix_1 = require("./numberPrefix");
|
|
@@ -48,4 +49,3 @@ slug: /my/customDocPath
|
|
|
48
49
|
}
|
|
49
50
|
return ensureValidSlug(computeSlug());
|
|
50
51
|
}
|
|
51
|
-
exports.default = getSlug;
|
package/lib/translations.d.ts
CHANGED
|
@@ -4,7 +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
|
-
/// <reference path="../src/plugin-content-docs.d.ts" />
|
|
8
7
|
import type { LoadedContent } from '@docusaurus/plugin-content-docs';
|
|
9
8
|
import type { TranslationFile } from '@docusaurus/types';
|
|
10
9
|
export declare function getLoadedContentTranslationFiles(loadedContent: LoadedContent): TranslationFile[];
|
package/lib/translations.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.getLoadedContentTranslationFiles = getLoadedContentTranslationFiles;
|
|
10
|
+
exports.translateLoadedContent = translateLoadedContent;
|
|
10
11
|
const tslib_1 = require("tslib");
|
|
11
12
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
12
13
|
const utils_1 = require("@docusaurus/utils");
|
|
@@ -158,11 +159,9 @@ function translateVersions(versions, translationFiles) {
|
|
|
158
159
|
function getLoadedContentTranslationFiles(loadedContent) {
|
|
159
160
|
return getVersionsTranslationFiles(loadedContent.loadedVersions);
|
|
160
161
|
}
|
|
161
|
-
exports.getLoadedContentTranslationFiles = getLoadedContentTranslationFiles;
|
|
162
162
|
function translateLoadedContent(loadedContent, translationFiles) {
|
|
163
163
|
const translationFilesMap = lodash_1.default.keyBy(translationFiles, (f) => f.path);
|
|
164
164
|
return {
|
|
165
165
|
loadedVersions: translateVersions(loadedContent.loadedVersions, translationFilesMap),
|
|
166
166
|
};
|
|
167
167
|
}
|
|
168
|
-
exports.translateLoadedContent = translateLoadedContent;
|
package/lib/types.d.ts
CHANGED
|
@@ -4,7 +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
|
-
/// <reference path="../src/plugin-content-docs.d.ts" />
|
|
8
7
|
import type { TagMetadata } from '@docusaurus/utils';
|
|
9
8
|
import type { LoadedVersion, CategoryGeneratedIndexMetadata } from '@docusaurus/plugin-content-docs';
|
|
10
9
|
import type { SidebarsUtils } from './sidebars/utils';
|
package/lib/versions/files.d.ts
CHANGED
|
@@ -4,7 +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
|
-
/// <reference path="../../src/plugin-content-docs.d.ts" />
|
|
8
7
|
import type { PluginOptions, VersionMetadata } from '@docusaurus/plugin-content-docs';
|
|
9
8
|
import type { VersionContext } from './index';
|
|
10
9
|
/** `[siteDir]/community_versioned_docs/version-1.0.0` */
|
package/lib/versions/files.js
CHANGED
|
@@ -6,7 +6,13 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.getVersionDocsDirPath = getVersionDocsDirPath;
|
|
10
|
+
exports.getVersionSidebarsPath = getVersionSidebarsPath;
|
|
11
|
+
exports.getDocsDirPathLocalized = getDocsDirPathLocalized;
|
|
12
|
+
exports.getVersionsFilePath = getVersionsFilePath;
|
|
13
|
+
exports.readVersionsFile = readVersionsFile;
|
|
14
|
+
exports.readVersionNames = readVersionNames;
|
|
15
|
+
exports.getVersionMetadataPaths = getVersionMetadataPaths;
|
|
10
16
|
const tslib_1 = require("tslib");
|
|
11
17
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
12
18
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
@@ -23,12 +29,10 @@ function addPluginIdPrefix(fileOrDir, pluginId) {
|
|
|
23
29
|
function getVersionDocsDirPath(siteDir, pluginId, versionName) {
|
|
24
30
|
return path_1.default.join(siteDir, addPluginIdPrefix(constants_1.VERSIONED_DOCS_DIR, pluginId), `version-${versionName}`);
|
|
25
31
|
}
|
|
26
|
-
exports.getVersionDocsDirPath = getVersionDocsDirPath;
|
|
27
32
|
/** `[siteDir]/community_versioned_sidebars/version-1.0.0-sidebars.json` */
|
|
28
33
|
function getVersionSidebarsPath(siteDir, pluginId, versionName) {
|
|
29
34
|
return path_1.default.join(siteDir, addPluginIdPrefix(constants_1.VERSIONED_SIDEBARS_DIR, pluginId), `version-${versionName}-sidebars.json`);
|
|
30
35
|
}
|
|
31
|
-
exports.getVersionSidebarsPath = getVersionSidebarsPath;
|
|
32
36
|
function getDocsDirPathLocalized({ localizationDir, pluginId, versionName, }) {
|
|
33
37
|
return (0, utils_1.getPluginI18nPath)({
|
|
34
38
|
localizationDir,
|
|
@@ -41,12 +45,10 @@ function getDocsDirPathLocalized({ localizationDir, pluginId, versionName, }) {
|
|
|
41
45
|
],
|
|
42
46
|
});
|
|
43
47
|
}
|
|
44
|
-
exports.getDocsDirPathLocalized = getDocsDirPathLocalized;
|
|
45
48
|
/** `community` => `[siteDir]/community_versions.json` */
|
|
46
49
|
function getVersionsFilePath(siteDir, pluginId) {
|
|
47
50
|
return path_1.default.join(siteDir, addPluginIdPrefix(constants_1.VERSIONS_JSON_FILE, pluginId));
|
|
48
51
|
}
|
|
49
|
-
exports.getVersionsFilePath = getVersionsFilePath;
|
|
50
52
|
/**
|
|
51
53
|
* Reads the plugin's respective `versions.json` file, and returns its content.
|
|
52
54
|
*
|
|
@@ -62,7 +64,6 @@ async function readVersionsFile(siteDir, pluginId) {
|
|
|
62
64
|
}
|
|
63
65
|
return null;
|
|
64
66
|
}
|
|
65
|
-
exports.readVersionsFile = readVersionsFile;
|
|
66
67
|
/**
|
|
67
68
|
* Reads the `versions.json` file, and returns an ordered list of version names.
|
|
68
69
|
*
|
|
@@ -98,7 +99,6 @@ async function readVersionNames(siteDir, options) {
|
|
|
98
99
|
}
|
|
99
100
|
return versions;
|
|
100
101
|
}
|
|
101
|
-
exports.readVersionNames = readVersionNames;
|
|
102
102
|
/**
|
|
103
103
|
* Gets the path-related version metadata.
|
|
104
104
|
*
|
|
@@ -138,4 +138,3 @@ Please set the docs "sidebarPath" field in your config file to:
|
|
|
138
138
|
}
|
|
139
139
|
return { contentPath, contentPathLocalized, sidebarFilePath };
|
|
140
140
|
}
|
|
141
|
-
exports.getVersionMetadataPaths = getVersionMetadataPaths;
|
package/lib/versions/index.d.ts
CHANGED
|
@@ -4,7 +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
|
-
/// <reference path="../../src/plugin-content-docs.d.ts" />
|
|
8
7
|
import type { FullVersion } from '../types';
|
|
9
8
|
import type { LoadContext } from '@docusaurus/types';
|
|
10
9
|
import type { LoadedVersion, PluginOptions, VersionBanner, VersionMetadata } from '@docusaurus/plugin-content-docs';
|
package/lib/versions/index.js
CHANGED
|
@@ -6,7 +6,14 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.getDefaultVersionBanner = getDefaultVersionBanner;
|
|
10
|
+
exports.getVersionBanner = getVersionBanner;
|
|
11
|
+
exports.getVersionBadge = getVersionBadge;
|
|
12
|
+
exports.getVersionNoIndex = getVersionNoIndex;
|
|
13
|
+
exports.filterVersions = filterVersions;
|
|
14
|
+
exports.readVersionsMetadata = readVersionsMetadata;
|
|
15
|
+
exports.toFullVersion = toFullVersion;
|
|
16
|
+
exports.getVersionFromSourceFilePath = getVersionFromSourceFilePath;
|
|
10
17
|
const tslib_1 = require("tslib");
|
|
11
18
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
12
19
|
const utils_1 = require("@docusaurus/utils");
|
|
@@ -55,7 +62,6 @@ function getDefaultVersionBanner({ versionName, versionNames, lastVersionName, }
|
|
|
55
62
|
// Older versions: display unmaintained banner
|
|
56
63
|
return 'unmaintained';
|
|
57
64
|
}
|
|
58
|
-
exports.getDefaultVersionBanner = getDefaultVersionBanner;
|
|
59
65
|
function getVersionBanner(context) {
|
|
60
66
|
const { versionName, options } = context;
|
|
61
67
|
const versionBannerOption = options.versions[versionName]?.banner;
|
|
@@ -64,7 +70,6 @@ function getVersionBanner(context) {
|
|
|
64
70
|
}
|
|
65
71
|
return getDefaultVersionBanner(context);
|
|
66
72
|
}
|
|
67
|
-
exports.getVersionBanner = getVersionBanner;
|
|
68
73
|
function getVersionBadge({ versionName, versionNames, options, }) {
|
|
69
74
|
// If site is not versioned or only one version is included
|
|
70
75
|
// we don't show the version badge by default
|
|
@@ -72,11 +77,9 @@ function getVersionBadge({ versionName, versionNames, options, }) {
|
|
|
72
77
|
const defaultVersionBadge = versionNames.length !== 1;
|
|
73
78
|
return options.versions[versionName]?.badge ?? defaultVersionBadge;
|
|
74
79
|
}
|
|
75
|
-
exports.getVersionBadge = getVersionBadge;
|
|
76
80
|
function getVersionNoIndex({ versionName, options, }) {
|
|
77
81
|
return options.versions[versionName]?.noIndex ?? false;
|
|
78
82
|
}
|
|
79
|
-
exports.getVersionNoIndex = getVersionNoIndex;
|
|
80
83
|
function getVersionClassName({ versionName, options, }) {
|
|
81
84
|
const defaultVersionClassName = `docs-version-${versionName}`;
|
|
82
85
|
return options.versions[versionName]?.className ?? defaultVersionClassName;
|
|
@@ -138,7 +141,6 @@ function filterVersions(versionNamesUnfiltered, options) {
|
|
|
138
141
|
}
|
|
139
142
|
return versionNamesUnfiltered;
|
|
140
143
|
}
|
|
141
|
-
exports.filterVersions = filterVersions;
|
|
142
144
|
function getLastVersionName({ versionNames, options, }) {
|
|
143
145
|
return (options.lastVersion ??
|
|
144
146
|
versionNames.find((name) => name !== constants_1.CURRENT_VERSION_NAME) ??
|
|
@@ -158,7 +160,6 @@ async function readVersionsMetadata({ context, options, }) {
|
|
|
158
160
|
})));
|
|
159
161
|
return versionsMetadata;
|
|
160
162
|
}
|
|
161
|
-
exports.readVersionsMetadata = readVersionsMetadata;
|
|
162
163
|
function toFullVersion(version) {
|
|
163
164
|
const sidebarsUtils = (0, utils_2.createSidebarsUtils)(version.sidebars);
|
|
164
165
|
return {
|
|
@@ -170,7 +171,6 @@ function toFullVersion(version) {
|
|
|
170
171
|
}),
|
|
171
172
|
};
|
|
172
173
|
}
|
|
173
|
-
exports.toFullVersion = toFullVersion;
|
|
174
174
|
function getVersionFromSourceFilePath(filePath, versionsMetadata) {
|
|
175
175
|
const versionFound = versionsMetadata.find((version) => (0, utils_1.getContentPathList)(version).some((docsDirPath) => filePath.startsWith(docsDirPath)));
|
|
176
176
|
if (!versionFound) {
|
|
@@ -178,4 +178,3 @@ function getVersionFromSourceFilePath(filePath, versionsMetadata) {
|
|
|
178
178
|
}
|
|
179
179
|
return versionFound;
|
|
180
180
|
}
|
|
181
|
-
exports.getVersionFromSourceFilePath = getVersionFromSourceFilePath;
|
|
@@ -4,7 +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
|
-
/// <reference path="../../src/plugin-content-docs.d.ts" />
|
|
8
7
|
import type { VersionsOptions } from '@docusaurus/plugin-content-docs';
|
|
9
8
|
export declare function validateVersionName(name: unknown): asserts name is string;
|
|
10
9
|
export declare function validateVersionNames(names: unknown): asserts names is string[];
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.validateVersionName = validateVersionName;
|
|
10
|
+
exports.validateVersionNames = validateVersionNames;
|
|
11
|
+
exports.validateVersionsOptions = validateVersionsOptions;
|
|
10
12
|
const tslib_1 = require("tslib");
|
|
11
13
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
12
14
|
function validateVersionName(name) {
|
|
@@ -29,14 +31,12 @@ function validateVersionName(name) {
|
|
|
29
31
|
}
|
|
30
32
|
});
|
|
31
33
|
}
|
|
32
|
-
exports.validateVersionName = validateVersionName;
|
|
33
34
|
function validateVersionNames(names) {
|
|
34
35
|
if (!Array.isArray(names)) {
|
|
35
36
|
throw new Error(`The versions file should contain an array of version names! Found content: ${JSON.stringify(names)}`);
|
|
36
37
|
}
|
|
37
38
|
names.forEach(validateVersionName);
|
|
38
39
|
}
|
|
39
|
-
exports.validateVersionNames = validateVersionNames;
|
|
40
40
|
/**
|
|
41
41
|
* @throws Throws for one of the following invalid options:
|
|
42
42
|
* - `lastVersion` is non-existent
|
|
@@ -68,4 +68,3 @@ function validateVersionsOptions(availableVersionNames, options) {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
exports.validateVersionsOptions = validateVersionsOptions;
|
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-5982",
|
|
4
4
|
"description": "Docs plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
},
|
|
36
36
|
"license": "MIT",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@docusaurus/core": "0.0.0-
|
|
39
|
-
"@docusaurus/logger": "0.0.0-
|
|
40
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
41
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
42
|
-
"@docusaurus/types": "0.0.0-
|
|
43
|
-
"@docusaurus/utils": "0.0.0-
|
|
44
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
45
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
38
|
+
"@docusaurus/core": "0.0.0-5982",
|
|
39
|
+
"@docusaurus/logger": "0.0.0-5982",
|
|
40
|
+
"@docusaurus/mdx-loader": "0.0.0-5982",
|
|
41
|
+
"@docusaurus/module-type-aliases": "0.0.0-5982",
|
|
42
|
+
"@docusaurus/types": "0.0.0-5982",
|
|
43
|
+
"@docusaurus/utils": "0.0.0-5982",
|
|
44
|
+
"@docusaurus/utils-common": "0.0.0-5982",
|
|
45
|
+
"@docusaurus/utils-validation": "0.0.0-5982",
|
|
46
46
|
"@types/react-router-config": "^5.0.7",
|
|
47
47
|
"combine-promises": "^1.1.0",
|
|
48
48
|
"fs-extra": "^11.1.1",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"engines": {
|
|
67
67
|
"node": ">=18.0"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "8b6a944282857a6fc8e184e8b56109238ce50924"
|
|
70
70
|
}
|