/** * @file Walk parent directories to locate a file or directory by name. The * traversal includes the filesystem root (or the caller-supplied `stopAt` * boundary) — historically the loop exited at `dir === root` _before_ * visiting root itself, so a match at e.g. `/.foo` was never found. The * current shape visits root, then breaks. */ import type { FindUpOptions, FindUpSyncOptions } from './types.js'; /** * Find a file or directory by traversing up parent directories. Searches from * the starting directory upward to the filesystem root. Useful for finding * configuration files or project roots. * * @example * ;```ts * // Find package.json starting from current directory * const pkgPath = await findUp('package.json') * * // Find any of multiple config files * const configPath = await findUp(['.config.js', '.config.json']) * * // Find a directory instead of file * const nodeModules = await findUp('node_modules', { onlyDirectories: true }) * ``` * * @param name - Filename(s) to search for. * @param options - Search options including cwd and type filters. * * @returns Normalized absolute path if found, undefined otherwise */ export declare function findUp(name: string | string[] | readonly string[], options?: FindUpOptions | undefined): Promise; /** * Synchronously find a file or directory by traversing up parent directories. * Searches from the starting directory upward to the filesystem root or * `stopAt` directory. Useful for finding configuration files or project roots * in synchronous contexts. * * @example * ;```ts * // Find package.json starting from current directory * const pkgPath = findUpSync('package.json') * * // Find .git directory but stop at home directory * const gitPath = findUpSync('.git', { * onlyDirectories: true, * stopAt: process.env.HOME, * }) * * // Find any of multiple config files * const configPath = findUpSync(['.eslintrc.js', '.eslintrc.json']) * ``` * * @param name - Filename(s) to search for. * @param options - Search options including cwd, stopAt, and type filters. * * @returns Normalized absolute path if found, undefined otherwise */ export declare function findUpSync(name: string | string[] | readonly string[], options?: FindUpSyncOptions | undefined): string | undefined;