import { TreeLike } from './tree'; /** * Checks if a specified file in a tree-like structure is a valid JSON file. * * This function determines whether a file at a given path within a tree-like structure * contains valid JSON content. It utilizes a `TreeAdapter` to interact with the tree structure, * allowing it to check for the existence of the file and to read its contents. * * @param tree - An object representing the tree-like structure. Must be compatible with the `TreeAdapter`. * @param filePath - The path to the file within the tree structure to be checked. * @returns `true` if the file exists and contains valid JSON content, otherwise `false`. * * @typeParam Tree - The type of the tree structure that extends `TreeLike`, ensuring compatibility with `TreeAdapter`. * * @example * // Assuming `projectFiles` is a tree-like structure that includes a file at 'data/config.json' * const isValidJson = HasJsonFile(projectFiles, 'data/config.json'); * console.log(isValidJson); // Outputs: true or false based on the file's content validity as JSON. */ export declare function HasJsonFile(tree: Tree, filePath: string): boolean; /** * Retrieves the contents of a JSON file and returns it as an object. * If the file does not exist and `create` flag is set to `true`, an empty JSON file will be created. * * @template T - The type of the returned JSON object. * @param tree - The file system tree-like object. * @param filePath - The path to the JSON file. * @param [create=false] - Flag indicating whether to create the file if it does not exist (default: false). * @throws If the JSON file does not exist and `create` flag is set to `false`. * @throws If the content of the JSON file could not be parsed. * @returns {T} The parsed JSON object. */ export declare function GetJsonFile(tree: TreeLike, filePath: string, create?: boolean): T; export interface UpdateJsonFileOptions { space?: string | number; /** * true - create the file if it does not exist */ create?: boolean; } export declare function UpdateJsonFile = Record>(tree: TreeLike, updaterOrJsonFile: T | ((jsonFile: T) => void), filePath: string, options?: UpdateJsonFileOptions): void; export declare function UpdateJsonFile = Record>(tree: TreeLike, updaterOrJsonFile: T | ((jsonFile: T) => Promise), filePath: string, options?: UpdateJsonFileOptions): Promise;