/** * @file The strictest of the three deletes. `fs/safe` widens by location and * its `forceDelete` drops the boundary; this one REFUSES a target it cannot * prove is safe, before any I/O touches the disk. * Reach for it wherever the target is BUILT from a variable, which is where * the failure lives: `path.join(base, '')` is `base`, so one empty segment * turns "remove this scratch directory" into "remove the tree it sits in". * `existsSync` answers TRUE for that path, so an existence check waves it * through, and the rename-then-delete shape common to cascade and staging * code completes before anything logs. */ import type { RemoveOptions } from './types.js'; /** * Options for a strict delete: the ordinary delete options plus the base the * target must sit strictly below. */ export interface StrictDeleteOptions extends RemoveOptions { /** * The directory the target must be strictly inside. Omit it to check only * the target-shape refusals (empty, dot-only, filesystem root). */ readonly base?: string | undefined; } /** * Throw when a target must never be deleted. */ export declare function assertDeletable(target: string, base?: string | undefined): void; /** * The reason a target must never be deleted, or undefined when it is fine. * * Four refusals, all before any I/O: an empty or dot-only target, a filesystem * root, and - when a `base` is named - a target that IS the base or sits * outside it. */ export declare function deleteRefusalReason(target: string, base?: string | undefined): string | undefined; /** * Delete a target only after proving it sits strictly below `options.base`. */ export declare function strictDelete(target: string, options?: StrictDeleteOptions | undefined): Promise; /** * Synchronous {@link strictDelete}. */ export declare function strictDeleteSync(target: string, options?: StrictDeleteOptions | undefined): void;