UNPKG

3.66 kBTypeScriptView Raw
1export type Task<T> = () => Promise<T>;
2export type SourceMapInput = import("@jridgewell/trace-mapping").SourceMapInput;
3export type TerserFormatOptions = import("terser").FormatOptions;
4export type TerserOptions = import("terser").MinifyOptions;
5export type TerserCompressOptions = import("terser").CompressOptions;
6export type TerserECMA = import("terser").ECMA;
7export type ExtractCommentsOptions =
8 import("./index.js").ExtractCommentsOptions;
9export type ExtractCommentsFunction =
10 import("./index.js").ExtractCommentsFunction;
11export type ExtractCommentsCondition =
12 import("./index.js").ExtractCommentsCondition;
13export type Input = import("./index.js").Input;
14export type MinimizedResult = import("./index.js").MinimizedResult;
15export type PredefinedOptions = import("./index.js").PredefinedOptions;
16export type CustomOptions = import("./index.js").CustomOptions;
17export type ExtractedComments = Array<string>;
18/**
19 * @template T
20 * @typedef {() => Promise<T>} Task
21 */
22/**
23 * Run tasks with limited concurrency.
24 * @template T
25 * @param {number} limit - Limit of tasks that run at once.
26 * @param {Task<T>[]} tasks - List of tasks to run.
27 * @returns {Promise<T[]>} A promise that fulfills to an array of the results
28 */
29export function throttleAll<T>(limit: number, tasks: Task<T>[]): Promise<T[]>;
30/**
31 * @template T
32 * @param fn {(function(): any) | undefined}
33 * @returns {function(): T}
34 */
35export function memoize<T>(fn: (() => any) | undefined): () => T;
36/**
37 * @param {Input} input
38 * @param {SourceMapInput | undefined} sourceMap
39 * @param {PredefinedOptions & CustomOptions} minimizerOptions
40 * @param {ExtractCommentsOptions | undefined} extractComments
41 * @return {Promise<MinimizedResult>}
42 */
43export function terserMinify(
44 input: Input,
45 sourceMap: SourceMapInput | undefined,
46 minimizerOptions: PredefinedOptions & CustomOptions,
47 extractComments: ExtractCommentsOptions | undefined
48): Promise<MinimizedResult>;
49export namespace terserMinify {
50 /**
51 * @returns {string | undefined}
52 */
53 function getMinimizerVersion(): string | undefined;
54}
55/**
56 * @param {Input} input
57 * @param {SourceMapInput | undefined} sourceMap
58 * @param {PredefinedOptions & CustomOptions} minimizerOptions
59 * @param {ExtractCommentsOptions | undefined} extractComments
60 * @return {Promise<MinimizedResult>}
61 */
62export function uglifyJsMinify(
63 input: Input,
64 sourceMap: SourceMapInput | undefined,
65 minimizerOptions: PredefinedOptions & CustomOptions,
66 extractComments: ExtractCommentsOptions | undefined
67): Promise<MinimizedResult>;
68export namespace uglifyJsMinify {
69 /**
70 * @returns {string | undefined}
71 */
72 function getMinimizerVersion(): string | undefined;
73}
74/**
75 * @param {Input} input
76 * @param {SourceMapInput | undefined} sourceMap
77 * @param {PredefinedOptions & CustomOptions} minimizerOptions
78 * @return {Promise<MinimizedResult>}
79 */
80export function swcMinify(
81 input: Input,
82 sourceMap: SourceMapInput | undefined,
83 minimizerOptions: PredefinedOptions & CustomOptions
84): Promise<MinimizedResult>;
85export namespace swcMinify {
86 /**
87 * @returns {string | undefined}
88 */
89 function getMinimizerVersion(): string | undefined;
90}
91/**
92 * @param {Input} input
93 * @param {SourceMapInput | undefined} sourceMap
94 * @param {PredefinedOptions & CustomOptions} minimizerOptions
95 * @return {Promise<MinimizedResult>}
96 */
97export function esbuildMinify(
98 input: Input,
99 sourceMap: SourceMapInput | undefined,
100 minimizerOptions: PredefinedOptions & CustomOptions
101): Promise<MinimizedResult>;
102export namespace esbuildMinify {
103 /**
104 * @returns {string | undefined}
105 */
106 function getMinimizerVersion(): string | undefined;
107}