UNPKG

@mui/internal-docs-infra

Version:

MUI Infra - internal documentation creation tools.

24 lines (23 loc) 1.68 kB
/** * Preload keys + dynamic-import factories for CodeHighlighter's heavy functions. * * Shared by `CodeProvider` (which exposes them as lazy context accessors) and * `CodeHighlighterClient` (which speculatively preloads them on first render). * Using the identical `key -> factory` pair on both sides lets `PreloadProvider` * dedupe to a single fetch per page - the speculative preload and the eventual * consumer resolve the same promise. * * The `import()`s are inside the factories, so importing this module is cheap: * the heavy modules (and their transitive deps like jsondiffpatch) only load * when a factory is actually invoked. */ export const PRELOAD_KEY_LOAD_VARIANT = 'docs-infra/loadIsomorphicCodeVariant'; export const PRELOAD_KEY_LOAD_FALLBACK = 'docs-infra/loadCodeFallback'; export const PRELOAD_KEY_COMPUTE_DELTAS = 'docs-infra/computeHastDeltas'; export const loadVariantFactory = async () => (await import("../pipeline/loadIsomorphicCodeVariant/loadIsomorphicCodeVariant.mjs")).loadIsomorphicCodeVariant; export const loadFallbackFactory = async () => (await import("../pipeline/loadIsomorphicCodeVariant/loadCodeFallback.mjs")).loadCodeFallback; export const computeHastDeltasFactory = async () => (await import("../pipeline/loadIsomorphicCodeVariant/computeHastDeltas.mjs")).computeHastDeltas; export const PRELOAD_KEY_EDITING = 'docs-infra/editingEngine'; export const editingEngineFactory = async () => import("../useCode/EditingEngine.mjs"); export const PRELOAD_KEY_TRANSFORM_ENGINE = 'docs-infra/transformEngine'; export const transformEngineFactory = async () => (await import("../useCode/TransformEngine.mjs")).createTransformedFiles;