UNPKG

histoire

Version:

A fast story book powered by Vite

49 lines • 2.59 kB
/** Reserved generated run directory, shared only as a parent of isolated outputs. */ export declare const HISTOIRE_TEMP_PATH = ".histoire/tmp"; /** Resolves generated output ancestry without acquiring or deleting a run. */ export declare function getProjectTempDir(root: string): string; /** Caches kept across runs (optimizer output, story catalog). */ export declare function getProjectCacheDir(root: string): string; /** File published by the background story collection cache. */ export declare function getCollectionCacheFile(root: string): string; /** * Builds the temp directory owned by a single run. * * Runs empty their own directory when they start, so a directory shared between * runs (a dev-server test run concurrent with a `histoire build`, two CLI runs…) * would delete the generated files of any run still in flight. * @param root The project root. * @param kind Name of the generated artifacts, used as parent directory. */ export declare function getRunTempDir(root: string, kind: string): string; /** Short tag of this host, so runs never judge processes of another machine sharing the project. */ export declare function getHostTag(): string; /** * Produces a short stable disambiguator for a value used inside a generated * file name. Generated temp paths sanitize or flatten their source value * (`a/b` and `a b` both become `a_b`), so distinct sources can otherwise * resolve to the same file and silently overwrite each other. * @param value The raw value the temp path is derived from. */ export declare function hashPathSegment(value: string): string; /** * Builds the file-name segment a generated file is written under. * * Always disambiguated by {@link hashPathSegment}: the sanitized form is lossy * (`a/b` and `a b` both become `a_b`), so two sources would otherwise be * written to the same file and one of them silently dropped from the run. * @param value The raw value the segment is derived from. * @param sanitize How to turn the raw value into a file-name-safe form. */ export declare function toTempPathSegment(value: string, sanitize?: (value: string) => string): string; /** * Throws when two generated temp paths resolve to the same file, which would * silently drop one of them from the run. * @param entries Generated paths with a human-readable label of their source. * @param kind Name of the generated artifact, used in the error message. */ export declare function assertNoDuplicateTempPaths(entries: Array<{ path: string; label: string; }>, kind: string): void; //# sourceMappingURL=temp-paths.d.ts.map