/** * @file Private state shared between `fs/safe` and `fs/path-cache`. The * `shared.ts` filename keeps this module out of the generated package.json * `exports` map (the `dist/**\/shared.*` ignore pattern in * `scripts/repo/package-exports.config.mts` filters it out), so it is not * part of the public surface — it exists only to give the two leaves above a * common owner for the allowed-directory cache. The cache is invalidated by * `invalidatePathCache()` in `fs/path-cache.ts` whenever paths are rewired in * tests (`paths/rewire.ts` registers `invalidatePathCache` as one of its * cache callbacks); `getDefaultAllowedDirectories()` rehydrates on next call. */ /** * Whether every pattern resolves inside an allowed tree. * * `extraDirs` names additional roots for THIS call. The default roots stay * untouched: {@link getDefaultAllowedDirectories} hands back a fresh array, so * appending here cannot widen the allow-list for a later caller. * * @param patterns - Delete patterns, resolved against the process cwd. * @param extraDirs - Extra roots permitted for this call. * * @returns `true` when each pattern is contained by some allowed root. */ export declare function areAllPathsInAllowedDirs(patterns: readonly string[], extraDirs?: readonly string[] | undefined): boolean; /** * Clear the cached allowed-directories list. Used by `invalidatePathCache()` * when test path rewiring changes any of the underlying paths so the next read * picks up the new resolved values. */ export declare function clearDefaultAllowedDirectories(): void; /** * Get resolved allowed directories for safe deletion with lazy caching. These * directories are resolved once and cached for the process lifetime. * * BOTH the resolved and the real path of each directory are listed, because * they differ whenever a component is a symlink and a caller may hold either * form. On macOS, `os.tmpdir()` can contain a symlinked component. * A caller that uses `fs.realpathSync` holds the real path instead. * Listing both forms permits cleanup through either path to the allowed tree. */ export declare function getDefaultAllowedDirectories(): string[];