@docusaurus/plugin-content-docs 0.0.0-4752 → 0.0.0-4755
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/docs.js +2 -2
- package/lib/{docFrontMatter.d.ts → frontMatter.d.ts} +0 -0
- package/lib/{docFrontMatter.js → frontMatter.js} +0 -0
- package/lib/options.d.ts +3 -5
- package/lib/options.js +4 -3
- package/package.json +9 -9
- package/src/docs.ts +1 -1
- package/src/{docFrontMatter.ts → frontMatter.ts} +0 -0
- package/src/options.ts +6 -8
package/lib/docs.js
CHANGED
|
@@ -17,7 +17,7 @@ const slug_1 = tslib_1.__importDefault(require("./slug"));
|
|
|
17
17
|
const constants_1 = require("./constants");
|
|
18
18
|
const versions_1 = require("./versions");
|
|
19
19
|
const numberPrefix_1 = require("./numberPrefix");
|
|
20
|
-
const
|
|
20
|
+
const frontMatter_1 = require("./frontMatter");
|
|
21
21
|
const utils_2 = require("./sidebars/utils");
|
|
22
22
|
async function readLastUpdateData(filePath, options) {
|
|
23
23
|
const { showLastUpdateAuthor, showLastUpdateTime } = options;
|
|
@@ -61,7 +61,7 @@ function doProcessDocMetadata({ docFile, versionMetadata, context, options, }) {
|
|
|
61
61
|
const { source, content, lastUpdate, contentPath, filePath } = docFile;
|
|
62
62
|
const { siteDir, i18n } = context;
|
|
63
63
|
const { frontMatter: unsafeFrontMatter, contentTitle, excerpt, } = (0, utils_1.parseMarkdownString)(content);
|
|
64
|
-
const frontMatter = (0,
|
|
64
|
+
const frontMatter = (0, frontMatter_1.validateDocFrontMatter)(unsafeFrontMatter);
|
|
65
65
|
const { custom_edit_url: customEditURL,
|
|
66
66
|
// Strip number prefixes by default
|
|
67
67
|
// (01-MyFolder/01-MyDoc.md => MyFolder/MyDoc)
|
|
File without changes
|
|
File without changes
|
package/lib/options.d.ts
CHANGED
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import type { PluginOptions } from '@docusaurus/plugin-content-docs';
|
|
8
|
-
import {
|
|
9
|
-
import type { OptionValidationContext, ValidationResult } from '@docusaurus/types';
|
|
7
|
+
import type { PluginOptions, Options } from '@docusaurus/plugin-content-docs';
|
|
8
|
+
import type { OptionValidationContext } from '@docusaurus/types';
|
|
10
9
|
export declare const DEFAULT_OPTIONS: Omit<PluginOptions, 'id' | 'sidebarPath'>;
|
|
11
|
-
export declare
|
|
12
|
-
export declare function validateOptions({ validate, options: userOptions, }: OptionValidationContext<PluginOptions>): ValidationResult<PluginOptions>;
|
|
10
|
+
export declare function validateOptions({ validate, options: userOptions, }: OptionValidationContext<Options, PluginOptions>): PluginOptions;
|
package/lib/options.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.validateOptions = exports.
|
|
9
|
+
exports.validateOptions = exports.DEFAULT_OPTIONS = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const utils_validation_1 = require("@docusaurus/utils-validation");
|
|
12
12
|
const utils_1 = require("@docusaurus/utils");
|
|
@@ -54,7 +54,7 @@ const VersionOptionsSchema = utils_validation_1.Joi.object({
|
|
|
54
54
|
const VersionsOptionsSchema = utils_validation_1.Joi.object()
|
|
55
55
|
.pattern(utils_validation_1.Joi.string().required(), VersionOptionsSchema)
|
|
56
56
|
.default(exports.DEFAULT_OPTIONS.versions);
|
|
57
|
-
|
|
57
|
+
const OptionsSchema = utils_validation_1.Joi.object({
|
|
58
58
|
path: utils_validation_1.Joi.string().default(exports.DEFAULT_OPTIONS.path),
|
|
59
59
|
editUrl: utils_validation_1.Joi.alternatives().try(utils_validation_1.URISchema, utils_validation_1.Joi.function()),
|
|
60
60
|
editCurrentVersion: utils_validation_1.Joi.boolean().default(exports.DEFAULT_OPTIONS.editCurrentVersion),
|
|
@@ -64,6 +64,7 @@ exports.OptionsSchema = utils_validation_1.Joi.object({
|
|
|
64
64
|
// .allow('') ""
|
|
65
65
|
.default(exports.DEFAULT_OPTIONS.routeBasePath),
|
|
66
66
|
tagsBasePath: utils_validation_1.Joi.string().default(exports.DEFAULT_OPTIONS.tagsBasePath),
|
|
67
|
+
// @ts-expect-error: deprecated
|
|
67
68
|
homePageId: utils_validation_1.Joi.any().forbidden().messages({
|
|
68
69
|
'any.unknown': 'The docs plugin option homePageId is not supported anymore. To make a doc the "home", please add "slug: /" in its front matter. See: https://docusaurus.io/docs/next/docs-introduction#home-page-docs',
|
|
69
70
|
}),
|
|
@@ -121,7 +122,7 @@ function validateOptions({ validate, options: userOptions, }) {
|
|
|
121
122
|
};
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
|
-
const normalizedOptions = validate(
|
|
125
|
+
const normalizedOptions = validate(OptionsSchema, options);
|
|
125
126
|
if (normalizedOptions.admonitions) {
|
|
126
127
|
normalizedOptions.remarkPlugins = normalizedOptions.remarkPlugins.concat([
|
|
127
128
|
[remark_admonitions_1.default, normalizedOptions.admonitions],
|
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-4755",
|
|
4
4
|
"description": "Docs plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@docusaurus/core": "0.0.0-
|
|
27
|
-
"@docusaurus/logger": "0.0.0-
|
|
28
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
29
|
-
"@docusaurus/utils": "0.0.0-
|
|
30
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
26
|
+
"@docusaurus/core": "0.0.0-4755",
|
|
27
|
+
"@docusaurus/logger": "0.0.0-4755",
|
|
28
|
+
"@docusaurus/mdx-loader": "0.0.0-4755",
|
|
29
|
+
"@docusaurus/utils": "0.0.0-4755",
|
|
30
|
+
"@docusaurus/utils-validation": "0.0.0-4755",
|
|
31
31
|
"combine-promises": "^1.1.0",
|
|
32
32
|
"fs-extra": "^10.0.1",
|
|
33
33
|
"import-fresh": "^3.3.0",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"webpack": "^5.70.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
43
|
-
"@docusaurus/types": "0.0.0-
|
|
42
|
+
"@docusaurus/module-type-aliases": "0.0.0-4755",
|
|
43
|
+
"@docusaurus/types": "0.0.0-4755",
|
|
44
44
|
"@types/js-yaml": "^4.0.5",
|
|
45
45
|
"@types/picomatch": "^2.3.0",
|
|
46
46
|
"commander": "^5.1.0",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"engines": {
|
|
57
57
|
"node": ">=14"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "238d7ef1d3e0a56ba5e4ec9f81992a948f4c4945"
|
|
60
60
|
}
|
package/src/docs.ts
CHANGED
|
@@ -34,7 +34,7 @@ import getSlug from './slug';
|
|
|
34
34
|
import {CURRENT_VERSION_NAME} from './constants';
|
|
35
35
|
import {getDocsDirPaths} from './versions';
|
|
36
36
|
import {stripPathNumberPrefixes} from './numberPrefix';
|
|
37
|
-
import {validateDocFrontMatter} from './
|
|
37
|
+
import {validateDocFrontMatter} from './frontMatter';
|
|
38
38
|
import type {SidebarsUtils} from './sidebars/utils';
|
|
39
39
|
import {toDocNavigationLink, toNavigationLink} from './sidebars/utils';
|
|
40
40
|
import type {
|
|
File without changes
|
package/src/options.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type {PluginOptions} from '@docusaurus/plugin-content-docs';
|
|
8
|
+
import type {PluginOptions, Options} from '@docusaurus/plugin-content-docs';
|
|
9
9
|
import {
|
|
10
10
|
Joi,
|
|
11
11
|
RemarkPluginsSchema,
|
|
@@ -15,10 +15,7 @@ import {
|
|
|
15
15
|
} from '@docusaurus/utils-validation';
|
|
16
16
|
import {GlobExcludeDefault} from '@docusaurus/utils';
|
|
17
17
|
|
|
18
|
-
import type {
|
|
19
|
-
OptionValidationContext,
|
|
20
|
-
ValidationResult,
|
|
21
|
-
} from '@docusaurus/types';
|
|
18
|
+
import type {OptionValidationContext} from '@docusaurus/types';
|
|
22
19
|
import logger from '@docusaurus/logger';
|
|
23
20
|
import admonitions from 'remark-admonitions';
|
|
24
21
|
import {DefaultSidebarItemsGenerator} from './sidebars/generator';
|
|
@@ -70,7 +67,7 @@ const VersionsOptionsSchema = Joi.object()
|
|
|
70
67
|
.pattern(Joi.string().required(), VersionOptionsSchema)
|
|
71
68
|
.default(DEFAULT_OPTIONS.versions);
|
|
72
69
|
|
|
73
|
-
|
|
70
|
+
const OptionsSchema = Joi.object<PluginOptions>({
|
|
74
71
|
path: Joi.string().default(DEFAULT_OPTIONS.path),
|
|
75
72
|
editUrl: Joi.alternatives().try(URISchema, Joi.function()),
|
|
76
73
|
editCurrentVersion: Joi.boolean().default(DEFAULT_OPTIONS.editCurrentVersion),
|
|
@@ -80,6 +77,7 @@ export const OptionsSchema = Joi.object({
|
|
|
80
77
|
// .allow('') ""
|
|
81
78
|
.default(DEFAULT_OPTIONS.routeBasePath),
|
|
82
79
|
tagsBasePath: Joi.string().default(DEFAULT_OPTIONS.tagsBasePath),
|
|
80
|
+
// @ts-expect-error: deprecated
|
|
83
81
|
homePageId: Joi.any().forbidden().messages({
|
|
84
82
|
'any.unknown':
|
|
85
83
|
'The docs plugin option homePageId is not supported anymore. To make a doc the "home", please add "slug: /" in its front matter. See: https://docusaurus.io/docs/next/docs-introduction#home-page-docs',
|
|
@@ -146,7 +144,7 @@ export const OptionsSchema = Joi.object({
|
|
|
146
144
|
export function validateOptions({
|
|
147
145
|
validate,
|
|
148
146
|
options: userOptions,
|
|
149
|
-
}: OptionValidationContext<PluginOptions>):
|
|
147
|
+
}: OptionValidationContext<Options, PluginOptions>): PluginOptions {
|
|
150
148
|
let options = userOptions;
|
|
151
149
|
|
|
152
150
|
if (options.sidebarCollapsible === false) {
|
|
@@ -168,7 +166,7 @@ export function validateOptions({
|
|
|
168
166
|
}
|
|
169
167
|
}
|
|
170
168
|
|
|
171
|
-
const normalizedOptions = validate(OptionsSchema, options);
|
|
169
|
+
const normalizedOptions = validate(OptionsSchema, options) as PluginOptions;
|
|
172
170
|
|
|
173
171
|
if (normalizedOptions.admonitions) {
|
|
174
172
|
normalizedOptions.remarkPlugins = normalizedOptions.remarkPlugins.concat([
|