feat(mdx-loader): Remark plugin to report unused MDX / Markdown directives (#9394)

Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
This commit is contained in:
ozaki 2023-10-24 16:15:49 +02:00 committed by GitHub
parent 56cc8e8ffa
commit c6762a2542
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 506 additions and 26 deletions

View file

@ -11,6 +11,7 @@ import {
parseFrontMatter,
escapePath,
getFileLoaderUtils,
getWebpackLoaderCompilerName,
} from '@docusaurus/utils';
import stringifyObject from 'stringify-object';
import preprocessor from './preprocessor';
@ -134,10 +135,12 @@ export async function mdxLoader(
this: LoaderContext<Options>,
fileString: string,
): Promise<void> {
const compilerName = getWebpackLoaderCompilerName(this);
const callback = this.async();
const filePath = this.resourcePath;
const reqOptions: Options = this.getOptions();
const {query} = this;
ensureMarkdownConfig(reqOptions);
const {frontMatter} = parseFrontMatter(fileString);
@ -165,6 +168,7 @@ export async function mdxLoader(
content: preprocessedContent,
filePath,
frontMatter,
compilerName,
});
} catch (errorUnknown) {
const error = errorUnknown as Error;