export type RC = Record; export interface RCOptions { /** * The name of the configuration file. * @optional */ name?: string; /** * The directory where the configuration file is or should be written. * @optional */ dir?: string; /** * Specifies whether the configuration should be treated as a flat object. * @optional */ flat?: boolean; } /** * The default options for the configuration file. */ export declare const defaults: RCOptions; export declare function parse(contents: string, options?: RCOptions): T; /** * Parses a configuration string into an object. * @param {string} contents - The configuration data as a raw string. * @param {RCOptions} [options={}] - Options to control the parsing behaviour. See {@link RCOptions}. * @returns {RC} - The parsed configuration object. See {@link RC}. */ export declare function parseFile(path: string, options?: RCOptions): T; /** * Reads a configuration file from a default or specified location and parses its contents. * @param {RCOptions|string} [options] - Options for reading the configuration file, or the name of the configuration file. See {@link RCOptions}. * @returns {RC} - The parsed configuration object. See {@link RC}. */ export declare function read(options?: RCOptions | string): T; /** * Reads a custom configuration file from a default or specified location and parses its contents. * @param {RCOptions|string} [options] - Options for reading the configuration file, or the name of the configuration file. See {@link RCOptions}. * @returns {RC} - The parsed configuration object. * @deprecated Use {@link readUserConfig} instead, which uses `~/.config` following XDG conventions. */ export declare function readUser(options?: RCOptions | string): T; /** * Serialises a configuration object to a string format. * @param {RC} config - The configuration object to serialise. See {@link RC}. * @returns {string} - The serialised configuration string. */ export declare function serialize(config: T): string; /** * Writes a configuration object to a file in a default or specified location. * @param {RC} config - The configuration object to write. See {@link RC}. * @param {RCOptions|string} [options] - Options for writing the configuration file, or the name of the configuration file. See {@link RCOptions}. */ export declare function write(config: T, options?: RCOptions | string): void; /** * Writes a custom configuration object to a file in a default or specified location. * @param {RC} config - The configuration object to write. See {@link RC}. * @param {RCOptions|string} [options] - Options for writing the configuration file, or the name of the configuration file. See {@link RCOptions}. * @deprecated Use {@link writeUserConfig} instead, which uses `~/.config` following XDG conventions. */ export declare function writeUser(config: T, options?: RCOptions | string): void; /** * Resolves the directory used by the `*UserConfig` helpers: `$XDG_CONFIG_HOME` or `$HOME/.config`. * @returns {string} - The absolute path to the user configuration directory. */ export declare function userConfigDir(): string; /** * Reads a configuration file from `$XDG_CONFIG_HOME` or `$HOME/.config` and parses its contents. * @param {RCOptions|string} [options] - Options for reading the configuration file, or the name of the configuration file. See {@link RCOptions}. * @returns {RC} - The parsed configuration object. */ export declare function readUserConfig(options?: RCOptions | string): T; /** * Writes a configuration object to a file in `$XDG_CONFIG_HOME` or `$HOME/.config`. * @param {RC} config - The configuration object to write. See {@link RC}. * @param {RCOptions|string} [options] - Options for writing the configuration file, or the name of the configuration file. See {@link RCOptions}. */ export declare function writeUserConfig(config: T, options?: RCOptions | string): void; /** * Updates a configuration object in `$XDG_CONFIG_HOME` or `$HOME/.config` by merging and writing the result. * @param {RC} config - The configuration object to update. See {@link RC}. * @param {RCOptions|string} [options] - Options for updating the configuration file, or the name of the configuration file. See {@link RCOptions}. * @returns {RC} - The updated configuration object. */ export declare function updateUserConfig(config: T, options?: RCOptions | string): T; /** * Updates an existing configuration object by merging it with the contents of a configuration file and writing the result. * @param {RC} config - The configuration object to update. See {@link RC}. * @param {RCOptions|string} [options] - Options for updating the configuration file, or the name of the configuration file. See {@link RCOptions}. * @returns {RC} - The updated configuration object. See {@link RC}. */ export declare function update(config: T, options?: RCOptions | string): T; /** * Updates a custom configuration object by merging it with the contents of a configuration file in a default location and writing the result. * @param {RC} config - The configuration object to update. See {@link RC}. * @param {RCOptions|string} [options] - Options for updating the configuration file, or the name of the configuration file. See {@link RCOptions}. * @returns {RC} - The updated configuration object. See {@link RC}. * @deprecated Use {@link updateUserConfig} instead, which uses `~/.config` following XDG conventions. */ export declare function updateUser(config: T, options?: RCOptions | string): T;