fix: type error in mdx defaults
This commit is contained in:
parent
4226b03579
commit
5fce7a2819
2 changed files with 12 additions and 6 deletions
|
@ -66,11 +66,11 @@ export default function mdx(partialMdxOptions: Partial<MdxOptions> = {}): Integr
|
|||
});
|
||||
|
||||
const extendMarkdownConfig =
|
||||
partialMdxOptions.extendMarkdownConfig ?? defaultOptions.extendMarkdownConfig;
|
||||
partialMdxOptions.extendMarkdownConfig ?? defaultMdxOptions.extendMarkdownConfig;
|
||||
|
||||
const mdxOptions = applyDefaultOptions({
|
||||
options: partialMdxOptions,
|
||||
defaults: extendMarkdownConfig ? config.markdown : defaultOptions,
|
||||
defaults: withDefaultMdxOptions(extendMarkdownConfig ? config.markdown : markdownConfigDefaults),
|
||||
});
|
||||
|
||||
const mdxPluginOpts: MdxRollupPluginOptions = {
|
||||
|
@ -185,14 +185,20 @@ export default function mdx(partialMdxOptions: Partial<MdxOptions> = {}): Integr
|
|||
};
|
||||
}
|
||||
|
||||
const defaultOptions: MdxOptions = {
|
||||
...markdownConfigDefaults,
|
||||
const defaultMdxOptions = {
|
||||
extendMarkdownConfig: true,
|
||||
recmaPlugins: [],
|
||||
remarkPlugins: [],
|
||||
rehypePlugins: [],
|
||||
remarkRehype: {},
|
||||
}
|
||||
|
||||
function withDefaultMdxOptions(markdownConfig: typeof markdownConfigDefaults): MdxOptions {
|
||||
return {
|
||||
...markdownConfig,
|
||||
...defaultMdxOptions,
|
||||
};
|
||||
}
|
||||
|
||||
function applyDefaultOptions({
|
||||
options,
|
||||
|
|
|
@ -179,7 +179,7 @@ export function getRehypePlugins(mdxOptions: MdxOptions): MdxRollupPluginOptions
|
|||
return rehypePlugins;
|
||||
}
|
||||
|
||||
function ignoreStringPlugins(plugins: any[]) {
|
||||
function ignoreStringPlugins(plugins: any[]): PluggableList {
|
||||
let validPlugins: PluggableList = [];
|
||||
let hasInvalidPlugin = false;
|
||||
for (const plugin of plugins) {
|
||||
|
|
Loading…
Reference in a new issue