feat: new Rsdoctor official plugin (#10588)

This commit is contained in:
Sébastien Lorber 2024-10-17 17:20:06 +02:00 committed by GitHub
parent f6a6ca899f
commit 24716787d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 331 additions and 54 deletions

View 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);
}