mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 07:37:19 +02:00
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:
parent
56cc8e8ffa
commit
c6762a2542
19 changed files with 506 additions and 26 deletions
|
@ -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 {
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue