mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-13 16:23:34 +02:00
refactor: unify how validateOptions is handled (#6961)
* refactor: unify how validateOptions is handled * fix types * fix again
This commit is contained in:
parent
44107fb879
commit
6e2eb44964
43 changed files with 542 additions and 540 deletions
|
@ -21,15 +21,9 @@ import {
|
|||
DEFAULT_PLUGIN_ID,
|
||||
parseMarkdownString,
|
||||
} from '@docusaurus/utils';
|
||||
import type {
|
||||
LoadContext,
|
||||
Plugin,
|
||||
OptionValidationContext,
|
||||
ValidationResult,
|
||||
} from '@docusaurus/types';
|
||||
import type {LoadContext, Plugin} from '@docusaurus/types';
|
||||
import admonitions from 'remark-admonitions';
|
||||
import {PluginOptionSchema} from './pluginOptionSchema';
|
||||
import {validatePageFrontMatter} from './pageFrontMatter';
|
||||
import {validatePageFrontMatter} from './frontMatter';
|
||||
|
||||
import type {LoadedContent, PagesContentPaths} from './types';
|
||||
import type {PluginOptions, Metadata} from '@docusaurus/plugin-content-pages';
|
||||
|
@ -176,7 +170,7 @@ export default async function pluginContentPages(
|
|||
);
|
||||
},
|
||||
|
||||
configureWebpack(_config, isServer, {getJSLoader}) {
|
||||
configureWebpack(config, isServer, {getJSLoader}) {
|
||||
const {
|
||||
rehypePlugins,
|
||||
remarkPlugins,
|
||||
|
@ -241,10 +235,4 @@ export default async function pluginContentPages(
|
|||
};
|
||||
}
|
||||
|
||||
export function validateOptions({
|
||||
validate,
|
||||
options,
|
||||
}: OptionValidationContext<PluginOptions>): ValidationResult<PluginOptions> {
|
||||
const validatedOptions = validate(PluginOptionSchema, options);
|
||||
return validatedOptions;
|
||||
}
|
||||
export {validateOptions} from './options';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue