import { FSWatcher } from 'chokidar'; import { EventEmitter } from 'node:events'; import tmp from 'tmp-promise'; declare const getAPIToken: () => Promise; declare const shouldBase64Encode: (contentType: string) => boolean; interface DevEvent { name: string; } type DevEventHandler = (event: DevEvent) => void; type logFunction = (...message: unknown[]) => void; type Logger = { error: logFunction; log: logFunction; warn: logFunction; }; declare const ensureNetlifyIgnore: (dir: string, logger?: Logger) => Promise; declare const headers: { BlobsInfo: string; }; declare const toMultiValueHeaders: (headers: Headers) => Record; type ConfigStoreOptions> = { defaults?: T | undefined; }; declare class GlobalConfigStore = Record> { #private; constructor(options?: ConfigStoreOptions); get all(): T; set(key: string, value: unknown): void; get(key: string): T[typeof key]; private getConfig; private writeConfig; } declare const getGlobalConfigStore: () => Promise; declare const resetConfigCache: () => void; type globalConfig_GlobalConfigStore = Record> = GlobalConfigStore; declare const globalConfig_GlobalConfigStore: typeof GlobalConfigStore; declare const globalConfig_resetConfigCache: typeof resetConfigCache; declare namespace globalConfig { export { globalConfig_GlobalConfigStore as GlobalConfigStore, getGlobalConfigStore as default, globalConfig_resetConfigCache as resetConfigCache }; } type Handler = (request: Request) => Promise; declare class LocalState { private path; constructor(cwd: string); get all(): any; set all(val: any); get size(): number; get(key: any): string | undefined; set(...args: any[]): void; has(key: any): boolean; delete(key: any): void; clear(): void; } interface CacheEntry { enqueued?: boolean; task: Promise; timestamp: number; } type MemoizeCache = Record | undefined>; interface MemoizeOptions { cache: MemoizeCache; cacheKey: string; command: () => Promise; } declare const memoize: ({ cache, cacheKey, command }: MemoizeOptions) => Promise; /** * A Node.js HTTP server with support for middleware. */ declare class HTTPServer { private handler; private nodeServer?; constructor(handler: Handler); start(port?: number): Promise; stop(): Promise; } interface WatchDebouncedOptions { depth?: number; ignored?: (string | RegExp)[]; onAdd?: (paths: string[]) => void; onChange?: (paths: string[]) => void; onUnlink?: (paths: string[]) => void; } /** * Adds a file watcher to a path or set of paths and debounces the events. */ declare const watchDebounced: (target: string | string[], { depth, ignored, onAdd, onChange, onUnlink }: WatchDebouncedOptions) => Promise; interface EventInspectorOptions { debug?: boolean; } declare class EventInspector extends EventEmitter { debug: boolean; events: DevEvent[]; constructor({ debug }?: EventInspectorOptions); handleEvent(event: DevEvent): void; waitFor(filter: (event: DevEvent) => boolean, timeoutMs?: number): Promise; } type BodyFunction = (bufferedBody: string | null) => Promise | void; type HeadersFunction = (headers: Record) => Promise | void; type ResponseFunction = () => Promise | Response; interface ExpectedRequest { body?: string | BodyFunction; fulfilled: boolean; headers: Record | HeadersFunction; method: string; response: Response | ResponseFunction | Error; url: string; } interface ExpectedRequestOptions { body?: string | BodyFunction; headers?: Record | HeadersFunction; response: Response | ResponseFunction | Error; url: string; } declare class MockFetch { originalFetch: typeof globalThis.fetch; requests: ExpectedRequest[]; constructor(); private addExpectedRequest; delete(options: ExpectedRequestOptions): this; get(options: ExpectedRequestOptions): this; head(options: ExpectedRequestOptions): this; post(options: ExpectedRequestOptions): this; put(options: ExpectedRequestOptions): this; get fetch(): (...args: Parameters) => Promise; get fulfilled(): boolean; inject(): this; restore(): void; } declare class Fixture { directory?: tmp.DirectoryResult; files: Record; npmDependencies: Record; constructor(); private ensureDirectory; private installNpmDependencies; create(): Promise; deleteFile(path: string): Promise; destroy(): Promise; withFile(path: string, contents: string): this; withStateFile(state: object): this; writeFile(path: string, contents: string): Promise; withPackages(packages: Record): this; } export { type DevEvent, type DevEventHandler, EventInspector, Fixture, HTTPServer, type Handler, LocalState, type Logger, type MemoizeCache, MockFetch, ensureNetlifyIgnore, getAPIToken, globalConfig, headers, memoize, shouldBase64Encode, toMultiValueHeaders, watchDebounced };