import type { Consumer, TriConsumer, UnaryOperator } from "@rickosborne/typical"; /** * Configuration for a {@link writeText} call. */ export type WriteTextConfig = { /** * Override the console log handler, as you may want to do in * unit tests. */ consoleLog?: Consumer; /** * Ensure the text has a final newline. * @defaultValue true */ finalNewline?: boolean; /** * When logging the operation to the console, format the path to be * relative to this value. * @defaultValue process.cwd() */ relativeTo?: string; /** * Whether to log the operation to the console. * @defaultValue false */ silent?: boolean; /** * Override the underlying filesystem write handler, as you may * want to do in unit tests. */ writeFileSync?: TriConsumer; }; /** * Synchronously write a file as UTF-8 text. */ export declare const writeText: (filePath: string, text: string, config?: WriteTextConfig) => void; /** * Configuration for a {@link writeJson} call. */ export type WriteJsonConfig = WriteTextConfig & { /** * Perform any last-minute text replacements on the JSON before * it is written. */ modifyJson?: UnaryOperator; /** * Perform any pre-serialization modifications to the sorted version * of the value. */ modifySorted?: (value: T) => (void | undefined | T); /** * Indent width or text for JSON serialization. * @defaultValue "\\t" */ indent?: string | number; /** * Function for writing to the filesystem. Mostly used for unit tests. */ writeText?: typeof writeText; }; /** * Serialize and synchronously write out JSON to a UTF-8 text file. * Has some extra special handling for package.json files. */ export declare const writeJson: (filePath: string, value: unknown, config?: WriteJsonConfig) => void; //# sourceMappingURL=write-file.d.ts.map