UNPKG

@mui/internal-docs-infra

Version:

MUI Infra - internal documentation creation tools.

75 lines 3.29 kB
import type { FormatInlineTypeOptions, DescriptionReplacement } from "../loadServerTypesMeta/format.mjs"; import type { OrderingConfig } from "../loadServerTypesText/order.mjs"; import type { SyncPageIndexBaseOptions } from "../transformMarkdownMetadata/types.mjs"; import type { TypesSourceData } from "../loadServerTypesText/index.mjs"; export interface SyncTypesOptions { /** Absolute path to the types.md file to generate */ typesMarkdownPath: string; /** Root context directory (workspace root) */ rootContext: string; /** * Map of variant name to file path (relative or package path). * For single component: `{ Default: './Component' }` * For multiple: `{ CssModules: './css-modules/Component', Tailwind: './tailwind/Component' }` */ variants?: Record<string, string>; /** * When true, resolves library paths to their source files for watching. * Useful during development to watch the original source rather than built files. */ watchSourceDirectly?: boolean; /** Options for formatting types in tables */ formattingOptions?: 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. */ socketDir?: string; /** Enable performance logging */ performanceLogging?: boolean; /** * 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. * * These options are passed through to syncPageIndex. */ updateParentIndex?: SyncPageIndexBaseOptions & { /** * Name of the index file to update. * @default 'page.mdx' */ indexFileName?: string; }; /** * Optional regex pattern string 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 for most projects. * * When provided, only external types whose names match this pattern will be collected. * * @example undefined // Collect all qualifying external types (recommended) * @example '^(Orientation|Alignment|Side)$' // Only include specific types */ 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[]; } /** * Syncs types for a component/hook/function. * - Loads and formats types via loadServerTypesMeta * - Generates markdown documentation * - Writes markdown to disk * - Updates parent index page (if configured) * * This is separated from the webpack loader to allow reuse in other contexts. */ export declare function syncTypes(options: SyncTypesOptions): Promise<TypesSourceData>;