mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-25 20:48:50 +02:00
feat(core, mdx-loader): deduplicate MDX compilation - siteConfig.future.experimental_faster.mdxCrossCompilerCache
(#10479)
This commit is contained in:
parent
897ebbe3ca
commit
5bab0b5432
18 changed files with 333 additions and 151 deletions
|
@ -13,6 +13,7 @@ import {
|
|||
getFileCommitDate,
|
||||
LAST_UPDATE_FALLBACK,
|
||||
} from '@docusaurus/utils';
|
||||
import {DEFAULT_FUTURE_CONFIG} from '@docusaurus/core/src/server/configValidation';
|
||||
import pluginContentBlog from '../index';
|
||||
import {validateOptions} from '../options';
|
||||
import type {
|
||||
|
@ -106,7 +107,7 @@ const getPlugin = async (
|
|||
baseUrl: '/',
|
||||
url: 'https://docusaurus.io',
|
||||
markdown,
|
||||
future: {},
|
||||
future: DEFAULT_FUTURE_CONFIG,
|
||||
staticDirectories: ['static'],
|
||||
} as DocusaurusConfig;
|
||||
return pluginContentBlog(
|
||||
|
|
|
@ -21,10 +21,7 @@ import {
|
|||
resolveMarkdownLinkPathname,
|
||||
} from '@docusaurus/utils';
|
||||
import {getTagsFilePathsToWatch} from '@docusaurus/utils-validation';
|
||||
import {
|
||||
createMDXLoaderItem,
|
||||
type Options as MDXLoaderOptions,
|
||||
} from '@docusaurus/mdx-loader';
|
||||
import {createMDXLoaderItem} from '@docusaurus/mdx-loader';
|
||||
import {
|
||||
getBlogTags,
|
||||
paginateBlogPosts,
|
||||
|
@ -114,7 +111,9 @@ export default async function pluginContentBlog(
|
|||
|
||||
const contentDirs = getContentPathList(contentPaths);
|
||||
|
||||
const loaderOptions: MDXLoaderOptions = {
|
||||
const mdxLoaderItem = await createMDXLoaderItem({
|
||||
useCrossCompilerCache:
|
||||
siteConfig.future.experimental_faster.mdxCrossCompilerCache,
|
||||
admonitions,
|
||||
remarkPlugins,
|
||||
rehypePlugins,
|
||||
|
@ -168,7 +167,7 @@ export default async function pluginContentBlog(
|
|||
}
|
||||
return permalink;
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
function createBlogMarkdownLoader(): RuleSetUseItem {
|
||||
const markdownLoaderOptions: BlogMarkdownLoaderOptions = {
|
||||
|
@ -185,10 +184,7 @@ export default async function pluginContentBlog(
|
|||
include: contentDirs
|
||||
// Trailing slash is important, see https://github.com/facebook/docusaurus/pull/3970
|
||||
.map(addTrailingPathSeparator),
|
||||
use: [
|
||||
await createMDXLoaderItem(loaderOptions),
|
||||
createBlogMarkdownLoader(),
|
||||
],
|
||||
use: [mdxLoaderItem, createBlogMarkdownLoader()],
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue