import { type Logger } from '../utility/logging/logger.ts';
import type { Stats } from 'node:fs';
import { EventEmitter } from 'node:events';
import { FileAndURLPathConfig } from './Component.ts';
import { FilesOption } from './deriveGlobOptions.ts';
export interface BaseEntry {
    stats?: Stats;
    urlPath: string;
    absolutePath: string;
}
export interface FileEntry extends BaseEntry {
    contents: Buffer;
}
export interface EntryEvent extends BaseEntry {
    eventType: string;
    entryType: string;
}
export interface AddFileEvent extends EntryEvent, FileEntry {
    eventType: 'add';
    entryType: 'file';
}
export interface ChangeFileEvent extends EntryEvent, FileEntry {
    eventType: 'change';
    entryType: 'file';
}
export interface UnlinkFileEvent extends EntryEvent {
    eventType: 'unlink';
    entryType: 'file';
}
export type FileEntryEvent = AddFileEvent | ChangeFileEvent | UnlinkFileEvent;
export interface AddDirectoryEvent extends EntryEvent {
    eventType: 'addDir';
    entryType: 'directory';
}
export interface UnlinkDirectoryEvent extends EntryEvent {
    eventType: 'unlinkDir';
    entryType: 'directory';
}
export type DirectoryEntryEvent = AddDirectoryEvent | UnlinkDirectoryEvent;
export type onEntryEventHandler = (entry: FileEntryEvent | DirectoryEntryEvent) => void | Promise<void>;
export type EntryHandlerEventMap = {
    all: [entry: FileEntryEvent | DirectoryEntryEvent];
    close: [];
    error: [error: unknown];
    ready: [];
    initialLoadComplete: [];
    add: [entry: AddFileEvent];
    change: [entry: ChangeFileEvent];
    unlink: [entry: UnlinkFileEvent];
    addDir: [entry: AddDirectoryEvent];
    unlinkDir: [entry: UnlinkDirectoryEvent];
};
export declare class EntryHandler extends EventEmitter<EntryHandlerEventMap> {
    #private;
    ready: Promise<any[]>;
    constructor(name: string, directory: string, config: FilesOption | FileAndURLPathConfig, logger?: Logger);
    get name(): string;
    get directory(): string;
    _simulateWatcherErrorForTests(error: unknown): void;
    get _usingPollingForTests(): boolean;
    get _openCountForTests(): number;
    close(): Promise<this>;
    /**
     * Quiesce the watcher without tearing down the EntryHandler. Closes the
     * underlying chokidar watcher (releasing inotify handles for the watched
     * tree) but preserves all listeners attached to this instance, so plugins
     * that registered `scope.handleEntry(handler)` keep their handler wired up
     * across the pause.
     *
     * Idempotent. Awaiting `ready` while paused will not resolve until resume().
     */
    pause(): void;
    /**
     * Reinstate the watcher previously stopped by pause(). The fresh chokidar
     * instance does an initial scan and emits add events for every file
     * currently matching the configured globs — by design, since the typical
     * caller (Scope, on deploy:end) wants plugins to see the post-deploy tree
     * as if loading cold.
     *
     * No-op if not currently paused.
     */
    resume(): Promise<any[]>;
    update(config: FilesOption | FileAndURLPathConfig): Promise<any[]>;
}
