@docusaurus/plugin-content-docs 2.0.0-rc.1 → 2.1.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/options.js +1 -0
- package/lib/props.js +1 -0
- package/lib/sidebars/types.d.ts +1 -0
- package/lib/sidebars/validation.js +1 -0
- package/lib/versions/index.d.ts +1 -0
- package/lib/versions/index.js +6 -1
- package/package.json +9 -10
- package/src/options.ts +1 -0
- package/src/plugin-content-docs.d.ts +23 -18
- package/src/props.ts +1 -0
- package/src/sidebars/types.ts +1 -0
- package/src/sidebars/validation.ts +1 -0
- package/src/versions/index.ts +8 -0
package/lib/options.js
CHANGED
|
@@ -49,6 +49,7 @@ const VersionOptionsSchema = utils_validation_1.Joi.object({
|
|
|
49
49
|
banner: utils_validation_1.Joi.string().equal('none', 'unreleased', 'unmaintained').optional(),
|
|
50
50
|
badge: utils_validation_1.Joi.boolean().optional(),
|
|
51
51
|
className: utils_validation_1.Joi.string().optional(),
|
|
52
|
+
noIndex: utils_validation_1.Joi.boolean().optional(),
|
|
52
53
|
});
|
|
53
54
|
const VersionsOptionsSchema = utils_validation_1.Joi.object()
|
|
54
55
|
.pattern(utils_validation_1.Joi.string().required(), VersionOptionsSchema)
|
package/lib/props.js
CHANGED
|
@@ -98,6 +98,7 @@ function toVersionMetadataProp(pluginId, loadedVersion) {
|
|
|
98
98
|
label: loadedVersion.label,
|
|
99
99
|
banner: loadedVersion.banner,
|
|
100
100
|
badge: loadedVersion.badge,
|
|
101
|
+
noIndex: loadedVersion.noIndex,
|
|
101
102
|
className: loadedVersion.className,
|
|
102
103
|
isLast: loadedVersion.isLast,
|
|
103
104
|
docsSidebars: toSidebarsProp(loadedVersion),
|
package/lib/sidebars/types.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ const sidebarItemHtmlSchema = sidebarItemBaseSchema.append({
|
|
|
36
36
|
const sidebarItemLinkSchema = sidebarItemBaseSchema.append({
|
|
37
37
|
type: 'link',
|
|
38
38
|
href: utils_validation_1.URISchema.required(),
|
|
39
|
+
autoAddBaseUrl: utils_validation_1.Joi.boolean(),
|
|
39
40
|
label: utils_validation_1.Joi.string()
|
|
40
41
|
.required()
|
|
41
42
|
.messages({ 'any.unknown': '"label" must be a string' }),
|
package/lib/versions/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export declare type VersionContext = {
|
|
|
23
23
|
export declare function getDefaultVersionBanner({ versionName, versionNames, lastVersionName, }: VersionContext): VersionBanner | null;
|
|
24
24
|
export declare function getVersionBanner(context: VersionContext): VersionMetadata['banner'];
|
|
25
25
|
export declare function getVersionBadge({ versionName, versionNames, options, }: VersionContext): VersionMetadata['badge'];
|
|
26
|
+
export declare function getVersionNoIndex({ versionName, options, }: VersionContext): VersionMetadata['noIndex'];
|
|
26
27
|
/**
|
|
27
28
|
* Filter versions according to provided options (i.e. `onlyIncludeVersions`).
|
|
28
29
|
*
|
package/lib/versions/index.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.readVersionsMetadata = exports.filterVersions = exports.getVersionBadge = exports.getVersionBanner = exports.getDefaultVersionBanner = void 0;
|
|
9
|
+
exports.readVersionsMetadata = exports.filterVersions = exports.getVersionNoIndex = exports.getVersionBadge = exports.getVersionBanner = exports.getDefaultVersionBanner = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
12
12
|
const utils_1 = require("@docusaurus/utils");
|
|
@@ -71,6 +71,10 @@ function getVersionBadge({ versionName, versionNames, options, }) {
|
|
|
71
71
|
return options.versions[versionName]?.badge ?? defaultVersionBadge;
|
|
72
72
|
}
|
|
73
73
|
exports.getVersionBadge = getVersionBadge;
|
|
74
|
+
function getVersionNoIndex({ versionName, options, }) {
|
|
75
|
+
return options.versions[versionName]?.noIndex ?? false;
|
|
76
|
+
}
|
|
77
|
+
exports.getVersionNoIndex = getVersionNoIndex;
|
|
74
78
|
function getVersionClassName({ versionName, options, }) {
|
|
75
79
|
const defaultVersionClassName = `docs-version-${versionName}`;
|
|
76
80
|
return options.versions[versionName]?.className ?? defaultVersionClassName;
|
|
@@ -108,6 +112,7 @@ async function createVersionMetadata(context) {
|
|
|
108
112
|
label: getVersionLabel(context),
|
|
109
113
|
banner: getVersionBanner(context),
|
|
110
114
|
badge: getVersionBadge(context),
|
|
115
|
+
noIndex: getVersionNoIndex(context),
|
|
111
116
|
className: getVersionClassName(context),
|
|
112
117
|
path: routePath,
|
|
113
118
|
tagsPath: (0, utils_1.normalizeUrl)([routePath, options.tagsBasePath]),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-content-docs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Docs plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
},
|
|
35
35
|
"license": "MIT",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@docusaurus/core": "2.
|
|
38
|
-
"@docusaurus/logger": "2.
|
|
39
|
-
"@docusaurus/mdx-loader": "2.
|
|
40
|
-
"@docusaurus/module-type-aliases": "2.
|
|
41
|
-
"@docusaurus/types": "2.
|
|
42
|
-
"@docusaurus/utils": "2.
|
|
43
|
-
"@docusaurus/utils-validation": "2.
|
|
37
|
+
"@docusaurus/core": "2.1.0",
|
|
38
|
+
"@docusaurus/logger": "2.1.0",
|
|
39
|
+
"@docusaurus/mdx-loader": "2.1.0",
|
|
40
|
+
"@docusaurus/module-type-aliases": "2.1.0",
|
|
41
|
+
"@docusaurus/types": "2.1.0",
|
|
42
|
+
"@docusaurus/utils": "2.1.0",
|
|
43
|
+
"@docusaurus/utils-validation": "2.1.0",
|
|
44
44
|
"@types/react-router-config": "^5.0.6",
|
|
45
45
|
"combine-promises": "^1.1.0",
|
|
46
46
|
"fs-extra": "^10.1.0",
|
|
@@ -52,7 +52,6 @@
|
|
|
52
52
|
"webpack": "^5.73.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@docusaurus/types": "2.0.0-beta.21",
|
|
56
55
|
"@types/js-yaml": "^4.0.5",
|
|
57
56
|
"@types/picomatch": "^2.3.0",
|
|
58
57
|
"commander": "^5.1.0",
|
|
@@ -67,5 +66,5 @@
|
|
|
67
66
|
"engines": {
|
|
68
67
|
"node": ">=16.14"
|
|
69
68
|
},
|
|
70
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "be9b0942641184213485eba7fd75ceb0b328d3f4"
|
|
71
70
|
}
|
package/src/options.ts
CHANGED
|
@@ -59,6 +59,7 @@ const VersionOptionsSchema = Joi.object({
|
|
|
59
59
|
banner: Joi.string().equal('none', 'unreleased', 'unmaintained').optional(),
|
|
60
60
|
badge: Joi.boolean().optional(),
|
|
61
61
|
className: Joi.string().optional(),
|
|
62
|
+
noIndex: Joi.boolean().optional(),
|
|
62
63
|
});
|
|
63
64
|
|
|
64
65
|
const VersionsOptionsSchema = Joi.object()
|
|
@@ -125,6 +125,25 @@ declare module '@docusaurus/plugin-content-docs' {
|
|
|
125
125
|
// TODO support custom version banner?
|
|
126
126
|
// {type: "error", content: "html content"}
|
|
127
127
|
export type VersionBanner = 'unreleased' | 'unmaintained';
|
|
128
|
+
|
|
129
|
+
export type VersionOptions = {
|
|
130
|
+
/**
|
|
131
|
+
* The base path of the version, will be appended to `baseUrl` +
|
|
132
|
+
* `routeBasePath`.
|
|
133
|
+
*/
|
|
134
|
+
path?: string;
|
|
135
|
+
/** The label of the version to be used in badges, dropdowns, etc. */
|
|
136
|
+
label?: string;
|
|
137
|
+
/** The banner to show at the top of a doc of that version. */
|
|
138
|
+
banner?: 'none' | VersionBanner;
|
|
139
|
+
/** Show a badge with the version label at the top of each doc. */
|
|
140
|
+
badge?: boolean;
|
|
141
|
+
/** Prevents search engines from indexing this version */
|
|
142
|
+
noIndex?: boolean;
|
|
143
|
+
/** Add a custom class name to the <html> element of each doc. */
|
|
144
|
+
className?: string;
|
|
145
|
+
};
|
|
146
|
+
|
|
128
147
|
export type VersionsOptions = {
|
|
129
148
|
/**
|
|
130
149
|
* The version navigated to in priority and displayed by default for docs
|
|
@@ -144,23 +163,7 @@ declare module '@docusaurus/plugin-content-docs' {
|
|
|
144
163
|
/** Include the current version of your docs. */
|
|
145
164
|
includeCurrentVersion: boolean;
|
|
146
165
|
/** Independent customization of each version's properties. */
|
|
147
|
-
versions: {
|
|
148
|
-
[versionName: string]: {
|
|
149
|
-
/**
|
|
150
|
-
* The base path of the version, will be appended to `baseUrl` +
|
|
151
|
-
* `routeBasePath`.
|
|
152
|
-
*/
|
|
153
|
-
path?: string;
|
|
154
|
-
/** The label of the version to be used in badges, dropdowns, etc. */
|
|
155
|
-
label?: string;
|
|
156
|
-
/** The banner to show at the top of a doc of that version. */
|
|
157
|
-
banner?: 'none' | VersionBanner;
|
|
158
|
-
/** Show a badge with the version label at the top of each doc. */
|
|
159
|
-
badge?: boolean;
|
|
160
|
-
/** Add a custom class name to the <html> element of each doc. */
|
|
161
|
-
className?: string;
|
|
162
|
-
};
|
|
163
|
-
};
|
|
166
|
+
versions: {[versionName: string]: VersionOptions};
|
|
164
167
|
};
|
|
165
168
|
export type SidebarOptions = {
|
|
166
169
|
/**
|
|
@@ -263,6 +266,8 @@ declare module '@docusaurus/plugin-content-docs' {
|
|
|
263
266
|
banner: VersionBanner | null;
|
|
264
267
|
/** Show a badge with the version label at the top of each doc. */
|
|
265
268
|
badge: boolean;
|
|
269
|
+
/** Prevents search engines from indexing this version */
|
|
270
|
+
noIndex: boolean;
|
|
266
271
|
/** Add a custom class name to the <html> element of each doc. */
|
|
267
272
|
className: string;
|
|
268
273
|
/**
|
|
@@ -500,7 +505,7 @@ declare module '@docusaurus/plugin-content-docs' {
|
|
|
500
505
|
|
|
501
506
|
export type PropVersionMetadata = Pick<
|
|
502
507
|
VersionMetadata,
|
|
503
|
-
'label' | 'banner' | 'badge' | 'className' | 'isLast'
|
|
508
|
+
'label' | 'banner' | 'badge' | 'className' | 'isLast' | 'noIndex'
|
|
504
509
|
> & {
|
|
505
510
|
/** ID of the docs plugin this version belongs to. */
|
|
506
511
|
pluginId: string;
|
package/src/props.ts
CHANGED
|
@@ -142,6 +142,7 @@ export function toVersionMetadataProp(
|
|
|
142
142
|
label: loadedVersion.label,
|
|
143
143
|
banner: loadedVersion.banner,
|
|
144
144
|
badge: loadedVersion.badge,
|
|
145
|
+
noIndex: loadedVersion.noIndex,
|
|
145
146
|
className: loadedVersion.className,
|
|
146
147
|
isLast: loadedVersion.isLast,
|
|
147
148
|
docsSidebars: toSidebarsProp(loadedVersion),
|
package/src/sidebars/types.ts
CHANGED
|
@@ -59,6 +59,7 @@ const sidebarItemHtmlSchema = sidebarItemBaseSchema.append<SidebarItemHtml>({
|
|
|
59
59
|
const sidebarItemLinkSchema = sidebarItemBaseSchema.append<SidebarItemLink>({
|
|
60
60
|
type: 'link',
|
|
61
61
|
href: URISchema.required(),
|
|
62
|
+
autoAddBaseUrl: Joi.boolean(),
|
|
62
63
|
label: Joi.string()
|
|
63
64
|
.required()
|
|
64
65
|
.messages({'any.unknown': '"label" must be a string'}),
|
package/src/versions/index.ts
CHANGED
|
@@ -122,6 +122,13 @@ export function getVersionBadge({
|
|
|
122
122
|
return options.versions[versionName]?.badge ?? defaultVersionBadge;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
export function getVersionNoIndex({
|
|
126
|
+
versionName,
|
|
127
|
+
options,
|
|
128
|
+
}: VersionContext): VersionMetadata['noIndex'] {
|
|
129
|
+
return options.versions[versionName]?.noIndex ?? false;
|
|
130
|
+
}
|
|
131
|
+
|
|
125
132
|
function getVersionClassName({
|
|
126
133
|
versionName,
|
|
127
134
|
options,
|
|
@@ -179,6 +186,7 @@ async function createVersionMetadata(
|
|
|
179
186
|
label: getVersionLabel(context),
|
|
180
187
|
banner: getVersionBanner(context),
|
|
181
188
|
badge: getVersionBadge(context),
|
|
189
|
+
noIndex: getVersionNoIndex(context),
|
|
182
190
|
className: getVersionClassName(context),
|
|
183
191
|
path: routePath,
|
|
184
192
|
tagsPath: normalizeUrl([routePath, options.tagsBasePath]),
|