@mui/internal-docs-infra
Version:
MUI Infra - internal documentation creation tools.
71 lines • 3.23 kB
text/typescript
import type { LoaderContext } from 'webpack';
import type { FormatInlineTypeOptions, DescriptionReplacement } from "../loadServerTypesMeta/format.mjs";
import type { SyncPageIndexBaseOptions } from "../transformMarkdownMetadata/types.mjs";
import type { OrderingConfig } from "../loadServerTypesText/order.mjs";
import type { TransformHtmlCodeBlockOptions } from "../transformHtmlCodeBlock/transformHtmlCodeBlock.mjs";
export type LoaderOptions = {
/** Performance tracking and logging options */
performance?: {
/** Enable detailed performance logging */
logging?: boolean;
/** Only log operations exceeding this threshold in milliseconds */
notableMs?: number;
/** Show wrapper measurements in performance logs */
showWrapperMeasures?: boolean;
/** Threshold for notable dependency counts */
significantDependencyCountThreshold?: number;
};
/** Options for formatting types in tables */
formatting?: FormatInlineTypeOptions;
/**
* Directory path for socket and lock files used for IPC between workers.
* Useful for Windows where the default temp directory may not support Unix domain sockets.
* @example '.next/docs-infra'
*/
socketDir?: string;
/**
* Options for updating the parent index page with component metadata.
* When provided, will call syncPageIndex to update the parent directory's page.mdx
* with props, dataAttributes, and cssVariables extracted from the component types.
*/
updateParentIndex?: SyncPageIndexBaseOptions & {
/**
* Name of the index file to update.
* @default 'page.mdx'
*/
indexFileName?: string;
};
/**
* Optional regex pattern to filter which external types to include.
* External types are named union types (like `Orientation = 'horizontal' | 'vertical'`)
* that are referenced in props but not exported from the component's module.
*
* When not provided, ALL qualifying named union types (unions of literals) will be
* collected automatically. This is the recommended behavior.
*
* When provided, only external types whose names match this pattern will be collected.
* @example '^(Orientation|Side|Align)$'
*/
externalTypesPattern?: string;
/** Custom ordering configuration for sorting props, data attributes, exports, etc. */
ordering?: OrderingConfig;
/**
* Pattern/replacement pairs to apply to JSDoc descriptions.
* Each entry has a `pattern` (regex string) and `replacement` string.
*/
descriptionReplacements?: DescriptionReplacement[];
/** Options for code blocks highlighted inside generated type metadata */
codeBlockEmphasisOptions?: TransformHtmlCodeBlockOptions;
};
/**
* Webpack loader that processes types and precomputes meta.
*
* Finds createTypesMeta calls, loads and processes all component types,
* then injects the precomputed type meta back into the source.
*
* Supports single component syntax: createTypesMeta(import.meta.url, Component)
* And object syntax: createTypesMeta(import.meta.url, { Component1, Component2 })
*
* Automatically skips processing if skipPrecompute: true is set.
*/
export declare function loadPrecomputedTypes(this: LoaderContext<LoaderOptions>, source: string): Promise<void>;