source: trip-planner-front/node_modules/terser-webpack-plugin/types/index.d.ts

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 6.8 KB
Line 
1export default TerserPlugin;
2export type ExtractedCommentsInfo = {
3 extractedCommentsSource: import("webpack").sources.RawSource;
4 commentsFilename: string;
5};
6export type Schema = import("schema-utils/declarations/validate").Schema;
7export type Compiler = import("webpack").Compiler;
8export type Compilation = import("webpack").Compilation;
9export type WebpackError = import("webpack").WebpackError;
10export type Asset = import("webpack").Asset;
11export type TerserECMA = import("terser").ECMA;
12export type TerserMinifyOptions = import("terser").MinifyOptions;
13export type JestWorker = import("jest-worker").default;
14export type RawSourceMap = import("source-map").RawSourceMap;
15export type InternalMinifyOptions = import("./minify.js").InternalMinifyOptions;
16export type InternalMinifyResult = import("./minify.js").InternalMinifyResult;
17export type CustomMinifyOptions = import("./minify.js").CustomMinifyOptions;
18export type Rule = RegExp | string;
19export type Rules = Rule[] | Rule;
20export type MinifyWorker = MinifyWorker;
21export type ExtractCommentsFunction = (
22 astNode: any,
23 comment: {
24 value: string;
25 type: "comment1" | "comment2" | "comment3" | "comment4";
26 pos: number;
27 line: number;
28 col: number;
29 }
30) => boolean;
31export type ExtractCommentsCondition =
32 | boolean
33 | string
34 | RegExp
35 | ExtractCommentsFunction;
36export type ExtractCommentsFilename = string | ((fileData: any) => string);
37export type ExtractCommentsBanner =
38 | string
39 | boolean
40 | ((commentsFile: string) => string);
41export type ExtractCommentsObject = {
42 condition: ExtractCommentsCondition;
43 filename: ExtractCommentsFilename;
44 banner: ExtractCommentsBanner;
45};
46export type CustomMinifyFunction = (
47 fileAndCode: {
48 [file: string]: string;
49 },
50 sourceMap?: import("source-map").RawSourceMap | undefined,
51 minifyOptions: any
52) => any;
53export type ExtractCommentsOptions =
54 | ExtractCommentsCondition
55 | ExtractCommentsObject;
56export type PluginWithTerserOptions = {
57 test?: Rules | undefined;
58 include?: Rules | undefined;
59 exclude?: Rules | undefined;
60 terserOptions?: import("terser").MinifyOptions | undefined;
61 extractComments?: ExtractCommentsOptions | undefined;
62 parallel?: boolean | undefined;
63 minify?: CustomMinifyFunction | undefined;
64};
65export type PluginWithCustomMinifyOptions = {
66 test?: Rules | undefined;
67 include?: Rules | undefined;
68 exclude?: Rules | undefined;
69 terserOptions?: any;
70 extractComments?: ExtractCommentsOptions | undefined;
71 parallel?: boolean | undefined;
72 minify?: CustomMinifyFunction | undefined;
73};
74export type TerserPluginOptions =
75 | PluginWithTerserOptions
76 | PluginWithCustomMinifyOptions;
77/** @typedef {import("schema-utils/declarations/validate").Schema} Schema */
78/** @typedef {import("webpack").Compiler} Compiler */
79/** @typedef {import("webpack").Compilation} Compilation */
80/** @typedef {import("webpack").WebpackError} WebpackError */
81/** @typedef {import("webpack").Asset} Asset */
82/** @typedef {import("terser").ECMA} TerserECMA */
83/** @typedef {import("terser").MinifyOptions} TerserMinifyOptions */
84/** @typedef {import("jest-worker").default} JestWorker */
85/** @typedef {import("source-map").RawSourceMap} RawSourceMap */
86/** @typedef {import("./minify.js").InternalMinifyOptions} InternalMinifyOptions */
87/** @typedef {import("./minify.js").InternalMinifyResult} InternalMinifyResult */
88/** @typedef {import("./minify.js").CustomMinifyOptions} CustomMinifyOptions */
89/** @typedef {RegExp | string} Rule */
90/** @typedef {Rule[] | Rule} Rules */
91/** @typedef {JestWorker & { transform: (options: string) => InternalMinifyResult, minify: (options: InternalMinifyOptions) => InternalMinifyResult }} MinifyWorker */
92/**
93 * @callback ExtractCommentsFunction
94 * @param {any} astNode
95 * @param {{ value: string, type: 'comment1' | 'comment2' | 'comment3' | 'comment4', pos: number, line: number, col: number }} comment
96 * @returns {boolean}
97 */
98/**
99 * @typedef {boolean | string | RegExp | ExtractCommentsFunction} ExtractCommentsCondition
100 */
101/**
102 * @typedef {string | ((fileData: any) => string)} ExtractCommentsFilename
103 */
104/**
105 * @typedef {boolean | string | ((commentsFile: string) => string)} ExtractCommentsBanner
106 */
107/**
108 * @typedef {Object} ExtractCommentsObject
109 * @property {ExtractCommentsCondition} condition
110 * @property {ExtractCommentsFilename} filename
111 * @property {ExtractCommentsBanner} banner
112 */
113/**
114 * @callback CustomMinifyFunction
115 * @param {{ [file: string]: string }} fileAndCode
116 * @param {RawSourceMap} [sourceMap]
117 * @param {Object.<any, any>} minifyOptions
118 */
119/**
120 * @typedef {ExtractCommentsCondition | ExtractCommentsObject} ExtractCommentsOptions
121 */
122/**
123 * @typedef {Object} PluginWithTerserOptions
124 * @property {Rules} [test]
125 * @property {Rules} [include]
126 * @property {Rules} [exclude]
127 * @property {TerserMinifyOptions} [terserOptions]
128 * @property {ExtractCommentsOptions} [extractComments]
129 * @property {boolean} [parallel]
130 * @property {CustomMinifyFunction} [minify]
131 */
132/**
133 * @typedef {Object} PluginWithCustomMinifyOptions
134 * @property {Rules} [test]
135 * @property {Rules} [include]
136 * @property {Rules} [exclude]
137 * @property {Object.<any, any>} [terserOptions]
138 * @property {ExtractCommentsOptions} [extractComments]
139 * @property {boolean} [parallel]
140 * @property {CustomMinifyFunction} [minify]
141 */
142/**
143 * @typedef {PluginWithTerserOptions | PluginWithCustomMinifyOptions} TerserPluginOptions
144 */
145declare class TerserPlugin {
146 /**
147 * @private
148 * @param {any} input
149 * @returns {boolean}
150 */
151 private static isSourceMap;
152 /**
153 * @private
154 * @param {Error & { line: number, col: number}} error
155 * @param {string} file
156 * @param {Compilation["requestShortener"]} [requestShortener]
157 * @param {SourceMapConsumer} [sourceMap]
158 * @returns {Error}
159 */
160 private static buildError;
161 /**
162 * @private
163 * @param {boolean} parallel
164 * @returns {number}
165 */
166 private static getAvailableNumberOfCores;
167 /**
168 * @private
169 * @param {any} environment
170 * @returns {TerserECMA}
171 */
172 private static getEcmaVersion;
173 /**
174 * @param {TerserPluginOptions} options
175 */
176 constructor(options?: TerserPluginOptions);
177 options: {
178 test: Rules;
179 extractComments: ExtractCommentsOptions;
180 parallel: boolean;
181 include: Rules | undefined;
182 exclude: Rules | undefined;
183 minify: CustomMinifyFunction | undefined;
184 terserOptions: any;
185 };
186 /**
187 * @param {Compiler} compiler
188 * @param {Compilation} compilation
189 * @param {Record<string, import("webpack").sources.Source>} assets
190 * @param {{availableNumberOfCores: number}} optimizeOptions
191 * @returns {Promise<void>}
192 */
193 optimize(
194 compiler: Compiler,
195 compilation: Compilation,
196 assets: Record<string, import("webpack").sources.Source>,
197 optimizeOptions: {
198 availableNumberOfCores: number;
199 }
200 ): Promise<void>;
201 /**
202 * @param {Compiler} compiler
203 * @returns {void}
204 */
205 apply(compiler: Compiler): void;
206}
Note: See TracBrowser for help on using the repository browser.