Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 73x | import { exactOptional, object, string, boolean } from '@metamask/superstruct';
import type { Infer } from '@metamask/superstruct';
import type { PathLike, existsSync } from 'node:fs';
import type { readFile, access } from 'node:fs/promises';
export type { PathLike };
// Throws if the path argument violates expectations (async version).
export type PathCaveat = (path: PathLike) => Promise<void>;
// Throws if the path argument violates expectations (sync version).
export type SyncPathCaveat = (path: PathLike) => void;
export type ReadFile = typeof readFile;
export type Access = typeof access;
export type ExistsSync = typeof existsSync;
export const fsConfigStruct = object({
rootDir: string(),
existsSync: exactOptional(boolean()),
promises: exactOptional(
object({
readFile: exactOptional(boolean()),
access: exactOptional(boolean()),
}),
),
});
export type FsCapability = Partial<{
existsSync: ExistsSync;
promises: Partial<{
readFile: ReadFile;
access: Access;
}>;
}>;
export type FsConfig = Infer<typeof fsConfigStruct>;
|