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

@ -98,7 +98,11 @@ export {
createMatcher,
createAbsoluteFilePathMatcher,
} from './globUtils';
export {getFileLoaderUtils} from './webpackUtils';
export {
getFileLoaderUtils,
getWebpackLoaderCompilerName,
type WebpackCompilerName,
} from './webpackUtils';
export {escapeShellArg} from './shellUtils';
export {loadFreshModule} from './moduleUtils';
export {

View file

@ -11,7 +11,25 @@ import {
WEBPACK_URL_LOADER_LIMIT,
OUTPUT_STATIC_ASSETS_DIR_NAME,
} from './constants';
import type {RuleSetRule} from 'webpack';
import type {RuleSetRule, LoaderContext} from 'webpack';
export type WebpackCompilerName = 'server' | 'client';
export function getWebpackLoaderCompilerName(
context: LoaderContext<unknown>,
): WebpackCompilerName {
// eslint-disable-next-line no-underscore-dangle
const compilerName = context._compiler?.name;
switch (compilerName) {
case 'server':
case 'client':
return compilerName;
default:
throw new Error(
`Cannot get valid Docusaurus webpack compiler name. Found compilerName=${compilerName}`,
);
}
}
type AssetFolder = 'images' | 'files' | 'fonts' | 'medias';