export type InputFileSystem = import("webpack").Compilation["inputFileSystem"]; export type Stats = import("fs").Stats; export type Task = () => Promise; /** * @template T * @param {(() => unknown) | undefined} fn The function to memoize. * @returns {() => T} A memoized function that returns the result of the original function. */ export function memoize(fn: (() => unknown) | undefined): () => T; /** * @param {InputFileSystem} inputFileSystem the input file system to use for reading the file. * @param {string} path the path to the file to read. * @returns {Promise} a promise that resolves to the content of the file. */ export function readFile( inputFileSystem: InputFileSystem, path: string, ): Promise; /** @typedef {import("webpack").Compilation["inputFileSystem"]} InputFileSystem */ /** @typedef {import("fs").Stats} Stats */ /** * @param {InputFileSystem} inputFileSystem the input file system to use for reading the file stats. * @param {string} path the path to the file or directory to get stats for. * @returns {Promise} a promise that resolves to the stats of the file or directory. */ export function stat( inputFileSystem: InputFileSystem, path: string, ): Promise; /** * @template T * @typedef {() => Promise} Task */ /** * Run tasks with limited concurrency. * @template T * @param {number} limit Limit of tasks that run at once. * @param {Task[]} tasks List of tasks to run. * @returns {Promise} A promise that fulfills to an array of the results */ export function throttleAll(limit: number, tasks: Task[]): Promise;