import fsSync from "node:fs"; import { type RootFileOpenFailure } from "./root-file.js"; import { type WriteTextAtomicOptions } from "./text-atomic.js"; export declare function tryReadJsonSync(pathname: string): T | null; export declare function writeJsonSync(pathname: string, data: unknown): void; export declare class JsonFileReadError extends Error { readonly filePath: string; readonly reason: "read" | "parse"; constructor(filePath: string, reason: "read" | "parse", cause: unknown); } export type RootStructuredFileReadResult = { ok: true; value: T; stat: fsSync.Stats; path: string; rootRealPath: string; } | { ok: false; reason: "open"; failure: RootFileOpenFailure; } | { ok: false; reason: "invalid" | "parse"; error: string; }; export type ReadRootStructuredFileSyncOptions = { rootDir: string; rootRealPath?: string; relativePath: string; boundaryLabel: string; rejectHardlinks?: boolean; maxBytes?: number; parse: (raw: string) => unknown; validate?: (value: unknown) => value is T; invalidMessage?: string | ((relativePath: string) => string); }; export type ReadRootJsonSyncOptions = Omit, "parse" | "validate" | "invalidMessage">; export declare function readRootStructuredFileSync(options: ReadRootStructuredFileSyncOptions): RootStructuredFileReadResult; export declare function readRootJsonSync(options: ReadRootJsonSyncOptions): RootStructuredFileReadResult; export declare function readRootJsonObjectSync(options: ReadRootJsonSyncOptions): RootStructuredFileReadResult>; export declare function tryReadJson(filePath: string): Promise; export declare function readJson(filePath: string): Promise; export declare function readJsonIfExists(filePath: string): Promise; export declare function readJsonSync(filePath: string): T; export type WriteJsonOptions = Pick; export declare function writeJson(filePath: string, value: unknown, options?: WriteJsonOptions): Promise; //# sourceMappingURL=json.d.ts.map