mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-01 18:32:52 +02:00
perf(mdx-loader): cache mdx/remark compiler instances (#4997)
* (mdx-loader) only create mdx compiler once per webpack config * type fixes * fix path * remove assertion * docs: add missing Tab/TabItem imports * fixup Co-authored-by: slorber <lorber.sebastien@gmail.com> Co-authored-by: Josh-Cena <sidachen2003@gmail.com>
This commit is contained in:
parent
bb55586c20
commit
949a72e6a5
3 changed files with 61 additions and 45 deletions
22
packages/docusaurus-mdx-loader/src/deps.d.ts
vendored
22
packages/docusaurus-mdx-loader/src/deps.d.ts
vendored
|
@ -10,19 +10,17 @@ declare module '@mdx-js/mdx' {
|
|||
import type {Processor} from 'unified';
|
||||
import type {RemarkOrRehypePlugin} from '@docusaurus/mdx-loader';
|
||||
|
||||
namespace mdx {
|
||||
interface Options {
|
||||
filepath?: string;
|
||||
skipExport?: boolean;
|
||||
wrapExport?: string;
|
||||
remarkPlugins?: RemarkOrRehypePlugin[];
|
||||
rehypePlugins?: RemarkOrRehypePlugin[];
|
||||
}
|
||||
|
||||
function sync(content: string, options?: Options): string;
|
||||
function createMdxAstCompiler(options?: Options): Processor;
|
||||
function createCompiler(options?: Options): Processor;
|
||||
export interface Options {
|
||||
filepath?: string;
|
||||
skipExport?: boolean;
|
||||
wrapExport?: string;
|
||||
remarkPlugins?: RemarkOrRehypePlugin[];
|
||||
rehypePlugins?: RemarkOrRehypePlugin[];
|
||||
}
|
||||
|
||||
export function sync(content: string, options?: Options): string;
|
||||
export function createMdxAstCompiler(options?: Options): Processor;
|
||||
export function createCompiler(options?: Options): Processor;
|
||||
export default function mdx(
|
||||
content: string,
|
||||
options?: mdx.Options,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue