/** * @file Walk parent directories. `walkUp` is the lazy ancestor generator that * `fs/find` and package-root lookups build on: given a starting path it * yields that path, then each parent, up to and INCLUDING the filesystem root * (or a caller-supplied `stopAt` boundary). Lazy so a caller can stop early * without computing the whole chain. */ export interface WalkUpOptions { /** * Starting directory. Relative `from` values are resolved against this. * Defaults to `process.cwd()`. */ cwd?: string | undefined; /** * Last directory to yield (INCLUSIVE). Traversal stops after this path is * emitted. Defaults to the filesystem root. */ stopAt?: string | undefined; } /** * Lazily yield `from` and each of its ancestor directories, up to and including * the filesystem root (or `stopAt`). Each yielded path is normalized to forward * slashes. * * @example * ;```ts * for (const dir of walkUp('/a/b/c')) { * // '/a/b/c', '/a/b', '/a', '/' * } * * // Stop at a boundary (inclusive): * [...walkUp('/a/b/c', { stopAt: '/a' })] // ['/a/b/c', '/a/b', '/a'] * ``` * * @param from - Path to start from. Relative values resolve against `cwd`. * @param options - `cwd` and `stopAt` boundary. * * @returns Generator of normalized absolute directory paths. */ export declare function walkUp(from: string, options?: WalkUpOptions | undefined): Generator;