UNPKG

@mui/internal-docs-infra

Version:

MUI Infra - internal documentation creation tools.

40 lines 1.95 kB
import type { LoadSource } from "../../CodeHighlighter/types.mjs"; import type { StoreAtMode } from "../loaderUtils/processRelativeImports.mjs"; interface LoadServerCodeSourceOptions { maxDepth?: number; maxFiles?: number; includeDependencies?: boolean; storeAt?: StoreAtMode; /** * Prefixes for comments that should be stripped from the source output. * Comments starting with these prefixes will be removed from the returned source. * They can still be collected via `notableCommentsPrefix`. * @example ['@highlight', '@internal'] */ removeCommentsWithPrefix?: string[]; /** * Prefixes for notable comments that should be collected and included in the result. * Comments starting with these prefixes will be returned in the `comments` field. * @example ['@highlight', '@focus'] */ notableCommentsPrefix?: string[]; } /** * Default loadServerCodeSource function that reads a file and extracts its dependencies. * This function is used to load source files for demos, resolving their imports and dependencies. * It reads the source file, resolves its imports, and returns the processed source along with any * additional files and dependencies that were found. */ export declare const loadServerCodeSource: LoadSource; /** * Creates a loadSource function that reads a file and extracts its dependencies. * * @param options.storeAt - Controls how imports are stored in extraFiles: * - 'canonical': Full resolved path (e.g., '../Component/index.js') * - 'import': Import path with file extension (e.g., '../Component.js') * - 'flat': Flattened to current directory with rewritten imports (e.g., './Component.js') * @param options.removeCommentsWithPrefix - Prefixes for comments to strip from source * @param options.notableCommentsPrefix - Prefixes for comments to collect */ export declare function createLoadServerCodeSource(options?: LoadServerCodeSourceOptions): LoadSource; export {};