import { type ITerminal } from '@rushstack/terminal';
import type { IInputsSnapshot, GetInputsSnapshotAsyncFn } from './incremental/InputsSnapshot';
import type { RushConfiguration } from '../api/RushConfiguration';
import type { RushConfigurationProject } from '../api/RushConfigurationProject';
export interface IProjectWatcherOptions {
    abortSignal: AbortSignal;
    getInputsSnapshotAsync: GetInputsSnapshotAsyncFn;
    debounceMs?: number;
    rushConfiguration: RushConfiguration;
    projectsToWatch: ReadonlySet<RushConfigurationProject>;
    terminal: ITerminal;
    initialSnapshot?: IInputsSnapshot | undefined;
}
export interface IProjectChangeResult {
    /**
     * The set of projects that have changed since the last iteration
     */
    changedProjects: ReadonlySet<RushConfigurationProject>;
    /**
     * Contains the git hashes for all tracked files in the repo
     */
    inputsSnapshot: IInputsSnapshot;
}
export interface IPromptGeneratorFunction {
    (isPaused: boolean): Iterable<string>;
}
/**
 * This class is for incrementally watching a set of projects in the repository for changes.
 *
 * We are manually using fs.watch() instead of `chokidar` because all we want from the file system watcher is a boolean
 * signal indicating that "at least 1 file in a watched project changed". We then defer to getInputsSnapshotAsync (which
 * is responsible for change detection in all incremental builds) to determine what actually chanaged.
 *
 * Calling `waitForChange()` will return a promise that resolves when the package-deps of one or
 * more projects differ from the value the previous time it was invoked. The first time will always resolve with the full selection.
 */
export declare class ProjectWatcher {
    private readonly _abortSignal;
    private readonly _getInputsSnapshotAsync;
    private readonly _debounceMs;
    private readonly _repoRoot;
    private readonly _rushConfiguration;
    private readonly _projectsToWatch;
    private readonly _terminal;
    private _initialSnapshot;
    private _previousSnapshot;
    private _forceChangedProjects;
    private _resolveIfChanged;
    private _onAbort;
    private _getPromptLines;
    private _lastStatus;
    private _renderedStatusLines;
    isPaused: boolean;
    constructor(options: IProjectWatcherOptions);
    pause(): void;
    resume(): void;
    invalidateProject(project: RushConfigurationProject, reason: string): boolean;
    invalidateAll(reason: string): void;
    clearStatus(): void;
    rerenderStatus(): void;
    setPromptGenerator(promptGenerator: IPromptGeneratorFunction): void;
    /**
     * Waits for a change to the package-deps of one or more of the selected projects, since the previous invocation.
     * Will return immediately the first time it is invoked, since no state has been recorded.
     * If no change is currently present, watches the source tree of all selected projects for file changes.
     * `waitForChange` is not allowed to be called multiple times concurrently.
     */
    waitForChangeAsync(onWatchingFiles?: () => void): Promise<IProjectChangeResult>;
    private _setStatus;
    /**
     * Determines which, if any, projects (within the selection) have new hashes for files that are not in .gitignore
     */
    private _computeChangedAsync;
    private _commitChanges;
    /**
     * Tests for inequality of the passed Maps. Order invariant.
     *
     * @returns `true` if the maps are different, `false` otherwise
     */
    private static _haveProjectDepsChanged;
    private static _enumeratePathsToWatch;
}
//# sourceMappingURL=ProjectWatcher.d.ts.map