@mui/internal-docs-infra
Version:
MUI Infra - internal documentation creation tools.
39 lines • 2.34 kB
text/typescript
import { type TransformRuntimeDeps } from "../pipeline/loadIsomorphicCodeVariant/applyCodeTransformWithComments.mjs";
import type { VariantSource, VariantCode, Transforms, SourceComments, Fallbacks } from "../CodeHighlighter/types.mjs";
import type { FallbackNode } from "../CodeHighlighter/fallbackFormat.mjs";
import type { TransformedFiles } from "./useCodeUtils.mjs";
export type { TransformRuntimeDeps };
/**
* Function signature of {@link createTransformedFiles}. Used by the
* `transformEngineLoader` accessor and `useTransformManagement` so they can
* reference the engine without statically importing this (heavy) module.
*
* `deps` (the decoder + frame-fallback helper) is injected by the caller (the
* `useCode` shell already loads them) so this engine chunk doesn't statically
* depend on them.
*/
export type CreateTransformedFiles = (selectedVariant: VariantCode | null, selectedTransform: string | null, deps: TransformRuntimeDeps, fallbacks?: Fallbacks) => TransformedFiles | undefined;
/**
* Pure helper function to apply transform to a source file.
*
* @param source - The source code to transform
* @param fileName - The filename for the source
* @param transforms - Available transforms for this source
* @param selectedTransform - The transform to apply
* @param comments - Optional 1-indexed comment map for the source. Returned
* shifted onto the transformed source's line numbering.
* @returns Object with transformed source, name, and shifted comments
*/
export declare function applyTransformToSource(source: VariantSource, fileName: string, transforms: Transforms | undefined, selectedTransform: string, deps: TransformRuntimeDeps, comments?: SourceComments, fallback?: FallbackNode[]): {
transformedSource: VariantSource;
transformedName: string;
transformedComments?: SourceComments;
};
/**
* Pure function to create transformed files from a variant and selected transform.
*
* @param selectedVariant - The currently selected variant
* @param selectedTransform - The transform to apply
* @returns Object with transformed files and filename mapping, or undefined if no transform
*/
export declare function createTransformedFiles(selectedVariant: VariantCode | null, selectedTransform: string | null, deps: TransformRuntimeDeps, fallbacks?: Fallbacks): TransformedFiles | undefined;