import { C as CompressionType, e as ReadJsoncOptions, f as WriteJsoncOptions } from "./packem_shared/types.d-B-T1rDxl.js"; export type { g as JsoncFormattingOptions, h as JsoncParseOptions } from "./packem_shared/types.d-B-T1rDxl.js"; import 'node:fs'; import 'fdir'; /** * Asynchronously reads a JSONC (JSON with comments) file and parses it into a JavaScript value. * Supports `//` and `/* *\/` comments and, optionally, trailing commas via `jsonc-parser`. * @param path The path to the JSONC file. Can be a file URL or a string path. * @param options Optional configuration. See {@link ReadJsoncOptions}. * @returns A promise that resolves with the parsed value. * @example * ```javascript * import { readJsonc } from "@visulima/fs/jsonc"; * * const config = await readJsonc("./tsconfig.json", { allowTrailingComma: true }); * ``` */ declare const readJsonc: (path: URL | string, options?: ReadJsoncOptions) => Promise; /** * Synchronously reads a JSONC (JSON with comments) file and parses it into a JavaScript value. * Supports `//` and `/* *\/` comments and, optionally, trailing commas via `jsonc-parser`. * @param path The path to the JSONC file. Can be a file URL or a string path. * @param options Optional configuration. See {@link ReadJsoncOptions}. * @returns The parsed value. * @example * ```javascript * import { readJsoncSync } from "@visulima/fs/jsonc"; * * const config = readJsoncSync("./tsconfig.json", { allowTrailingComma: true }); * ``` */ declare const readJsoncSync: (path: URL | string, options?: ReadJsoncOptions) => unknown; /** * Asynchronously writes a value to a JSONC file. When `preserveComments` is `true` (the default) * and the target file already exists, existing comments and formatting are preserved by computing * a minimal diff against the new value via `jsonc-parser`'s `modify` API. * @param path The path to the JSONC file. Can be a file URL or a string path. * @param data The data to serialize. * @param options Optional configuration. See {@link WriteJsoncOptions}. * @returns A promise that resolves when the file has been written. * @example * ```javascript * import { writeJsonc } from "@visulima/fs/jsonc"; * * // Preserves comments inside an existing tsconfig.json * await writeJsonc("./tsconfig.json", { ...tsconfig, compilerOptions: { target: "es2024" } }); * ``` */ declare const writeJsonc: (path: URL | string, data: unknown, options?: WriteJsoncOptions) => Promise; /** * Synchronously writes a value to a JSONC file. When `preserveComments` is `true` (the default) * and the target file already exists, existing comments and formatting are preserved by computing * a minimal diff against the new value via `jsonc-parser`'s `modify` API. * @param path The path to the JSONC file. Can be a file URL or a string path. * @param data The data to serialize. * @param options Optional configuration. See {@link WriteJsoncOptions}. * @example * ```javascript * import { writeJsoncSync } from "@visulima/fs/jsonc"; * * writeJsoncSync("./tsconfig.json", updated); * ``` */ declare const writeJsoncSync: (path: URL | string, data: unknown, options?: WriteJsoncOptions) => void; export { type ReadJsoncOptions, type WriteJsoncOptions, readJsonc, readJsoncSync, writeJsonc, writeJsoncSync };