mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-06 10:20:09 +02:00
feat: new Rsdoctor official plugin (#10588)
This commit is contained in:
parent
f6a6ca899f
commit
24716787d3
12 changed files with 331 additions and 54 deletions
34
packages/docusaurus-plugin-rsdoctor/src/options.ts
Normal file
34
packages/docusaurus-plugin-rsdoctor/src/options.ts
Normal file
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import {Joi} from '@docusaurus/utils-validation';
|
||||
import type {OptionValidationContext} from '@docusaurus/types';
|
||||
|
||||
export type PluginOptions = {
|
||||
rsdoctorOptions: Record<string, unknown>;
|
||||
};
|
||||
|
||||
export type Options = {
|
||||
rsdoctorOptions?: Record<string, unknown>;
|
||||
};
|
||||
|
||||
export const DEFAULT_OPTIONS: Partial<PluginOptions> = {
|
||||
rsdoctorOptions: {},
|
||||
};
|
||||
|
||||
const pluginOptionsSchema = Joi.object<PluginOptions>({
|
||||
rsdoctorOptions: Joi.object()
|
||||
.pattern(Joi.string(), Joi.any())
|
||||
.optional()
|
||||
.default(DEFAULT_OPTIONS.rsdoctorOptions),
|
||||
}).default(DEFAULT_OPTIONS);
|
||||
|
||||
export function validateOptions({
|
||||
validate,
|
||||
options,
|
||||
}: OptionValidationContext<Options | undefined, PluginOptions>): PluginOptions {
|
||||
return validate(pluginOptionsSchema, options);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue