@docusaurus/plugin-content-docs 2.0.0-beta.fc64c12e4 → 2.0.0
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 +12 -0
- package/lib/categoryGeneratedIndex.js +37 -0
- package/lib/cli.d.ts +3 -2
- package/lib/cli.js +57 -73
- package/lib/client/docsClientUtils.d.ts +9 -28
- package/lib/client/docsClientUtils.js +34 -43
- package/lib/client/index.d.ts +81 -0
- package/lib/client/index.js +67 -0
- package/lib/constants.d.ts +4 -0
- package/lib/constants.js +4 -1
- package/lib/docs.d.ts +33 -6
- package/lib/docs.js +201 -78
- package/{src/__tests__/__fixtures__/site-with-autogenerated-sidebar/docusaurus.config.js → lib/frontMatter.d.ts} +4 -8
- package/lib/{docFrontMatter.js → frontMatter.js} +22 -3
- package/lib/globalData.d.ts +3 -3
- package/lib/globalData.js +35 -6
- package/lib/index.d.ts +3 -3
- package/lib/index.js +120 -153
- package/lib/lastUpdate.d.ts +4 -6
- package/lib/lastUpdate.js +22 -26
- package/lib/markdown/index.d.ts +3 -6
- package/lib/markdown/index.js +3 -3
- package/lib/markdown/linkify.d.ts +1 -1
- package/lib/markdown/linkify.js +6 -3
- package/lib/numberPrefix.d.ts +1 -1
- package/lib/numberPrefix.js +16 -21
- package/lib/options.d.ts +3 -5
- package/lib/options.js +34 -26
- package/lib/props.d.ts +7 -2
- package/lib/props.js +84 -13
- package/lib/routes.d.ts +29 -0
- package/lib/routes.js +96 -0
- package/lib/server-export.d.ts +9 -0
- package/lib/server-export.js +25 -0
- package/lib/{sidebarItemsGenerator.d.ts → sidebars/generator.d.ts} +1 -7
- package/lib/sidebars/generator.js +209 -0
- package/lib/sidebars/index.d.ts +13 -0
- package/lib/sidebars/index.js +92 -0
- package/lib/sidebars/normalization.d.ts +13 -0
- package/lib/sidebars/normalization.js +59 -0
- package/lib/sidebars/postProcessor.d.ts +11 -0
- package/lib/sidebars/postProcessor.js +81 -0
- package/lib/sidebars/processor.d.ts +10 -0
- package/lib/sidebars/processor.js +79 -0
- package/lib/sidebars/types.d.ts +183 -0
- package/lib/{docFrontMatter.d.ts → sidebars/types.js} +2 -2
- package/lib/sidebars/utils.d.ts +55 -0
- package/lib/sidebars/utils.js +259 -0
- package/lib/sidebars/validation.d.ts +11 -0
- package/lib/sidebars/validation.js +143 -0
- package/lib/slug.d.ts +5 -4
- package/lib/slug.js +28 -18
- package/{src/__tests__/__fixtures__/sidebars/sidebars-first-level-not-category.js → lib/tags.d.ts} +3 -14
- package/lib/tags.js +21 -0
- package/lib/translations.d.ts +3 -3
- package/lib/translations.js +100 -93
- package/lib/types.d.ts +13 -192
- package/lib/versions/files.d.ts +50 -0
- package/lib/versions/files.js +141 -0
- package/lib/versions/index.d.ts +36 -0
- package/lib/versions/index.js +154 -0
- package/lib/versions/validation.d.ts +17 -0
- package/lib/versions/validation.js +71 -0
- package/package.json +44 -30
- package/src/categoryGeneratedIndex.ts +60 -0
- package/src/cli.ts +88 -118
- package/src/client/docsClientUtils.ts +44 -71
- package/src/client/index.ts +158 -0
- package/src/constants.ts +4 -2
- package/src/docs.ts +277 -80
- package/src/frontMatter.ts +63 -0
- package/src/globalData.ts +57 -7
- package/src/index.ts +174 -221
- package/src/lastUpdate.ts +27 -38
- package/src/markdown/index.ts +10 -16
- package/src/markdown/linkify.ts +7 -4
- package/src/numberPrefix.ts +19 -26
- package/src/options.ts +38 -38
- package/src/plugin-content-docs.d.ts +570 -91
- package/src/props.ts +121 -20
- package/src/routes.ts +159 -0
- package/src/server-export.ts +26 -0
- package/src/sidebars/README.md +10 -0
- package/src/sidebars/generator.ts +292 -0
- package/src/sidebars/index.ts +118 -0
- package/src/sidebars/normalization.ts +91 -0
- package/src/sidebars/postProcessor.ts +112 -0
- package/src/sidebars/processor.ts +123 -0
- package/src/sidebars/types.ts +280 -0
- package/src/sidebars/utils.ts +393 -0
- package/src/sidebars/validation.ts +179 -0
- package/src/slug.ts +41 -22
- package/src/tags.ts +20 -0
- package/src/translations.ts +155 -124
- package/src/types.ts +17 -259
- package/src/versions/files.ts +216 -0
- package/src/versions/index.ts +246 -0
- package/src/versions/validation.ts +115 -0
- package/lib/.tsbuildinfo +0 -1
- package/lib/sidebarItemsGenerator.js +0 -215
- package/lib/sidebars.d.ts +0 -45
- package/lib/sidebars.js +0 -354
- package/lib/theme/hooks/useDocs.d.ts +0 -20
- package/lib/theme/hooks/useDocs.js +0 -75
- package/lib/versions.d.ts +0 -16
- package/lib/versions.js +0 -319
- package/src/__tests__/__fixtures__/bad-id-site/docs/invalid-id.md +0 -5
- package/src/__tests__/__fixtures__/bad-slug-on-doc-home-site/docs/docWithSlug.md +0 -5
- package/src/__tests__/__fixtures__/empty-site/docusaurus.config.js +0 -16
- package/src/__tests__/__fixtures__/empty-site/sidebars.json +0 -1
- package/src/__tests__/__fixtures__/sidebars/sidebars-category-shorthand.js +0 -34
- package/src/__tests__/__fixtures__/sidebars/sidebars-category-wrong-items.json +0 -11
- package/src/__tests__/__fixtures__/sidebars/sidebars-category-wrong-label.json +0 -11
- package/src/__tests__/__fixtures__/sidebars/sidebars-category.js +0 -44
- package/src/__tests__/__fixtures__/sidebars/sidebars-collapsed-first-level.json +0 -20
- package/src/__tests__/__fixtures__/sidebars/sidebars-collapsed.json +0 -21
- package/src/__tests__/__fixtures__/sidebars/sidebars-doc-id-not-string.json +0 -10
- package/src/__tests__/__fixtures__/sidebars/sidebars-link-wrong-href.json +0 -11
- package/src/__tests__/__fixtures__/sidebars/sidebars-link-wrong-label.json +0 -11
- package/src/__tests__/__fixtures__/sidebars/sidebars-link.json +0 -11
- package/src/__tests__/__fixtures__/sidebars/sidebars-unknown-type.json +0 -14
- package/src/__tests__/__fixtures__/sidebars/sidebars-wrong-field.json +0 -20
- package/src/__tests__/__fixtures__/sidebars/sidebars.json +0 -20
- package/src/__tests__/__fixtures__/simple-site/docs/_partials/somePartial.md +0 -3
- package/src/__tests__/__fixtures__/simple-site/docs/_partials/subfolder/somePartial.md +0 -3
- package/src/__tests__/__fixtures__/simple-site/docs/_somePartial.md +0 -3
- package/src/__tests__/__fixtures__/simple-site/docs/foo/bar.md +0 -69
- package/src/__tests__/__fixtures__/simple-site/docs/foo/baz.md +0 -70
- package/src/__tests__/__fixtures__/simple-site/docs/headingAsTitle.md +0 -1
- package/src/__tests__/__fixtures__/simple-site/docs/hello.md +0 -53
- package/src/__tests__/__fixtures__/simple-site/docs/ipsum.md +0 -5
- package/src/__tests__/__fixtures__/simple-site/docs/lorem.md +0 -6
- package/src/__tests__/__fixtures__/simple-site/docs/rootAbsoluteSlug.md +0 -5
- package/src/__tests__/__fixtures__/simple-site/docs/rootRelativeSlug.md +0 -5
- package/src/__tests__/__fixtures__/simple-site/docs/rootResolvedSlug.md +0 -5
- package/src/__tests__/__fixtures__/simple-site/docs/rootTryToEscapeSlug.md +0 -5
- package/src/__tests__/__fixtures__/simple-site/docs/slugs/absoluteSlug.md +0 -5
- package/src/__tests__/__fixtures__/simple-site/docs/slugs/relativeSlug.md +0 -5
- package/src/__tests__/__fixtures__/simple-site/docs/slugs/resolvedSlug.md +0 -5
- package/src/__tests__/__fixtures__/simple-site/docs/slugs/tryToEscapeSlug.md +0 -5
- package/src/__tests__/__fixtures__/simple-site/docusaurus.config.js +0 -14
- package/src/__tests__/__fixtures__/simple-site/sidebars.json +0 -23
- package/src/__tests__/__fixtures__/simple-site/wrong-sidebars.json +0 -7
- package/src/__tests__/__fixtures__/site-with-autogenerated-sidebar/docs/0-getting-started.md +0 -3
- package/src/__tests__/__fixtures__/site-with-autogenerated-sidebar/docs/1-installation.md +0 -3
- package/src/__tests__/__fixtures__/site-with-autogenerated-sidebar/docs/3-API/00_api-overview.md +0 -3
- package/src/__tests__/__fixtures__/site-with-autogenerated-sidebar/docs/3-API/01_Core APIs/0 --- Client API.md +0 -1
- package/src/__tests__/__fixtures__/site-with-autogenerated-sidebar/docs/3-API/01_Core APIs/1 --- Server API.md +0 -1
- package/src/__tests__/__fixtures__/site-with-autogenerated-sidebar/docs/3-API/02_Extension APIs/0. Plugin API.md +0 -1
- package/src/__tests__/__fixtures__/site-with-autogenerated-sidebar/docs/3-API/02_Extension APIs/1. Theme API.md +0 -1
- package/src/__tests__/__fixtures__/site-with-autogenerated-sidebar/docs/3-API/02_Extension APIs/_category_.yml +0 -1
- package/src/__tests__/__fixtures__/site-with-autogenerated-sidebar/docs/3-API/03_api-end.md +0 -3
- package/src/__tests__/__fixtures__/site-with-autogenerated-sidebar/docs/3-API/_category_.json +0 -3
- package/src/__tests__/__fixtures__/site-with-autogenerated-sidebar/docs/Guides/0-guide2.5.md +0 -8
- package/src/__tests__/__fixtures__/site-with-autogenerated-sidebar/docs/Guides/02-guide2.md +0 -7
- package/src/__tests__/__fixtures__/site-with-autogenerated-sidebar/docs/Guides/_category_.json +0 -3
- package/src/__tests__/__fixtures__/site-with-autogenerated-sidebar/docs/Guides/a-guide4.md +0 -7
- package/src/__tests__/__fixtures__/site-with-autogenerated-sidebar/docs/Guides/b-guide5.md +0 -7
- package/src/__tests__/__fixtures__/site-with-autogenerated-sidebar/docs/Guides/guide3.md +0 -8
- package/src/__tests__/__fixtures__/site-with-autogenerated-sidebar/docs/Guides/z-guide1.md +0 -8
- package/src/__tests__/__fixtures__/site-with-autogenerated-sidebar/partialAutogeneratedSidebars.js +0 -23
- package/src/__tests__/__fixtures__/site-with-autogenerated-sidebar/partialAutogeneratedSidebars2.js +0 -16
- package/src/__tests__/__fixtures__/site-with-doc-label/docs/hello-1.md +0 -7
- package/src/__tests__/__fixtures__/site-with-doc-label/docs/hello-2.md +0 -8
- package/src/__tests__/__fixtures__/site-with-doc-label/docusaurus.config.js +0 -14
- package/src/__tests__/__fixtures__/site-with-doc-label/sidebars.json +0 -14
- package/src/__tests__/__fixtures__/versioned-site/community/team.md +0 -1
- package/src/__tests__/__fixtures__/versioned-site/community_sidebars.json +0 -3
- package/src/__tests__/__fixtures__/versioned-site/community_versioned_docs/version-1.0.0/team.md +0 -1
- package/src/__tests__/__fixtures__/versioned-site/community_versioned_sidebars/version-1.0.0-sidebars.json +0 -3
- package/src/__tests__/__fixtures__/versioned-site/community_versions.json +0 -1
- package/src/__tests__/__fixtures__/versioned-site/docs/foo/bar.md +0 -4
- package/src/__tests__/__fixtures__/versioned-site/docs/hello.md +0 -1
- package/src/__tests__/__fixtures__/versioned-site/docs/slugs/absoluteSlug.md +0 -5
- package/src/__tests__/__fixtures__/versioned-site/docs/slugs/relativeSlug.md +0 -5
- package/src/__tests__/__fixtures__/versioned-site/docs/slugs/resolvedSlug.md +0 -5
- package/src/__tests__/__fixtures__/versioned-site/docs/slugs/tryToEscapeSlug.md +0 -5
- package/src/__tests__/__fixtures__/versioned-site/docusaurus.config.js +0 -18
- package/src/__tests__/__fixtures__/versioned-site/i18n/en/docusaurus-plugin-content-docs/version-1.0.0/hello.md +0 -1
- package/src/__tests__/__fixtures__/versioned-site/i18n/en/docusaurus-plugin-content-docs-community/current/team.md +0 -5
- package/src/__tests__/__fixtures__/versioned-site/i18n/fr/docusaurus-plugin-content-docs/version-1.0.0/hello.md +0 -1
- package/src/__tests__/__fixtures__/versioned-site/sidebars.json +0 -10
- package/src/__tests__/__fixtures__/versioned-site/versioned_docs/version-1.0.0/foo/bar.md +0 -4
- package/src/__tests__/__fixtures__/versioned-site/versioned_docs/version-1.0.0/foo/baz.md +0 -1
- package/src/__tests__/__fixtures__/versioned-site/versioned_docs/version-1.0.0/hello.md +0 -1
- package/src/__tests__/__fixtures__/versioned-site/versioned_docs/version-1.0.1/_partials/somePartial.md +0 -3
- package/src/__tests__/__fixtures__/versioned-site/versioned_docs/version-1.0.1/_partials/subfolder/somePartial.md +0 -3
- package/src/__tests__/__fixtures__/versioned-site/versioned_docs/version-1.0.1/_somePartial.md +0 -3
- package/src/__tests__/__fixtures__/versioned-site/versioned_docs/version-1.0.1/foo/bar.md +0 -1
- package/src/__tests__/__fixtures__/versioned-site/versioned_docs/version-1.0.1/hello.md +0 -1
- package/src/__tests__/__fixtures__/versioned-site/versioned_docs/version-withSlugs/rootAbsoluteSlug.md +0 -5
- package/src/__tests__/__fixtures__/versioned-site/versioned_docs/version-withSlugs/rootRelativeSlug.md +0 -5
- package/src/__tests__/__fixtures__/versioned-site/versioned_docs/version-withSlugs/rootResolvedSlug.md +0 -5
- package/src/__tests__/__fixtures__/versioned-site/versioned_docs/version-withSlugs/rootTryToEscapeSlug.md +0 -5
- package/src/__tests__/__fixtures__/versioned-site/versioned_docs/version-withSlugs/slugs/absoluteSlug.md +0 -5
- package/src/__tests__/__fixtures__/versioned-site/versioned_docs/version-withSlugs/slugs/relativeSlug.md +0 -5
- package/src/__tests__/__fixtures__/versioned-site/versioned_docs/version-withSlugs/slugs/resolvedSlug.md +0 -5
- package/src/__tests__/__fixtures__/versioned-site/versioned_docs/version-withSlugs/slugs/tryToEscapeSlug.md +0 -5
- package/src/__tests__/__fixtures__/versioned-site/versioned_sidebars/version-1.0.0-sidebars.json +0 -11
- package/src/__tests__/__fixtures__/versioned-site/versioned_sidebars/version-1.0.1-sidebars.json +0 -10
- package/src/__tests__/__fixtures__/versioned-site/versioned_sidebars/version-withSlugs-sidebars.json +0 -5
- package/src/__tests__/__fixtures__/versioned-site/versions.json +0 -5
- package/src/__tests__/__snapshots__/cli.test.ts.snap +0 -95
- package/src/__tests__/__snapshots__/index.test.ts.snap +0 -1926
- package/src/__tests__/__snapshots__/sidebars.test.ts.snap +0 -233
- package/src/__tests__/__snapshots__/translations.test.ts.snap +0 -484
- package/src/__tests__/cli.test.ts +0 -337
- package/src/__tests__/docFrontMatter.test.ts +0 -244
- package/src/__tests__/docs.test.ts +0 -878
- package/src/__tests__/index.test.ts +0 -1885
- package/src/__tests__/lastUpdate.test.ts +0 -69
- package/src/__tests__/numberPrefix.test.ts +0 -199
- package/src/__tests__/options.test.ts +0 -272
- package/src/__tests__/sidebarItemsGenerator.test.ts +0 -358
- package/src/__tests__/sidebars.test.ts +0 -746
- package/src/__tests__/slug.test.ts +0 -109
- package/src/__tests__/translations.test.ts +0 -158
- package/src/__tests__/versions.test.ts +0 -741
- package/src/client/__tests__/docsClientUtils.test.ts +0 -371
- package/src/docFrontMatter.ts +0 -41
- package/src/markdown/__tests__/__fixtures__/docs/doc-localized.md +0 -1
- package/src/markdown/__tests__/__fixtures__/docs/doc1.md +0 -13
- package/src/markdown/__tests__/__fixtures__/docs/doc2.md +0 -12
- package/src/markdown/__tests__/__fixtures__/docs/doc4.md +0 -19
- package/src/markdown/__tests__/__fixtures__/docs/doc5.md +0 -6
- package/src/markdown/__tests__/__fixtures__/docs/subdir/doc3.md +0 -3
- package/src/markdown/__tests__/__fixtures__/versioned_docs/version-1.0.0/doc2.md +0 -7
- package/src/markdown/__tests__/__fixtures__/versioned_docs/version-1.0.0/subdir/doc1.md +0 -3
- package/src/markdown/__tests__/__snapshots__/linkify.test.ts.snap +0 -82
- package/src/markdown/__tests__/linkify.test.ts +0 -190
- package/src/sidebarItemsGenerator.ts +0 -315
- package/src/sidebars.ts +0 -589
- package/src/theme/hooks/useDocs.ts +0 -103
- package/src/versions.ts +0 -572
- package/tsconfig.json +0 -9
- package/types.d.ts +0 -13
|
@@ -1,75 +0,0 @@
|
|
|
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
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.useDocVersionSuggestions = exports.useActiveDocContext = exports.useActiveVersion = exports.useLatestVersion = exports.useVersions = exports.useActivePluginAndVersion = exports.useActivePlugin = exports.useDocsData = exports.useAllDocsData = void 0;
|
|
10
|
-
const tslib_1 = require("tslib");
|
|
11
|
-
const router_1 = require("@docusaurus/router");
|
|
12
|
-
const useGlobalData_1 = tslib_1.__importStar(require("@docusaurus/useGlobalData"));
|
|
13
|
-
const docsClientUtils_1 = require("../../client/docsClientUtils");
|
|
14
|
-
// Important to use a constant object to avoid React useEffect executions etc...,
|
|
15
|
-
// see https://github.com/facebook/docusaurus/issues/5089
|
|
16
|
-
const StableEmptyObject = {};
|
|
17
|
-
// Not using useAllPluginInstancesData() because in blog-only mode, docs hooks are still used by the theme
|
|
18
|
-
// We need a fail-safe fallback when the docs plugin is not in use
|
|
19
|
-
const useAllDocsData = () => { var _a;
|
|
20
|
-
// useAllPluginInstancesData('docusaurus-plugin-content-docs');
|
|
21
|
-
return (_a = useGlobalData_1.default()['docusaurus-plugin-content-docs']) !== null && _a !== void 0 ? _a : StableEmptyObject; };
|
|
22
|
-
exports.useAllDocsData = useAllDocsData;
|
|
23
|
-
const useDocsData = (pluginId) => useGlobalData_1.usePluginData('docusaurus-plugin-content-docs', pluginId);
|
|
24
|
-
exports.useDocsData = useDocsData;
|
|
25
|
-
const useActivePlugin = (options = {}) => {
|
|
26
|
-
const data = exports.useAllDocsData();
|
|
27
|
-
const { pathname } = router_1.useLocation();
|
|
28
|
-
return docsClientUtils_1.getActivePlugin(data, pathname, options);
|
|
29
|
-
};
|
|
30
|
-
exports.useActivePlugin = useActivePlugin;
|
|
31
|
-
const useActivePluginAndVersion = (options = {}) => {
|
|
32
|
-
const activePlugin = exports.useActivePlugin(options);
|
|
33
|
-
const { pathname } = router_1.useLocation();
|
|
34
|
-
if (activePlugin) {
|
|
35
|
-
const activeVersion = docsClientUtils_1.getActiveVersion(activePlugin.pluginData, pathname);
|
|
36
|
-
return {
|
|
37
|
-
activePlugin,
|
|
38
|
-
activeVersion,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
return undefined;
|
|
42
|
-
};
|
|
43
|
-
exports.useActivePluginAndVersion = useActivePluginAndVersion;
|
|
44
|
-
// versions are returned ordered (most recent first)
|
|
45
|
-
const useVersions = (pluginId) => {
|
|
46
|
-
const data = exports.useDocsData(pluginId);
|
|
47
|
-
return data.versions;
|
|
48
|
-
};
|
|
49
|
-
exports.useVersions = useVersions;
|
|
50
|
-
const useLatestVersion = (pluginId) => {
|
|
51
|
-
const data = exports.useDocsData(pluginId);
|
|
52
|
-
return docsClientUtils_1.getLatestVersion(data);
|
|
53
|
-
};
|
|
54
|
-
exports.useLatestVersion = useLatestVersion;
|
|
55
|
-
// Note: return undefined on doc-unrelated pages,
|
|
56
|
-
// because there's no version currently considered as active
|
|
57
|
-
const useActiveVersion = (pluginId) => {
|
|
58
|
-
const data = exports.useDocsData(pluginId);
|
|
59
|
-
const { pathname } = router_1.useLocation();
|
|
60
|
-
return docsClientUtils_1.getActiveVersion(data, pathname);
|
|
61
|
-
};
|
|
62
|
-
exports.useActiveVersion = useActiveVersion;
|
|
63
|
-
const useActiveDocContext = (pluginId) => {
|
|
64
|
-
const data = exports.useDocsData(pluginId);
|
|
65
|
-
const { pathname } = router_1.useLocation();
|
|
66
|
-
return docsClientUtils_1.getActiveDocContext(data, pathname);
|
|
67
|
-
};
|
|
68
|
-
exports.useActiveDocContext = useActiveDocContext;
|
|
69
|
-
// Useful to say "hey, you are not on the latest docs version, please switch"
|
|
70
|
-
const useDocVersionSuggestions = (pluginId) => {
|
|
71
|
-
const data = exports.useDocsData(pluginId);
|
|
72
|
-
const { pathname } = router_1.useLocation();
|
|
73
|
-
return docsClientUtils_1.getDocVersionSuggestions(data, pathname);
|
|
74
|
-
};
|
|
75
|
-
exports.useDocVersionSuggestions = useDocVersionSuggestions;
|
package/lib/versions.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
import { PluginOptions, VersionMetadata } from './types';
|
|
8
|
-
import { LoadContext } from '@docusaurus/types';
|
|
9
|
-
export declare function getVersionedDocsDirPath(siteDir: string, pluginId: string): string;
|
|
10
|
-
export declare function getVersionedSidebarsDirPath(siteDir: string, pluginId: string): string;
|
|
11
|
-
export declare function getVersionsFilePath(siteDir: string, pluginId: string): string;
|
|
12
|
-
export declare function readVersionsMetadata({ context, options, }: {
|
|
13
|
-
context: Pick<LoadContext, 'siteDir' | 'baseUrl' | 'i18n'>;
|
|
14
|
-
options: Pick<PluginOptions, 'id' | 'path' | 'sidebarPath' | 'routeBasePath' | 'includeCurrentVersion' | 'disableVersioning' | 'lastVersion' | 'versions' | 'onlyIncludeVersions' | 'editUrl' | 'editCurrentVersion'>;
|
|
15
|
-
}): VersionMetadata[];
|
|
16
|
-
export declare function getDocsDirPaths(versionMetadata: Pick<VersionMetadata, 'contentPath' | 'contentPathLocalized'>): [string, string];
|
package/lib/versions.js
DELETED
|
@@ -1,319 +0,0 @@
|
|
|
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
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.getDocsDirPaths = exports.readVersionsMetadata = exports.getVersionsFilePath = exports.getVersionedSidebarsDirPath = exports.getVersionedDocsDirPath = void 0;
|
|
10
|
-
const tslib_1 = require("tslib");
|
|
11
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
12
|
-
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
13
|
-
const constants_1 = require("./constants");
|
|
14
|
-
const constants_2 = require("@docusaurus/core/lib/constants");
|
|
15
|
-
const utils_1 = require("@docusaurus/utils");
|
|
16
|
-
const lodash_1 = require("lodash");
|
|
17
|
-
const sidebars_1 = require("./sidebars");
|
|
18
|
-
// retro-compatibility: no prefix for the default plugin id
|
|
19
|
-
function addPluginIdPrefix(fileOrDir, pluginId) {
|
|
20
|
-
if (pluginId === constants_2.DEFAULT_PLUGIN_ID) {
|
|
21
|
-
return fileOrDir;
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
return `${pluginId}_${fileOrDir}`;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function getVersionedDocsDirPath(siteDir, pluginId) {
|
|
28
|
-
return path_1.default.join(siteDir, addPluginIdPrefix(constants_1.VERSIONED_DOCS_DIR, pluginId));
|
|
29
|
-
}
|
|
30
|
-
exports.getVersionedDocsDirPath = getVersionedDocsDirPath;
|
|
31
|
-
function getVersionedSidebarsDirPath(siteDir, pluginId) {
|
|
32
|
-
return path_1.default.join(siteDir, addPluginIdPrefix(constants_1.VERSIONED_SIDEBARS_DIR, pluginId));
|
|
33
|
-
}
|
|
34
|
-
exports.getVersionedSidebarsDirPath = getVersionedSidebarsDirPath;
|
|
35
|
-
function getVersionsFilePath(siteDir, pluginId) {
|
|
36
|
-
return path_1.default.join(siteDir, addPluginIdPrefix(constants_1.VERSIONS_JSON_FILE, pluginId));
|
|
37
|
-
}
|
|
38
|
-
exports.getVersionsFilePath = getVersionsFilePath;
|
|
39
|
-
function ensureValidVersionString(version) {
|
|
40
|
-
if (typeof version !== 'string') {
|
|
41
|
-
throw new Error(`Versions should be strings. Found type "${typeof version}" for version "${version}".`);
|
|
42
|
-
}
|
|
43
|
-
// Should we forbid versions with special chars like / ?
|
|
44
|
-
if (version.trim().length === 0) {
|
|
45
|
-
throw new Error(`Invalid version "${version}".`);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
function ensureValidVersionArray(versionArray) {
|
|
49
|
-
if (!(versionArray instanceof Array)) {
|
|
50
|
-
throw new Error(`The versions file should contain an array of versions! Found content: ${JSON.stringify(versionArray)}`);
|
|
51
|
-
}
|
|
52
|
-
versionArray.forEach(ensureValidVersionString);
|
|
53
|
-
}
|
|
54
|
-
// TODO not easy to make async due to many deps
|
|
55
|
-
function readVersionsFile(siteDir, pluginId) {
|
|
56
|
-
const versionsFilePath = getVersionsFilePath(siteDir, pluginId);
|
|
57
|
-
if (fs_extra_1.default.existsSync(versionsFilePath)) {
|
|
58
|
-
const content = JSON.parse(fs_extra_1.default.readFileSync(versionsFilePath, 'utf8'));
|
|
59
|
-
ensureValidVersionArray(content);
|
|
60
|
-
return content;
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
// TODO not easy to make async due to many deps
|
|
67
|
-
function readVersionNames(siteDir, options) {
|
|
68
|
-
const versionFileContent = readVersionsFile(siteDir, options.id);
|
|
69
|
-
if (!versionFileContent && options.disableVersioning) {
|
|
70
|
-
throw new Error(`Docs: using "disableVersioning=${options.disableVersioning}" option on a non-versioned site does not make sense.`);
|
|
71
|
-
}
|
|
72
|
-
const versions = options.disableVersioning ? [] : versionFileContent !== null && versionFileContent !== void 0 ? versionFileContent : [];
|
|
73
|
-
// We add the current version at the beginning, unless
|
|
74
|
-
// - user don't want to
|
|
75
|
-
// - it's been explicitly added to versions.json
|
|
76
|
-
if (options.includeCurrentVersion &&
|
|
77
|
-
!versions.includes(constants_1.CURRENT_VERSION_NAME)) {
|
|
78
|
-
versions.unshift(constants_1.CURRENT_VERSION_NAME);
|
|
79
|
-
}
|
|
80
|
-
if (versions.length === 0) {
|
|
81
|
-
throw new Error(`It is not possible to use docs without any version. Please check the configuration of these options: "includeCurrentVersion=${options.includeCurrentVersion}", "disableVersioning=${options.disableVersioning}".`);
|
|
82
|
-
}
|
|
83
|
-
return versions;
|
|
84
|
-
}
|
|
85
|
-
function getDocsDirPathLocalized({ siteDir, locale, pluginId, versionName, }) {
|
|
86
|
-
return utils_1.getPluginI18nPath({
|
|
87
|
-
siteDir,
|
|
88
|
-
locale,
|
|
89
|
-
pluginName: 'docusaurus-plugin-content-docs',
|
|
90
|
-
pluginId,
|
|
91
|
-
subPaths: [
|
|
92
|
-
versionName === constants_1.CURRENT_VERSION_NAME
|
|
93
|
-
? constants_1.CURRENT_VERSION_NAME
|
|
94
|
-
: `version-${versionName}`,
|
|
95
|
-
],
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
function getVersionMetadataPaths({ versionName, context, options, }) {
|
|
99
|
-
const isCurrentVersion = versionName === constants_1.CURRENT_VERSION_NAME;
|
|
100
|
-
const contentPath = isCurrentVersion
|
|
101
|
-
? path_1.default.resolve(context.siteDir, options.path)
|
|
102
|
-
: path_1.default.join(getVersionedDocsDirPath(context.siteDir, options.id), `version-${versionName}`);
|
|
103
|
-
const contentPathLocalized = getDocsDirPathLocalized({
|
|
104
|
-
siteDir: context.siteDir,
|
|
105
|
-
locale: context.i18n.currentLocale,
|
|
106
|
-
pluginId: options.id,
|
|
107
|
-
versionName,
|
|
108
|
-
});
|
|
109
|
-
function getSidebarFilePath() {
|
|
110
|
-
if (isCurrentVersion) {
|
|
111
|
-
return sidebars_1.resolveSidebarPathOption(context.siteDir, options.sidebarPath);
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
return path_1.default.join(getVersionedSidebarsDirPath(context.siteDir, options.id), `version-${versionName}-sidebars.json`);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return {
|
|
118
|
-
contentPath,
|
|
119
|
-
contentPathLocalized,
|
|
120
|
-
sidebarFilePath: getSidebarFilePath(),
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
function getVersionEditUrls({ contentPath, contentPathLocalized, context: { siteDir, i18n }, options: { id, path: currentVersionPath, editUrl, editCurrentVersion }, }) {
|
|
124
|
-
if (!editUrl) {
|
|
125
|
-
return undefined;
|
|
126
|
-
}
|
|
127
|
-
// if the user is using the functional form of editUrl,
|
|
128
|
-
// he has total freedom and we can't compute a "version edit url"
|
|
129
|
-
if (typeof editUrl === 'function') {
|
|
130
|
-
return undefined;
|
|
131
|
-
}
|
|
132
|
-
const editDirPath = editCurrentVersion ? currentVersionPath : contentPath;
|
|
133
|
-
const editDirPathLocalized = editCurrentVersion
|
|
134
|
-
? getDocsDirPathLocalized({
|
|
135
|
-
siteDir,
|
|
136
|
-
locale: i18n.currentLocale,
|
|
137
|
-
versionName: constants_1.CURRENT_VERSION_NAME,
|
|
138
|
-
pluginId: id,
|
|
139
|
-
})
|
|
140
|
-
: contentPathLocalized;
|
|
141
|
-
const versionPathSegment = utils_1.posixPath(path_1.default.relative(siteDir, path_1.default.resolve(siteDir, editDirPath)));
|
|
142
|
-
const versionPathSegmentLocalized = utils_1.posixPath(path_1.default.relative(siteDir, path_1.default.resolve(siteDir, editDirPathLocalized)));
|
|
143
|
-
const versionEditUrl = utils_1.normalizeUrl([editUrl, versionPathSegment]);
|
|
144
|
-
const versionEditUrlLocalized = utils_1.normalizeUrl([
|
|
145
|
-
editUrl,
|
|
146
|
-
versionPathSegmentLocalized,
|
|
147
|
-
]);
|
|
148
|
-
return {
|
|
149
|
-
versionEditUrl,
|
|
150
|
-
versionEditUrlLocalized,
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
function getDefaultVersionBanner({ versionName, versionNames, lastVersionName, }) {
|
|
154
|
-
// Current version: good, no banner
|
|
155
|
-
if (versionName === lastVersionName) {
|
|
156
|
-
return 'none';
|
|
157
|
-
}
|
|
158
|
-
// Upcoming versions: unreleased banner
|
|
159
|
-
else if (versionNames.indexOf(versionName) < versionNames.indexOf(lastVersionName)) {
|
|
160
|
-
return 'unreleased';
|
|
161
|
-
}
|
|
162
|
-
// Older versions: display unmaintained banner
|
|
163
|
-
else {
|
|
164
|
-
return 'unmaintained';
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
function getVersionBanner({ versionName, versionNames, lastVersionName, options, }) {
|
|
168
|
-
var _a;
|
|
169
|
-
const versionOptionBanner = (_a = options.versions[versionName]) === null || _a === void 0 ? void 0 : _a.banner;
|
|
170
|
-
return (versionOptionBanner !== null && versionOptionBanner !== void 0 ? versionOptionBanner : getDefaultVersionBanner({
|
|
171
|
-
versionName,
|
|
172
|
-
versionNames,
|
|
173
|
-
lastVersionName,
|
|
174
|
-
}));
|
|
175
|
-
}
|
|
176
|
-
function createVersionMetadata({ versionName, versionNames, lastVersionName, context, options, }) {
|
|
177
|
-
var _a, _b, _c;
|
|
178
|
-
const { sidebarFilePath, contentPath, contentPathLocalized, } = getVersionMetadataPaths({
|
|
179
|
-
versionName,
|
|
180
|
-
context,
|
|
181
|
-
options,
|
|
182
|
-
});
|
|
183
|
-
const isLast = versionName === lastVersionName;
|
|
184
|
-
// retro-compatible values
|
|
185
|
-
const defaultVersionLabel = versionName === constants_1.CURRENT_VERSION_NAME ? 'Next' : versionName;
|
|
186
|
-
function getDefaultVersionPathPart() {
|
|
187
|
-
if (isLast) {
|
|
188
|
-
return '';
|
|
189
|
-
}
|
|
190
|
-
return versionName === constants_1.CURRENT_VERSION_NAME ? 'next' : versionName;
|
|
191
|
-
}
|
|
192
|
-
const defaultVersionPathPart = getDefaultVersionPathPart();
|
|
193
|
-
const versionOptions = (_a = options.versions[versionName]) !== null && _a !== void 0 ? _a : {};
|
|
194
|
-
const versionLabel = (_b = versionOptions.label) !== null && _b !== void 0 ? _b : defaultVersionLabel;
|
|
195
|
-
const versionPathPart = (_c = versionOptions.path) !== null && _c !== void 0 ? _c : defaultVersionPathPart;
|
|
196
|
-
const versionPath = utils_1.normalizeUrl([
|
|
197
|
-
context.baseUrl,
|
|
198
|
-
options.routeBasePath,
|
|
199
|
-
versionPathPart,
|
|
200
|
-
]);
|
|
201
|
-
const versionEditUrls = getVersionEditUrls({
|
|
202
|
-
contentPath,
|
|
203
|
-
contentPathLocalized,
|
|
204
|
-
context,
|
|
205
|
-
options,
|
|
206
|
-
});
|
|
207
|
-
// Because /docs/:route` should always be after `/docs/versionName/:route`.
|
|
208
|
-
const routePriority = versionPathPart === '' ? -1 : undefined;
|
|
209
|
-
return {
|
|
210
|
-
versionName,
|
|
211
|
-
versionLabel,
|
|
212
|
-
versionPath,
|
|
213
|
-
versionEditUrl: versionEditUrls === null || versionEditUrls === void 0 ? void 0 : versionEditUrls.versionEditUrl,
|
|
214
|
-
versionEditUrlLocalized: versionEditUrls === null || versionEditUrls === void 0 ? void 0 : versionEditUrls.versionEditUrlLocalized,
|
|
215
|
-
versionBanner: getVersionBanner({
|
|
216
|
-
versionName,
|
|
217
|
-
versionNames,
|
|
218
|
-
lastVersionName,
|
|
219
|
-
options,
|
|
220
|
-
}),
|
|
221
|
-
isLast,
|
|
222
|
-
routePriority,
|
|
223
|
-
sidebarFilePath,
|
|
224
|
-
contentPath,
|
|
225
|
-
contentPathLocalized,
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
function checkVersionMetadataPaths({ versionMetadata, context, }) {
|
|
229
|
-
const { versionName, contentPath, sidebarFilePath } = versionMetadata;
|
|
230
|
-
const { siteDir } = context;
|
|
231
|
-
const isCurrentVersion = versionName === constants_1.CURRENT_VERSION_NAME;
|
|
232
|
-
if (!fs_extra_1.default.existsSync(contentPath)) {
|
|
233
|
-
throw new Error(`The docs folder does not exist for version "${versionName}". A docs folder is expected to be found at ${path_1.default.relative(siteDir, contentPath)}.`);
|
|
234
|
-
}
|
|
235
|
-
// If the current version defines a path to a sidebar file that does not exist, we throw!
|
|
236
|
-
// Note: for versioned sidebars, the file may not exist (as we prefer to not create it rather than to create an empty file)
|
|
237
|
-
// See https://github.com/facebook/docusaurus/issues/3366
|
|
238
|
-
// See https://github.com/facebook/docusaurus/pull/4775
|
|
239
|
-
if (isCurrentVersion &&
|
|
240
|
-
typeof sidebarFilePath === 'string' &&
|
|
241
|
-
!fs_extra_1.default.existsSync(sidebarFilePath)) {
|
|
242
|
-
throw new Error(`The path to the sidebar file does not exist at "${path_1.default.relative(siteDir, sidebarFilePath)}".
|
|
243
|
-
Please set the docs "sidebarPath" field in your config file to:
|
|
244
|
-
- a sidebars path that exists
|
|
245
|
-
- false: to disable the sidebar
|
|
246
|
-
- undefined: for Docusaurus generates it automatically`);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
// TODO for retrocompatibility with existing behavior
|
|
250
|
-
// We should make this configurable
|
|
251
|
-
// "last version" is not a very good concept nor api surface
|
|
252
|
-
function getDefaultLastVersionName(versionNames) {
|
|
253
|
-
if (versionNames.length === 1) {
|
|
254
|
-
return versionNames[0];
|
|
255
|
-
}
|
|
256
|
-
else {
|
|
257
|
-
return versionNames.filter((versionName) => versionName !== constants_1.CURRENT_VERSION_NAME)[0];
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
function checkVersionsOptions(availableVersionNames, options) {
|
|
261
|
-
const availableVersionNamesMsg = `Available version names are: ${availableVersionNames.join(', ')}`;
|
|
262
|
-
if (options.lastVersion &&
|
|
263
|
-
!availableVersionNames.includes(options.lastVersion)) {
|
|
264
|
-
throw new Error(`Docs option lastVersion=${options.lastVersion} is invalid. ${availableVersionNamesMsg}`);
|
|
265
|
-
}
|
|
266
|
-
const unknownVersionConfigNames = lodash_1.difference(Object.keys(options.versions), availableVersionNames);
|
|
267
|
-
if (unknownVersionConfigNames.length > 0) {
|
|
268
|
-
throw new Error(`Invalid docs option "versions": unknown versions (${unknownVersionConfigNames.join(',')}) found. ${availableVersionNamesMsg}`);
|
|
269
|
-
}
|
|
270
|
-
if (options.onlyIncludeVersions) {
|
|
271
|
-
if (options.onlyIncludeVersions.length === 0) {
|
|
272
|
-
throw new Error(`Invalid docs option "onlyIncludeVersions": an empty array is not allowed, at least one version is needed.`);
|
|
273
|
-
}
|
|
274
|
-
const unknownOnlyIncludeVersionNames = lodash_1.difference(options.onlyIncludeVersions, availableVersionNames);
|
|
275
|
-
if (unknownOnlyIncludeVersionNames.length > 0) {
|
|
276
|
-
throw new Error(`Invalid docs option "onlyIncludeVersions": unknown versions (${unknownOnlyIncludeVersionNames.join(',')}) found. ${availableVersionNamesMsg}`);
|
|
277
|
-
}
|
|
278
|
-
if (options.lastVersion &&
|
|
279
|
-
!options.onlyIncludeVersions.includes(options.lastVersion)) {
|
|
280
|
-
throw new Error(`Invalid docs option "lastVersion": if you use both the "onlyIncludeVersions" and "lastVersion" options, then "lastVersion" must be present in the provided "onlyIncludeVersions" array.`);
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
// Filter versions according to provided options
|
|
285
|
-
// Note: we preserve the order in which versions are provided
|
|
286
|
-
// the order of the onlyIncludeVersions array does not matter
|
|
287
|
-
function filterVersions(versionNamesUnfiltered, options) {
|
|
288
|
-
if (options.onlyIncludeVersions) {
|
|
289
|
-
return versionNamesUnfiltered.filter((name) => (options.onlyIncludeVersions || []).includes(name));
|
|
290
|
-
}
|
|
291
|
-
else {
|
|
292
|
-
return versionNamesUnfiltered;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
// TODO make this async (requires plugin init to be async)
|
|
296
|
-
function readVersionsMetadata({ context, options, }) {
|
|
297
|
-
var _a;
|
|
298
|
-
const versionNamesUnfiltered = readVersionNames(context.siteDir, options);
|
|
299
|
-
checkVersionsOptions(versionNamesUnfiltered, options);
|
|
300
|
-
const versionNames = filterVersions(versionNamesUnfiltered, options);
|
|
301
|
-
const lastVersionName = (_a = options.lastVersion) !== null && _a !== void 0 ? _a : getDefaultLastVersionName(versionNames);
|
|
302
|
-
const versionsMetadata = versionNames.map((versionName) => createVersionMetadata({
|
|
303
|
-
versionName,
|
|
304
|
-
versionNames,
|
|
305
|
-
lastVersionName,
|
|
306
|
-
context,
|
|
307
|
-
options,
|
|
308
|
-
}));
|
|
309
|
-
versionsMetadata.forEach((versionMetadata) => checkVersionMetadataPaths({ versionMetadata, context }));
|
|
310
|
-
return versionsMetadata;
|
|
311
|
-
}
|
|
312
|
-
exports.readVersionsMetadata = readVersionsMetadata;
|
|
313
|
-
// order matter!
|
|
314
|
-
// Read in priority the localized path, then the unlocalized one
|
|
315
|
-
// We want the localized doc to "override" the unlocalized one
|
|
316
|
-
function getDocsDirPaths(versionMetadata) {
|
|
317
|
-
return [versionMetadata.contentPathLocalized, versionMetadata.contentPath];
|
|
318
|
-
}
|
|
319
|
-
exports.getDocsDirPaths = getDocsDirPaths;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
module.exports = {
|
|
9
|
-
title: 'My Site',
|
|
10
|
-
tagline: 'The tagline of my site',
|
|
11
|
-
url: 'https://your-docusaurus-test-site.com',
|
|
12
|
-
baseUrl: '/',
|
|
13
|
-
favicon: 'img/favicon.ico',
|
|
14
|
-
organizationName: 'facebook', // Usually your GitHub org/user name.
|
|
15
|
-
projectName: 'docusaurus', // Usually your repo name.
|
|
16
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
module.exports = {
|
|
9
|
-
docs: [
|
|
10
|
-
{
|
|
11
|
-
'level 1': [
|
|
12
|
-
'a',
|
|
13
|
-
{
|
|
14
|
-
'level 2': [
|
|
15
|
-
{
|
|
16
|
-
'level 3': [
|
|
17
|
-
'c',
|
|
18
|
-
{
|
|
19
|
-
'level 4': [
|
|
20
|
-
'd',
|
|
21
|
-
{
|
|
22
|
-
'deeper more more': ['e'],
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
'f',
|
|
29
|
-
],
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
module.exports = {
|
|
9
|
-
docs: [
|
|
10
|
-
{
|
|
11
|
-
type: 'category',
|
|
12
|
-
label: 'level 1',
|
|
13
|
-
items: [
|
|
14
|
-
'a',
|
|
15
|
-
{
|
|
16
|
-
type: 'category',
|
|
17
|
-
label: 'level 2',
|
|
18
|
-
items: [
|
|
19
|
-
{
|
|
20
|
-
type: 'category',
|
|
21
|
-
label: 'level 3',
|
|
22
|
-
items: [
|
|
23
|
-
'c',
|
|
24
|
-
{
|
|
25
|
-
type: 'category',
|
|
26
|
-
label: 'level 4',
|
|
27
|
-
items: [
|
|
28
|
-
'd',
|
|
29
|
-
{
|
|
30
|
-
type: 'category',
|
|
31
|
-
label: 'deeper more more',
|
|
32
|
-
items: ['e'],
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
},
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
'f',
|
|
39
|
-
],
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"docs": [
|
|
3
|
-
{
|
|
4
|
-
"type": "category",
|
|
5
|
-
"label": "Introduction",
|
|
6
|
-
"items": [
|
|
7
|
-
"doc1"
|
|
8
|
-
],
|
|
9
|
-
"collapsed": false
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"type": "category",
|
|
13
|
-
"label": "Powering MDX",
|
|
14
|
-
"items": [
|
|
15
|
-
"doc2"
|
|
16
|
-
],
|
|
17
|
-
"collapsed": false
|
|
18
|
-
}
|
|
19
|
-
]
|
|
20
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"docs": {
|
|
3
|
-
"Test": [
|
|
4
|
-
{
|
|
5
|
-
"type": "category",
|
|
6
|
-
"label": "Introduction",
|
|
7
|
-
"items": ["doc1"],
|
|
8
|
-
"collapsed": false
|
|
9
|
-
}
|
|
10
|
-
],
|
|
11
|
-
"Reference": [
|
|
12
|
-
{
|
|
13
|
-
"type": "category",
|
|
14
|
-
"label": "Powering MDX",
|
|
15
|
-
"items": ["doc2"],
|
|
16
|
-
"collapsed": false
|
|
17
|
-
}
|
|
18
|
-
]
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|