export = AsyncQueue; /** * @template T * @template K * @template R */ declare class AsyncQueue { /** * @param {Object} options options object * @param {string=} options.name name of the queue * @param {number=} options.parallelism how many items should be processed at once * @param {AsyncQueue=} options.parent parent queue, which will have priority over this queue and with shared parallelism * @param {function(T): K=} options.getKey extract key from item * @param {function(T, Callback): void} options.processor async function to process items */ constructor({ name, parallelism, parent, processor, getKey, }: { name?: string | undefined; parallelism?: number | undefined; parent?: AsyncQueue | undefined; getKey?: ((arg0: T) => K) | undefined; processor: (arg0: T, arg1: Callback) => void; }); _name: string; _parallelism: number; _processor: (arg0: T, arg1: Callback) => void; _getKey: (arg0: T) => K; /** @type {Map>} */ _entries: Map>; /** @type {ArrayQueue>} */ _queued: ArrayQueue>; /** @type {AsyncQueue[] | undefined} */ _children: AsyncQueue[] | undefined; _activeTasks: number; _willEnsureProcessing: boolean; _needProcessing: boolean; _stopped: boolean; _root: AsyncQueue; hooks: { /** @type {AsyncSeriesHook<[T]>} */ beforeAdd: AsyncSeriesHook<[T]>; /** @type {SyncHook<[T]>} */ added: SyncHook<[T]>; /** @type {AsyncSeriesHook<[T]>} */ beforeStart: AsyncSeriesHook<[T]>; /** @type {SyncHook<[T]>} */ started: SyncHook<[T]>; /** @type {SyncHook<[T, Error, R]>} */ result: SyncHook<[T, Error, R]>; }; /** * @returns {void} */ _ensureProcessing(): void; /** * @param {T} item an item * @param {Callback} callback callback function * @returns {void} */ add(item: T, callback: Callback): void; /** * @param {T} item an item * @returns {void} */ invalidate(item: T): void; /** * Waits for an already started item * @param {T} item an item * @param {Callback} callback callback function * @returns {void} */ waitFor(item: T, callback: Callback): void; /** * @returns {void} */ stop(): void; /** * @returns {void} */ increaseParallelism(): void; /** * @returns {void} */ decreaseParallelism(): void; /** * @param {T} item an item * @returns {boolean} true, if the item is currently being processed */ isProcessing(item: T): boolean; /** * @param {T} item an item * @returns {boolean} true, if the item is currently queued */ isQueued(item: T): boolean; /** * @param {T} item an item * @returns {boolean} true, if the item is currently queued */ isDone(item: T): boolean; /** * @param {AsyncQueueEntry} entry the entry * @returns {void} */ _startProcessing(entry: AsyncQueueEntry): void; /** * @param {AsyncQueueEntry} entry the entry * @param {WebpackError=} err error, if any * @param {R=} result result, if any * @returns {void} */ _handleResult( entry: AsyncQueueEntry, err?: WebpackError | undefined, result?: R | undefined, ): void; clear(): void; } declare namespace AsyncQueue { export { Callback }; } type Callback = ( err?: (WebpackError | null) | undefined, result?: T | undefined, ) => any; /** * @template T * @callback Callback * @param {(WebpackError | null)=} err * @param {T=} result */ /** * @template T * @template K * @template R */ declare class AsyncQueueEntry { /** * @param {T} item the item * @param {Callback} callback the callback */ constructor(item: T, callback: Callback); item: T; /** @type {typeof QUEUED_STATE | typeof PROCESSING_STATE | typeof DONE_STATE} */ state: typeof QUEUED_STATE | typeof PROCESSING_STATE | typeof DONE_STATE; callback: Callback; /** @type {Callback[] | undefined} */ callbacks: Callback[]; result: any; /** @type {WebpackError | undefined} */ error: WebpackError | undefined; } import ArrayQueue = require('./ArrayQueue'); import { AsyncSeriesHook } from 'tapable'; import { SyncHook } from 'tapable'; import WebpackError = require('../WebpackError'); declare const QUEUED_STATE: 0; declare const PROCESSING_STATE: 1; declare const DONE_STATE: 2;