import { r as RootFileOpenFailure } from "./root-file-DLWTdIAa.js"; import fs from "node:fs"; //#region node_modules/@kodelyth/fs-safe/dist/text-atomic.d.ts type WriteTextAtomicOptions$1 = { mode?: number; dirMode?: number; trailingNewline?: boolean; /** * When false, skip the temp-file and parent-directory fsync calls while * preserving the temp-file replace/rename behavior. * * Defaults to true. */ durable?: boolean; }; //#endregion //#region node_modules/@kodelyth/fs-safe/dist/json.d.ts declare function tryReadJsonSync(pathname: string): T | null; declare function writeJsonSync(pathname: string, data: unknown): void; declare class JsonFileReadError extends Error { readonly filePath: string; readonly reason: "read" | "parse"; constructor(filePath: string, reason: "read" | "parse", cause: unknown); } type RootStructuredFileReadResult = { ok: true; value: T; stat: fs.Stats; path: string; rootRealPath: string; } | { ok: false; reason: "open"; failure: RootFileOpenFailure; } | { ok: false; reason: "invalid" | "parse"; error: string; }; 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); }; type ReadRootJsonSyncOptions = Omit, "parse" | "validate" | "invalidMessage">; declare function readRootStructuredFileSync(options: ReadRootStructuredFileSyncOptions): RootStructuredFileReadResult; declare function readRootJsonSync(options: ReadRootJsonSyncOptions): RootStructuredFileReadResult; declare function readRootJsonObjectSync(options: ReadRootJsonSyncOptions): RootStructuredFileReadResult>; declare function tryReadJson(filePath: string): Promise; declare function readJson(filePath: string): Promise; declare function readJsonIfExists(filePath: string): Promise; declare function readJsonSync(filePath: string): T; type WriteJsonOptions = Pick; declare function writeJson(filePath: string, value: unknown, options?: WriteJsonOptions): Promise; //#endregion //#region src/infra/json-files.d.ts type WriteTextAtomicOptions = { mode?: number; dirMode?: number; trailingNewline?: boolean; durable?: boolean; }; declare function writeTextAtomic(filePath: string, content: string, options?: WriteTextAtomicOptions): Promise; //#endregion export { readJsonIfExists as a, readRootJsonSync as c, tryReadJsonSync as d, writeJson as f, readJson as i, readRootStructuredFileSync as l, writeTextAtomic as n, readJsonSync as o, writeJsonSync as p, JsonFileReadError as r, readRootJsonObjectSync as s, WriteTextAtomicOptions as t, tryReadJson as u };