import { PrettierStyle } from '../style'; /** * Clears the in-memory Prettier module cache. * Call this in long-running processes to free memory when Prettier * versions are no longer needed. */ export declare function clearPrettierModuleCache(): void; /** * Result of detecting Prettier in a project. */ export interface PrettierDetectionResult { /** * Whether Prettier is available in the project. */ available: boolean; /** * The Prettier version from the project's node_modules. */ version?: string; /** * Reference to the bundled Prettier for resolving configs. * We use our bundled version to resolve configs (stable API), * but at formatting time, the project's version will be loaded dynamically. */ bundledPrettier?: typeof import('prettier'); } /** * Manages Prettier configuration detection and loading for a parse session. * * This class: * 1. Detects if Prettier is installed in the project * 2. Resolves Prettier config per-file (with overrides) * 3. Caches resolved configs for marker deduplication * 4. Creates PrettierStyle markers for source files * * The marker only stores the version and resolved config - at formatting time, * the correct version of Prettier will be loaded dynamically (like npx). */ export declare class PrettierConfigLoader { private readonly projectRoot; private detection?; private configCache; /** * Creates a new PrettierConfigLoader for a project. * * @param projectRoot The root directory of the project (where package.json is) */ constructor(projectRoot: string); /** * Detects Prettier in the project and loads our bundled version for config resolution. * Call this once at the start of parsing. */ detectPrettier(): Promise; /** * Gets the Prettier version from the project's package.json or node_modules. * Scans upward from projectRoot to support monorepo structures where Prettier * is installed at the repository root. */ private getPrettierVersionFromProject; /** * Finds the .prettierignore file by scanning upward from projectRoot. * Returns undefined if no .prettierignore file is found. */ private findPrettierIgnore; /** * Gets or creates a PrettierStyle marker for the given source file. * Returns undefined if Prettier is not available or no config applies to this file. * * @param filePath Absolute path to the source file */ getConfigMarker(filePath: string): Promise; /** * Clears the config cache. Call this between parse batches if needed. */ clearCache(): void; } /** * Dynamically loads a specific version of Prettier for formatting. * * This function will attempt to load Prettier in this order: * 1. From the in-memory cache (if already loaded) * 2. From the current working directory's node_modules (if version matches) * 3. From the cached npm project at ~/.cache/openrewrite/prettier// * 4. Install to cache and load from there * * Concurrent requests for the same version are deduplicated. * * @param version The Prettier version to load (e.g., "3.4.2") * @returns The loaded Prettier module */ export declare function loadPrettierVersion(version: string): Promise; //# sourceMappingURL=prettier-config-loader.d.ts.map