/** The `_meta` key a JSON file faf renders carries its render hash under. */ export declare const RENDER_KEY = "one.faf/render"; /** `sha256:` of `text` (UTF-8). */ export declare function renderHash(text: string): string; /** How faf records its hash in a file: an HTML meta line, or a JSON `_meta` key. */ export type RenderFormat = 'html' | 'json'; /** * Whether the bytes of a whole file faf renders are exactly what faf wrote: * `match` — they carry faf's render hash, the hash is that of the rest of the * file, and the file is laid out exactly as faf writes it; `mismatch` — they * carry a render hash that no longer fits, or (project.html) a render line * that is not exactly faf's form (the file was edited since faf wrote it); * `none` — they carry no render hash (a file from before 7.13, or one faf * never wrote). The bytes are taken as they are: see {@link writeRendered} * for a file git checked out with CRLF line ends. */ export declare function renderOwnership(bytes: Uint8Array, format: RenderFormat): 'match' | 'mismatch' | 'none'; /** Options for {@link writeRendered}. */ export interface RenderedWriteOptions { /** The project folder the write must stay inside. */ root: string; /** How the hash is recorded: `html` (project.html) or `json` (the cards, server.json, a snapshot). */ format: RenderFormat; /** True when the bytes carry faf's older mark — a file faf wrote before render hashes. */ hasMark: (bytes: Buffer) => boolean; /** That mark in words, for the refusal of a file without it. */ mark: string; /** Replace the file whatever it holds — the explicit overwrite (`--force`). */ force?: boolean; } /** What {@link writeRendered} did. */ export type RenderedResult = 'created' | 'updated' | 'unchanged'; /** * Write the whole file faf renders at `path`: `render` (faf's text, without a * render hash) with faf's render hash added. The link rules and the atomic, * compare-before-rename write are safe-write's. A file already there is * replaced only when {@link renderOwnership} says `match`; with a `mismatch`, * or with no hash, it is refused (SafePathError `not-owned`) and left byte for * byte: * - " was edited since faf wrote it — faf left it unchanged. Use --force to replace it." * - with faf's older mark (written before 7.13): exactly faf's `render` → * nothing to change (`unchanged`); otherwise " has no faf render hash * (written before 7.13), so faf cannot tell whether it was edited — faf * left it unchanged. Use --force once to replace it; after that faf * recognises its own output." * - without the mark: " has no , so faf did not write it — faf left it unchanged." * `force` replaces it anyway. A file already holding exactly the new bytes is * not written again. A file whose every line ends CRLF (git's * `core.autocrlf`) is judged with those line ends read as LF, and is written * back with CRLF line ends. */ export declare function writeRendered(path: string, render: string, opts: RenderedWriteOptions): { path: string; result: RenderedResult; };